unuran-1.11.0/0000755001357500135600000000000014430713513010116 500000000000000unuran-1.11.0/config.h.in0000644001357500135600000001460414430713360012066 00000000000000/* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the `alarm' function. */ #undef HAVE_ALARM /* Define to 1 if you have the declaration of `alarm', and to 0 if you don't. */ #undef HAVE_DECL_ALARM /* Define to 1 if you have the declaration of `DBL_MAX', and to 0 if you don't. */ #undef HAVE_DECL_DBL_MAX /* Define to 1 if you have the declaration of `getopt', and to 0 if you don't. */ #undef HAVE_DECL_GETOPT /* Define to 1 if you have the declaration of `HUGE_VAL', and to 0 if you don't. */ #undef HAVE_DECL_HUGE_VAL /* Define to 1 if you have the declaration of `hypot', and to 0 if you don't. */ #undef HAVE_DECL_HYPOT /* Define to 1 if you have the declaration of `INFINITY', and to 0 if you don't. */ #undef HAVE_DECL_INFINITY /* Define to 1 if you have the declaration of `isfinite', and to 0 if you don't. */ #undef HAVE_DECL_ISFINITE /* Define to 1 if you have the declaration of `isinf', and to 0 if you don't. */ #undef HAVE_DECL_ISINF /* Define to 1 if you have the declaration of `isnan', and to 0 if you don't. */ #undef HAVE_DECL_ISNAN /* Define to 1 if you have the declaration of `log1p', and to 0 if you don't. */ #undef HAVE_DECL_LOG1P /* Define to 1 if you have the declaration of `signal', and to 0 if you don't. */ #undef HAVE_DECL_SIGNAL /* Define to 1 if you have the declaration of `snprintf', and to 0 if you don't. */ #undef HAVE_DECL_SNPRINTF /* Define to 1 if you have the declaration of `vsnprintf', and to 0 if you don't. */ #undef HAVE_DECL_VSNPRINTF /* Define to 1 if "1.0/0.0" results in INFINITY */ #undef HAVE_DIVIDE_BY_ZERO /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define to 1 if you have the header file. */ #undef HAVE_FLOAT_H /* Define to 1 if you have the `floor' function. */ #undef HAVE_FLOOR /* Define to 1 if you have the `gettimeofday' function. */ #undef HAVE_GETTIMEOFDAY /* Define to 1 if you have the header file. */ #undef HAVE_GSL_GSL_RNG_H /* Define to 1 if "x != x" is true for NaNs */ #undef HAVE_IEEE_COMPARISONS /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `gsl' library (-lgsl). */ #undef HAVE_LIBGSL /* Define to 1 if you have the `gslcblas' library (-lgslcblas). */ #undef HAVE_LIBGSLCBLAS /* Define to 1 if you have the `m' library (-lm). */ #undef HAVE_LIBM /* Define to 1 if you have the `prng' library (-lprng). */ #undef HAVE_LIBPRNG /* Define to 1 if you have the `Rmath' library (-lRmath). */ #undef HAVE_LIBRMATH /* Define to 1 if you have the `rngstreams' library (-lrngstreams). */ #undef HAVE_LIBRNGSTREAMS /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H /* Define to 1 if you have the `memset' function. */ #undef HAVE_MEMSET /* Define to 1 if you have the `pow' function. */ #undef HAVE_POW /* Define to 1 if you have the header file. */ #undef HAVE_PRNG_H /* Define to 1 if you have the header file. */ #undef HAVE_RNGSTREAM_H /* Define to 1 if you have the `signal' function. */ #undef HAVE_SIGNAL /* Define to 1 if you have the `sqrt' function. */ #undef HAVE_SQRT /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDIO_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `strcasecmp' function. */ #undef HAVE_STRCASECMP /* Define to 1 if you have the `strchr' function. */ #undef HAVE_STRCHR /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strtol' function. */ #undef HAVE_STRTOL /* Define to 1 if you have the `strtoul' function. */ #undef HAVE_STRTOUL /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to the sub-directory where libtool stores uninstalled libraries. */ #undef LT_OBJDIR /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to 1 if all of the C90 standard headers exist (not just the ones required in a freestanding environment). This macro is provided for backward compatibility; new code need not use it. */ #undef STDC_HEADERS /* Define to 1 if you use random number generators from GNU Scientific Library. */ #undef UNURAN_HAS_GSL /* Define to 1 if you use Otmar Lendl's PRNG library. */ #undef UNURAN_HAS_PRNG /* Define to 1 if you use Pierre L'Ecuyer's RNGSTREAM library. */ #undef UNURAN_HAS_RNGSTREAM /* Define to 1 if you want to use magic cookies to validate type of a pointer */ #undef UNUR_COOKIES /* Define to 1 if you want to perform additional checks against an invalid NULL pointer */ #undef UNUR_ENABLE_CHECKNULL /* Define to 1 if you want to use the info routine for printing informations about UNU.RAN objects */ #undef UNUR_ENABLE_INFO /* Define to 1 if you want to use a logfile for logging informations about UNU.RAN objects */ #undef UNUR_ENABLE_LOGGING /* Define to 1 if you use RNGSTREAM as global URNG. */ #undef UNUR_URNG_DEFAULT_RNGSTREAM /* Define to 1 if you want to use deprecated code. */ #undef USE_DEPRECATED_CODE /* Define to 1 if you want to use experimental code */ #undef USE_EXPERIMENTAL_CODE /* Version number of package */ #undef VERSION /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus #undef inline #endif /* Define to `unsigned int' if does not define. */ #undef size_t unuran-1.11.0/ChangeLog0000644001357500135600000000001514420445767011620 00000000000000see NEWS fileunuran-1.11.0/tests/0000755001357500135600000000000014430713513011260 500000000000000unuran-1.11.0/tests/t_tdr.conf0000644001357500135600000004140414420445767013202 00000000000000############################################################################# [main] [main - data:] # method method: TDR [main - header:] /* prototypes */ double pdf( double x, const UNUR_DISTR *distr ); double pdf_bimodal( double x, const UNUR_DISTR *distr ); double dpdf_bimodal( double x, const UNUR_DISTR *distr ); double pdf_negative( double x, const UNUR_DISTR *distr ); double dpdf_negative( double x, const UNUR_DISTR *distr ); double pdf_partnegative( double x, const UNUR_DISTR *distr ); double dpdf_partnegative( double x, const UNUR_DISTR *distr ); \#define COMPARE_SAMPLE_SIZE (10000) \#define VIOLATE_SAMPLE_SIZE (20) ############################################################################# [new] [new - invalid NULL ptr: distr = NULL; ] ~( distr ); --> expected_NULL --> UNUR_ERR_NULL [new - invalid distribution type: distr = unur_distr_discr_new(); ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID [new - data missing in distribution object: distr = unur_distr_cont_new(); ] /* pdf, dpdf */ ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED /* dpdf */ unur_distr_cont_set_pdf(distr,pdf); ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED ############################################################################# [set] [set - invalid NULL ptr: par = NULL; ] ~_cpoints( par, 0, NULL ); --> expected_setfailed --> UNUR_ERR_NULL ~_reinit_percentiles( par, 0, NULL ); --> expected_setfailed --> UNUR_ERR_NULL ~_guidefactor( par, 1. ); --> expected_setfailed --> UNUR_ERR_NULL ~_max_sqhratio( par, 0.95 ); --> expected_setfailed --> UNUR_ERR_NULL ~_max_intervals( par, 100 ); --> expected_setfailed --> UNUR_ERR_NULL ~_usecenter( par, 1 ); --> expected_setfailed --> UNUR_ERR_NULL ~_usemode( par, 1 ); --> expected_setfailed --> UNUR_ERR_NULL ~_variant_gw( par ); --> expected_setfailed --> UNUR_ERR_NULL ~_variant_ps( par ); --> expected_setfailed --> UNUR_ERR_NULL ~_variant_ia( par ); --> expected_setfailed --> UNUR_ERR_NULL ~_usedars( par, TRUE ); --> expected_setfailed --> UNUR_ERR_NULL ~_darsfactor( par, 1. ); --> expected_setfailed --> UNUR_ERR_NULL ~_c( par, -0.5 ); --> expected_setfailed --> UNUR_ERR_NULL ~_verify( par, 1 ); --> expected_setfailed --> UNUR_ERR_NULL ~_pedantic( par, 1 ); --> expected_setfailed --> UNUR_ERR_NULL [set - invalid parameter object: double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_arou_new(distr); ] ~_cpoints( par, 0, NULL ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_reinit_percentiles( par, 0, NULL ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_guidefactor( par, 1. ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_max_sqhratio( par, 0.95 ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_max_intervals( par, 100 ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_usecenter( par, 1 ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_usemode( par, 1 ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_variant_gw( par ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_variant_ps( par ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_variant_ia( par ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_usedars( par, TRUE ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_darsfactor( par, 1. ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_c( par, -0.5 ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_verify( par, 1 ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_pedantic( par, 1 ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID unur_par_free(par); [set - invalid parameters: double perc[] = {0.1,0.4,0.2}; double stp[] = {1.,0.,1.}; int n_stp = 3; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_tdr_new(distr); ] ~_cpoints( par, -1, NULL ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_cpoints( par, n_stp, stp ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_reinit_percentiles( par, -1, NULL ); --> none --> UNUR_ERR_PAR_SET ~_reinit_percentiles( par, n_stp, stp ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_reinit_percentiles( par, n_stp, perc ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_guidefactor( par, -1. ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_max_sqhratio( par, -1. ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_max_sqhratio( par, 2. ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_max_intervals( par, 0 ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_usedars( par, -1 ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_darsfactor( par, -1. ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_c( par, 0.5 ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_c( par, -0.6 ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_c( par, -0.3 ); --> none --> UNUR_ERR_PAR_SET unur_par_free(par); ############################################################################# [get] [get - invalid generator object: distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); gen = unur_init(par); <-- ! NULL ] ~_sqhratio(gen); --> expected_INFINITY --> UNUR_ERR_GEN_INVALID ~_hatarea(gen); --> expected_INFINITY --> UNUR_ERR_GEN_INVALID ~_squeezearea(gen); --> expected_INFINITY --> UNUR_ERR_GEN_INVALID ############################################################################# [chg] [chg - invalid generator object: double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_arou_new(distr); unur_set_debug(par,0); gen = unur_init( par ); <-- ! NULL ] ~_reinit_percentiles(gen, -1, NULL ); --> expected_setfailed --> UNUR_ERR_GEN_INVALID ~_verify(gen,1); --> expected_setfailed --> UNUR_ERR_GEN_INVALID [chg - invalid parameters: double percmon[] = {0.1,0.4,0.2}; double percdom[] = {0.1,0.4,2.}; int n_perc = 3; distr = unur_distr_normal(NULL,0); par = unur_tdr_new(distr); unur_set_debug(par,0); gen = unur_init( par ); <-- ! NULL ] ~_reinit_percentiles( gen, -1, NULL ); --> none --> UNUR_ERR_PAR_SET ~_reinit_percentiles( gen, n_perc, percmon ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_reinit_percentiles( gen, n_perc, percdom ); --> expected_setfailed --> UNUR_ERR_PAR_SET ############################################################################# [init] [init - invalid NULL ptr: par = NULL; ] unur_init( par ); --> expected_NULL --> UNUR_ERR_NULL [init - stp out of domain: double stp[] = {-2.5,-1.,0.,1.,2.5}; int n_stp = 5; gen = NULL; distr = unur_distr_normal(NULL,0); unur_distr_cont_set_domain(distr,-2.,2.); par = unur_tdr_new(distr); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints( par, n_stp, stp ); ] gen = unur_init( par ); --> none --> UNUR_ERR_GEN_DATA [init - bimodal: gen = NULL; distr = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr,pdf_bimodal); unur_distr_cont_set_dpdf(distr,dpdf_bimodal); par = unur_tdr_new(distr); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints( par, 30, NULL ); ] gen = unur_init( par ); --> expected_NULL --> UNUR_ERR_GEN_CONDITION [init - wrong mode: gen = NULL; distr = unur_distr_normal(NULL,0); par = NULL; ] unur_distr_cont_set_mode(distr,-1.); par = unur_tdr_new(distr); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints( par, 30, NULL ); gen = unur_init( par ); --> expected_NULL --> UNUR_ERR_GEN_DATA unur_distr_cont_set_mode(distr,1.); par = unur_tdr_new(distr); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints( par, 30, NULL ); gen = unur_init( par ); --> none --> UNUR_ERR_GEN_DATA [init - negative value of pdf: gen = NULL; distr = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr,pdf_negative); unur_distr_cont_set_dpdf(distr,dpdf_negative); par = NULL; ] par = unur_tdr_new(distr); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints( par, 30, NULL ); gen = unur_init( par ); --> expected_NULL --> UNUR_ERR_GEN_DATA unur_distr_cont_set_domain(distr,-2.,2.); par = unur_tdr_new(distr); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints( par, 30, NULL ); gen = unur_init( par ); --> expected_NULL --> UNUR_ERR_GEN_DATA ############################################################################# [reinit] [reinit - exist: distr = unur_distr_normal(NULL,0); par = unur_tdr_new(distr); gen = unur_init( par ); <-- ! NULL ] unur_reinit( gen ); --> expected_reinit ############################################################################# [sample] [sample - invalid NULL ptr: gen = NULL; ] unur_tdr_eval_invcdfhat(gen,0.5,NULL,NULL,NULL); --> expected_INFINITY --> UNUR_ERR_NULL #..................................................................... [sample - invalid generator object: distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); gen = unur_init(par); <-- ! NULL ] unur_tdr_eval_invcdfhat(gen,0.5,NULL,NULL,NULL); --> expected_INFINITY --> UNUR_ERR_GEN_INVALID #..................................................................... [sample - invalid domain: distr = unur_distr_normal(NULL,0); par = unur_tdr_new(distr); unur_set_debug(par,0); gen = unur_init( par ); <-- ! NULL ] unur_tdr_eval_invcdfhat(gen,1.5,NULL,NULL,NULL); --> expected_INFINITY --> UNUR_ERR_DOMAIN unur_tdr_eval_invcdfhat(gen,-0.5,NULL,NULL,NULL); --> expected_negINFINITY --> UNUR_ERR_DOMAIN #..................................................................... [sample - partial negative value of pdf: int i; double x; double stp[] = {-0.9,0.9}; int n_stp = 2; distr = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr,pdf_partnegative); unur_distr_cont_set_dpdf(distr,dpdf_partnegative); par = unur_tdr_new(distr); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_usecenter(par,FALSE); unur_tdr_set_cpoints( par, n_stp, stp ); unur_tdr_set_pedantic( par, 1 ); gen = unur_init( par ); <-- ! NULL ] for (i=0; i<100; i++) { x = unur_sample_cont(gen); } x; --> expected_INFINITY --> UNUR_ERR_GEN_CONDITION #..................................................................... [sample - compare: distr = unur_distr_normal(NULL,0); par = NULL; ] # T = -1/sqrt /* GW, c = -0.5 */ par = unur_tdr_new(distr); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); -->compare_sequence_par_start /* GW, c = -0.5 - verifying mode */ par = unur_tdr_new(distr); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_verify(par,1); unur_tdr_set_usedars(par,FALSE); -->compare_sequence_par /* PS, c = -0.5 */ par = unur_tdr_new(distr); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); -->compare_sequence_par_start /* PS, c = -0.5 - verifying mode */ par = unur_tdr_new(distr); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_verify(par,1); unur_tdr_set_usedars(par,FALSE); -->compare_sequence_par /* IA, c = -0.5 */ par = unur_tdr_new(distr); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); -->compare_sequence_par_start /* IA, c = -0.5 - verifying mode */ par = unur_tdr_new(distr); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_verify(par,1); unur_tdr_set_usedars(par,FALSE); -->compare_sequence_par # T = log /* GW, c = 0 */ par = unur_tdr_new(distr); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); -->compare_sequence_par_start /* GW, c = 0, verifying mode */ par = unur_tdr_new(distr); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_verify(par,1); unur_tdr_set_usedars(par,FALSE); -->compare_sequence_par /* PS, c = 0 */ par = unur_tdr_new(distr); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); -->compare_sequence_par_start /* PS, c = 0, verifying mode */ par = unur_tdr_new(distr); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_verify(par,1); unur_tdr_set_usedars(par,FALSE); -->compare_sequence_par /* IA, c = 0 */ par = unur_tdr_new(distr); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); -->compare_sequence_par_start /* IA, c = 0, verifying mode */ par = unur_tdr_new(distr); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); unur_tdr_set_verify(par,1); unur_tdr_set_usedars(par,FALSE); -->compare_sequence_par #..................................................................... [sample - compare clone: UNUR_GEN *clone; distr = unur_distr_normal(NULL,0); par = NULL; gen = NULL; ] /* original generator object */ par = unur_tdr_new(distr); unur_tabl_set_max_sqhratio(par,0.); gen = unur_init(par); -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen #..................................................................... [sample - compare stringparser: double fpar[2] = {3.,3.}; distr = NULL; par = NULL; gen = NULL; ] distr = unur_distr_gamma(fpar,2); unur_distr_cont_set_center(distr,2.1); par = unur_tdr_new(distr); unur_tdr_set_cpoints(par,20,NULL); unur_tdr_set_guidefactor(par,2.); unur_tdr_set_max_intervals(par,32); unur_tdr_set_max_sqhratio(par,0.9); unur_tdr_set_usecenter(par,TRUE); unur_tdr_set_verify(par,TRUE); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "gamma(3.,3.); center = 2.1 & \ method = tdr; usecenter; cpoints = 20; guidefactor = 2.; \ max_intervals = 32; max_sqhratio = 0.9; verify" ); -->compare_sequence_gen unur_free(gen); gen = NULL; distr = unur_distr_gamma(fpar,2); par = unur_tdr_new(distr); unur_tdr_set_cpoints(par,9,NULL); unur_tdr_set_pedantic(par,TRUE); unur_tdr_set_usemode(par,FALSE); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "gamma(3.,3.) & \ method = tdr; cpoints = 9; pedantic; usemode = false" ); -->compare_sequence_gen unur_free(gen); gen = NULL; distr = unur_distr_gamma(fpar,2); par = unur_tdr_new(distr); unur_tdr_set_c(par,0.); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "gamma(3.,3.) & \ method = tdr; c = 0." ); -->compare_sequence_gen unur_free(gen); gen = NULL; distr = unur_distr_gamma(fpar,2); par = unur_tdr_new(distr); unur_tdr_set_c(par,-0.5); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "gamma(3.,3.) & \ method = tdr; c = -0.5" ); -->compare_sequence_gen unur_free(gen); gen = NULL; distr = unur_distr_gamma(fpar,2); par = unur_tdr_new(distr); unur_tdr_set_variant_gw(par); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "gamma(3.,3.) & \ method = tdr; variant_gw" ); -->compare_sequence_gen unur_free(gen); gen = NULL; distr = unur_distr_gamma(fpar,2); par = unur_tdr_new(distr); unur_tdr_set_variant_ia(par); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "gamma(3.,3.) & \ method = tdr; variant_ia" ); -->compare_sequence_gen unur_free(gen); gen = NULL; distr = unur_distr_gamma(fpar,2); par = unur_tdr_new(distr); unur_tdr_set_variant_ps(par); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "gamma(3.,3.) & \ method = tdr; variant_ps" ); -->compare_sequence_gen ############################################################################# # [validate] ############################################################################# [verbatim] /* pdf of bimodal density */ double pdf_bimodal( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return ( exp(-(x-1.)*(x-1.)) + exp(-(x+1.)*(x+1.)) ); } double dpdf_bimodal( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return ( -2. * (x-1.) * exp(-(x-1.)*(x-1.)) -2. * (x+1.) * exp(-(x+1.)*(x+1.)) ); } /* pdf with negative value */ double pdf_negative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return (-x*x); } double dpdf_negative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return (-2.*x); } /* pdf with partial negative value */ double pdf_partnegative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return ((x>-0.89 && x<0.89) ? -1.: exp(-x*x)); } double dpdf_partnegative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return ((x>-0.89 && x<0.89) ?0.: -2.*x*exp(-x*x)); } /* pdf of normal density */ double pdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return exp(-x*x/2.); } /* end of pdf */ ############################################################################# unuran-1.11.0/tests/t_tdr_gw.c0000644001357500135600000103447714430713513013175 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for TDR **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ double pdf_sqrtlin( double x, const UNUR_DISTR *distr ); double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ); double cdf_sqrtlin( double x, const UNUR_DISTR *distr ); double pdf_sqrtlinshft(double x, const UNUR_DISTR *distr ); double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); #define COMPARE_SAMPLE_SIZE (10000) #define VIOLATE_SAMPLE_SIZE (20) /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ /* pdf with piecewise linear function as transformed density with T = -1/sqrt */ double pdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y = 1./(fabs(x)+1.); return y*y; } double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y = 1./(fabs(x)+1.); y = 2.*y*y*y; return ((x<0.) ? y : - y); } double cdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { if (x<=0.) return 0.5/(1.-x); else return (1.-0.5/(1.+x)); } /* pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode */ double pdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y; x -= 1000.; y = 1./(fabs(x)+1.); return y*y; } double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y; x -= 1000.; y = 1./(fabs(x)+1.); y = 2.*y*y*y; return ((x<0.) ? y : - y); } double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { x -= 1000.; if (x<=0.) return 0.5/(1.-x); else return (1.-0.5/(1.+x)); } /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [validate] */ /*---------------------------------------------------------------------------*/ /* [validate] */ void test_validate (void) { /* suppress GCC compiler warning */ GCC_DIAG_OFF(unused-variable) UNUR_DISTR *distr[32]; UNUR_PAR *par; UNUR_GEN *gen; double *darray; double fpm[10]; int n_tests_failed; int rcode; /* start test */ printf("[validate "); fflush(stdout); fprintf(TESTLOG,"\n[validate]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* distributions: 32 */ { fpm[0] = 1.; fpm[1] = 2.; distr[0] = unur_distr_beta(fpm,2); } { fpm[0] = 1.; fpm[1] = 5.; distr[1] = unur_distr_beta(fpm,2); } { fpm[0] = 1.; fpm[1] = 100.; distr[2] = unur_distr_beta(fpm,2); } { fpm[0] = 2.; fpm[1] = 5.; distr[30] = unur_distr_beta(fpm,2); } { fpm[0] = 5.; fpm[1] = 2.; distr[31] = unur_distr_beta(fpm,2); } { fpm[0] = 3.; fpm[1] = 4.; distr[3] = unur_distr_beta(fpm,2); } { fpm[0] = 5.; fpm[1] = 100.; distr[4] = unur_distr_beta(fpm,2); } { fpm[0] = 500.; fpm[1] = 300.; distr[5] = unur_distr_beta(fpm,2); } { fpm[0] = 5.; fpm[1] = 10.; fpm[2] = -3.; fpm[3] = 15.; distr[6] = unur_distr_beta(fpm,4); } { distr[7] = unur_distr_cauchy(NULL,0); } { fpm[0] = 1.; fpm[1] = 20.; distr[8] = unur_distr_cauchy(fpm,2); } { distr[24] = unur_distr_exponential(NULL,0); } { fpm[0] = 30.; fpm[1] = -5.; distr[25] = unur_distr_exponential(fpm,2); } { fpm[0] = 1.; distr[9] = unur_distr_gamma(fpm,1); } { fpm[0] = 2.; distr[10] = unur_distr_gamma(fpm,1); } { fpm[0] = 3.; distr[11] = unur_distr_gamma(fpm,1); } { fpm[0] = 10.; distr[12] = unur_distr_gamma(fpm,1); } { fpm[0] = 1000.; distr[13] = unur_distr_gamma(fpm,1); } { fpm[0] = 5.; fpm[1] = 1000.; distr[14] = unur_distr_gamma(fpm,2); } { fpm[0] = 5.; fpm[1] = 1.e-5; distr[15] = unur_distr_gamma(fpm,2); } { fpm[0] = 5.; fpm[1] = 10.; fpm[2] = 1000.; distr[16] = unur_distr_gamma(fpm,3); } { distr[26] = unur_distr_laplace(NULL,0); } { fpm[0] = -10.; fpm[1] = 100.; distr[27] = unur_distr_laplace(fpm,2); } { distr[17] = unur_distr_normal(NULL,0); } { fpm[0] = 1.; fpm[1] = 1.e-5; distr[18] = unur_distr_normal(fpm,2); } { fpm[0] = 0.; fpm[1] = 1.e+5; distr[19] = unur_distr_normal(fpm,2); } { distr[20] = unur_distr_uniform(NULL,0); } { fpm[0] = 1.; fpm[1] = 20.; distr[21] = unur_distr_uniform(fpm,2); } { distr[28] = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr[28],pdf_sqrtlin); unur_distr_cont_set_dpdf(distr[28],dpdf_sqrtlin); unur_distr_cont_set_cdf(distr[28],cdf_sqrtlin); unur_distr_set_name(distr[28],"sqrtlin"); } { distr[29] = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr[29],pdf_sqrtlinshft); unur_distr_cont_set_dpdf(distr[29],dpdf_sqrtlinshft); unur_distr_cont_set_cdf(distr[29],cdf_sqrtlinshft); unur_distr_set_name(distr[29],"sqrtlin"); } { distr[22] = unur_distr_cauchy(NULL,0); unur_distr_cont_set_domain(distr[22],0.1,1.); unur_distr_cont_upd_mode(distr[22]); unur_distr_cont_upd_pdfarea(distr[22]); } { fpm[0] = 3.; fpm[1] = 4.; distr[23] = unur_distr_beta(fpm,2); unur_distr_cont_set_domain(distr[23],-2.,5.); } /* timing */ stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); printf("\n(chi^2) "); fflush(stdout); /* chi^2 tests: 288 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nChi^2 Test:\n"); /* distribution [0] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [2] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [30] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [31] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [3] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [4] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [5] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [6] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [7] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [8] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [24] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [25] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [9] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [10] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [11] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [12] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [13] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [14] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [15] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [16] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [26] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [27] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [17] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [18] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [19] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [20] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [21] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [22] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [23] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [28] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [29] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); printf("\n(verify hat) "); fflush(stdout); /* verify hat tests: 288 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nVerify Hat Test (squeeze <= PDF <= hat):\n"); /* distribution [0] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [2] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [30] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [31] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [3] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [4] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [5] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [6] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [7] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'0')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'0')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [8] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'0')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'0')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [24] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [25] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [9] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [10] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [11] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [12] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [13] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [14] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [15] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [16] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [26] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [27] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [17] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [18] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [19] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [20] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [21] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [22] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [23] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [28] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'0')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'0')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'0')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [29] */ if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); /* free distributions */ unur_distr_free(distr[0]); unur_distr_free(distr[1]); unur_distr_free(distr[2]); unur_distr_free(distr[3]); unur_distr_free(distr[4]); unur_distr_free(distr[5]); unur_distr_free(distr[6]); unur_distr_free(distr[7]); unur_distr_free(distr[8]); unur_distr_free(distr[9]); unur_distr_free(distr[10]); unur_distr_free(distr[11]); unur_distr_free(distr[12]); unur_distr_free(distr[13]); unur_distr_free(distr[14]); unur_distr_free(distr[15]); unur_distr_free(distr[16]); unur_distr_free(distr[17]); unur_distr_free(distr[18]); unur_distr_free(distr[19]); unur_distr_free(distr[20]); unur_distr_free(distr[21]); unur_distr_free(distr[22]); unur_distr_free(distr[23]); unur_distr_free(distr[24]); unur_distr_free(distr[25]); unur_distr_free(distr[26]); unur_distr_free(distr[27]); unur_distr_free(distr[28]); unur_distr_free(distr[29]); unur_distr_free(distr[30]); unur_distr_free(distr[31]); /* test finished */ test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; /* we accept CHI2_FAILURES_TOLERATED failures */ (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_validate */ /* enable GCC compiler warning */ GCC_DIAG_ON(unused-variable) /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_tdr_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/testdistributions/0000755001357500135600000000000014430713513015062 500000000000000unuran-1.11.0/tests/testdistributions/vc_special_correlations_constantrho.c0000644001357500135600000002773514420445767024516 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * Distribution objects of multivariate distributions having a * * correlation matrix with constant off-diagonal elements * * * ***************************************************************************** * * * Use correlation matrix of the form: * * * * +- -+ * * | 1 r r ... r | * * | r 1 r ... r | * * | r r 1 ... r | * * | ... | * * | r r r ... 1 | * * +- -+ * * * * in this case the inverse matrix is given as * * * * +- -+ * * | a b b ... b b | * * | b a b ... b b | * * | b b a ... b b | * * | ... | * * | b b b ... a b | * * | b b b ... b a | * * +- -+ * * * * with * * * * a = (1+(d-2)*r) / (1+(d-2)*r-(d-1)*r^2) * * b = - r / (1+(d-2)*r-(d-1)*r^2) * * * * and the determinant of the covariance matrix is * * * * det = (1-r)^(d-1) * (1+(d-1)*r) * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "testdistributions.h" /*---------------------------------------------------------------------------*/ #define LOGNORMCONSTANT (distr->data.cvec.norm_constant) #define NORMCONSTANT (distr->data.cvec.norm_constant) /*---------------------------------------------------------------------------*/ /* Set correlation matrix with constant off-diagonal elements and its inverse */ static int _unur_vc_set_corrmatrix_constantrho( UNUR_DISTR *distr, int dim, double rho ); /*---------------------------------------------------------------------------*/ int _unur_vc_set_corrmatrix_constantrho( UNUR_DISTR *distr, int dim, double rho ) /*----------------------------------------------------------------------*/ /* Create and set correlation matrix with constant off-diagonal */ /* elements and its inverse. */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* dim ... dimension of random vector */ /* rho ... correlation between consecutive elements in process */ /* */ /* return: */ /* UNUR_SUCCESS ... success */ /* UNUR_FAILURE ... failure */ /*----------------------------------------------------------------------*/ { #define idx(a,b) ((a)*dim+(b)) double *covar, *covar_inv; double a, b, denominator; int i,j; int error = UNUR_FAILURE; /* checking parameters */ if (_unur_iszero(rho)) /* nothing to do */ return UNUR_SUCCESS; if ( rho<0. || rho>=1. || dim<1) /* invalid arguments */ return UNUR_FAILURE; /* entries of matrix */ denominator = 1.+(dim-2)*rho-(dim-1)*rho*rho; a = (1.+(dim-2)*rho)/denominator; b = -rho/denominator; /* allocate memory */ covar = malloc( dim * dim * sizeof(double) ); covar_inv = malloc( dim * dim * sizeof(double) ); if (covar == NULL || covar_inv == NULL) { if (covar) free (covar); if (covar_inv) free (covar_inv); return UNUR_FAILURE; } /* create correlation matrix */ for (i=0; i=1. || dim<1) return NULL; /* get distribution object for multinormal distribution */ distr = unur_distr_multinormal_w_marginals( dim, mean, NULL ); /* set the name of distribution */ unur_distr_set_name(distr, "multinormal_constantrho"); /* set the correlation matrix and its inverse */ if (_unur_vc_set_corrmatrix_constantrho(distr, dim, rho) != UNUR_SUCCESS) { /* error */ unur_distr_free(distr); distr = NULL; return NULL; } /* compute normalization constant */ det_covar = _unur_matrix_determinant(distr->dim, distr->data.cvec.covar); LOGNORMCONSTANT = - ( distr->dim * log(2 * M_PI) + log(det_covar) ) / 2.; /* return pointer to object */ return distr; } /* end of unur_distr_multinormal_constantrho() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_multicauchy_constantrho(int dim, const double *mean, double rho) /*---------------------------------------------------------------------------*/ /* Multinormal distribution (corr-matrix : constant off-diagonal elements) */ /*---------------------------------------------------------------------------*/ { struct unur_distr *distr; double det_covar; /* checking parameters */ if ( rho<0. || rho>=1. || dim<1) return NULL; /* get distribution object for multicauchy distribution */ distr = unur_distr_multicauchy_w_marginals( dim, mean, NULL ); /* set the name of distribution */ unur_distr_set_name(distr, "multicauchy_constantrho"); /* set the correlation matrix and its inverse */ if (_unur_vc_set_corrmatrix_constantrho(distr, dim, rho) != UNUR_SUCCESS) { /* error */ unur_distr_free(distr); distr = NULL; return NULL; } /* compute normalization constant */ det_covar = _unur_matrix_determinant(distr->dim, distr->data.cvec.covar); LOGNORMCONSTANT = _unur_SF_ln_gamma((distr->dim+1)/2.) - ( (distr->dim+1) * log(M_PI) + log(det_covar) ) / 2.; /* return pointer to object */ return distr; } /* end of unur_distr_multicauchy_constantrho() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_multistudent_constantrho(int dim, double df, const double *mean, double rho) /*---------------------------------------------------------------------------*/ /* Multistudent distribution (corr-matrix : constant off-diagonal elements) */ /*---------------------------------------------------------------------------*/ { struct unur_distr *distr; double det_covar; /* checking parameters */ if ( rho<0. || rho>=1. || dim<1) return NULL; /* get distribution object for multistudent distribution */ distr = unur_distr_multistudent_w_marginals( dim, df, mean, NULL ); /* set the name of distribution */ unur_distr_set_name(distr, "multistudent_constantrho"); /* set the correlation matrix and its inverse */ if (_unur_vc_set_corrmatrix_constantrho(distr, dim, rho) != UNUR_SUCCESS) { /* error */ unur_distr_free(distr); distr = NULL; return NULL; } /* compute normalization constant */ det_covar = _unur_matrix_determinant(distr->dim, distr->data.cvec.covar); LOGNORMCONSTANT = _unur_SF_ln_gamma((distr->dim+df)/2.) - _unur_SF_ln_gamma(df/2.) - ( distr->dim * log(df*M_PI) + log(det_covar) ) / 2.; /* return pointer to object */ return distr; } /* end of unur_distr_multistudent_constantrho() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/tests/testdistributions/c_w_pdf_from_logpdf.c0000644001357500135600000001546614420445767021155 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * Distribution objects of standard distributions with logPDF where the * * PDF and its derivatives are computed from the logPDF and its derivatives * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "testdistributions.h" /*---------------------------------------------------------------------------*/ /* Cont. univariate distributions with logPDF with PDF computed from logPDF */ /*---------------------------------------------------------------------------*/ #define DISTR distr->data.cont /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_beta_w_pdf_from_logpdf( const double *params, int n_params ) { register struct unur_distr *distr; /* get distribution object for beta distribution */ distr = unur_distr_beta( params, n_params ); /* name of distribution */ distr->name = "beta_w_pdf_from_logpdf"; /* replace PDF by wrapper function */ DISTR.pdf = _unur_distr_cont_eval_pdf_from_logpdf; DISTR.dpdf = _unur_distr_cont_eval_dpdf_from_dlogpdf; /* return pointer to object */ return distr; } /* end of unur_distr_beta_w_pdf_from_logpdf() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_cauchy_w_pdf_from_logpdf( const double *params, int n_params ) { register struct unur_distr *distr; /* get distribution object for cauchy distribution */ distr = unur_distr_cauchy( params, n_params ); /* name of distribution */ distr->name = "cauchy_w_pdf_from_logpdf"; /* replace PDF by wrapper function */ DISTR.pdf = _unur_distr_cont_eval_pdf_from_logpdf; DISTR.dpdf = _unur_distr_cont_eval_dpdf_from_dlogpdf; /* return pointer to object */ return distr; } /* end of unur_distr_cauchy_w_pdf_from_logpdf() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_exponential_w_pdf_from_logpdf( const double *params, int n_params ) { register struct unur_distr *distr; /* get distribution object for exponential distribution */ distr = unur_distr_exponential( params, n_params ); /* name of distribution */ distr->name = "exponential_w_pdf_from_logpdf"; /* replace PDF by wrapper function */ DISTR.pdf = _unur_distr_cont_eval_pdf_from_logpdf; DISTR.dpdf = _unur_distr_cont_eval_dpdf_from_dlogpdf; /* return pointer to object */ return distr; } /* end of unur_distr_exponential_w_pdf_from_logpdf() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_gamma_w_pdf_from_logpdf( const double *params, int n_params ) { register struct unur_distr *distr; /* get distribution object for gamma distribution */ distr = unur_distr_gamma( params, n_params ); /* name of distribution */ distr->name = "gamma_w_pdf_from_logpdf"; /* replace PDF by wrapper function */ DISTR.pdf = _unur_distr_cont_eval_pdf_from_logpdf; DISTR.dpdf = _unur_distr_cont_eval_dpdf_from_dlogpdf; /* return pointer to object */ return distr; } /* end of unur_distr_gamma_w_pdf_from_logpdf() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_normal_w_pdf_from_logpdf( const double *params, int n_params ) { register struct unur_distr *distr; /* get distribution object for normal distribution */ distr = unur_distr_normal( params, n_params ); /* name of distribution */ distr->name = "normal_w_pdf_from_logpdf"; /* replace PDF by wrapper function */ DISTR.pdf = _unur_distr_cont_eval_pdf_from_logpdf; DISTR.dpdf = _unur_distr_cont_eval_dpdf_from_dlogpdf; /* return pointer to object */ return distr; } /* end of unur_distr_normal_w_pdf_from_logpdf() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_powerexponential_w_pdf_from_logpdf( const double *params, int n_params ) { register struct unur_distr *distr; /* get distribution object for powerexponential distribution */ distr = unur_distr_powerexponential( params, n_params ); /* name of distribution */ distr->name = "powerexponential_w_pdf_from_logpdf"; /* replace PDF by wrapper function */ DISTR.pdf = _unur_distr_cont_eval_pdf_from_logpdf; DISTR.dpdf = _unur_distr_cont_eval_dpdf_from_dlogpdf; /* return pointer to object */ return distr; } /* end of unur_distr_powerexponential_w_pdf_from_logpdf() */ /*---------------------------------------------------------------------------*/ #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/tests/testdistributions/testdistributions.h0000644001357500135600000002300614420445767020772 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: testdistributions.h * * * * PURPOSE: * * Make distribution objects for special tests. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifndef UNURAN_TESTDISTRIBUTIONS_H_SEEN #define UNURAN_TESTDISTRIBUTIONS_H_SEEN /*---------------------------------------------------------------------------*/ /* Distribution objects of with multiple of PDFs generated from other */ /* distribution objects. */ UNUR_DISTR *unur_distr_multPDF( const UNUR_DISTR *distr, double mult ); /*---------------------------------------------------------------------------*/ /* Special continuous univariate distributions */ /* sawtooth distributions with discontinuous PDF */ /* pdf(x) = |x| - floor(|x|) (and 1 at integers != 0) */ /* (boundary of domain as parameters) */ UNUR_DISTR *unur_distr_sawtooth_discpdf(const double *params, int n_params); /* sawtooth distributions with continuous PDF */ /* pdf(x) = y for y < 0.5 and 1-y otherwise (where y = |x| - floor(|x|)) */ /* (boundary of domain as parameters) */ UNUR_DISTR *unur_distr_sawtooth_contpdf(const double *params, int n_params); /*---------------------------------------------------------------------------*/ /* Continuous univariate distributions without logPDF */ /* Beta distribution [3; ch.25, p.210] */ UNUR_DISTR *unur_distr_beta_wo_logpdf(const double *params, int n_params); /* Cauchy distribution [2; ch.16, p.299] */ UNUR_DISTR *unur_distr_cauchy_wo_logpdf(const double *params, int n_params); /* Exponential distribution [2; ch.19, p.494] */ UNUR_DISTR *unur_distr_exponential_wo_logpdf(const double *params, int n_params); /* Gamma distribution [2; ch.17, p.337] */ UNUR_DISTR *unur_distr_gamma_wo_logpdf(const double *params, int n_params); /* Laplace distribution [3; ch.24, p.164] */ UNUR_DISTR *unur_distr_laplace_wo_logpdf(const double *params, int n_params); /* Normal distribution [2; ch.13, p.80] */ UNUR_DISTR *unur_distr_normal_wo_logpdf( const double *params, int n_params ); /* Power-exponential (Subbotin) distribution [3; ch.24, p.195] */ UNUR_DISTR *unur_distr_powerexponential_wo_logpdf(const double *params, int n_params); /* Uniform distribution [3; ch.26, p.276] */ UNUR_DISTR *unur_distr_uniform_wo_logpdf(const double *params, int n_params); /*---------------------------------------------------------------------------*/ /* Continuous univariate distributions where PDF is computed from logPDF */ /* Beta distribution [3; ch.25, p.210] */ UNUR_DISTR *unur_distr_beta_w_pdf_from_logpdf(const double *params, int n_params); /* Cauchy distribution [2; ch.16, p.299] */ UNUR_DISTR *unur_distr_cauchy_w_pdf_from_logpdf(const double *params, int n_params); /* Exponential distribution [2; ch.19, p.494] */ UNUR_DISTR *unur_distr_exponential_w_pdf_from_logpdf(const double *params, int n_params); /* Gamma distribution [2; ch.17, p.337] */ UNUR_DISTR *unur_distr_gamma_w_pdf_from_logpdf(const double *params, int n_params); /* Normal distribution [2; ch.13, p.80] */ UNUR_DISTR *unur_distr_normal_w_pdf_from_logpdf(const double *params, int n_params ); /* Power-exponential (Subbotin) distribution [3; ch.24, p.195] */ UNUR_DISTR *unur_distr_powerexponential_w_pdf_from_logpdf(const double *params, int n_params); /*---------------------------------------------------------------------------*/ /* Continuous multivariate distributions with marginal distributions */ /* Multicauchy distribution [5; ch.45, p.219] */ UNUR_DISTR *unur_distr_multicauchy_w_marginals(int dim, const double *mean, const double *covar); /* Multinormal distribution [5; ch.45, p.105] */ UNUR_DISTR *unur_distr_multinormal_w_marginals(int dim, const double *mean, const double *covar); /* Multistudent distribution */ UNUR_DISTR *unur_distr_multistudent_w_marginals(int dim, double df, const double *mean, const double *covar); /*---------------------------------------------------------------------------*/ /* Continuous multivariate distributions without logPDF */ /* Multinormal distribution [5; ch.45, p.105] */ UNUR_DISTR *unur_distr_multinormal_wo_logpdf(int dim, const double *mean, const double *covar); /*---------------------------------------------------------------------------*/ /* Continuous multivariate distributions where PDF is computed from logPDF */ /* Multinormal distribution [5; ch.45, p.105] */ UNUR_DISTR *unur_distr_multinormal_w_pdf_from_logpdf(int dim, const double *mean, const double *covar); /*---------------------------------------------------------------------------*/ /* Specially shaped multivariate distributions */ /* Multi-Cauchy distribution where RoU region with r=1 is a ball */ UNUR_DISTR *unur_distr_multicauchy_RoU_ball( int dim ); /*---------------------------------------------------------------------------*/ /* Multivariate distributions with correlation matrix of AR(1) process */ /* Multinormal distribution - AR(1) */ UNUR_DISTR *unur_distr_multinormal_ar1(int dim, const double *mean, double rho); /* Multicauchy distribution - AR(1) */ UNUR_DISTR *unur_distr_multicauchy_ar1(int dim, const double *mean, double rho); /* Multistudent distribution - AR(1) */ UNUR_DISTR *unur_distr_multistudent_ar1(int dim, double df, const double *mean, double rho); /*---------------------------------------------------------------------------*/ /* Multivariate distributions with equal off-diagonal entries in */ /* correlation matrix */ /* Multinormal distribution - constant rho */ UNUR_DISTR *unur_distr_multinormal_constantrho(int dim, const double *mean, double rho); /* Multicauchy distribution - constant rho */ UNUR_DISTR *unur_distr_multicauchy_constantrho(int dim, const double *mean, double rho); /* Multistudent distribution - constant rho */ UNUR_DISTR *unur_distr_multistudent_constantrho(int dim, double df, const double *mean, double rho); /*---------------------------------------------------------------------------*/ #endif /* UNURAN_TESTDISTRIBUTIONS_H_SEEN */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/tests/testdistributions/Makefile.in0000644001357500135600000005160214430713360017053 00000000000000# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = tests/testdistributions ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libtestdistributions_la_LIBADD = am_libtestdistributions_la_OBJECTS = c_with_multiple_of_pdf.lo \ c_wo_logpdf.lo c_w_pdf_from_logpdf.lo c_sawtooth_discpdf.lo \ c_sawtooth_contpdf.lo vc_w_marginals.lo vc_wo_logpdf.lo \ vc_cauchy_RoU_ball.lo vc_special_correlations_ar1.lo \ vc_special_correlations_constantrho.lo libtestdistributions_la_OBJECTS = \ $(am_libtestdistributions_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/c_sawtooth_contpdf.Plo \ ./$(DEPDIR)/c_sawtooth_discpdf.Plo \ ./$(DEPDIR)/c_w_pdf_from_logpdf.Plo \ ./$(DEPDIR)/c_with_multiple_of_pdf.Plo \ ./$(DEPDIR)/c_wo_logpdf.Plo ./$(DEPDIR)/vc_cauchy_RoU_ball.Plo \ ./$(DEPDIR)/vc_special_correlations_ar1.Plo \ ./$(DEPDIR)/vc_special_correlations_constantrho.Plo \ ./$(DEPDIR)/vc_w_marginals.Plo ./$(DEPDIR)/vc_wo_logpdf.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libtestdistributions_la_SOURCES) DIST_SOURCES = $(libtestdistributions_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(noinst_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autoconf/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILECMD = @FILECMD@ GREP = @GREP@ HAVE_DIVIDE_BY_ZERO = @HAVE_DIVIDE_BY_ZERO@ HAVE_IEEE_COMPARISONS = @HAVE_IEEE_COMPARISONS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNURAN_LT_VERSION = @UNURAN_LT_VERSION@ UNURAN_SUPPORTS_GSL = @UNURAN_SUPPORTS_GSL@ UNURAN_SUPPORTS_PRNG = @UNURAN_SUPPORTS_PRNG@ UNURAN_SUPPORTS_RNGSTREAM = @UNURAN_SUPPORTS_RNGSTREAM@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ have_valgrind = @have_valgrind@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = \ -I$(top_srcdir)/src noinst_LTLIBRARIES = libtestdistributions.la libtestdistributions_la_SOURCES = \ c_with_multiple_of_pdf.c \ c_wo_logpdf.c \ c_w_pdf_from_logpdf.c \ c_sawtooth_discpdf.c \ c_sawtooth_contpdf.c \ vc_w_marginals.c \ vc_wo_logpdf.c \ vc_cauchy_RoU_ball.c \ vc_special_correlations_ar1.c \ vc_special_correlations_constantrho.c noinst_HEADERS = testdistributions.h # clean backup files CLEANFILES = *~ # clean generated files MAINTAINERCLEANFILES = \ Makefile.in all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/testdistributions/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign tests/testdistributions/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libtestdistributions.la: $(libtestdistributions_la_OBJECTS) $(libtestdistributions_la_DEPENDENCIES) $(EXTRA_libtestdistributions_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libtestdistributions_la_OBJECTS) $(libtestdistributions_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_sawtooth_contpdf.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_sawtooth_discpdf.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_w_pdf_from_logpdf.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_with_multiple_of_pdf.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_wo_logpdf.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vc_cauchy_RoU_ball.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vc_special_correlations_ar1.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vc_special_correlations_constantrho.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vc_w_marginals.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vc_wo_logpdf.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/c_sawtooth_contpdf.Plo -rm -f ./$(DEPDIR)/c_sawtooth_discpdf.Plo -rm -f ./$(DEPDIR)/c_w_pdf_from_logpdf.Plo -rm -f ./$(DEPDIR)/c_with_multiple_of_pdf.Plo -rm -f ./$(DEPDIR)/c_wo_logpdf.Plo -rm -f ./$(DEPDIR)/vc_cauchy_RoU_ball.Plo -rm -f ./$(DEPDIR)/vc_special_correlations_ar1.Plo -rm -f ./$(DEPDIR)/vc_special_correlations_constantrho.Plo -rm -f ./$(DEPDIR)/vc_w_marginals.Plo -rm -f ./$(DEPDIR)/vc_wo_logpdf.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/c_sawtooth_contpdf.Plo -rm -f ./$(DEPDIR)/c_sawtooth_discpdf.Plo -rm -f ./$(DEPDIR)/c_w_pdf_from_logpdf.Plo -rm -f ./$(DEPDIR)/c_with_multiple_of_pdf.Plo -rm -f ./$(DEPDIR)/c_wo_logpdf.Plo -rm -f ./$(DEPDIR)/vc_cauchy_RoU_ball.Plo -rm -f ./$(DEPDIR)/vc_special_correlations_ar1.Plo -rm -f ./$(DEPDIR)/vc_special_correlations_constantrho.Plo -rm -f ./$(DEPDIR)/vc_w_marginals.Plo -rm -f ./$(DEPDIR)/vc_wo_logpdf.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: unuran-1.11.0/tests/testdistributions/Makefile.am0000644001357500135600000000107314420445767017053 00000000000000## Process this file with automake to produce Makefile.in AM_CPPFLAGS = \ -I$(top_srcdir)/src noinst_LTLIBRARIES = libtestdistributions.la libtestdistributions_la_SOURCES = \ c_with_multiple_of_pdf.c \ c_wo_logpdf.c \ c_w_pdf_from_logpdf.c \ c_sawtooth_discpdf.c \ c_sawtooth_contpdf.c \ vc_w_marginals.c \ vc_wo_logpdf.c \ vc_cauchy_RoU_ball.c \ vc_special_correlations_ar1.c \ vc_special_correlations_constantrho.c noinst_HEADERS = testdistributions.h # clean backup files CLEANFILES = *~ # clean generated files MAINTAINERCLEANFILES = \ Makefile.in unuran-1.11.0/tests/testdistributions/c_sawtooth_discpdf.c0000644001357500135600000002064614420445767021040 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * Sawtooth distribution with discontinuous PDF * * * * pdf: / 1 if x is integer != 0 * * f(x) = < * * \ |x| - floor(|x|) otherwise * * domain: closed interval * * constant: depends on interval * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include "testdistributions.h" /*---------------------------------------------------------------------------*/ static const char distr_name[] = "sawtooth_discpdf"; /* parameters */ #define DISTR distr->data.cont #define bd_left (params[0]) #define bd_right (params[1]) /* function prototypes */ static double _unur_pdf_sawtooth_discpdf( double x, const UNUR_DISTR *distr ); static double _unur_dpdf_sawtooth_discpdf( double x, const UNUR_DISTR *distr ); static double _unur_cdf_sawtooth_discpdf( double x, const UNUR_DISTR *distr ); static int _unur_set_params_sawtooth_discpdf( UNUR_DISTR *distr, const double *params, int n_params ); static int _unur_upd_area_sawtooth_discpdf( UNUR_DISTR *distr ); /*---------------------------------------------------------------------------*/ double _unur_pdf_sawtooth_discpdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED ) { double pdf; if (_unur_iszero(x)) return 0.; /* else */ x = fabs(x); pdf = x - floor(x); return _unur_iszero(pdf) ? 1. : pdf; } /* end of _unur_pdf_sawtooth_discpdf() */ /*---------------------------------------------------------------------------*/ double _unur_dpdf_sawtooth_discpdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED ) { return (x<0.) ? -1. : 1.; } /* end of _unur_dpdf_sawtooth_discpdf() */ /*---------------------------------------------------------------------------*/ static double integral_0_x( double x ) { double absx = fabs(x); double intx = floor(absx); return 0.5*(intx + (absx-intx)*(absx-intx)); } /* end of integral_0_x() */ static double integral_x_y( double x, double y ) { double ix = integral_0_x(x); double iy = integral_0_x(y); double sign = 1.; if (x>y) { double tmp=x; x=y; y=tmp; sign=-1.; } if (x<0. && y<0.) return sign*(ix - iy); if (x<0. && y>=0.) return sign*(ix + iy); /* otherwise */ return sign*(iy -ix); } /* end of integral_x_y() */ /*---------------------------------------------------------------------------*/ double _unur_cdf_sawtooth_discpdf( double x, const UNUR_DISTR *distr ) { return (integral_x_y(DISTR.domain[0],x) / integral_x_y(DISTR.domain[0],DISTR.domain[1])); } /* end of _unur_cdf_sawtooth_discpdf() */ /*---------------------------------------------------------------------------*/ int _unur_upd_area_sawtooth_discpdf( UNUR_DISTR *distr ) { double area = integral_x_y(DISTR.domain[0],DISTR.domain[1]); if (!_unur_isfinite(area)) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"invalid domain"); return UNUR_ERR_DISTR_DOMAIN; } DISTR.area = area; return UNUR_SUCCESS; } /* end of _unur_upd_area_sawtooth_discpdf() */ /*---------------------------------------------------------------------------*/ int _unur_set_params_sawtooth_discpdf( UNUR_DISTR *distr, const double *params, int n_params ) { /* check number of parameters for distribution */ if (n_params != 2) { _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,""); return UNUR_ERR_DISTR_NPARAMS; } CHECK_NULL(params,UNUR_ERR_NULL); /* check parameters */ if (! (_unur_FP_less(bd_left,bd_right) || _unur_isfinite(bd_left) || _unur_isfinite(bd_right)) ) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"invalid domain"); return UNUR_ERR_DISTR_DOMAIN; } /* set domain */ DISTR.domain[0] = bd_left; DISTR.domain[1] = bd_right; /* update area below PDF */ if (_unur_upd_area_sawtooth_discpdf(distr) != UNUR_SUCCESS) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"invalid domain"); return UNUR_ERR_DISTR_DOMAIN; } return UNUR_SUCCESS; } /* end of _unur_set_params_sawtooth_discpdf() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_sawtooth_discpdf( const double *params, int n_params ) /* boundary of domain as parameters */ { register struct unur_distr *distr; if (! (_unur_FP_less(bd_left,bd_right) || _unur_isfinite(bd_left) || _unur_isfinite(bd_right)) ) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"invalid domain"); return NULL; } /* get new (empty) distribution object */ distr = unur_distr_cont_new(); /* set distribution id */ distr->id = UNUR_DISTR_GENERIC; /* name of distribution */ distr->name = distr_name; /* how to get special generators */ /* DISTR.init = NULL; */ /* functions */ DISTR.pdf = _unur_pdf_sawtooth_discpdf; /* pointer to PDF */ DISTR.dpdf = _unur_dpdf_sawtooth_discpdf; /* pointer to derivative of PDF */ DISTR.cdf = _unur_cdf_sawtooth_discpdf; /* pointer to CDF */ /* indicate which parameters are set */ distr->set = ( UNUR_DISTR_SET_DOMAIN | UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_PDFAREA ); /* set parameters for distribution */ if (_unur_set_params_sawtooth_discpdf(distr,params,n_params)!=UNUR_SUCCESS) { free(distr); return NULL; } /* log of normalization constant */ /* NORMCONSTANT = 1.; */ /* function for setting parameters and updating domain */ DISTR.set_params = _unur_set_params_sawtooth_discpdf; /* function for updating derived parameters */ DISTR.upd_area = _unur_upd_area_sawtooth_discpdf; /* funct for computing area */ /* return pointer to object */ return distr; } /* end of unur_distr_sawtooth_discpdf() */ /*---------------------------------------------------------------------------*/ #undef DISTR #undef bd_left #undef bd_right /*---------------------------------------------------------------------------*/ unuran-1.11.0/tests/testdistributions/c_sawtooth_contpdf.c0000644001357500135600000002077114420445767021060 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * Sawtooth distribution with discontinuous PDF * * * * pdf: / y if y < 0.5 * * f(x) = < [ where y = |x| - floor(|x|) ] * * \ 1-y otherwise * * domain: closed interval * * constant: depends on interval * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include "testdistributions.h" /*---------------------------------------------------------------------------*/ static const char distr_name[] = "sawtooth_contpdf"; /* parameters */ #define DISTR distr->data.cont #define bd_left (params[0]) #define bd_right (params[1]) /* function prototypes */ static double _unur_pdf_sawtooth_contpdf( double x, const UNUR_DISTR *distr ); static double _unur_dpdf_sawtooth_contpdf( double x, const UNUR_DISTR *distr ); static double _unur_cdf_sawtooth_contpdf( double x, const UNUR_DISTR *distr ); static int _unur_set_params_sawtooth_contpdf( UNUR_DISTR *distr, const double *params, int n_params ); static int _unur_upd_area_sawtooth_contpdf( UNUR_DISTR *distr ); /*---------------------------------------------------------------------------*/ double _unur_pdf_sawtooth_contpdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y = fabs(x) - floor(fabs(x)); return ((y<=0.5) ? y : 1. - y); } /* end of _unur_pdf_sawtooth_contpdf() */ /*---------------------------------------------------------------------------*/ double _unur_dpdf_sawtooth_contpdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED ) { double y = fabs(x) - floor(fabs(x)); return ((y <= 0.5 && x > 0.) || (y >= 0.5 && x < 0.) ? 1. : -1.); } /* end of _unur_dpdf_sawtooth_contpdf() */ /*---------------------------------------------------------------------------*/ static double integral_0_x( double x ) { double absx = fabs(x); double intx = floor(absx); double y = absx - intx; double val = 0.25 * intx; if (y <= 0.5) val += 0.5 * y * y; else val += 0.125 + 0.5*(y-0.5)*(1.5-y); return val; } /* end of integral_0_x() */ static double integral_x_y( double x, double y ) { double ix = integral_0_x(x); double iy = integral_0_x(y); double sign = 1.; if (x>y) { double tmp=x; x=y; y=tmp; sign=-1.; } if (x<0. && y<0.) return sign*(ix - iy); if (x<0. && y>=0.) return sign*(ix + iy); /* otherwise */ return sign*(iy -ix); } /* end of integral_x_y() */ /*---------------------------------------------------------------------------*/ double _unur_cdf_sawtooth_contpdf( double x, const UNUR_DISTR *distr ) { return (integral_x_y(DISTR.domain[0],x) / integral_x_y(DISTR.domain[0],DISTR.domain[1])); } /* end of _unur_cdf_sawtooth_contpdf() */ /*---------------------------------------------------------------------------*/ int _unur_upd_area_sawtooth_contpdf( UNUR_DISTR *distr ) { double area = integral_x_y(DISTR.domain[0],DISTR.domain[1]); if (!_unur_isfinite(area)) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"invalid domain"); return UNUR_ERR_DISTR_DOMAIN; } DISTR.area = area; return UNUR_SUCCESS; } /* end of _unur_upd_area_sawtooth_contpdf() */ /*---------------------------------------------------------------------------*/ int _unur_set_params_sawtooth_contpdf( UNUR_DISTR *distr, const double *params, int n_params ) { /* check number of parameters for distribution */ if (n_params != 2) { _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,""); return UNUR_ERR_DISTR_NPARAMS; } CHECK_NULL(params,UNUR_ERR_NULL); /* check parameters */ if (! (_unur_FP_less(bd_left,bd_right) || _unur_isfinite(bd_left) || _unur_isfinite(bd_right)) ) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"invalid domain"); return UNUR_ERR_DISTR_DOMAIN; } /* set domain */ DISTR.domain[0] = bd_left; DISTR.domain[1] = bd_right; /* update area below PDF */ if (_unur_upd_area_sawtooth_contpdf(distr) != UNUR_SUCCESS) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"invalid domain"); return UNUR_ERR_DISTR_DOMAIN; } return UNUR_SUCCESS; } /* end of _unur_set_params_sawtooth_contpdf() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_sawtooth_contpdf( const double *params, int n_params ) /* boundary of domain as parameters */ { register struct unur_distr *distr; if (! (_unur_FP_less(bd_left,bd_right) || _unur_isfinite(bd_left) || _unur_isfinite(bd_right)) ) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"invalid domain"); return NULL; } /* get new (empty) distribution object */ distr = unur_distr_cont_new(); /* set distribution id */ distr->id = UNUR_DISTR_GENERIC; /* name of distribution */ distr->name = distr_name; /* how to get special generators */ /* DISTR.init = NULL; */ /* functions */ DISTR.pdf = _unur_pdf_sawtooth_contpdf; /* pointer to PDF */ DISTR.dpdf = _unur_dpdf_sawtooth_contpdf; /* pointer to derivative of PDF */ DISTR.cdf = _unur_cdf_sawtooth_contpdf; /* pointer to CDF */ /* indicate which parameters are set */ distr->set = ( UNUR_DISTR_SET_DOMAIN | UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_PDFAREA ); /* set parameters for distribution */ if (_unur_set_params_sawtooth_contpdf(distr,params,n_params)!=UNUR_SUCCESS) { free(distr); return NULL; } /* log of normalization constant */ /* NORMCONSTANT = 1.; */ /* function for setting parameters and updating domain */ DISTR.set_params = _unur_set_params_sawtooth_contpdf; /* function for updating derived parameters */ DISTR.upd_area = _unur_upd_area_sawtooth_contpdf; /* funct for computing area */ /* return pointer to object */ return distr; } /* end of unur_distr_sawtooth_contpdf() */ /*---------------------------------------------------------------------------*/ #undef DISTR #undef bd_left #undef bd_right /*---------------------------------------------------------------------------*/ unuran-1.11.0/tests/testdistributions/c_with_multiple_of_pdf.c0000644001357500135600000002155614420445767021700 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * Distribution objects of with multiple of PDFs generated from other * * distribution objects. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "testdistributions.h" /*---------------------------------------------------------------------------*/ /* Continuous univariate distributions */ /*---------------------------------------------------------------------------*/ static const char distr_name[] = "multPDF"; /*---------------------------------------------------------------------------*/ /* prototypes for wrapper functions */ static double _unur_cdf_mult (double x, const struct unur_distr *q); static double _unur_logcdf_mult (double x, const struct unur_distr *q); static double _unur_pdf_mult (double x, const struct unur_distr *q); static double _unur_logpdf_mult (double x, const struct unur_distr *q); static double _unur_dpdf_mult (double x, const struct unur_distr *q); static double _unur_dlogpdf_mult (double x, const struct unur_distr *q); #define DISTR distr->data.cont #define MULT params[0] /* multiplicator */ #define CDF(x) ((*(q->base->data.cont.cdf)) ((x), q->base)) #define logCDF(x) ((*(q->base->data.cont.logcdf)) ((x), q->base)) #define PDF(x) ((*(q->base->data.cont.pdf)) ((x), q->base)) #define logPDF(x) ((*(q->base->data.cont.logpdf)) ((x), q->base)) #define dPDF(x) ((*(q->base->data.cont.dpdf)) ((x), q->base)) #define dlogPDF(x) ((*(q->base->data.cont.dlogpdf)) ((x), q->base)) /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_multPDF( const struct unur_distr *distr, double mult ) /*----------------------------------------------------------------------*/ /* Create an object where the PDF is a multiple of the PDF of 'distr'. */ /* `distr' must be a pointer to a univariate continuous distribution. */ /* */ /* parameters: */ /* distr ... pointer to univariate continuous distribution. */ /* mult ... multiplicator for PDF */ /* */ /* return: */ /* pointer to distribution object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_distr *q; /* check arguments */ _unur_check_NULL( distr_name,distr,NULL ); /* check distribution */ if (distr->type != UNUR_DISTR_CONT) { _unur_error(distr_name,UNUR_ERR_DISTR_INVALID,""); return NULL; } COOKIE_CHECK(distr,CK_DISTR_CONT,NULL); /* check multiplitor */ if (mult <= 0.) { _unur_error(distr_name,UNUR_ERR_PAR_SET,"mult <= 0"); return NULL; } /* get distribution object for generic continuous univariate distribution */ q = _unur_distr_cont_clone(distr); if (!q) return NULL; /* this is a derived distribution */ /* clone base distribution ... */ q->base = _unur_distr_cont_clone( distr ); if (!q->base) { _unur_distr_free(q); return NULL; } /* pointer to PDF, its derivative, and CDF */ if (DISTR.cdf) q->data.cont.cdf = _unur_cdf_mult; /* pointer to CDF */ if (DISTR.logcdf) q->data.cont.logcdf = _unur_logcdf_mult; /* pointer to CDF */ if (DISTR.pdf) q->data.cont.pdf = _unur_pdf_mult; /* pointer to PDF */ if (DISTR.dpdf) q->data.cont.dpdf = _unur_dpdf_mult; /* derivative of PDF */ if (DISTR.logpdf) q->data.cont.logpdf = _unur_logpdf_mult; /* pointer to logPDF */ if (DISTR.dlogpdf) q->data.cont.dlogpdf = _unur_dlogpdf_mult; /* derivative of logPDF */ /* disable all other pointers */ q->data.cont.dlogpdf = NULL; /* pointer to HR */ /* set multiplicator */ q->data.cont.MULT = mult; q->data.cont.n_params = 1; /* return pointer to object */ return q; } /* end of unur_distr_multPDF() */ /*---------------------------------------------------------------------------*/ double _unur_cdf_mult( double x, const struct unur_distr *q ) { /* check arguments */ CHECK_NULL( q, UNUR_INFINITY ); CHECK_NULL( q->base, UNUR_INFINITY ); CHECK_NULL( q->base->data.cont.pdf, UNUR_INFINITY ); return CDF(x); } /* end of _unur_cdf_mult() */ /*---------------------------------------------------------------------------*/ double _unur_logcdf_mult( double x, const struct unur_distr *q ) { /* check arguments */ CHECK_NULL( q, UNUR_INFINITY ); CHECK_NULL( q->base, UNUR_INFINITY ); CHECK_NULL( q->base->data.cont.pdf, UNUR_INFINITY ); return logCDF(x); } /* end of _unur_logcdf_mult() */ /*---------------------------------------------------------------------------*/ double _unur_pdf_mult( double x, const struct unur_distr *q ) { /* check arguments */ CHECK_NULL( q, UNUR_INFINITY ); CHECK_NULL( q->base, UNUR_INFINITY ); CHECK_NULL( q->base->data.cont.pdf, UNUR_INFINITY ); return q->data.cont.MULT * PDF(x); } /* end of _unur_pdf_mult() */ /*---------------------------------------------------------------------------*/ double _unur_dpdf_mult( double x, const struct unur_distr *q ) { /* check arguments */ CHECK_NULL( q, UNUR_INFINITY ); CHECK_NULL( q->base, UNUR_INFINITY ); CHECK_NULL( q->base->data.cont.dpdf, UNUR_INFINITY ); return q->data.cont.MULT * dPDF(x); } /* end of _unur_dpdf_mult() */ /*---------------------------------------------------------------------------*/ double _unur_logpdf_mult( double x, const struct unur_distr *q ) { /* check arguments */ CHECK_NULL( q, UNUR_INFINITY ); CHECK_NULL( q->base, UNUR_INFINITY ); CHECK_NULL( q->base->data.cont.logpdf, UNUR_INFINITY ); return log(q->data.cont.MULT) + logPDF(x); } /* end of _unur_logpdf_mult() */ /*---------------------------------------------------------------------------*/ double _unur_dlogpdf_mult( double x, const struct unur_distr *q ) { /* check arguments */ CHECK_NULL( q, UNUR_INFINITY ); CHECK_NULL( q->base, UNUR_INFINITY ); CHECK_NULL( q->base->data.cont.dlogpdf, UNUR_INFINITY ); return dlogPDF(x); } /* end of _unur_dlogpdf_mult() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/tests/testdistributions/vc_w_marginals.c0000644001357500135600000001152114420445767020155 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * Distribution objects of standard distributions without logPDF * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include "testdistributions.h" /*---------------------------------------------------------------------------*/ /* Continuous multivariate distributions without logPDF */ /*---------------------------------------------------------------------------*/ #define DISTR distr->data.cvec /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_multicauchy_w_marginals( int dim, const double *mean, const double *covar ) { struct unur_distr *distr; struct unur_distr *marginal; /* get distribution object for beta distribution */ distr = unur_distr_multicauchy( dim, mean, covar ); /* set marginal distributions */ if (distr != NULL && DISTR.marginals == NULL) { marginal = unur_distr_cauchy(NULL,0); unur_distr_cvec_set_marginals(distr,marginal); unur_distr_free(marginal); } /* return pointer to object */ return distr; } /* end of unur_distr_multicauchy_w_marginals() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_multinormal_w_marginals( int dim, const double *mean, const double *covar ) { struct unur_distr *distr; struct unur_distr *marginal; /* get distribution object for beta distribution */ distr = unur_distr_multinormal( dim, mean, covar ); /* set marginal distributions */ if (distr != NULL && DISTR.marginals == NULL) { marginal = unur_distr_normal(NULL,0); unur_distr_cvec_set_marginals(distr,marginal); unur_distr_free(marginal); } /* return pointer to object */ return distr; } /* end of unur_distr_multinormal_w_marginals() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_multistudent_w_marginals( int dim, double df, const double *mean, const double *covar ) { struct unur_distr *distr; struct unur_distr *marginal; /* get distribution object for beta distribution */ distr = unur_distr_multistudent( dim, df, mean, covar ); /* set marginal distributions */ if (distr != NULL && DISTR.marginals == NULL) { marginal = unur_distr_student(&df,1); unur_distr_cvec_set_marginals(distr,marginal); unur_distr_free(marginal); } /* return pointer to object */ return distr; } /* end of unur_distr_multistudent_w_marginals() */ /*---------------------------------------------------------------------------*/ #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/tests/testdistributions/vc_special_correlations_ar1.c0000644001357500135600000003031014420445767022616 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * Distribution objects of multivariate distributions having the * * correlation matrix of AR(1) process. * * * ***************************************************************************** * * * Use correlation matrix of AR(1): * * * * +- -+ * * | 1 r r^2 ... r^(d-1) | * * | r 1 r ... r^(d-2) | * * | r^2 r 1 ... r^(d-3) | * * | ... ... | * * | r^(d-1) r^(d-2) r^(d-3) ... 1 | * * +- -+ * * * * in this case the inverse matrix is given as * * * * +- -+ * * | a b 0 0 ... 0 0 | * * | b c b 0 ... 0 0 | * * | 0 b c b ... 0 0 | * * | ... | * * | 0 0 0 0 ... c b | * * | 0 0 0 0 ... b a | * * +- -+ * * * * with * * * * a = 1 / (1-r^2) * * b = - r / (1-r^2) * * c = (1+r^2) / (1-r^2) * * * * and the determinant of the covariance matrix is * * * * det = (1-r^2)^(d-1) * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "testdistributions.h" /*---------------------------------------------------------------------------*/ #define LOGNORMCONSTANT (distr->data.cvec.norm_constant) #define NORMCONSTANT (distr->data.cvec.norm_constant) /*---------------------------------------------------------------------------*/ /* Set correlation matrix and its inverse of AR(1) process */ static int _unur_vc_set_corrmatrix_ar1( UNUR_DISTR *distr, int dim, double rho ); /*---------------------------------------------------------------------------*/ int _unur_vc_set_corrmatrix_ar1( UNUR_DISTR *distr, int dim, double rho ) /*----------------------------------------------------------------------*/ /* Create and set correlation matrix and its inverse of AR(1) process. */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* dim ... dimension of random vector */ /* rho ... correlation between consecutive elements in process */ /* */ /* return: */ /* UNUR_SUCCESS ... success */ /* UNUR_FAILURE ... failure */ /*----------------------------------------------------------------------*/ { #define idx(a,b) ((a)*dim+(b)) double *covar, *covar_inv, *rhop; double a, b, c, denominator; int i,j; int error = UNUR_FAILURE; /* checking parameters */ if (_unur_iszero(rho)) /* nothing to do */ return UNUR_SUCCESS; /* entries of matrix */ denominator = 1.-rho*rho; a = 1./denominator; b = -rho/denominator; c = (1.+rho*rho)/denominator; if ( rho<0. || rho>=1. || dim<1) /* invalid arguments */ return UNUR_FAILURE; /* allocate memory */ covar = malloc( dim * dim * sizeof(double) ); covar_inv = malloc( dim * dim * sizeof(double) ); rhop = malloc( dim * sizeof(double) ); if (covar == NULL || covar_inv == NULL || rhop == NULL) { if (covar) free (covar); if (covar_inv) free (covar_inv); if (rhop) free (rhop); return UNUR_FAILURE; } /* compute powers of rho */ rhop[0] = 1.; for (i=1; i=1. || dim<1) return NULL; /* get distribution object for multinormal distribution */ distr = unur_distr_multinormal_w_marginals( dim, mean, NULL ); /* set the name of distribution */ unur_distr_set_name(distr, "multinormal_ar1"); /* set the correlation matrix and its inverse */ if (_unur_vc_set_corrmatrix_ar1(distr, dim, rho) != UNUR_SUCCESS) { /* error */ unur_distr_free(distr); distr = NULL; return NULL; } /* compute normalization constant */ det_covar = _unur_matrix_determinant(distr->dim, distr->data.cvec.covar); LOGNORMCONSTANT = - ( distr->dim * log(2 * M_PI) + log(det_covar) ) / 2.; /* return pointer to object */ return distr; } /* end of unur_distr_multinormal_ar1() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_multicauchy_ar1(int dim, const double *mean, double rho) /*---------------------------------------------------------------------------*/ /* Multinormal distribution (corr-matrix from AR(1) process) */ /*---------------------------------------------------------------------------*/ { struct unur_distr *distr; double det_covar; /* checking parameters */ if ( rho<0. || rho>=1. || dim<1) return NULL; /* get distribution object for multicauchy distribution */ distr = unur_distr_multicauchy_w_marginals( dim, mean, NULL ); /* set the name of distribution */ unur_distr_set_name(distr, "multicauchy_ar1"); /* set the correlation matrix and its inverse */ if (_unur_vc_set_corrmatrix_ar1(distr, dim, rho) != UNUR_SUCCESS) { /* error */ unur_distr_free(distr); distr = NULL; return NULL; } /* compute normalization constant */ det_covar = _unur_matrix_determinant(distr->dim, distr->data.cvec.covar); LOGNORMCONSTANT = _unur_SF_ln_gamma((distr->dim+1)/2.) - ( (distr->dim+1) * log(M_PI) + log(det_covar) ) / 2.; /* return pointer to object */ return distr; } /* end of unur_distr_multicauchy_ar1() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_multistudent_ar1(int dim, double df, const double *mean, double rho) /*---------------------------------------------------------------------------*/ /* Multistudent distribution (corr-matrix from AR(1) process) */ /*---------------------------------------------------------------------------*/ { struct unur_distr *distr; double det_covar; /* checking parameters */ if ( rho<0. || rho>=1. || dim<1) return NULL; /* get distribution object for multistudent distribution */ distr = unur_distr_multistudent_w_marginals( dim, df, mean, NULL ); /* set the name of distribution */ unur_distr_set_name(distr, "multistudent_ar1"); /* set the correlation matrix and its inverse */ if (_unur_vc_set_corrmatrix_ar1(distr, dim, rho) != UNUR_SUCCESS) { /* error */ unur_distr_free(distr); distr = NULL; return NULL; } /* compute normalization constant */ det_covar = _unur_matrix_determinant(distr->dim, distr->data.cvec.covar); LOGNORMCONSTANT = _unur_SF_ln_gamma((distr->dim+df)/2.) - _unur_SF_ln_gamma(df/2.) - ( distr->dim * log(df*M_PI) + log(det_covar) ) / 2.; /* return pointer to object */ return distr; } /* end of unur_distr_multistudent_ar1() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/tests/testdistributions/vc_cauchy_RoU_ball.c0000644001357500135600000001533614420304141020671 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * Distribution objects of cauchy distribution whch becomes a ball when * * the ratio-of-uniforms transformation is applied. * * * ***************************************************************************** * * * PDF(x) = (2 / (1+||x||^2) )^{dim+1} * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include "testdistributions.h" /*---------------------------------------------------------------------------*/ static const char distr_name[] = "multicauchy-RoU-ball"; /*---------------------------------------------------------------------------*/ /* parameters */ #define DISTR distr->data.cvec /*---------------------------------------------------------------------------*/ /* function prototypes */ static double _unur_pdf_multicauchy_RoU_ball( const double *x, UNUR_DISTR *distr ); static double _unur_logpdf_multicauchy_RoU_ball( const double *x, UNUR_DISTR *distr ); static int _unur_dlogpdf_multicauchy_RoU_ball( double *result, const double *x, UNUR_DISTR *distr ); /*---------------------------------------------------------------------------*/ double _unur_pdf_multicauchy_RoU_ball( const double *x, UNUR_DISTR *distr ) { return exp(_unur_logpdf_multicauchy_RoU_ball( x, distr )); } /* end of _unur_pdf_multicauchy_RoU_ball() */ /*---------------------------------------------------------------------------*/ double _unur_logpdf_multicauchy_RoU_ball( const double *x, UNUR_DISTR *distr ) { int i,dim; double normsq; dim = distr->dim; for (i=0, normsq=0.; idim; for (i=0, normsq=0.; iid = UNUR_DISTR_MCAUCHY; /* name of distribution */ distr->name = distr_name; /* how to get special generators */ DISTR.init = NULL; /* functions */ DISTR.pdf = _unur_pdf_multicauchy_RoU_ball; /* pointer to PDF */ DISTR.logpdf = _unur_logpdf_multicauchy_RoU_ball; /* pointer to logPDF */ DISTR.dpdf = _unur_distr_cvec_eval_dpdf_from_dlogpdf; /* pointer to derivative of PDF */ DISTR.dlogpdf = _unur_dlogpdf_multicauchy_RoU_ball; /* pointer to derivative of logPDF */ /* copy other parameters of distribution */ /* none */ /* number of other parameters */ /* DISTR.n_params = 0; ... default */ /* domain */ /* log of normalization constant */ /* mode */ DISTR.mode = _unur_xmalloc( distr->dim * sizeof(double) ); for (i=0; iset |= ( UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_MODE ); /* return pointer to object */ return distr; } /* end of unur_distr_multicauchy_RoU_ball() */ /*---------------------------------------------------------------------------*/ #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/tests/testdistributions/c_wo_logpdf.c0000644001357500135600000001625514420445767017455 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * Distribution objects of standard distributions without logPDF * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include "testdistributions.h" /*---------------------------------------------------------------------------*/ /* Continuous univariate distributions without logPDF */ /*---------------------------------------------------------------------------*/ #define DISTR distr->data.cont /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_beta_wo_logpdf( const double *params, int n_params ) { register struct unur_distr *distr; /* get distribution object for beta distribution */ distr = unur_distr_beta( params, n_params ); /* name of distribution */ distr->name = "beta_wo_logpdf"; /* disable logPDF */ DISTR.logpdf = NULL; DISTR.dlogpdf = NULL; /* return pointer to object */ return distr; } /* end of unur_distr_beta_wo_logpdf() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_cauchy_wo_logpdf( const double *params, int n_params ) { register struct unur_distr *distr; /* get distribution object for cauchy distribution */ distr = unur_distr_cauchy( params, n_params ); /* name of distribution */ distr->name = "cauchy_wo_logpdf"; /* disable logPDF */ DISTR.logpdf = NULL; DISTR.dlogpdf = NULL; /* return pointer to object */ return distr; } /* end of unur_distr_cauchy_wo_logpdf() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_exponential_wo_logpdf( const double *params, int n_params ) { register struct unur_distr *distr; /* get distribution object for exponential distribution */ distr = unur_distr_exponential( params, n_params ); /* name of distribution */ distr->name = "exponential_wo_logpdf"; /* disable logPDF */ DISTR.logpdf = NULL; DISTR.dlogpdf = NULL; /* return pointer to object */ return distr; } /* end of unur_distr_exponential_wo_logpdf() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_gamma_wo_logpdf( const double *params, int n_params ) { register struct unur_distr *distr; /* get distribution object for gamma distribution */ distr = unur_distr_gamma( params, n_params ); /* name of distribution */ distr->name = "gamma_wo_logpdf"; /* disable logPDF */ DISTR.logpdf = NULL; DISTR.dlogpdf = NULL; /* return pointer to object */ return distr; } /* end of unur_distr_gamma_wo_logpdf() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_laplace_wo_logpdf( const double *params, int n_params ) { register struct unur_distr *distr; /* get distribution object for laplace distribution */ distr = unur_distr_laplace( params, n_params ); /* name of distribution */ distr->name = "laplace_wo_logpdf"; /* disable logPDF */ DISTR.logpdf = NULL; DISTR.dlogpdf = NULL; /* return pointer to object */ return distr; } /* end of unur_distr_laplace_wo_logpdf() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_normal_wo_logpdf( const double *params, int n_params ) { register struct unur_distr *distr; /* get distribution object for normal distribution */ distr = unur_distr_normal( params, n_params ); /* name of distribution */ distr->name = "normal_wo_logpdf"; /* disable logPDF */ DISTR.logpdf = NULL; DISTR.dlogpdf = NULL; /* return pointer to object */ return distr; } /* end of unur_distr_normal_wo_logpdf() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_powerexponential_wo_logpdf( const double *params, int n_params ) { register struct unur_distr *distr; /* get distribution object for powerexponential distribution */ distr = unur_distr_powerexponential( params, n_params ); /* name of distribution */ distr->name = "powerexponential_wo_logpdf"; /* disable logPDF */ DISTR.logpdf = NULL; DISTR.dlogpdf = NULL; /* return pointer to object */ return distr; } /* end of unur_distr_powerexponential_wo_logpdf() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_uniform_wo_logpdf( const double *params, int n_params ) { register struct unur_distr *distr; /* get distribution object for uniform distribution */ distr = unur_distr_uniform( params, n_params ); /* name of distribution */ distr->name = "uniform_wo_logpdf"; /* disable logPDF */ DISTR.logpdf = NULL; DISTR.dlogpdf = NULL; /* return pointer to object */ return distr; } /* end of unur_distr_uniform_wo_logpdf() */ /*---------------------------------------------------------------------------*/ #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/tests/testdistributions/vc_wo_logpdf.c0000644001357500135600000000667114420445767017644 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * Distribution objects of standard distributions without logPDF * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include "testdistributions.h" /*---------------------------------------------------------------------------*/ /* Continuous multivariate distributions without logPDF */ /*---------------------------------------------------------------------------*/ #define DISTR distr->data.cvec /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_multinormal_wo_logpdf( int dim, const double *mean, const double *covar ) { register struct unur_distr *distr; /* get distribution object for beta distribution */ distr = unur_distr_multinormal_w_marginals( dim, mean, covar ); /* name of distribution */ distr->name = "multinormal_wo_logpdf"; /* disable logPDF */ DISTR.logpdf = NULL; DISTR.dlogpdf = NULL; DISTR.pdlogpdf = NULL; /* return pointer to object */ return distr; } /* end of unur_distr_multinormal_wo_logpdf() */ /*---------------------------------------------------------------------------*/ #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/tests/t_cext.conf0000644001357500135600000002034014420445767013350 00000000000000############################################################################# [main] [main - data:] # method (for information only: the program scans the file name) method: CEXT [main - header:] /* prototypes */ int check_init(UNUR_GEN *gen); double check_sample(UNUR_GEN *gen); double exp1_sample(UNUR_GEN *gen); double expa_sample(UNUR_GEN *gen); int expb_init(UNUR_GEN *gen); double expb_sample(UNUR_GEN *gen); \#define COMPARE_SAMPLE_SIZE (500) \#define VIOLATE_SAMPLE_SIZE (20) /* \#define SEED (298346) */ ############################################################################# [new] [new - invalid distribution type: distr = unur_distr_discr_new(); ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID ############################################################################# [set] [set - invalid NULL ptr: par = NULL; ] ~_init(par,NULL); --> expected_setfailed --> UNUR_ERR_NULL ~_sample(par,NULL); --> expected_setfailed --> UNUR_ERR_NULL [set - invalid parameter object: distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); ] ~_init(par,NULL); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_sample(par,NULL); --> expected_setfailed --> UNUR_ERR_NULL ~_sample(par,check_sample); --> expected_setfailed --> UNUR_ERR_PAR_INVALID unur_par_free(par); ############################################################################# [get] [get - invalid NULL ptr: gen = NULL; ] ~_params(gen,(size_t)0); --> expected_NULL --> UNUR_ERR_NULL ############################################################################# # [chg] ############################################################################# [init] [init - invalid NULL ptr: par = NULL; ] unur_init( par ); --> expected_NULL --> UNUR_ERR_NULL ############################################################################# [reinit] [reinit - does not exist: distr = unur_distr_exponential(NULL,0); par = unur_cext_new(distr); unur_cext_set_sample(par,exp1_sample); gen = unur_init(par); <-- ! NULL ] unur_reinit( gen ); --> expected_reinit ############################################################################# [sample] [sample - compare clone: UNUR_GEN *clone; distr = unur_distr_exponential(NULL,0); par = NULL; gen = NULL; ] /* external generator 1 */ par = unur_cext_new(distr); unur_cext_set_sample(par,exp1_sample); gen = unur_init(par); -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen /* cstd */ unur_free(gen); par = unur_cstd_new(distr); gen = unur_init(par); -->compare_sequence_gen /* external generator A */ unur_free(gen); par = unur_cext_new(distr); unur_cext_set_sample(par,expa_sample); gen = unur_init(par); -->compare_sequence_gen /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen /* external generator B */ unur_free(gen); par = unur_cext_new(distr); unur_cext_set_init(par,expb_init); unur_cext_set_sample(par,expb_sample); gen = unur_init(par); -->compare_sequence_gen /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen #..................................................................... [sample - compare clone: UNUR_GEN *clone; double fpar[1] = { 1. }; distr = unur_distr_exponential(fpar,1); par = NULL; gen = NULL; ] /* external generator 1 */ par = unur_cext_new(distr); unur_cext_set_sample(par,exp1_sample); gen = unur_init(par); -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen /* cstd */ unur_free(gen); par = unur_cstd_new(distr); gen = unur_init(par); -->compare_sequence_gen /* external generator A */ unur_free(gen); par = unur_cext_new(distr); unur_cext_set_sample(par,expa_sample); gen = unur_init(par); -->compare_sequence_gen /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen /* external generator B */ unur_free(gen); par = unur_cext_new(distr); unur_cext_set_init(par,expb_init); unur_cext_set_sample(par,expb_sample); gen = unur_init(par); -->compare_sequence_gen /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen #..................................................................... [sample - compare clone: UNUR_GEN *clone; double fpar[1] = { 5. }; distr = unur_distr_exponential(fpar,1); par = NULL; gen = NULL; ] /* external generator A */ unur_free(gen); par = unur_cext_new(distr); unur_cext_set_sample(par,expa_sample); gen = unur_init(par); -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen /* external generator B */ unur_free(gen); par = unur_cext_new(distr); unur_cext_set_init(par,expb_init); unur_cext_set_sample(par,expb_sample); gen = unur_init(par); -->compare_sequence_gen /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen /* cstd */ unur_free(gen); par = unur_cstd_new(distr); gen = unur_init(par); -->compare_sequence_gen ############################################################################# [validate] [validate - generators:] # exponential(1): # standard distribution; do not read any parameters par[0] = unur_cext_new(@distr@); unur_cext_set_sample(par,exp1_sample); # exponential(lambda): # use pointer to parameter of distribution in sampling routine par[1] = unur_cext_new(@distr@); unur_cext_set_sample(par,expa_sample); # exponential(lambda): # store parameter of distribution in generator object during init par[2] = unur_cext_new(@distr@); unur_cext_set_init(par,expb_init); unur_cext_set_sample(par,expb_sample); # exponential # store parameter of distribution in generator object during init # change parameters { UNUR_DISTR *dg =NULL; par[3] = unur_cext_new(@distr@); unur_cext_set_init(par,expb_init); unur_cext_set_sample(par,expb_sample); fpm[0] = 2.; dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,1); unur_reinit(gen); } [validate - distributions:] # Exponential distribution distr[0] = unur_distr_exponential(NULL,0); fpm[0] = 5.; distr[1] = unur_distr_exponential(fpm,1); fpm[0] = 1.; distr[2] = unur_distr_exponential(fpm,1); ## number of distributions: 3 [validate - test chi2:] # + ... pass test # 0 ... fail to initialize generator (given variant does not exist) # - ... fail test # / ... either init fails or test passes # . ... do not run test # # ... comment # # generators: # [0] ... Exponential(0) # [1] ... Exponential(lambda): use pointer to distribution # [2] ... Exponential(lambda): store distrparams in object # [3] ... Exponential, reinit with changed parameters # #gen 0 1 2 3 # distribution #------------------------------------------------------------- <0> + + + + # standard exponential <1> - + + + # exponential (5) <2> + + + + # exponential (1) ############################################################################# ############################################################################# [verbatim] int check_init(UNUR_GEN *gen ATTRIBUTE__UNUSED) { return UNUR_SUCCESS; } double check_sample(UNUR_GEN *gen ATTRIBUTE__UNUSED) { return 0.; } /* ............. */ double exp1_sample(UNUR_GEN *gen) { double U = unur_sample_urng(gen); return (-log(1. - U)); } /* ............. */ double expa_sample(UNUR_GEN *gen) { \# define sigma (params[0]) /* scale */ double U = unur_sample_urng(gen); double X = -log(1. - U); double *params = unur_cext_get_distrparams(gen); if (params) return sigma * X; else return X; \# undef sigma } /* ............. */ int expb_init(UNUR_GEN *gen) { \# define sigma (params[0]) /* scale */ double *params = unur_cext_get_distrparams(gen); double *genpar = unur_cext_get_params(gen, sizeof(double)); genpar[0] = (params) ? sigma : 1.; return UNUR_SUCCESS; \# undef sigma } double expb_sample(UNUR_GEN *gen) { \# define sigma (params[0]) /* scale */ double U = unur_sample_urng(gen); double X = -log(1. - U); double *params = unur_cext_get_params(gen,(size_t)0); return sigma * X; \# undef sigma } ############################################################################# unuran-1.11.0/tests/test_functionparser.m0000644001357500135600000002515714420445767015505 00000000000000(***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: test_functionparser.m * * * * Create file with results of evaluations of algebraic expersions * * and make C test file. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************) (* === List of tests ========================================================*) (* Input the function of testing in the following format : {"function_string",{minimal_function_value,maximal_function_value,\ number_of_function_value} *) Testsample = { (* --- arithmetic operator --- *) {"3.45+x", {-2, 2, 5}}, {"x-4.673", {-200, 200000, 5}}, {"3*x", {-2, 2, 5}}, {"x/5.8", {-2, 2, 5}}, {"x^12-3.345+5", {-2, 2, 5}}, {"3*x", {-2, 2, 5}}, {"2.894736*10^2", {-2, 2, 5}}, {"2.784e-2", {-2,2,5}}, {"2.784*e",{-2,2,5}}, {"-4.7285e-7*x",{-2,2,5}}, (* --- brackets --- *) {"3*(x^5-x^4/(1.5-x))", {-2, 2, 5}}, (* --- relational operators --- *) (* (* Does not work for Mathematica 5.1 any more! *) {"3*(x>1)" ,{-2,2,5}}, {"3*(x<1)" ,{-2,2,5}}, {"3*(x>=1)",{-2,2,5}}, {"3*(x<=1)",{-2,2,5}}, {"3*(x==1)",{-2,2,5}}, {"3*(2==x)",{-2,2,5}}, {"3*(x<>1)",{-2,2,5}}, {"3*(2<>x)",{-2,2,5}}, {"3*(2!=x)",{-2,2,5}}, {"3*(2=x)",{-2,2,5}}, *) (* --- system functions --- *) {"exp[-4*X]", {-2, 2, 5}}, {"log[x]", {1,6,6}}, {"sqrt[x]", {1,6,6}}, {"sin[x]", {1,6,6}}, {"mod[x,3]", {1,6,6}}, {"sgn[x]", {-2,2,5}}, {"sec[x]", {-2,2,5}}, {"exp[-x^2]+log[2]-Pi*sin[x+x*2]", {-5*10^1, 2.3454*10^2,7}}, {"Sin[x]*3*log[x]", {2, 4, 2}}, {"abs[x]-3*x", {-2, 2, 5}} (* (* does not work with Mathematica 3.0 *) {"(sin[ ln[3*x*(cos[ 3*x^3-4.6789/(x+4)])]])-1", {-38.828,454.4*10^3,7}}, *) (* (* Does not work for Mathematica 5.1 any more! *) {"exp[x^2]*(sin[x*cos[x^2-1]]+1)*((x-3*pi*x)<1)", {-3,7,5}} *) }; (* === Set Constants ========================================================*) (* name of datafile file for running tests *) DataFile = "t_functionparser.data"; (* === Define cosntants and functions for function parser ===================*) (* --- Constants ----------------------------------------------------------- *) pi = Pi; e = E; (* --- Functions ----------------------------------------------------------- *) mod[x_,y_] := Mod[x,y]; exp[x_] := Exp[x]; log[x_] := Log[x]; sin[x_] := Sin[x]; cos[x_] := Cos[x]; tan[x_] := Tan[x]; sec[x_] := 1/Cos[x]; sqrt[x_] := Sqrt[x]; abs[x_] := Abs[x]; sgn[x_] := Sign[x]; (* === Define derivatives for these functions (according to function parser) *) Unprotect[Derivative]; (* --- Relation Operators -------------------------------------------------- *) Derivative[1][Sign][x_] := 0; Derivative[1, 0][Unequal][x_, y_] := 0; Derivative[0, 1][Unequal][x_, y_] := 0; Derivative[1, 0][Greater][x_, y_] := 0; Derivative[0, 1][Greater][x_, y_] := 0; Derivative[1, 0][GreaterEqual][x_, y_] := 0; Derivative[0, 1][GreaterEqual][x_, y_] := 0; Derivative[1, 0][Less][x_, y_] := 0; Derivative[0, 1][Less][x_, y_] := 0; Derivative[1, 0][LessEqual][x_, y_] := 0; Derivative[0, 1][LessEqual][x_, y_] := 0; Derivative[1, 0][Mod][x_, y_] := 0; Derivative[0, 1][Mod][x_, y_] := 0; (* --- Functions ----------------------------------------------------------- *) Derivative[1][Abs][x_] := sgn[x]; (* ------------------------------------------------------------------------- *) Protect[Derivative]; (* === Write results for an expression into data file ====================== *) UnurWriteData[expression_,points__] := Module [ (* expression ... function term *) (* points ... list {x_min, x_max, number of points} *) (* local variables *) { funct, (* string use to compute expression with Mathematica *) x, (* argument for function *) xmin, (* minimal value for x *) xmax, (* maximal value for x *) xstep (* step width *) }, (* convert to lower case letters *) funct = ToLowerCase[expression]; (* print function string into data file *) WriteString[DataFile, "function=", UnurTransformExpression[funct], "\n"]; (* get values for x *) xmin = points[[1]]; xmax = points[[2]]; xstep = (xmax - xmin) / (points[[3]]-1); xmax += xstep/2; (* print function and its derivative at all given points *) Do[ UnurWriteLine[x,funct],{x,xmin,xmax,xstep}]; (* add blank line *) WriteString[DataFile,"\n"]; ]; (* end of UnurWriteData[] *) (* --- Transform expression into string for function parser ---------------- *) UnurTransformExpression[expression_] := Module [ (* expression ... function term *) (* local variables *) {fstr}, (* Replace square brackets by parenthesis *) fstr = StringReplace[ expression, {"[" -> "(", "]" -> ")"}]; (* return result *) Return[fstr]; ]; (* end of UnurTransformExpression[] *) (* --- Transform expression into string for Mathematica computation ----------*) UnurTransformMathExpression[expression_] := Module [ (* expression ... function term *) (* local variables *) {fstr}, (* replace '<>' -> '!=' *) fstr = StringReplace[expression, {"<>" -> "!="}]; (* replace 'and' -> '&&', 'or' -> '||' *) fstr = StringReplace[fstr,{"and" -> "&&","or" -> "||"}]; (* replace '=' -> '==' *) fstr = StringReplace[fstr,{"=" -> "=="}]; fstr = StringReplace[fstr,{"====" -> "==","<==" -> "<=",">=="->">=", "!==" -> "!="}]; (* replace e.g'2.45e-3' -> '1.45*10^2' *) fstr = StringReplace[fstr,{"0e" -> "0*10^","1e" -> "1*10^", "2e" -> "2*10^","3e" -> "3*10^", "3e" -> "3*10^","4e" -> "4*10^", "5e" -> "5*10^","6e" -> "6*10^", "7e" -> "7*10^","8e" -> "8*10^", "8e" -> "8*10^","9e" -> "9*10^"}]; (* return result *) Return[fstr]; ]; (* end of UnurTransformMathExpression[] *) (* --- Compute function and write line into date file ---------------- *) UnurWriteLine[xarg_,funct_] := Module [ (* xarg ... argument *) (* funct ... function term *) (* local variables *) { xval, (* numerical value of argument x *) fx, (* value of function at x *) dfx, (* value of derivative of function at x *) fstr (* function term *) }, (* argument *) xval = N[xarg]; WriteString[DataFile, CForm[xval],"\t"]; fstr = UnurTransformMathExpression[funct]; (* function *) fx = N[ToExpression[fstr]] /. x -> xval /. {True -> 1, False -> 0}; (* if fx is Complex the output is 'inf' *) If[Head[fx]===Complex, WriteString[DataFile, "inf" ,"\t"], WriteString[DataFile, CForm[fx],"\t"] ]; (* derivative *) dfx = N[ D[ ToExpression[fstr], x ]] /. x -> xval /. {True -> 1, False -> 0}; (* if dfx is Complex the output is 'inf' *) If[Head[dfx]===Complex, WriteString[DataFile, "inf" ,"\n"], WriteString[DataFile, CForm[dfx],"\n"] ]; ]; (* end of UnurWriteLine[] *) (* === Main ================================================================ *) Do [ fstr = Testsample[[i]][[1]]; points = Testsample[[i]][[2]]; UnurWriteData[fstr, points], {i, 1, Length[Testsample]} ]; (* === Exit ================================================================ *) Quit[] unuran-1.11.0/tests/t_distr_corder.c0000644001357500135600000011660114430713513014357 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for DISTR_CORDER **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); int unur_distr_corder_set_verify( UNUR_PAR *par, int verify); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ #define COMPARE_SAMPLE_SIZE (500) #define VIOLATE_SAMPLE_SIZE (20) /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,25,(unur_distr_corder_new( distr, 5, 2 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,25,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,32,(unur_distr_corder_new( distr, 5, 2 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,32,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid order statistics */ UNUR_DISTR *distr = NULL; UNUR_DISTR *os; distr = unur_distr_normal(NULL,0); os = unur_distr_corder_new( distr, 5, 2 ); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,41,(unur_distr_corder_new( os, 5, 2 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,41,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(os); unur_distr_free(distr); } { /* invalid data */ UNUR_DISTR *distr = NULL; distr = unur_distr_normal(NULL,0); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,50,(unur_distr_corder_new( distr, 5, 6 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,50,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,53,(unur_distr_corder_new( distr, 1, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,53,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,56,(unur_distr_corder_new( distr, 2, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,56,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [set] */ void test_set (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[set "); fflush(stdout); fprintf(TESTLOG,"\n[set]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,67,(unur_distr_corder_set_rank( distr, 5, 2 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,67,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,70,(unur_distr_corder_set_pdfparams( distr, NULL, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,70,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,73,(unur_distr_corder_set_domain( distr, 0., 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,73,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,76,(unur_distr_corder_set_mode( distr, 0. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,76,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,79,(unur_distr_corder_set_pdfarea( distr, 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,79,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution object */ UNUR_DISTR *distr = NULL; distr = unur_distr_normal(NULL,0); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,86,(unur_distr_corder_set_rank( distr, 5, 2 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,86,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution object */ UNUR_DISTR *distr = NULL; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,92,(unur_distr_corder_set_pdfparams( distr, NULL, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,92,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,95,(unur_distr_corder_set_domain( distr, 0., 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,95,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,98,(unur_distr_corder_set_mode( distr, 0. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,98,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,101,(unur_distr_corder_set_pdfarea( distr, 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,101,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; UNUR_DISTR *os; distr = unur_distr_normal(NULL,0); os = unur_distr_corder_new( distr, 5, 2 ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,109,(unur_distr_corder_set_pdfparams( distr, NULL, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,109,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(os); unur_distr_free(distr); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; UNUR_DISTR *os; distr = unur_distr_normal(NULL,0); os = unur_distr_corder_new( distr, 5, 2 ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,119,(unur_distr_corder_set_rank( os, 5, 20 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,119,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,122,(unur_distr_cont_set_pdfarea( distr, -1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,122,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_distr_free(os); unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_set() */ /*---------------------------------------------------------------------------*/ /* [get] */ void test_get (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[get "); fflush(stdout); fprintf(TESTLOG,"\n[get]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; int n, k; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,136,(unur_distr_corder_get_distribution( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,136,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,139,(unur_distr_corder_get_rank( distr, &n, &k )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,139,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; int n, k; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,147,(unur_distr_corder_get_distribution( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,147,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,150,(unur_distr_corder_get_rank( distr, &n, &k )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,150,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* parameters not unknown */ UNUR_DISTR *distr = NULL; int n, k; distr = unur_distr_cont_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,158,(unur_distr_corder_get_distribution( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,158,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,161,(unur_distr_corder_get_rank( distr, &n, &k )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,161,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_get() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* compare clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; 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 ); abort_if_NULL(TESTLOG, 187, gen ); unur_reset_errno(); /* original generator object */; n_tests_failed += (compare_sequence_gen_start(TESTLOG,191,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,197,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare stringparser */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; UNUR_DISTR *os = NULL; distr = NULL; par = NULL; gen = NULL; unur_reset_errno(); 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); n_tests_failed += (compare_sequence_gen_start(TESTLOG,212,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); 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"); n_tests_failed += (compare_sequence_gen(TESTLOG,219,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* [validate] */ /*---------------------------------------------------------------------------*/ /* [validate] */ void test_validate (void) { /* suppress GCC compiler warning */ GCC_DIAG_OFF(unused-variable) UNUR_DISTR *distr[16]; UNUR_PAR *par; UNUR_GEN *gen; double *darray; double fpm[10]; int n_tests_failed; int rcode; /* start test */ printf("[validate "); fflush(stdout); fprintf(TESTLOG,"\n[validate]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* distributions: 16 */ { { 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); } } { { UNUR_DISTR *d; d = unur_distr_cauchy(NULL,0); distr[3] = unur_distr_corder_new( d, 10, 8); unur_distr_free(d); } } { { 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); } } { { 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); } } { { UNUR_DISTR *d; d = unur_distr_uniform(NULL,0); distr[12] = unur_distr_corder_new( d, 10, 8); unur_distr_free(d); } } { { 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); } } { {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); } } /* timing */ stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); printf("\n(chi^2) "); fflush(stdout); /* chi^2 tests: 48 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nChi^2 Test:\n"); /* distribution [0] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_cpoints(par,50,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_arou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_ninv_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_cpoints(par,50,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_arou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_ninv_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [2] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_cpoints(par,50,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_arou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_ninv_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [3] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_cpoints(par,50,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_arou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_ninv_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [4] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_cpoints(par,50,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_arou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_ninv_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [5] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_cpoints(par,50,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_arou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_ninv_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [6] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_cpoints(par,50,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_arou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_ninv_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [7] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_cpoints(par,50,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_arou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_ninv_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [8] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_cpoints(par,50,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_arou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_ninv_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [9] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_cpoints(par,50,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_arou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_ninv_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [10] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_cpoints(par,50,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_arou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_ninv_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [11] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_cpoints(par,50,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_arou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_ninv_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [12] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_cpoints(par,50,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_arou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_ninv_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [13] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_cpoints(par,50,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_arou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_ninv_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [14] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_cpoints(par,50,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_arou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_ninv_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [15] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_cpoints(par,50,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_arou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_ninv_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); /* free distributions */ unur_distr_free(distr[0]); unur_distr_free(distr[1]); unur_distr_free(distr[2]); unur_distr_free(distr[3]); unur_distr_free(distr[4]); unur_distr_free(distr[5]); unur_distr_free(distr[6]); unur_distr_free(distr[7]); unur_distr_free(distr[8]); unur_distr_free(distr[9]); unur_distr_free(distr[10]); unur_distr_free(distr[11]); unur_distr_free(distr[12]); unur_distr_free(distr[13]); unur_distr_free(distr[14]); unur_distr_free(distr[15]); /* test finished */ test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; /* we accept CHI2_FAILURES_TOLERATED failures */ (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_validate */ /* enable GCC compiler warning */ GCC_DIAG_ON(unused-variable) /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_distr_corder_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_deprecated_tdrgw.c0000644001357500135600000063446214430713513015215 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for TDRGW **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ double logpdf_normal_1( double x, const UNUR_DISTR *distr ); double dlogpdf_normal_1( double x, const UNUR_DISTR *distr ); double cdf_normal_1( double x, const UNUR_DISTR *distr ); double logpdf_normal_2( double x, const UNUR_DISTR *distr ); double dlogpdf_normal_2( double x, const UNUR_DISTR *distr ); double cdf_normal_2( double x, const UNUR_DISTR *distr ); #define COMPARE_SAMPLE_SIZE (10000) #define VIOLATE_SAMPLE_SIZE (20) /* #define SEED (298346) */ /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ /* logPDF of normal density */ double logpdf_normal_1( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return (-x*x/2. - 10000.); } double dlogpdf_normal_1( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return (-x); } double cdf_normal_1( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { static UNUR_DISTR *normal = NULL; static double fpm[2] = {0., 1.}; if (normal == NULL) normal = unur_distr_normal(fpm,2); return unur_distr_cont_eval_cdf( x, normal ); } /* ......................................................................... */ #define mu_2 (100.) double logpdf_normal_2( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return (-(x-mu_2)*(x-mu_2)/2. - 10000.); } double dlogpdf_normal_2( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return (-(x-mu_2)); } double cdf_normal_2( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { static UNUR_DISTR *normal_2 = NULL; static double fpm[2] = {mu_2, 1.}; if (normal_2 == NULL) normal_2 = unur_distr_normal(fpm,2); return unur_distr_cont_eval_cdf( x, normal_2 ); } /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,33,(unur_tdrgw_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,33,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,39,(unur_tdrgw_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,39,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* data missing in distribution object */ UNUR_DISTR *distr = NULL; distr = unur_distr_normal_wo_logpdf(NULL,0); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,45,(unur_tdrgw_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,45,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* data missing in distribution object */ UNUR_DISTR *distr = NULL; distr = unur_distr_cont_new(); unur_reset_errno(); /* logpdf, dlogpdf */ n_tests_failed += (check_expected_NULL(TESTLOG,53,(unur_tdrgw_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,53,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* dlogpdf */ unur_distr_cont_set_logpdf(distr,logpdf_normal_1); n_tests_failed += (check_expected_NULL(TESTLOG,58,(unur_tdrgw_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,58,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [set] */ void test_set (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[set "); fflush(stdout); fprintf(TESTLOG,"\n[set]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,68,(unur_tdrgw_set_cpoints( par, 0, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,68,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,71,(unur_tdrgw_set_reinit_percentiles( par, 0, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,71,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,74,(unur_tdrgw_set_reinit_ncpoints( par, 20 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,74,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,77,(unur_tdrgw_set_max_intervals( par, 100 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,77,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,80,(unur_tdrgw_set_verify( par, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,80,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,83,(unur_tdrgw_set_pedantic( par, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,83,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* invalid parameter object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = unur_distr_normal(NULL,0); par = unur_tdr_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,91,(unur_tdrgw_set_cpoints( par, 0, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,91,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,94,(unur_tdrgw_set_reinit_percentiles( par, 0, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,94,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,97,(unur_tdrgw_set_reinit_ncpoints( par, 30 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,97,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,100,(unur_tdrgw_set_max_intervals( par, 100 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,100,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,103,(unur_tdrgw_set_verify( par, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,103,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,106,(unur_tdrgw_set_pedantic( par, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,106,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double stp[] = {1.,0.,1.}; double perc[] = {0.1,0.4,0.2}; int n_stp = 3; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_tdrgw_new(distr); unur_reset_errno(); unur_tdrgw_set_cpoints( par, -1, NULL ); n_tests_failed += (check_errorcode(TESTLOG,119,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,122,(unur_tdrgw_set_cpoints( par, n_stp, stp )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,122,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_tdrgw_set_reinit_percentiles( par, -1, NULL ); n_tests_failed += (check_errorcode(TESTLOG,125,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,128,(unur_tdrgw_set_reinit_percentiles( par, n_stp, stp )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,128,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,131,(unur_tdrgw_set_reinit_percentiles( par, n_stp, perc )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,131,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,134,(unur_tdrgw_set_reinit_ncpoints( par, 9 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,134,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,137,(unur_tdrgw_set_max_intervals( par, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,137,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_set() */ /*---------------------------------------------------------------------------*/ /* [get] */ void test_get (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[get "); fflush(stdout); fprintf(TESTLOG,"\n[get]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid generator object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_tdr_new(distr); gen = unur_init(par); abort_if_NULL(TESTLOG, 147, gen ); unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,151,(unur_tdrgw_get_loghatarea(gen)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,151,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_get() */ /*---------------------------------------------------------------------------*/ /* [chg] */ void test_chg (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[chg "); fflush(stdout); fprintf(TESTLOG,"\n[chg]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid generator object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_tdr_new(distr); unur_set_debug(par,0); gen = unur_init( par ); abort_if_NULL(TESTLOG, 161, gen ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,165,(unur_tdrgw_chg_verify(gen,1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,165,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,168,(unur_tdrgw_chg_reinit_percentiles(gen, -1, NULL)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,168,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,171,(unur_tdrgw_chg_reinit_ncpoints(gen, 30)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,171,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double percmon[] = {0.1,0.4,0.2}; double percdom[] = {0.1,0.4,2.}; int n_perc = 3; distr = unur_distr_normal(NULL,0); par = unur_tdrgw_new(distr); unur_set_debug(par,0); gen = unur_init( par ); abort_if_NULL(TESTLOG, 180, gen ); unur_reset_errno(); unur_tdrgw_chg_reinit_percentiles( gen, -1, NULL ); n_tests_failed += (check_errorcode(TESTLOG,184,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,187,(unur_tdrgw_chg_reinit_percentiles( gen, n_perc, percmon )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,187,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,190,(unur_tdrgw_chg_reinit_percentiles( gen, n_perc, percdom )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,190,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,193,(unur_tdrgw_chg_reinit_ncpoints( gen, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,193,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_chg() */ /*---------------------------------------------------------------------------*/ /* [init] */ void test_init (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[init "); fflush(stdout); fprintf(TESTLOG,"\n[init]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,204,(unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,204,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* stp out of domain */ UNUR_GEN *gen = NULL; UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double stp[] = {-2.5,-1.,0.,1.,2.5}; int n_stp = 5; gen = NULL; distr = unur_distr_normal(NULL,0); unur_distr_cont_set_domain(distr,-2.,2.); par = unur_tdrgw_new(distr); unur_tdrgw_set_cpoints( par, n_stp, stp ); unur_reset_errno(); gen = unur_init( par ); n_tests_failed += (check_errorcode(TESTLOG,216,UNUR_ERR_GEN_DATA)==UNUR_SUCCESS)?0:1; unur_free(gen); unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_init() */ /*---------------------------------------------------------------------------*/ /* [reinit] */ void test_reinit (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[reinit "); fflush(stdout); fprintf(TESTLOG,"\n[reinit]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* exist */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_tdrgw_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 225, gen ); unur_reset_errno(); n_tests_failed += (check_expected_reinit(TESTLOG,229,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_reinit() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_GEN *gen = NULL; gen = NULL; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,239,(unur_tdrgw_eval_invcdfhat(gen,0.5)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,239,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_free(gen); } { /* invalid generator object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); gen = unur_init(par); abort_if_NULL(TESTLOG, 245, gen ); unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,249,(unur_tdrgw_eval_invcdfhat(gen,0.5)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,249,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* invalid domain */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_tdrgw_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 255, gen ); unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,259,(unur_tdrgw_eval_invcdfhat(gen,1.5)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,259,UNUR_ERR_DOMAIN)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_negINFINITY(TESTLOG,262,(unur_tdrgw_eval_invcdfhat(gen,-0.5)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,262,UNUR_ERR_DOMAIN)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = unur_distr_normal(NULL,0); par = NULL; unur_reset_errno(); /* default */ par = unur_tdrgw_new(distr); n_tests_failed += (compare_sequence_par_start(TESTLOG,272,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* verifying mode */ par = unur_tdrgw_new(distr); unur_tdrgw_set_verify(par,1); n_tests_failed += (compare_sequence_par(TESTLOG,277,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* don't use private copy for distr object */ par = unur_tdrgw_new(distr); unur_set_use_distr_privatecopy(par,FALSE); n_tests_failed += (compare_sequence_par(TESTLOG,282,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* verifying mode, don't use private copy for distr object */ par = unur_tdrgw_new(distr); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_verify(par,1); n_tests_failed += (compare_sequence_par(TESTLOG,288,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* compare clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; UNUR_GEN *clone; double fpar[] = {1.23456,2.3456}; distr = unur_distr_normal(fpar,2); par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_tdrgw_new(distr); unur_tdrgw_set_max_intervals(par,2); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,303,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,309,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* dont use private copy for distr object */ /* original generator object */ unur_free(clone); par = unur_tdrgw_new(distr); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_max_intervals(par,2); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,318,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,324,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare reinit */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_tdrgw_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,336,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* reinit */ unur_reinit(gen); n_tests_failed += (compare_sequence_gen(TESTLOG,340,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare stringparser */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[2] = {3.,3.}; distr = NULL; par = NULL; gen = NULL; unur_reset_errno(); distr = unur_distr_gamma(fpar,2); par = unur_tdrgw_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,353,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "gamma(3.,3.) & method = ars "); n_tests_failed += (compare_sequence_gen(TESTLOG,358,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; distr = unur_distr_gamma(fpar,2); par = unur_tdrgw_new(distr); unur_tdrgw_set_cpoints(par,20,NULL); unur_tdrgw_set_max_intervals(par,32); unur_tdrgw_set_verify(par,TRUE); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,368,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "gamma(3.,3.) & \ method = ars; cpoints = 20; \ max_intervals = 32; verify" ); n_tests_failed += (compare_sequence_gen(TESTLOG,375,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* [validate] */ /*---------------------------------------------------------------------------*/ /* [validate] */ void test_validate (void) { /* suppress GCC compiler warning */ GCC_DIAG_OFF(unused-variable) UNUR_DISTR *distr[31]; UNUR_PAR *par; UNUR_GEN *gen; double *darray; double fpm[10]; int n_tests_failed; int rcode; /* start test */ printf("[validate "); fflush(stdout); fprintf(TESTLOG,"\n[validate]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* distributions: 31 */ { fpm[0] = 1.; fpm[1] = 2.; distr[0] = unur_distr_beta(fpm,2); } { fpm[0] = 1.; fpm[1] = 5.; distr[1] = unur_distr_beta(fpm,2); } { fpm[0] = 1.; fpm[1] = 100.; distr[2] = unur_distr_beta(fpm,2); } { fpm[0] = 2.; fpm[1] = 5.; distr[3] = unur_distr_beta(fpm,2); } { fpm[0] = 5.; fpm[1] = 2.; distr[4] = unur_distr_beta(fpm,2); } { fpm[0] = 3.; fpm[1] = 4.; distr[5] = unur_distr_beta(fpm,2); } { fpm[0] = 5.; fpm[1] = 100.; distr[6] = unur_distr_beta(fpm,2); } { fpm[0] = 500.; fpm[1] = 300.; distr[7] = unur_distr_beta(fpm,2); } { fpm[0] = 5.; fpm[1] = 10.; fpm[2] = -3.; fpm[3] = 15.; distr[8] = unur_distr_beta(fpm,4); } { distr[9] = unur_distr_cauchy(NULL,0); } { fpm[0] = 1.; fpm[1] = 20.; distr[10] = unur_distr_cauchy(fpm,2); } { distr[11] = unur_distr_exponential(NULL,0); } { fpm[0] = 30.; fpm[1] = -5.; distr[12] = unur_distr_exponential(fpm,2); } { fpm[0] = 1.; distr[13] = unur_distr_gamma(fpm,1); } { fpm[0] = 2.; distr[14] = unur_distr_gamma(fpm,1); } { fpm[0] = 3.; distr[15] = unur_distr_gamma(fpm,1); } { fpm[0] = 10.; distr[16] = unur_distr_gamma(fpm,1); } { fpm[0] = 1000.; distr[17] = unur_distr_gamma(fpm,1); } { fpm[0] = 5.; fpm[1] = 1000.; distr[18] = unur_distr_gamma(fpm,2); } { fpm[0] = 5.; fpm[1] = 1.e-5; distr[19] = unur_distr_gamma(fpm,2); } { fpm[0] = 5.; fpm[1] = 10.; fpm[2] = 1000; distr[20] = unur_distr_gamma(fpm,3); } { distr[21] = unur_distr_laplace(NULL,0); } { fpm[0] = -10.; fpm[1] = 100.; distr[22] = unur_distr_laplace(fpm,2); } { distr[23] = unur_distr_normal(NULL,0); } { fpm[0] = 1.; fpm[1] = 1.e-5; distr[24] = unur_distr_normal(fpm,2); } { fpm[0] = 0.; fpm[1] = 1.e+5; distr[25] = unur_distr_normal(fpm,2); } { distr[26] = unur_distr_uniform(NULL,0); } { fpm[0] = 1.; fpm[1] = 20.; distr[27] = unur_distr_uniform(fpm,2); } { fpm[0] = 3.; fpm[1] = 4.; distr[28] = unur_distr_beta(fpm,2); unur_distr_cont_set_domain(distr[23],-2.,5.); } { distr[29] = unur_distr_cont_new(); unur_distr_cont_set_logpdf(distr[29],logpdf_normal_1); unur_distr_cont_set_dlogpdf(distr[29],dlogpdf_normal_1); unur_distr_cont_set_cdf(distr[29],cdf_normal_1); unur_distr_set_name(distr[29],"normal_1"); } { distr[30] = unur_distr_cont_new(); unur_distr_cont_set_logpdf(distr[30],logpdf_normal_2); unur_distr_cont_set_dlogpdf(distr[30],dlogpdf_normal_2); unur_distr_cont_set_cdf(distr[30],cdf_normal_2); unur_distr_set_name(distr[30],"normal_2"); } /* timing */ stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); printf("\n(chi^2) "); fflush(stdout); /* chi^2 tests: 217 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nChi^2 Test:\n"); /* distribution [0] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdrgw_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdrgw_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [2] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdrgw_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [3] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdrgw_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [4] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdrgw_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [5] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdrgw_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [6] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdrgw_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [7] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdrgw_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [8] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdrgw_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [9] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdrgw_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [10] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdrgw_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [11] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdrgw_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [12] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdrgw_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [13] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tdrgw_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [14] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tdrgw_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [15] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tdrgw_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [16] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tdrgw_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [17] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdrgw_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [18] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdrgw_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [19] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdrgw_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [20] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdrgw_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [21] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdrgw_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [22] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdrgw_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [23] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdrgw_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [24] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdrgw_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [25] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdrgw_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [26] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdrgw_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [27] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdrgw_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [28] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdrgw_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [29] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_tdrgw_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [30] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tdrgw_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tdrgw_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); printf("\n(verify hat) "); fflush(stdout); /* verify hat tests: 217 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nVerify Hat Test (squeeze <= PDF <= hat):\n"); /* distribution [0] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [2] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [3] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [4] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [5] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [6] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [7] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [8] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [9] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [10] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [11] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [12] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [13] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [14] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [15] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [16] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [17] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [18] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [19] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [20] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [21] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [22] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [23] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [24] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [25] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [26] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [27] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [28] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdrgw_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [29] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,3,NULL); unur_tdrgw_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [30] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tdrgw_new(distr_localcopy); unur_tdrgw_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_tdrgw_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_tdrgw_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); /* free distributions */ unur_distr_free(distr[0]); unur_distr_free(distr[1]); unur_distr_free(distr[2]); unur_distr_free(distr[3]); unur_distr_free(distr[4]); unur_distr_free(distr[5]); unur_distr_free(distr[6]); unur_distr_free(distr[7]); unur_distr_free(distr[8]); unur_distr_free(distr[9]); unur_distr_free(distr[10]); unur_distr_free(distr[11]); unur_distr_free(distr[12]); unur_distr_free(distr[13]); unur_distr_free(distr[14]); unur_distr_free(distr[15]); unur_distr_free(distr[16]); unur_distr_free(distr[17]); unur_distr_free(distr[18]); unur_distr_free(distr[19]); unur_distr_free(distr[20]); unur_distr_free(distr[21]); unur_distr_free(distr[22]); unur_distr_free(distr[23]); unur_distr_free(distr[24]); unur_distr_free(distr[25]); unur_distr_free(distr[26]); unur_distr_free(distr[27]); unur_distr_free(distr[28]); unur_distr_free(distr[29]); unur_distr_free(distr[30]); /* test finished */ test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; /* we accept CHI2_FAILURES_TOLERATED failures */ (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_validate */ /* enable GCC compiler warning */ GCC_DIAG_ON(unused-variable) /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_tdrgw_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_distr_corder.conf0000644001357500135600000002202314420445767015070 00000000000000############################################################################# [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] ############################################################################# unuran-1.11.0/tests/t_distr_condi.conf0000644001357500135600000002562314420445767014717 00000000000000############################################################################# [main] [main - data:] # method (for information only: the program scans the file name) method: DISTR_CONDI [main - header:] /* prototypes */ \#define COMPARE_SAMPLE_SIZE (500) \#define VIOLATE_SAMPLE_SIZE (20) ## work-around for missing functions int unur_distr_condi_set_pedantic(UNUR_PAR *par, int pedantic); int unur_distr_condi_chg_verify(UNUR_GEN *gen, int verify); ############################################################################# [new] [new - invalid NULL ptr: distr = NULL; ] unur_distr_condi_new( distr, NULL, NULL, 0 ); --> expected_NULL --> UNUR_ERR_NULL [new - invalid NULL ptr: distr = unur_distr_multinormal(3,NULL,NULL); ] unur_distr_condi_new( distr, NULL, NULL, 0 ); --> expected_NULL --> UNUR_ERR_NULL [new - invalid distribution type: double p[] = { 1., 2., 3., 4.}; distr = unur_distr_discr_new(); ] unur_distr_condi_new( distr, p, NULL, 4 ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID [new - invalid data: double p[] = { 1., 2., 3., 4.}; distr = unur_distr_multinormal(3,NULL,NULL); ] unur_distr_condi_new( distr, p, NULL, -1 ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID unur_distr_condi_new( distr, p, NULL, 3 ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID ############################################################################# [set] [set - invalid NULL ptr: distr = NULL; ] unur_distr_condi_set_condition( distr, NULL, NULL, 0 ); --> expected_setfailed --> UNUR_ERR_NULL [set - invalid distribution type: distr = unur_distr_discr_new(); ] unur_distr_condi_set_condition( distr, NULL, NULL, 0 ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID [set - invalid data: double p[] = { 1., 2., 3., 4.}; UNUR_DISTR *condi; distr = unur_distr_multinormal(3,NULL,NULL); condi = unur_distr_condi_new( distr, p, NULL, 0 ); ] unur_distr_condi_set_condition( condi, p, NULL, -1 ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_condi_set_condition( condi, p, NULL, 3 ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_free(condi); ############################################################################# [get] [get - invalid NULL ptr: const double *pos, *dir; int k; distr = NULL; ] unur_distr_condi_get_distribution( distr ); --> expected_NULL --> UNUR_ERR_NULL unur_distr_condi_get_condition( distr, &pos, &dir, &k ); --> expected_setfailed --> UNUR_ERR_NULL [get - invalid distribution type: const double *pos, *dir; int k; distr = unur_distr_cont_new(); ] unur_distr_condi_get_distribution( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID unur_distr_condi_get_condition( distr, &pos, &dir, &k ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID ############################################################################# # [chg] ############################################################################## # [init] ############################################################################# # [reinit] ############################################################################# [sample] [sample - check for memory leaks: double p[] = { 1., 2., 3., 4.}; double dir[] = { 1., -1., 2., -2.}; UNUR_DISTR *condi; distr = unur_distr_multinormal(3,NULL,NULL); condi = unur_distr_condi_new( distr, p, NULL, 0 ); ] unur_distr_condi_set_condition( condi, p, NULL, 1 ); --> none --> UNUR_SUCCESS unur_distr_condi_set_condition( condi, p, dir, 1 ); --> none --> UNUR_SUCCESS unur_distr_free(condi); [sample - check for memory leaks: double p[] = { 1., 2., 3., 4.}; double dir[] = { 1., -1., 2., -2.}; UNUR_DISTR *condi; distr = unur_distr_multinormal(4,NULL,NULL); condi = unur_distr_condi_new( distr, p, dir, 0 ); ] unur_distr_condi_set_condition( condi, p, dir, 1 ); --> none --> UNUR_SUCCESS unur_distr_condi_set_condition( condi, p, NULL, 1 ); --> none --> UNUR_SUCCESS unur_distr_condi_set_condition( condi, p, dir, 3 ); --> none --> UNUR_SUCCESS unur_distr_free(condi); [sample - check for memory leaks: double p[] = { 1., 2., 3., 4.}; double dir[] = { 1., -1., 2., -2.}; UNUR_DISTR *condi; distr = unur_distr_multinormal(4,NULL,NULL); condi = unur_distr_condi_new( distr, p, NULL, 0 ); ] unur_distr_condi_set_condition( condi, p, NULL, 1 ); --> none --> UNUR_SUCCESS unur_distr_condi_set_condition( condi, p, dir, 1 ); --> none --> UNUR_SUCCESS unur_distr_condi_set_condition( condi, p, NULL, 3 ); --> none --> UNUR_SUCCESS unur_distr_free(condi); ############################################################################# [validate] [validate - generators:] # AROU (default) par[0] = unur_arou_new(@distr@); # TDR (default) par[1] = unur_tdr_new(@distr@); # TDR (T=log) par[2] = unur_tdr_new(@distr@); unur_tdr_set_c(par,0.); # ARS par[3] = unur_ars_new(@distr@); # TABL (default) par[4] = unur_tabl_new(@distr@); [validate - distributions:] # conditional: standard multinormal distribution \#define dim (3) UNUR_DISTR *normal = unur_distr_multinormal(dim,NULL,NULL); int i; double p[dim]; for(i=0;i + + + + + # standard multinormal (dim=3, coord=0) <1> + + + + + # standard multinormal (dim=3, coord=2) <2> x+ + + + + # standard multinormal (dim=4, random dir) x<3> . + + + + # multinormal (dim=3, random dir) <4> x+ + + + + # conditional: multinormal distribution with rectangular domain <5> x+ + + + . # conditional: multinormal distribution with rectangular domain <6> x+ + + + + # conditional: multinormal distribution with rectangular domain ############################################################################# ############################################################################# [verbatim] ## work-around for missing functions int unur_distr_condi_set_pedantic(UNUR_PAR *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) { return UNUR_FAILURE; } int unur_distr_condi_chg_verify(UNUR_GEN *gen, int verify) { if (unur_arou_chg_verify(gen,verify)==UNUR_SUCCESS) return UNUR_SUCCESS; if (unur_srou_chg_verify(gen,verify)==UNUR_SUCCESS) return UNUR_SUCCESS; if (unur_tabl_chg_verify(gen,verify)==UNUR_SUCCESS) return UNUR_SUCCESS; if (unur_tdr_chg_verify(gen,verify)==UNUR_SUCCESS) return UNUR_SUCCESS; if (unur_ars_chg_verify(gen,verify)==UNUR_SUCCESS) return UNUR_SUCCESS; return UNUR_FAILURE; } ############################################################################# unuran-1.11.0/tests/t_mcorr.c0000644001357500135600000004054114430713513013015 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for MCORR **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); int unur_mcorr_set_verify( UNUR_PAR *par, int verify); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ #define COMPARE_SAMPLE_SIZE (10000) #define VIOLATE_SAMPLE_SIZE (20) #include #include int mcorr_eigenvalues_test(int dim); /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ int mcorr_eigenvalues_test(int dim) /* returns 0 if everything is OK, 1 otherwise */ { UNUR_DISTR *corr_distr; UNUR_PAR *corr_par; UNUR_GEN *corr_gen; int i; int err = 0; double *mean; double *corr; double *eigenvalues, *eigenvalues_set; double *eigenvectors; mean = _unur_vector_new(dim); corr = _unur_vector_new(dim*dim); eigenvalues_set = _unur_vector_new(dim); eigenvalues = _unur_vector_new(dim); eigenvectors = _unur_vector_new(dim*dim); /* setting eigenvalues to const*{1,2,...,dim} with sum=dim */ for (i=0; itime = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [set] */ void test_set (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[set "); fflush(stdout); fprintf(TESTLOG,"\n[set]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; double *eigenvalues = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,48,(unur_mcorr_set_eigenvalues( par, eigenvalues )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,48,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double *eigenvalues = NULL; distr = unur_distr_correlation(4); par = unur_mcorr_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,57,(unur_mcorr_set_eigenvalues( par, eigenvalues )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,57,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } { /* invalid parameter object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double eigenvalues[] = {1,2,3}; distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,68,(unur_mcorr_set_eigenvalues( par, eigenvalues )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,68,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double eigenvalues[] = {1,-2,3}; distr = unur_distr_correlation(4); par = unur_mcorr_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,79,(unur_mcorr_set_eigenvalues( par, eigenvalues )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,79,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_set() */ /*---------------------------------------------------------------------------*/ /* [init] */ void test_init (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[init "); fflush(stdout); fprintf(TESTLOG,"\n[init]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,100,(unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,100,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_init() */ /*---------------------------------------------------------------------------*/ /* [reinit] */ void test_reinit (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[reinit "); fflush(stdout); fprintf(TESTLOG,"\n[reinit]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* exists */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_correlation(3); par = unur_mcorr_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 109, gen ); unur_reset_errno(); n_tests_failed += (check_expected_reinit(TESTLOG,113,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_reinit() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* compare clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; UNUR_GEN *clone; distr = unur_distr_correlation(4); par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_mcorr_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,128,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,134,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare clone */ UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; UNUR_DISTR *distr = NULL; UNUR_GEN *clone; double eigenvalues[] = {1.,2.,3.,4.}; par = NULL; gen = NULL; distr = unur_distr_correlation(4); unur_reset_errno(); /* original generator object */ par = unur_mcorr_new(distr); unur_mcorr_set_eigenvalues( par, eigenvalues ); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,149,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,155,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_free(gen); unur_distr_free(distr); } { /* compare reinit */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_correlation(4); par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_mcorr_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,167,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* reinit */ unur_reinit(gen); n_tests_failed += (compare_sequence_gen(TESTLOG,171,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare reinit */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double eigenvalues[] = {1.,2.,3.,4.}; distr = unur_distr_correlation(4); par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_mcorr_new(distr); unur_mcorr_set_eigenvalues( par, eigenvalues ); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,185,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* reinit */ unur_reinit(gen); n_tests_failed += (compare_sequence_gen(TESTLOG,189,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* [special] */ void test_special (void) { /* set boolean to FALSE */ int FAILED = 0; int errorsum = 0; int dim; /* start test */ printf("[special "); fflush(stdout); fprintf(TESTLOG,"\n[special]\n"); /* set stop watch */ stopwatch_lap(&watch); /* test for eigenvalues */ printf("\ntest eigenvalues"); fprintf(TESTLOG,"\nTest eigenvalues:\n"); for (dim=2; dim<10; dim++) { if (mcorr_eigenvalues_test(dim)) errorsum++; } /* test finished */ FAILED = (errorsum==0) ? 0: 1; /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (FAILED) ? 0 : 1; (FAILED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_special() */ /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_mcorr_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_tdr_ps.conf0000644001357500135600000003035014420445767013702 00000000000000############################################################################# [main] [main - data:] # method method: TDR [main - header:] /* prototypes */ double pdf_sqrtlin( double x, const UNUR_DISTR *distr ); double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ); double cdf_sqrtlin( double x, const UNUR_DISTR *distr ); double pdf_sqrtlinshft(double x, const UNUR_DISTR *distr ); double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); \#define COMPARE_SAMPLE_SIZE (10000) \#define VIOLATE_SAMPLE_SIZE (20) ############################################################################# [new] ############################################################################# # [set] ############################################################################# # [get] ############################################################################# # [chg] ############################################################################# # [init] ############################################################################# # [reinit] ############################################################################# [validate] [validate - generators:] # sqrt, PS par[0] = unur_tdr_new(@distr@); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); # sqrt, PS, few starting points, ARS par[1] = unur_tdr_new(@distr@); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); # sqrt, PS, few construction points par[2] = unur_tdr_new(@distr@); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); # sqrt, PS, truncated par[3] = unur_tdr_new(@distr@); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_chg_truncated(gen,0.5,0.9); # log, PS par[4] = unur_tdr_new(@distr@); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); # log, PS, few starting points, ARS par[5] = unur_tdr_new(@distr@); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); # log, PS, few construction points par[6] = unur_tdr_new(@distr@); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); # sqrt, PS, few construction points, urng_aux par[7] = unur_tdr_new(@distr@); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); # reinit, sqrt, PS par[8] = unur_tdr_new(@distr@); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(@distr@,fpm,2); unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); # reinit, log, PS par[9] = unur_tdr_new(@distr@); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(@distr@,fpm,2); unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); [validate - distributions:] # Beta distributions fpm[0] = 1.; fpm[1] = 2.; distr[0] = unur_distr_beta(fpm,2); fpm[0] = 1.; fpm[1] = 5.; distr[1] = unur_distr_beta(fpm,2); fpm[0] = 1.; fpm[1] = 100.; distr[2] = unur_distr_beta(fpm,2); fpm[0] = 2.; fpm[1] = 5.; distr[30] = unur_distr_beta(fpm,2); fpm[0] = 5.; fpm[1] = 2.; distr[31] = unur_distr_beta(fpm,2); fpm[0] = 3.; fpm[1] = 4.; distr[3] = unur_distr_beta(fpm,2); fpm[0] = 5.; fpm[1] = 100.; distr[4] = unur_distr_beta(fpm,2); fpm[0] = 500.; fpm[1] = 300.; distr[5] = unur_distr_beta(fpm,2); fpm[0] = 5.; fpm[1] = 10.; fpm[2] = -3.; fpm[3] = 15.; distr[6] = unur_distr_beta(fpm,4); # Cauchy distributions distr[7] = unur_distr_cauchy(NULL,0); fpm[0] = 1.; fpm[1] = 20.; distr[8] = unur_distr_cauchy(fpm,2); # Exponential distributions distr[24] = unur_distr_exponential(NULL,0); fpm[0] = 30.; fpm[1] = -5.; distr[25] = unur_distr_exponential(fpm,2); # Gamma distributions fpm[0] = 1.; distr[9] = unur_distr_gamma(fpm,1); fpm[0] = 2.; distr[10] = unur_distr_gamma(fpm,1); fpm[0] = 3.; distr[11] = unur_distr_gamma(fpm,1); fpm[0] = 10.; distr[12] = unur_distr_gamma(fpm,1); fpm[0] = 1000.; distr[13] = unur_distr_gamma(fpm,1); fpm[0] = 5.; fpm[1] = 1000.; distr[14] = unur_distr_gamma(fpm,2); fpm[0] = 5.; fpm[1] = 1.e-5; distr[15] = unur_distr_gamma(fpm,2); fpm[0] = 5.; fpm[1] = 10.; fpm[2] = 1000.; distr[16] = unur_distr_gamma(fpm,3); # Laplace distributions distr[26] = unur_distr_laplace(NULL,0); fpm[0] = -10.; fpm[1] = 100.; distr[27] = unur_distr_laplace(fpm,2); # Normal distributions distr[17] = unur_distr_normal(NULL,0); fpm[0] = 1.; fpm[1] = 1.e-5; distr[18] = unur_distr_normal(fpm,2); fpm[0] = 0.; fpm[1] = 1.e+5; distr[19] = unur_distr_normal(fpm,2); # Uniform distributions distr[20] = unur_distr_uniform(NULL,0); fpm[0] = 1.; fpm[1] = 20.; distr[21] = unur_distr_uniform(fpm,2); # F distributions fpm[0] = 4.; fpm[1] = 10.; distr[32] = unur_distr_F(fpm,2); # pdf with piecewise linear function as transformed density with T = -1/sqrt distr[28] = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr[28],pdf_sqrtlin); unur_distr_cont_set_dpdf(distr[28],dpdf_sqrtlin); unur_distr_cont_set_cdf(distr[28],cdf_sqrtlin); unur_distr_set_name(distr[28],"sqrtlin"); # pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode distr[29] = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr[29],pdf_sqrtlinshft); unur_distr_cont_set_dpdf(distr[29],dpdf_sqrtlinshft); unur_distr_cont_set_cdf(distr[29],cdf_sqrtlinshft); unur_distr_set_name(distr[29],"sqrtlin"); # truncated distributions distr[22] = unur_distr_cauchy(NULL,0); unur_distr_cont_set_domain(distr[22],0.1,1.); unur_distr_cont_upd_mode(distr[22]); unur_distr_cont_upd_pdfarea(distr[22]); # domain exceeds support of pdf fpm[0] = 3.; fpm[1] = 4.; distr[23] = unur_distr_beta(fpm,2); unur_distr_cont_set_domain(distr[23],-2.,5.); # number of distributions: 33 [validate - test chi2:] # + ... pass test # 0 ... fail to initialize generator # - ... fail test # . ... do not run test # # ... comment # # generators: # [0] sqrt, PS # [1] sqrt, PS, few starting points, ARS # [2] sqrt, PS, few construction points # [3] sqrt, PS, truncated # [4] log, PS # [5] log, PS, few starting points, ARS # [6] log, PS, few construction points # [7] sqrt, PS, few construction points, urng_aux # [8] reinit, log, PS # [9] reinit, sqrt, PS # # # 0 1 2 3 4 5 6 7 8 9 # distribution #----------------------------------------------------- x <0> + + + + + + + + + + # beta (1, 2) <1> + + + + + + + + . . # beta (1, 5) x <2> + + + + + + + + + + # beta (1, 100) <30> + + + + + + + + . . # beta (2, 5) <31> + + + + + + + + + + # beta (5, 2) <3> + + + + + + + + . . # beta (3, 4) <4> + + + + + + + + . . # beta (5, 100) <5> + + + + + + + + + + # beta (500, 300) <6> + + + + + + + + + + # beta (5, 10, -3, 15) <7> + + + + 0 - - + + 0 # cauchy () <8> + + + + 0 - - + + 0 # cauchy (1, 20) <24> + + + + + + + + + + # exponential () <25> + + + + + + + + + + # exponential (30, -5) x <9> + + + + + + + + . . # gamma (1) <10> + + + + + + + + . . # gamma (2) <11> + + + + + + + + + + # gamma (3) <12> + + + x+ + + + + . . # gamma (10) x<13> + + + . + + + + . . # gamma (1000) <14> + + + . + + + + . . # gamma (5, 1000, 0) x<15> + + + . + + + + . . # gamma (5, 1e-05, 0) x<16> + + + . + + + + . . # gamma (5, 10, 1000) <26> + + + + + + + + + + # laplace () <27> + + + + + + + + . . # laplace (-10, 100) <17> + + + + + + + + + + # normal () x<18> + + + + + + + + . . # normal (1, 1e-05) <19> + + + + + + + + . . # normal (1, 1e+05) <20> + + + + + + + + + + # uniform () <21> + + + + + + + + . . # uniform (1, 20) <32> + + + + 0 0 0 + - - # F (4, 10) <22> + + + + + + + + . . # cauchy () - truncated <23> + + + + + + + + . . # beta () - domain superset of support <28> + + + + 0 0 0 + . . # sqrtlin <29> + + + + 0 0 0 + . . # sqrtlin with shifted mode # sqrtlin ... pdf with piecewise linear function as # transformed density with T = -1/sqrt [validate - verify hat:] # + ... pass test # ~ ... fail in at most 1% of samples # 0 ... fail to initialize generator # - ... fail test # . ... do not run test # # ... comment # # generators: # [0] sqrt, PS # [1] sqrt, PS, few starting points, ARS # [2] sqrt, PS, few construction points # [3] sqrt, PS, truncated # [4] log, PS # [5] log, PS, few starting points, ARS # [6] log, PS, few construction points # [7] sqrt, PS, few construction points, urng_aux # [8] reinit, log, PS # [9] reinit, sqrt, PS # # # 0 1 2 3 4 5 6 7 8 9 # distribution #----------------------------------------------------- x <0> + + + + + + + + + + # beta (1, 2) <1> + + + + + + + + . . # beta (1, 5) x <2> + + + + + + + + + + # beta (1, 100) <30> + + + + + + + + . . # beta (2, 5) <31> + + + + + + + + + + # beta (5, 2) <3> + + + + + + + + . . # beta (3, 4) <4> + + + + + + + + . . # beta (5, 100) <5> + + + + + + + + + + # beta (500,300) <6> + + + + + + + + + + # beta (5, 10, -3, 15) <7> + + + + 0 - - + . . # cauchy () <8> + + + + 0 - - + . . # cauchy (1, 20) <24> + + + + + + + + + + # exponential () <25> + + + + + + + + + + # exponential (30, -5) x <9> + + + + + + + + . . # gamma (1) <10> + + + + + + + + . . # gamma (2) <11> + + + + + + + + + + # gamma (3) <12> + + + x+ + + + + . . # gamma (10) x<13> + + + . + + + + . . # gamma (1000) <14> + + + . + + + + . . # gamma (5, 1000, 0) x<15> + + + . + + + + . . # gamma (5, 1e-05, 0) x<16> + + + . + + + + . . # gamma (5, 10, 100000) <26> + + + + + + + + + + # laplace () <27> + + + + + + + + . . # laplace (-10, 100) <17> + + + + + + + + + + # normal () x<18> + + + + + + + + . . # normal (1, 1e-05) <19> + + + + + + + + . . # normal (1, 1e+05) <20> + + + + + + + + + + # uniform () <21> + + + + + + + + . . # uniform (1, 20) <32> + + + + 0 0 0 + - - # F (4, 10) <22> + + + + + + + + . . # cauchy () - truncated <23> + + + + + + + + . . # beta () - domain superset of support <28> + + + + . . . + . . # sqrtlin <29> . . . . . . . . . . # sqrtlin with shifted mode # sqrtlin ... pdf with piecewise linear function as # transformed density with T = -1/sqrt ############################################################################# ############################################################################# [verbatim] /* pdf with piecewise linear function as transformed density with T = -1/sqrt */ double pdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y = 1./(fabs(x)+1.); return y*y; } double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y = 1./(fabs(x)+1.); y = 2.*y*y*y; return ((x<0.) ? y : - y); } double cdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { if (x<=0.) return 0.5/(1.-x); else return (1.-0.5/(1.+x)); } /* pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode */ double pdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y; x -= 1000.; y = 1./(fabs(x)+1.); return y*y; } double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y; x -= 1000.; y = 1./(fabs(x)+1.); y = 2.*y*y*y; return ((x<0.) ? y : - y); } double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { x -= 1000.; if (x<=0.) return 0.5/(1.-x); else return (1.-0.5/(1.+x)); } ############################################################################# unuran-1.11.0/tests/t_ars.conf0000644001357500135600000004462414420445767013205 00000000000000############################################################################# [main] [main - data:] # method method: ARS [main - header:] /* prototypes */ double logpdf_normal_1( double x, const UNUR_DISTR *distr ); double dlogpdf_normal_1( double x, const UNUR_DISTR *distr ); double cdf_normal_1( double x, const UNUR_DISTR *distr ); double logpdf_normal_2( double x, const UNUR_DISTR *distr ); double dlogpdf_normal_2( double x, const UNUR_DISTR *distr ); double cdf_normal_2( double x, const UNUR_DISTR *distr ); \#define COMPARE_SAMPLE_SIZE (10000) \#define VIOLATE_SAMPLE_SIZE (20) /* \#define SEED (298346) */ ############################################################################# [new] [new - invalid NULL ptr: distr = NULL; ] ~( distr ); --> expected_NULL --> UNUR_ERR_NULL [new - invalid distribution type: distr = unur_distr_discr_new(); ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID [new - data missing in distribution object: distr = unur_distr_normal_wo_logpdf(NULL,0); ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED [new - data missing in distribution object: distr = unur_distr_cont_new(); ] /* logpdf, dlogpdf */ ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED /* dlogpdf */ unur_distr_cont_set_logpdf(distr,logpdf_normal_1); ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED ############################################################################# [set] [set - invalid NULL ptr: par = NULL; ] ~_cpoints( par, 0, NULL ); --> expected_setfailed --> UNUR_ERR_NULL ~_reinit_percentiles( par, 0, NULL ); --> expected_setfailed --> UNUR_ERR_NULL ~_reinit_ncpoints( par, 20 ); --> expected_setfailed --> UNUR_ERR_NULL ~_max_intervals( par, 100 ); --> expected_setfailed --> UNUR_ERR_NULL ~_max_iter( par, 100 ); --> expected_setfailed --> UNUR_ERR_NULL ~_verify( par, 1 ); --> expected_setfailed --> UNUR_ERR_NULL ~_pedantic( par, 1 ); --> expected_setfailed --> UNUR_ERR_NULL [set - invalid parameter object: distr = unur_distr_normal(NULL,0); par = unur_tdr_new(distr); ] ~_cpoints( par, 0, NULL ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_reinit_percentiles( par, 0, NULL ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_reinit_ncpoints( par, 30 ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_max_intervals( par, 100 ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_max_iter( par, 100 ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_verify( par, 1 ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_pedantic( par, 1 ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID unur_par_free(par); [set - invalid parameters: double stp[] = {1.,0.,1.}; double perc[] = {0.1,0.4,0.2}; int n_stp = 3; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_ars_new(distr); ] ~_cpoints( par, -1, NULL ); --> none --> UNUR_ERR_PAR_SET ~_cpoints( par, n_stp, stp ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_reinit_percentiles( par, -1, NULL ); --> none --> UNUR_ERR_PAR_SET ~_reinit_percentiles( par, n_stp, stp ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_reinit_percentiles( par, n_stp, perc ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_reinit_ncpoints( par, 9 ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_max_intervals( par, 0 ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_max_iter( par, 0 ); --> expected_setfailed --> UNUR_ERR_PAR_SET unur_par_free(par); ############################################################################# [get] [get - invalid generator object: distr = unur_distr_normal(NULL,0); par = unur_tdr_new(distr); gen = unur_init(par); <-- ! NULL ] ~_loghatarea(gen); --> expected_INFINITY --> UNUR_ERR_GEN_INVALID ############################################################################# [chg] [chg - invalid generator object: double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_tdr_new(distr); unur_set_debug(par,0); gen = unur_init( par ); <-- ! NULL ] ~_verify(gen,1); --> expected_setfailed --> UNUR_ERR_GEN_INVALID ~_reinit_percentiles(gen, -1, NULL); --> expected_setfailed --> UNUR_ERR_GEN_INVALID ~_reinit_ncpoints(gen, 30); --> expected_setfailed --> UNUR_ERR_GEN_INVALID [chg - invalid parameters: double percmon[] = {0.1,0.4,0.2}; double percdom[] = {0.1,0.4,2.}; int n_perc = 3; distr = unur_distr_normal(NULL,0); par = unur_ars_new(distr); unur_set_debug(par,0); gen = unur_init( par ); <-- ! NULL ] ~_reinit_percentiles( gen, -1, NULL ); --> none --> UNUR_ERR_PAR_SET ~_reinit_percentiles( gen, n_perc, percmon ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_reinit_percentiles( gen, n_perc, percdom ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_reinit_ncpoints( gen, 0 ); --> expected_setfailed --> UNUR_ERR_PAR_SET ############################################################################# [init] [init - invalid NULL ptr: par = NULL; ] unur_init( par ); --> expected_NULL --> UNUR_ERR_NULL [init - stp out of domain: double stp[] = {-2.5,-1.,0.,1.,2.5}; int n_stp = 5; gen = NULL; distr = unur_distr_normal(NULL,0); unur_distr_cont_set_domain(distr,-2.,2.); par = unur_ars_new(distr); unur_ars_set_cpoints( par, n_stp, stp ); ] gen = unur_init( par ); --> none --> UNUR_ERR_GEN_DATA ############################################################################# [reinit] [reinit - exist: distr = unur_distr_normal(NULL,0); par = unur_ars_new(distr); gen = unur_init( par ); <-- ! NULL ] unur_reinit( gen ); --> expected_reinit ############################################################################# [sample] [sample - invalid NULL ptr: gen = NULL; ] unur_ars_eval_invcdfhat(gen,0.5); --> expected_INFINITY --> UNUR_ERR_NULL #..................................................................... [sample - invalid generator object: distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); gen = unur_init(par); <-- ! NULL ] unur_ars_eval_invcdfhat(gen,0.5); --> expected_INFINITY --> UNUR_ERR_GEN_INVALID #..................................................................... [sample - invalid domain: distr = unur_distr_normal(NULL,0); par = unur_ars_new(distr); gen = unur_init( par ); <-- ! NULL ] unur_ars_eval_invcdfhat(gen,1.5); --> expected_INFINITY --> UNUR_ERR_DOMAIN unur_ars_eval_invcdfhat(gen,-0.5); --> expected_negINFINITY --> UNUR_ERR_DOMAIN #..................................................................... [sample - compare: distr = unur_distr_normal(NULL,0); par = NULL; ] /* default */ par = unur_ars_new(distr); -->compare_sequence_par_start /* verifying mode */ par = unur_ars_new(distr); unur_ars_set_verify(par,1); -->compare_sequence_par /* don't use private copy for distr object */ par = unur_ars_new(distr); unur_set_use_distr_privatecopy(par,FALSE); -->compare_sequence_par /* verifying mode, don't use private copy for distr object */ par = unur_ars_new(distr); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_verify(par,1); -->compare_sequence_par #..................................................................... [sample - compare clone: UNUR_GEN *clone; double fpar[] = {1.23456,2.3456}; distr = unur_distr_normal(fpar,2); par = NULL; gen = NULL; ] /* original generator object */ par = unur_ars_new(distr); unur_ars_set_max_intervals(par,2); gen = unur_init(par); -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen /* dont use private copy for distr object */ /* original generator object */ unur_free(clone); par = unur_ars_new(distr); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_max_intervals(par,2); gen = unur_init(par); -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen #..................................................................... [sample - compare reinit: distr = unur_distr_normal(NULL,0); par = NULL; gen = NULL; ] /* original generator object */ par = unur_ars_new(distr); gen = unur_init(par); -->compare_sequence_gen_start /* reinit */ unur_reinit(gen); -->compare_sequence_gen #..................................................................... [sample - compare stringparser: double fpar[2] = {3.,3.}; distr = NULL; par = NULL; gen = NULL; ] distr = unur_distr_gamma(fpar,2); par = unur_ars_new(distr); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "gamma(3.,3.) & method = ars "); -->compare_sequence_gen unur_free(gen); gen = NULL; distr = unur_distr_gamma(fpar,2); par = unur_ars_new(distr); unur_ars_set_cpoints(par,20,NULL); unur_ars_set_max_intervals(par,32); unur_ars_set_verify(par,TRUE); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "gamma(3.,3.) & \ method = ars; cpoints = 20; \ max_intervals = 32; verify" ); -->compare_sequence_gen ############################################################################# [validate] [validate - generators:] # default (few starting points) par[0] = unur_ars_new(@distr@); # many starting points par[1] = unur_ars_new(@distr@); unur_ars_set_cpoints(par,30,NULL); # few starting points, ARS switchted off par[2] = unur_ars_new(@distr@); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); # no private copy of distr object, many starting points par[3] = unur_ars_new(@distr@); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); # reinitialized with changed parameters par[4] = unur_ars_new(@distr@); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(@distr@,fpm,2); unur_reinit(gen); # reinitialized with changed parameters, use percentiles par[5] = unur_ars_new(@distr@); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(@distr@,fpm,2); unur_ars_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); # reinitialized with changed parameters, use percentiles double perc[] = {0.1,0.3,0.5,0.7,0.9}; par[6] = unur_ars_new(@distr@); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(@distr@,fpm,2); unur_ars_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); [validate - distributions:] # Beta distributions fpm[0] = 1.; fpm[1] = 2.; distr[0] = unur_distr_beta(fpm,2); fpm[0] = 1.; fpm[1] = 5.; distr[1] = unur_distr_beta(fpm,2); fpm[0] = 1.; fpm[1] = 100.; distr[2] = unur_distr_beta(fpm,2); fpm[0] = 2.; fpm[1] = 5.; distr[3] = unur_distr_beta(fpm,2); fpm[0] = 5.; fpm[1] = 2.; distr[4] = unur_distr_beta(fpm,2); fpm[0] = 3.; fpm[1] = 4.; distr[5] = unur_distr_beta(fpm,2); fpm[0] = 5.; fpm[1] = 100.; distr[6] = unur_distr_beta(fpm,2); fpm[0] = 500.; fpm[1] = 300.; distr[7] = unur_distr_beta(fpm,2); fpm[0] = 5.; fpm[1] = 10.; fpm[2] = -3.; fpm[3] = 15.; distr[8] = unur_distr_beta(fpm,4); # Cauchy distributions distr[9] = unur_distr_cauchy(NULL,0); fpm[0] = 1.; fpm[1] = 20.; distr[10] = unur_distr_cauchy(fpm,2); # Exponential distributions distr[11] = unur_distr_exponential(NULL,0); fpm[0] = 30.; fpm[1] = -5.; distr[12] = unur_distr_exponential(fpm,2); # Gamma distributions fpm[0] = 1.; distr[13] = unur_distr_gamma(fpm,1); fpm[0] = 2.; distr[14] = unur_distr_gamma(fpm,1); fpm[0] = 3.; distr[15] = unur_distr_gamma(fpm,1); fpm[0] = 10.; distr[16] = unur_distr_gamma(fpm,1); fpm[0] = 1000.; distr[17] = unur_distr_gamma(fpm,1); fpm[0] = 5.; fpm[1] = 1000.; distr[18] = unur_distr_gamma(fpm,2); fpm[0] = 5.; fpm[1] = 1.e-5; distr[19] = unur_distr_gamma(fpm,2); fpm[0] = 5.; fpm[1] = 10.; fpm[2] = 1000; distr[20] = unur_distr_gamma(fpm,3); # Laplace distributions distr[21] = unur_distr_laplace(NULL,0); fpm[0] = -10.; fpm[1] = 100.; distr[22] = unur_distr_laplace(fpm,2); # Normal distributions distr[23] = unur_distr_normal(NULL,0); fpm[0] = 1.; fpm[1] = 1.e-5; distr[24] = unur_distr_normal(fpm,2); fpm[0] = 0.; fpm[1] = 1.e+5; distr[25] = unur_distr_normal(fpm,2); # Uniform distributions distr[26] = unur_distr_uniform(NULL,0); fpm[0] = 1.; fpm[1] = 20.; distr[27] = unur_distr_uniform(fpm,2); # domain exceeds support of pdf fpm[0] = 3.; fpm[1] = 4.; distr[28] = unur_distr_beta(fpm,2); unur_distr_cont_set_domain(distr[23],-2.,5.); # normal distributions with very bad normalization constant distr[29] = unur_distr_cont_new(); unur_distr_cont_set_logpdf(distr[29],logpdf_normal_1); unur_distr_cont_set_dlogpdf(distr[29],dlogpdf_normal_1); unur_distr_cont_set_cdf(distr[29],cdf_normal_1); unur_distr_set_name(distr[29],"normal_1"); distr[30] = unur_distr_cont_new(); unur_distr_cont_set_logpdf(distr[30],logpdf_normal_2); unur_distr_cont_set_dlogpdf(distr[30],dlogpdf_normal_2); unur_distr_cont_set_cdf(distr[30],cdf_normal_2); unur_distr_set_name(distr[30],"normal_2"); # number of distributions: 31 [validate - test chi2:] # + ... pass test # 0 ... fail to initialize generator # - ... fail test # . ... do not run test # # ... comment # # generators: # [0] default (few starting points) # [1] many starting points # [2] few starting points, ARS switchted off # [3] no private copy of distr object, many starting points # [4] reinitialized with changed parameters # [5] reinitialized with changed parameters, use percentiles # [6] reinitialized with changed parameters, use percentiles # # 0 1 2 3 4 5 6 # distribution #---------------------------------------- x <0> + + + + + + + # beta (1, 2) <1> + + + + + + + # beta (1, 5) x <2> + + + + + + + # beta (1, 100) x <3> + + + + + + + # beta (2, 5) <4> + + + + + + + # beta (5, 2) <5> + + + + + + + # beta (3, 4) x <6> + + + + + + + # beta (5, 100) x <7> + + + + + + + # beta (500, 300) <8> + + + + + + + # beta (5, 10, -3, 15) <9> - - - - . . . # cauchy () x<10> - - - - . . . # cauchy (1, 20) <11> + + + + + + + # exponential () <12> + + + + + + + # exponential (30, -5) x<13> + + + + . . . # gamma (1) <14> + + + + . . . # gamma (2) <15> + + + + . . . # gamma (3) <16> + + + + . . . # gamma (10) x<17> + + . + . . . # gamma (1000) <18> + + . + . . . # gamma (5, 1000, 0) x<19> + + . + . . . # gamma (5, 1e-05, 0) x<20> + + . + . . . # gamma (5, 10, 100000) <21> + + + + + + + # laplace () <22> + + + + + + + # laplace (-10, 100) <23> + + + + + + + # normal () <24> + + . + + + + # normal (1, 1e-05) <25> + + . + + + + # normal (1, 1e+05) <26> + + + + + + + # uniform () x<27> + + + + + + + # uniform (1, 20) <28> + + + + + + + # beta (3,4) - domain superset of support <29> + + + + . . . # normal(0,1) with bad normalization constant x<30> + + . + . . . # normal(100,1) with bad normalization constant [validate - verify hat:] # + ... pass test # ~ ... fail in at most 1% of samples # 0 ... fail to initialize generator # - ... fail test # . ... do not run test # # ... comment # # generators: # [0] default (few starting points) # [1] many starting points # [2] few starting points, ARS switchted off # [3] no private copy of distr object, many starting points # [4] reinitialized with changed parameters # [5] reinitialized with changed parameters, use percentiles # [6] reinitialized with changed parameters, use percentiles # # 0 1 2 3 4 5 6 # distribution #---------------------------------------- x <0> + + + + + + + # beta (1, 2) <1> + + + + + + + # beta (1, 5) x <2> + + + + + + + # beta (1, 100) x <3> + + + + + + + # beta (2, 5) <4> + + + + + + + # beta (5, 2) <5> + + + + + + + # beta (3, 4) x <6> + + + + + + + # beta (5, 100) x <7> + + + + + + + # beta (500, 300) <8> + + + + + + + # beta (5, 10, -3, 15) <9> - - - - . . . # cauchy () x<10> - - . - . . . # cauchy (1, 20) <11> + + + + + + + # exponential () <12> + + + + . . . # exponential (30, -5) x<13> + + + + . . . # gamma (1) <14> + + + + . . . # gamma (2) <15> + + + + . . . # gamma (3) <16> + + + + . . . # gamma (10) x<17> + + . + . . . # gamma (1000) <18> + + . + . . . # gamma (5, 1000, 0) x<19> + + . + . . . # gamma (5, 1e-05, 0) x<20> + + . + . . . # gamma (5, 10, 100000) <21> + + + + + + + # laplace () <22> + + + + + + + # laplace (-10, 100) <23> + + + + + + + # normal () <24> + + . + + + + # normal (1, 1e-05) <25> + + . + + + + # normal (1, 1e+05) <26> + + + + + + + # uniform () x<27> + + + + + + + # uniform (1, 20) <28> + + + + + + + # beta (3,4) - domain superset of support <29> + + + + . . . # normal(0,1) with bad normalization constant x<30> + + . + . . . # normal(100,1) with bad normalization constant ############################################################################# ############################################################################# [verbatim] /* logPDF of normal density */ double logpdf_normal_1( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return (-x*x/2. - 10000.); } double dlogpdf_normal_1( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return (-x); } static UNUR_DISTR *normal_1 = NULL; void remove_normal_1(void) { unur_distr_free(normal_1); } double cdf_normal_1( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { static double fpm[2] = {0., 1.}; if (normal_1 == NULL) { normal_1 = unur_distr_normal(fpm,2); atexit(remove_normal_1); } return unur_distr_cont_eval_cdf( x, normal_1 ); } /* ......................................................................... */ \#define mu_2 (100.) double logpdf_normal_2( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return (-(x-mu_2)*(x-mu_2)/2. - 10000.); } double dlogpdf_normal_2( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return (-(x-mu_2)); } double cdf_normal_2( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { static UNUR_DISTR *normal_2 = NULL; static double fpm[2] = {mu_2, 1.}; if (normal_2 == NULL) normal_2 = unur_distr_normal(fpm,2); return unur_distr_cont_eval_cdf( x, normal_2 ); } ############################################################################## unuran-1.11.0/tests/t_deprecated_vmt.conf0000644001357500135600000005734514420445767015412 00000000000000############################################################################# # # # THIS METHOD AND THE CORRESPONDING ROUTINES SHOULD NOT BE USED ANY MORE! # # # ############################################################################# [main] [main - data:] # method (for information only: the program scans the file name) method: VMT [main - header:] /* prototypes */ \#define COMPARE_SAMPLE_SIZE (10000) \#define VIOLATE_SAMPLE_SIZE (20) /* \#define SEED (298346) */ /* we need marginal distributions for the chi2 tests */ \#define unur_distr_multicauchy unur_distr_multicauchy_w_marginals \#define unur_distr_multinormal unur_distr_multinormal_w_marginals \#define unur_distr_multistudent unur_distr_multistudent_w_marginals ############################################################################# [new] [new - invalid NULL ptr: distr = NULL; ] ~( distr ); --> expected_NULL --> UNUR_ERR_NULL [new - invalid distribution type: distr = unur_distr_discr_new(); ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID [new - data missing in distribution object: double mean[] = {1.,2.}; double covar[] = {2.,1., 1., 2.}; distr = unur_distr_cvec_new(2); ] /* mean */ ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED /* covariance matrix */ unur_distr_cvec_set_mean(distr,mean); unur_distr_cvec_set_covar(distr,covar); ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED ############################################################################# # [set] ############################################################################# # [get] ############################################################################# # [chg] ############################################################################# # [init] ############################################################################# [reinit] [reinit - exists: distr = unur_distr_multinormal(3,NULL,NULL); par = unur_vmt_new(distr); gen = unur_init( par ); <-- ! NULL ] unur_reinit( gen ); --> expected_reinit ############################################################################# [sample] [sample - compare clone: const int dim = 3; double mean[] = {1.,2.,3.}; double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; UNUR_GEN *clone; distr = unur_distr_multinormal( dim, mean, covar ); par = unur_vmt_new(distr); gen = unur_init( par ); <-- ! NULL ] /* normal distribution */ -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen #..................................................................... [sample - compare clone: const int dim = 3; double mean[] = {1.,2.,3.}; double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; double beta_params[] = {3.,5.}; UNUR_GEN *clone; distr = unur_distr_cvec_new(dim); unur_distr_cvec_set_mean(distr,mean); unur_distr_cvec_set_covar(distr,covar); unur_distr_cvec_set_marginal_list(distr, unur_distr_normal(NULL,0), unur_distr_cauchy(NULL,0), unur_distr_beta(beta_params,2) ); unur_distr_cvec_set_stdmarginal_list(distr, unur_distr_normal(NULL,0), unur_distr_cauchy(NULL,0), unur_distr_beta(beta_params,2) ); par = unur_vmt_new(distr); gen = unur_init( par ); <-- ! NULL ] /* multivariate distribution with given marginals */ -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen #..................................................................... [sample - compare clone: double mean[] = {1.,2.,3.}; double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; double beta_params[] = {3.,5.}; UNUR_DISTR *marginals[3]; UNUR_GEN *clone; distr = unur_distr_cvec_new(3); unur_distr_cvec_set_mean(distr,mean); unur_distr_cvec_set_covar(distr,covar); marginals[0] = unur_distr_normal(NULL,0); marginals[1] = unur_distr_cauchy(NULL,0); marginals[2] = unur_distr_beta(beta_params,2); unur_distr_cvec_set_marginal_array(distr,marginals); unur_distr_cvec_set_stdmarginal_array(distr,marginals); unur_distr_free(marginals[0]); unur_distr_free(marginals[1]); unur_distr_free(marginals[2]); par = unur_vmt_new(distr); gen = unur_init( par ); <-- ! NULL ] /* multivariate distribution with given marginals */ -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen #..................................................................... [sample - compare clone 1dim: const int dim = 1; double mean[] = {1.}; double covar[] = {2.}; double beta_params[] = {3.,5.}; UNUR_GEN *clone; distr = unur_distr_cvec_new(dim); unur_distr_cvec_set_mean(distr,mean); unur_distr_cvec_set_covar(distr,covar); unur_distr_cvec_set_marginal_list(distr, unur_distr_beta(beta_params,2) ); unur_distr_cvec_set_stdmarginal_list(distr, unur_distr_beta(beta_params,2) ); par = unur_vmt_new(distr); gen = unur_init( par ); <-- ! NULL ] /* multivariate distribution with given marginals */ -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen #..................................................................... [sample - compare clone 1dim: double mean[] = {1.}; double covar[] = {2.}; double beta_params[] = {3.,5.}; UNUR_DISTR *marginals[1]; UNUR_GEN *clone; distr = unur_distr_cvec_new(1); unur_distr_cvec_set_mean(distr,mean); unur_distr_cvec_set_covar(distr,covar); marginals[0] = unur_distr_beta(beta_params,2); unur_distr_cvec_set_marginal_array(distr,marginals); unur_distr_cvec_set_stdmarginal_array(distr,marginals); unur_distr_free(marginals[0]); par = unur_vmt_new(distr); gen = unur_init( par ); <-- ! NULL ] /* multivariate distribution with given marginals */ -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen #..................................................................... [sample - compare reinit: distr = unur_distr_multinormal(3,NULL,NULL); par = NULL; gen = NULL; ] /* original generator object */ par = unur_vmt_new(distr); gen = unur_init(par); -->compare_sequence_gen_start /* reinit */ unur_reinit(gen); -->compare_sequence_gen #..................................................................... [sample - set domain and compare clone: const int dim = 3; double mean[] = {1.,2.,3.}; double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; double ll[] = {0.,0.,0.}; double ru[] = {UNUR_INFINITY, 1., 2.}; UNUR_GEN *clone; distr = unur_distr_multinormal( dim, mean, covar ); unur_distr_cvec_set_domain_rect( distr, ll, ru ); par = unur_vmt_new(distr); gen = unur_init( par ); <-- ! NULL ] /* normal distribution */ -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen ############################################################################# [validate] [validate - generators:] # default program par[0] = unur_vmt_new(@distr@); # default variant but reinitialized with changed distribution { UNUR_DISTR *dg =NULL; double mean[] = { -1., 2., -3. }; double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; par[1] = unur_vmt_new(@distr@); dg = unur_get_distr(gen); unur_distr_cvec_set_mean(dg,mean); unur_distr_cvec_set_covar(dg,covar); unur_reinit(gen); } [validate - distributions:] # standard multinormal distribution distr[0] = unur_distr_multinormal(3,NULL,NULL); # multinormal distribution, dim = 3 double mean[] = { 1., 2., 3. }; double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; distr[1] = unur_distr_multinormal(3,mean,covar); # standard multinormal distribution with rectangular domain double ll[3] = {0.,0.,0.}; double ru[3] = {UNUR_INFINITY,UNUR_INFINITY,UNUR_INFINITY}; distr[30] = unur_distr_multinormal(3,NULL,NULL); unur_distr_cvec_set_domain_rect(distr[30],ll,ru); # standard multinormal distribution with rectangular domain double ll[3] = {0.,0.,0.}; double ru[3] = {1.,UNUR_INFINITY,UNUR_INFINITY}; distr[31] = unur_distr_multinormal(3,NULL,NULL); unur_distr_cvec_set_domain_rect(distr[31],ll,ru); # standard multinormal distribution with rectangular domain double ll[3] = {-1.,-1.,1.}; double ru[3] = {1.,0.,2.}; distr[32] = unur_distr_multinormal(3,NULL,NULL); unur_distr_cvec_set_domain_rect(distr[32],ll,ru); # random multinormal distribution \#define dim (2) int i; double mean[dim], covar[dim*dim]; UNUR_DISTR *covar_distr; UNUR_GEN *covar_gen; UNUR_GEN *mean_gen; covar_distr = unur_distr_correlation(dim); covar_gen = unur_init(unur_mcorr_new(covar_distr)); mean_gen = unur_str2gen("normal(5,1)"); for (i=0; i + + # standard multinormal (dim=3) <1> + + # multinormal (dim=3) x <2> + . # random multinormal (dim=2) x <3> + + # random multinormal (dim=3) x <4> + . # random multinormal (dim=4) x <5> + . # random multinormal (dim=5) x <6> + . # random multinormal (dim=7) x <7> + . # random multinormal (dim=10) x <8> + . # random multinormal (dim=15) x <9> + . # random multinormal (dim=20) x<10> + . # random multinormal (dim=100) x<26> + . # multinormal with AR(1) corr matrix (rho=0.5, dim=100) x<27> + . # multinormal with AR(1) corr matrix (rho=0.9, dim=100) <28> + . # multinormal with AR(1) corr matrix (rho=0.99, dim=100) x<29> + . # multinormal with AR(1) corr matrix (rho=0.999, dim=100) x<11> + . # random distribution with non-normal marginals (dim=5) <12> + . # standard multinormal (dim=1) x<13> + . # random multinormal (dim=1) <14> 0 . # invalid distribution <15> + + # standard multicauchy (dim=3) <16> + + # multicauchy (dim=3) x<17> + . # random multicauchy (dim=2) x<18> + + # random multicauchy (dim=3) x<19> + . # random multicauchy (dim=4) x<20> + . # random multicauchy (dim=5) x<21> + . # random multicauchy (dim=7) x<22> + . # random multicauchy (dim=10) x<23> + . # random multicauchy (dim=15) x<24> + . # random multicauchy (dim=20) x<25> + . # random multicauchy (dim=100) x<30> + - # standard multinormal (dim=3) with rectangular domain <31> + . # standard multinormal (dim=3) with rectangular domain x<32> + . # standard multinormal (dim=3) with rectangular domain ############################################################################# ############################################################################# [verbatim] ############################################################################# unuran-1.11.0/tests/t_cext.c0000644001357500135600000006146514430713513012646 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for CEXT **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); int unur_cext_set_verify( UNUR_PAR *par, int verify); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ int check_init(UNUR_GEN *gen); double check_sample(UNUR_GEN *gen); double exp1_sample(UNUR_GEN *gen); double expa_sample(UNUR_GEN *gen); int expb_init(UNUR_GEN *gen); double expb_sample(UNUR_GEN *gen); #define COMPARE_SAMPLE_SIZE (500) #define VIOLATE_SAMPLE_SIZE (20) /* #define SEED (298346) */ /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ int check_init(UNUR_GEN *gen ATTRIBUTE__UNUSED) { return UNUR_SUCCESS; } double check_sample(UNUR_GEN *gen ATTRIBUTE__UNUSED) { return 0.; } /* ............. */ double exp1_sample(UNUR_GEN *gen) { double U = unur_sample_urng(gen); return (-log(1. - U)); } /* ............. */ double expa_sample(UNUR_GEN *gen) { # define sigma (params[0]) /* scale */ double U = unur_sample_urng(gen); double X = -log(1. - U); double *params = unur_cext_get_distrparams(gen); if (params) return sigma * X; else return X; # undef sigma } /* ............. */ int expb_init(UNUR_GEN *gen) { # define sigma (params[0]) /* scale */ double *params = unur_cext_get_distrparams(gen); double *genpar = unur_cext_get_params(gen, sizeof(double)); genpar[0] = (params) ? sigma : 1.; return UNUR_SUCCESS; # undef sigma } double expb_sample(UNUR_GEN *gen) { # define sigma (params[0]) /* scale */ double U = unur_sample_urng(gen); double X = -log(1. - U); double *params = unur_cext_get_params(gen,(size_t)0); return sigma * X; # undef sigma } /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid distribution type */ UNUR_DISTR *distr = NULL; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,38,(unur_cext_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,38,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [set] */ void test_set (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[set "); fflush(stdout); fprintf(TESTLOG,"\n[set]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,49,(unur_cext_set_init(par,NULL)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,49,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,52,(unur_cext_set_sample(par,NULL)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,52,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* invalid parameter object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,60,(unur_cext_set_init(par,NULL)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,60,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,63,(unur_cext_set_sample(par,NULL)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,63,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,66,(unur_cext_set_sample(par,check_sample)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,66,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_set() */ /*---------------------------------------------------------------------------*/ /* [get] */ void test_get (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[get "); fflush(stdout); fprintf(TESTLOG,"\n[get]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_GEN *gen = NULL; gen = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,79,(unur_cext_get_params(gen,(size_t)0)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,79,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_get() */ /*---------------------------------------------------------------------------*/ /* [init] */ void test_init (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[init "); fflush(stdout); fprintf(TESTLOG,"\n[init]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,93,(unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,93,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_init() */ /*---------------------------------------------------------------------------*/ /* [reinit] */ void test_reinit (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[reinit "); fflush(stdout); fprintf(TESTLOG,"\n[reinit]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* does not exist */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_exponential(NULL,0); par = unur_cext_new(distr); unur_cext_set_sample(par,exp1_sample); gen = unur_init(par); abort_if_NULL(TESTLOG, 103, gen ); unur_reset_errno(); n_tests_failed += (check_expected_reinit(TESTLOG,107,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_reinit() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* compare clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; UNUR_GEN *clone; distr = unur_distr_exponential(NULL,0); par = NULL; gen = NULL; unur_reset_errno(); /* external generator 1 */ par = unur_cext_new(distr); unur_cext_set_sample(par,exp1_sample); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,124,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,130,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* cstd */ unur_free(gen); par = unur_cstd_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen(TESTLOG,136,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* external generator A */ unur_free(gen); par = unur_cext_new(distr); unur_cext_set_sample(par,expa_sample); gen = unur_init(par); n_tests_failed += (compare_sequence_gen(TESTLOG,144,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,150,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* external generator B */ unur_free(gen); par = unur_cext_new(distr); unur_cext_set_init(par,expb_init); unur_cext_set_sample(par,expb_sample); gen = unur_init(par); n_tests_failed += (compare_sequence_gen(TESTLOG,158,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,164,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; UNUR_GEN *clone; double fpar[1] = { 1. }; distr = unur_distr_exponential(fpar,1); par = NULL; gen = NULL; unur_reset_errno(); /* external generator 1 */ par = unur_cext_new(distr); unur_cext_set_sample(par,exp1_sample); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,179,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,185,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* cstd */ unur_free(gen); par = unur_cstd_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen(TESTLOG,191,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* external generator A */ unur_free(gen); par = unur_cext_new(distr); unur_cext_set_sample(par,expa_sample); gen = unur_init(par); n_tests_failed += (compare_sequence_gen(TESTLOG,198,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,204,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* external generator B */ unur_free(gen); par = unur_cext_new(distr); unur_cext_set_init(par,expb_init); unur_cext_set_sample(par,expb_sample); gen = unur_init(par); n_tests_failed += (compare_sequence_gen(TESTLOG,212,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,218,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; UNUR_GEN *clone; double fpar[1] = { 5. }; distr = unur_distr_exponential(fpar,1); par = NULL; gen = NULL; unur_reset_errno(); /* external generator A */ unur_free(gen); par = unur_cext_new(distr); unur_cext_set_sample(par,expa_sample); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,234,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,240,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* external generator B */ unur_free(gen); par = unur_cext_new(distr); unur_cext_set_init(par,expb_init); unur_cext_set_sample(par,expb_sample); gen = unur_init(par); n_tests_failed += (compare_sequence_gen(TESTLOG,248,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,254,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* cstd */ unur_free(gen); par = unur_cstd_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen(TESTLOG,260,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* [validate] */ /*---------------------------------------------------------------------------*/ /* [validate] */ void test_validate (void) { /* suppress GCC compiler warning */ GCC_DIAG_OFF(unused-variable) UNUR_DISTR *distr[3]; UNUR_PAR *par; UNUR_GEN *gen; double *darray; double fpm[10]; int n_tests_failed; int rcode; /* start test */ printf("[validate "); fflush(stdout); fprintf(TESTLOG,"\n[validate]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* distributions: 3 */ { distr[0] = unur_distr_exponential(NULL,0); } { fpm[0] = 5.; distr[1] = unur_distr_exponential(fpm,1); } { fpm[0] = 1.; distr[2] = unur_distr_exponential(fpm,1); } /* timing */ stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); printf("\n(chi^2) "); fflush(stdout); /* chi^2 tests: 12 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nChi^2 Test:\n"); /* distribution [0] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_cext_new(distr_localcopy); unur_cext_set_sample(par,exp1_sample); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_cext_new(distr_localcopy); unur_cext_set_sample(par,expa_sample); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_cext_new(distr_localcopy); unur_cext_set_init(par,expb_init); unur_cext_set_sample(par,expb_sample); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { UNUR_DISTR *dg =NULL; par = unur_cext_new(distr_localcopy); unur_cext_set_init(par,expb_init); unur_cext_set_sample(par,expb_sample); fpm[0] = 2.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,1); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_cext_new(distr_localcopy); unur_cext_set_sample(par,exp1_sample); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_cext_new(distr_localcopy); unur_cext_set_sample(par,expa_sample); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_cext_new(distr_localcopy); unur_cext_set_init(par,expb_init); unur_cext_set_sample(par,expb_sample); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { UNUR_DISTR *dg =NULL; par = unur_cext_new(distr_localcopy); unur_cext_set_init(par,expb_init); unur_cext_set_sample(par,expb_sample); fpm[0] = 2.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,1); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [2] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_cext_new(distr_localcopy); unur_cext_set_sample(par,exp1_sample); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_cext_new(distr_localcopy); unur_cext_set_sample(par,expa_sample); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_cext_new(distr_localcopy); unur_cext_set_init(par,expb_init); unur_cext_set_sample(par,expb_sample); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); { UNUR_DISTR *dg =NULL; par = unur_cext_new(distr_localcopy); unur_cext_set_init(par,expb_init); unur_cext_set_sample(par,expb_sample); fpm[0] = 2.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,1); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); /* free distributions */ unur_distr_free(distr[0]); unur_distr_free(distr[1]); unur_distr_free(distr[2]); /* test finished */ test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; /* we accept CHI2_FAILURES_TOLERATED failures */ (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_validate */ /* enable GCC compiler warning */ GCC_DIAG_ON(unused-variable) /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_cext_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_srou.c0000644001357500135600000125177114430713513012675 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for SROU **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ double pdf_normal( double x, const UNUR_DISTR *distr ); double pdf_invalid( double x, const UNUR_DISTR *distr ); double pdf_sqrtlin( double x, const UNUR_DISTR *distr ); double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ); double cdf_sqrtlin( double x, const UNUR_DISTR *distr ); double pdf_sqrtlinshft(double x, const UNUR_DISTR *distr ); double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); int unur_srou_set_pedantic( struct unur_par *par, int pedantic ); #define COMPARE_SAMPLE_SIZE (10000) #define VIOLATE_SAMPLE_SIZE (20) /* #define SEED (3984364) */ /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ /* pdf for normal distribution */ double pdf_normal( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return exp(-x*x/2.); } /* end of pdf_normal */ /* pdf that does not work */ double pdf_invalid( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return ((fabs(x)<0.001) ? 0. : exp(-x*x/2.)); } /* end of pdf_invalid */ /* pdf with piecewise linear function as transformed density with T = -1/sqrt */ double pdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y = 1./(fabs(x)+1.); return y*y; } double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y = 1./(fabs(x)+1.); y = 2.*y*y*y; return ((x<0.) ? y : - y); } double cdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { if (x<=0.) return 0.5/(1.-x); else return (1.-0.5/(1.+x)); } /* pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode */ double pdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y; x -= 1000.; y = 1./(fabs(x)+1.); return y*y; } double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y; x -= 1000.; y = 1./(fabs(x)+1.); y = 2.*y*y*y; return ((x<0.) ? y : - y); } double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { x -= 1000.; if (x<=0.) return 0.5/(1.-x); else return (1.-0.5/(1.+x)); } /* dummy function */ int unur_srou_set_pedantic( struct unur_par *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) { return 1; } /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,39,(unur_srou_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,39,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,45,(unur_srou_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,45,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* data missing in distribution object */ UNUR_DISTR *distr = NULL; distr = unur_distr_cont_new(); unur_reset_errno(); /* pdf, mode, pdfarea */ n_tests_failed += (check_expected_NULL(TESTLOG,52,(unur_srou_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,52,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [set] */ void test_set (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[set "); fflush(stdout); fprintf(TESTLOG,"\n[set]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,62,(unur_srou_set_r(par,2.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,62,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,65,(unur_srou_set_cdfatmode(par,0.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,65,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,68,(unur_srou_set_pdfatmode(par,1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,68,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,71,(unur_srou_set_verify(par,1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,71,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,74,(unur_srou_set_usesqueeze(par,1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,74,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,77,(unur_srou_set_usemirror(par,1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,77,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* invalid parameter object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_arou_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,85,(unur_srou_set_r(par,2.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,85,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,88,(unur_srou_set_cdfatmode(par,0.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,88,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,91,(unur_srou_set_pdfatmode(par,1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,91,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,94,(unur_srou_set_verify(par,1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,94,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,97,(unur_srou_set_usesqueeze(par,1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,97,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,100,(unur_srou_set_usemirror(par,1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,100,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_srou_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,110,(unur_srou_set_r(par,0.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,110,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,113,(unur_srou_set_cdfatmode(par,-1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,113,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,116,(unur_srou_set_pdfatmode(par,-1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,116,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_set() */ /*---------------------------------------------------------------------------*/ /* [chg] */ void test_chg (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[chg "); fflush(stdout); fprintf(TESTLOG,"\n[chg]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid generator object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_arou_new(distr); unur_set_debug(par,0); gen = unur_init( par ); abort_if_NULL(TESTLOG, 132, gen ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,136,(unur_srou_chg_verify(gen,1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,136,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,139,(unur_srou_chg_cdfatmode(gen,1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,139,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,142,(unur_srou_chg_pdfatmode(gen,1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,142,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[2] = {2.,5.}; distr = unur_distr_gamma(fpar,2); par = unur_srou_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 148, gen ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,152,(unur_srou_chg_cdfatmode(gen,-1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,152,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,155,(unur_srou_chg_pdfatmode(gen,-1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,155,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_chg() */ /*---------------------------------------------------------------------------*/ /* [init] */ void test_init (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[init "); fflush(stdout); fprintf(TESTLOG,"\n[init]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,166,(unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,166,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* invalid data */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr,pdf_invalid); unur_distr_cont_set_mode(distr,0.); unur_distr_cont_set_pdfarea(distr,1.); par = unur_srou_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,177,(unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,177,UNUR_ERR_GEN_DATA)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid data */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr,pdf_invalid); unur_distr_cont_set_mode(distr,0.); unur_distr_cont_set_pdfarea(distr,1.); par = unur_srou_new(distr); unur_srou_set_r(par,2.); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,188,(unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,188,UNUR_ERR_GEN_DATA)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* data missing in distribution object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = unur_distr_cont_new(); par = NULL; unur_reset_errno(); /* mode, pdfarea */ unur_distr_cont_set_pdf(distr,pdf_normal); par = unur_srou_new( distr ); n_tests_failed += (check_expected_NULL(TESTLOG,198,(unur_init(par)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,198,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* pdfarea */ unur_distr_cont_set_mode(distr,1.); par = unur_srou_new( distr ); n_tests_failed += (check_expected_NULL(TESTLOG,204,(unur_init(par)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,204,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_init() */ /*---------------------------------------------------------------------------*/ /* [reinit] */ void test_reinit (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[reinit "); fflush(stdout); fprintf(TESTLOG,"\n[reinit]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* exist */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_srou_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 212, gen ); unur_reset_errno(); n_tests_failed += (check_expected_reinit(TESTLOG,216,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* exist */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_srou_new(distr); unur_srou_set_r(par,2.); gen = unur_init( par ); abort_if_NULL(TESTLOG, 221, gen ); unur_reset_errno(); n_tests_failed += (check_expected_reinit(TESTLOG,225,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_reinit() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* compare */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double fpar[2] = {1.,2.}; distr = unur_distr_normal(fpar,0); par = NULL; unur_reset_errno(); /* default algorithm */ par = unur_srou_new(distr); n_tests_failed += (compare_sequence_par_start(TESTLOG,238,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* default algorithm - verifying mode */ par = unur_srou_new(distr); unur_srou_set_verify(par,1); n_tests_failed += (compare_sequence_par(TESTLOG,243,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* generalized algorithm, r=2 */ par = unur_srou_new(distr); unur_srou_set_r(par,2.); n_tests_failed += (compare_sequence_par_start(TESTLOG,248,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* generalized algorithm, r=2 - verifying mode */ par = unur_srou_new(distr); unur_srou_set_r(par,2.); unur_srou_set_verify(par,1); n_tests_failed += (compare_sequence_par(TESTLOG,254,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* compare */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = NULL; unur_reset_errno(); /* use cdf at mode */ par = unur_srou_new(distr); unur_srou_set_cdfatmode(par,0.5); n_tests_failed += (compare_sequence_par_start(TESTLOG,266,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* use cdf at mode and squeeze */ par = unur_srou_new(distr); unur_srou_set_cdfatmode(par,0.5); unur_srou_set_usesqueeze(par,1); n_tests_failed += (compare_sequence_par(TESTLOG,272,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* use cdf at mode - verifying mode */ par = unur_srou_new(distr); unur_srou_set_cdfatmode(par,0.5); unur_srou_set_verify(par,1); n_tests_failed += (compare_sequence_par(TESTLOG,278,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* use cdf at mode and squeeze - verifying mode */ par = unur_srou_new(distr); unur_srou_set_cdfatmode(par,0.5); unur_srou_set_usesqueeze(par,1); unur_srou_set_verify(par,1); n_tests_failed += (compare_sequence_par(TESTLOG,285,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* compare */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = NULL; unur_reset_errno(); /* use mirror principle */ par = unur_srou_new(distr); unur_srou_set_usemirror(par,1); n_tests_failed += (compare_sequence_par_start(TESTLOG,297,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* use mirror principle - verifying mode */ par = unur_srou_new(distr); unur_srou_set_usemirror(par,1); unur_srou_set_verify(par,1); n_tests_failed += (compare_sequence_par(TESTLOG,303,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* violate condition */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = NULL; /* pdf at mode is too small: hat < pdf near mode */ unur_reset_errno(); /* default algorithm */ par = unur_srou_new(distr); unur_srou_set_pdfatmode(par,0.1); run_verify_generator (TESTLOG,317,par); n_tests_failed += (check_errorcode(TESTLOG,317,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* use cdf at mode and squeeze */ par = unur_srou_new(distr); unur_srou_set_pdfatmode(par,0.1); unur_srou_set_cdfatmode(par,0.5); unur_srou_set_usesqueeze(par,1); run_verify_generator (TESTLOG,324,par); n_tests_failed += (check_errorcode(TESTLOG,324,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; /* pdf at mode is too large: squeeze > pdf near mode */ unur_reset_errno(); /* use cdf at mode and squeeze */ unur_distr_cont_set_pdfarea(distr,10.); par = unur_srou_new(distr); unur_srou_set_cdfatmode(par,0.5); unur_srou_set_pdfatmode(par,10.); unur_srou_set_usesqueeze(par,1); run_verify_generator (TESTLOG,334,par); n_tests_failed += (check_errorcode(TESTLOG,334,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* compare clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; UNUR_GEN *clone; distr = unur_distr_normal(NULL,0); par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_srou_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,347,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,353,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare reinit */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_srou_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,365,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* reinit */ unur_reinit(gen); n_tests_failed += (compare_sequence_gen(TESTLOG,369,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare reinit */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_srou_new(distr); unur_srou_set_r(par,2.); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,380,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* reinit */ unur_reinit(gen); n_tests_failed += (compare_sequence_gen(TESTLOG,384,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare stringparser */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[2] = {3.,3.}; distr = NULL; par = NULL; gen = NULL; unur_reset_errno(); distr = unur_distr_beta(fpar,2); unur_distr_cont_set_pdfarea(distr,2.); par = unur_srou_new(distr); unur_srou_set_cdfatmode(par,0.5); unur_srou_set_pdfatmode(par,1.9); unur_srou_set_usemirror(par,TRUE); unur_srou_set_usesqueeze(par,FALSE); unur_srou_set_verify(par,TRUE); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,403,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "beta(3.,3.); pdfarea = 2. & \ method = srou; cdfatmode = 0.5; usemirror; usesqueeze = off; pdfatmode = 1.9; verify" ); n_tests_failed += (compare_sequence_gen(TESTLOG,409,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; distr = unur_distr_beta(fpar,2); unur_distr_cont_set_pdfarea(distr,2.); par = unur_srou_new(distr); unur_srou_set_r(par,3.); unur_srou_set_cdfatmode(par,0.5); unur_srou_set_pdfatmode(par,1.9); unur_srou_set_verify(par,TRUE); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,420,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "beta(3.,3.); pdfarea = 2. & \ method = srou; r=3; cdfatmode = 0.5; pdfatmode = 1.9; verify" ); n_tests_failed += (compare_sequence_gen(TESTLOG,426,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* [validate] */ /*---------------------------------------------------------------------------*/ /* [validate] */ void test_validate (void) { /* suppress GCC compiler warning */ GCC_DIAG_OFF(unused-variable) UNUR_DISTR *distr[31]; UNUR_PAR *par; UNUR_GEN *gen; double *darray; double fpm[10]; int n_tests_failed; int rcode; /* start test */ printf("[validate "); fflush(stdout); fprintf(TESTLOG,"\n[validate]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* distributions: 31 */ { fpm[0] = 1.; fpm[1] = 2.; distr[0] = unur_distr_beta(fpm,2); } { fpm[0] = 1.; fpm[1] = 5.; distr[1] = unur_distr_beta(fpm,2); } { fpm[0] = 1.; fpm[1] = 100.; distr[2] = unur_distr_beta(fpm,2); } { fpm[0] = 3.; fpm[1] = 4.; distr[3] = unur_distr_beta(fpm,2); } { fpm[0] = 5.; fpm[1] = 100.; distr[4] = unur_distr_beta(fpm,2); } { fpm[0] = 500.; fpm[1] = 300.; distr[5] = unur_distr_beta(fpm,2); } { fpm[0] = 5.; fpm[1] = 10.; fpm[2] = -3.; fpm[3] = 15.; distr[6] = unur_distr_beta(fpm,4); } { distr[7] = unur_distr_cauchy(NULL,0); } { fpm[0] = 1.; fpm[1] = 20.; distr[8] = unur_distr_cauchy(fpm,2); } { distr[23] = unur_distr_exponential(NULL,0); } { fpm[0] = 30.; fpm[1] = -5.; distr[24] = unur_distr_exponential(fpm,2); } { fpm[0] = 1.; distr[9] = unur_distr_gamma(fpm,1); } { fpm[0] = 2.; distr[10] = unur_distr_gamma(fpm,1); } { fpm[0] = 3.; distr[11] = unur_distr_gamma(fpm,1); } { fpm[0] = 10.; distr[12] = unur_distr_gamma(fpm,1); } { fpm[0] = 1000.; distr[13] = unur_distr_gamma(fpm,1); } { fpm[0] = 1.; fpm[1] = 4.; distr[29] = unur_distr_gamma(fpm,2); } { fpm[0] = 5.; fpm[1] = 1000.; distr[14] = unur_distr_gamma(fpm,2); } { fpm[0] = 5.; fpm[1] = 1.e-5; distr[15] = unur_distr_gamma(fpm,2); } { fpm[0] = 5.; fpm[1] = 10.; fpm[2] = 1000; distr[16] = unur_distr_gamma(fpm,3); } { fpm[0] = 0.5; distr[30] = unur_distr_gamma(fpm,1); } { distr[25] = unur_distr_laplace(NULL,0); } { fpm[0] = -10.; fpm[1] = 100.; distr[26] = unur_distr_laplace(fpm,2); } { distr[17] = unur_distr_normal(NULL,0); } { fpm[0] = 1.; fpm[1] = 1.e-5; distr[18] = unur_distr_normal(fpm,2); } { fpm[0] = 0.; fpm[1] = 1.e+5; distr[19] = unur_distr_normal(fpm,2); } { distr[20] = unur_distr_uniform(NULL,0); } { fpm[0] = 1.; fpm[1] = 20.; distr[21] = unur_distr_uniform(fpm,2); } { distr[27] = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr[27],pdf_sqrtlin); unur_distr_cont_set_dpdf(distr[27],dpdf_sqrtlin); unur_distr_cont_set_cdf(distr[27],cdf_sqrtlin); unur_distr_set_name(distr[27],"sqrtlin"); unur_distr_cont_set_mode(distr[27],0.); unur_distr_cont_set_pdfarea(distr[27],2.); } { distr[28] = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr[28],pdf_sqrtlinshft); unur_distr_cont_set_dpdf(distr[28],dpdf_sqrtlinshft); unur_distr_cont_set_cdf(distr[28],cdf_sqrtlinshft); unur_distr_set_name(distr[28],"sqrtlin"); unur_distr_cont_set_mode(distr[28],1000.); unur_distr_cont_set_pdfarea(distr[28],2.); } { distr[22] = unur_distr_cauchy(NULL,0); unur_distr_cont_set_domain(distr[22],0.1,1.); unur_distr_cont_upd_mode(distr[22]); unur_distr_cont_upd_pdfarea(distr[22]); } /* timing */ stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); printf("\n(chi^2) "); fflush(stdout); /* chi^2 tests: 341 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nChi^2 Test:\n"); /* distribution [0] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_srou_new(distr_localcopy); unur_srou_set_usemirror(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,1.001); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,10.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.95); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_srou_new(distr_localcopy); unur_srou_set_usemirror(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,1.001); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,10.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.95); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [2] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_srou_new(distr_localcopy); unur_srou_set_usemirror(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,1.001); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,10.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [3] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_srou_new(distr_localcopy); unur_srou_set_usemirror(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,1.001); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,10.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.95); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [4] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_srou_new(distr_localcopy); unur_srou_set_usemirror(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,1.001); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,10.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [5] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_srou_new(distr_localcopy); unur_srou_set_usemirror(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,1.001); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,10.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [6] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_srou_new(distr_localcopy); unur_srou_set_usemirror(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,1.001); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,10.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.95); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [23] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_srou_new(distr_localcopy); unur_srou_set_usemirror(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,1.001); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,10.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.95); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [24] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_srou_new(distr_localcopy); unur_srou_set_usemirror(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,1.001); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,10.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.95); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [7] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_srou_new(distr_localcopy); unur_srou_set_usemirror(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,1.001); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,10.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.95); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [8] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_srou_new(distr_localcopy); unur_srou_set_usemirror(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,1.001); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,10.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.95); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [9] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_srou_new(distr_localcopy); unur_srou_set_usemirror(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,1.001); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,10.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.95); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [10] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_srou_new(distr_localcopy); unur_srou_set_usemirror(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,1.001); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,10.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.95); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [11] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_srou_new(distr_localcopy); unur_srou_set_usemirror(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,1.001); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,10.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.95); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [12] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_srou_new(distr_localcopy); unur_srou_set_usemirror(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,1.001); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,10.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.95); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [13] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_srou_new(distr_localcopy); unur_srou_set_usemirror(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,1.001); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,10.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [29] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_srou_new(distr_localcopy); unur_srou_set_usemirror(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,1.001); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,10.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.95); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [14] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_srou_new(distr_localcopy); unur_srou_set_usemirror(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,1.001); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,10.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.95); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [15] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_srou_new(distr_localcopy); unur_srou_set_usemirror(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,1.001); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,10.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [16] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_srou_new(distr_localcopy); unur_srou_set_usemirror(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,1.001); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,10.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.95); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [30] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_srou_new(distr_localcopy); unur_srou_set_usemirror(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,1.001); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,10.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.95); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [25] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_srou_new(distr_localcopy); unur_srou_set_usemirror(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,1.001); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,10.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.95); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [26] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_srou_new(distr_localcopy); unur_srou_set_usemirror(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,1.001); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,10.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.95); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [17] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_srou_new(distr_localcopy); unur_srou_set_usemirror(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,1.001); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,10.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.95); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [18] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_srou_new(distr_localcopy); unur_srou_set_usemirror(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,1.001); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,10.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [19] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_srou_new(distr_localcopy); unur_srou_set_usemirror(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,1.001); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,10.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [20] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_srou_new(distr_localcopy); unur_srou_set_usemirror(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,1.001); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,10.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.95); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [21] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_srou_new(distr_localcopy); unur_srou_set_usemirror(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,1.001); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,10.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.95); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [22] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_srou_new(distr_localcopy); unur_srou_set_usemirror(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,1.001); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,10.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.95); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [27] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_srou_new(distr_localcopy); unur_srou_set_usemirror(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,1.001); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,10.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [28] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_srou_new(distr_localcopy); unur_srou_set_usemirror(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,1.001); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,10.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); printf("\n(verify hat) "); fflush(stdout); /* verify hat tests: 341 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nVerify Hat Test (squeeze <= PDF <= hat):\n"); /* distribution [0] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_usemirror(par,1); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,1.001); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,10.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.95); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_usemirror(par,1); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,1.001); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,10.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.95); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [2] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_usemirror(par,1); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,1.001); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,10.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [3] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_usemirror(par,1); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,1.001); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,10.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.95); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [4] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_usemirror(par,1); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,1.001); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,10.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [5] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_usemirror(par,1); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,1.001); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,10.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [6] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_usemirror(par,1); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,1.001); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,10.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.95); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [23] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_usemirror(par,1); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,1.001); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,10.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.95); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [24] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_usemirror(par,1); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,1.001); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,10.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.95); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [7] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_usemirror(par,1); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,1.001); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,10.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.95); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [8] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_usemirror(par,1); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,1.001); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,10.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.95); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [9] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_usemirror(par,1); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,1.001); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,10.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.95); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [10] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_usemirror(par,1); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,1.001); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,10.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.95); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [11] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_usemirror(par,1); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,1.001); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,10.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.95); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [12] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_usemirror(par,1); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,1.001); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,10.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.95); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [13] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_usemirror(par,1); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,1.001); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,10.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [29] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_usemirror(par,1); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,1.001); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,10.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.95); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [14] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_usemirror(par,1); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,1.001); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,10.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.95); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [15] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_usemirror(par,1); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,1.001); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,10.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [16] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_usemirror(par,1); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,1.001); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,10.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [25] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_usemirror(par,1); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,1.001); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,10.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.95); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [26] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_usemirror(par,1); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,1.001); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,10.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.95); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [17] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_usemirror(par,1); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,1.001); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,10.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.95); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [18] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_usemirror(par,1); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,1.001); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,10.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [19] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_usemirror(par,1); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,1.001); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,10.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [20] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_usemirror(par,1); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,1.001); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,10.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.95); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [21] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_usemirror(par,1); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,1.001); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,10.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [22] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_usemirror(par,1); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,1.001); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,10.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.95); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); {UNUR_DISTR *dg =NULL; par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [27] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_usemirror(par,1); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,1.001); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,10.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [28] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_usemirror(par,1); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,1.001); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,10.); gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_srou_new(distr_localcopy); unur_srou_set_pedantic(par,0); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } gen = unur_init(par); if (gen) unur_srou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); /* free distributions */ unur_distr_free(distr[0]); unur_distr_free(distr[1]); unur_distr_free(distr[2]); unur_distr_free(distr[3]); unur_distr_free(distr[4]); unur_distr_free(distr[5]); unur_distr_free(distr[6]); unur_distr_free(distr[7]); unur_distr_free(distr[8]); unur_distr_free(distr[9]); unur_distr_free(distr[10]); unur_distr_free(distr[11]); unur_distr_free(distr[12]); unur_distr_free(distr[13]); unur_distr_free(distr[14]); unur_distr_free(distr[15]); unur_distr_free(distr[16]); unur_distr_free(distr[17]); unur_distr_free(distr[18]); unur_distr_free(distr[19]); unur_distr_free(distr[20]); unur_distr_free(distr[21]); unur_distr_free(distr[22]); unur_distr_free(distr[23]); unur_distr_free(distr[24]); unur_distr_free(distr[25]); unur_distr_free(distr[26]); unur_distr_free(distr[27]); unur_distr_free(distr[28]); unur_distr_free(distr[29]); unur_distr_free(distr[30]); /* test finished */ test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; /* we accept CHI2_FAILURES_TOLERATED failures */ (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_validate */ /* enable GCC compiler warning */ GCC_DIAG_ON(unused-variable) /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_srou_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/make_test_files.pl0000754001357500135600000010647514420445767014726 00000000000000#!/usr/bin/perl ############################################################################## # # # UNURAN -- Universal Non-Uniform Random number generator # # # ############################################################################## # # # FILE: make_test_files.pl # # # # Read test config file and create C file for tests # # # ############################################################################## # # # Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold # # Department of Statistics and Mathematics, WU Wien, Austria # # # # This program is free software; you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # # the Free Software Foundation; either version 2 of the License, or # # (at your option) any later version. # # # # This program is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with this program; if not, write to the # # Free Software Foundation, Inc., # # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA # # # ############################################################################## use English; use strict; # --------------------------------------------------------------------------- sub usage { my $progname = $0; $progname =~ s#^.*/##g; print STDERR < Scans , generates the C source for test routines, and writes it on stdout. File must have suffix "conf". EOM } # end of usage() # --------------------------------------------------------------------------- # read arguments # src directory my $src_dir = shift or die "No argument given"; usage and die "$src_dir: No such directory" unless -d $src_dir; # --------------------------------------------------------------------------- # Constants # unuran header file my $unuran_h_file = "$src_dir/src/unuran.h"; # program name my $name_program = $0; $name_program =~ s#^.*/##g; # --------------------------------------------------------------------------- # seed for uniform random number generator. my $seed = $ENV{SEED} + 0.; unless ($seed) { $seed = int(rand 1000000) + 1; } # --------------------------------------------------------------------------- # Global variables my %DATA; # store all data in config file # special data we want ... my $method; # generation method (lower case letters) my $METHOD; # (upper case letters) my $gen_type; # type of generation method my $distr_type; # type of distribution my $C_header_aux; # part to be added to C header my @header_files; # additional header file included in *.conf my @othersections = ("new", "set", "get", "chg", "init", "reinit", "sample"); my $test_routines; my $verify_prototype; my $verify_routine; # --------------------------------------------------------------------------- ############################################################################# # # # Main # # # ############################################################################# # --------------------------------------------------------------------------- # read in input file name from argument list ... # it must hve suffix .conf my $file_in = shift; usage and die unless $file_in and $file_in =~ /\.conf$/; # get base name of file my $file_name = $file_in; $file_name =~ s#^.*/##g; $file_name =~ s/\.conf$//; # name of log files my $file_testlog = "$file_name\_test\.log"; my $file_unuranlog = "$file_name\_unuran\.log"; # add unuran header file push @header_files, $unuran_h_file; # read data read_data($file_in); # scan data and print scan_main(); # create verify routine (if necessary) make_unur_set_verify_routine(); # print print_C_header(); scan_verbatim(); foreach my $s (@othersections) { scan_other($s); } scan_validate(); scan_special(); print_C_routines(); print $verify_routine; print_C_main(); # --------------------------------------------------------------------------- # End exit(0); ############################################################################# # # # Read data # # # ############################################################################# sub read_data { my $file = shift; open (CONF, "$file") or die "Cannot open file $file for reading"; my $section = "start"; # lines before first section are stored in section "start" my $subsection = "start"; # lines before first subsection are stored in subsection "start" my $header; # header of subsection my $body; # body of subsection my $ssc = 0; # number of subsection (to store order in input file) while () { # first remove comments next if /^\#/; s/(? # s/\\\#/\#/g; # search for included header files if (/^\s*\#\s*include\s+[\"\<](.*)[\"\>]/) { push @header_files, "$src_dir/$1"; } if (/^\s*\[/) { # new (sub)section starts here # save body of last subsection $DATA{$section}[$ssc]{"title"} = $subsection; $DATA{$section}[$ssc]{"header"} = $header; $DATA{$section}[$ssc]{"body"} = $body; ++$ssc; # increment counter $header = ""; # reset entry of subsection header $body = ""; # reset entry of subsection body if (/^\s*\[\s*(.*?)\s*-\s*(.*?)\s*\:/) { # subsection header if ($1 ne $section) { die "Invalid subsection $_ in section [$section]"; } # update subsection name $subsection = $2; # find header of subsection (search for closing "]") unless (/\]\s*$/) { until ($header =~ /\]\s*$/) { $header .= "$INPUT_LINE_NUMBER:".; } # chop off closing bracket $header =~ s/\]\s*$//; } } elsif (/^\s*\[\s*(.*?)\s*\]/) { # section header if ($DATA{$1}) { die "section already defined"; } # update section name and reset subsection name $section = $1; $subsection = "start"; $ssc = 0; } else { die "Line $INPUT_LINE_NUMBER startet with '[' but is neither section nor subsection"; } } else { # subsection body $body .= ($INPUT_LINE_NUMBER-1).":$_"; } } close CONF; # store last section $DATA{$section}[$ssc]{"title"} = $subsection; $DATA{$section}[$ssc]{"header"} = $header; $DATA{$section}[$ssc]{"body"} = $body; # debug_print_data(); } # end of read_data() # --------------------------------------------------------------------------- sub debug_print_data { foreach my $s (keys %DATA) { print "[$s]\n"; foreach my $subs (@{$DATA{$s}}) { print "[$s \@ ".${$subs}{"title"}."]\n"; print ${$subs}{"header"}."\n"; print ${$subs}{"body"}."\n"; } } } # end of debug_print_data() ############################################################################# # # # Scan section [main] # # # ############################################################################# sub scan_main { $DATA{"main"} or die "section [main] missing"; # scan subsection foreach my $subs (@{$DATA{"main"}}) { my $title = ${$subs}{"title"}; my $body = ${$subs}{"body"}; MAINSUBS: { if ($title eq "start") { # ignore last MAINSUBS; } if ($title eq "data") { # name of method if ("\n$body" =~ /\n\d+\:\s*method\s*:\s*(\w+)/) { $method = $1; $method =~ tr/[A-Z]/[a-z]/; $METHOD = $method; $METHOD =~ tr/[a-z]/[A-Z]/; } last MAINSUBS; } if ($title eq "header") { # additonal part for C header $C_header_aux = $body; $C_header_aux =~ s/(^|\n)\d+\:/\n/g; # remove line info last MAINSUBS; } else { die "Unknown subsection $title for [main]"; } } } # check data $method or die "Data missing"; # mark as read undef $DATA{"main"}; } # end if scan_main() ############################################################################# # # # Scan section [verbatim] # # # ############################################################################# sub scan_verbatim { $DATA{"verbatim"} or return ""; print "/*---------------------------------------------------------------------------*/\n"; print "/* [verbatim] */\n\n"; # There must be only one subsection: [start] # scan subsection foreach my $subs (@{$DATA{"verbatim"}}) { my $title = ${$subs}{"title"}; my $body = ${$subs}{"body"}; if ($title eq "start") { $body =~ s/(^|\n)\d+\:/\n/g; # remove line info print $body; } else { die "No subsections allowed in [verbatim]"; } } # mark as read undef $DATA{"verbatim"}; } # end if scan_verbatim() ############################################################################# # # # Scan section [validate] # # # ############################################################################# sub scan_validate { $DATA{"validate"} or return ""; $test_routines .= "test_validate();\n"; print "/*---------------------------------------------------------------------------*/\n"; print "/* [validate] */\n\n"; my $section = "validate"; my @generators; my @distributions; my $chi2; my $verifyhat; # scan subsection foreach my $subs (@{$DATA{"validate"}}) { my $title = ${$subs}{"title"}; my $body = ${$subs}{"body"}; VALIDATESUBS: { if ($title eq "start") { last VALIDATESUBS; } if ($title eq "generators") { @generators = get_blocks( $section, $body, 0 ); last VALIDATESUBS; } if ($title eq "distributions") { @distributions = get_blocks( $section, $body, 0 ); last VALIDATESUBS; } # remove line info and empty lines $body =~ s/(^|\n)\d+\:/\n/g; $body =~ s/\n\s*\n/\n/g; $body =~ s/^\s*\n//; if ($title eq "test chi2") { $chi2 = $body; last VALIDATESUBS; } if ($title eq "verify hat") { $verifyhat = $body; last VALIDATESUBS; } else { die "Unknown subsection $title for [$section]"; } } } # number of given distributions my $n_distributions = $#distributions + 1; # number of generators my $n_generators = $#generators + 1; print "/*---------------------------------------------------------------------------*/\n\n"; print "/* [$section] */\n\n"; print "void test_validate (void)\n{\n"; print "\t/* suppress GCC compiler warning */\n"; print "GCC_DIAG_OFF(unused-variable)\n\n"; print "\tUNUR_DISTR *distr[".($n_distributions?$n_distributions:1)."];\n"; print "\tUNUR_PAR *par;\n"; print "\tUNUR_GEN *gen;\n"; print "\tdouble *darray;\n"; print "\tdouble fpm[10];\n"; print "\tint n_tests_failed;\n"; print "\tint rcode;\n"; print "\n\t/* start test */\n"; print "\tprintf(\"[validate \"); fflush(stdout);\n"; print "\tfprintf(TESTLOG,\"\\n[validate]\\n\");\n\n"; print "\t/* reset counter */\n\tn_tests_failed = 0;\n\n"; print "\t/* set stop watch */\n"; print "\tstopwatch_lap(&watch);\n\n"; ## list of distributions ## print "\n/* distributions: $n_distributions */\n"; foreach my $d (@distributions) { print "{\n$d}\n\n"; } print "\t/* timing */\n"; print "\tstopwatch_print(TESTLOG,\"\\n<*>setup time = %.3f ms\\n\", stopwatch_lap(&watch));\n\n"; # --- chisquare GoF tests ----- if ($chi2) { # analyse chi^2 tests my @chi2tests = split /\n/, $chi2; unless ($#chi2tests <= $#distributions) { die "wrong number of chi2 tests ($#chi2tests > $#distributions)"; } print "\tprintf(\"\\n(chi^2) \"); fflush(stdout);\n"; print "\n/* chi^2 tests: ".($#generators+1)*$n_distributions." */\n\n"; print "\tunur_set_default_debug(~UNUR_DEBUG_SAMPLE);\n"; print "\tfprintf( TESTLOG,\"\\nChi^2 Test:\\n\");\n\n"; foreach my $test (@chi2tests) { die "invalide test line" unless ($test =~ /^\s*([fFxX]?)\s*<(\d+)>\s*(.+)/); my $fullcheck_dist = $1; my $n_distr = $2; $test = $3; $test =~ s/^\s+//; $test =~ s/\s+$//; my @gentest = split /\s+/, $test; die "invalide number of test indicators" unless ($#gentest == $#generators); print "/* distribution [$n_distr] */\n\n"; foreach (@generators) { # get entry for generator my $genline = $_; # remove [..] from par[..] # (it is just to number generators for convience) $genline =~ s/par\[(\d+)\]/par/g; # insert local copy of distribution object $genline =~ s/\@distr\@/distr_localcopy/g; # read what we have to test my $todo = shift @gentest; # test for an "fullcheckonly" flag my $fullcheck_gen = 0; if ($todo =~ /^[fFxX](.+)/) { $fullcheck_gen = 1; $todo = $1; } # we encapsulate test into "if(TRUE)" or # "if(fullcheck)" statements. if ($fullcheck_dist || $fullcheck_gen) { print "\tif(fullcheck) {\n"; } else { print "\tif(TRUE) {\n"; } # nothing to do if ( $todo eq '.' ) { print "\tprintf(\".\"); fflush(stdout);\n"; print "\t}\n\n"; next; } # split into lines again my @lines = split /\n/, $genline; # print lines print "\tunur_reset_errno();\n"; print "\tdo {\n"; print "\tUNUR_DISTR *distr_localcopy = unur_distr_clone(distr[$n_distr]);\n"; my $have_gen_lines = 0; foreach my $l (@lines) { if ($l =~ /gen/ and !$have_gen_lines) { $have_gen_lines = 1; print "\tgen = unur_init(par);\n\tif (gen) {\n"; } print "$l\n"; # we cannot run the test if par == NULL. # then essential parameters are missing. # if ($l =~ /^\s*par\s*=\s*/) { # print "\tif (par==NULL) { printf(\"X\"); fflush(stdout); break; }\n"; #} } if ($have_gen_lines) { print "\t}\n"; } else { print "\tgen = unur_init(par);\n"; } print "\trcode = run_validate_chi2(TESTLOG,0,gen,distr[$n_distr],'$todo');\n"; print "\tn_tests_failed += (rcode==UNUR_SUCCESS)?0:1;\n"; print "\tn_tests_failed += (rcode==UNUR_FAILURE)?1000:0;\n"; print "\tunur_free(gen);\n"; print "\tunur_distr_free(distr_localcopy);\n"; print "\t} while (0);\n"; # end of if() statement print "\t}\n\n"; } } print "\t/* timing */\n"; print "\tstopwatch_print(TESTLOG,\"\\n<*>time = %.0f ms\\n\", stopwatch_lap(&watch));\n\n"; } ## run in verify mode ## if ($verifyhat) { # analyse verify hat tests my @verifyhattests = split /\n/, $verifyhat; die "wrong number of verify hat tests" unless ($#verifyhattests <= $#distributions); print "\tprintf(\"\\n(verify hat) \"); fflush(stdout);\n"; print "\n/* verify hat tests: ".($#generators+1)*$n_distributions." */\n\n"; print "\tunur_set_default_debug(~UNUR_DEBUG_SAMPLE);\n"; print "\tfprintf( TESTLOG,\"\\nVerify Hat Test (squeeze <= PDF <= hat):\\n\");\n\n"; foreach my $test (@verifyhattests) { die "invalide test line" unless ($test =~ /^\s*([fFxX]?)\s*<(\d+)>\s*(.+)/); my $fullcheck_dist = $1; my $n_distr = $2; $test = $3; $test =~ s/^\s+//; $test =~ s/\s+$//; my @gentest = split /\s+/, $test; die "invalide number of test indicators" unless ($#gentest == $#generators); print "/* distribution [$n_distr] */\n\n"; foreach (@generators) { # get entry for generator my $genline = $_; # remove [..] from par[..] # (it is just to number generators for convience) $genline =~ s/par\[(\d+)\]/par/g; # insert local copy of distribution object $genline =~ s/\@distr\@/distr_localcopy/g; # read what we have to test my $todo = shift @gentest; # replace '+' by '~' $todo =~ s/\+/\~/; # test for an "fullcheckonly" flag my $fullcheck_gen = 0; if ($todo =~ /^[fFxX](.+)/) { $fullcheck_gen = 1; $todo = $1; } # we encapsulate test into "if(TRUE)" or # "if(fullcheck)" statements. if ($fullcheck_dist || $fullcheck_gen) { print "\tif(fullcheck) {\n"; } else { print "\tif(TRUE) {\n"; } # nothing to do if ( $todo eq '.' ) { print "\tprintf(\".\"); fflush(stdout);\n"; print "\t}\n\n"; next; } # split into lines again my @lines = split /\n/, $genline; # print lines print "\tunur_reset_errno();\n"; print "\tdo {\n"; print "\tUNUR_DISTR *distr_localcopy = unur_distr_clone(distr[$n_distr]);\n"; my $have_gen_lines = 0; foreach my $l (@lines) { if ($l =~ /gen/ and !$have_gen_lines) { $have_gen_lines = 1; print "\tgen = unur_init(par);\n\tif (gen) {\n"; } print "$l\n"; if ($l =~ /^\s*par\s*=/) { print "\tunur_$method\_set_pedantic(par,0);\n"; # we cannot run the test if par == NULL. # then essential parameters are missing. # print "\tif (par==NULL) { printf(\"X\"); fflush(stdout); break; }\n"; } } if ($have_gen_lines) { print "\t}\n"; } else { print "\tgen = unur_init(par);\n"; } print "\tif (gen) unur_$method\_chg_verify(gen,1);\n"; # such an error is fatal. so we must make sure that we get a FAIL # and override the sloppy definition of FAIL (CHI2_FAILURES_TOLERATED are allowed for chi^2) print "\tn_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[$n_distr],'$todo')==UNUR_SUCCESS)?0:1000;\n"; print "\tunur_free(gen);\n\n"; print "\tunur_distr_free(distr_localcopy);\n"; print "\t} while (0);\n"; # end of if() statement print "\t}\n\n"; } } print "\t/* timing */\n"; print "\tstopwatch_print(TESTLOG,\"\\n<*>time = %.0f ms\\n\", stopwatch_lap(&watch));\n\n"; } ## free distributions ## print "\n/* free distributions */\n"; for (my $i=0; $i<$n_distributions; ++$i) { print "\tunur_distr_free(distr[$i]);\n"; } ## end ## print "\n\t/* test finished */\n"; print "\ttest_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1;\n"; print "\t/* we accept CHI2_FAILURES_TOLERATED failures */\n"; print "\t(n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(\" ==> failed] \") : printf(\" ==> ok] \");\n"; print "\n} /* end of test_validate */\n\n"; print "/* enable GCC compiler warning */\n"; print "GCC_DIAG_ON(unused-variable)\n\n"; # mark as read undef $DATA{"validate"}; } # end if scan_validate() ############################################################################# # # # Scan section [special] # # # ############################################################################# sub scan_special { my $section = "special"; $DATA{"$section"} or return ""; $test_routines .= "test_$section();\n"; print <time = %.3f ms\\n\\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (FAILED) ? 0 : 1; (FAILED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_$section() */ EOM # mark as read undef $DATA{$section}; } # end if scan_special() ############################################################################# # # # Scan all other sections # # # ############################################################################# sub scan_other { my $section = shift; $DATA{$section} or return ""; $test_routines .= "test_$section();\n"; print </, $block; # is there any test ? unless ($test_command) { print $code if defined $code; next; } # split code into lines again ... my @blines = split /\n/, $code; # get last C command ... undef my $last_C_line; while ( $last_C_line = pop @blines ) { last if $last_C_line =~ /\w+/; last if !defined $last_C_line; } $last_C_line =~ s/;\s*$// if defined $last_C_line; # print ... print "\nunur_reset_errno();\n"; # C lines ... foreach my $bl (@blines) { print "$bl\n"; } # test ... print_test_command( $test_command, $last_C_line, $lineno ); # error code ... $errno =~ s/[\s\n]+//g if defined $errno; print "n_tests_failed += (check_errorcode(TESTLOG,$lineno,$errno)==UNUR_SUCCESS)?0:1\;\n" if $errno; } # close subsection ... print "$subsection_closing}\n\n"; } # print section closing ... print <time = %.3f ms\\n\\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_$section() */ EOM # mark as read undef $DATA{$section}; } # end if scan_other() ############################################################################# # # # break into blocks (separated by blank lines) # # # ############################################################################# sub get_blocks { my $section = shift; my $body = shift; my $withlineno = shift; my @blocks; my $block; my @lines = split /\n/, $body; foreach my $line (@lines) { $line .= "\n"; $line =~ s/^(\d+)\://; my $lineno = $1 or die "internal error"; # convert line starting with ~ ... $line =~ s/~/unur_$method\_$section/ if $line =~ /^~/; if ($line =~ /\w+/) { # append line to block $block .= $line; } else { # empty line --> block completed # (we ignore lines without letters) $lineno = $withlineno ? "$lineno:" : ""; push @blocks, "$lineno$block" if $block =~ /\w+/; # goto next block $block = ""; } } return @blocks; } # end of get_blocks() ############################################################################# # # # print test command # # # ############################################################################# sub print_test_command { my $test_command = $_[0]; my $last_C_line = $_[1]; my $lineno = $_[2]; SWITCH: { if ($test_command =~ /^\s*none\s*/ ) { $test_command =~ s/\s+//g; print "$last_C_line\;\n"; last SWITCH; } if ($test_command =~ /^\s*expected_NULL\s*/ or $test_command =~ /^\s*expected_setfailed\s*/ or $test_command =~ /^\s*expected_zero\s*/ or $test_command =~ /^\s*expected_INFINITY\s*/ or $test_command =~ /^\s*expected_negINFINITY\s*/ or $test_command =~ /^\s*expected_INTMAX\s*/ or $test_command =~ /^\s*expected_reinit\s*/) { $test_command =~ s/\s+//g; print "n_tests_failed += (check_$test_command\(TESTLOG,$lineno,($last_C_line))==UNUR_SUCCESS)?0:1\;\n"; last SWITCH; } if ($test_command =~ /^\s*compare_sequence_gen\s*$/ or $test_command =~ /^\s*compare_sequence_gen_start\s*$/ ) { $test_command =~ s/\s+//g; print "$last_C_line\;\n"; print "n_tests_failed += ($test_command\(TESTLOG,$lineno,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1;\n"; last SWITCH; } if ($test_command =~ /^\s*compare_sequence_par\s*$/ or $test_command =~ /^\s*compare_sequence_par_start\s*$/ ) { $test_command =~ s/\s+//g; print "$last_C_line\;\n"; print "n_tests_failed += ($test_command\(TESTLOG,$lineno,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1;\n"; last SWITCH; } if ($test_command =~ /^\s*compare_sequence_urng_start\s*$/ ) { $test_command =~ s/\s+//g; print "$last_C_line\;\n"; print "$test_command\(TESTLOG,$lineno,COMPARE_SAMPLE_SIZE);\n"; last SWITCH; } if ($test_command =~ /^\s*run_verify_generator\s*$/) { print "$last_C_line\;\n"; print "$test_command(TESTLOG,$lineno,par);\n"; last SWITCH; } # otherwise die "Unknown test command: \"$test_command\""; } } # end print_test_command() ############################################################################# # # # print C header, main, and auxiliary routines # # # ############################################################################# sub print_C_header { print "/*\n\tfile automatically generated by $name_program\n\t"; print scalar localtime; print "\n*/\n\n"; print < #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); $verify_prototype /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ $C_header_aux /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif EOM } # end of print_C_header() ############################################################################# sub print_C_main { print <total time = %.0f ms\\n\\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ EOM } # end of print_C_main() ############################################################################# sub print_C_routines { print <) { $have_found = 1 if /$verify/; } close (H); } unless ($have_found) { $verify_routine = "int $verify(UNUR_PAR *par ATTRIBUTE__UNUSED, int verify ATTRIBUTE__UNUSED) {return 0;}\n"; $verify_prototype = "int unur_$method\_set_verify( UNUR_PAR *par, int verify);\n"; } else { $verify_routine = ""; $verify_prototype = ""; } } ############################################################################# unuran-1.11.0/tests/t_hist.conf0000644001357500135600000002043214420445767013356 00000000000000############################################################################# [main] [main - data:] # method (for information only: the program scans the file name) method: HIST [main - header:] /* prototypes */ \#define COMPARE_SAMPLE_SIZE (10000) \#define VIOLATE_SAMPLE_SIZE (20) UNUR_DISTR *get_distr_with_data( void ); UNUR_DISTR *get_distr_with_data2( void ); ############################################################################# [new] [new - invalid NULL ptr: distr = NULL; ] ~( distr ); --> expected_NULL --> UNUR_ERR_NULL [new - invalid distribution type: distr = unur_distr_cont_new(); ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID [new - data missing in distribution object: distr = unur_distr_cemp_new(); /* no data given */ ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED [new - data missing in distribution object: double hist[] = {0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1}; distr = unur_distr_cemp_new(); unur_distr_cemp_set_hist_prob(distr,hist,9); ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED ############################################################################# # [set] ############################################################################# # [get] ############################################################################# # [chg] ############################################################################# [init] [init - run init: distr = get_distr_with_data(); par = unur_hist_new(distr); gen = unur_init( par ); <-- ! NULL ] # this should be o.k. --> none --> 0x0u ############################################################################# [reinit] #[reinit - does not exist: # distr = get_distr_with_data(); # par = unur_hist_new(distr); # gen = unur_init( par ); <-- ! NULL ] # #unur_reinit( gen ); # --> expected_setfailed --> UNUR_ERR_NO_REINIT # #unur_sample_cont( gen ); # --> expected_INFINITY --> UNUR_ERR_GEN_CONDITION # ############################################################################# [sample] [sample - compare variants: UNUR_DISTR *distr1 = get_distr_with_data(); UNUR_DISTR *distr2 = get_distr_with_data2(); par = unur_hist_new(distr1); gen = unur_init( par ); <-- ! NULL ] /* default generator object */ -->compare_sequence_gen_start /* variant */ unur_free(gen); par = unur_hist_new(distr2); gen = unur_init(par); -->compare_sequence_gen unur_distr_free(distr1); unur_distr_free(distr2); # ........................................................................... [sample - compare variant: double hist[] = {0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1}; double bins[] = {1.,2.,3.,4.,5.,6.,7.,8.,9.,10.}; distr = unur_distr_cemp_new(); unur_distr_cemp_set_hist_prob(distr,hist,9); unur_distr_cemp_set_hist_domain(distr,1.,10.); par = unur_hist_new(distr); gen = unur_init( par ); <-- ! NULL ] /* default generator object */ -->compare_sequence_gen_start /* variant */ unur_free(gen); unur_distr_free(distr); distr = unur_distr_cemp_new(); unur_distr_cemp_set_hist_prob(distr,hist,9); unur_distr_cemp_set_hist_bins(distr,bins,10); unur_distr_cemp_set_hist_domain(distr,1.,100.); par = unur_hist_new(distr); gen = unur_init(par); -->compare_sequence_gen # ........................................................................... [sample - compare clone: UNUR_GEN *clone; double hist[] = {0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1}; double bins[] = {1.,2.,3.,4.,5.,6.,7.,8.,9.,10.}; distr = unur_distr_cemp_new(); unur_distr_cemp_set_hist_prob(distr,hist,9); unur_distr_cemp_set_hist_bins(distr,bins,10); par = unur_hist_new(distr); gen = unur_init( par ); <-- ! NULL ] /* default generator object */ -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen # ........................................................................... [sample - compare clone: UNUR_GEN *clone; distr = get_distr_with_data(); par = unur_hist_new(distr); gen = unur_init( par ); <-- ! NULL ] /* default generator object */ -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen # ........................................................................... [sample - compare stringparser: double hist[] = {0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1}; distr = unur_distr_cemp_new(); unur_distr_cemp_set_hist_prob(distr,hist,9); unur_distr_cemp_set_hist_domain(distr,1.,10.); par = unur_hist_new(distr); gen = unur_init( par ); <-- ! NULL ] /* default generator object */ -->compare_sequence_gen_start /* string API */ unur_free(gen); gen = unur_str2gen("cemp; hist_prob=(0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1); \ hist_domain=(1.,10.) & method = hist"); -->compare_sequence_gen /* string API */ unur_free(gen); gen = unur_str2gen("cemp; hist_prob=(0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1); \ hist_bins=(1.,2.,3.,4.,5.,6.,7.,8.,9.,10.) & method = hist"); -->compare_sequence_gen ############################################################################# [validate] [validate - generators:] # default par[0] = unur_hist_new(@distr@); [validate - distributions:] # approximate normal distribution, bins with equal width { double pv[1000]; UNUR_DISTR *normal_dist; int i; double xmin, xmax; double fxmin, fxmax; /* xmin = -5.; */ fxmin = 0.; normal_dist = unur_distr_normal(NULL,0); for (i=0; i<1000; i++) { xmax = -5. + i/100.; fxmax = unur_distr_cont_eval_cdf(xmax,normal_dist); pv[i] = fxmax - fxmin; /* xmin = xmax; */ fxmin = fxmax; } unur_distr_free(normal_dist); distr[0] = unur_distr_cemp_new(); unur_distr_cemp_set_hist(distr[0],pv,1000,-5.,5.); } # approximate normal distribution, bins with different widths { double pv[1000]; double bins[1001]; UNUR_DISTR *normal_dist; int i; double xmin, xmax; double fxmin, fxmax; normal_dist = unur_distr_normal(NULL,0); bins[500] = 0.; for (i=501; i<=1000; i++) bins[i] = bins[i-1] + (i-500)/25000.; for (i=499; i>=0; i--) bins[i] = bins[i+1] + (i-500)/25000.; xmin = bins[0]; fxmin = unur_distr_cont_eval_cdf(xmin,normal_dist); pv[0] = unur_distr_cont_eval_cdf(bins[0],normal_dist); for (i=0; i<1000; i++) { xmax = bins[i+1]; fxmax = unur_distr_cont_eval_cdf(xmax,normal_dist); pv[i] = fxmax - fxmin; xmin = xmax; fxmin = fxmax; } unur_distr_free(normal_dist); distr[1] = unur_distr_cemp_new(); unur_distr_cemp_set_hist_prob(distr[1],pv,1000); unur_distr_cemp_set_hist_bins(distr[1],bins,1001); } [validate - test chi2:] # + ... pass test # 0 ... fail to initialize generator # - ... fail test # . ... do not run test # # ... comment # # generators: # [0] default # # [0] # distribution #---------------------------------------------------------------- <0> + # approximate normal distribution, bins with equal width <1> + # approximate normal distribution, bins with different widths ############################################################################# ############################################################################# [verbatim] /*---------------------------------------------------------------------------*/ UNUR_DISTR *get_distr_with_data( void ) { \#define HIST_SIZE 20 double hist[HIST_SIZE]; UNUR_DISTR *distr; int i; unur_urng_fish_reset(NULL); for (i=0; i #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); int unur_ninv_set_verify( UNUR_PAR *par, int verify); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ #include /* -- which tests for u-error should be performed (for development) -- */ #define DEVEL (0) /* whether to run tests in development mode */ #define ALL (1) #define UERROR_STANDARDDIST (1) #define UERROR_QUASIPDF DEVEL #define UERROR_VANISHINGPDF DEVEL #define UERROR_TRUNCATED (1) #define UERROR_UNBOUNDEDPDF (0) #define UERROR_MULTIMODAL DEVEL #define UERROR_MULTIMODAL_VANISHINGPDF DEVEL /* variants */ static int UERROR_REGULA = TRUE; static int UERROR_NEWTON = TRUE; /* constants */ #define UERROR_SAMPLESIZE (10000) #define COMPARE_SAMPLE_SIZE (500) #define VIOLATE_SAMPLE_SIZE (20) /* Chi-square goodness-of-fit tests some times fail once due to numerical */ /* errors. So we accept more such failure than for other methods. */ #define CHI2_FAILURES_TOLERATED (5) /* prototypes */ #define set_debug_flag(par) \ do { \ if (fullcheck) unur_set_debug((par),~0u); \ else unur_set_debug((par),1u); \ } while (0); int ninv_error_experiment( UNUR_PAR *par, int samplesize ); int chg_domain_experiment( UNUR_PAR *par, int samplesize ); int ninv_error_gen_experiment( UNUR_GEN *gen, double u_resolution, const char *method, int samplesize ); /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ /*****************************************************************************/ /* run unur_test_u_error for a particular generator object and print result */ int ninv_error_gen_experiment( UNUR_GEN *gen, /* generator object */ double u_resolution, /* maximal tolerated u-error */ const char *method, /* chosen method */ int samplesize ) /* sample size for error experiment */ /* returns 0 if maxerror < u_resolution, errorcode otherwise */ { int i, nfpar; const double *fpar; const UNUR_DISTR *distr = unur_get_distr(gen); const char *genid = unur_get_genid(gen); double score; /* print data about distribution */ fprintf(TESTLOG,"%s: %s distribution",genid,unur_distr_get_name(distr)); nfpar = unur_distr_cont_get_pdfparams(distr,&fpar); if (nfpar) { fprintf(TESTLOG," with parameters "); for(i=0;i use regula falsi */ /* variant==1 --> use Newton */ /* variant==2 --> use bisection */ switch (variant) { case 0: /* run regula */ method = "regula"; if (UERROR_REGULA) printf(""); else continue; break; case 1: /* run Newton */ method = "newton"; if (UERROR_NEWTON) printf(""); else continue; break; case 2: /* run bisection method */ method = "bisect"; if (UERROR_NEWTON) printf(""); else continue; break; default: continue; } for ( u_resolution = 1.e-6; u_resolution > 1.e-10; u_resolution *= 0.01 ) { /* make a working copy */ par_clone = _unur_par_clone(par); /* set variant */ switch (variant) { case 0: unur_ninv_set_useregula(par_clone); break; case 1: unur_ninv_set_usenewton(par_clone); break; case 2: unur_ninv_set_usebisect(par_clone); break; } /* create generator object */ unur_ninv_set_x_resolution(par_clone,-1.); unur_ninv_set_u_resolution(par_clone,u_resolution); set_debug_flag(par_clone); gen = unur_init(par_clone); /* run test */ errorsum += ninv_error_gen_experiment(gen, u_resolution, method, samplesize); fprintf(TESTLOG,"\n"); /* clear memory */ unur_free(gen); } } unur_par_free(par); return errorsum; } /* end of ninv_error_experiment() */ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,68,(unur_ninv_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,68,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,74,(unur_ninv_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,74,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* data missing in distribution object */ UNUR_DISTR *distr = NULL; distr = unur_distr_cont_new(); unur_reset_errno(); /* cdf */ n_tests_failed += (check_expected_NULL(TESTLOG,81,(unur_ninv_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,81,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [set] */ void test_set (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[set "); fflush(stdout); fprintf(TESTLOG,"\n[set]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,91,(unur_ninv_set_usenewton( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,91,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,94,(unur_ninv_set_useregula( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,94,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,97,(unur_ninv_set_max_iter( par, 40 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,97,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,100,(unur_ninv_set_x_resolution( par, 0.001 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,100,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,103,(unur_ninv_set_u_resolution( par, 0.001 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,103,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,106,(unur_ninv_set_start( par, 0., 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,106,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,109,(unur_ninv_set_table( par, 100 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,109,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* invalid parameter object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_arou_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,118,(unur_ninv_set_usenewton( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,118,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,121,(unur_ninv_set_useregula( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,121,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,124,(unur_ninv_set_max_iter( par, 40 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,124,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,127,(unur_ninv_set_x_resolution( par, 0.001 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,127,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,130,(unur_ninv_set_u_resolution( par, 0.001 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,130,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,133,(unur_ninv_set_start( par, 0., 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,133,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,136,(unur_ninv_set_table( par, 100 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,136,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_ninv_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,147,(unur_ninv_set_max_iter( par, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,147,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_ninv_set_x_resolution( par, 1e-30 ); n_tests_failed += (check_errorcode(TESTLOG,150,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_ninv_set_u_resolution( par, 1e-30 ); n_tests_failed += (check_errorcode(TESTLOG,153,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_set() */ /*---------------------------------------------------------------------------*/ /* [chg] */ void test_chg (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[chg "); fflush(stdout); fprintf(TESTLOG,"\n[chg]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid generator object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); unur_distr_cont_set_domain(distr,-1.,2.); par = unur_tdr_new(distr); unur_set_debug(par,0); gen = unur_init( par ); abort_if_NULL(TESTLOG, 171, gen ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,175,(unur_ninv_chg_max_iter( gen, 100 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,175,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,178,(unur_ninv_chg_x_resolution( gen, 1.e-10)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,178,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,181,(unur_ninv_chg_u_resolution( gen, 1.e-10)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,181,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,184,(unur_ninv_chg_truncated( gen, 0., 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,184,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); unur_distr_cont_set_domain(distr,-1.,2.); par = unur_ninv_new(distr); unur_set_debug(par,0); gen = unur_init( par ); abort_if_NULL(TESTLOG, 192, gen ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,197,(unur_ninv_chg_max_iter( gen, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,197,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_ninv_chg_x_resolution( gen, 1.e-30); n_tests_failed += (check_errorcode(TESTLOG,200,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_ninv_chg_u_resolution( gen, 1.e-30); n_tests_failed += (check_errorcode(TESTLOG,203,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,206,(unur_ninv_chg_truncated( gen, 1., 0. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,206,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_ninv_chg_truncated( gen, -2., 0. ); n_tests_failed += (check_errorcode(TESTLOG,209,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_ninv_chg_truncated( gen, 0., 10. ); n_tests_failed += (check_errorcode(TESTLOG,212,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_chg() */ /*---------------------------------------------------------------------------*/ /* [init] */ void test_init (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[init "); fflush(stdout); fprintf(TESTLOG,"\n[init]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,223,(unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,223,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_init() */ /*---------------------------------------------------------------------------*/ /* [reinit] */ void test_reinit (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[reinit "); fflush(stdout); fprintf(TESTLOG,"\n[reinit]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* does not exist */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_ninv_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 231, gen ); unur_reset_errno(); n_tests_failed += (check_expected_reinit(TESTLOG,235,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_reinit() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_GEN *gen = NULL; gen = NULL; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,245,(unur_ninv_eval_approxinvcdf(gen,0.5)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,245,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_free(gen); } { /* invalid generator object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_hinv_new(distr); gen = unur_init(par); abort_if_NULL(TESTLOG, 249, gen ); unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,253,(unur_ninv_eval_approxinvcdf(gen,0.5)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,253,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* invalid domain */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_ninv_new(distr); unur_set_debug(par,0); gen = unur_init( par ); abort_if_NULL(TESTLOG, 258, gen ); unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,262,(unur_ninv_eval_approxinvcdf(gen,1.5)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,262,UNUR_ERR_DOMAIN)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_negINFINITY(TESTLOG,265,(unur_ninv_eval_approxinvcdf(gen,-0.5)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,265,UNUR_ERR_DOMAIN)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; UNUR_GEN *clone; distr = unur_distr_normal(NULL,0); par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_ninv_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,278,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,284,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare reinit */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_ninv_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,296,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* reinit */ unur_reinit(gen); n_tests_failed += (compare_sequence_gen(TESTLOG,300,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare stringparser */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[] = {3.,4.}; distr = NULL; par = NULL; gen = NULL; unur_reset_errno(); distr = unur_distr_gamma(fpar,2); unur_distr_cont_set_domain(distr,2.,UNUR_INFINITY); par = unur_ninv_new(distr); unur_ninv_set_max_iter(par,10); unur_ninv_set_start(par,4.,10.); unur_ninv_set_table(par,100); unur_ninv_set_usenewton(par); unur_ninv_set_x_resolution(par,1.E-6); unur_set_debug(par,1u); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,321,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "gamma(3.,4.); domain = 2,infinity & \ method = ninv; max_iter = 10; start = 4., 10.; table = 100; \ usenewton; x_resolution = 1.E-6; debug = 0x1" ); n_tests_failed += (compare_sequence_gen(TESTLOG,328,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; distr = unur_distr_gamma(fpar,2); unur_distr_cont_set_domain(distr,2.,UNUR_INFINITY); par = unur_ninv_new(distr); unur_ninv_set_useregula(par); unur_set_debug(par,1u); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,337,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "gamma(3.,4.); domain = (2,inf) & method = ninv; useregula; debug = 0x1" ); n_tests_failed += (compare_sequence_gen(TESTLOG,342,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* [validate] */ /*---------------------------------------------------------------------------*/ /* [validate] */ void test_validate (void) { /* suppress GCC compiler warning */ GCC_DIAG_OFF(unused-variable) UNUR_DISTR *distr[33]; UNUR_PAR *par; UNUR_GEN *gen; double *darray; double fpm[10]; int n_tests_failed; int rcode; /* start test */ printf("[validate "); fflush(stdout); fprintf(TESTLOG,"\n[validate]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* distributions: 33 */ { fpm[0] = 1.; fpm[1] = 2.; distr[0] = unur_distr_beta(fpm,2); } { fpm[0] = 1.; fpm[1] = 5.; distr[1] = unur_distr_beta(fpm,2); } { fpm[0] = 1.; fpm[1] = 100.; distr[2] = unur_distr_beta(fpm,2); } { fpm[0] = 3.; fpm[1] = 4.; distr[3] = unur_distr_beta(fpm,2); } { fpm[0] = 5.; fpm[1] = 100.; distr[4] = unur_distr_beta(fpm,2); } { fpm[0] = 500.; fpm[1] = 300.; distr[5] = unur_distr_beta(fpm,2); } { fpm[0] = 5.; fpm[1] = 10.; fpm[2] = -3.; fpm[3] = 15.; distr[6] = unur_distr_beta(fpm,4); } { fpm[0] = 0.5; fpm[1] = 3.; distr[28] = unur_distr_beta(fpm,2); } { fpm[0] = 5.; fpm[1] = 0.3; distr[29] = unur_distr_beta(fpm,2); } { fpm[0] = 0.5; fpm[1] = 0.4; distr[30] = unur_distr_beta(fpm,2); } { distr[7] = unur_distr_cauchy(NULL,0); } { fpm[0] = 1.; fpm[1] = 20.; distr[8] = unur_distr_cauchy(fpm,2); } { distr[24] = unur_distr_exponential(NULL,0); } { fpm[0] = 30.; fpm[1] = -5.; distr[25] = unur_distr_exponential(fpm,2); } { fpm[0] = 1.; distr[9] = unur_distr_gamma(fpm,1); } { fpm[0] = 2.; distr[10] = unur_distr_gamma(fpm,1); } { fpm[0] = 3.; distr[11] = unur_distr_gamma(fpm,1); } { fpm[0] = 10.; distr[12] = unur_distr_gamma(fpm,1); } { fpm[0] = 1000.; distr[13] = unur_distr_gamma(fpm,1); } { fpm[0] = 5.; fpm[1] = 1000.; distr[14] = unur_distr_gamma(fpm,2); } { fpm[0] = 5.; fpm[1] = 1.e-5; distr[15] = unur_distr_gamma(fpm,2); } { fpm[0] = 5.; fpm[1] = 10.; fpm[2] = 1000; distr[16] = unur_distr_gamma(fpm,3); } { fpm[0] = 0.5; distr[31] = unur_distr_gamma(fpm,1); } { fpm[0] = 0.2; distr[32] = unur_distr_gamma(fpm,1); } { distr[26] = unur_distr_laplace(NULL,0); } { fpm[0] = -10.; fpm[1] = 100.; distr[27] = unur_distr_laplace(fpm,2); } { distr[17] = unur_distr_normal(NULL,0); } { fpm[0] = 1.; fpm[1] = 1.e-5; distr[18] = unur_distr_normal(fpm,2); } { fpm[0] = 0.; fpm[1] = 1.e+5; distr[19] = unur_distr_normal(fpm,2); } { distr[20] = unur_distr_uniform(NULL,0); } { fpm[0] = 1.; fpm[1] = 20.; distr[21] = unur_distr_uniform(fpm,2); } { distr[22] = unur_distr_cauchy(NULL,0); unur_distr_cont_set_domain(distr[22],0.1,1.); unur_distr_cont_upd_mode(distr[22]); unur_distr_cont_upd_pdfarea(distr[22]); } { fpm[0] = 3.; fpm[1] = 4.; distr[23] = unur_distr_beta(fpm,2); unur_distr_cont_set_domain(distr[23],-2.,5.); } /* timing */ stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); printf("\n(chi^2) "); fflush(stdout); /* chi^2 tests: 660 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nChi^2 Test:\n"); /* distribution [0] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [2] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [3] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [4] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [5] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [6] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [28] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [29] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [30] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [7] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [8] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [24] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [25] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [9] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [10] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [11] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [12] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [13] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [14] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [15] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [16] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [31] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [32] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [26] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [27] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [17] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [18] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [19] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [20] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [21] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [22] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [23] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_start(par, 0.1, 0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); gen = unur_init(par); if (gen) { unur_ninv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); { UNUR_DISTR *dg =NULL; par = unur_ninv_new(distr_localcopy); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); /* free distributions */ unur_distr_free(distr[0]); unur_distr_free(distr[1]); unur_distr_free(distr[2]); unur_distr_free(distr[3]); unur_distr_free(distr[4]); unur_distr_free(distr[5]); unur_distr_free(distr[6]); unur_distr_free(distr[7]); unur_distr_free(distr[8]); unur_distr_free(distr[9]); unur_distr_free(distr[10]); unur_distr_free(distr[11]); unur_distr_free(distr[12]); unur_distr_free(distr[13]); unur_distr_free(distr[14]); unur_distr_free(distr[15]); unur_distr_free(distr[16]); unur_distr_free(distr[17]); unur_distr_free(distr[18]); unur_distr_free(distr[19]); unur_distr_free(distr[20]); unur_distr_free(distr[21]); unur_distr_free(distr[22]); unur_distr_free(distr[23]); unur_distr_free(distr[24]); unur_distr_free(distr[25]); unur_distr_free(distr[26]); unur_distr_free(distr[27]); unur_distr_free(distr[28]); unur_distr_free(distr[29]); unur_distr_free(distr[30]); unur_distr_free(distr[31]); unur_distr_free(distr[32]); /* test finished */ test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; /* we accept CHI2_FAILURES_TOLERATED failures */ (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_validate */ /* enable GCC compiler warning */ GCC_DIAG_ON(unused-variable) /*---------------------------------------------------------------------------*/ /* [special] */ void test_special (void) { /* set boolean to FALSE */ int FAILED = 0; int samplesize = UERROR_SAMPLESIZE; int errorsum = 0; UNUR_DISTR *distr; UNUR_PAR *par; /* start test */ printf("[special "); fflush(stdout); fprintf(TESTLOG,"\n[special]\n"); /* set stop watch */ stopwatch_lap(&watch); /* test for maximal u-error */ printf("\n[test maximal u-error]"); fprintf(TESTLOG,"\n* Test maximal u-error *\n"); if (UERROR_STANDARDDIST) { /* --------------------------- */ printf("\nStandard distributions:\n"); fprintf(TESTLOG,"\n--- Standard distributions --- \n\n"); if (ALL) { printf(" normal"); distr = unur_distr_normal(NULL,0); par = unur_ninv_new(distr); errorsum += ninv_error_experiment(par,samplesize); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } } /* endif (UERROR_STANDARDDIST) */ /* test finished */ FAILED = (errorsum < 2) ? 0 : 1; /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (FAILED) ? 0 : 1; (FAILED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_special() */ /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_ninv_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_distr_cxtrans.c0000644001357500135600000012672614430713513014574 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for DISTR_CXTRANS **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); int unur_distr_cxtrans_set_verify( UNUR_PAR *par, int verify); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ #define COMPARE_SAMPLE_SIZE (500) #define VIOLATE_SAMPLE_SIZE (20) /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,25,(unur_distr_cxtrans_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,25,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,32,(unur_distr_cxtrans_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,32,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [set] */ void test_set (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[set "); fflush(stdout); fprintf(TESTLOG,"\n[set]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,43,(unur_distr_cxtrans_set_alpha( distr, 5. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,43,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,46,(unur_distr_cxtrans_set_rescale( distr, 1., 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,46,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,49,(unur_distr_cxtrans_set_domain( distr, 0., 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,49,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,52,(unur_distr_cxtrans_set_mode( distr, 0. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,52,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,55,(unur_distr_cxtrans_set_logpdfpole( distr, 0., 0. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,55,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution object */ UNUR_DISTR *distr = NULL; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,62,(unur_distr_cxtrans_set_alpha( distr, 5. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,62,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,65,(unur_distr_cxtrans_set_rescale( distr, 1., 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,65,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,68,(unur_distr_cxtrans_set_domain( distr, 0., 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,68,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,71,(unur_distr_cxtrans_set_logpdfpole( distr, 0., 0. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,71,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution object */ UNUR_DISTR *distr = NULL; distr = unur_distr_normal(NULL,0); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,78,(unur_distr_cxtrans_set_alpha( distr, 5. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,78,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,81,(unur_distr_cxtrans_set_rescale( distr, 1., 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,81,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,84,(unur_distr_cxtrans_set_domain( distr, 0., 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,84,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,87,(unur_distr_cxtrans_set_logpdfpole( distr, 0., 0. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,87,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; UNUR_DISTR *cxt; distr = unur_distr_normal(NULL,0); cxt = unur_distr_cxtrans_new( distr ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,96,(unur_distr_cxtrans_set_alpha( cxt, -5. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,96,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,99,(unur_distr_cxtrans_set_rescale( cxt, 1., -1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,99,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,102,(unur_distr_cxtrans_set_alpha( cxt, 0. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,102,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_distr_cxtrans_set_alpha( cxt, UNUR_INFINITY ); n_tests_failed += (check_expected_setfailed(TESTLOG,106,(unur_distr_cxtrans_set_domain( cxt, -1., 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,106,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_distr_free(cxt); unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_set() */ /*---------------------------------------------------------------------------*/ /* [get] */ void test_get (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[get "); fflush(stdout); fprintf(TESTLOG,"\n[get]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,119,(unur_distr_cxtrans_get_distribution( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,119,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_negINFINITY(TESTLOG,122,(unur_distr_cxtrans_get_alpha( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,122,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_negINFINITY(TESTLOG,125,(unur_distr_cxtrans_get_mu( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,125,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_negINFINITY(TESTLOG,128,(unur_distr_cxtrans_get_sigma( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,128,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,135,(unur_distr_cxtrans_get_distribution( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,135,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_negINFINITY(TESTLOG,138,(unur_distr_cxtrans_get_alpha( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,138,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_negINFINITY(TESTLOG,141,(unur_distr_cxtrans_get_mu( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,141,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_negINFINITY(TESTLOG,144,(unur_distr_cxtrans_get_sigma( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,144,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution id */ UNUR_DISTR *distr = NULL; distr = unur_distr_cont_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,151,(unur_distr_cxtrans_get_distribution( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,151,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_negINFINITY(TESTLOG,154,(unur_distr_cxtrans_get_alpha( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,154,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_negINFINITY(TESTLOG,157,(unur_distr_cxtrans_get_mu( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,157,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_negINFINITY(TESTLOG,160,(unur_distr_cxtrans_get_sigma( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,160,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_get() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* compare clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; UNUR_GEN *clone; UNUR_DISTR *d; d = unur_distr_cauchy(NULL,0); unur_distr_cont_set_domain(d,0.,UNUR_INFINITY); distr = unur_distr_cxtrans_new( d ); unur_distr_cxtrans_set_alpha(distr, 0.5 ); unur_distr_free(d); par = unur_arou_new(distr); unur_arou_set_max_sqhratio(par,0.); gen = unur_init( par ); abort_if_NULL(TESTLOG, 188, gen ); unur_reset_errno(); /* original generator object */; n_tests_failed += (compare_sequence_gen_start(TESTLOG,192,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,198,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* [validate] */ /*---------------------------------------------------------------------------*/ /* [validate] */ void test_validate (void) { /* suppress GCC compiler warning */ GCC_DIAG_OFF(unused-variable) UNUR_DISTR *distr[14]; UNUR_PAR *par; UNUR_GEN *gen; double *darray; double fpm[10]; int n_tests_failed; int rcode; /* start test */ printf("[validate "); fflush(stdout); fprintf(TESTLOG,"\n[validate]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* distributions: 14 */ { { UNUR_DISTR *d; d = unur_distr_exponential( NULL, 0 ); distr[0] = unur_distr_cxtrans_new( d ); unur_distr_cxtrans_set_alpha(distr[0], UNUR_INFINITY ); unur_distr_cxtrans_set_mode(distr[0],1.); unur_distr_free(d); } } { { UNUR_DISTR *d; d = unur_distr_exponential( NULL, 0 ); distr[1] = unur_distr_cxtrans_new( d ); unur_distr_cxtrans_set_alpha(distr[1], 2.); unur_distr_free(d); } } { { UNUR_DISTR *d; d = unur_distr_exponential( NULL, 0 ); distr[2] = unur_distr_cxtrans_new( d ); unur_distr_cxtrans_set_alpha(distr[2], 1.); unur_distr_cxtrans_set_mode(distr[2],0.); unur_distr_free(d); } } { { UNUR_DISTR *d; d = unur_distr_exponential( NULL, 0 ); distr[3] = unur_distr_cxtrans_new( d ); unur_distr_cxtrans_set_alpha(distr[3], 0.5); unur_distr_cxtrans_set_mode(distr[3],0.7071067811865475); unur_distr_free(d); } } { { UNUR_DISTR *d; d = unur_distr_exponential( NULL, 0 ); distr[4] = unur_distr_cxtrans_new( d ); unur_distr_cxtrans_set_alpha(distr[4], 0.1); unur_distr_cxtrans_set_mode(distr[4],0.9895192582062144); unur_distr_free(d); } } { { UNUR_DISTR *d; d = unur_distr_exponential( NULL, 0 ); distr[5] = unur_distr_cxtrans_new( d ); unur_distr_cxtrans_set_alpha(distr[5], 0.001); unur_distr_cxtrans_set_mode(distr[5],0.9999989995001669); unur_distr_free(d); } } { { UNUR_DISTR *d; d = unur_distr_exponential( NULL, 0 ); distr[6] = unur_distr_cxtrans_new( d ); unur_distr_cxtrans_set_alpha(distr[6], 0.); unur_distr_cxtrans_set_mode(distr[6],0.); unur_distr_free(d); } } { { UNUR_DISTR *d; d = unur_distr_exponential_wo_logpdf( NULL, 0 ); distr[7] = unur_distr_cxtrans_new( d ); unur_distr_cxtrans_set_alpha(distr[7], UNUR_INFINITY ); unur_distr_cxtrans_set_mode(distr[7],1.); unur_distr_free(d); } } { { UNUR_DISTR *d; d = unur_distr_exponential_wo_logpdf( NULL, 0 ); distr[8] = unur_distr_cxtrans_new( d ); unur_distr_cxtrans_set_alpha(distr[8], 2.); unur_distr_free(d); } } { { UNUR_DISTR *d; d = unur_distr_exponential_wo_logpdf( NULL, 0 ); distr[9] = unur_distr_cxtrans_new( d ); unur_distr_cxtrans_set_alpha(distr[9], 1.); unur_distr_cxtrans_set_mode(distr[9],0.); unur_distr_free(d); } } { { UNUR_DISTR *d; d = unur_distr_exponential_wo_logpdf( NULL, 0 ); distr[10] = unur_distr_cxtrans_new( d ); unur_distr_cxtrans_set_alpha(distr[10], 0.5); unur_distr_cxtrans_set_mode(distr[10],0.7071067811865475); unur_distr_free(d); } } { { UNUR_DISTR *d; d = unur_distr_exponential_wo_logpdf( NULL, 0 ); distr[11] = unur_distr_cxtrans_new( d ); unur_distr_cxtrans_set_alpha(distr[11], 0.1); unur_distr_cxtrans_set_mode(distr[11],0.9895192582062144); unur_distr_free(d); } } { { UNUR_DISTR *d; d = unur_distr_exponential_wo_logpdf( NULL, 0 ); distr[12] = unur_distr_cxtrans_new( d ); unur_distr_cxtrans_set_alpha(distr[12], 0.001); unur_distr_cxtrans_set_mode(distr[12],0.9999989995001669); unur_distr_free(d); } } { { UNUR_DISTR *d; d = unur_distr_exponential_wo_logpdf( NULL, 0 ); distr[13] = unur_distr_cxtrans_new( d ); unur_distr_cxtrans_set_alpha(distr[13], 0.); unur_distr_cxtrans_set_mode(distr[13],0.); unur_distr_free(d); } } /* timing */ stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); printf("\n(chi^2) "); fflush(stdout); /* chi^2 tests: 70 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nChi^2 Test:\n"); /* distribution [0] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_arou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_ninv_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tabl_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_ninv_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [2] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_arou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_ninv_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tabl_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [3] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_arou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_ninv_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tabl_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [4] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_arou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_ninv_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tabl_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [5] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_ninv_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tabl_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [6] */ if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_ninv_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tabl_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [7] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_arou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_ninv_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tabl_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [8] */ if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_ninv_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [9] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_arou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_ninv_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tabl_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [10] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_arou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_ninv_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tabl_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [11] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_arou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_ninv_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tabl_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [12] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_ninv_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tabl_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [13] */ if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_ninv_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tabl_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); /* free distributions */ unur_distr_free(distr[0]); unur_distr_free(distr[1]); unur_distr_free(distr[2]); unur_distr_free(distr[3]); unur_distr_free(distr[4]); unur_distr_free(distr[5]); unur_distr_free(distr[6]); unur_distr_free(distr[7]); unur_distr_free(distr[8]); unur_distr_free(distr[9]); unur_distr_free(distr[10]); unur_distr_free(distr[11]); unur_distr_free(distr[12]); unur_distr_free(distr[13]); /* test finished */ test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; /* we accept CHI2_FAILURES_TOLERATED failures */ (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_validate */ /* enable GCC compiler warning */ GCC_DIAG_ON(unused-variable) /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_distr_cxtrans_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_dss.conf0000644001357500135600000001743314420445767013207 00000000000000############################################################################# [main] [main - data:] # method (for information only: the program scans the file name) method: DSS [main - header:] /* prototypes */ \#define COMPARE_SAMPLE_SIZE (15000) \#define VIOLATE_SAMPLE_SIZE (20) const int n_pv = 36; const double pv[36]={1,2,3,4,5,6,5,3,6,7,5,4,3,4,6,7,5,3,4,3,8,6,5,4,7,7,2,2,1,4,7,4,3,7,3,2}; const double pvsum = 158.; const double pvre[10] = {1,2,3,4,5,6,7,8,9,10}; const double pvresum = 55.; double my_pmf(int k, const UNUR_DISTR *distr); double my_cdf(int k, const UNUR_DISTR *distr); /* \#define SEED (298346) */ ############################################################################# [new] [new - invalid NULL ptr: distr = NULL; ] ~( distr ); --> expected_NULL --> UNUR_ERR_NULL [new - invalid distribution type: distr = unur_distr_cont_new(); ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID [new - data missing in distribution object: distr = unur_distr_discr_new(); /* no probability vector */ ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED ############################################################################# # [set] ############################################################################# # [get] ############################################################################# # [chg] ############################################################################# [init] [init - invalid NULL ptr: par = NULL; ] unur_init( par ); --> expected_NULL --> UNUR_ERR_NULL ############################################################################# [reinit] [reinit - exist: double fpar[2] = {10.,0.63}; distr = unur_distr_binomial(fpar,2); par = unur_dss_new(distr); gen = unur_init( par ); <-- ! NULL ] unur_reinit( gen ); --> expected_reinit ############################################################################# [sample] [sample - compare clone: UNUR_GEN *clone; double fpar[] = {10,0.3}; distr = unur_distr_binomial(fpar,2); par = NULL; gen = NULL; ] /* original generator object */ par = unur_dss_new(distr); gen = unur_init(par); -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen #..................................................................... [sample - compare reinit: double fpar[] = {10,0.3}; distr = unur_distr_binomial(fpar,2); par = NULL; gen = NULL; ] /* original generator object */ par = unur_dss_new(distr); gen = unur_init(par); -->compare_sequence_gen_start /* reinit */ unur_reinit(gen); -->compare_sequence_gen #..................................................................... [sample - compare stringparser: double pvec[] = {.1, .2, .3, .4, .5, .6, .7, .8, .9, 1.}; distr = NULL; par = NULL; gen = NULL; ] distr = unur_distr_discr_new(); unur_distr_discr_set_pv(distr,pvec,10); unur_distr_discr_set_pmfsum(distr,46.); par = unur_dss_new(distr); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "discr; pv = (.1, .2, .3, .4, .5, .6, .7, .8, .9, 1.); pmfsum=46 \ & method = dss" ); -->compare_sequence_gen ############################################################################# [validate] [validate - generators:] # default program par[0] = unur_dss_new(@distr@); # reinitialized with changed domain { UNUR_DISTR *dg =NULL; par[1] = unur_dss_new(@distr@); dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } # reinitialized with changed pdf parameters { UNUR_DISTR *dg =NULL; par[2] = unur_dss_new(@distr@); fpm[0] = 10.; fpm[1] = 0.63; dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } # reinitialized with changed pv { UNUR_DISTR *dg =NULL; par[3] = unur_dss_new(@distr@); dg = unur_get_distr(gen); unur_distr_discr_set_pv(dg,pvre,10); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } [validate - distributions:] # probability vector with random entries distr[0] = unur_distr_discr_new(); unur_distr_discr_set_pv(distr[0],pv,n_pv); unur_distr_discr_set_pmfsum(distr[0],pvsum); unur_distr_set_name(distr[0],"pv(0..35)"); distr[1] = unur_distr_discr_new(); unur_distr_discr_set_pv(distr[1],pv,n_pv); unur_distr_discr_set_domain(distr[1],100,135); unur_distr_discr_set_pmfsum(distr[1],pvsum); unur_distr_set_name(distr[1],"pv(100..135)"); ## PMF instead of PV distr[2] = unur_distr_discr_new(); unur_distr_discr_set_pmf(distr[2],my_pmf); unur_distr_discr_set_pmfsum(distr[2],pvsum); unur_distr_set_name(distr[2],"pmf(0..35)"); distr[14] = unur_distr_discr_new(); unur_distr_discr_set_pmf(distr[14],my_pmf); unur_distr_discr_set_domain(distr[14],0,35); unur_distr_discr_set_pmfsum(distr[14],pvsum); unur_distr_set_name(distr[14],"pmf(0..35)"); ## CDF instead of PV distr[3] = unur_distr_discr_new(); unur_distr_discr_set_cdf(distr[3],my_cdf); unur_distr_set_name(distr[3],"cdf(0..35)"); distr[15] = unur_distr_discr_new(); unur_distr_discr_set_cdf(distr[15],my_cdf); unur_distr_discr_set_domain(distr[15],0,35); unur_distr_set_name(distr[15],"cdf(0..35)"); # geometric disctribution fpm[0] = 0.5; distr[4] = unur_distr_geometric(fpm,1); fpm[0] = 0.01; distr[5] = unur_distr_geometric(fpm,1); # logarithmic distribution fpm[0] = 0.1; distr[6] = unur_distr_logarithmic(fpm,1); fpm[0] = 0.99; distr[7] = unur_distr_logarithmic(fpm,1); # negative binomial distribution fpm[0] = 0.5; fpm[1] = 10.; distr[8] = unur_distr_negativebinomial(fpm,2); fpm[0] = 0.8; fpm[1] = 10.; distr[9] = unur_distr_negativebinomial(fpm,2); # poisson distribution fpm[0] = 0.1; distr[10] = unur_distr_poisson(fpm,1); fpm[0] = 0.999; distr[11] = unur_distr_poisson(fpm,1); # binomial distribution fpm[0] = 20.; fpm[1] = 0.8; distr[12] = unur_distr_binomial(fpm,2); # binomial distribution fpm[0] = 2000.; fpm[1] = 0.0013; distr[13] = unur_distr_binomial(fpm,2); # number of distributions: 16 [validate - test chi2:] # + ... pass test # 0 ... fail to initialize generator # - ... fail test # . ... do not run test # # ... comment # # [0] ... default # [1] ... reinitialized with changed domain # [2] ... reinitialized with changed pdf parameters # [3] ... reinitialized with changed pv # #gen 0 1 2 3 # distribution #------------------------------------------------------------- <0> + + . + # PV on [0..35] with random entries <1> + + . + # PV on [100..135] with random entries <2> + + . . # PMF on [0..35] with random entries <14> + + . . # PMF on [0..35] with random entries <3> + . . . # CDF on [0..35] with random entries <15> + . . . # CDF on [0..35] with random entries <4> + + . . # geometric (0.5) x <5> + + . . # geometric (0.01) <6> + + . . # logarithmic (0.1) x <7> + + . . # logarithmic (0.99) x <8> + + . . # negativebinomial (0.5, 10) <9> + + . . # negativebinomial (0.8, 10) <10> + + . . # poisson (0.1) <11> + + . . # poisson (0.999) x<12> + + + . # binomial (20, 0.8) x<13> + + + . # binomial (2000, 0.0013) ############################################################################# ############################################################################# [verbatim] double my_pmf(int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { if (k<0 || k>35) return 0.; else return pv[k]; } double my_cdf(int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double sum; int j; if (k<0) return 0.; if (k>=35) return 1.; for (sum=0.,j=0; j<=k; j++) sum += pv[j]; return sum/pvsum; } /*---------------------------------------------------------------------------*/ ############################################################################# unuran-1.11.0/tests/t_urng.c0000644001357500135600000002431414430713513012646 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for URNG **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); int unur_urng_set_verify( UNUR_PAR *par, int verify); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ #define COMPARE_SAMPLE_SIZE (500) #define VIOLATE_SAMPLE_SIZE (20) /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ #ifdef UNUR_URNG_UNURAN unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,26,(unur_urng_new( NULL, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,26,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; #endif } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [set] */ void test_set (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[set "); fflush(stdout); fprintf(TESTLOG,"\n[set]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_URNG *urng = NULL; #ifdef UNUR_URNG_UNURAN unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,40,(unur_urng_set_seed( urng, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,40,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,43,(unur_urng_set_anti( urng, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,43,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,46,(unur_urng_set_reset( urng, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,46,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,49,(unur_urng_set_nextsub( urng, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,49,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,52,(unur_urng_set_resetsub( urng, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,52,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,55,(unur_urng_set_delete( urng, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,55,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; #endif } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_set() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* missing functions */ UNUR_URNG *urng = NULL; double (*sampleunif)(void*); sampleunif = unur_urng_fish; #ifdef UNUR_URNG_UNURAN urng = unur_urng_new(sampleunif,NULL); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,89,(unur_urng_reset (urng)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,89,UNUR_ERR_URNG_MISS)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,92,(unur_urng_seed (urng, 0UL)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,92,UNUR_ERR_URNG_MISS)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,95,(unur_urng_anti (urng, 0)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,95,UNUR_ERR_URNG_MISS)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,98,(unur_urng_nextsub (urng)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,98,UNUR_ERR_URNG_MISS)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,101,(unur_urng_resetsub (urng)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,101,UNUR_ERR_URNG_MISS)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,104,(unur_urng_seed (urng, 0UL)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,104,UNUR_ERR_URNG_MISS)==UNUR_SUCCESS)?0:1; unur_urng_free(urng); #endif } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_urng_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_auto.c0000644001357500135600000002753714430713513012655 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for AUTO **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); int unur_auto_set_verify( UNUR_PAR *par, int verify); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ int unur_auto_set_pedantic( struct unur_par *par, int pedantic ); #define COMPARE_SAMPLE_SIZE (10000) #define VIOLATE_SAMPLE_SIZE (20) /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ /* no such function */ int unur_auto_set_pedantic( struct unur_par *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) { return 1; } /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,27,(unur_auto_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,27,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [set] */ void test_set (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[set "); fflush(stdout); fprintf(TESTLOG,"\n[set]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_auto_set_logss(par,1); } { /* invalid parameter object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = unur_distr_normal(NULL,0); par = unur_tdr_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,44,(unur_auto_set_logss(par,1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,44,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = unur_distr_normal(NULL,0); par = unur_auto_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,53,(unur_auto_set_logss(par,-1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,53,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_set() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* compare */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,0); par = NULL; unur_reset_errno(); /* TDR */ par = unur_tdr_new(distr); n_tests_failed += (compare_sequence_par_start(TESTLOG,96,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* AUTO */ par = unur_auto_new(distr); n_tests_failed += (compare_sequence_par(TESTLOG,100,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* compare */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double fpar[] = {0.1}; distr = unur_distr_geometric(fpar,1); par = NULL; unur_reset_errno(); /* DARI */ par = unur_dari_new(distr); n_tests_failed += (compare_sequence_par_start(TESTLOG,109,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* AUTO */ par = unur_auto_new(distr); n_tests_failed += (compare_sequence_par(TESTLOG,113,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* compare clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; UNUR_GEN *clone; distr = unur_distr_normal(NULL,0); par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_auto_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,126,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,132,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare stringparser - cont */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = NULL; par = NULL; gen = NULL; unur_reset_errno(); distr = unur_distr_normal(NULL,0); par = unur_auto_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,144,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "normal()" ); n_tests_failed += (compare_sequence_gen(TESTLOG,149,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "normal() & method = auto" ); n_tests_failed += (compare_sequence_gen(TESTLOG,154,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare stringparser discr */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[] = {0.4}; distr = NULL; par = NULL; gen = NULL; unur_reset_errno(); distr = unur_distr_geometric(fpar,1); par = unur_auto_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,167,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "geometric(0.4)"); n_tests_failed += (compare_sequence_gen(TESTLOG,172,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "geometric(0.4) & method = auto"); n_tests_failed += (compare_sequence_gen(TESTLOG,177,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_auto_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/README.conf0000644001357500135600000003402714420445767013026 00000000000000############################################################################# # # Config file for test routines # # This file contains section with subsections. # Sections are indicated by [], subsections by [ - :] # (the brackets '[]', the dash '-' and the colon ':' are required). # There must be a line break after the closing bracket ']'. # # The names of the other sections can be arbitrary. However there are some # restrictions: # # (*) There alway must be a section [main]. # # (*) There must no be section [start] nor a subjection [ - start:]. # # (*) The sections [main], [verbatim], [validate], and [special] # are reserved and have a special meaning. # # Lines starting with '#' are ignored (comments). Similarly any text from # '#' til the end of a line is deleted. # `#' can be inserted by using `\#'. # ############################################################################# # # [main] # # Section [main] contains global data and there must be two subsections: # [main - data:] and [main - header:] # # Subsection [main - data:] must contain the following keywords: # # (*) method: # e.g. # method: AROU # # Everything in the subsection [main - header:] is copied verbatim # into the C file header. # eg. for prototypes for functions defined in section [verbatim]. # # Important: C header files can be included here. However, the path # must be relative to the 'top_srcdir' directory. # # Moreover this subsection must contain the following to definitions: # static int COMPARE_SAMPLE_SIZE = 500; # static int VIOLATE_SAMPLE_SIZE = 20; /* or any appropriate samples size */ # # Optionally the following macros can be defined: # (defaults given in brackets) # # CHI2_FAILURES_TOLERATED (2): # number of failures in section [validate - test chi2:], see below # # SEED: # if defined it is used to set the seed of the random number generator # # Notice: One also can set a global seed by setting the environment # variable 'SEED'. This is used in every generated C test file instead # of a randomly chosen one. However, it is overridden by the macro # 'SEED' #defined in the conf file. # # Both settings, however, are overwritten at runtime when the # environmental variable 'SEED' is defined. # ############################################################################# # # [verbatim] # # Everthing in section [verbatim] is copies AS IS into the C file immediately # after the C file header. # # ############################################################################# # # [special] # # There any tests can be added. There must be two subsections: # # [special - decl:] # Contains all declarations. # # [special - start:] # Contains the actual code # The variable FAILED should be set to a nonzero interger if one (or more) # tests have failed. # ############################################################################# # # [validate] # # Section [validate] describes tests for the implemented generators. # # It contains the following subsections: # # [validate - generators:] # List of generator types. Each type has to be declared by the # corresponding UNU.RAN calls to build a parameter object. # Different types are separated by empty lines. # The parameter object must be called `par[x]', where `x' # is an integer. It can be used for numbering the objects. However # this is just for convinience since it is ignored when scanning # the file. internally the first parameter object that appear in # the file is labeled with `0' the second with `1', and so on. # # IMPORTANT: the distribution object in the unur_..._new() call # has to be encoded by `@distr@'. # Example: to get a parameter object for method TDR and change # the parameter c you have to write: # par[0] = unur_tdr_new(@distr@); # unur_tdr_set_c(par[0],0.); # # It is also possible to change an existing generator object. # The generator object must be called `gen'. # It is not necessary (and even verboten) to call unur_init(). # Example: To get a generator for method SROU, change the domain # of the distribution, and reinitialize the generator # you have to write: # par[1] = unur_srou_new(@distr@); # unur_srou_chg_domain(gen,0.9,0.91); # unur_srou_upd_pdfarea(gen); # unur_srou_upd_mode(gen); # unur_srou_reinit(gen); # # # [validate - distributions:] # List of distributions. Each distribution object has to be # declared by the corresponding UNU.RAN calls. # Different distibutions are separated by empty lines. # If a pointer to a double array is required use `darray'. # If an array for parameters of the PDF is required use `fpm'. # The distribution object must be called `distr[x]', where # `x' is an integer. `x' is used to refer to this distribution # object. # # IMPORTANT: when there n distributions, all the `x' must be # different and run through 1,...,n. There is no checking! (However # the C compiler might complain.) # # # [validate - test chi2:] # Run chi-square goodness-of-fit tests. # The threshold p-value for a failure is set by the constant # PVAL_LIMIT in file 'testunuran.h' (currently 1.e-3). # A failed test is repeated once. # The entire test is failed if # - a particular test fails twice # - more than 'CHI2_FAILURES_TOLERATED' particular tests fail # at least once # The default for CHI2_FAILURES_TOLERATED is 2 and can be changed # In section [main] in the '*.conf' file (see above). # Notice: "Real" failures count for 1000 "soft" failures. # # The section contains a table which test has to be performed. # Each line starts with `
' where `dd' indicates the number of the # distributions as declared in section [validate - distributions:]. # One lines contains the tests that should be performed by with # a particular distribution. # Each line consists of the `
' marker followed by a list of # one character symbols. All entries are separated by white space # characters. There must be one symbol for each of the generator # types declared in subsection [validate - generators:] that # describes the expected result of the test when performed with the # choosen generator and the choosen distribution. # The following symbols can be used: # + should pass test # % should initialize generator and draw small sample (for memory debugging) # 0 should fail to initialize generator # - should fail to iniialize or fail the test (not implemented yet) # / either init fails or test successful (necessary for special generators) # . do not run the test # # Each line can be preceded by the letters 'x' or 'X' to exclude the # corresponding tests from 'make check' runs. # These optional tests are then only run when the environment variable # 'UNURANFULLCHECK' is defined (regardless of the actual value of the # variable). Likewise it is possible to mark particular tests for a # distribution by prefixing the corresponding symbol ('+', '0', '-', # '/', or '.') by a single 'x' or 'X'; no blanks are allowed between # 'x' and the symbol. # # Example: # # #par [0] [1] [2] # #--------------------------- # <0> + + . # <1> - + 0 # <2> - + 0 # <3> + + - # <4> + - . # x<5> + . - # <6> x+ + x+ # # That is: # run test and expect that the test is passed for # distribution 0 with generator 0 and 1 # distribution 1 with generator 1 # distribution 2 with generator 1 # distribution 3 with generator 0 and 1 # distribution 4 with generator 0 # expect that initialization of the generator fails # distribution 1 with generator 2 # distribution 2 with generator 2 # expect that initialization of the generator fails or # that the test is expected to fail for # distribution 1 with generator 0 # distribution 2 with generator 0 # distribution 3 with generator 2 # distribution 4 with generator 1 # do not run the test for # distribution 0 with generator 2 # distribution 4 with generator 2 # # run the tests only in fullcheck mode for # distribution 5 # distribution 6 with generators 0 and 2 # # Notice that the line # #par [0] [1] [2] # is just a comment line for convinience. Moreover the numbering # [0], [1], and [2] coincides with the order of definition in the # subsection [validate - generators:]. # # [validate - verify hat:] # Tests if condition of method is satisfied. It counts the number # occurences when unur_errno is equal to UNUR_ERR_GEN_CONDITION, # i.e. when when one of the following conditions is violated # squeeze <= PDF <= hat # or a violation is detected during an adaptive step. # # Contains a table which test has to be performed. # Each line starts with `
' where `dd' indicates the number of the # distributions as declared in section [validate - distributions:]. # One lines contains the tests that should be performed by with # a particular distribution. # Each line consists of the `
' marker followed by a list of # one character symbols. All entries are separated by white space # characters. There must be one symbol for each of the generator # types declared in subsection [validate - generators:] that # describes the expected result of the test when performed with the # choosen generator and the choosen distribution. # The following symbols can be used: # + should pass test # ~ condition might fail in at most 1% of all samples # 0 should fail to initialize generator # - should fail to iniialize or fail the test (not implemented yet) # / either init fails or test successful (necessary for special generators) # . do not run the test # # Each line can be preceded by the letters 'x' or 'X' to exclude the # corresponding tests from 'make check' runs. # These optional tests are then only run when the environment variable # 'UNURANFULLCHECK' is defined (regardless of the actual value of the # variable). Likewise it is possible to mark particular tests for a # distribution by prefixing the corresponding symbol ('+', '~', '0', '-', # '/', or '.') by a single 'x' or 'X'; no blanks are allowed between # 'x' and the symbol. # # Example: # # #par [0] [1] [2] # #--------------------------- # <0> + ~ . # <1> - + 0 # <2> - + 0 # <3> + + - # <4> + - . # x<5> + . - # <6> x+ + x+ # # That is: # run test and expect that the test is passed for # distribution 0 with generator 0 # distribution 1 with generator 1 # distribution 2 with generator 1 # distribution 3 with generator 0 and 1 # distribution 4 with generator 0 # run test and expect that in at most of 1% the test fails for # distribution 0 with generator 1 # expect that initialization of the generator fails # distribution 1 with generator 2 # distribution 2 with generator 2 # expect that initialization of the generator fails or # that the test is expected to fail for # distribution 1 with generator 0 # distribution 2 with generator 0 # distribution 3 with generator 2 # distribution 4 with generator 1 # do not run the test for # distribution 0 with generator 2 # distribution 4 with generator 2 # # run the tests only in fullcheck mode for # distribution 5 # distribution 6 with generators 0 and 2 # # Notice that the line # #par [0] [1] [2] # is just a comment line for convinience. Moreover the numbering # [0], [1], and [2] coincides with the order of definition in the # subsection [validate - generators:]. # # ############################################################################# # # All other sections # # Each of these sections decribe tests. # For each subsection definitions can be but into the subsection label, # eg.: [reinit - exist: # double fpar[2] = {0.,1.}; # distr = unur_distr_normal(fpar,2); # par = unur_srou_new(distr); # gen = unur_init( par ); <-- ! NULL ] # (the "<-- ! NULL" (in the same line) indicates, that the result should # be checked for an invalid NULL pointer.) # # The following names _must_ be used through out. # distr ... for distribution objects. # par ... for parameter objects. # gen ... for generator objects. # These there variables are declared automatically whenever they occur. # # Tests are separated by empty lines. Each test has the form # [ ] --> [ --> ] # (the first and the third part are optional). # # eg.: # unur_srou_new( distr ); # --> expected_NULL --> UNUR_ERR_NULL # # It is also possible to insert C code without a test, e.g. for # freeing some memory. # # A ~ (tilde) at the beginning of a line is expanded to # unur__. # e.g. in file srou.c, section [set] # ~_cdfatmode(par,0.); is equivalent to unur_srou_set_cdfatmode(par,0.); # # # List of tests: # # --> none # do not check return value (useful if only error code in unur_errno # should be tested). # # --> expected_NULL # check if the last C call returns a NULL pointer. # # --> expected_zero # check if the last C call return zero (int 0). # # --> expected_INFINITY # --> expected_negINFINITY # check if last C call returns UNUR_INFINITY or -UNUR_INFINITY, resp. # # --> expected_INTMAX # check if the last C call return INTMAX (of type int). # # --> expected_setfailed # check if the last set of chg call has failed. # # --> expected_reinit # check if unur_reinit works. # # --> run_verify_generator # run a generator in the verifying mode. # # --> compare_sequence_par_start # --> compare_sequence_par # compare random string generated by generator created by last # parameter object with the random string generated by generator # object from the last compare_double_sequence_par_start test. # # --> compare_sequence_gen # --> compare_sequence_gen_start # Analogously except that a generator object is used. # # -->compare_double_sequence_urng_start # Analogously but for the output of uniform random number generators. # ############################################################################# unuran-1.11.0/tests/t_dgt.c0000644001357500135600000025652114430713513012460 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for DGT **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); int unur_dgt_set_verify( UNUR_PAR *par, int verify); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ #define COMPARE_SAMPLE_SIZE (15000) #define VIOLATE_SAMPLE_SIZE (20) double *make_geometric_vector(double q, int len); double *make_random_vector(int len); UNUR_DISTR *get_distr_with_invalid_pv( void ); UNUR_DISTR *get_distr_with_pv( void ); /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ /*---------------------------------------------------------------------------*/ /* make a probability vector (need not sum to one) (use random entries) */ double *make_random_vector(int len) { double *pv; int i; /* allocate memory */ pv = malloc(len*sizeof(double)); if (!pv) abort(); /* main part of geometric distribution */ for( i=0; itime = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [set] */ void test_set (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[set "); fflush(stdout); fprintf(TESTLOG,"\n[set]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,52,(unur_dgt_set_variant(par,1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,52,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,55,(unur_dgt_set_guidefactor(par,-1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,55,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* invalid parameter object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = get_distr_with_pv(); par = unur_dau_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,62,(unur_dgt_set_variant(par,10)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,62,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,65,(unur_dgt_set_guidefactor(par,-1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,65,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = get_distr_with_pv(); par = unur_dgt_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,74,(unur_dgt_set_variant(par,10)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,74,UNUR_ERR_PAR_VARIANT)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,77,(unur_dgt_set_guidefactor(par,-1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,77,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_set() */ /*---------------------------------------------------------------------------*/ /* [init] */ void test_init (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[init "); fflush(stdout); fprintf(TESTLOG,"\n[init]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,97,(unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,97,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* invalid data */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = get_distr_with_invalid_pv(); par = unur_dgt_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,105,(unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,105,UNUR_ERR_GEN_DATA)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_init() */ /*---------------------------------------------------------------------------*/ /* [reinit] */ void test_reinit (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[reinit "); fflush(stdout); fprintf(TESTLOG,"\n[reinit]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* exist */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[2] = {10.,0.63}; distr = unur_distr_binomial(fpar,2); par = unur_dgt_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 114, gen ); unur_reset_errno(); n_tests_failed += (check_expected_reinit(TESTLOG,118,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_reinit() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_GEN *gen = NULL; gen = NULL; unur_reset_errno(); n_tests_failed += (check_expected_INTMAX(TESTLOG,128,(unur_dgt_eval_invcdf_recycle(gen,0.5,NULL)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,128,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INTMAX(TESTLOG,131,(unur_dgt_eval_invcdf(gen,0.5)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,131,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_free(gen); } { /* invalid generator object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_srou_new(distr); gen = unur_init(par); abort_if_NULL(TESTLOG, 137, gen ); unur_reset_errno(); n_tests_failed += (check_expected_INTMAX(TESTLOG,141,(unur_dgt_eval_invcdf_recycle(gen,0.5,NULL)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,141,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INTMAX(TESTLOG,144,(unur_dgt_eval_invcdf(gen,0.5)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,144,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* invalid domain */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[] = {10,0.3}; distr = unur_distr_binomial(fpar,2); par = unur_dgt_new(distr); unur_set_debug(par,0); gen = unur_init( par ); abort_if_NULL(TESTLOG, 150, gen ); unur_reset_errno(); unur_dgt_eval_invcdf_recycle(gen,1.5,NULL); n_tests_failed += (check_errorcode(TESTLOG,154,UNUR_ERR_DOMAIN)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_zero(TESTLOG,157,(unur_dgt_eval_invcdf_recycle(gen,-0.5,NULL)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,157,UNUR_ERR_DOMAIN)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_dgt_eval_invcdf(gen,1.5); n_tests_failed += (check_errorcode(TESTLOG,160,UNUR_ERR_DOMAIN)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_zero(TESTLOG,163,(unur_dgt_eval_invcdf(gen,-0.5)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,163,UNUR_ERR_DOMAIN)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = get_distr_with_pv(); par = NULL; unur_reset_errno(); /* default algorithm */ par = unur_dgt_new(distr); n_tests_failed += (compare_sequence_par_start(TESTLOG,173,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* variant 1 */ par = unur_dgt_new(distr); unur_dgt_set_variant(par,1); n_tests_failed += (compare_sequence_par(TESTLOG,178,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* variant 2 */ par = unur_dgt_new(distr); unur_dgt_set_variant(par,2); n_tests_failed += (compare_sequence_par(TESTLOG,183,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* larger guide table size */ par = unur_dgt_new(distr); unur_dgt_set_guidefactor(par,10.); n_tests_failed += (compare_sequence_par(TESTLOG,188,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* smaller guide table size */ par = unur_dgt_new(distr); unur_dgt_set_guidefactor(par,0.1); n_tests_failed += (compare_sequence_par(TESTLOG,193,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* sequential search */ par = unur_dgt_new(distr); unur_dgt_set_guidefactor(par,0.); n_tests_failed += (compare_sequence_par(TESTLOG,198,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* compare clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; UNUR_GEN *clone; double fpar[] = {10,0.3}; distr = unur_distr_binomial(fpar,2); par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_dgt_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,212,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,218,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare reinit */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[] = {10,0.3}; distr = unur_distr_binomial(fpar,2); par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_dgt_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,231,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* reinit */ unur_reinit(gen); n_tests_failed += (compare_sequence_gen(TESTLOG,235,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare stringparser */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double pv[] = {.1, .2, .3, .4, .5, .6, .7, .8, .9, 1.}; double fpar[] = {0.8}; distr = NULL; par = NULL; gen = NULL; unur_reset_errno(); distr = unur_distr_discr_new(); unur_distr_discr_set_pv(distr,pv,10); par = unur_dgt_new(distr); unur_dgt_set_guidefactor(par,3.); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,251,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "discr; pv = (.1, .2, .3, .4, .5, .6, .7, .8, .9, 1.) & \ method = dgt; guidefactor = 3." ); n_tests_failed += (compare_sequence_gen(TESTLOG,257,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; distr = unur_distr_discr_new(); unur_distr_discr_set_pv(distr,pv,10); par = unur_dgt_new(distr); unur_dgt_set_variant(par,1); unur_dgt_set_guidefactor(par,3.); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,267,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "discr; pv = (.1, .2, .3, .4, .5, .6, .7, .8, .9, 1.) & \ method = dgt; guidefactor = 3.; variant = 1" ); n_tests_failed += (compare_sequence_gen(TESTLOG,273,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_free(gen); gen = NULL; distr = unur_distr_discr_new(); unur_distr_discr_set_pv(distr,pv,10); par = unur_dgt_new(distr); unur_dgt_set_variant(par,2); unur_dgt_set_guidefactor(par,3.); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,284,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "discr; pv = (.1, .2, .3, .4, .5, .6, .7, .8, .9, 1.) & \ method = dgt; guidefactor = 3.; variant = 2" ); n_tests_failed += (compare_sequence_gen(TESTLOG,290,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; distr = unur_distr_geometric(fpar,1); par = unur_dgt_new(distr); unur_dgt_set_guidefactor(par,3.); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,298,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "geometric(0.8) & method = dgt; guidefactor = 3." ); n_tests_failed += (compare_sequence_gen(TESTLOG,303,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* [validate] */ /*---------------------------------------------------------------------------*/ /* [validate] */ void test_validate (void) { /* suppress GCC compiler warning */ GCC_DIAG_OFF(unused-variable) UNUR_DISTR *distr[24]; UNUR_PAR *par; UNUR_GEN *gen; double *darray; double fpm[10]; int n_tests_failed; int rcode; /* start test */ printf("[validate "); fflush(stdout); fprintf(TESTLOG,"\n[validate]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* distributions: 24 */ { distr[0] = unur_distr_discr_new(); darray = make_random_vector(10); unur_distr_discr_set_pv(distr[0],darray,10); free(darray); unur_distr_set_name(distr[0],"pv(random)"); } { distr[1] = unur_distr_discr_new(); darray = make_random_vector(100); unur_distr_discr_set_pv(distr[1],darray,100); free(darray); unur_distr_set_name(distr[1],"pv(random)"); } { distr[2] = unur_distr_discr_new(); darray = make_random_vector(1000); unur_distr_discr_set_pv(distr[2],darray,1000); free(darray); unur_distr_set_name(distr[2],"pv(random)"); } { distr[3] = unur_distr_discr_new(); darray = make_random_vector(10000); unur_distr_discr_set_pv(distr[3],darray,10000); free(darray); unur_distr_set_name(distr[3],"pv(random)"); } { distr[4] = unur_distr_discr_new(); darray = make_geometric_vector(1.,1000); unur_distr_discr_set_pv(distr[4],darray,1000); free(darray); unur_distr_set_name(distr[4],"pv(geometric)"); } { distr[5] = unur_distr_discr_new(); darray = make_geometric_vector(0.99,1000); unur_distr_discr_set_pv(distr[5],darray,1000); free(darray); unur_distr_set_name(distr[5],"pv(geometric)"); } { distr[6] = unur_distr_discr_new(); darray = make_geometric_vector(0.9,1000); unur_distr_discr_set_pv(distr[6],darray,1000); free(darray); unur_distr_set_name(distr[6],"pv(geometric)"); } { distr[7] = unur_distr_discr_new(); darray = make_geometric_vector(0.5,1000); unur_distr_discr_set_pv(distr[7],darray,1000); free(darray); unur_distr_set_name(distr[7],"pv(geometric)"); } { distr[8] = unur_distr_discr_new(); darray = make_geometric_vector(0.1,1000); unur_distr_discr_set_pv(distr[8],darray,1000); free(darray); unur_distr_set_name(distr[8],"pv(geometric)"); } { distr[9] = unur_distr_discr_new(); darray = make_geometric_vector(0.5,100); unur_distr_discr_set_pv(distr[9],darray,100); unur_distr_discr_set_domain(distr[9],10,209); free(darray); unur_distr_set_name(distr[9],"pv(geometric) - shifted domain"); } { distr[10] = unur_distr_discr_new(); darray = make_geometric_vector(0.9,100); unur_distr_discr_set_pv(distr[10],darray,100); unur_distr_discr_set_domain(distr[10],-10,209); free(darray); unur_distr_set_name(distr[10],"pv(geometric) - shifted domain"); } { fpm[0] = 0.5; distr[11] = unur_distr_geometric(fpm,1); } { fpm[0] = 0.001; distr[12] = unur_distr_geometric(fpm,1); } { fpm[0] = 0.1; distr[13] = unur_distr_logarithmic(fpm,1); } { fpm[0] = 0.999; distr[14] = unur_distr_logarithmic(fpm,1); } { fpm[0] = 0.5; fpm[1] = 10.; distr[15] = unur_distr_negativebinomial(fpm,2); } { fpm[0] = 0.8; fpm[1] = 10.; distr[21] = unur_distr_negativebinomial(fpm,2); } { fpm[0] = 0.01; fpm[1] = 20.; distr[16] = unur_distr_negativebinomial(fpm,2); } { fpm[0] = 0.1; distr[17] = unur_distr_poisson(fpm,1); } { fpm[0] = 0.999; distr[18] = unur_distr_poisson(fpm,1); } { fpm[0] = 2.; fpm[1] = 1.; distr[19] = unur_distr_zipf(fpm,2); unur_distr_discr_set_domain(distr[19],1,1000); } { fpm[0] = 0.001; fpm[1] = 1.; distr[20] = unur_distr_zipf(fpm,2); unur_distr_discr_set_domain(distr[20],1,1000); } { fpm[0] = 20.; fpm[1] = 0.8; distr[22] = unur_distr_binomial(fpm,2); } { fpm[0] = 2000.; fpm[1] = 0.0013; distr[23] = unur_distr_binomial(fpm,2); } /* timing */ stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); printf("\n(chi^2) "); fflush(stdout); /* chi^2 tests: 168 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nChi^2 Test:\n"); /* distribution [0] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_dgt_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,2); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,0.1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_dgt_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,2); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,0.1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [2] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_dgt_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,2); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,0.1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [3] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_dgt_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,2); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,0.1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [4] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_dgt_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,2); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,0.1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [5] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_dgt_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,2); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,0.1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [6] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_dgt_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,2); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,0.1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [7] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_dgt_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,2); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,0.1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [8] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_dgt_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,2); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,0.1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [9] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_dgt_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,2); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,0.1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [10] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_dgt_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,2); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,0.1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [11] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_dgt_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,2); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,0.1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); { UNUR_DISTR *dg =NULL; par = unur_dgt_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [12] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_dgt_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,2); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,0.1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); { UNUR_DISTR *dg =NULL; par = unur_dgt_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [13] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_dgt_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,2); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,0.1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); { UNUR_DISTR *dg =NULL; par = unur_dgt_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [14] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_dgt_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,2); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,0.1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); { UNUR_DISTR *dg =NULL; par = unur_dgt_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [15] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_dgt_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,2); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,0.1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); { UNUR_DISTR *dg =NULL; par = unur_dgt_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [21] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_dgt_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,2); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,0.1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); { UNUR_DISTR *dg =NULL; par = unur_dgt_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [16] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_dgt_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,2); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,0.1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); { UNUR_DISTR *dg =NULL; par = unur_dgt_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [17] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_dgt_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,2); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,0.1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); { UNUR_DISTR *dg =NULL; par = unur_dgt_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [18] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_dgt_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,2); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,0.1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); { UNUR_DISTR *dg =NULL; par = unur_dgt_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [19] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_dgt_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,2); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,0.1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); { UNUR_DISTR *dg =NULL; par = unur_dgt_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [20] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_dgt_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,2); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,0.1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); { UNUR_DISTR *dg =NULL; par = unur_dgt_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [22] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_dgt_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,2); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,0.1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); { UNUR_DISTR *dg =NULL; par = unur_dgt_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); { UNUR_DISTR *dg =NULL; par = unur_dgt_new(distr_localcopy); fpm[0] = 10.; fpm[1] = 0.63; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [23] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_dgt_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_variant(par,2); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_dgt_new(distr_localcopy); unur_dgt_set_guidefactor(par,0.1); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); { UNUR_DISTR *dg =NULL; par = unur_dgt_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); { UNUR_DISTR *dg =NULL; par = unur_dgt_new(distr_localcopy); fpm[0] = 10.; fpm[1] = 0.63; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); /* free distributions */ unur_distr_free(distr[0]); unur_distr_free(distr[1]); unur_distr_free(distr[2]); unur_distr_free(distr[3]); unur_distr_free(distr[4]); unur_distr_free(distr[5]); unur_distr_free(distr[6]); unur_distr_free(distr[7]); unur_distr_free(distr[8]); unur_distr_free(distr[9]); unur_distr_free(distr[10]); unur_distr_free(distr[11]); unur_distr_free(distr[12]); unur_distr_free(distr[13]); unur_distr_free(distr[14]); unur_distr_free(distr[15]); unur_distr_free(distr[16]); unur_distr_free(distr[17]); unur_distr_free(distr[18]); unur_distr_free(distr[19]); unur_distr_free(distr[20]); unur_distr_free(distr[21]); unur_distr_free(distr[22]); unur_distr_free(distr[23]); /* test finished */ test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; /* we accept CHI2_FAILURES_TOLERATED failures */ (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_validate */ /* enable GCC compiler warning */ GCC_DIAG_ON(unused-variable) /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_dgt_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_vempk.c0000644001357500135600000004503014430713513013013 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for VEMPK **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); int unur_vempk_set_verify( UNUR_PAR *par, int verify); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ #define COMPARE_SAMPLE_SIZE (10000) #define VIOLATE_SAMPLE_SIZE (20) /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,25,(unur_vempk_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,25,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,32,(unur_vempk_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,32,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* data missing in distribution object */ UNUR_DISTR *distr = NULL; distr = unur_distr_cvemp_new(2); unur_reset_errno(); /* data */ n_tests_failed += (check_expected_NULL(TESTLOG,40,(unur_vempk_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,40,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [set] */ void test_set (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[set "); fflush(stdout); fprintf(TESTLOG,"\n[set]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,51,(unur_vempk_set_smoothing( par, 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,51,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,54,(unur_vempk_set_varcor( par, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,54,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* invalid parameter object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = unur_distr_normal(NULL,0); par = unur_tdr_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,62,(unur_vempk_set_smoothing( par, 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,62,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,65,(unur_vempk_set_varcor( par, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,65,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_par_free (par); unur_distr_free(distr); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double data[] = {1.,1.,-1.,1.,1.,-1.,-1.,-1. }; distr = unur_distr_cvemp_new(2); unur_distr_cvemp_set_data(distr, data, 4); par = unur_vempk_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,76,(unur_vempk_set_smoothing( par, -1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,76,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_set() */ /*---------------------------------------------------------------------------*/ /* [chg] */ void test_chg (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[chg "); fflush(stdout); fprintf(TESTLOG,"\n[chg]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_GEN *gen = NULL; gen = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,93,(unur_vempk_chg_smoothing( gen, 1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,93,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,96,(unur_vempk_chg_varcor( gen, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,96,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_free(gen); } { /* invalid generator object */ UNUR_GEN *gen = NULL; gen = unur_str2gen("normal"); abort_if_NULL(TESTLOG, 99, gen ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,103,(unur_vempk_chg_smoothing( gen, 1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,103,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,106,(unur_vempk_chg_varcor( gen, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,106,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_free(gen); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double data[] = {1.,1.,-1.,1.,1.,-1.,-1.,-1. }; distr = unur_distr_cvemp_new(2); unur_distr_cvemp_set_data(distr, data, 4); par = unur_vempk_new(distr); gen = unur_init(par); abort_if_NULL(TESTLOG, 113, gen ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,117,(unur_vempk_chg_smoothing( gen, -1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,117,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_chg() */ /*---------------------------------------------------------------------------*/ /* [reinit] */ void test_reinit (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[reinit "); fflush(stdout); fprintf(TESTLOG,"\n[reinit]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* does not exist */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double x[2]; double data[] = {1.,1.,-1.,1.,1.,-1.,-1.,-1. }; distr = unur_distr_cvemp_new(2); unur_distr_cvemp_set_data(distr, data, 4); par = unur_vempk_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 133, gen ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,137,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,137,UNUR_ERR_NO_REINIT)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_sample_vec( gen, x ); n_tests_failed += (check_expected_INFINITY(TESTLOG,141,(x[0]))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,141,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_reinit() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* compare clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double data[] = {1.,1.,-1.,1.,1.,-1.,-1.,-1. }; UNUR_GEN *clone = NULL; distr = unur_distr_cvemp_new(2); unur_distr_cvemp_set_data(distr, data, 4); par = unur_vempk_new(distr); gen = unur_init(par); abort_if_NULL(TESTLOG, 153, gen ); unur_reset_errno(); /* default generator object */; n_tests_failed += (compare_sequence_gen_start(TESTLOG,157,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,163,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* set smoothing factor */ unur_free(gen); par = unur_vempk_new(distr); unur_vempk_set_smoothing( par, 3. ); gen = unur_init( par ); n_tests_failed += (compare_sequence_gen_start(TESTLOG,170,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,176,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* [validate] */ /*---------------------------------------------------------------------------*/ /* [validate] */ void test_validate (void) { /* suppress GCC compiler warning */ GCC_DIAG_OFF(unused-variable) UNUR_DISTR *distr[2]; UNUR_PAR *par; UNUR_GEN *gen; double *darray; double fpm[10]; int n_tests_failed; int rcode; /* start test */ printf("[validate "); fflush(stdout); fprintf(TESTLOG,"\n[validate]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* distributions: 2 */ { #define dim (2) { double *data; UNUR_DISTR *dist_mnormal; UNUR_GEN *gen_mnormal; int i; const int ss = 100000; data = malloc(dim*ss*sizeof(double)); dist_mnormal = unur_distr_multinormal(dim,NULL,NULL); gen_mnormal = unur_init(unur_mvstd_new(dist_mnormal)); for (i=0;isetup time = %.3f ms\n", stopwatch_lap(&watch)); printf("\n(chi^2) "); fflush(stdout); /* chi^2 tests: 4 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nChi^2 Test:\n"); /* distribution [0] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_vempk_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_vempk_new(distr_localcopy); unur_vempk_set_varcor(par,TRUE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_vempk_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_vempk_new(distr_localcopy); unur_vempk_set_varcor(par,TRUE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); /* free distributions */ unur_distr_free(distr[0]); unur_distr_free(distr[1]); /* test finished */ test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; /* we accept CHI2_FAILURES_TOLERATED failures */ (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_validate */ /* enable GCC compiler warning */ GCC_DIAG_ON(unused-variable) /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_vempk_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_unur_tests.conf0000644001357500135600000001426414420445767014630 00000000000000############################################################################# [main] [main - data:] # method (for information only: the program scans the file name) method: TEST [main - header:] /* prototypes */ double HR_increasing_gm31(double x, const UNUR_DISTR *distr); \#define COMPARE_SAMPLE_SIZE (500) \#define VIOLATE_SAMPLE_SIZE (20) /* we need marginal distributions for the chi2 tests */ \#define unur_distr_multinormal unur_distr_multinormal_w_marginals ############################################################################# [new] ############################################################################# # [set] ############################################################################# # [get] ############################################################################# # [chg] ############################################################################## # [init] ############################################################################# # [reinit] ############################################################################# [sample] [sample - run_tests for AUTO: distr = unur_distr_normal(NULL,0); par = NULL; ] par = unur_auto_new(distr); unur_run_tests(par,~0u,TESTLOG); -->none --> UNUR_SUCCESS [sample - run_tests for AUTO: double fpm[1] = {0.5}; distr = unur_distr_geometric(fpm,1); par = NULL; ] par = unur_auto_new(distr); unur_run_tests(par,~0u,TESTLOG); -->none --> UNUR_SUCCESS [sample - run_tests for AUTO: double data[] = {1.,2.,3.,4.,5.,6.,7.,8.,9.}; distr = unur_distr_cemp_new(); unur_distr_cemp_set_data(distr,data,9); par = NULL; ] par = unur_auto_new(distr); unur_run_tests(par,~0u,TESTLOG); -->none --> UNUR_SUCCESS [sample - run_tests for AUTO: const int dim = 3; double mean[] = {1.,2.,3.}; double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; distr = unur_distr_multinormal( dim, mean, covar ); par = NULL; ] par = unur_auto_new(distr); unur_run_tests(par,~0u,TESTLOG); -->none --> UNUR_SUCCESS ############################################################################# # [validate] ############################################################################# [special] [special - decl:] int samplesize = 10000; double fpm[10]; double Rsq, time_setup, time_marginal; UNUR_DISTR *distr; UNUR_PAR *par; UNUR_GEN *gen; [special - start:] /* unur_test_par_count_pdf() */ distr = unur_distr_normal(NULL,0); par = unur_tdr_new(distr); unur_tdr_set_usedars(par,0); unur_test_par_count_pdf(par,samplesize,1,TESTLOG); gen = unur_init(par); unur_test_count_pdf(gen,samplesize,1,TESTLOG); unur_free(gen); unur_distr_free(distr); distr = unur_distr_normal_wo_logpdf(NULL,0); par = unur_tdr_new(distr); unur_test_par_count_pdf(par,samplesize,1,TESTLOG); gen = unur_init(par); unur_test_count_pdf(gen,samplesize,1,TESTLOG); unur_free(gen); unur_distr_free(distr); distr = unur_distr_normal(NULL,0); par = unur_ninv_new(distr); unur_test_par_count_pdf(par,samplesize,1,TESTLOG); gen = unur_init(par); unur_test_count_pdf(gen,samplesize,1,TESTLOG); unur_free(gen); unur_distr_free(distr); distr = unur_distr_normal(NULL,0); par = unur_hinv_new(distr); unur_test_par_count_pdf(par,samplesize,1,TESTLOG); gen = unur_init(par); unur_test_count_pdf(gen,samplesize,1,TESTLOG); unur_free(gen); unur_distr_free(distr); distr = unur_distr_cont_new(); unur_distr_set_name(distr,"HR"); unur_distr_cont_set_hr(distr,HR_increasing_gm31); par = unur_hri_new(distr); unur_test_par_count_pdf(par,samplesize,1,TESTLOG); gen = unur_init(par); unur_test_count_pdf(gen,samplesize,1,TESTLOG); unur_free(gen); unur_distr_free(distr); fpm[0] = 0.5; distr = unur_distr_geometric(fpm,1); par = unur_dgt_new(distr); unur_test_par_count_pdf(par,samplesize,1,TESTLOG); gen = unur_init(par); unur_test_count_pdf(gen,samplesize,1,TESTLOG); unur_free(gen); unur_distr_free(distr); fpm[0] = 0.5; distr = unur_distr_geometric(fpm,1); par = unur_dari_new(distr); unur_test_par_count_pdf(par,samplesize,1,TESTLOG); gen = unur_init(par); unur_test_count_pdf(gen,samplesize,1,TESTLOG); unur_free(gen); unur_distr_free(distr); distr = unur_distr_multinormal(3,NULL,NULL); par = unur_vnrou_new(distr); unur_test_par_count_pdf(par,samplesize,1,TESTLOG); gen = unur_init(par); unur_test_count_pdf(gen,samplesize,1,TESTLOG); unur_free(gen); unur_distr_free(distr); distr = unur_distr_multinormal_wo_logpdf(3,NULL,NULL); par = unur_vnrou_new(distr); unur_test_par_count_pdf(par,samplesize,1,TESTLOG); gen = unur_init(par); unur_test_count_pdf(gen,samplesize,1,TESTLOG); unur_free(gen); unur_distr_free(distr); /* unur_test_count_urng() */ distr = unur_distr_normal(NULL,0); par = unur_tdr_new(distr); unur_tdr_set_usedars(par,0); gen = unur_init(par); unur_test_count_urn(gen,samplesize,1,TESTLOG); unur_free(gen); unur_distr_free(distr); /* test timing routines */ Rsq = unur_test_timing_R(NULL,NULL,NULL,5,&time_setup,&time_marginal); fprintf(TESTLOG,"\nR^2 = %g, setup time = %g, marginal generation time = %g\n", Rsq, time_setup, time_marginal); Rsq = unur_test_timing_R(NULL,"cont","pinv",5,&time_setup,&time_marginal); fprintf(TESTLOG,"\nR^2 = %g, setup time = %g, marginal generation time = %g\n", Rsq, time_setup, time_marginal); distr = unur_distr_normal(NULL,0); par = unur_tdr_new(distr); Rsq = unur_test_timing_R(par,NULL,NULL,5,&time_setup,&time_marginal); unur_distr_free(distr); fprintf(TESTLOG,"\nR^2 = %g, setup time = %g, marginal generation time = %g\n", Rsq, time_setup, time_marginal); Rsq = unur_test_timing_R(NULL,"normal","pinv",5,&time_setup,&time_marginal); fprintf(TESTLOG,"\nR^2 = %g, setup time = %g, marginal generation time = %g\n", Rsq, time_setup, time_marginal); /* test finished */ FAILED = 0; ############################################################################# [verbatim] double HR_increasing_gm31(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* example with increasing hazard rate: gamma (alpha=3,beta=1) */ { return (x*x)/(x*x+2.*x+2.); } ############################################################################# unuran-1.11.0/tests/t_distr_cvemp.c0000644001357500135600000002435714430713513014221 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for DISTR_CVEMP **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); int unur_distr_cvemp_set_verify( UNUR_PAR *par, int verify); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ #define COMPARE_SAMPLE_SIZE (500) #define VIOLATE_SAMPLE_SIZE (20) /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid data */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,25,(unur_distr_cvemp_new(1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,25,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [set] */ void test_set (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[set "); fflush(stdout); fprintf(TESTLOG,"\n[set]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,36,(unur_distr_cvemp_set_data( distr, NULL, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,36,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,39,(unur_distr_cvemp_read_data( distr, "junk" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,39,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,46,(unur_distr_cvemp_set_data( distr, NULL, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,46,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,49,(unur_distr_cvemp_read_data( distr, "junk" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,49,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = unur_distr_cvemp_new(2); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,56,(unur_distr_cvemp_set_data( distr, NULL, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,56,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; double data[] = {1.,2.,3.,4.}; distr = unur_distr_cvemp_new(2); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,64,(unur_distr_cvemp_set_data( distr, data, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,64,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,67,(unur_distr_cvemp_read_data( distr, "there-should-be-no-such-file.junk" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,67,UNUR_ERR_GENERIC)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_set() */ /*---------------------------------------------------------------------------*/ /* [get] */ void test_get (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[get "); fflush(stdout); fprintf(TESTLOG,"\n[get]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; const double *sample; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_zero(TESTLOG,79,(unur_distr_cvemp_get_data( distr, &sample )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,79,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; const double *sample; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_zero(TESTLOG,87,(unur_distr_cvemp_get_data( distr, &sample )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,87,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_get() */ /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_distr_cvemp_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_distr.c0000644001357500135600000002340014430713513013013 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for DISTR **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); int unur_distr_set_verify( UNUR_PAR *par, int verify); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ #define COMPARE_SAMPLE_SIZE (500) #define VIOLATE_SAMPLE_SIZE (20) /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [set] */ void test_set (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[set "); fflush(stdout); fprintf(TESTLOG,"\n[set]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,29,(unur_distr_set_name( distr, "nix" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,29,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,32,(unur_distr_set_extobj( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,32,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_set() */ /*---------------------------------------------------------------------------*/ /* [get] */ void test_get (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[get "); fflush(stdout); fprintf(TESTLOG,"\n[get]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,43,(unur_distr_get_name( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,43,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_zero(TESTLOG,46,((int) unur_distr_get_type( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,46,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_zero(TESTLOG,49,(unur_distr_get_dim( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,49,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_zero(TESTLOG,52,(unur_distr_is_cont( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,52,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_zero(TESTLOG,55,(unur_distr_is_cvec( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,55,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_zero(TESTLOG,58,(unur_distr_is_cemp( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,58,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_zero(TESTLOG,61,(unur_distr_is_cvemp( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,61,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_zero(TESTLOG,64,(unur_distr_is_matr( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,64,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_zero(TESTLOG,67,(unur_distr_is_discr( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,67,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,70,(unur_distr_get_extobj( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,70,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_get() */ /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_distr_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_arou.c0000644001357500135600000035273314430713513012652 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for AROU **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ double pdf( double x, const UNUR_DISTR *distr ); double pdf_bimodal( double x, const UNUR_DISTR *distr ); double dpdf_bimodal( double x, const UNUR_DISTR *distr ); double pdf_negative( double x, const UNUR_DISTR *distr ); double dpdf_negative( double x, const UNUR_DISTR *distr ); double pdf_partnegative( double x, const UNUR_DISTR *distr ); double dpdf_partnegative( double x, const UNUR_DISTR *distr ); double pdf_sqrtlin( double x, const UNUR_DISTR *distr ); double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ); double cdf_sqrtlin( double x, const UNUR_DISTR *distr ); double pdf_sqrtlinshft(double x, const UNUR_DISTR *distr ); double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); #define COMPARE_SAMPLE_SIZE (10000) #define VIOLATE_SAMPLE_SIZE (20) /* #define SEED (298346) */ /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ /* pdf of bimodal density */ double pdf_bimodal( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return ( exp(-(x-1.)*(x-1.)) + exp(-(x+1.)*(x+1.)) ); } double dpdf_bimodal( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return ( -2. * (x-1.) * exp(-(x-1.)*(x-1.)) -2. * (x+1.) * exp(-(x+1.)*(x+1.)) ); } /* pdf with negative value */ double pdf_negative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return (-x*x); } double dpdf_negative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return (-2.*x); } /* pdf with partial negative value */ double pdf_partnegative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return ((x>-0.89 && x<0.89) ? -1.: exp(-x*x)); } double dpdf_partnegative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return ((x>-0.89 && x<0.89) ?0.: -2.*x*exp(-x*x)); } /* pdf of normal density */ double pdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return exp(-x*x/2.); } /* end of pdf */ /* pdf with piecewise linear function as transformed density with T = -1/sqrt */ double pdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y = 1./(fabs(x)+1.); return y*y; } double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y = 1./(fabs(x)+1.); y = 2.*y*y*y; return ((x<0.) ? y : - y); } double cdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { if (x<=0.) return 0.5/(1.-x); else return (1.-0.5/(1.+x)); } /* pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode */ double pdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y; x -= 1.; y = 1./(fabs(x)+1.); return y*y; } double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y; x -= 1.; y = 1./(fabs(x)+1.); y = 2.*y*y*y; return ((x<0.) ? y : - y); } double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { x -= 1.; if (x<=0.) return 0.5/(1.-x); else return (1.-0.5/(1.+x)); } /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,45,(unur_arou_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,45,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,51,(unur_arou_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,51,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* data missing in distribution object */ UNUR_DISTR *distr = NULL; distr = unur_distr_cont_new(); unur_reset_errno(); /* pdf, dpdf */ n_tests_failed += (check_expected_NULL(TESTLOG,58,(unur_arou_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,58,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* dpdf */ unur_distr_cont_set_pdf(distr,pdf); n_tests_failed += (check_expected_NULL(TESTLOG,63,(unur_arou_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,63,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [set] */ void test_set (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[set "); fflush(stdout); fprintf(TESTLOG,"\n[set]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,73,(unur_arou_set_usedars( par, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,73,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,76,(unur_arou_set_darsfactor( par, 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,76,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,79,(unur_arou_set_cpoints( par, 0, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,79,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,82,(unur_arou_set_guidefactor( par, 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,82,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,85,(unur_arou_set_max_sqhratio( par, 0.95 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,85,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,88,(unur_arou_set_max_segments( par, 100 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,88,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,91,(unur_arou_set_usecenter( par, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,91,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,94,(unur_arou_set_verify( par, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,94,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,97,(unur_arou_set_pedantic( par, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,97,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* invalid parameter object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_tdr_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,106,(unur_arou_set_usedars( par, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,106,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,109,(unur_arou_set_darsfactor( par, 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,109,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,112,(unur_arou_set_cpoints( par, 0, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,112,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,115,(unur_arou_set_guidefactor( par, 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,115,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,118,(unur_arou_set_max_sqhratio( par, 0.95 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,118,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,121,(unur_arou_set_max_segments( par, 100 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,121,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,124,(unur_arou_set_usecenter( par, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,124,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,127,(unur_arou_set_verify( par, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,127,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,130,(unur_arou_set_pedantic( par, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,130,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double stp[] = {1.,0.,1.}; int n_stp = 3; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_arou_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,143,(unur_arou_set_darsfactor( par, -1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,143,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,146,(unur_arou_set_cpoints( par, -1, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,146,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,149,(unur_arou_set_cpoints( par, n_stp, stp )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,149,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,152,(unur_arou_set_guidefactor( par, -1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,152,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,155,(unur_arou_set_max_sqhratio( par, -1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,155,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,158,(unur_arou_set_max_sqhratio( par, 2. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,158,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,161,(unur_arou_set_max_segments( par, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,161,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_set() */ /*---------------------------------------------------------------------------*/ /* [get] */ void test_get (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[get "); fflush(stdout); fprintf(TESTLOG,"\n[get]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid generator object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_tdr_new(distr); gen = unur_init(par); abort_if_NULL(TESTLOG, 171, gen ); unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,175,(unur_arou_get_sqhratio(gen)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,175,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,178,(unur_arou_get_hatarea(gen)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,178,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,181,(unur_arou_get_squeezearea(gen)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,181,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_get() */ /*---------------------------------------------------------------------------*/ /* [chg] */ void test_chg (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[chg "); fflush(stdout); fprintf(TESTLOG,"\n[chg]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid generator object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_srou_new(distr); unur_set_debug(par,0); gen = unur_init( par ); abort_if_NULL(TESTLOG, 191, gen ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,195,(unur_arou_chg_verify(gen,1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,195,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_chg() */ /*---------------------------------------------------------------------------*/ /* [init] */ void test_init (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[init "); fflush(stdout); fprintf(TESTLOG,"\n[init]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,206,(unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,206,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* stp out of domain */ UNUR_GEN *gen = NULL; UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double stp[] = {-2.5,-1.,0.,1.,2.5}; int n_stp = 5; gen = NULL; distr = unur_distr_normal(NULL,0); unur_distr_cont_set_domain(distr,-2.,2.); par = unur_arou_new(distr); unur_arou_set_cpoints( par, n_stp, stp ); unur_reset_errno(); gen = unur_init( par ); n_tests_failed += (check_errorcode(TESTLOG,218,UNUR_ERR_GEN_DATA)==UNUR_SUCCESS)?0:1; unur_free(gen); unur_distr_free(distr); } { /* bimodal */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr,pdf_bimodal); unur_distr_cont_set_dpdf(distr,dpdf_bimodal); par = unur_arou_new(distr); unur_arou_set_cpoints( par, 30, NULL ); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,228,(unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,228,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* negative value of pdf */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr,pdf_negative); unur_distr_cont_set_dpdf(distr,dpdf_negative); par = NULL; unur_reset_errno(); par = unur_arou_new(distr); unur_arou_set_cpoints( par, 30, NULL ); n_tests_failed += (check_expected_NULL(TESTLOG,239,(unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,239,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_distr_cont_set_domain(distr,-2.,2.); par = unur_arou_new(distr); unur_arou_set_cpoints( par, 30, NULL ); n_tests_failed += (check_expected_NULL(TESTLOG,245,(unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,245,UNUR_ERR_GEN_DATA)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_init() */ /*---------------------------------------------------------------------------*/ /* [reinit] */ void test_reinit (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[reinit "); fflush(stdout); fprintf(TESTLOG,"\n[reinit]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* does not exist */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 253, gen ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,257,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,257,UNUR_ERR_NO_REINIT)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,260,(unur_sample_cont( gen )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,260,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_reinit() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* partial negative value of pdf */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; int i; double x; double stp[] = {-0.9,0.9}; int n_stp = 2; distr = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr,pdf_partnegative); unur_distr_cont_set_dpdf(distr,dpdf_partnegative); par = unur_arou_new(distr); unur_arou_set_usedars(par,FALSE); unur_arou_set_cpoints( par, n_stp, stp ); unur_arou_set_pedantic( par, 1 ); gen = unur_init( par ); abort_if_NULL(TESTLOG, 278, gen ); unur_reset_errno(); for (i=0; i<100; i++) { x = unur_sample_cont(gen); } n_tests_failed += (check_expected_INFINITY(TESTLOG,283,(x))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,283,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; UNUR_GEN *clone; distr = unur_distr_normal(NULL,0); par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_arou_new(distr); unur_arou_set_max_sqhratio(par,0.); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,297,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,303,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare stringparser */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[10]; distr = NULL; par = NULL; gen = NULL; unur_reset_errno(); distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,333,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "normal & method = arou" ); n_tests_failed += (compare_sequence_gen(TESTLOG,338,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; gen = unur_str2gen( "normal() & method = arou" ); n_tests_failed += (compare_sequence_gen(TESTLOG,342,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; gen = unur_str2gen( "normal(0.,1.) & method = arou" ); n_tests_failed += (compare_sequence_gen(TESTLOG,346,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; gen = unur_str2gen( "normal(0,1) & method = arou" ); n_tests_failed += (compare_sequence_gen(TESTLOG,350,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; gen = unur_str2gen( "distr = normal(0,1) & method = arou" ); n_tests_failed += (compare_sequence_gen(TESTLOG,354,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; fpar[0] = 1.; fpar[1] = 2.; distr = unur_distr_normal(fpar,2); par = unur_arou_new(distr); unur_arou_set_usedars(par,1); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,363,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "normal(1,2) & method = arou; usedars" ); n_tests_failed += (compare_sequence_gen(TESTLOG,368,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; fpar[0] = 1.; fpar[1] = 2.; distr = unur_distr_normal(fpar,2); par = unur_arou_new(distr); unur_arou_set_usedars(par,1); unur_arou_set_darsfactor(par,0.1); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,378,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "normal(1,2) & method = arou; usedars; darsfactor=0.1" ); n_tests_failed += (compare_sequence_gen(TESTLOG,383,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; fpar[0] = 1.; fpar[1] = 2.; distr = unur_distr_normal(fpar,2); unur_distr_cont_set_domain(distr,0.,2.); par = unur_arou_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,392,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "normal(1,2); domain = 0, 2 & method = arou" ); n_tests_failed += (compare_sequence_gen(TESTLOG,397,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; gen = unur_str2gen( "normal(1,2); domain = (0,2) & method = arou" ); n_tests_failed += (compare_sequence_gen(TESTLOG,401,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); fpar[0] = -2; fpar[1] = -1.5; fpar[2] = -1; fpar[3] = -0.5; fpar[4] = 0; fpar[5] = 0.5; fpar[6] = 1; fpar[7] = 1.5; fpar[8] = 2; unur_arou_set_cpoints(par,9,fpar); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,417,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "normal() & \ method = arou; cpoints = (-2,-1.5,-1,-0.5,0,0.5,1,1.5,2)" ); n_tests_failed += (compare_sequence_gen(TESTLOG,423,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; distr = unur_distr_normal(NULL,0); unur_distr_cont_set_center(distr,0.); par = unur_arou_new(distr); unur_arou_set_cpoints(par,20,NULL); unur_arou_set_guidefactor(par,1.); unur_arou_set_max_segments(par,40); unur_arou_set_max_sqhratio(par,0.5); unur_arou_set_pedantic(par,FALSE); unur_arou_set_usecenter(par,TRUE); unur_arou_set_verify(par,TRUE); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,437,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "normal(); center=0. & \ method = arou; \ cpoints = 20; guidefactor = 1.; max_segments = 40; \ max_sqhratio = 0.5; pedantic = off; usecenter = true; verify = on" ); n_tests_failed += (compare_sequence_gen(TESTLOG,445,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* [validate] */ /*---------------------------------------------------------------------------*/ /* [validate] */ void test_validate (void) { /* suppress GCC compiler warning */ GCC_DIAG_OFF(unused-variable) UNUR_DISTR *distr[33]; UNUR_PAR *par; UNUR_GEN *gen; double *darray; double fpm[10]; int n_tests_failed; int rcode; /* start test */ printf("[validate "); fflush(stdout); fprintf(TESTLOG,"\n[validate]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* distributions: 33 */ { fpm[0] = 1.; fpm[1] = 2.; distr[0] = unur_distr_beta(fpm,2); } { fpm[0] = 2.; fpm[1] = 1.; distr[32] = unur_distr_beta(fpm,2); } { fpm[0] = 1.; fpm[1] = 5.; distr[1] = unur_distr_beta(fpm,2); } { fpm[0] = 1.; fpm[1] = 100.; distr[2] = unur_distr_beta(fpm,2); } { fpm[0] = 2.; fpm[1] = 5.; distr[30] = unur_distr_beta(fpm,2); } { fpm[0] = 5.; fpm[1] = 2.; distr[31] = unur_distr_beta(fpm,2); } { fpm[0] = 3.; fpm[1] = 4.; distr[3] = unur_distr_beta(fpm,2); } { fpm[0] = 5.; fpm[1] = 100.; distr[4] = unur_distr_beta(fpm,2); } { fpm[0] = 500.; fpm[1] = 300.; distr[5] = unur_distr_beta(fpm,2); } { fpm[0] = 5.; fpm[1] = 10.; fpm[2] = -3.; fpm[3] = 15.; distr[6] = unur_distr_beta(fpm,4); } { distr[7] = unur_distr_cauchy(NULL,0); } { fpm[0] = 1.; fpm[1] = 20.; distr[8] = unur_distr_cauchy(fpm,2); } { distr[24] = unur_distr_exponential(NULL,0); } { fpm[0] = 30.; fpm[1] = -5.; distr[25] = unur_distr_exponential(fpm,2); } { fpm[0] = 1.; distr[9] = unur_distr_gamma(fpm,1); } { fpm[0] = 2.; distr[10] = unur_distr_gamma(fpm,1); } { fpm[0] = 3.; distr[11] = unur_distr_gamma(fpm,1); } { fpm[0] = 10.; distr[12] = unur_distr_gamma(fpm,1); } { fpm[0] = 1000.; distr[13] = unur_distr_gamma(fpm,1); } { fpm[0] = 5.; fpm[1] = 1000.; distr[14] = unur_distr_gamma(fpm,2); } { fpm[0] = 5.; fpm[1] = 1.e-5; distr[15] = unur_distr_gamma(fpm,2); } { fpm[0] = 5.; fpm[1] = 10.; fpm[2] = 1000; distr[16] = unur_distr_gamma(fpm,3); } { distr[26] = unur_distr_laplace(NULL,0); } { fpm[0] = -10.; fpm[1] = 100.; distr[27] = unur_distr_laplace(fpm,2); } { distr[17] = unur_distr_normal(NULL,0); } { fpm[0] = 1.; fpm[1] = 1.e-5; distr[18] = unur_distr_normal(fpm,2); } { fpm[0] = 0.; fpm[1] = 1.e+5; distr[19] = unur_distr_normal(fpm,2); } { distr[20] = unur_distr_uniform(NULL,0); } { fpm[0] = 1.; fpm[1] = 20.; distr[21] = unur_distr_uniform(fpm,2); } { distr[28] = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr[28],pdf_sqrtlin); unur_distr_cont_set_dpdf(distr[28],dpdf_sqrtlin); unur_distr_cont_set_cdf(distr[28],cdf_sqrtlin); unur_distr_set_name(distr[28],"sqrtlin"); } { distr[29] = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr[29],pdf_sqrtlinshft); unur_distr_cont_set_dpdf(distr[29],dpdf_sqrtlinshft); unur_distr_cont_set_cdf(distr[29],cdf_sqrtlinshft); unur_distr_set_name(distr[29],"sqrtlin"); } { distr[22] = unur_distr_cauchy(NULL,0); unur_distr_cont_set_domain(distr[22],0.1,1.); unur_distr_cont_upd_mode(distr[22]); unur_distr_cont_upd_pdfarea(distr[22]); } { fpm[0] = 3.; fpm[1] = 4.; distr[23] = unur_distr_beta(fpm,2); unur_distr_cont_set_domain(distr[23],-2.,5.); } /* timing */ stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); printf("\n(chi^2) "); fflush(stdout); /* chi^2 tests: 99 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nChi^2 Test:\n"); /* distribution [0] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_arou_new(distr_localcopy); unur_arou_set_usedars(par,0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [32] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_arou_new(distr_localcopy); unur_arou_set_usedars(par,0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_arou_new(distr_localcopy); unur_arou_set_usedars(par,0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [2] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_arou_new(distr_localcopy); unur_arou_set_usedars(par,0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [30] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_arou_new(distr_localcopy); unur_arou_set_usedars(par,0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [31] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_arou_new(distr_localcopy); unur_arou_set_usedars(par,0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [3] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_arou_new(distr_localcopy); unur_arou_set_usedars(par,0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [4] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_arou_new(distr_localcopy); unur_arou_set_usedars(par,0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [5] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_arou_new(distr_localcopy); unur_arou_set_usedars(par,0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [6] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_arou_new(distr_localcopy); unur_arou_set_usedars(par,0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [24] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_arou_new(distr_localcopy); unur_arou_set_usedars(par,0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [25] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_arou_new(distr_localcopy); unur_arou_set_usedars(par,0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [7] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_arou_new(distr_localcopy); unur_arou_set_usedars(par,0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [8] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_arou_new(distr_localcopy); unur_arou_set_usedars(par,0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [9] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_arou_new(distr_localcopy); unur_arou_set_usedars(par,0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [10] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_arou_new(distr_localcopy); unur_arou_set_usedars(par,0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [11] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_arou_new(distr_localcopy); unur_arou_set_usedars(par,0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [12] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_arou_new(distr_localcopy); unur_arou_set_usedars(par,0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [13] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_arou_new(distr_localcopy); unur_arou_set_usedars(par,0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [14] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_arou_new(distr_localcopy); unur_arou_set_usedars(par,0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [15] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_arou_new(distr_localcopy); unur_arou_set_usedars(par,0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [16] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_arou_new(distr_localcopy); unur_arou_set_usedars(par,0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [26] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_arou_new(distr_localcopy); unur_arou_set_usedars(par,0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [27] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_arou_new(distr_localcopy); unur_arou_set_usedars(par,0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [17] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_arou_new(distr_localcopy); unur_arou_set_usedars(par,0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [18] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_arou_new(distr_localcopy); unur_arou_set_usedars(par,0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [19] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_arou_new(distr_localcopy); unur_arou_set_usedars(par,0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [20] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_arou_new(distr_localcopy); unur_arou_set_usedars(par,0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [21] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_arou_new(distr_localcopy); unur_arou_set_usedars(par,0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [22] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_arou_new(distr_localcopy); unur_arou_set_usedars(par,0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [23] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_arou_new(distr_localcopy); unur_arou_set_usedars(par,0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); printf("\n(verify hat) "); fflush(stdout); /* verify hat tests: 99 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nVerify Hat Test (squeeze <= PDF <= hat):\n"); /* distribution [0] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_usedars(par,0); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [32] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_usedars(par,0); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[32],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[32],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[32],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_usedars(par,0); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [2] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_usedars(par,0); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [30] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_usedars(par,0); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [31] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_usedars(par,0); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [3] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_usedars(par,0); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [4] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_usedars(par,0); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [5] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_usedars(par,0); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [6] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_usedars(par,0); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [24] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_usedars(par,0); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [25] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_usedars(par,0); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [7] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_usedars(par,0); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [8] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_usedars(par,0); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [9] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_usedars(par,0); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [10] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_usedars(par,0); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [11] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_usedars(par,0); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [12] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_usedars(par,0); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [13] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_usedars(par,0); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [14] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_usedars(par,0); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [15] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_usedars(par,0); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [16] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_usedars(par,0); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [26] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_usedars(par,0); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [27] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_usedars(par,0); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [17] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_usedars(par,0); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [18] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_usedars(par,0); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [19] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_usedars(par,0); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [20] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_usedars(par,0); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [21] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_usedars(par,0); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [22] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_usedars(par,0); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [23] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_usedars(par,0); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_arou_new(distr_localcopy); unur_arou_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); gen = unur_init(par); if (gen) unur_arou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); /* free distributions */ unur_distr_free(distr[0]); unur_distr_free(distr[1]); unur_distr_free(distr[2]); unur_distr_free(distr[3]); unur_distr_free(distr[4]); unur_distr_free(distr[5]); unur_distr_free(distr[6]); unur_distr_free(distr[7]); unur_distr_free(distr[8]); unur_distr_free(distr[9]); unur_distr_free(distr[10]); unur_distr_free(distr[11]); unur_distr_free(distr[12]); unur_distr_free(distr[13]); unur_distr_free(distr[14]); unur_distr_free(distr[15]); unur_distr_free(distr[16]); unur_distr_free(distr[17]); unur_distr_free(distr[18]); unur_distr_free(distr[19]); unur_distr_free(distr[20]); unur_distr_free(distr[21]); unur_distr_free(distr[22]); unur_distr_free(distr[23]); unur_distr_free(distr[24]); unur_distr_free(distr[25]); unur_distr_free(distr[26]); unur_distr_free(distr[27]); unur_distr_free(distr[28]); unur_distr_free(distr[29]); unur_distr_free(distr[30]); unur_distr_free(distr[31]); unur_distr_free(distr[32]); /* test finished */ test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; /* we accept CHI2_FAILURES_TOLERATED failures */ (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_validate */ /* enable GCC compiler warning */ GCC_DIAG_ON(unused-variable) /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_arou_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_srou.conf0000644001357500135600000005556614420445767013417 00000000000000############################################################################# [main] [main - data:] # method (for information only: the program scans the file name) method: SROU [main - header:] /* prototypes */ double pdf_normal( double x, const UNUR_DISTR *distr ); double pdf_invalid( double x, const UNUR_DISTR *distr ); double pdf_sqrtlin( double x, const UNUR_DISTR *distr ); double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ); double cdf_sqrtlin( double x, const UNUR_DISTR *distr ); double pdf_sqrtlinshft(double x, const UNUR_DISTR *distr ); double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); int unur_srou_set_pedantic( struct unur_par *par, int pedantic ); \#define COMPARE_SAMPLE_SIZE (10000) \#define VIOLATE_SAMPLE_SIZE (20) /* \#define SEED (3984364) */ ############################################################################# [new] [new - invalid NULL ptr: distr = NULL; ] ~( distr ); --> expected_NULL --> UNUR_ERR_NULL [new - invalid distribution type: distr = unur_distr_discr_new(); ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID [new - data missing in distribution object: distr = unur_distr_cont_new(); ] /* pdf, mode, pdfarea */ ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED ############################################################################# [set] [set - invalid NULL ptr: par = NULL; ] ~_r(par,2.); --> expected_setfailed --> UNUR_ERR_NULL ~_cdfatmode(par,0.); --> expected_setfailed --> UNUR_ERR_NULL ~_pdfatmode(par,1.); --> expected_setfailed --> UNUR_ERR_NULL ~_verify(par,1); --> expected_setfailed --> UNUR_ERR_NULL ~_usesqueeze(par,1); --> expected_setfailed --> UNUR_ERR_NULL ~_usemirror(par,1); --> expected_setfailed --> UNUR_ERR_NULL [set - invalid parameter object: double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_arou_new(distr); ] ~_r(par,2.); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_cdfatmode(par,0.); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_pdfatmode(par,1.); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_verify(par,1); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_usesqueeze(par,1); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_usemirror(par,1); --> expected_setfailed --> UNUR_ERR_PAR_INVALID unur_par_free(par); [set - invalid parameters: double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_srou_new(distr); ] ~_r(par,0.); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_cdfatmode(par,-1.); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_pdfatmode(par,-1.); --> expected_setfailed --> UNUR_ERR_PAR_SET unur_par_free(par); ############################################################################# # [get] ############################################################################# [chg] [chg - invalid generator object: double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_arou_new(distr); unur_set_debug(par,0); gen = unur_init( par ); <-- ! NULL ] ~_verify(gen,1); --> expected_setfailed --> UNUR_ERR_GEN_INVALID ~_cdfatmode(gen,1.); --> expected_setfailed --> UNUR_ERR_GEN_INVALID ~_pdfatmode(gen,1.); --> expected_setfailed --> UNUR_ERR_GEN_INVALID [chg - invalid parameters: double fpar[2] = {2.,5.}; distr = unur_distr_gamma(fpar,2); par = unur_srou_new(distr); gen = unur_init( par ); <-- ! NULL ] ~_cdfatmode(gen,-1.); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_pdfatmode(gen,-1.); --> expected_setfailed --> UNUR_ERR_PAR_SET ############################################################################# [init] [init - invalid NULL ptr: par = NULL; ] unur_init( par ); --> expected_NULL --> UNUR_ERR_NULL [init - invalid data: distr = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr,pdf_invalid); unur_distr_cont_set_mode(distr,0.); unur_distr_cont_set_pdfarea(distr,1.); par = unur_srou_new(distr); ] unur_init( par ); --> expected_NULL --> UNUR_ERR_GEN_DATA [init - invalid data: distr = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr,pdf_invalid); unur_distr_cont_set_mode(distr,0.); unur_distr_cont_set_pdfarea(distr,1.); par = unur_srou_new(distr); unur_srou_set_r(par,2.); ] unur_init( par ); --> expected_NULL --> UNUR_ERR_GEN_DATA [init - data missing in distribution object: distr = unur_distr_cont_new(); par = NULL; ] /* mode, pdfarea */ unur_distr_cont_set_pdf(distr,pdf_normal); par = unur_srou_new( distr ); unur_init(par); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED /* pdfarea */ unur_distr_cont_set_mode(distr,1.); par = unur_srou_new( distr ); unur_init(par); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED ############################################################################# [reinit] [reinit - exist: distr = unur_distr_normal(NULL,0); par = unur_srou_new(distr); gen = unur_init( par ); <-- ! NULL ] unur_reinit( gen ); --> expected_reinit [reinit - exist: distr = unur_distr_normal(NULL,0); par = unur_srou_new(distr); unur_srou_set_r(par,2.); gen = unur_init( par ); <-- ! NULL ] unur_reinit( gen ); --> expected_reinit ############################################################################# [sample] [sample - compare: double fpar[2] = {1.,2.}; distr = unur_distr_normal(fpar,0); par = NULL; ] /* default algorithm */ par = unur_srou_new(distr); -->compare_sequence_par_start /* default algorithm - verifying mode */ par = unur_srou_new(distr); unur_srou_set_verify(par,1); -->compare_sequence_par /* generalized algorithm, r=2 */ par = unur_srou_new(distr); unur_srou_set_r(par,2.); -->compare_sequence_par_start /* generalized algorithm, r=2 - verifying mode */ par = unur_srou_new(distr); unur_srou_set_r(par,2.); unur_srou_set_verify(par,1); -->compare_sequence_par #..................................................................... [sample - compare: double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = NULL; ] /* use cdf at mode */ par = unur_srou_new(distr); unur_srou_set_cdfatmode(par,0.5); -->compare_sequence_par_start /* use cdf at mode and squeeze */ par = unur_srou_new(distr); unur_srou_set_cdfatmode(par,0.5); unur_srou_set_usesqueeze(par,1); -->compare_sequence_par /* use cdf at mode - verifying mode */ par = unur_srou_new(distr); unur_srou_set_cdfatmode(par,0.5); unur_srou_set_verify(par,1); --> compare_sequence_par /* use cdf at mode and squeeze - verifying mode */ par = unur_srou_new(distr); unur_srou_set_cdfatmode(par,0.5); unur_srou_set_usesqueeze(par,1); unur_srou_set_verify(par,1); --> compare_sequence_par #..................................................................... [sample - compare: double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = NULL; ] /* use mirror principle */ par = unur_srou_new(distr); unur_srou_set_usemirror(par,1); -->compare_sequence_par_start /* use mirror principle - verifying mode */ par = unur_srou_new(distr); unur_srou_set_usemirror(par,1); unur_srou_set_verify(par,1); --> compare_sequence_par #..................................................................... [sample - violate condition: double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = NULL; ] /* pdf at mode is too small: hat < pdf near mode */ /* default algorithm */ par = unur_srou_new(distr); unur_srou_set_pdfatmode(par,0.1); --> run_verify_generator --> UNUR_ERR_GEN_CONDITION /* use cdf at mode and squeeze */ par = unur_srou_new(distr); unur_srou_set_pdfatmode(par,0.1); unur_srou_set_cdfatmode(par,0.5); unur_srou_set_usesqueeze(par,1); --> run_verify_generator --> UNUR_ERR_GEN_CONDITION /* pdf at mode is too large: squeeze > pdf near mode */ /* use cdf at mode and squeeze */ unur_distr_cont_set_pdfarea(distr,10.); par = unur_srou_new(distr); unur_srou_set_cdfatmode(par,0.5); unur_srou_set_pdfatmode(par,10.); unur_srou_set_usesqueeze(par,1); --> run_verify_generator --> UNUR_ERR_GEN_CONDITION #..................................................................... [sample - compare clone: UNUR_GEN *clone; distr = unur_distr_normal(NULL,0); par = NULL; gen = NULL; ] /* original generator object */ par = unur_srou_new(distr); gen = unur_init(par); -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen #..................................................................... [sample - compare reinit: distr = unur_distr_normal(NULL,0); par = NULL; gen = NULL; ] /* original generator object */ par = unur_srou_new(distr); gen = unur_init(par); -->compare_sequence_gen_start /* reinit */ unur_reinit(gen); -->compare_sequence_gen [sample - compare reinit: distr = unur_distr_normal(NULL,0); par = NULL; gen = NULL; ] /* original generator object */ par = unur_srou_new(distr); unur_srou_set_r(par,2.); gen = unur_init(par); -->compare_sequence_gen_start /* reinit */ unur_reinit(gen); -->compare_sequence_gen #..................................................................... [sample - compare stringparser: double fpar[2] = {3.,3.}; distr = NULL; par = NULL; gen = NULL; ] distr = unur_distr_beta(fpar,2); unur_distr_cont_set_pdfarea(distr,2.); par = unur_srou_new(distr); unur_srou_set_cdfatmode(par,0.5); unur_srou_set_pdfatmode(par,1.9); unur_srou_set_usemirror(par,TRUE); unur_srou_set_usesqueeze(par,FALSE); unur_srou_set_verify(par,TRUE); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "beta(3.,3.); pdfarea = 2. & \ method = srou; cdfatmode = 0.5; usemirror; usesqueeze = off; pdfatmode = 1.9; verify" ); -->compare_sequence_gen unur_free(gen); gen = NULL; distr = unur_distr_beta(fpar,2); unur_distr_cont_set_pdfarea(distr,2.); par = unur_srou_new(distr); unur_srou_set_r(par,3.); unur_srou_set_cdfatmode(par,0.5); unur_srou_set_pdfatmode(par,1.9); unur_srou_set_verify(par,TRUE); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "beta(3.,3.); pdfarea = 2. & \ method = srou; r=3; cdfatmode = 0.5; pdfatmode = 1.9; verify" ); -->compare_sequence_gen ############################################################################# [validate] [validate - generators:] # default variant par[0] = unur_srou_new(@distr@); # use mirror principle par[1] = unur_srou_new(@distr@); unur_srou_set_usemirror(par,1); # use cdf at mode and squeeze # IMPORTANT: This method does not work properly for truncated standard distributions, # since unur_distr_cont_eval_cdf() returns the CDF of the untruncated distribution! { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(@distr@), @distr@ ); par[2] = unur_srou_new(@distr@); unur_srou_set_cdfatmode(par,cdfatmode); unur_srou_set_usesqueeze(par,1); } # default variant but reinitialized with changed domain {UNUR_DISTR *dg =NULL; par[3] = unur_srou_new(@distr@); dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } # default variant but reinitialized with changed pdf parameters {UNUR_DISTR *dg =NULL; par[4] = unur_srou_new(@distr@); fpm[0] = 2.; fpm[1] = 4.; dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } # generalized SROU # r = 1.001 par[10] = unur_srou_new(@distr@); unur_srou_set_r(par,1.001); # r = 2 par[11] = unur_srou_new(@distr@); unur_srou_set_r(par,2.); # r = 10 par[12] = unur_srou_new(@distr@); unur_srou_set_r(par,10.); # r = 2, use cdf at mode # IMPORTANT: This method does not work properly for truncated standard distributions, # since unur_distr_cont_eval_cdf() returns the CDF of the untruncated distribution! { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(@distr@), @distr@ ); par[13] = unur_srou_new(@distr@); unur_srou_set_r(par,2.); unur_srou_set_cdfatmode(par,cdfatmode); } # r = 2, reinitialized with changed domain {UNUR_DISTR *dg =NULL; par[14] = unur_srou_new(@distr@); unur_srou_set_r(par,2.); dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.95); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } # r = 2, reinitialized with changed pdf parameters {UNUR_DISTR *dg =NULL; par[15] = unur_srou_new(@distr@); unur_srou_set_r(par,2.); fpm[0] = 2.; fpm[1] = 4.; dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } [validate - distributions:] # Beta distributions fpm[0] = 1.; fpm[1] = 2.; distr[0] = unur_distr_beta(fpm,2); fpm[0] = 1.; fpm[1] = 5.; distr[1] = unur_distr_beta(fpm,2); fpm[0] = 1.; fpm[1] = 100.; distr[2] = unur_distr_beta(fpm,2); fpm[0] = 3.; fpm[1] = 4.; distr[3] = unur_distr_beta(fpm,2); fpm[0] = 5.; fpm[1] = 100.; distr[4] = unur_distr_beta(fpm,2); fpm[0] = 500.; fpm[1] = 300.; distr[5] = unur_distr_beta(fpm,2); fpm[0] = 5.; fpm[1] = 10.; fpm[2] = -3.; fpm[3] = 15.; distr[6] = unur_distr_beta(fpm,4); # Cauchy distributions distr[7] = unur_distr_cauchy(NULL,0); fpm[0] = 1.; fpm[1] = 20.; distr[8] = unur_distr_cauchy(fpm,2); # Exponential distributions distr[23] = unur_distr_exponential(NULL,0); fpm[0] = 30.; fpm[1] = -5.; distr[24] = unur_distr_exponential(fpm,2); # Gamma distributions fpm[0] = 1.; distr[9] = unur_distr_gamma(fpm,1); fpm[0] = 2.; distr[10] = unur_distr_gamma(fpm,1); fpm[0] = 3.; distr[11] = unur_distr_gamma(fpm,1); fpm[0] = 10.; distr[12] = unur_distr_gamma(fpm,1); fpm[0] = 1000.; distr[13] = unur_distr_gamma(fpm,1); fpm[0] = 1.; fpm[1] = 4.; distr[29] = unur_distr_gamma(fpm,2); fpm[0] = 5.; fpm[1] = 1000.; distr[14] = unur_distr_gamma(fpm,2); fpm[0] = 5.; fpm[1] = 1.e-5; distr[15] = unur_distr_gamma(fpm,2); fpm[0] = 5.; fpm[1] = 10.; fpm[2] = 1000; distr[16] = unur_distr_gamma(fpm,3); fpm[0] = 0.5; distr[30] = unur_distr_gamma(fpm,1); # Laplace distributions distr[25] = unur_distr_laplace(NULL,0); fpm[0] = -10.; fpm[1] = 100.; distr[26] = unur_distr_laplace(fpm,2); # Normal distributions distr[17] = unur_distr_normal(NULL,0); fpm[0] = 1.; fpm[1] = 1.e-5; distr[18] = unur_distr_normal(fpm,2); fpm[0] = 0.; fpm[1] = 1.e+5; distr[19] = unur_distr_normal(fpm,2); # Uniform distributions distr[20] = unur_distr_uniform(NULL,0); fpm[0] = 1.; fpm[1] = 20.; distr[21] = unur_distr_uniform(fpm,2); # pdf with piecewise linear function as transformed density with T = -1/sqrt distr[27] = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr[27],pdf_sqrtlin); unur_distr_cont_set_dpdf(distr[27],dpdf_sqrtlin); unur_distr_cont_set_cdf(distr[27],cdf_sqrtlin); unur_distr_set_name(distr[27],"sqrtlin"); unur_distr_cont_set_mode(distr[27],0.); unur_distr_cont_set_pdfarea(distr[27],2.); # pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode distr[28] = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr[28],pdf_sqrtlinshft); unur_distr_cont_set_dpdf(distr[28],dpdf_sqrtlinshft); unur_distr_cont_set_cdf(distr[28],cdf_sqrtlinshft); unur_distr_set_name(distr[28],"sqrtlin"); unur_distr_cont_set_mode(distr[28],1000.); unur_distr_cont_set_pdfarea(distr[28],2.); # truncated distributions distr[22] = unur_distr_cauchy(NULL,0); unur_distr_cont_set_domain(distr[22],0.1,1.); unur_distr_cont_upd_mode(distr[22]); unur_distr_cont_upd_pdfarea(distr[22]); # number of distributions: 31 [validate - test chi2:] # + ... pass test # 0 ... fail to initialize generator # - ... fail test # . ... do not run test # # ... comment # # generators: # [0] ... default variant # [1] ... use mirror principle # [2] ... use cdf at mode and squeeze (not for truncated std distributions) # [3] ... default variant but reinitialized with changed domain # [4] ... default variant but reinitialized with changed pdf parameters # generalized SROU # [10] ... r = 1.001 # [11] ... r = 2 # [12] ... r = 10 # [13] ... r = 2, use cdf at mode # [14] ... r = 2, reinitialized with changed domain # [15] ... r = 2, reinitialized with changed pdf parameters # # 0 1 2 3 4 10 11 12 13 14 15 # distribution #--------------------------------------------------------------------- x <0> + + + + + + + + + + + # beta (1, 2) <1> + + + + + + + + + + + # beta (1, 5) x <2> + + + . + + + + + . + # beta (1, 100) <3> + + + + + + + + + + + # beta (3, 4) x <4> + + + . + + + + + . + # beta (5, 100) <5> + + + . + + + + + . + # beta (500, 300) <6> + + + + + + + + + + + # beta (5, 10, -3, 15) <23> + + + + + + + + + + + # exponential () <24> + + + + + + + + + + + # exponential (30, -5) <7> + + + + + + + + + + + # cauchy () <8> + + + + + + + + + + + # cauchy (1, 20) x <9> + + + + + + + + + + + # gamma (1) <10> + + + + + + + + + + + # gamma (2) <11> + + + + + + + + + + + # gamma (3) <12> + + + + + + + + + + + # gamma (10) x<13> + + + . + + + + + . + # gamma (1000) <29> + + + + + + + + + + + # gamma (1, 4) <14> + + + + + + + + + + + # gamma (5, 1000, 0) x<15> + + + . + + + + + . + # gamma (5, 1e-05, 0) x<16> + + + - + + + + + - + # gamma (5, 10, 100000) <30> 0 0 0 0 0 0 0 0 0 0 0 # gamma (0.5) <25> + + + + + + + + + + + # laplace () <26> + + + + + + + + + + + # laplace (-10, 100) <17> + + + + + + + + + + + # normal () x<18> + + + . + + + + + . + # normal (1, 1e-05) <19> + + + . + + + + + . + # normal (1, 1e+05) <20> + + + + + + + + + + + # uniform () <21> + + + - + + + + + - + # uniform (1, 20) <22> + + - + + + + + - + + # cauchy () - truncated <27> + + + . . + + + + . . # pdf with piecewise linear function as transformed density with T = -1/sqrt <28> + + + . . + + + + . . # [27] with shifted mode [validate - verify hat:] # + ... pass test # ~ ... fail in at most 1% of samples # 0 ... fail to initialize generator # - ... fail test # . ... do not run test # # ... comment # # generators: # [0] ... default variant # [1] ... use mirror principle # [2] ... use cdf at mode and squeeze (not for truncated std distributions) # [3] ... default variant but reinitialized with changed domain # [4] ... default variant but reinitialized with changed pdf parameters # generalized SROU # [10] ... r = 1.001 # [11] ... r = 2 # [12] ... r = 10 # [13] ... r = 2, use cdf at mode # [14] ... r = 2, reinitialized with changed domain # [15] ... r = 2, reinitialized with changed pdf parameters # # 0 1 2 3 4 10 11 12 13 14 15 # distribution #--------------------------------------------------------------------- x <0> + + + + + + + + + + + # beta (1, 2) <1> + + + + + + + + + + + # beta (1, 5) x <2> + + + . + + + + + . + # beta (1, 100) <3> + + + + + + + + + + + # beta (3, 4) x <4> + + + . + + + + + . + # beta (5, 100) <5> + + + . + + + + + . + # beta (500, 300) <6> + + + + + + + + + + + # beta (5, 10, -3, 15) <23> + + + + + + + + + + + # exponential () <24> + + + + + + + + + + + # exponential (30, -5) <7> + + + + + + + + + + + # cauchy () <8> + + + + + + + + + + + # cauchy (1, 20) x <9> + + + + + + + + + + + # gamma (1) <10> + + + + + + + + + + + # gamma (2) <11> + + + + + + + + + + + # gamma (3) <12> + + + + + + + + + + + # gamma (10) x<13> + + + . + + + + + . + # gamma (1000) <29> + + + + + + + + + + + # gamma (1, 4) <14> + + + + + + + + + + + # gamma (5, 1000, 0) x<15> + + + . + + + + + . + # gamma (5, 1e-05, 0) x<16> + + + . + + + + + . + # gamma (5, 10, 100000) <25> + + + + + + + + + + + # laplace () <26> + + + + + + + + + + + # laplace (-10, 100) <17> + + + + + + + + + + + # normal () x<18> + + + . + + + + + . + # normal (1, 1e-05) <19> + + + . + + + + + . + # normal (1, 1e+05) <20> + + + + + + + + + + + # uniform () <21> + + + . + + + + + . + # uniform (1, 20) <22> + + . + + + + + . + + # cauchy () - truncated <27> + + + . . + + + + . . # pdf with piecewise linear function as transformed density with T = -1/sqrt <28> + + . . . + + + + . . # [27] with shifted mode ############################################################################# ############################################################################# [verbatim] /* pdf for normal distribution */ double pdf_normal( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return exp(-x*x/2.); } /* end of pdf_normal */ /* pdf that does not work */ double pdf_invalid( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return ((fabs(x)<0.001) ? 0. : exp(-x*x/2.)); } /* end of pdf_invalid */ /* pdf with piecewise linear function as transformed density with T = -1/sqrt */ double pdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y = 1./(fabs(x)+1.); return y*y; } double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y = 1./(fabs(x)+1.); y = 2.*y*y*y; return ((x<0.) ? y : - y); } double cdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { if (x<=0.) return 0.5/(1.-x); else return (1.-0.5/(1.+x)); } /* pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode */ double pdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y; x -= 1000.; y = 1./(fabs(x)+1.); return y*y; } double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y; x -= 1000.; y = 1./(fabs(x)+1.); y = 2.*y*y*y; return ((x<0.) ? y : - y); } double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { x -= 1000.; if (x<=0.) return 0.5/(1.-x); else return (1.-0.5/(1.+x)); } /* dummy function */ int unur_srou_set_pedantic( struct unur_par *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) { return 1; } ############################################################################# unuran-1.11.0/tests/t_tdr_ia.c0000644001357500135600000054067014430713513013145 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for TDR **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ double pdf_sqrtlin( double x, const UNUR_DISTR *distr ); double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ); double cdf_sqrtlin( double x, const UNUR_DISTR *distr ); double pdf_sqrtlinshft(double x, const UNUR_DISTR *distr ); double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); #define COMPARE_SAMPLE_SIZE (10000) #define VIOLATE_SAMPLE_SIZE (20) /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ /* pdf with piecewise linear function as transformed density with T = -1/sqrt */ double pdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y = 1./(fabs(x)+1.); return y*y; } double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y = 1./(fabs(x)+1.); y = 2.*y*y*y; return ((x<0.) ? y : - y); } double cdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { if (x<=0.) return 0.5/(1.-x); else return (1.-0.5/(1.+x)); } /* pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode */ double pdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y; x -= 1000.; y = 1./(fabs(x)+1.); return y*y; } double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y; x -= 1000.; y = 1./(fabs(x)+1.); y = 2.*y*y*y; return ((x<0.) ? y : - y); } double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { x -= 1000.; if (x<=0.) return 0.5/(1.-x); else return (1.-0.5/(1.+x)); } /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [validate] */ /*---------------------------------------------------------------------------*/ /* [validate] */ void test_validate (void) { /* suppress GCC compiler warning */ GCC_DIAG_OFF(unused-variable) UNUR_DISTR *distr[32]; UNUR_PAR *par; UNUR_GEN *gen; double *darray; double fpm[10]; int n_tests_failed; int rcode; /* start test */ printf("[validate "); fflush(stdout); fprintf(TESTLOG,"\n[validate]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* distributions: 32 */ { fpm[0] = 1.; fpm[1] = 2.; distr[0] = unur_distr_beta(fpm,2); } { fpm[0] = 1.; fpm[1] = 5.; distr[1] = unur_distr_beta(fpm,2); } { fpm[0] = 1.; fpm[1] = 100.; distr[2] = unur_distr_beta(fpm,2); } { fpm[0] = 2.; fpm[1] = 5.; distr[30] = unur_distr_beta(fpm,2); } { fpm[0] = 5.; fpm[1] = 2.; distr[31] = unur_distr_beta(fpm,2); } { fpm[0] = 3.; fpm[1] = 4.; distr[3] = unur_distr_beta(fpm,2); } { fpm[0] = 5.; fpm[1] = 100.; distr[4] = unur_distr_beta(fpm,2); } { fpm[0] = 500.; fpm[1] = 300.; distr[5] = unur_distr_beta(fpm,2); } { fpm[0] = 5.; fpm[1] = 10.; fpm[2] = -3.; fpm[3] = 15.; distr[6] = unur_distr_beta(fpm,4); } { distr[7] = unur_distr_cauchy(NULL,0); } { fpm[0] = 1.; fpm[1] = 20.; distr[8] = unur_distr_cauchy(fpm,2); } { distr[24] = unur_distr_exponential(NULL,0); } { fpm[0] = 30.; fpm[1] = -5.; distr[25] = unur_distr_exponential(fpm,2); } { fpm[0] = 1.; distr[9] = unur_distr_gamma(fpm,1); } { fpm[0] = 2.; distr[10] = unur_distr_gamma(fpm,1); } { fpm[0] = 3.; distr[11] = unur_distr_gamma(fpm,1); } { fpm[0] = 10.; distr[12] = unur_distr_gamma(fpm,1); } { fpm[0] = 1000.; distr[13] = unur_distr_gamma(fpm,1); } { fpm[0] = 5.; fpm[1] = 1000.; distr[14] = unur_distr_gamma(fpm,2); } { fpm[0] = 5.; fpm[1] = 1.e-5; distr[15] = unur_distr_gamma(fpm,2); } { fpm[0] = 5.; fpm[1] = 10.; fpm[2] = 1000.; distr[16] = unur_distr_gamma(fpm,3); } { distr[26] = unur_distr_laplace(NULL,0); } { fpm[0] = -10.; fpm[1] = 100.; distr[27] = unur_distr_laplace(fpm,2); } { distr[17] = unur_distr_normal(NULL,0); } { fpm[0] = 1.; fpm[1] = 1.e-5; distr[18] = unur_distr_normal(fpm,2); } { fpm[0] = 0.; fpm[1] = 1.e+5; distr[19] = unur_distr_normal(fpm,2); } { distr[20] = unur_distr_uniform(NULL,0); } { fpm[0] = 1.; fpm[1] = 20.; distr[21] = unur_distr_uniform(fpm,2); } { distr[28] = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr[28],pdf_sqrtlin); unur_distr_cont_set_dpdf(distr[28],dpdf_sqrtlin); unur_distr_cont_set_cdf(distr[28],cdf_sqrtlin); unur_distr_set_name(distr[28],"sqrtlin"); } { distr[29] = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr[29],pdf_sqrtlinshft); unur_distr_cont_set_dpdf(distr[29],dpdf_sqrtlinshft); unur_distr_cont_set_cdf(distr[29],cdf_sqrtlinshft); unur_distr_set_name(distr[29],"sqrtlin"); } { distr[22] = unur_distr_cauchy(NULL,0); unur_distr_cont_set_domain(distr[22],0.1,1.); unur_distr_cont_upd_mode(distr[22]); unur_distr_cont_upd_pdfarea(distr[22]); } { fpm[0] = 3.; fpm[1] = 4.; distr[23] = unur_distr_beta(fpm,2); unur_distr_cont_set_domain(distr[23],-2.,5.); } /* timing */ stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); printf("\n(chi^2) "); fflush(stdout); /* chi^2 tests: 192 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nChi^2 Test:\n"); /* distribution [0] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [2] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [30] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [31] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [3] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [4] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [5] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [6] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [7] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [8] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [24] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [25] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [9] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [10] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [11] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [12] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [13] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [14] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [15] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [16] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [26] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [27] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [17] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [18] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [19] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [20] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [21] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [22] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [23] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [28] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [29] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); printf("\n(verify hat) "); fflush(stdout); /* verify hat tests: 192 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nVerify Hat Test (squeeze <= PDF <= hat):\n"); /* distribution [0] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [2] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [30] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [31] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [3] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [4] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [5] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [6] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [7] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'0')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'0')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [8] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'0')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'0')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [24] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [25] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [9] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [10] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [11] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [12] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [13] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [14] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [15] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [16] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [26] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [27] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [17] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [18] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [19] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [20] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [21] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [22] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [23] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [28] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [29] */ if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); /* free distributions */ unur_distr_free(distr[0]); unur_distr_free(distr[1]); unur_distr_free(distr[2]); unur_distr_free(distr[3]); unur_distr_free(distr[4]); unur_distr_free(distr[5]); unur_distr_free(distr[6]); unur_distr_free(distr[7]); unur_distr_free(distr[8]); unur_distr_free(distr[9]); unur_distr_free(distr[10]); unur_distr_free(distr[11]); unur_distr_free(distr[12]); unur_distr_free(distr[13]); unur_distr_free(distr[14]); unur_distr_free(distr[15]); unur_distr_free(distr[16]); unur_distr_free(distr[17]); unur_distr_free(distr[18]); unur_distr_free(distr[19]); unur_distr_free(distr[20]); unur_distr_free(distr[21]); unur_distr_free(distr[22]); unur_distr_free(distr[23]); unur_distr_free(distr[24]); unur_distr_free(distr[25]); unur_distr_free(distr[26]); unur_distr_free(distr[27]); unur_distr_free(distr[28]); unur_distr_free(distr[29]); unur_distr_free(distr[30]); unur_distr_free(distr[31]); /* test finished */ test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; /* we accept CHI2_FAILURES_TOLERATED failures */ (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_validate */ /* enable GCC compiler warning */ GCC_DIAG_ON(unused-variable) /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_tdr_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_itdr.c0000644001357500135600000057120114430713513012637 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for ITDR **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ /* pdf of gamma density (a=1/2) */ double pdf_gamma12( double x, const UNUR_DISTR *distr ); double dpdf_gamma12( double x, const UNUR_DISTR *distr ); int unur_itdr_set_pedantic( struct unur_par *par, int pedantic ); #define COMPARE_SAMPLE_SIZE (10000) #define VIOLATE_SAMPLE_SIZE (20) /* #define SEED (298346) */ /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ /* pdf of gamma density (a=1/2) */ double pdf_gamma12( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return exp(-x)/sqrt(x); } double dpdf_gamma12( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return -exp(-x)/sqrt(x) * (1.+1./(2.*x)); } /* dummy function */ int unur_itdr_set_pedantic( struct unur_par *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) { return 1; } /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,32,(unur_itdr_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,32,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,38,(unur_itdr_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,38,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* data missing in distribution object */ UNUR_DISTR *distr = NULL; distr = unur_distr_cont_new(); unur_reset_errno(); /* pdf, mode (pole) */ n_tests_failed += (check_expected_NULL(TESTLOG,45,(unur_itdr_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,45,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* data missing in distribution object */ UNUR_DISTR *distr = NULL; distr = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr, pdf_gamma12); unur_reset_errno(); /* mode (pole) */ n_tests_failed += (check_expected_NULL(TESTLOG,53,(unur_itdr_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,53,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [set] */ void test_set (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[set "); fflush(stdout); fprintf(TESTLOG,"\n[set]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,63,(unur_itdr_set_verify( par, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,63,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,66,(unur_itdr_set_xi(par,1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,66,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,69,(unur_itdr_set_cp(par, -0.5)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,69,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,72,(unur_itdr_set_ct(par, -0.5)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,72,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* invalid parameter object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_arou_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,81,(unur_itdr_set_verify( par, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,81,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,84,(unur_itdr_set_xi(par,1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,84,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,87,(unur_itdr_set_cp(par, -0.5)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,87,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,90,(unur_itdr_set_ct(par, -0.5)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,90,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double fpar[1] = {0.5}; distr = unur_distr_gamma(fpar,1); par = unur_itdr_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,101,(unur_itdr_set_xi(par,-1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,101,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,104,(unur_itdr_set_cp(par, 0.5)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,104,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,107,(unur_itdr_set_cp(par, -1.0)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,107,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,110,(unur_itdr_set_ct(par, 0.5)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,110,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,113,(unur_itdr_set_ct(par, -1.0)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,113,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_set() */ /*---------------------------------------------------------------------------*/ /* [get] */ void test_get (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[get "); fflush(stdout); fprintf(TESTLOG,"\n[get]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_GEN *gen = NULL; gen = NULL; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,126,(unur_itdr_get_xi(gen)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,126,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,129,(unur_itdr_get_cp(gen)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,129,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,132,(unur_itdr_get_ct(gen)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,132,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,135,(unur_itdr_get_area(gen)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,135,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_free(gen); } { /* invalid generator object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); gen = unur_init(par); abort_if_NULL(TESTLOG, 140, gen ); unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,144,(unur_itdr_get_xi(gen)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,144,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,147,(unur_itdr_get_cp(gen)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,147,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,150,(unur_itdr_get_ct(gen)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,150,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,153,(unur_itdr_get_area(gen)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,153,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_get() */ /*---------------------------------------------------------------------------*/ /* [chg] */ void test_chg (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[chg "); fflush(stdout); fprintf(TESTLOG,"\n[chg]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_GEN *gen = NULL; gen = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,163,(unur_itdr_chg_verify( gen, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,163,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_free(gen); } { /* invalid generator object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); gen = unur_init(par); abort_if_NULL(TESTLOG, 167, gen ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,171,(unur_itdr_chg_verify( gen, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,171,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_chg() */ /*---------------------------------------------------------------------------*/ /* [init] */ void test_init (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[init "); fflush(stdout); fprintf(TESTLOG,"\n[init]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,183,(unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,183,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* data missing in distribution object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = unur_distr_cont_new(); par = NULL; unur_reset_errno(); /* dpdf, mode */ unur_distr_cont_set_pdf(distr,pdf_gamma12); n_tests_failed += (check_expected_NULL(TESTLOG,192,(par = unur_itdr_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,192,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* mode */ unur_distr_cont_set_dpdf(distr,dpdf_gamma12); n_tests_failed += (check_expected_NULL(TESTLOG,197,(par = unur_itdr_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,197,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_distr_cont_set_mode(distr,0.); n_tests_failed += (check_expected_NULL(TESTLOG,201,(par = unur_itdr_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,201,UNUR_ERR_DISTR_PROP)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_init() */ /*---------------------------------------------------------------------------*/ /* [reinit] */ void test_reinit (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[reinit "); fflush(stdout); fprintf(TESTLOG,"\n[reinit]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* does not exist */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpm[] = { 0.8 }; distr = unur_distr_gamma(fpm,1); par = unur_itdr_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 211, gen ); unur_reset_errno(); n_tests_failed += (check_expected_reinit(TESTLOG,215,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_reinit() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* compare */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double fpm[] = { 0.8, 1., 1. }; distr = unur_distr_gamma(fpm,3); par = NULL; unur_reset_errno(); /* default algorithm */ par = unur_itdr_new(distr); n_tests_failed += (compare_sequence_par_start(TESTLOG,228,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* default algorithm - verifying mode */ par = unur_itdr_new(distr); unur_itdr_set_verify(par,1); n_tests_failed += (compare_sequence_par(TESTLOG,233,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* compare */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double xi, cp, ct; double fpm[] = { 0.8, 1., 1. }; distr = unur_distr_gamma(fpm,3); par = NULL; gen = NULL; unur_reset_errno(); /* default algorithm */ par = unur_itdr_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,247,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* set bx, ct and cp */ xi = unur_itdr_get_xi(gen); ct = unur_itdr_get_ct(gen); cp = unur_itdr_get_cp(gen); unur_free(gen); par = unur_itdr_new(distr); unur_itdr_set_xi(par,xi); unur_itdr_set_cp(par,cp); unur_itdr_set_ct(par,ct); gen = unur_init(par); n_tests_failed += (compare_sequence_gen(TESTLOG,259,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double xi, cp, ct; double fpm[] = { 0.3, 1., 1. }; distr = unur_distr_gamma(fpm,3); par = NULL; gen = NULL; unur_reset_errno(); /* default algorithm */ par = unur_itdr_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,273,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* set bx, ct and cp */ xi = unur_itdr_get_xi(gen); ct = unur_itdr_get_ct(gen); cp = unur_itdr_get_cp(gen); unur_free(gen); par = unur_itdr_new(distr); unur_itdr_set_xi(par,xi); unur_itdr_set_cp(par,cp); unur_itdr_set_ct(par,ct); gen = unur_init(par); n_tests_failed += (compare_sequence_gen(TESTLOG,285,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double xi, cp, ct; double fpm[] = { 3., 0.3, 1., 2. }; distr = unur_distr_beta(fpm,4); par = NULL; gen = NULL; unur_reset_errno(); /* default algorithm */ par = unur_itdr_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,299,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* set bx, ct and cp */ xi = unur_itdr_get_xi(gen); ct = unur_itdr_get_ct(gen); cp = unur_itdr_get_cp(gen); unur_free(gen); par = unur_itdr_new(distr); unur_itdr_set_xi(par,xi); unur_itdr_set_cp(par,cp); unur_itdr_set_ct(par,ct); gen = unur_init(par); n_tests_failed += (compare_sequence_gen(TESTLOG,311,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; UNUR_GEN *clone; double fpm[] = { 0.3, 1., 1. }; distr = unur_distr_gamma(fpm,3); par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_itdr_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,325,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,331,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare reinit */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpm[] = { 0.8 }; distr = unur_distr_gamma(fpm,1); par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_itdr_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,344,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* reinit */ unur_reinit(gen); n_tests_failed += (compare_sequence_gen(TESTLOG,348,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare stringparser */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[] = { 0.3, 1., 1. }; distr = NULL; par = NULL; gen = NULL; unur_reset_errno(); distr = unur_distr_gamma(fpar,3); par = unur_itdr_new(distr); unur_itdr_set_xi(par,1.3); unur_itdr_set_cp(par,-0.7); unur_itdr_set_ct(par,-0.3); unur_itdr_set_verify(par,TRUE); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,365,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "gamma(0.3,1.,1.) & \ method = itdr; xi = 1.3; cp = -0.7; ct = -0.3; verify" ); n_tests_failed += (compare_sequence_gen(TESTLOG,371,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* [validate] */ /*---------------------------------------------------------------------------*/ /* [validate] */ void test_validate (void) { /* suppress GCC compiler warning */ GCC_DIAG_OFF(unused-variable) UNUR_DISTR *distr[53]; UNUR_PAR *par; UNUR_GEN *gen; double *darray; double fpm[10]; int n_tests_failed; int rcode; /* start test */ printf("[validate "); fflush(stdout); fprintf(TESTLOG,"\n[validate]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* distributions: 53 */ { fpm[0] = 0.1; distr[0] = unur_distr_gamma(fpm,1); } { fpm[0] = 0.1; distr[1] = unur_distr_gamma_wo_logpdf(fpm,1); } { fpm[0] = 0.5; distr[2] = unur_distr_gamma(fpm,1); } { fpm[0] = 0.5; distr[3] = unur_distr_gamma_wo_logpdf(fpm,1); } { fpm[0] = 0.9; distr[4] = unur_distr_gamma(fpm,1); } { fpm[0] = 0.9; distr[5] = unur_distr_gamma_wo_logpdf(fpm,1); } { fpm[0] = 1.; distr[6] = unur_distr_gamma(fpm,1); } { fpm[0] = 1.; distr[7] = unur_distr_gamma_wo_logpdf(fpm,1); } { fpm[0] = 2.; distr[8] = unur_distr_gamma(fpm,1); } { fpm[0] = 2.; distr[9] = unur_distr_gamma_wo_logpdf(fpm,1); } { fpm[0] = 0.5; fpm[1] = 2.; fpm[2] = 1.; distr[10] = unur_distr_gamma(fpm,3); } { fpm[0] = 0.5; fpm[1] = 2.; fpm[2] = 1.; distr[11] = unur_distr_gamma_wo_logpdf(fpm,3); } { fpm[0] = 0.5; fpm[1] = 2.; fpm[2] = -1.; distr[12] = unur_distr_gamma(fpm,3); } { fpm[0] = 0.5; fpm[1] = 2.; fpm[2] = -1.; distr[13] = unur_distr_gamma_wo_logpdf(fpm,3); } { fpm[0] = 0.5; fpm[1] = 1.; fpm[2] = 1.; distr[14] = unur_distr_gamma(fpm,3); unur_distr_cont_set_domain(distr[14],1.,1.1); } { fpm[0] = 0.5; fpm[1] = 1.; fpm[2] = 1.; distr[15] = unur_distr_gamma_wo_logpdf(fpm,3); unur_distr_cont_set_domain(distr[15],1.,1.1); } { fpm[0] = 0.5; fpm[1] = 1.; fpm[2] = 1.; distr[16] = unur_distr_gamma(fpm,3); unur_distr_cont_set_domain(distr[16],1.,2.); } { fpm[0] = 0.5; fpm[1] = 1.; fpm[2] = 1.; distr[17] = unur_distr_gamma_wo_logpdf(fpm,3); unur_distr_cont_set_domain(distr[17],1.,2.); } { fpm[0] = 0.5; fpm[1] = 1.; fpm[2] = 1.; distr[18] = unur_distr_gamma(fpm,3); unur_distr_cont_set_domain(distr[18],1.,4.); } { fpm[0] = 0.5; fpm[1] = 1.; fpm[2] = 1.; distr[19] = unur_distr_gamma_wo_logpdf(fpm,3); unur_distr_cont_set_domain(distr[19],1.,4.); } { fpm[0] = 1.5; distr[48] = unur_distr_gamma(fpm,1); unur_distr_cont_set_domain(distr[48],1.,UNUR_INFINITY); } { fpm[0] = 1.5; distr[49] = unur_distr_gamma_wo_logpdf(fpm,1); unur_distr_cont_set_domain(distr[49],1.,UNUR_INFINITY); } { distr[20] = unur_distr_normal(NULL,0); } { distr[21] = unur_distr_normal_wo_logpdf(NULL,0); } { distr[22] = unur_distr_normal(NULL,0); unur_distr_cont_set_domain(distr[22],0.,UNUR_INFINITY); } { distr[23] = unur_distr_normal_wo_logpdf(NULL,0); unur_distr_cont_set_domain(distr[23],0.,UNUR_INFINITY); } { distr[24] = unur_distr_normal(NULL,0); unur_distr_cont_set_domain(distr[24],0.,4.); } { distr[25] = unur_distr_normal_wo_logpdf(NULL,0); unur_distr_cont_set_domain(distr[25],0.,4.); } { distr[26] = unur_distr_normal(NULL,0); unur_distr_cont_set_domain(distr[26],1.,4.); } { distr[27] = unur_distr_normal_wo_logpdf(NULL,0); unur_distr_cont_set_domain(distr[27],1.,4.); } { distr[28] = unur_distr_normal(NULL,0); unur_distr_cont_set_domain(distr[28],-0.5,4.); unur_distr_cont_set_mode(distr[28],-0.5); } { distr[29] = unur_distr_normal_wo_logpdf(NULL,0); unur_distr_cont_set_domain(distr[29],-0.5,4.); unur_distr_cont_set_mode(distr[29],-0.5); } { distr[30] = unur_distr_cauchy(NULL,0); } { distr[31] = unur_distr_cauchy_wo_logpdf(NULL,0); } { distr[32] = unur_distr_cauchy(NULL,0); unur_distr_cont_set_domain(distr[32],0.,UNUR_INFINITY); } { distr[33] = unur_distr_cauchy_wo_logpdf(NULL,0); unur_distr_cont_set_domain(distr[33],0.,UNUR_INFINITY); } { distr[34] = unur_distr_cauchy(NULL,0); unur_distr_cont_set_domain(distr[34],0.,4.); } { distr[35] = unur_distr_cauchy_wo_logpdf(NULL,0); unur_distr_cont_set_domain(distr[35],0.,4.); } { distr[36] = unur_distr_cauchy(NULL,0); unur_distr_cont_set_domain(distr[36],1.,4.); } { distr[37] = unur_distr_cauchy_wo_logpdf(NULL,0); unur_distr_cont_set_domain(distr[37],1.,4.); } { distr[38] = unur_distr_cauchy(NULL,0); unur_distr_cont_set_domain(distr[38],-0.5,4.); unur_distr_cont_set_mode(distr[38],-0.5); } { distr[39] = unur_distr_cauchy_wo_logpdf(NULL,0); unur_distr_cont_set_domain(distr[39],-0.5,4.); unur_distr_cont_set_mode(distr[39],-0.5); } { fpm[0] = 0.5; fpm[1] = 3.; distr[40] = unur_distr_beta(fpm,2); } { fpm[0] = 0.5; fpm[1] = 3.; distr[41] = unur_distr_beta_wo_logpdf(fpm,2); } { fpm[0] = 0.5; fpm[1] = 3.; fpm[2] = 1.; fpm[3] = 2.; distr[42] = unur_distr_beta(fpm,4); } { fpm[0] = 0.5; fpm[1] = 3.; fpm[2] = 1.; fpm[3] = 2.; distr[43] = unur_distr_beta_wo_logpdf(fpm,4); } { fpm[0] = 3.; fpm[1] = 0.5; fpm[2] = -1.; fpm[3] = 0.; distr[44] = unur_distr_beta(fpm,4); } { fpm[0] = 3.; fpm[1] = 0.5; fpm[2] = -1.; fpm[3] = 0.; distr[45] = unur_distr_beta_wo_logpdf(fpm,4); } { fpm[0] = 3.; fpm[1] = 0.5; distr[46] = unur_distr_beta(fpm,2); } { fpm[0] = 3.; fpm[1] = 0.5; distr[47] = unur_distr_beta_wo_logpdf(fpm,2); } { fpm[0] = 1.; fpm[1] = 5.; distr[50] = unur_distr_F(fpm,2); } { fpm[0] = 1.99; fpm[1] = 5.; distr[51] = unur_distr_F(fpm,2); } { fpm[0] = 0.1; fpm[1] = 5.; distr[52] = unur_distr_F(fpm,2); } /* timing */ stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); printf("\n(chi^2) "); fflush(stdout); /* chi^2 tests: 265 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nChi^2 Test:\n"); /* distribution [0] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_xi(par,0.1); unur_itdr_set_cp(par,-0.9); unur_itdr_set_ct(par,-0.54); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [2] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_xi(par,0.5); unur_itdr_set_cp(par,-0.5); unur_itdr_set_ct(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [4] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [6] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [8] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [10] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [12] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [14] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [16] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [18] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [48] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[48]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[48],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[48]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[48],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[48]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[48],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_xi(par,0.1); unur_itdr_set_cp(par,-0.9); unur_itdr_set_ct(par,-0.54); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [3] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_xi(par,0.5); unur_itdr_set_cp(par,-0.5); unur_itdr_set_ct(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [5] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [7] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [9] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [11] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [13] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [15] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [17] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [19] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [49] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[49]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[49],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[49]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[49],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[49]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[49],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [20] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [22] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [24] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [26] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [28] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [21] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [23] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [25] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [27] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [29] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [30] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [32] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [34] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [36] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [38] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[38]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[38],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [31] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [33] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [35] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [37] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[37]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[37],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[37]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[37],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[37]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[37],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [39] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[39]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[39],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [40] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[40]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[40],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[40]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[40],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[40]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[40],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [42] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[42]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[42],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[42]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[42],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[42]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[42],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [44] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[44]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[44],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[44]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[44],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[44]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[44],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [46] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[46]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[46],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[46]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[46],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[46]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[46],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [41] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[41]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[41],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[41]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[41],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[41]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[41],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [43] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[43]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[43],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[43]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[43],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[43]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[43],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [45] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[45]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[45],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[45]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[45],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[45]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[45],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [47] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[47]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[47],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[47]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[47],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[47]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[47],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [50] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[50]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[50],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[50]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[50],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[50]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[50],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [51] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[51]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[51],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[51]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[51],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[51]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[51],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [52] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[52]); par = unur_itdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[52],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[52]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[52],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[52]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[52],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); printf("\n(verify hat) "); fflush(stdout); /* verify hat tests: 265 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nVerify Hat Test (squeeze <= PDF <= hat):\n"); /* distribution [0] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); unur_itdr_set_xi(par,0.1); unur_itdr_set_cp(par,-0.9); unur_itdr_set_ct(par,-0.54); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [2] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); unur_itdr_set_xi(par,0.5); unur_itdr_set_cp(par,-0.5); unur_itdr_set_ct(par,-0.5); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [4] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [6] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [8] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'0')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [10] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [12] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [14] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [16] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [18] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [48] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[48]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[48],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[48]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[48],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[48]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[48],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); unur_itdr_set_xi(par,0.1); unur_itdr_set_cp(par,-0.9); unur_itdr_set_ct(par,-0.54); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [3] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); unur_itdr_set_xi(par,0.5); unur_itdr_set_cp(par,-0.5); unur_itdr_set_ct(par,-0.5); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [5] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [7] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [9] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'0')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [11] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [13] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [15] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [17] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [19] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [49] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[49]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[49],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[49]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[49],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[49]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[49],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [20] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'0')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [22] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [24] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [26] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [28] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'0')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [21] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'0')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [23] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [25] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [27] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [29] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'0')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [30] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'0')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [32] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[32],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[32],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[32],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [34] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[34],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[34],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[34],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [36] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[36],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[36],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[36],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [38] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[38]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[38],'0')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [31] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'0')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [33] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[33],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[33],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[33],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [35] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[35],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[35],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[35],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [37] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[37]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[37],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[37]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[37],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[37]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[37],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [39] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[39]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[39],'0')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [40] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[40]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[40],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[40]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[40],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[40]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[40],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [42] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[42]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[42],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[42]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[42],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[42]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[42],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [44] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[44]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[44],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[44]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[44],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[44]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[44],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [46] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[46]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[46],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[46]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[46],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[46]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[46],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [41] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[41]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[41],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[41]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[41],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[41]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[41],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [43] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[43]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[43],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[43]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[43],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[43]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[43],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [45] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[45]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[45],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[45]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[45],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[45]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[45],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [47] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[47]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[47],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[47]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[47],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[47]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[47],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [50] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[50]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[50],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[50]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[50],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[50]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[50],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [51] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[51]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[51],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[51]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[51],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[51]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[51],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [52] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[52]); par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[52],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[52]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[52],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[52]); { UNUR_DISTR *dg =NULL; par = unur_itdr_new(distr_localcopy); unur_itdr_set_pedantic(par,0); fpm[0] = 0.5; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_itdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[52],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); /* free distributions */ unur_distr_free(distr[0]); unur_distr_free(distr[1]); unur_distr_free(distr[2]); unur_distr_free(distr[3]); unur_distr_free(distr[4]); unur_distr_free(distr[5]); unur_distr_free(distr[6]); unur_distr_free(distr[7]); unur_distr_free(distr[8]); unur_distr_free(distr[9]); unur_distr_free(distr[10]); unur_distr_free(distr[11]); unur_distr_free(distr[12]); unur_distr_free(distr[13]); unur_distr_free(distr[14]); unur_distr_free(distr[15]); unur_distr_free(distr[16]); unur_distr_free(distr[17]); unur_distr_free(distr[18]); unur_distr_free(distr[19]); unur_distr_free(distr[20]); unur_distr_free(distr[21]); unur_distr_free(distr[22]); unur_distr_free(distr[23]); unur_distr_free(distr[24]); unur_distr_free(distr[25]); unur_distr_free(distr[26]); unur_distr_free(distr[27]); unur_distr_free(distr[28]); unur_distr_free(distr[29]); unur_distr_free(distr[30]); unur_distr_free(distr[31]); unur_distr_free(distr[32]); unur_distr_free(distr[33]); unur_distr_free(distr[34]); unur_distr_free(distr[35]); unur_distr_free(distr[36]); unur_distr_free(distr[37]); unur_distr_free(distr[38]); unur_distr_free(distr[39]); unur_distr_free(distr[40]); unur_distr_free(distr[41]); unur_distr_free(distr[42]); unur_distr_free(distr[43]); unur_distr_free(distr[44]); unur_distr_free(distr[45]); unur_distr_free(distr[46]); unur_distr_free(distr[47]); unur_distr_free(distr[48]); unur_distr_free(distr[49]); unur_distr_free(distr[50]); unur_distr_free(distr[51]); unur_distr_free(distr[52]); /* test finished */ test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; /* we accept CHI2_FAILURES_TOLERATED failures */ (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_validate */ /* enable GCC compiler warning */ GCC_DIAG_ON(unused-variable) /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_itdr_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_utdr.c0000644001357500135600000026422114430713513012654 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for UTDR **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ double pdf( double x, const UNUR_DISTR *distr ); double pdf_bimodal( double x, const UNUR_DISTR *distr ); double dpdf_bimodal( double x, const UNUR_DISTR *distr ); double pdf_negative( double x, const UNUR_DISTR *distr ); double dpdf_negative( double x, const UNUR_DISTR *distr ); double pdf_partnegative( double x, const UNUR_DISTR *distr ); double dpdf_partnegative( double x, const UNUR_DISTR *distr ); double pdf_sqrtlin( double x, const UNUR_DISTR *distr ); double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ); double cdf_sqrtlin( double x, const UNUR_DISTR *distr ); double pdf_sqrtlinshft(double x, const UNUR_DISTR *distr ); double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); int unur_utdr_set_pedantic( struct unur_par *par, int pedantic ); #define COMPARE_SAMPLE_SIZE (10000) #define VIOLATE_SAMPLE_SIZE (20) /* #define SEED (2346412) */ /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ /* pdf of bimodal density */ double pdf_bimodal( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return ( exp(-(x-1.)*(x-1.)) + exp(-(x+1.)*(x+1.)) ); } double dpdf_bimodal( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return ( -2. * (x-1.) * exp(-(x-1.)*(x-1.)) -2. * (x+1.) * exp(-(x+1.)*(x+1.)) ); } /* pdf with negative value */ double pdf_negative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return (-x*x); } double dpdf_negative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return (-2.*x); } /* pdf with partial negative value */ double pdf_partnegative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return ((x>-0.89 && x<0.89) ? -1.: exp(-x*x)); } double dpdf_partnegative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return ((x>-0.89 && x<0.89) ?0.: -2.*x*exp(-x*x)); } /* pdf of normal density */ double pdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return exp(-x*x/2.); } /* end of pdf */ /* pdf with piecewise linear function as transformed density with T = -1/sqrt */ double pdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y = 1./(fabs(x)+1.); return y*y; } double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y = 1./(fabs(x)+1.); y = 2.*y*y*y; return ((x<0.) ? y : - y); } double cdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { if (x<=0.) return 0.5/(1.-x); else return (1.-0.5/(1.+x)); } /* pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode */ double pdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y; x -= 1000.; y = 1./(fabs(x)+1.); return y*y; } double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y; x -= 1000.; y = 1./(fabs(x)+1.); y = 2.*y*y*y; return ((x<0.) ? y : - y); } double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { x -= 1000.; if (x<=0.) return 0.5/(1.-x); else return (1.-0.5/(1.+x)); } /* dummy function */ int unur_utdr_set_pedantic( struct unur_par *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) { return 1; } /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,47,(unur_utdr_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,47,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,53,(unur_utdr_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,53,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* data missing in distribution object */ UNUR_DISTR *distr = NULL; distr = unur_distr_cont_new(); unur_reset_errno(); /* pdf, mode, pdfarea */ n_tests_failed += (check_expected_NULL(TESTLOG,60,(unur_utdr_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,60,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [set] */ void test_set (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[set "); fflush(stdout); fprintf(TESTLOG,"\n[set]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,70,(unur_utdr_set_verify( par, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,70,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,73,(unur_utdr_set_pdfatmode(par,1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,73,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,76,(unur_utdr_set_cpfactor(par, 1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,76,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,79,(unur_utdr_set_deltafactor(par, 1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,79,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* invalid parameter object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_arou_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,89,(unur_utdr_set_verify( par, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,89,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,92,(unur_utdr_set_pdfatmode(par,1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,92,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,95,(unur_utdr_set_cpfactor(par, 1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,95,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,98,(unur_utdr_set_deltafactor(par, 1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,98,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_utdr_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,108,(unur_utdr_set_pdfatmode(par,-1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,108,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,111,(unur_utdr_set_cpfactor(par, -1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,111,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,114,(unur_utdr_set_deltafactor(par, -1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,114,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,117,(unur_utdr_set_deltafactor(par, 1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,117,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_set() */ /*---------------------------------------------------------------------------*/ /* [chg] */ void test_chg (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[chg "); fflush(stdout); fprintf(TESTLOG,"\n[chg]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid generator object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_arou_new(distr); unur_set_debug(par,0); gen = unur_init( par ); abort_if_NULL(TESTLOG, 133, gen ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,137,(unur_utdr_chg_verify(gen,1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,137,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,140,(unur_utdr_chg_pdfatmode(gen,1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,140,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[2] = {2.,5.}; distr = unur_distr_gamma(fpar,2); par = unur_utdr_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 146, gen ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,150,(unur_utdr_chg_pdfatmode(gen,-1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,150,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_chg() */ /*---------------------------------------------------------------------------*/ /* [init] */ void test_init (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[init "); fflush(stdout); fprintf(TESTLOG,"\n[init]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,161,(unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,161,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* data missing in distribution object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = unur_distr_cont_new(); par = NULL; unur_reset_errno(); /* mode, pdfarea */ unur_distr_cont_set_pdf(distr,pdf); par = unur_utdr_new( distr ); n_tests_failed += (check_expected_NULL(TESTLOG,171,(unur_init(par)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,171,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* pdfarea */ unur_distr_cont_set_mode(distr,1.); par = unur_utdr_new( distr ); n_tests_failed += (check_expected_NULL(TESTLOG,177,(unur_init(par)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,177,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_init() */ /*---------------------------------------------------------------------------*/ /* [reinit] */ void test_reinit (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[reinit "); fflush(stdout); fprintf(TESTLOG,"\n[reinit]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* exist */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_utdr_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 185, gen ); unur_reset_errno(); n_tests_failed += (check_expected_reinit(TESTLOG,189,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_reinit() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* compare */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = unur_distr_normal(NULL,0); par = NULL; unur_reset_errno(); /* default algorithm */ par = unur_utdr_new(distr); n_tests_failed += (compare_sequence_par_start(TESTLOG,201,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* default algorithm - verifying mode */ par = unur_utdr_new(distr); unur_utdr_set_verify(par,1); n_tests_failed += (compare_sequence_par(TESTLOG,206,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* compare clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; UNUR_GEN *clone; distr = unur_distr_normal(NULL,0); par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_utdr_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,219,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,225,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare reinit */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_utdr_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,237,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* reinit */ unur_reinit(gen); n_tests_failed += (compare_sequence_gen(TESTLOG,241,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare stringparser */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[2] = {3.,3.}; distr = NULL; par = NULL; gen = NULL; unur_reset_errno(); distr = unur_distr_gamma(fpar,2); par = unur_utdr_new(distr); unur_utdr_set_cpfactor(par,0.660); unur_utdr_set_deltafactor(par,1.e-4); unur_utdr_set_verify(par,TRUE); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,257,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "gamma(3.,3.) & \ method = utdr; cpfactor = 0.66; deltafactor = 1.e-4; verify" ); n_tests_failed += (compare_sequence_gen(TESTLOG,263,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* [validate] */ /*---------------------------------------------------------------------------*/ /* [validate] */ void test_validate (void) { /* suppress GCC compiler warning */ GCC_DIAG_OFF(unused-variable) UNUR_DISTR *distr[29]; UNUR_PAR *par; UNUR_GEN *gen; double *darray; double fpm[10]; int n_tests_failed; int rcode; /* start test */ printf("[validate "); fflush(stdout); fprintf(TESTLOG,"\n[validate]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* distributions: 29 */ { fpm[0] = 1.; fpm[1] = 2.; distr[0] = unur_distr_beta(fpm,2); } { fpm[0] = 1.; fpm[1] = 5.; distr[1] = unur_distr_beta(fpm,2); } { fpm[0] = 1.; fpm[1] = 100.; distr[2] = unur_distr_beta(fpm,2); } { fpm[0] = 3.; fpm[1] = 4.; distr[3] = unur_distr_beta(fpm,2); } { fpm[0] = 5.; fpm[1] = 100.; distr[4] = unur_distr_beta(fpm,2); } { fpm[0] = 500.; fpm[1] = 300.; distr[5] = unur_distr_beta(fpm,2); } { fpm[0] = 5.; fpm[1] = 10.; fpm[2] = -3.; fpm[3] = 15.; distr[6] = unur_distr_beta(fpm,4); } { distr[7] = unur_distr_cauchy(NULL,0); } { fpm[0] = 1.; fpm[1] = 20.; distr[8] = unur_distr_cauchy(fpm,2); } { distr[23] = unur_distr_exponential(NULL,0); } { fpm[0] = 30.; fpm[1] = -5.; distr[24] = unur_distr_exponential(fpm,2); } { fpm[0] = 1.; distr[9] = unur_distr_gamma(fpm,1); } { fpm[0] = 2.; distr[10] = unur_distr_gamma(fpm,1); } { fpm[0] = 3.; distr[11] = unur_distr_gamma(fpm,1); } { fpm[0] = 10.; distr[12] = unur_distr_gamma(fpm,1); } { fpm[0] = 1000.; distr[13] = unur_distr_gamma(fpm,1); } { fpm[0] = 5.; fpm[1] = 1000.; distr[14] = unur_distr_gamma(fpm,2); } { fpm[0] = 5.; fpm[1] = 1.e-5; distr[15] = unur_distr_gamma(fpm,2); } { fpm[0] = 5.; fpm[1] = 10.; fpm[2] = 1000; distr[16] = unur_distr_gamma(fpm,3); } { distr[25] = unur_distr_laplace(NULL,0); } { fpm[0] = -10.; fpm[1] = 100.; distr[26] = unur_distr_laplace(fpm,2); } { distr[17] = unur_distr_normal(NULL,0); } { fpm[0] = 1.; fpm[1] = 1.e-5; distr[18] = unur_distr_normal(fpm,2); } { fpm[0] = 0.; fpm[1] = 1.e+5; distr[19] = unur_distr_normal(fpm,2); } { distr[20] = unur_distr_uniform(NULL,0); } { fpm[0] = 1.; fpm[1] = 20.; distr[21] = unur_distr_uniform(fpm,2); } { distr[27] = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr[27],pdf_sqrtlin); unur_distr_cont_set_dpdf(distr[27],dpdf_sqrtlin); unur_distr_cont_set_cdf(distr[27],cdf_sqrtlin); unur_distr_set_name(distr[27],"sqrtlin"); unur_distr_cont_set_mode(distr[27],0.); unur_distr_cont_set_pdfarea(distr[27],2.); } { distr[28] = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr[28],pdf_sqrtlinshft); unur_distr_cont_set_dpdf(distr[28],dpdf_sqrtlinshft); unur_distr_cont_set_cdf(distr[28],cdf_sqrtlinshft); unur_distr_set_name(distr[28],"sqrtlin"); unur_distr_cont_set_mode(distr[28],1000.); unur_distr_cont_set_pdfarea(distr[28],2.); } { distr[22] = unur_distr_cauchy(NULL,0); unur_distr_cont_set_domain(distr[22],0.1,1.); unur_distr_cont_upd_mode(distr[22]); unur_distr_cont_upd_pdfarea(distr[22]); } /* timing */ stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); printf("\n(chi^2) "); fflush(stdout); /* chi^2 tests: 87 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nChi^2 Test:\n"); /* distribution [0] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_utdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_utdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [2] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_utdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [3] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_utdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [4] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_utdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [5] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_utdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [6] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_utdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [23] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_utdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [24] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_utdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [7] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_utdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [8] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_utdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [9] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_utdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [10] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_utdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [11] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_utdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [12] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_utdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [13] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_utdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [14] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_utdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [15] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_utdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [16] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_utdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [25] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_utdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [26] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_utdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [17] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_utdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [18] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_utdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [19] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_utdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [20] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_utdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [21] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_utdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [22] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_utdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [27] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_utdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [28] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_utdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); printf("\n(verify hat) "); fflush(stdout); /* verify hat tests: 87 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nVerify Hat Test (squeeze <= PDF <= hat):\n"); /* distribution [0] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [2] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [3] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [4] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [5] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [6] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [23] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [24] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [7] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [8] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [9] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [10] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [11] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [12] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [13] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [14] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [15] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [16] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [25] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [26] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [17] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [18] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [19] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [20] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [21] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [22] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); { UNUR_DISTR *dg =NULL; par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [27] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_utdr_new(distr_localcopy); unur_utdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_utdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); /* free distributions */ unur_distr_free(distr[0]); unur_distr_free(distr[1]); unur_distr_free(distr[2]); unur_distr_free(distr[3]); unur_distr_free(distr[4]); unur_distr_free(distr[5]); unur_distr_free(distr[6]); unur_distr_free(distr[7]); unur_distr_free(distr[8]); unur_distr_free(distr[9]); unur_distr_free(distr[10]); unur_distr_free(distr[11]); unur_distr_free(distr[12]); unur_distr_free(distr[13]); unur_distr_free(distr[14]); unur_distr_free(distr[15]); unur_distr_free(distr[16]); unur_distr_free(distr[17]); unur_distr_free(distr[18]); unur_distr_free(distr[19]); unur_distr_free(distr[20]); unur_distr_free(distr[21]); unur_distr_free(distr[22]); unur_distr_free(distr[23]); unur_distr_free(distr[24]); unur_distr_free(distr[25]); unur_distr_free(distr[26]); unur_distr_free(distr[27]); unur_distr_free(distr[28]); /* test finished */ test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; /* we accept CHI2_FAILURES_TOLERATED failures */ (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_validate */ /* enable GCC compiler warning */ GCC_DIAG_ON(unused-variable) /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_utdr_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_unur_error.c0000644001357500135600000002204014430713513014067 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for ERROR **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); int unur_error_set_verify( UNUR_PAR *par, int verify); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ void my_error_handler( const char *objid, const char *file, int line, const char *errortype, int errorcode, const char *reason ); #define COMPARE_SAMPLE_SIZE (500) #define VIOLATE_SAMPLE_SIZE (20) /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ void my_error_handler( const char *objid, const char *file, int line, const char *errortype, int errorcode, const char *reason ) /*----------------------------------------------------------------------*/ /* parameters: */ /* objid ... id/type of object */ /* file ... file name (inserted by __FILE__) */ /* line ... line number in source file (inserted by __LINE__) */ /* errortype ... "warning" or "error" */ /* errorcode ... UNU.RAN error code */ /* reason ... (very) short description of reason for error */ /*----------------------------------------------------------------------*/ { FILE *LOG = UNURANLOG; static int n = 0; fprintf(LOG,"\n"); fprintf(LOG,"[[ %d ]] my_error_handler: [ %s ]\n",++n,errortype); fprintf(LOG,"\tobject = %s\n",objid); fprintf(LOG,"\tfile = %s\n",file); fprintf(LOG,"\tline = %d\n",line); fprintf(LOG,"\tcode = [%#x] %s\n",errorcode,unur_get_strerror(errorcode)); fprintf(LOG,"\treason = %s\n",reason); fprintf(LOG,"\n"); } /* end of my_error_handler() */ /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [special] */ void test_special (void) { /* set boolean to FALSE */ int FAILED = 0; GCC_DIAG_OFF(unused-but-set-variable) double fpm[2] = {0., -1.}; UNUR_DISTR *distr = NULL; UNUR_ERROR_HANDLER *default_error_handler = NULL; /* start test */ printf("[special "); fflush(stdout); fprintf(TESTLOG,"\n[special]\n"); /* set stop watch */ stopwatch_lap(&watch); /* invoke default error handler */ distr = unur_distr_normal(fpm,2); /* change error handler */ default_error_handler = unur_set_error_handler( my_error_handler ); distr = unur_distr_normal(fpm,2); /* change to old error handler */ default_error_handler = unur_set_error_handler( default_error_handler ); distr = unur_distr_normal(fpm,2); /* change to new error handler again */ default_error_handler = unur_set_error_handler( default_error_handler ); distr = unur_distr_normal(fpm,2); /* change to default error handler */ default_error_handler = unur_set_error_handler( NULL ); distr = unur_distr_normal(fpm,2); /* switch off error reporting */ default_error_handler = unur_set_error_handler_off(); distr = unur_distr_normal(fpm,2); /* change to old error handler */ default_error_handler = unur_set_error_handler( default_error_handler ); distr = unur_distr_normal(fpm,2); /* test finished */ FAILED = 0; GCC_DIAG_ON(unused-but-set-variable) /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (FAILED) ? 0 : 1; (FAILED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_special() */ /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_error_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_vnrou.c0000644001357500135600000043020514430713513013044 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for VNROU **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ int unur_vnrou_set_pedantic( UNUR_PAR *par, int pedantic ); #define COMPARE_SAMPLE_SIZE (10000) #define VIOLATE_SAMPLE_SIZE (20) /* Chi-square goodness-of-fit tests sometimes fail once due to numerical */ /* errors. So we accept more such failure than for other methods. */ #define CHI2_FAILURES_TOLERATED (5) /* we need marginal distributions for the chi2 tests */ #define unur_distr_multicauchy unur_distr_multicauchy_w_marginals #define unur_distr_multinormal unur_distr_multinormal_w_marginals #define unur_distr_multistudent unur_distr_multistudent_w_marginals /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ /* dummy function */ int unur_vnrou_set_pedantic( UNUR_PAR *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) { return 1; } /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,36,(unur_vnrou_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,36,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,43,(unur_vnrou_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,43,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [set] */ void test_set (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[set "); fflush(stdout); fprintf(TESTLOG,"\n[set]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,54,(unur_vnrou_set_u( par, NULL, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,54,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,57,(unur_vnrou_set_v( par, 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,57,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,60,(unur_vnrou_set_r( par, 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,60,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,63,(unur_vnrou_set_verify( par, 1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,63,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* invalid parameter object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_arou_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,72,(unur_vnrou_set_u( par, NULL, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,72,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,75,(unur_vnrou_set_v( par, 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,75,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,78,(unur_vnrou_set_r( par, 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,78,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,81,(unur_vnrou_set_verify( par, 1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,81,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; const int dim = 3; double mean[] = {1.,2.,3.}; double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; double umin[] = {1.,1.,1.}; double umax[] = {2.,1.,2.}; distr = unur_distr_multinormal( dim, mean, covar ); par = unur_vnrou_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,95,(unur_vnrou_set_u( par, NULL, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,95,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,98,(unur_vnrou_set_u( par, umin, umax )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,98,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,101,(unur_vnrou_set_v( par, -1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,101,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,104,(unur_vnrou_set_v( par, 0. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,104,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_vnrou_set_r( par, 0. ); n_tests_failed += (check_errorcode(TESTLOG,107,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_set() */ /*---------------------------------------------------------------------------*/ /* [get] */ void test_get (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[get "); fflush(stdout); fprintf(TESTLOG,"\n[get]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_GEN *gen = NULL; gen = NULL; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,120,(unur_vnrou_get_volumehat( gen )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,120,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_free(gen); } { /* invalid generator object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); gen = unur_init(par); abort_if_NULL(TESTLOG, 124, gen ); unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,128,(unur_vnrou_get_volumehat( gen )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,128,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_get() */ /*---------------------------------------------------------------------------*/ /* [chg] */ void test_chg (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[chg "); fflush(stdout); fprintf(TESTLOG,"\n[chg]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid generator object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double umin[] = {1.,1.,1.}; double umax[] = {2.,2.,2.}; distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); unur_set_debug(par,0); gen = unur_init( par ); abort_if_NULL(TESTLOG, 139, gen ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,143,(unur_vnrou_chg_u( gen, umin, umax )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,143,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,146,(unur_vnrou_chg_v( gen, 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,146,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,149,(unur_vnrou_chg_verify(gen,1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,149,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; const int dim = 3; double mean[] = {1.,2.,3.}; double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; double umin[] = {1.,1.,1.}; double umax[] = {2.,1.,2.}; distr = unur_distr_multinormal( dim, mean, covar ); par = unur_vnrou_new(distr); gen = unur_init(par); abort_if_NULL(TESTLOG, 158, gen ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,162,(unur_vnrou_chg_u( gen, umin, umax )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,162,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,165,(unur_vnrou_chg_v( gen, -1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,165,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_chg() */ /*---------------------------------------------------------------------------*/ /* [reinit] */ void test_reinit (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[reinit "); fflush(stdout); fprintf(TESTLOG,"\n[reinit]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* does not exist */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_multinormal(3,NULL,NULL); par = unur_vnrou_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 178, gen ); unur_reset_errno(); n_tests_failed += (check_expected_reinit(TESTLOG,182,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_reinit() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* compare */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; const int dim = 3; double mean[] = {1.,2.,3.}; double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; distr = unur_distr_multinormal( dim, mean, covar ); par = unur_vnrou_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 193, gen ); unur_reset_errno(); ; n_tests_failed += (compare_sequence_gen_start(TESTLOG,197,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); par = unur_vnrou_new(distr); unur_vnrou_set_verify(par,1); gen = unur_init( par ); n_tests_failed += (compare_sequence_gen(TESTLOG,204,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); par = unur_vnrou_new(distr); unur_vnrou_set_r(par,0.5); gen = unur_init( par ); n_tests_failed += (compare_sequence_gen_start(TESTLOG,212,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); par = unur_vnrou_new(distr); unur_vnrou_set_r(par,0.5); unur_vnrou_set_verify(par,1); gen = unur_init( par ); n_tests_failed += (compare_sequence_gen(TESTLOG,220,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare 1dim */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; const int dim = 1; double mean[] = {1.}; double covar[] = {2.}; distr = unur_distr_multinormal( dim, mean, covar ); par = unur_vnrou_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 228, gen ); unur_reset_errno(); ; n_tests_failed += (compare_sequence_gen_start(TESTLOG,232,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); par = unur_vnrou_new(distr); unur_vnrou_set_verify(par,1); gen = unur_init( par ); n_tests_failed += (compare_sequence_gen(TESTLOG,239,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; const int dim = 3; double mean[] = {1.,2.,3.}; double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; UNUR_GEN *clone; distr = unur_distr_multinormal( dim, mean, covar ); par = unur_vnrou_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 248, gen ); unur_reset_errno(); /* normal distribution */; n_tests_failed += (compare_sequence_gen_start(TESTLOG,252,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,258,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare clone 1dim */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; const int dim = 1; double mean[] = {1.}; double covar[] = {2.}; UNUR_GEN *clone; distr = unur_distr_multinormal( dim, mean, covar ); par = unur_vnrou_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 268, gen ); unur_reset_errno(); /* normal distribution */; n_tests_failed += (compare_sequence_gen_start(TESTLOG,272,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,278,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare reinit */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_multinormal(3,NULL,NULL); par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_vnrou_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,290,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* reinit */ unur_reinit(gen); n_tests_failed += (compare_sequence_gen(TESTLOG,294,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* [validate] */ /*---------------------------------------------------------------------------*/ /* [validate] */ void test_validate (void) { /* suppress GCC compiler warning */ GCC_DIAG_OFF(unused-variable) UNUR_DISTR *distr[35]; UNUR_PAR *par; UNUR_GEN *gen; double *darray; double fpm[10]; int n_tests_failed; int rcode; /* start test */ printf("[validate "); fflush(stdout); fprintf(TESTLOG,"\n[validate]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* distributions: 35 */ { distr[0] = unur_distr_multinormal(3,NULL,NULL); } { double mean[] = { 1., 2., 3. }; double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; distr[1] = unur_distr_multinormal(3,mean,covar); } { #define dim (2) int i; double mean[dim], covar[dim*dim]; UNUR_DISTR *covar_distr; UNUR_GEN *covar_gen; UNUR_GEN *mean_gen; covar_distr = unur_distr_correlation(dim); covar_gen = unur_init(unur_mcorr_new(covar_distr)); mean_gen = unur_str2gen("normal(5,1)"); for (i=0; isetup time = %.3f ms\n", stopwatch_lap(&watch)); printf("\n(chi^2) "); fflush(stdout); /* chi^2 tests: 210 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nChi^2 Test:\n"); /* distribution [0] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { double umin[] = {-0.608928,-0.608928,-0.608928}; double umax[] = { 0.608928, 0.608928, 0.608928}; double vmax = 0.51; par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_u(par,umin,umax); unur_vnrou_set_v(par,vmax); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { UNUR_DISTR *dg =NULL; double mean[] = { -1., 2., -3. }; double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cvec_set_mean(dg,mean); unur_distr_cvec_set_covar(dg,covar); unur_distr_cvec_upd_mode(dg); unur_distr_cvec_upd_pdfvol(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { double umin[] = {-0.608928,-0.608928,-0.608928}; double umax[] = { 0.608928, 0.608928, 0.608928}; double vmax = 0.51; par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_u(par,umin,umax); unur_vnrou_set_v(par,vmax); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { UNUR_DISTR *dg =NULL; double mean[] = { -1., 2., -3. }; double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cvec_set_mean(dg,mean); unur_distr_cvec_set_covar(dg,covar); unur_distr_cvec_upd_mode(dg); unur_distr_cvec_upd_pdfvol(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [2] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [3] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); { UNUR_DISTR *dg =NULL; double mean[] = { -1., 2., -3. }; double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cvec_set_mean(dg,mean); unur_distr_cvec_set_covar(dg,covar); unur_distr_cvec_upd_mode(dg); unur_distr_cvec_upd_pdfvol(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [4] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); { UNUR_DISTR *dg =NULL; double mean[] = { -1., 2., -3. }; double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cvec_set_mean(dg,mean); unur_distr_cvec_set_covar(dg,covar); unur_distr_cvec_upd_mode(dg); unur_distr_cvec_upd_pdfvol(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [5] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); { double umin[] = {-0.608928,-0.608928,-0.608928}; double umax[] = { 0.608928, 0.608928, 0.608928}; double vmax = 0.70; par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_u(par,umin,umax); unur_vnrou_set_v(par,vmax); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [6] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [7] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [8] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); { UNUR_DISTR *dg =NULL; double mean[] = { -1., 2., -3. }; double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cvec_set_mean(dg,mean); unur_distr_cvec_set_covar(dg,covar); unur_distr_cvec_upd_mode(dg); unur_distr_cvec_upd_pdfvol(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [9] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [10] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [11] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [12] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); { UNUR_DISTR *dg =NULL; double mean[] = { -1., 2., -3. }; double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cvec_set_mean(dg,mean); unur_distr_cvec_set_covar(dg,covar); unur_distr_cvec_upd_mode(dg); unur_distr_cvec_upd_pdfvol(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [13] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [14] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [15] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); { UNUR_DISTR *dg =NULL; double mean[] = { -1., 2., -3. }; double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cvec_set_mean(dg,mean); unur_distr_cvec_set_covar(dg,covar); unur_distr_cvec_upd_mode(dg); unur_distr_cvec_upd_pdfvol(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [16] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); { UNUR_DISTR *dg =NULL; double mean[] = { -1., 2., -3. }; double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cvec_set_mean(dg,mean); unur_distr_cvec_set_covar(dg,covar); unur_distr_cvec_upd_mode(dg); unur_distr_cvec_upd_pdfvol(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [17] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); { UNUR_DISTR *dg =NULL; double mean[] = { -1., 2., -3. }; double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cvec_set_mean(dg,mean); unur_distr_cvec_set_covar(dg,covar); unur_distr_cvec_upd_mode(dg); unur_distr_cvec_upd_pdfvol(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [18] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); { UNUR_DISTR *dg =NULL; double mean[] = { -1., 2., -3. }; double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cvec_set_mean(dg,mean); unur_distr_cvec_set_covar(dg,covar); unur_distr_cvec_upd_mode(dg); unur_distr_cvec_upd_pdfvol(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [19] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [20] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); { UNUR_DISTR *dg =NULL; double mean[] = { -1., 2., -3. }; double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cvec_set_mean(dg,mean); unur_distr_cvec_set_covar(dg,covar); unur_distr_cvec_upd_mode(dg); unur_distr_cvec_upd_pdfvol(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [21] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [22] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [23] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [24] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); { UNUR_DISTR *dg =NULL; double mean[] = { -1., 2., -3. }; double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cvec_set_mean(dg,mean); unur_distr_cvec_set_covar(dg,covar); unur_distr_cvec_upd_mode(dg); unur_distr_cvec_upd_pdfvol(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [25] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [26] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [27] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); { UNUR_DISTR *dg =NULL; double mean[] = { -1., 2., -3. }; double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cvec_set_mean(dg,mean); unur_distr_cvec_set_covar(dg,covar); unur_distr_cvec_upd_mode(dg); unur_distr_cvec_upd_pdfvol(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [28] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); { UNUR_DISTR *dg =NULL; double mean[] = { -1., 2., -3. }; double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cvec_set_mean(dg,mean); unur_distr_cvec_set_covar(dg,covar); unur_distr_cvec_upd_mode(dg); unur_distr_cvec_upd_pdfvol(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [29] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); { UNUR_DISTR *dg =NULL; double mean[] = { -1., 2., -3. }; double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cvec_set_mean(dg,mean); unur_distr_cvec_set_covar(dg,covar); unur_distr_cvec_upd_mode(dg); unur_distr_cvec_upd_pdfvol(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [30] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); { UNUR_DISTR *dg =NULL; double mean[] = { -1., 2., -3. }; double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cvec_set_mean(dg,mean); unur_distr_cvec_set_covar(dg,covar); unur_distr_cvec_upd_mode(dg); unur_distr_cvec_upd_pdfvol(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [31] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [32] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [33] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [34] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); par = unur_vnrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_r(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); printf("\n(verify hat) "); fflush(stdout); /* verify hat tests: 210 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nVerify Hat Test (squeeze <= PDF <= hat):\n"); /* distribution [0] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,0.5); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,2.); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { double umin[] = {-0.608928,-0.608928,-0.608928}; double umax[] = { 0.608928, 0.608928, 0.608928}; double vmax = 0.51; par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_u(par,umin,umax); unur_vnrou_set_v(par,vmax); } gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { UNUR_DISTR *dg =NULL; double mean[] = { -1., 2., -3. }; double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cvec_set_mean(dg,mean); unur_distr_cvec_set_covar(dg,covar); unur_distr_cvec_upd_mode(dg); unur_distr_cvec_upd_pdfvol(dg); unur_reinit(gen); } } if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,0.5); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,2.); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { double umin[] = {-0.608928,-0.608928,-0.608928}; double umax[] = { 0.608928, 0.608928, 0.608928}; double vmax = 0.51; par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_u(par,umin,umax); unur_vnrou_set_v(par,vmax); } gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { UNUR_DISTR *dg =NULL; double mean[] = { -1., 2., -3. }; double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cvec_set_mean(dg,mean); unur_distr_cvec_set_covar(dg,covar); unur_distr_cvec_upd_mode(dg); unur_distr_cvec_upd_pdfvol(dg); unur_reinit(gen); } } if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [2] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,0.5); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,2.); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [3] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,0.5); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,2.); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); { UNUR_DISTR *dg =NULL; double mean[] = { -1., 2., -3. }; double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cvec_set_mean(dg,mean); unur_distr_cvec_set_covar(dg,covar); unur_distr_cvec_upd_mode(dg); unur_distr_cvec_upd_pdfvol(dg); unur_reinit(gen); } } if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [4] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,0.5); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,2.); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); { UNUR_DISTR *dg =NULL; double mean[] = { -1., 2., -3. }; double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cvec_set_mean(dg,mean); unur_distr_cvec_set_covar(dg,covar); unur_distr_cvec_upd_mode(dg); unur_distr_cvec_upd_pdfvol(dg); unur_reinit(gen); } } if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [5] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,0.5); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,2.); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); { double umin[] = {-0.608928,-0.608928,-0.608928}; double umax[] = { 0.608928, 0.608928, 0.608928}; double vmax = 0.70; par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_u(par,umin,umax); unur_vnrou_set_v(par,vmax); } gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [6] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,0.5); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,2.); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [7] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,0.5); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,2.); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [8] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,0.5); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,2.); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); { UNUR_DISTR *dg =NULL; double mean[] = { -1., 2., -3. }; double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cvec_set_mean(dg,mean); unur_distr_cvec_set_covar(dg,covar); unur_distr_cvec_upd_mode(dg); unur_distr_cvec_upd_pdfvol(dg); unur_reinit(gen); } } if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [9] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,0.5); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,2.); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [10] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,0.5); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,2.); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [11] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,2.); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [12] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,2.); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); { UNUR_DISTR *dg =NULL; double mean[] = { -1., 2., -3. }; double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cvec_set_mean(dg,mean); unur_distr_cvec_set_covar(dg,covar); unur_distr_cvec_upd_mode(dg); unur_distr_cvec_upd_pdfvol(dg); unur_reinit(gen); } } if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [13] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,2.); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [14] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,2.); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [15] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,0.5); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,2.); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); { UNUR_DISTR *dg =NULL; double mean[] = { -1., 2., -3. }; double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cvec_set_mean(dg,mean); unur_distr_cvec_set_covar(dg,covar); unur_distr_cvec_upd_mode(dg); unur_distr_cvec_upd_pdfvol(dg); unur_reinit(gen); } } if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [16] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,0.5); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,2.); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); { UNUR_DISTR *dg =NULL; double mean[] = { -1., 2., -3. }; double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cvec_set_mean(dg,mean); unur_distr_cvec_set_covar(dg,covar); unur_distr_cvec_upd_mode(dg); unur_distr_cvec_upd_pdfvol(dg); unur_reinit(gen); } } if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [17] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,0.5); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,2.); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); { UNUR_DISTR *dg =NULL; double mean[] = { -1., 2., -3. }; double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cvec_set_mean(dg,mean); unur_distr_cvec_set_covar(dg,covar); unur_distr_cvec_upd_mode(dg); unur_distr_cvec_upd_pdfvol(dg); unur_reinit(gen); } } if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [18] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,0.5); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,2.); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); { UNUR_DISTR *dg =NULL; double mean[] = { -1., 2., -3. }; double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cvec_set_mean(dg,mean); unur_distr_cvec_set_covar(dg,covar); unur_distr_cvec_upd_mode(dg); unur_distr_cvec_upd_pdfvol(dg); unur_reinit(gen); } } if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [19] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,0.5); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,2.); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [20] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,0.5); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,2.); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); { UNUR_DISTR *dg =NULL; double mean[] = { -1., 2., -3. }; double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cvec_set_mean(dg,mean); unur_distr_cvec_set_covar(dg,covar); unur_distr_cvec_upd_mode(dg); unur_distr_cvec_upd_pdfvol(dg); unur_reinit(gen); } } if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [21] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,0.5); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,2.); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [22] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,0.5); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,2.); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [23] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,2.); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [24] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,2.); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); { UNUR_DISTR *dg =NULL; double mean[] = { -1., 2., -3. }; double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cvec_set_mean(dg,mean); unur_distr_cvec_set_covar(dg,covar); unur_distr_cvec_upd_mode(dg); unur_distr_cvec_upd_pdfvol(dg); unur_reinit(gen); } } if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [25] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,2.); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [26] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,2.); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [27] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,0.5); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,2.); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); { UNUR_DISTR *dg =NULL; double mean[] = { -1., 2., -3. }; double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cvec_set_mean(dg,mean); unur_distr_cvec_set_covar(dg,covar); unur_distr_cvec_upd_mode(dg); unur_distr_cvec_upd_pdfvol(dg); unur_reinit(gen); } } if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [28] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,0.5); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,2.); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); { UNUR_DISTR *dg =NULL; double mean[] = { -1., 2., -3. }; double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cvec_set_mean(dg,mean); unur_distr_cvec_set_covar(dg,covar); unur_distr_cvec_upd_mode(dg); unur_distr_cvec_upd_pdfvol(dg); unur_reinit(gen); } } if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [29] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,0.5); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,2.); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); { UNUR_DISTR *dg =NULL; double mean[] = { -1., 2., -3. }; double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cvec_set_mean(dg,mean); unur_distr_cvec_set_covar(dg,covar); unur_distr_cvec_upd_mode(dg); unur_distr_cvec_upd_pdfvol(dg); unur_reinit(gen); } } if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [30] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,0.5); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,2.); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); { UNUR_DISTR *dg =NULL; double mean[] = { -1., 2., -3. }; double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cvec_set_mean(dg,mean); unur_distr_cvec_set_covar(dg,covar); unur_distr_cvec_upd_mode(dg); unur_distr_cvec_upd_pdfvol(dg); unur_reinit(gen); } } if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [31] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,0.5); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,2.); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [32] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[32],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,0.5); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[32],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,2.); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[32],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [33] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[33],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,0.5); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[33],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,2.); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[33],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [34] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[34],'0')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,0.5); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[34],'0')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); par = unur_vnrou_new(distr_localcopy); unur_vnrou_set_pedantic(par,0); unur_vnrou_set_r(par,2.); gen = unur_init(par); if (gen) unur_vnrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[34],'0')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); /* free distributions */ unur_distr_free(distr[0]); unur_distr_free(distr[1]); unur_distr_free(distr[2]); unur_distr_free(distr[3]); unur_distr_free(distr[4]); unur_distr_free(distr[5]); unur_distr_free(distr[6]); unur_distr_free(distr[7]); unur_distr_free(distr[8]); unur_distr_free(distr[9]); unur_distr_free(distr[10]); unur_distr_free(distr[11]); unur_distr_free(distr[12]); unur_distr_free(distr[13]); unur_distr_free(distr[14]); unur_distr_free(distr[15]); unur_distr_free(distr[16]); unur_distr_free(distr[17]); unur_distr_free(distr[18]); unur_distr_free(distr[19]); unur_distr_free(distr[20]); unur_distr_free(distr[21]); unur_distr_free(distr[22]); unur_distr_free(distr[23]); unur_distr_free(distr[24]); unur_distr_free(distr[25]); unur_distr_free(distr[26]); unur_distr_free(distr[27]); unur_distr_free(distr[28]); unur_distr_free(distr[29]); unur_distr_free(distr[30]); unur_distr_free(distr[31]); unur_distr_free(distr[32]); unur_distr_free(distr[33]); unur_distr_free(distr[34]); /* test finished */ test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; /* we accept CHI2_FAILURES_TOLERATED failures */ (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_validate */ /* enable GCC compiler warning */ GCC_DIAG_ON(unused-variable) /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_vnrou_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_distr_discr.conf0000644001357500135600000002264514420445767014730 00000000000000############################################################################# [main] [main - data:] # method (for information only: the program scans the file name) method: DISTR_DISCR [main - header:] ## we need UNUR_DISTR_MAXPARAMS for a test: \#include /* prototypes */ \#define COMPARE_SAMPLE_SIZE (500) \#define VIOLATE_SAMPLE_SIZE (20) double pmf(int k, const UNUR_DISTR *distr); double icdf(int k, const UNUR_DISTR *distr); int invcdf(double x, const UNUR_DISTR *distr); ############################################################################# [new] ############################################################################# [set] [set - invalid NULL ptr: distr = NULL; ] unur_distr_discr_set_pv( distr, NULL, 0 ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_discr_set_pmf( distr, pmf ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_discr_set_cdf( distr, icdf ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_discr_set_invcdf( distr, invcdf ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_discr_set_pmfstr( distr, "pmf" ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_discr_set_cdfstr( distr, "cdf" ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_discr_set_pmfparams( distr, NULL, 0 ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_discr_set_domain( distr, 0, 10 ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_discr_set_mode( distr, 0 ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_discr_set_pmfsum( distr, 1. ); --> expected_setfailed --> UNUR_ERR_NULL [set - invalid distribution type: distr = unur_distr_cont_new(); ] unur_distr_discr_set_pv( distr, NULL, 0 ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_discr_set_pmf( distr, pmf ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_discr_set_cdf( distr, icdf ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_discr_set_invcdf( distr, invcdf ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_discr_set_pmfstr( distr, "exp(-k)" ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_discr_set_cdfstr( distr, "exp(-k)" ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_discr_set_pmfparams( distr, NULL, 0 ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_discr_set_domain( distr, 0, 10 ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_discr_set_mode( distr, 0 ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_discr_set_pmfsum( distr, 1. ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID [set - invalid NULL ptr: distr = unur_distr_discr_new(); ] unur_distr_discr_set_pmf( distr, NULL ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_discr_set_cdf( distr, NULL ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_discr_set_invcdf( distr, NULL ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_discr_set_pmfstr( distr, NULL ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_discr_set_cdfstr( distr, NULL ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_discr_set_pmfparams( distr, NULL, 1 ); --> expected_setfailed --> UNUR_ERR_NULL [set - invalid parameters: double pv[] = {1.,2.,3.}; distr = unur_distr_discr_new(); ] unur_distr_discr_set_pmfstr( distr, "" ); --> expected_setfailed --> UNUR_ERR_DISTR_SET unur_distr_discr_set_pmfstr( distr, "beta(2.)" ); --> expected_setfailed --> UNUR_ERR_DISTR_SET unur_distr_discr_set_cdfstr( distr, "" ); --> expected_setfailed --> UNUR_ERR_DISTR_SET unur_distr_discr_set_cdfstr( distr, "beta(2.)" ); --> expected_setfailed --> UNUR_ERR_DISTR_SET unur_distr_discr_set_pmfparams( distr, pv, -1 ); --> expected_setfailed --> UNUR_ERR_DISTR_NPARAMS unur_distr_discr_set_pmfparams( distr, pv, UNUR_DISTR_MAXPARAMS +1 ); --> expected_setfailed --> UNUR_ERR_DISTR_NPARAMS unur_distr_discr_set_domain( distr, 10, 1 ); --> expected_setfailed --> UNUR_ERR_DISTR_SET unur_distr_discr_set_pmfsum( distr, -1. ); --> expected_setfailed --> UNUR_ERR_DISTR_SET ############################################################################# [get] [get - invalid NULL ptr: distr = NULL; ] unur_distr_discr_get_pv( distr, NULL ); --> expected_zero --> UNUR_ERR_NULL unur_distr_discr_get_pmf( distr ); --> expected_NULL --> UNUR_ERR_NULL unur_distr_discr_get_cdf( distr ); --> expected_NULL --> UNUR_ERR_NULL unur_distr_discr_get_invcdf( distr ); --> expected_NULL --> UNUR_ERR_NULL unur_distr_discr_get_pmfstr( distr ); --> expected_NULL --> UNUR_ERR_NULL unur_distr_discr_get_cdfstr( distr ); --> expected_NULL --> UNUR_ERR_NULL unur_distr_discr_get_pmfparams( distr, NULL ); --> expected_zero --> UNUR_ERR_NULL unur_distr_discr_get_pmfsum( distr ); --> expected_INFINITY --> UNUR_ERR_NULL unur_distr_discr_make_pv( distr ); --> expected_zero --> UNUR_ERR_NULL [get - invalid distribution type: int ia, ib; distr = unur_distr_cont_new(); ] unur_distr_discr_get_pmf( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID unur_distr_discr_get_cdf( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID unur_distr_discr_get_invcdf( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID unur_distr_discr_get_pmfstr( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID unur_distr_discr_get_cdfstr( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID unur_distr_discr_get_pv( distr, NULL ); --> expected_zero --> UNUR_ERR_DISTR_INVALID unur_distr_discr_get_domain( distr, &ia, &ib ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_discr_get_pmfparams( distr, NULL ); --> expected_zero --> UNUR_ERR_DISTR_INVALID unur_distr_discr_get_pmfsum( distr ); --> expected_INFINITY --> UNUR_ERR_DISTR_INVALID unur_distr_discr_make_pv( distr ); --> expected_zero --> UNUR_ERR_DISTR_INVALID [get - parameters not unknown: distr = unur_distr_discr_new(); ] unur_distr_discr_get_pmfstr( distr ); --> expected_NULL --> UNUR_ERR_NULL unur_distr_discr_get_cdfstr( distr ); --> expected_NULL --> UNUR_ERR_NULL unur_distr_discr_get_pmfsum( distr ); --> expected_INFINITY --> UNUR_ERR_DISTR_GET unur_distr_discr_get_mode( distr ); --> expected_INTMAX --> UNUR_ERR_DISTR_GET unur_distr_discr_make_pv( distr ); --> expected_zero --> UNUR_ERR_DISTR_GET ############################################################################# [chg] [chg - invalid NULL ptr: distr = NULL; ] unur_distr_discr_upd_mode( distr ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_discr_upd_pmfsum( distr ); --> expected_setfailed --> UNUR_ERR_NULL [chg - invalid distribution type: distr = unur_distr_cont_new(); ] unur_distr_discr_upd_mode( distr ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_discr_upd_pmfsum( distr ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID [chg - missing data: distr = unur_distr_discr_new(); ] unur_distr_discr_upd_mode( distr ); --> expected_setfailed --> UNUR_ERR_DISTR_DATA unur_distr_discr_upd_pmfsum( distr ); --> expected_setfailed --> UNUR_ERR_DISTR_DATA ############################################################################## # [init] ############################################################################# # [reinit] ############################################################################# [sample] [sample - invalid NULL ptr: distr = NULL; ] unur_distr_discr_eval_pmf( 1, distr ); --> expected_INFINITY --> UNUR_ERR_NULL unur_distr_discr_eval_cdf( 1, distr ); --> expected_INFINITY --> UNUR_ERR_NULL unur_distr_discr_eval_invcdf( 0.5, distr ); --> expected_INTMAX --> UNUR_ERR_NULL #..................................................................... [sample - invalid distribution object: distr = unur_distr_cont_new(); ] unur_distr_discr_eval_pmf( 1, distr ); --> expected_INFINITY --> UNUR_ERR_DISTR_INVALID unur_distr_discr_eval_cdf( 1, distr ); --> expected_INFINITY --> UNUR_ERR_DISTR_INVALID unur_distr_discr_eval_invcdf( 0.5, distr ); --> expected_INTMAX --> UNUR_ERR_DISTR_INVALID #..................................................................... [sample - missing data: distr = unur_distr_discr_new(); ] unur_distr_discr_eval_pmf( 1, distr ); --> expected_INFINITY --> UNUR_ERR_DISTR_DATA unur_distr_discr_eval_cdf( 1, distr ); --> expected_INFINITY --> UNUR_ERR_DISTR_DATA unur_distr_discr_eval_invcdf( 0.5, distr ); --> expected_INTMAX --> UNUR_ERR_DISTR_DATA ############################################################################# # [validate] ############################################################################# ############################################################################# [verbatim] double pmf(int k ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return 1.; } double icdf(int k ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return 1.; } int invcdf(double x ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return 1; } ############################################################################# unuran-1.11.0/tests/test_StdDistr.m0000644001357500135600000003427614420445767014205 00000000000000(***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: test_StdDistr.m * * * * Create file with results of CDF, PDF and derivatives of PDF * * for various distributions and make C test file. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************) (* === Set Constants ========================================================*) If [ Environment["srcdir"] != $Failed, SrcDir = Environment["srcdir"], (* Else *) SrcDir = "./" ]; (* name of C file for running tests *) SrcFileName = "t_StdDistr.c"; (* name of data file for running tests *) DataFileName = "t_StdDistr.data"; (* sample size for tests *) RunSampleSize = 10000; (* constants *) isCONT = 1; isDISCR = 2; (* === Declare additional distributions ==================================== *) (* --- Defaults (to avoid error with C program) ---------------------------- *) (* --- Extreme Value II Distribution --------------------------------------- *) ExtremeValueIIDistribution/: Domain[ExtremeValueIIDistribution[k_,zeta_,theta_]] := Interval[{zeta, Infinity}]; ExtremeValueIIDistribution/: PDF[ExtremeValueIIDistribution[k_,zeta_,theta_], x_] := If [ x > zeta, Exp[ -((x-zeta)/theta)^(-k)] * ((x-zeta)/theta)^(-k-1) * k/theta, (* else *) 0 ]; ExtremeValueIIDistribution/: CDF[ExtremeValueIIDistribution[k_,zeta_,theta_], x_] := If [ x > zeta, Exp[ -((x-zeta)/theta)^(-k)], (* else *) 0 ]; ExtremeValueIIDistribution/: Random[ExtremeValueIIDistribution[k_,zeta_,theta_]] := zeta + theta * Exp[ -Log[ -Log[Random[]] ]/k ]; (* --- Lomax Distribution -------------------------------------------------- *) LomaxDistribution/: Domain[LomaxDistribution[___]] := Interval[{0,1}]; LomaxDistribution/: PDF[LomaxDistribution[a_,C_], x_] := (x+C)^(-(a+1)) * a * C^a; LomaxDistribution/: CDF[LomaxDistribution[a_,C_], x_] := 1 - C^a/(C + x)^a; LomaxDistribution/: Random[LomaxDistribution[a_,C_]] := -C + (-(C^a/(-1 + Random[])))^(1/a); (* --- Powerexponential Distribution --------------------------------------- *) PowerexponentialDistribution/: Domain[PowerexponentialDistribution[___]] := Interval[{-Infinity, Infinity}]; PowerexponentialDistribution/: PDF[PowerexponentialDistribution[r_], x_] := If [ x>0, Exp[-x^r]/(2 Gamma[1+1/r]), (* Else *) Exp[-(-x)^r]/(2 Gamma[1+1/r]) ]; PowerexponentialDistribution/: CDF[PowerexponentialDistribution[r_], x_] := If [ x<0, Gamma[1/r, (-x)^r] / (2*r*Gamma[1 + 1/r]), (* Else *) 1/2 + (Gamma[1 + 1/r] - Gamma[1/r, x^r]/r) / (2 Gamma[1+1/r]) ]; PowerexponentialDistribution/: Random[PowerexponentialDistribution[r_]] := (* Warning!! This not a generator for the Powerexponential Distribution!! *) (* FindRoot[ PDF[PowerexponentialDistribution[r],x] == Random[],{x,0.3}][[1,2]] *) (* is correct but very slow. So we use a Laplace random variate instead !! *) If[ Random[] < 0.5, 1, -1] * If[ Random[] < Max[0.3,(1-1/r)], Random[], 1-Log[Random[]]/r ]; (* --- Triangular Distribution --------------------------------------------- *) (* We use our own version of the triangular distribution. *) Unprotect[TriangularDistribution]; Clear[TriangularDistribution]; TriangularDistribution/: Domain[TriangularDistribution[___]] := Interval[{0,1}]; TriangularDistribution/: PDF[TriangularDistribution[H_], x_] := Which [ x > 0 && x <= H, 2*x / H, x > H && x < 1, 2*(1-x) / (1-H), True, 0 ]; TriangularDistribution/: CDF[TriangularDistribution[H_], x_] := Which [ x <= 0, 0, x > 0 && x <= H, x*x / H, x > H && x < 1, (H + x * (x-2))/(H-1), True, 1 ]; TriangularDistribution/: Random[TriangularDistribution[H_]] := (* Warning!! This not a generator for the Triangular Distribution!! *) (* We simply use uniform distribution!! *) Random[]; (* === End of Distributions ================================================ *) (* === Format and write output ============================================= *) (* --- Write result for parameter/argument combination into file ----------- *) UnurTestDistrResultLine[stream_, distr_, dtype_, fparams__, x_] := Module [ (* stream ... output stream *) (* distr ... distribution *) (* dtype ... type of distribution (CONT|DISCR|...) *) (* fparams ... parameters for distribution *) (* x ... argument where 'distr' should be evaluated *) (* local variables *) {i,Fx}, (* number of parameters *) WriteString[stream, Length[fparams]," "]; (* list of parameters *) Table[ WriteString[stream, CForm[ N[ fparams[[i]] ]]," "], {i,1,Length[fparams]} ]; (* argument *) WriteString[stream, CForm[x]," "]; (* CDF *) WriteString[stream, CForm[ N[ CDF[ Apply[distr,fparams], x ]]]," "]; (* PDF *) WriteString[stream, CForm[ N[ PDF[ Apply[distr,fparams], x ]]]," "]; (* derivative of PDF *) Switch [ dtype, isCONT, Fx = N[ 0. + D[ PDF[ Apply[distr,fparams], t ], t] /. t->x], isDISCR, (* discrete distribution: no derivative *) Fx = 0, _, (* default: should not happen *) Fx = 0 ]; WriteString[stream, CForm[ Fx ]]; (* end *) WriteString[stream, "\n"]; ]; (* end of UnurTestDistrResultLine[] *) (* --- make file with results for given distribution ----------------------- *) UnurTestDistrResultFile[dname_, dtype_, datafile_, fparbd__, size_, distribution___] := Module [ (* dname ... UNU.RAN name of distribution *) (* dtype ... type of distribution (CONT|DISCR|...) *) (* srcfile ... output stream for C file running tests *) (* datafile... output stream for data for running tests *) (* fparbd ... bounds for parameters for distribution *) (* (use isDISCR as 3rd entry in list for *) (* discrete parameters) *) (* size ... size of sample *) (* distribution ... (optional) *) (* local variables *) {distr, distrAPI, distrstring, i, j, nfparams, fparams, x}, (* name of distribution for Mathematica *) If [ Length[{distribution}] > 0, (* distribution given as third argument *) distr = distribution, (* else *) (* get distribution from dname *) distrstring = ToUpperCase[ StringTake[dname,1] ] <> StringDrop[dname,1] <> "Distribution"; distr = ToExpression[distrstring]; ]; (* number of parameters for distribution *) nfparams = Length[fparbd]; (* compose string for UNU.RAN string API *) distrAPI = dname <> "("; For [ i=0, i ToString[ N[fparbd[[i+1,2]]] ]; If [ i ", " ]; ]; distrAPI = distrAPI <> ")"; Print[ distrAPI ]; (* print distribution into data file *) WriteString[datafile,"distr=" <> distrAPI <> "\n"]; (* print results into data file *) Do[ (* make parameters for distribution at random *) fparams = Table[ If [ Length[fparbd[[j]]]>2 && fparbd[[j,3]] == isDISCR, Round[ fparbd[[j,1]] + Random[] * (fparbd[[j,2]]-fparbd[[j,1]]) ], (* else: isCONT *) N[ fparbd[[j,1]] + Random[] * (fparbd[[j,2]]-fparbd[[j,1]]) ] ], {j,nfparams} ]; (* make an argument at random (use importance sampling) *) x = Random[ Apply[distr,fparams] ]; If [ dtype == isCONT, x = N[x] ]; (* print line with this parameters *) UnurTestDistrResultLine[datafile,distr,dtype,fparams,x], {i,size} ]; (* empty line as separator between distributions *) WriteString[datafile,"\n"]; ]; (* end of UnurTestDistrResultFile[] *) (* === Start of Main ======================================================= *) (* Open data file *) datafile = OpenWrite[ DataFileName ]; (* --- List of Continuous Distributions ------------------------------------ *) (* Beta *) fparams = {{1,10}, {1,100}}; UnurTestDistrResultFile["beta", isCONT, datafile, fparams, RunSampleSize]; (* Cauchy *) fparams = {{-100,100},{1/100,100}}; UnurTestDistrResultFile["cauchy", isCONT, datafile, fparams, RunSampleSize]; (* Chi *) fparams = {{1,100}}; UnurTestDistrResultFile["chi", isCONT, datafile, fparams, RunSampleSize]; (* Chisquare *) fparams = {{1,100}}; UnurTestDistrResultFile["chisquare", isCONT, datafile, fparams, RunSampleSize, ChiSquareDistribution]; (* Exponential -- parameters differ *) fparams = {{1/100,100}}; ed[mu_] = ExponentialDistribution[1/mu]; UnurTestDistrResultFile["exponential", isCONT, datafile, fparams, RunSampleSize, ed]; (* ExtremeValue I *) fparams = {{-100,100},{1/100,100}}; UnurTestDistrResultFile["extremeI",isCONT, datafile, fparams, RunSampleSize, ExtremeValueDistribution]; (* ExtremeValue II *) fparams = {{1/100,100}, {-100,100}, {1/100,100}}; UnurTestDistrResultFile["extremeII",isCONT, datafile, fparams, RunSampleSize, ExtremeValueIIDistribution]; (* F *) fparams = {{1/100,10}, {1/100,10}}; UnurTestDistrResultFile["F", isCONT, datafile, fparams, RunSampleSize, FRatioDistribution]; (* Gamma *) fparams = {{1/2,10}, {1/100,100}}; UnurTestDistrResultFile["gamma", isCONT, datafile, fparams, RunSampleSize]; (* InverseGaussianDistribution *) (* Remark: the CDF values differ for mu < 0 *) fparams = {{1,100}, {1/100,10}}; UnurTestDistrResultFile["ig", isCONT, datafile, fparams, RunSampleSize, InverseGaussianDistribution]; (* Laplace *) (* Remark: dPDF is computed incorrectly! *) fparams = {{-100,100}, {1/100,100}}; UnurTestDistrResultFile["laplace", isCONT, datafile, fparams, RunSampleSize]; (* Lomax *) fparams = {{1/100,100}, {1/100,100}}; UnurTestDistrResultFile["lomax", isCONT, datafile, fparams, RunSampleSize]; (* Logistic *) fparams = {{-100,100},{1/100,100}}; UnurTestDistrResultFile["logistic", isCONT, datafile, fparams, RunSampleSize]; (* Normal *) fparams = {{-100,100}, {1/100,100}}; UnurTestDistrResultFile["normal", isCONT, datafile, fparams, RunSampleSize]; (* Pareto *) fparams = {{1/100,100},{1/100,100}}; UnurTestDistrResultFile["pareto", isCONT, datafile, fparams, RunSampleSize]; (* Powerexponential *) fparams = {{1/1000,3}}; UnurTestDistrResultFile["powerexponential", isCONT, datafile, fparams, RunSampleSize]; (* Rayleigh *) fparams = {{1/100,100}}; UnurTestDistrResultFile["rayleigh", isCONT, datafile, fparams, RunSampleSize]; (* Student *) fparams = {{1/100,100}}; UnurTestDistrResultFile["student", isCONT, datafile, fparams, RunSampleSize, StudentTDistribution]; (* Triangular *) fparams = {{0,1}}; UnurTestDistrResultFile["triangular", isCONT, datafile, fparams, RunSampleSize]; (* (* Uniform *) (* Disabled! since Mathematica 3.0 computes wrong values for the derivative *) fparams = {{-100,1}, {1001/1000,100}}; UnurTestDistrResultFile["uniform", isCONT, datafile, fparams, RunSampleSize]; *) (* Weibull *) fparams = {{1/2,10},{1/100,100}}; UnurTestDistrResultFile["weibull", isCONT, datafile, fparams, RunSampleSize]; (* --- List of Discrete Distributions -------------------------------------- *) (* Binomial *) fparams = {{2,1000,isDISCR}, {1/1000,999/1000}}; UnurTestDistrResultFile["binomial", is_DISCR, datafile, fparams, RunSampleSize]; (* Geometric *) fparams = {{1/1000,999/1000}}; UnurTestDistrResultFile["geometric", is_DISCR, datafile, fparams, RunSampleSize]; (* Hypergeometric; order of parameters is different *) hgd[N_,M_,n_] = HypergeometricDistribution[n,M,N]; fparams = {{100,1000,isDISCR}, {1,99,isDISCR}, {1,99,isDISCR}}; UnurTestDistrResultFile["hypergeometric", is_DISCR, datafile, fparams, RunSampleSize, hgd]; (* Logarithmic *) fparams = {{1/1000,999/1000}}; UnurTestDistrResultFile["logarithmic", is_DISCR, datafile, fparams, RunSampleSize, LogSeriesDistribution]; (* NegativeBinomial; order of parameters is different *) nb[p_,n_] = NegativeBinomialDistribution[n,p]; fparams = {{1/1000,999/1000}, {1,100,isDISCR}}; UnurTestDistrResultFile["negativebinomial", is_DISCR, datafile, fparams, RunSampleSize, nb]; (* Poisson *) fparams = {{1/100,100}}; UnurTestDistrResultFile["poisson", is_DISCR, datafile, fparams, RunSampleSize]; (* --- Done ---------------------------------------------------------------- *) (* close data file *) Close[datafile]; (* === Exit ================================================================ *) Quit[] unuran-1.11.0/tests/t_stringparser.conf0000644001357500135600000003704314420445767015140 00000000000000############################################################################# [main] [main - data:] # method (for information only: the program scans the file name) method: STRINGPARSER [main - header:] /* prototypes */ int unur_ssr_set_pedantic( struct unur_par *par, int pedantic ); \#define COMPARE_SAMPLE_SIZE (10000) \#define VIOLATE_SAMPLE_SIZE (20) ############################################################################# [new] ############################################################################# # [set] ############################################################################# # [get] ############################################################################# # [chg] ############################################################################# [init] # unur_str2gen ... [init - invalid NULL ptr: distr = NULL; gen = NULL; ] gen = unur_str2gen( NULL ); --> expected_NULL --> UNUR_ERR_NULL distr = unur_str2distr( NULL ); --> expected_NULL --> UNUR_ERR_NULL gen = unur_makegen_ssu(NULL,NULL,NULL); --> expected_NULL --> UNUR_ERR_NULL [init - invalid distribution block: gen = NULL; ] gen = unur_str2gen( "xxxx" ); --> expected_NULL --> UNUR_ERR_STR_UNKNOWN unur_free(gen); gen = NULL; gen = unur_str2gen( "method = xxxx" ); --> expected_NULL --> UNUR_ERR_STR_SYNTAX unur_free(gen); gen = NULL; gen = unur_str2gen( "normal; xxxx=1" ); --> expected_NULL --> UNUR_ERR_STR_UNKNOWN unur_free(gen); gen = NULL; gen = unur_str2gen( "normal; pv=(1,2,3)" ); --> expected_NULL --> UNUR_ERR_STR_UNKNOWN unur_free(gen); gen = NULL; gen = unur_str2gen( "normal,(1,2)" ); --> expected_NULL --> UNUR_ERR_STR_UNKNOWN unur_free(gen); gen = NULL; gen = unur_str2gen( "beta" ); --> expected_NULL --> UNUR_ERR_STR_INVALID unur_free(gen); gen = NULL; gen = unur_str2gen( "beta()" ); --> expected_NULL --> UNUR_ERR_STR_INVALID unur_free(gen); gen = NULL; gen = unur_str2gen( "beta(1)" ); --> expected_NULL --> UNUR_ERR_STR_INVALID unur_free(gen); gen = NULL; gen = unur_str2gen( "beta(1,2,3)" ); --> none --> UNUR_ERR_DISTR_NPARAMS unur_free(gen); gen = NULL; gen = unur_str2gen( "beta(1,2,3,4,5)" ); --> none --> UNUR_ERR_DISTR_NPARAMS unur_free(gen); gen = NULL; gen = unur_str2gen( "gamma(-0.5)" ); --> expected_NULL --> UNUR_ERR_STR_INVALID unur_free(gen); gen = NULL; gen = unur_str2gen( "normal(); domain" ); --> expected_NULL --> UNUR_ERR_STR_INVALID [init - invalid other block: gen = NULL; ] gen = unur_str2gen( "normal() & xxxx = arou" ); --> expected_NULL --> UNUR_ERR_STR_UNKNOWN unur_free(gen); gen = NULL; gen = unur_str2gen( "normal() & distr=gamma(2)" ); --> expected_NULL --> UNUR_ERR_STR_UNKNOWN [init - invalid method block: gen = NULL; ] gen = unur_str2gen( "normal() & method = arou; c = 0" ); --> none --> UNUR_ERR_STR_UNKNOWN unur_free(gen); gen = NULL; gen = unur_str2gen( "normal() & method = xxx" ); --> expected_NULL --> UNUR_ERR_NULL [init - invalid urng block: gen = NULL; ] gen = unur_str2gen( "normal & urng = xxx" ); --> none --> UNUR_ERR_STR unur_free(gen); gen = NULL; \#ifdef UNURAN_SUPPORTS_PRNG gen = unur_str2gen( "normal & urng = mt19937(123); xxx = 1" ); --> none --> UNUR_ERR_STR_UNKNOWN \#endif [init - invalid data: gen = NULL; ] gen = unur_str2gen( "gamma(0.5) & method = tdr" ); --> expected_NULL --> UNUR_ERR_GEN_DATA # unur_str2par ... [init - invalid data: struct unur_slist *mlist = NULL; distr = NULL; par = NULL; gen = NULL; ] distr = unur_str2distr("normal()"); par = _unur_str2par(distr, "tdr", &mlist); gen = unur_init(par); _unur_slist_free(mlist); ## Function parser [init - invalid distribution block: distr = NULL; ] ## missing parenthesis for function distr = unur_str2distr("cont; pdf='exp'"); --> expected_NULL --> UNUR_ERR_STR_INVALID ## unknown function name distr = unur_str2distr("cont; pdf='abc(x)'"); --> expected_NULL --> UNUR_ERR_STR_INVALID ## the first symbol ('x') is interpreted as variable, ## the second one causes an error. distr = unur_str2distr("cont; pdf='exp(x*y)'"); --> expected_NULL --> UNUR_ERR_STR_INVALID ## invalid number of parentheses distr = unur_str2distr("cont; pdf='exp(x'"); --> expected_NULL --> UNUR_ERR_STR_INVALID distr = unur_str2distr("cont; pdf='exp((x)'"); --> expected_NULL --> UNUR_ERR_STR_INVALID distr = unur_str2distr("cont; pdf='exp(x))'"); --> expected_NULL --> UNUR_ERR_STR_INVALID ## variable name expected distr = unur_str2distr("cont; pdf='x^'"); --> expected_NULL --> UNUR_ERR_STR_INVALID ## distr = unur_str2distr("cont; pdf='exp(x)x'"); --> expected_NULL --> UNUR_ERR_STR_INVALID distr = unur_str2distr("cont; pdf='2x'"); --> expected_NULL --> UNUR_ERR_STR_INVALID distr = unur_str2distr("cont; pdf='x***2'"); --> expected_NULL --> UNUR_ERR_STR_INVALID distr = unur_str2distr("cont; pdf='x*exp(x^(x*y))'"); --> expected_NULL --> UNUR_ERR_STR_INVALID # unur_makegen_ssu ... ############################################################################# # [reinit] ############################################################################# [sample] #---------------------------------------------------------------------------- [sample - compare function parser - cont: double fpm[10]; distr = NULL; par = NULL; gen = NULL; ] distr = unur_distr_normal(NULL,0); par = unur_srou_new(distr); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "cont; pdf = \"(1/sqrt(2*pi)*exp(-x^2/2))\"; mode = 0; pdfarea = 1 & \ method = srou" ); -->compare_sequence_gen unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "cont; logpdf = \"-x^2/2-0.5*log(2*pi)\"; mode = 0; pdfarea = 1 & \ method = srou" ); -->compare_sequence_gen unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_makegen_ssu( "cont; logpdf = \"-x^2/2-0.5*log(2*pi)\"; mode = 0; pdfarea = 1", \ "method = srou", NULL ); -->compare_sequence_gen unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_makegen_ssu( "cont; logpdf = \"-x^2/2-0.5*log(2*pi)\"; mode = 0; pdfarea = 1", \ "srou", NULL ); -->compare_sequence_gen unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; distr = unur_str2distr("cont; logpdf = \"-x^2/2-0.5*log(2*pi)\"; mode = 0; pdfarea = 1"); gen = unur_makegen_dsu( distr, "srou", NULL ); -->compare_sequence_gen # ........................................................................... unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; distr = unur_distr_normal(NULL,0); par = unur_ssr_new(distr); gen = unur_init(par); -->compare_sequence_gen_start #if(fullcheck) { unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "cont; pdf = \"(1/sqrt(2*pi)*exp(-x^2/2))\"; mode = 0; pdfarea = 1 & \ method = ssr" ); -->compare_sequence_gen # ........................................................................... unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; distr = unur_distr_normal(NULL,0); par = unur_utdr_new(distr); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "cont; pdf = \"(1/sqrt(2*pi)*exp(-x^2/2))\"; mode = 0; pdfarea = 1 & \ method = utdr" ); -->compare_sequence_gen unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "cont; logpdf = \"-x^2/2-0.5*log(2*pi)\"; mode = 0; pdfarea = 1 & \ method = utdr" ); -->compare_sequence_gen # ........................................................................... unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; distr = unur_distr_normal(NULL,0); par = unur_tdr_new(distr); unur_tdr_set_cpoints(par,8,NULL); unur_tdr_set_max_sqhratio(par,0.); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "cont; pdf = \"(1/sqrt(2*pi)*exp(-x^2/2))\"; mode = 0; pdfarea = 1 & \ method = tdr; cpoints = 8; max_sqhratio = 0." ); -->compare_sequence_gen unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "cont; logpdf = \"-x^2/2-0.5*log(2*pi)\"; mode = 0; pdfarea = 1 & \ method = tdr; cpoints = 8; max_sqhratio = 0." ); -->compare_sequence_gen unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_makegen_ssu( "cont; logpdf = \"-x^2/2-0.5*log(2*pi)\"; mode = 0; pdfarea = 1", \ "method = tdr; cpoints = 8; max_sqhratio = 0.", NULL ); -->compare_sequence_gen unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_makegen_ssu( "cont; logpdf = \"-x^2/2-0.5*log(2*pi)\"; mode = 0; pdfarea = 1", \ "tdr; cpoints = 8; max_sqhratio = 0.", NULL ); -->compare_sequence_gen # ........................................................................... unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); unur_arou_set_cpoints(par,8,NULL); unur_arou_set_max_sqhratio(par,0.); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "cont; pdf = \"(1/sqrt(2*pi)*exp(-x^2/2))\"; mode = 0; pdfarea = 1 & \ method = arou; cpoints = 8; max_sqhratio = 0." ); -->compare_sequence_gen # ........................................................................... unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; distr = unur_distr_cont_new(); unur_distr_cont_set_cdfstr(distr,"1-exp(-x)"); par = unur_ninv_new(distr); unur_ninv_set_usenewton(par); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "cont; cdf = \"1-exp(-x)\"; domain = (0,inf)& \ method = ninv; usenewton" ); -->compare_sequence_gen # ........................................................................... unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; distr = unur_distr_cont_new(); unur_distr_cont_set_hrstr(distr,"1/(1+x)"); par = unur_hrb_new(distr); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "cont; hr = \"1/(1+x)\"; domain = (0,inf)& \ method = hrb" ); -->compare_sequence_gen # ........................................................................... unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; distr = unur_distr_normal(NULL,0); par = unur_auto_new(distr); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "normal() & method=auto" ); -->compare_sequence_gen unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_makegen_ssu( "normal()", "method=auto", NULL ); -->compare_sequence_gen unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_makegen_ssu( "normal()", "auto", NULL ); -->compare_sequence_gen unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_makegen_ssu( "normal()", "", NULL ); -->compare_sequence_gen unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_makegen_ssu( "normal()", NULL, NULL ); -->compare_sequence_gen unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_makegen_ssu( "normal", NULL, NULL ); -->compare_sequence_gen # ........................................................................... unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; fpm[0] = 1.; fpm[1] = 2.; distr = unur_distr_normal(fpm,2); par = unur_auto_new(distr); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "normal(1.,2.) & method=auto" ); -->compare_sequence_gen unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_makegen_ssu( "normal(1,2)", "method=auto", NULL ); -->compare_sequence_gen unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_makegen_ssu( "normal(1,2.)", "auto", NULL ); -->compare_sequence_gen unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_makegen_ssu( "normal(1.,2)", "", NULL ); -->compare_sequence_gen unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_makegen_ssu( "normal(1,2)", NULL, NULL ); -->compare_sequence_gen unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; fpm[0] = 1.; fpm[1] = 2.; distr = unur_distr_normal(fpm,2); gen = unur_makegen_dsu( distr, "method=auto", NULL ); -->compare_sequence_gen unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; fpm[0] = 1.; fpm[1] = 2.; distr = unur_distr_normal(fpm,2); gen = unur_makegen_dsu( distr, "auto", NULL ); -->compare_sequence_gen unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; fpm[0] = 1.; fpm[1] = 2.; distr = unur_distr_normal(fpm,2); gen = unur_makegen_dsu( distr, "", NULL ); -->compare_sequence_gen unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; fpm[0] = 1.; fpm[1] = 2.; distr = unur_distr_normal(fpm,2); gen = unur_makegen_dsu( distr, NULL, NULL ); -->compare_sequence_gen # ........................................................................... ## Not tested: ## ## unur_distr_cont_set_pdfparams(); #--------------------------------------------------------------------- [sample - compare function parser - discr: double fpar[] = {0.4}; distr = NULL; par = NULL; gen = NULL; ] distr = unur_distr_geometric(fpar,1); par = unur_dsrou_new(distr); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "discr; pmf = \"0.4 * (1-0.4)^k\"; domain = (0,inf); mode = 0; pmfsum = 1 & \ method = dsrou" ); -->compare_sequence_gen unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; distr = unur_distr_geometric(fpar,1); par = unur_dau_new(distr); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "discr; pmf = \"0.4 * (1-0.4)^k\"; domain = (0,inf); mode = 0; pmfsum = 1 & \ method = dau" ); -->compare_sequence_gen unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; distr = unur_distr_geometric(fpar,1); par = unur_dgt_new(distr); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "discr; pmf = \"0.4 * (1-0.4)^k\"; domain = (0,inf); mode = 0; pmfsum = 1 & \ method = dgt" ); -->compare_sequence_gen unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; distr = unur_distr_geometric(fpar,1); par = unur_dari_new(distr); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "discr; pmf = \"0.4 * (1-0.4)^k\"; domain = (0,inf); mode = 0; pmfsum = 1 & \ method = dari" ); -->compare_sequence_gen ## Not tested: ## ## unur_distr_discr_set_mode(); ## unur_distr_discr_set_pmfparams(); ############################################################################# # [validate] ############################################################################# ############################################################################# [verbatim] ############################################################################# unuran-1.11.0/tests/t_hinv.c0000644001357500135600000067204214430713513012646 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for HINV **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); int unur_hinv_set_verify( UNUR_PAR *par, int verify); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ #include /* constants */ #define UERROR_SAMPLESIZE (10000) #define COMPARE_SAMPLE_SIZE (500) #define VIOLATE_SAMPLE_SIZE (20) /* #define SEED (298346) */ #ifndef M_PI #define M_PI 3.14159265358979323846264338328 /* pi */ #endif #define set_debug_flag(par) \ do { \ if (fullcheck) unur_set_debug((par),~0u); \ else unur_set_debug((par),1u); \ } while (0); /* prototypes */ double sin_cdf( double x, const UNUR_DISTR *distr ); double sin_pdf( double x, const UNUR_DISTR *distr ); double sin_dpdf( double x, const UNUR_DISTR *distr ); double sin0_cdf( double x, const UNUR_DISTR *distr ); double sin0_pdf( double x, const UNUR_DISTR *distr ); double sin0_dpdf( double x, const UNUR_DISTR *distr ); int hinv_error_experiment( UNUR_PAR *par, int samplesize ); int chg_domain_experiment( UNUR_PAR *par, int samplesize ); int hinv_error_gen_experiment( UNUR_GEN *gen, double u_resolution, int order, int samplesize ); /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ /*---------------------------------------------------------------------------*/ /* Example of a distribution with f(x)=0 at x=-0.25 and x=0.75 */ /* */ /* / (1 +sin(2 Pi x))/2 if |x| <= 1 */ /* f(x) = < */ /* \ 0 otherwise */ /* */ double sin_pdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { if (fabs(x) > 1.) return 0.; else return (0.5*(1.+sin((2.*M_PI)*x))); } /* end of sin_pdf() */ /* The derivative of the PDF of our distribution: */ double sin_dpdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { if (fabs(x) > 1.) return 0.; else return (M_PI*cos((2.*M_PI)*x)); } /* end of sin_dpdf() */ /* The CDF of our distribution: */ double sin_cdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { if (x < -1.) return 0.; else if(x<=1.) return (1.+2.*M_PI*(1+x)-cos((2.*M_PI)*x))/(4.*M_PI); else return 1.; } /* end of sin_cdf() */ /*---------------------------------------------------------------------------*/ /* Example of a distribution with f(x)=0 in (-0.5,0) */ /* */ /* / Max(sin(2 Pi x)),0)Pi/2 if -1 < x <0.5 */ /* f(x) = < */ /* \ 0 otherwise */ /* */ double sin0_pdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { if (x < -1.) return 0.; if (x <= -0.5) return sin((2.*M_PI)*x)*0.5*M_PI; if (x < 0.) return 0.; if (x <= 0.5) return sin((2.*M_PI)*x)*0.5*M_PI; return 0.; } /* end of sin0_pdf() */ /* The derivative of the PDF of our distribution: */ double sin0_dpdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { if (x < -1.) return 0.; if (x <= -0.5) return cos((2.*M_PI)*x)*M_PI*M_PI; if (x < 0.) return 0.; if (x <= 0.5) return cos((2.*M_PI)*x)*M_PI*M_PI; return 0.; } /* end of sin0_dpdf() */ /* The CDF of our distribution: */ double sin0_cdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { if (x < -1.) return 0.; if(x<= -0.5) return 0.25*(1-cos((2.*M_PI)*x)); if (x < 0.) return 0.5; if (x <= 0.5) return 0.75-0.25*cos((2.*M_PI)*x); return 1.; } /* end of sin0_cdf() */ /*****************************************************************************/ /* run unur_test_u_error for a particular generator object and print result */ int hinv_error_gen_experiment( UNUR_GEN *gen, /* generator object */ double u_resolution, /* maximal tolerated u-error */ int order, /* order of polynomial */ int samplesize ) /* sample size for error experiment */ /* returns 0 if maxerror < u_resolution, errorcode otherwise */ { int i, nfpar; const double *fpar; const UNUR_DISTR *distr = unur_get_distr(gen); const char *genid = unur_get_genid(gen); double score; /* print data about distribution */ fprintf(TESTLOG,"%s: %s distribution",genid,unur_distr_get_name(distr)); nfpar = unur_distr_cont_get_pdfparams(distr,&fpar); if (nfpar) { fprintf(TESTLOG," with parameters "); for(i=0;i 1.e-13; u_resolution *= 0.01 ) { for ( order=(u_resolution<1.e-9 ? 3:1); order<=5; order+=2) { /* make a working copy */ par_clone = _unur_par_clone(par); /* create generator object */ unur_hinv_set_order(par_clone,order); unur_hinv_set_u_resolution(par_clone,u_resolution); set_debug_flag(par_clone); gen = unur_init(par_clone); /* run test */ errorsum += hinv_error_gen_experiment(gen, u_resolution, order, samplesize); fprintf(TESTLOG,"\n"); /* clear memory */ unur_free(gen); } } unur_par_free(par); return errorsum; } /* end of hinv_error_experiment() */ /*****************************************************************************/ /* run test with truncated distributions */ int chg_domain_experiment( UNUR_PAR *par, /* generator object */ int samplesize ) /* sample size for experiment */ /* returns 0 if maxerror < u_resolution, errorcode otherwise */ { int k; int result = 0; UNUR_GEN *gen; /* generator object */ double left, right; /* border of userdefined original domain */ double newleft, newright; double u_resolution = 1.e-10; /* maximal tolerated u-error */ int order = 3; /* order of polynomial */ unur_hinv_set_order(par,order); unur_hinv_set_u_resolution(par,u_resolution); gen = unur_init(par); unur_distr_cont_get_domain(unur_get_distr(gen), &left, &right ); if (left <= UNUR_INFINITY) left = unur_hinv_eval_approxinvcdf(gen, 1.e-10); if (right >= UNUR_INFINITY) right = unur_hinv_eval_approxinvcdf(gen, 1-1.e-10); for(k=1; k<=10;k++){ newleft = left + k*0.05*(right-left); newright = right - k*0.04*(right-left); unur_hinv_chg_truncated(gen, newleft, newright); result += hinv_error_gen_experiment(gen, u_resolution, order, samplesize/10); } unur_hinv_chg_truncated(gen, left, right); result += hinv_error_gen_experiment(gen, u_resolution, order, samplesize/10); unur_free(gen); return result; } /* end of chg_domain_experiment() */ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,60,(unur_hinv_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,60,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,66,(unur_hinv_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,66,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* data missing in distribution object */ UNUR_DISTR *distr = NULL; distr = unur_distr_cont_new(); unur_reset_errno(); /* cdf */ n_tests_failed += (check_expected_NULL(TESTLOG,73,(unur_hinv_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,73,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [set] */ void test_set (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[set "); fflush(stdout); fprintf(TESTLOG,"\n[set]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; double stp[] = {1.,2.,3.}; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,84,(unur_hinv_set_order( par, 3 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,84,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,87,(unur_hinv_set_u_resolution( par, 1.e-8 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,87,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,90,(unur_hinv_set_cpoints(par,stp,3)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,90,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,93,(unur_hinv_set_boundary(par,1.,3.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,93,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,96,(unur_hinv_set_guidefactor( par, 2. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,96,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,99,(unur_hinv_set_max_intervals(par,10000)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,99,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* invalid parameter object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double fpar[2] = {0.,1.}; double stp[] = {1.,2.,3.}; distr = unur_distr_normal(fpar,2); par = unur_arou_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,108,(unur_hinv_set_order( par, 3 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,108,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,111,(unur_hinv_set_u_resolution( par, 1.e-8 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,111,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,114,(unur_hinv_set_cpoints(par,stp,3)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,114,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,117,(unur_hinv_set_boundary(par,1.,3.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,117,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,120,(unur_hinv_set_guidefactor( par, 2. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,120,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,123,(unur_hinv_set_max_intervals(par,10000)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,123,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double fpar[2] = {0.,1.}; double stp[] = {1.,2.,-3.}; distr = unur_distr_normal(fpar,2); par = unur_hinv_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,134,(unur_hinv_set_order( par, 30 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,134,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,137,(unur_hinv_set_u_resolution( par, 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,137,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,140,(unur_hinv_set_cpoints(par,stp,3)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,140,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,143,(unur_hinv_set_boundary(par,1.,-3.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,143,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,146,(unur_hinv_set_boundary(par,1.,UNUR_INFINITY)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,146,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,149,(unur_hinv_set_guidefactor( par, -2. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,149,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,152,(unur_hinv_set_max_intervals(par,0)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,152,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_set() */ /*---------------------------------------------------------------------------*/ /* [get] */ void test_get (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[get "); fflush(stdout); fprintf(TESTLOG,"\n[get]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid generator object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_tdr_new(distr); gen = unur_init(par); abort_if_NULL(TESTLOG, 162, gen ); unur_reset_errno(); n_tests_failed += (check_expected_zero(TESTLOG,166,(unur_hinv_get_n_intervals(gen)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,166,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_get() */ /*---------------------------------------------------------------------------*/ /* [chg] */ void test_chg (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[chg "); fflush(stdout); fprintf(TESTLOG,"\n[chg]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid generator object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); unur_distr_cont_set_domain(distr,-1.,2.); par = unur_hinv_new(distr); unur_set_debug(par,0); gen = unur_init( par ); abort_if_NULL(TESTLOG, 178, gen ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,182,(unur_hinv_chg_truncated( gen, 1., 0. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,182,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_hinv_chg_truncated( gen, -2., 0. ); n_tests_failed += (check_errorcode(TESTLOG,185,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_hinv_chg_truncated( gen, 0., 10. ); n_tests_failed += (check_errorcode(TESTLOG,188,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_chg() */ /*---------------------------------------------------------------------------*/ /* [reinit] */ void test_reinit (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[reinit "); fflush(stdout); fprintf(TESTLOG,"\n[reinit]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* exists */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_hinv_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 201, gen ); unur_reset_errno(); n_tests_failed += (check_expected_reinit(TESTLOG,205,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_reinit() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_GEN *gen = NULL; gen = NULL; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,215,(unur_hinv_eval_approxinvcdf(gen,0.5)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,215,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_free(gen); } { /* invalid generator object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_tdr_new(distr); gen = unur_init(par); abort_if_NULL(TESTLOG, 221, gen ); unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,225,(unur_hinv_eval_approxinvcdf(gen,0.5)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,225,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* invalid domain */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_hinv_new(distr); unur_set_debug(par,0); gen = unur_init( par ); abort_if_NULL(TESTLOG, 231, gen ); unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,235,(unur_hinv_eval_approxinvcdf(gen,1.5)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,235,UNUR_ERR_DOMAIN)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_negINFINITY(TESTLOG,238,(unur_hinv_eval_approxinvcdf(gen,-0.5)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,238,UNUR_ERR_DOMAIN)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; UNUR_GEN *clone; distr = unur_distr_normal(NULL,0); par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_hinv_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,251,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,257,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare reinit */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_hinv_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,269,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* reinit */ unur_reinit(gen); n_tests_failed += (compare_sequence_gen(TESTLOG,273,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare stringparser */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[] = {3.,4.}; distr = NULL; par = NULL; gen = NULL; unur_reset_errno(); distr = unur_distr_gamma(fpar,2); unur_distr_cont_set_domain(distr,2.,UNUR_INFINITY); par = unur_hinv_new(distr); set_debug_flag(par); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,289,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "gamma(3.,4.); domain = 2,infinity & \ method = hinv; debug = 0x1" ); n_tests_failed += (compare_sequence_gen(TESTLOG,295,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; distr = unur_distr_normal(NULL,0); unur_distr_cont_set_domain(distr,2.,UNUR_INFINITY); par = unur_hinv_new(distr); unur_hinv_set_order(par,1); unur_hinv_set_max_intervals(par,1000); unur_hinv_set_u_resolution(par,0.001); unur_hinv_set_boundary(par,2.,5.); set_debug_flag(par); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,308,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "normal; domain = (2,inf) & \ method = hinv; order = 1; max_intervals = 1000; u_resolution = 0.001; \ boundary = (2,5); debug = 0x1" ); n_tests_failed += (compare_sequence_gen(TESTLOG,315,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* [validate] */ /*---------------------------------------------------------------------------*/ /* [validate] */ void test_validate (void) { /* suppress GCC compiler warning */ GCC_DIAG_OFF(unused-variable) UNUR_DISTR *distr[44]; UNUR_PAR *par; UNUR_GEN *gen; double *darray; double fpm[10]; int n_tests_failed; int rcode; /* start test */ printf("[validate "); fflush(stdout); fprintf(TESTLOG,"\n[validate]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* distributions: 44 */ { fpm[0] = 1.; fpm[1] = 2.; distr[0] = unur_distr_beta(fpm,2); } { fpm[0] = 1.; fpm[1] = 5.; distr[1] = unur_distr_beta(fpm,2); } { fpm[0] = 1.; fpm[1] = 100.; distr[2] = unur_distr_beta(fpm,2); } { fpm[0] = 3.; fpm[1] = 4.; distr[3] = unur_distr_beta(fpm,2); } { fpm[0] = 5.; fpm[1] = 100.; distr[4] = unur_distr_beta(fpm,2); } { fpm[0] = 500.; fpm[1] = 300.; distr[5] = unur_distr_beta(fpm,2); } { fpm[0] = 5.; fpm[1] = 10.; fpm[2] = -3.; fpm[3] = 15.; distr[6] = unur_distr_beta(fpm,4); } { fpm[0] = 0.5; fpm[1] = 3.; distr[28] = unur_distr_beta(fpm,2); } { fpm[0] = 5.; fpm[1] = 0.3; distr[29] = unur_distr_beta(fpm,2); } { fpm[0] = 0.5; fpm[1] = 0.4; distr[30] = unur_distr_beta(fpm,2); } { distr[7] = unur_distr_cauchy(NULL,0); } { fpm[0] = 1.; fpm[1] = 20.; distr[8] = unur_distr_cauchy(fpm,2); } { distr[24] = unur_distr_exponential(NULL,0); } { fpm[0] = 30.; fpm[1] = -5.; distr[25] = unur_distr_exponential(fpm,2); } { fpm[0] = 1.; distr[9] = unur_distr_gamma(fpm,1); } { fpm[0] = 2.; distr[10] = unur_distr_gamma(fpm,1); } { fpm[0] = 3.; distr[11] = unur_distr_gamma(fpm,1); } { fpm[0] = 10.; distr[12] = unur_distr_gamma(fpm,1); } { fpm[0] = 1000.; distr[13] = unur_distr_gamma(fpm,1); } { fpm[0] = 5.; fpm[1] = 1000.; distr[14] = unur_distr_gamma(fpm,2); } { fpm[0] = 5.; fpm[1] = 1.e-5; distr[15] = unur_distr_gamma(fpm,2); } { fpm[0] = 5.; fpm[1] = 10.; fpm[2] = 1000; distr[16] = unur_distr_gamma(fpm,3); } { fpm[0] = 0.5; distr[31] = unur_distr_gamma(fpm,1); } { fpm[0] = 0.2; distr[32] = unur_distr_gamma(fpm,1); } { distr[26] = unur_distr_laplace(NULL,0); } { fpm[0] = -10.; fpm[1] = 100.; distr[27] = unur_distr_laplace(fpm,2); } { distr[17] = unur_distr_normal(NULL,0); } { fpm[0] = 1.; fpm[1] = 1.e-5; distr[18] = unur_distr_normal(fpm,2); } { fpm[0] = 0.; fpm[1] = 1.e+5; distr[19] = unur_distr_normal(fpm,2); } { distr[20] = unur_distr_uniform(NULL,0); } { fpm[0] = 1.; fpm[1] = 20.; distr[21] = unur_distr_uniform(fpm,2); } { fpm[0] = 1.; fpm[1] = 10.; distr[35] = unur_distr_F(fpm,2); } { fpm[0] = 2.; fpm[1] = 10.; distr[36] = unur_distr_F(fpm,2); } { fpm[0] = 4.; fpm[1] = 10.; distr[37] = unur_distr_F(fpm,2); } { fpm[0] = 10.; fpm[1] = 10.; distr[38] = unur_distr_F(fpm,2); } { fpm[0] = 10.; fpm[1] = 1; distr[40] = unur_distr_F(fpm,2); } { fpm[0] = 0.1; fpm[1] = 10.; distr[43] = unur_distr_F(fpm,2); } { distr[22] = unur_distr_cauchy(NULL,0); unur_distr_cont_set_domain(distr[22],0.1,1.); unur_distr_cont_upd_mode(distr[22]); unur_distr_cont_upd_pdfarea(distr[22]); } { fpm[0] = 3.; fpm[1] = 4.; distr[23] = unur_distr_beta(fpm,2); unur_distr_cont_set_domain(distr[23],-2.,5.); } { distr[33] = unur_distr_cont_new(); unur_distr_cont_set_cdf( distr[33], sin_cdf ); unur_distr_cont_set_pdf( distr[33], sin_pdf ); unur_distr_cont_set_dpdf( distr[33], sin_dpdf ); unur_distr_cont_set_domain( distr[33], -1., 1. ); } { distr[34] = unur_distr_cont_new(); unur_distr_cont_set_cdf( distr[34], sin0_cdf ); unur_distr_cont_set_pdf( distr[34], sin0_pdf ); unur_distr_cont_set_dpdf( distr[34], sin0_dpdf ); unur_distr_cont_set_domain( distr[34], -1., 1. ); } { distr[39] = unur_distr_cont_new(); unur_distr_cont_set_cdfstr(distr[39], "(x<=2)*(0.5-x+0.5*x*x)+(x>2)*(-3.5+3*x-0.5*x*x)"); unur_distr_cont_set_domain(distr[39],1.,3.); unur_distr_set_name(distr[39],"triangular-string"); } { distr[41] = unur_distr_cont_new(); unur_distr_cont_set_cdfstr(distr[41], "(x<=2)*(0.5-x+0.5*x*x)+(x>2)*(-3.5+3*x-0.5*x*x)"); unur_distr_cont_set_domain(distr[41],1.,5.); unur_distr_set_name(distr[41],"triangular-invalid-string"); } { distr[42] = unur_distr_cont_new(); unur_distr_cont_set_cdfstr(distr[42], "(x<=2)*(0.5-x+0.5*x*x)+(x>2)*(-3.5+3*x-0.5*x*x)"); unur_distr_cont_set_domain(distr[42],-1.,3.); unur_distr_set_name(distr[42],"triangular-invalid-string"); } /* timing */ stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); printf("\n(chi^2) "); fflush(stdout); /* chi^2 tests: 396 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nChi^2 Test:\n"); /* distribution [0] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,1); unur_hinv_set_u_resolution(par,1.e-8); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); if (gen) { unur_hinv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-12); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.25; fpm[2]= 0.25; fpm[3]= 0.75; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.5; fpm[2]= 0.; fpm[3]= 0.25; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,1); unur_hinv_set_u_resolution(par,1.e-8); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); if (gen) { unur_hinv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-12); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.25; fpm[2]= 0.25; fpm[3]= 0.75; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.5; fpm[2]= 0.; fpm[3]= 0.25; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [2] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,1); unur_hinv_set_u_resolution(par,1.e-8); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-12); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.25; fpm[2]= 0.25; fpm[3]= 0.75; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.5; fpm[2]= 0.; fpm[3]= 0.25; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [3] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,1); unur_hinv_set_u_resolution(par,1.e-8); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); if (gen) { unur_hinv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-12); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.25; fpm[2]= 0.25; fpm[3]= 0.75; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.5; fpm[2]= 0.; fpm[3]= 0.25; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [4] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,1); unur_hinv_set_u_resolution(par,1.e-8); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-12); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.25; fpm[2]= 0.25; fpm[3]= 0.75; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.5; fpm[2]= 0.; fpm[3]= 0.25; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [5] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,1); unur_hinv_set_u_resolution(par,1.e-8); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); if (gen) { unur_hinv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-12); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.25; fpm[2]= 0.25; fpm[3]= 0.75; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.5; fpm[2]= 0.; fpm[3]= 0.25; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [6] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,1); unur_hinv_set_u_resolution(par,1.e-8); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); if (gen) { unur_hinv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-12); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.25; fpm[2]= 0.25; fpm[3]= 0.75; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.5; fpm[2]= 0.; fpm[3]= 0.25; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [28] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,1); unur_hinv_set_u_resolution(par,1.e-8); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); if (gen) { unur_hinv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-12); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.25; fpm[2]= 0.25; fpm[3]= 0.75; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.5; fpm[2]= 0.; fpm[3]= 0.25; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [29] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,1); unur_hinv_set_u_resolution(par,1.e-8); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); if (gen) { unur_hinv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-12); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.25; fpm[2]= 0.25; fpm[3]= 0.75; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.5; fpm[2]= 0.; fpm[3]= 0.25; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [30] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,1); unur_hinv_set_u_resolution(par,1.e-8); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); if (gen) { unur_hinv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-12); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.25; fpm[2]= 0.25; fpm[3]= 0.75; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.5; fpm[2]= 0.; fpm[3]= 0.25; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [7] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,1); unur_hinv_set_u_resolution(par,1.e-8); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); if (gen) { unur_hinv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-12); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.25; fpm[2]= 0.25; fpm[3]= 0.75; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.5; fpm[2]= 0.; fpm[3]= 0.25; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [8] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,1); unur_hinv_set_u_resolution(par,1.e-8); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); if (gen) { unur_hinv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-12); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.25; fpm[2]= 0.25; fpm[3]= 0.75; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.5; fpm[2]= 0.; fpm[3]= 0.25; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [24] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,1); unur_hinv_set_u_resolution(par,1.e-8); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); if (gen) { unur_hinv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-12); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.25; fpm[2]= 0.25; fpm[3]= 0.75; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.5; fpm[2]= 0.; fpm[3]= 0.25; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [25] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,1); unur_hinv_set_u_resolution(par,1.e-8); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); if (gen) { unur_hinv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-12); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.25; fpm[2]= 0.25; fpm[3]= 0.75; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.5; fpm[2]= 0.; fpm[3]= 0.25; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [9] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,1); unur_hinv_set_u_resolution(par,1.e-8); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); if (gen) { unur_hinv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-12); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.25; fpm[2]= 0.25; fpm[3]= 0.75; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.5; fpm[2]= 0.; fpm[3]= 0.25; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [10] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,1); unur_hinv_set_u_resolution(par,1.e-8); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); if (gen) { unur_hinv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-12); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.25; fpm[2]= 0.25; fpm[3]= 0.75; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.5; fpm[2]= 0.; fpm[3]= 0.25; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [11] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,1); unur_hinv_set_u_resolution(par,1.e-8); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); if (gen) { unur_hinv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-12); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.25; fpm[2]= 0.25; fpm[3]= 0.75; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.5; fpm[2]= 0.; fpm[3]= 0.25; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [12] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,1); unur_hinv_set_u_resolution(par,1.e-8); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); if (gen) { unur_hinv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-12); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.25; fpm[2]= 0.25; fpm[3]= 0.75; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.5; fpm[2]= 0.; fpm[3]= 0.25; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [13] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,1); unur_hinv_set_u_resolution(par,1.e-8); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-12); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.25; fpm[2]= 0.25; fpm[3]= 0.75; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.5; fpm[2]= 0.; fpm[3]= 0.25; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [14] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,1); unur_hinv_set_u_resolution(par,1.e-8); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-12); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.25; fpm[2]= 0.25; fpm[3]= 0.75; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.5; fpm[2]= 0.; fpm[3]= 0.25; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [15] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,1); unur_hinv_set_u_resolution(par,1.e-8); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-12); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.25; fpm[2]= 0.25; fpm[3]= 0.75; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.5; fpm[2]= 0.; fpm[3]= 0.25; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [16] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,1); unur_hinv_set_u_resolution(par,1.e-8); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-12); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.25; fpm[2]= 0.25; fpm[3]= 0.75; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.5; fpm[2]= 0.; fpm[3]= 0.25; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [31] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,1); unur_hinv_set_u_resolution(par,1.e-8); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); if (gen) { unur_hinv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-12); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.25; fpm[2]= 0.25; fpm[3]= 0.75; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.5; fpm[2]= 0.; fpm[3]= 0.25; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [32] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,1); unur_hinv_set_u_resolution(par,1.e-8); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); if (gen) { unur_hinv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-12); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.25; fpm[2]= 0.25; fpm[3]= 0.75; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.5; fpm[2]= 0.; fpm[3]= 0.25; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [26] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,1); unur_hinv_set_u_resolution(par,1.e-8); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); if (gen) { unur_hinv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-12); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.25; fpm[2]= 0.25; fpm[3]= 0.75; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.5; fpm[2]= 0.; fpm[3]= 0.25; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [27] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,1); unur_hinv_set_u_resolution(par,1.e-8); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); if (gen) { unur_hinv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-12); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.25; fpm[2]= 0.25; fpm[3]= 0.75; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.5; fpm[2]= 0.; fpm[3]= 0.25; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [17] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,1); unur_hinv_set_u_resolution(par,1.e-8); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); if (gen) { unur_hinv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-12); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.25; fpm[2]= 0.25; fpm[3]= 0.75; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.5; fpm[2]= 0.; fpm[3]= 0.25; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [18] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,1); unur_hinv_set_u_resolution(par,1.e-8); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-12); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.25; fpm[2]= 0.25; fpm[3]= 0.75; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.5; fpm[2]= 0.; fpm[3]= 0.25; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [19] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,1); unur_hinv_set_u_resolution(par,1.e-8); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); if (gen) { unur_hinv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-12); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.25; fpm[2]= 0.25; fpm[3]= 0.75; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.5; fpm[2]= 0.; fpm[3]= 0.25; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [20] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,1); unur_hinv_set_u_resolution(par,1.e-8); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); if (gen) { unur_hinv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-12); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.25; fpm[2]= 0.25; fpm[3]= 0.75; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.5; fpm[2]= 0.; fpm[3]= 0.25; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [21] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,1); unur_hinv_set_u_resolution(par,1.e-8); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-12); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.25; fpm[2]= 0.25; fpm[3]= 0.75; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.5; fpm[2]= 0.; fpm[3]= 0.25; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [35] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,1); unur_hinv_set_u_resolution(par,1.e-8); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); if (gen) { unur_hinv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-12); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.25; fpm[2]= 0.25; fpm[3]= 0.75; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.5; fpm[2]= 0.; fpm[3]= 0.25; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [36] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,1); unur_hinv_set_u_resolution(par,1.e-8); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); if (gen) { unur_hinv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-12); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.25; fpm[2]= 0.25; fpm[3]= 0.75; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.5; fpm[2]= 0.; fpm[3]= 0.25; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [37] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[37]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,1); unur_hinv_set_u_resolution(par,1.e-8); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[37],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[37]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[37],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[37]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[37],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[37]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); if (gen) { unur_hinv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[37],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[37]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-12); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[37],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[37]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.25; fpm[2]= 0.25; fpm[3]= 0.75; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[37],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[37]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.5; fpm[2]= 0.; fpm[3]= 0.25; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[37],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[37]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[37],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[37]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[37],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [38] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[38]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,1); unur_hinv_set_u_resolution(par,1.e-8); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[38],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[38]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[38],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[38]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[38],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[38]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); if (gen) { unur_hinv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[38],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[38]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-12); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[38],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[38]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.25; fpm[2]= 0.25; fpm[3]= 0.75; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[38],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[38]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.5; fpm[2]= 0.; fpm[3]= 0.25; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[38],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[38]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[38],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[38]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[38],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [40] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[40]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,1); unur_hinv_set_u_resolution(par,1.e-8); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[40],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[40]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[40],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[40]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[40],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[40]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); if (gen) { unur_hinv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[40],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[40]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-12); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[40],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[40]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.25; fpm[2]= 0.25; fpm[3]= 0.75; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[40],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[40]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.5; fpm[2]= 0.; fpm[3]= 0.25; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[40],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[40]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[40],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[40]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[40],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [43] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[43]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,1); unur_hinv_set_u_resolution(par,1.e-8); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[43],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[43]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[43],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[43]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[43],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[43]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); if (gen) { unur_hinv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[43],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[43]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-12); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[43],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[43]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.25; fpm[2]= 0.25; fpm[3]= 0.75; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[43],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[43]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.5; fpm[2]= 0.; fpm[3]= 0.25; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[43],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[43]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[43],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[43]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[43],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [22] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,1); unur_hinv_set_u_resolution(par,1.e-8); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); if (gen) { unur_hinv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-12); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.25; fpm[2]= 0.25; fpm[3]= 0.75; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.5; fpm[2]= 0.; fpm[3]= 0.25; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [23] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,1); unur_hinv_set_u_resolution(par,1.e-8); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); if (gen) { unur_hinv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-12); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.25; fpm[2]= 0.25; fpm[3]= 0.75; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.5; fpm[2]= 0.; fpm[3]= 0.25; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [33] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,1); unur_hinv_set_u_resolution(par,1.e-8); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); if (gen) { unur_hinv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-12); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.25; fpm[2]= 0.25; fpm[3]= 0.75; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [34] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,1); unur_hinv_set_u_resolution(par,1.e-8); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); if (gen) { unur_hinv_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-12); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.5; fpm[2]= 0.; fpm[3]= 0.25; unur_hinv_set_cpoints(par,fpm,4); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); { UNUR_DISTR *dg =NULL; par = unur_hinv_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [39] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[39]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,1); unur_hinv_set_u_resolution(par,1.e-8); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[39],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[39]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[39],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[39]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[39],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [41] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[41]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,1); unur_hinv_set_u_resolution(par,1.e-8); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[41],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[41]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[41],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[41]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[41],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [42] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[42]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,1); unur_hinv_set_u_resolution(par,1.e-8); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[42],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[42]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[42],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[42]); par = unur_hinv_new(distr_localcopy); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[42],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); /* free distributions */ unur_distr_free(distr[0]); unur_distr_free(distr[1]); unur_distr_free(distr[2]); unur_distr_free(distr[3]); unur_distr_free(distr[4]); unur_distr_free(distr[5]); unur_distr_free(distr[6]); unur_distr_free(distr[7]); unur_distr_free(distr[8]); unur_distr_free(distr[9]); unur_distr_free(distr[10]); unur_distr_free(distr[11]); unur_distr_free(distr[12]); unur_distr_free(distr[13]); unur_distr_free(distr[14]); unur_distr_free(distr[15]); unur_distr_free(distr[16]); unur_distr_free(distr[17]); unur_distr_free(distr[18]); unur_distr_free(distr[19]); unur_distr_free(distr[20]); unur_distr_free(distr[21]); unur_distr_free(distr[22]); unur_distr_free(distr[23]); unur_distr_free(distr[24]); unur_distr_free(distr[25]); unur_distr_free(distr[26]); unur_distr_free(distr[27]); unur_distr_free(distr[28]); unur_distr_free(distr[29]); unur_distr_free(distr[30]); unur_distr_free(distr[31]); unur_distr_free(distr[32]); unur_distr_free(distr[33]); unur_distr_free(distr[34]); unur_distr_free(distr[35]); unur_distr_free(distr[36]); unur_distr_free(distr[37]); unur_distr_free(distr[38]); unur_distr_free(distr[39]); unur_distr_free(distr[40]); unur_distr_free(distr[41]); unur_distr_free(distr[42]); unur_distr_free(distr[43]); /* test finished */ test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; /* we accept CHI2_FAILURES_TOLERATED failures */ (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_validate */ /* enable GCC compiler warning */ GCC_DIAG_ON(unused-variable) /*---------------------------------------------------------------------------*/ /* [special] */ void test_special (void) { /* set boolean to FALSE */ int FAILED = 0; int samplesize = UERROR_SAMPLESIZE; int errorsum = 0; double fpar[4]; double cpoints[10]; UNUR_DISTR *distr; UNUR_PAR *par; /* start test */ printf("[special "); fflush(stdout); fprintf(TESTLOG,"\n[special]\n"); /* set stop watch */ stopwatch_lap(&watch); /* test for maximal u-error */ printf("\ntest maximal u-error: "); fprintf(TESTLOG,"\nTest maximal u-error:\n"); distr = unur_distr_normal(NULL,0); par = unur_hinv_new(distr); errorsum += hinv_error_experiment(par,samplesize); unur_distr_free(distr); distr = unur_distr_cauchy(NULL,0); par = unur_hinv_new(distr); errorsum += hinv_error_experiment(par,samplesize); unur_distr_free(distr); distr = unur_distr_exponential(NULL,0); par = unur_hinv_new(distr); errorsum += hinv_error_experiment(par,samplesize); unur_distr_free(distr); fpar[0]= 5.; distr = unur_distr_gamma(fpar,1); par = unur_hinv_new(distr); errorsum += hinv_error_experiment(par,samplesize); unur_distr_free(distr); fpar[0]= 0.5; distr = unur_distr_gamma(fpar,1); par = unur_hinv_new(distr); errorsum += hinv_error_experiment(par,samplesize); unur_distr_free(distr); fpar[0]=2.; fpar[1]=2.;fpar[2]= 0.; fpar[3]=1.; distr = unur_distr_beta(fpar,4); par = unur_hinv_new(distr); errorsum += hinv_error_experiment(par,samplesize); unur_distr_free(distr); fpar[0]=0.3; fpar[1]=3.;fpar[2]= 0.; fpar[3]=1.; distr = unur_distr_beta(fpar,4); par = unur_hinv_new(distr); errorsum += hinv_error_experiment(par,samplesize); unur_distr_free(distr); distr = unur_distr_cont_new(); unur_distr_set_name(distr,"sin-example"); unur_distr_cont_set_cdf( distr, sin_cdf ); unur_distr_cont_set_pdf( distr, sin_pdf ); unur_distr_cont_set_dpdf( distr, sin_dpdf ); unur_distr_cont_set_domain( distr, -1., 1. ); cpoints[0]= -0.75; cpoints[1]= -0.25; cpoints[2]= 0.25; cpoints[3]= 0.75; par = unur_hinv_new(distr); unur_hinv_set_cpoints(par, cpoints, 4); errorsum += hinv_error_experiment(par,samplesize); unur_distr_free(distr); distr = unur_distr_cont_new(); unur_distr_set_name(distr,"sin-0-example"); unur_distr_cont_set_cdf( distr, sin0_cdf ); unur_distr_cont_set_pdf( distr, sin0_pdf ); unur_distr_cont_set_dpdf( distr, sin0_dpdf ); unur_distr_cont_set_domain( distr, -1., 0.5 ); cpoints[0]= -0.75; cpoints[1]= -0.5; cpoints[2]= 0.; cpoints[3]= 0.25; par = unur_hinv_new(distr); unur_hinv_set_cpoints(par, cpoints, 4); errorsum += hinv_error_experiment(par,samplesize); unur_distr_free(distr); /* extra test for changeing the domain of the generator object */ printf("\ntest unur_chg_truncated(): "); fprintf(TESTLOG,"\nTests unur_chg_truncated():\n\n"); printf(" normal"); distr = unur_distr_normal(NULL,0); par = unur_hinv_new(distr); errorsum += chg_domain_experiment(par,samplesize); unur_distr_free(distr); fprintf(TESTLOG,"\n"); /****/ printf(" sinus1"); distr = unur_distr_cont_new(); unur_distr_set_name(distr,"sin-example"); unur_distr_cont_set_cdf( distr, sin_cdf ); unur_distr_cont_set_pdf( distr, sin_pdf ); unur_distr_cont_set_dpdf( distr, sin_dpdf ); unur_distr_cont_set_domain( distr, -1., 1. ); cpoints[0]= -0.75; cpoints[1]= -0.25; cpoints[2]= 0.25; cpoints[3]= 0.75; par = unur_hinv_new(distr); unur_hinv_set_cpoints(par, cpoints, 4); errorsum += chg_domain_experiment(par,samplesize); unur_distr_free(distr); fprintf(TESTLOG,"\n"); /****/ printf(" sinus2"); distr = unur_distr_cont_new(); unur_distr_set_name(distr,"sin-0-example"); unur_distr_cont_set_cdf( distr, sin0_cdf ); unur_distr_cont_set_pdf( distr, sin0_pdf ); unur_distr_cont_set_dpdf( distr, sin0_dpdf ); unur_distr_cont_set_domain( distr, -1., 0.5 ); cpoints[0]= -0.75; cpoints[1]= -0.5; cpoints[2]= 0.; cpoints[3]= 0.25; par = unur_hinv_new(distr); unur_hinv_set_cpoints(par, cpoints, 4); errorsum += chg_domain_experiment(par,samplesize); unur_distr_free(distr); fprintf(TESTLOG,"\n"); /* test finished */ FAILED = (errorsum < 2) ? 0 : 1; /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (FAILED) ? 0 : 1; (FAILED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_special() */ /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_hinv_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_x_gen.conf0000644001357500135600000000545014420445767013512 00000000000000############################################################################# [main] [main - data:] # method (for information only: the program scans the file name) method: X_GEN [main - header:] /* prototypes */ \#define COMPARE_SAMPLE_SIZE (500) \#define VIOLATE_SAMPLE_SIZE (20) ############################################################################# [new] ############################################################################# # [set] ############################################################################# [get] [get - invalid NULL: ] unur_get_genid(NULL) --> expected_NULL unur_get_method(NULL) --> expected_zero ############################################################################# # [chg] ############################################################################## # [init] ############################################################################# # [reinit] ############################################################################# [sample] [sample - invalid generator object: distr = unur_distr_normal(NULL,0); par = unur_tdr_new(distr); gen = unur_init( par ); <-- ! NULL ] unur_quantile(gen,0.5); --> expected_INFINITY --> UNUR_ERR_NO_QUANTILE [sample - CSTD quantile function: distr = unur_distr_normal(NULL,0); par = unur_cstd_new(distr); unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION); gen = unur_init( par ); <-- ! NULL ] unur_quantile(gen,0.5); --> none --> UNUR_SUCCESS [sample - DGT quantile function: double fpar[2] = {10.,0.63}; distr = unur_distr_binomial(fpar,2); par = unur_dgt_new(distr); gen = unur_init( par ); <-- ! NULL ] unur_quantile(gen,0.5); --> none --> UNUR_SUCCESS [sample - DSTD quantile function: double fpar[1] = {0.3}; distr = unur_distr_geometric(fpar,1); par = unur_dstd_new(distr); unur_dstd_set_variant(par,UNUR_STDGEN_INVERSION); gen = unur_init( par ); <-- ! NULL ] unur_quantile(gen,0.5); --> none --> UNUR_SUCCESS [sample - HINV quantile function: distr = unur_distr_normal(NULL,0); par = unur_hinv_new(distr); gen = unur_init( par ); <-- ! NULL ] unur_quantile(gen,0.5); --> none --> UNUR_SUCCESS [sample - NINV quantile function: distr = unur_distr_normal(NULL,0); par = unur_ninv_new(distr); gen = unur_init( par ); <-- ! NULL ] unur_quantile(gen,0.5); --> none --> UNUR_SUCCESS [sample - PINV quantile function: distr = unur_distr_normal(NULL,0); par = unur_pinv_new(distr); gen = unur_init( par ); <-- ! NULL ] unur_quantile(gen,0.5); --> none --> UNUR_SUCCESS ############################################################################# # [validate] ############################################################################# # [special] ############################################################################# unuran-1.11.0/tests/t_x_gen.c0000644001357500135600000002456114430713513012777 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for X_GEN **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); int unur_x_gen_set_verify( UNUR_PAR *par, int verify); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ #define COMPARE_SAMPLE_SIZE (500) #define VIOLATE_SAMPLE_SIZE (20) /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [get] */ void test_get (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[get "); fflush(stdout); fprintf(TESTLOG,"\n[get]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL */ unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,33,(unur_get_genid(NULL)))==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_zero(TESTLOG,36,(unur_get_method(NULL)))==UNUR_SUCCESS)?0:1; } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_get() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid generator object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_tdr_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 56, gen ); unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,60,(unur_quantile(gen,0.5)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,60,UNUR_ERR_NO_QUANTILE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* CSTD quantile function */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_cstd_new(distr); unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION); gen = unur_init( par ); abort_if_NULL(TESTLOG, 66, gen ); unur_reset_errno(); unur_quantile(gen,0.5); n_tests_failed += (check_errorcode(TESTLOG,70,UNUR_SUCCESS)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* DGT quantile function */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[2] = {10.,0.63}; distr = unur_distr_binomial(fpar,2); par = unur_dgt_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 76, gen ); unur_reset_errno(); unur_quantile(gen,0.5); n_tests_failed += (check_errorcode(TESTLOG,80,UNUR_SUCCESS)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* DSTD quantile function */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[1] = {0.3}; distr = unur_distr_geometric(fpar,1); par = unur_dstd_new(distr); unur_dstd_set_variant(par,UNUR_STDGEN_INVERSION); gen = unur_init( par ); abort_if_NULL(TESTLOG, 87, gen ); unur_reset_errno(); unur_quantile(gen,0.5); n_tests_failed += (check_errorcode(TESTLOG,91,UNUR_SUCCESS)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* HINV quantile function */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_hinv_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 96, gen ); unur_reset_errno(); unur_quantile(gen,0.5); n_tests_failed += (check_errorcode(TESTLOG,100,UNUR_SUCCESS)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* NINV quantile function */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_ninv_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 105, gen ); unur_reset_errno(); unur_quantile(gen,0.5); n_tests_failed += (check_errorcode(TESTLOG,109,UNUR_SUCCESS)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* PINV quantile function */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_pinv_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 114, gen ); unur_reset_errno(); unur_quantile(gen,0.5); n_tests_failed += (check_errorcode(TESTLOG,118,UNUR_SUCCESS)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_x_gen_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_dstd.c0000644001357500135600000017243514430713513012641 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for DSTD **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); int unur_dstd_set_verify( UNUR_PAR *par, int verify); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ int estimate_uerror( UNUR_DISTR *distr, double u_resolution, int samplesize ); double cdf_geom(int k, const UNUR_DISTR *distr); int invcdf_geom(double u, const UNUR_DISTR *distr); /* -- constants -- */ /* sample size */ static const int UERROR_SAMPLESIZE = 100000; static const double UERROR_RESOLUTION = 1.e-14; #define COMPARE_SAMPLE_SIZE (500) #define VIOLATE_SAMPLE_SIZE (20) /* #define SEED (298346) */ /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ int estimate_uerror( UNUR_DISTR *distr, /* distribution object */ double u_resolution, /* maximal tolerated u-error */ int samplesize ) /* sample size for error experiment */ /* returns 0 if maxerror < u_resolution, errorcode otherwise */ { UNUR_PAR *par; UNUR_GEN *gen; int i, nfpar; const double *fpar; double score; /* print data about distribution */ fprintf(TESTLOG,"> %s (",unur_distr_get_name(distr)); nfpar = unur_distr_discr_get_pmfparams(distr,&fpar); for(i=0;i inversion method not implemented !!\n\n"); printf("0"); fflush(stdout); if (par) unur_par_free(par); unur_distr_free(distr); return 0; } /* initialize generator object */ gen = unur_init(par); /* run test */ score = run_validate_u_error( TESTLOG, gen, distr, u_resolution, samplesize ); /* clear working space */ unur_distr_free(distr); unur_free(gen); /* return */ fprintf(TESTLOG,"\n"); return score; } /* end of estimate_uerror() */ double cdf_geom(int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { const double p = 0.3; return ((k<0) ? 0. : (1. - pow(1. - p, k+1.)) ); } int invcdf_geom(double u, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { const double p = 0.3; return ((int) (log(u) / log(1.-p))); } /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,38,(unur_dstd_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,38,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; distr = unur_distr_cont_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,44,(unur_dstd_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,44,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* not a standard distribution */ UNUR_DISTR *distr = NULL; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,50,(unur_dstd_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,50,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [set] */ void test_set (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[set "); fflush(stdout); fprintf(TESTLOG,"\n[set]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,60,(unur_dstd_set_variant(par,1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,60,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* invalid parameter object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double fpar[1] = {0.5}; distr = unur_distr_geometric(fpar,1); par = unur_dgt_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,68,(unur_dstd_set_variant(par,1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,68,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double fpar[1] = {0.5}; distr = unur_distr_geometric(fpar,1); par = unur_dstd_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,78,(unur_dstd_set_variant(par,9999)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,78,UNUR_ERR_PAR_VARIANT)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_set() */ /*---------------------------------------------------------------------------*/ /* [chg] */ void test_chg (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[chg "); fflush(stdout); fprintf(TESTLOG,"\n[chg]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid generator object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[2] = {10,0.4}; distr = unur_distr_binomial(fpar,2); par = unur_dgt_new(distr); unur_set_debug(par,0); gen = unur_init( par ); abort_if_NULL(TESTLOG, 94, gen ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,98,(unur_dstd_chg_truncated(gen, 1, 5)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,98,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_chg() */ /*---------------------------------------------------------------------------*/ /* [init] */ void test_init (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[init "); fflush(stdout); fprintf(TESTLOG,"\n[init]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,108,(unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,108,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_init() */ /*---------------------------------------------------------------------------*/ /* [reinit] */ void test_reinit (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[reinit "); fflush(stdout); fprintf(TESTLOG,"\n[reinit]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* does not exist */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[2] = {10.,0.63}; distr = unur_distr_binomial(fpar,2); par = unur_dstd_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 118, gen ); unur_reset_errno(); n_tests_failed += (check_expected_reinit(TESTLOG,122,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_reinit() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* compare clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; UNUR_GEN *clone; double fpar[] = {10,0.3}; distr = unur_distr_binomial(fpar,2); par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_dstd_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,138,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,144,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare stringparser */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[] = {3.}; distr = NULL; par = NULL; gen = NULL; unur_reset_errno(); distr = unur_distr_poisson(fpar,1); par = unur_dstd_new(distr); unur_dstd_set_variant(par,2); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,158,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "poisson(3.) & method = dstd; variant = 2" ); n_tests_failed += (compare_sequence_gen(TESTLOG,163,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* [validate] */ /*---------------------------------------------------------------------------*/ /* [validate] */ void test_validate (void) { /* suppress GCC compiler warning */ GCC_DIAG_OFF(unused-variable) UNUR_DISTR *distr[30]; UNUR_PAR *par; UNUR_GEN *gen; double *darray; double fpm[10]; int n_tests_failed; int rcode; /* start test */ printf("[validate "); fflush(stdout); fprintf(TESTLOG,"\n[validate]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* distributions: 30 */ { fpm[0] = 50.; fpm[1] = 0.4; distr[1] = unur_distr_binomial(fpm,2); } { fpm[0] = 100.; fpm[1] = 0.87; distr[2] = unur_distr_binomial(fpm,2); } { fpm[0] = 100.; fpm[1] = 0.01; distr[3] = unur_distr_binomial(fpm,2); } { fpm[0] = 10000.; fpm[1] = 0.7 ; distr[4] = unur_distr_binomial(fpm,2); } { fpm[0] = 0.5; distr[0] = unur_distr_geometric(fpm,1); } { fpm[0] = 0.001; distr[11] = unur_distr_geometric(fpm,1); } { fpm[0] = 0.999; distr[12] = unur_distr_geometric(fpm,1); } { fpm[0] = 10000.; fpm[1] = 100. ; fpm[2] = 50. ; distr[5] = unur_distr_hypergeometric(fpm,3); } { fpm[0] = 10000.; fpm[1] = 9000. ; fpm[2] = 50. ; distr[6] = unur_distr_hypergeometric(fpm,3); } { fpm[0] = 10000.; fpm[1] = 80. ; fpm[2] = 90. ; distr[7] = unur_distr_hypergeometric(fpm,3); } { fpm[0] = 10000.; fpm[1] = 1000. ; fpm[2] = 150. ; distr[8] = unur_distr_hypergeometric(fpm,3); } { fpm[0] = 10000.; fpm[1] = 9000. ; fpm[2] = 500. ; distr[9] = unur_distr_hypergeometric(fpm,3); } { fpm[0] = 10000.; fpm[1] = 9000. ; fpm[2] = 250. ; distr[10] = unur_distr_hypergeometric(fpm,3); } { fpm[0] = 0.001; distr[25] = unur_distr_logarithmic(fpm,1); } { fpm[0] = 0.01; distr[13] = unur_distr_logarithmic(fpm,1); } { fpm[0] = 0.1; distr[14] = unur_distr_logarithmic(fpm,1); } { fpm[0] = 0.5; distr[15] = unur_distr_logarithmic(fpm,1); } { fpm[0] = 0.9; distr[16] = unur_distr_logarithmic(fpm,1); } { fpm[0] = 0.999; distr[17] = unur_distr_logarithmic(fpm,1); } { fpm[0] = 0.001; distr[18] = unur_distr_poisson(fpm,1); } { fpm[0] = 0.1; distr[19] = unur_distr_poisson(fpm,1); } { fpm[0] = 0.5; distr[20] = unur_distr_poisson(fpm,1); } { fpm[0] = 1.; distr[21] = unur_distr_poisson(fpm,1); } { fpm[0] = 10.; distr[22] = unur_distr_poisson(fpm,1); } { fpm[0] = 1000.; distr[23] = unur_distr_poisson(fpm,1); } { fpm[0] = 2.; fpm[1] = 3.; distr[28] = unur_distr_zipf(fpm,2); } { fpm[0] = 3.; fpm[1] = 2.; distr[29] = unur_distr_zipf(fpm,2); } { fpm[0] = 0.5; fpm[1] = 10.; distr[24] = unur_distr_negativebinomial(fpm,2); } { distr[26] = unur_distr_discr_new(); unur_distr_set_name( distr[26], "CDF_only" ); unur_distr_discr_set_domain( distr[26], 0, INT_MAX ); unur_distr_discr_set_cdf( distr[26], cdf_geom ); } { distr[27] = unur_distr_discr_new(); unur_distr_set_name( distr[27], "CDF&invCDF" ); unur_distr_discr_set_domain( distr[27], 0, INT_MAX ); unur_distr_discr_set_cdf( distr[27], cdf_geom ); unur_distr_discr_set_invcdf( distr[27], invcdf_geom ); } /* timing */ stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); printf("\n(chi^2) "); fflush(stdout); /* chi^2 tests: 210 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nChi^2 Test:\n"); /* distribution [1] */ if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_dstd_new(distr_localcopy); if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { UNUR_DISTR *dg =NULL; par = unur_dstd_new(distr_localcopy); fpm[0] = 20; fpm[1] = 0.5; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [2] */ if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_dstd_new(distr_localcopy); if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); { UNUR_DISTR *dg =NULL; par = unur_dstd_new(distr_localcopy); fpm[0] = 20; fpm[1] = 0.5; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [3] */ if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_dstd_new(distr_localcopy); if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); { UNUR_DISTR *dg =NULL; par = unur_dstd_new(distr_localcopy); fpm[0] = 20; fpm[1] = 0.5; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [4] */ if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_dstd_new(distr_localcopy); if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); { UNUR_DISTR *dg =NULL; par = unur_dstd_new(distr_localcopy); fpm[0] = 20; fpm[1] = 0.5; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [0] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_dstd_new(distr_localcopy); if (unur_dstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { UNUR_DISTR *dg =NULL; par = unur_dstd_new(distr_localcopy); fpm[0] = 0.2; fpm[1] = 0.5; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [11] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_dstd_new(distr_localcopy); if (unur_dstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); { UNUR_DISTR *dg =NULL; par = unur_dstd_new(distr_localcopy); fpm[0] = 0.2; fpm[1] = 0.5; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [12] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_dstd_new(distr_localcopy); if (unur_dstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); { UNUR_DISTR *dg =NULL; par = unur_dstd_new(distr_localcopy); fpm[0] = 0.2; fpm[1] = 0.5; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [5] */ if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_dstd_new(distr_localcopy); if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); { UNUR_DISTR *dg =NULL; par = unur_dstd_new(distr_localcopy); fpm[0] = 200; fpm[1] = 50; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [6] */ if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_dstd_new(distr_localcopy); if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); { UNUR_DISTR *dg =NULL; par = unur_dstd_new(distr_localcopy); fpm[0] = 200; fpm[1] = 50; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [7] */ if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_dstd_new(distr_localcopy); if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); { UNUR_DISTR *dg =NULL; par = unur_dstd_new(distr_localcopy); fpm[0] = 200; fpm[1] = 50; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [8] */ if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_dstd_new(distr_localcopy); if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); { UNUR_DISTR *dg =NULL; par = unur_dstd_new(distr_localcopy); fpm[0] = 200; fpm[1] = 50; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [9] */ if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_dstd_new(distr_localcopy); if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); { UNUR_DISTR *dg =NULL; par = unur_dstd_new(distr_localcopy); fpm[0] = 200; fpm[1] = 50; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [10] */ if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_dstd_new(distr_localcopy); if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); { UNUR_DISTR *dg =NULL; par = unur_dstd_new(distr_localcopy); fpm[0] = 200; fpm[1] = 50; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [25] */ if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_dstd_new(distr_localcopy); if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); { UNUR_DISTR *dg =NULL; par = unur_dstd_new(distr_localcopy); fpm[0] = 0.2; fpm[1] = 0.5; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [13] */ if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_dstd_new(distr_localcopy); if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); { UNUR_DISTR *dg =NULL; par = unur_dstd_new(distr_localcopy); fpm[0] = 0.2; fpm[1] = 0.5; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [14] */ if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_dstd_new(distr_localcopy); if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); { UNUR_DISTR *dg =NULL; par = unur_dstd_new(distr_localcopy); fpm[0] = 0.2; fpm[1] = 0.5; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [15] */ if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_dstd_new(distr_localcopy); if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); { UNUR_DISTR *dg =NULL; par = unur_dstd_new(distr_localcopy); fpm[0] = 0.2; fpm[1] = 0.5; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [16] */ if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_dstd_new(distr_localcopy); if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); { UNUR_DISTR *dg =NULL; par = unur_dstd_new(distr_localcopy); fpm[0] = 0.2; fpm[1] = 0.5; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [17] */ if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_dstd_new(distr_localcopy); if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); { UNUR_DISTR *dg =NULL; par = unur_dstd_new(distr_localcopy); fpm[0] = 0.2; fpm[1] = 0.5; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [18] */ if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_dstd_new(distr_localcopy); if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_dstd_new(distr_localcopy); if (unur_dstd_set_variant(par,2)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); { UNUR_DISTR *dg =NULL; par = unur_dstd_new(distr_localcopy); fpm[0] = 0.2; fpm[1] = 0.5; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); { UNUR_DISTR *dg =NULL; par = unur_dstd_new(distr_localcopy); fpm[0] = 20; fpm[1] = 0.5; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [19] */ if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_dstd_new(distr_localcopy); if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_dstd_new(distr_localcopy); if (unur_dstd_set_variant(par,2)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); { UNUR_DISTR *dg =NULL; par = unur_dstd_new(distr_localcopy); fpm[0] = 0.2; fpm[1] = 0.5; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); { UNUR_DISTR *dg =NULL; par = unur_dstd_new(distr_localcopy); fpm[0] = 20; fpm[1] = 0.5; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [20] */ if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_dstd_new(distr_localcopy); if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_dstd_new(distr_localcopy); if (unur_dstd_set_variant(par,2)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); { UNUR_DISTR *dg =NULL; par = unur_dstd_new(distr_localcopy); fpm[0] = 0.2; fpm[1] = 0.5; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); { UNUR_DISTR *dg =NULL; par = unur_dstd_new(distr_localcopy); fpm[0] = 20; fpm[1] = 0.5; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [21] */ if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_dstd_new(distr_localcopy); if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_dstd_new(distr_localcopy); if (unur_dstd_set_variant(par,2)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); { UNUR_DISTR *dg =NULL; par = unur_dstd_new(distr_localcopy); fpm[0] = 0.2; fpm[1] = 0.5; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); { UNUR_DISTR *dg =NULL; par = unur_dstd_new(distr_localcopy); fpm[0] = 20; fpm[1] = 0.5; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [22] */ if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_dstd_new(distr_localcopy); if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_dstd_new(distr_localcopy); if (unur_dstd_set_variant(par,2)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); { UNUR_DISTR *dg =NULL; par = unur_dstd_new(distr_localcopy); fpm[0] = 0.2; fpm[1] = 0.5; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); { UNUR_DISTR *dg =NULL; par = unur_dstd_new(distr_localcopy); fpm[0] = 20; fpm[1] = 0.5; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [23] */ if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_dstd_new(distr_localcopy); if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_dstd_new(distr_localcopy); if (unur_dstd_set_variant(par,2)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); { UNUR_DISTR *dg =NULL; par = unur_dstd_new(distr_localcopy); fpm[0] = 0.2; fpm[1] = 0.5; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); { UNUR_DISTR *dg =NULL; par = unur_dstd_new(distr_localcopy); fpm[0] = 20; fpm[1] = 0.5; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [28] */ if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_dstd_new(distr_localcopy); if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [29] */ if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_dstd_new(distr_localcopy); if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [26] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_dstd_new(distr_localcopy); if (unur_dstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [27] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_dstd_new(distr_localcopy); if (unur_dstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); /* free distributions */ unur_distr_free(distr[0]); unur_distr_free(distr[1]); unur_distr_free(distr[2]); unur_distr_free(distr[3]); unur_distr_free(distr[4]); unur_distr_free(distr[5]); unur_distr_free(distr[6]); unur_distr_free(distr[7]); unur_distr_free(distr[8]); unur_distr_free(distr[9]); unur_distr_free(distr[10]); unur_distr_free(distr[11]); unur_distr_free(distr[12]); unur_distr_free(distr[13]); unur_distr_free(distr[14]); unur_distr_free(distr[15]); unur_distr_free(distr[16]); unur_distr_free(distr[17]); unur_distr_free(distr[18]); unur_distr_free(distr[19]); unur_distr_free(distr[20]); unur_distr_free(distr[21]); unur_distr_free(distr[22]); unur_distr_free(distr[23]); unur_distr_free(distr[24]); unur_distr_free(distr[25]); unur_distr_free(distr[26]); unur_distr_free(distr[27]); unur_distr_free(distr[28]); unur_distr_free(distr[29]); /* test finished */ test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; /* we accept CHI2_FAILURES_TOLERATED failures */ (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_validate */ /* enable GCC compiler warning */ GCC_DIAG_ON(unused-variable) /*---------------------------------------------------------------------------*/ /* [special] */ void test_special (void) { /* set boolean to FALSE */ int FAILED = 0; int samplesize = UERROR_SAMPLESIZE; double ures = UERROR_RESOLUTION; int errorsum = 0; double fpar[5]; UNUR_DISTR *distr; /* start test */ printf("[special "); fflush(stdout); fprintf(TESTLOG,"\n[special]\n"); /* set stop watch */ stopwatch_lap(&watch); /* test for maximal u-error */ printf("\n[test maximal u-error for inversion method]\n"); fprintf(TESTLOG,"\n* Test maximal u-error for inversion method *\n"); printf(" binomial"); fpar[0] = 20; fpar[1] = 0.2; distr = unur_distr_binomial(fpar,2); errorsum += estimate_uerror(distr,ures,samplesize); fpar[0] = 10000; fpar[1] = 0.2; distr = unur_distr_binomial(fpar,2); errorsum += estimate_uerror(distr,ures,samplesize); printf(" geometric"); fpar[0] = 0.1; distr = unur_distr_geometric(fpar,1); errorsum += estimate_uerror(distr,ures,samplesize); printf(" hypergeometric"); fpar[0] = 10000; fpar[1] = 1000; fpar[2] = 150; distr = unur_distr_hypergeometric(fpar,3); errorsum += estimate_uerror(distr,ures,samplesize); printf(" negativebinomial"); fpar[0] = 0.2; fpar[1] = 20; distr = unur_distr_negativebinomial(fpar,2); errorsum += estimate_uerror(distr,ures,samplesize); fpar[0] = 0.2; fpar[1] = 10000; distr = unur_distr_negativebinomial(fpar,2); errorsum += estimate_uerror(distr,ures,samplesize); printf(" poisson"); fpar[0] = 0.1; distr = unur_distr_poisson(fpar,1); errorsum += estimate_uerror(distr,ures,samplesize); fpar[0] = 10; distr = unur_distr_poisson(fpar,1); errorsum += estimate_uerror(distr,ures,samplesize); /*---------------------------------------------------------------------------*/ /* test finished */ FAILED = (errorsum < 2) ? 0 : 1; /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (FAILED) ? 0 : 1; (FAILED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_special() */ /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_dstd_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_nrou.conf0000644001357500135600000003541514420445767013401 00000000000000############################################################################# [main] [main - data:] # method (for information only: the program scans the file name) method: NROU [main - header:] /* prototypes */ double pdf_sqrtlin( double x, const UNUR_DISTR *distr ); double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ); double cdf_sqrtlin( double x, const UNUR_DISTR *distr ); double pdf_sqrtlinshft(double x, const UNUR_DISTR *distr ); double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); int unur_nrou_set_pedantic( struct unur_par *par, int pedantic ); \#define COMPARE_SAMPLE_SIZE (10000) \#define VIOLATE_SAMPLE_SIZE (100) ############################################################################# [new] [new - invalid NULL ptr: distr = NULL; ] ~( distr ); --> expected_NULL --> UNUR_ERR_NULL [new - invalid distribution type: distr = unur_distr_discr_new(); ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID [new - data missing in distribution object: distr = unur_distr_cont_new(); ] /* pdf */ ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED ############################################################################# [set] [set - invalid NULL ptr: par = NULL; ] ~_u(par,-1.,1.); --> expected_setfailed --> UNUR_ERR_NULL ~_v(par,1.); --> expected_setfailed --> UNUR_ERR_NULL ~_center(par,0.); --> expected_setfailed --> UNUR_ERR_NULL ~_verify(par,1); --> expected_setfailed --> UNUR_ERR_NULL [set - invalid parameter object: double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_arou_new(distr); ] ~_u(par,-1.,1.); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_v(par,1.); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_center(par,0.); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_verify(par,1); --> expected_setfailed --> UNUR_ERR_PAR_INVALID unur_par_free(par); [set - invalid parameters: double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_nrou_new(distr); ] ~_u(par,-1.,-2.); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_v(par,0.); --> expected_setfailed --> UNUR_ERR_PAR_SET unur_par_free(par); ############################################################################# # [get] ############################################################################# [chg] [chg - invalid generator object: double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_arou_new(distr); unur_set_debug(par,0); gen = unur_init( par ); <-- ! NULL ] ~_verify(gen,1); --> expected_setfailed --> UNUR_ERR_GEN_INVALID ############################################################################# [init] [init - invalid NULL ptr: par = NULL; ] unur_init( par ); --> expected_NULL --> UNUR_ERR_NULL ############################################################################# [reinit] [reinit - exist: distr = unur_distr_normal(NULL,0); par = unur_nrou_new(distr); gen = unur_init( par ); <-- ! NULL ] unur_reinit( gen ); --> expected_reinit ############################################################################# [sample] [sample - compare: distr = unur_distr_normal(NULL,0); par = NULL; ] /* default algorithm */ par = unur_nrou_new(distr); unur_nrou_set_u(par,-0.56,0.56); unur_nrou_set_v(par,0.64); -->compare_sequence_par_start /* default algorithm - verifying mode */ par = unur_nrou_new(distr); unur_nrou_set_u(par,-0.56,0.56); unur_nrou_set_v(par,0.64); unur_nrou_set_verify(par,1); -->compare_sequence_par #..................................................................... [sample - violate condition: distr = unur_distr_normal(NULL,0); par = NULL; ] /* v-value is too small */ par = unur_nrou_new(distr); unur_nrou_set_u(par,-0.56,0.56); unur_nrou_set_v(par,0.1); --> run_verify_generator --> UNUR_ERR_GEN_CONDITION /* u-value is too small */ par = unur_nrou_new(distr); unur_nrou_set_u(par,-0.2,0.56); unur_nrou_set_v(par,0.64); --> run_verify_generator --> UNUR_ERR_GEN_CONDITION /* u-value is too small */ par = unur_nrou_new(distr); unur_nrou_set_u(par,-0.56,0.26); unur_nrou_set_v(par,0.64); --> run_verify_generator --> UNUR_ERR_GEN_CONDITION #..................................................................... [sample - compare clone: UNUR_GEN *clone; distr = unur_distr_normal(NULL,0); par = NULL; gen = NULL; ] /* original generator object */ par = unur_nrou_new(distr); unur_nrou_set_u(par,-0.56,0.56); unur_nrou_set_v(par,0.64); gen = unur_init(par); -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen #..................................................................... [sample - compare reinit: distr = unur_distr_normal(NULL,0); par = NULL; gen = NULL; ] /* original generator object */ par = unur_nrou_new(distr); gen = unur_init(par); -->compare_sequence_gen_start /* reinit */ unur_reinit(gen); -->compare_sequence_gen #..................................................................... [sample - compare stringparser: distr = NULL; par = NULL; gen = NULL; ] distr = unur_distr_normal(NULL,0); par = unur_nrou_new(distr); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "normal() & method = nrou" ); -->compare_sequence_gen unur_free(gen); gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_nrou_new(distr); unur_nrou_set_u(par,-0.6,0.6); unur_nrou_set_v(par,1.); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "normal() & method = nrou; u=(-0.6,0.6); v=1" ); -->compare_sequence_gen ############################################################################# [validate] [validate - generators:] # default variant par[0] = unur_nrou_new(@distr@); # use bounding rectangle par[1] = unur_nrou_new(@distr@); unur_nrou_set_u(par,-0.6,0.6); unur_nrou_set_v(par,1.); # r-parameter = 0.5 par[2] = unur_nrou_new(@distr@); unur_nrou_set_r(par, 0.5); # r-parameter = 2.0 par[3] = unur_nrou_new(@distr@); unur_nrou_set_r(par, 2.0 ); # default variant but reinitialized with changed domain { UNUR_DISTR *dg =NULL; par[4] = unur_nrou_new(@distr@); dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } # default variant but reinitialized with changed pdf parameters { UNUR_DISTR *dg =NULL; par[5] = unur_nrou_new(@distr@); fpm[0] = 1.; fpm[1] = 4.; dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } [validate - distributions:] # Beta distributions fpm[0] = 1.; fpm[1] = 2.; distr[0] = unur_distr_beta(fpm,2); fpm[0] = 1.; fpm[1] = 5.; distr[1] = unur_distr_beta(fpm,2); fpm[0] = 1.; fpm[1] = 100.; distr[2] = unur_distr_beta(fpm,2); fpm[0] = 3.; fpm[1] = 4.; distr[3] = unur_distr_beta(fpm,2); fpm[0] = 5.; fpm[1] = 100.; distr[4] = unur_distr_beta(fpm,2); fpm[0] = 500.; fpm[1] = 300.; distr[5] = unur_distr_beta(fpm,2); fpm[0] = 5.; fpm[1] = 10.; fpm[2] = -3.; fpm[3] = 15.; distr[6] = unur_distr_beta(fpm,4); # Cauchy distributions distr[7] = unur_distr_cauchy(NULL,0); fpm[0] = 1.; fpm[1] = 20.; distr[8] = unur_distr_cauchy(fpm,2); # Exponential distributions distr[23] = unur_distr_exponential(NULL,0); fpm[0] = 30.; fpm[1] = -5.; distr[24] = unur_distr_exponential(fpm,2); # Gamma distributions fpm[0] = 1.; distr[9] = unur_distr_gamma(fpm,1); fpm[0] = 2.; distr[10] = unur_distr_gamma(fpm,1); fpm[0] = 3.; distr[11] = unur_distr_gamma(fpm,1); fpm[0] = 10.; distr[12] = unur_distr_gamma(fpm,1); fpm[0] = 1000.; distr[13] = unur_distr_gamma(fpm,1); fpm[0] = 5.; fpm[1] = 1000.; distr[14] = unur_distr_gamma(fpm,2); fpm[0] = 5.; fpm[1] = 1.e-5; distr[15] = unur_distr_gamma(fpm,2); fpm[0] = 5.; fpm[1] = 10.; fpm[2] = 1000; distr[16] = unur_distr_gamma(fpm,3); fpm[0] = 1.; fpm[1] = 4.; distr[29] = unur_distr_gamma(fpm,2); # Laplace distributions distr[25] = unur_distr_laplace(NULL,0); fpm[0] = -10.; fpm[1] = 100.; distr[26] = unur_distr_laplace(fpm,2); # Normal distributions distr[17] = unur_distr_normal(NULL,0); fpm[0] = 1.; fpm[1] = 1.e-5; distr[18] = unur_distr_normal(fpm,2); fpm[0] = 0.; fpm[1] = 1.e+5; distr[19] = unur_distr_normal(fpm,2); # Uniform distributions distr[20] = unur_distr_uniform(NULL,0); fpm[0] = 1.; fpm[1] = 20.; distr[21] = unur_distr_uniform(fpm,2); # pdf with piecewise linear function as transformed density with T = -1/sqrt distr[27] = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr[27],pdf_sqrtlin); unur_distr_cont_set_dpdf(distr[27],dpdf_sqrtlin); unur_distr_cont_set_cdf(distr[27],cdf_sqrtlin); unur_distr_set_name(distr[27],"sqrtlin"); unur_distr_cont_set_mode(distr[27],0.); unur_distr_cont_set_pdfarea(distr[27],2.); # pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode distr[28] = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr[28],pdf_sqrtlinshft); unur_distr_cont_set_dpdf(distr[28],dpdf_sqrtlinshft); unur_distr_cont_set_cdf(distr[28],cdf_sqrtlinshft); unur_distr_set_name(distr[28],"sqrtlin"); unur_distr_cont_set_mode(distr[28],1000.); unur_distr_cont_set_pdfarea(distr[28],2.); # truncated distributions distr[22] = unur_distr_cauchy(NULL,0); unur_distr_cont_set_domain(distr[22],0.1,1.); unur_distr_cont_upd_mode(distr[22]); unur_distr_cont_upd_pdfarea(distr[22]); # distribution with center distr[30] = unur_distr_exponential(NULL,0); unur_distr_cont_set_center(distr[30],2.); # number of distributions: 31 [validate - test chi2:] # + ... pass test # 0 ... fail to initialize generator # - ... fail test # . ... do not run test # # ... comment # # generators: # [0] ... default variant # [1] ... use rectangle # [2] ... r=0.5 # [3] ... r=2.0 # [4] ... default variant but reinitialized with changed domain # [5] ... default variant but reinitialized with changed pdf parameters # # 0 1 2 3 4 5 # distribution #--------------------------------------------------------------------- <0> + . + + + + # beta (1, 2) <1> + . + + + + # beta (1, 5) <2> + . + + + + # beta (1, 100) <3> + . + + + + # beta (3, 4) <4> + . + + + + # beta (5, 100) x <5> + . + + + + # beta (500, 300) <6> + . + + + + # beta (5, 10, -3, 15) <23> + . + + + + # exponential () <24> + . + + + + # exponential (30, -5) <7> + . . + + + # cauchy () <8> + . . + + + # cauchy (1, 20) <9> + . + + + + # gamma (1) <10> + . + + + + # gamma (2) <11> + . + + + + # gamma (3) <12> + . + + + + # gamma (10) x<13> + . + + . + # gamma (1000) <29> + . + + + + # gamma (1, 4) <14> + . + + . + # gamma (5, 1000, 0) x<15> + . + + . + # gamma (5, 1e-05, 0) x<16> + . + + . + # gamma (5, 10, 100000) <25> + . + + + + # laplace () <26> + - + + . + # laplace (-10, 100) <17> + + + + + + # normal () x<18> + . + + . + # normal (1, 1e-05) <19> + . + + + + # normal (1, 1e+05) <20> + . + + + + # uniform () <21> + . + + . + # uniform (1, 20) <22> + . + + . . # cauchy () - truncated <27> + . . + . . # pdf with piecewise linear function as transformed density with T = -1/sqrt <28> + . . + . . # [27] with shifted mode <30> + . + + . . # standard exponential distribution with center at 2 # number of distributions: 31 [validate - verify hat:] # + ... pass test # ~ ... fail in at most 1% of samples # 0 ... fail to initialize generator # - ... fail test # . ... do not run test # # ... comment # # generators: # [0] ... default variant # [1] ... use rectangle # [2] ... r=0.5 # [3] ... r=2.0 # [4] ... default variant but reinitialized with changed domain # [5] ... default variant but reinitialized with changed pdf parameters # # 0 1 2 3 4 5 # distribution #--------------------------------------------------------------------- <0> + . + + + + # beta (1, 2) <1> + . + + + + # beta (1, 5) <2> + . + + + + # beta (1, 100) <3> + . + + + + # beta (3, 4) <4> + . + + + + # beta (5, 100) x <5> + . + + + + # beta (500, 300) <6> + . + + + + # beta (5, 10, -3, 15) <23> + . + + + + # exponential () <24> + . + + + + # exponential (30, -5) <7> + . . + + + # cauchy () <8> + . . + + + # cauchy (1, 20) <9> + . + + + + # gamma (1) <10> + . + + + + # gamma (2) <11> + . + + + + # gamma (3) <12> + . + + + + # gamma (10) x<13> + . + + . + # gamma (1000) <29> + . + + + + # gamma (1, 4) <14> + . + + . + # gamma (5, 1000, 0) x<15> + . + + . + # gamma (5, 1e-05, 0) x<16> + . + + . + # gamma (5, 10, 100000) <25> + . + + + + # laplace () <26> + - + + . + # laplace (-10, 100) <17> + + + + + + # normal () x<18> + . + + . + # normal (1, 1e-05) <19> + . + + + + # normal (1, 1e+05) <20> + . + + + + # uniform () <21> + . + + . + # uniform (1, 20) <22> + . + + . . # cauchy () - truncated <27> + . . + . . # pdf with piecewise linear function as transformed density with T = -1/sqrt <28> + . . + . . # [27] with shifted mode <30> + . + + . . # standard exponential distribution with center at 2 # number of distributions: 31 ############################################################################# ############################################################################# [verbatim] /* pdf with piecewise linear function as transformed density with T = -1/sqrt */ double pdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y = 1./(fabs(x)+1.); return y*y; } double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y = 1./(fabs(x)+1.); y = 2.*y*y*y; return ((x<0.) ? y : - y); } double cdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { if (x<=0.) return 0.5/(1.-x); else return (1.-0.5/(1.+x)); } /* pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode */ double pdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y; x -= 1000.; y = 1./(fabs(x)+1.); return y*y; } double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y; x -= 1000.; y = 1./(fabs(x)+1.); y = 2.*y*y*y; return ((x<0.) ? y : - y); } double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { x -= 1000.; if (x<=0.) return 0.5/(1.-x); else return (1.-0.5/(1.+x)); } /* dummy function */ int unur_nrou_set_pedantic( struct unur_par *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) { return 1; } ############################################################################# unuran-1.11.0/tests/t_hri.conf0000644001357500135600000002267114420445767013200 00000000000000############################################################################# [main] [main - data:] # method (for information only: the program scans the file name) method: HRI [main - header:] /* prototypes */ double HR_invalid(double x, const UNUR_DISTR *distr); double HR_decreasing(double x, const UNUR_DISTR *distr); double CDF_decreasing(double x, const UNUR_DISTR *distr); double HR_constant(double x, const UNUR_DISTR *distr); double CDF_constant(double x, const UNUR_DISTR *distr); double HR_increasing_wb31(double x, const UNUR_DISTR *distr); double CDF_increasing_wb31(double x, const UNUR_DISTR *distr); double HR_increasing_gm31(double x, const UNUR_DISTR *distr); double CDF_increasing_gm31(double x, const UNUR_DISTR *distr); double HR_increasing_gm51(double x, const UNUR_DISTR *distr); double CDF_increasing_gm51(double x, const UNUR_DISTR *distr); int unur_hri_set_pedantic( UNUR_PAR *par, int pedantic ); \#define COMPARE_SAMPLE_SIZE (10000) \#define VIOLATE_SAMPLE_SIZE (20) ############################################################################# [new] [new - invalid NULL ptr: distr = NULL; ] ~( distr ); --> expected_NULL --> UNUR_ERR_NULL [new - invalid distribution type: distr = unur_distr_discr_new(); ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID [new - data missing in distribution object: distr = unur_distr_cont_new(); ] /* hazard rate */ ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED ############################################################################# [set] [set - invalid NULL ptr: par = NULL; ] ~_verify(par,1); --> expected_setfailed --> UNUR_ERR_NULL ~_p0(par,1.); --> expected_setfailed --> UNUR_ERR_NULL [set - invalid parameter object: distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); ] ~_verify(par,1); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_p0(par,1.); --> expected_setfailed --> UNUR_ERR_PAR_INVALID unur_par_free(par); ############################################################################# # [get] ############################################################################# [chg] [chg - invalid generator object: distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); unur_set_debug(par,0); gen = unur_init( par ); <-- ! NULL ] ~_verify(gen,1); --> expected_setfailed --> UNUR_ERR_GEN_INVALID ############################################################################# [init] [init - left border no valid upper bound: gen = NULL; distr = unur_distr_cont_new(); unur_distr_cont_set_hr(distr,HR_invalid); par = unur_hri_new(distr); <-- ! NULL] gen = unur_init( par ); --> expected_NULL --> UNUR_ERR_GEN_CONDITION ############################################################################# [reinit] [reinit - does not exist: distr = unur_distr_cont_new(); unur_distr_cont_set_hr(distr,HR_increasing_wb31); par = unur_hri_new(distr); gen = unur_init( par ); <-- ! NULL ] unur_reinit( gen ); --> expected_reinit ############################################################################# [sample] [sample - compare: distr = unur_distr_cont_new(); unur_distr_cont_set_hr(distr,HR_increasing_wb31); par = NULL; ] /* default algorithm */ par = unur_hri_new(distr); -->compare_sequence_par_start /* default algorithm - verifying mode */ par = unur_hri_new(distr); unur_hri_set_verify(par,1); -->compare_sequence_par /* default algorithm - ignore invalid boundary */ unur_distr_cont_set_domain(distr,-10.,10.); par = unur_hri_new(distr); -->compare_sequence_par_start #..................................................................... [sample - compare reinit: distr = unur_distr_cont_new(); unur_distr_cont_set_hr(distr,HR_increasing_wb31); par = NULL; gen = NULL; ] /* original generator object */ par = unur_hri_new(distr); gen = unur_init(par); -->compare_sequence_gen_start /* reinit */ unur_reinit(gen); -->compare_sequence_gen #..................................................................... [sample - compare stringparser: distr = NULL; par = NULL; gen = NULL; ] distr = unur_distr_cont_new(); unur_distr_cont_set_hrstr(distr,"3*x^2"); par = unur_hri_new(distr); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "cont; hr = \"3*x^2\"; domain = (0,inf)& \ method = hri" ); -->compare_sequence_gen #unur_free(gen); gen = NULL; #distr = unur_distr_cont_new(); #unur_distr_cont_set_hrstr(distr,"3*x^2"); #par = unur_hri_new(distr); #unur_hri_set_p0(par,2.); #gen = unur_init(par); # -->compare_sequence_gen_start #unur_free(gen); gen = NULL; #unur_distr_free(distr); distr = NULL; #gen = unur_str2gen( "cont; hr = \"1/(1+x)\"; domain = (0,inf)& \ # method = hri; p0 = 1." ); # -->compare_sequence_gen ############################################################################# [validate] [validate - generators:] # default program par[0] = unur_hri_new(@distr@); # set design point par[0] = unur_hri_new(@distr@); unur_hri_set_p0(par,2.); [validate - distributions:] # decreasing hazard rate distr[0] = unur_distr_cont_new(); unur_distr_set_name(distr[0],"decreasing HR"); unur_distr_cont_set_hr(distr[0],HR_decreasing); unur_distr_cont_set_cdf(distr[0],CDF_decreasing); # constant hazard rate distr[1] = unur_distr_cont_new(); unur_distr_set_name(distr[1],"constant HR"); unur_distr_cont_set_hr(distr[1],HR_constant); unur_distr_cont_set_cdf(distr[1],CDF_constant); # increasing hazard rate distr[2] = unur_distr_cont_new(); unur_distr_set_name(distr[2],"increasing HR wb31"); unur_distr_cont_set_hr(distr[2],HR_increasing_wb31); unur_distr_cont_set_cdf(distr[2],CDF_increasing_wb31); distr[3] = unur_distr_cont_new(); unur_distr_set_name(distr[3],"increasing HR gm31"); unur_distr_cont_set_hr(distr[3],HR_increasing_gm31); unur_distr_cont_set_cdf(distr[3],CDF_increasing_gm31); distr[4] = unur_distr_cont_new(); unur_distr_set_name(distr[4],"increasing HR gm51"); unur_distr_cont_set_hr(distr[4],HR_increasing_gm51); unur_distr_cont_set_cdf(distr[4],CDF_increasing_gm51); # number of distributions: 5 [validate - test chi2:] # + ... pass test # 0 ... fail to initialize generator # - ... fail test # . ... do not run test # # ... comment # # generators: # [0] ... default variant # [1] ... set design point # #gen 0 1 # distribution #--------------------------------------------- x<0> - - # hazard rate decreasing <1> + + # hazard rate constant <2> + + # hazard rate increasing wb31 <3> + + # hazard rate increasing gm31 <4> + + # hazard rate increasing gm51 [validate - verify hat:] # + ... pass test # ~ ... fail in at most 1% of samples # 0 ... fail to initialize generator # - ... fail test # . ... do not run test # # ... comment # # generators: # [0] ... default variant # [1] ... set design point # #gen 0 1 # distribution #--------------------------------------------- x<0> - . # hazard rate decreasing <1> + + # hazard rate constant <2> + + # hazard rate increasing wb31 <3> + + # hazard rate increasing gm31 <4> + + # hazard rate increasing gm51 ############################################################################# ############################################################################# [verbatim] double HR_invalid(double x ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* example with invalid hazard rate */ { return 0.; } double HR_decreasing(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* example with decreasing hazard rate */ { return (1./(1.+x)); } double CDF_decreasing(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* CDF for example with decreasing hazard rate */ { return (x/(1. + x)); } double HR_constant(double x ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* example with constant hazard rate: standard expontential */ { return 1.; } double CDF_constant(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* CDF for example with constant hazard rate: standard expontential */ { return (1.-exp(-x)); } double HR_increasing_wb31(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* example with increasing hazard rate: Weibull (alpha=3,beta=1) */ { return (3*x*x); } double CDF_increasing_wb31(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* CDF for example with increasing hazard rate: Weibull (alpha=3,beta=1) */ { return (1.-exp(-x*x*x)); } double HR_increasing_gm31(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* example with increasing hazard rate: gamma (alpha=3,beta=1) */ { return (x*x)/(x*x+2*x+2.); } double CDF_increasing_gm31(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* CDF for example with increasing hazard rate: gamma (alpha=3,beta=1) */ { return 1.-(x*x*exp(-x))/2.-(x*exp(-x))-exp(-x); } double HR_increasing_gm51(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* example with increasing hazard rate: gamma (alpha=5,beta=1) */ { return pow(x,4.)/(pow(x,4.)+4*pow(x,3.)+12.*x*x+24.*x+24.); } double CDF_increasing_gm51(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* CDF for example with increasing hazard rate: gamma (alpha=5,beta=1) */ { return (-exp(-x)/24.)*((pow(x,4.)+4*pow(x,3.)+12.*x*x+24.*x+24.))+1.; } /* dummy function */ int unur_hri_set_pedantic( UNUR_PAR *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) { return 1; } ############################################################################# unuran-1.11.0/tests/Makefile.in0000644001357500135600000030357614430713360013263 00000000000000# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ check_PROGRAMS = t_x_gen$(EXEEXT) t_unur_tests$(EXEEXT) \ t_unur_error$(EXEEXT) t_urng$(EXEEXT) t_distr$(EXEEXT) \ t_distr_cemp$(EXEEXT) t_distr_cont$(EXEEXT) \ t_distr_corder$(EXEEXT) t_distr_cvec$(EXEEXT) \ t_distr_condi$(EXEEXT) t_distr_cvemp$(EXEEXT) \ t_distr_cxtrans$(EXEEXT) t_distr_discr$(EXEEXT) \ t_distr_matr$(EXEEXT) t_auto$(EXEEXT) t_arou$(EXEEXT) \ t_ars$(EXEEXT) t_cext$(EXEEXT) t_cstd$(EXEEXT) t_dari$(EXEEXT) \ t_dau$(EXEEXT) t_dext$(EXEEXT) t_dgt$(EXEEXT) t_dsrou$(EXEEXT) \ t_dss$(EXEEXT) t_dstd$(EXEEXT) t_empk$(EXEEXT) t_empl$(EXEEXT) \ t_gibbs$(EXEEXT) t_hinv$(EXEEXT) t_hist$(EXEEXT) \ t_hitro$(EXEEXT) t_hrb$(EXEEXT) t_hrd$(EXEEXT) t_hri$(EXEEXT) \ t_itdr$(EXEEXT) t_mcorr$(EXEEXT) t_mixt$(EXEEXT) \ t_mvstd$(EXEEXT) t_mvtdr$(EXEEXT) t_ninv$(EXEEXT) \ t_norta$(EXEEXT) t_nrou$(EXEEXT) t_pinv$(EXEEXT) \ t_srou$(EXEEXT) t_ssr$(EXEEXT) t_tabl$(EXEEXT) t_tdr$(EXEEXT) \ t_tdr_gw$(EXEEXT) t_tdr_ps$(EXEEXT) t_tdr_ia$(EXEEXT) \ t_unif$(EXEEXT) t_utdr$(EXEEXT) t_vempk$(EXEEXT) \ t_vnrou$(EXEEXT) t_stringparser$(EXEEXT) t_info$(EXEEXT) \ t_util_matrix$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2) @HAVE_MATHEMATICA_FALSE@test_StdDistr_DEPENDENCIES = \ @HAVE_MATHEMATICA_FALSE@ libtestroutines.la \ @HAVE_MATHEMATICA_FALSE@ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ @HAVE_MATHEMATICA_FALSE@ $(top_builddir)/src/libunuran.la @HAVE_MATHEMATICA_FALSE@test_functionparser_DEPENDENCIES = \ @HAVE_MATHEMATICA_FALSE@ libtestroutines.la \ @HAVE_MATHEMATICA_FALSE@ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ @HAVE_MATHEMATICA_FALSE@ $(top_builddir)/src/libunuran.la subdir = tests ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @ENABLE_DEPRECATED_TRUE@am__EXEEXT_1 = t_deprecated_vmt$(EXEEXT) \ @ENABLE_DEPRECATED_TRUE@ t_deprecated_tdrgw$(EXEEXT) @HAVE_MATHEMATICA_TRUE@am__EXEEXT_2 = test_StdDistr$(EXEEXT) \ @HAVE_MATHEMATICA_TRUE@ test_functionparser$(EXEEXT) LTLIBRARIES = $(noinst_LTLIBRARIES) libtestroutines_la_LIBADD = am_libtestroutines_la_OBJECTS = testroutines.lo testcounter.lo libtestroutines_la_OBJECTS = $(am_libtestroutines_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = t_arou_SOURCES = t_arou.c t_arou_OBJECTS = t_arou.$(OBJEXT) t_arou_LDADD = $(LDADD) t_arou_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_ars_SOURCES = t_ars.c t_ars_OBJECTS = t_ars.$(OBJEXT) t_ars_LDADD = $(LDADD) t_ars_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_auto_SOURCES = t_auto.c t_auto_OBJECTS = t_auto.$(OBJEXT) t_auto_LDADD = $(LDADD) t_auto_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_cext_SOURCES = t_cext.c t_cext_OBJECTS = t_cext.$(OBJEXT) t_cext_LDADD = $(LDADD) t_cext_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_cstd_SOURCES = t_cstd.c t_cstd_OBJECTS = t_cstd.$(OBJEXT) t_cstd_LDADD = $(LDADD) t_cstd_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_dari_SOURCES = t_dari.c t_dari_OBJECTS = t_dari.$(OBJEXT) t_dari_LDADD = $(LDADD) t_dari_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_dau_SOURCES = t_dau.c t_dau_OBJECTS = t_dau.$(OBJEXT) t_dau_LDADD = $(LDADD) t_dau_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_deprecated_tdrgw_SOURCES = t_deprecated_tdrgw.c t_deprecated_tdrgw_OBJECTS = t_deprecated_tdrgw.$(OBJEXT) t_deprecated_tdrgw_LDADD = $(LDADD) t_deprecated_tdrgw_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_deprecated_vmt_SOURCES = t_deprecated_vmt.c t_deprecated_vmt_OBJECTS = t_deprecated_vmt.$(OBJEXT) t_deprecated_vmt_LDADD = $(LDADD) t_deprecated_vmt_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_dext_SOURCES = t_dext.c t_dext_OBJECTS = t_dext.$(OBJEXT) t_dext_LDADD = $(LDADD) t_dext_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_dgt_SOURCES = t_dgt.c t_dgt_OBJECTS = t_dgt.$(OBJEXT) t_dgt_LDADD = $(LDADD) t_dgt_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_distr_SOURCES = t_distr.c t_distr_OBJECTS = t_distr.$(OBJEXT) t_distr_LDADD = $(LDADD) t_distr_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_distr_cemp_SOURCES = t_distr_cemp.c t_distr_cemp_OBJECTS = t_distr_cemp.$(OBJEXT) t_distr_cemp_LDADD = $(LDADD) t_distr_cemp_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_distr_condi_SOURCES = t_distr_condi.c t_distr_condi_OBJECTS = t_distr_condi.$(OBJEXT) t_distr_condi_LDADD = $(LDADD) t_distr_condi_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_distr_cont_SOURCES = t_distr_cont.c t_distr_cont_OBJECTS = t_distr_cont.$(OBJEXT) t_distr_cont_LDADD = $(LDADD) t_distr_cont_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_distr_corder_SOURCES = t_distr_corder.c t_distr_corder_OBJECTS = t_distr_corder.$(OBJEXT) t_distr_corder_LDADD = $(LDADD) t_distr_corder_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_distr_cvec_SOURCES = t_distr_cvec.c t_distr_cvec_OBJECTS = t_distr_cvec.$(OBJEXT) t_distr_cvec_LDADD = $(LDADD) t_distr_cvec_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_distr_cvemp_SOURCES = t_distr_cvemp.c t_distr_cvemp_OBJECTS = t_distr_cvemp.$(OBJEXT) t_distr_cvemp_LDADD = $(LDADD) t_distr_cvemp_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_distr_cxtrans_SOURCES = t_distr_cxtrans.c t_distr_cxtrans_OBJECTS = t_distr_cxtrans.$(OBJEXT) t_distr_cxtrans_LDADD = $(LDADD) t_distr_cxtrans_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_distr_discr_SOURCES = t_distr_discr.c t_distr_discr_OBJECTS = t_distr_discr.$(OBJEXT) t_distr_discr_LDADD = $(LDADD) t_distr_discr_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_distr_matr_SOURCES = t_distr_matr.c t_distr_matr_OBJECTS = t_distr_matr.$(OBJEXT) t_distr_matr_LDADD = $(LDADD) t_distr_matr_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_dsrou_SOURCES = t_dsrou.c t_dsrou_OBJECTS = t_dsrou.$(OBJEXT) t_dsrou_LDADD = $(LDADD) t_dsrou_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_dss_SOURCES = t_dss.c t_dss_OBJECTS = t_dss.$(OBJEXT) t_dss_LDADD = $(LDADD) t_dss_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_dstd_SOURCES = t_dstd.c t_dstd_OBJECTS = t_dstd.$(OBJEXT) t_dstd_LDADD = $(LDADD) t_dstd_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_empk_SOURCES = t_empk.c t_empk_OBJECTS = t_empk.$(OBJEXT) t_empk_LDADD = $(LDADD) t_empk_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_empl_SOURCES = t_empl.c t_empl_OBJECTS = t_empl.$(OBJEXT) t_empl_LDADD = $(LDADD) t_empl_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_gibbs_SOURCES = t_gibbs.c t_gibbs_OBJECTS = t_gibbs.$(OBJEXT) t_gibbs_LDADD = $(LDADD) t_gibbs_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_hinv_SOURCES = t_hinv.c t_hinv_OBJECTS = t_hinv.$(OBJEXT) t_hinv_LDADD = $(LDADD) t_hinv_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_hist_SOURCES = t_hist.c t_hist_OBJECTS = t_hist.$(OBJEXT) t_hist_LDADD = $(LDADD) t_hist_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_hitro_SOURCES = t_hitro.c t_hitro_OBJECTS = t_hitro.$(OBJEXT) t_hitro_LDADD = $(LDADD) t_hitro_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_hrb_SOURCES = t_hrb.c t_hrb_OBJECTS = t_hrb.$(OBJEXT) t_hrb_LDADD = $(LDADD) t_hrb_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_hrd_SOURCES = t_hrd.c t_hrd_OBJECTS = t_hrd.$(OBJEXT) t_hrd_LDADD = $(LDADD) t_hrd_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_hri_SOURCES = t_hri.c t_hri_OBJECTS = t_hri.$(OBJEXT) t_hri_LDADD = $(LDADD) t_hri_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_info_SOURCES = t_info.c t_info_OBJECTS = t_info.$(OBJEXT) t_info_LDADD = $(LDADD) t_info_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_itdr_SOURCES = t_itdr.c t_itdr_OBJECTS = t_itdr.$(OBJEXT) t_itdr_LDADD = $(LDADD) t_itdr_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_mcorr_SOURCES = t_mcorr.c t_mcorr_OBJECTS = t_mcorr.$(OBJEXT) t_mcorr_LDADD = $(LDADD) t_mcorr_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_mixt_SOURCES = t_mixt.c t_mixt_OBJECTS = t_mixt.$(OBJEXT) t_mixt_LDADD = $(LDADD) t_mixt_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_mvstd_SOURCES = t_mvstd.c t_mvstd_OBJECTS = t_mvstd.$(OBJEXT) t_mvstd_LDADD = $(LDADD) t_mvstd_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_mvtdr_SOURCES = t_mvtdr.c t_mvtdr_OBJECTS = t_mvtdr.$(OBJEXT) t_mvtdr_LDADD = $(LDADD) t_mvtdr_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_ninv_SOURCES = t_ninv.c t_ninv_OBJECTS = t_ninv.$(OBJEXT) t_ninv_LDADD = $(LDADD) t_ninv_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_norta_SOURCES = t_norta.c t_norta_OBJECTS = t_norta.$(OBJEXT) t_norta_LDADD = $(LDADD) t_norta_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_nrou_SOURCES = t_nrou.c t_nrou_OBJECTS = t_nrou.$(OBJEXT) t_nrou_LDADD = $(LDADD) t_nrou_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_pinv_SOURCES = t_pinv.c t_pinv_OBJECTS = t_pinv.$(OBJEXT) t_pinv_LDADD = $(LDADD) t_pinv_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_srou_SOURCES = t_srou.c t_srou_OBJECTS = t_srou.$(OBJEXT) t_srou_LDADD = $(LDADD) t_srou_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_ssr_SOURCES = t_ssr.c t_ssr_OBJECTS = t_ssr.$(OBJEXT) t_ssr_LDADD = $(LDADD) t_ssr_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_stringparser_SOURCES = t_stringparser.c t_stringparser_OBJECTS = t_stringparser.$(OBJEXT) t_stringparser_LDADD = $(LDADD) t_stringparser_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_tabl_SOURCES = t_tabl.c t_tabl_OBJECTS = t_tabl.$(OBJEXT) t_tabl_LDADD = $(LDADD) t_tabl_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_tdr_SOURCES = t_tdr.c t_tdr_OBJECTS = t_tdr.$(OBJEXT) t_tdr_LDADD = $(LDADD) t_tdr_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_tdr_gw_SOURCES = t_tdr_gw.c t_tdr_gw_OBJECTS = t_tdr_gw.$(OBJEXT) t_tdr_gw_LDADD = $(LDADD) t_tdr_gw_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_tdr_ia_SOURCES = t_tdr_ia.c t_tdr_ia_OBJECTS = t_tdr_ia.$(OBJEXT) t_tdr_ia_LDADD = $(LDADD) t_tdr_ia_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_tdr_ps_SOURCES = t_tdr_ps.c t_tdr_ps_OBJECTS = t_tdr_ps.$(OBJEXT) t_tdr_ps_LDADD = $(LDADD) t_tdr_ps_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_unif_SOURCES = t_unif.c t_unif_OBJECTS = t_unif.$(OBJEXT) t_unif_LDADD = $(LDADD) t_unif_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_unur_error_SOURCES = t_unur_error.c t_unur_error_OBJECTS = t_unur_error.$(OBJEXT) t_unur_error_LDADD = $(LDADD) t_unur_error_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_unur_tests_SOURCES = t_unur_tests.c t_unur_tests_OBJECTS = t_unur_tests.$(OBJEXT) t_unur_tests_LDADD = $(LDADD) t_unur_tests_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_urng_SOURCES = t_urng.c t_urng_OBJECTS = t_urng.$(OBJEXT) t_urng_LDADD = $(LDADD) t_urng_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_utdr_SOURCES = t_utdr.c t_utdr_OBJECTS = t_utdr.$(OBJEXT) t_utdr_LDADD = $(LDADD) t_utdr_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_util_matrix_SOURCES = t_util_matrix.c t_util_matrix_OBJECTS = t_util_matrix.$(OBJEXT) t_util_matrix_LDADD = $(LDADD) t_util_matrix_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_vempk_SOURCES = t_vempk.c t_vempk_OBJECTS = t_vempk.$(OBJEXT) t_vempk_LDADD = $(LDADD) t_vempk_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_vnrou_SOURCES = t_vnrou.c t_vnrou_OBJECTS = t_vnrou.$(OBJEXT) t_vnrou_LDADD = $(LDADD) t_vnrou_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la t_x_gen_SOURCES = t_x_gen.c t_x_gen_OBJECTS = t_x_gen.$(OBJEXT) t_x_gen_LDADD = $(LDADD) t_x_gen_DEPENDENCIES = libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la am__test_StdDistr_SOURCES_DIST = test_StdDistr.c @HAVE_MATHEMATICA_TRUE@am_test_StdDistr_OBJECTS = \ @HAVE_MATHEMATICA_TRUE@ test_StdDistr.$(OBJEXT) test_StdDistr_OBJECTS = $(am_test_StdDistr_OBJECTS) test_StdDistr_LDADD = $(LDADD) am__test_functionparser_SOURCES_DIST = test_functionparser.c @HAVE_MATHEMATICA_TRUE@am_test_functionparser_OBJECTS = \ @HAVE_MATHEMATICA_TRUE@ test_functionparser.$(OBJEXT) test_functionparser_OBJECTS = $(am_test_functionparser_OBJECTS) test_functionparser_LDADD = $(LDADD) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/t_arou.Po ./$(DEPDIR)/t_ars.Po \ ./$(DEPDIR)/t_auto.Po ./$(DEPDIR)/t_cext.Po \ ./$(DEPDIR)/t_cstd.Po ./$(DEPDIR)/t_dari.Po \ ./$(DEPDIR)/t_dau.Po ./$(DEPDIR)/t_deprecated_tdrgw.Po \ ./$(DEPDIR)/t_deprecated_vmt.Po ./$(DEPDIR)/t_dext.Po \ ./$(DEPDIR)/t_dgt.Po ./$(DEPDIR)/t_distr.Po \ ./$(DEPDIR)/t_distr_cemp.Po ./$(DEPDIR)/t_distr_condi.Po \ ./$(DEPDIR)/t_distr_cont.Po ./$(DEPDIR)/t_distr_corder.Po \ ./$(DEPDIR)/t_distr_cvec.Po ./$(DEPDIR)/t_distr_cvemp.Po \ ./$(DEPDIR)/t_distr_cxtrans.Po ./$(DEPDIR)/t_distr_discr.Po \ ./$(DEPDIR)/t_distr_matr.Po ./$(DEPDIR)/t_dsrou.Po \ ./$(DEPDIR)/t_dss.Po ./$(DEPDIR)/t_dstd.Po \ ./$(DEPDIR)/t_empk.Po ./$(DEPDIR)/t_empl.Po \ ./$(DEPDIR)/t_gibbs.Po ./$(DEPDIR)/t_hinv.Po \ ./$(DEPDIR)/t_hist.Po ./$(DEPDIR)/t_hitro.Po \ ./$(DEPDIR)/t_hrb.Po ./$(DEPDIR)/t_hrd.Po ./$(DEPDIR)/t_hri.Po \ ./$(DEPDIR)/t_info.Po ./$(DEPDIR)/t_itdr.Po \ ./$(DEPDIR)/t_mcorr.Po ./$(DEPDIR)/t_mixt.Po \ ./$(DEPDIR)/t_mvstd.Po ./$(DEPDIR)/t_mvtdr.Po \ ./$(DEPDIR)/t_ninv.Po ./$(DEPDIR)/t_norta.Po \ ./$(DEPDIR)/t_nrou.Po ./$(DEPDIR)/t_pinv.Po \ ./$(DEPDIR)/t_srou.Po ./$(DEPDIR)/t_ssr.Po \ ./$(DEPDIR)/t_stringparser.Po ./$(DEPDIR)/t_tabl.Po \ ./$(DEPDIR)/t_tdr.Po ./$(DEPDIR)/t_tdr_gw.Po \ ./$(DEPDIR)/t_tdr_ia.Po ./$(DEPDIR)/t_tdr_ps.Po \ ./$(DEPDIR)/t_unif.Po ./$(DEPDIR)/t_unur_error.Po \ ./$(DEPDIR)/t_unur_tests.Po ./$(DEPDIR)/t_urng.Po \ ./$(DEPDIR)/t_utdr.Po ./$(DEPDIR)/t_util_matrix.Po \ ./$(DEPDIR)/t_vempk.Po ./$(DEPDIR)/t_vnrou.Po \ ./$(DEPDIR)/t_x_gen.Po ./$(DEPDIR)/test_StdDistr.Po \ ./$(DEPDIR)/test_functionparser.Po ./$(DEPDIR)/testcounter.Plo \ ./$(DEPDIR)/testroutines.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libtestroutines_la_SOURCES) t_arou.c t_ars.c t_auto.c \ t_cext.c t_cstd.c t_dari.c t_dau.c t_deprecated_tdrgw.c \ t_deprecated_vmt.c t_dext.c t_dgt.c t_distr.c t_distr_cemp.c \ t_distr_condi.c t_distr_cont.c t_distr_corder.c t_distr_cvec.c \ t_distr_cvemp.c t_distr_cxtrans.c t_distr_discr.c \ t_distr_matr.c t_dsrou.c t_dss.c t_dstd.c t_empk.c t_empl.c \ t_gibbs.c t_hinv.c t_hist.c t_hitro.c t_hrb.c t_hrd.c t_hri.c \ t_info.c t_itdr.c t_mcorr.c t_mixt.c t_mvstd.c t_mvtdr.c \ t_ninv.c t_norta.c t_nrou.c t_pinv.c t_srou.c t_ssr.c \ t_stringparser.c t_tabl.c t_tdr.c t_tdr_gw.c t_tdr_ia.c \ t_tdr_ps.c t_unif.c t_unur_error.c t_unur_tests.c t_urng.c \ t_utdr.c t_util_matrix.c t_vempk.c t_vnrou.c t_x_gen.c \ $(test_StdDistr_SOURCES) $(test_functionparser_SOURCES) DIST_SOURCES = $(libtestroutines_la_SOURCES) t_arou.c t_ars.c t_auto.c \ t_cext.c t_cstd.c t_dari.c t_dau.c t_deprecated_tdrgw.c \ t_deprecated_vmt.c t_dext.c t_dgt.c t_distr.c t_distr_cemp.c \ t_distr_condi.c t_distr_cont.c t_distr_corder.c t_distr_cvec.c \ t_distr_cvemp.c t_distr_cxtrans.c t_distr_discr.c \ t_distr_matr.c t_dsrou.c t_dss.c t_dstd.c t_empk.c t_empl.c \ t_gibbs.c t_hinv.c t_hist.c t_hitro.c t_hrb.c t_hrd.c t_hri.c \ t_info.c t_itdr.c t_mcorr.c t_mixt.c t_mvstd.c t_mvtdr.c \ t_ninv.c t_norta.c t_nrou.c t_pinv.c t_srou.c t_ssr.c \ t_stringparser.c t_tabl.c t_tdr.c t_tdr_gw.c t_tdr_ia.c \ t_tdr_ps.c t_unif.c t_unur_error.c t_unur_tests.c t_urng.c \ t_utdr.c t_util_matrix.c t_vempk.c t_vnrou.c t_x_gen.c \ $(am__test_StdDistr_SOURCES_DIST) \ $(am__test_functionparser_SOURCES_DIST) RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(noinst_HEADERS) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ check recheck distdir distdir-am am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` am__tty_colors_dummy = \ mgn= red= grn= lgn= blu= brg= std=; \ am__color_tests=no am__tty_colors = { \ $(am__tty_colors_dummy); \ if test "X$(AM_COLOR_TESTS)" = Xno; then \ am__color_tests=no; \ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ am__color_tests=yes; \ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ am__color_tests=yes; \ fi; \ if test $$am__color_tests = yes; then \ red=''; \ grn=''; \ lgn=''; \ blu=''; \ mgn=''; \ brg=''; \ std=''; \ fi; \ } am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__recheck_rx = ^[ ]*:recheck:[ ]* am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* # A command that, given a newline-separated list of test names on the # standard input, print the name of the tests that are to be re-run # upon "make recheck". am__list_recheck_tests = $(AWK) '{ \ recheck = 1; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ { \ if ((getline line2 < ($$0 ".log")) < 0) \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ { \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ { \ break; \ } \ }; \ if (recheck) \ print $$0; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # A command that, given a newline-separated list of test names on the # standard input, create the global log from their .trs and .log files. am__create_global_log = $(AWK) ' \ function fatal(msg) \ { \ print "fatal: making $@: " msg | "cat >&2"; \ exit 1; \ } \ function rst_section(header) \ { \ print header; \ len = length(header); \ for (i = 1; i <= len; i = i + 1) \ printf "="; \ printf "\n\n"; \ } \ { \ copy_in_global_log = 1; \ global_test_result = "RUN"; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".trs"); \ if (line ~ /$(am__global_test_result_rx)/) \ { \ sub("$(am__global_test_result_rx)", "", line); \ sub("[ ]*$$", "", line); \ global_test_result = line; \ } \ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ copy_in_global_log = 0; \ }; \ if (copy_in_global_log) \ { \ rst_section(global_test_result ": " $$0); \ while ((rc = (getline line < ($$0 ".log"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".log"); \ print line; \ }; \ printf "\n"; \ }; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # Restructured Text title. am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } # Solaris 10 'make', and several other traditional 'make' implementations, # pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it # by disabling -e (using the XSI extension "set +e") if it's set. am__sh_e_setup = case $$- in *e*) set +e;; esac # Default flags passed to test drivers. am__common_driver_flags = \ --color-tests "$$am__color_tests" \ --enable-hard-errors "$$am__enable_hard_errors" \ --expect-failure "$$am__expect_failure" # To be inserted before the command running the test. Creates the # directory for the log if needed. Stores in $dir the directory # containing $f, in $tst the test, in $log the log. Executes the # developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and # passes TESTS_ENVIRONMENT. Set up options for the wrapper that # will run the test scripts (or their associated LOG_COMPILER, if # thy have one). am__check_pre = \ $(am__sh_e_setup); \ $(am__vpath_adj_setup) $(am__vpath_adj) \ $(am__tty_colors); \ srcdir=$(srcdir); export srcdir; \ case "$@" in \ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ *) am__odir=.;; \ esac; \ test "x$$am__odir" = x"." || test -d "$$am__odir" \ || $(MKDIR_P) "$$am__odir" || exit $$?; \ if test -f "./$$f"; then dir=./; \ elif test -f "$$f"; then dir=; \ else dir="$(srcdir)/"; fi; \ tst=$$dir$$f; log='$@'; \ if test -n '$(DISABLE_HARD_ERRORS)'; then \ am__enable_hard_errors=no; \ else \ am__enable_hard_errors=yes; \ fi; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ am__expect_failure=yes;; \ *) \ am__expect_failure=no;; \ esac; \ $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) # A shell command to get the names of the tests scripts with any registered # extension removed (i.e., equivalently, the names of the test logs, with # the '.log' extension removed). The result is saved in the shell variable # '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, # we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", # since that might cause problem with VPATH rewrites for suffix-less tests. # See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. am__set_TESTS_bases = \ bases='$(TEST_LOGS)'; \ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ bases=`echo $$bases` AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING)' RECHECK_LOGS = $(TEST_LOGS) TEST_SUITE_LOG = test-suite.log TEST_EXTENSIONS = @EXEEXT@ .test LOG_DRIVER = $(SHELL) $(top_srcdir)/autoconf/test-driver LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) am__set_b = \ case '$@' in \ */*) \ case '$*' in \ */*) b='$*';; \ *) b=`echo '$@' | sed 's/\.log$$//'`; \ esac;; \ *) \ b='$*';; \ esac am__test_logs1 = $(TESTS:=.log) am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) TEST_LOGS = $(am__test_logs2:.test.log=.log) TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/autoconf/test-driver TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ $(TEST_LOG_FLAGS) DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autoconf/depcomp \ $(top_srcdir)/autoconf/test-driver DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILECMD = @FILECMD@ GREP = @GREP@ HAVE_DIVIDE_BY_ZERO = @HAVE_DIVIDE_BY_ZERO@ HAVE_IEEE_COMPARISONS = @HAVE_IEEE_COMPARISONS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNURAN_LT_VERSION = @UNURAN_LT_VERSION@ UNURAN_SUPPORTS_GSL = @UNURAN_SUPPORTS_GSL@ UNURAN_SUPPORTS_PRNG = @UNURAN_SUPPORTS_PRNG@ UNURAN_SUPPORTS_RNGSTREAM = @UNURAN_SUPPORTS_RNGSTREAM@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ have_valgrind = @have_valgrind@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = parallel-tests color-tests SUBDIRS = testdistributions . AM_CPPFLAGS = \ $(UNURAN_SUPPORTS_GSL) \ $(UNURAN_SUPPORTS_PRNG) \ $(UNURAN_SUPPORTS_RNGSTREAM) \ -I$(top_srcdir)/src \ -I$(top_srcdir)/src/tests noinst_LTLIBRARIES = libtestroutines.la libtestroutines_la_SOURCES = testroutines.c testcounter.c LDADD = \ libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la @HAVE_MATHEMATICA_FALSE@MATHEMATICA_PROGS = # Special files for tests with Mathematica(TM) @HAVE_MATHEMATICA_TRUE@MATHEMATICA_PROGS = test_StdDistr test_functionparser @ENABLE_DEPRECATED_FALSE@DEPRECATED_TESTS = # Files that contain deprecated routines @ENABLE_DEPRECATED_TRUE@DEPRECATED_TESTS = t_deprecated_vmt t_deprecated_tdrgw TESTS = $(check_PROGRAMS) # These tests fail until we fix some bugs #XFAIL_TESTS = noinst_HEADERS = \ testunuran.h EXTRA_DIST = \ test_StdDistr.m \ test_functionparser.m \ make_test_files.pl \ README.conf \ t_info.conf \ t_stringparser.conf \ t_x_gen.conf \ t_unur_tests.conf \ t_unur_error.conf \ t_urng.conf \ t_util_matrix.conf \ t_distr.conf \ t_distr_cemp.conf \ t_distr_cont.conf \ t_distr_corder.conf \ t_distr_cvec.conf \ t_distr_condi.conf \ t_distr_cvemp.conf \ t_distr_cxtrans.conf \ t_distr_discr.conf \ t_distr_matr.conf \ t_auto.conf \ t_arou.conf \ t_ars.conf \ t_cext.conf \ t_cstd.conf \ t_dari.conf \ t_dau.conf \ t_dext.conf \ t_dgt.conf \ t_dsrou.conf \ t_dss.conf \ t_dstd.conf \ t_empk.conf \ t_empl.conf \ t_gibbs.conf \ t_hinv.conf \ t_hinv.conf \ t_hist.conf \ t_hrb.conf \ t_hrd.conf \ t_hri.conf \ t_itdr.conf \ t_mcorr.conf \ t_mvstd.conf \ t_ninv.conf \ t_norta.conf \ t_nrou.conf \ t_pinv.conf \ t_srou.conf \ t_ssr.conf \ t_tabl.conf \ t_tdr.conf t_tdr_gw.conf t_tdr_ps.conf t_tdr_ia.conf \ t_unif.conf \ t_utdr.conf \ t_vempk.conf \ t_vnrou.conf \ \ t_deprecated_vmt.conf # Compare results of CDF, PDF, and dPDF of standard distributions # and results of function parser to those produced with # Mathematica(TM) ... @HAVE_MATHEMATICA_TRUE@test_StdDistr_SOURCES = test_StdDistr.c @HAVE_MATHEMATICA_TRUE@test_StdDistr_DEPENDENCIES = t_StdDistr.data @HAVE_MATHEMATICA_TRUE@test_functionparser_SOURCES = test_functionparser.c @HAVE_MATHEMATICA_TRUE@test_functionparser_DEPENDENCIES = t_functionparser.data # Generate C sources for tests SUFFIXES = .c # clean log files and backup files CLEANFILES = \ *.log \ valgrind-* \ unuran-valgrind-* \ *~ # clean generated files DISTCLEANFILES = \ rm -f t_*.data # clean generated files MAINTAINERCLEANFILES = \ rm -f t_*.c \ Makefile.in all: all-recursive .SUFFIXES: .SUFFIXES: .c .conf .lo .log .o .obj .test .test$(EXEEXT) .trs $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign tests/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libtestroutines.la: $(libtestroutines_la_OBJECTS) $(libtestroutines_la_DEPENDENCIES) $(EXTRA_libtestroutines_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libtestroutines_la_OBJECTS) $(libtestroutines_la_LIBADD) $(LIBS) t_arou$(EXEEXT): $(t_arou_OBJECTS) $(t_arou_DEPENDENCIES) $(EXTRA_t_arou_DEPENDENCIES) @rm -f t_arou$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_arou_OBJECTS) $(t_arou_LDADD) $(LIBS) t_ars$(EXEEXT): $(t_ars_OBJECTS) $(t_ars_DEPENDENCIES) $(EXTRA_t_ars_DEPENDENCIES) @rm -f t_ars$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_ars_OBJECTS) $(t_ars_LDADD) $(LIBS) t_auto$(EXEEXT): $(t_auto_OBJECTS) $(t_auto_DEPENDENCIES) $(EXTRA_t_auto_DEPENDENCIES) @rm -f t_auto$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_auto_OBJECTS) $(t_auto_LDADD) $(LIBS) t_cext$(EXEEXT): $(t_cext_OBJECTS) $(t_cext_DEPENDENCIES) $(EXTRA_t_cext_DEPENDENCIES) @rm -f t_cext$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_cext_OBJECTS) $(t_cext_LDADD) $(LIBS) t_cstd$(EXEEXT): $(t_cstd_OBJECTS) $(t_cstd_DEPENDENCIES) $(EXTRA_t_cstd_DEPENDENCIES) @rm -f t_cstd$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_cstd_OBJECTS) $(t_cstd_LDADD) $(LIBS) t_dari$(EXEEXT): $(t_dari_OBJECTS) $(t_dari_DEPENDENCIES) $(EXTRA_t_dari_DEPENDENCIES) @rm -f t_dari$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_dari_OBJECTS) $(t_dari_LDADD) $(LIBS) t_dau$(EXEEXT): $(t_dau_OBJECTS) $(t_dau_DEPENDENCIES) $(EXTRA_t_dau_DEPENDENCIES) @rm -f t_dau$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_dau_OBJECTS) $(t_dau_LDADD) $(LIBS) t_deprecated_tdrgw$(EXEEXT): $(t_deprecated_tdrgw_OBJECTS) $(t_deprecated_tdrgw_DEPENDENCIES) $(EXTRA_t_deprecated_tdrgw_DEPENDENCIES) @rm -f t_deprecated_tdrgw$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_deprecated_tdrgw_OBJECTS) $(t_deprecated_tdrgw_LDADD) $(LIBS) t_deprecated_vmt$(EXEEXT): $(t_deprecated_vmt_OBJECTS) $(t_deprecated_vmt_DEPENDENCIES) $(EXTRA_t_deprecated_vmt_DEPENDENCIES) @rm -f t_deprecated_vmt$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_deprecated_vmt_OBJECTS) $(t_deprecated_vmt_LDADD) $(LIBS) t_dext$(EXEEXT): $(t_dext_OBJECTS) $(t_dext_DEPENDENCIES) $(EXTRA_t_dext_DEPENDENCIES) @rm -f t_dext$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_dext_OBJECTS) $(t_dext_LDADD) $(LIBS) t_dgt$(EXEEXT): $(t_dgt_OBJECTS) $(t_dgt_DEPENDENCIES) $(EXTRA_t_dgt_DEPENDENCIES) @rm -f t_dgt$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_dgt_OBJECTS) $(t_dgt_LDADD) $(LIBS) t_distr$(EXEEXT): $(t_distr_OBJECTS) $(t_distr_DEPENDENCIES) $(EXTRA_t_distr_DEPENDENCIES) @rm -f t_distr$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_distr_OBJECTS) $(t_distr_LDADD) $(LIBS) t_distr_cemp$(EXEEXT): $(t_distr_cemp_OBJECTS) $(t_distr_cemp_DEPENDENCIES) $(EXTRA_t_distr_cemp_DEPENDENCIES) @rm -f t_distr_cemp$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_distr_cemp_OBJECTS) $(t_distr_cemp_LDADD) $(LIBS) t_distr_condi$(EXEEXT): $(t_distr_condi_OBJECTS) $(t_distr_condi_DEPENDENCIES) $(EXTRA_t_distr_condi_DEPENDENCIES) @rm -f t_distr_condi$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_distr_condi_OBJECTS) $(t_distr_condi_LDADD) $(LIBS) t_distr_cont$(EXEEXT): $(t_distr_cont_OBJECTS) $(t_distr_cont_DEPENDENCIES) $(EXTRA_t_distr_cont_DEPENDENCIES) @rm -f t_distr_cont$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_distr_cont_OBJECTS) $(t_distr_cont_LDADD) $(LIBS) t_distr_corder$(EXEEXT): $(t_distr_corder_OBJECTS) $(t_distr_corder_DEPENDENCIES) $(EXTRA_t_distr_corder_DEPENDENCIES) @rm -f t_distr_corder$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_distr_corder_OBJECTS) $(t_distr_corder_LDADD) $(LIBS) t_distr_cvec$(EXEEXT): $(t_distr_cvec_OBJECTS) $(t_distr_cvec_DEPENDENCIES) $(EXTRA_t_distr_cvec_DEPENDENCIES) @rm -f t_distr_cvec$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_distr_cvec_OBJECTS) $(t_distr_cvec_LDADD) $(LIBS) t_distr_cvemp$(EXEEXT): $(t_distr_cvemp_OBJECTS) $(t_distr_cvemp_DEPENDENCIES) $(EXTRA_t_distr_cvemp_DEPENDENCIES) @rm -f t_distr_cvemp$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_distr_cvemp_OBJECTS) $(t_distr_cvemp_LDADD) $(LIBS) t_distr_cxtrans$(EXEEXT): $(t_distr_cxtrans_OBJECTS) $(t_distr_cxtrans_DEPENDENCIES) $(EXTRA_t_distr_cxtrans_DEPENDENCIES) @rm -f t_distr_cxtrans$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_distr_cxtrans_OBJECTS) $(t_distr_cxtrans_LDADD) $(LIBS) t_distr_discr$(EXEEXT): $(t_distr_discr_OBJECTS) $(t_distr_discr_DEPENDENCIES) $(EXTRA_t_distr_discr_DEPENDENCIES) @rm -f t_distr_discr$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_distr_discr_OBJECTS) $(t_distr_discr_LDADD) $(LIBS) t_distr_matr$(EXEEXT): $(t_distr_matr_OBJECTS) $(t_distr_matr_DEPENDENCIES) $(EXTRA_t_distr_matr_DEPENDENCIES) @rm -f t_distr_matr$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_distr_matr_OBJECTS) $(t_distr_matr_LDADD) $(LIBS) t_dsrou$(EXEEXT): $(t_dsrou_OBJECTS) $(t_dsrou_DEPENDENCIES) $(EXTRA_t_dsrou_DEPENDENCIES) @rm -f t_dsrou$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_dsrou_OBJECTS) $(t_dsrou_LDADD) $(LIBS) t_dss$(EXEEXT): $(t_dss_OBJECTS) $(t_dss_DEPENDENCIES) $(EXTRA_t_dss_DEPENDENCIES) @rm -f t_dss$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_dss_OBJECTS) $(t_dss_LDADD) $(LIBS) t_dstd$(EXEEXT): $(t_dstd_OBJECTS) $(t_dstd_DEPENDENCIES) $(EXTRA_t_dstd_DEPENDENCIES) @rm -f t_dstd$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_dstd_OBJECTS) $(t_dstd_LDADD) $(LIBS) t_empk$(EXEEXT): $(t_empk_OBJECTS) $(t_empk_DEPENDENCIES) $(EXTRA_t_empk_DEPENDENCIES) @rm -f t_empk$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_empk_OBJECTS) $(t_empk_LDADD) $(LIBS) t_empl$(EXEEXT): $(t_empl_OBJECTS) $(t_empl_DEPENDENCIES) $(EXTRA_t_empl_DEPENDENCIES) @rm -f t_empl$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_empl_OBJECTS) $(t_empl_LDADD) $(LIBS) t_gibbs$(EXEEXT): $(t_gibbs_OBJECTS) $(t_gibbs_DEPENDENCIES) $(EXTRA_t_gibbs_DEPENDENCIES) @rm -f t_gibbs$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_gibbs_OBJECTS) $(t_gibbs_LDADD) $(LIBS) t_hinv$(EXEEXT): $(t_hinv_OBJECTS) $(t_hinv_DEPENDENCIES) $(EXTRA_t_hinv_DEPENDENCIES) @rm -f t_hinv$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_hinv_OBJECTS) $(t_hinv_LDADD) $(LIBS) t_hist$(EXEEXT): $(t_hist_OBJECTS) $(t_hist_DEPENDENCIES) $(EXTRA_t_hist_DEPENDENCIES) @rm -f t_hist$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_hist_OBJECTS) $(t_hist_LDADD) $(LIBS) t_hitro$(EXEEXT): $(t_hitro_OBJECTS) $(t_hitro_DEPENDENCIES) $(EXTRA_t_hitro_DEPENDENCIES) @rm -f t_hitro$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_hitro_OBJECTS) $(t_hitro_LDADD) $(LIBS) t_hrb$(EXEEXT): $(t_hrb_OBJECTS) $(t_hrb_DEPENDENCIES) $(EXTRA_t_hrb_DEPENDENCIES) @rm -f t_hrb$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_hrb_OBJECTS) $(t_hrb_LDADD) $(LIBS) t_hrd$(EXEEXT): $(t_hrd_OBJECTS) $(t_hrd_DEPENDENCIES) $(EXTRA_t_hrd_DEPENDENCIES) @rm -f t_hrd$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_hrd_OBJECTS) $(t_hrd_LDADD) $(LIBS) t_hri$(EXEEXT): $(t_hri_OBJECTS) $(t_hri_DEPENDENCIES) $(EXTRA_t_hri_DEPENDENCIES) @rm -f t_hri$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_hri_OBJECTS) $(t_hri_LDADD) $(LIBS) t_info$(EXEEXT): $(t_info_OBJECTS) $(t_info_DEPENDENCIES) $(EXTRA_t_info_DEPENDENCIES) @rm -f t_info$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_info_OBJECTS) $(t_info_LDADD) $(LIBS) t_itdr$(EXEEXT): $(t_itdr_OBJECTS) $(t_itdr_DEPENDENCIES) $(EXTRA_t_itdr_DEPENDENCIES) @rm -f t_itdr$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_itdr_OBJECTS) $(t_itdr_LDADD) $(LIBS) t_mcorr$(EXEEXT): $(t_mcorr_OBJECTS) $(t_mcorr_DEPENDENCIES) $(EXTRA_t_mcorr_DEPENDENCIES) @rm -f t_mcorr$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_mcorr_OBJECTS) $(t_mcorr_LDADD) $(LIBS) t_mixt$(EXEEXT): $(t_mixt_OBJECTS) $(t_mixt_DEPENDENCIES) $(EXTRA_t_mixt_DEPENDENCIES) @rm -f t_mixt$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_mixt_OBJECTS) $(t_mixt_LDADD) $(LIBS) t_mvstd$(EXEEXT): $(t_mvstd_OBJECTS) $(t_mvstd_DEPENDENCIES) $(EXTRA_t_mvstd_DEPENDENCIES) @rm -f t_mvstd$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_mvstd_OBJECTS) $(t_mvstd_LDADD) $(LIBS) t_mvtdr$(EXEEXT): $(t_mvtdr_OBJECTS) $(t_mvtdr_DEPENDENCIES) $(EXTRA_t_mvtdr_DEPENDENCIES) @rm -f t_mvtdr$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_mvtdr_OBJECTS) $(t_mvtdr_LDADD) $(LIBS) t_ninv$(EXEEXT): $(t_ninv_OBJECTS) $(t_ninv_DEPENDENCIES) $(EXTRA_t_ninv_DEPENDENCIES) @rm -f t_ninv$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_ninv_OBJECTS) $(t_ninv_LDADD) $(LIBS) t_norta$(EXEEXT): $(t_norta_OBJECTS) $(t_norta_DEPENDENCIES) $(EXTRA_t_norta_DEPENDENCIES) @rm -f t_norta$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_norta_OBJECTS) $(t_norta_LDADD) $(LIBS) t_nrou$(EXEEXT): $(t_nrou_OBJECTS) $(t_nrou_DEPENDENCIES) $(EXTRA_t_nrou_DEPENDENCIES) @rm -f t_nrou$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_nrou_OBJECTS) $(t_nrou_LDADD) $(LIBS) t_pinv$(EXEEXT): $(t_pinv_OBJECTS) $(t_pinv_DEPENDENCIES) $(EXTRA_t_pinv_DEPENDENCIES) @rm -f t_pinv$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_pinv_OBJECTS) $(t_pinv_LDADD) $(LIBS) t_srou$(EXEEXT): $(t_srou_OBJECTS) $(t_srou_DEPENDENCIES) $(EXTRA_t_srou_DEPENDENCIES) @rm -f t_srou$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_srou_OBJECTS) $(t_srou_LDADD) $(LIBS) t_ssr$(EXEEXT): $(t_ssr_OBJECTS) $(t_ssr_DEPENDENCIES) $(EXTRA_t_ssr_DEPENDENCIES) @rm -f t_ssr$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_ssr_OBJECTS) $(t_ssr_LDADD) $(LIBS) t_stringparser$(EXEEXT): $(t_stringparser_OBJECTS) $(t_stringparser_DEPENDENCIES) $(EXTRA_t_stringparser_DEPENDENCIES) @rm -f t_stringparser$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_stringparser_OBJECTS) $(t_stringparser_LDADD) $(LIBS) t_tabl$(EXEEXT): $(t_tabl_OBJECTS) $(t_tabl_DEPENDENCIES) $(EXTRA_t_tabl_DEPENDENCIES) @rm -f t_tabl$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_tabl_OBJECTS) $(t_tabl_LDADD) $(LIBS) t_tdr$(EXEEXT): $(t_tdr_OBJECTS) $(t_tdr_DEPENDENCIES) $(EXTRA_t_tdr_DEPENDENCIES) @rm -f t_tdr$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_tdr_OBJECTS) $(t_tdr_LDADD) $(LIBS) t_tdr_gw$(EXEEXT): $(t_tdr_gw_OBJECTS) $(t_tdr_gw_DEPENDENCIES) $(EXTRA_t_tdr_gw_DEPENDENCIES) @rm -f t_tdr_gw$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_tdr_gw_OBJECTS) $(t_tdr_gw_LDADD) $(LIBS) t_tdr_ia$(EXEEXT): $(t_tdr_ia_OBJECTS) $(t_tdr_ia_DEPENDENCIES) $(EXTRA_t_tdr_ia_DEPENDENCIES) @rm -f t_tdr_ia$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_tdr_ia_OBJECTS) $(t_tdr_ia_LDADD) $(LIBS) t_tdr_ps$(EXEEXT): $(t_tdr_ps_OBJECTS) $(t_tdr_ps_DEPENDENCIES) $(EXTRA_t_tdr_ps_DEPENDENCIES) @rm -f t_tdr_ps$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_tdr_ps_OBJECTS) $(t_tdr_ps_LDADD) $(LIBS) t_unif$(EXEEXT): $(t_unif_OBJECTS) $(t_unif_DEPENDENCIES) $(EXTRA_t_unif_DEPENDENCIES) @rm -f t_unif$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_unif_OBJECTS) $(t_unif_LDADD) $(LIBS) t_unur_error$(EXEEXT): $(t_unur_error_OBJECTS) $(t_unur_error_DEPENDENCIES) $(EXTRA_t_unur_error_DEPENDENCIES) @rm -f t_unur_error$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_unur_error_OBJECTS) $(t_unur_error_LDADD) $(LIBS) t_unur_tests$(EXEEXT): $(t_unur_tests_OBJECTS) $(t_unur_tests_DEPENDENCIES) $(EXTRA_t_unur_tests_DEPENDENCIES) @rm -f t_unur_tests$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_unur_tests_OBJECTS) $(t_unur_tests_LDADD) $(LIBS) t_urng$(EXEEXT): $(t_urng_OBJECTS) $(t_urng_DEPENDENCIES) $(EXTRA_t_urng_DEPENDENCIES) @rm -f t_urng$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_urng_OBJECTS) $(t_urng_LDADD) $(LIBS) t_utdr$(EXEEXT): $(t_utdr_OBJECTS) $(t_utdr_DEPENDENCIES) $(EXTRA_t_utdr_DEPENDENCIES) @rm -f t_utdr$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_utdr_OBJECTS) $(t_utdr_LDADD) $(LIBS) t_util_matrix$(EXEEXT): $(t_util_matrix_OBJECTS) $(t_util_matrix_DEPENDENCIES) $(EXTRA_t_util_matrix_DEPENDENCIES) @rm -f t_util_matrix$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_util_matrix_OBJECTS) $(t_util_matrix_LDADD) $(LIBS) t_vempk$(EXEEXT): $(t_vempk_OBJECTS) $(t_vempk_DEPENDENCIES) $(EXTRA_t_vempk_DEPENDENCIES) @rm -f t_vempk$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_vempk_OBJECTS) $(t_vempk_LDADD) $(LIBS) t_vnrou$(EXEEXT): $(t_vnrou_OBJECTS) $(t_vnrou_DEPENDENCIES) $(EXTRA_t_vnrou_DEPENDENCIES) @rm -f t_vnrou$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_vnrou_OBJECTS) $(t_vnrou_LDADD) $(LIBS) t_x_gen$(EXEEXT): $(t_x_gen_OBJECTS) $(t_x_gen_DEPENDENCIES) $(EXTRA_t_x_gen_DEPENDENCIES) @rm -f t_x_gen$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_x_gen_OBJECTS) $(t_x_gen_LDADD) $(LIBS) test_StdDistr$(EXEEXT): $(test_StdDistr_OBJECTS) $(test_StdDistr_DEPENDENCIES) $(EXTRA_test_StdDistr_DEPENDENCIES) @rm -f test_StdDistr$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_StdDistr_OBJECTS) $(test_StdDistr_LDADD) $(LIBS) test_functionparser$(EXEEXT): $(test_functionparser_OBJECTS) $(test_functionparser_DEPENDENCIES) $(EXTRA_test_functionparser_DEPENDENCIES) @rm -f test_functionparser$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_functionparser_OBJECTS) $(test_functionparser_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_arou.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_ars.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_auto.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_cext.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_cstd.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_dari.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_dau.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_deprecated_tdrgw.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_deprecated_vmt.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_dext.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_dgt.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_distr.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_distr_cemp.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_distr_condi.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_distr_cont.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_distr_corder.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_distr_cvec.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_distr_cvemp.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_distr_cxtrans.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_distr_discr.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_distr_matr.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_dsrou.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_dss.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_dstd.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_empk.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_empl.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_gibbs.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_hinv.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_hist.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_hitro.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_hrb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_hrd.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_hri.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_info.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_itdr.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_mcorr.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_mixt.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_mvstd.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_mvtdr.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_ninv.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_norta.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_nrou.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_pinv.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_srou.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_ssr.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_stringparser.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_tabl.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_tdr.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_tdr_gw.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_tdr_ia.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_tdr_ps.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_unif.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_unur_error.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_unur_tests.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_urng.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_utdr.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_util_matrix.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_vempk.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_vnrou.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_x_gen.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_StdDistr.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_functionparser.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testcounter.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testroutines.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags # Recover from deleted '.trs' file; this should ensure that # "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create # both 'foo.log' and 'foo.trs'. Break the recipe in two subshells # to avoid problems with "make -n". .log.trs: rm -f $< $@ $(MAKE) $(AM_MAKEFLAGS) $< # Leading 'am--fnord' is there to ensure the list of targets does not # expand to empty, as could happen e.g. with make check TESTS=''. am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) am--force-recheck: @: $(TEST_SUITE_LOG): $(TEST_LOGS) @$(am__set_TESTS_bases); \ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ redo_bases=`for i in $$bases; do \ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ done`; \ if test -n "$$redo_bases"; then \ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ if $(am__make_dryrun); then :; else \ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ fi; \ fi; \ if test -n "$$am__remaking_logs"; then \ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ "recursion detected" >&2; \ elif test -n "$$redo_logs"; then \ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ fi; \ if $(am__make_dryrun); then :; else \ st=0; \ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ for i in $$redo_bases; do \ test -f $$i.trs && test -r $$i.trs \ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ test -f $$i.log && test -r $$i.log \ || { echo "$$errmsg $$i.log" >&2; st=1; }; \ done; \ test $$st -eq 0 || exit 1; \ fi @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ ws='[ ]'; \ results=`for b in $$bases; do echo $$b.trs; done`; \ test -n "$$results" || results=/dev/null; \ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ if test `expr $$fail + $$xpass + $$error` -eq 0; then \ success=true; \ else \ success=false; \ fi; \ br='==================='; br=$$br$$br$$br$$br; \ result_count () \ { \ if test x"$$1" = x"--maybe-color"; then \ maybe_colorize=yes; \ elif test x"$$1" = x"--no-color"; then \ maybe_colorize=no; \ else \ echo "$@: invalid 'result_count' usage" >&2; exit 4; \ fi; \ shift; \ desc=$$1 count=$$2; \ if test $$maybe_colorize = yes && test $$count -gt 0; then \ color_start=$$3 color_end=$$std; \ else \ color_start= color_end=; \ fi; \ echo "$${color_start}# $$desc $$count$${color_end}"; \ }; \ create_testsuite_report () \ { \ result_count $$1 "TOTAL:" $$all "$$brg"; \ result_count $$1 "PASS: " $$pass "$$grn"; \ result_count $$1 "SKIP: " $$skip "$$blu"; \ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ result_count $$1 "FAIL: " $$fail "$$red"; \ result_count $$1 "XPASS:" $$xpass "$$red"; \ result_count $$1 "ERROR:" $$error "$$mgn"; \ }; \ { \ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ $(am__rst_title); \ create_testsuite_report --no-color; \ echo; \ echo ".. contents:: :depth: 2"; \ echo; \ for b in $$bases; do echo $$b; done \ | $(am__create_global_log); \ } >$(TEST_SUITE_LOG).tmp || exit 1; \ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ if $$success; then \ col="$$grn"; \ else \ col="$$red"; \ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ fi; \ echo "$${col}$$br$${std}"; \ echo "$${col}Testsuite summary"$(AM_TESTSUITE_SUMMARY_HEADER)"$${std}"; \ echo "$${col}$$br$${std}"; \ create_testsuite_report --maybe-color; \ echo "$$col$$br$$std"; \ if $$success; then :; else \ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ if test -n "$(PACKAGE_BUGREPORT)"; then \ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ fi; \ echo "$$col$$br$$std"; \ fi; \ $$success || exit 1 check-TESTS: $(check_PROGRAMS) @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ log_list=`for i in $$bases; do echo $$i.log; done`; \ trs_list=`for i in $$bases; do echo $$i.trs; done`; \ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ exit $$?; recheck: all $(check_PROGRAMS) @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ bases=`for i in $$bases; do echo $$i; done \ | $(am__list_recheck_tests)` || exit 1; \ log_list=`for i in $$bases; do echo $$i.log; done`; \ log_list=`echo $$log_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ am__force_recheck=am--force-recheck \ TEST_LOGS="$$log_list"; \ exit $$? t_x_gen.log: t_x_gen$(EXEEXT) @p='t_x_gen$(EXEEXT)'; \ b='t_x_gen'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_unur_tests.log: t_unur_tests$(EXEEXT) @p='t_unur_tests$(EXEEXT)'; \ b='t_unur_tests'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_unur_error.log: t_unur_error$(EXEEXT) @p='t_unur_error$(EXEEXT)'; \ b='t_unur_error'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_urng.log: t_urng$(EXEEXT) @p='t_urng$(EXEEXT)'; \ b='t_urng'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_distr.log: t_distr$(EXEEXT) @p='t_distr$(EXEEXT)'; \ b='t_distr'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_distr_cemp.log: t_distr_cemp$(EXEEXT) @p='t_distr_cemp$(EXEEXT)'; \ b='t_distr_cemp'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_distr_cont.log: t_distr_cont$(EXEEXT) @p='t_distr_cont$(EXEEXT)'; \ b='t_distr_cont'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_distr_corder.log: t_distr_corder$(EXEEXT) @p='t_distr_corder$(EXEEXT)'; \ b='t_distr_corder'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_distr_cvec.log: t_distr_cvec$(EXEEXT) @p='t_distr_cvec$(EXEEXT)'; \ b='t_distr_cvec'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_distr_condi.log: t_distr_condi$(EXEEXT) @p='t_distr_condi$(EXEEXT)'; \ b='t_distr_condi'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_distr_cvemp.log: t_distr_cvemp$(EXEEXT) @p='t_distr_cvemp$(EXEEXT)'; \ b='t_distr_cvemp'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_distr_cxtrans.log: t_distr_cxtrans$(EXEEXT) @p='t_distr_cxtrans$(EXEEXT)'; \ b='t_distr_cxtrans'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_distr_discr.log: t_distr_discr$(EXEEXT) @p='t_distr_discr$(EXEEXT)'; \ b='t_distr_discr'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_distr_matr.log: t_distr_matr$(EXEEXT) @p='t_distr_matr$(EXEEXT)'; \ b='t_distr_matr'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_auto.log: t_auto$(EXEEXT) @p='t_auto$(EXEEXT)'; \ b='t_auto'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_arou.log: t_arou$(EXEEXT) @p='t_arou$(EXEEXT)'; \ b='t_arou'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_ars.log: t_ars$(EXEEXT) @p='t_ars$(EXEEXT)'; \ b='t_ars'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_cext.log: t_cext$(EXEEXT) @p='t_cext$(EXEEXT)'; \ b='t_cext'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_cstd.log: t_cstd$(EXEEXT) @p='t_cstd$(EXEEXT)'; \ b='t_cstd'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_dari.log: t_dari$(EXEEXT) @p='t_dari$(EXEEXT)'; \ b='t_dari'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_dau.log: t_dau$(EXEEXT) @p='t_dau$(EXEEXT)'; \ b='t_dau'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_dext.log: t_dext$(EXEEXT) @p='t_dext$(EXEEXT)'; \ b='t_dext'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_dgt.log: t_dgt$(EXEEXT) @p='t_dgt$(EXEEXT)'; \ b='t_dgt'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_dsrou.log: t_dsrou$(EXEEXT) @p='t_dsrou$(EXEEXT)'; \ b='t_dsrou'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_dss.log: t_dss$(EXEEXT) @p='t_dss$(EXEEXT)'; \ b='t_dss'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_dstd.log: t_dstd$(EXEEXT) @p='t_dstd$(EXEEXT)'; \ b='t_dstd'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_empk.log: t_empk$(EXEEXT) @p='t_empk$(EXEEXT)'; \ b='t_empk'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_empl.log: t_empl$(EXEEXT) @p='t_empl$(EXEEXT)'; \ b='t_empl'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_gibbs.log: t_gibbs$(EXEEXT) @p='t_gibbs$(EXEEXT)'; \ b='t_gibbs'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_hinv.log: t_hinv$(EXEEXT) @p='t_hinv$(EXEEXT)'; \ b='t_hinv'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_hist.log: t_hist$(EXEEXT) @p='t_hist$(EXEEXT)'; \ b='t_hist'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_hitro.log: t_hitro$(EXEEXT) @p='t_hitro$(EXEEXT)'; \ b='t_hitro'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_hrb.log: t_hrb$(EXEEXT) @p='t_hrb$(EXEEXT)'; \ b='t_hrb'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_hrd.log: t_hrd$(EXEEXT) @p='t_hrd$(EXEEXT)'; \ b='t_hrd'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_hri.log: t_hri$(EXEEXT) @p='t_hri$(EXEEXT)'; \ b='t_hri'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_itdr.log: t_itdr$(EXEEXT) @p='t_itdr$(EXEEXT)'; \ b='t_itdr'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_mcorr.log: t_mcorr$(EXEEXT) @p='t_mcorr$(EXEEXT)'; \ b='t_mcorr'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_mixt.log: t_mixt$(EXEEXT) @p='t_mixt$(EXEEXT)'; \ b='t_mixt'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_mvstd.log: t_mvstd$(EXEEXT) @p='t_mvstd$(EXEEXT)'; \ b='t_mvstd'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_mvtdr.log: t_mvtdr$(EXEEXT) @p='t_mvtdr$(EXEEXT)'; \ b='t_mvtdr'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_ninv.log: t_ninv$(EXEEXT) @p='t_ninv$(EXEEXT)'; \ b='t_ninv'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_norta.log: t_norta$(EXEEXT) @p='t_norta$(EXEEXT)'; \ b='t_norta'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_nrou.log: t_nrou$(EXEEXT) @p='t_nrou$(EXEEXT)'; \ b='t_nrou'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_pinv.log: t_pinv$(EXEEXT) @p='t_pinv$(EXEEXT)'; \ b='t_pinv'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_srou.log: t_srou$(EXEEXT) @p='t_srou$(EXEEXT)'; \ b='t_srou'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_ssr.log: t_ssr$(EXEEXT) @p='t_ssr$(EXEEXT)'; \ b='t_ssr'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_tabl.log: t_tabl$(EXEEXT) @p='t_tabl$(EXEEXT)'; \ b='t_tabl'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_tdr.log: t_tdr$(EXEEXT) @p='t_tdr$(EXEEXT)'; \ b='t_tdr'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_tdr_gw.log: t_tdr_gw$(EXEEXT) @p='t_tdr_gw$(EXEEXT)'; \ b='t_tdr_gw'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_tdr_ps.log: t_tdr_ps$(EXEEXT) @p='t_tdr_ps$(EXEEXT)'; \ b='t_tdr_ps'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_tdr_ia.log: t_tdr_ia$(EXEEXT) @p='t_tdr_ia$(EXEEXT)'; \ b='t_tdr_ia'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_unif.log: t_unif$(EXEEXT) @p='t_unif$(EXEEXT)'; \ b='t_unif'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_utdr.log: t_utdr$(EXEEXT) @p='t_utdr$(EXEEXT)'; \ b='t_utdr'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_vempk.log: t_vempk$(EXEEXT) @p='t_vempk$(EXEEXT)'; \ b='t_vempk'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_vnrou.log: t_vnrou$(EXEEXT) @p='t_vnrou$(EXEEXT)'; \ b='t_vnrou'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_stringparser.log: t_stringparser$(EXEEXT) @p='t_stringparser$(EXEEXT)'; \ b='t_stringparser'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_info.log: t_info$(EXEEXT) @p='t_info$(EXEEXT)'; \ b='t_info'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_util_matrix.log: t_util_matrix$(EXEEXT) @p='t_util_matrix$(EXEEXT)'; \ b='t_util_matrix'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_deprecated_vmt.log: t_deprecated_vmt$(EXEEXT) @p='t_deprecated_vmt$(EXEEXT)'; \ b='t_deprecated_vmt'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_deprecated_tdrgw.log: t_deprecated_tdrgw$(EXEEXT) @p='t_deprecated_tdrgw$(EXEEXT)'; \ b='t_deprecated_tdrgw'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test_StdDistr.log: test_StdDistr$(EXEEXT) @p='test_StdDistr$(EXEEXT)'; \ b='test_StdDistr'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test_functionparser.log: test_functionparser$(EXEEXT) @p='test_functionparser$(EXEEXT)'; \ b='test_functionparser'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) .test.log: @p='$<'; \ $(am__set_b); \ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) @am__EXEEXT_TRUE@.test$(EXEEXT).log: @am__EXEEXT_TRUE@ @p='$<'; \ @am__EXEEXT_TRUE@ $(am__set_b); \ @am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ @am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-recursive all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-recursive clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ clean-noinstLTLIBRARIES mostlyclean-am distclean: distclean-recursive -rm -f ./$(DEPDIR)/t_arou.Po -rm -f ./$(DEPDIR)/t_ars.Po -rm -f ./$(DEPDIR)/t_auto.Po -rm -f ./$(DEPDIR)/t_cext.Po -rm -f ./$(DEPDIR)/t_cstd.Po -rm -f ./$(DEPDIR)/t_dari.Po -rm -f ./$(DEPDIR)/t_dau.Po -rm -f ./$(DEPDIR)/t_deprecated_tdrgw.Po -rm -f ./$(DEPDIR)/t_deprecated_vmt.Po -rm -f ./$(DEPDIR)/t_dext.Po -rm -f ./$(DEPDIR)/t_dgt.Po -rm -f ./$(DEPDIR)/t_distr.Po -rm -f ./$(DEPDIR)/t_distr_cemp.Po -rm -f ./$(DEPDIR)/t_distr_condi.Po -rm -f ./$(DEPDIR)/t_distr_cont.Po -rm -f ./$(DEPDIR)/t_distr_corder.Po -rm -f ./$(DEPDIR)/t_distr_cvec.Po -rm -f ./$(DEPDIR)/t_distr_cvemp.Po -rm -f ./$(DEPDIR)/t_distr_cxtrans.Po -rm -f ./$(DEPDIR)/t_distr_discr.Po -rm -f ./$(DEPDIR)/t_distr_matr.Po -rm -f ./$(DEPDIR)/t_dsrou.Po -rm -f ./$(DEPDIR)/t_dss.Po -rm -f ./$(DEPDIR)/t_dstd.Po -rm -f ./$(DEPDIR)/t_empk.Po -rm -f ./$(DEPDIR)/t_empl.Po -rm -f ./$(DEPDIR)/t_gibbs.Po -rm -f ./$(DEPDIR)/t_hinv.Po -rm -f ./$(DEPDIR)/t_hist.Po -rm -f ./$(DEPDIR)/t_hitro.Po -rm -f ./$(DEPDIR)/t_hrb.Po -rm -f ./$(DEPDIR)/t_hrd.Po -rm -f ./$(DEPDIR)/t_hri.Po -rm -f ./$(DEPDIR)/t_info.Po -rm -f ./$(DEPDIR)/t_itdr.Po -rm -f ./$(DEPDIR)/t_mcorr.Po -rm -f ./$(DEPDIR)/t_mixt.Po -rm -f ./$(DEPDIR)/t_mvstd.Po -rm -f ./$(DEPDIR)/t_mvtdr.Po -rm -f ./$(DEPDIR)/t_ninv.Po -rm -f ./$(DEPDIR)/t_norta.Po -rm -f ./$(DEPDIR)/t_nrou.Po -rm -f ./$(DEPDIR)/t_pinv.Po -rm -f ./$(DEPDIR)/t_srou.Po -rm -f ./$(DEPDIR)/t_ssr.Po -rm -f ./$(DEPDIR)/t_stringparser.Po -rm -f ./$(DEPDIR)/t_tabl.Po -rm -f ./$(DEPDIR)/t_tdr.Po -rm -f ./$(DEPDIR)/t_tdr_gw.Po -rm -f ./$(DEPDIR)/t_tdr_ia.Po -rm -f ./$(DEPDIR)/t_tdr_ps.Po -rm -f ./$(DEPDIR)/t_unif.Po -rm -f ./$(DEPDIR)/t_unur_error.Po -rm -f ./$(DEPDIR)/t_unur_tests.Po -rm -f ./$(DEPDIR)/t_urng.Po -rm -f ./$(DEPDIR)/t_utdr.Po -rm -f ./$(DEPDIR)/t_util_matrix.Po -rm -f ./$(DEPDIR)/t_vempk.Po -rm -f ./$(DEPDIR)/t_vnrou.Po -rm -f ./$(DEPDIR)/t_x_gen.Po -rm -f ./$(DEPDIR)/test_StdDistr.Po -rm -f ./$(DEPDIR)/test_functionparser.Po -rm -f ./$(DEPDIR)/testcounter.Plo -rm -f ./$(DEPDIR)/testroutines.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f ./$(DEPDIR)/t_arou.Po -rm -f ./$(DEPDIR)/t_ars.Po -rm -f ./$(DEPDIR)/t_auto.Po -rm -f ./$(DEPDIR)/t_cext.Po -rm -f ./$(DEPDIR)/t_cstd.Po -rm -f ./$(DEPDIR)/t_dari.Po -rm -f ./$(DEPDIR)/t_dau.Po -rm -f ./$(DEPDIR)/t_deprecated_tdrgw.Po -rm -f ./$(DEPDIR)/t_deprecated_vmt.Po -rm -f ./$(DEPDIR)/t_dext.Po -rm -f ./$(DEPDIR)/t_dgt.Po -rm -f ./$(DEPDIR)/t_distr.Po -rm -f ./$(DEPDIR)/t_distr_cemp.Po -rm -f ./$(DEPDIR)/t_distr_condi.Po -rm -f ./$(DEPDIR)/t_distr_cont.Po -rm -f ./$(DEPDIR)/t_distr_corder.Po -rm -f ./$(DEPDIR)/t_distr_cvec.Po -rm -f ./$(DEPDIR)/t_distr_cvemp.Po -rm -f ./$(DEPDIR)/t_distr_cxtrans.Po -rm -f ./$(DEPDIR)/t_distr_discr.Po -rm -f ./$(DEPDIR)/t_distr_matr.Po -rm -f ./$(DEPDIR)/t_dsrou.Po -rm -f ./$(DEPDIR)/t_dss.Po -rm -f ./$(DEPDIR)/t_dstd.Po -rm -f ./$(DEPDIR)/t_empk.Po -rm -f ./$(DEPDIR)/t_empl.Po -rm -f ./$(DEPDIR)/t_gibbs.Po -rm -f ./$(DEPDIR)/t_hinv.Po -rm -f ./$(DEPDIR)/t_hist.Po -rm -f ./$(DEPDIR)/t_hitro.Po -rm -f ./$(DEPDIR)/t_hrb.Po -rm -f ./$(DEPDIR)/t_hrd.Po -rm -f ./$(DEPDIR)/t_hri.Po -rm -f ./$(DEPDIR)/t_info.Po -rm -f ./$(DEPDIR)/t_itdr.Po -rm -f ./$(DEPDIR)/t_mcorr.Po -rm -f ./$(DEPDIR)/t_mixt.Po -rm -f ./$(DEPDIR)/t_mvstd.Po -rm -f ./$(DEPDIR)/t_mvtdr.Po -rm -f ./$(DEPDIR)/t_ninv.Po -rm -f ./$(DEPDIR)/t_norta.Po -rm -f ./$(DEPDIR)/t_nrou.Po -rm -f ./$(DEPDIR)/t_pinv.Po -rm -f ./$(DEPDIR)/t_srou.Po -rm -f ./$(DEPDIR)/t_ssr.Po -rm -f ./$(DEPDIR)/t_stringparser.Po -rm -f ./$(DEPDIR)/t_tabl.Po -rm -f ./$(DEPDIR)/t_tdr.Po -rm -f ./$(DEPDIR)/t_tdr_gw.Po -rm -f ./$(DEPDIR)/t_tdr_ia.Po -rm -f ./$(DEPDIR)/t_tdr_ps.Po -rm -f ./$(DEPDIR)/t_unif.Po -rm -f ./$(DEPDIR)/t_unur_error.Po -rm -f ./$(DEPDIR)/t_unur_tests.Po -rm -f ./$(DEPDIR)/t_urng.Po -rm -f ./$(DEPDIR)/t_utdr.Po -rm -f ./$(DEPDIR)/t_util_matrix.Po -rm -f ./$(DEPDIR)/t_vempk.Po -rm -f ./$(DEPDIR)/t_vnrou.Po -rm -f ./$(DEPDIR)/t_x_gen.Po -rm -f ./$(DEPDIR)/test_StdDistr.Po -rm -f ./$(DEPDIR)/test_functionparser.Po -rm -f ./$(DEPDIR)/testcounter.Plo -rm -f ./$(DEPDIR)/testroutines.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(am__recursive_targets) check-am install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--depfiles check check-TESTS check-am clean \ clean-checkPROGRAMS clean-generic clean-libtool \ clean-noinstLTLIBRARIES cscopelist-am ctags ctags-am distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am recheck tags tags-am \ uninstall uninstall-am .PRECIOUS: Makefile @HAVE_MATHEMATICA_TRUE@test_StdDistr.o: t_StdDistr.data @HAVE_MATHEMATICA_TRUE@t_StdDistr.data: test_StdDistr.m @HAVE_MATHEMATICA_TRUE@ math -initfile $(top_srcdir)/tests/test_StdDistr.m @HAVE_MATHEMATICA_TRUE@test_functionparser.o: t_functionparser.data @HAVE_MATHEMATICA_TRUE@t_functionparser.data: test_functionparser.m @HAVE_MATHEMATICA_TRUE@ math -initfile $(top_srcdir)/tests/test_functionparser.m .conf.c: ./make_test_files.pl $(top_srcdir) $< > $@ t_*.c: make_test_files.pl # run tests with valgrind @HAVE_VALGRIND_TRUE@valgrind: $(check_PROGRAMS) @HAVE_VALGRIND_TRUE@ @list='$(check_PROGRAMS)'; for p in $$list; do \ @HAVE_VALGRIND_TRUE@ $(top_srcdir)/scripts/run_valgrind.sh ./$$p; \ @HAVE_VALGRIND_TRUE@ done # run tests in fullcheck mode fullcheck: UNURANFULLCHECK=true $(MAKE) check # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: unuran-1.11.0/tests/t_nrou.c0000644001357500135600000047203714430713513012667 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for NROU **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ double pdf_sqrtlin( double x, const UNUR_DISTR *distr ); double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ); double cdf_sqrtlin( double x, const UNUR_DISTR *distr ); double pdf_sqrtlinshft(double x, const UNUR_DISTR *distr ); double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); int unur_nrou_set_pedantic( struct unur_par *par, int pedantic ); #define COMPARE_SAMPLE_SIZE (10000) #define VIOLATE_SAMPLE_SIZE (100) /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ /* pdf with piecewise linear function as transformed density with T = -1/sqrt */ double pdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y = 1./(fabs(x)+1.); return y*y; } double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y = 1./(fabs(x)+1.); y = 2.*y*y*y; return ((x<0.) ? y : - y); } double cdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { if (x<=0.) return 0.5/(1.-x); else return (1.-0.5/(1.+x)); } /* pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode */ double pdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y; x -= 1000.; y = 1./(fabs(x)+1.); return y*y; } double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y; x -= 1000.; y = 1./(fabs(x)+1.); y = 2.*y*y*y; return ((x<0.) ? y : - y); } double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { x -= 1000.; if (x<=0.) return 0.5/(1.-x); else return (1.-0.5/(1.+x)); } /* dummy function */ int unur_nrou_set_pedantic( struct unur_par *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) { return 1; } /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,36,(unur_nrou_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,36,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,42,(unur_nrou_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,42,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* data missing in distribution object */ UNUR_DISTR *distr = NULL; distr = unur_distr_cont_new(); unur_reset_errno(); /* pdf */ n_tests_failed += (check_expected_NULL(TESTLOG,49,(unur_nrou_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,49,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [set] */ void test_set (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[set "); fflush(stdout); fprintf(TESTLOG,"\n[set]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,59,(unur_nrou_set_u(par,-1.,1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,59,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,62,(unur_nrou_set_v(par,1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,62,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,65,(unur_nrou_set_center(par,0.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,65,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,68,(unur_nrou_set_verify(par,1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,68,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* invalid parameter object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_arou_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,77,(unur_nrou_set_u(par,-1.,1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,77,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,80,(unur_nrou_set_v(par,1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,80,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,83,(unur_nrou_set_center(par,0.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,83,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,86,(unur_nrou_set_verify(par,1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,86,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_nrou_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,96,(unur_nrou_set_u(par,-1.,-2.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,96,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,99,(unur_nrou_set_v(par,0.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,99,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_set() */ /*---------------------------------------------------------------------------*/ /* [chg] */ void test_chg (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[chg "); fflush(stdout); fprintf(TESTLOG,"\n[chg]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid generator object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_arou_new(distr); unur_set_debug(par,0); gen = unur_init( par ); abort_if_NULL(TESTLOG, 115, gen ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,119,(unur_nrou_chg_verify(gen,1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,119,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_chg() */ /*---------------------------------------------------------------------------*/ /* [init] */ void test_init (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[init "); fflush(stdout); fprintf(TESTLOG,"\n[init]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,129,(unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,129,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_init() */ /*---------------------------------------------------------------------------*/ /* [reinit] */ void test_reinit (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[reinit "); fflush(stdout); fprintf(TESTLOG,"\n[reinit]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* exist */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_nrou_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 138, gen ); unur_reset_errno(); n_tests_failed += (check_expected_reinit(TESTLOG,142,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_reinit() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* compare */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = unur_distr_normal(NULL,0); par = NULL; unur_reset_errno(); /* default algorithm */ par = unur_nrou_new(distr); unur_nrou_set_u(par,-0.56,0.56); unur_nrou_set_v(par,0.64); n_tests_failed += (compare_sequence_par_start(TESTLOG,156,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* default algorithm - verifying mode */ par = unur_nrou_new(distr); unur_nrou_set_u(par,-0.56,0.56); unur_nrou_set_v(par,0.64); unur_nrou_set_verify(par,1); n_tests_failed += (compare_sequence_par(TESTLOG,163,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* violate condition */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = unur_distr_normal(NULL,0); par = NULL; unur_reset_errno(); /* v-value is too small */ par = unur_nrou_new(distr); unur_nrou_set_u(par,-0.56,0.56); unur_nrou_set_v(par,0.1); run_verify_generator (TESTLOG,175,par); n_tests_failed += (check_errorcode(TESTLOG,175,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* u-value is too small */ par = unur_nrou_new(distr); unur_nrou_set_u(par,-0.2,0.56); unur_nrou_set_v(par,0.64); run_verify_generator (TESTLOG,181,par); n_tests_failed += (check_errorcode(TESTLOG,181,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* u-value is too small */ par = unur_nrou_new(distr); unur_nrou_set_u(par,-0.56,0.26); unur_nrou_set_v(par,0.64); run_verify_generator (TESTLOG,187,par); n_tests_failed += (check_errorcode(TESTLOG,187,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* compare clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; UNUR_GEN *clone; distr = unur_distr_normal(NULL,0); par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_nrou_new(distr); unur_nrou_set_u(par,-0.56,0.56); unur_nrou_set_v(par,0.64); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,202,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,208,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare reinit */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_nrou_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,220,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* reinit */ unur_reinit(gen); n_tests_failed += (compare_sequence_gen(TESTLOG,224,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare stringparser */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = NULL; par = NULL; gen = NULL; unur_reset_errno(); distr = unur_distr_normal(NULL,0); par = unur_nrou_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,236,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "normal() & method = nrou" ); n_tests_failed += (compare_sequence_gen(TESTLOG,241,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_nrou_new(distr); unur_nrou_set_u(par,-0.6,0.6); unur_nrou_set_v(par,1.); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,249,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "normal() & method = nrou; u=(-0.6,0.6); v=1" ); n_tests_failed += (compare_sequence_gen(TESTLOG,254,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* [validate] */ /*---------------------------------------------------------------------------*/ /* [validate] */ void test_validate (void) { /* suppress GCC compiler warning */ GCC_DIAG_OFF(unused-variable) UNUR_DISTR *distr[31]; UNUR_PAR *par; UNUR_GEN *gen; double *darray; double fpm[10]; int n_tests_failed; int rcode; /* start test */ printf("[validate "); fflush(stdout); fprintf(TESTLOG,"\n[validate]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* distributions: 31 */ { fpm[0] = 1.; fpm[1] = 2.; distr[0] = unur_distr_beta(fpm,2); } { fpm[0] = 1.; fpm[1] = 5.; distr[1] = unur_distr_beta(fpm,2); } { fpm[0] = 1.; fpm[1] = 100.; distr[2] = unur_distr_beta(fpm,2); } { fpm[0] = 3.; fpm[1] = 4.; distr[3] = unur_distr_beta(fpm,2); } { fpm[0] = 5.; fpm[1] = 100.; distr[4] = unur_distr_beta(fpm,2); } { fpm[0] = 500.; fpm[1] = 300.; distr[5] = unur_distr_beta(fpm,2); } { fpm[0] = 5.; fpm[1] = 10.; fpm[2] = -3.; fpm[3] = 15.; distr[6] = unur_distr_beta(fpm,4); } { distr[7] = unur_distr_cauchy(NULL,0); } { fpm[0] = 1.; fpm[1] = 20.; distr[8] = unur_distr_cauchy(fpm,2); } { distr[23] = unur_distr_exponential(NULL,0); } { fpm[0] = 30.; fpm[1] = -5.; distr[24] = unur_distr_exponential(fpm,2); } { fpm[0] = 1.; distr[9] = unur_distr_gamma(fpm,1); } { fpm[0] = 2.; distr[10] = unur_distr_gamma(fpm,1); } { fpm[0] = 3.; distr[11] = unur_distr_gamma(fpm,1); } { fpm[0] = 10.; distr[12] = unur_distr_gamma(fpm,1); } { fpm[0] = 1000.; distr[13] = unur_distr_gamma(fpm,1); } { fpm[0] = 5.; fpm[1] = 1000.; distr[14] = unur_distr_gamma(fpm,2); } { fpm[0] = 5.; fpm[1] = 1.e-5; distr[15] = unur_distr_gamma(fpm,2); } { fpm[0] = 5.; fpm[1] = 10.; fpm[2] = 1000; distr[16] = unur_distr_gamma(fpm,3); } { fpm[0] = 1.; fpm[1] = 4.; distr[29] = unur_distr_gamma(fpm,2); } { distr[25] = unur_distr_laplace(NULL,0); } { fpm[0] = -10.; fpm[1] = 100.; distr[26] = unur_distr_laplace(fpm,2); } { distr[17] = unur_distr_normal(NULL,0); } { fpm[0] = 1.; fpm[1] = 1.e-5; distr[18] = unur_distr_normal(fpm,2); } { fpm[0] = 0.; fpm[1] = 1.e+5; distr[19] = unur_distr_normal(fpm,2); } { distr[20] = unur_distr_uniform(NULL,0); } { fpm[0] = 1.; fpm[1] = 20.; distr[21] = unur_distr_uniform(fpm,2); } { distr[27] = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr[27],pdf_sqrtlin); unur_distr_cont_set_dpdf(distr[27],dpdf_sqrtlin); unur_distr_cont_set_cdf(distr[27],cdf_sqrtlin); unur_distr_set_name(distr[27],"sqrtlin"); unur_distr_cont_set_mode(distr[27],0.); unur_distr_cont_set_pdfarea(distr[27],2.); } { distr[28] = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr[28],pdf_sqrtlinshft); unur_distr_cont_set_dpdf(distr[28],dpdf_sqrtlinshft); unur_distr_cont_set_cdf(distr[28],cdf_sqrtlinshft); unur_distr_set_name(distr[28],"sqrtlin"); unur_distr_cont_set_mode(distr[28],1000.); unur_distr_cont_set_pdfarea(distr[28],2.); } { distr[22] = unur_distr_cauchy(NULL,0); unur_distr_cont_set_domain(distr[22],0.1,1.); unur_distr_cont_upd_mode(distr[22]); unur_distr_cont_upd_pdfarea(distr[22]); } { distr[30] = unur_distr_exponential(NULL,0); unur_distr_cont_set_center(distr[30],2.); } /* timing */ stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); printf("\n(chi^2) "); fflush(stdout); /* chi^2 tests: 186 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nChi^2 Test:\n"); /* distribution [0] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_nrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_nrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [2] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_nrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [3] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_nrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [4] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_nrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [5] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_nrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [6] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_nrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [23] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_nrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [24] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_nrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [7] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_nrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [8] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_nrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [9] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_nrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [10] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_nrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [11] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_nrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [12] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_nrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [13] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_nrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [29] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_nrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [14] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_nrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [15] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_nrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [16] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_nrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [25] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_nrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [26] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_nrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_u(par,-0.6,0.6); unur_nrou_set_v(par,1.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [17] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_nrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_u(par,-0.6,0.6); unur_nrou_set_v(par,1.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [18] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_nrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [19] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_nrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [20] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_nrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [21] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_nrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [22] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_nrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [27] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_nrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [28] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_nrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [30] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_nrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); printf("\n(verify hat) "); fflush(stdout); /* verify hat tests: 186 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nVerify Hat Test (squeeze <= PDF <= hat):\n"); /* distribution [0] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 0.5); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 0.5); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [2] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 0.5); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [3] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 0.5); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [4] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 0.5); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [5] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 0.5); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [6] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 0.5); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [23] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 0.5); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [24] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 0.5); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [7] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [8] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [9] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 0.5); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [10] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 0.5); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [11] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 0.5); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [12] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 0.5); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [13] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 0.5); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [29] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 0.5); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [14] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 0.5); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [15] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 0.5); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [16] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 0.5); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [25] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 0.5); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [26] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_u(par,-0.6,0.6); unur_nrou_set_v(par,1.); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 0.5); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [17] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_u(par,-0.6,0.6); unur_nrou_set_v(par,1.); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 0.5); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [18] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 0.5); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [19] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 0.5); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [20] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 0.5); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [21] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 0.5); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); { UNUR_DISTR *dg =NULL; par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [22] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 0.5); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [27] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [28] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [30] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 0.5); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_nrou_new(distr_localcopy); unur_nrou_set_pedantic(par,0); unur_nrou_set_r(par, 2.0 ); gen = unur_init(par); if (gen) unur_nrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); /* free distributions */ unur_distr_free(distr[0]); unur_distr_free(distr[1]); unur_distr_free(distr[2]); unur_distr_free(distr[3]); unur_distr_free(distr[4]); unur_distr_free(distr[5]); unur_distr_free(distr[6]); unur_distr_free(distr[7]); unur_distr_free(distr[8]); unur_distr_free(distr[9]); unur_distr_free(distr[10]); unur_distr_free(distr[11]); unur_distr_free(distr[12]); unur_distr_free(distr[13]); unur_distr_free(distr[14]); unur_distr_free(distr[15]); unur_distr_free(distr[16]); unur_distr_free(distr[17]); unur_distr_free(distr[18]); unur_distr_free(distr[19]); unur_distr_free(distr[20]); unur_distr_free(distr[21]); unur_distr_free(distr[22]); unur_distr_free(distr[23]); unur_distr_free(distr[24]); unur_distr_free(distr[25]); unur_distr_free(distr[26]); unur_distr_free(distr[27]); unur_distr_free(distr[28]); unur_distr_free(distr[29]); unur_distr_free(distr[30]); /* test finished */ test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; /* we accept CHI2_FAILURES_TOLERATED failures */ (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_validate */ /* enable GCC compiler warning */ GCC_DIAG_ON(unused-variable) /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_nrou_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_distr_cvemp.conf0000644001357500135600000000524714420445767014735 00000000000000############################################################################# [main] [main - data:] # method (for information only: the program scans the file name) method: DISTR_CVEMP [main - header:] /* prototypes */ \#define COMPARE_SAMPLE_SIZE (500) \#define VIOLATE_SAMPLE_SIZE (20) ############################################################################# [new] [new - invalid data: distr = NULL; ] unur_distr_cvemp_new(1); --> expected_NULL --> UNUR_ERR_DISTR_SET ############################################################################# [set] [set - invalid NULL ptr: distr = NULL; ] unur_distr_cvemp_set_data( distr, NULL, 0 ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_cvemp_read_data( distr, "junk" ); --> expected_setfailed --> UNUR_ERR_NULL [set - invalid distribution type: distr = unur_distr_discr_new(); ] unur_distr_cvemp_set_data( distr, NULL, 0 ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_cvemp_read_data( distr, "junk" ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID [set - invalid NULL ptr: distr = unur_distr_cvemp_new(2); ] unur_distr_cvemp_set_data( distr, NULL, 0 ); --> expected_setfailed --> UNUR_ERR_NULL [set - invalid parameters: double data[] = {1.,2.,3.,4.}; distr = unur_distr_cvemp_new(2); ] unur_distr_cvemp_set_data( distr, data, 0 ); --> expected_setfailed --> UNUR_ERR_DISTR_SET unur_distr_cvemp_read_data( distr, "there-should-be-no-such-file.junk" ); --> expected_setfailed --> UNUR_ERR_GENERIC ############################################################################# [get] [get - invalid NULL ptr: const double *sample; distr = NULL; ] unur_distr_cvemp_get_data( distr, &sample ) --> expected_zero --> UNUR_ERR_NULL [get - invalid distribution type: const double *sample; distr = unur_distr_discr_new(); ] unur_distr_cvemp_get_data( distr, &sample ) --> expected_zero --> UNUR_ERR_DISTR_INVALID ############################################################################# # [chg] ############################################################################## # [init] ############################################################################# # [reinit] ############################################################################# # [sample] ############################################################################# # [validate] ############################################################################# ############################################################################# [verbatim] ############################################################################# unuran-1.11.0/tests/t_util_matrix.c0000644001357500135600000002276614430713513014245 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for MATRIX **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); int unur_matrix_set_verify( UNUR_PAR *par, int verify); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* header files */ #include #include /* function prototypes */ void _unur_test_set_matrix_1(int dim, double *M); void _unur_test_set_matrix_2(int dim, double *M); int _unur_test_matrix(int dim); /* dimension of test matrix */ static const int dim_testmatrix = 50; /* max tolerable absolute error */ static const double error_absolute_max = 1.e-12; #ifndef M_PI #define M_PI 3.14159265358979323846264338328 /* pi */ #endif #define COMPARE_SAMPLE_SIZE (10000) #define VIOLATE_SAMPLE_SIZE (20) /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ void _unur_test_set_matrix_1(int dim, double *M) { #define idx1(a,b) ((a-1)*dim+(b-1)) int i,j,k; double p; /* original derflinger test-matrix */ p = M_PI/(dim+1); for (i=1; i<=dim; i++) { for (k=1; k<=i; k++) { M[idx1(i,k)]=0.; for (j=1; j<=dim; j++) { M[idx1(i,k)] += sin(p*i*j)*j*sin(p*j*k); } M[idx1(k,i)] = M[idx1(i,k)]; }} #undef idx1 } /* end of _unur_test_set_matrix_1() */ /*-------------------------------------------------------------------------*/ void _unur_test_set_matrix_2(int dim, double *M) { #define idx1(a,b) ((a-1)*dim+(b-1)) int i,j,k; /* another test-matrix */ for (i=1; i<=dim; i++) { for (k=1; k<=i; k++) { M[idx1(i,k)]=0.; for (j=1; j<=dim; j++) { M[idx1(i,k)] = 1./(i+k); } M[idx1(k,i)] = M[idx1(i,k)]; }} #undef idx1 } /* end of _unur_test_set_matrix_2() */ /*-------------------------------------------------------------------------*/ int _unur_test_matrix(int dim) { #define idx1(a,b) ((a-1)*dim+(b-1)) int i, ret; double *M; double *values; double *vectors; double error_absolute; double error_relative; int error_counter = 0; char error_char; /* allocate memory */ M = malloc(dim*dim*sizeof(double)); values = malloc(dim*sizeof(double)); vectors = malloc(dim*dim*sizeof(double)); _unur_test_set_matrix_1(dim, M); error_counter = 0; ret = _unur_matrix_eigensystem(dim, M, values, vectors); if (ret == UNUR_SUCCESS) { fprintf(TESTLOG, " # \t Eigenvalue \t\t Expected \t\t Abs. Error \t Rel. Error\n"); for (i=0; i error_absolute_max) { /* eigenvalue is not ok */ error_char = '*'; error_counter++; } else { /* eigenvalue is ok */ error_char = ' '; } fprintf(TESTLOG, "%02d : \t%18.15f \t%18.15f \t% 8.4e \t% 8.4e %c\n", i+1, 2.*values[i]/(dim+1), (double) (i+1) , error_absolute, error_relative, error_char); } if (error_counter!=0) printf(" failed at %d eigenvalues", error_counter); } else { ++error_counter; printf(": init"); } /* free memory */ free(M); free(values); free(vectors); /* return number of errors */ return error_counter; #undef idx1 } /* end of _unur_test_matrix() */ /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [special] */ void test_special (void) { /* set boolean to FALSE */ int FAILED = 0; /* start test */ printf("[special "); fflush(stdout); fprintf(TESTLOG,"\n[special]\n"); /* set stop watch */ stopwatch_lap(&watch); printf("\nEigensystem"); /* run tests */ FAILED = _unur_test_matrix(dim_testmatrix); /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (FAILED) ? 0 : 1; (FAILED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_special() */ /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_matrix_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_distr.conf0000644001357500135600000000433614420445767013541 00000000000000############################################################################# [main] [main - data:] # method (for information only: the program scans the file name) method: DISTR [main - header:] /* prototypes */ \#define COMPARE_SAMPLE_SIZE (500) \#define VIOLATE_SAMPLE_SIZE (20) ############################################################################# [new] ############################################################################# [set] [set - invalid NULL ptr: distr = NULL; ] unur_distr_set_name( distr, "nix" ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_set_extobj( distr, NULL ); --> expected_setfailed --> UNUR_ERR_NULL ############################################################################# [get] [get - invalid NULL ptr: distr = NULL; ] unur_distr_get_name( distr ); --> expected_NULL --> UNUR_ERR_NULL (int) unur_distr_get_type( distr ); --> expected_zero --> UNUR_ERR_NULL unur_distr_get_dim( distr ); --> expected_zero --> UNUR_ERR_NULL unur_distr_is_cont( distr ); --> expected_zero --> UNUR_ERR_NULL unur_distr_is_cvec( distr ); --> expected_zero --> UNUR_ERR_NULL unur_distr_is_cemp( distr ); --> expected_zero --> UNUR_ERR_NULL unur_distr_is_cvemp( distr ); --> expected_zero --> UNUR_ERR_NULL unur_distr_is_matr( distr ); --> expected_zero --> UNUR_ERR_NULL unur_distr_is_discr( distr ); --> expected_zero --> UNUR_ERR_NULL unur_distr_get_extobj( distr ); --> expected_NULL --> UNUR_ERR_NULL ############################################################################# # [chg] ############################################################################## # [init] ############################################################################# # [reinit] ############################################################################# # [sample] ############################################################################# # [validate] ############################################################################# ############################################################################# [verbatim] ############################################################################# unuran-1.11.0/tests/t_distr_matr.conf0000644001357500135600000000335114420445767014560 00000000000000############################################################################# [main] [main - data:] # method (for information only: the program scans the file name) method: DISTR_MATR [main - header:] /* prototypes */ \#define COMPARE_SAMPLE_SIZE (500) \#define VIOLATE_SAMPLE_SIZE (20) ############################################################################# [new] [new - invalid data: distr = NULL; ] unur_distr_matr_new(0,3); --> expected_NULL --> UNUR_ERR_DISTR_SET unur_distr_matr_new(3,0); --> expected_NULL --> UNUR_ERR_DISTR_SET ############################################################################# # [set] ############################################################################# [get] [get - invalid NULL ptr: int n_rows, n_cols; distr = NULL; ] ~_dim( distr, &n_rows, &n_cols ); --> expected_zero --> UNUR_ERR_NULL [get - invalid distribution type: int n_rows, n_cols; distr = unur_distr_discr_new(); ] ~_dim( distr, &n_rows, &n_cols ); --> expected_zero --> UNUR_ERR_DISTR_INVALID ############################################################################# # [chg] ############################################################################## # [init] ############################################################################# # [reinit] ############################################################################# # [sample] ############################################################################# # [validate] ############################################################################# ############################################################################# [verbatim] ############################################################################# unuran-1.11.0/tests/t_dss.c0000644001357500135600000010160014430713513012456 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for DSS **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); int unur_dss_set_verify( UNUR_PAR *par, int verify); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ #define COMPARE_SAMPLE_SIZE (15000) #define VIOLATE_SAMPLE_SIZE (20) const int n_pv = 36; const double pv[36]={1,2,3,4,5,6,5,3,6,7,5,4,3,4,6,7,5,3,4,3,8,6,5,4,7,7,2,2,1,4,7,4,3,7,3,2}; const double pvsum = 158.; const double pvre[10] = {1,2,3,4,5,6,7,8,9,10}; const double pvresum = 55.; double my_pmf(int k, const UNUR_DISTR *distr); double my_cdf(int k, const UNUR_DISTR *distr); /* #define SEED (298346) */ /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ double my_pmf(int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { if (k<0 || k>35) return 0.; else return pv[k]; } double my_cdf(int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double sum; int j; if (k<0) return 0.; if (k>=35) return 1.; for (sum=0.,j=0; j<=k; j++) sum += pv[j]; return sum/pvsum; } /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,37,(unur_dss_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,37,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; distr = unur_distr_cont_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,43,(unur_dss_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,43,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* data missing in distribution object */ UNUR_DISTR *distr = NULL; distr = unur_distr_discr_new(); /* no probability vector */ unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,49,(unur_dss_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,49,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [init] */ void test_init (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[init "); fflush(stdout); fprintf(TESTLOG,"\n[init]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,71,(unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,71,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_init() */ /*---------------------------------------------------------------------------*/ /* [reinit] */ void test_reinit (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[reinit "); fflush(stdout); fprintf(TESTLOG,"\n[reinit]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* exist */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[2] = {10.,0.63}; distr = unur_distr_binomial(fpar,2); par = unur_dss_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 81, gen ); unur_reset_errno(); n_tests_failed += (check_expected_reinit(TESTLOG,85,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_reinit() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* compare clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; UNUR_GEN *clone; double fpar[] = {10,0.3}; distr = unur_distr_binomial(fpar,2); par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_dss_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,102,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,108,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare reinit */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[] = {10,0.3}; distr = unur_distr_binomial(fpar,2); par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_dss_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,121,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* reinit */ unur_reinit(gen); n_tests_failed += (compare_sequence_gen(TESTLOG,125,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare stringparser */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double pvec[] = {.1, .2, .3, .4, .5, .6, .7, .8, .9, 1.}; distr = NULL; par = NULL; gen = NULL; unur_reset_errno(); distr = unur_distr_discr_new(); unur_distr_discr_set_pv(distr,pvec,10); unur_distr_discr_set_pmfsum(distr,46.); par = unur_dss_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,140,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "discr; pv = (.1, .2, .3, .4, .5, .6, .7, .8, .9, 1.); pmfsum=46 \ & method = dss" ); n_tests_failed += (compare_sequence_gen(TESTLOG,146,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* [validate] */ /*---------------------------------------------------------------------------*/ /* [validate] */ void test_validate (void) { /* suppress GCC compiler warning */ GCC_DIAG_OFF(unused-variable) UNUR_DISTR *distr[16]; UNUR_PAR *par; UNUR_GEN *gen; double *darray; double fpm[10]; int n_tests_failed; int rcode; /* start test */ printf("[validate "); fflush(stdout); fprintf(TESTLOG,"\n[validate]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* distributions: 16 */ { distr[0] = unur_distr_discr_new(); unur_distr_discr_set_pv(distr[0],pv,n_pv); unur_distr_discr_set_pmfsum(distr[0],pvsum); unur_distr_set_name(distr[0],"pv(0..35)"); } { distr[1] = unur_distr_discr_new(); unur_distr_discr_set_pv(distr[1],pv,n_pv); unur_distr_discr_set_domain(distr[1],100,135); unur_distr_discr_set_pmfsum(distr[1],pvsum); unur_distr_set_name(distr[1],"pv(100..135)"); } { distr[2] = unur_distr_discr_new(); unur_distr_discr_set_pmf(distr[2],my_pmf); unur_distr_discr_set_pmfsum(distr[2],pvsum); unur_distr_set_name(distr[2],"pmf(0..35)"); } { distr[14] = unur_distr_discr_new(); unur_distr_discr_set_pmf(distr[14],my_pmf); unur_distr_discr_set_domain(distr[14],0,35); unur_distr_discr_set_pmfsum(distr[14],pvsum); unur_distr_set_name(distr[14],"pmf(0..35)"); } { distr[3] = unur_distr_discr_new(); unur_distr_discr_set_cdf(distr[3],my_cdf); unur_distr_set_name(distr[3],"cdf(0..35)"); } { distr[15] = unur_distr_discr_new(); unur_distr_discr_set_cdf(distr[15],my_cdf); unur_distr_discr_set_domain(distr[15],0,35); unur_distr_set_name(distr[15],"cdf(0..35)"); } { fpm[0] = 0.5; distr[4] = unur_distr_geometric(fpm,1); } { fpm[0] = 0.01; distr[5] = unur_distr_geometric(fpm,1); } { fpm[0] = 0.1; distr[6] = unur_distr_logarithmic(fpm,1); } { fpm[0] = 0.99; distr[7] = unur_distr_logarithmic(fpm,1); } { fpm[0] = 0.5; fpm[1] = 10.; distr[8] = unur_distr_negativebinomial(fpm,2); } { fpm[0] = 0.8; fpm[1] = 10.; distr[9] = unur_distr_negativebinomial(fpm,2); } { fpm[0] = 0.1; distr[10] = unur_distr_poisson(fpm,1); } { fpm[0] = 0.999; distr[11] = unur_distr_poisson(fpm,1); } { fpm[0] = 20.; fpm[1] = 0.8; distr[12] = unur_distr_binomial(fpm,2); } { fpm[0] = 2000.; fpm[1] = 0.0013; distr[13] = unur_distr_binomial(fpm,2); } /* timing */ stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); printf("\n(chi^2) "); fflush(stdout); /* chi^2 tests: 64 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nChi^2 Test:\n"); /* distribution [0] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_dss_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { UNUR_DISTR *dg =NULL; par = unur_dss_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { UNUR_DISTR *dg =NULL; par = unur_dss_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pv(dg,pvre,10); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_dss_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { UNUR_DISTR *dg =NULL; par = unur_dss_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { UNUR_DISTR *dg =NULL; par = unur_dss_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pv(dg,pvre,10); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [2] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_dss_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); { UNUR_DISTR *dg =NULL; par = unur_dss_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [14] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_dss_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); { UNUR_DISTR *dg =NULL; par = unur_dss_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [3] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_dss_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [15] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_dss_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [4] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_dss_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); { UNUR_DISTR *dg =NULL; par = unur_dss_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [5] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_dss_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); { UNUR_DISTR *dg =NULL; par = unur_dss_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [6] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_dss_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); { UNUR_DISTR *dg =NULL; par = unur_dss_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [7] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_dss_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); { UNUR_DISTR *dg =NULL; par = unur_dss_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [8] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_dss_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); { UNUR_DISTR *dg =NULL; par = unur_dss_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [9] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_dss_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); { UNUR_DISTR *dg =NULL; par = unur_dss_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [10] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_dss_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); { UNUR_DISTR *dg =NULL; par = unur_dss_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [11] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_dss_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); { UNUR_DISTR *dg =NULL; par = unur_dss_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [12] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_dss_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); { UNUR_DISTR *dg =NULL; par = unur_dss_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); { UNUR_DISTR *dg =NULL; par = unur_dss_new(distr_localcopy); fpm[0] = 10.; fpm[1] = 0.63; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [13] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_dss_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); { UNUR_DISTR *dg =NULL; par = unur_dss_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); { UNUR_DISTR *dg =NULL; par = unur_dss_new(distr_localcopy); fpm[0] = 10.; fpm[1] = 0.63; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); /* free distributions */ unur_distr_free(distr[0]); unur_distr_free(distr[1]); unur_distr_free(distr[2]); unur_distr_free(distr[3]); unur_distr_free(distr[4]); unur_distr_free(distr[5]); unur_distr_free(distr[6]); unur_distr_free(distr[7]); unur_distr_free(distr[8]); unur_distr_free(distr[9]); unur_distr_free(distr[10]); unur_distr_free(distr[11]); unur_distr_free(distr[12]); unur_distr_free(distr[13]); unur_distr_free(distr[14]); unur_distr_free(distr[15]); /* test finished */ test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; /* we accept CHI2_FAILURES_TOLERATED failures */ (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_validate */ /* enable GCC compiler warning */ GCC_DIAG_ON(unused-variable) /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_dss_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_tdr.c0000644001357500135600000011517414430713513012471 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for TDR **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ double pdf( double x, const UNUR_DISTR *distr ); double pdf_bimodal( double x, const UNUR_DISTR *distr ); double dpdf_bimodal( double x, const UNUR_DISTR *distr ); double pdf_negative( double x, const UNUR_DISTR *distr ); double dpdf_negative( double x, const UNUR_DISTR *distr ); double pdf_partnegative( double x, const UNUR_DISTR *distr ); double dpdf_partnegative( double x, const UNUR_DISTR *distr ); #define COMPARE_SAMPLE_SIZE (10000) #define VIOLATE_SAMPLE_SIZE (20) /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ /* pdf of bimodal density */ double pdf_bimodal( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return ( exp(-(x-1.)*(x-1.)) + exp(-(x+1.)*(x+1.)) ); } double dpdf_bimodal( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return ( -2. * (x-1.) * exp(-(x-1.)*(x-1.)) -2. * (x+1.) * exp(-(x+1.)*(x+1.)) ); } /* pdf with negative value */ double pdf_negative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return (-x*x); } double dpdf_negative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return (-2.*x); } /* pdf with partial negative value */ double pdf_partnegative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return ((x>-0.89 && x<0.89) ? -1.: exp(-x*x)); } double dpdf_partnegative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return ((x>-0.89 && x<0.89) ?0.: -2.*x*exp(-x*x)); } /* pdf of normal density */ double pdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return exp(-x*x/2.); } /* end of pdf */ /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,35,(unur_tdr_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,35,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,41,(unur_tdr_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,41,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* data missing in distribution object */ UNUR_DISTR *distr = NULL; distr = unur_distr_cont_new(); unur_reset_errno(); /* pdf, dpdf */ n_tests_failed += (check_expected_NULL(TESTLOG,48,(unur_tdr_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,48,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* dpdf */ unur_distr_cont_set_pdf(distr,pdf); n_tests_failed += (check_expected_NULL(TESTLOG,53,(unur_tdr_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,53,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [set] */ void test_set (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[set "); fflush(stdout); fprintf(TESTLOG,"\n[set]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,63,(unur_tdr_set_cpoints( par, 0, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,63,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,66,(unur_tdr_set_reinit_percentiles( par, 0, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,66,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,69,(unur_tdr_set_guidefactor( par, 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,69,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,72,(unur_tdr_set_max_sqhratio( par, 0.95 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,72,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,75,(unur_tdr_set_max_intervals( par, 100 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,75,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,78,(unur_tdr_set_usecenter( par, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,78,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,81,(unur_tdr_set_usemode( par, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,81,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,84,(unur_tdr_set_variant_gw( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,84,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,87,(unur_tdr_set_variant_ps( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,87,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,90,(unur_tdr_set_variant_ia( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,90,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,93,(unur_tdr_set_usedars( par, TRUE )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,93,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,96,(unur_tdr_set_darsfactor( par, 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,96,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,99,(unur_tdr_set_c( par, -0.5 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,99,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,102,(unur_tdr_set_verify( par, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,102,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,105,(unur_tdr_set_pedantic( par, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,105,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* invalid parameter object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_arou_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,114,(unur_tdr_set_cpoints( par, 0, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,114,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,117,(unur_tdr_set_reinit_percentiles( par, 0, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,117,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,120,(unur_tdr_set_guidefactor( par, 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,120,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,123,(unur_tdr_set_max_sqhratio( par, 0.95 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,123,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,126,(unur_tdr_set_max_intervals( par, 100 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,126,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,129,(unur_tdr_set_usecenter( par, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,129,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,132,(unur_tdr_set_usemode( par, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,132,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,135,(unur_tdr_set_variant_gw( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,135,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,138,(unur_tdr_set_variant_ps( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,138,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,141,(unur_tdr_set_variant_ia( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,141,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,144,(unur_tdr_set_usedars( par, TRUE )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,144,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,147,(unur_tdr_set_darsfactor( par, 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,147,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,150,(unur_tdr_set_c( par, -0.5 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,150,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,153,(unur_tdr_set_verify( par, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,153,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,156,(unur_tdr_set_pedantic( par, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,156,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double perc[] = {0.1,0.4,0.2}; double stp[] = {1.,0.,1.}; int n_stp = 3; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_tdr_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,169,(unur_tdr_set_cpoints( par, -1, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,169,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,172,(unur_tdr_set_cpoints( par, n_stp, stp )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,172,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_tdr_set_reinit_percentiles( par, -1, NULL ); n_tests_failed += (check_errorcode(TESTLOG,175,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,178,(unur_tdr_set_reinit_percentiles( par, n_stp, stp )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,178,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,181,(unur_tdr_set_reinit_percentiles( par, n_stp, perc )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,181,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,184,(unur_tdr_set_guidefactor( par, -1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,184,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,187,(unur_tdr_set_max_sqhratio( par, -1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,187,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,190,(unur_tdr_set_max_sqhratio( par, 2. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,190,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,193,(unur_tdr_set_max_intervals( par, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,193,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,196,(unur_tdr_set_usedars( par, -1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,196,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,199,(unur_tdr_set_darsfactor( par, -1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,199,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,202,(unur_tdr_set_c( par, 0.5 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,202,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,205,(unur_tdr_set_c( par, -0.6 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,205,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_tdr_set_c( par, -0.3 ); n_tests_failed += (check_errorcode(TESTLOG,208,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_set() */ /*---------------------------------------------------------------------------*/ /* [get] */ void test_get (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[get "); fflush(stdout); fprintf(TESTLOG,"\n[get]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid generator object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); gen = unur_init(par); abort_if_NULL(TESTLOG, 218, gen ); unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,222,(unur_tdr_get_sqhratio(gen)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,222,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,225,(unur_tdr_get_hatarea(gen)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,225,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,228,(unur_tdr_get_squeezearea(gen)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,228,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_get() */ /*---------------------------------------------------------------------------*/ /* [chg] */ void test_chg (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[chg "); fflush(stdout); fprintf(TESTLOG,"\n[chg]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid generator object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_arou_new(distr); unur_set_debug(par,0); gen = unur_init( par ); abort_if_NULL(TESTLOG, 239, gen ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,243,(unur_tdr_chg_reinit_percentiles(gen, -1, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,243,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,246,(unur_tdr_chg_verify(gen,1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,246,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double percmon[] = {0.1,0.4,0.2}; double percdom[] = {0.1,0.4,2.}; int n_perc = 3; distr = unur_distr_normal(NULL,0); par = unur_tdr_new(distr); unur_set_debug(par,0); gen = unur_init( par ); abort_if_NULL(TESTLOG, 255, gen ); unur_reset_errno(); unur_tdr_chg_reinit_percentiles( gen, -1, NULL ); n_tests_failed += (check_errorcode(TESTLOG,259,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,262,(unur_tdr_chg_reinit_percentiles( gen, n_perc, percmon )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,262,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,265,(unur_tdr_chg_reinit_percentiles( gen, n_perc, percdom )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,265,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_chg() */ /*---------------------------------------------------------------------------*/ /* [init] */ void test_init (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[init "); fflush(stdout); fprintf(TESTLOG,"\n[init]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,276,(unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,276,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* stp out of domain */ UNUR_GEN *gen = NULL; UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double stp[] = {-2.5,-1.,0.,1.,2.5}; int n_stp = 5; gen = NULL; distr = unur_distr_normal(NULL,0); unur_distr_cont_set_domain(distr,-2.,2.); par = unur_tdr_new(distr); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints( par, n_stp, stp ); unur_reset_errno(); gen = unur_init( par ); n_tests_failed += (check_errorcode(TESTLOG,289,UNUR_ERR_GEN_DATA)==UNUR_SUCCESS)?0:1; unur_free(gen); unur_distr_free(distr); } { /* bimodal */ UNUR_GEN *gen = NULL; UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; gen = NULL; distr = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr,pdf_bimodal); unur_distr_cont_set_dpdf(distr,dpdf_bimodal); par = unur_tdr_new(distr); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints( par, 30, NULL ); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,301,(gen = unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,301,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; unur_free(gen); unur_distr_free(distr); } { /* wrong mode */ UNUR_GEN *gen = NULL; UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; gen = NULL; distr = unur_distr_normal(NULL,0); par = NULL; unur_reset_errno(); unur_distr_cont_set_mode(distr,-1.); par = unur_tdr_new(distr); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints( par, 30, NULL ); n_tests_failed += (check_expected_NULL(TESTLOG,313,(gen = unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,313,UNUR_ERR_GEN_DATA)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_distr_cont_set_mode(distr,1.); par = unur_tdr_new(distr); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints( par, 30, NULL ); gen = unur_init( par ); n_tests_failed += (check_errorcode(TESTLOG,320,UNUR_ERR_GEN_DATA)==UNUR_SUCCESS)?0:1; unur_free(gen); unur_distr_free(distr); } { /* negative value of pdf */ UNUR_GEN *gen = NULL; UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; gen = NULL; distr = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr,pdf_negative); unur_distr_cont_set_dpdf(distr,dpdf_negative); par = NULL; unur_reset_errno(); par = unur_tdr_new(distr); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints( par, 30, NULL ); n_tests_failed += (check_expected_NULL(TESTLOG,333,(gen = unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,333,UNUR_ERR_GEN_DATA)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_distr_cont_set_domain(distr,-2.,2.); par = unur_tdr_new(distr); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints( par, 30, NULL ); n_tests_failed += (check_expected_NULL(TESTLOG,340,(gen = unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,340,UNUR_ERR_GEN_DATA)==UNUR_SUCCESS)?0:1; unur_free(gen); unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_init() */ /*---------------------------------------------------------------------------*/ /* [reinit] */ void test_reinit (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[reinit "); fflush(stdout); fprintf(TESTLOG,"\n[reinit]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* exist */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_tdr_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 348, gen ); unur_reset_errno(); n_tests_failed += (check_expected_reinit(TESTLOG,352,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_reinit() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_GEN *gen = NULL; gen = NULL; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,362,(unur_tdr_eval_invcdfhat(gen,0.5,NULL,NULL,NULL)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,362,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_free(gen); } { /* invalid generator object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); gen = unur_init(par); abort_if_NULL(TESTLOG, 368, gen ); unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,372,(unur_tdr_eval_invcdfhat(gen,0.5,NULL,NULL,NULL)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,372,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* invalid domain */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_tdr_new(distr); unur_set_debug(par,0); gen = unur_init( par ); abort_if_NULL(TESTLOG, 379, gen ); unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,383,(unur_tdr_eval_invcdfhat(gen,1.5,NULL,NULL,NULL)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,383,UNUR_ERR_DOMAIN)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_negINFINITY(TESTLOG,386,(unur_tdr_eval_invcdfhat(gen,-0.5,NULL,NULL,NULL)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,386,UNUR_ERR_DOMAIN)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* partial negative value of pdf */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; int i; double x; double stp[] = {-0.9,0.9}; int n_stp = 2; distr = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr,pdf_partnegative); unur_distr_cont_set_dpdf(distr,dpdf_partnegative); par = unur_tdr_new(distr); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_usecenter(par,FALSE); unur_tdr_set_cpoints( par, n_stp, stp ); unur_tdr_set_pedantic( par, 1 ); gen = unur_init( par ); abort_if_NULL(TESTLOG, 402, gen ); unur_reset_errno(); for (i=0; i<100; i++) { x = unur_sample_cont(gen); } n_tests_failed += (check_expected_INFINITY(TESTLOG,407,(x))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,407,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = unur_distr_normal(NULL,0); par = NULL; unur_reset_errno(); /* GW, c = -0.5 */ par = unur_tdr_new(distr); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); n_tests_failed += (compare_sequence_par_start(TESTLOG,422,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* GW, c = -0.5 - verifying mode */ par = unur_tdr_new(distr); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_verify(par,1); unur_tdr_set_usedars(par,FALSE); n_tests_failed += (compare_sequence_par(TESTLOG,430,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* PS, c = -0.5 */ par = unur_tdr_new(distr); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); n_tests_failed += (compare_sequence_par_start(TESTLOG,437,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* PS, c = -0.5 - verifying mode */ par = unur_tdr_new(distr); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_verify(par,1); unur_tdr_set_usedars(par,FALSE); n_tests_failed += (compare_sequence_par(TESTLOG,445,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* IA, c = -0.5 */ par = unur_tdr_new(distr); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); n_tests_failed += (compare_sequence_par_start(TESTLOG,452,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* IA, c = -0.5 - verifying mode */ par = unur_tdr_new(distr); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_verify(par,1); unur_tdr_set_usedars(par,FALSE); n_tests_failed += (compare_sequence_par(TESTLOG,460,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* GW, c = 0 */ par = unur_tdr_new(distr); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); n_tests_failed += (compare_sequence_par_start(TESTLOG,470,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* GW, c = 0, verifying mode */ par = unur_tdr_new(distr); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_verify(par,1); unur_tdr_set_usedars(par,FALSE); n_tests_failed += (compare_sequence_par(TESTLOG,478,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* PS, c = 0 */ par = unur_tdr_new(distr); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); n_tests_failed += (compare_sequence_par_start(TESTLOG,485,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* PS, c = 0, verifying mode */ par = unur_tdr_new(distr); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_verify(par,1); unur_tdr_set_usedars(par,FALSE); n_tests_failed += (compare_sequence_par(TESTLOG,493,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* IA, c = 0 */ par = unur_tdr_new(distr); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); n_tests_failed += (compare_sequence_par_start(TESTLOG,500,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* IA, c = 0, verifying mode */ par = unur_tdr_new(distr); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); unur_tdr_set_verify(par,1); unur_tdr_set_usedars(par,FALSE); n_tests_failed += (compare_sequence_par(TESTLOG,508,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* compare clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; UNUR_GEN *clone; distr = unur_distr_normal(NULL,0); par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_tdr_new(distr); unur_tabl_set_max_sqhratio(par,0.); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,522,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,528,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare stringparser */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[2] = {3.,3.}; distr = NULL; par = NULL; gen = NULL; unur_reset_errno(); distr = unur_distr_gamma(fpar,2); unur_distr_cont_set_center(distr,2.1); par = unur_tdr_new(distr); unur_tdr_set_cpoints(par,20,NULL); unur_tdr_set_guidefactor(par,2.); unur_tdr_set_max_intervals(par,32); unur_tdr_set_max_sqhratio(par,0.9); unur_tdr_set_usecenter(par,TRUE); unur_tdr_set_verify(par,TRUE); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,548,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "gamma(3.,3.); center = 2.1 & \ method = tdr; usecenter; cpoints = 20; guidefactor = 2.; \ max_intervals = 32; max_sqhratio = 0.9; verify" ); n_tests_failed += (compare_sequence_gen(TESTLOG,555,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; distr = unur_distr_gamma(fpar,2); par = unur_tdr_new(distr); unur_tdr_set_cpoints(par,9,NULL); unur_tdr_set_pedantic(par,TRUE); unur_tdr_set_usemode(par,FALSE); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,565,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "gamma(3.,3.) & \ method = tdr; cpoints = 9; pedantic; usemode = false" ); n_tests_failed += (compare_sequence_gen(TESTLOG,571,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; distr = unur_distr_gamma(fpar,2); par = unur_tdr_new(distr); unur_tdr_set_c(par,0.); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,579,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "gamma(3.,3.) & \ method = tdr; c = 0." ); n_tests_failed += (compare_sequence_gen(TESTLOG,585,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; distr = unur_distr_gamma(fpar,2); par = unur_tdr_new(distr); unur_tdr_set_c(par,-0.5); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,593,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "gamma(3.,3.) & \ method = tdr; c = -0.5" ); n_tests_failed += (compare_sequence_gen(TESTLOG,599,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; distr = unur_distr_gamma(fpar,2); par = unur_tdr_new(distr); unur_tdr_set_variant_gw(par); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,607,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "gamma(3.,3.) & \ method = tdr; variant_gw" ); n_tests_failed += (compare_sequence_gen(TESTLOG,613,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; distr = unur_distr_gamma(fpar,2); par = unur_tdr_new(distr); unur_tdr_set_variant_ia(par); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,621,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "gamma(3.,3.) & \ method = tdr; variant_ia" ); n_tests_failed += (compare_sequence_gen(TESTLOG,627,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; distr = unur_distr_gamma(fpar,2); par = unur_tdr_new(distr); unur_tdr_set_variant_ps(par); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,635,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "gamma(3.,3.) & \ method = tdr; variant_ps" ); n_tests_failed += (compare_sequence_gen(TESTLOG,641,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_tdr_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_vempk.conf0000644001357500135600000001406314420445767013534 00000000000000############################################################################# [main] [main - data:] # method (for information only: the program scans the file name) method: VEMPK [main - header:] /* prototypes */ \#define COMPARE_SAMPLE_SIZE (10000) \#define VIOLATE_SAMPLE_SIZE (20) ############################################################################# [new] [new - invalid NULL ptr: distr = NULL; ] ~( distr ); --> expected_NULL --> UNUR_ERR_NULL [new - invalid distribution type: distr = unur_distr_discr_new(); ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID [new - data missing in distribution object: distr = unur_distr_cvemp_new(2); ] /* data */ ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED ############################################################################# [set] [set - invalid NULL ptr: par = NULL; ] ~_smoothing( par, 1. ); --> expected_setfailed --> UNUR_ERR_NULL ~_varcor( par, 1 ); --> expected_setfailed --> UNUR_ERR_NULL [set - invalid parameter object: distr = unur_distr_normal(NULL,0); par = unur_tdr_new(distr); ] ~_smoothing( par, 1. ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_varcor( par, 1 ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID unur_par_free (par); [set - invalid parameters: double data[] = {1.,1.,-1.,1.,1.,-1.,-1.,-1. }; distr = unur_distr_cvemp_new(2); unur_distr_cvemp_set_data(distr, data, 4); par = unur_vempk_new(distr); ] ~_smoothing( par, -1. ); --> expected_setfailed --> UNUR_ERR_PAR_SET unur_par_free(par); ############################################################################# # [get] ############################################################################# [chg] [chg - invalid NULL ptr: gen = NULL; ] ~_smoothing( gen, 1.); --> expected_setfailed --> UNUR_ERR_NULL ~_varcor( gen, 1 ); --> expected_setfailed --> UNUR_ERR_NULL [chg - invalid generator object: gen = unur_str2gen("normal"); <-- ! NULL ] ~_smoothing( gen, 1.); --> expected_setfailed --> UNUR_ERR_GEN_INVALID ~_varcor( gen, 1 ); --> expected_setfailed --> UNUR_ERR_GEN_INVALID [chg - invalid parameters: double data[] = {1.,1.,-1.,1.,1.,-1.,-1.,-1. }; distr = unur_distr_cvemp_new(2); unur_distr_cvemp_set_data(distr, data, 4); par = unur_vempk_new(distr); gen = unur_init(par); <-- ! NULL ] ~_smoothing( gen, -1.); --> expected_setfailed --> UNUR_ERR_PAR_SET ############################################################################# # [init] ############################################################################# [reinit] [reinit - does not exist: double x[2]; double data[] = {1.,1.,-1.,1.,1.,-1.,-1.,-1. }; distr = unur_distr_cvemp_new(2); unur_distr_cvemp_set_data(distr, data, 4); par = unur_vempk_new(distr); gen = unur_init( par ); <-- ! NULL ] unur_reinit( gen ); --> expected_setfailed --> UNUR_ERR_NO_REINIT unur_sample_vec( gen, x ); x[0]; --> expected_INFINITY --> UNUR_ERR_GEN_CONDITION ############################################################################# [sample] [sample - compare clone: double data[] = {1.,1.,-1.,1.,1.,-1.,-1.,-1. }; UNUR_GEN *clone = NULL; distr = unur_distr_cvemp_new(2); unur_distr_cvemp_set_data(distr, data, 4); par = unur_vempk_new(distr); gen = unur_init(par); <-- ! NULL ] /* default generator object */ -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen /* set smoothing factor */ unur_free(gen); par = unur_vempk_new(distr); unur_vempk_set_smoothing( par, 3. ); gen = unur_init( par ); -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen #..................................................................... #[sample - compare stringparser: # distr = NULL; # par = NULL; # gen = NULL; ] # # Not implemented yet! # ############################################################################# [validate] [validate - generators:] # default par[0] = unur_vempk_new(@distr@); # use variance correction par[1] = unur_vempk_new(@distr@); unur_vempk_set_varcor(par,TRUE); [validate - distributions:] # approximate normal distribution \#define dim (2) { double *data; UNUR_DISTR *dist_mnormal; UNUR_GEN *gen_mnormal; int i; const int ss = 100000; data = malloc(dim*ss*sizeof(double)); dist_mnormal = unur_distr_multinormal(dim,NULL,NULL); gen_mnormal = unur_init(unur_mvstd_new(dist_mnormal)); for (i=0;i + + # approximate normal distribution (dim=2, sample size 100000) <1> + + # approximate normal distribution (dim=3, sample size 100000) ############################################################################# ############################################################################# [verbatim] ############################################################################# unuran-1.11.0/tests/t_distr_discr.c0000644001357500135600000006454214430713513014213 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for DISTR_DISCR **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); int unur_distr_discr_set_verify( UNUR_PAR *par, int verify); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ #include /* prototypes */ #define COMPARE_SAMPLE_SIZE (500) #define VIOLATE_SAMPLE_SIZE (20) double pmf(int k, const UNUR_DISTR *distr); double icdf(int k, const UNUR_DISTR *distr); int invcdf(double x, const UNUR_DISTR *distr); /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ double pmf(int k ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return 1.; } double icdf(int k ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return 1.; } int invcdf(double x ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return 1; } /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [set] */ void test_set (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[set "); fflush(stdout); fprintf(TESTLOG,"\n[set]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,36,(unur_distr_discr_set_pv( distr, NULL, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,36,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,39,(unur_distr_discr_set_pmf( distr, pmf )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,39,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,42,(unur_distr_discr_set_cdf( distr, icdf )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,42,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,45,(unur_distr_discr_set_invcdf( distr, invcdf )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,45,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,48,(unur_distr_discr_set_pmfstr( distr, "pmf" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,48,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,51,(unur_distr_discr_set_cdfstr( distr, "cdf" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,51,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,54,(unur_distr_discr_set_pmfparams( distr, NULL, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,54,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,57,(unur_distr_discr_set_domain( distr, 0, 10 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,57,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,60,(unur_distr_discr_set_mode( distr, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,60,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,63,(unur_distr_discr_set_pmfsum( distr, 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,63,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; distr = unur_distr_cont_new(); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,70,(unur_distr_discr_set_pv( distr, NULL, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,70,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,73,(unur_distr_discr_set_pmf( distr, pmf )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,73,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,76,(unur_distr_discr_set_cdf( distr, icdf )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,76,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,79,(unur_distr_discr_set_invcdf( distr, invcdf )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,79,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,82,(unur_distr_discr_set_pmfstr( distr, "exp(-k)" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,82,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,85,(unur_distr_discr_set_cdfstr( distr, "exp(-k)" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,85,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,88,(unur_distr_discr_set_pmfparams( distr, NULL, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,88,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,91,(unur_distr_discr_set_domain( distr, 0, 10 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,91,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,94,(unur_distr_discr_set_mode( distr, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,94,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,97,(unur_distr_discr_set_pmfsum( distr, 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,97,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,104,(unur_distr_discr_set_pmf( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,104,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,107,(unur_distr_discr_set_cdf( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,107,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,110,(unur_distr_discr_set_invcdf( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,110,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,113,(unur_distr_discr_set_pmfstr( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,113,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,116,(unur_distr_discr_set_cdfstr( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,116,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,119,(unur_distr_discr_set_pmfparams( distr, NULL, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,119,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; double pv[] = {1.,2.,3.}; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,127,(unur_distr_discr_set_pmfstr( distr, "" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,127,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,130,(unur_distr_discr_set_pmfstr( distr, "beta(2.)" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,130,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,133,(unur_distr_discr_set_cdfstr( distr, "" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,133,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,136,(unur_distr_discr_set_cdfstr( distr, "beta(2.)" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,136,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,139,(unur_distr_discr_set_pmfparams( distr, pv, -1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,139,UNUR_ERR_DISTR_NPARAMS)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,142,(unur_distr_discr_set_pmfparams( distr, pv, UNUR_DISTR_MAXPARAMS +1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,142,UNUR_ERR_DISTR_NPARAMS)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,145,(unur_distr_discr_set_domain( distr, 10, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,145,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,148,(unur_distr_discr_set_pmfsum( distr, -1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,148,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_set() */ /*---------------------------------------------------------------------------*/ /* [get] */ void test_get (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[get "); fflush(stdout); fprintf(TESTLOG,"\n[get]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_zero(TESTLOG,159,(unur_distr_discr_get_pv( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,159,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,162,(unur_distr_discr_get_pmf( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,162,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,165,(unur_distr_discr_get_cdf( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,165,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,168,(unur_distr_discr_get_invcdf( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,168,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,171,(unur_distr_discr_get_pmfstr( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,171,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,174,(unur_distr_discr_get_cdfstr( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,174,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_zero(TESTLOG,177,(unur_distr_discr_get_pmfparams( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,177,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,180,(unur_distr_discr_get_pmfsum( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,180,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_zero(TESTLOG,183,(unur_distr_discr_make_pv( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,183,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; int ia, ib; distr = unur_distr_cont_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,191,(unur_distr_discr_get_pmf( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,191,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,194,(unur_distr_discr_get_cdf( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,194,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,197,(unur_distr_discr_get_invcdf( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,197,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,200,(unur_distr_discr_get_pmfstr( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,200,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,203,(unur_distr_discr_get_cdfstr( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,203,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_zero(TESTLOG,206,(unur_distr_discr_get_pv( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,206,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,209,(unur_distr_discr_get_domain( distr, &ia, &ib )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,209,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_zero(TESTLOG,212,(unur_distr_discr_get_pmfparams( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,212,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,215,(unur_distr_discr_get_pmfsum( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,215,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_zero(TESTLOG,218,(unur_distr_discr_make_pv( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,218,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* parameters not unknown */ UNUR_DISTR *distr = NULL; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,225,(unur_distr_discr_get_pmfstr( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,225,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,228,(unur_distr_discr_get_cdfstr( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,228,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,231,(unur_distr_discr_get_pmfsum( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,231,UNUR_ERR_DISTR_GET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INTMAX(TESTLOG,234,(unur_distr_discr_get_mode( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,234,UNUR_ERR_DISTR_GET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_zero(TESTLOG,237,(unur_distr_discr_make_pv( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,237,UNUR_ERR_DISTR_GET)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_get() */ /*---------------------------------------------------------------------------*/ /* [chg] */ void test_chg (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[chg "); fflush(stdout); fprintf(TESTLOG,"\n[chg]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,248,(unur_distr_discr_upd_mode( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,248,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,251,(unur_distr_discr_upd_pmfsum( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,251,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; distr = unur_distr_cont_new(); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,258,(unur_distr_discr_upd_mode( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,258,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,261,(unur_distr_discr_upd_pmfsum( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,261,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* missing data */ UNUR_DISTR *distr = NULL; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,268,(unur_distr_discr_upd_mode( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,268,UNUR_ERR_DISTR_DATA)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,271,(unur_distr_discr_upd_pmfsum( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,271,UNUR_ERR_DISTR_DATA)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_chg() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,290,(unur_distr_discr_eval_pmf( 1, distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,290,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,293,(unur_distr_discr_eval_cdf( 1, distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,293,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INTMAX(TESTLOG,296,(unur_distr_discr_eval_invcdf( 0.5, distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,296,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution object */ UNUR_DISTR *distr = NULL; distr = unur_distr_cont_new(); unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,304,(unur_distr_discr_eval_pmf( 1, distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,304,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,307,(unur_distr_discr_eval_cdf( 1, distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,307,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INTMAX(TESTLOG,310,(unur_distr_discr_eval_invcdf( 0.5, distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,310,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* missing data */ UNUR_DISTR *distr = NULL; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,318,(unur_distr_discr_eval_pmf( 1, distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,318,UNUR_ERR_DISTR_DATA)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,321,(unur_distr_discr_eval_cdf( 1, distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,321,UNUR_ERR_DISTR_DATA)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INTMAX(TESTLOG,324,(unur_distr_discr_eval_invcdf( 0.5, distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,324,UNUR_ERR_DISTR_DATA)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_distr_discr_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/testunuran.h0000644001357500135600000002370314420445767013602 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: testunuran.h * * * * Prototypes for common test routines * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include #include #include #include #include "testdistributions/testdistributions.h" /* macros and functions for handling floats */ #include #include /*---------------------------------------------------------------------------*/ /* global variables */ /* tresholds */ #define PVAL_LIMIT (1.e-3) /* treshold for p-value for stat. test */ #define DEFAULT_CHI2_FAILURES_TOLERATED (3) /* tolerated number of failed tests */ /* chisquare test */ #define CHI_TEST_INTERVALS 100 /* number of intervals for chi^2 test */ #define CHI_TEST_VERBOSITY 0 /* verbosity level for chi^2 test: 0 | 1 | 2 */ /*---------------------------------------------------------------------------*/ /* constants */ #ifndef TRUE #define TRUE (1) #endif #ifndef FALSE #define FALSE (0) #endif #ifndef M_LN10 #define M_LN10 2.302585092994046 #endif /*---------------------------------------------------------------------------*/ /* define macros for GCC attributes */ #ifdef __GNUC__ # define ATTRIBUTE__UNUSED __attribute__ ((unused)) #else # define ATTRIBUTE__UNUSED #endif /*---------------------------------------------------------------------------*/ /* suppress GCC warnings */ /* from Jonathan Wakely (copied from Patrick Horgan */ /* http://dbp-consulting.com/tutorials/SuppressingGCCWarnings.html ) */ #if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 402 #define GCC_DIAG_STR(s) #s #define GCC_DIAG_JOINSTR(x,y) GCC_DIAG_STR(x ## y) # define GCC_DIAG_DO_PRAGMA(x) _Pragma (#x) # define GCC_DIAG_PRAGMA(x) GCC_DIAG_DO_PRAGMA(GCC diagnostic x) # if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406 # define GCC_DIAG_OFF(x) GCC_DIAG_PRAGMA(push) \ GCC_DIAG_PRAGMA(ignored GCC_DIAG_JOINSTR(-W,x)) # define GCC_DIAG_ON(x) GCC_DIAG_PRAGMA(pop) # else # define GCC_DIAG_OFF(x) GCC_DIAG_PRAGMA(ignored GCC_DIAG_JOINSTR(-W,x)) # define GCC_DIAG_ON(x) GCC_DIAG_PRAGMA(warning GCC_DIAG_JOINSTR(-W,x)) # endif #else # define GCC_DIAG_OFF(x) # define GCC_DIAG_ON(x) #endif /*---------------------------------------------------------------------------*/ /* stop watch (return milliseconds) */ #if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H) /* use gettimeofday() command. Not in ANSI C! */ #include typedef struct timer { struct timeval tv; double start; double interim; double stop; } TIMER; #define stopwatch_get_time(tv) \ ( gettimeofday(&tv, NULL), ((tv).tv_sec * 1.e3 + (tv).tv_usec * 1.e-3) ) #else /* use clock() command. ANSI C but less accurate */ #include typedef struct timer { clock_t tv; double start; double interim; double stop; } TIMER; #define stopwatch_get_time(tv) \ ( (1.e3 * clock()) / CLOCKS_PER_SEC ) #endif void stopwatch_start(TIMER *t); double stopwatch_lap(TIMER *t); double stopwatch_stop(TIMER *t); void stopwatch_init(void); void stopwatch_print( FILE *LOG, const char *format, double etime ); /*---------------------------------------------------------------------------*/ /* set alarm when run time exceeds given limit */ void set_alarm(FILE *LOG); /*---------------------------------------------------------------------------*/ /* count number of function evaluations */ /* set and start counter for PDF and similar functions in parameter object */ int start_counter_fcalls( UNUR_PAR *par ); /* IMPORTANT: * This function uses global variables. * Thus the corresponding parameter/generator object has to be DESTROYED * before this routine is called again. * In addition, it creates a clone of the distribution object to which * the parameter objects points to. * Thus one should run * stop_counter_fcalls() * immediately after the corresponding parameter/generator object has been * destroyed to avoid memory leaks. */ int stop_counter_fcalls(void); /* stop counter for PDF calls and clear memory */ /* reset counter to 0 */ void reset_counter_fcalls(void); /* get number of PDF evaluations */ int get_counter_pdf(void); int get_counter_logpdf(void); int get_counter_cdf(void); /*---------------------------------------------------------------------------*/ /* print header for test log file */ void print_test_log_header( FILE *LOG, unsigned long seed, int fullcheck ); /*---------------------------------------------------------------------------*/ /* check for invalid NULL pointer, that should not happen in this program */ void abort_if_NULL( FILE *LOG, int line, const void *ptr ); /* compare error code */ int check_errorcode( FILE *LOG, int line, int cherrno ); /* check for expected NULL pointer */ /* int do_check_expected_NULL( FILE *LOG, int line, const void *ptr ); */ int do_check_expected_NULL( FILE *LOG, int line, int is_NULL ); #define check_expected_NULL(LOG,line,ptr) \ do_check_expected_NULL((LOG),(line),((ptr)==NULL)?1:0 ) /* check for "set failed" */ int check_expected_setfailed( FILE *LOG, int line, int rcode ); /* check for expected zero (int 0) */ int check_expected_zero( FILE *LOG, int line, int k ); /* check for INFINITY */ int check_expected_INFINITY( FILE *LOG, int line, double x ); int check_expected_negINFINITY( FILE *LOG, int line, double x ); int check_expected_INTMAX( FILE *LOG, int line, int k ); /* check for reinit */ int check_expected_reinit( FILE *LOG, int line, int rcode ); /* check for non existing reinit */ int check_expected_no_reinit( FILE *LOG, int line, int rcode ); /* compare sequences generated by generator */ int compare_sequence_gen_start ( FILE *LOG, int line, UNUR_GEN *gen, int sample_size ); int compare_sequence_gen ( FILE *LOG, int line, UNUR_GEN *gen, int sample_size ); int compare_sequence_par_start ( FILE *LOG, int line, UNUR_PAR *par, int sample_size ); int compare_sequence_par ( FILE *LOG, int line, UNUR_PAR *par, int sample_size ); int compare_sequence_urng_start( FILE *LOG, int line, int sample_size ); /* free memory used for comparing sequences */ void compare_free_memory( void ); /* print name of distribution */ void print_distr_name( FILE *LOG, const UNUR_DISTR *distr, const char *genid ); /* check p-value of statistical test and print result */ int print_pval( FILE *LOG, UNUR_GEN *gen, const UNUR_DISTR *distr, double pval, int trial, int todo ); /* run chi2 test */ int run_validate_chi2( FILE *LOG, int line, UNUR_GEN *gen, const UNUR_DISTR *distr, int todo ); /* run verify hat test */ int run_validate_verifyhat( FILE *LOG, int line, UNUR_GEN *gen, const UNUR_DISTR *distr, int todo ); /* print result of verify hat test */ int print_verifyhat_result( FILE *LOG, UNUR_GEN *gen, const UNUR_DISTR *distr, int failed, int todo ); /* print result of timings */ void print_timing_results( FILE *LOG, int line, const UNUR_DISTR *distr, double *timing_setup, double *timing_marginal, int n_results ); /* run test for u-error of inversion method and print results */ int run_validate_u_error( FILE *LOG, UNUR_GEN *gen, const UNUR_DISTR *distr, double u_resolution, int samplesize ); /*---------------------------------------------------------------------------*/ unuran-1.11.0/tests/t_stringparser.c0000644001357500135600000007233514430713513014424 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for STRINGPARSER **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); int unur_stringparser_set_verify( UNUR_PAR *par, int verify); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ int unur_ssr_set_pedantic( struct unur_par *par, int pedantic ); #define COMPARE_SAMPLE_SIZE (10000) #define VIOLATE_SAMPLE_SIZE (20) /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [init] */ void test_init (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[init "); fflush(stdout); fprintf(TESTLOG,"\n[init]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; UNUR_GEN *gen = NULL; distr = NULL; gen = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,45,(gen = unur_str2gen( NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,45,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,48,(distr = unur_str2distr( NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,48,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,51,(gen = unur_makegen_ssu(NULL,NULL,NULL)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,51,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* invalid distribution block */ UNUR_GEN *gen = NULL; gen = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,58,(gen = unur_str2gen( "xxxx" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,58,UNUR_ERR_STR_UNKNOWN)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; n_tests_failed += (check_expected_NULL(TESTLOG,62,(gen = unur_str2gen( "method = xxxx" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,62,UNUR_ERR_STR_SYNTAX)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; n_tests_failed += (check_expected_NULL(TESTLOG,66,(gen = unur_str2gen( "normal; xxxx=1" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,66,UNUR_ERR_STR_UNKNOWN)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; n_tests_failed += (check_expected_NULL(TESTLOG,70,(gen = unur_str2gen( "normal; pv=(1,2,3)" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,70,UNUR_ERR_STR_UNKNOWN)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; n_tests_failed += (check_expected_NULL(TESTLOG,74,(gen = unur_str2gen( "normal,(1,2)" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,74,UNUR_ERR_STR_UNKNOWN)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; n_tests_failed += (check_expected_NULL(TESTLOG,78,(gen = unur_str2gen( "beta" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,78,UNUR_ERR_STR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; n_tests_failed += (check_expected_NULL(TESTLOG,82,(gen = unur_str2gen( "beta()" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,82,UNUR_ERR_STR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; n_tests_failed += (check_expected_NULL(TESTLOG,86,(gen = unur_str2gen( "beta(1)" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,86,UNUR_ERR_STR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; gen = unur_str2gen( "beta(1,2,3)" ); n_tests_failed += (check_errorcode(TESTLOG,90,UNUR_ERR_DISTR_NPARAMS)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; gen = unur_str2gen( "beta(1,2,3,4,5)" ); n_tests_failed += (check_errorcode(TESTLOG,94,UNUR_ERR_DISTR_NPARAMS)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; n_tests_failed += (check_expected_NULL(TESTLOG,98,(gen = unur_str2gen( "gamma(-0.5)" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,98,UNUR_ERR_STR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; n_tests_failed += (check_expected_NULL(TESTLOG,102,(gen = unur_str2gen( "normal(); domain" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,102,UNUR_ERR_STR_INVALID)==UNUR_SUCCESS)?0:1; unur_free(gen); } { /* invalid other block */ UNUR_GEN *gen = NULL; gen = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,109,(gen = unur_str2gen( "normal() & xxxx = arou" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,109,UNUR_ERR_STR_UNKNOWN)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; n_tests_failed += (check_expected_NULL(TESTLOG,113,(gen = unur_str2gen( "normal() & distr=gamma(2)" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,113,UNUR_ERR_STR_UNKNOWN)==UNUR_SUCCESS)?0:1; unur_free(gen); } { /* invalid method block */ UNUR_GEN *gen = NULL; gen = NULL; unur_reset_errno(); gen = unur_str2gen( "normal() & method = arou; c = 0" ); n_tests_failed += (check_errorcode(TESTLOG,120,UNUR_ERR_STR_UNKNOWN)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; n_tests_failed += (check_expected_NULL(TESTLOG,124,(gen = unur_str2gen( "normal() & method = xxx" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,124,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_free(gen); } { /* invalid urng block */ UNUR_GEN *gen = NULL; gen = NULL; unur_reset_errno(); gen = unur_str2gen( "normal & urng = xxx" ); n_tests_failed += (check_errorcode(TESTLOG,131,UNUR_ERR_STR)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; #ifdef UNURAN_SUPPORTS_PRNG gen = unur_str2gen( "normal & urng = mt19937(123); xxx = 1" ); n_tests_failed += (check_errorcode(TESTLOG,136,UNUR_ERR_STR_UNKNOWN)==UNUR_SUCCESS)?0:1; #endif unur_free(gen); } { /* invalid data */ UNUR_GEN *gen = NULL; gen = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,145,(gen = unur_str2gen( "gamma(0.5) & method = tdr" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,145,UNUR_ERR_GEN_DATA)==UNUR_SUCCESS)?0:1; unur_free(gen); } { /* invalid data */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; struct unur_slist *mlist = NULL; distr = NULL; par = NULL; gen = NULL; distr = unur_str2distr("normal()"); par = _unur_str2par(distr, "tdr", &mlist); gen = unur_init(par); _unur_slist_free(mlist); unur_distr_free(distr); unur_free(gen); } { /* invalid distribution block */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,168,(distr = unur_str2distr("cont; pdf='exp'")))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,168,UNUR_ERR_STR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,173,(distr = unur_str2distr("cont; pdf='abc(x)'")))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,173,UNUR_ERR_STR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,178,(distr = unur_str2distr("cont; pdf='exp(x*y)'")))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,178,UNUR_ERR_STR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,182,(distr = unur_str2distr("cont; pdf='exp(x'")))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,182,UNUR_ERR_STR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,185,(distr = unur_str2distr("cont; pdf='exp((x)'")))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,185,UNUR_ERR_STR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,188,(distr = unur_str2distr("cont; pdf='exp(x))'")))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,188,UNUR_ERR_STR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,192,(distr = unur_str2distr("cont; pdf='x^'")))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,192,UNUR_ERR_STR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,196,(distr = unur_str2distr("cont; pdf='exp(x)x'")))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,196,UNUR_ERR_STR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,199,(distr = unur_str2distr("cont; pdf='2x'")))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,199,UNUR_ERR_STR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,202,(distr = unur_str2distr("cont; pdf='x***2'")))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,202,UNUR_ERR_STR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,205,(distr = unur_str2distr("cont; pdf='x*exp(x^(x*y))'")))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,205,UNUR_ERR_STR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_init() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* compare function parser - cont */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpm[10]; distr = NULL; par = NULL; gen = NULL; unur_reset_errno(); distr = unur_distr_normal(NULL,0); par = unur_srou_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,231,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "cont; pdf = \"(1/sqrt(2*pi)*exp(-x^2/2))\"; mode = 0; pdfarea = 1 & \ method = srou" ); n_tests_failed += (compare_sequence_gen(TESTLOG,237,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "cont; logpdf = \"-x^2/2-0.5*log(2*pi)\"; mode = 0; pdfarea = 1 & \ method = srou" ); n_tests_failed += (compare_sequence_gen(TESTLOG,243,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_makegen_ssu( "cont; logpdf = \"-x^2/2-0.5*log(2*pi)\"; mode = 0; pdfarea = 1", \ "method = srou", NULL ); n_tests_failed += (compare_sequence_gen(TESTLOG,249,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_makegen_ssu( "cont; logpdf = \"-x^2/2-0.5*log(2*pi)\"; mode = 0; pdfarea = 1", \ "srou", NULL ); n_tests_failed += (compare_sequence_gen(TESTLOG,255,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; distr = unur_str2distr("cont; logpdf = \"-x^2/2-0.5*log(2*pi)\"; mode = 0; pdfarea = 1"); gen = unur_makegen_dsu( distr, "srou", NULL ); n_tests_failed += (compare_sequence_gen(TESTLOG,262,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; distr = unur_distr_normal(NULL,0); par = unur_ssr_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,271,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "cont; pdf = \"(1/sqrt(2*pi)*exp(-x^2/2))\"; mode = 0; pdfarea = 1 & \ method = ssr" ); n_tests_failed += (compare_sequence_gen(TESTLOG,278,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; distr = unur_distr_normal(NULL,0); par = unur_utdr_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,287,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "cont; pdf = \"(1/sqrt(2*pi)*exp(-x^2/2))\"; mode = 0; pdfarea = 1 & \ method = utdr" ); n_tests_failed += (compare_sequence_gen(TESTLOG,293,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "cont; logpdf = \"-x^2/2-0.5*log(2*pi)\"; mode = 0; pdfarea = 1 & \ method = utdr" ); n_tests_failed += (compare_sequence_gen(TESTLOG,299,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; distr = unur_distr_normal(NULL,0); par = unur_tdr_new(distr); unur_tdr_set_cpoints(par,8,NULL); unur_tdr_set_max_sqhratio(par,0.); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,310,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "cont; pdf = \"(1/sqrt(2*pi)*exp(-x^2/2))\"; mode = 0; pdfarea = 1 & \ method = tdr; cpoints = 8; max_sqhratio = 0." ); n_tests_failed += (compare_sequence_gen(TESTLOG,316,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "cont; logpdf = \"-x^2/2-0.5*log(2*pi)\"; mode = 0; pdfarea = 1 & \ method = tdr; cpoints = 8; max_sqhratio = 0." ); n_tests_failed += (compare_sequence_gen(TESTLOG,322,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_makegen_ssu( "cont; logpdf = \"-x^2/2-0.5*log(2*pi)\"; mode = 0; pdfarea = 1", \ "method = tdr; cpoints = 8; max_sqhratio = 0.", NULL ); n_tests_failed += (compare_sequence_gen(TESTLOG,328,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_makegen_ssu( "cont; logpdf = \"-x^2/2-0.5*log(2*pi)\"; mode = 0; pdfarea = 1", \ "tdr; cpoints = 8; max_sqhratio = 0.", NULL ); n_tests_failed += (compare_sequence_gen(TESTLOG,334,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); unur_arou_set_cpoints(par,8,NULL); unur_arou_set_max_sqhratio(par,0.); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,345,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "cont; pdf = \"(1/sqrt(2*pi)*exp(-x^2/2))\"; mode = 0; pdfarea = 1 & \ method = arou; cpoints = 8; max_sqhratio = 0." ); n_tests_failed += (compare_sequence_gen(TESTLOG,351,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; distr = unur_distr_cont_new(); unur_distr_cont_set_cdfstr(distr,"1-exp(-x)"); par = unur_ninv_new(distr); unur_ninv_set_usenewton(par); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,362,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "cont; cdf = \"1-exp(-x)\"; domain = (0,inf)& \ method = ninv; usenewton" ); n_tests_failed += (compare_sequence_gen(TESTLOG,368,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; distr = unur_distr_cont_new(); unur_distr_cont_set_hrstr(distr,"1/(1+x)"); par = unur_hrb_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,378,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "cont; hr = \"1/(1+x)\"; domain = (0,inf)& \ method = hrb" ); n_tests_failed += (compare_sequence_gen(TESTLOG,384,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; distr = unur_distr_normal(NULL,0); par = unur_auto_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,393,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "normal() & method=auto" ); n_tests_failed += (compare_sequence_gen(TESTLOG,398,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_makegen_ssu( "normal()", "method=auto", NULL ); n_tests_failed += (compare_sequence_gen(TESTLOG,403,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_makegen_ssu( "normal()", "auto", NULL ); n_tests_failed += (compare_sequence_gen(TESTLOG,408,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_makegen_ssu( "normal()", "", NULL ); n_tests_failed += (compare_sequence_gen(TESTLOG,413,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_makegen_ssu( "normal()", NULL, NULL ); n_tests_failed += (compare_sequence_gen(TESTLOG,418,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_makegen_ssu( "normal", NULL, NULL ); n_tests_failed += (compare_sequence_gen(TESTLOG,423,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; fpm[0] = 1.; fpm[1] = 2.; distr = unur_distr_normal(fpm,2); par = unur_auto_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,434,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "normal(1.,2.) & method=auto" ); n_tests_failed += (compare_sequence_gen(TESTLOG,439,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_makegen_ssu( "normal(1,2)", "method=auto", NULL ); n_tests_failed += (compare_sequence_gen(TESTLOG,444,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_makegen_ssu( "normal(1,2.)", "auto", NULL ); n_tests_failed += (compare_sequence_gen(TESTLOG,449,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_makegen_ssu( "normal(1.,2)", "", NULL ); n_tests_failed += (compare_sequence_gen(TESTLOG,454,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_makegen_ssu( "normal(1,2)", NULL, NULL ); n_tests_failed += (compare_sequence_gen(TESTLOG,459,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; fpm[0] = 1.; fpm[1] = 2.; distr = unur_distr_normal(fpm,2); gen = unur_makegen_dsu( distr, "method=auto", NULL ); n_tests_failed += (compare_sequence_gen(TESTLOG,467,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; fpm[0] = 1.; fpm[1] = 2.; distr = unur_distr_normal(fpm,2); gen = unur_makegen_dsu( distr, "auto", NULL ); n_tests_failed += (compare_sequence_gen(TESTLOG,475,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; fpm[0] = 1.; fpm[1] = 2.; distr = unur_distr_normal(fpm,2); gen = unur_makegen_dsu( distr, "", NULL ); n_tests_failed += (compare_sequence_gen(TESTLOG,483,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; fpm[0] = 1.; fpm[1] = 2.; distr = unur_distr_normal(fpm,2); gen = unur_makegen_dsu( distr, NULL, NULL ); n_tests_failed += (compare_sequence_gen(TESTLOG,491,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare function parser - discr */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[] = {0.4}; distr = NULL; par = NULL; gen = NULL; unur_reset_errno(); distr = unur_distr_geometric(fpar,1); par = unur_dsrou_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,510,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "discr; pmf = \"0.4 * (1-0.4)^k\"; domain = (0,inf); mode = 0; pmfsum = 1 & \ method = dsrou" ); n_tests_failed += (compare_sequence_gen(TESTLOG,516,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; distr = unur_distr_geometric(fpar,1); par = unur_dau_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,524,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "discr; pmf = \"0.4 * (1-0.4)^k\"; domain = (0,inf); mode = 0; pmfsum = 1 & \ method = dau" ); n_tests_failed += (compare_sequence_gen(TESTLOG,530,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; distr = unur_distr_geometric(fpar,1); par = unur_dgt_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,538,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "discr; pmf = \"0.4 * (1-0.4)^k\"; domain = (0,inf); mode = 0; pmfsum = 1 & \ method = dgt" ); n_tests_failed += (compare_sequence_gen(TESTLOG,544,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; distr = unur_distr_geometric(fpar,1); par = unur_dari_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,552,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "discr; pmf = \"0.4 * (1-0.4)^k\"; domain = (0,inf); mode = 0; pmfsum = 1 & \ method = dari" ); n_tests_failed += (compare_sequence_gen(TESTLOG,559,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_stringparser_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_arou.conf0000644001357500135600000004655114420445767013367 00000000000000############################################################################# [main] [main - data:] # method method: AROU [main - header:] /* prototypes */ double pdf( double x, const UNUR_DISTR *distr ); double pdf_bimodal( double x, const UNUR_DISTR *distr ); double dpdf_bimodal( double x, const UNUR_DISTR *distr ); double pdf_negative( double x, const UNUR_DISTR *distr ); double dpdf_negative( double x, const UNUR_DISTR *distr ); double pdf_partnegative( double x, const UNUR_DISTR *distr ); double dpdf_partnegative( double x, const UNUR_DISTR *distr ); double pdf_sqrtlin( double x, const UNUR_DISTR *distr ); double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ); double cdf_sqrtlin( double x, const UNUR_DISTR *distr ); double pdf_sqrtlinshft(double x, const UNUR_DISTR *distr ); double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); \#define COMPARE_SAMPLE_SIZE (10000) \#define VIOLATE_SAMPLE_SIZE (20) /* \#define SEED (298346) */ ############################################################################# [new] [new - invalid NULL ptr: distr = NULL; ] ~( distr ); --> expected_NULL --> UNUR_ERR_NULL [new - invalid distribution type: distr = unur_distr_discr_new(); ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID [new - data missing in distribution object: distr = unur_distr_cont_new(); ] /* pdf, dpdf */ ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED /* dpdf */ unur_distr_cont_set_pdf(distr,pdf); ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED ############################################################################# [set] [set - invalid NULL ptr: par = NULL; ] ~_usedars( par, 1 ); --> expected_setfailed --> UNUR_ERR_NULL ~_darsfactor( par, 1. ); --> expected_setfailed --> UNUR_ERR_NULL ~_cpoints( par, 0, NULL ); --> expected_setfailed --> UNUR_ERR_NULL ~_guidefactor( par, 1. ); --> expected_setfailed --> UNUR_ERR_NULL ~_max_sqhratio( par, 0.95 ); --> expected_setfailed --> UNUR_ERR_NULL ~_max_segments( par, 100 ); --> expected_setfailed --> UNUR_ERR_NULL ~_usecenter( par, 1 ); --> expected_setfailed --> UNUR_ERR_NULL ~_verify( par, 1 ); --> expected_setfailed --> UNUR_ERR_NULL ~_pedantic( par, 1 ); --> expected_setfailed --> UNUR_ERR_NULL [set - invalid parameter object: double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_tdr_new(distr); ] ~_usedars( par, 1 ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_darsfactor( par, 1. ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_cpoints( par, 0, NULL ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_guidefactor( par, 1. ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_max_sqhratio( par, 0.95 ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_max_segments( par, 100 ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_usecenter( par, 1 ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_verify( par, 1 ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_pedantic( par, 1 ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID unur_par_free(par); [set - invalid parameters: double stp[] = {1.,0.,1.}; int n_stp = 3; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_arou_new(distr); ] ~_darsfactor( par, -1. ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_cpoints( par, -1, NULL ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_cpoints( par, n_stp, stp ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_guidefactor( par, -1. ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_max_sqhratio( par, -1. ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_max_sqhratio( par, 2. ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_max_segments( par, 0 ); --> expected_setfailed --> UNUR_ERR_PAR_SET unur_par_free(par); ############################################################################# [get] [get - invalid generator object: distr = unur_distr_normal(NULL,0); par = unur_tdr_new(distr); gen = unur_init(par); <-- ! NULL ] ~_sqhratio(gen); --> expected_INFINITY --> UNUR_ERR_GEN_INVALID ~_hatarea(gen); --> expected_INFINITY --> UNUR_ERR_GEN_INVALID ~_squeezearea(gen); --> expected_INFINITY --> UNUR_ERR_GEN_INVALID ############################################################################# [chg] [chg - invalid generator object: double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_srou_new(distr); unur_set_debug(par,0); gen = unur_init( par ); <-- ! NULL ] ~_verify(gen,1); --> expected_setfailed --> UNUR_ERR_GEN_INVALID ############################################################################# [init] [init - invalid NULL ptr: par = NULL; ] unur_init( par ); --> expected_NULL --> UNUR_ERR_NULL [init - stp out of domain: double stp[] = {-2.5,-1.,0.,1.,2.5}; int n_stp = 5; gen = NULL; distr = unur_distr_normal(NULL,0); unur_distr_cont_set_domain(distr,-2.,2.); par = unur_arou_new(distr); unur_arou_set_cpoints( par, n_stp, stp ); ] gen = unur_init( par ); --> none --> UNUR_ERR_GEN_DATA [init - bimodal: distr = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr,pdf_bimodal); unur_distr_cont_set_dpdf(distr,dpdf_bimodal); par = unur_arou_new(distr); unur_arou_set_cpoints( par, 30, NULL ); ] unur_init( par ); --> expected_NULL --> UNUR_ERR_GEN_CONDITION [init - negative value of pdf: distr = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr,pdf_negative); unur_distr_cont_set_dpdf(distr,dpdf_negative); par = NULL; ] par = unur_arou_new(distr); unur_arou_set_cpoints( par, 30, NULL ); unur_init( par ); --> expected_NULL --> UNUR_ERR_GEN_CONDITION unur_distr_cont_set_domain(distr,-2.,2.); par = unur_arou_new(distr); unur_arou_set_cpoints( par, 30, NULL ); unur_init( par ); --> expected_NULL --> UNUR_ERR_GEN_DATA ############################################################################# [reinit] [reinit - does not exist: distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); gen = unur_init( par ); <-- ! NULL ] unur_reinit( gen ); --> expected_setfailed --> UNUR_ERR_NO_REINIT unur_sample_cont( gen ); --> expected_INFINITY --> UNUR_ERR_GEN_CONDITION ############################################################################# [sample] [sample - partial negative value of pdf: int i; double x; double stp[] = {-0.9,0.9}; int n_stp = 2; distr = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr,pdf_partnegative); unur_distr_cont_set_dpdf(distr,dpdf_partnegative); par = unur_arou_new(distr); unur_arou_set_usedars(par,FALSE); unur_arou_set_cpoints( par, n_stp, stp ); unur_arou_set_pedantic( par, 1 ); gen = unur_init( par ); <-- ! NULL ] for (i=0; i<100; i++) { x = unur_sample_cont(gen); } x; --> expected_INFINITY --> UNUR_ERR_GEN_CONDITION #..................................................................... [sample - compare clone: UNUR_GEN *clone; distr = unur_distr_normal(NULL,0); par = NULL; gen = NULL; ] /* original generator object */ par = unur_arou_new(distr); unur_arou_set_max_sqhratio(par,0.); gen = unur_init(par); -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen # due to optimizations of the compiler the following test # fails for some compilers with some options (!?) # #[sample - compare: # distr = unur_distr_normal(NULL,0); # par = NULL; ] # #/* default algorithm */ #par = unur_arou_new(distr); # -->compare_sequence_par_start # #/* verifying mode */ #par = unur_arou_new(distr); #unur_arou_set_verify(par,1); # -->compare_sequence_par #..................................................................... [sample - compare stringparser: double fpar[10]; distr = NULL; par = NULL; gen = NULL; ] distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "normal & method = arou" ); -->compare_sequence_gen unur_free(gen); gen = NULL; gen = unur_str2gen( "normal() & method = arou" ); -->compare_sequence_gen unur_free(gen); gen = NULL; gen = unur_str2gen( "normal(0.,1.) & method = arou" ); -->compare_sequence_gen unur_free(gen); gen = NULL; gen = unur_str2gen( "normal(0,1) & method = arou" ); -->compare_sequence_gen unur_free(gen); gen = NULL; gen = unur_str2gen( "distr = normal(0,1) & method = arou" ); -->compare_sequence_gen unur_free(gen); gen = NULL; fpar[0] = 1.; fpar[1] = 2.; distr = unur_distr_normal(fpar,2); par = unur_arou_new(distr); unur_arou_set_usedars(par,1); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "normal(1,2) & method = arou; usedars" ); -->compare_sequence_gen unur_free(gen); gen = NULL; fpar[0] = 1.; fpar[1] = 2.; distr = unur_distr_normal(fpar,2); par = unur_arou_new(distr); unur_arou_set_usedars(par,1); unur_arou_set_darsfactor(par,0.1); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "normal(1,2) & method = arou; usedars; darsfactor=0.1" ); -->compare_sequence_gen unur_free(gen); gen = NULL; fpar[0] = 1.; fpar[1] = 2.; distr = unur_distr_normal(fpar,2); unur_distr_cont_set_domain(distr,0.,2.); par = unur_arou_new(distr); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "normal(1,2); domain = 0, 2 & method = arou" ); -->compare_sequence_gen unur_free(gen); gen = NULL; gen = unur_str2gen( "normal(1,2); domain = (0,2) & method = arou" ); -->compare_sequence_gen unur_free(gen); gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); fpar[0] = -2; fpar[1] = -1.5; fpar[2] = -1; fpar[3] = -0.5; fpar[4] = 0; fpar[5] = 0.5; fpar[6] = 1; fpar[7] = 1.5; fpar[8] = 2; unur_arou_set_cpoints(par,9,fpar); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "normal() & \ method = arou; cpoints = (-2,-1.5,-1,-0.5,0,0.5,1,1.5,2)" ); -->compare_sequence_gen unur_free(gen); gen = NULL; distr = unur_distr_normal(NULL,0); unur_distr_cont_set_center(distr,0.); par = unur_arou_new(distr); unur_arou_set_cpoints(par,20,NULL); unur_arou_set_guidefactor(par,1.); unur_arou_set_max_segments(par,40); unur_arou_set_max_sqhratio(par,0.5); unur_arou_set_pedantic(par,FALSE); unur_arou_set_usecenter(par,TRUE); unur_arou_set_verify(par,TRUE); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "normal(); center=0. & \ method = arou; \ cpoints = 20; guidefactor = 1.; max_segments = 40; \ max_sqhratio = 0.5; pedantic = off; usecenter = true; verify = on" ); -->compare_sequence_gen ############################################################################# [validate] [validate - generators:] # default program (without DARS) par[0] = unur_arou_new(@distr@); unur_arou_set_usedars(par,0); # use dars par[1] = unur_arou_new(@distr@); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); # small squeeze / hat ratio par[2] = unur_arou_new(@distr@); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_max_sqhratio(par,0.5); [validate - distributions:] # Beta distributions fpm[0] = 1.; fpm[1] = 2.; distr[0] = unur_distr_beta(fpm,2); fpm[0] = 2.; fpm[1] = 1.; distr[32] = unur_distr_beta(fpm,2); fpm[0] = 1.; fpm[1] = 5.; distr[1] = unur_distr_beta(fpm,2); fpm[0] = 1.; fpm[1] = 100.; distr[2] = unur_distr_beta(fpm,2); fpm[0] = 2.; fpm[1] = 5.; distr[30] = unur_distr_beta(fpm,2); fpm[0] = 5.; fpm[1] = 2.; distr[31] = unur_distr_beta(fpm,2); fpm[0] = 3.; fpm[1] = 4.; distr[3] = unur_distr_beta(fpm,2); fpm[0] = 5.; fpm[1] = 100.; distr[4] = unur_distr_beta(fpm,2); fpm[0] = 500.; fpm[1] = 300.; distr[5] = unur_distr_beta(fpm,2); fpm[0] = 5.; fpm[1] = 10.; fpm[2] = -3.; fpm[3] = 15.; distr[6] = unur_distr_beta(fpm,4); # Cauchy distributions distr[7] = unur_distr_cauchy(NULL,0); fpm[0] = 1.; fpm[1] = 20.; distr[8] = unur_distr_cauchy(fpm,2); # Exponential distributions distr[24] = unur_distr_exponential(NULL,0); fpm[0] = 30.; fpm[1] = -5.; distr[25] = unur_distr_exponential(fpm,2); # Gamma distributions fpm[0] = 1.; distr[9] = unur_distr_gamma(fpm,1); fpm[0] = 2.; distr[10] = unur_distr_gamma(fpm,1); fpm[0] = 3.; distr[11] = unur_distr_gamma(fpm,1); fpm[0] = 10.; distr[12] = unur_distr_gamma(fpm,1); fpm[0] = 1000.; distr[13] = unur_distr_gamma(fpm,1); fpm[0] = 5.; fpm[1] = 1000.; distr[14] = unur_distr_gamma(fpm,2); fpm[0] = 5.; fpm[1] = 1.e-5; distr[15] = unur_distr_gamma(fpm,2); fpm[0] = 5.; fpm[1] = 10.; fpm[2] = 1000; distr[16] = unur_distr_gamma(fpm,3); # Laplace distributions distr[26] = unur_distr_laplace(NULL,0); fpm[0] = -10.; fpm[1] = 100.; distr[27] = unur_distr_laplace(fpm,2); # Normal distributions distr[17] = unur_distr_normal(NULL,0); fpm[0] = 1.; fpm[1] = 1.e-5; distr[18] = unur_distr_normal(fpm,2); fpm[0] = 0.; fpm[1] = 1.e+5; distr[19] = unur_distr_normal(fpm,2); # Uniform distributions distr[20] = unur_distr_uniform(NULL,0); fpm[0] = 1.; fpm[1] = 20.; distr[21] = unur_distr_uniform(fpm,2); # pdf with piecewise linear function as transformed density with T = -1/sqrt distr[28] = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr[28],pdf_sqrtlin); unur_distr_cont_set_dpdf(distr[28],dpdf_sqrtlin); unur_distr_cont_set_cdf(distr[28],cdf_sqrtlin); unur_distr_set_name(distr[28],"sqrtlin"); # pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode distr[29] = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr[29],pdf_sqrtlinshft); unur_distr_cont_set_dpdf(distr[29],dpdf_sqrtlinshft); unur_distr_cont_set_cdf(distr[29],cdf_sqrtlinshft); unur_distr_set_name(distr[29],"sqrtlin"); # truncated distributions distr[22] = unur_distr_cauchy(NULL,0); unur_distr_cont_set_domain(distr[22],0.1,1.); unur_distr_cont_upd_mode(distr[22]); unur_distr_cont_upd_pdfarea(distr[22]); # domain exceeds support of pdf fpm[0] = 3.; fpm[1] = 4.; distr[23] = unur_distr_beta(fpm,2); unur_distr_cont_set_domain(distr[23],-2.,5.); # number of distributions: 33 [validate - test chi2:] # + ... pass test # 0 ... fail to initialize generator # - ... fail test # . ... do not run test # # ... comment # # generators: # [0] without DARS # [1] with DARS # [2] small squeeze / hat ratio # #gen [0] [1] [2] # distribution #--------------------------------------------- <0> + + + # beta (1, 2) <32> + + + # beta (2, 1) <1> + + + # beta (1, 5) x <2> + + + # beta (1, 100) <30> + + + # beta (2, 5) <31> + + + # beta (5, 2) <3> + + + # beta (3, 4) x <4> + + + # beta (5, 100) x <5> + + + # beta (500, 300) <6> + + + # beta (5, 10, -3, 15) <24> + + + # exponential () x<25> + + + # exponential (30, -5) <7> + + + # cauchy () x <8> + + + # cauchy (1, 20) <9> + + + # gamma (1) <10> + + + # gamma (2) <11> + + + # gamma (3) <12> + + + # gamma (10) x<13> + + + # gamma (1000) <14> + + + # gamma (5, 1000, 0) x<15> + + + # gamma (5, 1e-05, 0) x<16> + + + # gamma (5, 10, 100000) <26> + + + # laplace () <27> + + + # laplace (-10, 100) <17> + + + # normal () x<18> + + . # normal (1, 1e-05) <19> + + + # normal (1, 1e+05) <20> + + + # uniform () <21> + + + # uniform (1, 20) <22> + + + # cauchy () - truncated <23> + + + # beta () - domain superset of support #<28> + + + # pdf with piecewise linear function as transformed density with T = -1/sqrt #<29> . . . # [28] with shifted mode [validate - verify hat:] # + ... pass test # ~ ... fail in at most 1% of samples # 0 ... fail to initialize generator # - ... fail test # . ... do not run test # # ... comment # # generators: # [0] without DARS # [1] with DARS # [2] small squeeze / hat ratio # #gen [0] [1] [2] # distribution #--------------------------------------------- <0> + + + # beta (1, 2) <32> + + + # beta (2, 1) <1> + + + # beta (1, 5) x <2> + + + # beta (1, 100) <30> + + + # beta (2, 5) <31> + + + # beta (5, 2) <3> + + + # beta (3, 4) x <4> + + + # beta (5, 100) x <5> + + + # beta (500, 300) <6> + + + # beta (5, 10, -3, 15) <24> + + + # exponential () x<25> + + + # exponential (30, -5) <7> + + + # cauchy () <8> + + + # cauchy (1, 20) <9> + + + # gamma (1) <10> + + + # gamma (2) <11> + + + # gamma (3) <12> + + + # gamma (10) x<13> + + + # gamma (1000) <14> + + + # gamma (5, 1000, 0) x<15> + + + # gamma (5, 1e-05, 0) x<16> + + + # gamma (5, 10, 100000) <26> + + + # laplace () <27> + + + # laplace (-10, 100) <17> + + + # normal () x<18> + + + # normal (1, 1e-05) <19> + + + # normal (1, 1e+05) <20> + + + # uniform () <21> + + + # uniform (1, 20) <22> + + + # cauchy () - truncated <23> + + + # beta () - domain superset of support #<28> + + + # pdf with piecewise linear function as transformed density with T = -1/sqrt #<29> . . . # [28] with shifted mode ############################################################################# ############################################################################# [verbatim] /* pdf of bimodal density */ double pdf_bimodal( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return ( exp(-(x-1.)*(x-1.)) + exp(-(x+1.)*(x+1.)) ); } double dpdf_bimodal( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return ( -2. * (x-1.) * exp(-(x-1.)*(x-1.)) -2. * (x+1.) * exp(-(x+1.)*(x+1.)) ); } /* pdf with negative value */ double pdf_negative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return (-x*x); } double dpdf_negative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return (-2.*x); } /* pdf with partial negative value */ double pdf_partnegative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return ((x>-0.89 && x<0.89) ? -1.: exp(-x*x)); } double dpdf_partnegative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return ((x>-0.89 && x<0.89) ?0.: -2.*x*exp(-x*x)); } /* pdf of normal density */ double pdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return exp(-x*x/2.); } /* end of pdf */ /* pdf with piecewise linear function as transformed density with T = -1/sqrt */ double pdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y = 1./(fabs(x)+1.); return y*y; } double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y = 1./(fabs(x)+1.); y = 2.*y*y*y; return ((x<0.) ? y : - y); } double cdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { if (x<=0.) return 0.5/(1.-x); else return (1.-0.5/(1.+x)); } /* pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode */ double pdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y; x -= 1.; y = 1./(fabs(x)+1.); return y*y; } double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y; x -= 1.; y = 1./(fabs(x)+1.); y = 2.*y*y*y; return ((x<0.) ? y : - y); } double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { x -= 1.; if (x<=0.) return 0.5/(1.-x); else return (1.-0.5/(1.+x)); } ############################################################################# unuran-1.11.0/tests/Makefile.am0000644001357500135600000000763014430713333013242 00000000000000## Process this file with automake to produce Makefile.in AUTOMAKE_OPTIONS = parallel-tests color-tests SUBDIRS = testdistributions . AM_CPPFLAGS = \ $(UNURAN_SUPPORTS_GSL) \ $(UNURAN_SUPPORTS_PRNG) \ $(UNURAN_SUPPORTS_RNGSTREAM) \ -I$(top_srcdir)/src \ -I$(top_srcdir)/src/tests noinst_LTLIBRARIES = libtestroutines.la libtestroutines_la_SOURCES = testroutines.c testcounter.c LDADD = \ libtestroutines.la \ $(top_builddir)/tests/testdistributions/libtestdistributions.la \ $(top_builddir)/src/libunuran.la # Special files for tests with Mathematica(TM) if HAVE_MATHEMATICA MATHEMATICA_PROGS = test_StdDistr test_functionparser else MATHEMATICA_PROGS = endif # Files that contain deprecated routines if ENABLE_DEPRECATED DEPRECATED_TESTS = t_deprecated_vmt t_deprecated_tdrgw else DEPRECATED_TESTS = endif check_PROGRAMS = \ t_x_gen \ t_unur_tests \ t_unur_error \ t_urng \ t_distr \ t_distr_cemp \ t_distr_cont \ t_distr_corder \ t_distr_cvec \ t_distr_condi \ t_distr_cvemp \ t_distr_cxtrans \ t_distr_discr \ t_distr_matr \ t_auto \ t_arou \ t_ars \ t_cext \ t_cstd \ t_dari \ t_dau \ t_dext \ t_dgt \ t_dsrou \ t_dss \ t_dstd \ t_empk \ t_empl \ t_gibbs \ t_hinv \ t_hist \ t_hitro \ t_hrb \ t_hrd \ t_hri \ t_itdr \ t_mcorr \ t_mixt \ t_mvstd \ t_mvtdr \ t_ninv \ t_norta \ t_nrou \ t_pinv \ t_srou \ t_ssr \ t_tabl \ t_tdr t_tdr_gw t_tdr_ps t_tdr_ia \ t_unif \ t_utdr \ t_vempk \ t_vnrou \ t_stringparser \ t_info \ t_util_matrix \ $(DEPRECATED_TESTS) \ $(MATHEMATICA_PROGS) TESTS = $(check_PROGRAMS) # These tests fail until we fix some bugs #XFAIL_TESTS = noinst_HEADERS = \ testunuran.h EXTRA_DIST = \ test_StdDistr.m \ test_functionparser.m \ make_test_files.pl \ README.conf \ t_info.conf \ t_stringparser.conf \ t_x_gen.conf \ t_unur_tests.conf \ t_unur_error.conf \ t_urng.conf \ t_util_matrix.conf \ t_distr.conf \ t_distr_cemp.conf \ t_distr_cont.conf \ t_distr_corder.conf \ t_distr_cvec.conf \ t_distr_condi.conf \ t_distr_cvemp.conf \ t_distr_cxtrans.conf \ t_distr_discr.conf \ t_distr_matr.conf \ t_auto.conf \ t_arou.conf \ t_ars.conf \ t_cext.conf \ t_cstd.conf \ t_dari.conf \ t_dau.conf \ t_dext.conf \ t_dgt.conf \ t_dsrou.conf \ t_dss.conf \ t_dstd.conf \ t_empk.conf \ t_empl.conf \ t_gibbs.conf \ t_hinv.conf \ t_hinv.conf \ t_hist.conf \ t_hrb.conf \ t_hrd.conf \ t_hri.conf \ t_itdr.conf \ t_mcorr.conf \ t_mvstd.conf \ t_ninv.conf \ t_norta.conf \ t_nrou.conf \ t_pinv.conf \ t_srou.conf \ t_ssr.conf \ t_tabl.conf \ t_tdr.conf t_tdr_gw.conf t_tdr_ps.conf t_tdr_ia.conf \ t_unif.conf \ t_utdr.conf \ t_vempk.conf \ t_vnrou.conf \ \ t_deprecated_vmt.conf if HAVE_MATHEMATICA # Compare results of CDF, PDF, and dPDF of standard distributions # and results of function parser to those produced with # Mathematica(TM) ... test_StdDistr_SOURCES = test_StdDistr.c test_StdDistr_DEPENDENCIES = t_StdDistr.data test_StdDistr.o: t_StdDistr.data t_StdDistr.data: test_StdDistr.m math -initfile $(top_srcdir)/tests/test_StdDistr.m test_functionparser_SOURCES = test_functionparser.c test_functionparser_DEPENDENCIES = t_functionparser.data test_functionparser.o: t_functionparser.data t_functionparser.data: test_functionparser.m math -initfile $(top_srcdir)/tests/test_functionparser.m endif # Generate C sources for tests SUFFIXES = .c .conf.c: ./make_test_files.pl $(top_srcdir) $< > $@ t_*.c: make_test_files.pl # run tests with valgrind if HAVE_VALGRIND valgrind: $(check_PROGRAMS) @list='$(check_PROGRAMS)'; for p in $$list; do \ $(top_srcdir)/scripts/run_valgrind.sh ./$$p; \ done endif # run tests in fullcheck mode fullcheck: UNURANFULLCHECK=true $(MAKE) check # clean log files and backup files CLEANFILES = \ *.log \ valgrind-* \ unuran-valgrind-* \ *~ # clean generated files DISTCLEANFILES = \ rm -f t_*.data # clean generated files MAINTAINERCLEANFILES = \ rm -f t_*.c \ Makefile.in unuran-1.11.0/tests/t_tdr_ps.c0000644001357500135600000114533514430713513013176 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for TDR **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ double pdf_sqrtlin( double x, const UNUR_DISTR *distr ); double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ); double cdf_sqrtlin( double x, const UNUR_DISTR *distr ); double pdf_sqrtlinshft(double x, const UNUR_DISTR *distr ); double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); #define COMPARE_SAMPLE_SIZE (10000) #define VIOLATE_SAMPLE_SIZE (20) /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ /* pdf with piecewise linear function as transformed density with T = -1/sqrt */ double pdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y = 1./(fabs(x)+1.); return y*y; } double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y = 1./(fabs(x)+1.); y = 2.*y*y*y; return ((x<0.) ? y : - y); } double cdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { if (x<=0.) return 0.5/(1.-x); else return (1.-0.5/(1.+x)); } /* pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode */ double pdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y; x -= 1000.; y = 1./(fabs(x)+1.); return y*y; } double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y; x -= 1000.; y = 1./(fabs(x)+1.); y = 2.*y*y*y; return ((x<0.) ? y : - y); } double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { x -= 1000.; if (x<=0.) return 0.5/(1.-x); else return (1.-0.5/(1.+x)); } /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [validate] */ /*---------------------------------------------------------------------------*/ /* [validate] */ void test_validate (void) { /* suppress GCC compiler warning */ GCC_DIAG_OFF(unused-variable) UNUR_DISTR *distr[33]; UNUR_PAR *par; UNUR_GEN *gen; double *darray; double fpm[10]; int n_tests_failed; int rcode; /* start test */ printf("[validate "); fflush(stdout); fprintf(TESTLOG,"\n[validate]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* distributions: 33 */ { fpm[0] = 1.; fpm[1] = 2.; distr[0] = unur_distr_beta(fpm,2); } { fpm[0] = 1.; fpm[1] = 5.; distr[1] = unur_distr_beta(fpm,2); } { fpm[0] = 1.; fpm[1] = 100.; distr[2] = unur_distr_beta(fpm,2); } { fpm[0] = 2.; fpm[1] = 5.; distr[30] = unur_distr_beta(fpm,2); } { fpm[0] = 5.; fpm[1] = 2.; distr[31] = unur_distr_beta(fpm,2); } { fpm[0] = 3.; fpm[1] = 4.; distr[3] = unur_distr_beta(fpm,2); } { fpm[0] = 5.; fpm[1] = 100.; distr[4] = unur_distr_beta(fpm,2); } { fpm[0] = 500.; fpm[1] = 300.; distr[5] = unur_distr_beta(fpm,2); } { fpm[0] = 5.; fpm[1] = 10.; fpm[2] = -3.; fpm[3] = 15.; distr[6] = unur_distr_beta(fpm,4); } { distr[7] = unur_distr_cauchy(NULL,0); } { fpm[0] = 1.; fpm[1] = 20.; distr[8] = unur_distr_cauchy(fpm,2); } { distr[24] = unur_distr_exponential(NULL,0); } { fpm[0] = 30.; fpm[1] = -5.; distr[25] = unur_distr_exponential(fpm,2); } { fpm[0] = 1.; distr[9] = unur_distr_gamma(fpm,1); } { fpm[0] = 2.; distr[10] = unur_distr_gamma(fpm,1); } { fpm[0] = 3.; distr[11] = unur_distr_gamma(fpm,1); } { fpm[0] = 10.; distr[12] = unur_distr_gamma(fpm,1); } { fpm[0] = 1000.; distr[13] = unur_distr_gamma(fpm,1); } { fpm[0] = 5.; fpm[1] = 1000.; distr[14] = unur_distr_gamma(fpm,2); } { fpm[0] = 5.; fpm[1] = 1.e-5; distr[15] = unur_distr_gamma(fpm,2); } { fpm[0] = 5.; fpm[1] = 10.; fpm[2] = 1000.; distr[16] = unur_distr_gamma(fpm,3); } { distr[26] = unur_distr_laplace(NULL,0); } { fpm[0] = -10.; fpm[1] = 100.; distr[27] = unur_distr_laplace(fpm,2); } { distr[17] = unur_distr_normal(NULL,0); } { fpm[0] = 1.; fpm[1] = 1.e-5; distr[18] = unur_distr_normal(fpm,2); } { fpm[0] = 0.; fpm[1] = 1.e+5; distr[19] = unur_distr_normal(fpm,2); } { distr[20] = unur_distr_uniform(NULL,0); } { fpm[0] = 1.; fpm[1] = 20.; distr[21] = unur_distr_uniform(fpm,2); } { fpm[0] = 4.; fpm[1] = 10.; distr[32] = unur_distr_F(fpm,2); } { distr[28] = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr[28],pdf_sqrtlin); unur_distr_cont_set_dpdf(distr[28],dpdf_sqrtlin); unur_distr_cont_set_cdf(distr[28],cdf_sqrtlin); unur_distr_set_name(distr[28],"sqrtlin"); } { distr[29] = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr[29],pdf_sqrtlinshft); unur_distr_cont_set_dpdf(distr[29],dpdf_sqrtlinshft); unur_distr_cont_set_cdf(distr[29],cdf_sqrtlinshft); unur_distr_set_name(distr[29],"sqrtlin"); } { distr[22] = unur_distr_cauchy(NULL,0); unur_distr_cont_set_domain(distr[22],0.1,1.); unur_distr_cont_upd_mode(distr[22]); unur_distr_cont_upd_pdfarea(distr[22]); } { fpm[0] = 3.; fpm[1] = 4.; distr[23] = unur_distr_beta(fpm,2); unur_distr_cont_set_domain(distr[23],-2.,5.); } /* timing */ stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); printf("\n(chi^2) "); fflush(stdout); /* chi^2 tests: 330 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nChi^2 Test:\n"); /* distribution [0] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [2] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [30] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [31] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [3] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [4] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [5] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [6] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [7] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [8] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [24] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [25] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [9] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [10] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [11] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [12] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [13] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [14] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [15] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [16] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [26] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [27] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [17] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [18] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [19] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [20] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [21] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [32] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [22] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [23] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [28] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [29] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); printf("\n(verify hat) "); fflush(stdout); /* verify hat tests: 330 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nVerify Hat Test (squeeze <= PDF <= hat):\n"); /* distribution [0] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [2] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [30] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [31] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [3] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [4] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [5] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [6] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [7] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'0')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [8] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'0')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [24] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [25] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [9] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [10] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [11] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [12] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [13] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [14] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [15] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [16] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [26] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [27] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [17] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [18] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [19] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [20] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [21] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [32] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[32],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[32],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[32],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[32],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[32],'0')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[32],'0')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[32],'0')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[32],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[32],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,10,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[32],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [22] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [23] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [28] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); gen = unur_init(par); if (gen) { unur_tdr_chg_truncated(gen,0.5,0.9); } if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tdr_new(distr_localcopy); unur_tdr_set_pedantic(par,0); unur_tdr_set_variant_ps(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); unur_use_urng_aux_default(par); gen = unur_init(par); if (gen) unur_tdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [29] */ if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); /* free distributions */ unur_distr_free(distr[0]); unur_distr_free(distr[1]); unur_distr_free(distr[2]); unur_distr_free(distr[3]); unur_distr_free(distr[4]); unur_distr_free(distr[5]); unur_distr_free(distr[6]); unur_distr_free(distr[7]); unur_distr_free(distr[8]); unur_distr_free(distr[9]); unur_distr_free(distr[10]); unur_distr_free(distr[11]); unur_distr_free(distr[12]); unur_distr_free(distr[13]); unur_distr_free(distr[14]); unur_distr_free(distr[15]); unur_distr_free(distr[16]); unur_distr_free(distr[17]); unur_distr_free(distr[18]); unur_distr_free(distr[19]); unur_distr_free(distr[20]); unur_distr_free(distr[21]); unur_distr_free(distr[22]); unur_distr_free(distr[23]); unur_distr_free(distr[24]); unur_distr_free(distr[25]); unur_distr_free(distr[26]); unur_distr_free(distr[27]); unur_distr_free(distr[28]); unur_distr_free(distr[29]); unur_distr_free(distr[30]); unur_distr_free(distr[31]); unur_distr_free(distr[32]); /* test finished */ test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; /* we accept CHI2_FAILURES_TOLERATED failures */ (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_validate */ /* enable GCC compiler warning */ GCC_DIAG_ON(unused-variable) /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_tdr_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_distr_condi.c0000644001357500135600000010264414430713513014177 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for DISTR_CONDI **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); int unur_distr_condi_set_verify( UNUR_PAR *par, int verify); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ #define COMPARE_SAMPLE_SIZE (500) #define VIOLATE_SAMPLE_SIZE (20) int unur_distr_condi_set_pedantic(UNUR_PAR *par, int pedantic); int unur_distr_condi_chg_verify(UNUR_GEN *gen, int verify); /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ int unur_distr_condi_set_pedantic(UNUR_PAR *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) { return UNUR_FAILURE; } int unur_distr_condi_chg_verify(UNUR_GEN *gen, int verify) { if (unur_arou_chg_verify(gen,verify)==UNUR_SUCCESS) return UNUR_SUCCESS; if (unur_srou_chg_verify(gen,verify)==UNUR_SUCCESS) return UNUR_SUCCESS; if (unur_tabl_chg_verify(gen,verify)==UNUR_SUCCESS) return UNUR_SUCCESS; if (unur_tdr_chg_verify(gen,verify)==UNUR_SUCCESS) return UNUR_SUCCESS; if (unur_ars_chg_verify(gen,verify)==UNUR_SUCCESS) return UNUR_SUCCESS; return UNUR_FAILURE; } /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,30,(unur_distr_condi_new( distr, NULL, NULL, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,30,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = unur_distr_multinormal(3,NULL,NULL); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,37,(unur_distr_condi_new( distr, NULL, NULL, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,37,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; double p[] = { 1., 2., 3., 4.}; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,45,(unur_distr_condi_new( distr, p, NULL, 4 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,45,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid data */ UNUR_DISTR *distr = NULL; double p[] = { 1., 2., 3., 4.}; distr = unur_distr_multinormal(3,NULL,NULL); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,53,(unur_distr_condi_new( distr, p, NULL, -1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,53,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,56,(unur_distr_condi_new( distr, p, NULL, 3 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,56,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [set] */ void test_set (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[set "); fflush(stdout); fprintf(TESTLOG,"\n[set]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,67,(unur_distr_condi_set_condition( distr, NULL, NULL, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,67,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,74,(unur_distr_condi_set_condition( distr, NULL, NULL, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,74,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid data */ UNUR_DISTR *distr = NULL; double p[] = { 1., 2., 3., 4.}; UNUR_DISTR *condi; distr = unur_distr_multinormal(3,NULL,NULL); condi = unur_distr_condi_new( distr, p, NULL, 0 ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,84,(unur_distr_condi_set_condition( condi, p, NULL, -1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,84,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,87,(unur_distr_condi_set_condition( condi, p, NULL, 3 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,87,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(condi); unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_set() */ /*---------------------------------------------------------------------------*/ /* [get] */ void test_get (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[get "); fflush(stdout); fprintf(TESTLOG,"\n[get]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; const double *pos, *dir; int k; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,102,(unur_distr_condi_get_distribution( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,102,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,105,(unur_distr_condi_get_condition( distr, &pos, &dir, &k )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,105,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; const double *pos, *dir; int k; distr = unur_distr_cont_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,114,(unur_distr_condi_get_distribution( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,114,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,117,(unur_distr_condi_get_condition( distr, &pos, &dir, &k )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,117,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_get() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* check for memory leaks */ UNUR_DISTR *distr = NULL; double p[] = { 1., 2., 3., 4.}; double dir[] = { 1., -1., 2., -2.}; UNUR_DISTR *condi; distr = unur_distr_multinormal(3,NULL,NULL); condi = unur_distr_condi_new( distr, p, NULL, 0 ); unur_reset_errno(); unur_distr_condi_set_condition( condi, p, NULL, 1 ); n_tests_failed += (check_errorcode(TESTLOG,144,UNUR_SUCCESS)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_distr_condi_set_condition( condi, p, dir, 1 ); n_tests_failed += (check_errorcode(TESTLOG,147,UNUR_SUCCESS)==UNUR_SUCCESS)?0:1; unur_distr_free(condi); unur_distr_free(distr); } { /* check for memory leaks */ UNUR_DISTR *distr = NULL; double p[] = { 1., 2., 3., 4.}; double dir[] = { 1., -1., 2., -2.}; UNUR_DISTR *condi; distr = unur_distr_multinormal(4,NULL,NULL); condi = unur_distr_condi_new( distr, p, dir, 0 ); unur_reset_errno(); unur_distr_condi_set_condition( condi, p, dir, 1 ); n_tests_failed += (check_errorcode(TESTLOG,160,UNUR_SUCCESS)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_distr_condi_set_condition( condi, p, NULL, 1 ); n_tests_failed += (check_errorcode(TESTLOG,163,UNUR_SUCCESS)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_distr_condi_set_condition( condi, p, dir, 3 ); n_tests_failed += (check_errorcode(TESTLOG,166,UNUR_SUCCESS)==UNUR_SUCCESS)?0:1; unur_distr_free(condi); unur_distr_free(distr); } { /* check for memory leaks */ UNUR_DISTR *distr = NULL; double p[] = { 1., 2., 3., 4.}; double dir[] = { 1., -1., 2., -2.}; UNUR_DISTR *condi; distr = unur_distr_multinormal(4,NULL,NULL); condi = unur_distr_condi_new( distr, p, NULL, 0 ); unur_reset_errno(); unur_distr_condi_set_condition( condi, p, NULL, 1 ); n_tests_failed += (check_errorcode(TESTLOG,179,UNUR_SUCCESS)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_distr_condi_set_condition( condi, p, dir, 1 ); n_tests_failed += (check_errorcode(TESTLOG,182,UNUR_SUCCESS)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_distr_condi_set_condition( condi, p, NULL, 3 ); n_tests_failed += (check_errorcode(TESTLOG,185,UNUR_SUCCESS)==UNUR_SUCCESS)?0:1; unur_distr_free(condi); unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* [validate] */ /*---------------------------------------------------------------------------*/ /* [validate] */ void test_validate (void) { /* suppress GCC compiler warning */ GCC_DIAG_OFF(unused-variable) UNUR_DISTR *distr[7]; UNUR_PAR *par; UNUR_GEN *gen; double *darray; double fpm[10]; int n_tests_failed; int rcode; /* start test */ printf("[validate "); fflush(stdout); fprintf(TESTLOG,"\n[validate]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* distributions: 7 */ { #define dim (3) UNUR_DISTR *normal = unur_distr_multinormal(dim,NULL,NULL); int i; double p[dim]; for(i=0;isetup time = %.3f ms\n", stopwatch_lap(&watch)); printf("\n(verify hat) "); fflush(stdout); /* verify hat tests: 35 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nVerify Hat Test (squeeze <= PDF <= hat):\n"); /* distribution [0] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_arou_new(distr_localcopy); unur_distr_condi_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_distr_condi_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_distr_condi_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_distr_condi_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tdr_new(distr_localcopy); unur_distr_condi_set_pedantic(par,0); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_distr_condi_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_ars_new(distr_localcopy); unur_distr_condi_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_distr_condi_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tabl_new(distr_localcopy); unur_distr_condi_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_distr_condi_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_arou_new(distr_localcopy); unur_distr_condi_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_distr_condi_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdr_new(distr_localcopy); unur_distr_condi_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_distr_condi_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tdr_new(distr_localcopy); unur_distr_condi_set_pedantic(par,0); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_distr_condi_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_ars_new(distr_localcopy); unur_distr_condi_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_distr_condi_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tabl_new(distr_localcopy); unur_distr_condi_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_distr_condi_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [2] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_arou_new(distr_localcopy); unur_distr_condi_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_distr_condi_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_distr_condi_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_distr_condi_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tdr_new(distr_localcopy); unur_distr_condi_set_pedantic(par,0); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_distr_condi_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_ars_new(distr_localcopy); unur_distr_condi_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_distr_condi_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tabl_new(distr_localcopy); unur_distr_condi_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_distr_condi_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [3] */ if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdr_new(distr_localcopy); unur_distr_condi_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_distr_condi_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tdr_new(distr_localcopy); unur_distr_condi_set_pedantic(par,0); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_distr_condi_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_ars_new(distr_localcopy); unur_distr_condi_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_distr_condi_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tabl_new(distr_localcopy); unur_distr_condi_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_distr_condi_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [4] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_arou_new(distr_localcopy); unur_distr_condi_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_distr_condi_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdr_new(distr_localcopy); unur_distr_condi_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_distr_condi_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tdr_new(distr_localcopy); unur_distr_condi_set_pedantic(par,0); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_distr_condi_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_ars_new(distr_localcopy); unur_distr_condi_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_distr_condi_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tabl_new(distr_localcopy); unur_distr_condi_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_distr_condi_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [5] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_arou_new(distr_localcopy); unur_distr_condi_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_distr_condi_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_distr_condi_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_distr_condi_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tdr_new(distr_localcopy); unur_distr_condi_set_pedantic(par,0); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_distr_condi_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_ars_new(distr_localcopy); unur_distr_condi_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_distr_condi_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [6] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_arou_new(distr_localcopy); unur_distr_condi_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_distr_condi_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_distr_condi_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_distr_condi_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tdr_new(distr_localcopy); unur_distr_condi_set_pedantic(par,0); unur_tdr_set_c(par,0.); gen = unur_init(par); if (gen) unur_distr_condi_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_ars_new(distr_localcopy); unur_distr_condi_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_distr_condi_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tabl_new(distr_localcopy); unur_distr_condi_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_distr_condi_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); /* free distributions */ unur_distr_free(distr[0]); unur_distr_free(distr[1]); unur_distr_free(distr[2]); unur_distr_free(distr[3]); unur_distr_free(distr[4]); unur_distr_free(distr[5]); unur_distr_free(distr[6]); /* test finished */ test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; /* we accept CHI2_FAILURES_TOLERATED failures */ (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_validate */ /* enable GCC compiler warning */ GCC_DIAG_ON(unused-variable) /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_distr_condi_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_empk.conf0000644001357500135600000002137114420445767013346 00000000000000############################################################################# [main] [main - data:] # method (for information only: the program scans the file name) method: EMPK [main - header:] /* prototypes */ \#define COMPARE_SAMPLE_SIZE (10000) \#define VIOLATE_SAMPLE_SIZE (20) /* sample size for Gaussian distributet sample */ \#define samplesize (5000) UNUR_DISTR *get_distr_with_data( void ); UNUR_DISTR *get_distr_with_Gaussian_data( void ); double urng_ed (void *dummy); ############################################################################# [new] [new - invalid NULL ptr: distr = NULL; ] ~( distr ); --> expected_NULL --> UNUR_ERR_NULL [new - invalid distribution type: distr = unur_distr_cont_new(); ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID [new - data missing in distribution object: distr = unur_distr_cemp_new(); /* no data given */ ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED ############################################################################# [set] [set - invalid NULL ptr: par = NULL; ] ~_kernel(par,UNUR_DISTR_GAUSSIAN); --> expected_setfailed --> UNUR_ERR_NULL ~_kernelgen(par, NULL, 1., 1.); --> expected_setfailed --> UNUR_ERR_NULL ~_beta(par,1.); --> expected_setfailed --> UNUR_ERR_NULL ~_smoothing(par,1.); --> expected_setfailed --> UNUR_ERR_NULL ~_varcor(par,TRUE); --> expected_setfailed --> UNUR_ERR_NULL ~_positive(par,TRUE); --> expected_setfailed --> UNUR_ERR_NULL [set - invalid parameter object: distr = unur_distr_normal(NULL,0); par = unur_cstd_new(distr); ] ~_kernel(par,UNUR_DISTR_GAUSSIAN); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_kernelgen(par, NULL, 1., 1.); --> expected_setfailed --> UNUR_ERR_NULL ~_beta(par,1.); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_smoothing(par,1.); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_varcor(par,TRUE); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_positive(par,TRUE); --> expected_setfailed --> UNUR_ERR_PAR_INVALID unur_par_free(par); [set - invalid parameters: distr = get_distr_with_data(); par = unur_empk_new(distr); ] ~_kernel(par,UNUR_DISTR_BETA); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_kernelgen(par, NULL, -1., 1.); --> expected_setfailed --> UNUR_ERR_NULL ~_beta(par,-1.); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_smoothing(par,-1.); --> expected_setfailed --> UNUR_ERR_PAR_SET unur_par_free(par); ############################################################################# # [get] ############################################################################# [chg] [chg - invalid generator object: distr = unur_distr_normal(NULL,0); par = unur_cstd_new(distr); gen = unur_init( par ); <-- ! NULL ] ~_smoothing(gen,1.); --> expected_setfailed --> UNUR_ERR_GEN_INVALID ~_varcor(gen,TRUE); --> expected_setfailed --> UNUR_ERR_GEN_INVALID [chg - invalid parameters: distr = get_distr_with_data(); par = unur_empk_new(distr); gen = unur_init( par ); <-- ! NULL ] ~_smoothing(gen,-1.); --> expected_setfailed --> UNUR_ERR_PAR_SET ############################################################################# [init] [init - invalid NULL ptr: par = NULL; ] unur_init( par ); --> expected_NULL --> UNUR_ERR_NULL [init - run init: distr = get_distr_with_data(); par = unur_empk_new(distr); gen = unur_init( par ); <-- ! NULL ] # this should be o.k. --> none --> 0x0u ############################################################################# [reinit] [reinit - does not exist: distr = get_distr_with_data(); par = unur_empk_new(distr); gen = unur_init( par ); <-- ! NULL ] unur_reinit( gen ); --> expected_setfailed --> UNUR_ERR_NO_REINIT unur_sample_cont( gen ); --> expected_INFINITY --> UNUR_ERR_GEN_CONDITION ############################################################################# [sample] [sample - compare clone: UNUR_GEN *clone; UNUR_GEN *kerngen; distr = get_distr_with_data(); par = unur_empk_new(distr); gen = unur_init( par ); <-- ! NULL ] /* default generator object */ -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen /* set kernel generator */ unur_free(gen); par = unur_empk_new(distr); kerngen = unur_str2gen("normal & method=cstd"); unur_empk_set_kernelgen(par,kerngen,0.7763884,1.); gen = unur_init( par ); -->compare_sequence_gen /* set kernel */ unur_free(gen); unur_free(kerngen); par = unur_empk_new(distr); unur_empk_set_kernel(par,UNUR_DISTR_GAUSSIAN); gen = unur_init( par ); -->compare_sequence_gen #..................................................................... [sample - compare stringparser: double data[] = {1.,2.,3.,4.,5.,6.,7.,8.,9.}; distr = NULL; par = NULL; gen = NULL; ] distr = unur_distr_cemp_new(); unur_distr_cemp_set_data(distr,data,9); par = unur_empk_new(distr); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "cemp; data = (1.,2.,3.,4.,5.,6.,7.,8.,9.) & \ method = empk" ); -->compare_sequence_gen unur_free(gen); gen = NULL; distr = unur_distr_cemp_new(); unur_distr_cemp_set_data(distr,data,9); par = unur_empk_new(distr); unur_empk_set_beta(par,1.2); unur_empk_set_kernel(par,UNUR_DISTR_UNIFORM); unur_empk_set_positive(par,TRUE); unur_empk_set_smoothing(par,0.); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "cemp; data = (1.,2.,3.,4.,5.,6.,7.,8.,9.) & \ method = empk; beta = 1.2; kernel = 2001; positive; smoothing = 0." ); -->compare_sequence_gen unur_free(gen); gen = NULL; distr = unur_distr_cemp_new(); unur_distr_cemp_set_data(distr,data,9); par = unur_empk_new(distr); unur_empk_set_varcor(par,TRUE); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "cemp; data = (1.,2.,3.,4.,5.,6.,7.,8.,9.) & \ method = empk; varcor" ); -->compare_sequence_gen ############################################################################# [validate] [validate - generators:] # default par[0] = unur_empk_new(@distr@); # use variance correction par[1] = unur_empk_new(@distr@); unur_empk_set_varcor(par, TRUE); # use UNUR_DISTR_GAUSSIAN par[2] = unur_empk_new(@distr@); unur_empk_set_kernel( par, UNUR_DISTR_GAUSSIAN); # use UNUR_DISTR_EPANECHNIKOV par[3] = unur_empk_new(@distr@); unur_empk_set_kernel( par, UNUR_DISTR_EPANECHNIKOV); # use UNUR_DISTR_BOXCAR par[4] = unur_empk_new(@distr@); unur_empk_set_kernel( par, UNUR_DISTR_BOXCAR); # use UNUR_DISTR_STUDENT par[5] = unur_empk_new(@distr@); unur_empk_set_kernel( par, UNUR_DISTR_STUDENT); # use UNUR_DISTR_LOGISTIC par[6] = unur_empk_new(@distr@); unur_empk_set_kernel( par, UNUR_DISTR_LOGISTIC); [validate - distributions:] # approximate normal distribution distr[0] = get_distr_with_Gaussian_data(); [validate - test chi2:] # + ... pass test # 0 ... fail to initialize generator # - ... fail test # . ... do not run test # # ... comment # # generators: # [0] ... default # [1] ... use variance correction # # 0 1 2 3 4 5 6 # distribution #---------------------------------------------------------------- <0> + + + + + + + # approximate normal distribution ############################################################################# ############################################################################# [verbatim] /*---------------------------------------------------------------------------*/ UNUR_DISTR *get_distr_with_data( void ) { \#define PV_SIZE 20 double pv[PV_SIZE]; UNUR_DISTR *distr; int i; for (i=0; i expected_NULL --> UNUR_ERR_NULL [new - invalid distribution type: distr = unur_distr_discr_new(); ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID ############################################################################# [set] [set - invalid NULL ptr: double x0[] = {1., 2., 3.}; par = NULL; ] ~_variant_coordinate( par ); --> expected_setfailed --> UNUR_ERR_NULL ~_variant_random_direction( par ); --> expected_setfailed --> UNUR_ERR_NULL ~_startingpoint( par, x0); --> expected_setfailed --> UNUR_ERR_NULL ~_thinning( par, 3 ); --> expected_setfailed --> UNUR_ERR_NULL ~_burnin( par, 100 ); --> expected_setfailed --> UNUR_ERR_NULL [set - invalid parameter object: double x0[] = {1., 2., 3.}; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_arou_new(distr); ] ~_variant_coordinate( par ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_variant_random_direction( par ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_startingpoint( par, x0); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_thinning( par, 3 ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_burnin( par, 100 ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID unur_par_free(par); [set - invalid parameters: distr = unur_distr_multinormal( 3, NULL, NULL ); par = unur_gibbs_new(distr); ] ~_thinning( par, 0 ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_burnin( par, -1 ); --> expected_setfailed --> UNUR_ERR_PAR_SET unur_par_free(par); ############################################################################# [get] [get - invalid generator object: distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); gen = unur_init(par); <-- ! NULL ] ~_state(gen); --> expected_NULL --> UNUR_ERR_GEN_INVALID ############################################################################# [chg] [chg - invalid generator object: double x[] = {0.,0.}; distr = unur_distr_normal(NULL,0); par = unur_ssr_new(distr); gen = unur_init( par ); <-- ! NULL ] ~_state(gen,x); --> expected_setfailed --> UNUR_ERR_GEN_INVALID [chg - invalid NULL: distr = unur_distr_multinormal(2,NULL,NULL); par = unur_gibbs_new(distr); gen = unur_init( par ); <-- ! NULL ] ~_state(gen,NULL); --> expected_setfailed --> UNUR_ERR_NULL ############################################################################# # [init] ############################################################################# [reinit] [reinit - does not exist: double x[3]; distr = unur_distr_multinormal(3,NULL,NULL); par = unur_gibbs_new(distr); gen = unur_init( par ); <-- ! NULL ] unur_reinit( gen ); --> expected_setfailed --> UNUR_ERR_NO_REINIT unur_sample_vec( gen, x ); x[0]; --> expected_INFINITY --> UNUR_ERR_GEN_CONDITION ############################################################################# [sample] [sample - test clone: const int dim = 3; double mean[] = {1.,2.,3.}; double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; UNUR_GEN *clone; distr = unur_distr_multinormal( dim, mean, covar ); par = unur_gibbs_new(distr); /* unur_gibbs_set_variant_random_direction(par); */ unur_set_debug(par,1u); gen = unur_init( par ); <-- ! NULL ] /* clone */ /* currently we cannot compare clone with original generator. */ /* thus we just run it to test whether cloning works without a segfault. */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; unur_gibbs_reset_state(gen); -->compare_sequence_gen_start ############################################################################# [validate] [validate - generators:] # T=log, coordinate sampling, thinning = THINNIG*dim par[0] = unur_gibbs_new(@distr@); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(@distr@)); unur_gibbs_set_burnin(par,1000); # T=log, random direction sampling, thinning = THINNIG*dim par[1] = unur_gibbs_new(@distr@); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(@distr@)); unur_gibbs_set_burnin(par,1000); # T=sqrt, coordinate sampling, thinning = THINNIG*dim par[2] = unur_gibbs_new(@distr@); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(@distr@)); unur_gibbs_set_c(par,-0.5); ##unur_set_debug(par,~0u); # T=sqrt, random direction sampling, thinning = THINNIG*dim par[3] = unur_gibbs_new(@distr@); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(@distr@)); unur_gibbs_set_c(par,-0.5); [validate - distributions:] # standard multinormal distribution distr[0] = unur_distr_multinormal(1,NULL,NULL); distr[1] = unur_distr_multinormal(2,NULL,NULL); distr[2] = unur_distr_multinormal(3,NULL,NULL); # standard multinormal distribution, shifted center double mean[] = { 1., 2., 3. }; distr[34] = unur_distr_multinormal(3,mean,NULL); # multinormal distribution, dim = 1, shifted center double mean[] = { -1. }; double covar[] = { 2. }; distr[3] = unur_distr_multinormal(1,mean,covar); unur_distr_cvec_set_center(distr[3],NULL); # multinormal distribution, dim = 3, shifted center double mean[] = { 1., 2., 3. }; double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; distr[4] = unur_distr_multinormal(3,mean,covar); # multinormal with AR(1) distr[5] = unur_distr_multinormal_ar1(3,NULL,0.9); distr[6] = unur_distr_multinormal_ar1(4,NULL,0.8); distr[7] = unur_distr_multinormal_ar1(5,NULL,0.7); distr[8] = unur_distr_multinormal_ar1(10,NULL,0.6); # multinormal with AR(1) (rho=0.9, dim=3), shifted center double mean[] = { -1., -2., -3., 4., 5., 6., 7., 8., 9., 10. }; distr[9] = unur_distr_multinormal_ar1(3,mean,0.9); double mean[] = { -1., -2., -3., 4., 5., 6., 7., 8., 9., 10. }; distr[10] = unur_distr_multinormal_ar1(4,mean,0.8); double mean[] = { -1., -2., -3., 4., 5., 6., 7., 8., 9., 10. }; distr[11] = unur_distr_multinormal_ar1(5,mean,0.7); double mean[] = { -1., -2., -3., 4., 5., 6., 7., 8., 9., 10. }; distr[12] = unur_distr_multinormal_ar1(10,mean,0.6); # multinormal with constant rho distr[13] = unur_distr_multinormal_constantrho(3,NULL,0.9); distr[14] = unur_distr_multinormal_constantrho(4,NULL,0.8); distr[15] = unur_distr_multinormal_constantrho(5,NULL,0.7); distr[16] = unur_distr_multinormal_constantrho(10,NULL,0.6); # standard multicauchy distribution distr[17] = unur_distr_multicauchy(2,NULL,NULL); distr[18] = unur_distr_multicauchy(3,NULL,NULL); # multicauchy distribution, dim = 3 double mean[] = { 1., 2., 3. }; double covar[] = { 1., 0.5, 0.25, 0.5, 1., 0.5, 0.25, 0.5, 1. }; distr[19] = unur_distr_multicauchy(3,mean,covar); # multicauchy with AR(1) covariance matrix distr[20] = unur_distr_multicauchy_ar1(3,NULL,0.7); distr[21] = unur_distr_multicauchy_ar1(4,NULL,0.6); distr[22] = unur_distr_multicauchy_ar1(5,NULL,0.5); distr[23] = unur_distr_multicauchy_ar1(10,NULL,0.4); # multistudent with AR(1) covariance matrix distr[24] = unur_distr_multistudent_ar1(2,3.,NULL,0.7); distr[25] = unur_distr_multistudent_ar1(2,5.,NULL,0.7); distr[26] = unur_distr_multistudent_ar1(2,15.,NULL,0.7); distr[27] = unur_distr_multistudent_ar1(2,0.5,NULL,0.7); distr[28] = unur_distr_multistudent_ar1(2,1.5,NULL,0.7); distr[29] = unur_distr_multistudent_ar1(2,2.5,NULL,0.7); # standard multinormal distribution with rectangular domain double ll[3] = {0.,0.,0.}; double ru[3] = {UNUR_INFINITY,UNUR_INFINITY,UNUR_INFINITY}; distr[30] = unur_distr_multinormal(3,NULL,NULL); unur_distr_cvec_set_domain_rect(distr[30],ll,ru); # standard multinormal distribution with rectangular domain double ll[3] = {0.,0.,0.}; double ru[3] = {1.,UNUR_INFINITY,UNUR_INFINITY}; distr[31] = unur_distr_multinormal(3,NULL,NULL); unur_distr_cvec_set_domain_rect(distr[31],ll,ru); # standard multinormal distribution with rectangular domain double ll[3] = {-1.,-1.,1.}; double ru[3] = {1.,0.,2.}; double center[3] = {0.,-0.5,1.5}; distr[32] = unur_distr_multinormal(3,NULL,NULL); unur_distr_cvec_set_domain_rect(distr[32],ll,ru); unur_distr_cvec_set_center(distr[32],center); # invalid: default center of distribution out of truncated domain double ll[3] = {-1.,-1.,1.}; double ru[3] = {1.,0.,2.}; distr[33] = unur_distr_multinormal(3,NULL,NULL); unur_distr_cvec_set_domain_rect(distr[33],ll,ru); # number of distributions: 35 [validate - test chi2:] # + ... pass test # 0 ... fail to initialize generator # - ... fail test # . ... do not run test # # ... comment # # generators: # [0] ... T=log, coordinate sampling, thinning = THINNIG*dim # [1] ... T=log, random direction sampling, thinning = THINNIG*dim # [2] ... T=sqrt, coordinate sampling, thinning = THINNIG*dim # [3] ... T=sqrt, random direction sampling, thinning = THINNIG*dim # #gen 0 1 2 3 # distribution #--------------------------------------------- <0> + + + + # standard multinormal (dim=1) <1> + + + + # standard multinormal (dim=2) <2> + + x+ x+ # standard multinormal (dim=3) <34> + + x+ x+ # standard multinormal distribution (dim=3), shifted center x <3> + + + + # multinormal (dim=1), shifted center x <4> + + + + # multinormal (dim=3), shifted center x <5> + + + + # multinormal with AR(1) (rho=0.9, dim=3) x <6> + + . . # multinormal with AR(1) (rho=0.8, dim=4) x <7> + + . . # multinormal with AR(1) (rho=0.7, dim=5) x <8> + + . . # multinormal with AR(1) (rho=0.6, dim=10) x <9> + + . . # multinormal with AR(1) (rho=0.9, dim=3), shifted center x<10> + + . . # multinormal with AR(1) (rho=0.8, dim=4), shifted center x<11> + + . . # multinormal with AR(1) (rho=0.7, dim=5), shifted center x<12> + + + + # multinormal with AR(1) (rho=0.6, dim=10), shifted center x<13> + + . . # multinormal with constant rho (rho=0.9, dim=3) x<14> + + . . # multinormal with constant rho (rho=0.8, dim=4) x<15> + + + + # multinormal with constant rho (rho=0.7, dim=5) x<16> + + . . # multinormal with constant rho (rho=0.6, dim=10) <17> 0 0 + + # standard multicauchy (dim=2) <18> 0 0 + + # standard multicauchy (dim=3) <19> 0 0 + + # multicauchy (dim=3), shifted center x<20> 0 0 + + # multicauchy with AR(1) covariance matrix (rho=0.7, dim=3) x<21> 0 0 + + # multicauchy with AR(1) covariance matrix (rho=0.6, dim=4) x<22> 0 0 + + # multicauchy with AR(1) covariance matrix (rho=0.5, dim=5) x<23> 0 0 + + # multicauchy with AR(1) covariance matrix (rho=0.4, dim=10) <24> 0 0 + + # multistudent with AR(1) covariance matrix (rho=0.7, dim=2, nu = 3) x<25> 0 0 + + # multistudent with AR(1) covariance matrix (rho=0.7, dim=2, nu = 5) x<26> 0 0 + + # multistudent with AR(1) covariance matrix (rho=0.7, dim=2, nu = 15) x<27> 0 0 + + # multistudent with AR(1) covariance matrix (rho=0.7, dim=2, nu = 0.5) x<28> 0 0 + + # multistudent with AR(1) covariance matrix (rho=0.7, dim=2, nu = 1.5) x<29> 0 0 + + # multistudent with AR(1) covariance matrix (rho=0.7, dim=2, nu = 2.5) <30> + . + . # standard multinormal distribution with rectangular domain <31> + . + . # standard multinormal distribution with rectangular domain x<32> + . + . # standard multinormal distribution with rectangular domain x<33> 0 0 0 0 # invalid: default center of distribution out of truncated domain ############################################################################# ############################################################################# [verbatim] /* dummy function */ int unur_gibbs_set_pedantic( UNUR_PAR *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) { return 1; } ############################################################################# unuran-1.11.0/tests/t_ars.c0000644001357500135600000062756214430713513012476 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for ARS **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ double logpdf_normal_1( double x, const UNUR_DISTR *distr ); double dlogpdf_normal_1( double x, const UNUR_DISTR *distr ); double cdf_normal_1( double x, const UNUR_DISTR *distr ); double logpdf_normal_2( double x, const UNUR_DISTR *distr ); double dlogpdf_normal_2( double x, const UNUR_DISTR *distr ); double cdf_normal_2( double x, const UNUR_DISTR *distr ); #define COMPARE_SAMPLE_SIZE (10000) #define VIOLATE_SAMPLE_SIZE (20) /* #define SEED (298346) */ /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ /* logPDF of normal density */ double logpdf_normal_1( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return (-x*x/2. - 10000.); } double dlogpdf_normal_1( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return (-x); } static UNUR_DISTR *normal_1 = NULL; void remove_normal_1(void) { unur_distr_free(normal_1); } double cdf_normal_1( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { static double fpm[2] = {0., 1.}; if (normal_1 == NULL) { normal_1 = unur_distr_normal(fpm,2); atexit(remove_normal_1); } return unur_distr_cont_eval_cdf( x, normal_1 ); } /* ......................................................................... */ #define mu_2 (100.) double logpdf_normal_2( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return (-(x-mu_2)*(x-mu_2)/2. - 10000.); } double dlogpdf_normal_2( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return (-(x-mu_2)); } double cdf_normal_2( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { static UNUR_DISTR *normal_2 = NULL; static double fpm[2] = {mu_2, 1.}; if (normal_2 == NULL) normal_2 = unur_distr_normal(fpm,2); return unur_distr_cont_eval_cdf( x, normal_2 ); } /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,33,(unur_ars_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,33,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,39,(unur_ars_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,39,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* data missing in distribution object */ UNUR_DISTR *distr = NULL; distr = unur_distr_normal_wo_logpdf(NULL,0); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,45,(unur_ars_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,45,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* data missing in distribution object */ UNUR_DISTR *distr = NULL; distr = unur_distr_cont_new(); unur_reset_errno(); /* logpdf, dlogpdf */ n_tests_failed += (check_expected_NULL(TESTLOG,53,(unur_ars_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,53,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* dlogpdf */ unur_distr_cont_set_logpdf(distr,logpdf_normal_1); n_tests_failed += (check_expected_NULL(TESTLOG,58,(unur_ars_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,58,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [set] */ void test_set (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[set "); fflush(stdout); fprintf(TESTLOG,"\n[set]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,68,(unur_ars_set_cpoints( par, 0, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,68,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,71,(unur_ars_set_reinit_percentiles( par, 0, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,71,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,74,(unur_ars_set_reinit_ncpoints( par, 20 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,74,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,77,(unur_ars_set_max_intervals( par, 100 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,77,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,80,(unur_ars_set_max_iter( par, 100 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,80,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,83,(unur_ars_set_verify( par, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,83,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,86,(unur_ars_set_pedantic( par, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,86,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* invalid parameter object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = unur_distr_normal(NULL,0); par = unur_tdr_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,94,(unur_ars_set_cpoints( par, 0, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,94,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,97,(unur_ars_set_reinit_percentiles( par, 0, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,97,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,100,(unur_ars_set_reinit_ncpoints( par, 30 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,100,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,103,(unur_ars_set_max_intervals( par, 100 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,103,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,106,(unur_ars_set_max_iter( par, 100 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,106,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,109,(unur_ars_set_verify( par, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,109,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,112,(unur_ars_set_pedantic( par, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,112,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double stp[] = {1.,0.,1.}; double perc[] = {0.1,0.4,0.2}; int n_stp = 3; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_ars_new(distr); unur_reset_errno(); unur_ars_set_cpoints( par, -1, NULL ); n_tests_failed += (check_errorcode(TESTLOG,125,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,128,(unur_ars_set_cpoints( par, n_stp, stp )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,128,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_ars_set_reinit_percentiles( par, -1, NULL ); n_tests_failed += (check_errorcode(TESTLOG,131,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,134,(unur_ars_set_reinit_percentiles( par, n_stp, stp )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,134,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,137,(unur_ars_set_reinit_percentiles( par, n_stp, perc )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,137,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,140,(unur_ars_set_reinit_ncpoints( par, 9 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,140,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,143,(unur_ars_set_max_intervals( par, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,143,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,146,(unur_ars_set_max_iter( par, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,146,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_set() */ /*---------------------------------------------------------------------------*/ /* [get] */ void test_get (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[get "); fflush(stdout); fprintf(TESTLOG,"\n[get]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid generator object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_tdr_new(distr); gen = unur_init(par); abort_if_NULL(TESTLOG, 156, gen ); unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,160,(unur_ars_get_loghatarea(gen)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,160,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_get() */ /*---------------------------------------------------------------------------*/ /* [chg] */ void test_chg (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[chg "); fflush(stdout); fprintf(TESTLOG,"\n[chg]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid generator object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_tdr_new(distr); unur_set_debug(par,0); gen = unur_init( par ); abort_if_NULL(TESTLOG, 170, gen ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,174,(unur_ars_chg_verify(gen,1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,174,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,177,(unur_ars_chg_reinit_percentiles(gen, -1, NULL)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,177,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,180,(unur_ars_chg_reinit_ncpoints(gen, 30)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,180,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double percmon[] = {0.1,0.4,0.2}; double percdom[] = {0.1,0.4,2.}; int n_perc = 3; distr = unur_distr_normal(NULL,0); par = unur_ars_new(distr); unur_set_debug(par,0); gen = unur_init( par ); abort_if_NULL(TESTLOG, 189, gen ); unur_reset_errno(); unur_ars_chg_reinit_percentiles( gen, -1, NULL ); n_tests_failed += (check_errorcode(TESTLOG,193,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,196,(unur_ars_chg_reinit_percentiles( gen, n_perc, percmon )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,196,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,199,(unur_ars_chg_reinit_percentiles( gen, n_perc, percdom )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,199,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,202,(unur_ars_chg_reinit_ncpoints( gen, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,202,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_chg() */ /*---------------------------------------------------------------------------*/ /* [init] */ void test_init (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[init "); fflush(stdout); fprintf(TESTLOG,"\n[init]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,213,(unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,213,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* stp out of domain */ UNUR_GEN *gen = NULL; UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double stp[] = {-2.5,-1.,0.,1.,2.5}; int n_stp = 5; gen = NULL; distr = unur_distr_normal(NULL,0); unur_distr_cont_set_domain(distr,-2.,2.); par = unur_ars_new(distr); unur_ars_set_cpoints( par, n_stp, stp ); unur_reset_errno(); gen = unur_init( par ); n_tests_failed += (check_errorcode(TESTLOG,225,UNUR_ERR_GEN_DATA)==UNUR_SUCCESS)?0:1; unur_free(gen); unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_init() */ /*---------------------------------------------------------------------------*/ /* [reinit] */ void test_reinit (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[reinit "); fflush(stdout); fprintf(TESTLOG,"\n[reinit]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* exist */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_ars_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 234, gen ); unur_reset_errno(); n_tests_failed += (check_expected_reinit(TESTLOG,238,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_reinit() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_GEN *gen = NULL; gen = NULL; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,248,(unur_ars_eval_invcdfhat(gen,0.5)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,248,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_free(gen); } { /* invalid generator object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); gen = unur_init(par); abort_if_NULL(TESTLOG, 254, gen ); unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,258,(unur_ars_eval_invcdfhat(gen,0.5)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,258,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* invalid domain */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_ars_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 264, gen ); unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,268,(unur_ars_eval_invcdfhat(gen,1.5)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,268,UNUR_ERR_DOMAIN)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_negINFINITY(TESTLOG,271,(unur_ars_eval_invcdfhat(gen,-0.5)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,271,UNUR_ERR_DOMAIN)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = unur_distr_normal(NULL,0); par = NULL; unur_reset_errno(); /* default */ par = unur_ars_new(distr); n_tests_failed += (compare_sequence_par_start(TESTLOG,281,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* verifying mode */ par = unur_ars_new(distr); unur_ars_set_verify(par,1); n_tests_failed += (compare_sequence_par(TESTLOG,286,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* don't use private copy for distr object */ par = unur_ars_new(distr); unur_set_use_distr_privatecopy(par,FALSE); n_tests_failed += (compare_sequence_par(TESTLOG,291,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* verifying mode, don't use private copy for distr object */ par = unur_ars_new(distr); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_verify(par,1); n_tests_failed += (compare_sequence_par(TESTLOG,297,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* compare clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; UNUR_GEN *clone; double fpar[] = {1.23456,2.3456}; distr = unur_distr_normal(fpar,2); par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_ars_new(distr); unur_ars_set_max_intervals(par,2); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,312,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,318,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* dont use private copy for distr object */ /* original generator object */ unur_free(clone); par = unur_ars_new(distr); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_max_intervals(par,2); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,327,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,333,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare reinit */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_ars_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,345,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* reinit */ unur_reinit(gen); n_tests_failed += (compare_sequence_gen(TESTLOG,349,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare stringparser */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[2] = {3.,3.}; distr = NULL; par = NULL; gen = NULL; unur_reset_errno(); distr = unur_distr_gamma(fpar,2); par = unur_ars_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,362,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "gamma(3.,3.) & method = ars "); n_tests_failed += (compare_sequence_gen(TESTLOG,367,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; distr = unur_distr_gamma(fpar,2); par = unur_ars_new(distr); unur_ars_set_cpoints(par,20,NULL); unur_ars_set_max_intervals(par,32); unur_ars_set_verify(par,TRUE); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,377,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "gamma(3.,3.) & \ method = ars; cpoints = 20; \ max_intervals = 32; verify" ); n_tests_failed += (compare_sequence_gen(TESTLOG,384,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* [validate] */ /*---------------------------------------------------------------------------*/ /* [validate] */ void test_validate (void) { /* suppress GCC compiler warning */ GCC_DIAG_OFF(unused-variable) UNUR_DISTR *distr[31]; UNUR_PAR *par; UNUR_GEN *gen; double *darray; double fpm[10]; int n_tests_failed; int rcode; /* start test */ printf("[validate "); fflush(stdout); fprintf(TESTLOG,"\n[validate]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* distributions: 31 */ { fpm[0] = 1.; fpm[1] = 2.; distr[0] = unur_distr_beta(fpm,2); } { fpm[0] = 1.; fpm[1] = 5.; distr[1] = unur_distr_beta(fpm,2); } { fpm[0] = 1.; fpm[1] = 100.; distr[2] = unur_distr_beta(fpm,2); } { fpm[0] = 2.; fpm[1] = 5.; distr[3] = unur_distr_beta(fpm,2); } { fpm[0] = 5.; fpm[1] = 2.; distr[4] = unur_distr_beta(fpm,2); } { fpm[0] = 3.; fpm[1] = 4.; distr[5] = unur_distr_beta(fpm,2); } { fpm[0] = 5.; fpm[1] = 100.; distr[6] = unur_distr_beta(fpm,2); } { fpm[0] = 500.; fpm[1] = 300.; distr[7] = unur_distr_beta(fpm,2); } { fpm[0] = 5.; fpm[1] = 10.; fpm[2] = -3.; fpm[3] = 15.; distr[8] = unur_distr_beta(fpm,4); } { distr[9] = unur_distr_cauchy(NULL,0); } { fpm[0] = 1.; fpm[1] = 20.; distr[10] = unur_distr_cauchy(fpm,2); } { distr[11] = unur_distr_exponential(NULL,0); } { fpm[0] = 30.; fpm[1] = -5.; distr[12] = unur_distr_exponential(fpm,2); } { fpm[0] = 1.; distr[13] = unur_distr_gamma(fpm,1); } { fpm[0] = 2.; distr[14] = unur_distr_gamma(fpm,1); } { fpm[0] = 3.; distr[15] = unur_distr_gamma(fpm,1); } { fpm[0] = 10.; distr[16] = unur_distr_gamma(fpm,1); } { fpm[0] = 1000.; distr[17] = unur_distr_gamma(fpm,1); } { fpm[0] = 5.; fpm[1] = 1000.; distr[18] = unur_distr_gamma(fpm,2); } { fpm[0] = 5.; fpm[1] = 1.e-5; distr[19] = unur_distr_gamma(fpm,2); } { fpm[0] = 5.; fpm[1] = 10.; fpm[2] = 1000; distr[20] = unur_distr_gamma(fpm,3); } { distr[21] = unur_distr_laplace(NULL,0); } { fpm[0] = -10.; fpm[1] = 100.; distr[22] = unur_distr_laplace(fpm,2); } { distr[23] = unur_distr_normal(NULL,0); } { fpm[0] = 1.; fpm[1] = 1.e-5; distr[24] = unur_distr_normal(fpm,2); } { fpm[0] = 0.; fpm[1] = 1.e+5; distr[25] = unur_distr_normal(fpm,2); } { distr[26] = unur_distr_uniform(NULL,0); } { fpm[0] = 1.; fpm[1] = 20.; distr[27] = unur_distr_uniform(fpm,2); } { fpm[0] = 3.; fpm[1] = 4.; distr[28] = unur_distr_beta(fpm,2); unur_distr_cont_set_domain(distr[23],-2.,5.); } { distr[29] = unur_distr_cont_new(); unur_distr_cont_set_logpdf(distr[29],logpdf_normal_1); unur_distr_cont_set_dlogpdf(distr[29],dlogpdf_normal_1); unur_distr_cont_set_cdf(distr[29],cdf_normal_1); unur_distr_set_name(distr[29],"normal_1"); } { distr[30] = unur_distr_cont_new(); unur_distr_cont_set_logpdf(distr[30],logpdf_normal_2); unur_distr_cont_set_dlogpdf(distr[30],dlogpdf_normal_2); unur_distr_cont_set_cdf(distr[30],cdf_normal_2); unur_distr_set_name(distr[30],"normal_2"); } /* timing */ stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); printf("\n(chi^2) "); fflush(stdout); /* chi^2 tests: 217 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nChi^2 Test:\n"); /* distribution [0] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_ars_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_ars_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [2] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_ars_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [3] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_ars_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [4] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_ars_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [5] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_ars_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [6] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_ars_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [7] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_ars_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [8] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_ars_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [9] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_ars_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [10] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_ars_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [11] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_ars_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [12] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_ars_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [13] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_ars_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [14] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_ars_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [15] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_ars_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [16] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_ars_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [17] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_ars_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [18] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_ars_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [19] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_ars_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [20] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_ars_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [21] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_ars_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [22] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_ars_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [23] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_ars_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [24] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_ars_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [25] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_ars_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [26] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_ars_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [27] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_ars_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [28] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_ars_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [29] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_ars_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [30] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_ars_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_ars_new(distr_localcopy); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_ars_new(distr_localcopy); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); printf("\n(verify hat) "); fflush(stdout); /* verify hat tests: 217 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nVerify Hat Test (squeeze <= PDF <= hat):\n"); /* distribution [0] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [2] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [3] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [4] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [5] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [6] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [7] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [8] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [9] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [10] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [11] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [12] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [13] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [14] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [15] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [16] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [17] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [18] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [19] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [20] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [21] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [22] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [23] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [24] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [25] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [26] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [27] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [28] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); double perc[] = {0.1,0.3,0.5,0.7,0.9}; par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,10,NULL); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(distr_localcopy,fpm,2); gen = unur_init(par); if (gen) { unur_ars_chg_reinit_percentiles(gen, 5, perc ); unur_reinit(gen); } if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [29] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,3,NULL); unur_ars_set_max_intervals(par,10); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [30] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_ars_new(distr_localcopy); unur_ars_set_pedantic(par,0); unur_set_use_distr_privatecopy(par,FALSE); unur_ars_set_cpoints(par,30,NULL); gen = unur_init(par); if (gen) unur_ars_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); /* free distributions */ unur_distr_free(distr[0]); unur_distr_free(distr[1]); unur_distr_free(distr[2]); unur_distr_free(distr[3]); unur_distr_free(distr[4]); unur_distr_free(distr[5]); unur_distr_free(distr[6]); unur_distr_free(distr[7]); unur_distr_free(distr[8]); unur_distr_free(distr[9]); unur_distr_free(distr[10]); unur_distr_free(distr[11]); unur_distr_free(distr[12]); unur_distr_free(distr[13]); unur_distr_free(distr[14]); unur_distr_free(distr[15]); unur_distr_free(distr[16]); unur_distr_free(distr[17]); unur_distr_free(distr[18]); unur_distr_free(distr[19]); unur_distr_free(distr[20]); unur_distr_free(distr[21]); unur_distr_free(distr[22]); unur_distr_free(distr[23]); unur_distr_free(distr[24]); unur_distr_free(distr[25]); unur_distr_free(distr[26]); unur_distr_free(distr[27]); unur_distr_free(distr[28]); unur_distr_free(distr[29]); unur_distr_free(distr[30]); /* test finished */ test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; /* we accept CHI2_FAILURES_TOLERATED failures */ (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_validate */ /* enable GCC compiler warning */ GCC_DIAG_ON(unused-variable) /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_ars_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_urng.conf0000644001357500135600000000473614420445767013373 00000000000000############################################################################# [main] [main - data:] # method (for information only: the program scans the file name) method: URNG [main - header:] /* prototypes */ \#define COMPARE_SAMPLE_SIZE (500) \#define VIOLATE_SAMPLE_SIZE (20) ############################################################################# [new] [new - invalid NULL ptr: ] \#ifdef UNUR_URNG_UNURAN ~( NULL, NULL ); --> expected_NULL --> UNUR_ERR_NULL \#endif ############################################################################# [set] [set - invalid NULL ptr: UNUR_URNG *urng = NULL; ] \#ifdef UNUR_URNG_UNURAN ~_seed( urng, NULL ); --> expected_setfailed --> UNUR_ERR_NULL ~_anti( urng, NULL ); --> expected_setfailed --> UNUR_ERR_NULL ~_reset( urng, NULL ); --> expected_setfailed --> UNUR_ERR_NULL ~_nextsub( urng, NULL ); --> expected_setfailed --> UNUR_ERR_NULL ~_resetsub( urng, NULL ); --> expected_setfailed --> UNUR_ERR_NULL ~_delete( urng, NULL ); --> expected_setfailed --> UNUR_ERR_NULL \#endif ############################################################################# # [get] ############################################################################# # [chg] ############################################################################# # [init] ############################################################################# # [reinit] ############################################################################# [sample] [sample - missing functions: UNUR_URNG *urng = NULL; double (*sampleunif)(void*); sampleunif = unur_urng_fish; ] \#ifdef UNUR_URNG_UNURAN urng = unur_urng_new(sampleunif,NULL); unur_urng_reset (urng); --> expected_setfailed --> UNUR_ERR_URNG_MISS unur_urng_seed (urng, 0UL); --> expected_setfailed --> UNUR_ERR_URNG_MISS unur_urng_anti (urng, 0); --> expected_setfailed --> UNUR_ERR_URNG_MISS unur_urng_nextsub (urng); --> expected_setfailed --> UNUR_ERR_URNG_MISS unur_urng_resetsub (urng); --> expected_setfailed --> UNUR_ERR_URNG_MISS unur_urng_seed (urng, 0UL); --> expected_setfailed --> UNUR_ERR_URNG_MISS unur_urng_free(urng); \#endif ############################################################################# # [validate] ############################################################################# ############################################################################# [verbatim] ############################################################################# unuran-1.11.0/tests/testroutines.c0000644001357500135600000012530414420445767014135 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: testroutines.c * * * * Common test routines * * * ***************************************************************************** * * * Copyright (c) 2000-2011 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #include #ifdef HAVE_UNISTD_H # include #endif /*---------------------------------------------------------------------------*/ /* Compiler switches */ /* whether to test U-errors for inversion method in tails more accurately */ #define TEST_INVERROR_TAILS (FALSE) /*---------------------------------------------------------------------------*/ /* global switches */ static int stopwatch = FALSE; /* whether to use a stop watch for checks */ static TIMER vw; /* timer for particular tests */ /*---------------------------------------------------------------------------*/ #if defined(HAVE_ALARM) && defined(HAVE_SIGNAL) /* time limit before SIGALRM is sent to process */ int time_limit = 0u; /* handle SIGALRM signals */ static void catch_alarm (int sig); /* test log file */ static FILE *TESTLOG = NULL; #endif /*---------------------------------------------------------------------------*/ /* draw sample */ static int draw_sample_and_discard ( FILE *LOG, int line, UNUR_GEN *gen, int sample_size ); /* compare two doubles */ static int compare_doubles ( double x1, double x2 ); /* compare double sequences generated by generator */ static int compare_double_sequence_gen_start ( FILE *LOG, int line, UNUR_GEN *gen, int sample_size ); static int compare_double_sequence_gen ( FILE *LOG, int line, UNUR_GEN *gen, int sample_size ); /* compare int sequences generated by generator */ static int compare_int_sequence_gen_start ( FILE *LOG, int line, UNUR_GEN *gen, int sample_size ); static int compare_int_sequence_gen ( FILE *LOG, int line, UNUR_GEN *gen, int sample_size ); /* compare sequences of double vectors generated by generator */ static int compare_cvec_sequence_gen_start ( FILE *LOG, int line, UNUR_GEN *gen, int sample_size ); static int compare_cvec_sequence_gen ( FILE *LOG, int line, UNUR_GEN *gen, int sample_size ); /* compare sequences of double matrices generated by generator */ static int compare_matr_sequence_gen_start ( FILE *LOG, int line, UNUR_GEN *gen, int sample_size ); static int compare_matr_sequence_gen ( FILE *LOG, int line, UNUR_GEN *gen, int sample_size ); /*---------------------------------------------------------------------------*/ /* check whether unur_urng_reset() works */ static int cannot_compare_sequence ( FILE *LOG ) { fprintf (LOG,"\nURNG cannot be reset. Cannot compare sequences. (Skip)\n"); printf ("URNG cannot be reset. Cannot compare sequences. (Skip)\n"); return UNUR_SUCCESS; /* indicate as "not failed" for practical reasons */ } /* end of cannot_compare_sequence() */ /*---------------------------------------------------------------------------*/ /* stop watch */ void stopwatch_start(TIMER *t) /* start stop watch */ { t->stop = stopwatch_get_time(t->tv); t->interim = t->stop; t->start = t->stop; } double stopwatch_lap(TIMER *t) /* return elapsed time (in ms) since last call to stopwatch_start(), stopwatch_stop(), or stopwatch_lap() */ { double etime; t->stop = stopwatch_get_time(t->tv); etime = t->stop - t->interim; t->interim = t->stop; return etime; } double stopwatch_stop(TIMER *t) /* return elapsed time (in ms) since last call to stopwatch_start() or stopwatch_stop() */ { double etime; t->stop = stopwatch_get_time(t->tv); etime = t->stop - t->start; t->interim = t->stop; t->start = t->stop; return etime; } void stopwatch_init(void) /* initialize watch */ { /* detect whether stopwatch should be used */ stopwatch = (getenv("UNURANSTOPWATCH")==NULL) ? FALSE : TRUE; stopwatch_start(&vw); } void stopwatch_print( FILE *LOG, const char *format, double etime ) /* print time depending whether watch is enabled or not */ { if (stopwatch) fprintf(LOG,format,etime); } /*---------------------------------------------------------------------------*/ /* exit with FAIL when run time exceeds limit */ #if defined(HAVE_ALARM) && defined(HAVE_SIGNAL) void catch_alarm (int sig ATTRIBUTE__UNUSED) { fprintf(stdout," aborted! time limit of %d seconds exceeded ...\n",time_limit); fprintf(TESTLOG,"\n\n=== ABORTED! ===\ntime limit of %d seconds exceeded ...\n\n",time_limit); exit (EXIT_FAILURE); } void set_alarm(FILE *LOG) { char *read_timer; /* file handle for test log file */ TESTLOG = LOG; /* read time limit from environment */ read_timer = getenv("UNURANTIMER"); time_limit = (read_timer!=NULL) ? atoi(read_timer) : 0; /* alarm is only set when environment variable is defined */ if (time_limit<=0) return; /* Establish a handler for SIGALRM signals. */ signal(SIGALRM, catch_alarm); /* set in alarm in 'time' seconds */ alarm((unsigned)time_limit); /* print message into test log file */ fprintf(TESTLOG,"Send alarm in %d seconds\n",time_limit); fprintf(TESTLOG,"\n====================================================\n\n"); } #else void set_alarm(FILE *LOG ATTRIBUTE__UNUSED) {;} #endif /*---------------------------------------------------------------------------*/ /* print header for test log file */ void print_test_log_header( FILE *LOG, unsigned long seed, int fullcheck ) { time_t started; /* Title */ fprintf(LOG,"\nUNU.RAN - Universal Non-Uniform RANdom number generator\n\n"); if (time( &started ) != -1) fprintf(LOG,"%s",ctime(&started)); fprintf(LOG,"\n=======================================================\n\n"); /* version */ fprintf(LOG,"UNU.RAN version: %s\n", PACKAGE_STRING); /* deprecated code */ fprintf(LOG,"Use deprecated code: %s\n", #ifdef USE_DEPRECATED_CODE "yes" #else "no" #endif ); /* runtime checks */ fprintf(LOG,"Enable runtime checks: %s\n", #if defined(UNUR_ENABLE_CHECKNULL) || defined(UNUR_COOKIES) "yes" #else "no" #endif ); /* printing debugging info into log file */ fprintf(LOG,"Enable logging of data: %s\n", #ifdef UNUR_ENABLE_LOGGING "yes" #else "no" #endif ); /* creating info string */ fprintf(LOG,"Enable info routine: %s\n", #ifdef UNUR_ENABLE_INFO "yes" #else "no" #endif ); fprintf(LOG,"\n"); /* Uniform random number generator */ fprintf(LOG,"Uniform random number generator: %s\n", #ifdef UNUR_URNG_DEFAULT_RNGSTREAM "RngStreams" #else "[default] (built-in or user supplied)" #endif ); /* seed */ if (seed != ~0u) fprintf(LOG,"SEED = %lu\n",seed); else fprintf(LOG,"SEED = (not set)\n"); fprintf(LOG,"\n"); /* whether all checks are performed */ fprintf(LOG,"check mode: %s\n", fullcheck ? "fullcheck" : "installation"); /* end */ fprintf(LOG,"\n=======================================================\n\n"); } /* end of print_test_log_header() */ /*---------------------------------------------------------------------------*/ /* check for invalid NULL pointer, that should not happen in this program */ void abort_if_NULL( FILE *LOG, int line, const void *ptr ) { if (ptr) return; /* o.k. */ /* There must not be a NULL pointer. Since we do not expect a NULL pointer something serious has happend. So it is better to abort the tests. */ fprintf(LOG,"line %4d: Unexpected NULL pointer. Panik --> Abort tests!!\n\n",line); printf(" Panik --> Tests aborted\n"); fflush(stdout); /* test finished */ printf("\n"); fflush(stdout); /* close log files and exit */ fclose(LOG); exit(EXIT_FAILURE); } /* abort_if_NULL() */ /*---------------------------------------------------------------------------*/ /* compare error code */ int check_errorcode( FILE *LOG, int line, int errno_exp ) { int errno_obs = unur_get_errno(); fprintf(LOG,"line %4d: Error code ...\t\t",line); if (errno_obs != errno_exp) { fprintf(LOG," Failed"); fprintf(LOG," (observed = %#x, expected = %#x)\n",errno_obs,errno_exp); fflush(LOG); return UNUR_FAILURE; } else { fprintf(LOG," ok\n"); fflush(LOG); return UNUR_SUCCESS; } } /* end of check_errorcode() */ /*---------------------------------------------------------------------------*/ /* check for expected NULL pointer */ int do_check_expected_NULL( FILE *LOG, int line, int is_NULL ) { fprintf(LOG,"line %4d: NULL pointer expected ...\t",line); if (is_NULL) { fprintf(LOG," ok\n"); fflush(LOG); return UNUR_SUCCESS; } else { fprintf(LOG," Failed\n"); fflush(LOG); return UNUR_FAILURE; } } /* end of check_expected_NULL() */ /*---------------------------------------------------------------------------*/ /* check for "set failed" */ int check_expected_setfailed( FILE *LOG, int line, int rcode ) { fprintf(LOG,"line %4d: `failed' expected ...\t",line); if (rcode==UNUR_SUCCESS) { fprintf(LOG," Failed\n"); fflush(LOG); return UNUR_FAILURE; } else { fprintf(LOG," ok\n"); fflush(LOG); return UNUR_SUCCESS; } } /* end of check_expected_setfailed() */ /*---------------------------------------------------------------------------*/ /* check for O (zero) */ int check_expected_zero( FILE *LOG, int line, int k ) { fprintf(LOG,"line %4d: 0 (zero) expected ...\t",line); if (k != 0) { fprintf(LOG," Failed\n"); fflush(LOG); return UNUR_FAILURE; } else { fprintf(LOG," ok\n"); fflush(LOG); return UNUR_SUCCESS; } } /* end of check_expected_zero() */ /*---------------------------------------------------------------------------*/ /* check for INFINITY */ int check_expected_INFINITY( FILE *LOG, int line, double x ) { fprintf(LOG,"line %4d: INFINITY expected ...\t",line); if (x < UNUR_INFINITY) { fprintf(LOG," Failed\n"); fflush(LOG); return UNUR_FAILURE; } else { fprintf(LOG," ok\n"); fflush(LOG); return UNUR_SUCCESS; } } /* end of check_expected_INFINITY() */ int check_expected_negINFINITY( FILE *LOG, int line, double x ) { fprintf(LOG,"line %4d: -INFINITY expected ...\t",line); if (x > -UNUR_INFINITY) { fprintf(LOG," Failed\n"); fflush(LOG); return UNUR_FAILURE; } else { fprintf(LOG," ok\n"); fflush(LOG); return UNUR_SUCCESS; } } /* end of check_expected_negINFINITY() */ int check_expected_INTMAX( FILE *LOG, int line, int k ) { fprintf(LOG,"line %4d: INT_MAX expected ...\t",line); if (k < INT_MAX) { fprintf(LOG," Failed\n"); fflush(LOG); return UNUR_FAILURE; } else { fprintf(LOG," ok\n"); fflush(LOG); return UNUR_SUCCESS; } } /* end of check_expected_INTMAX() */ /*---------------------------------------------------------------------------*/ /* check for reinit */ int check_expected_reinit( FILE *LOG, int line, int rcode ) { fprintf(LOG,"line %4d: reinit ...\t\t\t",line); if (rcode!=UNUR_SUCCESS) { fprintf(LOG," Failed\n"); fflush(LOG); return UNUR_FAILURE; } else { fprintf(LOG," ok\n"); fflush(LOG); return UNUR_SUCCESS; } } /* end of check_expected_reinit() */ /*---------------------------------------------------------------------------*/ /* check for non existing reinit */ int check_expected_no_reinit( FILE *LOG, int line, int rcode ) { fprintf(LOG,"line %4d: no reinit ...\t\t",line); if (rcode==UNUR_SUCCESS) { fprintf(LOG," Failed\n"); fflush(LOG); return UNUR_FAILURE; } else { fprintf(LOG," ok\n"); fflush(LOG); return UNUR_SUCCESS; } } /* end of check_expected_no_reinit() */ /*---------------------------------------------------------------------------*/ /* draw sample */ int draw_sample_and_discard ( FILE *LOG, int line, UNUR_GEN *gen, int sample_size ) { /* int J; */ /* double X; */ double *vec; switch (unur_distr_get_type(unur_get_distr(gen)) ) { case UNUR_DISTR_DISCR: for( ; sample_size>0; --sample_size) /* J = unur_sample_discr(gen); */ unur_sample_discr(gen); return UNUR_SUCCESS; case UNUR_DISTR_CONT: case UNUR_DISTR_CEMP: for( ; sample_size>0; --sample_size) /* X = unur_sample_cont(gen); */ unur_sample_cont(gen); return UNUR_SUCCESS; case UNUR_DISTR_CVEC: case UNUR_DISTR_CVEMP: /* we need an array for the vector */ vec = malloc( unur_get_dimension(gen) * sizeof(double) ); abort_if_NULL(LOG, line, vec); for( ; sample_size>0; --sample_size) unur_sample_vec(gen,vec); free(vec); return UNUR_SUCCESS; default: /* unknown ! */ fprintf(stderr,"\ncannot handle distribution type! ... aborted\n"); exit (EXIT_FAILURE); } } /* end of unur_test_printsample() */ /*---------------------------------------------------------------------------*/ /* compare two doubles */ int compare_doubles ( double x1, double x2 ) { if (_unur_FP_approx(x1,x2)) return TRUE; else if (fabs(x1-x2) < UNUR_EPSILON) return TRUE; else return FALSE; } /* end of compare_doubles() */ /*---------------------------------------------------------------------------*/ /* compare sequences generated by generator */ int compare_sequence_gen_start( FILE *LOG, int line, UNUR_GEN *gen, int sample_size ) { if (gen == NULL) return UNUR_FAILURE; /* reset uniform RNG */ if (unur_urng_reset(unur_get_urng(gen)) != UNUR_SUCCESS) return UNUR_SUCCESS; switch( unur_distr_get_type(unur_get_distr(gen)) ) { case UNUR_DISTR_CONT: case UNUR_DISTR_CEMP: case 0: /* method UNIF */ return compare_double_sequence_gen_start(LOG,line,gen,sample_size ); case UNUR_DISTR_CVEC: case UNUR_DISTR_CVEMP: return compare_cvec_sequence_gen_start(LOG,line,gen,sample_size ); case UNUR_DISTR_DISCR: return compare_int_sequence_gen_start(LOG,line,gen,sample_size ); case UNUR_DISTR_MATR: return compare_matr_sequence_gen_start(LOG,line,gen,sample_size ); default: fprintf(stderr,"\ncannot handle distribution type! ... aborted\n"); exit (EXIT_FAILURE); } } /* end of compare_sequence_gen_start() */ int compare_sequence_gen ( FILE *LOG, int line, UNUR_GEN *gen, int sample_size ) { if (gen == NULL) return UNUR_FAILURE; /* reset uniform RNG */ if (unur_urng_reset(unur_get_urng(gen)) != UNUR_SUCCESS) return cannot_compare_sequence(LOG); switch( unur_distr_get_type(unur_get_distr(gen)) ) { case UNUR_DISTR_CONT: case UNUR_DISTR_CEMP: case 0: /* method UNIF */ return compare_double_sequence_gen(LOG,line,gen,sample_size ); case UNUR_DISTR_CVEC: case UNUR_DISTR_CVEMP: return compare_cvec_sequence_gen(LOG,line,gen,sample_size ); case UNUR_DISTR_DISCR: return compare_int_sequence_gen(LOG,line,gen,sample_size ); case UNUR_DISTR_MATR: return compare_matr_sequence_gen(LOG,line,gen,sample_size ); default: fprintf(stderr,"\ncannot handle distribution type! ... aborted\n"); exit (EXIT_FAILURE); } } /* end of compare_sequence_gen() */ /*---------------------------------------------------------------------------*/ int compare_sequence_par_start( FILE *LOG, int line, UNUR_PAR *par, int sample_size ) { UNUR_GEN *gen; int result; /* reset uniform RNG */ if (unur_urng_reset(unur_get_default_urng()) != UNUR_SUCCESS) { if (par) { free(par); } return UNUR_SUCCESS; } /* init generator */ gen = unur_init( par ); abort_if_NULL(LOG,line,gen); /* run test */ result = compare_sequence_gen_start(LOG,line,gen,sample_size); unur_free(gen); return result; } /* end of compare_sequence_par_start() */ int compare_sequence_par ( FILE *LOG, int line, UNUR_PAR *par, int sample_size ) { UNUR_GEN *gen; int result; /* reset uniform RNG */ if (unur_urng_reset(unur_get_default_urng()) != UNUR_SUCCESS) { if (par) { free(par); } return cannot_compare_sequence(LOG); } /* init generator */ gen = unur_init( par ); abort_if_NULL(LOG, line,gen); /* run test */ result = compare_sequence_gen(LOG,line,gen,sample_size); unur_free(gen); return result; } /* end of compare_sequence_par() */ /*---------------------------------------------------------------------------*/ /* compare double sequences generated by generator */ /* only when when we can reset the uniform RNG */ static double *double_sequence_A = NULL; int compare_sequence_urng_start( FILE *LOG, int line, int sample_size ) { int i; UNUR_URNG *urng = unur_get_default_urng(); /* allocate memory for storing sequence */ if (double_sequence_A == NULL) { double_sequence_A = malloc( sample_size * sizeof(double) ); abort_if_NULL(LOG, line, double_sequence_A); } /* reset uniform RNG */ if (unur_urng_reset(urng) != UNUR_SUCCESS) return UNUR_SUCCESS; /* generate sequence */ for (i=0; i1) ? pval : pval*(dim+1); if (pval < -1.5) { /* was not able to run test (CDF missing) */ fprintf(LOG," not performed (missing data)\t"); /* print distribution name */ print_distr_name( LOG, distr, gen ? unur_get_genid(gen):"???\t" ); fprintf(LOG,"\n"); printf("X"); fflush(stdout); fflush(LOG); /* test failed */ return UNUR_FAILURE; } if (pval < 0.) { fprintf(LOG," setup failed\t\t"); } else { fprintf(LOG," pval = %8.6f ",pval); l = _unur_isnan(pval_corrected) ? 10000 : -(int) ((pval_corrected > 1e-6) ? (log(pval_corrected) / M_LN10) : 6.); switch (l) { case 0: fprintf(LOG," "); break; case 1: fprintf(LOG,". "); break; case 2: fprintf(LOG,"** "); break; case 3: fprintf(LOG,"XXX "); break; case 4: fprintf(LOG,"XXXX "); break; case 5: fprintf(LOG,"XXXXX "); break; default: fprintf(LOG,"######"); break; } } switch (todo) { case '+': if (pval_corrected >= PVAL_LIMIT) { fprintf(LOG,"\t ok"); printf("+"); } else { failed = 1; if (trial > 2) { fprintf(LOG,"\t Failed"); printf("(!+)"); } else { fprintf(LOG,"\t Try again"); printf("?"); } } break; case '0': case '/': fprintf(LOG,"\t ok (expected to fail)"); printf("0"); break; case '-': if (pval_corrected < PVAL_LIMIT) { /* in this case it is expected to fail */ failed = 0; fprintf(LOG,"\t ok (expected to fail)"); printf("-"); } else { /* the test has failed which was not what we have expected */ failed = 1; fprintf(LOG,"\t Not ok (expected to fail)"); printf("(!-)"); } break; default: fprintf(stderr, "%s:%d: invalid test symbol\n", __FILE__, __LINE__); exit (-1); } /* timing */ stopwatch_print(LOG,"\ttime=%.1f ms ", stopwatch_lap(&vw)); /* print distribution name */ fprintf(LOG,"\t"); print_distr_name( LOG, distr, gen ? unur_get_genid(gen):"???\t" ); fprintf(LOG,"\n"); fflush(stdout); fflush(LOG); return (failed ? UNUR_FAILURE : UNUR_SUCCESS); } /* end of print_pval() */ /*---------------------------------------------------------------------------*/ /* run chi2 test */ int run_validate_chi2( FILE *LOG, int line ATTRIBUTE__UNUSED, UNUR_GEN *gen, const UNUR_DISTR *distr, int todo ) /* UNUR_SUCCESS ... on success */ /* UNUR_ERR_SILENT ... test failed only once */ /* UNUR_FAILURE ... serious failure */ { #define BUFSIZE 128 const char *distr_name; static char last_distr_name[BUFSIZE] = ""; unsigned int type; int i; double pval; int failed = 0; /* check input */ if (distr == NULL) { printf(" [!!no distribution!!] "); fflush(stdout); return UNUR_FAILURE; } /* timer */ stopwatch_lap(&vw); /* get name of distribution */ distr_name = unur_distr_get_name( distr ); /* get type of distribution */ type = unur_distr_get_type( distr ); if ( strcmp(distr_name,last_distr_name) ) { /* different distributions */ strncpy(last_distr_name,distr_name,(size_t)BUFSIZE); last_distr_name[BUFSIZE-1] = '\0'; printf(" %s",distr_name); fflush(stdout); } if (todo == '.') { /* nothing to do */ printf("."); fflush(stdout); return UNUR_SUCCESS; } if (todo == '0') { /* initialization of generator is expected to fail */ if (gen == NULL) { printf("0"); fflush(stdout); return UNUR_SUCCESS; } else { /* error */ printf("(!0)"); fflush(stdout); return UNUR_FAILURE; } } if (gen == NULL) { if (todo == '-') { print_pval(LOG,gen,distr,-0.5,10,todo); return UNUR_SUCCESS; } else if (todo == '/') { printf("/"); fflush(stdout); return UNUR_SUCCESS; } else { /* initialization failed --> cannot run test */ print_pval(LOG,gen,distr,-0.5,10,todo); return UNUR_FAILURE; } } if (todo == '%') { /* initialize generator and draw small sample. */ /* (for memory debugging when the CDF is not available) */ printf("%%"); fflush(stdout); draw_sample_and_discard(LOG, line, gen, 100); fprintf(LOG," not performed (sample only)\t"); print_distr_name( LOG, distr, gen ? unur_get_genid(gen):"???\t" ); fprintf(LOG,"\n"); return UNUR_SUCCESS; } /* init successful */ if ( todo == '/' ) todo = '+'; /* run chi^2 test */ for (i=1; i<=3; i++) { /* we run the test up to three times when it fails */ switch (type) { case UNUR_DISTR_DISCR: pval = unur_test_chi2( gen, CHI_TEST_INTERVALS, 100000, 20, CHI_TEST_VERBOSITY, LOG); break; case UNUR_DISTR_CONT: case UNUR_DISTR_CEMP: pval = unur_test_chi2( gen, CHI_TEST_INTERVALS, 0, 20, CHI_TEST_VERBOSITY, LOG); break; case UNUR_DISTR_CVEC: case UNUR_DISTR_CVEMP: pval = unur_test_chi2( gen, CHI_TEST_INTERVALS, 0, 20, CHI_TEST_VERBOSITY, LOG); break; default: fprintf(stderr, "\n%s:%d: run_validate_chi2: this should not happen\n", __FILE__, __LINE__); exit (EXIT_FAILURE); } if ( print_pval(LOG,gen,distr,pval,i,todo) != UNUR_SUCCESS ) /* test failed */ failed++; else /* test ok */ break; } return (failed==0 ? UNUR_SUCCESS : (failed<=2 ? UNUR_ERR_SILENT : UNUR_FAILURE)); #undef BUFSIZE } /* end of run_validate_chi2() */ /*---------------------------------------------------------------------------*/ /* run verify hat test */ #define VERIFYHAT_SAMPLESIZE 10000 int run_validate_verifyhat( FILE *LOG, int line, UNUR_GEN *gen, const UNUR_DISTR *distr, int todo ) { #define BUFSIZE 128 const char *distr_name; static char last_distr_name[BUFSIZE] = ""; unsigned int type; int i; int failed = 0; int dim; double *x = NULL; int errno_obs; /* check input */ if (distr == NULL) { printf(" [!!no distribution!!]" ); fflush(stdout); return UNUR_FAILURE; } /* timer */ stopwatch_lap(&vw); /* get name of distribution */ distr_name = unur_distr_get_name( distr ); /* get type of distribution */ type = unur_distr_get_type( distr ); if (strcmp(distr_name,last_distr_name) ) { /* different distributions */ strncpy(last_distr_name,distr_name,(size_t)BUFSIZE); last_distr_name[BUFSIZE-1] = '\0'; printf(" %s",distr_name); fflush(stdout); } if (todo == '.') { /* nothing to do */ printf("."); fflush(stdout); return UNUR_SUCCESS; } if (todo == '0') { /* initialization of generator is expected to fail */ if (gen == NULL) { printf("0"); fflush(stdout); print_verifyhat_result(LOG,gen,distr,-1,todo); return UNUR_SUCCESS; } else { /* error */ printf("(!0)"); fflush(stdout); return UNUR_FAILURE; } } if (gen == NULL) { if (todo == '-') { printf("-"); fflush(stdout); print_verifyhat_result(LOG,gen,distr,-1,todo); return UNUR_SUCCESS; } else { /* initialization failed --> cannot run test */ printf("(!+)"); fflush(stdout); print_verifyhat_result(LOG,gen,distr,-1,todo); return UNUR_FAILURE; } } /* get dimension of distribution */ dim = unur_get_dimension (gen); /* allocate working space */ if (dim > 0) { x = malloc( dim * sizeof(double) ); abort_if_NULL(LOG, line, x); } /* run verify hat test */ for (i=0; i= 0) { fprintf(LOG," failures = %d (%g%%) ",failed, 100. * failed_ratio); switch (todo) { case '+': if (failed > 0) { fprintf(LOG,"\t Failed"); printf("(!+)"); failed_test = 1; } else { fprintf(LOG,"\t ok"); printf("+"); } break; case '~': if (failed == 0) { fprintf(LOG,"\t ok"); printf("+"); } else if (failed_ratio <= 0.01) { fprintf(LOG,"\t tolerated"); printf("(~+)"); } else { fprintf(LOG,"\t Failed"); printf("(!~+)"); failed_test = 1; } break; case '-': if (failed_ratio > 0.01) { /* in this case it is expected to fail */ fprintf(LOG,"\t ok (expected to fail)"); printf("-"); } else { /* the test has failed which was not what we have expected */ fprintf(LOG,"\t Not ok (expected to fail)"); printf("(!-)"); failed_test = 1; } break; default: fprintf(stderr,"%s:%d: invalid test symbol\n", __FILE__, __LINE__); exit (EXIT_FAILURE); } } else { fprintf(LOG," setup failed\t"); switch (todo) { case '0': case '-': fprintf(LOG,"\t ok (expected to fail)"); break; default: fprintf(LOG,"\t Failed"); } } /* timing */ stopwatch_print(LOG,"\ttime=%.1f ms ", stopwatch_lap(&vw)); /* print distribution name */ fprintf(LOG,"\t"); print_distr_name( LOG, distr, gen ? unur_get_genid(gen):"???\t" ); fprintf(LOG,"\n"); fflush(stdout); fflush(LOG); return (failed_test ? UNUR_ERR_SILENT : UNUR_SUCCESS); } /* end of print_verifyhat_result() */ #undef VERIFYHAT_SAMPLESIZE /*---------------------------------------------------------------------------*/ /* print result of timings */ void print_timing_results( FILE *LOG, int line ATTRIBUTE__UNUSED, const UNUR_DISTR *distr, double *timing_setup, double *timing_marginal, int n_results ) { const char *distr_name; static const char *last_distr_name = ""; int i; /* get name of distribution */ distr_name = unur_distr_get_name( distr ); if (strcmp(distr_name,last_distr_name) ) { /* different distributions */ last_distr_name = distr_name; printf(" %s=",distr_name); fflush(stdout); } else { printf("="); fflush(stdout); } /* print timings into log file */ for (i=0; i u_resolution) { fprintf(LOG,"(NOT <= %g)\n",u_resolution); fprintf(LOG,"%s: Warning: precision problem, maxerror > u_resolution\n",genid); } else { fprintf(LOG,"(<= %g)\n",u_resolution); } fprintf(LOG,"%s: score = %5.2f %%\t--> %s\n", genid, score*100, (score<0.001) ? "passed" : "failed"); /* print result of test on screen and return result */ if (score == 0.) { printf("+"); fflush(stdout); return 0; } if (score < 0.001) { printf("(?+)"); fflush(stdout); return 1; } else { printf("(!+)"); fflush(stdout); return 2; } } /* end of run_validate_u_error() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/tests/t_deprecated_vmt.c0000644001357500135600000014321414430713513014662 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for VMT **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); int unur_vmt_set_verify( UNUR_PAR *par, int verify); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ #define COMPARE_SAMPLE_SIZE (10000) #define VIOLATE_SAMPLE_SIZE (20) /* #define SEED (298346) */ /* we need marginal distributions for the chi2 tests */ #define unur_distr_multicauchy unur_distr_multicauchy_w_marginals #define unur_distr_multinormal unur_distr_multinormal_w_marginals #define unur_distr_multistudent unur_distr_multistudent_w_marginals /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,37,(unur_vmt_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,37,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,44,(unur_vmt_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,44,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* data missing in distribution object */ UNUR_DISTR *distr = NULL; double mean[] = {1.,2.}; double covar[] = {2.,1., 1., 2.}; distr = unur_distr_cvec_new(2); unur_reset_errno(); /* mean */ n_tests_failed += (check_expected_NULL(TESTLOG,54,(unur_vmt_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,54,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* covariance matrix */ unur_distr_cvec_set_mean(distr,mean); unur_distr_cvec_set_covar(distr,covar); n_tests_failed += (check_expected_NULL(TESTLOG,60,(unur_vmt_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,60,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [reinit] */ void test_reinit (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[reinit "); fflush(stdout); fprintf(TESTLOG,"\n[reinit]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* exists */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_multinormal(3,NULL,NULL); par = unur_vmt_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 85, gen ); unur_reset_errno(); n_tests_failed += (check_expected_reinit(TESTLOG,89,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_reinit() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* compare clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; const int dim = 3; double mean[] = {1.,2.,3.}; double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; UNUR_GEN *clone; distr = unur_distr_multinormal( dim, mean, covar ); par = unur_vmt_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 101, gen ); unur_reset_errno(); /* normal distribution */; n_tests_failed += (compare_sequence_gen_start(TESTLOG,105,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,111,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; const int dim = 3; double mean[] = {1.,2.,3.}; double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; double beta_params[] = {3.,5.}; UNUR_GEN *clone; distr = unur_distr_cvec_new(dim); unur_distr_cvec_set_mean(distr,mean); unur_distr_cvec_set_covar(distr,covar); unur_distr_cvec_set_marginal_list(distr, unur_distr_normal(NULL,0), unur_distr_cauchy(NULL,0), unur_distr_beta(beta_params,2) ); unur_distr_cvec_set_stdmarginal_list(distr, unur_distr_normal(NULL,0), unur_distr_cauchy(NULL,0), unur_distr_beta(beta_params,2) ); par = unur_vmt_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 132, gen ); unur_reset_errno(); /* multivariate distribution with given marginals */; n_tests_failed += (compare_sequence_gen_start(TESTLOG,136,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,142,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double mean[] = {1.,2.,3.}; double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; double beta_params[] = {3.,5.}; UNUR_DISTR *marginals[3]; UNUR_GEN *clone; distr = unur_distr_cvec_new(3); unur_distr_cvec_set_mean(distr,mean); unur_distr_cvec_set_covar(distr,covar); marginals[0] = unur_distr_normal(NULL,0); marginals[1] = unur_distr_cauchy(NULL,0); marginals[2] = unur_distr_beta(beta_params,2); unur_distr_cvec_set_marginal_array(distr,marginals); unur_distr_cvec_set_stdmarginal_array(distr,marginals); unur_distr_free(marginals[0]); unur_distr_free(marginals[1]); unur_distr_free(marginals[2]); par = unur_vmt_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 163, gen ); unur_reset_errno(); /* multivariate distribution with given marginals */; n_tests_failed += (compare_sequence_gen_start(TESTLOG,167,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,173,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare clone 1dim */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; const int dim = 1; double mean[] = {1.}; double covar[] = {2.}; double beta_params[] = {3.,5.}; UNUR_GEN *clone; distr = unur_distr_cvec_new(dim); unur_distr_cvec_set_mean(distr,mean); unur_distr_cvec_set_covar(distr,covar); unur_distr_cvec_set_marginal_list(distr, unur_distr_beta(beta_params,2) ); unur_distr_cvec_set_stdmarginal_list(distr, unur_distr_beta(beta_params,2) ); par = unur_vmt_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 190, gen ); unur_reset_errno(); /* multivariate distribution with given marginals */; n_tests_failed += (compare_sequence_gen_start(TESTLOG,194,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,200,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare clone 1dim */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double mean[] = {1.}; double covar[] = {2.}; double beta_params[] = {3.,5.}; UNUR_DISTR *marginals[1]; UNUR_GEN *clone; distr = unur_distr_cvec_new(1); unur_distr_cvec_set_mean(distr,mean); unur_distr_cvec_set_covar(distr,covar); marginals[0] = unur_distr_beta(beta_params,2); unur_distr_cvec_set_marginal_array(distr,marginals); unur_distr_cvec_set_stdmarginal_array(distr,marginals); unur_distr_free(marginals[0]); par = unur_vmt_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 217, gen ); unur_reset_errno(); /* multivariate distribution with given marginals */; n_tests_failed += (compare_sequence_gen_start(TESTLOG,221,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,227,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare reinit */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_multinormal(3,NULL,NULL); par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_vmt_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,239,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* reinit */ unur_reinit(gen); n_tests_failed += (compare_sequence_gen(TESTLOG,243,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* set domain and compare clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; const int dim = 3; double mean[] = {1.,2.,3.}; double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; double ll[] = {0.,0.,0.}; double ru[] = {UNUR_INFINITY, 1., 2.}; UNUR_GEN *clone; distr = unur_distr_multinormal( dim, mean, covar ); unur_distr_cvec_set_domain_rect( distr, ll, ru ); par = unur_vmt_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 256, gen ); unur_reset_errno(); /* normal distribution */; n_tests_failed += (compare_sequence_gen_start(TESTLOG,260,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,266,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* [validate] */ /*---------------------------------------------------------------------------*/ /* [validate] */ void test_validate (void) { /* suppress GCC compiler warning */ GCC_DIAG_OFF(unused-variable) UNUR_DISTR *distr[33]; UNUR_PAR *par; UNUR_GEN *gen; double *darray; double fpm[10]; int n_tests_failed; int rcode; /* start test */ printf("[validate "); fflush(stdout); fprintf(TESTLOG,"\n[validate]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* distributions: 33 */ { distr[0] = unur_distr_multinormal(3,NULL,NULL); } { double mean[] = { 1., 2., 3. }; double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; distr[1] = unur_distr_multinormal(3,mean,covar); } { double ll[3] = {0.,0.,0.}; double ru[3] = {UNUR_INFINITY,UNUR_INFINITY,UNUR_INFINITY}; distr[30] = unur_distr_multinormal(3,NULL,NULL); unur_distr_cvec_set_domain_rect(distr[30],ll,ru); } { double ll[3] = {0.,0.,0.}; double ru[3] = {1.,UNUR_INFINITY,UNUR_INFINITY}; distr[31] = unur_distr_multinormal(3,NULL,NULL); unur_distr_cvec_set_domain_rect(distr[31],ll,ru); } { double ll[3] = {-1.,-1.,1.}; double ru[3] = {1.,0.,2.}; distr[32] = unur_distr_multinormal(3,NULL,NULL); unur_distr_cvec_set_domain_rect(distr[32],ll,ru); } { #define dim (2) int i; double mean[dim], covar[dim*dim]; UNUR_DISTR *covar_distr; UNUR_GEN *covar_gen; UNUR_GEN *mean_gen; covar_distr = unur_distr_correlation(dim); covar_gen = unur_init(unur_mcorr_new(covar_distr)); mean_gen = unur_str2gen("normal(5,1)"); for (i=0; isetup time = %.3f ms\n", stopwatch_lap(&watch)); printf("\n(chi^2) "); fflush(stdout); /* chi^2 tests: 66 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nChi^2 Test:\n"); /* distribution [0] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_vmt_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { UNUR_DISTR *dg =NULL; double mean[] = { -1., 2., -3. }; double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; par = unur_vmt_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cvec_set_mean(dg,mean); unur_distr_cvec_set_covar(dg,covar); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_vmt_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { UNUR_DISTR *dg =NULL; double mean[] = { -1., 2., -3. }; double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; par = unur_vmt_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cvec_set_mean(dg,mean); unur_distr_cvec_set_covar(dg,covar); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [2] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_vmt_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [3] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_vmt_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); { UNUR_DISTR *dg =NULL; double mean[] = { -1., 2., -3. }; double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; par = unur_vmt_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cvec_set_mean(dg,mean); unur_distr_cvec_set_covar(dg,covar); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [4] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_vmt_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [5] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_vmt_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [6] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_vmt_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [7] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_vmt_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [8] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_vmt_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [9] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_vmt_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [10] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_vmt_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [26] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_vmt_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [27] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_vmt_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [28] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_vmt_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [29] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_vmt_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [11] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_vmt_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [12] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_vmt_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [13] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_vmt_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [14] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_vmt_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [15] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_vmt_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); { UNUR_DISTR *dg =NULL; double mean[] = { -1., 2., -3. }; double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; par = unur_vmt_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cvec_set_mean(dg,mean); unur_distr_cvec_set_covar(dg,covar); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [16] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_vmt_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); { UNUR_DISTR *dg =NULL; double mean[] = { -1., 2., -3. }; double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; par = unur_vmt_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cvec_set_mean(dg,mean); unur_distr_cvec_set_covar(dg,covar); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [17] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_vmt_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [18] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_vmt_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); { UNUR_DISTR *dg =NULL; double mean[] = { -1., 2., -3. }; double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; par = unur_vmt_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cvec_set_mean(dg,mean); unur_distr_cvec_set_covar(dg,covar); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [19] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_vmt_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [20] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_vmt_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [21] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_vmt_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [22] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_vmt_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [23] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_vmt_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [24] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_vmt_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [25] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_vmt_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [30] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_vmt_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); { UNUR_DISTR *dg =NULL; double mean[] = { -1., 2., -3. }; double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; par = unur_vmt_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cvec_set_mean(dg,mean); unur_distr_cvec_set_covar(dg,covar); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [31] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_vmt_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [32] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_vmt_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); /* free distributions */ unur_distr_free(distr[0]); unur_distr_free(distr[1]); unur_distr_free(distr[2]); unur_distr_free(distr[3]); unur_distr_free(distr[4]); unur_distr_free(distr[5]); unur_distr_free(distr[6]); unur_distr_free(distr[7]); unur_distr_free(distr[8]); unur_distr_free(distr[9]); unur_distr_free(distr[10]); unur_distr_free(distr[11]); unur_distr_free(distr[12]); unur_distr_free(distr[13]); unur_distr_free(distr[14]); unur_distr_free(distr[15]); unur_distr_free(distr[16]); unur_distr_free(distr[17]); unur_distr_free(distr[18]); unur_distr_free(distr[19]); unur_distr_free(distr[20]); unur_distr_free(distr[21]); unur_distr_free(distr[22]); unur_distr_free(distr[23]); unur_distr_free(distr[24]); unur_distr_free(distr[25]); unur_distr_free(distr[26]); unur_distr_free(distr[27]); unur_distr_free(distr[28]); unur_distr_free(distr[29]); unur_distr_free(distr[30]); unur_distr_free(distr[31]); unur_distr_free(distr[32]); /* test finished */ test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; /* we accept CHI2_FAILURES_TOLERATED failures */ (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_validate */ /* enable GCC compiler warning */ GCC_DIAG_ON(unused-variable) /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_vmt_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_hitro.c0000644001357500135600000067360414430713513013034 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for HITRO **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); int unur_hitro_set_verify( UNUR_PAR *par, int verify); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ int unur_hitro_set_pedantic( UNUR_PAR *par, int pedantic ); #define COMPARE_SAMPLE_SIZE (9999) #define VIOLATE_SAMPLE_SIZE (20) /* For running chi2 tests we use a thinning of dimension * THINNING */ #define THINNING (2) /* HITRO is a Markov Chain Monte Carlo method and thus it is likely to */ /* fail the chi-square goodness-of-fit test with the used sample size. */ /* Thus we accept one "hard" failer and more "soft" failures then usual. */ #define CHI2_FAILURES_TOLERATED (1010) /* we need marginal distributions for the chi2 tests */ #define unur_distr_multicauchy unur_distr_multicauchy_w_marginals #define unur_distr_multinormal unur_distr_multinormal_w_marginals #define unur_distr_multistudent unur_distr_multistudent_w_marginals /* HITRO tests are sensitive against SEED. */ /* So we at least ignore the random seed from the script */ /* the transforms t_hitro.conf to t_hitro.c. */ #ifndef SEED #define SEED (123456) #endif /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ /* dummy function */ int unur_hitro_set_pedantic( UNUR_PAR *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) { return 1; } /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,48,(unur_hitro_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,48,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,55,(unur_hitro_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,55,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* missing data */ UNUR_DISTR *distr = NULL; distr = unur_distr_cvec_new(3); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,62,(unur_hitro_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,62,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [set] */ void test_set (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[set "); fflush(stdout); fprintf(TESTLOG,"\n[set]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; double x0[] = {1., 2., 3.}; double umin[] = {0.,0.,0.}; double umax[] = {1.,1.,1.}; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,76,(unur_hitro_set_variant_coordinate( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,76,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,79,(unur_hitro_set_variant_random_direction( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,79,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,82,(unur_hitro_set_startingpoint( par, x0)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,82,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,85,(unur_hitro_set_thinning( par, 3 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,85,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,88,(unur_hitro_set_burnin( par, 100 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,88,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,91,(unur_hitro_set_use_adaptiveline( par, TRUE )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,91,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,94,(unur_hitro_set_use_boundingrectangle( par, TRUE )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,94,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,97,(unur_hitro_set_use_adaptiverectangle( par, TRUE ) ))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,97,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,100,(unur_hitro_set_r( par, 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,100,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,103,(unur_hitro_set_v( par, 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,103,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,106,(unur_hitro_set_u( par, umin, umax )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,106,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,109,(unur_hitro_set_adaptive_multiplier( par, 1.1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,109,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* invalid parameter object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double x0[] = {1., 2., 3.}; double umin[] = {0.,0.,0.}; double umax[] = {1.,1.,1.}; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_arou_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,121,(unur_hitro_set_variant_coordinate( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,121,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,124,(unur_hitro_set_variant_random_direction( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,124,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,127,(unur_hitro_set_startingpoint( par, x0)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,127,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,130,(unur_hitro_set_thinning( par, 3 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,130,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,133,(unur_hitro_set_burnin( par, 100 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,133,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,136,(unur_hitro_set_use_adaptiveline( par, TRUE )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,136,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,139,(unur_hitro_set_use_boundingrectangle( par, TRUE )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,139,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,142,(unur_hitro_set_use_adaptiverectangle( par, TRUE ) ))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,142,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,145,(unur_hitro_set_r( par, 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,145,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,148,(unur_hitro_set_v( par, 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,148,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,151,(unur_hitro_set_u( par, umin, umax )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,151,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,154,(unur_hitro_set_adaptive_multiplier( par, 1.1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,154,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double umin[] = {0.,0.,0.}; double umax[] = {1.,-1.,1.}; double umaxinf[] = {1.,UNUR_INFINITY,1.}; distr = unur_distr_multinormal( 3, NULL, NULL ); par = unur_hitro_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,167,(unur_hitro_set_thinning( par, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,167,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,170,(unur_hitro_set_burnin( par, -1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,170,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,173,(unur_hitro_set_r( par, 0. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,173,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,176,(unur_hitro_set_v( par, 0. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,176,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,179,(unur_hitro_set_v( par, UNUR_INFINITY )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,179,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,182,(unur_hitro_set_u( par, umin, umax )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,182,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,185,(unur_hitro_set_u( par, umin, umaxinf )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,185,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,188,(unur_hitro_set_adaptive_multiplier( par, 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,188,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_set() */ /*---------------------------------------------------------------------------*/ /* [get] */ void test_get (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[get "); fflush(stdout); fprintf(TESTLOG,"\n[get]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid generator object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); gen = unur_init(par); abort_if_NULL(TESTLOG, 200, gen ); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,204,(unur_hitro_get_state(gen)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,204,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_get() */ /*---------------------------------------------------------------------------*/ /* [chg] */ void test_chg (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[chg "); fflush(stdout); fprintf(TESTLOG,"\n[chg]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid generator object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double x[] = {0.,0.}; distr = unur_distr_normal(NULL,0); par = unur_ssr_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 214, gen ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,218,(unur_hitro_chg_state(gen,x)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,218,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* invalid NULL */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_multinormal(2,NULL,NULL); par = unur_hitro_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 222, gen ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,226,(unur_hitro_chg_state(gen,NULL)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,226,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* invalid state */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double state[] = {1000.,1000.,1000.}; distr = unur_distr_multinormal(2,NULL,NULL); par = unur_hitro_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 231, gen ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,235,(unur_hitro_chg_state(gen,state)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,235,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_chg() */ /*---------------------------------------------------------------------------*/ /* [reinit] */ void test_reinit (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[reinit "); fflush(stdout); fprintf(TESTLOG,"\n[reinit]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* does not exist */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double x[3]; distr = unur_distr_multinormal(3,NULL,NULL); par = unur_hitro_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 249, gen ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,253,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,253,UNUR_ERR_NO_REINIT)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_sample_vec( gen, x ); n_tests_failed += (check_expected_INFINITY(TESTLOG,257,(x[0]))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,257,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_reinit() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* test clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; const int dim = 3; double mean[] = {1.,2.,3.}; double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; UNUR_GEN *clone; distr = unur_distr_multinormal( dim, mean, covar ); par = unur_hitro_new(distr); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); gen = unur_init( par ); abort_if_NULL(TESTLOG, 273, gen ); unur_reset_errno(); ; n_tests_failed += (compare_sequence_gen_start(TESTLOG,277,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; unur_hitro_reset_state(gen); n_tests_failed += (compare_sequence_gen(TESTLOG,284,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* test clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; const int dim = 3; double mean[] = {1.,2.,3.}; double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; UNUR_GEN *clone; distr = unur_distr_multinormal( dim, mean, covar ); par = unur_hitro_new(distr); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,TRUE); gen = unur_init( par ); abort_if_NULL(TESTLOG, 298, gen ); unur_reset_errno(); ; n_tests_failed += (compare_sequence_gen_start(TESTLOG,302,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; unur_hitro_reset_state(gen); n_tests_failed += (compare_sequence_gen(TESTLOG,309,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* [validate] */ /*---------------------------------------------------------------------------*/ /* [validate] */ void test_validate (void) { /* suppress GCC compiler warning */ GCC_DIAG_OFF(unused-variable) UNUR_DISTR *distr[37]; UNUR_PAR *par; UNUR_GEN *gen; double *darray; double fpm[10]; int n_tests_failed; int rcode; /* start test */ printf("[validate "); fflush(stdout); fprintf(TESTLOG,"\n[validate]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* distributions: 37 */ { distr[0] = unur_distr_multinormal(1,NULL,NULL); } { distr[1] = unur_distr_multinormal(2,NULL,NULL); } { distr[2] = unur_distr_multinormal(3,NULL,NULL); } { double mean[] = { -1. }; double covar[] = { 2. }; distr[3] = unur_distr_multinormal(1,mean,covar); unur_distr_cvec_set_center(distr[3],NULL); } { double mean[] = { 1., 2., 3. }; double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; distr[4] = unur_distr_multinormal(3,mean,covar); } { distr[5] = unur_distr_multinormal_ar1(3,NULL,0.9); } { distr[6] = unur_distr_multinormal_ar1(4,NULL,0.9); } { distr[7] = unur_distr_multinormal_ar1(5,NULL,0.9); } { distr[8] = unur_distr_multinormal_ar1(10,NULL,0.7); } { double mean[] = { -1., -2., -3., 4., 5., 6., 7., 8., 9., 10. }; distr[9] = unur_distr_multinormal_ar1(3,mean,0.9); } { double mean[] = { -1., -2., -3., 4., 5., 6., 7., 8., 9., 10. }; distr[10] = unur_distr_multinormal_ar1(4,mean,0.9); } { double mean[] = { -1., -2., -3., 4., 5., 6., 7., 8., 9., 10. }; distr[11] = unur_distr_multinormal_ar1(5,mean,0.9); } { double mean[] = { -1., -2., -3., 4., 5., 6., 7., 8., 9., 10. }; distr[12] = unur_distr_multinormal_ar1(10,mean,0.7); } { distr[13] = unur_distr_multinormal_constantrho(3,NULL,0.9); } { distr[14] = unur_distr_multinormal_constantrho(4,NULL,0.9); } { distr[15] = unur_distr_multinormal_constantrho(5,NULL,0.9); } { distr[16] = unur_distr_multinormal_constantrho(10,NULL,0.7); } { distr[17] = unur_distr_multicauchy(2,NULL,NULL); } { distr[18] = unur_distr_multicauchy(3,NULL,NULL); } { double mean[] = { 1., 2., 3. }; double covar[] = { 1., 0.5, 0.25, 0.5, 1., 0.5, 0.25, 0.5, 1. }; distr[19] = unur_distr_multicauchy(3,mean,covar); } { distr[20] = unur_distr_multicauchy_ar1(3,NULL,0.9); } { distr[21] = unur_distr_multicauchy_ar1(4,NULL,0.9); } { distr[22] = unur_distr_multicauchy_ar1(5,NULL,0.9); } { distr[23] = unur_distr_multicauchy_ar1(10,NULL,0.7); } { distr[24] = unur_distr_multistudent_ar1(2,3.,NULL,0.9); } { distr[25] = unur_distr_multistudent_ar1(2,5.,NULL,0.9); } { distr[26] = unur_distr_multistudent_ar1(2,15.,NULL,0.9); } { distr[27] = unur_distr_multistudent_ar1(2,0.5,NULL,0.9); } { distr[28] = unur_distr_multistudent_ar1(2,1.5,NULL,0.9); } { distr[29] = unur_distr_multistudent_ar1(2,2.5,NULL,0.9); } { double ll[3] = {0.,0.,0.}; double ru[3] = {UNUR_INFINITY,UNUR_INFINITY,UNUR_INFINITY}; distr[30] = unur_distr_multinormal(3,NULL,NULL); unur_distr_cvec_set_domain_rect(distr[30],ll,ru); } { double ll[3] = {-0.5,-0.5,-0.5}; double ru[3] = {UNUR_INFINITY,UNUR_INFINITY,UNUR_INFINITY}; distr[34] = unur_distr_multinormal(3,NULL,NULL); unur_distr_cvec_set_domain_rect(distr[34],ll,ru); } { double ll[3] = {0.,0.,0.}; double ru[3] = {1.,UNUR_INFINITY,UNUR_INFINITY}; distr[31] = unur_distr_multinormal(3,NULL,NULL); unur_distr_cvec_set_domain_rect(distr[31],ll,ru); } { double ll[3] = {-0.5,-0.5,-0.5}; double ru[3] = {1.,UNUR_INFINITY,UNUR_INFINITY}; distr[35] = unur_distr_multinormal(3,NULL,NULL); unur_distr_cvec_set_domain_rect(distr[35],ll,ru); } { double ll[3] = {-1.,-1.,1.}; double ru[3] = {1.,0.,2.}; double center[3] = {0.,0.,1.}; distr[32] = unur_distr_multinormal(3,NULL,NULL); unur_distr_cvec_set_domain_rect(distr[32],ll,ru); unur_distr_cvec_set_center(distr[32],center); } { double ll[3] = {-1.,-1.,1.}; double ru[3] = {1.,0.,2.}; double center[3] = {0.,-0.5,1.5}; distr[36] = unur_distr_multinormal(3,NULL,NULL); unur_distr_cvec_set_domain_rect(distr[36],ll,ru); unur_distr_cvec_set_center(distr[36],center); } { double ll[3] = {-1.,-1.,1.}; double ru[3] = {1.,0.,2.}; distr[33] = unur_distr_multinormal(3,NULL,NULL); unur_distr_cvec_set_domain_rect(distr[33],ll,ru); } /* timing */ stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); printf("\n(chi^2) "); fflush(stdout); /* chi^2 tests: 333 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nChi^2 Test:\n"); /* distribution [0] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [2] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [3] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [4] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [5] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [6] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [7] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [8] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [9] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [10] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [11] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [12] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [13] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [14] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [15] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [16] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [17] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [18] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [19] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [20] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [21] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [22] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [23] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [24] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [25] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [26] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [28] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [29] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [30] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [34] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [31] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [35] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [32] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [36] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [33] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,FALSE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,FALSE); unur_hitro_set_use_boundingrectangle(par,FALSE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_coordinate(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); par = unur_hitro_new(distr_localcopy); unur_hitro_set_variant_random_direction(par); unur_hitro_set_r(par,3.); unur_hitro_set_use_adaptiveline(par,TRUE); unur_hitro_set_use_adaptiverectangle(par,TRUE); unur_hitro_set_use_boundingrectangle(par,TRUE); unur_hitro_set_thinning(par,THINNING*(1+unur_distr_get_dim(distr_localcopy))); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); /* free distributions */ unur_distr_free(distr[0]); unur_distr_free(distr[1]); unur_distr_free(distr[2]); unur_distr_free(distr[3]); unur_distr_free(distr[4]); unur_distr_free(distr[5]); unur_distr_free(distr[6]); unur_distr_free(distr[7]); unur_distr_free(distr[8]); unur_distr_free(distr[9]); unur_distr_free(distr[10]); unur_distr_free(distr[11]); unur_distr_free(distr[12]); unur_distr_free(distr[13]); unur_distr_free(distr[14]); unur_distr_free(distr[15]); unur_distr_free(distr[16]); unur_distr_free(distr[17]); unur_distr_free(distr[18]); unur_distr_free(distr[19]); unur_distr_free(distr[20]); unur_distr_free(distr[21]); unur_distr_free(distr[22]); unur_distr_free(distr[23]); unur_distr_free(distr[24]); unur_distr_free(distr[25]); unur_distr_free(distr[26]); unur_distr_free(distr[27]); unur_distr_free(distr[28]); unur_distr_free(distr[29]); unur_distr_free(distr[30]); unur_distr_free(distr[31]); unur_distr_free(distr[32]); unur_distr_free(distr[33]); unur_distr_free(distr[34]); unur_distr_free(distr[35]); unur_distr_free(distr[36]); /* test finished */ test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; /* we accept CHI2_FAILURES_TOLERATED failures */ (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_validate */ /* enable GCC compiler warning */ GCC_DIAG_ON(unused-variable) /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_hitro_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_utdr.conf0000644001357500135600000003526714420445767013401 00000000000000############################################################################# [main] [main - data:] # method method: UTDR [main - header:] /* prototypes */ double pdf( double x, const UNUR_DISTR *distr ); double pdf_bimodal( double x, const UNUR_DISTR *distr ); double dpdf_bimodal( double x, const UNUR_DISTR *distr ); double pdf_negative( double x, const UNUR_DISTR *distr ); double dpdf_negative( double x, const UNUR_DISTR *distr ); double pdf_partnegative( double x, const UNUR_DISTR *distr ); double dpdf_partnegative( double x, const UNUR_DISTR *distr ); double pdf_sqrtlin( double x, const UNUR_DISTR *distr ); double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ); double cdf_sqrtlin( double x, const UNUR_DISTR *distr ); double pdf_sqrtlinshft(double x, const UNUR_DISTR *distr ); double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); int unur_utdr_set_pedantic( struct unur_par *par, int pedantic ); \#define COMPARE_SAMPLE_SIZE (10000) \#define VIOLATE_SAMPLE_SIZE (20) /* \#define SEED (2346412) */ ############################################################################# [new] [new - invalid NULL ptr: distr = NULL; ] ~( distr ); --> expected_NULL --> UNUR_ERR_NULL [new - invalid distribution type: distr = unur_distr_discr_new(); ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID [new - data missing in distribution object: distr = unur_distr_cont_new(); ] /* pdf, mode, pdfarea */ ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED ############################################################################# [set] [set - invalid NULL ptr: par = NULL; ] ~_verify( par, 1 ); --> expected_setfailed --> UNUR_ERR_NULL ~_pdfatmode(par,1.); --> expected_setfailed --> UNUR_ERR_NULL ~_cpfactor(par, 1.); --> expected_setfailed --> UNUR_ERR_NULL ~_deltafactor(par, 1.); --> expected_setfailed --> UNUR_ERR_NULL [set - invalid parameter object: double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_arou_new(distr); ] ~_verify( par, 1 ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_pdfatmode(par,1.); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_cpfactor(par, 1.); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_deltafactor(par, 1.); --> expected_setfailed --> UNUR_ERR_PAR_INVALID unur_par_free(par); [set - invalid parameters: double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_utdr_new(distr); ] ~_pdfatmode(par,-1.); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_cpfactor(par, -1.); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_deltafactor(par, -1.); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_deltafactor(par, 1.); --> expected_setfailed --> UNUR_ERR_PAR_SET unur_par_free(par); ############################################################################# # [get] ############################################################################# [chg] [chg - invalid generator object: double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_arou_new(distr); unur_set_debug(par,0); gen = unur_init( par ); <-- ! NULL ] ~_verify(gen,1); --> expected_setfailed --> UNUR_ERR_GEN_INVALID ~_pdfatmode(gen,1.); --> expected_setfailed --> UNUR_ERR_GEN_INVALID [chg - invalid parameters: double fpar[2] = {2.,5.}; distr = unur_distr_gamma(fpar,2); par = unur_utdr_new(distr); gen = unur_init( par ); <-- ! NULL ] ~_pdfatmode(gen,-1.); --> expected_setfailed --> UNUR_ERR_PAR_SET ############################################################################# [init] [init - invalid NULL ptr: par = NULL; ] unur_init( par ); --> expected_NULL --> UNUR_ERR_NULL [init - data missing in distribution object: distr = unur_distr_cont_new(); par = NULL; ] /* mode, pdfarea */ unur_distr_cont_set_pdf(distr,pdf); par = unur_utdr_new( distr ); unur_init(par); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED /* pdfarea */ unur_distr_cont_set_mode(distr,1.); par = unur_utdr_new( distr ); unur_init(par); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED ############################################################################# [reinit] [reinit - exist: distr = unur_distr_normal(NULL,0); par = unur_utdr_new(distr); gen = unur_init( par ); <-- ! NULL ] unur_reinit( gen ); --> expected_reinit ############################################################################# [sample] [sample - compare: distr = unur_distr_normal(NULL,0); par = NULL; ] /* default algorithm */ par = unur_utdr_new(distr); -->compare_sequence_par_start /* default algorithm - verifying mode */ par = unur_utdr_new(distr); unur_utdr_set_verify(par,1); -->compare_sequence_par #..................................................................... [sample - compare clone: UNUR_GEN *clone; distr = unur_distr_normal(NULL,0); par = NULL; gen = NULL; ] /* original generator object */ par = unur_utdr_new(distr); gen = unur_init(par); -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen #..................................................................... [sample - compare reinit: distr = unur_distr_normal(NULL,0); par = NULL; gen = NULL; ] /* original generator object */ par = unur_utdr_new(distr); gen = unur_init(par); -->compare_sequence_gen_start /* reinit */ unur_reinit(gen); -->compare_sequence_gen #..................................................................... [sample - compare stringparser: double fpar[2] = {3.,3.}; distr = NULL; par = NULL; gen = NULL; ] distr = unur_distr_gamma(fpar,2); par = unur_utdr_new(distr); unur_utdr_set_cpfactor(par,0.660); unur_utdr_set_deltafactor(par,1.e-4); unur_utdr_set_verify(par,TRUE); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "gamma(3.,3.) & \ method = utdr; cpfactor = 0.66; deltafactor = 1.e-4; verify" ); -->compare_sequence_gen ############################################################################# [validate] [validate - generators:] # default program par[0] = unur_utdr_new(@distr@); # default variant but reinitialized with changed domain { UNUR_DISTR *dg =NULL; par[1] = unur_utdr_new(@distr@); dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } # default variant but reinitialized with changed pdf parameters { UNUR_DISTR *dg =NULL; par[2] = unur_utdr_new(@distr@); fpm[0] = 1.; fpm[1] = 4.; dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } [validate - distributions:] # Beta distributions fpm[0] = 1.; fpm[1] = 2.; distr[0] = unur_distr_beta(fpm,2); fpm[0] = 1.; fpm[1] = 5.; distr[1] = unur_distr_beta(fpm,2); fpm[0] = 1.; fpm[1] = 100.; distr[2] = unur_distr_beta(fpm,2); fpm[0] = 3.; fpm[1] = 4.; distr[3] = unur_distr_beta(fpm,2); fpm[0] = 5.; fpm[1] = 100.; distr[4] = unur_distr_beta(fpm,2); fpm[0] = 500.; fpm[1] = 300.; distr[5] = unur_distr_beta(fpm,2); fpm[0] = 5.; fpm[1] = 10.; fpm[2] = -3.; fpm[3] = 15.; distr[6] = unur_distr_beta(fpm,4); # Cauchy distributions distr[7] = unur_distr_cauchy(NULL,0); fpm[0] = 1.; fpm[1] = 20.; distr[8] = unur_distr_cauchy(fpm,2); # Exponential distributions distr[23] = unur_distr_exponential(NULL,0); fpm[0] = 30.; fpm[1] = -5.; distr[24] = unur_distr_exponential(fpm,2); # Gamma distributions fpm[0] = 1.; distr[9] = unur_distr_gamma(fpm,1); fpm[0] = 2.; distr[10] = unur_distr_gamma(fpm,1); fpm[0] = 3.; distr[11] = unur_distr_gamma(fpm,1); fpm[0] = 10.; distr[12] = unur_distr_gamma(fpm,1); fpm[0] = 1000.; distr[13] = unur_distr_gamma(fpm,1); fpm[0] = 5.; fpm[1] = 1000.; distr[14] = unur_distr_gamma(fpm,2); fpm[0] = 5.; fpm[1] = 1.e-5; distr[15] = unur_distr_gamma(fpm,2); fpm[0] = 5.; fpm[1] = 10.; fpm[2] = 1000; distr[16] = unur_distr_gamma(fpm,3); # Laplace distributions distr[25] = unur_distr_laplace(NULL,0); fpm[0] = -10.; fpm[1] = 100.; distr[26] = unur_distr_laplace(fpm,2); # Normal distributions distr[17] = unur_distr_normal(NULL,0); fpm[0] = 1.; fpm[1] = 1.e-5; distr[18] = unur_distr_normal(fpm,2); fpm[0] = 0.; fpm[1] = 1.e+5; distr[19] = unur_distr_normal(fpm,2); # Uniform distributions distr[20] = unur_distr_uniform(NULL,0); fpm[0] = 1.; fpm[1] = 20.; distr[21] = unur_distr_uniform(fpm,2); # pdf with piecewise linear function as transformed density with T = -1/sqrt distr[27] = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr[27],pdf_sqrtlin); unur_distr_cont_set_dpdf(distr[27],dpdf_sqrtlin); unur_distr_cont_set_cdf(distr[27],cdf_sqrtlin); unur_distr_set_name(distr[27],"sqrtlin"); unur_distr_cont_set_mode(distr[27],0.); unur_distr_cont_set_pdfarea(distr[27],2.); # pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode distr[28] = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr[28],pdf_sqrtlinshft); unur_distr_cont_set_dpdf(distr[28],dpdf_sqrtlinshft); unur_distr_cont_set_cdf(distr[28],cdf_sqrtlinshft); unur_distr_set_name(distr[28],"sqrtlin"); unur_distr_cont_set_mode(distr[28],1000.); unur_distr_cont_set_pdfarea(distr[28],2.); # truncated distributions distr[22] = unur_distr_cauchy(NULL,0); unur_distr_cont_set_domain(distr[22],0.1,1.); unur_distr_cont_upd_mode(distr[22]); unur_distr_cont_upd_pdfarea(distr[22]); # number of distributions: 29 [validate - test chi2:] # + ... pass test # 0 ... fail to initialize generator # - ... fail test # . ... do not run test # # ... comment # # generators: # [0] default # [1] default, but reinitialized with changed domain # [2] default, but reinitialized with changed PDF parameters # #gen 0 1 2 # distribution #--------------------------------------------- x <0> + + + # beta (1, 2) <1> + + + # beta (1, 5) x <2> + . . # beta (1, 100) <3> + + + # beta (3, 4) <4> + . . # beta (5, 100) <5> + . . # beta (500, 300) <6> + + . # beta (5, 10, -3, 15) <23> + + + # exponential () <24> + + + # exponential (30, -5) <7> + + + # cauchy () <8> + + + # cauchy (1, 20) x <9> + + + # gamma (1) <10> + + + # gamma (2) <11> + + . # gamma (3) <12> + + . # gamma (10) x<13> + . . # gamma (1000) <14> + + . # gamma (5, 1000, 0) x<15> + . . # gamma (5, 1e-05, 0) x<16> + - . # gamma (5, 10, 100000) <25> + + + # laplace () <26> + + + # laplace (-10, 100) <17> + + + # normal () x<18> + . + # normal (1, 1e-05) <19> + . . # normal (1, 1e+05) <20> + + . # uniform () <21> + - + # uniform (1, 20) <22> + + + # cauchy () - truncated <27> + . . # pdf with piecewise linear function as transformed density with T = -1/sqrt <28> + . . # [27] with shifted mode [validate - verify hat:] # + ... pass test # ~ ... fail in at most 1% of samples # 0 ... fail to initialize generator # - ... fail test # . ... do not run test # # ... comment # # # generators: # [0] default # [1] default, but reinitialized with changed domain # [2] default, but reinitialized with changed PDF parameters # #gen 0 1 2 # distribution #--------------------------------------------- x <0> + + + # beta (1, 2) <1> + + + # beta (1, 5) x <2> + . . # beta (1, 100) <3> + + + # beta (3, 4) <4> + . . # beta (5, 100) <5> + . . # beta (500, 300) <6> + + . # beta (5, 10, -3, 15) <23> + + + # exponential () <24> + + + # exponential (30, -5) <7> + + + # cauchy () <8> + + + # cauchy (1, 20) x <9> + + + # gamma (1) <10> + + + # gamma (2) <11> + + . # gamma (3) <12> + + . # gamma (10) x<13> + . . # gamma (1000) <14> + + . # gamma (5, 1000, 0) x<15> + . . # gamma (5, 1e-05, 0) x<16> + . . # gamma (5, 10, 100000) <25> + + + # laplace () <26> + + + # laplace (-10, 100) <17> + + + # normal () x<18> + . + # normal (1, 1e-05) <19> + . . # normal (1, 1e+05) <20> + + . # uniform () <21> + . + # uniform (1, 20) <22> + + + # cauchy () - truncated <27> + . . # pdf with piecewise linear function as transformed density with T = -1/sqrt ############################################################################# ############################################################################# [verbatim] /* pdf of bimodal density */ double pdf_bimodal( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return ( exp(-(x-1.)*(x-1.)) + exp(-(x+1.)*(x+1.)) ); } double dpdf_bimodal( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return ( -2. * (x-1.) * exp(-(x-1.)*(x-1.)) -2. * (x+1.) * exp(-(x+1.)*(x+1.)) ); } /* pdf with negative value */ double pdf_negative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return (-x*x); } double dpdf_negative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return (-2.*x); } /* pdf with partial negative value */ double pdf_partnegative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return ((x>-0.89 && x<0.89) ? -1.: exp(-x*x)); } double dpdf_partnegative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return ((x>-0.89 && x<0.89) ?0.: -2.*x*exp(-x*x)); } /* pdf of normal density */ double pdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return exp(-x*x/2.); } /* end of pdf */ /* pdf with piecewise linear function as transformed density with T = -1/sqrt */ double pdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y = 1./(fabs(x)+1.); return y*y; } double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y = 1./(fabs(x)+1.); y = 2.*y*y*y; return ((x<0.) ? y : - y); } double cdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { if (x<=0.) return 0.5/(1.-x); else return (1.-0.5/(1.+x)); } /* pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode */ double pdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y; x -= 1000.; y = 1./(fabs(x)+1.); return y*y; } double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y; x -= 1000.; y = 1./(fabs(x)+1.); y = 2.*y*y*y; return ((x<0.) ? y : - y); } double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { x -= 1000.; if (x<=0.) return 0.5/(1.-x); else return (1.-0.5/(1.+x)); } /* dummy function */ int unur_utdr_set_pedantic( struct unur_par *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) { return 1; } ############################################################################# unuran-1.11.0/tests/t_ssr.conf0000644001357500135600000004114614420445767013223 00000000000000############################################################################# [main] [main - data:] # method (for information only: the program scans the file name) method: SSR [main - header:] /* prototypes */ double pdf_normal( double x, const UNUR_DISTR *distr ); double pdf_invalid( double x, const UNUR_DISTR *distr ); double pdf_sqrtlin( double x, const UNUR_DISTR *distr ); double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ); double cdf_sqrtlin( double x, const UNUR_DISTR *distr ); double pdf_sqrtlinshft(double x, const UNUR_DISTR *distr ); double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); int unur_ssr_set_pedantic( struct unur_par *par, int pedantic ); \#define COMPARE_SAMPLE_SIZE (10000) \#define VIOLATE_SAMPLE_SIZE (20) /* \#define SEED (1656256) */ ############################################################################# [new] [new - invalid NULL ptr: distr = NULL; ] ~( distr ); --> expected_NULL --> UNUR_ERR_NULL [new - invalid distribution type: distr = unur_distr_discr_new(); ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID [new - data missing in distribution object: distr = unur_distr_cont_new(); ] /* pdf, mode, pdfarea */ ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED ############################################################################# [set] [set - invalid NULL ptr: par = NULL; ] ~_cdfatmode(par,0.); --> expected_setfailed --> UNUR_ERR_NULL ~_pdfatmode(par,1.); --> expected_setfailed --> UNUR_ERR_NULL ~_verify(par,1); --> expected_setfailed --> UNUR_ERR_NULL ~_usesqueeze(par,1); --> expected_setfailed --> UNUR_ERR_NULL [set - invalid parameter object: double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_arou_new(distr); ] ~_cdfatmode(par,0.); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_pdfatmode(par,1.); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_verify(par,1); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_usesqueeze(par,1); --> expected_setfailed --> UNUR_ERR_PAR_INVALID unur_par_free(par); [set - invalid parameters: double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_ssr_new(distr); ] ~_cdfatmode(par,-1.); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_pdfatmode(par,-1.); --> expected_setfailed --> UNUR_ERR_PAR_SET unur_par_free(par); ############################################################################# # [get] ############################################################################# [chg] [chg - invalid generator object: double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_arou_new(distr); unur_set_debug(par,0); gen = unur_init( par ); <-- ! NULL ] ~_verify(gen,1); --> expected_setfailed --> UNUR_ERR_GEN_INVALID ~_cdfatmode(gen,1.); --> expected_setfailed --> UNUR_ERR_GEN_INVALID ~_pdfatmode(gen,1.); --> expected_setfailed --> UNUR_ERR_GEN_INVALID [chg - invalid parameters: double fpar[2] = {2.,5.}; distr = unur_distr_gamma(fpar,2); par = unur_ssr_new(distr); gen = unur_init( par ); <-- ! NULL ] ~_cdfatmode(gen,-1.); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_pdfatmode(gen,-1.); --> expected_setfailed --> UNUR_ERR_PAR_SET ############################################################################# [init] [init - invalid NULL ptr: par = NULL; ] unur_init( par ); --> expected_NULL --> UNUR_ERR_NULL [init - invalid data: distr = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr,pdf_invalid); unur_distr_cont_set_mode(distr,0.); unur_distr_cont_set_pdfarea(distr,1.); par = unur_ssr_new(distr); ] unur_init( par ); --> expected_NULL --> UNUR_ERR_GEN_DATA [init - data missing in distribution object: distr = unur_distr_cont_new(); par = NULL; ] /* mode, pdfarea */ unur_distr_cont_set_pdf(distr,pdf_normal); par = unur_ssr_new( distr ); unur_init(par); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED /* pdfarea */ unur_distr_cont_set_mode(distr,1.); par = unur_ssr_new( distr ); unur_init(par); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED ############################################################################# [reinit] [reinit - exist: distr = unur_distr_normal(NULL,0); par = unur_ssr_new(distr); gen = unur_init( par ); <-- ! NULL ] unur_reinit( gen ); --> expected_reinit ############################################################################# [sample] [sample - compare: double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,0); par = NULL; ] /* default algorithm */ par = unur_ssr_new(distr); -->compare_sequence_par_start /* default algorithm - verifying mode */ par = unur_ssr_new(distr); unur_ssr_set_verify(par,1); -->compare_sequence_par #..................................................................... [sample - compare: double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = NULL; ] /* use cdf at mode */ par = unur_ssr_new(distr); unur_ssr_set_cdfatmode(par,0.5); -->compare_sequence_par_start /* use cdf at mode and squeeze */ par = unur_ssr_new(distr); unur_ssr_set_cdfatmode(par,0.5); unur_ssr_set_usesqueeze(par,1); -->compare_sequence_par /* use cdf at mode - verifying mode */ par = unur_ssr_new(distr); unur_ssr_set_cdfatmode(par,0.5); unur_ssr_set_verify(par,1); --> compare_sequence_par /* use cdf at mode and squeeze - verifying mode */ par = unur_ssr_new(distr); unur_ssr_set_cdfatmode(par,0.5); unur_ssr_set_usesqueeze(par,1); unur_ssr_set_verify(par,1); --> compare_sequence_par #..................................................................... [sample - violate condition: double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = NULL; ] /* pdf at mode is too small: hat < pdf near mode */ /* default algorithm */ par = unur_ssr_new(distr); unur_ssr_set_pdfatmode(par,0.1); --> run_verify_generator --> UNUR_ERR_GEN_CONDITION /* use cdf at mode and squeeze */ par = unur_ssr_new(distr); unur_ssr_set_pdfatmode(par,0.1); unur_ssr_set_cdfatmode(par,0.5); unur_ssr_set_usesqueeze(par,1); --> run_verify_generator --> UNUR_ERR_GEN_CONDITION /* pdf at mode is too large: squeeze > pdf near mode */ /* use cdf at mode and squeeze */ unur_distr_cont_set_pdfarea(distr,10.); par = unur_ssr_new(distr); unur_ssr_set_cdfatmode(par,0.5); unur_ssr_set_pdfatmode(par,10.); unur_ssr_set_usesqueeze(par,1); --> run_verify_generator --> UNUR_ERR_GEN_CONDITION #..................................................................... [sample - compare clone: UNUR_GEN *clone; distr = unur_distr_normal(NULL,0); par = NULL; gen = NULL; ] /* original generator object */ par = unur_ssr_new(distr); gen = unur_init(par); -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen #..................................................................... [sample - compare reinit: distr = unur_distr_normal(NULL,0); par = NULL; gen = NULL; ] /* original generator object */ par = unur_ssr_new(distr); gen = unur_init(par); -->compare_sequence_gen_start /* reinit */ unur_reinit(gen); -->compare_sequence_gen #..................................................................... [sample - compare stringparser: double fpar[2] = {3.,3.}; distr = NULL; par = NULL; gen = NULL; ] distr = unur_distr_beta(fpar,2); unur_distr_cont_set_pdfarea(distr,2.); par = unur_ssr_new(distr); unur_ssr_set_cdfatmode(par,0.5); unur_ssr_set_pdfatmode(par,1.9); unur_ssr_set_usesqueeze(par,FALSE); unur_ssr_set_verify(par,TRUE); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "beta(3.,3.); pdfarea = 2. & \ method = ssr; cdfatmode = 0.5; usesqueeze = off; pdfatmode = 1.9; verify" ); -->compare_sequence_gen ############################################################################# [validate] [validate - generators:] # default program par[0] = unur_ssr_new(@distr@); # use cdf at mode and squeeze { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(@distr@), @distr@ ); par[1] = unur_ssr_new(@distr@); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } # default variant but reinitialized with changed domain { UNUR_DISTR *dg =NULL; par[2] = unur_ssr_new(@distr@); dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } # default variant but reinitialized with changed pdf parameters { UNUR_DISTR *dg =NULL; par[3] = unur_ssr_new(@distr@); fpm[0] = 1.; fpm[1] = 4.; dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } [validate - distributions:] # Beta distributions fpm[0] = 1.; fpm[1] = 2.; distr[0] = unur_distr_beta(fpm,2); fpm[0] = 1.; fpm[1] = 5.; distr[1] = unur_distr_beta(fpm,2); fpm[0] = 1.; fpm[1] = 100.; distr[2] = unur_distr_beta(fpm,2); fpm[0] = 3.; fpm[1] = 4.; distr[3] = unur_distr_beta(fpm,2); fpm[0] = 5.; fpm[1] = 100.; distr[4] = unur_distr_beta(fpm,2); fpm[0] = 500.; fpm[1] = 300.; distr[5] = unur_distr_beta(fpm,2); fpm[0] = 5.; fpm[1] = 10.; fpm[2] = -3.; fpm[3] = 15.; distr[6] = unur_distr_beta(fpm,4); # Cauchy distributions distr[7] = unur_distr_cauchy(NULL,0); fpm[0] = 1.; fpm[1] = 20.; distr[8] = unur_distr_cauchy(fpm,2); # Exponential distributions distr[23] = unur_distr_exponential(NULL,0); fpm[0] = 30.; fpm[1] = -5.; distr[24] = unur_distr_exponential(fpm,2); # Gamma distributions fpm[0] = 1.; distr[9] = unur_distr_gamma(fpm,1); fpm[0] = 2.; distr[10] = unur_distr_gamma(fpm,1); fpm[0] = 3.; distr[11] = unur_distr_gamma(fpm,1); fpm[0] = 10.; distr[12] = unur_distr_gamma(fpm,1); fpm[0] = 1000.; distr[13] = unur_distr_gamma(fpm,1); fpm[0] = 1.; fpm[1] = 4.; distr[29] = unur_distr_gamma(fpm,2); fpm[0] = 5.; fpm[1] = 1000.; distr[14] = unur_distr_gamma(fpm,2); fpm[0] = 5.; fpm[1] = 1.e-5; distr[15] = unur_distr_gamma(fpm,2); fpm[0] = 5.; fpm[1] = 10.; fpm[2] = 1000; distr[16] = unur_distr_gamma(fpm,3); fpm[0] = 0.5; distr[30] = unur_distr_gamma(fpm,1); # Laplace distributions distr[25] = unur_distr_laplace(NULL,0); fpm[0] = -10.; fpm[1] = 100.; distr[26] = unur_distr_laplace(fpm,2); # Normal distributions distr[17] = unur_distr_normal(NULL,0); fpm[0] = 1.; fpm[1] = 1.e-5; distr[18] = unur_distr_normal(fpm,2); fpm[0] = 0.; fpm[1] = 1.e+5; distr[19] = unur_distr_normal(fpm,2); # Uniform distributions distr[20] = unur_distr_uniform(NULL,0); fpm[0] = 1.; fpm[1] = 20.; distr[21] = unur_distr_uniform(fpm,2); # pdf with piecewise linear function as transformed density with T = -1/sqrt distr[27] = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr[27],pdf_sqrtlin); unur_distr_cont_set_dpdf(distr[27],dpdf_sqrtlin); unur_distr_cont_set_cdf(distr[27],cdf_sqrtlin); unur_distr_set_name(distr[27],"sqrtlin"); unur_distr_cont_set_mode(distr[27],0.); unur_distr_cont_set_pdfarea(distr[27],2.); # pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode distr[28] = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr[28],pdf_sqrtlinshft); unur_distr_cont_set_dpdf(distr[28],dpdf_sqrtlinshft); unur_distr_cont_set_cdf(distr[28],cdf_sqrtlinshft); unur_distr_set_name(distr[28],"sqrtlin"); unur_distr_cont_set_mode(distr[28],1000.); unur_distr_cont_set_pdfarea(distr[28],2.); # truncated distributions distr[22] = unur_distr_cauchy(NULL,0); unur_distr_cont_set_domain(distr[22],0.1,1.); unur_distr_cont_upd_mode(distr[22]); unur_distr_cont_upd_pdfarea(distr[22]); # number of distributions: 31 [validate - test chi2:] # + ... pass test # 0 ... fail to initialize generator # - ... fail test # . ... do not run test # # ... comment # # generators: # [0] ... default variant # [1] ... use cdf at mode and squeeze # [2] ... default variant but reinitialized with changed domain # [3] ... default variant but reinitialized with changed pdf parameters # #gen 0 1 2 3 # distribution #--------------------------------------------- x <0> + + + + # beta (1, 2) <1> + + + + # beta (1, 5) x <2> + + . . # beta (1, 100) <3> + + + . # beta (3, 4) x <4> + + . . # beta (5, 100) x <5> + + . . # beta (500, 300) <6> + + + . # beta (5, 10, -3, 15) <23> + + + + # exponential () <24> + + + + # exponential (30, -5) <7> + + + + # cauchy () <8> + + + + # cauchy (1, 20) x <9> + + + + # gamma (1) <0> + + + + # gamma (2) <11> + + + . # gamma (3) <12> + + + . # gamma (10) x<13> + + . . # gamma (1000) <29> + + + + # gamma (1, 4) <14> + + + . # gamma (5, 1000, 0) x<15> + + . . # gamma (5, 1e-05, 0) x<16> + + - . # gamma (5, 10, 100000) <30> 0 0 0 0 # gamma (0.5) <25> + + + + # laplace () <26> + + + + # laplace (-10, 100) <17> + + + + # normal () x<18> + + . + # normal (1, 1e-05) <19> + + . . # normal (1, 1e+05) <20> + + + + # uniform () <21> + + - + # uniform (1, 20) <22> + . + + # cauchy () - truncated <27> + + . . # pdf with piecewise linear function as transformed density with T = -1/sqrt <28> + + . . # [27] with shifted mode [validate - verify hat:] # + ... pass test # ~ ... fail in at most 1% of samples # 0 ... fail to initialize generator # - ... fail test # . ... do not run test # # ... comment # # # generators: # [0] ... default variant # [1] ... use cdf at mode and squeeze # [2] ... default variant but reinitialized with changed domain # [3] ... default variant but reinitialized with changed pdf parameters # #gen 0 1 2 3 # distribution #--------------------------------------------- x <0> + + + + # beta (1, 2) <1> + + + + # beta (1, 5) x <2> + + . . # beta (1, 100) <3> + + + . # beta (3, 4) x <4> + + . . # beta (5, 100) <5> + + . . # beta (500, 300) <6> + + + . # beta (5, 10, -3, 15) <23> + + + + # exponential () <24> + + + + # exponential (30, -5) <7> + + + + # cauchy () <8> + + + + # cauchy (1, 20) x <9> + + + + # gamma (1) <0> + + + + # gamma (2) <11> + + + . # gamma (3) <12> + + + . # gamma (10) x<13> + + . . # gamma (1000) <14> + + + . # gamma (5, 1000, 0) x<15> + + . . # gamma (5, 1e-05, 0) x<16> + + . . # gamma (5, 10, 100000) <25> + + + + # laplace () <26> + + + + # laplace (-10, 100) <17> + + + + # normal () x<18> + + . + # normal (1, 1e-05) <19> + + . . # normal (1, 1e+05) <20> + + + . # uniform () <21> + + . + # uniform (1, 20) <22> + . + + # cauchy () - truncated <27> + + . . # pdf with piecewise linear function as transformed density with T = -1/sqrt <28> + + . . # [27] with shifted mode ############################################################################# ############################################################################# [verbatim] /* pdf for normal distribution */ double pdf_normal( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return exp(-x*x/2.); } /* end of pdf_normal */ /* pdf that does not work */ double pdf_invalid( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return ((fabs(x)<0.001) ? 0. : exp(-x*x/2.)); } /* end of pdf_invalid */ /* pdf with piecewise linear function as transformed density with T = -1/sqrt */ double pdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y = 1./(fabs(x)+1.); return y*y; } double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y = 1./(fabs(x)+1.); y = 2.*y*y*y; return ((x<0.) ? y : - y); } double cdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { if (x<=0.) return 0.5/(1.-x); else return (1.-0.5/(1.+x)); } /* pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode */ double pdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y; x -= 1000.; y = 1./(fabs(x)+1.); return y*y; } double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y; x -= 1000.; y = 1./(fabs(x)+1.); y = 2.*y*y*y; return ((x<0.) ? y : - y); } double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { x -= 1000.; if (x<=0.) return 0.5/(1.-x); else return (1.-0.5/(1.+x)); } /* dummy function */ int unur_ssr_set_pedantic( struct unur_par *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) { return 1; } ############################################################################# unuran-1.11.0/tests/t_itdr.conf0000644001357500135600000005031214420445767013351 00000000000000############################################################################# [main] [main - data:] # method method: ITDR [main - header:] /* prototypes */ /* pdf of gamma density (a=1/2) */ double pdf_gamma12( double x, const UNUR_DISTR *distr ); double dpdf_gamma12( double x, const UNUR_DISTR *distr ); int unur_itdr_set_pedantic( struct unur_par *par, int pedantic ); \#define COMPARE_SAMPLE_SIZE (10000) \#define VIOLATE_SAMPLE_SIZE (20) /* \#define SEED (298346) */ ############################################################################# [new] [new - invalid NULL ptr: distr = NULL; ] ~( distr ); --> expected_NULL --> UNUR_ERR_NULL [new - invalid distribution type: distr = unur_distr_discr_new(); ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID [new - data missing in distribution object: distr = unur_distr_cont_new(); ] /* pdf, mode (pole) */ ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED [new - data missing in distribution object: distr = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr, pdf_gamma12); ] /* mode (pole) */ ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED ############################################################################# [set] [set - invalid NULL ptr: par = NULL; ] ~_verify( par, 1 ); --> expected_setfailed --> UNUR_ERR_NULL ~_xi(par,1.); --> expected_setfailed --> UNUR_ERR_NULL ~_cp(par, -0.5); --> expected_setfailed --> UNUR_ERR_NULL ~_ct(par, -0.5); --> expected_setfailed --> UNUR_ERR_NULL [set - invalid parameter object: double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_arou_new(distr); ] ~_verify( par, 1 ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_xi(par,1.); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_cp(par, -0.5); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_ct(par, -0.5); --> expected_setfailed --> UNUR_ERR_PAR_INVALID unur_par_free(par); [set - invalid parameters: double fpar[1] = {0.5}; distr = unur_distr_gamma(fpar,1); par = unur_itdr_new(distr); ] ~_xi(par,-1.); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_cp(par, 0.5); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_cp(par, -1.0); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_ct(par, 0.5); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_ct(par, -1.0); --> expected_setfailed --> UNUR_ERR_PAR_SET unur_par_free(par); ############################################################################# [get] [get - invalid NULL ptr: gen = NULL; ] ~_xi(gen) --> expected_INFINITY --> UNUR_ERR_NULL ~_cp(gen) --> expected_INFINITY --> UNUR_ERR_NULL ~_ct(gen) --> expected_INFINITY --> UNUR_ERR_NULL ~_area(gen) --> expected_INFINITY --> UNUR_ERR_NULL [get - invalid generator object: distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); gen = unur_init(par); <-- ! NULL ] ~_xi(gen) --> expected_INFINITY --> UNUR_ERR_GEN_INVALID ~_cp(gen) --> expected_INFINITY --> UNUR_ERR_GEN_INVALID ~_ct(gen) --> expected_INFINITY --> UNUR_ERR_GEN_INVALID ~_area(gen) --> expected_INFINITY --> UNUR_ERR_GEN_INVALID ############################################################################# [chg] [chg - invalid NULL ptr: gen = NULL; ] ~_verify( gen, 1 ); --> expected_setfailed --> UNUR_ERR_NULL [chg - invalid generator object: distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); gen = unur_init(par); <-- ! NULL ] ~_verify( gen, 1 ); --> expected_setfailed --> UNUR_ERR_GEN_INVALID ############################################################################# [init] [init - invalid NULL ptr: par = NULL; ] unur_init( par ); --> expected_NULL --> UNUR_ERR_NULL [init - data missing in distribution object: distr = unur_distr_cont_new(); par = NULL; ] /* dpdf, mode */ unur_distr_cont_set_pdf(distr,pdf_gamma12); par = unur_itdr_new( distr ); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED /* mode */ unur_distr_cont_set_dpdf(distr,dpdf_gamma12); par = unur_itdr_new( distr ); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED unur_distr_cont_set_mode(distr,0.); par = unur_itdr_new( distr ); --> expected_NULL --> UNUR_ERR_DISTR_PROP ############################################################################# [reinit] [reinit - does not exist: double fpm[] = { 0.8 }; distr = unur_distr_gamma(fpm,1); par = unur_itdr_new(distr); gen = unur_init( par ); <-- ! NULL ] unur_reinit( gen ); --> expected_reinit ############################################################################# [sample] [sample - compare: double fpm[] = { 0.8, 1., 1. }; distr = unur_distr_gamma(fpm,3); par = NULL; ] /* default algorithm */ par = unur_itdr_new(distr); -->compare_sequence_par_start /* default algorithm - verifying mode */ par = unur_itdr_new(distr); unur_itdr_set_verify(par,1); -->compare_sequence_par #..................................................................... [sample - compare: double xi, cp, ct; double fpm[] = { 0.8, 1., 1. }; distr = unur_distr_gamma(fpm,3); par = NULL; gen = NULL; ] /* default algorithm */ par = unur_itdr_new(distr); gen = unur_init(par); -->compare_sequence_gen_start /* set bx, ct and cp */ xi = unur_itdr_get_xi(gen); ct = unur_itdr_get_ct(gen); cp = unur_itdr_get_cp(gen); unur_free(gen); par = unur_itdr_new(distr); unur_itdr_set_xi(par,xi); unur_itdr_set_cp(par,cp); unur_itdr_set_ct(par,ct); gen = unur_init(par); -->compare_sequence_gen #..................................................................... [sample - compare: double xi, cp, ct; double fpm[] = { 0.3, 1., 1. }; distr = unur_distr_gamma(fpm,3); par = NULL; gen = NULL; ] /* default algorithm */ par = unur_itdr_new(distr); gen = unur_init(par); -->compare_sequence_gen_start /* set bx, ct and cp */ xi = unur_itdr_get_xi(gen); ct = unur_itdr_get_ct(gen); cp = unur_itdr_get_cp(gen); unur_free(gen); par = unur_itdr_new(distr); unur_itdr_set_xi(par,xi); unur_itdr_set_cp(par,cp); unur_itdr_set_ct(par,ct); gen = unur_init(par); -->compare_sequence_gen #..................................................................... [sample - compare: double xi, cp, ct; double fpm[] = { 3., 0.3, 1., 2. }; distr = unur_distr_beta(fpm,4); par = NULL; gen = NULL; ] /* default algorithm */ par = unur_itdr_new(distr); gen = unur_init(par); -->compare_sequence_gen_start /* set bx, ct and cp */ xi = unur_itdr_get_xi(gen); ct = unur_itdr_get_ct(gen); cp = unur_itdr_get_cp(gen); unur_free(gen); par = unur_itdr_new(distr); unur_itdr_set_xi(par,xi); unur_itdr_set_cp(par,cp); unur_itdr_set_ct(par,ct); gen = unur_init(par); -->compare_sequence_gen #..................................................................... [sample - compare clone: UNUR_GEN *clone; double fpm[] = { 0.3, 1., 1. }; distr = unur_distr_gamma(fpm,3); par = NULL; gen = NULL; ] /* original generator object */ par = unur_itdr_new(distr); gen = unur_init(par); -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen #..................................................................... [sample - compare reinit: double fpm[] = { 0.8 }; distr = unur_distr_gamma(fpm,1); par = NULL; gen = NULL; ] /* original generator object */ par = unur_itdr_new(distr); gen = unur_init(par); -->compare_sequence_gen_start /* reinit */ unur_reinit(gen); -->compare_sequence_gen #..................................................................... [sample - compare stringparser: double fpar[] = { 0.3, 1., 1. }; distr = NULL; par = NULL; gen = NULL; ] distr = unur_distr_gamma(fpar,3); par = unur_itdr_new(distr); unur_itdr_set_xi(par,1.3); unur_itdr_set_cp(par,-0.7); unur_itdr_set_ct(par,-0.3); unur_itdr_set_verify(par,TRUE); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "gamma(0.3,1.,1.) & \ method = itdr; xi = 1.3; cp = -0.7; ct = -0.3; verify" ); -->compare_sequence_gen ############################################################################# [validate] [validate - generators:] # default program par[0] = unur_itdr_new(@distr@); # set xi, cp, and ct for gamm(0.1) par[1] = unur_itdr_new(@distr@); unur_itdr_set_xi(par,0.1); unur_itdr_set_cp(par,-0.9); unur_itdr_set_ct(par,-0.54); # set xi, cp, and ct for gamm(0.5) par[2] = unur_itdr_new(@distr@); unur_itdr_set_xi(par,0.5); unur_itdr_set_cp(par,-0.5); unur_itdr_set_ct(par,-0.5); # default variant but reinitialized with changed domain { UNUR_DISTR *dg =NULL; par[3] = unur_itdr_new(@distr@); dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.2,0.99); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } # default variant but reinitialized with changed pdf parameters { UNUR_DISTR *dg =NULL; par[4] = unur_itdr_new(@distr@); fpm[0] = 0.5; fpm[1] = 4.; dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } [validate - distributions:] # Gamma distributions fpm[0] = 0.1; distr[0] = unur_distr_gamma(fpm,1); fpm[0] = 0.1; distr[1] = unur_distr_gamma_wo_logpdf(fpm,1); fpm[0] = 0.5; distr[2] = unur_distr_gamma(fpm,1); fpm[0] = 0.5; distr[3] = unur_distr_gamma_wo_logpdf(fpm,1); fpm[0] = 0.9; distr[4] = unur_distr_gamma(fpm,1); fpm[0] = 0.9; distr[5] = unur_distr_gamma_wo_logpdf(fpm,1); fpm[0] = 1.; distr[6] = unur_distr_gamma(fpm,1); fpm[0] = 1.; distr[7] = unur_distr_gamma_wo_logpdf(fpm,1); fpm[0] = 2.; distr[8] = unur_distr_gamma(fpm,1); fpm[0] = 2.; distr[9] = unur_distr_gamma_wo_logpdf(fpm,1); fpm[0] = 0.5; fpm[1] = 2.; fpm[2] = 1.; distr[10] = unur_distr_gamma(fpm,3); fpm[0] = 0.5; fpm[1] = 2.; fpm[2] = 1.; distr[11] = unur_distr_gamma_wo_logpdf(fpm,3); fpm[0] = 0.5; fpm[1] = 2.; fpm[2] = -1.; distr[12] = unur_distr_gamma(fpm,3); fpm[0] = 0.5; fpm[1] = 2.; fpm[2] = -1.; distr[13] = unur_distr_gamma_wo_logpdf(fpm,3); fpm[0] = 0.5; fpm[1] = 1.; fpm[2] = 1.; distr[14] = unur_distr_gamma(fpm,3); unur_distr_cont_set_domain(distr[14],1.,1.1); fpm[0] = 0.5; fpm[1] = 1.; fpm[2] = 1.; distr[15] = unur_distr_gamma_wo_logpdf(fpm,3); unur_distr_cont_set_domain(distr[15],1.,1.1); fpm[0] = 0.5; fpm[1] = 1.; fpm[2] = 1.; distr[16] = unur_distr_gamma(fpm,3); unur_distr_cont_set_domain(distr[16],1.,2.); fpm[0] = 0.5; fpm[1] = 1.; fpm[2] = 1.; distr[17] = unur_distr_gamma_wo_logpdf(fpm,3); unur_distr_cont_set_domain(distr[17],1.,2.); fpm[0] = 0.5; fpm[1] = 1.; fpm[2] = 1.; distr[18] = unur_distr_gamma(fpm,3); unur_distr_cont_set_domain(distr[18],1.,4.); fpm[0] = 0.5; fpm[1] = 1.; fpm[2] = 1.; distr[19] = unur_distr_gamma_wo_logpdf(fpm,3); unur_distr_cont_set_domain(distr[19],1.,4.); fpm[0] = 1.5; distr[48] = unur_distr_gamma(fpm,1); unur_distr_cont_set_domain(distr[48],1.,UNUR_INFINITY); fpm[0] = 1.5; distr[49] = unur_distr_gamma_wo_logpdf(fpm,1); unur_distr_cont_set_domain(distr[49],1.,UNUR_INFINITY); # Normal distributions distr[20] = unur_distr_normal(NULL,0); distr[21] = unur_distr_normal_wo_logpdf(NULL,0); distr[22] = unur_distr_normal(NULL,0); unur_distr_cont_set_domain(distr[22],0.,UNUR_INFINITY); distr[23] = unur_distr_normal_wo_logpdf(NULL,0); unur_distr_cont_set_domain(distr[23],0.,UNUR_INFINITY); distr[24] = unur_distr_normal(NULL,0); unur_distr_cont_set_domain(distr[24],0.,4.); distr[25] = unur_distr_normal_wo_logpdf(NULL,0); unur_distr_cont_set_domain(distr[25],0.,4.); distr[26] = unur_distr_normal(NULL,0); unur_distr_cont_set_domain(distr[26],1.,4.); distr[27] = unur_distr_normal_wo_logpdf(NULL,0); unur_distr_cont_set_domain(distr[27],1.,4.); distr[28] = unur_distr_normal(NULL,0); unur_distr_cont_set_domain(distr[28],-0.5,4.); unur_distr_cont_set_mode(distr[28],-0.5); distr[29] = unur_distr_normal_wo_logpdf(NULL,0); unur_distr_cont_set_domain(distr[29],-0.5,4.); unur_distr_cont_set_mode(distr[29],-0.5); # Cauchy distributions distr[30] = unur_distr_cauchy(NULL,0); distr[31] = unur_distr_cauchy_wo_logpdf(NULL,0); distr[32] = unur_distr_cauchy(NULL,0); unur_distr_cont_set_domain(distr[32],0.,UNUR_INFINITY); distr[33] = unur_distr_cauchy_wo_logpdf(NULL,0); unur_distr_cont_set_domain(distr[33],0.,UNUR_INFINITY); distr[34] = unur_distr_cauchy(NULL,0); unur_distr_cont_set_domain(distr[34],0.,4.); distr[35] = unur_distr_cauchy_wo_logpdf(NULL,0); unur_distr_cont_set_domain(distr[35],0.,4.); distr[36] = unur_distr_cauchy(NULL,0); unur_distr_cont_set_domain(distr[36],1.,4.); distr[37] = unur_distr_cauchy_wo_logpdf(NULL,0); unur_distr_cont_set_domain(distr[37],1.,4.); distr[38] = unur_distr_cauchy(NULL,0); unur_distr_cont_set_domain(distr[38],-0.5,4.); unur_distr_cont_set_mode(distr[38],-0.5); distr[39] = unur_distr_cauchy_wo_logpdf(NULL,0); unur_distr_cont_set_domain(distr[39],-0.5,4.); unur_distr_cont_set_mode(distr[39],-0.5); # Beta distributions fpm[0] = 0.5; fpm[1] = 3.; distr[40] = unur_distr_beta(fpm,2); fpm[0] = 0.5; fpm[1] = 3.; distr[41] = unur_distr_beta_wo_logpdf(fpm,2); fpm[0] = 0.5; fpm[1] = 3.; fpm[2] = 1.; fpm[3] = 2.; distr[42] = unur_distr_beta(fpm,4); fpm[0] = 0.5; fpm[1] = 3.; fpm[2] = 1.; fpm[3] = 2.; distr[43] = unur_distr_beta_wo_logpdf(fpm,4); fpm[0] = 3.; fpm[1] = 0.5; fpm[2] = -1.; fpm[3] = 0.; distr[44] = unur_distr_beta(fpm,4); fpm[0] = 3.; fpm[1] = 0.5; fpm[2] = -1.; fpm[3] = 0.; distr[45] = unur_distr_beta_wo_logpdf(fpm,4); fpm[0] = 3.; fpm[1] = 0.5; distr[46] = unur_distr_beta(fpm,2); fpm[0] = 3.; fpm[1] = 0.5; distr[47] = unur_distr_beta_wo_logpdf(fpm,2); # F distributions fpm[0] = 1.; fpm[1] = 5.; distr[50] = unur_distr_F(fpm,2); fpm[0] = 1.99; fpm[1] = 5.; distr[51] = unur_distr_F(fpm,2); fpm[0] = 0.1; fpm[1] = 5.; distr[52] = unur_distr_F(fpm,2); # number of distributions: 53 [validate - test chi2:] # + ... pass test # 0 ... fail to initialize generator # - ... fail test # . ... do not run test # # ... comment # # generators: # [0] ... default # [1] ... set xi, cp, and ct for gamm(0.1) # [2] ... set xi, cp, and ct for gamm(0.5) # [3] ... default variant but reinitialized with changed domain (0.2,0.99) # [4] ... default variant but reinitialized with changed pdf parameters (0.5, 4.) # #gen 0 1 2 3 4 # distribution #--------------------------------------------- <0> + + . + + # gamma(0.1) <2> + . + + + # gamma(0.5) <4> + . . + + # gamma(0.9) <6> + . . + + # gamma(1.) <8> 0 . . . . # gamma(2.) <10> + . . - + # gamma(0.5,2.,1.) <12> + . . + + # gamma(0.5,2.,-1.) <14> + . . - + # gamma(0.5,1.,1.), domain=(1.,1.1) <16> + . . - + # gamma(0.5,1.,1.), domain=(1.,2.) <18> + . . - + # gamma(0.5,1.,1.), domain=(1.,4.) <48> + . . - + # gamma(1.5), domain=(1.,inf) <1> + + . + + # gamma(0.1), w/o logpdf <3> + . + + + # gamma(0.5), w/o logpdf <5> + . . + + # gamma(0.9), w/o logpdf <7> + . . + + # gamma(1.), w/o logpdf <9> 0 . . . . # gamma(2.), w/o logpdf <11> + . . - + # gamma(0.5,2.,1.), w/o logpdf <13> + . . + + # gamma(0.5,2.,-1.), w/o logpdf <15> + . . - + # gamma(0.5,1.,1.), domain=(1.,1.1), w/o logpdf <17> + . . - + # gamma(0.5,1.,1.), domain=(1.,2.), w/o logpdf <19> + . . - + # gamma(0.5,1.,1.), domain=(1.,4.), w/o logpdf <49> + . . - + # gamma(1.5), domain=(1.,inf), w/o logpdf <20> 0 . . . . # normal() <22> + . . + - # normal(), domain=(0.,inf) <24> + . . + - # normal(), domain=(0.,4.) <26> + . . + + # normal(), domain=(1.,4.) <28> 0 . . . . # normal(), domain=(-0.5,4.) <21> 0 . . . . # normal(), w/o logpdf <23> + . . + - # normal(), domain=(0.,inf), w/o logpdf <25> + . . + - # normal(), domain=(0.,4.), w/o logpdf <27> + . . + + # normal(), domain=(1.,4.), w/o logpdf <29> 0 . . . . # normal(), domain=(-0.5,4.), w/o logpdf <30> 0 . . . . # cauchy() <32> + . . + - # cauchy(), domain=(0.,inf) <34> + . . + - # cauchy(), domain=(0.,4.) <36> + . . + + # cauchy(), domain=(1.,4.) <38> 0 . . . . # cauchy(), domain=(-0.5,4.) <31> 0 . . . . # cauchy(), w/o logpdf <33> + . . + - # cauchy(), domain=(0.,inf), w/o logpdf <35> + . . + - # cauchy(), domain=(0.,4.), w/o logpdf <37> + . . + + # cauchy(), domain=(1.,4.), w/o logpdf <39> 0 . . . . # cauchy(), domain=(-0.5,4.), w/o logpdf <40> + . . + + # beta(0.5,3.) <42> + . . - + # beta(0.5,3.; 1.,2.) <44> + . . - + # beta(3.,0.5; -1.,0.) <46> + . . + + # beta(3.,0.5) <41> + . . + + # beta(0.5,3.), w/o logpdf <43> + . . - + # beta(0.5,3.; 1.,2.), w/o logpdf <45> + . . - + # beta(3.,0.5; -1.,0.), w/o logpdf <47> + . . + + # beta(3.,0.5), w/o logpdf <50> + . . + + # F (1,5) <51> + . . + + # F (1.99,5) <52> + . . + + # F (0.1,5) [validate - verify hat:] # + ... pass test # ~ ... fail in at most 1% of samples # 0 ... fail to initialize generator # - ... fail test # . ... do not run test # # ... comment # # generators: # [0] ... default # [1] ... set xi, cp, and ct for gamm(0.1) # [2] ... set xi, cp, and ct for gamm(0.5) # [3] ... default variant but reinitialized with changed domain (0.2,0.99) # [4] ... default variant but reinitialized with changed pdf parameters (0.5, 4.) # #gen 0 1 2 3 4 # distribution #--------------------------------------------- <0> + + . + + # gamma(0.1) <2> + . + + + # gamma(0.5) <4> + . . + + # gamma(0.9) <6> + . . + + # gamma(1.) <8> 0 . . . . # gamma(2.) <10> + . . - + # gamma(0.5,2.,1.) <12> + . . + + # gamma(0.5,2.,-1.) <14> + . . - + # gamma(0.5,1.,1.), domain=(1.,1.1) <16> + . . - + # gamma(0.5,1.,1.), domain=(1.,2.) <18> + . . - + # gamma(0.5,1.,1.), domain=(1.,4.) <48> + . . - + # gamma(1.5), domain=(1.,inf) <1> + + . + + # gamma(0.1), w/o logpdf <3> + . + + + # gamma(0.5), w/o logpdf <5> + . . + + # gamma(0.9), w/o logpdf <7> + . . + + # gamma(1.), w/o logpdf <9> 0 . . . . # gamma(2.), w/o logpdf <11> + . . - + # gamma(0.5,2.,1.), w/o logpdf <13> + . . + + # gamma(0.5,2.,-1.), w/o logpdf <15> + . . - + # gamma(0.5,1.,1.), domain=(1.,1.1), w/o logpdf <17> + . . - + # gamma(0.5,1.,1.), domain=(1.,2.), w/o logpdf <19> + . . - + # gamma(0.5,1.,1.), domain=(1.,4.), w/o logpdf <49> + . . - + # gamma(1.5), domain=(1.,inf), w/o logpdf <20> 0 . . . . # normal() <22> + . . + - # normal(), domain=(0.,inf) <24> + . . + - # normal(), domain=(0.,4.) <26> + . . + + # normal(), domain=(1.,4.) <28> 0 . . . . # normal(), domain=(-0.5,4.) <21> 0 . . . . # normal(), w/o logpdf <23> + . . + - # normal(), domain=(0.,inf), w/o logpdf <25> + . . + - # normal(), domain=(0.,4.), w/o logpdf <27> + . . + + # normal(), domain=(1.,4.), w/o logpdf <29> 0 . . . . # normal(), domain=(-0.5,4.), w/o logpdf <30> 0 . . . . # cauchy() <32> + . . + - # cauchy(), domain=(0.,inf) <34> + . . + - # cauchy(), domain=(0.,4.) <36> + . . + + # cauchy(), domain=(1.,4.) <38> 0 . . . . # cauchy(), domain=(-0.5,4.) <31> 0 . . . . # cauchy(), w/o logpdf <33> + . . + - # cauchy(), domain=(0.,inf), w/o logpdf <35> + . . + - # cauchy(), domain=(0.,4.), w/o logpdf <37> + . . + + # cauchy(), domain=(1.,4.), w/o logpdf <39> 0 . . . . # cauchy(), domain=(-0.5,4.), w/o logpdf <40> + . . + + # beta(0.5,3.) <42> + . . - + # beta(0.5,3.; 1.,2.) <44> + . . - + # beta(3.,0.5; -1.,0.) <46> + . . + + # beta(3.,0.5) <41> + . . + + # beta(0.5,3.), w/o logpdf <43> + . . - + # beta(0.5,3.; 1.,2.), w/o logpdf <45> + . . - + # beta(3.,0.5; -1.,0.), w/o logpdf <47> + . . + + # beta(3.,0.5), w/o logpdf <50> + . . + + # F (1,5) <51> + . . + + # F (1.99,5) <52> + . . + + # F (0.1,5) ############################################################################# ############################################################################# [verbatim] /* pdf of gamma density (a=1/2) */ double pdf_gamma12( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return exp(-x)/sqrt(x); } double dpdf_gamma12( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return -exp(-x)/sqrt(x) * (1.+1./(2.*x)); } /* dummy function */ int unur_itdr_set_pedantic( struct unur_par *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) { return 1; } ############################################################################# unuran-1.11.0/tests/t_unur_error.conf0000644001357500135600000000747614420445767014626 00000000000000############################################################################# [main] [main - data:] # method (for information only: the program scans the file name) method: ERROR [main - header:] /* prototypes */ void my_error_handler( const char *objid, const char *file, int line, const char *errortype, int errorcode, const char *reason ); \#define COMPARE_SAMPLE_SIZE (500) \#define VIOLATE_SAMPLE_SIZE (20) ############################################################################# [new] ############################################################################# # [set] ############################################################################# # [get] ############################################################################# # [chg] ############################################################################# # [init] ############################################################################# # [reinit] ############################################################################# # [sample] ############################################################################# # [validate] ############################################################################# [special] [special - decl:] GCC_DIAG_OFF(unused-but-set-variable) double fpm[2] = {0., -1.}; UNUR_DISTR *distr = NULL; UNUR_ERROR_HANDLER *default_error_handler = NULL; [special - start:] /* invoke default error handler */ distr = unur_distr_normal(fpm,2); /* change error handler */ default_error_handler = unur_set_error_handler( my_error_handler ); distr = unur_distr_normal(fpm,2); /* change to old error handler */ default_error_handler = unur_set_error_handler( default_error_handler ); distr = unur_distr_normal(fpm,2); /* change to new error handler again */ default_error_handler = unur_set_error_handler( default_error_handler ); distr = unur_distr_normal(fpm,2); /* change to default error handler */ default_error_handler = unur_set_error_handler( NULL ); distr = unur_distr_normal(fpm,2); /* switch off error reporting */ default_error_handler = unur_set_error_handler_off(); distr = unur_distr_normal(fpm,2); /* change to old error handler */ default_error_handler = unur_set_error_handler( default_error_handler ); distr = unur_distr_normal(fpm,2); /* test finished */ FAILED = 0; GCC_DIAG_ON(unused-but-set-variable) ############################################################################# [verbatim] void my_error_handler( const char *objid, const char *file, int line, const char *errortype, int errorcode, const char *reason ) /*----------------------------------------------------------------------*/ /* parameters: */ /* objid ... id/type of object */ /* file ... file name (inserted by __FILE__) */ /* line ... line number in source file (inserted by __LINE__) */ /* errortype ... "warning" or "error" */ /* errorcode ... UNU.RAN error code */ /* reason ... (very) short description of reason for error */ /*----------------------------------------------------------------------*/ { FILE *LOG = UNURANLOG; static int n = 0; fprintf(LOG,"\n"); fprintf(LOG,"[[ %d ]] my_error_handler: [ %s ]\n",++n,errortype); fprintf(LOG,"\tobject = %s\n",objid); fprintf(LOG,"\tfile = %s\n",file); fprintf(LOG,"\tline = %d\n",line); fprintf(LOG,"\tcode = [%\#x] %s\n",errorcode,unur_get_strerror(errorcode)); fprintf(LOG,"\treason = %s\n",reason); fprintf(LOG,"\n"); } /* end of my_error_handler() */ ############################################################################# unuran-1.11.0/tests/test_functionparser.c0000644001357500135600000002355414420445767015472 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: test_functionparser * * * * Compare evaluation result of function parser with those of * * Mathematica(TM) * * * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* #define DEBUG 1 */ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include #include /* macros and functions for handling floats */ #include #include /*---------------------------------------------------------------------------*/ /* name of data file */ static const char datafile[] = "t_functionparser.data"; /* number of failed tests */ static int n_failed = 0; /* file handles */ FILE *DATA; /* file with data */ FILE *UNURANLOG; /* unuran log file */ FILE *TESTLOG; /* test log file */ /*---------------------------------------------------------------------------*/ static int _unur_test_function (void); /*---------------------------------------------------------------------------*/ int main(void) { /* open log file for unuran and set output stream for unuran messages */ if ( (UNURANLOG = fopen( "t_functionparser_unuran.log","w" )) == NULL ) exit (EXIT_FAILURE); unur_set_stream( UNURANLOG ); /* open log file for testing */ if ( (TESTLOG = fopen( "t_functionparser_test.log","w" )) == NULL ) exit (EXIT_FAILURE); /* write header into log file */ { time_t started; fprintf(TESTLOG,"\nUNU.RAN - Universal Non-Uniform RANdom number generator\n\n"); if (time( &started ) != -1) fprintf(TESTLOG,"%s",ctime(&started)); fprintf(TESTLOG,"\n=======================================================\n\n"); /* fprintf(TESTLOG,"(Search for string \"data\" to find new section.)\n\n"); */ } /* open data file */ if ( (DATA = fopen( datafile,"r" )) == NULL ) { printf("ERROR: could not open file %s \n", datafile); fprintf(TESTLOG,"ERROR: could not open file %s \n", datafile); exit (77); /* ignore this error */ } while (_unur_test_function()==TRUE); /* close files */ fclose (UNURANLOG); fclose (TESTLOG); fclose (DATA); /* end */ if (n_failed > 0) { printf("[function parser --> failed]\n"); exit (EXIT_FAILURE); } else { printf("[function parser --> ok]\n"); exit (EXIT_SUCCESS); } } /* end of main() */ /*---------------------------------------------------------------------------*/ int _unur_test_function (void) { #define BUFSIZE 1024 /* size of line buffer */ char buffer[BUFSIZE]; /* buffer for reading line */ char *ptr_buffer; /* pointer into buffer */ char fstr[BUFSIZE]; /* function string */ double x; /* argument x */ double fx_exp, dfx_exp; /* expected values for f(x) and f'(x) */ double fx_obs, dfx_obs; /* observed values for f(x) and f'(x) */ double fx_rep, dfx_rep; /* observed values for f(x) and f'(x) for reparsed string */ double diff; char *repstr = NULL; /* string generated from parsed tree */ UNUR_DISTR *distr, *rep; int failed = 0; /* find next function string */ while (1) { /* read next line */ fgets(buffer, BUFSIZE, DATA); if (feof(DATA)) return FALSE; if (strncmp(buffer,"function=",8)==0) break; } /* get function string */ strcpy( fstr, buffer+9 ); /* remove newline character */ fstr[strlen(fstr)-1] = '\0'; /* print info into log file */ fprintf(TESTLOG,"function = \"%s\"\n", fstr); /* make distribution object with given function as PDF */ distr = unur_distr_cont_new(); if (unur_distr_cont_set_pdfstr(distr,fstr)!=UNUR_SUCCESS) { printf("ERROR: syntax error in \"%s\"\n", fstr); fprintf(TESTLOG,"ERROR: syntax error in \"%s\"\n", fstr); exit (EXIT_FAILURE); } /* reparse function string and make duplicate distribution object */ repstr = unur_distr_cont_get_pdfstr(distr); fprintf(TESTLOG,"parsed = \"%s\"\n", repstr); rep = unur_distr_cont_new(); if (unur_distr_cont_set_pdfstr(rep,repstr)!=UNUR_SUCCESS) { printf("ERROR: syntax error in \"%s\"\n", repstr); fprintf(TESTLOG,"ERROR: syntax error in reparsed string \"%s\"\n", repstr); exit (EXIT_FAILURE); } /* read all the data */ while (1) { /* read next line */ fgets(buffer, BUFSIZE, DATA); if (feof(DATA)) break; /* stop if blank line */ if (isspace(buffer[0])) break; /* read x and expected values for f(x) and f'(x) */ ptr_buffer = buffer; x = strtod( ptr_buffer, &ptr_buffer ); fx_exp = strtod( ptr_buffer, &ptr_buffer ); dfx_exp = strtod( ptr_buffer, &ptr_buffer ); /* compute function values for function tree */ fx_obs = unur_distr_cont_eval_pdf(x,distr); dfx_obs = unur_distr_cont_eval_dpdf(x,distr); /* compute function values for reparsed function tree */ fx_rep = unur_distr_cont_eval_pdf(x,rep); dfx_rep = unur_distr_cont_eval_dpdf(x,rep); /* compare */ if (!(_unur_FP_approx(fx_exp,fx_obs))) { ++failed; diff = fx_obs - fx_exp; fprintf(TESTLOG,"[fx]\tx = %g:\t(exp) = %g\t(obs) = %g\tdiff = %g --> error\n", x,fx_exp,fx_obs,diff); } if (!(_unur_FP_approx(fx_obs,fx_rep))) { ++failed; diff = fx_rep - fx_obs; fprintf(TESTLOG,"[fx]\tx = %g:\t(obs) = %g\t(rep) = %g\tdiff = %g --> error\n", x,fx_obs,fx_rep,diff); } if (!(_unur_FP_approx(dfx_exp,dfx_obs))) { ++failed; diff = dfx_obs - dfx_exp; fprintf(TESTLOG,"[dfx]\tx = %g:\t(exp) = %g\t(obs) = %g\tdiff = %g --> error\n", x,dfx_exp,dfx_obs,diff); } if (!(_unur_FP_approx(dfx_obs,dfx_rep))) { ++failed; diff = dfx_rep - dfx_obs; fprintf(TESTLOG,"[dfx]\tx = %g:\t(obs) = %g\t(rep) = %g\tdiff = %g --> error\n", x,dfx_obs,dfx_rep,diff); } } /* free memory */ unur_distr_free(distr); unur_distr_free(rep); if (repstr) free(repstr); /* write result */ if (failed) { fprintf(TESTLOG,"\t--> FAILED\n\n"); ++n_failed; } else { fprintf(TESTLOG,"\t--> OK\n\n"); } return TRUE; #undef BUFSIZE } /* end of _unur_test_function() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/tests/t_tdr_gw.conf0000644001357500135600000002677414420445767013714 00000000000000############################################################################# [main] [main - data:] # method method: TDR [main - header:] /* prototypes */ double pdf_sqrtlin( double x, const UNUR_DISTR *distr ); double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ); double cdf_sqrtlin( double x, const UNUR_DISTR *distr ); double pdf_sqrtlinshft(double x, const UNUR_DISTR *distr ); double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); \#define COMPARE_SAMPLE_SIZE (10000) \#define VIOLATE_SAMPLE_SIZE (20) ############################################################################# [new] ############################################################################# # [set] ############################################################################# # [get] ############################################################################# # [chg] ############################################################################# # [init] ############################################################################# # [reinit] ############################################################################# [validate] [validate - generators:] # sqrt, GW par[0] = unur_tdr_new(@distr@); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); # sqrt, GW, few starting points, ARS par[1] = unur_tdr_new(@distr@); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); # sqrt, GW, few construction points par[2] = unur_tdr_new(@distr@); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); # sqrt, GW, truncated par[3] = unur_tdr_new(@distr@); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_chg_truncated(gen,0.5,0.9); # log, GW par[4] = unur_tdr_new(@distr@); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); # log, GW, few starting points, ARS par[5] = unur_tdr_new(@distr@); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); # log, GW, few construction points par[6] = unur_tdr_new(@distr@); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); # reinit, sqrt, GW par[7] = unur_tdr_new(@distr@); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(@distr@,fpm,2); unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); # reinit, log, GW par[8] = unur_tdr_new(@distr@); unur_tdr_set_variant_gw(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,20,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(@distr@,fpm,2); unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); [validate - distributions:] # Beta distributions fpm[0] = 1.; fpm[1] = 2.; distr[0] = unur_distr_beta(fpm,2); fpm[0] = 1.; fpm[1] = 5.; distr[1] = unur_distr_beta(fpm,2); fpm[0] = 1.; fpm[1] = 100.; distr[2] = unur_distr_beta(fpm,2); fpm[0] = 2.; fpm[1] = 5.; distr[30] = unur_distr_beta(fpm,2); fpm[0] = 5.; fpm[1] = 2.; distr[31] = unur_distr_beta(fpm,2); fpm[0] = 3.; fpm[1] = 4.; distr[3] = unur_distr_beta(fpm,2); fpm[0] = 5.; fpm[1] = 100.; distr[4] = unur_distr_beta(fpm,2); fpm[0] = 500.; fpm[1] = 300.; distr[5] = unur_distr_beta(fpm,2); fpm[0] = 5.; fpm[1] = 10.; fpm[2] = -3.; fpm[3] = 15.; distr[6] = unur_distr_beta(fpm,4); # Cauchy distributions distr[7] = unur_distr_cauchy(NULL,0); fpm[0] = 1.; fpm[1] = 20.; distr[8] = unur_distr_cauchy(fpm,2); # Exponential distributions distr[24] = unur_distr_exponential(NULL,0); fpm[0] = 30.; fpm[1] = -5.; distr[25] = unur_distr_exponential(fpm,2); # Gamma distributions fpm[0] = 1.; distr[9] = unur_distr_gamma(fpm,1); fpm[0] = 2.; distr[10] = unur_distr_gamma(fpm,1); fpm[0] = 3.; distr[11] = unur_distr_gamma(fpm,1); fpm[0] = 10.; distr[12] = unur_distr_gamma(fpm,1); fpm[0] = 1000.; distr[13] = unur_distr_gamma(fpm,1); fpm[0] = 5.; fpm[1] = 1000.; distr[14] = unur_distr_gamma(fpm,2); fpm[0] = 5.; fpm[1] = 1.e-5; distr[15] = unur_distr_gamma(fpm,2); fpm[0] = 5.; fpm[1] = 10.; fpm[2] = 1000.; distr[16] = unur_distr_gamma(fpm,3); # Laplace distributions distr[26] = unur_distr_laplace(NULL,0); fpm[0] = -10.; fpm[1] = 100.; distr[27] = unur_distr_laplace(fpm,2); # Normal distributions distr[17] = unur_distr_normal(NULL,0); fpm[0] = 1.; fpm[1] = 1.e-5; distr[18] = unur_distr_normal(fpm,2); fpm[0] = 0.; fpm[1] = 1.e+5; distr[19] = unur_distr_normal(fpm,2); # Uniform distributions distr[20] = unur_distr_uniform(NULL,0); fpm[0] = 1.; fpm[1] = 20.; distr[21] = unur_distr_uniform(fpm,2); # pdf with piecewise linear function as transformed density with T = -1/sqrt distr[28] = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr[28],pdf_sqrtlin); unur_distr_cont_set_dpdf(distr[28],dpdf_sqrtlin); unur_distr_cont_set_cdf(distr[28],cdf_sqrtlin); unur_distr_set_name(distr[28],"sqrtlin"); # pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode distr[29] = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr[29],pdf_sqrtlinshft); unur_distr_cont_set_dpdf(distr[29],dpdf_sqrtlinshft); unur_distr_cont_set_cdf(distr[29],cdf_sqrtlinshft); unur_distr_set_name(distr[29],"sqrtlin"); # truncated distributions distr[22] = unur_distr_cauchy(NULL,0); unur_distr_cont_set_domain(distr[22],0.1,1.); unur_distr_cont_upd_mode(distr[22]); unur_distr_cont_upd_pdfarea(distr[22]); # domain exceeds support of pdf fpm[0] = 3.; fpm[1] = 4.; distr[23] = unur_distr_beta(fpm,2); unur_distr_cont_set_domain(distr[23],-2.,5.); # number of distributions: 32 [validate - test chi2:] # + ... pass test # 0 ... fail to initialize generator # - ... fail test # . ... do not run test # # ... comment # # generators: # [0] sqrt, GW # [1] sqrt, GW, few starting points, ARS # [2] sqrt, GW, few construction points # [3] sqrt, GW, truncated # [4] log, GW # [5] log, GW, few starting points, ARS # [6] log, GW, few construction points # [7] reinit, log, GW # [8] reinit, sqrt, GW # # # 0 1 2 3 4 5 6 7 8 # distribution #----------------------------------------------------- x <0> + + + + + + + + + # beta (1, 2) <1> + + + + + + + . . # beta (1, 5) x <2> + + + + + + + + + # beta (1, 100) <30> + + + + + + + . . # beta (2, 5) <31> + + + + + + + + + # beta (5, 2) <3> + + + + + + + . . # beta (3, 4) <4> + + + + + + + . . # beta (5, 100) <5> + + + + + + + + + # beta (500, 300) <6> + + + + + + + + + # beta (5, 10, -3, 15) <7> + + + + 0 - - + 0 # cauchy () <8> + + + + 0 - - + 0 # cauchy (1, 20) <24> + + + + + + + + + # exponential () <25> + + + + + + + + + # exponential (30, -5) x <9> + + + + + + + . . # gamma (1) <10> + + + + + + + . . # gamma (2) <11> + + + + + + + + + # gamma (3) <12> + + + x+ + + + . . # gamma (10) x<13> + + + . + + + . . # gamma (1000) <14> + + + . + + + . . # gamma (5, 1000, 0) x<15> + + + . + + + . . # gamma (5, 1e-05, 0) x<16> + + + . + + + . . # gamma (5, 10, 1000) <26> + + + + + + + + + # laplace () <27> + + + + + + + . . # laplace (-10, 100) <17> + + + + + + + + + # normal () x<18> + + + + + + + + + # normal (1, 1e-05) <19> + + + + + + + + + # normal (1, 1e+05) <20> + + + + + + + + + # uniform () <21> + + + + + + + . . # uniform (1, 20) <22> + + + + + + + . . # cauchy () - truncated <23> + + + + + + + . . # beta () - domain superset of support <28> + + + + 0 0 0 . . # sqrtlin <29> + + + + 0 0 0 . . # sqrtlin with shifted mode # sqrtlin ... pdf with piecewise linear function as # transformed density with T = -1/sqrt [validate - verify hat:] # + ... pass test # ~ ... fail in at most 1% of samples # 0 ... fail to initialize generator # - ... fail test # . ... do not run test # # ... comment # # generators: # [0] sqrt, GW # [1] sqrt, GW, few starting points, ARS # [2] sqrt, GW, few construction points # [3] sqrt, GW, truncated # [4] log, GW # [5] log, GW, few starting points, ARS # [6] log, GW, few construction points # [7] reinit, log, GW # [8] reinit, sqrt, GW # # # 0 1 2 3 4 5 6 7 8 # distribution #----------------------------------------------------- x <0> + + + + + + + + + # beta (1, 2) <1> + + + + + + + . . # beta (1, 5) x <2> + + + + + + + + + # beta (1, 100) <30> + + + + + + + . . # beta (2, 5) <31> + + + + + + + + + # beta (5, 2) <3> + + + + + + + . . # beta (3, 4) <4> + + + + + + + . . # beta (5, 100) <5> + + + + + + + + + # beta (500,300) <6> + + + + + + + + + # beta (5, 10, -3, 15) <7> + + + + 0 - - + 0 # cauchy () <8> + + + + 0 - - + 0 # cauchy (1, 20) <24> + + + + + + + + + # exponential () <25> + + + + + + + + + # exponential (30, -5) x <9> + + + + + + + . . # gamma (1) <10> + + + + + + + . . # gamma (2) <11> + + + + + + + + + # gamma (3) <12> + + + x+ + + + + + # gamma (10) x<13> + + + . + + + . . # gamma (1000) <14> + + + . + + + . . # gamma (5, 1000, 0) x<15> + + + . + + + . . # gamma (5, 1e-05, 0) x<16> + + + . + + + . . # gamma (5, 10, 100000) <26> + + + + + + + + + # laplace () <27> + + + + + + + . . # laplace (-10, 100) <17> + + + + + + + + + # normal () x<18> + + + + + + + + + # normal (1, 1e-05) <19> + + + + + + x+ + + # normal (1, 1e+05) <20> + + + + + + + + + # uniform () <21> + + + + + + + . . # uniform (1, 20) <22> + + + + + + + . . # cauchy () - truncated <23> + + + + + + + . . # beta () - domain superset of support x<28> + + + + 0 0 0 . . # sqrtlin <29> . . . . . . . . . # sqrtlin with shifted mode # sqrtlin ... pdf with piecewise linear function as # transformed density with T = -1/sqrt ############################################################################# ############################################################################# [verbatim] /* pdf with piecewise linear function as transformed density with T = -1/sqrt */ double pdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y = 1./(fabs(x)+1.); return y*y; } double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y = 1./(fabs(x)+1.); y = 2.*y*y*y; return ((x<0.) ? y : - y); } double cdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { if (x<=0.) return 0.5/(1.-x); else return (1.-0.5/(1.+x)); } /* pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode */ double pdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y; x -= 1000.; y = 1./(fabs(x)+1.); return y*y; } double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y; x -= 1000.; y = 1./(fabs(x)+1.); y = 2.*y*y*y; return ((x<0.) ? y : - y); } double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { x -= 1000.; if (x<=0.) return 0.5/(1.-x); else return (1.-0.5/(1.+x)); } ############################################################################# unuran-1.11.0/tests/t_mcorr.conf0000644001357500135600000001435214420445767013535 00000000000000############################################################################# [main] [main - data:] # method (for information only: the program scans the file name) method: MCORR [main - header:] /* prototypes */ \#define COMPARE_SAMPLE_SIZE (10000) \#define VIOLATE_SAMPLE_SIZE (20) \#include \#include int mcorr_eigenvalues_test(int dim); ############################################################################# [new] [new - invalid NULL ptr: distr = NULL; ] ~( distr ); --> expected_NULL --> UNUR_ERR_NULL [new - invalid distribution type: distr = unur_distr_discr_new(); ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID ############################################################################# [set] [set - invalid NULL ptr: double *eigenvalues = NULL; par = NULL; ] ~_eigenvalues( par, eigenvalues ) --> expected_setfailed --> UNUR_ERR_NULL [set - invalid NULL ptr: double *eigenvalues = NULL; distr = unur_distr_correlation(4); par = unur_mcorr_new(distr); ] ~_eigenvalues( par, eigenvalues ) --> expected_setfailed --> UNUR_ERR_NULL unur_par_free(par); [set - invalid parameter object: double eigenvalues[] = {1,2,3}; distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); ] ~_eigenvalues( par, eigenvalues ) --> expected_setfailed --> UNUR_ERR_PAR_INVALID unur_par_free(par); [set - invalid parameters: double eigenvalues[] = {1,-2,3}; distr = unur_distr_correlation(4); par = unur_mcorr_new(distr); ] ~_eigenvalues( par, eigenvalues ) --> expected_setfailed --> UNUR_ERR_PAR_SET unur_par_free(par); ############################################################################# # [get] ############################################################################# # [chg] ############################################################################# [init] [init - invalid NULL ptr: par = NULL; ] unur_init( par ); --> expected_NULL --> UNUR_ERR_NULL ############################################################################# [reinit] [reinit - exists: distr = unur_distr_correlation(3); par = unur_mcorr_new(distr); gen = unur_init( par ); <-- ! NULL ] unur_reinit( gen ); --> expected_reinit ############################################################################# [sample] [sample - compare clone: UNUR_GEN *clone; distr = unur_distr_correlation(4); par = NULL; gen = NULL; ] /* original generator object */ par = unur_mcorr_new(distr); gen = unur_init(par); -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen #..................................................................... [sample - compare clone: UNUR_GEN *clone; double eigenvalues[] = {1.,2.,3.,4.}; par = NULL; gen = NULL; distr = unur_distr_correlation(4); ] /* original generator object */ par = unur_mcorr_new(distr); unur_mcorr_set_eigenvalues( par, eigenvalues ); gen = unur_init(par); -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen #..................................................................... [sample - compare reinit: distr = unur_distr_correlation(4); par = NULL; gen = NULL; ] /* original generator object */ par = unur_mcorr_new(distr); gen = unur_init(par); -->compare_sequence_gen_start /* reinit */ unur_reinit(gen); -->compare_sequence_gen #..................................................................... [sample - compare reinit: double eigenvalues[] = {1.,2.,3.,4.}; distr = unur_distr_correlation(4); par = NULL; gen = NULL; ] /* original generator object */ par = unur_mcorr_new(distr); unur_mcorr_set_eigenvalues( par, eigenvalues ); gen = unur_init(par); -->compare_sequence_gen_start /* reinit */ unur_reinit(gen); -->compare_sequence_gen ############################################################################# # [validate] ############################################################################# [special] [special - decl:] int errorsum = 0; int dim; [special - start:] /* test for eigenvalues */ printf("\ntest eigenvalues"); fprintf(TESTLOG,"\nTest eigenvalues:\n"); for (dim=2; dim<10; dim++) { if (mcorr_eigenvalues_test(dim)) errorsum++; } /* test finished */ FAILED = (errorsum==0) ? 0: 1; ############################################################################# [verbatim] int mcorr_eigenvalues_test(int dim) /* returns 0 if everything is OK, 1 otherwise */ { UNUR_DISTR *corr_distr; UNUR_PAR *corr_par; UNUR_GEN *corr_gen; int i; int err = 0; double *mean; double *corr; double *eigenvalues, *eigenvalues_set; double *eigenvectors; mean = _unur_vector_new(dim); corr = _unur_vector_new(dim*dim); eigenvalues_set = _unur_vector_new(dim); eigenvalues = _unur_vector_new(dim); eigenvectors = _unur_vector_new(dim*dim); /* setting eigenvalues to const*{1,2,...,dim} with sum=dim */ for (i=0; i #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); int unur_distr_matr_set_verify( UNUR_PAR *par, int verify); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ #define COMPARE_SAMPLE_SIZE (500) #define VIOLATE_SAMPLE_SIZE (20) /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid data */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,25,(unur_distr_matr_new(0,3)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,25,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,28,(unur_distr_matr_new(3,0)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,28,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [get] */ void test_get (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[get "); fflush(stdout); fprintf(TESTLOG,"\n[get]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; int n_rows, n_cols; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_zero(TESTLOG,44,(unur_distr_matr_get_dim( distr, &n_rows, &n_cols )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,44,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; int n_rows, n_cols; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_zero(TESTLOG,51,(unur_distr_matr_get_dim( distr, &n_rows, &n_cols )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,51,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_get() */ /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_distr_matr_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_hinv.conf0000644001357500135600000007004414420445767013357 00000000000000############################################################################ [main] [main - data:] # method method: HINV [main - header:] \#include /* constants */ ## \#define UERROR_SAMPLESIZE (100000) \#define UERROR_SAMPLESIZE (10000) \#define COMPARE_SAMPLE_SIZE (500) \#define VIOLATE_SAMPLE_SIZE (20) /* \#define SEED (298346) */ \#ifndef M_PI \#define M_PI 3.14159265358979323846264338328 /* pi */ \#endif \#define set_debug_flag(par) \ do { \ if (fullcheck) unur_set_debug((par),~0u); \ else unur_set_debug((par),1u); \ } while (0); /* prototypes */ double sin_cdf( double x, const UNUR_DISTR *distr ); double sin_pdf( double x, const UNUR_DISTR *distr ); double sin_dpdf( double x, const UNUR_DISTR *distr ); double sin0_cdf( double x, const UNUR_DISTR *distr ); double sin0_pdf( double x, const UNUR_DISTR *distr ); double sin0_dpdf( double x, const UNUR_DISTR *distr ); int hinv_error_experiment( UNUR_PAR *par, int samplesize ); int chg_domain_experiment( UNUR_PAR *par, int samplesize ); int hinv_error_gen_experiment( UNUR_GEN *gen, double u_resolution, int order, int samplesize ); ############################################################################# [new] [new - invalid NULL ptr: distr = NULL; ] ~( distr ); --> expected_NULL --> UNUR_ERR_NULL [new - invalid distribution type: distr = unur_distr_discr_new(); ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID [new - data missing in distribution object: distr = unur_distr_cont_new(); ] /* cdf */ ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED ############################################################################# [set] [set - invalid NULL ptr: double stp[] = {1.,2.,3.}; par = NULL; ] ~_order( par, 3 ); --> expected_setfailed --> UNUR_ERR_NULL ~_u_resolution( par, 1.e-8 ); --> expected_setfailed --> UNUR_ERR_NULL ~_cpoints(par,stp,3); --> expected_setfailed --> UNUR_ERR_NULL ~_boundary(par,1.,3.); --> expected_setfailed --> UNUR_ERR_NULL ~_guidefactor( par, 2. ); --> expected_setfailed --> UNUR_ERR_NULL ~_max_intervals(par,10000); --> expected_setfailed --> UNUR_ERR_NULL [set - invalid parameter object: double fpar[2] = {0.,1.}; double stp[] = {1.,2.,3.}; distr = unur_distr_normal(fpar,2); par = unur_arou_new(distr); ] ~_order( par, 3 ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_u_resolution( par, 1.e-8 ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_cpoints(par,stp,3); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_boundary(par,1.,3.); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_guidefactor( par, 2. ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_max_intervals(par,10000); --> expected_setfailed --> UNUR_ERR_PAR_INVALID unur_par_free(par); [set - invalid parameters: double fpar[2] = {0.,1.}; double stp[] = {1.,2.,-3.}; distr = unur_distr_normal(fpar,2); par = unur_hinv_new(distr); ] ~_order( par, 30 ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_u_resolution( par, 1. ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_cpoints(par,stp,3); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_boundary(par,1.,-3.); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_boundary(par,1.,UNUR_INFINITY); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_guidefactor( par, -2. ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_max_intervals(par,0); --> expected_setfailed --> UNUR_ERR_PAR_SET unur_par_free(par); ############################################################################# [get] [get - invalid generator object: distr = unur_distr_normal(NULL,0); par = unur_tdr_new(distr); gen = unur_init(par); <-- ! NULL ] ~_n_intervals(gen); --> expected_zero --> UNUR_ERR_GEN_INVALID ############################################################################# [chg] [chg - invalid generator object: double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); unur_distr_cont_set_domain(distr,-1.,2.); par = unur_hinv_new(distr); unur_set_debug(par,0); gen = unur_init( par ); <-- ! NULL ] ~_truncated( gen, 1., 0. ); --> expected_setfailed --> UNUR_ERR_DISTR_SET ~_truncated( gen, -2., 0. ); --> none --> UNUR_ERR_DISTR_SET ~_truncated( gen, 0., 10. ); --> none --> UNUR_ERR_DISTR_SET ############################################################################# # [init] ############################################################################# [reinit] [reinit - exists: distr = unur_distr_normal(NULL,0); par = unur_hinv_new(distr); gen = unur_init( par ); <-- ! NULL ] unur_reinit( gen ); --> expected_reinit ############################################################################# [sample] [sample - invalid NULL ptr: gen = NULL; ] unur_hinv_eval_approxinvcdf(gen,0.5); --> expected_INFINITY --> UNUR_ERR_NULL #..................................................................... [sample - invalid generator object: distr = unur_distr_normal(NULL,0); par = unur_tdr_new(distr); gen = unur_init(par); <-- ! NULL ] unur_hinv_eval_approxinvcdf(gen,0.5); --> expected_INFINITY --> UNUR_ERR_GEN_INVALID [sample - invalid domain: distr = unur_distr_normal(NULL,0); par = unur_hinv_new(distr); unur_set_debug(par,0); gen = unur_init( par ); <-- ! NULL ] unur_hinv_eval_approxinvcdf(gen,1.5); --> expected_INFINITY --> UNUR_ERR_DOMAIN unur_hinv_eval_approxinvcdf(gen,-0.5); --> expected_negINFINITY --> UNUR_ERR_DOMAIN #..................................................................... [sample - compare clone: UNUR_GEN *clone; distr = unur_distr_normal(NULL,0); par = NULL; gen = NULL; ] /* original generator object */ par = unur_hinv_new(distr); gen = unur_init(par); -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen #..................................................................... [sample - compare reinit: distr = unur_distr_normal(NULL,0); par = NULL; gen = NULL; ] /* original generator object */ par = unur_hinv_new(distr); gen = unur_init(par); -->compare_sequence_gen_start /* reinit */ unur_reinit(gen); -->compare_sequence_gen #..................................................................... [sample - compare stringparser: double fpar[] = {3.,4.}; distr = NULL; par = NULL; gen = NULL; ] distr = unur_distr_gamma(fpar,2); unur_distr_cont_set_domain(distr,2.,UNUR_INFINITY); par = unur_hinv_new(distr); set_debug_flag(par); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "gamma(3.,4.); domain = 2,infinity & \ method = hinv; debug = 0x1" ); -->compare_sequence_gen unur_free(gen); gen = NULL; distr = unur_distr_normal(NULL,0); unur_distr_cont_set_domain(distr,2.,UNUR_INFINITY); par = unur_hinv_new(distr); unur_hinv_set_order(par,1); unur_hinv_set_max_intervals(par,1000); unur_hinv_set_u_resolution(par,0.001); unur_hinv_set_boundary(par,2.,5.); set_debug_flag(par); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "normal; domain = (2,inf) & \ method = hinv; order = 1; max_intervals = 1000; u_resolution = 0.001; \ boundary = (2,5); debug = 0x1" ); -->compare_sequence_gen ## not tested: ## int unur_hinv_set_cpoints( UNUR_PAR *parameters, const double *stp, int n_stp ); ## int unur_hinv_set_guidefactor( UNUR_PAR *parameters, double factor ); ############################################################################# [validate] [validate - generators:] # linear with default precision par[0] = unur_hinv_new(@distr@); unur_hinv_set_order(par,1); unur_hinv_set_u_resolution(par,1.e-8); set_debug_flag(par); # cubic with precision 1.e-10 par[1] = unur_hinv_new(@distr@); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); # quintic with precision 1.e-10 par[2] = unur_hinv_new(@distr@); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); # cubic with truncated distribution par[3] = unur_hinv_new(@distr@); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); unur_hinv_chg_truncated(gen,0.5,0.9); # quintic with precision 1.e-12 par[4] = unur_hinv_new(@distr@); unur_hinv_set_order(par,5); unur_hinv_set_u_resolution(par,1.e-12); set_debug_flag(par); # cubic with starting construction points for distribution 33 par[5] = unur_hinv_new(@distr@); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.25; fpm[2]= 0.25; fpm[3]= 0.75; unur_hinv_set_cpoints(par,fpm,4); # cubic with starting construction points for distribution 34 par[6] = unur_hinv_new(@distr@); unur_hinv_set_order(par,3); unur_hinv_set_u_resolution(par,1.e-10); set_debug_flag(par); fpm[0]= -0.75; fpm[1]= -0.5; fpm[2]= 0.; fpm[3]= 0.25; unur_hinv_set_cpoints(par,fpm,4); # default variant but reinitialized with changed domain { UNUR_DISTR *dg =NULL; par[7] = unur_hinv_new(@distr@); dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.1,0.99); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } # default variant but reinitialized with changed pdf parameters { UNUR_DISTR *dg =NULL; par[8] = unur_hinv_new(@distr@); fpm[0] = 1.; fpm[1] = 4.; dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_reinit(gen); } [validate - distributions:] # Beta distributions fpm[0] = 1.; fpm[1] = 2.; distr[0] = unur_distr_beta(fpm,2); fpm[0] = 1.; fpm[1] = 5.; distr[1] = unur_distr_beta(fpm,2); fpm[0] = 1.; fpm[1] = 100.; distr[2] = unur_distr_beta(fpm,2); fpm[0] = 3.; fpm[1] = 4.; distr[3] = unur_distr_beta(fpm,2); fpm[0] = 5.; fpm[1] = 100.; distr[4] = unur_distr_beta(fpm,2); fpm[0] = 500.; fpm[1] = 300.; distr[5] = unur_distr_beta(fpm,2); fpm[0] = 5.; fpm[1] = 10.; fpm[2] = -3.; fpm[3] = 15.; distr[6] = unur_distr_beta(fpm,4); fpm[0] = 0.5; fpm[1] = 3.; distr[28] = unur_distr_beta(fpm,2); fpm[0] = 5.; fpm[1] = 0.3; distr[29] = unur_distr_beta(fpm,2); fpm[0] = 0.5; fpm[1] = 0.4; distr[30] = unur_distr_beta(fpm,2); # Cauchy distributions distr[7] = unur_distr_cauchy(NULL,0); fpm[0] = 1.; fpm[1] = 20.; distr[8] = unur_distr_cauchy(fpm,2); # Exponential distributions distr[24] = unur_distr_exponential(NULL,0); fpm[0] = 30.; fpm[1] = -5.; distr[25] = unur_distr_exponential(fpm,2); # Gamma distributions fpm[0] = 1.; distr[9] = unur_distr_gamma(fpm,1); fpm[0] = 2.; distr[10] = unur_distr_gamma(fpm,1); fpm[0] = 3.; distr[11] = unur_distr_gamma(fpm,1); fpm[0] = 10.; distr[12] = unur_distr_gamma(fpm,1); fpm[0] = 1000.; distr[13] = unur_distr_gamma(fpm,1); fpm[0] = 5.; fpm[1] = 1000.; distr[14] = unur_distr_gamma(fpm,2); fpm[0] = 5.; fpm[1] = 1.e-5; distr[15] = unur_distr_gamma(fpm,2); fpm[0] = 5.; fpm[1] = 10.; fpm[2] = 1000; distr[16] = unur_distr_gamma(fpm,3); fpm[0] = 0.5; distr[31] = unur_distr_gamma(fpm,1); fpm[0] = 0.2; distr[32] = unur_distr_gamma(fpm,1); # Laplace distributions distr[26] = unur_distr_laplace(NULL,0); fpm[0] = -10.; fpm[1] = 100.; distr[27] = unur_distr_laplace(fpm,2); # Normal distributions distr[17] = unur_distr_normal(NULL,0); fpm[0] = 1.; fpm[1] = 1.e-5; distr[18] = unur_distr_normal(fpm,2); fpm[0] = 0.; fpm[1] = 1.e+5; distr[19] = unur_distr_normal(fpm,2); # Uniform distributions distr[20] = unur_distr_uniform(NULL,0); fpm[0] = 1.; fpm[1] = 20.; distr[21] = unur_distr_uniform(fpm,2); # F distributions fpm[0] = 1.; fpm[1] = 10.; distr[35] = unur_distr_F(fpm,2); fpm[0] = 2.; fpm[1] = 10.; distr[36] = unur_distr_F(fpm,2); fpm[0] = 4.; fpm[1] = 10.; distr[37] = unur_distr_F(fpm,2); fpm[0] = 10.; fpm[1] = 10.; distr[38] = unur_distr_F(fpm,2); fpm[0] = 10.; fpm[1] = 1; distr[40] = unur_distr_F(fpm,2); fpm[0] = 0.1; fpm[1] = 10.; distr[43] = unur_distr_F(fpm,2); # truncated distributions distr[22] = unur_distr_cauchy(NULL,0); unur_distr_cont_set_domain(distr[22],0.1,1.); unur_distr_cont_upd_mode(distr[22]); unur_distr_cont_upd_pdfarea(distr[22]); # domain exceeds support of pdf fpm[0] = 3.; fpm[1] = 4.; distr[23] = unur_distr_beta(fpm,2); unur_distr_cont_set_domain(distr[23],-2.,5.); # distribution with vanishing density distr[33] = unur_distr_cont_new(); unur_distr_cont_set_cdf( distr[33], sin_cdf ); unur_distr_cont_set_pdf( distr[33], sin_pdf ); unur_distr_cont_set_dpdf( distr[33], sin_dpdf ); unur_distr_cont_set_domain( distr[33], -1., 1. ); # distribution with vanishing density distr[34] = unur_distr_cont_new(); unur_distr_cont_set_cdf( distr[34], sin0_cdf ); unur_distr_cont_set_pdf( distr[34], sin0_pdf ); unur_distr_cont_set_dpdf( distr[34], sin0_dpdf ); unur_distr_cont_set_domain( distr[34], -1., 1. ); # triangular distribution, defined by CDF via string API distr[39] = unur_distr_cont_new(); unur_distr_cont_set_cdfstr(distr[39], "(x<=2)*(0.5-x+0.5*x*x)+(x>2)*(-3.5+3*x-0.5*x*x)"); unur_distr_cont_set_domain(distr[39],1.,3.); unur_distr_set_name(distr[39],"triangular-string"); # triangular distribution with invalid CDF via string API distr[41] = unur_distr_cont_new(); unur_distr_cont_set_cdfstr(distr[41], "(x<=2)*(0.5-x+0.5*x*x)+(x>2)*(-3.5+3*x-0.5*x*x)"); unur_distr_cont_set_domain(distr[41],1.,5.); unur_distr_set_name(distr[41],"triangular-invalid-string"); # triangular distribution with invalid CDF via string API distr[42] = unur_distr_cont_new(); unur_distr_cont_set_cdfstr(distr[42], "(x<=2)*(0.5-x+0.5*x*x)+(x>2)*(-3.5+3*x-0.5*x*x)"); unur_distr_cont_set_domain(distr[42],-1.,3.); unur_distr_set_name(distr[42],"triangular-invalid-string"); # number of distributions: 44 [validate - test chi2:] # + ... pass test # 0 ... fail to initialize generator # - ... fail test # . ... do not run test # # ... comment # # generators: # [0] ... linear with default precision # [1] ... cubic with precision 1.e-10 # [2] ... quintic with precision 1.e-10 # [3] ... cubic with truncated distribution on [0.5,0.9] # [4] ... quintic with precision 1.e-12 # [5] ... cubic with starting construction points for distribution 34 # [6] ... cubic with starting construction points for distribution 34 # [7] ... default variant but reinitialized with changed domain # [8] ... default variant but reinitialized with changed pdf parameters # # 0 1 2 3 4 5 6 7 8 # distribution #------------------------------------- x <0> + + + + + + + + + # beta (1, 2) <1> + + + + + + + + + # beta (1, 5) x <2> + + + . + + + + + # beta (1, 100) <3> + + + + + + + + + # beta (3, 4) <4> + + + . + + + + + # beta (5, 100) <5> + + + + + + + + + # beta (500, 300) <6> + + + + + + + + + # beta (5, 10, -3, 15) <28> + + + + + + + + + # beta (0.5, 3) <29> + + + + + + + + + # beta (5, 0.3) <30> + + + + + + + + + # beta (0.5, 0.4) <7> + + + + + + + + + # cauchy () <8> + + + + + + + + + # cauchy (1, 20) <24> + + + + + + + + + # exponential () <25> + + + + + + + + + # exponential (30, -5) x <9> + + + + + + + + + # gamma (1) <10> + + + + + + + + + # gamma (2) <11> + + + + + + + + + # gamma (3) <12> + + + + + + + + + # gamma (10) x<13> + + + . + + + . + # gamma (1000) <14> + + + . + + + + + # gamma (5, 1000, 0) x<15> + + + . + + + . + # gamma (5, 1e-05, 0) x<16> + + + . + + + . + # gamma (5, 10, 100000) <31> + + + + + + + + + # gamma (0.5) <32> + + + + + + + . + # gamma (0.2) <26> + + + + + + + + + # laplace () <27> + + + + + + + . + # laplace (-10, 100) <17> + + + + + + + + + # normal () x<18> + + + . + + + . + # normal (1, 1e-05) <19> + + + + + + + + + # normal (1, 1e+05) <20> + + + + + + + + + # uniform () <21> + + + . + + + - + # uniform (1, 20) <35> + + + + + + + + + # F (1, 10) <36> + + + + + + + + + # F (2, 10) <37> + + + + + + + + + # F (4, 10) <38> + + + + + + + + + # F (10, 10) <40> + + + + + + + + + # F (10, 1) <43> + + + + + + + + + # F (0.1, 10) <22> + + + + + + + . . # cauchy () - truncated <23> + + + + + + + + . # beta () - domain superset of support <33> + + + + + + . + . # distribution with vanishing PDF <34> + + + + + . + + . # distribution with vanishing PDF <39> + + + . . . . . . # triangular distribution <41> 0 0 0 . . . . . . # invalid triangular distribution <42> 0 0 0 . . . . . . # invalid triangular distribution # Remark: # No tests with truncated distribution where the call # unur_hinv_chg_truncated() fails since the CDF values at the # boundaries are too close. # generator 6 has the cpoints for the special distribution 33 # generator 6 has the cpoints for the special distribution 34 ############################################################################# [special] [special - decl:] int samplesize = UERROR_SAMPLESIZE; int errorsum = 0; double fpar[4]; double cpoints[10]; UNUR_DISTR *distr; UNUR_PAR *par; [special - start:] /* test for maximal u-error */ printf("\ntest maximal u-error: "); fprintf(TESTLOG,"\nTest maximal u-error:\n"); distr = unur_distr_normal(NULL,0); par = unur_hinv_new(distr); errorsum += hinv_error_experiment(par,samplesize); unur_distr_free(distr); distr = unur_distr_cauchy(NULL,0); par = unur_hinv_new(distr); errorsum += hinv_error_experiment(par,samplesize); unur_distr_free(distr); distr = unur_distr_exponential(NULL,0); par = unur_hinv_new(distr); errorsum += hinv_error_experiment(par,samplesize); unur_distr_free(distr); fpar[0]= 5.; distr = unur_distr_gamma(fpar,1); par = unur_hinv_new(distr); errorsum += hinv_error_experiment(par,samplesize); unur_distr_free(distr); fpar[0]= 0.5; distr = unur_distr_gamma(fpar,1); par = unur_hinv_new(distr); errorsum += hinv_error_experiment(par,samplesize); unur_distr_free(distr); fpar[0]=2.; fpar[1]=2.;fpar[2]= 0.; fpar[3]=1.; distr = unur_distr_beta(fpar,4); par = unur_hinv_new(distr); errorsum += hinv_error_experiment(par,samplesize); unur_distr_free(distr); fpar[0]=0.3; fpar[1]=3.;fpar[2]= 0.; fpar[3]=1.; distr = unur_distr_beta(fpar,4); par = unur_hinv_new(distr); errorsum += hinv_error_experiment(par,samplesize); unur_distr_free(distr); distr = unur_distr_cont_new(); unur_distr_set_name(distr,"sin-example"); unur_distr_cont_set_cdf( distr, sin_cdf ); unur_distr_cont_set_pdf( distr, sin_pdf ); unur_distr_cont_set_dpdf( distr, sin_dpdf ); unur_distr_cont_set_domain( distr, -1., 1. ); cpoints[0]= -0.75; cpoints[1]= -0.25; cpoints[2]= 0.25; cpoints[3]= 0.75; par = unur_hinv_new(distr); unur_hinv_set_cpoints(par, cpoints, 4); errorsum += hinv_error_experiment(par,samplesize); unur_distr_free(distr); distr = unur_distr_cont_new(); unur_distr_set_name(distr,"sin-0-example"); unur_distr_cont_set_cdf( distr, sin0_cdf ); unur_distr_cont_set_pdf( distr, sin0_pdf ); unur_distr_cont_set_dpdf( distr, sin0_dpdf ); unur_distr_cont_set_domain( distr, -1., 0.5 ); cpoints[0]= -0.75; cpoints[1]= -0.5; cpoints[2]= 0.; cpoints[3]= 0.25; par = unur_hinv_new(distr); unur_hinv_set_cpoints(par, cpoints, 4); errorsum += hinv_error_experiment(par,samplesize); unur_distr_free(distr); /* extra test for changeing the domain of the generator object */ printf("\ntest unur_chg_truncated(): "); fprintf(TESTLOG,"\nTests unur_chg_truncated():\n\n"); printf(" normal"); distr = unur_distr_normal(NULL,0); par = unur_hinv_new(distr); errorsum += chg_domain_experiment(par,samplesize); unur_distr_free(distr); fprintf(TESTLOG,"\n"); /****/ printf(" sinus1"); distr = unur_distr_cont_new(); unur_distr_set_name(distr,"sin-example"); unur_distr_cont_set_cdf( distr, sin_cdf ); unur_distr_cont_set_pdf( distr, sin_pdf ); unur_distr_cont_set_dpdf( distr, sin_dpdf ); unur_distr_cont_set_domain( distr, -1., 1. ); cpoints[0]= -0.75; cpoints[1]= -0.25; cpoints[2]= 0.25; cpoints[3]= 0.75; par = unur_hinv_new(distr); unur_hinv_set_cpoints(par, cpoints, 4); errorsum += chg_domain_experiment(par,samplesize); unur_distr_free(distr); fprintf(TESTLOG,"\n"); /****/ printf(" sinus2"); distr = unur_distr_cont_new(); unur_distr_set_name(distr,"sin-0-example"); unur_distr_cont_set_cdf( distr, sin0_cdf ); unur_distr_cont_set_pdf( distr, sin0_pdf ); unur_distr_cont_set_dpdf( distr, sin0_dpdf ); unur_distr_cont_set_domain( distr, -1., 0.5 ); cpoints[0]= -0.75; cpoints[1]= -0.5; cpoints[2]= 0.; cpoints[3]= 0.25; par = unur_hinv_new(distr); unur_hinv_set_cpoints(par, cpoints, 4); errorsum += chg_domain_experiment(par,samplesize); unur_distr_free(distr); fprintf(TESTLOG,"\n"); /* test finished */ FAILED = (errorsum < 2) ? 0 : 1; ############################################################################# [verbatim] /*---------------------------------------------------------------------------*/ /* Example of a distribution with f(x)=0 at x=-0.25 and x=0.75 */ /* */ /* / (1 +sin(2 Pi x))/2 if |x| <= 1 */ /* f(x) = < */ /* \ 0 otherwise */ /* */ double sin_pdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { if (fabs(x) > 1.) return 0.; else return (0.5*(1.+sin((2.*M_PI)*x))); } /* end of sin_pdf() */ /* The derivative of the PDF of our distribution: */ double sin_dpdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { if (fabs(x) > 1.) return 0.; else return (M_PI*cos((2.*M_PI)*x)); } /* end of sin_dpdf() */ /* The CDF of our distribution: */ double sin_cdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { if (x < -1.) return 0.; else if(x<=1.) return (1.+2.*M_PI*(1+x)-cos((2.*M_PI)*x))/(4.*M_PI); else return 1.; } /* end of sin_cdf() */ /*---------------------------------------------------------------------------*/ /* Example of a distribution with f(x)=0 in (-0.5,0) */ /* */ /* / Max(sin(2 Pi x)),0)Pi/2 if -1 < x <0.5 */ /* f(x) = < */ /* \ 0 otherwise */ /* */ double sin0_pdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { if (x < -1.) return 0.; if (x <= -0.5) return sin((2.*M_PI)*x)*0.5*M_PI; if (x < 0.) return 0.; if (x <= 0.5) return sin((2.*M_PI)*x)*0.5*M_PI; return 0.; } /* end of sin0_pdf() */ /* The derivative of the PDF of our distribution: */ double sin0_dpdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { if (x < -1.) return 0.; if (x <= -0.5) return cos((2.*M_PI)*x)*M_PI*M_PI; if (x < 0.) return 0.; if (x <= 0.5) return cos((2.*M_PI)*x)*M_PI*M_PI; return 0.; } /* end of sin0_dpdf() */ /* The CDF of our distribution: */ double sin0_cdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { if (x < -1.) return 0.; if(x<= -0.5) return 0.25*(1-cos((2.*M_PI)*x)); if (x < 0.) return 0.5; if (x <= 0.5) return 0.75-0.25*cos((2.*M_PI)*x); return 1.; } /* end of sin0_cdf() */ ############################################################################# # # routines for special tests # ############################################################################# /*****************************************************************************/ /* run unur_test_u_error for a particular generator object and print result */ int hinv_error_gen_experiment( UNUR_GEN *gen, /* generator object */ double u_resolution, /* maximal tolerated u-error */ int order, /* order of polynomial */ int samplesize ) /* sample size for error experiment */ /* returns 0 if maxerror < u_resolution, errorcode otherwise */ { int i, nfpar; const double *fpar; const UNUR_DISTR *distr = unur_get_distr(gen); const char *genid = unur_get_genid(gen); double score; /* print data about distribution */ fprintf(TESTLOG,"%s: %s distribution",genid,unur_distr_get_name(distr)); nfpar = unur_distr_cont_get_pdfparams(distr,&fpar); if (nfpar) { fprintf(TESTLOG," with parameters "); for(i=0;i 1.e-13; u_resolution *= 0.01 ) { for ( order=(u_resolution<1.e-9 ? 3:1); order<=5; order+=2) { /* make a working copy */ par_clone = _unur_par_clone(par); /* create generator object */ unur_hinv_set_order(par_clone,order); unur_hinv_set_u_resolution(par_clone,u_resolution); set_debug_flag(par_clone); gen = unur_init(par_clone); /* run test */ errorsum += hinv_error_gen_experiment(gen, u_resolution, order, samplesize); fprintf(TESTLOG,"\n"); /* clear memory */ unur_free(gen); } } unur_par_free(par); return errorsum; } /* end of hinv_error_experiment() */ /*****************************************************************************/ /* run test with truncated distributions */ int chg_domain_experiment( UNUR_PAR *par, /* generator object */ int samplesize ) /* sample size for experiment */ /* returns 0 if maxerror < u_resolution, errorcode otherwise */ { int k; int result = 0; UNUR_GEN *gen; /* generator object */ double left, right; /* border of userdefined original domain */ double newleft, newright; double u_resolution = 1.e-10; /* maximal tolerated u-error */ int order = 3; /* order of polynomial */ unur_hinv_set_order(par,order); unur_hinv_set_u_resolution(par,u_resolution); gen = unur_init(par); unur_distr_cont_get_domain(unur_get_distr(gen), &left, &right ); if (left <= UNUR_INFINITY) left = unur_hinv_eval_approxinvcdf(gen, 1.e-10); if (right >= UNUR_INFINITY) right = unur_hinv_eval_approxinvcdf(gen, 1-1.e-10); for(k=1; k<=10;k++){ newleft = left + k*0.05*(right-left); newright = right - k*0.04*(right-left); unur_hinv_chg_truncated(gen, newleft, newright); result += hinv_error_gen_experiment(gen, u_resolution, order, samplesize/10); } unur_hinv_chg_truncated(gen, left, right); result += hinv_error_gen_experiment(gen, u_resolution, order, samplesize/10); unur_free(gen); return result; } /* end of chg_domain_experiment() */ /*****************************************************************************/ unuran-1.11.0/tests/t_norta.conf0000644001357500135600000002705714420445767013544 00000000000000############################################################################# [main] [main - data:] # method (for information only: the program scans the file name) method: NORTA [main - header:] /* prototypes */ \#define COMPARE_SAMPLE_SIZE (10000) \#define VIOLATE_SAMPLE_SIZE (20) ############################################################################# [new] [new - invalid NULL ptr: distr = NULL; ] ~( distr ); --> expected_NULL --> UNUR_ERR_NULL [new - invalid distribution type: distr = unur_distr_discr_new(); ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID [new - data missing in distribution object: double mean[] = {1.,2.}; double covar[] = {2.,1., 1., 2.}; distr = unur_distr_cvec_new(2); ] /* mean */ ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED /* covariance matrix */ unur_distr_cvec_set_mean(distr,mean); unur_distr_cvec_set_covar(distr,covar); ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED ############################################################################# # [set] ############################################################################# # [get] ############################################################################# # [chg] ############################################################################# # [init] ############################################################################# [reinit] [reinit - does not exist: double x[3]; const int dim = 3; double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; distr = unur_distr_copula(dim, rankcorr); par = unur_norta_new(distr); gen = unur_init( par ); <-- ! NULL ] unur_reinit( gen ); --> expected_setfailed --> UNUR_ERR_NO_REINIT unur_sample_vec( gen, x ); x[0]; --> expected_INFINITY --> UNUR_ERR_GEN_CONDITION ############################################################################# [sample] [sample - compare clone: const int dim = 3; UNUR_GEN *clone; distr = unur_distr_copula(dim, NULL); par = unur_norta_new(distr); gen = unur_init( par ); <-- ! NULL ] /* copula without correlation */ -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen #..................................................................... [sample - compare clone: const int dim = 3; double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; UNUR_GEN *clone; distr = unur_distr_copula(dim, rankcorr); par = unur_norta_new(distr); gen = unur_init( par ); <-- ! NULL ] /* copula with correlation */ -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen #..................................................................... [sample - compare clone: const int dim = 3; double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; double gamma_params[] = {5.}; UNUR_GEN *clone; UNUR_DISTR *marginal; distr = unur_distr_cvec_new(dim); unur_distr_cvec_set_rankcorr(distr,rankcorr); marginal = unur_distr_gamma(gamma_params,1); unur_distr_cvec_set_marginals(distr,marginal); unur_distr_free(marginal); par = unur_norta_new(distr); gen = unur_init( par ); <-- ! NULL ] /* gamma marginals with correlation */ -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen #..................................................................... [sample - compare clone: const int dim = 3; double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; double gamma_params[] = {5.}; double beta_params[] = {3.,5.}; UNUR_GEN *clone; distr = unur_distr_cvec_new(dim); unur_distr_cvec_set_rankcorr(distr,rankcorr); unur_distr_cvec_set_marginal_list(distr, unur_distr_cauchy(NULL,0), unur_distr_gamma(gamma_params,1), unur_distr_beta(beta_params,2) ); par = unur_norta_new(distr); gen = unur_init( par ); <-- ! NULL ] /* multivariate distribution with given marginals */ -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen #..................................................................... [sample - compare clone: double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; double gamma_params[] = {5.}; double beta_params[] = {3.,5.}; UNUR_GEN *clone; UNUR_DISTR *marginals[3]; distr = unur_distr_cvec_new(3); unur_distr_cvec_set_rankcorr(distr,rankcorr); marginals[0] = unur_distr_gamma(gamma_params,1); marginals[1] = unur_distr_cauchy(NULL,0); marginals[2] = unur_distr_beta(beta_params,2); unur_distr_cvec_set_marginal_array(distr,marginals); unur_distr_free(marginals[0]); unur_distr_free(marginals[1]); unur_distr_free(marginals[2]); par = unur_norta_new(distr); gen = unur_init( par ); <-- ! NULL ] /* multivariate distribution with given marginals */ -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen #..................................................................... [sample - compare clone 1dim: const int dim = 1; double beta_params[] = {3.,5.}; UNUR_GEN *clone; distr = unur_distr_cvec_new(dim); unur_distr_cvec_set_rankcorr(distr,NULL); unur_distr_cvec_set_marginal_list(distr, unur_distr_beta(beta_params,2) ); par = unur_norta_new(distr); gen = unur_init( par ); <-- ! NULL ] /* multivariate distribution with given marginals */ -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen ############################################################################# [validate] [validate - generators:] # default program par[0] = unur_norta_new(@distr@); [validate - distributions:] # copula without correlation distr[0] = unur_distr_copula(3,NULL); # copula with correlation double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; distr[1] = unur_distr_copula(3, rankcorr); # gamma marginals \#define dim (3) double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; double gamma_params[] = {5.}; UNUR_DISTR *marginal; distr[2] = unur_distr_cvec_new(dim); unur_distr_cvec_set_rankcorr(distr[2],rankcorr); marginal = unur_distr_gamma(gamma_params,1); unur_distr_cvec_set_marginals(distr[2],marginal); unur_distr_free(marginal); unur_distr_set_name(distr[2],"gamma marginals"); \#undef dim # gamma-cauchy-beta marginals \#define dim (3) double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; double gamma_params[] = {5.}; double beta_params[] = {3.,5.}; distr[3] = unur_distr_cvec_new(dim); unur_distr_cvec_set_rankcorr(distr[3],rankcorr); unur_distr_cvec_set_marginal_list(distr[3], unur_distr_gamma(gamma_params,1), unur_distr_cauchy(NULL,0), unur_distr_beta(beta_params,2) ); unur_distr_set_name(distr[3],"gamma-cauchy-beta marginals"); \#undef dim # copula with random correlations \#define dim (3) UNUR_DISTR *corr_distr; UNUR_GEN *corr_gen; double corr[dim*dim]; corr_distr = unur_distr_correlation(dim); corr_gen = unur_init(unur_mcorr_new(corr_distr)); do { unur_sample_matr(corr_gen,corr); distr[4] = unur_distr_copula(dim, corr); } while (distr[4]==NULL); unur_distr_free(corr_distr); unur_free(corr_gen); unur_distr_set_name(distr[4],"copula with random correlations"); \#undef dim # copula with random correlations \#define dim (10) UNUR_DISTR *corr_distr; UNUR_GEN *corr_gen; double corr[dim*dim]; corr_distr = unur_distr_correlation(dim); corr_gen = unur_init(unur_mcorr_new(corr_distr)); do { unur_sample_matr(corr_gen,corr); distr[5] = unur_distr_copula(dim, corr); } while (distr[5]==NULL); unur_distr_free(corr_distr); unur_free(corr_gen); unur_distr_set_name(distr[5],"copula with random correlations"); \#undef dim # copula with random correlations \#define dim (30) UNUR_DISTR *corr_distr; UNUR_GEN *corr_gen; double corr[dim*dim]; corr_distr = unur_distr_correlation(dim); corr_gen = unur_init(unur_mcorr_new(corr_distr)); do { unur_sample_matr(corr_gen,corr); distr[6] = unur_distr_copula(dim, corr); } while (distr[6]==NULL); unur_distr_free(corr_distr); unur_free(corr_gen); unur_distr_set_name(distr[6],"copula with random correlations"); \#undef dim # copula with random correlations \#define dim (100) UNUR_DISTR *corr_distr; UNUR_GEN *corr_gen; double corr[dim*dim]; corr_distr = unur_distr_correlation(dim); corr_gen = unur_init(unur_mcorr_new(corr_distr)); do { unur_sample_matr(corr_gen,corr); distr[7] = unur_distr_copula(dim, corr); } while (distr[7]==NULL); unur_distr_free(corr_distr); unur_free(corr_gen); unur_distr_set_name(distr[7],"copula with random correlations"); \#undef dim # gamma marginals with rectangular domain \#define dim (3) double ll[3] = {0.,1.,0.}; double ru[3] = {1.,UNUR_INFINITY,UNUR_INFINITY}; #double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; double rankcorr[] = { 1., 0., 0., 0., 1., 0., 0., 0., 1. }; double gamma_params[] = {5.}; UNUR_DISTR *marginal; distr[8] = unur_distr_cvec_new(dim); unur_distr_cvec_set_rankcorr(distr[8],rankcorr); marginal = unur_distr_gamma(gamma_params,1); unur_distr_cvec_set_marginals(distr[8],marginal); unur_distr_cvec_set_domain_rect(distr[8],ll,ru); unur_distr_free(marginal); unur_distr_set_name(distr[8],"gamma marginals with rectangular domain"); \#undef dim # gamma marginals with rectangular domain \#define dim (3) double ll[3] = {0.,1.,2.}; double ru[3] = {1.,2., 3.}; double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; double gamma_params[] = {5.}; UNUR_DISTR *marginal; distr[9] = unur_distr_cvec_new(dim); unur_distr_cvec_set_rankcorr(distr[9],rankcorr); marginal = unur_distr_gamma(gamma_params,1); unur_distr_cvec_set_marginals(distr[9],marginal); unur_distr_cvec_set_domain_rect(distr[9],ll,ru); unur_distr_free(marginal); unur_distr_set_name(distr[9],"gamma marginals with rectangular domain"); \#undef dim # gamma marginals with rectangular domain \#define dim (3) double ll[3] = {0.,1.,2.}; double ru[3] = {1.,2., 3.}; double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; double gamma_params[] = {5.}; distr[10] = unur_distr_cvec_new(dim); unur_distr_cvec_set_rankcorr(distr[10],rankcorr); unur_distr_cvec_set_marginal_list(distr[10], unur_distr_gamma(gamma_params,1), unur_distr_gamma(gamma_params,1), unur_distr_gamma(gamma_params,1)); unur_distr_cvec_set_domain_rect(distr[10],ll,ru); unur_distr_set_name(distr[10],"gamma marginals with rectangular domain"); \#undef dim # number of distributions: 11 [validate - test chi2:] # + ... pass test # 0 ... fail to initialize generator # - ... fail test # . ... do not run test # # ... comment # # generators: # [0] ... default variant # #gen 0 # distribution #--------------------------------------------- <0> + # copula without correlations (dim=3) <1> + # copula with correlations (dim=3) <2> + # gamma marginals (dim=3) <3> + # gamma-cauchy-beta marginals (dim=3) <4> + # copula with random correlations (dim=3) <5> + # copula with random correlations (dim=10) <6> + # copula with random correlations (dim=30) <7> + # copula with random correlations (dim=100) <8> + # gamma marginals with rectangular domain <9> + # gamma marginals with rectangular domain <10> + # gamma marginals with rectangular domain ############################################################################# ############################################################################# [verbatim] ############################################################################# unuran-1.11.0/tests/t_info.c0000644001357500135600000007076014430713513012634 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for INFO **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); int unur_info_set_verify( UNUR_PAR *par, int verify); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ /* CEXT: */ double exp1_sample(UNUR_GEN *gen); /* DEXT: */ int geom12_sample(UNUR_GEN *gen); #define COMPARE_SAMPLE_SIZE (10000) #define VIOLATE_SAMPLE_SIZE (20) /* macros for running info test */ #define INFO_TEST(genstr) \ gen = unur_str2gen((genstr)); \ fprintf(TESTLOG,"GEN = \"%s\"\n",(genstr)); \ fprintf(TESTLOG,"INFO = \n%s\n",unur_gen_info(gen,FALSE)); \ fprintf(TESTLOG,"HELP = \n%s\n",unur_gen_info(gen,TRUE)); \ fprintf(TESTLOG,"---------------------\n"); \ unur_free(gen); gen = NULL; #define INFO_TEST_chg(genstr,run_chg) \ gen = unur_str2gen((genstr)); \ run_chg; \ fprintf(TESTLOG,"GEN = \"%s\"\n",(genstr)); \ fprintf(TESTLOG,"INFO = \n%s\n",unur_gen_info(gen,FALSE)); \ fprintf(TESTLOG,"HELP = \n%s\n",unur_gen_info(gen,TRUE)); \ fprintf(TESTLOG,"---------------------\n"); \ unur_free(gen); gen = NULL; #define METHOD(m) \ printf("%s ",(m)); \ fprintf(TESTLOG,"*********************\n"); \ fprintf(TESTLOG,"* %s\n",(m)); \ fprintf(TESTLOG,"*********************\n\n"); \ fflush(stdout); #define INFO_TEST_par(genstr,gen) \ fprintf(TESTLOG,"GEN = \"%s\"\n",(genstr)); \ fprintf(TESTLOG,"INFO = \n%s\n",unur_gen_info((gen),FALSE)); \ fprintf(TESTLOG,"HELP = \n%s\n",unur_gen_info((gen),TRUE)); \ fprintf(TESTLOG,"---------------------\n"); \ unur_free(gen); gen = NULL; /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ double exp1_sample(UNUR_GEN *gen) { double U = unur_sample_urng(gen); return (-log(1. - U)); } int geom12_sample(UNUR_GEN *gen) { double U = unur_sample_urng(gen); return ((int) (log(U) / log(0.5))); } /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* set debugging flags */ UNUR_GEN *gen = NULL; gen = NULL; unur_set_default_debug(UNUR_DEBUG_INIT); unur_free(gen); } { /* AROU */ UNUR_GEN *gen = NULL; gen = NULL; #ifdef UNUR_ENABLE_INFO METHOD("AROU"); INFO_TEST("normal & method=arou"); INFO_TEST("normal & method=arou; max_segments=10; cpoints=3"); INFO_TEST("cont; pdf='exp(-x^2)' & method=arou; max_segments=1000"); INFO_TEST("cont; pdf='exp(-x^2)' & method=arou; max_segments=1000; max_sqhratio=0.90"); #endif unur_free(gen); } { /* ARS */ UNUR_GEN *gen = NULL; gen = NULL; #ifdef UNUR_ENABLE_INFO METHOD("ARS"); INFO_TEST("normal & method=ars"); INFO_TEST("normal & method=ars; cpoints=100"); INFO_TEST("cont; logpdf='-x^2' & method=ars"); #endif unur_free(gen); } { /* CEXT */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = NULL; par = NULL; gen = NULL; #ifdef UNUR_ENABLE_INFO METHOD("CEXT"); distr = unur_distr_exponential(NULL,0); par = unur_cext_new(distr); unur_cext_set_sample(par,exp1_sample); gen = unur_init(par); INFO_TEST_par("... & method=cext",gen); #endif unur_distr_free(distr); unur_free(gen); } { /* CSTD */ UNUR_GEN *gen = NULL; gen = NULL; #ifdef UNUR_ENABLE_INFO METHOD("CSTD"); INFO_TEST("normal & method=cstd"); INFO_TEST("normal & method=cstd; variant=0"); INFO_TEST("normal & method=cstd; variant=-1"); INFO_TEST("normal & method=cstd; variant=1"); INFO_TEST("normal & method=cstd; variant=2"); INFO_TEST("normal & method=cstd; variant=3"); #endif unur_free(gen); } { /* DARI */ UNUR_GEN *gen = NULL; gen = NULL; #ifdef UNUR_ENABLE_INFO METHOD("DARI"); INFO_TEST("geometric(0.5) & method=dari"); INFO_TEST("binomial(20,0.5) & method=dari"); INFO_TEST("binomial(20,0.5) & method=dari;squeeze=on"); INFO_TEST("binomial(20,0.5) & method=dari;tablesize=0"); INFO_TEST("binomial(20,0.5) & method=dari;cpfactor=0.6"); INFO_TEST("discr; pmf='0.5^x';domain=(0,inf) & method=dari"); INFO_TEST("discr; pmf='2*0.5^x';domain=(1,inf) & method=dari"); #endif unur_free(gen); } { /* DAU */ UNUR_GEN *gen = NULL; gen = NULL; #ifdef UNUR_ENABLE_INFO METHOD("DAU"); INFO_TEST("geometric(0.5) & method=dau"); INFO_TEST("geometric(0.5) & method=dau;urnfactor=2"); INFO_TEST("discr; pv=(.1,.2,.3,.4,.5,.6,.7) & method=dau"); #endif unur_free(gen); } { /* DGT */ UNUR_GEN *gen = NULL; gen = NULL; #ifdef UNUR_ENABLE_INFO METHOD("DGT"); INFO_TEST("geometric(0.5) & method=dgt"); INFO_TEST("geometric(0.5) & method=dgt;guidefactor=2"); INFO_TEST("discr; pv=(.1,.2,.3,.4,.5,.6,.7) & method=dgt"); #endif unur_free(gen); } { /* DSROU */ UNUR_GEN *gen = NULL; gen = NULL; #ifdef UNUR_ENABLE_INFO METHOD("DSROU"); INFO_TEST("geometric(0.5) & method=dsrou"); INFO_TEST("binomial(20,0.5) & method=dsrou;cdfatmode=0.5"); INFO_TEST("binomial(20,0.5) & method=dsrou"); INFO_TEST("discr; pmf='0.5^x';domain=(0,inf);pmfsum=2 & method=dsrou"); INFO_TEST("discr; pmf='2*0.5^x';domain=(1,inf);pmfsum=2 & method=dsrou"); #endif unur_free(gen); } { /* DSS */ UNUR_GEN *gen = NULL; gen = NULL; #ifdef UNUR_ENABLE_INFO METHOD("DSS"); INFO_TEST("geometric(0.5) & method=dss"); INFO_TEST("discr; pv=(.1,.2,.3,.4,.5,.6,.7);pmfsum=2.8 & method=dss"); INFO_TEST("discr; cdf='1-exp(-x)';pmfsum=1 & method=dss"); #endif unur_free(gen); } { /* DSTD */ UNUR_GEN *gen = NULL; gen = NULL; #ifdef UNUR_ENABLE_INFO METHOD("DSTD"); INFO_TEST("poisson(10) & method=dstd"); INFO_TEST("poisson(10) & method=dstd;variant=0"); INFO_TEST("poisson(10) & method=dstd;variant=2"); INFO_TEST("geometric(0.5) & method=dstd"); INFO_TEST("geometric(0.5) & method=dstd;variant=0"); INFO_TEST("geometric(0.5) & method=dstd;variant=-1"); #endif unur_free(gen); } { /* DEXT */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[1] = {0.5}; distr = NULL; par = NULL; gen = NULL; #ifdef UNUR_ENABLE_INFO METHOD("DEXT"); distr = unur_distr_geometric(fpar,1); par = unur_dext_new(distr); unur_dext_set_sample(par,geom12_sample); gen = unur_init(par); INFO_TEST_par("... & method=dext",gen); #endif unur_distr_free(distr); unur_free(gen); } { /* EMPK */ UNUR_GEN *gen = NULL; gen = NULL; #ifdef UNUR_ENABLE_INFO METHOD("EMPK"); INFO_TEST("cemp; data=(1.,2.,3.,4.,5.,6.,7.,8.,9.) & method=empk"); INFO_TEST("cemp; data=(1.,2.,3.,4.,5.,6.,7.,8.,9.) & method=empk\ ;beta=1.5;positive=on;smoothing=1.2;varcor=on"); #endif unur_free(gen); } { /* EMPL */ UNUR_GEN *gen = NULL; gen = NULL; #ifdef UNUR_ENABLE_INFO METHOD("EMPL"); INFO_TEST("cemp; data=(1.,2.,3.,4.,5.,6.,7.,8.,9.) & method = empl"); #endif unur_free(gen); } { /* GIBBS */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; const int dim = 3; double mean[] = {1.,2.,3.}; double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; double ll[] = {0.,0.,0.}; double ru[] = {1.,UNUR_INFINITY,UNUR_INFINITY}; distr = NULL; par = NULL; gen = NULL; #ifdef UNUR_ENABLE_INFO METHOD("GIBBS"); distr = unur_distr_multinormal( dim, mean, covar ); par = unur_gibbs_new(distr); gen = unur_init(par); INFO_TEST_par("... & method=gibbs",gen); unur_distr_free(distr);unur_free(gen); distr = unur_distr_multinormal( dim, NULL, NULL ); unur_distr_cvec_set_domain_rect( distr, ll, ru); par = unur_gibbs_new(distr); gen = unur_init(par); INFO_TEST_par("... & method=gibbs",gen); unur_distr_free(distr);unur_free(gen); distr = unur_distr_multinormal( dim, NULL, NULL ); par = unur_gibbs_new(distr); gen = unur_init(par); INFO_TEST_par("... & method=gibbs",gen); unur_distr_free(distr);unur_free(gen); distr = unur_distr_multinormal( dim, NULL, NULL ); par = unur_gibbs_new(distr); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_c(par,-0.5); unur_gibbs_set_thinning(par,3); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); INFO_TEST_par("... & method=gibbs",gen); #endif unur_distr_free(distr); unur_free(gen); } { /* HINV */ UNUR_GEN *gen = NULL; gen = NULL; #ifdef UNUR_ENABLE_INFO METHOD("HINV"); INFO_TEST("normal & method=hinv"); INFO_TEST("cont; cdf='1-exp(-x)'; domain=(0,inf) & method=hinv"); INFO_TEST("cont; cdf='1-exp(-x)'; domain=(0,inf) & method=hinv; order=5"); INFO_TEST("cont; cdf='1-exp(-x)'; domain=(0,inf); mode=0 & method=hinv"); INFO_TEST("cont; cdf='1-exp(-x)'; domain=(0,inf) & method=hinv; u_resolution=1e-16"); INFO_TEST_chg("normal & method=hinv", unur_hinv_chg_truncated(gen,0.,1.)); #endif unur_free(gen); } { /* HIST */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double hist[] = {0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1}; double bins[] = {1.,2.,3.,4.,5.,6.,7.,8.,9.,10.}; distr = NULL; par = NULL; gen = NULL; #ifdef UNUR_ENABLE_INFO METHOD("HIST"); distr = unur_distr_cemp_new(); unur_distr_cemp_set_hist_prob(distr,hist,9); unur_distr_cemp_set_hist_domain(distr,1.,10.); par = unur_hist_new(distr); gen = unur_init(par); INFO_TEST_par("... & method=hist",gen); unur_distr_free(distr);unur_free(gen); distr = unur_distr_cemp_new(); unur_distr_cemp_set_hist_prob(distr,hist,9); unur_distr_cemp_set_hist_bins(distr,bins,10); unur_distr_cemp_set_hist_domain(distr,1.,10.); par = unur_hist_new(distr); gen = unur_init(par); INFO_TEST_par("... & method=hist",gen); #endif unur_distr_free(distr); unur_free(gen); } { /* HITRO */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; const int dim = 3; double mean[] = {1.,2.,3.}; double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; double ll[] = {0.,0.,0.}; double ru[] = {1.,UNUR_INFINITY,UNUR_INFINITY}; distr = NULL; par = NULL; gen = NULL; #ifdef UNUR_ENABLE_INFO METHOD("HITRO"); distr = unur_distr_multinormal( dim, mean, covar ); par = unur_hitro_new(distr); gen = unur_init(par); INFO_TEST_par("... & method=hitro",gen); unur_distr_free(distr);unur_free(gen); distr = unur_distr_multinormal( dim, NULL, NULL ); unur_distr_cvec_set_domain_rect( distr, ll, ru); par = unur_hitro_new(distr); gen = unur_init(par); INFO_TEST_par("... & method=hitro",gen); unur_distr_free(distr);unur_free(gen); distr = unur_distr_multinormal( dim, NULL, NULL ); par = unur_hitro_new(distr); gen = unur_init(par); INFO_TEST_par("... & method=hitro",gen); unur_distr_free(distr);unur_free(gen); distr = unur_distr_multinormal( dim, NULL, NULL ); par = unur_hitro_new(distr); unur_hitro_set_variant_random_direction(par); unur_hitro_set_r(par,2.); unur_hitro_set_thinning(par,3); unur_hitro_set_burnin(par,1000); gen = unur_init(par); INFO_TEST_par("... & method=hitro",gen); #endif unur_distr_free(distr); unur_free(gen); } { /* HRB */ UNUR_GEN *gen = NULL; gen = NULL; #ifdef UNUR_ENABLE_INFO METHOD("HRB"); INFO_TEST("cont; hr='1./(1.+x)' & method=hrb"); INFO_TEST("cont; hr='1./(1.+x)' & method=hrb;upperbound=1.1"); #endif unur_free(gen); } { /* HRD */ UNUR_GEN *gen = NULL; gen = NULL; #ifdef UNUR_ENABLE_INFO METHOD("HRD"); INFO_TEST("cont; hr='1./(1.+x)' & method=hrd"); #endif unur_free(gen); } { /* HRI */ UNUR_GEN *gen = NULL; gen = NULL; #ifdef UNUR_ENABLE_INFO METHOD("HRI"); INFO_TEST("cont; hr='3*x*x' & method=hri"); INFO_TEST("cont; hr='3*x*x' & method=hri;p0=0.8"); #endif unur_free(gen); } { /* ITDR */ UNUR_GEN *gen = NULL; gen = NULL; #ifdef UNUR_ENABLE_INFO METHOD("ITDR"); INFO_TEST("gamma(0.5) & method=itdr"); INFO_TEST("gamma(0.5) & method=itdr; cp=-0.5; ct=-0.5"); INFO_TEST("gamma(0.5) & method=itdr; cp=-0.5; ct=-0.5; xi=0.4"); INFO_TEST("cont; pdf='exp(-x)/sqrt(x)';mode=0;domain=(0,inf) & method=itdr"); #endif unur_free(gen); } { /* MCORR */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double eigenvalues[] = {1.,2.,3.,4.}; distr = NULL; par = NULL; gen = NULL; #ifdef UNUR_ENABLE_INFO METHOD("MCORR"); distr = unur_distr_correlation(4); par = unur_mcorr_new(distr); gen = unur_init(par); INFO_TEST_par("... & method=mcorr",gen); unur_distr_free(distr);unur_free(gen); distr = unur_distr_correlation(4); par = unur_mcorr_new(distr); unur_mcorr_set_eigenvalues( par, eigenvalues ); gen = unur_init(par); INFO_TEST_par("... & method=mcorr",gen); #endif unur_distr_free(distr); unur_free(gen); } { /* MIXT */ UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; UNUR_GEN *comp[3]; double prob[3] = {1,2,3}; par = NULL; gen = NULL; #ifdef UNUR_ENABLE_INFO METHOD("MIXT"); comp[0] = unur_str2gen("normal;domain=(-inf,-1)&method=pinv"); comp[1] = unur_str2gen("uniform(-1,1)&method=cstd"); comp[2] = unur_str2gen("exponential;domain=(1,inf)&method=pinv"); par = unur_mixt_new(3,prob,comp); gen = unur_init(par); INFO_TEST_par("... & method=mixt",gen); par = unur_mixt_new(3,prob,comp); unur_mixt_set_useinversion(par,TRUE); gen = unur_init(par); INFO_TEST_par("... & method=mixt; useinversion=ON",gen); unur_free(comp[0]); unur_free(comp[1]); unur_free(comp[2]); comp[0] = unur_str2gen("exponential&method=pinv"); comp[1] = unur_str2gen("poisson(5)&method=dgt"); par = unur_mixt_new(2,prob,comp); gen = unur_init(par); INFO_TEST_par("... & method=mixt",gen); unur_free(comp[0]); unur_free(comp[1]); comp[0] = unur_str2gen("binomial(100,0.05)&method=dgt"); comp[1] = unur_str2gen("poisson(5)&method=dgt"); par = unur_mixt_new(2,prob,comp); gen = unur_init(par); INFO_TEST_par("... & method=mixt",gen); unur_free(comp[0]); unur_free(comp[1]); #endif unur_free(gen); } { /* MVSTD */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; const int dim = 3; double mean[] = {1.,2.,3.}; double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; distr = NULL; par = NULL; gen = NULL; #ifdef UNUR_ENABLE_INFO METHOD("MVSTD"); distr = unur_distr_multinormal( dim, mean, covar ); par = unur_mvstd_new(distr); gen = unur_init(par); INFO_TEST_par("... & method=mvstd",gen); unur_distr_free(distr);unur_free(gen); distr = unur_distr_multinormal( dim, NULL, NULL ); par = unur_mvstd_new(distr); gen = unur_init(par); INFO_TEST_par("... & method=mvstd",gen); #endif unur_distr_free(distr); unur_free(gen); } { /* MVTDR */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; const int dim = 3; double mean[] = {1.,2.,3.}; double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; double ll[] = {0.,0.,0.}; double ru[] = {1.,UNUR_INFINITY,UNUR_INFINITY}; distr = NULL; par = NULL; gen = NULL; #ifdef UNUR_ENABLE_INFO METHOD("MVTDR"); distr = unur_distr_multinormal( dim, mean, covar ); par = unur_mvtdr_new(distr); gen = unur_init(par); INFO_TEST_par("... & method=mvtdr",gen); unur_distr_free(distr);unur_free(gen); distr = unur_distr_multinormal( dim, NULL, NULL ); unur_distr_cvec_set_domain_rect( distr, ll, ru); par = unur_mvtdr_new(distr); gen = unur_init(par); INFO_TEST_par("... & method=mvtdr",gen); unur_distr_free(distr);unur_free(gen); distr = unur_distr_multinormal( dim, NULL, NULL ); par = unur_mvtdr_new(distr); gen = unur_init(par); INFO_TEST_par("... & method=mvtdr",gen); unur_distr_free(distr);unur_free(gen); distr = unur_distr_multinormal( dim, NULL, NULL ); par = unur_mvtdr_new(distr); unur_mvtdr_set_stepsmin( par, 7 ); unur_mvtdr_set_boundsplitting( par, 1.2 ); unur_mvtdr_set_maxcones( par, 9999 ); gen = unur_init(par); INFO_TEST_par("... & method=mvtdr",gen); unur_distr_free(distr);unur_free(gen); distr = unur_distr_multinormal( dim, NULL, NULL ); par = unur_mvtdr_new(distr); unur_mvtdr_set_maxcones( par, 10 ); gen = unur_init(par); INFO_TEST_par("... & method=mvtdr",gen); #endif unur_distr_free(distr); unur_free(gen); } { /* NINV */ UNUR_GEN *gen = NULL; gen = NULL; #ifdef UNUR_ENABLE_INFO METHOD("NINV"); INFO_TEST("normal & method=ninv"); INFO_TEST("normal & method=ninv; usenewton"); INFO_TEST("normal & method=ninv; usebisect"); INFO_TEST("cont; cdf='1-exp(-x)'; domain=(0,inf) & method=ninv"); INFO_TEST_chg("normal & method=ninv", unur_ninv_chg_truncated(gen,0.,1.)); INFO_TEST("normal & method=ninv; x_resolution=1e-10"); INFO_TEST("normal & method=ninv; u_resolution=1e-10"); INFO_TEST("normal & method=ninv; u_resolution=1e-10; x_resolution=1e-10"); INFO_TEST("normal & method=ninv; u_resolution=1e-10; x_resolution=-1"); INFO_TEST("normal & method=ninv; max_iter=100"); INFO_TEST("normal & method=ninv; start=(-1,1)"); INFO_TEST("normal & method=ninv; table=123"); #endif unur_free(gen); } { /* NORTA */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; const int dim = 3; double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; double gamma_params[] = {5.}; double beta_params[] = {3.,5.}; UNUR_DISTR *marginal = NULL; distr = NULL; par = NULL; gen = NULL; #ifdef UNUR_ENABLE_INFO METHOD("NORTA"); distr = unur_distr_copula(dim, rankcorr); par = unur_norta_new(distr); gen = unur_init(par); INFO_TEST_par("... & method=norta",gen); unur_distr_free(distr);unur_free(gen); distr = unur_distr_cvec_new(dim); unur_distr_cvec_set_rankcorr(distr,rankcorr); marginal = unur_distr_gamma(gamma_params,1); unur_distr_cvec_set_marginals(distr,marginal); unur_distr_free(marginal); par = unur_norta_new(distr); gen = unur_init(par); INFO_TEST_par("... & method=norta",gen); unur_distr_free(distr);unur_free(gen); distr = unur_distr_cvec_new(dim); unur_distr_cvec_set_rankcorr(distr,rankcorr); unur_distr_cvec_set_marginal_list(distr, unur_distr_cauchy(NULL,0), unur_distr_gamma(gamma_params,1), unur_distr_beta(beta_params,2) ); par = unur_norta_new(distr); gen = unur_init(par); INFO_TEST_par("... & method=norta",gen); #endif unur_distr_free(distr); unur_free(gen); } { /* NROU */ UNUR_GEN *gen = NULL; gen = NULL; METHOD("NROU"); INFO_TEST("normal & method=nrou"); INFO_TEST("cont; pdf='exp(-x^2)' & method=nrou"); INFO_TEST("cont; pdf='exp(-x^2)' & method=nrou; r=2"); INFO_TEST("cont; pdf='exp(-x^2)' & method=nrou; v=1"); INFO_TEST("cont; pdf='exp(-x^2)' & method=nrou; u=(-0.61, 0.61)"); INFO_TEST("cont; pdf='exp(-x^2)' & method=nrou; v=1; u=(-0.61, 0.61)"); unur_free(gen); } { /* PINV */ UNUR_GEN *gen = NULL; gen = NULL; #ifdef UNUR_ENABLE_INFO METHOD("PINV"); INFO_TEST("normal & method=pinv"); INFO_TEST("normal & method=pinv; smoothness=1"); INFO_TEST("normal & method=pinv; smoothness=2"); INFO_TEST("normal & method=pinv; smoothness=1; order=6"); INFO_TEST("normal & method=pinv; usecdf"); INFO_TEST("normal & method=pinv; order=7; u_resolution=1e-14; use_upoints=on"); INFO_TEST("normal & method=pinv; boundary=(-10,10); searchboundary=(1,0)"); INFO_TEST("cont; cdf='1-exp(-x)'; domain=(0,inf) & method=pinv"); INFO_TEST("chisquare(2) & method=pinv"); INFO_TEST("normal & method=pinv; keepcdf=on"); #endif unur_free(gen); } { /* SROU */ UNUR_GEN *gen = NULL; gen = NULL; METHOD("SROU"); INFO_TEST("normal & method=srou"); INFO_TEST("cont; pdf='exp(-x^2)';pdfarea=1.773 & method=srou"); INFO_TEST("cont; pdf='exp(-x^2)';pdfarea=1.773 & method=srou; usemirror"); INFO_TEST("cont; pdf='exp(-x^2)';pdfarea=1.773 & method=srou; cdfatmode=0.5; usesqueeze"); INFO_TEST("cont; pdf='exp(-x^2)';pdfarea=1.773 & method=srou; r=2"); INFO_TEST("cont; pdf='exp(-x^2)';pdfarea=1.773 & method=srou; r=2; cdfatmode=0.5"); unur_free(gen); } { /* SSR */ UNUR_GEN *gen = NULL; gen = NULL; METHOD("SSR"); INFO_TEST("normal & method=ssr"); INFO_TEST("cont; pdf='exp(-x^2)';pdfarea=1.773 & method=ssr"); INFO_TEST("cont; pdf='exp(-x^2)';pdfarea=1.773 & method=ssr; cdfatmode=0.5; usesqueeze"); INFO_TEST("cont; pdf='exp(-x^2)';pdfarea=1.773 & method=ssr; cdfatmode=0.5"); INFO_TEST("cont; pdf='exp(-x^2)';domain=(0,inf);pdfarea=0.887 & method=ssr"); unur_free(gen); } { /* TABL */ UNUR_GEN *gen = NULL; gen = NULL; #ifdef UNUR_ENABLE_INFO METHOD("TABL"); INFO_TEST("normal & method=tabl"); INFO_TEST("normal & method=tabl;variant_ia=off;max_intervals=50"); INFO_TEST("cont; pdf='exp(-x^2)';mode=0 & method=tabl"); INFO_TEST("cont; pdf='exp(-x^2)';mode=0 & method=tabl; max_intervals=100; max_sqhratio=0.99"); INFO_TEST_chg("normal & method=tabl", unur_tabl_chg_truncated(gen,0.,1.)); #endif unur_free(gen); } { /* TDR */ UNUR_GEN *gen = NULL; gen = NULL; #ifdef UNUR_ENABLE_INFO METHOD("TDR"); INFO_TEST("normal & method=tdr"); INFO_TEST("normal & method=tdr; max_intervals=10; cpoints=3"); INFO_TEST("cont; pdf='exp(-x^2)' & method=tdr"); INFO_TEST("cont; pdf='exp(-x^2)' & method=tdr; c=0"); INFO_TEST("cont; pdf='exp(-x^2)' & method=tdr; c=0; variant_ia"); INFO_TEST("cont; pdf='exp(-x^2)' & method=tdr; c=0; variant_ia; max_intervals=1000"); INFO_TEST("cont; pdf='exp(-x^2)' & method=tdr; c=0; variant_ia; max_intervals=1000; max_sqhratio=0.90"); INFO_TEST_chg("normal & method=tdr", unur_tdr_chg_truncated(gen,0.,1.)); #endif unur_free(gen); } { /* UNIF */ UNUR_GEN *gen = NULL; gen = NULL; #ifdef UNUR_ENABLE_INFO METHOD("UNIF"); INFO_TEST("uniform(0,1) & method=unif"); #endif unur_free(gen); } { /* UTDR */ UNUR_GEN *gen = NULL; gen = NULL; #ifdef UNUR_ENABLE_INFO METHOD("UTDR"); INFO_TEST("normal & method=utdr"); INFO_TEST("cont; pdf='exp(-x^2)';pdfarea=1.773 & method=utdr"); INFO_TEST("cont; pdf='exp(-x^2)';pdfarea=1.773 & method=utdr;pdfatmode=1.0"); INFO_TEST("cont; pdf='exp(-x^2)';pdfarea=1.773 & method=utdr;deltafactor=1e-8"); #endif unur_free(gen); } { /* VEMPK */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double data[] = {1.,1.,-1.,1.,1.,-1.,-1.,-1. }; distr = NULL; par = NULL; gen = NULL; #ifdef UNUR_ENABLE_INFO METHOD("VEMPK"); distr = unur_distr_cvemp_new(2); unur_distr_cvemp_set_data(distr, data, 4); par = unur_vempk_new(distr); gen = unur_init(par); INFO_TEST_par("... & method=vempk",gen); unur_distr_free(distr);unur_free(gen); distr = unur_distr_cvemp_new(2); unur_distr_cvemp_set_data(distr, data, 4); par = unur_vempk_new(distr); unur_vempk_set_smoothing(par,1.5); unur_vempk_set_varcor(par,TRUE); gen = unur_init(par); INFO_TEST_par("... & method=vempk",gen); #endif unur_distr_free(distr); unur_free(gen); } { /* VNROU */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; const int dim = 3; double mean[] = {1.,2.,3.}; double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; double ll[] = {0.,0.,0.}; double ru[] = {1.,UNUR_INFINITY,UNUR_INFINITY}; distr = NULL; par = NULL; gen = NULL; #ifdef UNUR_ENABLE_INFO METHOD("VNROU"); distr = unur_distr_multinormal( dim, mean, covar ); par = unur_vnrou_new(distr); gen = unur_init(par); INFO_TEST_par("... & method=vnrou",gen); unur_distr_free(distr);unur_free(gen); distr = unur_distr_multinormal( dim, NULL, NULL ); unur_distr_cvec_set_domain_rect( distr, ll, ru); par = unur_vnrou_new(distr); gen = unur_init(par); INFO_TEST_par("... & method=vnrou",gen); unur_distr_free(distr);unur_free(gen); distr = unur_distr_multinormal( dim, NULL, NULL ); par = unur_vnrou_new(distr); unur_vnrou_set_r(par,2.); gen = unur_init(par); INFO_TEST_par("... & method=vnrou",gen); #endif unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_info_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_empl.c0000644001357500135600000003503714430713513012634 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for EMPL **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); int unur_empl_set_verify( UNUR_PAR *par, int verify); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ #define COMPARE_SAMPLE_SIZE (10000) #define VIOLATE_SAMPLE_SIZE (20) /* sample size for Gaussian distributet sample */ #define samplesize (5000) UNUR_DISTR *get_distr_with_data( void ); UNUR_DISTR *get_distr_with_Gaussian_data( void ); double urng_ed (void *dummy); /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ /*---------------------------------------------------------------------------*/ UNUR_DISTR *get_distr_with_data( void ) { #define PV_SIZE 20 double pv[PV_SIZE]; UNUR_DISTR *distr; int i; for (i=0; itime = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [init] */ void test_init (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[init "); fflush(stdout); fprintf(TESTLOG,"\n[init]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,67,(unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,67,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* run init */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = get_distr_with_data(); par = unur_empl_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 72, gen ); unur_reset_errno(); ; n_tests_failed += (check_errorcode(TESTLOG,76,0x0u)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_init() */ /*---------------------------------------------------------------------------*/ /* [reinit] */ void test_reinit (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[reinit "); fflush(stdout); fprintf(TESTLOG,"\n[reinit]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* does not exist */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = get_distr_with_data(); par = unur_empl_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 84, gen ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,88,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,88,UNUR_ERR_NO_REINIT)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,91,(unur_sample_cont( gen )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,91,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_reinit() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* compare clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; UNUR_GEN *clone; distr = get_distr_with_data(); par = unur_empl_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 101, gen ); unur_reset_errno(); /* default generator object */; n_tests_failed += (compare_sequence_gen_start(TESTLOG,105,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,111,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare stringparser */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double data[] = {1.,2.,3.,4.,5.,6.,7.,8.,9.}; distr = NULL; par = NULL; gen = NULL; unur_reset_errno(); distr = unur_distr_cemp_new(); unur_distr_cemp_set_data(distr,data,9); par = unur_empl_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,126,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "cemp; data = (1.,2.,3.,4.,5.,6.,7.,8.,9.) & \ method = empl" ); n_tests_failed += (compare_sequence_gen(TESTLOG,132,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* [validate] */ /*---------------------------------------------------------------------------*/ /* [validate] */ void test_validate (void) { /* suppress GCC compiler warning */ GCC_DIAG_OFF(unused-variable) UNUR_DISTR *distr[1]; UNUR_PAR *par; UNUR_GEN *gen; double *darray; double fpm[10]; int n_tests_failed; int rcode; /* start test */ printf("[validate "); fflush(stdout); fprintf(TESTLOG,"\n[validate]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* distributions: 1 */ { distr[0] = get_distr_with_Gaussian_data(); } /* timing */ stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); printf("\n(chi^2) "); fflush(stdout); /* chi^2 tests: 1 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nChi^2 Test:\n"); /* distribution [0] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_empl_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); /* free distributions */ unur_distr_free(distr[0]); /* test finished */ test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; /* we accept CHI2_FAILURES_TOLERATED failures */ (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_validate */ /* enable GCC compiler warning */ GCC_DIAG_ON(unused-variable) /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_empl_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_cstd.c0000644001357500135600000054302114430713513012631 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for CSTD **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); int unur_cstd_set_verify( UNUR_PAR *par, int verify); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* -- prototypes -- */ int estimate_uerror( UNUR_DISTR *distr, double u_resolution, int samplesize ); double cdf_exp(double x, const UNUR_DISTR *distr); double invcdf_exp(double u, const UNUR_DISTR *distr); /* -- constants -- */ /* sample size */ static const int UERROR_SAMPLESIZE = 100000; static const double UERROR_RESOLUTION = 1.e-14; #define COMPARE_SAMPLE_SIZE (500) #define VIOLATE_SAMPLE_SIZE (20) /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ int estimate_uerror( UNUR_DISTR *distr, /* distribution object */ double u_resolution, /* maximal tolerated u-error */ int samplesize ) /* sample size for error experiment */ /* returns 0 if maxerror < u_resolution, errorcode otherwise */ { UNUR_PAR *par; UNUR_GEN *gen; int i, nfpar; const double *fpar; double score; /* print data about distribution */ fprintf(TESTLOG,"> %s (",unur_distr_get_name(distr)); nfpar = unur_distr_cont_get_pdfparams(distr,&fpar); for(i=0;i inversion method not implemented !!\n\n"); printf("0"); fflush(stdout); if (par) unur_par_free(par); unur_distr_free(distr); return 0; } /* initialize generator object */ gen = unur_init(par); /* run test */ score = run_validate_u_error( TESTLOG, gen, distr, u_resolution, samplesize ); /* clear working space */ unur_distr_free(distr); unur_free(gen); /* return */ fprintf(TESTLOG,"\n"); return score; } /* end of estimate_uerror() */ double cdf_exp(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return ((x<0.) ? 0. : 1.-exp(-x)); } double invcdf_exp(double u, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return (-log(1.- u)); } /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,36,(unur_cstd_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,36,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,42,(unur_cstd_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,42,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* not a standard distribution and missing inverse CDF */ UNUR_DISTR *distr = NULL; distr = unur_distr_cont_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,48,(unur_cstd_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,48,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [set] */ void test_set (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[set "); fflush(stdout); fprintf(TESTLOG,"\n[set]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,58,(unur_cstd_set_variant(par,1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,58,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* invalid parameter object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_arou_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,66,(unur_cstd_set_variant(par,1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,66,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = unur_distr_normal(NULL,0); par = unur_cstd_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,75,(unur_cstd_set_variant(par,9999)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,75,UNUR_ERR_PAR_VARIANT)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_set() */ /*---------------------------------------------------------------------------*/ /* [chg] */ void test_chg (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[chg "); fflush(stdout); fprintf(TESTLOG,"\n[chg]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid generator object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_arou_new(distr); unur_set_debug(par,0); gen = unur_init( par ); abort_if_NULL(TESTLOG, 91, gen ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,95,(unur_cstd_chg_truncated(gen, 0., 1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,95,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_chg() */ /*---------------------------------------------------------------------------*/ /* [init] */ void test_init (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[init "); fflush(stdout); fprintf(TESTLOG,"\n[init]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,106,(unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,106,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_init() */ /*---------------------------------------------------------------------------*/ /* [reinit] */ void test_reinit (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[reinit "); fflush(stdout); fprintf(TESTLOG,"\n[reinit]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* does not exist */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_cstd_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 115, gen ); unur_reset_errno(); n_tests_failed += (check_expected_reinit(TESTLOG,119,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_reinit() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* compare clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; UNUR_GEN *clone; double fpar[] = { 1., 2.}; distr = unur_distr_normal(fpar,2); par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_cstd_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,135,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,141,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare stringparser */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[] = {3., 4.}; distr = NULL; par = NULL; gen = NULL; unur_reset_errno(); distr = unur_distr_gamma(fpar,2); par = unur_cstd_new(distr); unur_cstd_set_variant(par,2); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,155,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "gamma(3.,4.) & method = cstd; variant = 2" ); n_tests_failed += (compare_sequence_gen(TESTLOG,160,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* [validate] */ /*---------------------------------------------------------------------------*/ /* [validate] */ void test_validate (void) { /* suppress GCC compiler warning */ GCC_DIAG_OFF(unused-variable) UNUR_DISTR *distr[87]; UNUR_PAR *par; UNUR_GEN *gen; double *darray; double fpm[10]; int n_tests_failed; int rcode; /* start test */ printf("[validate "); fflush(stdout); fprintf(TESTLOG,"\n[validate]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* distributions: 87 */ { fpm[0] = 1.; fpm[1] = 2.; distr[0] = unur_distr_beta(fpm,2); } { fpm[0] = 1.; fpm[1] = 5.; distr[1] = unur_distr_beta(fpm,2); } { fpm[0] = 5.; fpm[1] = 1.; distr[80] = unur_distr_beta(fpm,2); } { fpm[0] = 1.; fpm[1] = 1.; distr[81] = unur_distr_beta(fpm,2); } { fpm[0] = 7.; fpm[1] = 0.5; distr[60] = unur_distr_beta(fpm,2); } { fpm[0] = 0.7; fpm[1] = 0.5; distr[61] = unur_distr_beta(fpm,2); } { fpm[0] = 7.; fpm[1] = 0.1; fpm[2] = -1.; fpm[3] = 2.; distr[62] = unur_distr_beta(fpm,4); } { fpm[0] = 1.; fpm[1] = 100.; distr[2] = unur_distr_beta(fpm,2); } { fpm[0] = 3.; fpm[1] = 4.; distr[3] = unur_distr_beta(fpm,2); } { fpm[0] = 5.; fpm[1] = 100.; distr[4] = unur_distr_beta(fpm,2); } { fpm[0] = 500.; fpm[1] = 300.; distr[5] = unur_distr_beta(fpm,2); } { fpm[0] = 5.; fpm[1] = 10.; fpm[2] = -3.; fpm[3] = 15.; distr[6] = unur_distr_beta(fpm,4); } { fpm[0] = 1; distr[66] = unur_distr_burr(fpm,1); } { fpm[0] = 2; fpm[1] = 2; distr[67] = unur_distr_burr(fpm,2); } { fpm[0] = 3; fpm[1] = 2; fpm[2] = 2; distr[68] = unur_distr_burr(fpm,3); } { fpm[0] = 4; fpm[1] = 2; fpm[2] = 2; distr[69] = unur_distr_burr(fpm,3); } { fpm[0] = 5; fpm[1] = 2; fpm[2] = 2; distr[70] = unur_distr_burr(fpm,3); } { fpm[0] = 6; fpm[1] = 2; fpm[2] = 2; distr[71] = unur_distr_burr(fpm,3); } { fpm[0] = 7; fpm[1] = 2; distr[72] = unur_distr_burr(fpm,2); } { fpm[0] = 8; fpm[1] = 2; distr[73] = unur_distr_burr(fpm,2); } { fpm[0] = 9; fpm[1] = 2; fpm[2] = 2; distr[74] = unur_distr_burr(fpm,3); } { fpm[0] = 10; fpm[1] = 2; distr[75] = unur_distr_burr(fpm,2); } { fpm[0] = 11; fpm[1] = 2; distr[76] = unur_distr_burr(fpm,2); } { fpm[0] = 12; fpm[1] = 2; fpm[2] = 2; distr[77] = unur_distr_burr(fpm,3); } { distr[7] = unur_distr_cauchy(NULL,0); } { fpm[0] = 1.; fpm[1] = 20.; distr[8] = unur_distr_cauchy(fpm,2); } { fpm[0] = 0.5; distr[23] = unur_distr_chi(fpm,1); } { fpm[0] = 1.; distr[24] = unur_distr_chi(fpm,1); } { fpm[0] = 2.; distr[25] = unur_distr_chi(fpm,1); } { fpm[0] = 50.; distr[26] = unur_distr_chi(fpm,1); } { distr[27] = unur_distr_exponential(NULL,0); } { fpm[0] = 0.5; distr[28] = unur_distr_exponential(fpm,1); } { fpm[0] = 5.; fpm[1] = -3.; distr[29] = unur_distr_exponential(fpm,2); } { distr[30] = unur_distr_extremeI(NULL,0); } { fpm[0] = -3.; distr[31] = unur_distr_extremeI(fpm,1); } { fpm[0] = -1.; fpm[1] = 5.; distr[32] = unur_distr_extremeI(fpm,2); } { fpm[0] = 3.; distr[33] = unur_distr_extremeII(fpm,1); } { fpm[0] = 0.5; fpm[1] = -3.; distr[34] = unur_distr_extremeII(fpm,2); } { fpm[0] = 0.8; fpm[1] = -1.; fpm[2] = 5.; distr[35] = unur_distr_extremeII(fpm,3); } { fpm[0] = 1.; distr[9] = unur_distr_gamma(fpm,1); } { fpm[0] = 2.; distr[10] = unur_distr_gamma(fpm,1); } { fpm[0] = 3.; distr[11] = unur_distr_gamma(fpm,1); } { fpm[0] = 10.; distr[12] = unur_distr_gamma(fpm,1); } { fpm[0] = 1000.; distr[13] = unur_distr_gamma(fpm,1); } { fpm[0] = 5.; fpm[1] = 1000.; distr[14] = unur_distr_gamma(fpm,2); } { fpm[0] = 5.; fpm[1] = 1.e-5; distr[15] = unur_distr_gamma(fpm,2); } { fpm[0] = 5.; fpm[1] = 10.; fpm[2] = 1000; distr[16] = unur_distr_gamma(fpm,3); } { fpm[0] = 0.5; distr[63] = unur_distr_gamma(fpm,1); } { fpm[0] = 0.2; distr[64] = unur_distr_gamma(fpm,1); } { fpm[0] = 0.5; fpm[1] = 7; fpm[2] = 1; distr[83] = unur_distr_gig(fpm,3); } { fpm[0] = 0.5; fpm[1] = 0.5; fpm[2] = 1; distr[86] = unur_distr_gig(fpm,3); } { distr[36] = unur_distr_laplace(NULL,0); } { fpm[0] = -3.; distr[37] = unur_distr_laplace(fpm,1); } { fpm[0] = -1.; fpm[1] = 5.; distr[38] = unur_distr_laplace(fpm,2); } { distr[39] = unur_distr_logistic(NULL,0); } { fpm[0] = -3.; distr[40] = unur_distr_logistic(fpm,1); } { fpm[0] = -1.; fpm[1] = 5.; distr[41] = unur_distr_logistic(fpm,2); } { fpm[0] = 2.; fpm[1] = 3.; distr[56] = unur_distr_lomax(fpm,2); } { fpm[0] = 20.; fpm[1] = 0.4; distr[57] = unur_distr_lomax(fpm,2); } { fpm[0] = 0.2; fpm[1] = 40.; distr[58] = unur_distr_lomax(fpm,2); } { fpm[0] = 0.2; fpm[1] = 0.5; distr[59] = unur_distr_lomax(fpm,2); } { distr[17] = unur_distr_normal(NULL,0); } { fpm[0] = 1.; fpm[1] = 1.e-5; distr[18] = unur_distr_normal(fpm,2); } { fpm[0] = 0.; fpm[1] = 1.e+5; distr[19] = unur_distr_normal(fpm,2); } { fpm[0] = 2.; fpm[1] = 3.; distr[52] = unur_distr_pareto(fpm,2); } { fpm[0] = 20.; fpm[1] = 0.4; distr[53] = unur_distr_pareto(fpm,2); } { fpm[0] = 0.2; fpm[1] = 40.; distr[54] = unur_distr_pareto(fpm,2); } { fpm[0] = 0.2; fpm[1] = 0.5; distr[55] = unur_distr_pareto(fpm,2); } { fpm[0] = 0.5; distr[42] = unur_distr_powerexponential(fpm,1); } { fpm[0] = 1.; distr[43] = unur_distr_powerexponential(fpm,1); } { fpm[0] = 2.; distr[44] = unur_distr_powerexponential(fpm,1); } { fpm[0] = 10.; distr[45] = unur_distr_powerexponential(fpm,1); } { fpm[0] = 1.; distr[65] = unur_distr_rayleigh(fpm,1); } { distr[82] = unur_distr_slash(NULL,0); } { fpm[0] = 2; distr[84] = unur_distr_student(fpm,1); } { fpm[0] = 0.5; distr[85] = unur_distr_student(fpm,1); } { fpm[0] = 0.7; distr[46] = unur_distr_triangular(fpm,1); } { fpm[0] = 0.; distr[47] = unur_distr_triangular(fpm,1); } { fpm[0] = 1.; distr[48] = unur_distr_triangular(fpm,1); } { distr[20] = unur_distr_uniform(NULL,0); } { fpm[0] = 1.; fpm[1] = 20.; distr[21] = unur_distr_uniform(fpm,2); } { fpm[0] = 3.; distr[49] = unur_distr_weibull(fpm,1); } { fpm[0] = 0.5; fpm[1] = 3.; distr[50] = unur_distr_weibull(fpm,2); } { fpm[0] = 1.5; fpm[1] = 2.; fpm[2] = -5.; distr[51] = unur_distr_weibull(fpm,3); } { distr[22] = unur_distr_cauchy(NULL,0); unur_distr_cont_set_domain(distr[22],0.1,1.); unur_distr_cont_upd_mode(distr[22]); unur_distr_cont_upd_pdfarea(distr[22]); } { distr[78] = unur_distr_cont_new(); unur_distr_set_name( distr[78], "CDF_only" ); unur_distr_cont_set_domain( distr[78], 0, UNUR_INFINITY ); unur_distr_cont_set_cdf( distr[78], cdf_exp ); } { distr[79] = unur_distr_cont_new(); unur_distr_set_name( distr[79], "CDF&invCDF" ); unur_distr_cont_set_domain( distr[79], 0, UNUR_INFINITY ); unur_distr_cont_set_cdf( distr[79], cdf_exp ); unur_distr_cont_set_invcdf( distr[79], invcdf_exp ); } /* timing */ stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); printf("\n(chi^2) "); fflush(stdout); /* chi^2 tests: 1044 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nChi^2 Test:\n"); /* distribution [0] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [1] */ if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [80] */ if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[80]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[80],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[80]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[80],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [81] */ if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[81]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[81],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[81]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[81],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [2] */ if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [3] */ if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [60] */ if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[60]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[60],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[60]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[60],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [61] */ if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[61]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[61],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[61]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[61],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [4] */ if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [5] */ if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [6] */ if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [66] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[66]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[66],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [67] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[67]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[67],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [68] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[68]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[68],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [69] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[69]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[69],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [70] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[70]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[70],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [71] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[71]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[71],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [72] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[72]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[72],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [73] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[73]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[73],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [74] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[74]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[74],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [75] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[75]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[75],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [76] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[76]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[76],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [77] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[77]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[77],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [7] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); if (gen) { unur_cstd_chg_truncated(gen,0.5,0.55); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [8] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); if (gen) { unur_cstd_chg_truncated(gen,0.5,0.55); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [23] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [24] */ if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [25] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [26] */ if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [27] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); if (gen) { unur_cstd_chg_truncated(gen,0.5,0.55); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [28] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); if (gen) { unur_cstd_chg_truncated(gen,0.5,0.55); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [29] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); if (gen) { unur_cstd_chg_truncated(gen,0.5,0.55); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [30] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); if (gen) { unur_cstd_chg_truncated(gen,0.5,0.55); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [31] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); if (gen) { unur_cstd_chg_truncated(gen,0.5,0.55); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [32] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); if (gen) { unur_cstd_chg_truncated(gen,0.5,0.55); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [33] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); if (gen) { unur_cstd_chg_truncated(gen,0.5,0.55); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [34] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); if (gen) { unur_cstd_chg_truncated(gen,0.5,0.55); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [35] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); if (gen) { unur_cstd_chg_truncated(gen,0.5,0.55); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [9] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [10] */ if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [11] */ if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [12] */ if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [13] */ if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [14] */ if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [15] */ if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [16] */ if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [63] */ if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[63]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[63],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[63]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[63],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[63]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[63],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [64] */ if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[64]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[64],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[64]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[64],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[64]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[64],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [83] */ if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[83]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[83],'%'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [86] */ if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[86]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[86],'%'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [36] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); if (gen) { unur_cstd_chg_truncated(gen,0.5,0.55); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [37] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[37]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[37],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[37]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); if (gen) { unur_cstd_chg_truncated(gen,0.5,0.55); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[37],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[37]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[37],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [38] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[38]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[38],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[38]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); if (gen) { unur_cstd_chg_truncated(gen,0.5,0.55); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[38],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[38]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[38],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [39] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[39]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[39],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[39]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); if (gen) { unur_cstd_chg_truncated(gen,0.5,0.55); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[39],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[39]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[39],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [40] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[40]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[40],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[40]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); if (gen) { unur_cstd_chg_truncated(gen,0.5,0.55); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[40],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[40]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[40],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [41] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[41]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[41],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[41]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); if (gen) { unur_cstd_chg_truncated(gen,0.5,0.55); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[41],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[41]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[41],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [56] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[56]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[56],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[56]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); if (gen) { unur_cstd_chg_truncated(gen,0.5,0.55); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[56],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[56]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[56],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [57] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[57]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[57],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[57]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); if (gen) { unur_cstd_chg_truncated(gen,0.5,0.55); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[57],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[57]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[57],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [58] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[58]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[58],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[58]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); if (gen) { unur_cstd_chg_truncated(gen,0.5,0.55); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[58],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[58]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[58],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [59] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[59]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[59],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[59]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); if (gen) { unur_cstd_chg_truncated(gen,0.5,0.55); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[59],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[59]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[59],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [17] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,3)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,4)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,5)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,6)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,7)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); if (gen) { unur_cstd_chg_truncated(gen,0.5,0.55); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'/'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [18] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,3)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,4)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,5)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,6)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,7)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [19] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,3)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,4)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,5)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,6)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,7)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); if (gen) { unur_cstd_chg_truncated(gen,0.5,0.55); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'/'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [52] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[52]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[52],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[52]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[52],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [53] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[53]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[53],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[53]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[53],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [54] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[54]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[54],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[54]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[54],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [55] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[55]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[55],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[55]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); if (gen) { unur_cstd_chg_truncated(gen,0.5,0.55); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[55],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[55]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[55],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [42] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[42]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[42],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[42]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[42],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [43] */ if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[43]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[43],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[43]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[43],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [44] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[44]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[44],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[44]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[44],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [45] */ if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[45]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[45],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [65] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[65]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[65],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[65]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[65],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [82] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[82]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[82],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[82]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[82],'%'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [84] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[84]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[84],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[84]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[84],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[84]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[84],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [85] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[85]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[85],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[85]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[85],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[85]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[85],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [46] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[46]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[46],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[46]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); if (gen) { unur_cstd_chg_truncated(gen,0.5,0.55); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[46],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [47] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[47]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[47],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[47]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); if (gen) { unur_cstd_chg_truncated(gen,0.5,0.55); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[47],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [48] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[48]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[48],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[48]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); if (gen) { unur_cstd_chg_truncated(gen,0.5,0.55); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[48],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [49] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[49]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[49],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[49]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); if (gen) { unur_cstd_chg_truncated(gen,0.5,0.55); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[49],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[49]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[49],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [50] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[50]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[50],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[50]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); if (gen) { unur_cstd_chg_truncated(gen,0.5,0.55); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[50],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[50]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[50],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [51] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[51]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[51],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[51]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); if (gen) { unur_cstd_chg_truncated(gen,0.5,0.55); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[51],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[51]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[51],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [20] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); if (gen) { unur_cstd_chg_truncated(gen,0.5,0.55); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [21] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [22] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); if (gen) { unur_cstd_chg_truncated(gen,0.5,0.55); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); { UNUR_DISTR *dg =NULL; par = unur_cstd_new(distr_localcopy); fpm[0] = 2.; fpm[1] = 5.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [78] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[78]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[78],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [79] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[79]); par = unur_cstd_new(distr_localcopy); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[79],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); /* free distributions */ unur_distr_free(distr[0]); unur_distr_free(distr[1]); unur_distr_free(distr[2]); unur_distr_free(distr[3]); unur_distr_free(distr[4]); unur_distr_free(distr[5]); unur_distr_free(distr[6]); unur_distr_free(distr[7]); unur_distr_free(distr[8]); unur_distr_free(distr[9]); unur_distr_free(distr[10]); unur_distr_free(distr[11]); unur_distr_free(distr[12]); unur_distr_free(distr[13]); unur_distr_free(distr[14]); unur_distr_free(distr[15]); unur_distr_free(distr[16]); unur_distr_free(distr[17]); unur_distr_free(distr[18]); unur_distr_free(distr[19]); unur_distr_free(distr[20]); unur_distr_free(distr[21]); unur_distr_free(distr[22]); unur_distr_free(distr[23]); unur_distr_free(distr[24]); unur_distr_free(distr[25]); unur_distr_free(distr[26]); unur_distr_free(distr[27]); unur_distr_free(distr[28]); unur_distr_free(distr[29]); unur_distr_free(distr[30]); unur_distr_free(distr[31]); unur_distr_free(distr[32]); unur_distr_free(distr[33]); unur_distr_free(distr[34]); unur_distr_free(distr[35]); unur_distr_free(distr[36]); unur_distr_free(distr[37]); unur_distr_free(distr[38]); unur_distr_free(distr[39]); unur_distr_free(distr[40]); unur_distr_free(distr[41]); unur_distr_free(distr[42]); unur_distr_free(distr[43]); unur_distr_free(distr[44]); unur_distr_free(distr[45]); unur_distr_free(distr[46]); unur_distr_free(distr[47]); unur_distr_free(distr[48]); unur_distr_free(distr[49]); unur_distr_free(distr[50]); unur_distr_free(distr[51]); unur_distr_free(distr[52]); unur_distr_free(distr[53]); unur_distr_free(distr[54]); unur_distr_free(distr[55]); unur_distr_free(distr[56]); unur_distr_free(distr[57]); unur_distr_free(distr[58]); unur_distr_free(distr[59]); unur_distr_free(distr[60]); unur_distr_free(distr[61]); unur_distr_free(distr[62]); unur_distr_free(distr[63]); unur_distr_free(distr[64]); unur_distr_free(distr[65]); unur_distr_free(distr[66]); unur_distr_free(distr[67]); unur_distr_free(distr[68]); unur_distr_free(distr[69]); unur_distr_free(distr[70]); unur_distr_free(distr[71]); unur_distr_free(distr[72]); unur_distr_free(distr[73]); unur_distr_free(distr[74]); unur_distr_free(distr[75]); unur_distr_free(distr[76]); unur_distr_free(distr[77]); unur_distr_free(distr[78]); unur_distr_free(distr[79]); unur_distr_free(distr[80]); unur_distr_free(distr[81]); unur_distr_free(distr[82]); unur_distr_free(distr[83]); unur_distr_free(distr[84]); unur_distr_free(distr[85]); unur_distr_free(distr[86]); /* test finished */ test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; /* we accept CHI2_FAILURES_TOLERATED failures */ (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_validate */ /* enable GCC compiler warning */ GCC_DIAG_ON(unused-variable) /*---------------------------------------------------------------------------*/ /* [special] */ void test_special (void) { /* set boolean to FALSE */ int FAILED = 0; int samplesize = UERROR_SAMPLESIZE; double ures = UERROR_RESOLUTION; int errorsum = 0; double fpar[5]; UNUR_DISTR *distr; /* start test */ printf("[special "); fflush(stdout); fprintf(TESTLOG,"\n[special]\n"); /* set stop watch */ stopwatch_lap(&watch); /* test for maximal u-error */ printf("\n[test maximal u-error for inversion method]\n"); fprintf(TESTLOG,"\n* Test maximal u-error for inversion method *\n"); printf(" beta"); fpar[0] = 3.; fpar[1] = 4.; distr = unur_distr_beta(fpar,2); errorsum += estimate_uerror(distr,ures,samplesize); fpar[0] = 1.; fpar[1] = 2.; fpar[2] = 3.; fpar[3] = 4.; distr = unur_distr_beta(fpar,4); errorsum += estimate_uerror(distr,ures,samplesize); printf(" burr"); fpar[0] = 1.; distr = unur_distr_burr(fpar,1); errorsum += estimate_uerror(distr,ures,samplesize); fpar[0] = 2.; fpar[1] = 2.; distr = unur_distr_burr(fpar,2); errorsum += estimate_uerror(distr,ures,samplesize); fpar[0] = 3.; fpar[1] = 2.; fpar[2] = 3.; distr = unur_distr_burr(fpar,3); errorsum += estimate_uerror(distr,ures,samplesize); fpar[0] = 4.; fpar[1] = 1.; fpar[2] = 2.; distr = unur_distr_burr(fpar,3); errorsum += estimate_uerror(distr,1e-10,samplesize); /* computation of CDF and /or inverse CDF is not seem very accurate */ fpar[0] = 5.; fpar[1] = 2.; fpar[2] = 3.; distr = unur_distr_burr(fpar,3); errorsum += estimate_uerror(distr,ures,samplesize); fpar[0] = 6.; fpar[1] = 2.; fpar[2] = 3.; distr = unur_distr_burr(fpar,3); errorsum += estimate_uerror(distr,ures,samplesize); fpar[0] = 7.; fpar[1] = 2.; fpar[2] = 3.; distr = unur_distr_burr(fpar,3); errorsum += estimate_uerror(distr,ures,samplesize); fpar[0] = 8.; fpar[1] = 2.; distr = unur_distr_burr(fpar,2); errorsum += estimate_uerror(distr,ures,samplesize); fpar[0] = 9.; fpar[1] = 2.; fpar[2] = 3.; distr = unur_distr_burr(fpar,3); errorsum += estimate_uerror(distr,ures,samplesize); fpar[0] = 10.; fpar[1] = 2.; distr = unur_distr_burr(fpar,2); errorsum += estimate_uerror(distr,ures,samplesize); fpar[0] = 11.; fpar[1] = 2.; distr = unur_distr_burr(fpar,2); errorsum += estimate_uerror(distr,ures,samplesize); fpar[0] = 12.; fpar[1] = 2.; fpar[2] = 3.; distr = unur_distr_burr(fpar,3); errorsum += estimate_uerror(distr,ures,samplesize); printf(" cauchy"); fpar[0] = 1.; fpar[1] = 2.; distr = unur_distr_cauchy(fpar,2); errorsum += estimate_uerror(distr,ures,samplesize); printf(" chi"); fpar[0] = 3.; distr = unur_distr_chi(fpar,1); errorsum += estimate_uerror(distr,ures,samplesize); printf(" chisquare"); fpar[0] = 3.; distr = unur_distr_chisquare(fpar,1); errorsum += estimate_uerror(distr,ures,samplesize); printf(" exponential"); fpar[0] = 1.; fpar[1] = 2.; distr = unur_distr_exponential(fpar,2); errorsum += estimate_uerror(distr,ures,samplesize); printf(" extremeI"); fpar[0] = 1.; fpar[1] = 2.; distr = unur_distr_extremeI(fpar,2); errorsum += estimate_uerror(distr,ures,samplesize); printf(" extremeII"); fpar[0] = 1.; fpar[1] = 2.; fpar[2] = 3.; distr = unur_distr_extremeII(fpar,3); errorsum += estimate_uerror(distr,ures,samplesize); printf(" F"); fpar[0] = 3.; fpar[1] = 4.; distr = unur_distr_F(fpar,2); errorsum += estimate_uerror(distr,ures,samplesize); printf(" gamma"); fpar[0] = 5.; distr = unur_distr_gamma(fpar,1); errorsum += estimate_uerror(distr,ures,samplesize); fpar[0] = 4.; fpar[1] = 3.; distr = unur_distr_gamma(fpar,2); errorsum += estimate_uerror(distr,ures,samplesize); fpar[0] = 3.; fpar[1] = 2.; fpar[2] = 1.; distr = unur_distr_gamma(fpar,3); errorsum += estimate_uerror(distr,ures,samplesize); printf(" gig"); fpar[0] = 1.; fpar[1] = 2.; fpar[1] = 3.; distr = unur_distr_gig(fpar,3); errorsum += estimate_uerror(distr,ures,samplesize); printf(" gig2"); fpar[0] = 1.; fpar[1] = 2.; fpar[2] = 3.; distr = unur_distr_gig2(fpar,3); errorsum += estimate_uerror(distr,ures,samplesize); printf(" ghyp"); fpar[0] = 1.; fpar[1] = 3.; fpar[2] = 2.; fpar[3] = 4.; fpar[4] = 5.; distr = unur_distr_ghyp(fpar,5); errorsum += estimate_uerror(distr,ures,samplesize); printf(" hyperbolic"); fpar[0] = 3.; fpar[1] = 2.; fpar[2] = 2.; fpar[3] = 2.; distr = unur_distr_hyperbolic(fpar,4); errorsum += estimate_uerror(distr,ures,samplesize); printf(" ig"); fpar[0] = 1.; fpar[1] = 2.; distr = unur_distr_ig(fpar,2); errorsum += estimate_uerror(distr,ures,samplesize); printf(" laplace"); fpar[0] = 1.; fpar[1] = 2.; distr = unur_distr_laplace(fpar,2); errorsum += estimate_uerror(distr,ures,samplesize); printf(" logistic"); fpar[0] = 1.; fpar[1] = 2.; distr = unur_distr_logistic(fpar,2); errorsum += estimate_uerror(distr,ures,samplesize); printf(" lognormal"); fpar[0] = 1.; fpar[1] = 2.; fpar[2] = 3.; distr = unur_distr_lognormal(fpar,3); errorsum += estimate_uerror(distr,ures,samplesize); printf(" lomax"); fpar[0] = 1.; fpar[1] = 2.; distr = unur_distr_lomax(fpar,2); errorsum += estimate_uerror(distr,ures,samplesize); printf(" normal"); fpar[0] = 1.; fpar[1] = 2.; distr = unur_distr_normal(fpar,2); errorsum += estimate_uerror(distr,ures,samplesize); printf(" pareto"); fpar[0] = 1.; fpar[1] = 2.; distr = unur_distr_pareto(fpar,2); errorsum += estimate_uerror(distr,ures,samplesize); printf(" powerexponential"); fpar[0] = 3.; distr = unur_distr_powerexponential(fpar,1); errorsum += estimate_uerror(distr,ures,samplesize); printf(" rayleigh"); fpar[0] = 2.; distr = unur_distr_rayleigh(fpar,1); errorsum += estimate_uerror(distr,ures,samplesize); printf(" slash"); distr = unur_distr_slash(NULL,0); errorsum += estimate_uerror(distr,ures,samplesize); printf(" student"); fpar[0] = 4.4; distr = unur_distr_student(fpar,1); errorsum += estimate_uerror(distr,ures,samplesize); printf(" triangular"); fpar[0] = 0.7; distr = unur_distr_triangular(fpar,1); errorsum += estimate_uerror(distr,ures,samplesize); printf(" uniform"); fpar[0] = 1.; fpar[1] = 2.; distr = unur_distr_uniform(fpar,2); errorsum += estimate_uerror(distr,ures,samplesize); printf(" weibull"); fpar[0] = 1.; fpar[1] = 2.; distr = unur_distr_weibull(fpar,2); errorsum += estimate_uerror(distr,ures,samplesize); /*---------------------------------------------------------------------------*/ /* test finished */ FAILED = (errorsum < 2) ? 0 : 1; /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (FAILED) ? 0 : 1; (FAILED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_special() */ /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_cstd_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_unif.conf0000644001357500135600000000546114420445767013355 00000000000000############################################################################# [main] [main - data:] # method (for information only: the program scans the file name) method: UNIF [main - header:] /* prototypes */ \#define COMPARE_SAMPLE_SIZE (10000) \#define VIOLATE_SAMPLE_SIZE (20) ############################################################################# [new] ############################################################################# # [set] ############################################################################# # [get] ############################################################################# # [chg] ############################################################################# [init] [init - invalid NULL ptr: par = NULL; ] unur_init( par ); --> expected_NULL --> UNUR_ERR_NULL ############################################################################# [reinit] [reinit - exist: par = unur_unif_new(NULL); gen = unur_init( par ); <-- ! NULL ] unur_reinit( gen ); --> expected_reinit ############################################################################# [sample] [sample - compare: par = NULL; ] -->compare_sequence_urng_start par = unur_unif_new(NULL); -->compare_sequence_par #..................................................................... [sample - compare: distr = unur_distr_uniform(NULL,0); par = NULL; ] -->compare_sequence_urng_start par = unur_unif_new(distr); -->compare_sequence_par #..................................................................... [sample - compare clone: UNUR_GEN *clone; par = NULL; gen = NULL; ] /* original generator object */ par = unur_unif_new(NULL); gen = unur_init(par); -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen #..................................................................... [sample - compare reinit: par = NULL; gen = NULL; ] /* original generator object */ par = unur_unif_new(NULL); gen = unur_init(par); -->compare_sequence_gen_start /* reinit */ unur_reinit(gen); -->compare_sequence_gen #..................................................................... [sample - compare stringparser: par = NULL; gen = NULL; ] par = unur_unif_new(NULL); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; gen = unur_str2gen( "uniform & method = unif" ); -->compare_sequence_gen ############################################################################# # [validate] ############################################################################# ############################################################################# [verbatim] ############################################################################# unuran-1.11.0/tests/t_mvstd.conf0000644001357500135600000002547214420445767013555 00000000000000############################################################################# [main] [main - data:] # method (for information only: the program scans the file name) method: MVSTD [main - header:] /* prototypes */ \#define COMPARE_SAMPLE_SIZE (500) \#define VIOLATE_SAMPLE_SIZE (20) /* \#define SEED (298346) */ /* we need marginal distributions for the chi2 tests */ \#define unur_distr_multinormal unur_distr_multinormal_w_marginals ############################################################################# [new] [new - invalid NULL ptr: distr = NULL; ] ~( distr ); --> expected_NULL --> UNUR_ERR_NULL [new - invalid distribution type: distr = unur_distr_cont_new(); ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID [new - not a standard distribution: distr = unur_distr_cvec_new(3); ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID ############################################################################# # [set] ############################################################################# # [get] ############################################################################# # [chg] ############################################################################# # [init] ############################################################################# [reinit] [reinit - exists: distr = unur_distr_multinormal(3,NULL,NULL); par = unur_mvstd_new(distr); gen = unur_init( par ); <-- ! NULL ] unur_reinit( gen ); --> expected_reinit ############################################################################# [sample] [sample - compare clone: const int dim = 3; double mean[] = {1.,2.,3.}; double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; UNUR_GEN *clone; distr = unur_distr_multinormal( dim, mean, covar ); par = NULL; gen = NULL; ] /* normal distribution */ par = unur_mvstd_new(distr); gen = unur_init( par ); -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen ############################################################################# [validate] [validate - generators:] # default program par[0] = unur_mvstd_new(@distr@); # default variant but reinitialized with changed distribution { UNUR_DISTR *dg =NULL; double mean[] = { -1., 2., -3. }; double covar[] = { 1., 0.8, 0.64, 0.8, 1., 0.8, 0.64, 0.8, 1. }; par[1] = unur_mvstd_new(@distr@); dg = unur_get_distr(gen); unur_distr_cvec_set_mean(dg,mean); unur_distr_cvec_set_covar(dg,covar); unur_reinit(gen); } [validate - distributions:] # standard multinormal distribution distr[0] = unur_distr_multinormal(3,NULL,NULL); # multinormal distribution, dim = 3 double mean[] = { -1., 2., -3. }; double covar[] = { 1., 0.8, 0.64, 0.8, 1., 0.8, 0.64, 0.8, 1. }; distr[1] = unur_distr_multinormal(3,mean,covar); # random multinormal distribution \#define dim (2) int i; double mean[dim], covar[dim*dim]; UNUR_DISTR *covar_distr; UNUR_GEN *covar_gen; UNUR_GEN *mean_gen; covar_distr = unur_distr_correlation(dim); covar_gen = unur_init(unur_mcorr_new(covar_distr)); mean_gen = unur_str2gen("normal(5,1)"); for (i=0; i + + # standard multinormal (dim=3) <1> + + # multinormal (dim=3) <2> + . # random multinormal (dim=2) <3> + + # random multinormal (dim=3) <4> + . # random multinormal (dim=4) <5> + . # random multinormal (dim=5) <6> + . # random multinormal (dim=7) <7> + . # random multinormal (dim=10) <8> + . # random multinormal (dim=15) <9> + . # random multinormal (dim=20) <10> + . # random multinormal (dim=100) x<11> + . # multinormal with AR(1) corr matrix (rho=0.5, dim=100) <12> + . # multinormal with AR(1) corr matrix (rho=0.9, dim=100) x<13> + . # multinormal with AR(1) corr matrix (rho=0.99, dim=100) x<14> + . # multinormal with AR(1) corr matrix (rho=0.999, dim=100) <15> + . # standard multinormal (dim=1) x<16> + . # random multinormal (dim=1) <17> 0 . # standard multinormal distribution with rectangular domain <18> 0 . # invalid distribution (standard multicauchy, dim=3) ############################################################################# ############################################################################# [verbatim] ############################################################################# unuran-1.11.0/tests/t_distr_cvec.conf0000644001357500135600000003463014420445767014541 00000000000000############################################################################# [main] [main - data:] # method (for information only: the program scans the file name) method: DISTR_CVEC [main - header:] /* prototypes */ \#define COMPARE_SAMPLE_SIZE (500) \#define VIOLATE_SAMPLE_SIZE (20) double mvpdf(const double *x, UNUR_DISTR *distr); int mvdpdf(double *result, const double *x, UNUR_DISTR *distr); double mvpdpdf(const double *x, int coord, UNUR_DISTR *distr); ############################################################################# [new] [new - invalid data: distr = NULL; ] unur_distr_cvec_new(0); --> expected_NULL --> UNUR_ERR_DISTR_SET ############################################################################# [set] [set - invalid NULL ptr: distr = NULL; ] ~_pdf( distr, mvpdf ); --> expected_setfailed --> UNUR_ERR_NULL ~_dpdf( distr, mvdpdf ); --> expected_setfailed --> UNUR_ERR_NULL ~_pdpdf( distr, mvpdpdf ); --> expected_setfailed --> UNUR_ERR_NULL ~_logpdf( distr, mvpdf ); --> expected_setfailed --> UNUR_ERR_NULL ~_dlogpdf( distr, mvdpdf ); --> expected_setfailed --> UNUR_ERR_NULL ~_pdlogpdf( distr, mvpdpdf ); --> expected_setfailed --> UNUR_ERR_NULL ~_mean( distr, NULL ); --> expected_setfailed --> UNUR_ERR_NULL ~_covar( distr, NULL ); --> expected_setfailed --> UNUR_ERR_NULL ~_covar_inv( distr, NULL ); --> expected_setfailed --> UNUR_ERR_NULL ~_rankcorr( distr, NULL ); --> expected_setfailed --> UNUR_ERR_NULL ~_mode( distr, NULL ); --> expected_setfailed --> UNUR_ERR_NULL ~_center( distr, NULL ); --> expected_setfailed --> UNUR_ERR_NULL ~_pdfparams( distr, NULL, 0 ); --> expected_setfailed --> UNUR_ERR_NULL ~_pdfparams_vec( distr, 0, NULL, 0 ); --> expected_setfailed --> UNUR_ERR_NULL ~_pdfvol( distr, 1. ); --> expected_setfailed --> UNUR_ERR_NULL ~_marginals( distr, NULL ); --> expected_setfailed --> UNUR_ERR_NULL ~_marginal_array( distr, NULL ); --> expected_setfailed --> UNUR_ERR_NULL ~_domain_rect( distr, NULL, NULL ); --> expected_setfailed --> UNUR_ERR_NULL [set - invalid distribution type: double fpm[2] = {1.,2.}; distr = unur_distr_discr_new(); ] ~_pdf( distr, mvpdf ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID ~_dpdf( distr, mvdpdf ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID ~_pdpdf( distr, mvpdpdf ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID ~_logpdf( distr, mvpdf ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID ~_dlogpdf( distr, mvdpdf ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID ~_pdlogpdf( distr, mvpdpdf ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID ~_mean( distr, NULL ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID ~_covar( distr, NULL ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID ~_covar_inv( distr, NULL ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID ~_rankcorr( distr, NULL ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID ~_mode( distr, NULL ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID ~_center( distr, NULL ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID ~_pdfparams( distr, fpm, 2 ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID ~_pdfparams_vec( distr, 0, fpm, 2 ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID ~_pdfvol( distr, 1. ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID ~_marginals( distr, NULL ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID ~_marginal_array( distr, NULL ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID ~_domain_rect( distr, NULL, NULL ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID [set - invalid NULL ptr: distr = unur_distr_cvec_new(2); ] ~_pdf( distr, NULL ); --> expected_setfailed --> UNUR_ERR_NULL ~_dpdf( distr, NULL ); --> expected_setfailed --> UNUR_ERR_NULL ~_pdpdf( distr, NULL ); --> expected_setfailed --> UNUR_ERR_NULL ~_logpdf( distr, NULL ); --> expected_setfailed --> UNUR_ERR_NULL ~_dlogpdf( distr, NULL ); --> expected_setfailed --> UNUR_ERR_NULL ~_pdlogpdf( distr, NULL ); --> expected_setfailed --> UNUR_ERR_NULL ~_pdfparams( distr, NULL, 0 ); --> expected_setfailed --> UNUR_ERR_NULL ~_marginals( distr, NULL ); --> expected_setfailed --> UNUR_ERR_NULL ~_marginal_array( distr, NULL ); --> expected_setfailed --> UNUR_ERR_NULL ~_domain_rect( distr, NULL, NULL ); --> expected_setfailed --> UNUR_ERR_NULL [set - invalid parameters: double fpm[2] = {1.,2.}; double dpm[2] = {4., 0.5}; double covar_invalid_negative[4] = {-1.,0.,0.,1.}; double covar_invalid_nonsym[4] = {1.,0.5,0.,1.}; double covar_invalid_nonpositive[4] = {0.5,1.,1.,0.5}; double ll[] = { 0., 0. }; double ru[] = { 0., 0. }; UNUR_DISTR *marginal = unur_distr_binomial(dpm,2); UNUR_DISTR *marginal_array[2]; marginal_array[0] = marginal; marginal_array[1] = marginal; distr = unur_distr_cvec_new(2); ] ~_pdfvol( distr, -1. ); --> expected_setfailed --> UNUR_ERR_DISTR_SET ~_covar( distr, covar_invalid_negative ); --> expected_setfailed --> UNUR_ERR_DISTR_DOMAIN ~_covar_inv( distr, covar_invalid_negative ); --> expected_setfailed --> UNUR_ERR_DISTR_DOMAIN ~_covar( distr, covar_invalid_nonsym ); --> expected_setfailed --> UNUR_ERR_DISTR_DOMAIN ~_covar_inv( distr, covar_invalid_nonsym ); --> expected_setfailed --> UNUR_ERR_DISTR_DOMAIN ~_covar( distr, covar_invalid_nonpositive ); --> expected_setfailed --> UNUR_ERR_DISTR_DOMAIN ~_rankcorr( distr, covar_invalid_negative ); --> expected_setfailed --> UNUR_ERR_DISTR_DOMAIN ~_rankcorr( distr, covar_invalid_nonsym ); --> expected_setfailed --> UNUR_ERR_DISTR_DOMAIN ~_pdfparams( distr, fpm, -1 ); --> expected_setfailed --> UNUR_ERR_DISTR_NPARAMS ~_pdfparams_vec( distr, -1, fpm, 2 ); --> expected_setfailed --> UNUR_ERR_DISTR_NPARAMS ~_pdfparams_vec( distr, 100000, fpm, 2 ); --> expected_setfailed --> UNUR_ERR_DISTR_NPARAMS ~_marginals( distr, marginal ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID ~_marginal_array( distr, marginal_array ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID ~_domain_rect( distr, ll, ru ); --> expected_setfailed --> UNUR_ERR_DISTR_SET unur_distr_free(marginal); ############################################################################# [get] [get - invalid NULL ptr: distr = NULL; ] ~_pdf( distr ); --> expected_NULL --> UNUR_ERR_NULL ~_dpdf( distr ); --> expected_NULL --> UNUR_ERR_NULL ~_pdpdf( distr ); --> expected_NULL --> UNUR_ERR_NULL ~_logpdf( distr ); --> expected_NULL --> UNUR_ERR_NULL ~_dlogpdf( distr ); --> expected_NULL --> UNUR_ERR_NULL ~_pdlogpdf( distr ); --> expected_NULL --> UNUR_ERR_NULL ~_pdfvol( distr ); --> expected_INFINITY --> UNUR_ERR_NULL ~_mean( distr ); --> expected_NULL --> UNUR_ERR_NULL ~_covar( distr ); --> expected_NULL --> UNUR_ERR_NULL ~_covar_inv( distr ); --> expected_NULL --> UNUR_ERR_NULL ~_rankcorr( distr ); --> expected_NULL --> UNUR_ERR_NULL ~_cholesky( distr ); --> expected_NULL --> UNUR_ERR_NULL ~_mode( distr ); --> expected_NULL --> UNUR_ERR_NULL ~_center( distr ); --> expected_NULL --> UNUR_ERR_NULL ~_pdfparams( distr, NULL ); --> expected_zero --> UNUR_ERR_NULL ~_pdfparams_vec( distr, 0, NULL ); --> expected_zero --> UNUR_ERR_NULL ~_marginal( distr, 1 ); --> expected_NULL --> UNUR_ERR_NULL [get - invalid distribution type: const double *fpm; distr = unur_distr_discr_new(); ] unur_distr_cvec_get_pdf( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID unur_distr_cvec_get_dpdf( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID unur_distr_cvec_get_pdpdf( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID unur_distr_cvec_get_logpdf( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID unur_distr_cvec_get_dlogpdf( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID unur_distr_cvec_get_pdlogpdf( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID ~_pdfvol( distr ); --> expected_INFINITY --> UNUR_ERR_DISTR_INVALID ~_mean( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID ~_covar( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID ~_covar_inv( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID ~_rankcorr( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID ~_cholesky( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID ~_mode( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID ~_center( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID ~_pdfparams( distr, &fpm ); --> expected_zero --> UNUR_ERR_DISTR_INVALID ~_pdfparams_vec( distr, 0, &fpm ); --> expected_zero --> UNUR_ERR_DISTR_INVALID ~_marginal( distr, 1 ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID [get - parameters not unknown: const double *fpm; distr = unur_distr_cvec_new(2); ] ~_pdfvol( distr ); --> expected_INFINITY --> UNUR_ERR_DISTR_GET ~_mean( distr ); --> expected_NULL --> UNUR_ERR_DISTR_GET ~_covar( distr ); --> expected_NULL --> UNUR_ERR_DISTR_GET ~_covar_inv( distr ); --> expected_NULL --> UNUR_ERR_DISTR_GET ~_rankcorr( distr ); --> expected_NULL --> UNUR_ERR_DISTR_GET ~_cholesky( distr ); --> expected_NULL --> UNUR_ERR_DISTR_GET ~_mode( distr ); --> expected_NULL --> UNUR_ERR_DISTR_GET ~_pdfparams_vec( distr, -1, &fpm ); --> expected_zero --> UNUR_ERR_DISTR_NPARAMS ~_pdfparams_vec( distr, 1000, &fpm ); --> expected_zero --> UNUR_ERR_DISTR_NPARAMS ~_marginal( distr, 1 ); --> expected_NULL --> UNUR_ERR_DISTR_GET [get - invalid parameters: double covar_invalid_noninv[4] = {1.,1.,1.,1.}; UNUR_DISTR *marginal = unur_distr_normal(NULL,0); distr = unur_distr_cvec_new(2); unur_distr_cvec_set_marginals( distr, marginal ); unur_distr_cvec_set_covar( distr, covar_invalid_noninv ); ] ~_covar( distr ); --> expected_NULL --> UNUR_ERR_DISTR_GET ~_rankcorr( distr ); --> expected_NULL --> UNUR_ERR_DISTR_GET ~_marginal( distr, 0 ); --> expected_NULL --> UNUR_ERR_DISTR_GET ~_marginal( distr, 3 ); --> expected_NULL --> UNUR_ERR_DISTR_GET unur_distr_free(marginal); ############################################################################# [chg] [chg - invalid NULL ptr: distr = NULL; ] unur_distr_cvec_upd_mode( distr ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_cvec_upd_pdfvol( distr ); --> expected_setfailed --> UNUR_ERR_NULL [chg - invalid distribution type: distr = unur_distr_cont_new(); ] unur_distr_cvec_upd_mode( distr ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_cvec_upd_pdfvol( distr ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID [chg - missing data: distr = unur_distr_cvec_new(3); ] unur_distr_cvec_upd_mode( distr ); --> expected_setfailed --> UNUR_ERR_DISTR_DATA unur_distr_cvec_upd_pdfvol( distr ); --> expected_setfailed --> UNUR_ERR_DISTR_DATA ############################################################################## # [init] ############################################################################# # [reinit] ############################################################################# [sample] [sample - invalid NULL ptr: distr = NULL; ] unur_distr_cvec_eval_pdf( NULL, distr ); --> expected_INFINITY --> UNUR_ERR_NULL unur_distr_cvec_eval_dpdf( NULL, NULL, distr ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_cvec_eval_pdpdf( NULL, 1, distr ); --> expected_INFINITY --> UNUR_ERR_NULL unur_distr_cvec_eval_logpdf( NULL, distr ); --> expected_INFINITY --> UNUR_ERR_NULL unur_distr_cvec_eval_dlogpdf( NULL, NULL, distr ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_cvec_eval_pdlogpdf( NULL, 1, distr ); --> expected_INFINITY --> UNUR_ERR_NULL [sample - invalid distribution object: distr = unur_distr_discr_new(); ] unur_distr_cvec_eval_pdf( NULL, distr ); --> expected_INFINITY --> UNUR_ERR_DISTR_INVALID unur_distr_cvec_eval_dpdf( NULL, NULL, distr ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_cvec_eval_pdpdf( NULL, 1, distr ); --> expected_INFINITY --> UNUR_ERR_DISTR_INVALID unur_distr_cvec_eval_logpdf( NULL, distr ); --> expected_INFINITY --> UNUR_ERR_DISTR_INVALID unur_distr_cvec_eval_dlogpdf( NULL, NULL, distr ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_cvec_eval_pdlogpdf( NULL, 1, distr ); --> expected_INFINITY --> UNUR_ERR_DISTR_INVALID [sample - missing data: double x[2], result[2]; distr = unur_distr_cvec_new(2); ] unur_distr_cvec_eval_pdf( x, distr ); --> expected_INFINITY --> UNUR_ERR_DISTR_DATA unur_distr_cvec_eval_dpdf( result, x, distr ); --> expected_setfailed --> UNUR_ERR_DISTR_DATA unur_distr_cvec_eval_pdpdf( x, 1, distr ); --> expected_INFINITY --> UNUR_ERR_DISTR_DATA unur_distr_cvec_eval_logpdf( x, distr ); --> expected_INFINITY --> UNUR_ERR_DISTR_DATA unur_distr_cvec_eval_dlogpdf( result, x, distr ); --> expected_setfailed --> UNUR_ERR_DISTR_DATA unur_distr_cvec_eval_pdlogpdf( x, 1, distr ); --> expected_INFINITY --> UNUR_ERR_DISTR_DATA [sample - check for memory leaks: double x[] = { 1., 2., 3. }; distr = unur_distr_cvec_new(3); ] unur_distr_cvec_set_pdfparams_vec( distr, 0, x, 3 ); --> none --> UNUR_SUCCESS ############################################################################# # [validate] ############################################################################# ############################################################################# [verbatim] double mvpdf(const double *x ATTRIBUTE__UNUSED, UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return 1.; } int mvdpdf(double *result ATTRIBUTE__UNUSED, const double *x ATTRIBUTE__UNUSED, UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return 1; } double mvpdpdf(const double *x ATTRIBUTE__UNUSED, int coord ATTRIBUTE__UNUSED, UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return 1.; } ############################################################################# unuran-1.11.0/tests/t_dau.c0000644001357500135600000015544314430713513012454 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for DAU **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); int unur_dau_set_verify( UNUR_PAR *par, int verify); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ #define COMPARE_SAMPLE_SIZE (10000) #define VIOLATE_SAMPLE_SIZE (20) double *make_geometric_vector(double q, int len); double *make_random_vector(int len); UNUR_DISTR *get_distr_with_invalid_pv( void ); UNUR_DISTR *get_distr_with_pv( void ); /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ /*---------------------------------------------------------------------------*/ /* make a probability vector (need not sum to one) (use random entries) */ double *make_random_vector(int len) { double *pv; int i; /* allocate memory */ pv = malloc(len*sizeof(double)); if (!pv) abort(); /* main part of geometric distribution */ for( i=0; itime = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [set] */ void test_set (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[set "); fflush(stdout); fprintf(TESTLOG,"\n[set]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,52,(unur_dau_set_urnfactor(par,1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,52,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* invalid parameter object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = get_distr_with_pv(); par = unur_dgt_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,59,(unur_dau_set_urnfactor(par,1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,59,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = get_distr_with_pv(); par = unur_dau_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,68,(unur_dau_set_urnfactor(par,0.8)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,68,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_set() */ /*---------------------------------------------------------------------------*/ /* [init] */ void test_init (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[init "); fflush(stdout); fprintf(TESTLOG,"\n[init]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,88,(unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,88,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* invalid data */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = get_distr_with_invalid_pv(); par = unur_dau_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,96,(unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,96,UNUR_ERR_GEN_DATA)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_init() */ /*---------------------------------------------------------------------------*/ /* [reinit] */ void test_reinit (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[reinit "); fflush(stdout); fprintf(TESTLOG,"\n[reinit]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* exist */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[2] = {10.,0.63}; distr = unur_distr_binomial(fpar,2); par = unur_dau_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 107, gen ); unur_reset_errno(); n_tests_failed += (check_expected_reinit(TESTLOG,111,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_reinit() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* compare clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; UNUR_GEN *clone; double fpar[] = {10,0.3}; distr = unur_distr_binomial(fpar,2); par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_dau_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,128,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,134,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare reinit */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[] = {10,0.3}; distr = unur_distr_binomial(fpar,2); par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_dau_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,147,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* reinit */ unur_reinit(gen); n_tests_failed += (compare_sequence_gen(TESTLOG,151,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare stringparser */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double pv[] = {.1, .2, .3, .4, .5, .6, .7, .8, .9, 1.}; double fpar[] = {0.8}; distr = NULL; par = NULL; gen = NULL; unur_reset_errno(); distr = unur_distr_discr_new(); unur_distr_discr_set_pv(distr,pv,10); par = unur_dau_new(distr); unur_dau_set_urnfactor(par,3.); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,167,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "discr; pv = (.1, .2, .3, .4, .5, .6, .7, .8, .9, 1.) & \ method = dau; urnfactor = 3." ); n_tests_failed += (compare_sequence_gen(TESTLOG,173,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; distr = unur_distr_geometric(fpar,1); par = unur_dau_new(distr); unur_dau_set_urnfactor(par,3.); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,181,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "geometric(0.8) & method = dau; urnfactor = 3." ); n_tests_failed += (compare_sequence_gen(TESTLOG,186,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* [validate] */ /*---------------------------------------------------------------------------*/ /* [validate] */ void test_validate (void) { /* suppress GCC compiler warning */ GCC_DIAG_OFF(unused-variable) UNUR_DISTR *distr[23]; UNUR_PAR *par; UNUR_GEN *gen; double *darray; double fpm[10]; int n_tests_failed; int rcode; /* start test */ printf("[validate "); fflush(stdout); fprintf(TESTLOG,"\n[validate]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* distributions: 23 */ { distr[0] = unur_distr_discr_new(); darray = make_random_vector(10); unur_distr_discr_set_pv(distr[0],darray,10); free(darray); unur_distr_set_name(distr[0],"pv(random)"); } { distr[1] = unur_distr_discr_new(); darray = make_random_vector(100); unur_distr_discr_set_pv(distr[1],darray,100); free(darray); unur_distr_set_name(distr[1],"pv(random)"); } { distr[2] = unur_distr_discr_new(); darray = make_random_vector(1000); unur_distr_discr_set_pv(distr[2],darray,1000); free(darray); unur_distr_set_name(distr[2],"pv(random)"); } { distr[3] = unur_distr_discr_new(); darray = make_random_vector(10000); unur_distr_discr_set_pv(distr[3],darray,10000); free(darray); unur_distr_set_name(distr[3],"pv(random)"); } { distr[4] = unur_distr_discr_new(); darray = make_geometric_vector(1.,1000); unur_distr_discr_set_pv(distr[4],darray,1000); free(darray); unur_distr_set_name(distr[4],"pv(geometric)"); } { distr[5] = unur_distr_discr_new(); darray = make_geometric_vector(0.99,1000); unur_distr_discr_set_pv(distr[5],darray,1000); free(darray); unur_distr_set_name(distr[5],"pv(geometric)"); } { distr[6] = unur_distr_discr_new(); darray = make_geometric_vector(0.9,1000); unur_distr_discr_set_pv(distr[6],darray,1000); free(darray); unur_distr_set_name(distr[6],"pv(geometric)"); } { distr[7] = unur_distr_discr_new(); darray = make_geometric_vector(0.5,1000); unur_distr_discr_set_pv(distr[7],darray,1000); free(darray); unur_distr_set_name(distr[7],"pv(geometric)"); } { distr[8] = unur_distr_discr_new(); darray = make_geometric_vector(0.1,1000); unur_distr_discr_set_pv(distr[8],darray,1000); free(darray); unur_distr_set_name(distr[8],"pv(geometric)"); } { distr[9] = unur_distr_discr_new(); darray = make_geometric_vector(0.9,100); unur_distr_discr_set_pv(distr[9],darray,100); unur_distr_discr_set_domain(distr[9],10,209); free(darray); unur_distr_set_name(distr[9],"pv(geometric) - shifted domain"); } { distr[10] = unur_distr_discr_new(); darray = make_geometric_vector(0.9,100); unur_distr_discr_set_pv(distr[10],darray,100); unur_distr_discr_set_domain(distr[10],-10,209); free(darray); unur_distr_set_name(distr[10],"pv(geometric) - shifted domain"); } { fpm[0] = 0.5; distr[11] = unur_distr_geometric(fpm,1); } { fpm[0] = 0.001; distr[12] = unur_distr_geometric(fpm,1); } { fpm[0] = 0.1; distr[13] = unur_distr_logarithmic(fpm,1); } { fpm[0] = 0.999; distr[14] = unur_distr_logarithmic(fpm,1); } { fpm[0] = 0.5; fpm[1] = 10.; distr[15] = unur_distr_negativebinomial(fpm,2); } { fpm[0] = 0.01; fpm[1] = 20.; distr[16] = unur_distr_negativebinomial(fpm,2); } { fpm[0] = 0.1; distr[17] = unur_distr_poisson(fpm,1); } { fpm[0] = 0.999; distr[18] = unur_distr_poisson(fpm,1); } { fpm[0] = 2.; fpm[1] = 1.; distr[19] = unur_distr_zipf(fpm,2); unur_distr_discr_set_domain(distr[19],1,1000); } { fpm[0] = 0.001; fpm[1] = 1.; distr[20] = unur_distr_zipf(fpm,2); unur_distr_discr_set_domain(distr[20],1,1000); } { fpm[0] = 20.; fpm[1] = 0.8; distr[21] = unur_distr_binomial(fpm,2); } { fpm[0] = 2000.; fpm[1] = 0.0013; distr[22] = unur_distr_binomial(fpm,2); } /* timing */ stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); printf("\n(chi^2) "); fflush(stdout); /* chi^2 tests: 92 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nChi^2 Test:\n"); /* distribution [0] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_dau_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_dau_new(distr_localcopy); unur_dau_set_urnfactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { UNUR_DISTR *dg =NULL; par = unur_dau_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_dau_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_dau_new(distr_localcopy); unur_dau_set_urnfactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { UNUR_DISTR *dg =NULL; par = unur_dau_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [2] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_dau_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_dau_new(distr_localcopy); unur_dau_set_urnfactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); { UNUR_DISTR *dg =NULL; par = unur_dau_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [3] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_dau_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_dau_new(distr_localcopy); unur_dau_set_urnfactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); { UNUR_DISTR *dg =NULL; par = unur_dau_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [4] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_dau_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_dau_new(distr_localcopy); unur_dau_set_urnfactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); { UNUR_DISTR *dg =NULL; par = unur_dau_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [5] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_dau_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_dau_new(distr_localcopy); unur_dau_set_urnfactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); { UNUR_DISTR *dg =NULL; par = unur_dau_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [6] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_dau_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_dau_new(distr_localcopy); unur_dau_set_urnfactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); { UNUR_DISTR *dg =NULL; par = unur_dau_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [7] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_dau_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_dau_new(distr_localcopy); unur_dau_set_urnfactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); { UNUR_DISTR *dg =NULL; par = unur_dau_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [8] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_dau_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_dau_new(distr_localcopy); unur_dau_set_urnfactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); { UNUR_DISTR *dg =NULL; par = unur_dau_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [9] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_dau_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_dau_new(distr_localcopy); unur_dau_set_urnfactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); { UNUR_DISTR *dg =NULL; par = unur_dau_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [10] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_dau_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_dau_new(distr_localcopy); unur_dau_set_urnfactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); { UNUR_DISTR *dg =NULL; par = unur_dau_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [11] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_dau_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_dau_new(distr_localcopy); unur_dau_set_urnfactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); { UNUR_DISTR *dg =NULL; par = unur_dau_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [12] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_dau_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_dau_new(distr_localcopy); unur_dau_set_urnfactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); { UNUR_DISTR *dg =NULL; par = unur_dau_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [13] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_dau_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_dau_new(distr_localcopy); unur_dau_set_urnfactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); { UNUR_DISTR *dg =NULL; par = unur_dau_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [14] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_dau_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_dau_new(distr_localcopy); unur_dau_set_urnfactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); { UNUR_DISTR *dg =NULL; par = unur_dau_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [15] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_dau_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_dau_new(distr_localcopy); unur_dau_set_urnfactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); { UNUR_DISTR *dg =NULL; par = unur_dau_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [16] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_dau_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_dau_new(distr_localcopy); unur_dau_set_urnfactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); { UNUR_DISTR *dg =NULL; par = unur_dau_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [17] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_dau_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_dau_new(distr_localcopy); unur_dau_set_urnfactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); { UNUR_DISTR *dg =NULL; par = unur_dau_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [18] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_dau_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_dau_new(distr_localcopy); unur_dau_set_urnfactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); { UNUR_DISTR *dg =NULL; par = unur_dau_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [19] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_dau_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_dau_new(distr_localcopy); unur_dau_set_urnfactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); { UNUR_DISTR *dg =NULL; par = unur_dau_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [20] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_dau_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_dau_new(distr_localcopy); unur_dau_set_urnfactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); { UNUR_DISTR *dg =NULL; par = unur_dau_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [21] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_dau_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_dau_new(distr_localcopy); unur_dau_set_urnfactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); { UNUR_DISTR *dg =NULL; par = unur_dau_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); { UNUR_DISTR *dg =NULL; par = unur_dau_new(distr_localcopy); fpm[0] = 10.; fpm[1] = 0.63; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [22] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_dau_new(distr_localcopy); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_dau_new(distr_localcopy); unur_dau_set_urnfactor(par,10.); unur_set_debug(par, 1u); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); { UNUR_DISTR *dg =NULL; par = unur_dau_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); { UNUR_DISTR *dg =NULL; par = unur_dau_new(distr_localcopy); fpm[0] = 10.; fpm[1] = 0.63; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); /* free distributions */ unur_distr_free(distr[0]); unur_distr_free(distr[1]); unur_distr_free(distr[2]); unur_distr_free(distr[3]); unur_distr_free(distr[4]); unur_distr_free(distr[5]); unur_distr_free(distr[6]); unur_distr_free(distr[7]); unur_distr_free(distr[8]); unur_distr_free(distr[9]); unur_distr_free(distr[10]); unur_distr_free(distr[11]); unur_distr_free(distr[12]); unur_distr_free(distr[13]); unur_distr_free(distr[14]); unur_distr_free(distr[15]); unur_distr_free(distr[16]); unur_distr_free(distr[17]); unur_distr_free(distr[18]); unur_distr_free(distr[19]); unur_distr_free(distr[20]); unur_distr_free(distr[21]); unur_distr_free(distr[22]); /* test finished */ test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; /* we accept CHI2_FAILURES_TOLERATED failures */ (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_validate */ /* enable GCC compiler warning */ GCC_DIAG_ON(unused-variable) /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_dau_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_mvtdr.c0000644001357500135600000015510414430713513013031 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for MVTDR **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ int unur_mvtdr_set_pedantic( UNUR_PAR *par, int pedantic ); #define COMPARE_SAMPLE_SIZE (9999) #define VIOLATE_SAMPLE_SIZE (20) double pdf_normal(const double *coord, UNUR_DISTR *distr); int dpdf_normal(double *grad, const double *coord, UNUR_DISTR *distr); double logpdf_normal(const double *coord, UNUR_DISTR *distr); int dlogpdf_normal(double *grad, const double *coord, UNUR_DISTR *distr); /* we need marginal distributions for the chi2 tests */ #define unur_distr_multicauchy unur_distr_multicauchy_w_marginals #define unur_distr_multinormal unur_distr_multinormal_w_marginals #define unur_distr_multistudent unur_distr_multistudent_w_marginals /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ /* dummy function */ int unur_mvtdr_set_pedantic( UNUR_PAR *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) { return 1; } /*-----------------------------------------------------------------*/ double pdf_normal(const double *coord, UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* multinormal density function */ { int i; double f = 0.; for( i=0; i<3; i++ ) f += coord[i] * coord[i]; return( exp(-f) ); } /* end of pdf_normal() */ int dpdf_normal(double *grad, const double *coord, UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* gradient of multinormal density function */ { int i; double f = 0.; /* d(e^{-\sum j*x_j^2})/d x_i = -2*x_i*e^{-\sum j*x_j^2} */ for( i=0; i<3; i++ ) f += coord[i] * coord[i]; f = exp( -f ); for( i=0; i<3; i++ ) grad[i] = (-2) * coord[i] * f; return 0; } /* end of dpdf_normal() */ /*-----------------------------------------------------------------*/ double logpdf_normal(const double *coord, UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* multinormal density function */ { int i; double f = 0.; for( i=0; i<3; i++ ) f += coord[i] * coord[i]; return (-f); } /* end of logpdf_normal() */ int dlogpdf_normal(double *grad, const double *coord, UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* gradient of multinormal density function */ { int i; /* d(e^{-\sum j*x_j^2})/d x_i = -2*i*x_i*e^{-\sum j*x_j^2} */ for( i=0; i<3; i++ ) grad[i] = -2 * coord[i]; return 0; } /* end of dlogpdf_normal() */ /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,40,(unur_mvtdr_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,40,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,47,(unur_mvtdr_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,47,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid number of dimensions */ UNUR_DISTR *distr = NULL; distr = unur_distr_cvec_new(1); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,53,(unur_mvtdr_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,53,UNUR_ERR_DISTR_PROP)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* missing data */ UNUR_DISTR *distr = NULL; distr = unur_distr_cvec_new(3); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,60,(unur_mvtdr_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,60,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* missing data */ UNUR_DISTR *distr = NULL; distr = unur_distr_cvec_new(3); unur_distr_cvec_set_pdf(distr,pdf_normal); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,68,(unur_mvtdr_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,68,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* missing data */ UNUR_DISTR *distr = NULL; distr = unur_distr_cvec_new(3); unur_distr_cvec_set_logpdf(distr,logpdf_normal); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,76,(unur_mvtdr_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,76,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [set] */ void test_set (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[set "); fflush(stdout); fprintf(TESTLOG,"\n[set]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,88,(unur_mvtdr_set_stepsmin( par, 5 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,88,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,91,(unur_mvtdr_set_maxcones( par, 5000 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,91,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,94,(unur_mvtdr_set_verify( par, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,94,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* invalid parameter object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,102,(unur_mvtdr_set_stepsmin( par, 5 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,102,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,105,(unur_mvtdr_set_maxcones( par, 5000 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,105,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,108,(unur_mvtdr_set_verify( par, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,108,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = unur_distr_multinormal( 3, NULL, NULL ); par = unur_mvtdr_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,118,(unur_mvtdr_set_stepsmin( par, -1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,118,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_set() */ /*---------------------------------------------------------------------------*/ /* [get] */ void test_get (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[get "); fflush(stdout); fprintf(TESTLOG,"\n[get]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_GEN *gen = NULL; gen = NULL; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,131,(unur_mvtdr_get_hatvol(gen)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,131,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_zero(TESTLOG,134,(unur_mvtdr_get_ncones(gen)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,134,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_free(gen); } { /* invalid generator object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); gen = unur_init(par); abort_if_NULL(TESTLOG, 139, gen ); unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,143,(unur_mvtdr_get_hatvol(gen)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,143,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_zero(TESTLOG,146,(unur_mvtdr_get_ncones(gen)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,146,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_get() */ /*---------------------------------------------------------------------------*/ /* [chg] */ void test_chg (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[chg "); fflush(stdout); fprintf(TESTLOG,"\n[chg]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid generator object */ UNUR_GEN *gen = NULL; gen = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,157,(unur_mvtdr_chg_verify(gen,1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,157,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_free(gen); } { /* invalid generator object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_srou_new(distr); unur_set_debug(par,0); gen = unur_init( par ); abort_if_NULL(TESTLOG, 164, gen ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,168,(unur_mvtdr_chg_verify(gen,1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,168,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_chg() */ /*---------------------------------------------------------------------------*/ /* [reinit] */ void test_reinit (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[reinit "); fflush(stdout); fprintf(TESTLOG,"\n[reinit]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* does not exist */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double x[3]; distr = unur_distr_multinormal(3,NULL,NULL); par = unur_mvtdr_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 182, gen ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,186,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,186,UNUR_ERR_NO_REINIT)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_sample_vec( gen, x ); n_tests_failed += (check_expected_INFINITY(TESTLOG,190,(x[0]))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,190,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_reinit() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* test clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; const int dim = 3; double mean[] = {1.,2.,3.}; double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; UNUR_GEN *clone; distr = unur_distr_multinormal( dim, mean, covar ); par = unur_mvtdr_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 203, gen ); unur_reset_errno(); ; n_tests_failed += (compare_sequence_gen_start(TESTLOG,206,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,212,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* [validate] */ /*---------------------------------------------------------------------------*/ /* [validate] */ void test_validate (void) { /* suppress GCC compiler warning */ GCC_DIAG_OFF(unused-variable) UNUR_DISTR *distr[39]; UNUR_PAR *par; UNUR_GEN *gen; double *darray; double fpm[10]; int n_tests_failed; int rcode; /* start test */ printf("[validate "); fflush(stdout); fprintf(TESTLOG,"\n[validate]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* distributions: 39 */ { distr[0] = unur_distr_multinormal(2,NULL,NULL); } { distr[1] = unur_distr_multinormal(3,NULL,NULL); } { distr[2] = unur_distr_multinormal(4,NULL,NULL); } { distr[3] = unur_distr_multinormal(5,NULL,NULL); } { distr[4] = unur_distr_multinormal(6,NULL,NULL); } { distr[5] = unur_distr_multinormal(7,NULL,NULL); } { {double ll[2] = {-1.,-1.}; double ru[2] = { 1., 1.}; distr[6] = unur_distr_multinormal(2,NULL,NULL); unur_distr_cvec_set_domain_rect(distr[6],ll,ru); } } { {double ll[3] = {-.1,-.1,-.1}; double ru[3] = { 1., 1., 1.}; distr[7] = unur_distr_multinormal(3,NULL,NULL); unur_distr_cvec_set_domain_rect(distr[7],ll,ru); } } { {double ll[3] = {-.1,-.1,-.1}; double ru[3] = {UNUR_INFINITY,UNUR_INFINITY,UNUR_INFINITY}; distr[8] = unur_distr_multinormal(3,NULL,NULL); unur_distr_cvec_set_domain_rect(distr[8],ll,ru); } } { {double ll[3] = {-UNUR_INFINITY,-UNUR_INFINITY,-UNUR_INFINITY}; double ru[3] = {0.1,0.1,0.1}; distr[9] = unur_distr_multinormal(3,NULL,NULL); unur_distr_cvec_set_domain_rect(distr[9],ll,ru); } } { {double ll[6] = {-1.,-1.,-1.,-1.,-1.,-1.}; double ru[6] = { 1., 1., 1., 1., 1., 1.}; distr[10] = unur_distr_multinormal(6,NULL,NULL); unur_distr_cvec_set_domain_rect(distr[10],ll,ru); } } { {double mean[] = { 10., 20., 30.}; double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; distr[11] = unur_distr_multinormal(3,mean,covar); } } { distr[12] = unur_distr_multinormal_ar1(3,NULL,0.9); } { distr[13] = unur_distr_multinormal_ar1(4,NULL,0.9); } { distr[14] = unur_distr_multinormal_ar1(5,NULL,0.9); } { distr[15] = unur_distr_multinormal_ar1(6,NULL,0.5); } { distr[16] = unur_distr_multinormal_ar1(7,NULL,0.3); } { {double mean[] = { -1., -2., -3., 4., 5., 6., 7., 8., 9., 10. }; distr[17] = unur_distr_multinormal_ar1(3,mean,0.9); } } { {double mean[] = { -1., -2., -3., 4., 5., 6., 7., 8., 9., 10. }; distr[18] = unur_distr_multinormal_ar1(4,mean,0.9); } } { {double mean[] = { -1., -2., -3., 4., 5., 6., 7., 8., 9., 10. }; distr[19] = unur_distr_multinormal_ar1(5,mean,0.9); } } { distr[20] = unur_distr_multinormal_constantrho(3,NULL,0.99); } { distr[21] = unur_distr_multinormal_constantrho(4,NULL,0.9); } { distr[22] = unur_distr_multinormal_constantrho(5,NULL,0.5); } { {double ll[3] = {-.1,-.1,-.1}; double ru[3] = { 1., 1., 1.}; distr[23] = unur_distr_multinormal_ar1(3,NULL,0.9); unur_distr_cvec_set_domain_rect(distr[23],ll,ru); } } { {double ll[3] = { 0., 0., 0.}; double ru[3] = { 1., 1., 1.}; distr[24] = unur_distr_multinormal_ar1(3,NULL,0.9); unur_distr_cvec_set_domain_rect(distr[24],ll,ru); } } { {double ll[3] = {-1.,-1.,-1.}; double ru[3] = { 0., 0., 0.}; distr[25] = unur_distr_multinormal_ar1(3,NULL,0.9); unur_distr_cvec_set_domain_rect(distr[25],ll,ru); } } { {double ll[3] = {-1., 0.,-1.}; double ru[3] = { 0., 1., 0.}; distr[26] = unur_distr_multinormal_ar1(3,NULL,0.9); unur_distr_cvec_set_domain_rect(distr[26],ll,ru); } } { {double ll[3] = { 0., 0., 0.}; double ru[3] = { UNUR_INFINITY, UNUR_INFINITY, UNUR_INFINITY}; distr[27] = unur_distr_multinormal_ar1(3,NULL,0.9); unur_distr_cvec_set_domain_rect(distr[27],ll,ru); } } { {double ll[3] = { -UNUR_INFINITY, -UNUR_INFINITY, -UNUR_INFINITY}; double ru[3] = { 0., 0., 0.}; distr[28] = unur_distr_multinormal_ar1(3,NULL,0.9); unur_distr_cvec_set_domain_rect(distr[28],ll,ru); } } { {double ll[3] = { -UNUR_INFINITY, -UNUR_INFINITY, -UNUR_INFINITY}; double ru[3] = { 0., 0., UNUR_INFINITY}; distr[29] = unur_distr_multinormal_ar1(3,NULL,0.9); unur_distr_cvec_set_domain_rect(distr[29],ll,ru); } } { {double ll[3] = {-1.,-1.,-1.}; double ru[3] = { UNUR_INFINITY, UNUR_INFINITY, UNUR_INFINITY}; distr[30] = unur_distr_multinormal_ar1(3,NULL,0.9); unur_distr_cvec_set_domain_rect(distr[30],ll,ru); } } { {double ll[3] = {-.1,-.1,-.1}; double ru[3] = { 1., 1., 1.}; distr[31] = unur_distr_multinormal(3,NULL,NULL); unur_distr_cvec_set_domain_rect(distr[31],ll,ru); } } { {double ll[3] = { 0., 0., 0.}; double ru[3] = { 1., 1., 1.}; distr[32] = unur_distr_multinormal(3,NULL,NULL); unur_distr_cvec_set_domain_rect(distr[32],ll,ru); } } { {double ll[3] = {-1.,-1.,-1.}; double ru[3] = { 0., 0., 0.}; distr[33] = unur_distr_multinormal(3,NULL,NULL); unur_distr_cvec_set_domain_rect(distr[33],ll,ru); } } { {double ll[3] = {-1., 0.,-1.}; double ru[3] = { 0., 1., 0.}; distr[34] = unur_distr_multinormal(3,NULL,NULL); unur_distr_cvec_set_domain_rect(distr[34],ll,ru); } } { {double ll[3] = { 0., 0., 0.}; double ru[3] = { UNUR_INFINITY, UNUR_INFINITY, UNUR_INFINITY}; distr[35] = unur_distr_multinormal(3,NULL,NULL); unur_distr_cvec_set_domain_rect(distr[35],ll,ru); } } { {double ll[3] = { -UNUR_INFINITY, -UNUR_INFINITY, -UNUR_INFINITY}; double ru[3] = { 0., 0., 0.}; distr[36] = unur_distr_multinormal(3,NULL,NULL); unur_distr_cvec_set_domain_rect(distr[36],ll,ru); } } { {double ll[3] = { -UNUR_INFINITY, -UNUR_INFINITY, -UNUR_INFINITY}; double ru[3] = { 0., 0., UNUR_INFINITY}; distr[37] = unur_distr_multinormal(3,NULL,NULL); unur_distr_cvec_set_domain_rect(distr[37],ll,ru); } } { {double ll[3] = {-1.,-1.,-1.}; double ru[3] = { UNUR_INFINITY, UNUR_INFINITY, UNUR_INFINITY}; distr[38] = unur_distr_multinormal(3,NULL,NULL); unur_distr_cvec_set_domain_rect(distr[38],ll,ru); } } /* timing */ stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); printf("\n(chi^2) "); fflush(stdout); /* chi^2 tests: 39 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nChi^2 Test:\n"); /* distribution [0] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_mvtdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_mvtdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [2] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_mvtdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [3] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_mvtdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [4] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_mvtdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [5] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_mvtdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [6] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_mvtdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [7] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_mvtdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [8] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_mvtdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [9] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_mvtdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [10] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_mvtdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [11] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_mvtdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [12] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_mvtdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [13] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_mvtdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [14] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_mvtdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [15] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_mvtdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [16] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_mvtdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [17] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_mvtdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [18] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_mvtdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [19] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_mvtdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [20] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_mvtdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [21] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_mvtdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [22] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_mvtdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [31] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_mvtdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [32] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_mvtdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [33] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); par = unur_mvtdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [34] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); par = unur_mvtdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [35] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); par = unur_mvtdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[35],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [36] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); par = unur_mvtdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[36],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [37] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[37]); par = unur_mvtdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[37],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [38] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[38]); par = unur_mvtdr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[38],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); printf("\n(verify hat) "); fflush(stdout); /* verify hat tests: 39 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nVerify Hat Test (squeeze <= PDF <= hat):\n"); /* distribution [0] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_mvtdr_new(distr_localcopy); unur_mvtdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_mvtdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_mvtdr_new(distr_localcopy); unur_mvtdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_mvtdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [2] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_mvtdr_new(distr_localcopy); unur_mvtdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_mvtdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [3] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_mvtdr_new(distr_localcopy); unur_mvtdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_mvtdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [4] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_mvtdr_new(distr_localcopy); unur_mvtdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_mvtdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [5] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_mvtdr_new(distr_localcopy); unur_mvtdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_mvtdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [6] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_mvtdr_new(distr_localcopy); unur_mvtdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_mvtdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [7] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_mvtdr_new(distr_localcopy); unur_mvtdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_mvtdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [8] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_mvtdr_new(distr_localcopy); unur_mvtdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_mvtdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [9] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_mvtdr_new(distr_localcopy); unur_mvtdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_mvtdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [10] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_mvtdr_new(distr_localcopy); unur_mvtdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_mvtdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [11] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_mvtdr_new(distr_localcopy); unur_mvtdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_mvtdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [12] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_mvtdr_new(distr_localcopy); unur_mvtdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_mvtdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [13] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_mvtdr_new(distr_localcopy); unur_mvtdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_mvtdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [14] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_mvtdr_new(distr_localcopy); unur_mvtdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_mvtdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [15] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_mvtdr_new(distr_localcopy); unur_mvtdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_mvtdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [16] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_mvtdr_new(distr_localcopy); unur_mvtdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_mvtdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [17] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_mvtdr_new(distr_localcopy); unur_mvtdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_mvtdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [18] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_mvtdr_new(distr_localcopy); unur_mvtdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_mvtdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [19] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_mvtdr_new(distr_localcopy); unur_mvtdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_mvtdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [20] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_mvtdr_new(distr_localcopy); unur_mvtdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_mvtdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [21] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_mvtdr_new(distr_localcopy); unur_mvtdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_mvtdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [22] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_mvtdr_new(distr_localcopy); unur_mvtdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_mvtdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [23] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_mvtdr_new(distr_localcopy); unur_mvtdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_mvtdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [24] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_mvtdr_new(distr_localcopy); unur_mvtdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_mvtdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [25] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_mvtdr_new(distr_localcopy); unur_mvtdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_mvtdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [26] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_mvtdr_new(distr_localcopy); unur_mvtdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_mvtdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [27] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_mvtdr_new(distr_localcopy); unur_mvtdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_mvtdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [28] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_mvtdr_new(distr_localcopy); unur_mvtdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_mvtdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [29] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_mvtdr_new(distr_localcopy); unur_mvtdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_mvtdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[29],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [30] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_mvtdr_new(distr_localcopy); unur_mvtdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_mvtdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[30],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [31] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_mvtdr_new(distr_localcopy); unur_mvtdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_mvtdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[31],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [32] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_mvtdr_new(distr_localcopy); unur_mvtdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_mvtdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[32],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [33] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); par = unur_mvtdr_new(distr_localcopy); unur_mvtdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_mvtdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[33],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [34] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); par = unur_mvtdr_new(distr_localcopy); unur_mvtdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_mvtdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[34],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [35] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[35]); par = unur_mvtdr_new(distr_localcopy); unur_mvtdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_mvtdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[35],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [36] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[36]); par = unur_mvtdr_new(distr_localcopy); unur_mvtdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_mvtdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[36],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [37] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[37]); par = unur_mvtdr_new(distr_localcopy); unur_mvtdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_mvtdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[37],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [38] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[38]); par = unur_mvtdr_new(distr_localcopy); unur_mvtdr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_mvtdr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[38],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); /* free distributions */ unur_distr_free(distr[0]); unur_distr_free(distr[1]); unur_distr_free(distr[2]); unur_distr_free(distr[3]); unur_distr_free(distr[4]); unur_distr_free(distr[5]); unur_distr_free(distr[6]); unur_distr_free(distr[7]); unur_distr_free(distr[8]); unur_distr_free(distr[9]); unur_distr_free(distr[10]); unur_distr_free(distr[11]); unur_distr_free(distr[12]); unur_distr_free(distr[13]); unur_distr_free(distr[14]); unur_distr_free(distr[15]); unur_distr_free(distr[16]); unur_distr_free(distr[17]); unur_distr_free(distr[18]); unur_distr_free(distr[19]); unur_distr_free(distr[20]); unur_distr_free(distr[21]); unur_distr_free(distr[22]); unur_distr_free(distr[23]); unur_distr_free(distr[24]); unur_distr_free(distr[25]); unur_distr_free(distr[26]); unur_distr_free(distr[27]); unur_distr_free(distr[28]); unur_distr_free(distr[29]); unur_distr_free(distr[30]); unur_distr_free(distr[31]); unur_distr_free(distr[32]); unur_distr_free(distr[33]); unur_distr_free(distr[34]); unur_distr_free(distr[35]); unur_distr_free(distr[36]); unur_distr_free(distr[37]); unur_distr_free(distr[38]); /* test finished */ test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; /* we accept CHI2_FAILURES_TOLERATED failures */ (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_validate */ /* enable GCC compiler warning */ GCC_DIAG_ON(unused-variable) /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_mvtdr_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_dau.conf0000644001357500135600000002722714420445767013171 00000000000000############################################################################# [main] [main - data:] # method (for information only: the program scans the file name) method: DAU [main - header:] /* prototypes */ \#define COMPARE_SAMPLE_SIZE (10000) \#define VIOLATE_SAMPLE_SIZE (20) double *make_geometric_vector(double q, int len); double *make_random_vector(int len); UNUR_DISTR *get_distr_with_invalid_pv( void ); UNUR_DISTR *get_distr_with_pv( void ); ############################################################################# [new] [new - invalid NULL ptr: distr = NULL; ] ~( distr ); --> expected_NULL --> UNUR_ERR_NULL [new - invalid distribution type: distr = unur_distr_cont_new(); ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID [new - data missing in distribution object: distr = unur_distr_discr_new(); /* no probability vector */ ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED ############################################################################# [set] [set - invalid NULL ptr: par = NULL; ] ~_urnfactor(par,1.); --> expected_setfailed --> UNUR_ERR_NULL [set - invalid parameter object: distr = get_distr_with_pv(); par = unur_dgt_new(distr); ] ~_urnfactor(par,1.); --> expected_setfailed --> UNUR_ERR_PAR_INVALID unur_par_free(par); [set - invalid parameters: distr = get_distr_with_pv(); par = unur_dau_new(distr); ] ~_urnfactor(par,0.8); --> expected_setfailed --> UNUR_ERR_PAR_SET unur_par_free(par); ############################################################################# # [get] ############################################################################# # [chg] ############################################################################# [init] [init - invalid NULL ptr: par = NULL; ] unur_init( par ); --> expected_NULL --> UNUR_ERR_NULL [init - invalid data: distr = get_distr_with_invalid_pv(); par = unur_dau_new(distr); ] unur_init( par ); --> expected_NULL --> UNUR_ERR_GEN_DATA ############################################################################# [reinit] [reinit - exist: double fpar[2] = {10.,0.63}; distr = unur_distr_binomial(fpar,2); par = unur_dau_new(distr); gen = unur_init( par ); <-- ! NULL ] unur_reinit( gen ); --> expected_reinit ############################################################################# [sample] [sample - compare clone: UNUR_GEN *clone; double fpar[] = {10,0.3}; distr = unur_distr_binomial(fpar,2); par = NULL; gen = NULL; ] /* original generator object */ par = unur_dau_new(distr); gen = unur_init(par); -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen #..................................................................... [sample - compare reinit: double fpar[] = {10,0.3}; distr = unur_distr_binomial(fpar,2); par = NULL; gen = NULL; ] /* original generator object */ par = unur_dau_new(distr); gen = unur_init(par); -->compare_sequence_gen_start /* reinit */ unur_reinit(gen); -->compare_sequence_gen #..................................................................... [sample - compare stringparser: double pv[] = {.1, .2, .3, .4, .5, .6, .7, .8, .9, 1.}; double fpar[] = {0.8}; distr = NULL; par = NULL; gen = NULL; ] distr = unur_distr_discr_new(); unur_distr_discr_set_pv(distr,pv,10); par = unur_dau_new(distr); unur_dau_set_urnfactor(par,3.); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "discr; pv = (.1, .2, .3, .4, .5, .6, .7, .8, .9, 1.) & \ method = dau; urnfactor = 3." ); -->compare_sequence_gen unur_free(gen); gen = NULL; distr = unur_distr_geometric(fpar,1); par = unur_dau_new(distr); unur_dau_set_urnfactor(par,3.); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "geometric(0.8) & method = dau; urnfactor = 3." ); -->compare_sequence_gen ############################################################################# [validate] [validate - generators:] # default program par[0] = unur_dau_new(@distr@); unur_set_debug(par, 1u); # larger urn table size par[1] = unur_dau_new(@distr@); unur_dau_set_urnfactor(par[1],10.); unur_set_debug(par, 1u); # default variant but reinitialized with changed domain { UNUR_DISTR *dg =NULL; par[2] = unur_dau_new(@distr@); dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } # default variant but reinitialized with changed pdf parameters { UNUR_DISTR *dg =NULL; par[3] = unur_dau_new(@distr@); fpm[0] = 10.; fpm[1] = 0.63; dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } [validate - distributions:] # probability vector with random entries distr[0] = unur_distr_discr_new(); darray = make_random_vector(10); unur_distr_discr_set_pv(distr[0],darray,10); free(darray); unur_distr_set_name(distr[0],"pv(random)"); distr[1] = unur_distr_discr_new(); darray = make_random_vector(100); unur_distr_discr_set_pv(distr[1],darray,100); free(darray); unur_distr_set_name(distr[1],"pv(random)"); distr[2] = unur_distr_discr_new(); darray = make_random_vector(1000); unur_distr_discr_set_pv(distr[2],darray,1000); free(darray); unur_distr_set_name(distr[2],"pv(random)"); distr[3] = unur_distr_discr_new(); darray = make_random_vector(10000); unur_distr_discr_set_pv(distr[3],darray,10000); free(darray); unur_distr_set_name(distr[3],"pv(random)"); # probability vector with geometrically distributed entries distr[4] = unur_distr_discr_new(); darray = make_geometric_vector(1.,1000); unur_distr_discr_set_pv(distr[4],darray,1000); free(darray); unur_distr_set_name(distr[4],"pv(geometric)"); distr[5] = unur_distr_discr_new(); darray = make_geometric_vector(0.99,1000); unur_distr_discr_set_pv(distr[5],darray,1000); free(darray); unur_distr_set_name(distr[5],"pv(geometric)"); distr[6] = unur_distr_discr_new(); darray = make_geometric_vector(0.9,1000); unur_distr_discr_set_pv(distr[6],darray,1000); free(darray); unur_distr_set_name(distr[6],"pv(geometric)"); distr[7] = unur_distr_discr_new(); darray = make_geometric_vector(0.5,1000); unur_distr_discr_set_pv(distr[7],darray,1000); free(darray); unur_distr_set_name(distr[7],"pv(geometric)"); distr[8] = unur_distr_discr_new(); darray = make_geometric_vector(0.1,1000); unur_distr_discr_set_pv(distr[8],darray,1000); free(darray); unur_distr_set_name(distr[8],"pv(geometric)"); # probability vecotr with geometrically distributed entries and shifted domain distr[9] = unur_distr_discr_new(); darray = make_geometric_vector(0.9,100); unur_distr_discr_set_pv(distr[9],darray,100); unur_distr_discr_set_domain(distr[9],10,209); free(darray); unur_distr_set_name(distr[9],"pv(geometric) - shifted domain"); distr[10] = unur_distr_discr_new(); darray = make_geometric_vector(0.9,100); unur_distr_discr_set_pv(distr[10],darray,100); unur_distr_discr_set_domain(distr[10],-10,209); free(darray); unur_distr_set_name(distr[10],"pv(geometric) - shifted domain"); # PMF instead of PV # geometric disctribution fpm[0] = 0.5; distr[11] = unur_distr_geometric(fpm,1); fpm[0] = 0.001; distr[12] = unur_distr_geometric(fpm,1); # logarithmic distribution fpm[0] = 0.1; distr[13] = unur_distr_logarithmic(fpm,1); fpm[0] = 0.999; distr[14] = unur_distr_logarithmic(fpm,1); # negative binomial distribution fpm[0] = 0.5; fpm[1] = 10.; distr[15] = unur_distr_negativebinomial(fpm,2); fpm[0] = 0.01; fpm[1] = 20.; distr[16] = unur_distr_negativebinomial(fpm,2); # poisson distribution fpm[0] = 0.1; distr[17] = unur_distr_poisson(fpm,1); fpm[0] = 0.999; distr[18] = unur_distr_poisson(fpm,1); # zipf distribution fpm[0] = 2.; fpm[1] = 1.; distr[19] = unur_distr_zipf(fpm,2); unur_distr_discr_set_domain(distr[19],1,1000); fpm[0] = 0.001; fpm[1] = 1.; distr[20] = unur_distr_zipf(fpm,2); unur_distr_discr_set_domain(distr[20],1,1000); # binomial distribution fpm[0] = 20.; fpm[1] = 0.8; distr[21] = unur_distr_binomial(fpm,2); fpm[0] = 2000.; fpm[1] = 0.0013; distr[22] = unur_distr_binomial(fpm,2); # number of distributions: 23 [validate - test chi2:] # + ... pass test # 0 ... fail to initialize generator # - ... fail test # . ... do not run test # # ... comment # # [0] ... default # [1] ... larger urn table size # [2] ... default variant but reinitialized with changed domain # [3] ....default variant but reinitialized with changed pdf parameters # #gen 0 1 2 3 # distribution #------------------------------------- <0> + + + . # PV with random entries <1> + + + . <2> + + + . x <3> + + + . x <4> + + + . # PV with geometrically distributed entries <5> + + + . x <6> + + + . <7> + + + . x <8> + + + . <9> + + + . # PV with geom. distr. entries and shifted domain <10> + + + . # PMF instead of PV <11> + + + . # geometric (0.5) <12> + + + . # geometric (0.001) <13> + + + . # logarithmic (0.1) <14> + + + . # logarithmic (0.999) <15> + + + . # negativebinomial (0.5, 10) x<16> + + + . # negativebinomial (0.01, 20) x<17> + + + . # poisson (0.1) <18> + + + . # poisson (0.999) <19> + + + . # zipf (2, 1) x<20> + + + . # zipf (0.001, 1) <21> + + + + # binomial (20, 0.8) x<22> + + + + # binomial (2000, 0.0013) # number of distributions: 23 ############################################################################# ############################################################################# [verbatim] /*---------------------------------------------------------------------------*/ /* make a probability vector (need not sum to one) (use random entries) */ double *make_random_vector(int len) { double *pv; int i; /* allocate memory */ pv = malloc(len*sizeof(double)); if (!pv) abort(); /* main part of geometric distribution */ for( i=0; i #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); int unur_mixt_set_verify( UNUR_PAR *par, int verify); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ double cdf_cont_1 ( double x, const UNUR_DISTR *distr ); double cdf_cont_inv ( double x, const UNUR_DISTR *distr ); #define COMPARE_SAMPLE_SIZE (10000) #define VIOLATE_SAMPLE_SIZE (20) /* #define SEED (1656256) */ /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ static UNUR_DISTR *d0 = NULL; static UNUR_DISTR *d1 = NULL; static UNUR_DISTR *d2 = NULL; void remove_cont_1(void) { unur_distr_free(d0); unur_distr_free(d1); unur_distr_free(d2); } double cdf_cont_1 ( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED ) { double p[3] = {1./6., 2./6., 3./6.}; double y; if (d0 == NULL) { double fpar[2] = {-2,-1}; d0 = unur_distr_exponential(NULL,0); d1 = unur_distr_normal(NULL,0); d2 = unur_distr_uniform(fpar,2); atexit(remove_cont_1); } y = ( p[0] * unur_distr_cont_eval_cdf(x,d0) + p[1] * unur_distr_cont_eval_cdf(x,d1) + p[2] * unur_distr_cont_eval_cdf(x,d2) ); return y; } static UNUR_DISTR *di = NULL; void remove_cont_inv(void) { unur_distr_free(di); } double cdf_cont_inv ( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED ) { double p[3] = {1./6., 2./6., 3./6.}; double y; if (di == NULL) { di = unur_distr_normal(NULL,0); atexit(remove_cont_inv); } if (x < -1.) { y = p[0] * unur_distr_cont_eval_cdf(x,di) / 0.1586553; } else if (x < 1.) { y = p[0] + p[1] * (unur_distr_cont_eval_cdf(x,di) - 0.1586553) / (0.8413447 - 0.1586553); } else { y = p[0] + p[1] + p[2] * (unur_distr_cont_eval_cdf(x,di) - 0.8413447) / (1 - 0.8413447); } return y; } /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ double prob[2] = {1,2}; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,30,(unur_mixt_new( 0, NULL, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,30,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,33,(unur_mixt_new( 2, prob, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,33,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* invalid arguments */ double prob[2] = {1,2}; UNUR_GEN *comp[2]; comp[0] = unur_str2gen("normal"); comp[1] = unur_str2gen("normal"); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,44,(unur_mixt_new( -1, prob, comp )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,44,UNUR_ERR_DISTR_DOMAIN)==UNUR_SUCCESS)?0:1; unur_free(comp[0]); unur_free(comp[1]); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [set] */ void test_set (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[set "); fflush(stdout); fprintf(TESTLOG,"\n[set]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,58,(unur_mixt_set_useinversion(par,0.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,58,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* invalid parameter object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,65,(unur_mixt_set_useinversion(par,0.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,65,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_set() */ /*---------------------------------------------------------------------------*/ /* [init] */ void test_init (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[init "); fflush(stdout); fprintf(TESTLOG,"\n[init]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL in list of components */ UNUR_PAR *par = NULL; double prob[2] = {1,2}; UNUR_GEN *comp[2] = {NULL, NULL}; par = unur_mixt_new(2,prob,comp); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,87,(unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,87,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* invalid distribution type */ double prob[2] = {1,2}; UNUR_DISTR *distr; UNUR_PAR *par; UNUR_GEN *comp[2]; distr = unur_distr_multinormal(2,NULL,NULL); comp[0] = unur_init(unur_hitro_new(distr)); comp[1] = unur_str2gen("normal"); unur_reset_errno(); par = unur_mixt_new( 2, prob, comp ); n_tests_failed += (check_expected_NULL(TESTLOG,101,(unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,101,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(comp[0]); unur_free(comp[1]); } { /* invalid probabilities */ double prob[2] = {1,-2}; UNUR_PAR *par; UNUR_GEN *comp[2]; comp[0] = unur_str2gen("normal"); comp[1] = unur_str2gen("normal"); unur_reset_errno(); par = unur_mixt_new( 2, prob, comp ); n_tests_failed += (check_expected_NULL(TESTLOG,118,(unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,118,UNUR_ERR_GEN_DATA)==UNUR_SUCCESS)?0:1; unur_free(comp[0]); unur_free(comp[1]); } { /* no inversion method */ double prob[2] = {1,2}; UNUR_PAR *par; UNUR_GEN *comp[2]; comp[0] = unur_str2gen("normal&method=ssr"); comp[1] = unur_str2gen("normal&method=ssr"); unur_reset_errno(); par = unur_mixt_new( 2, prob, comp ); unur_mixt_set_useinversion(par,TRUE); n_tests_failed += (check_expected_NULL(TESTLOG,135,(unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,135,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_free(comp[0]); unur_free(comp[1]); } { /* overlapping domains cont+cont */ double prob[2] = {1,2}; UNUR_PAR *par; UNUR_GEN *comp[2]; comp[0] = unur_str2gen("normal;domain=(-2,1)&method=pinv"); comp[1] = unur_str2gen("normal;domain=(-1,2)&method=pinv"); unur_reset_errno(); par = unur_mixt_new( 2, prob, comp ); unur_mixt_set_useinversion(par,TRUE); n_tests_failed += (check_expected_NULL(TESTLOG,152,(unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,152,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_free(comp[0]); unur_free(comp[1]); } { /* overlapping domains cont+discr */ double prob[2] = {1,2}; UNUR_PAR *par; UNUR_GEN *comp[2]; comp[0] = unur_str2gen("normal;domain=(-2,3)&method=pinv"); comp[1] = unur_str2gen("binomial(100,0.2)&method=dgt"); unur_reset_errno(); par = unur_mixt_new( 2, prob, comp ); unur_mixt_set_useinversion(par,TRUE); n_tests_failed += (check_expected_NULL(TESTLOG,169,(unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,169,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_free(comp[0]); unur_free(comp[1]); } { /* overlapping domains discr+discr */ double prob[2] = {1,2}; UNUR_PAR *par; UNUR_GEN *comp[2]; comp[0] = unur_str2gen("geometric(0.1)&method=dgt"); comp[1] = unur_str2gen("binomial(100,0.2)&method=dgt"); unur_reset_errno(); par = unur_mixt_new( 2, prob, comp ); unur_mixt_set_useinversion(par,TRUE); n_tests_failed += (check_expected_NULL(TESTLOG,186,(unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,186,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_free(comp[0]); unur_free(comp[1]); } { /* unsorted domains */ double prob[2] = {1,2}; UNUR_PAR *par; UNUR_GEN *comp[2]; comp[0] = unur_str2gen("normal;domain=(1,2)&method=pinv"); comp[1] = unur_str2gen("normal;domain=(-2,-1)&method=pinv"); unur_reset_errno(); par = unur_mixt_new( 2, prob, comp ); unur_mixt_set_useinversion(par,TRUE); n_tests_failed += (check_expected_NULL(TESTLOG,203,(unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,203,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_free(comp[0]); unur_free(comp[1]); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_init() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* compare clone cont+cont */ UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; UNUR_GEN *clone; double prob[2] = {1,2}; UNUR_GEN *comp[2]; par = NULL; gen = NULL; comp[0] = unur_str2gen("normal"); comp[1] = unur_str2gen("exponential"); unur_reset_errno(); /* original generator object */ par = unur_mixt_new( 2, prob, comp ); gen = unur_init( par ); n_tests_failed += (compare_sequence_gen_start(TESTLOG,230,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,236,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_free(comp[0]); unur_free(comp[1]); unur_free(gen); } { /* compare clone cont+discr */ UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; UNUR_GEN *clone; double prob[2] = {1,2}; UNUR_GEN *comp[2]; par = NULL; gen = NULL; comp[0] = unur_str2gen("normal&method=tdr"); comp[1] = unur_str2gen("binomial(100,0.2)&method=dgt"); unur_reset_errno(); /* original generator object */ par = unur_mixt_new( 2, prob, comp ); gen = unur_init( par ); n_tests_failed += (compare_sequence_gen_start(TESTLOG,256,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,262,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_free(comp[0]); unur_free(comp[1]); unur_free(gen); } { /* compare clone discr+discr */ UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; UNUR_GEN *clone; double prob[2] = {1,2}; UNUR_GEN *comp[2]; par = NULL; gen = NULL; comp[0] = unur_str2gen("geometric(0.1)&method=dgt"); comp[1] = unur_str2gen("binomial(100,0.2)&method=dgt"); unur_reset_errno(); /* original generator object */ par = unur_mixt_new( 2, prob, comp ); gen = unur_init( par ); n_tests_failed += (compare_sequence_gen_start(TESTLOG,282,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,288,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_free(comp[0]); unur_free(comp[1]); unur_free(gen); } { /* compare clone cont+discr */ UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; UNUR_GEN *clone; double prob[2] = {1,2}; UNUR_GEN *comp[2]; par = NULL; gen = NULL; comp[0] = unur_str2gen("normal"); comp[1] = unur_str2gen("binomial(100,0.2)&method=dgt"); unur_reset_errno(); /* original generator object */ par = unur_mixt_new( 2, prob, comp ); gen = unur_init( par ); n_tests_failed += (compare_sequence_gen_start(TESTLOG,308,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,314,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_free(comp[0]); unur_free(comp[1]); unur_free(gen); } { /* compare clone empirical+discr */ UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; UNUR_GEN *clone; double prob[2] = {1,2}; UNUR_GEN *comp[2]; par = NULL; gen = NULL; comp[0] = unur_str2gen("distr = cemp; \ data=(-0.10, 0.05,-0.50, 0.08, 0.13, \ -0.21,-0.44,-0.43,-0.33,-0.30, \ 0.18, 0.20,-0.37,-0.29,-0.90) \ & method=empk; smoothing=0.8"); comp[1] = unur_str2gen("binomial(100,0.2)&method=dgt"); unur_reset_errno(); /* original generator object */ par = unur_mixt_new( 2, prob, comp ); gen = unur_init( par ); n_tests_failed += (compare_sequence_gen_start(TESTLOG,338,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,344,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_free(comp[0]); unur_free(comp[1]); unur_free(gen); } { /* compare clone mixt+cont */ UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; UNUR_GEN *clone; double prob[2] = {1,2}; UNUR_GEN *comp[2]; par = NULL; gen = NULL; comp[0] = unur_str2gen("normal&method=tdr"); comp[1] = unur_str2gen("exponential&method=arou"); par = unur_mixt_new( 2, prob, comp ); gen = unur_init( par ); unur_free(comp[0]); unur_free(comp[1]); comp[0] = gen; comp[1] = unur_str2gen("cauchy&method=srou"); unur_reset_errno(); /* original generator object */ par = unur_mixt_new( 2, prob, comp ); gen = unur_init( par ); n_tests_failed += (compare_sequence_gen_start(TESTLOG,371,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,377,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_free(comp[0]); unur_free(comp[1]); unur_free(gen); } { /* compare clone mixt+cont+inversion */ UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; UNUR_GEN *clone; double prob[2] = {1,2}; UNUR_GEN *comp[2]; par = NULL; gen = NULL; comp[0] = unur_str2gen("normal;domain=(-inf,-1)&method=pinv"); comp[1] = unur_str2gen("normal;domain=(-1,1)&method=pinv"); par = unur_mixt_new( 2, prob, comp ); unur_mixt_set_useinversion(par,TRUE); gen = unur_init( par ); unur_free(comp[0]); unur_free(comp[1]); comp[0] = gen; comp[1] = unur_str2gen("normal;domain=(1,inf)&method=pinv"); unur_reset_errno(); /* original generator object */ par = unur_mixt_new( 2, prob, comp ); unur_mixt_set_useinversion(par,TRUE); gen = unur_init( par ); n_tests_failed += (compare_sequence_gen_start(TESTLOG,406,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,412,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_free(comp[0]); unur_free(comp[1]); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* [special] */ void test_special (void) { /* set boolean to FALSE */ int FAILED = 0; int rcode = 0; int errorsum = 0; UNUR_DISTR *dtmp; UNUR_PAR *par; UNUR_GEN *gen; UNUR_GEN *comp[3]; double prob[3] = {1.,2.,3.}; /* start test */ printf("[special "); fflush(stdout); fprintf(TESTLOG,"\n[special]\n"); /* set stop watch */ stopwatch_lap(&watch); /* very ugly hack */ comp[0] = unur_str2gen("exponential&method=pinv"); comp[1] = unur_str2gen("normal&method=pinv"); comp[2] = unur_str2gen("uniform(-2,-1)&method=pinv"); unur_reset_errno(); par = unur_mixt_new( 3, prob, comp ); gen = unur_init(par); dtmp = unur_get_distr(gen); unur_distr_set_name(dtmp,"cont"); unur_distr_cont_set_cdf(dtmp,cdf_cont_1); rcode = run_validate_chi2(TESTLOG,0,gen,dtmp,'+'); errorsum += (rcode==UNUR_SUCCESS)?0:1; unur_free(gen); unur_free(comp[0]); unur_free(comp[1]); unur_free(comp[2]); /* ---------------------------------- */ comp[0] = unur_str2gen("normal;domain=(-inf,-1)&method=pinv"); comp[1] = unur_str2gen("normal;domain=(-1,1)&method=pinv"); comp[2] = unur_str2gen("normal;domain=(1,inf)&method=pinv"); unur_reset_errno(); par = unur_mixt_new( 3, prob, comp ); gen = unur_init(par); dtmp = unur_get_distr(gen); unur_distr_set_name(dtmp,"cont"); unur_distr_cont_set_cdf(dtmp,cdf_cont_inv); rcode = run_validate_chi2(TESTLOG,0,gen,dtmp,'+'); errorsum += (rcode==UNUR_SUCCESS)?0:1; unur_free(gen); unur_free(comp[0]); unur_free(comp[1]); unur_free(comp[2]); comp[0] = unur_str2gen("normal;domain=(-inf,-1)&method=pinv"); comp[1] = unur_str2gen("normal;domain=(-1,1)&method=pinv"); comp[2] = unur_str2gen("normal;domain=(1,inf)&method=pinv"); unur_reset_errno(); par = unur_mixt_new( 3, prob, comp ); unur_mixt_set_useinversion(par,TRUE); gen = unur_init(par); dtmp = unur_get_distr(gen); unur_distr_set_name(dtmp,"cont_inv"); unur_distr_cont_set_cdf(dtmp,cdf_cont_inv); rcode = run_validate_chi2(TESTLOG,0,gen,dtmp,'+'); errorsum += (rcode==UNUR_SUCCESS)?0:1; unur_free(gen); unur_free(comp[0]); unur_free(comp[1]); unur_free(comp[2]); /* ---------------------------------- */ /* test finished */ FAILED = (errorsum < 1) ? 0 : 1; /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (FAILED) ? 0 : 1; (FAILED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_special() */ /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_mixt_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_dsrou.conf0000644001357500135600000002740514420445767013552 00000000000000############################################################################# [main] [main - data:] # method (for information only: the program scans the file name) method: DSROU [main - header:] /* prototypes */ int unur_dsrou_set_pedantic( struct unur_par *par, int pedantic ); double pmf( int k, const UNUR_DISTR *distr ); double pmf_invalidmode( int k, const UNUR_DISTR *distr ); double pmf_geom05( int k, const UNUR_DISTR *distr ); double cdf_geom05( int k, const UNUR_DISTR *distr ); \#define COMPARE_SAMPLE_SIZE (10000) \#define VIOLATE_SAMPLE_SIZE (10000) /* \#define SEED (298346) */ ############################################################################# [new] [new - invalid NULL ptr: distr = NULL; ] ~( distr ); --> expected_NULL --> UNUR_ERR_NULL [new - invalid distribution type: distr = unur_distr_cont_new(); ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID [new - data missing in distribution object: distr = unur_distr_discr_new(); ] /* pmf, mode, pmfsum */ ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED ############################################################################# [set] [set - invalid NULL ptr: par = NULL; ] ~_cdfatmode(par,0.); --> expected_setfailed --> UNUR_ERR_NULL ~_verify(par,1); --> expected_setfailed --> UNUR_ERR_NULL [set - invalid parameter object: double fpar[2] = {10,0.63}; distr = unur_distr_binomial(fpar,2); par = unur_dari_new(distr); ] ~_cdfatmode(par,0.); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_verify(par,1); --> expected_setfailed --> UNUR_ERR_PAR_INVALID unur_par_free(par); [set - invalid parameters: double fpar[2] = {10.,0.63}; distr = unur_distr_binomial(fpar,2); par = unur_dsrou_new(distr); ] ~_cdfatmode(par,-1.); --> expected_setfailed --> UNUR_ERR_PAR_SET unur_par_free(par); ############################################################################# # [get] ############################################################################# [chg] [chg - invalid generator object: double fpar[2] = {10.,0.63}; distr = unur_distr_binomial(fpar,2); par = unur_dari_new(distr); unur_set_debug(par,0); gen = unur_init( par ); <-- ! NULL ] ~_verify(gen,1); --> expected_setfailed --> UNUR_ERR_GEN_INVALID ~_cdfatmode(gen,1.); --> expected_setfailed --> UNUR_ERR_GEN_INVALID [chg - invalid parameters: double fpar[2] = {10.,0.63}; distr = unur_distr_binomial(fpar,2); par = unur_dsrou_new(distr); gen = unur_init( par ); <-- ! NULL ] ~_cdfatmode(gen,-1.); --> expected_setfailed --> UNUR_ERR_PAR_SET ############################################################################# [init] [init - invalid NULL ptr: par = NULL; ] unur_init( par ); --> expected_NULL --> UNUR_ERR_NULL [init - invalid data: distr = unur_distr_discr_new(); unur_distr_discr_set_pmf(distr,pmf); unur_distr_discr_set_mode(distr,2); unur_distr_discr_set_pmfsum(distr,1.); par = unur_dsrou_new(distr); ] unur_init( par ); --> expected_NULL --> UNUR_ERR_GEN_DATA [init - data missing in distribution object: distr = unur_distr_discr_new(); par = NULL; ] /* mode, pmfsum */ unur_distr_discr_set_pmf(distr,pmf); par = unur_dsrou_new( distr ); unur_init(par); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED /* pmfsum */ unur_distr_discr_set_mode(distr,0); par = unur_dsrou_new( distr ); unur_init(par); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED ############################################################################# [reinit] [reinit - exist: double fpar[2] = {10.,0.63}; distr = unur_distr_binomial(fpar,2); par = unur_dsrou_new(distr); gen = unur_init( par ); <-- ! NULL ] unur_reinit( gen ); --> expected_reinit ############################################################################# [sample] [sample - compare: double fpar[2] = {10.,0.63}; distr = unur_distr_binomial(fpar,2); par = NULL; ] /* default algorithm */ par = unur_dsrou_new(distr); -->compare_sequence_par_start /* default algorithm - verifying mode */ par = unur_dsrou_new(distr); unur_dsrou_set_verify(par,1); -->compare_sequence_par #..................................................................... [sample - violate condition: double fpar[2] = {10.,0.63}; distr = unur_distr_binomial(fpar,2); par = NULL; ] /* use cdf at mode */ par = unur_dsrou_new(distr); unur_dsrou_set_cdfatmode(par,0.1); --> run_verify_generator --> UNUR_ERR_GEN_CONDITION #..................................................................... [sample - compare clone: UNUR_GEN *clone; double fpar[] = {10,0.3}; distr = unur_distr_binomial(fpar,2); par = NULL; gen = NULL; ] /* original generator object */ par = unur_dsrou_new(distr); gen = unur_init(par); -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen #..................................................................... [sample - compare reinit: double fpar[] = {10,0.3}; distr = unur_distr_binomial(fpar,2); par = NULL; gen = NULL; ] /* original generator object */ par = unur_dsrou_new(distr); gen = unur_init(par); -->compare_sequence_gen_start /* reinit */ unur_reinit(gen); -->compare_sequence_gen #..................................................................... [sample - compare stringparser: double fpar[] = {3.}; distr = NULL; par = NULL; gen = NULL; ] distr = unur_distr_poisson(fpar,1); par = unur_dsrou_new(distr); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "poisson(3.) & method = dsrou" ); -->compare_sequence_gen unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; distr = unur_distr_poisson(fpar,1); par = unur_dsrou_new(distr); unur_dsrou_set_cdfatmode(par,0.3); unur_dsrou_set_verify(par,1); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "poisson(3.) & method = dsrou; cdfatmode=0.3; verify=on" ); -->compare_sequence_gen ############################################################################# [validate] [validate - generators:] # default variant par[0] = unur_dsrou_new(@distr@); # use cdf at mode { double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(@distr@), @distr@ ); par[1] = unur_dsrou_new(@distr@); unur_dsrou_set_cdfatmode(par,Fmode); } # default variant but reinitialized with changed domain { UNUR_DISTR *dg =NULL; par[2] = unur_dsrou_new(@distr@); dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } # default variant but reinitialized with changed pdf parameters { UNUR_DISTR *dg =NULL; par[3] = unur_dsrou_new(@distr@); fpm[0] = 10.; fpm[1] = 0.63; dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } [validate - distributions:] # geometric disctribution fpm[0] = 0.5; distr[0] = unur_distr_geometric(fpm,1); fpm[0] = 0.1; distr[1] = unur_distr_geometric(fpm,1); fpm[0] = 0.001; distr[2] = unur_distr_geometric(fpm,1); # logarithmic distribution fpm[0] = 0.1; distr[3] = unur_distr_logarithmic(fpm,1); fpm[0] = 0.9; distr[4] = unur_distr_logarithmic(fpm,1); # negative binomial distribution fpm[0] = 0.5; fpm[1] = 10.; distr[5] = unur_distr_negativebinomial(fpm,2); fpm[0] = 0.7; fpm[1] = 5.; distr[6] = unur_distr_negativebinomial(fpm,2); fpm[0] = 0.1; fpm[1] = 20.; distr[7] = unur_distr_negativebinomial(fpm,2); # poisson distribution fpm[0] = 3.; distr[8] = unur_distr_poisson(fpm,1); fpm[0] = 50.; distr[9] = unur_distr_poisson(fpm,1); # zipf distribution fpm[0] = 2.; fpm[1] = 1.; distr[10] = unur_distr_zipf(fpm,2); # binomial distribution fpm[0] = 20.; fpm[1] = 0.8; distr[11] = unur_distr_binomial(fpm,2); # binomial distribution fpm[0] = 2000.; fpm[1] = 0.0013; distr[12] = unur_distr_binomial(fpm,2); # Hyper geometric distribution fpm[0] = 2000.; fpm[1] = 200.; fpm[2] = 20; distr[13] = unur_distr_hypergeometric(fpm,3); # Hyper geometric distribution fpm[0] = 2000.; fpm[1] = 200.; fpm[2] = 220; distr[14] = unur_distr_hypergeometric(fpm,3); # Test for mode finding algorithm distr[15] = unur_distr_discr_new(); unur_distr_discr_set_pmf(distr[15],pmf_geom05); unur_distr_discr_set_cdf(distr[15],cdf_geom05); unur_distr_set_name(distr[15],"test find_mode"); # number of distributions: 16 [validate - test chi2:] # + ... pass test # 0 ... fail to initialize generator (given variant does not exist) # - ... fail test # . ... do not run test # # ... comment # # generators: # [0] ... default # [1] ... use cdf at mode-1 # [2] ... default variant but reinitialized with changed domain # [3] ....default variant but reinitialized with changed pdf parameters # #gen 0 1 2 3 # distribution #---------------------------------------------------- <0> + + + . # geometric (0.5) <1> + + + . # geometric (0.1) <2> + + + . # geometric (0.001) <3> + + + . # logarithmic (0.1) <4> + + + . # logarithmic (0.9) <5> + + + . # negativebinomial (0.5, 10) <6> + + + . # negativebinomial (0.7, 5) <7> + + + . # negativebinomial (0.1, 20) <8> + + + . # poisson (3) <9> + + + . # poisson (20) #<10> . . . . # zipf (2, 1) <11> + + + + # binomial (20, 0.8) <12> + + + + # binomial (2000, 0.0013) <13> + + + . # hypergeometric (2000, 200, 20) <14> + + + . # hypergeometric (2000, 200, 220) <15> + . . . # geomtric(0.5) with domain (1,inf) # number of distributions: 16 [validate - verify hat:] # + ... pass test # ~ ... fail in at most 1% of samples # 0 ... fail to initialize generator # - ... fail test # . ... do not run test # # ... comment # # # generators: # [0] ... default # [1] ... use cdf at mode-1 # [2] ... default variant but reinitialized with changed domain # [3] ....default variant but reinitialized with changed pdf parameters # #gen 0 1 2 3 # distribution #---------------------------------------------------- <0> + + + . # geometric (0.5) <1> + + + . # geometric (0.1) <2> + + + . # geometric (0.001) <3> + + + . # logarithmic (0.1) <4> + + + . # logarithmic (0.9) <5> + + + . # negativebinomial (0.5, 10) <6> + + + . # negativebinomial (0.7, 5) <7> + + . . # negativebinomial (0.1, 20) <8> + + + . # poisson (3) <9> + + + . # poisson (20) #<10> . . . . # zipf (2, 1) <11> + + + + # binomial (20, 0.8) <12> + + + + # binomial (2000, 0.0013) <13> + + + . # hypergeometric (2000, 200, 20) <14> + + + . # hypergeometric (2000, 200, 220) <15> + . . . # geomtric(0.5) with domain (1,inf) # number of distributions: 16 ############################################################################# ############################################################################# [verbatim] /* pmf that does not work */ double pmf( int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return ((k==2) ? 0. : pow(0.5,(double)k)); } /* end of pmf */ double pmf_invalidmode( int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return ((k==2) ? 0.01 : pow(0.5,(double)k)); } /* end of pmf */ /* pmf for geometric(0.5) distribution with domain (1,inf) */ double pmf_geom05( int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return (pow(0.5,(double)k)); } double cdf_geom05( int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return (1.-pow(0.5,(double)k)); } /* dummy function */ int unur_dsrou_set_pedantic( struct unur_par *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) { return 1; } ############################################################################# unuran-1.11.0/tests/t_info.conf0000644001357500135600000005773714420445767013364 00000000000000############################################################################# [main] [main - data:] # method (for information only: the program scans the file name) method: INFO [main - header:] /* prototypes */ /* CEXT: */ double exp1_sample(UNUR_GEN *gen); /* DEXT: */ int geom12_sample(UNUR_GEN *gen); \#define COMPARE_SAMPLE_SIZE (10000) \#define VIOLATE_SAMPLE_SIZE (20) /* macros for running info test */ \#define INFO_TEST(genstr) \ gen = unur_str2gen((genstr)); \ fprintf(TESTLOG,"GEN = \"%s\"\n",(genstr)); \ fprintf(TESTLOG,"INFO = \n%s\n",unur_gen_info(gen,FALSE)); \ fprintf(TESTLOG,"HELP = \n%s\n",unur_gen_info(gen,TRUE)); \ fprintf(TESTLOG,"---------------------\n"); \ unur_free(gen); gen = NULL; \#define INFO_TEST_chg(genstr,run_chg) \ gen = unur_str2gen((genstr)); \ run_chg; \ fprintf(TESTLOG,"GEN = \"%s\"\n",(genstr)); \ fprintf(TESTLOG,"INFO = \n%s\n",unur_gen_info(gen,FALSE)); \ fprintf(TESTLOG,"HELP = \n%s\n",unur_gen_info(gen,TRUE)); \ fprintf(TESTLOG,"---------------------\n"); \ unur_free(gen); gen = NULL; \#define METHOD(m) \ printf("%s ",(m)); \ fprintf(TESTLOG,"*********************\n"); \ fprintf(TESTLOG,"* %s\n",(m)); \ fprintf(TESTLOG,"*********************\n\n"); \ fflush(stdout); \#define INFO_TEST_par(genstr,gen) \ fprintf(TESTLOG,"GEN = \"%s\"\n",(genstr)); \ fprintf(TESTLOG,"INFO = \n%s\n",unur_gen_info((gen),FALSE)); \ fprintf(TESTLOG,"HELP = \n%s\n",unur_gen_info((gen),TRUE)); \ fprintf(TESTLOG,"---------------------\n"); \ unur_free(gen); gen = NULL; ############################################################################# [new] ############################################################################# # [set] ############################################################################# # [get] ############################################################################# # [chg] ############################################################################# # [init] ############################################################################# # [reinit] ############################################################################# [sample] [sample - set debugging flags: gen = NULL; ] unur_set_default_debug(UNUR_DEBUG_INIT); #--------------------------------------------------------------------- [sample - AROU: gen = NULL; ] \#ifdef UNUR_ENABLE_INFO METHOD("AROU"); INFO_TEST("normal & method=arou"); INFO_TEST("normal & method=arou; max_segments=10; cpoints=3"); INFO_TEST("cont; pdf='exp(-x^2)' & method=arou; max_segments=1000"); INFO_TEST("cont; pdf='exp(-x^2)' & method=arou; max_segments=1000; max_sqhratio=0.90"); \#endif #--------------------------------------------------------------------- [sample - ARS: gen = NULL; ] \#ifdef UNUR_ENABLE_INFO METHOD("ARS"); INFO_TEST("normal & method=ars"); INFO_TEST("normal & method=ars; cpoints=100"); INFO_TEST("cont; logpdf='-x^2' & method=ars"); \#endif #--------------------------------------------------------------------- [sample - CEXT: distr = NULL; par = NULL; gen = NULL; ] \#ifdef UNUR_ENABLE_INFO METHOD("CEXT"); distr = unur_distr_exponential(NULL,0); par = unur_cext_new(distr); unur_cext_set_sample(par,exp1_sample); gen = unur_init(par); INFO_TEST_par("... & method=cext",gen); \#endif #--------------------------------------------------------------------- [sample - CSTD: gen = NULL; ] \#ifdef UNUR_ENABLE_INFO METHOD("CSTD"); INFO_TEST("normal & method=cstd"); INFO_TEST("normal & method=cstd; variant=0"); INFO_TEST("normal & method=cstd; variant=-1"); INFO_TEST("normal & method=cstd; variant=1"); INFO_TEST("normal & method=cstd; variant=2"); INFO_TEST("normal & method=cstd; variant=3"); \#endif #--------------------------------------------------------------------- [sample - DARI: gen = NULL; ] \#ifdef UNUR_ENABLE_INFO METHOD("DARI"); INFO_TEST("geometric(0.5) & method=dari"); INFO_TEST("binomial(20,0.5) & method=dari"); INFO_TEST("binomial(20,0.5) & method=dari;squeeze=on"); INFO_TEST("binomial(20,0.5) & method=dari;tablesize=0"); INFO_TEST("binomial(20,0.5) & method=dari;cpfactor=0.6"); INFO_TEST("discr; pmf='0.5^x';domain=(0,inf) & method=dari"); INFO_TEST("discr; pmf='2*0.5^x';domain=(1,inf) & method=dari"); \#endif #--------------------------------------------------------------------- [sample - DAU: gen = NULL; ] \#ifdef UNUR_ENABLE_INFO METHOD("DAU"); INFO_TEST("geometric(0.5) & method=dau"); INFO_TEST("geometric(0.5) & method=dau;urnfactor=2"); INFO_TEST("discr; pv=(.1,.2,.3,.4,.5,.6,.7) & method=dau"); \#endif #--------------------------------------------------------------------- [sample - DGT: gen = NULL; ] \#ifdef UNUR_ENABLE_INFO METHOD("DGT"); INFO_TEST("geometric(0.5) & method=dgt"); INFO_TEST("geometric(0.5) & method=dgt;guidefactor=2"); INFO_TEST("discr; pv=(.1,.2,.3,.4,.5,.6,.7) & method=dgt"); \#endif #--------------------------------------------------------------------- [sample - DSROU: gen = NULL; ] \#ifdef UNUR_ENABLE_INFO METHOD("DSROU"); INFO_TEST("geometric(0.5) & method=dsrou"); INFO_TEST("binomial(20,0.5) & method=dsrou;cdfatmode=0.5"); INFO_TEST("binomial(20,0.5) & method=dsrou"); INFO_TEST("discr; pmf='0.5^x';domain=(0,inf);pmfsum=2 & method=dsrou"); INFO_TEST("discr; pmf='2*0.5^x';domain=(1,inf);pmfsum=2 & method=dsrou"); \#endif #--------------------------------------------------------------------- [sample - DSS: gen = NULL; ] \#ifdef UNUR_ENABLE_INFO METHOD("DSS"); INFO_TEST("geometric(0.5) & method=dss"); INFO_TEST("discr; pv=(.1,.2,.3,.4,.5,.6,.7);pmfsum=2.8 & method=dss"); INFO_TEST("discr; cdf='1-exp(-x)';pmfsum=1 & method=dss"); \#endif #--------------------------------------------------------------------- [sample - DSTD: gen = NULL; ] \#ifdef UNUR_ENABLE_INFO METHOD("DSTD"); INFO_TEST("poisson(10) & method=dstd"); INFO_TEST("poisson(10) & method=dstd;variant=0"); INFO_TEST("poisson(10) & method=dstd;variant=2"); INFO_TEST("geometric(0.5) & method=dstd"); INFO_TEST("geometric(0.5) & method=dstd;variant=0"); INFO_TEST("geometric(0.5) & method=dstd;variant=-1"); \#endif #--------------------------------------------------------------------- [sample - DEXT: double fpar[1] = {0.5}; distr = NULL; par = NULL; gen = NULL; ] \#ifdef UNUR_ENABLE_INFO METHOD("DEXT"); distr = unur_distr_geometric(fpar,1); par = unur_dext_new(distr); unur_dext_set_sample(par,geom12_sample); gen = unur_init(par); INFO_TEST_par("... & method=dext",gen); \#endif #--------------------------------------------------------------------- [sample - EMPK: gen = NULL; ] \#ifdef UNUR_ENABLE_INFO METHOD("EMPK"); INFO_TEST("cemp; data=(1.,2.,3.,4.,5.,6.,7.,8.,9.) & method=empk"); INFO_TEST("cemp; data=(1.,2.,3.,4.,5.,6.,7.,8.,9.) & method=empk\ ;beta=1.5;positive=on;smoothing=1.2;varcor=on"); \#endif #--------------------------------------------------------------------- [sample - EMPL: gen = NULL; ] \#ifdef UNUR_ENABLE_INFO METHOD("EMPL"); INFO_TEST("cemp; data=(1.,2.,3.,4.,5.,6.,7.,8.,9.) & method = empl"); \#endif #--------------------------------------------------------------------- [sample - GIBBS: const int dim = 3; double mean[] = {1.,2.,3.}; double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; double ll[] = {0.,0.,0.}; double ru[] = {1.,UNUR_INFINITY,UNUR_INFINITY}; distr = NULL; par = NULL; gen = NULL; ] \#ifdef UNUR_ENABLE_INFO METHOD("GIBBS"); distr = unur_distr_multinormal( dim, mean, covar ); par = unur_gibbs_new(distr); gen = unur_init(par); INFO_TEST_par("... & method=gibbs",gen); unur_distr_free(distr);unur_free(gen); distr = unur_distr_multinormal( dim, NULL, NULL ); unur_distr_cvec_set_domain_rect( distr, ll, ru); par = unur_gibbs_new(distr); gen = unur_init(par); INFO_TEST_par("... & method=gibbs",gen); unur_distr_free(distr);unur_free(gen); distr = unur_distr_multinormal( dim, NULL, NULL ); par = unur_gibbs_new(distr); gen = unur_init(par); INFO_TEST_par("... & method=gibbs",gen); unur_distr_free(distr);unur_free(gen); distr = unur_distr_multinormal( dim, NULL, NULL ); par = unur_gibbs_new(distr); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_c(par,-0.5); unur_gibbs_set_thinning(par,3); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); INFO_TEST_par("... & method=gibbs",gen); \#endif #--------------------------------------------------------------------- [sample - HINV: gen = NULL; ] \#ifdef UNUR_ENABLE_INFO METHOD("HINV"); INFO_TEST("normal & method=hinv"); INFO_TEST("cont; cdf='1-exp(-x)'; domain=(0,inf) & method=hinv"); INFO_TEST("cont; cdf='1-exp(-x)'; domain=(0,inf) & method=hinv; order=5"); INFO_TEST("cont; cdf='1-exp(-x)'; domain=(0,inf); mode=0 & method=hinv"); INFO_TEST("cont; cdf='1-exp(-x)'; domain=(0,inf) & method=hinv; u_resolution=1e-16"); INFO_TEST_chg("normal & method=hinv", unur_hinv_chg_truncated(gen,0.,1.)); \#endif #--------------------------------------------------------------------- [sample - HIST: double hist[] = {0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1}; double bins[] = {1.,2.,3.,4.,5.,6.,7.,8.,9.,10.}; distr = NULL; par = NULL; gen = NULL; ] \#ifdef UNUR_ENABLE_INFO METHOD("HIST"); distr = unur_distr_cemp_new(); unur_distr_cemp_set_hist_prob(distr,hist,9); unur_distr_cemp_set_hist_domain(distr,1.,10.); par = unur_hist_new(distr); gen = unur_init(par); INFO_TEST_par("... & method=hist",gen); unur_distr_free(distr);unur_free(gen); distr = unur_distr_cemp_new(); unur_distr_cemp_set_hist_prob(distr,hist,9); unur_distr_cemp_set_hist_bins(distr,bins,10); unur_distr_cemp_set_hist_domain(distr,1.,10.); par = unur_hist_new(distr); gen = unur_init(par); INFO_TEST_par("... & method=hist",gen); \#endif #--------------------------------------------------------------------- [sample - HITRO: const int dim = 3; double mean[] = {1.,2.,3.}; double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; double ll[] = {0.,0.,0.}; double ru[] = {1.,UNUR_INFINITY,UNUR_INFINITY}; distr = NULL; par = NULL; gen = NULL; ] \#ifdef UNUR_ENABLE_INFO METHOD("HITRO"); distr = unur_distr_multinormal( dim, mean, covar ); par = unur_hitro_new(distr); gen = unur_init(par); INFO_TEST_par("... & method=hitro",gen); unur_distr_free(distr);unur_free(gen); distr = unur_distr_multinormal( dim, NULL, NULL ); unur_distr_cvec_set_domain_rect( distr, ll, ru); par = unur_hitro_new(distr); gen = unur_init(par); INFO_TEST_par("... & method=hitro",gen); unur_distr_free(distr);unur_free(gen); distr = unur_distr_multinormal( dim, NULL, NULL ); par = unur_hitro_new(distr); gen = unur_init(par); INFO_TEST_par("... & method=hitro",gen); unur_distr_free(distr);unur_free(gen); distr = unur_distr_multinormal( dim, NULL, NULL ); par = unur_hitro_new(distr); unur_hitro_set_variant_random_direction(par); unur_hitro_set_r(par,2.); unur_hitro_set_thinning(par,3); unur_hitro_set_burnin(par,1000); gen = unur_init(par); INFO_TEST_par("... & method=hitro",gen); \#endif #--------------------------------------------------------------------- [sample - HRB: gen = NULL; ] \#ifdef UNUR_ENABLE_INFO METHOD("HRB"); INFO_TEST("cont; hr='1./(1.+x)' & method=hrb"); INFO_TEST("cont; hr='1./(1.+x)' & method=hrb;upperbound=1.1"); \#endif #--------------------------------------------------------------------- [sample - HRD: gen = NULL; ] \#ifdef UNUR_ENABLE_INFO METHOD("HRD"); INFO_TEST("cont; hr='1./(1.+x)' & method=hrd"); \#endif #--------------------------------------------------------------------- [sample - HRI: gen = NULL; ] \#ifdef UNUR_ENABLE_INFO METHOD("HRI"); INFO_TEST("cont; hr='3*x*x' & method=hri"); INFO_TEST("cont; hr='3*x*x' & method=hri;p0=0.8"); \#endif #--------------------------------------------------------------------- [sample - ITDR: gen = NULL; ] \#ifdef UNUR_ENABLE_INFO METHOD("ITDR"); INFO_TEST("gamma(0.5) & method=itdr"); INFO_TEST("gamma(0.5) & method=itdr; cp=-0.5; ct=-0.5"); INFO_TEST("gamma(0.5) & method=itdr; cp=-0.5; ct=-0.5; xi=0.4"); INFO_TEST("cont; pdf='exp(-x)/sqrt(x)';mode=0;domain=(0,inf) & method=itdr"); \#endif #--------------------------------------------------------------------- [sample - MCORR: double eigenvalues[] = {1.,2.,3.,4.}; distr = NULL; par = NULL; gen = NULL; ] \#ifdef UNUR_ENABLE_INFO METHOD("MCORR"); distr = unur_distr_correlation(4); par = unur_mcorr_new(distr); gen = unur_init(par); INFO_TEST_par("... & method=mcorr",gen); unur_distr_free(distr);unur_free(gen); distr = unur_distr_correlation(4); par = unur_mcorr_new(distr); unur_mcorr_set_eigenvalues( par, eigenvalues ); gen = unur_init(par); INFO_TEST_par("... & method=mcorr",gen); \#endif #--------------------------------------------------------------------- [sample - MIXT: UNUR_GEN *comp[3]; double prob[3] = {1,2,3}; par = NULL; gen = NULL; ] \#ifdef UNUR_ENABLE_INFO METHOD("MIXT"); comp[0] = unur_str2gen("normal;domain=(-inf,-1)&method=pinv"); comp[1] = unur_str2gen("uniform(-1,1)&method=cstd"); comp[2] = unur_str2gen("exponential;domain=(1,inf)&method=pinv"); par = unur_mixt_new(3,prob,comp); gen = unur_init(par); INFO_TEST_par("... & method=mixt",gen); par = unur_mixt_new(3,prob,comp); unur_mixt_set_useinversion(par,TRUE); gen = unur_init(par); INFO_TEST_par("... & method=mixt; useinversion=ON",gen); unur_free(comp[0]); unur_free(comp[1]); unur_free(comp[2]); comp[0] = unur_str2gen("exponential&method=pinv"); comp[1] = unur_str2gen("poisson(5)&method=dgt"); par = unur_mixt_new(2,prob,comp); gen = unur_init(par); INFO_TEST_par("... & method=mixt",gen); unur_free(comp[0]); unur_free(comp[1]); comp[0] = unur_str2gen("binomial(100,0.05)&method=dgt"); comp[1] = unur_str2gen("poisson(5)&method=dgt"); par = unur_mixt_new(2,prob,comp); gen = unur_init(par); INFO_TEST_par("... & method=mixt",gen); unur_free(comp[0]); unur_free(comp[1]); \#endif #--------------------------------------------------------------------- [sample - MVSTD: const int dim = 3; double mean[] = {1.,2.,3.}; double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; distr = NULL; par = NULL; gen = NULL; ] \#ifdef UNUR_ENABLE_INFO METHOD("MVSTD"); distr = unur_distr_multinormal( dim, mean, covar ); par = unur_mvstd_new(distr); gen = unur_init(par); INFO_TEST_par("... & method=mvstd",gen); unur_distr_free(distr);unur_free(gen); distr = unur_distr_multinormal( dim, NULL, NULL ); par = unur_mvstd_new(distr); gen = unur_init(par); INFO_TEST_par("... & method=mvstd",gen); \#endif #--------------------------------------------------------------------- [sample - MVTDR: const int dim = 3; double mean[] = {1.,2.,3.}; double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; double ll[] = {0.,0.,0.}; double ru[] = {1.,UNUR_INFINITY,UNUR_INFINITY}; distr = NULL; par = NULL; gen = NULL; ] \#ifdef UNUR_ENABLE_INFO METHOD("MVTDR"); distr = unur_distr_multinormal( dim, mean, covar ); par = unur_mvtdr_new(distr); gen = unur_init(par); INFO_TEST_par("... & method=mvtdr",gen); unur_distr_free(distr);unur_free(gen); distr = unur_distr_multinormal( dim, NULL, NULL ); unur_distr_cvec_set_domain_rect( distr, ll, ru); par = unur_mvtdr_new(distr); gen = unur_init(par); INFO_TEST_par("... & method=mvtdr",gen); unur_distr_free(distr);unur_free(gen); distr = unur_distr_multinormal( dim, NULL, NULL ); par = unur_mvtdr_new(distr); gen = unur_init(par); INFO_TEST_par("... & method=mvtdr",gen); unur_distr_free(distr);unur_free(gen); distr = unur_distr_multinormal( dim, NULL, NULL ); par = unur_mvtdr_new(distr); unur_mvtdr_set_stepsmin( par, 7 ); unur_mvtdr_set_boundsplitting( par, 1.2 ); unur_mvtdr_set_maxcones( par, 9999 ); gen = unur_init(par); INFO_TEST_par("... & method=mvtdr",gen); unur_distr_free(distr);unur_free(gen); distr = unur_distr_multinormal( dim, NULL, NULL ); par = unur_mvtdr_new(distr); unur_mvtdr_set_maxcones( par, 10 ); gen = unur_init(par); INFO_TEST_par("... & method=mvtdr",gen); \#endif #--------------------------------------------------------------------- [sample - NINV: gen = NULL; ] \#ifdef UNUR_ENABLE_INFO METHOD("NINV"); INFO_TEST("normal & method=ninv"); INFO_TEST("normal & method=ninv; usenewton"); INFO_TEST("normal & method=ninv; usebisect"); INFO_TEST("cont; cdf='1-exp(-x)'; domain=(0,inf) & method=ninv"); INFO_TEST_chg("normal & method=ninv", unur_ninv_chg_truncated(gen,0.,1.)); INFO_TEST("normal & method=ninv; x_resolution=1e-10"); INFO_TEST("normal & method=ninv; u_resolution=1e-10"); INFO_TEST("normal & method=ninv; u_resolution=1e-10; x_resolution=1e-10"); INFO_TEST("normal & method=ninv; u_resolution=1e-10; x_resolution=-1"); INFO_TEST("normal & method=ninv; max_iter=100"); INFO_TEST("normal & method=ninv; start=(-1,1)"); INFO_TEST("normal & method=ninv; table=123"); \#endif #--------------------------------------------------------------------- [sample - NORTA: const int dim = 3; double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; double gamma_params[] = {5.}; double beta_params[] = {3.,5.}; UNUR_DISTR *marginal = NULL; distr = NULL; par = NULL; gen = NULL; ] \#ifdef UNUR_ENABLE_INFO METHOD("NORTA"); distr = unur_distr_copula(dim, rankcorr); par = unur_norta_new(distr); gen = unur_init(par); INFO_TEST_par("... & method=norta",gen); unur_distr_free(distr);unur_free(gen); distr = unur_distr_cvec_new(dim); unur_distr_cvec_set_rankcorr(distr,rankcorr); marginal = unur_distr_gamma(gamma_params,1); unur_distr_cvec_set_marginals(distr,marginal); unur_distr_free(marginal); par = unur_norta_new(distr); gen = unur_init(par); INFO_TEST_par("... & method=norta",gen); unur_distr_free(distr);unur_free(gen); distr = unur_distr_cvec_new(dim); unur_distr_cvec_set_rankcorr(distr,rankcorr); unur_distr_cvec_set_marginal_list(distr, unur_distr_cauchy(NULL,0), unur_distr_gamma(gamma_params,1), unur_distr_beta(beta_params,2) ); par = unur_norta_new(distr); gen = unur_init(par); INFO_TEST_par("... & method=norta",gen); \#endif #--------------------------------------------------------------------- [sample - NROU: gen = NULL; ] METHOD("NROU"); INFO_TEST("normal & method=nrou"); INFO_TEST("cont; pdf='exp(-x^2)' & method=nrou"); INFO_TEST("cont; pdf='exp(-x^2)' & method=nrou; r=2"); INFO_TEST("cont; pdf='exp(-x^2)' & method=nrou; v=1"); INFO_TEST("cont; pdf='exp(-x^2)' & method=nrou; u=(-0.61, 0.61)"); INFO_TEST("cont; pdf='exp(-x^2)' & method=nrou; v=1; u=(-0.61, 0.61)"); #--------------------------------------------------------------------- [sample - PINV: gen = NULL; ] \#ifdef UNUR_ENABLE_INFO METHOD("PINV"); INFO_TEST("normal & method=pinv"); INFO_TEST("normal & method=pinv; smoothness=1"); INFO_TEST("normal & method=pinv; smoothness=2"); INFO_TEST("normal & method=pinv; smoothness=1; order=6"); INFO_TEST("normal & method=pinv; usecdf"); INFO_TEST("normal & method=pinv; order=7; u_resolution=1e-14; use_upoints=on"); INFO_TEST("normal & method=pinv; boundary=(-10,10); searchboundary=(1,0)"); INFO_TEST("cont; cdf='1-exp(-x)'; domain=(0,inf) & method=pinv"); INFO_TEST("chisquare(2) & method=pinv"); INFO_TEST("normal & method=pinv; keepcdf=on"); \#endif #--------------------------------------------------------------------- [sample - SROU: gen = NULL; ] METHOD("SROU"); INFO_TEST("normal & method=srou"); INFO_TEST("cont; pdf='exp(-x^2)';pdfarea=1.773 & method=srou"); INFO_TEST("cont; pdf='exp(-x^2)';pdfarea=1.773 & method=srou; usemirror"); INFO_TEST("cont; pdf='exp(-x^2)';pdfarea=1.773 & method=srou; cdfatmode=0.5; usesqueeze"); INFO_TEST("cont; pdf='exp(-x^2)';pdfarea=1.773 & method=srou; r=2"); INFO_TEST("cont; pdf='exp(-x^2)';pdfarea=1.773 & method=srou; r=2; cdfatmode=0.5"); #--------------------------------------------------------------------- [sample - SSR: gen = NULL; ] METHOD("SSR"); INFO_TEST("normal & method=ssr"); INFO_TEST("cont; pdf='exp(-x^2)';pdfarea=1.773 & method=ssr"); INFO_TEST("cont; pdf='exp(-x^2)';pdfarea=1.773 & method=ssr; cdfatmode=0.5; usesqueeze"); INFO_TEST("cont; pdf='exp(-x^2)';pdfarea=1.773 & method=ssr; cdfatmode=0.5"); INFO_TEST("cont; pdf='exp(-x^2)';domain=(0,inf);pdfarea=0.887 & method=ssr"); #--------------------------------------------------------------------- [sample - TABL: gen = NULL; ] \#ifdef UNUR_ENABLE_INFO METHOD("TABL"); INFO_TEST("normal & method=tabl"); INFO_TEST("normal & method=tabl;variant_ia=off;max_intervals=50"); INFO_TEST("cont; pdf='exp(-x^2)';mode=0 & method=tabl"); INFO_TEST("cont; pdf='exp(-x^2)';mode=0 & method=tabl; max_intervals=100; max_sqhratio=0.99"); INFO_TEST_chg("normal & method=tabl", unur_tabl_chg_truncated(gen,0.,1.)); \#endif #--------------------------------------------------------------------- [sample - TDR: gen = NULL; ] \#ifdef UNUR_ENABLE_INFO METHOD("TDR"); INFO_TEST("normal & method=tdr"); INFO_TEST("normal & method=tdr; max_intervals=10; cpoints=3"); INFO_TEST("cont; pdf='exp(-x^2)' & method=tdr"); INFO_TEST("cont; pdf='exp(-x^2)' & method=tdr; c=0"); INFO_TEST("cont; pdf='exp(-x^2)' & method=tdr; c=0; variant_ia"); INFO_TEST("cont; pdf='exp(-x^2)' & method=tdr; c=0; variant_ia; max_intervals=1000"); INFO_TEST("cont; pdf='exp(-x^2)' & method=tdr; c=0; variant_ia; max_intervals=1000; max_sqhratio=0.90"); INFO_TEST_chg("normal & method=tdr", unur_tdr_chg_truncated(gen,0.,1.)); \#endif #--------------------------------------------------------------------- [sample - UNIF: gen = NULL; ] \#ifdef UNUR_ENABLE_INFO METHOD("UNIF"); INFO_TEST("uniform(0,1) & method=unif"); \#endif #--------------------------------------------------------------------- [sample - UTDR: gen = NULL; ] \#ifdef UNUR_ENABLE_INFO METHOD("UTDR"); INFO_TEST("normal & method=utdr"); INFO_TEST("cont; pdf='exp(-x^2)';pdfarea=1.773 & method=utdr"); INFO_TEST("cont; pdf='exp(-x^2)';pdfarea=1.773 & method=utdr;pdfatmode=1.0"); INFO_TEST("cont; pdf='exp(-x^2)';pdfarea=1.773 & method=utdr;deltafactor=1e-8"); \#endif #--------------------------------------------------------------------- [sample - VEMPK: double data[] = {1.,1.,-1.,1.,1.,-1.,-1.,-1. }; distr = NULL; par = NULL; gen = NULL; ] \#ifdef UNUR_ENABLE_INFO METHOD("VEMPK"); distr = unur_distr_cvemp_new(2); unur_distr_cvemp_set_data(distr, data, 4); par = unur_vempk_new(distr); gen = unur_init(par); INFO_TEST_par("... & method=vempk",gen); unur_distr_free(distr);unur_free(gen); distr = unur_distr_cvemp_new(2); unur_distr_cvemp_set_data(distr, data, 4); par = unur_vempk_new(distr); unur_vempk_set_smoothing(par,1.5); unur_vempk_set_varcor(par,TRUE); gen = unur_init(par); INFO_TEST_par("... & method=vempk",gen); \#endif #--------------------------------------------------------------------- [sample - VNROU: const int dim = 3; double mean[] = {1.,2.,3.}; double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; double ll[] = {0.,0.,0.}; double ru[] = {1.,UNUR_INFINITY,UNUR_INFINITY}; distr = NULL; par = NULL; gen = NULL; ] \#ifdef UNUR_ENABLE_INFO METHOD("VNROU"); distr = unur_distr_multinormal( dim, mean, covar ); par = unur_vnrou_new(distr); gen = unur_init(par); INFO_TEST_par("... & method=vnrou",gen); unur_distr_free(distr);unur_free(gen); distr = unur_distr_multinormal( dim, NULL, NULL ); unur_distr_cvec_set_domain_rect( distr, ll, ru); par = unur_vnrou_new(distr); gen = unur_init(par); INFO_TEST_par("... & method=vnrou",gen); unur_distr_free(distr);unur_free(gen); distr = unur_distr_multinormal( dim, NULL, NULL ); par = unur_vnrou_new(distr); unur_vnrou_set_r(par,2.); gen = unur_init(par); INFO_TEST_par("... & method=vnrou",gen); \#endif #--------------------------------------------------------------------- ############################################################################# # [validate] ############################################################################# ############################################################################# [verbatim] ## -------------------------------------------------------------------------- ## CEXT: double exp1_sample(UNUR_GEN *gen) { double U = unur_sample_urng(gen); return (-log(1. - U)); } ## -------------------------------------------------------------------------- ## DEXT: int geom12_sample(UNUR_GEN *gen) { double U = unur_sample_urng(gen); return ((int) (log(U) / log(0.5))); } ############################################################################# unuran-1.11.0/tests/t_util_matrix.conf0000644001357500135600000001043114420445767014746 00000000000000############################################################################# [main] [main - data:] # method (for information only: the program scans the file name) method: MATRIX [main - header:] /* header files */ \#include \#include /* function prototypes */ void _unur_test_set_matrix_1(int dim, double *M); void _unur_test_set_matrix_2(int dim, double *M); int _unur_test_matrix(int dim); /* dimension of test matrix */ static const int dim_testmatrix = 50; /* max tolerable absolute error */ static const double error_absolute_max = 1.e-12; \#ifndef M_PI \#define M_PI 3.14159265358979323846264338328 /* pi */ \#endif \#define COMPARE_SAMPLE_SIZE (10000) \#define VIOLATE_SAMPLE_SIZE (20) ############################################################################# [new] ############################################################################# # [set] ############################################################################# # [get] ############################################################################# # [chg] ############################################################################# # [init] ############################################################################# # [reinit] ############################################################################# # [sample] ############################################################################# # [validate] ############################################################################# [special] [special - decl:] [special - start:] printf("\nEigensystem"); /* run tests */ FAILED = _unur_test_matrix(dim_testmatrix); ############################################################################# [verbatim] void _unur_test_set_matrix_1(int dim, double *M) { \#define idx1(a,b) ((a-1)*dim+(b-1)) int i,j,k; double p; /* original derflinger test-matrix */ p = M_PI/(dim+1); for (i=1; i<=dim; i++) { for (k=1; k<=i; k++) { M[idx1(i,k)]=0.; for (j=1; j<=dim; j++) { M[idx1(i,k)] += sin(p*i*j)*j*sin(p*j*k); } M[idx1(k,i)] = M[idx1(i,k)]; }} \#undef idx1 } /* end of _unur_test_set_matrix_1() */ /*-------------------------------------------------------------------------*/ void _unur_test_set_matrix_2(int dim, double *M) { \#define idx1(a,b) ((a-1)*dim+(b-1)) int i,j,k; /* another test-matrix */ for (i=1; i<=dim; i++) { for (k=1; k<=i; k++) { M[idx1(i,k)]=0.; for (j=1; j<=dim; j++) { M[idx1(i,k)] = 1./(i+k); } M[idx1(k,i)] = M[idx1(i,k)]; }} \#undef idx1 } /* end of _unur_test_set_matrix_2() */ /*-------------------------------------------------------------------------*/ int _unur_test_matrix(int dim) { \#define idx1(a,b) ((a-1)*dim+(b-1)) int i, ret; double *M; double *values; double *vectors; double error_absolute; double error_relative; int error_counter = 0; char error_char; /* allocate memory */ M = malloc(dim*dim*sizeof(double)); values = malloc(dim*sizeof(double)); vectors = malloc(dim*dim*sizeof(double)); _unur_test_set_matrix_1(dim, M); error_counter = 0; ret = _unur_matrix_eigensystem(dim, M, values, vectors); if (ret == UNUR_SUCCESS) { fprintf(TESTLOG, " \# \t Eigenvalue \t\t Expected \t\t Abs. Error \t Rel. Error\n"); for (i=0; i error_absolute_max) { /* eigenvalue is not ok */ error_char = '*'; error_counter++; } else { /* eigenvalue is ok */ error_char = ' '; } fprintf(TESTLOG, "%02d : \t%18.15f \t%18.15f \t% 8.4e \t% 8.4e %c\n", i+1, 2.*values[i]/(dim+1), (double) (i+1) , error_absolute, error_relative, error_char); } if (error_counter!=0) printf(" failed at %d eigenvalues", error_counter); } else { ++error_counter; printf(": init"); } /* free memory */ free(M); free(values); free(vectors); /* return number of errors */ return error_counter; \#undef idx1 } /* end of _unur_test_matrix() */ ############################################################################# unuran-1.11.0/tests/t_gibbs.c0000644001357500135600000024426214430713513012767 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for GIBBS **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); int unur_gibbs_set_verify( UNUR_PAR *par, int verify); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ int unur_gibbs_set_pedantic( UNUR_PAR *par, int pedantic ); #define COMPARE_SAMPLE_SIZE (9999) #define VIOLATE_SAMPLE_SIZE (20) /* For running chi2 tests we use a thinning of dimension * THINNING */ #define THINNING (2) /* GIBBS is a Markov Chain Monte Carlo method and thus it is likely to */ /* fail the chi-square goodness-of-fit test with the used sample size. */ /* Thus we accept one "hard" failer and more "soft" failures then usual. */ #define CHI2_FAILURES_TOLERATED (1010) /* we need marginal distributions for the chi2 tests */ #define unur_distr_multicauchy unur_distr_multicauchy_w_marginals #define unur_distr_multinormal unur_distr_multinormal_w_marginals #define unur_distr_multistudent unur_distr_multistudent_w_marginals /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ /* dummy function */ int unur_gibbs_set_pedantic( UNUR_PAR *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) { return 1; } /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,42,(unur_gibbs_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,42,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,49,(unur_gibbs_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,49,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [set] */ void test_set (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[set "); fflush(stdout); fprintf(TESTLOG,"\n[set]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; double x0[] = {1., 2., 3.}; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,61,(unur_gibbs_set_variant_coordinate( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,61,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,64,(unur_gibbs_set_variant_random_direction( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,64,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,67,(unur_gibbs_set_startingpoint( par, x0)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,67,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,70,(unur_gibbs_set_thinning( par, 3 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,70,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,73,(unur_gibbs_set_burnin( par, 100 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,73,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* invalid parameter object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double x0[] = {1., 2., 3.}; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_arou_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,82,(unur_gibbs_set_variant_coordinate( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,82,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,85,(unur_gibbs_set_variant_random_direction( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,85,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,88,(unur_gibbs_set_startingpoint( par, x0)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,88,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,91,(unur_gibbs_set_thinning( par, 3 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,91,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,94,(unur_gibbs_set_burnin( par, 100 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,94,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = unur_distr_multinormal( 3, NULL, NULL ); par = unur_gibbs_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,103,(unur_gibbs_set_thinning( par, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,103,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,106,(unur_gibbs_set_burnin( par, -1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,106,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_set() */ /*---------------------------------------------------------------------------*/ /* [get] */ void test_get (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[get "); fflush(stdout); fprintf(TESTLOG,"\n[get]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid generator object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); gen = unur_init(par); abort_if_NULL(TESTLOG, 117, gen ); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,121,(unur_gibbs_get_state(gen)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,121,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_get() */ /*---------------------------------------------------------------------------*/ /* [chg] */ void test_chg (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[chg "); fflush(stdout); fprintf(TESTLOG,"\n[chg]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid generator object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double x[] = {0.,0.}; distr = unur_distr_normal(NULL,0); par = unur_ssr_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 131, gen ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,135,(unur_gibbs_chg_state(gen,x)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,135,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* invalid NULL */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_multinormal(2,NULL,NULL); par = unur_gibbs_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 139, gen ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,143,(unur_gibbs_chg_state(gen,NULL)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,143,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_chg() */ /*---------------------------------------------------------------------------*/ /* [reinit] */ void test_reinit (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[reinit "); fflush(stdout); fprintf(TESTLOG,"\n[reinit]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* does not exist */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double x[3]; distr = unur_distr_multinormal(3,NULL,NULL); par = unur_gibbs_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 157, gen ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,161,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,161,UNUR_ERR_NO_REINIT)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_sample_vec( gen, x ); n_tests_failed += (check_expected_INFINITY(TESTLOG,165,(x[0]))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,165,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_reinit() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* test clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; const int dim = 3; double mean[] = {1.,2.,3.}; double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; UNUR_GEN *clone; distr = unur_distr_multinormal( dim, mean, covar ); par = unur_gibbs_new(distr); /* unur_gibbs_set_variant_random_direction(par); */ unur_set_debug(par,1u); gen = unur_init( par ); abort_if_NULL(TESTLOG, 180, gen ); unur_reset_errno(); /* clone */ /* currently we cannot compare clone with original generator. */ /* thus we just run it to test whether cloning works without a segfault. */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; unur_gibbs_reset_state(gen); n_tests_failed += (compare_sequence_gen_start(TESTLOG,190,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* [validate] */ /*---------------------------------------------------------------------------*/ /* [validate] */ void test_validate (void) { /* suppress GCC compiler warning */ GCC_DIAG_OFF(unused-variable) UNUR_DISTR *distr[35]; UNUR_PAR *par; UNUR_GEN *gen; double *darray; double fpm[10]; int n_tests_failed; int rcode; /* start test */ printf("[validate "); fflush(stdout); fprintf(TESTLOG,"\n[validate]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* distributions: 35 */ { distr[0] = unur_distr_multinormal(1,NULL,NULL); } { distr[1] = unur_distr_multinormal(2,NULL,NULL); } { distr[2] = unur_distr_multinormal(3,NULL,NULL); } { double mean[] = { 1., 2., 3. }; distr[34] = unur_distr_multinormal(3,mean,NULL); } { double mean[] = { -1. }; double covar[] = { 2. }; distr[3] = unur_distr_multinormal(1,mean,covar); unur_distr_cvec_set_center(distr[3],NULL); } { double mean[] = { 1., 2., 3. }; double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; distr[4] = unur_distr_multinormal(3,mean,covar); } { distr[5] = unur_distr_multinormal_ar1(3,NULL,0.9); } { distr[6] = unur_distr_multinormal_ar1(4,NULL,0.8); } { distr[7] = unur_distr_multinormal_ar1(5,NULL,0.7); } { distr[8] = unur_distr_multinormal_ar1(10,NULL,0.6); } { double mean[] = { -1., -2., -3., 4., 5., 6., 7., 8., 9., 10. }; distr[9] = unur_distr_multinormal_ar1(3,mean,0.9); } { double mean[] = { -1., -2., -3., 4., 5., 6., 7., 8., 9., 10. }; distr[10] = unur_distr_multinormal_ar1(4,mean,0.8); } { double mean[] = { -1., -2., -3., 4., 5., 6., 7., 8., 9., 10. }; distr[11] = unur_distr_multinormal_ar1(5,mean,0.7); } { double mean[] = { -1., -2., -3., 4., 5., 6., 7., 8., 9., 10. }; distr[12] = unur_distr_multinormal_ar1(10,mean,0.6); } { distr[13] = unur_distr_multinormal_constantrho(3,NULL,0.9); } { distr[14] = unur_distr_multinormal_constantrho(4,NULL,0.8); } { distr[15] = unur_distr_multinormal_constantrho(5,NULL,0.7); } { distr[16] = unur_distr_multinormal_constantrho(10,NULL,0.6); } { distr[17] = unur_distr_multicauchy(2,NULL,NULL); } { distr[18] = unur_distr_multicauchy(3,NULL,NULL); } { double mean[] = { 1., 2., 3. }; double covar[] = { 1., 0.5, 0.25, 0.5, 1., 0.5, 0.25, 0.5, 1. }; distr[19] = unur_distr_multicauchy(3,mean,covar); } { distr[20] = unur_distr_multicauchy_ar1(3,NULL,0.7); } { distr[21] = unur_distr_multicauchy_ar1(4,NULL,0.6); } { distr[22] = unur_distr_multicauchy_ar1(5,NULL,0.5); } { distr[23] = unur_distr_multicauchy_ar1(10,NULL,0.4); } { distr[24] = unur_distr_multistudent_ar1(2,3.,NULL,0.7); } { distr[25] = unur_distr_multistudent_ar1(2,5.,NULL,0.7); } { distr[26] = unur_distr_multistudent_ar1(2,15.,NULL,0.7); } { distr[27] = unur_distr_multistudent_ar1(2,0.5,NULL,0.7); } { distr[28] = unur_distr_multistudent_ar1(2,1.5,NULL,0.7); } { distr[29] = unur_distr_multistudent_ar1(2,2.5,NULL,0.7); } { double ll[3] = {0.,0.,0.}; double ru[3] = {UNUR_INFINITY,UNUR_INFINITY,UNUR_INFINITY}; distr[30] = unur_distr_multinormal(3,NULL,NULL); unur_distr_cvec_set_domain_rect(distr[30],ll,ru); } { double ll[3] = {0.,0.,0.}; double ru[3] = {1.,UNUR_INFINITY,UNUR_INFINITY}; distr[31] = unur_distr_multinormal(3,NULL,NULL); unur_distr_cvec_set_domain_rect(distr[31],ll,ru); } { double ll[3] = {-1.,-1.,1.}; double ru[3] = {1.,0.,2.}; double center[3] = {0.,-0.5,1.5}; distr[32] = unur_distr_multinormal(3,NULL,NULL); unur_distr_cvec_set_domain_rect(distr[32],ll,ru); unur_distr_cvec_set_center(distr[32],center); } { double ll[3] = {-1.,-1.,1.}; double ru[3] = {1.,0.,2.}; distr[33] = unur_distr_multinormal(3,NULL,NULL); unur_distr_cvec_set_domain_rect(distr[33],ll,ru); } /* timing */ stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); printf("\n(chi^2) "); fflush(stdout); /* chi^2 tests: 140 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nChi^2 Test:\n"); /* distribution [0] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [2] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [34] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[34]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[34],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [3] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [4] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [5] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [6] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [7] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [8] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [9] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [10] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [11] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [12] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [13] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [14] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [15] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [16] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [17] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [18] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [19] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [20] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [21] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [22] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [23] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [24] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [25] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [26] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [27] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [28] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [29] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [30] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [31] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[31]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[31],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [32] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[32]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[32],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [33] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_burnin(par,1000); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[33]); par = unur_gibbs_new(distr_localcopy); unur_gibbs_set_variant_random_direction(par); unur_gibbs_set_thinning(par,THINNING*unur_distr_get_dim(distr_localcopy)); unur_gibbs_set_c(par,-0.5); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[33],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); /* free distributions */ unur_distr_free(distr[0]); unur_distr_free(distr[1]); unur_distr_free(distr[2]); unur_distr_free(distr[3]); unur_distr_free(distr[4]); unur_distr_free(distr[5]); unur_distr_free(distr[6]); unur_distr_free(distr[7]); unur_distr_free(distr[8]); unur_distr_free(distr[9]); unur_distr_free(distr[10]); unur_distr_free(distr[11]); unur_distr_free(distr[12]); unur_distr_free(distr[13]); unur_distr_free(distr[14]); unur_distr_free(distr[15]); unur_distr_free(distr[16]); unur_distr_free(distr[17]); unur_distr_free(distr[18]); unur_distr_free(distr[19]); unur_distr_free(distr[20]); unur_distr_free(distr[21]); unur_distr_free(distr[22]); unur_distr_free(distr[23]); unur_distr_free(distr[24]); unur_distr_free(distr[25]); unur_distr_free(distr[26]); unur_distr_free(distr[27]); unur_distr_free(distr[28]); unur_distr_free(distr[29]); unur_distr_free(distr[30]); unur_distr_free(distr[31]); unur_distr_free(distr[32]); unur_distr_free(distr[33]); unur_distr_free(distr[34]); /* test finished */ test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; /* we accept CHI2_FAILURES_TOLERATED failures */ (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_validate */ /* enable GCC compiler warning */ GCC_DIAG_ON(unused-variable) /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_gibbs_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_tabl.conf0000644001357500135600000005021014420445767013326 00000000000000############################################################################# [main] [main - data:] # method method: TABL [main - header:] /* prototypes */ double pdf( double x, UNUR_DISTR *distr ); double pdf_negative( double x, const UNUR_DISTR *distr ); double pdf_partnegative( double x, const UNUR_DISTR *distr ); \#define COMPARE_SAMPLE_SIZE (10000) \#define VIOLATE_SAMPLE_SIZE (20) ############################################################################# [new] [new - invalid NULL ptr: distr = NULL; ] ~( distr ); --> expected_NULL --> UNUR_ERR_NULL [new - invalid distribution type: distr = unur_distr_discr_new(); ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID [new - data missing in distribution object: distr = unur_distr_cont_new(); ] /* pdf */ ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED ############################################################################# [set] [set - invalid NULL ptr: double slopes[2] = {0.,1.}; par = NULL; ] ~_cpoints( par, 0, NULL ); --> expected_setfailed --> UNUR_ERR_NULL ~_useear( par, 1 ); --> expected_setfailed --> UNUR_ERR_NULL ~_usedars( par, 1 ); --> expected_setfailed --> UNUR_ERR_NULL ~_darsfactor( par, 1. ); --> expected_setfailed --> UNUR_ERR_NULL ~_variant_splitmode( par, 1 ); --> expected_setfailed --> UNUR_ERR_NULL ~_areafraction( par, 0.2 ); --> expected_setfailed --> UNUR_ERR_NULL ~_nstp( par, 30 ); --> expected_setfailed --> UNUR_ERR_NULL ~_slopes( par, slopes, 2 ); --> expected_setfailed --> UNUR_ERR_NULL ~_boundary( par, 0.,1. ); --> expected_setfailed --> UNUR_ERR_NULL ~_guidefactor( par, 1. ); --> expected_setfailed --> UNUR_ERR_NULL ~_max_sqhratio( par, 0.95 ); --> expected_setfailed --> UNUR_ERR_NULL ~_max_intervals( par, 100 ); --> expected_setfailed --> UNUR_ERR_NULL ~_verify( par, 1 ); --> expected_setfailed --> UNUR_ERR_NULL ~_pedantic( par, 1 ); --> expected_setfailed --> UNUR_ERR_NULL ~_variant_ia( par, TRUE ); --> expected_setfailed --> UNUR_ERR_NULL [set - invalid parameter object: double fpar[2] = {0.,1.}; double slopes[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_arou_new(distr); ] ~_cpoints( par, 0, NULL ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_useear( par, 1 ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_usedars( par, 1 ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_darsfactor( par, -1. ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_variant_splitmode( par, 1 ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_areafraction( par, 0.2 ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_nstp( par, 30 ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_slopes( par, slopes, 2 ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_boundary( par, 0.,1. ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_guidefactor( par, 1. ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_max_sqhratio( par, 0.95 ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_max_intervals( par, 100 ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_verify( par, 1 ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_pedantic( par, 1 ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_variant_ia( par, TRUE ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID unur_par_free(par); [set - invalid parameters: double slopesA[4] = {0.,1.,0.5,2.}; double slopesB[4] = {1.,2.,0.,1.}; double stp[] = {1.,0.,1.}; int n_stp = 3; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_tabl_new(distr); ] ~_cpoints( par, -1, NULL ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_cpoints( par, n_stp, stp ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_variant_splitmode( par, 0 ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_variant_splitmode( par, 4 ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_areafraction( par, -0.1 ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_nstp( par, -1 ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_slopes( par, slopesA, 0 ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_slopes( par, slopesA, 4 ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_slopes( par, slopesB, 4 ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_boundary( par, 2., 1. ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_boundary( par, 0., UNUR_INFINITY ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_boundary( par, -UNUR_INFINITY, 0. ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_guidefactor( par, -0.1 ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_max_sqhratio( par, -0.1 ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_max_sqhratio( par, 1.1 ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_max_intervals( par, 0 ); --> expected_setfailed --> UNUR_ERR_PAR_SET unur_par_free(par); ############################################################################# [get] [get - invalid NULL ptr: gen = NULL; ] ~_sqhratio(gen); --> expected_INFINITY --> UNUR_ERR_NULL ~_hatarea(gen); --> expected_INFINITY --> UNUR_ERR_NULL ~_squeezearea(gen); --> expected_INFINITY --> UNUR_ERR_NULL ~_n_intervals(gen); --> expected_zero --> UNUR_ERR_NULL [get - invalid generator object: distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); gen = unur_init(par); <-- ! NULL ] ~_sqhratio(gen); --> expected_INFINITY --> UNUR_ERR_GEN_INVALID ~_hatarea(gen); --> expected_INFINITY --> UNUR_ERR_GEN_INVALID ~_squeezearea(gen); --> expected_INFINITY --> UNUR_ERR_GEN_INVALID ~_n_intervals(gen); --> expected_zero --> UNUR_ERR_GEN_INVALID ############################################################################# [chg] [chg - invalid generator object: double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_arou_new(distr); unur_set_debug(par,0); gen = unur_init( par ); <-- ! NULL ] ~_verify(gen,1); --> expected_setfailed --> UNUR_ERR_GEN_INVALID ############################################################################# [init] [init - invalid NULL ptr: par = NULL; ] unur_init( par ); --> expected_NULL --> UNUR_ERR_NULL [init - wrong mode: distr = unur_distr_normal(NULL,0); par = NULL; ] unur_distr_cont_set_mode(distr,-1.); par = unur_tabl_new(distr); unur_init( par ); --> expected_NULL --> UNUR_ERR_GEN_CONDITION unur_distr_cont_set_mode(distr,1.); par = unur_tabl_new(distr); unur_init( par ); --> expected_NULL --> UNUR_ERR_GEN_CONDITION [init - negative value of pdf: distr = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr,pdf_negative); par = NULL; ] par = unur_tabl_new(distr); unur_init( par ); --> expected_NULL --> UNUR_ERR_GEN_CONDITION unur_distr_cont_set_domain(distr,-2.,2.); par = unur_tabl_new(distr); unur_init( par ); --> expected_NULL --> UNUR_ERR_GEN_CONDITION ############################################################################# [reinit] [reinit - does not exist: distr = unur_distr_normal(NULL,0); par = unur_tabl_new(distr); gen = unur_init( par ); <-- ! NULL ] unur_reinit( gen ); --> expected_setfailed --> UNUR_ERR_NO_REINIT unur_sample_cont( gen ); --> expected_INFINITY --> UNUR_ERR_GEN_CONDITION ############################################################################# [sample] [sample - compare: distr = unur_distr_normal(NULL,0); par = NULL; ] # default (immediate acceptance) par = unur_tabl_new(distr); -->compare_sequence_par_start # default - verifying mode */ par = unur_tabl_new(distr); unur_tabl_set_verify(par,1); -->compare_sequence_par # "classical" acceptance/rejection (RH) par = unur_tabl_new(distr); unur_tabl_set_variant_ia(par,FALSE); -->compare_sequence_par_start # "classical" acceptance/rejection (RH) - verifying mode */ par = unur_tabl_new(distr); unur_tabl_set_variant_ia(par,FALSE); unur_tabl_set_verify(par,1); -->compare_sequence_par #..................................................................... [sample - compare clone: UNUR_GEN *clone; distr = unur_distr_normal(NULL,0); par = NULL; gen = NULL; ] /* original generator object */ par = unur_tabl_new(distr); unur_tabl_set_max_sqhratio(par,0.); gen = unur_init(par); -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen #..................................................................... [sample - compare stringparser: double fpar[2] = {3.,3.}; double slopes[] = {0.5,-1,0.5,1}; distr = NULL; par = NULL; gen = NULL; ] distr = unur_distr_beta(fpar,2); par = unur_tabl_new(distr); unur_tabl_set_areafraction(par,0.25); unur_tabl_set_boundary(par,0.1,0.9); unur_tabl_set_guidefactor(par,5.); unur_tabl_set_max_intervals(par,50); unur_tabl_set_max_sqhratio(par,0.8); unur_tabl_set_nstp(par,30); unur_tabl_set_usedars(par,0); unur_tabl_set_variant_splitmode(par,3); unur_tabl_set_verify(par,TRUE); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "beta(3.,3.) & \ method = tabl; areafraction = 0.25; boundary = (0.1,0.9); \ guidefactor = 5; max_intervals = 50; max_sqhratio = 0.8; \ nstp = 30; usedars = 0; variant_splitmode = 3; verify" ); -->compare_sequence_gen unur_free(gen); gen = NULL; distr = unur_distr_beta(fpar,2); par = unur_tabl_new(distr); unur_tabl_set_slopes(par,slopes,2); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "beta(3.,3.) & \ method = tabl; slopes = (0.5,-1,0.5,1),2 " ); -->compare_sequence_gen unur_free(gen); gen = NULL; distr = unur_distr_beta(fpar,2); par = unur_tabl_new(distr); unur_tabl_set_usedars(par,TRUE); unur_tabl_set_darsfactor(par,0.5); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "beta(3.,3.) & method = tabl; usedars=on; darsfactor=0.5" ); -->compare_sequence_gen ############################################################################ [validate] [validate - generators:] # with DARS (default - immediate accatance) par[0] = unur_tabl_new(@distr@); unur_tabl_set_usedars(par,TRUE); # default, truncated par[1] = unur_tabl_new(@distr@); unur_tabl_chg_truncated(gen,0.5,0.9); # without DARS (immediate accatance) par[2] = unur_tabl_new(@distr@); unur_tabl_set_usedars(par,FALSE); # "classical" acceptance/rejection par[3] = unur_tabl_new(@distr@); unur_tabl_set_variant_ia(par,FALSE); # "classical" acceptance/rejection par[4] = unur_tabl_new(@distr@); unur_tabl_set_variant_ia(par,FALSE); unur_tabl_chg_truncated(gen,0.5,0.9); # give slopes of the distribution {double slopes[4] = {0.,-0.5,0.,2.}; par[5] = unur_tabl_new(@distr@); unur_tabl_set_slopes(par,slopes,2);} # give construction points {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par[6] = unur_tabl_new(@distr@); unur_tabl_set_cpoints(par,7,cpoints);} # give slopes of the distribution {double slopes[6] = {1.,0.,2.,1.,3.,2.}; par[7] = unur_tabl_new(@distr@); unur_tabl_set_slopes(par,slopes,3);} {double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; par[8] = unur_tabl_new(@distr@); unur_tabl_set_slopes(par,slopes,4);} # dars disabled, ear disabled, urng_aux par[9] = unur_tabl_new(@distr@); unur_tabl_set_variant_ia(par,FALSE); unur_tabl_set_usedars(par,FALSE); unur_tabl_set_useear(par,FALSE); unur_use_urng_aux_default(par); [validate - distributions:] # Beta distributions fpm[0] = 1.; fpm[1] = 2.; distr[0] = unur_distr_beta(fpm,2); fpm[0] = 1.; fpm[1] = 5.; distr[1] = unur_distr_beta(fpm,2); fpm[0] = 1.; fpm[1] = 100.; distr[2] = unur_distr_beta(fpm,2); fpm[0] = 3.; fpm[1] = 4.; distr[3] = unur_distr_beta(fpm,2); fpm[0] = 5.; fpm[1] = 100.; distr[4] = unur_distr_beta(fpm,2); fpm[0] = 500.; fpm[1] = 300.; distr[5] = unur_distr_beta(fpm,2); fpm[0] = 5.; fpm[1] = 10.; fpm[2] = -3.; fpm[3] = 15.; distr[6] = unur_distr_beta(fpm,4); # Cauchy distributions distr[7] = unur_distr_cauchy(NULL,0); fpm[0] = 1.; fpm[1] = 20.; distr[8] = unur_distr_cauchy(fpm,2); # Exponential distributions distr[23] = unur_distr_exponential(NULL,0); fpm[0] = 30.; fpm[1] = -5.; distr[24] = unur_distr_exponential(fpm,2); # Gamma distributions fpm[0] = 1.; distr[9] = unur_distr_gamma(fpm,1); fpm[0] = 2.; distr[10] = unur_distr_gamma(fpm,1); fpm[0] = 3.; distr[11] = unur_distr_gamma(fpm,1); fpm[0] = 10.; distr[12] = unur_distr_gamma(fpm,1); fpm[0] = 1000.; distr[13] = unur_distr_gamma(fpm,1); fpm[0] = 5.; fpm[1] = 1000.; distr[14] = unur_distr_gamma(fpm,2); fpm[0] = 5.; fpm[1] = 1.e-5; distr[15] = unur_distr_gamma(fpm,2); fpm[0] = 5.; fpm[1] = 10.; fpm[2] = 1000; distr[16] = unur_distr_gamma(fpm,3); # Laplace distributions distr[25] = unur_distr_laplace(NULL,0); fpm[0] = -10.; fpm[1] = 100.; distr[26] = unur_distr_laplace(fpm,2); # Normal distributions distr[17] = unur_distr_normal(NULL,0); fpm[0] = 1.; fpm[1] = 1.e-5; distr[18] = unur_distr_normal(fpm,2); fpm[0] = 0.; fpm[1] = 1.e+5; distr[19] = unur_distr_normal(fpm,2); # Uniform distributions distr[20] = unur_distr_uniform(NULL,0); fpm[0] = 1.; fpm[1] = 20.; distr[21] = unur_distr_uniform(fpm,2); # truncated distributions distr[22] = unur_distr_cauchy(NULL,0); unur_distr_cont_set_domain(distr[22],0.1,1.); unur_distr_cont_upd_mode(distr[22]); unur_distr_cont_upd_pdfarea(distr[22]); # sawtooth distribution with continuous PDF { double domain[2] = {0., 3.}; distr[27] = unur_distr_sawtooth_contpdf(domain, 2); } { double domain[2] = {0., 5.}; distr[28] = unur_distr_sawtooth_contpdf(domain, 2); } # sawtooth distribution with discontinuous PDF { double domain[2] = {0., 3.}; distr[29] = unur_distr_sawtooth_discpdf(domain, 2); } { double domain[2] = {-2., 2.}; distr[30] = unur_distr_sawtooth_discpdf(domain, 2); } # number of distributions: 31 [validate - test chi2:] # + ... pass test # 0 ... fail to initialize generator # - ... fail test # . ... do not run test # # ... comment # # generators: # [0] ... default (immediate acceptance) # [1] ... default, truncated # [2] ... without DARS # [3] ... "classical" acceptance/rejection # [4] ... "classical" acceptance/rejection, truncated # [5] ... use slopes (-0.5, 0.) and (0.,2.) # [6] ... give construction points # [7] ... use slopes [for particular sawtooth distribution only] # [8] ... use slopes [for particular sawtooth distribution only] # [9] ... dars disabled, ear disabled, urng_aux # # [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] # distribution #----------------------------------------------------------------------------- x <0> + + + + + + + 0 0 + # beta (1, 2) <1> + + + + + + + 0 0 + # beta (1, 5) x <2> + + + + + + + 0 0 + # beta (1, 100) <3> + + + + + 0 . 0 0 + # beta (3, 4) <4> + . + + . 0 0 0 0 + # beta (5, 100) <5> + + + + + 0 0 0 0 + # beta (500, 300) <6> + + + + + 0 + 0 0 + # beta (5, 10, -3, 15) <7> + + + + + 0 + 0 0 + # cauchy () <8> + + + + + 0 + 0 0 + # cauchy (1, 20) <23> + + + + + 0 + 0 0 + # exponential () <24> + + + + + 0 + 0 0 + # exponential (30, -5) x <9> + + + + + 0 + 0 0 + # gamma (1) <10> + + + + + 0 + 0 0 + # gamma (2) <11> + + + + + 0 + 0 0 + # gamma (3) <12> + + + + + 0 0 0 0 + # gamma (10) x<13> + . + + . 0 0 0 0 + # gamma (1000) <14> + + + + + 0 - 0 0 + # gamma (5, 1000, 0) x<15> + + + + + 0 0 0 0 + # gamma (5, 1e-05, 0) x<16> + . + + . 0 0 0 0 + # gamma (5, 10, 100000) <25> + + + + + 0 + 0 0 + # laplace () <26> + + + + + 0 . 0 0 + # laplace (-10, 100) <17> + + + + + 0 + 0 0 + # normal () x<18> + . + + . 0 + 0 0 + # normal (1, 1e-05) <19> + + + + + 0 + 0 0 + # normal (1, 1e+05) <20> + + + + + + + + + + # uniform () <21> + . + + . 0 + 0 0 + # uniform (1, 20) <22> + + + + + + + 0 0 + # cauchy () - truncated <27> 0 0 0 0 0 0 + 0 0 0 # sawtooth-cont (0,3) <28> 0 0 0 0 0 0 0 0 0 0 # sawtooth-cont (0,5) <29> 0 0 0 0 0 0 0 + 0 0 # sawtooth-disc (0,3) <30> 0 0 0 0 0 0 0 0 + 0 # sawtooth-disc (-2,2) [validate - verify hat:] # + ... pass test # 0 ... fail to initialize generator # - ... fail test # . ... do not run test # # ... comment # # generators: # [0] ... default (immediate acceptance) # [1] ... default, truncated # [2] ... without DARS # [3] ... "classical" acceptance/rejection # [4] ... "classical" acceptance/rejection, truncated # [5] ... use slopes (-0.5, 0.) and (0.,2.) # [6] ... give construction points # [7] ... use slopes [for particular sawtooth distribution only] # [8] ... use slopes [for particular sawtooth distribution only] # [9] ... dars disabled, ear disabled, urng_aux # # [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] # distribution #----------------------------------------------------------------------------- x <0> + . + + . + + . . . # beta (1, 2) <1> + . + + . + + . . . # beta (1, 5) x <2> + . + + . + + . . . # beta (1, 100) <3> + . + + . . . . . . # beta (3, 4) <4> + . + + . . . . . . # beta (5, 100) <5> + . + + . . . . . . # beta (500, 300) <6> + . + + . . . . . . # beta (5, 10, -3, 15) <7> + . + + . . + . . . # cauchy () <8> + . + + . . + . . . # cauchy (1, 20) <23> + . + + . . + . . . # exponential () <24> + . + + . . + . . . # exponential (30, -5) x <9> + . + + . . + . . . # gamma (1) <10> + . + + . . + . . . # gamma (2) <11> + . + + . . + . . . # gamma (3) <12> + . + + . . . . . . # gamma (10) x<13> + . + + . . . . . . # gamma (1000) <14> + . + + . . . . . . # gamma (5, 1000, 0) x<15> + . + + . . . . . . # gamma (5, 1e-05, 0) x<16> + . + + . . . . . . # gamma (5, 10, 100000) <25> + . + + . . + . . . # laplace () <26> + . + + . . - . . . # laplace (-10, 100) <17> + . + + . . + . . . # normal () x<18> + . + + . . + . . . # normal (1, 1e-05) <19> + . + + . . + . . . # normal (1, 1e+05) <20> + . + + . + + . . . # uniform () <21> + . + + . . + . . . # uniform (1, 20) <22> + . + + . + + . . . # cauchy () - truncated <27> . . . . . . + . . . # sawtooth-cont (0,3) <28> . . . . . . . . . . # sawtooth-cont (0,5) <29> . . . . . . . . . . # sawtooth-disc (0,3) <30> . . . . . . . . . . # sawtooth-disc (-2,2) ############################################################################# ############################################################################# [verbatim] /* pdf with negative value */ double pdf_negative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return (-x*x); } /* pdf with partial negative value */ double pdf_partnegative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return ((x>-0.89 && x<0.89) ? -1.: exp(-x*x)); } ############################################################################# unuran-1.11.0/tests/t_dari.c0000644001357500135600000040405614430713513012617 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for DARI **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ int unur_dari_set_pedantic( struct unur_par *par, int pedantic ); double pmf_poisson5(int k, const UNUR_DISTR *distr); double pmf_poisson5_NaN(int k, const UNUR_DISTR *distr); double pmf_poisson50(int k, const UNUR_DISTR *distr); double pmf_negpoisson5(int k, const UNUR_DISTR *distr); double pmf_negpoisson50(int k, const UNUR_DISTR *distr); #define COMPARE_SAMPLE_SIZE (10000) #define VIOLATE_SAMPLE_SIZE (20) /* #define SEED (298346) */ /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ /* no such function */ int unur_dari_set_pedantic( struct unur_par *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) { return 1; } #include double pmf_poisson5(int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double theta = 5.; return ((k<0) ? 0. : exp( -theta + k * log(theta) - _unur_SF_ln_factorial(k) )); } double pmf_poisson5_NaN(int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double theta = 5.; return ((k<0) ? 0. : exp( -theta + k * log(theta)) / exp (_unur_SF_ln_factorial(k) )); } double pmf_poisson50(int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double theta = 50.; return ((k<0) ? 0. : exp( -theta + k * log(theta) - _unur_SF_ln_factorial(k) )); } double pmf_negpoisson5(int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double theta = 5.; k *= -1; return ((k<0) ? 0. : exp( -theta + k * log(theta) - _unur_SF_ln_factorial(k) )); } double pmf_negpoisson50(int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double theta = 50.; k *= -1; return ((k<0) ? 0. : exp( -theta + k * log(theta) - _unur_SF_ln_factorial(k) )); } /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,36,(unur_dari_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,36,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; distr = unur_distr_cont_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,42,(unur_dari_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,42,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* data missing in distribution object */ UNUR_DISTR *distr = NULL; distr = unur_distr_discr_new(); /* no PMF */ unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,48,(unur_dari_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,48,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [set] */ void test_set (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[set "); fflush(stdout); fprintf(TESTLOG,"\n[set]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,58,(unur_dari_set_cpfactor(par,1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,58,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,61,(unur_dari_set_squeeze(par, 1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,61,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,64,(unur_dari_set_tablesize(par,100)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,64,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,67,(unur_dari_set_verify(par,1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,67,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* invalid parameter object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double fpar[1] = {0.5}; distr = unur_distr_geometric(fpar,1); par = unur_dgt_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,76,(unur_dari_set_cpfactor(par,1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,76,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,79,(unur_dari_set_squeeze(par, 1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,79,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,82,(unur_dari_set_tablesize(par,100)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,82,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,85,(unur_dari_set_verify(par,1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,85,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double fpar[1] = {0.5}; distr = unur_distr_geometric(fpar,1); par = unur_dari_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,95,(unur_dari_set_cpfactor(par,-1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,95,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_dari_set_cpfactor(par,3.); n_tests_failed += (check_errorcode(TESTLOG,98,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,101,(unur_dari_set_tablesize(par,-100)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,101,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_set() */ /*---------------------------------------------------------------------------*/ /* [chg] */ void test_chg (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[chg "); fflush(stdout); fprintf(TESTLOG,"\n[chg]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid generator object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[1] = {0.5}; distr = unur_distr_geometric(fpar,1); par = unur_dgt_new(distr); unur_set_debug(par,0); gen = unur_init( par ); abort_if_NULL(TESTLOG, 117, gen ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,121,(unur_dari_chg_verify( gen,1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,121,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_chg() */ /*---------------------------------------------------------------------------*/ /* [reinit] */ void test_reinit (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[reinit "); fflush(stdout); fprintf(TESTLOG,"\n[reinit]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* exist */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[1] = {0.5}; distr = unur_distr_geometric(fpar,1); par = unur_dari_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 135, gen ); unur_reset_errno(); n_tests_failed += (check_expected_reinit(TESTLOG,139,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_reinit() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* compare */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double fpar[] = {0.1}; distr = unur_distr_geometric(fpar,1); par = NULL; unur_reset_errno(); /* default algorithm */ par = unur_dari_new(distr); n_tests_failed += (compare_sequence_par_start(TESTLOG,152,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* default algorithm - verifying mode */ par = unur_dari_new(distr); unur_dari_set_verify(par,1); n_tests_failed += (compare_sequence_par(TESTLOG,157,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* compare clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; UNUR_GEN *clone; double fpar[] = {10,0.3}; distr = unur_distr_binomial(fpar,2); par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_dari_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,171,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,177,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare reinit */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[] = {10,0.3}; distr = unur_distr_binomial(fpar,2); par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_dari_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,190,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* reinit */ unur_reinit(gen); n_tests_failed += (compare_sequence_gen(TESTLOG,194,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare stringparser */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[] = {20, 0.8}; distr = NULL; par = NULL; gen = NULL; unur_reset_errno(); distr = unur_distr_binomial(fpar,2); par = unur_dari_new(distr); unur_dari_set_cpfactor(par,0.7); unur_dari_set_squeeze(par,TRUE); unur_dari_set_tablesize(par,30); unur_dari_set_verify(par,FALSE); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,211,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "binomial(20,0.8) & \ method = dari; cpfactor = 0.7; squeeze; tablesize = 30; verify = off" ); n_tests_failed += (compare_sequence_gen(TESTLOG,217,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* [validate] */ /*---------------------------------------------------------------------------*/ /* [validate] */ void test_validate (void) { /* suppress GCC compiler warning */ GCC_DIAG_OFF(unused-variable) UNUR_DISTR *distr[23]; UNUR_PAR *par; UNUR_GEN *gen; double *darray; double fpm[10]; int n_tests_failed; int rcode; /* start test */ printf("[validate "); fflush(stdout); fprintf(TESTLOG,"\n[validate]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* distributions: 23 */ { fpm[0] = 0.5; distr[0] = unur_distr_geometric(fpm,1); } { fpm[0] = 0.1; distr[1] = unur_distr_geometric(fpm,1); } { fpm[0] = 0.001; distr[2] = unur_distr_geometric(fpm,1); } { fpm[0] = 0.1; distr[3] = unur_distr_logarithmic(fpm,1); } { fpm[0] = 0.9; distr[4] = unur_distr_logarithmic(fpm,1); } { fpm[0] = 0.5; fpm[1] = 10.; distr[5] = unur_distr_negativebinomial(fpm,2); } { fpm[0] = 0.7; fpm[1] = 5.; distr[6] = unur_distr_negativebinomial(fpm,2); } { fpm[0] = 0.1; fpm[1] = 20.; distr[7] = unur_distr_negativebinomial(fpm,2); } { fpm[0] = 3.; distr[8] = unur_distr_poisson(fpm,1); } { fpm[0] = 50.; distr[9] = unur_distr_poisson(fpm,1); } { fpm[0] = 2.; fpm[1] = 1.; distr[10] = unur_distr_zipf(fpm,2); unur_distr_discr_set_domain(distr[10],1,1000); } { fpm[0] = 20.; fpm[1] = 0.8; distr[11] = unur_distr_binomial(fpm,2); } { fpm[0] = 2000.; fpm[1] = 0.0013; distr[12] = unur_distr_binomial(fpm,2); } { fpm[0] = 2000.; fpm[1] = 200.; fpm[2] = 20; distr[13] = unur_distr_hypergeometric(fpm,3); } { fpm[0] = 2000.; fpm[1] = 200.; fpm[2] = 220; distr[14] = unur_distr_hypergeometric(fpm,3); } { distr[15] = unur_distr_discr_new(); unur_distr_discr_set_pmf(distr[15],pmf_poisson5); unur_distr_set_name(distr[15],"test-poisson"); } { distr[16] = unur_distr_discr_new(); unur_distr_discr_set_pmf(distr[16],pmf_poisson5); unur_distr_set_name(distr[16],"test-poisson"); } { distr[17] = unur_distr_discr_new(); unur_distr_discr_set_pmf(distr[17],pmf_poisson5); unur_distr_set_name(distr[17],"test-poisson"); } { distr[18] = unur_distr_discr_new(); unur_distr_discr_set_pmf(distr[18],pmf_poisson5); unur_distr_discr_set_domain(distr[18],INT_MIN,INT_MAX); unur_distr_set_name(distr[18],"test-poisson"); } { distr[19] = unur_distr_discr_new(); unur_distr_discr_set_pmf(distr[19],pmf_negpoisson5); unur_distr_discr_set_domain(distr[19],INT_MIN,INT_MAX); unur_distr_set_name(distr[19],"test-poisson"); } { distr[20] = unur_distr_discr_new(); unur_distr_discr_set_pmf(distr[20],pmf_negpoisson5); unur_distr_discr_set_domain(distr[20],INT_MIN,0); unur_distr_set_name(distr[20],"test-poisson"); } { distr[21] = unur_distr_discr_new(); unur_distr_discr_set_pmf(distr[21],pmf_negpoisson50); unur_distr_discr_set_domain(distr[21],INT_MIN,INT_MAX); unur_distr_set_name(distr[21],"test-poisson"); } { distr[22] = unur_distr_discr_new(); unur_distr_discr_set_pmf(distr[22],pmf_negpoisson50); unur_distr_discr_set_domain(distr[22],INT_MIN,0); unur_distr_set_name(distr[22],"test-poisson"); } /* timing */ stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); printf("\n(chi^2) "); fflush(stdout); /* chi^2 tests: 161 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nChi^2 Test:\n"); /* distribution [0] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_dari_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,5); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); fpm[0] = 0.4; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,1); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_dari_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,5); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); fpm[0] = 0.4; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,1); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [2] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_dari_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,5); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); fpm[0] = 0.4; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,1); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [3] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_dari_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,5); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); fpm[0] = 0.4; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,1); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [4] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_dari_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,5); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); fpm[0] = 0.4; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,1); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [5] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_dari_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,5); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [6] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_dari_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,5); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [7] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_dari_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,5); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [8] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_dari_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,5); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [9] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_dari_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,5); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [10] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_dari_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,5); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [11] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_dari_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,5); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [12] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_dari_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,5); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [13] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_dari_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,5); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [14] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_dari_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,5); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [15] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_dari_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,5); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [16] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_dari_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,5); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [17] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_dari_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_dari_new(distr_localcopy); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,5); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); printf("\n(verify hat) "); fflush(stdout); /* verify hat tests: 161 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nVerify Hat Test (squeeze <= PDF <= hat):\n"); /* distribution [0] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 1); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 1); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,5); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); fpm[0] = 0.4; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,1); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 1); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 1); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,5); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); fpm[0] = 0.4; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,1); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [2] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 1); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 1); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,5); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); fpm[0] = 0.4; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,1); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [3] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 1); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 1); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,5); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); fpm[0] = 0.4; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,1); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [4] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 1); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 1); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,5); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); fpm[0] = 0.4; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,1); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [5] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 1); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 1); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,5); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [6] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 1); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 1); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,5); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [7] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 1); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 1); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,5); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [8] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 1); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 1); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,5); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [9] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 1); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 1); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,5); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [10] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 1); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 1); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,5); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [11] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 1); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 1); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,5); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [12] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 1); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 1); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,5); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [13] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 1); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 1); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,5); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [14] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 1); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 1); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,5); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [15] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 1); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 1); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,5); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [16] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 1); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 1); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,5); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [17] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 1); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 1); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,5); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [19] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'0')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 1); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'0')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'0')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 1); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'0')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 0); gen = unur_init(par); if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'0')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); { UNUR_DISTR *dg =NULL; par = unur_dari_new(distr_localcopy); unur_dari_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,5); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_dari_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'0')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); /* free distributions */ unur_distr_free(distr[0]); unur_distr_free(distr[1]); unur_distr_free(distr[2]); unur_distr_free(distr[3]); unur_distr_free(distr[4]); unur_distr_free(distr[5]); unur_distr_free(distr[6]); unur_distr_free(distr[7]); unur_distr_free(distr[8]); unur_distr_free(distr[9]); unur_distr_free(distr[10]); unur_distr_free(distr[11]); unur_distr_free(distr[12]); unur_distr_free(distr[13]); unur_distr_free(distr[14]); unur_distr_free(distr[15]); unur_distr_free(distr[16]); unur_distr_free(distr[17]); unur_distr_free(distr[18]); unur_distr_free(distr[19]); unur_distr_free(distr[20]); unur_distr_free(distr[21]); unur_distr_free(distr[22]); /* test finished */ test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; /* we accept CHI2_FAILURES_TOLERATED failures */ (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_validate */ /* enable GCC compiler warning */ GCC_DIAG_ON(unused-variable) /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_dari_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_pinv.conf0000644001357500135600000011412514420445767013366 00000000000000############################################################################ [main] [main - data:] # method method: PINV [main - header:] /* header files */ \#include /* -- which tests for u-error should be performed (for development) -- */ \#define DEVEL FALSE /* whether to run tests in development mode */ \#define ALL TRUE /* Remark: Setting ALL to FALSE is useful if a only a single validation test should be run. Thus the "if(ALL)" condition for that particular test has to be replaced by "if(TRUE)". */ \#define UERROR_STANDARDDIST TRUE \#define UERROR_QUASIPDF TRUE \#define UERROR_VANISHINGPDF TRUE \#define UERROR_TRUNCATED TRUE \#define UERROR_UNBOUNDEDPDF TRUE \#define UERROR_MULTIMODAL TRUE \#define UERROR_MULTIMODAL_VANISHINGPDF TRUE /* orders */ static int UERROR_ORDER_MIN = 3; static int UERROR_ORDER_MAX = 17; static int UERROR_ORDER_STEP = 1; /* smoothness */ static int SMOOTHNESS_MAX = 2; /* u-resolutions */ static double UERROR_URESOLUTION_MAX = 1.e-8; static double UERROR_URESOLUTION_MIN = 0.99e-13; static double UERROR_URESOLUTION_STEP = 0.1; /* we run all tests only in 'fullcheck' mode */ \#define set_uerror_tests() \ if (!fullcheck) { \ /* UERROR_ORDER_STEP = 3; */ \ UERROR_URESOLUTION_MAX = 1.e-8; \ UERROR_URESOLUTION_MIN = 0.99e-12; \ UERROR_URESOLUTION_STEP = 0.01; \ } /* see also SKIPORDER in routine pinv_error_experiment() below */ /* sample size */ static const int UERROR_SAMPLESIZE = 100000; /* -- constants -- */ \#define COMPARE_SAMPLE_SIZE (500) \#define VIOLATE_SAMPLE_SIZE (20) /* \#define SEED (298346) */ \#ifndef M_PI \#define M_PI 3.14159265358979323846264338328 /* pi */ \#endif /* -- macros -- */ \#define set_debug_flag(par) \ do { \ if (fullcheck) unur_set_debug((par),~0u); \ else unur_set_debug((par),0x00010000u); \ } while (0); /* -- prototypes -- */ int pinv_error_experiment( UNUR_PAR *par, int samplesize, int UERROR_PDF, int UERROR_CDF); int pinv_error_gen_experiment( UNUR_GEN *gen, double u_resolution, int order, int samplesize ); double neg_exponential_cdf( double x, const UNUR_DISTR *distr ); double neg_exponential_pdf( double x, const UNUR_DISTR *distr ); double neg_exponential_1_cdf( double x, const UNUR_DISTR *distr ); double neg_exponential_1_pdf( double x, const UNUR_DISTR *distr ); double sin_2_cdf( double x, const UNUR_DISTR *distr ); double sin_2_pdf( double x, const UNUR_DISTR *distr ); double sin_10_cdf( double x, const UNUR_DISTR *distr ); double sin_10_pdf( double x, const UNUR_DISTR *distr ); ############################################################################# [new] [new - invalid NULL ptr: distr = NULL; ] ~( distr ); --> expected_NULL --> UNUR_ERR_NULL [new - invalid distribution type: distr = unur_distr_discr_new(); ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID [new - data missing in distribution object: distr = unur_distr_cont_new(); ] /* pdf */ ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED ############################################################################# [set] [set - invalid NULL ptr: /* double stp[] = {1.,2.,3.}; */ par = NULL; ] ~_order( par, 3 ); --> expected_setfailed --> UNUR_ERR_NULL ~_smoothness( par, 1 ); --> expected_setfailed --> UNUR_ERR_NULL ~_u_resolution( par, 1.e-8 ); --> expected_setfailed --> UNUR_ERR_NULL ~_use_upoints( par, TRUE ); --> expected_setfailed --> UNUR_ERR_NULL ~_usepdf( par ); --> expected_setfailed --> UNUR_ERR_NULL ~_usecdf( par ); --> expected_setfailed --> UNUR_ERR_NULL ~_boundary(par,1.,3.); --> expected_setfailed --> UNUR_ERR_NULL ~_searchboundary(par, TRUE, TRUE ) --> expected_setfailed --> UNUR_ERR_NULL ~_max_intervals(par,1000) --> expected_setfailed --> UNUR_ERR_NULL ~_extra_testpoints(par,10) --> expected_setfailed --> UNUR_ERR_NULL ~_keepcdf(par,TRUE) --> expected_setfailed --> UNUR_ERR_NULL [set - invalid parameter object: /* double stp[] = {1.,2.,3.}; */ distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); ] ~_order( par, 3 ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_smoothness( par, 1 ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_u_resolution( par, 1.e-8 ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_use_upoints( par, TRUE ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_usepdf( par ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_usecdf( par ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_boundary(par,1.,3.); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_searchboundary(par, TRUE, TRUE ) --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_max_intervals(par,1000) --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_extra_testpoints(par,10) --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_keepcdf(par,TRUE) --> expected_setfailed --> UNUR_ERR_PAR_INVALID unur_par_free(par); [set - invalid parameters: distr = unur_distr_normal(NULL,0); par = unur_pinv_new(distr); ] ~_order( par, 30 ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_order( par, 1 ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_smoothness( par, 4 ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_boundary(par,1.,-3.); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_boundary(par,1.,UNUR_INFINITY); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_max_intervals(par,1) --> expected_setfailed --> UNUR_ERR_PAR_SET ~_max_intervals(par,10000000) --> expected_setfailed --> UNUR_ERR_PAR_SET ~_extra_testpoints(par,-1) --> expected_setfailed --> UNUR_ERR_PAR_SET unur_par_free(par); [set - invalid parameters: UNUR_PAR *par; UNUR_GEN *gen; distr = unur_distr_normal(NULL,0); ] par = unur_pinv_new(distr); ~_order( par, 4 ); ~_smoothness( par, 1 ); gen = unur_init(par); --> none --> UNUR_ERR_GENERIC unur_free(gen); par = unur_pinv_new(distr); ~_order( par, 4 ); ~_smoothness( par, 2 ); gen = unur_init(par); --> none --> UNUR_ERR_GENERIC unur_free(gen); par = unur_pinv_new(distr); ~_order( par, 6 ); ~_smoothness( par, 2 ); gen = unur_init(par); --> none --> UNUR_ERR_GENERIC unur_free(gen); [set - missing CDF: distr = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr, neg_exponential_pdf); par = unur_pinv_new(distr); ] ~_usecdf( par ); --> expected_setfailed --> UNUR_ERR_PAR_SET unur_par_free(par); [set - missing PDF: distr = unur_distr_cont_new(); unur_distr_cont_set_cdf(distr, neg_exponential_cdf); par = unur_pinv_new(distr); ] ~_usepdf( par ); --> expected_setfailed --> UNUR_ERR_PAR_SET unur_par_free(par); [set - missing PDF: UNUR_PAR *par; UNUR_GEN *gen; distr = unur_distr_cont_new(); unur_distr_cont_set_cdf(distr, neg_exponential_cdf); ] par = unur_pinv_new(distr); ~_usecdf( par ); ~_smoothness( par, 1 ); gen = unur_init(par); --> none --> UNUR_ERR_DISTR_REQUIRED unur_free(gen); par = unur_pinv_new(distr); ~_usecdf( par ); ~_smoothness( par, 2 ); gen = unur_init(par); --> none --> UNUR_ERR_DISTR_REQUIRED unur_free(gen); unur_distr_cont_set_pdf(distr, neg_exponential_pdf); par = unur_pinv_new(distr); ~_usecdf( par ); ~_smoothness( par, 2 ); gen = unur_init(par); --> none --> UNUR_ERR_DISTR_REQUIRED unur_free(gen); ############################################################################# [get] [get - invalid generator object: distr = unur_distr_normal(NULL,0); par = unur_srou_new(distr); gen = unur_init(par); <-- ! NULL ] ~_n_intervals(gen); --> expected_zero --> UNUR_ERR_GEN_INVALID ############################################################################# #[chg] ############################################################################# # [init] ############################################################################# #[reinit] #[reinit - exists: # distr = unur_distr_normal(NULL,0); # par = unur_pinv_new(distr); # gen = unur_init( par ); <-- ! NULL ] # #unur_reinit( gen ); # --> expected_reinit ############################################################################# [sample] [sample - invalid NULL ptr: gen = NULL; ] unur_pinv_eval_approxinvcdf(gen,0.5); --> expected_INFINITY --> UNUR_ERR_NULL #..................................................................... [sample - invalid generator object: distr = unur_distr_normal(NULL,0); par = unur_srou_new(distr); gen = unur_init(par); <-- ! NULL ] unur_pinv_eval_approxinvcdf(gen,0.5); --> expected_INFINITY --> UNUR_ERR_GEN_INVALID [sample - invalid domain: distr = unur_distr_normal(NULL,0); par = unur_pinv_new(distr); unur_set_debug(par,0); gen = unur_init( par ); <-- ! NULL ] unur_pinv_eval_approxinvcdf(gen,1.5); --> expected_INFINITY --> UNUR_ERR_DOMAIN unur_pinv_eval_approxinvcdf(gen,-0.5); --> expected_negINFINITY --> UNUR_ERR_DOMAIN #..................................................................... [sample - cdf table removed: distr = unur_distr_normal(NULL,0); par = unur_pinv_new(distr); unur_set_debug(par,0); gen = unur_init( par ); <-- ! NULL ] unur_pinv_eval_approxcdf(gen,1.5); --> expected_INFINITY --> UNUR_ERR_GENERIC #..................................................................... [sample - check approximate cdf: int i, cdffailed=0; double x,u,d; gen = unur_str2gen("cont;logpdf='5-x';domain=(0,infinity)&method=pinv;keepcdf=on;debug=0"); ] for (i=1; i<1000; i++) { x = 5.*i/1000.; u = unur_pinv_eval_approxcdf(gen,x); d = fabs(u - (1-exp(-x))); if (d > 1.e-11) { cdffailed = 1; }} cdffailed; --> expected_zero --> UNUR_SUCCESS #..................................................................... [sample - compare clone: UNUR_GEN *clone; distr = unur_distr_normal(NULL,0); par = NULL; gen = NULL; ] /* original generator object */ par = unur_pinv_new(distr); gen = unur_init(par); -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen #..................................................................... # #[sample - compare reinit: # distr = unur_distr_normal(NULL,0); # par = NULL; # gen = NULL; ] # #/* original generator object */ #par = unur_pinv_new(distr); #gen = unur_init(par); # -->compare_sequence_gen_start # #/* reinit */ #unur_reinit(gen); # -->compare_sequence_gen #..................................................................... [sample - compare stringparser: double fpar[] = {3.,4.}; distr = NULL; par = NULL; gen = NULL; ] distr = unur_distr_gamma(fpar,2); unur_distr_cont_set_domain(distr,2.,UNUR_INFINITY); par = unur_pinv_new(distr); set_debug_flag(par); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "gamma(3.,4.); domain = (2,infinity) & \ method = pinv; debug = 0x1" ); -->compare_sequence_gen unur_free(gen); gen = NULL; distr = unur_distr_normal(NULL,0); unur_distr_cont_set_domain(distr,2.,UNUR_INFINITY); par = unur_pinv_new(distr); unur_pinv_set_order(par,10); unur_pinv_set_u_resolution(par,1.e-6); unur_pinv_set_boundary(par,1.,1000.); unur_pinv_set_max_intervals(par,1000); set_debug_flag(par); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "normal; domain = (2,inf) & \ method = pinv; order = 10; u_resolution = 1.e-6; \ boundary = (1,1000); max_intervals = 1000; debug = 0x1" ); -->compare_sequence_gen ############################################################################# [validate] [validate - generators:] # default par[0] = unur_pinv_new(@distr@); [validate - distributions:] # Normal distributions distr[0] = unur_distr_normal(NULL,0); # Normal distributions with quasi density distr[1] = unur_distr_multPDF( distr[0], 100. ); # distributions with negative PDF distr[2] = unur_str2distr( "cont; pdf='x/(1+x*x*x*x)'; center=1" ); distr[3] = unur_str2distr( "cont; pdf='-x/(1+x*x*x*x)'; center=-1" ); # distributions with almost vanishing PDF distr[4] = unur_str2distr( "cont; pdf='cos(2*x)'; cdf='(1+sin(2*x))/2'; center=0; domain=(-0.7853981633974482, 0.7853981633974482)" ); distr[5] = unur_str2distr( "cont; pdf='1-x^2+1e-16'; cdf='( 2-(x^2-3)*x) / 4'; center=0; domain=(-1, 1)" ); # number of distributions: 3 [validate - test chi2:] # + ... pass test # 0 ... fail to initialize generator # - ... fail test # . ... do not run test # # ... comment # # generators: # [0] ... default # # 0 # distribution #----------------------------- <0> + # normal () <1> + # normal () <2> 0 # PDF(x) < 0 <3> 0 # PDF(x) < 0 <4> + # PDF(x) \approx 0 <5> + # PDF(x) \approx 0 ############################################################################# [special] [special - decl:] int samplesize = UERROR_SAMPLESIZE; int errorsum = 0; double fpar[4]; UNUR_DISTR *distr, *qdistr; UNUR_PAR *par; [special - start:] /* set u-error tests */ set_uerror_tests(); /* test for maximal u-error */ printf("\n[test maximal u-error]"); fprintf(TESTLOG,"\n* Test maximal u-error *\n"); ## ---------------------------------------------------- if (UERROR_STANDARDDIST) { /* --------------------------- */ printf("\nStandard distributions:\n"); fprintf(TESTLOG,"\n--- Standard distributions --- \n\n"); ## --- Normal --- if (ALL) { printf(" normal"); distr = unur_distr_normal(NULL,0); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } ## --- Cauchy --- if (ALL) { printf(" cauchy"); distr = unur_distr_cauchy(NULL,0); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } ## --- Exponential - Gamma(1) --- if (ALL) { printf(" exponential"); distr = unur_distr_exponential(NULL,0); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } ## --- Gamma(0.9) --- if (ALL) { printf(" gamma(0.9)"); fpar[0] = 0.9; distr = unur_distr_gamma(fpar,1); unur_distr_cont_set_center(distr,1.); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } ## --- Gamma(1.02) --- if (ALL) { printf(" gamma(1.02)"); fpar[0] = 1.02; distr = unur_distr_gamma(fpar,1); unur_distr_cont_set_center(distr,1.); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } ## --- Gamma(1.5) --- if (ALL) { printf(" gamma(1.5)"); fpar[0] = 1.5; distr = unur_distr_gamma(fpar,1); unur_distr_cont_set_center(distr,1.); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } ## --- Gamma(2) --- if (ALL) { printf(" gamma(2)"); fpar[0] = 2.; distr = unur_distr_gamma(fpar,1); unur_distr_cont_set_center(distr,1.); par = unur_pinv_new(distr); unur_pinv_set_boundary(par,0., 1.e100); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } ## --- Gamma(5) --- if (ALL) { printf(" gamma(5)"); fpar[0] = 5.; distr = unur_distr_gamma(fpar,1); unur_distr_cont_set_center(distr,1.); par = unur_pinv_new(distr); unur_pinv_set_boundary(par,0., 1.e100); ## unur_pinv_set_searchboundary(par,FALSE,TRUE); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } ## --- beta(2,3) --- if (ALL) { printf(" beta(2,3)"); fpar[0] = 2; fpar[1] = 3; distr = unur_distr_beta(fpar,2); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } ## --- Gumbel - ExtremeI --- if (ALL) { printf(" Gumbel"); distr = unur_distr_extremeI(NULL,0); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } ## --- Shifted Normal --- if (ALL) { printf(" shifted normal"); fpar[0] = 200.; fpar[1] = 1.; distr = unur_distr_normal(fpar,2); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); printf(" shifted normal"); fpar[0] = -200; fpar[1] = 1.; distr = unur_distr_normal(fpar,2); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } ## --- Lognormal --- if (0) { printf(" lognormal(2,0.5)"); fpar[0] = 2.; fpar[1] = 0.5; distr = unur_distr_lognormal(fpar,2); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); printf(" lognormal(2.0.5,4.)"); fpar[0] = 2.; fpar[1] = 0.5; fpar[2] = 4.; distr = unur_distr_lognormal(fpar,3); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } } /* endif (UERROR_STANDARDDIST) */ ## ---------------------------------------------------- if (UERROR_QUASIPDF) { /* --------------------------- */ printf("\nDistributions with quasi-densities:\n"); fprintf(TESTLOG,"\n--- Distributions with quasi-densities --- \n\n"); if (ALL) { distr = unur_distr_normal(NULL,0); printf(" (normal*1e10)"); qdistr = unur_distr_multPDF( distr, 1.e10 ); par = unur_pinv_new(qdistr); errorsum += pinv_error_experiment(par,samplesize,TRUE, DEVEL); unur_distr_free(qdistr); fprintf(TESTLOG,"\n"); printf(" (normal*1e-10)"); qdistr = unur_distr_multPDF( distr, 1.e-10 ); par = unur_pinv_new(qdistr); errorsum += pinv_error_experiment(par,samplesize,TRUE, DEVEL); unur_distr_free(qdistr); fprintf(TESTLOG,"\n"); unur_distr_free(distr); } } /* endif (UERROR_QUASIPDF) */ ## ---------------------------------------------------- if (UERROR_VANISHINGPDF) { /* --------------------------- */ printf("\nDistributions with vanishing PDF:\n"); fprintf(TESTLOG,"\n--- Distributions with vanishing PDF --- \n\n"); ## --- Exponential --- if (ALL) { printf(" (exponential_on_(-oo,oo))"); distr = unur_distr_exponential(NULL,0); unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); unur_distr_set_name(distr,"exponential_(-oo,oo)"); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } if (ALL) { printf(" (exponential(1,1)_on_(-oo,oo))"); fpar[0] = 1.; fpar[1] = 1.; distr = unur_distr_exponential(fpar,2); unur_distr_cont_set_center(distr,2.); unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); unur_distr_set_name(distr,"exponential(1,1)_(-oo,oo)"); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } if (ALL) { printf(" (exponential(1,1)_on_(-oo,oo))"); fpar[0] = 1.; fpar[1] = 1.; distr = unur_distr_exponential(fpar,2); unur_distr_cont_set_center(distr,2.); unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); unur_distr_cont_set_center(distr,2.); unur_distr_set_name(distr,"exponential(1,1)_(-oo,oo)"); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } if (ALL) { printf(" (exponential(1,-1)_on_(-oo,oo))"); fpar[0] = 1.; fpar[1] = -1.; distr = unur_distr_exponential(fpar,2); unur_distr_cont_set_center(distr,2.); unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); unur_distr_set_name(distr,"exponential(1,-1)_(-oo,oo)"); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } if (ALL) { printf(" (exponential(0.1,0.1)_on_(-oo,oo))"); fpar[0] = 0.1; fpar[1] = 0.1; distr = unur_distr_exponential(fpar,2); unur_distr_cont_set_center(distr,2.); unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); unur_distr_set_name(distr,"exponential(0.1,0.1)_(-oo,oo)"); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } if (ALL) { printf(" (exponential(1000,1000)_on_(-oo,oo))"); fpar[0] = 1000; fpar[1] = 1000; distr = unur_distr_exponential(fpar,2); unur_distr_cont_set_center(distr,1000.); unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); unur_distr_set_name(distr,"exponential(1000,1000)_(-oo,oo)"); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } ## --- "Negative" exponential --- if (ALL) { printf(" neg_exponential"); distr = unur_distr_cont_new(); unur_distr_set_name(distr,"neg_exponential"); unur_distr_cont_set_cdf( distr, neg_exponential_cdf ); unur_distr_cont_set_pdf( distr, neg_exponential_pdf ); unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } if (ALL) { printf(" neg_exponential_1"); distr = unur_distr_cont_new(); unur_distr_set_name(distr,"neg_exponential_1"); unur_distr_cont_set_cdf( distr, neg_exponential_1_cdf ); unur_distr_cont_set_pdf( distr, neg_exponential_1_pdf ); unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); unur_distr_cont_set_center(distr,-2.); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } ## --- Gamma(2) --- if (ALL) { printf(" gamma(2)"); fpar[0] = 2.; distr = unur_distr_gamma(fpar,1); unur_distr_cont_set_center(distr,1.); unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); par = unur_pinv_new(distr); unur_pinv_set_boundary(par,0., 1.e100); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } ## --- Gamma(5) --- if (ALL) { printf(" gamma(5)"); fpar[0] = 5.; distr = unur_distr_gamma(fpar,1); unur_distr_cont_set_center(distr,1.); unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); par = unur_pinv_new(distr); unur_pinv_set_boundary(par,0., 1.e100); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } ## --- Gamma(1.02) --- if (ALL) { printf(" gamma(1.02)"); fpar[0] = 1.02; distr = unur_distr_gamma(fpar,1); unur_distr_cont_set_center(distr,1.); unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } } /* endif (UERROR_VANISHINGPDF) */ ## ---------------------------------------------------- if (UERROR_TRUNCATED) { /* --------------------------- */ printf("\nTruncated Distributions:\n"); fprintf(TESTLOG,"\n--- Truncated Distributions --- \n\n"); ## --- Normal --- if (ALL) { printf(" truncated normal[3,inf]"); distr = unur_distr_normal(NULL,0); unur_distr_cont_set_domain(distr,3.,UNUR_INFINITY); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } if (ALL && DEVEL) { printf(" truncated normal[15,inf]"); distr = unur_distr_normal(NULL,0); unur_distr_cont_set_domain(distr,15.,UNUR_INFINITY); par = unur_pinv_new(distr); /* using CDF does not work here. */ errorsum += pinv_error_experiment(par,samplesize,TRUE, DEVEL); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } } /* endif (UERROR_TRUNCATED) */ ## ---------------------------------------------------- if (UERROR_UNBOUNDEDPDF) { /* --------------------------- */ printf("\nDistributions with unbounded PDF:\n"); fprintf(TESTLOG,"\n--- Distributions with unbounded PDF --- \n\n"); ## --- Gamma(0.2) --- if (ALL) { printf(" gamma(0.2)"); fpar[0] = 0.2; distr = unur_distr_gamma(fpar,1); unur_distr_cont_set_center(distr,1.); par = unur_pinv_new(distr); unur_pinv_set_extra_testpoints(par,50); errorsum += pinv_error_experiment(par,samplesize,TRUE, DEVEL); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } ## --- Gamma(0.5) --- if (ALL) { printf(" gamma(0.5)"); fpar[0] = 0.5; distr = unur_distr_gamma(fpar,1); unur_distr_cont_set_center(distr,1.); par = unur_pinv_new(distr); unur_pinv_set_extra_testpoints(par,40); errorsum += pinv_error_experiment(par,samplesize,TRUE, DEVEL); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } } /* endif (UERROR_UNBOUNDEDPDF) */ ## ---------------------------------------------------- if (UERROR_MULTIMODAL) { /* --------------------------- */ printf("\nMultimodal distributions:\n"); fprintf(TESTLOG,"\n--- Multimodal distributions --- \n\n"); ## --- sin-2-example --- if (ALL) { printf(" sin-2-example"); distr = unur_distr_cont_new(); unur_distr_set_name(distr,"sin-2-example"); unur_distr_cont_set_cdf( distr, sin_2_cdf ); unur_distr_cont_set_pdf( distr, sin_2_pdf ); unur_distr_cont_set_domain( distr, -1., 1. ); unur_distr_cont_set_center(distr,0.25); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } ## --- sin-10-example --- if (ALL) { printf(" sin-10-example"); distr = unur_distr_cont_new(); unur_distr_set_name(distr,"sin-10-example"); unur_distr_cont_set_cdf( distr, sin_10_cdf ); unur_distr_cont_set_pdf( distr, sin_10_pdf ); unur_distr_cont_set_domain( distr, -5., 5. ); unur_distr_cont_set_center(distr,0.25); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE, DEVEL); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } } /* endif (UERROR_MULTIMODAL) */ ## ---------------------------------------------------- if (UERROR_MULTIMODAL_VANISHINGPDF) { /* --------------------------- */ printf("\nMultimodal distributions with vanishing PDF:\n"); fprintf(TESTLOG,"\n--- Multimodal distributions with vanishing PDF --- \n\n"); ## --- sin-0-example --- if (ALL) { printf(" sin-2-example");fflush(stdout); distr = unur_distr_cont_new(); unur_distr_set_name(distr,"sin-0-example"); unur_distr_cont_set_cdf( distr, sin_2_cdf ); unur_distr_cont_set_pdf( distr, sin_2_pdf ); unur_distr_cont_set_domain( distr, -2., 2. ); unur_distr_cont_set_center(distr,0.25); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } if (ALL) { printf(" sin-2-example");fflush(stdout); distr = unur_distr_cont_new(); unur_distr_set_name(distr,"sin-0-example"); unur_distr_cont_set_cdf( distr, sin_2_cdf ); unur_distr_cont_set_pdf( distr, sin_2_pdf ); unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); unur_distr_cont_set_center(distr,0.25); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } ## --- sin-10-example --- if (ALL) { printf(" sin-10-example"); distr = unur_distr_cont_new(); unur_distr_set_name(distr,"sin-10-example"); unur_distr_cont_set_cdf( distr, sin_10_cdf ); unur_distr_cont_set_pdf( distr, sin_10_pdf ); unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); unur_distr_cont_set_center(distr,0.25); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE, DEVEL); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } } /* endif (UERROR_MULTIMODAL_VANISHINGPDF) */ ## ---------------------------------------------------- /*---------------------------------------------------------------------------*/ /* test finished */ FAILED = (errorsum < 2) ? 0 : 1; ############################################################################# [verbatim] ############################################################################# # # routines for special tests # ############################################################################# /*****************************************************************************/ /* run unur_test_u_error for a particular generator object and print result */ int pinv_error_gen_experiment( UNUR_GEN *gen, /* generator object */ double u_resolution, /* maximal tolerated u-error */ int order, /* order of polynomial */ int samplesize ) /* sample size for error experiment */ /* returns 0 if maxerror < u_resolution, errorcode otherwise */ { int i, nfpar; const double *fpar; const UNUR_DISTR *distr; const char *genid; int score; /* check for invalid NULL pointer */ if (gen==NULL) { fprintf(TESTLOG,"\n--setup failed !! --\n"); printf("(!!+)"); fflush(stdout); return 100; } /* get data about generator object */ distr = unur_get_distr(gen); genid = unur_get_genid(gen); /* print data about distribution */ fprintf(TESTLOG,"%s: %s distribution",genid,unur_distr_get_name(distr)); nfpar = unur_distr_cont_get_pdfparams(distr,&fpar); if (nfpar) { fprintf(TESTLOG," with parameters "); for(i=0;i 0) { fprintf(TESTLOG,"\t\#PDF calls = %d\t(per interval = %d)", get_counter_pdf(), ( (unur_pinv_get_n_intervals(gen)!=0) ? get_counter_pdf() / unur_pinv_get_n_intervals(gen) : -1 ) ); } if (get_counter_logpdf() > 0) { fprintf(TESTLOG,"\t\#logPDF calls = %d\t(per interval = %d)", get_counter_logpdf(), ( (unur_pinv_get_n_intervals(gen)!=0) ? get_counter_logpdf() / unur_pinv_get_n_intervals(gen) : -1 ) ); } if (get_counter_cdf() > 0) { fprintf(TESTLOG,"\t\#CDF calls = %d\t(per interval = %d)", get_counter_cdf(), ( (unur_pinv_get_n_intervals(gen)!=0) ? get_counter_cdf() / unur_pinv_get_n_intervals(gen) : -1 ) ); } fprintf(TESTLOG,"\n"); /* run test */ score = run_validate_u_error( TESTLOG, gen, distr, u_resolution, samplesize ); /* return score */ fprintf(TESTLOG,"\n"); fflush(TESTLOG); return score; } /* end of pinv_error_gen_experiment() */ /*****************************************************************************/ /* run experiment for a particular distribution object */ int pinv_error_experiment( UNUR_PAR *par, /* parameter object */ int samplesize, /* samplesize for error experiment */ int UERROR_PDF, /* if TRUE, check variant usePDF */ int UERROR_CDF) /* if TRUE, check variant useCDF */ /* returns 0 if maxerror < u_resolution, errorcode otherwise */ { UNUR_PAR *par_clone; /* working copy of parameter object */ UNUR_GEN *gen; /* generator object */ int order = 3; int smooth = 0; double u_resolution = 1.e-8; /* maximal tolerated u-error */ int errorsum = 0; int variant; /* check for invalid NULL pointer */ if (par==NULL) { printf(" NULL! "); return 1000; } /* -- loop smoothness -- */ for (smooth=0; smooth <= SMOOTHNESS_MAX; smooth++) { /* -- loop variante -- */ for (variant=0; variant <= 1; ++variant) { /* variant==0 --> use PDF */ /* variant==1 --> use CDF */ switch (variant) { case 0: /* run variant PDF+Lobatto */ if (UERROR_PDF) printf("",smooth); else continue; break; case 1: /* run variant CDF */ if (UERROR_CDF) printf("",smooth); else continue; break; default: continue; } /* -- loop order -- */ for ( order=UERROR_ORDER_MIN; order<=UERROR_ORDER_MAX; order+=UERROR_ORDER_STEP) { /* prevent warning from invalid order */ if (smooth==1 && order % 2 != 1) continue; if (smooth==2 && order % 3 != 2) continue; /* SKIPORDER: * when we do not run in fullcheck mode, we skip some orders. */ if (!fullcheck) { switch (smooth) { case 0: if (! (order==3 || order==5 || order==8 || order==12 || order==17) ) continue; break; case 1: if (order==7 || order==11 || order==15) continue; break; case 2: if (order == 14) continue; break; } } /* -- loop u-resolution -- */ for ( u_resolution = UERROR_URESOLUTION_MAX; u_resolution > UERROR_URESOLUTION_MIN; u_resolution *= UERROR_URESOLUTION_STEP ) { if (!fullcheck) { if (smooth==2 && u_resolution < 0.99e-10) /* setup fails for some truncated distributions. */ /* so we skip it when not run in fullcheck mode. */ continue; } /* make a working copy */ par_clone = _unur_par_clone(par); /* set variant */ switch (variant) { case 0: unur_pinv_set_usepdf(par_clone); break; case 1: unur_pinv_set_usecdf(par_clone); break; } /* maximum number of subintervals */ /**/ if (order <= 3 && u_resolution < 1.e-12) { unur_pinv_set_max_intervals(par_clone,100000); } else if (u_resolution < 1.e13) { unur_pinv_set_max_intervals(par_clone,100000); } /* start counter for PDF calls */ start_counter_fcalls(par_clone); /* create generator object */ unur_pinv_set_order(par_clone,order); unur_pinv_set_smoothness(par_clone,smooth); unur_pinv_set_u_resolution(par_clone,u_resolution); set_debug_flag(par_clone); gen = unur_init(par_clone); /* run test */ errorsum += pinv_error_gen_experiment(gen, u_resolution, order, samplesize); /* clear memory */ unur_free(gen); stop_counter_fcalls(); } /* -- end loop u-resolution -- */ } /* -- end end loop order -- */ } /* -- end loop variant */ } /* -- end loop smoothness -- */ unur_par_free(par); return errorsum; } /* end of pinv_error_experiment() */ /*****************************************************************************/ ############################################################################# # # PDFs and CDF for test distributions # ############################################################################# /*---------------------------------------------------------------------------*/ /* "negative" exponential distribution */ /* */ /* / exp(x) if x <= 0 */ /* f(x) = < */ /* \ 0 otherwise */ /* */ double neg_exponential_pdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { if (x>0.) return 0.; else return (exp(x)); } double neg_exponential_cdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { if (x>0.) return 1.; else return (exp(x)); } /*---------------------------------------------------------------------------*/ /* "shifted negative" exponential distribution */ /* */ /* / exp(x-s) if x <= s */ /* f(x) = < */ /* \ 0 otherwise */ /* */ \#define shift (-1.) double neg_exponential_1_pdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { x = x-shift; if (x>0.) return 0.; else return (exp(x)); } double neg_exponential_1_cdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { x = x-shift; if (x>=0.) return 1.; else return (exp(x)); } \#undef shift /*---------------------------------------------------------------------------*/ /* */ /* / 0.05 + 0.45*(1 +sin(2 Pi x)) if |x| <= 1 */ /* f(x) = < */ /* \ 0 otherwise */ /* */ double sin_2_pdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { if (fabs(x) > 1.) return 0.; else return (0.05 + 0.45*(1.+sin(2.*M_PI*x))); } /* end of sin_pdf() */ /* The CDF of our distribution: */ double sin_2_cdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { if (x < -1.) return 0.; else if(x<=1.) return (0.05*(x+1) + 0.9*(1.+2.*M_PI*(1+x)-cos((2.*M_PI)*x))/(4.*M_PI)); else return 1.; } /* end of sin_cdf() */ /*---------------------------------------------------------------------------*/ /* */ /* / 0.05 + 0.45*(1 +sin(2 Pi x)) if |x| <= 5 */ /* f(x) = < */ /* \ 0 otherwise */ /* */ double sin_10_pdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { if (fabs(x) > 5.) return 0.; else return (0.05 + 0.45*(1.+sin(2.*M_PI*x))); } /* end of sin_pdf() */ /* The CDF of our distribution: */ double sin_10_cdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { if (x < -5.) return 0.; else if(x<=5.) return ((x/10.+0.5) + 0.09/(2*M_PI)*(cos(10*M_PI)-cos(2*M_PI*x))); else return 1.; } /* end of sin_cdf() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/tests/t_distr_cont.conf0000644001357500135600000004607414420445767014571 00000000000000############################################################################# [main] [main - data:] # method (for information only: the program scans the file name) method: DISTR_CONT [main - header:] ## we need UNUR_DISTR_MAXPARAMS for a test: \#include /* prototypes */ \#define COMPARE_SAMPLE_SIZE (500) \#define VIOLATE_SAMPLE_SIZE (20) double pdf(double x, const UNUR_DISTR *distr); double dpdf(double x, const UNUR_DISTR *distr); double cdf(double x, const UNUR_DISTR *distr); double invcdf(double x, const UNUR_DISTR *distr); double hr(double x, const UNUR_DISTR *distr); ## work-around for missing functions int unur_distr_cont_set_pedantic(UNUR_PAR *par, int pedantic); int unur_distr_cont_chg_verify(UNUR_GEN *gen, int verify); ############################################################################# [new] ############################################################################# [set] [set - invalid NULL ptr: distr = NULL; ] unur_distr_cont_set_pdf( distr, pdf ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_cont_set_dpdf( distr, dpdf ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_cont_set_logpdf( distr, pdf ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_cont_set_dlogpdf( distr, dpdf ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_cont_set_cdf( distr, cdf ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_cont_set_invcdf( distr, invcdf ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_cont_set_hr( distr, hr ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_cont_set_pdfstr( distr, "pdf" ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_cont_set_logpdfstr( distr, "pdf" ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_cont_set_cdfstr( distr, "cdf" ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_cont_set_hrstr( distr, "hr" ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_cont_set_pdfparams( distr, NULL, 0 ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_cont_set_pdfparams_vec( distr, 0, NULL, 0 ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_cont_set_domain( distr, 0., 1. ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_cont_set_mode( distr, 0. ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_cont_set_center( distr, 0. ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_cont_set_pdfarea( distr, 1. ); --> expected_setfailed --> UNUR_ERR_NULL [set - invalid distribution type: distr = unur_distr_discr_new(); ] unur_distr_cont_set_pdf( distr, pdf ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_cont_set_dpdf( distr, dpdf ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_cont_set_logpdf( distr, pdf ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_cont_set_dlogpdf( distr, dpdf ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_cont_set_cdf( distr, cdf ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_cont_set_invcdf( distr, invcdf ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_cont_set_hr( distr, hr ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_cont_set_pdfstr( distr, "exp(-x)" ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_cont_set_pdfstr( distr, "-x" ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_cont_set_cdfstr( distr, "exp(-x)" ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_cont_set_hrstr( distr, "exp(-x)" ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_cont_set_pdfparams( distr, NULL, 0 ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_cont_set_domain( distr, 0., 1. ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_cont_set_mode( distr, 0. ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_cont_set_center( distr, 0. ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_cont_set_pdfarea( distr, 1. ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID [set - invalid NULL ptr: distr = unur_distr_cont_new(); ] unur_distr_cont_set_pdf( distr, NULL ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_cont_set_dpdf( distr, NULL ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_cont_set_logpdf( distr, NULL ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_cont_set_dlogpdf( distr, NULL ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_cont_set_cdf( distr, NULL ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_cont_set_invcdf( distr, NULL ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_cont_set_hr( distr, NULL ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_cont_set_pdfstr( distr, NULL ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_cont_set_logpdfstr( distr, NULL ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_cont_set_cdfstr( distr, NULL ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_cont_set_hrstr( distr, NULL ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_cont_set_pdfparams( distr, NULL, 1 ); --> expected_setfailed --> UNUR_ERR_NULL [set - invalid parameters: double pv[] = {1.,2.,3.}; distr = unur_distr_cont_new(); ] unur_distr_cont_set_pdfstr( distr, "" ); --> expected_setfailed --> UNUR_ERR_DISTR_SET unur_distr_cont_set_pdfstr( distr, "x * y * z" ); --> expected_setfailed --> UNUR_ERR_DISTR_SET unur_distr_cont_set_pdfstr( distr, "beta(2.)" ); --> expected_setfailed --> UNUR_ERR_DISTR_SET unur_distr_cont_set_logpdfstr( distr, "" ); --> expected_setfailed --> UNUR_ERR_DISTR_SET unur_distr_cont_set_logpdfstr( distr, "x * y * z" ); --> expected_setfailed --> UNUR_ERR_DISTR_SET unur_distr_cont_set_logpdfstr( distr, "beta(2.)" ); --> expected_setfailed --> UNUR_ERR_DISTR_SET unur_distr_cont_set_cdfstr( distr, "" ); --> expected_setfailed --> UNUR_ERR_DISTR_SET unur_distr_cont_set_cdfstr( distr, "beta(2.)" ); --> expected_setfailed --> UNUR_ERR_DISTR_SET unur_distr_cont_set_hrstr( distr, "" ); --> expected_setfailed --> UNUR_ERR_DISTR_SET unur_distr_cont_set_pdfparams( distr, pv, -1 ); --> expected_setfailed --> UNUR_ERR_DISTR_NPARAMS unur_distr_cont_set_pdfparams( distr, pv, UNUR_DISTR_MAXPARAMS +1 ); --> expected_setfailed --> UNUR_ERR_DISTR_NPARAMS unur_distr_cont_set_pdfparams_vec( distr, -1, pv, 2 ); --> expected_setfailed --> UNUR_ERR_DISTR_NPARAMS unur_distr_cont_set_pdfparams_vec( distr, 100000, pv, 2 ); --> expected_setfailed --> UNUR_ERR_DISTR_NPARAMS unur_distr_cont_set_domain( distr, 0., -1. ); --> expected_setfailed --> UNUR_ERR_DISTR_SET unur_distr_cont_set_pdfarea( distr, -1. ); --> expected_setfailed --> UNUR_ERR_DISTR_SET [set - invalid set parameters: distr = unur_distr_normal(NULL,0); ] unur_distr_cont_set_pdf( distr, pdf ); --> expected_setfailed --> UNUR_ERR_DISTR_SET unur_distr_cont_set_dpdf( distr, dpdf ); --> expected_setfailed --> UNUR_ERR_DISTR_SET unur_distr_cont_set_logpdf( distr, pdf ); --> expected_setfailed --> UNUR_ERR_DISTR_SET unur_distr_cont_set_dlogpdf( distr, dpdf ); --> expected_setfailed --> UNUR_ERR_DISTR_SET ############################################################################# [get] [get - invalid NULL ptr: double a, b; distr = NULL; ] unur_distr_cont_get_pdf( distr ); --> expected_NULL --> UNUR_ERR_NULL unur_distr_cont_get_dpdf( distr ); --> expected_NULL --> UNUR_ERR_NULL unur_distr_cont_get_logpdf( distr ); --> expected_NULL --> UNUR_ERR_NULL unur_distr_cont_get_dlogpdf( distr ); --> expected_NULL --> UNUR_ERR_NULL unur_distr_cont_get_cdf( distr ); --> expected_NULL --> UNUR_ERR_NULL unur_distr_cont_get_invcdf( distr ); --> expected_NULL --> UNUR_ERR_NULL unur_distr_cont_get_hr( distr ); --> expected_NULL --> UNUR_ERR_NULL unur_distr_cont_get_pdfstr( distr ); --> expected_NULL --> UNUR_ERR_NULL unur_distr_cont_get_dpdfstr( distr ); --> expected_NULL --> UNUR_ERR_NULL unur_distr_cont_get_logpdfstr( distr ); --> expected_NULL --> UNUR_ERR_NULL unur_distr_cont_get_dlogpdfstr( distr ); --> expected_NULL --> UNUR_ERR_NULL unur_distr_cont_get_cdfstr( distr ); --> expected_NULL --> UNUR_ERR_NULL unur_distr_cont_get_hrstr( distr ); --> expected_NULL --> UNUR_ERR_NULL unur_distr_cont_get_pdfparams( distr, NULL ); --> expected_zero --> UNUR_ERR_NULL unur_distr_cont_get_pdfparams_vec( distr, 0, NULL ); --> expected_zero --> UNUR_ERR_NULL unur_distr_cont_get_domain( distr, &a, &b ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_cont_get_mode( distr ); --> expected_INFINITY --> UNUR_ERR_NULL unur_distr_cont_get_pdfarea( distr ); --> expected_INFINITY --> UNUR_ERR_NULL [get - invalid distribution type: double a,b; const double *ar; distr = unur_distr_discr_new(); ] unur_distr_cont_get_pdf( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID unur_distr_cont_get_dpdf( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID unur_distr_cont_get_logpdf( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID unur_distr_cont_get_dlogpdf( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID unur_distr_cont_get_cdf( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID unur_distr_cont_get_invcdf( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID unur_distr_cont_get_hr( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID unur_distr_cont_get_pdfstr( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID unur_distr_cont_get_dpdfstr( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID unur_distr_cont_get_logpdfstr( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID unur_distr_cont_get_dlogpdfstr( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID unur_distr_cont_get_cdfstr( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID unur_distr_cont_get_hrstr( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID unur_distr_cont_get_pdfparams( distr, NULL ); --> expected_zero --> UNUR_ERR_DISTR_INVALID unur_distr_cont_get_pdfparams_vec( distr, 0, &ar ); --> expected_zero --> UNUR_ERR_DISTR_INVALID unur_distr_cont_get_domain( distr, &a, &b ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_cont_get_mode( distr ); --> expected_INFINITY --> UNUR_ERR_DISTR_INVALID unur_distr_cont_get_pdfarea( distr ); --> expected_INFINITY --> UNUR_ERR_DISTR_INVALID [get - parameters not unknown: distr = unur_distr_cont_new(); ] unur_distr_cont_get_pdfstr( distr ); --> expected_NULL --> UNUR_ERR_NULL unur_distr_cont_get_dpdfstr( distr ); --> expected_NULL --> UNUR_ERR_NULL unur_distr_cont_get_logpdfstr( distr ); --> expected_NULL --> UNUR_ERR_NULL unur_distr_cont_get_dlogpdfstr( distr ); --> expected_NULL --> UNUR_ERR_NULL unur_distr_cont_get_cdfstr( distr ); --> expected_NULL --> UNUR_ERR_NULL unur_distr_cont_get_hrstr( distr ); --> expected_NULL --> UNUR_ERR_NULL unur_distr_cont_get_mode( distr ); --> expected_INFINITY --> UNUR_ERR_DISTR_GET unur_distr_cont_get_pdfarea( distr ); --> expected_INFINITY --> UNUR_ERR_DISTR_GET ############################################################################# [chg] [chg - invalid NULL ptr: distr = NULL; ] unur_distr_cont_upd_mode( distr ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_cont_upd_pdfarea( distr ); --> expected_setfailed --> UNUR_ERR_NULL [chg - invalid distribution type: distr = unur_distr_discr_new(); ] unur_distr_cont_upd_mode( distr ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_cont_upd_pdfarea( distr ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID [chg - missing data: distr = unur_distr_cont_new(); ] unur_distr_cont_upd_mode( distr ); --> expected_setfailed --> UNUR_ERR_DISTR_DATA unur_distr_cont_upd_pdfarea( distr ); --> expected_setfailed --> UNUR_ERR_DISTR_DATA ############################################################################## # [init] ############################################################################# # [reinit] ############################################################################# [sample] [sample - invalid NULL ptr: distr = NULL; ] unur_distr_cont_eval_pdf( 1., distr ); --> expected_INFINITY --> UNUR_ERR_NULL unur_distr_cont_eval_dpdf( 1., distr ); --> expected_INFINITY --> UNUR_ERR_NULL unur_distr_cont_eval_logpdf( 1., distr ); --> expected_INFINITY --> UNUR_ERR_NULL unur_distr_cont_eval_dlogpdf( 1., distr ); --> expected_INFINITY --> UNUR_ERR_NULL unur_distr_cont_eval_cdf( 1., distr ); --> expected_INFINITY --> UNUR_ERR_NULL unur_distr_cont_eval_invcdf( 0.5, distr ); --> expected_INFINITY --> UNUR_ERR_NULL unur_distr_cont_eval_hr( 1., distr ); --> expected_INFINITY --> UNUR_ERR_NULL [sample - invalid distribution object: distr = unur_distr_discr_new(); ] unur_distr_cont_eval_pdf( 1., distr ); --> expected_INFINITY --> UNUR_ERR_DISTR_INVALID unur_distr_cont_eval_dpdf( 1., distr ); --> expected_INFINITY --> UNUR_ERR_DISTR_INVALID unur_distr_cont_eval_logpdf( 1., distr ); --> expected_INFINITY --> UNUR_ERR_DISTR_INVALID unur_distr_cont_eval_dlogpdf( 1., distr ); --> expected_INFINITY --> UNUR_ERR_DISTR_INVALID unur_distr_cont_eval_cdf( 1., distr ); --> expected_INFINITY --> UNUR_ERR_DISTR_INVALID unur_distr_cont_eval_invcdf( 0.5, distr ); --> expected_INFINITY --> UNUR_ERR_DISTR_INVALID unur_distr_cont_eval_hr( 1., distr ); --> expected_INFINITY --> UNUR_ERR_DISTR_INVALID [sample - missing data: distr = unur_distr_cont_new(); ] unur_distr_cont_eval_pdf( 1., distr ); --> expected_INFINITY --> UNUR_ERR_DISTR_DATA unur_distr_cont_eval_dpdf( 1., distr ); --> expected_INFINITY --> UNUR_ERR_DISTR_DATA unur_distr_cont_eval_logpdf( 1., distr ); --> expected_INFINITY --> UNUR_ERR_DISTR_DATA unur_distr_cont_eval_dlogpdf( 1., distr ); --> expected_INFINITY --> UNUR_ERR_DISTR_DATA unur_distr_cont_eval_cdf( 1., distr ); --> expected_INFINITY --> UNUR_ERR_DISTR_DATA unur_distr_cont_eval_invcdf( 0.5, distr ); --> expected_INFINITY --> UNUR_ERR_DISTR_DATA unur_distr_cont_eval_hr( 1., distr ); --> expected_INFINITY --> UNUR_ERR_DISTR_DATA [sample - check for memory leaks: double x[] = { 1., 2., 3. }; distr = unur_distr_cont_new(); ] unur_distr_cont_set_pdfparams_vec( distr, 0, x, 3 ); --> none --> UNUR_SUCCESS ############################################################################# [validate] ## test wrapper functions [validate - generators:] # AROU without DARS par[0] = unur_arou_new(@distr@); unur_arou_set_usedars(par,0); # AROU, use dars par[1] = unur_arou_new(@distr@); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); # SROU (default) #par[2] = unur_srou_new(@distr@); # small squeeze / hat ratio par[2] = unur_srou_new(@distr@); #unur_arou_set_cpoints( par, 8, NULL ); #unur_arou_set_max_sqhratio(par,0.5); [validate - distributions:] ## distributions where PDF is computed from logPDF # beta fpm[0] = 3.; fpm[1] = 4.; distr[0] = unur_distr_beta_w_pdf_from_logpdf(fpm,2); # cauchy distr[1] = unur_distr_cauchy_w_pdf_from_logpdf(NULL,0); # cauchy fpm[0] = 3.; fpm[1] = 4.; distr[2] = unur_distr_cauchy_w_pdf_from_logpdf(fpm,2); # exponential distr[3] = unur_distr_exponential_w_pdf_from_logpdf(NULL,0); # exponential fpm[0] = 3.; fpm[1] = 4.; distr[4] = unur_distr_exponential_w_pdf_from_logpdf(fpm,2); # gamma fpm[0] = 1.; distr[5] = unur_distr_gamma_w_pdf_from_logpdf(fpm,1); # gamma fpm[0] = 1.; fpm[1] = 4.; distr[6] = unur_distr_gamma_w_pdf_from_logpdf(fpm,2); # gamma fpm[0] = 3.; distr[7] = unur_distr_gamma_w_pdf_from_logpdf(fpm,1); # gamma fpm[0] = 3.; fpm[1] = 4.; distr[8] = unur_distr_gamma_w_pdf_from_logpdf(fpm,2); # normal distr[9] = unur_distr_normal_w_pdf_from_logpdf(NULL,0); # normal fpm[0] = 3.; fpm[1] = 4.; distr[10] = unur_distr_normal_w_pdf_from_logpdf(fpm,2); # powerexponential fpm[0] = 5.; distr[11] = unur_distr_powerexponential_w_pdf_from_logpdf(fpm,1); # number of distributions: 12 [validate - test chi2:] # + ... pass test # 0 ... fail to initialize generator # - ... fail test # . ... do not run test # # ... comment # # generators: # [0] AROU without DARS # [1] AROU with DARS # [2] SROU # #gen [0] [1] [2] # distribution #--------------------------------------------- ## distributions where PDF is computed from logPDF <0> + + + # beta (3,4) <1> + + + # cauchy () <2> + + + # cauchy (3,4) <3> + + + # exponential () <4> + + + # exponential (3,4) x <5> + + + # gamma (1) x <6> + + + # gamma (1,4) x <7> + + + # gamma (3) <8> + + + # gamma (3,4) <9> + + + # normal () <10> + + + # normal (3,4) <11> + + + # powerexponential (5) [validate - verify hat:] # + ... pass test # ~ ... fail in at most 1% of samples # 0 ... fail to initialize generator # - ... fail test # . ... do not run test # # ... comment # # generators: # [0] AROU without DARS # [1] AROU with DARS # [2] SROU # #gen [0] [1] [2] # distribution #--------------------------------------------- ## distributions where PDF is computed from logPDF <0> + + + # beta (3,4) <1> + + + # cauchy () <2> + + + # cauchy (3,4) <3> + + + # exponential () <4> + + + # exponential (3,4) x <5> + + + # gamma (1) x <6> + + + # gamma (1,4) x <7> + + + # gamma (3) <8> + + + # gamma (3,4) <9> + + + # normal () <10> + + + # normal (3,4) <11> + + + # powerexponential (5) ############################################################################# ############################################################################# [verbatim] double pdf(double x ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return 1.; } double dpdf(double x ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return 1.; } double cdf(double x ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return 1.; } double invcdf(double x ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return 1.; } double hr(double x ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return 1.; } ## work-around for missing functions int unur_distr_cont_set_pedantic(UNUR_PAR *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) { return UNUR_FAILURE; } int unur_distr_cont_chg_verify(UNUR_GEN *gen, int verify) { if (unur_arou_chg_verify(gen,verify)==UNUR_SUCCESS) return UNUR_SUCCESS; if (unur_srou_chg_verify(gen,verify)==UNUR_SUCCESS) return UNUR_SUCCESS; return UNUR_FAILURE; } ############################################################################# unuran-1.11.0/tests/t_pinv.c0000644001357500135600000015543014430713513012653 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for PINV **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); int unur_pinv_set_verify( UNUR_PAR *par, int verify); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* header files */ #include /* -- which tests for u-error should be performed (for development) -- */ #define DEVEL FALSE /* whether to run tests in development mode */ #define ALL TRUE /* Remark: Setting ALL to FALSE is useful if a only a single validation test should be run. Thus the "if(ALL)" condition for that particular test has to be replaced by "if(TRUE)". */ #define UERROR_STANDARDDIST TRUE #define UERROR_QUASIPDF TRUE #define UERROR_VANISHINGPDF TRUE #define UERROR_TRUNCATED TRUE #define UERROR_UNBOUNDEDPDF TRUE #define UERROR_MULTIMODAL TRUE #define UERROR_MULTIMODAL_VANISHINGPDF TRUE /* orders */ static int UERROR_ORDER_MIN = 3; static int UERROR_ORDER_MAX = 17; static int UERROR_ORDER_STEP = 1; /* smoothness */ static int SMOOTHNESS_MAX = 2; /* u-resolutions */ static double UERROR_URESOLUTION_MAX = 1.e-8; static double UERROR_URESOLUTION_MIN = 0.99e-13; static double UERROR_URESOLUTION_STEP = 0.1; /* we run all tests only in 'fullcheck' mode */ #define set_uerror_tests() \ if (!fullcheck) { \ /* UERROR_ORDER_STEP = 3; */ \ UERROR_URESOLUTION_MAX = 1.e-8; \ UERROR_URESOLUTION_MIN = 0.99e-12; \ UERROR_URESOLUTION_STEP = 0.01; \ } /* see also SKIPORDER in routine pinv_error_experiment() below */ /* sample size */ static const int UERROR_SAMPLESIZE = 100000; /* -- constants -- */ #define COMPARE_SAMPLE_SIZE (500) #define VIOLATE_SAMPLE_SIZE (20) /* #define SEED (298346) */ #ifndef M_PI #define M_PI 3.14159265358979323846264338328 /* pi */ #endif /* -- macros -- */ #define set_debug_flag(par) \ do { \ if (fullcheck) unur_set_debug((par),~0u); \ else unur_set_debug((par),0x00010000u); \ } while (0); /* -- prototypes -- */ int pinv_error_experiment( UNUR_PAR *par, int samplesize, int UERROR_PDF, int UERROR_CDF); int pinv_error_gen_experiment( UNUR_GEN *gen, double u_resolution, int order, int samplesize ); double neg_exponential_cdf( double x, const UNUR_DISTR *distr ); double neg_exponential_pdf( double x, const UNUR_DISTR *distr ); double neg_exponential_1_cdf( double x, const UNUR_DISTR *distr ); double neg_exponential_1_pdf( double x, const UNUR_DISTR *distr ); double sin_2_cdf( double x, const UNUR_DISTR *distr ); double sin_2_pdf( double x, const UNUR_DISTR *distr ); double sin_10_cdf( double x, const UNUR_DISTR *distr ); double sin_10_pdf( double x, const UNUR_DISTR *distr ); /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ /*****************************************************************************/ /* run unur_test_u_error for a particular generator object and print result */ int pinv_error_gen_experiment( UNUR_GEN *gen, /* generator object */ double u_resolution, /* maximal tolerated u-error */ int order, /* order of polynomial */ int samplesize ) /* sample size for error experiment */ /* returns 0 if maxerror < u_resolution, errorcode otherwise */ { int i, nfpar; const double *fpar; const UNUR_DISTR *distr; const char *genid; int score; /* check for invalid NULL pointer */ if (gen==NULL) { fprintf(TESTLOG,"\n--setup failed !! --\n"); printf("(!!+)"); fflush(stdout); return 100; } /* get data about generator object */ distr = unur_get_distr(gen); genid = unur_get_genid(gen); /* print data about distribution */ fprintf(TESTLOG,"%s: %s distribution",genid,unur_distr_get_name(distr)); nfpar = unur_distr_cont_get_pdfparams(distr,&fpar); if (nfpar) { fprintf(TESTLOG," with parameters "); for(i=0;i 0) { fprintf(TESTLOG,"\t#PDF calls = %d\t(per interval = %d)", get_counter_pdf(), ( (unur_pinv_get_n_intervals(gen)!=0) ? get_counter_pdf() / unur_pinv_get_n_intervals(gen) : -1 ) ); } if (get_counter_logpdf() > 0) { fprintf(TESTLOG,"\t#logPDF calls = %d\t(per interval = %d)", get_counter_logpdf(), ( (unur_pinv_get_n_intervals(gen)!=0) ? get_counter_logpdf() / unur_pinv_get_n_intervals(gen) : -1 ) ); } if (get_counter_cdf() > 0) { fprintf(TESTLOG,"\t#CDF calls = %d\t(per interval = %d)", get_counter_cdf(), ( (unur_pinv_get_n_intervals(gen)!=0) ? get_counter_cdf() / unur_pinv_get_n_intervals(gen) : -1 ) ); } fprintf(TESTLOG,"\n"); /* run test */ score = run_validate_u_error( TESTLOG, gen, distr, u_resolution, samplesize ); /* return score */ fprintf(TESTLOG,"\n"); fflush(TESTLOG); return score; } /* end of pinv_error_gen_experiment() */ /*****************************************************************************/ /* run experiment for a particular distribution object */ int pinv_error_experiment( UNUR_PAR *par, /* parameter object */ int samplesize, /* samplesize for error experiment */ int UERROR_PDF, /* if TRUE, check variant usePDF */ int UERROR_CDF) /* if TRUE, check variant useCDF */ /* returns 0 if maxerror < u_resolution, errorcode otherwise */ { UNUR_PAR *par_clone; /* working copy of parameter object */ UNUR_GEN *gen; /* generator object */ int order = 3; int smooth = 0; double u_resolution = 1.e-8; /* maximal tolerated u-error */ int errorsum = 0; int variant; /* check for invalid NULL pointer */ if (par==NULL) { printf(" NULL! "); return 1000; } /* -- loop smoothness -- */ for (smooth=0; smooth <= SMOOTHNESS_MAX; smooth++) { /* -- loop variante -- */ for (variant=0; variant <= 1; ++variant) { /* variant==0 --> use PDF */ /* variant==1 --> use CDF */ switch (variant) { case 0: /* run variant PDF+Lobatto */ if (UERROR_PDF) printf("",smooth); else continue; break; case 1: /* run variant CDF */ if (UERROR_CDF) printf("",smooth); else continue; break; default: continue; } /* -- loop order -- */ for ( order=UERROR_ORDER_MIN; order<=UERROR_ORDER_MAX; order+=UERROR_ORDER_STEP) { /* prevent warning from invalid order */ if (smooth==1 && order % 2 != 1) continue; if (smooth==2 && order % 3 != 2) continue; /* SKIPORDER: * when we do not run in fullcheck mode, we skip some orders. */ if (!fullcheck) { switch (smooth) { case 0: if (! (order==3 || order==5 || order==8 || order==12 || order==17) ) continue; break; case 1: if (order==7 || order==11 || order==15) continue; break; case 2: if (order == 14) continue; break; } } /* -- loop u-resolution -- */ for ( u_resolution = UERROR_URESOLUTION_MAX; u_resolution > UERROR_URESOLUTION_MIN; u_resolution *= UERROR_URESOLUTION_STEP ) { if (!fullcheck) { if (smooth==2 && u_resolution < 0.99e-10) /* setup fails for some truncated distributions. */ /* so we skip it when not run in fullcheck mode. */ continue; } /* make a working copy */ par_clone = _unur_par_clone(par); /* set variant */ switch (variant) { case 0: unur_pinv_set_usepdf(par_clone); break; case 1: unur_pinv_set_usecdf(par_clone); break; } /* maximum number of subintervals */ /**/ if (order <= 3 && u_resolution < 1.e-12) { unur_pinv_set_max_intervals(par_clone,100000); } else if (u_resolution < 1.e13) { unur_pinv_set_max_intervals(par_clone,100000); } /* start counter for PDF calls */ start_counter_fcalls(par_clone); /* create generator object */ unur_pinv_set_order(par_clone,order); unur_pinv_set_smoothness(par_clone,smooth); unur_pinv_set_u_resolution(par_clone,u_resolution); set_debug_flag(par_clone); gen = unur_init(par_clone); /* run test */ errorsum += pinv_error_gen_experiment(gen, u_resolution, order, samplesize); /* clear memory */ unur_free(gen); stop_counter_fcalls(); } /* -- end loop u-resolution -- */ } /* -- end end loop order -- */ } /* -- end loop variant */ } /* -- end loop smoothness -- */ unur_par_free(par); return errorsum; } /* end of pinv_error_experiment() */ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ /* "negative" exponential distribution */ /* */ /* / exp(x) if x <= 0 */ /* f(x) = < */ /* \ 0 otherwise */ /* */ double neg_exponential_pdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { if (x>0.) return 0.; else return (exp(x)); } double neg_exponential_cdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { if (x>0.) return 1.; else return (exp(x)); } /*---------------------------------------------------------------------------*/ /* "shifted negative" exponential distribution */ /* */ /* / exp(x-s) if x <= s */ /* f(x) = < */ /* \ 0 otherwise */ /* */ #define shift (-1.) double neg_exponential_1_pdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { x = x-shift; if (x>0.) return 0.; else return (exp(x)); } double neg_exponential_1_cdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { x = x-shift; if (x>=0.) return 1.; else return (exp(x)); } #undef shift /*---------------------------------------------------------------------------*/ /* */ /* / 0.05 + 0.45*(1 +sin(2 Pi x)) if |x| <= 1 */ /* f(x) = < */ /* \ 0 otherwise */ /* */ double sin_2_pdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { if (fabs(x) > 1.) return 0.; else return (0.05 + 0.45*(1.+sin(2.*M_PI*x))); } /* end of sin_pdf() */ /* The CDF of our distribution: */ double sin_2_cdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { if (x < -1.) return 0.; else if(x<=1.) return (0.05*(x+1) + 0.9*(1.+2.*M_PI*(1+x)-cos((2.*M_PI)*x))/(4.*M_PI)); else return 1.; } /* end of sin_cdf() */ /*---------------------------------------------------------------------------*/ /* */ /* / 0.05 + 0.45*(1 +sin(2 Pi x)) if |x| <= 5 */ /* f(x) = < */ /* \ 0 otherwise */ /* */ double sin_10_pdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { if (fabs(x) > 5.) return 0.; else return (0.05 + 0.45*(1.+sin(2.*M_PI*x))); } /* end of sin_pdf() */ /* The CDF of our distribution: */ double sin_10_cdf( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { if (x < -5.) return 0.; else if(x<=5.) return ((x/10.+0.5) + 0.09/(2*M_PI)*(cos(10*M_PI)-cos(2*M_PI*x))); else return 1.; } /* end of sin_cdf() */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,111,(unur_pinv_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,111,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,117,(unur_pinv_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,117,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* data missing in distribution object */ UNUR_DISTR *distr = NULL; distr = unur_distr_cont_new(); unur_reset_errno(); /* pdf */ n_tests_failed += (check_expected_NULL(TESTLOG,124,(unur_pinv_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,124,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [set] */ void test_set (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[set "); fflush(stdout); fprintf(TESTLOG,"\n[set]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; /* double stp[] = {1.,2.,3.}; */ par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,135,(unur_pinv_set_order( par, 3 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,135,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,138,(unur_pinv_set_smoothness( par, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,138,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,141,(unur_pinv_set_u_resolution( par, 1.e-8 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,141,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,144,(unur_pinv_set_use_upoints( par, TRUE )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,144,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,147,(unur_pinv_set_usepdf( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,147,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,150,(unur_pinv_set_usecdf( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,150,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,153,(unur_pinv_set_boundary(par,1.,3.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,153,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,156,(unur_pinv_set_searchboundary(par, TRUE, TRUE )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,156,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,159,(unur_pinv_set_max_intervals(par,1000)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,159,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,162,(unur_pinv_set_extra_testpoints(par,10)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,162,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,165,(unur_pinv_set_keepcdf(par,TRUE)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,165,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* invalid parameter object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; /* double stp[] = {1.,2.,3.}; */ distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,174,(unur_pinv_set_order( par, 3 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,174,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,177,(unur_pinv_set_smoothness( par, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,177,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,180,(unur_pinv_set_u_resolution( par, 1.e-8 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,180,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,183,(unur_pinv_set_use_upoints( par, TRUE )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,183,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,186,(unur_pinv_set_usepdf( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,186,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,189,(unur_pinv_set_usecdf( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,189,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,192,(unur_pinv_set_boundary(par,1.,3.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,192,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,195,(unur_pinv_set_searchboundary(par, TRUE, TRUE )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,195,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,198,(unur_pinv_set_max_intervals(par,1000)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,198,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,201,(unur_pinv_set_extra_testpoints(par,10)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,201,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,204,(unur_pinv_set_keepcdf(par,TRUE)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,204,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = unur_distr_normal(NULL,0); par = unur_pinv_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,214,(unur_pinv_set_order( par, 30 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,214,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,217,(unur_pinv_set_order( par, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,217,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,220,(unur_pinv_set_smoothness( par, 4 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,220,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,223,(unur_pinv_set_boundary(par,1.,-3.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,223,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,226,(unur_pinv_set_boundary(par,1.,UNUR_INFINITY)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,226,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,229,(unur_pinv_set_max_intervals(par,1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,229,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,232,(unur_pinv_set_max_intervals(par,10000000)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,232,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,235,(unur_pinv_set_extra_testpoints(par,-1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,235,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; UNUR_PAR *par; UNUR_GEN *gen; distr = unur_distr_normal(NULL,0); unur_reset_errno(); par = unur_pinv_new(distr); unur_pinv_set_order( par, 4 ); unur_pinv_set_smoothness( par, 1 ); gen = unur_init(par); n_tests_failed += (check_errorcode(TESTLOG,249,UNUR_ERR_GENERIC)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); par = unur_pinv_new(distr); unur_pinv_set_order( par, 4 ); unur_pinv_set_smoothness( par, 2 ); gen = unur_init(par); n_tests_failed += (check_errorcode(TESTLOG,256,UNUR_ERR_GENERIC)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); par = unur_pinv_new(distr); unur_pinv_set_order( par, 6 ); unur_pinv_set_smoothness( par, 2 ); gen = unur_init(par); n_tests_failed += (check_errorcode(TESTLOG,263,UNUR_ERR_GENERIC)==UNUR_SUCCESS)?0:1; unur_free(gen); unur_distr_free(distr); } { /* missing CDF */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr, neg_exponential_pdf); par = unur_pinv_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,274,(unur_pinv_set_usecdf( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,274,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } { /* missing PDF */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = unur_distr_cont_new(); unur_distr_cont_set_cdf(distr, neg_exponential_cdf); par = unur_pinv_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,285,(unur_pinv_set_usepdf( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,285,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } { /* missing PDF */ UNUR_DISTR *distr = NULL; UNUR_PAR *par; UNUR_GEN *gen; distr = unur_distr_cont_new(); unur_distr_cont_set_cdf(distr, neg_exponential_cdf); unur_reset_errno(); par = unur_pinv_new(distr); unur_pinv_set_usecdf( par ); unur_pinv_set_smoothness( par, 1 ); gen = unur_init(par); n_tests_failed += (check_errorcode(TESTLOG,300,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); par = unur_pinv_new(distr); unur_pinv_set_usecdf( par ); unur_pinv_set_smoothness( par, 2 ); gen = unur_init(par); n_tests_failed += (check_errorcode(TESTLOG,307,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); unur_distr_cont_set_pdf(distr, neg_exponential_pdf); par = unur_pinv_new(distr); unur_pinv_set_usecdf( par ); unur_pinv_set_smoothness( par, 2 ); gen = unur_init(par); n_tests_failed += (check_errorcode(TESTLOG,315,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_free(gen); unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_set() */ /*---------------------------------------------------------------------------*/ /* [get] */ void test_get (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[get "); fflush(stdout); fprintf(TESTLOG,"\n[get]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid generator object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_srou_new(distr); gen = unur_init(par); abort_if_NULL(TESTLOG, 326, gen ); unur_reset_errno(); n_tests_failed += (check_expected_zero(TESTLOG,330,(unur_pinv_get_n_intervals(gen)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,330,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_get() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_GEN *gen = NULL; gen = NULL; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,361,(unur_pinv_eval_approxinvcdf(gen,0.5)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,361,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_free(gen); } { /* invalid generator object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_srou_new(distr); gen = unur_init(par); abort_if_NULL(TESTLOG, 367, gen ); unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,371,(unur_pinv_eval_approxinvcdf(gen,0.5)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,371,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* invalid domain */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_pinv_new(distr); unur_set_debug(par,0); gen = unur_init( par ); abort_if_NULL(TESTLOG, 377, gen ); unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,381,(unur_pinv_eval_approxinvcdf(gen,1.5)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,381,UNUR_ERR_DOMAIN)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_negINFINITY(TESTLOG,384,(unur_pinv_eval_approxinvcdf(gen,-0.5)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,384,UNUR_ERR_DOMAIN)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* cdf table removed */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_pinv_new(distr); unur_set_debug(par,0); gen = unur_init( par ); abort_if_NULL(TESTLOG, 391, gen ); unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,395,(unur_pinv_eval_approxcdf(gen,1.5)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,395,UNUR_ERR_GENERIC)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* check approximate cdf */ UNUR_GEN *gen = NULL; int i, cdffailed=0; double x,u,d; gen = unur_str2gen("cont;logpdf='5-x';domain=(0,infinity)&method=pinv;keepcdf=on;debug=0"); unur_reset_errno(); for (i=1; i<1000; i++) { x = 5.*i/1000.; u = unur_pinv_eval_approxcdf(gen,x); d = fabs(u - (1-exp(-x))); if (d > 1.e-11) { cdffailed = 1; }} n_tests_failed += (check_expected_zero(TESTLOG,410,(cdffailed))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,410,UNUR_SUCCESS)==UNUR_SUCCESS)?0:1; unur_free(gen); } { /* compare clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; UNUR_GEN *clone; distr = unur_distr_normal(NULL,0); par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_pinv_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,423,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,429,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare stringparser */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[] = {3.,4.}; distr = NULL; par = NULL; gen = NULL; unur_reset_errno(); distr = unur_distr_gamma(fpar,2); unur_distr_cont_set_domain(distr,2.,UNUR_INFINITY); par = unur_pinv_new(distr); set_debug_flag(par); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,461,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "gamma(3.,4.); domain = (2,infinity) & \ method = pinv; debug = 0x1" ); n_tests_failed += (compare_sequence_gen(TESTLOG,467,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; distr = unur_distr_normal(NULL,0); unur_distr_cont_set_domain(distr,2.,UNUR_INFINITY); par = unur_pinv_new(distr); unur_pinv_set_order(par,10); unur_pinv_set_u_resolution(par,1.e-6); unur_pinv_set_boundary(par,1.,1000.); unur_pinv_set_max_intervals(par,1000); set_debug_flag(par); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,480,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "normal; domain = (2,inf) & \ method = pinv; order = 10; u_resolution = 1.e-6; \ boundary = (1,1000); max_intervals = 1000; debug = 0x1" ); n_tests_failed += (compare_sequence_gen(TESTLOG,487,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* [validate] */ /*---------------------------------------------------------------------------*/ /* [validate] */ void test_validate (void) { /* suppress GCC compiler warning */ GCC_DIAG_OFF(unused-variable) UNUR_DISTR *distr[6]; UNUR_PAR *par; UNUR_GEN *gen; double *darray; double fpm[10]; int n_tests_failed; int rcode; /* start test */ printf("[validate "); fflush(stdout); fprintf(TESTLOG,"\n[validate]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* distributions: 6 */ { distr[0] = unur_distr_normal(NULL,0); } { distr[1] = unur_distr_multPDF( distr[0], 100. ); } { distr[2] = unur_str2distr( "cont; pdf='x/(1+x*x*x*x)'; center=1" ); } { distr[3] = unur_str2distr( "cont; pdf='-x/(1+x*x*x*x)'; center=-1" ); } { distr[4] = unur_str2distr( "cont; pdf='cos(2*x)'; cdf='(1+sin(2*x))/2'; center=0; domain=(-0.7853981633974482, 0.7853981633974482)" ); } { distr[5] = unur_str2distr( "cont; pdf='1-x^2+1e-16'; cdf='( 2-(x^2-3)*x) / 4'; center=0; domain=(-1, 1)" ); } /* timing */ stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); printf("\n(chi^2) "); fflush(stdout); /* chi^2 tests: 6 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nChi^2 Test:\n"); /* distribution [0] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_pinv_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_pinv_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [2] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_pinv_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [3] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_pinv_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [4] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_pinv_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [5] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_pinv_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); /* free distributions */ unur_distr_free(distr[0]); unur_distr_free(distr[1]); unur_distr_free(distr[2]); unur_distr_free(distr[3]); unur_distr_free(distr[4]); unur_distr_free(distr[5]); /* test finished */ test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; /* we accept CHI2_FAILURES_TOLERATED failures */ (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_validate */ /* enable GCC compiler warning */ GCC_DIAG_ON(unused-variable) /*---------------------------------------------------------------------------*/ /* [special] */ void test_special (void) { /* set boolean to FALSE */ int FAILED = 0; int samplesize = UERROR_SAMPLESIZE; int errorsum = 0; double fpar[4]; UNUR_DISTR *distr, *qdistr; UNUR_PAR *par; /* start test */ printf("[special "); fflush(stdout); fprintf(TESTLOG,"\n[special]\n"); /* set stop watch */ stopwatch_lap(&watch); /* set u-error tests */ set_uerror_tests(); /* test for maximal u-error */ printf("\n[test maximal u-error]"); fprintf(TESTLOG,"\n* Test maximal u-error *\n"); if (UERROR_STANDARDDIST) { /* --------------------------- */ printf("\nStandard distributions:\n"); fprintf(TESTLOG,"\n--- Standard distributions --- \n\n"); if (ALL) { printf(" normal"); distr = unur_distr_normal(NULL,0); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } if (ALL) { printf(" cauchy"); distr = unur_distr_cauchy(NULL,0); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } if (ALL) { printf(" exponential"); distr = unur_distr_exponential(NULL,0); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } if (ALL) { printf(" gamma(0.9)"); fpar[0] = 0.9; distr = unur_distr_gamma(fpar,1); unur_distr_cont_set_center(distr,1.); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } if (ALL) { printf(" gamma(1.02)"); fpar[0] = 1.02; distr = unur_distr_gamma(fpar,1); unur_distr_cont_set_center(distr,1.); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } if (ALL) { printf(" gamma(1.5)"); fpar[0] = 1.5; distr = unur_distr_gamma(fpar,1); unur_distr_cont_set_center(distr,1.); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } if (ALL) { printf(" gamma(2)"); fpar[0] = 2.; distr = unur_distr_gamma(fpar,1); unur_distr_cont_set_center(distr,1.); par = unur_pinv_new(distr); unur_pinv_set_boundary(par,0., 1.e100); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } if (ALL) { printf(" gamma(5)"); fpar[0] = 5.; distr = unur_distr_gamma(fpar,1); unur_distr_cont_set_center(distr,1.); par = unur_pinv_new(distr); unur_pinv_set_boundary(par,0., 1.e100); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } if (ALL) { printf(" beta(2,3)"); fpar[0] = 2; fpar[1] = 3; distr = unur_distr_beta(fpar,2); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } if (ALL) { printf(" Gumbel"); distr = unur_distr_extremeI(NULL,0); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } if (ALL) { printf(" shifted normal"); fpar[0] = 200.; fpar[1] = 1.; distr = unur_distr_normal(fpar,2); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); printf(" shifted normal"); fpar[0] = -200; fpar[1] = 1.; distr = unur_distr_normal(fpar,2); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } if (0) { printf(" lognormal(2,0.5)"); fpar[0] = 2.; fpar[1] = 0.5; distr = unur_distr_lognormal(fpar,2); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); printf(" lognormal(2.0.5,4.)"); fpar[0] = 2.; fpar[1] = 0.5; fpar[2] = 4.; distr = unur_distr_lognormal(fpar,3); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } } /* endif (UERROR_STANDARDDIST) */ if (UERROR_QUASIPDF) { /* --------------------------- */ printf("\nDistributions with quasi-densities:\n"); fprintf(TESTLOG,"\n--- Distributions with quasi-densities --- \n\n"); if (ALL) { distr = unur_distr_normal(NULL,0); printf(" (normal*1e10)"); qdistr = unur_distr_multPDF( distr, 1.e10 ); par = unur_pinv_new(qdistr); errorsum += pinv_error_experiment(par,samplesize,TRUE, DEVEL); unur_distr_free(qdistr); fprintf(TESTLOG,"\n"); printf(" (normal*1e-10)"); qdistr = unur_distr_multPDF( distr, 1.e-10 ); par = unur_pinv_new(qdistr); errorsum += pinv_error_experiment(par,samplesize,TRUE, DEVEL); unur_distr_free(qdistr); fprintf(TESTLOG,"\n"); unur_distr_free(distr); } } /* endif (UERROR_QUASIPDF) */ if (UERROR_VANISHINGPDF) { /* --------------------------- */ printf("\nDistributions with vanishing PDF:\n"); fprintf(TESTLOG,"\n--- Distributions with vanishing PDF --- \n\n"); if (ALL) { printf(" (exponential_on_(-oo,oo))"); distr = unur_distr_exponential(NULL,0); unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); unur_distr_set_name(distr,"exponential_(-oo,oo)"); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } if (ALL) { printf(" (exponential(1,1)_on_(-oo,oo))"); fpar[0] = 1.; fpar[1] = 1.; distr = unur_distr_exponential(fpar,2); unur_distr_cont_set_center(distr,2.); unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); unur_distr_set_name(distr,"exponential(1,1)_(-oo,oo)"); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } if (ALL) { printf(" (exponential(1,1)_on_(-oo,oo))"); fpar[0] = 1.; fpar[1] = 1.; distr = unur_distr_exponential(fpar,2); unur_distr_cont_set_center(distr,2.); unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); unur_distr_cont_set_center(distr,2.); unur_distr_set_name(distr,"exponential(1,1)_(-oo,oo)"); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } if (ALL) { printf(" (exponential(1,-1)_on_(-oo,oo))"); fpar[0] = 1.; fpar[1] = -1.; distr = unur_distr_exponential(fpar,2); unur_distr_cont_set_center(distr,2.); unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); unur_distr_set_name(distr,"exponential(1,-1)_(-oo,oo)"); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } if (ALL) { printf(" (exponential(0.1,0.1)_on_(-oo,oo))"); fpar[0] = 0.1; fpar[1] = 0.1; distr = unur_distr_exponential(fpar,2); unur_distr_cont_set_center(distr,2.); unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); unur_distr_set_name(distr,"exponential(0.1,0.1)_(-oo,oo)"); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } if (ALL) { printf(" (exponential(1000,1000)_on_(-oo,oo))"); fpar[0] = 1000; fpar[1] = 1000; distr = unur_distr_exponential(fpar,2); unur_distr_cont_set_center(distr,1000.); unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); unur_distr_set_name(distr,"exponential(1000,1000)_(-oo,oo)"); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } if (ALL) { printf(" neg_exponential"); distr = unur_distr_cont_new(); unur_distr_set_name(distr,"neg_exponential"); unur_distr_cont_set_cdf( distr, neg_exponential_cdf ); unur_distr_cont_set_pdf( distr, neg_exponential_pdf ); unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } if (ALL) { printf(" neg_exponential_1"); distr = unur_distr_cont_new(); unur_distr_set_name(distr,"neg_exponential_1"); unur_distr_cont_set_cdf( distr, neg_exponential_1_cdf ); unur_distr_cont_set_pdf( distr, neg_exponential_1_pdf ); unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); unur_distr_cont_set_center(distr,-2.); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } if (ALL) { printf(" gamma(2)"); fpar[0] = 2.; distr = unur_distr_gamma(fpar,1); unur_distr_cont_set_center(distr,1.); unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); par = unur_pinv_new(distr); unur_pinv_set_boundary(par,0., 1.e100); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } if (ALL) { printf(" gamma(5)"); fpar[0] = 5.; distr = unur_distr_gamma(fpar,1); unur_distr_cont_set_center(distr,1.); unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); par = unur_pinv_new(distr); unur_pinv_set_boundary(par,0., 1.e100); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } if (ALL) { printf(" gamma(1.02)"); fpar[0] = 1.02; distr = unur_distr_gamma(fpar,1); unur_distr_cont_set_center(distr,1.); unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } } /* endif (UERROR_VANISHINGPDF) */ if (UERROR_TRUNCATED) { /* --------------------------- */ printf("\nTruncated Distributions:\n"); fprintf(TESTLOG,"\n--- Truncated Distributions --- \n\n"); if (ALL) { printf(" truncated normal[3,inf]"); distr = unur_distr_normal(NULL,0); unur_distr_cont_set_domain(distr,3.,UNUR_INFINITY); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } if (ALL && DEVEL) { printf(" truncated normal[15,inf]"); distr = unur_distr_normal(NULL,0); unur_distr_cont_set_domain(distr,15.,UNUR_INFINITY); par = unur_pinv_new(distr); /* using CDF does not work here. */ errorsum += pinv_error_experiment(par,samplesize,TRUE, DEVEL); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } } /* endif (UERROR_TRUNCATED) */ if (UERROR_UNBOUNDEDPDF) { /* --------------------------- */ printf("\nDistributions with unbounded PDF:\n"); fprintf(TESTLOG,"\n--- Distributions with unbounded PDF --- \n\n"); if (ALL) { printf(" gamma(0.2)"); fpar[0] = 0.2; distr = unur_distr_gamma(fpar,1); unur_distr_cont_set_center(distr,1.); par = unur_pinv_new(distr); unur_pinv_set_extra_testpoints(par,50); errorsum += pinv_error_experiment(par,samplesize,TRUE, DEVEL); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } if (ALL) { printf(" gamma(0.5)"); fpar[0] = 0.5; distr = unur_distr_gamma(fpar,1); unur_distr_cont_set_center(distr,1.); par = unur_pinv_new(distr); unur_pinv_set_extra_testpoints(par,40); errorsum += pinv_error_experiment(par,samplesize,TRUE, DEVEL); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } } /* endif (UERROR_UNBOUNDEDPDF) */ if (UERROR_MULTIMODAL) { /* --------------------------- */ printf("\nMultimodal distributions:\n"); fprintf(TESTLOG,"\n--- Multimodal distributions --- \n\n"); if (ALL) { printf(" sin-2-example"); distr = unur_distr_cont_new(); unur_distr_set_name(distr,"sin-2-example"); unur_distr_cont_set_cdf( distr, sin_2_cdf ); unur_distr_cont_set_pdf( distr, sin_2_pdf ); unur_distr_cont_set_domain( distr, -1., 1. ); unur_distr_cont_set_center(distr,0.25); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } if (ALL) { printf(" sin-10-example"); distr = unur_distr_cont_new(); unur_distr_set_name(distr,"sin-10-example"); unur_distr_cont_set_cdf( distr, sin_10_cdf ); unur_distr_cont_set_pdf( distr, sin_10_pdf ); unur_distr_cont_set_domain( distr, -5., 5. ); unur_distr_cont_set_center(distr,0.25); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE, DEVEL); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } } /* endif (UERROR_MULTIMODAL) */ if (UERROR_MULTIMODAL_VANISHINGPDF) { /* --------------------------- */ printf("\nMultimodal distributions with vanishing PDF:\n"); fprintf(TESTLOG,"\n--- Multimodal distributions with vanishing PDF --- \n\n"); if (ALL) { printf(" sin-2-example");fflush(stdout); distr = unur_distr_cont_new(); unur_distr_set_name(distr,"sin-0-example"); unur_distr_cont_set_cdf( distr, sin_2_cdf ); unur_distr_cont_set_pdf( distr, sin_2_pdf ); unur_distr_cont_set_domain( distr, -2., 2. ); unur_distr_cont_set_center(distr,0.25); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } if (ALL) { printf(" sin-2-example");fflush(stdout); distr = unur_distr_cont_new(); unur_distr_set_name(distr,"sin-0-example"); unur_distr_cont_set_cdf( distr, sin_2_cdf ); unur_distr_cont_set_pdf( distr, sin_2_pdf ); unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); unur_distr_cont_set_center(distr,0.25); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE,TRUE); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } if (ALL) { printf(" sin-10-example"); distr = unur_distr_cont_new(); unur_distr_set_name(distr,"sin-10-example"); unur_distr_cont_set_cdf( distr, sin_10_cdf ); unur_distr_cont_set_pdf( distr, sin_10_pdf ); unur_distr_cont_set_domain(distr,-UNUR_INFINITY,UNUR_INFINITY); unur_distr_cont_set_center(distr,0.25); par = unur_pinv_new(distr); errorsum += pinv_error_experiment(par,samplesize,TRUE, DEVEL); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } } /* endif (UERROR_MULTIMODAL_VANISHINGPDF) */ /*---------------------------------------------------------------------------*/ /* test finished */ FAILED = (errorsum < 2) ? 0 : 1; /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (FAILED) ? 0 : 1; (FAILED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_special() */ /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_pinv_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_tabl.c0000644001357500135600000067723014430713513012630 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for TABL **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ double pdf( double x, UNUR_DISTR *distr ); double pdf_negative( double x, const UNUR_DISTR *distr ); double pdf_partnegative( double x, const UNUR_DISTR *distr ); #define COMPARE_SAMPLE_SIZE (10000) #define VIOLATE_SAMPLE_SIZE (20) /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ /* pdf with negative value */ double pdf_negative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return (-x*x); } /* pdf with partial negative value */ double pdf_partnegative( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return ((x>-0.89 && x<0.89) ? -1.: exp(-x*x)); } /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,29,(unur_tabl_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,29,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,35,(unur_tabl_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,35,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* data missing in distribution object */ UNUR_DISTR *distr = NULL; distr = unur_distr_cont_new(); unur_reset_errno(); /* pdf */ n_tests_failed += (check_expected_NULL(TESTLOG,42,(unur_tabl_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,42,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [set] */ void test_set (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[set "); fflush(stdout); fprintf(TESTLOG,"\n[set]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; double slopes[2] = {0.,1.}; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,53,(unur_tabl_set_cpoints( par, 0, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,53,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,56,(unur_tabl_set_useear( par, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,56,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,59,(unur_tabl_set_usedars( par, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,59,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,62,(unur_tabl_set_darsfactor( par, 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,62,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,65,(unur_tabl_set_variant_splitmode( par, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,65,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,68,(unur_tabl_set_areafraction( par, 0.2 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,68,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,71,(unur_tabl_set_nstp( par, 30 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,71,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,74,(unur_tabl_set_slopes( par, slopes, 2 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,74,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,77,(unur_tabl_set_boundary( par, 0.,1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,77,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,80,(unur_tabl_set_guidefactor( par, 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,80,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,83,(unur_tabl_set_max_sqhratio( par, 0.95 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,83,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,86,(unur_tabl_set_max_intervals( par, 100 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,86,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,89,(unur_tabl_set_verify( par, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,89,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,92,(unur_tabl_set_pedantic( par, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,92,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,95,(unur_tabl_set_variant_ia( par, TRUE )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,95,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* invalid parameter object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double fpar[2] = {0.,1.}; double slopes[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_arou_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,105,(unur_tabl_set_cpoints( par, 0, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,105,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,108,(unur_tabl_set_useear( par, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,108,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,111,(unur_tabl_set_usedars( par, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,111,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,114,(unur_tabl_set_darsfactor( par, -1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,114,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,117,(unur_tabl_set_variant_splitmode( par, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,117,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,120,(unur_tabl_set_areafraction( par, 0.2 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,120,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,123,(unur_tabl_set_nstp( par, 30 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,123,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,126,(unur_tabl_set_slopes( par, slopes, 2 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,126,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,129,(unur_tabl_set_boundary( par, 0.,1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,129,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,132,(unur_tabl_set_guidefactor( par, 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,132,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,135,(unur_tabl_set_max_sqhratio( par, 0.95 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,135,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,138,(unur_tabl_set_max_intervals( par, 100 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,138,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,141,(unur_tabl_set_verify( par, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,141,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,144,(unur_tabl_set_pedantic( par, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,144,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,147,(unur_tabl_set_variant_ia( par, TRUE )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,147,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double slopesA[4] = {0.,1.,0.5,2.}; double slopesB[4] = {1.,2.,0.,1.}; double stp[] = {1.,0.,1.}; int n_stp = 3; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_tabl_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,162,(unur_tabl_set_cpoints( par, -1, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,162,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,165,(unur_tabl_set_cpoints( par, n_stp, stp )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,165,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,168,(unur_tabl_set_variant_splitmode( par, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,168,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,171,(unur_tabl_set_variant_splitmode( par, 4 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,171,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,174,(unur_tabl_set_areafraction( par, -0.1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,174,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,177,(unur_tabl_set_nstp( par, -1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,177,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,180,(unur_tabl_set_slopes( par, slopesA, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,180,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,183,(unur_tabl_set_slopes( par, slopesA, 4 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,183,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,186,(unur_tabl_set_slopes( par, slopesB, 4 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,186,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,189,(unur_tabl_set_boundary( par, 2., 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,189,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,192,(unur_tabl_set_boundary( par, 0., UNUR_INFINITY )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,192,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,195,(unur_tabl_set_boundary( par, -UNUR_INFINITY, 0. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,195,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,198,(unur_tabl_set_guidefactor( par, -0.1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,198,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,201,(unur_tabl_set_max_sqhratio( par, -0.1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,201,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,204,(unur_tabl_set_max_sqhratio( par, 1.1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,204,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,207,(unur_tabl_set_max_intervals( par, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,207,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_set() */ /*---------------------------------------------------------------------------*/ /* [get] */ void test_get (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[get "); fflush(stdout); fprintf(TESTLOG,"\n[get]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_GEN *gen = NULL; gen = NULL; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,219,(unur_tabl_get_sqhratio(gen)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,219,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,222,(unur_tabl_get_hatarea(gen)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,222,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,225,(unur_tabl_get_squeezearea(gen)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,225,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_zero(TESTLOG,228,(unur_tabl_get_n_intervals(gen)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,228,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_free(gen); } { /* invalid generator object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); gen = unur_init(par); abort_if_NULL(TESTLOG, 233, gen ); unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,237,(unur_tabl_get_sqhratio(gen)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,237,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,240,(unur_tabl_get_hatarea(gen)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,240,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,243,(unur_tabl_get_squeezearea(gen)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,243,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_zero(TESTLOG,246,(unur_tabl_get_n_intervals(gen)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,246,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_get() */ /*---------------------------------------------------------------------------*/ /* [chg] */ void test_chg (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[chg "); fflush(stdout); fprintf(TESTLOG,"\n[chg]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid generator object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_arou_new(distr); unur_set_debug(par,0); gen = unur_init( par ); abort_if_NULL(TESTLOG, 257, gen ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,261,(unur_tabl_chg_verify(gen,1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,261,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_chg() */ /*---------------------------------------------------------------------------*/ /* [init] */ void test_init (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[init "); fflush(stdout); fprintf(TESTLOG,"\n[init]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,272,(unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,272,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* wrong mode */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = unur_distr_normal(NULL,0); par = NULL; unur_reset_errno(); unur_distr_cont_set_mode(distr,-1.); par = unur_tabl_new(distr); n_tests_failed += (check_expected_NULL(TESTLOG,281,(unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,281,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_distr_cont_set_mode(distr,1.); par = unur_tabl_new(distr); n_tests_failed += (check_expected_NULL(TESTLOG,286,(unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,286,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* negative value of pdf */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr,pdf_negative); par = NULL; unur_reset_errno(); par = unur_tabl_new(distr); n_tests_failed += (check_expected_NULL(TESTLOG,295,(unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,295,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_distr_cont_set_domain(distr,-2.,2.); par = unur_tabl_new(distr); n_tests_failed += (check_expected_NULL(TESTLOG,300,(unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,300,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_init() */ /*---------------------------------------------------------------------------*/ /* [reinit] */ void test_reinit (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[reinit "); fflush(stdout); fprintf(TESTLOG,"\n[reinit]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* does not exist */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_tabl_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 309, gen ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,313,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,313,UNUR_ERR_NO_REINIT)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,316,(unur_sample_cont( gen )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,316,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_reinit() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* compare */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = unur_distr_normal(NULL,0); par = NULL; unur_reset_errno(); par = unur_tabl_new(distr); n_tests_failed += (compare_sequence_par_start(TESTLOG,328,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); par = unur_tabl_new(distr); unur_tabl_set_verify(par,1); n_tests_failed += (compare_sequence_par(TESTLOG,333,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); par = unur_tabl_new(distr); unur_tabl_set_variant_ia(par,FALSE); n_tests_failed += (compare_sequence_par_start(TESTLOG,338,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); par = unur_tabl_new(distr); unur_tabl_set_variant_ia(par,FALSE); unur_tabl_set_verify(par,1); n_tests_failed += (compare_sequence_par(TESTLOG,344,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* compare clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; UNUR_GEN *clone; distr = unur_distr_normal(NULL,0); par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_tabl_new(distr); unur_tabl_set_max_sqhratio(par,0.); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,358,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,364,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare stringparser */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[2] = {3.,3.}; double slopes[] = {0.5,-1,0.5,1}; distr = NULL; par = NULL; gen = NULL; unur_reset_errno(); distr = unur_distr_beta(fpar,2); par = unur_tabl_new(distr); unur_tabl_set_areafraction(par,0.25); unur_tabl_set_boundary(par,0.1,0.9); unur_tabl_set_guidefactor(par,5.); unur_tabl_set_max_intervals(par,50); unur_tabl_set_max_sqhratio(par,0.8); unur_tabl_set_nstp(par,30); unur_tabl_set_usedars(par,0); unur_tabl_set_variant_splitmode(par,3); unur_tabl_set_verify(par,TRUE); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,387,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "beta(3.,3.) & \ method = tabl; areafraction = 0.25; boundary = (0.1,0.9); \ guidefactor = 5; max_intervals = 50; max_sqhratio = 0.8; \ nstp = 30; usedars = 0; variant_splitmode = 3; verify" ); n_tests_failed += (compare_sequence_gen(TESTLOG,395,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; distr = unur_distr_beta(fpar,2); par = unur_tabl_new(distr); unur_tabl_set_slopes(par,slopes,2); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,403,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "beta(3.,3.) & \ method = tabl; slopes = (0.5,-1,0.5,1),2 " ); n_tests_failed += (compare_sequence_gen(TESTLOG,409,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; distr = unur_distr_beta(fpar,2); par = unur_tabl_new(distr); unur_tabl_set_usedars(par,TRUE); unur_tabl_set_darsfactor(par,0.5); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,418,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "beta(3.,3.) & method = tabl; usedars=on; darsfactor=0.5" ); n_tests_failed += (compare_sequence_gen(TESTLOG,423,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* [validate] */ /*---------------------------------------------------------------------------*/ /* [validate] */ void test_validate (void) { /* suppress GCC compiler warning */ GCC_DIAG_OFF(unused-variable) UNUR_DISTR *distr[31]; UNUR_PAR *par; UNUR_GEN *gen; double *darray; double fpm[10]; int n_tests_failed; int rcode; /* start test */ printf("[validate "); fflush(stdout); fprintf(TESTLOG,"\n[validate]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* distributions: 31 */ { fpm[0] = 1.; fpm[1] = 2.; distr[0] = unur_distr_beta(fpm,2); } { fpm[0] = 1.; fpm[1] = 5.; distr[1] = unur_distr_beta(fpm,2); } { fpm[0] = 1.; fpm[1] = 100.; distr[2] = unur_distr_beta(fpm,2); } { fpm[0] = 3.; fpm[1] = 4.; distr[3] = unur_distr_beta(fpm,2); } { fpm[0] = 5.; fpm[1] = 100.; distr[4] = unur_distr_beta(fpm,2); } { fpm[0] = 500.; fpm[1] = 300.; distr[5] = unur_distr_beta(fpm,2); } { fpm[0] = 5.; fpm[1] = 10.; fpm[2] = -3.; fpm[3] = 15.; distr[6] = unur_distr_beta(fpm,4); } { distr[7] = unur_distr_cauchy(NULL,0); } { fpm[0] = 1.; fpm[1] = 20.; distr[8] = unur_distr_cauchy(fpm,2); } { distr[23] = unur_distr_exponential(NULL,0); } { fpm[0] = 30.; fpm[1] = -5.; distr[24] = unur_distr_exponential(fpm,2); } { fpm[0] = 1.; distr[9] = unur_distr_gamma(fpm,1); } { fpm[0] = 2.; distr[10] = unur_distr_gamma(fpm,1); } { fpm[0] = 3.; distr[11] = unur_distr_gamma(fpm,1); } { fpm[0] = 10.; distr[12] = unur_distr_gamma(fpm,1); } { fpm[0] = 1000.; distr[13] = unur_distr_gamma(fpm,1); } { fpm[0] = 5.; fpm[1] = 1000.; distr[14] = unur_distr_gamma(fpm,2); } { fpm[0] = 5.; fpm[1] = 1.e-5; distr[15] = unur_distr_gamma(fpm,2); } { fpm[0] = 5.; fpm[1] = 10.; fpm[2] = 1000; distr[16] = unur_distr_gamma(fpm,3); } { distr[25] = unur_distr_laplace(NULL,0); } { fpm[0] = -10.; fpm[1] = 100.; distr[26] = unur_distr_laplace(fpm,2); } { distr[17] = unur_distr_normal(NULL,0); } { fpm[0] = 1.; fpm[1] = 1.e-5; distr[18] = unur_distr_normal(fpm,2); } { fpm[0] = 0.; fpm[1] = 1.e+5; distr[19] = unur_distr_normal(fpm,2); } { distr[20] = unur_distr_uniform(NULL,0); } { fpm[0] = 1.; fpm[1] = 20.; distr[21] = unur_distr_uniform(fpm,2); } { distr[22] = unur_distr_cauchy(NULL,0); unur_distr_cont_set_domain(distr[22],0.1,1.); unur_distr_cont_upd_mode(distr[22]); unur_distr_cont_upd_pdfarea(distr[22]); } { { double domain[2] = {0., 3.}; distr[27] = unur_distr_sawtooth_contpdf(domain, 2); } } { { double domain[2] = {0., 5.}; distr[28] = unur_distr_sawtooth_contpdf(domain, 2); } } { { double domain[2] = {0., 3.}; distr[29] = unur_distr_sawtooth_discpdf(domain, 2); } } { { double domain[2] = {-2., 2.}; distr[30] = unur_distr_sawtooth_discpdf(domain, 2); } } /* timing */ stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); printf("\n(chi^2) "); fflush(stdout); /* chi^2 tests: 310 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nChi^2 Test:\n"); /* distribution [0] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tabl_new(distr_localcopy); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); {double slopes[4] = {0.,-0.5,0.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,2);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); {double slopes[6] = {1.,0.,2.,1.,3.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,3);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); {double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,4);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); unur_tabl_set_usedars(par,FALSE); unur_tabl_set_useear(par,FALSE); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tabl_new(distr_localcopy); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); {double slopes[4] = {0.,-0.5,0.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,2);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); {double slopes[6] = {1.,0.,2.,1.,3.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,3);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); {double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,4);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); unur_tabl_set_usedars(par,FALSE); unur_tabl_set_useear(par,FALSE); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [2] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tabl_new(distr_localcopy); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); {double slopes[4] = {0.,-0.5,0.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,2);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); {double slopes[6] = {1.,0.,2.,1.,3.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,3);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); {double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,4);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); unur_tabl_set_usedars(par,FALSE); unur_tabl_set_useear(par,FALSE); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [3] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tabl_new(distr_localcopy); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); {double slopes[4] = {0.,-0.5,0.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,2);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); {double slopes[6] = {1.,0.,2.,1.,3.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,3);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); {double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,4);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); unur_tabl_set_usedars(par,FALSE); unur_tabl_set_useear(par,FALSE); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [4] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); {double slopes[4] = {0.,-0.5,0.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,2);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); {double slopes[6] = {1.,0.,2.,1.,3.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,3);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); {double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,4);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); unur_tabl_set_usedars(par,FALSE); unur_tabl_set_useear(par,FALSE); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [5] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tabl_new(distr_localcopy); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); {double slopes[4] = {0.,-0.5,0.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,2);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); {double slopes[6] = {1.,0.,2.,1.,3.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,3);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); {double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,4);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); unur_tabl_set_usedars(par,FALSE); unur_tabl_set_useear(par,FALSE); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [6] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tabl_new(distr_localcopy); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); {double slopes[4] = {0.,-0.5,0.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,2);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); {double slopes[6] = {1.,0.,2.,1.,3.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,3);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); {double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,4);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); unur_tabl_set_usedars(par,FALSE); unur_tabl_set_useear(par,FALSE); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [7] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tabl_new(distr_localcopy); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); {double slopes[4] = {0.,-0.5,0.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,2);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); {double slopes[6] = {1.,0.,2.,1.,3.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,3);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); {double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,4);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); unur_tabl_set_usedars(par,FALSE); unur_tabl_set_useear(par,FALSE); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [8] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tabl_new(distr_localcopy); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); {double slopes[4] = {0.,-0.5,0.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,2);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); {double slopes[6] = {1.,0.,2.,1.,3.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,3);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); {double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,4);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); unur_tabl_set_usedars(par,FALSE); unur_tabl_set_useear(par,FALSE); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [23] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tabl_new(distr_localcopy); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); {double slopes[4] = {0.,-0.5,0.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,2);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); {double slopes[6] = {1.,0.,2.,1.,3.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,3);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); {double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,4);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); unur_tabl_set_usedars(par,FALSE); unur_tabl_set_useear(par,FALSE); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [24] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tabl_new(distr_localcopy); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); {double slopes[4] = {0.,-0.5,0.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,2);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); {double slopes[6] = {1.,0.,2.,1.,3.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,3);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); {double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,4);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); unur_tabl_set_usedars(par,FALSE); unur_tabl_set_useear(par,FALSE); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [9] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tabl_new(distr_localcopy); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); {double slopes[4] = {0.,-0.5,0.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,2);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); {double slopes[6] = {1.,0.,2.,1.,3.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,3);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); {double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,4);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); unur_tabl_set_usedars(par,FALSE); unur_tabl_set_useear(par,FALSE); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [10] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tabl_new(distr_localcopy); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); {double slopes[4] = {0.,-0.5,0.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,2);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); {double slopes[6] = {1.,0.,2.,1.,3.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,3);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); {double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,4);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); unur_tabl_set_usedars(par,FALSE); unur_tabl_set_useear(par,FALSE); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [11] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tabl_new(distr_localcopy); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); {double slopes[4] = {0.,-0.5,0.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,2);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); {double slopes[6] = {1.,0.,2.,1.,3.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,3);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); {double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,4);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); unur_tabl_set_usedars(par,FALSE); unur_tabl_set_useear(par,FALSE); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [12] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tabl_new(distr_localcopy); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); {double slopes[4] = {0.,-0.5,0.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,2);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); {double slopes[6] = {1.,0.,2.,1.,3.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,3);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); {double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,4);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); unur_tabl_set_usedars(par,FALSE); unur_tabl_set_useear(par,FALSE); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [13] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); {double slopes[4] = {0.,-0.5,0.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,2);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); {double slopes[6] = {1.,0.,2.,1.,3.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,3);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); {double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,4);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); unur_tabl_set_usedars(par,FALSE); unur_tabl_set_useear(par,FALSE); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [14] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tabl_new(distr_localcopy); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); {double slopes[4] = {0.,-0.5,0.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,2);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); {double slopes[6] = {1.,0.,2.,1.,3.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,3);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); {double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,4);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); unur_tabl_set_usedars(par,FALSE); unur_tabl_set_useear(par,FALSE); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [15] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tabl_new(distr_localcopy); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); {double slopes[4] = {0.,-0.5,0.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,2);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); {double slopes[6] = {1.,0.,2.,1.,3.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,3);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); {double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,4);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); unur_tabl_set_usedars(par,FALSE); unur_tabl_set_useear(par,FALSE); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [16] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); {double slopes[4] = {0.,-0.5,0.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,2);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); {double slopes[6] = {1.,0.,2.,1.,3.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,3);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); {double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,4);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); unur_tabl_set_usedars(par,FALSE); unur_tabl_set_useear(par,FALSE); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [25] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tabl_new(distr_localcopy); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); {double slopes[4] = {0.,-0.5,0.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,2);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); {double slopes[6] = {1.,0.,2.,1.,3.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,3);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); {double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,4);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); unur_tabl_set_usedars(par,FALSE); unur_tabl_set_useear(par,FALSE); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [26] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tabl_new(distr_localcopy); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); {double slopes[4] = {0.,-0.5,0.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,2);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); {double slopes[6] = {1.,0.,2.,1.,3.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,3);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); {double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,4);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); unur_tabl_set_usedars(par,FALSE); unur_tabl_set_useear(par,FALSE); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [17] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tabl_new(distr_localcopy); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); {double slopes[4] = {0.,-0.5,0.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,2);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); {double slopes[6] = {1.,0.,2.,1.,3.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,3);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); {double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,4);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); unur_tabl_set_usedars(par,FALSE); unur_tabl_set_useear(par,FALSE); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [18] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); {double slopes[4] = {0.,-0.5,0.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,2);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); {double slopes[6] = {1.,0.,2.,1.,3.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,3);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); {double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,4);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); unur_tabl_set_usedars(par,FALSE); unur_tabl_set_useear(par,FALSE); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [19] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tabl_new(distr_localcopy); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); {double slopes[4] = {0.,-0.5,0.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,2);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); {double slopes[6] = {1.,0.,2.,1.,3.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,3);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); {double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,4);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); unur_tabl_set_usedars(par,FALSE); unur_tabl_set_useear(par,FALSE); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [20] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tabl_new(distr_localcopy); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); {double slopes[4] = {0.,-0.5,0.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,2);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); {double slopes[6] = {1.,0.,2.,1.,3.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,3);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); {double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,4);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); unur_tabl_set_usedars(par,FALSE); unur_tabl_set_useear(par,FALSE); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [21] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); {double slopes[4] = {0.,-0.5,0.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,2);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); {double slopes[6] = {1.,0.,2.,1.,3.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,3);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); {double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,4);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); unur_tabl_set_usedars(par,FALSE); unur_tabl_set_useear(par,FALSE); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [22] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tabl_new(distr_localcopy); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); {double slopes[4] = {0.,-0.5,0.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,2);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); {double slopes[6] = {1.,0.,2.,1.,3.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,3);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); {double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,4);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); unur_tabl_set_usedars(par,FALSE); unur_tabl_set_useear(par,FALSE); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [27] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tabl_new(distr_localcopy); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); {double slopes[4] = {0.,-0.5,0.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,2);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); {double slopes[6] = {1.,0.,2.,1.,3.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,3);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); {double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,4);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); unur_tabl_set_usedars(par,FALSE); unur_tabl_set_useear(par,FALSE); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [28] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tabl_new(distr_localcopy); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); {double slopes[4] = {0.,-0.5,0.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,2);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); {double slopes[6] = {1.,0.,2.,1.,3.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,3);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); {double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,4);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); unur_tabl_set_usedars(par,FALSE); unur_tabl_set_useear(par,FALSE); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [29] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_tabl_new(distr_localcopy); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); {double slopes[4] = {0.,-0.5,0.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,2);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); {double slopes[6] = {1.,0.,2.,1.,3.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,3);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); {double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,4);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); unur_tabl_set_usedars(par,FALSE); unur_tabl_set_useear(par,FALSE); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [30] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tabl_new(distr_localcopy); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) { unur_tabl_chg_truncated(gen,0.5,0.9); } rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); {double slopes[4] = {0.,-0.5,0.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,2);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); {double slopes[6] = {1.,0.,2.,1.,3.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,3);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); {double slopes[8] = {-2.,-1.,-1.,0.,1.,0.,2.,1.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_slopes(par,slopes,4);} gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_variant_ia(par,FALSE); unur_tabl_set_usedars(par,FALSE); unur_tabl_set_useear(par,FALSE); unur_use_urng_aux_default(par); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); printf("\n(verify hat) "); fflush(stdout); /* verify hat tests: 310 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nVerify Hat Test (squeeze <= PDF <= hat):\n"); /* distribution [0] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); {double slopes[4] = {0.,-0.5,0.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_slopes(par,slopes,2);} gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); {double slopes[4] = {0.,-0.5,0.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_slopes(par,slopes,2);} gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [2] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); {double slopes[4] = {0.,-0.5,0.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_slopes(par,slopes,2);} gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [3] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [4] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [5] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [6] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [7] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [8] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [23] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [24] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [9] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [10] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [11] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [12] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [13] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [14] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [15] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [16] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [25] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [26] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [17] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [18] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [19] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [20] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); {double slopes[4] = {0.,-0.5,0.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_slopes(par,slopes,2);} gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [21] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [22] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,TRUE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_usedars(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_variant_ia(par,FALSE); gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); {double slopes[4] = {0.,-0.5,0.,2.}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_slopes(par,slopes,2);} gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [27] */ if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); {double cpoints[] = {0.,0.5,1.0,1.5,2.0,2.5,3.0}; par = unur_tabl_new(distr_localcopy); unur_tabl_set_pedantic(par,0); unur_tabl_set_cpoints(par,7,cpoints);} gen = unur_init(par); if (gen) unur_tabl_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [28] */ if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [29] */ if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [30] */ if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); /* free distributions */ unur_distr_free(distr[0]); unur_distr_free(distr[1]); unur_distr_free(distr[2]); unur_distr_free(distr[3]); unur_distr_free(distr[4]); unur_distr_free(distr[5]); unur_distr_free(distr[6]); unur_distr_free(distr[7]); unur_distr_free(distr[8]); unur_distr_free(distr[9]); unur_distr_free(distr[10]); unur_distr_free(distr[11]); unur_distr_free(distr[12]); unur_distr_free(distr[13]); unur_distr_free(distr[14]); unur_distr_free(distr[15]); unur_distr_free(distr[16]); unur_distr_free(distr[17]); unur_distr_free(distr[18]); unur_distr_free(distr[19]); unur_distr_free(distr[20]); unur_distr_free(distr[21]); unur_distr_free(distr[22]); unur_distr_free(distr[23]); unur_distr_free(distr[24]); unur_distr_free(distr[25]); unur_distr_free(distr[26]); unur_distr_free(distr[27]); unur_distr_free(distr[28]); unur_distr_free(distr[29]); unur_distr_free(distr[30]); /* test finished */ test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; /* we accept CHI2_FAILURES_TOLERATED failures */ (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_validate */ /* enable GCC compiler warning */ GCC_DIAG_ON(unused-variable) /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_tabl_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_distr_cvec.c0000644001357500135600000012231214430713513014015 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for DISTR_CVEC **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); int unur_distr_cvec_set_verify( UNUR_PAR *par, int verify); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ #define COMPARE_SAMPLE_SIZE (500) #define VIOLATE_SAMPLE_SIZE (20) double mvpdf(const double *x, UNUR_DISTR *distr); int mvdpdf(double *result, const double *x, UNUR_DISTR *distr); double mvpdpdf(const double *x, int coord, UNUR_DISTR *distr); /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ double mvpdf(const double *x ATTRIBUTE__UNUSED, UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return 1.; } int mvdpdf(double *result ATTRIBUTE__UNUSED, const double *x ATTRIBUTE__UNUSED, UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return 1; } double mvpdpdf(const double *x ATTRIBUTE__UNUSED, int coord ATTRIBUTE__UNUSED, UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return 1.; } /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid data */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,29,(unur_distr_cvec_new(0)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,29,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [set] */ void test_set (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[set "); fflush(stdout); fprintf(TESTLOG,"\n[set]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,40,(unur_distr_cvec_set_pdf( distr, mvpdf )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,40,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,43,(unur_distr_cvec_set_dpdf( distr, mvdpdf )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,43,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,46,(unur_distr_cvec_set_pdpdf( distr, mvpdpdf )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,46,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,49,(unur_distr_cvec_set_logpdf( distr, mvpdf )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,49,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,52,(unur_distr_cvec_set_dlogpdf( distr, mvdpdf )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,52,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,55,(unur_distr_cvec_set_pdlogpdf( distr, mvpdpdf )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,55,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,58,(unur_distr_cvec_set_mean( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,58,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,61,(unur_distr_cvec_set_covar( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,61,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,64,(unur_distr_cvec_set_covar_inv( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,64,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,67,(unur_distr_cvec_set_rankcorr( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,67,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,70,(unur_distr_cvec_set_mode( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,70,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,73,(unur_distr_cvec_set_center( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,73,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,76,(unur_distr_cvec_set_pdfparams( distr, NULL, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,76,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,79,(unur_distr_cvec_set_pdfparams_vec( distr, 0, NULL, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,79,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,82,(unur_distr_cvec_set_pdfvol( distr, 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,82,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,85,(unur_distr_cvec_set_marginals( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,85,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,88,(unur_distr_cvec_set_marginal_array( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,88,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,91,(unur_distr_cvec_set_domain_rect( distr, NULL, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,91,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; double fpm[2] = {1.,2.}; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,99,(unur_distr_cvec_set_pdf( distr, mvpdf )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,99,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,102,(unur_distr_cvec_set_dpdf( distr, mvdpdf )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,102,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,105,(unur_distr_cvec_set_pdpdf( distr, mvpdpdf )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,105,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,108,(unur_distr_cvec_set_logpdf( distr, mvpdf )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,108,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,111,(unur_distr_cvec_set_dlogpdf( distr, mvdpdf )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,111,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,114,(unur_distr_cvec_set_pdlogpdf( distr, mvpdpdf )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,114,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,117,(unur_distr_cvec_set_mean( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,117,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,120,(unur_distr_cvec_set_covar( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,120,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,123,(unur_distr_cvec_set_covar_inv( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,123,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,126,(unur_distr_cvec_set_rankcorr( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,126,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,129,(unur_distr_cvec_set_mode( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,129,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,132,(unur_distr_cvec_set_center( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,132,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,135,(unur_distr_cvec_set_pdfparams( distr, fpm, 2 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,135,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,138,(unur_distr_cvec_set_pdfparams_vec( distr, 0, fpm, 2 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,138,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,141,(unur_distr_cvec_set_pdfvol( distr, 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,141,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,144,(unur_distr_cvec_set_marginals( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,144,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,147,(unur_distr_cvec_set_marginal_array( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,147,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,150,(unur_distr_cvec_set_domain_rect( distr, NULL, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,150,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = unur_distr_cvec_new(2); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,157,(unur_distr_cvec_set_pdf( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,157,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,160,(unur_distr_cvec_set_dpdf( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,160,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,163,(unur_distr_cvec_set_pdpdf( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,163,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,166,(unur_distr_cvec_set_logpdf( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,166,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,169,(unur_distr_cvec_set_dlogpdf( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,169,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,172,(unur_distr_cvec_set_pdlogpdf( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,172,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,175,(unur_distr_cvec_set_pdfparams( distr, NULL, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,175,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,178,(unur_distr_cvec_set_marginals( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,178,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,181,(unur_distr_cvec_set_marginal_array( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,181,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,184,(unur_distr_cvec_set_domain_rect( distr, NULL, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,184,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; double fpm[2] = {1.,2.}; double dpm[2] = {4., 0.5}; double covar_invalid_negative[4] = {-1.,0.,0.,1.}; double covar_invalid_nonsym[4] = {1.,0.5,0.,1.}; double covar_invalid_nonpositive[4] = {0.5,1.,1.,0.5}; double ll[] = { 0., 0. }; double ru[] = { 0., 0. }; UNUR_DISTR *marginal = unur_distr_binomial(dpm,2); UNUR_DISTR *marginal_array[2]; marginal_array[0] = marginal; marginal_array[1] = marginal; distr = unur_distr_cvec_new(2); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,202,(unur_distr_cvec_set_pdfvol( distr, -1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,202,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,205,(unur_distr_cvec_set_covar( distr, covar_invalid_negative )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,205,UNUR_ERR_DISTR_DOMAIN)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,208,(unur_distr_cvec_set_covar_inv( distr, covar_invalid_negative )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,208,UNUR_ERR_DISTR_DOMAIN)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,211,(unur_distr_cvec_set_covar( distr, covar_invalid_nonsym )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,211,UNUR_ERR_DISTR_DOMAIN)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,214,(unur_distr_cvec_set_covar_inv( distr, covar_invalid_nonsym )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,214,UNUR_ERR_DISTR_DOMAIN)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,217,(unur_distr_cvec_set_covar( distr, covar_invalid_nonpositive )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,217,UNUR_ERR_DISTR_DOMAIN)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,220,(unur_distr_cvec_set_rankcorr( distr, covar_invalid_negative )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,220,UNUR_ERR_DISTR_DOMAIN)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,223,(unur_distr_cvec_set_rankcorr( distr, covar_invalid_nonsym )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,223,UNUR_ERR_DISTR_DOMAIN)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,226,(unur_distr_cvec_set_pdfparams( distr, fpm, -1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,226,UNUR_ERR_DISTR_NPARAMS)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,229,(unur_distr_cvec_set_pdfparams_vec( distr, -1, fpm, 2 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,229,UNUR_ERR_DISTR_NPARAMS)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,232,(unur_distr_cvec_set_pdfparams_vec( distr, 100000, fpm, 2 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,232,UNUR_ERR_DISTR_NPARAMS)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,235,(unur_distr_cvec_set_marginals( distr, marginal )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,235,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,238,(unur_distr_cvec_set_marginal_array( distr, marginal_array )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,238,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,241,(unur_distr_cvec_set_domain_rect( distr, ll, ru )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,241,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_distr_free(marginal); unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_set() */ /*---------------------------------------------------------------------------*/ /* [get] */ void test_get (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[get "); fflush(stdout); fprintf(TESTLOG,"\n[get]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,254,(unur_distr_cvec_get_pdf( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,254,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,257,(unur_distr_cvec_get_dpdf( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,257,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,260,(unur_distr_cvec_get_pdpdf( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,260,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,263,(unur_distr_cvec_get_logpdf( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,263,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,266,(unur_distr_cvec_get_dlogpdf( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,266,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,269,(unur_distr_cvec_get_pdlogpdf( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,269,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,272,(unur_distr_cvec_get_pdfvol( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,272,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,275,(unur_distr_cvec_get_mean( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,275,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,278,(unur_distr_cvec_get_covar( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,278,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,281,(unur_distr_cvec_get_covar_inv( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,281,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,284,(unur_distr_cvec_get_rankcorr( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,284,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,287,(unur_distr_cvec_get_cholesky( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,287,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,290,(unur_distr_cvec_get_mode( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,290,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,293,(unur_distr_cvec_get_center( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,293,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_zero(TESTLOG,296,(unur_distr_cvec_get_pdfparams( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,296,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_zero(TESTLOG,299,(unur_distr_cvec_get_pdfparams_vec( distr, 0, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,299,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,302,(unur_distr_cvec_get_marginal( distr, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,302,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; const double *fpm; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,310,(unur_distr_cvec_get_pdf( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,310,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,313,(unur_distr_cvec_get_dpdf( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,313,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,316,(unur_distr_cvec_get_pdpdf( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,316,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,319,(unur_distr_cvec_get_logpdf( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,319,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,322,(unur_distr_cvec_get_dlogpdf( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,322,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,325,(unur_distr_cvec_get_pdlogpdf( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,325,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,328,(unur_distr_cvec_get_pdfvol( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,328,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,331,(unur_distr_cvec_get_mean( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,331,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,334,(unur_distr_cvec_get_covar( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,334,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,337,(unur_distr_cvec_get_covar_inv( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,337,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,340,(unur_distr_cvec_get_rankcorr( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,340,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,343,(unur_distr_cvec_get_cholesky( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,343,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,346,(unur_distr_cvec_get_mode( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,346,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,349,(unur_distr_cvec_get_center( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,349,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_zero(TESTLOG,352,(unur_distr_cvec_get_pdfparams( distr, &fpm )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,352,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_zero(TESTLOG,355,(unur_distr_cvec_get_pdfparams_vec( distr, 0, &fpm )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,355,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,358,(unur_distr_cvec_get_marginal( distr, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,358,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* parameters not unknown */ UNUR_DISTR *distr = NULL; const double *fpm; distr = unur_distr_cvec_new(2); unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,366,(unur_distr_cvec_get_pdfvol( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,366,UNUR_ERR_DISTR_GET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,369,(unur_distr_cvec_get_mean( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,369,UNUR_ERR_DISTR_GET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,372,(unur_distr_cvec_get_covar( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,372,UNUR_ERR_DISTR_GET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,375,(unur_distr_cvec_get_covar_inv( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,375,UNUR_ERR_DISTR_GET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,378,(unur_distr_cvec_get_rankcorr( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,378,UNUR_ERR_DISTR_GET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,381,(unur_distr_cvec_get_cholesky( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,381,UNUR_ERR_DISTR_GET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,384,(unur_distr_cvec_get_mode( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,384,UNUR_ERR_DISTR_GET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_zero(TESTLOG,387,(unur_distr_cvec_get_pdfparams_vec( distr, -1, &fpm )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,387,UNUR_ERR_DISTR_NPARAMS)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_zero(TESTLOG,390,(unur_distr_cvec_get_pdfparams_vec( distr, 1000, &fpm )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,390,UNUR_ERR_DISTR_NPARAMS)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,393,(unur_distr_cvec_get_marginal( distr, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,393,UNUR_ERR_DISTR_GET)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; double covar_invalid_noninv[4] = {1.,1.,1.,1.}; UNUR_DISTR *marginal = unur_distr_normal(NULL,0); distr = unur_distr_cvec_new(2); unur_distr_cvec_set_marginals( distr, marginal ); unur_distr_cvec_set_covar( distr, covar_invalid_noninv ); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,404,(unur_distr_cvec_get_covar( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,404,UNUR_ERR_DISTR_GET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,407,(unur_distr_cvec_get_rankcorr( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,407,UNUR_ERR_DISTR_GET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,410,(unur_distr_cvec_get_marginal( distr, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,410,UNUR_ERR_DISTR_GET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,413,(unur_distr_cvec_get_marginal( distr, 3 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,413,UNUR_ERR_DISTR_GET)==UNUR_SUCCESS)?0:1; unur_distr_free(marginal); unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_get() */ /*---------------------------------------------------------------------------*/ /* [chg] */ void test_chg (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[chg "); fflush(stdout); fprintf(TESTLOG,"\n[chg]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,425,(unur_distr_cvec_upd_mode( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,425,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,428,(unur_distr_cvec_upd_pdfvol( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,428,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; distr = unur_distr_cont_new(); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,434,(unur_distr_cvec_upd_mode( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,434,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,437,(unur_distr_cvec_upd_pdfvol( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,437,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* missing data */ UNUR_DISTR *distr = NULL; distr = unur_distr_cvec_new(3); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,443,(unur_distr_cvec_upd_mode( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,443,UNUR_ERR_DISTR_DATA)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,446,(unur_distr_cvec_upd_pdfvol( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,446,UNUR_ERR_DISTR_DATA)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_chg() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,465,(unur_distr_cvec_eval_pdf( NULL, distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,465,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,468,(unur_distr_cvec_eval_dpdf( NULL, NULL, distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,468,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,471,(unur_distr_cvec_eval_pdpdf( NULL, 1, distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,471,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,474,(unur_distr_cvec_eval_logpdf( NULL, distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,474,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,477,(unur_distr_cvec_eval_dlogpdf( NULL, NULL, distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,477,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,480,(unur_distr_cvec_eval_pdlogpdf( NULL, 1, distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,480,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution object */ UNUR_DISTR *distr = NULL; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,487,(unur_distr_cvec_eval_pdf( NULL, distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,487,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,490,(unur_distr_cvec_eval_dpdf( NULL, NULL, distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,490,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,493,(unur_distr_cvec_eval_pdpdf( NULL, 1, distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,493,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,496,(unur_distr_cvec_eval_logpdf( NULL, distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,496,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,499,(unur_distr_cvec_eval_dlogpdf( NULL, NULL, distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,499,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,502,(unur_distr_cvec_eval_pdlogpdf( NULL, 1, distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,502,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* missing data */ UNUR_DISTR *distr = NULL; double x[2], result[2]; distr = unur_distr_cvec_new(2); unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,510,(unur_distr_cvec_eval_pdf( x, distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,510,UNUR_ERR_DISTR_DATA)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,513,(unur_distr_cvec_eval_dpdf( result, x, distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,513,UNUR_ERR_DISTR_DATA)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,516,(unur_distr_cvec_eval_pdpdf( x, 1, distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,516,UNUR_ERR_DISTR_DATA)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,519,(unur_distr_cvec_eval_logpdf( x, distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,519,UNUR_ERR_DISTR_DATA)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,522,(unur_distr_cvec_eval_dlogpdf( result, x, distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,522,UNUR_ERR_DISTR_DATA)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,525,(unur_distr_cvec_eval_pdlogpdf( x, 1, distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,525,UNUR_ERR_DISTR_DATA)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* check for memory leaks */ UNUR_DISTR *distr = NULL; double x[] = { 1., 2., 3. }; distr = unur_distr_cvec_new(3); unur_reset_errno(); unur_distr_cvec_set_pdfparams_vec( distr, 0, x, 3 ); n_tests_failed += (check_errorcode(TESTLOG,533,UNUR_SUCCESS)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_distr_cvec_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_dari.conf0000644001357500135600000003424414420445767013334 00000000000000############################################################################# [main] [main - data:] # method (for information only: the program scans the file name) method: DARI [main - header:] /* prototypes */ int unur_dari_set_pedantic( struct unur_par *par, int pedantic ); double pmf_poisson5(int k, const UNUR_DISTR *distr); double pmf_poisson5_NaN(int k, const UNUR_DISTR *distr); double pmf_poisson50(int k, const UNUR_DISTR *distr); double pmf_negpoisson5(int k, const UNUR_DISTR *distr); double pmf_negpoisson50(int k, const UNUR_DISTR *distr); \#define COMPARE_SAMPLE_SIZE (10000) \#define VIOLATE_SAMPLE_SIZE (20) /* \#define SEED (298346) */ ############################################################################# [new] [new - invalid NULL ptr: distr = NULL; ] ~( distr ); --> expected_NULL --> UNUR_ERR_NULL [new - invalid distribution type: distr = unur_distr_cont_new(); ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID [new - data missing in distribution object: distr = unur_distr_discr_new(); /* no PMF */ ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED ############################################################################## [set] [set - invalid NULL ptr: par = NULL; ] ~_cpfactor(par,1.); --> expected_setfailed --> UNUR_ERR_NULL ~_squeeze(par, 1); --> expected_setfailed --> UNUR_ERR_NULL ~_tablesize(par,100); --> expected_setfailed --> UNUR_ERR_NULL ~_verify(par,1); --> expected_setfailed --> UNUR_ERR_NULL [set - invalid parameter object: double fpar[1] = {0.5}; distr = unur_distr_geometric(fpar,1); par = unur_dgt_new(distr); ] ~_cpfactor(par,1.); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_squeeze(par, 1); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_tablesize(par,100); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_verify(par,1); --> expected_setfailed --> UNUR_ERR_PAR_INVALID unur_par_free(par); [set - invalid parameters: double fpar[1] = {0.5}; distr = unur_distr_geometric(fpar,1); par = unur_dari_new(distr); ] ~_cpfactor(par,-1.); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_cpfactor(par,3.); --> none --> UNUR_ERR_PAR_SET ~_tablesize(par,-100); --> expected_setfailed --> UNUR_ERR_PAR_SET unur_par_free(par); ############################################################################## # [get] ############################################################################## [chg] [chg - invalid generator object: double fpar[1] = {0.5}; distr = unur_distr_geometric(fpar,1); par = unur_dgt_new(distr); unur_set_debug(par,0); gen = unur_init( par ); <-- ! NULL ] ~_verify( gen,1 ); --> expected_setfailed --> UNUR_ERR_GEN_INVALID ############################################################################# # [init] ############################################################################## [reinit] [reinit - exist: double fpar[1] = {0.5}; distr = unur_distr_geometric(fpar,1); par = unur_dari_new(distr); gen = unur_init( par ); <-- ! NULL ] unur_reinit( gen ); --> expected_reinit ############################################################################## [sample] [sample - compare: double fpar[] = {0.1}; distr = unur_distr_geometric(fpar,1); par = NULL; ] /* default algorithm */ par = unur_dari_new(distr); -->compare_sequence_par_start /* default algorithm - verifying mode */ par = unur_dari_new(distr); unur_dari_set_verify(par,1); -->compare_sequence_par #..................................................................... [sample - compare clone: UNUR_GEN *clone; double fpar[] = {10,0.3}; distr = unur_distr_binomial(fpar,2); par = NULL; gen = NULL; ] /* original generator object */ par = unur_dari_new(distr); gen = unur_init(par); -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen #..................................................................... [sample - compare reinit: double fpar[] = {10,0.3}; distr = unur_distr_binomial(fpar,2); par = NULL; gen = NULL; ] /* original generator object */ par = unur_dari_new(distr); gen = unur_init(par); -->compare_sequence_gen_start /* reinit */ unur_reinit(gen); -->compare_sequence_gen #..................................................................... [sample - compare stringparser: double fpar[] = {20, 0.8}; distr = NULL; par = NULL; gen = NULL; ] distr = unur_distr_binomial(fpar,2); par = unur_dari_new(distr); unur_dari_set_cpfactor(par,0.7); unur_dari_set_squeeze(par,TRUE); unur_dari_set_tablesize(par,30); unur_dari_set_verify(par,FALSE); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "binomial(20,0.8) & \ method = dari; cpfactor = 0.7; squeeze; tablesize = 30; verify = off" ); -->compare_sequence_gen ############################################################################## [validate] [validate - generators:] # default par[0] = unur_dari_new(@distr@); # with table and with squeeze par[1] = unur_dari_new(@distr@); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 1); # with table and without squeeze par[2] = unur_dari_new(@distr@); unur_dari_set_tablesize(par, 100); unur_dari_set_squeeze(par, 0); # without table and with squeeze par[3] = unur_dari_new(@distr@); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 1); # without table and without squeeze par[4] = unur_dari_new(@distr@); unur_dari_set_tablesize(par, 0); unur_dari_set_squeeze(par, 0); # default variant but reinitialized with changed domain { UNUR_DISTR *dg =NULL; par[5] = unur_dari_new(@distr@); dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,5); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } # default variant but reinitialized with changed pmf parameters { UNUR_DISTR *dg =NULL; par[6] = unur_dari_new(@distr@); fpm[0] = 0.4; dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,1); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } [validate - distributions:] # geometric disctribution fpm[0] = 0.5; distr[0] = unur_distr_geometric(fpm,1); fpm[0] = 0.1; distr[1] = unur_distr_geometric(fpm,1); fpm[0] = 0.001; distr[2] = unur_distr_geometric(fpm,1); # logarithmic distribution fpm[0] = 0.1; distr[3] = unur_distr_logarithmic(fpm,1); fpm[0] = 0.9; distr[4] = unur_distr_logarithmic(fpm,1); # negative binomial distribution fpm[0] = 0.5; fpm[1] = 10.; distr[5] = unur_distr_negativebinomial(fpm,2); fpm[0] = 0.7; fpm[1] = 5.; distr[6] = unur_distr_negativebinomial(fpm,2); fpm[0] = 0.1; fpm[1] = 20.; distr[7] = unur_distr_negativebinomial(fpm,2); # poisson distribution fpm[0] = 3.; distr[8] = unur_distr_poisson(fpm,1); fpm[0] = 50.; distr[9] = unur_distr_poisson(fpm,1); # zipf distribution fpm[0] = 2.; fpm[1] = 1.; distr[10] = unur_distr_zipf(fpm,2); unur_distr_discr_set_domain(distr[10],1,1000); # binomial distribution fpm[0] = 20.; fpm[1] = 0.8; distr[11] = unur_distr_binomial(fpm,2); # binomial distribution fpm[0] = 2000.; fpm[1] = 0.0013; distr[12] = unur_distr_binomial(fpm,2); # Hyper geometric distribution fpm[0] = 2000.; fpm[1] = 200.; fpm[2] = 20; distr[13] = unur_distr_hypergeometric(fpm,3); # Hyper geometric distribution fpm[0] = 2000.; fpm[1] = 200.; fpm[2] = 220; distr[14] = unur_distr_hypergeometric(fpm,3); # Special tests with Poission distribution distr[15] = unur_distr_discr_new(); unur_distr_discr_set_pmf(distr[15],pmf_poisson5); unur_distr_set_name(distr[15],"test-poisson"); distr[16] = unur_distr_discr_new(); unur_distr_discr_set_pmf(distr[16],pmf_poisson5); unur_distr_set_name(distr[16],"test-poisson"); distr[17] = unur_distr_discr_new(); unur_distr_discr_set_pmf(distr[17],pmf_poisson5); unur_distr_set_name(distr[17],"test-poisson"); distr[18] = unur_distr_discr_new(); unur_distr_discr_set_pmf(distr[18],pmf_poisson5); unur_distr_discr_set_domain(distr[18],INT_MIN,INT_MAX); unur_distr_set_name(distr[18],"test-poisson"); distr[19] = unur_distr_discr_new(); unur_distr_discr_set_pmf(distr[19],pmf_negpoisson5); unur_distr_discr_set_domain(distr[19],INT_MIN,INT_MAX); unur_distr_set_name(distr[19],"test-poisson"); distr[20] = unur_distr_discr_new(); unur_distr_discr_set_pmf(distr[20],pmf_negpoisson5); unur_distr_discr_set_domain(distr[20],INT_MIN,0); unur_distr_set_name(distr[20],"test-poisson"); distr[21] = unur_distr_discr_new(); unur_distr_discr_set_pmf(distr[21],pmf_negpoisson50); unur_distr_discr_set_domain(distr[21],INT_MIN,INT_MAX); unur_distr_set_name(distr[21],"test-poisson"); distr[22] = unur_distr_discr_new(); unur_distr_discr_set_pmf(distr[22],pmf_negpoisson50); unur_distr_discr_set_domain(distr[22],INT_MIN,0); unur_distr_set_name(distr[22],"test-poisson"); # number of distributions: 23 [validate - test chi2:] # + ... pass test # 0 ... fail to initialize generator (given variant does not exist) # - ... fail test # . ... do not run test # # ... comment # # generators: # [0] ... default # [1] ... with table and with squeeze # [2] ... with table and without squeeze # [3] ... without table and with squeeze # [4] ... without table and without squeeze # [5] ... default variant but reinitialized with changed domain # [6] ... default variant but reinitialized with changed pmf parameters # #gen 0 1 2 3 4 5 6 # distribution #------------------------------------------------------------- <0> + + + + + + + # geometric (0.5) x <1> + + + + + + + # geometric (0.1) <2> + + + + + + + # geometric (0.001) <3> + + + + + + + # logarithmic (0.1) <4> + + + + + + + # logarithmic (0.9) x <5> + + + + + + . # negativebinomial (0.5, 10) <6> + + + + + + . # negativebinomial (0.7, 5) <7> + + + + + + . # negativebinomial (0.1, 20) <8> + + + + + + . # poisson (3) <9> + + + + + + . # poisson (50) <10> + + + + + + . # zipf (2, 1) <11> + + + + + + . # binomial (20, 0.8) <12> + + + + + + . # binomial (2000, 0.0013) <13> + + + + + + . # hypergeometric (2000, 200, 20) x<14> + + + + + + . # hypergeometric (2000, 200, 220) <15> + + + + + + . # poisson (5), search for mode <16> + + + + + + . # poisson (5), search for mode, returns NaN <17> + + + + + + . # poisson (50), search for mode #<18> + + + + + + . # poisson (5), search for mode, domain = (-oo,oo) #<19> + + + + + + . # -poisson (5), search for mode, domain = (-oo,oo) #<20> + + + + + + . # -poisson (5), search for mode, domain = (-oo,0) #<21> + + + + + + . # -poisson (50), search for mode, domain = (-oo,oo) #<22> + + + + + + . # -poisson (50), search for mode, domain = (-oo,0) [validate - verify hat:] # + ... pass test # ~ ... fail in at most 1% of samples # 0 ... fail to initialize generator # - ... fail test # . ... do not run test # # ... comment # # generators: # [0] ... default # [1] ... with table and with squeeze # [2] ... with table and without squeeze # [3] ... without table and with squeeze # [4] ... without table and without squeeze # [5] ... default variant but reinitialized with changed domain # [6] ... default variant but reinitialized with changed pmf parameters # #gen 0 1 2 3 4 5 6 # distribution #------------------------------------------------------------- <0> + + + + + + + # geometric (0.5) x <1> + + + + + + + # geometric (0.1) <2> + + + + + + + # geometric (0.001) <3> + + + + + + + # logarithmic (0.1) <4> + + + + + + + # logarithmic (0.9 ) x <5> + + + + + + . # negativebinomial (0.5, 10) <6> + + + + + + . # negativebinomial (0.7, 5) <7> + + + + + + . # negativebinomial (0.1, 20) <8> + + + + + + . # poisson (3) <9> + + + + + + . # poisson (50) <10> + + + + + + . # zipf (2, 1) <11> + + + + + + . # binomial (20, 0.8) <12> + + + + + + . # binomial (2000, 0.0013) <13> + + + + + + . # hypergeometric (2000, 200, 20) x<14> + + + + + + . # hypergeometric (2000, 200, 220) <15> + + + + + + . # poisson (5), search for mode <16> + + + + + + . # poisson (5), search for mode, returns NaN <17> + + + + + + . # poisson (50), search for mode #<18> + + + + + + . # poisson (5), search for mode, domain = (-oo,oo) <19> 0 0 0 0 0 0 . # -poisson (5), search for mode, domain = (-oo,oo) #<20> + + + + + + . # -poisson (5), search for mode, domain = (-oo,0) #<21> + + + + + + . # -poisson (50), search for mode, domain = (-oo,oo) #<22> + + + + + + . # -poisson (50), search for mode, domain = (-oo,0) ############################################################################## ############################################################################## [verbatim] /* no such function */ int unur_dari_set_pedantic( struct unur_par *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) { return 1; } \#include double pmf_poisson5(int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double theta = 5.; return ((k<0) ? 0. : exp( -theta + k * log(theta) - _unur_SF_ln_factorial(k) )); } double pmf_poisson5_NaN(int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double theta = 5.; return ((k<0) ? 0. : exp( -theta + k * log(theta)) / exp (_unur_SF_ln_factorial(k) )); } double pmf_poisson50(int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double theta = 50.; return ((k<0) ? 0. : exp( -theta + k * log(theta) - _unur_SF_ln_factorial(k) )); } double pmf_negpoisson5(int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double theta = 5.; k *= -1; return ((k<0) ? 0. : exp( -theta + k * log(theta) - _unur_SF_ln_factorial(k) )); } double pmf_negpoisson50(int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double theta = 50.; k *= -1; return ((k<0) ? 0. : exp( -theta + k * log(theta) - _unur_SF_ln_factorial(k) )); } ############################################################################## unuran-1.11.0/tests/t_unur_tests.c0000644001357500135600000003112214430713513014101 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for TEST **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); int unur_test_set_verify( UNUR_PAR *par, int verify); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ double HR_increasing_gm31(double x, const UNUR_DISTR *distr); #define COMPARE_SAMPLE_SIZE (500) #define VIOLATE_SAMPLE_SIZE (20) /* we need marginal distributions for the chi2 tests */ #define unur_distr_multinormal unur_distr_multinormal_w_marginals /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ double HR_increasing_gm31(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* example with increasing hazard rate: gamma (alpha=3,beta=1) */ { return (x*x)/(x*x+2.*x+2.); } /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* run_tests for AUTO */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = unur_distr_normal(NULL,0); par = NULL; unur_reset_errno(); par = unur_auto_new(distr); unur_run_tests(par,~0u,TESTLOG); n_tests_failed += (check_errorcode(TESTLOG,55,UNUR_SUCCESS)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* run_tests for AUTO */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double fpm[1] = {0.5}; distr = unur_distr_geometric(fpm,1); par = NULL; unur_reset_errno(); par = unur_auto_new(distr); unur_run_tests(par,~0u,TESTLOG); n_tests_failed += (check_errorcode(TESTLOG,65,UNUR_SUCCESS)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* run_tests for AUTO */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double data[] = {1.,2.,3.,4.,5.,6.,7.,8.,9.}; distr = unur_distr_cemp_new(); unur_distr_cemp_set_data(distr,data,9); par = NULL; unur_reset_errno(); par = unur_auto_new(distr); unur_run_tests(par,~0u,TESTLOG); n_tests_failed += (check_errorcode(TESTLOG,76,UNUR_SUCCESS)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* run_tests for AUTO */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; const int dim = 3; double mean[] = {1.,2.,3.}; double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; distr = unur_distr_multinormal( dim, mean, covar ); par = NULL; unur_reset_errno(); par = unur_auto_new(distr); unur_run_tests(par,~0u,TESTLOG); n_tests_failed += (check_errorcode(TESTLOG,88,UNUR_SUCCESS)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* [special] */ void test_special (void) { /* set boolean to FALSE */ int FAILED = 0; int samplesize = 10000; double fpm[10]; double Rsq, time_setup, time_marginal; UNUR_DISTR *distr; UNUR_PAR *par; UNUR_GEN *gen; /* start test */ printf("[special "); fflush(stdout); fprintf(TESTLOG,"\n[special]\n"); /* set stop watch */ stopwatch_lap(&watch); /* unur_test_par_count_pdf() */ distr = unur_distr_normal(NULL,0); par = unur_tdr_new(distr); unur_tdr_set_usedars(par,0); unur_test_par_count_pdf(par,samplesize,1,TESTLOG); gen = unur_init(par); unur_test_count_pdf(gen,samplesize,1,TESTLOG); unur_free(gen); unur_distr_free(distr); distr = unur_distr_normal_wo_logpdf(NULL,0); par = unur_tdr_new(distr); unur_test_par_count_pdf(par,samplesize,1,TESTLOG); gen = unur_init(par); unur_test_count_pdf(gen,samplesize,1,TESTLOG); unur_free(gen); unur_distr_free(distr); distr = unur_distr_normal(NULL,0); par = unur_ninv_new(distr); unur_test_par_count_pdf(par,samplesize,1,TESTLOG); gen = unur_init(par); unur_test_count_pdf(gen,samplesize,1,TESTLOG); unur_free(gen); unur_distr_free(distr); distr = unur_distr_normal(NULL,0); par = unur_hinv_new(distr); unur_test_par_count_pdf(par,samplesize,1,TESTLOG); gen = unur_init(par); unur_test_count_pdf(gen,samplesize,1,TESTLOG); unur_free(gen); unur_distr_free(distr); distr = unur_distr_cont_new(); unur_distr_set_name(distr,"HR"); unur_distr_cont_set_hr(distr,HR_increasing_gm31); par = unur_hri_new(distr); unur_test_par_count_pdf(par,samplesize,1,TESTLOG); gen = unur_init(par); unur_test_count_pdf(gen,samplesize,1,TESTLOG); unur_free(gen); unur_distr_free(distr); fpm[0] = 0.5; distr = unur_distr_geometric(fpm,1); par = unur_dgt_new(distr); unur_test_par_count_pdf(par,samplesize,1,TESTLOG); gen = unur_init(par); unur_test_count_pdf(gen,samplesize,1,TESTLOG); unur_free(gen); unur_distr_free(distr); fpm[0] = 0.5; distr = unur_distr_geometric(fpm,1); par = unur_dari_new(distr); unur_test_par_count_pdf(par,samplesize,1,TESTLOG); gen = unur_init(par); unur_test_count_pdf(gen,samplesize,1,TESTLOG); unur_free(gen); unur_distr_free(distr); distr = unur_distr_multinormal(3,NULL,NULL); par = unur_vnrou_new(distr); unur_test_par_count_pdf(par,samplesize,1,TESTLOG); gen = unur_init(par); unur_test_count_pdf(gen,samplesize,1,TESTLOG); unur_free(gen); unur_distr_free(distr); distr = unur_distr_multinormal_wo_logpdf(3,NULL,NULL); par = unur_vnrou_new(distr); unur_test_par_count_pdf(par,samplesize,1,TESTLOG); gen = unur_init(par); unur_test_count_pdf(gen,samplesize,1,TESTLOG); unur_free(gen); unur_distr_free(distr); /* unur_test_count_urng() */ distr = unur_distr_normal(NULL,0); par = unur_tdr_new(distr); unur_tdr_set_usedars(par,0); gen = unur_init(par); unur_test_count_urn(gen,samplesize,1,TESTLOG); unur_free(gen); unur_distr_free(distr); /* test timing routines */ Rsq = unur_test_timing_R(NULL,NULL,NULL,5,&time_setup,&time_marginal); fprintf(TESTLOG,"\nR^2 = %g, setup time = %g, marginal generation time = %g\n", Rsq, time_setup, time_marginal); Rsq = unur_test_timing_R(NULL,"cont","pinv",5,&time_setup,&time_marginal); fprintf(TESTLOG,"\nR^2 = %g, setup time = %g, marginal generation time = %g\n", Rsq, time_setup, time_marginal); distr = unur_distr_normal(NULL,0); par = unur_tdr_new(distr); Rsq = unur_test_timing_R(par,NULL,NULL,5,&time_setup,&time_marginal); unur_distr_free(distr); fprintf(TESTLOG,"\nR^2 = %g, setup time = %g, marginal generation time = %g\n", Rsq, time_setup, time_marginal); Rsq = unur_test_timing_R(NULL,"normal","pinv",5,&time_setup,&time_marginal); fprintf(TESTLOG,"\nR^2 = %g, setup time = %g, marginal generation time = %g\n", Rsq, time_setup, time_marginal); /* test finished */ FAILED = 0; /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (FAILED) ? 0 : 1; (FAILED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_special() */ /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_test_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_distr_cemp.conf0000644001357500135600000001533214420445767014543 00000000000000############################################################################# [main] [main - data:] # method (for information only: the program scans the file name) method: DISTR_CEMP [main - header:] /* prototypes */ \#define COMPARE_SAMPLE_SIZE (500) \#define VIOLATE_SAMPLE_SIZE (20) ############################################################################# [new] ############################################################################# [set] [set - invalid NULL ptr: distr = NULL; ] unur_distr_cemp_set_data( distr, NULL, 0 ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_cemp_read_data( distr, "junk" ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_cemp_set_hist( distr, NULL, 0, 0., 2. ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_cemp_set_hist_prob( distr, NULL, 0 ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_cemp_set_hist_domain( distr, 0., 2. ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_cemp_set_hist_bins( distr, NULL, 0 ); --> expected_setfailed --> UNUR_ERR_NULL [set - invalid distribution type: distr = unur_distr_discr_new(); ] unur_distr_cemp_set_data( distr, NULL, 0 ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_cemp_read_data( distr, "junk" ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_cemp_set_hist( distr, NULL, 0, 0., 2. ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_cemp_set_hist_prob( distr, NULL, 0 ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_cemp_set_hist_domain( distr, 0., 2. ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_cemp_set_hist_bins( distr, NULL, 0 ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID [set - invalid NULL ptr: distr = unur_distr_cemp_new(); ] unur_distr_cemp_set_data( distr, NULL, 0 ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_cemp_set_hist( distr, NULL, 0, 0., 2. ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_cemp_set_hist_prob( distr, NULL, 0 ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_cemp_set_hist_bins( distr, NULL, 0 ); --> expected_setfailed --> UNUR_ERR_NULL [set - invalid parameters: double data[] = {1.,2.,3.}; distr = unur_distr_cemp_new(); ] unur_distr_cemp_set_data( distr, data, 0 ); --> expected_setfailed --> UNUR_ERR_DISTR_SET unur_distr_cemp_read_data( distr, "there-should-be-no-such-file" ); --> expected_setfailed --> UNUR_ERR_GENERIC unur_distr_cemp_set_hist( distr, data, 0, 0., 2. ); --> expected_setfailed --> UNUR_ERR_DISTR_SET unur_distr_cemp_set_hist_prob( distr, data, 0 ); --> expected_setfailed --> UNUR_ERR_DISTR_SET unur_distr_cemp_set_hist( distr, data, 3, 5., 2. ); --> expected_setfailed --> UNUR_ERR_DISTR_SET unur_distr_cemp_set_hist_domain( distr, 5., 2. ); --> expected_setfailed --> UNUR_ERR_DISTR_SET unur_distr_cemp_set_hist_domain( distr, -UNUR_INFINITY, 2. ); --> expected_setfailed --> UNUR_ERR_DISTR_SET unur_distr_cemp_set_hist_domain( distr, 0., UNUR_INFINITY ); --> expected_setfailed --> UNUR_ERR_DISTR_SET unur_distr_cemp_set_hist_bins( distr, data, 0 ); --> expected_setfailed --> UNUR_ERR_DISTR_SET unur_distr_cemp_set_hist_bins( distr, data, 4 ); --> expected_setfailed --> UNUR_ERR_DISTR_SET [set - invalid parameters: double prob[] = {1.,2.,3.}; double bins[] = {1.,2.,3.,4.}; distr = unur_distr_cemp_new(); unur_distr_cemp_set_hist_prob( distr, prob, 3 ); ] unur_distr_cemp_set_hist_bins( distr, bins, 0 ); --> expected_setfailed --> UNUR_ERR_DISTR_SET unur_distr_cemp_set_hist_bins( distr, bins, 3 ); --> expected_setfailed --> UNUR_ERR_DISTR_SET unur_distr_cemp_set_hist_bins( distr, bins, 5 ); --> expected_setfailed --> UNUR_ERR_DISTR_SET [set - invalid parameters: double prob[] = {1.,2.,3.}; double bins[] = {1.,2.,-3.,4.}; double binsinf[] = {1.,2.,3.,UNUR_INFINITY}; distr = unur_distr_cemp_new(); unur_distr_cemp_set_hist_prob( distr, prob, 3 ); ] unur_distr_cemp_set_hist_bins( distr, bins, 4 ); --> expected_setfailed --> UNUR_ERR_DISTR_SET unur_distr_cemp_set_hist_bins( distr, binsinf, 4 ); --> expected_setfailed --> UNUR_ERR_DISTR_SET ############################################################################# [get] [get - invalid NULL ptr: const double *sample; distr = NULL; ] unur_distr_cemp_get_data( distr, &sample ) --> expected_zero --> UNUR_ERR_NULL [get - invalid distribution type: const double *sample; distr = unur_distr_discr_new(); ] unur_distr_cemp_get_data( distr, &sample ) --> expected_zero --> UNUR_ERR_DISTR_INVALID ############################################################################# [chg] ############################################################################## [init] ############################################################################# [reinit] ############################################################################# [sample] [sample - compare stringparser: double data[] = {1.,2.,3.,4.,5.,6.,7.,8.,9.}; distr = NULL; par = NULL; gen = NULL; ] distr = unur_distr_cemp_new(); unur_distr_cemp_set_data(distr,data,9); par = unur_auto_new(distr); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; gen = unur_str2gen( "cemp; data = (1.,2.,3.,4.,5.,6.,7.,8.,9.)" ); -->compare_sequence_gen unur_free(gen); gen = NULL; gen = unur_str2gen( "cemp; data = (1.,2.,3.,4.,5.,6.,7.,8.,9.) & \ method = auto" ); -->compare_sequence_gen #............................................................................ [sample - compare stringparser: double hist[] = {0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1}; distr = NULL; par = NULL; gen = NULL; ] distr = unur_distr_cemp_new(); unur_distr_cemp_set_hist_prob(distr,hist,9); unur_distr_cemp_set_hist_domain(distr,1.,10.); par = unur_auto_new(distr); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen=NULL; gen = unur_str2gen("cemp; hist_prob=(0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1); \ hist_domain=(1.,10.)"); -->compare_sequence_gen unur_free(gen); gen=NULL; gen = unur_str2gen("cemp; hist_prob=(0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1); \ hist_domain=(1.,10.) & method = hist"); -->compare_sequence_gen ############################################################################# # [validate] ############################################################################# ############################################################################# [verbatim] ############################################################################# unuran-1.11.0/tests/t_ninv.conf0000644001357500135600000005633514420445767013374 00000000000000############################################################################# [main] [main - data:] # method method: NINV [main - header:] \#include /* -- which tests for u-error should be performed (for development) -- */ \#define DEVEL (0) /* whether to run tests in development mode */ \#define ALL (1) \#define UERROR_STANDARDDIST (1) \#define UERROR_QUASIPDF DEVEL \#define UERROR_VANISHINGPDF DEVEL \#define UERROR_TRUNCATED (1) \#define UERROR_UNBOUNDEDPDF (0) \#define UERROR_MULTIMODAL DEVEL \#define UERROR_MULTIMODAL_VANISHINGPDF DEVEL /* variants */ static int UERROR_REGULA = TRUE; static int UERROR_NEWTON = TRUE; /* constants */ ## \#define UERROR_SAMPLESIZE (100000) \#define UERROR_SAMPLESIZE (10000) \#define COMPARE_SAMPLE_SIZE (500) \#define VIOLATE_SAMPLE_SIZE (20) /* Chi-square goodness-of-fit tests some times fail once due to numerical */ /* errors. So we accept more such failure than for other methods. */ \#define CHI2_FAILURES_TOLERATED (5) /* prototypes */ \#define set_debug_flag(par) \ do { \ if (fullcheck) unur_set_debug((par),~0u); \ else unur_set_debug((par),1u); \ } while (0); int ninv_error_experiment( UNUR_PAR *par, int samplesize ); int chg_domain_experiment( UNUR_PAR *par, int samplesize ); int ninv_error_gen_experiment( UNUR_GEN *gen, double u_resolution, const char *method, int samplesize ); ############################################################################# [new] [new - invalid NULL ptr: distr = NULL; ] ~( distr ); --> expected_NULL --> UNUR_ERR_NULL [new - invalid distribution type: distr = unur_distr_discr_new(); ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID [new - data missing in distribution object: distr = unur_distr_cont_new(); ] /* cdf */ ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED ############################################################################# [set] [set - invalid NULL ptr: par = NULL; ] ~_usenewton( par ); --> expected_setfailed --> UNUR_ERR_NULL ~_useregula( par ); --> expected_setfailed --> UNUR_ERR_NULL ~_max_iter( par, 40 ); --> expected_setfailed --> UNUR_ERR_NULL ~_x_resolution( par, 0.001 ); --> expected_setfailed --> UNUR_ERR_NULL ~_u_resolution( par, 0.001 ); --> expected_setfailed --> UNUR_ERR_NULL ~_start( par, 0., 1. ); --> expected_setfailed --> UNUR_ERR_NULL ~_table( par, 100 ); --> expected_setfailed --> UNUR_ERR_NULL [set - invalid parameter object: double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_arou_new(distr); ] ~_usenewton( par ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_useregula( par ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_max_iter( par, 40 ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_x_resolution( par, 0.001 ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_u_resolution( par, 0.001 ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_start( par, 0., 1. ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_table( par, 100 ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID unur_par_free(par); [set - invalid parameters: double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_ninv_new(distr); ] ~_max_iter( par, 0 ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_x_resolution( par, 1e-30 ); --> none --> UNUR_ERR_PAR_SET ~_u_resolution( par, 1e-30 ); --> none --> UNUR_ERR_PAR_SET unur_par_free(par); ############################################################################# # [get] ############################################################################# [chg] [chg - invalid generator object: double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); unur_distr_cont_set_domain(distr,-1.,2.); par = unur_tdr_new(distr); unur_set_debug(par,0); gen = unur_init( par ); <-- ! NULL ] ~_max_iter( gen, 100 ); --> expected_setfailed --> UNUR_ERR_GEN_INVALID ~_x_resolution( gen, 1.e-10); --> expected_setfailed --> UNUR_ERR_GEN_INVALID ~_u_resolution( gen, 1.e-10); --> expected_setfailed --> UNUR_ERR_GEN_INVALID ~_truncated( gen, 0., 1. ); --> expected_setfailed --> UNUR_ERR_GEN_INVALID [chg - invalid parameters: double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); unur_distr_cont_set_domain(distr,-1.,2.); par = unur_ninv_new(distr); unur_set_debug(par,0); gen = unur_init( par ); <-- ! NULL ] ~_max_iter( gen, 0 ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_x_resolution( gen, 1.e-30); --> none --> UNUR_ERR_PAR_SET ~_u_resolution( gen, 1.e-30); --> none --> UNUR_ERR_PAR_SET ~_truncated( gen, 1., 0. ); --> expected_setfailed --> UNUR_ERR_DISTR_SET ~_truncated( gen, -2., 0. ); --> none --> UNUR_ERR_DISTR_SET ~_truncated( gen, 0., 10. ); --> none --> UNUR_ERR_DISTR_SET ############################################################################# [init] [init - invalid NULL ptr: par = NULL; ] unur_init( par ); --> expected_NULL --> UNUR_ERR_NULL ############################################################################# [reinit] [reinit - does not exist: distr = unur_distr_normal(NULL,0); par = unur_ninv_new(distr); gen = unur_init( par ); <-- ! NULL ] unur_reinit( gen ); --> expected_reinit ############################################################################# [sample] [sample - invalid NULL ptr: gen = NULL; ] unur_ninv_eval_approxinvcdf(gen,0.5); --> expected_INFINITY --> UNUR_ERR_NULL [sample - invalid generator object: distr = unur_distr_normal(NULL,0); par = unur_hinv_new(distr); gen = unur_init(par); <-- ! NULL ] unur_ninv_eval_approxinvcdf(gen,0.5); --> expected_INFINITY --> UNUR_ERR_GEN_INVALID [sample - invalid domain: distr = unur_distr_normal(NULL,0); par = unur_ninv_new(distr); unur_set_debug(par,0); gen = unur_init( par ); <-- ! NULL ] unur_ninv_eval_approxinvcdf(gen,1.5); --> expected_INFINITY --> UNUR_ERR_DOMAIN unur_ninv_eval_approxinvcdf(gen,-0.5); --> expected_negINFINITY --> UNUR_ERR_DOMAIN #..................................................................... [sample - compare clone: UNUR_GEN *clone; distr = unur_distr_normal(NULL,0); par = NULL; gen = NULL; ] /* original generator object */ par = unur_ninv_new(distr); gen = unur_init(par); -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen #..................................................................... [sample - compare reinit: distr = unur_distr_normal(NULL,0); par = NULL; gen = NULL; ] /* original generator object */ par = unur_ninv_new(distr); gen = unur_init(par); -->compare_sequence_gen_start /* reinit */ unur_reinit(gen); -->compare_sequence_gen #..................................................................... [sample - compare stringparser: double fpar[] = {3.,4.}; distr = NULL; par = NULL; gen = NULL; ] distr = unur_distr_gamma(fpar,2); unur_distr_cont_set_domain(distr,2.,UNUR_INFINITY); par = unur_ninv_new(distr); unur_ninv_set_max_iter(par,10); unur_ninv_set_start(par,4.,10.); unur_ninv_set_table(par,100); unur_ninv_set_usenewton(par); unur_ninv_set_x_resolution(par,1.E-6); unur_set_debug(par,1u); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "gamma(3.,4.); domain = 2,infinity & \ method = ninv; max_iter = 10; start = 4., 10.; table = 100; \ usenewton; x_resolution = 1.E-6; debug = 0x1" ); -->compare_sequence_gen unur_free(gen); gen = NULL; distr = unur_distr_gamma(fpar,2); unur_distr_cont_set_domain(distr,2.,UNUR_INFINITY); par = unur_ninv_new(distr); unur_ninv_set_useregula(par); unur_set_debug(par,1u); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "gamma(3.,4.); domain = (2,inf) & method = ninv; useregula; debug = 0x1" ); -->compare_sequence_gen ############################################################################# [validate] [validate - generators:] # default (Newton) par[0] = unur_ninv_new(@distr@); unur_ninv_set_usenewton(par); # no table, starting points (Newton) par[1] = unur_ninv_new(@distr@); unur_ninv_set_usenewton(par); unur_ninv_set_start(par, 0.1, 0.9); # use small table (Newton) par[2] = unur_ninv_new(@distr@); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); # use large table (Newton) par[3] = unur_ninv_new(@distr@); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); # default with truncated distribution (Newton) par[4] = unur_ninv_new(@distr@); unur_ninv_set_usenewton(par); unur_ninv_chg_truncated(gen,0.5,0.9); # use small table with truncated distribution (Newton) par[5] = unur_ninv_new(@distr@); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); unur_ninv_chg_truncated(gen,0.5,0.9); # use large table with truncated distribution (Newton) par[6] = unur_ninv_new(@distr@); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); unur_ninv_chg_truncated(gen,0.5,0.9); # default with changed pdf parameters after setup (Newton) { UNUR_DISTR *dg =NULL; par[7] = unur_ninv_new(@distr@); unur_ninv_set_usenewton(par); fpm[0] = 2.; fpm[1] = 4.; dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } # use small table with changed pdf parameters after setup (Newton) { UNUR_DISTR *dg =NULL; par[8] = unur_ninv_new(@distr@); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } # use large table with changed pdf parameters after setup (Newton) { UNUR_DISTR *dg =NULL; par[9] = unur_ninv_new(@distr@); unur_ninv_set_usenewton(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } # default (regula falsi) par[10] = unur_ninv_new(@distr@); unur_ninv_set_useregula(par); # no table, starting points (regula falsi) par[11] = unur_ninv_new(@distr@); unur_ninv_set_useregula(par); unur_ninv_set_start(par, 0.1, 0.9); # use small table (regula falsi) par[12] = unur_ninv_new(@distr@); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); # use large table (regula falsi) par[13] = unur_ninv_new(@distr@); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); # default with truncated distribution (regula falsi) par[14] = unur_ninv_new(@distr@); unur_ninv_set_useregula(par); unur_ninv_chg_truncated(gen,0.5,0.9); # use small table with truncated distribution (regula falsi) par[15] = unur_ninv_new(@distr@); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); unur_ninv_chg_truncated(gen,0.5,0.9); # use large table with truncated distribution (regula falsi) par[16] = unur_ninv_new(@distr@); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); unur_ninv_chg_truncated(gen,0.5,0.9); # default with changed pdf parameters after setup (regula falsi) { UNUR_DISTR *dg =NULL; par[17] = unur_ninv_new(@distr@); unur_ninv_set_useregula(par); fpm[0] = 2.; fpm[1] = 4.; dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } # use small table with changed pdf parameters after setup (regula falsi) { UNUR_DISTR *dg =NULL; par[18] = unur_ninv_new(@distr@); unur_ninv_set_useregula(par); unur_ninv_set_table(par,11); fpm[0] = 2.; fpm[1] = 4.; dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } # use large table with changed pdf parameters after setup (regula falsi) { UNUR_DISTR *dg =NULL; par[19] = unur_ninv_new(@distr@); unur_ninv_set_useregula(par); unur_ninv_set_table(par,1000); fpm[0] = 2.; fpm[1] = 4.; dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } [validate - distributions:] # Beta distributions fpm[0] = 1.; fpm[1] = 2.; distr[0] = unur_distr_beta(fpm,2); fpm[0] = 1.; fpm[1] = 5.; distr[1] = unur_distr_beta(fpm,2); fpm[0] = 1.; fpm[1] = 100.; distr[2] = unur_distr_beta(fpm,2); fpm[0] = 3.; fpm[1] = 4.; distr[3] = unur_distr_beta(fpm,2); fpm[0] = 5.; fpm[1] = 100.; distr[4] = unur_distr_beta(fpm,2); fpm[0] = 500.; fpm[1] = 300.; distr[5] = unur_distr_beta(fpm,2); fpm[0] = 5.; fpm[1] = 10.; fpm[2] = -3.; fpm[3] = 15.; distr[6] = unur_distr_beta(fpm,4); fpm[0] = 0.5; fpm[1] = 3.; distr[28] = unur_distr_beta(fpm,2); fpm[0] = 5.; fpm[1] = 0.3; distr[29] = unur_distr_beta(fpm,2); fpm[0] = 0.5; fpm[1] = 0.4; distr[30] = unur_distr_beta(fpm,2); # Cauchy distributions distr[7] = unur_distr_cauchy(NULL,0); fpm[0] = 1.; fpm[1] = 20.; distr[8] = unur_distr_cauchy(fpm,2); # Exponential distributions distr[24] = unur_distr_exponential(NULL,0); fpm[0] = 30.; fpm[1] = -5.; distr[25] = unur_distr_exponential(fpm,2); # Gamma distributions fpm[0] = 1.; distr[9] = unur_distr_gamma(fpm,1); fpm[0] = 2.; distr[10] = unur_distr_gamma(fpm,1); fpm[0] = 3.; distr[11] = unur_distr_gamma(fpm,1); fpm[0] = 10.; distr[12] = unur_distr_gamma(fpm,1); fpm[0] = 1000.; distr[13] = unur_distr_gamma(fpm,1); fpm[0] = 5.; fpm[1] = 1000.; distr[14] = unur_distr_gamma(fpm,2); fpm[0] = 5.; fpm[1] = 1.e-5; distr[15] = unur_distr_gamma(fpm,2); fpm[0] = 5.; fpm[1] = 10.; fpm[2] = 1000; distr[16] = unur_distr_gamma(fpm,3); fpm[0] = 0.5; distr[31] = unur_distr_gamma(fpm,1); fpm[0] = 0.2; distr[32] = unur_distr_gamma(fpm,1); # Laplace distributions distr[26] = unur_distr_laplace(NULL,0); fpm[0] = -10.; fpm[1] = 100.; distr[27] = unur_distr_laplace(fpm,2); # Normal distributions distr[17] = unur_distr_normal(NULL,0); fpm[0] = 1.; fpm[1] = 1.e-5; distr[18] = unur_distr_normal(fpm,2); fpm[0] = 0.; fpm[1] = 1.e+5; distr[19] = unur_distr_normal(fpm,2); # Uniform distributions distr[20] = unur_distr_uniform(NULL,0); fpm[0] = 1.; fpm[1] = 20.; distr[21] = unur_distr_uniform(fpm,2); # truncated distributions distr[22] = unur_distr_cauchy(NULL,0); unur_distr_cont_set_domain(distr[22],0.1,1.); unur_distr_cont_upd_mode(distr[22]); unur_distr_cont_upd_pdfarea(distr[22]); # domain exceeds support of pdf fpm[0] = 3.; fpm[1] = 4.; distr[23] = unur_distr_beta(fpm,2); unur_distr_cont_set_domain(distr[23],-2.,5.); # number of distributions: 33 [validate - test chi2:] # + ... pass test # 0 ... fail to initialize generator # - ... fail test # . ... do not run test # # ... comment # # generators: # [0] ... (Newton) default (no table) (but with increased number of max iterations) # [1] ... (Newton) no table, starting points # [2] ... (Newton) use small table # [3] ... (Newton) use large table # [4] ... (Newton) default with truncated distribution # [5] ... (Newton) use small table with truncated distribution # [6] ... (Newton) use large table with truncated distribution # [7] ... (Newton) default with changed pdf parameters after setup # [8] ... (Newton) use small table with changed pdf parameters after setup # [9] ... (Newton) use large table with changed pdf parameters after setup # # [10] ... (regula) default (no table) # [11] ... (regula) no table, starting points # [12] ... (regula) use small table # [13] ... (regula) use large table # [14] ... (regula) default with truncated distribution # [15] ... (regula) use small table with truncated distribution # [16] ... (regula) use large table with truncated distribution # [17] ... (regula) default with changed pdf parameters after setup # [18] ... (regula) use small table with changed pdf parameters after setup # [19] ... (regula) use large table with changed pdf parameters after setup # # 1 1 1 1 1 1 1 1 1 1 # 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 # distribution #------------------------------------------------------------------------------------------ x <0> + + + + + + + + + + + + + + + + + + + + # beta (1, 2) <1> + + + + + + + + + + + + + + + + + + + + # beta (1, 5) x <2> + + + + + + + + + + + + + + + + + + + + # beta (1, 100) <3> + + + + + + + + + + + + + + + + + + + + # beta (3, 4) <4> x+ x+ x+ + x+ x+ + + + + x+ x+ x+ + x+ x+ + + + + # beta (5, 100) <5> x+ x+ x+ + x+ x+ + + + + x+ x+ x+ + x+ x+ + + + + # beta (500, 300) <6> + + + + + + + + + + + + + + + + + + + + # beta (5, 10, -3, 15) <28> x+ x+ x+ + x+ x+ + + + + x+ x+ x+ + x+ x+ + + + + # beta (0.5, 3) <29> x+ x+ x. + x+ x+ + + + + x+ x+ x+ + x+ x+ + + + + # beta (5, 0.3) <30> x+ x+ x. + x+ x+ + + + + x+ x+ x+ + x+ x+ + + + + # beta (0.5, 0.4) <7> + + + + + + + + + + + + + + + + + + + + # cauchy () <8> + + + + + + + + + + + + + + + + + + + + # cauchy (1, 20) <24> + + + + + + + + + + + + + + + + + + + + # exponential () <25> + + + + + + + + + + + + + + + + + + + + # exponential (30, -5) x <9> + + + + + + + + + + + + + + + + + + + + # gamma (1) <10> + + + + + + + + + + + + + + + + + + + + # gamma (2) <11> + + + + + + + + + + + + + + + + + + + + # gamma (3) <12> + . + + + + + + + + + + + + + + + + + + # gamma (10) x<13> + . + + + + + + + + + + + + + + + + + + # gamma (1000) <14> + . + + + + + + + + + + + + + + + + + + # gamma (5, 1000, 0) x<15> + + + + + + + + + + + + + + + + + + + + # gamma (5, 1e-05, 0) x<16> + + + + + + + + + + + . + + + + + + + + # gamma (5, 10, 1000) <31> + + + + + + + + + + + + + + + + + + + + # gamma (0.5) <32> + + + + + + + + + + + + + + + + + + + + # gamma (0.2) <26> + + + + + + + + + + + + + + + + + + + + # laplace () <27> + + + + + + + + + + + + + + + + + + + + # laplace (-10, 100) <17> + + + + + + + + + + + + + + + + + + + + # normal () x<18> + + + + + + + + + + + + + + + + + + + + # normal (1, 1e-05) <19> + + + + + + + + + + + + + + + + + + + + # normal (1, 1e+05) <20> + + + + + + + + + + + + + + + + + + + + # uniform () <21> + + + + + + + + + + + + + + + + + + + + # uniform (1, 20) <22> + + + + + + + + + + + + + + + + + + + + # cauchy () - truncated <23> + + + + + + + + + + + + + + + + + + + + # beta () - domain superset of support ############################################################################# [special] [special - decl:] int samplesize = UERROR_SAMPLESIZE; int errorsum = 0; # double fpar[4]; # double cpoints[10]; UNUR_DISTR *distr; UNUR_PAR *par; [special - start:] /* test for maximal u-error */ printf("\n[test maximal u-error]"); fprintf(TESTLOG,"\n* Test maximal u-error *\n"); ## ---------------------------------------------------- if (UERROR_STANDARDDIST) { /* --------------------------- */ printf("\nStandard distributions:\n"); fprintf(TESTLOG,"\n--- Standard distributions --- \n\n"); ## --- Normal --- if (ALL) { printf(" normal"); distr = unur_distr_normal(NULL,0); par = unur_ninv_new(distr); errorsum += ninv_error_experiment(par,samplesize); unur_distr_free(distr); fprintf(TESTLOG,"\n"); } } /* endif (UERROR_STANDARDDIST) */ ## ---------------------------------------------------- /* test finished */ FAILED = (errorsum < 2) ? 0 : 1; ############################################################################# [verbatim] ############################################################################# # # routines for special tests # ############################################################################# /*****************************************************************************/ /* run unur_test_u_error for a particular generator object and print result */ int ninv_error_gen_experiment( UNUR_GEN *gen, /* generator object */ double u_resolution, /* maximal tolerated u-error */ const char *method, /* chosen method */ int samplesize ) /* sample size for error experiment */ /* returns 0 if maxerror < u_resolution, errorcode otherwise */ { int i, nfpar; const double *fpar; const UNUR_DISTR *distr = unur_get_distr(gen); const char *genid = unur_get_genid(gen); double score; /* print data about distribution */ fprintf(TESTLOG,"%s: %s distribution",genid,unur_distr_get_name(distr)); nfpar = unur_distr_cont_get_pdfparams(distr,&fpar); if (nfpar) { fprintf(TESTLOG," with parameters "); for(i=0;i use regula falsi */ /* variant==1 --> use Newton */ /* variant==2 --> use bisection */ switch (variant) { case 0: /* run regula */ method = "regula"; if (UERROR_REGULA) printf(""); else continue; break; case 1: /* run Newton */ method = "newton"; if (UERROR_NEWTON) printf(""); else continue; break; case 2: /* run bisection method */ method = "bisect"; if (UERROR_NEWTON) printf(""); else continue; break; default: continue; } for ( u_resolution = 1.e-6; u_resolution > 1.e-10; u_resolution *= 0.01 ) { /* make a working copy */ par_clone = _unur_par_clone(par); /* set variant */ switch (variant) { case 0: unur_ninv_set_useregula(par_clone); break; case 1: unur_ninv_set_usenewton(par_clone); break; case 2: unur_ninv_set_usebisect(par_clone); break; } /* create generator object */ unur_ninv_set_x_resolution(par_clone,-1.); unur_ninv_set_u_resolution(par_clone,u_resolution); set_debug_flag(par_clone); gen = unur_init(par_clone); /* run test */ errorsum += ninv_error_gen_experiment(gen, u_resolution, method, samplesize); fprintf(TESTLOG,"\n"); /* clear memory */ unur_free(gen); } } unur_par_free(par); return errorsum; } /* end of ninv_error_experiment() */ /*****************************************************************************/ ############################################################################# unuran-1.11.0/tests/t_empk.c0000644001357500135600000006230114430713513012625 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for EMPK **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); int unur_empk_set_verify( UNUR_PAR *par, int verify); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ #define COMPARE_SAMPLE_SIZE (10000) #define VIOLATE_SAMPLE_SIZE (20) /* sample size for Gaussian distributet sample */ #define samplesize (5000) UNUR_DISTR *get_distr_with_data( void ); UNUR_DISTR *get_distr_with_Gaussian_data( void ); double urng_ed (void *dummy); /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ /*---------------------------------------------------------------------------*/ UNUR_DISTR *get_distr_with_data( void ) { #define PV_SIZE 20 double pv[PV_SIZE]; UNUR_DISTR *distr; int i; for (i=0; itime = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [set] */ void test_set (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[set "); fflush(stdout); fprintf(TESTLOG,"\n[set]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,54,(unur_empk_set_kernel(par,UNUR_DISTR_GAUSSIAN)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,54,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,57,(unur_empk_set_kernelgen(par, NULL, 1., 1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,57,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,60,(unur_empk_set_beta(par,1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,60,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,63,(unur_empk_set_smoothing(par,1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,63,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,66,(unur_empk_set_varcor(par,TRUE)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,66,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,69,(unur_empk_set_positive(par,TRUE)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,69,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* invalid parameter object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = unur_distr_normal(NULL,0); par = unur_cstd_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,77,(unur_empk_set_kernel(par,UNUR_DISTR_GAUSSIAN)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,77,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,80,(unur_empk_set_kernelgen(par, NULL, 1., 1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,80,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,83,(unur_empk_set_beta(par,1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,83,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,86,(unur_empk_set_smoothing(par,1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,86,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,89,(unur_empk_set_varcor(par,TRUE)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,89,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,92,(unur_empk_set_positive(par,TRUE)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,92,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = get_distr_with_data(); par = unur_empk_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,101,(unur_empk_set_kernel(par,UNUR_DISTR_BETA)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,101,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,104,(unur_empk_set_kernelgen(par, NULL, -1., 1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,104,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,107,(unur_empk_set_beta(par,-1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,107,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,110,(unur_empk_set_smoothing(par,-1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,110,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_set() */ /*---------------------------------------------------------------------------*/ /* [chg] */ void test_chg (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[chg "); fflush(stdout); fprintf(TESTLOG,"\n[chg]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid generator object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_cstd_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 124, gen ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,128,(unur_empk_chg_smoothing(gen,1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,128,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,131,(unur_empk_chg_varcor(gen,TRUE)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,131,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = get_distr_with_data(); par = unur_empk_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 135, gen ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,139,(unur_empk_chg_smoothing(gen,-1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,139,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_chg() */ /*---------------------------------------------------------------------------*/ /* [init] */ void test_init (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[init "); fflush(stdout); fprintf(TESTLOG,"\n[init]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,150,(unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,150,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* run init */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = get_distr_with_data(); par = unur_empk_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 155, gen ); unur_reset_errno(); ; n_tests_failed += (check_errorcode(TESTLOG,159,0x0u)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_init() */ /*---------------------------------------------------------------------------*/ /* [reinit] */ void test_reinit (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[reinit "); fflush(stdout); fprintf(TESTLOG,"\n[reinit]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* does not exist */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = get_distr_with_data(); par = unur_empk_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 167, gen ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,171,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,171,UNUR_ERR_NO_REINIT)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,174,(unur_sample_cont( gen )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,174,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_reinit() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* compare clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; UNUR_GEN *clone; UNUR_GEN *kerngen; distr = get_distr_with_data(); par = unur_empk_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 184, gen ); unur_reset_errno(); /* default generator object */; n_tests_failed += (compare_sequence_gen_start(TESTLOG,188,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,194,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* set kernel generator */ unur_free(gen); par = unur_empk_new(distr); kerngen = unur_str2gen("normal & method=cstd"); unur_empk_set_kernelgen(par,kerngen,0.7763884,1.); gen = unur_init( par ); n_tests_failed += (compare_sequence_gen(TESTLOG,202,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* set kernel */ unur_free(gen); unur_free(kerngen); par = unur_empk_new(distr); unur_empk_set_kernel(par,UNUR_DISTR_GAUSSIAN); gen = unur_init( par ); n_tests_failed += (compare_sequence_gen(TESTLOG,209,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare stringparser */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double data[] = {1.,2.,3.,4.,5.,6.,7.,8.,9.}; distr = NULL; par = NULL; gen = NULL; unur_reset_errno(); distr = unur_distr_cemp_new(); unur_distr_cemp_set_data(distr,data,9); par = unur_empk_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,223,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "cemp; data = (1.,2.,3.,4.,5.,6.,7.,8.,9.) & \ method = empk" ); n_tests_failed += (compare_sequence_gen(TESTLOG,229,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; distr = unur_distr_cemp_new(); unur_distr_cemp_set_data(distr,data,9); par = unur_empk_new(distr); unur_empk_set_beta(par,1.2); unur_empk_set_kernel(par,UNUR_DISTR_UNIFORM); unur_empk_set_positive(par,TRUE); unur_empk_set_smoothing(par,0.); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,240,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "cemp; data = (1.,2.,3.,4.,5.,6.,7.,8.,9.) & \ method = empk; beta = 1.2; kernel = 2001; positive; smoothing = 0." ); n_tests_failed += (compare_sequence_gen(TESTLOG,246,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; distr = unur_distr_cemp_new(); unur_distr_cemp_set_data(distr,data,9); par = unur_empk_new(distr); unur_empk_set_varcor(par,TRUE); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,254,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "cemp; data = (1.,2.,3.,4.,5.,6.,7.,8.,9.) & \ method = empk; varcor" ); n_tests_failed += (compare_sequence_gen(TESTLOG,260,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* [validate] */ /*---------------------------------------------------------------------------*/ /* [validate] */ void test_validate (void) { /* suppress GCC compiler warning */ GCC_DIAG_OFF(unused-variable) UNUR_DISTR *distr[1]; UNUR_PAR *par; UNUR_GEN *gen; double *darray; double fpm[10]; int n_tests_failed; int rcode; /* start test */ printf("[validate "); fflush(stdout); fprintf(TESTLOG,"\n[validate]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* distributions: 1 */ { distr[0] = get_distr_with_Gaussian_data(); } /* timing */ stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); printf("\n(chi^2) "); fflush(stdout); /* chi^2 tests: 7 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nChi^2 Test:\n"); /* distribution [0] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_empk_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_empk_new(distr_localcopy); unur_empk_set_varcor(par, TRUE); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_empk_new(distr_localcopy); unur_empk_set_kernel( par, UNUR_DISTR_GAUSSIAN); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_empk_new(distr_localcopy); unur_empk_set_kernel( par, UNUR_DISTR_EPANECHNIKOV); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_empk_new(distr_localcopy); unur_empk_set_kernel( par, UNUR_DISTR_BOXCAR); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_empk_new(distr_localcopy); unur_empk_set_kernel( par, UNUR_DISTR_STUDENT); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_empk_new(distr_localcopy); unur_empk_set_kernel( par, UNUR_DISTR_LOGISTIC); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); /* free distributions */ unur_distr_free(distr[0]); /* test finished */ test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; /* we accept CHI2_FAILURES_TOLERATED failures */ (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_validate */ /* enable GCC compiler warning */ GCC_DIAG_ON(unused-variable) /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_empk_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_dsrou.c0000644001357500135600000020775114430713513013037 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for DSROU **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ int unur_dsrou_set_pedantic( struct unur_par *par, int pedantic ); double pmf( int k, const UNUR_DISTR *distr ); double pmf_invalidmode( int k, const UNUR_DISTR *distr ); double pmf_geom05( int k, const UNUR_DISTR *distr ); double cdf_geom05( int k, const UNUR_DISTR *distr ); #define COMPARE_SAMPLE_SIZE (10000) #define VIOLATE_SAMPLE_SIZE (10000) /* #define SEED (298346) */ /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ /* pmf that does not work */ double pmf( int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return ((k==2) ? 0. : pow(0.5,(double)k)); } /* end of pmf */ double pmf_invalidmode( int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return ((k==2) ? 0.01 : pow(0.5,(double)k)); } /* end of pmf */ /* pmf for geometric(0.5) distribution with domain (1,inf) */ double pmf_geom05( int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return (pow(0.5,(double)k)); } double cdf_geom05( int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return (1.-pow(0.5,(double)k)); } /* dummy function */ int unur_dsrou_set_pedantic( struct unur_par *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) { return 1; } /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,34,(unur_dsrou_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,34,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; distr = unur_distr_cont_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,40,(unur_dsrou_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,40,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* data missing in distribution object */ UNUR_DISTR *distr = NULL; distr = unur_distr_discr_new(); unur_reset_errno(); /* pmf, mode, pmfsum */ n_tests_failed += (check_expected_NULL(TESTLOG,47,(unur_dsrou_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,47,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [set] */ void test_set (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[set "); fflush(stdout); fprintf(TESTLOG,"\n[set]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,57,(unur_dsrou_set_cdfatmode(par,0.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,57,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,60,(unur_dsrou_set_verify(par,1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,60,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* invalid parameter object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double fpar[2] = {10,0.63}; distr = unur_distr_binomial(fpar,2); par = unur_dari_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,68,(unur_dsrou_set_cdfatmode(par,0.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,68,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,71,(unur_dsrou_set_verify(par,1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,71,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double fpar[2] = {10.,0.63}; distr = unur_distr_binomial(fpar,2); par = unur_dsrou_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,81,(unur_dsrou_set_cdfatmode(par,-1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,81,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_set() */ /*---------------------------------------------------------------------------*/ /* [chg] */ void test_chg (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[chg "); fflush(stdout); fprintf(TESTLOG,"\n[chg]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid generator object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[2] = {10.,0.63}; distr = unur_distr_binomial(fpar,2); par = unur_dari_new(distr); unur_set_debug(par,0); gen = unur_init( par ); abort_if_NULL(TESTLOG, 97, gen ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,101,(unur_dsrou_chg_verify(gen,1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,101,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,104,(unur_dsrou_chg_cdfatmode(gen,1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,104,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[2] = {10.,0.63}; distr = unur_distr_binomial(fpar,2); par = unur_dsrou_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 110, gen ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,114,(unur_dsrou_chg_cdfatmode(gen,-1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,114,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_chg() */ /*---------------------------------------------------------------------------*/ /* [init] */ void test_init (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[init "); fflush(stdout); fprintf(TESTLOG,"\n[init]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,125,(unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,125,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* invalid data */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = unur_distr_discr_new(); unur_distr_discr_set_pmf(distr,pmf); unur_distr_discr_set_mode(distr,2); unur_distr_discr_set_pmfsum(distr,1.); par = unur_dsrou_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,136,(unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,136,UNUR_ERR_GEN_DATA)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* data missing in distribution object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = unur_distr_discr_new(); par = NULL; unur_reset_errno(); /* mode, pmfsum */ unur_distr_discr_set_pmf(distr,pmf); par = unur_dsrou_new( distr ); n_tests_failed += (check_expected_NULL(TESTLOG,146,(unur_init(par)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,146,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* pmfsum */ unur_distr_discr_set_mode(distr,0); par = unur_dsrou_new( distr ); n_tests_failed += (check_expected_NULL(TESTLOG,152,(unur_init(par)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,152,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_init() */ /*---------------------------------------------------------------------------*/ /* [reinit] */ void test_reinit (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[reinit "); fflush(stdout); fprintf(TESTLOG,"\n[reinit]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* exist */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[2] = {10.,0.63}; distr = unur_distr_binomial(fpar,2); par = unur_dsrou_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 161, gen ); unur_reset_errno(); n_tests_failed += (check_expected_reinit(TESTLOG,165,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_reinit() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* compare */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double fpar[2] = {10.,0.63}; distr = unur_distr_binomial(fpar,2); par = NULL; unur_reset_errno(); /* default algorithm */ par = unur_dsrou_new(distr); n_tests_failed += (compare_sequence_par_start(TESTLOG,178,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* default algorithm - verifying mode */ par = unur_dsrou_new(distr); unur_dsrou_set_verify(par,1); n_tests_failed += (compare_sequence_par(TESTLOG,183,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* violate condition */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double fpar[2] = {10.,0.63}; distr = unur_distr_binomial(fpar,2); par = NULL; unur_reset_errno(); /* use cdf at mode */ par = unur_dsrou_new(distr); unur_dsrou_set_cdfatmode(par,0.1); run_verify_generator (TESTLOG,195,par); n_tests_failed += (check_errorcode(TESTLOG,195,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* compare clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; UNUR_GEN *clone; double fpar[] = {10,0.3}; distr = unur_distr_binomial(fpar,2); par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_dsrou_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,209,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,215,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare reinit */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[] = {10,0.3}; distr = unur_distr_binomial(fpar,2); par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_dsrou_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,228,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* reinit */ unur_reinit(gen); n_tests_failed += (compare_sequence_gen(TESTLOG,232,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare stringparser */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[] = {3.}; distr = NULL; par = NULL; gen = NULL; unur_reset_errno(); distr = unur_distr_poisson(fpar,1); par = unur_dsrou_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,245,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "poisson(3.) & method = dsrou" ); n_tests_failed += (compare_sequence_gen(TESTLOG,250,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; distr = unur_distr_poisson(fpar,1); par = unur_dsrou_new(distr); unur_dsrou_set_cdfatmode(par,0.3); unur_dsrou_set_verify(par,1); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,259,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "poisson(3.) & method = dsrou; cdfatmode=0.3; verify=on" ); n_tests_failed += (compare_sequence_gen(TESTLOG,264,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* [validate] */ /*---------------------------------------------------------------------------*/ /* [validate] */ void test_validate (void) { /* suppress GCC compiler warning */ GCC_DIAG_OFF(unused-variable) UNUR_DISTR *distr[16]; UNUR_PAR *par; UNUR_GEN *gen; double *darray; double fpm[10]; int n_tests_failed; int rcode; /* start test */ printf("[validate "); fflush(stdout); fprintf(TESTLOG,"\n[validate]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* distributions: 16 */ { fpm[0] = 0.5; distr[0] = unur_distr_geometric(fpm,1); } { fpm[0] = 0.1; distr[1] = unur_distr_geometric(fpm,1); } { fpm[0] = 0.001; distr[2] = unur_distr_geometric(fpm,1); } { fpm[0] = 0.1; distr[3] = unur_distr_logarithmic(fpm,1); } { fpm[0] = 0.9; distr[4] = unur_distr_logarithmic(fpm,1); } { fpm[0] = 0.5; fpm[1] = 10.; distr[5] = unur_distr_negativebinomial(fpm,2); } { fpm[0] = 0.7; fpm[1] = 5.; distr[6] = unur_distr_negativebinomial(fpm,2); } { fpm[0] = 0.1; fpm[1] = 20.; distr[7] = unur_distr_negativebinomial(fpm,2); } { fpm[0] = 3.; distr[8] = unur_distr_poisson(fpm,1); } { fpm[0] = 50.; distr[9] = unur_distr_poisson(fpm,1); } { fpm[0] = 2.; fpm[1] = 1.; distr[10] = unur_distr_zipf(fpm,2); } { fpm[0] = 20.; fpm[1] = 0.8; distr[11] = unur_distr_binomial(fpm,2); } { fpm[0] = 2000.; fpm[1] = 0.0013; distr[12] = unur_distr_binomial(fpm,2); } { fpm[0] = 2000.; fpm[1] = 200.; fpm[2] = 20; distr[13] = unur_distr_hypergeometric(fpm,3); } { fpm[0] = 2000.; fpm[1] = 200.; fpm[2] = 220; distr[14] = unur_distr_hypergeometric(fpm,3); } { distr[15] = unur_distr_discr_new(); unur_distr_discr_set_pmf(distr[15],pmf_geom05); unur_distr_discr_set_cdf(distr[15],cdf_geom05); unur_distr_set_name(distr[15],"test find_mode"); } /* timing */ stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); printf("\n(chi^2) "); fflush(stdout); /* chi^2 tests: 64 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nChi^2 Test:\n"); /* distribution [0] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_dsrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_cdfatmode(par,Fmode); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { UNUR_DISTR *dg =NULL; par = unur_dsrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_dsrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_cdfatmode(par,Fmode); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { UNUR_DISTR *dg =NULL; par = unur_dsrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [2] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_dsrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); { double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_cdfatmode(par,Fmode); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); { UNUR_DISTR *dg =NULL; par = unur_dsrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [3] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_dsrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); { double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_cdfatmode(par,Fmode); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); { UNUR_DISTR *dg =NULL; par = unur_dsrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [4] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_dsrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); { double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_cdfatmode(par,Fmode); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); { UNUR_DISTR *dg =NULL; par = unur_dsrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [5] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_dsrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); { double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_cdfatmode(par,Fmode); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); { UNUR_DISTR *dg =NULL; par = unur_dsrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [6] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_dsrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); { double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_cdfatmode(par,Fmode); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); { UNUR_DISTR *dg =NULL; par = unur_dsrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [7] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_dsrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); { double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_cdfatmode(par,Fmode); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); { UNUR_DISTR *dg =NULL; par = unur_dsrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [8] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_dsrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); { double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_cdfatmode(par,Fmode); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); { UNUR_DISTR *dg =NULL; par = unur_dsrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [9] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_dsrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); { double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_cdfatmode(par,Fmode); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); { UNUR_DISTR *dg =NULL; par = unur_dsrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [11] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_dsrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); { double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_cdfatmode(par,Fmode); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); { UNUR_DISTR *dg =NULL; par = unur_dsrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); { UNUR_DISTR *dg =NULL; par = unur_dsrou_new(distr_localcopy); fpm[0] = 10.; fpm[1] = 0.63; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [12] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_dsrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); { double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_cdfatmode(par,Fmode); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); { UNUR_DISTR *dg =NULL; par = unur_dsrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); { UNUR_DISTR *dg =NULL; par = unur_dsrou_new(distr_localcopy); fpm[0] = 10.; fpm[1] = 0.63; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [13] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_dsrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); { double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_cdfatmode(par,Fmode); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); { UNUR_DISTR *dg =NULL; par = unur_dsrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [14] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_dsrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); { double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_cdfatmode(par,Fmode); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); { UNUR_DISTR *dg =NULL; par = unur_dsrou_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [15] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_dsrou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); printf("\n(verify hat) "); fflush(stdout); /* verify hat tests: 64 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nVerify Hat Test (squeeze <= PDF <= hat):\n"); /* distribution [0] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_dsrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_pedantic(par,0); unur_dsrou_set_cdfatmode(par,Fmode); } gen = unur_init(par); if (gen) unur_dsrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { UNUR_DISTR *dg =NULL; par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_dsrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_dsrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_pedantic(par,0); unur_dsrou_set_cdfatmode(par,Fmode); } gen = unur_init(par); if (gen) unur_dsrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { UNUR_DISTR *dg =NULL; par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_dsrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [2] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_dsrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); { double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_pedantic(par,0); unur_dsrou_set_cdfatmode(par,Fmode); } gen = unur_init(par); if (gen) unur_dsrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); { UNUR_DISTR *dg =NULL; par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_dsrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [3] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_dsrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); { double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_pedantic(par,0); unur_dsrou_set_cdfatmode(par,Fmode); } gen = unur_init(par); if (gen) unur_dsrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); { UNUR_DISTR *dg =NULL; par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_dsrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [4] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_dsrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); { double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_pedantic(par,0); unur_dsrou_set_cdfatmode(par,Fmode); } gen = unur_init(par); if (gen) unur_dsrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); { UNUR_DISTR *dg =NULL; par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_dsrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [5] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_dsrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); { double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_pedantic(par,0); unur_dsrou_set_cdfatmode(par,Fmode); } gen = unur_init(par); if (gen) unur_dsrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); { UNUR_DISTR *dg =NULL; par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_dsrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [6] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_dsrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); { double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_pedantic(par,0); unur_dsrou_set_cdfatmode(par,Fmode); } gen = unur_init(par); if (gen) unur_dsrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); { UNUR_DISTR *dg =NULL; par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_dsrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [7] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_dsrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); { double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_pedantic(par,0); unur_dsrou_set_cdfatmode(par,Fmode); } gen = unur_init(par); if (gen) unur_dsrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [8] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_dsrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); { double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_pedantic(par,0); unur_dsrou_set_cdfatmode(par,Fmode); } gen = unur_init(par); if (gen) unur_dsrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); { UNUR_DISTR *dg =NULL; par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_dsrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [9] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_dsrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); { double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_pedantic(par,0); unur_dsrou_set_cdfatmode(par,Fmode); } gen = unur_init(par); if (gen) unur_dsrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); { UNUR_DISTR *dg =NULL; par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_dsrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [11] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_dsrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); { double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_pedantic(par,0); unur_dsrou_set_cdfatmode(par,Fmode); } gen = unur_init(par); if (gen) unur_dsrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); { UNUR_DISTR *dg =NULL; par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_dsrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); { UNUR_DISTR *dg =NULL; par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_pedantic(par,0); fpm[0] = 10.; fpm[1] = 0.63; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_dsrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [12] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_dsrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); { double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_pedantic(par,0); unur_dsrou_set_cdfatmode(par,Fmode); } gen = unur_init(par); if (gen) unur_dsrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); { UNUR_DISTR *dg =NULL; par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_dsrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); { UNUR_DISTR *dg =NULL; par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_pedantic(par,0); fpm[0] = 10.; fpm[1] = 0.63; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_dsrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [13] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_dsrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); { double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_pedantic(par,0); unur_dsrou_set_cdfatmode(par,Fmode); } gen = unur_init(par); if (gen) unur_dsrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); { UNUR_DISTR *dg =NULL; par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_dsrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [14] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_dsrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); { double Fmode = unur_distr_discr_eval_cdf( unur_distr_discr_get_mode(distr_localcopy), distr_localcopy ); par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_pedantic(par,0); unur_dsrou_set_cdfatmode(par,Fmode); } gen = unur_init(par); if (gen) unur_dsrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); { UNUR_DISTR *dg =NULL; par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_distr_discr_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_dsrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [15] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_dsrou_new(distr_localcopy); unur_dsrou_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_dsrou_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); /* free distributions */ unur_distr_free(distr[0]); unur_distr_free(distr[1]); unur_distr_free(distr[2]); unur_distr_free(distr[3]); unur_distr_free(distr[4]); unur_distr_free(distr[5]); unur_distr_free(distr[6]); unur_distr_free(distr[7]); unur_distr_free(distr[8]); unur_distr_free(distr[9]); unur_distr_free(distr[10]); unur_distr_free(distr[11]); unur_distr_free(distr[12]); unur_distr_free(distr[13]); unur_distr_free(distr[14]); unur_distr_free(distr[15]); /* test finished */ test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; /* we accept CHI2_FAILURES_TOLERATED failures */ (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_validate */ /* enable GCC compiler warning */ GCC_DIAG_ON(unused-variable) /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_dsrou_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_hrb.conf0000644001357500135600000002033414420445767013163 00000000000000############################################################################# [main] [main - data:] # method (for information only: the program scans the file name) method: HRB [main - header:] /* prototypes */ double HR_decreasing(double x, const UNUR_DISTR *distr); double CDF_decreasing(double x, const UNUR_DISTR *distr); double HR_constant(double x, const UNUR_DISTR *distr); double CDF_constant(double x, const UNUR_DISTR *distr); double HR_increasing(double x, const UNUR_DISTR *distr); double CDF_increasing(double x, const UNUR_DISTR *distr); int unur_hrb_set_pedantic( UNUR_PAR *par, int pedantic ); \#define COMPARE_SAMPLE_SIZE (10000) \#define VIOLATE_SAMPLE_SIZE (20) ############################################################################# [new] [new - invalid NULL ptr: distr = NULL; ] ~( distr ); --> expected_NULL --> UNUR_ERR_NULL [new - invalid distribution type: distr = unur_distr_discr_new(); ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID [new - data missing in distribution object: distr = unur_distr_cont_new(); ] /* hazard rate */ ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED ############################################################################# [set] [set - invalid NULL ptr: par = NULL; ] ~_upperbound(par,1.); --> expected_setfailed --> UNUR_ERR_NULL ~_verify(par,1); --> expected_setfailed --> UNUR_ERR_NULL [set - invalid parameter object: distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); ] ~_upperbound(par,1.); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_verify(par,1); --> expected_setfailed --> UNUR_ERR_PAR_INVALID unur_par_free(par); [set - invalid parameters: distr = unur_distr_cont_new(); unur_distr_cont_set_hr(distr,HR_decreasing); par = unur_hrb_new(distr); ] ~_upperbound(par,-1.); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_upperbound(par,UNUR_INFINITY); --> expected_setfailed --> UNUR_ERR_PAR_SET unur_par_free(par); ############################################################################# # [get] ############################################################################# [chg] [chg - invalid generator object: distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); unur_set_debug(par,0); gen = unur_init( par ); <-- ! NULL ] ~_verify(gen,1); --> expected_setfailed --> UNUR_ERR_GEN_INVALID ############################################################################# [init] [init - left border no valid upper bound: gen = NULL; distr = unur_distr_cont_new(); unur_distr_cont_set_hr(distr,HR_increasing); par = unur_hrb_new(distr); <-- ! NULL] gen = unur_init( par ); --> expected_NULL --> UNUR_ERR_GEN_CONDITION ############################################################################# [reinit] [reinit - does not exist: distr = unur_distr_cont_new(); unur_distr_cont_set_hr(distr,HR_decreasing); par = unur_hrb_new(distr); gen = unur_init( par ); <-- ! NULL ] unur_reinit( gen ); --> expected_reinit ############################################################################# [sample] [sample - compare: distr = unur_distr_cont_new(); unur_distr_cont_set_hr(distr,HR_decreasing); par = NULL; ] /* default algorithm */ par = unur_hrb_new(distr); -->compare_sequence_par_start /* default algorithm - set upper bound */ par = unur_hrb_new(distr); unur_hrb_set_upperbound(par,1.); -->compare_sequence_par /* default algorithm - verifying mode */ par = unur_hrb_new(distr); unur_hrb_set_verify(par,1); -->compare_sequence_par /* default algorithm - ignore invalid boundary */ unur_distr_cont_set_domain(distr,-10.,10.); par = unur_hrb_new(distr); -->compare_sequence_par_start #..................................................................... [sample - compare reinit: distr = unur_distr_cont_new(); unur_distr_cont_set_hr(distr,HR_decreasing); par = NULL; gen = NULL; ] /* original generator object */ par = unur_hrb_new(distr); gen = unur_init(par); -->compare_sequence_gen_start /* reinit */ unur_reinit(gen); -->compare_sequence_gen #..................................................................... [sample - compare stringparser: distr = NULL; par = NULL; gen = NULL; ] distr = unur_distr_cont_new(); unur_distr_cont_set_hrstr(distr,"1/(1+x)"); par = unur_hrb_new(distr); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "cont; hr = \"1/(1+x)\"; domain = (0,inf)& \ method = hrb" ); -->compare_sequence_gen unur_free(gen); gen = NULL; distr = unur_distr_cont_new(); unur_distr_cont_set_hrstr(distr,"1/(1+x)"); par = unur_hrb_new(distr); unur_hrb_set_upperbound(par,2.); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "cont; hr = \"1/(1+x)\"; domain = (0,inf)& \ method = hrb; upperbound = 2" ); -->compare_sequence_gen ############################################################################# [validate] [validate - generators:] # default program par[0] = unur_hrb_new(@distr@); # set upper bound par[1] = unur_hrb_new(@distr@); unur_hrb_set_upperbound(par,1.2); # set upper bound too small par[2] = unur_hrb_new(@distr@); unur_hrb_set_upperbound(par,0.9); [validate - distributions:] # decreasing hazard rate distr[0] = unur_distr_cont_new(); unur_distr_set_name(distr[0],"decreasing HR"); unur_distr_cont_set_hr(distr[0],HR_decreasing); unur_distr_cont_set_cdf(distr[0],CDF_decreasing); # constant hazard rate distr[1] = unur_distr_cont_new(); unur_distr_set_name(distr[1],"constant HR"); unur_distr_cont_set_hr(distr[1],HR_constant); unur_distr_cont_set_cdf(distr[1],CDF_constant); # increasing hazard rate distr[2] = unur_distr_cont_new(); unur_distr_set_name(distr[2],"increasing HR"); unur_distr_cont_set_hr(distr[2],HR_increasing); unur_distr_cont_set_cdf(distr[2],CDF_increasing); # number of distributions: 3 [validate - test chi2:] # + ... pass test # 0 ... fail to initialize generator # - ... fail test # . ... do not run test # # ... comment # # generators: # [0] ... default variant # [1] ... set upper bound # [2] ... set upper bound too small # #gen 0 1 2 # distribution #--------------------------------------------- <0> + + . # hazard rate decreasing <1> + + - # hazard rate constant <2> - - . # hazard rate increasing [validate - verify hat:] # + ... pass test # ~ ... fail in at most 1% of samples # 0 ... fail to initialize generator # - ... fail test # . ... do not run test # # ... comment # # generators: # [0] ... default variant # [1] ... set upper bound # [2] ... set upper bound too small # #gen 0 1 2 # distribution #--------------------------------------------- <0> + + - # hazard rate decreasing <1> + + - # hazard rate constant <2> - - . # hazard rate increasing ############################################################################# ############################################################################# [verbatim] double HR_decreasing(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* example with decreasing hazard rate */ { return (1./(1.+x)); } double CDF_decreasing(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* CDF for example with decreasing hazard rate */ { return (x/(1. + x)); } double HR_constant(double x ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* example with constant hazard rate: standard expontential */ { return 1.; } double CDF_constant(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* CDF for example with constant hazard rate: standard expontential */ { return (1.-exp(-x)); } double HR_increasing(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* example with increasing hazard rate: Weibull (alpha=3,beta=1) */ { return (3*x*x); } double CDF_increasing(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* CDF for example with increasing hazard rate: Weibull (alpha=3,beta=1) */ { return (1.-exp(-x*x*x)); } /* dummy function */ int unur_hrb_set_pedantic( UNUR_PAR *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) { return 1; } ############################################################################# unuran-1.11.0/tests/t_vnrou.conf0000644001357500135600000004675014420445767013573 00000000000000############################################################################# [main] [main - data:] # method (for information only: the program scans the file name) method: VNROU [main - header:] /* prototypes */ int unur_vnrou_set_pedantic( UNUR_PAR *par, int pedantic ); \#define COMPARE_SAMPLE_SIZE (10000) \#define VIOLATE_SAMPLE_SIZE (20) /* Chi-square goodness-of-fit tests sometimes fail once due to numerical */ /* errors. So we accept more such failure than for other methods. */ \#define CHI2_FAILURES_TOLERATED (5) /* we need marginal distributions for the chi2 tests */ \#define unur_distr_multicauchy unur_distr_multicauchy_w_marginals \#define unur_distr_multinormal unur_distr_multinormal_w_marginals \#define unur_distr_multistudent unur_distr_multistudent_w_marginals ############################################################################# [new] [new - invalid NULL ptr: distr = NULL; ] ~( distr ); --> expected_NULL --> UNUR_ERR_NULL [new - invalid distribution type: distr = unur_distr_discr_new(); ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID ############################################################################# [set] [set - invalid NULL ptr: par = NULL; ] ~_u( par, NULL, NULL ); --> expected_setfailed --> UNUR_ERR_NULL ~_v( par, 1. ); --> expected_setfailed --> UNUR_ERR_NULL ~_r( par, 1. ); --> expected_setfailed --> UNUR_ERR_NULL ~_verify( par, 1); --> expected_setfailed --> UNUR_ERR_NULL [set - invalid parameter object: double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_arou_new(distr); ] ~_u( par, NULL, NULL ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_v( par, 1. ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_r( par, 1. ); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_verify( par, 1); --> expected_setfailed --> UNUR_ERR_PAR_INVALID unur_par_free(par); [set - invalid parameters: const int dim = 3; double mean[] = {1.,2.,3.}; double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; double umin[] = {1.,1.,1.}; double umax[] = {2.,1.,2.}; distr = unur_distr_multinormal( dim, mean, covar ); par = unur_vnrou_new(distr); ] ~_u( par, NULL, NULL ); --> expected_setfailed --> UNUR_ERR_NULL ~_u( par, umin, umax ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_v( par, -1. ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_v( par, 0. ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_r( par, 0. ); --> none --> UNUR_ERR_PAR_SET unur_par_free(par); ############################################################################# [get] [get - invalid NULL ptr: gen = NULL; ] ~_volumehat( gen ); --> expected_INFINITY --> UNUR_ERR_NULL [get - invalid generator object: distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); gen = unur_init(par); <-- ! NULL ] ~_volumehat( gen ); --> expected_INFINITY --> UNUR_ERR_GEN_INVALID ############################################################################# [chg] [chg - invalid generator object: double umin[] = {1.,1.,1.}; double umax[] = {2.,2.,2.}; distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); unur_set_debug(par,0); gen = unur_init( par ); <-- ! NULL ] ~_u( gen, umin, umax ); --> expected_setfailed --> UNUR_ERR_GEN_INVALID ~_v( gen, 1. ); --> expected_setfailed --> UNUR_ERR_GEN_INVALID ~_verify(gen,1); --> expected_setfailed --> UNUR_ERR_GEN_INVALID [chg - invalid parameters: const int dim = 3; double mean[] = {1.,2.,3.}; double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; double umin[] = {1.,1.,1.}; double umax[] = {2.,1.,2.}; distr = unur_distr_multinormal( dim, mean, covar ); par = unur_vnrou_new(distr); gen = unur_init(par); <-- ! NULL ] ~_u( gen, umin, umax ); --> expected_setfailed --> UNUR_ERR_PAR_SET ~_v( gen, -1. ); --> expected_setfailed --> UNUR_ERR_PAR_SET ############################################################################# # [init] ############################################################################# [reinit] [reinit - does not exist: distr = unur_distr_multinormal(3,NULL,NULL); par = unur_vnrou_new(distr); gen = unur_init( par ); <-- ! NULL ] unur_reinit( gen ); --> expected_reinit ############################################################################# [sample] [sample - compare: const int dim = 3; double mean[] = {1.,2.,3.}; double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; distr = unur_distr_multinormal( dim, mean, covar ); par = unur_vnrou_new(distr); gen = unur_init( par ); <-- ! NULL ] # default -->compare_sequence_gen_start # default - verifying mode unur_free(gen); par = unur_vnrou_new(distr); unur_vnrou_set_verify(par,1); gen = unur_init( par ); -->compare_sequence_gen # r = 0.5 unur_free(gen); par = unur_vnrou_new(distr); unur_vnrou_set_r(par,0.5); gen = unur_init( par ); -->compare_sequence_gen_start # r = 0.5 - verifying mode unur_free(gen); par = unur_vnrou_new(distr); unur_vnrou_set_r(par,0.5); unur_vnrou_set_verify(par,1); gen = unur_init( par ); -->compare_sequence_gen [sample - compare 1dim: const int dim = 1; double mean[] = {1.}; double covar[] = {2.}; distr = unur_distr_multinormal( dim, mean, covar ); par = unur_vnrou_new(distr); gen = unur_init( par ); <-- ! NULL ] # default -->compare_sequence_gen_start # default - verifying mode unur_free(gen); par = unur_vnrou_new(distr); unur_vnrou_set_verify(par,1); gen = unur_init( par ); -->compare_sequence_gen [sample - compare clone: const int dim = 3; double mean[] = {1.,2.,3.}; double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; UNUR_GEN *clone; distr = unur_distr_multinormal( dim, mean, covar ); par = unur_vnrou_new(distr); gen = unur_init( par ); <-- ! NULL ] /* normal distribution */ -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen #..................................................................... [sample - compare clone 1dim: const int dim = 1; double mean[] = {1.}; double covar[] = {2.}; UNUR_GEN *clone; distr = unur_distr_multinormal( dim, mean, covar ); par = unur_vnrou_new(distr); gen = unur_init( par ); <-- ! NULL ] /* normal distribution */ -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen #..................................................................... [sample - compare reinit: distr = unur_distr_multinormal(3,NULL,NULL); par = NULL; gen = NULL; ] /* original generator object */ par = unur_vnrou_new(distr); gen = unur_init(par); -->compare_sequence_gen_start /* reinit */ unur_reinit(gen); -->compare_sequence_gen ############################################################################# [validate] [validate - generators:] # default program par[0] = unur_vnrou_new(@distr@); # r = 0.5 par[1] = unur_vnrou_new(@distr@); unur_vnrou_set_r(par,0.5); # r = 2 par[2] = unur_vnrou_new(@distr@); unur_vnrou_set_r(par,2.); # default with bounding rectangle { double umin[] = {-0.608928,-0.608928,-0.608928}; double umax[] = { 0.608928, 0.608928, 0.608928}; double vmax = 0.51; par[3] = unur_vnrou_new(@distr@); unur_vnrou_set_u(par,umin,umax); unur_vnrou_set_v(par,vmax); } # default with bounding rectangle { double umin[] = {-0.608928,-0.608928,-0.608928}; double umax[] = { 0.608928, 0.608928, 0.608928}; double vmax = 0.70; par[4] = unur_vnrou_new(@distr@); unur_vnrou_set_u(par,umin,umax); unur_vnrou_set_v(par,vmax); } # default variant but reinitialized with changed distribution { UNUR_DISTR *dg =NULL; double mean[] = { -1., 2., -3. }; double covar[] = { 2., 2., 0.9, 2., 4., 3., 0.9, 3., 3. }; par[5] = unur_vnrou_new(@distr@); dg = unur_get_distr(gen); unur_distr_cvec_set_mean(dg,mean); unur_distr_cvec_set_covar(dg,covar); unur_distr_cvec_upd_mode(dg); unur_distr_cvec_upd_pdfvol(dg); unur_reinit(gen); } [validate - distributions:] # standard multinormal distribution distr[0] = unur_distr_multinormal(3,NULL,NULL); # multinormal distribution, dim = 3 double mean[] = { 1., 2., 3. }; double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; distr[1] = unur_distr_multinormal(3,mean,covar); # random multinormal distribution \#define dim (2) int i; double mean[dim], covar[dim*dim]; UNUR_DISTR *covar_distr; UNUR_GEN *covar_gen; UNUR_GEN *mean_gen; covar_distr = unur_distr_correlation(dim); covar_gen = unur_init(unur_mcorr_new(covar_distr)); mean_gen = unur_str2gen("normal(5,1)"); for (i=0; i + + + + . + # standard multinormal (dim=3) <1> + + + - . + # multinormal (dim=3) x <2> + + + . . . # random multinormal (dim=2) x <3> + + + . . + # random multinormal (dim=3) <4> + + + . . + # multinormal (dim=3), shifted center <5> + + + . + . # standard multinormal (dim=1) <6> + + + . . . # multinormal (dim=1), shifted center <7> + + + . . . # multinormal with AR(1) (rho=0.5, dim=2) <8> + + + . . + # multinormal with AR(1) (rho=0.5, dim=3) <9> + + + . . . # multinormal with AR(1) (rho=0.5, dim=4) x<10> + + + . . . # multinormal with AR(1) (rho=0.5, dim=5) <11> + . + . . . # multicauchy with AR(1) (rho=0.2, dim=2) <12> + . + . . + # multicauchy with AR(1) (rho=0.2, dim=3) <13> + . + . . . # multicauchy with AR(1) (rho=0.2, dim=4) <14> + . + . . . # multicauchy with AR(1) (rho=0.2, dim=5) <15> + + + . . + # multistudent with AR(1) (rho=0.4, dim=3, nu=4) x<16> + + + . . + # multistudent with AR(1) (rho=0.4, dim=3, nu=5) <17> + + + . . + # multistudent with AR(1) (rho=0.4, dim=3, nu=6) x<18> + + + . . + # multistudent with AR(1) (rho=0.4, dim=3, nu=7) <19> + + + . . . # multinormal with constant rho (rho=0.5, dim=2) <20> + + + . . + # multinormal with constant rho (rho=0.5, dim=3) <21> + + + . . . # multinormal with constant rho (rho=0.5, dim=4) x<22> + + + . . . # multinormal with constant rho (rho=0.5, dim=5) <23> + . + . . . # multicauchy with constant rho (rho=0.2, dim=2) <24> + . + . . + # multicauchy with constant rho (rho=0.2, dim=3) <25> + . + . . . # multicauchy with constant rho (rho=0.2, dim=4) <26> + . + . . . # multicauchy with constant rho (rho=0.2, dim=5) <27> + + + . . + # multistudent with constant rho (rho=0.4, dim=3, nu=4) x<28> + + + . . + # multistudent with constant rho (rho=0.4, dim=3, nu=5) x<29> + + + . . + # multistudent with constant rho (rho=0.4, dim=3, nu=6) <30> + + + . . + # multistudent with constant rho (rho=0.4, dim=3, nu=7) <31> + + + . . . # standard multinormal distribution with rectangular domain <32> + + + . . . # standard multinormal distribution with rectangular domain <33> + + + . . . # standard multinormal distribution with rectangular domain <34> 0 0 0 . . . # invalid: default center of distribution out of truncated domain [validate - verify hat:] # + ... pass test # ~ ... fail in at most 1% of samples # 0 ... fail to initialize generator # - ... fail test # . ... do not run test # # ... comment # # generators: # [0] ... default variant # [1] ... r = 0.5 # [2] ... r = 2 # [3] ... r = default, given rectangle # [4] ... r = default, given rectangle # [5] ... default variant but reinitialized with changed distribution # #gen 0 1 2 3 4 5 # distribution #--------------------------------------------- <0> + + + + . + # standard multinormal (dim=3) <1> + + + - . + # multinormal (dim=3) x <2> + + + . . . # random multinormal (dim=2) x <3> + + + . . + # random multinormal (dim=3) <4> + + + . . + # multinormal (dim=3), shifted center <5> + + + . + . # standard multinormal (dim=1) <6> + + + . . . # multinormal (dim=1), shifted center <7> + + + . . . # multinormal with AR(1) (rho=0.5, dim=2) <8> + + + . . + # multinormal with AR(1) (rho=0.5, dim=3) <9> + + + . . . # multinormal with AR(1) (rho=0.5, dim=4) x<10> + + + . . . # multinormal with AR(1) (rho=0.5, dim=5) <11> + . + . . . # multicauchy with AR(1) (rho=0.2, dim=2) <12> + . + . . + # multicauchy with AR(1) (rho=0.2, dim=3) <13> + . + . . . # multicauchy with AR(1) (rho=0.2, dim=4) <14> + . + . . . # multicauchy with AR(1) (rho=0.2, dim=5) x<15> + + + . . + # multistudent with AR(1) (rho=0.4, dim=3, nu=4) x<16> + + + . . + # multistudent with AR(1) (rho=0.4, dim=3, nu=5) <17> + + + . . + # multistudent with AR(1) (rho=0.4, dim=3, nu=6) <18> + + + . . + # multistudent with AR(1) (rho=0.4, dim=3, nu=7) <19> + + + . . . # multinormal with constant rho (rho=0.5, dim=2) <20> + + + . . + # multinormal with constant rho (rho=0.5, dim=3) <21> + + + . . . # multinormal with constant rho (rho=0.5, dim=4) x<22> + + + . . . # multinormal with constant rho (rho=0.5, dim=5) <23> + . + . . . # multicauchy with constant rho (rho=0.2, dim=2) <24> + . + . . + # multicauchy with constant rho (rho=0.2, dim=3) <25> + . + . . . # multicauchy with constant rho (rho=0.2, dim=4) <26> + . + . . . # multicauchy with constant rho (rho=0.2, dim=5) <27> + + + . . + # multistudent with constant rho (rho=0.4, dim=3, nu=4) x<28> + + + . . + # multistudent with constant rho (rho=0.4, dim=3, nu=5) x<29> + + + . . + # multistudent with constant rho (rho=0.4, dim=3, nu=6) <30> + + + . . + # multistudent with constant rho (rho=0.4, dim=3, nu=7) <31> + + + . . . # standard multinormal distribution with rectangular domain <32> + + + . . . # standard multinormal distribution with rectangular domain <33> + + + . . . # standard multinormal distribution with rectangular domain <34> 0 0 0 . . . # invalid: default center of distribution out of truncated domain ############################################################################# ############################################################################# [verbatim] /* dummy function */ int unur_vnrou_set_pedantic( UNUR_PAR *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) { return 1; } ############################################################################# unuran-1.11.0/tests/t_hrd.conf0000644001357500135600000001641014420445767013165 00000000000000############################################################################# [main] [main - data:] # method (for information only: the program scans the file name) method: HRD [main - header:] /* prototypes */ double HR_decreasing(double x, const UNUR_DISTR *distr); double CDF_decreasing(double x, const UNUR_DISTR *distr); double HR_constant(double x, const UNUR_DISTR *distr); double CDF_constant(double x, const UNUR_DISTR *distr); double HR_increasing(double x, const UNUR_DISTR *distr); double CDF_increasing(double x, const UNUR_DISTR *distr); int unur_hrd_set_pedantic( UNUR_PAR *par, int pedantic ); \#define COMPARE_SAMPLE_SIZE (10000) \#define VIOLATE_SAMPLE_SIZE (20) ############################################################################# [new] [new - invalid NULL ptr: distr = NULL; ] ~( distr ); --> expected_NULL --> UNUR_ERR_NULL [new - invalid distribution type: distr = unur_distr_discr_new(); ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID [new - data missing in distribution object: distr = unur_distr_cont_new(); ] /* hazard rate */ ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED ############################################################################# [set] [set - invalid NULL ptr: par = NULL; ] ~_verify(par,1); --> expected_setfailed --> UNUR_ERR_NULL [set - invalid parameter object: distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); ] ~_verify(par,1); --> expected_setfailed --> UNUR_ERR_PAR_INVALID unur_par_free(par); ############################################################################# # [get] ############################################################################# [chg] [chg - invalid generator object: distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); unur_set_debug(par,0); gen = unur_init( par ); <-- ! NULL ] ~_verify(gen,1); --> expected_setfailed --> UNUR_ERR_GEN_INVALID ############################################################################# [init] [init - left border no valid upper bound: gen = NULL; distr = unur_distr_cont_new(); unur_distr_cont_set_hr(distr,HR_increasing); par = unur_hrd_new(distr); <-- ! NULL] gen = unur_init( par ); --> expected_NULL --> UNUR_ERR_GEN_CONDITION ############################################################################# [reinit] [reinit - does not exist: distr = unur_distr_cont_new(); unur_distr_cont_set_hr(distr,HR_decreasing); par = unur_hrd_new(distr); gen = unur_init( par ); <-- ! NULL ] unur_reinit( gen ); --> expected_reinit ############################################################################# [sample] [sample - compare: distr = unur_distr_cont_new(); unur_distr_cont_set_hr(distr,HR_decreasing); par = NULL; ] /* default algorithm */ par = unur_hrd_new(distr); -->compare_sequence_par_start /* default algorithm - verifying mode */ par = unur_hrd_new(distr); unur_hrd_set_verify(par,1); -->compare_sequence_par /* default algorithm - ignore invalid boundary */ unur_distr_cont_set_domain(distr,-10.,10.); par = unur_hrd_new(distr); -->compare_sequence_par_start #..................................................................... [sample - compare reinit: distr = unur_distr_cont_new(); unur_distr_cont_set_hr(distr,HR_decreasing); par = NULL; gen = NULL; ] /* original generator object */ par = unur_hrd_new(distr); gen = unur_init(par); -->compare_sequence_gen_start /* reinit */ unur_reinit(gen); -->compare_sequence_gen #..................................................................... [sample - compare stringparser: distr = NULL; par = NULL; gen = NULL; ] distr = unur_distr_cont_new(); unur_distr_cont_set_hrstr(distr,"1/(1+x)"); par = unur_hrd_new(distr); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "cont; hr = \"1/(1+x)\"; domain = (0,inf)& \ method = hrd" ); -->compare_sequence_gen unur_free(gen); gen = NULL; distr = unur_distr_cont_new(); unur_distr_cont_set_hrstr(distr,"1/(1+x)"); par = unur_hrd_new(distr); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "cont; hr = \"1/(1+x)\"; domain = (0,inf)& \ method = hrd" ); -->compare_sequence_gen ############################################################################# [validate] [validate - generators:] # default program par[0] = unur_hrd_new(@distr@); [validate - distributions:] # decreasing hazard rate distr[0] = unur_distr_cont_new(); unur_distr_set_name(distr[0],"decreasing HR"); unur_distr_cont_set_hr(distr[0],HR_decreasing); unur_distr_cont_set_cdf(distr[0],CDF_decreasing); # constant hazard rate distr[1] = unur_distr_cont_new(); unur_distr_set_name(distr[1],"constant HR"); unur_distr_cont_set_hr(distr[1],HR_constant); unur_distr_cont_set_cdf(distr[1],CDF_constant); # increasing hazard rate distr[2] = unur_distr_cont_new(); unur_distr_set_name(distr[2],"increasing HR"); unur_distr_cont_set_hr(distr[2],HR_increasing); unur_distr_cont_set_cdf(distr[2],CDF_increasing); # number of distributions: 3 [validate - test chi2:] # + ... pass test # 0 ... fail to initialize generator # - ... fail test # . ... do not run test # # ... comment # # generators: # [0] ... default variant # #gen 0 # distribution #--------------------------------------------- <0> + # hazard rate decreasing <1> + # hazard rate constant <2> - # hazard rate increasing [validate - verify hat:] # + ... pass test # ~ ... fail in at most 1% of samples # 0 ... fail to initialize generator # - ... fail test # . ... do not run test # # ... comment # # generators: # [0] ... default variant # #gen 0 # distribution #--------------------------------------------- <0> + # hazard rate decreasing <1> + # hazard rate constant <2> - # hazard rate increasing ############################################################################# ############################################################################# [verbatim] double HR_decreasing(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* example with decreasing hazard rate */ { return (1./(1.+x)); } double CDF_decreasing(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* CDF for example with decreasing hazard rate */ { return (x/(1. + x)); } double HR_constant(double x ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* example with constant hazard rate: standard expontential */ { return 1.; } double CDF_constant(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* CDF for example with constant hazard rate: standard expontential */ { return (1.-exp(-x)); } double HR_increasing(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* example with increasing hazard rate: Weibull (alpha=3,beta=1) */ { return (3*x*x); } double CDF_increasing(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* CDF for example with increasing hazard rate: Weibull (alpha=3,beta=1) */ { return (1.-exp(-x*x*x)); } /* dummy function */ int unur_hrd_set_pedantic( UNUR_PAR *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) { return 1; } ############################################################################# unuran-1.11.0/tests/t_dgt.conf0000644001357500135600000003676614420445767013206 00000000000000############################################################################# [main] [main - data:] # method (for information only: the program scans the file name) method: DGT [main - header:] /* prototypes */ \#define COMPARE_SAMPLE_SIZE (15000) \#define VIOLATE_SAMPLE_SIZE (20) double *make_geometric_vector(double q, int len); double *make_random_vector(int len); UNUR_DISTR *get_distr_with_invalid_pv( void ); UNUR_DISTR *get_distr_with_pv( void ); ############################################################################# [new] [new - invalid NULL ptr: distr = NULL; ] ~( distr ); --> expected_NULL --> UNUR_ERR_NULL [new - invalid distribution type: distr = unur_distr_cont_new(); ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID [new - data missing in distribution object: distr = unur_distr_discr_new(); /* no probability vector */ ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED ############################################################################# [set] [set - invalid NULL ptr: par = NULL; ] ~_variant(par,1); --> expected_setfailed --> UNUR_ERR_NULL ~_guidefactor(par,-1.); --> expected_setfailed --> UNUR_ERR_NULL [set - invalid parameter object: distr = get_distr_with_pv(); par = unur_dau_new(distr); ] ~_variant(par,10); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_guidefactor(par,-1.); --> expected_setfailed --> UNUR_ERR_PAR_INVALID unur_par_free(par); [set - invalid parameters: distr = get_distr_with_pv(); par = unur_dgt_new(distr); ] ~_variant(par,10); --> expected_setfailed --> UNUR_ERR_PAR_VARIANT ~_guidefactor(par,-1.); --> expected_setfailed --> UNUR_ERR_PAR_SET unur_par_free(par); ############################################################################# # [get] ############################################################################# # [chg] ############################################################################# [init] [init - invalid NULL ptr: par = NULL; ] unur_init( par ); --> expected_NULL --> UNUR_ERR_NULL [init - invalid data: distr = get_distr_with_invalid_pv(); par = unur_dgt_new(distr); ] unur_init( par ); --> expected_NULL --> UNUR_ERR_GEN_DATA ############################################################################# [reinit] [reinit - exist: double fpar[2] = {10.,0.63}; distr = unur_distr_binomial(fpar,2); par = unur_dgt_new(distr); gen = unur_init( par ); <-- ! NULL ] unur_reinit( gen ); --> expected_reinit ############################################################################# [sample] [sample - invalid NULL ptr: gen = NULL; ] unur_dgt_eval_invcdf_recycle(gen,0.5,NULL); --> expected_INTMAX --> UNUR_ERR_NULL unur_dgt_eval_invcdf(gen,0.5); --> expected_INTMAX --> UNUR_ERR_NULL #..................................................................... [sample - invalid generator object: distr = unur_distr_normal(NULL,0); par = unur_srou_new(distr); gen = unur_init(par); <-- ! NULL ] unur_dgt_eval_invcdf_recycle(gen,0.5,NULL); --> expected_INTMAX --> UNUR_ERR_GEN_INVALID unur_dgt_eval_invcdf(gen,0.5); --> expected_INTMAX --> UNUR_ERR_GEN_INVALID [sample - invalid domain: double fpar[] = {10,0.3}; distr = unur_distr_binomial(fpar,2); par = unur_dgt_new(distr); unur_set_debug(par,0); gen = unur_init( par ); <-- ! NULL ] unur_dgt_eval_invcdf_recycle(gen,1.5,NULL); --> none --> UNUR_ERR_DOMAIN unur_dgt_eval_invcdf_recycle(gen,-0.5,NULL); --> expected_zero --> UNUR_ERR_DOMAIN unur_dgt_eval_invcdf(gen,1.5); --> none --> UNUR_ERR_DOMAIN unur_dgt_eval_invcdf(gen,-0.5); --> expected_zero --> UNUR_ERR_DOMAIN #..................................................................... [sample - compare: distr = get_distr_with_pv(); par = NULL; ] /* default algorithm */ par = unur_dgt_new(distr); -->compare_sequence_par_start /* variant 1 */ par = unur_dgt_new(distr); unur_dgt_set_variant(par,1); -->compare_sequence_par /* variant 2 */ par = unur_dgt_new(distr); unur_dgt_set_variant(par,2); -->compare_sequence_par /* larger guide table size */ par = unur_dgt_new(distr); unur_dgt_set_guidefactor(par,10.); -->compare_sequence_par /* smaller guide table size */ par = unur_dgt_new(distr); unur_dgt_set_guidefactor(par,0.1); -->compare_sequence_par /* sequential search */ par = unur_dgt_new(distr); unur_dgt_set_guidefactor(par,0.); -->compare_sequence_par #..................................................................... [sample - compare clone: UNUR_GEN *clone; double fpar[] = {10,0.3}; distr = unur_distr_binomial(fpar,2); par = NULL; gen = NULL; ] /* original generator object */ par = unur_dgt_new(distr); gen = unur_init(par); -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen #..................................................................... [sample - compare reinit: double fpar[] = {10,0.3}; distr = unur_distr_binomial(fpar,2); par = NULL; gen = NULL; ] /* original generator object */ par = unur_dgt_new(distr); gen = unur_init(par); -->compare_sequence_gen_start /* reinit */ unur_reinit(gen); -->compare_sequence_gen #..................................................................... [sample - compare stringparser: double pv[] = {.1, .2, .3, .4, .5, .6, .7, .8, .9, 1.}; double fpar[] = {0.8}; distr = NULL; par = NULL; gen = NULL; ] distr = unur_distr_discr_new(); unur_distr_discr_set_pv(distr,pv,10); par = unur_dgt_new(distr); unur_dgt_set_guidefactor(par,3.); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "discr; pv = (.1, .2, .3, .4, .5, .6, .7, .8, .9, 1.) & \ method = dgt; guidefactor = 3." ); -->compare_sequence_gen unur_free(gen); gen = NULL; distr = unur_distr_discr_new(); unur_distr_discr_set_pv(distr,pv,10); par = unur_dgt_new(distr); unur_dgt_set_variant(par,1); unur_dgt_set_guidefactor(par,3.); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "discr; pv = (.1, .2, .3, .4, .5, .6, .7, .8, .9, 1.) & \ method = dgt; guidefactor = 3.; variant = 1" ); -->compare_sequence_gen unur_free(gen); gen = NULL; unur_free(gen); gen = NULL; distr = unur_distr_discr_new(); unur_distr_discr_set_pv(distr,pv,10); par = unur_dgt_new(distr); unur_dgt_set_variant(par,2); unur_dgt_set_guidefactor(par,3.); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "discr; pv = (.1, .2, .3, .4, .5, .6, .7, .8, .9, 1.) & \ method = dgt; guidefactor = 3.; variant = 2" ); -->compare_sequence_gen unur_free(gen); gen = NULL; distr = unur_distr_geometric(fpar,1); par = unur_dgt_new(distr); unur_dgt_set_guidefactor(par,3.); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "geometric(0.8) & method = dgt; guidefactor = 3." ); -->compare_sequence_gen ############################################################################# [validate] [validate - generators:] # default program par[0] = unur_dgt_new(@distr@); unur_set_debug(par, 1u); # variant 1 par[1] = unur_dgt_new(@distr@); unur_dgt_set_variant(par,1); unur_set_debug(par, 1u); # variant 2 par[2] = unur_dgt_new(@distr@); unur_dgt_set_variant(par,2); unur_set_debug(par, 1u); # larger guide table size par[3] = unur_dgt_new(@distr@); unur_dgt_set_guidefactor(par,10.); unur_set_debug(par, 1u); # smaller guide table size par[4] = unur_dgt_new(@distr@); unur_dgt_set_guidefactor(par,0.1); unur_set_debug(par, 1u); # default variant but reinitialized with changed domain { UNUR_DISTR *dg =NULL; par[5] = unur_dgt_new(@distr@); dg = unur_get_distr(gen); unur_distr_discr_set_domain(dg,2,7); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } # default variant but reinitialized with changed pdf parameters { UNUR_DISTR *dg =NULL; par[6] = unur_dgt_new(@distr@); fpm[0] = 10.; fpm[1] = 0.63; dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_distr_discr_upd_pmfsum(dg); unur_reinit(gen); } [validate - distributions:] # probability vector with random entries distr[0] = unur_distr_discr_new(); darray = make_random_vector(10); unur_distr_discr_set_pv(distr[0],darray,10); free(darray); unur_distr_set_name(distr[0],"pv(random)"); distr[1] = unur_distr_discr_new(); darray = make_random_vector(100); unur_distr_discr_set_pv(distr[1],darray,100); free(darray); unur_distr_set_name(distr[1],"pv(random)"); distr[2] = unur_distr_discr_new(); darray = make_random_vector(1000); unur_distr_discr_set_pv(distr[2],darray,1000); free(darray); unur_distr_set_name(distr[2],"pv(random)"); distr[3] = unur_distr_discr_new(); darray = make_random_vector(10000); unur_distr_discr_set_pv(distr[3],darray,10000); free(darray); unur_distr_set_name(distr[3],"pv(random)"); # probability vector with geometrically distributed entries distr[4] = unur_distr_discr_new(); darray = make_geometric_vector(1.,1000); unur_distr_discr_set_pv(distr[4],darray,1000); free(darray); unur_distr_set_name(distr[4],"pv(geometric)"); distr[5] = unur_distr_discr_new(); darray = make_geometric_vector(0.99,1000); unur_distr_discr_set_pv(distr[5],darray,1000); free(darray); unur_distr_set_name(distr[5],"pv(geometric)"); distr[6] = unur_distr_discr_new(); darray = make_geometric_vector(0.9,1000); unur_distr_discr_set_pv(distr[6],darray,1000); free(darray); unur_distr_set_name(distr[6],"pv(geometric)"); distr[7] = unur_distr_discr_new(); darray = make_geometric_vector(0.5,1000); unur_distr_discr_set_pv(distr[7],darray,1000); free(darray); unur_distr_set_name(distr[7],"pv(geometric)"); distr[8] = unur_distr_discr_new(); darray = make_geometric_vector(0.1,1000); unur_distr_discr_set_pv(distr[8],darray,1000); free(darray); unur_distr_set_name(distr[8],"pv(geometric)"); # probability vector with geometrically distributed entries and shifted domain distr[9] = unur_distr_discr_new(); darray = make_geometric_vector(0.5,100); unur_distr_discr_set_pv(distr[9],darray,100); unur_distr_discr_set_domain(distr[9],10,209); free(darray); unur_distr_set_name(distr[9],"pv(geometric) - shifted domain"); distr[10] = unur_distr_discr_new(); darray = make_geometric_vector(0.9,100); unur_distr_discr_set_pv(distr[10],darray,100); unur_distr_discr_set_domain(distr[10],-10,209); free(darray); unur_distr_set_name(distr[10],"pv(geometric) - shifted domain"); # PMF instead of PV # geometric disctribution fpm[0] = 0.5; distr[11] = unur_distr_geometric(fpm,1); fpm[0] = 0.001; distr[12] = unur_distr_geometric(fpm,1); # logarithmic distribution fpm[0] = 0.1; distr[13] = unur_distr_logarithmic(fpm,1); fpm[0] = 0.999; distr[14] = unur_distr_logarithmic(fpm,1); # negative binomial distribution fpm[0] = 0.5; fpm[1] = 10.; distr[15] = unur_distr_negativebinomial(fpm,2); fpm[0] = 0.8; fpm[1] = 10.; distr[21] = unur_distr_negativebinomial(fpm,2); fpm[0] = 0.01; fpm[1] = 20.; distr[16] = unur_distr_negativebinomial(fpm,2); # poisson distribution fpm[0] = 0.1; distr[17] = unur_distr_poisson(fpm,1); fpm[0] = 0.999; distr[18] = unur_distr_poisson(fpm,1); # zipf distribution fpm[0] = 2.; fpm[1] = 1.; distr[19] = unur_distr_zipf(fpm,2); unur_distr_discr_set_domain(distr[19],1,1000); fpm[0] = 0.001; fpm[1] = 1.; distr[20] = unur_distr_zipf(fpm,2); unur_distr_discr_set_domain(distr[20],1,1000); # binomial distribution fpm[0] = 20.; fpm[1] = 0.8; distr[22] = unur_distr_binomial(fpm,2); fpm[0] = 2000.; fpm[1] = 0.0013; distr[23] = unur_distr_binomial(fpm,2); # number of distributions: 24 [validate - test chi2:] # + ... pass test # 0 ... fail to initialize generator # - ... fail test # . ... do not run test # # ... comment # # [0] ... default program # [1] ... variant 1 # [2] ... variant 2 # [3] ... larger guide table size # [4] ... smaller guide table size # [5] ... default variant but reinitialized with changed domain # [6] ... default variant but reinitialized with changed pdf parameters # #gen 0 1 2 3 4 5 6 # distribution #------------------------------------------------------------- <0> + + + + + . . # PV with random entries <1> + + + + + . . <2> + + + + + . . x <3> + + + + + . . x <4> + + + + + . . # PV with geometrically distributed entries <5> + + + + + . . x <6> + + + + + . . <7> + + + + + . . x <8> + + + + + . . <9> + + + + + . . # PV with geom. distr. entries and shifted domain <10> + + + + + . . # PMF instead of PV <11> + + + + + + . # geometric (0.5) <12> + + + + + + . # geometric (0.001) <13> + + + + + + . # logarithmic (0.1) <14> + + + + + + . # logarithmic (0.999) <15> + + + + + + . # negativebinomial (0.5, 10) x<21> + + + + + + . # negativebinomial (0.8, 10) <16> + + + + + + . # negativebinomial (0.01, 20) x<17> + + + + + + . # poisson (0.1) <18> + + + + + + . # poisson (0.999) <19> + + + + + + . # zipf (2, 1) x<20> + + + + + + . # zipf (0.001, 1) <22> + + + + + + + # binomial (20, 0.8) <23> + + + + + + + # binomial (2000, 0.0013) ############################################################################# ############################################################################# [verbatim] /*---------------------------------------------------------------------------*/ /* make a probability vector (need not sum to one) (use random entries) */ double *make_random_vector(int len) { double *pv; int i; /* allocate memory */ pv = malloc(len*sizeof(double)); if (!pv) abort(); /* main part of geometric distribution */ for( i=0; i #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ double HR_invalid(double x, const UNUR_DISTR *distr); double HR_decreasing(double x, const UNUR_DISTR *distr); double CDF_decreasing(double x, const UNUR_DISTR *distr); double HR_constant(double x, const UNUR_DISTR *distr); double CDF_constant(double x, const UNUR_DISTR *distr); double HR_increasing_wb31(double x, const UNUR_DISTR *distr); double CDF_increasing_wb31(double x, const UNUR_DISTR *distr); double HR_increasing_gm31(double x, const UNUR_DISTR *distr); double CDF_increasing_gm31(double x, const UNUR_DISTR *distr); double HR_increasing_gm51(double x, const UNUR_DISTR *distr); double CDF_increasing_gm51(double x, const UNUR_DISTR *distr); int unur_hri_set_pedantic( UNUR_PAR *par, int pedantic ); #define COMPARE_SAMPLE_SIZE (10000) #define VIOLATE_SAMPLE_SIZE (20) /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ double HR_invalid(double x ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* example with invalid hazard rate */ { return 0.; } double HR_decreasing(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* example with decreasing hazard rate */ { return (1./(1.+x)); } double CDF_decreasing(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* CDF for example with decreasing hazard rate */ { return (x/(1. + x)); } double HR_constant(double x ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* example with constant hazard rate: standard expontential */ { return 1.; } double CDF_constant(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* CDF for example with constant hazard rate: standard expontential */ { return (1.-exp(-x)); } double HR_increasing_wb31(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* example with increasing hazard rate: Weibull (alpha=3,beta=1) */ { return (3*x*x); } double CDF_increasing_wb31(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* CDF for example with increasing hazard rate: Weibull (alpha=3,beta=1) */ { return (1.-exp(-x*x*x)); } double HR_increasing_gm31(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* example with increasing hazard rate: gamma (alpha=3,beta=1) */ { return (x*x)/(x*x+2*x+2.); } double CDF_increasing_gm31(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* CDF for example with increasing hazard rate: gamma (alpha=3,beta=1) */ { return 1.-(x*x*exp(-x))/2.-(x*exp(-x))-exp(-x); } double HR_increasing_gm51(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* example with increasing hazard rate: gamma (alpha=5,beta=1) */ { return pow(x,4.)/(pow(x,4.)+4*pow(x,3.)+12.*x*x+24.*x+24.); } double CDF_increasing_gm51(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* CDF for example with increasing hazard rate: gamma (alpha=5,beta=1) */ { return (-exp(-x)/24.)*((pow(x,4.)+4*pow(x,3.)+12.*x*x+24.*x+24.))+1.; } /* dummy function */ int unur_hri_set_pedantic( UNUR_PAR *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) { return 1; } /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,44,(unur_hri_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,44,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,50,(unur_hri_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,50,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* data missing in distribution object */ UNUR_DISTR *distr = NULL; distr = unur_distr_cont_new(); unur_reset_errno(); /* hazard rate */ n_tests_failed += (check_expected_NULL(TESTLOG,57,(unur_hri_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,57,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [set] */ void test_set (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[set "); fflush(stdout); fprintf(TESTLOG,"\n[set]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,67,(unur_hri_set_verify(par,1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,67,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,70,(unur_hri_set_p0(par,1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,70,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* invalid parameter object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,78,(unur_hri_set_verify(par,1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,78,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,81,(unur_hri_set_p0(par,1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,81,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_set() */ /*---------------------------------------------------------------------------*/ /* [chg] */ void test_chg (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[chg "); fflush(stdout); fprintf(TESTLOG,"\n[chg]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid generator object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); unur_set_debug(par,0); gen = unur_init( par ); abort_if_NULL(TESTLOG, 97, gen ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,101,(unur_hri_chg_verify(gen,1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,101,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_chg() */ /*---------------------------------------------------------------------------*/ /* [init] */ void test_init (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[init "); fflush(stdout); fprintf(TESTLOG,"\n[init]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* left border no valid upper bound */ UNUR_GEN *gen = NULL; UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; gen = NULL; distr = unur_distr_cont_new(); unur_distr_cont_set_hr(distr,HR_invalid); par = unur_hri_new(distr); abort_if_NULL(TESTLOG, 111, par ); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,115,(gen = unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,115,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; unur_free(gen); unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_init() */ /*---------------------------------------------------------------------------*/ /* [reinit] */ void test_reinit (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[reinit "); fflush(stdout); fprintf(TESTLOG,"\n[reinit]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* does not exist */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_cont_new(); unur_distr_cont_set_hr(distr,HR_increasing_wb31); par = unur_hri_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 125, gen ); unur_reset_errno(); n_tests_failed += (check_expected_reinit(TESTLOG,129,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_reinit() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* compare */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = unur_distr_cont_new(); unur_distr_cont_set_hr(distr,HR_increasing_wb31); par = NULL; unur_reset_errno(); /* default algorithm */ par = unur_hri_new(distr); n_tests_failed += (compare_sequence_par_start(TESTLOG,142,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* default algorithm - verifying mode */ par = unur_hri_new(distr); unur_hri_set_verify(par,1); n_tests_failed += (compare_sequence_par(TESTLOG,147,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* default algorithm - ignore invalid boundary */ unur_distr_cont_set_domain(distr,-10.,10.); par = unur_hri_new(distr); n_tests_failed += (compare_sequence_par_start(TESTLOG,152,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* compare reinit */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_cont_new(); unur_distr_cont_set_hr(distr,HR_increasing_wb31); par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_hri_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,165,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* reinit */ unur_reinit(gen); n_tests_failed += (compare_sequence_gen(TESTLOG,169,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare stringparser */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = NULL; par = NULL; gen = NULL; unur_reset_errno(); distr = unur_distr_cont_new(); unur_distr_cont_set_hrstr(distr,"3*x^2"); par = unur_hri_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,182,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "cont; hr = \"3*x^2\"; domain = (0,inf)& \ method = hri" ); n_tests_failed += (compare_sequence_gen(TESTLOG,188,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* [validate] */ /*---------------------------------------------------------------------------*/ /* [validate] */ void test_validate (void) { /* suppress GCC compiler warning */ GCC_DIAG_OFF(unused-variable) UNUR_DISTR *distr[5]; UNUR_PAR *par; UNUR_GEN *gen; double *darray; double fpm[10]; int n_tests_failed; int rcode; /* start test */ printf("[validate "); fflush(stdout); fprintf(TESTLOG,"\n[validate]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* distributions: 5 */ { distr[0] = unur_distr_cont_new(); unur_distr_set_name(distr[0],"decreasing HR"); unur_distr_cont_set_hr(distr[0],HR_decreasing); unur_distr_cont_set_cdf(distr[0],CDF_decreasing); } { distr[1] = unur_distr_cont_new(); unur_distr_set_name(distr[1],"constant HR"); unur_distr_cont_set_hr(distr[1],HR_constant); unur_distr_cont_set_cdf(distr[1],CDF_constant); } { distr[2] = unur_distr_cont_new(); unur_distr_set_name(distr[2],"increasing HR wb31"); unur_distr_cont_set_hr(distr[2],HR_increasing_wb31); unur_distr_cont_set_cdf(distr[2],CDF_increasing_wb31); } { distr[3] = unur_distr_cont_new(); unur_distr_set_name(distr[3],"increasing HR gm31"); unur_distr_cont_set_hr(distr[3],HR_increasing_gm31); unur_distr_cont_set_cdf(distr[3],CDF_increasing_gm31); } { distr[4] = unur_distr_cont_new(); unur_distr_set_name(distr[4],"increasing HR gm51"); unur_distr_cont_set_hr(distr[4],HR_increasing_gm51); unur_distr_cont_set_cdf(distr[4],CDF_increasing_gm51); } /* timing */ stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); printf("\n(chi^2) "); fflush(stdout); /* chi^2 tests: 10 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nChi^2 Test:\n"); /* distribution [0] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_hri_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_hri_new(distr_localcopy); unur_hri_set_p0(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_hri_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_hri_new(distr_localcopy); unur_hri_set_p0(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [2] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_hri_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_hri_new(distr_localcopy); unur_hri_set_p0(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [3] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_hri_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_hri_new(distr_localcopy); unur_hri_set_p0(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [4] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_hri_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_hri_new(distr_localcopy); unur_hri_set_p0(par,2.); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); printf("\n(verify hat) "); fflush(stdout); /* verify hat tests: 10 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nVerify Hat Test (squeeze <= PDF <= hat):\n"); /* distribution [0] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_hri_new(distr_localcopy); unur_hri_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_hri_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_hri_new(distr_localcopy); unur_hri_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_hri_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_hri_new(distr_localcopy); unur_hri_set_pedantic(par,0); unur_hri_set_p0(par,2.); gen = unur_init(par); if (gen) unur_hri_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [2] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_hri_new(distr_localcopy); unur_hri_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_hri_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_hri_new(distr_localcopy); unur_hri_set_pedantic(par,0); unur_hri_set_p0(par,2.); gen = unur_init(par); if (gen) unur_hri_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [3] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_hri_new(distr_localcopy); unur_hri_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_hri_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_hri_new(distr_localcopy); unur_hri_set_pedantic(par,0); unur_hri_set_p0(par,2.); gen = unur_init(par); if (gen) unur_hri_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [4] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_hri_new(distr_localcopy); unur_hri_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_hri_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_hri_new(distr_localcopy); unur_hri_set_pedantic(par,0); unur_hri_set_p0(par,2.); gen = unur_init(par); if (gen) unur_hri_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); /* free distributions */ unur_distr_free(distr[0]); unur_distr_free(distr[1]); unur_distr_free(distr[2]); unur_distr_free(distr[3]); unur_distr_free(distr[4]); /* test finished */ test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; /* we accept CHI2_FAILURES_TOLERATED failures */ (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_validate */ /* enable GCC compiler warning */ GCC_DIAG_ON(unused-variable) /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_hri_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_dstd.conf0000644001357500135600000003362514420445767013355 00000000000000############################################################################# [main] [main - data:] # method (for information only: the program scans the file name) method: DSTD [main - header:] /* prototypes */ int estimate_uerror( UNUR_DISTR *distr, double u_resolution, int samplesize ); double cdf_geom(int k, const UNUR_DISTR *distr); int invcdf_geom(double u, const UNUR_DISTR *distr); /* -- constants -- */ /* sample size */ static const int UERROR_SAMPLESIZE = 100000; static const double UERROR_RESOLUTION = 1.e-14; \#define COMPARE_SAMPLE_SIZE (500) \#define VIOLATE_SAMPLE_SIZE (20) /* \#define SEED (298346) */ ############################################################################# [new] [new - invalid NULL ptr: distr = NULL; ] ~( distr ); --> expected_NULL --> UNUR_ERR_NULL [new - invalid distribution type: distr = unur_distr_cont_new(); ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID [new - not a standard distribution: distr = unur_distr_discr_new(); ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED ############################################################################## [set] [set - invalid NULL ptr: par = NULL; ] ~_variant(par,1); --> expected_setfailed --> UNUR_ERR_NULL [set - invalid parameter object: double fpar[1] = {0.5}; distr = unur_distr_geometric(fpar,1); par = unur_dgt_new(distr); ] ~_variant(par,1); --> expected_setfailed --> UNUR_ERR_PAR_INVALID unur_par_free(par); [set - invalid parameters: double fpar[1] = {0.5}; distr = unur_distr_geometric(fpar,1); par = unur_dstd_new(distr); ] ~_variant(par,9999); --> expected_setfailed --> UNUR_ERR_PAR_VARIANT unur_par_free(par); ############################################################################## # [get] ############################################################################## [chg] [chg - invalid generator object: double fpar[2] = {10,0.4}; distr = unur_distr_binomial(fpar,2); par = unur_dgt_new(distr); unur_set_debug(par,0); gen = unur_init( par ); <-- ! NULL ] ~_truncated(gen, 1, 5); --> expected_setfailed --> UNUR_ERR_GEN_INVALID ############################################################################## [init] [init - invalid NULL ptr: par = NULL; ] unur_init( par ); --> expected_NULL --> UNUR_ERR_NULL ############################################################################## [reinit] [reinit - does not exist: double fpar[2] = {10.,0.63}; distr = unur_distr_binomial(fpar,2); par = unur_dstd_new(distr); gen = unur_init( par ); <-- ! NULL ] unur_reinit( gen ); --> expected_reinit ############################################################################## [sample] [sample - compare clone: UNUR_GEN *clone; double fpar[] = {10,0.3}; distr = unur_distr_binomial(fpar,2); par = NULL; gen = NULL; ] /* original generator object */ par = unur_dstd_new(distr); gen = unur_init(par); -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen #..................................................................... [sample - compare stringparser: double fpar[] = {3.}; distr = NULL; par = NULL; gen = NULL; ] distr = unur_distr_poisson(fpar,1); par = unur_dstd_new(distr); unur_dstd_set_variant(par,2); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "poisson(3.) & method = dstd; variant = 2" ); -->compare_sequence_gen ############################################################################## [validate] [validate - generators:] # inversion par[0] = unur_dstd_new(@distr@); if (unur_dstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } par[1] = unur_dstd_new(@distr@); if (unur_dstd_set_variant(par,1)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } par[2] = unur_dstd_new(@distr@); if (unur_dstd_set_variant(par,2)!=UNUR_SUCCESS) { unur_par_free(par); par = NULL; } # change domain par[10] = unur_dstd_new(@distr@); if (unur_dstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } unur_dstd_chg_truncated(gen,1,4); # change parameters (use default variant) { UNUR_DISTR *dg =NULL; par[11] = unur_dstd_new(@distr@); fpm[0] = 0.2; fpm[1] = 0.5; dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_reinit(gen); } # change parameters (use default variant) { UNUR_DISTR *dg =NULL; par[12] = unur_dstd_new(@distr@); fpm[0] = 20; fpm[1] = 0.5; dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_reinit(gen); } # change parameters (use default variant) { UNUR_DISTR *dg =NULL; par[13] = unur_dstd_new(@distr@); fpm[0] = 200; fpm[1] = 50; dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,2); unur_reinit(gen); } [validate - distributions:] # Binomial distribution fpm[0] = 50.; fpm[1] = 0.4; distr[1] = unur_distr_binomial(fpm,2); fpm[0] = 100.; fpm[1] = 0.87; distr[2] = unur_distr_binomial(fpm,2); fpm[0] = 100.; fpm[1] = 0.01; distr[3] = unur_distr_binomial(fpm,2); fpm[0] = 10000.; fpm[1] = 0.7 ; distr[4] = unur_distr_binomial(fpm,2); # Geometric disctribution fpm[0] = 0.5; distr[0] = unur_distr_geometric(fpm,1); fpm[0] = 0.001; distr[11] = unur_distr_geometric(fpm,1); fpm[0] = 0.999; distr[12] = unur_distr_geometric(fpm,1); # Hypergeometric fpm[0] = 10000.; fpm[1] = 100. ; fpm[2] = 50. ; distr[5] = unur_distr_hypergeometric(fpm,3); fpm[0] = 10000.; fpm[1] = 9000. ; fpm[2] = 50. ; distr[6] = unur_distr_hypergeometric(fpm,3); fpm[0] = 10000.; fpm[1] = 80. ; fpm[2] = 90. ; distr[7] = unur_distr_hypergeometric(fpm,3); fpm[0] = 10000.; fpm[1] = 1000. ; fpm[2] = 150. ; distr[8] = unur_distr_hypergeometric(fpm,3); fpm[0] = 10000.; fpm[1] = 9000. ; fpm[2] = 500. ; distr[9] = unur_distr_hypergeometric(fpm,3); fpm[0] = 10000.; fpm[1] = 9000. ; fpm[2] = 250. ; distr[10] = unur_distr_hypergeometric(fpm,3); # Logarithmic disctribution fpm[0] = 0.001; distr[25] = unur_distr_logarithmic(fpm,1); fpm[0] = 0.01; distr[13] = unur_distr_logarithmic(fpm,1); fpm[0] = 0.1; distr[14] = unur_distr_logarithmic(fpm,1); fpm[0] = 0.5; distr[15] = unur_distr_logarithmic(fpm,1); fpm[0] = 0.9; distr[16] = unur_distr_logarithmic(fpm,1); fpm[0] = 0.999; distr[17] = unur_distr_logarithmic(fpm,1); # Poisson distribution fpm[0] = 0.001; distr[18] = unur_distr_poisson(fpm,1); fpm[0] = 0.1; distr[19] = unur_distr_poisson(fpm,1); fpm[0] = 0.5; distr[20] = unur_distr_poisson(fpm,1); fpm[0] = 1.; distr[21] = unur_distr_poisson(fpm,1); fpm[0] = 10.; distr[22] = unur_distr_poisson(fpm,1); fpm[0] = 1000.; distr[23] = unur_distr_poisson(fpm,1); # Zipf fpm[0] = 2.; fpm[1] = 3.; distr[28] = unur_distr_zipf(fpm,2); fpm[0] = 3.; fpm[1] = 2.; distr[29] = unur_distr_zipf(fpm,2); # negative binomial distribution fpm[0] = 0.5; fpm[1] = 10.; distr[24] = unur_distr_negativebinomial(fpm,2); # distributions from scratch distr[26] = unur_distr_discr_new(); unur_distr_set_name( distr[26], "CDF_only" ); unur_distr_discr_set_domain( distr[26], 0, INT_MAX ); unur_distr_discr_set_cdf( distr[26], cdf_geom ); distr[27] = unur_distr_discr_new(); unur_distr_set_name( distr[27], "CDF&invCDF" ); unur_distr_discr_set_domain( distr[27], 0, INT_MAX ); unur_distr_discr_set_cdf( distr[27], cdf_geom ); unur_distr_discr_set_invcdf( distr[27], invcdf_geom ); # number of distributions: 30 [validate - test chi2:] # + ... pass test # 0 ... fail to initialize generator (given variant does not exist) # - ... fail test # / ... either init fails or test passes # . ... do not run test # # ... comment # # generators: # [0] ... Inversion # [1] -- [2] ... Variants 1 to 9 # [10] ... domain changed after initialization # [11] ... change parameters to {0.2, 0.5} (use default variant) # [12] ... change parameters to {20, 0.5} (use default variant) # [13] ... change parameters to {200, 50} (use default variant) # # 1 1 1 1 #gen 0 1 2 0 1 2 3 # distribution #------------------------------------------------------------- <1> . + . . . + . # binomial (50, 0.4) <2> . + . . . + . # binomial (100, 0.87) <3> . + . . . + . # binomial (100, 0.01) <4> . + . . . + . # binomial (10000, 0.7) <0> + . . . + . . # geometric (0.5) <11> + . . . + . . # geometric (0.01) <12> + . . . + . . # geometric (0.999) <5> . + . . . . + # hypergeometric (10000, 100, 50) <6> . + . . . . + # hypergeometric (10000, 9000, 50) <7> . + . . . . + # hypergeometric (10000, 80, 90) <8> . + . . . . + # hypergeometric (10000, 1000, 150) <9> . + . . . . + # hypergeometric (10000, 9000, 500) <10> . + . . . . + # hypergeometric (10000, 9000, 5000) x<25> . + . . + . . # logarithmic (0.001) <13> . + . . + . . # logarithmic (0.01) <14> . + . . + . . # logarithmic (0.1) <15> . + . . + . . # logarithmic (0.5) <16> . + . . + . . # logarithmic (0.9) <17> . + . . + . . # logarithmic (0.999) x<18> . + + . + + . # poisson (0.001) <19> . + + . + + . # poisson (0.1) <20> . + + . + + . # poisson (0.5) <21> . + + . + + . # poisson (1) <22> . + + . + + . # poisson (10) <23> . + + . + + . # poisson (1000) <28> . + . . . . . # zipf (2,3) <29> . + . . . . . # zipf (3,2) #<24> . . . . . . . # negativebinomial (0.5, 10) <26> 0 . . . . . . # given CDF <27> + . . . . . . # given CDF + invCDF ############################################################################## ############################################################################## [special] ## Remark: ## ## In this section we merely test the existence of inversion. ## A few implementations seem to be rather inaccurate with respect to ## their u-errors. ## [special - decl:] int samplesize = UERROR_SAMPLESIZE; double ures = UERROR_RESOLUTION; int errorsum = 0; double fpar[5]; UNUR_DISTR *distr; [special - start:] /* test for maximal u-error */ printf("\n[test maximal u-error for inversion method]\n"); fprintf(TESTLOG,"\n* Test maximal u-error for inversion method *\n"); ## ---------------------------------------------------- printf(" binomial"); fpar[0] = 20; fpar[1] = 0.2; distr = unur_distr_binomial(fpar,2); errorsum += estimate_uerror(distr,ures,samplesize); fpar[0] = 10000; fpar[1] = 0.2; distr = unur_distr_binomial(fpar,2); errorsum += estimate_uerror(distr,ures,samplesize); ## ---------------------------------------------------- printf(" geometric"); fpar[0] = 0.1; distr = unur_distr_geometric(fpar,1); errorsum += estimate_uerror(distr,ures,samplesize); ## ---------------------------------------------------- printf(" hypergeometric"); fpar[0] = 10000; fpar[1] = 1000; fpar[2] = 150; distr = unur_distr_hypergeometric(fpar,3); errorsum += estimate_uerror(distr,ures,samplesize); ## ---------------------------------------------------- printf(" negativebinomial"); fpar[0] = 0.2; fpar[1] = 20; distr = unur_distr_negativebinomial(fpar,2); errorsum += estimate_uerror(distr,ures,samplesize); fpar[0] = 0.2; fpar[1] = 10000; distr = unur_distr_negativebinomial(fpar,2); errorsum += estimate_uerror(distr,ures,samplesize); ## ---------------------------------------------------- printf(" poisson"); fpar[0] = 0.1; distr = unur_distr_poisson(fpar,1); errorsum += estimate_uerror(distr,ures,samplesize); fpar[0] = 10; distr = unur_distr_poisson(fpar,1); errorsum += estimate_uerror(distr,ures,samplesize); ## ---------------------------------------------------- /*---------------------------------------------------------------------------*/ /* test finished */ FAILED = (errorsum < 2) ? 0 : 1; ############################################################################## [verbatim] ############################################################################# # # routines for special tests # ############################################################################# int estimate_uerror( UNUR_DISTR *distr, /* distribution object */ double u_resolution, /* maximal tolerated u-error */ int samplesize ) /* sample size for error experiment */ /* returns 0 if maxerror < u_resolution, errorcode otherwise */ { UNUR_PAR *par; UNUR_GEN *gen; int i, nfpar; const double *fpar; double score; /* print data about distribution */ fprintf(TESTLOG,"> %s (",unur_distr_get_name(distr)); nfpar = unur_distr_discr_get_pmfparams(distr,&fpar); for(i=0;i inversion method not implemented !!\n\n"); printf("0"); fflush(stdout); if (par) unur_par_free(par); unur_distr_free(distr); return 0; } /* initialize generator object */ gen = unur_init(par); /* run test */ score = run_validate_u_error( TESTLOG, gen, distr, u_resolution, samplesize ); /* clear working space */ unur_distr_free(distr); unur_free(gen); /* return */ fprintf(TESTLOG,"\n"); return score; } /* end of estimate_uerror() */ ############################################################################# # # PDFs and CDF for test distributions # ############################################################################# double cdf_geom(int k, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { const double p = 0.3; return ((k<0) ? 0. : (1. - pow(1. - p, k+1.)) ); } int invcdf_geom(double u, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { const double p = 0.3; return ((int) (log(u) / log(1.-p))); } ############################################################################## unuran-1.11.0/tests/t_mvstd.c0000644001357500135600000006675314430713513013045 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for MVSTD **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); int unur_mvstd_set_verify( UNUR_PAR *par, int verify); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ #define COMPARE_SAMPLE_SIZE (500) #define VIOLATE_SAMPLE_SIZE (20) /* #define SEED (298346) */ /* we need marginal distributions for the chi2 tests */ #define unur_distr_multinormal unur_distr_multinormal_w_marginals /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,30,(unur_mvstd_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,30,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; distr = unur_distr_cont_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,36,(unur_mvstd_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,36,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* not a standard distribution */ UNUR_DISTR *distr = NULL; distr = unur_distr_cvec_new(3); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,42,(unur_mvstd_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,42,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [reinit] */ void test_reinit (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[reinit "); fflush(stdout); fprintf(TESTLOG,"\n[reinit]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* exists */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_multinormal(3,NULL,NULL); par = unur_mvstd_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 66, gen ); unur_reset_errno(); n_tests_failed += (check_expected_reinit(TESTLOG,70,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_reinit() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* compare clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; const int dim = 3; double mean[] = {1.,2.,3.}; double covar[] = { 2., 2., 1., 2., 4., 3., 1., 3., 3. }; UNUR_GEN *clone; distr = unur_distr_multinormal( dim, mean, covar ); par = NULL; gen = NULL; unur_reset_errno(); /* normal distribution */ par = unur_mvstd_new(distr); gen = unur_init( par ); n_tests_failed += (compare_sequence_gen_start(TESTLOG,88,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,94,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* [validate] */ /*---------------------------------------------------------------------------*/ /* [validate] */ void test_validate (void) { /* suppress GCC compiler warning */ GCC_DIAG_OFF(unused-variable) UNUR_DISTR *distr[19]; UNUR_PAR *par; UNUR_GEN *gen; double *darray; double fpm[10]; int n_tests_failed; int rcode; /* start test */ printf("[validate "); fflush(stdout); fprintf(TESTLOG,"\n[validate]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* distributions: 19 */ { distr[0] = unur_distr_multinormal(3,NULL,NULL); } { double mean[] = { -1., 2., -3. }; double covar[] = { 1., 0.8, 0.64, 0.8, 1., 0.8, 0.64, 0.8, 1. }; distr[1] = unur_distr_multinormal(3,mean,covar); } { #define dim (2) int i; double mean[dim], covar[dim*dim]; UNUR_DISTR *covar_distr; UNUR_GEN *covar_gen; UNUR_GEN *mean_gen; covar_distr = unur_distr_correlation(dim); covar_gen = unur_init(unur_mcorr_new(covar_distr)); mean_gen = unur_str2gen("normal(5,1)"); for (i=0; isetup time = %.3f ms\n", stopwatch_lap(&watch)); printf("\n(chi^2) "); fflush(stdout); /* chi^2 tests: 38 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nChi^2 Test:\n"); /* distribution [0] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_mvstd_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { UNUR_DISTR *dg =NULL; double mean[] = { -1., 2., -3. }; double covar[] = { 1., 0.8, 0.64, 0.8, 1., 0.8, 0.64, 0.8, 1. }; par = unur_mvstd_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cvec_set_mean(dg,mean); unur_distr_cvec_set_covar(dg,covar); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_mvstd_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { UNUR_DISTR *dg =NULL; double mean[] = { -1., 2., -3. }; double covar[] = { 1., 0.8, 0.64, 0.8, 1., 0.8, 0.64, 0.8, 1. }; par = unur_mvstd_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cvec_set_mean(dg,mean); unur_distr_cvec_set_covar(dg,covar); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [2] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_mvstd_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [3] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_mvstd_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); { UNUR_DISTR *dg =NULL; double mean[] = { -1., 2., -3. }; double covar[] = { 1., 0.8, 0.64, 0.8, 1., 0.8, 0.64, 0.8, 1. }; par = unur_mvstd_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cvec_set_mean(dg,mean); unur_distr_cvec_set_covar(dg,covar); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [4] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_mvstd_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [5] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_mvstd_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [6] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_mvstd_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [7] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_mvstd_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [8] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_mvstd_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [9] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_mvstd_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [10] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_mvstd_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [11] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_mvstd_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [12] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_mvstd_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [13] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_mvstd_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [14] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_mvstd_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [15] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_mvstd_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [16] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_mvstd_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [17] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_mvstd_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [18] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_mvstd_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); /* free distributions */ unur_distr_free(distr[0]); unur_distr_free(distr[1]); unur_distr_free(distr[2]); unur_distr_free(distr[3]); unur_distr_free(distr[4]); unur_distr_free(distr[5]); unur_distr_free(distr[6]); unur_distr_free(distr[7]); unur_distr_free(distr[8]); unur_distr_free(distr[9]); unur_distr_free(distr[10]); unur_distr_free(distr[11]); unur_distr_free(distr[12]); unur_distr_free(distr[13]); unur_distr_free(distr[14]); unur_distr_free(distr[15]); unur_distr_free(distr[16]); unur_distr_free(distr[17]); unur_distr_free(distr[18]); /* test finished */ test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; /* we accept CHI2_FAILURES_TOLERATED failures */ (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_validate */ /* enable GCC compiler warning */ GCC_DIAG_ON(unused-variable) /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_mvstd_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/test_StdDistr.c0000644001357500135600000005322214420445767014163 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: test_StdDistr.c * * * * Compare CDF, PDF and derivatives of PDF of varios distributions * * with Mathematica(TM) output. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* #define DEBUG 1 */ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include #include /*---------------------------------------------------------------------------*/ /* PDF test: maximal difference allowed (relative to maximal value) */ #define MAX_REL_DIFF 1.e-10 /* mode test: */ #define EPSX 1.e-5 /* stepsize */ #define EPSY 1.e-12 /* maximal allowed relative error */ /*---------------------------------------------------------------------------*/ /* name of data file */ static const char datafile[] = "t_StdDistr.data"; /* file handles */ static FILE *DATA; /* file with data */ static FILE *UNURANLOG; /* unuran log file */ static FILE *TESTLOG; /* test log file */ /*---------------------------------------------------------------------------*/ static int _unur_test_StdDistr (int *n_failed); /* main loop for testing standard distributions */ static int test_cdf_pdf( UNUR_DISTR *distr, char *datafile ); /* compare CDF, PDF and dPDF for continuous univariate distributions */ static int modetest_cont( UNUR_DISTR *distr); static int modetest_discr( UNUR_DISTR *distr); /* test mode of distribution */ /*---------------------------------------------------------------------------*/ #define MAX(a,b) ( ((a) < (b)) ? (b) : (a)) #define MIN(a,b) ( ((a) > (b)) ? (b) : (a)) /*---------------------------------------------------------------------------*/ int main() { /* number of failed tests */ int n_failed = 0; /* open log file for unuran and set output stream for unuran messages */ if ( (UNURANLOG = fopen( "t_StdDistr_unuran.log","w" )) == NULL ) exit (EXIT_FAILURE); unur_set_stream( UNURANLOG ); /* open log file for testing */ if ( (TESTLOG = fopen( "t_StdDistr_test.log","w" )) == NULL ) exit (EXIT_FAILURE); /* write header into log file */ { time_t started; fprintf(TESTLOG,"\nUNU.RAN - Universal Non-Uniform RANdom number generator\n\n"); if (time( &started ) != -1) fprintf(TESTLOG,"%s",ctime(&started)); fprintf(TESTLOG,"\n=======================================================\n\n"); fprintf(TESTLOG,"(Search for string \"distr=\" to find new section.)\n\n"); } /* open data file */ if ( (DATA = fopen( datafile,"r" )) == NULL ) { printf("ERROR: could not open file %s \n", datafile); fprintf(TESTLOG,"ERROR: could not open file %s \n", datafile); exit (77); /* ignore this error */ } /* run tests on all distributions */ while (_unur_test_StdDistr(&n_failed)==TRUE); /* close files */ fclose (UNURANLOG); fclose (TESTLOG); fclose (DATA); /* end */ if (n_failed > 0) { printf("[StdDistr --> failed]\n"); exit (EXIT_FAILURE); } else { printf("[StdDistr --> ok]\n"); exit (EXIT_SUCCESS); } } /* end of main() */ /*---------------------------------------------------------------------------*/ int _unur_test_StdDistr (int *n_failed) { #define BUFSIZE 1024 /* size of line buffer */ char buffer[BUFSIZE]; /* buffer for reading line */ char dstr[BUFSIZE]; /* distribution string */ UNUR_DISTR *distr; /* distribution object */ /* find next function string */ while (1) { /* read next line */ fgets(buffer, BUFSIZE, DATA); if (feof(DATA)) return FALSE; if (strncmp(buffer,"distr=",6)==0) break; } /* get function string */ strcpy( dstr, buffer+6 ); /* remove newline character */ dstr[strlen(dstr)-1] = '\0'; /* make distribution object with given function as PDF */ if ( (distr = unur_str2distr(dstr)) == NULL ) { printf("ERROR: syntax error in \"%s\"\n", dstr); fprintf(TESTLOG,"ERROR: syntax error in \"%s\"\n", dstr); exit (EXIT_FAILURE); } /* now run test */ if (test_cdf_pdf( distr,dstr ) == UNUR_FAILURE) (*n_failed)++; /* free memory */ unur_distr_free(distr); return TRUE; #undef BUFSIZE } /* end of _unur_test_StdDistr() */ /*---------------------------------------------------------------------------*/ int test_cdf_pdf( UNUR_DISTR *distr, char *distrAPI ) /*----------------------------------------------------------------------*/ /* test CDF, PDF and derivative of PDF by comparing to data */ /* read from file created by Mathematica. */ /* */ /* the ordering in this file is: */ /* n par[1] par[2] ... par[n] x CDF PDF dPDF */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* distrAPI ... string that contains name for distribution */ /* */ /* return: */ /* UNUR_SUCCESS ... if test was successful */ /* UNUR_FAILURE ... failed (difference too large) */ /* UNUR_ERR_NULL ... could not run test */ /*----------------------------------------------------------------------*/ { #define BUFSIZE 1024 /* size of line buffer */ #define MAX_FPARAMS 10 /* maximal number of parameters for distribution */ char buffer[BUFSIZE]; /* buffer for reading line */ char *ptr_buffer; /* pointer into buffer */ int n_fparams; /* number of parameters for distribution */ double fparams[10]; /* array for parameters for distribution */ double x; /* double argument */ int k = 0; /* integer argument */ double CDF_e, PDF_e, dPDF_e; /* expected values for CDF, PDF and derivative of PDF at x */ double CDF_o, PDF_o, dPDF_o; /* observed values for CDF, PDF and derivative of PDF at x */ double CDF_d, PDF_d, dPDF_d; /* differences between observed and expected values */ double CDF_md, PDF_md, dPDF_md; /* maximal difference (absolute) */ double CDF_me, PDF_me, dPDF_me; /* maximal expected absolute values */ int have_CDF, have_PDF, have_dPDF, have_upd_pdfarea; int is_DISCR; /* 1 if discrete distribution, 0 otherwise */ int n_failed = 0; /* number of failed tests */ const char *dname; /* name of distribution */ int i; /* discrete distribution ? */ is_DISCR = unur_distr_is_discr( distr ); /* name of distribution */ dname = unur_distr_get_name(distr); /* initialize */ CDF_md = PDF_md = dPDF_md = 0.; CDF_me = PDF_me = dPDF_me = 0.; /* check existence of CDF, PDF and dPDF */ if (is_DISCR==TRUE) { have_CDF = (unur_distr_discr_get_cdf(distr)) ? TRUE : FALSE; have_PDF = (unur_distr_discr_get_pmf(distr)) ? TRUE : FALSE; have_dPDF = FALSE; } else { /* is_CONT */ have_CDF = (unur_distr_cont_get_cdf(distr)) ? TRUE : FALSE; have_PDF = (unur_distr_cont_get_pdf(distr)) ? TRUE : FALSE; have_dPDF = (unur_distr_cont_get_dpdf(distr)) ? TRUE : FALSE; } /* check whether unur_distr_cont_upd_pdfarea() works */ if (is_DISCR==TRUE) have_upd_pdfarea = (unur_distr_discr_upd_pmfsum(distr)==UNUR_SUCCESS) ? TRUE : FALSE; else /* is_CONT */ have_upd_pdfarea = (unur_distr_cont_upd_pdfarea(distr)==UNUR_SUCCESS) ? TRUE : FALSE; if (have_upd_pdfarea==FALSE) { /* if we cannot update the area below the PDF, then the given PDF is not a "real" PDF, i.e. not normalized */ have_PDF = FALSE; have_dPDF = FALSE; } /* print info into log file */ fprintf(TESTLOG,"%s: distr= %s ...\n", dname, distrAPI); if (have_CDF==FALSE) fprintf(TESTLOG,"%s: no CDF!\n", dname); if (have_PDF==FALSE) fprintf(TESTLOG,"%s: no PDF!\n", dname); if (have_dPDF==FALSE) fprintf(TESTLOG,"%s: no dPDF!\n", dname); /* read data file */ while (1) { /* read next line */ fgets(buffer, BUFSIZE-1, DATA); if (feof(DATA) || isspace(buffer[0])) break; ptr_buffer = buffer; /* get number of parameters */ n_fparams = strtol(buffer, &ptr_buffer, 10); if (n_fparams < 0 || n_fparams >= MAX_FPARAMS) { printf("%s: ERROR: invalid number of parameters for distribution: %d \n", dname,n_fparams); fprintf(TESTLOG,"%s: ERROR: invalid number of parameters for distribution: %d \n", dname,n_fparams); return UNUR_ERR_NULL; } /* read parameters */ for (i=0; i CDF_md) CDF_md = CDF_d; if (PDF_d > PDF_md) PDF_md = PDF_d; if (dPDF_d > dPDF_md) dPDF_md = dPDF_d; /* maximal values */ if (CDF_e > CDF_me) CDF_me = CDF_e; if (PDF_e > PDF_me) PDF_me = PDF_e; if (dPDF_e > dPDF_me) dPDF_me = dPDF_e; /* test mode of distribution */ if (is_DISCR) { if (modetest_discr(distr) == UNUR_FAILURE) ++n_failed; } else { /* is_CONT */ if (modetest_cont(distr) == UNUR_FAILURE) ++n_failed; } } /* print info on screen */ fprintf(TESTLOG, "%s: \tmaximal difference:\n", dname); if (have_CDF) { fprintf(TESTLOG,"%s: \t\tCDF = %g ... ", dname,CDF_md); if (CDF_md > MAX_REL_DIFF * CDF_me) { fprintf(TESTLOG, "failed!!\n"); ++n_failed; } else fprintf(TESTLOG, "ok\n"); } if (have_PDF) { fprintf(TESTLOG,"%s: \t\tPDF = %g (rel = %g) ... ", dname,PDF_md,PDF_md/PDF_me); if (PDF_md > MAX_REL_DIFF * PDF_me) { fprintf(TESTLOG, "failed!!\n"); ++n_failed; } else fprintf(TESTLOG, "ok\n"); } if (have_dPDF) { fprintf(TESTLOG,"%s: \t\tdPDF = %g (rel = %g) ... ", dname,dPDF_md,dPDF_md/dPDF_me); if (dPDF_md > MAX_REL_DIFF * dPDF_me) { fprintf(TESTLOG, "failed!!\n"); ++n_failed; } else fprintf(TESTLOG, "ok\n"); } fprintf(TESTLOG, "\n----------------------------------------\n\n"); /* print result on screen */ printf("%-17s ... ", dname ); if (n_failed > 0) { printf("failed!!\n"); return UNUR_FAILURE; } else { printf("ok\n"); return UNUR_SUCCESS; } #undef BUFSIZE #undef MAX_FPARAMS } /* end of test_cdf_pdf() */ /*---------------------------------------------------------------------------*/ int modetest_cont( UNUR_DISTR *distr) /*----------------------------------------------------------------------*/ /* Tests whether the mode of continuous distribution is correct. */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* UNUR_SUCCESS ... if test was successful */ /* UNUR_FAILURE ... failed (difference too large) */ /* UNUR_ERR_NULL ... could not run test */ /*----------------------------------------------------------------------*/ { double m, fm; /* mode and value of PDF at mode */ double x, fx; /* argument x and value of PDF at x */ double domain[2]; /* boundaries of the domain of distribution */ const char *dname; /* name of distribution */ int n_failed = 0; /* number of failed tests */ int i; /* loop variable */ /* name of distribution */ dname = unur_distr_get_name(distr); /* get mode */ if (unur_distr_cont_upd_mode(distr)!=UNUR_SUCCESS ) { /* cannot read mode */ printf("%s: ERROR: cannot get mode\n", dname); fprintf(TESTLOG,"%s: ERROR: cannot get mode\n", dname); return UNUR_ERR_NULL; } m = unur_distr_cont_get_mode(distr); /* Correct possible problems if the mode m is on the boundary of domain */ unur_distr_cont_get_domain(distr,domain, domain+1); if(domain[1] - m < 1.e-11) m = MIN( m-EPSX/2., m*(m<0?(1.+EPSX/2.):1.-EPSX/2.) ); if(m - domain[0] < 1.e-11) m = MAX( m+EPSX/2., m*(m>0?(1.+EPSX/2.):1.-EPSX/2.) ); /* evaluate PDF at mode */ fm = unur_distr_cont_eval_pdf(m, distr); #ifdef DEBUG fprintf(TESTLOG,"%s: mode: m = %.20g, f(m) = %.20g\n", dname,m,fm); #endif /* test PDF left and right of mode */ for (i=0; i<2; i++) { if (i==0) /* right of mode */ x = MAX( m+EPSX, m*(m>0?(1.+EPSX):1.-EPSX) ); else /* left of mode */ x = MIN( m-EPSX, m*(m<0?(1.+EPSX):1.-EPSX) ); /* evaluate PDF */ fx = unur_distr_cont_eval_pdf(x, distr); #ifdef DEBUG fprintf(TESTLOG,"%s: x = %.20g, f(x) = %.20g", dname,x,fx); #endif if(fm * (1.+EPSY) < fx) { #ifdef DEBUG fprintf(TESTLOG," ... failed! f(mode) not maximal!"); #endif ++n_failed; } #ifdef DEBUG fprintf(TESTLOG,"\n"); #endif } #ifdef DEBUG fprintf(TESTLOG,"%s:\n",dname); #endif /* end */ return ((n_failed > 0) ? UNUR_FAILURE : UNUR_SUCCESS); } /* end of modetest_cont() */ /*---------------------------------------------------------------------------*/ int modetest_discr( UNUR_DISTR *distr) /*----------------------------------------------------------------------*/ /* Tests whether the mode of discr distribution is correct. */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* UNUR_SUCCESS ... if test was successful */ /* UNUR_FAILURE ... failed (difference too large) */ /* UNUR_ERR_NULL ... could not run test */ /*----------------------------------------------------------------------*/ { int m, x; /* mode and other argument for PDF */ double fm, fx; /* value of PDF at m and x */ const char *dname; /* name of distribution */ int n_failed = 0; /* number of failed tests */ int i; /* loop variable */ /* name of distribution */ dname = unur_distr_get_name(distr); /* get mode */ if (unur_distr_discr_upd_mode(distr)!=UNUR_SUCCESS ) { /* cannot read mode */ printf("%s: ERROR: cannot get mode\n", dname); fprintf(TESTLOG,"%s: ERROR: cannot get mode\n", dname); return UNUR_ERR_NULL; } m = unur_distr_discr_get_mode(distr); /* evaluate PMF at mode */ fm = unur_distr_discr_eval_pmf(m, distr); #ifdef DEBUG fprintf(TESTLOG,"%s: mode: m = %d, f(m) = %.20g\n", dname,m,fm); #endif /* test PMF left and right of mode */ for (i=-1; i<2; i+=2 ) { /* left and right of mode */ x = m + i; /* evaluate PMF */ fx = unur_distr_discr_eval_pmf(x, distr); #ifdef DEBUG fprintf(TESTLOG,"%s: x = %d, f(x) = %.20g", dname,x,fx); #endif if(fm * (1.+EPSY) < fx) { #ifdef DEBUG fprintf(TESTLOG," ... failed! f(mode) not maximal!"); #endif ++n_failed; } #ifdef DEBUG fprintf(TESTLOG,"\n"); #endif } #ifdef DEBUG fprintf(TESTLOG,"%s:\n",dname); #endif /* end */ return ((n_failed > 0) ? UNUR_FAILURE : UNUR_SUCCESS); } /* end of modetest_cont() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/tests/testcounter.c0000644001357500135600000001467214420445767013751 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: testcounter.c * * * * Count function evaluations * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #include #include #include /*---------------------------------------------------------------------------*/ /* count number of function evaluations */ /* -- global varibales ------------------------------------------------------*/ /* pointer for storing distribution object */ struct unur_distr *distr_to_use = NULL; /* counter for evaluations of PDF and similar functions */ static int counter_pdf = 0; static int counter_logpdf = 0; static int counter_cdf = 0; /* pointer to original functions */ static double (*cont_pdf_to_use)(double x, const struct unur_distr *distr); static double (*cont_logpdf_to_use)(double x, const struct unur_distr *distr); static double (*cont_cdf_to_use)(double x, const struct unur_distr *distr); /*---------------------------------------------------------------------------*/ /* wrapper for functions */ static double cont_pdf_with_counter( double x, const struct unur_distr *distr ) { ++counter_pdf; return cont_pdf_to_use(x,distr); } static double cont_logpdf_with_counter( double x, const struct unur_distr *distr ) { ++counter_logpdf; return cont_logpdf_to_use(x,distr); } static double cont_cdf_with_counter( double x, const struct unur_distr *distr ) { ++counter_cdf; return cont_cdf_to_use(x,distr); } /*---------------------------------------------------------------------------*/ /* set and start counter for PDF calls in parameter object */ int start_counter_fcalls( UNUR_PAR *par ) { /* clear object if necessary */ stop_counter_fcalls(); /* make a copy (clone) of the distribution object */ distr_to_use = _unur_distr_clone(par->distr); /* set pointer to distribution object in parameter object to cloned one */ par->distr = distr_to_use; par->distr_is_privatecopy = FALSE; /* exchange pointer to PDF etc. with counting wrapper */ switch (distr_to_use->type) { case UNUR_DISTR_CONT: /* this only works for continuous distributions */ /* PDF */ if (distr_to_use->data.cont.pdf) { if (distr_to_use->data.cont.pdf == cont_pdf_with_counter) { /* we must avoid this situation as it causes infinite recursion */ return UNUR_FAILURE; } cont_pdf_to_use = distr_to_use->data.cont.pdf; distr_to_use->data.cont.pdf = cont_pdf_with_counter; } /* logPDF */ if (distr_to_use->data.cont.logpdf) { if (distr_to_use->data.cont.logpdf == cont_logpdf_with_counter) { /* we must avoid this situation as it causes infinite recursion */ return UNUR_FAILURE; } cont_logpdf_to_use = distr_to_use->data.cont.logpdf; distr_to_use->data.cont.logpdf = cont_logpdf_with_counter; } /* CDF */ if (distr_to_use->data.cont.cdf) { if (distr_to_use->data.cont.cdf == cont_cdf_with_counter) { return UNUR_FAILURE; } cont_cdf_to_use = distr_to_use->data.cont.cdf; distr_to_use->data.cont.cdf = cont_cdf_with_counter; } break; default: return UNUR_FAILURE; } /* reset counter */ reset_counter_fcalls(); return UNUR_SUCCESS; } /*---------------------------------------------------------------------------*/ /* stop counter for PDF calls and clear memory */ int stop_counter_fcalls(void) { if (distr_to_use) unur_distr_free(distr_to_use); distr_to_use = NULL; cont_pdf_to_use = NULL; cont_logpdf_to_use = NULL; cont_cdf_to_use = NULL; return UNUR_SUCCESS; } /*---------------------------------------------------------------------------*/ /* reset counter to 0 */ void reset_counter_fcalls(void) { counter_pdf = 0; counter_logpdf = 0; counter_cdf = 0; } /*---------------------------------------------------------------------------*/ /* get number of PDF evaluations */ int get_counter_pdf(void) { return counter_pdf; } int get_counter_logpdf(void) { return counter_logpdf; } int get_counter_cdf(void) { return counter_cdf; } /*---------------------------------------------------------------------------*/ unuran-1.11.0/tests/t_norta.c0000644001357500135600000006144714430713513013026 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for NORTA **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); int unur_norta_set_verify( UNUR_PAR *par, int verify); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ #define COMPARE_SAMPLE_SIZE (10000) #define VIOLATE_SAMPLE_SIZE (20) /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,25,(unur_norta_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,25,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,32,(unur_norta_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,32,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* data missing in distribution object */ UNUR_DISTR *distr = NULL; double mean[] = {1.,2.}; double covar[] = {2.,1., 1., 2.}; distr = unur_distr_cvec_new(2); unur_reset_errno(); /* mean */ n_tests_failed += (check_expected_NULL(TESTLOG,42,(unur_norta_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,42,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* covariance matrix */ unur_distr_cvec_set_mean(distr,mean); unur_distr_cvec_set_covar(distr,covar); n_tests_failed += (check_expected_NULL(TESTLOG,48,(unur_norta_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,48,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [reinit] */ void test_reinit (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[reinit "); fflush(stdout); fprintf(TESTLOG,"\n[reinit]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* does not exist */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double x[3]; const int dim = 3; double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; distr = unur_distr_copula(dim, rankcorr); par = unur_norta_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 76, gen ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,80,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,80,UNUR_ERR_NO_REINIT)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_sample_vec( gen, x ); n_tests_failed += (check_expected_INFINITY(TESTLOG,84,(x[0]))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,84,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_reinit() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* compare clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; const int dim = 3; UNUR_GEN *clone; distr = unur_distr_copula(dim, NULL); par = unur_norta_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 95, gen ); unur_reset_errno(); /* copula without correlation */; n_tests_failed += (compare_sequence_gen_start(TESTLOG,99,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,105,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; const int dim = 3; double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; UNUR_GEN *clone; distr = unur_distr_copula(dim, rankcorr); par = unur_norta_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 114, gen ); unur_reset_errno(); /* copula with correlation */; n_tests_failed += (compare_sequence_gen_start(TESTLOG,118,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,124,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; const int dim = 3; double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; double gamma_params[] = {5.}; UNUR_GEN *clone; UNUR_DISTR *marginal; distr = unur_distr_cvec_new(dim); unur_distr_cvec_set_rankcorr(distr,rankcorr); marginal = unur_distr_gamma(gamma_params,1); unur_distr_cvec_set_marginals(distr,marginal); unur_distr_free(marginal); par = unur_norta_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 139, gen ); unur_reset_errno(); /* gamma marginals with correlation */; n_tests_failed += (compare_sequence_gen_start(TESTLOG,143,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,149,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; const int dim = 3; double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; double gamma_params[] = {5.}; double beta_params[] = {3.,5.}; UNUR_GEN *clone; distr = unur_distr_cvec_new(dim); unur_distr_cvec_set_rankcorr(distr,rankcorr); unur_distr_cvec_set_marginal_list(distr, unur_distr_cauchy(NULL,0), unur_distr_gamma(gamma_params,1), unur_distr_beta(beta_params,2) ); par = unur_norta_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 165, gen ); unur_reset_errno(); /* multivariate distribution with given marginals */; n_tests_failed += (compare_sequence_gen_start(TESTLOG,169,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,175,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; double gamma_params[] = {5.}; double beta_params[] = {3.,5.}; UNUR_GEN *clone; UNUR_DISTR *marginals[3]; distr = unur_distr_cvec_new(3); unur_distr_cvec_set_rankcorr(distr,rankcorr); marginals[0] = unur_distr_gamma(gamma_params,1); marginals[1] = unur_distr_cauchy(NULL,0); marginals[2] = unur_distr_beta(beta_params,2); unur_distr_cvec_set_marginal_array(distr,marginals); unur_distr_free(marginals[0]); unur_distr_free(marginals[1]); unur_distr_free(marginals[2]); par = unur_norta_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 194, gen ); unur_reset_errno(); /* multivariate distribution with given marginals */; n_tests_failed += (compare_sequence_gen_start(TESTLOG,198,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,204,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare clone 1dim */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; const int dim = 1; double beta_params[] = {3.,5.}; UNUR_GEN *clone; distr = unur_distr_cvec_new(dim); unur_distr_cvec_set_rankcorr(distr,NULL); unur_distr_cvec_set_marginal_list(distr, unur_distr_beta(beta_params,2) ); par = unur_norta_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 216, gen ); unur_reset_errno(); /* multivariate distribution with given marginals */; n_tests_failed += (compare_sequence_gen_start(TESTLOG,220,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,226,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* [validate] */ /*---------------------------------------------------------------------------*/ /* [validate] */ void test_validate (void) { /* suppress GCC compiler warning */ GCC_DIAG_OFF(unused-variable) UNUR_DISTR *distr[11]; UNUR_PAR *par; UNUR_GEN *gen; double *darray; double fpm[10]; int n_tests_failed; int rcode; /* start test */ printf("[validate "); fflush(stdout); fprintf(TESTLOG,"\n[validate]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* distributions: 11 */ { distr[0] = unur_distr_copula(3,NULL); } { double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; distr[1] = unur_distr_copula(3, rankcorr); } { #define dim (3) double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; double gamma_params[] = {5.}; UNUR_DISTR *marginal; distr[2] = unur_distr_cvec_new(dim); unur_distr_cvec_set_rankcorr(distr[2],rankcorr); marginal = unur_distr_gamma(gamma_params,1); unur_distr_cvec_set_marginals(distr[2],marginal); unur_distr_free(marginal); unur_distr_set_name(distr[2],"gamma marginals"); #undef dim } { #define dim (3) double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; double gamma_params[] = {5.}; double beta_params[] = {3.,5.}; distr[3] = unur_distr_cvec_new(dim); unur_distr_cvec_set_rankcorr(distr[3],rankcorr); unur_distr_cvec_set_marginal_list(distr[3], unur_distr_gamma(gamma_params,1), unur_distr_cauchy(NULL,0), unur_distr_beta(beta_params,2) ); unur_distr_set_name(distr[3],"gamma-cauchy-beta marginals"); #undef dim } { #define dim (3) UNUR_DISTR *corr_distr; UNUR_GEN *corr_gen; double corr[dim*dim]; corr_distr = unur_distr_correlation(dim); corr_gen = unur_init(unur_mcorr_new(corr_distr)); do { unur_sample_matr(corr_gen,corr); distr[4] = unur_distr_copula(dim, corr); } while (distr[4]==NULL); unur_distr_free(corr_distr); unur_free(corr_gen); unur_distr_set_name(distr[4],"copula with random correlations"); #undef dim } { #define dim (10) UNUR_DISTR *corr_distr; UNUR_GEN *corr_gen; double corr[dim*dim]; corr_distr = unur_distr_correlation(dim); corr_gen = unur_init(unur_mcorr_new(corr_distr)); do { unur_sample_matr(corr_gen,corr); distr[5] = unur_distr_copula(dim, corr); } while (distr[5]==NULL); unur_distr_free(corr_distr); unur_free(corr_gen); unur_distr_set_name(distr[5],"copula with random correlations"); #undef dim } { #define dim (30) UNUR_DISTR *corr_distr; UNUR_GEN *corr_gen; double corr[dim*dim]; corr_distr = unur_distr_correlation(dim); corr_gen = unur_init(unur_mcorr_new(corr_distr)); do { unur_sample_matr(corr_gen,corr); distr[6] = unur_distr_copula(dim, corr); } while (distr[6]==NULL); unur_distr_free(corr_distr); unur_free(corr_gen); unur_distr_set_name(distr[6],"copula with random correlations"); #undef dim } { #define dim (100) UNUR_DISTR *corr_distr; UNUR_GEN *corr_gen; double corr[dim*dim]; corr_distr = unur_distr_correlation(dim); corr_gen = unur_init(unur_mcorr_new(corr_distr)); do { unur_sample_matr(corr_gen,corr); distr[7] = unur_distr_copula(dim, corr); } while (distr[7]==NULL); unur_distr_free(corr_distr); unur_free(corr_gen); unur_distr_set_name(distr[7],"copula with random correlations"); #undef dim } { #define dim (3) double ll[3] = {0.,1.,0.}; double ru[3] = {1.,UNUR_INFINITY,UNUR_INFINITY}; double rankcorr[] = { 1., 0., 0., 0., 1., 0., 0., 0., 1. }; double gamma_params[] = {5.}; UNUR_DISTR *marginal; distr[8] = unur_distr_cvec_new(dim); unur_distr_cvec_set_rankcorr(distr[8],rankcorr); marginal = unur_distr_gamma(gamma_params,1); unur_distr_cvec_set_marginals(distr[8],marginal); unur_distr_cvec_set_domain_rect(distr[8],ll,ru); unur_distr_free(marginal); unur_distr_set_name(distr[8],"gamma marginals with rectangular domain"); #undef dim } { #define dim (3) double ll[3] = {0.,1.,2.}; double ru[3] = {1.,2., 3.}; double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; double gamma_params[] = {5.}; UNUR_DISTR *marginal; distr[9] = unur_distr_cvec_new(dim); unur_distr_cvec_set_rankcorr(distr[9],rankcorr); marginal = unur_distr_gamma(gamma_params,1); unur_distr_cvec_set_marginals(distr[9],marginal); unur_distr_cvec_set_domain_rect(distr[9],ll,ru); unur_distr_free(marginal); unur_distr_set_name(distr[9],"gamma marginals with rectangular domain"); #undef dim } { #define dim (3) double ll[3] = {0.,1.,2.}; double ru[3] = {1.,2., 3.}; double rankcorr[] = { 1., 0.5, 0.1, 0.5, 1., 0.3, 0.1, 0.3, 1. }; double gamma_params[] = {5.}; distr[10] = unur_distr_cvec_new(dim); unur_distr_cvec_set_rankcorr(distr[10],rankcorr); unur_distr_cvec_set_marginal_list(distr[10], unur_distr_gamma(gamma_params,1), unur_distr_gamma(gamma_params,1), unur_distr_gamma(gamma_params,1)); unur_distr_cvec_set_domain_rect(distr[10],ll,ru); unur_distr_set_name(distr[10],"gamma marginals with rectangular domain"); #undef dim } /* timing */ stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); printf("\n(chi^2) "); fflush(stdout); /* chi^2 tests: 11 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nChi^2 Test:\n"); /* distribution [0] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_norta_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_norta_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [2] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_norta_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [3] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_norta_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [4] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_norta_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [5] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_norta_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [6] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_norta_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [7] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_norta_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [8] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_norta_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [9] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_norta_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [10] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_norta_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); /* free distributions */ unur_distr_free(distr[0]); unur_distr_free(distr[1]); unur_distr_free(distr[2]); unur_distr_free(distr[3]); unur_distr_free(distr[4]); unur_distr_free(distr[5]); unur_distr_free(distr[6]); unur_distr_free(distr[7]); unur_distr_free(distr[8]); unur_distr_free(distr[9]); unur_distr_free(distr[10]); /* test finished */ test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; /* we accept CHI2_FAILURES_TOLERATED failures */ (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_validate */ /* enable GCC compiler warning */ GCC_DIAG_ON(unused-variable) /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_norta_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_hrb.c0000644001357500135600000006351714430713513012456 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for HRB **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ double HR_decreasing(double x, const UNUR_DISTR *distr); double CDF_decreasing(double x, const UNUR_DISTR *distr); double HR_constant(double x, const UNUR_DISTR *distr); double CDF_constant(double x, const UNUR_DISTR *distr); double HR_increasing(double x, const UNUR_DISTR *distr); double CDF_increasing(double x, const UNUR_DISTR *distr); int unur_hrb_set_pedantic( UNUR_PAR *par, int pedantic ); #define COMPARE_SAMPLE_SIZE (10000) #define VIOLATE_SAMPLE_SIZE (20) /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ double HR_decreasing(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* example with decreasing hazard rate */ { return (1./(1.+x)); } double CDF_decreasing(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* CDF for example with decreasing hazard rate */ { return (x/(1. + x)); } double HR_constant(double x ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* example with constant hazard rate: standard expontential */ { return 1.; } double CDF_constant(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* CDF for example with constant hazard rate: standard expontential */ { return (1.-exp(-x)); } double HR_increasing(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* example with increasing hazard rate: Weibull (alpha=3,beta=1) */ { return (3*x*x); } double CDF_increasing(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* CDF for example with increasing hazard rate: Weibull (alpha=3,beta=1) */ { return (1.-exp(-x*x*x)); } /* dummy function */ int unur_hrb_set_pedantic( UNUR_PAR *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) { return 1; } /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,36,(unur_hrb_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,36,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,42,(unur_hrb_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,42,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* data missing in distribution object */ UNUR_DISTR *distr = NULL; distr = unur_distr_cont_new(); unur_reset_errno(); /* hazard rate */ n_tests_failed += (check_expected_NULL(TESTLOG,49,(unur_hrb_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,49,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [set] */ void test_set (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[set "); fflush(stdout); fprintf(TESTLOG,"\n[set]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,59,(unur_hrb_set_upperbound(par,1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,59,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,62,(unur_hrb_set_verify(par,1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,62,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* invalid parameter object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,70,(unur_hrb_set_upperbound(par,1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,70,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,73,(unur_hrb_set_verify(par,1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,73,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = unur_distr_cont_new(); unur_distr_cont_set_hr(distr,HR_decreasing); par = unur_hrb_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,84,(unur_hrb_set_upperbound(par,-1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,84,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,87,(unur_hrb_set_upperbound(par,UNUR_INFINITY)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,87,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_set() */ /*---------------------------------------------------------------------------*/ /* [chg] */ void test_chg (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[chg "); fflush(stdout); fprintf(TESTLOG,"\n[chg]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid generator object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); unur_set_debug(par,0); gen = unur_init( par ); abort_if_NULL(TESTLOG, 102, gen ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,106,(unur_hrb_chg_verify(gen,1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,106,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_chg() */ /*---------------------------------------------------------------------------*/ /* [init] */ void test_init (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[init "); fflush(stdout); fprintf(TESTLOG,"\n[init]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* left border no valid upper bound */ UNUR_GEN *gen = NULL; UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; gen = NULL; distr = unur_distr_cont_new(); unur_distr_cont_set_hr(distr,HR_increasing); par = unur_hrb_new(distr); abort_if_NULL(TESTLOG, 116, par ); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,120,(gen = unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,120,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; unur_free(gen); unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_init() */ /*---------------------------------------------------------------------------*/ /* [reinit] */ void test_reinit (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[reinit "); fflush(stdout); fprintf(TESTLOG,"\n[reinit]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* does not exist */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_cont_new(); unur_distr_cont_set_hr(distr,HR_decreasing); par = unur_hrb_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 131, gen ); unur_reset_errno(); n_tests_failed += (check_expected_reinit(TESTLOG,135,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_reinit() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* compare */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = unur_distr_cont_new(); unur_distr_cont_set_hr(distr,HR_decreasing); par = NULL; unur_reset_errno(); /* default algorithm */ par = unur_hrb_new(distr); n_tests_failed += (compare_sequence_par_start(TESTLOG,148,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* default algorithm - set upper bound */ par = unur_hrb_new(distr); unur_hrb_set_upperbound(par,1.); n_tests_failed += (compare_sequence_par(TESTLOG,153,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* default algorithm - verifying mode */ par = unur_hrb_new(distr); unur_hrb_set_verify(par,1); n_tests_failed += (compare_sequence_par(TESTLOG,158,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* default algorithm - ignore invalid boundary */ unur_distr_cont_set_domain(distr,-10.,10.); par = unur_hrb_new(distr); n_tests_failed += (compare_sequence_par_start(TESTLOG,163,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* compare reinit */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_cont_new(); unur_distr_cont_set_hr(distr,HR_decreasing); par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_hrb_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,176,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* reinit */ unur_reinit(gen); n_tests_failed += (compare_sequence_gen(TESTLOG,180,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare stringparser */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = NULL; par = NULL; gen = NULL; unur_reset_errno(); distr = unur_distr_cont_new(); unur_distr_cont_set_hrstr(distr,"1/(1+x)"); par = unur_hrb_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,194,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "cont; hr = \"1/(1+x)\"; domain = (0,inf)& \ method = hrb" ); n_tests_failed += (compare_sequence_gen(TESTLOG,200,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; distr = unur_distr_cont_new(); unur_distr_cont_set_hrstr(distr,"1/(1+x)"); par = unur_hrb_new(distr); unur_hrb_set_upperbound(par,2.); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,208,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "cont; hr = \"1/(1+x)\"; domain = (0,inf)& \ method = hrb; upperbound = 2" ); n_tests_failed += (compare_sequence_gen(TESTLOG,214,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* [validate] */ /*---------------------------------------------------------------------------*/ /* [validate] */ void test_validate (void) { /* suppress GCC compiler warning */ GCC_DIAG_OFF(unused-variable) UNUR_DISTR *distr[3]; UNUR_PAR *par; UNUR_GEN *gen; double *darray; double fpm[10]; int n_tests_failed; int rcode; /* start test */ printf("[validate "); fflush(stdout); fprintf(TESTLOG,"\n[validate]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* distributions: 3 */ { distr[0] = unur_distr_cont_new(); unur_distr_set_name(distr[0],"decreasing HR"); unur_distr_cont_set_hr(distr[0],HR_decreasing); unur_distr_cont_set_cdf(distr[0],CDF_decreasing); } { distr[1] = unur_distr_cont_new(); unur_distr_set_name(distr[1],"constant HR"); unur_distr_cont_set_hr(distr[1],HR_constant); unur_distr_cont_set_cdf(distr[1],CDF_constant); } { distr[2] = unur_distr_cont_new(); unur_distr_set_name(distr[2],"increasing HR"); unur_distr_cont_set_hr(distr[2],HR_increasing); unur_distr_cont_set_cdf(distr[2],CDF_increasing); } /* timing */ stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); printf("\n(chi^2) "); fflush(stdout); /* chi^2 tests: 9 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nChi^2 Test:\n"); /* distribution [0] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_hrb_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_hrb_new(distr_localcopy); unur_hrb_set_upperbound(par,1.2); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_hrb_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_hrb_new(distr_localcopy); unur_hrb_set_upperbound(par,1.2); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_hrb_new(distr_localcopy); unur_hrb_set_upperbound(par,0.9); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [2] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_hrb_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_hrb_new(distr_localcopy); unur_hrb_set_upperbound(par,1.2); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); printf("\n(verify hat) "); fflush(stdout); /* verify hat tests: 9 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nVerify Hat Test (squeeze <= PDF <= hat):\n"); /* distribution [0] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_hrb_new(distr_localcopy); unur_hrb_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_hrb_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_hrb_new(distr_localcopy); unur_hrb_set_pedantic(par,0); unur_hrb_set_upperbound(par,1.2); gen = unur_init(par); if (gen) unur_hrb_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_hrb_new(distr_localcopy); unur_hrb_set_pedantic(par,0); unur_hrb_set_upperbound(par,0.9); gen = unur_init(par); if (gen) unur_hrb_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_hrb_new(distr_localcopy); unur_hrb_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_hrb_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_hrb_new(distr_localcopy); unur_hrb_set_pedantic(par,0); unur_hrb_set_upperbound(par,1.2); gen = unur_init(par); if (gen) unur_hrb_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_hrb_new(distr_localcopy); unur_hrb_set_pedantic(par,0); unur_hrb_set_upperbound(par,0.9); gen = unur_init(par); if (gen) unur_hrb_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [2] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_hrb_new(distr_localcopy); unur_hrb_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_hrb_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_hrb_new(distr_localcopy); unur_hrb_set_pedantic(par,0); unur_hrb_set_upperbound(par,1.2); gen = unur_init(par); if (gen) unur_hrb_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); /* free distributions */ unur_distr_free(distr[0]); unur_distr_free(distr[1]); unur_distr_free(distr[2]); /* test finished */ test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; /* we accept CHI2_FAILURES_TOLERATED failures */ (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_validate */ /* enable GCC compiler warning */ GCC_DIAG_ON(unused-variable) /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_hrb_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_distr_cont.c0000644001357500135600000022522414430713513014046 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for DISTR_CONT **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); int unur_distr_cont_set_verify( UNUR_PAR *par, int verify); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ #include /* prototypes */ #define COMPARE_SAMPLE_SIZE (500) #define VIOLATE_SAMPLE_SIZE (20) double pdf(double x, const UNUR_DISTR *distr); double dpdf(double x, const UNUR_DISTR *distr); double cdf(double x, const UNUR_DISTR *distr); double invcdf(double x, const UNUR_DISTR *distr); double hr(double x, const UNUR_DISTR *distr); int unur_distr_cont_set_pedantic(UNUR_PAR *par, int pedantic); int unur_distr_cont_chg_verify(UNUR_GEN *gen, int verify); /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ double pdf(double x ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return 1.; } double dpdf(double x ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return 1.; } double cdf(double x ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return 1.; } double invcdf(double x ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return 1.; } double hr(double x ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return 1.; } int unur_distr_cont_set_pedantic(UNUR_PAR *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) { return UNUR_FAILURE; } int unur_distr_cont_chg_verify(UNUR_GEN *gen, int verify) { if (unur_arou_chg_verify(gen,verify)==UNUR_SUCCESS) return UNUR_SUCCESS; if (unur_srou_chg_verify(gen,verify)==UNUR_SUCCESS) return UNUR_SUCCESS; return UNUR_FAILURE; } /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [set] */ void test_set (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[set "); fflush(stdout); fprintf(TESTLOG,"\n[set]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,42,(unur_distr_cont_set_pdf( distr, pdf )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,42,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,45,(unur_distr_cont_set_dpdf( distr, dpdf )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,45,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,48,(unur_distr_cont_set_logpdf( distr, pdf )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,48,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,51,(unur_distr_cont_set_dlogpdf( distr, dpdf )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,51,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,54,(unur_distr_cont_set_cdf( distr, cdf )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,54,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,57,(unur_distr_cont_set_invcdf( distr, invcdf )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,57,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,60,(unur_distr_cont_set_hr( distr, hr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,60,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,63,(unur_distr_cont_set_pdfstr( distr, "pdf" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,63,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,66,(unur_distr_cont_set_logpdfstr( distr, "pdf" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,66,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,69,(unur_distr_cont_set_cdfstr( distr, "cdf" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,69,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,72,(unur_distr_cont_set_hrstr( distr, "hr" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,72,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,75,(unur_distr_cont_set_pdfparams( distr, NULL, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,75,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,78,(unur_distr_cont_set_pdfparams_vec( distr, 0, NULL, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,78,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,81,(unur_distr_cont_set_domain( distr, 0., 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,81,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,84,(unur_distr_cont_set_mode( distr, 0. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,84,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,87,(unur_distr_cont_set_center( distr, 0. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,87,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,90,(unur_distr_cont_set_pdfarea( distr, 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,90,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,97,(unur_distr_cont_set_pdf( distr, pdf )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,97,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,100,(unur_distr_cont_set_dpdf( distr, dpdf )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,100,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,103,(unur_distr_cont_set_logpdf( distr, pdf )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,103,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,106,(unur_distr_cont_set_dlogpdf( distr, dpdf )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,106,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,109,(unur_distr_cont_set_cdf( distr, cdf )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,109,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,112,(unur_distr_cont_set_invcdf( distr, invcdf )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,112,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,115,(unur_distr_cont_set_hr( distr, hr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,115,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,118,(unur_distr_cont_set_pdfstr( distr, "exp(-x)" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,118,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,121,(unur_distr_cont_set_pdfstr( distr, "-x" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,121,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,124,(unur_distr_cont_set_cdfstr( distr, "exp(-x)" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,124,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,127,(unur_distr_cont_set_hrstr( distr, "exp(-x)" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,127,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,130,(unur_distr_cont_set_pdfparams( distr, NULL, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,130,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,133,(unur_distr_cont_set_domain( distr, 0., 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,133,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,136,(unur_distr_cont_set_mode( distr, 0. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,136,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,139,(unur_distr_cont_set_center( distr, 0. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,139,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,142,(unur_distr_cont_set_pdfarea( distr, 1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,142,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = unur_distr_cont_new(); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,149,(unur_distr_cont_set_pdf( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,149,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,152,(unur_distr_cont_set_dpdf( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,152,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,155,(unur_distr_cont_set_logpdf( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,155,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,158,(unur_distr_cont_set_dlogpdf( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,158,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,161,(unur_distr_cont_set_cdf( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,161,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,164,(unur_distr_cont_set_invcdf( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,164,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,167,(unur_distr_cont_set_hr( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,167,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,170,(unur_distr_cont_set_pdfstr( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,170,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,173,(unur_distr_cont_set_logpdfstr( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,173,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,176,(unur_distr_cont_set_cdfstr( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,176,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,179,(unur_distr_cont_set_hrstr( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,179,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,182,(unur_distr_cont_set_pdfparams( distr, NULL, 1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,182,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; double pv[] = {1.,2.,3.}; distr = unur_distr_cont_new(); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,190,(unur_distr_cont_set_pdfstr( distr, "" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,190,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,193,(unur_distr_cont_set_pdfstr( distr, "x * y * z" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,193,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,196,(unur_distr_cont_set_pdfstr( distr, "beta(2.)" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,196,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,199,(unur_distr_cont_set_logpdfstr( distr, "" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,199,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,202,(unur_distr_cont_set_logpdfstr( distr, "x * y * z" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,202,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,205,(unur_distr_cont_set_logpdfstr( distr, "beta(2.)" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,205,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,208,(unur_distr_cont_set_cdfstr( distr, "" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,208,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,211,(unur_distr_cont_set_cdfstr( distr, "beta(2.)" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,211,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,214,(unur_distr_cont_set_hrstr( distr, "" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,214,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,217,(unur_distr_cont_set_pdfparams( distr, pv, -1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,217,UNUR_ERR_DISTR_NPARAMS)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,220,(unur_distr_cont_set_pdfparams( distr, pv, UNUR_DISTR_MAXPARAMS +1 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,220,UNUR_ERR_DISTR_NPARAMS)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,223,(unur_distr_cont_set_pdfparams_vec( distr, -1, pv, 2 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,223,UNUR_ERR_DISTR_NPARAMS)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,226,(unur_distr_cont_set_pdfparams_vec( distr, 100000, pv, 2 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,226,UNUR_ERR_DISTR_NPARAMS)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,229,(unur_distr_cont_set_domain( distr, 0., -1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,229,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,232,(unur_distr_cont_set_pdfarea( distr, -1. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,232,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid set parameters */ UNUR_DISTR *distr = NULL; distr = unur_distr_normal(NULL,0); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,239,(unur_distr_cont_set_pdf( distr, pdf )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,239,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,242,(unur_distr_cont_set_dpdf( distr, dpdf )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,242,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,245,(unur_distr_cont_set_logpdf( distr, pdf )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,245,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,248,(unur_distr_cont_set_dlogpdf( distr, dpdf )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,248,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_set() */ /*---------------------------------------------------------------------------*/ /* [get] */ void test_get (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[get "); fflush(stdout); fprintf(TESTLOG,"\n[get]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; double a, b; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,261,(unur_distr_cont_get_pdf( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,261,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,264,(unur_distr_cont_get_dpdf( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,264,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,267,(unur_distr_cont_get_logpdf( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,267,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,270,(unur_distr_cont_get_dlogpdf( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,270,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,273,(unur_distr_cont_get_cdf( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,273,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,276,(unur_distr_cont_get_invcdf( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,276,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,279,(unur_distr_cont_get_hr( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,279,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,282,(unur_distr_cont_get_pdfstr( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,282,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,285,(unur_distr_cont_get_dpdfstr( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,285,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,288,(unur_distr_cont_get_logpdfstr( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,288,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,291,(unur_distr_cont_get_dlogpdfstr( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,291,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,294,(unur_distr_cont_get_cdfstr( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,294,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,297,(unur_distr_cont_get_hrstr( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,297,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_zero(TESTLOG,300,(unur_distr_cont_get_pdfparams( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,300,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_zero(TESTLOG,303,(unur_distr_cont_get_pdfparams_vec( distr, 0, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,303,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,306,(unur_distr_cont_get_domain( distr, &a, &b )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,306,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,309,(unur_distr_cont_get_mode( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,309,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,312,(unur_distr_cont_get_pdfarea( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,312,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; double a,b; const double *ar; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,321,(unur_distr_cont_get_pdf( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,321,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,324,(unur_distr_cont_get_dpdf( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,324,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,327,(unur_distr_cont_get_logpdf( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,327,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,330,(unur_distr_cont_get_dlogpdf( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,330,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,333,(unur_distr_cont_get_cdf( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,333,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,336,(unur_distr_cont_get_invcdf( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,336,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,339,(unur_distr_cont_get_hr( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,339,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,342,(unur_distr_cont_get_pdfstr( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,342,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,345,(unur_distr_cont_get_dpdfstr( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,345,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,348,(unur_distr_cont_get_logpdfstr( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,348,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,351,(unur_distr_cont_get_dlogpdfstr( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,351,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,354,(unur_distr_cont_get_cdfstr( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,354,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,357,(unur_distr_cont_get_hrstr( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,357,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_zero(TESTLOG,360,(unur_distr_cont_get_pdfparams( distr, NULL )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,360,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_zero(TESTLOG,363,(unur_distr_cont_get_pdfparams_vec( distr, 0, &ar )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,363,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,366,(unur_distr_cont_get_domain( distr, &a, &b )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,366,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,369,(unur_distr_cont_get_mode( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,369,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,372,(unur_distr_cont_get_pdfarea( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,372,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* parameters not unknown */ UNUR_DISTR *distr = NULL; distr = unur_distr_cont_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,379,(unur_distr_cont_get_pdfstr( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,379,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,382,(unur_distr_cont_get_dpdfstr( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,382,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,385,(unur_distr_cont_get_logpdfstr( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,385,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,388,(unur_distr_cont_get_dlogpdfstr( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,388,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,391,(unur_distr_cont_get_cdfstr( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,391,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,394,(unur_distr_cont_get_hrstr( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,394,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,397,(unur_distr_cont_get_mode( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,397,UNUR_ERR_DISTR_GET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,400,(unur_distr_cont_get_pdfarea( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,400,UNUR_ERR_DISTR_GET)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_get() */ /*---------------------------------------------------------------------------*/ /* [chg] */ void test_chg (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[chg "); fflush(stdout); fprintf(TESTLOG,"\n[chg]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,411,(unur_distr_cont_upd_mode( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,411,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,414,(unur_distr_cont_upd_pdfarea( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,414,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,421,(unur_distr_cont_upd_mode( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,421,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,424,(unur_distr_cont_upd_pdfarea( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,424,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* missing data */ UNUR_DISTR *distr = NULL; distr = unur_distr_cont_new(); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,431,(unur_distr_cont_upd_mode( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,431,UNUR_ERR_DISTR_DATA)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,434,(unur_distr_cont_upd_pdfarea( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,434,UNUR_ERR_DISTR_DATA)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_chg() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,453,(unur_distr_cont_eval_pdf( 1., distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,453,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,456,(unur_distr_cont_eval_dpdf( 1., distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,456,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,459,(unur_distr_cont_eval_logpdf( 1., distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,459,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,462,(unur_distr_cont_eval_dlogpdf( 1., distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,462,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,465,(unur_distr_cont_eval_cdf( 1., distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,465,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,468,(unur_distr_cont_eval_invcdf( 0.5, distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,468,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,471,(unur_distr_cont_eval_hr( 1., distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,471,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution object */ UNUR_DISTR *distr = NULL; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,478,(unur_distr_cont_eval_pdf( 1., distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,478,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,481,(unur_distr_cont_eval_dpdf( 1., distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,481,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,484,(unur_distr_cont_eval_logpdf( 1., distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,484,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,487,(unur_distr_cont_eval_dlogpdf( 1., distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,487,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,490,(unur_distr_cont_eval_cdf( 1., distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,490,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,493,(unur_distr_cont_eval_invcdf( 0.5, distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,493,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,496,(unur_distr_cont_eval_hr( 1., distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,496,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* missing data */ UNUR_DISTR *distr = NULL; distr = unur_distr_cont_new(); unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,503,(unur_distr_cont_eval_pdf( 1., distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,503,UNUR_ERR_DISTR_DATA)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,506,(unur_distr_cont_eval_dpdf( 1., distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,506,UNUR_ERR_DISTR_DATA)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,509,(unur_distr_cont_eval_logpdf( 1., distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,509,UNUR_ERR_DISTR_DATA)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,512,(unur_distr_cont_eval_dlogpdf( 1., distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,512,UNUR_ERR_DISTR_DATA)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,515,(unur_distr_cont_eval_cdf( 1., distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,515,UNUR_ERR_DISTR_DATA)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,518,(unur_distr_cont_eval_invcdf( 0.5, distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,518,UNUR_ERR_DISTR_DATA)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_INFINITY(TESTLOG,521,(unur_distr_cont_eval_hr( 1., distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,521,UNUR_ERR_DISTR_DATA)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* check for memory leaks */ UNUR_DISTR *distr = NULL; double x[] = { 1., 2., 3. }; distr = unur_distr_cont_new(); unur_reset_errno(); unur_distr_cont_set_pdfparams_vec( distr, 0, x, 3 ); n_tests_failed += (check_errorcode(TESTLOG,529,UNUR_SUCCESS)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* [validate] */ /*---------------------------------------------------------------------------*/ /* [validate] */ void test_validate (void) { /* suppress GCC compiler warning */ GCC_DIAG_OFF(unused-variable) UNUR_DISTR *distr[12]; UNUR_PAR *par; UNUR_GEN *gen; double *darray; double fpm[10]; int n_tests_failed; int rcode; /* start test */ printf("[validate "); fflush(stdout); fprintf(TESTLOG,"\n[validate]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* distributions: 12 */ { fpm[0] = 3.; fpm[1] = 4.; distr[0] = unur_distr_beta_w_pdf_from_logpdf(fpm,2); } { distr[1] = unur_distr_cauchy_w_pdf_from_logpdf(NULL,0); } { fpm[0] = 3.; fpm[1] = 4.; distr[2] = unur_distr_cauchy_w_pdf_from_logpdf(fpm,2); } { distr[3] = unur_distr_exponential_w_pdf_from_logpdf(NULL,0); } { fpm[0] = 3.; fpm[1] = 4.; distr[4] = unur_distr_exponential_w_pdf_from_logpdf(fpm,2); } { fpm[0] = 1.; distr[5] = unur_distr_gamma_w_pdf_from_logpdf(fpm,1); } { fpm[0] = 1.; fpm[1] = 4.; distr[6] = unur_distr_gamma_w_pdf_from_logpdf(fpm,2); } { fpm[0] = 3.; distr[7] = unur_distr_gamma_w_pdf_from_logpdf(fpm,1); } { fpm[0] = 3.; fpm[1] = 4.; distr[8] = unur_distr_gamma_w_pdf_from_logpdf(fpm,2); } { distr[9] = unur_distr_normal_w_pdf_from_logpdf(NULL,0); } { fpm[0] = 3.; fpm[1] = 4.; distr[10] = unur_distr_normal_w_pdf_from_logpdf(fpm,2); } { fpm[0] = 5.; distr[11] = unur_distr_powerexponential_w_pdf_from_logpdf(fpm,1); } /* timing */ stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); printf("\n(chi^2) "); fflush(stdout); /* chi^2 tests: 36 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nChi^2 Test:\n"); /* distribution [0] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_arou_new(distr_localcopy); unur_arou_set_usedars(par,0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_arou_new(distr_localcopy); unur_arou_set_usedars(par,0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [2] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_arou_new(distr_localcopy); unur_arou_set_usedars(par,0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [3] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_arou_new(distr_localcopy); unur_arou_set_usedars(par,0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [4] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_arou_new(distr_localcopy); unur_arou_set_usedars(par,0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [5] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_arou_new(distr_localcopy); unur_arou_set_usedars(par,0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [6] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_arou_new(distr_localcopy); unur_arou_set_usedars(par,0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [7] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_arou_new(distr_localcopy); unur_arou_set_usedars(par,0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [8] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_arou_new(distr_localcopy); unur_arou_set_usedars(par,0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [9] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_arou_new(distr_localcopy); unur_arou_set_usedars(par,0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [10] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_arou_new(distr_localcopy); unur_arou_set_usedars(par,0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[10],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [11] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_arou_new(distr_localcopy); unur_arou_set_usedars(par,0); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_arou_new(distr_localcopy); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_srou_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); printf("\n(verify hat) "); fflush(stdout); /* verify hat tests: 36 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nVerify Hat Test (squeeze <= PDF <= hat):\n"); /* distribution [0] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_arou_new(distr_localcopy); unur_distr_cont_set_pedantic(par,0); unur_arou_set_usedars(par,0); gen = unur_init(par); if (gen) unur_distr_cont_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_arou_new(distr_localcopy); unur_distr_cont_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); if (gen) unur_distr_cont_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_srou_new(distr_localcopy); unur_distr_cont_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_distr_cont_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_arou_new(distr_localcopy); unur_distr_cont_set_pedantic(par,0); unur_arou_set_usedars(par,0); gen = unur_init(par); if (gen) unur_distr_cont_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_arou_new(distr_localcopy); unur_distr_cont_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); if (gen) unur_distr_cont_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_srou_new(distr_localcopy); unur_distr_cont_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_distr_cont_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [2] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_arou_new(distr_localcopy); unur_distr_cont_set_pedantic(par,0); unur_arou_set_usedars(par,0); gen = unur_init(par); if (gen) unur_distr_cont_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_arou_new(distr_localcopy); unur_distr_cont_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); if (gen) unur_distr_cont_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_srou_new(distr_localcopy); unur_distr_cont_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_distr_cont_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [3] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_arou_new(distr_localcopy); unur_distr_cont_set_pedantic(par,0); unur_arou_set_usedars(par,0); gen = unur_init(par); if (gen) unur_distr_cont_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_arou_new(distr_localcopy); unur_distr_cont_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); if (gen) unur_distr_cont_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_srou_new(distr_localcopy); unur_distr_cont_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_distr_cont_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [4] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_arou_new(distr_localcopy); unur_distr_cont_set_pedantic(par,0); unur_arou_set_usedars(par,0); gen = unur_init(par); if (gen) unur_distr_cont_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_arou_new(distr_localcopy); unur_distr_cont_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); if (gen) unur_distr_cont_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_srou_new(distr_localcopy); unur_distr_cont_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_distr_cont_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [5] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_arou_new(distr_localcopy); unur_distr_cont_set_pedantic(par,0); unur_arou_set_usedars(par,0); gen = unur_init(par); if (gen) unur_distr_cont_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_arou_new(distr_localcopy); unur_distr_cont_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); if (gen) unur_distr_cont_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_srou_new(distr_localcopy); unur_distr_cont_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_distr_cont_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [6] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_arou_new(distr_localcopy); unur_distr_cont_set_pedantic(par,0); unur_arou_set_usedars(par,0); gen = unur_init(par); if (gen) unur_distr_cont_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_arou_new(distr_localcopy); unur_distr_cont_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); if (gen) unur_distr_cont_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_srou_new(distr_localcopy); unur_distr_cont_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_distr_cont_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [7] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_arou_new(distr_localcopy); unur_distr_cont_set_pedantic(par,0); unur_arou_set_usedars(par,0); gen = unur_init(par); if (gen) unur_distr_cont_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_arou_new(distr_localcopy); unur_distr_cont_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); if (gen) unur_distr_cont_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_srou_new(distr_localcopy); unur_distr_cont_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_distr_cont_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [8] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_arou_new(distr_localcopy); unur_distr_cont_set_pedantic(par,0); unur_arou_set_usedars(par,0); gen = unur_init(par); if (gen) unur_distr_cont_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_arou_new(distr_localcopy); unur_distr_cont_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); if (gen) unur_distr_cont_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_srou_new(distr_localcopy); unur_distr_cont_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_distr_cont_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [9] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_arou_new(distr_localcopy); unur_distr_cont_set_pedantic(par,0); unur_arou_set_usedars(par,0); gen = unur_init(par); if (gen) unur_distr_cont_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_arou_new(distr_localcopy); unur_distr_cont_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); if (gen) unur_distr_cont_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_srou_new(distr_localcopy); unur_distr_cont_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_distr_cont_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [10] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_arou_new(distr_localcopy); unur_distr_cont_set_pedantic(par,0); unur_arou_set_usedars(par,0); gen = unur_init(par); if (gen) unur_distr_cont_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_arou_new(distr_localcopy); unur_distr_cont_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); if (gen) unur_distr_cont_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[10]); par = unur_srou_new(distr_localcopy); unur_distr_cont_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_distr_cont_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[10],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [11] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_arou_new(distr_localcopy); unur_distr_cont_set_pedantic(par,0); unur_arou_set_usedars(par,0); gen = unur_init(par); if (gen) unur_distr_cont_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_arou_new(distr_localcopy); unur_distr_cont_set_pedantic(par,0); unur_arou_set_cpoints( par, 8, NULL ); unur_arou_set_usedars(par,1); gen = unur_init(par); if (gen) unur_distr_cont_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_srou_new(distr_localcopy); unur_distr_cont_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_distr_cont_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); /* free distributions */ unur_distr_free(distr[0]); unur_distr_free(distr[1]); unur_distr_free(distr[2]); unur_distr_free(distr[3]); unur_distr_free(distr[4]); unur_distr_free(distr[5]); unur_distr_free(distr[6]); unur_distr_free(distr[7]); unur_distr_free(distr[8]); unur_distr_free(distr[9]); unur_distr_free(distr[10]); unur_distr_free(distr[11]); /* test finished */ test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; /* we accept CHI2_FAILURES_TOLERATED failures */ (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_validate */ /* enable GCC compiler warning */ GCC_DIAG_ON(unused-variable) /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_distr_cont_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_cstd.conf0000644001357500135600000006646014420445767013357 00000000000000############################################################################# [main] [main - data:] # method (for information only: the program scans the file name) method: CSTD [main - header:] /* -- prototypes -- */ int estimate_uerror( UNUR_DISTR *distr, double u_resolution, int samplesize ); double cdf_exp(double x, const UNUR_DISTR *distr); double invcdf_exp(double u, const UNUR_DISTR *distr); /* -- constants -- */ /* sample size */ static const int UERROR_SAMPLESIZE = 100000; static const double UERROR_RESOLUTION = 1.e-14; \#define COMPARE_SAMPLE_SIZE (500) \#define VIOLATE_SAMPLE_SIZE (20) ############################################################################# [new] [new - invalid NULL ptr: distr = NULL; ] ~( distr ); --> expected_NULL --> UNUR_ERR_NULL [new - invalid distribution type: distr = unur_distr_discr_new(); ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID [new - not a standard distribution and missing inverse CDF: distr = unur_distr_cont_new(); ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED ############################################################################# [set] [set - invalid NULL ptr: par = NULL; ] ~_variant(par,1); --> expected_setfailed --> UNUR_ERR_NULL [set - invalid parameter object: double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_arou_new(distr); ] ~_variant(par,1); --> expected_setfailed --> UNUR_ERR_PAR_INVALID unur_par_free(par); [set - invalid parameters: distr = unur_distr_normal(NULL,0); par = unur_cstd_new(distr); ] ~_variant(par,9999); --> expected_setfailed --> UNUR_ERR_PAR_VARIANT unur_par_free(par); ############################################################################# # [get] ############################################################################# [chg] [chg - invalid generator object: double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_arou_new(distr); unur_set_debug(par,0); gen = unur_init( par ); <-- ! NULL ] ~_truncated(gen, 0., 1.); --> expected_setfailed --> UNUR_ERR_GEN_INVALID ############################################################################# [init] [init - invalid NULL ptr: par = NULL; ] unur_init( par ); --> expected_NULL --> UNUR_ERR_NULL ############################################################################# [reinit] [reinit - does not exist: distr = unur_distr_normal(NULL,0); par = unur_cstd_new(distr); gen = unur_init( par ); <-- ! NULL ] unur_reinit( gen ); --> expected_reinit ############################################################################# [sample] [sample - compare clone: UNUR_GEN *clone; double fpar[] = { 1., 2.}; distr = unur_distr_normal(fpar,2); par = NULL; gen = NULL; ] /* original generator object */ par = unur_cstd_new(distr); gen = unur_init(par); -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen #..................................................................... [sample - compare stringparser: double fpar[] = {3., 4.}; distr = NULL; par = NULL; gen = NULL; ] distr = unur_distr_gamma(fpar,2); par = unur_cstd_new(distr); unur_cstd_set_variant(par,2); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "gamma(3.,4.) & method = cstd; variant = 2" ); -->compare_sequence_gen ############################################################################# [validate] [validate - generators:] # inversion par[0] = unur_cstd_new(@distr@); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } par[1] = unur_cstd_new(@distr@); if (unur_cstd_set_variant(par,1)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } par[2] = unur_cstd_new(@distr@); if (unur_cstd_set_variant(par,2)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } par[3] = unur_cstd_new(@distr@); if (unur_cstd_set_variant(par,3)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } par[4] = unur_cstd_new(@distr@); if (unur_cstd_set_variant(par,4)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } par[5] = unur_cstd_new(@distr@); if (unur_cstd_set_variant(par,5)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } par[6] = unur_cstd_new(@distr@); if (unur_cstd_set_variant(par,6)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } par[7] = unur_cstd_new(@distr@); if (unur_cstd_set_variant(par,7)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } par[8] = unur_cstd_new(@distr@); if (unur_cstd_set_variant(par,8)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } par[9] = unur_cstd_new(@distr@); if (unur_cstd_set_variant(par,9)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } # change domain par[10] = unur_cstd_new(@distr@); if (unur_cstd_set_variant(par,UNUR_STDGEN_INVERSION)!=UNUR_SUCCESS) { if (par) unur_par_free(par); par = NULL; } unur_cstd_chg_truncated(gen,0.5,0.55); ## change parameters (use default variant) { UNUR_DISTR *dg =NULL; par[11] = unur_cstd_new(@distr@); fpm[0] = 2.; fpm[1] = 5.; dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_reinit(gen); } [validate - distributions:] # Beta distributions fpm[0] = 1.; fpm[1] = 2.; distr[0] = unur_distr_beta(fpm,2); fpm[0] = 1.; fpm[1] = 5.; distr[1] = unur_distr_beta(fpm,2); fpm[0] = 5.; fpm[1] = 1.; distr[80] = unur_distr_beta(fpm,2); fpm[0] = 1.; fpm[1] = 1.; distr[81] = unur_distr_beta(fpm,2); fpm[0] = 7.; fpm[1] = 0.5; distr[60] = unur_distr_beta(fpm,2); fpm[0] = 0.7; fpm[1] = 0.5; distr[61] = unur_distr_beta(fpm,2); fpm[0] = 7.; fpm[1] = 0.1; fpm[2] = -1.; fpm[3] = 2.; distr[62] = unur_distr_beta(fpm,4); fpm[0] = 1.; fpm[1] = 100.; distr[2] = unur_distr_beta(fpm,2); fpm[0] = 3.; fpm[1] = 4.; distr[3] = unur_distr_beta(fpm,2); fpm[0] = 5.; fpm[1] = 100.; distr[4] = unur_distr_beta(fpm,2); fpm[0] = 500.; fpm[1] = 300.; distr[5] = unur_distr_beta(fpm,2); fpm[0] = 5.; fpm[1] = 10.; fpm[2] = -3.; fpm[3] = 15.; distr[6] = unur_distr_beta(fpm,4); # Burr distributions fpm[0] = 1; distr[66] = unur_distr_burr(fpm,1); fpm[0] = 2; fpm[1] = 2; distr[67] = unur_distr_burr(fpm,2); fpm[0] = 3; fpm[1] = 2; fpm[2] = 2; distr[68] = unur_distr_burr(fpm,3); fpm[0] = 4; fpm[1] = 2; fpm[2] = 2; distr[69] = unur_distr_burr(fpm,3); fpm[0] = 5; fpm[1] = 2; fpm[2] = 2; distr[70] = unur_distr_burr(fpm,3); fpm[0] = 6; fpm[1] = 2; fpm[2] = 2; distr[71] = unur_distr_burr(fpm,3); fpm[0] = 7; fpm[1] = 2; distr[72] = unur_distr_burr(fpm,2); fpm[0] = 8; fpm[1] = 2; distr[73] = unur_distr_burr(fpm,2); fpm[0] = 9; fpm[1] = 2; fpm[2] = 2; distr[74] = unur_distr_burr(fpm,3); fpm[0] = 10; fpm[1] = 2; distr[75] = unur_distr_burr(fpm,2); fpm[0] = 11; fpm[1] = 2; distr[76] = unur_distr_burr(fpm,2); fpm[0] = 12; fpm[1] = 2; fpm[2] = 2; distr[77] = unur_distr_burr(fpm,3); # Cauchy distributions distr[7] = unur_distr_cauchy(NULL,0); fpm[0] = 1.; fpm[1] = 20.; distr[8] = unur_distr_cauchy(fpm,2); # Chi distribution fpm[0] = 0.5; distr[23] = unur_distr_chi(fpm,1); fpm[0] = 1.; distr[24] = unur_distr_chi(fpm,1); fpm[0] = 2.; distr[25] = unur_distr_chi(fpm,1); fpm[0] = 50.; distr[26] = unur_distr_chi(fpm,1); # Exponential distribution distr[27] = unur_distr_exponential(NULL,0); fpm[0] = 0.5; distr[28] = unur_distr_exponential(fpm,1); fpm[0] = 5.; fpm[1] = -3.; distr[29] = unur_distr_exponential(fpm,2); # Extreme value type I distr[30] = unur_distr_extremeI(NULL,0); fpm[0] = -3.; distr[31] = unur_distr_extremeI(fpm,1); fpm[0] = -1.; fpm[1] = 5.; distr[32] = unur_distr_extremeI(fpm,2); # Extreme value type II fpm[0] = 3.; distr[33] = unur_distr_extremeII(fpm,1); fpm[0] = 0.5; fpm[1] = -3.; distr[34] = unur_distr_extremeII(fpm,2); fpm[0] = 0.8; fpm[1] = -1.; fpm[2] = 5.; distr[35] = unur_distr_extremeII(fpm,3); # Gamma distributions fpm[0] = 1.; distr[9] = unur_distr_gamma(fpm,1); fpm[0] = 2.; distr[10] = unur_distr_gamma(fpm,1); fpm[0] = 3.; distr[11] = unur_distr_gamma(fpm,1); fpm[0] = 10.; distr[12] = unur_distr_gamma(fpm,1); fpm[0] = 1000.; distr[13] = unur_distr_gamma(fpm,1); fpm[0] = 5.; fpm[1] = 1000.; distr[14] = unur_distr_gamma(fpm,2); fpm[0] = 5.; fpm[1] = 1.e-5; distr[15] = unur_distr_gamma(fpm,2); fpm[0] = 5.; fpm[1] = 10.; fpm[2] = 1000; distr[16] = unur_distr_gamma(fpm,3); fpm[0] = 0.5; distr[63] = unur_distr_gamma(fpm,1); fpm[0] = 0.2; distr[64] = unur_distr_gamma(fpm,1); # Generalized Inverse Gaussian fpm[0] = 0.5; fpm[1] = 7; fpm[2] = 1; distr[83] = unur_distr_gig(fpm,3); fpm[0] = 0.5; fpm[1] = 0.5; fpm[2] = 1; distr[86] = unur_distr_gig(fpm,3); # Laplace distribution distr[36] = unur_distr_laplace(NULL,0); fpm[0] = -3.; distr[37] = unur_distr_laplace(fpm,1); fpm[0] = -1.; fpm[1] = 5.; distr[38] = unur_distr_laplace(fpm,2); # Logistic distribution distr[39] = unur_distr_logistic(NULL,0); fpm[0] = -3.; distr[40] = unur_distr_logistic(fpm,1); fpm[0] = -1.; fpm[1] = 5.; distr[41] = unur_distr_logistic(fpm,2); # Lomax fpm[0] = 2.; fpm[1] = 3.; distr[56] = unur_distr_lomax(fpm,2); fpm[0] = 20.; fpm[1] = 0.4; distr[57] = unur_distr_lomax(fpm,2); fpm[0] = 0.2; fpm[1] = 40.; distr[58] = unur_distr_lomax(fpm,2); fpm[0] = 0.2; fpm[1] = 0.5; distr[59] = unur_distr_lomax(fpm,2); # Normal distributions distr[17] = unur_distr_normal(NULL,0); fpm[0] = 1.; fpm[1] = 1.e-5; distr[18] = unur_distr_normal(fpm,2); fpm[0] = 0.; fpm[1] = 1.e+5; distr[19] = unur_distr_normal(fpm,2); # Pareto fpm[0] = 2.; fpm[1] = 3.; distr[52] = unur_distr_pareto(fpm,2); fpm[0] = 20.; fpm[1] = 0.4; distr[53] = unur_distr_pareto(fpm,2); fpm[0] = 0.2; fpm[1] = 40.; distr[54] = unur_distr_pareto(fpm,2); fpm[0] = 0.2; fpm[1] = 0.5; distr[55] = unur_distr_pareto(fpm,2); # Power exponential distribution fpm[0] = 0.5; distr[42] = unur_distr_powerexponential(fpm,1); fpm[0] = 1.; distr[43] = unur_distr_powerexponential(fpm,1); fpm[0] = 2.; distr[44] = unur_distr_powerexponential(fpm,1); fpm[0] = 10.; distr[45] = unur_distr_powerexponential(fpm,1); # Rayleigh fpm[0] = 1.; distr[65] = unur_distr_rayleigh(fpm,1); # Slash distr[82] = unur_distr_slash(NULL,0); # Student t fpm[0] = 2; distr[84] = unur_distr_student(fpm,1); fpm[0] = 0.5; distr[85] = unur_distr_student(fpm,1); # Triangular fpm[0] = 0.7; distr[46] = unur_distr_triangular(fpm,1); fpm[0] = 0.; distr[47] = unur_distr_triangular(fpm,1); fpm[0] = 1.; distr[48] = unur_distr_triangular(fpm,1); # Uniform distributions distr[20] = unur_distr_uniform(NULL,0); fpm[0] = 1.; fpm[1] = 20.; distr[21] = unur_distr_uniform(fpm,2); # Weibull fpm[0] = 3.; distr[49] = unur_distr_weibull(fpm,1); fpm[0] = 0.5; fpm[1] = 3.; distr[50] = unur_distr_weibull(fpm,2); fpm[0] = 1.5; fpm[1] = 2.; fpm[2] = -5.; distr[51] = unur_distr_weibull(fpm,3); # truncated distributions distr[22] = unur_distr_cauchy(NULL,0); unur_distr_cont_set_domain(distr[22],0.1,1.); unur_distr_cont_upd_mode(distr[22]); unur_distr_cont_upd_pdfarea(distr[22]); # distributions from scratch distr[78] = unur_distr_cont_new(); unur_distr_set_name( distr[78], "CDF_only" ); unur_distr_cont_set_domain( distr[78], 0, UNUR_INFINITY ); unur_distr_cont_set_cdf( distr[78], cdf_exp ); distr[79] = unur_distr_cont_new(); unur_distr_set_name( distr[79], "CDF&invCDF" ); unur_distr_cont_set_domain( distr[79], 0, UNUR_INFINITY ); unur_distr_cont_set_cdf( distr[79], cdf_exp ); unur_distr_cont_set_invcdf( distr[79], invcdf_exp ); # number of distributions: 87 [validate - test chi2:] # + ... pass test # % ... initialize generator and draw small sample # (for memory debugging when the CDF is not available) # 0 ... fail to initialize generator (given variant does not exist) # - ... fail test # / ... either init fails or test passes # . ... do not run test # # ... comment # # generators: # [0] ... Inversion # [1] -- [9] ... Variants 1 to 9 # [10] ... inversion domain changed after initialization # [11] ... change parameters to {2., 5.} (use default variant) # # 1 1 #gen 0 1 2 3 4 5 6 7 8 9 0 1 # distribution #------------------------------------------------------------- <0> 0 + + . . . . . . . . . # beta (1, 2) <1> . + + . . . . . . . . . # beta (1, 5) <80> . + + . . . . . . . . . # beta (5, 1) <81> . + + . . . . . . . . . # beta (1, 1) x <2> . + . . . . . . . . . . # beta (1, 100) <3> . + + . . . . . . . . . # beta (3, 4) <60> . + + . . . . . . . . . # beta (7, 0.5) <61> . + + . . . . . . . . . # beta (0.7, 0.5) #<62> . + + . . . . . . . . . # beta (7, 0.1, -1, 2) x <4> . + . . . . . . . . . . # beta (5, 100) x <5> . + . . . . . . . . . . # beta (500, 300) x <6> . + . . . . . . . . . . # beta (5, 10, -3, 15) <66> + . . . . . . . . . . . # burr (1) <67> + . . . . . . . . . . . # burr (2,2) <68> + . . . . . . . . . . . # burr (3,2,2) <69> + . . . . . . . . . . . # burr (4,2,2) <70> + . . . . . . . . . . . # burr (5,2,2) <71> + . . . . . . . . . . . # burr (6,2,2) <72> + . . . . . . . . . . . # burr (7,2) <73> + . . . . . . . . . . . # burr (8,2) <74> + . . . . . . . . . . . # burr (9,2,2) <75> + . . . . . . . . . . . # burr (10,2) <76> 0 . . . . . . . . . . . # burr (11,2) <77> + . . . . . . . . . . . # burr (12,2,2) <7> + . . . . . . . . . + + # cauchy () <8> + . . . . . . . . . + + # cauchy (1, 20) <23> 0 - . . . . . . . . . . # chi (0.5) x<24> . + . . . . . . . . . + # chi (1) <25> 0 + . . . . . . . . . . # chi (2) x<26> . + . . . . . . . . . + # chi (50) <27> + . . . . . . . . . + + # exponential () x<28> + . . . . . . . . . + + # exponential (0.5) <29> + . . . . . . . . . + + # exponential (5, -3) <30> + . . . . . . . . . + + # extremeI () <31> + . . . . . . . . . + + # extremeI (-3) <32> + . . . . . . . . . + + # extremeI (-1, 5) <33> + . . . . . . . . . + + # extremeII (3) <34> + . . . . . . . . . + + # extremeII (0.5, -3) <35> + . . . . . . . . . + + # extremeII (0.8, -1, 5) <9> 0 + + . . . . . . . . + # gamma (1) x<10> . + + . . . . . . . . + # gamma (2) <11> . + + . . . . . . . . + # gamma (3) <12> . + + . . . . . . . . + # gamma (10) x<13> . + + . . . . . . . . + # gamma (1000) <14> . + + . . . . . . . . + # gamma (5, 1000, 0) x<15> . + + . . . . . . . . + # gamma (5, 1e-05, 0) x<16> . + + . . . . . . . . + # gamma (5, 10, 100000) <63> . + + . . . . . . . . + # gamma (0.5) x<64> . + + . . . . . . . . + # gamma (0.2) <83> . % . . . . . . . . . . # gig (0.5, 7, 1) <86> . % . . . . . . . . . . # gig (0.5, 0.5, 1) <36> + . . . . . . . . . + + # laplace () <37> + . . . . . . . . . + + # laplace (-3) <38> + . . . . . . . . . + + # laplace (-1, 5) <39> + . . . . . . . . . + + # logistic () <40> + . . . . . . . . . + + # logistic (-3) <41> + . . . . . . . . . + + # logistic (-1, 5) <56> + . . . . . . . . . + + # lomax (2, 3) <57> + . . . . . . . . . + + # lomax (20, 0.4) <58> + . . . . . . . . . + + # lomax (0.2, 40) <59> + . . . . . . . . . + + # lomax (0.2, 0.5) <17> + + + + + + + + . . / + # normal () x<18> + + + + + + + + . . . + # normal (1, 1e-05) <19> + + + + + + + + . . / + # normal (1, 1e+05) <52> + . . . . . . . . . . + # pareto (2, 3) <53> + . . . . . . . . . . + # pareto (20, 0.4) <54> + . . . . . . . . . . + # pareto (0.2, 40) <55> + . . . . . . . . . + + # pareto (0.2, 0.5) <42> 0 - . . . . . . . . . . # powerexponential (0.5) <43> . + . . . . . . . . . + # powerexponential (1) <44> 0 + . . . . . . . . . . # powerexponential (2) <45> . + . . . . . . . . . . # powerexponential (10) <65> 0 - . . . . . . . . . . # rayleigh (1.) <82> 0 % . . . . . . . . . . # slash () <84> 0 + + . . . . . . . . . # student (2) <85> 0 + 0 . . . . . . . . . # student (0.5) <46> + . . . . . . . . . + . # triangular (0.7) x<47> + . . . . . . . . . + . # triangular (0) x<48> + . . . . . . . . . + . # triangular (1) <49> + . . . . . . . . . + + # weibull (3) <50> + . . . . . . . . . + + # weibull (0.5, 3) <51> + . . . . . . . . . + + # weibull (1.5, 2, -5.) <20> + . . . . . . . . . + + # uniform (1.5, 2, -5) <21> + . . . . . . . . . . + # uniform (1, 20) <22> + . . . . . . . . . + + # cauchy () - truncated <78> 0 . . . . . . . . . . . # given CDF <79> + . . . . . . . . . . . # given CDF + invCDF ## F ## chisquare ## ghyp ## hyperbolic ## ig ## lognormal ############################################################################# [special] ## Remark: ## ## In this section we merely test the existence of inversion. ## A few implementations seem to be rather inaccurate with respect to ## their u-errors. ## [special - decl:] int samplesize = UERROR_SAMPLESIZE; double ures = UERROR_RESOLUTION; int errorsum = 0; double fpar[5]; UNUR_DISTR *distr; [special - start:] /* test for maximal u-error */ printf("\n[test maximal u-error for inversion method]\n"); fprintf(TESTLOG,"\n* Test maximal u-error for inversion method *\n"); ## ---------------------------------------------------- printf(" beta"); fpar[0] = 3.; fpar[1] = 4.; distr = unur_distr_beta(fpar,2); errorsum += estimate_uerror(distr,ures,samplesize); fpar[0] = 1.; fpar[1] = 2.; fpar[2] = 3.; fpar[3] = 4.; distr = unur_distr_beta(fpar,4); errorsum += estimate_uerror(distr,ures,samplesize); ## ---------------------------------------------------- printf(" burr"); fpar[0] = 1.; distr = unur_distr_burr(fpar,1); errorsum += estimate_uerror(distr,ures,samplesize); fpar[0] = 2.; fpar[1] = 2.; distr = unur_distr_burr(fpar,2); errorsum += estimate_uerror(distr,ures,samplesize); fpar[0] = 3.; fpar[1] = 2.; fpar[2] = 3.; distr = unur_distr_burr(fpar,3); errorsum += estimate_uerror(distr,ures,samplesize); fpar[0] = 4.; fpar[1] = 1.; fpar[2] = 2.; distr = unur_distr_burr(fpar,3); errorsum += estimate_uerror(distr,1e-10,samplesize); /* computation of CDF and /or inverse CDF is not seem very accurate */ fpar[0] = 5.; fpar[1] = 2.; fpar[2] = 3.; distr = unur_distr_burr(fpar,3); errorsum += estimate_uerror(distr,ures,samplesize); fpar[0] = 6.; fpar[1] = 2.; fpar[2] = 3.; distr = unur_distr_burr(fpar,3); errorsum += estimate_uerror(distr,ures,samplesize); fpar[0] = 7.; fpar[1] = 2.; fpar[2] = 3.; distr = unur_distr_burr(fpar,3); errorsum += estimate_uerror(distr,ures,samplesize); fpar[0] = 8.; fpar[1] = 2.; distr = unur_distr_burr(fpar,2); errorsum += estimate_uerror(distr,ures,samplesize); fpar[0] = 9.; fpar[1] = 2.; fpar[2] = 3.; distr = unur_distr_burr(fpar,3); errorsum += estimate_uerror(distr,ures,samplesize); fpar[0] = 10.; fpar[1] = 2.; distr = unur_distr_burr(fpar,2); errorsum += estimate_uerror(distr,ures,samplesize); fpar[0] = 11.; fpar[1] = 2.; distr = unur_distr_burr(fpar,2); errorsum += estimate_uerror(distr,ures,samplesize); fpar[0] = 12.; fpar[1] = 2.; fpar[2] = 3.; distr = unur_distr_burr(fpar,3); errorsum += estimate_uerror(distr,ures,samplesize); ## ---------------------------------------------------- printf(" cauchy"); fpar[0] = 1.; fpar[1] = 2.; distr = unur_distr_cauchy(fpar,2); errorsum += estimate_uerror(distr,ures,samplesize); ## ---------------------------------------------------- printf(" chi"); fpar[0] = 3.; distr = unur_distr_chi(fpar,1); errorsum += estimate_uerror(distr,ures,samplesize); ## ---------------------------------------------------- printf(" chisquare"); fpar[0] = 3.; distr = unur_distr_chisquare(fpar,1); errorsum += estimate_uerror(distr,ures,samplesize); ## ---------------------------------------------------- printf(" exponential"); fpar[0] = 1.; fpar[1] = 2.; distr = unur_distr_exponential(fpar,2); errorsum += estimate_uerror(distr,ures,samplesize); ## ---------------------------------------------------- printf(" extremeI"); fpar[0] = 1.; fpar[1] = 2.; distr = unur_distr_extremeI(fpar,2); errorsum += estimate_uerror(distr,ures,samplesize); ## ---------------------------------------------------- printf(" extremeII"); fpar[0] = 1.; fpar[1] = 2.; fpar[2] = 3.; distr = unur_distr_extremeII(fpar,3); errorsum += estimate_uerror(distr,ures,samplesize); ## ---------------------------------------------------- printf(" F"); fpar[0] = 3.; fpar[1] = 4.; distr = unur_distr_F(fpar,2); errorsum += estimate_uerror(distr,ures,samplesize); ## ---------------------------------------------------- printf(" gamma"); fpar[0] = 5.; distr = unur_distr_gamma(fpar,1); errorsum += estimate_uerror(distr,ures,samplesize); fpar[0] = 4.; fpar[1] = 3.; distr = unur_distr_gamma(fpar,2); errorsum += estimate_uerror(distr,ures,samplesize); fpar[0] = 3.; fpar[1] = 2.; fpar[2] = 1.; distr = unur_distr_gamma(fpar,3); errorsum += estimate_uerror(distr,ures,samplesize); ## ---------------------------------------------------- printf(" gig"); fpar[0] = 1.; fpar[1] = 2.; fpar[1] = 3.; distr = unur_distr_gig(fpar,3); errorsum += estimate_uerror(distr,ures,samplesize); ## ---------------------------------------------------- printf(" gig2"); fpar[0] = 1.; fpar[1] = 2.; fpar[2] = 3.; distr = unur_distr_gig2(fpar,3); errorsum += estimate_uerror(distr,ures,samplesize); ## ---------------------------------------------------- printf(" ghyp"); fpar[0] = 1.; fpar[1] = 3.; fpar[2] = 2.; fpar[3] = 4.; fpar[4] = 5.; distr = unur_distr_ghyp(fpar,5); errorsum += estimate_uerror(distr,ures,samplesize); ## ---------------------------------------------------- printf(" hyperbolic"); fpar[0] = 3.; fpar[1] = 2.; fpar[2] = 2.; fpar[3] = 2.; distr = unur_distr_hyperbolic(fpar,4); errorsum += estimate_uerror(distr,ures,samplesize); ## ---------------------------------------------------- printf(" ig"); fpar[0] = 1.; fpar[1] = 2.; distr = unur_distr_ig(fpar,2); errorsum += estimate_uerror(distr,ures,samplesize); ## ---------------------------------------------------- printf(" laplace"); fpar[0] = 1.; fpar[1] = 2.; distr = unur_distr_laplace(fpar,2); errorsum += estimate_uerror(distr,ures,samplesize); ## ---------------------------------------------------- printf(" logistic"); fpar[0] = 1.; fpar[1] = 2.; distr = unur_distr_logistic(fpar,2); errorsum += estimate_uerror(distr,ures,samplesize); ## ---------------------------------------------------- printf(" lognormal"); fpar[0] = 1.; fpar[1] = 2.; fpar[2] = 3.; distr = unur_distr_lognormal(fpar,3); errorsum += estimate_uerror(distr,ures,samplesize); ## ---------------------------------------------------- printf(" lomax"); fpar[0] = 1.; fpar[1] = 2.; distr = unur_distr_lomax(fpar,2); errorsum += estimate_uerror(distr,ures,samplesize); ## ---------------------------------------------------- printf(" normal"); fpar[0] = 1.; fpar[1] = 2.; distr = unur_distr_normal(fpar,2); errorsum += estimate_uerror(distr,ures,samplesize); ## ---------------------------------------------------- printf(" pareto"); fpar[0] = 1.; fpar[1] = 2.; distr = unur_distr_pareto(fpar,2); errorsum += estimate_uerror(distr,ures,samplesize); ## ---------------------------------------------------- printf(" powerexponential"); fpar[0] = 3.; distr = unur_distr_powerexponential(fpar,1); errorsum += estimate_uerror(distr,ures,samplesize); ## ---------------------------------------------------- printf(" rayleigh"); fpar[0] = 2.; distr = unur_distr_rayleigh(fpar,1); errorsum += estimate_uerror(distr,ures,samplesize); ## ---------------------------------------------------- printf(" slash"); distr = unur_distr_slash(NULL,0); errorsum += estimate_uerror(distr,ures,samplesize); ## ---------------------------------------------------- printf(" student"); fpar[0] = 4.4; distr = unur_distr_student(fpar,1); errorsum += estimate_uerror(distr,ures,samplesize); ## ---------------------------------------------------- printf(" triangular"); fpar[0] = 0.7; distr = unur_distr_triangular(fpar,1); errorsum += estimate_uerror(distr,ures,samplesize); ## ---------------------------------------------------- printf(" uniform"); fpar[0] = 1.; fpar[1] = 2.; distr = unur_distr_uniform(fpar,2); errorsum += estimate_uerror(distr,ures,samplesize); ## ---------------------------------------------------- printf(" weibull"); fpar[0] = 1.; fpar[1] = 2.; distr = unur_distr_weibull(fpar,2); errorsum += estimate_uerror(distr,ures,samplesize); ## ---------------------------------------------------- /*---------------------------------------------------------------------------*/ /* test finished */ FAILED = (errorsum < 2) ? 0 : 1; ############################################################################# [verbatim] ############################################################################# # # routines for special tests # ############################################################################# int estimate_uerror( UNUR_DISTR *distr, /* distribution object */ double u_resolution, /* maximal tolerated u-error */ int samplesize ) /* sample size for error experiment */ /* returns 0 if maxerror < u_resolution, errorcode otherwise */ { UNUR_PAR *par; UNUR_GEN *gen; int i, nfpar; const double *fpar; double score; /* print data about distribution */ fprintf(TESTLOG,"> %s (",unur_distr_get_name(distr)); nfpar = unur_distr_cont_get_pdfparams(distr,&fpar); for(i=0;i inversion method not implemented !!\n\n"); printf("0"); fflush(stdout); if (par) unur_par_free(par); unur_distr_free(distr); return 0; } /* initialize generator object */ gen = unur_init(par); /* run test */ score = run_validate_u_error( TESTLOG, gen, distr, u_resolution, samplesize ); /* clear working space */ unur_distr_free(distr); unur_free(gen); /* return */ fprintf(TESTLOG,"\n"); return score; } /* end of estimate_uerror() */ ############################################################################# # # PDFs and CDF for test distributions # ############################################################################# double cdf_exp(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return ((x<0.) ? 0. : 1.-exp(-x)); } double invcdf_exp(double u, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return (-log(1.- u)); } ############################################################################# unuran-1.11.0/tests/t_hrd.c0000644001357500135600000005121214430713513012445 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for HRD **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ double HR_decreasing(double x, const UNUR_DISTR *distr); double CDF_decreasing(double x, const UNUR_DISTR *distr); double HR_constant(double x, const UNUR_DISTR *distr); double CDF_constant(double x, const UNUR_DISTR *distr); double HR_increasing(double x, const UNUR_DISTR *distr); double CDF_increasing(double x, const UNUR_DISTR *distr); int unur_hrd_set_pedantic( UNUR_PAR *par, int pedantic ); #define COMPARE_SAMPLE_SIZE (10000) #define VIOLATE_SAMPLE_SIZE (20) /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ double HR_decreasing(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* example with decreasing hazard rate */ { return (1./(1.+x)); } double CDF_decreasing(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* CDF for example with decreasing hazard rate */ { return (x/(1. + x)); } double HR_constant(double x ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* example with constant hazard rate: standard expontential */ { return 1.; } double CDF_constant(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* CDF for example with constant hazard rate: standard expontential */ { return (1.-exp(-x)); } double HR_increasing(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* example with increasing hazard rate: Weibull (alpha=3,beta=1) */ { return (3*x*x); } double CDF_increasing(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) /* CDF for example with increasing hazard rate: Weibull (alpha=3,beta=1) */ { return (1.-exp(-x*x*x)); } /* dummy function */ int unur_hrd_set_pedantic( UNUR_PAR *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) { return 1; } /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,34,(unur_hrd_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,34,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,40,(unur_hrd_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,40,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* data missing in distribution object */ UNUR_DISTR *distr = NULL; distr = unur_distr_cont_new(); unur_reset_errno(); /* hazard rate */ n_tests_failed += (check_expected_NULL(TESTLOG,47,(unur_hrd_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,47,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [set] */ void test_set (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[set "); fflush(stdout); fprintf(TESTLOG,"\n[set]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,57,(unur_hrd_set_verify(par,1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,57,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* invalid parameter object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,65,(unur_hrd_set_verify(par,1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,65,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_set() */ /*---------------------------------------------------------------------------*/ /* [chg] */ void test_chg (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[chg "); fflush(stdout); fprintf(TESTLOG,"\n[chg]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid generator object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); unur_set_debug(par,0); gen = unur_init( par ); abort_if_NULL(TESTLOG, 81, gen ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,85,(unur_hrd_chg_verify(gen,1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,85,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_chg() */ /*---------------------------------------------------------------------------*/ /* [init] */ void test_init (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[init "); fflush(stdout); fprintf(TESTLOG,"\n[init]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* left border no valid upper bound */ UNUR_GEN *gen = NULL; UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; gen = NULL; distr = unur_distr_cont_new(); unur_distr_cont_set_hr(distr,HR_increasing); par = unur_hrd_new(distr); abort_if_NULL(TESTLOG, 95, par ); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,99,(gen = unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,99,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; unur_free(gen); unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_init() */ /*---------------------------------------------------------------------------*/ /* [reinit] */ void test_reinit (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[reinit "); fflush(stdout); fprintf(TESTLOG,"\n[reinit]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* does not exist */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_cont_new(); unur_distr_cont_set_hr(distr,HR_decreasing); par = unur_hrd_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 109, gen ); unur_reset_errno(); n_tests_failed += (check_expected_reinit(TESTLOG,113,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_reinit() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* compare */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = unur_distr_cont_new(); unur_distr_cont_set_hr(distr,HR_decreasing); par = NULL; unur_reset_errno(); /* default algorithm */ par = unur_hrd_new(distr); n_tests_failed += (compare_sequence_par_start(TESTLOG,126,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* default algorithm - verifying mode */ par = unur_hrd_new(distr); unur_hrd_set_verify(par,1); n_tests_failed += (compare_sequence_par(TESTLOG,131,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* default algorithm - ignore invalid boundary */ unur_distr_cont_set_domain(distr,-10.,10.); par = unur_hrd_new(distr); n_tests_failed += (compare_sequence_par_start(TESTLOG,136,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* compare reinit */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_cont_new(); unur_distr_cont_set_hr(distr,HR_decreasing); par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_hrd_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,149,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* reinit */ unur_reinit(gen); n_tests_failed += (compare_sequence_gen(TESTLOG,153,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare stringparser */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = NULL; par = NULL; gen = NULL; unur_reset_errno(); distr = unur_distr_cont_new(); unur_distr_cont_set_hrstr(distr,"1/(1+x)"); par = unur_hrd_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,166,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "cont; hr = \"1/(1+x)\"; domain = (0,inf)& \ method = hrd" ); n_tests_failed += (compare_sequence_gen(TESTLOG,172,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; distr = unur_distr_cont_new(); unur_distr_cont_set_hrstr(distr,"1/(1+x)"); par = unur_hrd_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,179,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "cont; hr = \"1/(1+x)\"; domain = (0,inf)& \ method = hrd" ); n_tests_failed += (compare_sequence_gen(TESTLOG,185,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* [validate] */ /*---------------------------------------------------------------------------*/ /* [validate] */ void test_validate (void) { /* suppress GCC compiler warning */ GCC_DIAG_OFF(unused-variable) UNUR_DISTR *distr[3]; UNUR_PAR *par; UNUR_GEN *gen; double *darray; double fpm[10]; int n_tests_failed; int rcode; /* start test */ printf("[validate "); fflush(stdout); fprintf(TESTLOG,"\n[validate]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* distributions: 3 */ { distr[0] = unur_distr_cont_new(); unur_distr_set_name(distr[0],"decreasing HR"); unur_distr_cont_set_hr(distr[0],HR_decreasing); unur_distr_cont_set_cdf(distr[0],CDF_decreasing); } { distr[1] = unur_distr_cont_new(); unur_distr_set_name(distr[1],"constant HR"); unur_distr_cont_set_hr(distr[1],HR_constant); unur_distr_cont_set_cdf(distr[1],CDF_constant); } { distr[2] = unur_distr_cont_new(); unur_distr_set_name(distr[2],"increasing HR"); unur_distr_cont_set_hr(distr[2],HR_increasing); unur_distr_cont_set_cdf(distr[2],CDF_increasing); } /* timing */ stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); printf("\n(chi^2) "); fflush(stdout); /* chi^2 tests: 3 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nChi^2 Test:\n"); /* distribution [0] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_hrd_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_hrd_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [2] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_hrd_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); printf("\n(verify hat) "); fflush(stdout); /* verify hat tests: 3 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nVerify Hat Test (squeeze <= PDF <= hat):\n"); /* distribution [0] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_hrd_new(distr_localcopy); unur_hrd_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_hrd_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_hrd_new(distr_localcopy); unur_hrd_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_hrd_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [2] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_hrd_new(distr_localcopy); unur_hrd_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_hrd_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'-')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); /* free distributions */ unur_distr_free(distr[0]); unur_distr_free(distr[1]); unur_distr_free(distr[2]); /* test finished */ test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; /* we accept CHI2_FAILURES_TOLERATED failures */ (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_validate */ /* enable GCC compiler warning */ GCC_DIAG_ON(unused-variable) /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_hrd_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_tdr_ia.conf0000644001357500135600000002447714420445767013666 00000000000000############################################################################# [main] [main - data:] # method method: TDR [main - header:] /* prototypes */ double pdf_sqrtlin( double x, const UNUR_DISTR *distr ); double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ); double cdf_sqrtlin( double x, const UNUR_DISTR *distr ); double pdf_sqrtlinshft(double x, const UNUR_DISTR *distr ); double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); \#define COMPARE_SAMPLE_SIZE (10000) \#define VIOLATE_SAMPLE_SIZE (20) ############################################################################# [new] ############################################################################# # [set] ############################################################################# # [get] ############################################################################# # [chg] ############################################################################# # [init] ############################################################################# # [reinit] ############################################################################# [validate] [validate - generators:] # sqrt, IA par[0] = unur_tdr_new(@distr@); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); # sqrt, IA, few starting points, ARS par[1] = unur_tdr_new(@distr@); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); # sqrt, IA, few construction points par[2] = unur_tdr_new(@distr@); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_usedars(par,FALSE); unur_tdr_set_cpoints(par,10,NULL); unur_tdr_set_max_sqhratio(par,0.25); # log, IA par[3] = unur_tdr_new(@distr@); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); # reinit, sqrt, IA par[4] = unur_tdr_new(@distr@); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,-0.5); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(@distr@,fpm,2); unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); # reinit, log, IA par[5] = unur_tdr_new(@distr@); unur_tdr_set_variant_ia(par); unur_tdr_set_c(par,0.); unur_tdr_set_cpoints(par,30,NULL); unur_set_use_distr_privatecopy(par,FALSE); fpm[0] = 1.; fpm[1] = 4.; unur_distr_cont_set_pdfparams(@distr@,fpm,2); unur_tdr_chg_reinit_percentiles(gen, 2, NULL ); unur_reinit(gen); [validate - distributions:] # Beta distributions fpm[0] = 1.; fpm[1] = 2.; distr[0] = unur_distr_beta(fpm,2); fpm[0] = 1.; fpm[1] = 5.; distr[1] = unur_distr_beta(fpm,2); fpm[0] = 1.; fpm[1] = 100.; distr[2] = unur_distr_beta(fpm,2); fpm[0] = 2.; fpm[1] = 5.; distr[30] = unur_distr_beta(fpm,2); fpm[0] = 5.; fpm[1] = 2.; distr[31] = unur_distr_beta(fpm,2); fpm[0] = 3.; fpm[1] = 4.; distr[3] = unur_distr_beta(fpm,2); fpm[0] = 5.; fpm[1] = 100.; distr[4] = unur_distr_beta(fpm,2); fpm[0] = 500.; fpm[1] = 300.; distr[5] = unur_distr_beta(fpm,2); fpm[0] = 5.; fpm[1] = 10.; fpm[2] = -3.; fpm[3] = 15.; distr[6] = unur_distr_beta(fpm,4); # Cauchy distributions distr[7] = unur_distr_cauchy(NULL,0); fpm[0] = 1.; fpm[1] = 20.; distr[8] = unur_distr_cauchy(fpm,2); # Exponential distributions distr[24] = unur_distr_exponential(NULL,0); fpm[0] = 30.; fpm[1] = -5.; distr[25] = unur_distr_exponential(fpm,2); # Gamma distributions fpm[0] = 1.; distr[9] = unur_distr_gamma(fpm,1); fpm[0] = 2.; distr[10] = unur_distr_gamma(fpm,1); fpm[0] = 3.; distr[11] = unur_distr_gamma(fpm,1); fpm[0] = 10.; distr[12] = unur_distr_gamma(fpm,1); fpm[0] = 1000.; distr[13] = unur_distr_gamma(fpm,1); fpm[0] = 5.; fpm[1] = 1000.; distr[14] = unur_distr_gamma(fpm,2); fpm[0] = 5.; fpm[1] = 1.e-5; distr[15] = unur_distr_gamma(fpm,2); fpm[0] = 5.; fpm[1] = 10.; fpm[2] = 1000.; distr[16] = unur_distr_gamma(fpm,3); # Laplace distributions distr[26] = unur_distr_laplace(NULL,0); fpm[0] = -10.; fpm[1] = 100.; distr[27] = unur_distr_laplace(fpm,2); # Normal distributions distr[17] = unur_distr_normal(NULL,0); fpm[0] = 1.; fpm[1] = 1.e-5; distr[18] = unur_distr_normal(fpm,2); fpm[0] = 0.; fpm[1] = 1.e+5; distr[19] = unur_distr_normal(fpm,2); # Uniform distributions distr[20] = unur_distr_uniform(NULL,0); fpm[0] = 1.; fpm[1] = 20.; distr[21] = unur_distr_uniform(fpm,2); # pdf with piecewise linear function as transformed density with T = -1/sqrt distr[28] = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr[28],pdf_sqrtlin); unur_distr_cont_set_dpdf(distr[28],dpdf_sqrtlin); unur_distr_cont_set_cdf(distr[28],cdf_sqrtlin); unur_distr_set_name(distr[28],"sqrtlin"); # pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode distr[29] = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr[29],pdf_sqrtlinshft); unur_distr_cont_set_dpdf(distr[29],dpdf_sqrtlinshft); unur_distr_cont_set_cdf(distr[29],cdf_sqrtlinshft); unur_distr_set_name(distr[29],"sqrtlin"); # truncated distributions distr[22] = unur_distr_cauchy(NULL,0); unur_distr_cont_set_domain(distr[22],0.1,1.); unur_distr_cont_upd_mode(distr[22]); unur_distr_cont_upd_pdfarea(distr[22]); # domain exceeds support of pdf fpm[0] = 3.; fpm[1] = 4.; distr[23] = unur_distr_beta(fpm,2); unur_distr_cont_set_domain(distr[23],-2.,5.); # number of distributions: 32 [validate - test chi2:] # + ... pass test # 0 ... fail to initialize generator # - ... fail test # . ... do not run test # # ... comment # # generators: # [0] sqrt, IA # [1] sqrt, IA, few starting points, ARS # [2] sqrt, IA, few construction points # [3] log, IA # [4] reinit, log, IA # [5] reinit, sqrt, IA # # # 0 1 2 3 4 5 # distribution #--------------------------------------------- x <0> + + + + + + # beta (1, 2) <1> + + + + . . # beta (1, 5) x <2> + + + + + + # beta (1, 100) <30> + + + + . . # beta (2, 5) <31> + + + + + + # beta (5, 2) <3> + + + + . . # beta (3, 4) <4> + + + + . . # beta (5, 100) <5> + + + + + + # beta (500, 300) <6> + + + + + + # beta (5, 10, -3, 15) <7> + + + 0 + 0 # cauchy () <8> + + + 0 + 0 # cauchy (1, 20) <24> + + + + + + # exponential () <25> + + + + + + # exponential (30, -5) x <9> + + + + . . # gamma (1) <10> + + + + + + # gamma (2) <11> + + + + . . # gamma (3) <12> + + + + . . # gamma (10) x<13> + + + + . . # gamma (1000) <14> + + + + . . # gamma (5, 1000, 0) x<15> + + + + . . # gamma (5, 1e-05, 0) x<16> + + + + . . # gamma (5, 10, 1000) <26> + + + + + + # laplace () <27> + + + + + + # laplace (-10, 100) <17> + + + + + + # normal () x<18> + + + + + + # normal (1, 1e-05) <19> + + + + + + # normal (1, 1e+05) <20> + + + + + + # uniform () <21> + + + + . . # uniform (1, 20) <22> + + + + . . # cauchy () - truncated <23> + + + + . . # beta () - domain superset of support <28> + + + 0 . . # sqrtlin <29> + + + 0 . . # sqrtlin with shifted mode # sqrtlin ... pdf with piecewise linear function as # transformed density with T = -1/sqrt [validate - verify hat:] # + ... pass test # ~ ... fail in at most 1% of samples # 0 ... fail to initialize generator # - ... fail test # . ... do not run test # # ... comment # # generators: # [0] sqrt, IA # [1] sqrt, IA, few starting points, ARS # [2] sqrt, IA, few construction points # [3] log, IA # [4] reinit, log, IA # [5] reinit, sqrt, IA # # # 0 1 2 3 4 5 # distribution #--------------------------------------------- x <0> + + + + + + # beta (1, 2) <1> + + + + . . # beta (1, 5) x <2> + + + + + + # beta (1, 100) <30> + + + + . . # beta (2, 5) <31> + + + + + + # beta (5, 2) <3> + + + + . . # beta (3, 4) <4> + + + + . . # beta (5, 100) <5> + + + + + + # beta (500,300) <6> + + + + + + # beta (5, 10, -3, 15) <7> + + + 0 + 0 # cauchy () <8> + + + 0 + 0 # cauchy (1, 20) <24> + + + + + + # exponential () <25> + + + + + + # exponential (30, -5) x <9> + + + + . . # gamma (1) <10> + + + + . . # gamma (2) <11> + + + + + + # gamma (3) <12> + + + + . . # gamma (10) x<13> + + + + . . # gamma (1000) <14> + + + + . . # gamma (5, 1000, 0) x<15> + + + + . . # gamma (5, 1e-05, 0) x<16> + + + + . . # gamma (5, 10, 100000) <26> + + + + + + # laplace () <27> + + + + + + # laplace (-10, 100) <17> + + + + + + # normal () x<18> + + + + . . # normal (1, 1e-05) <19> + + + + . . # normal (1, 1e+05) <20> + + + + + + # uniform () <21> + + + + . . # uniform (1, 20) <22> + + + + . . # cauchy () - truncated <23> + + + + . . # beta () - domain superset of support <28> + + + . . . # sqrtlin <29> . . . . . . # sqrtlin with shifted mode # sqrtlin ... pdf with piecewise linear function as # transformed density with T = -1/sqrt ############################################################################# ############################################################################# [verbatim] /* pdf with piecewise linear function as transformed density with T = -1/sqrt */ double pdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y = 1./(fabs(x)+1.); return y*y; } double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y = 1./(fabs(x)+1.); y = 2.*y*y*y; return ((x<0.) ? y : - y); } double cdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { if (x<=0.) return 0.5/(1.-x); else return (1.-0.5/(1.+x)); } /* pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode */ double pdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y; x -= 1000.; y = 1./(fabs(x)+1.); return y*y; } double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y; x -= 1000.; y = 1./(fabs(x)+1.); y = 2.*y*y*y; return ((x<0.) ? y : - y); } double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { x -= 1000.; if (x<=0.) return 0.5/(1.-x); else return (1.-0.5/(1.+x)); } ############################################################################# unuran-1.11.0/tests/t_dext.c0000644001357500135600000005125614430713513012644 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for DEXT **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); int unur_dext_set_verify( UNUR_PAR *par, int verify); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ int check_init(UNUR_GEN *gen); int check_sample(UNUR_GEN *gen); int geom12_sample(UNUR_GEN *gen); int geoma_sample(UNUR_GEN *gen); int geomb_init(UNUR_GEN *gen); int geomb_sample(UNUR_GEN *gen); #define COMPARE_SAMPLE_SIZE (500) #define VIOLATE_SAMPLE_SIZE (20) /* #define SEED (298346) */ /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ int check_init(UNUR_GEN *gen ATTRIBUTE__UNUSED) { return UNUR_SUCCESS; } int check_sample(UNUR_GEN *gen ATTRIBUTE__UNUSED) { return 0; } /* ............. */ int geom12_sample(UNUR_GEN *gen) { double U = unur_sample_urng(gen); return ((int) ceil(log(1.-U) / log(0.5) - 1.)); } /* ............. */ int geoma_sample(UNUR_GEN *gen) { # define p (params[0]) /* scale */ double U = unur_sample_urng(gen); double *params = unur_dext_get_distrparams(gen); return ((int) ceil(log(1.-U) / log(1.-p) - 1.)); # undef p } /* ............. */ int geomb_init(UNUR_GEN *gen) { # define p (params[0]) /* scale */ double *params = unur_dext_get_distrparams(gen); double *genpar = unur_dext_get_params(gen, sizeof(double)); genpar[0] = p; return UNUR_SUCCESS; # undef p } int geomb_sample(UNUR_GEN *gen) { # define p (params[0]) /* scale */ double *params = unur_dext_get_params(gen,(size_t)0); double U = unur_sample_urng(gen); return ((int) ceil(log(1.-U) / log(1.-p) - 1.)); # undef p } /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid distribution type */ UNUR_DISTR *distr = NULL; distr = unur_distr_cont_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,38,(unur_dext_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,38,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [set] */ void test_set (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[set "); fflush(stdout); fprintf(TESTLOG,"\n[set]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,49,(unur_dext_set_init(par,NULL)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,49,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,52,(unur_dext_set_sample(par,NULL)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,52,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* invalid parameter object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,60,(unur_dext_set_init(par,NULL)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,60,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,63,(unur_dext_set_sample(par,NULL)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,63,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,66,(unur_dext_set_sample(par,check_sample)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,66,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_set() */ /*---------------------------------------------------------------------------*/ /* [get] */ void test_get (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[get "); fflush(stdout); fprintf(TESTLOG,"\n[get]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_GEN *gen = NULL; gen = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,79,(unur_dext_get_params(gen,(size_t)0)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,79,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_get() */ /*---------------------------------------------------------------------------*/ /* [init] */ void test_init (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[init "); fflush(stdout); fprintf(TESTLOG,"\n[init]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,93,(unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,93,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_init() */ /*---------------------------------------------------------------------------*/ /* [reinit] */ void test_reinit (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[reinit "); fflush(stdout); fprintf(TESTLOG,"\n[reinit]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_reinit() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* compare clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; UNUR_GEN *clone; double fpar[1] = {0.5}; distr = unur_distr_geometric(fpar,1); par = NULL; gen = NULL; unur_reset_errno(); /* external generator 1 */ par = unur_dext_new(distr); unur_dext_set_sample(par,geom12_sample); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,125,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,131,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* dstd */ unur_free(gen); par = unur_dstd_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen(TESTLOG,137,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* external generator A */ unur_free(gen); par = unur_dext_new(distr); unur_dext_set_sample(par,geoma_sample); gen = unur_init(par); n_tests_failed += (compare_sequence_gen(TESTLOG,145,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,151,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* external generator B */ unur_free(gen); par = unur_dext_new(distr); unur_dext_set_init(par,geomb_init); unur_dext_set_sample(par,geomb_sample); gen = unur_init(par); n_tests_failed += (compare_sequence_gen(TESTLOG,159,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,165,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; UNUR_GEN *clone; double fpar[1] = {0.1}; distr = unur_distr_geometric(fpar,1); par = NULL; gen = NULL; unur_reset_errno(); /* external generator A */ unur_free(gen); par = unur_dext_new(distr); unur_dext_set_sample(par,geoma_sample); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,181,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,187,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* external generator B */ unur_free(gen); par = unur_dext_new(distr); unur_dext_set_init(par,geomb_init); unur_dext_set_sample(par,geomb_sample); gen = unur_init(par); n_tests_failed += (compare_sequence_gen(TESTLOG,195,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,201,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* dstd */ unur_free(gen); par = unur_dstd_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen(TESTLOG,207,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* [validate] */ /*---------------------------------------------------------------------------*/ /* [validate] */ void test_validate (void) { /* suppress GCC compiler warning */ GCC_DIAG_OFF(unused-variable) UNUR_DISTR *distr[2]; UNUR_PAR *par; UNUR_GEN *gen; double *darray; double fpm[10]; int n_tests_failed; int rcode; /* start test */ printf("[validate "); fflush(stdout); fprintf(TESTLOG,"\n[validate]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* distributions: 2 */ { fpm[0] = 0.5; distr[0] = unur_distr_geometric(fpm,1); } { fpm[0] = 0.1; distr[1] = unur_distr_geometric(fpm,1); } /* timing */ stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); printf("\n(chi^2) "); fflush(stdout); /* chi^2 tests: 8 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nChi^2 Test:\n"); /* distribution [0] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_dext_new(distr_localcopy); unur_dext_set_sample(par,geom12_sample); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_dext_new(distr_localcopy); unur_dext_set_sample(par,geoma_sample); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_dext_new(distr_localcopy); unur_dext_set_init(par,geomb_init); unur_dext_set_sample(par,geomb_sample); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { UNUR_DISTR *dg =NULL; par = unur_dext_new(distr_localcopy); unur_dext_set_init(par,geomb_init); unur_dext_set_sample(par,geomb_sample); fpm[0] = 0.2; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,1); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_dext_new(distr_localcopy); unur_dext_set_sample(par,geom12_sample); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_dext_new(distr_localcopy); unur_dext_set_sample(par,geoma_sample); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_dext_new(distr_localcopy); unur_dext_set_init(par,geomb_init); unur_dext_set_sample(par,geomb_sample); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { UNUR_DISTR *dg =NULL; par = unur_dext_new(distr_localcopy); unur_dext_set_init(par,geomb_init); unur_dext_set_sample(par,geomb_sample); fpm[0] = 0.2; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,1); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); /* free distributions */ unur_distr_free(distr[0]); unur_distr_free(distr[1]); /* test finished */ test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; /* we accept CHI2_FAILURES_TOLERATED failures */ (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_validate */ /* enable GCC compiler warning */ GCC_DIAG_ON(unused-variable) /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_dext_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_distr_cxtrans.conf0000644001357500135600000002376214420445767015307 00000000000000############################################################################# [main] [main - data:] # method (for information only: the program scans the file name) method: DISTR_CXTRANS [main - header:] /* prototypes */ \#define COMPARE_SAMPLE_SIZE (500) \#define VIOLATE_SAMPLE_SIZE (20) ############################################################################# [new] [new - invalid NULL ptr: distr = NULL; ] unur_distr_cxtrans_new( distr ); --> expected_NULL --> UNUR_ERR_NULL [new - invalid distribution type: distr = unur_distr_discr_new(); ] unur_distr_cxtrans_new( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID ############################################################################# [set] [set - invalid NULL ptr: distr = NULL; ] unur_distr_cxtrans_set_alpha( distr, 5. ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_cxtrans_set_rescale( distr, 1., 1. ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_cxtrans_set_domain( distr, 0., 1. ) --> expected_setfailed --> UNUR_ERR_NULL unur_distr_cxtrans_set_mode( distr, 0. ) --> expected_setfailed --> UNUR_ERR_NULL unur_distr_cxtrans_set_logpdfpole( distr, 0., 0. ) --> expected_setfailed --> UNUR_ERR_NULL [set - invalid distribution object: distr = unur_distr_discr_new(); ] unur_distr_cxtrans_set_alpha( distr, 5. ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_cxtrans_set_rescale( distr, 1., 1. ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_cxtrans_set_domain( distr, 0., 1. ) --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_cxtrans_set_logpdfpole( distr, 0., 0. ) --> expected_setfailed --> UNUR_ERR_DISTR_INVALID [set - invalid distribution object: distr = unur_distr_normal(NULL,0); ] unur_distr_cxtrans_set_alpha( distr, 5. ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_cxtrans_set_rescale( distr, 1., 1. ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_cxtrans_set_domain( distr, 0., 1. ) --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_cxtrans_set_logpdfpole( distr, 0., 0. ) --> expected_setfailed --> UNUR_ERR_DISTR_INVALID [set - invalid parameters: UNUR_DISTR *cxt; distr = unur_distr_normal(NULL,0); cxt = unur_distr_cxtrans_new( distr ); ] unur_distr_cxtrans_set_alpha( cxt, -5. ); --> expected_setfailed --> UNUR_ERR_DISTR_SET unur_distr_cxtrans_set_rescale( cxt, 1., -1. ); --> expected_setfailed --> UNUR_ERR_DISTR_SET unur_distr_cxtrans_set_alpha( cxt, 0. ); --> expected_setfailed --> UNUR_ERR_DISTR_SET unur_distr_cxtrans_set_alpha( cxt, UNUR_INFINITY ); unur_distr_cxtrans_set_domain( cxt, -1., 1. ) --> expected_setfailed --> UNUR_ERR_DISTR_SET unur_distr_free(cxt); ############################################################################# [get] [get - invalid NULL ptr: distr = NULL; ] unur_distr_cxtrans_get_distribution( distr ); --> expected_NULL --> UNUR_ERR_NULL unur_distr_cxtrans_get_alpha( distr ); --> expected_negINFINITY --> UNUR_ERR_NULL unur_distr_cxtrans_get_mu( distr ); --> expected_negINFINITY --> UNUR_ERR_NULL unur_distr_cxtrans_get_sigma( distr ); --> expected_negINFINITY --> UNUR_ERR_NULL [get - invalid distribution type: distr = unur_distr_discr_new(); ] unur_distr_cxtrans_get_distribution( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID unur_distr_cxtrans_get_alpha( distr ); --> expected_negINFINITY --> UNUR_ERR_DISTR_INVALID unur_distr_cxtrans_get_mu( distr ); --> expected_negINFINITY --> UNUR_ERR_DISTR_INVALID unur_distr_cxtrans_get_sigma( distr ); --> expected_negINFINITY --> UNUR_ERR_DISTR_INVALID [get - invalid distribution id: distr = unur_distr_cont_new(); ] unur_distr_cxtrans_get_distribution( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID unur_distr_cxtrans_get_alpha( distr ); --> expected_negINFINITY --> UNUR_ERR_DISTR_INVALID unur_distr_cxtrans_get_mu( distr ); --> expected_negINFINITY --> UNUR_ERR_DISTR_INVALID unur_distr_cxtrans_get_sigma( distr ); --> expected_negINFINITY --> UNUR_ERR_DISTR_INVALID ############################################################################# # [chg] ############################################################################# # [init] ############################################################################# # [reinit] ############################################################################# [sample] [sample - compare clone: UNUR_GEN *clone; UNUR_DISTR *d; d = unur_distr_cauchy(NULL,0); unur_distr_cont_set_domain(d,0.,UNUR_INFINITY); distr = unur_distr_cxtrans_new( d ); unur_distr_cxtrans_set_alpha(distr, 0.5 ); 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: ] ############################################################################# [validate] [validate - generators:] # TDR par[0] = unur_tdr_new(@distr@); # AROU par[1] = unur_arou_new(@distr@); # SROU par[2] = unur_srou_new(@distr@); # HINV par[3] = unur_ninv_new(@distr@); # TABL par[4] = unur_tabl_new(@distr@); [validate - distributions:] # Exponential distribution with logPDF { UNUR_DISTR *d; d = unur_distr_exponential( NULL, 0 ); distr[0] = unur_distr_cxtrans_new( d ); unur_distr_cxtrans_set_alpha(distr[0], UNUR_INFINITY ); unur_distr_cxtrans_set_mode(distr[0],1.); unur_distr_free(d); } { UNUR_DISTR *d; d = unur_distr_exponential( NULL, 0 ); distr[1] = unur_distr_cxtrans_new( d ); unur_distr_cxtrans_set_alpha(distr[1], 2.); unur_distr_free(d); } { UNUR_DISTR *d; d = unur_distr_exponential( NULL, 0 ); distr[2] = unur_distr_cxtrans_new( d ); unur_distr_cxtrans_set_alpha(distr[2], 1.); unur_distr_cxtrans_set_mode(distr[2],0.); unur_distr_free(d); } { UNUR_DISTR *d; d = unur_distr_exponential( NULL, 0 ); distr[3] = unur_distr_cxtrans_new( d ); unur_distr_cxtrans_set_alpha(distr[3], 0.5); unur_distr_cxtrans_set_mode(distr[3],0.7071067811865475); unur_distr_free(d); } { UNUR_DISTR *d; d = unur_distr_exponential( NULL, 0 ); distr[4] = unur_distr_cxtrans_new( d ); unur_distr_cxtrans_set_alpha(distr[4], 0.1); unur_distr_cxtrans_set_mode(distr[4],0.9895192582062144); unur_distr_free(d); } { UNUR_DISTR *d; d = unur_distr_exponential( NULL, 0 ); distr[5] = unur_distr_cxtrans_new( d ); unur_distr_cxtrans_set_alpha(distr[5], 0.001); unur_distr_cxtrans_set_mode(distr[5],0.9999989995001669); unur_distr_free(d); } { UNUR_DISTR *d; d = unur_distr_exponential( NULL, 0 ); distr[6] = unur_distr_cxtrans_new( d ); unur_distr_cxtrans_set_alpha(distr[6], 0.); unur_distr_cxtrans_set_mode(distr[6],0.); unur_distr_free(d); } # Exponential distribution without logPDF { UNUR_DISTR *d; d = unur_distr_exponential_wo_logpdf( NULL, 0 ); distr[7] = unur_distr_cxtrans_new( d ); unur_distr_cxtrans_set_alpha(distr[7], UNUR_INFINITY ); unur_distr_cxtrans_set_mode(distr[7],1.); unur_distr_free(d); } { UNUR_DISTR *d; d = unur_distr_exponential_wo_logpdf( NULL, 0 ); distr[8] = unur_distr_cxtrans_new( d ); unur_distr_cxtrans_set_alpha(distr[8], 2.); unur_distr_free(d); } { UNUR_DISTR *d; d = unur_distr_exponential_wo_logpdf( NULL, 0 ); distr[9] = unur_distr_cxtrans_new( d ); unur_distr_cxtrans_set_alpha(distr[9], 1.); unur_distr_cxtrans_set_mode(distr[9],0.); unur_distr_free(d); } { UNUR_DISTR *d; d = unur_distr_exponential_wo_logpdf( NULL, 0 ); distr[10] = unur_distr_cxtrans_new( d ); unur_distr_cxtrans_set_alpha(distr[10], 0.5); unur_distr_cxtrans_set_mode(distr[10],0.7071067811865475); unur_distr_free(d); } { UNUR_DISTR *d; d = unur_distr_exponential_wo_logpdf( NULL, 0 ); distr[11] = unur_distr_cxtrans_new( d ); unur_distr_cxtrans_set_alpha(distr[11], 0.1); unur_distr_cxtrans_set_mode(distr[11],0.9895192582062144); unur_distr_free(d); } { UNUR_DISTR *d; d = unur_distr_exponential_wo_logpdf( NULL, 0 ); distr[12] = unur_distr_cxtrans_new( d ); unur_distr_cxtrans_set_alpha(distr[12], 0.001); unur_distr_cxtrans_set_mode(distr[12],0.9999989995001669); unur_distr_free(d); } { UNUR_DISTR *d; d = unur_distr_exponential_wo_logpdf( NULL, 0 ); distr[13] = unur_distr_cxtrans_new( d ); unur_distr_cxtrans_set_alpha(distr[13], 0.); unur_distr_cxtrans_set_mode(distr[13],0.); unur_distr_free(d); } # Gamma distributions #{ UNUR_DISTR *d; #fpm[0] = 1.; #d = unur_distr_gamma( fpm,1 ); #distr[4] = unur_distr_cxtrans_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] SROU # [3] HINV # [4] TABL # # [0] [1] [2] [3] [4] # distribution #----------------------------------------------------- x <0> + + + + + # exponential (1), alpha=inf (exp) x <1> . . . + . # exponential (1), alpha=2 <2> + x+ + + + # exponential (1), alpha=1 x <3> + + + + + # exponential (1), alpha=0.5 x <4> + + + + + # exponential (1), alpha=0.1 x <5> + . + + + # exponential (1), alpha=0.001 x <6> . . + + + # exponential (1), alpha=0 (log) x <7> + + + + + # exponential_wo_logpdf (1), alpha=inf (exp) x <8> . . . + . # exponential_wo_logpdf (1), alpha=2 x <9> + + + + + # exponential_wo_logpdf (1), alpha=1 x<10> + + + + + # exponential_wo_logpdf (1), alpha=0.5 x<11> + + + + + # exponential_wo_logpdf (1), alpha=0.1 x<12> + . + + + # exponential_wo_logpdf (1), alpha=0.001 x<13> . . + + + # exponential_wo_logpdf (1), alpha=0 (log) ############################################################################# ############################################################################# [verbatim] ############################################################################# unuran-1.11.0/tests/t_hist.c0000644001357500135600000004456514430713513012654 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for HIST **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); int unur_hist_set_verify( UNUR_PAR *par, int verify); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ #define COMPARE_SAMPLE_SIZE (10000) #define VIOLATE_SAMPLE_SIZE (20) UNUR_DISTR *get_distr_with_data( void ); UNUR_DISTR *get_distr_with_data2( void ); /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ /*---------------------------------------------------------------------------*/ UNUR_DISTR *get_distr_with_data( void ) { #define HIST_SIZE 20 double hist[HIST_SIZE]; UNUR_DISTR *distr; int i; unur_urng_fish_reset(NULL); for (i=0; itime = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [init] */ void test_init (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[init "); fflush(stdout); fprintf(TESTLOG,"\n[init]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* run init */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = get_distr_with_data(); par = unur_hist_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 72, gen ); unur_reset_errno(); ; n_tests_failed += (check_errorcode(TESTLOG,76,0x0u)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_init() */ /*---------------------------------------------------------------------------*/ /* [reinit] */ void test_reinit (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[reinit "); fflush(stdout); fprintf(TESTLOG,"\n[reinit]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_reinit() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* compare variants */ UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; UNUR_DISTR *distr1 = get_distr_with_data(); UNUR_DISTR *distr2 = get_distr_with_data2(); par = unur_hist_new(distr1); gen = unur_init( par ); abort_if_NULL(TESTLOG, 101, gen ); unur_reset_errno(); /* default generator object */; n_tests_failed += (compare_sequence_gen_start(TESTLOG,105,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* variant */ unur_free(gen); par = unur_hist_new(distr2); gen = unur_init(par); n_tests_failed += (compare_sequence_gen(TESTLOG,111,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr1); unur_distr_free(distr2); unur_free(gen); } { /* compare variant */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double hist[] = {0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1}; double bins[] = {1.,2.,3.,4.,5.,6.,7.,8.,9.,10.}; distr = unur_distr_cemp_new(); unur_distr_cemp_set_hist_prob(distr,hist,9); unur_distr_cemp_set_hist_domain(distr,1.,10.); par = unur_hist_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 124, gen ); unur_reset_errno(); /* default generator object */; n_tests_failed += (compare_sequence_gen_start(TESTLOG,128,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* variant */ unur_free(gen); unur_distr_free(distr); distr = unur_distr_cemp_new(); unur_distr_cemp_set_hist_prob(distr,hist,9); unur_distr_cemp_set_hist_bins(distr,bins,10); unur_distr_cemp_set_hist_domain(distr,1.,100.); par = unur_hist_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen(TESTLOG,139,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; UNUR_GEN *clone; double hist[] = {0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1}; double bins[] = {1.,2.,3.,4.,5.,6.,7.,8.,9.,10.}; distr = unur_distr_cemp_new(); unur_distr_cemp_set_hist_prob(distr,hist,9); unur_distr_cemp_set_hist_bins(distr,bins,10); par = unur_hist_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 150, gen ); unur_reset_errno(); /* default generator object */; n_tests_failed += (compare_sequence_gen_start(TESTLOG,154,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,160,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; UNUR_GEN *clone; distr = get_distr_with_data(); par = unur_hist_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 167, gen ); unur_reset_errno(); /* default generator object */; n_tests_failed += (compare_sequence_gen_start(TESTLOG,171,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,177,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare stringparser */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double hist[] = {0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1}; distr = unur_distr_cemp_new(); unur_distr_cemp_set_hist_prob(distr,hist,9); unur_distr_cemp_set_hist_domain(distr,1.,10.); par = unur_hist_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 186, gen ); unur_reset_errno(); /* default generator object */; n_tests_failed += (compare_sequence_gen_start(TESTLOG,190,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* string API */ unur_free(gen); gen = unur_str2gen("cemp; hist_prob=(0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1); \ hist_domain=(1.,10.) & method = hist"); n_tests_failed += (compare_sequence_gen(TESTLOG,196,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* string API */ unur_free(gen); gen = unur_str2gen("cemp; hist_prob=(0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1); \ hist_bins=(1.,2.,3.,4.,5.,6.,7.,8.,9.,10.) & method = hist"); n_tests_failed += (compare_sequence_gen(TESTLOG,202,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* [validate] */ /*---------------------------------------------------------------------------*/ /* [validate] */ void test_validate (void) { /* suppress GCC compiler warning */ GCC_DIAG_OFF(unused-variable) UNUR_DISTR *distr[2]; UNUR_PAR *par; UNUR_GEN *gen; double *darray; double fpm[10]; int n_tests_failed; int rcode; /* start test */ printf("[validate "); fflush(stdout); fprintf(TESTLOG,"\n[validate]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* distributions: 2 */ { { double pv[1000]; UNUR_DISTR *normal_dist; int i; double xmin, xmax; double fxmin, fxmax; /* xmin = -5.; */ fxmin = 0.; normal_dist = unur_distr_normal(NULL,0); for (i=0; i<1000; i++) { xmax = -5. + i/100.; fxmax = unur_distr_cont_eval_cdf(xmax,normal_dist); pv[i] = fxmax - fxmin; /* xmin = xmax; */ fxmin = fxmax; } unur_distr_free(normal_dist); distr[0] = unur_distr_cemp_new(); unur_distr_cemp_set_hist(distr[0],pv,1000,-5.,5.); } } { { double pv[1000]; double bins[1001]; UNUR_DISTR *normal_dist; int i; double xmin, xmax; double fxmin, fxmax; normal_dist = unur_distr_normal(NULL,0); bins[500] = 0.; for (i=501; i<=1000; i++) bins[i] = bins[i-1] + (i-500)/25000.; for (i=499; i>=0; i--) bins[i] = bins[i+1] + (i-500)/25000.; xmin = bins[0]; fxmin = unur_distr_cont_eval_cdf(xmin,normal_dist); pv[0] = unur_distr_cont_eval_cdf(bins[0],normal_dist); for (i=0; i<1000; i++) { xmax = bins[i+1]; fxmax = unur_distr_cont_eval_cdf(xmax,normal_dist); pv[i] = fxmax - fxmin; xmin = xmax; fxmin = fxmax; } unur_distr_free(normal_dist); distr[1] = unur_distr_cemp_new(); unur_distr_cemp_set_hist_prob(distr[1],pv,1000); unur_distr_cemp_set_hist_bins(distr[1],bins,1001); } } /* timing */ stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); printf("\n(chi^2) "); fflush(stdout); /* chi^2 tests: 2 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nChi^2 Test:\n"); /* distribution [0] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_hist_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_hist_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); /* free distributions */ unur_distr_free(distr[0]); unur_distr_free(distr[1]); /* test finished */ test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; /* we accept CHI2_FAILURES_TOLERATED failures */ (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_validate */ /* enable GCC compiler warning */ GCC_DIAG_ON(unused-variable) /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_hist_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_dext.conf0000644001357500135600000001574414420445767013365 00000000000000############################################################################# [main] [main - data:] # method (for information only: the program scans the file name) method: DEXT [main - header:] /* prototypes */ int check_init(UNUR_GEN *gen); int check_sample(UNUR_GEN *gen); int geom12_sample(UNUR_GEN *gen); int geoma_sample(UNUR_GEN *gen); int geomb_init(UNUR_GEN *gen); int geomb_sample(UNUR_GEN *gen); \#define COMPARE_SAMPLE_SIZE (500) \#define VIOLATE_SAMPLE_SIZE (20) /* \#define SEED (298346) */ ############################################################################# [new] [new - invalid distribution type: distr = unur_distr_cont_new(); ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID ############################################################################# [set] [set - invalid NULL ptr: par = NULL; ] ~_init(par,NULL); --> expected_setfailed --> UNUR_ERR_NULL ~_sample(par,NULL); --> expected_setfailed --> UNUR_ERR_NULL [set - invalid parameter object: distr = unur_distr_normal(NULL,0); par = unur_arou_new(distr); ] ~_init(par,NULL); --> expected_setfailed --> UNUR_ERR_PAR_INVALID ~_sample(par,NULL); --> expected_setfailed --> UNUR_ERR_NULL ~_sample(par,check_sample); --> expected_setfailed --> UNUR_ERR_PAR_INVALID unur_par_free(par); ############################################################################# [get] [get - invalid NULL ptr: gen = NULL; ] ~_params(gen,(size_t)0); --> expected_NULL --> UNUR_ERR_NULL ############################################################################# # [chg] ############################################################################# [init] [init - invalid NULL ptr: par = NULL; ] unur_init( par ); --> expected_NULL --> UNUR_ERR_NULL ############################################################################# [reinit] #[reinit - does not exist: # distr = unur_distr_exponential(NULL,0); # par = unur_dext_new(distr); # unur_dext_set_sample(par,geom12_sample); # gen = unur_init(par); <-- ! NULL ] #unur_reinit( gen ); # --> expected_reinit ############################################################################# [sample] [sample - compare clone: UNUR_GEN *clone; double fpar[1] = {0.5}; distr = unur_distr_geometric(fpar,1); par = NULL; gen = NULL; ] /* external generator 1 */ par = unur_dext_new(distr); unur_dext_set_sample(par,geom12_sample); gen = unur_init(par); -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen /* dstd */ unur_free(gen); par = unur_dstd_new(distr); gen = unur_init(par); -->compare_sequence_gen /* external generator A */ unur_free(gen); par = unur_dext_new(distr); unur_dext_set_sample(par,geoma_sample); gen = unur_init(par); -->compare_sequence_gen /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen /* external generator B */ unur_free(gen); par = unur_dext_new(distr); unur_dext_set_init(par,geomb_init); unur_dext_set_sample(par,geomb_sample); gen = unur_init(par); -->compare_sequence_gen /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen #..................................................................... [sample - compare clone: UNUR_GEN *clone; double fpar[1] = {0.1}; distr = unur_distr_geometric(fpar,1); par = NULL; gen = NULL; ] /* external generator A */ unur_free(gen); par = unur_dext_new(distr); unur_dext_set_sample(par,geoma_sample); gen = unur_init(par); -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen /* external generator B */ unur_free(gen); par = unur_dext_new(distr); unur_dext_set_init(par,geomb_init); unur_dext_set_sample(par,geomb_sample); gen = unur_init(par); -->compare_sequence_gen /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen /* dstd */ unur_free(gen); par = unur_dstd_new(distr); gen = unur_init(par); -->compare_sequence_gen ############################################################################# [validate] [validate - generators:] # geometric(0.5): # geometric distribution; do not read any parameters par[0] = unur_dext_new(@distr@); unur_dext_set_sample(par,geom12_sample); # geometric(p): # use pointer to parameter of distribution in sampling routine par[1] = unur_dext_new(@distr@); unur_dext_set_sample(par,geoma_sample); # geometric(p): # store parameter of distribution in generator object during init par[2] = unur_dext_new(@distr@); unur_dext_set_init(par,geomb_init); unur_dext_set_sample(par,geomb_sample); # geometric(p): # store parameter of distribution in generator object during init # change parameters { UNUR_DISTR *dg =NULL; par[3] = unur_dext_new(@distr@); unur_dext_set_init(par,geomb_init); unur_dext_set_sample(par,geomb_sample); fpm[0] = 0.2; dg = unur_get_distr(gen); unur_distr_discr_set_pmfparams(dg,fpm,1); unur_reinit(gen); } [validate - distributions:] # Geometric fpm[0] = 0.5; distr[0] = unur_distr_geometric(fpm,1); fpm[0] = 0.1; distr[1] = unur_distr_geometric(fpm,1); ## number of distributions: 2 [validate - test chi2:] # + ... pass test # 0 ... fail to initialize generator (given variant does not exist) # - ... fail test # / ... either init fails or test passes # . ... do not run test # # ... comment # # generators: # [0] ... Geometric(p) # [1] ... Geometric(p): use pointer to distribution # [2] ... Geometric(p): store distrparams in object # [3] ... Geometric, reinit with changed parameters # #gen 0 1 2 3 # distribution #------------------------------------------------------------- <0> + + + + # geometric(0.5) <1> - + + + # geometric(0.1) ############################################################################# ############################################################################# [verbatim] int check_init(UNUR_GEN *gen ATTRIBUTE__UNUSED) { return UNUR_SUCCESS; } int check_sample(UNUR_GEN *gen ATTRIBUTE__UNUSED) { return 0; } /* ............. */ int geom12_sample(UNUR_GEN *gen) { double U = unur_sample_urng(gen); return ((int) ceil(log(1.-U) / log(0.5) - 1.)); } /* ............. */ int geoma_sample(UNUR_GEN *gen) { \# define p (params[0]) /* scale */ double U = unur_sample_urng(gen); double *params = unur_dext_get_distrparams(gen); return ((int) ceil(log(1.-U) / log(1.-p) - 1.)); \# undef p } /* ............. */ int geomb_init(UNUR_GEN *gen) { \# define p (params[0]) /* scale */ double *params = unur_dext_get_distrparams(gen); double *genpar = unur_dext_get_params(gen, sizeof(double)); genpar[0] = p; return UNUR_SUCCESS; \# undef p } int geomb_sample(UNUR_GEN *gen) { \# define p (params[0]) /* scale */ double *params = unur_dext_get_params(gen,(size_t)0); double U = unur_sample_urng(gen); return ((int) ceil(log(1.-U) / log(1.-p) - 1.)); \# undef p } ############################################################################# unuran-1.11.0/tests/t_distr_cemp.c0000644001357500135600000005057314430713513014032 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for DISTR_CEMP **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); int unur_distr_cemp_set_verify( UNUR_PAR *par, int verify); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ #define COMPARE_SAMPLE_SIZE (500) #define VIOLATE_SAMPLE_SIZE (20) /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [set] */ void test_set (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[set "); fflush(stdout); fprintf(TESTLOG,"\n[set]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,29,(unur_distr_cemp_set_data( distr, NULL, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,29,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,32,(unur_distr_cemp_read_data( distr, "junk" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,32,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,35,(unur_distr_cemp_set_hist( distr, NULL, 0, 0., 2. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,35,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,38,(unur_distr_cemp_set_hist_prob( distr, NULL, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,38,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,41,(unur_distr_cemp_set_hist_domain( distr, 0., 2. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,41,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,44,(unur_distr_cemp_set_hist_bins( distr, NULL, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,44,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,51,(unur_distr_cemp_set_data( distr, NULL, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,51,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,54,(unur_distr_cemp_read_data( distr, "junk" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,54,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,57,(unur_distr_cemp_set_hist( distr, NULL, 0, 0., 2. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,57,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,60,(unur_distr_cemp_set_hist_prob( distr, NULL, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,60,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,63,(unur_distr_cemp_set_hist_domain( distr, 0., 2. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,63,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,66,(unur_distr_cemp_set_hist_bins( distr, NULL, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,66,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = unur_distr_cemp_new(); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,73,(unur_distr_cemp_set_data( distr, NULL, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,73,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,76,(unur_distr_cemp_set_hist( distr, NULL, 0, 0., 2. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,76,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,79,(unur_distr_cemp_set_hist_prob( distr, NULL, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,79,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,82,(unur_distr_cemp_set_hist_bins( distr, NULL, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,82,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; double data[] = {1.,2.,3.}; distr = unur_distr_cemp_new(); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,90,(unur_distr_cemp_set_data( distr, data, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,90,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,93,(unur_distr_cemp_read_data( distr, "there-should-be-no-such-file" )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,93,UNUR_ERR_GENERIC)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,96,(unur_distr_cemp_set_hist( distr, data, 0, 0., 2. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,96,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,99,(unur_distr_cemp_set_hist_prob( distr, data, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,99,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,102,(unur_distr_cemp_set_hist( distr, data, 3, 5., 2. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,102,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,105,(unur_distr_cemp_set_hist_domain( distr, 5., 2. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,105,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,108,(unur_distr_cemp_set_hist_domain( distr, -UNUR_INFINITY, 2. )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,108,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,111,(unur_distr_cemp_set_hist_domain( distr, 0., UNUR_INFINITY )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,111,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,114,(unur_distr_cemp_set_hist_bins( distr, data, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,114,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,117,(unur_distr_cemp_set_hist_bins( distr, data, 4 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,117,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; double prob[] = {1.,2.,3.}; double bins[] = {1.,2.,3.,4.}; distr = unur_distr_cemp_new(); unur_distr_cemp_set_hist_prob( distr, prob, 3 ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,127,(unur_distr_cemp_set_hist_bins( distr, bins, 0 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,127,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,130,(unur_distr_cemp_set_hist_bins( distr, bins, 3 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,130,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,133,(unur_distr_cemp_set_hist_bins( distr, bins, 5 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,133,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; double prob[] = {1.,2.,3.}; double bins[] = {1.,2.,-3.,4.}; double binsinf[] = {1.,2.,3.,UNUR_INFINITY}; distr = unur_distr_cemp_new(); unur_distr_cemp_set_hist_prob( distr, prob, 3 ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,144,(unur_distr_cemp_set_hist_bins( distr, bins, 4 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,144,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,147,(unur_distr_cemp_set_hist_bins( distr, binsinf, 4 )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,147,UNUR_ERR_DISTR_SET)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_set() */ /*---------------------------------------------------------------------------*/ /* [get] */ void test_get (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[get "); fflush(stdout); fprintf(TESTLOG,"\n[get]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; const double *sample; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_zero(TESTLOG,159,(unur_distr_cemp_get_data( distr, &sample )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,159,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; const double *sample; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_zero(TESTLOG,167,(unur_distr_cemp_get_data( distr, &sample )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,167,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_get() */ /*---------------------------------------------------------------------------*/ /* [chg] */ void test_chg (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[chg "); fflush(stdout); fprintf(TESTLOG,"\n[chg]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_chg() */ /*---------------------------------------------------------------------------*/ /* [init] */ void test_init (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[init "); fflush(stdout); fprintf(TESTLOG,"\n[init]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_init() */ /*---------------------------------------------------------------------------*/ /* [reinit] */ void test_reinit (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[reinit "); fflush(stdout); fprintf(TESTLOG,"\n[reinit]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_reinit() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* compare stringparser */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double data[] = {1.,2.,3.,4.,5.,6.,7.,8.,9.}; distr = NULL; par = NULL; gen = NULL; unur_reset_errno(); distr = unur_distr_cemp_new(); unur_distr_cemp_set_data(distr,data,9); par = unur_auto_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,196,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; gen = unur_str2gen( "cemp; data = (1.,2.,3.,4.,5.,6.,7.,8.,9.)" ); n_tests_failed += (compare_sequence_gen(TESTLOG,200,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; gen = unur_str2gen( "cemp; data = (1.,2.,3.,4.,5.,6.,7.,8.,9.) & \ method = auto" ); n_tests_failed += (compare_sequence_gen(TESTLOG,205,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare stringparser */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double hist[] = {0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1}; distr = NULL; par = NULL; gen = NULL; unur_reset_errno(); distr = unur_distr_cemp_new(); unur_distr_cemp_set_hist_prob(distr,hist,9); unur_distr_cemp_set_hist_domain(distr,1.,10.); par = unur_auto_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,220,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen=NULL; gen = unur_str2gen("cemp; hist_prob=(0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1); \ hist_domain=(1.,10.)"); n_tests_failed += (compare_sequence_gen(TESTLOG,225,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen=NULL; gen = unur_str2gen("cemp; hist_prob=(0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1); \ hist_domain=(1.,10.) & method = hist"); n_tests_failed += (compare_sequence_gen(TESTLOG,230,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_distr_cemp_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_ssr.c0000644001357500135600000037670014430713513012513 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for SSR **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ double pdf_normal( double x, const UNUR_DISTR *distr ); double pdf_invalid( double x, const UNUR_DISTR *distr ); double pdf_sqrtlin( double x, const UNUR_DISTR *distr ); double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ); double cdf_sqrtlin( double x, const UNUR_DISTR *distr ); double pdf_sqrtlinshft(double x, const UNUR_DISTR *distr ); double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ); int unur_ssr_set_pedantic( struct unur_par *par, int pedantic ); #define COMPARE_SAMPLE_SIZE (10000) #define VIOLATE_SAMPLE_SIZE (20) /* #define SEED (1656256) */ /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ /* pdf for normal distribution */ double pdf_normal( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return exp(-x*x/2.); } /* end of pdf_normal */ /* pdf that does not work */ double pdf_invalid( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { return ((fabs(x)<0.001) ? 0. : exp(-x*x/2.)); } /* end of pdf_invalid */ /* pdf with piecewise linear function as transformed density with T = -1/sqrt */ double pdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y = 1./(fabs(x)+1.); return y*y; } double dpdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y = 1./(fabs(x)+1.); y = 2.*y*y*y; return ((x<0.) ? y : - y); } double cdf_sqrtlin( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { if (x<=0.) return 0.5/(1.-x); else return (1.-0.5/(1.+x)); } /* pdf with piecewise linear function as transformed density with T = -1/sqrt and shifted mode */ double pdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y; x -= 1000.; y = 1./(fabs(x)+1.); return y*y; } double dpdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { double y; x -= 1000.; y = 1./(fabs(x)+1.); y = 2.*y*y*y; return ((x<0.) ? y : - y); } double cdf_sqrtlinshft( double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { x -= 1000.; if (x<=0.) return 0.5/(1.-x); else return (1.-0.5/(1.+x)); } /* dummy function */ int unur_ssr_set_pedantic( struct unur_par *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) { return 1; } /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_DISTR *distr = NULL; distr = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,39,(unur_ssr_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,39,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* invalid distribution type */ UNUR_DISTR *distr = NULL; distr = unur_distr_discr_new(); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,45,(unur_ssr_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,45,UNUR_ERR_DISTR_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* data missing in distribution object */ UNUR_DISTR *distr = NULL; distr = unur_distr_cont_new(); unur_reset_errno(); /* pdf, mode, pdfarea */ n_tests_failed += (check_expected_NULL(TESTLOG,52,(unur_ssr_new( distr )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,52,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [set] */ void test_set (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[set "); fflush(stdout); fprintf(TESTLOG,"\n[set]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,62,(unur_ssr_set_cdfatmode(par,0.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,62,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,65,(unur_ssr_set_pdfatmode(par,1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,65,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,68,(unur_ssr_set_verify(par,1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,68,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,71,(unur_ssr_set_usesqueeze(par,1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,71,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* invalid parameter object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_arou_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,79,(unur_ssr_set_cdfatmode(par,0.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,79,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,82,(unur_ssr_set_pdfatmode(par,1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,82,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,85,(unur_ssr_set_verify(par,1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,85,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,88,(unur_ssr_set_usesqueeze(par,1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,88,UNUR_ERR_PAR_INVALID)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_ssr_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,98,(unur_ssr_set_cdfatmode(par,-1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,98,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,101,(unur_ssr_set_pdfatmode(par,-1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,101,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_par_free(par); unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_set() */ /*---------------------------------------------------------------------------*/ /* [chg] */ void test_chg (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[chg "); fflush(stdout); fprintf(TESTLOG,"\n[chg]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid generator object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = unur_arou_new(distr); unur_set_debug(par,0); gen = unur_init( par ); abort_if_NULL(TESTLOG, 117, gen ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,121,(unur_ssr_chg_verify(gen,1)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,121,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,124,(unur_ssr_chg_cdfatmode(gen,1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,124,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,127,(unur_ssr_chg_pdfatmode(gen,1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,127,UNUR_ERR_GEN_INVALID)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* invalid parameters */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[2] = {2.,5.}; distr = unur_distr_gamma(fpar,2); par = unur_ssr_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 133, gen ); unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,137,(unur_ssr_chg_cdfatmode(gen,-1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,137,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_reset_errno(); n_tests_failed += (check_expected_setfailed(TESTLOG,140,(unur_ssr_chg_pdfatmode(gen,-1.)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,140,UNUR_ERR_PAR_SET)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_chg() */ /*---------------------------------------------------------------------------*/ /* [init] */ void test_init (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[init "); fflush(stdout); fprintf(TESTLOG,"\n[init]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,151,(unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,151,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } { /* invalid data */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr,pdf_invalid); unur_distr_cont_set_mode(distr,0.); unur_distr_cont_set_pdfarea(distr,1.); par = unur_ssr_new(distr); unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,161,(unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,161,UNUR_ERR_GEN_DATA)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* data missing in distribution object */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = unur_distr_cont_new(); par = NULL; unur_reset_errno(); /* mode, pdfarea */ unur_distr_cont_set_pdf(distr,pdf_normal); par = unur_ssr_new( distr ); n_tests_failed += (check_expected_NULL(TESTLOG,171,(unur_init(par)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,171,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* pdfarea */ unur_distr_cont_set_mode(distr,1.); par = unur_ssr_new( distr ); n_tests_failed += (check_expected_NULL(TESTLOG,177,(unur_init(par)))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,177,UNUR_ERR_DISTR_REQUIRED)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_init() */ /*---------------------------------------------------------------------------*/ /* [reinit] */ void test_reinit (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[reinit "); fflush(stdout); fprintf(TESTLOG,"\n[reinit]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* exist */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = unur_ssr_new(distr); gen = unur_init( par ); abort_if_NULL(TESTLOG, 185, gen ); unur_reset_errno(); n_tests_failed += (check_expected_reinit(TESTLOG,189,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_reinit() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* compare */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,0); par = NULL; unur_reset_errno(); /* default algorithm */ par = unur_ssr_new(distr); n_tests_failed += (compare_sequence_par_start(TESTLOG,202,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* default algorithm - verifying mode */ par = unur_ssr_new(distr); unur_ssr_set_verify(par,1); n_tests_failed += (compare_sequence_par(TESTLOG,207,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* compare */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = NULL; unur_reset_errno(); /* use cdf at mode */ par = unur_ssr_new(distr); unur_ssr_set_cdfatmode(par,0.5); n_tests_failed += (compare_sequence_par_start(TESTLOG,219,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* use cdf at mode and squeeze */ par = unur_ssr_new(distr); unur_ssr_set_cdfatmode(par,0.5); unur_ssr_set_usesqueeze(par,1); n_tests_failed += (compare_sequence_par(TESTLOG,225,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* use cdf at mode - verifying mode */ par = unur_ssr_new(distr); unur_ssr_set_cdfatmode(par,0.5); unur_ssr_set_verify(par,1); n_tests_failed += (compare_sequence_par(TESTLOG,231,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* use cdf at mode and squeeze - verifying mode */ par = unur_ssr_new(distr); unur_ssr_set_cdfatmode(par,0.5); unur_ssr_set_usesqueeze(par,1); unur_ssr_set_verify(par,1); n_tests_failed += (compare_sequence_par(TESTLOG,238,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* violate condition */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,2); par = NULL; /* pdf at mode is too small: hat < pdf near mode */ unur_reset_errno(); /* default algorithm */ par = unur_ssr_new(distr); unur_ssr_set_pdfatmode(par,0.1); run_verify_generator (TESTLOG,252,par); n_tests_failed += (check_errorcode(TESTLOG,252,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* use cdf at mode and squeeze */ par = unur_ssr_new(distr); unur_ssr_set_pdfatmode(par,0.1); unur_ssr_set_cdfatmode(par,0.5); unur_ssr_set_usesqueeze(par,1); run_verify_generator (TESTLOG,259,par); n_tests_failed += (check_errorcode(TESTLOG,259,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; /* pdf at mode is too large: squeeze > pdf near mode */ unur_reset_errno(); /* use cdf at mode and squeeze */ unur_distr_cont_set_pdfarea(distr,10.); par = unur_ssr_new(distr); unur_ssr_set_cdfatmode(par,0.5); unur_ssr_set_pdfatmode(par,10.); unur_ssr_set_usesqueeze(par,1); run_verify_generator (TESTLOG,269,par); n_tests_failed += (check_errorcode(TESTLOG,269,UNUR_ERR_GEN_CONDITION)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* compare clone */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; UNUR_GEN *clone; distr = unur_distr_normal(NULL,0); par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_ssr_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,282,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,288,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare reinit */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; distr = unur_distr_normal(NULL,0); par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_ssr_new(distr); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,300,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* reinit */ unur_reinit(gen); n_tests_failed += (compare_sequence_gen(TESTLOG,304,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } { /* compare stringparser */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; double fpar[2] = {3.,3.}; distr = NULL; par = NULL; gen = NULL; unur_reset_errno(); distr = unur_distr_beta(fpar,2); unur_distr_cont_set_pdfarea(distr,2.); par = unur_ssr_new(distr); unur_ssr_set_cdfatmode(par,0.5); unur_ssr_set_pdfatmode(par,1.9); unur_ssr_set_usesqueeze(par,FALSE); unur_ssr_set_verify(par,TRUE); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,322,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "beta(3.,3.); pdfarea = 2. & \ method = ssr; cdfatmode = 0.5; usesqueeze = off; pdfatmode = 1.9; verify" ); n_tests_failed += (compare_sequence_gen(TESTLOG,328,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* [validate] */ /*---------------------------------------------------------------------------*/ /* [validate] */ void test_validate (void) { /* suppress GCC compiler warning */ GCC_DIAG_OFF(unused-variable) UNUR_DISTR *distr[31]; UNUR_PAR *par; UNUR_GEN *gen; double *darray; double fpm[10]; int n_tests_failed; int rcode; /* start test */ printf("[validate "); fflush(stdout); fprintf(TESTLOG,"\n[validate]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* distributions: 31 */ { fpm[0] = 1.; fpm[1] = 2.; distr[0] = unur_distr_beta(fpm,2); } { fpm[0] = 1.; fpm[1] = 5.; distr[1] = unur_distr_beta(fpm,2); } { fpm[0] = 1.; fpm[1] = 100.; distr[2] = unur_distr_beta(fpm,2); } { fpm[0] = 3.; fpm[1] = 4.; distr[3] = unur_distr_beta(fpm,2); } { fpm[0] = 5.; fpm[1] = 100.; distr[4] = unur_distr_beta(fpm,2); } { fpm[0] = 500.; fpm[1] = 300.; distr[5] = unur_distr_beta(fpm,2); } { fpm[0] = 5.; fpm[1] = 10.; fpm[2] = -3.; fpm[3] = 15.; distr[6] = unur_distr_beta(fpm,4); } { distr[7] = unur_distr_cauchy(NULL,0); } { fpm[0] = 1.; fpm[1] = 20.; distr[8] = unur_distr_cauchy(fpm,2); } { distr[23] = unur_distr_exponential(NULL,0); } { fpm[0] = 30.; fpm[1] = -5.; distr[24] = unur_distr_exponential(fpm,2); } { fpm[0] = 1.; distr[9] = unur_distr_gamma(fpm,1); } { fpm[0] = 2.; distr[10] = unur_distr_gamma(fpm,1); } { fpm[0] = 3.; distr[11] = unur_distr_gamma(fpm,1); } { fpm[0] = 10.; distr[12] = unur_distr_gamma(fpm,1); } { fpm[0] = 1000.; distr[13] = unur_distr_gamma(fpm,1); } { fpm[0] = 1.; fpm[1] = 4.; distr[29] = unur_distr_gamma(fpm,2); } { fpm[0] = 5.; fpm[1] = 1000.; distr[14] = unur_distr_gamma(fpm,2); } { fpm[0] = 5.; fpm[1] = 1.e-5; distr[15] = unur_distr_gamma(fpm,2); } { fpm[0] = 5.; fpm[1] = 10.; fpm[2] = 1000; distr[16] = unur_distr_gamma(fpm,3); } { fpm[0] = 0.5; distr[30] = unur_distr_gamma(fpm,1); } { distr[25] = unur_distr_laplace(NULL,0); } { fpm[0] = -10.; fpm[1] = 100.; distr[26] = unur_distr_laplace(fpm,2); } { distr[17] = unur_distr_normal(NULL,0); } { fpm[0] = 1.; fpm[1] = 1.e-5; distr[18] = unur_distr_normal(fpm,2); } { fpm[0] = 0.; fpm[1] = 1.e+5; distr[19] = unur_distr_normal(fpm,2); } { distr[20] = unur_distr_uniform(NULL,0); } { fpm[0] = 1.; fpm[1] = 20.; distr[21] = unur_distr_uniform(fpm,2); } { distr[27] = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr[27],pdf_sqrtlin); unur_distr_cont_set_dpdf(distr[27],dpdf_sqrtlin); unur_distr_cont_set_cdf(distr[27],cdf_sqrtlin); unur_distr_set_name(distr[27],"sqrtlin"); unur_distr_cont_set_mode(distr[27],0.); unur_distr_cont_set_pdfarea(distr[27],2.); } { distr[28] = unur_distr_cont_new(); unur_distr_cont_set_pdf(distr[28],pdf_sqrtlinshft); unur_distr_cont_set_dpdf(distr[28],dpdf_sqrtlinshft); unur_distr_cont_set_cdf(distr[28],cdf_sqrtlinshft); unur_distr_set_name(distr[28],"sqrtlin"); unur_distr_cont_set_mode(distr[28],1000.); unur_distr_cont_set_pdfarea(distr[28],2.); } { distr[22] = unur_distr_cauchy(NULL,0); unur_distr_cont_set_domain(distr[22],0.1,1.); unur_distr_cont_upd_mode(distr[22]); unur_distr_cont_upd_pdfarea(distr[22]); } /* timing */ stopwatch_print(TESTLOG,"\n<*>setup time = %.3f ms\n", stopwatch_lap(&watch)); printf("\n(chi^2) "); fflush(stdout); /* chi^2 tests: 124 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nChi^2 Test:\n"); /* distribution [0] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_ssr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_ssr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[1],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [2] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_ssr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[2],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [3] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_ssr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[3],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [4] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_ssr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[4],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [5] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_ssr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[5],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [6] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_ssr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[6],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [23] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_ssr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[23],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [24] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_ssr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[24],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [7] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_ssr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[7],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [8] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_ssr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[8],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [9] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_ssr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[9],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [0] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_ssr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[0],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [11] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_ssr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[11],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [12] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_ssr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[12],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [13] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_ssr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[13],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [29] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); par = unur_ssr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[29]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[29],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [14] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_ssr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[14],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [15] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_ssr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[15],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [16] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_ssr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[16],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [30] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); par = unur_ssr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[30]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[30],'0'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [25] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_ssr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[25],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [26] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_ssr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[26],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [17] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_ssr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[17],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [18] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_ssr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[18],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [19] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_ssr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[19],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [20] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_ssr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[20],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [21] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_ssr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'-'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[21],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [22] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_ssr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } rcode = run_validate_chi2(TESTLOG,0,gen,distr[22],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [27] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_ssr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[27],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [28] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_ssr_new(distr_localcopy); gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); rcode = run_validate_chi2(TESTLOG,0,gen,distr[28],'+'); n_tests_failed += (rcode==UNUR_SUCCESS)?0:1; n_tests_failed += (rcode==UNUR_FAILURE)?1000:0; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); printf("\n(verify hat) "); fflush(stdout); /* verify hat tests: 124 */ unur_set_default_debug(~UNUR_DEBUG_SAMPLE); fprintf( TESTLOG,"\nVerify Hat Test (squeeze <= PDF <= hat):\n"); /* distribution [0] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [1] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[1]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[1],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [2] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[2]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[2],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [3] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[3]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[3],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [4] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[4]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[4],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [5] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[5]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[5],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [6] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[6]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[6],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [23] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[23]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[23],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [24] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[24]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[24],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [7] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[7]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[7],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [8] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[8]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[8],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [9] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[9]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[9],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [0] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[0]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[0],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [11] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[11]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[11],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [12] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[12]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[12],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [13] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[13]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[13],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [14] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[14]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[14],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [15] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[15]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[15],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [16] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[16]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[16],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { printf("."); fflush(stdout); } /* distribution [25] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[25]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[25],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [26] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[26]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[26],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [17] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[17]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[17],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [18] */ if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(fullcheck) { printf("."); fflush(stdout); } if(fullcheck) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[18]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[18],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [19] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[19]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[19],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [20] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[20]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[20],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [21] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[21]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[21],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [22] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_domain(dg,0.9,0.92); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[22]); { UNUR_DISTR *dg =NULL; par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); fpm[0] = 1.; fpm[1] = 4.; gen = unur_init(par); if (gen) { dg = unur_get_distr(gen); unur_distr_cont_set_pdfparams(dg,fpm,2); unur_distr_cont_upd_pdfarea(dg); unur_distr_cont_upd_mode(dg); unur_reinit(gen); } } if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[22],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } /* distribution [27] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[27]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[27],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* distribution [28] */ if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { unur_reset_errno(); do { UNUR_DISTR *distr_localcopy = unur_distr_clone(distr[28]); { double cdfatmode = unur_distr_cont_eval_cdf( unur_distr_cont_get_mode(distr_localcopy), distr_localcopy ); par = unur_ssr_new(distr_localcopy); unur_ssr_set_pedantic(par,0); unur_ssr_set_cdfatmode(par,cdfatmode); unur_ssr_set_usesqueeze(par,1); } gen = unur_init(par); if (gen) unur_ssr_chg_verify(gen,1); n_tests_failed += (run_validate_verifyhat(TESTLOG,0,gen,distr[28],'~')==UNUR_SUCCESS)?0:1000; unur_free(gen); unur_distr_free(distr_localcopy); } while (0); } if(TRUE) { printf("."); fflush(stdout); } if(TRUE) { printf("."); fflush(stdout); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.0f ms\n", stopwatch_lap(&watch)); /* free distributions */ unur_distr_free(distr[0]); unur_distr_free(distr[1]); unur_distr_free(distr[2]); unur_distr_free(distr[3]); unur_distr_free(distr[4]); unur_distr_free(distr[5]); unur_distr_free(distr[6]); unur_distr_free(distr[7]); unur_distr_free(distr[8]); unur_distr_free(distr[9]); unur_distr_free(distr[10]); unur_distr_free(distr[11]); unur_distr_free(distr[12]); unur_distr_free(distr[13]); unur_distr_free(distr[14]); unur_distr_free(distr[15]); unur_distr_free(distr[16]); unur_distr_free(distr[17]); unur_distr_free(distr[18]); unur_distr_free(distr[19]); unur_distr_free(distr[20]); unur_distr_free(distr[21]); unur_distr_free(distr[22]); unur_distr_free(distr[23]); unur_distr_free(distr[24]); unur_distr_free(distr[25]); unur_distr_free(distr[26]); unur_distr_free(distr[27]); unur_distr_free(distr[28]); unur_distr_free(distr[29]); unur_distr_free(distr[30]); /* test finished */ test_ok &= (n_tests_failed>CHI2_FAILURES_TOLERATED) ? 0 : 1; /* we accept CHI2_FAILURES_TOLERATED failures */ (n_tests_failed>CHI2_FAILURES_TOLERATED) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_validate */ /* enable GCC compiler warning */ GCC_DIAG_ON(unused-variable) /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_ssr_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_auto.conf0000644001357500135600000001035114420445767013356 00000000000000############################################################################# [main] [main - data:] # method (for information only: the program scans the file name) method: AUTO [main - header:] /* prototypes */ int unur_auto_set_pedantic( struct unur_par *par, int pedantic ); \#define COMPARE_SAMPLE_SIZE (10000) \#define VIOLATE_SAMPLE_SIZE (20) ############################################################################# [new] [new - invalid NULL ptr: distr = NULL; ] ~( distr ); --> expected_NULL --> UNUR_ERR_NULL ############################################################################# [set] [set - invalid NULL ptr: par = NULL; ] ~_logss(par,1); [set - invalid parameter object: distr = unur_distr_normal(NULL,0); par = unur_tdr_new(distr); ] ~_logss(par,1); --> expected_setfailed --> UNUR_ERR_PAR_INVALID unur_par_free(par); [set - invalid parameters: distr = unur_distr_normal(NULL,0); par = unur_auto_new(distr); ] ~_logss(par,-1); --> expected_setfailed --> UNUR_ERR_PAR_SET unur_par_free(par); ############################################################################# # [get] ############################################################################# # [chg] ############################################################################# # [init] ############################################################################# # [reinit] #[reinit - does not exist: # distr = unur_distr_normal(NULL,0); # par = unur_auto_new(distr); # gen = unur_init( par ); <-- ! NULL ] #unur_reinit( gen ); # --> expected_setfailed --> UNUR_ERR_NO_REINIT #unur_sample_cont( gen ); # --> expected_INFINITY --> UNUR_ERR_GEN_CONDITION ############################################################################# [sample] [sample - compare: double fpar[2] = {0.,1.}; distr = unur_distr_normal(fpar,0); par = NULL; ] /* TDR */ par = unur_tdr_new(distr); -->compare_sequence_par_start /* AUTO */ par = unur_auto_new(distr); -->compare_sequence_par [sample - compare: double fpar[] = {0.1}; distr = unur_distr_geometric(fpar,1); par = NULL; ] /* DARI */ par = unur_dari_new(distr); -->compare_sequence_par_start /* AUTO */ par = unur_auto_new(distr); -->compare_sequence_par #..................................................................... [sample - compare clone: UNUR_GEN *clone; distr = unur_distr_normal(NULL,0); par = NULL; gen = NULL; ] /* original generator object */ par = unur_auto_new(distr); gen = unur_init(par); -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen #..................................................................... [sample - compare stringparser - cont: distr = NULL; par = NULL; gen = NULL; ] distr = unur_distr_normal(NULL,0); par = unur_auto_new(distr); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "normal()" ); -->compare_sequence_gen unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "normal() & method = auto" ); -->compare_sequence_gen #..................................................................... [sample - compare stringparser discr: double fpar[] = {0.4}; distr = NULL; par = NULL; gen = NULL; ] distr = unur_distr_geometric(fpar,1); par = unur_auto_new(distr); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "geometric(0.4)"); -->compare_sequence_gen unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "geometric(0.4) & method = auto"); -->compare_sequence_gen ############################################################################# # [validate] ############################################################################# ############################################################################# [verbatim] /* no such function */ int unur_auto_set_pedantic( struct unur_par *par ATTRIBUTE__UNUSED, int pedantic ATTRIBUTE__UNUSED) { return 1; } ############################################################################# unuran-1.11.0/tests/t_unif.c0000644001357500135600000002470414430713513012637 00000000000000/* file automatically generated by make_test_files.pl Tue May 16 16:46:35 2023 */ /***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /** ** Tests for UNIF **/ /*---------------------------------------------------------------------------*/ #include "testunuran.h" #ifdef UNUR_URNG_DEFAULT_RNGSTREAM #include #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* global variables */ static FILE *TESTLOG; /* test log file */ static FILE *UNURANLOG; /* unuran log file */ static int test_ok = TRUE; /* all tests ok (boolean) */ static int fullcheck = FALSE; /* whether all checks are performed */ static TIMER watch; /* stop watch */ /*---------------------------------------------------------------------------*/ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ); int unur_unif_set_verify( UNUR_PAR *par, int verify); /*---------------------------------------------------------------------------*/ void test_new (void); void test_set (void); void test_get (void); void test_chg (void); void test_init (void); void test_reinit (void); void test_sample (void); void test_validate (void); void test_special(void); /*---------------------------------------------------------------------------*/ /* prototypes */ #define COMPARE_SAMPLE_SIZE (10000) #define VIOLATE_SAMPLE_SIZE (20) /*---------------------------------------------------------------------------*/ #ifndef CHI2_FAILURES_TOLERATED # define CHI2_FAILURES_TOLERATED DEFAULT_CHI2_FAILURES_TOLERATED #endif /*---------------------------------------------------------------------------*/ /* [verbatim] */ /*---------------------------------------------------------------------------*/ /* [new] */ void test_new (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[new "); fflush(stdout); fprintf(TESTLOG,"\n[new]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_new() */ /*---------------------------------------------------------------------------*/ /* [init] */ void test_init (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[init "); fflush(stdout); fprintf(TESTLOG,"\n[init]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* invalid NULL ptr */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); n_tests_failed += (check_expected_NULL(TESTLOG,41,(unur_init( par )))==UNUR_SUCCESS)?0:1; n_tests_failed += (check_errorcode(TESTLOG,41,UNUR_ERR_NULL)==UNUR_SUCCESS)?0:1; } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_init() */ /*---------------------------------------------------------------------------*/ /* [reinit] */ void test_reinit (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[reinit "); fflush(stdout); fprintf(TESTLOG,"\n[reinit]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* exist */ UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; par = unur_unif_new(NULL); gen = unur_init( par ); abort_if_NULL(TESTLOG, 49, gen ); unur_reset_errno(); n_tests_failed += (check_expected_reinit(TESTLOG,53,(unur_reinit( gen )))==UNUR_SUCCESS)?0:1; unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_reinit() */ /*---------------------------------------------------------------------------*/ /* [sample] */ void test_sample (void) { int n_tests_failed; /* number of failed tests */ /* start test */ printf("[sample "); fflush(stdout); fprintf(TESTLOG,"\n[sample]\n"); /* reset counter */ n_tests_failed = 0; /* set stop watch */ stopwatch_lap(&watch); { /* compare */ UNUR_PAR *par = NULL; par = NULL; unur_reset_errno(); ; compare_sequence_urng_start(TESTLOG,63,COMPARE_SAMPLE_SIZE); unur_reset_errno(); par = unur_unif_new(NULL); n_tests_failed += (compare_sequence_par(TESTLOG,66,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; } { /* compare */ UNUR_DISTR *distr = NULL; UNUR_PAR *par = NULL; distr = unur_distr_uniform(NULL,0); par = NULL; unur_reset_errno(); ; compare_sequence_urng_start(TESTLOG,75,COMPARE_SAMPLE_SIZE); unur_reset_errno(); par = unur_unif_new(distr); n_tests_failed += (compare_sequence_par(TESTLOG,78,par,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_distr_free(distr); } { /* compare clone */ UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; UNUR_GEN *clone; par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_unif_new(NULL); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,90,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; n_tests_failed += (compare_sequence_gen(TESTLOG,96,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_free(gen); } { /* compare reinit */ UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; par = NULL; gen = NULL; unur_reset_errno(); /* original generator object */ par = unur_unif_new(NULL); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,107,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); /* reinit */ unur_reinit(gen); n_tests_failed += (compare_sequence_gen(TESTLOG,111,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_free(gen); } { /* compare stringparser */ UNUR_PAR *par = NULL; UNUR_GEN *gen = NULL; par = NULL; gen = NULL; unur_reset_errno(); par = unur_unif_new(NULL); gen = unur_init(par); n_tests_failed += (compare_sequence_gen_start(TESTLOG,121,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_reset_errno(); unur_free(gen); gen = NULL; gen = unur_str2gen( "uniform & method = unif" ); n_tests_failed += (compare_sequence_gen(TESTLOG,125,gen,COMPARE_SAMPLE_SIZE)==UNUR_SUCCESS)?0:1; unur_free(gen); } /* timing */ stopwatch_print(TESTLOG,"\n<*>time = %.3f ms\n\n", stopwatch_lap(&watch)); /* test finished */ test_ok &= (n_tests_failed) ? 0 : 1; (n_tests_failed) ? printf(" ==> failed] ") : printf(" ==> ok] "); } /* end of test_sample() */ /*---------------------------------------------------------------------------*/ /* run generator in verifying mode */ void run_verify_generator( FILE *LOG, int line, UNUR_PAR *par ) { UNUR_GEN *gen; int i; /* switch to verifying mode */ unur_unif_set_verify(par,1); /* initialize generator */ gen = unur_init( par ); abort_if_NULL(LOG, line, gen); /* run generator */ for (i=0; itotal time = %.0f ms\n\n", stopwatch_stop(&watch)); fclose(UNURANLOG); fclose(TESTLOG); /* free memory */ compare_free_memory(); unur_urng_free(unur_get_default_urng()); unur_urng_free(unur_get_default_urng_aux()); /* exit */ exit( (test_ok) ? EXIT_SUCCESS : EXIT_FAILURE ); } /* end of main */ unuran-1.11.0/tests/t_empl.conf0000644001357500135600000001156314420445767013351 00000000000000############################################################################# [main] [main - data:] # method (for information only: the program scans the file name) method: EMPL [main - header:] /* prototypes */ \#define COMPARE_SAMPLE_SIZE (10000) \#define VIOLATE_SAMPLE_SIZE (20) /* sample size for Gaussian distributet sample */ \#define samplesize (5000) UNUR_DISTR *get_distr_with_data( void ); UNUR_DISTR *get_distr_with_Gaussian_data( void ); double urng_ed (void *dummy); ############################################################################# [new] [new - invalid NULL ptr: distr = NULL; ] ~( distr ); --> expected_NULL --> UNUR_ERR_NULL [new - invalid distribution type: distr = unur_distr_cont_new(); ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID [new - data missing in distribution object: distr = unur_distr_cemp_new(); /* no data given */ ] ~( distr ); --> expected_NULL --> UNUR_ERR_DISTR_REQUIRED ############################################################################# # [set] ############################################################################# # [get] ############################################################################# # [chg] ############################################################################# [init] [init - invalid NULL ptr: par = NULL; ] unur_init( par ); --> expected_NULL --> UNUR_ERR_NULL [init - run init: distr = get_distr_with_data(); par = unur_empl_new(distr); gen = unur_init( par ); <-- ! NULL ] # this should be o.k. --> none --> 0x0u ############################################################################# [reinit] [reinit - does not exist: distr = get_distr_with_data(); par = unur_empl_new(distr); gen = unur_init( par ); <-- ! NULL ] unur_reinit( gen ); --> expected_setfailed --> UNUR_ERR_NO_REINIT unur_sample_cont( gen ); --> expected_INFINITY --> UNUR_ERR_GEN_CONDITION ############################################################################# [sample] [sample - compare clone: UNUR_GEN *clone; distr = get_distr_with_data(); par = unur_empl_new(distr); gen = unur_init( par ); <-- ! NULL ] /* default generator object */ -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen #..................................................................... [sample - compare stringparser: double data[] = {1.,2.,3.,4.,5.,6.,7.,8.,9.}; distr = NULL; par = NULL; gen = NULL; ] distr = unur_distr_cemp_new(); unur_distr_cemp_set_data(distr,data,9); par = unur_empl_new(distr); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; gen = unur_str2gen( "cemp; data = (1.,2.,3.,4.,5.,6.,7.,8.,9.) & \ method = empl" ); -->compare_sequence_gen ############################################################################# [validate] [validate - generators:] # default par[0] = unur_empl_new(@distr@); [validate - distributions:] # approximate normal distribution distr[0] = get_distr_with_Gaussian_data(); [validate - test chi2:] # + ... pass test # 0 ... fail to initialize generator # - ... fail test # . ... do not run test # # ... comment # # generators: # [0] default # # [0] # distribution #---------------------------------------------------------------- <0> + # approximate normal distribution (sample size 200000) ############################################################################# ############################################################################# [verbatim] /*---------------------------------------------------------------------------*/ UNUR_DISTR *get_distr_with_data( void ) { \#define PV_SIZE 20 double pv[PV_SIZE]; UNUR_DISTR *distr; int i; for (i=0; i Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. unuran-1.11.0/autogen.sh0000754001357500135600000000354414420445767012060 00000000000000#! /bin/sh # Run this to generate all the initial makefiles, etc. # Constants srcdir=`dirname $0` test -z "$srcdir" && srcdir=. ORIGDIR=`pwd` cd $srcdir PROJECT=unuran TEST_TYPE=-f FILE=src/unuran_config.h # a file that should exist in the source dir export WANT_AUTOMAKE=1.16 # Check for required programs (libtoolize --version) < /dev/null > /dev/null 2>&1 || { echo echo "You must have libtool installed to compile $PROJECT." exit 1 } (autoheader --version) < /dev/null > /dev/null 2>&1 || { echo echo "You must have autoheader installed to compile $PROJECT." exit 1 } (autoconf --version) < /dev/null > /dev/null 2>&1 || { echo echo "You must have autoconf installed to compile $PROJECT." exit 1 } (automake --version) < /dev/null > /dev/null 2>&1 || { echo echo "You must have automake installed to compile $PROJECT." exit 1 } test $TEST_TYPE $FILE || { echo "You must run this script in the top-level $PROJECT directory" exit 1 } # Check for given command line arguments if test -z "$*"; then echo "I am going to run ./configure with no arguments - if you wish " echo "to pass any to it, please specify them on the $0 command line." echo fi # Set flags for special compilers case $CC in *xlc | *xlc\ * | *lcc | *lcc\ *) am_opt=--include-deps;; esac # Run autotools echo "Running libtoolize ..." libtoolize --automake echo; echo "Running aclocal ..." aclocal echo; echo "Running autoheader ..." autoheader --warnings=all echo; echo "Running automake ..." automake --warnings=all --add-missing $am_opt echo; echo "Running autoconf ..." autoconf --warnings=all echo # Change to original directory cd $ORIGDIR # Run ./configure script echo; echo "Running configure ..." $srcdir/configure --enable-maintainer-mode --enable-deprecated --enable-check-struct --enable-logging "$@" # End echo echo "Now type 'make' to compile $PROJECT." echo exit 0 unuran-1.11.0/THANKS0000644001357500135600000000070414420445767010766 00000000000000We thank the following people for their permissions to use some of their codes: Ernst Stadlober (Stadlober@stat.tu-graz.ac.at) ... WinRand library. Renee Touzin ... mrg31k3p.c (Combined multiple recursive generator) We thank the following people for submitting bug reports: Richard Russell Rene Brun and Lorenzo Moneta from the ROOT team at CERN We also thank Philipp Tomsich for valuable help concerning the C programming language. unuran-1.11.0/NEWS0000644001357500135600000004565214420445767010565 00000000000000 Version 1.11.0: April 2023 * Methods: - PINV: . Optionally improved estimate of u-error of the approximation at the expense of considerably higher setup time. This can be switched on by means of ... . new function unur_pinv_set_extra_testpoints() . Fixed issue with PDFs that almost vanish at the boundary of the domain Version 1.10.0: December 2022 * Distributions: - GIG: improved numerical accuracy of computation of mode * Internal: - Fixed some compiler warnings - Update configure script Version 1.9.0: March 2022 * Methods: - CSTD: print constants computed in init step into log file and info string. - PINV: . now also works for distributions with PDFs with constant part . internal: check pointer dPDF before using it. disabled internal rescaling of PDF. abort computation of area below PDF when an almost infinite loop occurs. do not immediately stop computation of relevant domain when INF or NaN occurs. - new function unur_get_method(): it returns the identifier for the generating method. these identifiers are declared in 'src/methods/unur_metthods.h'. - new function unur_gen_is_inversion(); returns TRUE if the generator object implements an inversion method. - get rid of confusing error message for method TABL when the the update function for the PDF area is not available. * Distributions: - beta: fixed a problem with CSTD special generator '2'. - added example 'example_reinit.c' Version 1.8.1: April 2011 - fixed linker flags for GSL (thanks to Carlos) Version 1.8.0: October 2010 * Methods: - DSTD: new function unur_dstd_chg_truncated() that allows to truncate the domain of generator object that implements the inversion method. - NORTA: use method PINV as first choice for generator of marginal distribution. - PINV: when no 'center' is provided by the user, or when the PDF vanishes for the given 'center' or is not finite, then the method tries to "guess" an appropriate point for the 'center'. new function unur_pinv_eval_approxcdf() for computing approximate CDF. This requires to keep the table of CDF values by means of call unur_pinv_set_keepcdf(). * Distributions: - DISCRete distribution objects: added slot 'invCDF' for inverse CDF. New functions . unur_distr_discr_set_invcdf() . unur_distr_discr_get_invcdf() . unur_distr_discr_eval_invcdf() - When configure flag '--with-Rmath' is used, then all special functions (like beta and gamma function) are now taken from Rmath library. - geometric distribution: fixed special random variate generator * Other: - Fixed errors detect by static analysis tools by the ROOT team at CERN (thanks to R. Brun and L. Moneta) Version 1.7.1: April 2010 * Methods: - PINV: fixed setup for smoothness parameters 1 and 2. It failed on x86 (32-bit) platforms. Version 1.7.0: April 2010 * Methods: - PINV: . estimation of computational domain is now more robust. . added experimental function unur_pinv_set_use_upoints(). . increased maximal order to 17 . added smoothness parameter, new function unur_pinv_set_smoothness(). Version 1.6.0: February 2010 * Methods: - new method MIXT (MIXTure of distributions) Version 1.5.1: November 2009 * fixed a minor problem with MS Visual Studio compiler Version 1.5.0: November 2009 * Methods: - NINV: changed evaluation of accuracy goal of algorithms. Now checking for the maximal tolerated x-error and maximal tolerated u-error can be set (or disabled) independently. [This slightly changes the generated pseudo-random sequence!] By default, the u-error remains unchecked. New variant: bisection method. This is a very slow method and should only be considered as a last resort. - NORTA: try method PINV for sampling from marginal distribution. * Distributions: - added new distributions: hyperbolic ... Hyperbolic distribution IG ... Inverse Gaussian distribution GIG ... Generalized Inverse Gaussian distribution lognormal ... Log-Normal distribution slash ... Slash distribution * Tests: - unur_test_inverror() has been renamed to unur_test_u_error(). - new test function unur_test_timing_R() for (hopefully) more robust timing results. * configure: - New exprimental configure flag '--with-Rmath': enables usage of the Rmath stand alone library from the R project for statistical computing. This makes some special functions (in particular Bessel functions) available for PDFs and CDFs of some distributions (e.g. GIG). Version 1.4.1: August 2009 * Methods: - PINV: fixed bug that occured when SunStudio compiler with flag -xO5 was used (initialization failed). Version 1.4.0: June 2009 * Methods: - unur_quantile() now also supports CSTD with inversion and DGT (for discrete distribution). - CSTD: generic inversion method for continuous distribution provided that the inverse CDF is implemented in distribution object. - PINV: slightly fewer PDF evaluations during setup * Distributions: - CONT (continuous univariate distribution): support for inverse CDF: unur_distr_cont_set_invcdf() unur_distr_cont_get_invcdf() unur_distr_cont_eval_invcdf() - unur_distr_cont_set_domain() now takes care of given center set by a unur_distr_cont_set_center() call. Version 1.3.1: January 2009 * Methods: - AROU: fixed problems with round-off errors when computing tangents. Version 1.3.0: November 2008 * Methods: - new method PINV (Polynomial interpolation based INVersion of CDF). - new function unur_quantile() that (approximately) computes the quantile for a continuous distribution. It requires a generator object that implements an inversion method. - HINV: fixed segfault when calling unur_hinv_eval_approxinvcdf with u-value very close too 1. However, now when the domain has been truncated then this function evaluates the inverse CDF of the truncated distribution. Version 1.2.4: April 2008 * Methods: - GIBBS: fixed possible infinite loops. - HINV: fixed round-off error that occured for truncated distributions when compiled with 'gcc-4.3 -O2' on some plattforms. Version 1.2.3: April 2008 * Function parser: - moved (hidden) routines for code generator into external library. Version 1.2.2: April 2008 * Methods: - AROU: run DARS by default (as stated in the manual) - ARS: new method unur_ars_set_max_iter(): Sets maximum number of iterations of rejection loop. The loops aborts then and UNUR_INFINITY is returned. Thus (almost) infinite loops are prevented when invalid PDFs are given but not detected during setup. - GIBBS: fixed rare problem with infinite loops (see ARS) - HRB and HRI: fixed possible infinite loop with invalid hazad rates. * Uniform random number generators: - unur_urng_prng_new() now supports 'unur_urng_seed'. Version 1.2.0: February 2008 * Methods: - New call unur_gen_info() for creating info strings in interactive programming environments. This feature is controlled by the '--enable-info' configure flag. - Renamed method TDRGW to ARS (avoid confusion with TDR) old functions available as macros. not available for string API. - DARI now checks for distributions with negative domains. * Inststallation: - 'make check' now runs only a restricted set of tests. For additional tests run 'make fullcheck'. (These might fail occasionally when randomly chosen distribution parameter are too extreme). Version 1.1.0: December 2007 * Methods: - New method MVTDR * Distributions: - CONT (continuous univariate distribution): logarithm of CDF can be provided by user. Version 1.0.1: May 2007 * Methods: - HINV: . fixed problem with missing PDF. . better support for heavy-tailed distributions. . change default of u-resolution from 1.e-8 to 1.e-10. * Distributions: - CONT (continuous univariate distribution): compute PDF and dPDF when the CDF is set by a unur_distr_cont_set_cdfstr() call. Version 1.0.0: April 2007 * Methods: - New method HIST for sampling from histograms. - New method CEXT, DEXT, and MVSTD: wrapper for external generators for univariate contiuous, discrete, and multivariate continuous distributions, resp. - HINV: fixed problem with truncated domains. - DARI: check for positive domain. - VMT is now deprecated. Its only usefull application is sampling from a multinormal distribution. Use new method MVSTD for this purpose instead. * Distributions: - Standard distributions: added F-distribution. - CEMP (empirical distributions): added histogram. - CVEC (Continuous multivariate distributions): . Added support for rectangular domains: unur_distr_cvec_set_domain_rect() . Using standardized marginal distributions is now deprecated: unur_distr_cvec_set_stdmarginals() unur_distr_cvec_set_stdmarginal_array() unur_distr_cvec_set_stdmarginal_list() unur_distr_cvec_get_stdmarginal() * Uniform random number generators: - unur_urng_fvoid_new() has been changed: first argument must be pointer to function of prototype double (*random)(void *state) * Miscellaneous: - Protoype of unur_run_tests() has changed: it uses the output stream as additional argument - The UNU.RAN error handler has been been changed: unur_set_error_handler_off() allows to switch off error messages and warnings. unur_set_error_handler() allows to replace the default error handler (i.e. print a short message into a logfile) by a customized one. On the other hand it is not possible any more to suppress error messages by a compiler switch. - More flags for the ./configure script. - The size of file 'src/unuran_config.h' has been removed: Some of the macros are either deleted at all or moved into the file 'config.h' which is created/controlled by ./configure script. - Script for creating MS Windows(R) DLL using MS Visual Studio 2005: ./scripts/win32/build.sh Version 0.9.0: January 2007 * This is a pre-1.0 release. * Deprecated Routines: Deprecated routines (see release notes to Version 0.8.1 below) are now disabled by default. They are still available but must be enable at using ./configure --enable-deprecated Notice: Deprecated routines are not tested any more and their usage is strongly discouraged. * Wrapper functions for external sources of uniform random numbers are now enabled by configure flags and not by macros defined in file 'src/unuran_config.h'. * The file 'src/unuran_config.h' is not installed any more. It is now only included when the library is compiled. It should be removed from the global include path of the compiler. * Some bugs have been fixed. Version 0.8.1: November 2006 * Methods: - new method ITDR (Inverse Transformed Density Rejection) for distributions with monotone unbounded densities. - Implemented new routine unur_reinit() for reinitializing existing generator object. This can be done by extracting the underlying distribution object by a unur_get_distr(), modify it and reinitialize the generator by running unur_reinit(). - More methods support reinitialization now. * String API: - New functions unur_makegen_ssu() and unur_makegen_dsu() to allow disribution object, generation method and uniform random number generator as separate arguments. - The keyword "urng" is deprecated now and will be removed in the next release. * Distributions: - DISCR: now unur_distr_discr_set_pmf() and unur_distr_discr_set_cdf() can be used after a unur_distr_discr_set_pv() call. However, the probability vector is then removed. - added unur_distr_set_extobj() / unur_distr_get_extobj(): Store pointer to external object that can be passed to PDF, CDF, PMF or similar functions * Deprecated calls: The API for UNU.RAN has been modified. ow there exists a general unur_reinit() call that replaces such a call for particular methods. Thus the following calls are now deprecated and will be removed in the next release: unur_dari_reinit() unur_dsrou_reinit() unur_srou_reinit() unur_ssr_reinit() unur_utdr_reinit() unur_tdr_reinit() unur_tdrgw_reinit() To avoid lots of calls for changing the parameters or domains of the underlying distribution the prefered method now is to extract the distribution object from the generator object, use the corresponding calls for distributions to change it, and run unur_reinit(). Thus the following calls are now deprecated and will be removed in the next release: . unur_cstd_chg_pdfparams(), . unur_dari_chg_pmfparams(), unur_dari_chg_domain(), unur_dari_chg_mode(), unur_dari_upd_mode(), unur_dari_chg_pmfsum(), unur_dari_upd_pmfsum(), and . unur_dsrou_chg_pmfparams(), unur_dsrou_chg_domain(), unur_dsrou_chg_mode(), unur_dsrou_upd_mode(), unur_dsrou_chg_pmfsum(), unur_dsrou_upd_pmfsum(), and . unur_dstd_chg_pmfparams(), . unur_ninv_chg_pmfparams(), . unur_srou_chg_pdfparams(), unur_srou_chg_domain(), unur_srou_chg_mode(), unur_srou_upd_mode(), unur_srou_chg_pdfarea(), unur_srou_upd_pdfarea() . unur_ssr_chg_pdfparams(), unur_ssr_chg_domain(), unur_ssr_chg_mode(), unur_ssr_upd_mode(), unur_ssr_chg_pdfarea(), unur_ssr_upd_pdfarea() . unur_utdr_chg_pdfparams(), unur_utdr_chg_domain(), unur_utdr_chg_mode(), unur_utdr_upd_mode(), unur_utdr_chg_pdfarea(), unur_utdr_upd_pdfarea() Other calls: . removed unur_arou_set_center() as this functionality is already covered by the unur_distr_cont_set_center() call. . removed unur_tdr_set_center() as this functionality is already covered by the unur_distr_cont_set_center() call. * Bug fixes: - fixed segfault when calling unur_urng_free() with RngStreams object. Version 0.7.2: March 2006 - fixed function prototype that contained C++ keyword Version 0.7.1: January 2006 - fixed non-ASCII C compliant code in tests directory Version 0.7.0: January 2006 * Methods: - new method TDRGW (robust variant of TDR - variant of Gilks & Wild) - new method NORTA (NORmal To Anything) - new method HITROU - new method GIBBS - method TDR: added reinit routine - method TABL: construction points can be set by new function unur_tdr_set_cpoints(). It also replaces function unur_tabl_set_nstp() which should not be used any more (but is still available for compatibility). - method MCORR: extended to cover generation of random correlation matrices with given eigenvalues. * Distributions: - added new distribution type for full conditional distributions - continuous distribution objects (CONT) have a slot for the center of the distribution. It is now set for the distribution directly. This mechanism replaces the _set_ calls for all methods that make use of the center. - interface for setting and getting parameter-arrays for multivariate distributions (CVEC) has been renamed. - adding multivariate Cauchy and Student distributions. * Uniform random number generator: - new flexible interface to uniform random number generators. No compiler switches necessary. Thus it is now possible to use random numbers from different libraries without recompiling UNU.RAN. - The generic interface to uniform random number generators has been enhanced. However, it cannot be accessed directly any more. Use the corresponding calls instead (see also the message above). Version 0.6.0: June 2005 - precompiled version for Windows Version 0.5.0: August 2004 - UNU.RAN now makes use of IEEE 754 compliant floating point arithmetic. In particular, 1./0. and 0./0. must result in infinity and NaN (not a number), respectively, and must not cause a floating point exception. For all modern compting architecture this is implemented in hardware or in software using a special compiler flag. - new methods NROU and VNROU - new method MCORR - return codes of _set_ and _get_ functions have been changed: in case of successful execution 0 (or UNUR_SUCCESS) is returned (instead of 1 in previous versions). Thus it is possible to return some non-zero error code in case of an failure. - the API of method VMT has changed - added new disribution type MATR for matrix distributions. (Currently only used for creating random covariance matrices) - multivariate distribution objects now contain marginal distributions. - unur_distr_cvec_set_covar() now checks for positive definiteness of given covariance matrix. - fixed bug in function that (automatically) computes a probability vector by means of the probability mass function. This caused methods that require explicitly given probability vectors (like DAU) to truncate the last entry. - some other minor bug fixes Version 0.4.5: July 2003 - added method DSS (discrete sequential search) - added rerandomized ARS to method AROU - bug fixes with discrete distributions Version 0.4.4: July 2003 - "orderstatistics" need not be last entry in string API - replaced unur_tabl_set_variant_setup() by unur_tabl_set_usedars() with a slightly different interface. Version 0.4.3: June 2003 - fixed problem with prepocessor for MacOS X - fixed bug in Kinderman-Ramage Gaussian variate generator Version 0.4.2: March 2003 - new interface for unur_tdr_eval_invcdfhat() - fixed bug in error handling of method AROU Version 0.4.1: January 2003 - use build-in generator as default uniform random number generator - string API: fixed bug with string 'inf' in cygwin. parsing of numbers does not depend on locale any more - fixed bug in Makefile Version 0.4.0: January 2003 - added methods HRB, HRD, and HRI for distributions with given hazard rates (bounded, decreasing, and increasing, resp.) - added method EMPL (empirical CDF with linear interpolation) (for sake of completeness; method not recommended) - support for shared libraries - reorganization of source tree - bug fixes Version 0.3.0: October 2002 - added method HINV (Hermite interpolation based INVersion of CDF) - new interface for using uniform random number generators; all settings are now in ./src/unuran_config.h - added support for more uniform random number generator packages - included better build-in uniform pseudo-random number generator - added unur_gen_clone() call - added const qualifier in function prototypes where appropriate - fixed broken computation of window width in method EMPK - many bug fixes Version 0.2.0: June 2002 - added new simple API (String interface) - added method AUTO (automatic) - added method DSROU (discrete simple ratio of uniforms) - improved method for finding construction points in methods TDR and AROU (Derandomized adaptive rejection sampling) - many bug fixes Version 0.1.0: March 2001 - First public release. unuran-1.11.0/aclocal.m40000644001357500135600000133657314430713357011726 00000000000000# generated automatically by aclocal 1.16.5 -*- Autoconf -*- # Copyright (C) 1996-2021 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],, [m4_warning([this file was generated for autoconf 2.71. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # # Copyright (C) 1996-2001, 2003-2019, 2021-2022 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. m4_define([_LT_COPYING], [dnl # Copyright (C) 2014 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program or library that is built # using GNU Libtool, you may include this file under the same # distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . ]) # serial 59 LT_INIT # LT_PREREQ(VERSION) # ------------------ # Complain and exit if this libtool version is less that VERSION. m4_defun([LT_PREREQ], [m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, [m4_default([$3], [m4_fatal([Libtool version $1 or higher is required], 63)])], [$2])]) # _LT_CHECK_BUILDDIR # ------------------ # Complain if the absolute build directory name contains unusual characters m4_defun([_LT_CHECK_BUILDDIR], [case `pwd` in *\ * | *\ *) AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; esac ]) # LT_INIT([OPTIONS]) # ------------------ AC_DEFUN([LT_INIT], [AC_PREREQ([2.62])dnl We use AC_PATH_PROGS_FEATURE_CHECK AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl AC_BEFORE([$0], [LT_LANG])dnl AC_BEFORE([$0], [LT_OUTPUT])dnl AC_BEFORE([$0], [LTDL_INIT])dnl m4_require([_LT_CHECK_BUILDDIR])dnl dnl Autoconf doesn't catch unexpanded LT_ macros by default: m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 dnl unless we require an AC_DEFUNed macro: AC_REQUIRE([LTOPTIONS_VERSION])dnl AC_REQUIRE([LTSUGAR_VERSION])dnl AC_REQUIRE([LTVERSION_VERSION])dnl AC_REQUIRE([LTOBSOLETE_VERSION])dnl m4_require([_LT_PROG_LTMAIN])dnl _LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) # This can be used to rebuild libtool when needed LIBTOOL_DEPS=$ltmain # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl _LT_SETUP # Only expand once: m4_define([LT_INIT]) ])# LT_INIT # Old names: AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PROG_LIBTOOL], []) dnl AC_DEFUN([AM_PROG_LIBTOOL], []) # _LT_PREPARE_CC_BASENAME # ----------------------- m4_defun([_LT_PREPARE_CC_BASENAME], [ # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in @S|@*""; do case $cc_temp in compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } ])# _LT_PREPARE_CC_BASENAME # _LT_CC_BASENAME(CC) # ------------------- # It would be clearer to call AC_REQUIREs from _LT_PREPARE_CC_BASENAME, # but that macro is also expanded into generated libtool script, which # arranges for $SED and $ECHO to be set by different means. m4_defun([_LT_CC_BASENAME], [m4_require([_LT_PREPARE_CC_BASENAME])dnl AC_REQUIRE([_LT_DECL_SED])dnl AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl func_cc_basename $1 cc_basename=$func_cc_basename_result ]) # _LT_FILEUTILS_DEFAULTS # ---------------------- # It is okay to use these file commands and assume they have been set # sensibly after 'm4_require([_LT_FILEUTILS_DEFAULTS])'. m4_defun([_LT_FILEUTILS_DEFAULTS], [: ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} ])# _LT_FILEUTILS_DEFAULTS # _LT_SETUP # --------- m4_defun([_LT_SETUP], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl _LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl dnl _LT_DECL([], [host_alias], [0], [The host system])dnl _LT_DECL([], [host], [0])dnl _LT_DECL([], [host_os], [0])dnl dnl _LT_DECL([], [build_alias], [0], [The build system])dnl _LT_DECL([], [build], [0])dnl _LT_DECL([], [build_os], [0])dnl dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl dnl AC_REQUIRE([AC_PROG_LN_S])dnl test -z "$LN_S" && LN_S="ln -s" _LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl dnl AC_REQUIRE([LT_CMD_MAX_LEN])dnl _LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl m4_require([_LT_CMD_RELOAD])dnl m4_require([_LT_DECL_FILECMD])dnl m4_require([_LT_CHECK_MAGIC_METHOD])dnl m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_WITH_SYSROOT])dnl m4_require([_LT_CMD_TRUNCATE])dnl _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi ]) if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi _LT_CHECK_OBJDIR m4_require([_LT_TAG_COMPILER])dnl case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a '.a' archive for static linking (except MSVC and # ICC, which need '.lib'). libext=a with_gnu_ld=$lt_cv_prog_gnu_ld old_CC=$CC old_CFLAGS=$CFLAGS # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o _LT_CC_BASENAME([$compiler]) # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then _LT_PATH_MAGIC fi ;; esac # Use C for the default configuration in the libtool script LT_SUPPORTED_TAG([CC]) _LT_LANG_C_CONFIG _LT_LANG_DEFAULT_CONFIG _LT_CONFIG_COMMANDS ])# _LT_SETUP # _LT_PREPARE_SED_QUOTE_VARS # -------------------------- # Define a few sed substitution that help us do robust quoting. m4_defun([_LT_PREPARE_SED_QUOTE_VARS], [# Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([["`\\]]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ]) # _LT_PROG_LTMAIN # --------------- # Note that this code is called both from 'configure', and 'config.status' # now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, # 'config.status' has no value for ac_aux_dir unless we are using Automake, # so we pass a copy along to make sure it has a sensible value anyway. m4_defun([_LT_PROG_LTMAIN], [m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl _LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) ltmain=$ac_aux_dir/ltmain.sh ])# _LT_PROG_LTMAIN # So that we can recreate a full libtool script including additional # tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS # in macros and then make a single call at the end using the 'libtool' # label. # _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) # ---------------------------------------- # Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL_INIT], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_INIT], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_INIT]) # _LT_CONFIG_LIBTOOL([COMMANDS]) # ------------------------------ # Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) # _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) # ----------------------------------------------------- m4_defun([_LT_CONFIG_SAVE_COMMANDS], [_LT_CONFIG_LIBTOOL([$1]) _LT_CONFIG_LIBTOOL_INIT([$2]) ]) # _LT_FORMAT_COMMENT([COMMENT]) # ----------------------------- # Add leading comment marks to the start of each line, and a trailing # full-stop to the whole comment if one is not present already. m4_define([_LT_FORMAT_COMMENT], [m4_ifval([$1], [ m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) )]) # _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) # ------------------------------------------------------------------- # CONFIGNAME is the name given to the value in the libtool script. # VARNAME is the (base) name used in the configure script. # VALUE may be 0, 1 or 2 for a computed quote escaped value based on # VARNAME. Any other value will be used directly. m4_define([_LT_DECL], [lt_if_append_uniq([lt_decl_varnames], [$2], [, ], [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], [m4_ifval([$1], [$1], [$2])]) lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) m4_ifval([$4], [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) lt_dict_add_subkey([lt_decl_dict], [$2], [tagged?], [m4_ifval([$5], [yes], [no])])]) ]) # _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) # -------------------------------------------------------- m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) # lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_tag_varnames], [_lt_decl_filter([tagged?], [yes], $@)]) # _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) # --------------------------------------------------------- m4_define([_lt_decl_filter], [m4_case([$#], [0], [m4_fatal([$0: too few arguments: $#])], [1], [m4_fatal([$0: too few arguments: $#: $1])], [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], [lt_dict_filter([lt_decl_dict], $@)])[]dnl ]) # lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) # -------------------------------------------------- m4_define([lt_decl_quote_varnames], [_lt_decl_filter([value], [1], $@)]) # lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_dquote_varnames], [_lt_decl_filter([value], [2], $@)]) # lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_varnames_tagged], [m4_assert([$# <= 2])dnl _$0(m4_quote(m4_default([$1], [[, ]])), m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) m4_define([_lt_decl_varnames_tagged], [m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) # lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_all_varnames], [_$0(m4_quote(m4_default([$1], [[, ]])), m4_if([$2], [], m4_quote(lt_decl_varnames), m4_quote(m4_shift($@))))[]dnl ]) m4_define([_lt_decl_all_varnames], [lt_join($@, lt_decl_varnames_tagged([$1], lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl ]) # _LT_CONFIG_STATUS_DECLARE([VARNAME]) # ------------------------------------ # Quote a variable value, and forward it to 'config.status' so that its # declaration there will have the same value as in 'configure'. VARNAME # must have a single quote delimited value for this to work. m4_define([_LT_CONFIG_STATUS_DECLARE], [$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) # _LT_CONFIG_STATUS_DECLARATIONS # ------------------------------ # We delimit libtool config variables with single quotes, so when # we write them to config.status, we have to be sure to quote all # embedded single quotes properly. In configure, this macro expands # each variable declared with _LT_DECL (and _LT_TAGDECL) into: # # ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAGS # ---------------- # Output comment and list of tags supported by the script m4_defun([_LT_LIBTOOL_TAGS], [_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl available_tags='_LT_TAGS'dnl ]) # _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) # ----------------------------------- # Extract the dictionary values for VARNAME (optionally with TAG) and # expand to a commented shell variable setting: # # # Some comment about what VAR is for. # visible_name=$lt_internal_name m4_define([_LT_LIBTOOL_DECLARE], [_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [description])))[]dnl m4_pushdef([_libtool_name], m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), [0], [_libtool_name=[$]$1], [1], [_libtool_name=$lt_[]$1], [2], [_libtool_name=$lt_[]$1], [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl ]) # _LT_LIBTOOL_CONFIG_VARS # ----------------------- # Produce commented declarations of non-tagged libtool config variables # suitable for insertion in the LIBTOOL CONFIG section of the 'libtool' # script. Tagged libtool config variables (even for the LIBTOOL CONFIG # section) are produced by _LT_LIBTOOL_TAG_VARS. m4_defun([_LT_LIBTOOL_CONFIG_VARS], [m4_foreach([_lt_var], m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAG_VARS(TAG) # ------------------------- m4_define([_LT_LIBTOOL_TAG_VARS], [m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) # _LT_TAGVAR(VARNAME, [TAGNAME]) # ------------------------------ m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) # _LT_CONFIG_COMMANDS # ------------------- # Send accumulated output to $CONFIG_STATUS. Thanks to the lists of # variables for single and double quote escaping we saved from calls # to _LT_DECL, we can put quote escaped variables declarations # into 'config.status', and then the shell code to quote escape them in # for loops in 'config.status'. Finally, any additional code accumulated # from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. m4_defun([_LT_CONFIG_COMMANDS], [AC_PROVIDE_IFELSE([LT_OUTPUT], dnl If the libtool generation code has been placed in $CONFIG_LT, dnl instead of duplicating it all over again into config.status, dnl then we will have config.status run $CONFIG_LT later, so it dnl needs to know what name is stored there: [AC_CONFIG_COMMANDS([libtool], [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], dnl If the libtool generation code is destined for config.status, dnl expand the accumulated commands and init code now: [AC_CONFIG_COMMANDS([libtool], [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) ])#_LT_CONFIG_COMMANDS # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], [ # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' _LT_CONFIG_STATUS_DECLARATIONS LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$[]1 _LTECHO_EOF' } # Quote evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_quote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_dquote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done _LT_OUTPUT_LIBTOOL_INIT ]) # _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) # ------------------------------------ # Generate a child script FILE with all initialization necessary to # reuse the environment learned by the parent script, and make the # file executable. If COMMENT is supplied, it is inserted after the # '#!' sequence but before initialization text begins. After this # macro, additional text can be appended to FILE to form the body of # the child script. The macro ends with non-zero status if the # file could not be fully written (such as if the disk is full). m4_ifdef([AS_INIT_GENERATED], [m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], [m4_defun([_LT_GENERATED_FILE_INIT], [m4_require([AS_PREPARE])]dnl [m4_pushdef([AS_MESSAGE_LOG_FD])]dnl [lt_write_fail=0 cat >$1 <<_ASEOF || lt_write_fail=1 #! $SHELL # Generated by $as_me. $2 SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$1 <<\_ASEOF || lt_write_fail=1 AS_SHELL_SANITIZE _AS_PREPARE exec AS_MESSAGE_FD>&1 _ASEOF test 0 = "$lt_write_fail" && chmod +x $1[]dnl m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT # LT_OUTPUT # --------- # This macro allows early generation of the libtool script (before # AC_OUTPUT is called), incase it is used in configure for compilation # tests. AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} AC_MSG_NOTICE([creating $CONFIG_LT]) _LT_GENERATED_FILE_INIT(["$CONFIG_LT"], [# Run this file to recreate a libtool stub with the current configuration.]) cat >>"$CONFIG_LT" <<\_LTEOF lt_cl_silent=false exec AS_MESSAGE_LOG_FD>>config.log { echo AS_BOX([Running $as_me.]) } >&AS_MESSAGE_LOG_FD lt_cl_help="\ '$as_me' creates a local libtool stub from the current configuration, for use in further configure time tests before the real libtool is generated. Usage: $[0] [[OPTIONS]] -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files Report bugs to ." lt_cl_version="\ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. Copyright (C) 2011 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation gives unlimited permision to copy, distribute and modify it." while test 0 != $[#] do case $[1] in --version | --v* | -V ) echo "$lt_cl_version"; exit 0 ;; --help | --h* | -h ) echo "$lt_cl_help"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --quiet | --q* | --silent | --s* | -q ) lt_cl_silent=: ;; -*) AC_MSG_ERROR([unrecognized option: $[1] Try '$[0] --help' for more information.]) ;; *) AC_MSG_ERROR([unrecognized argument: $[1] Try '$[0] --help' for more information.]) ;; esac shift done if $lt_cl_silent; then exec AS_MESSAGE_FD>/dev/null fi _LTEOF cat >>"$CONFIG_LT" <<_LTEOF _LT_OUTPUT_LIBTOOL_COMMANDS_INIT _LTEOF cat >>"$CONFIG_LT" <<\_LTEOF AC_MSG_NOTICE([creating $ofile]) _LT_OUTPUT_LIBTOOL_COMMANDS AS_EXIT(0) _LTEOF chmod +x "$CONFIG_LT" # configure is writing to config.log, but config.lt does its own redirection, # appending to config.log, which fails on DOS, as config.log is still kept # open by configure. Here we exec the FD to /dev/null, effectively closing # config.log, so it can be properly (re)opened and appended to by config.lt. lt_cl_success=: test yes = "$silent" && lt_config_lt_args="$lt_config_lt_args --quiet" exec AS_MESSAGE_LOG_FD>/dev/null $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false exec AS_MESSAGE_LOG_FD>>config.log $lt_cl_success || AS_EXIT(1) ])# LT_OUTPUT # _LT_CONFIG(TAG) # --------------- # If TAG is the built-in tag, create an initial libtool script with a # default configuration from the untagged config vars. Otherwise add code # to config.status for appending the configuration named by TAG from the # matching tagged config vars. m4_defun([_LT_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_CONFIG_SAVE_COMMANDS([ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl m4_if(_LT_TAG, [C], [ # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi cfgfile=${ofile}T trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # Generated automatically by $as_me ($PACKAGE) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # Provide generalized library-building support services. # Written by Gordon Matzigkeit, 1996 _LT_COPYING _LT_LIBTOOL_TAGS # Configured defaults for sys_lib_dlsearch_path munging. : \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} # ### BEGIN LIBTOOL CONFIG _LT_LIBTOOL_CONFIG_VARS _LT_LIBTOOL_TAG_VARS # ### END LIBTOOL CONFIG _LT_EOF cat <<'_LT_EOF' >> "$cfgfile" # ### BEGIN FUNCTIONS SHARED WITH CONFIGURE _LT_PREPARE_MUNGE_PATH_LIST _LT_PREPARE_CC_BASENAME # ### END FUNCTIONS SHARED WITH CONFIGURE _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac _LT_PROG_LTMAIN # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? $SED '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], [cat <<_LT_EOF >> "$ofile" dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded dnl in a comment (ie after a #). # ### BEGIN LIBTOOL TAG CONFIG: $1 _LT_LIBTOOL_TAG_VARS(_LT_TAG) # ### END LIBTOOL TAG CONFIG: $1 _LT_EOF ])dnl /m4_if ], [m4_if([$1], [], [ PACKAGE='$PACKAGE' VERSION='$VERSION' RM='$RM' ofile='$ofile'], []) ])dnl /_LT_CONFIG_SAVE_COMMANDS ])# _LT_CONFIG # LT_SUPPORTED_TAG(TAG) # --------------------- # Trace this macro to discover what tags are supported by the libtool # --tag option, using: # autoconf --trace 'LT_SUPPORTED_TAG:$1' AC_DEFUN([LT_SUPPORTED_TAG], []) # C support is built-in for now m4_define([_LT_LANG_C_enabled], []) m4_define([_LT_TAGS], []) # LT_LANG(LANG) # ------------- # Enable libtool support for the given language if not already enabled. AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl m4_case([$1], [C], [_LT_LANG(C)], [C++], [_LT_LANG(CXX)], [Go], [_LT_LANG(GO)], [Java], [_LT_LANG(GCJ)], [Fortran 77], [_LT_LANG(F77)], [Fortran], [_LT_LANG(FC)], [Windows Resource], [_LT_LANG(RC)], [m4_ifdef([_LT_LANG_]$1[_CONFIG], [_LT_LANG($1)], [m4_fatal([$0: unsupported language: "$1"])])])dnl ])# LT_LANG # _LT_LANG(LANGNAME) # ------------------ m4_defun([_LT_LANG], [m4_ifdef([_LT_LANG_]$1[_enabled], [], [LT_SUPPORTED_TAG([$1])dnl m4_append([_LT_TAGS], [$1 ])dnl m4_define([_LT_LANG_]$1[_enabled], [])dnl _LT_LANG_$1_CONFIG($1)])dnl ])# _LT_LANG m4_ifndef([AC_PROG_GO], [ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_GO. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # m4_defun([AC_PROG_GO], [AC_LANG_PUSH(Go)dnl AC_ARG_VAR([GOC], [Go compiler command])dnl AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl _AC_ARG_VAR_LDFLAGS()dnl AC_CHECK_TOOL(GOC, gccgo) if test -z "$GOC"; then if test -n "$ac_tool_prefix"; then AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) fi fi if test -z "$GOC"; then AC_CHECK_PROG(GOC, gccgo, gccgo, false) fi ])#m4_defun ])#m4_ifndef # _LT_LANG_DEFAULT_CONFIG # ----------------------- m4_defun([_LT_LANG_DEFAULT_CONFIG], [AC_PROVIDE_IFELSE([AC_PROG_CXX], [LT_LANG(CXX)], [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) AC_PROVIDE_IFELSE([AC_PROG_F77], [LT_LANG(F77)], [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) AC_PROVIDE_IFELSE([AC_PROG_FC], [LT_LANG(FC)], [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal dnl pulling things in needlessly. AC_PROVIDE_IFELSE([AC_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([LT_PROG_GCJ], [LT_LANG(GCJ)], [m4_ifdef([AC_PROG_GCJ], [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([A][M_PROG_GCJ], [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([LT_PROG_GCJ], [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) AC_PROVIDE_IFELSE([AC_PROG_GO], [LT_LANG(GO)], [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) AC_PROVIDE_IFELSE([LT_PROG_RC], [LT_LANG(RC)], [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) ])# _LT_LANG_DEFAULT_CONFIG # Obsolete macros: AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_CXX], []) dnl AC_DEFUN([AC_LIBTOOL_F77], []) dnl AC_DEFUN([AC_LIBTOOL_FC], []) dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) dnl AC_DEFUN([AC_LIBTOOL_RC], []) # _LT_TAG_COMPILER # ---------------- m4_defun([_LT_TAG_COMPILER], [AC_REQUIRE([AC_PROG_CC])dnl _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl _LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC ])# _LT_TAG_COMPILER # _LT_COMPILER_BOILERPLATE # ------------------------ # Check for compiler boilerplate output or warnings with # the simple compiler test code. m4_defun([_LT_COMPILER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ])# _LT_COMPILER_BOILERPLATE # _LT_LINKER_BOILERPLATE # ---------------------- # Check for linker boilerplate output or warnings with # the simple link test code. m4_defun([_LT_LINKER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ])# _LT_LINKER_BOILERPLATE # _LT_REQUIRED_DARWIN_CHECKS # ------------------------- m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ case $host_os in rhapsody* | darwin*) AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) AC_CHECK_TOOL([LIPO], [lipo], [:]) AC_CHECK_TOOL([OTOOL], [otool], [:]) AC_CHECK_TOOL([OTOOL64], [otool64], [:]) _LT_DECL([], [DSYMUTIL], [1], [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) _LT_DECL([], [NMEDIT], [1], [Tool to change global to local symbols on Mac OS X]) _LT_DECL([], [LIPO], [1], [Tool to manipulate fat objects and archives on Mac OS X]) _LT_DECL([], [OTOOL], [1], [ldd/readelf like tool for Mach-O binaries on Mac OS X]) _LT_DECL([], [OTOOL64], [1], [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], [lt_cv_apple_cc_single_mod=no if test -z "$LT_MULTI_MODULE"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test 0 = "$_lt_result"; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -rf libconftest.dylib* rm -f conftest.* fi]) AC_CACHE_CHECK([for -exported_symbols_list linker flag], [lt_cv_ld_exported_symbols_list], [lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [lt_cv_ld_exported_symbols_list=yes], [lt_cv_ld_exported_symbols_list=no]) LDFLAGS=$save_LDFLAGS ]) AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], [lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD echo "$AR $AR_FLAGS libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD $AR $AR_FLAGS libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then lt_cv_ld_force_load=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM ]) case $host_os in rhapsody* | darwin1.[[012]]) _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; darwin*) case $MACOSX_DEPLOYMENT_TARGET,$host in 10.[[012]],*|,*powerpc*-darwin[[5-8]]*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; *) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test yes = "$lt_cv_apple_cc_single_mod"; then _lt_dar_single_mod='$single_module' fi if test yes = "$lt_cv_ld_exported_symbols_list"; then _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' fi if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ]) # _LT_DARWIN_LINKER_FEATURES([TAG]) # --------------------------------- # Checks for linker and compiler features on darwin m4_defun([_LT_DARWIN_LINKER_FEATURES], [ m4_require([_LT_REQUIRED_DARWIN_CHECKS]) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported if test yes = "$lt_cv_ld_force_load"; then _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) else _LT_TAGVAR(whole_archive_flag_spec, $1)='' fi _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=$_lt_dar_allow_undefined case $cc_basename in ifort*|nagfor*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test yes = "$_lt_dar_can_shared"; then output_verbose_link_cmd=func_echo_all _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" _LT_TAGVAR(archive_expsym_cmds, $1)="$SED 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" _LT_TAGVAR(module_expsym_cmds, $1)="$SED -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" m4_if([$1], [CXX], [ if test yes != "$lt_cv_apple_cc_single_mod"; then _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil" _LT_TAGVAR(archive_expsym_cmds, $1)="$SED 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil" fi ],[]) else _LT_TAGVAR(ld_shlibs, $1)=no fi ]) # _LT_SYS_MODULE_PATH_AIX([TAGNAME]) # ---------------------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. # Store the results from the different compilers for each TAGNAME. # Allow to override them for all tags through lt_cv_aix_libpath. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ lt_aix_libpath_sed='[ /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }]' _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi],[]) if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=/usr/lib:/lib fi ]) aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) fi ])# _LT_SYS_MODULE_PATH_AIX # _LT_SHELL_INIT(ARG) # ------------------- m4_define([_LT_SHELL_INIT], [m4_divert_text([M4SH-INIT], [$1 ])])# _LT_SHELL_INIT # _LT_PROG_ECHO_BACKSLASH # ----------------------- # Find how we can fake an echo command that does not interpret backslash. # In particular, with Autoconf 2.60 or later we add some code to the start # of the generated configure script that will find a shell with a builtin # printf (that we can use as an echo command). m4_defun([_LT_PROG_ECHO_BACKSLASH], [ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO AC_MSG_CHECKING([how to print strings]) # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $[]1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } case $ECHO in printf*) AC_MSG_RESULT([printf]) ;; print*) AC_MSG_RESULT([print -r]) ;; *) AC_MSG_RESULT([cat]) ;; esac m4_ifdef([_AS_DETECT_SUGGESTED], [_AS_DETECT_SUGGESTED([ test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test "X`printf %s $ECHO`" = "X$ECHO" \ || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) ])# _LT_PROG_ECHO_BACKSLASH # _LT_WITH_SYSROOT # ---------------- AC_DEFUN([_LT_WITH_SYSROOT], [m4_require([_LT_DECL_SED])dnl AC_MSG_CHECKING([for sysroot]) AC_ARG_WITH([sysroot], [AS_HELP_STRING([--with-sysroot@<:@=DIR@:>@], [Search for dependent libraries within DIR (or the compiler's sysroot if not specified).])], [], [with_sysroot=no]) dnl lt_sysroot will always be passed unquoted. We quote it here dnl in case the user passed a directory name. lt_sysroot= case $with_sysroot in #( yes) if test yes = "$GCC"; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | $SED -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) AC_MSG_RESULT([$with_sysroot]) AC_MSG_ERROR([The sysroot must be an absolute path.]) ;; esac AC_MSG_RESULT([${lt_sysroot:-no}]) _LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl [dependent libraries, and where our libraries should be installed.])]) # _LT_ENABLE_LOCK # --------------- m4_defun([_LT_ENABLE_LOCK], [AC_ARG_ENABLE([libtool-lock], [AS_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test no = "$enable_libtool_lock" || enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out what ABI is being produced by ac_compile, and set mode # options accordingly. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `$FILECMD conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE=32 ;; *ELF-64*) HPUX_IA64_MODE=64 ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test yes = "$lt_cv_prog_gnu_ld"; then case `$FILECMD conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `$FILECMD conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; mips64*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then emul=elf case `$FILECMD conftest.$ac_objext` in *32-bit*) emul="${emul}32" ;; *64-bit*) emul="${emul}64" ;; esac case `$FILECMD conftest.$ac_objext` in *MSB*) emul="${emul}btsmip" ;; *LSB*) emul="${emul}ltsmip" ;; esac case `$FILECMD conftest.$ac_objext` in *N32*) emul="${emul}n32" ;; esac LD="${LD-ld} -m $emul" fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. Note that the listed cases only cover the # situations where additional linker options are needed (such as when # doing 32-bit compilation for a host where ld defaults to 64-bit, or # vice versa); the common cases where no linker options are needed do # not appear in the list. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `$FILECMD conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) case `$FILECMD conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; *) LD="${LD-ld} -m elf_i386" ;; esac ;; powerpc64le-*linux*) LD="${LD-ld} -m elf32lppclinux" ;; powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; powerpcle-*linux*|powerpc64le-*linux*) LD="${LD-ld} -m elf64lppc" ;; powerpc-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_PUSH(C) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_POP]) if test yes != "$lt_cv_cc_needs_belf"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS=$SAVE_CFLAGS fi ;; *-*solaris*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `$FILECMD conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*|x86_64-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD=${LD-ld}_sol2 fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks=$enable_libtool_lock ])# _LT_ENABLE_LOCK # _LT_PROG_AR # ----------- m4_defun([_LT_PROG_AR], [AC_CHECK_TOOLS(AR, [ar], false) : ${AR=ar} _LT_DECL([], [AR], [1], [The archiver]) # Use ARFLAGS variable as AR's operation code to sync the variable naming with # Automake. If both AR_FLAGS and ARFLAGS are specified, AR_FLAGS should have # higher priority because thats what people were doing historically (setting # ARFLAGS for automake and AR_FLAGS for libtool). FIXME: Make the AR_FLAGS # variable obsoleted/removed. test ${AR_FLAGS+y} || AR_FLAGS=${ARFLAGS-cr} lt_ar_flags=$AR_FLAGS _LT_DECL([], [lt_ar_flags], [0], [Flags to create an archive (by configure)]) # Make AR_FLAGS overridable by 'make ARFLAGS='. Don't try to run-time override # by AR_FLAGS because that was never working and AR_FLAGS is about to die. _LT_DECL([], [AR_FLAGS], [\@S|@{ARFLAGS-"\@S|@lt_ar_flags"}], [Flags to create an archive]) AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], [lt_cv_ar_at_file=no AC_COMPILE_IFELSE([AC_LANG_PROGRAM], [echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' AC_TRY_EVAL([lt_ar_try]) if test 0 -eq "$ac_status"; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a AC_TRY_EVAL([lt_ar_try]) if test 0 -ne "$ac_status"; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a ]) ]) if test no = "$lt_cv_ar_at_file"; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi _LT_DECL([], [archiver_list_spec], [1], [How to feed a file listing to the archiver]) ])# _LT_PROG_AR # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], [_LT_PROG_AR AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: _LT_DECL([], [STRIP], [1], [A symbol stripping program]) AC_CHECK_TOOL(RANLIB, ranlib, :) test -z "$RANLIB" && RANLIB=: _LT_DECL([], [RANLIB], [1], [Commands used to install an old-style archive]) # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in bitrig* | openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac _LT_DECL([], [old_postinstall_cmds], [2]) _LT_DECL([], [old_postuninstall_cmds], [2]) _LT_TAGDECL([], [old_archive_cmds], [2], [Commands used to build an old-style archive]) _LT_DECL([], [lock_old_archive_extraction], [0], [Whether to use a lock for old archive extraction]) ])# _LT_CMD_OLD_ARCHIVE # _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------------------- # Check whether the given compiler option works AC_DEFUN([_LT_COMPILER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi fi $RM conftest* ]) if test yes = "[$]$2"; then m4_if([$5], , :, [$5]) else m4_if([$6], , :, [$6]) fi ])# _LT_COMPILER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) # _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------- # Check whether the given linker option works AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $3" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi else $2=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS ]) if test yes = "[$]$2"; then m4_if([$4], , :, [$4]) else m4_if([$5], , :, [$5]) fi ])# _LT_LINKER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) # LT_CMD_MAX_LEN #--------------- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl # find the maximum length of command line arguments AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 teststring=ABCD case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; bitrig* | darwin* | dragonfly* | freebsd* | midnightbsd* | netbsd* | openbsd*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | $SED 's/.*[[ ]]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len" && \ test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test X`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test 17 != "$i" # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac ]) if test -n "$lt_cv_sys_max_cmd_len"; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) fi max_cmd_len=$lt_cv_sys_max_cmd_len _LT_DECL([], [max_cmd_len], [0], [What is the maximum length of a command?]) ])# LT_CMD_MAX_LEN # Old name: AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) # _LT_HEADER_DLFCN # ---------------- m4_defun([_LT_HEADER_DLFCN], [AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl ])# _LT_HEADER_DLFCN # _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ---------------------------------------------------------------- m4_defun([_LT_TRY_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test yes = "$cross_compiling"; then : [$4] else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF [#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; }] _LT_EOF if AC_TRY_EVAL(ac_link) && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; x$lt_dlneed_uscore) $2 ;; x$lt_dlunknown|x*) $3 ;; esac else : # compilation failed $3 fi fi rm -fr conftest* ])# _LT_TRY_DLOPEN_SELF # LT_SYS_DLOPEN_SELF # ------------------ AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test yes != "$enable_dlopen"; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen=load_add_on lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen=LoadLibrary lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen=dlopen lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl],[ lt_cv_dlopen=dyld lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; tpf*) # Don't try to run any link tests for TPF. We know it's impossible # because TPF is a cross-compiler, and we know how we open DSOs. lt_cv_dlopen=dlopen lt_cv_dlopen_libs= lt_cv_dlopen_self=no ;; *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen=shl_load], [AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen=dlopen], [AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl], [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld], [AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld]) ]) ]) ]) ]) ]) ;; esac if test no = "$lt_cv_dlopen"; then enable_dlopen=no else enable_dlopen=yes fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS=$CPPFLAGS test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS=$LDFLAGS wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS=$LIBS LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) if test yes = "$lt_cv_dlopen_self"; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) ]) fi CPPFLAGS=$save_CPPFLAGS LDFLAGS=$save_LDFLAGS LIBS=$save_LIBS ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi _LT_DECL([dlopen_support], [enable_dlopen], [0], [Whether dlopen is supported]) _LT_DECL([dlopen_self], [enable_dlopen_self], [0], [Whether dlopen of programs is supported]) _LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], [Whether dlopen of statically linked programs is supported]) ])# LT_SYS_DLOPEN_SELF # Old name: AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) # _LT_COMPILER_C_O([TAGNAME]) # --------------------------- # Check to see if options -c and -o are simultaneously supported by compiler. # This macro does not hard code the compiler like AC_PROG_CC_C_O. m4_defun([_LT_COMPILER_C_O], [m4_require([_LT_DECL_SED])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi chmod u+w . 2>&AS_MESSAGE_LOG_FD $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* ]) _LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], [Does compiler simultaneously support -c and -o options?]) ])# _LT_COMPILER_C_O # _LT_COMPILER_FILE_LOCKS([TAGNAME]) # ---------------------------------- # Check to see if we can do hard links to lock some files if needed m4_defun([_LT_COMPILER_FILE_LOCKS], [m4_require([_LT_ENABLE_LOCK])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_COMPILER_C_O([$1]) hard_links=nottested if test no = "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test no = "$hard_links"; then AC_MSG_WARN(['$CC' does not support '-c -o', so 'make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi _LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) ])# _LT_COMPILER_FILE_LOCKS # _LT_CHECK_OBJDIR # ---------------- m4_defun([_LT_CHECK_OBJDIR], [AC_CACHE_CHECK([for objdir], [lt_cv_objdir], [rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null]) objdir=$lt_cv_objdir _LT_DECL([], [objdir], [0], [The name of the directory that contains temporary libtool files])dnl m4_pattern_allow([LT_OBJDIR])dnl AC_DEFINE_UNQUOTED([LT_OBJDIR], "$lt_cv_objdir/", [Define to the sub-directory where libtool stores uninstalled libraries.]) ])# _LT_CHECK_OBJDIR # _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) # -------------------------------------- # Check hardcoding attributes. m4_defun([_LT_LINKER_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_TAGVAR(hardcode_action, $1)= if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || test -n "$_LT_TAGVAR(runpath_var, $1)" || test yes = "$_LT_TAGVAR(hardcode_automatic, $1)"; then # We can hardcode non-existent directories. if test no != "$_LT_TAGVAR(hardcode_direct, $1)" && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" && test no != "$_LT_TAGVAR(hardcode_minus_L, $1)"; then # Linking always hardcodes the temporary library directory. _LT_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. _LT_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. _LT_TAGVAR(hardcode_action, $1)=unsupported fi AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) if test relink = "$_LT_TAGVAR(hardcode_action, $1)" || test yes = "$_LT_TAGVAR(inherit_rpath, $1)"; then # Fast installation is not supported enable_fast_install=no elif test yes = "$shlibpath_overrides_runpath" || test no = "$enable_shared"; then # Fast installation is not necessary enable_fast_install=needless fi _LT_TAGDECL([], [hardcode_action], [0], [How to hardcode a shared library path into an executable]) ])# _LT_LINKER_HARDCODE_LIBPATH # _LT_CMD_STRIPLIB # ---------------- m4_defun([_LT_CMD_STRIPLIB], [m4_require([_LT_DECL_EGREP]) striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -z "$STRIP"; then AC_MSG_RESULT([no]) else if $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then old_striplib="$STRIP --strip-debug" striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else case $host_os in darwin*) # FIXME - insert some real tests, host_os isn't really good enough striplib="$STRIP -x" old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) ;; freebsd*) if $STRIP -V 2>&1 | $GREP "elftoolchain" >/dev/null; then old_striplib="$STRIP --strip-debug" striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi ;; *) AC_MSG_RESULT([no]) ;; esac fi fi _LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) _LT_DECL([], [striplib], [1]) ])# _LT_CMD_STRIPLIB # _LT_PREPARE_MUNGE_PATH_LIST # --------------------------- # Make sure func_munge_path_list() is defined correctly. m4_defun([_LT_PREPARE_MUNGE_PATH_LIST], [[# func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x@S|@2 in x) ;; *:) eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'` \@S|@@S|@1\" ;; x:*) eval @S|@1=\"\@S|@@S|@1 `$ECHO @S|@2 | $SED 's/:/ /g'`\" ;; *::*) eval @S|@1=\"\@S|@@S|@1\ `$ECHO @S|@2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval @S|@1=\"`$ECHO @S|@2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \@S|@@S|@1\" ;; *) eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'`\" ;; esac } ]])# _LT_PREPARE_PATH_LIST # _LT_SYS_DYNAMIC_LINKER([TAG]) # ----------------------------- # PORTME Fill in your ld.so characteristics m4_defun([_LT_SYS_DYNAMIC_LINKER], [AC_REQUIRE([AC_CANONICAL_HOST])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_PREPARE_MUNGE_PATH_LIST])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ if test yes = "$GCC"; then case $host_os in darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; *) lt_awk_arg='/^libraries:/' ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq='s|=\([[A-Za-z]]:\)|\1|g' ;; *) lt_sed_strip_eq='s|=/|/|g' ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary... lt_tmp_lt_search_path_spec= lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` # ...but if some path component already ends with the multilib dir we assume # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). case "$lt_multi_os_dir; $lt_search_path_spec " in "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) lt_multi_os_dir= ;; esac for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" elif test -n "$lt_multi_os_dir"; then test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS = " "; FS = "/|\n";} { lt_foo = ""; lt_count = 0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo = "/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[[lt_foo]]++; } if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's|/\([[A-Za-z]]:\)|\1|g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi]) library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=.so postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown AC_ARG_VAR([LT_SYS_LIBRARY_PATH], [User-defined run-time library search path.]) case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='$libname$release$shared_ext$major' ;; aix[[4-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test ia64 = "$host_cpu"; then # AIX 5 supports IA64 library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line '#! .'. This would cause the generated library to # depend on '.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # Using Import Files as archive members, it is possible to support # filename-based versioning of shared library archives on AIX. While # this would work for both with and without runtime linking, it will # prevent static linking of such archives. So we do filename-based # shared library versioning with .so extension only, which is used # when both runtime linking and shared linking is enabled. # Unfortunately, runtime linking may impact performance, so we do # not want this to be the default eventually. Also, we use the # versioned .so libs for executables only if there is the -brtl # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. # To allow for filename-based versioning support, we need to create # libNAME.so.V as an archive file, containing: # *) an Import File, referring to the versioned filename of the # archive as well as the shared archive member, telling the # bitwidth (32 or 64) of that shared object, and providing the # list of exported symbols of that shared object, eventually # decorated with the 'weak' keyword # *) the shared object with the F_LOADONLY flag set, to really avoid # it being seen by the linker. # At run time we better use the real file rather than another symlink, # but for link time we create the symlink libNAME.so -> libNAME.so.V case $with_aix_soname,$aix_use_runtimelinking in # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. aix,yes) # traditional libtool dynamic_linker='AIX unversionable lib.so' # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; aix,no) # traditional AIX only dynamic_linker='AIX lib.a[(]lib.so.V[)]' # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' ;; svr4,*) # full svr4 only dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)]" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,yes) # both, prefer svr4 dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)], lib.a[(]lib.so.V[)]" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # unpreferred sharedlib libNAME.a needs extra handling postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,no) # both, prefer aix dynamic_linker="AIX lib.a[(]lib.so.V[)], lib.so.V[(]$shared_archive_member_spec.o[)]" library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' ;; esac shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='$libname$shared_ext' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[[45]]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo $libname | $SED -e 's/^lib/cyg/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo $libname | $SED -e 's/^lib/pw/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl* | *,icl*) # Native MSVC or ICC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec=$LIB if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC and ICC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='$libname$release$versuffix$shared_ext $libname$release$major$shared_ext $libname$shared_ext' soname_spec='$libname$release$major$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .bundle || echo .dylib`' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly* | midnightbsd*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[[23]].*) objformat=aout ;; *) objformat=elf ;; esac fi # Handle Gentoo/FreeBSD as it was Linux case $host_vendor in gentoo) version_type=linux ;; *) version_type=freebsd-$objformat ;; esac case $version_type in freebsd-elf*) library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' need_version=yes ;; linux) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' need_lib_prefix=no need_version=no ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[[01]]* | freebsdelf3.[[01]]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=no sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' if test 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[[3-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test yes = "$lt_cv_prog_gnu_ld"; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; linux*android*) version_type=none # Android doesn't support versioned libraries. need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext' soname_spec='$libname$release$shared_ext' finish_cmds= shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes dynamic_linker='Android linker' # Don't embed -rpath directories since the linker doesn't support them. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], [lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], [lt_cv_shlibpath_overrides_runpath=yes])]) LDFLAGS=$save_LDFLAGS libdir=$save_libdir ]) shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, # even though it is searched at run-time. Try to do the best guess by # appending ld.so.conf contents (and includes) to the search path. if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd* | bitrig*) version_type=sunos sys_lib_dlsearch_path_spec=/usr/lib need_lib_prefix=no if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then need_version=no else need_version=yes fi library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; os2*) libname_spec='$name' version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no # OS/2 can only load a DLL with a base name of 8 characters or less. soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; v=$($ECHO $release$versuffix | tr -d .-); n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); $ECHO $n$v`$shared_ext' library_names_spec='${libname}_dll.$libext' dynamic_linker='OS/2 ld.exe' shlibpath_var=BEGINLIBPATH sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test yes = "$with_gnu_ld"; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec; then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' soname_spec='$libname$shared_ext.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=sco need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test yes = "$with_gnu_ld"; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test yes = "$GCC"; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec fi if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec fi # remember unaugmented sys_lib_dlsearch_path content for libtool script decls... configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec # ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" # to be used as default LT_SYS_LIBRARY_PATH value in generated libtool configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH _LT_DECL([], [variables_saved_for_relink], [1], [Variables whose values should be saved in libtool wrapper scripts and restored at link time]) _LT_DECL([], [need_lib_prefix], [0], [Do we need the "lib" prefix for modules?]) _LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) _LT_DECL([], [version_type], [0], [Library versioning type]) _LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) _LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) _LT_DECL([], [shlibpath_overrides_runpath], [0], [Is shlibpath searched before the hard-coded library search path?]) _LT_DECL([], [libname_spec], [1], [Format of library name prefix]) _LT_DECL([], [library_names_spec], [1], [[List of archive names. First name is the real one, the rest are links. The last name is the one that the linker finds with -lNAME]]) _LT_DECL([], [soname_spec], [1], [[The coded name of the library, if different from the real name]]) _LT_DECL([], [install_override_mode], [1], [Permission mode override for installation of shared libraries]) _LT_DECL([], [postinstall_cmds], [2], [Command to use after installation of a shared archive]) _LT_DECL([], [postuninstall_cmds], [2], [Command to use after uninstallation of a shared archive]) _LT_DECL([], [finish_cmds], [2], [Commands used to finish a libtool library installation in a directory]) _LT_DECL([], [finish_eval], [1], [[As "finish_cmds", except a single script fragment to be evaled but not shown]]) _LT_DECL([], [hardcode_into_libs], [0], [Whether we should hardcode library paths into libraries]) _LT_DECL([], [sys_lib_search_path_spec], [2], [Compile-time system search path for libraries]) _LT_DECL([sys_lib_dlsearch_path_spec], [configure_time_dlsearch_path], [2], [Detected run-time system search path for libraries]) _LT_DECL([], [configure_time_lt_sys_library_path], [2], [Explicit LT_SYS_LIBRARY_PATH set during ./configure time]) ])# _LT_SYS_DYNAMIC_LINKER # _LT_PATH_TOOL_PREFIX(TOOL) # -------------------------- # find a file program that can recognize shared library AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="m4_if([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$1"; then lt_cv_path_MAGIC_CMD=$ac_dir/"$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac]) MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi _LT_DECL([], [MAGIC_CMD], [0], [Used to examine libraries when file_magic_cmd begins with "file"])dnl ])# _LT_PATH_TOOL_PREFIX # Old name: AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) # _LT_PATH_MAGIC # -------------- # find a file program that can recognize a shared library m4_defun([_LT_PATH_MAGIC], [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) else MAGIC_CMD=: fi fi ])# _LT_PATH_MAGIC # LT_PATH_LD # ---------- # find the pathname to the GNU or non-GNU linker AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PROG_ECHO_BACKSLASH])dnl AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld @<:@default=no@:>@])], [test no = "$withval" || with_gnu_ld=yes], [with_gnu_ld=no])dnl ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return, which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD=$ac_prog ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test yes = "$with_gnu_ld"; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD=$ac_dir/$ac_prog # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &1 conftest.i cat conftest.i conftest.i >conftest2.i : ${lt_DD:=$DD} AC_PATH_PROGS_FEATURE_CHECK([lt_DD], [dd], [if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: fi]) rm -f conftest.i conftest2.i conftest.out]) ])# _LT_PATH_DD # _LT_CMD_TRUNCATE # ---------------- # find command to truncate a binary pipe m4_defun([_LT_CMD_TRUNCATE], [m4_require([_LT_PATH_DD]) AC_CACHE_CHECK([how to truncate binary pipes], [lt_cv_truncate_bin], [printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i lt_cv_truncate_bin= if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" fi rm -f conftest.i conftest2.i conftest.out test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q"]) _LT_DECL([lt_truncate_bin], [lt_cv_truncate_bin], [1], [Command to truncate a binary pipe]) ])# _LT_CMD_TRUNCATE # _LT_CHECK_MAGIC_METHOD # ---------------------- # how to check for library dependencies # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_MAGIC_METHOD], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) AC_CACHE_CHECK([how to recognize dependent libraries], lt_cv_deplibs_check_method, [lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # 'unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # that responds to the $file_magic_cmd with a given extended regex. # If you have 'file' or equivalent on your system and you're not sure # whether 'pass_all' will *always* work, you probably want this one. case $host_os in aix[[4-9]]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[[45]]*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='$FILECMD -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. if ( file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly* | midnightbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=$FILECMD lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=$FILECMD case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[[3-9]]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=$FILECMD lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd* | bitrig*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; os2*) lt_cv_deplibs_check_method=pass_all ;; esac ]) file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], [Command to use when deplibs_check_method = "file_magic"]) _LT_DECL([], [file_magic_glob], [1], [How to find potential files when deplibs_check_method = "file_magic"]) _LT_DECL([], [want_nocaseglob], [1], [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) ])# _LT_CHECK_MAGIC_METHOD # LT_PATH_NM # ---------- # find the pathname to a BSD- or MS-compatible name lister AC_DEFUN([LT_PATH_NM], [AC_REQUIRE([AC_PROG_CC])dnl AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM=$NM else lt_nm_to_check=${ac_tool_prefix}nm if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. tmp_nm=$ac_dir/$lt_tmp_nm if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then # Check to see if the nm accepts a BSD-compat flag. # Adding the 'sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty case $build_os in mingw*) lt_bad_file=conftest.nm/nofile ;; *) lt_bad_file=/dev/null ;; esac case `"$tmp_nm" -B $lt_bad_file 2>&1 | $SED '1q'` in *$lt_bad_file* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break 2 ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | $SED '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break 2 ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS=$lt_save_ifs done : ${lt_cv_path_NM=no} fi]) if test no != "$lt_cv_path_NM"; then NM=$lt_cv_path_NM else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) case `$DUMPBIN -symbols -headers /dev/null 2>&1 | $SED '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols -headers" ;; *) DUMPBIN=: ;; esac fi AC_SUBST([DUMPBIN]) if test : != "$DUMPBIN"; then NM=$DUMPBIN fi fi test -z "$NM" && NM=nm AC_SUBST([NM]) _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], [lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) cat conftest.out >&AS_MESSAGE_LOG_FD if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest*]) ])# LT_PATH_NM # Old names: AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_PROG_NM], []) dnl AC_DEFUN([AC_PROG_NM], []) # _LT_CHECK_SHAREDLIB_FROM_LINKLIB # -------------------------------- # how to determine the name of the shared library # associated with a specific link library. # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) m4_require([_LT_DECL_DLLTOOL]) AC_CACHE_CHECK([how to associate runtime and link libraries], lt_cv_sharedlib_from_linklib_cmd, [lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh; # decide which one to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd=$ECHO ;; esac ]) sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO _LT_DECL([], [sharedlib_from_linklib_cmd], [1], [Command to associate shared and link libraries]) ])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB # _LT_PATH_MANIFEST_TOOL # ---------------------- # locate the manifest tool m4_defun([_LT_PATH_MANIFEST_TOOL], [AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], [lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&AS_MESSAGE_LOG_FD if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest*]) if test yes != "$lt_cv_path_mainfest_tool"; then MANIFEST_TOOL=: fi _LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl ])# _LT_PATH_MANIFEST_TOOL # _LT_DLL_DEF_P([FILE]) # --------------------- # True iff FILE is a Windows DLL '.def' file. # Keep in sync with func_dll_def_p in the libtool script AC_DEFUN([_LT_DLL_DEF_P], [dnl test DEF = "`$SED -n dnl -e '\''s/^[[ ]]*//'\'' dnl Strip leading whitespace -e '\''/^\(;.*\)*$/d'\'' dnl Delete empty lines and comments -e '\''s/^\(EXPORTS\|LIBRARY\)\([[ ]].*\)*$/DEF/p'\'' dnl -e q dnl Only consider the first "real" line $1`" dnl ])# _LT_DLL_DEF_P # LT_LIB_M # -------- # check for math library AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM=-lmw) AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, cos, LIBM=-lm) ;; esac AC_SUBST([LIBM]) ])# LT_LIB_M # Old name: AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_CHECK_LIBM], []) # _LT_COMPILER_NO_RTTI([TAGNAME]) # ------------------------------- m4_defun([_LT_COMPILER_NO_RTTI], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test yes = "$GCC"; then case $cc_basename in nvcc*) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; *) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; esac _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, [-fno-rtti -fno-exceptions], [], [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) fi _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], [Compiler flag to turn off builtin functions]) ])# _LT_COMPILER_NO_RTTI # _LT_CMD_GLOBAL_SYMBOLS # ---------------------- m4_defun([_LT_CMD_GLOBAL_SYMBOLS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([LT_PATH_NM])dnl AC_REQUIRE([LT_PATH_LD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_TAG_COMPILER])dnl # Check for command to grab the raw symbol name followed by C symbol from nm. AC_MSG_CHECKING([command to parse $NM output from $compiler object]) AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [ # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[[BCDEGRST]]' # Regexp to match symbols that can be accessed directly from C. sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[[BCDT]]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[[ABCDGISTW]]' ;; hpux*) if test ia64 = "$host_cpu"; then symcode='[[ABCDEGRST]]' fi ;; irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; osf*) symcode='[[BCDEGQRST]]' ;; solaris*) symcode='[[BDRT]]' ;; sco3.2v5*) symcode='[[DT]]' ;; sysv4.2uw2*) symcode='[[DT]]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[[ABDT]]' ;; sysv4) symcode='[[DFNSTU]]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[[ABCDGIRSTW]]' ;; esac if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Gets list of data symbols to import. lt_cv_sys_global_symbol_to_import="$SED -n -e 's/^I .* \(.*\)$/\1/p'" # Adjust the below global symbol transforms to fixup imported variables. lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" lt_c_name_lib_hook="\ -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" else # Disable hooks by default. lt_cv_sys_global_symbol_to_import= lt_cdecl_hook= lt_c_name_hook= lt_c_name_lib_hook= fi # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="$SED -n"\ $lt_cdecl_hook\ " -e 's/^T .* \(.*\)$/extern int \1();/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="$SED -n"\ $lt_c_name_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" # Transform an extracted symbol line into symbol name with lib prefix and # symbol address. lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="$SED -n"\ $lt_c_name_lib_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function, # D for any global variable and I for any imported variable. # Also find C++ and __fastcall symbols from MSVC++ or ICC, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ " /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ " /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ " {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ " s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx]" else lt_cv_sys_global_symbol_pipe="$SED -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | $SED '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT@&t@_DLSYM_CONST #elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT@&t@_DLSYM_CONST #else # define LT@&t@_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT@&t@_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[[]] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS=conftstm.$ac_objext CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test yes = "$pipe_works"; then break else lt_cv_sys_global_symbol_pipe= fi done ]) if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then nm_file_list_spec='@' fi _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], [Transform the output of nm in a proper C declaration]) _LT_DECL([global_symbol_to_import], [lt_cv_sys_global_symbol_to_import], [1], [Transform the output of nm into a list of symbols to manually relocate]) _LT_DECL([global_symbol_to_c_name_address], [lt_cv_sys_global_symbol_to_c_name_address], [1], [Transform the output of nm in a C name address pair]) _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) _LT_DECL([nm_interface], [lt_cv_nm_interface], [1], [The name lister interface]) _LT_DECL([], [nm_file_list_spec], [1], [Specify filename containing input files for $NM]) ]) # _LT_CMD_GLOBAL_SYMBOLS # _LT_COMPILER_PIC([TAGNAME]) # --------------------------- m4_defun([_LT_COMPILER_PIC], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_wl, $1)= _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. if test yes = "$GXX"; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) case $host_os in os2*) _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else case $host_os in aix[[4-9]]*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; dgux*) case $cc_basename in ec++*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; ghcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; freebsd* | dragonfly* | midnightbsd*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' if test ia64 != "$host_cpu"; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # KAI C++ Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64, which still supported -KPIC. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL 8.0, 9.0 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | $SED 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) ;; esac ;; netbsd*) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; cxx*) # Digital/Compaq C++ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; lcc*) # Lucid _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ], [ if test yes = "$GCC"; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) case $host_os in os2*) _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' case $cc_basename in nagfor*) # NAG Fortran compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) case $host_os in os2*) _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' ;; esac ;; hpux9* | hpux10* | hpux11*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC (with -KPIC) is the default. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64, which still supported -KPIC. ecc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # Lahey Fortran 8.1. lf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; nagfor*) # NAG Fortran compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; tcc*) # Fabrice Bellard et al's Tiny C Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; ccc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | $SED 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='' ;; *Sun\ F* | *Sun*Fortran*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; *Intel*\ [[CF]]*Compiler*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; *Portland\ Group*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; esac ;; newsos6) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All OSF/1 code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; rdos*) _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; solaris*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; esac ;; sunos4*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; unicos*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; uts4*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ]) case $host_os in # For platforms that do not support PIC, -DPIC is meaningless: *djgpp*) _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac AC_CACHE_CHECK([for $compiler option to produce PIC], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) _LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) # # Check to make sure the PIC flag actually works. # if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; esac], [_LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) fi _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], [Additional compiler flags for building library objects]) _LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], [How to pass a linker flag through the compiler]) # # Check to make sure the static flag actually works. # wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" _LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), $lt_tmp_static_flag, [], [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], [Compiler flag to prevent dynamic linking]) ])# _LT_COMPILER_PIC # _LT_LINKER_SHLIBS([TAGNAME]) # ---------------------------- # See if the linker supports building shared libraries. m4_defun([_LT_LINKER_SHLIBS], [AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) m4_if([$1], [CXX], [ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] case $host_os in aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)=$ltdll_cmds ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl* | icl*) _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] ;; esac ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_cmds, $1)= _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(old_archive_from_new_cmds, $1)= _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= _LT_TAGVAR(thread_safe_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list _LT_TAGVAR(include_expsyms, $1)= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ' (' and ')$', so one must not match beginning or # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', # as well as any symbol that contains 'd'. _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. dnl Note also adjust exclude_expsyms for C++ above. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ and ICC port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++ or Intel C++ Compiler. if test yes != "$GCC"; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++ or ICC) with_gnu_ld=yes ;; openbsd* | bitrig*) with_gnu_ld=no ;; esac _LT_TAGVAR(ld_shlibs, $1)=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test yes = "$with_gnu_ld"; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test yes = "$lt_use_gnu_ld_interface"; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='$wl' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi supports_anon_versioning=no case `$LD -v | $SED -e 's/([[^)]]\+)\s\+//' 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[[3-9]]*) # On AIX/PPC, the GNU linker is very broken if test ia64 != "$host_cpu"; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported shrext_cmds=.dll _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$SED "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test linux-dietlibc = "$host_os"; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test no = "$tmp_diet" then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--shared' ;; nagfor*) # NAGFOR 5.3 tmp_sharedflag='-Wl,-shared' ;; xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes ;; esac case `$CC -V 2>&1 | $SED 5q` in *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi case $cc_basename in tcc*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='-rdynamic' ;; xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test yes = "$supports_anon_versioning"; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; sunos4*) _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac if test no = "$_LT_TAGVAR(ld_shlibs, $1)"; then runpath_var= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_TAGVAR(hardcode_minus_L, $1)=yes if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_TAGVAR(hardcode_direct, $1)=unsupported fi ;; aix[[4-9]]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then aix_use_runtimelinking=yes break fi done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # traditional, no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no ;; esac if test yes = "$GCC"; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi ;; esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag="$shared_flag "'$wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_TAGVAR(always_export_symbols, $1)=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; bsdi[[45]]*) _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++ or Intel C++ Compiler. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl* | icl*) # Native MSVC or ICC _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC and ICC wrapper _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly* | midnightbsd*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; hpux9*) if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' ;; hpux10*) if test yes,no = "$GCC,$with_gnu_ld"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test no = "$with_gnu_ld"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes fi ;; hpux11*) if test yes,no = "$GCC,$with_gnu_ld"; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) m4_if($1, [], [ # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) _LT_LINKER_OPTION([if $CC understands -b], _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) ;; esac fi if test no = "$with_gnu_ld"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], [lt_cv_irix_exported_symbol], [save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" AC_LINK_IFELSE( [AC_LANG_SOURCE( [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], [C++], [[int foo (void) { return 0; }]], [Fortran 77], [[ subroutine foo end]], [Fortran], [[ subroutine foo end]])])], [lt_cv_irix_exported_symbol=yes], [lt_cv_irix_exported_symbol=no]) LDFLAGS=$save_LDFLAGS]) if test yes = "$lt_cv_irix_exported_symbol"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' fi else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes _LT_TAGVAR(link_all_deplibs, $1)=yes ;; linux*) case $cc_basename in tcc*) # Fabrice Bellard et al's Tiny C Compiler _LT_TAGVAR(ld_shlibs, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; newsos6) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *nto* | *qnx*) ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' fi else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported shrext_cmds=.dll _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' ;; osf3*) if test yes = "$GCC"; then _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test yes = "$GCC"; then _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; solaris*) _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test yes = "$GCC"; then wlarc='$wl' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' _LT_TAGVAR(archive_cmds, $1)='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='$wl' _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. GCC discards it without '$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test yes = "$GCC"; then _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' else _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' fi ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes ;; sunos4*) if test sequent = "$host_vendor"; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4) case $host_vendor in sni) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' _LT_TAGVAR(hardcode_direct, $1)=no ;; motorola) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4.3*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes _LT_TAGVAR(ld_shlibs, $1)=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport' runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(ld_shlibs, $1)=no ;; esac if test sni = "$host_vendor"; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Blargedynsym' ;; esac fi fi ]) AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld _LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl _LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl _LT_DECL([], [extract_expsyms_cmds], [2], [The commands to extract the exported symbol list from a shared archive]) # # Do we need to explicitly link libc? # case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in x|xyes) # Assume -lc should be added _LT_TAGVAR(archive_cmds_need_lc, $1)=yes if test yes,yes = "$GCC,$enable_shared"; then case $_LT_TAGVAR(archive_cmds, $1) in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. AC_CACHE_CHECK([whether -lc should be explicitly linked in], [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), [$RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if AC_TRY_EVAL(ac_compile) 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) _LT_TAGVAR(allow_undefined_flag, $1)= if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) then lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no else lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes fi _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* ]) _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) ;; esac fi ;; esac _LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], [Whether or not to add -lc for building shared libraries]) _LT_TAGDECL([allow_libtool_libs_with_static_runtimes], [enable_shared_with_static_runtimes], [0], [Whether or not to disallow shared libs when runtime libs are static]) _LT_TAGDECL([], [export_dynamic_flag_spec], [1], [Compiler flag to allow reflexive dlopens]) _LT_TAGDECL([], [whole_archive_flag_spec], [1], [Compiler flag to generate shared objects directly from archives]) _LT_TAGDECL([], [compiler_needs_object], [1], [Whether the compiler copes with passing no objects directly]) _LT_TAGDECL([], [old_archive_from_new_cmds], [2], [Create an old-style archive from a shared archive]) _LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], [Create a temporary old-style archive to link instead of a shared archive]) _LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) _LT_TAGDECL([], [archive_expsym_cmds], [2]) _LT_TAGDECL([], [module_cmds], [2], [Commands used to build a loadable module if different from building a shared archive.]) _LT_TAGDECL([], [module_expsym_cmds], [2]) _LT_TAGDECL([], [with_gnu_ld], [1], [Whether we are building with GNU ld or not]) _LT_TAGDECL([], [allow_undefined_flag], [1], [Flag that allows shared libraries with undefined symbols to be built]) _LT_TAGDECL([], [no_undefined_flag], [1], [Flag that enforces no undefined symbols]) _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], [Flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]) _LT_TAGDECL([], [hardcode_libdir_separator], [1], [Whether we need a single "-rpath" flag with a separated argument]) _LT_TAGDECL([], [hardcode_direct], [0], [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_direct_absolute], [0], [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes DIR into the resulting binary and the resulting library dependency is "absolute", i.e impossible to change by setting $shlibpath_var if the library is relocated]) _LT_TAGDECL([], [hardcode_minus_L], [0], [Set to "yes" if using the -LDIR flag during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_shlibpath_var], [0], [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_automatic], [0], [Set to "yes" if building a shared library automatically hardcodes DIR into the library and all subsequent libraries and executables linked against it]) _LT_TAGDECL([], [inherit_rpath], [0], [Set to yes if linker adds runtime paths of dependent libraries to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], [The commands to list exported symbols]) _LT_TAGDECL([], [exclude_expsyms], [1], [Symbols that should not be listed in the preloaded symbols]) _LT_TAGDECL([], [include_expsyms], [1], [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) _LT_TAGDECL([], [postlink_cmds], [2], [Commands necessary for finishing linking programs]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], dnl [Compiler flag to generate thread safe objects]) ])# _LT_LINKER_SHLIBS # _LT_LANG_C_CONFIG([TAG]) # ------------------------ # Ensure that the configuration variables for a C compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to 'libtool'. m4_defun([_LT_LANG_C_CONFIG], [m4_require([_LT_DECL_EGREP])dnl lt_save_CC=$CC AC_LANG_PUSH(C) # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' _LT_TAG_COMPILER # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) LT_SYS_DLOPEN_SELF _LT_CMD_STRIPLIB # Report what library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_CONFIG($1) fi AC_LANG_POP CC=$lt_save_CC ])# _LT_LANG_C_CONFIG # _LT_LANG_CXX_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a C++ compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to 'libtool'. m4_defun([_LT_LANG_CXX_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl if test -n "$CXX" && ( test no != "$CXX" && ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) || (test g++ != "$CXX"))); then AC_PROG_CXXCPP else _lt_caught_CXX_error=yes fi AC_LANG_PUSH(C++) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test yes != "$_lt_caught_CXX_error"; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} CFLAGS=$CXXFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test yes = "$GXX"; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi if test yes = "$GXX"; then # Set up default GNU C++ configuration LT_PATH_LD # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test yes = "$with_gnu_ld"; then _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='$wl' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) _LT_TAGVAR(ld_shlibs, $1)=yes case $host_os in aix3*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aix[[4-9]]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no ;; esac if test yes = "$GXX"; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag=$shared_flag' $wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. _LT_TAGVAR(always_export_symbols, $1)=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. # The "-G" linker flag allows undefined symbols. _LT_TAGVAR(no_undefined_flag, $1)='-bernotok' # Determine the default libpath from the value encoded in an empty # executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared # libraries. Need -bnortl late, we may have -brtl in LDFLAGS. _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in ,cl* | no,cl* | ,icl* | no,icl*) # Native MSVC or ICC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ func_to_tool_file "$lt_outputfile"~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # g++ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported shrext_cmds=.dll _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; freebsd2.*) # C++ shared libraries reported to be fairly broken before # switch to ELF _LT_TAGVAR(ld_shlibs, $1)=no ;; freebsd-elf*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; freebsd* | dragonfly* | midnightbsd*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_TAGVAR(ld_shlibs, $1)=yes ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; hpux9*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; hpux10*|hpux11*) if test no = "$with_gnu_ld"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) ;; *) _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then if test no = "$with_gnu_ld"; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$SED "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test yes = "$GXX"; then if test no = "$with_gnu_ld"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` -o $lib' fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib $wl-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 6 and above use weak symbols _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl--rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' ;; cxx*) # Compaq C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib $wl-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | $SED 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file $wl$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; m88k*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) _LT_TAGVAR(ld_shlibs, $1)=yes ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file,$export_symbols -o $lib' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; cxx*) case $host in osf3*) _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $soname `test -n "$verstring" && func_echo_all "$wl-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' ;; *) _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname $wl-input $wl$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~ $RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ;; esac _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes,no = "$GXX,$with_gnu_ld"; then _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' case $host in osf3*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag $wl-M $wl$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test yes,no = "$GXX,$with_gnu_ld"; then _LT_TAGVAR(no_undefined_flag, $1)=' $wl-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # g++ 2.7 appears to require '-G' NOT '-shared' on this # platform. _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $wl$libdir' case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ '"$_LT_TAGVAR(old_archive_cmds, $1)" _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ '"$_LT_TAGVAR(reload_cmds, $1)" ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no _LT_TAGVAR(GCC, $1)=$GXX _LT_TAGVAR(LD, $1)=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test yes != "$_lt_caught_CXX_error" AC_LANG_POP ])# _LT_LANG_CXX_CONFIG # _LT_FUNC_STRIPNAME_CNF # ---------------------- # func_stripname_cnf prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # # This function is identical to the (non-XSI) version of func_stripname, # except this one can be used by m4 code that may be executed by configure, # rather than the libtool script. m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl AC_REQUIRE([_LT_DECL_SED]) AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) func_stripname_cnf () { case @S|@2 in .*) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%\\\\@S|@2\$%%"`;; *) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%@S|@2\$%%"`;; esac } # func_stripname_cnf ])# _LT_FUNC_STRIPNAME_CNF # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose # compiler output when linking a shared library. # Parse the compiler output and extract the necessary # objects, libraries and library flags. m4_defun([_LT_SYS_HIDDEN_LIBDEPS], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl # Dependencies to place before and after the object being linked: _LT_TAGVAR(predep_objects, $1)= _LT_TAGVAR(postdep_objects, $1)= _LT_TAGVAR(predeps, $1)= _LT_TAGVAR(postdeps, $1)= _LT_TAGVAR(compiler_lib_search_path, $1)= dnl we can't use the lt_simple_compile_test_code here, dnl because it contains code intended for an executable, dnl not a library. It's possible we should let each dnl tag define a new lt_????_link_test_code variable, dnl but it's only used here... m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF int a; void foo (void) { a = 0; } _LT_EOF ], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF ], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer*4 a a=0 return end _LT_EOF ], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer a a=0 return end _LT_EOF ], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF public class foo { private int a; public void bar (void) { a = 0; } }; _LT_EOF ], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF package foo func foo() { } _LT_EOF ]) _lt_libdeps_save_CFLAGS=$CFLAGS case "$CC $CFLAGS " in #( *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; *\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; esac dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case $prev$p in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test x-L = "$p" || test x-R = "$p"; then prev=$p continue fi # Expand the sysroot to ease extracting the directories later. if test -z "$prev"; then case $p in -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; esac fi case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac if test no = "$pre_test_object_deps_done"; then case $prev in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then _LT_TAGVAR(compiler_lib_search_path, $1)=$prev$p else _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} $prev$p" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$_LT_TAGVAR(postdeps, $1)"; then _LT_TAGVAR(postdeps, $1)=$prev$p else _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} $prev$p" fi fi prev= ;; *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test no = "$pre_test_object_deps_done"; then if test -z "$_LT_TAGVAR(predep_objects, $1)"; then _LT_TAGVAR(predep_objects, $1)=$p else _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" fi else if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then _LT_TAGVAR(postdep_objects, $1)=$p else _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling $1 test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], [case $host_os in interix[[3-9]]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. _LT_TAGVAR(predep_objects,$1)= _LT_TAGVAR(postdep_objects,$1)= _LT_TAGVAR(postdeps,$1)= ;; esac ]) case " $_LT_TAGVAR(postdeps, $1) " in *" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; esac _LT_TAGVAR(compiler_lib_search_dirs, $1)= if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | $SED -e 's! -L! !g' -e 's!^ !!'` fi _LT_TAGDECL([], [compiler_lib_search_dirs], [1], [The directories searched by this compiler when creating a shared library]) _LT_TAGDECL([], [predep_objects], [1], [Dependencies to place before and after the objects being linked to create a shared library]) _LT_TAGDECL([], [postdep_objects], [1]) _LT_TAGDECL([], [predeps], [1]) _LT_TAGDECL([], [postdeps], [1]) _LT_TAGDECL([], [compiler_lib_search_path], [1], [The library search path used internally by the compiler when linking a shared library]) ])# _LT_SYS_HIDDEN_LIBDEPS # _LT_LANG_F77_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a Fortran 77 compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_F77_CONFIG], [AC_LANG_PUSH(Fortran 77) if test -z "$F77" || test no = "$F77"; then _lt_disable_F77=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the F77 compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test yes != "$_lt_disable_F77"; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${F77-"f77"} CFLAGS=$FFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) GCC=$G77 if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)=$G77 _LT_TAGVAR(LD, $1)=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test yes != "$_lt_disable_F77" AC_LANG_POP ])# _LT_LANG_F77_CONFIG # _LT_LANG_FC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for a Fortran compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_FC_CONFIG], [AC_LANG_PUSH(Fortran) if test -z "$FC" || test no = "$FC"; then _lt_disable_FC=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for fc test sources. ac_ext=${ac_fc_srcext-f} # Object file extension for compiled fc test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the FC compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test yes != "$_lt_disable_FC"; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${FC-"f95"} CFLAGS=$FCFLAGS compiler=$CC GCC=$ac_cv_fc_compiler_gnu _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)=$ac_cv_fc_compiler_gnu _LT_TAGVAR(LD, $1)=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test yes != "$_lt_disable_FC" AC_LANG_POP ])# _LT_LANG_FC_CONFIG # _LT_LANG_GCJ_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Java Compiler compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_GCJ_CONFIG], [AC_REQUIRE([LT_PROG_GCJ])dnl AC_LANG_SAVE # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GCJ-"gcj"} CFLAGS=$GCJFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)=$LD _LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GCJ_CONFIG # _LT_LANG_GO_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Go compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_GO_CONFIG], [AC_REQUIRE([LT_PROG_GO])dnl AC_LANG_SAVE # Source file extension for Go test sources. ac_ext=go # Object file extension for compiled Go test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="package main; func main() { }" # Code to be used in simple link tests lt_simple_link_test_code='package main; func main() { }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GOC-"gccgo"} CFLAGS=$GOFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)=$LD _LT_CC_BASENAME([$compiler]) # Go did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GO_CONFIG # _LT_LANG_RC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for the Windows resource compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_RC_CONFIG], [AC_REQUIRE([LT_PROG_RC])dnl AC_LANG_SAVE # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code=$lt_simple_compile_test_code # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC= CC=${RC-"windres"} CFLAGS= compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes if test -n "$compiler"; then : _LT_CONFIG($1) fi GCC=$lt_save_GCC AC_LANG_RESTORE CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_RC_CONFIG # LT_PROG_GCJ # ----------- AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj,) test set = "${GCJFLAGS+set}" || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS)])])[]dnl ]) # Old name: AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_GCJ], []) # LT_PROG_GO # ---------- AC_DEFUN([LT_PROG_GO], [AC_CHECK_TOOL(GOC, gccgo,) ]) # LT_PROG_RC # ---------- AC_DEFUN([LT_PROG_RC], [AC_CHECK_TOOL(RC, windres,) ]) # Old name: AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_RC], []) # _LT_DECL_EGREP # -------------- # If we don't have a new enough Autoconf to choose the best grep # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_EGREP], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_REQUIRE([AC_PROG_FGREP])dnl test -z "$GREP" && GREP=grep _LT_DECL([], [GREP], [1], [A grep program that handles long lines]) _LT_DECL([], [EGREP], [1], [An ERE matcher]) _LT_DECL([], [FGREP], [1], [A literal string matcher]) dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too AC_SUBST([GREP]) ]) # _LT_DECL_OBJDUMP # -------------- # If we don't have a new enough Autoconf to choose the best objdump # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_OBJDUMP], [AC_CHECK_TOOL(OBJDUMP, objdump, false) test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) AC_SUBST([OBJDUMP]) ]) # _LT_DECL_DLLTOOL # ---------------- # Ensure DLLTOOL variable is set. m4_defun([_LT_DECL_DLLTOOL], [AC_CHECK_TOOL(DLLTOOL, dlltool, false) test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program]) AC_SUBST([DLLTOOL]) ]) # _LT_DECL_FILECMD # ---------------- # Check for a file(cmd) program that can be used to detect file type and magic m4_defun([_LT_DECL_FILECMD], [AC_CHECK_TOOL([FILECMD], [file], [:]) _LT_DECL([], [FILECMD], [1], [A file(cmd) program that detects file types]) ])# _LD_DECL_FILECMD # _LT_DECL_SED # ------------ # Check for a fully-functional sed program, that truncates # as few characters as possible. Prefer GNU sed if found. m4_defun([_LT_DECL_SED], [AC_PROG_SED test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" _LT_DECL([], [SED], [1], [A sed program that does not truncate output]) _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], [Sed that helps us avoid accidentally triggering echo(1) options like -n]) ])# _LT_DECL_SED m4_ifndef([AC_PROG_SED], [ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # m4_defun([AC_PROG_SED], [AC_MSG_CHECKING([for a sed that does not truncate output]) AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f "$lt_ac_sed" && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test 10 -lt "$lt_ac_count" && break lt_ac_count=`expr $lt_ac_count + 1` if test "$lt_ac_count" -gt "$lt_ac_max"; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done ]) SED=$lt_cv_path_SED AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ])#AC_PROG_SED ])#m4_ifndef # Old name: AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_SED], []) # _LT_CHECK_SHELL_FEATURES # ------------------------ # Find out whether the shell is Bourne or XSI compatible, # or has some other useful features. m4_defun([_LT_CHECK_SHELL_FEATURES], [if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi _LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac _LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES # _LT_PATH_CONVERSION_FUNCTIONS # ----------------------------- # Determine what file name conversion functions should be used by # func_to_host_file (and, implicitly, by func_to_host_path). These are needed # for certain cross-compile configurations and native mingw. m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_MSG_CHECKING([how to convert $build file names to $host format]) AC_CACHE_VAL(lt_cv_to_host_file_cmd, [case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac ]) to_host_file_cmd=$lt_cv_to_host_file_cmd AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) _LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], [0], [convert $build file names to $host format])dnl AC_MSG_CHECKING([how to convert $build file names to toolchain format]) AC_CACHE_VAL(lt_cv_to_tool_file_cmd, [#assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac ]) to_tool_file_cmd=$lt_cv_to_tool_file_cmd AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) _LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], [0], [convert $build files to toolchain format])dnl ])# _LT_PATH_CONVERSION_FUNCTIONS # Helper functions for option handling. -*- Autoconf -*- # # Copyright (C) 2004-2005, 2007-2009, 2011-2019, 2021-2022 Free # Software Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 8 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) # ------------------------------------------ m4_define([_LT_MANGLE_OPTION], [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) # --------------------------------------- # Set option OPTION-NAME for macro MACRO-NAME, and if there is a # matching handler defined, dispatch to it. Other OPTION-NAMEs are # saved as a flag. m4_define([_LT_SET_OPTION], [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), _LT_MANGLE_DEFUN([$1], [$2]), [m4_warning([Unknown $1 option '$2'])])[]dnl ]) # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) # ------------------------------------------------------------ # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. m4_define([_LT_IF_OPTION], [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) # ------------------------------------------------------- # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME # are set. m4_define([_LT_UNLESS_OPTIONS], [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), [m4_define([$0_found])])])[]dnl m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 ])[]dnl ]) # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) # ---------------------------------------- # OPTION-LIST is a space-separated list of Libtool options associated # with MACRO-NAME. If any OPTION has a matching handler declared with # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about # the unknown option and exit. m4_defun([_LT_SET_OPTIONS], [# Set options m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [_LT_SET_OPTION([$1], _LT_Option)]) m4_if([$1],[LT_INIT],[ dnl dnl Simply set some default values (i.e off) if boolean options were not dnl specified: _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no ]) _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no ]) dnl dnl If no reference was made to various pairs of opposing options, then dnl we run the default mode handler for the pair. For example, if neither dnl 'shared' nor 'disable-shared' was passed, we enable building of shared dnl archives by default: _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], [_LT_ENABLE_FAST_INSTALL]) _LT_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4], [_LT_WITH_AIX_SONAME([aix])]) ]) ])# _LT_SET_OPTIONS # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) # ----------------------------------------- m4_define([_LT_MANGLE_DEFUN], [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) # ----------------------------------------------- m4_define([LT_OPTION_DEFINE], [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl ])# LT_OPTION_DEFINE # dlopen # ------ LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes ]) AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'dlopen' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) # win32-dll # --------- # Declare package support for building win32 dll's. LT_OPTION_DEFINE([LT_INIT], [win32-dll], [enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; esac test -z "$AS" && AS=as _LT_DECL([], [AS], [1], [Assembler program])dnl test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl ])# win32-dll AU_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_REQUIRE([AC_CANONICAL_HOST])dnl _LT_SET_OPTION([LT_INIT], [win32-dll]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'win32-dll' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) # _LT_ENABLE_SHARED([DEFAULT]) # ---------------------------- # implement the --enable-shared flag, and supports the 'shared' and # 'disable-shared' LT_INIT options. # DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. m4_define([_LT_ENABLE_SHARED], [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([shared], [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS=$lt_save_ifs ;; esac], [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) _LT_DECL([build_libtool_libs], [enable_shared], [0], [Whether or not to build shared libraries]) ])# _LT_ENABLE_SHARED LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) # Old names: AC_DEFUN([AC_ENABLE_SHARED], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) ]) AC_DEFUN([AC_DISABLE_SHARED], [_LT_SET_OPTION([LT_INIT], [disable-shared]) ]) AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_SHARED], []) dnl AC_DEFUN([AM_DISABLE_SHARED], []) # _LT_ENABLE_STATIC([DEFAULT]) # ---------------------------- # implement the --enable-static flag, and support the 'static' and # 'disable-static' LT_INIT options. # DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. m4_define([_LT_ENABLE_STATIC], [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([static], [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS=$lt_save_ifs ;; esac], [enable_static=]_LT_ENABLE_STATIC_DEFAULT) _LT_DECL([build_old_libs], [enable_static], [0], [Whether or not to build static libraries]) ])# _LT_ENABLE_STATIC LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) # Old names: AC_DEFUN([AC_ENABLE_STATIC], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) ]) AC_DEFUN([AC_DISABLE_STATIC], [_LT_SET_OPTION([LT_INIT], [disable-static]) ]) AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_STATIC], []) dnl AC_DEFUN([AM_DISABLE_STATIC], []) # _LT_ENABLE_FAST_INSTALL([DEFAULT]) # ---------------------------------- # implement the --enable-fast-install flag, and support the 'fast-install' # and 'disable-fast-install' LT_INIT options. # DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. m4_define([_LT_ENABLE_FAST_INSTALL], [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([fast-install], [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS=$lt_save_ifs ;; esac], [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) _LT_DECL([fast_install], [enable_fast_install], [0], [Whether or not to optimize for fast installation])dnl ])# _LT_ENABLE_FAST_INSTALL LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) # Old names: AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'fast-install' option into LT_INIT's first parameter.]) ]) AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'disable-fast-install' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) # _LT_WITH_AIX_SONAME([DEFAULT]) # ---------------------------------- # implement the --with-aix-soname flag, and support the `aix-soname=aix' # and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT # is either `aix', `both' or `svr4'. If omitted, it defaults to `aix'. m4_define([_LT_WITH_AIX_SONAME], [m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl shared_archive_member_spec= case $host,$enable_shared in power*-*-aix[[5-9]]*,yes) AC_MSG_CHECKING([which variant of shared library versioning to provide]) AC_ARG_WITH([aix-soname], [AS_HELP_STRING([--with-aix-soname=aix|svr4|both], [shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])], [case $withval in aix|svr4|both) ;; *) AC_MSG_ERROR([Unknown argument to --with-aix-soname]) ;; esac lt_cv_with_aix_soname=$with_aix_soname], [AC_CACHE_VAL([lt_cv_with_aix_soname], [lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT) with_aix_soname=$lt_cv_with_aix_soname]) AC_MSG_RESULT([$with_aix_soname]) if test aix != "$with_aix_soname"; then # For the AIX way of multilib, we name the shared archive member # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, # the AIX toolchain works better with OBJECT_MODE set (default 32). if test 64 = "${OBJECT_MODE-32}"; then shared_archive_member_spec=shr_64 else shared_archive_member_spec=shr fi fi ;; *) with_aix_soname=aix ;; esac _LT_DECL([], [shared_archive_member_spec], [0], [Shared archive member basename, for filename based shared library versioning on AIX])dnl ])# _LT_WITH_AIX_SONAME LT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])]) LT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])]) LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])]) # _LT_WITH_PIC([MODE]) # -------------------- # implement the --with-pic flag, and support the 'pic-only' and 'no-pic' # LT_INIT options. # MODE is either 'yes' or 'no'. If omitted, it defaults to 'both'. m4_define([_LT_WITH_PIC], [AC_ARG_WITH([pic], [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], [lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for lt_pkg in $withval; do IFS=$lt_save_ifs if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS=$lt_save_ifs ;; esac], [pic_mode=m4_default([$1], [default])]) _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl ])# _LT_WITH_PIC LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) # Old name: AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'pic-only' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) m4_define([_LTDL_MODE], []) LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], [m4_define([_LTDL_MODE], [nonrecursive])]) LT_OPTION_DEFINE([LTDL_INIT], [recursive], [m4_define([_LTDL_MODE], [recursive])]) LT_OPTION_DEFINE([LTDL_INIT], [subproject], [m4_define([_LTDL_MODE], [subproject])]) m4_define([_LTDL_TYPE], []) LT_OPTION_DEFINE([LTDL_INIT], [installable], [m4_define([_LTDL_TYPE], [installable])]) LT_OPTION_DEFINE([LTDL_INIT], [convenience], [m4_define([_LTDL_TYPE], [convenience])]) # ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # # Copyright (C) 2004-2005, 2007-2008, 2011-2019, 2021-2022 Free Software # Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 6 ltsugar.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) # lt_join(SEP, ARG1, [ARG2...]) # ----------------------------- # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their # associated separator. # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier # versions in m4sugar had bugs. m4_define([lt_join], [m4_if([$#], [1], [], [$#], [2], [[$2]], [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) m4_define([_lt_join], [m4_if([$#$2], [2], [], [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) # lt_car(LIST) # lt_cdr(LIST) # ------------ # Manipulate m4 lists. # These macros are necessary as long as will still need to support # Autoconf-2.59, which quotes differently. m4_define([lt_car], [[$1]]) m4_define([lt_cdr], [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], [$#], 1, [], [m4_dquote(m4_shift($@))])]) m4_define([lt_unquote], $1) # lt_append(MACRO-NAME, STRING, [SEPARATOR]) # ------------------------------------------ # Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'. # Note that neither SEPARATOR nor STRING are expanded; they are appended # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). # No SEPARATOR is output if MACRO-NAME was previously undefined (different # than defined and empty). # # This macro is needed until we can rely on Autoconf 2.62, since earlier # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. m4_define([lt_append], [m4_define([$1], m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) # ---------------------------------------------------------- # Produce a SEP delimited list of all paired combinations of elements of # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list # has the form PREFIXmINFIXSUFFIXn. # Needed until we can rely on m4_combine added in Autoconf 2.62. m4_define([lt_combine], [m4_if(m4_eval([$# > 3]), [1], [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl [[m4_foreach([_Lt_prefix], [$2], [m4_foreach([_Lt_suffix], ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) # ----------------------------------------------------------------------- # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. m4_define([lt_if_append_uniq], [m4_ifdef([$1], [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], [lt_append([$1], [$2], [$3])$4], [$5])], [lt_append([$1], [$2], [$3])$4])]) # lt_dict_add(DICT, KEY, VALUE) # ----------------------------- m4_define([lt_dict_add], [m4_define([$1($2)], [$3])]) # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) # -------------------------------------------- m4_define([lt_dict_add_subkey], [m4_define([$1($2:$3)], [$4])]) # lt_dict_fetch(DICT, KEY, [SUBKEY]) # ---------------------------------- m4_define([lt_dict_fetch], [m4_ifval([$3], m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) # ----------------------------------------------------------------- m4_define([lt_if_dict_fetch], [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], [$5], [$6])]) # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) # -------------------------------------------------------------- m4_define([lt_dict_filter], [m4_if([$5], [], [], [lt_join(m4_quote(m4_default([$4], [[, ]])), lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl ]) # ltversion.m4 -- version numbers -*- Autoconf -*- # # Copyright (C) 2004, 2011-2019, 2021-2022 Free Software Foundation, # Inc. # Written by Scott James Remnant, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # @configure_input@ # serial 4245 ltversion.m4 # This file is part of GNU Libtool m4_define([LT_PACKAGE_VERSION], [2.4.7]) m4_define([LT_PACKAGE_REVISION], [2.4.7]) AC_DEFUN([LTVERSION_VERSION], [macro_version='2.4.7' macro_revision='2.4.7' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) # lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # # Copyright (C) 2004-2005, 2007, 2009, 2011-2019, 2021-2022 Free # Software Foundation, Inc. # Written by Scott James Remnant, 2004. # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 5 lt~obsolete.m4 # These exist entirely to fool aclocal when bootstrapping libtool. # # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN), # which have later been changed to m4_define as they aren't part of the # exported API, or moved to Autoconf or Automake where they belong. # # The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN # in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us # using a macro with the same name in our local m4/libtool.m4 it'll # pull the old libtool.m4 in (it doesn't see our shiny new m4_define # and doesn't know about Autoconf macros at all.) # # So we provide this file, which has a silly filename so it's always # included after everything else. This provides aclocal with the # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything # because those macros already exist, or will be overwritten later. # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. # # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. # Yes, that means every name once taken will need to remain here until # we give up compatibility with versions before 1.7, at which point # we need to keep only those names which we still refer to. # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) # Copyright (C) 2002-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.16' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.16.5], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.16.5])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to # '$srcdir', '$srcdir/..', or '$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is '.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], [$1], [CXX], [depcc="$CXX" am_compiler_list=], [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], [$1], [UPC], [depcc="$UPC" am_compiler_list=], [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE([dependency-tracking], [dnl AS_HELP_STRING( [--enable-dependency-tracking], [do not reject slow dependency extractors]) AS_HELP_STRING( [--disable-dependency-tracking], [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. # TODO: see whether this extra hack can be removed once we start # requiring Autoconf 2.70 or later. AS_CASE([$CONFIG_FILES], [*\'*], [eval set x "$CONFIG_FILES"], [*], [set x $CONFIG_FILES]) shift # Used to flag and report bootstrapping failures. am_rc=0 for am_mf do # Strip MF so we end up with the name of the file. am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ || continue am_dirpart=`AS_DIRNAME(["$am_mf"])` am_filepart=`AS_BASENAME(["$am_mf"])` AM_RUN_LOG([cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles]) || am_rc=$? done if test $am_rc -ne 0; then AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments for automatic dependency tracking. If GNU make was not used, consider re-running the configure script with MAKE="gmake" (or whatever is necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking).]) fi AS_UNSET([am_dirpart]) AS_UNSET([am_filepart]) AS_UNSET([am_mf]) AS_UNSET([am_rc]) rm -f conftest-deps.mk } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking is enabled. # This creates each '.Po' and '.Plo' makefile fragment that we'll need in # order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC]) [_AM_PROG_CC_C_O ]) # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl m4_ifdef([_$0_ALREADY_INIT], [m4_fatal([$0 expanded multiple times ]m4_defn([_$0_ALREADY_INIT]))], [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [AC_DIAGNOSE([obsolete], [$0: two- and three-arguments forms are deprecated.]) m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) AM_MISSING_PROG([AUTOCONF], [autoconf]) AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) AM_MISSING_PROG([AUTOHEADER], [autoheader]) AM_MISSING_PROG([MAKEINFO], [makeinfo]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES([CC])], [m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES([CXX])], [m4_define([AC_PROG_CXX], m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES([OBJC])], [m4_define([AC_PROG_OBJC], m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [_AM_DEPENDENCIES([OBJCXX])], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) # Variables for tags utilities; see am/tags.am if test -z "$CTAGS"; then CTAGS=ctags fi AC_SUBST([CTAGS]) if test -z "$ETAGS"; then ETAGS=etags fi AC_SUBST([ETAGS]) if test -z "$CSCOPE"; then CSCOPE=cscope fi AC_SUBST([CSCOPE]) AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) fi fi dnl The trailing newline in this macro's definition is deliberate, for dnl backward compatibility and to allow trailing 'dnl'-style comments dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. ]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST([install_sh])]) # Copyright (C) 2003-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering # Copyright (C) 1996-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAINTAINER_MODE([DEFAULT-MODE]) # ---------------------------------- # Control maintainer-specific portions of Makefiles. # Default is to disable them, unless 'enable' is passed literally. # For symmetry, 'disable' may be passed as well. Anyway, the user # can override the default with the --enable/--disable switch. AC_DEFUN([AM_MAINTAINER_MODE], [m4_case(m4_default([$1], [disable]), [enable], [m4_define([am_maintainer_other], [disable])], [disable], [m4_define([am_maintainer_other], [enable])], [m4_define([am_maintainer_other], [enable]) m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode's default is 'disable' unless 'enable' is passed AC_ARG_ENABLE([maintainer-mode], [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode], am_maintainer_other[ make rules and dependencies not useful (and sometimes confusing) to the casual installer])], [USE_MAINTAINER_MODE=$enableval], [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) AC_MSG_RESULT([$USE_MAINTAINER_MODE]) AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) MAINT=$MAINTAINER_MODE_TRUE AC_SUBST([MAINT])dnl ] ) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAKE_INCLUDE() # ----------------- # Check whether make has an 'include' directive that can support all # the idioms we need for our automatic dependency tracking code. AC_DEFUN([AM_MAKE_INCLUDE], [AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive]) cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out .PHONY: am__doit END am__include="#" am__quote= # BSD make does it like this. echo '.include "confinc.mk" # ignored' > confmf.BSD # Other make implementations (GNU, Solaris 10, AIX) do it like this. echo 'include confinc.mk # ignored' > confmf.GNU _am_result=no for s in GNU BSD; do AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out]) AS_CASE([$?:`cat confinc.out 2>/dev/null`], ['0:this is the am__doit target'], [AS_CASE([$s], [BSD], [am__include='.include' am__quote='"'], [am__include='include' am__quote=''])]) if test "$am__include" != "#"; then _am_result="yes ($s style)" break fi done rm -f confinc.* confmf.* AC_MSG_RESULT([${_am_result}]) AC_SUBST([am__include])]) AC_SUBST([am__quote])]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it is modern enough. # If it is, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= AC_MSG_WARN(['missing' script is too old or missing]) fi ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), [1])]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_CC_C_O # --------------- # Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC # to automatically call this. AC_DEFUN([_AM_PROG_CC_C_O], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl AC_LANG_PUSH([C])dnl AC_CACHE_CHECK( [whether $CC understands -c and -o together], [am_cv_prog_cc_c_o], [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i]) if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) # Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_RUN_LOG(COMMAND) # ------------------- # Run COMMAND, save the exit status in ac_status, and log it. # (This has been adapted from Autoconf's _AC_RUN_LOG macro.) AC_DEFUN([AM_RUN_LOG], [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD (exit $ac_status); }]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi if test "$[2]" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT([yes]) # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi AC_CONFIG_COMMANDS_PRE( [AC_MSG_CHECKING([that generated files are newer than configure]) if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi AC_MSG_RESULT([done])]) rm -f conftest.file ]) # Copyright (C) 2009-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # ("yes" being less verbose, "no" or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) AS_HELP_STRING( [--disable-silent-rules], [verbose build output (undo: "make V=0")])dnl ]) case $enable_silent_rules in @%:@ ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac dnl dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} AC_CACHE_CHECK([whether $am_make supports nested variables], [am_cv_make_support_nested_variables], [if AS_ECHO([['TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi]) if test $am_cv_make_support_nested_variables = yes; then dnl Using '$V' instead of '$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AC_SUBST([AM_V])dnl AM_SUBST_NOTMAKE([AM_V])dnl AC_SUBST([AM_DEFAULT_V])dnl AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor 'install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in "make install-strip", and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of 'v7', 'ustar', or 'pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar # AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar], [# The POSIX 1988 'ustar' format is defined with fixed-size fields. # There is notably a 21 bits limit for the UID and the GID. In fact, # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 # and bug#13588). am_max_uid=2097151 # 2^21 - 1 am_max_gid=$am_max_uid # The $UID and $GID variables are not portable, so we need to resort # to the POSIX-mandated id(1) utility. Errors in the 'id' calls # below are definitely unexpected, so allow the users to see them # (that is, avoid stderr redirection). am_uid=`id -u || echo unknown` am_gid=`id -g || echo unknown` AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) if test $am_uid -le $am_max_uid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) if test $am_gid -le $am_max_gid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi], [pax], [], [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Go ahead even if we have the value already cached. We do so because we # need to set the values for the 'am__tar' and 'am__untar' variables. _am_tools=${am_cv_prog_tar_$1-$_am_tools} for _am_tool in $_am_tools; do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works. rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([acinclude.m4]) unuran-1.11.0/UPGRADE0000644001357500135600000000407614420445767011073 00000000000000 ***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** Important: UNU.RAN now relies on some aspects of IEEE 754 compliant floating point arithmetic. In particular, 1./0. and 0./0. must result in INFINITY and NaN (not a number), respectively, and must not cause a floating point exception. For almost all modern compting architecture this is implemented in hardware. For others there should be a special compiler flag to get this feature (e.g. -MIEEE on DEC alpha or -mp for the Intel C compiler). Upgrading UNU.RAN from version 0.9.x or earlier ............................................... With UNU.RAN version 1.0.x some of the macro definitions in file 'src/unuran_config.h' are moved into file 'config.h' and are set/controlled by the ./configure script. Writting logging information into the logfile must now be enabled when running the configure script: sh ./configure --enable-logging Upgrading UNU.RAN from version 0.7.x or earlier ............................................... With UNU.RAN version 0.8.x the interface for changing underlying distributions and running a reinitialization routine has been simplified. The old routines can be compiled into the library using the following configure flag: sh ./configure --enable-deprecated Notice: Using these deprecated routines is not supported any more and this strong discouraged. Wrapper functions for external sources of uniform random numbers are now enabled by configure flags and not by macros defined in file 'src/unuran_config.h'. The file 'src/unuran_config.h' is not installed any more. It is now only included when the library is compiled. It should be removed from the global include path of the compiler. unuran-1.11.0/Makefile.in0000644001357500135600000007415014430713360012112 00000000000000# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # AUTOMAKE_OPTIONS = VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ $(am__configure_deps) $(am__DIST_COMMON) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ cscope distdir distdir-am dist dist-all distcheck am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) \ config.h.in # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(top_srcdir)/autoconf/compile \ $(top_srcdir)/autoconf/config.guess \ $(top_srcdir)/autoconf/config.sub \ $(top_srcdir)/autoconf/install-sh \ $(top_srcdir)/autoconf/ltmain.sh \ $(top_srcdir)/autoconf/missing AUTHORS COPYING ChangeLog \ INSTALL NEWS README THANKS autoconf/compile \ autoconf/config.guess autoconf/config.sub autoconf/install-sh \ autoconf/ltmain.sh autoconf/missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__post_remove_distdir = $(am__remove_distdir) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best DIST_TARGETS = dist-gzip # Exists only to be overridden by the user if desired. AM_DISTCHECK_DVI_TARGET = dvi distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILECMD = @FILECMD@ GREP = @GREP@ HAVE_DIVIDE_BY_ZERO = @HAVE_DIVIDE_BY_ZERO@ HAVE_IEEE_COMPARISONS = @HAVE_IEEE_COMPARISONS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNURAN_LT_VERSION = @UNURAN_LT_VERSION@ UNURAN_SUPPORTS_GSL = @UNURAN_SUPPORTS_GSL@ UNURAN_SUPPORTS_PRNG = @UNURAN_SUPPORTS_PRNG@ UNURAN_SUPPORTS_RNGSTREAM = @UNURAN_SUPPORTS_RNGSTREAM@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ have_valgrind = @have_valgrind@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = . scripts src examples experiments tests doc DIST_SUBDIRS = $(SUBDIRS) EXTRA_DIST = \ README.win32 \ UPGRADE \ KNOWN-PROBLEMS \ autogen.sh # make special distribution for ROOT rootdir = tmp-unuran-root distrootfile = $(PACKAGE)-$(VERSION)-root.tar.gz remove_rootdir = \ { test ! -d $(rootdir) \ || { find $(rootdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr $(rootdir); }; } # clean backup files CLEANFILES = *~ # clean generated files MAINTAINERCLEANFILES = \ $(srcdir)/Makefile.in \ $(srcdir)/autoconf/compile \ $(srcdir)/autoconf/config.guess \ $(srcdir)/autoconf/config.sub \ $(srcdir)/autoconf/depcomp \ $(srcdir)/autoconf/install-sh \ $(srcdir)/autoconf/ltmain.sh \ $(srcdir)/autoconf/mdate-sh \ $(srcdir)/autoconf/missing \ $(srcdir)/autoconf/test-driver all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: am--refresh: Makefile @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): config.h: stamp-h1 @test -f $@ || rm -f stamp-h1 @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool config.lt # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscope: cscope.files test ! -s cscope.files \ || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) clean-cscope: -rm -f cscope.files cscope.files: clean-cscope cscopelist cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__post_remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__post_remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) dist-zstd: distdir tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst $(am__post_remove_distdir) dist-tarZ: distdir @echo WARNING: "Support for distribution archives compressed with" \ "legacy program 'compress' is deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__post_remove_distdir) dist-shar: distdir @echo WARNING: "Support for shar distribution archives is" \ "deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__post_remove_distdir) dist dist-all: $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' $(am__post_remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ *.tar.zst*) \ zstd -dc $(distdir).tar.zst | $(am__untar) ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build/sub \ && ../../configure \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ --srcdir=../.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__post_remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile config.h installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-hdr \ distclean-libtool distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic \ maintainer-clean-local mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(am__recursive_targets) all install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--refresh check check-am clean clean-cscope clean-generic \ clean-libtool cscope cscopelist-am ctags ctags-am dist \ dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \ dist-xz dist-zip dist-zstd distcheck distclean \ distclean-generic distclean-hdr distclean-libtool \ distclean-tags distcleancheck distdir distuninstallcheck dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs installdirs-am \ maintainer-clean maintainer-clean-generic \ maintainer-clean-local mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am .PRECIOUS: Makefile dist-root: @MAINTAINER_MODE_TRUE@ @echo "Create tar ball for ROOT" | \ @MAINTAINER_MODE_TRUE@ sed 'h;s/./=/g;p;x;p;x' @MAINTAINER_MODE_TRUE@ $(remove_rootdir) @MAINTAINER_MODE_TRUE@ $(MAKE) @MAINTAINER_MODE_TRUE@ $(MAKE) dist @MAINTAINER_MODE_TRUE@ mkdir $(rootdir) @MAINTAINER_MODE_TRUE@ tar zxf $(PACKAGE)-$(VERSION).tar.gz -C $(rootdir) @MAINTAINER_MODE_TRUE@ (cd $(rootdir)/$(PACKAGE)-$(VERSION); \ @MAINTAINER_MODE_TRUE@ sed -e 's/\(AC_INIT(\s*\[unuran\]\s*,\s*\[\)\(.*\)\]\s*,\s*\[/\1\2-root\],\[/' \ @MAINTAINER_MODE_TRUE@ -e 's/\(AM_INIT_AUTOMAKE(\s*\[unuran\]\s*,\s*\[\)\(.*\)\]\s*)/\1\2-root\])/' \ @MAINTAINER_MODE_TRUE@ -e '/^\s*src.*\/Makefile\s*\\/p' -e '/^\s*.*\/Makefile\s*\\/d' \ @MAINTAINER_MODE_TRUE@ < ../../configure.ac > ./configure.ac; \ @MAINTAINER_MODE_TRUE@ sed -e 's/^\s*SUBDIRS\s*=.*/SUBDIRS = \. src/' \ @MAINTAINER_MODE_TRUE@ < ../../Makefile.am > Makefile.am; \ @MAINTAINER_MODE_TRUE@ for f in `find ./src -type f -name '*.[ch]' -o -name '*.ch'`; do \ @MAINTAINER_MODE_TRUE@ ./scripts/remove_comments.pl $$f; \ @MAINTAINER_MODE_TRUE@ done; \ @MAINTAINER_MODE_TRUE@ echo "AC_MSG_NOTICE([ " >> configure.ac; \ @MAINTAINER_MODE_TRUE@ echo "*===================================================" >> configure.ac; \ @MAINTAINER_MODE_TRUE@ echo "*" >> configure.ac; \ @MAINTAINER_MODE_TRUE@ echo "* This is a pure source distribution!" >> configure.ac; \ @MAINTAINER_MODE_TRUE@ echo "*" >> configure.ac; \ @MAINTAINER_MODE_TRUE@ echo "* For a manual, documented sources, tests," >> configure.ac; \ @MAINTAINER_MODE_TRUE@ echo "* and examples please download" >> configure.ac; \ @MAINTAINER_MODE_TRUE@ echo "*" >> configure.ac; \ @MAINTAINER_MODE_TRUE@ echo "* $(PACKAGE)-$(VERSION).tar.gz" >> configure.ac; \ @MAINTAINER_MODE_TRUE@ echo "*" >> configure.ac; \ @MAINTAINER_MODE_TRUE@ echo "*===================================================" >> configure.ac; \ @MAINTAINER_MODE_TRUE@ echo "])" >> configure.ac; \ @MAINTAINER_MODE_TRUE@ autoreconf; ./configure; \ @MAINTAINER_MODE_TRUE@ $(MAKE) dist; \ @MAINTAINER_MODE_TRUE@ ) @MAINTAINER_MODE_TRUE@ cp $(rootdir)/$(PACKAGE)-$(VERSION)/$(PACKAGE)-*.tar.gz . @MAINTAINER_MODE_TRUE@ $(remove_rootdir) @MAINTAINER_MODE_TRUE@ @echo "$(distrootfile) is ready for distribution" | \ @MAINTAINER_MODE_TRUE@ sed 'h;s/./=/g;p;x;p;x' @MAINTAINER_MODE_FALSE@ @echo "You must enable maintainer mode using" @MAINTAINER_MODE_FALSE@ @echo " sh ./configure --enable-maintainer-mode" @MAINTAINER_MODE_FALSE@ @echo "first to run 'make dist-root'!" # compile with almost all GCC warnings enabled @MAINTAINER_MODE_TRUE@setgccWflags: @MAINTAINER_MODE_TRUE@ export CFLAGS="`cat $(top_srcdir)/scripts/gccWflags`"; \ @MAINTAINER_MODE_TRUE@ ./configure --enable-maintainer-mode @MAINTAINER_MODE_TRUE@setgccWflags-ansi: @MAINTAINER_MODE_TRUE@ export CFLAGS="-ansi -pedantic `cat $(top_srcdir)/scripts/gccWflags`"; \ @MAINTAINER_MODE_TRUE@ ./configure --enable-maintainer-mode # run checks in fullcheck mode fullcheck: UNURANFULLCHECK=true $(MAKE) check # Remark: the three files # $(top_srcdir)/aclocal.m4 # $(top_srcdir)/config.h.in # $(top_srcdir)/configure # are removed in doc/Makefile.am. # It cannot be done here as this breaks the cleaning process. # auxiliary directories maintainer-clean-local: rm -rf unuran-win32 @$(remove_rootdir) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: unuran-1.11.0/KNOWN-PROBLEMS0000644001357500135600000000045014420304141012065 00000000000000 (*) Using unur_sample_cont(), unur_sample_discr(), or unur_distr_vec() with a generator object of the wrong distribution type results in undefined behavior or causes a segmentation fault. (*) The String API does not provide the full functionality as the API using function calls. unuran-1.11.0/AUTHORS0000644001357500135600000000026714420445767011127 00000000000000Josef Leydold (josef.leydold@wu.ac.at) Wolfgang Hoermann (hormannw@boun.edu.tr) Erich Janka Guenther Tirler Roman Karawatzki Source code provided by: Ernst Stadlober Renee Touzinunuran-1.11.0/Makefile.am0000644001357500135600000000644714430713333012105 00000000000000## Process this file with automake to produce Makefile.in # AUTOMAKE_OPTIONS = SUBDIRS = . scripts src examples experiments tests doc DIST_SUBDIRS = $(SUBDIRS) EXTRA_DIST = \ README.win32 \ UPGRADE \ KNOWN-PROBLEMS \ autogen.sh # make special distribution for ROOT rootdir = tmp-unuran-root distrootfile = $(PACKAGE)-$(VERSION)-root.tar.gz remove_rootdir = \ { test ! -d $(rootdir) \ || { find $(rootdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr $(rootdir); }; } dist-root: if MAINTAINER_MODE @echo "Create tar ball for ROOT" | \ sed 'h;s/./=/g;p;x;p;x' $(remove_rootdir) $(MAKE) $(MAKE) dist mkdir $(rootdir) tar zxf $(PACKAGE)-$(VERSION).tar.gz -C $(rootdir) (cd $(rootdir)/$(PACKAGE)-$(VERSION); \ sed -e 's/\(AC_INIT(\s*\[unuran\]\s*,\s*\[\)\(.*\)\]\s*,\s*\[/\1\2-root\],\[/' \ -e 's/\(AM_INIT_AUTOMAKE(\s*\[unuran\]\s*,\s*\[\)\(.*\)\]\s*)/\1\2-root\])/' \ -e '/^\s*src.*\/Makefile\s*\\/p' -e '/^\s*.*\/Makefile\s*\\/d' \ < ../../configure.ac > ./configure.ac; \ sed -e 's/^\s*SUBDIRS\s*=.*/SUBDIRS = \. src/' \ < ../../Makefile.am > Makefile.am; \ for f in `find ./src -type f -name '*.[ch]' -o -name '*.ch'`; do \ ./scripts/remove_comments.pl $$f; \ done; \ echo "AC_MSG_NOTICE([ " >> configure.ac; \ echo "*===================================================" >> configure.ac; \ echo "*" >> configure.ac; \ echo "* This is a pure source distribution!" >> configure.ac; \ echo "*" >> configure.ac; \ echo "* For a manual, documented sources, tests," >> configure.ac; \ echo "* and examples please download" >> configure.ac; \ echo "*" >> configure.ac; \ echo "* $(PACKAGE)-$(VERSION).tar.gz" >> configure.ac; \ echo "*" >> configure.ac; \ echo "*===================================================" >> configure.ac; \ echo "])" >> configure.ac; \ autoreconf; ./configure; \ $(MAKE) dist; \ ) cp $(rootdir)/$(PACKAGE)-$(VERSION)/$(PACKAGE)-*.tar.gz . $(remove_rootdir) @echo "$(distrootfile) is ready for distribution" | \ sed 'h;s/./=/g;p;x;p;x' else @echo "You must enable maintainer mode using" @echo " sh ./configure --enable-maintainer-mode" @echo "first to run 'make dist-root'!" endif # compile with almost all GCC warnings enabled if MAINTAINER_MODE setgccWflags: export CFLAGS="`cat $(top_srcdir)/scripts/gccWflags`"; \ ./configure --enable-maintainer-mode setgccWflags-ansi: export CFLAGS="-ansi -pedantic `cat $(top_srcdir)/scripts/gccWflags`"; \ ./configure --enable-maintainer-mode endif # run checks in fullcheck mode fullcheck: UNURANFULLCHECK=true $(MAKE) check # clean backup files CLEANFILES = *~ # clean generated files MAINTAINERCLEANFILES = \ $(srcdir)/Makefile.in \ $(srcdir)/autoconf/compile \ $(srcdir)/autoconf/config.guess \ $(srcdir)/autoconf/config.sub \ $(srcdir)/autoconf/depcomp \ $(srcdir)/autoconf/install-sh \ $(srcdir)/autoconf/ltmain.sh \ $(srcdir)/autoconf/mdate-sh \ $(srcdir)/autoconf/missing \ $(srcdir)/autoconf/test-driver # Remark: the three files # $(top_srcdir)/aclocal.m4 # $(top_srcdir)/config.h.in # $(top_srcdir)/configure # are removed in doc/Makefile.am. # It cannot be done here as this breaks the cleaning process. # auxiliary directories maintainer-clean-local: rm -rf unuran-win32 @$(remove_rootdir) unuran-1.11.0/README.win320000644001357500135600000000125414420445767011675 00000000000000You can create a MS Windows(R) DLL using Cygwin[1] and MS Visual Studio 2005 [2]: 1. Edit path variables 'VSCYG' and 'VCWIN' in file './scripts/win32/build.sh' (The distributed files contains the default pathes of Cygwin and MS Visual Studio). 2. Run './scripts/win32/build.sh' 3. The created files can be then found in directory 'unuran-win32': libunuran.dll libunuran.dll.manifest libunuran.def libunuran.lib libunuran.exp unuran.h 4. Applications also have to be linked against the runtime library 'msvcr80.dll' (included in the MS Visual Studio tree). References: [1] http://www.cygwin.com/ [2] http://msdn2.microsoft.com/en-us/vstudio/default.aspxunuran-1.11.0/autoconf/0000755001357500135600000000000014430713526011740 500000000000000unuran-1.11.0/autoconf/mdate-sh0000755001357500135600000001373214224072466013320 00000000000000#!/bin/sh # Get modification time of a file or directory and pretty-print it. scriptversion=2018-03-07.03; # UTC # Copyright (C) 1995-2021 Free Software Foundation, Inc. # written by Ulrich Drepper , June 1995 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST fi case $1 in '') echo "$0: No file. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: mdate-sh [--help] [--version] FILE Pretty-print the modification day of FILE, in the format: 1 January 1970 Report bugs to . EOF exit $? ;; -v | --v*) echo "mdate-sh $scriptversion" exit $? ;; esac error () { echo "$0: $1" >&2 exit 1 } # Prevent date giving response in another language. LANG=C export LANG LC_ALL=C export LC_ALL LC_TIME=C export LC_TIME # Use UTC to get reproducible result. TZ=UTC0 export TZ # GNU ls changes its time format in response to the TIME_STYLE # variable. Since we cannot assume 'unset' works, revert this # variable to its documented default. if test "${TIME_STYLE+set}" = set; then TIME_STYLE=posix-long-iso export TIME_STYLE fi save_arg1=$1 # Find out how to get the extended ls output of a file or directory. if ls -L /dev/null 1>/dev/null 2>&1; then ls_command='ls -L -l -d' else ls_command='ls -l -d' fi # Avoid user/group names that might have spaces, when possible. if ls -n /dev/null 1>/dev/null 2>&1; then ls_command="$ls_command -n" fi # A 'ls -l' line looks as follows on OS/2. # drwxrwx--- 0 Aug 11 2001 foo # This differs from Unix, which adds ownership information. # drwxrwx--- 2 root root 4096 Aug 11 2001 foo # # To find the date, we split the line on spaces and iterate on words # until we find a month. This cannot work with files whose owner is a # user named "Jan", or "Feb", etc. However, it's unlikely that '/' # will be owned by a user whose name is a month. So we first look at # the extended ls output of the root directory to decide how many # words should be skipped to get the date. # On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below. set x`$ls_command /` # Find which argument is the month. month= command= until test $month do test $# -gt 0 || error "failed parsing '$ls_command /' output" shift # Add another shift to the command. command="$command shift;" case $1 in Jan) month=January; nummonth=1;; Feb) month=February; nummonth=2;; Mar) month=March; nummonth=3;; Apr) month=April; nummonth=4;; May) month=May; nummonth=5;; Jun) month=June; nummonth=6;; Jul) month=July; nummonth=7;; Aug) month=August; nummonth=8;; Sep) month=September; nummonth=9;; Oct) month=October; nummonth=10;; Nov) month=November; nummonth=11;; Dec) month=December; nummonth=12;; esac done test -n "$month" || error "failed parsing '$ls_command /' output" # Get the extended ls output of the file or directory. set dummy x`eval "$ls_command \"\\\$save_arg1\""` # Remove all preceding arguments eval $command # Because of the dummy argument above, month is in $2. # # On a POSIX system, we should have # # $# = 5 # $1 = file size # $2 = month # $3 = day # $4 = year or time # $5 = filename # # On Darwin 7.7.0 and 7.6.0, we have # # $# = 4 # $1 = day # $2 = month # $3 = year or time # $4 = filename # Get the month. case $2 in Jan) month=January; nummonth=1;; Feb) month=February; nummonth=2;; Mar) month=March; nummonth=3;; Apr) month=April; nummonth=4;; May) month=May; nummonth=5;; Jun) month=June; nummonth=6;; Jul) month=July; nummonth=7;; Aug) month=August; nummonth=8;; Sep) month=September; nummonth=9;; Oct) month=October; nummonth=10;; Nov) month=November; nummonth=11;; Dec) month=December; nummonth=12;; esac case $3 in ???*) day=$1;; *) day=$3; shift;; esac # Here we have to deal with the problem that the ls output gives either # the time of day or the year. case $3 in *:*) set `date`; eval year=\$$# case $2 in Jan) nummonthtod=1;; Feb) nummonthtod=2;; Mar) nummonthtod=3;; Apr) nummonthtod=4;; May) nummonthtod=5;; Jun) nummonthtod=6;; Jul) nummonthtod=7;; Aug) nummonthtod=8;; Sep) nummonthtod=9;; Oct) nummonthtod=10;; Nov) nummonthtod=11;; Dec) nummonthtod=12;; esac # For the first six month of the year the time notation can also # be used for files modified in the last year. if (expr $nummonth \> $nummonthtod) > /dev/null; then year=`expr $year - 1` fi;; *) year=$3;; esac # The result. echo $day $month $year # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: unuran-1.11.0/autoconf/test-driver0000755001357500135600000001141714224072466014064 00000000000000#! /bin/sh # test-driver - basic testsuite driver script. scriptversion=2018-03-07.03; # UTC # Copyright (C) 2011-2021 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . # Make unconditional expansion of undefined variables an error. This # helps a lot in preventing typo-related bugs. set -u usage_error () { echo "$0: $*" >&2 print_usage >&2 exit 2 } print_usage () { cat <"$log_file" "$@" >>"$log_file" 2>&1 estatus=$? if test $enable_hard_errors = no && test $estatus -eq 99; then tweaked_estatus=1 else tweaked_estatus=$estatus fi case $tweaked_estatus:$expect_failure in 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; 0:*) col=$grn res=PASS recheck=no gcopy=no;; 77:*) col=$blu res=SKIP recheck=no gcopy=yes;; 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;; *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;; *:*) col=$red res=FAIL recheck=yes gcopy=yes;; esac # Report the test outcome and exit status in the logs, so that one can # know whether the test passed or failed simply by looking at the '.log' # file, without the need of also peaking into the corresponding '.trs' # file (automake bug#11814). echo "$res $test_name (exit status: $estatus)" >>"$log_file" # Report outcome to console. echo "${col}${res}${std}: $test_name" # Register the test result, and other relevant metadata. echo ":test-result: $res" > $trs_file echo ":global-test-result: $res" >> $trs_file echo ":recheck: $recheck" >> $trs_file echo ":copy-in-global-log: $gcopy" >> $trs_file # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: unuran-1.11.0/autoconf/install-sh0000755001357500135600000003577614224072466013710 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2020-11-14.01; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # 'make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. tab=' ' nl=' ' IFS=" $tab$nl" # Set DOITPROG to "echo" to test this script. doit=${DOITPROG-} doit_exec=${doit:-exec} # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_mkdir= # Desired mode of installed file. mode=0755 # Create dirs (including intermediate dirs) using mode 755. # This is like GNU 'install' as of coreutils 8.32 (2020). mkdir_umask=22 backupsuffix= chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false is_target_a_directory=possibly usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -p pass -p to $cpprog. -s $stripprog installed files. -S SUFFIX attempt to back up existing files, with suffix SUFFIX. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG By default, rm is invoked with -f; when overridden with RMPROG, it's up to you to specify -f if you want it. If -S is not specified, no backups are attempted. Email bug reports to bug-automake@gnu.org. Automake home page: https://www.gnu.org/software/automake/ " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -p) cpprog="$cpprog -p";; -s) stripcmd=$stripprog;; -S) backupsuffix="$2" shift;; -t) is_target_a_directory=always dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) is_target_a_directory=never;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done # We allow the use of options -d and -T together, by making -d # take the precedence; this is for compatibility with GNU install. if test -n "$dir_arg"; then if test -n "$dst_arg"; then echo "$0: target directory not allowed when installing a directory." >&2 exit 1 fi fi if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then if test $# -gt 1 || test "$is_target_a_directory" = always; then if test ! -d "$dst_arg"; then echo "$0: $dst_arg: Is not a directory." >&2 exit 1 fi fi fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? # Don't chown directories that already exist. if test $dstdir_status = 0; then chowncmd="" fi else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename. if test -d "$dst"; then if test "$is_target_a_directory" = never; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dstbase=`basename "$src"` case $dst in */) dst=$dst$dstbase;; *) dst=$dst/$dstbase;; esac dstdir_status=0 else dstdir=`dirname "$dst"` test -d "$dstdir" dstdir_status=$? fi fi case $dstdir in */) dstdirslash=$dstdir;; *) dstdirslash=$dstdir/;; esac obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false # The $RANDOM variable is not portable (e.g., dash). Use it # here however when possible just to lower collision chance. tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap ' ret=$? rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null exit $ret ' 0 # Because "mkdir -p" follows existing symlinks and we likely work # directly in world-writeable /tmp, make sure that the '$tmpdir' # directory is successfully created first before we actually test # 'mkdir -p'. if (umask $mkdir_umask && $mkdirprog $mkdir_mode "$tmpdir" && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. test_tmpdir="$tmpdir/a" ls_ld_tmpdir=`ls -ld "$test_tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null fi trap '' 0;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac oIFS=$IFS IFS=/ set -f set fnord $dstdir shift set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=${dstdirslash}_inst.$$_ rmtmp=${dstdirslash}_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && { test -z "$stripcmd" || { # Create $dsttmp read-write so that cp doesn't create it read-only, # which would cause strip to fail. if test -z "$doit"; then : >"$dsttmp" # No need to fork-exec 'touch'. else $doit touch "$dsttmp" fi } } && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # If $backupsuffix is set, and the file being installed # already exists, attempt a backup. Don't worry if it fails, # e.g., if mv doesn't support -f. if test -n "$backupsuffix" && test -f "$dst"; then $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null fi # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: unuran-1.11.0/autoconf/config.sub0000755001357500135600000010575314343322277013660 00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2022 Free Software Foundation, Inc. # shellcheck disable=SC2006,SC2268 # see below for rationale timestamp='2022-09-17' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # https://git.savannah.gnu.org/cgit/config.git/plain/config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. # The "shellcheck disable" line above the timestamp inhibits complaints # about features and limitations of the classic Bourne shell that were # superseded or lifted in POSIX. However, this script identifies a wide # variety of pre-POSIX systems that do not have POSIX shells at all, and # even some reasonably current systems (Solaris 10 as case-in-point) still # have a pre-POSIX /bin/sh. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2022 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; *local*) # First pass through any local machine types. echo "$1" exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Split fields of configuration type # shellcheck disable=SC2162 saved_IFS=$IFS IFS="-" read field1 field2 field3 field4 <&2 exit 1 ;; *-*-*-*) basic_machine=$field1-$field2 basic_os=$field3-$field4 ;; *-*-*) # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two # parts maybe_os=$field2-$field3 case $maybe_os in nto-qnx* | linux-* | uclinux-uclibc* \ | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ | storm-chaos* | os2-emx* | rtmk-nova* | managarm-*) basic_machine=$field1 basic_os=$maybe_os ;; android-linux) basic_machine=$field1-unknown basic_os=linux-android ;; *) basic_machine=$field1-$field2 basic_os=$field3 ;; esac ;; *-*) # A lone config we happen to match not fitting any pattern case $field1-$field2 in decstation-3100) basic_machine=mips-dec basic_os= ;; *-*) # Second component is usually, but not always the OS case $field2 in # Prevent following clause from handling this valid os sun*os*) basic_machine=$field1 basic_os=$field2 ;; zephyr*) basic_machine=$field1-unknown basic_os=$field2 ;; # Manufacturers dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ | unicom* | ibm* | next | hp | isi* | apollo | altos* \ | convergent* | ncr* | news | 32* | 3600* | 3100* \ | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ | ultra | tti* | harris | dolphin | highlevel | gould \ | cbm | ns | masscomp | apple | axis | knuth | cray \ | microblaze* | sim | cisco \ | oki | wec | wrs | winbond) basic_machine=$field1-$field2 basic_os= ;; *) basic_machine=$field1 basic_os=$field2 ;; esac ;; esac ;; *) # Convert single-component short-hands not valid as part of # multi-component configurations. case $field1 in 386bsd) basic_machine=i386-pc basic_os=bsd ;; a29khif) basic_machine=a29k-amd basic_os=udi ;; adobe68k) basic_machine=m68010-adobe basic_os=scout ;; alliant) basic_machine=fx80-alliant basic_os= ;; altos | altos3068) basic_machine=m68k-altos basic_os= ;; am29k) basic_machine=a29k-none basic_os=bsd ;; amdahl) basic_machine=580-amdahl basic_os=sysv ;; amiga) basic_machine=m68k-unknown basic_os= ;; amigaos | amigados) basic_machine=m68k-unknown basic_os=amigaos ;; amigaunix | amix) basic_machine=m68k-unknown basic_os=sysv4 ;; apollo68) basic_machine=m68k-apollo basic_os=sysv ;; apollo68bsd) basic_machine=m68k-apollo basic_os=bsd ;; aros) basic_machine=i386-pc basic_os=aros ;; aux) basic_machine=m68k-apple basic_os=aux ;; balance) basic_machine=ns32k-sequent basic_os=dynix ;; blackfin) basic_machine=bfin-unknown basic_os=linux ;; cegcc) basic_machine=arm-unknown basic_os=cegcc ;; convex-c1) basic_machine=c1-convex basic_os=bsd ;; convex-c2) basic_machine=c2-convex basic_os=bsd ;; convex-c32) basic_machine=c32-convex basic_os=bsd ;; convex-c34) basic_machine=c34-convex basic_os=bsd ;; convex-c38) basic_machine=c38-convex basic_os=bsd ;; cray) basic_machine=j90-cray basic_os=unicos ;; crds | unos) basic_machine=m68k-crds basic_os= ;; da30) basic_machine=m68k-da30 basic_os= ;; decstation | pmax | pmin | dec3100 | decstatn) basic_machine=mips-dec basic_os= ;; delta88) basic_machine=m88k-motorola basic_os=sysv3 ;; dicos) basic_machine=i686-pc basic_os=dicos ;; djgpp) basic_machine=i586-pc basic_os=msdosdjgpp ;; ebmon29k) basic_machine=a29k-amd basic_os=ebmon ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson basic_os=ose ;; gmicro) basic_machine=tron-gmicro basic_os=sysv ;; go32) basic_machine=i386-pc basic_os=go32 ;; h8300hms) basic_machine=h8300-hitachi basic_os=hms ;; h8300xray) basic_machine=h8300-hitachi basic_os=xray ;; h8500hms) basic_machine=h8500-hitachi basic_os=hms ;; harris) basic_machine=m88k-harris basic_os=sysv3 ;; hp300 | hp300hpux) basic_machine=m68k-hp basic_os=hpux ;; hp300bsd) basic_machine=m68k-hp basic_os=bsd ;; hppaosf) basic_machine=hppa1.1-hp basic_os=osf ;; hppro) basic_machine=hppa1.1-hp basic_os=proelf ;; i386mach) basic_machine=i386-mach basic_os=mach ;; isi68 | isi) basic_machine=m68k-isi basic_os=sysv ;; m68knommu) basic_machine=m68k-unknown basic_os=linux ;; magnum | m3230) basic_machine=mips-mips basic_os=sysv ;; merlin) basic_machine=ns32k-utek basic_os=sysv ;; mingw64) basic_machine=x86_64-pc basic_os=mingw64 ;; mingw32) basic_machine=i686-pc basic_os=mingw32 ;; mingw32ce) basic_machine=arm-unknown basic_os=mingw32ce ;; monitor) basic_machine=m68k-rom68k basic_os=coff ;; morphos) basic_machine=powerpc-unknown basic_os=morphos ;; moxiebox) basic_machine=moxie-unknown basic_os=moxiebox ;; msdos) basic_machine=i386-pc basic_os=msdos ;; msys) basic_machine=i686-pc basic_os=msys ;; mvs) basic_machine=i370-ibm basic_os=mvs ;; nacl) basic_machine=le32-unknown basic_os=nacl ;; ncr3000) basic_machine=i486-ncr basic_os=sysv4 ;; netbsd386) basic_machine=i386-pc basic_os=netbsd ;; netwinder) basic_machine=armv4l-rebel basic_os=linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony basic_os=newsos ;; news1000) basic_machine=m68030-sony basic_os=newsos ;; necv70) basic_machine=v70-nec basic_os=sysv ;; nh3000) basic_machine=m68k-harris basic_os=cxux ;; nh[45]000) basic_machine=m88k-harris basic_os=cxux ;; nindy960) basic_machine=i960-intel basic_os=nindy ;; mon960) basic_machine=i960-intel basic_os=mon960 ;; nonstopux) basic_machine=mips-compaq basic_os=nonstopux ;; os400) basic_machine=powerpc-ibm basic_os=os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson basic_os=ose ;; os68k) basic_machine=m68k-none basic_os=os68k ;; paragon) basic_machine=i860-intel basic_os=osf ;; parisc) basic_machine=hppa-unknown basic_os=linux ;; psp) basic_machine=mipsallegrexel-sony basic_os=psp ;; pw32) basic_machine=i586-unknown basic_os=pw32 ;; rdos | rdos64) basic_machine=x86_64-pc basic_os=rdos ;; rdos32) basic_machine=i386-pc basic_os=rdos ;; rom68k) basic_machine=m68k-rom68k basic_os=coff ;; sa29200) basic_machine=a29k-amd basic_os=udi ;; sei) basic_machine=mips-sei basic_os=seiux ;; sequent) basic_machine=i386-sequent basic_os= ;; sps7) basic_machine=m68k-bull basic_os=sysv2 ;; st2000) basic_machine=m68k-tandem basic_os= ;; stratus) basic_machine=i860-stratus basic_os=sysv4 ;; sun2) basic_machine=m68000-sun basic_os= ;; sun2os3) basic_machine=m68000-sun basic_os=sunos3 ;; sun2os4) basic_machine=m68000-sun basic_os=sunos4 ;; sun3) basic_machine=m68k-sun basic_os= ;; sun3os3) basic_machine=m68k-sun basic_os=sunos3 ;; sun3os4) basic_machine=m68k-sun basic_os=sunos4 ;; sun4) basic_machine=sparc-sun basic_os= ;; sun4os3) basic_machine=sparc-sun basic_os=sunos3 ;; sun4os4) basic_machine=sparc-sun basic_os=sunos4 ;; sun4sol2) basic_machine=sparc-sun basic_os=solaris2 ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun basic_os= ;; sv1) basic_machine=sv1-cray basic_os=unicos ;; symmetry) basic_machine=i386-sequent basic_os=dynix ;; t3e) basic_machine=alphaev5-cray basic_os=unicos ;; t90) basic_machine=t90-cray basic_os=unicos ;; toad1) basic_machine=pdp10-xkl basic_os=tops20 ;; tpf) basic_machine=s390x-ibm basic_os=tpf ;; udi29k) basic_machine=a29k-amd basic_os=udi ;; ultra3) basic_machine=a29k-nyu basic_os=sym1 ;; v810 | necv810) basic_machine=v810-nec basic_os=none ;; vaxv) basic_machine=vax-dec basic_os=sysv ;; vms) basic_machine=vax-dec basic_os=vms ;; vsta) basic_machine=i386-pc basic_os=vsta ;; vxworks960) basic_machine=i960-wrs basic_os=vxworks ;; vxworks68) basic_machine=m68k-wrs basic_os=vxworks ;; vxworks29k) basic_machine=a29k-wrs basic_os=vxworks ;; xbox) basic_machine=i686-pc basic_os=mingw32 ;; ymp) basic_machine=ymp-cray basic_os=unicos ;; *) basic_machine=$1 basic_os= ;; esac ;; esac # Decode 1-component or ad-hoc basic machines case $basic_machine in # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) cpu=hppa1.1 vendor=winbond ;; op50n) cpu=hppa1.1 vendor=oki ;; op60c) cpu=hppa1.1 vendor=oki ;; ibm*) cpu=i370 vendor=ibm ;; orion105) cpu=clipper vendor=highlevel ;; mac | mpw | mac-mpw) cpu=m68k vendor=apple ;; pmac | pmac-mpw) cpu=powerpc vendor=apple ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) cpu=m68000 vendor=att ;; 3b*) cpu=we32k vendor=att ;; bluegene*) cpu=powerpc vendor=ibm basic_os=cnk ;; decsystem10* | dec10*) cpu=pdp10 vendor=dec basic_os=tops10 ;; decsystem20* | dec20*) cpu=pdp10 vendor=dec basic_os=tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) cpu=m68k vendor=motorola ;; dpx2*) cpu=m68k vendor=bull basic_os=sysv3 ;; encore | umax | mmax) cpu=ns32k vendor=encore ;; elxsi) cpu=elxsi vendor=elxsi basic_os=${basic_os:-bsd} ;; fx2800) cpu=i860 vendor=alliant ;; genix) cpu=ns32k vendor=ns ;; h3050r* | hiux*) cpu=hppa1.1 vendor=hitachi basic_os=hiuxwe2 ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) cpu=m68000 vendor=hp ;; hp9k3[2-9][0-9]) cpu=m68k vendor=hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) cpu=hppa1.1 vendor=hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp cpu=hppa1.1 vendor=hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp cpu=hppa1.1 vendor=hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) cpu=hppa1.1 vendor=hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; i*86v32) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc basic_os=sysv32 ;; i*86v4*) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc basic_os=sysv4 ;; i*86v) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc basic_os=sysv ;; i*86sol2) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc basic_os=solaris2 ;; j90 | j90-cray) cpu=j90 vendor=cray basic_os=${basic_os:-unicos} ;; iris | iris4d) cpu=mips vendor=sgi case $basic_os in irix*) ;; *) basic_os=irix4 ;; esac ;; miniframe) cpu=m68000 vendor=convergent ;; *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) cpu=m68k vendor=atari basic_os=mint ;; news-3600 | risc-news) cpu=mips vendor=sony basic_os=newsos ;; next | m*-next) cpu=m68k vendor=next case $basic_os in openstep*) ;; nextstep*) ;; ns2*) basic_os=nextstep2 ;; *) basic_os=nextstep3 ;; esac ;; np1) cpu=np1 vendor=gould ;; op50n-* | op60c-*) cpu=hppa1.1 vendor=oki basic_os=proelf ;; pa-hitachi) cpu=hppa1.1 vendor=hitachi basic_os=hiuxwe2 ;; pbd) cpu=sparc vendor=tti ;; pbb) cpu=m68k vendor=tti ;; pc532) cpu=ns32k vendor=pc532 ;; pn) cpu=pn vendor=gould ;; power) cpu=power vendor=ibm ;; ps2) cpu=i386 vendor=ibm ;; rm[46]00) cpu=mips vendor=siemens ;; rtpc | rtpc-*) cpu=romp vendor=ibm ;; sde) cpu=mipsisa32 vendor=sde basic_os=${basic_os:-elf} ;; simso-wrs) cpu=sparclite vendor=wrs basic_os=vxworks ;; tower | tower-32) cpu=m68k vendor=ncr ;; vpp*|vx|vx-*) cpu=f301 vendor=fujitsu ;; w65) cpu=w65 vendor=wdc ;; w89k-*) cpu=hppa1.1 vendor=winbond basic_os=proelf ;; none) cpu=none vendor=none ;; leon|leon[3-9]) cpu=sparc vendor=$basic_machine ;; leon-*|leon[3-9]-*) cpu=sparc vendor=`echo "$basic_machine" | sed 's/-.*//'` ;; *-*) # shellcheck disable=SC2162 saved_IFS=$IFS IFS="-" read cpu vendor <&2 exit 1 ;; esac ;; esac # Here we canonicalize certain aliases for manufacturers. case $vendor in digital*) vendor=dec ;; commodore*) vendor=cbm ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if test x$basic_os != x then # First recognize some ad-hoc cases, or perhaps split kernel-os, or else just # set os. case $basic_os in gnu/linux*) kernel=linux os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'` ;; os2-emx) kernel=os2 os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'` ;; nto-qnx*) kernel=nto os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'` ;; *-*) # shellcheck disable=SC2162 saved_IFS=$IFS IFS="-" read kernel os <&2 exit 1 ;; esac # As a final step for OS-related things, validate the OS-kernel combination # (given a valid OS), if there is a kernel. case $kernel-$os in linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \ | linux-musl* | linux-relibc* | linux-uclibc* | linux-mlibc* ) ;; uclinux-uclibc* ) ;; managarm-mlibc* | managarm-kernel* ) ;; -dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* | -mlibc* ) # These are just libc implementations, not actual OSes, and thus # require a kernel. echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2 exit 1 ;; -kernel* ) echo "Invalid configuration \`$1': \`$os' needs explicit kernel." 1>&2 exit 1 ;; *-kernel* ) echo "Invalid configuration \`$1': \`$kernel' does not support \`$os'." 1>&2 exit 1 ;; kfreebsd*-gnu* | kopensolaris*-gnu*) ;; vxworks-simlinux | vxworks-simwindows | vxworks-spe) ;; nto-qnx*) ;; os2-emx) ;; *-eabi* | *-gnueabi*) ;; -*) # Blank kernel with real OS is always fine. ;; *-*) echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2 exit 1 ;; esac # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. case $vendor in unknown) case $cpu-$os in *-riscix*) vendor=acorn ;; *-sunos*) vendor=sun ;; *-cnk* | *-aix*) vendor=ibm ;; *-beos*) vendor=be ;; *-hpux*) vendor=hp ;; *-mpeix*) vendor=hp ;; *-hiux*) vendor=hitachi ;; *-unos*) vendor=crds ;; *-dgux*) vendor=dg ;; *-luna*) vendor=omron ;; *-genix*) vendor=ns ;; *-clix*) vendor=intergraph ;; *-mvs* | *-opened*) vendor=ibm ;; *-os400*) vendor=ibm ;; s390-* | s390x-*) vendor=ibm ;; *-ptx*) vendor=sequent ;; *-tpf*) vendor=ibm ;; *-vxsim* | *-vxworks* | *-windiss*) vendor=wrs ;; *-aux*) vendor=apple ;; *-hms*) vendor=hitachi ;; *-mpw* | *-macos*) vendor=apple ;; *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) vendor=atari ;; *-vos*) vendor=stratus ;; esac ;; esac echo "$cpu-$vendor-${kernel:+$kernel-}$os" exit # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: unuran-1.11.0/autoconf/compile0000755001357500135600000001635014224072466013245 00000000000000#! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2018-03-07.03; # UTC # Copyright (C) 1999-2021 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' # We need space, tab and new line, in precisely that order. Quoting is # there to prevent tools from complaining about whitespace usage. IFS=" "" $nl" file_conv= # func_file_conv build_file lazy # Convert a $build file to $host form and store it in $file # Currently only supports Windows hosts. If the determined conversion # type is listed in (the comma separated) LAZY, no conversion will # take place. func_file_conv () { file=$1 case $file in / | /[!/]*) # absolute file, and not a UNC file if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in MINGW*) file_conv=mingw ;; CYGWIN* | MSYS*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv/,$2, in *,$file_conv,*) ;; mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin/* | msys/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_cl_dashL linkdir # Make cl look for libraries in LINKDIR func_cl_dashL () { func_file_conv "$1" if test -z "$lib_path"; then lib_path=$file else lib_path="$lib_path;$file" fi linker_opts="$linker_opts -LIBPATH:$file" } # func_cl_dashl library # Do a library search-path lookup for cl func_cl_dashl () { lib=$1 found=no save_IFS=$IFS IFS=';' for dir in $lib_path $LIB do IFS=$save_IFS if $shared && test -f "$dir/$lib.dll.lib"; then found=yes lib=$dir/$lib.dll.lib break fi if test -f "$dir/$lib.lib"; then found=yes lib=$dir/$lib.lib break fi if test -f "$dir/lib$lib.a"; then found=yes lib=$dir/lib$lib.a break fi done IFS=$save_IFS if test "$found" != yes; then lib=$lib.lib fi } # func_cl_wrapper cl arg... # Adjust compile command to suit cl func_cl_wrapper () { # Assume a capable shell lib_path= shared=: linker_opts= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. eat=1 case $2 in *.o | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift ;; *) func_file_conv "$2" set x "$@" -Fe"$file" shift ;; esac ;; -I) eat=1 func_file_conv "$2" mingw set x "$@" -I"$file" shift ;; -I*) func_file_conv "${1#-I}" mingw set x "$@" -I"$file" shift ;; -l) eat=1 func_cl_dashl "$2" set x "$@" "$lib" shift ;; -l*) func_cl_dashl "${1#-l}" set x "$@" "$lib" shift ;; -L) eat=1 func_cl_dashL "$2" ;; -L*) func_cl_dashL "${1#-L}" ;; -static) shared=false ;; -Wl,*) arg=${1#-Wl,} save_ifs="$IFS"; IFS=',' for flag in $arg; do IFS="$save_ifs" linker_opts="$linker_opts $flag" done IFS="$save_ifs" ;; -Xlinker) eat=1 linker_opts="$linker_opts $2" ;; -*) set x "$@" "$1" shift ;; *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" set x "$@" -Tp"$file" shift ;; *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) func_file_conv "$1" mingw set x "$@" "$file" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -n "$linker_opts"; then linker_opts="-link$linker_opts" fi exec "$@" $linker_opts exit 1 } eat= case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand '-c -o'. Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file 'INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \ icl | *[/\\]icl | icl.exe | *[/\\]icl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac ofile= cfile= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. # So we strip '-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no '-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # '.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. # Note: use '[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: unuran-1.11.0/autoconf/depcomp0000755001357500135600000005602014224072466013242 00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2018-03-07.03; # UTC # Copyright (C) 1999-2021 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # Get the directory component of the given path, and save it in the # global variables '$dir'. Note that this directory component will # be either empty or ending with a '/' character. This is deliberate. set_dir_from () { case $1 in */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; *) dir=;; esac } # Get the suffix-stripped basename of the given path, and save it the # global variable '$base'. set_base_from () { base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` } # If no dependency file was actually created by the compiler invocation, # we still have to create a dummy depfile, to avoid errors with the # Makefile "include basename.Plo" scheme. make_dummy_depfile () { echo "#dummy" > "$depfile" } # Factor out some common post-processing of the generated depfile. # Requires the auxiliary global variable '$tmpdepfile' to be set. aix_post_process_depfile () { # If the compiler actually managed to produce a dependency file, # post-process it. if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependency.h'. # Do two passes, one to just change these to # $object: dependency.h # and one to simply output # dependency.h: # which is needed to avoid the deleted-header problem. { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" } > "$depfile" rm -f "$tmpdepfile" else make_dummy_depfile fi } # A tabulation character. tab=' ' # A newline character. nl=' ' # Character ranges might be problematic outside the C locale. # These definitions help. upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ lower=abcdefghijklmnopqrstuvwxyz digits=0123456789 alpha=${upper}${lower} if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Avoid interferences from the environment. gccflag= dashmflag= # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. gccflag=-qmakedep=gcc,-MF depmode=gcc fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. ## (see the conditional assignment to $gccflag above). ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). Also, it might not be ## supported by the other compilers which use the 'gcc' depmode. ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The second -e expression handles DOS-style file names with drive # letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ | tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" ;; xlc) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done aix_post_process_depfile ;; tcc) # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 # FIXME: That version still under development at the moment of writing. # Make that this statement remains true also for stable, released # versions. # It will wrap lines (doesn't matter whether long or short) with a # trailing '\', as in: # # foo.o : \ # foo.c \ # foo.h \ # # It will put a trailing '\' even on the last line, and will use leading # spaces rather than leading tabs (at least since its commit 0394caf7 # "Emit spaces for -MD"). "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. # We have to change lines of the first kind to '$object: \'. sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" # And for each line of the second kind, we have to emit a 'dep.h:' # dummy dependency, to avoid the deleted-header problem. sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; ## The order of this option in the case statement is important, since the ## shell code in configure will try each of these formats in the order ## listed in this file. A plain '-MD' option would be understood by many ## compilers, so we must ensure this comes after the gcc and icc options. pgcc) # Portland's C compiler understands '-MD'. # Will always output deps to 'file.d' where file is the root name of the # source file under compilation, even if file resides in a subdirectory. # The object file name does not affect the name of the '.d' file. # pgcc 10.2 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\' : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... set_dir_from "$object" # Use the source, not the object, to determine the base name, since # that's sadly what pgcc will do too. set_base_from "$source" tmpdepfile=$base.d # For projects that build the same source file twice into different object # files, the pgcc approach of using the *source* file root name can cause # problems in parallel builds. Use a locking strategy to avoid stomping on # the same $tmpdepfile. lockdir=$base.d-lock trap " echo '$0: caught signal, cleaning up...' >&2 rmdir '$lockdir' exit 1 " 1 2 13 15 numtries=100 i=$numtries while test $i -gt 0; do # mkdir is a portable test-and-set. if mkdir "$lockdir" 2>/dev/null; then # This process acquired the lock. "$@" -MD stat=$? # Release the lock. rmdir "$lockdir" break else # If the lock is being held by a different process, wait # until the winning process is done or we timeout. while test -d "$lockdir" && test $i -gt 0; do sleep 1 i=`expr $i - 1` done fi i=`expr $i - 1` done trap - 1 2 13 15 if test $i -le 0; then echo "$0: failed to acquire lock after $numtries attempts" >&2 echo "$0: check lockdir '$lockdir'" >&2 exit 1 fi if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in 'foo.d' instead, so we check for that too. # Subdirectories are respected. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then # Libtool generates 2 separate objects for the 2 libraries. These # two compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir$base.o.d # libtool 1.5 tmpdepfile2=$dir.libs/$base.o.d # Likewise. tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d "$@" -MD fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done # Same post-processing that is required for AIX mode. aix_post_process_depfile ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" echo >> "$depfile" # make sure the fragment doesn't end with a backslash rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this sed invocation # correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process the last invocation # correctly. Breaking it into two sed invocations is a workaround. sed '1,2d' "$tmpdepfile" \ | tr ' ' "$nl" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E \ | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: unuran-1.11.0/autoconf/ltmain.sh0000644001357500135600000121316514364754672013526 00000000000000#! /usr/bin/env sh ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in ## by inline-source v2019-02-19.15 # libtool (GNU libtool) 2.4.7 # Provide generalized library-building support services. # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996-2019, 2021-2022 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . PROGRAM=libtool PACKAGE=libtool VERSION=2.4.7 package_revision=2.4.7 ## ------ ## ## Usage. ## ## ------ ## # Run './libtool --help' for help with using this script from the # command line. ## ------------------------------- ## ## User overridable command paths. ## ## ------------------------------- ## # After configure completes, it has a better idea of some of the # shell tools we need than the defaults used by the functions shared # with bootstrap, so set those here where they can still be over- # ridden by the user, but otherwise take precedence. : ${AUTOCONF="autoconf"} : ${AUTOMAKE="automake"} ## -------------------------- ## ## Source external libraries. ## ## -------------------------- ## # Much of our low-level functionality needs to be sourced from external # libraries, which are installed to $pkgauxdir. # Set a version string for this script. scriptversion=2019-02-19.15; # UTC # General shell script boiler plate, and helper functions. # Written by Gary V. Vaughan, 2004 # This is free software. There is NO warranty; not even for # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # Copyright (C) 2004-2019, 2021 Bootstrap Authors # # This file is dual licensed under the terms of the MIT license # , and GPL version 2 or later # . You must apply one of # these licenses when using or redistributing this software or any of # the files within it. See the URLs above, or the file `LICENSE` # included in the Bootstrap distribution for the full license texts. # Please report bugs or propose patches to: # ## ------ ## ## Usage. ## ## ------ ## # Evaluate this file near the top of your script to gain access to # the functions and variables defined here: # # . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh # # If you need to override any of the default environment variable # settings, do that before evaluating this file. ## -------------------- ## ## Shell normalisation. ## ## -------------------- ## # Some shells need a little help to be as Bourne compatible as possible. # Before doing anything else, make sure all that help has been provided! DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # NLS nuisances: We save the old values in case they are required later. _G_user_locale= _G_safe_locale= for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test set = \"\${$_G_var+set}\"; then save_$_G_var=\$$_G_var $_G_var=C export $_G_var _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\" _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\" fi" done # These NLS vars are set unconditionally (bootstrap issue #24). Unset those # in case the environment reset is needed later and the $save_* variant is not # defined (see the code above). LC_ALL=C LANGUAGE=C export LANGUAGE LC_ALL # Make sure IFS has a sensible default sp=' ' nl=' ' IFS="$sp $nl" # There are apparently some retarded systems that use ';' as a PATH separator! if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # func_unset VAR # -------------- # Portably unset VAR. # In some shells, an 'unset VAR' statement leaves a non-zero return # status if VAR is already unset, which might be problematic if the # statement is used at the end of a function (thus poisoning its return # value) or when 'set -e' is active (causing even a spurious abort of # the script in this case). func_unset () { { eval $1=; (eval unset $1) >/dev/null 2>&1 && eval unset $1 || : ; } } # Make sure CDPATH doesn't cause `cd` commands to output the target dir. func_unset CDPATH # Make sure ${,E,F}GREP behave sanely. func_unset GREP_OPTIONS ## ------------------------- ## ## Locate command utilities. ## ## ------------------------- ## # func_executable_p FILE # ---------------------- # Check that FILE is an executable regular file. func_executable_p () { test -f "$1" && test -x "$1" } # func_path_progs PROGS_LIST CHECK_FUNC [PATH] # -------------------------------------------- # Search for either a program that responds to --version with output # containing "GNU", or else returned by CHECK_FUNC otherwise, by # trying all the directories in PATH with each of the elements of # PROGS_LIST. # # CHECK_FUNC should accept the path to a candidate program, and # set $func_check_prog_result if it truncates its output less than # $_G_path_prog_max characters. func_path_progs () { _G_progs_list=$1 _G_check_func=$2 _G_PATH=${3-"$PATH"} _G_path_prog_max=0 _G_path_prog_found=false _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:} for _G_dir in $_G_PATH; do IFS=$_G_save_IFS test -z "$_G_dir" && _G_dir=. for _G_prog_name in $_G_progs_list; do for _exeext in '' .EXE; do _G_path_prog=$_G_dir/$_G_prog_name$_exeext func_executable_p "$_G_path_prog" || continue case `"$_G_path_prog" --version 2>&1` in *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;; *) $_G_check_func $_G_path_prog func_path_progs_result=$func_check_prog_result ;; esac $_G_path_prog_found && break 3 done done done IFS=$_G_save_IFS test -z "$func_path_progs_result" && { echo "no acceptable sed could be found in \$PATH" >&2 exit 1 } } # We want to be able to use the functions in this file before configure # has figured out where the best binaries are kept, which means we have # to search for them ourselves - except when the results are already set # where we skip the searches. # Unless the user overrides by setting SED, search the path for either GNU # sed, or the sed that truncates its output the least. test -z "$SED" && { _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for _G_i in 1 2 3 4 5 6 7; do _G_sed_script=$_G_sed_script$nl$_G_sed_script done echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed _G_sed_script= func_check_prog_sed () { _G_path_prog=$1 _G_count=0 printf 0123456789 >conftest.in while : do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo '' >> conftest.nl "$_G_path_prog" -f conftest.sed conftest.out 2>/dev/null || break diff conftest.out conftest.nl >/dev/null 2>&1 || break _G_count=`expr $_G_count + 1` if test "$_G_count" -gt "$_G_path_prog_max"; then # Best one so far, save it but keep looking for a better one func_check_prog_result=$_G_path_prog _G_path_prog_max=$_G_count fi # 10*(2^10) chars as input seems more than enough test 10 -lt "$_G_count" && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out } func_path_progs "sed gsed" func_check_prog_sed "$PATH:/usr/xpg4/bin" rm -f conftest.sed SED=$func_path_progs_result } # Unless the user overrides by setting GREP, search the path for either GNU # grep, or the grep that truncates its output the least. test -z "$GREP" && { func_check_prog_grep () { _G_path_prog=$1 _G_count=0 _G_path_prog_max=0 printf 0123456789 >conftest.in while : do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo 'GREP' >> conftest.nl "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' conftest.out 2>/dev/null || break diff conftest.out conftest.nl >/dev/null 2>&1 || break _G_count=`expr $_G_count + 1` if test "$_G_count" -gt "$_G_path_prog_max"; then # Best one so far, save it but keep looking for a better one func_check_prog_result=$_G_path_prog _G_path_prog_max=$_G_count fi # 10*(2^10) chars as input seems more than enough test 10 -lt "$_G_count" && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out } func_path_progs "grep ggrep" func_check_prog_grep "$PATH:/usr/xpg4/bin" GREP=$func_path_progs_result } ## ------------------------------- ## ## User overridable command paths. ## ## ------------------------------- ## # All uppercase variable names are used for environment variables. These # variables can be overridden by the user before calling a script that # uses them if a suitable command of that name is not already available # in the command search PATH. : ${CP="cp -f"} : ${ECHO="printf %s\n"} : ${EGREP="$GREP -E"} : ${FGREP="$GREP -F"} : ${LN_S="ln -s"} : ${MAKE="make"} : ${MKDIR="mkdir"} : ${MV="mv -f"} : ${RM="rm -f"} : ${SHELL="${CONFIG_SHELL-/bin/sh}"} ## -------------------- ## ## Useful sed snippets. ## ## -------------------- ## sed_dirname='s|/[^/]*$||' sed_basename='s|^.*/||' # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='s|\([`"$\\]\)|\\\1|g' # Same as above, but do not quote variable references. sed_double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution that turns a string into a regex matching for the # string literally. sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g' # Sed substitution that converts a w32 file name or path # that contains forward slashes, into one that contains # (escaped) backslashes. A very naive implementation. sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' # Re-'\' parameter expansions in output of sed_double_quote_subst that # were '\'-ed in input to the same. If an odd number of '\' preceded a # '$' in input to sed_double_quote_subst, that '$' was protected from # expansion. Since each input '\' is now two '\'s, look for any number # of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'. _G_bs='\\' _G_bs2='\\\\' _G_bs4='\\\\\\\\' _G_dollar='\$' sed_double_backslash="\ s/$_G_bs4/&\\ /g s/^$_G_bs2$_G_dollar/$_G_bs&/ s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g s/\n//g" # require_check_ifs_backslash # --------------------------- # Check if we can use backslash as IFS='\' separator, and set # $check_ifs_backshlash_broken to ':' or 'false'. require_check_ifs_backslash=func_require_check_ifs_backslash func_require_check_ifs_backslash () { _G_save_IFS=$IFS IFS='\' _G_check_ifs_backshlash='a\\b' for _G_i in $_G_check_ifs_backshlash do case $_G_i in a) check_ifs_backshlash_broken=false ;; '') break ;; *) check_ifs_backshlash_broken=: break ;; esac done IFS=$_G_save_IFS require_check_ifs_backslash=: } ## ----------------- ## ## Global variables. ## ## ----------------- ## # Except for the global variables explicitly listed below, the following # functions in the '^func_' namespace, and the '^require_' namespace # variables initialised in the 'Resource management' section, sourcing # this file will not pollute your global namespace with anything # else. There's no portable way to scope variables in Bourne shell # though, so actually running these functions will sometimes place # results into a variable named after the function, and often use # temporary variables in the '^_G_' namespace. If you are careful to # avoid using those namespaces casually in your sourcing script, things # should continue to work as you expect. And, of course, you can freely # overwrite any of the functions or variables defined here before # calling anything to customize them. EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. # Allow overriding, eg assuming that you follow the convention of # putting '$debug_cmd' at the start of all your functions, you can get # bash to show function call trace with: # # debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name debug_cmd=${debug_cmd-":"} exit_cmd=: # By convention, finish your script with: # # exit $exit_status # # so that you can set exit_status to non-zero if you want to indicate # something went wrong during execution without actually bailing out at # the point of failure. exit_status=$EXIT_SUCCESS # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath=$0 # The name of this program. progname=`$ECHO "$progpath" |$SED "$sed_basename"` # Make sure we have an absolute progpath for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *[\\/]*) progdir=`$ECHO "$progpath" |$SED "$sed_dirname"` progdir=`cd "$progdir" && pwd` progpath=$progdir/$progname ;; *) _G_IFS=$IFS IFS=${PATH_SEPARATOR-:} for progdir in $PATH; do IFS=$_G_IFS test -x "$progdir/$progname" && break done IFS=$_G_IFS test -n "$progdir" || progdir=`pwd` progpath=$progdir/$progname ;; esac ## ----------------- ## ## Standard options. ## ## ----------------- ## # The following options affect the operation of the functions defined # below, and should be set appropriately depending on run-time para- # meters passed on the command line. opt_dry_run=false opt_quiet=false opt_verbose=false # Categories 'all' and 'none' are always available. Append any others # you will pass as the first argument to func_warning from your own # code. warning_categories= # By default, display warnings according to 'opt_warning_types'. Set # 'warning_func' to ':' to elide all warnings, or func_fatal_error to # treat the next displayed warning as a fatal error. warning_func=func_warn_and_continue # Set to 'all' to display all warnings, 'none' to suppress all # warnings, or a space delimited list of some subset of # 'warning_categories' to display only the listed warnings. opt_warning_types=all ## -------------------- ## ## Resource management. ## ## -------------------- ## # This section contains definitions for functions that each ensure a # particular resource (a file, or a non-empty configuration variable for # example) is available, and if appropriate to extract default values # from pertinent package files. Call them using their associated # 'require_*' variable to ensure that they are executed, at most, once. # # It's entirely deliberate that calling these functions can set # variables that don't obey the namespace limitations obeyed by the rest # of this file, in order that that they be as useful as possible to # callers. # require_term_colors # ------------------- # Allow display of bold text on terminals that support it. require_term_colors=func_require_term_colors func_require_term_colors () { $debug_cmd test -t 1 && { # COLORTERM and USE_ANSI_COLORS environment variables take # precedence, because most terminfo databases neglect to describe # whether color sequences are supported. test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"} if test 1 = "$USE_ANSI_COLORS"; then # Standard ANSI escape sequences tc_reset='' tc_bold=''; tc_standout='' tc_red=''; tc_green='' tc_blue=''; tc_cyan='' else # Otherwise trust the terminfo database after all. test -n "`tput sgr0 2>/dev/null`" && { tc_reset=`tput sgr0` test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold` tc_standout=$tc_bold test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso` test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1` test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2` test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4` test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5` } fi } require_term_colors=: } ## ----------------- ## ## Function library. ## ## ----------------- ## # This section contains a variety of useful functions to call in your # scripts. Take note of the portable wrappers for features provided by # some modern shells, which will fall back to slower equivalents on # less featureful shells. # func_append VAR VALUE # --------------------- # Append VALUE onto the existing contents of VAR. # We should try to minimise forks, especially on Windows where they are # unreasonably slow, so skip the feature probes when bash or zsh are # being used: if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then : ${_G_HAVE_ARITH_OP="yes"} : ${_G_HAVE_XSI_OPS="yes"} # The += operator was introduced in bash 3.1 case $BASH_VERSION in [12].* | 3.0 | 3.0*) ;; *) : ${_G_HAVE_PLUSEQ_OP="yes"} ;; esac fi # _G_HAVE_PLUSEQ_OP # Can be empty, in which case the shell is probed, "yes" if += is # useable or anything else if it does not work. test -z "$_G_HAVE_PLUSEQ_OP" \ && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \ && _G_HAVE_PLUSEQ_OP=yes if test yes = "$_G_HAVE_PLUSEQ_OP" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_append () { $debug_cmd eval "$1+=\$2" }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_append () { $debug_cmd eval "$1=\$$1\$2" } fi # func_append_quoted VAR VALUE # ---------------------------- # Quote VALUE and append to the end of shell variable VAR, separated # by a space. if test yes = "$_G_HAVE_PLUSEQ_OP"; then eval 'func_append_quoted () { $debug_cmd func_quote_arg pretty "$2" eval "$1+=\\ \$func_quote_arg_result" }' else func_append_quoted () { $debug_cmd func_quote_arg pretty "$2" eval "$1=\$$1\\ \$func_quote_arg_result" } fi # func_append_uniq VAR VALUE # -------------------------- # Append unique VALUE onto the existing contents of VAR, assuming # entries are delimited by the first character of VALUE. For example: # # func_append_uniq options " --another-option option-argument" # # will only append to $options if " --another-option option-argument " # is not already present somewhere in $options already (note spaces at # each end implied by leading space in second argument). func_append_uniq () { $debug_cmd eval _G_current_value='`$ECHO $'$1'`' _G_delim=`expr "$2" : '\(.\)'` case $_G_delim$_G_current_value$_G_delim in *"$2$_G_delim"*) ;; *) func_append "$@" ;; esac } # func_arith TERM... # ------------------ # Set func_arith_result to the result of evaluating TERMs. test -z "$_G_HAVE_ARITH_OP" \ && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \ && _G_HAVE_ARITH_OP=yes if test yes = "$_G_HAVE_ARITH_OP"; then eval 'func_arith () { $debug_cmd func_arith_result=$(( $* )) }' else func_arith () { $debug_cmd func_arith_result=`expr "$@"` } fi # func_basename FILE # ------------------ # Set func_basename_result to FILE with everything up to and including # the last / stripped. if test yes = "$_G_HAVE_XSI_OPS"; then # If this shell supports suffix pattern removal, then use it to avoid # forking. Hide the definitions single quotes in case the shell chokes # on unsupported syntax... _b='func_basename_result=${1##*/}' _d='case $1 in */*) func_dirname_result=${1%/*}$2 ;; * ) func_dirname_result=$3 ;; esac' else # ...otherwise fall back to using sed. _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`' _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"` if test "X$func_dirname_result" = "X$1"; then func_dirname_result=$3 else func_append func_dirname_result "$2" fi' fi eval 'func_basename () { $debug_cmd '"$_b"' }' # func_dirname FILE APPEND NONDIR_REPLACEMENT # ------------------------------------------- # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. eval 'func_dirname () { $debug_cmd '"$_d"' }' # func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT # -------------------------------------------------------- # Perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # For efficiency, we do not delegate to the functions above but instead # duplicate the functionality here. eval 'func_dirname_and_basename () { $debug_cmd '"$_b"' '"$_d"' }' # func_echo ARG... # ---------------- # Echo program name prefixed message. func_echo () { $debug_cmd _G_message=$* func_echo_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_IFS $ECHO "$progname: $_G_line" done IFS=$func_echo_IFS } # func_echo_all ARG... # -------------------- # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } # func_echo_infix_1 INFIX ARG... # ------------------------------ # Echo program name, followed by INFIX on the first line, with any # additional lines not showing INFIX. func_echo_infix_1 () { $debug_cmd $require_term_colors _G_infix=$1; shift _G_indent=$_G_infix _G_prefix="$progname: $_G_infix: " _G_message=$* # Strip color escape sequences before counting printable length for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan" do test -n "$_G_tc" && { _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"` _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"` } done _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes func_echo_infix_1_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_infix_1_IFS $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2 _G_prefix=$_G_indent done IFS=$func_echo_infix_1_IFS } # func_error ARG... # ----------------- # Echo program name prefixed message to standard error. func_error () { $debug_cmd $require_term_colors func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2 } # func_fatal_error ARG... # ----------------------- # Echo program name prefixed message to standard error, and exit. func_fatal_error () { $debug_cmd func_error "$*" exit $EXIT_FAILURE } # func_grep EXPRESSION FILENAME # ----------------------------- # Check whether EXPRESSION matches any line of FILENAME, without output. func_grep () { $debug_cmd $GREP "$1" "$2" >/dev/null 2>&1 } # func_len STRING # --------------- # Set func_len_result to the length of STRING. STRING may not # start with a hyphen. test -z "$_G_HAVE_XSI_OPS" \ && (eval 'x=a/b/c; test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ && _G_HAVE_XSI_OPS=yes if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_len () { $debug_cmd func_len_result=${#1} }' else func_len () { $debug_cmd func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` } fi # func_mkdir_p DIRECTORY-PATH # --------------------------- # Make sure the entire path to DIRECTORY-PATH is available. func_mkdir_p () { $debug_cmd _G_directory_path=$1 _G_dir_list= if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then # Protect directory names starting with '-' case $_G_directory_path in -*) _G_directory_path=./$_G_directory_path ;; esac # While some portion of DIR does not yet exist... while test ! -d "$_G_directory_path"; do # ...make a list in topmost first order. Use a colon delimited # list incase some portion of path contains whitespace. _G_dir_list=$_G_directory_path:$_G_dir_list # If the last portion added has no slash in it, the list is done case $_G_directory_path in */*) ;; *) break ;; esac # ...otherwise throw away the child directory and loop _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"` done _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'` func_mkdir_p_IFS=$IFS; IFS=: for _G_dir in $_G_dir_list; do IFS=$func_mkdir_p_IFS # mkdir can fail with a 'File exist' error if two processes # try to create one of the directories concurrently. Don't # stop in that case! $MKDIR "$_G_dir" 2>/dev/null || : done IFS=$func_mkdir_p_IFS # Bail out if we (or some other process) failed to create a directory. test -d "$_G_directory_path" || \ func_fatal_error "Failed to create '$1'" fi } # func_mktempdir [BASENAME] # ------------------------- # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, BASENAME is the basename for that directory. func_mktempdir () { $debug_cmd _G_template=${TMPDIR-/tmp}/${1-$progname} if test : = "$opt_dry_run"; then # Return a directory name, but don't create it in dry-run mode _G_tmpdir=$_G_template-$$ else # If mktemp works, use that first and foremost _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null` if test ! -d "$_G_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race _G_tmpdir=$_G_template-${RANDOM-0}$$ func_mktempdir_umask=`umask` umask 0077 $MKDIR "$_G_tmpdir" umask $func_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$_G_tmpdir" || \ func_fatal_error "cannot create temporary directory '$_G_tmpdir'" fi $ECHO "$_G_tmpdir" } # func_normal_abspath PATH # ------------------------ # Remove doubled-up and trailing slashes, "." path components, # and cancel out any ".." path components in PATH after making # it an absolute path. func_normal_abspath () { $debug_cmd # These SED scripts presuppose an absolute path with a trailing slash. _G_pathcar='s|^/\([^/]*\).*$|\1|' _G_pathcdr='s|^/[^/]*||' _G_removedotparts=':dotsl s|/\./|/|g t dotsl s|/\.$|/|' _G_collapseslashes='s|/\{1,\}|/|g' _G_finalslash='s|/*$|/|' # Start from root dir and reassemble the path. func_normal_abspath_result= func_normal_abspath_tpath=$1 func_normal_abspath_altnamespace= case $func_normal_abspath_tpath in "") # Empty path, that just means $cwd. func_stripname '' '/' "`pwd`" func_normal_abspath_result=$func_stripname_result return ;; # The next three entries are used to spot a run of precisely # two leading slashes without using negated character classes; # we take advantage of case's first-match behaviour. ///*) # Unusual form of absolute path, do nothing. ;; //*) # Not necessarily an ordinary path; POSIX reserves leading '//' # and for example Cygwin uses it to access remote file shares # over CIFS/SMB, so we conserve a leading double slash if found. func_normal_abspath_altnamespace=/ ;; /*) # Absolute path, do nothing. ;; *) # Relative path, prepend $cwd. func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath ;; esac # Cancel out all the simple stuff to save iterations. We also want # the path to end with a slash for ease of parsing, so make sure # there is one (and only one) here. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"` while :; do # Processed it all yet? if test / = "$func_normal_abspath_tpath"; then # If we ascended to the root using ".." the result may be empty now. if test -z "$func_normal_abspath_result"; then func_normal_abspath_result=/ fi break fi func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_pathcar"` func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_pathcdr"` # Figure out what to do with it case $func_normal_abspath_tcomponent in "") # Trailing empty path component, ignore it. ;; ..) # Parent dir; strip last assembled component from result. func_dirname "$func_normal_abspath_result" func_normal_abspath_result=$func_dirname_result ;; *) # Actual path component, append it. func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent" ;; esac done # Restore leading double-slash if one was found on entry. func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result } # func_notquiet ARG... # -------------------- # Echo program name prefixed message only when not in quiet mode. func_notquiet () { $debug_cmd $opt_quiet || func_echo ${1+"$@"} # A bug in bash halts the script if the last line of a function # fails when set -e is in force, so we need another command to # work around that: : } # func_relative_path SRCDIR DSTDIR # -------------------------------- # Set func_relative_path_result to the relative path from SRCDIR to DSTDIR. func_relative_path () { $debug_cmd func_relative_path_result= func_normal_abspath "$1" func_relative_path_tlibdir=$func_normal_abspath_result func_normal_abspath "$2" func_relative_path_tbindir=$func_normal_abspath_result # Ascend the tree starting from libdir while :; do # check if we have found a prefix of bindir case $func_relative_path_tbindir in $func_relative_path_tlibdir) # found an exact match func_relative_path_tcancelled= break ;; $func_relative_path_tlibdir*) # found a matching prefix func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" func_relative_path_tcancelled=$func_stripname_result if test -z "$func_relative_path_result"; then func_relative_path_result=. fi break ;; *) func_dirname $func_relative_path_tlibdir func_relative_path_tlibdir=$func_dirname_result if test -z "$func_relative_path_tlibdir"; then # Have to descend all the way to the root! func_relative_path_result=../$func_relative_path_result func_relative_path_tcancelled=$func_relative_path_tbindir break fi func_relative_path_result=../$func_relative_path_result ;; esac done # Now calculate path; take care to avoid doubling-up slashes. func_stripname '' '/' "$func_relative_path_result" func_relative_path_result=$func_stripname_result func_stripname '/' '/' "$func_relative_path_tcancelled" if test -n "$func_stripname_result"; then func_append func_relative_path_result "/$func_stripname_result" fi # Normalisation. If bindir is libdir, return '.' else relative path. if test -n "$func_relative_path_result"; then func_stripname './' '' "$func_relative_path_result" func_relative_path_result=$func_stripname_result fi test -n "$func_relative_path_result" || func_relative_path_result=. : } # func_quote_portable EVAL ARG # ---------------------------- # Internal function to portably implement func_quote_arg. Note that we still # keep attention to performance here so we as much as possible try to avoid # calling sed binary (so far O(N) complexity as long as func_append is O(1)). func_quote_portable () { $debug_cmd $require_check_ifs_backslash func_quote_portable_result=$2 # one-time-loop (easy break) while true do if $1; then func_quote_portable_result=`$ECHO "$2" | $SED \ -e "$sed_double_quote_subst" -e "$sed_double_backslash"` break fi # Quote for eval. case $func_quote_portable_result in *[\\\`\"\$]*) # Fallback to sed for $func_check_bs_ifs_broken=:, or when the string # contains the shell wildcard characters. case $check_ifs_backshlash_broken$func_quote_portable_result in :*|*[\[\*\?]*) func_quote_portable_result=`$ECHO "$func_quote_portable_result" \ | $SED "$sed_quote_subst"` break ;; esac func_quote_portable_old_IFS=$IFS for _G_char in '\' '`' '"' '$' do # STATE($1) PREV($2) SEPARATOR($3) set start "" "" func_quote_portable_result=dummy"$_G_char$func_quote_portable_result$_G_char"dummy IFS=$_G_char for _G_part in $func_quote_portable_result do case $1 in quote) func_append func_quote_portable_result "$3$2" set quote "$_G_part" "\\$_G_char" ;; start) set first "" "" func_quote_portable_result= ;; first) set quote "$_G_part" "" ;; esac done done IFS=$func_quote_portable_old_IFS ;; *) ;; esac break done func_quote_portable_unquoted_result=$func_quote_portable_result case $func_quote_portable_result in # double-quote args containing shell metacharacters to delay # word splitting, command substitution and variable expansion # for a subsequent eval. # many bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") func_quote_portable_result=\"$func_quote_portable_result\" ;; esac } # func_quotefast_eval ARG # ----------------------- # Quote one ARG (internal). This is equivalent to 'func_quote_arg eval ARG', # but optimized for speed. Result is stored in $func_quotefast_eval. if test xyes = `(x=; printf -v x %q yes; echo x"$x") 2>/dev/null`; then printf -v _GL_test_printf_tilde %q '~' if test '\~' = "$_GL_test_printf_tilde"; then func_quotefast_eval () { printf -v func_quotefast_eval_result %q "$1" } else # Broken older Bash implementations. Make those faster too if possible. func_quotefast_eval () { case $1 in '~'*) func_quote_portable false "$1" func_quotefast_eval_result=$func_quote_portable_result ;; *) printf -v func_quotefast_eval_result %q "$1" ;; esac } fi else func_quotefast_eval () { func_quote_portable false "$1" func_quotefast_eval_result=$func_quote_portable_result } fi # func_quote_arg MODEs ARG # ------------------------ # Quote one ARG to be evaled later. MODEs argument may contain zero or more # specifiers listed below separated by ',' character. This function returns two # values: # i) func_quote_arg_result # double-quoted (when needed), suitable for a subsequent eval # ii) func_quote_arg_unquoted_result # has all characters that are still active within double # quotes backslashified. Available only if 'unquoted' is specified. # # Available modes: # ---------------- # 'eval' (default) # - escape shell special characters # 'expand' # - the same as 'eval'; but do not quote variable references # 'pretty' # - request aesthetic output, i.e. '"a b"' instead of 'a\ b'. This might # be used later in func_quote to get output like: 'echo "a b"' instead # of 'echo a\ b'. This is slower than default on some shells. # 'unquoted' # - produce also $func_quote_arg_unquoted_result which does not contain # wrapping double-quotes. # # Examples for 'func_quote_arg pretty,unquoted string': # # string | *_result | *_unquoted_result # ------------+-----------------------+------------------- # " | \" | \" # a b | "a b" | a b # "a b" | "\"a b\"" | \"a b\" # * | "*" | * # z="${x-$y}" | "z=\"\${x-\$y}\"" | z=\"\${x-\$y}\" # # Examples for 'func_quote_arg pretty,unquoted,expand string': # # string | *_result | *_unquoted_result # --------------+---------------------+-------------------- # z="${x-$y}" | "z=\"${x-$y}\"" | z=\"${x-$y}\" func_quote_arg () { _G_quote_expand=false case ,$1, in *,expand,*) _G_quote_expand=: ;; esac case ,$1, in *,pretty,*|*,expand,*|*,unquoted,*) func_quote_portable $_G_quote_expand "$2" func_quote_arg_result=$func_quote_portable_result func_quote_arg_unquoted_result=$func_quote_portable_unquoted_result ;; *) # Faster quote-for-eval for some shells. func_quotefast_eval "$2" func_quote_arg_result=$func_quotefast_eval_result ;; esac } # func_quote MODEs ARGs... # ------------------------ # Quote all ARGs to be evaled later and join them into single command. See # func_quote_arg's description for more info. func_quote () { $debug_cmd _G_func_quote_mode=$1 ; shift func_quote_result= while test 0 -lt $#; do func_quote_arg "$_G_func_quote_mode" "$1" if test -n "$func_quote_result"; then func_append func_quote_result " $func_quote_arg_result" else func_append func_quote_result "$func_quote_arg_result" fi shift done } # func_stripname PREFIX SUFFIX NAME # --------------------------------- # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_stripname () { $debug_cmd # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary variable first. func_stripname_result=$3 func_stripname_result=${func_stripname_result#"$1"} func_stripname_result=${func_stripname_result%"$2"} }' else func_stripname () { $debug_cmd case $2 in .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;; *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;; esac } fi # func_show_eval CMD [FAIL_EXP] # ----------------------------- # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. func_show_eval () { $debug_cmd _G_cmd=$1 _G_fail_exp=${2-':'} func_quote_arg pretty,expand "$_G_cmd" eval "func_notquiet $func_quote_arg_result" $opt_dry_run || { eval "$_G_cmd" _G_status=$? if test 0 -ne "$_G_status"; then eval "(exit $_G_status); $_G_fail_exp" fi } } # func_show_eval_locale CMD [FAIL_EXP] # ------------------------------------ # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. Use the saved locale for evaluation. func_show_eval_locale () { $debug_cmd _G_cmd=$1 _G_fail_exp=${2-':'} $opt_quiet || { func_quote_arg expand,pretty "$_G_cmd" eval "func_echo $func_quote_arg_result" } $opt_dry_run || { eval "$_G_user_locale $_G_cmd" _G_status=$? eval "$_G_safe_locale" if test 0 -ne "$_G_status"; then eval "(exit $_G_status); $_G_fail_exp" fi } } # func_tr_sh # ---------- # Turn $1 into a string suitable for a shell variable name. # Result is stored in $func_tr_sh_result. All characters # not in the set a-zA-Z0-9_ are replaced with '_'. Further, # if $1 begins with a digit, a '_' is prepended as well. func_tr_sh () { $debug_cmd case $1 in [0-9]* | *[!a-zA-Z0-9_]*) func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'` ;; * ) func_tr_sh_result=$1 ;; esac } # func_verbose ARG... # ------------------- # Echo program name prefixed message in verbose mode only. func_verbose () { $debug_cmd $opt_verbose && func_echo "$*" : } # func_warn_and_continue ARG... # ----------------------------- # Echo program name prefixed warning message to standard error. func_warn_and_continue () { $debug_cmd $require_term_colors func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2 } # func_warning CATEGORY ARG... # ---------------------------- # Echo program name prefixed warning message to standard error. Warning # messages can be filtered according to CATEGORY, where this function # elides messages where CATEGORY is not listed in the global variable # 'opt_warning_types'. func_warning () { $debug_cmd # CATEGORY must be in the warning_categories list! case " $warning_categories " in *" $1 "*) ;; *) func_internal_error "invalid warning category '$1'" ;; esac _G_category=$1 shift case " $opt_warning_types " in *" $_G_category "*) $warning_func ${1+"$@"} ;; esac } # func_sort_ver VER1 VER2 # ----------------------- # 'sort -V' is not generally available. # Note this deviates from the version comparison in automake # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a # but this should suffice as we won't be specifying old # version formats or redundant trailing .0 in bootstrap.conf. # If we did want full compatibility then we should probably # use m4_version_compare from autoconf. func_sort_ver () { $debug_cmd printf '%s\n%s\n' "$1" "$2" \ | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n } # func_lt_ver PREV CURR # --------------------- # Return true if PREV and CURR are in the correct order according to # func_sort_ver, otherwise false. Use it like this: # # func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..." func_lt_ver () { $debug_cmd test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q` } # Local variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: #! /bin/sh # A portable, pluggable option parser for Bourne shell. # Written by Gary V. Vaughan, 2010 # This is free software. There is NO warranty; not even for # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # Copyright (C) 2010-2019, 2021 Bootstrap Authors # # This file is dual licensed under the terms of the MIT license # , and GPL version 2 or later # . You must apply one of # these licenses when using or redistributing this software or any of # the files within it. See the URLs above, or the file `LICENSE` # included in the Bootstrap distribution for the full license texts. # Please report bugs or propose patches to: # # Set a version string for this script. scriptversion=2019-02-19.15; # UTC ## ------ ## ## Usage. ## ## ------ ## # This file is a library for parsing options in your shell scripts along # with assorted other useful supporting features that you can make use # of too. # # For the simplest scripts you might need only: # # #!/bin/sh # . relative/path/to/funclib.sh # . relative/path/to/options-parser # scriptversion=1.0 # func_options ${1+"$@"} # eval set dummy "$func_options_result"; shift # ...rest of your script... # # In order for the '--version' option to work, you will need to have a # suitably formatted comment like the one at the top of this file # starting with '# Written by ' and ending with '# Copyright'. # # For '-h' and '--help' to work, you will also need a one line # description of your script's purpose in a comment directly above the # '# Written by ' line, like the one at the top of this file. # # The default options also support '--debug', which will turn on shell # execution tracing (see the comment above debug_cmd below for another # use), and '--verbose' and the func_verbose function to allow your script # to display verbose messages only when your user has specified # '--verbose'. # # After sourcing this file, you can plug in processing for additional # options by amending the variables from the 'Configuration' section # below, and following the instructions in the 'Option parsing' # section further down. ## -------------- ## ## Configuration. ## ## -------------- ## # You should override these variables in your script after sourcing this # file so that they reflect the customisations you have added to the # option parser. # The usage line for option parsing errors and the start of '-h' and # '--help' output messages. You can embed shell variables for delayed # expansion at the time the message is displayed, but you will need to # quote other shell meta-characters carefully to prevent them being # expanded when the contents are evaled. usage='$progpath [OPTION]...' # Short help message in response to '-h' and '--help'. Add to this or # override it after sourcing this library to reflect the full set of # options your script accepts. usage_message="\ --debug enable verbose shell tracing -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] -v, --verbose verbosely report processing --version print version information and exit -h, --help print short or long help message and exit " # Additional text appended to 'usage_message' in response to '--help'. long_help_message=" Warning categories include: 'all' show all warnings 'none' turn off all the warnings 'error' warnings are treated as fatal errors" # Help message printed before fatal option parsing errors. fatal_help="Try '\$progname --help' for more information." ## ------------------------- ## ## Hook function management. ## ## ------------------------- ## # This section contains functions for adding, removing, and running hooks # in the main code. A hook is just a list of function names that can be # run in order later on. # func_hookable FUNC_NAME # ----------------------- # Declare that FUNC_NAME will run hooks added with # 'func_add_hook FUNC_NAME ...'. func_hookable () { $debug_cmd func_append hookable_fns " $1" } # func_add_hook FUNC_NAME HOOK_FUNC # --------------------------------- # Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must # first have been declared "hookable" by a call to 'func_hookable'. func_add_hook () { $debug_cmd case " $hookable_fns " in *" $1 "*) ;; *) func_fatal_error "'$1' does not accept hook functions." ;; esac eval func_append ${1}_hooks '" $2"' } # func_remove_hook FUNC_NAME HOOK_FUNC # ------------------------------------ # Remove HOOK_FUNC from the list of hook functions to be called by # FUNC_NAME. func_remove_hook () { $debug_cmd eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`' } # func_propagate_result FUNC_NAME_A FUNC_NAME_B # --------------------------------------------- # If the *_result variable of FUNC_NAME_A _is set_, assign its value to # *_result variable of FUNC_NAME_B. func_propagate_result () { $debug_cmd func_propagate_result_result=: if eval "test \"\${${1}_result+set}\" = set" then eval "${2}_result=\$${1}_result" else func_propagate_result_result=false fi } # func_run_hooks FUNC_NAME [ARG]... # --------------------------------- # Run all hook functions registered to FUNC_NAME. # It's assumed that the list of hook functions contains nothing more # than a whitespace-delimited list of legal shell function names, and # no effort is wasted trying to catch shell meta-characters or preserve # whitespace. func_run_hooks () { $debug_cmd case " $hookable_fns " in *" $1 "*) ;; *) func_fatal_error "'$1' does not support hook functions." ;; esac eval _G_hook_fns=\$$1_hooks; shift for _G_hook in $_G_hook_fns; do func_unset "${_G_hook}_result" eval $_G_hook '${1+"$@"}' func_propagate_result $_G_hook func_run_hooks if $func_propagate_result_result; then eval set dummy "$func_run_hooks_result"; shift fi done } ## --------------- ## ## Option parsing. ## ## --------------- ## # In order to add your own option parsing hooks, you must accept the # full positional parameter list from your hook function. You may remove # or edit any options that you action, and then pass back the remaining # unprocessed options in '_result', escaped # suitably for 'eval'. # # The '_result' variable is automatically unset # before your hook gets called; for best performance, only set the # *_result variable when necessary (i.e. don't call the 'func_quote' # function unnecessarily because it can be an expensive operation on some # machines). # # Like this: # # my_options_prep () # { # $debug_cmd # # # Extend the existing usage message. # usage_message=$usage_message' # -s, --silent don'\''t print informational messages # ' # # No change in '$@' (ignored completely by this hook). Leave # # my_options_prep_result variable intact. # } # func_add_hook func_options_prep my_options_prep # # # my_silent_option () # { # $debug_cmd # # args_changed=false # # # Note that, for efficiency, we parse as many options as we can # # recognise in a loop before passing the remainder back to the # # caller on the first unrecognised argument we encounter. # while test $# -gt 0; do # opt=$1; shift # case $opt in # --silent|-s) opt_silent=: # args_changed=: # ;; # # Separate non-argument short options: # -s*) func_split_short_opt "$_G_opt" # set dummy "$func_split_short_opt_name" \ # "-$func_split_short_opt_arg" ${1+"$@"} # shift # args_changed=: # ;; # *) # Make sure the first unrecognised option "$_G_opt" # # is added back to "$@" in case we need it later, # # if $args_changed was set to 'true'. # set dummy "$_G_opt" ${1+"$@"}; shift; break ;; # esac # done # # # Only call 'func_quote' here if we processed at least one argument. # if $args_changed; then # func_quote eval ${1+"$@"} # my_silent_option_result=$func_quote_result # fi # } # func_add_hook func_parse_options my_silent_option # # # my_option_validation () # { # $debug_cmd # # $opt_silent && $opt_verbose && func_fatal_help "\ # '--silent' and '--verbose' options are mutually exclusive." # } # func_add_hook func_validate_options my_option_validation # # You'll also need to manually amend $usage_message to reflect the extra # options you parse. It's preferable to append if you can, so that # multiple option parsing hooks can be added safely. # func_options_finish [ARG]... # ---------------------------- # Finishing the option parse loop (call 'func_options' hooks ATM). func_options_finish () { $debug_cmd func_run_hooks func_options ${1+"$@"} func_propagate_result func_run_hooks func_options_finish } # func_options [ARG]... # --------------------- # All the functions called inside func_options are hookable. See the # individual implementations for details. func_hookable func_options func_options () { $debug_cmd _G_options_quoted=false for my_func in options_prep parse_options validate_options options_finish do func_unset func_${my_func}_result func_unset func_run_hooks_result eval func_$my_func '${1+"$@"}' func_propagate_result func_$my_func func_options if $func_propagate_result_result; then eval set dummy "$func_options_result"; shift _G_options_quoted=: fi done $_G_options_quoted || { # As we (func_options) are top-level options-parser function and # nobody quoted "$@" for us yet, we need to do it explicitly for # caller. func_quote eval ${1+"$@"} func_options_result=$func_quote_result } } # func_options_prep [ARG]... # -------------------------- # All initialisations required before starting the option parse loop. # Note that when calling hook functions, we pass through the list of # positional parameters. If a hook function modifies that list, and # needs to propagate that back to rest of this script, then the complete # modified list must be put in 'func_run_hooks_result' before returning. func_hookable func_options_prep func_options_prep () { $debug_cmd # Option defaults: opt_verbose=false opt_warning_types= func_run_hooks func_options_prep ${1+"$@"} func_propagate_result func_run_hooks func_options_prep } # func_parse_options [ARG]... # --------------------------- # The main option parsing loop. func_hookable func_parse_options func_parse_options () { $debug_cmd _G_parse_options_requote=false # this just eases exit handling while test $# -gt 0; do # Defer to hook functions for initial option parsing, so they # get priority in the event of reusing an option name. func_run_hooks func_parse_options ${1+"$@"} func_propagate_result func_run_hooks func_parse_options if $func_propagate_result_result; then eval set dummy "$func_parse_options_result"; shift # Even though we may have changed "$@", we passed the "$@" array # down into the hook and it quoted it for us (because we are in # this if-branch). No need to quote it again. _G_parse_options_requote=false fi # Break out of the loop if we already parsed every option. test $# -gt 0 || break # We expect that one of the options parsed in this function matches # and thus we remove _G_opt from "$@" and need to re-quote. _G_match_parse_options=: _G_opt=$1 shift case $_G_opt in --debug|-x) debug_cmd='set -x' func_echo "enabling shell trace mode" >&2 $debug_cmd ;; --no-warnings|--no-warning|--no-warn) set dummy --warnings none ${1+"$@"} shift ;; --warnings|--warning|-W) if test $# = 0 && func_missing_arg $_G_opt; then _G_parse_options_requote=: break fi case " $warning_categories $1" in *" $1 "*) # trailing space prevents matching last $1 above func_append_uniq opt_warning_types " $1" ;; *all) opt_warning_types=$warning_categories ;; *none) opt_warning_types=none warning_func=: ;; *error) opt_warning_types=$warning_categories warning_func=func_fatal_error ;; *) func_fatal_error \ "unsupported warning category: '$1'" ;; esac shift ;; --verbose|-v) opt_verbose=: ;; --version) func_version ;; -\?|-h) func_usage ;; --help) func_help ;; # Separate optargs to long options (plugins may need this): --*=*) func_split_equals "$_G_opt" set dummy "$func_split_equals_lhs" \ "$func_split_equals_rhs" ${1+"$@"} shift ;; # Separate optargs to short options: -W*) func_split_short_opt "$_G_opt" set dummy "$func_split_short_opt_name" \ "$func_split_short_opt_arg" ${1+"$@"} shift ;; # Separate non-argument short options: -\?*|-h*|-v*|-x*) func_split_short_opt "$_G_opt" set dummy "$func_split_short_opt_name" \ "-$func_split_short_opt_arg" ${1+"$@"} shift ;; --) _G_parse_options_requote=: ; break ;; -*) func_fatal_help "unrecognised option: '$_G_opt'" ;; *) set dummy "$_G_opt" ${1+"$@"}; shift _G_match_parse_options=false break ;; esac if $_G_match_parse_options; then _G_parse_options_requote=: fi done if $_G_parse_options_requote; then # save modified positional parameters for caller func_quote eval ${1+"$@"} func_parse_options_result=$func_quote_result fi } # func_validate_options [ARG]... # ------------------------------ # Perform any sanity checks on option settings and/or unconsumed # arguments. func_hookable func_validate_options func_validate_options () { $debug_cmd # Display all warnings if -W was not given. test -n "$opt_warning_types" || opt_warning_types=" $warning_categories" func_run_hooks func_validate_options ${1+"$@"} func_propagate_result func_run_hooks func_validate_options # Bail if the options were screwed! $exit_cmd $EXIT_FAILURE } ## ----------------- ## ## Helper functions. ## ## ----------------- ## # This section contains the helper functions used by the rest of the # hookable option parser framework in ascii-betical order. # func_fatal_help ARG... # ---------------------- # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { $debug_cmd eval \$ECHO \""Usage: $usage"\" eval \$ECHO \""$fatal_help"\" func_error ${1+"$@"} exit $EXIT_FAILURE } # func_help # --------- # Echo long help message to standard output and exit. func_help () { $debug_cmd func_usage_message $ECHO "$long_help_message" exit 0 } # func_missing_arg ARGNAME # ------------------------ # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { $debug_cmd func_error "Missing argument for '$1'." exit_cmd=exit } # func_split_equals STRING # ------------------------ # Set func_split_equals_lhs and func_split_equals_rhs shell variables # after splitting STRING at the '=' sign. test -z "$_G_HAVE_XSI_OPS" \ && (eval 'x=a/b/c; test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ && _G_HAVE_XSI_OPS=yes if test yes = "$_G_HAVE_XSI_OPS" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_split_equals () { $debug_cmd func_split_equals_lhs=${1%%=*} func_split_equals_rhs=${1#*=} if test "x$func_split_equals_lhs" = "x$1"; then func_split_equals_rhs= fi }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_split_equals () { $debug_cmd func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'` func_split_equals_rhs= test "x$func_split_equals_lhs=" = "x$1" \ || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'` } fi #func_split_equals # func_split_short_opt SHORTOPT # ----------------------------- # Set func_split_short_opt_name and func_split_short_opt_arg shell # variables after splitting SHORTOPT after the 2nd character. if test yes = "$_G_HAVE_XSI_OPS" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_split_short_opt () { $debug_cmd func_split_short_opt_arg=${1#??} func_split_short_opt_name=${1%"$func_split_short_opt_arg"} }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_split_short_opt () { $debug_cmd func_split_short_opt_name=`expr "x$1" : 'x\(-.\)'` func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'` } fi #func_split_short_opt # func_usage # ---------- # Echo short help message to standard output and exit. func_usage () { $debug_cmd func_usage_message $ECHO "Run '$progname --help |${PAGER-more}' for full usage" exit 0 } # func_usage_message # ------------------ # Echo short help message to standard output. func_usage_message () { $debug_cmd eval \$ECHO \""Usage: $usage"\" echo $SED -n 's|^# || /^Written by/{ x;p;x } h /^Written by/q' < "$progpath" echo eval \$ECHO \""$usage_message"\" } # func_version # ------------ # Echo version message to standard output and exit. # The version message is extracted from the calling file's header # comments, with leading '# ' stripped: # 1. First display the progname and version # 2. Followed by the header comment line matching /^# Written by / # 3. Then a blank line followed by the first following line matching # /^# Copyright / # 4. Immediately followed by any lines between the previous matches, # except lines preceding the intervening completely blank line. # For example, see the header comments of this file. func_version () { $debug_cmd printf '%s\n' "$progname $scriptversion" $SED -n ' /^# Written by /!b s|^# ||; p; n :fwd2blnk /./ { n b fwd2blnk } p; n :holdwrnt s|^# || s|^# *$|| /^Copyright /!{ /./H n b holdwrnt } s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2| G s|\(\n\)\n*|\1|g p; q' < "$progpath" exit $? } # Local variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-pattern: "30/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: # Set a version string. scriptversion='(GNU libtool) 2.4.7' # func_echo ARG... # ---------------- # Libtool also displays the current mode in messages, so override # funclib.sh func_echo with this custom definition. func_echo () { $debug_cmd _G_message=$* func_echo_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_IFS $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line" done IFS=$func_echo_IFS } # func_warning ARG... # ------------------- # Libtool warnings are not categorized, so override funclib.sh # func_warning with this simpler definition. func_warning () { $debug_cmd $warning_func ${1+"$@"} } ## ---------------- ## ## Options parsing. ## ## ---------------- ## # Hook in the functions to make sure our own options are parsed during # the option parsing loop. usage='$progpath [OPTION]... [MODE-ARG]...' # Short help message in response to '-h'. usage_message="Options: --config show all configuration variables --debug enable verbose shell tracing -n, --dry-run display commands without modifying any files --features display basic configuration information and exit --mode=MODE use operation mode MODE --no-warnings equivalent to '-Wnone' --preserve-dup-deps don't remove duplicate dependency libraries --quiet, --silent don't print informational messages --tag=TAG use configuration variables from tag TAG -v, --verbose print more informational messages than default --version print version information -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] -h, --help, --help-all print short, long, or detailed help message " # Additional text appended to 'usage_message' in response to '--help'. func_help () { $debug_cmd func_usage_message $ECHO "$long_help_message MODE must be one of the following: clean remove files from the build directory compile compile a source file into a libtool object execute automatically set library path, then run a program finish complete the installation of libtool libraries install install libraries or executables link create a library or an executable uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. When passed as first option, '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that. Try '$progname --help --mode=MODE' for a more detailed description of MODE. When reporting a bug, please describe a test case to reproduce it and include the following information: host-triplet: $host shell: $SHELL compiler: $LTCC compiler flags: $LTCFLAGS linker: $LD (gnu? $with_gnu_ld) version: $progname (GNU libtool) 2.4.7 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` Report bugs to . GNU libtool home page: . General help using GNU software: ." exit 0 } # func_lo2o OBJECT-NAME # --------------------- # Transform OBJECT-NAME from a '.lo' suffix to the platform specific # object suffix. lo2o=s/\\.lo\$/.$objext/ o2lo=s/\\.$objext\$/.lo/ if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_lo2o () { case $1 in *.lo) func_lo2o_result=${1%.lo}.$objext ;; * ) func_lo2o_result=$1 ;; esac }' # func_xform LIBOBJ-OR-SOURCE # --------------------------- # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise) # suffix to a '.lo' libtool-object suffix. eval 'func_xform () { func_xform_result=${1%.*}.lo }' else # ...otherwise fall back to using sed. func_lo2o () { func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"` } func_xform () { func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'` } fi # func_fatal_configuration ARG... # ------------------------------- # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func_fatal_error ${1+"$@"} \ "See the $PACKAGE documentation for more information." \ "Fatal configuration error." } # func_config # ----------- # Display the configuration for all the tags in this script. func_config () { re_begincf='^# ### BEGIN LIBTOOL' re_endcf='^# ### END LIBTOOL' # Default configuration. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" # Now print the configurations for the tags. for tagname in $taglist; do $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" done exit $? } # func_features # ------------- # Display the features supported by this script. func_features () { echo "host: $host" if test yes = "$build_libtool_libs"; then echo "enable shared libraries" else echo "disable shared libraries" fi if test yes = "$build_old_libs"; then echo "enable static libraries" else echo "disable static libraries" fi exit $? } # func_enable_tag TAGNAME # ----------------------- # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { # Global variable: tagname=$1 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" sed_extractcf=/$re_begincf/,/$re_endcf/p # Validate tagname. case $tagname in *[!-_A-Za-z0-9,/]*) func_fatal_error "invalid tag name: $tagname" ;; esac # Don't test for the "default" C tag, as we know it's # there but not specially marked. case $tagname in CC) ;; *) if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable quotes within backquotes within # quotes we have to do it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } # func_check_version_match # ------------------------ # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } # libtool_options_prep [ARG]... # ----------------------------- # Preparation for options parsed by libtool. libtool_options_prep () { $debug_mode # Option defaults: opt_config=false opt_dlopen= opt_dry_run=false opt_help=false opt_mode= opt_preserve_dup_deps=false opt_quiet=false nonopt= preserve_args= _G_rc_lt_options_prep=: # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set dummy --mode clean ${1+"$@"}; shift ;; compile|compil|compi|comp|com|co|c) shift; set dummy --mode compile ${1+"$@"}; shift ;; execute|execut|execu|exec|exe|ex|e) shift; set dummy --mode execute ${1+"$@"}; shift ;; finish|finis|fini|fin|fi|f) shift; set dummy --mode finish ${1+"$@"}; shift ;; install|instal|insta|inst|ins|in|i) shift; set dummy --mode install ${1+"$@"}; shift ;; link|lin|li|l) shift; set dummy --mode link ${1+"$@"}; shift ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set dummy --mode uninstall ${1+"$@"}; shift ;; *) _G_rc_lt_options_prep=false ;; esac if $_G_rc_lt_options_prep; then # Pass back the list of options. func_quote eval ${1+"$@"} libtool_options_prep_result=$func_quote_result fi } func_add_hook func_options_prep libtool_options_prep # libtool_parse_options [ARG]... # --------------------------------- # Provide handling for libtool specific options. libtool_parse_options () { $debug_cmd _G_rc_lt_parse_options=false # Perform our own loop to consume as many options as possible in # each iteration. while test $# -gt 0; do _G_match_lt_parse_options=: _G_opt=$1 shift case $_G_opt in --dry-run|--dryrun|-n) opt_dry_run=: ;; --config) func_config ;; --dlopen|-dlopen) opt_dlopen="${opt_dlopen+$opt_dlopen }$1" shift ;; --preserve-dup-deps) opt_preserve_dup_deps=: ;; --features) func_features ;; --finish) set dummy --mode finish ${1+"$@"}; shift ;; --help) opt_help=: ;; --help-all) opt_help=': help-all' ;; --mode) test $# = 0 && func_missing_arg $_G_opt && break opt_mode=$1 case $1 in # Valid mode arguments: clean|compile|execute|finish|install|link|relink|uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $_G_opt" exit_cmd=exit break ;; esac shift ;; --no-silent|--no-quiet) opt_quiet=false func_append preserve_args " $_G_opt" ;; --no-warnings|--no-warning|--no-warn) opt_warning=false func_append preserve_args " $_G_opt" ;; --no-verbose) opt_verbose=false func_append preserve_args " $_G_opt" ;; --silent|--quiet) opt_quiet=: opt_verbose=false func_append preserve_args " $_G_opt" ;; --tag) test $# = 0 && func_missing_arg $_G_opt && break opt_tag=$1 func_append preserve_args " $_G_opt $1" func_enable_tag "$1" shift ;; --verbose|-v) opt_quiet=false opt_verbose=: func_append preserve_args " $_G_opt" ;; # An option not handled by this hook function: *) set dummy "$_G_opt" ${1+"$@"} ; shift _G_match_lt_parse_options=false break ;; esac $_G_match_lt_parse_options && _G_rc_lt_parse_options=: done if $_G_rc_lt_parse_options; then # save modified positional parameters for caller func_quote eval ${1+"$@"} libtool_parse_options_result=$func_quote_result fi } func_add_hook func_parse_options libtool_parse_options # libtool_validate_options [ARG]... # --------------------------------- # Perform any sanity checks on option settings and/or unconsumed # arguments. libtool_validate_options () { # save first non-option argument if test 0 -lt $#; then nonopt=$1 shift fi # preserve --debug test : = "$debug_cmd" || func_append preserve_args " --debug" case $host in # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452 # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788 *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps ;; esac $opt_help || { # Sanity checks first: func_check_version_match test yes != "$build_libtool_libs" \ && test yes != "$build_old_libs" \ && func_fatal_configuration "not configured to build any kind of library" # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$opt_dlopen" && test execute != "$opt_mode"; then func_error "unrecognized option '-dlopen'" $ECHO "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help=$help help="Try '$progname --help --mode=$opt_mode' for more information." } # Pass back the unparsed argument list func_quote eval ${1+"$@"} libtool_validate_options_result=$func_quote_result } func_add_hook func_validate_options libtool_validate_options # Process options as early as possible so that --help and --version # can return quickly. func_options ${1+"$@"} eval set dummy "$func_options_result"; shift ## ----------- ## ## Main. ## ## ----------- ## magic='%%%MAGIC variable%%%' magic_exe='%%%MAGIC EXE variable%%%' # Global variables. extracted_archives= extracted_serial=0 # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } # func_generated_by_libtool # True iff stdin has been generated by Libtool. This function is only # a basic sanity check; it will hardly flush out determined imposters. func_generated_by_libtool_p () { $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 } # func_lalib_p file # True iff FILE is a libtool '.la' library or '.lo' object file. # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_lalib_p () { test -f "$1" && $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p } # func_lalib_unsafe_p file # True iff FILE is a libtool '.la' library or '.lo' object file. # This function implements the same check as func_lalib_p without # resorting to external programs. To this end, it redirects stdin and # closes it afterwards, without saving the original file descriptor. # As a safety measure, use it only where a negative result would be # fatal anyway. Works if 'file' does not exist. func_lalib_unsafe_p () { lalib_p=no if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then for lalib_p_l in 1 2 3 4 do read lalib_p_line case $lalib_p_line in \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; esac done exec 0<&5 5<&- fi test yes = "$lalib_p" } # func_ltwrapper_script_p file # True iff FILE is a libtool wrapper script # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_script_p () { test -f "$1" && $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p } # func_ltwrapper_executable_p file # True iff FILE is a libtool wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_executable_p () { func_ltwrapper_exec_suffix= case $1 in *.exe) ;; *) func_ltwrapper_exec_suffix=.exe ;; esac $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 } # func_ltwrapper_scriptname file # Assumes file is an ltwrapper_executable # uses $file to determine the appropriate filename for a # temporary ltwrapper_script. func_ltwrapper_scriptname () { func_dirname_and_basename "$1" "" "." func_stripname '' '.exe' "$func_basename_result" func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper } # func_ltwrapper_p file # True iff FILE is a libtool wrapper script or wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_p () { func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" } # func_execute_cmds commands fail_cmd # Execute tilde-delimited COMMANDS. # If FAIL_CMD is given, eval that upon failure. # FAIL_CMD may read-access the current command in variable CMD! func_execute_cmds () { $debug_cmd save_ifs=$IFS; IFS='~' for cmd in $1; do IFS=$sp$nl eval cmd=\"$cmd\" IFS=$save_ifs func_show_eval "$cmd" "${2-:}" done IFS=$save_ifs } # func_source file # Source FILE, adding directory component if necessary. # Note that it is not necessary on cygwin/mingw to append a dot to # FILE even if both FILE and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # 'FILE.' does not work on cygwin managed mounts. func_source () { $debug_cmd case $1 in */* | *\\*) . "$1" ;; *) . "./$1" ;; esac } # func_resolve_sysroot PATH # Replace a leading = in PATH with a sysroot. Store the result into # func_resolve_sysroot_result func_resolve_sysroot () { func_resolve_sysroot_result=$1 case $func_resolve_sysroot_result in =*) func_stripname '=' '' "$func_resolve_sysroot_result" func_resolve_sysroot_result=$lt_sysroot$func_stripname_result ;; esac } # func_replace_sysroot PATH # If PATH begins with the sysroot, replace it with = and # store the result into func_replace_sysroot_result. func_replace_sysroot () { case $lt_sysroot:$1 in ?*:"$lt_sysroot"*) func_stripname "$lt_sysroot" '' "$1" func_replace_sysroot_result='='$func_stripname_result ;; *) # Including no sysroot. func_replace_sysroot_result=$1 ;; esac } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { $debug_cmd if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case "$@ " in " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with '--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_write_libtool_object output_name pic_name nonpic_name # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. func_write_libtool_object () { write_libobj=$1 if test yes = "$build_libtool_libs"; then write_lobj=\'$2\' else write_lobj=none fi if test yes = "$build_old_libs"; then write_oldobj=\'$3\' else write_oldobj=none fi $opt_dry_run || { cat >${write_libobj}T </dev/null` if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | $SED -e "$sed_naive_backslashify"` else func_convert_core_file_wine_to_w32_result= fi fi } # end: func_convert_core_file_wine_to_w32 # func_convert_core_path_wine_to_w32 ARG # Helper function used by path conversion functions when $build is *nix, and # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly # configured wine environment available, with the winepath program in $build's # $PATH. Assumes ARG has no leading or trailing path separator characters. # # ARG is path to be converted from $build format to win32. # Result is available in $func_convert_core_path_wine_to_w32_result. # Unconvertible file (directory) names in ARG are skipped; if no directory names # are convertible, then the result may be empty. func_convert_core_path_wine_to_w32 () { $debug_cmd # unfortunately, winepath doesn't convert paths, only file names func_convert_core_path_wine_to_w32_result= if test -n "$1"; then oldIFS=$IFS IFS=: for func_convert_core_path_wine_to_w32_f in $1; do IFS=$oldIFS func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" if test -n "$func_convert_core_file_wine_to_w32_result"; then if test -z "$func_convert_core_path_wine_to_w32_result"; then func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result else func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" fi fi done IFS=$oldIFS fi } # end: func_convert_core_path_wine_to_w32 # func_cygpath ARGS... # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or # (2), returns the Cygwin file name or path in func_cygpath_result (input # file name or path is assumed to be in w32 format, as previously converted # from $build's *nix or MSYS format). In case (3), returns the w32 file name # or path in func_cygpath_result (input file name or path is assumed to be in # Cygwin format). Returns an empty string on error. # # ARGS are passed to cygpath, with the last one being the file name or path to # be converted. # # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH # environment variable; do not put it in $PATH. func_cygpath () { $debug_cmd if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` if test "$?" -ne 0; then # on failure, ensure result is empty func_cygpath_result= fi else func_cygpath_result= func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'" fi } #end: func_cygpath # func_convert_core_msys_to_w32 ARG # Convert file name or path ARG from MSYS format to w32 format. Return # result in func_convert_core_msys_to_w32_result. func_convert_core_msys_to_w32 () { $debug_cmd # awkward: cmd appends spaces to result func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"` } #end: func_convert_core_msys_to_w32 # func_convert_file_check ARG1 ARG2 # Verify that ARG1 (a file name in $build format) was converted to $host # format in ARG2. Otherwise, emit an error message, but continue (resetting # func_to_host_file_result to ARG1). func_convert_file_check () { $debug_cmd if test -z "$2" && test -n "$1"; then func_error "Could not determine host file name corresponding to" func_error " '$1'" func_error "Continuing, but uninstalled executables may not work." # Fallback: func_to_host_file_result=$1 fi } # end func_convert_file_check # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH # Verify that FROM_PATH (a path in $build format) was converted to $host # format in TO_PATH. Otherwise, emit an error message, but continue, resetting # func_to_host_file_result to a simplistic fallback value (see below). func_convert_path_check () { $debug_cmd if test -z "$4" && test -n "$3"; then func_error "Could not determine the host path corresponding to" func_error " '$3'" func_error "Continuing, but uninstalled executables may not work." # Fallback. This is a deliberately simplistic "conversion" and # should not be "improved". See libtool.info. if test "x$1" != "x$2"; then lt_replace_pathsep_chars="s|$1|$2|g" func_to_host_path_result=`echo "$3" | $SED -e "$lt_replace_pathsep_chars"` else func_to_host_path_result=$3 fi fi } # end func_convert_path_check # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT # and appending REPL if ORIG matches BACKPAT. func_convert_path_front_back_pathsep () { $debug_cmd case $4 in $1 ) func_to_host_path_result=$3$func_to_host_path_result ;; esac case $4 in $2 ) func_append func_to_host_path_result "$3" ;; esac } # end func_convert_path_front_back_pathsep ################################################## # $build to $host FILE NAME CONVERSION FUNCTIONS # ################################################## # invoked via '$to_host_file_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # Result will be available in $func_to_host_file_result. # func_to_host_file ARG # Converts the file name ARG from $build format to $host format. Return result # in func_to_host_file_result. func_to_host_file () { $debug_cmd $to_host_file_cmd "$1" } # end func_to_host_file # func_to_tool_file ARG LAZY # converts the file name ARG from $build format to toolchain format. Return # result in func_to_tool_file_result. If the conversion in use is listed # in (the comma separated) LAZY, no conversion takes place. func_to_tool_file () { $debug_cmd case ,$2, in *,"$to_tool_file_cmd",*) func_to_tool_file_result=$1 ;; *) $to_tool_file_cmd "$1" func_to_tool_file_result=$func_to_host_file_result ;; esac } # end func_to_tool_file # func_convert_file_noop ARG # Copy ARG to func_to_host_file_result. func_convert_file_noop () { func_to_host_file_result=$1 } # end func_convert_file_noop # func_convert_file_msys_to_w32 ARG # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_file_result. func_convert_file_msys_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_to_host_file_result=$func_convert_core_msys_to_w32_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_w32 # func_convert_file_cygwin_to_w32 ARG # Convert file name ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_file_cygwin_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then # because $build is cygwin, we call "the" cygpath in $PATH; no need to use # LT_CYGPATH in this case. func_to_host_file_result=`cygpath -m "$1"` fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_cygwin_to_w32 # func_convert_file_nix_to_w32 ARG # Convert file name ARG from *nix to w32 format. Requires a wine environment # and a working winepath. Returns result in func_to_host_file_result. func_convert_file_nix_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_file_wine_to_w32 "$1" func_to_host_file_result=$func_convert_core_file_wine_to_w32_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_w32 # func_convert_file_msys_to_cygwin ARG # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_file_msys_to_cygwin () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_cygpath -u "$func_convert_core_msys_to_w32_result" func_to_host_file_result=$func_cygpath_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_cygwin # func_convert_file_nix_to_cygwin ARG # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed # in a wine environment, working winepath, and LT_CYGPATH set. Returns result # in func_to_host_file_result. func_convert_file_nix_to_cygwin () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. func_convert_core_file_wine_to_w32 "$1" func_cygpath -u "$func_convert_core_file_wine_to_w32_result" func_to_host_file_result=$func_cygpath_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_cygwin ############################################# # $build to $host PATH CONVERSION FUNCTIONS # ############################################# # invoked via '$to_host_path_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # The result will be available in $func_to_host_path_result. # # Path separators are also converted from $build format to $host format. If # ARG begins or ends with a path separator character, it is preserved (but # converted to $host format) on output. # # All path conversion functions are named using the following convention: # file name conversion function : func_convert_file_X_to_Y () # path conversion function : func_convert_path_X_to_Y () # where, for any given $build/$host combination the 'X_to_Y' value is the # same. If conversion functions are added for new $build/$host combinations, # the two new functions must follow this pattern, or func_init_to_host_path_cmd # will break. # func_init_to_host_path_cmd # Ensures that function "pointer" variable $to_host_path_cmd is set to the # appropriate value, based on the value of $to_host_file_cmd. to_host_path_cmd= func_init_to_host_path_cmd () { $debug_cmd if test -z "$to_host_path_cmd"; then func_stripname 'func_convert_file_' '' "$to_host_file_cmd" to_host_path_cmd=func_convert_path_$func_stripname_result fi } # func_to_host_path ARG # Converts the path ARG from $build format to $host format. Return result # in func_to_host_path_result. func_to_host_path () { $debug_cmd func_init_to_host_path_cmd $to_host_path_cmd "$1" } # end func_to_host_path # func_convert_path_noop ARG # Copy ARG to func_to_host_path_result. func_convert_path_noop () { func_to_host_path_result=$1 } # end func_convert_path_noop # func_convert_path_msys_to_w32 ARG # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_path_result. func_convert_path_msys_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # Remove leading and trailing path separator characters from ARG. MSYS # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; # and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result=$func_convert_core_msys_to_w32_result func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_msys_to_w32 # func_convert_path_cygwin_to_w32 ARG # Convert path ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_path_cygwin_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_cygwin_to_w32 # func_convert_path_nix_to_w32 ARG # Convert path ARG from *nix to w32 format. Requires a wine environment and # a working winepath. Returns result in func_to_host_file_result. func_convert_path_nix_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result=$func_convert_core_path_wine_to_w32_result func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_nix_to_w32 # func_convert_path_msys_to_cygwin ARG # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_path_msys_to_cygwin () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_msys_to_w32_result" func_to_host_path_result=$func_cygpath_result func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_msys_to_cygwin # func_convert_path_nix_to_cygwin ARG # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a # a wine environment, working winepath, and LT_CYGPATH set. Returns result in # func_to_host_file_result. func_convert_path_nix_to_cygwin () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # Remove leading and trailing path separator characters from # ARG. msys behavior is inconsistent here, cygpath turns them # into '.;' and ';.', and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" func_to_host_path_result=$func_cygpath_result func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_nix_to_cygwin # func_dll_def_p FILE # True iff FILE is a Windows DLL '.def' file. # Keep in sync with _LT_DLL_DEF_P in libtool.m4 func_dll_def_p () { $debug_cmd func_dll_def_p_tmp=`$SED -n \ -e 's/^[ ]*//' \ -e '/^\(;.*\)*$/d' \ -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \ -e q \ "$1"` test DEF = "$func_dll_def_p_tmp" } # func_mode_compile arg... func_mode_compile () { $debug_cmd # Get the compilation command and the source file. base_compile= srcfile=$nonopt # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= pie_flag= for arg do case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg=$arg arg_mode=normal ;; target ) libobj=$arg arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) test -n "$libobj" && \ func_fatal_error "you cannot specify '-o' more than once" arg_mode=target continue ;; -pie | -fpie | -fPIE) func_append pie_flag " $arg" continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) func_append later " $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result lastarg= save_ifs=$IFS; IFS=, for arg in $args; do IFS=$save_ifs func_append_quoted lastarg "$arg" done IFS=$save_ifs func_stripname ' ' '' "$lastarg" lastarg=$func_stripname_result # Add the arguments to base_compile. func_append base_compile " $lastarg" continue ;; *) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg=$srcfile srcfile=$arg ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. func_append_quoted base_compile "$lastarg" done # for arg case $arg_mode in arg) func_fatal_error "you must specify an argument for -Xcompile" ;; target) func_fatal_error "you must specify a target with '-o'" ;; *) # Get the name of the library object. test -z "$libobj" && { func_basename "$srcfile" libobj=$func_basename_result } ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo case $libobj in *.[cCFSifmso] | \ *.ada | *.adb | *.ads | *.asm | \ *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) func_xform "$libobj" libobj=$func_xform_result ;; esac case $libobj in *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; *) func_fatal_error "cannot determine name of library object from '$libobj'" ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -shared) test yes = "$build_libtool_libs" \ || func_fatal_configuration "cannot build a shared library" build_old_libs=no continue ;; -static) build_libtool_libs=no build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done func_quote_arg pretty "$libobj" test "X$libobj" != "X$func_quote_arg_result" \ && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ && func_warning "libobj name '$libobj' may not contain shell special characters." func_dirname_and_basename "$obj" "/" "" objname=$func_basename_result xdir=$func_dirname_result lobj=$xdir$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test yes = "$build_old_libs"; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2* | cegcc*) pic_mode=default ;; esac if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test no = "$compiler_c_o"; then output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext lockfile=$output_obj.lock else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test yes = "$need_locks"; then until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done elif test warn = "$need_locks"; then if test -f "$lockfile"; then $ECHO "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support '-c' and '-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi func_append removelist " $output_obj" $ECHO "$srcfile" > "$lockfile" fi $opt_dry_run || $RM $removelist func_append removelist " $lockfile" trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 srcfile=$func_to_tool_file_result func_quote_arg pretty "$srcfile" qsrcfile=$func_quote_arg_result # Only build a PIC object if we are building libtool libraries. if test yes = "$build_libtool_libs"; then # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile if test no != "$pic_mode"; then command="$base_compile $qsrcfile $pic_flag" else # Don't build PIC code command="$base_compile $qsrcfile" fi func_mkdir_p "$xdir$objdir" if test -z "$output_obj"; then # Place PIC objects in $objdir func_append command " -o $lobj" fi func_show_eval_locale "$command" \ 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' if test warn = "$need_locks" && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support '-c' and '-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then func_show_eval '$MV "$output_obj" "$lobj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi # Allow error messages only from the first compilation. if test yes = "$suppress_opt"; then suppress_output=' >/dev/null 2>&1' fi fi # Only build a position-dependent object if we build old libraries. if test yes = "$build_old_libs"; then if test yes != "$pic_mode"; then # Don't build PIC code command="$base_compile $qsrcfile$pie_flag" else command="$base_compile $qsrcfile $pic_flag" fi if test yes = "$compiler_c_o"; then func_append command " -o $obj" fi # Suppress compiler output if we already did a PIC compilation. func_append command "$suppress_output" func_show_eval_locale "$command" \ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' if test warn = "$need_locks" && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support '-c' and '-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then func_show_eval '$MV "$output_obj" "$obj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi fi $opt_dry_run || { func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" # Unlock the critical section if it was locked if test no != "$need_locks"; then removelist=$lockfile $RM "$lockfile" fi } exit $EXIT_SUCCESS } $opt_help || { test compile = "$opt_mode" && func_mode_compile ${1+"$@"} } func_mode_help () { # We need to display help for each of the modes. case $opt_mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $ECHO \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $ECHO \ "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to build PIC objects only -prefer-non-pic try to build non-PIC objects only -shared do not build a '.o' file suitable for static linking -static only build a '.o' file suitable for static linking -Wc,FLAG -Xcompiler FLAG pass FLAG directly to the compiler COMPILE-COMMAND is a command to be used in creating a 'standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix '.c' with the library object suffix, '.lo'." ;; execute) $ECHO \ "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to '-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $ECHO \ "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the '--dry-run' option if you just want to see what would be executed." ;; install) $ECHO \ "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the 'install' or 'cp' program. The following components of INSTALL-COMMAND are treated specially: -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $ECHO \ "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -bindir BINDIR specify path to binaries directory (for systems where libraries must be found in the PATH setting at runtime) -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE use a list of object files found in FILE to specify objects -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes) -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of uninstalled libtool libraries -static-libtool-libs do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface -Wc,FLAG -Xcompiler FLAG pass linker-specific FLAG directly to the compiler -Wa,FLAG -Xassembler FLAG pass linker-specific FLAG directly to the assembler -Wl,FLAG -Xlinker FLAG pass linker-specific FLAG directly to the linker -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) All other options (arguments beginning with '-') are ignored. Every other argument is treated as a filename. Files ending in '.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in '.la', then a libtool library is created, only library objects ('.lo' files) may be specified, and '-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created using 'ar' and 'ranlib', or on Windows using 'lib'. If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $ECHO \ "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) func_fatal_help "invalid operation mode '$opt_mode'" ;; esac echo $ECHO "Try '$progname --help' for more information about other modes." } # Now that we've collected a possible --mode arg, show help if necessary if $opt_help; then if test : = "$opt_help"; then func_mode_help else { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do func_mode_help done } | $SED -n '1p; 2,$s/^Usage:/ or: /p' { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do echo func_mode_help done } | $SED '1d /^When reporting/,/^Report/{ H d } $x /information about other modes/d /more detailed .*MODE/d s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' fi exit $? fi # func_mode_execute arg... func_mode_execute () { $debug_cmd # The first argument is the command name. cmd=$nonopt test -z "$cmd" && \ func_fatal_help "you must specify a COMMAND" # Handle -dlopen flags immediately. for file in $opt_dlopen; do test -f "$file" \ || func_fatal_help "'$file' is not a file" dir= case $file in *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "'$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= func_source "$file" # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "'$file' was not linked with '-export-dynamic'" continue fi func_dirname "$file" "" "." dir=$func_dirname_result if test -f "$dir/$objdir/$dlname"; then func_append dir "/$objdir" else if test ! -f "$dir/$dlname"; then func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'" fi fi ;; *.lo) # Just add the directory containing the .lo file. func_dirname "$file" "" "." dir=$func_dirname_result ;; *) func_warning "'-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir=$absdir # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic=$magic # Check if any of the arguments is a wrapper script. args= for file do case $file in -* | *.la | *.lo ) ;; *) # Do a test to see if this is really a libtool program. if func_ltwrapper_script_p "$file"; then func_source "$file" # Transform arg to wrapped name. file=$progdir/$program elif func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" func_source "$func_ltwrapper_scriptname_result" # Transform arg to wrapped name. file=$progdir/$program fi ;; esac # Quote arguments (to preserve shell metacharacters). func_append_quoted args "$file" done if $opt_dry_run; then # Display what would be done. if test -n "$shlibpath_var"; then eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" echo "export $shlibpath_var" fi $ECHO "$cmd$args" exit $EXIT_SUCCESS else if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${save_$lt_var+set}\" = set; then $lt_var=\$save_$lt_var; export $lt_var else $lt_unset $lt_var fi" done # Now prepare to actually exec the command. exec_cmd=\$cmd$args fi } test execute = "$opt_mode" && func_mode_execute ${1+"$@"} # func_mode_finish arg... func_mode_finish () { $debug_cmd libs= libdirs= admincmds= for opt in "$nonopt" ${1+"$@"} do if test -d "$opt"; then func_append libdirs " $opt" elif test -f "$opt"; then if func_lalib_unsafe_p "$opt"; then func_append libs " $opt" else func_warning "'$opt' is not a valid libtool archive" fi else func_fatal_error "invalid argument '$opt'" fi done if test -n "$libs"; then if test -n "$lt_sysroot"; then sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" else sysroot_cmd= fi # Remove sysroot references if $opt_dry_run; then for lib in $libs; do echo "removing references to $lt_sysroot and '=' prefixes from $lib" done else tmpdir=`func_mktempdir` for lib in $libs; do $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ > $tmpdir/tmp-la mv -f $tmpdir/tmp-la $lib done ${RM}r "$tmpdir" fi fi if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds '"$cmd"'"' fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $opt_dry_run || eval "$cmds" || func_append admincmds " $cmds" fi done fi # Exit here if they wanted silent mode. $opt_quiet && exit $EXIT_SUCCESS if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then echo "----------------------------------------------------------------------" echo "Libraries have been installed in:" for libdir in $libdirs; do $ECHO " $libdir" done echo echo "If you ever happen to want to link against installed libraries" echo "in a given directory, LIBDIR, you must either use libtool, and" echo "specify the full pathname of the library, or use the '-LLIBDIR'" echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then echo " - add LIBDIR to the '$shlibpath_var' environment variable" echo " during execution" fi if test -n "$runpath_var"; then echo " - add LIBDIR to the '$runpath_var' environment variable" echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $ECHO " - use the '$flag' linker flag" fi if test -n "$admincmds"; then $ECHO " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'" fi echo echo "See any operating system documentation about shared libraries for" case $host in solaris2.[6789]|solaris2.1[0-9]) echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" echo "pages." ;; *) echo "more information, such as the ld(1) and ld.so(8) manual pages." ;; esac echo "----------------------------------------------------------------------" fi exit $EXIT_SUCCESS } test finish = "$opt_mode" && func_mode_finish ${1+"$@"} # func_mode_install arg... func_mode_install () { $debug_cmd # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" || # Allow the use of GNU shtool's install command. case $nonopt in *shtool*) :;; *) false;; esac then # Aesthetically quote it. func_quote_arg pretty "$nonopt" install_prog="$func_quote_arg_result " arg=$1 shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. func_quote_arg pretty "$arg" func_append install_prog "$func_quote_arg_result" install_shared_prog=$install_prog case " $install_prog " in *[\\\ /]cp\ *) install_cp=: ;; *) install_cp=false ;; esac # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=false stripme= no_mode=: for arg do arg2= if test -n "$dest"; then func_append files " $dest" dest=$arg continue fi case $arg in -d) isdir=: ;; -f) if $install_cp; then :; else prev=$arg fi ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then if test X-m = "X$prev" && test -n "$install_override_mode"; then arg2=$install_override_mode no_mode=false fi prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. func_quote_arg pretty "$arg" func_append install_prog " $func_quote_arg_result" if test -n "$arg2"; then func_quote_arg pretty "$arg2" fi func_append install_shared_prog " $func_quote_arg_result" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the '$prev' option requires an argument" if test -n "$install_override_mode" && $no_mode; then if $install_cp; then :; else func_quote_arg pretty "$install_override_mode" func_append install_shared_prog " -m $func_quote_arg_result" fi fi if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. func_stripname '' '/' "$dest" dest=$func_stripname_result # Check to see that the destination is a directory. test -d "$dest" && isdir=: if $isdir; then destdir=$dest destname= else func_dirname_and_basename "$dest" "" "." destdir=$func_dirname_result destname=$func_basename_result # Not a directory, so check to see that there is only one file specified. set dummy $files; shift test "$#" -gt 1 && \ func_fatal_help "'$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "'$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic=$magic staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. func_append staticlibs " $file" ;; *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "'$file' is not a valid libtool archive" library_names= old_library= relink_command= func_source "$file" # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) func_append current_libdirs " $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) func_append future_libdirs " $libdir" ;; esac fi func_dirname "$file" "/" "" dir=$func_dirname_result func_append dir "$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking '$file'" func_show_eval "$relink_command" \ 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"' fi # See the names of the shared library. set dummy $library_names; shift if test -n "$1"; then realname=$1 shift srcname=$realname test -n "$relink_command" && srcname=${realname}T # Install the shared library and build the symlinks. func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 'exit $?' tstripme=$stripme case $host_os in cygwin* | mingw* | pw32* | cegcc*) case $realname in *.dll.a) tstripme= ;; esac ;; os2*) case $realname in *_dll.a) tstripme= ;; esac ;; esac if test -n "$tstripme" && test -n "$striplib"; then func_show_eval "$striplib $destdir/$realname" 'exit $?' fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try 'ln -sf' first, because the 'ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do test "$linkname" != "$realname" \ && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" done fi # Do each command in the postinstall commands. lib=$destdir/$realname func_execute_cmds "$postinstall_cmds" 'exit $?' fi # Install the pseudo-library for information purposes. func_basename "$file" name=$func_basename_result instname=$dir/${name}i func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' # Maybe install the static library, too. test -n "$old_library" && func_append staticlibs " $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile=$destdir/$destname else func_basename "$file" destfile=$func_basename_result destfile=$destdir/$destfile fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) func_lo2o "$destfile" staticdest=$func_lo2o_result ;; *.$objext) staticdest=$destfile destfile= ;; *) func_fatal_help "cannot copy a libtool object to '$destfile'" ;; esac # Install the libtool object if requested. test -n "$destfile" && \ func_show_eval "$install_prog $file $destfile" 'exit $?' # Install the old object if enabled. if test yes = "$build_old_libs"; then # Deduce the name of the old-style object file. func_lo2o "$file" staticobj=$func_lo2o_result func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile=$destdir/$destname else func_basename "$file" destfile=$func_basename_result destfile=$destdir/$destfile fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext= case $file in *.exe) if test ! -f "$file"; then func_stripname '' '.exe' "$file" file=$func_stripname_result stripped_ext=.exe fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin* | *mingw*) if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" wrapper=$func_ltwrapper_scriptname_result else func_stripname '' '.exe' "$file" wrapper=$func_stripname_result fi ;; *) wrapper=$file ;; esac if func_ltwrapper_script_p "$wrapper"; then notinst_deplibs= relink_command= func_source "$wrapper" # Check the variables that should have been set. test -z "$generated_by_libtool_version" && \ func_fatal_error "invalid libtool wrapper script '$wrapper'" finalize=: for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then func_source "$lib" fi libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'` if test -n "$libdir" && test ! -f "$libfile"; then func_warning "'$lib' has not been installed in '$libdir'" finalize=false fi done relink_command= func_source "$wrapper" outputname= if test no = "$fast_install" && test -n "$relink_command"; then $opt_dry_run || { if $finalize; then tmpdir=`func_mktempdir` func_basename "$file$stripped_ext" file=$func_basename_result outputname=$tmpdir/$file # Replace the output file specification. relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` $opt_quiet || { func_quote_arg expand,pretty "$relink_command" eval "func_echo $func_quote_arg_result" } if eval "$relink_command"; then : else func_error "error: relink '$file' with the above command before installing it" $opt_dry_run || ${RM}r "$tmpdir" continue fi file=$outputname else func_warning "cannot relink '$file'" fi } else # Install the binary that we compiled earlier. file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) func_stripname '' '.exe' "$destfile" destfile=$func_stripname_result ;; esac ;; esac func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' $opt_dry_run || if test -n "$outputname"; then ${RM}r "$tmpdir" fi ;; esac done for file in $staticlibs; do func_basename "$file" name=$func_basename_result # Set up the ranlib parameters. oldlib=$destdir/$name func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result func_show_eval "$install_prog \$file \$oldlib" 'exit $?' if test -n "$stripme" && test -n "$old_striplib"; then func_show_eval "$old_striplib $tool_oldlib" 'exit $?' fi # Do each command in the postinstall commands. func_execute_cmds "$old_postinstall_cmds" 'exit $?' done test -n "$future_libdirs" && \ func_warning "remember to run '$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. $opt_dry_run && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } test install = "$opt_mode" && func_mode_install ${1+"$@"} # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { $debug_cmd my_outputname=$1 my_originator=$2 my_pic_p=${3-false} my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms=${my_outputname}S.c else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist=$output_objdir/$my_outputname.nm func_show_eval "$RM $nlist ${nlist}S ${nlist}T" # Parse the name list into a source file. func_verbose "creating $output_objdir/$my_dlsyms" $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" #endif /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) /* External symbol declarations for the compiler. */\ " if test yes = "$dlself"; then func_verbose "generating symbol list for '$output'" $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` for progfile in $progfiles; do func_to_tool_file "$progfile" func_convert_file_msys_to_w32 func_verbose "extracting global C symbols from '$func_to_tool_file_result'" $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $opt_dry_run || { eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi if test -n "$export_symbols_regex"; then $opt_dry_run || { eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols=$output_objdir/$outputname.exp $opt_dry_run || { $RM $export_symbols eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac } else $opt_dry_run || { eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac } fi fi for dlprefile in $dlprefiles; do func_verbose "extracting global C symbols from '$dlprefile'" func_basename "$dlprefile" name=$func_basename_result case $host in *cygwin* | *mingw* | *cegcc* ) # if an import library, we need to obtain dlname if func_win32_import_lib_p "$dlprefile"; then func_tr_sh "$dlprefile" eval "curr_lafile=\$libfile_$func_tr_sh_result" dlprefile_dlbasename= if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then # Use subshell, to avoid clobbering current variable values dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` if test -n "$dlprefile_dlname"; then func_basename "$dlprefile_dlname" dlprefile_dlbasename=$func_basename_result else # no lafile. user explicitly requested -dlpreopen . $sharedlib_from_linklib_cmd "$dlprefile" dlprefile_dlbasename=$sharedlib_from_linklib_result fi fi $opt_dry_run || { if test -n "$dlprefile_dlbasename"; then eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' else func_warning "Could not compute DLL name from $name" eval '$ECHO ": $name " >> "$nlist"' fi func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" } else # not an import lib $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } fi ;; *) $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } ;; esac done $opt_dry_run || { # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $MV "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi func_show_eval '$RM "${nlist}I"' if test -n "$global_symbol_to_import"; then eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I' fi echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ typedef struct { const char *name; void *address; } lt_dlsymlist; extern LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[];\ " if test -s "$nlist"I; then echo >> "$output_objdir/$my_dlsyms" "\ static void lt_syminit(void) { LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols; for (; symbol->name; ++symbol) {" $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms" echo >> "$output_objdir/$my_dlsyms" "\ } }" fi echo >> "$output_objdir/$my_dlsyms" "\ LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[] = { {\"$my_originator\", (void *) 0}," if test -s "$nlist"I; then echo >> "$output_objdir/$my_dlsyms" "\ {\"@INIT@\", (void *) <_syminit}," fi case $need_lib_prefix in no) eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; *) eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; esac echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " } # !$opt_dry_run pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) $my_pic_p && pic_flag_for_symtable=" $pic_flag" ;; esac ;; esac symtab_cflags= for arg in $LTCFLAGS; do case $arg in -pie | -fpie | -fPIE) ;; *) func_append symtab_cflags " $arg" ;; esac done # Now compile the dynamic symbol file. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' # Clean up the generated files. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"' # Transform the symbol file into the correct name. symfileobj=$output_objdir/${my_outputname}S.$objext case $host in *cygwin* | *mingw* | *cegcc* ) if test -f "$output_objdir/$my_outputname.def"; then compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` else compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` fi ;; *) compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` ;; esac ;; *) func_fatal_error "unknown suffix for '$my_dlsyms'" ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` fi } # func_cygming_gnu_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is a GNU/binutils-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_gnu_implib_p () { $debug_cmd func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` test -n "$func_cygming_gnu_implib_tmp" } # func_cygming_ms_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is an MS-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_ms_implib_p () { $debug_cmd func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` test -n "$func_cygming_ms_implib_tmp" } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. # Despite the name, also deal with 64 bit binaries. func_win32_libid () { $debug_cmd win32_libid_type=unknown win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then case $nm_interface in "MS dumpbin") if func_cygming_ms_implib_p "$1" || func_cygming_gnu_implib_p "$1" then win32_nmres=import else win32_nmres= fi ;; *) func_to_tool_file "$1" func_convert_file_msys_to_w32 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | $SED -n -e ' 1,100{ / I /{ s|.*|import| p q } }'` ;; esac case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $ECHO "$win32_libid_type" } # func_cygming_dll_for_implib ARG # # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib () { $debug_cmd sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` } # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs # # The is the core of a fallback implementation of a # platform-specific function to extract the name of the # DLL associated with the specified import library LIBNAME. # # SECTION_NAME is either .idata$6 or .idata$7, depending # on the platform and compiler that created the implib. # # Echos the name of the DLL associated with the # specified import library. func_cygming_dll_for_implib_fallback_core () { $debug_cmd match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` $OBJDUMP -s --section "$1" "$2" 2>/dev/null | $SED '/^Contents of section '"$match_literal"':/{ # Place marker at beginning of archive member dllname section s/.*/====MARK====/ p d } # These lines can sometimes be longer than 43 characters, but # are always uninteresting /:[ ]*file format pe[i]\{,1\}-/d /^In archive [^:]*:/d # Ensure marker is printed /^====MARK====/p # Remove all lines with less than 43 characters /^.\{43\}/!d # From remaining lines, remove first 43 characters s/^.\{43\}//' | $SED -n ' # Join marker and all lines until next marker into a single line /^====MARK====/ b para H $ b para b :para x s/\n//g # Remove the marker s/^====MARK====// # Remove trailing dots and whitespace s/[\. \t]*$// # Print /./p' | # we now have a list, one entry per line, of the stringified # contents of the appropriate section of all members of the # archive that possess that section. Heuristic: eliminate # all those that have a first or second character that is # a '.' (that is, objdump's representation of an unprintable # character.) This should work for all archives with less than # 0x302f exports -- but will fail for DLLs whose name actually # begins with a literal '.' or a single character followed by # a '.'. # # Of those that remain, print the first one. $SED -e '/^\./d;/^.\./d;q' } # func_cygming_dll_for_implib_fallback ARG # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # # This fallback implementation is for use when $DLLTOOL # does not support the --identify-strict option. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib_fallback () { $debug_cmd if func_cygming_gnu_implib_p "$1"; then # binutils import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` elif func_cygming_ms_implib_p "$1"; then # ms-generated import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` else # unknown sharedlib_from_linklib_result= fi } # func_extract_an_archive dir oldlib func_extract_an_archive () { $debug_cmd f_ex_an_ar_dir=$1; shift f_ex_an_ar_oldlib=$1 if test yes = "$lock_old_archive_extraction"; then lockfile=$f_ex_an_ar_oldlib.lock until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done fi func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 'stat=$?; rm -f "$lockfile"; exit $stat' if test yes = "$lock_old_archive_extraction"; then $opt_dry_run || rm -f "$lockfile" fi if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" fi } # func_extract_archives gentop oldlib ... func_extract_archives () { $debug_cmd my_gentop=$1; shift my_oldlibs=${1+"$@"} my_oldobjs= my_xlib= my_xabs= my_xdir= for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac func_basename "$my_xlib" my_xlib=$func_basename_result my_xlib_u=$my_xlib while :; do case " $extracted_archives " in *" $my_xlib_u "*) func_arith $extracted_serial + 1 extracted_serial=$func_arith_result my_xlib_u=lt$extracted_serial-$my_xlib ;; *) break ;; esac done extracted_archives="$extracted_archives $my_xlib_u" my_xdir=$my_gentop/$my_xlib_u func_mkdir_p "$my_xdir" case $host in *-darwin*) func_verbose "Extracting $my_xabs" # Do not bother doing anything if just a dry run $opt_dry_run || { darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` func_basename "$darwin_archive" darwin_base_archive=$func_basename_result darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` if test -n "$darwin_arches"; then darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches; do func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch" $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive" cd "unfat-$$/$darwin_base_archive-$darwin_arch" func_extract_an_archive "`pwd`" "$darwin_base_archive" cd "$darwin_curdir" $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" done # $darwin_arches ## Okay now we've a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` $LIPO -create -output "$darwin_file" $darwin_files done # $darwin_filelist $RM -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches } # !$opt_dry_run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` done func_extract_archives_result=$my_oldobjs } # func_emit_wrapper [arg=no] # # Emit a libtool wrapper script on stdout. # Don't directly open a file because we may want to # incorporate the script contents within a cygwin/mingw # wrapper executable. Must ONLY be called from within # func_mode_link because it depends on a number of variables # set therein. # # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR # variable will take. If 'yes', then the emitted script # will assume that the directory where it is stored is # the $objdir directory. This is a cygwin/mingw-specific # behavior. func_emit_wrapper () { func_emit_wrapper_arg1=${1-no} $ECHO "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='$sed_quote_subst' # Be Bourne compatible if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variables: generated_by_libtool_version='$macro_version' notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$ECHO are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then file=\"\$0\"" func_quote_arg pretty "$ECHO" qECHO=$func_quote_arg_result $ECHO "\ # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } ECHO=$qECHO fi # Very basic option parsing. These options are (a) specific to # the libtool wrapper, (b) are identical between the wrapper # /script/ and the wrapper /executable/ that is used only on # windows platforms, and (c) all begin with the string "--lt-" # (application programs are unlikely to have options that match # this pattern). # # There are only two supported options: --lt-debug and # --lt-dump-script. There is, deliberately, no --lt-help. # # The first argument to this parsing function should be the # script's $0 value, followed by "$@". lt_option_debug= func_parse_lt_options () { lt_script_arg0=\$0 shift for lt_opt do case \"\$lt_opt\" in --lt-debug) lt_option_debug=1 ;; --lt-dump-script) lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` cat \"\$lt_dump_D/\$lt_dump_F\" exit 0 ;; --lt-*) \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 exit 1 ;; esac done # Print the debug banner immediately: if test -n \"\$lt_option_debug\"; then echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2 fi } # Used when --lt-debug. Prints its arguments to stdout # (redirection is the responsibility of the caller) func_lt_dump_args () { lt_dump_args_N=1; for lt_arg do \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\" lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` done } # Core function for launching the target application func_exec_program_core () { " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2* | *-cegcc*) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $ECHO "\ \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 exit 1 } # A function to encapsulate launching the target application # Strips options in the --lt-* namespace from \$@ and # launches target application with the remaining arguments. func_exec_program () { case \" \$* \" in *\\ --lt-*) for lt_wr_arg do case \$lt_wr_arg in --lt-*) ;; *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; esac shift done ;; esac func_exec_program_core \${1+\"\$@\"} } # Parse options func_parse_lt_options \"\$0\" \${1+\"\$@\"} # Find the directory that this script lives in. thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` done # Usually 'no', except on cygwin/mingw when embedded into # the cwrapper. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then # special case for '.' if test \"\$thisdir\" = \".\"; then thisdir=\`pwd\` fi # remove .libs from thisdir case \"\$thisdir\" in *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; $objdir ) thisdir=. ;; esac fi # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test yes = "$fast_install"; then $ECHO "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $MKDIR \"\$progdir\" else $RM \"\$progdir/\$file\" fi" $ECHO "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else \$ECHO \"\$relink_command_output\" >&2 $RM \"\$progdir/\$file\" exit 1 fi fi $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $RM \"\$progdir/\$program\"; $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } $RM \"\$progdir/\$file\" fi" else $ECHO "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $ECHO "\ if test -f \"\$progdir/\$program\"; then" # fixup the dll searchpath if we need to. # # Fix the DLL searchpath if we need to. Do this before prepending # to shlibpath, because on Windows, both are PATH and uninstalled # libraries must come first. if test -n "$dllsearchpath"; then $ECHO "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi # Export our shlibpath_var if we have one. if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $ECHO "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` export $shlibpath_var " fi $ECHO "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. func_exec_program \${1+\"\$@\"} fi else # The program doesn't exist. \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " } # func_emit_cwrapperexe_src # emit the source code for a wrapper executable on stdout # Must ONLY be called from within func_mode_link because # it depends on a number of variable set therein. func_emit_cwrapperexe_src () { cat < #include #ifdef _MSC_VER # include # include # include #else # include # include # ifdef __CYGWIN__ # include # endif #endif #include #include #include #include #include #include #include #include #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) /* declarations of non-ANSI functions */ #if defined __MINGW32__ # ifdef __STRICT_ANSI__ int _putenv (const char *); # endif #elif defined __CYGWIN__ # ifdef __STRICT_ANSI__ char *realpath (const char *, char *); int putenv (char *); int setenv (const char *, const char *, int); # endif /* #elif defined other_platform || defined ... */ #endif /* portability defines, excluding path handling macros */ #if defined _MSC_VER # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv # define S_IXUSR _S_IEXEC #elif defined __MINGW32__ # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv #elif defined __CYGWIN__ # define HAVE_SETENV # define FOPEN_WB "wb" /* #elif defined other platforms ... */ #endif #if defined PATH_MAX # define LT_PATHMAX PATH_MAX #elif defined MAXPATHLEN # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef S_IXOTH # define S_IXOTH 0 #endif #ifndef S_IXGRP # define S_IXGRP 0 #endif /* path handling portability macros */ #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \ defined __OS2__ # define HAVE_DOS_BASED_FILE_SYSTEM # define FOPEN_WB "wb" # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #ifndef FOPEN_WB # define FOPEN_WB "w" #endif #ifndef _O_BINARY # define _O_BINARY 0 #endif #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free (stale); stale = 0; } \ } while (0) #if defined LT_DEBUGWRAPPER static int lt_debug = 1; #else static int lt_debug = 0; #endif const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ void *xmalloc (size_t num); char *xstrdup (const char *string); const char *base_name (const char *name); char *find_executable (const char *wrapper); char *chase_symlinks (const char *pathspec); int make_executable (const char *path); int check_executable (const char *path); char *strendzap (char *str, const char *pat); void lt_debugprintf (const char *file, int line, const char *fmt, ...); void lt_fatal (const char *file, int line, const char *message, ...); static const char *nonnull (const char *s); static const char *nonempty (const char *s); void lt_setenv (const char *name, const char *value); char *lt_extend_str (const char *orig_value, const char *add, int to_end); void lt_update_exe_path (const char *name, const char *value); void lt_update_lib_path (const char *name, const char *value); char **prepare_spawn (char **argv); void lt_dump_script (FILE *f); EOF cat <= 0) && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) return 1; else return 0; } int make_executable (const char *path) { int rval = 0; struct stat st; lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", nonempty (path)); if ((!path) || (!*path)) return 0; if (stat (path, &st) >= 0) { rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); } return rval; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise Does not chase symlinks, even on platforms that support them. */ char * find_executable (const char *wrapper) { int has_slash = 0; const char *p; const char *p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; size_t tmp_len; char *concat_name; lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", nonempty (wrapper)); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined HAVE_DOS_BASED_FILE_SYSTEM if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } #if defined HAVE_DOS_BASED_FILE_SYSTEM } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char *path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char *q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR (*q)) break; p_len = (size_t) (q - p); p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); return NULL; } char * chase_symlinks (const char *pathspec) { #ifndef S_ISLNK return xstrdup (pathspec); #else char buf[LT_PATHMAX]; struct stat s; char *tmp_pathspec = xstrdup (pathspec); char *p; int has_symlinks = 0; while (strlen (tmp_pathspec) && !has_symlinks) { lt_debugprintf (__FILE__, __LINE__, "checking path component for symlinks: %s\n", tmp_pathspec); if (lstat (tmp_pathspec, &s) == 0) { if (S_ISLNK (s.st_mode) != 0) { has_symlinks = 1; break; } /* search backwards for last DIR_SEPARATOR */ p = tmp_pathspec + strlen (tmp_pathspec) - 1; while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) p--; if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) { /* no more DIR_SEPARATORS left */ break; } *p = '\0'; } else { lt_fatal (__FILE__, __LINE__, "error accessing file \"%s\": %s", tmp_pathspec, nonnull (strerror (errno))); } } XFREE (tmp_pathspec); if (!has_symlinks) { return xstrdup (pathspec); } tmp_pathspec = realpath (pathspec, buf); if (tmp_pathspec == 0) { lt_fatal (__FILE__, __LINE__, "could not follow symlinks for %s", pathspec); } return xstrdup (tmp_pathspec); #endif } char * strendzap (char *str, const char *pat) { size_t len, patlen; assert (str != NULL); assert (pat != NULL); len = strlen (str); patlen = strlen (pat); if (patlen <= len) { str += len - patlen; if (STREQ (str, pat)) *str = '\0'; } return str; } void lt_debugprintf (const char *file, int line, const char *fmt, ...) { va_list args; if (lt_debug) { (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); va_start (args, fmt); (void) vfprintf (stderr, fmt, args); va_end (args); } } static void lt_error_core (int exit_status, const char *file, int line, const char *mode, const char *message, va_list ap) { fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *file, int line, const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); va_end (ap); } static const char * nonnull (const char *s) { return s ? s : "(null)"; } static const char * nonempty (const char *s) { return (s && !*s) ? "(empty)" : nonnull (s); } void lt_setenv (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_setenv) setting '%s' to '%s'\n", nonnull (name), nonnull (value)); { #ifdef HAVE_SETENV /* always make a copy, for consistency with !HAVE_SETENV */ char *str = xstrdup (value); setenv (name, str, 1); #else size_t len = strlen (name) + 1 + strlen (value) + 1; char *str = XMALLOC (char, len); sprintf (str, "%s=%s", name, value); if (putenv (str) != EXIT_SUCCESS) { XFREE (str); } #endif } } char * lt_extend_str (const char *orig_value, const char *add, int to_end) { char *new_value; if (orig_value && *orig_value) { size_t orig_value_len = strlen (orig_value); size_t add_len = strlen (add); new_value = XMALLOC (char, add_len + orig_value_len + 1); if (to_end) { strcpy (new_value, orig_value); strcpy (new_value + orig_value_len, add); } else { strcpy (new_value, add); strcpy (new_value + add_len, orig_value); } } else { new_value = xstrdup (add); } return new_value; } void lt_update_exe_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); /* some systems can't cope with a ':'-terminated path #' */ size_t len = strlen (new_value); while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1])) { new_value[--len] = '\0'; } lt_setenv (name, new_value); XFREE (new_value); } } void lt_update_lib_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); lt_setenv (name, new_value); XFREE (new_value); } } EOF case $host_os in mingw*) cat <<"EOF" /* Prepares an argument vector before calling spawn(). Note that spawn() does not by itself call the command interpreter (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&v); v.dwPlatformId == VER_PLATFORM_WIN32_NT; }) ? "cmd.exe" : "command.com"). Instead it simply concatenates the arguments, separated by ' ', and calls CreateProcess(). We must quote the arguments since Win32 CreateProcess() interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a special way: - Space and tab are interpreted as delimiters. They are not treated as delimiters if they are surrounded by double quotes: "...". - Unescaped double quotes are removed from the input. Their only effect is that within double quotes, space and tab are treated like normal characters. - Backslashes not followed by double quotes are not special. - But 2*n+1 backslashes followed by a double quote become n backslashes followed by a double quote (n >= 0): \" -> " \\\" -> \" \\\\\" -> \\" */ #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" char ** prepare_spawn (char **argv) { size_t argc; char **new_argv; size_t i; /* Count number of arguments. */ for (argc = 0; argv[argc] != NULL; argc++) ; /* Allocate new argument vector. */ new_argv = XMALLOC (char *, argc + 1); /* Put quoted arguments into the new argument vector. */ for (i = 0; i < argc; i++) { const char *string = argv[i]; if (string[0] == '\0') new_argv[i] = xstrdup ("\"\""); else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) { int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); size_t length; unsigned int backslashes; const char *s; char *quoted_string; char *p; length = 0; backslashes = 0; if (quote_around) length++; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') length += backslashes + 1; length++; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) length += backslashes + 1; quoted_string = XMALLOC (char, length + 1); p = quoted_string; backslashes = 0; if (quote_around) *p++ = '"'; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') { unsigned int j; for (j = backslashes + 1; j > 0; j--) *p++ = '\\'; } *p++ = c; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) { unsigned int j; for (j = backslashes; j > 0; j--) *p++ = '\\'; *p++ = '"'; } *p = '\0'; new_argv[i] = quoted_string; } else new_argv[i] = (char *) string; } new_argv[argc] = NULL; return new_argv; } EOF ;; esac cat <<"EOF" void lt_dump_script (FILE* f) { EOF func_emit_wrapper yes | $SED -n -e ' s/^\(.\{79\}\)\(..*\)/\1\ \2/ h s/\([\\"]\)/\\\1/g s/$/\\n/ s/\([^\n]*\).*/ fputs ("\1", f);/p g D' cat <<"EOF" } EOF } # end: func_emit_cwrapperexe_src # func_win32_import_lib_p ARG # True if ARG is an import lib, as indicated by $file_magic_cmd func_win32_import_lib_p () { $debug_cmd case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in *import*) : ;; *) false ;; esac } # func_suncc_cstd_abi # !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!! # Several compiler flags select an ABI that is incompatible with the # Cstd library. Avoid specifying it if any are in CXXFLAGS. func_suncc_cstd_abi () { $debug_cmd case " $compile_command " in *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*) suncc_use_cstd_abi=no ;; *) suncc_use_cstd_abi=yes ;; esac } # func_mode_link arg... func_mode_link () { $debug_cmd case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # what system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll that has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args=$nonopt base_compile="$nonopt $@" compile_command=$nonopt finalize_command=$nonopt compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= new_inherited_linker_flags= avoid_version=no bindir= dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= os2dllname= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=false prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= single_module=$wl-single_module func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test yes != "$build_libtool_libs" \ && func_fatal_configuration "cannot build a shared library" build_old_libs=no break ;; -all-static | -static | -static-libtool-libs) case $arg in -all-static) if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; -static) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built ;; -static-libtool-libs) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; esac build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg=$1 shift func_quote_arg pretty,unquoted "$arg" qarg=$func_quote_arg_unquoted_result func_append libtool_args " $func_quote_arg_result" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) func_append compile_command " @OUTPUT@" func_append finalize_command " @OUTPUT@" ;; esac case $prev in bindir) bindir=$arg prev= continue ;; dlfiles|dlprefiles) $preload || { # Add the symbol object into the linking commands. func_append compile_command " @SYMFILE@" func_append finalize_command " @SYMFILE@" preload=: } case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test no = "$dlself"; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test dlprefiles = "$prev"; then dlself=yes elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test dlfiles = "$prev"; then func_append dlfiles " $arg" else func_append dlprefiles " $arg" fi prev= continue ;; esac ;; expsyms) export_symbols=$arg test -f "$arg" \ || func_fatal_error "symbol file '$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex=$arg prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) func_append deplibs " $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir=$arg prev= continue ;; mllvm) # Clang does not use LLVM to link, so we can simply discard any # '-mllvm $arg' options when doing the link step. prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat "$save_arg"` do # func_append moreargs " $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test none = "$pic_object" && test none = "$non_pic_object"; then func_fatal_error "cannot find name of object for '$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result if test none != "$pic_object"; then # Prepend the subdirectory the object is found in. pic_object=$xdir$pic_object if test dlfiles = "$prev"; then if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test dlprefiles = "$prev"; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg=$pic_object fi # Non-PIC object. if test none != "$non_pic_object"; then # Prepend the subdirectory the object is found in. non_pic_object=$xdir$non_pic_object # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test none = "$pic_object"; then arg=$non_pic_object fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object=$pic_object func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "'$arg' is not a valid libtool object" fi fi done else func_fatal_error "link input file '$arg' does not exist" fi arg=$save_arg prev= continue ;; os2dllname) os2dllname=$arg prev= continue ;; precious_regex) precious_files_regex=$arg prev= continue ;; release) release=-$arg prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test rpath = "$prev"; then case "$rpath " in *" $arg "*) ;; *) func_append rpath " $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) func_append xrpath " $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds=$arg prev= continue ;; weak) func_append weak_libs " $arg" prev= continue ;; xassembler) func_append compiler_flags " -Xassembler $qarg" prev= func_append compile_command " -Xassembler $qarg" func_append finalize_command " -Xassembler $qarg" continue ;; xcclinker) func_append linker_flags " $qarg" func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xcompiler) func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xlinker) func_append linker_flags " $qarg" func_append compiler_flags " $wl$qarg" prev= func_append compile_command " $wl$qarg" func_append finalize_command " $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg=$arg case $arg in -all-static) if test -n "$link_static_flag"; then # See comment for -static flag below, for more details. func_append compile_command " $link_static_flag" func_append finalize_command " $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "'-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -bindir) prev=bindir continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test X-export-symbols = "X$arg"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) func_append compile_command " $arg" func_append finalize_command " $arg" ;; esac continue ;; -L*) func_stripname "-L" '' "$arg" if test -z "$func_stripname_result"; then if test "$#" -gt 0; then func_fatal_error "require no space between '-L' and '$1'" else func_fatal_error "need path for '-L' option" fi fi func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of '$dir'" dir=$absdir ;; esac case "$deplibs " in *" -L$dir "* | *" $arg "*) # Will only happen for absolute or sysroot arguments ;; *) # Preserve sysroot, but never include relative directories case $dir in [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; *) func_append deplibs " -L$dir" ;; esac func_append lib_search_path " $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; ::) dllsearchpath=$dir;; *) func_append dllsearchpath ":$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac continue ;; -l*) if test X-lc = "X$arg" || test X-lm = "X$arg"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test X-lc = "X$arg" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig* | *-*-midnightbsd*) # Do not include libc due to us having libc/libc_r. test X-lc = "X$arg" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework func_append deplibs " System.ltframework" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test X-lc = "X$arg" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test X-lc = "X$arg" && continue ;; esac elif test X-lc_r = "X$arg"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig* | *-*-midnightbsd*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi func_append deplibs " $arg" continue ;; -mllvm) prev=mllvm continue ;; -module) module=yes continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. # Darwin uses the -arch flag to determine output architecture. -model|-arch|-isysroot|--sysroot) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" prev=xcompiler continue ;; # Solaris ld rejects as of 11.4. Refer to Oracle bug 22985199. -pthread) case $host in *solaris2*) ;; *) case "$new_inherited_linker_flags " in *" $arg "*) ;; * ) func_append new_inherited_linker_flags " $arg" ;; esac ;; esac continue ;; -mt|-mthreads|-kthread|-Kthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case "$new_inherited_linker_flags " in *" $arg "*) ;; * ) func_append new_inherited_linker_flags " $arg" ;; esac # As we are forced to pass -nostdlib to g++ during linking, the option # -pthread{,s} is not in effect; add the -lpthread to $deplist # explicitly to link correctly. if test "$tagname" = CXX -a x"$with_gcc" = xyes; then case "$arg" in -pthread*) func_append deplibs " -lpthread" ;; esac fi continue ;; -multi_module) single_module=$wl-multi_module continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) # The PATH hackery in wrapper scripts is required on Windows # and Darwin in order for the loader to find any dlls it needs. func_warning "'-no-install' is ignored for $host" func_warning "assuming '-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -os2dllname) prev=os2dllname continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) func_stripname '-R' '' "$arg" dir=$func_stripname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; =*) func_stripname '=' '' "$dir" dir=$lt_sysroot$func_stripname_result ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static | -static-libtool-libs) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result arg= save_ifs=$IFS; IFS=, for flag in $args; do IFS=$save_ifs func_quote_arg pretty "$flag" func_append arg " $func_quote_arg_result" func_append compiler_flags " $func_quote_arg_result" done IFS=$save_ifs func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Wl,*) func_stripname '-Wl,' '' "$arg" args=$func_stripname_result arg= save_ifs=$IFS; IFS=, for flag in $args; do IFS=$save_ifs func_quote_arg pretty "$flag" func_append arg " $wl$func_quote_arg_result" func_append compiler_flags " $wl$func_quote_arg_result" func_append linker_flags " $func_quote_arg_result" done IFS=$save_ifs func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Xassembler) prev=xassembler continue ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # -msg_* for osf cc -msg_*) func_quote_arg pretty "$arg" arg=$func_quote_arg_result ;; # Flags to be passed through unchanged, with rationale: # -64, -mips[0-9] enable 64-bit mode for the SGI compiler # -r[0-9][0-9]* specify processor for the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler # +DA*, +DD* enable 64-bit mode for the HP compiler # -q* compiler args for the IBM compiler # -m*, -t[45]*, -txscale* architecture-specific flags for GCC # -F/path path to uninstalled frameworks, gcc on darwin # -p, -pg, --coverage, -fprofile-* profiling flags for GCC # -fstack-protector* stack protector flags for GCC # @file GCC response files # -tp=* Portland pgcc target processor selection # --sysroot=* for sysroot support # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization # -specs=* GCC specs files # -stdlib=* select c++ std lib with clang # -fsanitize=* Clang/GCC memory and address sanitizer # -fuse-ld=* Linker select flags for GCC # -Wa,* Pass flags directly to the assembler # -Werror, -Werror=* Report (specified) warnings as errors -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \ -specs=*|-fsanitize=*|-fuse-ld=*|-Wa,*|-Werror|-Werror=*) func_quote_arg pretty "$arg" arg=$func_quote_arg_result func_append compile_command " $arg" func_append finalize_command " $arg" func_append compiler_flags " $arg" continue ;; -Z*) if test os2 = "`expr $host : '.*\(os2\)'`"; then # OS/2 uses -Zxxx to specify OS/2-specific options compiler_flags="$compiler_flags $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case $arg in -Zlinker | -Zstack) prev=xcompiler ;; esac continue else # Otherwise treat like 'Some other compiler flag' below func_quote_arg pretty "$arg" arg=$func_quote_arg_result fi ;; # Some other compiler flag. -* | +*) func_quote_arg pretty "$arg" arg=$func_quote_arg_result ;; *.$objext) # A standard object. func_append objs " $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test none = "$pic_object" && test none = "$non_pic_object"; then func_fatal_error "cannot find name of object for '$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result test none = "$pic_object" || { # Prepend the subdirectory the object is found in. pic_object=$xdir$pic_object if test dlfiles = "$prev"; then if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test dlprefiles = "$prev"; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg=$pic_object } # Non-PIC object. if test none != "$non_pic_object"; then # Prepend the subdirectory the object is found in. non_pic_object=$xdir$non_pic_object # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test none = "$pic_object"; then arg=$non_pic_object fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object=$pic_object func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "'$arg' is not a valid libtool object" fi fi ;; *.$libext) # An archive. func_append deplibs " $arg" func_append old_deplibs " $arg" continue ;; *.la) # A libtool-controlled library. func_resolve_sysroot "$arg" if test dlfiles = "$prev"; then # This library was specified with -dlopen. func_append dlfiles " $func_resolve_sysroot_result" prev= elif test dlprefiles = "$prev"; then # The library was specified with -dlpreopen. func_append dlprefiles " $func_resolve_sysroot_result" prev= else func_append deplibs " $func_resolve_sysroot_result" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. func_quote_arg pretty "$arg" arg=$func_quote_arg_result ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then func_append compile_command " $arg" func_append finalize_command " $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the '$prevarg' option requires an argument" if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" func_append compile_command " $arg" func_append finalize_command " $arg" fi oldlibs= # calculate the name of the file, without its directory func_basename "$output" outputname=$func_basename_result libobjs_save=$libobjs if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" # Definition is injected by LT_CONFIG during libtool generation. func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH" func_dirname "$output" "/" "" output_objdir=$func_dirname_result$objdir func_to_tool_file "$output_objdir/" tool_output_objdir=$func_to_tool_file_result # Create the object directory. func_mkdir_p "$output_objdir" # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if $opt_preserve_dup_deps; then case "$libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append libs " $deplib" done if test lib = "$linkmode"; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; esac func_append pre_post_deps " $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can '-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=false newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do # The preopen pass in lib mode reverses $deplibs; put it back here # so that -L comes before libs that need it for instance... if test lib,link = "$linkmode,$pass"; then ## FIXME: Find the place where the list is rebuilt in the wrong ## order, and fix it there properly tmp_deplibs= for deplib in $deplibs; do tmp_deplibs="$deplib $tmp_deplibs" done deplibs=$tmp_deplibs fi if test lib,link = "$linkmode,$pass" || test prog,scan = "$linkmode,$pass"; then libs=$deplibs deplibs= fi if test prog = "$linkmode"; then case $pass in dlopen) libs=$dlfiles ;; dlpreopen) libs=$dlprefiles ;; link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi if test lib,dlpreopen = "$linkmode,$pass"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= func_resolve_sysroot "$lib" case $lib in *.la) func_source "$func_resolve_sysroot_result" ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do func_basename "$deplib" deplib_base=$func_basename_result case " $weak_libs " in *" $deplib_base "*) ;; *) func_append deplibs " $deplib" ;; esac done done libs=$dlprefiles fi if test dlopen = "$pass"; then # Collect dlpreopened libraries save_deplibs=$deplibs deplibs= fi for deplib in $libs; do lib= found=false case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append compiler_flags " $deplib" if test lib = "$linkmode"; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -l*) if test lib != "$linkmode" && test prog != "$linkmode"; then func_warning "'-l' is ignored for archives/objects" continue fi func_stripname '-l' '' "$deplib" name=$func_stripname_result if test lib = "$linkmode"; then searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" else searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" fi for searchdir in $searchdirs; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib=$searchdir/lib$name$search_ext if test -f "$lib"; then if test .la = "$search_ext"; then found=: else found=false fi break 2 fi done done if $found; then # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test yes = "$allow_libtool_libs_with_static_runtimes"; then case " $predeps $postdeps " in *" $deplib "*) if func_lalib_p "$lib"; then library_names= old_library= func_source "$lib" for l in $old_library $library_names; do ll=$l done if test "X$ll" = "X$old_library"; then # only static version available found=false func_dirname "$lib" "" "." ladir=$func_dirname_result lib=$ladir/$old_library if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi else # deplib doesn't seem to be a libtool library if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" fi continue fi ;; # -l *.ltframework) if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test lib = "$linkmode"; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test conv = "$pass" && continue newdependency_libs="$deplib $newdependency_libs" func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; prog) if test conv = "$pass"; then deplibs="$deplib $deplibs" continue fi if test scan = "$pass"; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; *) func_warning "'-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test link = "$pass"; then func_stripname '-R' '' "$deplib" func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) func_resolve_sysroot "$deplib" lib=$func_resolve_sysroot_result ;; *.$libext) if test conv = "$pass"; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $deplib "*) ;; *) valid_a_lib=false case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=: fi ;; pass_all) valid_a_lib=: ;; esac if $valid_a_lib; then echo $ECHO "*** Warning: Linking the shared library $output against the" $ECHO "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" else echo $ECHO "*** Warning: Trying to link with static lib archive $deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because the file extensions .$libext of this argument makes me believe" echo "*** that it is just a static archive that I should not use here." fi ;; esac continue ;; prog) if test link != "$pass"; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test conv = "$pass"; then deplibs="$deplib $deplibs" elif test prog = "$linkmode"; then if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then # If there is no dlopen support or we're linking statically, # we need to preload. func_append newdlprefiles " $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append newdlfiles " $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=: continue ;; esac # case $deplib $found || test -f "$lib" \ || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'" # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$lib" \ || func_fatal_error "'$lib' is not a valid libtool archive" func_dirname "$lib" "" "." ladir=$func_dirname_result dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file func_source "$lib" # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do case " $new_inherited_linker_flags " in *" $tmp_inherited_linker_flag "*) ;; *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; esac done fi dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` if test lib,link = "$linkmode,$pass" || test prog,scan = "$linkmode,$pass" || { test prog != "$linkmode" && test lib != "$linkmode"; }; then test -n "$dlopen" && func_append dlfiles " $dlopen" test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" fi if test conv = "$pass"; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for '$lib'" fi # It is a libtool convenience library, so add in its objects. func_append convenience " $ladir/$objdir/$old_library" func_append old_convenience " $ladir/$objdir/$old_library" elif test prog != "$linkmode" && test lib != "$linkmode"; then func_fatal_error "'$lib' is not a convenience library" fi tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done continue fi # $pass = conv # Get the name of the library we link against. linklib= if test -n "$old_library" && { test yes = "$prefer_static_libs" || test built,no = "$prefer_static_libs,$installed"; }; then linklib=$old_library else for l in $old_library $library_names; do linklib=$l done fi if test -z "$linklib"; then func_fatal_error "cannot find name of link library for '$lib'" fi # This library was specified with -dlopen. if test dlopen = "$pass"; then test -z "$libdir" \ && func_fatal_error "cannot -dlopen a convenience library: '$lib'" if test -z "$dlname" || test yes != "$dlopen_support" || test no = "$build_libtool_libs" then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. func_append dlprefiles " $lib $dependency_libs" else func_append newdlfiles " $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then func_warning "cannot determine absolute directory name of '$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir=$ladir fi ;; esac func_basename "$lib" laname=$func_basename_result # Find the relevant object directory and library name. if test yes = "$installed"; then if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library '$lib' was moved." dir=$ladir absdir=$abs_ladir libdir=$abs_ladir else dir=$lt_sysroot$libdir absdir=$lt_sysroot$libdir fi test yes = "$hardcode_automatic" && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir=$ladir absdir=$abs_ladir # Remove this search path later func_append notinst_path " $abs_ladir" else dir=$ladir/$objdir absdir=$abs_ladir/$objdir # Remove this search path later func_append notinst_path " $abs_ladir" fi fi # $installed = yes func_stripname 'lib' '.la' "$laname" name=$func_stripname_result # This library was specified with -dlpreopen. if test dlpreopen = "$pass"; then if test -z "$libdir" && test prog = "$linkmode"; then func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'" fi case $host in # special handling for platforms with PE-DLLs. *cygwin* | *mingw* | *cegcc* ) # Linker will automatically link against shared library if both # static and shared are present. Therefore, ensure we extract # symbols from the import library if a shared library is present # (otherwise, the dlopen module name will be incorrect). We do # this by putting the import library name into $newdlprefiles. # We recover the dlopen module name by 'saving' the la file # name in a special purpose variable, and (later) extracting the # dlname from the la file. if test -n "$dlname"; then func_tr_sh "$dir/$linklib" eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" func_append newdlprefiles " $dir/$linklib" else func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" fi ;; * ) # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then func_append newdlprefiles " $dir/$dlname" else func_append newdlprefiles " $dir/$linklib" fi ;; esac fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test lib = "$linkmode"; then deplibs="$dir/$old_library $deplibs" elif test prog,link = "$linkmode,$pass"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test prog = "$linkmode" && test link != "$pass"; then func_append newlib_search_path " $ladir" deplibs="$lib $deplibs" linkalldeplibs=false if test no != "$link_all_deplibs" || test -z "$library_names" || test no = "$build_libtool_libs"; then linkalldeplibs=: fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; esac # Need to link against all dependency_libs? if $linkalldeplibs; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done # for deplib continue fi # $linkmode = prog... if test prog,link = "$linkmode,$pass"; then if test -n "$library_names" && { { test no = "$prefer_static_libs" || test built,yes = "$prefer_static_libs,$installed"; } || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then # Make sure the rpath contains only unique directories. case $temp_rpath: in *"$absdir:"*) ;; *) func_append temp_rpath "$absdir:" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi # $linkmode,$pass = prog,link... if $alldeplibs && { test pass_all = "$deplibs_check_method" || { test yes = "$build_libtool_libs" && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test built = "$use_static_libs" && test yes = "$installed"; then use_static_libs=no fi if test -n "$library_names" && { test no = "$use_static_libs" || test -z "$old_library"; }; then case $host in *cygwin* | *mingw* | *cegcc* | *os2*) # No point in relinking DLLs because paths are not encoded func_append notinst_deplibs " $lib" need_relink=no ;; *) if test no = "$installed"; then func_append notinst_deplibs " $lib" need_relink=yes fi ;; esac # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule= for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule=$dlpremoduletest break fi done if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then echo if test prog = "$linkmode"; then $ECHO "*** Warning: Linking the executable $output against the loadable module" else $ECHO "*** Warning: Linking the shared library $output against the loadable module" fi $ECHO "*** $linklib is not portable!" fi if test lib = "$linkmode" && test yes = "$hardcode_into_libs"; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names shift realname=$1 shift libname=`eval "\\$ECHO \"$libname_spec\""` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname=$dlname elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw* | *cegcc* | *os2*) func_arith $current - $age major=$func_arith_result versuffix=-$major ;; esac eval soname=\"$soname_spec\" else soname=$realname fi # Make a new name for the extract_expsyms_cmds to use soroot=$soname func_basename "$soroot" soname=$func_basename_result func_stripname 'lib' '.dll' "$soname" newlib=libimp-$func_stripname_result.a # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else func_verbose "extracting exported symbol list from '$soname'" func_execute_cmds "$extract_expsyms_cmds" 'exit $?' fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else func_verbose "generating import library for '$soname'" func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test prog = "$linkmode" || test relink != "$opt_mode"; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test no = "$hardcode_direct"; then add=$dir/$linklib case $host in *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;; *-*-sysv4*uw2*) add_dir=-L$dir ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir=-L$dir ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we cannot # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP ": [^:]* bundle" >/dev/null; then if test "X$dlopenmodule" != "X$lib"; then $ECHO "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library"; then echo echo "*** And there doesn't seem to be a static archive available" echo "*** The link will probably fail, sorry" else add=$dir/$old_library fi elif test -n "$old_library"; then add=$dir/$old_library fi fi esac elif test no = "$hardcode_minus_L"; then case $host in *-*-sunos*) add_shlibpath=$dir ;; esac add_dir=-L$dir add=-l$name elif test no = "$hardcode_shlibpath_var"; then add_shlibpath=$dir add=-l$name else lib_linked=no fi ;; relink) if test yes = "$hardcode_direct" && test no = "$hardcode_direct_absolute"; then add=$dir/$linklib elif test yes = "$hardcode_minus_L"; then add_dir=-L$absdir # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add=-l$name elif test yes = "$hardcode_shlibpath_var"; then add_shlibpath=$dir add=-l$name else lib_linked=no fi ;; *) lib_linked=no ;; esac if test yes != "$lib_linked"; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) func_append compile_shlibpath "$add_shlibpath:" ;; esac fi if test prog = "$linkmode"; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test yes != "$hardcode_direct" && test yes != "$hardcode_minus_L" && test yes = "$hardcode_shlibpath_var"; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac fi fi fi if test prog = "$linkmode" || test relink = "$opt_mode"; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test yes = "$hardcode_direct" && test no = "$hardcode_direct_absolute"; then add=$libdir/$linklib elif test yes = "$hardcode_minus_L"; then add_dir=-L$libdir add=-l$name elif test yes = "$hardcode_shlibpath_var"; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac add=-l$name elif test yes = "$hardcode_automatic"; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib"; then add=$inst_prefix_dir$libdir/$linklib else add=$libdir/$linklib fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir=-L$libdir # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add=-l$name fi if test prog = "$linkmode"; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test prog = "$linkmode"; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test unsupported != "$hardcode_direct"; then test -n "$old_library" && linklib=$old_library compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test yes = "$build_libtool_libs"; then # Not a shared library if test pass_all != "$deplibs_check_method"; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. echo $ECHO "*** Warning: This system cannot link to static lib archive $lib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." if test yes = "$module"; then echo "*** But as you try to build a module library, libtool will still create " echo "*** a static module, that should work as long as the dlopening application" echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using 'nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** 'nm' from GNU binutils and a full rebuild may help." fi if test no = "$build_old_libs"; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test lib = "$linkmode"; then if test -n "$dependency_libs" && { test yes != "$hardcode_into_libs" || test yes = "$build_old_libs" || test yes = "$link_static"; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) func_stripname '-R' '' "$libdir" temp_xrpath=$func_stripname_result case " $xrpath " in *" $temp_xrpath "*) ;; *) func_append xrpath " $temp_xrpath";; esac;; *) func_append temp_deplibs " $libdir";; esac done dependency_libs=$temp_deplibs fi func_append newlib_search_path " $absdir" # Link against this library test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result";; *) func_resolve_sysroot "$deplib" ;; esac if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $func_resolve_sysroot_result "*) func_append specialdeplibs " $func_resolve_sysroot_result" ;; esac fi func_append tmp_libs " $func_resolve_sysroot_result" done if test no != "$link_all_deplibs"; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do path= case $deplib in -L*) path=$deplib ;; *.la) func_resolve_sysroot "$deplib" deplib=$func_resolve_sysroot_result func_dirname "$deplib" "" "." dir=$func_dirname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of '$dir'" absdir=$dir fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names"; then for tmp in $deplibrary_names; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl"; then depdepl=$absdir/$objdir/$depdepl darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` if test -z "$darwin_install_name"; then darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` fi func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl" func_append linker_flags " -dylib_file $darwin_install_name:$depdepl" path= fi fi ;; *) path=-L$absdir/$objdir ;; esac else eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "'$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "'$deplib' seems to be moved" path=-L$absdir fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs if test link = "$pass"; then if test prog = "$linkmode"; then compile_deplibs="$new_inherited_linker_flags $compile_deplibs" finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" else compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` fi fi dependency_libs=$newdependency_libs if test dlpreopen = "$pass"; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test dlopen != "$pass"; then test conv = "$pass" || { # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) func_append lib_search_path " $dir" ;; esac done newlib_search_path= } if test prog,link = "$linkmode,$pass"; then vars="compile_deplibs finalize_deplibs" else vars=deplibs fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) func_append tmp_libs " $deplib" ;; esac ;; *) func_append tmp_libs " $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Add Sun CC postdeps if required: test CXX = "$tagname" && { case $host_os in linux*) case `$CC -V 2>&1 | $SED 5q` in *Sun\ C*) # Sun C++ 5.9 func_suncc_cstd_abi if test no != "$suncc_use_cstd_abi"; then func_append postdeps ' -library=Cstd -library=Crun' fi ;; esac ;; solaris*) func_cc_basename "$CC" case $func_cc_basename_result in CC* | sunCC*) func_suncc_cstd_abi if test no != "$suncc_use_cstd_abi"; then func_append postdeps ' -library=Cstd -library=Crun' fi ;; esac ;; esac } # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i= ;; esac if test -n "$i"; then func_append tmp_libs " $i" fi done dependency_libs=$tmp_libs done # for pass if test prog = "$linkmode"; then dlfiles=$newdlfiles fi if test prog = "$linkmode" || test lib = "$linkmode"; then dlprefiles=$newdlprefiles fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then func_warning "'-dlopen' is ignored for archives" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "'-l' and '-L' are ignored for archives" ;; esac test -n "$rpath" && \ func_warning "'-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "'-R' is ignored for archives" test -n "$vinfo" && \ func_warning "'-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "'-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "'-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs=$output func_append objs "$old_deplibs" ;; lib) # Make sure we only generate libraries of the form 'libNAME.la'. case $outputname in lib*) func_stripname 'lib' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test no = "$module" \ && func_fatal_help "libtool library '$output' must begin with 'lib'" if test no != "$need_lib_prefix"; then # Add the "lib" prefix for modules if required func_stripname '' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else func_stripname '' '.la' "$outputname" libname=$func_stripname_result fi ;; esac if test -n "$objs"; then if test pass_all != "$deplibs_check_method"; then func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs" else echo $ECHO "*** Warning: Linking the shared library $output against the non-libtool" $ECHO "*** objects $objs is not portable!" func_append libobjs " $objs" fi fi test no = "$dlself" \ || func_warning "'-dlopen self' is ignored for libtool libraries" set dummy $rpath shift test 1 -lt "$#" \ && func_warning "ignoring multiple '-rpath's for a libtool library" install_libdir=$1 oldlibs= if test -z "$rpath"; then if test yes = "$build_libtool_libs"; then # Building a libtool convenience library. # Some compilers have problems with a '.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "'-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "'-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs=$IFS; IFS=: set dummy $vinfo 0 0 0 shift IFS=$save_ifs test -n "$7" && \ func_fatal_help "too many parameters to '-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major=$1 number_minor=$2 number_revision=$3 # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # that has an extra 1 added just for fun # case $version_type in # correct linux to gnu/linux during the next big refactor darwin|freebsd-elf|linux|midnightbsd-elf|osf|windows|none) func_arith $number_major + $number_minor current=$func_arith_result age=$number_minor revision=$number_revision ;; freebsd-aout|qnx|sunos) current=$number_major revision=$number_minor age=0 ;; irix|nonstopux) func_arith $number_major + $number_minor current=$func_arith_result age=$number_minor revision=$number_minor lt_irix_increment=no ;; esac ;; no) current=$1 revision=$2 age=$3 ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "CURRENT '$current' must be a nonnegative integer" func_fatal_error "'$vinfo' is not valid version information" ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "REVISION '$revision' must be a nonnegative integer" func_fatal_error "'$vinfo' is not valid version information" ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "AGE '$age' must be a nonnegative integer" func_fatal_error "'$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE '$age' is greater than the current interface number '$current'" func_fatal_error "'$vinfo' is not valid version information" fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision # Darwin ld doesn't like 0 for these options... func_arith $current + 1 minor_current=$func_arith_result xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" # On Darwin other compilers case $CC in nagfor*) verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" ;; *) verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; esac ;; freebsd-aout) major=.$current versuffix=.$current.$revision ;; freebsd-elf | midnightbsd-elf) func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision ;; irix | nonstopux) if test no = "$lt_irix_increment"; then func_arith $current - $age else func_arith $current - $age + 1 fi major=$func_arith_result case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring=$verstring_prefix$major.$revision # Add in all the interfaces that we are compatible with. loop=$revision while test 0 -ne "$loop"; do func_arith $revision - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring=$verstring_prefix$major.$iface:$verstring done # Before this point, $major must not contain '.'. major=.$major versuffix=$major.$revision ;; linux) # correct to gnu/linux during the next big refactor func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision ;; osf) func_arith $current - $age major=.$func_arith_result versuffix=.$current.$age.$revision verstring=$current.$age.$revision # Add in all the interfaces that we are compatible with. loop=$age while test 0 -ne "$loop"; do func_arith $current - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring=$verstring:$iface.0 done # Make executables depend on our current version. func_append verstring ":$current.0" ;; qnx) major=.$current versuffix=.$current ;; sco) major=.$current versuffix=.$current ;; sunos) major=.$current versuffix=.$current.$revision ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 file systems. func_arith $current - $age major=$func_arith_result versuffix=-$major ;; *) func_fatal_configuration "unknown library version type '$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring=0.0 ;; esac if test no = "$need_version"; then versuffix= else versuffix=.0.0 fi fi # Remove version info from name if versioning should be avoided if test yes,no = "$avoid_version,$need_version"; then major= versuffix= verstring= fi # Check to see if the archive will have undefined symbols. if test yes = "$allow_undefined"; then if test unsupported = "$allow_undefined_flag"; then if test yes = "$build_old_libs"; then func_warning "undefined symbols not allowed in $host shared libraries; building static only" build_libtool_libs=no else func_fatal_error "can't build $host shared library unless -no-undefined is specified" fi fi else # Don't allow undefined symbols. allow_undefined_flag=$no_undefined_flag fi fi func_generate_dlsyms "$libname" "$libname" : func_append libobjs " $symfileobj" test " " = "$libobjs" && libobjs= if test relink != "$opt_mode"; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$ECHO "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext | *.gcno) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*) if test -n "$precious_files_regex"; then if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi func_append removelist " $p" ;; *) ;; esac done test -n "$removelist" && \ func_show_eval "${RM}r \$removelist" fi # Now set the variables for building old libraries. if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then func_append oldlibs " $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP` fi # Eliminate all temporary directories. #for path in $notinst_path; do # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` #done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do func_replace_sysroot "$libdir" func_append temp_xrpath " -R$func_replace_sysroot_result" case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles=$dlfiles dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) func_append dlfiles " $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles=$dlprefiles dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) func_append dlprefiles " $lib" ;; esac done if test yes = "$build_libtool_libs"; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework func_append deplibs " System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-midnightbsd*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test yes = "$build_libtool_need_lc"; then func_append deplibs " -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release= versuffix= major= newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $opt_dry_run || $RM conftest.c cat > conftest.c </dev/null` $nocaseglob else potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` fi for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib=$potent_lib while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | $SED 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;; *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | $SED -e 10q | $EGREP "$file_magic_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib= break 2 fi done done fi if test -n "$a_deplib"; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib"; then $ECHO "*** with $libname but no candidates were found. (...for file magic test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a file magic. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` for a_deplib in $deplibs; do case $a_deplib in -l*) func_stripname -l '' "$a_deplib" name=$func_stripname_result if test yes = "$allow_libtool_libs_with_static_runtimes"; then case " $predeps $postdeps " in *" $a_deplib "*) func_append newdeplibs " $a_deplib" a_deplib= ;; esac fi if test -n "$a_deplib"; then libname=`eval "\\$ECHO \"$libname_spec\""` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib=$potent_lib # see symlink-check above in file_magic test if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ $EGREP "$match_pattern_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib= break 2 fi done done fi if test -n "$a_deplib"; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib"; then $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a regex pattern. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; none | unknown | *) newdeplibs= tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` if test yes = "$allow_libtool_libs_with_static_runtimes"; then for i in $predeps $postdeps; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"` done fi case $tmp_deplibs in *[!\ \ ]*) echo if test none = "$deplibs_check_method"; then echo "*** Warning: inter-library dependencies are not supported in this platform." else echo "*** Warning: inter-library dependencies are not known to be supported." fi echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes ;; esac ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac if test yes = "$droppeddeps"; then if test yes = "$module"; then echo echo "*** Warning: libtool could not satisfy all declared inter-library" $ECHO "*** dependencies of module $libname. Therefore, libtool will create" echo "*** a static module, that should work as long as the dlopening" echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using 'nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** 'nm' from GNU binutils and a full rebuild may help." fi if test no = "$build_old_libs"; then oldlibs=$output_objdir/$libname.$libext build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else echo "*** The inter-library dependencies that have been dropped here will be" echo "*** automatically added whenever a program is linked with this library" echo "*** or is declared to -dlopen it." if test no = "$allow_undefined"; then echo echo "*** Since this library must not contain undefined symbols," echo "*** because either the platform does not support them or" echo "*** it was explicitly requested with -no-undefined," echo "*** libtool will only create a static version of it." if test no = "$build_old_libs"; then oldlibs=$output_objdir/$libname.$libext build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done deplibs=$new_libs # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test yes = "$build_libtool_libs"; then # Remove $wl instances when linking with ld. # FIXME: should test the right _cmds variable. case $archive_cmds in *\$LD\ *) wl= ;; esac if test yes = "$hardcode_into_libs"; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath=$finalize_rpath test relink = "$opt_mode" || rpath=$compile_rpath$rpath for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then func_replace_sysroot "$libdir" libdir=$func_replace_sysroot_result if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append dep_rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir=$hardcode_libdirs eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath=$finalize_shlibpath test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names shift realname=$1 shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname=$realname fi if test -z "$dlname"; then dlname=$soname fi lib=$output_objdir/$realname linknames= for link do func_append linknames " $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` test "X$libobjs" = "X " && libobjs= delfiles= if test -n "$export_symbols" && test -n "$include_expsyms"; then $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" export_symbols=$output_objdir/$libname.uexp func_append delfiles " $export_symbols" fi orig_export_symbols= case $host_os in cygwin* | mingw* | cegcc*) if test -n "$export_symbols" && test -z "$export_symbols_regex"; then # exporting using user supplied symfile func_dll_def_p "$export_symbols" || { # and it's NOT already a .def file. Must figure out # which of the given symbols are data symbols and tag # them as such. So, trigger use of export_symbols_cmds. # export_symbols gets reassigned inside the "prepare # the list of exported symbols" if statement, so the # include_expsyms logic still works. orig_export_symbols=$export_symbols export_symbols= always_export_symbols=yes } fi ;; esac # Prepare the list of exported symbols if test -z "$export_symbols"; then if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then func_verbose "generating symbol list for '$libname.la'" export_symbols=$output_objdir/$libname.exp $opt_dry_run || $RM $export_symbols cmds=$export_symbols_cmds save_ifs=$IFS; IFS='~' for cmd1 in $cmds; do IFS=$save_ifs # Take the normal branch if the nm_file_list_spec branch # doesn't work or if tool conversion is not needed. case $nm_file_list_spec~$to_tool_file_cmd in *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) try_normal_branch=yes eval cmd=\"$cmd1\" func_len " $cmd" len=$func_len_result ;; *) try_normal_branch=no ;; esac if test yes = "$try_normal_branch" \ && { test "$len" -lt "$max_cmd_len" \ || test "$max_cmd_len" -le -1; } then func_show_eval "$cmd" 'exit $?' skipped_export=false elif test -n "$nm_file_list_spec"; then func_basename "$output" output_la=$func_basename_result save_libobjs=$libobjs save_output=$output output=$output_objdir/$output_la.nm func_to_tool_file "$output" libobjs=$nm_file_list_spec$func_to_tool_file_result func_append delfiles " $output" func_verbose "creating $NM input file list: $output" for obj in $save_libobjs; do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > "$output" eval cmd=\"$cmd1\" func_show_eval "$cmd" 'exit $?' output=$save_output libobjs=$save_libobjs skipped_export=false else # The command line is too long to execute in one step. func_verbose "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS=$save_ifs if test -n "$export_symbols_regex" && test : != "$skipped_export"; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols=$export_symbols test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test : != "$skipped_export" && test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for '$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands, which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) func_append tmp_deplibs " $test_deplib" ;; esac done deplibs=$tmp_deplibs if test -n "$convenience"; then if test -n "$whole_archive_flag_spec" && test yes = "$compiler_needs_object" && test -z "$libobjs"; then # extract the archives, so we have objects to list. # TODO: could optimize this to just extract one archive. whole_archive_flag_spec= fi if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= else gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $convenience func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi fi if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" func_append linker_flags " $flag" fi # Make a backup of the uninstalled library when relinking if test relink = "$opt_mode"; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test yes = "$module" && test -n "$module_cmds"; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test : != "$skipped_export" && func_len " $test_cmds" && len=$func_len_result && test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output func_basename "$output" output_la=$func_basename_result # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= last_robj= k=1 if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then output=$output_objdir/$output_la.lnkscript func_verbose "creating GNU ld script: $output" echo 'INPUT (' > $output for obj in $save_libobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done echo ')' >> $output func_append delfiles " $output" func_to_tool_file "$output" output=$func_to_tool_file_result elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then output=$output_objdir/$output_la.lnk func_verbose "creating linker input file list: $output" : > $output set x $save_libobjs shift firstobj= if test yes = "$compiler_needs_object"; then firstobj="$1 " shift fi for obj do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done func_append delfiles " $output" func_to_tool_file "$output" output=$firstobj\"$file_list_spec$func_to_tool_file_result\" else if test -n "$save_libobjs"; then func_verbose "creating reloadable object files..." output=$output_objdir/$output_la-$k.$objext eval test_cmds=\"$reload_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 # Loop over the list of objects to be linked. for obj in $save_libobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result if test -z "$objlist" || test "$len" -lt "$max_cmd_len"; then func_append objlist " $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test 1 -eq "$k"; then # The first file doesn't have a previous command to add. reload_objs=$objlist eval concat_cmds=\"$reload_cmds\" else # All subsequent reloadable object files will link in # the last one created. reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" fi last_robj=$output_objdir/$output_la-$k.$objext func_arith $k + 1 k=$func_arith_result output=$output_objdir/$output_la-$k.$objext objlist=" $obj" func_len " $last_robj" func_arith $len0 + $func_len_result len=$func_arith_result fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds$reload_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi func_append delfiles " $output" else output= fi ${skipped_export-false} && { func_verbose "generating symbol list for '$libname.la'" export_symbols=$output_objdir/$libname.exp $opt_dry_run || $RM $export_symbols libobjs=$output # Append the command to create the export file. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi } test -n "$save_libobjs" && func_verbose "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs=$IFS; IFS='~' for cmd in $concat_cmds; do IFS=$save_ifs $opt_quiet || { func_quote_arg expand,pretty "$cmd" eval "func_echo $func_quote_arg_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test relink = "$opt_mode"; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS=$save_ifs if test -n "$export_symbols_regex" && ${skipped_export-false}; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi ${skipped_export-false} && { if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols=$export_symbols test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for '$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands, which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi } libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test yes = "$module" && test -n "$module_cmds"; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi fi if test -n "$delfiles"; then # Append the command to remove temporary files to $cmds. eval cmds=\"\$cmds~\$RM $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi save_ifs=$IFS; IFS='~' for cmd in $cmds; do IFS=$sp$nl eval cmd=\"$cmd\" IFS=$save_ifs $opt_quiet || { func_quote_arg expand,pretty "$cmd" eval "func_echo $func_quote_arg_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test relink = "$opt_mode"; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS=$save_ifs # Restore the uninstalled library and exit if test relink = "$opt_mode"; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then func_show_eval '${RM}r "$gentop"' fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' fi done # If -module or -export-dynamic was specified, set the dlname. if test yes = "$module" || test yes = "$export_dynamic"; then # On all known operating systems, these are identical. dlname=$soname fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then func_warning "'-dlopen' is ignored for objects" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "'-l' and '-L' are ignored for objects" ;; esac test -n "$rpath" && \ func_warning "'-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "'-R' is ignored for objects" test -n "$vinfo" && \ func_warning "'-version-info' is ignored for objects" test -n "$release" && \ func_warning "'-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object '$output' from non-libtool objects" libobj=$output func_lo2o "$libobj" obj=$func_lo2o_result ;; *) libobj= obj=$output ;; esac # Delete the old objects. $opt_dry_run || $RM $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # if reload_cmds runs $LD directly, get rid of -Wl from # whole_archive_flag_spec and hope we can get by with turning comma # into space. case $reload_cmds in *\$LD[\ \$]*) wl= ;; esac if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags else gentop=$output_objdir/${obj}x func_append generated " $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # If we're not building shared, we need to use non_pic_objs test yes = "$build_libtool_libs" || libobjs=$non_pic_objects # Create the old-style object. reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs output=$obj func_execute_cmds "$reload_cmds" 'exit $?' # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS fi test yes = "$build_libtool_libs" || { if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS } if test -n "$pic_flag" || test default != "$pic_mode"; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output=$libobj func_execute_cmds "$reload_cmds" 'exit $?' fi if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) func_stripname '' '.exe' "$output" output=$func_stripname_result.exe;; esac test -n "$vinfo" && \ func_warning "'-version-info' is ignored for programs" test -n "$release" && \ func_warning "'-release' is ignored for programs" $preload \ && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \ && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors # But is supposedly fixed on 10.4 or later (yay!). if test CXX = "$tagname"; then case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 10.[0123]) func_append compile_command " $wl-bind_at_load" func_append finalize_command " $wl-bind_at_load" ;; esac fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done compile_deplibs=$new_libs func_append compile_command " $compile_deplibs" func_append finalize_command " $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; ::) dllsearchpath=$libdir;; *) func_append dllsearchpath ":$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir=$hardcode_libdirs eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath=$rpath rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) func_append finalize_perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir=$hardcode_libdirs eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath=$rpath if test -n "$libobjs" && test yes = "$build_old_libs"; then # Transform all the library objects into standard objects. compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" false # template prelinking step if test -n "$prelink_cmds"; then func_execute_cmds "$prelink_cmds" 'exit $?' fi wrappers_required=: case $host in *cegcc* | *mingw32ce*) # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. wrappers_required=false ;; *cygwin* | *mingw* ) test yes = "$build_libtool_libs" || wrappers_required=false ;; *) if test no = "$need_relink" || test yes != "$build_libtool_libs"; then wrappers_required=false fi ;; esac $wrappers_required || { # Replace the output file specification. compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` link_command=$compile_command$compile_rpath # We have no uninstalled library dependencies, so finalize right now. exit_status=0 func_show_eval "$link_command" 'exit_status=$?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Delete the generated files. if test -f "$output_objdir/${outputname}S.$objext"; then func_show_eval '$RM "$output_objdir/${outputname}S.$objext"' fi exit $exit_status } if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do func_append rpath "$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test yes = "$no_install"; then # We don't need to create a wrapper script. link_command=$compile_var$compile_command$compile_rpath # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $opt_dry_run || $RM $output # Link the executable and exit func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi exit $EXIT_SUCCESS fi case $hardcode_action,$fast_install in relink,*) # Fast installation is not supported link_command=$compile_var$compile_command$compile_rpath relink_command=$finalize_var$finalize_command$finalize_rpath func_warning "this platform does not like uninstalled shared libraries" func_warning "'$output' will be relinked during installation" ;; *,yes) link_command=$finalize_var$compile_command$finalize_rpath relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` ;; *,no) link_command=$compile_var$compile_command$compile_rpath relink_command=$finalize_var$finalize_command$finalize_rpath ;; *,needless) link_command=$finalize_var$compile_command$finalize_rpath relink_command= ;; esac # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output_objdir/$outputname" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Now create the wrapper script. func_verbose "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_arg pretty "$var_value" relink_command="$var=$func_quote_arg_result; export $var; $relink_command" fi done func_quote eval cd "`pwd`" func_quote_arg pretty,unquoted "($func_quote_result; $relink_command)" relink_command=$func_quote_arg_unquoted_result fi # Only actually do things if not in dry run mode. $opt_dry_run || { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) func_stripname '' '.exe' "$output" output=$func_stripname_result ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe func_stripname '' '.exe' "$outputname" outputname=$func_stripname_result ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) func_dirname_and_basename "$output" "" "." output_name=$func_basename_result output_path=$func_dirname_result cwrappersource=$output_path/$objdir/lt-$output_name.c cwrapper=$output_path/$output_name.exe $RM $cwrappersource $cwrapper trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 func_emit_cwrapperexe_src > $cwrappersource # The wrapper executable is built using the $host compiler, # because it contains $host paths and files. If cross- # compiling, it, like the target executable, must be # executed on the $host or under an emulation environment. $opt_dry_run || { $LTCC $LTCFLAGS -o $cwrapper $cwrappersource $STRIP $cwrapper } # Now, create the wrapper script for func_source use: func_ltwrapper_scriptname $cwrapper $RM $func_ltwrapper_scriptname_result trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 $opt_dry_run || { # note: this script will not be executed, so do not chmod. if test "x$build" = "x$host"; then $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result else func_emit_wrapper no > $func_ltwrapper_scriptname_result fi } ;; * ) $RM $output trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 func_emit_wrapper no > $output chmod +x $output ;; esac } exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do case $build_libtool_libs in convenience) oldobjs="$libobjs_save $symfileobj" addlibs=$convenience build_libtool_libs=no ;; module) oldobjs=$libobjs_save addlibs=$old_convenience build_libtool_libs=no ;; *) oldobjs="$old_deplibs $non_pic_objects" $preload && test -f "$symfileobj" \ && func_append oldobjs " $symfileobj" addlibs=$old_convenience ;; esac if test -n "$addlibs"; then gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $addlibs func_append oldobjs " $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append oldobjs " $func_extract_archives_result" fi # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do func_basename "$obj" $ECHO "$func_basename_result" done | sort | sort -uc >/dev/null 2>&1); then : else echo "copying selected object files to avoid basename conflicts..." gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_mkdir_p "$gentop" save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do func_basename "$obj" objbase=$func_basename_result case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase func_arith $counter + 1 counter=$func_arith_result case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" func_append oldobjs " $gentop/$newobj" ;; *) func_append oldobjs " $obj" ;; esac done fi func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result eval cmds=\"$old_archive_cmds\" func_len " $cmds" len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds elif test -n "$archiver_list_spec"; then func_verbose "using command file archive linking..." for obj in $oldobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > $output_objdir/$libname.libcmd func_to_tool_file "$output_objdir/$libname.libcmd" oldobjs=" $archiver_list_spec$func_to_tool_file_result" cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts func_verbose "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs oldobjs= # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done eval test_cmds=\"$old_archive_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 for obj in $save_oldobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result func_append objlist " $obj" if test "$len" -lt "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj"; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$old_archive_cmds\" objlist= len=$len0 fi done RANLIB=$save_RANLIB oldobjs=$objlist if test -z "$oldobjs"; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi func_execute_cmds "$cmds" 'exit $?' done test -n "$generated" && \ func_show_eval "${RM}r$generated" # Now create the libtool archive. case $output in *.la) old_library= test yes = "$build_old_libs" && old_library=$libname.$libext func_verbose "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_arg pretty,unquoted "$var_value" relink_command="$var=$func_quote_arg_unquoted_result; export $var; $relink_command" fi done # Quote the link command for shipping. func_quote eval cd "`pwd`" relink_command="($func_quote_result; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" func_quote_arg pretty,unquoted "$relink_command" relink_command=$func_quote_arg_unquoted_result if test yes = "$hardcode_automatic"; then relink_command= fi # Only create the output if not a dry run. $opt_dry_run || { for installed in no yes; do if test yes = "$installed"; then if test -z "$install_libdir"; then break fi output=$output_objdir/${outputname}i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) func_basename "$deplib" name=$func_basename_result func_resolve_sysroot "$deplib" eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` test -z "$libdir" && \ func_fatal_error "'$deplib' is not a valid libtool archive" func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" ;; -L*) func_stripname -L '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -L$func_replace_sysroot_result" ;; -R*) func_stripname -R '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -R$func_replace_sysroot_result" ;; *) func_append newdependency_libs " $deplib" ;; esac done dependency_libs=$newdependency_libs newdlfiles= for lib in $dlfiles; do case $lib in *.la) func_basename "$lib" name=$func_basename_result eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "'$lib' is not a valid libtool archive" func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" ;; *) func_append newdlfiles " $lib" ;; esac done dlfiles=$newdlfiles newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: func_basename "$lib" name=$func_basename_result eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "'$lib' is not a valid libtool archive" func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" ;; esac done dlprefiles=$newdlprefiles else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlfiles " $abs" done dlfiles=$newdlfiles newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlprefiles " $abs" done dlprefiles=$newdlprefiles fi $RM $output # place dlname in correct position for cygwin # In fact, it would be nice if we could use this code for all target # systems that can't hard-code library paths into their executables # and that have no shared library path variable independent of PATH, # but it turns out we can't easily determine that from inspecting # libtool variables, so we have to hard-code the OSs to which it # applies here; at the moment, that means platforms that use the PE # object format with DLL files. See the long comment at the top of # tests/bindir.at for full details. tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) # If a -bindir argument was supplied, place the dll there. if test -n "$bindir"; then func_relative_path "$install_libdir" "$bindir" tdlname=$func_relative_path_result/$dlname else # Otherwise fall back on heuristic. tdlname=../bin/$dlname fi ;; esac $ECHO > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Linker flags that cannot go in dependency_libs. inherited_linker_flags='$new_inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test no,yes = "$installed,$need_relink"; then $ECHO >> $output "\ relink_command=\"$relink_command\"" fi done } # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' ;; esac exit $EXIT_SUCCESS } if test link = "$opt_mode" || test relink = "$opt_mode"; then func_mode_link ${1+"$@"} fi # func_mode_uninstall arg... func_mode_uninstall () { $debug_cmd RM=$nonopt files= rmforce=false exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic=$magic for arg do case $arg in -f) func_append RM " $arg"; rmforce=: ;; -*) func_append RM " $arg" ;; *) func_append files " $arg" ;; esac done test -z "$RM" && \ func_fatal_help "you must specify an RM program" rmdirs= for file in $files; do func_dirname "$file" "" "." dir=$func_dirname_result if test . = "$dir"; then odir=$objdir else odir=$dir/$objdir fi func_basename "$file" name=$func_basename_result test uninstall = "$opt_mode" && odir=$dir # Remember odir for removal later, being careful to avoid duplicates if test clean = "$opt_mode"; then case " $rmdirs " in *" $odir "*) ;; *) func_append rmdirs " $odir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if { test -L "$file"; } >/dev/null 2>&1 || { test -h "$file"; } >/dev/null 2>&1 || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif $rmforce; then continue fi rmfiles=$file case $name in *.la) # Possibly a libtool archive, so verify it. if func_lalib_p "$file"; then func_source $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do func_append rmfiles " $odir/$n" done test -n "$old_library" && func_append rmfiles " $odir/$old_library" case $opt_mode in clean) case " $library_names " in *" $dlname "*) ;; *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; esac test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1' fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1' fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if func_lalib_p "$file"; then # Read the .lo file func_source $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test none != "$pic_object"; then func_append rmfiles " $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test none != "$non_pic_object"; then func_append rmfiles " $dir/$non_pic_object" fi fi ;; *) if test clean = "$opt_mode"; then noexename=$name case $file in *.exe) func_stripname '' '.exe' "$file" file=$func_stripname_result func_stripname '' '.exe' "$name" noexename=$func_stripname_result # $file with .exe has already been added to rmfiles, # add $file without .exe func_append rmfiles " $file" ;; esac # Do a test to see if this is a libtool program. if func_ltwrapper_p "$file"; then if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" relink_command= func_source $func_ltwrapper_scriptname_result func_append rmfiles " $func_ltwrapper_scriptname_result" else relink_command= func_source $dir/$noexename fi # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles func_append rmfiles " $odir/$name $odir/${name}S.$objext" if test yes = "$fast_install" && test -n "$relink_command"; then func_append rmfiles " $odir/lt-$name" fi if test "X$noexename" != "X$name"; then func_append rmfiles " $odir/lt-$noexename.c" fi fi fi ;; esac func_show_eval "$RM $rmfiles" 'exit_status=1' done # Try to remove the $objdir's in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then func_show_eval "rmdir $dir >/dev/null 2>&1" fi done exit $exit_status } if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then func_mode_uninstall ${1+"$@"} fi test -z "$opt_mode" && { help=$generic_help func_fatal_help "you must specify a MODE" } test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode '$opt_mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi exit $exit_status # The TAGs below are defined such that we never get into a situation # where we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: unuran-1.11.0/autoconf/config.guess0000755001357500135600000014142214343322277014206 00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2022 Free Software Foundation, Inc. # shellcheck disable=SC2006,SC2268 # see below for rationale timestamp='2022-09-17' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: # https://git.savannah.gnu.org/cgit/config.git/plain/config.guess # # Please send patches to . # The "shellcheck disable" line above the timestamp inhibits complaints # about features and limitations of the classic Bourne shell that were # superseded or lifted in POSIX. However, this script identifies a wide # variety of pre-POSIX systems that do not have POSIX shells at all, and # even some reasonably current systems (Solaris 10 as case-in-point) still # have a pre-POSIX /bin/sh. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2022 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi # Just in case it came from the environment. GUESS= # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. tmp= # shellcheck disable=SC2172 trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 set_cc_for_build() { # prevent multiple calls if $tmp is already set test "$tmp" && return 0 : "${TMPDIR=/tmp}" # shellcheck disable=SC2039,SC3028 { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } dummy=$tmp/dummy case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in ,,) echo "int x;" > "$dummy.c" for driver in cc gcc c89 c99 ; do if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then CC_FOR_BUILD=$driver break fi done if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac } # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if test -f /.attbin/uname ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case $UNAME_SYSTEM in Linux|GNU|GNU/*) LIBC=unknown set_cc_for_build cat <<-EOF > "$dummy.c" #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #elif defined(__GLIBC__) LIBC=gnu #else #include /* First heuristic to detect musl libc. */ #ifdef __DEFINED_va_list LIBC=musl #endif #endif EOF cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` eval "$cc_set_libc" # Second heuristic to detect musl libc. if [ "$LIBC" = unknown ] && command -v ldd >/dev/null && ldd --version 2>&1 | grep -q ^musl; then LIBC=musl fi # If the system lacks a compiler, then just pick glibc. # We could probably try harder. if [ "$LIBC" = unknown ]; then LIBC=gnu fi ;; esac # Note: order is significant - the case branches are not exclusive. case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ /sbin/sysctl -n hw.machine_arch 2>/dev/null || \ /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \ echo unknown)` case $UNAME_MACHINE_ARCH in aarch64eb) machine=aarch64_be-unknown ;; armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; earmv*) arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` machine=${arch}${endian}-unknown ;; *) machine=$UNAME_MACHINE_ARCH-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently (or will in the future) and ABI. case $UNAME_MACHINE_ARCH in earm*) os=netbsdelf ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # Determine ABI tags. case $UNAME_MACHINE_ARCH in earm*) expr='s/^earmv[0-9]/-eabi/;s/eb$//' abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case $UNAME_VERSION in Debian*) release='-gnu' ;; *) release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. GUESS=$machine-${os}${release}${abi-} ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE ;; *:SecBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'` GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE ;; *:LibertyBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE ;; *:MidnightBSD:*:*) GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE ;; *:ekkoBSD:*:*) GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE ;; *:SolidBSD:*:*) GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE ;; *:OS108:*:*) GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE ;; macppc:MirBSD:*:*) GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE ;; *:MirBSD:*:*) GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE ;; *:Sortix:*:*) GUESS=$UNAME_MACHINE-unknown-sortix ;; *:Twizzler:*:*) GUESS=$UNAME_MACHINE-unknown-twizzler ;; *:Redox:*:*) GUESS=$UNAME_MACHINE-unknown-redox ;; mips:OSF1:*.*) GUESS=mips-dec-osf1 ;; alpha:OSF1:*:*) # Reset EXIT trap before exiting to avoid spurious non-zero exit code. trap '' 0 case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case $ALPHA_CPU_TYPE in "EV4 (21064)") UNAME_MACHINE=alpha ;; "EV4.5 (21064)") UNAME_MACHINE=alpha ;; "LCA4 (21066/21068)") UNAME_MACHINE=alpha ;; "EV5 (21164)") UNAME_MACHINE=alphaev5 ;; "EV5.6 (21164A)") UNAME_MACHINE=alphaev56 ;; "EV5.6 (21164PC)") UNAME_MACHINE=alphapca56 ;; "EV5.7 (21164PC)") UNAME_MACHINE=alphapca57 ;; "EV6 (21264)") UNAME_MACHINE=alphaev6 ;; "EV6.7 (21264A)") UNAME_MACHINE=alphaev67 ;; "EV6.8CB (21264C)") UNAME_MACHINE=alphaev68 ;; "EV6.8AL (21264B)") UNAME_MACHINE=alphaev68 ;; "EV6.8CX (21264D)") UNAME_MACHINE=alphaev68 ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE=alphaev69 ;; "EV7 (21364)") UNAME_MACHINE=alphaev7 ;; "EV7.9 (21364A)") UNAME_MACHINE=alphaev79 ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` GUESS=$UNAME_MACHINE-dec-osf$OSF_REL ;; Amiga*:UNIX_System_V:4.0:*) GUESS=m68k-unknown-sysv4 ;; *:[Aa]miga[Oo][Ss]:*:*) GUESS=$UNAME_MACHINE-unknown-amigaos ;; *:[Mm]orph[Oo][Ss]:*:*) GUESS=$UNAME_MACHINE-unknown-morphos ;; *:OS/390:*:*) GUESS=i370-ibm-openedition ;; *:z/VM:*:*) GUESS=s390-ibm-zvmoe ;; *:OS400:*:*) GUESS=powerpc-ibm-os400 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) GUESS=arm-acorn-riscix$UNAME_RELEASE ;; arm*:riscos:*:*|arm*:RISCOS:*:*) GUESS=arm-unknown-riscos ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) GUESS=hppa1.1-hitachi-hiuxmpp ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. case `(/bin/universe) 2>/dev/null` in att) GUESS=pyramid-pyramid-sysv3 ;; *) GUESS=pyramid-pyramid-bsd ;; esac ;; NILE*:*:*:dcosx) GUESS=pyramid-pyramid-svr4 ;; DRS?6000:unix:4.0:6*) GUESS=sparc-icl-nx6 ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) GUESS=sparc-icl-nx7 ;; esac ;; s390x:SunOS:*:*) SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL ;; sun4H:SunOS:5.*:*) SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=sparc-hal-solaris2$SUN_REL ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=sparc-sun-solaris2$SUN_REL ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) GUESS=i386-pc-auroraux$UNAME_RELEASE ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) set_cc_for_build SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH=x86_64 fi fi SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=$SUN_ARCH-pc-solaris2$SUN_REL ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=sparc-sun-solaris3$SUN_REL ;; sun4*:SunOS:*:*) case `/usr/bin/arch -k` in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'` GUESS=sparc-sun-sunos$SUN_REL ;; sun3*:SunOS:*:*) GUESS=m68k-sun-sunos$UNAME_RELEASE ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 case `/bin/arch` in sun3) GUESS=m68k-sun-sunos$UNAME_RELEASE ;; sun4) GUESS=sparc-sun-sunos$UNAME_RELEASE ;; esac ;; aushp:SunOS:*:*) GUESS=sparc-auspex-sunos$UNAME_RELEASE ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) GUESS=m68k-atari-mint$UNAME_RELEASE ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) GUESS=m68k-atari-mint$UNAME_RELEASE ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) GUESS=m68k-atari-mint$UNAME_RELEASE ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) GUESS=m68k-milan-mint$UNAME_RELEASE ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) GUESS=m68k-hades-mint$UNAME_RELEASE ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) GUESS=m68k-unknown-mint$UNAME_RELEASE ;; m68k:machten:*:*) GUESS=m68k-apple-machten$UNAME_RELEASE ;; powerpc:machten:*:*) GUESS=powerpc-apple-machten$UNAME_RELEASE ;; RISC*:Mach:*:*) GUESS=mips-dec-mach_bsd4.3 ;; RISC*:ULTRIX:*:*) GUESS=mips-dec-ultrix$UNAME_RELEASE ;; VAX*:ULTRIX*:*:*) GUESS=vax-dec-ultrix$UNAME_RELEASE ;; 2020:CLIX:*:* | 2430:CLIX:*:*) GUESS=clipper-intergraph-clix$UNAME_RELEASE ;; mips:*:*:UMIPS | mips:*:*:RISCos) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`"$dummy" "$dummyarg"` && { echo "$SYSTEM_NAME"; exit; } GUESS=mips-mips-riscos$UNAME_RELEASE ;; Motorola:PowerMAX_OS:*:*) GUESS=powerpc-motorola-powermax ;; Motorola:*:4.3:PL8-*) GUESS=powerpc-harris-powermax ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) GUESS=powerpc-harris-powermax ;; Night_Hawk:Power_UNIX:*:*) GUESS=powerpc-harris-powerunix ;; m88k:CX/UX:7*:*) GUESS=m88k-harris-cxux7 ;; m88k:*:4*:R4*) GUESS=m88k-motorola-sysv4 ;; m88k:*:3*:R3*) GUESS=m88k-motorola-sysv3 ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110 then if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \ test "$TARGET_BINARY_INTERFACE"x = x then GUESS=m88k-dg-dgux$UNAME_RELEASE else GUESS=m88k-dg-dguxbcs$UNAME_RELEASE fi else GUESS=i586-dg-dgux$UNAME_RELEASE fi ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) GUESS=m88k-dolphin-sysv3 ;; M88*:*:R3*:*) # Delta 88k system running SVR3 GUESS=m88k-motorola-sysv3 ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) GUESS=m88k-tektronix-sysv3 ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) GUESS=m68k-tektronix-bsd ;; *:IRIX*:*:*) IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'` GUESS=mips-sgi-irix$IRIX_REL ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. GUESS=romp-ibm-aix # uname -m gives an 8 hex-code CPU id ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) GUESS=i386-ibm-aix ;; ia64:AIX:*:*) if test -x /usr/bin/oslevel ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=$UNAME_VERSION.$UNAME_RELEASE fi GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` then GUESS=$SYSTEM_NAME else GUESS=rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then GUESS=rs6000-ibm-aix3.2.4 else GUESS=rs6000-ibm-aix3.2 fi ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if test -x /usr/bin/lslpp ; then IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \ awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV=$UNAME_VERSION.$UNAME_RELEASE fi GUESS=$IBM_ARCH-ibm-aix$IBM_REV ;; *:AIX:*:*) GUESS=rs6000-ibm-aix ;; ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) GUESS=romp-ibm-bsd4.4 ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and GUESS=romp-ibm-bsd$UNAME_RELEASE # 4.3 with uname added to ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) GUESS=rs6000-bull-bosx ;; DPX/2?00:B.O.S.:*:*) GUESS=m68k-bull-sysv3 ;; 9000/[34]??:4.3bsd:1.*:*) GUESS=m68k-hp-bsd ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) GUESS=m68k-hp-bsd4.4 ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` case $UNAME_MACHINE in 9000/31?) HP_ARCH=m68000 ;; 9000/[34]??) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if test -x /usr/bin/getconf; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case $sc_cpu_version in 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case $sc_kernel_bits in 32) HP_ARCH=hppa2.0n ;; 64) HP_ARCH=hppa2.0w ;; '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi if test "$HP_ARCH" = ""; then set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if test "$HP_ARCH" = hppa2.0w then set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH=hppa2.0w else HP_ARCH=hppa64 fi fi GUESS=$HP_ARCH-hp-hpux$HPUX_REV ;; ia64:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` GUESS=ia64-hp-hpux$HPUX_REV ;; 3050*:HI-UX:*:*) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } GUESS=unknown-hitachi-hiuxwe2 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) GUESS=hppa1.1-hp-bsd ;; 9000/8??:4.3bsd:*:*) GUESS=hppa1.0-hp-bsd ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) GUESS=hppa1.0-hp-mpeix ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) GUESS=hppa1.1-hp-osf ;; hp8??:OSF1:*:*) GUESS=hppa1.0-hp-osf ;; i*86:OSF1:*:*) if test -x /usr/sbin/sysversion ; then GUESS=$UNAME_MACHINE-unknown-osf1mk else GUESS=$UNAME_MACHINE-unknown-osf1 fi ;; parisc*:Lites*:*:*) GUESS=hppa1.1-hp-lites ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) GUESS=c1-convex-bsd ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) GUESS=c34-convex-bsd ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) GUESS=c38-convex-bsd ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) GUESS=c4-convex-bsd ;; CRAY*Y-MP:*:*:*) CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` GUESS=ymp-cray-unicos$CRAY_REL ;; CRAY*[A-Z]90:*:*:*) echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` GUESS=t90-cray-unicos$CRAY_REL ;; CRAY*T3E:*:*:*) CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` GUESS=alphaev5-cray-unicosmk$CRAY_REL ;; CRAY*SV1:*:*:*) CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` GUESS=sv1-cray-unicos$CRAY_REL ;; *:UNICOS/mp:*:*) CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` GUESS=craynv-cray-unicosmp$CRAY_REL ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE ;; sparc*:BSD/OS:*:*) GUESS=sparc-unknown-bsdi$UNAME_RELEASE ;; *:BSD/OS:*:*) GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE ;; arm:FreeBSD:*:*) UNAME_PROCESSOR=`uname -p` set_cc_for_build if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi else FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf fi ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case $UNAME_PROCESSOR in amd64) UNAME_PROCESSOR=x86_64 ;; i386) UNAME_PROCESSOR=i586 ;; esac FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL ;; i*:CYGWIN*:*) GUESS=$UNAME_MACHINE-pc-cygwin ;; *:MINGW64*:*) GUESS=$UNAME_MACHINE-pc-mingw64 ;; *:MINGW*:*) GUESS=$UNAME_MACHINE-pc-mingw32 ;; *:MSYS*:*) GUESS=$UNAME_MACHINE-pc-msys ;; i*:PW*:*) GUESS=$UNAME_MACHINE-pc-pw32 ;; *:SerenityOS:*:*) GUESS=$UNAME_MACHINE-pc-serenity ;; *:Interix*:*) case $UNAME_MACHINE in x86) GUESS=i586-pc-interix$UNAME_RELEASE ;; authenticamd | genuineintel | EM64T) GUESS=x86_64-unknown-interix$UNAME_RELEASE ;; IA64) GUESS=ia64-unknown-interix$UNAME_RELEASE ;; esac ;; i*:UWIN*:*) GUESS=$UNAME_MACHINE-pc-uwin ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) GUESS=x86_64-pc-cygwin ;; prep*:SunOS:5.*:*) SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=powerpcle-unknown-solaris2$SUN_REL ;; *:GNU:*:*) # the GNU system GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'` GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'` GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL ;; *:GNU/*:*:*) # other systems with GNU libc and userland GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"` GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC ;; x86_64:[Mm]anagarm:*:*|i?86:[Mm]anagarm:*:*) GUESS="$UNAME_MACHINE-pc-managarm-mlibc" ;; *:[Mm]anagarm:*:*) GUESS="$UNAME_MACHINE-unknown-managarm-mlibc" ;; *:Minix:*:*) GUESS=$UNAME_MACHINE-unknown-minix ;; aarch64:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC=gnulibc1 ; fi GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; arm*:Linux:*:*) set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then GUESS=$UNAME_MACHINE-unknown-linux-$LIBC else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi else GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf fi fi ;; avr32*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; cris:Linux:*:*) GUESS=$UNAME_MACHINE-axis-linux-$LIBC ;; crisv32:Linux:*:*) GUESS=$UNAME_MACHINE-axis-linux-$LIBC ;; e2k:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; frv:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; hexagon:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; i*86:Linux:*:*) GUESS=$UNAME_MACHINE-pc-linux-$LIBC ;; ia64:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; k1om:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; loongarch32:Linux:*:* | loongarch64:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; m32r*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; m68*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; mips:Linux:*:* | mips64:Linux:*:*) set_cc_for_build IS_GLIBC=0 test x"${LIBC}" = xgnu && IS_GLIBC=1 sed 's/^ //' << EOF > "$dummy.c" #undef CPU #undef mips #undef mipsel #undef mips64 #undef mips64el #if ${IS_GLIBC} && defined(_ABI64) LIBCABI=gnuabi64 #else #if ${IS_GLIBC} && defined(_ABIN32) LIBCABI=gnuabin32 #else LIBCABI=${LIBC} #endif #endif #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 CPU=mipsisa64r6 #else #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 CPU=mipsisa32r6 #else #if defined(__mips64) CPU=mips64 #else CPU=mips #endif #endif #endif #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) MIPS_ENDIAN=el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) MIPS_ENDIAN= #else MIPS_ENDIAN= #endif #endif EOF cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'` eval "$cc_set_vars" test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } ;; mips64el:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; openrisc*:Linux:*:*) GUESS=or1k-unknown-linux-$LIBC ;; or32:Linux:*:* | or1k*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; padre:Linux:*:*) GUESS=sparc-unknown-linux-$LIBC ;; parisc64:Linux:*:* | hppa64:Linux:*:*) GUESS=hppa64-unknown-linux-$LIBC ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;; PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;; *) GUESS=hppa-unknown-linux-$LIBC ;; esac ;; ppc64:Linux:*:*) GUESS=powerpc64-unknown-linux-$LIBC ;; ppc:Linux:*:*) GUESS=powerpc-unknown-linux-$LIBC ;; ppc64le:Linux:*:*) GUESS=powerpc64le-unknown-linux-$LIBC ;; ppcle:Linux:*:*) GUESS=powerpcle-unknown-linux-$LIBC ;; riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; s390:Linux:*:* | s390x:Linux:*:*) GUESS=$UNAME_MACHINE-ibm-linux-$LIBC ;; sh64*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; sh*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; sparc:Linux:*:* | sparc64:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; tile*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; vax:Linux:*:*) GUESS=$UNAME_MACHINE-dec-linux-$LIBC ;; x86_64:Linux:*:*) set_cc_for_build CPU=$UNAME_MACHINE LIBCABI=$LIBC if test "$CC_FOR_BUILD" != no_compiler_found; then ABI=64 sed 's/^ //' << EOF > "$dummy.c" #ifdef __i386__ ABI=x86 #else #ifdef __ILP32__ ABI=x32 #endif #endif EOF cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'` eval "$cc_set_abi" case $ABI in x86) CPU=i686 ;; x32) LIBCABI=${LIBC}x32 ;; esac fi GUESS=$CPU-pc-linux-$LIBCABI ;; xtensa*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. GUESS=i386-sequent-sysv4 ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. GUESS=$UNAME_MACHINE-pc-os2-emx ;; i*86:XTS-300:*:STOP) GUESS=$UNAME_MACHINE-unknown-stop ;; i*86:atheos:*:*) GUESS=$UNAME_MACHINE-unknown-atheos ;; i*86:syllable:*:*) GUESS=$UNAME_MACHINE-pc-syllable ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) GUESS=i386-unknown-lynxos$UNAME_RELEASE ;; i*86:*DOS:*:*) GUESS=$UNAME_MACHINE-pc-msdosdjgpp ;; i*86:*:4.*:*) UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL else GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL fi ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL else GUESS=$UNAME_MACHINE-pc-sysv32 fi ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. GUESS=i586-pc-msdosdjgpp ;; Intel:Mach:3*:*) GUESS=i386-pc-mach3 ;; paragon:*:*:*) GUESS=i860-intel-osf1 ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then GUESS=i860-stardent-sysv$UNAME_RELEASE # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. GUESS=i860-unknown-sysv$UNAME_RELEASE # Unknown i860-SVR4 fi ;; mini*:CTIX:SYS*5:*) # "miniframe" GUESS=m68010-convergent-sysv ;; mc68k:UNIX:SYSTEM5:3.51m) GUESS=m68k-convergent-sysv ;; M680?0:D-NIX:5.3:*) GUESS=m68k-diab-dnix ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) GUESS=m68k-unknown-lynxos$UNAME_RELEASE ;; mc68030:UNIX_System_V:4.*:*) GUESS=m68k-atari-sysv4 ;; TSUNAMI:LynxOS:2.*:*) GUESS=sparc-unknown-lynxos$UNAME_RELEASE ;; rs6000:LynxOS:2.*:*) GUESS=rs6000-unknown-lynxos$UNAME_RELEASE ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) GUESS=powerpc-unknown-lynxos$UNAME_RELEASE ;; SM[BE]S:UNIX_SV:*:*) GUESS=mips-dde-sysv$UNAME_RELEASE ;; RM*:ReliantUNIX-*:*:*) GUESS=mips-sni-sysv4 ;; RM*:SINIX-*:*:*) GUESS=mips-sni-sysv4 ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` GUESS=$UNAME_MACHINE-sni-sysv4 else GUESS=ns32k-sni-sysv fi ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says GUESS=i586-unisys-sysv4 ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm GUESS=hppa1.1-stratus-sysv4 ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. GUESS=i860-stratus-sysv4 ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. GUESS=$UNAME_MACHINE-stratus-vos ;; *:VOS:*:*) # From Paul.Green@stratus.com. GUESS=hppa1.1-stratus-vos ;; mc68*:A/UX:*:*) GUESS=m68k-apple-aux$UNAME_RELEASE ;; news*:NEWS-OS:6*:*) GUESS=mips-sony-newsos6 ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if test -d /usr/nec; then GUESS=mips-nec-sysv$UNAME_RELEASE else GUESS=mips-unknown-sysv$UNAME_RELEASE fi ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. GUESS=powerpc-be-beos ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. GUESS=powerpc-apple-beos ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. GUESS=i586-pc-beos ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. GUESS=i586-pc-haiku ;; ppc:Haiku:*:*) # Haiku running on Apple PowerPC GUESS=powerpc-apple-haiku ;; *:Haiku:*:*) # Haiku modern gcc (not bound by BeOS compat) GUESS=$UNAME_MACHINE-unknown-haiku ;; SX-4:SUPER-UX:*:*) GUESS=sx4-nec-superux$UNAME_RELEASE ;; SX-5:SUPER-UX:*:*) GUESS=sx5-nec-superux$UNAME_RELEASE ;; SX-6:SUPER-UX:*:*) GUESS=sx6-nec-superux$UNAME_RELEASE ;; SX-7:SUPER-UX:*:*) GUESS=sx7-nec-superux$UNAME_RELEASE ;; SX-8:SUPER-UX:*:*) GUESS=sx8-nec-superux$UNAME_RELEASE ;; SX-8R:SUPER-UX:*:*) GUESS=sx8r-nec-superux$UNAME_RELEASE ;; SX-ACE:SUPER-UX:*:*) GUESS=sxace-nec-superux$UNAME_RELEASE ;; Power*:Rhapsody:*:*) GUESS=powerpc-apple-rhapsody$UNAME_RELEASE ;; *:Rhapsody:*:*) GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE ;; arm64:Darwin:*:*) GUESS=aarch64-apple-darwin$UNAME_RELEASE ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` case $UNAME_PROCESSOR in unknown) UNAME_PROCESSOR=powerpc ;; esac if command -v xcode-select > /dev/null 2> /dev/null && \ ! xcode-select --print-path > /dev/null 2> /dev/null ; then # Avoid executing cc if there is no toolchain installed as # cc will be a stub that puts up a graphical alert # prompting the user to install developer tools. CC_FOR_BUILD=no_compiler_found else set_cc_for_build fi if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_PPC >/dev/null then UNAME_PROCESSOR=powerpc fi elif test "$UNAME_PROCESSOR" = i386 ; then # uname -m returns i386 or x86_64 UNAME_PROCESSOR=$UNAME_MACHINE fi GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE ;; *:QNX:*:4*) GUESS=i386-pc-qnx ;; NEO-*:NONSTOP_KERNEL:*:*) GUESS=neo-tandem-nsk$UNAME_RELEASE ;; NSE-*:NONSTOP_KERNEL:*:*) GUESS=nse-tandem-nsk$UNAME_RELEASE ;; NSR-*:NONSTOP_KERNEL:*:*) GUESS=nsr-tandem-nsk$UNAME_RELEASE ;; NSV-*:NONSTOP_KERNEL:*:*) GUESS=nsv-tandem-nsk$UNAME_RELEASE ;; NSX-*:NONSTOP_KERNEL:*:*) GUESS=nsx-tandem-nsk$UNAME_RELEASE ;; *:NonStop-UX:*:*) GUESS=mips-compaq-nonstopux ;; BS2000:POSIX*:*:*) GUESS=bs2000-siemens-sysv ;; DS/*:UNIX_System_V:*:*) GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "${cputype-}" = 386; then UNAME_MACHINE=i386 elif test "x${cputype-}" != x; then UNAME_MACHINE=$cputype fi GUESS=$UNAME_MACHINE-unknown-plan9 ;; *:TOPS-10:*:*) GUESS=pdp10-unknown-tops10 ;; *:TENEX:*:*) GUESS=pdp10-unknown-tenex ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) GUESS=pdp10-dec-tops20 ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) GUESS=pdp10-xkl-tops20 ;; *:TOPS-20:*:*) GUESS=pdp10-unknown-tops20 ;; *:ITS:*:*) GUESS=pdp10-unknown-its ;; SEI:*:*:SEIUX) GUESS=mips-sei-seiux$UNAME_RELEASE ;; *:DragonFly:*:*) DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case $UNAME_MACHINE in A*) GUESS=alpha-dec-vms ;; I*) GUESS=ia64-dec-vms ;; V*) GUESS=vax-dec-vms ;; esac ;; *:XENIX:*:SysV) GUESS=i386-pc-xenix ;; i*86:skyos:*:*) SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'` GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL ;; i*86:rdos:*:*) GUESS=$UNAME_MACHINE-pc-rdos ;; i*86:Fiwix:*:*) GUESS=$UNAME_MACHINE-pc-fiwix ;; *:AROS:*:*) GUESS=$UNAME_MACHINE-unknown-aros ;; x86_64:VMkernel:*:*) GUESS=$UNAME_MACHINE-unknown-esx ;; amd64:Isilon\ OneFS:*:*) GUESS=x86_64-unknown-onefs ;; *:Unleashed:*:*) GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE ;; esac # Do we have a guess based on uname results? if test "x$GUESS" != x; then echo "$GUESS" exit fi # No uname command or uname output not recognized. set_cc_for_build cat > "$dummy.c" < #include #endif #if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) #if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) #include #if defined(_SIZE_T_) || defined(SIGLOST) #include #endif #endif #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) #if !defined (ultrix) #include #if defined (BSD) #if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); #else #if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); #else printf ("vax-dec-bsd\n"); exit (0); #endif #endif #else printf ("vax-dec-bsd\n"); exit (0); #endif #else #if defined(_SIZE_T_) || defined(SIGLOST) struct utsname un; uname (&un); printf ("vax-dec-ultrix%s\n", un.release); exit (0); #else printf ("vax-dec-ultrix\n"); exit (0); #endif #endif #endif #if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) #if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) #if defined(_SIZE_T_) || defined(SIGLOST) struct utsname *un; uname (&un); printf ("mips-dec-ultrix%s\n", un.release); exit (0); #else printf ("mips-dec-ultrix\n"); exit (0); #endif #endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; } echo "$0: unable to guess system type" >&2 case $UNAME_MACHINE:$UNAME_SYSTEM in mips:Linux | mips64:Linux) # If we got here on MIPS GNU/Linux, output extra information. cat >&2 <&2 <&2 </dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = "$UNAME_MACHINE" UNAME_RELEASE = "$UNAME_RELEASE" UNAME_SYSTEM = "$UNAME_SYSTEM" UNAME_VERSION = "$UNAME_VERSION" EOF fi exit 1 # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: unuran-1.11.0/autoconf/missing0000755001357500135600000001533614224072466013271 00000000000000#! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2018-03-07.03; # UTC # Copyright (C) 1996-2021 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try '$0 --help' for more information" exit 1 fi case $1 in --is-lightweight) # Used by our autoconf macros to check whether the available missing # script is modern enough. exit 0 ;; --run) # Back-compat with the calling convention used by older automake. shift ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal autoconf autoheader autom4te automake makeinfo bison yacc flex lex help2man Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: unknown '$1' option" echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac # Run the given program, remember its exit status. "$@"; st=$? # If it succeeded, we are done. test $st -eq 0 && exit 0 # Also exit now if we it failed (or wasn't found), and '--version' was # passed; such an option is passed most likely to detect whether the # program is present and works. case $2 in --version|--help) exit $st;; esac # Exit code 63 means version mismatch. This often happens when the user # tries to use an ancient version of a tool on a file that requires a # minimum version. if test $st -eq 63; then msg="probably too old" elif test $st -eq 127; then # Program was missing. msg="missing on your system" else # Program was found and executed, but failed. Give up. exit $st fi perl_URL=https://www.perl.org/ flex_URL=https://github.com/westes/flex gnu_software_URL=https://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'autom4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: unuran-1.11.0/configure0000754001357500135600000240115314430713361011753 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.71 for unuran 1.11.0. # # Report bugs to . # # # Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, # Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh as_nop=: if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi # Reset variables that may have inherited troublesome values from # the environment. # IFS needs to be set, to space, tab, and newline, in precisely that order. # (If _AS_PATH_WALK were called with IFS unset, it would have the # side effect of setting IFS to empty, thus disabling word splitting.) # Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl IFS=" "" $as_nl" PS1='$ ' PS2='> ' PS4='+ ' # Ensure predictable behavior from utilities with locale-dependent output. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # We cannot yet rely on "unset" to work, but we need these variables # to be unset--not just set to an empty or harmless value--now, to # avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct # also avoids known problems related to "unset" and subshell syntax # in other old shells (e.g. bash 2.01 and pdksh 5.2.14). for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH do eval test \${$as_var+y} \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done # Ensure that fds 0, 1, and 2 are open. if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="as_nop=: if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else \$as_nop case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ) then : else \$as_nop exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 blah=\$(echo \$(echo blah)) test x\"\$blah\" = xblah || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null then : as_have_required=yes else $as_nop as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null then : else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null then : CONFIG_SHELL=$as_shell as_have_required=yes if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null then : break 2 fi fi done;; esac as_found=false done IFS=$as_save_IFS if $as_found then : else $as_nop if { test -f "$SHELL" || test -f "$SHELL.exe"; } && as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null then : CONFIG_SHELL=$SHELL as_have_required=yes fi fi if test "x$CONFIG_SHELL" != x then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno then : printf "%s\n" "$0: This script requires a shell more modern than all" printf "%s\n" "$0: the shells that I found on your system." if test ${ZSH_VERSION+y} ; then printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." else printf "%s\n" "$0: Please tell bug-autoconf@gnu.org and $0: unuran@statmath.wu.ac.at about your system, including $0: any error possibly output before this message. Then $0: install a modern shell, or manually run the script $0: under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_nop # --------- # Do nothing but, unlike ":", preserve the value of $?. as_fn_nop () { return $? } as_nop=as_fn_nop # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null then : eval 'as_fn_append () { eval $1+=\$2 }' else $as_nop as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null then : eval 'as_fn_arith () { as_val=$(( $* )) }' else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_nop # --------- # Do nothing but, unlike ":", preserve the value of $?. as_fn_nop () { return $? } as_nop=as_fn_nop # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } # Determine whether it's possible to make 'echo' print without a newline. # These variables are no longer used directly by Autoconf, but are AC_SUBSTed # for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac # For backward compatibility with old third-party macros, we provide # the shell variables $as_echo and $as_echo_n. New code should use # AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. as_echo='printf %s\n' as_echo_n='printf %s' rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" SHELL=${CONFIG_SHELL-/bin/sh} test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='unuran' PACKAGE_TARNAME='unuran' PACKAGE_VERSION='1.11.0' PACKAGE_STRING='unuran 1.11.0' PACKAGE_BUGREPORT='unuran@statmath.wu.ac.at' PACKAGE_URL='' ac_unique_file="src/unuran_config.h" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_STDIO_H # include #endif #ifdef HAVE_STDLIB_H # include #endif #ifdef HAVE_STRING_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_header_c_list= ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS HAVE_MINGW_FALSE HAVE_MINGW_TRUE AM_CFLAGS HAVE_VALGRIND_FALSE HAVE_VALGRIND_TRUE have_valgrind HAVE_MATHEMATICA_FALSE HAVE_MATHEMATICA_TRUE ENABLE_EXPERIMENTAL_FALSE ENABLE_EXPERIMENTAL_TRUE ENABLE_DEPRECATED_FALSE ENABLE_DEPRECATED_TRUE HAVE_DIVIDE_BY_ZERO HAVE_IEEE_COMPARISONS UNURAN_SUPPORTS_GSL UNURAN_SUPPORTS_PRNG UNURAN_SUPPORTS_RNGSTREAM CXXCPP LT_SYS_LIBRARY_PATH OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL MANIFEST_TOOL ac_ct_AR DLLTOOL OBJDUMP FILECMD NM ac_ct_DUMPBIN DUMPBIN LD FGREP EGREP GREP SED LIBTOOL AR LN_S RANLIB CPP am__fastdepCXX_FALSE am__fastdepCXX_TRUE CXXDEPMODE ac_ct_CXX CXXFLAGS CXX am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC host_os host_vendor host_cpu host build_os build_vendor build_cpu build MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE UNURAN_LT_VERSION AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V CSCOPE ETAGS CTAGS am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir runstatedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL am__quote' ac_subst_files='' ac_user_opts=' enable_option_checking enable_silent_rules enable_maintainer_mode enable_dependency_tracking enable_shared enable_static with_pic enable_fast_install with_aix_soname with_gnu_ld with_sysroot enable_libtool_lock with_urng_rngstream with_urng_prng with_urng_gsl with_urng_default with_Rmath enable_deprecated enable_check_struct enable_logging enable_info enable_experimental with_mathematica ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CXX CXXFLAGS CCC CPP LT_SYS_LIBRARY_PATH CXXCPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -runstatedir | --runstatedir | --runstatedi | --runstated \ | --runstate | --runstat | --runsta | --runst | --runs \ | --run | --ru | --r) ac_prev=runstatedir ;; -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ | --run=* | --ru=* | --r=*) runstatedir=$ac_optarg ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures unuran 1.11.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/unuran] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of unuran 1.11.0:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build --enable-shared[=PKGS] build shared libraries [default=no] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --enable-deprecated enable support for deprecated UNU.RAN routines [default=no] --enable-check-struct Debug: check validity of pointers to structures [default=no] --enable-logging Debug: print informations about generator into logfile [default=no] --enable-info Info: provide function with information about generator objects [default=yes] --enable-experimental Experimental code (not documented) [default=no] Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use both] --with-aix-soname=aix|svr4|both shared library versioning (aka "SONAME") variant to provide on AIX, [default=aix]. --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-sysroot[=DIR] Search for dependent libraries within DIR (or the compiler's sysroot if not specified). --with-urng-rngstream URNG: use Pierre L'Ecuyer's RNGSTREAM library [default=no] --with-urng-prng URNG: use Otmar Lendl's PRNG library [default=no] --with-urng-gsl URNG: use random number generators from GNU Scientific Library [default=no] --with-urng-default URNG: global default (builtin|rngstream) [default=builtin] --with-Rmath use Rmath library from R project [EXPERIMENTAL] [default=no] --with-mathematica Use Mathematica(R) for some checks [default=no] Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CXX C++ compiler command CXXFLAGS C++ compiler flags CPP C preprocessor LT_SYS_LIBRARY_PATH User-defined run-time library search path. CXXCPP C++ preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for configure.gnu first; this name is used for a wrapper for # Metaconfig's "Configure" on case-insensitive file systems. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF unuran configure 1.11.0 generated by GNU Autoconf 2.71 Copyright (C) 2021 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest.beam if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext then : ac_retval=0 else $as_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_cxx_try_compile LINENO # ---------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest.beam if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext then : ac_retval=0 else $as_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err } then : ac_retval=0 else $as_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext } then : ac_retval=0 else $as_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 printf %s "checking for $2... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$3=yes" else $as_nop eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 printf %s "checking for $2... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (void); below. */ #include #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (void); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main (void) { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : eval "$3=yes" else $as_nop eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_cxx_try_cpp LINENO # ------------------------ # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.err } then : ac_retval=0 else $as_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_cpp # ac_fn_cxx_try_link LINENO # ------------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext } then : ac_retval=0 else $as_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_link # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 printf %s "checking for $2... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 else $as_nop eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : else $as_nop eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type # ac_fn_check_decl LINENO SYMBOL VAR INCLUDES EXTRA-OPTIONS FLAG-VAR # ------------------------------------------------------------------ # Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR # accordingly. Pass EXTRA-OPTIONS to the compiler, using FLAG-VAR. ac_fn_check_decl () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack as_decl_name=`echo $2|sed 's/ *(.*//'` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 printf %s "checking whether $as_decl_name is declared... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 else $as_nop as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` eval ac_save_FLAGS=\$$6 as_fn_append $6 " $5" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { #ifndef $as_decl_name #ifdef __cplusplus (void) $as_decl_use; #else (void) $as_decl_name; #endif #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$3=yes" else $as_nop eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext eval $6=\$ac_save_FLAGS fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_check_decl # ac_fn_c_try_run LINENO # ---------------------- # Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that # executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; } then : ac_retval=0 else $as_nop printf "%s\n" "$as_me: program exited with status $ac_status" >&5 printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run ac_configure_args_raw= for ac_arg do case $ac_arg in *\'*) ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append ac_configure_args_raw " '$ac_arg'" done case $ac_configure_args_raw in *$as_nl*) ac_safe_unquote= ;; *) ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. ac_unsafe_a="$ac_unsafe_z#~" ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; esac cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by unuran $as_me 1.11.0, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac printf "%s\n" "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Sanitize IFS. IFS=" "" $as_nl" # Save into config.log some information that might help in debugging. { echo printf "%s\n" "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo printf "%s\n" "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then printf "%s\n" "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then printf "%s\n" "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && printf "%s\n" "$as_me: caught signal $ac_signal" printf "%s\n" "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h printf "%s\n" "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. if test -n "$CONFIG_SITE"; then ac_site_files="$CONFIG_SITE" elif test "x$prefix" != xNONE; then ac_site_files="$prefix/share/config.site $prefix/etc/config.site" else ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi for ac_site_file in $ac_site_files do case $ac_site_file in #( */*) : ;; #( *) : ac_site_file=./$ac_site_file ;; esac if test -f "$ac_site_file" && test -r "$ac_site_file"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 printf "%s\n" "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 printf "%s\n" "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Test code for whether the C compiler supports C89 (global declarations) ac_c_conftest_c89_globals=' /* Does the compiler advertise C89 conformance? Do not test the value of __STDC__, because some compilers set it to 0 while being otherwise adequately conformant. */ #if !defined __STDC__ # error "Compiler does not advertise C89 conformance" #endif #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ struct buf { int x; }; struct buf * (*rcsopen) (struct buf *, struct stat *, int); static char *e (char **p, int i) { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not \xHH hex character constants. These do not provoke an error unfortunately, instead are silently treated as an "x". The following induces an error, until -std is added to get proper ANSI mode. Curiously \x00 != x always comes out true, for an array size at least. It is necessary to write \x00 == 0 to get something that is true only with -std. */ int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) '\''x'\'' int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int), int, int);' # Test code for whether the C compiler supports C89 (body of main). ac_c_conftest_c89_main=' ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); ' # Test code for whether the C compiler supports C99 (global declarations) ac_c_conftest_c99_globals=' // Does the compiler advertise C99 conformance? #if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L # error "Compiler does not advertise C99 conformance" #endif #include extern int puts (const char *); extern int printf (const char *, ...); extern int dprintf (int, const char *, ...); extern void *malloc (size_t); extern void free (void *); // Check varargs macros. These examples are taken from C99 6.10.3.5. // dprintf is used instead of fprintf to avoid needing to declare // FILE and stderr. #define debug(...) dprintf (2, __VA_ARGS__) #define showlist(...) puts (#__VA_ARGS__) #define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) static void test_varargs_macros (void) { int x = 1234; int y = 5678; debug ("Flag"); debug ("X = %d\n", x); showlist (The first, second, and third items.); report (x>y, "x is %d but y is %d", x, y); } // Check long long types. #define BIG64 18446744073709551615ull #define BIG32 4294967295ul #define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) #if !BIG_OK #error "your preprocessor is broken" #endif #if BIG_OK #else #error "your preprocessor is broken" #endif static long long int bignum = -9223372036854775807LL; static unsigned long long int ubignum = BIG64; struct incomplete_array { int datasize; double data[]; }; struct named_init { int number; const wchar_t *name; double average; }; typedef const char *ccp; static inline int test_restrict (ccp restrict text) { // See if C++-style comments work. // Iterate through items via the restricted pointer. // Also check for declarations in for loops. for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) continue; return 0; } // Check varargs and va_copy. static bool test_varargs (const char *format, ...) { va_list args; va_start (args, format); va_list args_copy; va_copy (args_copy, args); const char *str = ""; int number = 0; float fnumber = 0; while (*format) { switch (*format++) { case '\''s'\'': // string str = va_arg (args_copy, const char *); break; case '\''d'\'': // int number = va_arg (args_copy, int); break; case '\''f'\'': // float fnumber = va_arg (args_copy, double); break; default: break; } } va_end (args_copy); va_end (args); return *str && number && fnumber; } ' # Test code for whether the C compiler supports C99 (body of main). ac_c_conftest_c99_main=' // Check bool. _Bool success = false; success |= (argc != 0); // Check restrict. if (test_restrict ("String literal") == 0) success = true; char *restrict newvar = "Another string"; // Check varargs. success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234); test_varargs_macros (); // Check flexible array members. struct incomplete_array *ia = malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); ia->datasize = 10; for (int i = 0; i < ia->datasize; ++i) ia->data[i] = i * 1.234; // Check named initializers. struct named_init ni = { .number = 34, .name = L"Test wide string", .average = 543.34343, }; ni.number = 58; int dynamic_array[ni.number]; dynamic_array[0] = argv[0][0]; dynamic_array[ni.number - 1] = 543; // work around unused variable warnings ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\'' || dynamic_array[ni.number - 1] != 543); ' # Test code for whether the C compiler supports C11 (global declarations) ac_c_conftest_c11_globals=' // Does the compiler advertise C11 conformance? #if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L # error "Compiler does not advertise C11 conformance" #endif // Check _Alignas. char _Alignas (double) aligned_as_double; char _Alignas (0) no_special_alignment; extern char aligned_as_int; char _Alignas (0) _Alignas (int) aligned_as_int; // Check _Alignof. enum { int_alignment = _Alignof (int), int_array_alignment = _Alignof (int[100]), char_alignment = _Alignof (char) }; _Static_assert (0 < -_Alignof (int), "_Alignof is signed"); // Check _Noreturn. int _Noreturn does_not_return (void) { for (;;) continue; } // Check _Static_assert. struct test_static_assert { int x; _Static_assert (sizeof (int) <= sizeof (long int), "_Static_assert does not work in struct"); long int y; }; // Check UTF-8 literals. #define u8 syntax error! char const utf8_literal[] = u8"happens to be ASCII" "another string"; // Check duplicate typedefs. typedef long *long_ptr; typedef long int *long_ptr; typedef long_ptr long_ptr; // Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. struct anonymous { union { struct { int i; int j; }; struct { int k; long int l; } w; }; int m; } v1; ' # Test code for whether the C compiler supports C11 (body of main). ac_c_conftest_c11_main=' _Static_assert ((offsetof (struct anonymous, i) == offsetof (struct anonymous, w.k)), "Anonymous union alignment botch"); v1.i = 2; v1.w.k = 5; ok |= v1.i != 5; ' # Test code for whether the C compiler supports C11 (complete). ac_c_conftest_c11_program="${ac_c_conftest_c89_globals} ${ac_c_conftest_c99_globals} ${ac_c_conftest_c11_globals} int main (int argc, char **argv) { int ok = 0; ${ac_c_conftest_c89_main} ${ac_c_conftest_c99_main} ${ac_c_conftest_c11_main} return ok; } " # Test code for whether the C compiler supports C99 (complete). ac_c_conftest_c99_program="${ac_c_conftest_c89_globals} ${ac_c_conftest_c99_globals} int main (int argc, char **argv) { int ok = 0; ${ac_c_conftest_c89_main} ${ac_c_conftest_c99_main} return ok; } " # Test code for whether the C compiler supports C89 (complete). ac_c_conftest_c89_program="${ac_c_conftest_c89_globals} int main (int argc, char **argv) { int ok = 0; ${ac_c_conftest_c89_main} return ok; } " # Test code for whether the C++ compiler supports C++98 (global declarations) ac_cxx_conftest_cxx98_globals=' // Does the compiler advertise C++98 conformance? #if !defined __cplusplus || __cplusplus < 199711L # error "Compiler does not advertise C++98 conformance" #endif // These inclusions are to reject old compilers that // lack the unsuffixed header files. #include #include // and are *not* freestanding headers in C++98. extern void assert (int); namespace std { extern int strcmp (const char *, const char *); } // Namespaces, exceptions, and templates were all added after "C++ 2.0". using std::exception; using std::strcmp; namespace { void test_exception_syntax() { try { throw "test"; } catch (const char *s) { // Extra parentheses suppress a warning when building autoconf itself, // due to lint rules shared with more typical C programs. assert (!(strcmp) (s, "test")); } } template struct test_template { T const val; explicit test_template(T t) : val(t) {} template T add(U u) { return static_cast(u) + val; } }; } // anonymous namespace ' # Test code for whether the C++ compiler supports C++98 (body of main) ac_cxx_conftest_cxx98_main=' assert (argc); assert (! argv[0]); { test_exception_syntax (); test_template tt (2.0); assert (tt.add (4) == 6.0); assert (true && !false); } ' # Test code for whether the C++ compiler supports C++11 (global declarations) ac_cxx_conftest_cxx11_globals=' // Does the compiler advertise C++ 2011 conformance? #if !defined __cplusplus || __cplusplus < 201103L # error "Compiler does not advertise C++11 conformance" #endif namespace cxx11test { constexpr int get_val() { return 20; } struct testinit { int i; double d; }; class delegate { public: delegate(int n) : n(n) {} delegate(): delegate(2354) {} virtual int getval() { return this->n; }; protected: int n; }; class overridden : public delegate { public: overridden(int n): delegate(n) {} virtual int getval() override final { return this->n * 2; } }; class nocopy { public: nocopy(int i): i(i) {} nocopy() = default; nocopy(const nocopy&) = delete; nocopy & operator=(const nocopy&) = delete; private: int i; }; // for testing lambda expressions template Ret eval(Fn f, Ret v) { return f(v); } // for testing variadic templates and trailing return types template auto sum(V first) -> V { return first; } template auto sum(V first, Args... rest) -> V { return first + sum(rest...); } } ' # Test code for whether the C++ compiler supports C++11 (body of main) ac_cxx_conftest_cxx11_main=' { // Test auto and decltype auto a1 = 6538; auto a2 = 48573953.4; auto a3 = "String literal"; int total = 0; for (auto i = a3; *i; ++i) { total += *i; } decltype(a2) a4 = 34895.034; } { // Test constexpr short sa[cxx11test::get_val()] = { 0 }; } { // Test initializer lists cxx11test::testinit il = { 4323, 435234.23544 }; } { // Test range-based for int array[] = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; for (auto &x : array) { x += 23; } } { // Test lambda expressions using cxx11test::eval; assert (eval ([](int x) { return x*2; }, 21) == 42); double d = 2.0; assert (eval ([&](double x) { return d += x; }, 3.0) == 5.0); assert (d == 5.0); assert (eval ([=](double x) mutable { return d += x; }, 4.0) == 9.0); assert (d == 5.0); } { // Test use of variadic templates using cxx11test::sum; auto a = sum(1); auto b = sum(1, 2); auto c = sum(1.0, 2.0, 3.0); } { // Test constructor delegation cxx11test::delegate d1; cxx11test::delegate d2(); cxx11test::delegate d3(45); } { // Test override and final cxx11test::overridden o1(55464); } { // Test nullptr char *c = nullptr; } { // Test template brackets test_template<::test_template> v(test_template(12)); } { // Unicode literals char const *utf8 = u8"UTF-8 string \u2500"; char16_t const *utf16 = u"UTF-8 string \u2500"; char32_t const *utf32 = U"UTF-32 string \u2500"; } ' # Test code for whether the C compiler supports C++11 (complete). ac_cxx_conftest_cxx11_program="${ac_cxx_conftest_cxx98_globals} ${ac_cxx_conftest_cxx11_globals} int main (int argc, char **argv) { int ok = 0; ${ac_cxx_conftest_cxx98_main} ${ac_cxx_conftest_cxx11_main} return ok; } " # Test code for whether the C compiler supports C++98 (complete). ac_cxx_conftest_cxx98_program="${ac_cxx_conftest_cxx98_globals} int main (int argc, char **argv) { int ok = 0; ${ac_cxx_conftest_cxx98_main} return ok; } " as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H" as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H" as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H" as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H" as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H" as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H" as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H" as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H" as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H" as_fn_append ac_header_c_list " sys/time.h sys_time_h HAVE_SYS_TIME_H" # Auxiliary files required by this configure script. ac_aux_files="ltmain.sh compile config.guess config.sub missing install-sh" # Locations in which to look for auxiliary files. ac_aux_dir_candidates="${srcdir}/autoconf" # Search for a directory containing all of the required auxiliary files, # $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates. # If we don't find one directory that contains all the files we need, # we report the set of missing files from the *first* directory in # $ac_aux_dir_candidates and give up. ac_missing_aux_files="" ac_first_candidate=: printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in $ac_aux_dir_candidates do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac as_found=: printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5 ac_aux_dir_found=yes ac_install_sh= for ac_aux in $ac_aux_files do # As a special case, if "install-sh" is required, that requirement # can be satisfied by any of "install-sh", "install.sh", or "shtool", # and $ac_install_sh is set appropriately for whichever one is found. if test x"$ac_aux" = x"install-sh" then if test -f "${as_dir}install-sh"; then printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5 ac_install_sh="${as_dir}install-sh -c" elif test -f "${as_dir}install.sh"; then printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5 ac_install_sh="${as_dir}install.sh -c" elif test -f "${as_dir}shtool"; then printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5 ac_install_sh="${as_dir}shtool install -c" else ac_aux_dir_found=no if $ac_first_candidate; then ac_missing_aux_files="${ac_missing_aux_files} install-sh" else break fi fi else if test -f "${as_dir}${ac_aux}"; then printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5 else ac_aux_dir_found=no if $ac_first_candidate; then ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}" else break fi fi fi done if test "$ac_aux_dir_found" = yes; then ac_aux_dir="$as_dir" break fi ac_first_candidate=false as_found=false done IFS=$as_save_IFS if $as_found then : else $as_nop as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. if test -f "${ac_aux_dir}config.guess"; then ac_config_guess="$SHELL ${ac_aux_dir}config.guess" fi if test -f "${ac_aux_dir}config.sub"; then ac_config_sub="$SHELL ${ac_aux_dir}config.sub" fi if test -f "$ac_aux_dir/configure"; then ac_configure="$SHELL ${ac_aux_dir}configure" fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 printf "%s\n" "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 printf "%s\n" "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 printf "%s\n" "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 printf "%s\n" "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 printf "%s\n" "$as_me: former value: \`$ac_old_val'" >&2;} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 printf "%s\n" "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`${MAKE-make} distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_headers="$ac_config_headers config.h" am__api_version='1.16' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 printf %s "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if test ${ac_cv_path_install+y} then : printf %s "(cached) " >&6 else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac # Account for fact that we put trailing slashes in our PATH walk. case $as_dir in #(( ./ | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir/" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test ${ac_cv_path_install+y}; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 printf "%s\n" "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 printf %s "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi if test "$2" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi rm -f conftest.file test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`printf "%s\n" "$program_transform_name" | sed "$ac_script"` # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` if test x"${MISSING+set}" != xset; then MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 printf "%s\n" "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_STRIP+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 printf "%s\n" "$STRIP" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_STRIP+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 printf "%s\n" "$ac_ct_STRIP" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a race-free mkdir -p" >&5 printf %s "checking for a race-free mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if test ${ac_cv_path_mkdir+y} then : printf %s "(cached) " >&6 else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext" || continue case `"$as_dir$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir ('*'coreutils) '* | \ 'BusyBox '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test ${ac_cv_path_mkdir+y}; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 printf "%s\n" "$MKDIR_P" >&6; } for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_AWK+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 printf "%s\n" "$AWK" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$AWK" && break done { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 printf %s "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`printf "%s\n" "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval test \${ac_cv_prog_make_${ac_make}_set+y} then : printf %s "(cached) " >&6 else $as_nop cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } SET_MAKE= else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null # Check whether --enable-silent-rules was given. if test ${enable_silent_rules+y} then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 printf %s "checking whether $am_make supports nested variables... " >&6; } if test ${am_cv_make_support_nested_variables+y} then : printf %s "(cached) " >&6 else $as_nop if printf "%s\n" 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 printf "%s\n" "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='unuran' VERSION='1.11.0' printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h printf "%s\n" "#define VERSION \"$VERSION\"" >>confdefs.h # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # mkdir_p='$(MKDIR_P)' # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar pax cpio none' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' # Variables for tags utilities; see am/tags.am if test -z "$CTAGS"; then CTAGS=ctags fi if test -z "$ETAGS"; then ETAGS=etags fi if test -z "$CSCOPE"; then CSCOPE=cscope fi # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 fi fi UNURAN_LT_VERSION="16:1:0" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 printf %s "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } # Check whether --enable-maintainer-mode was given. if test ${enable_maintainer_mode+y} then : enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval else $as_nop USE_MAINTAINER_MODE=no fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 printf "%s\n" "$USE_MAINTAINER_MODE" >&6; } if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= fi MAINT=$MAINTAINER_MODE_TRUE # Make sure we can run config.sub. $SHELL "${ac_aux_dir}config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL ${ac_aux_dir}config.sub" "$LINENO" 5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 printf %s "checking build system type... " >&6; } if test ${ac_cv_build+y} then : printf %s "(cached) " >&6 else $as_nop ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "${ac_aux_dir}config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "${ac_aux_dir}config.sub" $ac_build_alias` || as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $ac_build_alias failed" "$LINENO" 5 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 printf "%s\n" "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 printf %s "checking host system type... " >&6; } if test ${ac_cv_host+y} then : printf %s "(cached) " >&6 else $as_nop if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "${ac_aux_dir}config.sub" $host_alias` || as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $host_alias failed" "$LINENO" 5 fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 printf "%s\n" "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 printf %s "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`printf "%s\n" "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval test \${ac_cv_prog_make_${ac_make}_set+y} then : printf %s "(cached) " >&6 else $as_nop cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } SET_MAKE= else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 printf "%s\n" "$ac_ct_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 printf "%s\n" "$ac_ct_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. set dummy ${ac_tool_prefix}clang; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}clang" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "clang", so it can be a program name with args. set dummy clang; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="clang" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 printf "%s\n" "$ac_ct_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi fi test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion -version; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 printf %s "checking whether the C compiler works... " >&6; } ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else $as_nop ac_file='' fi if test -z "$ac_file" then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 printf %s "checking for C compiler default output file name... " >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 printf "%s\n" "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 printf %s "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else $as_nop { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 printf "%s\n" "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 printf %s "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 printf "%s\n" "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 printf %s "checking for suffix of object files... " >&6; } if test ${ac_cv_objext+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 printf "%s\n" "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 printf %s "checking whether the compiler supports GNU C... " >&6; } if test ${ac_cv_c_compiler_gnu+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_compiler_gnu=yes else $as_nop ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } ac_compiler_gnu=$ac_cv_c_compiler_gnu if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+y} ac_save_CFLAGS=$CFLAGS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 printf %s "checking whether $CC accepts -g... " >&6; } if test ${ac_cv_prog_cc_g+y} then : printf %s "(cached) " >&6 else $as_nop ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_g=yes else $as_nop CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : else $as_nop ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 printf "%s\n" "$ac_cv_prog_cc_g" >&6; } if test $ac_test_CFLAGS; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi ac_prog_cc_stdc=no if test x$ac_prog_cc_stdc = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 printf %s "checking for $CC option to enable C11 features... " >&6; } if test ${ac_cv_prog_cc_c11+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cc_c11=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_c_conftest_c11_program _ACEOF for ac_arg in '' -std=gnu11 do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_c11=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c11" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi if test "x$ac_cv_prog_cc_c11" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cc_c11" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } CC="$CC $ac_cv_prog_cc_c11" fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 ac_prog_cc_stdc=c11 fi fi if test x$ac_prog_cc_stdc = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 printf %s "checking for $CC option to enable C99 features... " >&6; } if test ${ac_cv_prog_cc_c99+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cc_c99=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_c_conftest_c99_program _ACEOF for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_c99=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c99" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi if test "x$ac_cv_prog_cc_c99" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cc_c99" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } CC="$CC $ac_cv_prog_cc_c99" fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 ac_prog_cc_stdc=c99 fi fi if test x$ac_prog_cc_stdc = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 printf %s "checking for $CC option to enable C89 features... " >&6; } if test ${ac_cv_prog_cc_c89+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_c_conftest_c89_program _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi if test "x$ac_cv_prog_cc_c89" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cc_c89" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } CC="$CC $ac_cv_prog_cc_c89" fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 ac_prog_cc_stdc=c89 fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 printf %s "checking whether $CC understands -c and -o together... " >&6; } if test ${am_cv_prog_cc_c_o+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 printf "%s\n" "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 printf %s "checking whether ${MAKE-make} supports the include directive... " >&6; } cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out .PHONY: am__doit END am__include="#" am__quote= # BSD make does it like this. echo '.include "confinc.mk" # ignored' > confmf.BSD # Other make implementations (GNU, Solaris 10, AIX) do it like this. echo 'include confinc.mk # ignored' > confmf.GNU _am_result=no for s in GNU BSD; do { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5 (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } case $?:`cat confinc.out 2>/dev/null` in #( '0:this is the am__doit target') : case $s in #( BSD) : am__include='.include' am__quote='"' ;; #( *) : am__include='include' am__quote='' ;; esac ;; #( *) : ;; esac if test "$am__include" != "#"; then _am_result="yes ($s style)" break fi done rm -f confinc.* confmf.* { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 printf "%s\n" "${_am_result}" >&6; } # Check whether --enable-dependency-tracking was given. if test ${enable_dependency_tracking+y} then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 printf %s "checking dependency style of $depcc... " >&6; } if test ${am_cv_CC_dependencies_compiler_type+y} then : printf %s "(cached) " >&6 else $as_nop if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 printf "%s\n" "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CXX+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 printf "%s\n" "$CXX" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CXX+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 printf "%s\n" "$ac_ct_CXX" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$ac_ct_CXX" && break done if test "x$ac_ct_CXX" = x; then CXX="g++" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX fi fi fi fi # Provide some information about the compiler. printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C++" >&5 printf %s "checking whether the compiler supports GNU C++... " >&6; } if test ${ac_cv_cxx_compiler_gnu+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : ac_compiler_gnu=yes else $as_nop ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 printf "%s\n" "$ac_cv_cxx_compiler_gnu" >&6; } ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test $ac_compiler_gnu = yes; then GXX=yes else GXX= fi ac_test_CXXFLAGS=${CXXFLAGS+y} ac_save_CXXFLAGS=$CXXFLAGS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 printf %s "checking whether $CXX accepts -g... " >&6; } if test ${ac_cv_prog_cxx_g+y} then : printf %s "(cached) " >&6 else $as_nop ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : ac_cv_prog_cxx_g=yes else $as_nop CXXFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : else $as_nop ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : ac_cv_prog_cxx_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 printf "%s\n" "$ac_cv_prog_cxx_g" >&6; } if test $ac_test_CXXFLAGS; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi ac_prog_cxx_stdcxx=no if test x$ac_prog_cxx_stdcxx = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++11 features" >&5 printf %s "checking for $CXX option to enable C++11 features... " >&6; } if test ${ac_cv_prog_cxx_11+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cxx_11=no ac_save_CXX=$CXX cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_cxx_conftest_cxx11_program _ACEOF for ac_arg in '' -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x -qlanglvl=extended0x -AA do CXX="$ac_save_CXX $ac_arg" if ac_fn_cxx_try_compile "$LINENO" then : ac_cv_prog_cxx_cxx11=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cxx_cxx11" != "xno" && break done rm -f conftest.$ac_ext CXX=$ac_save_CXX fi if test "x$ac_cv_prog_cxx_cxx11" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cxx_cxx11" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx11" >&5 printf "%s\n" "$ac_cv_prog_cxx_cxx11" >&6; } CXX="$CXX $ac_cv_prog_cxx_cxx11" fi ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx11 ac_prog_cxx_stdcxx=cxx11 fi fi if test x$ac_prog_cxx_stdcxx = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++98 features" >&5 printf %s "checking for $CXX option to enable C++98 features... " >&6; } if test ${ac_cv_prog_cxx_98+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cxx_98=no ac_save_CXX=$CXX cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_cxx_conftest_cxx98_program _ACEOF for ac_arg in '' -std=gnu++98 -std=c++98 -qlanglvl=extended -AA do CXX="$ac_save_CXX $ac_arg" if ac_fn_cxx_try_compile "$LINENO" then : ac_cv_prog_cxx_cxx98=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cxx_cxx98" != "xno" && break done rm -f conftest.$ac_ext CXX=$ac_save_CXX fi if test "x$ac_cv_prog_cxx_cxx98" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cxx_cxx98" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx98" >&5 printf "%s\n" "$ac_cv_prog_cxx_cxx98" >&6; } CXX="$CXX $ac_cv_prog_cxx_cxx98" fi ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98 ac_prog_cxx_stdcxx=cxx98 fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CXX" am_compiler_list= { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 printf %s "checking dependency style of $depcc... " >&6; } if test ${am_cv_CXX_dependencies_compiler_type+y} then : printf %s "(cached) " >&6 else $as_nop if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CXX_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CXX_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CXX_dependencies_compiler_type=none fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 printf "%s\n" "$am_cv_CXX_dependencies_compiler_type" >&6; } CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then am__fastdepCXX_TRUE= am__fastdepCXX_FALSE='#' else am__fastdepCXX_TRUE='#' am__fastdepCXX_FALSE= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 printf %s "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test ${ac_cv_prog_CPP+y} then : printf %s "(cached) " >&6 else $as_nop # Double quotes because $CC needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" cpp /lib/cpp do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO" then : else $as_nop # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO" then : # Broken: success on invalid input. continue else $as_nop # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 printf "%s\n" "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO" then : else $as_nop # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO" then : # Broken: success on invalid input. continue else $as_nop # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok then : else $as_nop { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_RANLIB+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 printf "%s\n" "$RANLIB" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_RANLIB+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 printf "%s\n" "$ac_ct_RANLIB" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 printf %s "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 printf "%s\n" "no, using $LN_S" >&6; } fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_AR+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_AR="${ac_tool_prefix}ar" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 printf "%s\n" "$AR" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_AR"; then ac_ct_AR=$AR # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_AR+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="ar" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 printf "%s\n" "$ac_ct_AR" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_AR" = x; then AR=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi else AR="$ac_cv_prog_AR" fi case `pwd` in *\ * | *\ *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 printf "%s\n" "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; esac macro_version='2.4.7' macro_revision='2.4.7' ltmain=$ac_aux_dir/ltmain.sh # Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\(["`$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 printf %s "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "" } case $ECHO in printf*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: printf" >&5 printf "%s\n" "printf" >&6; } ;; print*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 printf "%s\n" "print -r" >&6; } ;; *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: cat" >&5 printf "%s\n" "cat" >&6; } ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 printf %s "checking for a sed that does not truncate output... " >&6; } if test ${ac_cv_path_SED+y} then : printf %s "(cached) " >&6 else $as_nop ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_prog in sed gsed do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_SED" || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 printf %s 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" printf "%s\n" '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 printf "%s\n" "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 printf %s "checking for grep that handles long lines and -e... " >&6; } if test ${ac_cv_path_GREP+y} then : printf %s "(cached) " >&6 else $as_nop if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_prog in grep ggrep do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 printf %s 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" printf "%s\n" 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 printf "%s\n" "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 printf %s "checking for egrep... " >&6; } if test ${ac_cv_path_EGREP+y} then : printf %s "(cached) " >&6 else $as_nop if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_prog in egrep do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 printf %s 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" printf "%s\n" 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 printf "%s\n" "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 printf %s "checking for fgrep... " >&6; } if test ${ac_cv_path_FGREP+y} then : printf %s "(cached) " >&6 else $as_nop if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else if test -z "$FGREP"; then ac_path_FGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_prog in fgrep do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_FGREP" || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in *GNU*) ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 printf %s 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" printf "%s\n" 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_FGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_FGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_FGREP"; then as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_FGREP=$FGREP fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 printf "%s\n" "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" test -z "$GREP" && GREP=grep # Check whether --with-gnu-ld was given. if test ${with_gnu_ld+y} then : withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes else $as_nop with_gnu_ld=no fi ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 printf %s "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return, which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD=$ac_prog ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test yes = "$with_gnu_ld"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 printf %s "checking for GNU ld... " >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 printf %s "checking for non-GNU ld... " >&6; } fi if test ${lt_cv_path_LD+y} then : printf %s "(cached) " >&6 else $as_nop if test -z "$LD"; then lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD=$ac_dir/$ac_prog # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 printf "%s\n" "$LD" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 printf %s "checking if the linker ($LD) is GNU ld... " >&6; } if test ${lt_cv_prog_gnu_ld+y} then : printf %s "(cached) " >&6 else $as_nop # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 printf "%s\n" "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 printf %s "checking for BSD- or MS-compatible name lister (nm)... " >&6; } if test ${lt_cv_path_NM+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM=$NM else lt_nm_to_check=${ac_tool_prefix}nm if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. tmp_nm=$ac_dir/$lt_tmp_nm if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then # Check to see if the nm accepts a BSD-compat flag. # Adding the 'sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty case $build_os in mingw*) lt_bad_file=conftest.nm/nofile ;; *) lt_bad_file=/dev/null ;; esac case `"$tmp_nm" -B $lt_bad_file 2>&1 | $SED '1q'` in *$lt_bad_file* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break 2 ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | $SED '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break 2 ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS=$lt_save_ifs done : ${lt_cv_path_NM=no} fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 printf "%s\n" "$lt_cv_path_NM" >&6; } if test no != "$lt_cv_path_NM"; then NM=$lt_cv_path_NM else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else if test -n "$ac_tool_prefix"; then for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_DUMPBIN+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 printf "%s\n" "$DUMPBIN" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$DUMPBIN" && break done fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_DUMPBIN+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 printf "%s\n" "$ac_ct_DUMPBIN" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$ac_ct_DUMPBIN" && break done if test "x$ac_ct_DUMPBIN" = x; then DUMPBIN=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN fi fi case `$DUMPBIN -symbols -headers /dev/null 2>&1 | $SED '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols -headers" ;; *) DUMPBIN=: ;; esac fi if test : != "$DUMPBIN"; then NM=$DUMPBIN fi fi test -z "$NM" && NM=nm { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 printf %s "checking the name lister ($NM) interface... " >&6; } if test ${lt_cv_nm_interface+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 printf "%s\n" "$lt_cv_nm_interface" >&6; } # find the maximum length of command line arguments { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 printf %s "checking the maximum length of command line arguments... " >&6; } if test ${lt_cv_sys_max_cmd_len+y} then : printf %s "(cached) " >&6 else $as_nop i=0 teststring=ABCD case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; bitrig* | darwin* | dragonfly* | freebsd* | midnightbsd* | netbsd* | openbsd*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | $SED 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len" && \ test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test X`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test 17 != "$i" # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac fi if test -n "$lt_cv_sys_max_cmd_len"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 printf "%s\n" "$lt_cv_sys_max_cmd_len" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none" >&5 printf "%s\n" "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len : ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 printf %s "checking how to convert $build file names to $host format... " >&6; } if test ${lt_cv_to_host_file_cmd+y} then : printf %s "(cached) " >&6 else $as_nop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac fi to_host_file_cmd=$lt_cv_to_host_file_cmd { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 printf "%s\n" "$lt_cv_to_host_file_cmd" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 printf %s "checking how to convert $build file names to toolchain format... " >&6; } if test ${lt_cv_to_tool_file_cmd+y} then : printf %s "(cached) " >&6 else $as_nop #assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac fi to_tool_file_cmd=$lt_cv_to_tool_file_cmd { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 printf "%s\n" "$lt_cv_to_tool_file_cmd" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 printf %s "checking for $LD option to reload object files... " >&6; } if test ${lt_cv_ld_reload_flag+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_ld_reload_flag='-r' fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 printf "%s\n" "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in cygwin* | mingw* | pw32* | cegcc*) if test yes != "$GCC"; then reload_cmds=false fi ;; darwin*) if test yes = "$GCC"; then reload_cmds='$LTCC $LTCFLAGS -nostdlib $wl-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}file", so it can be a program name with args. set dummy ${ac_tool_prefix}file; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_FILECMD+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$FILECMD"; then ac_cv_prog_FILECMD="$FILECMD" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_FILECMD="${ac_tool_prefix}file" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi FILECMD=$ac_cv_prog_FILECMD if test -n "$FILECMD"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $FILECMD" >&5 printf "%s\n" "$FILECMD" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_FILECMD"; then ac_ct_FILECMD=$FILECMD # Extract the first word of "file", so it can be a program name with args. set dummy file; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_FILECMD+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_FILECMD"; then ac_cv_prog_ac_ct_FILECMD="$ac_ct_FILECMD" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_FILECMD="file" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_FILECMD=$ac_cv_prog_ac_ct_FILECMD if test -n "$ac_ct_FILECMD"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_FILECMD" >&5 printf "%s\n" "$ac_ct_FILECMD" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_FILECMD" = x; then FILECMD=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac FILECMD=$ac_ct_FILECMD fi else FILECMD="$ac_cv_prog_FILECMD" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_OBJDUMP+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 printf "%s\n" "$OBJDUMP" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_OBJDUMP+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 printf "%s\n" "$ac_ct_OBJDUMP" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi test -z "$OBJDUMP" && OBJDUMP=objdump { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 printf %s "checking how to recognize dependent libraries... " >&6; } if test ${lt_cv_deplibs_check_method+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # 'unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # that responds to the $file_magic_cmd with a given extended regex. # If you have 'file' or equivalent on your system and you're not sure # whether 'pass_all' will *always* work, you probably want this one. case $host_os in aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='$FILECMD -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. if ( file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly* | midnightbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=$FILECMD lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=$FILECMD case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[3-9]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=$FILECMD lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd* | bitrig*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; os2*) lt_cv_deplibs_check_method=pass_all ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 printf "%s\n" "$lt_cv_deplibs_check_method" >&6; } file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_DLLTOOL+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 printf "%s\n" "$DLLTOOL" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_DLLTOOL+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 printf "%s\n" "$ac_ct_DLLTOOL" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi test -z "$DLLTOOL" && DLLTOOL=dlltool { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 printf %s "checking how to associate runtime and link libraries... " >&6; } if test ${lt_cv_sharedlib_from_linklib_cmd+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh; # decide which one to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd=$ECHO ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 printf "%s\n" "$lt_cv_sharedlib_from_linklib_cmd" >&6; } sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO if test -n "$ac_tool_prefix"; then for ac_prog in ar do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_AR+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 printf "%s\n" "$AR" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$AR" && break done fi if test -z "$AR"; then ac_ct_AR=$AR for ac_prog in ar do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_AR+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 printf "%s\n" "$ac_ct_AR" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$ac_ct_AR" && break done if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi fi : ${AR=ar} # Use ARFLAGS variable as AR's operation code to sync the variable naming with # Automake. If both AR_FLAGS and ARFLAGS are specified, AR_FLAGS should have # higher priority because thats what people were doing historically (setting # ARFLAGS for automake and AR_FLAGS for libtool). FIXME: Make the AR_FLAGS # variable obsoleted/removed. test ${AR_FLAGS+y} || AR_FLAGS=${ARFLAGS-cr} lt_ar_flags=$AR_FLAGS # Make AR_FLAGS overridable by 'make ARFLAGS='. Don't try to run-time override # by AR_FLAGS because that was never working and AR_FLAGS is about to die. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 printf %s "checking for archiver @FILE support... " >&6; } if test ${lt_cv_ar_at_file+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_ar_at_file=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test 0 -eq "$ac_status"; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test 0 -ne "$ac_status"; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 printf "%s\n" "$lt_cv_ar_at_file" >&6; } if test no = "$lt_cv_ar_at_file"; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_STRIP+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 printf "%s\n" "$STRIP" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_STRIP+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 printf "%s\n" "$ac_ct_STRIP" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi test -z "$STRIP" && STRIP=: if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_RANLIB+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 printf "%s\n" "$RANLIB" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_RANLIB+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 printf "%s\n" "$ac_ct_RANLIB" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi test -z "$RANLIB" && RANLIB=: # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in bitrig* | openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 printf %s "checking command to parse $NM output from $compiler object... " >&6; } if test ${lt_cv_sys_global_symbol_pipe+y} then : printf %s "(cached) " >&6 else $as_nop # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[ABCDGISTW]' ;; hpux*) if test ia64 = "$host_cpu"; then symcode='[ABCDEGRST]' fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Gets list of data symbols to import. lt_cv_sys_global_symbol_to_import="$SED -n -e 's/^I .* \(.*\)$/\1/p'" # Adjust the below global symbol transforms to fixup imported variables. lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" lt_c_name_lib_hook="\ -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" else # Disable hooks by default. lt_cv_sys_global_symbol_to_import= lt_cdecl_hook= lt_c_name_hook= lt_c_name_lib_hook= fi # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="$SED -n"\ $lt_cdecl_hook\ " -e 's/^T .* \(.*\)$/extern int \1();/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="$SED -n"\ $lt_c_name_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" # Transform an extracted symbol line into symbol name with lib prefix and # symbol address. lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="$SED -n"\ $lt_c_name_lib_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function, # D for any global variable and I for any imported variable. # Also find C++ and __fastcall symbols from MSVC++ or ICC, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ " /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ " /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ " {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ " s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx" else lt_cv_sys_global_symbol_pipe="$SED -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | $SED '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS=conftstm.$ac_objext CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test yes = "$pipe_works"; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: failed" >&5 printf "%s\n" "failed" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ok" >&5 printf "%s\n" "ok" >&6; } fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then nm_file_list_spec='@' fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 printf %s "checking for sysroot... " >&6; } # Check whether --with-sysroot was given. if test ${with_sysroot+y} then : withval=$with_sysroot; else $as_nop with_sysroot=no fi lt_sysroot= case $with_sysroot in #( yes) if test yes = "$GCC"; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | $SED -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $with_sysroot" >&5 printf "%s\n" "$with_sysroot" >&6; } as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 printf "%s\n" "${lt_sysroot:-no}" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5 printf %s "checking for a working dd... " >&6; } if test ${ac_cv_path_lt_DD+y} then : printf %s "(cached) " >&6 else $as_nop printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i : ${lt_DD:=$DD} if test -z "$lt_DD"; then ac_path_lt_DD_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_prog in dd do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_lt_DD="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_lt_DD" || continue if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: fi $ac_path_lt_DD_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_lt_DD"; then : fi else ac_cv_path_lt_DD=$lt_DD fi rm -f conftest.i conftest2.i conftest.out fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5 printf "%s\n" "$ac_cv_path_lt_DD" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5 printf %s "checking how to truncate binary pipes... " >&6; } if test ${lt_cv_truncate_bin+y} then : printf %s "(cached) " >&6 else $as_nop printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i lt_cv_truncate_bin= if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" fi rm -f conftest.i conftest2.i conftest.out test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5 printf "%s\n" "$lt_cv_truncate_bin" >&6; } # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in $*""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } # Check whether --enable-libtool-lock was given. if test ${enable_libtool_lock+y} then : enableval=$enable_libtool_lock; fi test no = "$enable_libtool_lock" || enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out what ABI is being produced by ac_compile, and set mode # options accordingly. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `$FILECMD conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE=32 ;; *ELF-64*) HPUX_IA64_MODE=64 ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test yes = "$lt_cv_prog_gnu_ld"; then case `$FILECMD conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `$FILECMD conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; mips64*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then emul=elf case `$FILECMD conftest.$ac_objext` in *32-bit*) emul="${emul}32" ;; *64-bit*) emul="${emul}64" ;; esac case `$FILECMD conftest.$ac_objext` in *MSB*) emul="${emul}btsmip" ;; *LSB*) emul="${emul}ltsmip" ;; esac case `$FILECMD conftest.$ac_objext` in *N32*) emul="${emul}n32" ;; esac LD="${LD-ld} -m $emul" fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. Note that the listed cases only cover the # situations where additional linker options are needed (such as when # doing 32-bit compilation for a host where ld defaults to 64-bit, or # vice versa); the common cases where no linker options are needed do # not appear in the list. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `$FILECMD conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) case `$FILECMD conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; *) LD="${LD-ld} -m elf_i386" ;; esac ;; powerpc64le-*linux*) LD="${LD-ld} -m elf32lppclinux" ;; powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; powerpcle-*linux*|powerpc64le-*linux*) LD="${LD-ld} -m elf64lppc" ;; powerpc-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -belf" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 printf %s "checking whether the C compiler needs -belf... " >&6; } if test ${lt_cv_cc_needs_belf+y} then : printf %s "(cached) " >&6 else $as_nop ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : lt_cv_cc_needs_belf=yes else $as_nop lt_cv_cc_needs_belf=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 printf "%s\n" "$lt_cv_cc_needs_belf" >&6; } if test yes != "$lt_cv_cc_needs_belf"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS=$SAVE_CFLAGS fi ;; *-*solaris*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `$FILECMD conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*|x86_64-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD=${LD-ld}_sol2 fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks=$enable_libtool_lock if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. set dummy ${ac_tool_prefix}mt; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_MANIFEST_TOOL+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$MANIFEST_TOOL"; then ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL if test -n "$MANIFEST_TOOL"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 printf "%s\n" "$MANIFEST_TOOL" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_MANIFEST_TOOL"; then ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL # Extract the first word of "mt", so it can be a program name with args. set dummy mt; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_MANIFEST_TOOL+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_MANIFEST_TOOL"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL if test -n "$ac_ct_MANIFEST_TOOL"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 printf "%s\n" "$ac_ct_MANIFEST_TOOL" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_MANIFEST_TOOL" = x; then MANIFEST_TOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL fi else MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" fi test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 printf %s "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } if test ${lt_cv_path_mainfest_tool+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&5 if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 printf "%s\n" "$lt_cv_path_mainfest_tool" >&6; } if test yes != "$lt_cv_path_mainfest_tool"; then MANIFEST_TOOL=: fi case $host_os in rhapsody* | darwin*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_DSYMUTIL+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 printf "%s\n" "$DSYMUTIL" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_DSYMUTIL+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 printf "%s\n" "$ac_ct_DSYMUTIL" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then DSYMUTIL=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL fi else DSYMUTIL="$ac_cv_prog_DSYMUTIL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_NMEDIT+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 printf "%s\n" "$NMEDIT" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_NMEDIT+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_NMEDIT="nmedit" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 printf "%s\n" "$ac_ct_NMEDIT" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then NMEDIT=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT fi else NMEDIT="$ac_cv_prog_NMEDIT" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_LIPO+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 printf "%s\n" "$LIPO" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_LIPO"; then ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_LIPO+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_LIPO="lipo" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 printf "%s\n" "$ac_ct_LIPO" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then LIPO=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac LIPO=$ac_ct_LIPO fi else LIPO="$ac_cv_prog_LIPO" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_OTOOL+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 printf "%s\n" "$OTOOL" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL"; then ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_OTOOL+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL="otool" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 printf "%s\n" "$ac_ct_OTOOL" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then OTOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL=$ac_ct_OTOOL fi else OTOOL="$ac_cv_prog_OTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_OTOOL64+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 printf "%s\n" "$OTOOL64" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL64"; then ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_OTOOL64+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL64="otool64" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 printf "%s\n" "$ac_ct_OTOOL64" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then OTOOL64=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 fi else OTOOL64="$ac_cv_prog_OTOOL64" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 printf %s "checking for -single_module linker flag... " >&6; } if test ${lt_cv_apple_cc_single_mod+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_apple_cc_single_mod=no if test -z "$LT_MULTI_MODULE"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&5 $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&5 # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test 0 = "$_lt_result"; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&5 fi rm -rf libconftest.dylib* rm -f conftest.* fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 printf "%s\n" "$lt_cv_apple_cc_single_mod" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 printf %s "checking for -exported_symbols_list linker flag... " >&6; } if test ${lt_cv_ld_exported_symbols_list+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : lt_cv_ld_exported_symbols_list=yes else $as_nop lt_cv_ld_exported_symbols_list=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 printf "%s\n" "$lt_cv_ld_exported_symbols_list" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 printf %s "checking for -force_load linker flag... " >&6; } if test ${lt_cv_ld_force_load+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 echo "$AR $AR_FLAGS libconftest.a conftest.o" >&5 $AR $AR_FLAGS libconftest.a conftest.o 2>&5 echo "$RANLIB libconftest.a" >&5 $RANLIB libconftest.a 2>&5 cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&5 elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then lt_cv_ld_force_load=yes else cat conftest.err >&5 fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 printf "%s\n" "$lt_cv_ld_force_load" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; darwin*) case $MACOSX_DEPLOYMENT_TARGET,$host in 10.[012],*|,*powerpc*-darwin[5-8]*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; *) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test yes = "$lt_cv_apple_cc_single_mod"; then _lt_dar_single_mod='$single_module' fi if test yes = "$lt_cv_ld_exported_symbols_list"; then _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' fi if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac # func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x$2 in x) ;; *:) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" ;; x:*) eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" ;; *::*) eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" ;; *) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" ;; esac } ac_header= ac_cache= for ac_item in $ac_header_c_list do if test $ac_cache; then ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default" if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then printf "%s\n" "#define $ac_item 1" >> confdefs.h fi ac_header= ac_cache= elif test $ac_header; then ac_cache=$ac_item else ac_header=$ac_item fi done if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes then : printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " if test "x$ac_cv_header_dlfcn_h" = xyes then : printf "%s\n" "#define HAVE_DLFCN_H 1" >>confdefs.h fi func_stripname_cnf () { case $2 in .*) func_stripname_result=`$ECHO "$3" | $SED "s%^$1%%; s%\\\\$2\$%%"`;; *) func_stripname_result=`$ECHO "$3" | $SED "s%^$1%%; s%$2\$%%"`;; esac } # func_stripname_cnf # Set options # Check whether --enable-shared was given. if test ${enable_shared+y} then : enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS=$lt_save_ifs ;; esac else $as_nop enable_shared=no fi enable_dlopen=no enable_win32_dll=no # Check whether --enable-static was given. if test ${enable_static+y} then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS=$lt_save_ifs ;; esac else $as_nop enable_static=yes fi # Check whether --with-pic was given. if test ${with_pic+y} then : withval=$with_pic; lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for lt_pkg in $withval; do IFS=$lt_save_ifs if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS=$lt_save_ifs ;; esac else $as_nop pic_mode=default fi # Check whether --enable-fast-install was given. if test ${enable_fast_install+y} then : enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS=$lt_save_ifs ;; esac else $as_nop enable_fast_install=yes fi shared_archive_member_spec= case $host,$enable_shared in power*-*-aix[5-9]*,yes) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5 printf %s "checking which variant of shared library versioning to provide... " >&6; } # Check whether --with-aix-soname was given. if test ${with_aix_soname+y} then : withval=$with_aix_soname; case $withval in aix|svr4|both) ;; *) as_fn_error $? "Unknown argument to --with-aix-soname" "$LINENO" 5 ;; esac lt_cv_with_aix_soname=$with_aix_soname else $as_nop if test ${lt_cv_with_aix_soname+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_with_aix_soname=aix fi with_aix_soname=$lt_cv_with_aix_soname fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5 printf "%s\n" "$with_aix_soname" >&6; } if test aix != "$with_aix_soname"; then # For the AIX way of multilib, we name the shared archive member # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, # the AIX toolchain works better with OBJECT_MODE set (default 32). if test 64 = "${OBJECT_MODE-32}"; then shared_archive_member_spec=shr_64 else shared_archive_member_spec=shr fi fi ;; *) with_aix_soname=aix ;; esac # This can be used to rebuild libtool when needed LIBTOOL_DEPS=$ltmain # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' test -z "$LN_S" && LN_S="ln -s" if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 printf %s "checking for objdir... " >&6; } if test ${lt_cv_objdir+y} then : printf %s "(cached) " >&6 else $as_nop rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 printf "%s\n" "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir printf "%s\n" "#define LT_OBJDIR \"$lt_cv_objdir/\"" >>confdefs.h case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a '.a' archive for static linking (except MSVC and # ICC, which need '.lib'). libext=a with_gnu_ld=$lt_cv_prog_gnu_ld old_CC=$CC old_CFLAGS=$CFLAGS # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o func_cc_basename $compiler cc_basename=$func_cc_basename_result # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 printf %s "checking for ${ac_tool_prefix}file... " >&6; } if test ${lt_cv_path_MAGIC_CMD+y} then : printf %s "(cached) " >&6 else $as_nop case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/${ac_tool_prefix}file"; then lt_cv_path_MAGIC_CMD=$ac_dir/"${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac fi MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 printf "%s\n" "$MAGIC_CMD" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for file" >&5 printf %s "checking for file... " >&6; } if test ${lt_cv_path_MAGIC_CMD+y} then : printf %s "(cached) " >&6 else $as_nop case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/file"; then lt_cv_path_MAGIC_CMD=$ac_dir/"file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac fi MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 printf "%s\n" "$MAGIC_CMD" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi else MAGIC_CMD=: fi fi fi ;; esac # Use C for the default configuration in the libtool script lt_save_CC=$CC ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= if test yes = "$GCC"; then case $cc_basename in nvcc*) lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; *) lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 printf %s "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } if test ${lt_cv_prog_compiler_rtti_exceptions+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $RM conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 printf "%s\n" "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test yes = "$lt_cv_prog_compiler_rtti_exceptions"; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= if test yes = "$GCC"; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi lt_prog_compiler_pic='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' case $host_os in os2*) lt_prog_compiler_static='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; *) lt_prog_compiler_pic='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 lt_prog_compiler_wl='-Xlinker ' if test -n "$lt_prog_compiler_pic"; then lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' case $cc_basename in nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; esac ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' case $host_os in os2*) lt_prog_compiler_static='$wl-static' ;; esac ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='$wl-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64, which still supported -KPIC. ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # Lahey Fortran 8.1. lf95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; tcc*) # Fabrice Bellard et al's Tiny C Compiler lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-qstaticlink' ;; *) case `$CC -V 2>&1 | $SED 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='' ;; *Sun\ F* | *Sun*Fortran*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; *Intel*\ [CF]*Compiler*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; *Portland\ Group*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; esac ;; esac ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; rdos*) lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi case $host_os in # For platforms that do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 printf %s "checking for $compiler option to produce PIC... " >&6; } if test ${lt_cv_prog_compiler_pic+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 printf "%s\n" "$lt_cv_prog_compiler_pic" >&6; } lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 printf %s "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } if test ${lt_cv_prog_compiler_pic_works+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works=yes fi fi $RM conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 printf "%s\n" "$lt_cv_prog_compiler_pic_works" >&6; } if test yes = "$lt_cv_prog_compiler_pic_works"; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 printf %s "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if test ${lt_cv_prog_compiler_static_works+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler_static_works=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes fi else lt_cv_prog_compiler_static_works=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 printf "%s\n" "$lt_cv_prog_compiler_static_works" >&6; } if test yes = "$lt_cv_prog_compiler_static_works"; then : else lt_prog_compiler_static= fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if test ${lt_cv_prog_compiler_c_o+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 printf "%s\n" "$lt_cv_prog_compiler_c_o" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if test ${lt_cv_prog_compiler_c_o+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 printf "%s\n" "$lt_cv_prog_compiler_c_o" >&6; } hard_links=nottested if test no = "$lt_cv_prog_compiler_c_o" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 printf %s "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 printf "%s\n" "$hard_links" >&6; } if test no = "$hard_links"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 printf "%s\n" "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 printf %s "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= always_export_symbols=no archive_cmds= archive_expsym_cmds= compiler_needs_object=no enable_shared_with_static_runtimes=no export_dynamic_flag_spec= export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' hardcode_automatic=no hardcode_direct=no hardcode_direct_absolute=no hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_minus_L=no hardcode_shlibpath_var=unsupported inherit_rpath=no link_all_deplibs=unknown module_cmds= module_expsym_cmds= old_archive_from_new_cmds= old_archive_from_expsyms_cmds= thread_safe_flag_spec= whole_archive_flag_spec= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ' (' and ')$', so one must not match beginning or # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', # as well as any symbol that contains 'd'. exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ and ICC port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++ or Intel C++ Compiler. if test yes != "$GCC"; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++ or ICC) with_gnu_ld=yes ;; openbsd* | bitrig*) with_gnu_ld=no ;; esac ld_shlibs=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test yes = "$with_gnu_ld"; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; *\ \(GNU\ Binutils\)\ [3-9]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test yes = "$lt_use_gnu_ld_interface"; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='$wl' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' export_dynamic_flag_spec='$wl--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v | $SED -e 's/([^)]\+)\s\+//' 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test ia64 != "$host_cpu"; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' export_dynamic_flag_spec='$wl--export-all-symbols' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; haiku*) archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' link_all_deplibs=yes ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported shrext_cmds=.dll archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=yes file_list_spec='@' ;; interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='$wl-rpath,$libdir' export_dynamic_flag_spec='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='$SED "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test linux-dietlibc = "$host_os"; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test no = "$tmp_diet" then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; nagfor*) # NAGFOR 5.3 tmp_sharedflag='-Wl,-shared' ;; xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object=yes ;; esac case `$CC -V 2>&1 | $SED 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi case $cc_basename in tcc*) export_dynamic_flag_spec='-rdynamic' ;; xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else ld_shlibs=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test no = "$ld_shlibs"; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then aix_use_runtimelinking=yes break fi done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes file_list_spec='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # traditional, no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. hardcode_direct=no hardcode_direct_absolute=no ;; esac if test yes = "$GCC"; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag="$shared_flag "'$wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi export_dynamic_flag_spec='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if test ${lt_cv_aix_libpath_+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then hardcode_libdir_flag_spec='$wl-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if test ${lt_cv_aix_libpath_+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' $wl-bernotok' allow_undefined_flag=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' fi archive_cmds_need_lc=yes archive_expsym_cmds='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols archive_expsym_cmds="$archive_expsym_cmds"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi archive_expsym_cmds="$archive_expsym_cmds"'~$RM -r $output_objdir/$realname.d' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++ or Intel C++ Compiler. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl* | icl*) # Native MSVC or ICC hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported always_export_symbols=yes file_list_spec='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, )='true' enable_shared_with_static_runtimes=yes exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib old_postinstall_cmds='chmod 644 $oldlib' postlink_cmds='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC and ICC wrapper hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' enable_shared_with_static_runtimes=yes ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported if test yes = "$lt_cv_ld_force_load"; then whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec='' fi link_all_deplibs=yes allow_undefined_flag=$_lt_dar_allow_undefined case $cc_basename in ifort*|nagfor*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test yes = "$_lt_dar_can_shared"; then output_verbose_link_cmd=func_echo_all archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" archive_expsym_cmds="$SED 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" module_expsym_cmds="$SED -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" else ld_shlibs=no fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly* | midnightbsd*) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test yes = "$GCC"; then archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='$wl-E' ;; hpux10*) if test yes,no = "$GCC,$with_gnu_ld"; then archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test no = "$with_gnu_ld"; then hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test yes,no = "$GCC,$with_gnu_ld"; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 printf %s "checking if $CC understands -b... " >&6; } if test ${lt_cv_prog_compiler__b+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler__b=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -b" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler__b=yes fi else lt_cv_prog_compiler__b=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 printf "%s\n" "$lt_cv_prog_compiler__b" >&6; } if test yes = "$lt_cv_prog_compiler__b"; then archive_cmds='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi ;; esac fi if test no = "$with_gnu_ld"; then hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test yes = "$GCC"; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 printf %s "checking whether the $host_os linker accepts -exported_symbol... " >&6; } if test ${lt_cv_irix_exported_symbol+y} then : printf %s "(cached) " >&6 else $as_nop save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo (void) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : lt_cv_irix_exported_symbol=yes else $as_nop lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 printf "%s\n" "$lt_cv_irix_exported_symbol" >&6; } if test yes = "$lt_cv_irix_exported_symbol"; then archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' fi else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: inherit_rpath=yes link_all_deplibs=yes ;; linux*) case $cc_basename in tcc*) # Fabrice Bellard et al's Tiny C Compiler ld_shlibs=yes archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; *nto* | *qnx*) ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no hardcode_direct_absolute=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='$wl-rpath,$libdir' export_dynamic_flag_spec='$wl-E' else archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='$wl-rpath,$libdir' fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported shrext_cmds=.dll archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=yes file_list_spec='@' ;; osf3*) if test yes = "$GCC"; then allow_undefined_flag=' $wl-expect_unresolved $wl\*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test yes = "$GCC"; then allow_undefined_flag=' $wl-expect_unresolved $wl\*' archive_cmds='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi archive_cmds_need_lc='no' hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z defs' if test yes = "$GCC"; then wlarc='$wl' archive_cmds='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' archive_cmds='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='$wl' archive_cmds='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. GCC discards it without '$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test yes = "$GCC"; then whole_archive_flag_spec='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs=yes ;; sunos4*) if test sequent = "$host_vendor"; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='$wl-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='$wl-z,text' allow_undefined_flag='$wl-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='$wl-R,$libdir' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='$wl-Bexport' runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac if test sni = "$host_vendor"; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) export_dynamic_flag_spec='$wl-Blargedynsym' ;; esac fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 printf "%s\n" "$ld_shlibs" >&6; } test no = "$ld_shlibs" && can_build_shared=no with_gnu_ld=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test yes,yes = "$GCC,$enable_shared"; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 printf %s "checking whether -lc should be explicitly linked in... " >&6; } if test ${lt_cv_archive_cmds_need_lc+y} then : printf %s "(cached) " >&6 else $as_nop $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc=no else lt_cv_archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 printf "%s\n" "$lt_cv_archive_cmds_need_lc" >&6; } archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac fi ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 printf %s "checking dynamic linker characteristics... " >&6; } if test yes = "$GCC"; then case $host_os in darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; *) lt_awk_arg='/^libraries:/' ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq='s|=\([A-Za-z]:\)|\1|g' ;; *) lt_sed_strip_eq='s|=/|/|g' ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary... lt_tmp_lt_search_path_spec= lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` # ...but if some path component already ends with the multilib dir we assume # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). case "$lt_multi_os_dir; $lt_search_path_spec " in "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) lt_multi_os_dir= ;; esac for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" elif test -n "$lt_multi_os_dir"; then test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS = " "; FS = "/|\n";} { lt_foo = ""; lt_count = 0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo = "/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's|/\([A-Za-z]:\)|\1|g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=.so postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='$libname$release$shared_ext$major' ;; aix[4-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test ia64 = "$host_cpu"; then # AIX 5 supports IA64 library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line '#! .'. This would cause the generated library to # depend on '.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # Using Import Files as archive members, it is possible to support # filename-based versioning of shared library archives on AIX. While # this would work for both with and without runtime linking, it will # prevent static linking of such archives. So we do filename-based # shared library versioning with .so extension only, which is used # when both runtime linking and shared linking is enabled. # Unfortunately, runtime linking may impact performance, so we do # not want this to be the default eventually. Also, we use the # versioned .so libs for executables only if there is the -brtl # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. # To allow for filename-based versioning support, we need to create # libNAME.so.V as an archive file, containing: # *) an Import File, referring to the versioned filename of the # archive as well as the shared archive member, telling the # bitwidth (32 or 64) of that shared object, and providing the # list of exported symbols of that shared object, eventually # decorated with the 'weak' keyword # *) the shared object with the F_LOADONLY flag set, to really avoid # it being seen by the linker. # At run time we better use the real file rather than another symlink, # but for link time we create the symlink libNAME.so -> libNAME.so.V case $with_aix_soname,$aix_use_runtimelinking in # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. aix,yes) # traditional libtool dynamic_linker='AIX unversionable lib.so' # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; aix,no) # traditional AIX only dynamic_linker='AIX lib.a(lib.so.V)' # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' ;; svr4,*) # full svr4 only dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,yes) # both, prefer svr4 dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # unpreferred sharedlib libNAME.a needs extra handling postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,no) # both, prefer aix dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' ;; esac shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='$libname$shared_ext' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo $libname | $SED -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo $libname | $SED -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl* | *,icl*) # Native MSVC or ICC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec=$LIB if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC and ICC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='$libname$release$versuffix$shared_ext $libname$release$major$shared_ext $libname$shared_ext' soname_spec='$libname$release$major$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .bundle || echo .dylib`' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly* | midnightbsd*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi # Handle Gentoo/FreeBSD as it was Linux case $host_vendor in gentoo) version_type=linux ;; *) version_type=freebsd-$objformat ;; esac case $version_type in freebsd-elf*) library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' need_version=yes ;; linux) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' need_lib_prefix=no need_version=no ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=no sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' if test 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test yes = "$lt_cv_prog_gnu_ld"; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; linux*android*) version_type=none # Android doesn't support versioned libraries. need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext' soname_spec='$libname$release$shared_ext' finish_cmds= shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes dynamic_linker='Android linker' # Don't embed -rpath directories since the linker doesn't support them. hardcode_libdir_flag_spec='-L$libdir' ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if test ${lt_cv_shlibpath_overrides_runpath+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, # even though it is searched at run-time. Try to do the best guess by # appending ld.so.conf contents (and includes) to the search path. if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd* | bitrig*) version_type=sunos sys_lib_dlsearch_path_spec=/usr/lib need_lib_prefix=no if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then need_version=no else need_version=yes fi library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; os2*) libname_spec='$name' version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no # OS/2 can only load a DLL with a base name of 8 characters or less. soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; v=$($ECHO $release$versuffix | tr -d .-); n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); $ECHO $n$v`$shared_ext' library_names_spec='${libname}_dll.$libext' dynamic_linker='OS/2 ld.exe' shlibpath_var=BEGINLIBPATH sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test yes = "$with_gnu_ld"; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec; then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' soname_spec='$libname$shared_ext.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=sco need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test yes = "$with_gnu_ld"; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 printf "%s\n" "$dynamic_linker" >&6; } test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test yes = "$GCC"; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec fi if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec fi # remember unaugmented sys_lib_dlsearch_path content for libtool script decls... configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec # ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" # to be used as default LT_SYS_LIBRARY_PATH value in generated libtool configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 printf %s "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || test yes = "$hardcode_automatic"; then # We can hardcode non-existent directories. if test no != "$hardcode_direct" && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, )" && test no != "$hardcode_minus_L"; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 printf "%s\n" "$hardcode_action" >&6; } if test relink = "$hardcode_action" || test yes = "$inherit_rpath"; then # Fast installation is not supported enable_fast_install=no elif test yes = "$shlibpath_overrides_runpath" || test no = "$enable_shared"; then # Fast installation is not necessary enable_fast_install=needless fi if test yes != "$enable_dlopen"; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen=load_add_on lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen=LoadLibrary lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen=dlopen lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 printf %s "checking for dlopen in -ldl... " >&6; } if test ${ac_cv_lib_dl_dlopen+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. The 'extern "C"' is for builds by C++ compilers; although this is not generally supported in C code supporting it here has little cost and some practical benefit (sr 110532). */ #ifdef __cplusplus extern "C" #endif char dlopen (void); int main (void) { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_dl_dlopen=yes else $as_nop ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 printf "%s\n" "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl else $as_nop lt_cv_dlopen=dyld lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; tpf*) # Don't try to run any link tests for TPF. We know it's impossible # because TPF is a cross-compiler, and we know how we open DSOs. lt_cv_dlopen=dlopen lt_cv_dlopen_libs= lt_cv_dlopen_self=no ;; *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" if test "x$ac_cv_func_shl_load" = xyes then : lt_cv_dlopen=shl_load else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 printf %s "checking for shl_load in -ldld... " >&6; } if test ${ac_cv_lib_dld_shl_load+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. The 'extern "C"' is for builds by C++ compilers; although this is not generally supported in C code supporting it here has little cost and some practical benefit (sr 110532). */ #ifdef __cplusplus extern "C" #endif char shl_load (void); int main (void) { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_dld_shl_load=yes else $as_nop ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 printf "%s\n" "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = xyes then : lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld else $as_nop ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = xyes then : lt_cv_dlopen=dlopen else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 printf %s "checking for dlopen in -ldl... " >&6; } if test ${ac_cv_lib_dl_dlopen+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. The 'extern "C"' is for builds by C++ compilers; although this is not generally supported in C code supporting it here has little cost and some practical benefit (sr 110532). */ #ifdef __cplusplus extern "C" #endif char dlopen (void); int main (void) { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_dl_dlopen=yes else $as_nop ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 printf "%s\n" "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 printf %s "checking for dlopen in -lsvld... " >&6; } if test ${ac_cv_lib_svld_dlopen+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. The 'extern "C"' is for builds by C++ compilers; although this is not generally supported in C code supporting it here has little cost and some practical benefit (sr 110532). */ #ifdef __cplusplus extern "C" #endif char dlopen (void); int main (void) { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_svld_dlopen=yes else $as_nop ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 printf "%s\n" "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = xyes then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 printf %s "checking for dld_link in -ldld... " >&6; } if test ${ac_cv_lib_dld_dld_link+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. The 'extern "C"' is for builds by C++ compilers; although this is not generally supported in C code supporting it here has little cost and some practical benefit (sr 110532). */ #ifdef __cplusplus extern "C" #endif char dld_link (void); int main (void) { return dld_link (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_dld_dld_link=yes else $as_nop ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 printf "%s\n" "$ac_cv_lib_dld_dld_link" >&6; } if test "x$ac_cv_lib_dld_dld_link" = xyes then : lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld fi fi fi fi fi fi ;; esac if test no = "$lt_cv_dlopen"; then enable_dlopen=no else enable_dlopen=yes fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS=$CPPFLAGS test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS=$LDFLAGS wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS=$LIBS LIBS="$lt_cv_dlopen_libs $LIBS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 printf %s "checking whether a program can dlopen itself... " >&6; } if test ${lt_cv_dlopen_self+y} then : printf %s "(cached) " >&6 else $as_nop if test yes = "$cross_compiling"; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 printf "%s\n" "$lt_cv_dlopen_self" >&6; } if test yes = "$lt_cv_dlopen_self"; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 printf %s "checking whether a statically linked program can dlopen itself... " >&6; } if test ${lt_cv_dlopen_self_static+y} then : printf %s "(cached) " >&6 else $as_nop if test yes = "$cross_compiling"; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 printf "%s\n" "$lt_cv_dlopen_self_static" >&6; } fi CPPFLAGS=$save_CPPFLAGS LDFLAGS=$save_LDFLAGS LIBS=$save_LIBS ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi striplib= old_striplib= { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 printf %s "checking whether stripping libraries is possible... " >&6; } if test -z "$STRIP"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } else if $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then old_striplib="$STRIP --strip-debug" striplib="$STRIP --strip-unneeded" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } else case $host_os in darwin*) # FIXME - insert some real tests, host_os isn't really good enough striplib="$STRIP -x" old_striplib="$STRIP -S" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } ;; freebsd*) if $STRIP -V 2>&1 | $GREP "elftoolchain" >/dev/null; then old_striplib="$STRIP --strip-debug" striplib="$STRIP --strip-unneeded" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi ;; *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } ;; esac fi fi # Report what library types will actually be built { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 printf %s "checking if libtool supports shared libraries... " >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 printf "%s\n" "$can_build_shared" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 printf %s "checking whether to build shared libraries... " >&6; } test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 printf "%s\n" "$enable_shared" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 printf %s "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 printf "%s\n" "$enable_static" >&6; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC=$lt_save_CC if test -n "$CXX" && ( test no != "$CXX" && ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) || (test g++ != "$CXX"))); then ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 printf %s "checking how to run the C++ preprocessor... " >&6; } if test -z "$CXXCPP"; then if test ${ac_cv_prog_CXXCPP+y} then : printf %s "(cached) " >&6 else $as_nop # Double quotes because $CXX needs to be expanded for CXXCPP in "$CXX -E" cpp /lib/cpp do ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include Syntax error _ACEOF if ac_fn_cxx_try_cpp "$LINENO" then : else $as_nop # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_cxx_try_cpp "$LINENO" then : # Broken: success on invalid input. continue else $as_nop # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok then : break fi done ac_cv_prog_CXXCPP=$CXXCPP fi CXXCPP=$ac_cv_prog_CXXCPP else ac_cv_prog_CXXCPP=$CXXCPP fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5 printf "%s\n" "$CXXCPP" >&6; } ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include Syntax error _ACEOF if ac_fn_cxx_try_cpp "$LINENO" then : else $as_nop # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_cxx_try_cpp "$LINENO" then : # Broken: success on invalid input. continue else $as_nop # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok then : else $as_nop { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu else _lt_caught_CXX_error=yes fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu archive_cmds_need_lc_CXX=no allow_undefined_flag_CXX= always_export_symbols_CXX=no archive_expsym_cmds_CXX= compiler_needs_object_CXX=no export_dynamic_flag_spec_CXX= hardcode_direct_CXX=no hardcode_direct_absolute_CXX=no hardcode_libdir_flag_spec_CXX= hardcode_libdir_separator_CXX= hardcode_minus_L_CXX=no hardcode_shlibpath_var_CXX=unsupported hardcode_automatic_CXX=no inherit_rpath_CXX=no module_cmds_CXX= module_expsym_cmds_CXX= link_all_deplibs_CXX=unknown old_archive_cmds_CXX=$old_archive_cmds reload_flag_CXX=$reload_flag reload_cmds_CXX=$reload_cmds no_undefined_flag_CXX= whole_archive_flag_spec_CXX= enable_shared_with_static_runtimes_CXX=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o objext_CXX=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test yes != "$_lt_caught_CXX_error"; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} CFLAGS=$CXXFLAGS compiler=$CC compiler_CXX=$CC func_cc_basename $compiler cc_basename=$func_cc_basename_result if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test yes = "$GXX"; then lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' else lt_prog_compiler_no_builtin_flag_CXX= fi if test yes = "$GXX"; then # Set up default GNU C++ configuration # Check whether --with-gnu-ld was given. if test ${with_gnu_ld+y} then : withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes else $as_nop with_gnu_ld=no fi ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 printf %s "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return, which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD=$ac_prog ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test yes = "$with_gnu_ld"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 printf %s "checking for GNU ld... " >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 printf %s "checking for non-GNU ld... " >&6; } fi if test ${lt_cv_path_LD+y} then : printf %s "(cached) " >&6 else $as_nop if test -z "$LD"; then lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD=$ac_dir/$ac_prog # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 printf "%s\n" "$LD" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 printf %s "checking if the linker ($LD) is GNU ld... " >&6; } if test ${lt_cv_prog_gnu_ld+y} then : printf %s "(cached) " >&6 else $as_nop # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 printf "%s\n" "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test yes = "$with_gnu_ld"; then archive_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' export_dynamic_flag_spec_CXX='$wl--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='$wl' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec_CXX=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else whole_archive_flag_spec_CXX= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 printf %s "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } ld_shlibs_CXX=yes case $host_os in aix3*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aix[4-9]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds_CXX='' hardcode_direct_CXX=yes hardcode_direct_absolute_CXX=yes hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes file_list_spec_CXX='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. hardcode_direct_CXX=no hardcode_direct_absolute_CXX=no ;; esac if test yes = "$GXX"; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct_CXX=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L_CXX=yes hardcode_libdir_flag_spec_CXX='-L$libdir' hardcode_libdir_separator_CXX= fi esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag=$shared_flag' $wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi export_dynamic_flag_spec_CXX='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. always_export_symbols_CXX=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. # The "-G" linker flag allows undefined symbols. no_undefined_flag_CXX='-bernotok' # Determine the default libpath from the value encoded in an empty # executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if test ${lt_cv_aix_libpath__CXX+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO" then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath__CXX fi hardcode_libdir_flag_spec_CXX='$wl-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then hardcode_libdir_flag_spec_CXX='$wl-R $libdir:/usr/lib:/lib' allow_undefined_flag_CXX="-z nodefs" archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if test ${lt_cv_aix_libpath__CXX+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO" then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath__CXX fi hardcode_libdir_flag_spec_CXX='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag_CXX=' $wl-bernotok' allow_undefined_flag_CXX=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec_CXX='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_CXX='$convenience' fi archive_cmds_need_lc_CXX=yes archive_expsym_cmds_CXX='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared # libraries. Need -bnortl late, we may have -brtl in LDFLAGS. archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$RM -r $output_objdir/$realname.d' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag_CXX=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else ld_shlibs_CXX=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in ,cl* | no,cl* | ,icl* | no,icl*) # Native MSVC or ICC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec_CXX=' ' allow_undefined_flag_CXX=unsupported always_export_symbols_CXX=yes file_list_spec_CXX='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. archive_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' archive_expsym_cmds_CXX='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, CXX)='true' enable_shared_with_static_runtimes_CXX=yes # Don't use ranlib old_postinstall_cmds_CXX='chmod 644 $oldlib' postlink_cmds_CXX='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ func_to_tool_file "$lt_outputfile"~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # g++ # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec_CXX='-L$libdir' export_dynamic_flag_spec_CXX='$wl--export-all-symbols' allow_undefined_flag_CXX=unsupported always_export_symbols_CXX=no enable_shared_with_static_runtimes_CXX=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... archive_expsym_cmds_CXX='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs_CXX=no fi ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc_CXX=no hardcode_direct_CXX=no hardcode_automatic_CXX=yes hardcode_shlibpath_var_CXX=unsupported if test yes = "$lt_cv_ld_force_load"; then whole_archive_flag_spec_CXX='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec_CXX='' fi link_all_deplibs_CXX=yes allow_undefined_flag_CXX=$_lt_dar_allow_undefined case $cc_basename in ifort*|nagfor*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test yes = "$_lt_dar_can_shared"; then output_verbose_link_cmd=func_echo_all archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" archive_expsym_cmds_CXX="$SED 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" module_expsym_cmds_CXX="$SED -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" if test yes != "$lt_cv_apple_cc_single_mod"; then archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil" archive_expsym_cmds_CXX="$SED 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil" fi else ld_shlibs_CXX=no fi ;; os2*) hardcode_libdir_flag_spec_CXX='-L$libdir' hardcode_minus_L_CXX=yes allow_undefined_flag_CXX=unsupported shrext_cmds=.dll archive_cmds_CXX='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds_CXX='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds_CXX='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes_CXX=yes file_list_spec_CXX='@' ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; freebsd2.*) # C++ shared libraries reported to be fairly broken before # switch to ELF ld_shlibs_CXX=no ;; freebsd-elf*) archive_cmds_need_lc_CXX=no ;; freebsd* | dragonfly* | midnightbsd*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions ld_shlibs_CXX=yes ;; haiku*) archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' link_all_deplibs_CXX=yes ;; hpux9*) hardcode_libdir_flag_spec_CXX='$wl+b $wl$libdir' hardcode_libdir_separator_CXX=: export_dynamic_flag_spec_CXX='$wl-E' hardcode_direct_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC*) archive_cmds_CXX='$RM $output_objdir/$soname~$CC -b $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; hpux10*|hpux11*) if test no = "$with_gnu_ld"; then hardcode_libdir_flag_spec_CXX='$wl+b $wl$libdir' hardcode_libdir_separator_CXX=: case $host_cpu in hppa*64*|ia64*) ;; *) export_dynamic_flag_spec_CXX='$wl-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no ;; *) hardcode_direct_CXX=yes hardcode_direct_absolute_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC*) case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -b $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then if test no = "$with_gnu_ld"; then case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -shared -nostdlib -fPIC $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; interix[3-9]*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' export_dynamic_flag_spec_CXX='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds_CXX='$SED "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test yes = "$GXX"; then if test no = "$with_gnu_ld"; then archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` -o $lib' fi fi link_all_deplibs_CXX=yes ;; esac hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' hardcode_libdir_separator_CXX=: inherit_rpath_CXX=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib $wl-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' export_dynamic_flag_spec_CXX='$wl--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; esac archive_cmds_need_lc_CXX=no hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' export_dynamic_flag_spec_CXX='$wl--export-dynamic' whole_archive_flag_spec_CXX='$wl--whole-archive$convenience $wl--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [1-5].* | *pgcpp\ [1-5].*) prelink_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' old_archive_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' archive_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 6 and above use weak symbols archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; esac hardcode_libdir_flag_spec_CXX='$wl--rpath $wl$libdir' export_dynamic_flag_spec_CXX='$wl--export-dynamic' whole_archive_flag_spec_CXX='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' ;; cxx*) # Compaq C++ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib $wl-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec_CXX='-rpath $libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' export_dynamic_flag_spec_CXX='$wl--export-dynamic' archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds_CXX='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | $SED 5q` in *Sun\ C*) # Sun C++ 5.9 no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' archive_expsym_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file $wl$export_symbols' hardcode_libdir_flag_spec_CXX='-R$libdir' whole_archive_flag_spec_CXX='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object_CXX=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; m88k*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) ld_shlibs_CXX=yes ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no hardcode_direct_absolute_CXX=yes archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file,$export_symbols -o $lib' export_dynamic_flag_spec_CXX='$wl-E' whole_archive_flag_spec_CXX=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else ld_shlibs_CXX=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' hardcode_libdir_separator_CXX=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; *) old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; cxx*) case $host in osf3*) allow_undefined_flag_CXX=' $wl-expect_unresolved $wl\*' archive_cmds_CXX='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $soname `test -n "$verstring" && func_echo_all "$wl-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' ;; *) allow_undefined_flag_CXX=' -expect_unresolved \*' archive_cmds_CXX='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname $wl-input $wl$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~ $RM $lib.exp' hardcode_libdir_flag_spec_CXX='-rpath $libdir' ;; esac hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes,no = "$GXX,$with_gnu_ld"; then allow_undefined_flag_CXX=' $wl-expect_unresolved $wl\*' case $host in osf3*) archive_cmds_CXX='$CC -shared -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' ;; *) archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' ;; esac hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ archive_cmds_need_lc_CXX=yes no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag $wl-M $wl$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_shlibpath_var_CXX=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract' ;; esac link_all_deplibs_CXX=yes output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test yes,no = "$GXX,$with_gnu_ld"; then no_undefined_flag_CXX=' $wl-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # g++ 2.7 appears to require '-G' NOT '-shared' on this # platform. archive_cmds_CXX='$CC -G -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' fi hardcode_libdir_flag_spec_CXX='$wl-R $wl$libdir' case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) whole_archive_flag_spec_CXX='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag_CXX='$wl-z,text' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag_CXX='$wl-z,text' allow_undefined_flag_CXX='$wl-z,nodefs' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='$wl-R,$libdir' hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes export_dynamic_flag_spec_CXX='$wl-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' old_archive_cmds_CXX='$CC -Tprelink_objects $oldobjs~ '"$old_archive_cmds_CXX" reload_cmds_CXX='$CC -Tprelink_objects $reload_objs~ '"$reload_cmds_CXX" ;; *) archive_cmds_CXX='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 printf "%s\n" "$ld_shlibs_CXX" >&6; } test no = "$ld_shlibs_CXX" && can_build_shared=no GCC_CXX=$GXX LD_CXX=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... # Dependencies to place before and after the object being linked: predep_objects_CXX= postdep_objects_CXX= predeps_CXX= postdeps_CXX= compiler_lib_search_path_CXX= cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF _lt_libdeps_save_CFLAGS=$CFLAGS case "$CC $CFLAGS " in #( *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; *\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; esac if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case $prev$p in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test x-L = "$p" || test x-R = "$p"; then prev=$p continue fi # Expand the sysroot to ease extracting the directories later. if test -z "$prev"; then case $p in -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; esac fi case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac if test no = "$pre_test_object_deps_done"; then case $prev in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$compiler_lib_search_path_CXX"; then compiler_lib_search_path_CXX=$prev$p else compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} $prev$p" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$postdeps_CXX"; then postdeps_CXX=$prev$p else postdeps_CXX="${postdeps_CXX} $prev$p" fi fi prev= ;; *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test no = "$pre_test_object_deps_done"; then if test -z "$predep_objects_CXX"; then predep_objects_CXX=$p else predep_objects_CXX="$predep_objects_CXX $p" fi else if test -z "$postdep_objects_CXX"; then postdep_objects_CXX=$p else postdep_objects_CXX="$postdep_objects_CXX $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling CXX test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken case $host_os in interix[3-9]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. predep_objects_CXX= postdep_objects_CXX= postdeps_CXX= ;; esac case " $postdeps_CXX " in *" -lc "*) archive_cmds_need_lc_CXX=no ;; esac compiler_lib_search_dirs_CXX= if test -n "${compiler_lib_search_path_CXX}"; then compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | $SED -e 's! -L! !g' -e 's!^ !!'` fi lt_prog_compiler_wl_CXX= lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX= # C++ specific cases for pic, static, wl, etc. if test yes = "$GXX"; then lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' fi lt_prog_compiler_pic_CXX='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic_CXX='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic_CXX='-DDLL_EXPORT' case $host_os in os2*) lt_prog_compiler_static_CXX='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic_CXX='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all lt_prog_compiler_pic_CXX= ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static_CXX= ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic_CXX=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic_CXX='-fPIC -shared' ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac else case $host_os in aix[4-9]*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' else lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_CXX='-DDLL_EXPORT' ;; dgux*) case $cc_basename in ec++*) lt_prog_compiler_pic_CXX='-KPIC' ;; ghcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; freebsd* | dragonfly* | midnightbsd*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='$wl-a ${wl}archive' if test ia64 != "$host_cpu"; then lt_prog_compiler_pic_CXX='+Z' fi ;; aCC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='$wl-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_CXX='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # KAI C++ Compiler lt_prog_compiler_wl_CXX='--backend -Wl,' lt_prog_compiler_pic_CXX='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64, which still supported -KPIC. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fPIC' lt_prog_compiler_static_CXX='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fpic' lt_prog_compiler_static_CXX='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; xlc* | xlC* | bgxl[cC]* | mpixl[cC]*) # IBM XL 8.0, 9.0 on PPC and BlueGene lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-qpic' lt_prog_compiler_static_CXX='-qstaticlink' ;; *) case `$CC -V 2>&1 | $SED 5q` in *Sun\ C*) # Sun C++ 5.9 lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) lt_prog_compiler_pic_CXX='-W c,exportall' ;; *) ;; esac ;; netbsd*) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic_CXX='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) lt_prog_compiler_wl_CXX='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 lt_prog_compiler_pic_CXX='-pic' ;; cxx*) # Digital/Compaq C++ lt_prog_compiler_wl_CXX='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x lt_prog_compiler_pic_CXX='-pic' lt_prog_compiler_static_CXX='-Bstatic' ;; lcc*) # Lucid lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 lt_prog_compiler_pic_CXX='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) lt_prog_compiler_can_build_shared_CXX=no ;; esac fi case $host_os in # For platforms that do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_CXX= ;; *) lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 printf %s "checking for $compiler option to produce PIC... " >&6; } if test ${lt_cv_prog_compiler_pic_CXX+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler_pic_CXX=$lt_prog_compiler_pic_CXX fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_CXX" >&5 printf "%s\n" "$lt_cv_prog_compiler_pic_CXX" >&6; } lt_prog_compiler_pic_CXX=$lt_cv_prog_compiler_pic_CXX # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_CXX"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 printf %s "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; } if test ${lt_cv_prog_compiler_pic_works_CXX+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler_pic_works_CXX=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works_CXX=yes fi fi $RM conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5 printf "%s\n" "$lt_cv_prog_compiler_pic_works_CXX" >&6; } if test yes = "$lt_cv_prog_compiler_pic_works_CXX"; then case $lt_prog_compiler_pic_CXX in "" | " "*) ;; *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; esac else lt_prog_compiler_pic_CXX= lt_prog_compiler_can_build_shared_CXX=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 printf %s "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if test ${lt_cv_prog_compiler_static_works_CXX+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler_static_works_CXX=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works_CXX=yes fi else lt_cv_prog_compiler_static_works_CXX=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5 printf "%s\n" "$lt_cv_prog_compiler_static_works_CXX" >&6; } if test yes = "$lt_cv_prog_compiler_static_works_CXX"; then : else lt_prog_compiler_static_CXX= fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if test ${lt_cv_prog_compiler_c_o_CXX+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler_c_o_CXX=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_CXX=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 printf "%s\n" "$lt_cv_prog_compiler_c_o_CXX" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if test ${lt_cv_prog_compiler_c_o_CXX+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler_c_o_CXX=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_CXX=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 printf "%s\n" "$lt_cv_prog_compiler_c_o_CXX" >&6; } hard_links=nottested if test no = "$lt_cv_prog_compiler_c_o_CXX" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 printf %s "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 printf "%s\n" "$hard_links" >&6; } if test no = "$hard_links"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 printf "%s\n" "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 printf %s "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' case $host_os in aix[4-9]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_CXX='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi ;; pw32*) export_symbols_cmds_CXX=$ltdll_cmds ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl* | icl*) exclude_expsyms_CXX='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms_CXX='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' ;; esac ;; *) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 printf "%s\n" "$ld_shlibs_CXX" >&6; } test no = "$ld_shlibs_CXX" && can_build_shared=no with_gnu_ld_CXX=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc_CXX" in x|xyes) # Assume -lc should be added archive_cmds_need_lc_CXX=yes if test yes,yes = "$GCC,$enable_shared"; then case $archive_cmds_CXX in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 printf %s "checking whether -lc should be explicitly linked in... " >&6; } if test ${lt_cv_archive_cmds_need_lc_CXX+y} then : printf %s "(cached) " >&6 else $as_nop $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl_CXX pic_flag=$lt_prog_compiler_pic_CXX compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag_CXX allow_undefined_flag_CXX= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc_CXX=no else lt_cv_archive_cmds_need_lc_CXX=yes fi allow_undefined_flag_CXX=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_CXX" >&5 printf "%s\n" "$lt_cv_archive_cmds_need_lc_CXX" >&6; } archive_cmds_need_lc_CXX=$lt_cv_archive_cmds_need_lc_CXX ;; esac fi ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 printf %s "checking dynamic linker characteristics... " >&6; } library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=.so postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='$libname$release$shared_ext$major' ;; aix[4-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test ia64 = "$host_cpu"; then # AIX 5 supports IA64 library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line '#! .'. This would cause the generated library to # depend on '.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # Using Import Files as archive members, it is possible to support # filename-based versioning of shared library archives on AIX. While # this would work for both with and without runtime linking, it will # prevent static linking of such archives. So we do filename-based # shared library versioning with .so extension only, which is used # when both runtime linking and shared linking is enabled. # Unfortunately, runtime linking may impact performance, so we do # not want this to be the default eventually. Also, we use the # versioned .so libs for executables only if there is the -brtl # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. # To allow for filename-based versioning support, we need to create # libNAME.so.V as an archive file, containing: # *) an Import File, referring to the versioned filename of the # archive as well as the shared archive member, telling the # bitwidth (32 or 64) of that shared object, and providing the # list of exported symbols of that shared object, eventually # decorated with the 'weak' keyword # *) the shared object with the F_LOADONLY flag set, to really avoid # it being seen by the linker. # At run time we better use the real file rather than another symlink, # but for link time we create the symlink libNAME.so -> libNAME.so.V case $with_aix_soname,$aix_use_runtimelinking in # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. aix,yes) # traditional libtool dynamic_linker='AIX unversionable lib.so' # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; aix,no) # traditional AIX only dynamic_linker='AIX lib.a(lib.so.V)' # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' ;; svr4,*) # full svr4 only dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,yes) # both, prefer svr4 dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # unpreferred sharedlib libNAME.a needs extra handling postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,no) # both, prefer aix dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' ;; esac shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='$libname$shared_ext' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo $libname | $SED -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo $libname | $SED -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl* | *,icl*) # Native MSVC or ICC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec=$LIB if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC and ICC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='$libname$release$versuffix$shared_ext $libname$release$major$shared_ext $libname$shared_ext' soname_spec='$libname$release$major$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .bundle || echo .dylib`' sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly* | midnightbsd*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi # Handle Gentoo/FreeBSD as it was Linux case $host_vendor in gentoo) version_type=linux ;; *) version_type=freebsd-$objformat ;; esac case $version_type in freebsd-elf*) library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' need_version=yes ;; linux) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' need_lib_prefix=no need_version=no ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=no sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' if test 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test yes = "$lt_cv_prog_gnu_ld"; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; linux*android*) version_type=none # Android doesn't support versioned libraries. need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext' soname_spec='$libname$release$shared_ext' finish_cmds= shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes dynamic_linker='Android linker' # Don't embed -rpath directories since the linker doesn't support them. hardcode_libdir_flag_spec_CXX='-L$libdir' ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if test ${lt_cv_shlibpath_overrides_runpath+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_CXX\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_CXX\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO" then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, # even though it is searched at run-time. Try to do the best guess by # appending ld.so.conf contents (and includes) to the search path. if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd* | bitrig*) version_type=sunos sys_lib_dlsearch_path_spec=/usr/lib need_lib_prefix=no if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then need_version=no else need_version=yes fi library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; os2*) libname_spec='$name' version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no # OS/2 can only load a DLL with a base name of 8 characters or less. soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; v=$($ECHO $release$versuffix | tr -d .-); n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); $ECHO $n$v`$shared_ext' library_names_spec='${libname}_dll.$libext' dynamic_linker='OS/2 ld.exe' shlibpath_var=BEGINLIBPATH sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test yes = "$with_gnu_ld"; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec; then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' soname_spec='$libname$shared_ext.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=sco need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test yes = "$with_gnu_ld"; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 printf "%s\n" "$dynamic_linker" >&6; } test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test yes = "$GCC"; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec fi if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec fi # remember unaugmented sys_lib_dlsearch_path content for libtool script decls... configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec # ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" # to be used as default LT_SYS_LIBRARY_PATH value in generated libtool configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 printf %s "checking how to hardcode library paths into programs... " >&6; } hardcode_action_CXX= if test -n "$hardcode_libdir_flag_spec_CXX" || test -n "$runpath_var_CXX" || test yes = "$hardcode_automatic_CXX"; then # We can hardcode non-existent directories. if test no != "$hardcode_direct_CXX" && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, CXX)" && test no != "$hardcode_minus_L_CXX"; then # Linking always hardcodes the temporary library directory. hardcode_action_CXX=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action_CXX=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action_CXX=unsupported fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5 printf "%s\n" "$hardcode_action_CXX" >&6; } if test relink = "$hardcode_action_CXX" || test yes = "$inherit_rpath_CXX"; then # Fast installation is not supported enable_fast_install=no elif test yes = "$shlibpath_overrides_runpath" || test no = "$enable_shared"; then # Fast installation is not necessary enable_fast_install=needless fi fi # test -n "$compiler" CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test yes != "$_lt_caught_CXX_error" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_commands="$ac_config_commands libtool" # Only expand once: { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sqrt in -lm" >&5 printf %s "checking for sqrt in -lm... " >&6; } if test ${ac_cv_lib_m_sqrt+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. The 'extern "C"' is for builds by C++ compilers; although this is not generally supported in C code supporting it here has little cost and some practical benefit (sr 110532). */ #ifdef __cplusplus extern "C" #endif char sqrt (void); int main (void) { return sqrt (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_sqrt=yes else $as_nop ac_cv_lib_m_sqrt=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_sqrt" >&5 printf "%s\n" "$ac_cv_lib_m_sqrt" >&6; } if test "x$ac_cv_lib_m_sqrt" = xyes then : printf "%s\n" "#define HAVE_LIBM 1" >>confdefs.h LIBS="-lm $LIBS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for cblas_dgemm in -lgslcblas" >&5 printf %s "checking for cblas_dgemm in -lgslcblas... " >&6; } if test ${ac_cv_lib_gslcblas_cblas_dgemm+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lgslcblas $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. The 'extern "C"' is for builds by C++ compilers; although this is not generally supported in C code supporting it here has little cost and some practical benefit (sr 110532). */ #ifdef __cplusplus extern "C" #endif char cblas_dgemm (void); int main (void) { return cblas_dgemm (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_gslcblas_cblas_dgemm=yes else $as_nop ac_cv_lib_gslcblas_cblas_dgemm=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gslcblas_cblas_dgemm" >&5 printf "%s\n" "$ac_cv_lib_gslcblas_cblas_dgemm" >&6; } if test "x$ac_cv_lib_gslcblas_cblas_dgemm" = xyes then : printf "%s\n" "#define HAVE_LIBGSLCBLAS 1" >>confdefs.h LIBS="-lgslcblas $LIBS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for gsl_blas_dgemm in -lgsl" >&5 printf %s "checking for gsl_blas_dgemm in -lgsl... " >&6; } if test ${ac_cv_lib_gsl_gsl_blas_dgemm+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lgsl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. The 'extern "C"' is for builds by C++ compilers; although this is not generally supported in C code supporting it here has little cost and some practical benefit (sr 110532). */ #ifdef __cplusplus extern "C" #endif char gsl_blas_dgemm (void); int main (void) { return gsl_blas_dgemm (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_gsl_gsl_blas_dgemm=yes else $as_nop ac_cv_lib_gsl_gsl_blas_dgemm=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gsl_gsl_blas_dgemm" >&5 printf "%s\n" "$ac_cv_lib_gsl_gsl_blas_dgemm" >&6; } if test "x$ac_cv_lib_gsl_gsl_blas_dgemm" = xyes then : printf "%s\n" "#define HAVE_LIBGSL 1" >>confdefs.h LIBS="-lgsl $LIBS" fi # Check whether --with-urng_rngstream was given. if test ${with_urng_rngstream+y} then : withval=$with_urng_rngstream; case "${withval}" in yes) ;; no) ;; *) as_fn_error $? "bad value '${withval}' for --with-urng-rngstream" "$LINENO" 5 ;; esac else $as_nop with_urng_rngstream=no fi if test "x$with_urng_rngstream" != xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for RngStream_CreateStream in -lrngstreams" >&5 printf %s "checking for RngStream_CreateStream in -lrngstreams... " >&6; } if test ${ac_cv_lib_rngstreams_RngStream_CreateStream+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lrngstreams $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. The 'extern "C"' is for builds by C++ compilers; although this is not generally supported in C code supporting it here has little cost and some practical benefit (sr 110532). */ #ifdef __cplusplus extern "C" #endif char RngStream_CreateStream (void); int main (void) { return RngStream_CreateStream (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_rngstreams_RngStream_CreateStream=yes else $as_nop ac_cv_lib_rngstreams_RngStream_CreateStream=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rngstreams_RngStream_CreateStream" >&5 printf "%s\n" "$ac_cv_lib_rngstreams_RngStream_CreateStream" >&6; } if test "x$ac_cv_lib_rngstreams_RngStream_CreateStream" = xyes then : printf "%s\n" "#define HAVE_LIBRNGSTREAMS 1" >>confdefs.h LIBS="-lrngstreams $LIBS" fi for ac_header in RngStream.h do : ac_fn_c_check_header_compile "$LINENO" "RngStream.h" "ac_cv_header_RngStream_h" "$ac_includes_default" if test "x$ac_cv_header_RngStream_h" = xyes then : printf "%s\n" "#define HAVE_RNGSTREAM_H 1" >>confdefs.h UNURAN_SUPPORTS_RNGSTREAM=-DUNURAN_SUPPORTS_RNGSTREAM printf "%s\n" "#define UNURAN_HAS_RNGSTREAM 1" >>confdefs.h else $as_nop { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? " `echo "--with-urng-rngstream given, but 'RngStream.h' not found" | \ $SED 's/\(.*\)/* \1 */;h;s/./*/g;p;s/./ /g;s/./*/;s/.$/*/;p;x;p;x;p;x;s/./*/g'` See \`config.log' for more details" "$LINENO" 5; } fi done fi # Check whether --with-urng_prng was given. if test ${with_urng_prng+y} then : withval=$with_urng_prng; case "${withval}" in yes) ;; no) ;; *) as_fn_error $? "bad value '${withval}' for --with-urng-prng" "$LINENO" 5 ;; esac else $as_nop with_urng_prng=no fi if test "x$with_urng_prng" != xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for prng_new in -lprng" >&5 printf %s "checking for prng_new in -lprng... " >&6; } if test ${ac_cv_lib_prng_prng_new+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lprng $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. The 'extern "C"' is for builds by C++ compilers; although this is not generally supported in C code supporting it here has little cost and some practical benefit (sr 110532). */ #ifdef __cplusplus extern "C" #endif char prng_new (void); int main (void) { return prng_new (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_prng_prng_new=yes else $as_nop ac_cv_lib_prng_prng_new=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_prng_prng_new" >&5 printf "%s\n" "$ac_cv_lib_prng_prng_new" >&6; } if test "x$ac_cv_lib_prng_prng_new" = xyes then : printf "%s\n" "#define HAVE_LIBPRNG 1" >>confdefs.h LIBS="-lprng $LIBS" fi for ac_header in prng.h do : ac_fn_c_check_header_compile "$LINENO" "prng.h" "ac_cv_header_prng_h" "$ac_includes_default" if test "x$ac_cv_header_prng_h" = xyes then : printf "%s\n" "#define HAVE_PRNG_H 1" >>confdefs.h UNURAN_SUPPORTS_PRNG=-DUNURAN_SUPPORTS_PRNG printf "%s\n" "#define UNURAN_HAS_PRNG 1" >>confdefs.h else $as_nop { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? " `echo "--with-urng-prng given, but 'prng.h' not found" | \ $SED 's/\(.*\)/* \1 */;h;s/./*/g;p;s/./ /g;s/./*/;s/.$/*/;p;x;p;x;p;x;s/./*/g'` See \`config.log' for more details" "$LINENO" 5; } fi done fi # Check whether --with-urng_gsl was given. if test ${with_urng_gsl+y} then : withval=$with_urng_gsl; case "${withval}" in yes) ;; no) ;; *) as_fn_error $? "bad value '${withval}' for --with-urng-gsl" "$LINENO" 5 ;; esac else $as_nop with_urng_gsl=no fi if test "x$with_urng_gsl" != xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for gsl_rng_alloc in -lgsl" >&5 printf %s "checking for gsl_rng_alloc in -lgsl... " >&6; } if test ${ac_cv_lib_gsl_gsl_rng_alloc+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lgsl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. The 'extern "C"' is for builds by C++ compilers; although this is not generally supported in C code supporting it here has little cost and some practical benefit (sr 110532). */ #ifdef __cplusplus extern "C" #endif char gsl_rng_alloc (void); int main (void) { return gsl_rng_alloc (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_gsl_gsl_rng_alloc=yes else $as_nop ac_cv_lib_gsl_gsl_rng_alloc=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gsl_gsl_rng_alloc" >&5 printf "%s\n" "$ac_cv_lib_gsl_gsl_rng_alloc" >&6; } if test "x$ac_cv_lib_gsl_gsl_rng_alloc" = xyes then : printf "%s\n" "#define HAVE_LIBGSL 1" >>confdefs.h LIBS="-lgsl $LIBS" fi for ac_header in gsl/gsl_rng.h do : ac_fn_c_check_header_compile "$LINENO" "gsl/gsl_rng.h" "ac_cv_header_gsl_gsl_rng_h" "$ac_includes_default" if test "x$ac_cv_header_gsl_gsl_rng_h" = xyes then : printf "%s\n" "#define HAVE_GSL_GSL_RNG_H 1" >>confdefs.h UNURAN_SUPPORTS_GSL=-DUNURAN_SUPPORTS_GSL printf "%s\n" "#define UNURAN_HAS_GSL 1" >>confdefs.h else $as_nop { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? " `echo "--with-urng-gsl given, but 'gsl/gsl_rng.h' not found" | \ $SED 's/\(.*\)/* \1 */;h;s/./*/g;p;s/./ /g;s/./*/;s/.$/*/;p;x;p;x;p;x;s/./*/g'` See \`config.log' for more details" "$LINENO" 5; } fi done fi # Check whether --with-urng_default was given. if test ${with_urng_default+y} then : withval=$with_urng_default; case "${withval}" in builtin) ;; rngstream) ;; *) as_fn_error $? "bad value '${withval}' for --with-urng-default" "$LINENO" 5 ;; esac else $as_nop with_urng_default=builtin fi if test "x$with_urng_default" == xrngstream then : if test "x$with_urng_rngstream" == xno then : with_urng_default=builtin { printf "%s\n" "$as_me:${as_lineno-$LINENO}: ******************************************************** * * --with-urng-default=rngstream * but --with-urng-rngstream=no. * use --with-urng-default=builtin instead * ******************************************************** " >&5 printf "%s\n" "$as_me: ******************************************************** * * --with-urng-default=rngstream * but --with-urng-rngstream=no. * use --with-urng-default=builtin instead * ******************************************************** " >&6;} else $as_nop printf "%s\n" "#define UNUR_URNG_DEFAULT_RNGSTREAM 1" >>confdefs.h fi fi # Check whether --with-Rmath was given. if test ${with_Rmath+y} then : withval=$with_Rmath; case "${withval}" in yes) ;; no) ;; *) as_fn_error $? "bad value '${withval}' for --with-Rmath" "$LINENO" 5 ;; esac else $as_nop with_Rmath=no fi if test "x$with_Rmath" != xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for bessel_k in -lRmath" >&5 printf %s "checking for bessel_k in -lRmath... " >&6; } if test ${ac_cv_lib_Rmath_bessel_k+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lRmath $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. The 'extern "C"' is for builds by C++ compilers; although this is not generally supported in C code supporting it here has little cost and some practical benefit (sr 110532). */ #ifdef __cplusplus extern "C" #endif char bessel_k (void); int main (void) { return bessel_k (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_Rmath_bessel_k=yes else $as_nop ac_cv_lib_Rmath_bessel_k=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Rmath_bessel_k" >&5 printf "%s\n" "$ac_cv_lib_Rmath_bessel_k" >&6; } if test "x$ac_cv_lib_Rmath_bessel_k" = xyes then : printf "%s\n" "#define HAVE_LIBRMATH 1" >>confdefs.h LIBS="-lRmath $LIBS" else $as_nop { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? " `echo "--with-Rmath given, but 'libRmath' not found" | \ $SED 's/\(.*\)/* \1 */;h;s/./*/g;p;s/./ /g;s/./*/;s/.$/*/;p;x;p;x;p;x;s/./*/g'` See \`config.log' for more details" "$LINENO" 5; } fi fi ac_fn_c_check_header_compile "$LINENO" "float.h" "ac_cv_header_float_h" "$ac_includes_default" if test "x$ac_cv_header_float_h" = xyes then : printf "%s\n" "#define HAVE_FLOAT_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "limits.h" "ac_cv_header_limits_h" "$ac_includes_default" if test "x$ac_cv_header_limits_h" = xyes then : printf "%s\n" "#define HAVE_LIMITS_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" if test "x$ac_cv_header_stdlib_h" = xyes then : printf "%s\n" "#define HAVE_STDLIB_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "string.h" "ac_cv_header_string_h" "$ac_includes_default" if test "x$ac_cv_header_string_h" = xyes then : printf "%s\n" "#define HAVE_STRING_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default" if test "x$ac_cv_header_unistd_h" = xyes then : printf "%s\n" "#define HAVE_UNISTD_H 1" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 printf %s "checking for an ANSI C-conforming const... " >&6; } if test ${ac_cv_c_const+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { #ifndef __cplusplus /* Ultrix mips cc rejects this sort of thing. */ typedef int charset[2]; const charset cs = { 0, 0 }; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* IBM XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this sort of thing. */ char tx; char *t = &tx; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* IBM XL C 1.02.0.0 rejects this sort of thing, saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; } bx; struct s *b = &bx; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_c_const=yes else $as_nop ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 printf "%s\n" "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then printf "%s\n" "#define const /**/" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 printf %s "checking for inline... " >&6; } if test ${ac_cv_c_inline+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; static $ac_kw foo_t static_foo (void) {return 0; } $ac_kw foo_t foo (void) {return 0; } #endif _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_c_inline=$ac_kw fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext test "$ac_cv_c_inline" != no && break done fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 printf "%s\n" "$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; *) case $ac_cv_c_inline in no) ac_val=;; *) ac_val=$ac_cv_c_inline;; esac cat >>confdefs.h <<_ACEOF #ifndef __cplusplus #define inline $ac_val #endif _ACEOF ;; esac ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes then : else $as_nop printf "%s\n" "#define size_t unsigned int" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "alarm" "ac_cv_func_alarm" if test "x$ac_cv_func_alarm" = xyes then : printf "%s\n" "#define HAVE_ALARM 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "floor" "ac_cv_func_floor" if test "x$ac_cv_func_floor" = xyes then : printf "%s\n" "#define HAVE_FLOOR 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "gettimeofday" "ac_cv_func_gettimeofday" if test "x$ac_cv_func_gettimeofday" = xyes then : printf "%s\n" "#define HAVE_GETTIMEOFDAY 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "memset" "ac_cv_func_memset" if test "x$ac_cv_func_memset" = xyes then : printf "%s\n" "#define HAVE_MEMSET 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "pow" "ac_cv_func_pow" if test "x$ac_cv_func_pow" = xyes then : printf "%s\n" "#define HAVE_POW 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "sqrt" "ac_cv_func_sqrt" if test "x$ac_cv_func_sqrt" = xyes then : printf "%s\n" "#define HAVE_SQRT 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "strcasecmp" "ac_cv_func_strcasecmp" if test "x$ac_cv_func_strcasecmp" = xyes then : printf "%s\n" "#define HAVE_STRCASECMP 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "strchr" "ac_cv_func_strchr" if test "x$ac_cv_func_strchr" = xyes then : printf "%s\n" "#define HAVE_STRCHR 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "strtol" "ac_cv_func_strtol" if test "x$ac_cv_func_strtol" = xyes then : printf "%s\n" "#define HAVE_STRTOL 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "strtoul" "ac_cv_func_strtoul" if test "x$ac_cv_func_strtoul" = xyes then : printf "%s\n" "#define HAVE_STRTOUL 1" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC options needed to detect all undeclared functions" >&5 printf %s "checking for $CC options needed to detect all undeclared functions... " >&6; } if test ${ac_cv_c_undeclared_builtin_options+y} then : printf %s "(cached) " >&6 else $as_nop ac_save_CFLAGS=$CFLAGS ac_cv_c_undeclared_builtin_options='cannot detect' for ac_arg in '' -fno-builtin; do CFLAGS="$ac_save_CFLAGS $ac_arg" # This test program should *not* compile successfully. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { (void) strchr; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : else $as_nop # This test program should compile successfully. # No library function is consistently available on # freestanding implementations, so test against a dummy # declaration. Include always-available headers on the # off chance that they somehow elicit warnings. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include extern void ac_decl (int, char *); int main (void) { (void) ac_decl (0, (char *) 0); (void) ac_decl; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : if test x"$ac_arg" = x then : ac_cv_c_undeclared_builtin_options='none needed' else $as_nop ac_cv_c_undeclared_builtin_options=$ac_arg fi break fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext done CFLAGS=$ac_save_CFLAGS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_undeclared_builtin_options" >&5 printf "%s\n" "$ac_cv_c_undeclared_builtin_options" >&6; } case $ac_cv_c_undeclared_builtin_options in #( 'cannot detect') : { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot make $CC report undeclared builtins See \`config.log' for more details" "$LINENO" 5; } ;; #( 'none needed') : ac_c_undeclared_builtin_options='' ;; #( *) : ac_c_undeclared_builtin_options=$ac_cv_c_undeclared_builtin_options ;; esac ac_fn_check_decl "$LINENO" "log1p" "ac_cv_have_decl_log1p" "#include " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_log1p" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_LOG1P $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "hypot" "ac_cv_have_decl_hypot" "#include " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_hypot" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_HYPOT $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "getopt" "ac_cv_have_decl_getopt" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_getopt" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_GETOPT $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "snprintf" "ac_cv_have_decl_snprintf" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_snprintf" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_SNPRINTF $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "vsnprintf" "ac_cv_have_decl_vsnprintf" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_vsnprintf" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_VSNPRINTF $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "isfinite" "ac_cv_have_decl_isfinite" "#include " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_isfinite" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_ISFINITE $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "isinf" "ac_cv_have_decl_isinf" "#include " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_isinf" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_ISINF $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "isnan" "ac_cv_have_decl_isnan" "#include " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_isnan" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_ISNAN $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "INFINITY" "ac_cv_have_decl_INFINITY" "#include " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_INFINITY" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_INFINITY $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "HUGE_VAL" "ac_cv_have_decl_HUGE_VAL" "#include " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_HUGE_VAL" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_HUGE_VAL $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "DBL_MAX" "ac_cv_have_decl_DBL_MAX" "#include " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_DBL_MAX" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_DBL_MAX $ac_have_decl" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for IEEE comparisons" >&5 printf %s "checking for IEEE comparisons... " >&6; } if test ${ac_cv_c_ieee_comparisons+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : ac_cv_c_ieee_comparisons="yes" else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { int status; double inf, nan; inf = exp(1.0e10); nan = inf / inf; /* nan = 0.0 / 0.0; */ status = (nan == nan); return status; } _ACEOF if ac_fn_c_try_run "$LINENO" then : ac_cv_c_ieee_comparisons="yes" else $as_nop ac_cv_c_ieee_comparisons="no" fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_ieee_comparisons" >&5 printf "%s\n" "$ac_cv_c_ieee_comparisons" >&6; } if test "$ac_cv_c_ieee_comparisons" != no ; then printf "%s\n" "#define HAVE_IEEE_COMPARISONS 1" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for divide-by-zero" >&5 printf %s "checking for divide-by-zero... " >&6; } if test ${ac_cv_c_divide_by_zero+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : ac_cv_c_divide_by_zero="yes" else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main (void) { double x = 0.0; double inf = 1.0 / x; int status = (inf < DBL_MAX/2.); return status; } _ACEOF if ac_fn_c_try_run "$LINENO" then : ac_cv_c_divide_by_zero="yes" else $as_nop ac_cv_c_divide_by_zero="no" fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_divide_by_zero" >&5 printf "%s\n" "$ac_cv_c_divide_by_zero" >&6; } if test "$ac_cv_c_divide_by_zero" != no ; then printf "%s\n" "#define HAVE_DIVIDE_BY_ZERO 1" >>confdefs.h fi ac_fn_check_decl "$LINENO" "alarm" "ac_cv_have_decl_alarm" "#include " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_alarm" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_ALARM $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "signal" "ac_cv_have_decl_signal" "#include " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_signal" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_SIGNAL $ac_have_decl" >>confdefs.h ac_fn_c_check_func "$LINENO" "alarm" "ac_cv_func_alarm" if test "x$ac_cv_func_alarm" = xyes then : printf "%s\n" "#define HAVE_ALARM 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "signal" "ac_cv_func_signal" if test "x$ac_cv_func_signal" = xyes then : printf "%s\n" "#define HAVE_SIGNAL 1" >>confdefs.h fi # Check whether --enable-deprecated was given. if test ${enable_deprecated+y} then : enableval=$enable_deprecated; else $as_nop enable_deprecated=no fi if test x$enable_deprecated = xyes; then ENABLE_DEPRECATED_TRUE= ENABLE_DEPRECATED_FALSE='#' else ENABLE_DEPRECATED_TRUE='#' ENABLE_DEPRECATED_FALSE= fi if test "x$enable_deprecated" = xyes then : printf "%s\n" "#define USE_DEPRECATED_CODE 1" >>confdefs.h fi # Check whether --enable-check-struct was given. if test ${enable_check_struct+y} then : enableval=$enable_check_struct; else $as_nop enable_check_struct=no fi if test "x$enable_check_struct" = xyes then : printf "%s\n" "#define UNUR_ENABLE_CHECKNULL 1" >>confdefs.h printf "%s\n" "#define UNUR_COOKIES 1" >>confdefs.h fi # Check whether --enable-logging was given. if test ${enable_logging+y} then : enableval=$enable_logging; else $as_nop enable_logging=no fi if test "x$enable_logging" = xyes then : printf "%s\n" "#define UNUR_ENABLE_LOGGING 1" >>confdefs.h fi # Check whether --enable-info was given. if test ${enable_info+y} then : enableval=$enable_info; else $as_nop enable_info=yes fi if test "x$enable_info" = xyes then : printf "%s\n" "#define UNUR_ENABLE_INFO 1" >>confdefs.h fi # Check whether --enable-experimental was given. if test ${enable_experimental+y} then : enableval=$enable_experimental; else $as_nop enable_experimental=no fi if test "x$enable_experimental" = xyes then : printf "%s\n" "#define USE_EXPERIMENTAL_CODE 1" >>confdefs.h fi if test x$enable_experimental = xyes; then ENABLE_EXPERIMENTAL_TRUE= ENABLE_EXPERIMENTAL_FALSE='#' else ENABLE_EXPERIMENTAL_TRUE='#' ENABLE_EXPERIMENTAL_FALSE= fi # Check whether --with-mathematica was given. if test ${with_mathematica+y} then : withval=$with_mathematica; case "${withval}" in yes) mathematica=true ;; no) mathematica=false ;; *) as_fn_error $? "bad value '${withval}' for --with-mathematica" "$LINENO" 5 ;; esac else $as_nop mathematica=false fi if test x$mathematica = xtrue; then HAVE_MATHEMATICA_TRUE= HAVE_MATHEMATICA_FALSE='#' else HAVE_MATHEMATICA_TRUE='#' HAVE_MATHEMATICA_FALSE= fi # Extract the first word of "valgrind", so it can be a program name with args. set dummy valgrind; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_have_valgrind+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$have_valgrind"; then ac_cv_prog_have_valgrind="$have_valgrind" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_have_valgrind="true" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_have_valgrind" && ac_cv_prog_have_valgrind="false" fi fi have_valgrind=$ac_cv_prog_have_valgrind if test -n "$have_valgrind"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_valgrind" >&5 printf "%s\n" "$have_valgrind" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test x$have_valgrind = xtrue; then HAVE_VALGRIND_TRUE= HAVE_VALGRIND_FALSE='#' else HAVE_VALGRIND_TRUE='#' HAVE_VALGRIND_FALSE= fi EXTRA_GCC_FLAGS= EXTRA_GCC_FLAGS="$EXTRA_GCC_FLAGS -Wshadow -Wstrict-prototypes" ##EXTRA_GCC_FLAGS="$EXTRA_GCC_FLAGS -Wdeprecated-declarations -Wbad-function-cast -Wcast-align -Wmissing-declarations -Wmissing-format-attribute -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wredundant-decls -Wstrict-prototypes -Wwrite-strings -Wconversion" ## the following flags raise warnings: ##EXTRA_GCC_FLAGS="$EXTRA_GCC_FLAGS -Wcast-qual -Wfloat-equal -Wunreachable-code" ## -Wcast-qual ## Warn whenever a pointer is cast so as to remove a type qualifier from the target type. For example, warn if a ## "const char *" is cast to an ordinary "char *". ## -Wfloat-equal ## Warn if floating point values are used in equality comparisons. ## -Wunreachable-code ## Warn if the compiler detects that code will never be executed. CC_FLAGS= if test X"$GCC" = Xyes ; then CC_FLAGS="$CC_FLAGS -Wall -Wextra $EXTRA_GCC_FLAGS" fi case "${host_os}" in linux*) case "${CC}" in ## Intel compiler *icc) ## -mp is the preferred form of -mieee-fp CC_FLAGS="$CC_FLAGS -mp" ;; esac ;; esac AM_CFLAGS=$CC_FLAGS case "${host}" in *-*-mingw*) have_mingw=yes ;; *) have_mingw=no esac if test "$have_mingw" = "yes"; then HAVE_MINGW_TRUE= HAVE_MINGW_FALSE='#' else HAVE_MINGW_TRUE='#' HAVE_MINGW_FALSE= fi ac_config_files="$ac_config_files Makefile src/Makefile src/distr/Makefile src/distributions/Makefile src/methods/Makefile src/parser/Makefile src/specfunct/Makefile src/tests/Makefile src/uniform/Makefile src/urng/Makefile src/utils/Makefile scripts/Makefile doc/Makefile doc/src/Makefile doc/figures/Makefile tests/Makefile tests/testdistributions/Makefile examples/Makefile experiments/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 printf "%s\n" "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 printf %s "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: done" >&5 printf "%s\n" "done" >&6; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_DEPRECATED_TRUE}" && test -z "${ENABLE_DEPRECATED_FALSE}"; then as_fn_error $? "conditional \"ENABLE_DEPRECATED\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_EXPERIMENTAL_TRUE}" && test -z "${ENABLE_EXPERIMENTAL_FALSE}"; then as_fn_error $? "conditional \"ENABLE_EXPERIMENTAL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_MATHEMATICA_TRUE}" && test -z "${HAVE_MATHEMATICA_FALSE}"; then as_fn_error $? "conditional \"HAVE_MATHEMATICA\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_VALGRIND_TRUE}" && test -z "${HAVE_VALGRIND_FALSE}"; then as_fn_error $? "conditional \"HAVE_VALGRIND\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_MINGW_TRUE}" && test -z "${HAVE_MINGW_FALSE}"; then as_fn_error $? "conditional \"HAVE_MINGW\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh as_nop=: if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi # Reset variables that may have inherited troublesome values from # the environment. # IFS needs to be set, to space, tab, and newline, in precisely that order. # (If _AS_PATH_WALK were called with IFS unset, it would have the # side effect of setting IFS to empty, thus disabling word splitting.) # Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl IFS=" "" $as_nl" PS1='$ ' PS2='> ' PS4='+ ' # Ensure predictable behavior from utilities with locale-dependent output. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # We cannot yet rely on "unset" to work, but we need these variables # to be unset--not just set to an empty or harmless value--now, to # avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct # also avoids known problems related to "unset" and subshell syntax # in other old shells (e.g. bash 2.01 and pdksh 5.2.14). for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH do eval test \${$as_var+y} \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done # Ensure that fds 0, 1, and 2 are open. if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null then : eval 'as_fn_append () { eval $1+=\$2 }' else $as_nop as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null then : eval 'as_fn_arith () { as_val=$(( $* )) }' else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # Determine whether it's possible to make 'echo' print without a newline. # These variables are no longer used directly by Autoconf, but are AC_SUBSTed # for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac # For backward compatibility with old third-party macros, we provide # the shell variables $as_echo and $as_echo_n. New code should use # AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. as_echo='printf %s\n' as_echo_n='printf %s' rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by unuran $as_me 1.11.0, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ unuran config.status 1.11.0 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" Copyright (C) 2021 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) printf "%s\n" "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) printf "%s\n" "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) printf "%s\n" "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX printf "%s\n" "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' shared_archive_member_spec='`$ECHO "$shared_archive_member_spec" | $SED "$delay_single_quote_subst"`' SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' FILECMD='`$ECHO "$FILECMD" | $SED "$delay_single_quote_subst"`' OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' lt_ar_flags='`$ECHO "$lt_ar_flags" | $SED "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_import='`$ECHO "$lt_cv_sys_global_symbol_to_import" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' lt_cv_nm_interface='`$ECHO "$lt_cv_nm_interface" | $SED "$delay_single_quote_subst"`' nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' lt_cv_truncate_bin='`$ECHO "$lt_cv_truncate_bin" | $SED "$delay_single_quote_subst"`' objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' configure_time_dlsearch_path='`$ECHO "$configure_time_dlsearch_path" | $SED "$delay_single_quote_subst"`' configure_time_lt_sys_library_path='`$ECHO "$configure_time_lt_sys_library_path" | $SED "$delay_single_quote_subst"`' hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' compiler_lib_search_dirs='`$ECHO "$compiler_lib_search_dirs" | $SED "$delay_single_quote_subst"`' predep_objects='`$ECHO "$predep_objects" | $SED "$delay_single_quote_subst"`' postdep_objects='`$ECHO "$postdep_objects" | $SED "$delay_single_quote_subst"`' predeps='`$ECHO "$predeps" | $SED "$delay_single_quote_subst"`' postdeps='`$ECHO "$postdeps" | $SED "$delay_single_quote_subst"`' compiler_lib_search_path='`$ECHO "$compiler_lib_search_path" | $SED "$delay_single_quote_subst"`' LD_CXX='`$ECHO "$LD_CXX" | $SED "$delay_single_quote_subst"`' reload_flag_CXX='`$ECHO "$reload_flag_CXX" | $SED "$delay_single_quote_subst"`' reload_cmds_CXX='`$ECHO "$reload_cmds_CXX" | $SED "$delay_single_quote_subst"`' old_archive_cmds_CXX='`$ECHO "$old_archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' compiler_CXX='`$ECHO "$compiler_CXX" | $SED "$delay_single_quote_subst"`' GCC_CXX='`$ECHO "$GCC_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "$lt_prog_compiler_no_builtin_flag_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic_CXX='`$ECHO "$lt_prog_compiler_pic_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl_CXX='`$ECHO "$lt_prog_compiler_wl_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static_CXX='`$ECHO "$lt_prog_compiler_static_CXX" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o_CXX='`$ECHO "$lt_cv_prog_compiler_c_o_CXX" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc_CXX='`$ECHO "$archive_cmds_need_lc_CXX" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes_CXX='`$ECHO "$enable_shared_with_static_runtimes_CXX" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec_CXX='`$ECHO "$export_dynamic_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec_CXX='`$ECHO "$whole_archive_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' compiler_needs_object_CXX='`$ECHO "$compiler_needs_object_CXX" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds_CXX='`$ECHO "$old_archive_from_new_cmds_CXX" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds_CXX='`$ECHO "$old_archive_from_expsyms_cmds_CXX" | $SED "$delay_single_quote_subst"`' archive_cmds_CXX='`$ECHO "$archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds_CXX='`$ECHO "$archive_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' module_cmds_CXX='`$ECHO "$module_cmds_CXX" | $SED "$delay_single_quote_subst"`' module_expsym_cmds_CXX='`$ECHO "$module_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' with_gnu_ld_CXX='`$ECHO "$with_gnu_ld_CXX" | $SED "$delay_single_quote_subst"`' allow_undefined_flag_CXX='`$ECHO "$allow_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' no_undefined_flag_CXX='`$ECHO "$no_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec_CXX='`$ECHO "$hardcode_libdir_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator_CXX='`$ECHO "$hardcode_libdir_separator_CXX" | $SED "$delay_single_quote_subst"`' hardcode_direct_CXX='`$ECHO "$hardcode_direct_CXX" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute_CXX='`$ECHO "$hardcode_direct_absolute_CXX" | $SED "$delay_single_quote_subst"`' hardcode_minus_L_CXX='`$ECHO "$hardcode_minus_L_CXX" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var_CXX='`$ECHO "$hardcode_shlibpath_var_CXX" | $SED "$delay_single_quote_subst"`' hardcode_automatic_CXX='`$ECHO "$hardcode_automatic_CXX" | $SED "$delay_single_quote_subst"`' inherit_rpath_CXX='`$ECHO "$inherit_rpath_CXX" | $SED "$delay_single_quote_subst"`' link_all_deplibs_CXX='`$ECHO "$link_all_deplibs_CXX" | $SED "$delay_single_quote_subst"`' always_export_symbols_CXX='`$ECHO "$always_export_symbols_CXX" | $SED "$delay_single_quote_subst"`' export_symbols_cmds_CXX='`$ECHO "$export_symbols_cmds_CXX" | $SED "$delay_single_quote_subst"`' exclude_expsyms_CXX='`$ECHO "$exclude_expsyms_CXX" | $SED "$delay_single_quote_subst"`' include_expsyms_CXX='`$ECHO "$include_expsyms_CXX" | $SED "$delay_single_quote_subst"`' prelink_cmds_CXX='`$ECHO "$prelink_cmds_CXX" | $SED "$delay_single_quote_subst"`' postlink_cmds_CXX='`$ECHO "$postlink_cmds_CXX" | $SED "$delay_single_quote_subst"`' file_list_spec_CXX='`$ECHO "$file_list_spec_CXX" | $SED "$delay_single_quote_subst"`' hardcode_action_CXX='`$ECHO "$hardcode_action_CXX" | $SED "$delay_single_quote_subst"`' compiler_lib_search_dirs_CXX='`$ECHO "$compiler_lib_search_dirs_CXX" | $SED "$delay_single_quote_subst"`' predep_objects_CXX='`$ECHO "$predep_objects_CXX" | $SED "$delay_single_quote_subst"`' postdep_objects_CXX='`$ECHO "$postdep_objects_CXX" | $SED "$delay_single_quote_subst"`' predeps_CXX='`$ECHO "$predeps_CXX" | $SED "$delay_single_quote_subst"`' postdeps_CXX='`$ECHO "$postdeps_CXX" | $SED "$delay_single_quote_subst"`' compiler_lib_search_path_CXX='`$ECHO "$compiler_lib_search_path_CXX" | $SED "$delay_single_quote_subst"`' LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } # Quote evaled strings. for var in SHELL \ ECHO \ PATH_SEPARATOR \ SED \ GREP \ EGREP \ FGREP \ LD \ NM \ LN_S \ lt_SP2NL \ lt_NL2SP \ reload_flag \ FILECMD \ OBJDUMP \ deplibs_check_method \ file_magic_cmd \ file_magic_glob \ want_nocaseglob \ DLLTOOL \ sharedlib_from_linklib_cmd \ AR \ archiver_list_spec \ STRIP \ RANLIB \ CC \ CFLAGS \ compiler \ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_import \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ lt_cv_nm_interface \ nm_file_list_spec \ lt_cv_truncate_bin \ lt_prog_compiler_no_builtin_flag \ lt_prog_compiler_pic \ lt_prog_compiler_wl \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ MANIFEST_TOOL \ DSYMUTIL \ NMEDIT \ LIPO \ OTOOL \ OTOOL64 \ shrext_cmds \ export_dynamic_flag_spec \ whole_archive_flag_spec \ compiler_needs_object \ with_gnu_ld \ allow_undefined_flag \ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_separator \ exclude_expsyms \ include_expsyms \ file_list_spec \ variables_saved_for_relink \ libname_spec \ library_names_spec \ soname_spec \ install_override_mode \ finish_eval \ old_striplib \ striplib \ compiler_lib_search_dirs \ predep_objects \ postdep_objects \ predeps \ postdeps \ compiler_lib_search_path \ LD_CXX \ reload_flag_CXX \ compiler_CXX \ lt_prog_compiler_no_builtin_flag_CXX \ lt_prog_compiler_pic_CXX \ lt_prog_compiler_wl_CXX \ lt_prog_compiler_static_CXX \ lt_cv_prog_compiler_c_o_CXX \ export_dynamic_flag_spec_CXX \ whole_archive_flag_spec_CXX \ compiler_needs_object_CXX \ with_gnu_ld_CXX \ allow_undefined_flag_CXX \ no_undefined_flag_CXX \ hardcode_libdir_flag_spec_CXX \ hardcode_libdir_separator_CXX \ exclude_expsyms_CXX \ include_expsyms_CXX \ file_list_spec_CXX \ compiler_lib_search_dirs_CXX \ predep_objects_CXX \ postdep_objects_CXX \ predeps_CXX \ postdeps_CXX \ compiler_lib_search_path_CXX; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in reload_cmds \ old_postinstall_cmds \ old_postuninstall_cmds \ old_archive_cmds \ extract_expsyms_cmds \ old_archive_from_new_cmds \ old_archive_from_expsyms_cmds \ archive_cmds \ archive_expsym_cmds \ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ postlink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ configure_time_dlsearch_path \ configure_time_lt_sys_library_path \ reload_cmds_CXX \ old_archive_cmds_CXX \ old_archive_from_new_cmds_CXX \ old_archive_from_expsyms_cmds_CXX \ archive_cmds_CXX \ archive_expsym_cmds_CXX \ module_cmds_CXX \ module_expsym_cmds_CXX \ export_symbols_cmds_CXX \ prelink_cmds_CXX \ postlink_cmds_CXX; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done ac_aux_dir='$ac_aux_dir' # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi PACKAGE='$PACKAGE' VERSION='$VERSION' RM='$RM' ofile='$ofile' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "src/distr/Makefile") CONFIG_FILES="$CONFIG_FILES src/distr/Makefile" ;; "src/distributions/Makefile") CONFIG_FILES="$CONFIG_FILES src/distributions/Makefile" ;; "src/methods/Makefile") CONFIG_FILES="$CONFIG_FILES src/methods/Makefile" ;; "src/parser/Makefile") CONFIG_FILES="$CONFIG_FILES src/parser/Makefile" ;; "src/specfunct/Makefile") CONFIG_FILES="$CONFIG_FILES src/specfunct/Makefile" ;; "src/tests/Makefile") CONFIG_FILES="$CONFIG_FILES src/tests/Makefile" ;; "src/uniform/Makefile") CONFIG_FILES="$CONFIG_FILES src/uniform/Makefile" ;; "src/urng/Makefile") CONFIG_FILES="$CONFIG_FILES src/urng/Makefile" ;; "src/utils/Makefile") CONFIG_FILES="$CONFIG_FILES src/utils/Makefile" ;; "scripts/Makefile") CONFIG_FILES="$CONFIG_FILES scripts/Makefile" ;; "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; "doc/src/Makefile") CONFIG_FILES="$CONFIG_FILES doc/src/Makefile" ;; "doc/figures/Makefile") CONFIG_FILES="$CONFIG_FILES doc/figures/Makefile" ;; "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; "tests/testdistributions/Makefile") CONFIG_FILES="$CONFIG_FILES tests/testdistributions/Makefile" ;; "examples/Makefile") CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;; "experiments/Makefile") CONFIG_FILES="$CONFIG_FILES experiments/Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers test ${CONFIG_COMMANDS+y} || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 printf "%s\n" "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`printf "%s\n" "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { printf "%s\n" "/* $configure_input */" >&1 \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 printf "%s\n" "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else printf "%s\n" "/* $configure_input */" >&1 \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 printf "%s\n" "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. # TODO: see whether this extra hack can be removed once we start # requiring Autoconf 2.70 or later. case $CONFIG_FILES in #( *\'*) : eval set x "$CONFIG_FILES" ;; #( *) : set x $CONFIG_FILES ;; #( *) : ;; esac shift # Used to flag and report bootstrapping failures. am_rc=0 for am_mf do # Strip MF so we end up with the name of the file. am_mf=`printf "%s\n" "$am_mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ || continue am_dirpart=`$as_dirname -- "$am_mf" || $as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$am_mf" : 'X\(//\)[^/]' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$am_mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` am_filepart=`$as_basename -- "$am_mf" || $as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X/"$am_mf" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` { echo "$as_me:$LINENO: cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles" >&5 (cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } || am_rc=$? done if test $am_rc -ne 0; then { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "Something went wrong bootstrapping makefile fragments for automatic dependency tracking. If GNU make was not used, consider re-running the configure script with MAKE=\"gmake\" (or whatever is necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking). See \`config.log' for more details" "$LINENO" 5; } fi { am_dirpart=; unset am_dirpart;} { am_filepart=; unset am_filepart;} { am_mf=; unset am_mf;} { am_rc=; unset am_rc;} rm -f conftest-deps.mk } ;; "libtool":C) # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi cfgfile=${ofile}T trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # Generated automatically by $as_me ($PACKAGE) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # Provide generalized library-building support services. # Written by Gordon Matzigkeit, 1996 # Copyright (C) 2014 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program or library that is built # using GNU Libtool, you may include this file under the same # distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # The names of the tagged configurations supported by this script. available_tags='CXX ' # Configured defaults for sys_lib_dlsearch_path munging. : \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} # ### BEGIN LIBTOOL CONFIG # Which release of libtool.m4 was used? macro_version=$macro_version macro_revision=$macro_revision # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # What type of objects to build. pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # Shared archive member basename,for filename based shared library versioning on AIX. shared_archive_member_spec=$shared_archive_member_spec # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # An echo program that protects backslashes. ECHO=$lt_ECHO # The PATH separator for the build system. PATH_SEPARATOR=$lt_PATH_SEPARATOR # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="\$SED -e 1s/^X//" # A grep program that handles long lines. GREP=$lt_GREP # An ERE matcher. EGREP=$lt_EGREP # A literal string matcher. FGREP=$lt_FGREP # A BSD- or MS-compatible name lister. NM=$lt_NM # Whether we need soft or hard links. LN_S=$lt_LN_S # What is the maximum length of a command? max_cmd_len=$max_cmd_len # Object file suffix (normally "o"). objext=$ac_objext # Executable file suffix (normally ""). exeext=$exeext # whether the shell understands "unset". lt_unset=$lt_unset # turn spaces into newlines. SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP # convert \$build file names to \$host format. to_host_file_cmd=$lt_cv_to_host_file_cmd # convert \$build files to toolchain format. to_tool_file_cmd=$lt_cv_to_tool_file_cmd # A file(cmd) program that detects file types. FILECMD=$lt_FILECMD # An object symbol dumper. OBJDUMP=$lt_OBJDUMP # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method = "file_magic". file_magic_cmd=$lt_file_magic_cmd # How to find potential files when deplibs_check_method = "file_magic". file_magic_glob=$lt_file_magic_glob # Find potential files using nocaseglob when deplibs_check_method = "file_magic". want_nocaseglob=$lt_want_nocaseglob # DLL creation program. DLLTOOL=$lt_DLLTOOL # Command to associate shared and link libraries. sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd # The archiver. AR=$lt_AR # Flags to create an archive (by configure). lt_ar_flags=$lt_ar_flags # Flags to create an archive. AR_FLAGS=\${ARFLAGS-"\$lt_ar_flags"} # How to feed a file listing to the archiver. archiver_list_spec=$lt_archiver_list_spec # A symbol stripping program. STRIP=$lt_STRIP # Commands used to install an old-style archive. RANLIB=$lt_RANLIB old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Whether to use a lock for old archive extraction. lock_old_archive_extraction=$lock_old_archive_extraction # A C compiler. LTCC=$lt_CC # LTCC compiler flags. LTCFLAGS=$lt_CFLAGS # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm into a list of symbols to manually relocate. global_symbol_to_import=$lt_lt_cv_sys_global_symbol_to_import # Transform the output of nm in a C name address pair. global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix # The name lister interface. nm_interface=$lt_lt_cv_nm_interface # Specify filename containing input files for \$NM. nm_file_list_spec=$lt_nm_file_list_spec # The root where to search for dependent libraries,and where our libraries should be installed. lt_sysroot=$lt_sysroot # Command to truncate a binary pipe. lt_truncate_bin=$lt_lt_cv_truncate_bin # The name of the directory that contains temporary libtool files. objdir=$objdir # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks # Manifest tool. MANIFEST_TOOL=$lt_MANIFEST_TOOL # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL # Tool to change global to local symbols on Mac OS X. NMEDIT=$lt_NMEDIT # Tool to manipulate fat objects and archives on Mac OS X. LIPO=$lt_LIPO # ldd/readelf like tool for Mach-O binaries on Mac OS X. OTOOL=$lt_OTOOL # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. OTOOL64=$lt_OTOOL64 # Old archive suffix (normally "a"). libext=$libext # Shared library suffix (normally ".so"). shrext_cmds=$lt_shrext_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Variables whose values should be saved in libtool wrapper scripts and # restored at link time. variables_saved_for_relink=$lt_variables_saved_for_relink # Do we need the "lib" prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Library versioning type. version_type=$version_type # Shared library runtime path variable. runpath_var=$runpath_var # Shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Permission mode override for installation of shared libraries. install_override_mode=$lt_install_override_mode # Command to use after installation of a shared archive. postinstall_cmds=$lt_postinstall_cmds # Command to use after uninstallation of a shared archive. postuninstall_cmds=$lt_postuninstall_cmds # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # As "finish_cmds", except a single script fragment to be evaled but # not shown. finish_eval=$lt_finish_eval # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Compile-time system search path for libraries. sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Detected run-time system search path for libraries. sys_lib_dlsearch_path_spec=$lt_configure_time_dlsearch_path # Explicit LT_SYS_LIBRARY_PATH set during ./configure time. configure_time_lt_sys_library_path=$lt_configure_time_lt_sys_library_path # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # The linker used to build libraries. LD=$lt_LD # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds # A language specific compiler. CC=$lt_compiler # Is the compiler the GNU compiler? with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \$shlibpath_var if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds # Specify filename containing input files. file_list_spec=$lt_file_list_spec # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # The directories searched by this compiler when creating a shared library. compiler_lib_search_dirs=$lt_compiler_lib_search_dirs # Dependencies to place before and after the objects being linked to # create a shared library. predep_objects=$lt_predep_objects postdep_objects=$lt_postdep_objects predeps=$lt_predeps postdeps=$lt_postdeps # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path # ### END LIBTOOL CONFIG _LT_EOF cat <<'_LT_EOF' >> "$cfgfile" # ### BEGIN FUNCTIONS SHARED WITH CONFIGURE # func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x$2 in x) ;; *:) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" ;; x:*) eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" ;; *::*) eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" ;; *) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" ;; esac } # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in $*""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } # ### END FUNCTIONS SHARED WITH CONFIGURE _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac ltmain=$ac_aux_dir/ltmain.sh # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? $SED '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" cat <<_LT_EOF >> "$ofile" # ### BEGIN LIBTOOL TAG CONFIG: CXX # The linker used to build libraries. LD=$lt_LD_CXX # How to create reloadable object files. reload_flag=$lt_reload_flag_CXX reload_cmds=$lt_reload_cmds_CXX # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds_CXX # A language specific compiler. CC=$lt_compiler_CXX # Is the compiler the GNU compiler? with_gcc=$GCC_CXX # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_CXX # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_CXX # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_CXX # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_CXX # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object_CXX # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds_CXX archive_expsym_cmds=$lt_archive_expsym_cmds_CXX # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds_CXX module_expsym_cmds=$lt_module_expsym_cmds_CXX # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld_CXX # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_CXX # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_CXX # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct_CXX # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \$shlibpath_var if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute_CXX # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L_CXX # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic_CXX # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath_CXX # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_CXX # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols_CXX # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_CXX # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_CXX # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_CXX # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds_CXX # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds_CXX # Specify filename containing input files. file_list_spec=$lt_file_list_spec_CXX # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_CXX # The directories searched by this compiler when creating a shared library. compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX # Dependencies to place before and after the objects being linked to # create a shared library. predep_objects=$lt_predep_objects_CXX postdep_objects=$lt_postdep_objects_CXX predeps=$lt_predeps_CXX postdeps=$lt_postdeps_CXX # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_CXX # ### END LIBTOOL TAG CONFIG: CXX _LT_EOF ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: *======================================================== * * Configuration for ${PACKAGE}-${VERSION}: * * Source directory: ${srcdir} * Installation directory: ${prefix} * C Compiler: ${CC} * * Build shared library: ${enable_shared} * Build static library: ${enable_static} * * Use deprecated code: ${enable_deprecated} * Enable runtime checks: ${enable_check_struct} * Enable logging of data: ${enable_logging} * Enable info routine: ${enable_info} * Experimenal code: ${enable_experimental} * Use Rmath library: ${with_Rmath} * * Support for external uniform random number generators * Rngstream: ${with_urng_rngstream} * PRNG: ${with_urng_prng} * GSL: ${with_urng_gsl} * * Default URNG: ${with_urng_default} * *======================================================== " >&5 printf "%s\n" " *======================================================== * * Configuration for ${PACKAGE}-${VERSION}: * * Source directory: ${srcdir} * Installation directory: ${prefix} * C Compiler: ${CC} * * Build shared library: ${enable_shared} * Build static library: ${enable_static} * * Use deprecated code: ${enable_deprecated} * Enable runtime checks: ${enable_check_struct} * Enable logging of data: ${enable_logging} * Enable info routine: ${enable_info} * Experimenal code: ${enable_experimental} * Use Rmath library: ${with_Rmath} * * Support for external uniform random number generators * Rngstream: ${with_urng_rngstream} * PRNG: ${with_urng_prng} * GSL: ${with_urng_gsl} * * Default URNG: ${with_urng_default} * *======================================================== " >&6; } unuran-1.11.0/doc/0000755001357500135600000000000014430713526010667 500000000000000unuran-1.11.0/doc/unuran.html0000644001357500135600000525323114430713517013020 00000000000000 UNU.RAN User Manual

UNU.RAN – Universal Non-Uniform RANdom number generators

UNU.RAN (Universal Non-Uniform RAndom Number generator) is a collection of algorithms for generating non-uniform pseudorandom variates as a library of C functions designed and implemented by the ARVAG (Automatic Random VAriate Generation) project group in Vienna, and released under the GNU Public License (GPL). It is especially designed for such situations where

  • a non-standard distribution or a truncated distribution is needed.
  • experiments with different types of distributions are made.
  • random variates for variance reduction techniques are used.
  • fast generators of predictable quality are necessary.

Of course it is also well suited for standard distributions. However due to its more sophisticated programming interface it might not be as easy to use if you only look for a generator for the standard normal distribution. (Although UNU.RAN provides generators that are superior in many aspects to those found in quite a number of other libraries.)

UNU.RAN implements several methods for generating random numbers. The choice depends primary on the information about the distribution can be provided and – if the user is familar with the different methods – on the preferences of the user.

The design goals of UNU.RAN are to provide reliable, portable and robust (as far as this is possible) functions with a consisent and easy to use interface. It is suitable for all situation where experiments with different distributions including non-standard distributions. For example it is no problem to replace the normal distribution by an empirical distribution in a model.

Since originally designed as a library for so called black-box or universal algorithms its interface is different from other libraries. (Nevertheless it also contains special generators for standard distributions.) It does not provide subroutines for random variate generation for particular distributions. Instead it uses an object-oriented interface. Distributions and generators are treated as independent objects. This approach allows one not only to have different methods for generating non-uniform random variates. It is also possible to choose the method which is optimal for a given situation (e.g. speed, quality of random numbers, using for variance reduction techniques, etc.). It also allows to sample from non-standard distribution or even from distributions that arise in a model and can only be computed in a complicated subroutine.

Sampling from a particular distribution requires the following steps:

  1. Create a distribution object. (Objects for standard distributions are available in the library)
  2. Choose a method.
  3. Initialize the generator, i.e., create the generator object. If the choosen method is not suitable for the given distribution (or if the distribution object contains too little information about the distribution) the initialization routine fails and produces an error message. Thus the generator object does (probably) not produce false results (random variates of a different distribution).
  4. Use this generator object to sample from the distribution.

There are four types of objects that can be manipulated independently:

  • Distribution objects: hold all information about the random variates that should be generated. The following types of distributions are available:
    • Continuous and Discrete distributions
    • Empirical distributions
    • Multivariate distributions

    Of course a library of standard distributions is included (and these can be further modified to get, e.g., truncated distributions). Moreover the library provides subroutines to build almost arbitrary distributions.

  • Generator objects: hold the generators for the given distributions. It is possible to build independent generator objects for the same distribution object which might use the same or different methods for generation. (If the choosen method is not suitable for the given method, a NULL pointer is returned in the initialization step).
  • Parameter objects: Each transformation method requires several parameters to adjust the generator to a given distribution. The parameter object holds all this information. When created it contains all necessary default settings. It is only used to create a generator object and destroyed immediately. Altough there is no need to change these parameters or even know about their existence for “usual distributions”, they allow a fine tuning of the generator to work with distributions with some awkward properties. The library provides all necessary functions to change these default parameters.
  • Uniform Random Number Generators: All generator objects need one (or more) streams of uniform random numbers that are transformed into random variates of the given distribution. These are given as pointers to appropriate functions or structures (objects). Two generator objects may have their own uniform random number generators or share a common one. Any functions that produce uniform (pseudo-) random numbers can be used. We suggest Otmar Lendl’s PRNG library.

Table of Contents


1 Introduction


1.1 Usage of this document

We designed this document in a way such that one can use UNU.RAN with reading as little as necessary. Read Installation for the instructions to install the library. Concepts of UNU.RAN, discribes the basics of UNU.RAN. It also has a short guideline for choosing an appropriate method. In Examples examples are given that can be copied and modified. They also can be found in the directory examples in the source tree.

Further information are given in consecutive chapters. Handling distribution objects, describes how to create and manipulate distribution objects. standard distributions, describes predefined distribution objects that are ready to use. Methods for generating non-uniform random variates describes the various methods in detail. For each of possible distribution classes (continuous, discrete, empirical, multivariate) there exists a short overview section that can be used to choose an appropriate method followed by sections that describe each of the particular methods in detail. These are merely for users with some knowledge about the methods who want to change method-specific parameters and can be ignored by others.

Abbreviations and explanation of some basic terms can be found in Glossary.


1.2 Installation

UNU.RAN was developed on an Intel architecture under Linux with the GNU C compiler but should compile and run on any computing environment. It requires an ANSI compliant C compiler.

Below find the installation instructions for unices.

Uniform random number generator

UNU.RAN can be used with any uniform random number generator but (at the moment) some features work best with Pierre L’Ecuyer’s RngStreams library (see http://statmath.wu.ac.at/software/RngStreams/ for a description and downloading. For details on using uniform random number in UNU.RAN see Using uniform random number generators.

Install the required libraries first.

UNU.RAN

  1. First unzip and untar the package and change to the directory:
    tar zxvf unuran-1.11.0.tar.gz
    cd unuran-1.11.0
    
  2. Optional: Edit the file src/unuran_config.h
  3. Run a configuration script:
    sh ./configure --prefix=<prefix>
    

    where <prefix> is the root of the installation tree. When omitted /usr/local is used.

    Use ./configure --help to get a list of other options. In particular the following flags are important:

    • Enable support for some external sources of uniform random number generators (see Using uniform random number generators):
      --with-urng-rngstream

      URNG: use Pierre L’Ecuyer’s RNGSTREAM library [default=no]

      --with-urng-prng

      URNG: use Otmar Lendl’s PRNG library [default=no]

      --with-urng-gsl

      URNG: use random number generators from GNU Scientific Library [default=no]

      --with-urng-default

      URNG: global default URNG (builtin|rngstream) [default=builtin]

      We strongly recommend to use RngStreams library:

      sh ./configure --with-urng-rngstream --with-urng-default=rngstream
      

      Important: You must install the respective libraries RngStreams, PRNG and GSL before ./configure is executed.

    • Also make a shared library:
      --enable-shared

      build shared libraries [default=no]

    • The library provides the function unur_gen_info for information about generator objects. This is intented for using in interactive computing environments. This feature can be enabled / disabled by means of the configure flag
      --enable-info

      INFO: provide function with information about generator objects [default=yes]

    • Enable support for deprecated UNU.RAN routines if you have some problems with older application after upgrading the library:
      --enable-deprecated

      enable support for deprecated UNU.RAN routines [default=no]

    • Enable debugging tools:
      --enable-check-struct

      Debug: check validity of pointers to structures [default=no]

      --enable-logging

      Debug: print informations about generator into logfile [default=no]

  4. Compile and install the libray:
    make
    make install
    

    Obviously $(prefix)/include and $(prefix)/lib must be in the search path of your compiler. You can use environment variables to add these directories to the search path. If you are using the bash type (or add to your profile):

    export LIBRARY_PATH="<prefix>/lib"
    export C_INCLURE_PATH="<prefix>/include"
    

    If you want to make a shared library, then making such a library can be enabled using

    sh ./configure --enable-shared
    

    If you want to link against the shared library make sure that it can be found when executing the binary that links to the library. If it is not installed in the usual path, then the easiest way is to set the LD_LIBRARY_PATH environment variable. See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages.

  5. Documentation in various formats (PDF, HTML, info, plain text) can be found in directory doc.
  6. You can run some tests by
    make check
    

    However, some of these tests requires the usage of the PRNG or RngStreams library and are only executed if these are installed enabled by the corresponding configure flag.

    An extended set of tests is run by

    make fullcheck
    

    However some of these might fail occasionally due to roundoff errors or the mysteries of floating point arithmetic, since we have used some extreme settings to test the library.

Upgrading

  • Important:

    UNU.RAN now relies on some aspects of IEEE 754 compliant floating point arithmetic. In particular, 1./0. and 0./0. must result in infinity and NaN (not a number), respectively, and must not cause a floating point exception. For allmost all modern compting architecture this is implemented in hardware. For others there should be a special compiler flag to get this feature (e.g., -MIEEE on DEC alpha or -mp for the Intel C complier).

  • Upgrading UNU.RAN from version 0.9.x or earlier:

    With UNU.RAN version 1.0.x some of the macro definitions in file src/unuran_config.h are moved into file config.h and are set/controlled by the ./configure script.

    Writting logging information into the logfile must now be enabled when running the configure script:

    sh ./configure --enable-logging
    
  • Upgrading UNU.RAN from version 0.7.x or earlier:

    With UNU.RAN version 0.8.0 the interface for changing underlying distributions and running a reinitialization routine has been simplified. The old routines can be compiled into the library using the following configure flag:

    sh ./configure --enable-deprecated
    

    Notice: Using these deprecated routines is not supported any more and this strong discouraged.

    Wrapper functions for external sources of uniform random numbers are now enabled by configure flags and not by macros defined in file src/unuran_config.h.

    The file src/unuran_config.h is not installed any more. It is now only included when the library is compiled. It should be removed from the global include path of the compiler.


1.3 Using the library

ANSI C Compliance

The library is written in ANSI C and is intended to conform to the ANSI C standard. It should be portable to any system with a working ANSI C compiler.

The library does not rely on any non-ANSI extensions in the interface it exports to the user. Programs you write using UNU.RAN can be ANSI compliant. Extensions which can be used in a way compatible with pure ANSI C are supported, however, via conditional compilation. This allows the library to take advantage of compiler extensions on those platforms which support them.

To avoid namespace conflicts all exported function names and variables have the prefix unur_, while exported macros have the prefix UNUR_.

Compiling and Linking

If you want to use the library you must include the UNU.RAN header file

#include <unuran.h>

If you also need the test routines then also add

#include <unuran_tests.h>

If wrapper functions for external sources of uniform random number generators are used, the corresponding header files must also be included, e.g.,

#include <unuran_urng_rngstream.h>

If these header files are not installed on the standard search path of your compiler you will also need to provide its location to the preprocessor as a command line flag. The default location of the unuran.h is /usr/local/include. A typical compilation command for a source file app.c with the GNU C compiler gcc is,

gcc -I/usr/local/include -c app.c

This results in an object file app.o. The default include path for gcc searches /usr/local/include automatically so the -I option can be omitted when UNU.RAN is installed in its default location.

The library is installed as a single file, libunuran.a. A shared version of the library is also installed on systems that support shared libraries. The default location of these files is /usr/local/lib. To link against the library you need to specify the main library. The following example shows how to link an application with the library (and the the RNGSTREAMS library if you decide to use this source of uniform pseudo-random numbers),

gcc app.o -lunuran -lrngstreams -lm

Shared Libraries

To run a program linked with the shared version of the library it may be necessary to define the shell variable LD_LIBRARY_PATH to include the directory where the library is installed. For example,

LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

To compile a statically linked version of the program instead, use the -static flag in gcc,

gcc -static app.o -lunuran -lrngstreams -lm

Compatibility with C++

The library header files automatically define functions to have extern "C" linkage when included in C++ programs.


1.4 Concepts of UNU.RAN

UNU.RAN is a C library for generating non-uniformly distributed random variates. Its emphasis is on the generation of non-standard distribution and on streams of random variates of special purposes. It is designed to provide a consistent tool to sample from distributions with various properties. Since there is no universal method that fits for all situations, various methods for sampling are implemented.

UNU.RAN solves this complex task by means of an object oriented programming interface. Three basic objects are used:

  • distribution object UNUR_DISTR
    Hold all information about the random variates that should be generated.
  • generator object UNUR_GEN
    Hold the generators for the given distributions. Two generator objects are completely independent of each other. They may share a common uniform random number generator or have their owns.
  • parameter object UNUR_PAR
    Hold all information for creating a generator object. It is necessary due to various parameters and switches for each of these generation methods.

    Notice that the parameter objects only hold pointers to arrays but do not have their own copy of such an array. Especially, if a dynamically allocated array is used it must not be freed until the generator object has been created!

The idea behind these structures is that creatin distributions, choosing a generation method and draing samples are orthogonal (ie. independent) functions of the library. The parameter object is only introduced due to the necessity to deal with various parameters and switches for each of these generation methods which are required to adjust the algorithms to unusual distributions with extreme properties but have default values that are suitable for most applications. These parameters and the data for distributions are set by various functions.

Once a generator object has been created sampling (from the univariate continuous distribution) can be done by the following command:

double x = unur_sample_cont(generator);

Analogous commands exist for discrete and multivariate distributions. For detailed examples that can be copied and modified see Examples.

Distribution objects

All information about a distribution are stored in objects (structures) of type UNUR_DISTR. UNU.RAN has five different types of distribution objects:

cont

Continuous univariate distributions.

cvec

Continuous multivariate distributions.

discr

Discrete univariate distributions.

cemp

Continuous empirical univariate distribution, ie. given by a sample.

cvemp

Continuous empirical multivariate distribution, ie. given by a sample.

matr

Matrix distributions.

Distribution objects can be created from scratch by the following call

distr = unur_distr_<type>_new();

where <type> is one of the five possible types from the above table. Notice that these commands only create an empty object which still must be filled by means of calls for each type of distribution object (see Handling distribution objects). The naming scheme of these functions is designed to indicate the corresponding type of the distribution object and the task to be performed. It is demonstated on the following example.

unur_distr_cont_set_pdf(distr, mypdf);

This command stores a PDF named mypdf in the distribution object distr which must have the type cont.

Of course UNU.RAN provides an easier way to use standard distributions. Instead of using unur_distr_<type>_new calls and fuctions unur_distr_<type>_set_<…> for setting data, objects for standard distribution can be created by a single call. Eg. to get an object for the normal distribution with mean 2 and standard deviation 5 use

double parameter[2] = {2.0 ,5.0};
UNUR_DISTR *distr = unur_distr_normal(parameter, 2);

For a list of standard distributions see Standard distributions.

Generation methods

The information that a distribution object must contain depends heavily on the chosen generation method choosen.

Brackets indicate optional information while a tilde indicates that only an approximation must be provided. See Glossary, for unfamiliar terms.

Methods for continuous univariate distributions
sample with unur_sample_cont

methodPDFdPDFCDFmodeareaother
AROUxx[x]T-concave
ARSxxT-concave
CEXTwrapper for external generator
CSTDbuild-in standard distribution
HINV[x][x]x
HRBbounded hazard rate
HRDdecreasing hazard rate
HRIincreasing hazard rate
ITDRxxxmonotone with pole
NINV[x]x
NROUx[x]
PINVx[x][~]
SROUxxxT-concave
SSRxxxT-concave
TABLxx[~]all local extrema
TDRxxT-concave
UTDRxx~T-concave

Methods for continuous empirical univariate distributions
sample with unur_sample_cont

EMPK: Requires an observed sample.
EMPL: Requires an observed sample.

Methods for continuous multivariate distributions
sample with unur_sample_vec

NORTA: Requires rank correlation matrix and marginal distributions.
VNROU: Requires the PDF.
MVSTD: Generator for built-in standard distributions.
MVTDR: Requires PDF and gradiant of PDF.

Methods for continuous empirical multivariate distributions
sample with unur_sample_vec

VEMPK: Requires an observed sample.

Methods for discrete univariate distributions
sample with unur_sample_discr

methodPMFPVmodesumother
DARIxx~T-concave
DAU[x]x
DEXTwrapper for external generator
DGT[x]x
DSROUxxxT-concave
DSS[x]xx
DSTDbuild-in standard distribution

Methods for matrix distributions
sample with unur_sample_matr

MCORR: Distribution object for random correlation matrix.

Markov Chain Methods for continuous multivariate distributions
sample with unur_sample_vec

GIBBS: T-concave logPDF and derivatives of logPDF.
HITRO: Requires PDF.

Because of tremendous variety of possible problems, UNU.RAN provides many methods. All information for creating a generator object has to be collected in a parameter object first. For example, if the task is to sample from a continuous distribution the method AROU might be a good choice. Then the call

UNUR_PAR *par = unur_arou_new(distribution);

creates an parameter object par with a pointer to the distribution object and default values for all necessary parameters for method AROU. Other methods can be used by replacing arou with the name of the desired methods (in lower case letters):

UNUR_PAR *par = unur_<method>_new(distribution);

This sets the default values for all necessary parameters for the chosen method. These are suitable for almost all applications. Nevertheless, it is possible to control the behavior of the method using corresponding set calls for each method. This might be necessary to adjust the algorithm for an unusual distribution with extreme properties, or just for fine tuning the perforence of the algorithm. The following example demonstrates how to change the maximum number of iterations for method NINV to the value 50:

unur_ninv_set_max_iteration(par, 50);

All available methods are described in details in Methods for generating non-uniform random variates.

Creating a generator object

Now it is possible to create a generator object:

UNUR_GEN *generator = unur_init(par);
if (generator == NULL) exit(EXIT_FAILURE);

Important: You must always check whether unur_init has been executed successfully. Otherwise the NULL pointer is returned which causes a segmentation fault when used for sampling.

Important: The call of unur_init destroys the parameter object!
Moreover, it is recommended to call unur_init immediately after the parameter object par has created and modified.

An existing generator object is a rather static construct. Nevertheless, some of the parameters can still be modified by chg calls, e.g.

unur_ninv_chg_max_iteration(gen, 30);

Notice that it is important when parameters are changed because different functions must be used:

The function name includes the term set and the first argument must be of type UNUR_PAR when the parameters are changed before the generator object is created.

The function name includes the term chg and the first argument must be of type UNUR_GEN when the parameters are changed for an existing generator object.

For details see Methods for generating non-uniform random variates.

Sampling

You can now use your generator object in any place of your program to sample from your distribution. You only have to take care about the type of variates it computes: double, int or a vector (array of doubles). Notice that at this point it does not matter whether you are sampling from a gamma distribution, a truncated normal distribution or even an empirical distribution.

Reinitializing

It is possible for a generator object to change the parameters and the domain of the underlying distribution. This must be done by extracting this object by means of a unur_get_distr call and changing the distribution using the correspondig set calls, see Handling distribution objects. The generator object must then be reinitialized by means of the unur_reinit call.

Important: Currently not all methods allow reinitialization, see the description of the particular method (keyword Reinit).

Destroy

When you do not need your generator object any more, you should destroy it:

unur_free(generator);

Uniform random numbers

Each generator object can have its own uniform random number generator or share one with others. When created a parameter object the pointer for the uniform random number generator is set to the default generator. However, it can be changed at any time to any other generator:

unur_set_urng(par, urng);

or

unur_chg_urng(generator, urng);

respectively. See Using uniform random number generators, for details.


1.5 Contact the authors

If you have any problems with UNU.RAN, suggestions how to improve the library, or find a bug, please contact us via email .

For news please visit out homepage at http://statmath.wu.ac.at/unuran/.


2 Examples

The examples in this chapter should compile cleanly and can be found in the directory examples of the source tree of UNU.RAN. Assuming that UNU.RAN as well as the PRNG libraries have been installed properly (see Installation) each of these can be compiled (using the GCC in this example) with

gcc -Wall -O2 -o example example.c -lunuran -lprng -lm

Remark: -lprng must be omitted when the PRNG library is not installed. Then however some of the examples might not work.

The library uses three objects: UNUR_DISTR, UNUR_PAR and UNUR_GEN. It is not important to understand the details of these objects but it is important not to changed the order of their creation. The distribution object can be destroyed after the generator object has been made. (The parameter object is freed automatically by the unur_init call.) It is also important to check the result of the unur_init call. If it has failed the NULL pointer is returned and causes a segmentation fault when used for sampling.

We give all examples with the UNU.RAN standard API and the more convenient string API.


2.1 As short as possible

Select a distribution and let UNU.RAN do all necessary steps.

/* ------------------------------------------------------------- */
/* File: example0.c                                              */
/* ------------------------------------------------------------- */

/* Include UNURAN header file.                                   */
#include <unuran.h>

/* ------------------------------------------------------------- */

int main(void)
{
  int    i;     /* loop variable                                 */
  double x;     /* will hold the random number                   */

  /* Declare the three UNURAN objects.                           */
  UNUR_DISTR *distr;    /* distribution object                   */
  UNUR_PAR   *par;      /* parameter object                      */
  UNUR_GEN   *gen;      /* generator object                      */

  /* Use a predefined standard distribution:                     */
  /*   Gaussian with mean zero and standard deviation 1.         */
  /*   Since this is the standard form of the distribution,      */
  /*   we need not give these parameters.                        */
  distr = unur_distr_normal(NULL, 0);

  /* Use method AUTO:                                            */
  /*   Let UNURAN select a suitable method for you.              */
  par = unur_auto_new(distr);

  /* Now you can change some of the default settings for the     */
  /* parameters of the chosen method. We don't do it here.       */

  /* Create the generator object.                                */
  gen = unur_init(par);

  /* Notice that this call has also destroyed the parameter      */
  /* object `par' as a side effect.                              */

  /* It is important to check if the creation of the generator   */
  /* object was successful. Otherwise `gen' is the NULL pointer  */ 
  /* and would cause a segmentation fault if used for sampling.  */
  if (gen == NULL) {
     fprintf(stderr, "ERROR: cannot create generator object\n");
     exit (EXIT_FAILURE);
  }

  /* It is possible to reuse the distribution object to create   */
  /* another generator object. If you do not need it any more,   */
  /* it should be destroyed to free memory.                      */
  unur_distr_free(distr);

  /* Now you can use the generator object `gen' to sample from   */
  /* the standard Gaussian distribution.                         */
  /* Eg.:                                                        */
  for (i=0; i<10; i++) {
    x = unur_sample_cont(gen);
    printf("%f\n",x);
  }

  /* When you do not need the generator object any more, you     */
  /* can destroy it.                                             */
  unur_free(gen);

  exit (EXIT_SUCCESS);

} /* end of main() */

/* ------------------------------------------------------------- */


2.2 As short as possible (String API)

Select a distribution and let UNU.RAN do all necessary steps.

/* ------------------------------------------------------------- */
/* File: example0_str.c                                          */
/* ------------------------------------------------------------- */
/* String API.                                                   */
/* ------------------------------------------------------------- */

/* Include UNURAN header file.                                   */
#include <unuran.h>

/* ------------------------------------------------------------- */

int main(void)
{
  int    i;     /* loop variable                                 */
  double x;     /* will hold the random number                   */

  /* Declare UNURAN generator object.                            */
  UNUR_GEN   *gen;      /* generator object                      */

  /* Create the generator object.                                */
  /* Use a predefined standard distribution:                     */
  /*   Standard Gaussian distribution.                           */
  /* Use method AUTO:                                            */
  /*   Let UNURAN select a suitable method for you.              */
  gen = unur_str2gen("normal()");         

  /* It is important to check if the creation of the generator   */
  /* object was successful. Otherwise `gen' is the NULL pointer  */ 
  /* and would cause a segmentation fault if used for sampling.  */
  if (gen == NULL) {
     fprintf(stderr, "ERROR: cannot create generator object\n");
     exit (EXIT_FAILURE);
  }

  /* Now you can use the generator object `gen' to sample from   */
  /* the standard Gaussian distribution.                         */
  /* Eg.:                                                        */
  for (i=0; i<10; i++) {
    x = unur_sample_cont(gen);
    printf("%f\n",x);
  }

  /* When you do not need the generator object any more, you     */
  /* can destroy it.                                             */
  unur_free(gen);

  exit (EXIT_SUCCESS);

} /* end of main() */

/* ------------------------------------------------------------- */


2.3 Select a method

Select method AROU and use it with default parameters.

/* ------------------------------------------------------------- */
/* File: example1.c                                              */
/* ------------------------------------------------------------- */

/* Include UNURAN header file.                                   */
#include <unuran.h>

/* ------------------------------------------------------------- */

int main(void)
{
  int    i;     /* loop variable                                 */
  double x;     /* will hold the random number                   */

  /* Declare the three UNURAN objects.                           */
  UNUR_DISTR *distr;    /* distribution object                   */
  UNUR_PAR   *par;      /* parameter object                      */
  UNUR_GEN   *gen;      /* generator object                      */

  /* Use a predefined standard distribution:                     */
  /*   Gaussian with mean zero and standard deviation 1.         */
  /*   Since this is the standard form of the distribution,      */
  /*   we need not give these parameters.                        */
  distr = unur_distr_normal(NULL, 0);

  /* Choose a method: AROU.                                      */
  /* For other (suitable) methods replace "arou" with the        */
  /* respective name (in lower case letters).                    */
  par = unur_arou_new(distr);

  /* Now you can change some of the default settings for the     */
  /* parameters of the chosen method. We don't do it here.       */

  /* Create the generator object.                                */
  gen = unur_init(par);

  /* Notice that this call has also destroyed the parameter      */
  /* object `par' as a side effect.                              */

  /* It is important to check if the creation of the generator   */
  /* object was successful. Otherwise `gen' is the NULL pointer  */ 
  /* and would cause a segmentation fault if used for sampling.  */
  if (gen == NULL) {
     fprintf(stderr, "ERROR: cannot create generator object\n");
     exit (EXIT_FAILURE);
  }

  /* It is possible to reuse the distribution object to create   */
  /* another generator object. If you do not need it any more,   */
  /* it should be destroyed to free memory.                      */
  unur_distr_free(distr);

  /* Now you can use the generator object `gen' to sample from   */
  /* the standard Gaussian distribution.                         */
  /* Eg.:                                                        */
  for (i=0; i<10; i++) {
    x = unur_sample_cont(gen);
    printf("%f\n",x);
  }

  /* When you do not need the generator object any more, you     */
  /* can destroy it.                                             */
  unur_free(gen);

  exit (EXIT_SUCCESS);

} /* end of main() */

/* ------------------------------------------------------------- */


2.4 Select a method (String API)

Select method AROU and use it with default parameters.

/* ------------------------------------------------------------- */
/* File: example1_str.c                                          */
/* ------------------------------------------------------------- */
/* String API.                                                   */
/* ------------------------------------------------------------- */

/* Include UNURAN header file.                                   */
#include <unuran.h>

/* ------------------------------------------------------------- */

int main(void)
{
  int    i;     /* loop variable                                 */
  double x;     /* will hold the random number                   */

  /* Declare UNURAN generator object.                            */
  UNUR_GEN   *gen;      /* generator object                      */

  /* Create the generator object.                                */
  /* Use a predefined standard distribution:                     */
  /*   Standard Gaussian distribution.                           */
  /* Choose a method: AROU.                                      */
  /*   For other (suitable) methods replace "arou" with the      */
  /*   respective name.                                          */
  gen = unur_str2gen("normal() & method=arou");         

  /* It is important to check if the creation of the generator   */
  /* object was successful. Otherwise `gen' is the NULL pointer  */ 
  /* and would cause a segmentation fault if used for sampling.  */
  if (gen == NULL) {
     fprintf(stderr, "ERROR: cannot create generator object\n");
     exit (EXIT_FAILURE);
  }

  /* Now you can use the generator object `gen' to sample from   */
  /* the standard Gaussian distribution.                         */
  /* Eg.:                                                        */
  for (i=0; i<10; i++) {
    x = unur_sample_cont(gen);
    printf("%f\n",x);
  }

  /* When you do not need the generator object any more, you     */
  /* can destroy it.                                             */
  unur_free(gen);

  exit (EXIT_SUCCESS);

} /* end of main() */

/* ------------------------------------------------------------- */


2.5 Arbitrary distributions

If you want to sample from a non-standard distribution, UNU.RAN might be exactly what you need. Depending on the information is available, a method must be choosen for sampling, see Concepts of UNU.RAN for an overview and Methods for generating non-uniform random variates for details.

/* ------------------------------------------------------------- */
/* File: example2.c                                              */
/* ------------------------------------------------------------- */

/* Include UNURAN header file.                                   */
#include <unuran.h>

/* ------------------------------------------------------------- */

/* In this example we build a distribution object from scratch   */
/* and sample from this distribution.                            */
/*                                                               */
/* We use method TDR (Transformed Density Rejection) which       */
/* required a PDF and the derivative of the PDF.                 */

/* ------------------------------------------------------------- */

/* Define the PDF and dPDF of our distribution.                  */
/*                                                               */
/* Our distribution has the PDF                                  */
/*                                                               */
/*          /  1 - x*x  if |x| <= 1                              */
/*  f(x) = <                                                     */
/*          \  0        otherwise                                */
/*                                                               */

/* The PDF of our distribution:                                  */
double mypdf( double x, const UNUR_DISTR *distr )
     /* The second argument (`distr') can be used for parameters */
     /* for the PDF. (We do not use parameters in our example.)  */
{
  if (fabs(x) >= 1.)
    return 0.;
  else
    return (1.-x*x);
} /* end of mypdf() */

/* The derivative of the PDF of our distribution:                */
double mydpdf( double x, const UNUR_DISTR *distr )
{
  if (fabs(x) >= 1.)
    return 0.;
  else
    return (-2.*x);
} /* end of mydpdf() */

/* ------------------------------------------------------------- */

int main(void)
{
  int    i;     /* loop variable                                 */
  double x;     /* will hold the random number                   */

  /* Declare the three UNURAN objects.                           */
  UNUR_DISTR *distr;    /* distribution object                   */
  UNUR_PAR   *par;      /* parameter object                      */
  UNUR_GEN   *gen;      /* generator object                      */

  /* Create a new distribution object from scratch.              */
  /* It is a continuous distribution, and we need a PDF and the  */
  /* derivative of the PDF. Moreover we set the domain.          */

  /* Get empty distribution object for a continuous distribution */
  distr = unur_distr_cont_new();

  /* Assign the PDF and dPDF (defined above).                    */
  unur_distr_cont_set_pdf( distr, mypdf );
  unur_distr_cont_set_dpdf( distr, mydpdf );

  /* Set the domain of the distribution (optional for TDR).      */
  unur_distr_cont_set_domain( distr, -1., 1. );

  /* Choose a method: TDR.                                       */
  par = unur_tdr_new(distr);

  /* Now you can change some of the default settings for the     */
  /* parameters of the chosen method. We don't do it here.       */

  /* Create the generator object.                                */
  gen = unur_init(par);

  /* Notice that this call has also destroyed the parameter      */
  /* object `par' as a side effect.                              */

  /* It is important to check if the creation of the generator   */
  /* object was successful. Otherwise `gen' is the NULL pointer  */ 
  /* and would cause a segmentation fault if used for sampling.  */
  if (gen == NULL) {
     fprintf(stderr, "ERROR: cannot create generator object\n");
     exit (EXIT_FAILURE);
  }

  /* It is possible to reuse the distribution object to create   */
  /* another generator object. If you do not need it any more,   */
  /* it should be destroyed to free memory.                      */
  unur_distr_free(distr);

  /* Now you can use the generator object `gen' to sample from   */
  /* the distribution. Eg.:                                      */
  for (i=0; i<10; i++) {
    x = unur_sample_cont(gen);
    printf("%f\n",x);
  }

  /* When you do not need the generator object any more, you     */
  /* can destroy it.                                             */
  unur_free(gen);

  exit (EXIT_SUCCESS);

} /* end of main() */

/* ------------------------------------------------------------- */



2.6 Arbitrary distributions (String API)

If you want to sample from a non-standard distribution, UNU.RAN might be exactly what you need. Depending on the information is available, a method must be choosen for sampling, see Concepts of UNU.RAN for an overview and Methods for generating non-uniform random variates for details.

/* ------------------------------------------------------------- */
/* File: example2_str.c                                          */
/* ------------------------------------------------------------- */
/* String API.                                                   */
/* ------------------------------------------------------------- */

/* Include UNURAN header file.                                   */
#include <unuran.h>

/* ------------------------------------------------------------- */

/* In this example we use a generic distribution object          */
/* and sample from this distribution.                            */
/*                                                               */
/* The PDF of our distribution is given by                       */
/*                                                               */
/*          /  1 - x*x  if |x| <= 1                              */
/*  f(x) = <                                                     */
/*          \  0        otherwise                                */
/*                                                               */
/* We use method TDR (Transformed Density Rejection) which       */
/* required a PDF and the derivative of the PDF.                 */

/* ------------------------------------------------------------- */

int main(void)
{
  int    i;     /* loop variable                                 */
  double x;     /* will hold the random number                   */

  /* Declare UNURAN generator object.                            */
  UNUR_GEN   *gen;      /* generator object                      */

  /* Create the generator object.                                */
  /* Use a generic continuous distribution.                      */
  /* Choose a method: TDR.                                       */
  gen = unur_str2gen(
        "distr = cont; pdf=\"1-x*x\"; domain=(-1,1) & method=tdr");

  /* It is important to check if the creation of the generator   */
  /* object was successful. Otherwise `gen' is the NULL pointer  */ 
  /* and would cause a segmentation fault if used for sampling.  */
  if (gen == NULL) {
     fprintf(stderr, "ERROR: cannot create generator object\n");
     exit (EXIT_FAILURE);
  }

  /* Now you can use the generator object `gen' to sample from   */
  /* the distribution. Eg.:                                      */
  for (i=0; i<10; i++) {
    x = unur_sample_cont(gen);
    printf("%f\n",x);
  }

  /* When you do not need the generator object any more, you     */
  /* can destroy it.                                             */
  unur_free(gen);

  exit (EXIT_SUCCESS);

} /* end of main() */

/* ------------------------------------------------------------- */



2.7 Change parameters of the method

Each method for generating random numbers allows several parameters to be modified. If you do not want to use default values, it is possible to change them. The following example illustrates how to change parameters. For details see Methods for generating non-uniform random variates.

/* ------------------------------------------------------------- */
/* File: example3.c                                              */
/* ------------------------------------------------------------- */

/* Include UNURAN header file.                                   */
#include <unuran.h>

/* ------------------------------------------------------------- */

int main(void)
{
  int    i;          /* loop variable                            */
  double x;          /* will hold the random number              */

  double fparams[2]; /* array for parameters for distribution    */

  /* Declare the three UNURAN objects.                           */
  UNUR_DISTR *distr;    /* distribution object                   */
  UNUR_PAR   *par;      /* parameter object                      */
  UNUR_GEN   *gen;      /* generator object                      */

  /* Use a predefined standard distribution:                     */
  /*   Gaussian with mean 2. and standard deviation 0.5.         */
  fparams[0] = 2.;
  fparams[1] = 0.5;
  distr = unur_distr_normal( fparams, 2 );

  /* Choose a method: TDR.                                       */
  par = unur_tdr_new(distr);

  /* Change some of the default parameters.                      */

  /* We want to use T(x)=log(x) for the transformation.          */
  unur_tdr_set_c( par, 0. );

  /* We want to have the variant with immediate acceptance.      */
  unur_tdr_set_variant_ia( par );

  /* We want to use 10 construction points for the setup         */
  unur_tdr_set_cpoints ( par, 10, NULL );

  /* Create the generator object.                                */
  gen = unur_init(par);

  /* Notice that this call has also destroyed the parameter      */
  /* object `par' as a side effect.                              */

  /* It is important to check if the creation of the generator   */
  /* object was successful. Otherwise `gen' is the NULL pointer  */ 
  /* and would cause a segmentation fault if used for sampling.  */
  if (gen == NULL) {
     fprintf(stderr, "ERROR: cannot create generator object\n");
     exit (EXIT_FAILURE);
  }

  /* It is possible to reuse the distribution object to create   */
  /* another generator object. If you do not need it any more,   */
  /* it should be destroyed to free memory.                      */
  unur_distr_free(distr);

  /* Now you can use the generator object `gen' to sample from   */
  /* the distribution. Eg.:                                      */
  for (i=0; i<10; i++) {
    x = unur_sample_cont(gen);
    printf("%f\n",x);
  }

  /* It is possible with method TDR to truncate the distribution */
  /* for an existing generator object ...                        */
  unur_tdr_chg_truncated( gen, -1., 0. );

  /* ... and sample again.                                       */
  for (i=0; i<10; i++) {
    x = unur_sample_cont(gen);
    printf("%f\n",x);
  }

  /* When you do not need the generator object any more, you     */
  /* can destroy it.                                             */
  unur_free(gen);

  exit (EXIT_SUCCESS);

} /* end of main() */

/* ------------------------------------------------------------- */

2.8 Change parameters of the method (String API)

Each method for generating random numbers allows several parameters to be modified. If you do not want to use default values, it is possible to change them. The following example illustrates how to change parameters. For details see Methods for generating non-uniform random variates.

/* ------------------------------------------------------------- */
/* File: example3_str.c                                              */
/* ------------------------------------------------------------- */
/* String API.                                                   */
/* ------------------------------------------------------------- */

/* Include UNURAN header file.                                   */
#include <unuran.h>

/* ------------------------------------------------------------- */

int main(void)
{
  int    i;          /* loop variable                            */
  double x;          /* will hold the random number              */

  /* Declare UNURAN generator object.                            */
  UNUR_GEN   *gen;      /* generator object                      */

  /* Create the generator object.                                */
  /* Use a predefined standard distribution:                     */
  /*   Gaussian with mean 2. and standard deviation 0.5.         */
  /* Choose a method: TDR with parameters                        */
  /*   c = 0: use T(x)=log(x) for the transformation;            */
  /*   variant "immediate acceptance";                           */
  /*   number of construction points = 10.                       */
  gen = unur_str2gen(
       "normal(2,0.5) & method=tdr; c=0.; variant_ia; cpoints=10");         

  /* It is important to check if the creation of the generator   */
  /* object was successful. Otherwise `gen' is the NULL pointer  */ 
  /* and would cause a segmentation fault if used for sampling.  */
  if (gen == NULL) {
     fprintf(stderr, "ERROR: cannot create generator object\n");
     exit (EXIT_FAILURE);
  }

  /* Now you can use the generator object `gen' to sample from   */
  /* the distribution. Eg.:                                      */
  for (i=0; i<10; i++) {
    x = unur_sample_cont(gen);
    printf("%f\n",x);
  }

  /* It is possible with method TDR to truncate the distribution */
  /* for an existing generator object ...                        */
  unur_tdr_chg_truncated( gen, -1., 0. );

  /* ... and sample again.                                       */
  for (i=0; i<10; i++) {
    x = unur_sample_cont(gen);
    printf("%f\n",x);
  }

  /* When you do not need the generator object any more, you     */
  /* can destroy it.                                             */
  unur_free(gen);

  exit (EXIT_SUCCESS);

} /* end of main() */

/* ------------------------------------------------------------- */

2.9 Change uniform random generator

All generator object use the same default uniform random number generator by default. This can be changed to any generator of your choice such that each generator object has its own random number generator or can share it with some other objects. It is also possible to change the default generator at any time. See Using uniform random number generators, for details.

The following example shows how the uniform random number generator can be set or changed for a generator object. It requires the RNGSTREAMS library to be installed and used. Otherwise the example must be modified accordingly.

/* ------------------------------------------------------------- */
/* File: example_rngstreams.c                                    */
/* ------------------------------------------------------------- */
#ifdef UNURAN_SUPPORTS_RNGSTREAM
/* ------------------------------------------------------------- */
/* This example makes use of the RNGSTREAM library for           */
/* for generating uniform random numbers.                        */
/* (see http://statmath.wu.ac.at/software/RngStreams/)           */
/* To compile this example you must have set                     */
/*   ./configure --with-urng-rngstream                           */
/* (Of course the executable has to be linked against the        */
/* RNGSTREAM library.)                                           */
/* ------------------------------------------------------------- */

/* Include UNURAN header files.                                  */
#include <unuran.h>
#include <unuran_urng_rngstreams.h>

/* ------------------------------------------------------------- */

int main(void)
{
  int    i;          /* loop variable                            */
  double x;          /* will hold the random number              */
  double fparams[2]; /* array for parameters for distribution    */

  /* Declare the three UNURAN objects.                           */
  UNUR_DISTR *distr;    /* distribution object                   */
  UNUR_PAR   *par;      /* parameter object                      */
  UNUR_GEN   *gen;      /* generator object                      */

  /* Declare objects for uniform random number generators.       */
  UNUR_URNG  *urng1, *urng2;    /* uniform generator objects     */

  /* The RNGSTREAMS library sets a package seed.                 */
  unsigned long seed[] = {111u, 222u, 333u, 444u, 555u, 666u};
  RngStream_SetPackageSeed(seed);

  /* RngStreams only:                                            */
  /* Make a object for uniform random number generator.          */
  /* For details see                                             */
  /* http://statmath.wu.ac.at/software/RngStreams/               */
  urng1 = unur_urng_rngstream_new("urng-1");
  if (urng1 == NULL) exit (EXIT_FAILURE);

  /* Use a predefined standard distribution:                     */
  /*   Beta with parameters 2 and 3.                             */
  fparams[0] = 2.;
  fparams[1] = 3.;
  distr = unur_distr_beta( fparams, 2 );

  /* Choose a method: TDR.                                       */
  par = unur_tdr_new(distr);

  /* Set uniform generator in parameter object                   */
  unur_set_urng( par, urng1 );

  /* Create the generator object.                                */
  gen = unur_init(par);

  /* Notice that this call has also destroyed the parameter      */
  /* object `par' as a side effect.                              */

  /* It is important to check if the creation of the generator   */
  /* object was successful. Otherwise `gen' is the NULL pointer  */ 
  /* and would cause a segmentation fault if used for sampling.  */
  if (gen == NULL) {
     fprintf(stderr, "ERROR: cannot create generator object\n");
     exit (EXIT_FAILURE);
  }

  /* It is possible to reuse the distribution object to create   */
  /* another generator object. If you do not need it any more,   */
  /* it should be destroyed to free memory.                      */
  unur_distr_free(distr);

  /* Now you can use the generator object `gen' to sample from   */
  /* the distribution. Eg.:                                      */
  for (i=0; i<10; i++) {
    x = unur_sample_cont(gen);
    printf("%f\n",x);
  }

  /* Now we want to switch to a different (independent) stream   */
  /* of uniform random numbers.                                  */
  urng2 = unur_urng_rngstream_new("urng-2");
  if (urng2 == NULL) exit (EXIT_FAILURE);
  unur_chg_urng( gen, urng2 );

  /* ... and sample again.                                       */
  for (i=0; i<10; i++) {
    x = unur_sample_cont(gen);
    printf("%f\n",x);
  }

  /* When you do not need the generator object any more, you     */
  /* can destroy it.                                             */
  unur_free(gen);

  /* We also should destroy the uniform random number generators.*/
  unur_urng_free(urng1);
  unur_urng_free(urng2);

  exit (EXIT_SUCCESS);
} /* end of main() */

/* ------------------------------------------------------------- */
#else
#include <stdio.h>
#include <stdlib.h>
int main(void) {
  printf("You must enable the RNGSTREAM library to run this example!\n\n");
  exit (77);    /* exit code for automake check routines */
}
#endif
/* ------------------------------------------------------------- */


2.10 Change parameters of underlying distribution

One a generator object has been created it allows to draw samples from the distribution with the given parameters. However, some methods allow to change the parameters of the underlying distribution and reinitialize the generator object again. Thus when the parameters of the distribution vary for each draw we save overhead for destroying the old object and creating a new one.

The following example shows how the parameters of a GIG distribution can be changed when method CSTD is used.

/* ------------------------------------------------------------- */
/* File: example_reinit.c                                        */
/* ------------------------------------------------------------- */

/* Include UNURAN header file.                                   */
#include <unuran.h>

/* ------------------------------------------------------------- */

/* In this example we show how the parameters of the underlying  */
/* distribution can be changed for an existing generator object. */

/* We use the GIG distribution with method CSTD.                 */

/* ------------------------------------------------------------- */

int main(void)
{
  int    i;     /* loop variable                                 */
  double x;     /* will hold the random number                   */

  /* Parameters of distribution.                                 */ 
  double dparam[3] = {0.5, 1., 5.};

  /* Declare the three UNURAN objects.                           */
  UNUR_DISTR *distr;    /* distribution object                   */
  UNUR_PAR   *par;      /* parameter object                      */
  UNUR_GEN   *gen;      /* generator object                      */

  /* Create initial GIG distribution object                      */
  distr = unur_distr_gig(dparam, 3);

  /* Choose a method: CSTD.                                      */
  par = unur_cstd_new(distr);

  /* Create the generator object.                                */
  gen = unur_init(par);

  /* It is important to check if the creation of the generator   */
  /* object was successful. Otherwise `gen' is the NULL pointer  */ 
  /* and would cause a segmentation fault if used for sampling.  */
  if (gen == NULL) {
     fprintf(stderr, "ERROR: cannot create generator object\n");
     exit (EXIT_FAILURE);
  }

  /* It is possible to reuse the distribution object to create   */
  /* another generator object. If you do not need it any more,   */
  /* it should be destroyed to free memory.                      */
  unur_distr_free(distr);
  
  /* Now you can use the generator object `gen' to sample from   */
  /* the distribution. Eg.:                                      */
  for (i=0; i<10; i++) {
    x = unur_sample_cont(gen);
    printf("%f\n",x);
  }

  /* It is possible for method CSTD to change the parameters of  */
  /* underlying distribution. However, we have to extract to     */
  /* pointer to the distribution. Be carefull with this pointer! */
  distr = unur_get_distr(gen);

  /* Change the parameter(s).                                    */
  dparam[2] = 0.001;
  unur_distr_cont_set_pdfparams(distr,dparam,3);

  /* Do not forget to reinitialize the generator object.         */
  /* Check the return code.                                      */
  /* (and try to find a better error handling)                   */
  if (unur_reinit(gen) != UNUR_SUCCESS) {
    fprintf(stderr, "ERROR: cannot reinitialize generator object\n");
    exit (EXIT_FAILURE);
  }

  /* Draw a new sample.                                          */
  for (i=0; i<10; i++) {
    x = unur_sample_cont(gen);
    printf("%f\n",x);
  }

  /* Changing parameters can be repeated.                        */
  dparam[2] = 1000;
  unur_distr_cont_set_pdfparams(distr,dparam,3);
  if (unur_reinit(gen) != UNUR_SUCCESS) {
    fprintf(stderr, "ERROR: cannot reinitialize generator object\n");
    exit (EXIT_FAILURE);
  }
  for (i=0; i<10; i++) {
    x = unur_sample_cont(gen);
    printf("%f\n",x);
  }

  /* When you do not need the generator object any more, you     */
  /* can destroy it.                                             */
  unur_free(gen);

  exit (EXIT_SUCCESS);

} /* end of main() */

/* ------------------------------------------------------------- */



2.11 Sample pairs of antithetic random variates

Using Method TDR it is easy to sample pairs of antithetic random variates.

/* ------------------------------------------------------------- */
/* File: example_anti.c                                          */
/* ------------------------------------------------------------- */
#ifdef UNURAN_SUPPORTS_PRNG
/* ------------------------------------------------------------- */
/* This example makes use of the PRNG library for generating     */
/* uniform random numbers.                                       */
/* (see http://statmath.wu.ac.at/prng/)                          */
/* To compile this example you must have set                     */
/*   ./configure --with-urng-prng                                */
/* (Of course the executable has to be linked against the        */
/* PRNG library.)                                                */
/* ------------------------------------------------------------- */

/* Example how to sample from two streams of antithetic random   */
/* variates from Gaussian N(2,5) and Gamma(4) distribution, resp.*/

/* ------------------------------------------------------------- */

/* Include UNURAN header files.                                  */
#include <unuran.h>
#include <unuran_urng_prng.h>

/* ------------------------------------------------------------- */

int main(void)
{
  int    i;          /* loop variable                            */
  double xn, xg;     /* will hold the random number              */
  double fparams[2]; /* array for parameters for distribution    */

  /* Declare the three UNURAN objects.                           */
  UNUR_DISTR *distr;    /* distribution object                   */
  UNUR_PAR   *par;      /* parameter object                      */
  UNUR_GEN   *gen_normal, *gen_gamma;
                        /* generator objects                     */

  /* Declare objects for uniform random number generators.       */
  UNUR_URNG  *urng1, *urng2;    /* uniform generator objects     */

  /* PRNG only:                                                  */
  /* Make a object for uniform random number generator.          */
  /* For details see http://statmath.wu.ac.at/prng/.             */


  /* The first generator: Gaussian N(2,5) */

  /* uniform generator: We use the Mersenne Twister.             */
  urng1 = unur_urng_prng_new("mt19937(1237)");
  if (urng1 == NULL) exit (EXIT_FAILURE);

  /* UNURAN generator object for N(2,5) */
  fparams[0] = 2.;
  fparams[1] = 5.;
  distr = unur_distr_normal( fparams, 2 );

  /* Choose method TDR with variant PS.                          */
  par = unur_tdr_new( distr );
  unur_tdr_set_variant_ps( par );

  /* Set uniform generator in parameter object.                  */
  unur_set_urng( par, urng1 );

  /* Set auxilliary uniform random number generator.             */
  /* We use the default generator.                               */
  unur_use_urng_aux_default( par );

  /* Alternatively you can create and use your own auxilliary    */
  /* uniform random number generator:                            */
  /*    UNUR_URNG  *urng_aux;                                    */
  /*    urng_aux = unur_urng_prng_new("tt800");                  */
  /*    if (urng_aux == NULL) exit (EXIT_FAILURE);               */
  /*    unur_set_urng_aux( par, urng_aux );                      */                    

  /* Create the generator object.                                */
  gen_normal = unur_init(par);
  if (gen_normal == NULL) {
     fprintf(stderr, "ERROR: cannot create generator object\n");
     exit (EXIT_FAILURE);
  }

  /* Destroy distribution object (gen_normal has its own copy).  */
  unur_distr_free(distr);


  /* The second generator: Gamma(4) with antithetic variates.    */

  /* uniform generator: We use the Mersenne Twister.             */
  urng2 = unur_urng_prng_new("anti(mt19937(1237))");
  if (urng2 == NULL) exit (EXIT_FAILURE);

  /* UNURAN generator object for gamma(4) */
  fparams[0] = 4.;
  distr = unur_distr_gamma( fparams, 1 );

  /* Choose method TDR with variant PS.                          */
  par = unur_tdr_new( distr );
  unur_tdr_set_variant_ps( par );

  /* Set uniform generator in parameter object.                  */
  unur_set_urng( par, urng2 );

  /* Set auxilliary uniform random number generator.             */
  /* We use the default generator.                               */
  unur_use_urng_aux_default( par );

  /* Alternatively you can create and use your own auxilliary    */
  /* uniform random number generator (see above).                */
  /* Notice that both generator objects gen_normal and           */
  /* gen_gamma can share the same auxilliary URNG.               */

  /* Create the generator object.                                */
  gen_gamma = unur_init(par);
  if (gen_gamma == NULL) {
     fprintf(stderr, "ERROR: cannot create generator object\n");
     exit (EXIT_FAILURE);
  }

  /* Destroy distribution object (gen_normal has its own copy).  */
  unur_distr_free(distr);


  /* Now we can sample pairs of negatively correlated random     */
  /* variates. E.g.:                                             */
  for (i=0; i<10; i++) {
    xn = unur_sample_cont(gen_normal);
    xg = unur_sample_cont(gen_gamma);
    printf("%g, %g\n",xn,xg);
  }


  /* When you do not need the generator objects any more, you    */
  /* can destroy it.                                             */
  unur_free(gen_normal);
  unur_free(gen_gamma);

  /* We also should destroy the uniform random number generators.*/
  unur_urng_free(urng1);
  unur_urng_free(urng2);

  exit (EXIT_SUCCESS);
} /* end of main() */

/* ------------------------------------------------------------- */
#else
#include <stdio.h>
#include <stdlib.h>
int main(void) {
  printf("You must enable the PRNG library to run this example!\n\n");
  exit (77);    /* exit code for automake check routines */
}
#endif
/* ------------------------------------------------------------- */

2.12 Sample pairs of antithetic random variates (String API)

Using Method TDR it is easy to sample pairs of antithetic random variates.

/* ------------------------------------------------------------- */
/* File: example_anti_str.c                                      */
/* ------------------------------------------------------------- */
/* String API.                                                   */
/* ------------------------------------------------------------- */
#ifdef UNURAN_SUPPORTS_PRNG
/* ------------------------------------------------------------- */
/* This example makes use of the PRNG library for generating     */
/* uniform random numbers.                                       */
/* (see http://statmath.wu.ac.at/prng/)                          */
/* To compile this example you must have set                     */
/*   ./configure --with-urng-prng                                */
/* (Of course the executable has to be linked against the        */
/* PRNG library.)                                                */
/* ------------------------------------------------------------- */

/* Example how to sample from two streams of antithetic random   */
/* variates from Gaussian N(2,5) and Gamma(4) distribution, resp.*/

/* ------------------------------------------------------------- */

/* Include UNURAN header files.                                  */
#include <unuran.h>
#include <unuran_urng_prng.h>

/* ------------------------------------------------------------- */

int main(void)
{
  int    i;          /* loop variable                            */
  double xn, xg;     /* will hold the random number              */

  /* Declare UNURAN generator objects.                           */
  UNUR_GEN   *gen_normal, *gen_gamma;

  /* PRNG only:                                                  */
  /* Make a object for uniform random number generator.          */
  /* For details see http://statmath.wu.ac.at/prng/.             */

  /* Create the first generator: Gaussian N(2,5)                 */
  gen_normal = unur_str2gen("normal(2,5) & method=tdr; variant_ps & urng=mt19937(1237)");
  if (gen_normal == NULL) {
     fprintf(stderr, "ERROR: cannot create generator object\n");
     exit (EXIT_FAILURE);
  }
  /* Set auxilliary uniform random number generator.             */
  /* We use the default generator.                               */
  unur_chgto_urng_aux_default(gen_normal);

  /* The second generator: Gamma(4) with antithetic variates.    */
  gen_gamma = unur_str2gen("gamma(4) & method=tdr; variant_ps & urng=anti(mt19937(1237))");
  if (gen_gamma == NULL) {
     fprintf(stderr, "ERROR: cannot create generator object\n");
     exit (EXIT_FAILURE);
  }
  unur_chgto_urng_aux_default(gen_gamma);


  /* Now we can sample pairs of negatively correlated random     */
  /* variates. E.g.:                                             */
  for (i=0; i<10; i++) {
    xn = unur_sample_cont(gen_normal);
    xg = unur_sample_cont(gen_gamma);
    printf("%g, %g\n",xn,xg);
  }


  /* When you do not need the generator objects any more, you    */
  /* can destroy it.                                             */

  /* But first we have to destroy the uniform random number      */
  /* generators.                                                 */
  unur_urng_free(unur_get_urng(gen_normal));
  unur_urng_free(unur_get_urng(gen_gamma));

  unur_free(gen_normal);
  unur_free(gen_gamma);


  exit (EXIT_SUCCESS);
} /* end of main() */

/* ------------------------------------------------------------- */
#else
#include <stdio.h>
#include <stdlib.h>
int main(void) {
  printf("You must enable the PRNG library to run this example!\n\n");
  exit (77);    /* exit code for automake check routines */
}
#endif
/* ------------------------------------------------------------- */

3 String Interface

The string interface (string API) provided by the unur_str2gen call is the easiest way to use UNU.RAN. This function takes a character string as its argument. The string is parsed and the information obtained is used to create a generator object. It returns NULL if this fails, either due to a syntax error, or due to invalid data. In both cases unur_error is set to the corresponding error codes (see Error reporting). Additionally there exists the call unur_str2distr that only produces a distribution object.

Notice that the string interface does not implement all features of the UNU.RAN library. For trickier tasks it might be necessary to use the UNU.RAN calls.

In Examples, all examples are given using both the UNU.RAN standard API and this convenient string API. The corresponding programm codes are equivalent.

Function reference

: UNUR_GEN* unur_str2gen (const char* string)

Get a generator object for the distribution, method and uniform random number generator as described in the given string. See Syntax of String Interface, for details.

: UNUR_DISTR* unur_str2distr (const char* string)

Get a distribution object for the distribution described in string. See Syntax of String Interface, and Distribution String, for details. However, only the block for the distribution object is allowed.

: UNUR_GEN* unur_makegen_ssu (const char* distrstr, const char* methodstr, UNUR_URNG* urng)
: UNUR_GEN* unur_makegen_dsu (const UNUR_DISTR* distribution, const char* methodstr, UNUR_URNG* urng)

Make a generator object for the distribution, method and uniform random number generator. The distribution can be given either as string distrstr or as a distribution object distr. The method must be given as a string methodstr. For the syntax of these strings see Syntax of String Interface. However, the method keyword is optional for these calls and can be omitted. If methodstr is the empty (blank) string or NULL method AUTO is used. The uniform random number generator is optional. If urng is NULL then the default uniform random number generator is used.


3.1 Syntax of String Interface

The given string holds information about the requested distribution and (optional) about the sampling method and the uniform random number generator invoked. The interpretation of the string is not case-sensitive, all white spaces are ignored.

The string consists of up to three blocks, separated by ampersands &.

Each block consists of <key>=<value> pairs, separated by semicolons ;.

The first key in each block is used to indicate each block. We have three different blocks with the following (first) keys:

distr

definition of the distribution (see Distribution String).

method

description of the transformation method (see Method String).

urng

uniform random number generation (see Uniform RNG String).

The distr block must be the very first block and is obligatory. All the other blocks are optional and can be arranged in arbitrary order.

For details see the following description of each block.

In the following example

distr = normal(3.,0.75); domain = (0,inf) & method = tdr; c = 0

we have a distribution block for the truncated normal distribution with mean 3 and standard deviation 0.75 on domain (0,infinity); and block for choosing method TDR with parameter c set to 0.

The <key>=<value> pairs that follow the first (initial) pair in each block are used to set parameters. The name of the parameter is given by the <key> string. It is deduced from the UNU.RAN set calls by taking the part after …_set_. The <value> string holds the parameters to be set, separated by commata ,. There are three types of parameters:

string "…" or '…'

i.e. any sequence of characters enclosed by double quotes "…" or single quotes '…' (there is no distinction between double quotes " and single quotes ').

list (…,…)

i.e. list of numbers, separated by commata ,, enclosed in parenthesis (...).

number

a sequence of characters that is not enclosed by double quotes "…", single quotes '…', or parenthesis (...). It is interpreted as float or integer depending on the type of the corresponding parameter.

The <value> string (including the character =) can be omitted when no argument is required.

At the moment not all set calls are supported. The syntax for the <value> can be directly derived from the corresponding set calls. To simplify the syntax additional shortcuts are possible. The following table lists the parameters for the set calls that are supported by the string interface; the entry in parenthesis gives the type of the argument as <value> string:

int (number):

The number is interpreted as an integer. true and on are transformed to 1, false and off are transformed to 0. A missing argument is interpreted as 1.

int, int (number, number or list):

The two numbers or the first two entries in the list are interpreted as a integers. inf and -inf are transformed to INT_MAX and INT_MIN respectively, i.e. the largest and smallest integers that can be represented by the computer.

unsigned (number):

The number is interpreted as an unsigned hexadecimal integer.

double (number):

The number is interpreted as a floating point number. inf is transformed to UNUR_INFINITY.

double, double (number, number or list):

The two numbers or the first two entries in the list are interpreted as a floating point numbers. inf is transformed to UNUR_INFINITY. However using inf in the list might not work for all versions of C. Then it is recommended to use two single numbers instead of a list.

int, double* ([number,] list or number):
  • The list is interpreted as a double array. The (first) number as its length. If it is less than the actual size of the array only the first entries of the array are used.
  • If only the list is given (i.e., if the first number is omitted), the first number is set to the actual size of the array.
  • If only the number is given (i.e., if the list is omitted), the NULL pointer is used instead an array as argument.
double*, int (list [,number]):

The list is interpreted as a double array. The (second) number as its length. If the length is omitted, it is replaced by the actual size of the array. (Only in the distribution block!)

char* (string):

The character string is passed as is to the corresponding set call.

Notice that missing entries in a list of numbers are interpreted as 0. E.g, a the list (1,,3) is read as (1,0,3), the list (1,2,) as (1,2,0).

The the list of key strings in Keys for Distribution String, and Keys for Method String, for further details.


3.2 Distribution String

The distr block must be the very first block and is obligatory. For that reason the keyword distr is optional and can be omitted (together with the = character). Moreover it is ignored while parsing the string. However, to avoid some possible confusion it has to start with the letter d (if it is given at all).

The value of the distr key is used to get the distribution object, either via a unur_distr_<value> call for a standard distribution via a unur_distr_<value>_new call to get an object of a generic distribution. However not all generic distributions are supported yet.

The parameters for the standard distribution are given as a list. There must not be any character (other than white space) between the name of the standard distribution and the opening parenthesis ( of this list. E.g., to get a beta distribution, use

distr = beta(2,4)

To get an object for a discrete distribution with probability vector (0.5,0.2,0.3), use

distr = discr; pv = (0.5,0.2,0.3)

It is also possible to set a PDF, PMF, or CDF using a string. E.g., to create a continuous distribution with PDF proportional to exp(-sqrt(2+(x-1)^2) + (x-1)) and domain (0,inf) use

distr = cont; pdf = "exp(-sqrt(2+(x-1)^2) + (x-1))"

Notice: If this string is used in an unur_str2distr or unur_str2gen call the double quotes " must be protected by \". Alternatively, single quotes may be used instead

distr = cont; pdf = 'exp(-sqrt(2+(x-1)^2) + (x-1))'

For the details of function strings see Function String.


3.2.1 Keys for Distribution String

List of standard distributions see Standard distributions

List of generic distributions see Handling Distribution Objects

Notice: Order statistics for continuous distributions (see Continuous univariate order statistics) are supported by using the key orderstatistics for distributions of type CONT.

List of keys that are available via the String API. For description see the corresponding UNU.RAN set calls.


3.3 Function String

In unuran it is also possible to define functions (e.g. CDF or PDF) as strings. As you can see in Example 2 (Arbitrary distributions (String API)) it is very easy to define the PDF of a distribution object by means of a string. The possibilities using this string interface are more restricted than using a pointer to a routine coded in C (Arbitrary distributions). But the differences in evaluation time is small. When a distribution object is defined using this string interface then of course the same conditions on the given density or CDF must be satisfied for a chosen method as for the standard API. This string interface can be used for both within the UNU.RAN string API using the unur_str2gen call, and for calls that define the density or CDF for a particular distribution object as done with (e.g.) the call unur_distr_cont_set_pdfstr. Here is an example for the latter case:

unur_distr_cont_set_pdfstr(distr,"1-x*x");

Syntax

The syntax for the function string is case insensitive, white spaces are ingnored. The expressions are similar to most programming languages and mathematical programs (see also the examples below). It is especially influenced by C. The usual preceedence rules are used (from highest to lowest preceedence: functions, power, multiplication, addition, relation operators). Use parentheses in case of doubt or when these preceedences should be changed.

Relation operators can be used as indicator functions, i.e. the term (x>1) is evaluted as 1 if this relation is satisfied, and as 0 otherwise.

The first unknown symbol (letter or word) is interpreted as the variable of the function. It is recommended to use x. Only one variable can be used.

Important: The symbol e is used twice, for Euler’s constant (= 2.7182…) and as exponent. The multiplication operator * must not be omitted, i.e. 2 x is interpreted as the string 2x (which will result in a syntax error).

List of symbols

Numbers

Numbers are composed using digits and, optionally, a sign, a decimal point, and an exponent indicated by e.

SymbolExplanationExamples
0…9digits2343
.decimal point165.567
-negative sign-465.223
eexponet13.2e-4 (=0.00132)

Constants

pipi = 3.1415…3*pi+2
eEuler’s constant3*e+2 (= 10.15…; do not cofuse with 3e2 = 300)
infinfinity(used for domains)

Special symbols

(opening parenthesis2*(3+x)
)closing parenthesis2*(3+x)
,(argument) list separatormod(13,2)

Relation operators (Indicator functions)

<less than(x<1)
=equal(2=x)
==same as =(x==3)
>greater than(x>0)
<=less than or equal(x<=1)
!=not equal(x!0)
<>same as !=(x<>pi)
>=greater or equal(x>=1)

Arithmetic operators

+addition2+x
-subtraction2-x
*multiplication2*x
/divisionx/2
^powerx^2

Functions

modmod(m,n) remainder of devision m over nmod(x,2)
expexponential function (same as e^x)exp(-x^2) (same as e^(-x^2))
lognatural logarithmlog(x)
sinsinesin(x)
coscosinecos(x)
tantangenttan(x)
secsecantsec(x*2)
sqrtsquare rootsqrt(2*x)
absabsolute valueabs(x)
sgnsign functionsign(x)*3

Variable

xvariable3*x^2

Examples

1.231+7.9876*x-1.234e-3*x^2+3.335e-5*x^3
sin(2*pi*x)+x^2
exp(-((x-3)/2.1)^2)

It is also possible to define functions using different terms on separate domains. However, instead of constructs using if … then … else … indicator functions are available.

For example to define the density of triangular distribution with domain (-1,1) and mode 0 use

(x>-1)*(x<0)*(1+x) + (x>=0)*(x<1)*(1-x)

3.4 Method String

The key method is obligatory, it must be the first key and its value is the name of a method suitable for the choosen standard distribution. E.g., if method AROU is chosen, use

method = arou

Of course the all following keys dependend on the method choosen at first. All corresponding set calls of UNU.RAN are available and the key is the string after the unur_<methodname>_set_ part of the command. E.g., UNU.RAN provides the command unur_arou_set_max_sqhratio to set a parameter of method AROU. To call this function via the string-interface, the key max_sqhratio can be used:

max_sqhratio = 0.9

Additionally the keyword debug can be used to set debugging flags (see Debugging, for details).

If this block is omitted, a suitable default method is used. Notice however that the default method may change in future versions of UNU.RAN.


3.4.1 Keys for Method String

List of methods and keys that are available via the String API. For description see the corresponding UNU.RAN set calls.


3.5 Uniform RNG String

The value of the urng key is passed to the PRNG interface (see PRNG manual for details). However it only works when using the PRNG library is enabled, see Installation for details. There are no other keys.

IMPORTANT: UNU.RAN creates a new uniform random number generator for the generator object. The pointer to this uniform generator has to be read and saved via a unur_get_urng call in order to clear the memory before the UNU.RAN generator object is destroyed.

If this block is omitted the UNU.RAN default generator is used (which must not be destroyed).


4 Handling distribution objects

Objects of type UNUR_DISTR are used for handling distributions. All data about a distribution are stored in this object. UNU.RAN provides functions that return instances of such objects for standard distributions (see Standard distributions). It is then possible to change these distribution objects by various set calls. Moreover, it is possible to build a distribution object entirely from scratch. For this purpose there exists unur_distr_<type>_new calls that return an empty object of this type for each object type (eg. univariate contiuous) which can be filled with the appropriate set calls.

UNU.RAN distinguishes between several types of distributions, each of which has its own sets of possible parameters (for details see the corresponding sections):

  • continuous univariate distributions
  • continuous univariate order statistics
  • continuous empirical univariate distributions
  • continuous multivariate distributions
  • continuous empirical multivariate distributions
  • matrix distributions
  • discrete univariate distributions

Notice that there are essential data about a distribution, eg. the PDF, a list of (shape, scale, location) parameters for the distribution, and the domain of (the possibly truncated) distribution. And there exist parameters that are/can be derived from these, eg. the mode of the distribution or the area below the given PDF (which need not be normalized for many methods). UNU.RAN keeps track of parameters which are known. Thus if one of the essential parameters is changed all derived parameters are marked as unknown and must be set again if these are required for the chosen generation method. Additionally to set calls there are calls for updating derived parameters for objects provided by the UNU.RAN library of standard distributions (one for each parameter to avoid computational overhead since not all parameters are required for all generator methods).

All parameters of distribution objects can be read by corresponding get calls.

Every generator object has its own copy of a distribution object which is accessible by a unur_get_distr call. Thus the parameter for this distribution can be read. However, never extract the distribution object out of a generator object and run one of the set calls on it to modify the distribution. (How should the poor generator object know what has happend?) Instead there exist calls for each of the generator methods that change particular parameters of the internal copy of the distribution object.

How To Use

UNU.RAN collects all data required for a particular generation method in a distribution object. There are two ways to get an instance of a distributions object:

  1. Build a distribtion from scratch, by means of the corresponding unur_distr_<type>_new call, where <type> is the type of the distribution as listed in the below subsections.
  2. Use the corresponding unur_distr_<name>_new call to get prebuild distribution from the UNU.RAN library of standard distributions. Here <name> is the name of the standard distribution in Standard distributions.

In either cases the corresponding unur_distr_<type>_set_<param> calls to set the necessary parameters <param> (case 1), or change the values of the standard distribution in case 2 (if this makes sense for you). In the latter case <type> is the type to which the standard distribution belongs to. These set calls return UNUR_SUCCESS when the correspondig parameter has been set successfully. Otherwise an error code is returned.

The parameters of a distribution are divided into essential and derived parameters.

Notice, that there are some restrictions in setting parameters to avoid possible confusions. Changing essential parameters marks derived parameters as unknown. Some of the parameters cannot be changed any more when already set; some parameters block each others. In such a case a new instance of a distribution object has to be build.

Additionally unur_distr_<type>_upd_<param> calls can be used for updating derived parameters for objects provided by the UNU.RAN library of standard distributions.

All parameters of a distribution object get be read by means of unur_distr_<type>_get_<param> calls.

Every distribution object be identified by its name which is a string of arbitrary characters provided by the user. For standard distribution it is automatically set to <name> in the corresponding new call. It can be changed to any other string.


4.1 Functions for all kinds of distribution objects

The calls in this section can be applied to all distribution objects.

  • Destroy free an instance of a generator object.
  • Ask for the type of a generator object.
  • Ask for the dimension of a generator object.
  • Deal with the name (identifier string) of a generator object.

Function reference

: void unur_distr_free (UNUR_DISTR* distribution)

Destroy the distribution object.

: int unur_distr_set_name (UNUR_DISTR* distribution, const char* name)
: const char* unur_distr_get_name (const UNUR_DISTR* distribution)

Set and get name of distribution. The name can be an arbitrary character string. It can be used to identify generator objects for the user. It is used by UNU.RAN when printing information of the distribution object into a log files.

: int unur_distr_get_dim (const UNUR_DISTR* distribution)

Get number of components of a random vector (its dimension) the distribution.

For univariate distributions it returns dimension 1.

For matrix distributions it returns the number of components (i.e., number of rows times number of columns). When the respective numbers of rows and columns are needed use unur_distr_matr_get_dim instead.

: unsigned int unur_distr_get_type (const UNUR_DISTR* distribution)

Get type of distribution. Possible types are

UNUR_DISTR_CONT

univariate continuous distribution

UNUR_DISTR_CEMP

empirical continuous univariate distribution (i.e. a sample)

UNUR_DISTR_CVEC

continuous mulitvariate distribution

UNUR_DISTR_CVEMP

empirical continuous multivariate distribution (i.e. a vector sample)

UNUR_DISTR_DISCR

discrete univariate distribution

UNUR_DISTR_MATR

matrix distribution

Alternatively the unur_distr_is_<TYPE> calls can be used.

: int unur_distr_is_cont (const UNUR_DISTR* distribution)

TRUE if distribution is a continuous univariate distribution.

: int unur_distr_is_cvec (const UNUR_DISTR* distribution)

TRUE if distribution is a continuous multivariate distribution.

: int unur_distr_is_cemp (const UNUR_DISTR* distribution)

TRUE if distribution is an empirical continuous univariate distribution, i.e. a sample.

: int unur_distr_is_cvemp (const UNUR_DISTR* distribution)

TRUE if distribution is an empirical continuous multivariate distribution.

: int unur_distr_is_discr (const UNUR_DISTR* distribution)

TRUE if distribution is a discrete univariate distribution.

: int unur_distr_is_matr (const UNUR_DISTR* distribution)

TRUE if distribution is a matrix distribution.

: int unur_distr_set_extobj (UNUR_DISTR* distribution, const void* extobj)

Store a pointer to an external object. This might be usefull if the PDF, PMF, CDF or other functions used to implement a particular distribution a parameter set that cannot be stored as doubles (e.g. pointers to some structure that holds information of the distribution).

Important: When UNU.RAN copies this distribution object into the generator object, then the address extobj that this pointer contains is simply copied. Thus the generator holds an address of a non-private object! Once the generator object has been created any change in the external object might effect the generator object.

Warning: External objects must be used with care. Once the generator object has been created or the distribution object has been copied you must not destroy this external object.

: const void* unur_distr_get_extobj (const UNUR_DISTR* distribution)

Get the pointer to the external object.

Important: Changing this object must be done with with extreme care.


4.2 Continuous univariate distributions

The calls in this section can be applied to continuous univariate distributions.

  • Create a new instance of a continuous univariate distribution.
  • Handle and evaluate distribution function (CDF, cdf), probability density function (PDF, pdf) and the derivative of the density function (dpdf). The following is important:
    • pdf need not be normalized, i.e., any integrable nonnegative function can be used.
    • dpdf must the derivate of the function provided as pdf.
    • cdf must be a distribution function, i.e. it must be monotonically increasing with range [0,1].
    • If cdf and pdf are used together for a pariticular generation method, then pdf must be the derivate of the cdf, i.e., it must be normalized.
  • Handle and evaluate the logarithm of the probability density function (logPDF, logpdf) and the derivative of the logarithm of the density function (dlogpdf).

    Some methods use the logarithm of the density if available.

  • Set (and change) parameters (pdfparams) and the area below the graph (pdfarea) of the given density.
  • Set the mode (or pole) of the distribution.
  • Set the center of the distribution. It is used by some generation methods to adjust the parameters of the generation algorithms to gain better performance. It can be seens as the location of the “central part” of the distribution.
  • Some generation methods require the hazard rate (hr) of the distribution instead of its pdf.
  • Alternatively, cdf, pdf, dpdf, and hr can be provided as strings instead of function pointers.
  • Set the domain of the distribution. Notice that the library also can handle truncated distributions, i.e., distributions that are derived from (standard) distributions by simply restricting its domain to a subset. However, there is a subtle difference between changing the domain of a distribution object by a unur_distr_cont_set_domain call and changing the (truncated) domain for an existing generator object. The domain of the distribution object is used to create the generator object with hats, squeezes, tables, etc. Whereas truncating the domain of an existing generator object need not necessarily require a recomputation of these data. Thus by a unur_<method>_chg_truncated call (if available) the sampling region is restricted to the subset of the domain of the given distribution object. However, generation methods that require a recreation of the generator object when the domain is changed have a unur_<method>_chg_domain call instead. For these calls there are of course no restrictions on the given domain (i.e., it is possible to increase the domain of the distribution) (see Methods for generating non-uniform random variates, for details).

Function reference

: UNUR_DISTR* unur_distr_cont_new (void)

Create a new (empty) object for univariate continuous distribution.

Essential parameters

: int unur_distr_cont_set_pdf (UNUR_DISTR* distribution, UNUR_FUNCT_CONT* pdf)
: int unur_distr_cont_set_dpdf (UNUR_DISTR* distribution, UNUR_FUNCT_CONT* dpdf)
: int unur_distr_cont_set_cdf (UNUR_DISTR* distribution, UNUR_FUNCT_CONT* cdf)
: int unur_distr_cont_set_invcdf (UNUR_DISTR* distribution, UNUR_FUNCT_CONT* invcdf)

Set respective pointer to the probability density function (PDF), the derivative of the probability density function (dPDF), the cumulative distribution function (CDF), and the inverse CDF of the distribution. Each of these function pointers must be of type double funct(double x, const UNUR_DISTR *distr).

Due to the fact that some of the methods do not require a normalized PDF the following is important:

  • The given CDF must be the cumulative distribution function of the (non-truncated) distribution. If a distribution from the UNU.RAN library of standard distributions (see Standard distributions) is truncated, there is no need to change the CDF.
  • If both the CDF and the PDF are used (for a method or for order statistics), the PDF must be the derivative of the CDF. If a truncated distribution for one of the standard distributions from the UNU.RAN library of standard distributions is used, there is no need to change the PDF.
  • If the area below the PDF is required for a given distribution it must be given by the unur_distr_cont_set_pdfarea call. For a truncated distribution this must be of course the integral of the PDF in the given truncated domain. For distributions from the UNU.RAN library of standard distributions this is done automatically by the unur_distr_cont_upd_pdfarea call.

It is important to note that all these functions must return a result for all values of x. Eg., if the domain of a given PDF is the interval [-1,1], then the given function must return 0.0 for all points outside this interval. In case of an overflow the PDF should return UNUR_INFINITY.

It is not possible to change such a function. Once the PDF or CDF is set it cannot be overwritten. This also holds when the logPDF is given or when the PDF is given by the unur_distr_cont_set_pdfstr or unur_distr_cont_set_logpdfstr call. A new distribution object has to be used instead.

: UNUR_FUNCT_CONT* unur_distr_cont_get_pdf (const UNUR_DISTR* distribution)
: UNUR_FUNCT_CONT* unur_distr_cont_get_dpdf (const UNUR_DISTR* distribution)
: UNUR_FUNCT_CONT* unur_distr_cont_get_cdf (const UNUR_DISTR* distribution)
: UNUR_FUNCT_CONT* unur_distr_cont_get_invcdf (const UNUR_DISTR* distribution)

Get the respective pointer to the PDF, the derivative of the PDF, the CDF, and the inverse CDF of the distribution. The pointer is of type double funct(double x, const UNUR_DISTR *distr). If the corresponding function is not available for the distribution, the NULL pointer is returned.

: double unur_distr_cont_eval_pdf (double x, const UNUR_DISTR* distribution)
: double unur_distr_cont_eval_dpdf (double x, const UNUR_DISTR* distribution)
: double unur_distr_cont_eval_cdf (double x, const UNUR_DISTR* distribution)
: double unur_distr_cont_eval_invcdf (double u, const UNUR_DISTR* distribution)

Evaluate the PDF, derivative of the PDF, the CDF, and the inverse CDF at x and u,respectively. Notice that distribution must not be the NULL pointer. If the corresponding function is not available for the distribution, UNUR_INFINITY is returned and unur_errno is set to UNUR_ERR_DISTR_DATA.

IMPORTANT: In the case of a truncated standard distribution these calls always return the respective values of the untruncated distribution!

: int unur_distr_cont_set_logpdf (UNUR_DISTR* distribution, UNUR_FUNCT_CONT* logpdf)
: int unur_distr_cont_set_dlogpdf (UNUR_DISTR* distribution, UNUR_FUNCT_CONT* dlogpdf)
: int unur_distr_cont_set_logcdf (UNUR_DISTR* distribution, UNUR_FUNCT_CONT* logcdf)
: UNUR_FUNCT_CONT* unur_distr_cont_get_logpdf (const UNUR_DISTR* distribution)
: UNUR_FUNCT_CONT* unur_distr_cont_get_dlogpdf (const UNUR_DISTR* distribution)
: UNUR_FUNCT_CONT* unur_distr_cont_get_logcdf (const UNUR_DISTR* distribution)
: double unur_distr_cont_eval_logpdf (double x, const UNUR_DISTR* distribution)
: double unur_distr_cont_eval_dlogpdf (double x, const UNUR_DISTR* distribution)
: double unur_distr_cont_eval_logcdf (double x, const UNUR_DISTR* distribution)

Analogous calls for the logarithm of the density distribution functions.

: int unur_distr_cont_set_pdfstr (UNUR_DISTR* distribution, const char* pdfstr)

This function provides an alternative way to set a PDF and its derivative of the distribution. pdfstr is a character string that contains the formula for the PDF, see Function String, for details. The derivative of the given PDF is computed automatically. See also the remarks for the unur_distr_cont_set_pdf call.

It is not possible to call this funtion twice or to call this function after a unur_distr_cont_set_pdf call.

: int unur_distr_cont_set_cdfstr (UNUR_DISTR* distribution, const char* cdfstr)

This function provides an alternative way to set a CDF; analogously to the unur_distr_cont_set_pdfstr call. The PDF and its derivative of the given CDF are computed automatically.

: char* unur_distr_cont_get_pdfstr (const UNUR_DISTR* distribution)
: char* unur_distr_cont_get_dpdfstr (const UNUR_DISTR* distribution)
: char* unur_distr_cont_get_cdfstr (const UNUR_DISTR* distribution)

Get pointer to respective string for PDF, derivate of PDF, and CDF of distribution that is given as string (instead of a function pointer). This call allocates memory to produce this string. It should be freed when it is not used any more.

: int unur_distr_cont_set_pdfparams (UNUR_DISTR* distribution, const double* params, int n_params)

Sets array of parameters for distribution. There is an upper limit for the number of parameters n_params. It is given by the macro UNUR_DISTR_MAXPARAMS in unuran_config.h. (It is set to 5 by default but can be changed to any appropriate nonnegative number.) If n_params is negative or exceeds this limit no parameters are copied into the distribution object and unur_errno is set to UNUR_ERR_DISTR_NPARAMS.

For standard distributions from the UNU.RAN library the parameters are checked. Moreover, the domain is updated automatically unless it has been changed before by a unur_distr_cont_set_domain call. If the given parameters are invalid for the standard distribution, then no parameters are set and an error code is returned. Notice, that the given parameter list for such a distribution is handled in the same way as in the corresponding new calls, i.e. optional parameters for the PDF that are not present in the given list are (re-)set to their default values.

Important: If the parameters of a distribution from the UNU.RAN library of standard distributions (see Standard distributions) are changed, then neither its mode nor the normalization constant are updated. Please use the respective calls unur_distr_cont_upd_mode and unur_distr_cont_upd_pdfarea. Moreover, if the domain has been changed by a unur_distr_cont_set_domain it is not automatically updated, either. Updating the normalization constant is in particular very important, when the CDF of the distribution is used.

: int unur_distr_cont_get_pdfparams (const UNUR_DISTR* distribution, const double** params)

Get number of parameters of the PDF and set pointer params to array of parameters. If no parameters are stored in the object, an error code is returned and params is set to NULL.

Important: Do not change the entries in params!

: int unur_distr_cont_set_pdfparams_vec (UNUR_DISTR* distribution, int par, const double* param_vec, int n_param_vec)

This function provides an interface for additional vector parameters for a continuous distribution.

It sets the parameter with number par. par indicates directly which of the parameters is set and must be a number between 0 and UNUR_DISTR_MAXPARAMS-1 (the upper limit of possible parameters defined in unuran_config.h; it is set to 5 but can be changed to any appropriate nonnegative number.)

The entries of a this parameter are given by the array param_vec of size n_param_vec.

If param_vec is NULL then the corresponding entry is cleared.

If an error occurs no parameters are copied into the parameter object unur_errno is set to UNUR_ERR_DISTR_DATA.

: int unur_distr_cont_get_pdfparams_vec (const UNUR_DISTR* distribution, int par, const double** param_vecs)

Get parameter of the PDF with number par. The pointer to the parameter array is stored in param_vecs, its size is returned by the function. If the requested parameter is not set, then an error code is returned and params is set to NULL.

Important: Do not change the entries in param_vecs!

: int unur_distr_cont_set_logpdfstr (UNUR_DISTR* distribution, const char* logpdfstr)
: char* unur_distr_cont_get_logpdfstr (const UNUR_DISTR* distribution)
: char* unur_distr_cont_get_dlogpdfstr (const UNUR_DISTR* distribution)
: int unur_distr_cont_set_logcdfstr (UNUR_DISTR* distribution, const char* logcdfstr)
: char* unur_distr_cont_get_logcdfstr (const UNUR_DISTR* distribution)

Analogous calls for the logarithm of the density and distribution functions.

: int unur_distr_cont_set_domain (UNUR_DISTR* distribution, double left, double right)

Set the left and right borders of the domain of the distribution. This can also be used to truncate an existing distribution. For setting the boundary to +/- infinity use +/- UNUR_INFINITY. If right is not strictly greater than left no domain is set and unur_errno is set to UNUR_ERR_DISTR_SET.

Important: For some technical reasons it is assumed that the density is unimodal and thus monotone on either side of the mode! This is used in the case when the given mode is outside of the original domain. Then the mode is set to the corresponding boundary of the new domain. If this result is not the desired it must be changed by using a unur_distr_cont_set_mode call (or a unur_distr_cont_upd_mode call). The same holds for the center of the distribution.

: int unur_distr_cont_get_domain (const UNUR_DISTR* distribution, double* left, double* right)

Get the left and right borders of the domain of the distribution. If the domain is not set +/- UNUR_INFINITY is assumed and returned. No error is reported in this case.

: int unur_distr_cont_get_truncated (const UNUR_DISTR* distribution, double* left, double* right)

Get the left and right borders of the (truncated) domain of the distribution. For non-truncated distribution this call is equivalent to the unur_distr_cont_get_domain call.

This call is only useful in connection with a unur_get_distr call to get the boundaries of the sampling region of a generator object.

: int unur_distr_cont_set_hr (UNUR_DISTR* distribution, UNUR_FUNCT_CONT* hazard)

Set pointer to the hazard rate (HR) of the distribution.

The hazard rate (or failure rate) is a mathematical way of describing aging. If the lifetime X is a random variable with density f(x) and CDF F(x) the hazard rate h(x) is defined as h(x) = f(x) / (1-F(x)). In other words, h(x) represents the (conditional) rate of failure of a unit that has survived up to time x with probability 1-F(x). The key distribution is the exponential distribution as it has constant hazard rate of value 1. Hazard rates tending to infinity describe distributions with sub-exponential tails whereas distributions with hazard rates tending to zero have heavier tails than the exponential distribution.

It is important to note that all these functions must return a result for all floats x. In case of an overflow the PDF should return UNUR_INFINITY.

Important: Do not simply use f(x) / (1-F(x)), since this is numerically very unstable and results in numerical noise if F(x) is (very) close to 1. Moreover, if the density f(x) is known a generation method that uses the density is more appropriate.

It is not possible to change such a function. Once the HR is set it cannot be overwritten. This also holds when the HR is given by the unur_distr_cont_set_hrstr call. A new distribution object has to be used instead.

: UNUR_FUNCT_CONT* unur_distr_cont_get_hr (const UNUR_DISTR* distribution)

Get the pointer to the hazard rate of the distribution. The pointer is of type double funct(double x, const UNUR_DISTR *distr). If the corresponding function is not available for the distribution, the NULL pointer is returned.

: double unur_distr_cont_eval_hr (double x, const UNUR_DISTR* distribution)

Evaluate the hazard rate at x. Notice that distribution must not be the NULL pointer. If the corresponding function is not available for the distribution, UNUR_INFINITY is returned and unur_errno is set to UNUR_ERR_DISTR_DATA.

: int unur_distr_cont_set_hrstr (UNUR_DISTR* distribution, const char* hrstr)

This function provides an alternative way to set a hazard rate and its derivative of the distribution. hrstr is a character string that contains the formula for the HR, see Function String, for details. See also the remarks for the unur_distr_cont_set_hr call.

It is not possible to call this funtion twice or to call this function after a unur_distr_cont_set_hr call.

: char* unur_distr_cont_get_hrstr (const UNUR_DISTR* distribution)

Get pointer to string for HR of distribution that is given via the string interface. This call allocates memory to produce this string. It should be freed when it is not used any more.

Derived parameters

The following paramters must be set whenever one of the essential parameters has been set or changed (and the parameter is required for the chosen method).

: int unur_distr_cont_set_mode (UNUR_DISTR* distribution, double mode)

Set mode of distribution. The mode must be contained in the domain of distribution. Otherwise the mode is not set and unur_errno is set to UNUR_ERR_DISTR_SET. For distributions with unbounded density, this call is used to set the pole of the PDF. Notice that the PDF should then return UNUR_INFINITY at the pole. Notice that the mode is adjusted when the domain is set, see the remark for the unur_distr_cont_set_domain call.

: int unur_distr_cont_upd_mode (UNUR_DISTR* distribution)

Recompute the mode of the distribution. This call works properly for distribution objects from the UNU.RAN library of standard distributions when the corresponding function is available. Otherwise a (slow) numerical mode finder based on Brent’s algorithm is used. If it failes unur_errno is set to UNUR_ERR_DISTR_DATA.

: double unur_distr_cont_get_mode (UNUR_DISTR* distribution)

Get mode of distribution. If the mode is not marked as known, unur_distr_cont_upd_mode is called to compute the mode. If this is not successful UNUR_INFINITY is returned and unur_errno is set to UNUR_ERR_DISTR_GET. (There is no difference between the case where no routine for computing the mode is available and the case where no mode exists for the distribution at all.)

: int unur_distr_cont_set_center (UNUR_DISTR* distribution, double center)

Set center of the distribution. The center is used by some methods to shift the distribution in order to decrease numerical round-off error. If not given explicitly a default is used.

Important: This call does not check whether the center is contained in the given domain.

Default: The mode, if set by a unur_distr_cont_set_mode or unur_distr_cont_upd_mode call; otherwise 0.

: double unur_distr_cont_get_center (const UNUR_DISTR* distribution)

Get center of the distribution. It always returns some point as there always exists a default for the center, see unur_distr_cont_set_center.

: int unur_distr_cont_set_pdfarea (UNUR_DISTR* distribution, double area)

Set the area below the PDF. If area is non-positive, no area is set and unur_errno is set to UNUR_ERR_DISTR_SET.

For a distribution object created by the UNU.RAN library of standard distributions you always should use the unur_distr_cont_upd_pdfarea. Otherwise there might be ambiguous side-effects.

: int unur_distr_cont_upd_pdfarea (UNUR_DISTR* distribution)

Recompute the area below the PDF of the distribution. It only works for distribution objects from the UNU.RAN library of standard distributions when the corresponding function is available. Otherwise unur_errno is set to UNUR_ERR_DISTR_DATA.

This call also sets the normalization constant such that the given PDF is the derivative of a given CDF, i.e. the area is 1. However, for truncated distributions the area is smaller than 1.

The call does not work for distributions from the UNU.RAN library of standard distributions with truncated domain when the CDF is not available.

: double unur_distr_cont_get_pdfarea (UNUR_DISTR* distribution)

Get the area below the PDF of the distribution. If this area is not known,
unur_distr_cont_upd_pdfarea is called to compute it. If this is not successful UNUR_INFINITY is returned and unur_errno is set to UNUR_ERR_DISTR_GET.


4.3 Continuous univariate order statistics

These are special cases of a continuous univariate distributions and thus they have most of these parameters (with the exception that functions cannot be changed). Additionally,

  • there is a call to extract the underlying distribution,
  • and a call to handle the rank of the order statistics.

Function reference

: UNUR_DISTR* unur_distr_corder_new (const UNUR_DISTR* distribution, int n, int k)

Create an object for order statistics of sample size n and rank k. distribution must be a pointer to a univariate continuous distribution. The resulting generator object is of the same type as of a unur_distr_cont_new call. (However, it cannot be used to make an order statistics out of an order statistics.)

To have a PDF for the order statistics, the given distribution object must contain a CDF and a PDF. Moreover, it is assumed that the given PDF is the derivative of the given CDF. Otherwise the area below the PDF of the order statistics is not computed correctly.

Important: There is no warning when the computed area below the PDF of the order statistics is wrong.

: const UNUR_DISTR* unur_distr_corder_get_distribution (const UNUR_DISTR* distribution)

Get pointer to distribution object for underlying distribution.

Essential parameters

: int unur_distr_corder_set_rank (UNUR_DISTR* distribution, int n, int k)

Change sample size n and rank k of order statistics. In case of invalid data, no parameters are changed. The area below the PDF can be set to that of the underlying distribution by a unur_distr_corder_upd_pdfarea call.

: int unur_distr_corder_get_rank (const UNUR_DISTR* distribution, int* n, int* k)

Get sample size n and rank k of order statistics. In case of error an error code is returned.

Additionally most of the set and get calls for continuous univariate distributions work. The most important exceptions are that the PDF and CDF cannot be changed and unur_distr_cont_upd_mode uses in any way a (slow) numerical method that might fail.

: UNUR_FUNCT_CONT* unur_distr_corder_get_pdf (UNUR_DISTR* distribution)
: UNUR_FUNCT_CONT* unur_distr_corder_get_dpdf (UNUR_DISTR* distribution)
: UNUR_FUNCT_CONT* unur_distr_corder_get_cdf (UNUR_DISTR* distribution)

Get the respective pointer to the PDF, the derivative of the PDF and the CDF of the distribution, respectively. The pointer is of type double funct(double x, UNUR_DISTR *distr). If the corresponding function is not available for the distribution, the NULL pointer is returned. See also unur_distr_cont_get_pdf. (Macro)

: double unur_distr_corder_eval_pdf (double x, UNUR_DISTR* distribution)
: double unur_distr_corder_eval_dpdf (double x, UNUR_DISTR* distribution)
: double unur_distr_corder_eval_cdf (double x, UNUR_DISTR* distribution)

Evaluate the PDF, derivative of the PDF. and the CDF, respectively, at x. Notice that distribution must not be the NULL pointer. If the corresponding function is not available for the distribution, UNUR_INFINITY is returned and unur_errno is set to UNUR_ERR_DISTR_DATA. See also unur_distr_cont_eval_pdf. (Macro)

IMPORTANT: In the case of a truncated standard distribution these calls always return the respective values of the untruncated distribution!

: int unur_distr_corder_set_pdfparams (UNUR_DISTR* distribution, double* params, int n_params)

Set array of parameters for underlying distribution. See unur_distr_cont_set_pdfparams for details. (Macro)

: int unur_distr_corder_get_pdfparams (UNUR_DISTR* distribution, double** params)

Get number of parameters of the PDF of the underlying distribution and set pointer params to array of parameters. See unur_distr_cont_get_pdfparams for details. (Macro)

: int unur_distr_corder_set_domain (UNUR_DISTR* distribution, double left, double right)

Set the left and right borders of the domain of the distribution. See unur_distr_cont_set_domain for details. (Macro)

: int unur_distr_corder_get_domain (UNUR_DISTR* distribution, double* left, double* right)

Get the left and right borders of the domain of the distribution. See unur_distr_cont_get_domain for details. (Macro)

: int unur_distr_corder_get_truncated (UNUR_DISTR* distribution, double* left, double* right)

Get the left and right borders of the (truncated) domain of the distribution. See unur_distr_cont_get_truncated for details. (Macro)

Derived parameters

The following paramters must be set whenever one of the essential parameters has been set or changed (and the parameter is required for the chosen method).

: int unur_distr_corder_set_mode (UNUR_DISTR* distribution, double mode)

Set mode of distribution. See also unur_distr_corder_set_mode. (Macro)

: double unur_distr_corder_upd_mode (UNUR_DISTR* distribution)

Recompute the mode of the distribution numerically. Notice that this routine is slow and might not work properly in every case. See also unur_distr_cont_upd_mode for further details. (Macro)

: double unur_distr_corder_get_mode (UNUR_DISTR* distribution)

Get mode of distribution. See unur_distr_cont_get_mode for details. (Macro)

: int unur_distr_corder_set_pdfarea (UNUR_DISTR* distribution, double area)

Set the area below the PDF. See unur_distr_cont_set_pdfarea for details. (Macro)

: double unur_distr_corder_upd_pdfarea (UNUR_DISTR* distribution)

Recompute the area below the PDF of the distribution. It only works for order statistics for distribution objects from the UNU.RAN library of standard distributions when the corresponding function is available. unur_distr_cont_upd_pdfarea assumes that the PDF of the underlying distribution is normalized, i.e. it is the derivative of its CDF. Otherwise the computed area is wrong and there is no warning about this failure. See unur_distr_cont_upd_pdfarea for further details. (Macro)

: double unur_distr_corder_get_pdfarea (UNUR_DISTR* distribution)

Get the area below the PDF of the distribution. See unur_distr_cont_get_pdfarea for details. (Macro)


4.4 Continuous empirical univariate distributions

Empirical univariate distributions are derived from observed data. There are two ways to create such a generator object:

  1. By a list of raw data by means of a unur_distr_cemp_set_data call.
  2. By a histogram (i.e. preprocessed data) by means of a unur_distr_cemp_set_hist call.

How these data are used to sample from the empirical distribution depends from the chosen generation method.

Function reference

: UNUR_DISTR* unur_distr_cemp_new (void)

Create a new (empty) object for empirical univariate continuous distribution.

Essential parameters

: int unur_distr_cemp_set_data (UNUR_DISTR* distribution, const double* sample, int n_sample)

Set observed sample for empirical distribution.

: int unur_distr_cemp_read_data (UNUR_DISTR* distribution, const char* filename)

Read data from file filename. It reads the first number from each line. Numbers are parsed by means of the C standard routine strtod. Lines that do not start with +, -, ., or a digit are ignored. (Beware of lines starting with a blank!)

In case of an error (file cannot be opened, invalid string for double in line) no data are copied into the distribution object and an error code is returned.

: int unur_distr_cemp_get_data (const UNUR_DISTR* distribution, const double** sample)

Get number of samples and set pointer sample to array of observations. If no sample has been given, an error code is returned and sample is set to NULL.

Important: Do not change the entries in sample!

: int unur_distr_cemp_set_hist (UNUR_DISTR* distribution, const double* prob, int n_prob, double xmin, double xmax)

Set a histogram with bins of equal width. prob is an array of length n_prob that contains the probabilities for the bins (in ascending order). xmin and xmax give the lower and upper bound of the histogram, respectively. The bins are assumed to have equal width.

Remark: This is shortcut for calling unur_distr_cemp_set_hist_prob and unur_distr_cemp_set_hist_domain. Notice: All sampling methods either use raw data or histogram. It is possible to set both types of data; however, it is not checked whether the given histogran corresponds to possibly given raw data.

: int unur_distr_cemp_set_hist_prob (UNUR_DISTR* distribution, const double* prob, int n_prob)

Set probabilities of a histogram with n_prob bins. Hence prob must be an array of length n_prob that contains the probabilities for the bins in ascending order. It is important also to set the location of the bins either with a unur_distr_cemp_set_hist_domain for bins of equal width or unur_distr_cemp_set_hist_bins when the bins have different width.

Notice: All sampling methods either use raw data or histogram. It is possible to set both types of data; however, it is not checked whether the given histogram corresponds to possibly given raw data.

: int unur_distr_cemp_set_hist_domain (UNUR_DISTR* distribution, double xmin, double xmax)

Set a domain of a histogram with bins of equal width. xmin and xmax give the lower and upper bound of the histogram, respectively.

: int unur_distr_cemp_set_hist_bins (UNUR_DISTR* distribution, const double* bins, int n_bins)

Set location of bins of a histogram with n_bins bins. Hence bins must be an array of length n_bins. The domain of the distribution is automatically set by this call and overrides any calls to unur_distr_cemp_set_hist_domain. Important: The probabilities of the bins of the distribution must be already be set by a unur_distr_cemp_set_hist_prob (or a unur_distr_cemp_set_hist call) and the value of n_bins must equal n_prob+1 from the corresponding value of the respective call.


4.5 Continuous multivariate distributions

The following calls handle multivariate distributions. However, the requirements of particular generation methods is not as unique as for univariate distributions. Moreover, random vector generation methods are still under development. The below functions are a first attempt to handle this situation.

Notice that some of the parameters – when given carelessly – might contradict to others. For example: Some methods require the marginal distribution and some methods need a standardized form of the marginal distributions, where the actual mean and variance is stored in the mean vector and the covariance matrix, respectively.

We also have to mention that some methods might abuse some of the parameters. Please read the discription of the chosen sampling method carfully.

The following kind of calls exists:

  • Create a new instance of a continuous multivariate distribution;
  • Handle and evaluate probability density function (PDF, pdf) and the gradient of the density function (dpdf). The following is important:
    • pdf need not be normalized, i.e., any integrable nonnegative function can be used.
    • dpdf must the derivate of the function provided as pdf.
  • Handle and evaluate the logarithm of the probability density function (logPDF, logpdf) and the gradient of the logarithm of the density function (dlogpdf).

    Some methods use the logarithm of the density if available.

  • Set (and change) parameters (pdfparams) and the volume below the graph (pdfvol) of the given density.
  • Set mode and mean of the distribution.
  • Set the center of the distribution. It is used by some generation methods to adjust the parameters of the generation algorithms to gain better performance. It can be seens as the location of the “central part” of the distribution.
  • Handle the covariance matrix of the distribution and its cholesky and invverse matrices.
  • Set the rankcorrelation matrix of the distribution.
  • Deal with marginal distributions.
  • Set domain of the distribution.

Function reference

: UNUR_DISTR* unur_distr_cvec_new (int dim)

Create a new (empty) object for multivariate continuous distribution. dim is the number of components of the random vector (i.e. its dimension). It is also possible to use dimension 1. Notice, however, that this is treated as a distribution of random vectors with only one component and not as a distribution of real numbers. For the latter unur_distr_cont_new should be used to create an object for a univariate distribution.

Essential parameters

: int unur_distr_cvec_set_pdf (UNUR_DISTR* distribution, UNUR_FUNCT_CVEC* pdf)

Set respective pointer to the PDF of the distribution. This function must be of type double funct(const double *x, UNUR_DISTR *distr), where x must be a pointer to a double array of appropriate size (i.e. of the same size as given to the unur_distr_cvec_new call).

It is not necessary that the given PDF is normalized, i.e. the integral need not be 1. Nevertheless the volume below the PDF can be provided by a unur_distr_cvec_set_pdfvol call.

It is not possible to change the PDF. Once the PDF is set it cannot be overwritten. This also holds when the logPDF is given. A new distribution object has to be used instead.

: int unur_distr_cvec_set_dpdf (UNUR_DISTR* distribution, UNUR_VFUNCT_CVEC* dpdf)

Set pointer to the gradient of the PDF. The type of this function must be int funct(double *result, const double *x, UNUR_DISTR *distr), where result and x must be pointers to double arrays of appropriate size (i.e. of the same size as given to the unur_distr_cvec_new call). The gradient of the PDF is stored in the array result. The function should return an error code in case of an error and must return UNUR_SUCCESS otherwise.

The given function must be the gradient of the function given by a unur_distr_cvec_set_pdf call.

It is not possible to change the gradient of the PDF. Once the dPDF is set it cannot be overwritten. This also holds when the gradient of the logPDF is given. A new distribution object has to be used instead.

: int unur_distr_cvec_set_pdpdf (UNUR_DISTR* distribution, UNUR_FUNCTD_CVEC* pdpdf)

Set pointer to partial derivatives of the PDF. The type of this function must be double funct(const double *x, int coord, UNUR_DISTR *distr), where x must be a pointer to a double array of appropriate size (i.e. of the same size as given to the unur_distr_cvec_new call). coord is the coordinate for which the partial dervative should be computed.

Notice that coord must be an integer from {0,…,dim-1}.

It is not possible to change the partial derivative of the PDF. Once the pdPDF is set it cannot be overwritten. This also holds when the partial derivative of the logPDF is given. A new distribution object has to be used instead.

: UNUR_FUNCT_CVEC* unur_distr_cvec_get_pdf (const UNUR_DISTR* distribution)

Get the pointer to the PDF of the distribution. The pointer is of type double funct(const double *x, UNUR_DISTR *distr). If the corresponding function is not available for the distribution, the NULL pointer is returned.

: UNUR_VFUNCT_CVEC* unur_distr_cvec_get_dpdf (const UNUR_DISTR* distribution)

Get the pointer to the gradient of the PDF of the distribution. The pointer is of type int double funct(double *result, const double *x, UNUR_DISTR *distr). If the corresponding function is not available for the distribution, the NULL pointer is returned.

: double unur_distr_cvec_eval_pdf (const double* x, UNUR_DISTR* distribution)

Evaluate the PDF of the distribution at x. x must be a pointer to a double array of appropriate size (i.e. of the same size as given to the unur_distr_cvec_new call) that contains the vector for which the function has to be evaluated.

Notice that distribution must not be the NULL pointer. If the corresponding function is not available for the distribution, UNUR_INFINITY is returned and unur_errno is set to UNUR_ERR_DISTR_DATA.

: int unur_distr_cvec_eval_dpdf (double* result, const double* x, UNUR_DISTR* distribution)

Evaluate the gradient of the PDF of the distribution at x. The result is stored in the double array result. Both result and x must be pointer to double arrays of appropriate size (i.e. of the same size as given to the unur_distr_cvec_new call).

Notice that distribution must not be the NULL pointer. If the corresponding function is not available for the distribution, an error code is returned and unur_errno is set to UNUR_ERR_DISTR_DATA (result is left unmodified).

: double unur_distr_cvec_eval_pdpdf (const double* x, int coord, UNUR_DISTR* distribution)

Evaluate the partial derivative of the PDF of the distribution at x for the coordinate coord. x must be a pointer to a double array of appropriate size (i.e. of the same size as given to the unur_distr_cvec_new call) that contains the vector for which the function has to be evaluated.

Notice that coord must be an integer from {0,…,dim-1}.

Notice that distribution must not be the NULL pointer. If the corresponding function is not available for the distribution, UNUR_INFINITY is returned and unur_errno is set to UNUR_ERR_DISTR_DATA.

: int unur_distr_cvec_set_logpdf (UNUR_DISTR* distribution, UNUR_FUNCT_CVEC* logpdf)
: int unur_distr_cvec_set_dlogpdf (UNUR_DISTR* distribution, UNUR_VFUNCT_CVEC* dlogpdf)
: int unur_distr_cvec_set_pdlogpdf (UNUR_DISTR* distribution, UNUR_FUNCTD_CVEC* pdlogpdf)
: UNUR_FUNCT_CVEC* unur_distr_cvec_get_logpdf (const UNUR_DISTR* distribution)
: UNUR_VFUNCT_CVEC* unur_distr_cvec_get_dlogpdf (const UNUR_DISTR* distribution)
: double unur_distr_cvec_eval_logpdf (const double* x, UNUR_DISTR* distribution)
: int unur_distr_cvec_eval_dlogpdf (double* result, const double* x, UNUR_DISTR* distribution)
: double unur_distr_cvec_eval_pdlogpdf (const double* x, int coord, UNUR_DISTR* distribution)

Analogous calls for the logarithm of the density function.

: int unur_distr_cvec_set_mean (UNUR_DISTR* distribution, const double* mean)

Set mean vector for multivariate distribution. mean must be a pointer to an array of size dim, where dim is the dimension returned by unur_distr_get_dim. A NULL pointer for mean is interpreted as the zero vector (0,…,0).

Important: If the parameters of a distribution from the UNU.RAN library of standard distributions (see Standard distributions) are changed, then neither its mode nor the normalization constant are updated. Please use the respective calls unur_distr_cvec_upd_mode and unur_distr_cvec_upd_pdfvol.

: const double* unur_distr_cvec_get_mean (const UNUR_DISTR* distribution)

Get the mean vector of the distribution. The function returns a pointer to an array of size dim. If the mean vector is not marked as known the NULL pointer is returned and unur_errno is set to UNUR_ERR_DISTR_GET.

Important: Do not modify the array that holds the mean vector!

: int unur_distr_cvec_set_covar (UNUR_DISTR* distribution, const double* covar)

Set covariance matrix for multivariate distribution. covar must be a pointer to an array of size dim x dim, where dim is the dimension returned by unur_distr_get_dim. The rows of the matrix have to be stored consecutively in this array.

covar must be a variance-covariance matrix of the distribution, i.e. it must be symmetric and positive definit and its diagonal entries (i.e. the variance of the components of the random vector) must be strictly positive. The Cholesky factor is computed (and stored) to verify the positive definiteness condition. Notice that the inverse of the given covariance matrix is automatically computed when it is requested by some routine. Notice that the computation of this inverse matrix is unstable in case of high correlations and/or high dimensions. Thus it might fail and methods that require this inverse cannot be used. As an alternative the inverse of the covariance matrix can be directly set by a unur_distr_cvec_set_covar_inv call.

A NULL pointer for covar is interpreted as the identity matrix.

Important: This entry is abused in some methods which do not require the covariance matrix. It is then used to perform some transformation to obtain better performance.

Important: In case of an error (e.g. because covar is not a valid covariance matrix) an error code is returned. Moreover, the covariance matrix is not set and is marked as unknown. A previously set covariance matrix is then no longer available.

Important: If the parameters of a distribution from the UNU.RAN library of standard distributions (see Standard distributions) are changed, then neither its mode nor the normalization constant are updated. Please use the respective calls unur_distr_cvec_upd_mode and unur_distr_cvec_upd_pdfvol. Remark: UNU.RAN does not check whether the an eventually set covariance matrix and a rank-correlation matrix do not contradict each other.

: int unur_distr_cvec_set_covar_inv (UNUR_DISTR* distribution, const double* covar_inv)

Set inverse of the covariance matrix for multivariate distribution. covar_inv must be a pointer to an array of size dim x dim, where dim is the dimension returned by unur_distr_get_dim. The rows of the matrix have to be stored consecutively in this array.

covar_inv must be symmetric and positive definit. Only the symmetry of the matrix is checked.

A NULL pointer for covar_inv is interpreted as the identity matrix.

Important: In case of an error (because covar_inv is not symetric) an error code is returned. Moreover, the inverse of the covariance matrix is not set and is marked as unknown. A previously set inverse matrix is then no longer available.

Remark: UNU.RAN does not check whether the given matrix is positive definit.

Remark: UNU.RAN does not check whether the matrix covar_inv is the inverse of the eventually set covariance matrix.

: const double* unur_distr_cvec_get_covar (const UNUR_DISTR* distribution)
: const double* unur_distr_cvec_get_cholesky (const UNUR_DISTR* distribution)
: const double* unur_distr_cvec_get_covar_inv (UNUR_DISTR* distribution)

Get covariance matrix of distribution, its Cholesky factor, and its inverse, respectively. The function returns a pointer to an array of size dim x dim. The rows of the matrix are stored consecutively in this array. If the requested matrix is not marked as known the NULL pointer is returned and unur_errno is set to UNUR_ERR_DISTR_GET.

Important: Do not modify the array that holds the covariance matrix!

Remark: The inverse of the covariance matrix is computed if it is not already stored.

: int unur_distr_cvec_set_rankcorr (UNUR_DISTR* distribution, const double* rankcorr)

Set rank-correlation matrix (Spearman’s correlation) for multivariate distribution. rankcorr must be a pointer to an array of size dim x dim, where dim is the dimension returned by unur_distr_get_dim. The rows of the matrix have to be stored consecutively in this array.

rankcorr must be a rank-correlation matrix of the distribution, i.e. it must be symmetric and positive definite and its diagonal entries must be equal to 1.

The Cholesky factor is computed (and stored) to verify the positive definiteness condition.

A NULL pointer for rankcorr is interpreted as the identity matrix.

Important: In case of an error (e.g. because rankcorr is not a valid rank-correlation matrix) an error code is returned. Moreover, the rank-correlation matrix is not set and is marked as unknown. A previously set rank-correlation matrix is then no longer available.

Remark: UNU.RAN does not check whether the an eventually set covariance matrix and a rank-correlation matrix do not contradict each other.

: const double* unur_distr_cvec_get_rankcorr (const UNUR_DISTR* distribution)
: const double* unur_distr_cvec_get_rk_cholesky (const UNUR_DISTR* distribution)

Get rank-correlation matrix and its cholesky factor, respectively, of distribution. The function returns a pointer to an array of size dim x dim. The rows of the matrix are stored consecutively in this array. If the requested matrix is not marked as known the NULL pointer is returned and unur_errno is set to UNUR_ERR_DISTR_GET.

Important: Do not modify the array that holds the rank-correlation matrix!

: int unur_distr_cvec_set_marginals (UNUR_DISTR* distribution, UNUR_DISTR* marginal)

Sets marginal distributions of the given distribution to the same marginal distribution object. The marginal distribution must be an instance of a continuous univariate distribution object. Notice that the marginal distribution is copied into the distribution object.

: int unur_distr_cvec_set_marginal_array (UNUR_DISTR* distribution, UNUR_DISTR** marginals)

Analogously to the above unur_distr_cvec_set_marginals call. However, now an array marginals of the pointers to each of the marginal distributions must be given. It must be an array of size dim, where dim is the dimension returned by unur_distr_get_dim. Notice: Local copies for each of the entries are stored in the distribution object. If some of these entries are identical (i.e. contain the same pointer), then for each of these a new copy is made.

: int unur_distr_cvec_set_marginal_list (UNUR_DISTR* distribution, ...)

Similar to the above unur_distr_cvec_set_marginal_array call. However, now the pointers to the particular marginal distributions can be given as parameter and does not require an array of pointers. Additionally the given distribution objects are immediately destroyed. Thus calls like unur_distr_normal can be used as arguments. (With unur_distr_cvec_set_marginal_array the result of such call has to be stored in a pointer since it has to be freed afterwarts to avoid memory leaks!)

The number of pointers to in the list of function arguments must be equal to the dimension of the distribution, i.e. the dimension returned by unur_distr_get_dim. If one of the given pointer to marginal distributions is the NULL pointer then the marginal distributions of distribution are not set (or previous settings are not changed) and an error code is returned.

Important: All distribution objects given in the argument list are destroyed!

: const UNUR_DISTR* unur_distr_cvec_get_marginal (const UNUR_DISTR* distribution, int n)

Get pointer to the n-th marginal distribution object from the given multivariate distribution. If this does not exist, NULL is returned. The marginal distributions are enumerated from 1 to dim, where dim is the dimension returned by unur_distr_get_dim.

: int unur_distr_cvec_set_pdfparams (UNUR_DISTR* distribution, const double* params, int n_params)

Sets array of parameters for distribution. There is an upper limit for the number of parameters n_params. It is given by the macro UNUR_DISTR_MAXPARAMS in unuran_config.h. (It is set to 5 by default but can be changed to any appropriate nonnegative number.) If n_params is negative or exceeds this limit no parameters are copied into the distribution object and unur_errno is set to UNUR_ERR_DISTR_NPARAMS.

For standard distributions from the UNU.RAN library the parameters are checked. Moreover, the domain is updated automatically. If the given parameters are invalid for the standard distribution, then no parameters are set and an error code is returned. Notice that the given parameter list for such a distribution is handled in the same way as in the corresponding new calls, i.e. optional parameters for the PDF that are not present in the given list are (re-)set to their default values.

Important: If the parameters of a distribution from the UNU.RAN library of standard distributions (see Standard distributions) are changed, then neither its mode nor the normalization constant are updated. Please use the respective calls unur_distr_cvec_upd_mode and unur_distr_cvec_upd_pdfvol.

: int unur_distr_cvec_get_pdfparams (const UNUR_DISTR* distribution, const double** params)

Get number of parameters of the PDF and set pointer params to array of parameters. If no parameters are stored in the object, an error code is returned and params is set to NULL.

Important: Do not change the entries in params!

: int unur_distr_cvec_set_pdfparams_vec (UNUR_DISTR* distribution, int par, const double* param_vec, int n_params)

This function provides an interface for additional vector parameters for a multivariate distribution besides mean vector and covariance matrix which have their own calls.

It sets the parameter with number par. par indicates directly which of the parameters is set and must be a number between 0 and UNUR_DISTR_MAXPARAMS-1 (the upper limit of possible parameters defined in unuran_config.h; it is set to 5 but can be changed to any appropriate nonnegative number.)

The entries of a this parameter are given by the array param_vec of size n_params. Notice that using this interface an An (n x m)-matrix has to be stored in an array of length n_params = n times m; where the rows of the matrix are stored consecutively in this array.

Due to great variety of possible parameters for a multivariate distribution there is no simpler interface.

If param_vec is NULL then the corresponding entry is cleared.

Important: If the parameters of a distribution from the UNU.RAN library of standard distributions (see Standard distributions) are changed, then neither its mode nor the normalization constant are updated. Please use the respective calls unur_distr_cvec_upd_mode and unur_distr_cvec_upd_pdfvol. If an error occurs no parameters are copied into the parameter object unur_errno is set to UNUR_ERR_DISTR_DATA.

: int unur_distr_cvec_get_pdfparams_vec (const UNUR_DISTR* distribution, int par, const double** param_vecs)

Get parameter of the PDF with number par. The pointer to the parameter array is stored in param_vecs, its size is returned by the function. If the requested parameter is not set, then an error code is returned and params is set to NULL.

Important: Do not change the entries in param_vecs!

: int unur_distr_cvec_set_domain_rect (UNUR_DISTR* distribution, const double* lowerleft, const double* upperright)

Set rectangular domain for distribution with lowerleft and upperright vertices. Both must be pointer to an array of the size returned by unur_distr_get_dim. A NULL pointer is interpreted as the zero vector (0,…,0). For setting a coordinate of the boundary to +/- infinity use +/- UNUR_INFINITY. The lowerleft vertex must be strictly smaller than upperright in each component. Otherwise no domain is set and unur_errno is set to UNUR_ERR_DISTR_SET.

By default the domain of a distribution is unbounded. Thus one can use this call to truncate an existing distribution.

Important: Changing the domain of distribution marks derived parameters like the mode or the center as unknown and must be set after changing the domain. This is important for the already set (or default) value for the center does not fall into the given domain. Notice that calls of the PDF and derived functions return 0. when the parameter is not contained in the domain.

: int unur_distr_cvec_is_indomain (const double* x, const UNUR_DISTR* distribution)

Check whether x falls into the domain of distribution.

Derived parameters

The following paramters must be set whenever one of the essential parameters has been set or changed (and the parameter is required for the chosen method).

: int unur_distr_cvec_set_mode (UNUR_DISTR* distribution, const double* mode)

Set mode of the distribution. mode must be a pointer to an array of the size returned by unur_distr_get_dim. A NULL pointer for mode is interpreted as the zero vector (0,…,0).

: int unur_distr_cvec_upd_mode (UNUR_DISTR* distribution)

Recompute the mode of the distribution. This call works properly for distribution objects from the UNU.RAN library of standard distributions when the corresponding function is available. If it failes unur_errno is set to UNUR_ERR_DISTR_DATA.

: const double* unur_distr_cvec_get_mode (UNUR_DISTR* distribution)

Get mode of the distribution. The function returns a pointer to an array of the size returned by unur_distr_get_dim. If the mode is not marked as known the NULL pointer is returned and unur_errno is set to UNUR_ERR_DISTR_GET. (There is no difference between the case where no routine for computing the mode is available and the case where no mode exists for the distribution at all.)

Important: Do not modify the array that holds the mode!

: int unur_distr_cvec_set_center (UNUR_DISTR* distribution, const double* center)

Set center of the distribution. center must be a pointer to an array of the size returned by unur_distr_get_dim. A NULL pointer for center is interpreted as the zero vector (0,…,0).

The center is used by some methods to shift the distribution in order to decrease numerical round-off error. If not given explicitly a default is used. Moreover, it is used as starting point for several numerical search algorithm (e.g. for the mode). Then center must be a pointer where the call to the PDF returns a non-zero value. In particular center must contained in the domain of the distribution.

Default: The mode, if given by a unur_distr_cvec_set_mode call; else the mean, if given by a unur_distr_cvec_set_mean call; otherwise the null vector (0,…,0).

: const double* unur_distr_cvec_get_center (UNUR_DISTR* distribution)

Get center of the distribution. The function returns a pointer to an array of the size returned by unur_distr_get_dim. It always returns some point as there always exists a default for the center, see unur_distr_cvec_set_center. Important: Do not modify the array that holds the center!

: int unur_distr_cvec_set_pdfvol (UNUR_DISTR* distribution, double volume)

Set the volume below the PDF. If vol is non-positive, no volume is set and unur_errno is set to UNUR_ERR_DISTR_SET.

: int unur_distr_cvec_upd_pdfvol (UNUR_DISTR* distribution)

Recompute the volume below the PDF of the distribution. It only works for distribution objects from the UNU.RAN library of standard distributions when the corresponding function is available. Otherwise unur_errno is set to UNUR_ERR_DISTR_DATA.

This call also sets the normalization constant such that the given PDF is the derivative of a given CDF, i.e. the volume is 1.

: double unur_distr_cvec_get_pdfvol (UNUR_DISTR* distribution)

Get the volume below the PDF of the distribution. If this volume is not known,
unur_distr_cont_upd_pdfarea is called to compute it. If this is not successful UNUR_INFINITY is returned and unur_errno is set to UNUR_ERR_DISTR_GET.


4.6 Continuous univariate full conditional distribution

Full conditional distribution for a given continuous multivariate distributiion. The condition is a position vector and either a variable that is variated or a vector that indicates the direction on which the random vector can variate.

There is a subtle difference between using direction vector and using the k-th variable. When a direction vector is given the PDF of the conditional distribution is defined by f(t) = PDF(pos + t * dir). When a variable is selected the full conditional distribution with all other variables fixed is used.

This is a special case of a continuous univariate distribution and thus they have most of these parameters (with the exception that functions cannot be changed). Additionally,

  • there is a call to extract the underlying multivariate distribution,
  • and a call to handle the variables that are fixed and the direction for changing the random vector.

This distibution type is primarily used for evaluation the conditional distribution and its derivative (as required for, e.g., the Gibbs sampler). The density is not normalized (i.e. does not integrate to one). Mode and area are not available and it does not make sense to use any call to set or change parameters except the ones given below.

Function reference

: UNUR_DISTR* unur_distr_condi_new (const UNUR_DISTR* distribution, const double* pos, const double* dir, int k)

Create an object for full conditional distribution for the given distribution. The condition is given by a position vector pos and either the k-th variable that is variated or the vector dir that contains the direction on which the random vector can variate.

distribution must be a pointer to a multivariate continuous distribution. pos must be a pointer to an array of size dim, where dim is the dimension of the underlying distribution object. dir must be a pointer to an array if size dim or NULL. k must be in the range 0, …, dim-1. If the k-th variable is used, dir must be set to NULL.

Notice: There is a subtle difference between using direction vector dir and using the k-th variable. When dir is given, the current position pos is mapped into 0 of the conditional distribution and the derivative is taken from the function PDF(pos+t*dir) w.r.t. t. On the other hand, when the coordinate k is used (i.e., when dir is set to NULL), the full conditional distribution of the distribution is considered (as used for the Gibbs sampler). In particular, the current point is just projected into the one-dimensional subspace without mapping it into the point 0.

Notice: If a coordinate k is used, then the k-th partial derivative is used if it as available. Otherwise the gradient is computed and the k-th component is returned.

The resulting generator object is of the same type as of a unur_distr_cont_new call.

: int unur_distr_condi_set_condition (struct unur_distr* distribution, const double* pos, const double* dir, int k)

Set/change condition for conditional distribution. Change values of fixed variables to pos and use direction dir or k-th variable of conditional distribution.

pos must be a pointer to an array of size dim, where dim is the dimension of the underlying distribution object. dir must be a pointer to an array if size dim or NULL. k must be in the range 0, …, dim-1. If the k-th variable is used, dir must be set to NULL.

Notice: There is a subtle difference between using direction vector dir and using the k-th variable. When dir is given, the current position pos is mapped into 0 of the conditional distribution and the derivative is taken from the function PDF(pos+t*dir) w.r.t. t. On the other hand, when the coordinate k is used (i.e., when dir is set to NULL), the full conditional distribution of the distribution is considered (as used for the Gibbs sampler). In particular, the current point is just projected into the one-dimensional subspace without mapping it into the point 0.

: int unur_distr_condi_get_condition (struct unur_distr* distribution, const double** pos, const double** dir, int* k)

Get condition for conditional distribution. The values for the fixed variables are stored in pos, which must be a pointer to an array of size dim. The condition is stored in dir and k, respectively.

Important: Do not change the entries in pos and dir!

: const UNUR_DISTR* unur_distr_condi_get_distribution (const UNUR_DISTR* distribution)

Get pointer to distribution object for underlying distribution.


4.7 Continuous empirical multivariate distributions

Empirical multivariate distributions are just lists of vectors (with the same dimension). Thus there are only calls to insert these data. How these data are used to sample from the empirical distribution depends from the chosen generation method.

Function reference

: UNUR_DISTR* unur_distr_cvemp_new (int dim)

Create a new (empty) object for an empirical multivariate continuous distribution. dim is the number of components of the random vector (i.e. its dimension). It must be at least 2; otherwise unur_distr_cemp_new should be used to create an object for an empirical univariate distribution.

Essential parameters

: int unur_distr_cvemp_set_data (UNUR_DISTR* distribution, const double* sample, int n_sample)

Set observed sample for empirical distribution. sample is an array of doubles of size dim x n_sample, where dim is the dimension of the distribution returned by unur_distr_get_dim. The data points must be stored consecutively in sample, i.e., data points (x1, y1), (x2, y2), … are given as an array {x1, y1, x2, y2, …}.

: int unur_distr_cvemp_read_data (UNUR_DISTR* distribution, const char* filename)

Read data from file filename. It reads the first dim numbers from each line, where dim is the dimension of the distribution returned by unur_distr_get_dim. Numbers are parsed by means of the C standard routine strtod. Lines that do not start with +, -, ., or a digit are ignored. (Beware of lines starting with a blank!)

In case of an error (file cannot be opened, too few entries in a line, invalid string for double in line) no data are copied into the distribution object and an error code is returned.

: int unur_distr_cvemp_get_data (const UNUR_DISTR* distribution, const double** sample)

Get number of samples and set pointer sample to array of observations. If no sample has been given, an error code is returned and sample is set to NULL. If successful sample points to an array of length dim x n_sample, where dim is the dimension of the distribution returned by unur_distr_get_dim and n_sample the return value of the function.

Important: Do not modify the array sample.


4.8 MATRix distributions

Distributions for random matrices. Notice that UNU.RAN uses arrays of doubles to handle matrices. The rows of the matrix are stored consecutively.

Function reference

: UNUR_DISTR* unur_distr_matr_new (int n_rows, int n_cols)

Create a new (empty) object for a matrix distribution. n_rows and n_cols are the respective numbers of rows and columns of the random matrix (i.e. its dimensions). It is also possible to have only one number or rows and/or columns. Notice, however, that this is treated as a distribution of random matrices with only one row or column or component and not as a distribution of vectors or real numbers. For the latter unur_distr_cont_new or unur_distr_cvec_new should be used to create an object for a univariate distribution and a multivariate (vector) distribution, respectively.

Essential parameters

: int unur_distr_matr_get_dim (const UNUR_DISTR* distribution, int* n_rows, int* n_cols)

Get number of rows and columns of random matrix (its dimension). It returns the total number of components. If successfull UNUR_SUCCESS is returned.


4.9 Discrete univariate distributions

The calls in this section can be applied to discrete univariate distributions.

  • Create a new instance of a discrete univariate distribution.
  • Handle and evaluate distribution function (CDF, cdf) and probability mass function (PMF, pmf). The following is important:
    • pmf need not be normalized, i.e., any summable nonnegative function on the set of intergers can be used.
    • cdf must be a distribution function, i.e. it must be monotonically increasing with range [0,1].
    • If cdf and pdf are used together for a pariticular generation method, then pmf must be normalized, i.e. it must sum to 1.
  • Alternatively, cdf and pdf can be provided as strings instead of function pointers.
  • Some generation methods require a (finite) probability vector (PV, pv), i.e. an array of doubles. It can be automatically computed if the pmf is given but pv is not.
  • Set (and change) parameters (pmfparams) and the total sum (pmfsum) of the given PMF or PV.
  • Set the mode of the distribution.
  • Set the domain of the distribution.

Function reference

: UNUR_DISTR* unur_distr_discr_new (void)

Create a new (empty) object for a univariate discrete distribution.

Essential parameters

There are two interfaces for discrete univariate distributions: Either provide a (finite) probability vector (PV). Or provide a probability mass function (PMF). For the latter case there are also a couple of derived parameters that are not required when a PV is given.

It is not possible to set both a PMF and a PV directly. However, the PV can be computed from the PMF (or the CDF if no PMF is available) by means of a unur_distr_discr_make_pv call. If both the PV and the PMF are given in the distribution object it depends on the generation method which of these is used.

: int unur_distr_discr_set_pv (UNUR_DISTR* distribution, const double* pv, int n_pv)

Set finite probability vector (PV) for the distribution. It is not necessary that the entries in the given PV sum to 1. n_pv must be positive. However, there is no testing whether all entries in pv are non-negative.

If no domain has been set, then the left boundary is set to 0, by default. If n_pv is too large, e.g. because left boundary + n_pv exceeds the range of integers, then the call fails.

Notice that it is not possible to set both a PV and a PMF or CDF. If the PMF or CDF is set first one cannot set the PV. If the PMF or CDF is set first after a PV is set, the latter is removed (and recomputed using unur_distr_discr_make_pv when required).

: int unur_distr_discr_make_pv (UNUR_DISTR* distribution)

Compute a PV when a PMF or CDF is given. However, when the domain is not given or is too large and the sum over the PMF is given then the (right) tail of the distribution is chopped off such that the probability for the tail region is less than 1.e-8. If the sum over the PMF is not given a PV of maximal length is computed.

The maximal size of the created PV is bounded by the macro UNUR_MAX_AUTO_PV that is defined in unuran_config.h.

If successful, the length of the generated PV is returned. If the sum over the PMF on the chopped tail is not neglible small (i.e. greater than 1.e-8 or unknown) than the negative of the length of the PV is returned and unur_errno is set to UNUR_ERR_DISTR_SET.

Notice that the left boundary of the PV is set to 0 by default when a discrete distribution object is created from scratch.

If computing a PV fails for some reasons, an error code is returned and unur_errno is set to UNUR_ERR_DISTR_SET.

: int unur_distr_discr_get_pv (const UNUR_DISTR* distribution, const double** pv)

Get length of PV of the distribution and set pointer pv to array of probabilities. If no PV is given, an error code is returned and pv is set to NULL.
(It does not call unur_distr_discr_make_pv !)

: int unur_distr_discr_set_pmf (UNUR_DISTR* distribution, UNUR_FUNCT_DISCR* pmf)
: int unur_distr_discr_set_cdf (UNUR_DISTR* distribution, UNUR_FUNCT_DISCR* cdf)

Set respective pointer to the PMF and the CDF of the distribution. These functions must be of type double funct(int k, const UNUR_DISTR *distr).

It is important to note that all these functions must return a result for all integers k. E.g., if the domain of a given PMF is the interval {1,2,3,…,100}, than the given function must return 0.0 for all points outside this interval.

The default domain for the PMF or CDF is [0, INT_MAX]. The domain can be changed using a unur_distr_discr_set_domain call.

It is not possible to change such a function. Once the PMF or CDF is set it cannot be overwritten. A new distribution object has to be used instead.

Notice that it is not possible to set both a PV and a PMF or CDF. If the PMF or CDF is set first one cannot set the PV. If the PMF or CDF is set first after a PV is set, the latter is removed (and recomputed using unur_distr_discr_make_pv when required).

: int unur_distr_discr_set_invcdf (UNUR_DISTR* distribution, UNUR_IFUNCT_DISCR* invcdf)

Set inverse CDF of the distribution. invcdf must be a pointer must be of type int funct(double x, const UNUR_DISTR *distr), i.e., it should return a double.

: double unur_distr_discr_eval_pv (int k, const UNUR_DISTR* distribution)
: double unur_distr_discr_eval_pmf (int k, const UNUR_DISTR* distribution)
: double unur_distr_discr_eval_cdf (int k, const UNUR_DISTR* distribution)

Evaluate the PV, PMF, and the CDF, respectively, at k. Notice that distribution must not be the NULL pointer. If no PV is set for the distribution, then unur_distr_discr_eval_pv behaves like unur_distr_discr_eval_pmf. If the corresponding function is not available for the distribution, UNUR_INFINITY is returned and unur_errno is set to UNUR_ERR_DISTR_DATA.

IMPORTANT: In the case of a truncated standard distribution these calls always return the respective values of the untruncated distribution!

: int unur_distr_discr_eval_invcdf (double u, const UNUR_DISTR* distribution)

Evaluate the inverse CDF at u. Notice that distribution must not be the NULL pointer. If the corresponding function is not available for the distribution, INT_MAX is returned and unur_errno is set to UNUR_ERR_DISTR_DATA.

IMPORTANT: In the case of a truncated standard distribution these calls always return the respective values of the untruncated distribution!

: int unur_distr_discr_set_pmfstr (UNUR_DISTR* distribution, const char* pmfstr)

This function provides an alternative way to set a PMF of the distribution. pmfstr is a character string that contains the formula for the PMF, see Function String, for details. See also the remarks for the unur_distr_discr_set_pmf call.

It is not possible to call this funtion twice or to call this function after a unur_distr_discr_set_pmf call.

: int unur_distr_discr_set_cdfstr (UNUR_DISTR* distribution, const char* cdfstr)

This function provides an alternative way to set a CDF; analogously to the unur_distr_discr_set_pmfstr call.

: char* unur_distr_discr_get_pmfstr (const UNUR_DISTR* distribution)
: char* unur_distr_discr_get_cdfstr (const UNUR_DISTR* distribution)

Get pointer to respective string for PMF and CDF of distribution that is given via the string interface. This call allocates memory to produce this string. It should be freed when it is not used any more.

: int unur_distr_discr_set_pmfparams (UNUR_DISTR* distribution, const double* params, int n_params)

Set array of parameters for distribution. There is an upper limit for the number of parameters n_params. It is given by the macro UNUR_DISTR_MAXPARAMS in unuran_config.h. (It is set to 5 but can be changed to any appropriate nonnegative number.) If n_params is negative or exceeds this limit no parameters are copied into the distribution object and unur_errno is set to UNUR_ERR_DISTR_NPARAMS.

For standard distributions from the UNU.RAN library the parameters are checked. Moreover, the domain is updated automatically unless it has been changed before by a unur_distr_discr_set_domain call. If the given parameters are invalid for the standard distribution, then no parameters are set and an error code is returned. Notice that the given parameter list for such a distribution is handled in the same way as in the corresponding new calls, i.e. optional parameters for the PDF that are not present in the given list are (re-)set to their default values.

Important: Integer parameter must be given as doubles.

: int unur_distr_discr_get_pmfparams (const UNUR_DISTR* distribution, const double** params)

Get number of parameters of the PMF and set pointer params to array of parameters. If no parameters are stored in the object, an error code is returned and params is set to NULL.

: int unur_distr_discr_set_domain (UNUR_DISTR* distribution, int left, int right)

Set the left and right borders of the domain of the distribution. This can also be used to truncate an existing distribution. For setting the boundary to +/- infinity use INT_MIN and INT_MAX, respectively. If right is not strictly greater than left no domain is set and unur_errno is set to UNUR_ERR_DISTR_SET. It is allowed to use this call to increase the domain. If the PV of the discrete distribution is used, than the right boudary is ignored (and internally set to left + size of PV - 1). Notice that INT_MIN and INT_MAX are interpreted as (minus/plus) infinity.

Default: [0, INT_MAX].

: int unur_distr_discr_get_domain (const UNUR_DISTR* distribution, int* left, int* right)

Get the left and right borders of the domain of the distribution. If the domain is not set explicitly the interval [INT_MIN, INT_MAX] is assumed and returned. When a PV is given then the domain is set automatically to [0,size of PV - 1].

Derived parameters

The following paramters must be set whenever one of the essential parameters has been set or changed (and the parameter is required for the chosen method).

: int unur_distr_discr_set_mode (UNUR_DISTR* distribution, int mode)

Set mode of distribution.

: int unur_distr_discr_upd_mode (UNUR_DISTR* distribution)

Recompute the mode of the distribution. This call works properly for distribution objects from the UNU.RAN library of standard distributions when the corresponding function is available. Otherwise a (slow) numerical mode finder is used. It only works properly for unimodal probability mass functions. If it failes unur_errno is set to UNUR_ERR_DISTR_DATA.

: int unur_distr_discr_get_mode (UNUR_DISTR* distribution)

Get mode of distribution. If the mode is not marked as known, unur_distr_discr_upd_mode is called to compute the mode. If this is not successful INT_MAX is returned and unur_errno is set to UNUR_ERR_DISTR_GET. (There is no difference between the case where no routine for computing the mode is available and the case where no mode exists for the distribution at all.)

: int unur_distr_discr_set_pmfsum (UNUR_DISTR* distribution, double sum)

Set the sum over the PMF. If sum is non-positive, no sum is set and unur_errno is set to UNUR_ERR_DISTR_SET.

For a distribution object created by the UNU.RAN library of standard distributions you always should use the unur_distr_discr_upd_pmfsum. Otherwise there might be ambiguous side-effects.

: int unur_distr_discr_upd_pmfsum (UNUR_DISTR* distribution)

Recompute the sum over the PMF of the distribution. In most cases the normalization constant is recomputed and thus the sum is 1. This call works for distribution objects from the UNU.RAN library of standard distributions when the corresponding function is available. When a PV, a PMF with finite domain, or a CDF is given, a simple generic function which uses a naive summation loop is used. If this computation is not possible, an error code is returned and unur_errno is set to UNUR_ERR_DISTR_DATA.

The call does not work for distributions from the UNU.RAN library of standard distributions with truncated domain when the CDF is not available.

: double unur_distr_discr_get_pmfsum (UNUR_DISTR* distribution)

Get the sum over the PMF of the distribution. If this sum is not known, unur_distr_discr_upd_pmfsum is called to compute it. If this is not successful UNUR_INFINITY is returned and unur_errno is set to UNUR_ERR_DISTR_GET.


5 Methods for generating non-uniform random variates

Sampling from a particular distribution with UNU.RAN requires the following steps:

  1. Create a distribution object (see Handling distribution objects).
  2. Select a method and create a parameter object.
  3. Initizialize the generator object using unur_init. Important: Initialization of the generator object might fail. unur_init returns a NULL pointer then, which must not be used for sampling.
  4. Draw a sample from the generator object using the corresponding sampling function (depending on the type of distribution: univariate continuous, univariate discrete, multivariate continuous, and random matrix).
  5. It is possible for a generator object to change the parameters and the domain of the underlying distribution. This must be done by extracting this object by means of a unur_get_distr call and changing the distribution using the correspondig set calls, see Handling distribution objects. The generator object must then be reinitialized by means of the unur_reinit call.

    Important: Currently not all methods allow reinitialization, see the description of the particular method (keyword Reinit).

    Important: Reinitialization of the generator object might fail. Thus one must check the return code of the unur_reinit call.

    Important: When reinitialization fails then sampling routines always return UNUR_INFINITY (for continuous distributions) or 0 (for discrete distributions), respectively. However, it is still possible to change the underlying distribution and try to reinitialize again.


5.1 Routines for all generator objects

Routines for all generator objects.

Function reference

: UNUR_GEN* unur_init (UNUR_PAR* parameters)

Initialize a generator object. All necessary information must be stored in the parameter object.

Important: If an error has occurred a NULL pointer is return. This must not be used for the sampling routines (this causes a segmentation fault).

Always check whether the call was successful or not!

Important: This call destroys the parameter object automatically. Thus it is not necessary/allowed to free it.

: int unur_reinit (UNUR_GEN* generator)

Update an existing generator object after the underlying distribution has been modified (using unur_get_distr together with corresponding set calls. It must be executed before sampling using this generator object is continued as otherwise it produces an invalid sample or might even cause a segmentation fault.

Important: Currently not all methods allow reinitialization, see the description of the particular method (keyword Reinit).

Important: Reinitialization of the generator object might fail. Thus one must check the return code:

UNUR_SUCCESS (0x0u)

success (no error)

UNUR_ERR_NO_REINIT

reinit routine not implemented.

other values

some error has occured while trying to reinitialize the generator object.

Important: When reinitialization fails then sampling routines always return UNUR_INFINITY (for continuous distributions) or 0 (for discrete distributions), respectively. However, it is still possible to change the underlying distribution and try to reinitialize again.

Important: When one tries to run unur_reinit but reinitialization is not implemented, then the generator object cannot be used any more and must be destroyed and a new one has to be built from scratch.

: int unur_sample_discr (UNUR_GEN* generator)
: double unur_sample_cont (UNUR_GEN* generator)
: int unur_sample_vec (UNUR_GEN* generator, double* vector)
: int unur_sample_matr (UNUR_GEN* generator, double* matrix)

Sample from generator object. The three routines depend on the type of the generator object (discrete or continuous univariate distribution, multivariate distribution, or random matrix).

Notice: UNU.RAN uses arrays of doubles to handle matrices. There the rows of the matrix are stored consecutively.

Notice: The routines unur_sample_vec and unur_sample_matr return UNUR_SUCCESS if generation was successful and some error code otherwise.

Important: These routines do not check whether generator is an invalid NULL pointer.

: double unur_quantile (UNUR_GEN* generator, double U)

Compute the U quantile of a continuous distribution using a generator object that implements an (approximate) inversion methods.

The following methods are currently available:

Important: This routine does not check whether generator is an invalid NULL pointer.

In case of an error UNUR_INFINITY or INT_MAX (depending on the type of generator) is returned.

: void unur_free (UNUR_GEN* generator)

Destroy (free) the given generator object.

: const char* unur_gen_info (UNUR_GEN* generator, int help)

Get a string with informations about the given generator. These informations allow some fine tuning of the generation method. If help is TRUE, some hints on setting parameters are given.

This function is intented for using in interactive environments (like R).

If an error occurs, then NULL is returned.

: int unur_get_dimension (const UNUR_GEN* generator)

Get the number of dimension of a (multivariate) distribution. For a univariate distribution 1 is return.

: const char* unur_get_genid (const UNUR_GEN* generator)

Get identifier string for generator.

: unsigned int unur_get_method (const UNUR_GEN* generator)

Get identifier for generating method. These identifiers are declared in src/methods/unur_metthods.h.

: int unur_gen_is_inversion (const UNUR_GEN* gen)

Return TRUE if the generator object implements an inversion method, and FALSE otherwise.

: UNUR_DISTR* unur_get_distr (const UNUR_GEN* generator)

Get pointer to distribution object from generator object. This function can be used to change the parameters of the distribution and reinitialize the generator object. Notice that currently not all generating methods have a reinitialize routine. This function should be used with extreme care. Changing the distribution is changed and using the generator object without reinitializing might cause wrong samples or segmentation faults. Moreover, if the corresponding generator object is freed, the pointer must not be used.

Important: The returned distribution object must not be freed. If the distribution object is changed then one must run unur_reinit !

: int unur_set_use_distr_privatecopy (UNUR_PAR* parameters, int use_privatecopy)

Set flag whether the generator object should make a private copy of the given distribution object or just stores the pointer to this distribution object. Values for use_privatecopy:

TRUE

make a private copy (default)

FALSE

do not make a private copy and store pointer to given (external) distribution object.

By default, generator objects keep their own private copy of the given distribution object. Thus the generator object can be handled independently from other UNU.RAN objects (with uniform random number generators as the only exception). When the generator object is initialized the given distribution object is cloned and stored.

However, in some rare situations it can be useful when only the pointer to the given distribution object is stored without making a private copy. A possible example is when only one random variate has to be drawn from the distribution. This behavior can be achieved when use_localcopy is set to FALSE.

Warning! Using a pointer to the external distribution object instead of a private copy must be done with extreme care! When the distrubtion object is changed or freed then the generator object does not work any more, might case a segmentation fault, or (even worse) produces garbage. On the other hand, when the generator object is initialized or used to draw a random sampling the distribution object may be changed.

Notice: The prototypes of all unur_<method>_new calls use a const qualifier for the distribution argument. However, if use_privatecopy is set to FALSE this qualifier is discarded and the distribution might be changed.

Important! If use_localcopy is set to FALSE and the corresponding distribution object is changed then one must run unur_reinit on the generator object. (Notice that currently not all generation methods support reinitialization.)

Default: use_privatecopy is TRUE.


5.2 AUTO – Select method automatically

AUTO selects a an appropriate method for the given distribution object automatically. There are no parameters for this method, yet. But it is planned to give some parameter to describe the task for which the random variate generator is used for and thus make the choice of the generating method more appropriate. Notice that the required sampling routine for the generator object depends on the type of the given distribution object.

The chosen method also depends on the sample size for which the generator object will be used. If only a few random variates the order of magnitude of the sample size should be set via a unur_auto_set_logss call.

IMPORTANT: This is an experimental version and the method chosen may change in future releases of UNU.RAN.

For an example see Example: As short as possible.

How To Use

Create a generator object for the given distribution object.

Function reference

: UNUR_PAR* unur_auto_new (const UNUR_DISTR* distribution)

Get default parameters for generator.

: int unur_auto_set_logss (UNUR_PAR* parameters, int logss)

Set the order of magnitude for the size of the sample that will be generated by the generator, i.e., the the common logarithm of the sample size.

Default is 10.

Notice: This feature will be used in future releases of UNU.RAN only.


5.3 Methods for continuous univariate distributions

Overview of methods

Methods for continuous univariate distributions
sample with unur_sample_cont

methodPDFdPDFCDFmodeareaother
AROUxx[x]T-concave
ARSxxT-concave
CEXTwrapper for external generator
CSTDbuild-in standard distribution
HINV[x][x]x
HRBbounded hazard rate
HRDdecreasing hazard rate
HRIincreasing hazard rate
ITDRxxxmonotone with pole
NINV[x]x
NROUx[x]
PINVx[x][~]
SROUxxxT-concave
SSRxxxT-concave
TABLxx[~]all local extrema
TDRxxT-concave
UTDRxx~T-concave

Example

/* ------------------------------------------------------------- */
/* File: example_cont.c                                          */
/* ------------------------------------------------------------- */

/* Include UNURAN header file.                                   */
#include <unuran.h>

/* ------------------------------------------------------------- */

/* Example how to sample from a continuous univariate            */
/* distribution.                                                 */
/*                                                               */
/* We build a distribution object from scratch and sample.       */

/* ------------------------------------------------------------- */

/* Define the PDF and dPDF of our distribution.                  */
/*                                                               */
/* Our distribution has the PDF                                  */
/*                                                               */
/*          /  1 - x*x  if |x| <= 1                              */
/*  f(x) = <                                                     */
/*          \  0        otherwise                                */
/*                                                               */

/* The PDF of our distribution:                                  */
double mypdf( double x, const UNUR_DISTR *distr )
     /* The second argument (`distr') can be used for parameters */
     /* for the PDF. (We do not use parameters in our example.)  */
{
  if (fabs(x) >= 1.)
    return 0.;
  else
    return (1.-x*x);
} /* end of mypdf() */

/* The derivative of the PDF of our distribution:                */
double mydpdf( double x, const UNUR_DISTR *distr )
{
  if (fabs(x) >= 1.)
    return 0.;
  else
    return (-2.*x);
} /* end of mydpdf() */

/* ------------------------------------------------------------- */

int main(void)
{
  int    i;     /* loop variable                                 */
  double x;     /* will hold the random number                   */

  /* Declare the three UNURAN objects.                           */
  UNUR_DISTR *distr;    /* distribution object                   */
  UNUR_PAR   *par;      /* parameter object                      */
  UNUR_GEN   *gen;      /* generator object                      */

  /* Create a new distribution object from scratch.              */

  /* Get empty distribution object for a continuous distribution */
  distr = unur_distr_cont_new();

  /* Fill the distribution object -- the provided information    */
  /* must fulfill the requirements of the method choosen below.  */
  unur_distr_cont_set_pdf(distr,  mypdf);     /* PDF             */
  unur_distr_cont_set_dpdf(distr, mydpdf);    /* its derivative  */
  unur_distr_cont_set_mode(distr, 0.);        /* mode            */
  unur_distr_cont_set_domain(distr, -1., 1.); /* domain          */

  /* Choose a method: TDR.                                       */
  par = unur_tdr_new(distr);

  /* Set some parameters of the method TDR.                      */
  unur_tdr_set_variant_gw(par);
  unur_tdr_set_max_sqhratio(par, 0.90);
  unur_tdr_set_c(par, -0.5);
  unur_tdr_set_max_intervals(par, 100);
  unur_tdr_set_cpoints(par, 10, NULL);

  /* Create the generator object.                                */
  gen = unur_init(par);

  /* Notice that this call has also destroyed the parameter      */
  /* object `par' as a side effect.                              */

  /* It is important to check if the creation of the generator   */
  /* object was successful. Otherwise `gen' is the NULL pointer  */ 
  /* and would cause a segmentation fault if used for sampling.  */
  if (gen == NULL) {
     fprintf(stderr, "ERROR: cannot create generator object\n");
     exit (EXIT_FAILURE);
  }

  /* It is possible to reuse the distribution object to create   */
  /* another generator object. If you do not need it any more,   */
  /* it should be destroyed to free memory.                      */
  unur_distr_free(distr);

  /* Now you can use the generator object `gen' to sample from   */
  /* the distribution. Eg.:                                      */
  for (i=0; i<10; i++) {
    x = unur_sample_cont(gen);
    printf("%f\n",x);
  }

  /* When you do not need the generator object any more, you     */
  /* can destroy it.                                             */
  unur_free(gen);

  exit (EXIT_SUCCESS);

} /* end of main() */

/* ------------------------------------------------------------- */

Example (String API)

/* ------------------------------------------------------------- */
/* File: example_cont_str.c                                      */
/* ------------------------------------------------------------- */
/* String API.                                                   */
/* ------------------------------------------------------------- */

/* Include UNURAN header file.                                   */
#include <unuran.h>

/* ------------------------------------------------------------- */

/* Example how to sample from a continuous univariate            */
/* distribution.                                                 */

/* We use a generic distribution object and sample.              */
/*                                                               */
/* The PDF of our distribution is given by                       */
/*                                                               */
/*          /  1 - x*x  if |x| <= 1                              */
/*  f(x) = <                                                     */
/*          \  0        otherwise                                */
/*                                                               */

/* ------------------------------------------------------------- */

int main(void)
{
  int    i;     /* loop variable                                 */
  double x;     /* will hold the random number                   */

  /* Declare UNURAN generator object.                            */
  UNUR_GEN   *gen;      /* generator object                      */

  /* Create the generator object.                                */
  /* Use a generic continuous distribution.                      */
  /* Choose a method: TDR.                                       */
  gen = unur_str2gen(
           "distr = cont; pdf=\"1-x*x\"; domain=(-1,1); mode=0. & \
            method=tdr; variant_gw; max_sqhratio=0.90; c=-0.5; \
            max_intervals=100; cpoints=10");

  /* It is important to check if the creation of the generator   */
  /* object was successful. Otherwise `gen' is the NULL pointer  */ 
  /* and would cause a segmentation fault if used for sampling.  */
  if (gen == NULL) {
     fprintf(stderr, "ERROR: cannot create generator object\n");
     exit (EXIT_FAILURE);
  }

  /* Now you can use the generator object `gen' to sample from   */
  /* the distribution. Eg.:                                      */
  for (i=0; i<10; i++) {
    x = unur_sample_cont(gen);
    printf("%f\n",x);
  }

  /* When you do not need the generator object any more, you     */
  /* can destroy it.                                             */
  unur_free(gen);

  exit (EXIT_SUCCESS);

} /* end of main() */

/* ------------------------------------------------------------- */

5.3.1 AROU – Automatic Ratio-Of-Uniforms method

Required:

T-concave PDF, dPDF

Optional:

mode

Speed:

Set-up: slow, Sampling: fast

Reinit:

not implemented

Reference:

[LJa00]

AROU is a variant of the ratio-of-uniforms method that uses the fact that the transformed region is convex for many distributions. It works for all T-concave distributions with T(x) = -1/sqrt(x).

It is possible to use this method for correlation induction by setting an auxiliary uniform random number generator via the unur_set_urng_aux call. (Notice that this must be done after a possible unur_set_urng call.) When an auxiliary generator is used then the number of used uniform random numbers that is used up for one generated random variate is constant and equal to 1.

There exists a test mode that verifies whether the conditions for the method are satisfied or not while sampling. It can be switched on by calling unur_arou_set_verify and unur_arou_chg_verify respectively. Notice however that sampling is (much) slower then.

For densities with modes not close to 0 it is suggested to set either the mode or the center of the distribution by the unur_distr_cont_set_mode or unur_distr_cont_set_center call. The latter is the approximate location of the mode or the mean of the distribution. This location provides some information about the main part of the PDF and is used to avoid numerical problems.

Function reference

: UNUR_PAR* unur_arou_new (const UNUR_DISTR* distribution)

Get default parameters for generator.

: int unur_arou_set_usedars (UNUR_PAR* parameters, int usedars)

If usedars is set to TRUE, “derandomized adaptive rejection sampling” (DARS) is used in setup. Segments where the area between hat and squeeze is too large compared to the average area between hat and squeeze over all intervals are split. This procedure is repeated until the ratio between area below squeeze and area below hat exceeds the bound given by unur_arou_set_max_sqhratio call or the maximum number of segments is reached. Moreover, it also aborts when no more segments can be found for splitting.

Segments are split such that the angle of the segments are halved (corresponds to arc-mean rule of method TDR (see TDR – Transformed Density Rejection)).

Default is TRUE.

: int unur_arou_set_darsfactor (UNUR_PAR* parameters, double factor)

Set factor for “derandomized adaptive rejection sampling”. This factor is used to determine the segments that are “too large”, that is, all segments where the area between squeeze and hat is larger than factor times the average area over all intervals between squeeze and hat. Notice that all segments are split when factor is set to 0., and that there is no splitting at all when factor is set to UNUR_INFINITY.

Default is 0.99. There is no need to change this parameter.

: int unur_arou_set_max_sqhratio (UNUR_PAR* parameters, double max_ratio)

Set upper bound for the ratio (area inside squeeze) / (area inside envelope). It must be a number between 0 and 1. When the ratio exceeds the given number no further construction points are inserted via adaptive rejection sampling. Use 0 if no construction points should be added after the setup. Use 1 if adding new construction points should not be stopped until the maximum number of construction points is reached.

Default is 0.99.

: double unur_arou_get_sqhratio (const UNUR_GEN* generator)

Get the current ratio (area inside squeeze) / (area inside envelope) for the generator. (In case of an error UNUR_INFINITY is returned.)

: double unur_arou_get_hatarea (const UNUR_GEN* generator)

Get the area below the hat for the generator. (In case of an error UNUR_INFINITY is returned.)

: double unur_arou_get_squeezearea (const UNUR_GEN* generator)

Get the area below the squeeze for the generator. (In case of an error UNUR_INFINITY is returned.)

: int unur_arou_set_max_segments (UNUR_PAR* parameters, int max_segs)

Set maximum number of segements. No construction points are added after the setup when the number of segments succeeds max_segs.

Default is 100.

: int unur_arou_set_cpoints (UNUR_PAR* parameters, int n_stp, const double* stp)

Set construction points for enveloping polygon. If stp is NULL, then a heuristical rule of thumb is used to get n_stp construction points. This is the default behavior when this routine is not called. The (default) number of construction points is 30, then.

: int unur_arou_set_usecenter (UNUR_PAR* parameters, int usecenter)

Use the center as construction point. Default is TRUE.

: int unur_arou_set_guidefactor (UNUR_PAR* parameters, double factor)

Set factor for relative size of the guide table for indexed search (see also method DGT DGT – (Discrete) Guide Table method (indexed search)). It must be greater than or equal to 0. When set to 0, then sequential search is used.

Default is 2.

: int unur_arou_set_verify (UNUR_PAR* parameters, int verify)
: int unur_arou_chg_verify (UNUR_GEN* generator, int verify)

Turn verifying of algorithm while sampling on/off. If the condition squeeze(x) <= PDF(x) <= hat(x) is violated for some x then unur_errno is set to UNUR_ERR_GEN_CONDITION. However notice that this might happen due to round-off errors for a few values of x (less than 1%).

Default is FALSE.

: int unur_arou_set_pedantic (UNUR_PAR* parameters, int pedantic)

Sometimes it might happen that unur_init has been executed successfully. But when additional construction points are added by adaptive rejection sampling, the algorithm detects that the PDF is not T-concave.

With pedantic being TRUE, the sampling routine is then exchanged by a routine that simply returns UNUR_INFINITY. Otherwise the new point is not added to the list of construction points. At least the hat function remains T-concave.

Setting pedantic to FALSE allows sampling from a distribution which is “almost” T-concave and small errors are tolerated. However it might happen that the hat function cannot be improved significantly. When the hat function that has been constructed by the unur_init call is extremely large then it might happen that the generation times are extremely high (even hours are possible in extremely rare cases).

Default is FALSE.


5.3.2 ARS – Adaptive Rejection Sampling

Required:

concave logPDF, derivative of logPDF

Optional:

mode

Speed:

Set-up: fast, Sampling: slow

Reinit:

supported

Reference:

[GWa92] [HLD04: Cha.4]

ARS is an acceptance/rejection method that uses the concavity of the log-density function to construct hat function and squeezes automatically. It is very similar to method TDR (see TDR – Transformed Density Rejection) with variant GW, parameter c = 0, and DARS switched off. Moreover, method ARS requires the logPDF and its derivative dlogPDF to run. On the other hand, it is designed to draw only a (very) small samples and it is much more robust against densities with very large or small areas below the PDF as it occurs, for example, in conditional distributions of (high dimensional) multivariate distributions. Additionally, it can be re-initialized when the underlying distribution has been modified. Thus it is well suited for Gibbs sampling.

Notice, that method ARS is a restricted version of TDR. If the full functionally of Transformed Density Rejection is needed use method TDR – Transformed Density Rejection.

How To Use

Method ARS is designed for distributions with log-concave densities. To use this method you need a distribution object with the logarithm of the PDF and its derivative given.

The number of construction points as well as a set of such points can be provided using unur_ars_set_cpoints. Notice that addition construction points are added by means of adaptive rejection sampling until the maximal number of intervals given by unur_ars_set_max_intervals is reached.

A generated distribution object can be reinitialized using the unur_reinit call. When unur_reinit is called construction points for the new generator are necessary. There are two options: Either the same construction points as for the initial generator (given by a unur_ars_set_cpoints call) are used (this is the default), or percentiles of the old hat function can be used. This can be set or changed using unur_ars_set_reinit_percentiles and unur_ars_chg_reinit_percentiles. This feature is usefull when the underlying distribution object is only moderately changed. (An example is Gibbs sampling with small correlations.)

There exists a test mode that verifies whether the conditions for the method are satisfied or not. It can be switched on by calling unur_ars_set_verify and unur_ars_chg_verify respectively. Notice however that sampling is (much) slower then.

Method ARS aborts after a given number of iterations and return UNUR_INFINITY to prevent (almost) infinite loops. This might happen when the starting hat is much too large and it is not possible to insert new construction points due to severe numerical errors or (more likely) the given PDF is not log-concave. This maximum number of iterations can be set by means of a unur_ars_set_max_iter call.

Function reference

: UNUR_PAR* unur_ars_new (const UNUR_DISTR* distribution)

Get default parameters for generator.

: int unur_ars_set_max_intervals (UNUR_PAR* parameters, int max_ivs)

Set maximum number of intervals. No construction points are added after the setup when the number of intervals suceeds max_ivs. It is increased automatically to twice the number of construction points if this is larger.

Default is 200.

: int unur_ars_set_cpoints (UNUR_PAR* parameters, int n_cpoints, const double* cpoints)

Set construction points for the hat function. If cpoints is NULL then a heuristic rule of thumb is used to get n_cpoints construction points. This is the default behavior. n_cpoints should be at least 2, otherwise defaults are used.

The default number of construction points is 2.

: int unur_ars_set_reinit_percentiles (UNUR_PAR* parameters, int n_percentiles, const double* percentiles)
: int unur_ars_chg_reinit_percentiles (UNUR_GEN* generator, int n_percentiles, const double* percentiles)

By default, when the generator object is reinitialized, it used the same construction points as for the initialization procedure. Often the underlying distribution object has been changed only moderately. For example, the full conditional distribution of a multivariate distribution. In this case it might be more appropriate to use percentilesm of the hat function for the last (unchanged) distribution. percentiles must then be a pointer to an ordered array of numbers between 0.01 and 0.99. If percentiles is NULL, then a heuristic rule of thumb is used to get n_percentiles values for these percentiles. Notice that n_percentiles must be at least 2, otherwise defaults are used. (Then the first and third quartiles are used by default.)

: int unur_ars_set_reinit_ncpoints (UNUR_PAR* parameters, int ncpoints)
: int unur_ars_chg_reinit_ncpoints (UNUR_GEN* generator, int ncpoints)

When reinit fails with the given construction points or the percentiles of the old hat function, another trial is undertaken with ncpoints construction points. ncpoints must be at least 10.

Default: 30

: int unur_ars_set_max_iter (UNUR_PAR* parameters, int max_iter)

The rejection loop stops after max_iter iterations and return UNUR_INFINITY.

Default: 10000

: int unur_ars_set_verify (UNUR_PAR* parameters, int verify)
: int unur_ars_chg_verify (UNUR_GEN* generator, int verify)

Turn verifying of algorithm while sampling on/off. If the condition squeeze(x) <= PDF(x) <= hat(x) is violated for some x then unur_errno is set to UNUR_ERR_GEN_CONDITION. However notice that this might happen due to round-off errors for a few values of x (less than 1%).

Default is FALSE.

: int unur_ars_set_pedantic (UNUR_PAR* parameters, int pedantic)

Sometimes it might happen that unur_init has been executed successfully. But when additional construction points are added by adaptive rejection sampling, the algorithm detects that the PDF is not log-concave.

With pedantic being TRUE, the sampling routine is exchanged by a routine that simply returns UNUR_INFINITY. Otherwise the new point is not added to the list of construction points. At least the hat function remains log-concave.

Setting pedantic to FALSE allows sampling from a distribution which is “almost” log-concave and small errors are tolerated. However it might happen that the hat function cannot be improved significantly. When the hat functions that has been constructed by the unur_init call is extremely large then it might happen that the generation times are extremely high (even hours are possible in extremely rare cases).

Default is FALSE.

: double unur_ars_get_loghatarea (const UNUR_GEN* generator)

Get the logarithm of area below the hat for the generator. (In case of an error UNUR_INFINITY is returned.)

: double unur_ars_eval_invcdfhat (const UNUR_GEN* generator, double u)

Evaluate the inverse of the CDF of the hat distribution at u.

If u is out of the domain [0,1] then unur_errno is set to UNUR_ERR_DOMAIN and the respective bound of the domain of the distribution are returned (which is -UNUR_INFINITY or UNUR_INFINITY in the case of unbounded domains).


5.3.3 CEXT – wrapper for Continuous EXTernal generators

Required:

routine for sampling continuous random variates

Speed:

depends on external generator

Reinit:

supported

Method CEXT is a wrapper for external generators for continuous univariate distributions. It allows the usage of external random variate generators within the UNU.RAN framework.

How To Use

The following steps are required to use some external generator within the UNU.RAN framework (some of these are optional):

  1. Make an empty generator object using a unur_cext_new call. The argument distribution is optional and can be replaced by NULL. However, it is required if you want to pass parameters of the generated distribution to the external generator or for running some validation tests provided by UNU.RAN.
  2. Create an initialization routine of type int (*init)(UNUR_GEN *gen) and plug it into the generator object using the unur_cext_set_init call. Notice that the init routine must return UNUR_SUCCESS when it has been executed successfully and UNUR_FAILURE otherwise. It is possible to get the size of and the pointer to the array of parameters of the underlying distribution object by the respective calls unur_cext_get_ndistrparams and unur_cext_get_distrparams. Parameters for the external generator that are computed in the init routine can be stored in a single array or structure which is available by the unur_cext_get_params call.

    Using an init routine is optional and can be omitted.

  3. Create a sampling routine of type double (*sample)(UNUR_GEN *gen) and plug it into the generator object using the unur_cext_set_sample call.

    Uniform random numbers are provided by the unur_sample_urng call. Do not use your own implementation of a uniform random number generator directly. If you want to use your own random number generator we recommend to use the UNU.RAN interface (see see Using uniform random number generators).

    The array or structure that contains parameters for the external generator that are computed in the init routine are available using the unur_cext_get_params call.

    Using a sample routine is of course obligatory.

It is possible to change the parameters and the domain of the chosen distribution and run unur_reinit to reinitialize the generator object. The init routine is then called again.

Here is a short example that demonstrates the application of this method by means of the exponential distribution:

/* ------------------------------------------------------------- */
/* File: example_cext.c                                          */
/* ------------------------------------------------------------- */

/* Include UNURAN header file.                                   */
#include <unuran.h>

/* ------------------------------------------------------------- */

/* This example shows how an external generator for the          */
/* exponential distribution with one scale parameter can be      */
/* used within the UNURAN framework.                             */
/*                                                               */
/* Notice, that this example does not provide the simplest       */
/* solution.                                                     */

/* ------------------------------------------------------------- */
/* Initialization routine.                                       */
/*                                                               */
/*   Here we simply read the scale parameter of the exponential  */
/*   distribution and store it in an array for parameters of     */
/*   the external generator.                                     */
/*   [ Of course we could do this in the sampling routine as     */
/*   and avoid the necessity of this initialization routine. ]   */

int exponential_init (UNUR_GEN *gen)
{ 
  /* Get pointer to parameters of exponential distribution       */
  double *params = unur_cext_get_distrparams(gen);

  /* The scale parameter is the first entry (see manual)         */
  double lambda = (params) ? params[0] : 1.;

  /* Get array to store this parameter for external generator    */
  double *genpar = unur_cext_get_params(gen, sizeof(double));
  genpar[0] = lambda;

  /* Executed successfully                                       */
  return UNUR_SUCCESS;
}

/* ------------------------------------------------------------- */
/* Sampling routine.                                             */
/*                                                               */
/*   Contains the code for the external generator.               */

double exponential_sample (UNUR_GEN *gen)
{ 
  /* Get scale parameter                                         */
  double *genpar = unur_cext_get_params(gen,0);
  double lambda = genpar[0];

  /* Sample a uniformly distributed random number                */
  double U = unur_sample_urng(gen);

  /* Transform into exponentially distributed random variate     */
  return ( -log(1. - U) * lambda );
}

/* ------------------------------------------------------------- */

int main(void)
{
  int    i;     /* loop variable                                 */
  double x;     /* will hold the random number                   */

  /* Declare the three UNURAN objects.                           */
  UNUR_DISTR *distr;    /* distribution object                   */
  UNUR_PAR   *par;      /* parameter object                      */
  UNUR_GEN   *gen;      /* generator object                      */

  /* Use predefined exponential distribution with scale param. 2 */
  double fpar[1] = { 2. };
  distr = unur_distr_exponential(fpar, 1);

  /* Use method CEXT                                             */
  par = unur_cext_new(distr);

  /* Set initialization and sampling routines.                   */
  unur_cext_set_init(par, exponential_init);
  unur_cext_set_sample(par, exponential_sample);

  /* Create the generator object.                                */
  gen = unur_init(par);

  /* It is important to check if the creation of the generator   */
  /* object was successful. Otherwise `gen' is the NULL pointer  */ 
  /* and would cause a segmentation fault if used for sampling.  */
  if (gen == NULL) {
     fprintf(stderr, "ERROR: cannot create generator object\n");
     exit (EXIT_FAILURE);
  }

  /* It is possible to reuse the distribution object to create   */
  /* another generator object. If you do not need it any more,   */
  /* it should be destroyed to free memory.                      */
  unur_distr_free(distr);

  /* Now you can use the generator object `gen' to sample from   */
  /* the standard Gaussian distribution.                         */
  /* Eg.:                                                        */
  for (i=0; i<10; i++) {
    x = unur_sample_cont(gen);
    printf("%f\n",x);
  }

  /* When you do not need the generator object any more, you     */
  /* can destroy it.                                             */
  unur_free(gen);

  exit (EXIT_SUCCESS);

} /* end of main() */

/* ------------------------------------------------------------- */

Function reference

: UNUR_PAR* unur_cext_new (const UNUR_DISTR* distribution)

Get default parameters for new generator.

: int unur_cext_set_init (UNUR_PAR* parameters, int (* init)(UNUR_GEN* gen ))

Set initialization routine for external generator. Inside the

Important: The routine init must return UNUR_SUCCESS when the generator was initialized successfully and UNUR_FAILURE otherwise.

Parameters that are computed in the init routine can be stored in an array or structure that is avaiable by means of the unur_cext_get_params call. Parameters of the underlying distribution object can be obtained by the unur_cext_get_distrparams call.

: int unur_cext_set_sample (UNUR_PAR* parameters, double (* sample)(UNUR_GEN* gen ))

Set sampling routine for external generator.

Important: Use unur_sample_urng(gen) to get a uniform random number. The pointer to the array or structure that contains the parameters that are precomputed in the init routine are available by unur_cext_get_params(gen,0). Additionally one can use the unur_cext_get_distrparams call.

: void* unur_cext_get_params (UNUR_GEN* generator, size_t size)

Get pointer to memory block for storing parameters of external generator. A memory block of size size is automatically (re-) allocated if necessary and the pointer to this block is stored in the generator object. If one only needs the pointer to this memory block set size to 0.

Notice, that size is the size of the memory block and not the length of an array.

Important: This rountine should only be used in the initialization and sampling routine of the external generator.

: double* unur_cext_get_distrparams (UNUR_GEN* generator)
: int unur_cext_get_ndistrparams (UNUR_GEN* generator)

Get size of and pointer to array of parameters of underlying distribution in generator object.

Important: These rountines should only be used in the initialization and sampling routine of the external generator.


5.3.4 CSTD – Continuous STandarD distributions

Required:

standard distribution from UNU.RAN library (see Standard distributions) or continuous distribution with inverse CDF.

Speed:

Set-up: fast, Sampling: depends on distribution and generator

Reinit:

supported

CSTD is a wrapper for special generators for continuous univariate standard distributions. It only works for distributions in the UNU.RAN library of standard distributions (see Standard distributions) or for continuous distributions where the inverse CDF is given. If a distribution object is provided that is build from scratch, it must provide the inverse CDF. Then CSTD implements the inversion method. Otherwise, the NULL pointer is returned.

For some distributions more than one special generator is possible.

How To Use

Create a distribution object for a standard distribution from the UNU.RAN library (see Standard distributions), or create a continuous distribution object and set the function for the inverse CDF using unur_distr_cont_set_invcdf. For some distributions more than one special generator (variants) is possible. These can be choosen by a unur_cstd_set_variant call. For possible variants see Standard distributions. However the following are common to all distributions:

UNUR_STDGEN_DEFAULT

the default generator.

UNUR_STDGEN_FAST

the fastest available special generator.

UNUR_STDGEN_INVERSION

the inversion method (if available).

Notice that the variant UNUR_STDGEN_FAST for a special generator may be slower than one of the universal algorithms! Additional variants may exist for particular distributions.

Sampling from truncated distributions (which can be constructed by changing the default domain of a distribution by means of unur_distr_cont_set_domain or unur_cstd_chg_truncated calls) is possible but requires the inversion method. Moreover the CDF of the distribution must be implemented.

It is possible to change the parameters and the domain of the chosen distribution and run unur_reinit to reinitialize the generator object.

Function reference

: UNUR_PAR* unur_cstd_new (const UNUR_DISTR* distribution)

Get default parameters for new generator. It requires a distribution object for a continuous univariant distribution from the UNU.RAN library of standard distributions (see Standard distributions).

Using a truncated distribution is allowed only if the inversion method is available and selected by the unur_cstd_set_variant call immediately after creating the parameter object. Use a unur_distr_cont_set_domain call to get a truncated distribution. To change the domain of a (truncated) distribution of a generator use the unur_cstd_chg_truncated call.

: int unur_cstd_set_variant (UNUR_PAR* parameters, unsigned variant)

Set variant (special generator) for sampling from a given distribution. For possible variants see Standard distributions.

Common variants are UNUR_STDGEN_DEFAULT for the default generator, UNUR_STDGEN_FAST for (one of the) fastest implemented special generators, and UNUR_STDGEN_INVERSION for the inversion method (if available). If the selected variant number is not implemented, then an error code is returned and the variant is not changed.

: int unur_cstd_chg_truncated (UNUR_GEN* generator, double left, double right)

Change left and right border of the domain of the (truncated) distribution. This is only possible if the inversion method is used. Otherwise this call has no effect and an error code is returned.

Notice that the given truncated domain must be a subset of the domain of the given distribution. The generator always uses the intersection of the domain of the distribution and the truncated domain given by this call.

It is not required to run unur_reinit after this call has been used.

Important: If the CDF is (almost) the same for left and right and (almost) equal to 0 or 1, then the truncated domain is not chanced and the call returns an error code.

Notice: If the parameters of the distribution has been changed it is recommended to set the truncated domain again, since the former call might change the domain of the distribution but not update the values for the boundaries of the truncated distribution.


5.3.5 HINV – Hermite interpolation based INVersion of CDF

Required:

CDF

Optional:

PDF, dPDF

Speed:

Set-up: (very) slow, Sampling: (very) fast

Reinit:

supported

Reference:

[HLa03] [HLD04: Sect.7.2; Alg.7.1]

HINV is a variant of numerical inversion, where the inverse CDF is approximated using Hermite interpolation, i.e., the interval [0,1] is split into several intervals and in each interval the inverse CDF is approximated by polynomials constructed by means of values of the CDF and PDF at interval boundaries. This makes it possible to improve the accuracy by splitting a particular interval without recomputations in unaffected intervals. Three types of splines are implemented: linear, cubic, and quintic interpolation. For linear interpolation only the CDF is required. Cubic interpolation also requires PDF and quintic interpolation PDF and its derivative.

These splines have to be computed in a setup step. However, it only works for distributions with bounded domain; for distributions with unbounded domain the tails are chopped off such that the probability for the tail regions is small compared to the given u-resolution.

The method is not exact, as it only produces random variates of the approximated distribution. Nevertheless, the maximal numerical error in "u-direction" (i.e. |U-CDF(X)|, for X = "approximate inverse CDF"(U) |U-CDF(X)|) can be set to the required resolution (within machine precision). Notice that very small values of the u-resolution are possible but may increase the cost for the setup step.

As the possible maximal error is only estimated in the setup it may be necessary to set some special design points for computing the Hermite interpolation to guarantee that the maximal u-error can not be bigger than desired. Such points are points where the density is not differentiable or has a local extremum. Notice that there is no necessity to do so. However, if you do not provide these points to the algorithm there might be a small chance that the approximation error is larger than the given u-resolution, or that the required number of intervals is larger than necessary.

How To Use

HINV works for continuous univariate distribution objects with given CDF and (optional) PDF. It uses Hermite interpolation of order 1, 3 [default] or 5. The order can be set by means of unur_hinv_set_order. For distributions with unbounded domains the tails are chopped off such that the probability for the tail regions is small compared to the given u-resulution. For finding these cut points the algorithm starts with the region [-1.e20,1.e20]. For the exceptional case where this might be too small (or one knows this region and wants to avoid this search heuristics) it can be directly set via a unur_hinv_set_boundary call.

It is possible to use this method for generating from truncated distributions. It even can be changed for an existing generator object by an unur_hinv_chg_truncated call.

This method is not exact, as it only produces random variates of the approximated distribution. Nevertheless, the numerical error in "u-direction" (i.e. |U-CDF(X)|, for X = "approximate inverse CDF"(U) |U-CDF(X)|) can be controlled by means of unur_hinv_set_u_resolution. The possible maximal error is only estimated in the setup. Thus it might be necessary to set some special design points for computing the Hermite interpolation to guarantee that the maximal u-error can not be bigger than desired. Such points (e.g. extremal points of the PDF, points with infinite derivative) can be set using using the unur_hinv_set_cpoints call. If the mode for a unimodal distribution is set in the distribution object this mode is automatically used as design-point if the unur_hinv_set_cpoints call is not used.

As already mentioned the maximal error of this approximation is only estimated. If this error is crucial for an application we recommend to compute this error using unur_hinv_estimate_error which runs a small Monte Carlo simulation.

It is possible to change the parameters and the domain of the chosen distribution and run unur_reinit to reinitialize the generator object. The values given by the last unur_hinv_chg_truncated call will be then changed to the values of the domain of the underlying distribution object. Moreover, starting construction points (nodes) that are given by a unur_hinv_set_cpoints call are ignored when unur_reinit is called. It is important to note that for a distribution from the UNU.RAN library of standard distributions (see Standard distributions) the normalization constant has to be updated using the unur_distr_cont_upd_pdfarea call whenever its parameters have been changed by means of a unur_distr_cont_set_pdfparams call.

Function reference

: UNUR_PAR* unur_hinv_new (const UNUR_DISTR* distribution)

Get default parameters for generator.

: int unur_hinv_set_order (UNUR_PAR* parameters, int order)

Set order of Hermite interpolation. Valid orders are 1, 3, and 5. Notice that order greater than 1 requires the density of the distribution, and order greater than 3 even requires the derivative of the density. Using order 1 results for most distributions in a huge number of intervals and is therefore not recommended. If the maximal error in u-direction is very small (say smaller than 1.e-10), order 5 is recommended as it leads to considerably fewer design points, as long there are no poles or heavy tails.

Remark: When the target distribution has poles or (very) heavy tails order 5 (i.e., quintic interpolation) is numerically less stable and more sensitive to round-off errors than order 3 (i.e., cubic interpolation).

Default is 3 if the density is given and 1 otherwise.

: int unur_hinv_set_u_resolution (UNUR_PAR* parameters, double u_resolution)

Set maximal error in u-direction. However, the given u-error must not be smaller than machine epsilon (DBL_EPSILON) and should not be too close to this value. As the resolution of most uniform random number sources is 2^(-32) = 2.3e-10, a value of 1.e-10 leads to an inversion algorithm that could be called exact. For most simulations slightly bigger values for the maximal error are enough as well.

Remark: The u-error might become larger than u_resolution due to rescaling of floating point numbers when the domain of the distribution is truncated by a unur_hinv_chg_truncated call.

Default is 1.e-10.

: int unur_hinv_set_cpoints (UNUR_PAR* parameters, const double* stp, int n_stp)

Set starting construction points (nodes) for Hermite interpolation.

As the possible maximal error is only estimated in the setup it may be necessary to set some special design points for computing the Hermite interpolation to guarantee that the maximal u-error can not be bigger than desired. We suggest to include as special design points all local extrema of the density, all points where the density is not differentiable, and isolated points inside of the domain with density 0. If there is an interval with density constant equal to 0 inside of the given domain of the density, both endpoints of this interval should be included as special design points. Notice that there is no necessity to do so. However, if these points are not provided to the algorithm the approximation error might be larger than the given u-resolution, or the required number of intervals could be larger than necessary.

Important: Notice that the given points must be in increasing order and they must be disjoint.

Important: The boundary point of the computational region must not be given in this list! Points outside the boundary of the computational region are ignored.

Default is for unimodal densities - if known - the mode of the density, if it is not equal to the border of the domain.

: int unur_hinv_set_boundary (UNUR_PAR* parameters, double left, double right)

Set the left and right boundary of the computational interval. Of course +/- UNUR_INFINITY is not allowed. If the CDF at left and right is not close to the respective values 0. and 1. then this interval is increased by a (rather slow) search algorithm.

Important: This call does not change the domain of the given distribution itself. But it restricts the domain for the resulting random variates.

Default is 1.e20.

: int unur_hinv_set_guidefactor (UNUR_PAR* parameters, double factor)

Set factor for relative size of the guide table for indexed search (see also method DGT DGT – (Discrete) Guide Table method (indexed search)). It must be greater than or equal to 0. When set to 0, then sequential search is used.

Default is 1.

: int unur_hinv_set_max_intervals (UNUR_PAR* parameters, int max_ivs)

Set maximum number of intervals. No generator object is created if the necessary number of intervals for the Hermite interpolation exceeds max_ivs. It is used to prevent the algorithm to eat up all memory for very badly shaped CDFs.

Default is 1000000 (1.e6).

: int unur_hinv_get_n_intervals (const UNUR_GEN* generator)

Get number of nodes (design points) used for Hermite interpolation in the generator object. The number of intervals is the number of nodes minus 1. It returns an error code in case of an error.

: double unur_hinv_eval_approxinvcdf (const UNUR_GEN* generator, double u)

Evaluate Hermite interpolation of inverse CDF at u. If u is out of the domain [0,1] then unur_errno is set to UNUR_ERR_DOMAIN and the respective bound of the domain of the distribution are returned (which is -UNUR_INFINITY or UNUR_INFINITY in the case of unbounded domains).

Notice: When the domain has been truncated by a unur_hinv_chg_truncated call then the inverse CDF of the truncated distribution is returned.

: int unur_hinv_chg_truncated (UNUR_GEN* generator, double left, double right)

Changes the borders of the domain of the (truncated) distribution.

Notice that the given truncated domain must be a subset of the domain of the given distribution. The generator always uses the intersection of the domain of the distribution and the truncated domain given by this call. The tables of splines are not recomputed. Thus it might happen that the relative error for the generated variates from the truncated distribution is greater than the bound for the non-truncated distribution. This call also fails when the CDF values of the boundary points are too close, i.e. when only a few different floating point numbers would be computed due to round-off errors with floating point arithmetic.

Remark: The u-error might become larger than the u_resolution given by a unur_hinv_set_u_resolution call due to rescaling of floating point numbers when the domain of the distribution is truncated.

When failed an error code is returned.

Important: Always check the return code since the domain is not changed in case of an error.

: int unur_hinv_estimate_error (const UNUR_GEN* generator, int samplesize, double* max_error, double* MAE)

Estimate maximal u-error and mean absolute error (MAE) for generator by means of a (quasi-) Monte-Carlo simulation with sample size samplesize. The results are stored in max_error and MAE, respectively.

It returns UNUR_SUCCESS if successful.


5.3.6 HRB – Hazard Rate Bounded

Required:

bounded hazard rate

Optional:

upper bound for hazard rate

Speed:

Set-up: fast, Sampling: slow

Reinit:

supported

Reference:

[HLD04: Sect.9.1.4; Alg.9.4]

Generates random variate with given hazard rate which must be bounded from above. It uses the thinning method with a constant dominating hazard function.

How To Use

HRB requires a hazard function for a continuous distribution together with an upper bound. The latter has to be set using the unur_hrb_set_upperbound call. If no such upper bound is given it is assumed that the upper bound can be achieved by evaluating the hazard rate at the left hand boundary of the domain of the distribution. Notice, however, that for decreasing hazard rate the method HRD (see Hazard Rate Decreasing) is much faster and thus the prefered method.

It is important to note that the domain of the distribution can be set via a unur_distr_cont_set_domain call. However, the left border must not be negative. Otherwise it is set to 0. This is also the default if no domain is given at all. For computational reasons the right border is always set to UNUR_INFINITY independently of the given domain. Thus for domains bounded from right the function for computing the hazard rate should return UNUR_INFINITY right of this domain.

For distributions with increasing hazard rate method HRI (see Hazard Rate Increasing) is required.

It is possible to change the parameters and the domain of the chosen distribution and run unur_reinit to reinitialize the generator object. Notice, that the upper bound given by the unur_hrb_set_upperbound call cannot be changed and must be valid for the changed distribution.

Function reference

: UNUR_PAR* unur_hrb_new (const UNUR_DISTR* distribution)

Get default parameters for generator.

: int unur_hrb_set_upperbound (UNUR_PAR* parameters, double upperbound)

Set upper bound for hazard rate. If this call is not used it is assumed that the the maximum of the hazard rate is achieved at the left hand boundary of the domain of the distribution.

: int unur_hrb_set_verify (UNUR_PAR* parameters, int verify)
: int unur_hrb_chg_verify (UNUR_GEN* generator, int verify)

Turn verifying of algorithm while sampling on/off. If the hazard rate is not bounded by the given bound, then unur_errno is set to UNUR_ERR_GEN_CONDITION.

Default is FALSE.


5.3.7 HRD – Hazard Rate Decreasing

Required:

decreasing (non-increasing) hazard rate

Speed:

Set-up: fast, Sampling: slow

Reinit:

supported

Reference:

[HLD04: Sect.9.1.5; Alg.9.5]

Generates random variate with given non-increasing hazard rate. It is necessary that the distribution object contains this hazard rate. Decreasing hazard rate implies that the corresponding PDF of the distribution has heavier tails than the exponential distribution (which has constant hazard rate).

How To Use

HRD requires a hazard function for a continuous distribution with non-increasing hazard rate. There are no parameters for this method.

It is important to note that the domain of the distribution can be set via a unur_distr_cont_set_domain call. However, only the left hand boundary is used. For computational reasons the right hand boundary is always reset to UNUR_INFINITY. If no domain is given by the user then the left hand boundary is set to 0.

For distributions which do not have decreasing hazard rates but are bounded from above use method HRB (see Hazard Rate Bounded). For distributions with increasing hazard rate method HRI (see Hazard Rate Increasing) is required.

It is possible to change the parameters and the domain of the chosen distribution and run unur_reinit to reinitialize the generator object.

Function reference

: UNUR_PAR* unur_hrd_new (const UNUR_DISTR* distribution)

Get default parameters for generator.

: int unur_hrd_set_verify (UNUR_PAR* parameters, int verify)
: int unur_hrd_chg_verify (UNUR_GEN* generator, int verify)

Turn verifying of algorithm while sampling on/off. If the hazard rate is not bounded by the given bound, then unur_errno is set to UNUR_ERR_GEN_CONDITION.

Default is FALSE.


5.3.8 HRI – Hazard Rate Increasing

Required:

increasing (non-decreasing) hazard rate

Speed:

Set-up: fast, Sampling: slow

Reinit:

supported

Reference:

[HLD04: Sect.9.1.6; Alg.9.6]

Generates random variate with given non-increasing hazard rate. It is necessary that the distribution object contains this hazard rate. Increasing hazard rate implies that the corresponding PDF of the distribution has heavier tails than the exponential distribution (which has constant hazard rate).

The method uses a decomposition of the hazard rate into a main part which is constant for all x beyond some point p0 and a remaining part. From both of these parts points are sampled using the thinning method and the minimum of both is returned. Sampling from the first part is easier as we have a constant dominating hazard rate. Thus p0 should be large. On the other hand, if p0 is large than the thinning algorithm needs many iteration. Thus the performance of the the algorithm deponds on the choice of p0. We found that values close to the expectation of the generated distribution result in good performance.

How To Use

HRI requires a hazard function for a continuous distribution with non-decreasing hazard rate. The parameter p0 should be set to a value close to the expectation of the required distribution using unur_hri_set_p0. If performance is crucial one may try other values as well.

It is important to note that the domain of the distribution can be set via a unur_distr_cont_set_domain call. However, only the left hand boundary is used. For computational reasons the right hand boundary is always reset to UNUR_INFINITY. If no domain is given by the user then the left hand boundary is set to 0.

For distributions with decreasing hazard rate method HRD (see Hazard Rate Decreasing) is required. For distributions which do not have increasing or decreasing hazard rates but are bounded from above use method HRB (see Hazard Rate Bounded).

It is possible to change the parameters and the domain of the chosen distribution and run unur_reinit to reinitialize the generator object.

Notice, that the upper bound given by the unur_hrb_set_upperbound call cannot be changed and must be valid for the changed distribution. Notice that the parameter p0 which has been set by a unur_hri_set_p0 call cannot be changed and must be valid for the changed distribution.

Function reference

: UNUR_PAR* unur_hri_new (const UNUR_DISTR* distribution)

Get default parameters for generator.

: int unur_hri_set_p0 (UNUR_PAR* parameters, double p0)

Set design point for algorithm. It is used to split the domain of the distribution. Values for p0 close to the expectation of the distribution results in a relatively good performance of the algorithm. It is important that the hazard rate at this point must be greater than 0 and less than UNUR_INFINITY.

Default: left boundary of domain + 1.

: int unur_hri_set_verify (UNUR_PAR* parameters, int verify)
: int unur_hri_chg_verify (UNUR_GEN* generator, int verify)

Turn verifying of algorithm while sampling on/off. If the hazard rate is not bounded by the given bound, then unur_errno is set to UNUR_ERR_GEN_CONDITION.

Default is FALSE.


5.3.9 ITDR – Inverse Transformed Density Rejection

Required:

monotone PDF, dPDF, pole

Optional:

splitting point between pole and tail region, c-values

Speed:

Set-up: moderate, Sampling: moderate

Reinit:

supported

Reference:

[HLDa07]

ITDR is an acceptance/rejection method that works for monotone densities. It is especially designed for PDFs with a single pole. It uses different hat functions for the pole region and for the tail region. For the tail region Transformed Density Rejection with a single construction point is used. For the pole region a variant called Inverse Transformed Density Rejection is used. The optimal splitting point between the two regions and the respective maximum local concavity and inverse local concavity (see Glossary) that guarantee valid hat functions for each regions are estimated. This splitting point is set to the intersection point of local concavity and inverse local concavity. However, it is assumed that both, the local concavity and the inverse local concavity do not have a local minimum in the interior of the domain (which is the case for all standard distributions with a single pole). In other cases (or when the built-in search routines do not compute non-optimal values) one can provide the splitting point, and the c-values.

How To Use

Method ITDR requires a distribution object with given PDF and its derivative and the location of the pole (or mode). The PDF must be monotone and may contain a pole. It must be set via the unur_distr_cont_set_pdf and unur_distr_cont_set_dpdf calls. The PDF should return UNUR_INFINITY for the pole. Alternatively, one can also set the logarithm of the PDF and its derivative via the unur_distr_cont_set_logpdf and unur_distr_cont_set_dlogpdf calls. This is in especially useful since then the setup and search routines are numerically more stable. Moreover, for many distributions computing the logarithm of the PDF is less expensive then computing the PDF directly.

The pole of the distribution is given by a unur_distr_cont_set_mode call. Notice that distributions with “heavy” poles may have numerical problems caused by the resultion of the floating point numbers used by computers. While the minimal distance between two different floating point numbers is about 1.e-320 near 0. it increases to 1.e-16 near 1. Thus any random variate generator implemented on a digital computer in fact draws samples from a discrete distribution that approximates the desired continuous distribution. For distributions with “heavy” poles not at 0 this approximation may be too crude and thus every goodness-of-fit test will fail. Besides this theoretic problem that cannot be resolved we have to take into consideration that round-off errors occur more frequently when we have PDFs with poles far away from 0. Method ITDR tries to handles this situation as good as possible by moving the pole into 0. Thus do not use a wrapper for your PDF that hides this shift since the information about the resolution of the floating point numbers near the pole gets lost.

Method ITDR uses different hats for the pole region and for the tail region. The splitting point between these two regions, the optimal c-value and design points for constructing the hats using Transformed Density Rejection are computed automatically. (The results of these computations can be read using the respective calls unur_itdr_get_xi unur_itdr_get_cp , and unur_itdr_get_ct for the intersection point between local concavity and inverse local concavity, the c-value for the pole and the tail region.) However, one can also analyze the local concavity and inverse local concavity set the corresponding values using unur_itdr_set_xi unur_itdr_set_cp , and unur_itdr_set_ct calls. Notice, that c-values greater than -1/2 can be set to -0.5. Although this results in smaller acceptance probabities sampling from the hat distribution is much faster than for other values of c. Depending on the expenses of evaluating the PDF the resulting algorithm is usually faster.

It is possible to change the parameters and the domain of the chosen distribution and run unur_reinit to reinitialize the generator object. However, the values given by unur_itdr_set_xi unur_itdr_set_cp , or unur_itdr_set_ct calls are then ignored when unur_reinit is called.

Function reference

: UNUR_PAR* unur_itdr_new (const UNUR_DISTR* distribution)

Get default parameters for generator.

: int unur_itdr_set_xi (UNUR_PAR* parameters, double xi)

Sets points where local concavity and inverse local concavity are (almost) equal. It is used to estimate the respective c-values for pole region and hat regions and to determine the splitting point bx between pole and tail region. If no such point is provided it will be computed automatically.

Default: not set.

: int unur_itdr_set_cp (UNUR_PAR* parameters, double cp)

Sets parameter cp for transformation T for inverse density in pole region. It must be at most 0 and greater than -1. A value of -0.5 is treated separately and usually results in faster marginal generation time (at the expense of smaller acceptance probabilities. If no cp-value is given it is estimated automatically.

Default: not set.

: int unur_itdr_set_ct (UNUR_PAR* parameters, double ct)

Sets parameter ct for transformation T for density in tail region. It must be at most 0. For densities with unbounded domain it must be greater than -1. A value of -0.5 is treated separately and usually results in faster marginal generation time (at the expense of smaller acceptance probabilities. If no ct-value is given it is estimated automatically.

Default: not set.

: double unur_itdr_get_xi (UNUR_GEN* generator)
: double unur_itdr_get_cp (UNUR_GEN* generator)
: double unur_itdr_get_ct (UNUR_GEN* generator)

Get intersection point xi, and c-values cp and ct, respectively. (In case of an error UNUR_INFINITY is returned.)

: double unur_itdr_get_area (UNUR_GEN* generator)

Get area below hat. (In case of an error UNUR_INFINITY is returned.)

: int unur_itdr_set_verify (UNUR_PAR* parameters, int verify)

Turn verifying of algorithm while sampling on/off.

If the condition PDF(x) <= hat(x) is violated for some x then unur_errno is set to UNUR_ERR_GEN_CONDITION. However, notice that this might happen due to round-off errors for a few values of x (less than 1%).

Default is FALSE.

: int unur_itdr_chg_verify (UNUR_GEN* generator, int verify)

Change the verifying of algorithm while sampling on/off.


5.3.10 NINV – Numerical INVersion

Required:

CDF

Optional:

PDF

Speed:

Set-up: optional, Sampling: (very) slow

Reinit:

supported

NINV implementations of some methods for numerical inversion: Newton’s method, regula falsi (combined with interval bisectioning), and bisection method. Regula falsi and bisection method require only the CDF while Newton’s method also requires the PDF. To speed up marginal generation times a table with suitable starting points can be created during the setup. The performance of the algorithm can adjusted by the desired accuracy of the method. It is possible to use this method for generating from truncated distributions. The truncated domain can be changed for an existing generator object.

How To Use

Method NINV generates random variates by numerical inversion and requires a continuous univariate distribution objects with given CDF. Three variants are available:

  • Regula falsi [default]
  • Newton’s method
  • Interval bisectioning

Newton’s method additionally requires the PDF of the distribution and cannot be used otherwise (NINV automatically switches to regula falsi then). Default algorithm is regula falsi. It is slightly slower but numerically much more stable than Newton’s algorithm. Interval bisectioning is the slowest method and should only be considered as a last resort when the other methods fails.

It is possible to draw samples from truncated distributions. The truncated domain can even be changed for an existing generator object by an unur_ninv_chg_truncated call.

Marginal generation times can be sped up by means of a table with suitable starting points which can be created during the setup. Using such a table can be switched on by means of a unur_ninv_set_table call where the table size is given as a parameter. The table is still useful when the (truncated) domain is changed often, since it is computed for the domain of the given distribution. (It is not possible to enlarge this domain.) If it is necessary to recalculate the table during sampling, the command unur_ninv_chg_table can be used. As a rule of thumb using such a table is appropriate when the number of generated points exceeds the table size by a factor of 100.

The default number of iterations of NINV should be enough for all reasonable cases. Nevertheless, it is possible to adjust the maximal number of iterations with the commands unur_ninv_set_max_iter and unur_ninv_chg_max_iter. In particular this might be necessary when the PDF has a pole or the distribution has extremely heavy tails.

It is also possible to set/change the accuracy of the method (which also heavily influencies the generation time). We use two measures for the approximation error which can be used independently: x-error and u-error (see The Inversion Method for more details). It is possible to set the maximal tolerated error using with unur_ninv_set_x_resolution and with unur_ninv_set_u_resolution resp., and change it with the respective calls unur_ninv_chg_x_resolution and unur_ninv_chg_x_resolution. The algorithm tries to satisfy both accuracy goals (and raises an error flag it this fails). One of these accuracy checks can be disabled by setting the accuracy goal to a negative value.

NINV tries to use proper starting values for both the regula falsi and bisection method, and for Newton’s method. Of course the user might have more knowledge about the properties of the target distribution and is able to share his wisdom with NINV using the respective commands unur_ninv_set_start and unur_ninv_chg_start. It is possible to change the parameters and the domain of the chosen distribution and run unur_reinit to reinitialize the generator object. The values given by the last unur_ninv_chg_truncated call will be then changed to the values of the domain of the underlying distribution object. It is important to note that for a distribution from the UNU.RAN library of standard distributions (see Standard distributions) the normalization constant has to be updated using the unur_distr_cont_upd_pdfarea call whenever its parameters have been changed by means of a unur_distr_cont_set_pdfparams call.

It might happen that NINV aborts unur_sample_cont without computing the correct value (because the maximal number iterations has been exceeded). Then the last approximate value for x is returned (with might be fairly false) and unur_error is set to UNUR_ERR_GEN_SAMPLING.

Function reference

: UNUR_PAR* unur_ninv_new (const UNUR_DISTR* distribution)

Get default parameters for generator.

: int unur_ninv_set_useregula (UNUR_PAR* parameters)

Switch to regula falsi combined with interval bisectioning. (This the default.)

: int unur_ninv_set_usenewton (UNUR_PAR* parameters)

Switch to Newton’s method. Notice that it is numerically less stable than regula falsi. It it is not possible to invert the CDF for a particular uniform random number U when calling unur_sample_cont unur_error is set to UNUR_ERR_GEN_SAMPLING. Thus it is recommended to check unur_error before using the result of the sampling routine.

: int unur_ninv_set_usebisect (UNUR_PAR* parameters)

Switch to bisection method. This is a slow algorithm and should only be used as a last resort.

: int unur_ninv_set_max_iter (UNUR_PAR* parameters, int max_iter)
: int unur_ninv_chg_max_iter (UNUR_GEN* generator, int max_iter)

Set and change number of maximal iterations. Default is 100.

: int unur_ninv_set_x_resolution (UNUR_PAR* parameters, double x_resolution)
: int unur_ninv_chg_x_resolution (UNUR_GEN* generator, double x_resolution)

Set and change the maximal tolerated relative x-error. If x_resolution is negative then checking of the x-error is disabled.

Default is 1.e-8.

: int unur_ninv_set_u_resolution (UNUR_PAR* parameters, double u_resolution)
: int unur_ninv_chg_u_resolution (UNUR_GEN* generator, double u_resolution)

Set and change the maximal tolerated (abolute) u-error. If u_resolution is negative then checking of the u-error is disabled.

Default is -1 (disabled).

: int unur_ninv_set_start (UNUR_PAR* parameters, double left, double right)

Set starting points. If not set, suitable values are chosen automatically.

Newton:left:starting point
Regula falsi:left, right:boundary of starting interval

If the starting points are not set then the follwing points are used by default:

Newton:left:CDF(left) = 0.5
Regula falsi:left:CDF(left) = 0.1
right:CDF(right) = 0.9

If left == right, then UNU.RAN always uses the default starting points!

: int unur_ninv_chg_start (UNUR_GEN* gen, double left, double right)

Change the starting points for numerical inversion. If left==right, then UNU.RAN uses the default starting points (see unur_ninv_set_start ).

: int unur_ninv_set_table (UNUR_PAR* parameters, int no_of_points)

Generates a table with no_of_points points containing suitable starting values for the iteration. The value of no_of_points must be at least 10 (otherwise it will be set to 10 automatically).

The table points are chosen such that the CDF at these points form an equidistance sequence in the interval (0,1).

If a table is used, then the starting points given by unur_ninv_set_start are ignored.

No table is used by default.

: int unur_ninv_chg_table (UNUR_GEN* gen, int no_of_points)

Recomputes a table as described in unur_ninv_set_table.

: int unur_ninv_chg_truncated (UNUR_GEN* gen, double left, double right)

Changes the borders of the domain of the (truncated) distribution.

Notice that the given truncated domain must be a subset of the domain of the given distribution. The generator always uses the intersection of the domain of the distribution and the truncated domain given by this call. Moreover the starting point(s) will not be changed.

Important: If the CDF is (almost) the same for left and right and (almost) equal to 0 or 1, then the truncated domain is not chanced and the call returns an error code.

Notice: If the parameters of the distribution has been changed by a unur_distr_cont_set_pdfparams call it is recommended to set the truncated domain again, since the former call might change the domain of the distribution but not update the values for the boundaries of the truncated distribution.

: double unur_ninv_eval_approxinvcdf (const UNUR_GEN* generator, double u)

Get approximate approximate value of inverse CDF at u. If u is out of the domain [0,1] then unur_errno is set to UNUR_ERR_DOMAIN and the respective bound of the domain of the distribution are returned (which is -UNUR_INFINITY or UNUR_INFINITY in the case of unbounded domains).

Notice: This function always evaluates the inverse CDF of the given distribution. A call to unur_ninv_chg_truncated call has no effect.


5.3.11 NROU – Naive Ratio-Of-Uniforms method

Required:

PDF

Optional:

mode, center, bounding rectangle for acceptance region

Speed:

Set-up: slow or fast, Sampling: moderate

Reinit:

supported

Reference:

[HLD04: Sect.2.4 and Sect.6.4]

NROU is an implementation of the (generalized) ratio-of-uniforms method which uses (minimal) bounding rectangles, see The Ratio-of-Uniforms Method. It uses a positive control parameter r for adjusting the algorithm to the given distribution to improve performance and/or to make this method applicable. Larger values of r increase the class of distributions for which the method works at the expense of a higher rejection constant. For computational reasons r=1 should be used if possible (this is the default). Moreover, this implementation uses the center mu of the distribution (see unur_distr_cont_get_center for details of its default values).

For the special case with r=1 the coordinates of the minimal bounding rectangles are given by

v+ = sup_x sqrt(PDF(x)),
u- = inf_x (x- mu) sqrt(PDF(x)),
u+ = sup_x (x- mu) sqrt(PDF(x)),

where mu is the center of the distribution. For other values of r we have

v+ = sup_x (PDF(x))1/(r+1),
u- = inf_x (x- mu) (PDF(x))r/(r+1),
u+ = sup_x (x- mu) (PDF(x))r/(r+1).

These bounds can be given directly. Otherwise they are computed automatically by means of a (slow) numerical routine. Of course this routine can fail, especially when this rectangle is not bounded.

It is important to note that the algorithm works with PDF(x- mu) instead of PDF(x). This is important as otherwise the acceptance region can become a very long and skinny ellipsoid along a diagonal of the (huge) bounding rectangle.

How To Use

For using the NROU method UNU.RAN needs the PDF of the distribution. Additionally, the parameter r can be set via a unur_vnrou_set_r call. Notice that the acceptance probability decreases when r is increased. On the other hand is is more unlikely that the bounding rectangle does not exist if r is small.

A bounding rectangle can be given by the unur_vnrou_set_u and unur_vnrou_set_v calls.

Important: The bounding rectangle has to be provided for the function PDF(x-center)! Notice that center is the center of the given distribution, see unur_distr_cont_set_center. If in doubt or if this value is not optimal, it can be changed (overridden) by a unur_nrou_set_center call.

If the coordinates of the bounding rectangle are not provided by the user then the minimal bounding rectangle is computed automatically.

By means of unur_vnrou_set_verify and unur_vnrou_chg_verify one can run the sampling algorithm in a checking mode, i.e., in every cycle of the rejection loop it is checked whether the used rectangle indeed enclosed the acceptance region of the distribution. When in doubt (e.g., when it is not clear whether the numerical routine has worked correctly) this can be used to run a small Monte Carlo study.

It is possible to change the parameters and the domain of the chosen distribution and run unur_reinit to reinitialize the generator object. Notice, that derived parameters like the mode must also be (re-) set if the parameters or the domain has be changed. Notice, however, that then the values that has been set by unur_vnrou_set_u and unur_vnrou_set_v calls are removed and the coordinates of the bounding box are computed numerically.

Function reference

: UNUR_PAR* unur_nrou_new (const UNUR_DISTR* distribution)

Get default parameters for generator.

: int unur_nrou_set_u (UNUR_PAR* parameters, double umin, double umax)

Sets left and right boundary of bounding rectangle. If no values are given, the boundary of the minimal bounding rectangle is computed numerically.

Notice: Computing the minimal bounding rectangle may fail under some circumstances. Moreover, for multimodal distributions the bounds might be too small as only local extrema are computed. Nevertheless, for T_c -concave distributions with c=-1/2 it should work.

Important: The bounding rectangle that has to be provided is for the function PDF(x-center)!

Default: not set.

: int unur_nrou_set_v (UNUR_PAR* parameters, double vmax)

Set upper boundary for bounding rectangle. If this value is not given then sqrt(PDF(mode)) is used instead.

Notice: When the mode is not given for the distribution object, then it will be computed numerically.

Default: not set.

: int unur_nrou_set_r (UNUR_PAR* parameters, double r)

Sets the parameter r of the generalized ratio-of-uniforms method.

Notice: This parameter must satisfy r>0.

Default: 1.

: int unur_nrou_set_center (UNUR_PAR* parameters, double center)

Set the center mu of the PDF. If not set the center of the given distribution object is used.

Default: see unur_distr_cont_set_center.

: int unur_nrou_set_verify (UNUR_PAR* parameters, int verify)

Turn verifying of algorithm while sampling on/off.

If the condition PDF(x) <= hat(x) is violated for some x then unur_errno is set to UNUR_ERR_GEN_CONDITION. However, notice that this might happen due to round-off errors for a few values of x (less than 1%).

Default is FALSE.

: int unur_nrou_chg_verify (UNUR_GEN* generator, int verify)

Change the verifying of algorithm while sampling on/off.


5.3.12 PINV – Polynomial interpolation based INVersion of CDF

Required:

PDF

Optional:

domain, center, CDF, derivative of PDF

Speed:

Set-up: (very) slow, Sampling: (very) fast

Reinit:

not implemented

Reference:

[DHLa08]

PINV is a variant of numerical inversion, where the inverse CDF is approximated using Newton’s interpolating formula. The interval [0,1] is split into several subintervals. In each of these the inverse CDF is constructed at nodes (CDF(x),x) for some points x in this subinterval. If the PDF is given, then the CDF is computed numerically from the given PDF using adaptive Gauss-Lobatto integration with 5 points. Subintervals are split until the requested accuracy goal is reached.

The method is not exact, as it only produces random variates of the approximated distribution. Nevertheless, the maximal tolerated approximation error can be set to be the resolution (but of course is bounded by the machine precision). We use the u-error |U-CDF(X)| to measure the error for X = "approximate inverse CDF"(U). Notice that very small values of the u-resolution are possible but increase the cost for the setup step. We call the maximal tolerated u-error the u-resolution of the algorithm in the sequel.

Both the order of the interpolating polynomial and the u-resolution can be selected.

The interpolating polynomials have to be computed in a setup step. However, it only works for distributions with bounded domain; for distributions with unbounded domain the tails are cut off such that the probability for the tail regions is small compared to the given u-resolution.

The construction of the interpolation polynomial only works when the PDF is unimodal or when the PDF does not vanish between two modes.

There are some restrictions for the given distribution:

  • The support of the distribution (i.e., the region where the PDF is strictly positive) must be connected. In practice this means, that the region where PDF is "not too small" must be connected. Unimodal densities satisfy this condition. If this condition is violated then the domain of the distribution might be truncated.
  • When the PDF is integrated numerically, then the given PDF must be continuous and should be smooth.
  • The PDF must be bounded.
  • The algorithm has problems when the distribution has heavy tails (as then the inverse CDF becomes very steep at 0 or 1) and the requested u-resolution is very small. E.g., the Cauchy distribution is likely to show this problem when the requested u-resolution is less then 1.e-12.

Regions with very small PDF values or heavy tails might lead to an abortion of the set-up or (even worse) the approximation error might become larger than requested, since the (computation of the) interpolating polynomial becomes numerically unstable.

Remark: We also have implemented experimental variants. However, we observed that these variants are more sensitive to round-off errors, especially in the right hand tail and we do not recommend their usage unless there are severe reasons.

  • Use a function that implements the CDF instead of numerical integration of the PDF.
  • Use Hermite interpolation instead of Newton interpolation. Thus the first (and second) derivative of the interpolating polynomial coincides with that of the inverse CDF. Consequently the interpolant is also (twice) differentiable even at the interval boundaries. This variant can be seen as limiting case of Newton interpolation with double (or triple) points as nodes.

    We have used a smoothness parameter to control this feature. However, besides numerical problems we observed that this variant requires more intervals and thus larger setup times and higher memory consumptions.

How To Use

PINV works for continuous univariate distribution objects with given PDF. The corresponding distribution object should contain a typical point of the distribution, i.e., a point where the PDF is not too small, e.g., (a point near) the mode. However, it is important that the center is not the pole of the distribution (or a point too close to the pole). It can be set using a unur_distr_cont_set_center or a unur_distr_cont_set_mode call. If neither is set, or if the given center cannot be used, then a simple search routine tries to find an appropriate point for the center.

It is recommended that the domain of the distribution with bounded domain is specified using a unur_distr_cont_set_domain call. Otherwise, the boundary is searched numerically which might be rather expensive, especially when this boundary point is 0.

The inverse CDF is interpolated using Newton polynomials. The order of this polynomial can be set by means of a unur_pinv_set_order call.

The smoothness of the interpolant at interval boundaries can be controlled using a unur_pinv_set_smoothness call. Then Hermite interpolation instead of Newton interpolation is used. (The former can be seen as a limiting case of Newton interpolation with double (or triple) points.) However, using higher smoothness is not recommended unless differentiability at the interval boundaries is important.

For distributions with unbounded domains the tails are cut off such that the probability for the tail regions is small compared to the given u-resolution. For finding these cut points the algorithm starts with the region [-1.e100,1.e100]. For the exceptional case where this does not work these starting points can be changed via a unur_pinv_set_boundary call.

This method is not exact, as it only produces random variates of the approximated distribution. Nevertheless, the numerical error in "u-direction" (i.e., |U-CDF(X)|, for X = "approximate inverse CDF"(U) |U-CDF(X)|) can be controlled by means of unur_pinv_set_u_resolution. However, the maximal error of this approximation is only estimated. For very small u-resolutions the actual approximation error might be (slightly) larger than the requested u-resolution. (Of course the size of this value depends on the given PDF.) If this error is crucial for an application we recommend to compute this error using unur_pinv_estimate_error which runs a small Monte Carlo simulation. It is also possible to improve the error estimate during setup by means of unur_pinv_set_extra_testpoints. See also the documentation for function unur_pinv_set_u_resolution and the remark given there.

The number of required subintervals heavily depends on the order of the interpolating polynomial and the requested u-resolution: it increases when order or u-resolution are decreased. It can be checked using a unur_pinv_get_n_intervals call. The maximum number of such subintervals is fixed but can be increased using a unur_pinv_set_max_intervals call. If this maximum number is too small then the set-up aborts with a corresponding error message.

It is also possible to use the CDF of the distribution instead of the PDF. Then the distribution object must contain a pointer to the CDF. Moreover, this variant of the algorithm has to be switched on using an unur_pinv_set_usecdf call. Notice, however, that the setup for this variant is numerically less stable than using integration of the PDF (the default variant). Thus using the CDF is not recommended.

Function reference

: UNUR_PAR* unur_pinv_new (const UNUR_DISTR* distribution)

Get default parameters for generator.

: int unur_pinv_set_order (UNUR_PAR* parameters, int order)

Set order of interpolation. Valid orders are between 3 and 17. Higher orders result in fewer intervals for the approximations.

Default: 5.

: int unur_pinv_set_smoothness (UNUR_PAR* parameters, int smoothness)

Set smoothness of interpolant. By construction the interpolant is piecewise polynomial and thus smooth on each of the intervals where these polynomials are constructed. At the interval boundaries, however, it usually not be differentiable. Method PINV also implements variants of Newton interpolation where the first (or second) derivative of the interpolating polynomial coincides with the respective derivative of the inverse CDF at the nodes. The the interpolant is (twice) differentiable even at the interval boundaries. These variants can be seen as limiting case of Newton interpolation with double (or triple) points as nodes and are known as Hermite interpolation.

Possible values for smoothness:

ValueEffectRequirements
0continuousrequires PDF (or CDF)
1differentiablerequires PDF (optional: CDF),
order of polynomial must be odd
2twice differentiablerequires PDF and its derivative (optional: CDF),
order must be 5, 8, 11, 14 or 17

If the order of the polynomial does not satisfy the given condition, then it is increased to the next larger possible value.

Remark: A higher smoothness parameter usually results in a higher number of intervals and thus a higher setup time and memory consumption. We also observed that higher smoothness parameters make the algorithm more sensible for round-off error. Then the setup fails.

Remark: If the interpolating polynomial cannot be constructed for the requested smoothness on a particular interval, then the smoothness parameter is reduced for that interval.

Remark: For order 3 and smoothness 1 (cubic Hermite interpolation) monotonicity is guaranteed by checking a simple monotonicity condition for the coefficients of the polynomials.

Remark: Using smoothness larger than 0 is not recommended unless differentiability at the interval boundaries is important for ones application.

Default: 0.

: int unur_pinv_set_u_resolution (UNUR_PAR* parameters, double u_resolution)

Set maximal tolerated u-error. Values of u_resolution must at least 1.e-15 and 1.e-5 at most. Notice that the resolution of most uniform random number sources is 2-32 = 2.3e-10. Thus a value of 1.e-10 leads to an inversion algorithm that could be called exact. For most simulations slightly bigger values for the maximal error are enough as well.

Smaller values for u_resolution increase the number of subinterval that are necessary for the approximation of the inverse CDF. For very small values (less then 1.e-12) this number might exceed the maximum number of such intervals. However, this number can be increased using a unur_pinv_set_max_intervals call.

Remark: We ran many experiments and found that the observed u-error was always smaller than the given u_resolution whenever this value was 1.e-12. For values smaller than 1e-13 the maximal observed u-error was slightly larger. One use 1.e-15 if best approximation is required. However, then the actual u-error can be as large as 1.e-14.

Consider calling unur_pinv_set_extra_testpoints in order to reduce the risk of larger approximation errors.

Warning! These figures are based on our experiments (with some tolerance added to be on the safe side). There is no guarantee for these error estimates for a particular distribution.

Default is 1.e-10.

: int unur_pinv_set_extra_testpoints (UNUR_PAR* parameters, int n_points)

During setup method PINV checks the current u-error by means of carefully selected test points and improves the approximation where necessary. However, it nevertheless may happen, that the maximal approximation error is larger than estimated in some interval (which usually is hit with a very small probability). This estimate can be improved by using extra test points which can be added by means of this call. However, this increases the setup time considerably. Note that these additional points are selected equidistributed in each subinterval.

Default is 0 (i.e., no additional test points are used).

: int unur_pinv_set_use_upoints (UNUR_PAR* parameters, int use_upoints)

If use_upoints is TRUE, then the nodes of the interpolating polynomial are constructed by means of Chebyshev points in u-scale not in x-scale. This results is a better approximation but almost doubles the number of PDF or CDF evaluations during the setup. (This is an experimental feature.)

Default: FALSE

: int unur_pinv_set_usepdf (UNUR_PAR* parameters)

Use PDF (if available) to compute approximate inverse CDF.

This is the default.

: int unur_pinv_set_usecdf (UNUR_PAR* parameters)

Use CDF (if available) to compute approximate inverse CDF. This variant is intend for running experiments with method PINV.

Remark: We ran many experiments and found that for small values of the given u_resolution (less than 1.e-12) the setup fails for distributions with heavy tails. We found that using the PDF (instead of the CDF) is numerically more stable. This is especially the case when the smoothness parameter is set to 1 or 2.

Using the CDF is not recommended.

: int unur_pinv_set_boundary (UNUR_PAR* parameters, double left, double right)

Set left and right point for finding the cut-off points for the "computational domain", i.e., the domain that covers the essential part of the distribution. The cut-off points are computed such that the tail probabilities are smaller than given by unur_pinv_set_u_resolution. It is usually safe to use a large interval. However, +/- UNUR_INFINITY is not allowed.

Important: This call does not change the domain of the given distribution itself. But it restricts the domain for the resulting random variates.

Default: intersection of [-1.e100,+1.e100] and the given domain of the distribution.

: int unur_pinv_set_searchboundary (UNUR_PAR* parameters, int left, int right)

If left or right is set to FALSE then the respective boundary as given by a unur_pinv_set_boundary call is used without any further computations. However, these boundary points might cause numerical problems during the setup when PDF returns 0 “almost everywhere”. If set to TRUE (the default) then the computational interval is shortened to a more sensible region by means of a search algorithm. Switching off this search is useful, e.g., for the Gamma(2) distribution where the left border 0 is fixed and finite.

Remark: The searching algorithm assumes that the support of the distribution is connected.

Remark: Do not set this parameter to FALSE except when searching for cut-off points fails and one wants to try with precomputed values.

Default: TRUE.

: int unur_pinv_set_max_intervals (UNUR_PAR* parameters, int max_ivs)

Set maximum number of intervals. max_ivs must be at least 100 and at most 1000000.

Default is 10000.

: int unur_pinv_get_n_intervals (const UNUR_GEN* generator)

Get number of intervals used for interpolation in the generator object. It returns 0 in case of an error.

: int unur_pinv_set_keepcdf (UNUR_PAR* parameters, int keepcdf)

If the PDF is given, then the CDF is computed numerically from the given PDF using adaptive Gauss-Lobatto integration. Thus a table of CDF points is stored to keep the number of evaluations of the PDF minimal. Usually this table is discarded when the setup is completed. If keepcdf is TRUE, then this table is kept and can be used to compute the CDF of the underlying distribution by means of function unur_pinv_eval_approxcdf. This option is ignored when unur_pinv_set_usecdf is called.

Default: FALSE

: double unur_pinv_eval_approxinvcdf (const UNUR_GEN* generator, double u)

Evaluate interpolation of inverse CDF at u. If u is out of the domain (0,1) then unur_errno is set to UNUR_ERR_DOMAIN and the respective bound of the domain of the distribution are returned (which is -UNUR_INFINITY or UNUR_INFINITY in the case of unbounded domains).

: double unur_pinv_eval_approxcdf (const UNUR_GEN* generator, double x)

Evaluate (approximate) CDF at x. If the PDF of the distribution is given, then adaptive Gauss-Lobatto integration is used to compute the CDF. If the PDF is used to create the generator object, then the table of integral values must not removed at the end of setup and thus unur_pinv_set_keepcdf must be called.

: int unur_pinv_estimate_error (const UNUR_GEN* generator, int samplesize, double* max_error, double* MAE)

Estimate maximal u-error and mean absolute error (MAE) for generator by means of Monte-Carlo simulation with sample size samplesize. The results are stored in max_error and MAE, respectively.

It returns UNUR_SUCCESS if successful.


5.3.13 SROU – Simple Ratio-Of-Uniforms method

Required:

T-concave PDF, mode, area

Speed:

Set-up: fast, Sampling: slow

Reinit:

supported

Reference:

[LJa01] [LJa02] [HLD04: Sect.6.3.1; Sect.6.3.2; Sect.6.4.1; Alg.6.4; Alg.6.5; Alg.6.7]

SROU is based on the ratio-of-uniforms method (see The Ratio-of-Uniforms Method) that uses universal inequalities for constructing a (universal) bounding rectangle. It works for all T-concave distributions, including log-concave and T-concave distributions with T(x) = -1/sqrt(x).

Moreover an (optional) parameter r can be given, to adjust the generator to the given distribution. This parameter is strongly related to the parameter c for transformed density rejection (see TDR – Transformed Density Rejection) via the formula c = -r/(r+1). The rejection constant increases with higher values for r. On the other hand, the given density must be T_c -concave for the corresponding c. The default setting for r is 1 which results in a very simple code. (For other settings, sampling uniformly from the acceptance region is more complicated.)

Optionally the CDF at the mode can be given to increase the performance of the algorithm. Then the rejection constant is reduced by 1/2 and (if r=1) even a universal squeeze can (but need not be) used. A way to increase the performance of the algorithm when the CDF at the mode is not provided is the usage of the mirror principle (only if r=1). However, using squeezes and using the mirror principle is only recommended when the PDF is expensive to compute.

The exact location of the mode and/or the area below the PDF can be replace by appropriate bounds. Then the algorithm still works but has larger rejection constants.

How To Use

SROU works for any continuous univariate distribution object with given T_c -concave PDF with c<1, ) mode and area below PDF. Optional the CDF at the mode can be given to increase the performance of the algorithm by means of the unur_srou_set_cdfatmode call. Additionally squeezes can be used and switched on via unur_srou_set_usesqueeze (only if r=1). A way to increase the performance of the algorithm when the CDF at the mode is not provided is the usage of the mirror principle which can be swithced on by means of a unur_srou_set_usemirror call (only if r=1) . However using squeezes and using the mirror principle is only recommended when the PDF is expensive to compute.

The parameter r can be given, to adjust the generator to the given distribution. This parameter is strongly related parameter c for transformed density rejection via the formula c = -r/(r+1). The parameter r can be any value larger than or equal to 1. Values less then 1 are automatically set to 1. The rejection constant depends on the chosen parameter r but not on the particular distribution. It is 4 for r equal to 1 and higher for higher values of r. It is important to note that different algorithms for different values of r: If r equal to 1 this is much faster than the algorithm for r greater than 1. The default setting for r is 1.

If the (exact) area below the PDF is not known, then an upper bound can be used instead (which of course increases the rejection constant). But then the squeeze flag must not be set and unur_srou_set_cdfatmode must not be used.

If the exact location of the mode is not known, then use the approximate location and provide the (exact) value of the PDF at the mode by means of the unur_srou_set_pdfatmode call. But then unur_srou_set_cdfatmode must not be used. Notice, that a (slow) numerical mode finder will be used if no mode is given at all. It is even possible to give an upper bound for the PDF only. However, then the (upper bound for the) area below the PDF has to be multiplied by the ratio between the upper bound and the lower bound of the PDF at the mode. Again setting the squeeze flag and using unur_srou_set_cdfatmode is not allowed.

It is possible to change the parameters and the domain of the chosen distribution and run unur_reinit to reinitialize the generator object. Notice, that derived parameters like the mode must also be (re-) set if the parameters or the domain has be changed. Moreover, if the PDF at the mode has been provided by a unur_srou_set_pdfatmode call, additionally unur_srou_chg_pdfatmode must be used (otherwise this call is not necessary since then this figure is computed directly from the PDF).

There exists a test mode that verifies whether the conditions for the method are satisfied or not while sampling. It can be switched on by calling unur_srou_set_verify and unur_srou_chg_verify respectively. Notice however that sampling is (a little bit) slower then.

Function reference

: UNUR_PAR* unur_srou_new (const UNUR_DISTR* distribution)

Get default parameters for generator.

: int unur_srou_set_r (UNUR_PAR* parameters, double r)

Set parameter r for transformation. Only values greater than or equal to 1 are allowed. The performance of the generator decreases when r is increased. On the other hand r must not be set to small, since the given density must be T_c-concave for c = -r/(r+1).

Notice: If r is set to 1 a simpler and much faster algorithm is used then for r greater than one.

For computational reasons values of r that are greater than 1 but less than 1.01 are always set to 1.01.

Default is 1.

: int unur_srou_set_cdfatmode (UNUR_PAR* parameters, double Fmode)

Set CDF at mode. When set, the performance of the algorithm is increased by factor 2. However, when the parameters of the distribution are changed unur_srou_chg_cdfatmode has to be used to update this value.

Default: not set.

: int unur_srou_set_pdfatmode (UNUR_PAR* parameters, double fmode)

Set pdf at mode. When set, the PDF at the mode is never changed. This is to avoid additional computations, when the PDF does not change when parameters of the distributions vary. It is only useful when the PDF at the mode does not change with changing parameters of the distribution.

IMPORTANT: This call has to be executed after a possible call of unur_srou_set_r. Default: not set.

: int unur_srou_set_usesqueeze (UNUR_PAR* parameters, int usesqueeze)

Set flag for using universal squeeze (default: off). Using squeezes is only useful when the evaluation of the PDF is (extremely) expensive. Using squeezes is automatically disabled when the CDF at the mode is not given (then no universal squeezes exist).

Squeezes can only be used if r=1.

Default is FALSE.

: int unur_srou_set_usemirror (UNUR_PAR* parameters, int usemirror)

Set flag for using mirror principle (default: off). Using the mirror principle is only useful when the CDF at the mode is not known and the evaluation of the PDF is rather cheap compared to the marginal generation time of the underlying uniform random number generator. It is automatically disabled when the CDF at the mode is given. (Then there is no necessity to use the mirror principle. However disabling is only done during the initialization step but not at a re-initialization step.)

The mirror principle can only be used if r=1.

Default is FALSE.

: int unur_srou_set_verify (UNUR_PAR* parameters, int verify)
: int unur_srou_chg_verify (UNUR_GEN* generator, int verify)

Turn verifying of algorithm while sampling on/off. If the condition squeeze(x) <= PDF(x) <= hat(x) is violated for some x then unur_errno is set to UNUR_ERR_GEN_CONDITION. However notice that this might happen due to round-off errors for a few values of x (less than 1%).

Default is FALSE.

: int unur_srou_chg_cdfatmode (UNUR_GEN* generator, double Fmode)

Change CDF at mode of distribution. unur_reinit must be executed before sampling from the generator again.

: int unur_srou_chg_pdfatmode (UNUR_GEN* generator, double fmode)

Change PDF at mode of distribution. unur_reinit must be executed before sampling from the generator again.


5.3.14 SSR – Simple Setup Rejection

Required:

T-concave PDF, mode, area

Speed:

Set-up: fast, Sampling: slow

Reinit:

supported

Reference:

[LJa01] [HLD04: Sect.6.3.3; Alg.6.6]

SSR is an acceptance/rejection method that uses universal inequalities for constructing (universal) hats and squeezes (see The Rejection Method). It works for all T-concave distributions with T(x) = -1/sqrt(x).

It requires the PDF, the (exact) location of the mode and the area below the given PDF. The rejection constant is 4 for all T-concave distributions with unbounded domain and is less than 4 when the domain is bounded. Optionally the CDF at the mode can be given to increase the performance of the algorithm. Then the rejection constant is at most 2 and a universal squeeze can (but need not be) used. However, using squeezes is not recommended unless the evaluation of the PDF is expensive.

The exact location of the mode and/or the area below the PDF can be replace by appropriate bounds. Then the algorithm still works but has larger rejection constants.

How To Use

SSR works for any continuous univariate distribution object with given T-concave PDF (with T(x) = -1/sqrt(x),) mode and area below PDF. Optional the CDF at the mode can be given to increase the performance of the algorithm by means of the unur_ssr_set_cdfatmode call. Additionally squeezes can be used and switched on via unur_ssr_set_usesqueeze. If the (exact) area below the PDF is not known, then an upper bound can be used instead (which of course increases the rejection constant). But then the squeeze flag must not be set and unur_ssr_set_cdfatmode must not be used.

If the exact location of the mode is not known, then use the approximate location and provide the (exact) value of the PDF at the mode by means of the unur_ssr_set_pdfatmode call. But then unur_ssr_set_cdfatmode must not be used. Notice, that a (slow) numerical mode finder will be used if no mode is given at all. It is even possible to give an upper bound for the PDF only. However, then the (upper bound for the) area below the PDF has to be multiplied by the ratio between the upper bound and the lower bound of the PDF at the mode. Again setting the squeeze flag and using unur_ssr_set_cdfatmode is not allowed.

It is possible to change the parameters and the domain of the chosen distribution and run unur_reinit to reinitialize the generator object. Notice, that derived parameters like the mode must also be (re-) set if the parameters or the domain has be changed. Moreover, if the PDF at the mode has been provided by a unur_ssr_set_pdfatmode call, additionally unur_ssr_chg_pdfatmode must be used (otherwise this call is not necessary since then this figure is computed directly from the PDF).

Important: If any of mode, PDF or CDF at the mode, or the area below the mode has been changed, then unur_reinit must be executed. (Otherwise the generator produces garbage).

There exists a test mode that verifies whether the conditions for the method are satisfied or not while sampling. It can be switched on/off by calling unur_ssr_set_verify and unur_ssr_chg_verify respectively. Notice, however, that sampling is (a little bit) slower then.

Function reference

: UNUR_PAR* unur_ssr_new (const UNUR_DISTR* distribution)

Get default parameters for generator.

: int unur_ssr_set_cdfatmode (UNUR_PAR* parameters, double Fmode)

Set CDF at mode. When set, the performance of the algorithm is increased by factor 2. However, when the parameters of the distribution are changed unur_ssr_chg_cdfatmode has to be used to update this value.

Default: not set.

: int unur_ssr_set_pdfatmode (UNUR_PAR* parameters, double fmode)

Set pdf at mode. When set, the PDF at the mode is never changed. This is to avoid additional computations, when the PDF does not change when parameters of the distributions vary. It is only useful when the PDF at the mode does not change with changing parameters for the distribution.

Default: not set.

: int unur_ssr_set_usesqueeze (UNUR_PAR* parameters, int usesqueeze)

Set flag for using universal squeeze (default: off). Using squeezes is only useful when the evaluation of the PDF is (extremely) expensive. Using squeezes is automatically disabled when the CDF at the mode is not given (then no universal squeezes exist).

Default is FALSE.

: int unur_ssr_set_verify (UNUR_PAR* parameters, int verify)
: int unur_ssr_chg_verify (UNUR_GEN* generator, int verify)

Turn verifying of algorithm while sampling on/off. If the condition squeeze(x) <= PDF(x) <= hat(x) is violated for some x then unur_errno is set to UNUR_ERR_GEN_CONDITION. However notice that this might happen due to round-off errors for a few values of x (less than 1%).

Default is FALSE.

: int unur_ssr_chg_cdfatmode (UNUR_GEN* generator, double Fmode)

Change CDF at mode of distribution. unur_reinit must be executed before sampling from the generator again.

: int unur_ssr_chg_pdfatmode (UNUR_GEN* generator, double fmode)

Change PDF at mode of distribution. unur_reinit must be executed before sampling from the generator again.


5.3.15 TABL – a TABLe method with piecewise constant hats

Required:

PDF, all local extrema, cut-off values for the tails

Optional:

approximate area

Speed:

Set-up: (very) slow, Sampling: fast

Reinit:

not implemented

Reference:

[AJa93] [AJa95] [HLD04: Cha.5.1]

TABL (called Ahrens method in [HLD04] ) is an acceptance/rejection method (see The Rejection Method) that uses a decomposition of the domain of the distribution into many short subintervals. Inside of these subintervals constant hat and squeeze functions are utilized. Thus it is easy to use the idea of immediate acceptance for points below the squeeze. This reduces the expected number of uniform random numbers per generated random variate to less than two. Using a large number of subintervals only little more than one random number is necessary on average. Thus this method becomes very fast.

Due to the constant hat function this method only works for distributions with bounded domains. Thus for unbounded domains the left and right tails have to be cut off. This is no problem when the probability of falling into these tail regions is beyond computational relevance (e.g. smaller than 1.e-12).

For easy construction of hat and squeeze functions it is necessary to know the regions of monotonicity (called slopes) or equivalently all local maxima and minima of the density. The main problem for this method in the setup is the choice of the subintervals. A simple and close to optimal approach is the "equal area rule" [HLD04: Cha.5.1] . There the subintervals are selected such that the area below the hat is the same for each subinterval which can be realized with a simple recursion. If more subintervals are necessary it is possible to split either randomly chosen intervals (adaptive rejection sampling, ARS) or those intervals, where the ratio between squeeze and hat is smallest. This version of the setup is called derandomized ARS (DARS). With the default settings TABL is first calculating approximately 30 subintervals with the equal area rule. Then DARS is used till the desired fit of the hat is reached.

A convenient measure to control the quality of the fit of hat and squeeze is the ratio (area below squeeze)/(area below hat) called sqhratio which must be smaller or equal to one. The expected number of iterations in the rejection algorithm is known to be smaller than 1/sqhratio and the expected number of evaluations of the density is bounded by 1/sqhratio - 1. So values of the sqhratio close to one (e.g. 0.95 or 0.99) lead to many subintervals. Thus a better fitting hat is constructed and the sampling algorithm becomes fast; on the other hand large tables are needed and the setup is very slow. For moderate values of sqhratio (e.g. 0.9 or 0.8) the sampling is slower but the required tables are smaller and the setup is not so slow.

It follows from the above explanations that TABL is always requiring a slow setup and that it is not very well suited for heavy-tailed distributions.

How To Use

For using the TABL method UNU.RAN needs a bounded interval to which the generated variates can be restricted and information about all local extrema of the distribution. For unimodal densities it is sufficient to provide the mode of the distribution. For the case of a built-in unimodal distribution with bounded domain all these information is present in the distribution object and thus no extra input is necessary (see example_TABL1 below).

For a built-in unimodal distribution with unbounded domain we should specify the cut-off values for the tails. This can be done with the unur_tabl_set_boundary call (see example_TABL2 below). For the case that we do not set these boundaries the default values of +/- 1.e20 are used. We can see in example_TABL1 that this still works fine for many standard distributions.

For the case of a multimodal distribution we have to set the regions of monotonicity (called slopes) explicitly using the unur_tabl_set_slopes command (see example_TABL3 below).

To controll the fit of the hat and the size of the tables and thus the speed of the setup and the sampling it is most convenient to use the unur_tabl_set_max_sqhratio call. The default is 0.9 which is a sensible value for most distributions and applications. If very large samples of a distribution are required or the evaluation of a density is very slow it may be useful to increase the sqhratio to eg. 0.95 or even 0.99. With the unur_tabl_get_sqhratio call we can check which sqhratio was really reached. If that value is below the desired value it is necessary to increase the maximal number of subintervals, which defaults to 1000, using the unur_tabl_set_max_intervals call. The unur_tabl_get_n_intervals call can be used to find out the number of subintervals the setup calculated.

It is also possible to set the number of intervals and their respective boundaries by means of the unur_tabl_set_cpoints call.

It is also possible to use method TABL for correlation induction (variance reduction) by setting of an auxiliary uniform random number generator via the unur_set_urng_aux call. (Notice that this must be done after a possible unur_set_urng call.) However, this only works when immediate acceptance is switched off by a unur_tabl_set_variant_ia call.

Function reference

: UNUR_PAR* unur_tabl_new (const UNUR_DISTR* distribution)

Get default parameters for generator.

: int unur_tabl_set_variant_ia (UNUR_PAR* parameters, int use_ia)

Use immediate acceptance when use_ia is set to TRUE. This technique requires less uniform. If it is set to FALSE, “classical” acceptance/rejection from hat distribution is used.

Notice: Auxiliary uniform random number generators for correlation induction (variance reduction) can only be used when “classical” acceptance/rejection is used.

Default: TRUE.

: int unur_tabl_set_cpoints (UNUR_PAR* parameters, int n_cpoints, const double* cpoints)

Set construction points for the hat function. If stp is NULL than a heuristic rule of thumb is used to get n_stp construction points. This is the default behavior.

The default number of construction points is 30.

: int unur_tabl_set_nstp (UNUR_PAR* parameters, int n_stp)

Set number of construction points for the hat function. n_stp must be greater than zero. After the setup there are about n_stp construction points. However it might be larger when a small fraction is given by the unur_tabl_set_areafraction call. It also might be smaller for some variants.

Default is 30.

: int unur_tabl_set_useear (UNUR_PAR* parameters, int useear)

If useear is set to TRUE, the “equal area rule” is used, the given slopes are partitioned in such a way that the area below the hat function in each subinterval (“stripe”) has the same area (except the last the last interval which can be smaller). The area can be set by means of the unur_tabl_set_areafraction call.

Default is TRUE.

: int unur_tabl_set_areafraction (UNUR_PAR* parameters, double fraction)

Set parameter for the equal area rule. During the setup a piecewise constant hat is constructed, such that the area below each of these pieces (strips) is the same and equal to the (given) area below the PDF times fraction (which must be greater than zero).

Important: If the area below the PDF is not set in the distribution object, then 1 is assumed.

Default is 0.1.

: int unur_tabl_set_usedars (UNUR_PAR* parameters, int usedars)

If usedars is set to TRUE, “derandomized adaptive rejection sampling” (DARS) is used in the setup. Intervals, where the area between hat and squeeze is too large compared to the average area between hat and squeeze over all intervals, are split. This procedure is repeated until the ratio between squeeze and hat exceeds the bound given by unur_tabl_set_max_sqhratio call or the maximum number of intervals is reached. Moreover, it also aborts when no more intervals can be found for splitting.

For finding splitting points the arc-mean rule (a mixture of arithmetic mean and harmonic mean) is used.

Default is TRUE.

: int unur_tabl_set_darsfactor (UNUR_PAR* parameters, double factor)

Set factor for “derandomized adaptive rejection sampling”. This factor is used to determine the segments that are “too large”, that is, all segments where the area between squeeze and hat is larger than factor times the average area over all intervals between squeeze and hat. Notice that all segments are split when factor is set to 0., and that there is no splitting at all when factor is set to UNUR_INFINITY.

Default is 0.99. There is no need to change this parameter.

: int unur_tabl_set_variant_splitmode (UNUR_PAR* parameters, unsigned splitmode)

There are three variants for adaptive rejection sampling. These differ in the way how an interval is split:

splitmode 1

use the generated point to split the interval.

splitmode 2

use the mean point of the interval.

splitmode 3

use the arcmean point; suggested for distributions with heavy tails.

Default is splitmode 2.

: int unur_tabl_set_max_sqhratio (UNUR_PAR* parameters, double max_ratio)

Set upper bound for the ratio (area below squeeze) / (area below hat). It must be a number between 0 and 1. When the ratio exceeds the given number no further construction points are inserted via DARS in the setup.

For the case of ARS (unur_tabl_set_usedars() must be set to FALSE): Use 0 if no construction points should be added after the setup. Use 1 if added new construction points should not be stopped until the maximum number of construction points is reached. If max_ratio is close to one, many construction points are used.

Default is 0.9.

: double unur_tabl_get_sqhratio (const UNUR_GEN* generator)

Get the current ratio (area below squeeze) / (area below hat) for the generator. (In case of an error UNUR_INFINITY is returned.)

: double unur_tabl_get_hatarea (const UNUR_GEN* generator)

Get the area below the hat for the generator. (In case of an error UNUR_INFINITY is returned.)

: double unur_tabl_get_squeezearea (const UNUR_GEN* generator)

Get the area below the squeeze for the generator. (In case of an error UNUR_INFINITY is returned.)

: int unur_tabl_set_max_intervals (UNUR_PAR* parameters, int max_ivs)

Set maximum number of intervals. No construction points are added in or after the setup when the number of intervals suceeds max_ivs.

Default is 1000.

: int unur_tabl_get_n_intervals (const UNUR_GEN* generator)

Get the current number of intervals. (In case of an error 0 is returned.)

: int unur_tabl_set_slopes (UNUR_PAR* parameters, const double* slopes, int n_slopes)

Set slopes for the PDF. A slope <a,b> is an interval [a,b] or [b,a] where the PDF is monotone and PDF(a) >= PDF(b). The list of slopes is given by an array slopes where each consecutive tuple (i.e. (slopes[0], slopes[1]), (slopes[2], slopes[3]), etc.) defines one slope. Slopes must be sorted (i.e. both slopes[0] and slopes[1] must not be greater than any entry of the slope (slopes[2], slopes[3]), etc.) and must not be overlapping. Otherwise no slopes are set and unur_errno is set to UNUR_ERR_PAR_SET.

Notice: n_slopes is the number of slopes (and not the length of the array slopes).

Notice that setting slopes resets the given domain for the distribution. However, in case of a standard distribution the area below the PDF is not updated.

: int unur_tabl_set_guidefactor (UNUR_PAR* parameters, double factor)

Set factor for relative size of the guide table for indexed search (see also method DGT DGT – (Discrete) Guide Table method (indexed search)). It must be greater than or equal to 0. When set to 0, then sequential search is used.

Default is 1.

: int unur_tabl_set_boundary (UNUR_PAR* parameters, double left, double right)

Set the left and right boundary of the computation interval. The piecewise hat is only constructed inside this interval. The probability outside of this region must not be of computational relevance. Of course +/- UNUR_INFINITY is not allowed.

Default is -1.e20,1.e20.

: int unur_tabl_chg_truncated (UNUR_GEN* gen, double left, double right)

Change the borders of the domain of the (truncated) distribution.

Notice that the given truncated domain must be a subset of the domain of the given distribution. The generator always uses the intersection of the domain of the distribution and the truncated domain given by this call. The hat function will not be changed.

Important: The ratio between the area below the hat and the area below the squeeze changes when the sampling region is restricted. In particalur it becomes (very) large when sampling from the (far) tail of the distribution. Then it is better to create a generator object for the tail of distribution only.

Important: This call does not work for variant IA (immediate acceptance). In this case UNU.RAN switches automatically to variant RH (use “classical” acceptance/rejection from hat distribution) and does revert to the variant originally set by the user.

Important: It is not a good idea to use adaptave rejection sampling while sampling from a domain that is a strict subset of the domain that has been used to construct the hat. For that reason adaptive adding of construction points is automatically disabled by this call.

Important: If the CDF of the hat is (almost) the same for left and right and (almost) equal to 0 or 1, then the truncated domain is not changed and the call returns an error code.

: int unur_tabl_set_verify (UNUR_PAR* parameters, int verify)
: int unur_tabl_chg_verify (UNUR_GEN* generator, int verify)

Turn verifying of algorithm while sampling on/off. If the condition squeeze(x) <= PDF(x) <= hat(x) is violated for some x then unur_errno is set to UNUR_ERR_GEN_CONDITION. However notice that this might happen due to round-off errors for a few values of x (less than 1%).

Default is FALSE.

: int unur_tabl_set_pedantic (UNUR_PAR* parameters, int pedantic)

Sometimes it might happen that unur_init has been executed successfully. But when additional construction points are added by adaptive rejection sampling, the algorithm detects that the PDF is not monotone in the given slopes.

With pedantic being TRUE, the sampling routine is exchanged by a routine that simply returns UNUR_INFINITY indicating an error.

Default is FALSE.


5.3.16 TDR – Transformed Density Rejection

Required:

T-concave PDF, dPDF

Optional:

mode

Speed:

Set-up: slow, Sampling: fast

Reinit:

supported

Reference:

[GWa92] [HWa95] [HLD04: Cha.4]

TDR is an acceptance/rejection method that uses the concavity of a transformed density to construct hat function and squeezes automatically. Such PDFs are called T-concave. Currently the following transformations are implemented and can be selected by setting their c-values by a unur_tdr_set_c call:

c = 0

T(x) = log(x)

c = -0.5

T(x) = -1/sqrt(x)      (Default)

In future releases the transformations T(x) = -(x)^c will be available for any c with 0 > c > -1. Notice that if a PDF is T-concave for a c then it also T-concave for every c’<c. However the performance decreases when c’ is smaller than c. For computational reasons we suggest the usage of c = -0.5 (this is the default). For c <= -1 the hat is not bounded any more if the domain of the PDF is unbounded. But in the case of a bounded domain using method TABL is preferred to a TDR with c < -1 (except in a few special cases).

We offer three variants of the algorithm.

GW

squeezes between construction points

PS

squeezes proportional to hat function      (Default)

IA

same as variant PS but uses a compositon method with “immediate acceptance” in the region below the squeeze.

GW has a slightly faster setup but higher marginal generation times. PS is faster than GW. IA uses less uniform random numbers and is therefore faster than PS.

It is also possible to evaluate the inverse of the CDF of the hat distribution directly using the unur_tdr_eval_invcdfhat call.

There are lots of parameters for these methods, see below.

It is possible to use this method for correlation induction by setting an auxiliary uniform random number generator via the unur_set_urng_aux call. (Notice that this must be done after a possible unur_set_urng call.) When an auxiliary generator is used then the number of uniform random numbers from the first URNG that are used for one generated random variate is constant and given in the following table:

GW ... 2
PS ... 2
IA ... 1

There exists a test mode that verifies whether the conditions for the method are satisfied or not. It can be switched on by calling unur_tdr_set_verify and unur_tdr_chg_verify respectively. Notice however that sampling is (much) slower then.

For densities with modes not close to 0 it is suggested to set either the mode or the center of the distribution by the unur_distr_cont_set_mode or unur_distr_cont_set_center call. The latter is the approximate location of the mode or the mean of the distribution. This location provides some information about the main part of the PDF and is used to avoid numerical problems.

It is possible to use this method for generating from truncated distributions. It even can be changed for an existing generator object by an unur_tdr_chg_truncated call.

It is possible to change the parameters and the domain of the chosen distribution and run unur_reinit to reinitialize the generator object.

Important: The ratio between the area below the hat and the area below the squeeze changes when the sampling region is restricted. Especially it becomes (very) small when sampling from the (far) tail of the distribution. Then it is better to create a new generator object for the tail of the distribution only.

Function reference

: UNUR_PAR* unur_tdr_new (const UNUR_DISTR* distribution)

Get default parameters for generator.

: int unur_tdr_set_c (UNUR_PAR* parameters, double c)

Set parameter c for transformation T. Currently only values between 0 and -0.5 are allowed. If c is between 0 and -0.5 it is set to -0.5.

Default is -0.5.

: int unur_tdr_set_variant_gw (UNUR_PAR* parameters)

Use original version with squeezes between construction points as proposed by Gilks & Wild (1992).

: int unur_tdr_set_variant_ps (UNUR_PAR* parameters)

Use squeezes proportional to the hat function. This is faster than the original version. This is the default.

: int unur_tdr_set_variant_ia (UNUR_PAR* parameters)

Use squeezes proportional to the hat function together with a composition method that required less uniform random numbers.

: int unur_tdr_set_usedars (UNUR_PAR* parameters, int usedars)

If usedars is set to TRUE, “derandomized adaptive rejection sampling” (DARS) is used in setup. Intervals where the area between hat and squeeze is too large compared to the average area between hat and squeeze over all intervals are split. This procedure is repeated until the ratio between area below squeeze and area below hat exceeds the bound given by unur_tdr_set_max_sqhratio call or the maximum number of intervals is reached. Moreover, it also aborts when no more intervals can be found for splitting.

For finding splitting points the following rules are used (in this order, i.e., is if the first rule cannot be applied, the next one is used):

  1. Use the expected value of adaptive rejection sampling.
  2. Use the arc-mean rule (a mixture of arithmetic mean and harmonic mean).
  3. Use the arithmetic mean of the interval boundaries.

Notice, however, that for unbounded intervals neither rule 1 nor rule 3 can be used.

As an additional feature, it is possible to choose amoung these rules. If usedars is set to 1 or TRUE the expected point (rule 1) is used (it switches to rule 2 for a particular interval if rule 1 cannot be applied). If it is set to 2 the arc-mean rule is used. If it is set to 3 the mean is used. Notice that rule 3 can only be used if the domain of the distribution is bounded. It is faster than the other two methods but for heavy-tailed distribution and large domain the hat converges extremely slowly.

The default depends on the given construction points. If the user has provided such points via a unur_tdr_set_cpoints call, then usedars is set to FALSE by default, i.e., there is no further splitting. If the user has only given the number of construction points (or only uses the default number), then usedars is set to TRUE (i.e., use rule 1).

: int unur_tdr_set_darsfactor (UNUR_PAR* parameters, double factor)

Set factor for “derandomized adaptive rejection sampling”. This factor is used to determine the intervals that are “too large”, that is, all intervals where the area between squeeze and hat is larger than factor times the average area over all intervals between squeeze and hat. Notice that all intervals are split when factor is set to 0., and that there is no splitting at all when factor is set to UNUR_INFINITY.

Default is 0.99. There is no need to change this parameter.

: int unur_tdr_set_cpoints (UNUR_PAR* parameters, int n_stp, const double* stp)

Set construction points for the hat function. If stp is NULL than a heuristic rule of thumb is used to get n_stp construction points. This is the default behavior.

The default number of construction points is 30.

: int unur_tdr_set_reinit_percentiles (UNUR_PAR* parameters, int n_percentiles, const double* percentiles)
: int unur_tdr_chg_reinit_percentiles (UNUR_GEN* generator, int n_percentiles, const double* percentiles)

By default, when the generator object is reinitialized, it used the same construction points as for the initialization procedure. Often the underlying distribution object has been changed only moderately. For example, the full conditional distribution of a multivariate distribution. In this case it might be more appropriate to use percentilesm of the hat function for the last (unchanged) distribution. percentiles must then be a pointer to an ordered array of numbers between 0.01 and 0.99. If percentiles is NULL, then a heuristic rule of thumb is used to get n_percentiles values for these percentiles. Notice that n_percentiles must be at least 2, otherwise defaults are used. (Then the first and third quartiles are used by default.)

: int unur_tdr_set_reinit_ncpoints (UNUR_PAR* parameters, int ncpoints)
: int unur_tdr_chg_reinit_ncpoints (UNUR_GEN* generator, int ncpoints)

When reinit fails with the given construction points or the percentiles of the old hat function, another trial is undertaken with ncpoints construction points. ncpoints must be at least 10.

Default: 50

: int unur_tdr_chg_truncated (UNUR_GEN* gen, double left, double right)

Change the borders of the domain of the (truncated) distribution.

Notice that the given truncated domain must be a subset of the domain of the given distribution. The generator always uses the intersection of the domain of the distribution and the truncated domain given by this call. The hat function will not be changed and there is no need to run unur_reinit. Important: The ratio between the area below the hat and the area below the squeeze changes when the sampling region is restricted. In particular it becomes (very) large when sampling from the (far) tail of the distribution. Then it is better to create a generator object for the tail of distribution only.

Important: This call does not work for variant IA (immediate acceptance). In this case UNU.RAN switches automatically to variant PS.

Important: It is not a good idea to use adaptave rejection sampling while sampling from a domain that is a strict subset of the domain that has been used to construct the hat. For that reason adaptive adding of construction points is automatically disabled by this call.

Important: If the CDF of the hat is (almost) the same for left and right and (almost) equal to 0 or 1, then the truncated domain is not changed and the call returns an error code.

: int unur_tdr_set_max_sqhratio (UNUR_PAR* parameters, double max_ratio)

Set upper bound for the ratio (area below squeeze) / (area below hat). It must be a number between 0 and 1. When the ratio exceeds the given number no further construction points are inserted via adaptive rejection sampling. Use 0 if no construction points should be added after the setup. Use 1 if added new construction points should not be stopped until the maximum number of construction points is reached.

Default is 0.99.

: double unur_tdr_get_sqhratio (const UNUR_GEN* generator)

Get the current ratio (area below squeeze) / (area below hat) for the generator. (In case of an error UNUR_INFINITY is returned.)

: double unur_tdr_get_hatarea (const UNUR_GEN* generator)

Get the area below the hat for the generator. (In case of an error UNUR_INFINITY is returned.)

: double unur_tdr_get_squeezearea (const UNUR_GEN* generator)

Get the area below the squeeze for the generator. (In case of an error UNUR_INFINITY is returned.)

: int unur_tdr_set_max_intervals (UNUR_PAR* parameters, int max_ivs)

Set maximum number of intervals. No construction points are added after the setup when the number of intervals suceeds max_ivs. It is increased automatically to twice the number of construction points if this is larger.

Default is 100.

: int unur_tdr_set_usecenter (UNUR_PAR* parameters, int usecenter)

Use the center as construction point. Default is TRUE.

: int unur_tdr_set_usemode (UNUR_PAR* parameters, int usemode)

Use the (exact!) mode as construction point. Notice that the behavior of the algorithm is different to simply adding the mode in the list of construction points via a unur_tdr_set_cpoints call. In the latter case the mode is treated just like any other point. However, when usemode is TRUE, the tangent in the mode is always set to 0. Then the hat of the transformed density can never cut the x-axis which must never happen if c < 0, since otherwise the hat would not be bounded.

Default is TRUE.

: int unur_tdr_set_guidefactor (UNUR_PAR* parameters, double factor)

Set factor for relative size of the guide table for indexed search (see also method DGT DGT – (Discrete) Guide Table method (indexed search)). It must be greater than or equal to 0. When set to 0, then sequential search is used.

Default is 2.

: int unur_tdr_set_verify (UNUR_PAR* parameters, int verify)
: int unur_tdr_chg_verify (UNUR_GEN* generator, int verify)

Turn verifying of algorithm while sampling on/off. If the condition squeeze(x) <= PDF(x) <= hat(x) is violated for some x then unur_errno is set to UNUR_ERR_GEN_CONDITION. However notice that this might happen due to round-off errors for a few values of x (less than 1%).

Default is FALSE.

: int unur_tdr_set_pedantic (UNUR_PAR* parameters, int pedantic)

Sometimes it might happen that unur_init has been executed successfully. But when additional construction points are added by adaptive rejection sampling, the algorithm detects that the PDF is not T-concave.

With pedantic being TRUE, the sampling routine is exchanged by a routine that simply returns UNUR_INFINITY. Otherwise the new point is not added to the list of construction points. At least the hat function remains T-concave.

Setting pedantic to FALSE allows sampling from a distribution which is “almost” T-concave and small errors are tolerated. However it might happen that the hat function cannot be improved significantly. When the hat functions that has been constructed by the unur_init call is extremely large then it might happen that the generation times are extremely high (even hours are possible in extremely rare cases).

Default is FALSE.

: double unur_tdr_eval_invcdfhat (const UNUR_GEN* generator, double u, double* hx, double* fx, double* sqx)

Evaluate the inverse of the CDF of the hat distribution at u. As a side effect the values of the hat, the density, and the squeeze at the computed point x are stored in hx, fx, and sqx, respectively. However, these computations are suppressed if the corresponding variable is set to NULL.

If u is out of the domain [0,1] then unur_errno is set to UNUR_ERR_DOMAIN and the respective bound of the domain of the distribution are returned (which is -UNUR_INFINITY or UNUR_INFINITY in the case of unbounded domains).

Important: This call does not work for variant IA (immediate acceptance). In this case the hat CDF is evaluated as if variant PS is used.

Notice: This function always evaluates the inverse CDF of the hat distribution. A call to unur_tdr_chg_truncated call has no effect.


5.3.17 UTDR – Universal Transformed Density Rejection

Required:

T-concave PDF, mode, approximate area

Speed:

Set-up: moderate, Sampling: Moderate

Reinit:

supported

Reference:

[HWa95] [HLD04: Sect.4.5.4; Alg.4.4]

UTDR is based on the transformed density rejection and uses three almost optimal points for constructing hat and squeezes. It works for all T-concave distributions with T(x) = -1/sqrt(()x).

It requires the PDF and the (exact) location of the mode. Notice that if no mode is given at all, a (slow) numerical mode finder will be used. Moreover the approximate area below the given PDF is used. (If no area is given for the distribution the algorithm assumes that it is approximately 1.) The rejection constant is bounded from above by 4 for all T-concave distributions.

How To Use

UTDR works for any continuous univariate distribution object with given T-concave PDF (with T(x) = -1/sqrt(x),) mode and approximate area below PDF.

When the PDF does not change at the mode for varying parameters, then this value can be set with unur_utdr_set_pdfatmode to avoid some computations. Since this value will not be updated any more when the parameters of the distribution are changed, the unur_utdr_chg_pdfatmode call is necessary to do this manually.

It is possible to change the parameters and the domain of the chosen distribution and run unur_reinit to reinitialize the generator object. Notice, that derived parameters like the mode must also be (re-) set if the parameters or the domain has be changed. Moreover, if the PDF at the mode has been provided by a unur_utdr_set_pdfatmode call, additionally unur_utdr_chg_pdfatmode must be used (otherwise this call is not necessary since then this figure is computed directly from the PDF).

There exists a test mode that verifies whether the conditions for the method are satisfied or not. It can be switched on by calling unur_utdr_set_verify and unur_utdr_chg_verify respectively. Notice however that sampling is slower then.

Function reference

: UNUR_PAR* unur_utdr_new (const UNUR_DISTR* distribution)

Get default parameters for generator.

: int unur_utdr_set_pdfatmode (UNUR_PAR* parameters, double fmode)

Set pdf at mode. When set, the PDF at the mode is never changed. This is to avoid additional computations, when the PDF does not change when parameters of the distributions vary. It is only useful when the PDF at the mode does not change with changing parameters for the distribution.

Default: not set.

: int unur_utdr_set_cpfactor (UNUR_PAR* parameters, double cp_factor)

Set factor for position of left and right construction point. The cp_factor is used to find almost optimal construction points for the hat function. There is no need to change this factor in almost all situations.

Default is 0.664.

: int unur_utdr_set_deltafactor (UNUR_PAR* parameters, double delta)

Set factor for replacing tangents by secants. higher factors increase the rejection constant but reduces the risk of serious round-off errors. There is no need to change this factor it almost all situations.

Default is 1.e-5.

: int unur_utdr_set_verify (UNUR_PAR* parameters, int verify)
: int unur_utdr_chg_verify (UNUR_GEN* generator, int verify)

Turn verifying of algorithm while sampling on/off. If the condition squeeze(x) <= PDF(x) <= hat(x) is violated for some x then unur_errno is set to UNUR_ERR_GEN_CONDITION. However notice that this might happen due to round-off errors for a few values of x (less than 1%).

Default is FALSE.

: int unur_utdr_chg_pdfatmode (UNUR_GEN* generator, double fmode)

Change PDF at mode of distribution. unur_reinit must be executed before sampling from the generator again.


5.4 Methods for continuous empirical univariate distributions

Overview of methods

Methods for continuous empirical univariate distributions
sample with unur_sample_cont

EMPK: Requires an observed sample.
EMPL: Requires an observed sample.

Example

/* ------------------------------------------------------------- */
/* File: example_emp.c                                          */
/* ------------------------------------------------------------- */

/* Include UNURAN header file.                                   */
#include <unuran.h>

/* ------------------------------------------------------------- */

/* Example how to sample from an empirial continuous univariate  */
/* distribution.                                                 */

/* ------------------------------------------------------------- */

int main(void)
{
  int    i;
  double x;
  
  /* data points                                                 */
  double data[15] = { -0.1,  0.05, -0.5,   0.08,  0.13,\
		      -0.21,-0.44, -0.43, -0.33, -0.3, \
		       0.18, 0.2,  -0.37, -0.29, -0.9 };

  /* Declare the three UNURAN objects.                           */
  UNUR_DISTR *distr;    /* distribution object                   */
  UNUR_PAR   *par;      /* parameter object                      */
  UNUR_GEN   *gen;      /* generator object                      */

  /* Create a distribution object and set empirical sample.      */
  distr = unur_distr_cemp_new();
  unur_distr_cemp_set_data(distr, data, 15); 

  /* Choose a method: EMPK.                                      */
  par = unur_empk_new(distr);

  /* Set smooting factor.                                        */
  unur_empk_set_smoothing(par, 0.8);
  
  /* Create the generator object.                                */
  gen = unur_init(par);

  /* It is important to check if the creation of the generator   */
  /* object was successful. Otherwise `gen' is the NULL pointer  */ 
  /* and would cause a segmentation fault if used for sampling.  */
  if (gen == NULL) {
     fprintf(stderr, "ERROR: cannot create generator object\n");
     exit (EXIT_FAILURE);
  }

  /* It is possible to reuse the distribution object to create   */
  /* another generator object. If you do not need it any more,   */
  /* it should be destroyed to free memory.                      */
  unur_distr_free(distr);

  /* Now you can use the generator object `gen' to sample from   */
  /* the distribution. Eg.:                                      */
  for (i=0; i<10; i++) {
    x = unur_sample_cont(gen);
    printf("%f\n",x);
  }

  /* When you do not need the generator object any more, you     */
  /* can destroy it.                                             */
  unur_free(gen);

  exit (EXIT_SUCCESS);

} /* end of main() */

/* ------------------------------------------------------------- */

Example (String API)

/* ------------------------------------------------------------- */
/* File: example_emp_str.c                                       */
/* ------------------------------------------------------------- */
/* String API.                                                   */
/* ------------------------------------------------------------- */

/* Include UNURAN header file.                                   */
#include <unuran.h>

/* ------------------------------------------------------------- */

/* Example how to sample from an empirial continuous univariate  */
/* distribution.                                                 */

/* ------------------------------------------------------------- */

int main(void)
{
  int    i;
  double x;
  
  /* Declare UNURAN generator object.                            */
  UNUR_GEN   *gen;      /* generator object                      */

  /* Create the generator object.                                */
  gen = unur_str2gen("distr = cemp; \
                         data=(-0.10, 0.05,-0.50, 0.08, 0.13,   \
                               -0.21,-0.44,-0.43,-0.33,-0.30,   \
                                0.18, 0.20,-0.37,-0.29,-0.90) & \
                      method=empk; smoothing=0.8");

  /* It is important to check if the creation of the generator   */
  /* object was successful. Otherwise `gen' is the NULL pointer  */ 
  /* and would cause a segmentation fault if used for sampling.  */
  if (gen == NULL) {
     fprintf(stderr, "ERROR: cannot create generator object\n");
     exit (EXIT_FAILURE);
  }

  /* Now you can use the generator object `gen' to sample from   */
  /* the distribution. Eg.:                                      */
  for (i=0; i<10; i++) {
    x = unur_sample_cont(gen);
    printf("%f\n",x);
  }

  /* When you do not need the generator object any more, you     */
  /* can destroy it.                                             */
  unur_free(gen);

  exit (EXIT_SUCCESS);

} /* end of main() */

/* ------------------------------------------------------------- */

5.4.1 EMPK – EMPirical distribution with Kernel smoothing

Required:

observed sample

Speed:

Set-up: slow (as sample is sorted), Sampling: fast (depends on kernel)

Reinit:

not implemented

Reference:

[HLa00] [HLD04: Sect.12.1.2]

EMPK generates random variates from an empirical distribution that is given by an observed sample. The idea is that simply choosing a random point from the sample and to return it with some added noise results in a method that has very nice properties, as it can be seen as sampling from a kernel density estimate. If the underlying distribution is continuous, especially the fine structur of the resulting empirical distribution is much better than using only resampling without noise.

Clearly we have to decide about the density of the noise (called kernel) and about the standard deviation of the noise. The mathematical theory of kernel density estimation shows us that we are comparatively free in choosing the kernel. It also supplies us with a simple formula to compute the optimal standarddeviation of the noise, called bandwidth (or window width) of the kernel.

The variance of the estimated density is slightly larger than that of the observed sample. However, this can be easily corrected if required.

There is also a correction (mirroring technique) for distributions with non-negative support.

A simple robust reference method is implemented to find a good standard deviation of the noise (i.e. the bandwidth of kernel density estimation). For some cases (e.g. densities with two or more sharp distinct peaks) there kernel density estimation can be adjusted by changing the smoothness factor and the so called beta factor.

How To Use

EMPK uses empirical distributions. The main parameter is the choice if of kernel density. The most important kernels can be set by unur_empk_set_kernel. Additionally generators for other kernels can be used by using unur_empk_set_kernelgen instead. Additionally variance correction and a correction for non-negative variates can be switched on.

The two other parameters (smoothing factor and beta factor) are only useful for people knowing the theory of kernel density estimation. It is not necessary to change them if the true underlying distribution is somehow comparable with a bell-shaped curve, even skewed or with some not too sharp extra peaks. In all these cases the simple robust reference method implemented to find a good standard deviation of the noise (i.e. the bandwidth of kernel density estimation) should give sensible results. However, it might be necessary to overwrite this automatic method to find the bandwidth eg. when resampling from data with two or more sharp distinct peaks. Then the distribution has nearly discrete components as well and our automatic method may easily choose too large a bandwidth which results in an empirical distribution which is oversmoothed (i.e. it has lower peaks than the original distribution). Then it is recommended to decrease the bandwidth using the unur_empk_set_smoothing call. A smoothing factor of 1 is the default. A smoothing factor of 0 leads to naive resampling of the data. Thus an appropriate value between these extremes should be choosen. We recommend to consult a reference on kernel smoothing when doing so; but it is not a simple problem to determine an optimal bandwidth for distributions with sharp peaks.

In general, for most applications it is perfectly ok to use the default values offered. Unless you have some knowledge on density estimation we do not recommend to change anything. There are two exceptions:

  1. In the case that the unknown underlying distribution is not continuous but discrete you should "turn off" the adding of the noise by setting:
    unur_empk_set_smoothing(par, 0.)
    
  2. In the case that you are especially interested in a fast sampling algorithm use the call
    unur_empk_set_kernel(par, UNUR_DISTR_BOXCAR);
    

    to change the used noise distribution from the default Gaussian distribution to the uniform distribution.

Function reference

: UNUR_PAR* unur_empk_new (const UNUR_DISTR* distribution)

Get default parameters for generator.

: int unur_empk_set_kernel (UNUR_PAR* parameters, unsigned kernel)

Select one of the supported kernel distributions. Currently the following kernels are supported:

UNUR_DISTR_GAUSSIAN

Gaussian (normal) kernel

UNUR_DISTR_EPANECHNIKOV

Epanechnikov kernel

UNUR_DISTR_BOXCAR

Boxcar (uniform, rectangular) kernel

UNUR_DISTR_STUDENT

t3 kernel (Student’s distribution with 3 degrees of freedom)

UNUR_DISTR_LOGISTIC

logistic kernel

For other kernels (including kernels with Student’s distribution with other than 3 degrees of freedom) use the unur_empk_set_kernelgen call.

It is not possible to call unur_empk_set_kernel twice.

Default is the Gaussian kernel.

: int unur_empk_set_kernelgen (UNUR_PAR* parameters, const UNUR_GEN* kernelgen, double alpha, double kernelvar)

Set generator for the kernel used for density estimation.

alpha is used to compute the optimal bandwidth from the point of view of minimizing the mean integrated square error (MISE). It depends on the kernel K and is given by

alpha(K) = Var(K)^(-2/5){ \int K(t)^2 dt}^(1/5)

For standard kernels (see above) alpha is computed by the algorithm.

kernvar is the variance of the used kernel. It is only required for the variance corrected version of density estimation (which is used by default); otherwise it is ignored. If kernelvar is nonpositive, variance correction is disabled. For standard kernels (see above) kernvar is computed by the algorithm.

It is not possible to call unur_empk_set_kernelgen after a standard kernel has been selected by a unur_empk_set_kernel call.

Notice that the uniform random number generator of the kernel generator is overwritten during the unur_init call and at each unur_chg_urng call with the uniform generator used for the empirical distribution.

Default is the Gaussian kernel.

: int unur_empk_set_beta (UNUR_PAR* parameters, double beta)

beta is used to compute the optimal bandwidth from the point of view of minimizing the mean integrated square error (MISE). beta depends on the (unknown) distribution of the sampled data points. By default Gaussian distribution is assumed for the sample (beta = 1.3637439). There is no requirement to change beta.

Default: 1.3637439

: int unur_empk_set_smoothing (UNUR_PAR* parameters, double smoothing)
: int unur_empk_chg_smoothing (UNUR_GEN* generator, double smoothing)

Set and change the smoothing factor. The smoothing factor controlles how “smooth” the resulting density estimation will be. A smoothing factor equal to 0 results in naive resampling. A very large smoothing factor (together with the variance correction) results in a density which is approximately equal to the kernel. Default is 1 which results in a smoothing parameter minimising the MISE (mean integrated squared error) if the data are not too far away from normal. If a large smoothing factor is used, then variance correction must be switched on.

Default: 1

: int unur_empk_set_varcor (UNUR_PAR* parameters, int varcor)
: int unur_empk_chg_varcor (UNUR_GEN* generator, int varcor)

Switch variance correction in generator on/off. If varcor is TRUE then the variance of the used density estimation is the same as the sample variance. However this increases the MISE of the estimation a little bit.

Default is FALSE.

: int unur_empk_set_positive (UNUR_PAR* parameters, int positive)

If positive is TRUE then only nonnegative random variates are generated. This is done by means of a mirroring technique.

Default is FALSE.


5.4.2 EMPL – EMPirical distribution with Linear interpolation

Required:

observed sample

Speed:

Set-up: slow (as sample is sorted), Sampling: very fast (inversion)

Reinit:

not implemented

Reference:

[HLa00] [HLD04: Sect.12.1.3]

EMPL generates random variates from an empirical distribution that is given by an observed sample. This is done by linear interpolation of the empirical CDF. Although this method is suggested in the books of Law and Kelton (2000) and Bratly, Fox, and Schrage (1987) we do not recommend this method at all since it has many theoretical drawbacks: The variance of empirical distribution function does not coincide with the variance of the given sample. Moreover, when the sample increases the empirical density function does not converge to the density of the underlying random variate. Notice that the range of the generated point set is always given by the range of the given sample.

This method is provided in UNU.RAN for the sake of completeness. We always recommend to use method EMPK (see EMPirical distribution with Kernel smoothing).

If the data seem to be far away from having a bell shaped histogram, then we think that naive resampling is still better than linear interpolation.

How To Use

EMPL creates and samples from an empiral distribution by linear interpolation of the empirical CDF. There are no parameters to set.

Important: We do not recommend to use this method! Use method EMPK (see EMPirical distribution with Kernel smoothing) instead.

Function reference

: UNUR_PAR* unur_empl_new (const UNUR_DISTR* distribution)

Get default parameters for generator.


5.4.3 HIST – HISTogramm of empirical distribution

Required:

histogram

Speed:

Set-up: moderate, Sampling: fast

Reinit:

not implemented

Method HIST generates random variates from an empirical distribution that is given as histogram. Sampling is done using the inversion method.

If observed (raw) data are provided we recommend method EMPK (see EMPirical distribution with Kernel smoothing) instead of compting a histogram as this reduces information.

How To Use

Method HIST uses empirical distributions that are given as a histgram. There are no optional parameters.

Function reference

: UNUR_PAR* unur_hist_new (const UNUR_DISTR* distribution)

Get default parameters for generator.


5.5 Methods for continuous multivariate distributions

Overview of methods

Methods for continuous multivariate distributions
sample with unur_sample_vec

NORTA: Requires rank correlation matrix and marginal distributions.
VNROU: Requires the PDF.
MVSTD: Generator for built-in standard distributions.
MVTDR: Requires PDF and gradiant of PDF.


5.5.1 MVSTD – MultiVariate continuous STandarD distributions

Required:

standard distribution from UNU.RAN library (see Standard distributions).

Speed:

depends on distribution and generator

Reinit:

supported

MVSTD is a wrapper for special generators for multivariate continuous standard distributions. It only works for distributions in the UNU.RAN library of standard distributions (see Standard distributions). If a distribution object is provided that is build from scratch, or if no special generator for the given standard distribution is provided, the NULL pointer is returned.

How To Use

Create a distribution object for a standard distribution from the UNU.RAN library (see Standard distributions).

Sampling from truncated distributions (which can be constructed by changing the default domain of a distribution by means of unur_distr_cvec_set_domain_rect call) is not possible.

It is possible to change the parameters and the domain of the chosen distribution and run unur_reinit to reinitialize the generator object.

Function reference

: UNUR_PAR* unur_mvstd_new (const UNUR_DISTR* distribution)

Get default parameters for new generator. It requires a distribution object for a multivariate continuous distribution from the UNU.RAN library of standard distributions (see Standard distributions). Using a truncated distribution is not possible.


5.5.2 MVTDR – Multi-Variate Transformed Density Rejection

Required:

log-concave (log)PDF, gradient of (log)PDF

Optional:

mode

Speed:

Set-up: slow, Sampling: depends on dimension

Reinit:

not implemented

Reference:

[HLD04: Sect.11.3.4; Alg.11.15.] [LJa98]

MVTDR a multivariate version of the Transformed Density Rection (see TDR – Transformed Density Rejection) that works for log-concave densities. For this method the domain of the distribution is partitioned into cones with the mode (or the center) of the distribution as their (common) vertex. The hat function is then constructed as tangent planes of the transformed density in each of these cones. The respective construction points lie on the central lines in the cones through the vertex. The point is chosen such that the hat is minimal among all such points (see the given references for more details).

The cones are created by starting with the orthants of the reals space. These are then iteratively split when the volume below the hat in such cones is too large. Thus an increasing number of cones results in a better fitting hat function. Notice however, that the required number of cones increases exponentially with the number of dimension. Moreover, due to the construction the rejection does not converge to 1 and remains strictly larger than 1.

For distributions with bounded domains the cones are cut to pyramids that cover the domain.

How To Use

Create a multivariate generator object that contains the PDF and its gradient. This object also should contain the mode of the distribution (or a point nearby should be provided as center of the distribution).

The method has three parameter to adjust the method for the given distribution:

stepsmin

Minimal number of iterations for splitting cones. Notice that we start with 2^dim initial cones and that we arrive at 2^(dim+stepsmin) cones after these splits. So this number must be set with care. It can be set by a unur_mvtdr_set_stepsmin call.

boundsplitting

Cones where the volume below the hat is relatively large (i.e. larger than the average volume over all cones times boundsplitting are further split. This parameter can set via a unur_mvtdr_set_boundsplitting call.

maxcones

The maximum number of generated cones. When this number is reached, the initialization routine is stopped. Notice that the rejection constant can be still prohibitive large. This parameter can set via a unur_mvtdr_set_maxcones call.

Setting of these parameter can be quite tricky. The default settings lead to hat functions where the volume below the hat is similar in each cone. However, there might be some problems with distributions with higher correlations, since then too few cones are created. Then it might be necessary to increase the values for stepsmin and maxcones and to set boundsplitting to 0.

The number of cones and the total volume below the hat can be controlled using the respective calls unur_mvtdr_get_ncones and unur_mvtdr_get_hatvol. Notice, that the rejection constant is bounded from below by some figure (larger than 1) that depends on the dimension.

Unfortunately, the algorithm cannot detect the quality of the constructed hat.

Function reference

: UNUR_PAR* unur_mvtdr_new (const UNUR_DISTR* distribution)

Get parameters for generator.

: int unur_mvtdr_set_stepsmin (UNUR_PAR* parameters, int stepsmin)

Set minimum number of triangulation step for each starting cone. stepsmin must be nonnegative.

Default: 5.

: int unur_mvtdr_set_boundsplitting (UNUR_PAR* parameters, double boundsplitting)

Set bound for splitting cones. All cones are split which have a volume below the hat that is greater than bound_splitting times the average over all volumes. However, the number given by the unur_mvtdr_set_maxcones is not exceeded. Notice that the later number is always reached if bound_splitting is less than 1.

Default: 1.5

: int unur_mvtdr_set_maxcones (UNUR_PAR* parameters, int maxcones)

Set maximum number of cones.

Notice that this number is always increased to 2dim+stepsmin where dim is the dimension of the distribution object and stepsmin the given mimimum number of triangulation steps.

Notice: For higher dimensions and/or higher correlations between the coordinates of the random vector the required number of cones can be very high. A too small maximum number of cones can lead to a very high rejection constant.

Default: 10000.

: int unur_mvtdr_get_ncones (const UNUR_GEN* generator)

Get the number of cones used for the hat function of the generator. (In case of an error 0 is returned.)

: double unur_mvtdr_get_hatvol (const UNUR_GEN* generator)

Get the volume below the hat for the generator. (In case of an error UNUR_INFINITY is returned.)

: int unur_mvtdr_set_verify (UNUR_PAR* parameters, int verify)
: int unur_mvtdr_chg_verify (UNUR_GEN* generator, int verify)

Turn verifying of algorithm while sampling on/off. If the condition squeeze(x) <= PDF(x) <= hat(x) is violated for some x then unur_errno is set to UNUR_ERR_GEN_CONDITION. However notice that this might happen due to round-off errors for a few values of x (less than 1%).

Default is FALSE.


5.5.3 NORTA – NORmal To Anything

Required:

rank correlation matrix, marginal distributions

Speed:

Set-up: slow, Sampling: depends on dimension

Reinit:

not implemented

Reference:

[HLD04: Sect.12.5.2; Alg.12.11.]

NORTA (NORmal to anything) is a model to get random vectors with given marginal distributions and rank correlation.

Important: Notice that marginal distribution and (rank) correlation structure do not uniquely define a multivariate distribution. Thus there are many other (more or less sensible) models.

In the NORTA model multinormal random variates with the given (Spearman’s) rank correlations are generated. In a second step the (standard normal distributed) marginal variates are transformed by means of the CDF of the normal distribution to get uniform marginals. The resulting random vectors have uniform marginals and the desired rank correlation between its components. Such a random vector is called ’copula’.

By means of the inverse CDF the uniform marginals are then transformed into the target marginal distributions. This transformation does not change the rank correlation.

For the generation of the multinormal distribution the (Spearman’s) rank correlation matrix is transformed into the corresponding (Pearson) correlation matrix. Samples from the resulting multinormal distribution are generated by means of the Cholesky decomposition of the covariance matrix.

It can happen that the desired rank correlation matrix is not feasible, i.e., it cannot occur as rank correlation matrix of a multinormal distribution. The resulting "covariance" matrix is not positive definite. In this case an eigenvector correction method is used. Then all non-positive eigenvalues are set to a small positive value and hence the rank correlation matrix of the generated random vectors is "close" to the desired matrix.

How To Use

Create a multivariate generator object and set marginal distributions using unur_distr_cvec_set_marginals unur_distr_cvec_set_marginal_array , or unur_distr_cvec_set_marginal_list. (Do not use the corresponding calls for the standard marginal distributions).

When the domain of the multivariate distribution is set by of a unur_distr_cvec_set_domain_rect call then the domain of each of the marginal distributions is truncated by the respective coordinates of the given rectangle.

If copulae are required (i.e. multivariate distributions with uniform marginals) such a generator object can be created by means of unur_distr_copula .

There are no optional parameters for this method.

Function reference

: UNUR_PAR* unur_norta_new (const UNUR_DISTR* distribution)

Get default parameters for generator.


5.5.4 VNROU – Multivariate Naive Ratio-Of-Uniforms method

Required:

PDF

Optional:

mode, center, bounding rectangle for acceptance region

Speed:

Set-up: fast or slow, Sampling: slow

Reinit:

supported

Reference:

[WGS91]

VNROU is an implementation of the multivariate ratio-of-uniforms method which uses a (minimal) bounding hyper-rectangle, see also The Ratio-of-Uniforms Method. It uses an additional parameter r that can be used for adjusting the algorithm to the given distribution to improve performance and/or to make this method applicable. Larger values of r increase the class of distributions for which the method works at the expense of higher rejection constants. Moreover, this implementation uses the center mu of the distribution (which is set to the mode or mean by default, see unur_distr_cvec_get_center for details of its default values).

The minimal bounding has then the coordinates

v+ = sup_x (f(x))1/r d+1,
u-_i = inf_x_i (x_i- mu_i) (f(x))r/r d+1,
u+_i = sup_x_i (x_i- mu_i) (f(x))r/r d+1,

where x_i is the i-th coordinate of point x; mu_i is the i-th coordinate of the center mu. d denotes the dimension of the distribution. These bounds can either be given directly, or are computed automatically by means of an numerical routine by Hooke and Jeeves [HJa61] called direct search (see src/utils/hooke.c for further references and details). Of course this algorithm can fail, especially when this rectangle is not bounded.

It is important to note that the algorithm works with PDF(x-center) instead of PDF(x), i.e. the bounding rectangle has to be provided for PDF(x-center). This is important as otherwise the acceptance region can become a very long and skinny ellipsoid along a diagonal of the (huge) bounding rectangle.

VNROU is based on the rejection method (see The Rejection Method), and it is important to note that the acceptance probability decreases exponentially with dimension. Thus even for moderately many dimensions (e.g. 5) the number of repetitions to get one random vector can be prohibitively large and the algorithm seems to stay in an infinite loop.

How To Use

For using the VNROU method UNU.RAN needs the PDF of the distribution. Additionally, the parameter r can be set via a unur_vnrou_set_r call. Notice that the acceptance probability decreases when r is increased. On the other hand is is more unlikely that the bounding rectangle does not exist if r is small.

A bounding rectangle can be given by the unur_vnrou_set_u and unur_vnrou_set_v calls.

Important: The bounding rectangle has to be provided for the function PDF(x-center)! Notice that center is the center of the given distribution, see unur_distr_cvec_set_center. If in doubt or if this value is not optimal, it can be changed (overridden) by a unur_distr_cvec_set_center call.

If the coordinates of the bounding rectangle are not provided by the user then the minimal bounding rectangle is computed automatically.

By means of unur_vnrou_set_verify and unur_vnrou_chg_verify one can run the sampling algorithm in a checking mode, i.e., in every cycle of the rejection loop it is checked whether the used rectangle indeed enclosed the acceptance region of the distribution. When in doubt (e.g., when it is not clear whether the numerical routine has worked correctly) this can be used to run a small Monte Carlo study.

Important: The rejection constant (i.e. the expected number of iterations for generationg one random vector) can be extremely high, in particular when the dimension is 4 or higher. Then the algorithm will perform almost infinite loops. Thus it is recommended to read the volume below the hat function by means of the unur_vnrou_get_volumehat call. The returned number divided by the volume below the PDF (which is 1 in case of a normalized PDF) gives the rejection constant.

It is possible to change the parameters and the domain of the chosen distribution and run unur_reinit to reinitialize the generator object. Notice, that the coordinates of a bounding rectangle given by unur_vnrou_set_u and unur_vnrou_set_v calls are used also when the generator is reused. These can be changed by means of unur_vnrou_chg_u and unur_vnrou_chg_v calls. (If no such coordinates have been given, then they are computed numerically during the reinitialization proceedure.)

Function reference

: UNUR_PAR* unur_vnrou_new (const UNUR_DISTR* distribution)

Get default parameters for generator.

: int unur_vnrou_set_u (UNUR_PAR* parameters, double* umin, double* umax)

Sets left and right boundaries of bounding hyper-rectangle. If no values are given, the boundary of the minimal bounding hyper-rectangle is computed numerically.

Important: The boundaries are those of the density shifted by the center of the distribution, i.e., for the function PDF(x-center)!

Notice: Computing the minimal bounding rectangle may fail under some circumstances. Moreover, for multimodal distributions the bounds might be too small as only local extrema are computed. Nevertheless, for log-concave distributions it should work.

Default: not set (i.e. computed automatically)

: int unur_vnrou_chg_u (UNUR_GEN* generator, double* umin, double* umax)

Change left and right boundaries of bounding hyper-rectangle.

: int unur_vnrou_set_v (UNUR_PAR* parameters, double vmax)

Set upper boundary for bounding hyper-rectangle. If no values are given, the density at the mode is evaluated. If no mode is given for the distribution it is computed numerically (and might fail).

Default: not set (i.e. computed automatically)

: int unur_vnrou_chg_v (UNUR_GEN* generator, double vmax)

Change upper boundary for bounding hyper-rectangle.

: int unur_vnrou_set_r (UNUR_PAR* parameters, double r)

Sets the parameter r of the generalized multivariate ratio-of-uniforms method.

Notice: This parameter must satisfy r>0.

Default: 1.

: int unur_vnrou_set_verify (UNUR_PAR* parameters, int verify)

Turn verifying of algorithm while sampling on/off.

If the condition PDF(x) <= hat(x) is violated for some x then unur_errno is set to UNUR_ERR_GEN_CONDITION. However notice that this might happen due to round-off errors for a few values of x (less than 1%).

Default is FALSE.

: int unur_vnrou_chg_verify (UNUR_GEN* generator, int verify)

Change the verifying of algorithm while sampling on/off.

: double unur_vnrou_get_volumehat (const UNUR_GEN* generator)

Get the volume of below the hat. For normalized densities, i.e. when the volume below PDF is 1, this value equals the rejection constant for the vnrou method.

In case of an error UNUR_INFINITY is returned.


5.6 Markov chain samplers for continuous multivariate distributions

Markov chain samplers generate sequences of random vectors which have the target distribution as stationary distribution. There generated vectors are (more or less) correlated and it might take a long time until the sequence has converged to the given target distribution.

Beware: MCMC sampling can be dangerous!

Overview of methods

Markov Chain Methods for continuous multivariate distributions
sample with unur_sample_vec

GIBBS: T-concave logPDF and derivatives of logPDF.
HITRO: Requires PDF.


5.6.1 GIBBS – Markov Chain - GIBBS sampler

Required:

T-concave logPDF, derivatives of logPDF

Speed:

Set-up: fast, Sampling: moderate

Reinit:

not implemented

Reference:

[HLD04: Sect.14.1.2]

Method GIBBS implements a Gibbs sampler for a multivariate distribution with given joint density and its gradient. When running such a Markov chain all coordinates are updated cyclically using full conditional distributions. After each step the state of the chain is returned (i.e., a random point is returned whenever a single coordinate has been updated). It is also possible to return only points after all coordinates have been updated by "thinning" the chain. Moreover, to reduce autocorrelation this thinning factor can be any integer. Notice, however, that the sampling time for a chain of given length is increased by the same factor, too.

GIBBS also provides a variant of the Gibbs sampler where in each step a point from the full conditional distribution along some random direction is sampled. This direction is chosen uniformly from the sphere in each step. This method is also known as Hit-and-Run algorithm for non-uniform distributions.

Our experiences shows that the original Gibbs sampler with sampling along coordinate axes is superior to random direction sampling as long as the correlations between the components of the random vector are not too high.

For both variants transformed density rejection (see methods see TDR – Transformed Density Rejection and see ARS – Adaptive Rejection Sampling) is used to sample from the full conditional distributions. In opposition to the univariate case, it is important that the factor c is as large as possible. I.e., for a log-concave density c must be set to 0., since otherwise numerical underflow might stop the algorithm.

Important: GIBBS does not generate independent random points. The starting point of the Gibbs chain must be in a "typical" region of the target distribution. If such a point is not known or would be too expensive, then the first part of the chain should be discarded (burn-in of the chain).

How To Use

For using the GIBBS method UNU.RAN needs the logarithm of the PDF of the multivariate joint distribution and its gradient or partial derivatives.

It provides two variants:

coordinate direction sampling (Gibbs sampling) [default]

The coordinates are updated cyclically. It requires the partial derivatives of the (logarithm of the) PDF of the target distribution, see unur_distr_cvec_set_pdlogpdf. Otherwise, the gradient of the logPDF (see unur_distr_cvec_set_dlogpdf ) is used, which is more expensive.

This variant can be selected using unur_gibbs_set_variant_coordinate.

random direction sampling (nonuniform Hit-and-Run algorithm)

In each step is a direction is sampled uniformly from the sphere and the next point in the chain is sampled from the full conditional distribution along this direction.

It requires the gradient of the logPDF and thus each step is more expensive than each step for coordinate direction sampling.

This variant can be selected using unur_gibbs_set_variant_random_direction.

It is important that the c parameter for the TDR method is as large as possible. For logconcave distribution it must be set to 0, since otherwise numerical underflow can cause the algorithm to stop.

The starting point of the Gibbs chain must be "typical" for the target distribution. If such a point is not known or would be too expensive, then the first part of the chain should be discarded (burn-in of the chain). When using the unur_gibbs_set_burnin call this is done during the setup of the Gibbs sampler object.

In case of a fatal error in the generator for conditional distributions the methods generates points that contain UNUR_INFINITY.

Warning: The algorithm requires that all full conditionals for the given distribution object are T-concave. However, this property is not checked. If this property is not satisfied, then generation from the conditional distributions becomes (very) slow and might fail or (even worse) produces random vectors from an incorrect distribution. When using unur_gibbs_set_burnin then the setup already might fail. Thus when in doubt whether GIBBS can be used for the targent distribution it is a good idea to use a burn-in for checking.

Remark: It might happen (very rarely) that the chain becomes stuck due to numerical errors. (This is in particular the case when the given PDF does not fulfill the condition of this method.) When this happens during burn-in then the setup is aborted (i.e. it fails). Otherwise the chain restarts again from its starting point.

Warning: Be carefull with debugging flags. If it contains flag 0x01000000u it produces a lot of output for each step in the algorithm. (This flag is switched of in the default debugging flags).

Function reference

: UNUR_PAR* unur_gibbs_new (const UNUR_DISTR* distribution)

...........................................................................

: int unur_gibbs_set_variant_coordinate (UNUR_PAR* parameters)

Coordinate Direction Sampling: Sampling along the coordinate directions (cyclic).

This is the default.

: int unur_gibbs_set_variant_random_direction (UNUR_PAR* parameters)

Random Direction Sampling: Sampling along the random directions.

: int unur_gibbs_set_c (UNUR_PAR* parameters, double c)

Set parameter c for transformation T of the transformed density rejection method. Currently only values between 0 and -0.5 are allowed. If c is between 0 and -0.5 it is set to -0.5.

For c =0 (for logconcave densities) method ARS (see ARS – Adaptive Rejection Sampling) is used which is very robust against badly normalized PDFs. For other values method TDR (see TDR – Transformed Density Rejection) is used.

The value for c should be as large as possible to avoid fatal numerical underflows. Thus for log-concave distributions c must be set to 0.

Default is 0.

: int unur_gibbs_set_startingpoint (UNUR_PAR* parameters, const double* x0)

Sets the starting point of the Gibbs sampler. x0 must be a "typical" point of the given distribution. If such a "typical" point is not known and a starting point is merely guessed, the first part of the Gibbs chain should be discarded (burn-in), e.g.\ by mean of the unur_gibbs_set_burnin call.

Default is the result of unur_distr_cvec_get_center for the given distribution object.

: int unur_gibbs_set_thinning (UNUR_PAR* parameters, int thinning)

Sets the thinning parameter. When thinning is set to k then every k-th point from the iteration is returned by the sampling algorithm.

Notice: This parameter must satisfy thinning>=1.

Default: 1.

: int unur_gibbs_set_burnin (UNUR_PAR* parameters, int burnin)

If a "typical" point for the target distribution is not known but merely guessed, the first part of the Gibbs chain should be discarded (burn-in). This can be done during the initialization of the generator object. The length of the burn-in can is then burnin.

When method GIBBS is not applicable for the target distribution then the initialization already might fail during the burn-in. Thus this reduces the risk of running a generator that returns UNUR_INFINITY cased by some fatal error during sampling.

The thinning factor set by a unur_gibbs_set_thinning call has no effect on the length of the burn-in, i.e., for the burn-in always a thinning factor 1 is used.

Notice: This parameter must satisfy thinning>=0.

Default: 0.

: const double* unur_gibbs_get_state (UNUR_GEN* generator)
: int unur_gibbs_chg_state (UNUR_GEN* generator, const double* state)

Get and change the current state of the Gibbs chain.

: int unur_gibbs_reset_state (UNUR_GEN* generator)

Reset state of chain to starting point.

Notice: Currently this function does not reset the generators for conditional distributions. Thus it is not possible to get the same Gibbs chain even when the underlying uniform random number generator is reset.


5.6.2 HITRO – Markov Chain - HIT-and-run sampler with Ratio-Of-uniforms

Required:

PDF

Optional:

mode, center, bounding rectangle for acceptance region

Speed:

Set-up: fast, Sampling: fast

Reinit:

not implemented

Reference:

[KLPa05]

HITRO is an implementation of a hit-and-run sampler that runs on the acceptance region of the multivariate ratio-of-uniforms method, see The Ratio-of-Uniforms Method.

The Ratio-of-Uniforms transforms the region below the density into some region that we call "region of acceptance" in the following. The minimal bounding hyperrectangle of this region is given by

v+ = sup_x (f(x))1/r d+1,
u-_i = inf_x_i (x_i- mu_i) (f(x))r/r d+1,
u+_i = sup_x_i (x_i- mu_i) (f(x))r/r d+1,

where d denotes the dimension of the distribution; x_i is the i-th coordinate of point x; mu_i is the i-th coordinate of the center mu of the distribution, i.e., a point in the "main region" of the distribution. Using the center is important, since otherwise the acceptance region can become a very long and skinny ellipsoid along a diagonal of the (huge) bounding rectangle.

For each step of the Hit-and-Run algorithm we have to choose some direction. This direction together with the current point of the chain determines a straight line. Then a point is sampled uniformly on intersection of this line and the region of acceptance. This is done by rejection from a uniform distribution on a line segment that covers it. Depending of the chosen variant the endpoints of this covering line are computed either by means of a (not necessary minimal) bounding hyper-rectangle, or just the "covering plate" of the bounding hyper-rectangle.

The required bounds of the hyper-rectable can be given directly by the user. Otherwise, these are computed automatically by means of a numerical routine by Hooke and Jeeves [HJa61] called direct search (see src/utils/hooke.c for further references and details). However, this expensive computation can be avoided by determine these bounds "on the fly" by the following adaptive algorithm: Start with some (small) hyper-rectangle and enlarge it whenever the endpoints of the covering line segment are not contained in the acceptance region of the Ratio-of-Unfiorms method. This approach works reliable as long as the region of acceptance is convex.

The performance of the uniform sampling from the line segment is much improved if the covering line is adjusted (shortened) whenever a point is rejected (adaptive sampling). This technique reduces the expected number of iterations enormously.

Method HITRO requires that the region of acceptance of the Ratio-of-Uniforms method is bounded. The shape of this region can be controlled by a parameter r. Higher values of r result in larger classes of distributions with bounded region of acceptance. (A distribution that has such a bounded region for some r also has a bounded region for every r’ greater than r.) On the other hand the acceptance probability decreases with increasing r. Moreover, round-off errors are more likely and (for large values of r) might result in a chain with a stationary distribution different from the target distribution.

Method HITRO works optimal for distributions whose region of acceptance is convex. This is in particular the case for all log-concave distributions when we set r = 1. For bounded but non-convex regions of acceptance convergence is yet not guarenteed by mathematical theory.

How To Use

Method HITRO requires the PDF of the target distribution (derivatives are not necessary).

The acceptance region of the Ratio-of-Uniforms transformation must be bounded. Its shape is controlled by parameter r. By default this parameter is set to 1 as this guarentees a convex region of acceptance when the PDF of the given distribution is log-concave. It should only be set to a different (higher!) value using unur_vnrou_set_r if otherwise x_i (f(x))r/r d+1 were not bounded for each coordinate.

There are two variants of the HITRO sampler:

coordinate direction sampling. [default]

The coordinates are updated cyclically. This can be seen as a Gibbs sampler running on the acceptance region of the Ratio-of-Uniforms method. This variant can be selected using unur_hitro_set_variant_coordinate.

random direction sampling.

In each step is a direction is sampled uniformly from the sphere.

This variant can be selected using unur_hitro_set_variant_random_direction.

Notice that each iteration of the coordinate direction sampler is cheaper than an iteration of the random direction sampler.

Sampling uniformly from the line segment can be adjusted in several ways:

Adaptive line sampling vs. simple rejection.

When adaptive line sampling is switched on, the covering line is shortened whenever a point is rejected. However, when the region of acceptance is not convex the line segment from which we have to sample might not be connected. We found that the algorithm still works but at the time being there is no formal proof that the generated Markov chain has the required stationary distribution.

Adaptive line sampling can switch on/off by means of the unur_hitro_set_use_adaptiveline call.

Bounding hyper-rectangle vs. "covering plate".

For computing the covering line we can use the bounding hyper-rectangle or just its upper bound. The latter saves computing time during the setup and when computing the covering during at each iteration step at the expense of a longer covering line. When adaptive line sampling is used the total generation time for the entire chain is shorter when only the "covering plate" is used.

Notice: When coordinate sampling is used the entire bounding rectangle is used.

Using the entire bounding hyper-rectangle can be switched on/off by means of the unur_hitro_set_use_boundingrectangle call.

Deterministic vs. adaptive bounding hyper-rectangle.

A bounding rectangle can be given by the unur_vnrou_set_u and unur_vnrou_set_v calls. Otherwise, the minimal bounding rectangle is computed automatically during the setup by means of a numerical algorithm. However, this is (very) slow especially in higher dimensions and it might happen that this algorithm (like any other numerical algorithm) does not return a correct result.

Alternatively the bounding rectangle can be computed adaptively. In the latter case unur_vnrou_set_u and unur_vnrou_set_v can be used to provide a starting rectangle which must be sufficiently small. Then both endpoints of the covering line segment are always check whether they are outside the acceptance region of the Ratio-of-Uniforms method. If they are not, then the line segment and the ("bounding") rectangle are enlarged using a factor that can be given using the unur_hitro_set_adaptive_multiplier call.

Notice, that running this method in the adaptive rectangle mode requires that the region of acceptance is convex when random directions are used, or the given PDF is unimodal when coordinate direction sampling is used. Moreover, it requires two additional calls to the PDF in each iteration step of the chain.

Using addaptive bounding rectangles can be switched on/off by means of the unur_hitro_set_use_adaptiverectangle call.

The algorithm takes of a bounded rectangular domain given by a unur_distr_cvec_set_domain_rect call, i.e. the PDF is set to zero for every x outside the given domain. However, it is only the coordinate direction sampler where the boundary values are directly used to get the endpoins of the coverline line for the line sampling step.

Important: The bounding rectangle has to be provided for the function PDF(x-center)! Notice that center is the center of the given distribution, see unur_distr_cvec_set_center. If in doubt or if this value is not optimal, it can be changed (overridden) by a unur_distr_cvec_set_center call.

Function reference

: UNUR_PAR* unur_hitro_new (const UNUR_DISTR* distribution)

Get default parameters for generator.

: int unur_hitro_set_variant_coordinate (UNUR_PAR* parameters)

Coordinate Direction Sampling: Sampling along the coordinate directions (cyclic).

Notice: For this variant the entire bounding rectangle is always used independent of the unur_hitro_set_use_boundingrectangle call.

This is the default.

: int unur_hitro_set_variant_random_direction (UNUR_PAR* parameters)

Random Direction Sampling: Sampling along the random directions.

: int unur_hitro_set_use_adaptiveline (UNUR_PAR* parameters, int adaptive)

When adaptive is set to TRUE adaptive line sampling is applied, otherwise simple rejection is used.

Notice: When adaptive line sampling is switched off, the entire bounding rectangle must be used since otherwise the sampling time can be arbitrarily slow.

Warning: When adaptive line sampling is switched off, sampling can be arbitrarily slow. In particular this happens when random direction sampling is used for distributions with rectangular domains. Then the algorithm can be trapped into a vertex (or even edge).

Default is TRUE.

: int unur_hitro_set_use_boundingrectangle (UNUR_PAR* parameters, int rectangle)

When rectangle is set to TRUE the entire bounding rectangle is used for computing the covering line. Otherwise, only an upper bound for the acceptance region is used.

Notice: When coordinate sampling is used the entire bounding rectangle has is always used and this call has no effect.

Default: FALSE for random direction samplig, TRUE for coordinate direction sampling.

: int unur_hitro_set_use_adaptiverectangle (UNUR_PAR* parameters, int adaptive)

When adaptive is set to FALSE the bounding rectangle is determined during the setup. Either, it is computed automatically by a (slow) numerical method, or it must be provided by unur_vnrou_set_u and unur_vnrou_set_v calls.

If adaptive is set to TRUE the bounding rectangle is computed adaptively. In this case the unur_vnrou_set_u and unur_vnrou_set_v calls can be used to provide a starting rectangle. This should be sufficiently small. If not given then we assume v_max = 1, u_min=(-0.001,-0.001,...,-0.001), and u_max=(0.001,0.001,...,0.001). Adaptive enlargements of the bounding hyperrectangle can be controlled set setting an enlargement factor given by a unur_hitro_set_adaptive_multiplier call.

Using adaptive computation of the bounding rectangle reduces the setup time significantly (when it is not given by the user) at the expense of two additional PDF evaluations during each iteration step.

Important: Using adaptive bounding rectangles requires that the region of acceptance is convex when random directions are used, or a unimodal PDF when coordinate direction sampling is used.

Default: FALSE for random direction samplig, TRUE for coordinate direction sampling.

: int unur_hitro_set_r (UNUR_PAR* parameters, double r)

Sets the parameter r of the generalized multivariate ratio-of-uniforms method.

Notice: This parameter must satisfy r>0.

Default: 1.

: int unur_hitro_set_v (UNUR_PAR* parameters, double vmax)

Set upper boundary for bounding hyper-rectangle. If not set not set the mode of the distribution is used.

If adaptive bounding rectangles the value is used for the starting rectangle. If not given (and the mode of the distribution is not known) then vmax=1e-3 is used.

If deterministic bounding rectangles these values are the given values are used for the rectangle. If no value is given (and the mode of the distribution is not known), the upper bound of the minimal bounding hyper-rectangle is computed numerically (slow).

Default: not set.

: int unur_hitro_set_u (UNUR_PAR* parameters, const double* umin, const double* umax)

Sets left and right boundaries of bounding hyper-rectangle.

If adaptive bounding rectangles these values are used for the starting rectangle. If not given then umin={-b,-b,…,-b} and umax={b,b,…,b} with b=1.e-3 is used.

If deterministic bounding rectangles these values are the given values are used for the rectangle. If no values are given, the boundary of the minimal bounding hyper-rectangle is computed numerically (slow).

Important: The boundaries are those of the density shifted by the center of the distribution, i.e., for the function PDF(x-center)!

Notice: Computing the minimal bounding rectangle may fail under some circumstances. Moreover, for multimodal distributions the bounds might be too small as only local extrema are computed. Nevertheless, for log-concave distributions it should work.

Default: not set.

: int unur_hitro_set_adaptive_multiplier (UNUR_PAR* parameters, double factor)

Adaptive enlargements of the bounding hyperrectangle can be controlled set setting the enlargement factor. This must be greater than 1. Values close to 1 result in small adaptive steps and thus reduce the risk of too large bounding rectangles. On the other hand many adaptive steps might be necessary.

Notice: For practical reasons this call does not accept values for factor less than 1.0001. If this value is UNUR_INFINITY this results in infinite loops.

Default: 1.1

: int unur_hitro_set_startingpoint (UNUR_PAR* parameters, const double* x0)

Sets the starting point of the HITRO sampler in the original scale. x0 must be a "typical" point of the given distribution. If such a "typical" point is not known and a starting point is merely guessed, the first part of the HITRO chain should be discarded (burn-in), e.g.\ by mean of the unur_hitro_set_burnin call.

Important: The PDF of the distribution must not vanish at the given point x0.

Default is the result of unur_distr_cvec_get_center for the given distribution object.

: int unur_hitro_set_thinning (UNUR_PAR* parameters, int thinning)

Sets the thinning parameter. When thinning is set to k then every k-th point from the iteration is returned by the sampling algorithm. If thinning has to be set such that each coordinate is updated when using coordinate direction sampling, then thinning should be dim+1 (or any multiple of it) where dim is the dimension of the distribution object.

Notice: This parameter must satisfy thinning>=1.

Default: 1.

: int unur_hitro_set_burnin (UNUR_PAR* parameters, int burnin)

If a "typical" point for the target distribution is not known but merely guessed, the first part of the HITRO chain should be discarded (burn-in). This can be done during the initialization of the generator object. The length of the burn-in can is then burnin.

The thinning factor set by a unur_hitro_set_thinning call has no effect on the length of the burn-in, i.e., for the burn-in always a thinning factor 1 is used.

Notice: This parameter must satisfy thinning>=0.

Default: 0.

: const double* unur_hitro_get_state (UNUR_GEN* generator)
: int unur_hitro_chg_state (UNUR_GEN* generator, const double* state)

Get and change the current state of the HITRO chain.

Notice: The state variable contains the point in the dim+1 dimensional point in the (tansformed) region of acceptance of the Ratio-of-Uniforms method. Its coordinate are stored in the following order: state[] = {v, u1, u2, …, udim}.

If the state can only be changed if the given state is inside this region.

: int unur_hitro_reset_state (UNUR_GEN* generator)

Reset state of chain to starting point.

Notice: Currently this function does not reset the generators for conditional distributions. Thus it is not possible to get the same HITRO chain even when the underlying uniform random number generator is reset.


5.7 Methods for continuous empirical multivariate distributions

Overview of methods

Methods for continuous empirical multivariate distributions
sample with unur_sample_vec

VEMPK: Requires an observed sample.

Example

/* ------------------------------------------------------------- */
/* File: example_vemp.c                                          */
/* ------------------------------------------------------------- */

/* Include UNURAN header file.                                   */
#include <unuran.h>

/* ------------------------------------------------------------- */

/* Example how to sample from an empirial continuous             */
/* multivariate distribution.                                    */

/* ------------------------------------------------------------- */

int main(void)
{
  int    i;

  /* 4 data points of dimension 2                                */
  double data[] = { 1. ,1.,       /* 1st data point              */
		    -1.,1.,       /* 2nd data point              */
		    1.,-1.,       /* 3rd data point              */
		    -1.,-1. };    /* 4th data point              */

  double result[2];

  /* Declare the three UNURAN objects.                           */
  UNUR_DISTR *distr;    /* distribution object                   */
  UNUR_PAR   *par;      /* parameter object                      */
  UNUR_GEN   *gen;      /* generator object                      */

  /* Create a distribution object with dimension 2.              */
  distr = unur_distr_cvemp_new( 2 );

  /* Set empirical sample.                                       */
  unur_distr_cvemp_set_data(distr, data, 4); 

  /* Choose a method: VEMPK.                                     */
  par = unur_vempk_new(distr);

  /* Use variance correction.                                    */
  unur_vempk_set_varcor( par, 1 );

  /* Create the generator object.                                */
  gen = unur_init(par);

  /* It is important to check if the creation of the generator   */
  /* object was successful. Otherwise `gen' is the NULL pointer  */ 
  /* and would cause a segmentation fault if used for sampling.  */
  if (gen == NULL) {
     fprintf(stderr, "ERROR: cannot create generator object\n");
     exit (EXIT_FAILURE);
  }

  /* It is possible to reuse the distribution object to create   */
  /* another generator object. If you do not need it any more,   */
  /* it should be destroyed to free memory.                      */
  unur_distr_free(distr);

  /* Now you can use the generator object `gen' to sample from   */
  /* the distribution. Eg.:                                      */
  for (i=0; i<10; i++) {
    unur_sample_vec(gen, result);
    printf("(%f,%f)\n", result[0], result[1]);
  }
 
  /* When you do not need the generator object any more, you     */
  /* can destroy it.                                             */
  unur_free(gen);

  exit (EXIT_SUCCESS);

} /* end of main() */

/* ------------------------------------------------------------- */

Example (String API)

(not implemented)


5.7.1 VEMPK – (Vector) EMPirical distribution with Kernel smoothing

Required:

observed sample

Speed:

Set-up: slow, Sampling: slow (depends on dimension)

Reinit:

not implemented

Reference:

[HLa00] [HLD04: Sect.12.2.1]

VEMPK generates random variates from a multivariate empirical distribution that is given by an observed sample. The idea is that simply choosing a random point from the sample and to return it with some added noise results in a method that has very nice properties, as it can be seen as sampling from a kernel density estimate. Clearly we have to decide about the density of the noise (called kernel) and about the covariance matrix of the noise. The mathematical theory of kernel density estimation shows us that we are comparatively free in choosing the kernel. It also supplies us with a simple formula to compute the optimal standarddeviation of the noise, called bandwidth (or window width) of the kernel.

Currently only a Gaussian kernel with the same covariance matrix as the given sample is implemented. However it is possible to choose between a variance corrected version or those with optimal MISE. Additionally a smoothing factor can be set to adjust the estimated density to non-bell-shaped data densities.

How To Use

VEMPK uses empirical distributions. The main parameter would be the choice if of kernel density. However, currently only Gaussian kernels are supported. The parameters for the density are computed by a simple but robust method. However, it is possible to control its behavior by changing the smoothing factor. Additionally, variance correction can be swithed on (at the price of suboptimal MISE).

Function reference

: UNUR_PAR* unur_vempk_new (const UNUR_DISTR* distribution)

Get default parameters for generator.

: int unur_vempk_set_smoothing (UNUR_PAR* parameters, double smoothing)
: int unur_vempk_chg_smoothing (UNUR_GEN* generator, double smoothing)

Set and change the smoothing factor. The smoothing factor controlles how “smooth” the resulting density estimation will be. A smoothing factor equal to 0 results in naive resampling. A very large smoothing factor (together with the variance correction) results in a density which is approximately equal to the kernel. Default is 1 which results in a smoothing parameter minimising the MISE (mean integrated squared error) if the data are not too far away from normal. If a large smoothing factor is used, then variance correction must be switched on.

Default: 1

: int unur_vempk_set_varcor (UNUR_PAR* parameters, int varcor)
: int unur_vempk_chg_varcor (UNUR_GEN* generator, int varcor)

Switch variance correction in generator on/off. If varcor is TRUE then the variance of the used density estimation is the same as the sample variance. However this increases the MISE of the estimation a little bit.

Default is FALSE.


5.8 Methods for discrete univariate distributions

Overview of methods

Methods for discrete univariate distributions
sample with unur_sample_discr

methodPMFPVmodesumother
DARIxx~T-concave
DAU[x]x
DEXTwrapper for external generator
DGT[x]x
DSROUxxxT-concave
DSS[x]xx
DSTDbuild-in standard distribution

Example

/* ------------------------------------------------------------- */
/* File: example_discr.c                                         */
/* ------------------------------------------------------------- */

/* Include UNURAN header file.                                   */
#include <unuran.h>

/* ------------------------------------------------------------- */

/* Example how to sample from a discrete univariate distribution.*/

/* ------------------------------------------------------------- */

int main(void)
{
  int    i;
  double param = 0.3;

  double probvec[10] = {1.0, 2.0, 3.0, 4.0, 5.0,\
                        6.0, 7.0, 8.0, 4.0, 3.0};

  /* Declare the three UNURAN objects.                           */
  UNUR_DISTR *distr1, *distr2;    /* distribution objects        */
  UNUR_PAR   *par1, *par2;        /* parameter objects           */
  UNUR_GEN   *gen1, *gen2;        /* generator objects           */

  /* First distribution: defined by PMF.                         */
  distr1 = unur_distr_geometric(&param, 1);
  unur_distr_discr_set_mode(distr1, 0);

  /* Choose a method: DARI.                                      */
  par1 = unur_dari_new(distr1);
  gen1 = unur_init(par1);

  /* It is important to check if the creation of the generator   */
  /* object was successful. Otherwise `gen' is the NULL pointer  */ 
  /* and would cause a segmentation fault if used for sampling.  */
  if (gen1 == NULL) {
     fprintf(stderr, "ERROR: cannot create generator object\n");
     exit (EXIT_FAILURE);
  }
  
  /* Second distribution: defined by (finite) PV.                */
  distr2 = unur_distr_discr_new();
  unur_distr_discr_set_pv(distr2, probvec, 10);

  /* Choose a method: DGT.                                       */
  par2 = unur_dgt_new(distr2);
  gen2 = unur_init(par2);
  if (gen2 == NULL) {
     fprintf(stderr, "ERROR: cannot create generator object\n");
     exit (EXIT_FAILURE);
  }
  
  /* print some random integers                                  */
  for (i=0; i<10; i++){
    printf("number %d: %d\n", i*2,   unur_sample_discr(gen1) );
    printf("number %d: %d\n", i*2+1, unur_sample_discr(gen2) );
  }

  /* Destroy all objects.                                        */
  unur_distr_free(distr1);
  unur_distr_free(distr2);
  unur_free(gen1);
  unur_free(gen2);

  exit (EXIT_SUCCESS);

} /* end of main() */

/* ------------------------------------------------------------- */

Example (String API)

/* ------------------------------------------------------------- */
/* File: example_discr_str.c                                     */
/* ------------------------------------------------------------- */
/* String API.                                                   */
/* ------------------------------------------------------------- */

/* Include UNURAN header file.                                   */
#include <unuran.h>

/* ------------------------------------------------------------- */

/* Example how to sample from a discrete univariate distribution.*/

/* ------------------------------------------------------------- */

int main(void)
{
  int    i;     /* loop variable                                 */

  /* Declare UNURAN generator objects.                           */
  UNUR_GEN   *gen1, *gen2;        /* generator objects           */


  /* First distribution: defined by PMF.                         */
  gen1 = unur_str2gen("geometric(0.3); mode=0 & method=dari");

  /* It is important to check if the creation of the generator   */
  /* object was successful. Otherwise `gen' is the NULL pointer  */ 
  /* and would cause a segmentation fault if used for sampling.  */
  if (gen1 == NULL) {
     fprintf(stderr, "ERROR: cannot create generator object\n");
     exit (EXIT_FAILURE);
  }
  
  /* Second distribution: defined by (finite) PV.                */
  gen2 = unur_str2gen(
             "distr=discr; pv=(1,2,3,4,5,6,7,8,4,3) & method=dgt");
  if (gen2 == NULL) {
     fprintf(stderr, "ERROR: cannot create generator object\n");
     exit (EXIT_FAILURE);
  }
  
  /* print some random integers                                  */
  for (i=0; i<10; i++){
    printf("number %d: %d\n", i*2,   unur_sample_discr(gen1) );
    printf("number %d: %d\n", i*2+1, unur_sample_discr(gen2) );
  }

  /* Destroy all objects.                                        */
  unur_free(gen1);
  unur_free(gen2);

  exit (EXIT_SUCCESS);

} /* end of main() */

/* ------------------------------------------------------------- */

5.8.1 DARI – Discrete Automatic Rejection Inversion

Required:

T-concave PMF, mode, approximate area

Speed:

Set-up: moderate, Sampling: fast

Reinit:

supported

Reference:

[HDa96] [HLD04: Sect.10.2; Alg.10.4]

DARI is based on rejection inversion, which can be seen as an adaptation of transformed density rejection to discrete distributions. The used transformation is -1/sqrt(x) .

DARI uses three almost optimal points for constructing the (continuous) hat. Rejection is then done in horizontal direction. Rejection inversion uses only one uniform random variate per trial.

DARI has moderate set-up times (the PMF is evaluated nine times), and good marginal speed, especially if an auxiliary array is used to store values during generation.

DARI works for all T_-1/2 -concave distributions. It requires the PMF and the location of the mode. Moreover the approximate sum over the PMF is used. (If no sum is given for the distribution the algorithm assumes that it is approximately 1.) The rejection constant is bounded from above by 4 for all T-concave distributions.

How To Use

DARI works for discrete distribution object with given PMF. The sum over probabilities should be approximately one. Otherwise it must be set by a unur_distr_discr_set_pmfsum call to its (approximate) value.

The size of an auxiliary table can be set by unur_dari_set_tablesize. The expected number of evaluations can be reduced by switching the use of squeezes by means of unur_dari_set_squeeze. It is possible to change the parameters and the domain of the chosen distribution and run unur_reinit to reinitialize the generator object. Notice, that derived parameters like the mode must also be (re-) set if the parameters or the domain has be changed.

There exists a test mode that verifies whether the conditions for the method are satisfied or not. It can be switched on by calling unur_dari_set_verify and unur_dari_chg_verify respectively. Notice however that sampling is (much) slower then.

Function reference

: UNUR_PAR* unur_dari_new (const UNUR_DISTR* distribution)

Get default parameters for generator.

: int unur_dari_set_squeeze (UNUR_PAR* parameters, int squeeze)

Turn utilization of the squeeze of the algorithm on/off. This squeeze does not resamble the squeeze of the continuous TDR method. It was especially designed for rejection inversion.

The squeeze is not necessary if the size of the auxiliary table is big enough (for the given distribution). Using a squeeze is suggested to speed up the algorithm if the domain of the distribution is very big or if only small samples are produced.

Default: no squeeze.

: int unur_dari_set_tablesize (UNUR_PAR* parameters, int size)

Set the size for the auxiliary table, that stores constants computed during generation. If size is set to 0 no table is used. The speed-up can be impressive if the PMF is expensive to evaluate and the “main part of the distribution” is concentrated in an interval shorter than the size of the table.

Default is 100.

: int unur_dari_set_cpfactor (UNUR_PAR* parameters, double cp_factor)

Set factor for position of the left and right construction point, resp. The cp_factor is used to find almost optimal construction points for the hat function. The cp_factor must be positive and should not exceed 2. There is no need to change this factor in almost all situations.

Default is 0.664.

: int unur_dari_set_verify (UNUR_PAR* parameters, int verify)
: int unur_dari_chg_verify (UNUR_GEN* generator, int verify)

Turn verifying of algorithm while sampling on/off. If the condition is violated for some x then unur_errno is set to UNUR_ERR_GEN_CONDITION. However notice that this might happen due to round-off errors for a few values of x (less than 1%).

Default is FALSE.


5.8.2 DAU – (Discrete) Alias-Urn method

Required:

probability vector (PV)

Speed:

Set-up: slow (linear with the vector-length), Sampling: very fast

Reinit:

supported

Reference:

[WAa77] [HLD04: Sect.3.2]

DAU samples from distributions with arbitrary but finite probability vectors (PV) of length N. The algorithmus is based on an ingeneous method by A.J. Walker and requires a table of size (at least) N. It needs one random numbers and only one comparison for each generated random variate. The setup time for constructing the tables is O(N).

By default the probability vector is indexed starting at 0. However this can be changed in the distribution object by a unur_distr_discr_set_domain call.

The method also works when no probability vector but a PMF is given. However then additionally a bounded (not too large) domain must be given or the sum over the PMF (see unur_distr_discr_make_pv for details).

How To Use

Create an object for a discrete distribution either by setting a probability vector or a PMF. The performance can be slightly influenced by setting the size of the used table which can be changed by unur_dau_set_urnfactor. It is possible to change the parameters and the domain of the chosen distribution and run unur_reinit to reinitialize the generator object.

Function reference

: UNUR_PAR* unur_dau_new (const UNUR_DISTR* distribution)

Get default parameters for generator.

: int unur_dau_set_urnfactor (UNUR_PAR* parameters, double factor)

Set size of urn table relative to length of the probability vector. It must not be less than 1. Larger tables result in (slightly) faster generation times but require a more expensive setup. However sizes larger than 2 are not recommended.

Default is 1.


5.8.3 DEXT – wrapper for Discrete EXTernal generators

Required:

routine for sampling discrete random variates

Speed:

depends on external generator

Reinit:

supported

Method DEXT is a wrapper for external generators for discrete univariate distributions. It allows the usage of external random variate generators within the UNU.RAN framework.

How To Use

The following steps are required to use some external generator within the UNU.RAN framework (some of these are optional):

  1. Make an empty generator object using a unur_dext_new call. The argument distribution is optional and can be replaced by NULL. However, it is required if you want to pass parameters of the generated distribution to the external generator or for running some validation tests provided by UNU.RAN.
  2. Create an initialization routine of type int (*init)(UNUR_GEN *gen) and plug it into the generator object using the unur_dext_set_init call. Notice that the init routine must return UNUR_SUCCESS when it has been executed successfully and UNUR_FAILURE otherwise. It is possible to get the size of and the pointer to the array of parameters of the underlying distribution object by the respective calls unur_dext_get_ndistrparams and unur_dext_get_distrparams. Parameters for the external generator that are computed in the init routine can be stored in a single array or structure which is available by the unur_dext_get_params call.

    Using an init routine is optional and can be omitted.

  3. Create a sampling routine of type int (*sample)(UNUR_GEN *gen) and plug it into the generator object using the unur_dext_set_sample call.

    Uniform random numbers are provided by the unur_sample_urng call. Do not use your own implementation of a uniform random number generator directly. If you want to use your own random number generator we recommend to use the UNU.RAN interface (see see Using uniform random number generators).

    The array or structure that contains parameters for the external generator that are computed in the init routine are available using the unur_dext_get_params call.

    Using a sample routine is of course obligatory.

It is possible to change the parameters and the domain of the chosen distribution and run unur_reinit to reinitialize the generator object. The init routine is then called again.

Here is a short example that demonstrates the application of this method by means of the geometric distribution:

/* ------------------------------------------------------------- */
/* File: example_dext.c                                          */
/* ------------------------------------------------------------- */

/* Include UNURAN header file.                                   */
#include <unuran.h>

/* ------------------------------------------------------------- */

/* This example shows how an external generator for the          */
/* geometric distribution can be used within the UNURAN          */
/* framework.                                                    */
/*                                                               */
/* Notice, that this example does not provide the simplest       */
/* solution.                                                     */

/* ------------------------------------------------------------- */
/* Initialization routine.                                       */
/*                                                               */
/*   Here we simply read the parameter of the geometric          */
/*   distribution and store it in an array for parameters of     */
/*   the external generator.                                     */
/*   [ Of course we could do this in the sampling routine as     */
/*   and avoid the necessity of this initialization routine. ]   */

int geometric_init (UNUR_GEN *gen)
{ 
  /* Get pointer to parameters of geometric distribution         */
  double *params = unur_dext_get_distrparams(gen);

  /* The parameter is the first entry (see manual)               */
  double p = params[0];

  /* Get array to store this parameter for external generator    */
  double *genpar = unur_dext_get_params(gen, sizeof(double));
  genpar[0] = p;

  /* Executed successfully                                       */
  return UNUR_SUCCESS;
}

/* ------------------------------------------------------------- */
/* Sampling routine.                                             */
/*                                                               */
/*   Contains the code for the external generator.               */

int geometric_sample (UNUR_GEN *gen)
{ 
  /* Get scale parameter                                         */
  double *genpar = unur_dext_get_params(gen,0);
  double p = genpar[0];

  /* Sample a uniformly distributed random number                */
  double U = unur_sample_urng(gen);

  /* Transform into geometrically distributed random variate     */
  return ( (int) (log(U) / log(1.-p)) );
}

/* ------------------------------------------------------------- */

int main(void)
{
  int i;     /* loop variable                                    */
  int K;     /* will hold the random number                      */

  /* Declare the three UNURAN objects.                           */
  UNUR_DISTR *distr;    /* distribution object                   */
  UNUR_PAR   *par;      /* parameter object                      */
  UNUR_GEN   *gen;      /* generator object                      */

  /* Use predefined geometric distribution with parameter 1/10   */
  double fpar[1] = { 0.1 };
  distr = unur_distr_geometric(fpar, 1);

  /* Use method DEXT                                             */
  par = unur_dext_new(distr);

  /* Set initialization and sampling routines.                   */
  unur_dext_set_init(par, geometric_init);
  unur_dext_set_sample(par, geometric_sample);

  /* Create the generator object.                                */
  gen = unur_init(par);

  /* It is important to check if the creation of the generator   */
  /* object was successful. Otherwise `gen' is the NULL pointer  */ 
  /* and would cause a segmentation fault if used for sampling.  */
  if (gen == NULL) {
     fprintf(stderr, "ERROR: cannot create generator object\n");
     exit (EXIT_FAILURE);
  }

  /* It is possible to reuse the distribution object to create   */
  /* another generator object. If you do not need it any more,   */
  /* it should be destroyed to free memory.                      */
  unur_distr_free(distr);

  /* Now you can use the generator object `gen' to sample from   */
  /* the standard Gaussian distribution.                         */
  /* Eg.:                                                        */
  for (i=0; i<10; i++) {
    K = unur_sample_discr(gen);
    printf("%d\n",K);
  }

  /* When you do not need the generator object any more, you     */
  /* can destroy it.                                             */
  unur_free(gen);

  exit (EXIT_SUCCESS);

} /* end of main() */

/* ------------------------------------------------------------- */

Function reference

: UNUR_PAR* unur_dext_new (const UNUR_DISTR* distribution)

Get default parameters for new generator.

: int unur_dext_set_init (UNUR_PAR* parameters, int (* init)(UNUR_GEN* gen ))

Set initialization routine for external generator. Inside the

Important: The routine init must return UNUR_SUCCESS when the generator was initialized successfully and UNUR_FAILURE otherwise.

Parameters that are computed in the init routine can be stored in an array or structure that is avaiable by means of the unur_dext_get_params call. Parameters of the underlying distribution object can be obtained by the unur_dext_get_distrparams call.

: int unur_dext_set_sample (UNUR_PAR* parameters, int (* sample)(UNUR_GEN* gen ))

Set sampling routine for external generator.

Important: Use unur_sample_urng(gen) to get a uniform random number. The pointer to the array or structure that contains the parameters that are precomputed in the init routine are available by unur_dext_get_params(gen,0). Additionally one can use the unur_dext_get_distrparams call.

: void* unur_dext_get_params (UNUR_GEN* generator, size_t size)

Get pointer to memory block for storing parameters of external generator. A memory block of size size is automatically (re-) allocated if necessary and the pointer to this block is stored in the generator object. If one only needs the pointer to this memory block set size to 0.

Notice, that size is the size of the memory block and not the length of an array.

Important: This rountine should only be used in the initialization and sampling routine of the external generator.

: double* unur_dext_get_distrparams (UNUR_GEN* generator)
: int unur_dext_get_ndistrparams (UNUR_GEN* generator)

Get size of and pointer to array of parameters of underlying distribution in generator object.

Important: These rountines should only be used in the initialization and sampling routine of the external generator.


5.8.4 DGT – (Discrete) Guide Table method (indexed search)

Required:

probability vector (PV)

Speed:

Set-up: slow (linear with the vector-length), Sampling: very fast

Reinit:

supported

Reference:

[CAa74] [HLD04: Sect.3.1.2]

DGT samples from arbitrary but finite probability vectors. Random numbers are generated by the inversion method, i.e.,

  1. Generate a random number U ~ U(0,1).
  2. Find smallest integer I such that F(I) = P(X<=I) >= U.

Step (2) is the crucial step. Using sequential search requires O(E(X)) comparisons, where E(X) is the expectation of the distribution. Indexed search, however, uses a guide table to jump to some I’ <= I near I to find X in constant time. Indeed the expected number of comparisons is reduced to 2, when the guide table has the same size as the probability vector (this is the default). For larger guide tables this number becomes smaller (but is always larger than 1), for smaller tables it becomes larger. For the limit case of table size 1 the algorithm simply does sequential search (but uses a more expensive setup then method DSS (see DSS – (Discrete) Sequential Search method). On the other hand the setup time for guide table is O(N), where N denotes the length of the probability vector (for size 1 no preprocessing is required). Moreover, for very large guide tables memory effects might even reduce the speed of the algorithm. So we do not recommend to use guide tables that are more than three times larger than the given probability vector. If only a few random numbers have to be generated, (much) smaller table sizes are better. The size of the guide table relative to the length of the given probability vector can be set by a unur_dgt_set_guidefactor call.

There exist two variants for the setup step which can be set by a unur_dgt_set_variant call: Variants 1 and 2. Variant 2 is faster but more sensitive to roundoff errors when the guide table is large. By default variant 2 is used for short probability vectors (N<1000) and variant 1 otherwise.

By default the probability vector is indexed starting at 0. However this can be changed in the distribution object by a unur_distr_discr_set_domain call.

The method also works when no probability vector but a PMF is given. However, then additionally a bounded (not too large) domain must be given or the sum over the PMF. In the latter case the domain of the distribution is trucated (see unur_distr_discr_make_pv for details).

How To Use

Create an object for a discrete distribution either by setting a probability vector or a PMF. The performance can be slightly influenced by setting the size of the used table which can be changed by unur_dgt_set_guidefactor. It is possible to change the parameters and the domain of the chosen distribution and run unur_reinit to reinitialize the generator object.

Function reference

: UNUR_PAR* unur_dgt_new (const UNUR_DISTR* distribution)

Get default parameters for generator.

: int unur_dgt_set_guidefactor (UNUR_PAR* parameters, double factor)

Set size of guide table relative to length of PV. Larger guide tables result in faster generation time but require a more expensive setup. Sizes larger than 3 are not recommended. If the relative size is set to 0, sequential search is used. However, this is not recommended, except in exceptional cases, since method DSS (see DSS – (Discrete) Sequential Search method) is has almost no setup and is thus faster (but requires the sum over the PV as input parameter).

Default is 1.

: int unur_dgt_set_variant (UNUR_PAR* parameters, unsigned variant)

Set variant for setup step. Possible values are 1 or 2. Variant 2 is faster but more sensitive to roundoff errors when the guide table is large. By default variant 2 is used for short probability vectors (N<1000) and variant 1 otherwise.


5.8.5 DSROU – Discrete Simple Ratio-Of-Uniforms method

Required:

T-concave PMF, mode, sum over PMF

Speed:

Set-up: fast, Sampling: slow

Reinit:

supported

Reference:

[LJa01] [HLD04: Sect.10.3.2; Alg.10.6]

DSROU is based on the ratio-of-uniforms method (see The Ratio-of-Uniforms Method) but uses universal inequalities for constructing a (universal) bounding rectangle. It works for all T-concave distributions with T(x) = -1/sqrt(x) .

The method requires the PMF, the (exact) location of the mode and the sum over the given PDF. The rejection constant is 4 for all T-concave distributions. Optionally the CDF at the mode can be given to increase the performance of the algorithm. Then the rejection constant is reduced to 2.

How To Use

The method works for T-concave discrete distributions with given PMF. The sum over of the PMF or an upper bound of this sum must be known.

Optionally the CDF at the mode can be given to increase the performance using unur_dsrou_set_cdfatmode. However, this must not be called if the sum over the PMF is replaced by an upper bound.

It is possible to change the parameters and the domain of the chosen distribution and run unur_reinit to reinitialize the generator object.

If any of mode, CDF at mode, or the sum over the PMF has been changed, then unur_reinit must be executed. (Otherwise the generator produces garbage).

There exists a test mode that verifies whether the conditions for the method are satisfied or not while sampling. It can be switched on or off by calling unur_dsrou_set_verify and unur_dsrou_chg_verify respectively. Notice however that sampling is (a little bit) slower then.

Function reference

: UNUR_PAR* unur_dsrou_new (const UNUR_DISTR* distribution)

Get default parameters for generator.

: int unur_dsrou_set_cdfatmode (UNUR_PAR* parameters, double Fmode)

Set CDF at mode. When set, the performance of the algorithm is increased by factor 2. However, when the parameters of the distribution are changed unur_dsrou_chg_cdfatmode has to be used to update this value. Notice that the algorithm detects a mode at the left boundary of the domain automatically and it is not necessary to use this call for a monotonically decreasing PMF.

Default: not set.

: int unur_dsrou_set_verify (UNUR_PAR* parameters, int verify)
: int unur_dsrou_chg_verify (UNUR_GEN* generator, int verify)

Turn verifying of algorithm while sampling on/off. If the condition squeeze(x) <= PMF(x) <= hat(x) is violated for some x then unur_errno is set to UNUR_ERR_GEN_CONDITION. However notice that this might happen due to round-off errors for a few values of x (less than 1%).

Default is FALSE.

: int unur_dsrou_chg_cdfatmode (UNUR_GEN* generator, double Fmode)

Change CDF at mode of distribution. unur_reinit must be executed before sampling from the generator again.


5.8.6 DSS – (Discrete) Sequential Search method

Required:

probability vector (PV) and sum over PV; or probability mass function(PMF), sum over PV and domain; or or cumulative distribution function (CDF)

Speed:

Set-up: fast, Sampling: very slow (linear in expectation)

Reinit:

supported

Reference:

[HLD04: Sect.3.1.1; Alg.3.1]

DSS samples from arbitrary discrete distributions. Random numbers are generated by the inversion method, i.e.,

  1. Generate a random number U ~ U(0,1).
  2. Find smallest integer I such that F(I) = P(X<=I) >= U.

Step (2) is the crucial step. Using sequential search requires O(E(X)) comparisons, where E(X) is the expectation of the distribution. Thus this method is only recommended when only a few random variates from the given distribution are required. Otherwise, table methods like DGT (see DGT – (Discrete) Guide Table method (indexed search)) or DAU (see DAU – (Discrete) Alias-Urn method) are much faster. These methods also need not the sum over the PMF (or PV) as input. On the other hand, however, these methods always compute a table.

DSS runs with the PV, the PMF, or the CDF of the distribution. It uses actually uses the first one in this list (in this ordering) that could be found.

How To Use

It works with a discrete distribution object with contains at least the PV, the PMF, or the CDF.

It is possible to change the parameters and the domain of the chosen distribution and run unur_reinit to reinitialize the generator object.

Function reference

: UNUR_PAR* unur_dss_new (const UNUR_DISTR* distribution)

Get default parameters for generator.


5.8.7 DSTD – Discrete STandarD distributions

Required:

standard distribution from UNU.RAN library (see Standard distributions) or discrete distribution with inverse CDF.

Speed:

Set-up: fast, Sampling: depends on distribution and generator

Reinit:

supported

DSTD is a wrapper for special generators for discrete univariate standard distributions. It only works for distributions in the UNU.RAN library of standard distributions (see Standard distributions) or for discrete distributions where the inverse CDF is given. If a distribution object is provided that is build from scratch, it must provide the inverse CDF. Then CSTD implements the inversion method. Otherwise, the NULL pointer is returned.

For some distributions more than one special generator is possible.

How To Use

Create a distribution object for a standard distribution from the UNU.RAN library (see Standard distributions), or create a discrete distribution object and set the function for the inverse CDF using unur_distr_discr_set_invcdf. For some distributions more than one special generator (variants) is possible. These can be choosen by a unur_dstd_set_variant call. For possible variants See Standard distributions. However the following are common to all distributions:

UNUR_STDGEN_DEFAULT

the default generator.

UNUR_STDGEN_FAST

the fastest available special generator.

UNUR_STDGEN_INVERSION

the inversion method (if available).

Notice that the variant UNUR_STDGEN_FAST for a special generator might be slower than one of the universal algorithms! Additional variants may exist for particular distributions.

Sampling from truncated distributions (which can be constructed by changing the default domain of a distribution by means of unur_distr_discr_set_domain or unur_dstd_chg_truncated calls) is possible but requires the inversion method. Moreover the CDF of the distribution must be implemented.

It is possible to change the parameters and the domain of the chosen distribution and run unur_reinit to reinitialize the generator object.

Function reference

: UNUR_PAR* unur_dstd_new (const UNUR_DISTR* distribution)

Get default parameters for new generator. It requires a distribution object for a discrete univariant distribution from the UNU.RAN library of standard distributions (see Standard distributions).

Using a truncated distribution is allowed only if the inversion method is available and selected by the unur_dstd_set_variant call immediately after creating the parameter object. Use a unur_distr_discr_set_domain call to get a truncated distribution.

: int unur_dstd_set_variant (UNUR_PAR* parameters, unsigned variant)

Set variant (special generator) for sampling from a given distribution. For possible variants see Standard distributions.

Common variants are UNUR_STDGEN_DEFAULT for the default generator, UNUR_STDGEN_FAST for (one of the) fastest implemented special generators, and UNUR_STDGEN_INVERSION for the inversion method (if available). If the selected variant number is not implemented, then an error code is returned and the variant is not changed.

: int unur_dstd_chg_truncated (UNUR_GEN* generator, int left, int right)

Change left and right border of the domain of the (truncated) distribution. This is only possible if the inversion method is used. Otherwise this call has no effect and an error code is returned.

Notice that the given truncated domain must be a subset of the domain of the given distribution. The generator always uses the intersection of the domain of the distribution and the truncated domain given by this call.

It is not required to run unur_reinit after this call has been used.

Important: If the CDF is (almost) the same for left and right and (almost) equal to 0 or 1, then the truncated domain is not chanced and the call returns an error code.

Notice: If the parameters of the distribution has been changed it is recommended to set the truncated domain again, since the former call might change the domain of the distribution but not update the values for the boundaries of the truncated distribution.


5.9 Methods for random matrices

Overview of methods

Methods for matrix distributions
sample with unur_sample_matr

MCORR: Distribution object for random correlation matrix.


5.9.1 MCORR – Random CORRelation matrix

Required:

Distribution object for random correlation matrix

Speed:

Set-up: fast, Sampling: depends on dimension

Reinit:

supported

Reference:

[DLa86: Sect.6.1; p.605] [MOa84]

MCORR generates a random correlation matrix (Pearson’s correlation). Two methods are used:

  1. When a random correlation matrix having given eigenvalues is sought, the method of Marsaglia and Olkin [MOa84] is used. In this case, the correlation matrix R is given as R=PDP' where D is a diagonal matrix containing the eigenvalues and P is a random orthonormal matrix. In higher dimensions, the rounding-errors introduced in the previous matrix multiplications could lead to a non-symmetric correlation matrix. Therefore the symmetric correlation matrix is computed as R=(PDP'+P'DP)/2 .
  2. A matrix H is generated where all rows are independent random vectors of unit length uniformly on a sphere. Then HH' is a correlation matrix (and vice versa if HH' is a correlation matrix then the rows of H are random vectors on a sphere).

Notice that due to round-off errors the generated matrices might not be positive definite in extremely rare cases (especially when the given eigenvalues are amost 0).

There are many other possibilites (distributions) of sampling the random rows from a sphere. The chosen methods are simple but does not result in a uniform distriubution of the random correlation matrices.

It only works with distribution objects of random correlation matrices (see Random Correlation Matrix).

How To Use

Create a distibution object for random correlation matrices by a unur_distr_correlation call (see Random Correlation Matrix).

When a correlation matrix with given eigenvalues should be generated, these eigenvalues can be set by a unur_mcorr_set_eigenvalues call.

Otherwise, a faster algorithm is used that generates correlation matrices with random eigenstructure.

Notice that due to round-off errors, there is a (small) chance that the resulting matrix is not positive definite for a Cholesky decomposition algorithm, especially when the dimension of the distribution is high.

It is possible to change the given eigenvalues using unur_mcorr_chg_eigenvalues and run unur_reinit to reinitialize the generator object.

Function reference

: UNUR_PAR* unur_mcorr_new (const UNUR_DISTR* distribution)

Get default parameters for generator.

: int unur_mcorr_set_eigenvalues (UNUR_PAR* par, const double* eigenvalues)

Sets the (optional) eigenvalues of the correlation matrix. If set, then the Marsaglia and Olkin algorithm will be used to generate random correlation matrices with given eigenvalues.

Important: the given eigenvalues of the correlation matrix must be strictly positive and sum to the dimension of the matrix. If non-positive eigenvalues are attempted, no eigenvalues are set and an error code is returned. In case, that their sum is different from the dimension, an implicit scaling to give the correct sum is performed.

: int unur_mcorr_chg_eigenvalues (UNUR_GEN* gen, const double* eigenvalues)

Change the eigenvalues of the correlation matrix. One must run unur_reinit to reinitialize the generator object then.


5.10 Methods for uniform univariate distributions


5.10.1 UNIF – wrapper for UNIForm random number generator

UNIF is a simple wrapper that makes it possible to use a uniform random number generator as a UNU.RAN generator. There are no parameters for this method.

How To Use

Create a generator object with NULL as argument. The created generator object returns raw random numbers from the underlying uniform random number generator.

Function reference

: UNUR_PAR* unur_unif_new (const UNUR_DISTR* dummy)

Get default parameters for generator. UNIF does not need a distribution object. dummy is not used and can (should) be set to NULL. It is used to keep the API consistent.


5.11 Meta Methods for univariate distributions

Example

/* ------------------------------------------------------------- */
/* File: example_mixt.c                                          */
/* ------------------------------------------------------------- */

/* Include UNURAN header file.                                   */
#include <unuran.h>

/* ------------------------------------------------------------- */
/* Mixture of a Gaussian and a Cauchy distribution.              */
/* ------------------------------------------------------------- */

int main(void)
{
  /* Declare the three UNURAN objects.                           */
  UNUR_DISTR *distr;   /* distribution object                    */
  UNUR_PAR   *par;     /* parameter object                       */
  UNUR_GEN   *comp[2]; /* array of generator objects (components)*/
  UNUR_GEN   *gen;     /* generator object for mixture           */

  double prob[2];      /* array of probabilities                 */

  int    i;            /* loop variable                          */
  double x;            /* will hold the random number            */

  /* Create generators for components                            */
  distr = unur_distr_normal(NULL,0);   /* Gaussian distribution  */
  par = unur_pinv_new(distr);          /* choose method PINV     */
  comp[0] = unur_init(par);            /* initialize             */
  unur_distr_free(distr);              /* free distribution obj. */

  distr = unur_distr_cauchy(NULL,0);   /* Cauchy distribution    */
  par = unur_tdr_new(distr);           /* choose method TDR      */
  comp[1] = unur_init(par);            /* initialize             */
  unur_distr_free(distr);              /* free distribution obj. */

  /* Probabilities for components (need not sum to 1)            */
  prob[0] = 0.4;    
  prob[1] = 0.3;

  /* Create mixture */
  par = unur_mixt_new(2,prob,comp);

  /* Initialize generator object                                 */
  gen = unur_init(par);

  /* we do not need the components any more */
  for (i=0; i<2; i++)
    unur_free(comp[i]);

  /* It is important to check if the creation of the generator   */
  /* object was successful. Otherwise `gen' is the NULL pointer  */ 
  /* and would cause a segmentation fault if used for sampling.  */
  if (gen == NULL) {
     fprintf(stderr, "ERROR: cannot create generator object\n");
     exit (EXIT_FAILURE);
  }

  /* Now you can use the generator object `gen' to sample from   */
  /* the distribution. Eg.:                                      */
  for (i=0; i<10; i++) {
    x = unur_sample_cont(gen);
    printf("%f\n",x);
  }

  /* When you do not need the generator object any more, you     */
  /* can destroy it.                                             */
  unur_free(gen);

  exit (EXIT_SUCCESS);

} /* end of main() */

/* ------------------------------------------------------------- */

Example (Inversion)

/* ------------------------------------------------------------- */
/* File: example_mixt_inv.c                                      */
/* ------------------------------------------------------------- */

/* Include UNURAN header file.                                   */
#include <unuran.h>

/* ------------------------------------------------------------- */
/* Mixture of truncated Gaussian on (-INFINITY,0] and            */
/* Exponential distribution on [0,INFINITY)                      */
/* ------------------------------------------------------------- */

int main(void)
{
  /* Declare the three UNURAN objects.                           */
  UNUR_DISTR *distr;   /* distribution object                    */
  UNUR_PAR   *par;     /* parameter object                       */
  UNUR_GEN   *comp[2]; /* array of generator objects (components)*/
  UNUR_GEN   *gen;     /* generator object for mixture           */

  double prob[2];      /* array of probabilities                 */

  int    i;            /* loop variable                          */
  double x;            /* will hold the random number            */

  /* Create generators for components                            */
  distr = unur_distr_normal(NULL,0);   /* Gaussian distribution  */
  unur_distr_cont_set_domain(distr,-UNUR_INFINITY,0);
  par = unur_pinv_new(distr);          /* choose method PINV     */
  comp[0] = unur_init(par);            /* initialize             */
  unur_distr_free(distr);              /* free distribution obj. */

  distr = unur_distr_exponential(NULL,0); /* Exponential distr.  */
  par = unur_pinv_new(distr);          /* choose method PINV     */
  comp[1] = unur_init(par);            /* initialize             */
  unur_distr_free(distr);              /* free distribution obj. */

  /* Probabilities for components (need not sum to 1)            */
  prob[0] = 0.4;    
  prob[1] = 0.3;

  /* Create mixture */
  par = unur_mixt_new(2,prob,comp);

  /* We want to use inversion for the mixture as well.           */
  /* (Thus the above order of the components is important!)      */
  unur_mixt_set_useinversion(par,TRUE);

  /* Initialize generator object                                 */
  gen = unur_init(par);

  /* we do not need the components any more */
  for (i=0; i<2; i++)
    unur_free(comp[i]);

  /* It is important to check if the creation of the generator   */
  /* object was successful. Otherwise `gen' is the NULL pointer  */ 
  /* and would cause a segmentation fault if used for sampling.  */
  if (gen == NULL) {
     fprintf(stderr, "ERROR: cannot create generator object\n");
     exit (EXIT_FAILURE);
  }

  /* Now you can use the generator object `gen' to sample from   */
  /* the distribution. Eg.:                                      */
  for (i=0; i<10; i++) {
    x = unur_sample_cont(gen);
    printf("%f\n",x);
  }

  /* When you do not need the generator object any more, you     */
  /* can destroy it.                                             */
  unur_free(gen);

  exit (EXIT_SUCCESS);

} /* end of main() */

/* ------------------------------------------------------------- */

5.11.1 MIXT – MIXTure of distributions

MIXT allows to sample from a mixture of univariate distributions.

Let f_1,...,f_n be PDFs of various distributions called the components and (p_1,...,p_n) be a probability vector. Then f(x) = p_1 * f_1(x) + ...+ p_n * f_n(x) is the PDF of the so called mixture of these distributions.

Method MIXT takes generator objects for the components and a probability vector and creates a generator object for this mixture.

The sampling part works as follows:

  1. Generate an index J as the realisation of a discrete random variate with the given probability vector. This is done by means of method DGT (see Guide Table method).
  2. Generate a random variate X with PDF f_J.

When the (interior of the) domains of the the components are disjoint then it is possible to sample from the mixture by inversion, provided that the following conditions are met:

  • The generator objects must use an inversion method for each component.
  • The domains of the PDFs f_i must not overlap.
  • The components must be ordered with respect to their domains.

How To Use

Create generator objects for the components of the mixture and store the corresponding pointers in an array. Store all probabilities an a double array of the same size. Create the parameter object for the generator of the mixture distribution by means of unur_mixt_new. The components of the mixture can be any continuous or discrete univariate distributions. This also includes generators for empirical distributions and mixtures of distributions. In particular, mixtures can also be defined recursively.

Remark: The components of the mixture can be continuous or discrete distributions. The resulting mixture, however, is always a continuous distribution and thus unur_sample_cont must be used!

The inversion method can be switched on by means of unur_mixt_set_useinversion call. However, the conditions for this method must then be met. Otherwise, initialization of the mixture object fails.

Function reference

: UNUR_PAR* unur_mixt_new (int n, const double* prob, UNUR_GEN** comp)

Get default parameters for the generator for a mixture of the distributions given in the array comp (components) of length n. The probabilities are given by prob.

The generators in comp must be objects for (continuous or discrete) univariate distributions

: int unur_mixt_set_useinversion (UNUR_PAR* parameters, int useinv)

If useinv is TRUE, then the inversion method is used for sampling from the mixture distribution.

However, the following conditions must be satisfied:

  • The generator objects must use an inversion method for each component.
  • The domains of the components must not overlap.
  • The components must be ordered with respect to their domains.

If one of these conditions is violated, then initialization of the mixture object fails.

Default is FALSE.


6 Using uniform random number generators

UNU.RAN is designed to work with many sources of (pseudo-) random numbers or low discrepancy numbers (so called quasi-random numbers) for almost all tasks in discrete event simulation, (quasi-) Monte Carlo integration or any other stochastic methods. Hence UNU.RAN uses pointers to access uniform (pseudo-) random number generators (URNG).

Each UNU.RAN (non-uniform random variate) generator object has a pointer to a URNG object. Thus each UNU.RAN generator object may have its own (independent) URNG or several generator objects can share the same URNG.

If no URNG is provided for a parameter or generator object a default generator is used which is the same for all generators. This URNG is defined in unuran_config.h at compile time and can be changed at runtime.

UNU.RAN uses a unified interface for all sources of random numbers. Unfortunately, the API for random number generators, like the GSL (GNU Scientific Library), Otmar Lendl’s prng (Pseudo random number generators), or a single function implemented by the user herself, are quite different. Hence an object of type UNUR_URNG is introduced to store the URNG. Thus it is possible to handle different sources of such URNGs with the unified API. It is inspired from similar to Pierre L’Ecuyers RngStreams library:

  • seed the random number generator;
  • get a uniform random number;
  • reset the URNG;
  • skip to the begining next substream;
  • sample antithetic numbers;
  • delete the URNG object.

The routine to create a URNG depends on the chosen random number generator (i.e. library). Nevertheless, there exist wrapper functions to simplify this task.

Currently the following sources of uniform random numbers are directly supported (i.e., there exist wrapper functions). Of course other random number generation libraries can be used.

  1. FVOID

    URNGs of type double uniform(void *state). The argument state can be simply ignored in the implementation of uniform when a global state variable is used. UNU.RAN contains some build-in URNGs of this type in directory src/uniform/.

  2. PRNG

    URNGs from Otmar Lendl’s prng library. It provides a very flexible way to sample form arbitrary URNGs by means of an object oriented programing paradigma. Similarly to the UNU.RAN library independent generator objects can be build and used.

    This library has been developed by the pLab group at the university of Salzburg (Austria, EU) and implemented by Otmar Lendl. It is available from http://statmath.wu.ac.at/prng/ or from the pLab site at http://random.mat.sbg.ac.at/.

    This interface must be compiled into UNU.RAN using the configure flag --with-urng-prng.

  3. RNGSTREAM

    Pierre L’Ecuyer’s RngStream library for multiple independent streams of pseudo-random numbers. A GNU-style package is available from http://statmath.wu.ac.at/software/RngStreams/.

    This interface must be compiled into UNU.RAN using the configure flag --with-urng-rngstream.

  4. GSL

    URNG from the GNU Scientific Library (GSL). It is available from http://www.gnu.org/software/gsl/.

    This interface must be compiled into UNU.RAN using the configure flag --with-urng-gsl.

How To Use

Each UNU.RAN generator object has a pointer to a uniform (pseudo-) random number generator (URNG). It can be set via the unur_set_urng call. It is also possible to read this pointer via unur_get_urng or change the URNG for an existing generator object by means of unur_chg_urng. It is important to note that these calls only copy the pointer to the URNG object into the generator object.

If no URNG is provided for a parameter or generator object a default URNG is used which is the same for all generators. This URNG is defined in unuran_config.h at compile time. A pointer to this default URNG can be obtained via unur_get_default_urng. Nevertheless, it is also possible to change this default URNG by another one at runtime by means of the unur_set_default_urng call. However, this only takes effect for new parameter objects.

Some generating methods provide the possibility of correlation induction. For this feature a second auxiliary URNG is required. It can be set and changed by unur_set_urng_aux and unur_chg_urng_aux calls, respectively. Since the auxiliary URNG is by default the same as the main URNG, the auxiliary URNG must be set after any unur_set_urng or unur_chg_urng call! Since in special cases mixing of two URNG might cause problems, we supply a default auxiliary generator that can be used by a unur_use_urng_aux_default call (after the main URNG has been set). This default auxiliary generator can be changed with analogous calls as the (main) default uniform generator.

Uniform random number generators form different sources have different programming interfaces. Thus UNU.RAN stores all information about a particular uniform random number generator in a structure of type UNUR_URNG. Before a URNG can be used with UNU.RAN an appropriate object has to be created ba a unur_urng_new call. This call takes two arguments: the pointer to the sampling routine of the generator and a pointer to a possible argument that stores the state of the generator. The function must be of type double (*sampleunif)(void *params), but functions without any argument also work. Additionally one can set pointers to functions for reseting or jumping the streams generated by the URNG by the corresponding set calls.

UNU.RAN provides a unified API to all sources of random numbers. Notice, however, that not all functions work for all random number generators (as the respective library has not implemented the corresponding feature).

There are wrapper functions for some libraries of uniform random number generators to simplify the task of creating a UNU.RAN object for URNGs. These functions must be compiled into UNU.RAN using the corresponding configure flags (see description of the respective interface below).

Function reference

Set and get default uniform RNGs

: UNUR_URNG* unur_get_default_urng (void)

Get the pointer to the default URNG. The default URNG is used by all generators where no URNG was set explicitly by a unur_set_urng call.

: UNUR_URNG* unur_set_default_urng (UNUR_URNG* urng_new)

Change the default URNG that is used for new parameter objects. It returns the pointer to the old default URNG that has been used.

: UNUR_URNG* unur_set_default_urng_aux (UNUR_URNG* urng_new)
: UNUR_URNG* unur_get_default_urng_aux (void)

Analogous calls for default auxiliary generator.

Set, change and get uniform RNGs in generator objects

: int unur_set_urng (UNUR_PAR* parameters, UNUR_URNG* urng)

Use the URNG urng for the new generator. This overrides the default URNG. It also sets the auxiliary URNG to urng.

Important: For multivariate distributions that use marginal distributions this call does not work properly. It is then better first to create the generator object (by a unur_init call) and then change the URNG by means of unur_chg_urng.

: UNUR_URNG* unur_chg_urng (UNUR_GEN* generator, UNUR_URNG* urng)

Change the URNG for the given generator. It returns the pointer to the old URNG that has been used by the generator. It also changes the auxiliary URNG to urng and thus it overrides the last unur_chg_urng_aux call.

: UNUR_URNG* unur_get_urng (UNUR_GEN* generator)

Get the pointer to the URNG that is used by the generator. This is usefull if two generators should share the same URNG.

: int unur_set_urng_aux (UNUR_PAR* parameters, UNUR_URNG* urng_aux)

Use the auxiliary URNG urng_aux for the new generator. (Default is the default URNG or the URNG from the last unur_set_urng call. Thus if the auxiliary generator should be different to the main URNG, unur_set_urng_aux must be called after unur_set_urng. The auxiliary URNG is used as second stream of uniform random number for correlation induction. It is not possible to set an auxiliary URNG for a method that does not need one. In this case an error code is returned.

: int unur_use_urng_aux_default (UNUR_PAR* parameters)

Use the default auxiliary URNG. (It must be set after unur_get_urng. ) It is not possible to set an auxiliary URNG for a method that does not use one (i.e. the call returns an error code).

: int unur_chgto_urng_aux_default (UNUR_GEN* generator)

Switch to default auxiliary URNG. (It must be set after unur_get_urng. ) It is not possible to set an auxiliary URNG for a method that does not use one (i.e. the call returns an error code).

: UNUR_URNG* unur_chg_urng_aux (UNUR_GEN* generator, UNUR_URNG* urng_aux)

Change the auxiliary URNG for the given generator. It returns the pointer to the old auxiliary URNG that has been used by the generator. It has to be called after each unur_chg_urng when the auxiliary URNG should be different from the main URNG. It is not possible to change the auxiliary URNG for a method that does not use one (i.e. the call NULL).

: UNUR_URNG* unur_get_urng_aux (UNUR_GEN* generator)

Get the pointer to the auxiliary URNG that is used by the generator. This is usefull if two generators should share the same URNG.

Handle uniform RNGs

Notice: Some of the below function calls do not work for every source of random numbers since not every library has implemented these features.

: double unur_urng_sample (UNUR_URNG* urng)

Get a uniform random number from urng. If the NULL pointer is given, the default uniform generator is used.

: double unur_sample_urng (UNUR_GEN* gen)

Get a uniform random number from the underlying uniform random number generator of generator gen. If the NULL pointer is given, the default uniform generator is used.

: int unur_urng_sample_array (UNUR_URNG* urng, double* X, int dim)

Set array X of length dim with uniform random numbers sampled from generator urng. If urng is the NULL pointer, the default uniform generator is used.

Important: If urng is based on a point set generator (this is the case for generators of low discrepance point sets as used in quasi-Monte Carlo methods) it has a “natural dimension” s. In this case either only the first s entries of X are filled (if s < dim), or the first dim coordinates of the generated point are filled.

The called returns the actual number of entries filled. In case of an error 0 is returned.

: int unur_urng_reset (UNUR_URNG* urng)

Reset urng object. The routine tries two ways to reset the generator (in this order):

  1. It uses the reset function given by an unur_urng_set_reset call.
  2. It uses the seed given by the last unur_urng_seed call (which requires a seeding function given by a unur_urng_set_seed call).

If neither of the two methods work resetting of the generator is not possible and an error code is returned.

If the NULL pointer is given, the default uniform generator is reset.

: int unur_urng_sync (UNUR_URNG* urng)

Jump into defined state ("sync") of the generator. This is useful when point generators are used where the coordinates are sampled via unur_urng_sample. Then this call can be used to jump to the first coordinate of the next generated point.

: int unur_urng_seed (UNUR_URNG* urng, unsigned long seed)

Set seed for generator urng. It returns an error code if this is not possible for the given URNG. If the NULL pointer is given, the default uniform generator is seeded (if possible).

Notice: Seeding should be done only once for a particular generator (except for resetting it to the initial state). Expertise is required when multiple seeds are used to get independent streams. Thus we recommend appropriate libraries for this task, e.g. Pierre L’Ecuyer’s RngStreams package. For this library only a package seed can be set and thus the unur_urng_seed call will not have any effect to generators of this type. Use unur_urng_reset or unur_urng_rngstream_new instead, depending whether one wants to reset the stream or get a new stream that is independent from the previous ones.

: int unur_urng_anti (UNUR_URNG* urng, int anti)

Switch to antithetic random numbers in urng. It returns an error code if this is not possible for the given URNG.

If the NULL pointer is given, the antithetic flag of the default uniform generator is switched (if possible).

: int unur_urng_nextsub (UNUR_URNG* urng)

Jump to start of the next substream of urng. It returns an error code if this is not possible for the given URNG.

If the NULL pointer is given, the default uniform generator is set to the start of the next substream (if possible).

: int unur_urng_resetsub (UNUR_URNG* urng)

Jump to start of the current substream of urng. It returns an error code if this is not possible for the given URNG.

If the NULL pointer is given, the default uniform generator is set to the start of the current substream (if possible).

: int unur_gen_sync (UNUR_GEN* generator)
: int unur_gen_seed (UNUR_GEN* generator, unsigned long seed)
: int unur_gen_anti (UNUR_GEN* generator, int anti)
: int unur_gen_reset (UNUR_GEN* generator)
: int unur_gen_nextsub (UNUR_GEN* generator)
: int unur_gen_resetsub (UNUR_GEN* generator)

Analogous to unur_urng_sync unur_urng_seed , unur_urng_anti unur_urng_reset , unur_urng_nextsub and unur_urng_resetsub but act on the URNG object used by the generator object.

Warning: These calls should be used with care as it influences all generator objects that share the same URNG object!

API to create a new URNG object

Notice: These functions are provided to built a UNUR_URNG object for a particular external random number generator from scratch. For some libraries that contain random number generators (like the GSL) there are special calls, e.g. unur_urng_gsl_new to get such an object. Then there is no need to change the UNUR_URNG object as it already contains all available features.

If you have a particular library for random number generators you can either write wrapper function like those in src/uniform/urng_gsl.c or write an email to the authors of UNU.RAN to write it for you.

: UNUR_URNG* unur_urng_new (double (* sampleunif)(void* state ), void* state)

Get a new URNG object. sampleunif is a function to the uniform sampling routine, state a pointer to its arguments which usually contains the state variables of the generator.

Functions sampleunif with a different type for p or without an argument at all also work. A typecast might be necessary to avoid compiler warnings or error messages.

For functions sampleunif that does not have any argument should use NULL for state.

Important: sampleunif must not be the NULL pointer.

There are appropriate calls that simplifies the task of creating URNG objects for some libraries with uniform random number generators, see below.

: void unur_urng_free (UNUR_URNG* urng)

Destroy urng object. It returns an error code if this is not possible.

If the NULL is given, this function does nothing.

Warning: This call must be used with care. The urng object must not be used by any existing generator object! It is designed to work in conjunction with the wrapper functions to create URNG objects for generators of a particular library. Thus an object created by an unur_urng_prng_new call can be simply destroyed by an unur_urng_free call.

: int unur_urng_set_sample_array (UNUR_URNG* urng, unsigned int(* samplearray)(void* state, double* X, int dim ))

Set function to fill array X of length dim with random numbers generated by generator urng (if available).

: int unur_urng_set_sync (UNUR_URNG* urng, void (* sync)(void* state ))

Set function for jumping into a defined state (“sync”).

: int unur_urng_set_seed (UNUR_URNG* urng, void (* setseed)(void* state, unsigned long seed ))

Set function to seed generator urng (if available).

: int unur_urng_set_anti (UNUR_URNG* urng, void (* setanti)(void* state, int anti ))

Set function to switch the antithetic flag of generator urng (if available).

: int unur_urng_set_reset (UNUR_URNG* urng, void (* reset)(void* state ))

Set function for reseting the uniform random number generator urng (if available).

: int unur_urng_set_nextsub (UNUR_URNG* urng, void (* nextsub)(void* state ))

Set function that allows jumping to start of the next substream of urng (if available).

: int unur_urng_set_resetsub (UNUR_URNG* urng, void (* resetsub)(void* state ))

Set function that allows jumping to start of the current substream of urng (if available).

: int unur_urng_set_delete (UNUR_URNG* urng, void (* fpdelete)(void* state ))

Set function for destroying urng (if available).


6.1 Simple interface for uniform random number generators

Simple interface for URNGs of type double uniform(void *state).

UNU.RAN contains some build-in URNGs of this type:

unur_urng_MRG31k3p

Combined multiple recursive generator by Pierre L’Ecuyer and Renee Touzin.

unur_urng_fish

Linear congruential generator by Fishman and Moore.

unur_urng_mstd

Linear congruential generator "Minimal Standard" by Park and Miller.

Notice, however, that these generators are provided as a fallback for the case that no state-of-the-art uniform random number generators (e.g. see Pierre L’Ecuyer’s Rngstream library) are used.

How To Use

Create an URNG object using unur_urng_fvoid_new. By this call a pointer to the sampling routine and (optional) a pointer to a reset routine are copied into the URNG object. Other functions, like seeding the URNG, switching to antithetic random number, or jumping to next substream, can be added to the URNG object by the respective calls, e.g. by unur_urng_set_seed. The following routines are supported for URNG objects of this type:

Function reference

: UNUR_URNG* unur_urng_fvoid_new (double (* urand)(void* state ), void (* reset)(void* state ))

Make a URNG object for a generator that consists of a single function call urand.

If there is no reset function use NULL for the second argument.


6.2 Interface to GSL uniform random number generators

Interface to the uniform random number generators from the GNU Scientific Library (GSL). Documentation and source code of this library is available from http://www.gnu.org/software/gsl/.

The interface to the GSL must be compiled into UNU.RAN using the configure flag --with-urng-gsl. Notice that the GSL has to be installed before running ./configure.

How To Use

When using this interface unuran_urng_gsl.h must be included in the corresponding C file, i.e., one must add the line

#include <unuran_urng_gsl.h>

Moreover, one must not forget to link the executable against libgsl.

The following routines are supported for URNG objects of type GSL:

/* ------------------------------------------------------------- */
/* File: example_gsl.c                                           */
/* ------------------------------------------------------------- */
#ifdef UNURAN_SUPPORTS_GSL
/* ------------------------------------------------------------- */
/* This example makes use of the GSL library for generating      */
/* uniform random numbers.                                       */
/* (see http://www.gnu.org/software/gsl/)                        */
/* To compile this example you must have set                     */
/*   ./configure --with-urng-gsl                                 */
/* (Of course the executable has to be linked against the        */
/* GSL library.)                                                 */
/* ------------------------------------------------------------- */

/* Include UNURAN header files.                                  */
#include <unuran.h>
#include <unuran_urng_gsl.h>

/* ------------------------------------------------------------- */

int main(void)
{
  int    i;          /* loop variable                            */
  double x;          /* will hold the random number              */

  /* Declare the three UNURAN objects.                           */
  UNUR_DISTR *distr;    /* distribution object                   */
  UNUR_PAR   *par;      /* parameter object                      */
  UNUR_GEN   *gen;      /* generator object                      */

  /* Declare objects for uniform random number generators.       */
  UNUR_URNG  *urng;     /* uniform generator objects             */

  /* GNU Scientific Library only:                                */
  /* Make a object for uniform random number generator.          */
  urng = unur_urng_gsl_new(gsl_rng_mt19937);
  if (urng == NULL) exit (EXIT_FAILURE);

  /* Create a generator object using this URNG */
  distr = unur_distr_normal( NULL, 0 );
  par = unur_tdr_new(distr);
  unur_set_urng( par, urng );
  gen = unur_init(par);
  if (gen == NULL)  exit (EXIT_FAILURE);
  unur_distr_free(distr);

  /* Now you can use the generator object `gen' to sample from   */
  /* the distribution. Eg.:                                      */
  for (i=0; i<10; i++) {
    x = unur_sample_cont(gen);
    printf("%f\n",x);
  }

  /* Destroy objects */
  unur_free(gen);
  unur_urng_free(urng);

  exit (EXIT_SUCCESS);
} /* end of main() */

/* ------------------------------------------------------------- */
#else
#include <stdio.h>
#include <stdlib.h>
int main(void) {
  printf("You must enable the GSL to run this example!\n\n");
  exit (77);    /* exit code for automake check routines */
}
#endif
/* ------------------------------------------------------------- */

Function reference

: UNUR_URNG* unur_urng_gsl_new (const gsl_rng_type* urngtype)

Make object for URNGs from the GSL (GNU Scientific Library). urngtype is the type of the chosen generator as described in the GSL manual (see Section Random Number Generation). This library is available from http://www.gnu.org/software/gsl/.

: UNUR_URNG* unur_urng_gslptr_new (gsl_rng* urng)

Similar to unur_urng_gsl_new but it uses a pointer to a generator object as returned by gsl_rng_alloc(rng_type); see GSL manual for details.

Notice: There is a subtle but important difference between these two calls. When a generator object is created by a unur_urng_gsl_new call, then resetting of the generator works. When a generator object is created by a unur_urng_gslptr_new call, then resetting only works after a unur_urng_seed(urng,myseed) call.


6.3 Interface to GSL generators for quasi-random points

Interface to the generators for quasi-random points (also called low discrepancy point sets) from the GNU Scientific Library (GSL). Documentation and source code of this library is available from http://www.gnu.org/software/gsl/.

The interface to the GSL must be compiled into UNU.RAN using the configure flag --with-urng-gsl. Notice that the GSL has to be installed before running ./configure.

How To Use

When using this interface unuran_urng_gsl.h must be included in the corresponding C file, i.e., one must add the line

#include <unuran_urng_gsl.h>

Moreover, one must not forget to link the executable against libgsl.

The following routines are supported for URNG objects of this type:

unur_urng_sync is used to jump to the first coordinate of the next point generated by the generator.

Function reference

: UNUR_URNG* unur_urng_gslqrng_new (const gsl_qrng_type* qrngtype, unsigned int dim)

Make object for quasi-random point generators for dimension dim from the GSL (GNU Scientific Library). qrngtype is the type of the chosen generator as described in the GSL manual (see section Quasi-Random Sequences). This library is available from http://www.gnu.org/software/gsl/.


6.4 Interface to Otmar Lendl’s pseudo-random number generators

URNGs from Otmar Lendl’s prng library. It provides a very flexible way to sample form arbitrary URNGs by means of an object oriented programing paradigma. Similarly to the UNU.RAN library independent generator objects can be build and used.

This library has been developed by the pLab group at the university of Salzburg (Austria, EU) and implemented by Otmar Lendl. It is available from http://statmath.wu.ac.at/prng/ or from the pLab site at http://random.mat.sbg.ac.at/.

The interface to the PRNG library must be compiled into UNU.RAN using the configure flag --with-urng-prng. Notice that the PRNG library has to be installed before running ./configure.

How To Use

When using this interface unuran_urng_prng.h must be included in the corresponding C file, i.e., one must add the line

#include <unuran_urng_prng.h>

Moreover, one must not forget to link the executable against libprng.

The following routines are supported for URNG objects of type PRNG:

Function reference

: UNUR_URNG* unur_urng_prng_new (const char* prngstr)

Make object for URNGs from Otmar Lendl’s prng package. prngstr is a string that contains the necessary information to create a uniform random number generator. For the format of this string see the prng user manual.

The prng library provides a very flexible way to sample form arbitrary URNGs by means of an object oriented programing paradigma. Similarly to the UNU.RAN library independent generator objects can be build and used. The library has been developed and implemented by Otmar Lendl as member of the pLab group at the university of Salzburg (Austria, EU).

It is available via anonymous ftp from http://statmath.wu.ac.at/prng/ or from the pLab site at http://random.mat.sbg.ac.at/.

: UNUR_URNG* unur_urng_prngptr_new (struct prng* urng)

Similar to unur_urng_prng_new but it uses a pointer to a generator object as returned by prng_new(prngstr); see prng manual for details.


6.5 Interface to L’Ecuyer’s RNGSTREAM random number generators

URNGs from Pierre L’Ecuyer’s RngStream library for multiple independent streams of pseudo-random numbers. This library provides multiple independent streams of pseudo-random numbers which itselves can be splitted into many substreams. It is available from http://www.iro.umontreal.ca/~lecuyer/myftp/streams00/c/. A GNU-style package is available from http://statmath.wu.ac.at/software/RngStreams/.

The interface to the RngStream library must be compiled into UNU.RAN using the configure flag --with-urng-rngstream. Notice that the RngStream library has to be installed before running ./configure.

How To Use

When using this interface unuran_urng_rngstream.h must be included in the corresponding C file, i.e., one must add the line

#include <unuran_urng_rngstream.h>

Moreover, one must not forget to link the executable against the RngStream library (i.e., when using the GNU-style package in UNIX like environments one has to add -lrngstreams when linking an executable).

Notice that the rngstream library uses a package seed, that means one should seed the uniform random number generator only once in an application using the routine RngStream_SetPackageSeed:

unsigned long seed[] = {111u, 222u, 333u, 444u, 555u, 666u};
RngStream_SetPackageSeed(seed);

The following routines are supported for URNG objects of this type:

Function reference

: UNUR_URNG* unur_urng_rngstream_new (const char* urngstr)

Make object for URNGs from Pierre L’Ecuyer’s RngStream library. urngstr is an arbitrary string to label a stream. It need not be unique.

: UNUR_URNG* unur_urng_rngstreamptr_new (RngStream rngstream)

Similar to unur_urng_rngstream_new but it uses a pointer to a generator object as returned by RngStream_CreateStream().


6.6 Combine point set generator with random shifts

Generators of type RANDOMSHIFT combine a point set generator with generators to apply random shifts as proposed in [CPa76] :

  1. Sample and store a random vector S.
  2. Run a QMC simulation where S is added to each point of the generated quasi-random point (mod 1).
  3. Repeat steps 1 and 2.

How To Use

Create a URNG object for a point set generator and a URNG object for a generator to create shift vectors at random. The meta URNG object can then be created using unur_urng_randomshift_new. Notice that only pointers to the two underlying URNG generator objects are copied into the newly created meta generator. Thus manipulating the meta URNG also changes the underlying URNGs and vice versa.

The following routines are supported for URNG objects of type RANDOMSHIFT:

unur_urng_sync is used to jump to the first coordinate of the next point generated by the generator. unur_urng_randomshift_nextshift allows to replace the shift vector by another randomly chosen shift vector.

Important: unur_urng_sync is only available if it is if it is implemented for the underlying point set generator.

Important: unur_urng_reset is only available if it is available for both underlying generators.

Function reference

: UNUR_URNG* unur_urng_randomshift_new (UNUR_URNG* qrng, UNUR_URNG* srng, int dim)

Make object for URNG with randomly shifted point sets. qrng is a generated that generates point sets of dimension dim. srng is a generated that generates random numbers or vectors.

Notice: Only pointers to the respective objects qrng and srng are copied into the created meta generator. Thus manipulating the meta URNG also changes the underlying URNGs and vice versa.

: int unur_urng_randomshift_nextshift (UNUR_URNG* urng)

Get the next (randomly chosen) vector for shifting the points set, and the underlying point generator qrng is reset.


7 UNU.RAN Library of standard distributions

Although it is not its primary target, many distributions are already implemented in UNU.RAN. This section presents these available distributions and their parameters.

The syntax to get a distribuion object for distributions <dname> is:

–: UNUR_DISTR* unur_distr_<dname> (double* params, int n_params)

params is an array of doubles of size n_params holding the parameters.

E.g. to get an object for the gamma distribution (with shape parameter) use

unur_distr_gamma( params, 1 );

Distributions may have default parameters with need not be given explicitely. E.g. The gamma distribution has three parameters: the shape, scale and location parameter. Only the (first) shape parameter is required. The others can be omitted and are then set by default values.

/* alpha = 5; default: beta = 1, gamma = 0 */
double fpar[] = {5.};
unur_distr_gamma( fpar, 1 );

/* alpha = 5, beta = 3; default: gamma = 0 */
double fpar[] = {5., 3.};
unur_distr_gamma( fpar, 2 );

/* alpha = 5, beta = 3, gamma = -2
double fpar[] = {5., 3., -2.};
unur_distr_gamma( fpar, 3 );

Important: Naturally the computational accuracy limits the possible parameters. There shouldn’t be problems when the parameters of a distribution are in a “reasonable” range but e.g. the normal distribution N(10^15,1) won’t yield the desired results. (In this case it would be better generating N(0,1) and then transform the results.)
Of course computational inaccuracy is not specific to UNU.RAN and should always be kept in mind when working with computers.

Important: The routines of the standard library are included for non-uniform random variate generation and not to provide special functions for statistical computations.

Remark

The following keywords are used in the tables:

PDF

probability density function, with variable x.

PMF

probability mass function, with variable k.

constant

normalization constant for given PDF and PMF, resp. They must be multiplied by constant to get the “real” PDF and PMF.

CDF

gives information whether the CDF is implemented in UNU.RAN.

domain

domain PDF and PMF, resp.

parameters n_std (n_total): list

list of parameters for distribution, where n_std is the number of parameters for the standard form of the distribution and n_total the total number for the (non-standard form of the) distribution. list is the list of parameters in the order as they are stored in the array of parameters. Optional parameter that can be omitted are enclosed in square brackets […].

A detailed list of these parameters gives then the range of valid parameters and defaults for optional parameters that are used when these are omitted.

reference

gives reference for distribution (see Bibliography).

special generators

lists available special generators for the distribution. The first number is the variant that to be set by unur_cstd_set_variant and unur_dstd_set_variant call, respectively. If no variant is set the default variant DEF is used. In the table the respective abbreviations DEF and INV are used for UNUR_STDGEN_DEFAULT and UNUR_STDGEN_INVERSION. Also the references for these methods are given (see Bibliography).

Notice that these generators might be slower than universal methods.

If DEF is ommited, the first entry is the default generator.


7.1 UNU.RAN Library of continuous univariate distributions


7.1.1 F – F-distribution

PDF:

(x^(nu_1/2-1)) / (1+nu_1/nu_2 x)^((nu_1+nu_2)/2)

constant:

(nu_1/nu_2)^(nu_1/2) / B(nu_1/2,nu_2/2)

domain:

0 < x < infinity

parameters 2 (2): nu_1, nu_2
No.namedefault
[0]nu_1> 0(scale)
[1]nu_2> 0(scale)
reference:

[JKBc95: Ch.27; p.322]


7.1.2 beta – Beta distribution

PDF:

(x-a)^(p-1) * (b-x)^(q-1)

constant:

1 / (B(p,q) * (b-a)^(p+q-1))

domain:

a < x < b

parameters 2 (4): p, q [, a, b ]
No.namedefault
[0]p> 0(scale)
[1]q> 0(scale)
[2]a0(location, scale)
[3]b> a1(location, scale)
reference:

[JKBc95: Ch.25; p.210]


7.1.3 cauchy – Cauchy distribution

PDF:

1/(1 + ((x-theta)/lambda)^2)

constant:

1/(pi * lambda)

domain:

-infinity < x < infinity

parameters 0 (2): [ theta [, lambda ] ]
No.namedefault
[0]theta0(location)
[1]lambda> 01(scale)
reference:

[JKBb94: Ch.16; p.299]

special generators:
INV

Inversion method


7.1.4 chi – Chi distribution

PDF:

x^(nu-1) * exp( -x^2/2 )

constant:

1 / (2^((nu/2)-1) * Gamma(nu/2))

domain:

0 <= x < infinity

parameters 1 (1): nu
No.namedefault
[0]nu> 0(shape)
reference:

[JKBb94: Ch.18; p.417]

special generators:
DEF

Ratio of Uniforms with shift (only for nu >= 1) [MJa87]


7.1.5 chisquare – Chisquare distribution

PDF:

x^((nu/2)-1) * exp( -x/2 )

constant:

1 / (2^(nu/2) * Gamma(nu/2))

domain:

0 <= x < infinity

parameters 1 (1): nu
No.namedefault
[0]nu> 0(shape (degrees of freedom))
reference:

[JKBb94: Ch.18; p.416]


7.1.6 exponential – Exponential distribution

PDF:

exp( -(x-theta)/sigma)

constant:

1/sigma

domain:

theta <= x < infinity

parameters 0 (2): [ sigma [, theta ] ]
No.namedefault
[0]sigma> 01(scale)
[1]theta0(location)
reference:

[JKBb94: Ch.19; p.494]

special generators:
INV

Inversion method


7.1.7 extremeI – Extreme value type I (Gumbel-type) distribution

PDF:

exp( -exp( -(x-zeta)/theta ) - (x-zeta)/theta )

constant:

1/theta

domain:

-infinity < x <infinity

parameters 0 (2): [ zeta [, theta ] ]
No.namedefault
[0]zeta0(location)
[1]theta> 01(scale)
reference:

[JKBc95: Ch.22; p.2]

special generators:
INV

Inversion method


7.1.8 extremeII – Extreme value type II (Frechet-type) distribution

PDF:

exp( -((x-zeta)/theta)^(-k)) * ((x-zeta)/theta)^(-k-1)

constant:

k/theta

domain:

zeta < x <infinity

parameters 1 (3): k [, zeta [, theta ] ]
No.namedefault
[0]k> 0(shape)
[1]zeta0(location)
[2]theta> 01(scale)
reference:

[JKBc95: Ch.22; p.2]

special generators:
INV

Inversion method


7.1.9 gamma – Gamma distribution

PDF:

((x-gamma)/beta)^(alpha-1) * exp( -(x-gamma)/beta )

constant:

1 / (beta * Gamma(alpha))

domain:

gamma < x < infinity

parameters 1 (3): alpha [, beta [, gamma ] ]
No.namedefault
[0]alpha> 0(shape)
[1]beta> 01(scale)
[2]gamma0(location)
reference:

[JKBb94: Ch.17; p.337]

special generators:
DEF

Acceptance Rejection combined with Acceptance Complement [ADa74] [ADa82]

2

Rejection from log-logistic envelopes [CHa77]


7.1.10 gig – Generalized Inverse Gaussian distribution

PDF:

x^(theta-1) * exp( -1/2 * omega * (x/eta + eta/x))

constant:

not implemented!

CDF:

not implemented!

domain:

0 < x <infinity

parameters 2 (3): theta, omega [, eta ]
No.namedefault
[0]theta(shape)
[1]omega> 0(scale)
[2]eta> 01(shape)
reference:

[JKBb94: Ch.15; p.84]

special generators:
DEF

Ratio-of-Uniforms method [Dag89]


7.1.11 gig2 – Generalized Inverse Gaussian distribution

PDF:

x^(theta-1) * exp( -1/2 * (chi/x + psi*x))

constant:

not implemented!

CDF:

not implemented!

domain:

0 < x <infinity

parameters 3 (3): theta, psi, chi
No.namedefault
[0]theta(shape)
[1]psi> 0(shape)
[2]chi> 0(shape)
reference:

[JKBb94: Ch.15; p.84]


7.1.12 hyperbolic – Hyperbolic distribution

PDF:

exp( -alpha * sqrt(delta^2 + (x - mu)^2) + beta*(x-mu) )

constant:

not implemented!

CDF:

not implemented!

domain:

-infinity < x <infinity

parameters 4 (4): alpha, beta, delta, mu
No.namedefault
[0]alpha>|beta|(shape (tail))
[1]beta(shape (asymmetry))
[2]delta> 0(scale)
[3]mu(location)

7.1.13 ig – Inverse Gaussian distribution

PDF:

sqrt( lambda/2*pi*x^3 ) * exp( -(lambda*(x-mu)^2)/2*mu^2*x )

constant:

1

CDF:

not implemented!

domain:

0 < x <infinity

parameters 2 (2): mu, lambda
No.namedefault
[0]mu> 0(mean)
[1]lambda> 0(shape)
reference:

[JKBb94: Ch.15; p.259]


7.1.14 laplace – Laplace distribution

PDF:

exp( -|x-theta| / phi )

constant:

1/(2 * phi)

domain:

-infinity < x <infinity

parameters 0 (2): [ theta [, phi ] ]
No.namedefault
[0]theta0(location)
[1]phi> 01(scale)
reference:

[JKBc95: Ch.24; p.164]

special generators:
INV

Inversion method


7.1.15 logistic – Logistic distribution

PDF:

exp(-(x-alpha)/beta) * (1 + exp(-(x-alpha)/beta))^(-2)

constant:

1/beta

domain:

-infinity < x <infinity

parameters 0 (2): [ alpha [, beta ] ]
No.namedefault
[0]alpha0(location)
[1]beta> 01(scale)
reference:

[JKBc95: Ch.23; p.115]

special generators:
INV

Inversion method


7.1.16 lognormal – Log-Normal distribution

PDF:

1/(x-theta) * exp( -(log(x-theta)-zeta)^2/(2 sigma^2) )

constant:

1/(sigma * sqrt(2 pi))

domain:

theta <= x < infinity

parameters 2 (3): zeta, sigma [, theta ]
No.namedefault
[0]zeta(shape)
[1]sigma> 0(shape)
[2]theta0(location)
reference:

[JKBb94: Ch.14; p. 208]


7.1.17 lomax – Lomax distribution (Pareto distribution of second kind)

PDF:

(x+C)^(-(a+1))

constant:

a * C^a

domain:

0 <= x < infinity

parameters 1 (2): a [, C ]
No.namedefault
[0]a> 0(shape)
[1]C> 01(scale)
reference:

[JKBb94: Ch.20; p.575]

special generators:
INV

Inversion method


7.1.18 normal – Normal distribution

PDF:

exp( -1/2 * ((x-mu)/sigma)^2 )

constant:

1 / (sigma * sqrt(2 pi))

domain:

-infinity < x < infinity

parameters 0 (2): [ mu [, sigma ] ]
No.namedefault
[0]mu0(location)
[1]sigma> 01(scale)
reference:

[JKBb94: Ch.13; p.80]

special generators:
DEF

ACR method (Acceptance-Complement Ratio) [HDa90]

1

Box-Muller method [BMa58]

2

Polar method with rejection [MGa62]

3

Kindermann-Ramage method [KRa76]

INV

Inversion method (slow)


7.1.19 pareto – Pareto distribution (of first kind)

PDF:

x^(-(a+1))

constant:

a * k^a

domain:

k < x < infinity

parameters 2 (2): k, a
No.namedefault
[0]k> 0(shape, location)
[1]a> 0(shape)
reference:

[JKBb94: Ch.20; p.574]

special generators:
INV

Inversion method


7.1.20 powerexponential – Powerexponential (Subbotin) distribution

PDF:

exp( -|x|^tau )

constant:

1 / (2 * Gamma(1+1/tau))

domain:

-infinity < x < infinity

parameters 1 (1): tau
No.namedefault
[0]tau> 0(shape)
reference:

[JKBc95: Ch.24; p.195]

special generators:
DEF

Transformed density rejection (only for tau >= 1) [DLa86]


7.1.21 rayleigh – Rayleigh distribution

PDF:

x * exp( -1/2 * (x/sigma)^2 )

constant:

1 / sigma^2

domain:

0 <= x < infinity

parameters 1 (1): sigma
No.namedefault
[0]sigma> 0(scale)
reference:

[JKBb94: Ch.18; p.456]


7.1.22 slash – Slash distribution

PDF:

(1 - exp(-x^2/2)) / x^2

constant:

1 / sqrt(2 pi)

CDF:

not implemented!

domain:

-infinity < x < infinity

reference:

[JKBb94: Ch.12; p.63]

special generators:
DEF

Ratio of normal and uniform random variates


7.1.23 student – Student’s t distribution

PDF:

(1+t^2/nu)^(-(nu+1)/2)

constant:

1 / (sqrt(nu) * B(1/2,nu/2))

CDF:

not implemented!

domain:

-infinity < x < infinity

parameters 1 (1): nu
No.namedefault
[0]nu> 0(shape)
reference:

[JKBc95: Ch.28; p.362]


7.1.24 triangular – Triangular distribution

PDF:

2*x / H, for 0 <= x <= H

2*(1-x) / (1-H), for H <= x <= 1

constant:

1

domain:

0 <= x <= 1

parameters 0 (1): [ H ]
No.namedefault
[0]H0 <= H <= 11/2(shape)
reference:

[JKBc95: Ch.26; p.297]

special generators:
INV

Inversion method


7.1.25 uniform – Uniform distribution

PDF:

1 / (b-a)

constant:

1

domain:

a < x < b

parameters 0 (2): [ a, b ]
No.namedefault
[0]a0(location)
[1]b> a1(location)
reference:

[JKBc95: Ch.26; p.276]

special generators:
INV

Inversion method


7.1.26 weibull – Weibull distribution

PDF:

((x-zeta)/alpha)^(c-1) * exp( -((x-zeta)/alpha)^c )

constant:

c / alpha

domain:

zeta < x < infinity

parameters 1 (3): c [, alpha [, zeta ] ]
No.namedefault
[0]c> 0(shape)
[1]alpha> 01(scale)
[2]zeta0(location)
reference:

[JKBb94: Ch.21; p.628]

special generators:
INV

Inversion method


7.2 UNU.RAN Library of continuous multivariate distributions


7.2.1 copula – Copula (distribution with uniform marginals)

UNUR_DISTR *unur_distr_copula(int dim, const double *rankcorr) creates a distribution object for a copula with dim components. rankcorr is an array of size dimxdim and holds the rank correlation matrix (Spearman’s correlation), where the rows of the matrix are stored consecutively in this array. The NULL pointer can be used instead the identity matrix.

If covar is not a valid rank correlation matrix (i.e., not positive definite) then no distribution object is created and NULL is returned.


7.2.2 multicauchy – Multicauchy distribution

PDF:

f(x) = 1 / ( 1 + (x-mu)^t . Sigma^(-1) . (x-mu) )^((dim+1)/2)

constant:

Gamma((dim+1)/2) / ( pi^((dim+1)/2) * sqrt(det(Sigma)) )

domain:

-infinity^(dim) < x < infinity^(dim)

parameters 0 (2): [ mu, Sigma ]
No.namedefault
[0]mu(0,…,0)(location)
[1]SigmaSymm, Pos. def.I(shape)
special generators:
DEF

Cholesky factor


7.2.3 multiexponential – Multiexponential distribution

PDF:

f(x) = Prod_(i=0)^(i=dim-1) exp(-(dim-i) (x_(i)-x_(i-1) - (theta_i-theta_(i-1)) ) / sigma_i); with x_(-1)=0 and theta_(i-1)=0

constant:

Prod_(i=0)^(i=dim-1) 1/sigma_i

domain:

0^(dim) <= x < infinity^(dim)

parameters 0 (2): [ sigma, theta ]
No.namedefault
[0]sigma(1,…,1)(shape)
[1]theta(0,…,0)(location)

7.2.4 multinormal – Multinormal distribution

PDF:

f(x) = exp( -1/2 * (x-mu)^t . Sigma^(-1) . (x-mu) )

constant:

1 / ( (2 pi)^(dim/2) * sqrt(det(Sigma)) )

domain:

-infinity^(dim) < x < infinity^(dim)

parameters 0 (2): [ mu, Sigma ]
No.namedefault
[0]mu(0,…,0)(location)
[1]SigmaSymm, Pos. def.I(shape)
reference:

[KBJe00: Ch.45; p.105]


7.2.5 multistudent – Multistudent distribution

PDF:

f(x) = 1 / ( 1 + (x-mu)^t . Sigma^(-1) . (x-mu) / m)^((dim+m)/2) )

constant:

Gamma((dim+m)/2) / ( Gamma(m/2) (m*pi)^(dim/2) * sqrt(det(Sigma)) )

domain:

-infinity^(dim) < x < infinity^(dim)

parameters 0 (3): [ m, mu, Sigma ]
No.namedefault
[0]mm>01(location)
[1]mu(0,…,0)(location)
[2]SigmaSymm, Pos. def.I(shape)

7.3 UNU.RAN Library of discrete univariate distributions

At the moment there are no CDFs implemented for discrete distribution. Thus unur_distr_discr_upd_pmfsum does not work properly for truncated distribution.


7.3.1 binomial – Binomial distribution

PMF:

(n \choose k) * p^k * (1-p)^(n-k)

constant:

1

domain:

0 <= k <= n

parameters 2 (2): n, p
No.namedefault
[0]n>= 1(no. of elements)
[1]p0 < p < 1(shape)
reference:

[JKKa92: Ch.3; p.105]

special generators:
DEF

Ratio of Uniforms/Inversion [STa89]


7.3.2 geometric – Geometric distribution

PMF:

p * (1-p)^k

constant:

1

domain:

0 <= k < infinity

parameters 1 (1): p
No.namedefault
[0]p0 < p < 1(shape)
reference:

[JKKa92: Ch.5.2; p.201]

special generators:
INV

Inversion method


7.3.3 hypergeometric – Hypergeometric distribution

PMF:

(M \choose k) * (N-M \choose n-k) / (N \choose n)

constant:

1

domain:

max(0,n-N+M) <= k <= min(n,M)

parameters 3 (3): N, M, n
No.namedefault
[0]N>= 1(no. of elements)
[1]M1 <= M <= N(shape)
[2]n1 <= n <= N(shape)
reference:

[JKKa92: Ch.6; p.237]

special generators:
DEF

Ratio of Uniforms/Inversion [STa89]


7.3.4 logarithmic – Logarithmic distribution

PMF:

theta^k / k

constant:

- log( 1.-theta);

domain:

1 <= k < infinity

parameters 1 (1): theta
No.namedefault
[0]theta0 < theta < 1(shape)
reference:

[JKKa92: Ch.7; p.285]

special generators:
DEF

Inversion/Transformation [KAa81]


7.3.5 negativebinomial – Negative Binomial distribution

PMF:

(k+r-1 \choose r-1) * p^r * (1-p)^k

constant:

1

domain:

0 <= k < infinity

parameters 2 (2): p, r
No.namedefault
[0]p0 < p < 1(shape)
[1]r> 0(shape)
reference:

[JKKa92: Ch.5.1; p.200]


7.3.6 poisson – Poisson distribution

PMF:

theta^k / k!

constant:

exp(theta)

domain:

0 <= k < infinity

parameters 1 (1): theta
No.namedefault
[0]theta> 0(shape)
reference:

[JKKa92: Ch.4; p.151]

special generators:
DEF

Tabulated Inversion combined with Acceptance Complement [ADb82]

2

Tabulated Inversion combined with Patchwork Rejection [ZHa94]


7.4 UNU.RAN Library of random matrices


7.4.1 correlation – Random correlation matrix

UNUR_DISTR *unur_distr_correlation( int n ) creates a distribution object for a random correlation matrix of n rows and columns. It can be used with method MCORR (see Random Correlation Matrix) to generate random correlation matrices of the given size.


8 Error handling and Debugging

UNU.RAN routines report an error whenever they cannot perform the requested task. Additionally it is possible to get information about the generated distribution of generator objects for debugging purposes. However, the latter must be enabled when compiling and installing the library. (It is disabled by default.) This chapter describes all necessary details:

  • Choose an output stream to for writing the requested information.
  • Select a debugging level.
  • Select an error handler.
  • Write your own error handler.
  • Get more information for a particular error code.

8.1 Output streams

UNU.RAN uses a logfile for writing all error messages, warnings, and debugging information onto an output stream. This stream can be set at runtime by the unur_set_stream call. If no such stream is given by the user a default stream is used by the library: all messages are written into the file unuran.log in the current working directory. The name of this logfile is defined by the macro UNUR_LOG_FILE in unuran_config.h. (If UNU.RAN fails to open this file for writing, stderr is used instead.)

To destinguish between messages for different objects each of these has its own identifier which is composed by the name of the distribution obejct and generator type, resp., followed by a dot and three digits. (If there are more than 999 generators then the identifiers are not unique.)

Remark: Writting debugging information must be switched on at compile time using the configure flag --enable-logging, see Debugging.

Function reference

: FILE* unur_set_stream (FILE* new_stream)

This function sets a new file handler for the output stream, new_stream, for the UNU.RAN library routines. The previous handler is returned (so that you can restore it later). Note that the pointer to a user defined file handler is stored in a static variable, so there can be only one output stream handler per program. This function should be not be used in multi-threaded programs except to set up a program-wide error handler from a master thread.

The NULL pointer is not allowed. (If you want to disable logging of debugging information use unur_set_default_debug(UNUR_DEBUG_OFF) instead. If you want to disable error messages at all use unur_set_error_handler_off. )

: FILE* unur_get_stream (void)

Get the file handle for the current output stream. It can be used to allow applications to write additional information into the logfile.


8.2 Debugging

The UNU.RAN library has several debugging levels which can be switched on/off by debugging flags. This debugging feature must be enabled when building the library using the --enable-logging configure flag.

The debugging levels range from print a short description of the created generator object to a detailed description of hat functions and tracing the sampling routines. The output is printed onto the debugging output stream (see Output streams).

The debugging flags can be set or changed by the respective calls unur_set_debug and unur_chg_debug independently for each generator.

By default flag UNUR_DEBUG_INIT (see below) is used. This default flags is set by the macro UNUR_DEBUGFLAG_DEFAULT in unuran_config.h and can be changed at runtime by a unur_set_default_debug call.

Off course these debugging flags depend on the chosen method. Since most of these are merely for debugging the library itself, a description of the flags are given in the corresponding source files of the method. Nevertheless, the following flags can be used with all methods.

Common debug flags:

UNUR_DEBUG_OFF

switch off all debuging information

UNUR_DEBUG_ALL

all avaivable information

UNUR_DEBUG_INIT

parameters of generator object after initialization

UNUR_DEBUG_SETUP

data created at setup

UNUR_DEBUG_ADAPT

data created during adaptive steps

UNUR_DEBUG_SAMPLE

trace sampling

Notice that these are flags which could be combined using the | operator.

Almost all routines check a given pointer before they read from or write to the given address. This does not hold for time-critical routines like all sampling routines. Thus you are responsible for checking a pointer that is returned from a unur_init call. However, it is possible to turn on checking for invalid NULL pointers even in such time-critical routines by building the library using the --enable-check-struct configure flag.

Another debugging tool used in the library are magic cookies that validate a given pointer. It produces an error whenever a given pointer points to an object that is invalid in the context. The usage of magic cookies is also switched on by the --enable-check-struct configure flag.

Function reference

: int unur_set_debug (UNUR_PAR* parameters, unsigned debug)

Set debugging flags for generator.

: int unur_chg_debug (UNUR_GEN* generator, unsigned debug)

Change debugging flags for generator.

: int unur_set_default_debug (unsigned debug)

Change default debugging flag.


8.3 Error reporting

UNU.RAN routines report an error whenever they cannot perform the requested task. For example, applying transformed density rejection to a distribution that violates the T-concavity condition, or trying to set a parameter that is out of range, result in an error message. It might also happen that the setup fails for transformed density rejection for a T-concave distribution with some extreme density function simply because of round-off errors that makes the generation of a hat function numerically impossible. Situations like this may happen when using black box algorithms and you should check the return values of all routines.

All ..._set_..., and ..._chg_... calls return UNUR_SUCCESS if they could be executed successfully. Otherwise, some error codes are returned if it was not possible to set or change the desired parameters, e.g. because the given values are out of range, or simply because the set call does not work for the chosen method.

All routines that return a pointer to the requested object will return a NULL pointer in case of error. (Thus you should always check the pointer to avoid possible segmentation faults. Sampling routines usually do not check the given pointer to the generator object.)

The library distinguishes between two major classes of error:

(fatal) errors:

The library was not able to construct the requested object.

warnings:

Some problems encounters while constructing a generator object. The routine has tried to solve the problem but the resulting object might not be what you want. For example, chosing a special variant of a method does not work and the initialization routine might switch to another variant. Then the generator produces random variates of the requested distribution but correlation induction is not possible. However, it also might happen that changing the domain of a distribution has failed. Then the generator produced random variates with too large/too small range, i.e. their distribution is not correct.

It is obvious from the example that this distinction between errors and warning is rather crude and sometimes arbitrary.

UNU.RAN routines use the global variable unur_errno to report errors, completely analogously to errno in the ANSI C standard library. (However this approach is not thread-safe. There can be only one instance of a global variable per program. Different threads of execution may overwrite unur_errno simultaneously). Thus when an error occurs the caller of the routine can examine the error code in unur_errno to get more details about the reason why a routine failed. You get a short description of the error by a unur_get_strerror call. All the error code numbers have prefix UNUR_ERR_ and expand to non-zero constant unsigned integer values. Error codes are divided into six main groups, see Error codes.

Alternatively, the variable unur_errno can also read by a unur_get_errno call and can be reset by the unur_reset_errno call (this is in particular required for the Windows version of the library).

Additionally, there exists a error handler (see Error handlers) that is invoked in case of an error.

In addition to reporting errors by setting error codes in unur_errno, the library also has an error handler function. This function is called by other library functions when they report an error, just before they return to the caller (see Error handlers). The default behavior of the error handler is to print a short message:

AROU.004: [error] arou.c:1500 - (generator) condition for method violated:
AROU.004: ..>  PDF not unimodal

The purpose of the error handler is to provide a function where a breakpoint can be set that will catch library errors when running under the debugger. It is not intended for use in production programs, which should handle any errors using the return codes.

Function reference

Variable: extern int unur_errno

Global variable for reporting diagnostics of error.

: int unur_get_errno (void)

Get current value of global variable unur_errno.

: void unur_reset_errno (void)

Reset global variable unur_errno to UNUR_SUCCESS (i.e., no errors occured).

: const char* unur_get_strerror (const int errnocode)

Get a short description for error code value.


8.4 Error codes

List of error codes

  • Procedure executed successfully (no error)
    UNUR_SUCCESS (0x0u)

    success (no error)

  • Errors that occurred while handling distribution objects.
    UNUR_ERR_DISTR_SET

    set failed (invalid parameter).

    UNUR_ERR_DISTR_GET

    get failed (parameter not set).

    UNUR_ERR_DISTR_NPARAMS

    invalid number of parameters.

    UNUR_ERR_DISTR_DOMAIN

    parameter(s) out of domain.

    UNUR_ERR_DISTR_GEN

    invalid variant for special generator.

    UNUR_ERR_DISTR_REQUIRED

    incomplete distribution object, entry missing.

    UNUR_ERR_DISTR_UNKNOWN

    unknown distribution, cannot handle.

    UNUR_ERR_DISTR_INVALID

    invalid distribution object.

    UNUR_ERR_DISTR_DATA

    data are missing.

    UNUR_ERR_DISTR_PROP

    desired property does not exist

  • Errors that occurred while handling parameter objects.
    UNUR_ERR_PAR_SET

    set failed (invalid parameter)

    UNUR_ERR_PAR_VARIANT

    invalid variant -> using default

    UNUR_ERR_PAR_INVALID

    invalid parameter object

  • Errors that occurred while handling generator objects.
    UNUR_ERR_GEN

    error with generator object.

    UNUR_ERR_GEN_DATA

    (possibly) invalid data.

    UNUR_ERR_GEN_CONDITION

    condition for method violated.

    UNUR_ERR_GEN_INVALID

    invalid generator object.

    UNUR_ERR_GEN_SAMPLING

    sampling error.

    UNUR_ERR_NO_REINIT

    reinit routine not implemented.

    UNUR_ERR_NO_QUANTILE

    quantile routine not implemented.

  • Errors that occurred while handling URNG objects.
    UNUR_ERR_URNG

    generic error with URNG object.

    UNUR_ERR_URNG_MISS

    missing functionality.

  • Errors that occurred while parsing strings.
    UNUR_ERR_STR

    error in string.

    UNUR_ERR_STR_UNKNOWN

    unknown keyword.

    UNUR_ERR_STR_SYNTAX

    syntax error.

    UNUR_ERR_STR_INVALID

    invalid parameter.

    UNUR_ERR_FSTR_SYNTAX

    syntax error in function string.

    UNUR_ERR_FSTR_DERIV

    cannot derivate function.

  • Other run time errors.
    UNUR_ERR_DOMAIN

    argument out of domain.

    UNUR_ERR_ROUNDOFF

    (serious) round-off error.

    UNUR_ERR_MALLOC

    virtual memory exhausted.

    UNUR_ERR_NULL

    invalid NULL pointer.

    UNUR_ERR_COOKIE

    invalid cookie.

    UNUR_ERR_GENERIC

    generic error.

    UNUR_ERR_SILENT

    silent error (no error message).

    UNUR_ERR_INF

    infinity occured.

    UNUR_ERR_NAN

    NaN occured.

    UNUR_ERR_COMPILE

    Requested routine requires different compilation switches. Recompilation of library necessary.

    UNUR_ERR_SHOULD_NOT_HAPPEN

    Internal error, that should not happen. Please report this bug!


8.5 Error handlers

The default behavior of the UNU.RAN error handler is to print a short message onto the output stream, usually a logfile (see Output streams), e.g.,

AROU.004: [error] arou.c:1500 - (generator) condition for method violated:
AROU.004: ..>  PDF not unimodal

This error handler can be switched off using the unur_set_error_handler_off call, or replace it by a new one. Thus it allows to set a breakpoint that will catch library errors when running under the debugger. It also can be used to redirect error messages when UNU.RAN is included in general purpose libraries or in interactive programming environments.

Data Type: UNUR_ERROR_HANDLER

This is the type of UNU.RAN error handler functions. An error handler will be passed six arguments which specify the identifier of the object where the error occured (a string), the name of the source file in which it occurred (also a string), the line number in that file (an integer), the type of error (a string: "error" or "warning"), the error number (an integert), and the reason for the error (a string). The source file and line number are set at compile time using the __FILE__ and __LINE__ directives in the preprocessor. The error number can be translated into a short description using a unur_get_strerror call. An error handler function returns type void.

Error handler functions should be defined like this,

void my_handler(
           const char *objid,
           const char *file,
           int line,
           const char *errortype,
           int unur_errno,
           const char *reason )

To request the use of your own error handler you need the call unur_set_error_handler.

Function reference

: UNUR_ERROR_HANDLER* unur_set_error_handler (UNUR_ERROR_HANDLER* new_handler)

This function sets a new error handler, new_handler, for the UNU.RAN library routines. The previous handler is returned (so that you can restore it later). Note that the pointer to a user defined error handler function is stored in a static variable, so there can be only one error handler per program. This function should be not be used in multi-threaded programs except to set up a program-wide error handler from a master thread.

To use the default behavior set the error handler to NULL.

: UNUR_ERROR_HANDLER* unur_set_error_handler_off (void)

This function turns off the error handler by defining an error handler which does nothing (except of setting unur_errno. The previous handler is returned (so that you can restore it later).


9 Testing

The following routines can be used to test the performance of the implemented generators and can be used to verify the implementions. They are declared in unuran_tests.h which has to be included.

Function reference

: void unur_run_tests (UNUR_PAR* parameters, unsigned tests, FILE* out)

Run a battery of tests. The following tests are available (use | to combine these tests):

UNUR_TEST_ALL

run all possible tests.

UNUR_TEST_TIME

estimate generation times.

UNUR_TEST_N_URNG

count number of uniform random numbers

UNUR_TEST_N_PDF

count number of PDF calls

UNUR_TEST_CHI2

run chi^2 test for goodness of fit

UNUR_TEST_SAMPLE

print a small sample.

All these tests can be started individually (see below).

: void unur_test_printsample (UNUR_GEN* generator, int n_rows, int n_cols, FILE* out)

Print a small sample with n_rows rows and n_cols columns. out is the output stream to which all results are written.

: UNUR_GEN* unur_test_timing (UNUR_PAR* parameters, int log10_samplesize, double* time_setup, double* time_sample, int verbosity, FILE* out)

Timing. parameters is an parameter object for which setup time and marginal generation times have to be measured. The results are written into time_setup and time_sample, respectively. log10_samplesize is the common logarithm of the sample size that is used for timing.

If verbosity is TRUE then a small table is printed to output stream out with setup time, marginal generation time and average generation times for generating 10, 100, … random variates. All times are given in micro seconds and relative to the generation times for the underlying uniform random number (using the UNIF interface) and an exponential distributed random variate using the inversion method.

The created generator object is returned. If a generator object could not be created successfully, then NULL is returned.

If verbosity is TRUE the result is written to the output stream out.

Notice: All timing results are subject to heavy changes. Reruning timings usually results in different results. Minor changes in the source code can cause changes in such timings up to 25 percent.

: double unur_test_timing_R (UNUR_PAR* parameters, const char* distrstr, const char* methodstr, double log10_samplesize, double* time_setup, double* time_marginal)

Timing. parameters is an parameter object for which setup time and marginal generation times have to be measured. The results are written into time_setup and time_marginal, respectively. log10_samplesize is the common logarithm of the sample size that is used for timing.

Alternatively, one could provide the "parameter object" using strings distrstr and methodstr as used for unur_makegen_ssu. The results are more accurate than those of function unur_test_timing as the timings are computed using linear regression with several timings for sample size 1 and 10^log10_samplesize. For each sample size total generation time (including setup) is measured 10 times. Since the these timings can be influenced by external effects (like disc sync or handling of interupts) the 2 fastest and the 3 slowest timings are discarded. Intercept and slope for simple linear regression are than stored and R2 is returned.

In case of an error -100. is returned.

Notice: All timing results are subject to heavy changes. Reruning timings usually results in different results. Minor changes in the source code can cause changes in such timings up to 25 percent.

: double unur_test_timing_uniform (const UNUR_PAR* parameters, int log10_samplesize)
: double unur_test_timing_exponential (const UNUR_PAR* parameters, int log10_samplesize)

Marginal generation times for the underlying uniform random number (using the UNIF interface) and an exponential distributed random variate using the inversion method. These times are used in unur_test_timing to compute the relative timings results.

: double unur_test_timing_total (const UNUR_PAR* parameters, int samplesize, double avg_duration)

Timing. parameters is an parameter object for which average times a sample of size samplesize (including setup) are estimated. Thus sampling is repeated and the median of these timings is returned (in micro seconds). The number of iterations is computed automatically such that the total amount of time necessary for the test ist approximately avg_duration (given in seconds). However, for very slow generator with expensive setup time the time necessary for this test may be (much) larger.

If an error occurs then -1 is returned.

Notice: All timing results are subject to heavy changes. Reruning timings usually results in different results. Minor changes in the source code can cause changes in such timings up to 25 percent.

: int unur_test_count_urn (UNUR_GEN* generator, int samplesize, int verbosity, FILE* out)

Count used uniform random numbers. It returns the total number of uniform random numbers required for a sample of non-uniform random variates of size samplesize. In case of an error -1 is returned.

If verbosity is TRUE the result is written to the output stream out.

Notice: This test uses global variables to store counters. Thus it is not thread save.

: int unur_test_count_pdf (UNUR_GEN* generator, int samplesize, int verbosity, FILE* out)

Count evaluations of PDF and similar functions. It returns the total number of evaluations of all such functions required for a sample of non-uniform random variates of size samplesize. If verbosity is TRUE then a more detailed report is printed to the output stream out. In case of an error -1 is returned. This test is run on a copy of the given generator object.

Notice: The printed numbers of evaluation should be interpreted with care. For example, methods either use the PDF or the logPDF; if only the logPDF is given, but a method needs the PDF then both the logPDF and the PDF (a wrapper around the logPDF) are called and thus one call to the PDF is counted twice.

Notice: This test uses global variables to store function pointers and counters. Thus it is not thread save.

: int unur_test_par_count_pdf (UNUR_PAR* parameters, int samplesize, int verbosity, FILE* out)

Same as unur_test_count_pdf except that it is run on a parameter object. Thus it also prints the number of function evaluations for the setup. The temporary created generator object is destroyed before the results are returned.

: double unur_test_chi2 (UNUR_GEN* generator, int intervals, int samplesize, int classmin, int verbosity, FILE* out)

Run a Chi^2 test with the generator. The resulting p-value is returned.

It works with discrete und continuous univariate distributions. For the latter the CDF of the distribution is required.

intervals is the number of intervals that is used for continuous univariate distributions. samplesize is the size of the sample that is used for testing. If it is set to 0 then a sample of size intervals^2 is used (bounded to some upper bound).

classmin is the minimum number of expected entries per class. If a class has to few entries then some classes are joined.

verbosity controls the output of the routine. If it is set to 1 then the result is written to the output stream out. If it is set to 2 additionally the list of expected and observed data is printed. If it is set to 3 then all generated numbers are printed. There is no output when it is set to 0.

Notice: For multivariate distributions the generated points are transformed by the inverse of the Cholesky factor of the covariance matrix and the mean vectors (if given for the underlying distribution). The marginal distributions of the transformed vectors are then tested against the marginal distribution given by a unur_distr_cvec_set_marginals or unur_distr_cvec_set_marginal_array call. (Notice that these marginal distributions are never set by default for any of the distributions provided by UNU.RAN.) Then the Bonferroni corrected p-value of all these tests is returned. However, the test may not be performed correctly if the domain of the underlying distribution is truncated by a unur_distr_cvec_set_domain_rect call and the components of the distribution are correlated (i.e. unur_distr_cvec_set_covar is called with the non-NULL argument). Then it almost surely will fail.

: int unur_test_moments (UNUR_GEN* generator, double* moments, int n_moments, int samplesize, int verbosity, FILE* out)

Computes the first n_moments central moments for a sample of size samplesize. The result is stored into the array moments. n_moments must be an integer between 1 and 4. For multivariate distributions the moments are stored consecutively for each dimension and the provided moments-array must have a length of at least (n_moments+1) * dim, where dim is the dimension of the multivariate distribution. The m’th moment for the d’th dimension (0<=d<dim) is thus stored in the array element moments[d*n_moments+m]

If verbosity is TRUE the result is written to the output stream out.

: double unur_test_correlation (UNUR_GEN* generator1, UNUR_GEN* generator2, int samplesize, int verbosity, FILE* out)

Compute the correlation coefficient between streams from generator1 and generator2 for two samples of size samplesize. The resultung correlation is returned.

If verbosity is TRUE the result is written to the output stream out.

: int unur_test_quartiles (UNUR_GEN* generator, double* q0, double* q1, double* q2, double* q3, double* q4, int samplesize, int verbosity, FILE* out)

Estimate quartiles of sample of size samplesize. The resulting quantiles are stored in the variables q:

q0

minimum

q1

25%

q2

median (50%)

q3

75%

q4

maximum

If verbosity is TRUE the result is written to the output stream out.

: double unur_test_u_error (const UNUR_GEN* generator, double* max_error, double* MAE, double threshold, int samplesize, int randomized, int testtails, int verbosity, FILE* out)

Estimate U-error of an inversion method, i.e. error = | CDF-1(U) - U | , by means of a simple Monte Carlo method. Maximum and mean absolute errors are stored in max_error and MAE, respectively. The particular computed U-errors should not exceed the given threshold. However, approximization and round-off errors might occasionally trigger such an event. Thus the function returns a penalty score. It is 0. when the U-error never exceed the threshold value. It roughly gives the portion of particular test points where the U-error is too larger. However, each such event is weighted with 1 + 10 x(uerror - threshold) / threshold .

If randomized is TRUE a pseudo-random sequence is used for the estimation.

If randomized is FALSE then the U-values are choosen equidistributed. If in addition randomized is set to TRUE then the tails of the distributions are tested with a more dense set of points.

If verbosity is TRUE the result is written to the output stream out.

When the domain of the distribution is truncated then the u-error might be larger due to rescaling of floating point numbers. Thus the observed u-errors are corrected by the corresponding rescaling factor.

The test also works for discrete distributions albeit with some restrictions: It does not work correctly with truncated distributions and the testtails flag is ignored. Moreover, the value stored in MAE is rather useless.

In case of an error a negative value is returned.


10 Miscelleanous


10.1 Mathematics

The following macros have been defined

UNUR_INFINITY

indicates infinity for floating point numbers (of type double). Internally HUGE_VAL is used.

INT_MAX
INT_MIN

indicate infinity and minus infinity, resp., for integers (defined by ISO C standard).

TRUE
FALSE

bolean expression for return values of set functions.


Appendix A A Short Introduction to Random Variate Generation

Random variate generation is the small field of research that deals with algorithms to generate random variates from various distributions. It is common to assume that a uniform random number generator is available. This is a program that produces a sequence of independent and identically distributed continuous U(0,1) random variates (i.e. uniform random variates on the interval (0,1) ). Of course real world computers can never generate ideal random numbers and they cannot produce numbers of arbitrary precision but state-of-the-art uniform random number generators come close to this aim. Thus random variate generation deals with the problem of transforming such a sequence of U(0,1) random numbers into non-uniform random variates.

Here we shortly explain the basic ideas of the inversion, rejection, and the ratio of uniforms method. How these ideas can be used to design a particular automatic random variate generation algorithms that can be applied to large classes of distributions is shortly explained in the description of the different methods included in this manual.

For a deeper treatment of the ideas presented here, for other basic methods and for automatic generators we refer the interested reader to our book [HLD04].


A.1 The Inversion Method

When the inverse F-1 of the cumulative distribution function is known, then random variate generation is easy. We just generate a uniformly U(0,1) distributed random number U and return

X=F-1(U).

The following figure shows how the inversion method works for the exponential distribution.

figures/inversion

This algorithm is so simple that inversion is certainly the method of choice if the inverse CDF is available in closed form. This is the case e.g. for the exponential and the Cauchy distribution.

The inversion method also has other special advantages that make it even more attractive for simulation purposes. It preserves the structural properties of the underlying uniform pseudo-random number generator. Consequently it can be used, e.g., for variance reduction techniques, it is easy to sample from truncated distributions, from marginal distributions, and from order statistics. Moreover, the quality of the generated random variables depends only on the underlying uniform (pseudo-) random number generator. Another important advantage of the inversion method is that we can easily characterize its performance. To generate one random variate we always need exactly one uniform variate and one evaluation of the inverse CDF. So its speed mainly depends on the costs for evaluating the inverse CDF. Hence inversion is often considered as the method of choice in the simulation literature.

Unfortunately computing the inverse CDF is, for many important standard distributions (e.g. for normal, student, gamma, and beta-distributions), comparatively difficult and slow. Often no such routines are available in standard programming libraries. Then numerical methods for inverting the CDF are necessary, e.g. Newton’s method or (polynomial or rational) approximations of the inverse CDF. Such procedures, however, have the disadvantage that they are not exact and/or slow. UNU.RAN implements several methods: NINV (see NINV – Numerical INVersion), HINV (see HINV – Hermite interpolation based INVersion of CDF) and PINV (see PINV – Polynomial interpolation based INVersion of CDF).

For such approximate inversion methods the approximation error is important for the quality of the generated point set. Let X=G-1(U) denote the approximate inverse CDF, and let F and F-1 be the exact CDF and inverse CDF of the distribution, resp. There are three measures for the approximation error:

u-error

is given by

uerror = |U-F(G-1(U))|

Goodness-of-fit tests like the Kolmogorov-Smirnov test or the chi-squared test look at this type of error. We are also convinced that it is the most suitable error measure for Monte Carlo simulations as pseudo-random numbers and points of low discrepancy sets are located on a grid of restricted resolution.

x-error

is given by

absolute xerror = |F-1(U)-G-1(U)|
relative xerror = |F-1(U)-G-1(U)| * |F-1(U)|

The x-error measure the deviation of G-1(U) from the exact result. This measure is suitable when the inverse CDF is used as a quantile function in some computations. The main problem with the x-error is that we have to use the absolute x-error for X=F-1(U) close to zero and the relative x-error in the tails.

We use the terms u-resolution and x-resolution as the maximal tolerated u-error and x-error, resp.

UNU.RAN allows to set u-resolution and x-resolution independently. Both requirements must be fulfilled. We use the following strategy for checking whether the precision goal is reached:

checking u-error:

The u-error must be slightly smaller than the given u-resolution:

|U-F(G-1(U))| < 0.9 * uresolution.

There is no necessity to consinder the relative u-error as we have 0 < U < 1.

checking x-error:

We combine absoute and relative x-error and use the criterion

|F-1(U)-G-1(U)| < xresolution * (|G-1(U)| + xresolution).

Remark: It should be noted here that the criterion based on the u-error is too stringent whereever the CDF is extremely steep (and thus the PDF has a pole or a high and narrow peak). This is in particular a problem for distributions with a pole (e.g., the gamma distribution with shape parameter less than 0.5). On the other hand using a criterion based on the x-error causes problems whereever the CDF is extremly flat. This is in particular the case in the (far) tails of heavy-tailed distributions (e.g., for the Cauchy distribution).


A.2 The Rejection Method

The rejection method, often called acceptance-rejection method, has been suggested by John von Neumann in 1951. Since then it has proven to be the most flexible and most efficient method to generate variates from continuous distributions.

We explain the rejection principle first for the density f(x) = sin(x)/2 on the interval (0, pi). To generate random variates from this distribution we also can sample random points that are uniformly distributed in the region between the graph of f(x) and the x-axis, i.e., the shaded region in the below figure.

figures/rejection_from_constant_hat

In general this is not a trivial task but in this example we can easily use the rejection trick: Sample a random point (X,Y) uniformly in the bounding rectangle (0, pi)x(0,0.5). This is easy since each coordinate can be sampled independently from the respective uniform distributions U(0, pi) and U(0,0.5). Whenever the point falls into the shaded region below the graph (indicated by dots in the figure), i.e., when Y < sin(X)/2, we accept it and return X as a random variate from the distribution with density f(x). Otherwise we have to reject the point (indicated by small circles in the figure), and try again.

It is quite clear that this idea works for every distribution with a bounded density on a bounded domain. Moreover, we can use this procedure with any multiple of the density, i.e., with any positive bounded function with bounded integral and it is not necessary to know the integral of this function. So we use the term density in the sequel for any positive function with bounded integral.

From the figure we can conclude that the performance of a rejection algorithm depends heavily on the area of the enveloping rectangle. Moreover, the method does not work if the target distribution has infinite tails (or is unbounded). Hence non-rectangular shaped regions for the envelopes are important and we have to solve the problem of sampling points uniformly from such domains. Looking again at the example above we notice that the x-coordinate of the random point (X,Y) was sampled by inversion from the uniform distribution on the domain of the given density. This motivates us to replace the density of the uniform distribution by the (multiple of a) density h(x) of some other appropriate distribution. We only have to take care that it is chosen such that it is always an upper bound, i.e., h(x) >= f(x) for all x in the domain of the distribution. To generate the pair (X,Y) we generate X from the distribution with density proportional to h(x) and Y uniformly between 0 and h(X). The first step (generate X ) is usually done by inversion (see The Inversion Method).

Thus the general rejection algorithm for a hat h(x) with inverse CDF H-1 consists of the following steps:

  1. Generate a U(0,1) random number U.
  2. Set X to H-1(U).
  3. Generate a U(0,1) random number V.
  4. Set Y to V h(X).
  5. If Y <= f(X) accept X as the random variate.
  6. Else try again.

If the evaluation of the density f(x) is expensive (i.e., time consuming) it is possible to use a simple lower bound of the density as so called squeeze function s(x) (the triangular shaped function in the above figure is an example for such a squeeze). We can then accept X when Y <= s(X) and can thus often save the evaluation of the density.

We have seen so far that the rejection principle leads to short and simple generation algorithms. The main practical problem to apply the rejection algorithm is the search for a good fitting hat function and for squeezes. We do not discuss these topics here as they are the heart of the different automatic algorithms implemented in UNU.RAN. Information about the construction of hat and squeeze can therefore be found in the descriptions of the methods.

The performance characteristics of rejection algorithms mainly depend on the fit of the hat and the squeeze. It is not difficult to prove that:

  • The expected number of trials to generate one variate is the ratio between the area below the hat and the area below the density.
  • The expected number of evaluations of the density necessary to generate one variate is equal to the ratio between the area below the hat and the area below the density, when no squeeze is used. Otherwise, when a squeeze is given it is equal to the ratio between the area between hat and squeeze and the area below the hat.
  • The sqhratio (i.e., the ratio between the area below the squeeze and the area below the hat) used in some of the UNU.RAN methods is easy to compute. It is useful as its reciprocal is an upper bound for the expected number of trials of the rejection algoritm. The expected number of evaluations of the density is bounded by (1/sqhratio)-1.

A.3 The Composition Method

The composition method is an important principle to facilitate and speed up random variate generation. The basic idea is simple. To generate random variates with a given density we first split the domain of the density into subintervals. Then we select one of these randomly with probabilities given by the area below the density in the respective subintervals. Finally we generate a random variate from the density of the selected part by inversion and return it as random variate of the full distribution.

Composition can be combined with rejection. Thus it is possible to decompose the domain of the distribution into subintervals and to construct hat and squeeze functions seperatly in every subinterval. The area below the hat must be determined in every subinterval. Then the Composition rejection algorithm contains the following steps:

  1. Generate the index J of the subinterval as the realisation of a discrete random variate with probabilities proportional to the area below the hat.
  2. Generate a random variate X proportional to the hat in interval J.
  3. Generate the U(0,f(X)) random number Y.
  4. If Y <= f(X) accept X as random variate.
  5. Else start again with generating the index J.

The first step can be done in constant time (i.e., independent of the number of chosen subintervals) by means of the indexed search method (see Indexed Search (Guide Table Method)).

It is possible to reduce the number of uniform random numbers required in the above algorithm by recycling the random numbers used in Step 1 and additionally by applying the principle of immediate acceptance. For details see [HLD04: Sect. 3.1] .


A.4 The Ratio-of-Uniforms Method

The construction of an appropriate hat function for the given density is the crucial step for constructing rejection algorithms. Equivalently we can try to find an appropriate envelope for the region between the graph of the density and the x-axis, such that we can easily sample uniformly distributed random points. This task could become easier if we can find transformations that map the region between the density and the axis into a region of more suitable shape (for example into a bounded region).

As a first example we consider the following simple algorithm for the Cauchy distribution.

  1. Generate a U(-1,1) random number U and a U(0,1) random number V.
  2. If U2 + V2 <= 1 accept X=U/V as a Cauchy random variate.
  3. Else try again.

It is possible to prove that the above algorithm indeed generates Cauchy random variates. The fundamental principle behind this algorithm is the fact that the region below the density is mapped by the transformation

(X,Y) -> (U,V)=(2 Xsqrt(Y),2 sqrt(Y))

into a half-disc in such a way that the ratio between the area of the image to the area of the preimage is constant. This is due to the fact that that the Jacobian of this transformation is constant.

figures/rou-cauchy

The above example is a special case of a more general principle, called the Ratio-of-uniforms (RoU) method. It is based on the fact that for a random variable X with density f(x) and some constant mu we can generate X from the desired density by calculating X=U/V+ mu for a pair (U,V) uniformly distributed in the set

A_f= { (u,v) : 0 < v <= sqrt(f(u/v+ mu)) } .

For most distributions it is best to set the constant mu equal to the mode of the distribution. For sampling random points uniformly distributed in A_f rejection from a convenient enveloping region is used, usually the minimal bounding rectangle, i.e., the smallest possible rectangle that contains A_f (see the above figure). It is given by (u-,u+)x(0,v+) where

v+ = sup_b_l<x<b_r sqrt(f(x)),
u- = inf_b_l<x<b_r (x- mu) sqrt(f(x)),
u+ = sup_b_l<x<b_r (x- mu) sqrt(f(x)).

Then the ratio-of-uniforms method consists of the following simple steps:

  1. Generate a U(u-,u+) random number U and a U(0,v+) random number V.
  2. Set X to U/V+ mu.
  3. If V2 <= f(X) accept X as the random variate.
  4. Else try again.

To apply the ratio-of-uniforms algorithm to a certain density we have to solve the simple optimization problems in the definitions above to obtain the design constants u-, u+, and v+. This simple algorithm works for all distributions with bounded densities that have subquadratic tails (i.e., tails like 1/x2 or lower). For most standard distributions it has quite good rejection constants. (E.g. 1.3688 for the normal and 1.4715 for the exponential distribution.)

Nevertheless, we use more sophisticated method that construct better fitting envelopes, like method AROU (see AROU – Automatic Ratio-Of-Uniforms method), or even avoid the computation of these design constants and thus have almost no setup, like method SROU (see SROU – Simple Ratio-Of-Uniforms method).

The Generalized Ratio-of-Uniforms Method

The Ratio-of-Uniforms method can be generalized: If a point (U,V) is uniformly distributed in the set

A_f= { (u,v) : 0 < v <= (f(u/vr+ mu))1/(r+1) }

then X=U/Vr+ mu has the denity f(x). The minimal bounding rectangle of this region is given by (u-,u+)x(0,v+) where

v+ = sup_b_l<x<b_r (f(x))1/(r+1),
u- = inf_b_l<x<b_r (x- mu) (f(x))r/(r+1),
u+ = sup_b_l<x<b_r (x- mu) (f(x))r/(r+1).

The above algorithm has then to be adjusted accordingly. Notice that the original Ratio-of-Uniforms method is the special case with r=1.


A.5 Inversion for Discrete Distributions

We have already presented the idea of the inversion method to generate from continuous random variables (see The Inversion Method). For a discrete random variable X we can write it mathematically in the same way:

X=F-1(U),

where F is the CDF of the desired distribution and U is a uniform U(0,1) random number. The difference compared to the continuous case is that F is now a step-function. The following figure illustrates the idea of discrete inversion for a simple distribution.

figures/discrete_inversion

To realize this idea on a computer we have to use a search algorithm. For the simplest version called Sequential Search the CDF is computed on-the-fly as sum of the probabilities p(k), since this is usually much cheaper than computing the CDF directly. It is obvious that the basic form of the search algorithm only works for discrete random variables with probability mass functions p(k) for nonnegative k. The sequential search algorithm consists of the following basic steps:

  1. Generate a U(0,1) random number U.
  2. Set X to 0 and P to p(0).
  3. Do while U > P
  4.       Set X to X+1 and P to P+p(X).
  5. Return X.

With the exception of some very simple discrete distributions, sequential search algorithms become very slow as the while-loop has to be repeated very often. The expected number of iterations, i.e., the number of comparisons in the while condition, is equal to the expectation of the distribution plus 1. It can therefore become arbitrary large or even infinity if the tail of the distribution is very heavy. Another serious problem can be critical round-off errors due to summing up many probabilities p(k). To speed up the search procedure it is best to use indexed search.


A.6 Indexed Search (Guide Table Method)

The idea to speed up the sequential search algorithm is easy to understand. Instead of starting always at 0 we store a table of size C with starting points for our search. For this table we compute F-1(U) for C equidistributed values of U, i.e., for u_i = i/C, i=0,...,C-1. Such a table is called guide table or hash table. Then it is easy to prove that for every U in (0,1) the guide table entry for k=floor(UC) is bounded by F-1(U). This shows that we can really start our sequential search procedure from the table entry for k and the index k of the correct table entry can be found rapidly by means of the truncation operation.

The two main differences between indexed search and sequential search are that we start searching at the number determined by the guide table, and that we have to compute and store the cumulative probabilities in the setup as we have to know the cumulative probability for the starting point of the search algorithm. The rounding problems that can occur in the sequential search algorithm can occur here as well. Compared to sequential search we have now the obvious drawback of a slow setup. The computation of the cumulative probabilities grows linear with the size of the domain of the distribution L. What we gain is really high speed as the marginal execution time of the sampling algorithm becomes very small. The expected number of comparisons is bounded by 1+L/C. This shows that there is a trade-off between speed and the size of the guide table. Cache-effects in modern computers will however slow down the speed-up for really large table sizes. Thus we recommend to use a guide table that is about two times larger than the probability vector to obtain optimal speed.


Appendix B Glossary

CDF

cumulative distribution function.

HR

hazard rate (or failure rate).

inverse local concavity

local concavity of inverse PDF f-1(y) expressed in term of x = f-1(y). Is is given by ilc_f(x) = 1 + x f''(x) / f'(x)

local concavity

maximum value of c such that PDF f(x) is T_c. Is is given by lc_f(x) = 1 - f''(x) f(x) / f'(x)2

PDF

probability density function.

dPDF

derivative (gradient) of probability density function.

PMF

probability mass function.

PV

(finite) probability vector.

URNG

uniform random number generator.

U(a,b)

continuous uniform distribution on the interval (a,b).

T-concave

a function f(x) is called T-convace if the transformed function T(f(x)) is concave. We only deal with transformations T_c, where

c = 0
T(x) = log(x)
c = -0.5
T(x) = -1/sqrt(x)
c != 0
T(x) = sign(x) * xc
u-error

for a given approximate inverse CDF X=G-1(U) the u-error is given as

uerror = |U-F(G-1(U))|

where F denotes the exact CDF. Goodness-of-fit tests like the Kolmogorov-Smirnov test or the chi-squared test look at this type of error. See The Inversion Method for more details.

u-resolution

the maximal tolerated u-error for an approximate inverse CDF.

x-error

for a given approximate inverse CDF X=G-1(U) the x-error is given as

xerror = |F-1(U)-G-1(U)|

where F-1 denotes the exact inverse CDF. The x-error measure the deviation of G-1(U) from the exact result. Notice that we have to distinguish between absolute and relative x-error. In UNU.RAN we use the absolute x-error near 0 and the relative x-error otherwise. See The Inversion Method for more details.

x-resolution

the maximal tolerated x-error for an approximate inverse CDF.


Appendix C Bibliography

Standard Distributions

[JKKa92]

N.L. JOHNSON, S. KOTZ, AND A.W. KEMP (1992). Univariate Discrete Distributions, 2nd edition, John Wiley & Sons, Inc., New York.

[JKBb94]

N.L. JOHNSON, S. KOTZ, AND N. BALAKRISHNAN (1994). Continuous Univariate Distributions, Volume 1, 2nd edition, John Wiley & Sons, Inc., New York.

[JKBc95]

N.L. JOHNSON, S. KOTZ, AND N. BALAKRISHNAN (1995). Continuous Univariate Distributions, Volume 2, 2nd edition, John Wiley & Sons, Inc., New York.

[JKBd97]

N.L. JOHNSON, S. KOTZ, AND N. BALAKRISHNAN (1997). Discrete Multivariate Distributions, John Wiley & Sons, Inc., New York.

[KBJe00]

S. KOTZ, N. BALAKRISHNAN, AND N.L. JOHNSON (2000). Continuous Multivariate Distributions, Volume 1: Models and Applications, John Wiley & Sons, Inc., New York.

Universal Methods – Surveys

[HLD04]

W. HÖRMANN, J. LEYDOLD, AND G. DERFLINGER (2004). Automatic Nonuniform Random Variate Generation, Springer, Berlin.

Universal Methods

[AJa93]

J.H. AHRENS (1993). Sampling from general distributions by suboptimal division of domains, Grazer Math. Berichte 319, 30pp.

[AJa95]

J.H. AHRENS (1995). An one-table method for sampling from continuous and discrete distributions, Computing 54(2), pp. 127-146.

[CAa74]

H.C. CHEN AND Y. ASAU (1974). On generating random variates from an empirical distribution, AIIE Trans. 6, pp. 163-166.

[DHLa08]

G. DERFLINGER, W. HÖRMANN, AND J. LEYDOLD (2008). Numerical inversion when only the density function is known, Research Report Series of the Department of Statistics and Mathematics 78, WU Wien, Augasse 2–6, A-1090 Wien, Austria, http://epub.wu.ac.at/english/.

[DLa86]

L. DEVROYE (1986). Non-Uniform Random Variate Generation, Springer Verlag, New York.

[GWa92]

W.R. GILKS AND P. WILD (1992). Adaptive rejection sampling for Gibbs sampling, Applied Statistics 41, pp. 337-348.

[HWa95]

W. HÖRMANN (1995). A rejection technique for sampling from T-concave distributions, ACM Trans. Math. Software 21(2), pp. 182-193.

[HDa96]

W. HÖRMANN AND G. DERFLINGER (1996). Rejection-inversion to generate variates from monotone discrete distributions, ACM TOMACS 6(3), 169-184.

[HLa00]

W. HÖRMANN AND J. LEYDOLD (2000). Automatic random variate generation for simulation input. In: J.A. Joines, R. Barton, P. Fishwick, K. Kang (eds.), Proceedings of the 2000 Winter Simulation Conference, pp. 675-682.

[HLa03]

W. HÖRMANN AND J. LEYDOLD (2003). Continuous Random Variate Generation by Fast Numerical Inversion, ACM TOMACS 13(4), 347-362.

[HLDa07]

W. HÖRMANN, J. LEYDOLD, AND G. DERFLINGER (2007). Automatic Random Variate Generation for Unbounded Densities, ACM Trans. Model. Comput. Simul. 17(4), pp.18.

[KLPa05]

R. KARAWATZKI, J. LEYDOLD, AND K. PÖTZELBERGER (2005). Automatic Markov chain Monte Carlo procedures for sampling from multivariate distributions, Research Report Series of the Department of Statistics and Mathematics 27, WU Wien, Augasse 2–6, A-1090 Wien, Austria, http://epub.wu.ac.at/english/.

[LJa98]

J. LEYDOLD (1998). A Rejection Technique for Sampling from Log-Concave Multivariate Distributions, ACM TOMACS 8(3), pp. 254-280.

[LJa00]

J. LEYDOLD (2000). Automatic Sampling with the Ratio-of-Uniforms Method, ACM Trans. Math. Software 26(1), pp. 78-98.

[LJa01]

J. LEYDOLD (2001). A simple universal generator for continuous and discrete univariate T-concave distributions, ACM Trans. Math. Software 27(1), pp. 66-82.

[LJa02]

J. LEYDOLD (2003). Short universal generators via generalized ratio-of-uniforms method, Math. Comp. 72(243), pp. 1453-1471.

[WGS91]

J.C. WAKEFIELD, A.E. GELFAND, AND A.F.M. SMITH (1992). Efficient generation of random variates via the ratio-of-uniforms method, Statist. Comput. 1(2), pp. 129-133.

[WAa77]

A.J. WALKER (1977). An efficient method for generating discrete random variables with general distributions, ACM Trans. Math. Software 3, pp. 253-256.

Special Generators

[ADa74]

J.H. AHRENS, U. DIETER (1974). Computer methods for sampling from gamma, beta, Poisson and binomial distributions, Computing 12, 223-246.

[ADa82]

J.H. AHRENS, U. DIETER (1982). Generating gamma variates by a modified rejection technique, Communications of the ACM 25, 47-54.

[ADb82]

J.H. AHRENS, U. DIETER (1982). Computer generation of Poisson deviates from modified normal distributions, ACM Trans. Math. Software 8, 163-179.

[BMa58]

G.E.P. BOX AND M.E. MULLER (1958). A note on the generation of random normal deviates, Annals Math. Statist. 29, 610-611.

[CHa77]

R.C.H. CHENG (1977). The Generation of Gamma Variables with Non-Integral Shape Parameter, Appl. Statist. 26(1), 71-75.

[Dag89]

J.S. DAGPUNAR (1989). An Easily Implemented Generalised Inverse Gaussian Generator, Commun. Statist. Simul. 18(2), 703-710.

[HDa90]

W. HÖRMANN AND G. DERFLINGER (1990). The ACR Method for generating normal random variables, OR Spektrum 12, 181-185.

[KAa81]

A.W. KEMP (1981). Efficient generation of logarithmically distributed pseudo-random variables, Appl. Statist. 30, 249-253.

[KRa76]

A.J. KINDERMAN AND J.G. RAMAGE (1976). Computer Generation of Normal Random Variables, J. Am. Stat. Assoc. 71(356), 893 - 898.

[MJa87]

J.F. MONAHAN (1987). An algorithm for generating chi random variables, ACM Trans. Math. Software 13, 168-172.

[MGa62]

G. MARSAGLIA (1962). Improving the Polar Method for Generating a Pair of Random Variables, Boeing Sci. Res. Lab., Seattle, Washington.

[MOa84]

G. MARSAGLIA AND I. OLKIN (1984). Generating Correlation Matrices, SIAM J. Sci. Stat. Comput 5, 470-475.

[STa89]

E. STADLOBER (1989). Sampling from Poisson, binomial and hypergeometric distributions: ratio of uniforms as a simple and fast alternative, Bericht 303, Math. Stat. Sektion, Forschungsgesellschaft Joanneum, Graz.

[ZHa94]

H. ZECHNER (1994). Efficient sampling from continuous and discrete unimodal distributions, Pd.D. Thesis, 156 pp., Technical University Graz, Austria.

Other references

[CPa76]

R. CRANLEY AND T.N.L. PATTERSON (1976). Randomization of number theoretic methods for multiple integration, SIAM J. Num. Anal., Vol. 13, pp. 904-914.

[HJa61]

R. HOOKE AND T.A. JEEVES (1961). Direct Search Solution of Numerical and Statistical Problems, Journal of the ACM, Vol. 8, April 1961, pp. 212-229.


Appendix D Function Index

Jump to:   F   I   T   U  
Index Entry  Section

F
FALSE: Math

I
INT_MAX: Math
INT_MIN: Math

T
TRUE: Math

U
unur_arou_chg_verify: AROU
unur_arou_get_hatarea: AROU
unur_arou_get_sqhratio: AROU
unur_arou_get_squeezearea: AROU
unur_arou_new: AROU
unur_arou_set_cpoints: AROU
unur_arou_set_darsfactor: AROU
unur_arou_set_guidefactor: AROU
unur_arou_set_max_segments: AROU
unur_arou_set_max_sqhratio: AROU
unur_arou_set_pedantic: AROU
unur_arou_set_usecenter: AROU
unur_arou_set_usedars: AROU
unur_arou_set_verify: AROU
unur_ars_chg_reinit_ncpoints: ARS
unur_ars_chg_reinit_percentiles: ARS
unur_ars_chg_verify: ARS
unur_ars_eval_invcdfhat: ARS
unur_ars_get_loghatarea: ARS
unur_ars_new: ARS
unur_ars_set_cpoints: ARS
unur_ars_set_max_intervals: ARS
unur_ars_set_max_iter: ARS
unur_ars_set_pedantic: ARS
unur_ars_set_reinit_ncpoints: ARS
unur_ars_set_reinit_percentiles: ARS
unur_ars_set_verify: ARS
unur_auto_new: AUTO
unur_auto_set_logss: AUTO
unur_cext_get_distrparams: CEXT
unur_cext_get_ndistrparams: CEXT
unur_cext_get_params: CEXT
unur_cext_new: CEXT
unur_cext_set_init: CEXT
unur_cext_set_sample: CEXT
unur_chgto_urng_aux_default: URNG
unur_chg_debug: Debug
unur_chg_urng: URNG
unur_chg_urng_aux: URNG
unur_cstd_chg_truncated: CSTD
unur_cstd_new: CSTD
unur_cstd_set_variant: CSTD
unur_dari_chg_verify: DARI
unur_dari_new: DARI
unur_dari_set_cpfactor: DARI
unur_dari_set_squeeze: DARI
unur_dari_set_tablesize: DARI
unur_dari_set_verify: DARI
unur_dau_new: DAU
unur_dau_set_urnfactor: DAU
UNUR_DEBUG_ADAPT: Debug
UNUR_DEBUG_ADAPT: Debug
UNUR_DEBUG_ALL: Debug
UNUR_DEBUG_ALL: Debug
UNUR_DEBUG_INIT: Debug
UNUR_DEBUG_INIT: Debug
UNUR_DEBUG_OFF: Debug
UNUR_DEBUG_OFF: Debug
UNUR_DEBUG_SAMPLE: Debug
UNUR_DEBUG_SAMPLE: Debug
UNUR_DEBUG_SETUP: Debug
UNUR_DEBUG_SETUP: Debug
unur_dext_get_distrparams: DEXT
unur_dext_get_ndistrparams: DEXT
unur_dext_get_params: DEXT
unur_dext_new: DEXT
unur_dext_set_init: DEXT
unur_dext_set_sample: DEXT
unur_dgt_new: DGT
unur_dgt_set_guidefactor: DGT
unur_dgt_set_variant: DGT
unur_distr_<dname>: Stddist
unur_distr_beta: beta
unur_distr_binomial: binomial
unur_distr_cauchy: cauchy
unur_distr_cemp_get_data: CEMP
unur_distr_cemp_new: CEMP
unur_distr_cemp_read_data: CEMP
unur_distr_cemp_set_data: CEMP
unur_distr_cemp_set_hist: CEMP
unur_distr_cemp_set_hist_bins: CEMP
unur_distr_cemp_set_hist_domain: CEMP
unur_distr_cemp_set_hist_prob: CEMP
unur_distr_chi: chi
unur_distr_chisquare: chisquare
unur_distr_condi_get_condition: CONDI
unur_distr_condi_get_distribution: CONDI
unur_distr_condi_new: CONDI
unur_distr_condi_set_condition: CONDI
unur_distr_cont_eval_cdf: CONT
unur_distr_cont_eval_dlogpdf: CONT
unur_distr_cont_eval_dpdf: CONT
unur_distr_cont_eval_hr: CONT
unur_distr_cont_eval_invcdf: CONT
unur_distr_cont_eval_logcdf: CONT
unur_distr_cont_eval_logpdf: CONT
unur_distr_cont_eval_pdf: CONT
unur_distr_cont_get_cdf: CONT
unur_distr_cont_get_cdfstr: CONT
unur_distr_cont_get_center: CONT
unur_distr_cont_get_dlogpdf: CONT
unur_distr_cont_get_dlogpdfstr: CONT
unur_distr_cont_get_domain: CONT
unur_distr_cont_get_dpdf: CONT
unur_distr_cont_get_dpdfstr: CONT
unur_distr_cont_get_hr: CONT
unur_distr_cont_get_hrstr: CONT
unur_distr_cont_get_invcdf: CONT
unur_distr_cont_get_logcdf: CONT
unur_distr_cont_get_logcdfstr: CONT
unur_distr_cont_get_logpdf: CONT
unur_distr_cont_get_logpdfstr: CONT
unur_distr_cont_get_mode: CONT
unur_distr_cont_get_pdf: CONT
unur_distr_cont_get_pdfarea: CONT
unur_distr_cont_get_pdfparams: CONT
unur_distr_cont_get_pdfparams_vec: CONT
unur_distr_cont_get_pdfstr: CONT
unur_distr_cont_get_truncated: CONT
unur_distr_cont_new: CONT
unur_distr_cont_set_cdf: CONT
unur_distr_cont_set_cdfstr: CONT
unur_distr_cont_set_center: CONT
unur_distr_cont_set_dlogpdf: CONT
unur_distr_cont_set_domain: CONT
unur_distr_cont_set_dpdf: CONT
unur_distr_cont_set_hr: CONT
unur_distr_cont_set_hrstr: CONT
unur_distr_cont_set_invcdf: CONT
unur_distr_cont_set_logcdf: CONT
unur_distr_cont_set_logcdfstr: CONT
unur_distr_cont_set_logpdf: CONT
unur_distr_cont_set_logpdfstr: CONT
unur_distr_cont_set_mode: CONT
unur_distr_cont_set_pdf: CONT
unur_distr_cont_set_pdfarea: CONT
unur_distr_cont_set_pdfparams: CONT
unur_distr_cont_set_pdfparams_vec: CONT
unur_distr_cont_set_pdfstr: CONT
unur_distr_cont_upd_mode: CONT
unur_distr_cont_upd_pdfarea: CONT
unur_distr_copula: copula
unur_distr_corder_eval_cdf: CORDER
unur_distr_corder_eval_dpdf: CORDER
unur_distr_corder_eval_pdf: CORDER
unur_distr_corder_get_cdf: CORDER
unur_distr_corder_get_distribution: CORDER
unur_distr_corder_get_domain: CORDER
unur_distr_corder_get_dpdf: CORDER
unur_distr_corder_get_mode: CORDER
unur_distr_corder_get_pdf: CORDER
unur_distr_corder_get_pdfarea: CORDER
unur_distr_corder_get_pdfparams: CORDER
unur_distr_corder_get_rank: CORDER
unur_distr_corder_get_truncated: CORDER
unur_distr_corder_new: CORDER
unur_distr_corder_set_domain: CORDER
unur_distr_corder_set_mode: CORDER
unur_distr_corder_set_pdfarea: CORDER
unur_distr_corder_set_pdfparams: CORDER
unur_distr_corder_set_rank: CORDER
unur_distr_corder_upd_mode: CORDER
unur_distr_corder_upd_pdfarea: CORDER
unur_distr_correlation: correlation
unur_distr_cvec_eval_dlogpdf: CVEC
unur_distr_cvec_eval_dpdf: CVEC
unur_distr_cvec_eval_logpdf: CVEC
unur_distr_cvec_eval_pdf: CVEC
unur_distr_cvec_eval_pdlogpdf: CVEC
unur_distr_cvec_eval_pdpdf: CVEC
unur_distr_cvec_get_center: CVEC
unur_distr_cvec_get_cholesky: CVEC
unur_distr_cvec_get_covar: CVEC
unur_distr_cvec_get_covar_inv: CVEC
unur_distr_cvec_get_dlogpdf: CVEC
unur_distr_cvec_get_dpdf: CVEC
unur_distr_cvec_get_logpdf: CVEC
unur_distr_cvec_get_marginal: CVEC
unur_distr_cvec_get_mean: CVEC
unur_distr_cvec_get_mode: CVEC
unur_distr_cvec_get_pdf: CVEC
unur_distr_cvec_get_pdfparams: CVEC
unur_distr_cvec_get_pdfparams_vec: CVEC
unur_distr_cvec_get_pdfvol: CVEC
unur_distr_cvec_get_rankcorr: CVEC
unur_distr_cvec_get_rk_cholesky: CVEC
unur_distr_cvec_is_indomain: CVEC
unur_distr_cvec_new: CVEC
unur_distr_cvec_set_center: CVEC
unur_distr_cvec_set_covar: CVEC
unur_distr_cvec_set_covar_inv: CVEC
unur_distr_cvec_set_dlogpdf: CVEC
unur_distr_cvec_set_domain_rect: CVEC
unur_distr_cvec_set_dpdf: CVEC
unur_distr_cvec_set_logpdf: CVEC
unur_distr_cvec_set_marginals: CVEC
unur_distr_cvec_set_marginal_array: CVEC
unur_distr_cvec_set_marginal_list: CVEC
unur_distr_cvec_set_mean: CVEC
unur_distr_cvec_set_mode: CVEC
unur_distr_cvec_set_pdf: CVEC
unur_distr_cvec_set_pdfparams: CVEC
unur_distr_cvec_set_pdfparams_vec: CVEC
unur_distr_cvec_set_pdfvol: CVEC
unur_distr_cvec_set_pdlogpdf: CVEC
unur_distr_cvec_set_pdpdf: CVEC
unur_distr_cvec_set_rankcorr: CVEC
unur_distr_cvec_upd_mode: CVEC
unur_distr_cvec_upd_pdfvol: CVEC
unur_distr_cvemp_get_data: CVEMP
unur_distr_cvemp_new: CVEMP
unur_distr_cvemp_read_data: CVEMP
unur_distr_cvemp_set_data: CVEMP
unur_distr_discr_eval_cdf: DISCR
unur_distr_discr_eval_invcdf: DISCR
unur_distr_discr_eval_pmf: DISCR
unur_distr_discr_eval_pv: DISCR
unur_distr_discr_get_cdfstr: DISCR
unur_distr_discr_get_domain: DISCR
unur_distr_discr_get_mode: DISCR
unur_distr_discr_get_pmfparams: DISCR
unur_distr_discr_get_pmfstr: DISCR
unur_distr_discr_get_pmfsum: DISCR
unur_distr_discr_get_pv: DISCR
unur_distr_discr_make_pv: DISCR
unur_distr_discr_new: DISCR
unur_distr_discr_set_cdf: DISCR
unur_distr_discr_set_cdfstr: DISCR
unur_distr_discr_set_domain: DISCR
unur_distr_discr_set_invcdf: DISCR
unur_distr_discr_set_mode: DISCR
unur_distr_discr_set_pmf: DISCR
unur_distr_discr_set_pmfparams: DISCR
unur_distr_discr_set_pmfstr: DISCR
unur_distr_discr_set_pmfsum: DISCR
unur_distr_discr_set_pv: DISCR
unur_distr_discr_upd_mode: DISCR
unur_distr_discr_upd_pmfsum: DISCR
unur_distr_exponential: exponential
unur_distr_extremeI: extremeI
unur_distr_extremeII: extremeII
unur_distr_F: F
unur_distr_free: AllDistr
unur_distr_gamma: gamma
unur_distr_geometric: geometric
unur_distr_get_dim: AllDistr
unur_distr_get_extobj: AllDistr
unur_distr_get_name: AllDistr
unur_distr_get_type: AllDistr
unur_distr_gig: gig
unur_distr_gig2: gig2
unur_distr_hyperbolic: hyperbolic
unur_distr_hypergeometric: hypergeometric
unur_distr_ig: ig
unur_distr_is_cemp: AllDistr
unur_distr_is_cont: AllDistr
unur_distr_is_cvec: AllDistr
unur_distr_is_cvemp: AllDistr
unur_distr_is_discr: AllDistr
unur_distr_is_matr: AllDistr
unur_distr_laplace: laplace
unur_distr_logarithmic: logarithmic
unur_distr_logistic: logistic
unur_distr_lognormal: lognormal
unur_distr_lomax: lomax
unur_distr_matr_get_dim: MATR
unur_distr_matr_new: MATR
unur_distr_multicauchy: multicauchy
unur_distr_multiexponential: multiexponential
unur_distr_multinormal: multinormal
unur_distr_multistudent: multistudent
unur_distr_negativebinomial: negativebinomial
unur_distr_normal: normal
unur_distr_pareto: pareto
unur_distr_poisson: poisson
unur_distr_powerexponential: powerexponential
unur_distr_rayleigh: rayleigh
unur_distr_set_extobj: AllDistr
unur_distr_set_name: AllDistr
unur_distr_slash: slash
unur_distr_student: student
unur_distr_triangular: triangular
unur_distr_uniform: uniform
unur_distr_weibull: weibull
unur_dsrou_chg_cdfatmode: DSROU
unur_dsrou_chg_verify: DSROU
unur_dsrou_new: DSROU
unur_dsrou_set_cdfatmode: DSROU
unur_dsrou_set_verify: DSROU
unur_dss_new: DSS
unur_dstd_chg_truncated: DSTD
unur_dstd_new: DSTD
unur_dstd_set_variant: DSTD
unur_empk_chg_smoothing: EMPK
unur_empk_chg_varcor: EMPK
unur_empk_new: EMPK
unur_empk_set_beta: EMPK
unur_empk_set_kernel: EMPK
unur_empk_set_kernelgen: EMPK
unur_empk_set_positive: EMPK
unur_empk_set_smoothing: EMPK
unur_empk_set_varcor: EMPK
unur_empl_new: EMPL
unur_errno: Error_reporting
UNUR_ERR_COMPILE: Errno
UNUR_ERR_COOKIE: Errno
UNUR_ERR_DISTR_DATA: Errno
UNUR_ERR_DISTR_DOMAIN: Errno
UNUR_ERR_DISTR_GEN: Errno
UNUR_ERR_DISTR_GET: Errno
UNUR_ERR_DISTR_INVALID: Errno
UNUR_ERR_DISTR_NPARAMS: Errno
UNUR_ERR_DISTR_PROP: Errno
UNUR_ERR_DISTR_REQUIRED: Errno
UNUR_ERR_DISTR_SET: Errno
UNUR_ERR_DISTR_UNKNOWN: Errno
UNUR_ERR_DOMAIN: Errno
UNUR_ERR_FSTR_DERIV: Errno
UNUR_ERR_FSTR_SYNTAX: Errno
UNUR_ERR_GEN: Errno
UNUR_ERR_GENERIC: Errno
UNUR_ERR_GEN_CONDITION: Errno
UNUR_ERR_GEN_DATA: Errno
UNUR_ERR_GEN_INVALID: Errno
UNUR_ERR_GEN_SAMPLING: Errno
UNUR_ERR_INF: Errno
UNUR_ERR_MALLOC: Errno
UNUR_ERR_NAN: Errno
UNUR_ERR_NO_QUANTILE: Errno
UNUR_ERR_NO_REINIT: Errno
UNUR_ERR_NULL: Errno
UNUR_ERR_PAR_INVALID: Errno
UNUR_ERR_PAR_SET: Errno
UNUR_ERR_PAR_VARIANT: Errno
UNUR_ERR_ROUNDOFF: Errno
UNUR_ERR_SHOULD_NOT_HAPPEN: Errno
UNUR_ERR_SILENT: Errno
UNUR_ERR_STR: Errno
UNUR_ERR_STR_INVALID: Errno
UNUR_ERR_STR_SYNTAX: Errno
UNUR_ERR_STR_UNKNOWN: Errno
UNUR_ERR_URNG: Errno
UNUR_ERR_URNG_MISS: Errno
unur_free: Methods_all
unur_gen_anti: URNG
unur_gen_info: Methods_all
unur_gen_is_inversion: Methods_all
unur_gen_nextsub: URNG
unur_gen_reset: URNG
unur_gen_resetsub: URNG
unur_gen_seed: URNG
unur_gen_sync: URNG
unur_get_default_urng: URNG
unur_get_default_urng_aux: URNG
unur_get_dimension: Methods_all
unur_get_distr: Methods_all
unur_get_errno: Error_reporting
unur_get_genid: Methods_all
unur_get_method: Methods_all
unur_get_stream: Output_streams
unur_get_strerror: Error_reporting
unur_get_urng: URNG
unur_get_urng_aux: URNG
unur_gibbs_chg_state: GIBBS
unur_gibbs_get_state: GIBBS
unur_gibbs_new: GIBBS
unur_gibbs_reset_state: GIBBS
unur_gibbs_set_burnin: GIBBS
unur_gibbs_set_c: GIBBS
unur_gibbs_set_startingpoint: GIBBS
unur_gibbs_set_thinning: GIBBS
unur_gibbs_set_variant_coordinate: GIBBS
unur_gibbs_set_variant_random_direction: GIBBS
unur_hinv_chg_truncated: HINV
unur_hinv_estimate_error: HINV
unur_hinv_eval_approxinvcdf: HINV
unur_hinv_get_n_intervals: HINV
unur_hinv_new: HINV
unur_hinv_set_boundary: HINV
unur_hinv_set_cpoints: HINV
unur_hinv_set_guidefactor: HINV
unur_hinv_set_max_intervals: HINV
unur_hinv_set_order: HINV
unur_hinv_set_u_resolution: HINV
unur_hist_new: HIST
unur_hitro_chg_state: HITRO
unur_hitro_get_state: HITRO
unur_hitro_new: HITRO
unur_hitro_reset_state: HITRO
unur_hitro_set_adaptive_multiplier: HITRO
unur_hitro_set_burnin: HITRO
unur_hitro_set_r: HITRO
unur_hitro_set_startingpoint: HITRO
unur_hitro_set_thinning: HITRO
unur_hitro_set_u: HITRO
unur_hitro_set_use_adaptiveline: HITRO
unur_hitro_set_use_adaptiverectangle: HITRO
unur_hitro_set_use_boundingrectangle: HITRO
unur_hitro_set_v: HITRO
unur_hitro_set_variant_coordinate: HITRO
unur_hitro_set_variant_random_direction: HITRO
unur_hrb_chg_verify: HRB
unur_hrb_new: HRB
unur_hrb_set_upperbound: HRB
unur_hrb_set_verify: HRB
unur_hrd_chg_verify: HRD
unur_hrd_new: HRD
unur_hrd_set_verify: HRD
unur_hri_chg_verify: HRI
unur_hri_new: HRI
unur_hri_set_p0: HRI
unur_hri_set_verify: HRI
UNUR_INFINITY: Math
unur_init: Methods_all
unur_itdr_chg_verify: ITDR
unur_itdr_get_area: ITDR
unur_itdr_get_cp: ITDR
unur_itdr_get_ct: ITDR
unur_itdr_get_xi: ITDR
unur_itdr_new: ITDR
unur_itdr_set_cp: ITDR
unur_itdr_set_ct: ITDR
unur_itdr_set_verify: ITDR
unur_itdr_set_xi: ITDR
unur_makegen_dsu: StringAPI
unur_makegen_ssu: StringAPI
unur_mcorr_chg_eigenvalues: MCORR
unur_mcorr_new: MCORR
unur_mcorr_set_eigenvalues: MCORR
unur_mixt_new: MIXT
unur_mixt_set_useinversion: MIXT
unur_mvstd_new: MVSTD
unur_mvtdr_chg_verify: MVTDR
unur_mvtdr_get_hatvol: MVTDR
unur_mvtdr_get_ncones: MVTDR
unur_mvtdr_new: MVTDR
unur_mvtdr_set_boundsplitting: MVTDR
unur_mvtdr_set_maxcones: MVTDR
unur_mvtdr_set_stepsmin: MVTDR
unur_mvtdr_set_verify: MVTDR
unur_ninv_chg_max_iter: NINV
unur_ninv_chg_start: NINV
unur_ninv_chg_table: NINV
unur_ninv_chg_truncated: NINV
unur_ninv_chg_u_resolution: NINV
unur_ninv_chg_x_resolution: NINV
unur_ninv_eval_approxinvcdf: NINV
unur_ninv_new: NINV
unur_ninv_set_max_iter: NINV
unur_ninv_set_start: NINV
unur_ninv_set_table: NINV
unur_ninv_set_usebisect: NINV
unur_ninv_set_usenewton: NINV
unur_ninv_set_useregula: NINV
unur_ninv_set_u_resolution: NINV
unur_ninv_set_x_resolution: NINV
unur_norta_new: NORTA
unur_nrou_chg_verify: NROU
unur_nrou_new: NROU
unur_nrou_set_center: NROU
unur_nrou_set_r: NROU
unur_nrou_set_u: NROU
unur_nrou_set_v: NROU
unur_nrou_set_verify: NROU
unur_pinv_estimate_error: PINV
unur_pinv_eval_approxcdf: PINV
unur_pinv_eval_approxinvcdf: PINV
unur_pinv_get_n_intervals: PINV
unur_pinv_new: PINV
unur_pinv_set_boundary: PINV
unur_pinv_set_extra_testpoints: PINV
unur_pinv_set_keepcdf: PINV
unur_pinv_set_max_intervals: PINV
unur_pinv_set_order: PINV
unur_pinv_set_searchboundary: PINV
unur_pinv_set_smoothness: PINV
unur_pinv_set_usecdf: PINV
unur_pinv_set_usepdf: PINV
unur_pinv_set_use_upoints: PINV
unur_pinv_set_u_resolution: PINV
unur_quantile: Methods_all
unur_reinit: Methods_all
unur_reset_errno: Error_reporting
unur_run_tests: Testing
unur_sample_cont: Methods_all
unur_sample_discr: Methods_all
unur_sample_matr: Methods_all
unur_sample_urng: URNG
unur_sample_vec: Methods_all
unur_set_debug: Debug
unur_set_default_debug: Debug
unur_set_default_urng: URNG
unur_set_default_urng_aux: URNG
unur_set_error_handler: Error_handlers
unur_set_error_handler_off: Error_handlers
unur_set_stream: Output_streams
unur_set_urng: URNG
unur_set_urng_aux: URNG
unur_set_use_distr_privatecopy: Methods_all
unur_srou_chg_cdfatmode: SROU
unur_srou_chg_pdfatmode: SROU
unur_srou_chg_verify: SROU
unur_srou_new: SROU
unur_srou_set_cdfatmode: SROU
unur_srou_set_pdfatmode: SROU
unur_srou_set_r: SROU
unur_srou_set_usemirror: SROU
unur_srou_set_usesqueeze: SROU
unur_srou_set_verify: SROU
unur_ssr_chg_cdfatmode: SSR
unur_ssr_chg_pdfatmode: SSR
unur_ssr_chg_verify: SSR
unur_ssr_new: SSR
unur_ssr_set_cdfatmode: SSR
unur_ssr_set_pdfatmode: SSR
unur_ssr_set_usesqueeze: SSR
unur_ssr_set_verify: SSR
unur_str2distr: StringAPI
unur_str2gen: StringAPI
UNUR_SUCCESS (0x0u): Errno
unur_tabl_chg_truncated: TABL
unur_tabl_chg_verify: TABL
unur_tabl_get_hatarea: TABL
unur_tabl_get_n_intervals: TABL
unur_tabl_get_sqhratio: TABL
unur_tabl_get_squeezearea: TABL
unur_tabl_new: TABL
unur_tabl_set_areafraction: TABL
unur_tabl_set_boundary: TABL
unur_tabl_set_cpoints: TABL
unur_tabl_set_darsfactor: TABL
unur_tabl_set_guidefactor: TABL
unur_tabl_set_max_intervals: TABL
unur_tabl_set_max_sqhratio: TABL
unur_tabl_set_nstp: TABL
unur_tabl_set_pedantic: TABL
unur_tabl_set_slopes: TABL
unur_tabl_set_usedars: TABL
unur_tabl_set_useear: TABL
unur_tabl_set_variant_ia: TABL
unur_tabl_set_variant_splitmode: TABL
unur_tabl_set_verify: TABL
unur_tdr_chg_reinit_ncpoints: TDR
unur_tdr_chg_reinit_percentiles: TDR
unur_tdr_chg_truncated: TDR
unur_tdr_chg_verify: TDR
unur_tdr_eval_invcdfhat: TDR
unur_tdr_get_hatarea: TDR
unur_tdr_get_sqhratio: TDR
unur_tdr_get_squeezearea: TDR
unur_tdr_new: TDR
unur_tdr_set_c: TDR
unur_tdr_set_cpoints: TDR
unur_tdr_set_darsfactor: TDR
unur_tdr_set_guidefactor: TDR
unur_tdr_set_max_intervals: TDR
unur_tdr_set_max_sqhratio: TDR
unur_tdr_set_pedantic: TDR
unur_tdr_set_reinit_ncpoints: TDR
unur_tdr_set_reinit_percentiles: TDR
unur_tdr_set_usecenter: TDR
unur_tdr_set_usedars: TDR
unur_tdr_set_usemode: TDR
unur_tdr_set_variant_gw: TDR
unur_tdr_set_variant_ia: TDR
unur_tdr_set_variant_ps: TDR
unur_tdr_set_verify: TDR
unur_test_chi2: Testing
unur_test_correlation: Testing
unur_test_count_pdf: Testing
unur_test_count_urn: Testing
unur_test_moments: Testing
unur_test_par_count_pdf: Testing
unur_test_printsample: Testing
unur_test_quartiles: Testing
unur_test_timing: Testing
unur_test_timing_exponential: Testing
unur_test_timing_R: Testing
unur_test_timing_total: Testing
unur_test_timing_uniform: Testing
unur_test_u_error: Testing
unur_unif_new: UNIF
unur_urng_anti: URNG
unur_urng_free: URNG
unur_urng_fvoid_new: URNG-FVOID
unur_urng_gslptr_new: URNG-GSL
unur_urng_gslqrng_new: URNG-GSLQRNG
unur_urng_gsl_new: URNG-GSL
unur_urng_new: URNG
unur_urng_nextsub: URNG
unur_urng_prngptr_new: URNG-PRNG
unur_urng_prng_new: URNG-PRNG
unur_urng_randomshift_new: URNG-RANDOMSHIFT
unur_urng_randomshift_nextshift: URNG-RANDOMSHIFT
unur_urng_reset: URNG
unur_urng_resetsub: URNG
unur_urng_rngstreamptr_new: URNG-RNGSTREAM
unur_urng_rngstream_new: URNG-RNGSTREAM
unur_urng_sample: URNG
unur_urng_sample_array: URNG
unur_urng_seed: URNG
unur_urng_set_anti: URNG
unur_urng_set_delete: URNG
unur_urng_set_nextsub: URNG
unur_urng_set_reset: URNG
unur_urng_set_resetsub: URNG
unur_urng_set_sample_array: URNG
unur_urng_set_seed: URNG
unur_urng_set_sync: URNG
unur_urng_sync: URNG
unur_use_urng_aux_default: URNG
unur_utdr_chg_pdfatmode: UTDR
unur_utdr_chg_verify: UTDR
unur_utdr_new: UTDR
unur_utdr_set_cpfactor: UTDR
unur_utdr_set_deltafactor: UTDR
unur_utdr_set_pdfatmode: UTDR
unur_utdr_set_verify: UTDR
unur_vempk_chg_smoothing: VEMPK
unur_vempk_chg_varcor: VEMPK
unur_vempk_new: VEMPK
unur_vempk_set_smoothing: VEMPK
unur_vempk_set_varcor: VEMPK
unur_vnrou_chg_u: VNROU
unur_vnrou_chg_v: VNROU
unur_vnrou_chg_verify: VNROU
unur_vnrou_get_volumehat: VNROU
unur_vnrou_new: VNROU
unur_vnrou_set_r: VNROU
unur_vnrou_set_u: VNROU
unur_vnrou_set_v: VNROU
unur_vnrou_set_verify: VNROU

unuran-1.11.0/doc/unuran.texi0000644001357500135600000000306014420445767013021 00000000000000\input texinfo @c -*-texinfo-*- @c %**start of header @setfilename unuran.info @settitle UNU.RAN User Manual @iftex @afourpaper @end iftex @footnotestyle end @setchapternewpage odd @c %**end of header @c ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc @c @c Some data about this software @c @dircategory Scientific software @direntry * unuran: (unuran). UNU.RAN -- Universal Non-Uniform Random number generator @end direntry @c Version ... @include version.texi @c ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc @c @c Copyright @c @copying @noindent Copyright @copyright{} 2000--2012 Institut fuer Statistik, WU Wien. @noindent Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. @end copying @c ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc @c @c Titlepage ... @c @titlepage @title UNU.RAN User Manual @subtitle Generating non-uniform random numbers @subtitle Version @value{VERSION}, @value{UPDATED} @author Josef Leydold @author Wolfgang H@"ormann @page @vskip 0pt plus 1filll @insertcopying @end titlepage @c ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc @c @c Table of contents @c @contents @c ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc @c @c insert automatically generated documentation ... @c @include unuran_src.texi @c -------------------------------------------------------------------- @bye unuran-1.11.0/doc/stamp-vti0000644001357500135600000000014114430713446012453 00000000000000@set UPDATED 21 April 2023 @set UPDATED-MONTH April 2023 @set EDITION 1.11.0 @set VERSION 1.11.0 unuran-1.11.0/doc/unuran.pdf0000644001357500135600000365734614430713525012641 00000000000000%PDF-1.5 %ÐÔÅØ 1 0 obj << /Length 587 /Filter /FlateDecode >> stream xÚmTM¢@½ó+z&ÎÁ±?tBL$ñ°ãd4›½*´.‰<øï·_•èÌf’W¯_wÕ«îrðãc;Šòê`GæUŠOÛV×&³£øç¾öƒ¤Ê®[vïÖæ6ïWÛ7ñÑTÙÖvb¯“uYt/N¼.³ó5·½êÿ¢¥=åS‚> stream xÚmTM¢@½ó+z&ÎÁ±?tBL0ñ°ãd4›½*´.‰<Ì¿ß~U¢Îf’W¯_u½ªîvðãc;ZäÕÁŽÌ«Ÿ¶­®MfGñÏ}í I•]/¶ìÞ­ÍmÞ¯¶o⣩²­íÄ0^'ë²è^œx]fçkn{ÕÿEK{*ʇuÄpg6;µÞ$4»¢;»µgZ8, ’ü²M[Tå›P¯RJG¤eWxm½ñ­ž÷ŽE™7·¢â žÒ"/²îÑ7»¸¦‘¼ýj;{Y—ÇÊ‹"1þt‹m×|‘£o¼irÛåI É‘c¶×º>[TÒ›ÏEnn#×ÛûþbÅø¹‘ûÒî«¶BS¬ØEVå¶­÷™möåÉz‘”s…«¹gËüŸµ)gŽÏR©ð133wÄ xAÄbêí;¬ÒaGL6K& 0+‡}&ö"?‘á°(Ò¦Òa/ ¡cì,•!£½¥‰î-fö3¤Ù*IÃx {aªùð”sIC%ÒðhSô¢¨7å£Å}­HÏ=ŤIYƒ¹(îƒêjŧ ÿZóéàü4{ÖØSOØá5˜‡áZ ä®ekxvKº·Ǭü÷…Ü@2aÂ> stream xÚmSÁnâ0½ç+¼$z Ø¨"¤€ÄaKU¢Õ^C<ÐHàDN8ð÷õÌŠV{Hôüæç=üúØS`¾Jñ m}u%ŒÒßE Y]^/`»w¦¶oâÃÕå:1L·ÙÖVÝ‹omy¾èUÿ­àTÙ ÖÃþŽv¹Êó‘DM^ug{¦…Ç‚° ÉpmUÛ7¡^¥”žX[“ÖôÚã{=1î+kܽ¨8 …@iaª²»¯è_^|Ó˜¼¿µ\¶öXq,ÆŸ>ØvîFŽ^‚ñÎp•=‰!9òÌþÚ4gÀêBË¥0pôùÞÞ‹ ˆñs#P~k@hZ+vQÖÚ¦(ÁöA,åRÄÑf€5ÿĦœq8>K¥Â_¸—žX NˆHæžÐÔ3$¤Çž˜{<Ý0Š*¢5cÕ~ÿP÷õʯÂùÝ5WÂ42^!ž0^#žrq‰xƘœE„3xÎü ñ ªz“)cÒgl1BÌîÒ°õ•?ŸXqû!òŠNA‡¨Wš»A*dý1ùÔ)iȧΰÅç“Оó â9ç’†NVf¤¡–kô¯VäaŠžUJü†ôì?%Íš5Ø»bÿTW£=ј«±®–¾Œ¿É5ëñ2éfè&p2pj³V^ócH£Mc†VYxLS7˜E=›þ1âj· ¾gÈÈ endstream endobj 6 0 obj << /Length 348 /Filter /FlateDecode >> stream xÚ…‘ÍJÄ0…÷}Š,S°×$7¿ËtdЇŽ.ÄEµíPè¤Úq®|u“fêFQ áör8çË ',|œAŒE°hÈË>cÓvÜ‘4l–?é¤BPÃü§¬˜uGpòÓ"¤F;°. /ÊìüÊ("he)Ûˆ§‚a–”5y¤Ûõ6‹u^ Qt{hÆ4ÝV>GNUŸ?•«ì²ÌÞ¾C‚…r Úff „!elH›Ý¥p¥gà˜ã1…é,QV7&,ߌÕ{çw!‘úÁGߵøO‹±òõ0Í’ú\XzÜÇó9/ÂÙŒ‡HH4&UhI€S<9ß磠|râÀƒì,ýž,¯cןVL`t›JãPj¹ ä*=‚Ôºä¿M›úºi>ꡯ'(Tx«$zȤCßîªé‚A{ý™+-h¸_åý¯õâG¹œÃ¹Ü/•€Ž endstream endobj 13 0 obj << /Length 373 /Filter /FlateDecode >> stream xÚ}Q=OÃ0Ýó+<:vý'é ¢&E À&nkµI*Ç©„øóؾJ”!wïÞÝ»wæˆù£B ¢”´”ªÛ„EÔnOw Ÿx™’TeÒÇÿÒˆ*òÈÙÔëe2[(…8£s6çh¹²eN‹Ò' zÃ7ý!%þ´f³ K?–HeT^’JQ¯øl‘g糈¤Lzé3Þ;ã ¨eyæ—Ëý¦‘%c_‚q‘)%¾ïgÜèB–áõ˜r¬S±…ò³«œñŒÝä¯/ÓßèŽÆ}I®¼¥žSžÆc°£mk†Áôï`›!üÞØªKEnp=ÚjÛ­ºàÆË[³ÝT8†fmW~¯º?=»_OC·f8íÂØ±ÚC~ðm†Mó³ÃVCµžÞ„DoÌ»’”«éÁ~*Þ ë©5Öõà$,ƒ¹¸ÂeÕÓêAÛctß@íįö{Àd> stream xÚíœ_sÛ¸Àßó)ô(=%þƒ}sÛ»kÚI¦“ØO½{ %:a+KJºI¦_¾ €K‰€!8ÎE6çf"™'î®ß.vKáI¦ÿÃI&RQ¤¨œ,îßd‡«õ§IûæÃ/o°ùÜ\p>ù—ë7ú™ó ÎPžåxr}7á„ Ž©“w½œü{ZÍ~»þÇ›Ÿ® N8âŒFjµŸ>Q-µj‰æ¬QÝüD ¬ù©Ñz=ËÙ´¸]•³9•|º¹k_ÿºYÏ(žîÊöeÛØÖŠbˆ2AQÙdÎ0ʘh%ݼ¿A®Þ·÷ÿ¯}¹YW¿7Êz[¬ÚKï7ë¹¾|·©ïÛ úžåƼ?hÛßÏ(™Þê+DߨhžP‚ˆÌ'sÌQn ÿT®ËºØmjcÎ2hœä(ˉ¶ñðá?ÏæXÈöEô~zâÅo*ì¥x̱ÆI6"G™PŽ×ÿO¯þ“Ðý+=²Íýs À‘Ý­ø±šÃÂcŸSAc"œ*¬Z;•  •[­sŒ Ÿ¾m½§Þh–ñt¹_ì*íWC¸âÆEÿ–¼Žhú/ú5‹˜Nh' D(d…z ÆÄz¤º¿ã(¡§ÖL2D86”¢†Ó,˦7ÛâS³PÚn”MwŸ«m{e©é%jºØßëÍ@¿Ùµ åcªä"‘ß cíâ]ã„8µFÇÒq6þæþ90˜õôÕ<‚?0&ÿ j‹&‘ƒŸøß®·»bµ*ºØÜG[eHä?nd~ qúÇÖàó–Lé¾boyJÇ«ßOœ1^Pj|„çiÜ“P·CTëOí~°û\¶[Īº­gxZÔ_w„lÜ^¢7l’Ý¡»?àMîs`I„GõZ—Ð[€Ìmn˜ñ ]#/ʇݶŸ8Ù2Ø“$±\½—¸x >Ð é¤wB¨Cæ„—u`L ìAÕ–v!‘`¶~F¼£ýý‹­tð7[A±ß}v˜#è E˜²ËªlG·:\<)“´#äü2¹½ ¹À‘šÄÌëÀš8Ò}ÒÉá:Jsnš²Ätr~úRÜ?¬Êá^£ÞBð·­Ɔγ’,G,cn-Ï&ÕÜ?†:GjZR½=GhM ©Gº‡£5!c³O×ѹ2YÉV‡e¯ séáÐÎÙl·UÓõŒØdLS.tƒñElCIzÄî„"6„¯kbü ¨Ûú.7sÛõ'®¹í‡K¿f<û¸«]©{õ¯·út­—>:Éw;D2ˆ™uN'¹"â„™—d`M ÉA݆d–s¤°#Ùv`>–«²M½é´hI¾/uÖ} x9Ü¡cçò ϰÜ${ðŒžØÛ…ÖDxFX·õ E63w}˜G<ãìÈ® FÈè6„ÛfåÓÙî„؆€aéeXÃvP·e[äˆcaÙ¶]—«ú¶ÚÕM‹½=‹­¶âÛ}sV5Üm¡Zܘ»ÿè|˜Ò1ï„0‡¬aåÅXƒyP·Åœ D…Ã\Ä`~n'Y†ä˜š?gn—1ÔN@Ô-Þ ´&Ô n *£Í̤UÚ.øçbmGeŠºÐ‰FYoÛ¤£=r¤ôÑü<×)ÉÆÒïÕ±kšNm' DmoZCmP·¥–êß@0K­z*µ¡—C/gˆføµ"íãάJ:w€w½Å÷ö, 51Üu[î°~ÅŽ»|€»½›ùÖ?ÔźùÖ8¹AîቿÛXŒ}¯Ô¬d:«€«=`¼çÛКVƒº-«ERSfOL²3‚ä~½,ëÕW—…ÂDu8ê¿yíå˜5³é¨uB¨õÖÛ_íkbP ê6¨Qá m½EÍžÎ}<&[ÔªcÊŠvÒ¢Ò[ò®ZœFÌßg\L‹º*vå`€PŽ(cõìB%£Pìñ@½õ ´&Űn‹¢”ˆ ìP$Ï€â¹Ù¢ÎµMòò8õQdþÆéuBÁ¥¤ÞÁ`hM EAÝ–"¡ó{ÜQd§ÞmjÃPÙ”9=RÉå™ ;²°¤»C' äIê=‚ÖĸÑî“11ª7YbC¹™sqOºgÿÊú®X”ÃÏüQŸQ}Æv¥™Ï2k•<ÖÝëá=;¦ÄPØW<“±BRYÅnìãW3¯û¥?Ÿ›èoÛ@F"6ǯ§Ÿs|±Ö@k;¡XÛcÍ9°&†ò n‹yƵ 6Ì»¯¿Á üµ|ˆf­'{- ÷—ÙûòáoàHÇ¿Â2Èüõ°&ÿ n¬‹$¥Ô„äÙax¿‹óÿ,¿šÊënS·!ÞúÄLçÆ-XÈ-¤®™Ýâ;2šMf¶»?€,ÄÆO,0%Ø b®‰Ì%ö;ÜãÏ3ÕtQQá:#O8Ç#ì…ÅpKLº?tBÁdÞî ´&Æ%‚º­O°t>aç߸ú]"—H%§ã#¯—ÙV´Ø¤;F' äNæ=’ƒÖÄ8FP·Kn8=œ“YÏe7Ö]dë.&³Ñ¹Îð&Â$gàÿP >¬Íš§cÝ a Ñ ` ¬‰Á:¨ÛÆ{š#%¥¥ÚÎôÞÀIˆïqk†}©‘HJ5¦B—ä(>î éÜwBÜCø¸wZÃý‘î“¶8ѦHeÔ2Óÿ{±^®\g|ÙoÙ4ß:y;› 2ýO©??]솟²nNµÁ/ù+ò<íkû7Mî_voé¸÷ ZCÌ‘îÁH‰óƤÝî«Å~@§ÅjÕ¾ùoµ^Z/Oš‚ a\hÂ]G#Œê;¦ ¸e×(9n¸ÕC{[ÌК ú-… #œ; ÉÑ7ŸT‡—ýfohÛ7_nëÆbÐÉ9ÊéHÚóï³v5Óyí„x…ÐðÜË+°&†× nË«P(cv¯u=¶sxÝÔËÒÔUÛ]±ÓôV‹á™inVx†™[»Žé¤vB¤B\„·‚ÖÄÔmIå ©\XRÙ#¤–÷U]-Š•?—™@«+¦@¬m6uEÇÓë`”4+“Î^' Ä@ø£$°&†½ nËÃH2nÙã°wøqµ@®©ÏÙÞ›0)Õø­—Ï&ÍB¦£Ú ¡ y‘Þ/s‚ÖÄ ÔmQ% ñÜ¡*6ô»½­‹›õ²j@mÃ(s¹©=ÂWH]Þ‹Wú3+ÎX' Ä\hé‡ÀšÆ‚º-c˜#ƘeLž·ÃèÈ5xMH<Ú“CÑ‘S$dþZÛ˜>æÌФ3× 1^ùã°&†¹ nË\FÉ©eÎ>–úîªéï\¨¾D»y=»ëÅ×ú>Ü é¸wB¸Cæ”÷)lhM îAÝw•#Ìíy7©¸¨Ë] k~fóHá'> stream xÚíÝsÛ¸ÀßóWøQ~ŽK€Ø7'NrîŒ?2iûÀØL¢Ö’\JJ.½¾ ‰¥LÀ’4rìÉLLÓ\îûób±XR°—©°'ò=!)‘Tì]ΟdÝÙæý^púò èë¦êÂ)ºòéù“_^Åd¤ÌJØ;‡ou~µ÷÷Él¶?¥¥Ùäâ䂜œ¨o)›\¬ê¦=¢“ãj±ŸËɦºÞÿçù_Ÿ©šYµ®Wí/ôË È2lË Â@(£;ýQú¹è¿p÷ÝöPd%a³¦·CA õ3’•ê?È»1ž Ž–Ÿ¢Œ ζšÎB)¼ŽAÖÄ8fK÷ÉIÉ”jF “¥v5 Y–MN—å€zÕ3Ó»FaT]_÷g´–ªåÛýiÁ'ÿª/×Ú œbe ´±"¿Ã _t2UîiøÎæn£ ãÔy÷‹ùÕòStƒ†¶ÕÜÅ/²&†ß nÃ/Í¥Òð›k~ÚwqþªÇöÏžÒ³úZÚÏûø£®ºêOT›õr®¢Î¥büóÃyûǺà ïö„Pí¾t@Ý B€bJÊÌ (²&Рn(ÒÌ~„j@à K'—K5C‹Éz¶“îh³ÜèkÔ4øq_Ú~Âëᾚ­ÖÍì­ºX…ìåb4þæ…št€'²{ÏBm|tÔ®I‡ÏÝ & /|Èšø‚º!"¥Ü#uôÙ þà´¯.z®þìQ:01°?{ª—ÓWï¦}öµº:ÇXãTY?%k>ô(§ƒän ;³,¼ !kb@ ê6 ñ2S_¹Éδ§gC†®ª›µ F*P©ÐUk’ê65TÑIOÄÕüæºÍïÇðQǶÿ©,NÚ-$šj±jËj&×;¬«Ùº­š|Þ®šŒ–Ùr’sùsQ<Ž“ìTœ¼§G¼‹lLNaÝ'Y.NižN¶W'›yÝ´»Tc „Ñh§Öôqþ~ÑÎ8/O'Àà]¾`cbð ê¶xŠœ(A³‹p2¶‹pRÍúpØE`vAxv#¬x8s´­~à“ɲâ°o!÷n"Kb° )¶T%¡¢DX™=…×ÛAïõ~W#ù¼XÎg&ò}¿ Jž‘ýÀ Ї=\É08ù Ø'{³~lL AÝÖVÏ1¦²6gÎfó›ëú«¶*Ûê¬,luÖ x2RN>€ö*äþ™ ƒTP·EŠR’ ‰2Uÿ³³Ó-šöa2owxnÔÁµn®8«×››ˆlÔ<úXæø>qO»0R'€sÔ? "cb ê¶nm!5{Ý:ñàéïˆT:©z4»}Jõ³z˜OÙ†¶O³õ‡þèfV_ÖŸf+}åår±Z÷]ÀºîC5Þ¶I3Nßµ,̃ ¤·êv˜@¨[vK‰ÆÄ?=Âuê†u[L”7„À˜˜]„íšC‡Æ°¼ÀlyAÆ•Ú:Ý÷aü_š‡8ídâœ|€8ìt þÙC\P·!Ž•”ð5ý€Ù¸ØFîb135.“ ‹\šBv…2' îa‚6NŒÏTb¼Ÿ˜Ó€yc6&‚˜°nÝìÊdF˜°=쫚]ëùÍ UºúÞ×õ¾Fô_´»áeÆïQ;™‡=°Éä8ù9Ø{À˜—dL 9AÝ6ÖpAhnû(˜íT}~üú·Aþ£N8.lÿóFd %?¿ÕÍ¢Ö­æ=…ËõÏÞÍr’I~Ÿº'ÌÀ%£áäh`ïóNCؘ4‚º-…¢A 4r‡ÆïƒY蹂`œŽ®%õ6¿ÏuÕ J¦ËoXWƒ`—Òczð’ñpò<°‡ ð.Ÿ°11xu[<,§j;°Î†ý Ý •/ß7Õ|ÞŸë‹·f<³Œ?Q!ÿIüô0'ƒää a_Bám„ÁÆÄ€Ôm’—\)lÓAñUÉ˼k½^Ûœ¥k®·‚’·m”S"9<ØÂ¤qE2kN>Àö7þDÃZP· ZÀˆÈl6Ý9~³ÝŽ|ܦ6Фng¿¿¯ïSn÷{=Pª”º ›ßbêÒnKåÒ‰û±Äd@Á}T"K"  *¶L  „cÒxÞŒ6‚ëü‡Uß"&_µsKÛc¹Û+/=XÉ$Xñ ÈPxWåÈ’BŠu®LyNìV½Ùˆ8®šw­}Ïc¿ÝÔ¨fºùbÕ>ûY7«­çñ.=Ï\Í»´zŒ£»sªlÌ~ü³W:ô&ãáä|`7÷®Ë±11„uÛ`Á$)¹Ý{ç6Å}yôôéð¡áÛÜÐÉ3à k3žö ’Ó®(#R!ú@Û»=´i_$Óæä´a‡÷.Þ±11´u[ÚhA$ Úr[:ï'§A®4©Z⺕<†N‰OÕRjÚl†l»’hç±™ÇÆB’(I)"÷³<žÔ¿g²'|À“x0{_lLŒ'ƒºÍÔ’ç„s›dˆo¹‡ÔÏ&ýr:a3 €ˆb·›R=Ðè1M†ÆÉ ÁŽ^z¡AÆÄ@Ômÿü• Ø­ja'›7·öþ‘Yßz¹^6ê;HÜ<øÂ­¥ö<âÛÍKOëqHö´“x6 GÆÄx:¨[‡‡ö ”[G˻ÃòâeS›ÚëíW(Å<ÆOKÂäãûë࿤‚‡äýà œÂ[²ÅÆD€ÖmBL.)ÉÁ67HbÛâ 2Ñ&‡ˆ::|³Û~Îð1ï_”’?„¾ÌH'³ää,aw‚ð>ð…‰a)¨Û²$ÔoÀ™c)°Ô½½p€S;i¤Ì”¥°ºžU«®|ѸÌõ®®÷ö÷/_døÅTjŸ%SéäTb0@xK:ؘ*ƒº-•…šcQij·_ðf¥aàëÞ§D‡ïSÒ¯ŽŸi%(‹ïßDëAFh22N>€ öï˸°11Èu[d%‚S‡Œ) ¾3À^nfWx«zkžè¹ÕÏÞÞ`¶¸ªÿ0 Í«ºjúâbw¿Ñ ­bß…ãAEd2*N>€ öHþ„Œ‰A%¨Û¢B3Â!w¨˜‹ÃÑÇ»†qÄ=ìźR‹ší–ÝÄ÷Jùž-õM€eNd.ïÃèaEd2+N>À vHo ÃJP·eé^’nXá–•³‘°¢Xµ0lE—³ú?›Zï+˜éç¬bò!òAú°öF=Äi$çäÄa§ƒôgäȘ₺-qYûŠdpÄ KÜV?ÎV`Jx) ¥„Óüq‡b@˜ÿdœ|€0ìdÞ­slL aAݺp%W ,ï®[Ù¹hg´J!uY¸/wºYðA< ¦½›J¯÷ËéMó‘%è›Ø¨$Ëìn隟½:6©Zhé¤ýa_ËÐQü‡oÓ6ûI_žͰ'CåäTaß‚ôîÚ`cb¸ ê6!‘3" ÷á3ÙÝAÑ}Pê#a9¹–ïAM{"5'@ »üŸ„€‰A-¨ÛưˆÈ¤cͱ‹“£±Å­îÚ¶³Ò Ø x×·.u{ÌoâîÓ’Fw•Û7"ÂŽ¶)™aKÃÉÀÀ¾Ò[–ÀÆÄ€Ômb•¤(l»}µ•ŠA•nñE£äÍDÚ½î±ÝöNø´o’ásòø0PzÛÿ±11ðuÛ¨¤.g¢Ï¥VG[%÷î„TÌ5õðɵ»k—'¥#î[~¦†Dû(™B' ƒ¥weйEáÿK×è£ endstream endobj 249 0 obj << /Length 3449 /Filter /FlateDecode >> stream xÚíKs¹€ïþº™<;xÌ+·Ý-[qJv¶lmåä0’ÆÔTøÐζ•üù`f0@“4[ìµ,–«d>Ðì&úCùI¤ÿñ“Tœ¤™d™LO®/¢îÕzvÒ?xö‚›r§ºà)(ùËÅ‹Ÿ^Çñ XåüäâãI̦b÷y×'ÿœTU5ý÷Åß^¼º°‹˜ÅJõ¥÷”§Z¹bR%¢UÞ~8g¹0z“é)ç"žüÞTËÙôT¦ñd³¬>®êEÿ¤.–×+óx9•|²YL¥˜\êWĤ¬û7f岬‹õªnÚïðÓkEP§Šñ\j;;•Ñ*“´ÿ/ÙzöÀ÷‹ìÖhÄ™”ÊÖ@[£,Öï±(׸èªvû•­:6ò§àFêxWM÷­yžz Ì¡8xGù6]YÂr¥u+ÉT–'3®k$Тɇjq;/µ×¤œTË©È&ë²þX\u/©‰ö{ÿžc@?± èÇZ&mÐ’šý·4» $Z%r¡m<*%Aö@ÊÏl%ߟ£NüÈʼnm%]ʼnHx)ÆP(BuÉH“œ  CÑ›}rÖ«ƒ³ç(AjÒÉ”q]¡ñ“%hûEO¦ºƒyròOЧ"’^ž€1žPÝO<Õ& ]“÷à Ðчª)ŸôÑJMþØMu ÃÔmGÖÊ„¸q Ò”%œÿ @áqÊT{0WNá úVD±—+` …+T÷ÀU¤X$-Wê0W_/ wÎËåõüecÀitA=ÊÑt]¯N!nIýE".sðóÌ<€˜ú ÄÉ#€@'a€c(€ º I±,K@âÀœ¿|uµ¹›v~àxÿîìÃÅûW?¿í‹îŒ‹‚èPŠeIö-é'`¨ P€¼Ÿ€-/ˆ(ñ!€ëÐá>•ñ@@bøuÕû¬Zÿ·=Gj{Žþµ¦\ï8³ú¹Zßì£ÐÜT=]NÜv9ùÕå`æa͸"˜5'°ý-"oò¡°¶£{/»NTÆÍ[§7²ëw¿³÷?¿ë³åóê².ê»þÉêcÿ³ÖõuÿìºjÖuu¹YW«¥'§V:¡Šø×Í©=éóðƒÓgðHú¼U“"ʽæP<¸£|ÚÆÓFÀÔF@yÏÈcÝÁËä8â ëØ3ìä†!FÃÀ èn˰Êô7€ «Ã Ï‹Ûy» wlG²T¤; Ÿ›òÔ…"¥LÆÇ<é1S¢ÁÑÁ(;yeH†20†‚2ªÛ¢,ËUPŽ (¯fšÇñ1Ãèdäù @ÝÌÒÂ,by\âyŒó1ƒƒ)vòÅ$Á½Ç 1ŠQÝ–bÁYšÃý‰ ‰âåª^Œ¯÷t3 |ãÓw½d·I¥Ž ŽµÆ‡Á”:y„R F)0†B)ªÛRµ[³!¥)…ÒEñÅ;¯*ömKïÏ«ÚÅßÚÑqQ—Ã9 ýRÃV寮Z-¯û×þS-¯»úу†ÚÞÇ_÷@bª0'@ý„AŒ¡@‚ê ‘yÌTvÖñì0$þ8¶·µn$~éàµÁF•"“ÇQeúèËHƒ§CYò~–·pBX†ÆXÆu[–3¡;?°ˆç‡Y¾í£…åí`æ y}@ksU7ëçKåsØ_äÓ¸-L'€ ÙÜ{XCÕmÁLòn ÙíÜ'¬Ý®>—õmBºYìwʦ«vFês?1_z÷ µ¼~Ø\š™Õuµ¼Çº¸~­¦SÁ 8yè+ ` T·%NX¤ („%œº¸›—Õ솜¿/ºí½mŠ’ëg’ÓŠ‡õÀÆ»Áü:y„_ˆÆ/0†Â/ªÛò«Ër°3H…šyÑÜSŽ]iê,¥<‘Ç% o›[ƒîäÐ!k‚{¤Cc( £º-è"g)ÈšaU©Yo®uWNž‘ÿЕï:ì—æšž5uåS°„'Ï|¿oð4¼qn0½Vðƒ±ë,¡ ‹)¶äò„Å`“ˆ ¬%iØŠål3/jò²ýÅ4“'FÄVWlv'£ü6ÔâÑå‡L²>÷Cžã,žeÈûYÞÂIô3õc,Cc,ãºÍ>í\Z”ŃïðYtwßÎ×U¶ã^7ù´“ï{ àÁÄÔb0&NÁºJpïUOÐ &¨nòÉòÌnV”»{®V·z”H»ª¡/jOùìžßíÞn’Û¹7wQÔ³jYÌïÚ¢h§Ë¾O¬<<™ÚæÉÉ#>ÁÙP\¦êƒárò\п\À \¨n —P,–±ƒKáòoÐðǾ¥Ý©A‹yÇ+òî?:>ƒôÒÕ^Jûƒ¢ñgÜ œ“G€ƒ>Ç€ÆP€Cu[à´3Ép„$z¾šéqàúfṨ`,‰>2äã¢=£‘óè12ß‚Étò™!¼×^Ac(d¢º-™:QU™“F/ËY±®>•Ø(ttêð]/8.LÛ—Ræ3ÇOéb`U}CeŦ€[1¤œ%¢0Å(žkXP„{HoWUÓ .'l6ømÚýž“jÝ~™fµ¼Çžƒ$;nI|üƒ]ÆëÁH[qi†´³„‚4¦x˜Ü‰ÆS»L‘'wàOˆ-ŠvèWŽÏàpÕYsL¶„ qS0ƒN² „÷º+h CT÷ZsÉ"aûjEÛÕP×å¼p‘0ˆ|~"Ê;Ž¿Œ',ºwxFË1ã…BèÄý B %{þKN¸ endstream endobj 9 0 obj << /Type /ObjStm /N 100 /First 852 /Length 2438 /Filter /FlateDecode >> stream xÚÍZM·½Ï¯à1¹pXŸ$Á€A¹$€aùGÐÁ‘Cèpþ}‡œ®Ü/ä°Û3=Íz¬êb±ª-¤ ¡æ@È)ö¬a d!§ŠBa ”C|+’I |$÷' .‡ÑR=0$Ä1qÎá2R%4y‚Ù14kh?¥Rã' ŒÂt’„!’ƒ@¤G ʽˆ\,†ÖDAð1aNâxµ!¬ø‡¹‹ã;†hÎ'Mx´JP iÚ(~*˜ ¦$7Uƒ&ËAq‹2žs<‚yA”⇠?A9Å-—|2X,c^†[ó2ÆOEÃåVJ¡™ ß3®ø‘0Ð@†{³1 VÛ?dz™N°¾SqKpIj ®ÍºM˜AM‚¶îÀ£ÄÁ³Ã€xÌKiw4xmï3ÍD°yò™ë‰RY ¥²bZí³e¤²×öº)ä‚ /,×öÊ ¢¤öš¡B!k^nääÁêÅR»SBqÜ&L·d¼‚7”“,VªþPS†@H¯T!Q…šÛX¨ÚüÕ”O§¨nmxWæ6¼Â0KS A;’¦w“Û^;l‚7NÒ4˜˜¤i¬¹h¦³ÒF4“åi¦*͇ۨTÛ¸‹¶ ¯‰ðv`Ç8mÚ5·&ø ŒÒLÜÞþaDS¶g^>y{þ¥MOÏžÎßÿçßwáüíÿ¼;ÿtÿöÃÝÛïƒc±}w:w÷þþã»7wï±ò.7þz÷ÓÏ?~sÿkx•p¾9ÃÔJ±Ô×'Hy‡á˜ìå鯾º¼€ÐðìY8¿ÀûÌí|ÄÛ*—xèüí»û7/ï>„W˜ÇóáüýݯÂëëøÃ BµOfÿØ0Ňy_4ЧÌÑê§s´ü;æxþúíÛ{ˆ{Õ‚\›y¿t[RŸ/]À§ú…ú…ûEú¥kÃ] w)Ü¥p—Â]Št)Ò¥H—"]Št)Ò¥H—"]Št)Ò¥h—¢]Šv)Ú¥h—¢]Šv)Ú¥h—¢]Šu)Ö¥X—b]Ê'ö¿êt~ùñ.ßÿòóÛÎßÜ¿ûéî]7uzÝ^ǼF£«ÖÝaüÒ`4LÎs‰Òxîë‹G¼ ç?ßÎÏÃèÍž)½Ô¤â»ñ!¤<’Sl;¢vÄ’y@ä(¿(bÊ‘n€¤ÛÁ—´ŠÕÃÓ‹LñùÒ6AÂW|ò+ð| éOõKÏ@jM±h=†Ì› á´‚tê3ç˜êƒÊ&L\o¦UW\C§M˜ØÀÓl[K1W:ÆÜ䵊P.’o˜RàÅÇ‘–w¹-®HÁo˜¬Q˱ñ¦À§ç®&ô^`nò!A<×z‹R±‹–r¼‹mò!ɰ­Ü|HŠAïã ² Ó9Ò-‘Œ´,²Û³§ˆpÔ[B"j°ìBËMQHi–ß Ù£Xþ²ˆç6ùIät ©›ü‡ÏŦ—™«˜YLÄsN·XËÅc.ÇI‰nòYFÆôM>DÆÐë–â½æãüËwé‰\(ë„©5 çBySÕ@ŒÂdÊ3 …6åæ.=Ó…o;±ÄtlÚ²KÍ„¥R'H,ÛâÇ˳lJ3K4í×žŽ¡ò(À?‡ˆÑPûÛ™[77¢v~ûñ—_^¶ÿ6u /ýeºöåZÿâI½CK¿iöžÓïîÌYogYogYogÕ>ýÚª½ÕTéWWWW×ÑìK£Û—F»/~_òhÈ£!†<òF“®ÍÃk÷ðÚ>¼öG‘F‘F ‘F‘F‘F‘F‘F‘F#‘F'‘F+‘F/‘F3‘F7‘F;‘F?‘FC‘FG‘FK‘FO‘FS‘FW‘F[‘F_ñõÓ·½l(ø§’±{걓oÚ2K¦ÖJ6Tn_Q’é¶ed•ŽwÚº)CÌ­—R<ŒÙw½º)Læ„ qªŒ3*F§ãÐ\7e1Þ2¿í@ŽŠQ}Yžž­añzK èV0: F!Ztifk¦”I͌Ҷ²ås ÛjL+-óÈÖJ)$ŠÔb‹Vm²lKhjœ£NΩ,0yæ%˜›õ5š­0e ¦]2ˆ©YïÁy¹Çƒ¬uRÊÔß­¨Æ•1Ñ2, “‰ Hú¢ö@bã©06÷XmÕ:ßãA¦i*ŒÍ$–EaŒDa¦ · SQŒÛS6ÙÛXI>Ñ9ZZôëe“m±¹ÙDKh”ý"{l«• ×„‰bœU °=˜xµ©yŽ­4Ù"«îÁtä÷I&bBã"¾ë&Ë¢OSDPG™¼Xœ¶Çi#PÓÔ9oô]]¨i{¶±ÆJ”IbÕÅ–’÷D!.9àÆÇ¸¯øõ=™-ûc˜óš¦¼g}²=怳â€)ï)u¹ñë2q!FxŸ‹˜P6½O~̳¬9`*{Ö'Óc˜yÍSÙäCH3e*<™Ö$0•=Û !ͤÛë¤Z öÂmË‚+Æ”êDùXëd,0÷„>„íÖ7˜(ŸÆ}/0ëžÐ×è›n„í””,Õ=K…°4lªÈÛ)ÉÂm람€¥S剪+Ö²¨TªBMÐ8cúÿÃM°þæÐ0ëO #·4ÎÜÒ8tKãÔ-c·<˜ Ìf‚3Áƒ™àÁLð`&8]Ç3ă™`ºžEò3Áƒ™àÁLð`&x0<˜ Ì_6_Ï6?nò®Ç›¯ç›¯œ¯'œ¯Gœ¯gœ3Áƒ™àÁL°\OKyƒ™àÁLð`&x0<˜ Ìf‚3Áƒ™`½¿Ö§3íÐÓÿÄTP}Øïÿ H•0A endstream endobj 291 0 obj << /Length 1453 /Filter /FlateDecode >> stream xÚí›ÏSÛ8Çïü9:‡¨úiI½A)Lw†î ½ìö`A¼“ÄŒãtºÿýʱä(Ž%\Ãv x˜!¶cé=¬ÏWzzÏ Ô?hÄñˆ á£Ùêî®æ÷£êàúò™û&úƉsçÙôäÝc#„¦wnWÓùè¯(ý>žŒn>߀ëÓÏú”Ðèf£òòˆDWÉzŒE´M–ãoÓ?N>Nkk 3À(éèš½ûÈ?®ý£€Ð[ÿ˜ÿÄx‚fÑÇ<ÏJ8‹Éz¾L×÷Õ™>©ÎÕíöþ¾¼®ý|w tûÅL©öe×í{ÝmÌ«øà쉟µ³Ç.6" ¯~€å€¦¿Pê_ïFæðÊÁ™ö§ƒ–!jšÙ=PŒ™—Ç.|4Œò+b õ0rJÒ0~"ÂèÏmñ°-*p7E®’Õ¦¢!&n'bÀÑs²ðÂzeŽt 5#?/ƒ]ó‰Ó¾Ć‘GEà8ÓEAÛVj! +lDИÑçÿ¶èâz~ uxz«cß> —Ð:gº¨#hÛªqí‚ #1ê°„^!rõ0žèØ&Ë Z¤ Åk·G˜ÞŠØ·(Â¥ãØ«Ç™.ŠÚ¶Š€@R+‚+b–í1W­a“À@jÕõSðL¼( ‰‚zKdß> SŒ…W"Ž3]$´m$K„ˆ­DرDv»O•· Dr½Iâƒ@^™…v-XTújÁiïט@Ÿ\g:h¡iû(ÇpÉ*»Òä`¦cI#µ)|9ÎõƼ®ËËtГ²£Ú;1ätH Àƒ ñBë¸ÓÚ ñZ,Efá@ÐP{•nfj¹TÉ:ÛnZ¹E„$é›÷W“g†¦?yûBä¹`½ä9ît!¯a¼=t@:<æÂÒWç$¯’b¡VI‘ÎÚc8fCBæužÐÁ Ò;tØ·„.!-8ÎtÑBÃöÑ,ÌÊúŽÝáž><è°Ej=OTušSýl%ågyúe‘åEuøi=Ö·y¶k2ßΊ4[W_Yõy­£ïlU-Ñ$O“B•Ûˆ`€¹MÓz¬Ì_ªµÊ“]7m¿ÞÐ"}4,¿v1`±é§ƒÀb`ï2>¸ît@ÓxëbÀÒ‡) œÖkÁt¡ª]¤Fóè{YYÕ{É ó²ØªŠ…IÁ´Ö­H hÌ“îÒ¾ƒHî€bêÍ&¹ît)h\ƒD$Ò¦¿vp^‚D`tQ¦þ·k§@°[`Ûÿó1¿¡9ËCŽ}´½Éq:s0‚˜ykÿ®;Gäü7Ǫî endstream endobj 253 0 obj << /Type /ObjStm /N 100 /First 889 /Length 1934 /Filter /FlateDecode >> stream xÚµ™oo¹‡ßëSÌKçE(’3$‡@p€¯iŠ®©'@Û\pm]N¨-ÒºÈ}ûþfµÖnjoš"»€áÝ¡Èy83ü3äò$QÏL‘#ž…X”¢÷$Yð ”Ôã)WÔñLO¡+žhï%-¢Ï¦( ¤Pˆ%áE)pµ’J!¡8sDë(Fó¤&T†ÎP *ƒªUF)p‹¬kÁ*£TØ*£ƒ)Ye”æ\¬"Å¢ÐQªÅ1{SÆïQˆ£Ù1縈1ÃØeV§jÍ•¸xk^‰#Zr•`] ñ©´n’P"^˜$*š³<Ñ9IÑ/"g¸ÏºÊ…¤XWYIÔº ³¥ZWÅSòÖUhO­¹)18°’’ˆ™+”RFå„ʹè"¢4óDE‰šÂìtØ–-pËln+LYÐßX„r²¸"09[` *‹l)”µ–üG¥õX©TZáçÒzLx /‘Jë1PREe€K V9QÑh•3•*V¹úTæ# ÆIíBDj–2†… ¢ÇP¡scC“·Á‹¹®Ñ+q×Tì'4Oµ.QÖ QÖlƒ=€›XÄTmÈ2ThicÍÅê ^ZŠ•@s©VÍÖyFtT¹,¨Å‹ U8›á­6ˆ B+¼Á Æš½ªp´ðfÆtõņ•R ¾_xa^¼x±X¾ýãÓš–çÛí®Y,/ﯚVþy³ý×bùãn³ÞÓ{éé?,–oÖ× ½ÇHq0¿Hpœã%¹$ƒà|N¨vN/^Ðò’–Ù½ÝÑò%aÎ>£~Xàïû˜Qͽ“‹«AF˜< 3$Ø•{fW20Ó4L`×€‚Ë!ÎÊ̪°+˜¹ª“<ÆÌÓ0K‚]Ò359̺fù^&,æ[–äl¡?A“ºìË´Nc({çuÀäê°D=Í af¨ÎíŒÙa-ž—é“«~À ìDçe¦ê×éMœ—X*FLLZ\(u^fçc¿Übó1y„9Ír›’wZÌÜÊó2±¤Kì—¤ 'ÏËÄ’n Ê‰É Åq^&–t‰ý´Ëäæ4[’=gi׉é[y^&–ô0ˆ§ÔVž—Y°}–S[y„)Ó0±‹hìÇäVž—‰,#Ã>1S+ÏËäèR0¥•G˜Ó¤&‚ŒKè™±•çeÚN6H5%dÄ3ÏÊdÌ ©ƒqëÙ%&S!m+dšŒÍï#Ìi²>Ιe¿ q)§ÌËL ;û­Œs+ÏËÄÔÐÚ[Ò`÷X<Ë4LLÁÊÇØMqüžÄ…Á‰c+ÏËÄÌOLì¦>¤Y™SÃ‡ƒþS§aâ€ä«PT>ÃØ®2ÍY%æà‰I,á¬ó"‘äIè7•˜Zy^&’<˜Ú3¥•çebj ¹ì™ØLC˜™‰©ÁÚ/ š®æY‘¡f˜5'öRõ#C(Ns> È3½öùW¨Ñå433W‡ºg–Vž—™²ãÔ¯XiMž—)ìì2ýÄL­<œæ|ìÆ$õËPVž—‰ox{b+ÏËô8ǧÁ ìJcNs>ªüÅUBðÞe/ß‚|Iï±VCçZþýÿ$> &VÚÞßÞ~x¨öj·mZU¯R¢®ú+|iÿÅêãz±üˆëmsÀ®Ü67‹»ûýõúÐ^ñ·E]ßlV?î>Ý’mÛ·•`ýÅjpDZvëØØöYÃzdßÚg‰Ý“»§tÏ®^y¨Wº§vÏz|ªïž¡{vú´Ó§>íôi§O;}zÔ÷áûïBK*.ðà¿ æÈH˜ènûÑwïªð¼Ìÿç»ÁTÌ'¾dÉibžè».ßöÝ N“¢f¤ÅªùÛ¾°Ÿè?UçýZVÍ‘—y"(ÎV2Ev‰Ïc×¾\&ºÄ®®`sÄù<É\Ì£¡)czHÜ5ÛtaÖ‰®šR§þ@—,Àšæervq0[N•G|+~¢«f콃ْp(:²úÉTWÍÑùAʘBu™ã¬L»j®ƒ š|v2v¥.]Mê—y Ï©<’¦Jšf®raÜ© òñÇ MP±µ÷®°¸(#+‘Ôi ¬ðòà MP®#†¦GYcõseÿ+Qü²koÿvÑvíìÝëwîÍùkzþœÞm7ÿ^ï«[z½Û>‡ôÛnGøñfw‡.Þ]Á)×Ûõ~Õìö‡gtþ´mö»£ÖöõæþºÙì¶+¾; Y}¹»îz`í~£æ÷Ínv×÷wÈ?ŸRhV··«VgG”> stream xÚV]OÛH}ϯ¸ôÕó婪0-Q! 8TûP ÉP¼ëØ‘ílËþú=×vL€$„¾Ä×3¾gÎ=çÎL”/É#åkÒ€~„$‰…‚Q"l¦€ñ¬Q4ô‘ÖRzš§Ì–H¨@™R°°  ãQ“’ËeR‚¸FÙR†0¦A`**0°Mª0Bd- k ×áœÔ>¦€% <6ð=å#àæ 4 ÀØ'} ü“¾Á ”>w”æ j“ô1pP† `à  y-8(C^ ʈׂƒ2âµà ŒBo`à òÀ×ÀAåáÍÀAåAci”€M*Ó ·¾`H`¡$óJ1Ÿ·D ކå]Z—¶|¤yZÕez·ªÓ"¯èÇQ‚·ü' ¯G?>||úDúøµ˜ô1¦£³ßv±ÌÜ­ú@Ÿ?ŽNlþÓÑÒ–vájWVTÜSýàoÅ|Oþ-V=ã`JúÜ*Oï‹rA¥ÍçÅ‚~ºÜ•¶.ÊÝù¥Kó´ÞÃi•Ï]™=2•MÑv#Ú¼N[¼¤^ÚBñ J¬ÓÙšà¿¶LmíªýhOªŽx°€—EéZpŽÈµÃ[µp@먴è£BÝÛ™Û•<æµýÝå41?4;NûÚã õ»ü×YßÜcµ‘ ƒ’Ûñ/«|Ö5D¾qÙ¶}+bÛ¾ûøm~Þ|#¯¿™Œ¿¶y7]£c`gÎfÍ·ÅÝßnVWmö9z%{ÙÑ´þäÐ0Ë64]‹Òò¶YFÿ¤ù¼iÇÃàN¯ÆÓnÃèß|U¬*Þ¹]ë>?›¶¥Oâ³É>€¢Ä–¥ª¶5ÒÙ6Œ³ËëWn±LËtf³÷ù~vú h±ÊêëÇ£}Åܯ ð¬Èç)#€ÜþS„ö–ön—Ãi§3Géï·¾GÉé¤ß¬³gè;¤lw@µ¹ÚëNqî×¼È_œñ»Ðã-Ú‚N ¬»§Æíï‡=½3½j³9¢ãcJ\†O×÷”]ÕÅä mö¸›V¼}êûÍêf²†“«›Ž"f5\ó  ~‹ã«ûãv^ËÃI²IŒ¹]¢9M«Ñ||l=]NÏþZïbDœþ«´Ë%6WµÑ{˜u%7n¯ö¶mLã £m $SXmËø-UÎGãï݇ˆAÎ]¹H!gÊ÷̲ÈlSÔ­Üœð ®øæ¤º§ÓøË¼ÉI79iÐì¶œ³ÀŽN þc0ß–¯“â—I±Ã¦°ÕV=Ï'£uÞèeÞ(ß7šÆÝžãˆ3Gù¿(ÌÑ;¤â@±±Ë«´~|rö5иWoÜ©7^-\{jôZmIë[qܵâØ6=tp^÷ _w _Ùc^,R¬ügÎ%=©¤#•¤Í?§ÃY%I'+‚ €ÄÕ«å>§Ã“‹6‘#δÄQÿÏöþ±Ñ2u3÷+…KØÿ¸©òšì¶ó§w·3÷¦Þôù7 çö€´ï„zv”õ—ÌŽ£ìOîR`~kA9b®xv(ÏþY4 ~áâ2ªEQ?lÝȾèñ.Þ»ÀÍ`Ëçý¶íˆIÚSï[ ÃN endstream endobj 564 0 obj << /Type /ObjStm /N 100 /First 872 /Length 1571 /Filter /FlateDecode >> stream xÚ¥—ËnÛ8†÷~ î¦Yh*’")E×N\£‰Ý±œ`ÅfbÍX’«KšÌÓÏt±ÓÆŽtèâùøŸ )GiÉ\¦´bžÁÃg¾‡GÀ¸ÔLÁ¸xJ&VÍ„Gó†I—3å»L ¸ùœIez ¾Ò—ƒ&}<}æaò¦È/5S’iNOÍ4­ 3®aÚu™ñžœù®éi×c¾ÄZW±ï´ë³ëµ°À×5ƒ»œÃ04Vp 247Œs_èæÜƒ“à0‚ §…Ǹ¨_)>>âT‹:p%ÈahlÏ=Œ4òÁ=‘d/Àbd…ií¬´îid R#N0¹Ö´d™Zl(²¡Å dZ4èÜGî5"á~€( …š5È¢ƒ‹Q*á á \dVpÊ•‹£®šêÅ)É(˜ ùA5„ðÉàLH÷4’%$jD+<§Q5áì…² E‰‚J¡È(œP´; ‚Ò¦Q:A®õTDƒâ ÍÕš Ê' Ô›0@ö‘6ƒ 1Qj„Ð È ä@a1*(z…YéJÙ3¨ tјY“I0"QZš j&²nPA4)šIøÃ@ûJ† JI¯ Ez’÷ *(="£‚R¹d€¬°K*dÕ ‚R‘TPRl,5QA©t1*(I¸A¥QAïÝçq8gŽÃè™ÝåQ’°ì–Ùdçñ"Z³e\”y|S•q–žô>|`ïCö~”Í3ö~ÈÞ]Ør•-‹ëÛ,¿\NØÇ½n–a–-²´ŒÓ*« –Të2¾ò8*íOÜbø*œ[™$ñ‚ü¯Zÿ'Üp¥Ë(g·³Ž sËt:è<Òª»dC›qùÈfö»Øýd:›÷`mF‚´aE?},Wqz÷Üïj2›^6~µ¹Ò%gÅ÷–Í"lëLoË4&QÈ`Ø=‘ .×jåÿf÷l±Šâ”Q²YÛü·*3ú6ìÚ¬Å7› êMÖÌ·›='|ÏgÓ†P›{˜wPT'¯¶¢Ù¸\írRµ99Ú“__lÊ]§¿% „ýÒVL áÛ»+4J–;a˜Ús|š¾Ø<µkV$Yv =ž0‡ƒÙó€]ä:‘†WJögãD v~Uf »Ø5;§÷h”½m?ì_v Ë&ðŽ„Ðûë8*œË<=جÃÓ¿ç­?,üȣͦȶ¢ð™B ïljó‰ÝÔ¨CæÏ¤Œªx‰3ݬm+ïãtip¼ å‹Õ·“=Ìp{:kó§T…15ãŽæ0 ;VøLah¿W­ˆ(ÃZÏ ˜î:¶·áNÒk¯¿'muÑŸïé*Ü~Ë,ah4¯Ý‡Lg™¤cÖ8ÑЮ£ºwjÀÃË .'ãásí©~C[ƒsÖpÈúµ›hŽxmdi•ÜàͶ£öJŒº›t+/b¿h|íGlÜu:Yõ5‡g•[úÄ‹k6µq¸%¶™9É‚sv5íòܶnœ–6¿ö§„¿; ÏèxK+3†Ùßþµøtç^‹þ^EEì´;l2Dtûu?sZ&QÎÎmº\ÿQ°Ma«eæ¼Q1þÂùì´±‡þÇé¢z´9àÛeoÍȬ?N/ÂÏã³¶‡Yr§¶ ÷W¹c4_–vƒbßîKHX.©çºÃrù'v`çñMåÔEYß#ËcÙr®ÓÉü ìÉöõç¥=Èõ)>s^þåyƒcÙ,'‹<>Ñóe§ET-V[c“ã ±Ž¸®âÖo×Nxõ(Щ¹Ýú5ÃÖ»¼Ì°›,m¾ åÉqNŸ ‘ÊÜ&vÜašQèmv­+tïãÆ²1>S#êÓµCc|©^ÿ…~Oü³Ü.V¶|Ýwø¿¤-wmxTGüâ»Ö+¾«}곎ÿÃ/€æŽ§*Š8J£Ä–%~¶BÐùM¶Ž r7®ÿÛ^ÆtÑ5Á½QÃ:Ú¬q_5„v@˜óÖ<âÝá}§¿Õþ}âCÑ5övØ"œI3:I¢‡ð?œB^ endstream endobj 940 0 obj << /Length 2853 /Filter /FlateDecode >> stream xÚ­]“Û¶ñݿ⩋å7)¿¹N⦓:÷œ—º<’P¤L¶¯ùóÝ/@ ÅsãŽÇ3`±wû-Çwü‹ïÊ䮬ҰJË»ýùYDÐáxÇ“·¯ŸÅ‚·Ä­‡ù×ûgù!Ïïâ(ÜE»øîþà_ußÜý+x÷æ]øöå›Í6MÓà²à]§?n’*Pƒ©[ÞyÓw[úáÌ8ÓôgÆïy:ã߇͖2ÒQuj¨Ç~0›mœDIÄ›ßÿýÙ÷÷Žä<ÉÃ{s#x:*àÒ˜AÚðÙš—û¾mÕ~Ô}ÇëþÀcÝûA§³ql§aœÇL0ˆf³Í Ǧî€ÊÉŠ£à̓ Ènú¡fz³¢>nò"¨]Ê0jmx§æe«†zxä’…ã+SG4ˉF}ìT#÷tÍÍú|iÕY‘’Žˆ›î®y>žN²àåÛMÇÁ¯ô÷%b¼f |š—ÓØŸã=ã¾–p[O y-âé;~ ;ýªU×ÕÏg|0ÈÝ6M²`P­ª’ÕÔ5ôè0%>pòúÍ;žü2=´H0ÎÒ{ÕÁ@†^ÿò2äÇ‘GR•¹°Fíuݶ ¼ÊW¤ i’ƾô~“”Á‰w§šßjåQ>Ô ØBŠÌ·<ÜÇ[0æXŒ÷}Ek¶çaQåp1‹‡=ê¡AVõаsj€.mÆA?L¢íìÅAÉ©q½ªI9pÙÜà“Tðz¥Õ„k„o…žm\„Eš íê³ÈzÐVOå{ŸÀ… ý>ŠSï ݤÅrØk‡[&ä¶zP<9×úÖLXÇûÁÆó«#ä`%½3¨f²ŽyR¬E†‡û0Y¶í“ùS} í‡ÚŒ·Ë—æ¨Ôû±~h…ŒSÝêQ¼ÈŒÀNí•1èÁª4 Jï¶@Q^Üm“(,b¡ìgº¹G< d–0×£Œôõœ±éò e¢Ú–áÎà´èle\¾öWs-SÏò*ø[d¢8#ÑF'¡cì-=†'ç~-Ó_Np§Þ2c1DÙ,›Û¶µ¤,BŸwêó™â´¸ááPÓû#™Îâà¬'«Ûîz™HdãÆ Á>òŒh…q2ö¾(²~âEßµ‚ß>nüÎ_e¹áÍ<8à%n¯¸/vµà¯=iêƒðGq»Èf’ÁçðlFÚñÔãÓѰÁó_s‰ÀìGÝÞcŒð²@'_Ö©Õ5ûÎWXçá­·ág‡ñÔ³F¢Ÿ:ñŠö–“•ç>¿ÿ±õ€‹Jd‡ƒ¼V&¤‰D;Uºº~'›¤ØÍã¸a˜æ›!¹i~&}µ'Š9@Ï?Áõàâùn²u÷œ+ì0ÔUÁ©×{Y7J¤Ù5fÅ4˜Ÿ 8xJmÒUUl'º”£m`úT‹+„š¿ÞO##X)â|£²¯åØÕ`òÈרFn¥…­?xMöB·Ë°¤A¶ CõY·õªnÙ•Êù§BÕYV¹§ðŠ ç÷OʹÚÞ/#šÃ@çtæžÙ¨$YÁy{p¥ ¦Û`¼Ú,Ø–‘LžØ$|T~øH’4,ÊžMÓj +Ñ&MÃ|—Zìçk7–v÷‚wõÃøÔ]Y ,»¬‡SÞòâ0+w3êú‡ bÜ´ÅŽ6tQµHêP, OZfZt<-‹0Îò¹J°!ôÆh`Aò_T¢kîžA¬88«y[š"›S“º"»|œá#áˆn”0ê,¸ ÁÆ%嵈«å³¼Gq¢‰ÜÒ€¡•ömÚÊ.O]dãO¤lqa f·v@ÀyZ ÝíÛ©á ËE »<ƒ|Aþ³ ŠR€ >×èå:ù’^M¼»ÞZYRÞ:þA]ÚÚæeΞ]T[ISWIQ¤åN%v†,ŒµîÇ/õâgDÄ"±`&üTs©¥l÷Yžre ÙOÉ—’Ü–ó;8ç»Z˜é cÍŒZØÜ¶ôjŒY7®æž‚ÔÃv5‰Óû©e—ÞØXåUÝ0™UNÁÇðŒ´ÆôŠ¬ë·  ŠÅ«ì¹…S‹¿[8ºLðç ¤%ͨ’Lv°gÛIɪ{ºãl¤ÄläêLa‡H-‚ßìYHý(±É lj9]_.xw_Ûjž®n[®©ï„ŽQíí”d#:yh€œjzZÉÑr£ã´ÉA4O·Ò¢šemiQÎÛNˆà46ý*Ÿq4@4Šc0Jȳ Å›äa”TOãKPù‰ >a–¦]+pž˜yê/£&·š¥¹ôÕ`‚=0pˆGq3/½ „Hhí*<O%$iÖzUóœwVš">5Ñ`tm8˜¯å¸r~2ÜÖ»Ò•-ÊvºL­•WËç\ËWXËc!ÿœÍQûPODXv¹«uó™®Ñ-½øä°ý@~ÓñÉoÂM.ížÜ–»wÇ ·©º¨‡¢mm4 b©Äl0”'æXqJAÓ¦è°Ø#+1h d4RÏß\8—V»Uæ9ɧC&Ê‹M;0ƒíÎHзxõ€«QzPPë Ê,òCoÈ]~òb^p¸Û…Q²›‚O]€b½wH± áaþQ„\½)•p”Æq€ûùêg ãrú†6à`y©`²ß¤ï’CBm†’†A¬täëÜ †‰ä ®:æ}¥Ä²4ó ^Fsõháì¼X*çìôQWÿGq›¾ï5Øûr+T¡L÷"Æu|é›?¸^3¦|é`O°óÇþù³uŒ1óhÐÆ6ùGÖ5ÛhóŒÆË«Séªà„å “£v¶‡ËÅ»_؞’tvúÝ º  ´¦²i Æx.q´äù•öZõëîÈj~t5൷?ÃÐö=m"0±S^@í OÙAD)ÿ2€ª2qÍIn£r^VÐÆÔG Û!;å{ê—MkÑEô8öõ"Á>؃ÿšÞu_KxÊG)Ýl/·™ÒŠšêÓ^>q×-SpSËÖÉ?h¹¶ lÎùA&k¡e‘üßÌA„Sì•¶u&&öθ‚FKGÁoò¥é\(~#ìq2Ϻ>ļŇ„ˆïóû¼÷TAúýwêª Ouð½®ÙÌßùaÈ‹)³Hr®;}î~ɰ™`åe‚íã‹Õöyîv»Å//q)-ƒrÖ> stream xÚ­WKÛ6¾ï¯0z© ÄŠÞ–zÛI"Ù /rhzàJ´ÍDW¤²ÙþúÎK²´k4-Pø`rf8Îë…«~áj­¶yìçñvU6WQûÊ·o®B‘Û€àf&ùëîêåë4]…_E¸ÚíçªvÕêw/Zoâ Î3ïîæÎ¿½¾m{wV÷¸J¼÷ª]G¹7¨zýÇî·«W»é²4Jý4‰ÿ¥e£ôÌ+b?3?H6ðÃ-,¼²úuèÙõ&ô4’rO1§6÷½ê™Ö‰¸uª­ž¨˜Pëzs?8Óµ–ee–iËz¨tÅÔÏAÀYf¹£¶r[ ž Úýzê~èA¦gNÓ«‚[Íç L@%8 ° c?LC~‘©¤Ú½€U´õ´ði™{®ÚR94&õ «Á²Ð_o²mà½ïzÝ­áè7ŒÞŸµkrN2÷ nN}‡rßL¥-+&? ~ßw ½ez1w?˜zi=¯ê¦³Ž³Dõ÷Ɖë!Uè٤סßG«}Ôòòu–Ìã¼ #?ƒÐoÂÌ%Òà±-˦۹¬ˆ,õF·ºW®C—o ¯ƒh¤™÷E—Îþ"§—…ÄãécWW|¢‹<€0ˆBËŒý¨ú,aØË-Ó1x¤yä½u,jDɉ¡³ÖÜ×ZÔu,röìFl›û×´•æÃVT{¨zŸíÄm´x8 ìG«YÍm~vž GSbFyۘ÷¬hZ*¿ÞdEn‚€Æº×˜ÓC€Ñhw”B±L!Ë“`ЉyžÄTŒo÷,E7£T‰ÊDEg),Kµ,f¸]à²íäî)íSäîG“§Î¿ðÀÙE/¤$ñ²yâA­æa>&ÞÍÝ»w—ÒZ]šd£”¤awqŽ9© Àzí¨¶Ôª€`Zà˜ dkœQµùKI AÈ:}âÎq©‹Ð‚ë0.þK!~DUY ††œSé?c£†WŠ#ɇ¡“´BÑL¶^CÉCmm -ÊöúÏÁôÚòÎjé‚RD8fYVC¥tU}¸y…ä³±ѦEˆçµ–Éù´ ÀÉ–ý¶óÚÂv%ÞŽ'N3è²è€ýÈ2OÕµÜv¤€§L“?Dñ§ãåœ,{- •iÿ—ç‘2ˆxÉ6á;ÕêR[Ëø€íAïÕPË1«Â[[ž%ÔÚH«åÿ®­åô¹‘Po$3x­øïìÊç`2ºƒQ+ôÈ+¸‚àWŽ¡ë‘<.dÓ4º2pX’Çš$w]»n8YAY‹´åÿ¶“=êqBá4TíAO‡©ÝEJ`Å‘3 $žp©˜SŠ@_‹ZöyÎKe¢ÙÊDsiL©¹#ΛᦫѴ8–Æ{ |0à…åHŽ9Ϫ7cEãcûÿ{¸¹k V©ýuÏõ~[ÃëT-ÄòáÑÒbÑäãqèÛ\ª•Yç/0[)m²H ƒÅ/ÀÍ–ÉOÁ^È\k vÂz ™1Ï]àsmFèå¡„Á@ËyŠÇ ˆå«!Üqýþ¨àãâét ”Fays¤úåW‰ó¥áYªíöihA¨Ÿe4l§è.²}?É“À­²GöiÌP œ²k.ƤÁ "*2LS„‡8ò®[Æ"ïÁŒ³;‘ …+l-ãgÜ€M‰Ó;pƒ.>Y=T݆³‰³Çáörê"‡>$q1}HFEJ`*–~BPÓºš=~}}p’ôwð­Pÿ,=íãíÍ^ “ R¾ÞÿN×Y endstream endobj 960 0 obj << /Length 3140 /Filter /FlateDecode >> stream xÚ­ZmsÜ6þž_±ß*Ïœd‘"õ’¹ÞLÒIs¾is7Ž=ýàfîä]zW­VÚê%¶ûë @­¤•íºw“IÄAàÀX…ðG¬¹JÒ(H£dµÞ¿ íh³]QãòãÁt>ú#Ê÷Woο×z% 3±ºº³ºÚ¬n¼ïvù¡3Í™E‘'ÞžùJiï¢:“©×5õ™ßM¿îŠº’P¥Ú‹Î¾\ýã͇«aW-u UôEtÔ'r& gH¡•“SÆAˆ=”Sœù:޼‹3áUg‘ áàë„™ˆ… "Kd®ü( ’,eå!½ë6ßXœh¯¾£o·+Zjm­ôÖýÞÀ>ÒëˆóT‰ÀYdqþé,<à¨ÂØÛ˜¶ØVfC=â«ÂÄò]_T.MçԽǩüL&Þ# ´ý‡vDÕíàøyGºâ-×93é[¹þt\¾ûD£÷E·£áÆä›¢ÚR'gÁÊ¢ëJƒ§´ÇŠ¡éTHÁ}WfmÚ6oñ”Á™‡¡w œæf â$È`q¬U%d†¹ Ìà!­=LGƆáÖû# <߯ÊúÙ8E ©qsQµ]^–9Î}ù f©w Ë_2äHª ÑäO²£~AÞH¦`Ôj*ï]Ý ÝŽ…)@Ô†l™õÞÕÇ8ÄŒ¾,n›áNfç߉•R¿ú@Fk—ÄÌTŸe zE›ïêj ¢ ï&ÛY[ ÉÝ`–í“®$sW­x~™&ŠâÉyž¾GýÂæLí9@%À‹vݷଉgXlR:ˆw›·Åº¥6ž'ù,^tôÍ˶¦Ö.g.¹õ1Žd´®&hóvW7DämûbcÊ[¦’,Ç EêÖº1£ï#]~84õ¡)òÎÐÄÞtL½Ùç¢:1øHZ'«l4ð|­µ¸õþˆÁ’ ̶™VÒ!n><äûCiZ´ ™ElH!Ä\x•dAë‰ðO›†£~AT•Ê@¨l*ªa©è#É+´Ðõ¶øŠ÷d*êv;DklYƛևc¶óŠ{¾¶âçP(coOIïjg™lkÎ4uLïêžX%6¼<·)ð׺aVÿáèOtª Î4èíäô'êÒA*RGù +HƒÉ 0Ž-ÜJ)I)¯­ûfmx°1Æ¢†ïL)Xªƒ,æÐÿ=‚\ßÀJ°§À ¼bŸì¨8#õcc¤~ìü]¨šußñ,b˜%#lO 4Š£ k×i(ñzÇàåþqý’_L7™ºЍèsów°’"wŒw¡¢¸í]Þ˜’ Ún¬ñúÓïÀ_ Äëꕆ¤†ÜJƒi}ƵËW+DÔÙ nå¨ýùRО1uˆ«áò!cbÄM qA,Ìsj¼Ÿ{êc,ÄïR˜ŽEÛ‡ôÚû¼*}9ÌMTdG¬6´÷ Xÿém«ì8‹&g~Íu»õ/ha¾ÍìÂAÊ„=(Œˆßø>o ¨6ycSK=Ã+& x·J:ÈD f'á8$DÇp†0})œ2µ?"_ §3¦C8•ãËuáT{‡Æl b§Éz~]02¾.!(Åy;40Ÿµy²B±š±$‘Gà iñÉgr7YÅA¦ÓW_8/÷Gë3ÛdVo ð>úÜüxŒÕö#‘¸¤¦Óäô¡2JÓ‰øÏ]#Q¿ ­Œ28°šŠ;wN”‡ _Ï_ò¦¨{žÙ#ÎðY äáQ ým¡Ë‹ÃY”¨×¬“»*{6K„ïs¶¸åÅÖ(ãÄ1¦Öi¨Þʼm­¸Ðù9Ô![töÓƒÀ¨ePºg:c»±gö‡¢)ÖyÉÓ{K^bà £Â?Aœ1"jš‚7ÌéÃ96kdC±§ùZ˜ûIµåR@—G+!œ±C‹Š;h !;`Ò¦¬™ÎF3R|më@!=·’C€‰c~ˆc³»¢Á»º,­°÷ÈÎíq‹#Ôf1Û¹œCY¨&W,³Ä^1~­)É,koºb ÞÐÄ({m‰­gFVd“¢ÖиEZÚ˜ò‘QöœÙÒ¸i©Iõ0ζõž×üZÑ©K³Ù:~t–ºï–n‹Ó˜h&(ŽÜc3*æ]µ#¶¤‹\.ŸWÛS&~KfoÖ6ý[¨'"{dD¹"rÊ9¯:f€Ð)¶UÝØ¼hÝíáD&Û>j½»½mÌ×"wehäÒRh˜‡C‰Ï'^8f]¾¤IlÙ‰š îž™°˜ãD5J†D5”î$&ƒºSAÐLƒ({} æÖû#K1y¶ ©áÀ—PmŠ’õ=Éyó±¬ícÀ´E¤kH= Ռݠp©NÀ[àŽ4«XR½”_1±¤^J¯¦,­ ÁÒ“˜Ò"; 8ª´{“ô06~.yîÙ‹cÃðÊ錽¥ÎÆØ•5ëqCã„ÏÖ)lŸßMIݼ!Ç(:™ž 5óÀFl¼„æŒß¼§õdl‘;矮iä;ú¬k@ôÒ­¿9óP|÷%BVÙDOkúØhúŠuåfܯàcÓs|´2~-šºro}€Vi¦ìã€eg~ë¡k^öûîÓç‹#òC¥ ޳BîpOûó{ãàÜBMº6“B,rïKƒWGó·(XHïU0ÕWÅÚ´#ÛŠÀùÀýжœ2 4?ª\W–jô´Ú€>knÛ7Ü~/¬·öÁÕ^LlMeš*Ô§ 0 âHÍ P(†¡F ”ØbcŠ!ù‘  ¡3Hm²´=Þ3§¯ M%¤íúŽ˜gäÜæIC-ïl€Ó¡,OÍðJ›ÞZ…´…ŸæWìÅîLmÇ“Â`â_…ilàƒÑ¾ù°î)Ëø¦¥ùËjûªë|Ïlݳ¡D‰[cNjßTPš®")þTrìÖû#Z“g†ù6V »®;¼=?‹ì Àß÷}¯ƒ¼;g´…õ–õ$sªïº{ÿçÇÞŸ€.”ØŒ3 Ó _zÚuÔþˆ| vS@Ã4˜Ÿv¥²i ~(1:wÙqô@©"üI]³*kû,) X$ÆÊs<(Ùi‰Þ1èùõ›Îz±ÃÖK‰2ø Š6QÔ`ÒCnœÃ“› ,Cdà}Y²’PÙÄúõ¯Ën½?b°¤×Ù6§?TÅ$ïÍ5©‚‘‰:ƒ#CÛB5–Éc_Æä—y þL¥WÂ7HròkWáðu¬ƒg~íbêNTù­uæ*æoØ)ÍNWO'XuCЈàUöG“–ˆè?/¤£ÈƒÇ$;}"ÞÃÄ1äÑ¢'AG”«L*û?çÛÅþqõbÝ:Úàÿ凳þO!^AFšÆÉøäÏü°ÈÄÏŸtÆ’F‹E SƒyŠÔ¾f[rßÇ´ßï›jëÃßÖfºO`@Š©i__~úø–UØ2¹Ú絎]¢?}ü vz…ÍËÐz÷#- ¤¼Ù˜»¼/»o7+Iä­êEGcÌýânä¿bC« endstream endobj 765 0 obj << /Type /ObjStm /N 100 /First 868 /Length 1727 /Filter /FlateDecode >> stream xÚ¥XÛnÛ8}÷WðmÓ‡ÊâU$°(&M¶@Ó-’´{iŠB¶Y[»²hHò6ýû=#ÊŽ;nÚ<$œΜ¹Q”Æ™Q,e™1Ì8,Ž9ò,e\X¬’q­±*&RZ3&”Àj™L3–YΤ„¾LfbYͤƒ5L‘½uLiì»”)§°J¦p@kCkÆ4dlŒÈ˜M93ðgSÁŒuK>…o:_6uø³Ìò”Y}.™uqÅœÂ>ϘËhß2žJ( Â(œ§j`ážs [a@¨pH–뤬‘º•H[®TŒKI[CU ·pÇ8‹zpeÍÀ* kN kd­²Á?«l(B äŒ#0 ä ¦V™ i )#‹¸9ö޹E--ºÄ äì¨RÔ)—ÁŠZåPGÛõŠ DÍJ‹…?‘¢ÍÙŠ½°p#ºj a‚K £c¨”áFp eè îˆL€dAÕ@JBP‚ð':4NpƒJ:ph6…ÈT1‡æ …Ò:'èX8´O( +d+4§- kÍAY#L‡ ƒ”:(Œv‡ ƒ :(2DE†j9tPСu :5t :(¬‚/d+¨¢*‡H¦t˜S3p’´ÂáOr…³„?)ÐE§ŠT;œøŒ$P6))C’Ix@eçñK‡Æ8tRQ™Ê0ÏoÙóçìMGLЦ­‹Ñ²-BÅnŽÞåµoö4|a‡jÂþ-ªÉͳgƒ_eÃ+6<× OÙQêy^>c/^ zš¼Ô&Ö®é¢sM#M¦û¸9B _ŠºiŒc¾úÚß.Bå«¶XEt_Ú9¸/»9ºZŽF¡-ª›gß ¹Î¿•¾˜Î"úŠ#ÔË} )ó¦·îH2½êˆïØµË Âí-#ÓÙFò—†µßAÀV^M—e^G;žp®ï¸Ã0˪ø‚æFŒž!€÷=yØú«ÇVÙ7§gÈúžÌ=öÇaÍÄùš9Œ1û¶ðõ= m¡ý¶-9 Y†) ÐÎæ+¼ A¼óïØÃH•Ÿæxnüv¥îK»k¾—=¶t‹P4 6ú»¹câ•Élj‹ãë‡ODW“@O%•Ìï}ÐëÚ—yç¢Úׂx‘w›ÒìvêU]‡úó©-§ª°Ê¢š2¬¬ÛÅ1Ý5ÿ}Ù.–íg¤ìóy¢Œ­d;6Î ÇÀj¿uK ÁÝ ÷YUaSw&û*Ñ»,}ÝìdN²›kßÜE²bv´.ð8G¢|Yú¼ÂE¾G1oû·(Q *Æ{Ô.?œG­cv5CÚìuÕÖa²wmÅWFßìýÕqî+_çûOßëê?d¶>5×3ÏÖ"váÛY˜ì ÀÿãÇí–ÑZô ÑI˜/BSl›möF¡?_ž÷/ãfÃëý­ANû+õ^¾w¹Âœ­”ˆ8tÙ¾®&þÖO®|^g+ NÄ¢ ¯Öóe1ñì:•¾jß›ô¼ Mƒg<‚¬¹½—Ũ,´Î«Wî–dGÿ¬‹'jž-«Ø™(ƒî`x;˜ ßåS?žàÓo®_Û)¦ÕËÁðÒ7aYãžaôÙÞ‰.ü¤È_†[ö‘t´Ó †Ôë> †ôy‹—ŸS²S‡[òrÊ>ÒD þù×ß7i†«ðYôéÕÎ'£DÏh6‹êg†ØžÄÆUOcÞ£™µghبá»:Œ¯|Ë>¢§glxío[¶öò@eÌNe”zbe0ýTÊ[yÞ¥ÆÐ ÷¤<Íî Ð?u†ÇU€ø±æ($šåºU§ýC¥A.ò¢çûUË~U½|ÅëžïåÚôk<÷2ìâ 1 µÿ¦¨þ _†zâë˜Jú‰ò£PÜd‰ã˜^µHh2Åxš¤˜œ‘ ×zÇl÷.hÚ¼Üxóþ´wœ#]’:š¡³DIƒ@Ò$M÷;FÓÆ~Ñ6Os*¥J4*g„N¨S*CÝo«³½ž_ÝæóEéŸêE¥i´•‰±ÝoW‰ÆéÑ9±×óæ½ü9Œè•Ó<¹è:K-ý—˜L! ž(Å8€ÿ…Œ· endstream endobj 968 0 obj << /Length 2218 /Filter /FlateDecode >> stream xÚ¥YûoÛ6þ½EP ˜ Ô¬(êlº>3di‘:†mÈh‹¶µÊ’¡G×ûãwÇ#iÉQš´EšoÞ¿ûîNá'>üã'Ip’¤‚¥"9Yíùz´ÙœPãòõ#nÖÍaá|°òçÅ£§¯¢è„û,ó3~²XZä'xál.|‘ÆÞÕÅ»|v]!¼«V5Ø ½_e5 R¯—åì¯Å/^.ÜeQ±(”Ì®¾-^<óˆ„AÌü($ çó‹n;ï›j3ßÃ(DZVQÂbná‚ñˆÓ¾«Ë‹×§¤Nß*Òæm·“ «*/¿o©óÖÒŠ²X63îÉæ†úäj-û²ûÑ\;’6ÛAC}cUOÉÆ9 aĬùkꜹà1i ¤,äü¶â›¶¼Wï‘Úq`ÔÆF#«¼ÞQ›žs7 o9›ÃÿøÒqzU©FvuÓÒÂuc·¼¾¸¢ÆûU¡ôþ®øÓçáŠFÏÁdh/´½Ág­†€ˆèÛÇáF²ÂÆ3B|p6e½äk$èSpî_ÌïO?ò—}QvE5% O}–D‰Uâ¿I9X¤vÈÜv’;8˜ÓŸ5$÷}¡Ý>etMè3?Y°—†,ï·Y*Ð)co\’áÖ5€aê²|ËyÎ9·Æ1‹El†üÕ'µê;•3Ú‡Gì0?ÌÆˆöK&Õ X| «geküc'? á'‘Ƴ¶²QùÐO€]¦]Å?&7UÉe©ææˆ‡Eä…üøj1Äà½‡Ùø:<âë#‹øAèP"p´‚áí›]êc‘k`º³ëÖ}WOÓr 9 öUß\C ¼.ªõ¤jI²ԉx¤+p9>ð¤ ]M¸OOIÂnÝwÔw–ä®—sÂ}€´,â1îÿ®häf‹­ÆjÊ=÷KaØDcý”0JB¥>ðQ‰’]©‡ìŽFa}ßwn=ù±Öß™ão‹±V²3>vòW²"\Ç5>†Ö©0±ØÌ?¥©¼hÝ îÉL°Ù)Y­×&àlá “Ì«cBa‚â0äæKüç®·žðž³‹WhŒ·¤Ñt4à ¦{”¨¥ñ±“‡)Ii—Fö¨Àn ÓQLÏÿ)ÕjïçÞiå‚ÚÅ×8éKmZŒÜkû=>ˆ­8Dq*W{H&¤Æ.N`ýo«Kì75‚’"# xM£73íP4¸•–C<…ûꢅð> ÅÎl×Ï14&‰Z—¹2å€ÜïËbežI¬;[õûM#sòaÂú9¿Œ±j?0UÆžš·GöÄryLOÉ1¸·‡\AtdÝjTÝL{oj¤)$âÛI_ÄÙ·J“…Zö›Íá)j²FÙ~Ñ#¬¶jõa9b¿º³*? ¼÷”’ž¢N@Ü} 9>΢ȓe‘ŽÞ I ¸‚„t ÜŽ“g’XìA’`®}Ń—œ"ca’Ýa¡²&+Þ8·m³oŒ–¤â€üŒr£˜(Fì‡]³»6YQ½A†·ï SÕ¦vÉB–BL*„hǾ÷âZa·J[±¸ý¶'ë—;½ƒVÃãk ¥›Œz\—&öª ÎoÕ>o—Nê¾-o¦dˆÀ'¸cíï°æ&YŸ°H|ZT«²Ï'“^îL—"£%¦p°(ºóx°ÏdJ:”ƒJ˜ ÿØÁ$©"‚F«dC~Dý½ìL  Ó7&EŠb–‰#f\Ñ 7ðࡈe™ð3“†ø©)Ma“ˆ˜ ÙÜ&Ñ8…Eä¿MØoi¹Æ LÉ<7[eÊ XÀl1^œ@Á®¡~ØGý´˜‰w¶ž‚ l­Iql7ÄêRb¬ D#v?̳ðݬ/‘ä¢q&%Vjjr.|áû t‹>íuäAxŸŸý|ùìò÷ëwÏo~|ü¡å'„Êã‰P;ÜùüúìâùùÕåËã½Åïs[·¯^‰³Ý¿¨¤’P7,ÂÒQNTB7£'Îè•Ûìž¢ÅØŠŸ‚Ü ŠºCe‚êt.\ ò]záÿ3ŸGî-ï°^‡äagl=Ñ!~ËÖ¨#7Ùͬ@dbÃÚ2ˆvÀ‰ƒåõ2-8í”-/ÌYÚbØpÃÙuÝW¹P¿¶¨l7Ö;BñLyË¢ÒR„YlnÃÑi©‰êѤ²sà°™ðµ¡pIavfkUwf‚ˆ^g²8_™£éÈÞ?Ÿë1äÀV$bƒ-»p‚”l`4CYXÛät)æ†z”ª3ÛÉ%œC¬t\}þâzè¿SI3ø.lL”…t/Pgl©S3\è½WŠæHFàzo>7KSl¢Ð7m§v†âýùY:¶AN Þª·—Ú ùz˜J`L±®E£0EY2ŒïjM­:$¹Ô=ÆbE§t[š—-í Þ…2Gråæ›,Þ¯s =ÃÚ'S=9™¸¿¢÷ÊÒ,ÂHwðËØ%´%2iÌ‹;,$‰FþÚðU#)µ8–z¤]K P¸w/^=¡Þ›Å¯çOì ë›)„¨RÚó:õ©#=±G> Gš¿ШõI'F aQ—¨FGú‹€Sm`ŽéφÌwuF^¯ðÕÙ?IýÚüè endstream endobj 972 0 obj << /Length 2629 /Filter /FlateDecode >> stream xÚµ]ܶñÝ¿âÞ¢²²(‘úð[ê^Rè!pÎ(ЦHxZî®`­´¥$û®¿¾3œ!¥Ý“¯’â€9Í ç›³â&?qS¤7E™ÅeVÜÔ§W‰ƒÚà -ÞÿðJ0Þ· Ì?Ý¿zý½R7"‰«¤7÷û%©ûÝÍ?£·G}Ýl³,‹Ä›ÍVJ½ë6i¶ßlá¹›ê±é;@Id©"µù×ý__ÝÞ®*U±’ÙWŠè±ÿ—œE\ âæq¢$ɚǛmž'Ñ?6eõÉ\ëŽvr  ýÉh4Ã8Ðòa“ÑŠœò%')c8ÖÍVäqQeÄé¤? 5ª¦þÈŸ]š‰Ë˯þÒ£Ú>ã?øZDŸÜÊ~ TI4 ˆD+ª¨ßÓs<šA -¢Œ¸Y™DÖü{j,‚•Ó †0dhñãû»˜ƒ%”÷<ü4Z£OL·m¬¶O„§»ž¬³Y,” ÃhËJì»ö‰kM=fGðfÏJæBø¦é†Q·­G5~àDK”ÑSø–­Ø[8çÙù[ßíšîàáÝω‡É2 Ø)}ˆƒÄ õÇŽ`GÓí<»ÁŒ|Žý•SȨ.\ç%/yníÙGöSÛþ~±'z/ íPh)r¯d\žšÃÑ…'m÷ºi×i¯®õÑ Ú"„ÝÄ´Æž¶Ÿº]ŠÌho¬ííÀ4làÇÜœµH2-ý…΄véõ Ǧl:aÚ6ãñdƦþ–mÓt5;€×‚7Ÿ‰bÔÂ5Ç8XÛš“ ÆFجx`¶8Ö¥Ïù(€d“å °\'`:²œˆsø¯âT”tÊçƒÕÎ;~.—–V.cmEç™ôZIvŠr‰*TœCÎIëÝé¼Q쨻ñÍš]yú‡»ñûïîàBF{“ÛXÓ:;áÚ¥lò!¬4G˜©G³§ç»ÛÛ[ZJÒ¢îOç¶ÑÁ€B^öÏŒŒ<‚‘![ˬÄbòÜ]ÎÚÆÔjÈŽ+ѦҸ**¯¿Nâ5µd".TæÑ8‘=‹Ü$Ϋ€”¼HKz4çöÓ0â!bÌ0µ¼nº5&y«*|Ýtû¦kƧ5>²Œ«Lý&™ïôÝ%@J« ¤Ÿ•t= ©ñ¡¢ÓÙäÎò@†·€& úÒJE!á‚;4m­‹g’ĉ‹«¢ânS™-õ;â+±O˜¦p©é±tÜ_» ÂÌcmÎØbÄ”„¾ß”Òe"G§mO½gæÏ­‰±so¹h[#ýc3ÂÙ°v¬¸ñèÒ¿J£ð‡‡TB¢¹Lƒ@Œ"ˆÎ£¶»Ï¨O(r(gU¡œ•YÀë!¯X&„KCËáØcòj™›6šQP'X“T£[â‡jZÃÔ©ì1õžž¨lÏ#‹ùmoô¸¨›*1ñ!^ ·Rœ î¶ý›Ëk1MÙìq=Í?ß¾åòßžš‹­ý9§½-¤½u·.!ß2Ò¾·i[úæÔ´ËuW±6‚ªªsuØÄk¹¼Μ]¦ÕE¶V_ÎÖs pŒç\Œ*·X½QJ®éCãµäâGzçd´…lm߬53‡,Ja¤U~I"N,"RžG fu„8!à¤k×Ìlg°¡‚ì$5L _´†`¿®Ù/Û$Uî51ØúõÔMVw¿@Ÿ¶oñqU} t@¢ð_}CÙEB_T‰ì M'Ä7„Ö÷›d÷>ôNV|³*+$/Q¦žéKò',îîUºÝUO ½Åk Ã7£¹¹åž18éŠ,BV±Áƒâ×$'¦kyòˆYɵmÎ#5¼ö…SÖ¥«`‚ªËu¹PQÛ¼Á‚1tÒ|…s€ È"÷7‡? J-òE†ÇÝÜdÀfNbÀËÅ^1|‹Ÿ†yAgÝI+8þv-%/[ýŒOþæëºñáH½øR·°ÝÒíc땲– Öî€ÿçlPüölejÉ@]“U@¶Œ\zegÊ›ÛØ½®ÄIn·®Jꎽ p50¶} û]3Œ¶y˜8] ˆCC¡qWÍȇ‹&VƒR±ÁvJ[óï‡x»íjgå¨Zò‚rB”A-#Іۤ»›¸”à, lé•Ô0Û}ž­Ù³Êå¨Kw‹ntÀ¹Ý‰çkÜAÈH/n½ýZ–0ü•ji{´{%¥Ó³”Å…ž‹¥ž‹h×ShKa kZÆ ŠEä9¼nëuUÐwà¦ö 2z–®“E|gƒPÇ+§böH•ÅDÈ6 "Ó෠監õGÛCsç†æ"1Qaø«ƒp>üGC»‰=°£¹„;±ìDDp|¿±9_(¢ÛåÁ&”¦Æc_" çØÑªéVk&¼L%Ù\{§4ノŒÜÈKRð1*BcqSò‹Ô߈ÇõCØ•G»i3îÅï ðæS£=ón管./¥ó(6­ö!™‚ŸA®Ëw].Cûôn à]’ž—ú£,Ãz÷i£r›‘~V©ø·‚*[aªìÒ'«ólû?<ƒÜ˜ bÆÎÁ~€RPÖzóyz!ÞÜÀÉÏ×|ÖïÊuúd†³‹…TúT¡6ݼaa€fæàpݼۣ);þ­îVw¢¾™úùiÍ6˜ø]˜Úiü€C?ë:’ÇÕBŸ@ÒÏÂð «ü/«c¡ry+æ¥T \¬¯† ô6ü8pÑ“ºÉBh”Ö~hð0®_’Z”p L‚8õï¿BêØÿtú_"ü·L endstream endobj 975 0 obj << /Length 2599 /Filter /FlateDecode >> stream xÚ­ioÛÈõ{~…±-PM8¼¹h d³Ù¬Ù p”E·piq$±¡HGÿû¾kF¤L'N[çxóæÝÇH_øð§/Òà"ÍB•…éÅæð̧ÕnwÁƒë7Ï´À­p5üqýìÅÏq|¡}•û¹¾Xo§¨ÖåÅ?¼ärúa–xÞ}P×/ßÁ4 ½½épy¿ÍeycQ_þsýë³×kwYÄ*ŽÂ'Rf¡—y¡ò>K^(?Ž˜¼WíáXÕU³jÒØ+š’o«æ#®Mçú+ª$ W[féÙhGæê'ÌÙÀ+CË`cox0ì ïÔÕí¥öº¢»çùQèH8½ ©šM=–sáT²‘·7Eɲ ½ß}ÕFxH¦<™Ê€DAÆlüÁáIz›±+µÿë’V“ãù¤PÔ½pÝSž±=æ*ôºvªÆô 9?^”åW¸È¿ÀÅ ^Õ?—lÂK{w]q<^€G…•íØl†ªmÔ<ñ¶­¬›Ïƒé0ašõíØmŒÀ´‚ll*?ðˆ*Û°ù“žog—íLcºbh»žçEgø˜PùüriMÒ¦È&C¥cÍlÚ®3=ÓÞ6%›7Èñ¡qô,ê©™…NðQ”zff}x7BµSÏÿµŒ]³»ÿ~èLqøFýè ™'gÒù‰1X>1,4XmÚWª¦Šº&{Ô(‡Œ÷a·)‹N¶{St›KÁžçÇb)àÅâåò Å&%ŸxlÝUu-D¡|Ô&^’Å-à{ì 4´xÿ§Šü>5 =oÖ-)xS IÎÏ17|ì̱8Ó÷d°°_Š‚?@õC_†ñ¨1¼ ’Œ‹­å¹·ÞËji¶ÅX<£aÊ³ÄæA0ø×’Å„»A»>Ÿ±±gÉ¢XeÚAþ‰qVä!á2î@«<ì‰cß½¨ÛMQ¿°6¹p‹ö1c¸[@I ½— ªãþXmØßѹÕ/ˆ8a"A" Y‘xé ÁÎýD…Y6·ˆei)?´´A„R›%Àm’0™ \ö®"ëÅèk“Ç›wxðŠ7œ/\¬ÃH%'Yî6Ë7ûSUýbŒXé8S!8‹ˆ‘BÄêjAQ¼#2¾0Ö{´4Ë=ˆŠ`º8É}ˆ¼XÈ·…hÇÞ¿Íf`Qm.jB§0NfÊhŸ  °'é€] ‘;—²´\j¯a„Œã2G„F‹Z"&ËU¬“¯i'ViîT(á-ƒÚ³F:ØôÍð¿r+vn1íœÎÖ÷¸„.Â[’Ý0 º  ««Å«R$¦=²s"ÒMÑð-.·á¤=TÀÑAî¨Á‘+­pR‰ˆ‚0W©ÌE4M+€¯’¦@…’dOfSb”|›.å)V‰\"âÍ™¾|)\aÐ^J\M(¸ãnÁŸÒ-XØ¢Ÿ#?Ù#át¶i%×J8.–Äœ*Ïg2c ”tñ²oÉãO—TÙô¤\ÀÄ€ßáÄ °Á<²”3­R¸m.ed †*”ˆí䎄Mè¾ÌA ‡}1ÈòH\ßÙK$À±Œ+Ói$þ‰NsѹæäÖ­½ˆ*’hR^-¤yf"z$¤Äà"É‚_a›° ÌWK¦H£Ä[_BnnùÈçyTì OXðȳ¬ió®G"é^ðÛ³ô̦ÚÞÏÐ@ YT½ –)SWy¬‚4UÛ¶‰Xa™ úÏÅáˆ&‹“~Ï»=OeÆ$ ¿Ì"ŽÐ¹é{k:Ö•Õ®qö£s{c ï8ùÝ}JÛAœ@ÜàúÝ›÷ëë×/{¿¤T‡‰¼ÿÔ ¥®•+Aj®w“úzÒ VÒÿ¸ú¶[Ásj`rìÍX¶+×C`{…÷Ì{ˆ¸ÑO,Ï]ÚåÆy¶f¿·3W§÷våÀÈçýµdß ¤¸@Øß‹‡q[-ö„Æl8D¦†il¸÷)x5í®+¤ƒ"í#Ó¥ôm 1šP±“'¶øLœ³#Ô,"M;5}R)¬V/ +¹O•¼PüŽ/“ç;@[ÕàŸ¡&¿„0#}Œ^1íϰè0S~â„õý÷‹¦b¡æQ‰ÒA4MQæÞpý?àÆYu‹û. Ðlò¤„ð”Ñ`yOa†MkÑ9òºEøŠÕýÝ«ï–Ø‰S• 2b 4;ÃsÍ‹WÛgöÚ0ö¡’Nf^[5¶e\, Uâ'_-9Žq^©0‚òµÆ*ÉSR¼o]V«¬$ @ÿ͆¢Õ‘ERI™ x[¹?’gr¥-2WãqH‘ ¿^ñu q‘Õ sêéq ot\¹À¼i›•$ëZ`Ë ìªhê.pjuÌÝ8…xS¼¨îŒtê] B…9o¾/úª_x_¡È {bûÎ2¡Ìn\„ÂÉì8,¿]L°:ϤEÁ„¾NxêòÖ`ÎOE#?òŸgÁãØÉSeO"ˆƒDgÍü%Ø÷Õ®¡ j§$«ø´…nÂuUÂo,°¾® ÕE‚iಽ­OS<ÑK©‰kÛŽ˜Udl"–žW%¬¤UZ;R{·ÄT×Ú·ã;Ššø÷Ùk˜‘¦(©fÂ$,5-Á‚luBoL°t0Þ(íñbàF~ÔòØ”aƒ$ûjÉ zÌ8yäôÔŽýÔ²" g¦F’rOÉü°Š.Êï`ø·ÌüZÙs? cY[3‹=Ï¡þ•F9Ö”…kóYvŠþ#nmåû@tÑ4›™¦Ò·è'‘gZ€‚“-ìV$â˜8[ ùݶØ%õŠåa¢Õõ¾3RÜ‚Gn¤L?=I«/Ò¡ü^þÀA(‰fU ç9™.FË@%± õgîŠõƄᅀ ™"Öî8háúæ§+èdsžÏ˜þ¥­KûÃ@m Ø¢ëwag®†Ûq8{bœv*Óhg«¤BžD Óù¦³$–‰qKr%òAYê,úYºŸXž$ÈLOK1ä›×‹f%  bŒ2)¢q0ý‰'’—½3ˆŠk€†§SåcLɵöÖwÔežaäéÜ2#ˆ@d™¸ÅN6˜úÞþðú˜AØÌ endstream endobj 982 0 obj << /Length 2876 /Filter /FlateDecode >> stream xÚ­kÛÆñ»ÅõUœ.ßLÒnl7.P'p”OŽqà‰+‰)E*|ø|(òß3¯¥–Ïw—Ä}ÌîÎÎ{fÕ•?u•øWI¸i\m/<m÷WÜxÿÏJàÖ¸¶ ÿ±yñÕ›(ºRž›y™ºÚìì­6ÅÕç»C~êu»ZAਯWë0Œœ·õÊO¾mVkøö/›@¼0œdõqó¯¯7ã©‘¹Q<EýžYàÆ€lìzQȘ–u¡O„†c8…¡Óìø«óíÊOœƒŒöݺp¡$q6}Ï£ÇA¤ÓòVs3ç϶9WkåÐu¡?Ôå®iÜióºh¤MçGü¿e¤ZžØëZ·yß´H&¸òZ®Šß¡Br\ø QÑ<È–2Ùàð]ݹ¸ÃWoâЦËZùn ¤Z«ÈÍd×_<•0씆ê1Ô)oó£yÝÚQìüª·½¬íµiäúÊ7k~÷óû›_¾_:e- “‹~ßTÒÃwòªÂ†þ!%s%˜Ù5`fÛj®÷²€?g:Œ….ò4Μ·=–k½Õ]—·÷Ü-Í+û†>­`}Þ–Í ˆ ë ›y$RÇTŽcDå®ì·È´ƒ–)F?±KIì®;í+…ÌUN',–ñý¡Ì8ˆ†1¯ d«ñ]Ó—[\û°]Ž÷J àâ)Ò›ÓZ†2ô2ÃÛ¾“‰ººçõˆ ³‰6CDš’õŠï ñ`:o[ÙûŽû·°vè¹]4 [720JwêŒØ³tãù8|W/}ۜ耕%:·FêB/GÚ%ñŸU8 Q9¯;¼hÔ¶¡£™k€NS§ÜÉ*Þ¤¸¯óc¹% Þµ‚ëTÌ‹mÞëB†ÇC¨K‚ß¡c€Ø)ꤶBIVkÔ»ãÐ!]²”´ @aâÆIlÀÅš}Ö¡ï¹I ¦ºµk5!"40»ÊÊÈÜTÔš]ûÓñŠ[¦˜®¹Kš¨‹¿ðé1˜ÎN?>zC¨À) ÄT㇒4E‘%#‰‡¹®oÁw -© ®ê  ³ êópQ‚òv@éu*q˜ùÌš¦c# 9&*Û•óTèfa8¥ët9E›ó† šOá ì Ñ´°ß¾©óŠû¿x‘Wj·ÐYrH t7Ôä6eKç̰ªò¶EcÅò‹ûmÌÔÙR_*É¥^#çb&mõÆ‘ý;ñ8 M"–¤Ü)b“ˆ ©¡·`€ß€!ZB"õ‰ÄâYB?KŒ#ÎÔ<'Ö;d È\` Á®Å`{t}ÜÂE£°RviÄH“>ͪ+gÒ¬Œß ¯,6ˆ°Íë‰ÙæNÑÔú’‚ÂdDU±Óec‡û@” ¼ûz)ðóS7Òµh’ˆÜÏüù†zhoØrÞÀ5Ñúy£ëA´¿Y ­#ø„—``ÁÌ"¯C/ƒp¸­"µ=ˆ²>—(±8O¢…c@?à‡Iq˜¢rБ)/dÈ"Æ>(Lkˆ7h…ySWÝçe¥ s¬8†m{1ДÆSªrkUBÔšÙNëyVåCXª¢Ïõü²*7‚9×ËànL¯¦#vžeÖ¯­ ò¬ù1—I¡Ï—ùðZ(ññÚƒ½ˆRsäÁÓ¹¡M8%4Р:ß”P•$)Hˆº”$,ð}ÞÑÜ0òô•eˆ0~‹È@tŠÖ [’Tä7gœõSL''© äµ5h¶©ÏŸbr"M åÃFB2FÛñ×2N Bƒ(6¡Çøí)™•°wI›È£ýPMò¸WoÚ,frQâúɘó¹‚F d*˜X%ØÆ}ÿòÝ,–D=~ t{ÎÕ1D%%¯³S¦`F®YàÚ-Z+ož¢ zàbc|ýeŽS4Ç‚ýÜt_¸.wéü5m=Áá“ÞþY– Ùø’½8ËZÏĉìäcH½)g¥ñÁÿ9ôñôgÉKËó4¥9]%ÊF«k¥=ÄbLÉ9Zç³ÌÅò’£9b.]‘ó:›ÿo³Ù.çðÞºáùzÁìz‰\/¸¼žIkžx'°hJÉ¿¦üü<,lúê‹J=qŸÁ˜üò(•3$£.âÚBŒsÕ%|8òY)©§ƒ¬H=-ðAÔ/¾ù¶¿?é¿ßÔúô3‚»˜ÄE[í'Í/ï¿´ef:‚‰t ©±ã/¥qlì2…%ØgwÑäwåmŲæÇÉ…qFh‰rí ·³SÀ<EÓ÷ÇÚ/Ä8I¶è$÷Á®Ä¡”R×KÒYÁ”ÓÙ0“`Ú‘‡áBÝ%Qnr¦ èX¿H¾À®l.æÓpœEB·ëKªcÂᬭÀ%:HéŠBGefŽ:§ä†¹Z‘vÜ”JhÆ(äöÁ–ðmÙÉçZy<ŒÔ³SPŽg% ˆ3˜…°SÅ>ÂO?†ýâg‡fýÚÚ`!–›3 ;¿?‰óá{λpt"L/Æ¡)394…åQ4¿ õn'Ú|845Ð\g¾©”å#…¥IJiÐÄÂ#ßB@©ˆeøJ¬ ŸÏœæœ…{þ¤²äIý¾…îÊ}MÂ=*Yàl]`r/KÙ4BcÛ´PŠ% øuD9g‰ƒQ’8{ùŒ b'Ö8À ,ZJžòî?b¯›…ÜÉÔDvhÀ[®q+tÏüB%‰W)µÐG HöÆÙ<â $½sqŒ²eý1Ò¼éts*v¨I4zÍNâxσOu›Ý"SÆr‡2™Èùóã«7ØðPŒt±„³JA#Ól¬=#*‹FЇæ˜P63O И…U<øÈ‹‘ÙB³%ûÎN6@¶‘…,Ë ½É+FŠ\è…0ú±T( \€3G?”*øH˜l–ûÙ”i?ì̃áÐ’b†•ÁÄ©eÿXÄD|b¬Lç]i^ ïæü$)Ê€Á“tné’T‚Õ$µ\?ŽŽ*͘W£”ßœ € + T£7«Ìy½—ñæöº—urÊÔqۈΠ+_°ÆÊDõPBmŠ÷!E$VÇ~ê<÷ПJëÑ2’\¬ÓÏ/ŽåãþÇIXý_ßõ¸u âõû7 ײ*ø×/çL4Ìã™bœý'fA~¬ Z cEeH¤“)[ÌèuYî^ªîE©xÁU¹Aœ=¿¸'Ë×çõKµ½é!—¥½DJ{?á è5¹¸L:Máá²îç{ÙEtAxfö½¾\ ð—o1Ûòl—ñÜ?6±# endstream endobj 988 0 obj << /Length 1656 /Filter /FlateDecode >> stream xÚÍX[SÛF~çWèQž‰·Úû*o IHj ÓÊd[`5²äH2>ô·÷ìEF–…!ÔÉt˜AëÕ¹ï~ßž"øÃ$T)*ƒÉ|/²³åuà£Ã=ìå† 8lIŒ÷~yËy€#G1ÆWmSãipªÁFT‰ðôøöá'¥ái•”fÄÂ#ˆ —:\ŒÝ{3^9ã„#Îè#k¤7“EÄׄGŠ8sá&yRê:-rGòpžÔ³†8œV& nzQ0Ä êÕdz„ Óüª(ç!‚Ãz¦k÷J»Ç4­ê2½\Þ‹—ƒ!á_ÉÄKÎm%*ÿkRØÊÔ:ͽ…d1&9Äfgf‰6"7iöÍM^´n⚘÷³¢Jü‹k›ïФfs¡s—Š Ç×§nŒÈÐNÉИBV33aÂ9(µõøÅüƒ *#1hšNt sŒFa±0î`Íí/(ÞʱªŸ™»¥™ÖîQ§ÙÄ’FÇÙ«üK[nk:7Å0.µ7¥‹²0Ý¥Þƒ ØÄߪAk`k^ºj»ÞÄM:M¦ì2ž$IwÏbEY 0FJ2»g‡w°á&vó®Ï´wq£?lèY× ~±°‹Û#½s wàç‡YQUºüvñÂ'£¯÷Š0ÙÍÒ±õ†~$ÞŽIî ÀÆÅ´„µÍ¯ô<ÍRí§ê¤œWÈÁC¥b "ŒÁ!ÒúÅ‘³ög„i“È×UxR¢Xª@DE’šàÎ/¢` ï`÷CUpk%çc *Œ³àdïw—ĺON1Šq ÖZY€ß¨Ç/A8Ž œ¤ [üF±øÁm¿Fåˆ*pG±s{tÑê¾ŽŽ¯d[Y`$"ø*5”’:Î-–•¯}žÞ €Št™Zˆƒm¾ê¥Â¡·íä«ô|‘y ·i=óŠ¢Õð1-óeùÙ©}†øê‡\•!ÓØƒµMSØþÓë·~4½¾Z憋M 7Yn(¥`Ã2Vªî,×øÑ§¶?2Eûx r’Å!@ŒÄ±}J Ìz~wtKއÇÄ1óÀ2H¯µ0 bÚ6„–ª£¯:úNýÕ›?Æ E1 oKÝ@¿\ “;ÀåY³ÌŽüë¢7½W'ãׯ"‰hx¹®¦þ<¨jOu9ÝÜ}vÞ½?>;˜0WÂõ£8îÕ×RROºÅ2žuQÏôß+ç¥Ùž›Õx7²¡KlVvR&ºJók§q¯Í6µWîß›ˆ11ÇÊCêôAõ÷ã×#£Ï‰_KµÚðf^äE]äþ,±À°&ݲY_RÇB‚!Þ_¾ã‰#£Ö#þÉv{OF 7+¥ÀUb±õ¸ì?}åHÙH\ø#ÖœST¬¥urlÌè}°æÈ"ÂÁARù4œ˜Ê+¥;êa;²MÞÎx h¸ðÁì"L6ƒê­ N0æê{ªUW<ÔYæ–?sü5ÑÙ ®e2×®x„P$_+žÛiÓöNë°Æ¶> stream xÚÅYYoÛH~ϯоQ‹ˆË¾xxÀ9ǃÄÉ:Ê`™À`¤¶Å EjH*v^ö·oMŠ”èXñX0û¨îªîªúªª%&ü‰I$'Q¬üXE“ÅúQ@£Õõ„/ G7ÂYòÉüÑß^3Ÿ‰˜Ì¯ú[Í—“ÞÓUºil5)¥“%Ìý< |•Ä“¢\O´ÒPC;Ÿ¼{ôï1–F Ø%9àŒð•¾H’I(_â[|ZÅ~¤tŸïžJŒ¯âh„­V^Ûfå.¿fÕ\•Šk£þÚPøaZ¶ÌêEeËK¶EöejŒ—VYÚŽESeŸ¶¨ÐÚm8fævœ å #xß:]or·ÃMÖ¬ÜÂpO©V’m±­.yÙ%Iu/\3¡/TÂ+×»£OgBËÄ{ûúEÛúÅ5֎º~½]c+–^Ù¬,1Igx†&}zq …‘ÞítBÀwä,"Ô¾RݵþwLxeüPÊ–d>[”Å"E_¦2ò,‰0#ñ;Iú‚à¿÷ ‹â·±•„,ÍäÏÃéŒpûUºÙ1r˜ ý60dÐ={ ¾\¤9_ÛÂViSŽßÇKØTêPßËþÝ û¤"JÜÍÑ *Ò”ï]Aì® žýÝ;T\ ˜‚Hyóù3<»‘Úû´Íòå,+Øë&-–iµ<´ëCw5 üU<Ü_ )©;ˆwBRJ©~4íólfÚ$4W´W÷MÄ ƒÀÑBLƒfƒ˜FƒÔ· 500÷â¥øª?…—ëŒæöÿ‡ŒÈÿh`|ýôÍÅÅ ³zÖ7w)?Mg&ô~·‹fwÐÐ^~2^¹æî¢¬*›§»•| þÝ^ó0ø }0Nu„Ï %ã2Î=¾ö£‚ûÐã{Ă݂@á3:+âo+ÀÄ «#œNšÖ¢Òê3"uɘMæù`‹°G;•PÊ×ÀÎY8„J3úlËmÍ[¯©›7˜•„ß™•´,úÁäÏùÞ»¸×õо<{òäó¼.ÊEm”£á¼¼~ûìŸ3-ÀÝ–Ü^ÚÊôî2Ê«þB,öýt6çÈ{ÂK.ìÛ¬²NíªqŸ} Í8-y‰’G8­!¢¨åû|Ũ®4ÂN„VÃ*çâOì"ÝÖ ™ºfü6•]ÛbI¶ˆý61¶ Þð×!ñ†Œ¾¬ëìSîöÙT%´×õcì&Þûó÷þÅéy7G”-­Û“Q4ƒÝÖ½¬¶ö¡ÈRwšç.I„Ch=Ô}V€¯­[”Ö‰ƒsxàÃpqÍÃ)î2=X¥56%|"Y,w(n™ƒÕæ”U.»ä™¬°Ù¤U '±£l`¥a—ªnðŒ‰ò^LcM£ù§½%?|ŒÖ,½ŒÜô´²<Фõg7U»©’û;·ÞUÅaM’„0@Øícæ‡Ì`åö8pz[`¾KÓÙõŠàŒ—í.æÒ‘÷š÷êí¨à‚¡½*³…õ¹Àž¯¬Y'Фlû&cë‡È[8㻸| Rb-íý”­ò‡@.­Êíeao~ LÐ?;ôÅßG}©ÇÇ9YÁ k¦/rƒY¸³ ,a¬ž‚b)V]±„{Œˆ ßD¢%"DgÖÌÃy%kÖqvV!Zò=Mà gP8ºa2LŠhvi¯RJ<ʰoÛS»€÷bB_jh¨1)ö »°uVèìq´s“š§Éw±105¤¹ÇqÔñŽó’jù¯;sÒù qK‡ ;ÛP+àkÀ¡Îæp´osØ'kA*2/a󢘂&†C}CZ·¨ÇÃaN@ƒýÞmƒµÅð¯À²ènkË‹Ój¬h¯·Y“R$TP®s ‚Fš¯ËºiÛ¹kl6y¶ ¸…q.=[N|*-‡sâk°î–¼Ã—_5J:&^–M%»8P´yeU:flVÐpî°âLJ¬•ÌÏÑD 7êH‚#Q\Õ‘â*©vS,ïp#¡¥ŸÈ²@Ó£^„ÎÒyâ|ÍLXiÀئ¬-îÉ…š ekL@I¸›ÁÝ`PŠÌp´ƒ\Þ#œÃÛÃátùû¶nš… ¬xÄu¡4¿.+ðõ5v[ÓÂñ‚¿[Ž­õß™p*#Å5:ðÅ9†qlÙ[J¸³AÂ’ï,#³l‰×2#a‡ü1»(Üúf[°®q ^dÜÞ°Ü 4TåÙr Ñ•³ÂÀÌWeîˆs-Üë¶Í<èéq &ÞT.BJȱ`1ƒ’¿¬×´¸¶LÔ1^§·Dë1Û,Ü”ì°ÞáCª÷Á„ê¥~¹¯öÓð¿³ó_x gP=8î ‡»&89.!¤|¹“¿„£\vâ f8=fH5Á÷$§„" ˆ+¯°lÊr=ã¹S#`¹:«^Lï^FÝáÛh²´ lUwƒ{?a¨ÀPÕ'üM‚ŠHF`Îø% þ–1éÿ¨Ñ®Ÿõ6)Â÷Ùþcø8^÷bãÇÇ<¸I¯ÝEÄÑþ°´±àîß`Zê{ÄÝß”ÄõY™Puáà ’2UdÜŽøÎà\ðé®T‰ ¥q‘”*ÐÅä ®—9DØB”³óÎÇÈœ:Z÷Ê6²ôÒ=zQ*Û}úr`ªÒ%‰ÍÉw¤á/ŸŸ»l¢·ß~N‘Yãü¢s‡}‡Ç ÝþVn¯ó÷¯^ázîÙ[Þôù¯gó˧g¯Þ_<ï;[t³­Ý}U WªÝ¹ 0¸$iƒ×¨žÛbùgÜ{¥a„r5 Á_k[ ¯,àgºYÙöšƒh 9¶ÔzðXƒW7*˜YЉÅå-ìî°’Š+wd[WÌÈc¯¶yþÏ%œtÏ80Ê0¡gñjn²6åt‘æ ›–¾Ž»ç/TÓÉ´ÑÕH5Ó™²†ä½ÙVE›ž9,»YemšÀ™0$þŽÞÙtm¯×–wìxµ×Ö7´E[wrÑ@Ómä ÂÜÕµ ¸ªdB*ìÔ:¼m™0r«Fû±Žï²†hÏDÜ¥a ~’ù:ú˜ˆ¯Ë²Û¸ †ýÇ! üÅìʽªç5¤åî7/ |*àìV&šŠßÊ.Êõš´I¯ƒT±%’ebî¬þÁýXDÇù„ö#Ó½ufÀn‰O¬ùWf•^ÑÙˆëÊr£wfìÞWÆÇ‰…áýe¼Š®éjÆÈ¤Þã²³o.ɱ0t‘/ÃŒÏ.»gÎÿ¾Ñ?ó endstream endobj 1003 0 obj << /Length 2614 /Filter /FlateDecode >> stream xÚÍkoã¸ñûþ ”˜E=÷¾t»Ý{¸ È%({‡€‘[== JJ6ýõáŒdÉV’ÝZ lÄáp8œ÷Œåʇr•«$U"UÉ*¯Þùjw+ú¸þád¼ n&˜½ywù}­¤/2?“«›‡)©›íê³'ýõ&ÈÒ4ön¯nÅõ‡«õF)åݶÆâWèý¬ëuz½.׿ßüýݧ›ñ¶(ˆDª¯dmÀ~ƒ¿4Y›±ð£xüP*ðÌz#½/EÛõZz;*ogjcu×XZ6÷ëMyÿ2yG€¢¥Ãš–€º7–@m§»"'xÞÔmgû¼ëM(¥weñÙÆziÚöÐ"åµMeèpó@aŸmue:c[Ôj#C÷’TBF’^’ƒ0|á eI†ƒ߆‹ªUêm‹ß|Â#Ý“·tæzFâ ´x*4)#‘ÊM·ìwŒ5màÏtY⫲;±Dw#ýtÃG,¤Êèd_÷ö®.êÇ;¸è®Ò_îŠUP4õo~äƒB€,¨ÛS>¬åwK¼À#E:'{Õ€2P YBÕ~I¯è‚jt«ƒ“Wc;4ÌÄë˜|:ˆ E˜ÆÃ[Ÿö¦^”H&ü#ÖDî*m ñã={]ïÌ–÷NI&×}Ë ;…)csæù¡¯s”JK§*$Ó·ÝŒÛJ¬D„Î;5 ¾}ïöGSq±OÜìŤã%´ªuÅð¢ÎË~kZZu:<¯Z4¡T %Õ ‹Öt/™P2àèz{BÖºÂBÛ]_å‰`5À-Л)g㇣lÎøÌ|eÙÀ­ë»|¸^´±¬ Kub Îè™ëp®wØ ½cL˜è}ÉÈâPà'³r¿ŽÀ_ áß%†”™ÍïŸE0dgÁP0_¹5º3[Á& ócõ¿4ŠWâÊÿŸQüðéê¿nð@Š”zÑJ²œw`ÍPúZ”cè‹Ø9³ Îk±³ 6€ €?7€ï×) ò‘­étQ2ÿ­1§ù[F©Hâ`eH ×bþìUÃ2p‰|™fôáüfB`!£Ÿ^ãý¸×‡Î0£‰üóϦÛ7.ºoÛß/=ìXðirúåƒÄ9{ÀËÈ€ý»§D»œÀT †ËaÄÅ@‰Œƒö/º:”/(Ø™%"VLôW§¬êDRe€uƒÖþ„‹Àsù¡ÏlzKà‰màæ`C½€á“¤ î™ÎJ3Qô/&ž #ÒcúÛìÀüi·kèo‹/3„ð`›ê„1´IžÀ¶`붸ï1AY¥>¾9toVIæ5uùŒ_)ø²@AðVÄéô#4)YÞ×)š¾cü=£Ìƒ…Ûsq¶× %m ˆ¢-A >7Õ¡èû¥è¢²P$*Ø1·M_.Ç÷P¨xtõ‹%Z‰Ò1žu·¢T „NªçÕY†u,þ!Yåd¾ïa奭:Q>¼|)\ú¸À™¿ñA-Vs Ç8 &ÅZ6kÀ[7@¨\Ë<ÒCSË":üÝR­kµn^éŽB|Cd¦zƒÒ]v¨T*T2èíà…`£Ù`­`~š;]Uü9µQ,[e< A7Pç˜pé(¶­  rËé9Â'oÌ<3˜1ø2A4ÿ5Õ¡°ENÔëβnüYœ¹6E]t….‹]´ù ¥ ¯sš‘É ™¶-Pùn‹2ìiZOS@ç… œ^Žv)‘á{&8K¢H×°Áè›Jc˜B sÓéf_o-Ÿù}oDlÚnö $jø)Ø…nm›Ú `ŠŒ®½üÒY»ìÌÝÐ;N’ïù± 5mtÝNûBì7—B zT4×IíLwçÞ²¤Ä’бdÄž©×[²þtìÇÙÌúG}¸§¨ „§PnÀï¹åª@Žˆ€·gļ±Ö´l'õ¶Ø6¶´?tÐê-”*NE˜¨U¨|—ÿ¿µ¼Îo&–òõÉ5'å0»Ÿ¡•üR5TYLÎÂîYnu¥I ¥I -ŠÎk+à&‹W¨žXÊ7J“{3A_¬¤æD¹4Ù„  Wú#/;Ž<̯Ë4I£™ “µ%ó9ªbŒ´TôÇ"’rÒËÔtýÑÏ`aA Ã(r0zlWì5ÈØÐ÷—2V¹AÁÔoˆøbUØœÏ^ÊR,Vè“îzFüT°sS†Å;ÂtÚ½±†¡÷±·n!ÐU6PßQVƒçºøQq•›B•;n5x艖©iNK*‹‹¹}Š)ømn‹;2V'€7dܱ({&Há}©¹Ÿ°E¬(þ@¶Ìó“+òìr mH”Œ!êÚu¿/i&Èàs´ª'–*k`\1™e¼¿pØf­ä8{-Ýýslé¸B¥vk’ZðÃPNJ쳦\Í37{dÈ4µ³æbá¶vßôåvèÆûÃ!eÐbµyŒ…c°ÆðpØšLÖN»G`"¸Ûº€Ì^a¥y‚`Ãß5 ³¯Ö”1Òìò Ñ~Ò”`Ð,£™ ²ðDP°O#OØÁ?ꕆ)º–p¨å©iÑìÊÈn†ìb8rA‰£Œ]fÁíž'xª Áž H… ÅDƒUf‹±DB¶ƒ!žG.´À r¦ŽE Açç,ä0æ‡YíKø<.˜áჩ¸¤õðfü^|3nß<} ÷cÏÏÆê 5GN[ó û²;1u|>D±¹EEñüb0YžÐ;˜ŽkÔ¤ d“×ç¾¼•™sEsÜgZ4\îOùú?'ßõ¶Þ¡¯€¢xͯE7öëoÄøpãÈñŸ¼w,·À˜ =äˆã¬™_–†8¡ r’i$|h-¿}ˆCç7‹¥Çüšó!NÌCœ[.&tôd÷à {2]7ó[óH|üÄÍfšç1šŒdv6 cœ@f3¼\l Øo¼ø”(÷ôÓ‘_8ŒØ&I êû«P¬BÒ”. ‘fì›,1@ÞÇÆ…ßN»@ ј'‘§{ÈÄ/Gâ T8T)8À‘Ù1éàbŒ³Î1rœÿÀâ`høªW)ÅCçŸÿ.hÕö»$,úñÂQÇR°p#!8]TJiCTG {b•ŽÕÖÙ/R }j‘%„±tÌ-°û~7è½4ºå‘lÞP$ÕCî[Úx,4ÿŽÍäÙÏ”Š„(ÇoöáüfB€ìeN®#„®ÿ‚?4VºÛ‹§^è\èî¼WŠD¿¯L2ûœ£“ÎhNô8ÉD“„ú5M_׿©=WÁcÑ9€&oð±o*3¸gè¿-H 8‰‘3œÿ ùóùÍ„À’üO®qOÚwÝáýåå™ü/I1—g‘$ŠAdñŒ×W" cŸs6$'DzÀ«ÿ‰Óþà endstream endobj 1008 0 obj << /Length 1399 /Filter /FlateDecode >> stream xÚ]oÛ6ð=¿Âo“Š)R¢ú–u]¡È×Aº¢clÚÖªƒ’šåßïŽG¹²«lE€èîx¼ïš/øã‹\,r2æ‹M}•xªÛ/XÝ\ñÀc<áüe}õóoJ-xФà‹õn*j½]|ŒÞ̱·n§i‰×ËXJ½ýÇÔÇÊv@åBæçËOë߯ޮOš”PLÉô͹¿³-Ûr&¸’£m"c bh›XÆ*KÁš%‚A`Æ¥GÉ"š%E¸´>Øe,RÙ“ˆ• ~“¨?”²Y Þ#¡;´Cµ%¶Í2æQ[AsY›Êš¦z&Ä4Û@5Aò#|txwíÐQ¤™ƒæp¶-Ýô­{¦ó¿‚SÙÔ)™H– œóN|™ñ_*¦¹9B–E,U‡ˆó”qÅé¬Ýašƒ%tíà6Qïl Žlwlu}ǻ.›ý(Âôg\$ÄtD|ÂØÚª"Œ¨ âá êîWw7tZ•θ҆«ƒw¿zÞ—ä܉f Q•”M×›ª²[B®=ƒÃL!éÏD%µ—,8g*.Ë9Ë”öÌœA)Á?.|)ŸS¦5=Þ'fúíR÷á=ä¿lƒœ >Þ’/Ï>½¢ÑÑì-QzéAšLäg¼Ü‚ù¬½é…øq2Ðè™<:†e‚_¨¦Îè{mÅ$åQ0|}Tb†|eŠ"÷†LsŠ)ºP\éXŸ2ºyó†(ØCtRvt:‚ŒÃ£§Êk¦“`6hЖ1ž¤m¿î†‘Å –¨ÿhéäŸ!l¼W ÍàÐWÂŽ-'¸6è© ñ7#”Z-´BmÜ—×³í¯˜HOÝ4Ìô~š³\f#_M3tؘ|2ië²ï±Iy:`÷ D‘ ´#@ÔŽÏ„øh÷iƒÐS»ÁTiŽÓ6ˆ:´¨ÿ+–‰_*pе55r¬+4©ŸŽ¤IÊ¿Mm$×åþ€{:$30ÙHlÝæsÉ )Ïâë·@Zð‰;€ \à(¢qÄ¥Tô7ôd7› ØN,ÍNÙ€·úüëíûõj.# «[Œ¼¯æäåLªìLÚýõ¼,˜<úĉg®¾9ÓàüTÜÍÛ»E>rB3®£Ûž¢P†ÀPˆ‘PÓ m íŠRÚSSÅY®åY"{è›TŠÖžuP#¸ýR9î8ØÚÞ”UGˆO»ãìð¤Iˆò8ô”ã·#™eÛùègLë¼mT"r´EƒÂšoö¾úIgÐè¶´xäHðĬÒÍ-Ÿ³~:Cð”Æê MãVïzW‚Í~°#eâüxDà4ýE }ó<û¶ÙÎM! &“Ó–7;|µÌäX@q|d#WAÇÞ6Öxs šeÙIJƒ_Ñ:™nW¤×fkY˜ÛyÆtQ|?¸C«°ªœ©-=& }¡TbE´ƒÖÛh†¾­!¢˜)ÏÄõH‘ðÇhÿ\É+=m2Ɵ˦ìg{оHGVÔÃhgd2 Å_Ëtdª® ”SõOÊ -jC ÀÌá0¦-@•fýŽüìJ†@8Û UOD_e@{Á;ްúaï$—gÞAÐhë Ã·|)Á |gü*þo൮ŠQêÝûw³¥–±> stream xÚ½XÛnã6}ÏW[‘³±"êâK²)v EêŽ-Ð-²ŒLÙleÒ¨8iÑïP$eI¶b½ì>h,“3gfÎ\Ôrà?jõÜV¯ïÙ}¯× —GNþ6™·”0¾9Bú\vJ'¿]A 9öÀ Ö$*«šÌZ?[ÈmwÜA¿ßµ¦£©=¾µ;žçYÓ”$Rò­0k»}+Ãqû—É÷GÃIa-p;𽡙Ó[øz€Ï·=¿ë|n×v_ásmÔî]׺jw•¦žo¥ ž)NÕsdñ4¥O1‘HëŽ;­ØÈí+½$&¡PÎbå錦"¡O™ œé/ØL 1ÑGKA‚ \‹c%0’4ÅÉ«ú>d•Ú Œ‡Z}{Ðíú‹Û·ûdzý@¡9;iËYòO©89“swÛïVõ_Ó˜œ+‘¼àå*&Ž|8ÖIYÕËè?DçBj\·jà–…q6#ê„:´”Ï$!¥6¡/ÓÞˆù+ZÖõ!cY‚™½ø¦bþÿò2¡¾^bÊ>;óÌé žhGªþÈß lùUr%.r‹^€ÐuxÌùJIÏ8¡XV@õ¼m6hU3žågä—º²5•tΣÎã™’ÄBŸ† ÎøRÉ,[>ɤ ½}‰ýHÂ'¤¦L,²#ÙüéW(ÍTæØG½FË o&cø¼z/t„ŒÝjIo”o.G'Wýã(F<´ÂR¯'KÄè…WxI„¡¤QŠP ë¨YëÍpd´Î «k…W$Á‚ïѺ‹ºÐ¯•€5À„ÌHDÑ L$'³í°œKN#U¤ð Π¹bfH"šÒļû$\ƒ`»Í’gŠ7©@a¿·ßò”rÁš*É< 2UME<Ñ,åQí`ÙùS=Öú*#&žŒëŠžÓç ­M zä$v»Ž³›Ä9uåR=dŸzÌ_?2pDz[Œ¦ww§ê{Gv‹·J­`Xp ÷j:¹‡D»rö:{GÄvM¦z\–(–fT࢔­E†Á¯<ƒô¼ÆC ¶ÝÇ™àŒ¬¥ëy(¶}®±Ä×…A%„†”á³¹¡_’&Rg±0Î AÙ<­y“Î[åÉ›cr“ýcá‚§„•ãf«Ÿ ÎŽ…5ß…™„‰œ~^w»çÖ`|—,ê-wg‹‘$íö™17XËI¢Œ ™ pv/%G\ÐMcQ¯åëW8N¹É 0€¿’ú$*µà=%\î¥RþWµ™´JijE:0Pûšï­¨ö$º\Á~ŠÍÐܤ„¿é[”ÉÚ ©¨9mjzììÚ¸˜f¡\N£,Öd»íÉššvñl7ôVÙ€tÔ9¬!2æÈÙób ¬yf‰¦HuR¥d¾$L”¼/U¢‰\ª÷–T®¯P¥ön,zgÒ÷%S74¾Üx•/aù'µwÁ/ô­ø­p:’:Rkh¢{ñ»áx|?>/N1ÂRåí,¸ÏÈóÙ»JÝ” ’SíÒæð§ÛÉãõÕíÝt<Ü\éìBúçßaéÊüXª4!E‚vNÌm†ôÖ^@P ¡Z˜å©©%嘣Z_7í°ˆõf$›˜aöª[+OÈéAxÌUø]Y0õ‰ìî?@T¬®K†^í··¿Ò\—7ÿ•Ѷ¨†²VÞÆ…¼‚ˆqGnõ„ªaߪn‡eÂÈÀxhïÐÎm¹  üÆ1TT¾ ½t.tî> B|ÿ¾^ÏòwTPi /Û³Lâ1äLèFÑXš›VðîëH•ñéK©*Ëö)ÊO Ó•¡ø!‰®Ó¿Ð}ÀæRPK“ÞT‡-WÇæëy ­ËÑ“-ú -ÂÓ endstream endobj 1015 0 obj << /Length 239 /Filter /FlateDecode >> stream xÚ¥MK1†ïû+æ˜-$›É$ÍFo.«èÑ ¨Èb·Zpk©=ôâ7é´²àE09Ìï<ó&:]oÀפjòð2úÐݾ'·Wu2 åDy‹êÒ9@­‚q9EÅ<ˆæ­ßì†m)‰H˜³RZëD»ïÇÍûð™ºh¬HåS¼)Úø³É§œ¥?Ú:©y#„Z…ùÜfk˜l´à1©±¿a¿Ú• µÓíýu|îíºTãyö2(›æ¤IÏ4Ès_> stream xÚ½WmOãFþίˆ8Uu8b¼~‰8*Q…*/j¥^E{¸uv#{}€N÷ß;ûæØ! ©ÚHxlïÎ<;Ï33uøEÐí„‘gG^؉Ž|ZÌ:Ê] ½® {•ßON®‚ ƒ{à Pg’6]M’Îoò»=wE}kz7µGwÝžçyÖ´$…°|ë'L»ndU8ïþ>ùñ`8©£n`¾·'4³ú¾ðù¶ç÷]ƒÏíÛNà+|®ív{Aßµ.º=d•€)ô­rÎ .ÌÀÂ¥º.á‚,V–ÙcNÔ£NàŒy‘Ñ™º¿øù!qŒõ¬8ØÈTÐ1ÉIÌU&°JC’•àê±â£úM”‘½´‘AØÀô²ï‹¼ƒòOš8-æñZ¦;¬Ûÿ@#r)—D–™>„î"Ï2ÎûȨ_Fÿ!:jcÛu7̲€È·‹Ùõ­\¯/Å:„LÈìXT½ów´jëMƲ3sõCÍýÿe©üõSöÅò¬'NøD-¥ú3ß›˜.rëåFldY½‚ÅÌiàç¹zÂ1Å‘h‘‘³Ëe*àY~FÜxnÛÒ(RYçQ WéJ†$|-×,[?Š¢L&£C…}OüǤa,]Ť¥ØüñwèÍDÔØE£F‹ ïoîç3•ø€&i|¥2¤ýæ›ô1K)gUã; «ÙÉMÿ "0@ž8ý|%ÄÏ+í-^7Š'ú¨ÛêÇé­¶º$¬i¶HŒS~Àju‰J$VcšDQLR(ŽƒÝ´\ V'U„ƒðGœ% ÅL“DH_Ni¢÷þ 1W X»[òDqY vG‡=ßC+Œ¡‰\éÏ‚LuW!KyØ8X þBUà‚­ºÊˆÎ'㪣—ô©¤µ.BùÛCËj'qE^y+?„N=äÛ BÀ‘P‹ÛŧOò÷–P«}­önÅyƒ ù(Ý¿žÝ-ªÉdoÜùkQ0bSK'Éh*D&W°ŠU’˜l"¬+vŠcž6I“õ­Cb’l Š3Hk‰ƒ2-[ ÏÇ:öˆ¤¢£Žwе[ú‘­p“—ã`ÞoùV.^x¦±(|þ ³¥¦)×ìSù9€OÙ2)è\9œËõþÄUgVgþ XªÕ3åŸ5ÎÎR½T=—ê×8/°3ÜÕýŒw1ÁiSö[eNÔh8î$ÄRc­‰2šŠA°G”'¥¥Šà´©'>.^=¬¶p”p]`!Í×°ò ´ÉH–s±þ 7Ï”—¤Ö« Õ3 C• ëÐä”Öe‘®7<EÔqr]uâS'v!jU¾“awÕä¶—Õ`·:Ä$ó}’$a)®Ý ]ÙRݲ_ÁÇY‡¼ TIç0 ‰”‹žÞŸòâÚòL2>Îò˜åš°´|¥ušàRÐèÅD ÐУf;=¶…¥`•,~[FUª¨ýà;‚òÖŒ„›‚sñMaŽÕsp:Íîf—…ÞÏ’_i¼Ö~û‚—ÖÚ¦ê<ëf>§¿ÜÌ>\ß|Z̦å•AÒ¿öÉA“¥#E1‰j’Ƥ¨P룽˰‚Þ*ê#ŠYåQëR¤sØu­†E®Ë©@ç ³¥¬<&GáÑW“UIÕGÒ.? @XLÏkŽ^ÌŽT:ªLââ¿ò°íÖ©c„mt·Ž ï ¢£ß+ŽÈTÇÄWŸO«|yqÐÁ'sº4¡‘ì‰Û5(ŸÏo­+U¹7¨X¾zÕìfñEΫ;|Þ}Éd"|ÎR¥Y*Áé÷¡ìâ‹çJS¶8ÜÛ“ŸWZ”Žaø1…n²¿°}ÄÜRPKq^7ÔÐvÊëâ¯OòNÖ® endstream endobj 1026 0 obj << /Length 254 /Filter /FlateDecode >> stream xÚ¥PMKÃ0¾÷Wä˜ ’æÍW<騢àk ‚Ê(.W¡Zðâ71N zLïÃËó•âñªª¬dVVèáPðí¸C¬/ øäÑH¤3æ™/Ês­pæ¸äû¹•ߢ[ †Pá¬5¸]µl}º"TJ‰Ûç0&¤ðu7añÔ=’{UÔþ+M Í´’¬vdÿè'YæŒQ©ĪT¬i×*wœ†iÜôcw\ó]–Ô&:Sß& Ãëþ…¤$œ˜õÍ¥ß4írY7Í·„:¦b@Ö‰¬{Ë¢r‘g¶<õyº} åÉ%oåoùGúŸ3Hßýì1p… endstream endobj 1030 0 obj << /Length 1174 /Filter /FlateDecode >> stream xÚ½WmOë6ýί¨˜¶¥\š;IÓÂec1!˜ú¢MÚ˜Iê-µ+'®¦ûß÷ø%iú´í‡v&´ÛCNFãECÔ#t´˜ ±“˜†^èM Éø£y?ÿéš"ß΃×é¡¡‹ðÀL5¡²`añ@ÃBÃù¸‹#çnfÞ·ÍeNU8Ì|fÅÜD MI™Ùæ%‘0©ÌÕ*\ÃÆG;ì÷EÜðñÝ 4tÞuUҜ޿ù3GïÕ„z½žô×ñ/YFOLHæè>/¤Ãò1$Ó9ê"gýß [TzªôtY?}9Zlƒ[\ó8+j^f·³ñù­‰ç”$j?©8…ôa4PfܚʯXëCÉKI¸;ÿnmzü…ÖÇxa>/ãj?= –T›¨Íü/Ý8t¬Ð(yžÃN•`€W1Ï„Xšè‰HF2µ·#«Qê>jÄKì™e™M»ÈsÛ²˜ˆ…‰y¹xPª ‡Ñ>e qFäe)§’Š+þ€’¡ä "XèföjüýÕP¨fŒSUUakUóm„…þ( ½=T/$%m-{+Íþ`+Í p–[bKI¡”1NmnórJ¤}KÔ öPLðÅØÛ¹›u&kW¤ÌsFøk.(/‹·×ƒfš`H+#æêH†ÓÏÝÉ¥P¯ìp¶ZÖJxS°áÊ…@Þ5t Çl‘j¿p€ÉckèÑx|7>©Vƹ(bî*9‘ðu_5t¤/¬XÑýr=½¿<¿¾™G«½MD?ï2é­x6Á'QÖ”ëô¾¥P¾2Jel­…™Ju®l2iËõ\ù?({pçÞcþÑ£ Šàa°µ ×RÙegÞ©õÚT‡ïÞµ}¡òpçeCqщ¸/¬ã^klG¯> stream xÚÕXmoÛ6þž_a`&#R¢^š®@Ö4E´+RûÐmÑ1 Yò()/X÷ßw|‘-ÓJœ¶é‡µ@yâËÝsÇçîèâQñ(!£$ Q&£Ùò гòrd„‹WØîóa£ßÛùëäàèŒÒPdx4™÷UMòѧcŸdi{ïß¼G'oÆ~†ÞûšK%EÞkVŽI구šüvðr²¶F E4 ­Û½ƒ/| £˜tøHŒ|ѱOcâŒ}ìÉ©h$ƒp èêå¢n¤˜¶¨ÊZtý F>Î&©Qw>‡s$ðn•OUk>®Õ‡q³13MeÆš-W7ò\VK#1pæ•Ué× +s&s³ÐGóDM‘^Ta}).=+S}êYõü†ÍšâÖ"Z°Æ ‰ ®i_B„)6¾”œç‚QŒ®2å%œŒáPiÆfÁ Êy%—L³µ™Ât5¦±ÇDÁ¦WØ“Xû ËKÞ,*­^¹ÇÞRajëÆ,+/ÏÚ˜©%½Ôêʸ56‡[«¤‘!¬jiSàµæjÎ]Šâ4@1¡š]ˆÂ4 2øM³í7zg‡S¡Û ãùŽÏll 0Š ÿ?¼¨Ê_5õ§'feÅ.¹‘b.Á)å}ÌwgD·{L‚S”dë\‡0°ÒÀ¬Ì*È+Á¯»ÕÜÅâÅqòÍqíÎïAíšÑ¨_,تá9µñ}mé•x¹qÔ‹qš¸D4E4‰än÷¸P}ÁäŽ ç¼Ì¨‘)0!¥(‹ãH>Uà¤×DC›šG‡cUð<ÿ{þ‡GëÜP;ÎDÁŸ ˆ*VÍ ˜޲=GPÇÀy9+Úœ›¨ƒº *yÁY®X ä98E §ªšBAÄü“èëzÖ–­d%Z<¿ÏüãûG\ÿÌØ,T!í]ù¸¶ã´EnDf†~›03Õô3Ýg”TÏ$kf ˆMöAeº9Ôƒ°QµÁØ7®%ApwàA½š в$‚U=k¡øÝ´9² è‹¡­­ Ûˆ99½0ÂÇ€¸ËZµ&nWOyY‹æÖ|\ðϦ.ÃVl#»**ÐIöEEò¿[!ùvøßžž91Ó-R‡KqòÊ~Wsgœ… ¥qÈ:Äž`§|.J¾‹Ðñ._OuîT­$CÑG₃ô÷!ƒ¶°zÈœ¤ôGð2}0 £%“ôÍá6H_n¾Øró‹±IÄûQsÅë› c­†gªÍ¥„Þ¯A£üˆÃÈ* Æ~D I+ˆ¼*Ÿ0ô©ïΧ&;<º—4O×75$¯ÚiWŒ–·«\ÇÅjé-Ý<1ã ñͦ_üyzþnb Å¡¶º.X[#!´Üx˜rkGjj» /Û%/›MñùKëýysU3f‰9Ý0{Z¿”°b’A9ã²~H^sªH¡«”yeƲjœÒéÚ¥s%¶ñ ã†fMwÛ[12ÀþÑ+<[œtí¨¯PÍÙ´vXü¼K´¾¥„n+‘¼i¥ cƒb`/j¾£cW…€‘ù©ŒZuðÖJI¶­ï_³¿‹:ïî¼ãîïé Ë•4 –*ù£çJðÿ¦€OÐ#0 ÿJ ü°.º´dB½l‚«Jä;w…÷]–ÒB0pJƒ÷œ/ªje¤+&ÓôÁIxg±Ú¢˜«ìZ…íÖUá¾™àõ–wÏ̲]NÕË>Ë’ý—YÁ¤ûzi’üb0ïãZ¿Wñ¯¾á<8¶!ê ßýúvPï¨~{rѽš"«ÿ ¡½ë"½­cºÛ{J_½|Ó)½ä¥«¦8ü¨ö(âî ÉY÷^¾¥úoøqOµAõcü?š>ì endstream endobj 1038 0 obj << /Length 1112 /Filter /FlateDecode >> stream xÚ­W[oÛ6~ϯ0 qÚXu±ãtyèR§H‘¥…ã ÖÁ•%Êâf‘†DÅ1†ü÷‘âEwGÅ–"¥ðܾóKÁÀdÿÀ`b &¶qaO~|dæ_“õ@怼7bG¥›¿-ŽÎo\wLcjNÁ`–U-‚ÁÃëÈÛR˜œŽlÛZ—§#Çq‡³g/Þn`ʾË™ ÁôôÏŧ£ÙB[r-×p»§[êvÃ7 .Œéxìp×sÓsql˜®#ü;sÊŇ·T-÷6µÔ/>Ì%Z6h2ü@h¹íÁ€!OÀèâuDH +lŒ!Hp©Ýdª,Ó™t‘pëµP‰â^îૼ';qØ“L…'Aô#¯U¥’¸«È½lCuE³ŠZ§5ÐóËÖ¸³ ”7,&Á“´Ã˜1Ôp/ øWM|BÕQ6MùÁò´+¶&'…5ÓkˆaâQ’è+¼èÆfÖÊÕrŠF”ç‡Åú*Kî E¾vÄÓU¡æ€ïm$¿#O†MJTbȵ@4Èí%PKI¹þ`¢'ÒLu¥(ÚaJ\ÜÉ«-¼>×P¼% õ° ”¨¬Cÿoy£Áž«¢Û‡ÝYãýD°;bšù>LÓ0ÛH®}fÚ“RåûƒÙ8©Æ¡Íß?ÞÝIÔ Â9æ=k1´I¶ Tª³Z¿Há:†˜–¢/¢Â‰ µbLùzÊÔ8è *šµYðøª‹“W¼ý“ËÇŒ¿eþ‡Û„O„”²mAõËãÙ|þy~©û &´”ÌCõöØ>îœIðY;·9ûv»XÞ¼¿½{œÏ ‘QÅQ)øò3,Ý6µWX%iu‚L¦2Ã4½eÔ=ê1¨"µFuu¤Üç°ÖÖU7ÔX‹ ÂÌÃr‹ŠÙ¶vÖË%šFSW°½ÿHÂBÕÀ™¡=§!pÝ{ —ü_&[3Q­P6Ê[…WTá¸T­¤Ùš­ V `:í„AW/]™ï$þ¿}|û¶^’SÃnUÏss ‰hòMG{³¾äÊ¡Ëùø—P”âÙs©²Zì½o_#ÕXúдO²êÖºÛ–ª3š’·Šà| ³»W—BÅÌ:vå [zÓÃãõõìᡆ Såó‹RnB5Ô¨Ski‘üÃËÍè¿ü” ðÿÿ ry ð endstream endobj 1045 0 obj << /Length 1656 /Filter /FlateDecode >> stream xÚ½XmoÛ6þž_adØ&§±*RïM3 ËK‘!M ÇA´E&K”­N–<‰Š¬ûï»#)[Rm'èº6@I‘âñ¹»çR&=þHÏ¥=×3uÏt{álϣŤ';ÃW{D½7€7í=¿°í1tßðIo7M¢Þ{ýõ=ÏÑn¯oõáÉu`š¦v[²{–ö:ÈúÔÓª íý¶w>ZífS[·-ó‰Ðê·¿Àç>K7-‡Öø¨£¶¥ðéN`;T;éˆVŒ^}è<:×Ö¢¤äE2®x’g¥ú`ØÆ fù|òö†¢ïÃè ˆ¯êɽ.cXA íÎ+ù°À.Gx.Û2˜ÍS&ûq‘Ïd/€†øZ–gƒ’Y‘œhB=Ä!Ú9ÌÏ’É´±ËòâiÊ<[!O¢iÀå&ÔE àšðÅÔ‰M¤/c‘‘³líŒÍ¥­,’Aq`Q&[>e²“dq^̧JÙˆé¾o;Z¤Á8eˆÝu„Ÿ0=c|š óè¦ãh3ÄT•\N£®¦öqJ¼ JÌ'S›ÅÒ¼}+NÍa(¼j»’±.ÿ€*Žgèµõt†uÇÿlt뤱vsÔ/ˆxÞ°PŪƒè–,Ž÷§y²9/?Ê™y0a²çtáRbëh¼‰y{¹Ôo?“Ow©ÛÆ‹P† “0s™Cä@qŸ°E=u1šÄÑÇýê¸ÖëAÝÝF >sÎr[Å÷µ¢—«E*ÆV#ÆžÛuÀ²=Ýv'¹~û¸ M:%tK#Æ¡2J] ŒIzžî;Ž… Ï@X9€4Ù¦*Íç}TCmð_þIÏWµoè–ÓÙà"IÙ ÙA±¢w Az¥†å?²üÛãkÛ¯Eû Ò VÔq]ë{¢¢dJÛ\faZEL>€B Æþ”òû1„O˜ªMŽþ4M½¬²ª2}úˮݿƒ{²åSTø7äÃBµU©:l&,cEʇæQ&Gòñ'HÑ7¶Æ£†€Â#:eccy‚¶‘5÷Áh[®±Éúš!8j¶î»ÌŠQA=¼‘T£©BñöìB9«¶*¶ù\£œ$÷L áˆ&ÔØÈ‰¯@Ùi€=†–(ªÈfy°Tã‰ÂüyùYQîX¶°€Ø®½;vÒFŒ×§¥¸0‰¥ÊÂKÔ`îöK¢ü@LKƒ»¥E!e9\3ŠE‚”" ¢ÿOßu™+®&Ši£³¡ì {#(ï;LÍž±¬Løƒ|²Oò¬_a1M©¸<"iû«JŠÚlÐáÔŠ÷¼¦èIr—®{Öfoðˆïù–õ·× Þ$ã*œA‚!1îó$ª/ÔÝôý-}8ó:IV(Ô'G¨ó`¯Fžæù\öîƒ"Á&°Ä5·žnQ^kÑXv-’4Uj§ÝhCÚ£Zd²j6F1÷}w›çµÍ3¦A±á@šð¼hjàZ§6¢Çõw¯Î¯eEj`ã/óXÞ;ÌÂûĶGXpZ°€³ŽÛ[aÊRÜÅçÛ]§@˜g<ɪ¼Ú¢Ö¼›jötšç-dÕ¾X•-^ ËÝÆ†I-½J¨ðÅK… d«XC=ZFî ¸­µèБìΣø…lŸ @_EO̓ ŽÑö€’µHüÔÄÌ£b玤rÕ6ñë’·Ï“d6Ï øtTÃø¹)ÐMYø§z£+!æ}}ÇÛ Y·3)³\[ TY…!+˸Ju9ðf­éøøìñsÛÕö×·WW*¬9–8vÃX©å"¯êRƒî½¤d“ËxÃû8¨RÞŽ,R⺠ÄÕ®ŸúN,µÌöšiÇk·Öé—ÒG,ø$¢­ZŠçpÍåâ\-9~q(쟇o†/jDz,çdîª]¤cÖ`W4[&| ûü÷ËÑÝÅÉåÕíð¼AÈPµðŸ]*x/dçQ˜;'înÉù‚(5³¿¼>¥ë3´-;8t>Ñ!®Ä÷·&vÅ Qrl¨âN^’U÷Ù³nrñ\³Ûv–ÄGxs‡b¢h³5Skfìÿˬ.Ijn¸)Eõ7­)ºÊQ¤B¼"þ.ôôd™ºÍò‚6l‹Cww‚Vôˆ$(W†> stream xÚ¥P= Â0Ýû+nL Isù0­£RGɦŶ*ØZªƒ‹ÿÝÔX)¸&„;/ï½;î.‚`Éi`_ü…vðÍzà›G‘Ž˜3Ä ­9KyŠ`«±”-`CæÇ¼½•]H¥”DLCª”&Ù=¯Ûsyu( eˆÀpgWAf?NZh¦•ü1ÖÀþÊ&–N&ª†œ³ :n*}ºGØÿ%qäkÙ¾¹T¾Öù©ÙrÍÝCDqÕÙRá†èuúÏô»xÓ†V8 endstream endobj 1053 0 obj << /Length 1588 /Filter /FlateDecode >> stream xÚ­XYoÛF~÷¯Ò‡PÅpyJqS MlÃE⪌H gM.M¶$WàaÙ(úß;³/6$@´\ÎÎ|3óÍÌ2dbÁ_2 ìI0w̹LÂüÈ»åÝD.–çGDÉÍ@pÖ“üuuôúÌó&Ä2Ö‚LVq_Õ*š|1l{:³ó¹o\]^™Ëw—Ó™ã8ÆUÅJ\¹Æ'ZLí¹ÑÐlz½úíètÕZólÏô\ç™Ð´ô¾ð¹¦ãú¶Ægû¦å¹ ŸLgžoïZÜ1ÀxÆš–4g5++ùÌcù['J^&–¶!êq¬ÉŒ,LbÏ¥S¢‹ D³ôY;€³b#æ Û]w¬`%­ÓâN>—´ˆx.…drü÷v憇R4Ë8no*)Y±û©x}oP ær_é‘9OQúÕ".‹ÌéÌ%¾qË#¨‘7R4âè³pÒ1‰G¤“¯1¡±AY™Tµƒñ·©˜\D,¦M¦ÞÞO=œhXuŒs#U/RŒ¾ãkŒWUz›±¡FW•8ÜOXŽÐ=ÏX%j/æ:@"°¸Åh¾ÖºÒ,kªâΪ_Ò­D•\•f‘Y§a4îzÆÙtî¼”o#VÓ4«äCÅØ˜çvà›¾Lü¹eú¶'xnzðδð±á‡;}æë󳞂•96#ÜÖ¯k¦€zÒË/Ÿ:†V×ÇrsMµ³ó`ì€Kæ¦øöª–~îX©€kÊjsÈdn.|ßEÁ™C3@…xÂQt|ýjŠ-Á˜}Ï©âÕë––éú#giÆÞÈ¥¢•c†X(Jåðъ͆ÐÙ#E˜5“ÐEûÅuÂh„YÇu mÉÛ«)1vbþ)íëú¹)èNfòË!ó?Þ?[H‹Z¾ÎiZ|µ<ëž§ü’]Èÿ› 2|!´ØÄ²ŒôD¨³Zäçk¹º§eJEß!n¢£ŒJMo„xëÚ@ƒQQçY$WbàB·x\M~‹I ÏÚãxßP,ºNõž–[ƒ´,飒á*Éý0x¥ÐûÒÛ¦Ny¡¢q˜SX˜Ñ’ü¨“’íà¿ý›…5vEâ’`_)ቛ¬–*éÔ‰‚£ ‘vÚ§³Åâ°êßßbâ¡Äô:¤—Ÿ64C¥„xžuHëùé¥Ö ƒ{¬UÍrþ„Ö]¾ªT$©X2˜iÁyªHCËh;,oЀu°e Àç´iJ MÐ:QåÄôžm*Ån£ì>¥]"`8áà öZÖ\µ®å·ÚÊÉ!i2”+'»Š0Äæt#¶o ^æ4Ã1(šce_þ`ç8ÙUn:#ïÎGI·¸H5þÕ‡%øo[î^‚ÙmˆuÙÑ ´Û8ȇ¼sˆ„ð\­ðv:(Æöz5¬|sýFÎþ©´l¨î²xí u Vùá¾Íø]û0j-]s€.WŘ ¤Œ©úãî@µ©X}v‰7Ž5 öe<ב„Þ˜èóZ®«ˆ4ÏYT×ÉC¶†JqbŠz†JõMJî|·m:ˆRòXÔ„]a®9 ¹j_^\³>X·ÃlôµíÊ ±ÔâòêãÇç–VÉÚè¶Àv6O¤/\÷…ÎlWXZ¤5"ŒOú’×iØ"¡:ØIª<i;ǩڢYÅuÉAäù#Ï÷Þp9@ AO \ƒ£/•™jÐzªT_ÃX«À@Wj¬\(ÅÚŸ4_ó²ÞbU˜°ð%1n,!&«¿ñþ´É¹ølg7ÚŪ «ª¸ÉT•íå&ÕTÿ6^ýhÍw¬DŘëɘ·nÃ}= i3j÷»ËYQ÷¼ïµX'8j­Â/øî4bÑ ªßvnuÝUÞf‰ öxj–àuŒ:ªn÷º*_œ.—Ÿ—o´g…øPo³y¨â¾Ç-^ §7wÙCZw°OÿºXÝœ½»øxµ<íNÌvýïP?³tÝ~÷÷IZ²6AÝÔÛ{?Ð[9½‹ cbpäÞáŽ$ «ì=â$ÊVé‚ibèÑBÝÐs^²ãgÕ‹>Z%QoÙîö£Äí¥> stream xÚÍUÑn›0}ÏW JÓH68„u}Y–NÝæMZ§Œ€O‹GM5õßg¸@ ÍÖL{YòÀÁ\Ÿ{î A†£¿Èð±áO]{êúF¼8ÕªÌ ·ï¨®³t¡Õ©|Æ×„ȱ'@F˜v©ÂÄøbÎòh£¨Z®ëšøÕÐòÒÕ úÆçÃr»ùAÜx[qÄl @å5È(§2RB­X}§±üM?{Y— ¸U³€S)ÖC Ÿ˜çã²iÝ€¥uy“¾œö¨„J²ÕV1ÁmXšg¶öqI°¤²;‡8ìʹ„;öµðâB?Cpó³âl‘>Ïž_Õ>ð­\B3ËXpU’ënKžËc*6’q•–Ug/Ò;äzül´ÛW[ÝaÇcCƒu 0î[rS;Ì ¸nDQ°Ucì=S9 5U¹H‡ooû³PrËãHÑ?¸ +Çm´´7¡;ÍÀxöl>l[Oá‰ó»ÙU.«D.ã<[6r“ÒÅ–{ÈBv»÷~•‡º«ÓAwò4œQ±2dØñ|òFëï“…NˆÖ§œòƒ_R†‹zpœÒäô×@Äê4 IGn> stream xÚíYmoG þ~¿b>Ò/³ã±=/(B…RR©¢¤¶UGr…´áÝmüû>Þã%É-e³ËK>TJ²Þ]ïŒýøÇ©]p5EG‘\Uv‘®â¿5±“l÷ê´2îÅe|QÏBÆ5; Qžq™1a ÊÙ1%19Ž‚ékP!$|ÄE!TGR0L‚²F¼Êä(QvIeªøg-³š1L®*xRCpø&†¡R ŒÏ0>øT`> ‰ao†Žˆ=©.*îjrªyVKp1›Ï0$¶Wê`'P)0`; ü 8RÆÃ8•³à«ªWøPaŠ8Ò•(Ì*œålðURªaÄI` W„l’ZDX„wÁ‰`pŒ&šm‚è$Ù+‚¤Á$¼ÌÊ3Hê^q©8íæ„$š’IÅ$ N)G¨5Â<肱šDâTXL‡Ê£CZ —à*" YapÄ3‹0ua“²VŒ³“ÇÂژÑUyGƒÑ#BsGøËÔI¢fÖŠA¢%fBœÔØ`eJbê˜6åÎGÀ” `DüsˆafNå -Æ#xjR†ÔÁÌÐD M‚G“àRæjz ®&E—“ýÁ»Œ…À1—`Ð †-Ò}ˆak4¤º¢Á ¬J0JxPˆM±+Q1³:p,`0bk#Ò"µXeE±ŠööfÍ£·¯®¹½\®ÚYsxö¬íî9Yþ3kî¬ÖÇ‹µ{°tÃÓYs°8jÝÐÂTsð Là…GX!ò"½ÛnoÏ5‡®¹¿z´rÍ]wã°=>>Ù´?¸[·fø71ªx¶eÇâ3⪩øX¿Þ”U}iTÄÇ.eùPÀEUOÒ;ëÃEûbu¼™6«{È  ? ,%yÍÜ;ñýÓÕf3_¿ ±$ö„µHfžäèc¦q“öÏÂ%z6¦S5Xß»Ç<±Eó‚­îãÄlÿÜxѶ¯n6ͦ·/çí ÿúÌÏü¼m6«¿Ú×óõ¢9X>?l׋ùËMsEó‡žaAâX´Èdvÿ M.ªÙcsÁ6}ECZ°07 v\zcöøà×ûg%õH8.bK!_l[R/¹šð®-«Š\óÛïXΩ"¥¸åÙééÓ/ ï {âçôDÉ+éE½{«eÛ¹pϲäVÿ²i~'"çGdÒí•#ÒÉøºÙ_¯ŽÈ5ûwï¹æÑâMëž^Äyþ|1k~Â$‹e»AEÒMaÈnVgë£Å¦+RºGÇ'ó;«7[øÛÆZ€Ðû`L­X8¦~ÎÍ”?‹Z¯—\CUåËù™ãŽŸ9Lô3Ó v\R‹1#êåªxœ£ÀG4.À4Ý…†§B#à‘KÐToÙøÚÖ§/F›²K›r5ÚÙªw nƒÉ­X7“¬Vß^·Yáéø„%o·Ê”Q ¯âµdT'!õfÅŸßÌ_¾:]L¬(asF厳‚(…%XVFDŠæÞ™ï¢*ZŸ<;kOVË?WÏþÆ@­ˆZ<¶läÞ YɈX•íU׃ÆÇBã2×…ùÉ,ö´£Ù¸›¬KšÈÆ¢SÙGVMá܃êR½¸¢ǹ'xTúƒë¶ÿ‘;ǹt@8™×ÞãÊ@ândÆF ÊNjœJS#ÀÁ&³®y²“7ò¢â"E˧C Êã"0 öék‡\¾‚®m01Û-ÃvíúÛï’t­ï_„ÉëÙ*§®à­AÀ!øÔõ‚¯œ¾Þ±ŽqXÐDbñÖ`øp¬ãⱇ£dm…/‰/iðÐc¯Âõ[@нÊúw–·@NIÁëUö1éÕ-ŸØ”PçuÃÆè3'õÖé"Ž^Š :ʽœŸœ¶«›g˳õ|ùãΉîªeöÁ:Žv¸”Š+'œ´»ûi‡Ë­Í¥|Ò5 T‚;z”ƒ—Ig†ó%âÇt4>픞´3qóíz›Sk?BηV"weͪ·®cÎý-¢KDïôtn+j7\y`¸¦ïÔŸ Ýèõ„¨Ž ÑyO) Cd€Þçé:Ì4‘¨¤»(ЕÎsd-Çdœ{_ħz|*Ó}ªC[¯GhcOéi2 q`Š ÷m`H=0Ètô;2œ{§3<dx¼& çžäÅã’×ùm–é]õÎqê~k[mFeg]oRpzK¥øò‰6 |;Z¼šZ²Zû?¥üafÁÂÚ,ÿ5sÿ¯ûÏâ J°\Jô^œ®F ;+ƒów\íÒCsáQ>§¹¼§¹üOsHs¹&4—šËtšË÷¤¹öÔ+J“i®“[0˜ê"Ñh<Ñt`õ¤×¤zÒžêIe,Ñþ|Pu endstream endobj 1062 0 obj << /Length 1613 /Filter /FlateDecode >> stream xÚÕWioÛFýî_!¸hK%Ö†Ë[q\ÀuäÀEâ¶„H•&—SŠ+ð°ùïÙƒ"iI6ÐhXËåìœoÞ,éÀ„ÿtà[?°I`ûƒhu`ŠÝb1‹«7TÉ@pÔ’üyzðâÜuÔ$csLÓ¤­j>–3Yã ðŒÙåŒ\^G¶m³’¸rŒwa>´£³áçé/“ic͵\â:ö]ÓÒüóÁ?‡ØŽgiÿ,˜®£ü#Ápäz–q¶ óŸ|×X‡E¸b+JùÌù[-•¼\rXZFŒŽñÉtÍëªHó…8ý0QãbHñ ÅÈú‰2#:&Ô ¤“0Â4,![®©õ[>êÇ„Cº,gl,XΊ°†ð¹󘯤Lä ÿÞÀN`ˆP*Ì2ŽÛw¥”,ÙíP¼‡¬ vÄ(Pq¹¯ôȇOqúɤ‹ÉpäPϸH䑯¨‘×R4æ³Ò&Ô¥2ÈœWXt߸CYYxµƒñ·.™\Ä, ëL½½ºQ³ò7#U/R¬íká/Ëô&c]2¯ª¸¸¿d+tÝuéRí%\'HV¶Ø}¸Zk]i–Õeyge'.ÖR•x–fížY»•a4î¸Æù0° ^È·1«Â4+åCÉX¿,ß#žç¼À$žåŠ^ .¼#æþPK4Ew§Ýúü¨¥`K÷ö͈ð 3ÖSŽº2Êï6-?ÉÍu¨ƒ ü~ ˆë{v7³–~ÄݾRá.‘ÝfÓA@Æžç àȦ>ñQ!ž°_<"m£¿óOªxö¢Á…I¯gà<ÍØK¹T°²ç'a³Ph—ýÇÿyÿºú5qáúôÃàÓò| µÿÐ+ ŠjY]y”Õ1“0=ÄðÀõ’…1â× ¤¦²î3àÛm~—¶U½ªóh“,Úgý_ /Í+ùz¦9Î[žÆzJôÿSì €¤[¡Ä¢¦i¤ÇB›Ù8žq¾–«Û°HCÁ‡ÔñAt{=c^ 1Éq‹ròjž†úôý„š‡¨èX˜i»ÛèáB%7U§«5/ª&çx¿Š—,úCI$½ÊFضMöx²»%iì¶æ ÝP9UÖPê²LêLuÓ{Ð^Ü¥Š¿ƒ»q4æ/goß¶êŠå§¦k>âFÓ®w¼ÖL…u¯åJ¶X±¼jE¯nÑí<Á¡¸×%ÞJà@öú¢ 66ø:Ù„µÁŠœ\ðáES;J’5Ü6ªu”ÌñâH5ÓäêêýÕKY.>šjîãÞOÔvò¼º½ÆîÓjãöä·‹éüüôâíìjÒä6G¿í› —üN.¾â'r¹ÇGû'Æ hd—êÃC¨À» ¥]wS홡 9Yœãñκ60À ¥'¦êÝôm–ÏŸ÷k‹··«ç~ ãˆ`æÀi•BÍÃ:©Ó\~ŸÈšÝ·j´Åà·}÷Œ>‘¬›ÏÃþhD>ëM)] â> stream xÚ¥P= Â0Ýû+nL Isù0­£RGɦŶ*ØZªƒ‹ÿÝÔX)¸&„;/ï½;î.‚`Éi`_ü…vðÍzà›G‘Ž˜3Ä ­9KyŠ`«±”-`CæÇ¼½•]H¥”DLCª”&Ù=¯Ûsyu( eˆÐáή‚Ì~œ´ÐL+ùc¬ý•M"$,LT 9g tÜTút°ÿKâÈײ)|s©|­óS³å𻇉â>ª³¥Â -Ðë ôŸ36èwñ×ÚV< endstream endobj 1071 0 obj << /Length 1810 /Filter /FlateDecode >> stream xÚÅXYoÛF~÷¯’ʰ(îòŽÛNb.Ç% €c+q%mCqUQ„ ÿ½³)’¢äAS0÷Î=ß zü¢ž{~`›í÷æë3Kž¦ËžZŒÞ!M7ÂAòõølxãº=d™¡¢ÞxQg5ŽzöúgLî&æèê®?°mÛ˜d4+Çø@’>Œ‚Äý§ñïg×ãJš‹]ÓuìïT­¤>ÐÏýÓv<\ê‡=Ór­Ÿö®‡7+’,)èä»F‘°O×j“’$âz½¤ MIÎS¡kÛt«7@¡‰p 8_Å1¼ä…µ—ä–Ï„@ãO:ÏÕA‘QµÈWR¾edd­"º E\VjÁ¦R ÖàAß(ÖÂÀþÒ´SôLPìœMPƵñª – ³¤¶‰\¤ì˜C€öJÖbãsÁJº,R·9WO"•Ù©MM¾Øò…zy'^æ…>U¬8›kÖY¡N4ßÉÕ9%õók_yÕÕ^+’)B–ëŠm“†ÊÄÊ—Ø5T6®­0ØW¾l tåSºGÜg+’RuÆrõܲ|¥/ùZßqˆrÉbŸ ÄÁq°q«ß„PÈ÷Hœqu²‘ÞçYÆf±f•ë«y_Ú+Ò·#~*«¹)ÖÊ ¢U1êÉÙšêüx ´]žØCfè=ÏóMÇwdyš.Ü™V–uÚ<©lùþ Æ PÚb¤MP¬›¼LrO©þ8ÉX²S}.Ç ±àÚ™Xb±·@n«ŒY>®ï?AE†«IH"®”ZaÞLbëMECØûžà~²\+£ZåUžo^ ‡PXùšä+s[˜dn’|˜ñE¾…†;%Ë•@CxuÑv"WÏ9_oXé¼۳;^hË*”J‘/úRBB–Û)» :™Ã9OlY¤´L1 ¨AU@ì ¿‹ß¡›>.J;Š4£­hÓ¯t^ädV""W â9£e$Ÿ|ˆ5Yc5VA;éÎî¼2U80v}÷'—4†ö‰[n“y\D´^ÛÚ/”DTgõ²A¦ª¸'Rõ%«3û¥H ÈxsõÛwÓNEÌëØ·WꎒsX’—øÁ‘Q_8‹dÜ:,ù&CÓANóBrÁò„]JvV¥yÌùF­¾”©dDŽ˜RŠSÄ‹*_¿¶ym™ø¢’!ãqÔÊöCÈé|Û=–ºuA‹ I!øII¬’4%»îIZ ³gÖºˆÄ’ÍŠœñD{£åóVPßÒyLÒvÕæ«”v$)Ÿ•_ :­oLßÞB1ê K¥.µ:¥à¦¦{îýAÃÉùþj¤¡ìÜlmT Oå™&O„Ü£Q\ß]ß•\¡©´¹Ö'Æ\Ÿu°v`+hÏt­– Âý¶wÒEÀBÐÎʉG:bƒÛ‘hˆï´ÆÞaùâöPÐîð-š•¶Ÿ”›–ß3êV¦Axt)’Œ-“²SļlýâÍÇ'µþU=¾!„ m:Ƹ\€Z.a.—®ë–KÏóŠ¿/»„Wm~ú@ó{¥8|”FzZ uy ÿ÷s‚öoï`Å6z¶¿}€áªá¸2  —L n§%ßTè¢>ð*‡ ŽçÆí5<\GE¦r#¢µºØ4¡[Žr A/!iô‹Å~„©sÖ¬ï&ïßëQNŽ1,ß“_ÿq;žÞ\ݾŸŒ®CÞ*‹IÖ Û&¥0ݳ*…Á1IDÒè_USÝ1ÿJÀz Q){“øOOWƒÀZ…D‹±†»øh••ÝÈjV6/OQ£&µÝM-M< £<žÎÀáâFS¼hñl‘½YqÞr:øbÅ#ýÕ7~;ó±åÍ4{¨`¥erI]+=Ä_þ%Ä  endstream endobj 1075 0 obj << /Length 1192 /Filter /FlateDecode >> stream xÚÍXkoÛ6ýž_á¥ê´±"êÅm3  Ü"C–ŽƒmX—–¯l®iPÒœ`È)’²žŽ‡îÃ$¦ò>Î=ç’ Øâ g\¸Ö… ÂäÈ.fùj ÓGH¯‰…£ÊÊgGg|€lklÑ`UMÍ–ƒß‡Wk¼É€ŸŒ\×:oNFžç'8ÙÄŠYäxÁÐ Nþ˜ýt4™•ž|Ç·|Ï=0,³º›‹ÖøüÜ“¡!¦ƒ¼A€Ä걫â;{u"·ï Sƒœ’ˆñD=¬€Çãê‘Põ¹Á'P¤%ÙâOÅöñ8ð‡¯Îd."®‘pç+/9Íù<…lžsºúlûviçT{óH ÅŸÑ[cÃÈ:N=Ô+85ÎÖЩ É:¡ó Ûn…”A±G­¾4©‹( %™ŒPÄÖŽÕ#¹e ËHpfF$U£DZ­±žÂqÊÔh iÆÙ#,™TÀu‘ß» Á`/Ç_ÄÖ—Úq§>R²ÔÖ!Š40~P3Þ…ôµ6lò!Ɇñ S“¨Î$\CøU¯ˆÙ„²X„i YÔ_6P7{ºrÝš Ó< !M£<¶ÔÄ'aœoIª=|.^ÖÓ(½ßÞßÜhСäÈ~rLuɶ,—¦Ò¹qh ‡U4«$á<Îê0‰MÚ@d˜›ÊÖ@èÊÚ‹1 ™º£ñå.-É]õôw±yå­‰6\dIi¶nÄx<™N?MߘÌ(eY¥˜û÷¹=®é¦RGx Ù.ìɯ׳ù‡÷×7÷ÓÉnǨ+ЧCÒ KS²ˆ¡ÎQeÊò/‰P Yä~VV²['ÝÅÏ3˜$ßþŽTĬË÷ÈrŠvVBMÁ0Ã`†é£$ŒÃé!z1;Óõލ èî>ÚÄA/H@øy”,D~/ ‹ŽYÀ8—;eY‹§g{ø-Û6<+5qHoo©Û¤PL:,9©NJèZMV–{Q(µ+ó'—ö[ ÿ;T_¿n rlyȯÛyhŸF*™yÈh¦¥Þ—Þ½óñ÷‘âéCEXŸönºD[0-·ÙøÓ-ÉÂu} ÅAÃVOè6 ~¹h0Ü€“ƒÔeÚ …‹nÌô˜æÉx*9\ôsV\5œ6Òrz.~T@s ÛJ9=rz[ZµW wvâCú_—ÀÂõªqq<¨\œœ/N–e5N°ªVð ÉyÇözKñÍLÿ?ý—µ9@iLJt¥f«.m;çÎs,/û îЦ•ËʸýÛ Mn¢×™54/¤Õc¢æ¼Lùå5pI­=¡r3ñ·ÿýh­wzéÞ!³»û««ÉÝ]ƒ$^”OjÁŒFLÛI„<¤Á½÷_žGßòÕtPÅãÄâˆl÷¢„†qn.úïÄ•Ž0kýC§‰ÖÒ˜,zÖÓà 1²ìÒ¸×+Óߌ®’<Í ¼xwG3üšÞ~¼›M'ïV"&Žùcã"—Óæk¨×éïŠ^ÐwE]äµpä ñ–X–¾\2ƒQÙùpž±…Ö«gâÖ@!­•®“g5¥âÄÜ×þ3:É3ü·\Ÿ endstream endobj 1079 0 obj << /Length 1577 /Filter /FlateDecode >> stream xÚ½XmoÛF þž_at&·±ªÓ‹-'í€.I3]R¸6 -²³t¶´ÉR —¸YÑÿ>òx'KòKì%ù òDñ’y—°ž¿¬7²{#ß1}gÔ VG–\Í—=¦—GLÙ Àpаüqvôò­çõ˜eŽ­1ëÍMW³°÷ѰýþÀûþи¹º1§o®úÇqŒ›Bä(¹Æ/<íÛ¾Qñ¤ÿyöóÑŬÞͳ=Ós'BÓÖ[øF€Ï5whk|öдlÎóÒ„Ê5§Ô‘Ö hkY’ ùâ¾±’!bU¸Hð°åØ1Bd3Jä³4U ãëÜ£‹D}ÕÉ«óë§Õ—Ø2;bMÅšæI– S@«]¬F¦å Éj†›Ú#%…FÀ`t‹K⋤?)EDo R#M7{dr\m–u,pR/'—¤‡}«¸ð”Ìæ’ÚÊå†Â!™I`8ƒ:žFÔÖ èÏ>ÌÎIŠ šªU!B“&’Ãz¾9]H¶oúÒ)ÌCröòyg§1ø'?äâù˺F–éY{ƒ·q"NHTI¿¥2ˆ…Y–e<‡”µ}ü‡mÓ¶ÝÞ`’I RàÀ’çÊÈr<±P^@ лÌǹ Y…ý]ÜôõªJ«œ§fôCk{ö¿ÇGÏ2B¢4JAÊZ=¡Ö*n-Hú£Ð¤?êHÿ–AóŒd–g=B‹ö¸ÂÙ#(Ì•Ç@·†Ì~¦Ê ­Äð wC­1y%º9sgn:@~Õø щH¶ôn¬ò(”’lJ…ûöôÇv‡ »jòïé3¬TÐà°ù•¸ÏâžlW9¾Êűé2·ýBzÁö4âS†àO#O²ìޤ{žÇ|Ž4b#gï$³j®©ö¥ël'‰æ\v*­âÅå´ZͱÇãÑc%}¿‡«Í:šOÇJît>“úš_-Ó;&‘™JðÌo§‡€‹ áy—ge”‹³‡8Œw'æ²Ñ> øÅíùäÃlª8!ƒ“b’Õ5íÑf~ jùU«þ8Ùoåòí2^bŸOì¸ÓCà,Ê2=sxs˜œ´¦ ·Q‘'ØoRP”á-\$"„÷8FÎjRî¨lè[û’´é6¬b°ÛH:Õ›¨É¥O©xu—å%× ¯þt0ˆàOeÑ=†èöX—v±?,¢ßÁCJ3C*®@Uˆ¢XT‰:_®Á{¾Žu-‡=¾oÇQouóîêœ &,öÍÎJy5–²JÏÈ€Wòb¹iÙˆ~Á«¤lç /ˆUþ!©y‹v€¥ÜÔùõ&,yÂÐdÔ7rLkòuq—CÐ t$y®zåÙÅtz==©¯iV6ŠyˆŸ˜ã¦ÏZ¼j‚†;B¹}ñÛdvûöÍäÝÍôbóÉ T}øíàmªÃÒ»¬(âú´Ð$ÍÅöbÿìiÑ[E½‹ ]bdȽǯ@U½‡¬RHÔ^uªS¡‰¡SÆÓ5•²\?©_ô§p‘¬‰ªosð×a™gzì¢>ûV6z0ÏáÆÔÅ/ ¹´+}£­SPß7·ë´çêt·¡h\¥é)OHÕNN¨j],Í“=ƒ_y©›¿¶NUþ_±Z|ñ¢Ó‘ø?¶¿,ÊÀ endstream endobj 1082 0 obj << /Length 842 /Filter /FlateDecode >> stream xÚíVÛnÚ@}ÏW8‘*Aή/€“æ¡!¤MUµµR!ƒÇx[X[ë%!­òï]{׈I¨Ú‡V*<ìufÎÌœ™5Öøc­mh펩w̶6]ì¡t—Í49é¿ÝÃê^S\l–nž÷Ž/m[ÃHwƒµ¡_V5ô´ëZ7p#¬Þ4M³fœÔ›–e×z+wÍ!»Ø°Ú5éßßïõ†¹%Û°uÛ2w„•Ý~‚ÍÄZGwZ-+†±£· G@léȶ$¾U=‘®ÉaI—l§àÆÓòd£P1àÓ¢0×ÎZ-,¥#F(÷“[¯ülZô ±*n7ݶ‘™CÄÌ0äæñ¡4ÅåHb9Fa“ÉäÊ™œ,€¡'çÝÁðBÎx(ÇiàÒ™ášD.s…0¥9ôë•j‡ÇU~e€–Ô6 t&׉9#“%'!ÕåÖ»ðî€5äê^Ù Ü;X‡+ÎÜ)/6–˜ Ex­+Ê}ªs®Ž¦.9Ÿ+P„™lÚTõ¾\mÀ(RýOé1>NªÈQ•Õî³ I´Ä‰áî8h[J¼TâÚ¸]C„t„6¨)¯§PS˜)‘DZ@y~ª$1‡Ò³†ÔÚ0_tâBEŸ†=:Ú!¤Õkö¼õnvp‘ØŒ¤Yv#p9xI)­_ì#!ô§ÛHÙêÿR¨,…R¤ÿ= ïRןP4}—êÙÞ|I(€·Ëk¡úU]{2h”tïð=‘׌‚µ¡RD’wÈ0·‹§AôÀÖ;J.…ÐZ¯øG)”Á„ì UÕ,\’EEú  UQoþίl ù$ÿ 3j!g endstream endobj 1086 0 obj << /Length 1371 /Filter /FlateDecode >> stream xÚÅX[oÛ6~ϯ0Ú¹¨h‘ºXN¶Ýš)’4pll@WŒEÛ\u1$*N°??^eIVäí¶ˆ(^ÎùÎwnTàÀá¿p0Fƒqè‚Жɉ#góõ@ ¦—'Pï³ùF»¶ó×ÙÉèÂ÷Ðg³U]Ô,|±\gh£IÖüv¦n‡¶ëºÖ¼ ¹yÖ N‡(´J¿Î>œÏ*m>ò﹯„fvàs|p½|(Žï)|@8´ýY÷8ÙÆ„ƒûÖÓ¼PÃl¥ž¦ -FÙ†0ºTs9N£,QãÇaàZ8§˜‘BXÒ&ÆØp •ÞyAÓµâ↰MÆY ­HMÌ>N7”© Z¨'ÁųZa™š) h>6 ù²ͧ·5Ð|-BËàæ¯C?0¸îÂA&Aà Ü(!‡îÏWÈGlËþž%âÝH(”Ô8À šò/hLNÕ¡ƒŽ}n.-³tE×eNLLìxŠÚ%Ço #ø¾ tºðÒòyeL(ó‚´üIžÈ²døÁذÁÚ2¦  ÆÝé7©1^cš¥( 0½LDPŽ@>œLŽœý¡)xÉE¨©à¼îÇM¶krPÔW¹‰Q¶3Ë,'8)š#*‘)ªõè–þíMŠGÓ#Zú.qY”lùv+\‹ÞûŠD¥12“‹eo¿QŽ’>”Œfé{ˆ[ÐOËç½åØ«t—©Jí‚#¢kÊŠ'ž(pö¥ì[ZöS™–œs°ùåÕ{"½"½j§þSZhÊL-¦©ðàcF#éÄþ–“àA¯¹ ¥ È3’žIqN…<βm-ÊdÚCo|˜¼JR”•Uex2qó´>ÓµÝHÝÑ86©G­ sXÖ‡öØõ_*u•«-Îyb}A_••Bœç¸Ýyä^ÂH^´ꡯyéúdã¼])Ù&'š=üE–L†§_Jmq`ññê~6ÕÞ—˜Î4£· t/|hO&ã—šº}÷aj* §ËuaÍé3M¡ú/zAJ½<¿5Ry[_¤¼SãXœY‹Bs&ÏCÇ>?ÝY¾õ¥ k(ªv¨Ø•ˆ®BÑðI% áç#—‰á17è§u.[”WIQ 1^¼ ¶ûú_2¹u'ê ¿}£ÌÒøùTqú{Æ ¿»éÔh:ù;ºvô·æ‹*ÍÃ4.ÌmçUW1®"„¸¸¡Û¾¯šzÀ?_X åéëšcêvý;i]Š«’pË ISý6Ûñü%ù¡MuÚd©ý?Ýe¾ï<‹”ìø7 ã×"w,ÆÉ'|#þœuI¥«ýu¯®A«¸__ï© O”í·Ÿÿq5[\|¸ºžOÏò»xª¾Îo\ŸêøM¡w¾6¨Aà¬o7lîö»w˪zȸœÖ5M lt稢©Ÿ–ß6Yf‚#ßêºÊÏtÕ Ù¦ÖvM—¿»Õ‡H'/Í!rå&Jj}£j#îÌIþ²Ð Ûb/¤RuÔÚ{ÂŽ<šöônõÄ{Ñh UÀ‘ܨÝR‹ð ¬ø·Ð?°b±[ endstream endobj 1089 0 obj << /Length 1085 /Filter /FlateDecode >> stream xÚÝX[oÛ6~ϯüd§³"êbIÍúµnÐ"uWÆ´…@Û”­Á¦ ŠŠ ýï%ERÖÕv×؆ É!M~çöÓÍ`_@sMÍõ,ݳ\m±½2ò]²Ò„0½¿òÜ–Nþ\ݼv ºoø@ ¢2T°Ô>ö_®áŽ"2Z–Õ7Ÿ†¶íôǸÝmPÊvi»} >o¯ÆA¡É1ݱ­ ÍR§¶Y@ót4²¹i€™i[s;í[¾›ë¿Þÿ€¨`vˆ7›’'±Îp%d+âe"eœmçÜ1.¯FÒ„èƒáÈc×7Ü#fÝ)µGU] J®¥°DÌ6´ F¦Û@6à V˜¼ ™ý¡„ùd8†€ÚAi(Û· Ädi3ͪmw–- iüˆ62OI&„ÄR Ri2‹HÍv^jKö¸TÆéø|[ȧ€í61Á4W9›Ì¦ál:¹gçY`ú×*\·lÃóϨóBÿ e+>ÿdÇ`´çQïQêFOD{èÛÎYð8*dÔIM“ÙÃ+tˆéñÆøÏ7AøúîÍÃl:–J]¯“0G¸ñ)¢s*ŒùEzX±F¢àT|Ê©ªi|YbIÁð"m’!ó¿Ð‚æ÷:3Ànš¡qœóœÙ[ávù~9¶ ¬ÖèþÃ[¬>Êv$Æ4âH)]"¢‚ÔO§ï§Ï‹:Á m–J«ïŸ€eã^§íçò̯ +†Ê‹_NUù+”R’Èú^ÆlÏ3'¸lYwÐÖ0BLÓZ¥/’Ý·LWUÖVèyærµaDâ*òU% Ð-¯Ö¥E£-ÕxÊ€¯ïáv 9¦}Lè>¦kÕ¯(“býIÌ2”êÎÔÆéJkª+îîëïIÆr왳¨ë­P]•yI«áqaKï[.™ÿü»wQY”µý£~s"f¼ñÞMN”€#µ¹jÉ_{Œ"Võp›~4>Weë­þækFTð°P*ȲºA×ãYïxë$Q¹ß"ºN$CƒWÓ: sÚaéúïx¹X£Îg¢x¿Ë†Ó%Q$(r‹©aßäm_îÒ‹FÐ12µ…츀…,$¨Þ÷O¼•שëe2/œk~î|~΀÷¿™ïÀ÷ xǶ“"eÔ®êY®-¯?tØ*~ñ¬Õ>j•‘.´À{Ôÿ’Q |ë¬eÖ«f/-Tçpþ×»ê<1Q†ÉÜc´ªô—EBÚ°Ô,«oŽÎ6ÒÒpÆ—c}¥³Ä›V÷ͨÜ/âÆ­ŒÞ¯ Ÿ=«ÓÏ×màTq¸ÉáwÈ&OZMUW5V¨ÙC`ðƒ|t­9 endstream endobj 1094 0 obj << /Length 608 /Filter /FlateDecode >> stream xÚ­TkkÛ0ýž_ᵜ;–_±Ùl%+,ŒÄaëŠ-;Zm©ÈÖHûï“-9Ç …-þ+éÜ«sŽ4K|@›ØÚ$pÌÀ™hq1°šY–i2˜ß€Âh ßGƒñÏÓ€e†V´(=,%Úwݱ‡†¯/gKsþn64ÇÑ—%buäêŸ ÚÎa>ü}L£Ýnží™žë¼Z‹>áç-0Cßwkz„¦o‡‚¦oZž+9>2LªôÞò¬‹«l4¬KéWÙ=p\r1Ú’Ñ6kàuÍO3BÓžfˆ–]Èü?ÍŠ¥0À–“ãkYèË=Q.ƒ„ÊB+ ”È¨Ú dˆ +Ê䮢¸*å’'”¡ÑAqX–~=nérléÄP±IPY1ª áÊÙŽ/ÂþtN8[¥ ¡Z%ÁmE(+`¾×¥Å?Ï`QÀ#´-»•‘`à ký§ Ê8i°ºžh ‹Ç½jùŠœúôc2‘@y‘w§¾ÃÄ´U'mÈ+ZÀ5oPü ˆQ^a‚Ê£Së÷Ø©¾—Âi8=÷Žü7'Õ/þ_XŸ  endstream endobj 1098 0 obj << /Length 1393 /Filter /FlateDecode >> stream xÚÕXmoÛ6þž_a´À §5-êÕNš]ëZ7plÀ:ŒEÙ\eÉ(ÛÁ°ÿ¾£HÚ’,Ûé¶XT_ŽÏ½Œ·7¹–‹\Ç~&,½{›Ød;ž¥±Y2]Gb³¶Ú׳ŒûÀñ]cIXšÉaÊ'‰Û668ãsÊÙTÎ¥$’…¯Úžm”NÕÉϦkÞó”Å3ùþöP³n1³ÕÁ}@Ò“ 2yÌõ‘òyÒîX=#ã÷#1p ÆåËä“’ìI®ðDÎdZ#k`¹Ð¦@#[ÒÖÒ66´Rðºj»žV Ià6nõPßóÛê¡@·‘ãJäÝó¶ð„Ñù7ÿ¤ˆó®¸°0‰¯*ÿšEôB© ¤ ‰9›d> stream xÚ­Uao›0ýž_Á:U"U u›´V]µI«¦&Ñ6­Sä€!¬`WÆîMýï3Ø$¤S§-ùÀù{~¾{¾Ã‘_`Œ]cB;„c#.N³Ê2C›«Ðq– ´:‘çÓÁé;ß7€cGNŒiÚ¥š&Æ7zCËÂ00g×3ûæíõЂš³ ³yæGD†nh T ¿O? .§›Ý|×·}>SZ½§#´£ ðjyDvàFRf`;¾§4®²an¾VA›W¨¼/ð<¦„ß:¾“a2ÏPY"ùÎj¥rWKžÛ €"¹g9ái{tœÓqv  GŽF+2ZeÛT+²=àë|•þØrB`êÅÓÅóy‰‰Bk*H¨zÊ5À8Qˆ/±R4fˆS¦^éâŽy¥^Y+PR†Gr8ŽyrÚ;b_MŒ´˜WœQÍ“s[&Ã@Âm¶+áºýôs¡§9«4ü©/уFœØcs2Aò”²R½0Dª1å¢qð÷Nú:6Õ©jáþ¸'¼›ÐøA0’ÍS†qÝáf%üYmíA¤ TÔMÞ÷È_m|Öãé–²Ik9ú{Ÿ=y‚nü¾•Ûiz¼Êu_êøË/ï§óÉìââr2Ù±°×ßæQ%µÆD’¦Új('5cÍ¢Vvœ²Ó!ë_>»t…¾ÄE…þ“¸‰vÙ«Š'9µ—ožZä‹ÝX*C¿4O¶EøÕ¤¨gg¤|mï})Ú;ƒ Zxçb|º¹¾RHªaˆ­û·‰ Ò&äzàU3é^4“J«'}Ô7Æx¬ÕÈØt}Ó¶:i;‚à´Dwz9^âøN £‚çW½®öØÁ~’$Oÿ0²þ›“êÿ§ßGÒ( endstream endobj 1109 0 obj << /Length 540 /Filter /FlateDecode >> stream xÚ­”ËnÛ0E÷þ .) bù’b–-Ò²iµ ²Pl&àd¹Èçw$J1-+RÒlzt9sgŽHA8~±’ØL±LY²Ü,x­IXüþ¹.Ea)¿å‹¯?´&‚3Ç ùCœ*_‘[úý©Ø×¾JR¥•WI  éõs±Ù¯ý£B‚¥J'wù¯ÅuþRIKÍ4¨7ÚêÕÞ,z¦ÀÈÞ›4ŒkÞ$*Iµ‘ô&IÝU Y þ¹ùÛYDcÃ9I…cBf!Íï‡ö`ʱÜ0'Mëži|ĸÃ/!Û6Î#q?Ýö4Ú?2êA‘Î˲.wÛ0nÍT³z{ãë§]’JKW‡zØuL–¨–­Ëöç¸;v‚ã6´ü›hM‹ª,jä«òPWåý±©r¸û‚ûâч]N G‘€;›Åë${õLëämï¬)MÐƸFF† x‘À­JeÄ8Îlö~Fýþ4J0âtXfŒü?%¿Ù—U¹,ÖAvÜ6ÄLD èªáxhÞèºj–gìà…¢à¾cØO<£ vA<3Aʘp`†›@N¹ytõ`?€î”` ]§Cg? ݦ}º®GN9ÄfÜÅíÉÃŒ£ùL\ž¼Ã69ŒAÊ3l"Âö†§3Dój§SÔ:Õµlž}YùþÖ çê7!b±òò*tÌ*y6©«0¨gú&=‘iJÿd!Ë‘ endstream endobj 1112 0 obj << /Length 53 /Filter /FlateDecode >> stream xÚ3T0BCs#s c= cs…ä\.°hQº„äÎeUgbj¬gjb dcUWN" endstream endobj 1125 0 obj << /Length 3450 /Filter /FlateDecode >> stream xÚÍZ[“Û¶~÷¯ÐS‡›±PâÆKšfÆm×ÄmíõôaãÉеbw%Ê$egÿ}ÏÁH€‚ö’tÚŽâzp®ßÀ)üø"‹¼¬ùbµ{–šÚîzA…·¯žqÛo —^Ï?]>ûý÷Z/xÊÊ´ä‹Ë?Õåzq•üy[†º»XJ)ùõÅR)¼ºfMu¯÷¢H Ë¦ZÕKQd:Md~ñáò¯Ï^^ŽKk¡™Vò‘tºÞ'Äæ@lÎ×Ê+2–â+/–:“HÞOˆÂ\#…’]ó=§‹¥ä¬p³\nk˜%½Û&LÒ„ÛÄæŸRú]^üý5TqjWU_GÙ"2ÍŠ"°CGŒ7åØ×Øn£BÉ(pѶëêþ@”ìרMÄ`rÁ‹9´êRå Æ™!kÔqæcÜ@]ϸ(–óE¦8Ó%ù;¦¡‰¥ eÆ…q|aïíð¥7>â­g‹RßÕÖ‘Ø‚I¢òêå´ƒ®¶»îØõªæ)XÏuMíBdóÝH•1%Ãíœwß®÷ÔÏ'5ä£ m)²"y±^7¸plwDªsMªiú¡«©ÒøÀˆ-E®ˆ"ÏŒîu 3EU ƒÏJ Ûj ˜×î‘ )¸y0+«ÇUÝSmEÝ̼ÍÇ#‰Ã ô}ƒÑ¶¬`E¢š,¥µþvh0È(^ØE/í&ùä3±< KØoMäõ„ûv°]w‡ÛÚ¹Sêj"¶mÀ©;7¤ÝÌV´¾Ÿ>n›]ÕÝ]2±{àŠ•J…ó=¶·7Á+\ö¦qHb¨úˬÆ2u×\o-mX."OjúØ×ÀÛW¥Ñ-UcĢЭ-Œ”b3jCO4Ž$zl~½?±ÙŒ1ͺËäO·Y;|9Ùl¸Hˆ²DÁAW/Aµ~©v-P¼EñðäƒñíÜš+vä|¾¡PÛ3çÕu¾ŸêÙ”†jK‰Ñ"$¤j†Lüª:KßuóÙ`‚=}{ ÜEê‡l1RÄÂ(EìÔË«nmu @¡Ö3d^$}ôQò‚Æ*تµQÉÑŒ€m½‡daF%B€f¨#`εí–ß^wÕnG#ü `(éì õ§cãlHÁŒq6f%hè¡P@½&\d†f`ËÀ.bÆÕ;b …¬ õÃÏ 9EÏ©¤p@š#ij € P¤·Ï{²TÛùþ]ͦtž)ÙXUÀ¸Êt¦¯¶®„ò,fír9°ùLø6ÿÝëw—oçVÝüôõo÷™`Ú ¤»WÒØ½s´¥,ÚÒÎô¡‚L_9¼öØÖ5QyÉò¼üF¦ò¨‘)cÊl¡PªŸlenüÒ› ¢óeB;Ãý;CövfXº±I’TæìÁWXw*$(Ñþ¡áaFºBfìOd…C.:fŒ%¯ ½zºØÞK¯{̯Ì&ÁKFçsdʤix’³³ã¢j¶L(d¢d‚øtõ] ¦ØFÌþ`wáX*•žjžm=’£¶ó¤Ï¦ôùiL Ý8·<ùK‹úðÅ@0bÝs§Išeù,¦»kDöܶÆ&ÍYÒ 5nÆÃáÿyÊ¥fNº8X°ÕÑQëGøYy[íª›ÂûÏ}üßùY³ù)• ¦.rÈ3ݘç´žYD"@©OW0˜h}f‰x¥²i /&¸óä9èÔô“wbðWË…Ì3&2£{WÒÅ-1•/¾˜ž»FŽ|º]¼{ö« !üÑ%ãEi¦r1÷ýÛ7¯¾ŠíV –Nt»x¨BlžêH¨š)ŒVLF¶{NaÖÿu…9 ÍݤNY&ÕoQkéˆÞE3îU(15þ=3üˆîP’j©JVfò·èŽ$(ÍT¹(ÿsÊ“=ŒsRɤ˜ËþhÔÑû¥æÌܬæ ŸA’3¹áÌžáà@_Êè«ç» ‡irsh£0Ã1é ~@zcr,Gs›€ Kn(¡VÅ Þ*’Ue Ó|LÉ |æãA66a¢„ÿÞšIÃÓh<3·A– 6£i´³%ªsDûA%š}ûÉB¢ÀcцEaxe“Á„ÈBN†Y©—Œ²8šË©PèÃg"|š]IÊ“¥¾‡<“,ÉòV<³ …g˜…¿ ú€.ÕÆEg· ˜·Ù}íÓei¬«\2•ò… Dž=%ÛñKo‚Æ™-3CÉ@¢drl\…(Ç g¼i7ô?¢d(Ÿ¤§xiãöò<—($ü—9l+{ÛÞK¯{ ˆÎ&¥(JƒÛDB?b7Cê™k̲µÉo“‹ărŒ+äåîÌõd‹Yüš¸àî¶ÚÝØ›®ÖÞkYÍÁ¢9ï%‘ˆä> ÃäÝrër°0Z ~´»f"øM^o¢–‘–L¤üñ¦¡X’ò/¥p)ë”aéÝa°7±ø‰aþãmµ¿¡{d¬ï9‘Â.Æm!HòìÁ«CÍJ£œæ~d¼¿ü}9Bñþ“¹è Õ"æ×ß?\ÀÀ²Ñð“Ã0hðé8Iÿ”Í}oqF BP§Q÷ä¶TL[n¢7ŒPÌKþˆ{W9Ý˃øöDíàö¿®7Õñv™a¯A%°Y¦0ÇòAí !ªíØàãµRŽ÷äèên\þ ÏÝ5Ýì:È¤Ý Iq¤T'[áÁ)Téš+@ƒÙ«¾^öõ¾o+¯çc.L=¾l›Á¦Òý¡š.4;[Ù\ïÛÎù„Ø¥Ú¥ËÄ'BÌ LO·µætcuù`/kZ—ÄwµLɾy8R$7½¥²¯0ÑhvroXð¾ew°üîAgžX¸žÒ˜ßEÝ5 þ|2Ö€K–fÜnSPÛËʶuw•< (>³í¨ÿäŒô››úîÛ?~ó¹º=ÖßFßülBŒ‡ªéz›ÌQsúz׬ÚÛ6þô„|ãÅèLÿðh¾(¼ Œ‰¯ð~J¹êú>lh§ÆÞÛÙˆ5g<4½{wkH/q¸}‰ƒó¬›•}‹³y3‰S˜¨ž'ÿDPjGl«Ñkwÿh‹ë6 ñºÍ^žÒg û©Éùkðñ`jÓºã¦Ñ*ÐeY6Yý,«ú¯c¢ÂK>ÎÒ´x ¯Ð9ƒÕºÆ5ö÷a3;Z;}§pæM‹(S–)”ãR<ý`Ô_Nãcp4\dŽ»%‹"Ýã±(H{:ð›NF±3¡i,ENF ëEéoçž“QÛù~âgSz/Zb¯RpœS¤ðÏÂË¡Xñšâà„éцÐ’`Å©÷_¹A]ût~NÐs³LK¼ŸÉÅC7|9>ÿ ™Ÿ hET^ýÒ]øÇß¹4Ï#ì x‘¨“ÇKšÂq7÷\êÙÎ÷Ó>›ò!9«Œæ4r÷£V_ÊÐzžÄ†‡";+`@q™ÎZ°-Ÿ.`;|9 8\d&`´&*¯Þû}ûæU)ƒlIÐ*w¹14iuNÊÞ–!å{70›2”2®ýoÖg'2 endstream endobj 1138 0 obj << /Length 3116 /Filter /FlateDecode >> stream xÚµZ[oã¸~Ÿ_ìCÇ)ƪ(R5{¦ín››‡Ah±»( cKYIžÙô×÷žCêb:v‹-‚@$E‘çòiq߸ʓ«\ËHËüj³ÛÑîñŠïÿöJð¼5L\OfþùîÕŸ~HÓ+GE\ˆ«»‡éRwÕÕO+©¯×I¡u¶úpû!zÿîöz-¥\}èM‡-µú±l®½:”»ë_îþñêû;¿[š¤Qªä…¤¹ÙgèÓYT(dfQœ*¢ñnkpo˜šM§&2R¹†Õí¤ªî‡Ž§ÍV”2’Iæ¦ÝïZ`X¯6ÈÔ§ëµ’ñjoìêÝÛ÷†:ÖŸqŽéž©÷s,T7~ VU˦¢FÝÓ³½ßÕåÐÂ"Z®¢ëuâ}·Û-vj‡-,±¨¤XÐÌ«• ÈSD¹ÒWk!#‘ â²}ê¶•YeZJ°±]Z¥zíë®+›GÃsêÆÞ×CW"ÇøEÛQ•é"»©PVKk‘EIÌHú¹j;úº2CYïzêôÆÐ"–GyhwÀð¥nÝ=²¼éê'Ø Éçè½)-û[fÀŠ$G‘ä«ODTÌôh¢ç†áMUhSó[¹ÚÑâÔ02[’0†P^}K¦íöåîç8eô&ŽòšâkzWµû¥9™Žã7uó€ÓhèôØ›aÛV³ÉCÕñJ›ÙxB9è3Òsj¿\³Žu¼Ú–ØùŒÒâ‘’»¶’PÃõýEï–¶‚cVÚñjݡٔƒÅtI"¼8Ê —ĕݪ_êaK­½)yL2M /ÒÐ,»Êë±Í:0Ÿë’hL ¹B™c+Y¹'vsòF{mêùxf É8§ýpÞ’S\ÇrŠ/-ƶ„·¶·ØÁ÷Vcö+^䥸W`õ=M F±õTv%L7~A;Ú›aÆÛîÐ6〩ésðá<Ý7ŸÌówß~ó¹ÜÌw!ÈäE$ á¦?•ug] ši9Pk4ì§ÎI©©TVÊ5ˆ·¶– h×£*ŸÖ‚s´`å-xê2•õi¶qèMÅ;¶4ℵ"²l.2/ß¼jZ(+ ’\50N-ëG´sz¦ì¢àó±&WßP÷Þbfü4$ö"›Ô3¹QiáÕƒ–Ñ<2½7܈ÊT‡ Y±k÷3®¼:’©œ†ßI âB,‚ÈlgSîÐ'iêÙÁ6Zeù‰ðœ²n±‚ALò%â:Σ¸ðq5Š¢ £!ÆU Œ{ùËJè“P¦¹—åiô*f¦çÒ$v·í®êyb„°0+Y„-o{‰‡7®‡+ .XztB7í~_e0–¤E¤Uáˆ}â'ò$ŸÊHYw¼ÊθpÖ×Dsz~²ŽÉôóp92ü–wÓ³p!2mŽvTD‰3)8"еÇîW í¯BËÄSéùlƒÀ‡iÛkXêu8 Å‘ˆ“ÄëÈ€d2p¡””b6&2PʯÓl õPø¤tݱj·c0k×’oÞýdª=Üïx…_í`ú :!=Mó –9§ÈåDD'÷ük *9ÊèNÊ DžŒ[¡+jØŸ*F6äºÙ¸ìÊC} MÃy—ÎzA s´òÚ £ˆd¦Ü Ÿ‹:aà^¸¾ËyƒÛhð ¹ÇÕë³öƒa( â^ü2h#îEÁ©ëÄ„ªŽD"¦²-¼æBÊ( $)˜Ek¶»8# ЦàãÔc«9ìï¯SJןÚi”{È;©‰w’/z'`s¡óÞ‰wIr”gÇc¬q ûºoˆåB®§d ‰m&Ç8sB«đ̵:J0Ȥ”@:P<úìYOꔉ‘–7̰UóHÓòÀD*Ðó*À4ÑY´_°¨¬_dg]Ì\,¨¨½Q½¸¾†ô!¹ÐÃï”i*ô2q‰ºóê}ñ?j*MéQF…Š}ÒŽ¦{ê ¡K~ ©iÚ–ü…#Ó}ñhx 2OäúšŠªAœÜÐÓ§YB¦ƒæiOÓbݴ]gzšÓº ¦A™R{(î£,]ÄàSy‘ˆ²ä¼¨GiQs–¾Ù*?Dép<Ãx8hƒH½¿=å#ôÔÓ&öÐ7¹§D…:í¾¬êpÊ—­i¨… Ÿe÷xØ#°r›ˆftŠ‚ÏŒ´îLÅ"L .Šå¢Ng•2/œRôjߎ bŸ,f@vöR"R…9 Gx!2ùèÆ™¶]µã}ûÃ#¡ìµ.îU6Q&t–¿ÑÕØL{ˆ²BDr¬Ü^ƒŒr=¡®¡u½&°S47Ãî™c×sÏP™Ž‹"45Ȱ¹"I]5…5Æ1䃉0t^¦l*1“):‚8…+9Ú±¯÷O»úáyAH?&ô˪ªýaL´Ç6PÇæ0ô<«ãÏ™ƒ~Í Wà¼ôÌô5¸qÔ£ÌX±>:\Š‘r÷ÐÄÐßó¨ûbR’ð Ý8#äÒÚéy<¦ Ù¹U­O„ñ/‘Ic>`MIë0¸<ƒP»(À½C~(7ækç )¥Ã6‡ˆîyzÆ¨Ž‚‡}é ð~áT/q¼Þm°ùKŒ ¡r&è/ó -h<=&A¼ Õ¬2“so^7¬¥,[z 1õ•1&+¦›DÅìtý6X/ìG Ž¡DÏsö(Õqžy"ÍÔc±fU¤BñWÅá¥u2jr£ð+ÔR‰Oê‡î`‚€Î ð¥Óò!“"ñõVZH@,÷'PxêY6=˜ÞÞ±1´¡ <»ñ0¤ÈE²(Ïüå®2 )Héq>·°#ã§bÔˆžñ$aÆ:šÑ)Öñ €¿Ž/=»xGkîë¾÷ùÏÒ<ÕÊý1¢NÚ®Ðy4?q=Ak…šæó‚Œõ#'h¶*·~d¶üuBÉ*UËs‘lyá0Y#Æ)o0Ï‘ÃÞk,ÈŽüÁZÅÅj,÷[ +>{Æ'öÄ$¦<ß~BßêÉÉoh!çèkÓÓ€=üu±¨ V.ñœ¹òí[^ ¤nM©z“>¨Ñx‘N™‚,ŠsÞ$†$Åkk}j©,cd°Ì$E:·*;¶*Þnonï>þøîŸ'âDàK–³Õnnϯæ6Èÿ8èîìÝ$â9NÜÑ…L¸Pfv`Â¦ç£ø$ƒÜ{yP5ðì!ù0îÈc zwYò;ÎK¯8ô ¨Ð‘ƤÜÚ?†afm }²óŒH<4}ýؘ*hâÅÔRŸÈ,‚|QmŸŽÍ*¹<6ç#–—ž”î¡@÷UQˆ¶Âôô‚°o·æ·²2›zïîÏEpëdt"ç^”9²•ÿmÆ“¿,W°ÀDäÇ.NŠteÝÅÜ£Ñ +'|E‘‘€àeI>J ø¯é¨½­}I-]gPXPôFŘ™ŸöOÙxâèhGj $ìS´ŠråS¥·Þä¢.”QÜÜþps{s÷¯Knl‚Êe¤„ž›)Ÿãái$h1ͪÿTýnJÖT/øEéã_nãR¤’~¡œ×ÂÆì uHíáê4ú[ÔÉ÷HmZÅCÇ”ÞÎòÛ:L.Ÿ¹¬}ŽVˆ‘§ÜœÁ9¤ZŸC¸ Î^,Óð"9…ðÜ–VS„¿c(Þ'hÁ«#¡Wo‘ºìà_õ ‡þÄ©…Œw’—ñÕ0_þÆL"é\Ú|#UǾ~Ü:‘CUBgS0Nè>ÑðÃ5Ÿhb™…?Â)ÌC_· W`¶,†7‰èyg×°UóúTÈáaÞ ˜¦šT?v¡7<0&¾á#æãf„¡oc?ÝÐoLÜ-OYM+x Nɘ>Ųuò3 ù‚<Ž’<™:šŸØÓü2îøûdìgâYÅcÕ®¼ÔÌÕ(üiC:“êÏqŸ¨f³ñB–ï;DéŒJâ Ú8“Jêú› êºÒÞ+_keMݶüÈ~‹xñë€âç»ÔÓ²3Íã°µ‹ªÕÍCÈY„J&_BÂiúžF _l\ËÐËr3(YÁËÕj¦R7ͱÄy#¼ovÏ‹Þcgæz/YÐýoÁ þˆ%r?šü‰Xl‘ endstream endobj 1144 0 obj << /Length 1174 /Filter /FlateDecode >> stream xÚWßÛ6 ~¿¿"{sŠXÓO[îã¶nèÖuÀš=]ïÁI”ÄhblgÀí¯)J‰í:k;p’)Š"?~¤±àð'¹\äV1«òÅöüÀ½´=,hòç/"襠˜4X?|ÿ³1 ÁYÁ ±XֻÅcòã±|î]»L•R‰z½Lµ6ɇ¾­êÉÞÖKiPÙ—[·L¥Í OT±|Zÿúðf}=ÚHÃŒV_égÔþÌÙL Ô„§3Æ&?rÎñôid°Ì°ïµÞîÉý¦>½Ð¬?:œÈäTu=‰ªŽÆCõ7éjúüÈ ¯˜c« µÀu¡ÛhÃÃs9ãÿ “D0ɸLšsÕ÷nFÅêÿ‚p!°T(&Œ ;öõ ŽúfµÜö—òDó®úÇÑr3¢lÛr)óäeiuÂÑ1üi€4ªøfø¹ðó<œ ¢ù8Aà ÃlÀç0BR6@ìå1 Š&ˆÃ&T&Ÿ³¡Ï2·,/Ttúý_ïÞÍ…ì“€LÐzöN7U¬‹±ó—Îí|ºàËióqÖªºë]¹ ¨)5” ›¢–]LÐár G=›s?Í / &¤%û»æ²9¹W‘¹uò:Ú—s&¡ð˜PÃo%ñ¸ª/çkŸ½¹Cm•{Íóë9¼RÁ%“bú¦¯õ‡3ÍËçÖAâHX†Å’Š,ˆ®€YÔMsÍoæ1žÎm›Ú€d³œRõarrõ¡?›ÀâaåQžx‰£Ó"("âR` ¤AË ŒW[÷|‚fº#é&¤^Ç"Aa¬aR £kx¬6"Ë2ÿ¾ìü™õmËL6'Me©i«Í¥¯šz.³¹d*»ÖËæÔx0·è§ïî1&²`l1u{,ÛWsìTrÊÎÎ_G÷Ìkì°ÿMHÉ™.f舌ßb3yì¸Ýàþ£6®“ç²ÃÒUh\£<è­Û¦m]:E½» M['ÛòtbÔ'´dD4ç}ÓWxÛª {W‰›2‘œñ<|ðœ£UG¥ÓV®#&Ç’†PÙ°Û_Ùl-„­eë®6ÆõˆûËn}ng6ðÏ^ †åòª,5Š'oØ›Tf££„]ôxæ$èÕVŽx!V+5`Å8åñ´“îòÖ†¬ï¥-ËT6>Šß?Ks†³ >¾äõÝx´bY‘‘«{g¨œEµç݆PU¡§ù×¹Ø(¹…ZÕã;Ÿz«5¡ñØ ‚ z6ö´ÒìïäÌðkm~r/³×«d:¿¢Mµ×‘Õªž¾3¥‚;/W £5S#|g Œþ éœcÉðå÷§3Ïäé1Þµnë£wM1ÉMs/á²oZ’ý4ì¤^Bê' ‡‘ ÚÉ!`ªù4F]Àá²Åxÿ-µ¿ÑÔhä*:SÖ»©ÐPAæ›!Æ!ƒ½ó?B¢ÂXÿ#„iK'‹R,N~wý‘®ÐŒo¸âኛuöw xîY; ì>®Qû ±L{@pZ'û ”K Õ¾w®/«SÇ¢‡ÿfXT‘ endstream endobj 1173 0 obj << /Length 3161 /Filter /FlateDecode >> stream xÚÅ[Q“Û¶~÷¯¸ÉKt“#J ¶MgÒ$׺m2™ÄyJÜ O¢ul$òLQqîßw P QÒIÇ&H.€Ýý°ß.@™ßÄð‡ßdÉM¦Ó"»™¯_Åæi»¼¡Æ÷ÿxÅ­\‚‘'ù÷7¯þt¯Ô YçüæÍ;¨7‹›Ÿf2¾’\ëtöã·?²ï¿øö6BÌ~Ü”-¶ä웢¾Môl[¬nß¾ù׫¯ßô³©D1%ʼnª9é‘~è'™iâôKR+Iú –ÜF*Mf_U›®­¶]ÕÔ Y¦f?À}½D­öŒo"ž3žhãÍci¥R_*0MÂFh㇠ËÐêwéÙ]ò+¨‘óÙÚ¸gÓÑ݃y_ÒM÷h¿¡LÙ>ÓÝÏ1—-uˆƒCõ‚Õ†®ÍêZ]#h1c·QʳÙý­–³¦uSVƒ¶,6ÆE¾¿ž?à¥i!wDJ±üqÁ¸âǽ¢¥v~1zÂjžX*æŽÌ€Æ¼¨©±ó ¯«®+­ÈÏ±Š»fY‚Æ-=ùPuÔêà'SÆ5w:|R3g¹èÑ3.~,ÚbÞ•-LÈÑ‘±˜}Ó´eƒï,L4k…þÔYo[µ¬Aθî¬Ð,Oµu ÿá±Zi2Q³§¢ÝàÚ„I àÓY°0iÆõìŸfFH óf0ïˆÉlÖ5$^ô*5ÕŽЬKôÉx²Ùlª7鼩ßm7&ò¬ž½3‚.°~êEÑ.ènϲ,³Jù€Ò±Œç: µUí—ºüR‹V\2ÖÏx®äuœ·¦«q±B£g;ë 9%ö¼ÒØ…YÐÂ[–uÙVszæÈ0Bå.v3»–3@¶nú¥ 0®ŽŒfWÑ–$¸Ù>aXgÀÐÄ‹ðìÙ ßQ @žÌ  û! “9§X—­º7°a£s8ÐË`‡†Øá£ 6¼4Ïí ]VÐyLpœßõÙeB¼3¾Àƃ±ÉÊP5ñLXôöìHtÀÑÐEç†9Ê RkÌt5µ€p»’d6OżD² 76Ït;˜ÊÚõ¶=jtÄFIop $vëïùJkJo(x€;âè²6™‘ˆJc?ôØ…Â#ÏX–d>ieV·x»GâSéàÁ¥ú5[²;û¾që±óV»èUŒW¨í‰,ª2Í’|’‰M±ÜƒŒl.04’ÜIƒPÀô›†Á‡+kÆfˆ^皌ØÅ¶8b©U Ç¼-;Z‹ àÞh¡µã+xg ħmЇjUu´HÍCŠ¢7šäz³þ 4kÚU!ûÆž2:ÿ…ÚO¿ ^f<Ù‘¯ /Új®ÅjÓPk¯ŠÀG}µ)m¯‚.ß}ug[߸%>ûò«{jl©êñºõ5RY¿õnÀ¨èÊA¨cLŒT´ñh¶›[øõif¢¸E[ß¡VØX­¡­+Oñ1¨ÌOõó¾°)B×G›÷mgñgøïïGþ›å ðŸÑbòÞˆ§’¥»ÚÙÐê³hÖEe­0pßU5„6$2šŸŠDÁ5PéY`àÚέ¯Å»Á«ON²%?Û­HÏÒO‚Ë1ÑL•ú¶éªyùg`§<›½FêJcG]Тõm•ÏÜ30zA-t¾A—jC"ñK /9XàiÉxÜË7íÈMw»Ä~LHꡳ¤÷Jc_IŠ/š-E<|¿mº2˜x Ÿ÷v-l˜æé {z{QX‹}âłȒê $}—†Ç“ãF½/{æBàœÉ]mÓÍ+HÛuÑU´¥Y=ãõΖ7æÜåÊ*dÍ7Ú¬‹žp÷Ô¶Øã¦¡ÞteÞºÂn,¹`ízáÚÿôd*¾79­u »´¹ 2dµ²ÉÛ¥ówÛzî’”°qaݵ)ËýØ×>¬e Û$:Ša Þ°v¿P6›3™áÿpÆõŽúáÆœJOEÁYð“9™¨Og5oíJx*–Ör)ö Áe­`W¿3äð™’“T{8 ]¬/^)˳eS+ÂÌ€jÙgéŒå@™"UL$Ü•Úq¤CÅRÝSúO–WP×ÏßZ¾²õ-cl—ò‡¾¸Êz–Õ—öáê@ö<ÑÞR3•ç½ gãmûGÞ!¼÷¦}Æ8žÐÌ-qwÅ8ÎÎ÷MHÚy:0á0°Nz¤pY™Ué‹‘­êf]«cèJ›¶Ô +OGWF7ãîÍ8]Û?ò¡»7M]Á¸CפïÆl™q7U¬0'#˜¥Û2¿â€æa˜”[¹¼æy±?>Y@VÈ’“CX á46Ÿ9œççlêy³öpšp»Ì®0'0¦ÛçgŠc …`’¦;&¶Ò#­ÃCíT~1ÀÕ1t!%'_Ÿðaµ8Îçgêyùy8M\éÀ5ÈV¬`g(† ;{L°³•©F5£S}T7ï·E[ÃVáNE\\°ß;;Χgêyéy8M\5—<‚8V1*˜1UY‘ôHé ĉ†b[©K!†}YS—uwBNhë“s°:šƒ¡àHóÞ³1¦î‘×?ñp’0©EœA_j{ˆ\Sphð€úÄ·eh+=R= tš1)ùå@wm¹._ŸQi])”©Þpf¼¸Òò˜¨´Þõ@“3N‹bÈ£à–SõIô ƒ ÌÙÿŠârp_,¢vv¼˜¨½&ˆz஺z]˯O `HóœËSLMÒ#­ÃC]«ùÅL} Û†éËgØ)H®{ýÏ?ñ þ‘7@ðÄc8M[·Gº £“6¿ ¶VI6Ð~¢¼²Ò#]ÈrØ´ÇÉ¥ˆ.‹õúø¹†6X]U%)UYÎFÕö¼B¨îMF5·¨O„Èx|xg,j?§$]ö˜8]xj *ßšœ†jž€yé@ý T­ôHÙ0ª èCæ—¢úøüT¶Íê"ÎèG®W˰6Ê`¥3äü-õ¼‚;Ûá4°uLLçöS-}H@ï„Êc9"f•²\ Mš f+=2 Œ·@iu¼ON¾\¯¯HÒ"F¾â½1çbîúGÞÌ÷§ '_1‚<£Ÿ¾¶g¦cü©œØ4: cžÄ,M.fîr1g"×Üefwï 8ODý#o€àžh8ÍØv@‡sñ(ŠЯIñžò¬m¥Gª†¡Þ/fíUñ´¢ß™N)ÊYžç×üR¤X9ÀYqþ—"êy¿ §9«ûšÎÀß8æ—‘åIK(T254d"f­ôHí Ä.yz1ÂͲh«îq}œ¤½ç+%fslíxéyó®ûáãfßU#zîáEOàOe3BŸzç̰i”™oÂÔ13 ïk7ã\rpááqdÿ¨CfkŋϘwý'Ž˜}WƒWíÐ5®…­‡mnøÞÓ*jIx_Û ®JA̯€kÝ´ëã߈þ¨C kÆ‹Ï4vý'Ž4|_MwÀ‚/nñ¿%Fæ7áÉ1ưCò÷Laü«Ý}Œ endstream endobj 1058 0 obj << /Type /ObjStm /N 100 /First 962 /Length 2081 /Filter /FlateDecode >> stream xÚÍZ_o7×§àãÝ EÎp†$h“º(îÒ â\Ñ» ({Ï1Ζr² 8ß¾¿¡´>7ZÛ²W®û"ÍîÎÎÿ΃d\ ’\²øÉv£:bvYãku\“!—¸ÉI$Ôi´W”Jžàýà25œâ Ṛ³Ë†VƒãÌ.Fn ñ8fƒ2Þ T RYØ üpm$ û- b JHŸÉÐ ~ ±ÚE”Êâ2T ЖNíy(ÉQ¤ÙKTËZNâЈe@É ˆB)ÚUI4¦•Iƒ€§D$)S emJ«£`œð°˜(1àÅZ1X7˜9À èbÇ$íìÏÙìuY€~QÎ*°qàv•ŒDÄÊ ÷F5þ b™ËMûQmOÅ¥dŒ@NbF…w\ÒlT8º”«ñˆÅ¥MX„DöÔ C:¡bSt’¢ÑƒYDL`ü«X41€ÚÔI溎Énˆ ´B&‚PŠš&ÙI Æ JM-„²Ó {Eš©##Éb8EÙb4ÂÛššMR´ 5PNµI ñ5S D@…Lפ.)@ˆ[Òv¯¸ÌÍb©ºœ,J"<”5Ú»ßM !—‹(x ˆa°†—à«&=B¥¥âØNÆYXRã!–2ÍÙ0RÉÁî!çJiÖJ©M*(]‘¤“/&ÓWî=BCÈoÝô—ýòB¨ê¡ÜüòììÃä›oÞÁb¾r/^¸éɰF?`ËxÉ®€7}³\v+÷ÞMß¼:pÓwÝÕÊ]“x÷ås‡³“n2} rÝ|uaYÜÞŸLßv‹ËåQw±®íÞëîøtöÝâʽ·RÅ#' n„|Ào¶à§ þ·óùD߯‹‰õ÷†0™^~\µë¿ŸÎÿ;™~·XwË5“ðÁD9‚`åa¡9ƒ"9/`¯¥øxß6‹ºé‹w [þåu·ú´8¾ø«™cøYƿϻâ z"£4íÕ)2à~˜S´Iô{õÒ3ZŽ:ÕGét3Ðt-d[¨ÆFœF_AO5ùŒÚ!$^¬eñ*Ã÷Ï·?ýp3ÜÎÕ —§VaØ[µP5ÅëN ›csØ-¾wÀûCâ;ÄwßùYã»è”ÇëTvtmùs¸¶ ¬'%Œ6C‰ÏèÚ¢:¥ñ:Én®-ò'qí@„—FxÛf(ÏèÚš¶uª4Z§ÊÏ©SÐIÇë”w ×ðþˆp3Ô±f°)ðÙ\ ¶t²©ñ1:Ýh¢lbmM” ¬@z@ǶU5zÛ€È!ùûcHõŦ°(ÉWÿëË__þã§wã:,èà™K›l0Áüëá­ÅÚ½ûøþõ›= Ñ`b<kþ…|¡z?ÿŸ÷'€ˆG£¨úŒ9]#V¹_‚W?¾|ûuÓi»Ôƒ]ðî®Ζ¸Ý‹Ø.ÊØ ïïE¾÷>Ai»¶­’‡Y¶Ò:öÙûlŽÚypìý£þu =Ð#Óèa+ †¬è”1ÍgÇI}‚(š™y8"¿_.‹Ëîób¹:ŸŒÍˆà*§äŒŒ°½ÁÔ j„Vàjvþù¬»Ç™rð”¢Kàd›”‚º˜Ùv媧8Ìùpµ„Ƈ_æ«ÙÕ8¯hgÏ(ýŒ›RñTòsG¶$Jž(Û>®·¦81–~jÆÄÁ³äkî‰>²óW§«åH“gö ͇âm ±79Ç èéMN5a®ŽD=± "ˆ¼òÔ&¯Á«FWM{˜º` ²=[øczZ“sÊ^m—}°-çˆàF±)ì+ó¬×‹ÞHÞ±‚·íyMtÍ[k~¼ƒ÷ÐÆŽíôï´Æ>O°ŠT„佈É6aËx1¢£à="¢Tb(›Díˆgs¡¶íO×Ú¹Eÿ޶ã”:®ÍàíyËγzß4?rŽúòR\Mq@[\%·i­yÚžžíHflß’ú~c#ù˜=]ƪš¹Eº†Í* ÒSâpåÿ[÷åbEÈò‹ŠOpaÔÈÈ4¬·sÝ®?-Ò#wþïá¯SbaßoØÞt~¿É?Æù}‹šú5õiê;SéDú†T¨úQVúîUúæWzÊÒS–ž²ô”µ§¬=eí)kOY{ÊÚSÖžòz—oÜ!†T[/­Q³B‰¥L ÚE†íÊ] ÈÁåüh5¶MÂb̹zÛrMhËk;¢ö·G®Ž‘*#Ù¢ù;IW$e{´ÆvªÍX¿% /Ø»Õll#Ž1ÜNí¡$3p»”ìã-CñÇÓùâütv6’±bö°O30†Wk±BˆSÀ,4|Ît4»<úôe¬™ ô '£C1/ËÚÌhŠE‡Í|ôét¬•3šNA ÄÀacOZwâÖ “ÜÆóâ—(#9·QÎQ‰híKòL¨‚=[¹»ú¼˜£2wñ&¶ÈŽí# &oŸ-%ßÂ|µìλ÷doä”M N·,=ñNÆc9#:5‚®¶©o‰Ä6éA‚Z‡½ƒ‘,%­}Åçl_Å ïÇ%Ù¾Ö°•Ofçç³ý˜8¢—°O?®MÚÃzžt‹óUúh?1ÉØ²ÈÛÈäˆ /È-¬OOöS±Êùµ¹ÔGa[')ÝÆ”Æf/¢Æ¾’à…`d ¯•q­ˆ²a×~ÑåÇÅÙX+Û|\ì³)NžZÏEáî$ps¾õ–“Ä៱ endstream endobj 1205 0 obj << /Length 2657 /Filter /FlateDecode >> stream xÚÝ[moÛFþž_aô“÷¸¯\×¹$½Kq—‰û)5Ú¢m]eÉ ¤¤îÇßìµä®–’¨œ‹"H,S³³3ó<3;³RðEðEA. I‘¤ÅÅÍó\?mî.Ì‹÷ÿx†­\‚™'ù÷Ëgý‘ó œ£2/ñÅå­¯êrvñqòò¾zÜÔÍ4£”Nè÷ÓŒ1>ù°iæË;óìÍrJäDn«›zš)x>axzuùÓ³×—íÖœpÄ=ÐN'+XÇØ•˜ƒÍ圃Íó\mŽ _s$$õZêãl¾ÞX¯~¸R?Ùd±z¨~ÿ5ç9B~`£¥»#& 5ˆPî6t¢ÝHb¦%3Ot]×ý¸Î%¢õAÅqxå%üƒ‰P÷‰)·>óD`ío£ÍùPßlæ«¥‰B0Â…‰ÄGŠ«¿˜w«»Ú¼"˜÷így(/:öïÇÕIÖÆq…G¹äcq]ÖwÕfþ¹¾ž/Wój1q‰8v>ˆ).Lì­;ÇBìÖgž‚ÄýmbSÄ-Â6(*wÛÀD'$Hd,*ž3‰<6ÂåQ¸EÉÆÅh¸WÍÃ0È”!–/E® íœ8:íúÌSËãÞ6{òX:”§x¢Ãa e¹ ¢ãB"•p`oÚB"ÌäXh«¦Þ¬ž ZëÄéÐõcB[ZhZÇ4ÓB9†°fH²ãJ b#ÇX8@Êѯæëõj9r‰Ê²<'È·^²YŸy ¢ w·‰iÑbœ‘bbÁ7,Î —ˆÓ²ãE _#ØÇ— D0ï—º©\-ëåæ OcçÎɧ±§ qw¢d3É»HOáŸ/úLV!RÝôd¥j¸NsÓhÇÏé0Õ9±©îù™j¸]ª÷¼ŠSBŒK…¦úº¨çw÷C`3ÊC) s½Nå²uãè\·ë3OA,×{Ûì¡¶h*…¯‰ÈA3Ju3í»‘Hv+G«C”ŽEx½¨Ö÷O5R9N©<‰‘ªª^báÕ¡ˆáZ„#VM³o~j¢Ò­QTy)ÍGTëÍvÅû©ŽhçÅÉG´§ qDw‚âJ®:º4†®ºÚ€C×÷"¯•lŽã+ ¢TŒÅwÓÌ«åÝvQ5Cs„ê|ƒ¥ ­#GCl×gž‚Ľmö@Ì,Ä6pCHb}v2ÔNeÇÈV:°:²ˆŠÑcòv9¿…ÑðÉ’Øzqz裸ØVˆ°» Ùª&KÇã0x‰iî|'R9l;ƾÉqxZŽ£¾Ôóëíbq¼ìpxÙ0¼Ö‹ÓáÝ)HÁë+„×ÍQ¦¥Ö‰ÕhâKÕ݆ïD ^-<`±¨„1†SŒ¶½à¿6cÃêÖXzW/ëf~cjTÁhåÔÚ<ŠE ”„¶šŽ¸]Ÿy bïm~8àªå?«åL•Jû ›¼òü0¢ï®§®É°u˜p<¼˜’rƒu|Lb¥âù¦r‰îtoê‡ÇX†©Û±#NÈáÙföRÐÖì£á¶ë3OA îÞ6a‚1äùúß?_⢠†ohtóãY¿H'Ø’•%ÅèOnVËÍÿHgöÉ@z @v¢ÓÒ(/ß½½ ë#¢H MñMO£¨¤Cã(JŠŠ|t nš(Œ˜ÉÏ#4è¢lÍ>E³<óÖÇ@ìnÃÐ] ¿zóáåûDIÓG¨oyD+*#§éÛcùíj'W—X‘(SxÉ©ƒò{8 þ<¯ÜûÄ}+ƒ‰|òâç7È<ýq*ÁáÆü2«¡,Î õ”ÜZß,׿—VÓͪiêµ»ž)­Ú%(‰*½;øÿòöôþÅ[ןnì)Z-k+ÀTp”–afÄ *0A‚·€¾X,B@-Ÿ4ÍÌz½Ž™ÃŽ*˜-žËêÁ2ðcïw³¶vV1ÜD[œÖ&¾í2X´,yþ]ÌïŒ@A °È‚Å9Î µ˜JrA (Î'ô‚n}æ)ˆT…þ6æÐÆå»0l—Ûæ“ÆêÐâ“yÌÕ\"‰Û<ï]lƒñ›2˜íÊŽÛ‰“Ë>öX™kZR$Ùõ--Å~ZîÿîQ† å-Ðyoârr9-4oÕḗ ¹jŸ¤¯(zçM„CÆ9pü·YŸy ¢wÞÝmÇ‚ ‰ÌeŽXÁ;¦'à´Ò†ö•ö³MtS³H*¥~˜U›ªS#Tè( Uâ#»t‰çÚ­þ£œ¢º)÷WÍ—QÕ¸ð¹öü*ZÔ•‰š¾Aý!¢ýNßiõg§ U¬ÔñõGå¨.BÓ˜¿TótŠÐVÀ$ADÇùTÿl¤CW;”F¨ˆîs‡{°ÿÓõÜ5.CL,¸¹Îûc3FiuQv4Ù  ¨.Oça»<ÁB#3‚ƒ;HcîBÓ˜Ër?‹<¬ŸqáûžªžF¶ïiHBR„1õX8[=Tóe‡‡QžHõd{žÏV[Õ²îkšÚ”{n=ª$9´òh•Fãr¦{P“31n+ áó—Y"̧V§Ó{§ Ep+5–â–/1·‹B»û’3õRèý¤¾Ød¤C#DgЗ~¹}lV×ÚrËÏÊHŠQNøFî¤i¥Æ2R{JÑ5­¶èz8¤ìöü!f㜋£†öÒú0„8NB<‰!¤§±WÚ0/à‚tLO!JzÀоÒá!„+¥z±mîÍìö{ ŒÞSÐ{ Øþ• õãý™§ Q.œÔ åÒH— »úH!걄׉ë ü×' üí¸Ÿà–• Ï.,PJÜEIJý,6ÕŸqð¾ÄÇ7SÑ;­IõÍöó7;êúW}Þv:Wv R\±Rc¸bâ~WØ^®x³®PyÍê‡õò'råÏÒËS ô߄޸DÐyŽ ÷NAŠÞVj½mü ½É^z{îBï¾³zç9bÜžš÷͇f·Á{hB;Voq¥! Dówk»õ žX¡4¹oö˜pŒÉ£j ŒU‚SßóG¬pàgHM¸=+«»Ã:+.ýj5’$À8®é|örÂ9l?¢±Ú­OÄ ‰ û>¢ Nadßæ¹0åÅJ' endstream endobj 1231 0 obj << /Length 1450 /Filter /FlateDecode >> stream xÚÝ™ÝoÛ6ÀßóW}’Š¿I`+°­ë°íCê<¥A ÚJf4¶ÛɰaüN"éP"MËV‚¡EG•§»ãï>(ãQÿðH’‘T)*GÓÅYÑÜ]ߎÌÅùogØÊå ˜{’?OÎÞ¼ç|„ ¤ G“_Õd6ºÌçD+%²‹èü§ãœRš]lªu}ŲårLTöPÞ¯&œý:Ù=Ž8£=MsÒ¡}·OS$ÀH ÎŒ…w«ÛûÙ1ëGcÓ«j[Þ¼­¥\!…<­Y¶Ù®çË[#×~eˆ êäÞ¾²º˜/“S°VÙ˜ …ý\pl¶bŠx&FyåöéUÕ ¿©‚ð×* Ú„ qø>0iâÖ¾ãЭÏ=‘ î>¦1ç2TPìÂð°|X_Ïæµëéj¹½ÞTÛky¸uZÀ)íÖ_½6;t_ÞVf“éF€j…¸hG`?0N:ô7FÀ§”6ö‹Õ¬j᥅a$¨pæÏV_DaÁ Q­‡…„E¨ ÂO‡ÅS€ÅI €¥‰zÌ_*ã4Á 8i"ZÎ'8±Ò¡«NFLÛêWUÚœ ¬*/ Õ ~:(O R X© $J (×…L ‚T»pËý*V:t6‚ ш`¹C¥\WåáªÒîAêʩ-¨,j·`yR‚ÅJ ƒ¥ |ÌeÎ 3ÙQ…EI„ Õò?E‹‘½ iáZ MÕŽ–ûr].6-^`ëŠ(3’#­wô ©›àNêmB£þòu‚G`È[5_FUcð¶Ë©¾ŠÒ¨™WºøsDþJ¥N§ÑS ÑI £ÑnìIÞ7ùè1þFx\SVëYµÞlË-x3ŸnW1\Ô©ÅÃÆúUH ¿,öÓgÔý{ y(`¡ð)ÉÙÂsŽ(t Sä ÿP~­@õ&ÜIJ¾dY+¢ðÿ›ÕÚÈÜΛKs¿hþåa;_-Ñ8g”g“?+óÝç3س®a«Ú:ýNÍÆ|»uk6å"¯­wŒØ–h59c$ÛÌÿ©`7˜,Ì¢æ^Ïêkê?§þj¾Ý˜‹u¹ü JIšx×)k×V!¹¢‰;§ÐHùñ¹ëÖçž‚Hîv“ÎÝhêÖûu½¬þЦ,pI$ñR¶+L” E;ѵyL3!ÂJ&!3Ys"&Å¡¾â¤sOUSëì/CÚËw¿úå¼[Èi¦h˜I}ÛS…ÜH°´«´ÛrE{Z„šk¥XCd¬ôôÛ9➘Ðöôés‚§ 1'8©ãç„&‘šAaºÿŒshjU|ßÔêûßcj ¼ §Æ%‚#±;¬,Êù²ÇÜ׸O/ÇßölTX˜ºêñëÈf Ž€½[ŸâÚ ÁÚ"òÌX?9߇ꎫ¨¡_ÖþvÞ^&_J¿² 9&Á1ñaT:’')J¬ÔLö¾ d0O©#Á`Eál,8m9Ÿ€ÄJ‡®†”PøÄîõøýâ;j“Tj¤99OA'5ˆûó·Ißÿ%ð6Š€EØŽ•ïüåÎóÒ¥UÈ¿vy R4Z©4&ÞîH cŠ8H9Ñ­ìçÑ ‡îFp$ v€ïpÜ<,ŽÚ†½˜&)Î^„ ½[³´<)HÑb¥†Ö.üIµKì­]žÿ}jW×Û¢"Âýâõدhµ ËÿU´ð¢a¦užC1ð««§ ¡“„ácüGWŒ$á ÃW‚! =À÷=@ð?ö†Ï- endstream endobj 1251 0 obj << /Length 2963 /Filter /FlateDecode >> stream xÚ­Zm“Û¶þî_¡É—R©…_“qgÇnÝ餮}™~H2ž„Ó1•H…¤rwÿ¾Ïîº ¯Îg/VºTÚ¢óY%6Åhš×±«ø;‹êAäu/Ïj×·ÒrÀ¬ó¨íûúrçD4´Òiã~ŠuÒ8ùºòy ?ÅiìÔV-Wyª£—ß½qÛÉóíw¯ÑC{k½(îy=‰£o¼ôŽ\mÒu 1Mž—U:Õ2¯ÞÁ ›b"´"i½º­ö‡“#mäÒùÎéL«2KYiUŽõ§S)ÚT\â6¼…SÉé^†ñ«3wn†~ïÂ’*/ ®{O™ÌªŒ•$*ÖdéÇŸãÅmX•ä‹î¸_Xer‹·Ýâý³Ϲc²\åP1qÇÌXÌ­*uù9,æ¹*!šXÄ~ÿü³Îtt¨¶a³>Ú#kseól²GgWèýÈŽœ+e‡$$É Jާ^¾£ „‡:ê–!É®ê酪R‚$÷)ÁÒk•o)üIÒ^ɳâ ^™,_9–ŇMMipy Ù令¼~aö`=ˆü’|º“÷½«(ól^ˆ ˆ*yHR!§Ò<‹.Ø#H)­ IëzWµëE~ìûð:\×^cÒzŠˆl¨sÒoßvn.;;GÖƒÛ Ÿ.¡™pÇêb4a%ïØhFúñúÞwêZ,¯2>Ö-CÔ&hgÀó¥<æ²ÞÚR3¤A’'ÿwÒûá«“ñ³61r–òð̨Tf÷pÊ' Œ‹ŽžüL’DMÝ1œ~Æ„ôƒ/º8_¬¤LêâdµN¿Ðû‘Å9W:¦Ÿ¢"GßI‘ÄXÑwPœX°±©‘oÖu®YSTGÚ~jr¿-‘4ÕîXÉŠ“l¨÷Î÷êEÒï«ÝŽlš8úϵóý*éäSyw :Œdcýâ( ©sí ‡Ü߈؇6›½Í…úgba•Äχ^¨±¶«A<»/QÁ'~ ±À…A Å‚+ÐÖì,eélÂÛ zv¨º¡^w•Ÿ3HB1ãôᑽïÚ2 C ­»È‰ôT1)|T ‰æ6·š6Ö*‹§«É^|@v z7|8l®ð=·¶:)ðž‡ÁÊCPŠZ í$¬ÿî¸èáˆP{ÿ9ÈðíFæ‰q}¼ß6ÚUÃxâXW½ûjn¦P(/&WEb›­7<ÿB¯n¿¼ý‚ëkÑJ ‹†Ò­+Qk±Ú«}×,-¢»º}èð«Ìzx¾XAêß Xaû€‹C4Arh† s#ÀÄ“¦ï%MÏáçá‰ÚF7×õ,*x¼3Ý0úmƱaøN¼{»ÛGOT‰ìæp‰÷ÏØ¨¯÷µÄ+t0Ï€pß2æáíеۮÚï=À$ØÀf{D¹ì¥³Ž‡T˜=þÔˆLéé‡úŽ´OrLA“œ¯HìanŒ›~f<ðîZZž›P&Ë2zã‘Yhª‰\/üÉ­käÇolñé‘jä&yÀ|`½’§PÔ€ñÈ3€ ë¸vnC#¥­;îœ/.²€é¤Ñ¯ºv/òëz{íBéÀÂÎÌËOˆ7÷‹zgvjWG8˜§ñÉ “HK®Uô*ìoªµêûAC¸ÁDÕ†êã’*£—tnçùÍN‡P!„çWCÛõ~¹SE`'w+ЬfB [Úó*:4®z\ËñÜ´ÇK­Çƒ)øÖŠ i^:žªÈ|½ŒO”£9‘húi­|÷¤cMÃås²KˆëZ9Ïé|¨ÇT÷³Ø ®—é»)œnÿªügÐÉ¥mè[{gˆõÑõÅq8qsÆh' "ŒžÕönô¨ÿÊׂ$'B~ÆFk¿3'Ñ„íÒ¦ô\$ôÒÏ3ý½‹ç½C † ,®»©{ç+–N2L¯˜n¼$xFiª“Ž“hjóßFR¨AÇé#{ßîÂ4Þ9_¹ð͛Œwm·ñgφ©eäaˆ_ً̇L¸^d·ººâË%Ö|%]Ç.!ž(¡ñͦ(¡=áÐã6¬Ûýž³˜à_N†Ö£;ÚX³Ë®?E±¶Ù’˜‚|ðÄCý«a¤¥Dn|’ËÙcœ@óQƲ'’ª°SœÚYi}¶}oö‡%qútx˜s ÜÅÞ'afQȦ'OÞÖfB¢_Ä*`™À¤§ð‘‘Ö¿?¦¸•¸ŠèMÇ;]mDJêiÓÏ•çvu¸¾)¹™6$Nõ\c ml>—[ЦcûÏ`Ö–ŸÞúE®HÅo*ÐE˜ì˾õ 8`í¬¯n‡úñpEΑôÈ#L1Ñ)_í]3öþñx0Û/õŸÍKŸ‘`’Skɤþ„*Ú¾ó3GÌ<5“T’Ÿ¼ˆc¶àH÷äÔSUâ¨_S‰)qÄ—ßŘéѰu{uìý¯f|Ë9ãÛÊ,€u³þzdX/üÿcˆã“#óT·±8ò¯) žY(jW¯/_"%M=ÜÍR½é‚ÒJùk¡ÓKРݼìéXVÕM¸Nø4(ý¾”ø’R°™Ì<‘ÐÑfŸ+óϬŽÓüP\„3 endstream endobj 1255 0 obj << /Length 1749 /Filter /FlateDecode >> stream xÚ½Y[o›H~ϯ oà„ sƒAŠ#u¥vw+m¥mÓ}é61 ƒk°ãþû=sÁ!¾1±¬U¤Ãá|gÎýŒ±Áöâ%‚"Ao2»ˆôêbê™›/¿_`KaØ£üíîâú#çŽP¥Ø»{쳺˽ï>cAHR!bÿÛçoèËûÏAH)õ¿5r¡î˜ÿWVDøË¬ ~Ü}ºøp·Aã„#Ψ£hõŽ|/EiLâN¾˜¢S#ß¿¦ðÏ ·$Ai"4e Ÿ«ï?"/‡wŸ¼ÑTxÏšræ1¤1ƒûÒûzñ÷>HN1pIwp£=¸á4õâT ñc¸‘ÇSØf•'¯ Á‰—€|-¾ÎÁ—“”­ÍÐüš)å?èõºl”DÀ(î3мÇÓ´œG–LôÉ8G"å@­©êyÀ±/«¢š¾~Î'°Ú>É¦Ø †aWœ’Ž )8z¹† Vô^H0GŒ$ E˜ãPxX¨IY7ÿ“@WÃÒ(F ûÓå Dеhe`¿iÍC#7’Âÿ¶^8H9«sÅÓ+ÒÉùÚÏ€a|ª£íDTœ‚‡±ñlr0¢â€Ir¦ˆÚƵa ±z­,½¸È‘@“EI|.±D’8:g±²áqýcá'ÒÁPãž6¾È2k‹º2q^ÛÈ_(jÌšò?«¼˜h§Ò¹øünYMÔwM/¤Ž¥ƒ›aG/eÓ_nŸ Ù»¯’l}ƒBl<Œ,UÌü´¥Å”Œ‡âzì€Úd3iö›íM)Œ p¦Žz„8"‘0»é‹œ”+€¡¾†ŸêL!MºÐU–'>$ì¿Aû·Ñ€"nÆo6¼¾«­@o5Íúf<äïDªj›VߌÿnP#·çv ØP˜Æ‚ZÜ΋ã¾1>Ñ9jå§ÚåöÅ.ûkÌ©9n§Êp¡„R‡*£(Sz®¾m÷ä*ÃI‚„Àç ¸Å‚8TF9JrÜB%u::Úÿž¸ç—Ã1Gqïpò°Ë)Jq¶CÑm\[nÝDê€@•Û¢_SXg³y)÷V}"£À(L­U0"_‚\ ûhªG&C­ÝK ³+—!‡íÓ›FçUù#£yaòà¥5ÉNCdõOgŒPÛ]ƒ©Ôõp×Zy¹V£æõg M!ã~јkV6µ¹3ÓtÝ4…ò ½ÔÚW¹²Ê®>nšgý¸4¿rûy€ýBGp¥a!õom°•‹™ýBõ†êÚÈyûe›×ªQnP2Ìý?jõís@_®=æ_tÎ@ÓÊ,ߣPÕ[«Žm²µ‹å¤mÌA³‘p9SŠÌ66$ û9BÈ|×>ÉêÕõeÙHóR-íkÄ!YÇt‘EÿÈ›öU§[Ë…e–©®ûYQªF¶" A±eB=ÀhŽ$ßÐÞj”½ÔõÅ^ôÛè–«¦hÔ/³ ¦( mTÓe™Y¦yú+–öHVž¡‹´ï´™Ì½öJ|…íIÀ :&ìçæ¾›?Ó&ÀJd>[6²KÿkCùf endstream endobj 1259 0 obj << /Length 198 /Filter /FlateDecode >> stream xÚ±Â0 D÷~EÆ„*Ánâ6 `‚²Z@¨bàó M)•XPŸ­;ûø‡,KXfµ²:c‡kÕ´,X«y„µOz£l9Ç.êΈ‚êA™ËÛ«Ü‘møä¼¿?N¥Zk®ûBC|ý(/·"Ì7‘Xî-ùþp2±)7$vnM]sšRdôŸœ÷/lÚ†Ee=rª€LàÝÁs$ÑWìTÍñó­Å{?C !´ß0ʨ?ó')P¹ endstream endobj 1280 0 obj << /Length 2412 /Filter /FlateDecode >> stream xÚíYmoã¸þ¾¿Âe fÅ7‰:Ü-¢wŵ·{‡Ýì§4X(¶ìk[©$g ?¾3$eQ-¿$Z 8ìE¢†Ã™á3Ï i: á?:‰Ù$Vœ(Oæ›w¡-Wóðé¯ï¨•›àÌ‘üóÍ»?ý"儆$ :¹Yºªn“Û@DÓK”Š‚/¿O×§3Îyð¥ÊJ|Á‡t;e*Ø¥ëéÝÍßÞý|³_M2I¤à'šÖHì‹Á>A¸ˆXc‹H(…±1Ɉ¦3dõCfÑ`ÿeð¹.óí ëûNf4!”)£ææ!ƒ‰ ¾MYdÏvJäN D{õŒ ®µð©æŠÄaÒÈå•Q\ܯóUZåóTñàj:Tym>nt+ý–÷r0¼Ôeÿ©(‘o8ÌÔ_ÒíÂŒæµ]ìi*£ ]﬎Æ«+ ¶éÆj-–V‡ù°1åÚµÉL1Â$ÄŠ*©ñ¨Úåuz¿Î –…Bý0¥Úhxž£yVQQe[#ZÕ`iZ.ÌÛ"¯`wîwu^l „CÈàg²"Wæk¾4]ƒôÀõ'Ôýû³ö Fí‚°Ô•ù°«2ß2Ex%}Dü?™?iYì|‹QP OÏ·ùñû7+ æÅ®„%õ³3>¤ëµyXëuÈúŽpÔCv+ó¶Èµ“Ùv‘ánâX±í©ëÄB/:³^µ6-`0¶, ®[æ˜(EYšÝ¢Aõ¨áVlmªD]·I„° °Èj_„ ¥”h?÷Ñ=!4ʘà-‡à`Zff4ÅÈÈækƒ,ý]¾›ÀÈõø’W½¯•Iv3wY#A5ß=^ñ0†4•±»í®üú£fÇû¯àâW/ 8‹zIñ˜–˜šÒf”Œm²ÁÀ¼ØlÀØIÕã‘pÄK §|‘U~~/‰xÔñ᫭ߤÿúZýó¡L!ÅüžØÙOjÀ“€Uq‹á!FjÀwðâ¢ÃŠ£è&w@‰š%æûÍTÁþ›ç¹N|ªrÀ_e^–»íYÀÌÊÓF&³–ÀÆ‚ôv5Ë·#°a™Î3äPåˆ5èð„)ì€÷X\bôÀ[[úº7j^€_?x³ËÌvI¢³ Ë40Í»1Cšº^,rŒDð¹G ¶d}G÷‹Ò ÊÀ{Ê—ÙýÎ[9%‘›À–Qöžã zŽï¡F Žh¤àê…Z­LÂpLWUCH2¬²¬ß'JÁ89‘±$Q"uŸ@$|#XE¡F놡;âvÍü™£ÀÓÙô—Ñ.~Î,òÐ>E˜±úö/ ôâܹ2•óÄ,ÓMû•c²ïÅzAÕÚ q¤j¤gŽ¸Ç¾RmÆU¯/²¨´‚€Sb¬‡žIÅ¢‹©_‘©"ŠÉX™§ûµIe]X¾™1óÅ&¯ël¡¹Ëô ðÑéàm‘-Óݺ6/ÝʽWD5€ áËÇ¢Îçv2ÃÈw æ'Êec^Z7O½…´kòDªî¶ ›U>»íIºmö.·¾ÜÕ»Ò¶0Ö„ Ða{ Mì|OÛÄ$¶§p È4DámsJ¨iOÿŽeK3E°45ؼ|°]+;­k²­þßrÝ*jlStÔ¬[1ë~e>˜Q1§ïÀa[ÐŽƒ€T·ãwMËøÝlŒX3õóõ¿óô ¶·Ú5…ûTÍËüѤ`úÛ…írshE²™Þɰ×gš–È6&æØážA4íèíÄFÃnG$Üx)@†ì‚)öS$‰¤ìu÷zŸÌ*mWØ[C§‘0.›%$õ.!Lßàˆ¶{›}÷Ö"Eð)Ükö1(K"¨9j""Jb~66Ógí|ñôéÒ'ÆIŽhÇXÝ6MÀe¦–'“M Áˆˆ;ÖfÉFxÜÖžÊÑ]™qÕUB÷ í–­}E¾­«~´Ûß™.•¦ãæ´·­½;ªö»øÞh½µGÜT¯j.ñ±™µÆd÷i˜+õݼ3 üûˆ~AÝÞñ ý¾4†XÃ!}™”Ðht9H…¨“ \SÅ pÄD°„0FÏv3æ(ð•ÔÞ2Úœ[o»MBNýÍvŸ³ ÜŒ÷óú9!‚$ê{Î%#1p…ëùá¤h¤‡~v¬O8‰&"„3ZdsNã´ÒµéÆmS’ìq°(vX|1@¶¢Åº+h¯î‘_*X*\ GÁT©‹ âDÝç/¡ ð´ ŠIXÔq~-Vzèê-<Žm»±ÚåØxlÀâáÂÀJlò&h‰a!ZZch±R¡Åº×a¨ºê,nÁÌu~-Vzèª-B%ÜSv¶Údû2z;†—„»%r¬Žî±ïï^•\Äq¸àùø‚j —VÁ\¬ÔEpé„Ýë14Åa|` —á_ÇýÀX顳ÀÀqùnIŽòKlÚî×àD6-bäk K@lt9b#ˆi¤.GÌÈuØqÄÈCˆqÝ?1g‡ˆa1´/ͯ6Ù"ÝÖùüz‰±c¯A/Ðb))Þ¢±("Q¿,­‚1°X©‹À²¹·ÏÅñ¼Z„¥=îº>Öçé¡£ è\¨=ôïªl„˜•§ ¥Óç¾)p~“ë7@ °…³øåHiŒ!ÅJ]„”6æÞ&ÛCyT€¥)lŒëûX“k¤‡žz ÁWtlÏOÀIdns^ƒQÀB¿ NB(Á2yNZc8±R—âDGü¢ƒ³Gµ§â,ÂB·çx=+Ü÷±wê{f hRIôâ{æÊ{ÍÌÌyú%×ÌÕÁ[æÎ/ž‡n™•$ï½›g_3Ûù3Gïž¹·Œÿ¢™í/š?{î˜ÕàŽ˜×ô‘;f#|ÄΞÊ#wÌ,ÆpüÿŠù¿õŠK W/è½c,h¥Î£Áêè óQLÒ ãø)<ØwÓS(¡–†,iõ9vOéú¤k > stream xÚÝ[ÛŽÛ6}ÏWøÑ Ä ï—¢ 憶(Rd§íbáØZÇhÖÞÚrŠýø%ʦ$šºÙ Ø›áˆgxtæfÈÃ2Rt¤4Cš©Ñüá Î~»]Žòïß>!.n/òÇé“go„Œ 6d4½÷SM£›ñËO³Ç4Ù^MccöÝÕ„s1¾N·«õ2ÿÝOë+ªÇr?›'Wª¥Àc®®n§??y==ÝÇd1[§«y>·›ìß|ü½Í³7²4XaD-ήÖiT~QˆèCÐó[—ˆû1j† LE†È<ôw,ˆKXª/áLŽ&ðp&òÐ]’T«E6ƒç*›³¬ZHÀ¿!là¡YÙÊ¿ñëWŒŸx ‹]}L6›PÂŒeد÷Û»Ùvw·KÒ»CÅC`©­ñaÜíÓ|YgË$_cªÈ™ HqQB~š'Etg'~åh½MVëUz·ž?n`åw-èBà3“¬ _H_¤A†|çä‹ÔÀªúóÅKáKÕ‡/Õʇ0K[ên´1tB” ¡‹®Ã ÐÆN“m“í<ÒNs¢Ä¡i¢º #äÓ¯vÁÜÔ¾úÛRí6À¿ ù9A’ÉVùM)X'1GJ’K¥äP?1€÷‡ñ1ÚçAXï'„Y©¬íu >‡áØåà4ï‹àÜí©Bœº®ú%Ù®îÿn!’BÕõ94’hÄŒ¹U œª=ÕK#‹‹êÃWïT¬}1i%ðSS‚QÆ<¸†±¼: šº®0*“Q·8DW›" Ü„’ôÓfQÍÙ>Ý„( 5â઼EõÖ_ÖÖ_”Ö?/'d¾['… ©4²Ÿð!3P†‰„Ô ])SŒŸx ”©>&›Òu2OW›u^*h^¬›Öm˜¾«®<\Ó晓Òô#âà¢&[M]à,ŠMJ £îúÈf¹kc¹ó×hš íÞçüj"$GFèþjâ%ˆ¨IÕIM,ý­œäõî¥&ø„šø°›Õ¤Š1¬&\#AŠÉ|—..#&6óyÄ$ÇÙ_KãcRâ³¢$ q§%/¯§¯ê:B°¨ ‡í8.M=¢#.8>ÑJÊ$s°%ù2Û®`çÙlÀ˦d¿Þ­–ëdzÌÉ‹|”pN,ñ%¤„$ùcâ%ˆI‰‹ê"%ù3gâŠÞg³ ƒµ!`ó|è±Ý~]Ôn ¢x¨;YàËŠÍ|A)€öV/ADRJõ¬h ¬‹Ó”WÖŸ¼xÿS@WT@W¬Œ &,ytÃ|«I› ŠA†U¤eþx?›§›m³¶È|qÝB-6ûŸ“à+ÅýãÊBËDîìÊÂ¥DŒ0)^‚ˆ²Q]”%{ ¬²j”ŒÑiQ²&-’! êcH‹‹®#­o9—Hb׳vî“䟤…›-SeÐy3‡…R! ˜{.È¢Ĉâ¢z¥¨x¯¤N¶ z‹Tà a )®èé ”a·jÅeÙnÎÁ&K“Kœ4s tPNܼ1¦¸¨^L9Ö<—‘lu:qE° ¼>¦)ytj+ L‹ææò¾¶Š3ب•Á†v Ýv´¶†ç{ –§µ2pZkSŸêBö’âñk´]ˆa0e¨]‰SŒŸx Ä©>&Ü…DÑ…®ß[sûîC¨ñZ/’ Ø&ú"½ÈE7L¸š´¡)’Ž”Ïk÷³ôa³HÎlpY q—¢%ÒJö/AD\ЍNâ’½Ù‰í¡êýZ?ÕŠ|ô-ZQ k½y¼¹õM®Á²×¡?QŽ bDqQýˆ9^i<° °ÄÁúÐ[ØVÛe­dpºÔ%„Ź.!@{gè%ˆ|gXªg­ ©C ÞCÐ2tÁHZš}ü"‚n˜k5iÓU»ã¤ÿÏUõÕúæHj>@VŽ b²â¢ºÉÊ9®"hyRV<èmd¥4(+ðâS>ôÔ6yxüã2ªb3ŸEUÎÞ¢rÑ¿˜Iá‡k¯ý튌¹uè=U©ÿ×$Î5’ÆŸ|LS²ØøLË ›ôDØš”ääc’Κµ¤|7˜“½œAxLð'Çñ±+MyPÉ8oe$+vðn$ Ò&¢!> stream xÚ½Zëo¹ÿî¿‚Û/ÉáðQäâKQ × ’Ðö{㨵´ª‰óßßo(Q>Ç«‹¤Ý+ȳ¯™á¼‡Ck)£¬ ^~ä?+GQ€ ˆ³Qù˜U"ŒQÞX¼üe’|­ŠÎ*ëŒWÉš |‘p;ÉO2‚.âUOB!²²ÌB/â2D¯Ä\îá³ì ”PÊ ã¶&«œK É)çðÆ»yå‚/Ä±ŠˆWå²>STdìŽ5²…—”9(ET8È ·4²S˜å)J¦<õŠòö+o·÷‚òÎ µ YQY~Nʳ-O³ò!Ä– „/2CV—>gyJF±RܳŠÉGœbôÖÙ¨Xä()Ž©ÜËŠ3 >g œ$JÀepEø Ä4ÀZðÑË=< Û§^…(œ:Ef[°MáÔEèT¤ i«H"!GNE°*÷²ŠL±Q1x`7Æ(÷ €˜±@h#|.ZJ¦òY,D è? e+ÒODB” P,PÂ×Ing(ÃqT)€ëÄC,Áª”ÅHÖžM,÷œÊ¢9@¤2YÁÛÉІ@¬ðÐ…}çX Ï)‰ „Ic ±\cÅ8°dÈÊG°u¨¼ˆ#â-ÃE7ò–‰¶ð)›TH‰› {Ib-Šñ"e6]x+>áŠÔ…ë"KNì”X‹3q‹sÀ¶…Õ­Šk¹²[´P˜(¯¹,?Tž 1¹‹gÏ.&o¿,Z5y>Ÿwë‹É›Íûu¹þûtþß‹É÷Ýò¦]ª_ "yw1yÝ^¯Õ/ˆÚza=jžu’E»¤á xï¹zöLMÞ¨É_»·š\ª?Moÿ¬¾ûîÿΤXG1cc5Ã}áU:Š0­Ó>Û^šwÍ⮹nNIC㉵؀V{tñ¨ŸjwÛ,§ë³éõ@ÊK…K„¤%¬x—‹Ô#„ü!ÒÓÕz8ݨ±b§ƒ‡¤}*’¤™í!ºón9kî~KøRýq@ýZMþù¯#l "€ù¬æ›»»wc¼ç­Õ!áÑ‹/»ùº°øRKÛ÷_Âåâ„:XÎöBr‡/0¾ž¼Zv×oZÈ@M^]¾T“·íýZ½{,ÊWÍm{1y"í|½’HÌò½HoÕm–×m¹GÛ{?¶7Óæûî~+c„-Åò ÊWÍHŠgoß/zZ~I•ÂVÉ”[ š pBbêW±~•êWÉVÀU€*à+P1§Š9UÌ©bNs®˜sÅœ+æ\1çŠ9W̹bÎs®˜ó³¤CÞ 0böš$k9Â_ä^µ„ÏHƘñ¬¹æ;„XÈrHÇ6h±g›>b/Õy{Û¬§ŸÚ÷Óy7›>ö¡sâ¤Ñy[# ›è ì8írî§ÿÄsP¬=Šo½¨B š¨—즿îÆI ³ö,á k©>B4šB¬ZtÓÕª›£æàI{x»ÝzÅêòwŸÛe{¿èæpùáz®ÉÁEÍ(@ÔØÜoß/~úÇÛTáE(/Ðzꌂ‚/zGA ôkúòoo^¼=a^¾ô¾NKÉÀ¹ ­¤QßXëëËÒE½£ ÅE§he‚6‰‡Pì‡Íüzý—Í|³¼ºK»Zµë«y3ÚT ¶NÚgmDÛ&>J'íÒö`Û¯ÙÊÚÒ¶e„"†8òqë¿ng‹"„›f݌ÎË0dÊ/ˆ´dH›dOäç#.¯PC­Fb 4AÞ¢²AK.ùÖzS7(+§ó‘ØBh”ö½ÊJB¦3ñ¶Ëîý8Vì)I V,Štˆ”ŽÒ³ª(ÐØ Ö‚'DÙÈ%Š) ´oE×7p=Gè”Q.GSÙn£ºÓïìqfç®»}jE²[!ÛÞßÚÕèݬxØ”øj·eöû­ ÙtyØæÙ§›[œC6/dŸz×Éïvd—z¤ Ônßíöd‡zw§~îêçnÿÈW€+*PI¸4tû ÚG´ÒÂÞ@"J“øt YŒgB”}׸Oà!ɾë©^=ënÚ‘øñpf¨µF™€ª†]<‘ŸQ%dñ—¤´‹Ú–.ÙkçÓéÁÄGªrÂ1†ÄÈV9äÓ9Z4Ëf6°È!Ù¾–þ•_@`i¦=ZÅ[ãÌWóöó0^¢a§e6eqvO$–ÿ¿l8ô¶Azk4úè)ê(“5‹>Œÿ¨N¨‡GGo¤ôÝÙ«GšÌñÈD„ßëåèÅŒG˜‰X’T™Ý©,Y;x“5#§ÖâÁ;tM–Nei¼ÀG2)Aª2"bKþT†³ñÔF–Svå|ém™ub>ƒ£1âÌž)4!Ä9¡AàΑÓf6R#%݃Lûzaéa²ìÄ“Yúô¤è#s^Ñ÷x,õ›Úî«zð¡<»è㞢ϟVô¡÷{RôùZùáõWô¸c #Šš¢ 2pŸûÕôÃ}3[ܵWîj°7‘´Õ(d? «òÒ¦x.ãp`{fOý‰A°9j¶yÌ{'65 °&•w;<ŠxäQÏØ“é,#z$…3{¦ƒ ü=©ìEw¾râp)¤ÁAäì%mÆ—´+Š¡ötu-çqv@mîBmîBmîBmîB .u.îê\ÜÕ¹¸œÁÙs¬˜cż›ˆMrèÀZVe2”ªg¤–ûcÓeû~s;¼Pf˜A9Jå°—ÑñÀvÎÚ–C/ kä4šGå úNÛ_ >ýÓÏ#U{.h/gêPxF/Ψ½ùfµ×,»Í¶^tÓùz¬ &“Ή÷-·”W)û£™¹i–«Íõº«Ì“sH²/±+…e¤AßÞ—Øós»™Þ´£2äœáa§Q2húv‰·ghÖÜãïí¬Meb½žv%HŽd„xGÿû¸lÖÓn¬™Œ6„VÓË69š¾Äùh†íM3|ºkÏ ÉI6ûPùéxÚ¬ÚQ7ª3̇ÜÞÙZ=d•S؉™Ëqp*ËìÇ¢Í#rG3ó©]N?|z쀑dP÷³ÑrLz]9b ¿7>ýf¬©A94´_¾“-«#ìt5~Ü)ðÃŒ.m±ŒˆOÅD?5w«qÇ;+=n\ðˆŸ¯<¦{»£zßlÎ|OÆëÑÄQIŽ3u ÷´%;¼­Ç!]=éêñCWºzüÐåý;µ ¬ÇiwüÐRcPc¡ ø pBbR*f[1ÛŠÙV̶b¶³­˜m}ž±³à#çÕ„ÇMA2Ç¡Sv:—9ÿ±Ì,Ûé|º¾šp‚÷%ö×¹`>.ö?âiÑ.%;NïÚ±ØÚ¶ÛYù½Ãv=\’vÍ€8dÙ&’ ]àAPýéç·?xƒÓ2«Ü­Ÿå¤Ð·«ïͺ«ó·Õj¤å{Ö1K/Äåü%s@pí·oÞ^Vª¿²a¬D endstream endobj 1366 0 obj << /Length 1936 /Filter /FlateDecode >> stream xÚÝ›moÛ6€¿çWøc̬øN[X» X´é¾d…áÄj*Ô‘ÙÎ6`?~'‰²(‘¦dÊÙ†¢@j8§ïîѽ ž%ðÏ$™IE‘¢rv÷p‘Tß÷³úû7ØÈÍApnI¾º¾xñšóNN4ž]²U]¯f7—L]͉VJ\~xû½ûþíÕœRzùa›å'vùË2¿"êr¿\_}¼þùâ‡ëÃÝ8áˆ3:ri´»>a¯OS$`‘%œÕ+ü’yº®—õ]½¦oË¥¼x-:WrŠÊOI}Õ>ßf÷yºª%»÷`),É—F³Eæ #š¨Ù¤±¨%O86ú:>Å ,³y‚åµè6MûîÂ`7UàþReB+w!¿ƒeÃL*¿u¿±Ø\?·xÜ¿MµœŸÀ_Ôò×¾X¤_Ût·0>÷ÙZËšË>~SæqyŸÖ±Á@TÏrÊ b²kùqPi×N?µÔõZ7Ûl—=¥õŠnB¬HÜ‘å;Ÿ°DX„^~ôrB4R@êÉœ°AN„J":žKA€“F*Š“ƒË}Ö¯µ ‘¢RÄ“ˆŽíRŒ´k©‡á‹Æë›Íîs–ßg•.)«ÍþvzÄ,g §Hð$7¬ðsæÁ’€a<+­‚+F*Š•Öé>s)F’ðaÑHÀjlãC°ÔÒ®©XʧڤΧeq·)Fä® ª¨19ä¬Õú9jÀ 9%§´ Bœ©(NŒÃãj>V{lËGÔž¾ÝAºÑŒÏD’ ÁH ,½'€Ýì‡t÷y³ê¤ûìövëã@³š•¶ZXˆÂRù´R½ÈÓ?|Þ,Û°¶ Õ‰èPBèÁÔSÁi®Ÿ[ <àôoS-é}z·Ë6yí,޵ÃnÞüôêÕû~ôé%¸¿|&Ê :Ë?ýFz`±}¥ÁÐ@Þ‘ˆ”Já©ÖÄ<¢·û"Ïòÿ.©œµøp¡2>©X I¥‘:%©Ô@™UŒÇ½}JYâq «êf…0xÓ6=”Uji×P·ôpeŠ™Ús7ÜŸ†X›^¦õ'ü,#§1M&Ò*b¤â¹óÙ©14Ô–â°ÍWÛFØ0Ò®‰6àA„êµ”­T~haÿçÓÎDOI"­‚"F*‘ƒÏ£:XO1=©müˆÖ1ÕE…)4µ-l¶ÌðͦXeùr—ú‚Ë%ÏYè§e~KA ²T\d¹¨/50Òºé€Q ©¶-ˆ‘vöĘSÀ@uc\,óÕæa±Ê Ó=ý›‘f 7¥°„"m¤¦EÚï¨î ; |Z¼”Q¥;εœµ´cºwà`Pí 8o@{òQl3È.V¨ƒãïPQ9¹Ô|lÚÊÞ=2m-ªgì<•£æòy{½£ÞM|£EÜŒ?þôö7Ϥ‘H'ì Æ)†í¥¢n„à í©38Dƒa3f˜!ðv³ÏWËâ¯á6RÔ!=µ4žñw¦‰=º ¨dmgZiü»^kɉW9Mì‘gm½= )7õAuë¼~ã M7–Ηj‚0(ˆN‰–‚@Jl¤NI‰ÕÓZF %Q›¸ÉÑM\Ûö›¸Ž¥nÅ£’‚×±Ž7ÐÊn;lå¥Ë÷ ¼ ¶Òq}µ—?0‹+ü,ü àKMÀïp}ˆ¾Z( ¾&ŠQƒy¢Ž æ–Ý#æò¾•ò8Mhî÷Ù*ý´¼Û5û¡̪ʱ@žg@‡õ²gÙ¦Ês2%Mµ B ©(Rl¯{ ¦Ÿ˜¨ 6ÀPÇú-FÚµÕƒK¢(“¨–.€ñ´xZ®·#Æu ›$Ê*šKA€—F*Š—®Û}&s†e§!EŠ‹®Èi×\"%Pe¢Ch:êÌ©óÎäíaʃóo(ð VÏJ« ÄŠ‘Šb¥ö·ÏÔDÙ§$ãjHB_``ÄH»fza 02{ûE‘n7ë};¸ˬ§»s”!h¦øäê)7ÑÔ”¼Ò*±b¤¢XéøÝkq™¿ODF ¤À?¶ý¡JTK;Öz7 æØô]ƒ]±8¥äãO)»Û ú,§”©Ñ§”–‚À)eÇ£Î)%9l\¿+ßœûÕwRÉÜm#ê˜Ú6¢cÜW:tR©+•Ú[ËÕò±|Ãgñ°_ï²Çu–Žèy1‘öAýøÙß[™÷*ÞpSþ/Ä„×!,tÓH–nʇ¢Ì7¾ø,‡qàüÁI;Œ–=íø!‘v­v+ı¯ð´sŒ¸žðª•¥ ÄŒ‘ŠcfÒi÷Ñ¡Ú6}ÄTíêÁ¤DÊìä_Éa7Æq<%©´ B€©8@ЏÃnyì°Û6zÄa·c¢|¥ùWyØ]6ãlB i¯b„âø˜xÒ­Žt[–8èîÛéySS!ÞÌCÛôP+×Y>æ5pŒj÷{§°"¹5>Ÿ÷ŹlB6i¯½Q űâ8Þg³”Õ_˜Nw]+ƒReyÀaæÜ|´ endstream endobj 1414 0 obj << /Length 1843 /Filter /FlateDecode >> stream xÚÝ[ÛnÛF}÷WèQªÍÞ/EÛ‡4MëÍCbäÅ Ybl±$È´›þ}†äRZrWË›„´F[P†Ã93‡gfwi2ÁðL(Ífj²|¸ÀÅ·»»IùáýïÄÚÍÀpæX¾¾¾xõVˆ ÁÈ`C&ן]W׫ÉÍô×ûÅ6Kv—3ÆØ”ýx9ã\L?d»t}W~wµ¾¤z &ŸËärFµxÊÍå§ë?/~»ÞßZPg㬬ý`¥¬aHBÄaÁËpŸ“ùb!§ÏÉ.Yf‹õÝ—¤ ôæçü7Ÿþ”‡öê­¬y"œ#pw/ܤ무ªß(D4­Œ~ùd=q×fF0G kø@‘!²´ý b=Šú}§œÌ0¢L”¦IÒL,0¸±Ê]bV$ ø?„ ü ´Èbý7Õõ3ÇA öÍÛáÜ„Áf¤ÊÃÓúi7¿O³Ýfþ˜dóp Ø)–ˆ(S¹ùôCY§íâ.)+E¤jf‚CVµL§Qeíãöi$á'Qê@£ÛÍÓz4ÿOÐHœ’FRM¨N#ÇA„F•Õpù%F#yŒFn&:ÐÈà‘ÄP6RÆò\†c åˆüjót»GYO°A²=g”A”œEw$ÆŠ|Ù_£Ki4Œ-Ï!† ÉD/}aÔ yvçEeìá Ђ*Ä©mRÏ‹]ºXgóåf³z/²$TN¡àºsÌ©ÑD±rZ«õ<’¢æ½42F÷{ôa\0 Ñn"¾µöAû5&¯ƒª×x·X¯6óUškXºYŸ®Ò¼µÒBÄÌwD*]Y«t8Q ©§pGIúÕ[‚,jSKF¤ÞÖÚƒ^¯ôÃÅDHŽŒÐU͈ v{ŠäAá’ì~³ªõ…ûÝmˆšÂ(¡&ÎCí°Bz¬µç¿Lòîv¾Nþ eRQ·€càÕÂ÷0ûò¨º~æ8ð¨y›"¤–E¢‚ç«LÖÍï_7ëΦ„ÿ9WHsR >öœ—Ö-¡6FË’Ç‹hb*,+³Ý&»b°i”y3‡Ð)ïUgF†ßÃeæà &3Öª—ÌÀP “‡¤‡à2õ‰ >½˜4ðXóøÈ¤`­}¨6bÂV–Péç;¬<„Fšè. Ò¶ðÐ |æ“7Q;\j4õ›„ûŒ±}æêúÍûP£þC‚ÕB‡”Æñ@.[º *&wév™åöûu™ÓªH.PzÄ–»ã ¦"ÖªŠ¤Ïe’=ä…ÈcG(.èg(D¿ÍP£AìFó2{!äÈ'Gåpr8"䨬†‘#;19\ÐÈáA C ¤ô A¨€–HG,t1~X«AüˆÌ XÞ$ Wuä’Xkg€$Ìy³åkúB14ošbD{qÄb­1äkzjq@wQÄà€J1 %|ä„úð|dD5¼’Ž›!Òß )\›QóWåÓþ‘•ÁšS¶‡Ú—3Õõ3ÇA€3ÍÛ„ÆT¨SÿúžS÷OsM‘7üØiniÝlÓi˨ªDAÚÚ¨Zœ-=n¿¤Y¶32¦+0É8Ë÷q'{y<¹þ^XˆÂˆ³«_ÇADX*«>ÂR> ¹²4R-%Â:ö†˜ðD˜#€Z "D³Ö>`¿‘"öóañu¹Y'fðL=Å«… ‰:?Œ<ý¬B˜¹%#sp#ŒµF˜}ÎûT©w]ðŽ‚=¨ª@9õ>íY²}|H×/…*ðÈHÍGPåà Fk5Œ*ûœŸš*ø.TiBõ©¢RþGËÞáw¤±óÊ{u}ô÷ÂhI"‹š?ˆ¤E (RéàŽ­}Jã&ÊðÛjf 3r¸]§ëç–í×}¹ç“l¿Zœƒ·_×G¶_ÝdzÛ¯ÛÁöÝÕ»¡ý×Àß5Àj¤{lÿµ4ŽGÚpY«I~ëoŸ ¯T endstream endobj 1459 0 obj << /Length 1746 /Filter /FlateDecode >> stream xÚÝšmoÛ6ÇßçSø¥Ì,Ÿ€­À¬Ã,²do²Âpµ5–Ø-g)°¿“IÉ”ÈÐ2e/@Q  ÚÓ‰ÿ»Ÿîx,ÉÃ/2Rt¤4Cš©ÑíÃÞþíêÓÈþpùÓqv0œx–?\½y'Ĉ`d°!£«¾««»ÑÍXàó 5ZËñõÅ5ºüþâ|Â_¯‹Uõÿ:[œS=ÞÌîÏß_ýröãUó6Aœõ\Zm®Oúë3 IX¤DXp»Â‡Ùót^Úå°ñÍwvYßV«yóN¶VQˆíƒóEiÚo ݽ}ïqßB‚4,`B(2DZÓ¿° Îa+¤„ƒ09šÀË™°¦ë¢èF‹€lïU•K̶ÑBþ a¿º [ûoüøÕÏO<‘üv_³]ÎM, aFê0l›Õt1_Ì×ÅmK«P`~pNùÞœ M ó hžƒDNk«¼œ¶Óy#HQqàÖÇ ß›/>µõ±Ö¡ÔHB%"Mš„.ŠÊÄc$tÿG*pAä³y>•Nk”›M?*GÌæNyŸdvtFrI5R†7¹\Ÿ6÷³ÿ5—D É\ÏA*›Î*7~`Ž˜NO|Ÿ|v¥† å¦$âŠÐóWØ ¹¦HÁ³yñ$x©­²xy>aƒöõ÷hÐ]µí<Á<``ãÇ¥DŒê:MDE÷ï°5 æEùyyׂj±Znb0hm¹Ú¥×#A$ˆ 6°ày 5K¥ýÙ£še#ðP#‘ºz(<õóÏAžîk¶Kúšzóý Ä!6^7—Õ×o×Ýü³1¡¸+‹ LÕ’ðrþkë= î:Mfg„AªrJàOê¾ÛbÑœ‘õŸ‡U—Ó’qÆV2 ºì¤ª‹³:¨ºTAU]\ÄcZ·by¢®PÔAWm剺â¬C‘VDض1n×ÒƒÊÁ£8!ÚÏIŽš8 Ô€sÏA g•H” û¬CƒVæ²¥9†³†h0h<š·ø“¡ñº'§´×É©îqrŠ âÚœ¢Þ1 Ûz£óqö$p®­²pÞg_sœ…œ¹BF¹Yñéõ*ÝqÑ€·k: zRh8«,4žŽ†§¹]…4`dÃÆEû©XÍ?~és ®ýâ4è@]#fÌ)NÕ&Ûá!ŸƒÎ*ð#o•|å=¶J]ÑŒµË#Ø#L §Á*ÏGÁj¡Ù#˜ç 1‚µâŽ`Ô`¿ÿ|ñglü¢ÁøU¥±öò㗳޳خÓ}ãG¦rê_–›ÅÝlõeÓ‘6³¯¶‡â¯û¿ÏÜ q’>Iá;—Ôä×AÏA¢ÖV‡ÔÁÇú@ª¡$ë^/Ý«ðµ÷¸W( û%eÞõ‘â¹\ͦe±.—Ð×=:'!íxrG ï¿¢:CÒê޼=)bœU1Aècªï_D‡YFAßõc¨£Î:T!{·3þ.ŠÇÛ»=€i—ÅAW·8$ì$gÞ¤:ÍUμ= `j«,`êˆG+Lu=ޤ8‘á^K#W_zj¯e­C¡!'Dîîhlï›U§iO³û>ÕÅh´ ,˜Ÿd¢'Š­ÐŽ<)VœU+í°Ç$ÃVG2~1†Âί€1Î:”!†y—5–«»^WB_ÿNÔþfÀ`@#ò¤XqVY¬Øxg]‹¢ü¥kQ¾ð÷¢™F°wùc]ÌV·ŸûoÍsÊJÿ}y?_צ^Ê4ÌÝó ®QÖDb‚«›˜òÀ® $ÁþÚSŸª€[Û@jäÒßî"Ìúa¹,?/ŠuŸn©«‹ê%ÃÇ…OŠäÝr÷|êò‰5Êeñèå“êÒ;¬Âdà äžô€’ÿA2 endstream endobj 1507 0 obj << /Length 1857 /Filter /FlateDecode >> stream xÚÝšÛnã6†ïó¾´5—gRE»@·è- ؤWi`x%k ±½²½= ß‘IY”HS2e_4(ÐéhÄæ9C’Œ0üCFŠŽ”fH35º¹Âû¿O#óããOWÄÚMÁpêX¾¿¹zûAˆÁ(ÃÝ<º®nF·ã>Ï×Û¼˜LccöÍdʹ_o‹ÅòÉüíçå„ê1˜<ÎïóÉ”j)ðXÉÝÍ/W?Þ^-¨@‚³žã¬¬ýÁJw°CF,Ü w7+òÍêy·]¬–f|ß•ÿáão˽ý Ïk…8<‰Í³«Ý§çÜØ5ßÃ8b’Uvï¬+îšL%G”¨Ñ”P”i,ÿÀ&í êähŠe˜nò¼2Ú™†|”.1Û‡ øgð/B÷±kþÅ bõüÔqÈxû5ûáÜÀ0#UvË]1[/–_g›|;kÄ=¨XÃoU=|÷Æ$g=ÊM~åmýLKȽhè?ŽLeí«õ‘‘$‹k+d“ÏvëÕb¹Ý˜AÝöG Š(Dô!Rïî‚Àpá—Fj@¨t``*«4`œ¨3a áãBÁº¡>†‹±öµp‘qN¸Ü?<†2*Ø–âý“É»“i_žžÌÚA,™®Æ„dbÒr¿ËOK¤€¡¨¦òH"­µ¯3H JiyHäº#‘â¬_¥}yz"k±Dº¹¾@"å}ÙÒÙLކŸ\Œ$UHkV%ˆ¨àxÆlh&‘ú ôTlªç§Žƒ6í×ì‡tß×”@03¯Ûëeµ÷Ûïíü3È¿jKà‚ Ë§+áxþ+뎷F³PÁ·\:%P°_ÌUóíËê!ï®ä˜†Š1J"e}1Rjå}@ié pÂ’ÄF¼èæƒrXUÄyø€IêãKàÁ`†—¥óQ;ˆb­’)B2µ€Ÿú40h¹» š#dXk_a ¶¸î0_E±*zô— TdYŸþ’vô—L ¡Ééˆt·$cøDôDj1D¬U"uÌÏ=‰8âûÌ"m©>+\S„qÝ^n¾ìòüŸ¼ÏfD)Ce3‚ †/2Ÿp©‘$ÇA–Ê*–*èAZÊ=v-ð3ˆº«>B‹µöµhªÌ¦èk^,ÿîAŠ¿õ~ÊR f0A]‚ˆ3†^*”ÚAŒk•DŠ xZƒœk]å=ä¶Î`ƒ ,"Õ†Nzƒ¼)‚ý15Ï€þxSm©[þka¹‡džÜÛç§ŽƒP{ÜzÍ‘ö˜Wíñõ„Œ?šÜs·9fØkŽi£Ó ‘æØZw ·í´£9f¦dzÝÍ1Ó¥éÓŠã 2­TV'M+ðt÷Æ´, c…-#~±ÂPFeC{¬X1Ö¾Rùat©_ik\î š @¥vCÅZ¥ ²¾*Žö>¨´•PaPt(þJëZ±VtÀ©¬ã ÆŠµJa¥«¬íj‚B°˜¶Æߣ ò¤`ÁðUKõ¿+k»»e ú22`ÃÍq¥²J%RÕâ2Âê4H¸D j>WxkíÉ Vµ´<;!C}¶óOÏ—9ö)=Ÿåاš|ìã8ˆû4âé×µÂÖµ7ÍÇß¿ÿ5TÙRÿØï‹PWBìØÇXw ¸í´ëØG:•­MмÈçÅüþ5Ý ¢ðõP«'´ÍÓ·þSnAvV RzÀù›ã ÆŠµJbʼnzÒ‘J`É·‡$®úG*žÖ.Œ"àÓŒåi·xÈûòÒܨV$ßü"ç*ŠàL¸Aê8ˆáb­’pq£žr˜½ìªïqØÓÀcĨMÑËü¯LŠyñuþÜçþx¦Ý[ CÎ÷yéÞ°€Î‡ ¹LV?¡Å%ÁÒŒyH¯à°ìóÓxÉ`Y‘ õ\¬±§5pçX#AkV6_>sè„^K*`š•vÌëçc7AŒQ2,‡ Ÿ¹ûtÄ{¬ü’Rˆ endstream endobj 1328 0 obj << /Type /ObjStm /N 100 /First 1016 /Length 2856 /Filter /FlateDecode >> stream xÚÍZ]o[Ç}ׯØÇöeµ³_… ®êÄh“²´ ¦®eÂÉ’—ªÓ_ß3Ë;WIL‹WÕ`XKòÞݳ³³3sö¬u¥(£¬7ø,7¬r¡pÃ)2õ'¯Âþ'R17‚ÊÎs#ªBõ™¤¬ÉŽ[YY[Ê ZÜ ñw–;¯¿Zô wfñ1QàzÊ9r‹”3†G°A9»ÿ5*ç"áœr¾ÔçŠrä#ƈx.¸Ìß%år¨cd…Yq ¨Ñ»ßÃð.ñ»ä¾¯-R>xù¸ÿ5*Ÿm}7)_a ÊŠ,OÐSQä"¿Œ"Ÿ¹ç`W¿ƒÁbä^‚W”yª>¢_*˜Â½„¨às+©à£Ãx$[{)*ÄÀ½`Ò!ÕyD«B©óˆIŽ#ÃÂ$X5¯"ŒÅß9ñß%ÃoäŒE ¼¹¨X QŒJXnY•êây ”¨.jñ*…:B*%Sß*e •ÈsÃd²Iµ— °cÀ›2›Ä²ëdŠ…[VåȽ\*'ª¿z•s®-RÅ`ñÐ ª9·àVŽ­K€V`rneUBÄ<~Uc&¬TG$,YÉ‘[°$&É£±×—ªcc$ÃYâ7¡Bä±L,ü€¯þ[÷˜ŠGò€o÷Ff/·uí‰'°ï’Ø»mõ?âµ1Ö&ÖÂf¶>± Û½\Ë:“jgøì\…ëà¼7 ÞeÕà^¬ÌHá¹ujøìJÝL¡î>~ƒBÝ/X*Ku›ø:‹ÀkêÙ§ƒÙ;6#c»ølìɳg'§?¯;uúõr¹êON_ïÞöõóßË'§ÏW›«n£~2æÍÉéy7ïÕO6{íá}Á:]°‡à¶{îìuvÏ}­ž=S§¯Õé7«‹•:=Sx·[Îû?í–»Íå|Û_]n»þòn¶YÌ–ýÕW_àßÿÆ•¨fEøKpC¬€X¼`@¦ƒ`ξ>ù´QŽæ@†¦ ”é`Yà ¯˜¯ßÍæýjÓŒ7:9×.ª£÷“Ñlÿ½ëºÿvmÀ .èÌÑ39þ™¬SH“Áô³·7ÝvÑ N$]*8͛˧ sžŒæ®Û,ÞýüDOÍA#b ïdx(–Ë%]eë5–ê3žú÷Fó·As>GõŽ·M8n€]ÿn³lá©b$fííÉeÒ®5‘î° ¾¹hc£®µ–Ù]¹”ôñhuuÝW \ïW]ËÝŠp¯)Ò葎Hûä§âiöêͯmñjvÝœþãtË~ËÔ òû<ýíj·™wÛ=™¨ß}×]-fÏW÷F Ø•Lš2l’ lñj¶A'(BQ‰Öç«¡·¿ò/†Ué×¾AVN^$ ( 釯~ÊÐFÒsžƒô¤ç =é9HÏAzÒs”žã¾ç7O÷§Ä™-Å1Ê'ÇÊa²G}è6Ëî¦oÇ„=ý‹b5æ'Ÿ e½Ú.úÅ]£X)"åÜׇ(Nrâd4ÛÛÕª¿X^7‚ca“àÆuŠÑ7N7âÞü©•dã€Ò¹`ƒÈOE¦úø{8òóòùó×B’×é\ŠH8G³ñõâíÛí>ú¡J\,Au”À³½+H|ôD¨i:˜y#ȇÈ=â¥LyQ M‡Á.ºlæ¥Ä0làã§=ÝÌF÷« éùr¾Â8‹å¬ïZQϤ™äEPyŸ±‰ÊãqmfË«ÕíåÕbƒî«e£³Ý`|=@ZlrëÂûöå÷?6¢\¯(XîÏŒÑÞeÀp˜»ývZí–  ?7B’æü(»ÛǬ]t“ÑÌ׫*‡F`—™Y‘‘ð×GÚÓMÓžŒ¯<ÄìoÛÞ€™ØéÖ¹}¼„yºÍÝìfÛŠ®Â6ì>Äa8€®:m|ž ©vÞ ‚°Áöö9"C>%ñ“¡ì.7¨2ovOßÑ÷„Õ£t‰õü­~v¼ÇÂgvôÅù­«Ñe ‘_ JâpÜýfU 1»š­¹„º¼ÝÝô‹õÍ¢Õ Y\д{ÚŠN)NGÖ2w[ -nÌÝÖ%Žš÷`%“Nö¾Â‰î&i›ºbI6 ¾´‰å=˜Ý¶½çf±ì>a™1üY&Yú„e²þò–É*ÝoYfÂ…ðe!sYÈ\2W„&y«È[EhbšX„&¡‰Ez.CϬi + ' / ’FF”F’F–FiM7 å2‹•éæa?ãl¶¼¾iÅøø¼µÊ{l1£1åqØjQ„MÙ0±ì)!+†€ZÍMÇv׊†¢R¥8øÑ¡R X¿/Uà‡”u’ ? ¸ÅwÖ¸ÂÔlÚy[5®ðCòÚæEßž?oы惦‘’AE}¼*Ú¼Ý{ózÝmª;7¢`ƒ*õâCè8-.¦¥Æ—*ï°ÊM…˦ü™åhtr´~œ?¡2éøÞ\µŸÿ Ä’#ÔÍþA!öÛVRô(¸² ïãTÁõý p®Mc¡uX†iBëû–:ëÀúGu¸ðÎúòâì¼±Ð:d’‰Bë¢¿Ú <»gË  Œ8˜áÆã q£o„ƒÀÍýÁªãCMk'ãhá#–Aæmò€ÌyËÇE#öjŒ9Õã<Ç|Yáû Žï~læš6‚‡!GD%¾jÅ)ýh|¼½“Ù×\µiíûf¬HDNÉ¡‰œAÝÎ>ÎWËnÛXý8ÓÔÏ{8Û¾[oo[i àñÓ'l¤\¦ciK…½b3㫇Øë÷¿9?erÊw‡ät¯ûýšœîÕÁ§S¾p¸§uVè¡è…zá€^8 vIòº§$Â)‰pJ"œ’§$Â)‰pJ"œ’§$Â)‰pJ"œ’§4§-•Ïáø{"]þêHµou@&äSÊ’‰äsD³íg›¾1×(Ó¸æ¥ÞŒkK7å`w"Ý\¶?Øý-ÏIÕ4žyhÛ½]l»VÕKà|ÄwôNÀš÷8Ëî?}3ëÈ[3íÆí/álºëÝͬåxž¸ÏC<ïœÍÜgTú†û¸hL~ºû}³kl÷÷n÷%îÄ{·Ëñ[·lçþO8bÙ4fŒi,pD±k„Â;m Ý£4fúÂܵ÷·]Ç»ÇÜv=£a!'´*9ÎÒÂWͤð‘µÀD¸þ2RøxÛÕ$`šJG4¨-7³Ë¾Ûö-5ññ2¬HxÓ.ÃŽ¨>tÝz~õ®ñMØAŸxvýõpk³fFÊ&Ëǯ†&Cj¨‡÷R}A ùà½ÔC8¶Ýl3ßÖ£åÖêpzš¸x¨^¥‰Þ~B܆;’¿/âLú„¸…½Îö$â&wEIîŠR¢”…(e!JY(X–·òø–P0%IDIQ’D”$%IDIQ’D”$%IDIQ’D” "J%à J¶¤rC7‘Ê­¢ ÿª¼]þ endstream endobj 1555 0 obj << /Length 1806 /Filter /FlateDecode >> stream xÚÝš[‹ÛFÇß÷SøqâÉÜ/ÐZÚ ÍCºyÚ.Ʊ•Ákoe;i¡¾GÒÈyFcidSRNpŽŽçæ§sÎ\ÈÃ2Qt¢4Cš©Éâù—ßæO“êï¹!Ön †SÇòÇû›×o…˜Œ 6drÿÉuu¿œ<Ü z7¥FkyûáÝôþ‡wwSÆØí‡]–ÿâ·¿Í7wTßæë»Çû_o~¾?þš  Îz­¶öÇ'Ýñ†$ R",x5ÂÍnÿR êáûjHß#yýV¶ä 1Éà·Ê‡V›}eÔöN"šÖFo­#îÚL%2\L¦„"CdeùÄúkE“pÐ$'SŒ(•é.ËNE@1ƒŸU…KÌÊ@!ÿ‡°Bˈµ¿qCW??u¦öôgÊá<„ÂÀf¤ŽÂasÈgûùÇõl—íge´CJ1<¤MýÐã«jJ^æOY5)„±SÝŒ„‰néöUú€Hø4ÊTcyÉ–óÍ~µè‰‚‰RôPƒ4:˜~–©1ÒÔ¤Sâ8ˆPR[%Qr yH-¼èÆè)Ò#EÂ|RÙÒ!ÅZûJ¤H_ÔQ_o_²]5‹ Ì¢"4Òä¨b½ÚY¡ªÇ·âMA€Õt yM@nÄ_8G)?qÉ$%¹F \§ã×8ˆág­’ð³óÒZŠå1ø„Ÿ ˆ«¶ò|ÖÚ×€¯È6vðÎä»IJòát$)³¤®QÊ$‘Hª1Iªq£ÄZ%QRG<˜£ŠB@b˜pˆ1-é1L*k_¨‰0 HGN²yÞ“v‚ŠaBÎ`B4bÅP/‰ÐI<"™8"˜ÔV©˜OK&¬+™¸Ê{$Og€)ÔÕP¾ÌóàÙjÞM‚,pP CcX_„Óô8b X«$Pœ ‡ô2…¸`Ã`Q†EZê#°Xk_kŸX´iÙ½¬Wûçí2ku@Afd­¦¯9lv«§M¶ Œ 7 …»‚ùÕÀLÎÇ´+Žƒ8Öj8MüC²•*×ÇCJ'Òi¡›ŸÚÚ—à$lçò%ËWŸþþ&*ÒùÕ×àZ§ãÒ<¡Å¥ÁRE;­É®räÈîQND¶'Ö\Åþ"Æi=7D'›")Ž­ìs¶ÿ¼]¶’Ï~™‡Ð´*YM pf_z³/ZÙ¢Šç2Ÿm²¯¡8ovŠŠ`€ª‚€e¦~~ê8sú3å~ÏûÕvS r>"²ŠÖÃýOïO§Á´+/1@úð¹£$k}f¬§N£ó#3Ȕﰆź}1ç+¬YxƒÌr{ø¸Î‚¯wg±£î J®Ru8;©F¤‘ÆA,X«A‰À/òHpoÞ]'ù†2ˆö2Ì-®äH ±Ö¾@¿Æp í$·Efñ²…‚±;ÏGJ‘±µëÕ™-&ÜÍœ[>ÕüsÆ?´Ï’Éÿa¸Á’ô*xãbñJGàÝ8ˆám­’𶼤ÕIÓY'å} å©NŸr¦ ¼¶(ö#>Íûm~t%ÊüÙ/òx"„ñ*H–W觘’PÀF4TŽƒ*µU *NЃë¶by,†Ñ" ô5¼%>¶]]YûR´È\ÆæÄ§Ãj™õÅ¥½ÊW7!ÇrsÍeÆ9Â|Ä ˜ã F‹µJ¡Å zÒ2Ÿã®e¾«¾Ç2ßÓÀ…í£ÝÏxžÿ5ƒœ˜å_æë>ûÌ3¬/±ÏìòrÑBÄAFŽÉ.ƒ/Ö*…—vÔƒŠ‹8«aÄh‰4ÄÇÕ!ÆZûj}b(|bÎbv~Îç°Üè‘aT¹kp‘ #9´æW9™ Ê mF¤ÇA™Ú*™c؃‚aɧC ïÖ-õ1`*k_k _Èoñ¨½+\•‹‰tV1V¬U +ñ“ös§Xœtb¹Ò{œbyB PX™›YòlµYíg›Ö²î!¾ãŒû^à9·{ý–á׆¤Æô/Žƒ0Ö*˜Óȇ4Ë"ÔdXË Ý5­D°©Œ}µ>5Ä@íª;;ö—,_dý:ë±@(jàŠ‹oèÿ~C€b«gÿí½1Åš\c­GAÂŒ8™sʱV)Ì4!OºÇhÃìÍ4W{{lžÒ*Œ¢z'øÿu•Ö¯H1¹¥qãÄZ%rÒy“èüf£îÚlt•÷Ølôt(Á0ÓÜ$jû¿yLŠÕ'‘Mšç#X£DF:öÏ2È$vÖÙ=9¸’¨‘ ík!O_CS)’×¹é½ç¨‹>õóÑ{>¥QÊ<žFeðn±îÚ-v”{Sù/jT0¡ endstream endobj 1593 0 obj << /Length 1306 /Filter /FlateDecode >> stream xÚÝY[oêF~ϯलgï—ªíCÛsª¶êE9œ¾¤¢à$¨‡‹ˆ¡ê¿ïØ»6kï²€‡T‘"D>ç›ùüÍxCz~HOÑžÒ i¦zÓÅ.¿Ý<÷ì‡ûîˆÃ 8ôߎîÞ}¢G02ØÞèÉ5šõúß½LÖy¶ c}öå`ȹèÌ7óå³ýîÇå€ê>@ž&Ól0¤Z Ülð8úéîý¨¾µ  ÎN̳B‡ÉJ?YÄŒ%‚Ûtw“Í|²ÌÇóI‘À»’ûx¡?$"-þO,ˆE6Ë@8ܰQ&,ô5ËÚ¤dÇ4T¬‰YI øÂ~Z²k~ãÓ¬®z"=iߦLçÁ¥Ý(C˜ÑKÄv¹ÝŒóÙfüšåãvaZw`)*ª+¿°½]Ož³âï¦Ûä™4HBÝ}ò‡;Z¡CªaG%üVJ4;º~½^GùÑŽJ‘„‚tî¨ ÑÑ uIG«Â\¯£>ù:PtTÄëÐ.ÛÌŸþµù<|m³ùÊ5·q©ÐH]Q˜/óXˆBD×úæ1¦h bÆÜD(B¼»PöRBq¨NB±õŽQÅE…UB$"á).Ä"qè€f³A  SÄdQ\÷‡¨hÃ)È®ö"Ë_V3›·ÓÒˆÇT 5â WÏÒ= È@¢áþeE‹ÈãeöO¬–J£â®#ãˆj¨‘HH]=W5ÕõC/@D5íÛ”)}̦ù|µ´¥ˆ!(oY¯‡O£ïïÛ½gÐ{ÚNŸ VVÄOÿpï+ô‘dÛA“2®S%Š£-zº†å#_m2ˆZŠ´u]š­¶}΢OGL²ÚU¢¦Â bXßbŸÆ CUwSñ$L¥Bc*ÛÊUêšÇØÂúfŒNù ‡ƒddƒ{jøXtÈ4>ÜEûÛ–gŸóÉ©jÑÅ U×Q 3nn" ;׈e %‡ê$¿êQÂàFI¹ï zã«Á>!‡¹Fä“JP›Êzö4É«Yv\+ º/O×q¥7 ç—æ±ì¤ÄâPIJ/z§½6f-vSõÉŸ°×T#Z!QNÞÜ^{‚P0+„Ð]'õõ)™XP'•$¶Ú’)?ÏNE\5h'âÀm’Ñ–k‰Œ î´»l±þ;&íLN\je¸Ô–¡mµÅñËþáÀV [”ÕTÏMuýÐ QMû6±­·Ôþñþ—éÿþ³m?÷[E‚ÅVƒë„Ï ±Ø:ô‘|ÛA,¶Šƒ±ÉæbûºX­ò—ú¬ííÏxCÒìì+^€„±T¨sœÅ>…µì«@ ^#YÂ]By1“D“û„½8tÈ5@œ‰Ò몣²iµÖ¾ùÄ)…М©zRJq¨nJq¾Ï#9O&ÐÕô©§¦EDãcæ"Ø¥ch¹Ymo4†ŠÐ×CŽj÷1´C~E[cH ^¡_ï‹ÿüö)rÀ"T8‡TypãSHÍ!‹>’p;è±9oÖEPð®L9Øâ•NV¢ä&+%9uÁ±¾ a*ê,S)õ_˜JÔO )½Û‰ó©¾³é„8tH1œ: “®N£woBÇOò‡› Nò½)m8T7mì®­ ô)ÚhSŒh¦‘êø¯† âä‚SY/@J ÕQ ‡_‹n$™¸çÈä? @µ endstream endobj 1611 0 obj << /Length 970 /Filter /FlateDecode >> stream xÚ•UÛŽÛ8 }Ÿ¯ð£ ÔªeÝì¾µÀn/@g‹4óÔ- %Vw{`;3˜¿_R”'›A[ˆ%’"É#ŠGüxdòÈ‚ÂDëýMæ¥ý6¢Åâý v)¦3ËwË›×+ñŒ•YÉ£åfîjYEßb%“4/‹BÇw·wlñö6I…ñÝàz\Éø³m“¼ˆ¶I¾/?Ýüµå…âdÿ¡CÈO¾KÈ¥G¿BÚ›,®GüÝÚæ™$Þ°ëïR<í\KŠÃ€ÔóKßIÔRePÔÔ«ÞöÏ$®ºÖ®W½‚]‘ÅWº*3¸-Ei(»ò§]Χ3×êxÆ×å«[u’ã,'èß>¶Ãh›Æ¢îû«PW!(Œ¯+°[GCD\fųCGºÈ˜ÎÕ/¸0Y§3ó+9pà€’êèôÄĸÀ€Ráíï8;-ÚŽ]Í ‡ÂÍ{`~è iÆÃXúøùË?‹¤ñ2)düövùƨR§!š+¯{gG7Æ’¬uO´?À<ó³ ¥½m«nO ºH{ü_„(‰F[׺ގ]Ov›.È=éPr2 Øp•äç»NÓøg‰óë*3‹æ¢0&~ð1»ã")Ž*ap<&‹‹S h1C‡ÛÎOb.&v´ÂT¤†Äi1ØÄOe4 ¢ÇÚ£k#Y˜ÒS?ŒäöÐÿغñÇK³9 ösª®ÏÔñº $諉8|׳á-¤ë ²½Ûwp§)LqÆFÍ™†×-ÀZ% *­Âï5\‚³’ߌc„Ùk|ÖyÔù&ªø§[c ÇÁ0~{?Ùž©–‰M,.ÏYŒžÂ±åŸ'YÆ«¦óý_£ƒ{Òz|»}=ŽþíRaÒáâWncÍHšê£°9 žyíðU{ÚÕ>ÞîZA…*˜×;hн†{Ò×ê)K–g³ú§4ÞAåRª…ÌsV˜s.̪ªããóë?H”K] endstream endobj 1617 0 obj << /Length 3026 /Filter /FlateDecode >> stream xÚ½kÛÆñ»Å}¤€Ã%wù‚N×)P·pΟbÃØ“öNŒ%R!)Ÿ¯¿¾óZŠË£bmÖ>fggfçÍSW üSWEzU”Y\fÅÕæð,¡ÕîþНÿþL Ü×Èïož}ó˜+•ÄUR©«›»)ª›íÕ/Ñßvö8¸nµÎ²,Òß®ÖZ›è¥m¶ûº¹çÕmÝ]}{ê¶á•övµ6&úÕmVk +õ«ušæJGƬÞÝüãÙ7#Q&5±ÑÙr࡟°QEœ*£=i'8C64”gS ='¼0D8€áCtÎ¥“\­³$.UÆXÿò Lf&Ú;þVi=ó2r‚-d]ÆIQRBöæÕ›×ïøéç›×K7ç*V¦ð°¶s|Ç©w[ݵvga6å±\•EÏ÷{Ù´ƒå‘½%2ÛÓ ß –ŠÈ†på´]­UVÅifpd© Q:I¢~h;$ Çuÿîîq¤&Ê1=9¨p¿~þŠ]‹rûXo¸ƒ«O͆8à•ag†îÜpêU?ØfÃÇz¢æ´A„»'·Ó ã“N™ 1¦•‰×Öv[žb䥷‰Izçæêœª2NõUž—q•U¤Í±­8©à?•’Z‡+Sý–ãëÉù+]Z*WðÏ/?_æâÝ5!ý’gƒ §àƒÅ]šS÷ž¨~ÿÝðxty߸‡%/·ö~Iº ¬U"–#où8¶òëÇAÞ §$•\¤B wKíñ>š–Ø‘"6ëLjÌL (>:Zø£èÜ=z5e€éÚ+Œ`(‡ú:„†!qÆ*%MƒPrª{²­˜ `˜¸ GãDàÞ}ÄE×Ù=/•ãä•ó芮ÙîÏŸBNäË;Ûóz=È %R|dò,MôXï%1¹céð«µä ÐW*¹mgühïmÖÌtÜ`kRÅ ßÍd¾i»Îõ‚»ÙJ‚„¼ðÁ¿eµÏõTíM\)>ÃÛ$I–,D™8/7¬QŸèçDŽ o|¢{³4­_¢b-¸×*M•þQt´Ý–óI1v@ Û|=ÙÿƒpuWoPA‘”§äéy¾ógQv é~¸Dóç>ÝLTSúÌÿ¢W_%­ƒÔŸþxýÜ(nªŸá’œ8‡¨·N“X—%ãyÕ‚2c47Æ'©f ™šPÊÀõ½Á“»„%ÎÆ Êgã‚@–§4 Ë, F›R%ì„èß?¼¸NíáÈ£É\![dÇ|ý;Žžß!6H½ö-o,ÞN¡k­ó4ð—J'ò•8`‚òô Õ€ rÒ9P{°T*äâøa É€0]zäý¡ƒªh{!N/ÆÜÌèè9]œã“À²æ!3EO#x·o(#؉qœYÍ™ž æ, á0Ýtb®™`z¬‚‚!,Ô­[Jó(X•>¾”¨ƒ\Iƒgê0³+×2£Ô-б‚+SOîž’Ò‡ؽ/h@{x€ÂŸf"°Ô8Ê7p··Ïi n´ÝÁîëÿx@Žœ@ÃÁRBú¸Ä'H|'rè}É蘈dºˆ>p¦qDç¤A²¥ìõOIRoXg b@çR5#¶†eÑÈU7;òn=ïÖw‚µpž…;b¼ïK!!)%ýøËÔ`A²åK¥8 5Â…Eæ‰GQv¦€V0b5ÄeC¼×»oÔsœßL§’â ÷d‚DïÝ‚=‰:ëÄ»±DCþÛ©–b_‹ñ'^Á- ·=åˆ0¿w ä‡Rp {°#L›M=ßnkÜÉ< ²–Ïrµ Ràš·ã)M¼}©¶×yØ›lAbv 4 WCK΋™o+Îç'……lÑ Iôظ óè'Hå t®;a|N±a²¯o;Û »¾âÜ|øLõ‡O¯ 2VÖVUŠÍÁª³£ò« 3 …BÅeK4#×m½å¥M{8žËÀÐÓzvçì–WûºÙ8>Ó;€5Vhï©*±2CX=ëæc¢ÍX` úâ×Î7gãR5óÜ# óz-•ÀÅæåø¸\1-•`Ë!;÷v¬ÊI €Œ ¾ž˯$¤õGð#dž ë8 êO\àB(3R!;5žlÚ£o]dì!ñ×ò‘Yçc ý´ì‚i-wØÍÆ= À4êxf¸Y1o„‰Å¤ážÀRzVjHáª1G™‘{¨&®zâgÌT»q:qDµ€ÎX&7"ƒ[_ÃãŸïÊ“è¥DL|•±™ÃÄA·C§±)•§¶ñÀ‹±*C“vŸ0 Q_¡’(ƒ™jÂʼ¯Î‹'?¸ã_Ë?SÓ Î 8Ç@% 1¤pŒ€]l±^Þû6«®=ùíbŒs­ïPWLå3¿dž¥•)ç/9Ž1p¿kOÔË“óA©³ÙÒ:^›ÚŒ©ÂîûÀϳÉÐ+±%X‚¬XÒâfû×'y¥0óSÓâ•@™J}&‰«¾eCñÇäýAvcF+$gÆÁ¦oëÓÌÈCZä·‰GÁ ö8í­œ ßµÒÙ=qõ7‰ÊØóSOã8ñn¾2ž»ì>WÂ0vùÉðM'`ò%%Õq©ä3,Žßôî‡py¦gM«L]·û½8o˜I@òåŽ:OÛoøeAÂ2þ¥¨rŸP¤&H^2…5;ö’dž(…RggXž"7q:­:§ÂÓøuâW·2(´E§‡óÌŸæê›ÄF…ýïÑȨ́ød£/kyÆ–WâÜ ;÷¾Uèãžÿ²†N»TÏC(õ»–\Jœì÷ÜìÉÂ|ôÔ"•Ü÷­qäûÖ ùøõ¢Èαò­ƒ³DAÎ¥.þ²¢ææI\F¿_l]ƒÎÎ_Ú¾¢u­Tœ/µ®¯¥IK²p£XWäþB¾eé†lüTX÷³Îã¼=šêfÖG’6±`Â&ï&×ÍÌÈŸØN>Ýú¶¦(¢JJPO¶_Rye4cx‡Ô?H¶Ô,]J™RK¯Ñ€{»ø œKšfÓBîoùzÖql`tîÖ«`:7IXñÊǤ§if@«ð¥ÏI=1ç¤&Üv)'_q6ÿ0[ª*zyACR“Åe2rì/ªHg¹šª ^%½¡2Âsïf[AűN+à,׿÷ÙI4eö½Pƒ+U 4¥p°üêÏŸþüz‚`á âüš§ªP°óP¬óºmØß%.¤òîÚ ÷¢ò ŸB³„KîüÌÚåO¡ú3ŒÌ‘N={Z¥±VZ:Œ…Ï=Àbt¹o,·™zžÒ›ÒúÓZdÉÄ È2Q—$ï¿£tbQçT^ÆEäêž ŒÕ({ (kVh!ü ôV}±‡²ä4s°ï³Ó¼LžÎbžSKW¦’Ha†wÍÁœcæU‰Ïaƒóû“ëyÎÉ[ÂÕ¨ÀœMgûuŠÿ.Ño¬ÿ"³”7‘JêBÑýµô›«*Ϋ™–{Aô§'`Å®!ÞLáÿ‹3j%Kgͨœt(óÆ {;°áÀ˜¤³¤&•Ž¡vù’0Ÿ†"•)ÎWÍ¿šiEÀÖ´Ýx>2õ›¸د˜èÞõ¹· endstream endobj 1621 0 obj << /Length 1228 /Filter /FlateDecode >> stream xÚWmoã6 þÞ_‘°h–%Û2V¸½á¬ÚôÓ6Š­$Z;°ìý÷#õâÄ™ïPp’h†¤>¤Xºˆá]äÉ"Œ–/ÊãMl¥Ý~á6O¿ÝP¯·ÅÕ…æ¯ë›Ÿ¿¦é‚Ƥˆ ºXï.M­«Å_Qš-WI!D½<¾§/Ëc,z1ªÃþÍ2Ñ ëå?ëßoÖ£·4IIÊÙ'C ÚŸˆ/ÉHœrß‘ªÛfo  ‚G}K–«,É¢õA…AìÒFAIF9¸µŒê½ÒÄQB A§”uíÍwªºfÎlZ8IÂO®§ÍóËýýÃóóœýœv´ßªñá”Û”m×)s²÷k›Jïø$;yT½…Žéãò@(Úb•ð”P¸RFhJÏWµé3CY‚³êúc)x¨qžFö‡%ìÇî]å~ ·ª®k}âË<æQ¥ÜQ§áðQ±qPN Î!ŠŒPV¸(Öot¼Šq&Úwæ–J›¾ÓÛ¡×­÷.;ï¬ÒoºR•“jKÀ¾õ(‹I™ y’˜•1ªéµãêuF11¦\6Õ¬AJ:&¹R~SË”FÕœEpÎÒÑùùº›ã 8v…ÎcÛëRýɈ‘ 3VÄH {yØÊ°1íÑï€(U‰H'Ñ×Q}¯›½;LG£­·ˆ¾á­®¼ªã1z[{'eÛìƒ.|ücr/(vÍÞ9L™ÃÛf1·¢I p>ÊîÕo-š¨m3;£ \Ÿ©»꙲æ¡ymÚ÷f6Ã1‰‹ |Oc=;Áº¥¬®§î]¾$È4¹p)›¦Å$åi¨Aw(ñ&ˆ†½ \£üp‡cÛy=_ú¨Pw¡ôd;¯ )ü3…„ƒl‚ z®[ëÛ:}u2%]îÔ"ƒ ^:+¢oÞ#ô i¯_ßoì®öõêÎô²)Õ'‹·Ý¢ïè_Uú&äZl, ™kayäím]ÿ ‰|©*¶%v¯RdŒÀpæÄÐmlH›Ûþã¤î6éÚÜZïæ˜Bó˜°„^÷!0ßnsN6H—ÁÄÙd‹<ÚÙ6‰_\%UÒ—!ˆ¦<ÁI®B×DW]û²I2oGÓ[Ý;V¡Ø7ÂN–åYAÒ<›‚ëøÂirEc”ŒWƒ}Op?ÀŠÃžˆ£¯KüíPN/ø‹ZWðÂwÝ»/Ú{”Cß¡@KÛM¬ÈŽJ¨;ÎS*‰”é8CÞ"”wßD:Žyº —P žp"àMš¶Ü«Éð :=w(ìÊs©Œ‰ “1ÖŽy<úÖû).LvçƒÃôíbÜ·hvñ†aÂ'Å”–$ü ðûøHA endstream endobj 1625 0 obj << /Length 1835 /Filter /FlateDecode >> stream xÚíYYoÛF~÷¯à#DÛ=yE×qÒˆ›:J‹" ZZÙl$R%)»þ÷½xÈ«ÃnÒ"@ Z‘«™ùæøfvM ÿHÓ NJXL—GX?­®³8qDì¾1l÷vþ49úî¹Á(Å) &ó¾¨É,xž\g«FV£1c,ä߯œ‹ð笘-òâÊ<åuSå—ë&/ 󤼅ÿ”Óј„͈„õhLiDx(âÑÇÉ«£ÓIk”  ÎDàv߃ ލƒA#„708"`RDÃ磔…ëbªŒ£X,ÂyY™E¶X˜Å§¼˜Ù—åÜ|H€ÑÇ©^Έ)œM­`m:c’"BcÄäZÿLA“’Ïx˜[—5×ymVµœ:OrØi߃&š„ö÷ÙjµÈåÌþ²4[õÛã;‘14â}CJ‰c#D“ÈûcìÃDŠÐô®gt•#0íÎnŽú›9†`Enó¼’Ò'%x+Ò!΋ºÉŠ©4èttóq% YeŽœzÛ&\ãÅ7N(ŠãÈ $ì!ëOFåÜ)k®¥«ˆ­ögÍÝê¬T|ˆŠíG•¦H¤ü?D5Ë—²¨U^y4HB Í1„!Ô¢ì1ŸÉÌÖÃmÞ\ïÄ%(m!Ùò€À}Àç3Y¨Ìoò˜pÇ‘ªöŠ+xO—¸ŠÇ Ö8€Äª1åÀf–”ĸ#1ÃD•œËJªjiñ” A- Q†baiè¦Ì:€HAĺºÐtqÑÕf„Ne°NX·U‘ QNݦwgïÎËÿÕR7Ud‰2qJq¿ÿˆƒ¼|`ÄãàVï\ ÑXi\o~µMj rŽ"L´(âëÙË·“ó'Ã?g\ßåp=ˆc‰{€‰/Æ4†ÀÄ Dˆ!àÎ{l¸‘pûE ñímÔUŠx—וƒ|›(JShö”"Nˆùe^4÷Â^Ëæ¢ËøÐó%„~ŽÐ+ÀPbB$Âõo"1Ý_ Ѝ8(ð»üœnüSÛªaLh|²™FjqO¯³ê‰ñî6wFЂ:&íåÕ0t'ºÐûyeŒÐÒ{Šza¼ÚFŠ1Âô  n7mE tÜcAí ë~mÒ¾Ú"£ˆñ½ÅÅ¢2Z'Øü}+Á§0!ÌÌ`û D $ÚÇçÀk³®[yv*.SžºÝ&Øê‘Ï#˜1௚¨GA…º/ìgu™7UVÝ™¯SEB*ÙTïê‘iLÖ®—Ö•J(hVDaXyàñž&šk©ÝÎõÄ©žt p~gÞôº›ÚП;Í“¹ye˜Ñ‰­”QÀiÆ([›=N£š~iÞ™5$:?>3_n¯ea6¯1Î% ”P^€êeÖ›‰çnð¶æ®cLÓëJC9˜l¥=©)`!ë-Œ ¨m/!«J†)ËÏÇ &¾®B&Àz „â…lŒÃ ÕõRùÔfZ5ŒÍ´\®ô‹²°™V{‡ª ¡\šõ s“¦žÔšÚìüÚÍg[Z4£Zlñëšb0"Ä„ ÏUÏG ´Æ­‹üf’UyÖ óFâµ;¤ªÔ³>«d³®ŠM8¾©–2®oéÃâŽ`¬ÕzN#ö¬”ÄVsÊC(£*ÿÛ¬ûŽ©Í#e*§¢3U=4õ oÐÕ Sõé º’§#‰$zª.!âP¿Û.ôƒ K¥íÖÙîª=Üà—$¬$¡LZ¬—E­’¨*Áqø»áá€Á¢’µ±[ßoF–8…q=”ofÆ[ûÔ´·N­}Z9qRÎ4/5CúB‡4Þ£º!Çlœ¡`¬aQ;Ö¨3¸ÌfÛ(-Õ|d8Í©ªó«BÚóÅ6‚ëÇ›£ ¤\š~] « ©dèñ–âݸT^Äaw“á;À9W$¢›^áBAððÒUÖu~¹­öÄh‡¤³œ¡òÈ“2pЄ…#}cÅx²éµ‹“_Î&^Sbm¦Û}Rƒ(Ùæ¬k­\מ»*ŸYV¼Å}›N_¿Ùc“ù\®ò*ŸºmM|ßšt¼V·íµœ£"ãxÛ…ju Ë–«l•j=œñõÛéÉaŽö;øY]ä;Þò(ã>¯Ë­­Š1Ï:[}ט¯óÐ0m×ïkù8×Ãÿ'ç‡ù¬›Bƒ“ýÄÙaÿƒMy}<9Ð×}:{JÚš>^À‘ È\ZÜus°ÇÊ„£$n¹Çãy}ñÃä7§?zÛIúwí}7sÚ\·Â–Õ¤ïo2”Ĉ26h2¾¶æ@Š5_ïÜ혛-îÉù»ÓýW“¹ÿ(‹wÝäþ*‘íæñ}°e‚µÜ9ýÜÿ'¸K=ÀŽŽ¾`ˆ¡e| ñ— ±¥]_[öŒ÷'¡a°íí¨ëÆ¢t÷Eî ø÷‡Ç endstream endobj 1635 0 obj << /Length 1412 /Filter /FlateDecode >> stream xÚÝWKÛ6¾ï¯Por3|êÑ[›dƒHÒn¼È! ZKk3°$W$ûï;$‡2µ« R´(‚‘£ùÍÌ7³ˆÂE)ÒLL¤Ñ¶>£VÚí"·¸x~ÆPo Šë@ó·ÍÙãs¥"FINsmn£6eô>VÙjÍó,KâË×—äâ×׫µ"¾ì«Î¬düªhV<‹Çâ°ú¸yyöl3ݦ¸"JŠï„æµïãK"ÆH®÷øxB¨’Ÿn†•ù6›±»*u?tWº¿Ú~®ê£ôø<¡¡}Læ$cî´Ÿ Š:5•‡j’p9)mÛ¦ð°žäÄ«ƒ.®ž¾x»¹øÙA²hôõ8è¶YÄ¢(I„ °0Ä’„jkÁrBð„)æ´7—ÏP{@pŽ’ÊŸ©o–¬cÔ¿¿q~šÊ‰ÌN§õ.úr{ð±îôBoÅà'C…A;F´cïÔj»= úóJ%qÑéb¨Ü›R¯X Z,:X!ròÂÉ×k°8‚pNK¿~Xl»ÿgø€èûØ+Iþ_ŠîéøÓº© J¨ï ©ø¾ªÿ ¤œ¤™ü23|¬¿:Ñ¿½¾®ª¯C{ýiÑi '"Q+'Md|¿ùsj"<t2NÁÈÄ´÷iTÂË—ˆÒè‹Õ¬#AxjØpˆÞžý}fvOÉ3aâ>BH…ÞÁg߈Áìp8[€¿PûÑT=—9)á§’õ¹Õ¥…,¢¡‚ÏYô°ŸEJÀqŸ›3~¬SðMžÏªÍÛ¡íLN3n‰#LYܺJ?ØY¤C‹J{–ªkl{€]{ ÄHâOÕv «µi¼Ù[þÁ»Zïö+žÆƒÛ‚&lì•PZúêf<à!@wÕýþôü®^ùÕ“§çx%kAݰ~æ­›±Ùš(Ù4àæªÒ­¬)ðÔõñ©2=ª®œ¹îMáGx[tƒÞއ¢s¢YøgºEWÔ•sl!-ð²}aW,ÞMÓ¢ôÚú¸B]‚rÉ„S¸lÇëC…-×$QEvÆÏRÞ‹~ál”qßÖXÅ÷¸Æ·—Œ÷í¡Ä¯tsÓvP(Ð8·7^{¡îšùꑆ<3V$„‰ÜYñ¢FÝàÊá—ÅêN§\x·¯ ™Ã©Ì “ŽÚ:^ Žb P™AÃb¡å¤²œtôQë¿®œxW5UW –O ¨l(§˜Ñl\V"ÄYŒÜ9ŠÆEYvUß/ÉœO­Ã¦±Ã¶ä!‰¢S½Á8Áùh.¬2¤~D+tƒzN¦0Ãô[¯, yr IjsìýhIèØz‚Ñ9'*Oïí_‹”:â$¹Íx4m³>vfŒP±›!@xú'ã¿i¶øÎaIçXæß8Á¾À±®XÖÀ渨D±óÖm¶ÆKû¢Ùá º™¥^U`~Pç€þsN™®j‹Ðþ@™˜^{W^Ì:´Ã$VX0N!ü'ôn•AïÝì–S‡~jüÏ&ÈR&áM½“Ô6èÓtî„SE2W+Íê‹#`•Bùê*  ü…Ã0IŸDF/0Oú$ò~2㉢wk¼jJ*>ôþ)x4q…ž.$°¸Sƒir', p¬ Ip—Ý:ö»õ­‰[;¢?³Ù„“T>ù³{ ¯©ß î—©“zY¼Ö~ëkD‰ž"ã{Љ óYLÀœ"X†³X޹vscÃÝÁl÷ÍÁ ¦¢Òäÿ³4Ÿ^DÆHÆçLy^ w:ÔÑÖ[S,ŽS? Ô¼!È!æéh”UÛÏèe L§)ð‰©6»‚ÀÌôl †34¸r)i¾÷+[¥ºÊwz—©8Aÿ/®û endstream endobj 1510 0 obj << /Type /ObjStm /N 100 /First 1006 /Length 2518 /Filter /FlateDecode >> stream xÚÍZ][·|ß_ÁÇô…"ÉC20Øu]MZc×ÚÆâfum Ù•}lìþúΡDií•«+‹8«#‰"çÉ’ÖVFYŸ,þx HQ*SžJàUð$APŒÿ°J”$ˆ*³“ï¬)ßeeÉç ë3êuòÖgT K„zØËO3~¥ˆÏh$;©%E&JS™ÙÍ·Q‘sRsNŠ|ŒeElÓ*5Š"—ê­¢,mCÊ™P>KÊYTŠ((GRK^9GQ>sʱ¶Ao¥ì† a™Ž‘£¹i©Ôà ¡@ìn¢‡þ×9Æ‚¬,ߢ«Z­;Ã&a§d!©5\é`<ïÖ“qßPòÚ —3Ãð4ÈRžž»îÃ5úª_Üw·ËVrE‹3®ƒ Œ†©8 Ðò·÷‹ƒë!žçh@¶ŒºT£þëß°žð—àiVÓõíí›ZîÅlº* ½@'¥Mñp´c³yÃâs`—¶ïd—¢Ä¨`ôr1»¹êñ0jôòù 5zÕX©7Ÿæäe÷®¿ýíô ¹øà ¿—4,gëÅM¿Ü8çòÙýxÒ=›}Ø$+ wÄ‚Áoê2ß¼ÄT¼Ö[Þ”/ _¢ý²Å °ÊÃ&p¶TƒZÆíÊ„p b R ò6ð¦µf_köµf_köµf_köµf_köµæ°©ùÍùtŠÖh‹œ9qIX‘ðšÂ`BM—«y#ŸkÝMÒbbÍpfÏûq7]MnZ™F3ŠL#CŸ£—·³yßÊL[$$Ðn½`‚øâᙾ‘iºÑôƒ‰9Å}b&Ƙø0}×hnÆxبÐíÚØ Q¡;,÷ÝbÎ\OºFxlÔ¤ñ6 7ÀCIó ¤©x–óÛICyìá[¸ðgëŠ8A˜~Á;½z~ÙÊ<Â+ÁX™`²ìcM?®GÇ[ëÔ„)8ì{JÇE?EKÑç"^÷ûA"‡òà„´Ö|²ô8¬ÐuK†ˆÂP8Í%Ÿ3Y–ì*±a‰ ç|EóNS‚f'!:¤ùÎ1xŽÖîV$ <LÛeš°4¡NN`0|H‡Á‰Yô“馭¡ÂŒ–åÀc»ØŒóTHóBiºíÚ¼$ÚŠ++ôqp¯É~|/¤nçòbÞ¯Hâòâ­·GÓNÐ`î‹v¯g`!˜NÉKË賫»ôÜÝIÕï~dë‚ÿ´uÙ=¶uÙžmëBµZ¡Z­XÝS¬î)U_–jáT §êËRõe©ú²T}Yª¾,ÕšS­9·÷e[6 õeŸÑ¡•´e,A)Ç=9±%ç™·²DX€X޶[¬bÏÂñ〜†[¬LTepZŽ‚Ù@<¼Ûûº™¤ 9êýö;›¢l=þz/&[ê¥À^Ëy~•':îøæê̸¿]uMñ¸O'Òàͤ;@­Ï ÁnÅtFƒá´ «A 9Ø-(}–´q<¦Vû…c½ŸþòãË¿5ò>rä.'!õ4‘ šè¨÷¹ïïæ¿n¶Sîf³ÕûÉô]#<Ì5´Õ¯ÞÁ…Ô{<˜ÏnÎ¥ë®O è)}Á±L(ÞzíÝa0?ý½Ù¥AC/ÇÞÍ‚ž‰àrŽÎè÷ÓÆçÞÎ%¹Ž±Ç!›:1ÇqßÊõ±f9µÛrÂYtÇñS»8Ó¢¾2µP_;½õ©ûZõÅÖ>R_r/ëLõ%7ÁŠ’“êM`é(¢/ ŒìЬ¢ñ›Ñ)ë jŽpTX_Þ|Ö±jßA¯/¿ßüùæýj5ÿv4Z®0“w«÷ú÷µînt·ÍÓw£»nºînGçG6tD82 žñXö(”k-02:áŒèû)ÝÞvçmÆÍ†¹cXCZ&£“š‚Ê=¾cZî ‘cPñ§CRy{0òõ4ŽilÃI4ù9­«ìõçêy²èèefM rW$¦rïS[:¬I®Vãñd¹:sZcˆ0¹„ u*7gcÖ˜Ùäj£v~h³›~çüà¶üx8ç¹aJ ‰Cæ?›¿Š8s@¦ÁdßäùšÊ½Ô³ŸÏãÂW–‡´\’>Z¦^g ô†Ü²Ç z“åFÂñ‚²Å–Ý€-±–{øG f#7OQŸ ¢OF—)÷•ëWr½™RK…á0ÐÏ@7Y_[ócÄ¢¾+ø_ÆÜÞl endstream endobj 1646 0 obj << /Length 3113 /Filter /FlateDecode >> stream xÚ½Z[ܶ~÷¯XôI[xXñ&RAQ uâ&ê¶ñ}°…v†³«`FZKšl“_ßsxH¤‘¼³^7˜‡¡(Š<—ï\%~‘Â_qa¬dVš‹õþEêg›Û üô÷<¬[ÁÂÕ`åß®^üéµÖU"ëEÄò9(pA½J𢠿±+™(…²Úããreyš”a›Ïlº¯uuUbpû•¦Êj Ñ õÖ×%è…'RGŽ£)ªÛ ÷éKþ1Ȉ8ŸHh•eiòÃv^LgÙc¢âL(¡šß)“ö1ïÔøÜ@xÔããó­ 54¿­Ã  »÷žºr}ØaþÖU®)áz×^ÎÞj­@ÔV³äæ )%ŸDo¯O²O›±\åcµŒŒyê¤uÒÇÖ–1ƒU³ΘFBÕ= Ôù¡:Ša?ÁÊ4”Û¹P®–C9ÖØžÏÍ2£*e8EsÂ<„kò1ÞÖû@ØÀüb^Iå ?1‰'òHÞÆ4æÈ˜JØ|‡Aw¸„Å/Àí[‡†šBQ’"á¼5ž|‡~7$d°0kÍ*z»r¶ik¥'ÉÂ&BBòÙº+h*øaÑݰL'™Üß=BŸ¶Pz éó{/aã”8¯À@A%‡Š1•Á(hùmÀ}jŸ1T%QãV%gèT<]§‚s^À ó’}½q‹iÔP7iÊù{¯zçŽÙú)¨­¨LÎlš}1fUš.ò—³ô¨àµ«°1çä,äû½“#ÿ›ò|ÂÂ*ƒÿ‡Žna:k)šãè¦wÉiÒ’—€uàwÆ^ßVÓÊbó3¥OG¶@Dàl•ájd…<€‘G €Á(Oà}nkï}Âþ@\W”aE0¨ŽÚ50AúuÍÃ%”×XßÈœ˜‡Û”·)¶r“´ÜX8²=Ò„|¤ãp±# ¬‹Aãg; ¸T 8_n4Å.à®hº?|1Þžá#½>…å#áâuÔ§ñúÄ™Æ}:”MXî©ÃÁ]ñ[ÑlpœB:Û…ÙÅèŽG©¾&¾›/çLi5öN¸)JÆŸMé–zœÁΉ+6ÃG0™oç&XªÔçÔ1bTÇœ¨ªd¦sû%:øëàYõéTV&³9NfXn²'&“sû°Gsæ1Ïîr^GÓY.kƒ½ÊG ¡˜¤ÓÞ\Ól°Ã…¯e-Ö²¾IÍB›s–F€Ñãr€²®¥Cz”á…7Y8g À<&q0:"¡¹° … Í!”àõþ/ùÊc¥â,Õ½n6õÝæ\,ÉÁU‹Q, ›úÁ$–äB&oj¨ï\\Wt“'våMS4¿ÒE±kkymâà.øP·²!ÙY¨b¦9ú¨³‹e¼Êcñ¤tÚß¾Ä7v­1Ód‰ŒêWPf8ÚÐĶ©÷´Ýöc7P²‚Ï!—„7æ7ï#&lÒ–û{0éa°µ¿ÃG,Ø*¿è}ÔJ@4 ªð“Óð¿ [íá¦uF-.“ï}ÏæÁ“L„7À³Ðyß §M¿{Ü þ`+t¤»pwS~H¹tóMgœ‰Á“’Qº@TŸC÷´/ÄÃȉ”:Ä5M=l}ÒÖôŠ$ÃW$MÜô…ƒžï«sÈ"xÞCøPšk¿ïõº®ºkÔõ2¬¹LgÇ\ªØíÂQTóé ›8sÌ‹E&ÇÜ"Jz¼†°•Û£:sC½œ,*úwÿzIŒp‚p\t|iäU¹€oÄN7õAæºþæ8(â’lO¡è[¸ŠÇŽ”JÁÌ:¾ÚP!äãÍ•8? ’îûž—¿F†)•LÚOç~st Ù V|ñžëÖÈ_f“ÿÜ9lŸ"´+' h^äQ¸î¥cï ¸òÆë£„ñj@»_<¤'¨¡ìGu?µvm u®ïñÁDŸáEA§5n]ïïeP3´zø[¯¤ÖÑpStfß©½Rk‡nôÀ‡ñ<ðñE^.FÀÿ³ÏØ6¹^ßÝ^Üæ)ò-³ƒ~!!ÎB—Ûx.Uèà K_ž‡ŠÈœá -À·EÝ€³P,×vâänɾµ!”iÛ;>5˜÷XÓq[˜ 'G“T‘šxó|œ¤›ƒ'‡¥©žÚâh y Éý÷õÑ¿õNtF£zÇØi½cl )Æb¬ˆŸó¶Ô?ïají8"ÓØ 2aâ{ ãGŽÎmJ­¯â$t;64qôJÕ Î ¹Ñà­Û)¾>ãV•2&nÏ ˆÝH“¼Æ$×ó*y´ O0½'³M¤1êmÀš””ä#¬­ëCãMK0^úÍ8ã‘ DÀ > stream xÚíÙrÜ6òÝ_1TʃAî›×±RJe•¬=~ز]*jÈ‘¸5"’ã#_¿Ýh€×`$y×våaKU"иº}cø*†?¾2beRÉRiVÛ»'±…¶7+j¼üù wóÖ0q=™ù÷Í“ϵ^ñ˜eqÆW›Ýt«M±z%ñÙZdišD¯/_³—Ï.ÏÖRÊèuW¶ØRÑ?òúL¤Ñ!ߟ½ÛüòäÅf8M Í´’DÍÏ>Æ/YqÎ2­…ÇO$,ÖŠð«êþ ×F‡úÐ^U×·Wۦ²¿ªêÛb‡xýxžÄS2y&™Q޶»¼uLÓt6¦˜PÂO¼ô4þ1 .cɤÈ,V"Íí7ïâUƒ¿¬bg|´3ïV’ #¡µ_½zòOGÛì4&='ð§‹W›—?8f¬Pp°”;Kzu}諦‘b4“| ø)NY­e Æ \2®ù}tr­a Ü&N•éÿB'×ãÀ*ÃÀ$zþúòù&pls3ý5ŽpSBŠù±Ï»Ü„¹Ë™æÚóë´$IÃN‰;îÏÔjͳÄNœ¦É¯ÊuÈDmÙ½53Q¹í«gØÀ$Bh5•U±žTÎD}C£ýmI€÷ms_WûªÇyŸi´(ëÆv‡zk¥Ã®A‘ÿý§sDøéb»¢l D¹Å&¼ÙÎ][IŠç"4CF)5G#2ØCdŠÙC°±=ÜY³ÏGÞØ-§bÏç³-óºXì]ÕAô‰è¶ÃY&‰`lhËüâú€Šeœ™Ü£3‘}JÕ 8ìlš8z‘oñìÛéy–á„‹žÒ½¥|t&†u=­¾&Ñ¢Î@‚½Zï‰IfÚ¢ Sb4/Íáz_’ÕP±fqlf²lñ²×H­—øô”|ä®wŽŒË•µiÔÿÁ²é”Ú3#ôÈ${¾‡®9˜$ãíäU’´¿·°Ë·x¸½÷¼'X×ܹQ+ÔÓéweÛX¾A ·cݸ}ÚòCuÆáKýÜ·wù¾ú³,¨ÿ;ÊÍ•f¿oó«ú†@U’ÀêÎ]mÛ“íÿ挚ÉËø‚oã8±æ$éÀÉÕ­£§á5uIÔµšŠ€¯œØ¡Þ¯]h¦› —š 0k\í$[k¿ikÝÔë¾…yy_^$ÎkC%æÑÞ öà3?!»¶¹£]„P“` ûêºÍÛÏÔiÜn0¾ÈÛâxÓŽ@ˆqW–˨‡ƒ7àˆt3sõ@|UœÁ?.lø3‡Lã ¿~=Ù §-!gv›¿'/‘ÊÈàGEo^„¤ BÞ¡~fàfò›’†Eœ- v·63‚N‡q~öè/7§E£êùA¢pm9ŸR7Ô¯ËÒ‘h Œ%Íëg¶O˜âj®hΗI”|R±µSœÿBɬ`ªÔiOÓßR×Yƒ””Mª èGAíaÔY4Ê[9tdYR+{»¦u« 6±[ ñ4ÚùFÓ¥k‚t÷ Õ¶ó€ó£Uo4 ÒLL‚tÑ6\è g¡ƒód³‰–ݶuá†r7Ã_¹Ûp®Íè-9¸g}jóAw–u©É©ñö!õW Ñ>@g´0ÅÀ‰}€^`WPº5 @b>Н5(¾$0K'Ìr&Ì'¹UxWßBnUæÎÀH`N-wëΉ! ýHoIm+´8éïu•-Rƒ={wvGúL½O¶4Ýv›ž¾wøàØø8"cüÉ‹­®)ø<–â1vKæ !“cªJ&ß;ˇ ûR–Š!òÛæû=·ÎLt~†È lJ>5jÔ]H8N¸õÆm¢rÐU7Ý‘Uã&eÜDGÚŠã×Å vô¼ªü³}!ñ¾B íŸJRÿTB–M¨ÐS‰p1ðt=øš§3 ×,„r•@=NS?Ö˜<Ž CA6ÆWr,†½~ªì¯¨rú†é$=åô-™ =Ó¸“lcÛ´k ¶ñ„Ø€µ\˜K÷ˆTLâìÙ(¾–$lø¸Gq]…q6¨fyÜú=‰È˜ù‚"p@WîñòáŒCn«dQßKc3«Ô”mKmG*)S&{Q0öÑSG?ÐR˜F„j±|ú> stream xÚåZÝsÛ¸Ï_¡>•êD(ñ ^ŸÜä|õÍÄ—ÚÊLgÒŒK“´ÅžDº•\þûî DH”,Ÿå´×Žà»ûÛO“Žbø£#ÍFÚpb¸e‹W±mîGnpõÃ+ê÷M`㤷óÏÓW<—rDc’Ä Mïú¤¦ùècôf–>´E3žpÎ#ñÝx"„Œþ’Vù¼¬îÝl^.Û¦¼]µe]¹™úv<‘2úg‘'4jÇ4ZŽ'Œ)*"EÇŸ¦?¾ú~º¾”d’HÁä Û½Ë†é³a¡h2Eb)+ïÞÿt5Ö:šŽµŠÎ.§ßáUv ‹æÞAŽbµ³Â ²téGõûMýŽfUei[äîqÙ‚ŒÒÆ?y :)9šË5Õù|éÉÍ¿Œ™ªÌD_ý\S´«¦w¸6À]tB9¡’ºë6Åò$m¢"kËÏH¢pù<}¤óU±ôÂËsÔàN…—C AJá‰è±ª,ƒcI#`ò!驘¨µðúÀøß­€0I¤d¸{BMBÓ£ ‹ ¥Ì½VVíõ g®šKä&««öfY´7óúþ!¿sÄT\8áD Ýþ÷XÆþ̤¿M&X·éÃ凫ÿZƒŒÇœp–ŒPŒ™Dˆ}ürXüq8ã‹Ý¹qÂeñh>º~õWÃà4k•RŒèÄkéíÅõôꞇ@ æ|H~C¬8]3üÚÁ‚ÇÀaÌB\ óI¥„-|¤tBŒ~ŸT&”iI)ooç.ßLNM`k"Oq*E1΂Sßüt9–-%’ÊNZûqÄ5Q` ÑAè2xEÄ2”óAèæûÏdq HãÇ`—?†]\K)E4ÏÂ.p¦ÀV”Ý~ì¢Luâezt%'Ø8t%2‡Ýç»ÆnÿØ#Á{I …„Ë#Ыˆ2ì è…#³oæxÈ’ñ“8^ Eù/u¼Lì$èRq—´=†Þç»FoÿØã]ovB×»ôåûÆ]cÈ÷3†zOÂ1P]¶C,3iªêÃýfƒ>`A€ÐVôØ…]x¿v{ÅC!E¦|‡Ç‰çP”2”(ªž¥ HîD½Я€OöŸ¼^Ý΋a¡ŸÓù!£¢†ÉžÜ€\¸´—òû~¢¤Àwõ|³-wöÊè1ÊöËY$$a,€ÊṘŒéAì| ü‘3{TÎêTr–P¯'æ[Yû1pÎþçáü\1…ÿ„âƒÔ!í³*QÖ+ßuèÚ\Dwµï)¹Î `cÚ”íl±Ý¡ðëyQ-ËÖ¶EÜÊnS鮪 Ÿ–d Âö…\¿‘ö‚µÁó·I{eŸ"逃ñ¢IïS˜ÍÒÆcj"¨q²_Ê6%LEŸÙ$IHt:+±í˜˜5(ÜÓCS#Š>—yaד(õ+é¼-š*Ý´Îpò ŽSìÉ}umí~þ5÷óþí¹®r7([@^4@Sªh‹6‚×}SoGŸôŸÐ ¤U…kY‘!ŠÄß–¾möT’å œÆš,Ê”Û%ü˜(Cn@»iæºÄ°‚—´½a·³´õáÎðÓ¦eµìÖ 7_°@ù®æ`Ëž®óý] Þ×þì*Åv#Y0A@(O”¶zŒ‰„5Ãí!8ÚŽr8Óo-wïOz:äÛÇX©\`x?0+ÇÄÇó±Q>^CáèÚ ìÓkÏôÞ¢#Žßf‘*„`ÀŠ?Ò+ïvOzÛÚ&ÚÙ·µTÞ%/@ss𪀠LË_1·ícPGSÂÈu™û㸸÷Ë•{ôV[`áÆ¬^<¬lgÓU[/€$†Ž¯(Mƒë¢kƒ ð[™p:_ÖAtQS,Òæg‡‚à³ýÞ·&Ú˜Mï{0. Ù ¿ÇÕÆïÁ­I—âX…O¨—îïyamCz›’QUÛ e-RGõrYÚ<§Ðëà$éFí¬{ü›µ-@XBsúRf…{t¶$wh¨F¶!Þys†á„¸ múLÛòX÷›ÝÄ#ÍôŽìv‚¸Ô$yBϾaçŒMOÄ‘”Ðú7Äýò ÆpÆû1œ 0p95¢¼ ã°Å†qüÝ ãðFÆmúˆ6ŒÃnÆñ57ÿæíùŸ:z>{uî±Ïm<Û(ö`ü§¡]€”Î ^œå±r©lêKC©λ_ªî?›Êùemý2>¾Y“lüÇl§CÇÌ£a[÷¬­Õio‡e2Èbe!ò ({³ÇÊ"*A+A»g¸üä&¯FCS9,€ü€(#R«—n2V T#ÛÅý#"È~ã=×øÑ–~@¿¹BìË ÍÏ…]E]¬†Õáé+ê²àÖæ]6Û†½.¯Ï•aWÏü ·f ?ØãœL9›‡™ún°¦/úGË~²Ö¯àðèÖŠØ@6×zÉ!OàfèĶ))`55D[¤¹›° %®r€Ÿ^"ONvV¸…‹:難ñ±7ù|iÌçµ}?åð« ›à.êæ«{¶šAÒÛš¯@öK—Âo˜yã-/o¹@ß-„Ëý 1]ÎêÕ“u#,¬–Ýæ´Z÷H8Þº8]'äê¼ÅòT~iO&ÅHÌŒ¨;7ôY™¤bq\;D¼L&™4'1gCý^ïlú 2š˜í“< ZV7ûµî‹Qúxk/Ñö+ª f-lo’¡´i6i•tõfhxjç·¡oàr >…ÿÚ:LƒŸå¹lQúTÌâÁ;ÏÆ=ÏËEÙn.´ÎæìÀ:àÕ™¹ Þài ý›PP[:å¿Uð7Ôô¹áÞ1ÄŽ(+¼ }„·î¸ëÂä"ÍÀ U²m"ÜÍ»³¿½?»:{w=XÆBläÚJö?€‚–³~Ò›Vè5îÊ{2"n ˆ×\ÿÞ³.c›uLÍ]Òl Ä’­ær燥‹kÁÀxÝ–¸ÃŽÒjÞú-«¶søU÷ÆÞÂ=ø^Vuo])Lt'l\*L¦àømýQº˜ sU]UÅ}?Æ·àD¬Ùès1b¡"5zc¼»þQ…Þ«´yŽ{ Ž)!|ØV05ÈåyèPS0…Ü ÐZ®¿dÇü6×nÀeoˆöÝÚýÂѨ­…¤ÎqàN[àzV?”¨œôÉR힬à–ðST{ üU᧨­'WåC(Þ Õ6MSÕ{ ²$;¢Ü’ö_ƒ¦(hß-[Küþª³ÆË¶È0}Ûº¶!ue‚†ý¤s¬Ã¬[¬÷*>¡Eô„³t³wM½p#ça#Wg—îa^Þ6)æ=Á–ÀµÃ³Õœêæg‹…­›Šèä!®ën§›×Cù‘sg‰‚¸¸H­ÏI|o æV.MÎý'¶Évj7¯ªy±ô/ØT æf©ŸðFXxÂö–k—Ý:Ä…¢›pMwÁ ±àšüÞmùõ°òYè¸ò†˜ÄlüÖ.0é.dÁ ßLÕ[AW ¯¸tÁó2w“.öÉõ0£CkÂ~°±Ý‚µOú7‰Á–! endstream endobj 1687 0 obj << /Length 3209 /Filter /FlateDecode >> stream xÚÝZmsܶþî_qýT*õ!x%Èö“ÇubkË3í8•:ò$vNÇ É³ªüúîbÁWátr¥IÓN&> Åb÷Ùg ÿ‰…• ›(–(»Xݼவ¾ZÐÃû^?n —£‘>ñíkc‚³”§bq¾Ouž/>E±éèM¶=‘I´Ï6'ŸÏÿòâûó~5# 3Z=R´nôù’˜ sʘq£IÆm…2Šh—ÕÙMÑuCguA𷈊ַnóî~‹º®jz\áLI”û÷J?Q]´ûz[äìd©ÞVm¹*^Âþ9ÚëÌOÜ^û×®Ê/¨’ÂÍ/±¨wS6þ…5, :ƒý/…bÂÚN³_áë×(Š2ü‰£ÞªËË}[V[êpÂAÏ5lhSä¾qK$ 44°45ÝžHœ f¾£†¬¿c»wbÐB]ÍΩ¢Úæåö Å„“ˆÇ'‡Ï¬’ =BqëGMÎKr¦¸í­²Í¦y‰»£’¨O™FÕwE´X*cW©× ½7>Y-b§9xð2cË»W¯éÎûÜñcÓ¶jéaÛ*œ¹ú!¸uzÉuGgÝÑáŸtVøä'³ÑOÜðºXÂh ßÙV4'`NhleM=y±Îö›6tÌ_N L»Ù óгcÅá蘥BÑè³uK×þ1¤ncY náÕ}¶9mOÅSÁŽÊȨ{jdر®«›É|„1óeÕwÓÙ1Ïê¼›ôÄ{à’ØË8QF¿, –&NËMQÌ!E˜”%q²ˆMÌŒJ¤0}Œ§ð[¦-céÞ_Ž&€Ì|'âw×ÙÎ91Êgñ'>}¶ ­cý5Ÿ_¢ ÐùUAÝ’§ó )k™Ðf²¡ÃÙ>"þ|R'>,‰áL¥'˜É¶WEîe…CÞÒ mQÂ5 ,Û†ŽN¦° ‘‘oÞ ˜©gCÓ7OQËM¶)ÉȬ°iúéì˜F“Aמì<ÏZ‡·‰Ñ;0 M‘ŠûQð«ÄQXŪõøë×BÌ ˜†g«zgÙo÷õm³ë™˜¨;Ü ¼½Øïò‹›*/B(àÍ“nVŒ6µ¥d"Ž'KÏæßåkÐI\Âh+Ó½ Z²ÜFoªº¨pß´ùT«¨\#Èúè¤%òê&s¸×Ùè`Á<§;¾$}ò±¹PÃ¥&øœ…v™¦Mzh—Ÿ^˜à&S¶¹li²¡_ÂtžFÙ¾…9 Ã1{YÆ&ô’B Y3ó›Õ 0ŒdbÅûw0Üpéñî06M [ÊÆÿúµ Ô~s‚<„š:«B­w~ü=`GbaUtK¾›N}‡A[i©'Zf8|ÍI¿Îo“a}6œ˜@6µ¾Úñ«¥T,Ž=¿*·°Gàg÷Nð NìÔEïb1Ÿ˜¹ÌØÞÎÕýªéÄ™Ô=‘pªõ“Md“ Ä~.Cï/^}8ÿ 7Ùt`a8xMïî/I!W[* T313ÍVûËMñ_òðÆSP£ï[„l|)dÊlO×øi…R2"b}ƒÿzWtœ[Ðñ+9 ç£v2hp¬[éÅ–¦›­ÎFUI6WÔ!•É|°ÛÄx³³x“0ËûóC2ä–D#¯3¤Sw‡Äf„Qg¾ˆBW@~ÒÕüfü©hT^0R15XîÛ?þ¤Ú‡¨@C’‰ÁA`‰MïsK#ÐJp…Å¿ªB„UX¦e”ŸC¨žBpìe"Šß½çÏøìyz]M¶!¯S1ÂF»8\ÖZkοٲžÔdøòôÿgY/Àš…dVÆ!4ÓO?…5ƒæl¬ÜT’ëGyM:TrÔÁê ±ž¸©® BÓsݦ¨%âý#ØÄŒ5ORð:‘j7U÷AΑb¢~R1ñP3WÓkƒÕuVû@ø n^ØÌ¯Çü1£O£5Bçá3…¸*†@ÿ+ß͸€#7ê¨4Ä5c¾JùÃJPðÃ|U‘üù^H ú¸„†fg¤ïa×^ýŠ® ÿCÊ(ŸÃµ~±Ó}Gò›ðmrîÕɹWÿãÎ=%ú ”¥¬*át›ÁF±ÆOÇä>©qñ|Ý]¢öÕ0˜Õ@ïoÆE·Qµ,/¶MÙŽêhþnZ>[è.:šgøXaþ¹ÉL=_XmŸÃ9øzj7O«äqËTlÐ|ùkÜÓQâœ\@æßò¦X·ÁZ'˜ûã£äXÈx”‡RXNë5\—W×mè¸ `¨äxÖŠ4RØY…ùƒûl“{“„¸CûqMÎñWî>OãÝGUçô *´ ]㻹ÅçþÓª¾¿_DON’¢’,ºÑÃ7]]Ý °iªñ’þå}ã>ºÂõªÐ?m ž‚…u8G_ä‚ßâ_°¦¯£ñ¹ZëèõI’ÖÔ2 î?!¡ËœjŸ9Þù>Ÿ(€Ë?ÅJB2œ Å¡|f¨[áI¡Ä +M},ù÷KÿÙ9¢ÞÙÛ×goÏÎÿ¼ 2àTr’,¡wþè~º endstream endobj 1698 0 obj << /Length 3362 /Filter /FlateDecode >> stream xÚÍZÛrä¶}߯˜¼QÎMÜÒUypöâ•Ë‘­¶*)Ç¥¢f8ãR&9ÖÊ_Ÿntƒ·ÅhåÄ.Ui@—Ð}ºû€b•ÀŸXY¹²™Š3eW›Ã‹ÄÕ¶·+*\~óBp»54\OZþõêÅ—oY‰$Γ\¬®vÓ¡®¶«¢WwÅ}_¶gk¥T¤¿:[km¢wE½ÝWõ-Õn«®o«›c_55Õ47gkc¢ÿ”›³µˆú3ugk)S¡£Týxõí‹7WƒPFšØhõÌøÖŸYF–ÆÂ˜2£i)ç;œZæÓ–PLU ƒ»6mu{w&3™šÎ…Á”É|Ó Ö¤’,ª›ž [l «­6ýþ+óè¶- Ú?hÑßuP™Å™6~ä}¹ Î/r·nU74è¶9UMe’)º’e‚ƒâ‘Òù¢El³aÂc}l¯Ë¶…!Ó¦¸Cf¹lž"ú&4ƒNb#¤ïôáâÃåõ›ËËklºZ«ÌÆ™4«µP±0‚Ú¼>uyýþÍUH#àÔbn’M›¬¹ÍZØ8gí=?ÜŸ5m_ÔýWÁÓ8ˆã{–öâi¥°‰Í¡¤RŠ JqWW›bOUp¬]SwôPõüËÏE×å–;ß½/ñxÛ²î  ù8ïx¬«+¼Øú‰ð¹7v8v´…,7í h@›ºÄþ:B[”™‰Ê ¦m©®«¶þíŽÞ:‘°ÂO[þ L Ww(¾ñ¿Ç®DßrmM¿Ã›¢+i̇»rùò¶úåLÚÈדÍgh޽“˜Ì•åÕŠ·P멺­jÜ$¬&ˆÏÖ6U :Î3¶†ÂdBìŒbµÓa¬žwØ4m[v÷®WSoÖaý ÕëmÑ>R• Çð}ëò!´„AFc-bÑZYDwôP‚éŽ{TxëëZ ‚4Çâ ºªuš¿=àÞ;~"¹=émQßú>7^ë,v! ‡ê"dÃJÛØª9J8°¿Þ4uïm™M5öõúÐÐI. Nç±0 Ì Õ\Éè߉IœáA9(ŒNãÔœ”åx¿=9£Ð"N¬™Î ³‰M£¶Ð¬]qàÒ]³ßvTÜy™zßlʅ¿D Fþ¤¿k©,¸ … LYô-l3£¿+MæÞBÅV[¿lÜàïѱÔNð»žt&8(£Óœ;¼þ‚$›…!gЇ(ßÿ%Íñf_~šo­¤g»pÇ8vK$éóG••VM}~ÚA%b•ÉÉŠz„ Ò‰˜‹úÍàâ@Á ïJéP£ ÷ˆ–kÙ¶eË~Ü)ÖtÑÙ‡^ÎÔ °(%œ95@E9ˆ!H YŸ”±Èr¿þrMZîë§Öï´ãüâíùÅùÕ¿B;f³8ÉgñùLö0®¢æB[öǶ.·l°÷(A¼Òp\êÇhKFì¶/¹³[«Òh¡UØørËÔ_þ ãëÛc½)p®€öH!ccÓ?ýéÑBº!JÎæÐý”ÕÀ£•ýAm1Kâ$±[4 ƒ8È±ä´ [ÄGvôl‹Xƒæ6OtÐ'‘«öì³0ÑÜ$c̉ïë¦^‡‚‡QÓN¤\^¿õàSG³(>Bü Y±gçÅ}oeÈæ¥6±Êõ)—»ô> §k@ûçŽ>f­Ë!>WÙ,N§hSe©—J¾¦©].%ˆ@wGÿ¶æöM]—Þx~€p—JÁ(B¤ڊٚÜBp]¡udö@.âÝíüÞ:œÇ ‡°PCD€×¢­J¿Ž¯r¯ afv¾^(ŒBî}j­ÐnǤzǸH¯n˺l‹ÞCà˜r÷¿CdÜ]Œ*Ò,NµøM¨†på³þŸ‡T^‚R­´–ÖLäø1Ymá%¨?œÒêÁµ<¬#Ä~õþÅ?8ÛŸcNÈ U"=‰1 #ŽŠÕˆ…ŸƒN F ì9¥…T<_ÀLx™Â X&@xžèÿg™ÂäÎÙâPiÊê퇋WWish››ßcZ™@%çÓ¾úþâ*¼»…‹!ؾ+~-Ú {„ð8ɔӀž§nò©z_2€±·¯8"oΉlS,…E_R3TÝw—„ÛSûÑp± i¬õ„ÚÌyg:Ÿ 6)DKF. ¯ ±Wå"Ÿm#2¸ŠG,ãJB3g±³!¯²y´+ªý±u)Š{ƽàõ[æ à· ŒðPÀFÀ?¦<àÅîr1ä€Z¤3º ìŘLBf~‹‰n&&‰.Oº¯ve_‚‹^g"–àqffõÏ {QqžÍ9)˜ EÏXW މªÀ賂ÂÄTã=D2£aÒˆRÎ1PÝáV~<¥¨gŒO(v…É^½~’`9²coŸÙL …ÝŒ•Ú-¸î' ¬±C×»§§ÿ0Šäwt "t]òDE<6…Q—Jçç6™Òý…~v‹ê/ékÅz܉SbŠ$‹m–†µNΑðILÔ×¥MÚ ñ[÷2$rÈgïŒCÈ1Ú²ã8ª£i‰úIS6È!,{^%¼ ØÁ’£‹ #˜â±-Yt$X¾JÅ ðœ^kd{*1§¥»¢£BwlA–-‹è° ù=7nø÷„Õ k!f6ãcxÛc“>Ó›ŽîÛæ¦¸©öO˜Ø´ÕnNÏ84‘‚‰F;BÉ-s40ÝOn}ô°‚™HTÙÐÂf‚ÌòEj^~ô¼ŸbEg—#"”uÌÈõôŒOÁìœKÖŠ! Æ·Þ&¡;¨%˜´ Eû#W ¦ß-:ñè}‰´#LÇ J4û2/¨jgŸ™¬ááØ‘ %WMÖQ¡NМ›uxO°]z껀q•EG½žrtûKý ÑÑ–L¬Nö¯eÛx¯‚oÌ5%UUƒ§'ÙÈkõÂí;2Á­Ë.ÏZ-´G°‡Næ·Ž·gµJMTx°Ö»ø½“~ëÆyjÎ_G”0¤N';~»C»¯7¼sXs jŸûáAo _Åì0”‰“Ç6;Â4Eg•Cl–Ù'­ÛÄI*¦6§RqlÇë‰[¢³2 I Ó, ŸXië¤ÂâØfºÆ§HÉÎ]sÜÏXžàeU6 Ø?O/éXµ¼+²3%7b?¹,böÈ[õ þzŒ<¾Â(GG¯wG£éVº²¤ò± Ã.„ÕÉxó8÷‹’ü¢|¶_´"NÅ”vÑR€õ¦$!ˆ@éWEn‰ÇCÙb„çe%sk½äp.pÂ'¾KD±‚Zd?¤¡¨Ïš³smæsЫº©œ`«]p_”‰Gªë³±‘´v´À¸Ø…uð‘ã[¨ÝìšØÁB•»€(çoM[6¸rî…¬•ÎP>׌ Ÿ ¥€TORFNp@¶ã×bÔ€q€ÝøPŒÞ €WK3{…¤8yþü´)‹Õ" 5ãå;IrâsBHÓxÁ²|ö›Â<É–ßPGl@è#ñIˆßÒ‡ƒ¯¿¾úúa˜8öW%ÿè{L endstream endobj 1707 0 obj << /Length 3318 /Filter /FlateDecode >> stream xÚÅZmsã¶þ~¿Bß*w" €L?%s¹Ä™éµõ9:i憖 ‹‰D:$uÎõ×w_@Š !ÛwΤã @¼,vŸgwA¹ð'V-lž&yjëÃ+Aµíí‚ Wß½’¾ß :®&=¿¹~õå­R$…(äâz;êz³øii²‹•*òÜ,|ûcrõõÛ‹Uš¦Ë;×b)[þ½¬/T¾<–û‹Ÿ¯xõíõ8›V:ÑYúÌ¥ ½®Ï,¤L ­Õ°>e¡3^_U÷øîòXÛ÷›ªëÛ÷ë¦îßw®¿ká—õå#¦»”¹M2 ÓÿZp/]L{e‰‚ùN°ý«a‡¿ËV……µðšT^à¢úY,6ÐøÃBà÷Ôó°Heq°ýâÝ«ù³¥B&†¶÷úòÝõÕ_ýAdi1¬Ž6^Ýûª©c[±:Iå¸á/øAN];Õ‰’jè½Þ•--ao%2Í+ ¿ZrûY)§2Is5‘²ôK 4ne@„Jù1¹ïõ®ê.VhÝöX¯iSðd—wrÙ6Ê.?Tç»”µÿÝ÷®­Ë¾ú€ éø{,—øï#Wô ÷ýð¯qý®üoÙn¸ª-{7Œí«ª¾ã~ך‰š-wìw.v"”Y伡häY1ˆ.‰ibs3ô˜œA8²‰*Æ3@©¦B?k\?œn¹îÉœ¡ —Ußr¹ß¸ËÞ÷mÈÎû²ª»¡ÙqaÛ´€}9V̺|…:',ˆýb%—nŽ™M»0¹IŒP„‰†–D€ PE„Œ°fŠüöjòzÙÂ)Hïœ×-\"Ø“Wr­lx`?½¹ÈÓ娌J‹å;Õϰ1e@5Ë[‡õr™¥óÝ)p#–Áˆ#áÐ{5éÙÏ|ÐÁ²q1t¸–ƒÛw 覴°_¿Ärß5\¢ÂB{Çgs(Û_;Þá8ÌI©M£…J„ÍíŠCpÔæSmjC£_—û=i:‹&ð¥†KTA€xÒ^ø­ª0+€‚¦ëª›½ã*4o샃q©ß ï– ó‘c"É}µvüHZ‹Õ³1L8Æú4@¹eÃÁbL@iVšêsòúæ;úv^v¿b&°9I!&Øf%‹$Sv ãQ®¼}Œ+•£Sé'‘åYfQ9¼žrê{Oq´°‡°8ãm-“fORJj  [Šô;DüÔ R›|ÙT¬ t€¦àS‡Ö­7lüþŠ+å#{—:K «!ãÜ‹$Ïåлߕ~]¤c0Ù-‹]ºš?T%·3šN—­Ã.Ðtц·åšÊ`òZ§žIñ%ÒfR8%³$™46$–5p_ÇþÁÁšö#»y$¨»k¹ÛæHV5Þ6 ÄËB¬É4-Vîšã~ÃåzÕ¿·mÛðà÷;Ú+TVþ-2ó¦ÇÎùAØßôË‚:o Ø!“ Àɘ‚ô&ðš¸; Ã±¬Ðn˃èbç„0dIß¼S‚+æß6(,‚Ž$Ž¡-å5jÎZ¢€ÂìÈÅL™ƒ™DX{t×NbÓÞoÁùPhŽ=–›šÚqú"XÑ+v]†÷U¹çªÉÖéyWvü²ŸNä4ŸAt$í‘W¹)BÛòžD};)ÂD‰ÒñϼT aÞð [÷Û±j‡3f»#årÜÎ4Ý (0ÄÎk"¢@E€† ‡fãâ‘‚Ld‘=ýÔS¡‚H¬5 š)rý’PA`Àài8‚\?+RÈ^)lš#2llp +éœ!¶“B? Û°/%ÓPµÞ‘fçóF€‰C± Jšg#1ºÙùÉÍ^‘GFNÅÔ%?-&FÑà¡fò¡Ó.NÆ §šTªªš·Çš›æPr¥9G?6Ãóø¤M³Mÿ£ß­Ø¾3‘'Fç;¸ö¾BÏ=• AD`ù<¤g/øeȆ#‡((ˆŠy$"tŽ\ÛÖMlш_Ë Ž§ÀE5±2\#oãÛ+ïq¼÷íul")RŠ1NÒIíœÿŒÝC˜k*ßλpèp‰YÈp_A4‡O§Ì'ßë ÓjOÝãAtÆVˆPm>8 PâšbyDí(‚òC°×’{IØ!ä‚®Þ9ÞûGâ„S{¾üçë7 7½mzö©¹ìv½ò©‡:;pEŠävxÖh]lëØ™ibdx&—oß\¾½¼þwì8lž¤'‡±ì‡ù<±yWnïÐÝ‘Ùi+ÔéA÷)„@}幯Üüöé6'b=ñ'sžEÄ =¦Ñ.',§à³snÆ`­ÃÈ*Âo1Ó°E"Nš#,?}LƒAu–=%€`‘rÏ’ù,y¼Ûü‰, ëײ?‚%q(Ë i2ÜqH“ç<¹@o®Üº9ÜÑcO‹A7‹P7 ÃöêÛc˜Ÿ°òâ³1¼Ú!6€É<Ð>_ÖPÀÝgsíþ#÷`Ý…¶`N^3@˜Í/nÝ{`”L,f ÃmÛWµ÷ ±0&—3ˆYöÕM[bà-”Wƒß®á <ù¹u< S-[n0ðºi[×y˜¨76ᓼ"ôªºÂQÚðÃ…†à¾Ú—7 2ÀÂÀ•#!KÉ4øA¥ï0.È—÷¤TK^÷ñÇšÌ!V»mZ —·sØh)Dò+¼Üûñ–íC©-ìÆuÑtFçæÙ„\ˆ< d‚½~Œc„,§66#ä×__gäìØÎ“¡!–)“>Ä2ï¶žÍyœuW?#å‡3p>°I’ÛÁ¦Ì À'eÒâ¥÷Ÿg™h:Ä3J« MôÚnÌ?·t¹ñ¹þy.H¹CŸM\y4 G”Ú‘wÃþÌxeȦ™=8àb˜`BÊN Œ|†â æ(ºV‹cÎwù”/ѹD€à°õÎdå&¸Ë†‹› Ð<…õÚwòá9ù÷”Õ›:—TX—ìÑóÓ=MÀy:Ê’†‘X3zÙ6`4µ÷<%ë%{œ,† 3ß‚i_?$8_—^Áûk\`Ùù§{/ƒBûå˜ „G÷;ŠŸdô|!Ú™'I>ÏUè»NÐ(Äü!Å÷ì$ÏÚÕ˜xŠ9°–ØçÝ«§€\>!ƒ)^†øÂ&©Ñ4T¦‹?áFø|žyؼ˜¥ÔÏ 4µ¯OŠ!!Ÿp¾G+ü” ×Òg5Õ98‡¡N\ñ陟¢2¼’õ}6=›»2ÑPs3$¢¡¶kŽKCf¬Á¿Aˆý»]µíO{ ºù:Qû3:Í¦Ý ^ ù[·ŽmžØßC#òÝNhi1ó°j ¸¶i‰?2æi¾ýÖ_n×\ï~¿ÛW몧 ír˜{[÷³œ=û¡,ó|žOŸ^ëî.ðX[ðìû¯¢‡d(«"¦Ї ®À\–´›_pºØ­Q>æÔB¿}žWžžòdóÌ6Õ³w¥>!À7˜+¿ô`ïYZ_aN)óÊ&Ó8£Jðç·\ï“[éIÏd¿fÄLZqÔãùíÓe"ÉÍhM4ñ„{'æ#zQs¢Çóû›Wè1–ŠÌ‹*FÎQI¬z"4(d¢… iâ©Èà<°)©}r”žÅ_‡š^‡¦O»í¹5{è¶§ÙÌ2¸ñ÷Ìjbúù¹fkùjf(÷“¯s:®cÒ?xP…Rxeë_ïÆ…¶þN 6âè‹à+ü3À–¿Ï’ïŠ#P£˜&¾ˆÎæùTgŸòBæÆ˜Oƒê3‘®«Èí'¸=w›m ñÂHW=/Ò• ?Gù#]IIýu{Âë­³RÄë-ó¤fx?E¯·T1hšàY¨Ê>©4ë†iyºæÇ‡Ëm·5~Rh.ÿALªEøLT7õÊ›]W ߺ}ÁÓ‘Û,uxË'€ÄÙKÇ5£ªÇrL¹Ñó…SÄã½U”c Åüy—? \ÉTî¿£¯Á#2M ÀŒ‚?V=8•!³h§)Q®@g­çL„™=.)°0É…Úi.Ôc¿Ó\èiÞ&r¡FÅÛŸc4¯9CIˆýÇÛe$:p\yîvB!ÍŒ3¿žÈ¦ßð '(1Í©ú™[Ç«9T·;útÇûS|à.nªÛcsôg¥€³Yƹ«6nå(6_÷]2 ×ÿÔrI endstream endobj 1716 0 obj << /Length 1106 /Filter /FlateDecode >> stream xÚÅVKÛF ¾ûWè8*¢‰æ¥GoÛì#ÎaÓ:ΡHCkÉk5²´c¤¿¾äÌÈ+y…¶@ >h’É4 bø± åAš š‰4ر=Õ[¬îÌËE $Z/^ß*°˜æq΂õn¬j]ŸÈ›}ñd*FB" #)y[´eS·î´¬{£ë‡£©»Öta¤ù½Ú†#&d¤#Î&I¢ÂÏëw‹›õÙ)ÅURüKƒôKIÀ͕⠞ÐXI£nMˆoɱ=êõx³íZ³9>•›§rWèª@Ç^ß&ñ8<ŽiÌضj~‹UìÄT>“”˳ÐÇû«ägÏEœÓ$VÖ-žåè÷§ÏqPÂå» ¦2 NVòÊSTÖ¿xpk‚ šÈ „×ËëÕÃ$RPHÊàÝ$[3ˆSEKG€™<)“HÈ„2–øÂsÒ«jÛžŽ¦‚l§1{»È‰®=‚Âਗ਼.„ÏÉÝz±Œü|}ëÝîâfì4…ä Y/Û6ßÜêò”túKï¶»N¿|ìô>×§é u8Œî`DIç. §tuuAšúAú›»A_ñÛ E¡K·ó6¡ò­ÙÞžöU{¡xÛi]õO6,][ZR¡Ý±Ý:‡QªžºéÃ]`¿†€¤¨›â¡©04R’÷ ]Ÿê¾ò™KÆ™cPÑI~N°åC¥uÛÍ¥9±ËA¼°ôî+ƒ @ÑÍYl\oȆÍÍjµ±º¹¾Z_ÍYbqF³çº£o$ ŒSÐ1¨6‘»»õÞ9Âȶh\qR4}çÎÀ9kcŒ—m§ESÿY  ^BN a@ãß·X?ûáma&Zy¬¿¢xÕ:¥¶Xñ¼¾4WBÖ+l|µËñ(ÖŒõz.«c;*#o®o_á*'5CžËmcµFÕ@1|`ý/óRo=×\å4kT˜HÇ5ª­0Ué¶cÂxe,Àzpa«‡ø6Õ m_´sÀ=ŸN²i9žúdò4!eçºDï¶mgœÄ ½‚»çwr鮽ƒÈXãÆ Î$ÆWgãÆ5œtDâ—Šgj³w”Gˆ%€æ!PµŸ‰ŽûVÖŠÀÔ:ñX). ÌTNòÌì3Ñž{Ä$e0*`´B/ö»ìŽ ??ì+ó·ÃŽAõÿ0ìxF¥Ê9Íÿã°ä™U•~¯a—HšËlšü»ÊLò)ÂÑ嘛ˆùÎ!|Ý\L êþm-ÏbC †f*ç 4r¨Sûj®5OçÜ?þºhÑ0 ¸bãi ˜²¼ÅºÇ5 øâTóð°6ªÀ±Rûá­ûJç>@ÞV}¿;6sîsµ“MG‹¤R(¸I†–÷·Ëûåú×902§0X/'›®ÌQ·‹¡Ìy‘&à„ú^ôîf=??}6DJþß›ð endstream endobj 1722 0 obj << /Length 2876 /Filter /FlateDecode >> stream xÚÕZ[sÛ¸~ϯУ”‰PâJ o[o²Mg“mçiwÇÃH´ÍF"]’Êe}ÏÁ(‚¦l§ñîN'3ˆëÁ¹~çÀ|‘Á?¾ÈÅ"·’Y™/6û'™ïm¯ÔxóÃæ­aâz4óoçOþòBëϘË_œ_Ž·:ß.~^³Z g­Y¾{ý޽ùîõj-¥\¾ëÊ[jùª¨WÂ.Ånõëù?žKnÅÅøò¨Ìá<7ž¦˜P"N[k¡Íª„ {Ý"j¬s‡p1#U\ÿ,h!9†Ùó$ƒqþ잆‰ãí¼ö-»,w*˜5 Ýq h¥1yÜãÓSÐTçh­=V¦Þä¬-½SSýþ‚ ' õòß%š\6m!%þ‘w¦¡ËÐ_ìov%õuÕoåS„–L8>e\jhËužn9²ŽTAàn\L˜”îL×6Î`³ À!z |œQ—d?“¶ Ú²'W8†n4_F¾±[æf'ÞÜûÛ&ˆ™+œñÞC8íƒ|R‚Ok(A÷­˜ÕѪ1áè³¥ÀðHkÚ²;ìzïqêU‰1¬†m}÷/ú&PáõÀ=ÀŽ*àc’w¡§±*ør$ïËM )ÊäË¢£_¯.ø=çÁ? ;3ñ%uô$…áÞ›Ežîn!^¡Où{ƒ¤|B>•w[0oe˪'BbÄöQzðqèÊ-µP*ø»/>¬F7ªÃ¼mxI󉩤ǃ~¥9„€]yBõàÉÕØ“G«ö,EÕó•…%@Bf&¸BeÈ^?ðÏï_Pƒ,9 ¢ÃF4ihžœÀ½¤±Asƒ­¸¥„:.»ªè˜šÎ‰*·ÂEMèLý,Ú{=íÂWTߢª©£ eg@ì î ±–S¬x'F¯š¶lŽ7oŸÑ„ª§a‚T¯;ì˰IÄC"FP>¾RؼžÇ‰b ˆ°¯"³±ŸÉ';æaGŽcs7û 1ϧª+'!€l‘ ²]ÐâtZ T>¤Øj~›fsèËmüj[<9øJ;Åß#5|¹¿Yi@Õm_Ôý_gÝ/$GätN0OÈœ¼Š´@ }{+-Úšœv\#q ª¦÷9Ð>ŒsˆWØ?åŽöq‘çöx†;^*¯°/M< nå‰ÌªÀÇOmS_±9ˆ´†Ôˆçn…`ñÆÐÅ£‘`¦«²¿¸…ÒЊŬ°¿7€¢W²ÙAÜG €Éó{Á ÇøãøñC”óv”ô¹NsàKG.ìð~ï¾äàZŽbÄðîü¼ëÊÓbj‰py”–Ý—£öÔý)™w ó#ÈIYÉd¹Ê¿JÖ(ĘþÿgÈéeÐU¸…´³@·!£ÿù×l±…ApO Îøägî€Ôr„¸»ÅÛ'ÿ e‰ä4™åLí·ÒApG¥™j˜J ó}ˆ<Õrõ5€üë þIð}¿~KçXf&˜àÌ'×@„pöíÀÙåL ynÎxšŸÂ†'asβ»Q34¥±IÚ ûÅÈ‚´Ž²Íµˆþ²¦MáAD¸R\‰ÂãUŠ »*P¸-úÅaœØ•šÆp?˜·&°ÀW DR¬ð…Š  MØg„x*Äíx*bÔ1ð㎑§Soçôz÷#†ÒŠwRˆ‰·‰§ò[+¾P{ §ˆú¶¿8Ül/n¶—þnsâ3r}“ÂâÙh…µ=çÒpu‡Ÿºzd?õû&õrÞ⟞80·ö^'’O³z#À8'(á®c€Ï‚?‚g«Èä$­"çàU0›8áUrËdîîô*Ž—ߪzô*†I§îs+£T;"×ùÔ­Y‘[ñeÀ®L§²mcx§J»6·ÞmRTÚËþÐÖè+È·@`ÊÄDý“J'¬²¡N+¥ ‡Û¶]ð ÐØã ¹=huõ b“äÝÆ¢8L˜V›±/è8x²ÃP¶uˆ“µ?&ó)~¸ s*­.Ù*ƒëï–B NQÏ÷åbÌÏ3EnÈ»Q+t…lR†ª 4ÎbÏEÃÇ,>FÞù¸vÆÝI—TUF~'XYO´Ý—Ðî›m9§m áÙ àÿ¼%Zž_¢ÇvÝr¬íR½Ãˆ ‰·EßKÒÛCF¸)BéBÖuйií}_]]¦{TZT'¼1œ(£÷|/Þ½>;¿8ûéõùI„Ùb«A ¢?¼² Ñw| ~´‚+üV\©oL>Rv+á`׉óþ†oOq x†[°j\Êî}Ã-ÜÜÂVðëä} _ “ƒ`ô#e}Ô!4ã2ñU_ÃöÍ¥ç”Ô‰ü1ô·2NüAzžBÅÝ@Öm¬ T¬’(_$ŽO§Ç θñ.½¡‚3U«U¨V×C€x6é 53=®™a¿¯ÃLÖR½¢ªXeVTœ,"píÈ¡õ\…žþÖRY_âöµîŽ.® zÍÄhš;*˜K¥'W>ÊaP˜PTÇß´à=÷ÖœtG±6‡÷ñuð_ßPUjù9àÕ#ì¥ï§þº§ä,„aJËã[‡¿ÒËK ¡A2 :Têýu9§Â_~So)sþËãÛ %Qø¥ê!ÇÔÅ—_·T»‚ȇîË–©=‘¾ÇB—>õ2*«j†¯ßýøã‰—Q™ Ö>S+Q<}RáÛëÄ Þ–A$Å®kæèR<ûìûD€'¨Wòq6- ýU±i›ÓnÒ‚ Æ¿‚¨'óî±üXìNâ€ÿáÑ5œ6ã©$ú”aÞç‡]N9ÜŒ ØCpÙ·9Ü.`±+g.°€%r¢_ÜI<Á-³Gfß%9ù@Éñ{%—?Pr†iáNûÌî›"%`|£ŽÊ=‘›zt¹åLðÔG>@l›ÿ[{³°¦ÃÜ`'“ó?Þd†åƤÖö<ôwÚ °ÛU”¶³¯zØï_ªýªÐAØ¢üWÛãØÙ°Ý †¢×4·N™œ4†eÇ¿òù|êïòQ±Ü-_7}µ)#1ó{¯eΙÍÄ}@~rš«–·ÿÊAÊ<>æã¿PÙLÜ»\= œk{2œ{Ök3á0ª À±Y@l¼À¤x ï¸b >‚=/¸ªi£½ü÷m…ý endstream endobj 1734 0 obj << /Length 2470 /Filter /FlateDecode >> stream xÚÕZ[sÛ6~÷¯Ð¾QKÜÁ¾e›&ëÎÔÍ:êC§íxh‰¶¹•H—¤ìqýž@Á€¾oÚNfb—ƒÛ÷Dg)ü£3ÍfÚpb¸ž­¶G©­m.g®púáˆú~ è¸ôü×òèŸï¥œÑ”diFgË‹¡¨åzösòÍU~ÝÍ|Á9OÄ×ó…2ùw^­7euéj×eÛ5åù®+ëÊÕÔçó…”É‹Õ|A“nN“v¾`LQ‘(=ÿuùÝÑ·Ë~Q’I"äö½؆Q„jÉI¥p[é® XÁ‚ßàr`´ !#\j˜ÐŽûñäÇÓ³ã“÷Ç'ÇËŸ|÷ðÌ4IÓlß½lÝ,MÑ횪X»/8±èLœ0A÷CwÕ®9+š¦ªcÓÈŒ¦ÇÓ´Eç ]›€’š,ØÊ·§§gïŽ?-áÿ·Ë·±™hjˆ¡ýTûÌ‚+ÂÅlA9¡’º¦OEá®<ß´Ñù% .b¸A{üg«ºêΊ›|sv½¾ˆ.‚k"$?, '’_R™~Ÿ¯š Ô3Ãa ª {‡‚$Jfnôñ÷8k,çZ%oO–_G/R–ªýŒÇˆæÔ8Ü`a•·¾T_¸¿¹ïÑìªUÞá]ãgÛÁmçÿòhìâd¶½Ôͦõâ6·s¦A*3ɯs0:¬Ä^…_hpMÑ^LR¬ºòEø«¹™óÍ®h=;qñ˜+XS;CJá™8ÜšÝà\Ò6‰Ö±ÓS)Qýá 9ö0(ɤdîžLFàyÁ`œöꦬÍÀñ)ͺhÎè•ë¼É·­“¨Òáü Te=Ö)~â,@$0Ž ±WH¿÷ZN‡hJgJq€Eóó¯él ßÍR"ôìÖöÜθG÷föéè?^³q  †(JPåfµìûÊï!8Á L;ÄØVœöGþÆ«ãzw¾)¢Ò¡´§ÙsØ èhíÚ(_V­.&žáâ{ÂVgÓW%SÂ(ÜjA…"•}¨r"\¥IÞ49ÒåÎ}ZXÃ_;k6 á®hrQ7®aWŒ6wÎnÁ÷ðt‰Cª³ˆc¨¦ ÒbdŽ6²lÄ- o¬èòrÓg\cnÄaÛc‰sù''åD2ö*ÄIñèô—#Îó˜žhÈœI|#*²,DÅ ï4K,Ïv[üÿÜéõÆ58ã“…@Ô{½nËß½7ú–€ 3Õ̺ۨ,¶Ðî—äìKíU¬'†’ p¸‰{H±ïl¼çOXrKn°UÎfñÁž=[&Kˆ‚É)Æ^>ÄXª2p"úñϦ*§†pÆŸdäÖõ6/«(QSðÀ^ƒ¦àPGY“ñÑ”f$£ÆŠ¢àE<†¦üI4ÕQšÆIJÑp‘C’nŠ‹.&u^ª-üXÛôÝ›òòª‹ŸnØÃ†s’ 3l”zŽBÁ®Ý–¡€3;l?f°Øi]eÊPˆ‡S¬‘#Gm$ᢴ5\Oq‹3ˆºÏ:/uß1ØåÝá©póbºIödËx?ÛP=?‚oüq|³2%^ƒo(*eÙãÛW }6ãâk×ÃÐñå”ˈHi ¬­e÷©ŒyÆa•eV ‡õÈ8Ý3kTØÑ á=ã°Ò5fy‚ÓgòìòïųCŒüEÅVŒâŸDi]{Sü¾+7šnÝ~‚º-|bD\Õv¥k„‰)çôIÁƶ^1²ÓŒ[å÷ xºHP3/K¦¥šp%­¨”«?5ذAo±¦ŽÑªbù ÎHðÖý•aþv¬¸„x8O•$*ûLŒ””0P6ÈÈŒ3D™Q¦×Ÿì4w×ëIh2Ê@£¨×€&hI Zܽ/‹ƒ™"4VKÍKÝ…pÇ!4'QÄ%œ3>ñ ,ïi±ª·×»N@æ4 ˜ÂOÄÔ ]þj­V™î¶`OðÑânn‚@)žœÔ]¹êç;ìK¨èP\Sï@TWV^¼«=‹&Å$·îË?’Y4 ÂöàPÉUm 2±%uó›ûºnjÿþÑÀÒlÚ|±7wîßq`݆:×ÛÖM† ݦI!NÇtaÜÐÀ¦ãTx œ´7-Ü€ª¹ïÃ/ž™¾Ÿb—÷hÿÿÅ(bX¼ Å@Tª³¿ Å>Dõô!g9¡§cÚY(˜¹/â›>ô>?a™R"²§>ÊåM‘Që3ú5p„¢nûÕ#»§¤,!NM9 É?yœA`7 R•‚ë6åLô¾¥ÄVyß·WÅA·ïÞW5Zü]‚Îx;li„[ ;ÄTÏÇ-gŸ'Úö1îÃ.Ä»"ðÝžþÐ0‹|ƒ—`ÌQÊ„…]_è?Oj Û “nÐΠƃ «Æ tÓî™ Ö ÖL­»‘éä¸óÝ+kê¡t;·yðßZ÷éŒ-µ©ñ}N qMm—w ´\µ1_ìôºt?[¯¥Á$yÿ2†Aaÿû¦ÎÇ‘M½ ¢O‰X §oO\í¦¦ì.bëîýQWk÷¦' xÕj¿êÌ´nÓÍžr“AÈ­³ŒÞçø<@kyó¶·±uëpþ!®ÄïjÿL)í3¥ó‰(Œç&À˜ïMçKü5Jøt)©ß*W±Ùæ›òbýÆ_IÐó™IÊ.ìÚK_Ût žŽýN|½»5Ðùß8Í¥Й»-Ûâ *rEž!öº­úµ)+÷åV.-b­v“þÕGÚ> stream xÚíXMo›7 ¾ûWè¸]d‰¢ÚÙeŠ&‡mAYbtÁ {p û÷{('m'ðk;iƒa›¯ôH¤ÈG¤¤\¸…r‘$û•ðÏ2±7h 58påP[ÐÄAPé Z»PC!Ah¡A‹¦`I]ÈÁ¤8F‚UŸM%´\]€¶$ ~]‚–¡>R¤j˜¾À^&[`1—æf‘ì )0EÔ—â&HóÅ(ÚÔWTŠÝ|WdÕg1LÐrokû,A2o³(g·Ï’ºUè ÜÜ*“@Ä>©ÁOd}¾ˆ³[eÉÍ-è IÙ}Š^eʘOºç*´)¹Ž mÚ}€(PIÅG`¬{öalé6WH5¹Ž ÷5pêö!Fœšb-†‹ÐÖ2$sDz¦î{8‡É[‚Ë –R.:pìd ,Ÿ¥³¡*¤ÛfKN®Ú,»;1›v Ú¬u‰œ6Å%'[` ó-£'rs K•Ô\† y| Ö<‚Tƒˆ¹ÿ á…d·¨vŸz›GÚÐ!…»D<‚„Ðb¨x›KnŸ‡L¬u«0¶2xåKVûXP:9M Fj¦.÷¹tI‚Rrû(e8 ^VÁ‡`Z•ÒM\=à¿©zÀ Ö¾UŒ4hñ€H‹Ð¢îHPjp#ÌÒIj •ÜQ ¥üD/ÚZw¸]úÑÁÁhü6œ`û võ‡0þõ·ßx &Æ‚ L¯?}:½zõ8P(r©›RSôܰ<œMáà ŒáäºÄb[¢´üðÍàþ¼éjþu ,¾ÿ©ÝöYhB·Ë9 jü~>;?š,ÂI¿{ÆÇ“Ï‹ðÅŠãþž ãìãd4þ M¦‹+O=ÅÇÆ&W³ëùùäj™ŽzÛ»ÉÅåÙ›Ùçp’‚;U#aWɱ¶Sè;›càs]â_O§3Lz²L‹nÖ=í0]ÿ±èß¿\NÿßÌæ“ùRI:uSαˆl-OD’ï͈<ˆÌÁQÙÕ¿î>= ãŸgdz€püðn²øsvqõ£{ãn»A²Ò°€‚¹#ŽRŠR7ã2·ÈV^ ðA^"aßò°WŠ}èº3)U×I©¼7)•ö&e²hHŸH5ø÷Š!1#%j«±T~•G‹‹‹Ë«Å+U†±íŽU¢—— Ìb“òb€O™¿îŠé]ê:½KÙŽÞ•×è]–{¾Ýöä¹€× õžGéJI£Ÿk%IÄIäžÏ/§¯§ç+\ß^¹3Íëh? !µ¶êç"èßJo'G±a{ì>.',›þ~+ (dž³ÍF £¡q3p|(8i~`n×!)èëî[—Øjë9¨êÞ9¨ÊÞ%V±G‘!QðcÍ~a²ˆ««ß£ÑV¶–a»ÿN›³Vª>nL%²Øf 1Å·þ'€8®ãÖ$Û–â•+Î7£»{é Št{ H·ÝŠô]µé®ò^ÝŒÓhPŠF1Û Ì­ÄªL̹bÆAio%Œ«Á_‰âJð½ïbKë9Ð>öÍíææ5ûžÃ 節¬Š fþr +(0Ù곟Š!’ø›_ôg¦R3òo{ óç›!œßW8¡b *€ª›q"› ²iL4@3Õ³æZ"É `-”Ÿïžsç!à©,¯?:Y–}s«?UâÏŽ¸’%V{6—ïìM¢uoRÚÛ›”‡yiG®w15Ú “ÈeÀŒ’RÌ”7™qn3Ù $øIù»Á¬šžøìo€O“0XÖ)δÅíæ¥Šþ„lV5 endstream endobj 1750 0 obj << /Length 425 /Filter /FlateDecode >> stream xÚ’OoÜ Åïþq%`ƒ©Ò)Q»ë=%ÑÊ»fÓ•œuËÚÊ×/øOd’*.#xÀï½A¸_‚hI´f@“Ãk‡]÷BÆb}›ˆI—ya¶P~-“«"œ¼¤<.Ÿ*kòHs“f²0&§Û‡-[_?¤ÐíźP)z_Sih_5ésy—|+ßC‰ ü'Ú¬þÌ—!X(g>™3Žjä«Û~ߨ4\§ý¹w»útéÜîкں݋ív¿ëcålè®V9_š• ˜â膷ž8òQ†ÅR¦˜ô`“ÈǰžþyÇååFlÒþñ™“ÚÞΔ&oƒò•“:<ÖMòsrý —*¶yó}S®¿L¢@0ß™npÚ÷Ý©=ÿ˱FB/ ‹Ép4hÍû®`Ũ¾µ]š)à´ûeC!èë°µ÷Sb¨mÚ0 od?nVãN{ŒNx„ËÒLÒµRµ*Ï}Àb&Z}î>7:6$°` ‹ùö±uAE2å3†Ùæ” íªSsñ4J©a$kç¨BÛÿÒZÕL endstream endobj 1755 0 obj << /Length 3106 /Filter /FlateDecode >> stream xÚÕZÝsܶ÷_qy*/õ¡Ä¿Ü§:qbw<ž©-?Å•:B:6wä™äEñß],@NR"·Žftä\,ûñÛù*†?¾ÊÄ*Ë%Ëe¶ÚžÅ†Úݬèâýϸ·›ÙÈ—ÏþòC’¬xÌŠ¸à«‹ë9«‹jõSôÝ®<º[o¤”‘z±Þ(•D¯Ë¦Ú×Í Q«ººúê4ÔmC”öj½I’è_z»ÞðhXó¨_o„H¹ŠÒbýóÅߟ½º…JDÂ%¹7úÎ22X†bR¥Â-C¤,N-C1"¥"úd” Sm~Ní $“Yéñîêm¹§ÛSSÿºNeTvu9h¢Í×Ùã*–º‹W^0.ršóÕÄRä±LÒ‘%Ò|–†Tvî™îà‘Gº"Âu×誽êuç=«Ê¡d°9¢ˆ.vÚ±y 8öÿµD0×%þûbçì“m§QÅ^ +x|`/¤$>MÓ8zù…Þ)‰áta™\[íæ¾e²$U ”aÒ­•·ðB’›Õ‡6D­ã+Wf¹4ÙA—¨p;›ƒ8¤Þ¤1‹Sî8œšSwiöìr sÙëáòÜÜ\qç…{Ì`ÏŒF6RLƹUŠ çâŽR*–y‘9–;¤E5Ü2!1XPì+Ÿâ$®™FKQ*:vúØ™m¶ºïÑ–P7¸"ÈIIkrÒšº_kµ¡ðgÕÒš‚A’§ µÜ˜”yþº%Ã&Ѱӽ¦K³)æªì úXꉖˆC[úíËÃqoŸ’{I¡‘æAA$Ë@#+}4êÓMÕû\Pœifpœ,Âû¶Çˆ¨Z¬B)ßˬC±ô ‡íQÅHaé$( ÔDAGH–6^ÿ°.(|k@Øêô5„f«§â¬H1½- ²>¾ûøþòû7.Þ»ÆP{gë}KlÒx¾k"3rnfv¶Â³_&Ô8Èį¶®Âüf¬xÈN6nâBZåÙdE±kUP`s2Á L$üâÌ[ÍRÕ@„kܥޮçû,–‡lAÍÀó üØ|²HŠÁ}ÃÍç™ôwïx¡ÍO.Ë®Ð]ÿˆý«›!¼o~¤ò•ÍsÎø&ïÛ<á¡¡¸DþyÌ΢ˆY–¥Ò!VËsóO?Ç« B6a*[Ýš‘‡•d"CKد><û‡Å!Þl¢P,ç°’±ÍâÖ2i ž(AŽKð5°”,P2ÆÑç´c°“.$ù¼eÂW^µ§«½þÖ…ò”å€8ü¥_´R3gו˜E¾ørY°…Îdš?Xþ'yô暆5í\|¢íÊž‘€t.FÔérŠY½¶æ}c[GÍsgÿ ³—dö¹5{iÍ^fïÜ¥ EV¬÷fÉ÷Œcœ[õÚº$((ÀÊÿ>z÷ñíÛ[( Š)ѱP¯d#c(¶ÒEÈ<×&ÆCJ¥Õ”29á{'cæçY(`„åm¸‘Q05kd˜ÎYÙÜØ 36P“ñuµË uØ9c(ªøcì Âqæo‚á 2ìù#ã—ß°ùOW¢,߯P="+©øÿSõxì yf fúÇkÇs|ƒ5©Íà!Uñ¹ãÿvÛª6ù}L‹‰iù[°)ä1=ßJ/7Õ¸9¡:Àº¦uzÓ•¢Zà•cA˜ÒÓlð«?ŸLµ‹}óºv,¸ä¸˜GŽ™ºýÈ•‚ñøAÅjˆ=% *f@t3bíEP€mÎÇY›»^¥$(‘H3ðšä)^¥À–sÈ„Èʵd·N[PÀR\¿¬¬›Í$ø„+Ï l66ìË«z_D¸°ƒxtE;&áÖ ]—ýV7k¸m»Jwh4á݃2-ÉCví¯ "ÿäTSrôyqÈ;k^Dé˜ÉÉ\\¾^¬lߎ7Ú®š,\œŽG‡xl4ÔY,Ê‚íÉÁ_×¶±óè Ïêí-Ûí`eÚYç2²g;‹¬Ò[¸§ìûÓÁ!BéˆZ¨l°«C ‚õÊgp4ò*ãyU¾É¸<ç<ó€Ò98E=λ“8gÊ}þª=”a“å€Ñ¥îÅJ`€ sµC½5z~Ft,—c>ûÛ·0."s®ÄPô9ÏÏ.z¦!ÒK†§'sZDÈ·tcnxL•8PFE”¶x¨µ’òH‘£¶Í ìû¾6¥(’ŒEb CÛ^Æ•©ûZû•9$˜~4Díõdè|õ¯Ø ƒžù$uK;Ó:ˆ£Úòu2ŒMBÚüü26XáÁíN[}àüµ‰Yd༚òU(Š·m7:mKçP£ûIO_fµå_º34,¥As”üäš7à‹tÎ…yOŽü‡£E§x”"žÔÍ…¼…hY©$û_GèÒD¾PuM:?‡é‚ý!¬èo™Ï—ì°V Ç$Vˆ;)HÆË :³ƒÛ9:ƒÛYŸÑÇ>9ÐÔ ` QÇn{âqTV°$å†O’‡±Ï0QbuéüõìÖcŸBü1Ø1×kš'óÍD!m,ÓV in'gj>'!Þæ`÷©`Š- þ.ÀázçSôŠç0à@È(ŽV«˜>qRúÒPÝäýx´0·ÜeÍÇY0“ Ó¯DÊ=­A°‹ ¨ïÍ`‡ZvõÁYì*‹}ߺθH×háú!ÜA2 Ï|’1~`wn>Æ¡/Nhª^›g=t}dþ:+•t²Ï³ûL5:Fe{4ˆR$˜°_ñÀ⡬Ï彸’Êt½+×ön»à78ò¡opŒ¸Wuø«,€,›Ú5r›vÊ”wÀ*ö–?Å\ângÈá®Ô®œÁÖ •Š™˜j8‚T…¢Y`¡–X (#–Â/> –‚‹)›î¯Z;nŽ¥R‘‘-¶é]¨;°©Pd¨(޶cmMAdµ±ÒûÆm¢Ž-$ÌfdÃøk¡”( ú"†°ŸES9¡)Ѫh|mß·çb‰¦ÜGpbBSxC§~p1¶Bév–\ ³=e=™—[úõÑSà›¸sÓ> stream xÚµWKoÜ6¾ûWè(¥ÃáC${kѦM€¨½>¥¡Ý•m»’#iãøßgøV²Ùµ§ðÁ’8œÇ7ß<Š(–(͉æ*ÙìϨûÚÝ$þáüÏ3r9 æ3ÉßVgoßI™%†HV×sU«mò)U4˙ѺH/?^’ó_?f9ç<½ì«Î>‰ôï²É˜Nå.û¼úpöÇj²&™$Rðº6J?õ¯Hˆ‘’þ±‚P)¼u3dönzhÝÕ¶î‡îjSíï®új¸ºÅ׫m»/ëÆ:÷ö]Aç±24 Ì }§ê_*©“f.&lBÎÇ@¿LÞ#D8ט6Ö÷OŸi²Åà %B%÷NrŸpÂǧ]rqöOpasM^XDùûû‹Õù›ÃÁ ½sñ×ëÃP·M,% ‡b”þÙçrÛÖ»*¦1)Z$9püµoû:ªÜ¢I_®\Ñ Gñoûò[4G ¥˜"¦¬Í)R¨à§—½¨\é´´ÿLxà>µ×þ[é_-OÚ›®Üû×ûz¸õçëºéç7tZ}±Lw‡÷õv¸%Q$ C´2ÇØ&À^3M(:¤ÊfÕDQñ¦¥*ŽG’ÞÔ_mMVÞÏá¶ò¾ïZûõ>AÚ|¼a̶¤D¶Ìöáî;Þè|B×î­=à%÷î€ÁÿÞ 6„Û:ƒ´·ú=¦]ÕE›!¸·{È4OG—ÌA %gŒ¨—ÖºËWŒEÀˆTŨtëÔIQ`ųW:8á4 -ÿ‡BWjqÓ6ý¯sÆ å2ïK÷‡üˆì Õn$DM1å›ÿÌÇz–æùºW¨Z˜Háseùn ·)Jî“g« {öŶŽ­É;ëDNz7è§;žîJ4g¸ÆjÆŸMš,š2Ü{„ó1Ûv'ìÙmDÄ\ØGTA¸‚%۞ĜPX-zŠÁ’×Mœk¿êàƒ yÅ/_3ì‹åî^1³±„R…»*œjõ #ÇÕIbh ¯iõøûG2íTÙ&qº%ãšt§3ŠèqUu{lyÇ•2 ‚Žy4?"®lÇ(–ÑÌø³ä#TO? ~ŠŽ|óô^wíÞG2ªpËé¦]³m¶usØ„?€=ú-3O?—ÙèÖê%-¯ÈˆÜw*pÆn endstream endobj 1766 0 obj << /Length 3017 /Filter /FlateDecode >> stream xÚµÛŽã¶õ}¿Â蓌Y‰¤DiûÖ½4)Eš´I°ÐØœ±Yr$yv“þ|Ïá9ÔŦ1“MŠÆyHžû›¬bø—¬Œ\™\‰\™Õöð"v³ÝÊßþãEÂpÜÌ ÿ~ûâ¯oÓt•Ä¢ˆ‹du{??êv·ú>zµ/ƒíÖ¥T¤_®7Z§Ñ—e³««æfwU?tÕÝi¨Ú†fÚ»õ&M£Ÿìv½I¢aDýz#e–èÈ$ëoÿùâÍíˆT*S‘jõL <ôÈÐBéLz2d&âTZ¤€R&£W€£œ*÷sjO€™2itpŸõP=®3•]U–Væäõˆü9ËâÕ&)D"sºêvó$ºoëº]K}$VÁÔ¶¬ëž†{䡃”p¹Ìùò4›.‡•]EÌŒ;y4“Ñ—-nüˆì#Þd»ØW¨hðHtö—SÕÙƒmp}àËÛ{ú=–ÝPmOuÙ!aŽ%’4!Jlc»’Å Ð;ì[dízB¯âóšv ‰’'NMõˉQ(ø¾íÆE 4š,¹Ìä}ÝvÖQøè($ÚtÔç€펥ÅíÐ.i¸$A+}FΔ¥A?TuMÃS³C•ÇáÎÒùu{t<Ì£°3ÚœäÎgk†›»?5[R˜å%%ýü'ºëž{8òÇІ$1*‹BÑ:®#ÆÕp*Ѻà"á¶ZÃ^#LRÐÞw-ˆØ"Ž ÿ=ÀÃ(úöÀs¨ 8ƒí-A/J`•íz‚ù/MÜ ÜÄCEláOgç@dmû¾þu¶ÇD‡êaïT![bbWîª-Ï -ß‚Öv(|-‹èí:×Ët3Ò5ã‰ýT޵E—”ÆÑ{GRhÉ€ ˆUdRV•yS 2Êî¡jÊš¾¼®ÑE;ƒ}sƒž/ÉÎMfkªdàô´ìv›L«ßpƒNr4ŒŽH8ã°Ãa‡§Ô4±°“Ô™Åâô+1ÓÆr ºÁ{¶lhÙQ‚S££i¶¼• {0$BÌDU3¡si[t,ª$ùg‚î›æÝ¨ê–íx~+ÎJ æÐwCßídNÛU ô)WÑ¥~KÂâ?¸Š§0©¡è8ƒa¿aüÚÀ+Þ¢cu^æÈ,pD&¸…„á„™&»ËîN½=ßåèNä‰É’@¯3­¢oj[ö6 ÖDNgËsÞÈ·]uœ…×û„ó´ömo GËãóŒ/»ûSý_oýáÆœkWl£ƒuôsååì1òñ í'ÐÔþ%ÌLÏæ¦±,–^ê‡8ŽCÁ5IE–§ y”{Æ«dðl®µFyðÆ~ )c‘'¹ª´Ô­S¢ÉˆÕè®*÷Ãéêm8b£´Ð_Dì¿ùǘ ‘‰Bþ.F|ÉAj6jXB¦>9dpæØµwå]UWâû+MîlÓã„ñ¬SÊÕœ’IiüÍë·7!.Ë ò)H´™ãî>ˆ±Ižx 8/9Ã×é/0pt¥”æ i¤ÂÙŽÌa0œûTvIxHBPI€ÝÆãµ»‚½”8œcIkozf£©ùÈ\Ћ¨–#ë%aæ"‹¥ÄEGJõƒ—zìâlŒ3r€ðÑ@”)kŒ:7Œ¬°âÆ;lV7O[ÊO:š¶iìCé}23`Áí­œÑøÈù˜JD¬s¢]=—ô«âÉ  È<™cÏd»ØïÍÑvl£Þ@/¼ç’ 0äÅcµ£Cï5Ë>h ú§&û]¦ ‚Î@űHóüxkñqzæ p‰ƒRÕí¸,ǦÍPÜAô¥ç@¨¹:¨‰uø…öG_óP—¥F}È+ÜRPÇejá8œi #N–&™k8oâ…çJ nꑇ+ë»é®ÂðÜaf+Ïs8Ò€’$£’쮓®cqîtØv ‘Åg¡Âç¼ê"…ÆclÏ´=H³žÖ2v¾ìÞÇ[Êà nC.ÔèšÌÊ97ôçéñ{‹î¿È#)LÀÇ/† èÁr )Î Þô%ZAFcfæévëx`vªÓ³xgˆP0*¸mëÓ¿ÙÏrµïIyp yÜ?hfD¶@ô±­Ÿiî`1‹)W‡Õ AzQOeÛýfÉCíõmˆî\˜|ô ‡vg¯zûñ(HÐ ™ŒœqÕÉ“G]š<ÕWÀ—·]aBœnâæTÜWA' ¹±öÐ[Û`ó-¤€Á%e'ó2Ñ:úŠëWè,FfÝÝ—2·h\Dî¶–+¡ÝO.öÎÈZm øjm–¾znµ*Ɉû‰/Æa°è8%½Zç¬xƒ»áÊŠ!8Ù¨G \>vXTcZ/¨FvÔÃ2e)¼‘r#(t{k¾¢ì'œ.kÞš8°-¯Vc¥·Ö·9jN+ÊnøË5—»ÖŸju>3P2¹¦qi*L1ÆœmûXNæ"Scó%<Ë%<Œ%‘ÆW¹ÁYof(^l5ôa‡±2=ÂvßÖ¶ÿù×`°,„šlåºWˆ§Ô«jŸÎÏ¸ÝØ[BÔ¸µý•´ ]ýÙ¾À«NȘyjÙ•ÍÏÛ¶ G§óJÀÖ3õÅJ}ŸÖ¼ü‘)>‡º×ÖëþGL5Cšƒ]UäØˆ KZ§£¤ÏzÅAƒ\d‘|nâxÓÈË<“qø¡ {ƒü 1½ƒ!S¡™ko×v–}ºhÒ¨³÷¶³hH#sQ¤©äWØœì:¿{÷Ý·^õþöÛ/Öø'ºÛG»ý0ö:²xY#BF)çù‚çA±`°ZMFBI3·À Ø™eS"[BwBLÏ/Ò÷s®o$¾ääÅ2BŒ -] F+×Äq߈»k”c´¢Ä§ÝcS†MMÐ;ƒvÏ*&Ф•y[Ç`[‡ò¼. Ù%« „yqÁ‚3o ,KFrm¸–Ôirõª«Z9€1Êí='oÔöqºdζ=Ptk/®3I]GUx· øDâÞG`<{q@ÈF,ý!+HRç…‚™Ûp«#ƒH)CLøÃ/õWñnoô}E-¼¼% ×]œˆ£î†,áÇ ìcKíýs–keù'\ñ ÚŒ_?°¥_˜q*ÃEoÉ‹%­-ÃÏTè¦#‡jâ  Cè£mj.í¡Fþ¥XP–\7(m¸ƒ3=ÿÒüYpÔ”ÄãJG¾fšâ^Hò||!qp¬Zê²aJ—áDÅ"MGÜ;¶>\i–nü¶Íý¾=Õ»+ýNoZî Í{¶ÞŸŽăï¥ù§>f|"ÄêÔ\}Òí&Z$F-ï›ãîÑ×q<ï,}ÚõVÍv¹½>Œuü™ 4@þ·;@tñþqü—ñÅ[æ(Á]¹±{ïþþÇxµƒEÐD)öGyX)n}׫÷/þÅoûÅ2…ËEªP'Œ(|ŸŸcJÀ×klרPÐ ‘bR™´‡¾ñMZ˜5gº¦3<45+Rƒ8þ™IZ@6W¬ -rÉw¾ýîÝ«ÛÀ¥Þ$Eú'\*cQrqé«¿yæl‰£o^¿¥ÕkÅ,_]2Øh&}hLzVx亘š¢­ãè–^·á’Yk ®žuxeqû|JÎèû Gú5™I™øåd*h&üˆÊ7Œˆ'Oò)t"dÇ“ªLœ•8%˨pŽƒ7%?Nì¸è^á" 9êöu]IMO²j#A•ϬڧÈåñصÇñALE}õÛ¬9eø–rQ ÷åaÚÆlvQfΚW>¾\)žd–ƒ¡h·H—ÏjDÎMß3Ç.,ºŽÿ‘° endstream endobj 1771 0 obj << /Length 3028 /Filter /FlateDecode >> stream xÚµZÛrã¸}Ÿ¯Ð£hŠO2øñ‰c%³ÒLwo2WÛÜN¨ðé§7Ü÷›AÇYÔóÏó7ú¨õ„g¬È >™ßÄSÍ—“ߦFœÌDam>½º¸bŸÎ.NfRÊéÕ®j°¤¦-·'ÂN÷åæä÷ù_Þ|˜w«i¡™VòHÑBïä³9ãæ9Ë´"Ï[ňéz‡O>ÝÖ¾b[-ªÝ®l¾Òk»*[êÑ®*ªº]? ôÕ–^yÿ‘:ÐT0CÝÜ•›õªå)TXh`;™é< s@•S@ o|zÛ€HˆªZ†9üªŸA•°ÕrœFÓ‹êa†š-̸d\sÚTÕÀÿd¦¸¤Õ°àä­7û;÷.¤›ëGÝ~°×NÉÕt2àË}s§0ÐLÖK—&„_©C‰’Áäñˆ"c*— °t¿Ý7×Ëõ®m®ÕâzWµ×÷Ë›‡zãÎoFÓfiŠE¹Ù°N †&:ØBÒiA“Pq»0Ó•úÿ »ØTÔÒÖô\à.Våö¶¢¡tZ…S £ª¿maPÔHm´¢œÂf|…_é¥ÑyBƒÓ?Sóج۶ÚÂ:¹Óù fKœp¹ÙÕäM«z³Ü‘;=®œ-Ê 6õ-ÉÍN.¨ëìÖPJMϨy[=R»;õç}»®ýtõg4Û鿪Eë-ý\Ne0¸ßTîwÎ|¡´ÞîÚª\²Þ8+´î4¹rî8ç5ÆÒ¾Ö[XÜ9iK0 š)Ïb»à–3^¨`TÿÌtæ,ânŠ %B'@¤OtþÝ! ˜1ù$W’e¶@ùí÷l²„F8¦ÌäÑõ¼›H& šñfrùæïlŠ¡¥+f¹€©³mÞŸ_Î?½õ{h=éGØŠÑLrzŸ: ïà,×C;Io“k ]ä$+¤ý–mr]0šÂ©L&iÕ_?^]¼›'Ô›&ùë Ðâj¸î»_?¼Kk&×½vØ"ÏòÈŒx…8‰ÍøPÑ—èìÂÚ/쀽ÁZãü[cb€ýr]Q'ª©oF]m°jNUÐæðõ>8Ûpú7ÖÜì· ò]¬¿svç¥û줫RÐ,UÁ¬è¶ï<}ØM‡>µ¬÷Ÿ7ÙZè#ñÛ¦Úí7í) [ÔÛ]Kààºê·_|;ZæµóêôÖÙü!¥ Å]„ï,p“#à5UÊ?dÁ¤â¡7É•šVpô^Wn—©Ég†w¾¤æb®lèÒ«\Ú¬S¹{[‡£ š‡W«bàË Ú…ž– FÝÅÓ.?6Ýß7õ}³.ÛŠvÀ<¨ ¸‡’ÂPÞΠyWÞ…’¢¦åŽj"Žƒ¯ÎŒñ R¬ÒV$3¦õÁA&åSaØ`çÚÑ ípN^ µî}jr·'l¡¸ô Æ=xîÚºq,kéë·£ Ú’ØKÊ´à²/PK£»~cÁ{ÏÄw«zìcI¯MÕî/U¹õn’äÐͪ¦©›àc –Uˆ¶äJ‹rçkœ^àYú–h,»+Ü¡5¡ Žy§÷¤œ,/LG¯/¯Þ½ûpy™RˆLö|¯u7ë]ÅBÈ*ž{ÞæO´¥ø€_Ãk¤Ñ.l  ïl©ç¹3ß0f»èÜhîøt¥Xlwí@ÛЉñÓ\W¿ò…¡ÌÀÙº.›°DLx0~IWÉ;qvòùg ÂXŽbҘ榉±VžÏdž* ¥@…s¨0TÒCa„¹G¾‹îÙ2T†éc¶Œ ŸQWbËÐ>¦jO¶à¹3X ÃŸg)4/¼ü( }˜Cä_GPhù…6p»¸§± Âæ7p<™qÇÂU.`{ÅQZ~#…—ê¼ó(­ Â}S壣ÐïÓZ‹â{¬‹ZÃa°îóZ…4$ TÒŠ#H´a¶ã ãÐÀÓh…äHCµ·°µlÚ5¦J”†ËjÕ€ƒbÈl½£î¨—ƒ,íi0à[Ïíð-\{AešeYg`1yM+ëhvGœeDœUOœ;b¾¨ëÆ¥– uȦåKlh…01™æö2m˜•öYþK×¹§ô—ëÖà¥ÄGê|±Ö!ë.x»A®HÑXƒc×[ÒTÞ¾ø¸Zaê¼ÑlÕ€3æÞMH!ÓÝøx6È-ê»û}[-=±–](=¤ƒu»^TaѲMé@ƒ…B|x½"SGàrÛ‘jg¤·•WÄMSßÑÄœK7³ìFçW sÿ7µºfª¿'fày9Ç[‚bÑ?¸ÓÓåúnÆ“ë¸ÀÓ!ìÿ^\&°F¡ÈŸÐF¡ g øtœ .;cÚˆmîîϘ6ºú•/t–€<ÅeêänŸñ¨_ÀS)Ñ/D&‡³ÒÇñ2œ8ˆê(¥“Ý?=¥Œ)m2J+Ÿ±~Â(s¥ÑQBïÀ(MÇ( É{™>Ô¦6ŒÄÄ£:’i|JÖè!ÉYΨڃĘRþÑí÷`—.Ð8nrML!I5o)ŸN²å .ůJÖRHLp?Ý{sßz“—€cþŒö‰áaã|ØzŒOY`Ïßc• Ç<‚Ý ˜à¹C(ÐÌÆXqnOxyQDg±@º”ˆyœk¦û jœ÷Ñá1«ÂΚȾ–Ý ¶½‚pËÆLÏÝ…_õ'£4ØUÓT;Ÿ“ÛBØ»¥>q.À;)<éÛB‚ân¥èëëMIâª*•:tp®1ZÄ”™çƒB0©†–ôì™*SñÓ>"§ò5:N}_\ýüó¼UäH sþKœæ†^m«C¸‘YwŸx ¿…óóyÁ²\}GèЇ¡C –=IÅþhè&ç/,PHÜ‚,¥`Ó:;Æò(ac)ê &£”̨%™é,˜áù«Ð¥ˆ\­È2¿:¸w±Š%qéìûÃ_&ðêà.ª…u÷ ø–4þXApñ &^i3BÅ_•ØäºÏ,9¤ñî†Ä°·óª ³‹ðÁù¶øÕÝ‹p(p(¦ì‡HQćöºrØè£ÀF6Í6$Ï0›Æ)8Ü<äÃX’™ê¡Ü¤(YƲ¨J†‰3$’Ǿ/É»L”e¬ît JeœÉ T X¥Ì7}NÅ”~1épW/¤ÚàÄ$Ä2; Ý??™oöt1U&$î¿@P™²ú&€cÊø!ÖêþÓà‹Æ™±ÎUÒ·OS™çó#zøU(1 0!.^úÆ( ž¸¹Â~û+ŽÊ]’êž~ˆÆFG;¡µ¤×±*ʧtºÌ)Ÿâ¡KðŒ¬žMøè(‹"dM Ô'Zòh)ÛÅŽ”h qwxƉ–¢ðË)bŽ4̨×&Z8î |]qéWrö‚¸µƒ¥.J½5L‡¤µû» %=m@àtöDõ† ïom>·4N–T‘,SyêR%ÚN•X÷·‰ãÍßô©†Èæ`¢ÃÚFBj;ô¼Á9áŸt$?"6ØÞƱÁ}Pµ^u°&($‰<ÔÇ\­ÿL’{sΛs‚Ý+žÓQbá@Tµ˜­TŒ7¦ôV] ¯¶çÏ/ÎçÿH~gµ¬èÿå(ß”éßyyôÿ†áBã…øOÕ4Û:µLÎãã ËÐç=žûÿ1> stream xÚíZÝsÛ6Ï_¡{£o"”ø"ˆ¾¥ùè¥Óñ´‰Ó™›4ãaDÊæU"}•4½¹ÿýviP–b'íà Ðb±Ø°K1üÑ…b •r’rµXmŦ·¹ZØÆ«ïQ7o —ÞÌï.}óBʉŽ5]\¬}Rùâmôô:»i‹ælÉ9Ä·gK!dô¬Ê7eue{ór×6åû}[Ö•í©ßŸ-¥ŒþU¬Î–4jÏh´;[2–P)~öîâ‡GÏ/z¦$“D ~äºÙ··‘,(%ZJÖmƒ%$–Ân£¬Ú3üm´¯öÍ¥áørõ¡X]²Íe~“¯‘­o^$±/ š*",lhüËØÎ’ÚŸ%†Ü¤¼Þ¿ßwÔF<‰˜$qÒMlŠÝ~Ó†èqE™vó[‘®êj׆¨rIeÓåÍ^Q— ©G¦,–¦‰X,)'TR;öæüÍ«î°þÝŸ•¦ÀqáTž¢üß¾‹9 þ°ˆQ\ÍÌ킦P.›ÅëG?»C±B¥&4Õ@ŠA·«>{ùúâUX~œp.úúZ8;% §‰wvÔIc¤îKª)I`»s;ùù‡3™DÙfŸµHŸÅQ{ ª£«&ËË¢:c)¨µé©×ö¿szöâöHà ¨DB×ì~Æœ‚¬8ïÏ9 jîAõ’!jÐ-‚æGÝîœNšv¹³ÛÙµuS䮯ò÷ «nV‡˜b$eéX‡²¦ÉPXŸBì²”$Š bÄ3²’ÊgZé軺½Zø‡ø¢<¢½~€C rHAèê @¡ ;ï¦lq³ûÊü$¸Aø,ìÇ |¨¨.­òèÑ­ µµá¤iÚ½àvöÛ(ÌÍnnšú¦)­jÂÀ®üõÐ?•¤pò©×öXÀV ÓÓ¶ne—mMKtt /ÛÙž«òrP8§n¸Äÿ½:'#9€{Sƒc™úÙªø”˜¾½Q¯²ÍM•8•BÞÃM€cq¼Ÿ×m¹BV%ˆñ:l2%‚ŠLKÉРUíÃYšu!¦ÅRðнú¿ùñÇN§}cH÷šÑÀ JšF/×ÝbnÕUÝ€>;=ªr€¡½¯V.øÂ—1\ǹ•"¬Fc=1L\ ühZ¹É¬ÚAϺFú3N+„:Z°’¤Bû‘Œi05»TÑ4v1ܘ‘@®'ãm÷ ç¦2þ:+¨žqò‘êõªñ”Ä>OÝR»¢µ¶­ ¨¿m Œ—Ï_½ºtÁPBÊä(„˜(vùìÉÅ“ y ®`G9²dÐ8³!°ÒM±n­ï«mmT&/©(òÞÀ¦ i Z‚ 2pÌ”ûâzº™ƒO€KˆTÉIûœÅ9,¤HNÄ9j‚¢ÐÄ@·ƒôGèbU×M0"pˆ)›Â§#ÔIðIj~ò!ÐR#½û³Ð Â'N»pC£›¬iËlc?ò¢)íÔÖEÛoBÿ+‹¨x< Ek@ÎZËܾŒzQñ³ÏJ{c¶Ôç~e­ô©¬P"!¯ªIœèA÷l<èp:¸ [ “ÄÈ!ͱ.|ŠyñNQˆ¦o¨ì 0ê&¡i‚×6{{h>Í"ÅŽ‡? eqŒ °€‘0JÝÿΊç[äâý’Zä=>rOëÓѽ™íÞBB¡`ˆGƒîÃŽÌcÔBh1tqF~YYíº±ÂY¶W-*¬mƒE¯ËŽ]O~0„~ì¾Îv¶;ºC´Ûç°ï„÷_xÆš[ØÏà-ƒýfðD@u¤C¼ü¸§sªÞKq€4«ŸÚvÕ½B¬›zk cŒBÊÜ ‘êÇÕÿ„ï?Bô 5†°ƒäý£ ÂÇy¹]Òà:Æ…÷1à¿w.Ó¡Y…H<ù?šý*hVÐÄ™4æÐ,'±Ÿ‹fòRDéd_ž¿xyþòâŸ!‚ Ôupå¸SäQ¯…¼ø5yÄþ!ÒÝx©<Ý2ñÙ„¯ðEc¶bå/`’â/Š`ø0äÅ‹CJ§ak ?µ Q”>gî€ÿËM}5÷r§98puô 6`z!lú>€ÇŠpÀ|HIÈã? œú`S·p)l0f# p–_³–"%»E_¼9zXU[5¾ÿª N‰q6^õé/ϟνÄzóZd^buõ–Áµ‰ 96‰ƒŠ›Ï¯Éâ˜ÄŒŸôè<§¹š$ !ÜY°³,IÑîMý˪.Eõ)W*Á4èÀƒ¼H#©¸{‘þeF{Ú³R±.áaˆ­{¤úÐ%8ÍåÝú wß4æ#7qP}oê/Ü=ÂïJJ!b@ˆ"qšÞO{5Ñ4R@Rò¯¢½ø OÒÞ˜Áa©Ñ^ ¥Àí®÷YX{%Ó±.j¯ÄÀæ¯{X{{¥<¤J2&@únõ…”zKØ—fï—–“ 2_ ÏV|‰ç+ÃÝ øÒ‚ßz£QwЇ2P0Î/G‰ç©ãçæ_G@*&i2É.} ùèy@*p M‡ ØQü°TäçgwÍ…9ìxÂlPo(‡¦ü>@0A(Üh9Oˆ†+Òp) ù“•ýÈ`öçäÿùç¿‹Ûx…IÍO¸(0 w]pº®”Ðê+=`O¡;@>™Gd<¨ (Ë¿ù»—˜Ù¤ÿ̤Vâ¤üŒÃȆ?ˆÎ%¼9þUJFžT¨D½wÙ7|úuYt—àCÎ&fMÙ^o]±ÔÚNìÇó¢Ú•m÷fŽ$öÕl-U ­ºšIß¡æ'¼Ÿl‹¬ ×=¡tÅ x¦c¢TŠ–šÜejaÞ±L–‡³ûýaÿ95WÎ*À)llsrÆPß­p ÈPL’l¯Íó]Ì-mÓ%à{Ý5ìð³løBj“.¡dWaYÉ“ÞCÓƒ™(Ì ¡lÃäýX`¢·_¬‘÷þ¡?2ûïv {MÎ'9qx‰'üD3Ãÿ&[xð4ŸÆ|Lô bòüá’i}¼.š eÐWF=©I‚ͲdôÌRç3XÊðWèðUû‡7b|ïWXÓX`v1 ¤± ²ŸÙ\ÌÉDÁj"¦¢'Aê)¦DîÌH¢5ËØ ª†ÂœÄðž>§>K'¦éÄ@ºB—ò/š,%)º‚TÓÈý‚§ÞC‹è¢qÅN¾Máˆq…4”8â6qD£Ç±_`¡|N'™µ—['¦Í¬<¾ Úø»á¹ÇäQ’®$119õl[Àwv v2;<©Î…“?óiÄè¼É«'çö›ò}“5ŸÆÔvÀbž5yGÔÖôÒhiÝžãqœZí–EÆtjd·+Šiý/†t¼ÙQ/*¶õ¿D˜ÑB~ Ç=~Ep÷û¥G PØ<]fRÝ ü)ü§£·¯‡­B¯/¿Ý»Ç˜3‘ ó«Â³XO7ĸ@mþ†æ š»Ùw°?%:D ÃFÖ–{›%Ϊ«"w¼Â!WvRUê°»ÕQÙîÜÍB´VÓˆ5Td ˆ• %2q‰gÛ³Í6å™Ë>C— —YW‹³ W8´·ŠžÛ$ó2¥4úÉÔdF‰ºY;×p«`.lg &Ø×ˆ˜µ À VjÙô”ïòB‰+/ÄY<´¿É/·u^Q¥8““cÔGS¼…ôáÊð¡ÞW˜ºV‡ócL'øÏ‚ñF÷ƒÐ[Î,Á‡âÁ“©‡Ëä œJ¬gw‚"tú $6RÛïM_’tžM9x„]#W#Ö³Íæ†)‚<-?/9Œ9oˆ^N;é2¼;û‘ÙÒø)­ÁIî—~1·…YLƒW*Äô¡åPCl! F–¸¬=ëå‰-_ž8Å`è75fjÖüfæävBæ&üVÕØýÑÑ™©ÀaL‘4G  ¬½œG°BÇ™‡š¼T…ëIA›Ù`Œ‡³ëK¸C\JÇÙ‡(lY)óe¥Þ¥/+µ™ôïŸ_̳TO=E:>w!ˆ`ÜÁ 6À I-Ú˜AXZÑïûYÂ0 &b¸+˸Ť&bÀ]0)ן&Wa_ŸÍ8kíÀu½É§¨Ì™ò•ý­ ¾ÿëßù endstream endobj 1800 0 obj << /Length 3345 /Filter /FlateDecode >> stream xÚÍZÝoÜ6Ï_±ò¡ËŠ_"uo¹ÞµHÑæîç©- yW¶…ìJ®¤uâþõ7Ã!%J+Ûk»¼"5"‡Ãùü‘|•Â_±2V2+Íj³“ºÞözE~xÃ=Ý×å?Îß|û½Ö+ž²<Íùêü*ê|»ú%1êl-rk³äÓûOìÃÛ÷gk)eò©+[|RÉÏE}&lr(vg¿ÿøæ_çÃlZh¦•<‘µ@}Ì_¶âœåZ‹ÀŸÈXªñWÕý~›êC{±­º¾½ØÜ•›‹®ì/6Í]Ñ"[ß~Ÿ¥ñ*¹5L˜ØñkªS¢ÒyL¥˜†<,ÿCXáïÛ"7À ñ$lŽLÿò[ºÚÂËW)ÎñÅQîW’ ƒƒíVßüׯl2›L9KaˆÉòþùîãù‡¿ù%L¡$ƒܹ…W—‡¾jꥥÍ$ü m⦩»~il©™àb»9\îJÇÄ ¿c\Ú՚ïæDñ œ%gÒŠHÎÜ37ѹuBÂI´KØWiÉ3a’»3%E[õ¦¤þ} þŠÏ*¹jZßéTq×W}_.‰÷Ÿkñˆô& jͬ²š-˜3n äÙ"Ï: r™(rf¤ äÄu×Ób.ÁàLRR£ uÝBŸMšÊ™Z_úÕö'ª©]´m÷Ôl®hË„…Äë·¬«þ’É&œÁã¨(Ûj¿È>hj–¢¯Kãä,Sê‰a8l¨¨”™H¾Ü”í"gÒ2cô)œ ûPu0&(BƒâÔ¿*ëwÙõ·ehërK­K’ÝÂÔ\ –«‰<Í58™‡—J–æ£Î¬5—Éy`¤uòÅóv v«§;EÌËHãÁëÞ¤aðÏ¿uÊ cõF×7­[ž·örs@ÛÀ¯v÷DRÕþû'-«‘•ËÊž‡S–Ÿªî–e¹9Vwa¬ã×-þäk_OF÷iƒ8ðè~QV üŠÔ²Ü<ÏÜóH/Á³'+a•È’Ês¾GÇ´¼Žî~¿/aŽ_V½õ¦˜K¦¹x:oÛ]v­—'Ûò×”«ºê©‰C¸‡ªÇm2VQ\75„]×]’kh«²£ jijÖÖ+tOåˆ=(;üH€ièÝß:Ejj?²ŸõˆºÎgN-"Å¥Õl@ãÙñhï±5È ¸'›ÕR‰ôX*°“² $ÿî¦Ù•Ýç{j]8}ŠzŒ}XáGõÇÊà ‘æB»l¥Îx°Ÿ¦j««û¥Ñš•J¼h:lü»;óF§ä¸se]v}Æ·­PßP‡L–¼oújãGëo`„¢ ßK¾Þ3ÔùN'ý˜êÚK§¦©ië¼½ÄH÷ƒw“õÑòŠCßQµ)vÁ9Œ"DÇ®¹öN£§r é/Q÷ôÜ5{ïŒÚ,®vV¤ô(ç{ÜòeXX˜äÒÁJç»ád¡Ep\š;‘™‰Èàõ°l$è¨ïyO9 µœ„ßM¾¡¡yrS]ßøwMÛ–;Ç‹té[—vLè†Ó¡á¥)è+iüÒ PŠŠÃÎàçhcØÔ ËÕŽ^¾"EÙß4Î"¶õÈð e_µeèvÚ£é¾ÞuÝøi†@CWnãÌšäm&÷¿;H8êbôNHïíLƒt6÷:›“šû¾%Ÿ.•t4G^©sðØ»…¥’—ÀWË¡û2ä=ð\,æ5Z!ZˆáÓjᢪïsÔ0À4ñSaƒ ¢øv1àÌò!9yÿé§ŸƒeuP¨2?0LxâœVL¦ò9Y(”v“d mÚO…®¤…-»…,‰ t¡ ë-·Ú–ÎèzÐe¿C¦R;‘#‡-ÏôT\ï Ú€5m_Ôý߈Éf”ݹSsébˆ{÷Ô ÝÅ%j´ï«ñ—{O„=Ss.ë„X íjnúuÆ‚ƒ‘á@nõØ»T›¸ñÇõCaKœOôæÝÌö޳ʄ؎: 6e {¾÷Yw©@Ñ·Ãä%'ß5—}’;oBý @¤V4(ò½¸Wé³7)c<lì›< ~Ufä ¤¦‚ÚeÛ: žKvÁÜèà› Š ’ÅNCù ž£ìR該g´ÁøPg4À®ÚzÖ—b)ôÓSþྮéóÁhZ2PpP:di6¯—Iùp´Ì‡%ø å†xýó »l¢ æj¤Íe|ÙBÿàG£Ñi©h¥ œ2"Ùíg7‘ï/|ÿ¡þ\;6¾ÔÀ“gïíB_qW5‡n‚Ù‡p¾$È()ŒAÆ €eêÙ5õuÐÜb\qµÃ T×<¡ºÎ¢î:‡±¬¿†åzðŸïP[³t”ömÑà: ´Ñ‹ÆôzRV¸Wm³Ÿ1¢hл«.Û]W<¤&õ¶h·Ã kïGˆ¹iFæCŽr묨+Ë9ÇuÎ,”ÅJB “Ö!qLÃ;W¡¢!$7퉱¹ðý:`;œOãXü%·üüÉ“_>Žk„ÞXpÝoßP†q[\—ôZ¤ù|AÒ€í+=YÐÃÐb ~‚ýù #fåØ(Ú’¸§@Q€Jn¿²¡šˆê²‚FK„Xªù²/uõçdïö£P Íµ+_Xá{öàŠþð¾»bç5˜¨Wøê@¾-zç@,çÉÀXweáÊ”@Õù? b ›(Åù ·é–ÒÏzåR)Zgx»„(É:Ün/öͶ\„Kà1b¾b>ÊâKµ~(‰Ãño·WwÍnqeáÙÌQ<;m˜J‡,ㆻ⢷P†¥#*8¶É»üXGMt½ð(ÉÀ à!}*7è`?SJË«‘ÌÆÄy49CÙ‡šp›7[Ž @0:ÜÌûŒÇÔ†dfú¼va št¨p5nSÇÁ¾Ü6c]¨p@_)=+¶PÛ“S/‹i¡;oplÜë„^sŸ‡›nOûÇô} D .˜6Ù)ˆ¿xñ—À­‘Ú²Ô¼ ð‡LŸç F2ÌJ}à¯þÀ-…d©œy¨ü;‘?*^žf,Ëó'~R¥Ì‘~žè¨zº_ʹõrJ†ýÏî<Àužx ”õà/!RÃôèÍŽ’Ó©J)‘‚ˆ•”à2ûRBAÎÝPZªiY¾ä-ŒÈY‡‡DS»ü<ò5–£äÖ ñÏ33ËMÐ5¤–\þF§)A¶øûÐA„µÌ(ñÜIËHôÀAëÆ“"¸|ä Â8~grRn¤!qOíä šÑADj;ˆy ^vA¡ZflˆÔéx‘,{{»=s€kxÓù3ð7HAU&^íॄÚ2@;ŸL@óöÐÐta²åÁÃ`ŽÔ,'n›L!#´ kÈ&,lË«.]@ä™*“ö”mKÓ)d +$hV æLÖWËòˆÑáa¡"ô‡jFpõ&ãÓû™à ÁA£k³€ùû *ª+Íb…ýƒýëŒÎдÇÇðÁHåj„­ŸÏSŸ‘+J;zïq#›|©]I*g 5:>O˜ƒÏ!#é!#õ(dêšS@ϧj@H³3qTâ¬[Úæ² Œ(lðŸ–Ê=—{‘mÇg{@eKgÇ@Å‚%à™~æ:E¾°N1©u±ém­ºÆuЉ‰¬\JË!›åÊžê,gÕ ç5^ÁÒrq$iô)YtnÌÔ+„#r<jl‚ ÷ÅT%Ôî“0hšÏ€ã±Ô?[=µ¶¦ÚЕz“ºo^j_?v¯N@¾ Æ"õ¤‹u¥"ªÒq5~1VÇè aÓ|V²UnS§eqT§ÎÄ#4ãršöánÂ’ˆ2!™zñbiU½ýëEÄ_¨CÂ5È„ú3ЫÜÝ·Ò ½Î'€‘ƒ#Í¡Àü)°f-29ϡЗH~¢`CϪíè$\.{…M%ü}³£ œÔúÅ·¤¤ÒþvL1^ÏÁÉézާ ¾ègw7<©§ÃQ`twÍÕke„«Z¶scÁ!ÌjÚ«C½ñ2xís,˜.q|ÂÏB… Sã‰üÇ1€Mº$’=|“rE-O¹JiÄ“W)óg!î¶¡Æ»'Ï.ÞÍx1ÒiP Kõý¾n÷võ?Có·“ endstream endobj 1809 0 obj << /Length 3297 /Filter /FlateDecode >> stream xÚÕZK“Û6¾ûW(§¥R–x`nÞ$›8åuÕŽ'µ‡$5EKœîH䄤ìxýv£¾„yÈÎnUJ 4¯¿n¯Røñ•+c%³Ò¬¶‡©kmoVT¸øþ÷ý6Ðq3éù·Ëý»Ö+ž²<Íùêòz:ÔånõsòÍmqß—íz#¥LÔ×ëR:ù¡¨wûª¾¡Ö]ÕõmõîØWMM-Í»õFëäßåv½áI¿æI·Þ‘q•½þõòÇß]Bi¡™Vò™+½ŸX†Í70¦ÈXª-eÛÔ]¹1߯…MÊýG–‹¤B¡9ˆy[uÔR´m]>®­J,YÚäÕuèUR¡-;–]_â wÔt(@¿S9ŒU7}xÙÞ­…IJß¹ðî@;uƒo>Ôã #XR6]’49Ksjp«yóÓë×¾Ûlå°b™šÐëôn“ÖÜGøÇj£RÍT Úä’qÍ©«“6¯-ûc[;1¥J`§c˜Œ)«Ã,ÇúØ^•m ëˆH”¹bè¦éÊžfè›ØŠ3èþôÓ›Ÿ.®¾»¸¸úöÕÛË‹«ï¿»ŒMÄSÉÆ‰˜ïb§]@œYn`é`ÐÙu}u¸_kž4m_Ôý×±¡5ØÓ¨ÕoƒÈf6½aJ :ÁɘƒæÛŸ]uý‘´Bæ…ÑII·EO/n›ý®›uV`ÙØõýZg𿪨·¾ ò‹¨"rÁrÅIÞ.P %jTJ3™‰ úemË$t¦ÚÎ76×g‰èGòëÚ6‡ûc,°òCUý´—ò' UµoËbçØõM[îØhRœåZ ·d3-5ØgFx|«j@…lØAÙÕö}¹½û¼j‹únÛ´-–¥³s–ÂA Êø%Õ©Ÿ2Ÿ©Œ %¦FÀï·Ñ$×ÌZ¾Ê@:™ ijŸMW;xùã*eʬ>¸ž‡•dÂàŒûÕÛÿô 7›M‚qåܺ¡¸ö t'æK¿‚™>”œ±ŠG–b`÷ùp¾ ;Uw}ll²Œ°ŸÄìšã»}ù%)ü1åòV.¦êå1‹„ÁÁz3ég¡Îo°€%㜡ÜÞ7ét48èÛö!`¹hEý—Ž^Lþåæv×k„*К{ô%àèТû2¦50T–[óˆ’ç0¶ ìÁf#Z¦Ôàp‰(ɨDž‚džƒÕäóm áaã6ŠçÉ;A%U xˆ4!4t´ûÇ—€ÔÔ©öÏ£°ŠgÿÜUÿ‰:0n ã"uqˆú/îìÆwú=:P †ËŸИ[>±W¥xòá¶l£²)Rœ%ÂSÊ­Wü«¬;gg¨r£`2!®º"lD;k>yJ7€G-uá÷`©*à³JZ‡¼º)0«ÑÑLø¶ Æóàñ»¡ç`$#Æ\?%Uäü4Ô'¤JÆ-{ã×1sÍOY8€X>ž˜Ñ²…£ÐX)ð|”€eÔ>G–ϸdZ|Ú+90NVâ&–+/é#rw‡æØúeC{øæÙÜ^<Ý몰ž¡—¿¤\ÕU_ޤÎûÔ.pøâ¦©‹=ÕJ:÷mUú×£|ø÷w„˜TþgrÂXpÐXȵsÈSØC¦ß,Ìa`ß*»;O®‹mß´±„úaÙdÀÙ+WÄœ²±¨^ÕD¯uÙ ÓÖ» Í–‘ÎÖË(œ!#µÏàõZeòz7÷uÓÆLV+ äs}†RLó%[!–µj÷oCˆÐ-´Uí¼y €&Îʹ´6ŸÄÊÅ ¹Ws¶±P=€]áß@ˆBVBöP²–6X´ W‹#Å«ˆÜ±ó“æFœ£M±PçÀ]5¢òâ}å5a.З¸mX&ƒ–ÊÇ¥"™q«Û•T%øçyñÇnÊfBæ¿¢Ž~_£„JN¢^™cûõñåñ9ãô[Ї¥‹‡Ãy™9À»šüWíå|I*|_5Ç.8?‘Œ 3`]uØjÙ7õM8KÞ"»«öÐÖ¨å¦s“}*‚‚®y>‰ØÅË70]»C‘ \¨’¡°E1nÁ2a[î¨ H ˆÞR…6 nãáYÒæÑyhv ‚v²è0j,ƒöAM™Å)³eŸ7 ùg;Ó÷œUìšEÀé¤k‹]µõ>¥,h¥ž¥àãAW.³3 â( qQÅ,ÄXÆt7OÅtYî‰gDuC§C a°õ,ƒ1ÆbxzK¥]H'tb.à<›„E  ͸œ}–Žî®¶Á¿ÆÔDÞæç¿«){XM&e6³³´±¢Í\Mßã2‹Ehˆ"”¤a¡ N(»ƒ:pl!n‚Ô°¤-;rÝåvB™û÷à±bQ$Ǥ§:‹tÎâ.ˆ99yŽõ6üDÙ̶B®Á­È¹(|œ2lEæä:Õþ9†„Â;`|>fšåO‡r93êñÐBøv^D8W‹ž„ISÁûðzÜx\¤o –O!²_0unæöë‚##CpdBÆÙ gIÊ8áÞÈ!ã¼£ê±Æ»4²ÍîåÄ»BÝq4xÞt;–j‚‰g¥šs£¡¤Ɇ¬2YÊ™Èì’ºDSÍô‚‹?cªÙQv5 þì™æÇ¼ýq_”±ãꌬ+ØîM±hõ=\0m²?"ñ FÎaËð™}^Þ6šÃqÁ‘¤ÕÏÊ»ªOÍ»Òù`~RÌP%¾J΀k¹’)˜C–Î29¦•mî†Ä;o™aSc{ªS8áüiÁyÊñÎÛS"ãã ®6U«ïà0=óñ n†`"–h¬Dçñ­š]˲|Ø*ç§ÓuÅ!QB‡¥¨¢Nn`¸ˆ'“i…ýkÏÐZ8 Ê~ÏlÁµâ¹rHÎÃØi:ËØI:ËX" ð¬€RÜ5·5ø–!@ _r„0Úu5Ä,½ÿëéìN ÙT @Ðâ´¼iúj’œòfYÑ`LñîÈo›ûªÜÍr$Í™1%ƒ,jÌ"?iRùôž5¬,d•ýO0W‚Kã<Iö ̽Bo'ý˜iÕö^-Á/€`šŸHNú)ÕÿÜÕŠ)tfÏÆ]Jø`WàUR:[e|™–k—Ç8êL5ÞâÛ§×àN‰9ˆ¼„A›ŸÁ w;$<Þa¡ ¬Ú$£  4<›ñ»Ç Á’Õ§,3ÃFm‹ý´I³ä¢ºî6cÌh)%O‚½˜þÂfäà±» ‘ç§qÒ£‚ITw1–z……%UÆ«¤T‘áõ˜ Áý[ÿ± k Gç:Œ÷{é$[•àò0›–i•¼êcüé¹Ô'—*±À0›ž’EÂ:~5=+”4sÎi|žÖ`˜8Í».¿8ɵ:÷ÒOJû𥟄¨1ÕOÝúaþaQ„¬&—~X~;c¹íã Êc€õi×|‘˜ppLô;ç’±Ñ$&?†¾_û=““jnä¯)rØ:ƒãÚ¹¼à€Ü¨r÷îÝÄr9ÑøÚ_‘ꕤ{%lp‘4B$e½¦âƒN”3%ŸëC!(”cÂ~Æ6™¥O»œ Í¡<¼+ãv”.0p¾‘ûõ@®@ÂÞ  =&Ýü—”§÷EUÓk›–h¢kZÂ4"˜¹kìDºÇcWPî‰jtŸû%pô¨ËT€ ·÷(ñ<ÿnW># {ÃØWC"pN0¤a™åg%_ Ê0‘É©>‹bpFaÇÿý5Œ±è÷0šý´£Æ¯=ÜNÓÏaªCµ/0#üE§< ‚ìfrïýà"´zžK —ù`#‚{G_eĵCòFzáIh5ý:ÎÅ&܇[pÚ¹V©)Oéžn 8ÿ÷E góHšÑzJø¡¶pªØ´u¾ ã§Pü)U]šF‡SLI0lv—_8îä–GkŸ®siáߎ9©å ˜›VÍÓ4ÊÇ¡"TujdòrG·ÐþHõAa*³: n”Œ„]ÁQåc°0ø®„A’Ï¥YM.o‰I à(g¾¸¯îä‡YoÌSÖM{ˆ‡§<åÓ®¶ÄðÔäK'¨;çoåF±,àxð7רF`¥…þUõ·ÑSWJ=t*Bn˜‘‹ïàžy`RÃÒ‘û›>ü²¨;î{*;3ÐyÒøcî±÷{ªÝ:«Ìˆ¡ãs´`¨ ó@O—˜†¶‚‘Œ.þ¡ò×…)}’ OšAç'38„uÌTpÝ–!n.®alwú ü´ ï†díô"ÖxÿCyhZŸÇÜ—Å]÷E€Dtÿ -úà endstream endobj 1821 0 obj << /Length 3829 /Filter /FlateDecode >> stream xÚµ[ëܶÿî¿âú){…Wâ£A?¸MR8ˆÔ @\ä]ÝÚ}EÒúìüõáŒ$Jǽ=Û) ÜR5’óøÍ -.rø'.¬¼°NeNÙ‹ÕöIz›› j¼úçÁã–0püû›'ù®(.DžùÜ‹‹7×1©7닟Ö\.¥wÎ,Þ¾|›½zöòr©”Z¼m«[zñ¢Ü]J·8–›Ë_Þ|ÿäÛ7Ãl…,²B«G²Ö>ß3™°@Sš,/4ñøæ¶B^Ü‚8ÙâßwÀ¶[“n±¿¦ßôÚž»ªi©»ÛÓ/ôÓsOpS·¶ì@áú¸[uõž–ÍÍq[µ×ìÚ˜]é\¦œ†%NkG IC'+“6Ëý0’ù§iªßp{=«‹ëh‘# y±T¢È´uK¡2Q"†ÌkçÃG4³gV:3¹íg^Ú›úݱcšs>‹"sÚ÷£Ÿ^ÂÉÁÎeUv¹ôBc8ÙÈXxlªîØìª5=½ÃøÈäML^ŸIkzúÇݱ¹ ,]ÝT´¶)žD®`óúo˜“ç¼êýŽ9šml–‘™“’7‹>¾©ß#op¨ ÷>–‹´!œ¾Ý‚Ô;<ìw®¥uË ;?Y¬„Ó²~`üåÛ~Hн)úQ‡ £30Ëáî.Å‚ô÷ š‘ˆ¥Ô"óFOÅè¬dÀÉy׳Y6(¡Â,vûŽmÅŸó"ߣj »84À!Œ‹÷Ш÷Ç–úapWïnZúâ>±®þ¶ÜÝTk 'xØnÝ7ˆJÕ44|°G¹®èMÍ”{¹ÌRê»ä%-áœLÁò|Ë'Ðtdûº¿&wÃfÊ úül³!Ë9ÙÄг]/Ìâ?Õªk©§—AÜTó/ë½Mˆ%õôÆJñnq^W0Ùžt ®ÿ4J!pQȰJ+²,îRæ™1†^ˆt¨ÜZþWWß<ýæÕŸ©#RÊÕûj4sP…0É'òë5ð æxü)©Ó™Çó± ·ÒŸ”!æ-è´´6ú¼äNf¶E2Ù4Þr<Ü$*ƒýø]jͬ˜V,R2²:Ï c'蟨&Ò锢Co°=ø›6æàpœ3Ö¦³‚ëìë²»%r‘)ƒ§©”bOÒ"H)u\7ûíÈIhĶIo·é ¾,›ºì’,K®ÿ3ýOF§®•ÉÔìÐÑþ+ êqtZë=yU~$[êÌù4ér›ò¼ß-‡Mï§M˲°Ãè·:055ÊØEú‹Œ1¢©غ5õ…}OùïÁB™–7­TfeÅ•ZúDÆO9^P6'gŠsw[5Iw§\&…ßÊ_>µ"Áç­½·!j‰­ýë ½¾”´¾)I~á±h»Ã¬+ø| €&±6¡@õ¹Vt©s‡ -΀+p@ Ÿ‡ÃQáó¦ÞÖÝÈPh€F@%ó8 _$Ö”ÐÕ¥pèÃgg<ÝÿéjtÛ \ XŠçhÝsZŠÊU›ÙV„!d] s[®š´5a°.;®^<û÷Ï^={ñ:iAÀ@ºbÐ…šçþ59DnJƪÜ]"\×7ÙmŠ8¸MŸ«þŠ—&c¾tDÞñ<°ÞÞ³ÿKåÅ¢À9n ´×=8¿†F ¾œ‡;úd€vøÁuE6§Ž~ÂËL»<šýè0}»ýnWݔ݀ñ«„8e„ùpèæS1­W ëSˆ6µÚ´…„èðä˜Gí±M¤4ïéiYMÓ™US+€ý‹éâ5*¾©>¬ªjÍÃÒàkÖÃðíž~aj<¬-Û @¾_íuˆÃs²~”TÀ'ŠÝó9ü lŒA “ƒP+!ÄùT´‚ÿƒ l·OÑМ»z •>K 2¬rPÄo_õÊøòU” .~%„ìr„DZÏw—Ž6œì¢…(o]6kzB…˜EÑÐËXZd¡1¤ËðaS¿kÊæãlÈIJÃs8!lþT+<›ÿRà†Ê-ôâž©BÏrÍÎúYòU›Ì)åS[óøl’qDÐM“󺌘n ¼Øó€’^Ï’Nð‚,VD#üðÅ`±bj£)$¢ Ç-z™%ÙRæqb‹âÈÄw·­ªy©@>sÆA€p  ,d¼ áW1#Ö ¦=qñ ÿ~HæÓÿq[‚’"üâ§×ãJç‰Ý_ž¢)Æ0ㆠžÌý|A*d¡ŠÉ‚N×>úÑgØŸƒØû~1¯lb—l|J4¢Ïæ‡eèôŠífØ)‡xÔßG… pp€Œ6ã›} r›i9ä..¥¬ÏôÈãèCxõ·” À6¼›ºj‡CM©3I!ŠGl|‘ånPÅt‰JjšØg¤Y¯ 'iúàÀ͘¼þ’T«¶¨"¨c‘)€¿_’j-@ !Ñ_o8“hU_”h} ý öÕeBÙ{Zžó²˜øƒ7T`Êu|;$ÇpdŒ…ºöºâ!ŠêÅ`ׯK 09‘Ƭ¶"$è"à³êú!Óà7þ–™!gFµ7ó@í- "?KÖ/#´äghétJYéØû³ClyåpLÛŠ,ûl1l¹{;6ŒYÞ­ØàoKàê}|w[÷!3¾º-9BÙÇ8.S‹*¹ãY^ä´ó:µµhè¥D‹ËÞII‡òØWcÕ_¤@Jn øë#S˜´ÀE\¢Ê’:œ9uŽ XÈ|,sÔÓ¯àð[bx]7°ñ›¼h/áeðÿ¸n>Zºš Œ©yo†”2h 褚hßÃ(Æ Oð¤£KM𪤾amŸCnè=î©vé´¹Ì\>“<µ%8óç‘{>fÓŸàGIôg)ˆyt&$=bZ;ÁgÎÙ⸰ãLØkÛ,a“YpŸú4Æ’Ú"ú9:@ | ÙøýõT-;/ŠO-0 ûöÕ×Ȥ]„ºæ»Mð6ÂÍø-èçÝmµC tö"zã:ALa¨„‡P',–ÑäýËI÷+ ÿ'+}Z'ºÖCåycgðÆðÝ?c)™búûЛӗíd™àƒw=Ä6}ê0 î«}I\_d…4蔀N†bŽ(-XýE°‹!%td,L˜–Íô °èÄ õýµõïé †*qVªƒøÉË?b!ñ“tÓ…<=uàE =$}ÉQxˆÿü,Ò¡¤Ô [-&L¡‰‰m·áÃÌ»ãPÒ·x¶£çoºiÀgÊÊoðxÀÀƒ©ú¢â2]˜ñÚi’†-\Œw–½—EînK^ ©¤×¶k^WÉëŠËØš”_oªÝMw›v Nøó¥:¡!ê”ê(Õ ˆÛÐ×~Z­ŽÿoÉc“™ß»‚ft϶«·U›¢$Ñ[ÉÇŸÝ×ñ­ÖØþÑÝ¿;—)¼îްêD´Ž¾Z{£`ƒÒQ_±~èNõ¥5¸@ÍîN~s e¾Åæ‹ÅMS]òz€}äò?Òû >~¸ Ç’ºb_èû{¾ *ÊôúÙCX¢;‘¿9áÁ‹›ßñ• ÏW&|êSøÜÖÛÆð Ø°KÞ‰© M¬D6qJfHô'àØ/ŸðBBô˜Ó…¢ôèŒPB#ƒ„„-ã´ŽÓ(I(pø·ž£‹žœÂŽSGcéÊö¥«I~âcœ-aÆ4ó¦¿Ðò~âÎo¸õ•ÛϽô›—i¤íodCc"²–n¤ãoI?½èqìG\[ŽÉŒµexkËÁ¨htCÑWÝ…ëc½&76Þ!{ætµFÓÿ1o­Œÿôb ¾¿OÕj¦“LK5Èœ¥Ÿ¨Tƒ÷J5Ò .ÕàëT©f0Àg´š*5<øaÞg$£: ò@e~hLë4ÒÉ!Ë®}ã¡\ƒuÇç2Vfx-ÿC| endstream endobj 1829 0 obj << /Length 3317 /Filter /FlateDecode >> stream xÚÕZÛrÜ6}÷WLÞFÙ BÜɼÙqœu*åÍÚÊÃV’RQCŽÄõ ©Ëö×o7¼€ÂDr何«,ÀàÒè>Ý}¾Jà_Y±²©d©´«íáIâjÛ«^ÿ„û~踙õ|vþäëZ¯x²$ã«óÝ|¨óbõËúÛëü¦/Û³”r­¾9Û(¥×Íëb_ÕWT[T]ßV—Ǿjjªi.Ï6Z¯ÿYnÏ6|ÝŸñuw¶Âpµ¶öì·óž|w>.J Í´’ÜÁÐûžm¤†q c íh+uÛP2Y÷×%D†5‡|_}Ìi騶mê®Ïë3‘º]MÞ–T8ÞÀ&ìºÈû²`g+Õú§}™wCóP‡oË’®Ëm_½Ã!}m¾ßw(X¶™/[ZäÅͺëc{áÄ{½W›¡}Ã%ãšS¯í»r{q¼).MQúQÃ3ÍX¢ì0(œ]lj!7Ydæqø›b÷®ÙÇ&à*…ò8 'I×/w(Òß²mÝ @±q’ÜnmGuCoò6?” p¾…ïv.t¸~ç~ãÍMU¤rYƒ_ŠŽ«ÇñfŠiP1û˜ ¸IXbBñêaq‘M,¦Cߪ£º²÷Khb3(ΠqøÑϯ~~}ñÝë×Ï_¾9‡ÿŸž?Š7IYÊgâæ,ÓZ`ŸL5H(–/¡ª†Õ€ÉÜ9Ï«²Çótâé. †Æ4I Ò2“ŠaÞ_ø©³`OL¨±“³?X°@‘‚Ýê`çn×_Ò‰LÂáüÍ$¹¯{à°éм&ÄÖÀ 3f”#l>:[dÓDîXOnK‚Ôù¸û¢9^îË/ýžœtQ¸]LºœgLè¹tyìð753á¿G%Yæ¶Fr@˜%-YºnvÔÚ_CcI埞¿ ÆÛ ª]•“Óñ€ÿ_LÅå‘ÁÌ\Þ•Z¨£šÙ4!€©_—4)Á`ã†Ö™9kÅÖþº·3X+Öçm›ã>P+šVw}Ó¢Ù»º¨²lD‚€Ä´pƒÎç÷Ñ£pn™°+©7ùå·dU@Ó«„jÞº~‡•„^(„ýêÍ“¿{—ÊI€m'4’”†&%Ô`!²Œ)­æŠ¦íºêH4Iõ1L ‚¨iËþØÖð öò ô• î ËüXoшàt"c‹ï"`”ße×Ó0!@Îæª›ž*ÏÜÊÜ)ÕduZ1 g¨dî]¿yDÀ-¡|QÒ瀳mÀ× oÄ•¸03¥œŠ  *˲G¡ð«Ÿü164xD(.Q7 M‘Þo@‹´ñÆËÃÍ™'×B ÑZCx2ùËçÃ"m Ë”ä„MkÜ¢¶]çõU9¸A,—d{mUv£ÇŒY{"˜æ:ü]£‘\0ˆ­À*–‚la6@Ùé†2‚?Èl²d<¼/¢ÎPåþaδå¢hyU_´cd°p…Â|ò r…èã"¢“ŠYa/De)üê1¢“)³ðÊh8Þ©F\˜ÔLëïs¸PŒ›‡ºAhüLU Þ’Ô÷ÍmÙîË]W;pÍÙã¼®?Ü›À êêº;]0j«ïwºY´0yã@* ÙqŸ#Ò"塯]÷¢xì*ûé/ƒKžËt>;2(æBztºû­æÖ™Î\ÐÁÀ ‚Grp\´Å õáŠu\-0 Fž² ²à¶¯¶e®È¨dý¬ÁÈet@ßu¤£ÕQ‚‰¥?ñ ÄVDÂe¥ °Õåø×… Î)â'FAø—Ò1;xT¬š\Ö_RŒˉ@ϲéf¸ñsQâѺdI:ó›ÔˆõÓèøà<Œ¹×¥”LñWDÎo“,3Ðo.£qÙÞÀÆãMô:G7 ©T|,Û†ª<úöΑC ¢]&i8înö‡ ±þ*qvÄ)ìÓëg)¤Z- †Y1q=1875¹öÒU I5µá±ëºtQDs¬‹¼ý@UƒW‡;Wí„3¥f5¤r'üº ÓöÈÑ@ö©@‚i€ùzCÀäÒ——¯^¼|õòü±92(+f: ­uápÄÚ$¨¿ŒZ1Jü½+apwʦMÆ—–W¾‡µZgl©36÷5Ú•„!mûýjêù~ïA‹Ñ^lʤH?¬Wè æ(s XHuU2Ó j£9x}¯}ü‚*¦Ôúo ímÕùà¦n<51Æ7µùXðd¨)8,nBÑÿtÒÿæ»ó“(Ÿ¨“ VÁæ3Ÿå.?îqI2~Pd‚†Ì0÷MÞ 9ãtäTRš• ¦Ì­Ï‘^”Õ‘Fù!k?Ï6÷“8"ŒòO' „¯yÎ[ÈSÐèqcI`ec*ñ–çYF5¬Jo"áxò'âðdÊZ¿ÅÐÙO˜ Ò$@)œcFÁ!ÝTõíböÉQòömç'*[OT1gÃð{_½õ¸,ð@8ê-\cë)39”]XT?¤äÛ2LÆsŸ]ë·5APí³ðº ym"s‰\%¡³?p´ƒÈ±ð0c²°|×—QA¦'“w"3ž õ'2ªã@ š[ˆ©uï™\¬ÇÐlˆDÄ1hÉBõÛ·e^|,Ûï?ÐÉmAF¨Œ†ç\ kzw¦ ŒrôØ´k<ùèÏK¢wcQ¢\v˜ùùvÎj\îInçmàôÂ<¨8…ÿ˜U=ÿ5KUºà•§9z|pïD``Jz‡d¢—ðsg€’“Z=÷‘yÈ)é×çĤ=™ÒÊÀ늈Gbz–º(Á‡žbÚ1¬Œ¹eb2å)ä„É)T‚ùÐÀK«REÚc‘, e×!dZˆRò=U®¾¯]>?ö³9ô˜æ3£WäʲÔ,î &⬠Ãw¶É=öýÁ…Òd"«Zµ©|7AÓ•^`ˆkïµÑ¢Ø“|}5]ý-øŽ”3>…&à­±`YÂX—Eù‰L±Ð‡Òå÷Yy+û8"‰RiG s唜‘L̽àéƒU‹ËO+™ ŒË|"œ¾k¹ÏT0γGaN8`6ç|¦µÄ8÷„™ÔÜ·ÚÉØá#§Ü¥,ܾß©¦^3úf¹}Wð"™™ß dz¸‰åð˜¬ê1þdgÎá`Òåp ´1ÖäpÌüö3"1Ç K"z0I¢—ÙiEÐY¶7€h-´ãõK·*ÏAUÀM!‚$AÜAñ@J îò!’2÷`Zøœáߎi BLúY0 †åy,¦ý©ÐI:¿hûë)”£#×2;S€5Æ›=…5\8èO›¹ñPJÓp2"p:Çr5”ÿBÃMÛ l’㤠yRh[<2Â5Oo9<ùÉ3˜8YÉ»¶9€ùjïñÊÀ^?}…rêËÖ‹Øâ8cø‹O€Š¼-èkA=tTKJ0ð¶iÇ7?M]¸Äç%êå¹ÚE.ænº!u ¬ö9¸!:î­ØSL;h.£‡² #øÿz¼"$b<ä´éuHpÃyËrÒ/ƒ¡eõð˜{;7Ò` )øÉÇ]Ûiër ýè*ùðaÜÝg%2á:À'qüd$ÛÏäŸD6ʃŸj²ü"GßÑGN"¾—æ®.è.ÈužžŽ,wàúù`bœ£,<„Hä Žœ¾â ìÄ<özH¥–¬\ ­R:ÿxBµ…íDv`{Þ¾¹hpŽêgäÝ0^ŒI”»¿¿?j™]ÊF$3T~âPŽRe,Ë'"§ŠD<¶8K³¶”ð ?NÀV@-`ëû‡ÑïË­CÐT÷T¨qzz»ˆnâׄKh®·¾‡†ûéFǹ 1¸ (lón¤¦¸³£@f·4‚î8„tB ˜—Ë–ÅlBòôÄ_‹áQzØ?ñß Ç ‡š)årú½[¢+«‘~5wwœ}GeÏ.ØýS!F:?ö =Ý|¸àÙïÙ ñ—: .ÿo<Ô¤Ví>ñ· €ËñÃæ®›}± ÖGøbðWÿM—T endstream endobj 1839 0 obj << /Length 2288 /Filter /FlateDecode >> stream xÚ½YQsÛ6~ϯнQ7JÞ=åÎqÆÖ×:ÊÃMÛñÐ"eñJ‘>’²ëüúÛÅ‚ICŽsI3z ‹ÝÅî· ¾áÇZ,´‘ÌH½Øì_…¶·¹]ÐËÕ»WÜ[ÁÀÕhä?Ö¯¾;WjÁC–„ _¬·cQëlñK Ír%câàÃåvõær¹’RÚ¼Á·(ø1­–‡´\þ¶þþÕÛõ°šŠ©H¾Pµ~ôSýâç,QJôú‰˜…*"ýŠª[âÜàPšë¬h»æzsŸo®Û¼»ÞäUz‚^ßÇáØLžH¦# K[)¿†*¤a*‹˜ˆD?pÕÛøßAqJ&Ebµ&Aµù-\dðñûEÈ`;r¿Lh oåâý«Ÿm“Õd¨™ŒÕÔÀ³‹÷ë«¿:&®ˆ`a){í¬éÅÍ¡+êÊgŠVLòÁà×´›ºj;Ÿl©˜àƒåY}¸)s«Äæ%,âÑbÅ%ãŠÓˆÓž–šÅ ÉÑÑÜi7 »•ï$‰Jcßç°µà¾\ñÀ†YgÃúê-=»]î³cylEQðÆ· OXœ Þ¸üðÃ>yñ*Rý(G X·uãÛ1ÈÁoÃ6- î×Á(k–<¸Z÷¼¥n ù^>⨼©©u3óMW;HBH®˜£S<è!ñÁ^‡˜Œ2IȘ€„— )µ¶ 7­%Ú™m«-<­Õ-²[Kñ½m½wóöy·«­37ÆŒowŶs]ý*“Ô u*]7Y¿4 €Áù¦ÉÓ6§„ûû¼)6þà×I(5õ¡ÊVõ¯!—¨Ä}ÓÔ ‹H‚‹-õUu‡/&¸-È™•ûÇ]YlŠ®|¤vJ£²|›ÊŽúÐ%øD—8±?ÖM^£œ{t^Þ¼ÆòÅd†qN´rŒ¶K›®¨néûÍÓ>}Æmí–kH¼Ü-N°S¿@ÏÓfƒÝ;’–·uSt»=}ƨÉÙ-˜ tt”L›/{·Ÿ9qâÅy 'ÐýÉ|Сñ@(u„*m½ŠB0Î'Žf9nÏü„÷öYÂ+TXοá&r¡àóE„W‡ŒwFQ‘’/"¼Ïº©Å–ðÆŸ$žQ(XÆÓ”}—Ûz!Ç(aÛõ–ž§h§`Z©Ï¢fL¢`)›Ù¸Äö€8¸AºÑÁ‹­ÏØOÙR#¥ÇSÂd•¬Ý 7sD!ç¶Ø¢Ã°(œMJ. xIN½ä²Ò‡&ŠÅÚ&ŸC)Ôዎ0"-p1R¿¥¾I­€¶£@†ÏÜá$´ô­s• ^­P= ÌîÐÓ L©k Øp$Á ÓÔ7ñÈÝ "ºå¹ÏO£B›ç`kœÑsà‚3I¨ç§3õ)KŽØv±¿[*Ä®K+($¾ˆ4ŒêœÕnˆžˆ4,ŠAöæ£ó€Ñ{=})¶äžÁO£ˆDòÖíÒ®?dÂÑ–™ÄÛ®.³)F ú?¤FŒ#Å#ê³wwÙö¾.¿ÍA”€¦±ùw(JKù î ¨ù„Céã&èv ¼ døO¸‰vØ•Ät£•ì‡ryiϳÁ@7uÁ)Äc7Ôá!Èlo‚ ¡(Q*ÒUw‚h‹® Š€î £«¦asûé-Y·Ê¼èª#¦“)Û£UUû4ŒC0ÅÌ5Ä%l¢EÕ@ÕfŒµö.;)¿Ù×o¯®®m°]¿»> êæÉÕÊ,G%è˜Ä/LÒÃ]öm“´“ÉW¹ØCQ<þâ‹=ÏÑŸÌ"¼¶3Ñ,7¯òM½¿;tù—5‘ZˆLˆÕ½½ï îyRMæØ3ö ¯ /K7ÓÌN7+ ã±´ÛáUùHl5®›ß[jÚsð|²ï(^ƒ^pû-œ ¸€â°mê=½QêÃËp‹²¸iÒæ‘–Á³…꘥MF­ñÚNêÃÎÞQŒ¥nê¦É[G;ªŒ®PCµy¢õôò)]Z㉶(S@Vw™ö¯áôáKEˆ–8Ö/F€$|réeAÆžk¼É§¢ÓÉ~öfýÆŸí†>¥$yÖZÄ“ÓìzGzðþV@"ÇkkêÝÜWWç@j³OËâcê.ªp&ŒÒãá¼Ã½¹ëç¦ÝD ŸœŠA(];@1_.ëc Y0LR*H;7™†Ò^Ðqt¶·“e¢àŸgç®v¬ßÞÀŒ‹€âöçÔÑÃg\E>y*<–‚C¡Óñ×@KTÈ'ÂŒ’_†–â$‰¬(ª?áTø´&ká9NØç|óæ9¹7pÑ&'w?>öa ›ò¹^ØðºØö‹÷ñ4U5âÌÞ¿âËïi]½öþY "huòÏÈÆ®¯Íi“§^|(Š¡Hqe!oÒðϬŠ#¢ºº„EfÁAÆšeGíú¹ôŒÈ ì Øäm»=”Þ{"±x¼´¸Ö¡ôìo­‹Ëó‹Ë‹õ¿}ÆD ‹Ž1õîýù‚wU~§cPB}z'ÿzËèýîª6ej˜âÿ. ž endstream endobj 1747 0 obj << /Type /ObjStm /N 100 /First 972 /Length 1356 /Filter /FlateDecode >> stream xÚíYMoG ½ëW̱½Œ†äÃŒI÷ÒAœCS#‡4Š UØþû>ŽêÀV”îZ’ÓK/w÷ ?¹3kj¢©$jb©Žß–œâ×1‡Ð™@Àc.5J\‡À‰]C$l!Ô$Öê<–sªµÇ£ž´Ç*¥d=î(§¡½UO­;5¹·Ô)õëàH‘pB¡¼4^‡R¢ðG$ã^GZ¡Örkq`¡ðÅp¯ŽXâZ„HÚB)—´:œ·¸çáA©o¨bB\°¦ ºû0 =\Âh³ imHÖðµ5$I†ÃM ©À@NF2š!—Z°Œk - ú”B‹uH]CMØFa(öOú: úº I“”pƒTÇÚɇäIˆ‡Ô!EZ/¨Ýði+®ðXÑQY+à®ÈflÔÒÃÖV Ú  ¢£ªÖGÞ ôyô¹ úúæ)ôu³‚+‘— áÆþÀ†ÃµÊ,›:Ôá‹£¸uøâ4‰Ê9R\‡/N5(G!A³œ Y[h¡j€3ôµ(¸#ÙÕ}Øð¤¥Œ§œ”†]üÑÑÎ5)ož*¤x¯ìáõp8©5ØæR’ªl%µ88¤V'Ðlc­@skAm#6PJ}Ćê#6´¥mr…v4¢ˆ mb¤¼89Y,Ÿ§sôœ ¥_¦å/¯M h”QïË>¼Y;ôê¯?Wxðö÷Õbùœ[]Þ\ÇT-±~±|¹º^¼z·ºÞÌñqïçÕÅû·ÏÖŸÒy€´kf 6ð4|{o¯ $ð6ðwSTû<êÎÀMgrnòöO’~™$•ƒ“„—Þ¬$퉳R³T›*œUÕi`E“¹Ó4PzÉÜ}ÐÔ¦™™„gPãnƒÜm±½(sœ&3þ’?VæÑ<^ì‰3¯¹nWûxÝx¯<û§Öv¤¶žZ™²ýp\{6—i IÉ­ÈÃhø©þ'ƒ²ÑŽjôƒ«Ñʼ,oáÌ,+Ñ4°ºelD§ØCg3™²ÖÌÎÓ@ ºÜË#6ÙæÕô°ÂúŽ æœ`ýŸV}zy¹†ÒóÍ!(ÜÚ²>‹åÙÇßnÆõOï/ÿX,Ÿ­¯.VW#åM¸òA‚ ±ÍVÁFG––)öóVñ¦ óOG"ÏÒòÇõ«uB ¾;»¹¸x}ó}dãne|æ˜Ügì¹+M«·¬ò?n_ŽÚ¹ó œùV½wo+q”—Ÿ—›÷îweoÇêÊŠ×WLàÛ¶¬0_ùA]Ùgž$öĉ—l¢Ó@2ÇXøHû«£ìcã#Æ6ßâ;Ì>|»“—ø44§tÛ8kžÛ®—ñ6°6¼J="PVï4 dkØ0Ì’Z.ß|­Ä¿×sþr¯ŸÎ>ñ /ÜŸðŽ4…Ä5b¾BÒ‘ëfsÇІ«æÚ<)v‹(ˆà…dè³é!Ó/¾mÎj ÞÞùzŽo›“ÀQ­Ó@A.ãCó$qP·í£ÿn"ß{Þ#è¿ ¼£!wL5>|ªñÌ©¶…³Ž‰!<X8ë4L:ì6š²÷ÿx™²f Ài øOõÛ¿àî?ŸŒ÷fˆì`ˆÎ™É Üß[¶SL endstream endobj 1849 0 obj << /Length 3427 /Filter /FlateDecode >> stream xÚí[ßܶ~÷_qÚÔËH$EQúÐÚuš"MçŒ>4…¡ÛÕÝ*Ù•®’6¶û×w†CŠ¢–{»W¸@Q~XŠ¢Èáp~|óñœÝ¤ð/»)øM¡Ó¢¸Ù^¤¦·¸¡ÆÛ¯_dvÜ®g#ÿxûâË7y~“¥¬LËìæö~>ÕíöæïÉ«]õ8Öýj-„HäW«µ”yòçªÝî›öz·Í0öÍÝqlº–zº»Õ:Ï“ŸëÍj%ã*K†Õšs•ɤ(Wÿ¸ýË‹?ÝNBåÙFÛLHÅÝ6¸bi.i’)IñäÈ(@¦Æü»#H&Š<9¶Í¯+%’ªoª±¦¾ûã~O­M×nÜ_e;‚=Æ–jLoÖYÉ2®iù7+-šMf‹Ù$_jz}òÒñ"©Ûi|Ä]pív£æq?Âè\ù½KÀ ޱH“Û}9 D³7nÉìA°,Ïh(‰*“G8É"é<Ùf…š4ŸÁ›_qñz3Ñጄu3îj׉?Æ‚} |wûšzÆ]5ÒfpóM{°uËIpAÄ-L{ÚÀ·v¶qgÚ6=iÏmÚ$íÑð‡]³Aï葾…F{êÔ¦±+Ãó¦jÝ »·±ff °ËRJXH±¼´ºïkt aö‹¿ý Ç»qo_m›ŸÒLÀÈvc{À³pÓ#nýƒÙ?Ú¾9Æ#é3·Eó8—Ô,„ã>#´_á.ɔ˹) ‘3•• )#ø/1sÏY‘k7b=îܺöáÑäRümçÄ­ŒjÖ"WLð,4µ¹ü*?9gì3Jƒ_ãÚ8WŠN ûxý†ÝýâMà}ØzŸŸ\%ÛÔ/[4?ì¾Ã•>Ñþ•t¤$Ë2å4pÓ>˜™ñS𧱉$ãÜì 16`¥(gÓdè:ù}l¶L³BOçòhP”ÉkcAobsCÄZ^##wƒ»!6˜º™ô»Ø4˜I @ëðèíž• Í+çÊ‹•fq±”?° ¨X0Heö.ÂWñ³ä²p#¬M—¹ñà2ìžzŒAÁïPïÁ°=Á™dé ¶Bã,Ñ8){B í¡åÍÞ}hŒ§áÂîûŽ"íR »V}u¨úX 7Â…>#Ô7õ£G>6ýÀˆû#Wk¢Ø@= Ún¤q6ŒÛÌrîªö¡Þ¢I2YØ:KØZi™¼Œ{F ‡øGµ}ãz @#å\¾±òU.œ‚›éèEýqì«Í¸È…Çv[÷ûO <`–9Å €ÝÅÚʆû€ýœ}Èà™‘ž§Nzè0ÒÃïÁ*œEm»w¶±ðzgNg3ÊùœËP/-–úIf™  ¶¡=À‘¢û Í—¶0"²<†"ÿ[+¦reÀ¤†è6ó? ¡;9vŒ¸ì'‚h5šQš¸±}s€Ý‚-™Gtqj™qdM٫ل;; Lî¡wcŸ?Wxa¾€N£#ü´‡ˆwÙð\÷ÖLF lA1:7NV ÔîëA»¨q­Œ”øÀZ”(Ù3Mmu ÿv€ôîn O†êð¸¯{ëR*u€Wcbo‡f¤tn¾nì7‡Œb»ëÕ¾ù‰@Â5¬6sÁÉw¤å(V&?Añm¬zò"ývmmEƒz&ùkg"ÂÖ²Ø ´®¦5¦ÉmC´Ùì’ž}ÛØq[š›ðìûCõ‹ø4€NL³˜D<Ó”ôYnõ4\ µ 2vÎ`ãÁ2´R ]VP}=¯}|èÜw3 Xý –BŒ°Õ—>’¼Y••óÓmëÞ‚j 0ê&ËX™çÜÚøÝwïÞ¾ýÍ·o¿Xaõ û÷Æôß§xßÖlPK0•B0;ÅR!¸°L78üHÄ5Ô¼SÈ;‘(RŒ–aÄL™®{iOåÜjð¶„oÀlÛÁÂìŠõ ©’¥2»v Ù´ù`~ßNç_Lo=,ª6Á„ßö/±C W¨S<fœ5šH‡Y{Ži\š÷0¿†÷PÈ{ŒÔaórT´Ââ:Åÿü+›0ÔÌ"Zá¥f™.=ô}ššÈs¦åT°Ámdœ‹G– °!ŠÐ$fµ—Ò•GÐD[ˆ„a7LäBPŒÆL•L¥“tîûh±’2á?=˜"¤‰XøàïÆç½™ï Î 9‹#‡(ü. ØðY–¼ÃÁj"2§L!)ç¦4*™ÀšYŒ ø áZ׆ۘÞÏ šÄoH J/H&¬©4@n)~²…¡q/ð ^sþPy)}©Õ61Ò‘¨ ù(Uì ðmÕÚÁþü°»¹§î³çWpÀ<•Î9ž)…3qp<7ä»wß~ˆ0å‘X e…ÈŸŒ³%S<»BoMK–21LìC\ )´óiÎÔÂÆØK2 ñU'ŒãaÍý½”A&[Êä›{Oã&“{Tqm~'ùeªÍ‰‘y[«,˜äò²yZœª÷0Åœºƒ)Ft 6ƒ«OF¹4 "* ¶Êu˜¾ëFÈ?9øc”tƒX¢ŠIi–@—·ÃÜ•à#бèØ'Ðñ%Ðé³)?âã…„ š‹üÒ€!ylLUr¸èy´’=—~'Cç9“"[ '¯ š6üeda²âò¦ è´Ç…/‰°‘Z'›c'AxÝt„ø0†ej»6±B[Êr¨-+¹¥›3;zJé‡rŠv’–Kºƒ²ˆRúä2pè] W~;ø¤ä’í°·´]0ÐÖá-uß÷hÍg¸Q| ?¼~s®¤)„*S –>/–,ý‰iñi®ñ‹hbª,.ï™gÌéÚwøõlŒ†¨As~é*Dñ|šs‘'ß·^u„ŸJõN^óÙ!Ë ;ˆ)"3 ?Î\Ý•!MMÚë·M‹81Z\k¦9¿å´¿u0§‹±oê„ÌóKsqbn©™,øåˆŸk.™ÛåFzˆ‡x²3 x]ˆÇã´BOš³o¼t"PMC~Òdi|RHÇðÉ22„j.ã­C^F—ö4¢tD'¶ìzégüº!²š!Y(Ë4ù•ÕÒ„U©é¸¯ú—1ŒPIQ„;B N}tkR$?ÔÁQ}çþ`‚.‡pÔ§ðiZ¡këõˆéš¥ÀŒ7N{Ÿ¦üä ªÐ†ü$ j«w×>ß”]ššÂ³¡”> ô…§«V@¸³«+vŽgÊ®à™J›f')ËÏ$ îI;II˜× ²¢ÍOA¿­ Ο$xÚZ/#Þ¸àÃ!ûèÏ@ƒjÃ7^@¬¾„|BoMëk"J‘ ÿÊ8^g™Q^Îkù€µ1î Z€t¾âüýL¨ÈSeöÜêIÅÿ*ª~ã@ÿ¯9Püoÿv;»Ã endstream endobj 1855 0 obj << /Length 1249 /Filter /FlateDecode >> stream xÚ•WKoã6¾çW¸7:X>DŠê­EºAŠmºÈ:§¶d[޵kK%5M}‡=C'[ø j4œ÷|3¦ ?ºHØ"Q+ž,6Ç b©úiá÷7ÔóEÀ8^]üðAˆ%8%)]¬vcQ«íâ¤È2b©R=Ü=àûŸî–ç=Ô¹6§ý–•K¦P›–­~½øeÕkL`óo4­ã~Ç>%1M@&“˜ˆØÙ¸-êFë¶)ªŒ’eåÖš}n1Úæºø{)$Êx‚Áž^Ôž1ûj©¥#ïtuœIØ-)jËM§$FŸ®?üI1nƒ•éØJN,DžYOC…ªÚ³Ê1+•X$´ãüÞ³L|8a½¬æ2¤0Å2íY¶…‰¡1¦qϦSçá3Ö¸Áþ†š¸‘bÁx¯9$”cÉDÇ—‘àý^¡ƒ+‹ˆ§+PQŽ© Ž¹‚Ϧ†¨@{Èו9¦èyoS@¥<|ÝT.|z[”Y“‡Ü§Ba5Xú5diŠ•ìlÖAG 9…#EùÖé2 -pŽÇÖô)…cè”wâ 5 ÔT¥ðê÷ÒT¡’ˆ Nâ´»x÷ðñcHä—^ý©å‰ÖD`N“A©ÍÈY\`FYXÁ€ ï+ð¹¾<ãD¢’ÀMó&1×Þ¨E%0Iå´ên Å„ @a^¹ë× ÝÈ«,Åž€ø*©Ó&`¤£©!E+SùF©Ó‡6¯gF4Žƒs4þÇtêÀ®‹ ¢^»ï™ö¢ê¦ÒŽ™è,¡˜LOâ1Øb6°)£ãÔ%E±1ÉÛ»ÕàhW"ƒ/æmmÚ¾[82÷8Yšmo€;ÍĬ> stream xÚÍYK“Û¸¾Ï¯PN¡6B.Œ²ºÈÚœF†Ò6(ËTƒñbÅ-ã"¥¿0N%0©g¬MÏ8•Æ@0ìÇ~;6-=íaVCÕ–f}D–9jzÝVµ_ú÷XÇE»£©íÎ3j²CN6ÅÁ­)évxTÀCUÂ:Î@UVF7;wV'¤“J2®9I ÝÙ@KtH)`ñþ‰H í¾!b[©(›¼n=m—7~ñ&k3†F¥¢+Üîqv ³Žè7;6ù†Æi¢=ìýšm]:FDê/x(IsjÁ›ü,ÔZn¢–A™REk<ð®jr¿è>/ó: LTtÈÛN$ц‘¥ ‘Jƒ©xK’YîuúýÒªèX®=°µ:ß‚šËuîíÌ,8gVkѯ6aõ‡·ÞÝ~{ýþæÝWKôàt¬od·ë ým™?íUĆIàæ¸ ÙøÍìp’bB‰0 |o=³Ñ¡¸aÆ$a"ØØÜŽº©²}(Æ „x' <#€åë#&?8Áeö@.f!PªI¥/p¬SÐ*Â\Â?zà`”~ODÀhò‰û¹O¡É¿¸F8•A„Û#T…ìÒYú“ø§`•¯cTtïeöY}Ö9 ïuḿiž‡êÔb°$°¦.ügÖ„˜êqŠä¾Oô "’)éyç6†°›&×ÿžÛ7âã(H@ü7àZdBÊyòR"yÐæ|&€@sY* žO™„ŒX)´³/L&¡¨@V<þ?JÖ»¬îÀ>qóm±ÏK¬ÞÿxÄN!@»Ûwpƒäq½ïùR×9W€{ÿ˜7k™5ï9>¨<åþýÎ W#à®hK =¶Òpÿ:ho²­2;(¬íÓÕHiÀ½º™JœgTÕ}_”¹y>`qÐ>àÇgd¾¦”t`¦£0û„ÈçÂX ÇPü3˜ˆùL ‹±€ìámÈ rO“/ dÄ¢·§×ÃÔ)Ô߉ÓÁiÀ3 2|R3òÌ5̤&„úŽ^Ó_ÓB=›Õ­+PKyæ2!EÔYhmµ™d `D ¥Riô¸ú“´»¬¥§ME»–UÛ†:a*rºÙä\%íÒ ¿Ì£y"X3W3“vG\ýqz3žãA÷PÓ*Øû Ÿ‘ÁU&1\a:¾Êâ¾ÄÄw1b|µ»–!}ÓSJç™>0;}vÝhßôÄ@MÃw`YùÏ?\t ¥–¥M¯ÑÁ ®®3×r„Ý&@q!Þóºv Ï„¨ä a2•a•îW©ANãUè#æÔ2®‰€ÙMÞºæLÌ©¥TN,åj9:M P()¢>Á¾ØÐ8º»Ó,Ù†ÓRE2×À-Ê^¾GælÔ·?}ÏUöŠw‚VØX+\m3ª8«IkÔÃÌ>öýÐþ³@R*Ï%äVAÑ.l:Åm<÷aRͧ/]ä¢ìåþÛÆ8èEÊtŸŸ4j_Ê*0À˜¾l})­p 'ô¿åùâß‚•y¹ø2y3 \?`í¯b=gq€ü 'Ðö 8*­W“ÜÏ)ÅB6«/*åÓ>Ér <ÜÓå𮀞Ë7-ЯÜWìbê4ºÞÒ´²Ÿh»Ì‡rm*#ÆZ÷âc)yi_Y¼Bºvftoöø80{|E³Çÿ>@ãªìŒNLj/P T‘I:¬Ÿ‘«Ó?>€–æ sˆŒa¼ýðæÍ™Öµ{¡œþÜÇõ:wÕg³ÅBt¶écÌðãÀ¥2œ”‹½à6¡o†Ã«!l7ƒr^}/Ga;º¼ŸÍ6f±à¤{}wîÓ,¦{}Žûqϥͯ(3}D5îè{èÃØ|7EË ÎjFÍš)jœ…*ÓéÇ›é·3 ÔyøêK&Kî!@ ¡F€q>ÏäPœiñ¹y&”®¢¤÷3i¨ Š®gÕn‡i½lÁ)(ù|å&ªŸ»õ_óB°JÇj˜¥¢dħ¾><,5ÄÙÖöëÙt &Ç]`ú6¸j2RÄ.Ñ#&&súùzW=xÜ)¶O£P~Òï{kª>·éÃByÿ;5ë2Ù endstream endobj 1868 0 obj << /Length 1403 /Filter /FlateDecode >> stream xÚ­WÝoœ8Ï_Á#[u]ü…á±—¦U*5Ò%›§^Öérb!&iÿûÎx Ëni®'VZŒg<žÏß Ç™X­Ežei|{uË®ß^­ÖRÊø¶·®Tü©hV"‹‡¢^}Ù|<»ØL·i¡™Vò7U¹ÒÏ€~ŠI•ŠQ?‘²D+ÒO±lµÖ©ˆ?­Ö<~»ÊU¼¹®¾nFÇÛªw]u?¸ªmzTïÔÚ$Zóœq‘‘°wGük%düÐv´èŠfÛîi½/€­´=[­ WñUëà I*v»ÂÓä/|z]W Ã¾÷t }Š¥sÅdª˜’è¯Ø¶îk»dפrä w¸–ž;ЙŽEk™gÌä –ŒkNü3C”Òñfg)¼]‹*>÷ô*úP»‘ì}£uÑY¢ö®íì–6KðŸ-ÁO(ÇÖßW™Œéñ”,B„dyÐç=ÆohJ …°³¶³Mi^â,×Z§\Ðiðøõݻ˛Íõ«æHº;Ÿw¨ò]cŸILšÌ}(’„%brâ_‰NÂmùœM1¡&¦Êg½ ⎴â)Ka'06w]ûÜ/É“†¥°ø^“ç^ ¦ÇAnÙÖý’9^n6³†/%ÎZ&š)%1Ÿw¶pOLT|ˆ}æè»Ç*{\qÐP˜ø»î©í=–aü·-møÂÁEA⦜­y]²%׈À@|8BË?^H‡ŒR‰^É->I¢-?F S&zöœûH2aÐkutsög€¼ã8¤‚ÁJ≤§Xð•™â%¶h‡—/  M’ìÿÐ_‰„qnŽ 8$ljòœ¥ÉAy_¼*m„9Û?âCÑ–cõüÐˆÏæ?ú÷øO§:Ä •fÀs†$ð†Î‚…ŽKÌ£¶ “öÍÉÒÏÈŵOàþF¯˜Œ³ˆ[™ˆ+Dl«½mzDoÌÌ@½ttg5*Q÷-­ÈÒ¶ï«€®¾!ÌìC •Ðûv²Ÿ0ç-í´ €ZX…­ÉÆ;X±2ûJÈŽ|‘y_¼)­ü Cp¦~Â=(äy¼£ƒ>¤D(ÔnP„ÛUA0=Mì|1oÃmý‘}!ü@KùTŽXÖ¼°é£O |àuìôö\¹®’ÑxÐûO­‰ÞÑ&Y8;¢•í>D¢±þ<²švÜ ÷KÁš£ ˆÓ‰·Ÿ”Ç%4¨>:z‚‡jZ5èVŸŽ³øa:ØëqÙÄShQÐÊÆó>UqQÎA¸:¹Ð‚I3uòYK‚&é-é¸L9à¾Vz<Õ.Šæ‚)­$‡Š5©¿ùÈIå“-u©ÊÔÐ,±k‡ÀgþÀ˜e¶/ð‰¯æ±upLm¢û¦ ±) ƒ#"5 A\¨Æ¢«‚ ¢ ¤1 þH³M)XCHÍ'÷Æ[æÙŽ˜qȄк`p9¹é5í «IùÙ(£–G™5Œ©ïôMð÷EßCNK€©†#ÍcÑ{ë*_˜iø8g¸åYæ«uðº_¸Q €ùOó NlËSG6OÄŸF¬£¢[¸„ë„¥R-O9¯~q¡É²ßŸ²ƒàó`:~åÌsþÅÛŒÿü7‡ªü_‡ªfª“Û?Xü P|¹? a Ÿ˜Æ÷|󹎋ÐNxÇÏÅ§Ñ ×¾1ºÀ<µÃÐ MšùnèX7t£Tc~Ñ:ú;é þøÛàg § _Ž~(¡oôC]/‚™É!rGyvs{~~qs³äh#æŸ=UøP!›ì–ãÖ“ÞÒH endstream endobj 1873 0 obj << /Length 3226 /Filter /FlateDecode >> stream xÚ¥ZK“ã¶¾ï¯Ð‘“¬зÄë*?b}±][\ ’˜H¤LR;v~}ºÑ h¨™YoÍA €F?¾¯1|•Ã_i±Ò¦`¦Ð«ÍéUîzûýŠßÿó÷ãÖ0püÇý«¿½-ËÏY•W|u¿‹—ºß®~Î>?ÔçÑöwë¢(2ùÙÝZÊ2û²n·Ç¦ÝSï¶ƾy›®¥žîýݺ,³ÿØÍÝšgãφ»µŠËÌw¿ÞÿëÕ÷“P¥(Y)‹î Œ~´ Û¬J„mÅòRÒ6$«@$%²7ͰéíhAP]f—¶ùp½ußÔ¡/Þ΀Â^«(_­yŸ0´ôýÁÒ®7õñ8`SfWÄxhj vô#a¤z&óóëóùØØ­ŸÙÑÐí,/ô:yK5ËK#fõ;MóŒ‘ÜJÆr—¬â%È®(‘dÿ%Ïó¥-ò’)SÂNÉz[ j?\ÅÃ¥dBaxk–Ö93Ü„AM;Œu»ñ«v;ÚK=YÔ£M—ѦS›[ÜìÚäLkå¶ >f»Îºá;¢Ô4±gDz?^œø*5{ìÙ]ÚMx2ð±2ÿüÍÛ×K …`ª’á‹›ínQ,͸áa¬Ç¯„:÷Ýûú=zslÆ;¡³?hÀ©†["}÷õ²Hk!+f4HÁ¸·óé¶`"Œa`Ád¶ëŽÇîlûa MðÓ¤ÑY׃àñ3ü¸6؇HŒ-I M1Û gUQ͉n% •µÝHÉó¨·?ÕÇævû: 4Ì2×äÊ苇ËéT¿?NÓÚÖîëÌs^kÖ8>…ßñà_Ö Ðíh×^ÒXë ©Åö{ÛOEŒË`·Œ–!¥òÄK•wÃî„`\ª0è„Â\œpÖz$ý¤ž€=A ¨CS:uÞ­ ϳÆ/óÄ¢§©k §PWÓB8¨gJøüÐŒ¯=•´ÇIà¾n÷^A?ç¯ù¯Oih­Tž}µ[ôQÎJ¥žSgBN~ŒŽ¹¼’*¦Èw~ÑJ½ËFÂ1¶0#ì-˜QOý»Î7jz{†è86›Ë±öý{ÛÚ¾ö9žO0¹szF#/Œ@›lÅ­@SòÉ;§Sua«d•Kb¹‰Ç¹èàLÁšöÌ&‚ž'Æ"ãËa¿ÐL˜2=æ—…ý¿ÁãÚÉ›ÁöL‘-†Je˜àâ9ËHÒÝm˼xÎ2’•–#d Sš-d‹ÀãˆzXúnç"¦ÌÞû|úçóPS·­·t.”¹‹(ì9qœlÝȆå ÅriþL’þ¡;a¼<1t|Ž } žÞþviz?¼¦L…¿ä\¶Íh)³J!@n95J¨8šLb3¢Ó…Ùßý´h`u¬˜Œãüaq+œÉRÆù¥ ^ sƒi‡Äíû?îéCÕº ™d‘mwÁLµðùp²š>?øÜýÕø$8½ŒÝ ´ì£²Ã»hfÝé|¥ÖÛC³ È×.|®˜ú¹Ø’BEow{ôLÙ Þe\úBYnËgô_²¼º^²ÎRB’q)úã­³} ÆÁ6|Øà6˜¥Èò°âw –K ßOXÌßR³Ùt@nâ"OTVÊ2…¸ô$‡%«!¦Žõ‘ú(Î>%@.ÏãÄ)·¬¬xüy1ð£ UØÞû ÛÒÀ¨>‘@8/Ë“vžŒ~÷ÓòqùøÓ§uÛxQ=ã¢n»è]@;#µw‘?$t æ&yÑÅsõg²ØÇía >Ý´‹§gžÛl ¦_È¿ p+p,ÜAÉé—jX)Zéí]%³9O×îíÎöià$*ÀᲞg‹‚U•¯DüøÍß¿{óÕ÷ßÿå˰ҥç„yç㻉xªü:æÄv´X%Ð̵1vÍvyµÄ¤T>¨®àOJ¢"Q^÷ŒBÙÓytÞ{ æÖ©ŒâCótNæ?Qåˆ>/P嫳âàÑ@ß“³úbÀ 4Rt¢nTE4à\9UE0ãŽÑÈÑ±í¶øàÔKDØÕ;PŸÃ¶pÑF°ûz«~Ä\¬ù 䬪싆`2Îq¸È .òjêœþñå9Êý˜r1åIð‰@Áð ;¾õ/’cG=õ'ŸpÄ×±Á¨°:(ïë·ÑÞ". ß'§„Ʊ©LíM=Øéu¾?5ŽCDŠ7èítÓ]ÎÇ«²ÌÖö>@{T™d+jo¢ôJ§ÔðèËデCÈßuã8ÄYSÑ6°ÍJÊ´jåŠT4EzR_HùÂÂ04Ž£c—£ Òónlªé û¸Çš~0ãгKŽÑ‹Ÿh-la3")H%œÁ—7fÕ!”¹G2#+*0 Ï/@°JF•|Ø ~BðD5l6:]ß&¾F hÎâ·Ÿ¿ñoƒß¶»šæôfÐÐB]i­9‚¤XÙyZ€œ„±}²uë'u»0y)»'¿GúTÿ×¾ó©ÝM6{®U%Ÿ ÐñˆÄÝp$îkÉE|¦øHÅhàáI^ ˜v„ÛóKT6œÉb#B!8²IíÕ¤«Rô$AÚMýPK,È¶Ž‡àÐv–Λ6˜„¶# žÙ u<±‹: ›zÒTZJ¬‚Sf7ÞH¨à4Yk0U®_’U§Ô‹ <ÿ›*úÂH&«j%JÅVóþ5_máD&&õêÁ;­ _b>®~xõos‘|KÃÊBÁB UåÕéñí Q‚D > stream xÚåZ[oÇ~÷¯`žJÒt.;—훚؊XIeºh‘êš\JŒÉ¥²»´ãýï=gn{ÑP¤m5(PwgçrΙsýf؄›h>ÑF#ôd±}Fmk};q×ßeÓ—E5ãfº/6³Ÿæyö|W“\™‰I ½ÐgaæäŠP™9çwåì<ãùt[üºÞ!ö¥Yÿæ›w+÷Û†~‹º,Úré^¾ÿ›û]7î÷ 0l¦»}µ =Þ ƒFsl‹E½C–BÕ§P0Fh†|Yâ@l×7//þ~sñzþÝ ,æ† ˜ÊL…í]ÑF’ ÷ä<£š©'çL&™ë¶,¤,«HÜ‘uåöãŸ)š¤ ð-,°¯öuQÝ,vÕj}KîR & øqt0‘ž1I² !— ]a²i³_,ʦYí7gÐ+'*ü²)«ÛöÎ=ï|ïøñ¶¬ÊÚí¾ân#ìnà{]¶û˜$³s s^އ7û­Ÿ7éþ³šÙïóý˾OÕ}A†èP¢ }·»¿·`)RÀF±Þà“v4AKµkýCy»Y¿Ù”îsª·q~¤’®I‰DgÀ¢U·ÚOwWTòܸ¡;ÿq_½­,#ï+˜‚ GhÏ‘[¸h׎[?Ã*őڷ@ø-€¶øÑÊ>¬glÚ¸Ç vס¨–)­b:'T±¾ZÝ”u]íR¥h_£¬(aæ¦lÝ‚mÒ–2Ö×[kJϯ¯o¾¾|5¿¾yõ|žZˆQAhÆxÍ…]'"CͽڵëÊ@kotBµ…¦M¹òMK(ê®É ÑŽ¡ùVŽðÍ2ïŽ9ì”dŽw&ÓRšô à eèüN¹,WÅ~ãé{WV®¹p Ëu>®õtÁ[[¯ß¡ûv 6`%Â%#Êð¡¾ì€S©¦?;žØtÑzçâ·+:NܲU½Ûú]\€;ë!Q QЦç"L·ÛÞ Õ-¾RK,´Z±Áï ­q_VÖ  ­ÙmK÷+7»ªAßÂäÔZ´‚º…®‹ì ƽZ’í¸¨É¸dZ“l…¤òdMVŠ4)µ› éÍÎ S#þÉí¦g$—’ÛéÓ„+PpN eÜÓVMXCV n¬jÜÜ–íÍý;7“¢C£ÎH΢V¢'ó æË„@ B'ˆ$Më'Å Ät9°_Ëé—Ž,¯˜Q+Ç‹0 ¢îìÿÌ+á¡ÕÎ…õ¸ò2öar·ý¥_1ͳÊûÛzÞÄ6œ3šÉ°á~ãö]u.–yï¿Nµu|÷çŸ €„X„HˆÂyt¥¨Òvò&Pââ×nm3 <‰%µ$ÜÄ]¾wÁ3¥{’˜n-Ðm»BQ×EpF‘]=½¯wèeŠ7ëͺ]— Ä¿LäÞü1n¥ââóFJD{ë#\uæŽ5zP€`ôV,¯Ë²ï§Bø ^ìA DÑ‹bˆRN£>%‚EC¹zýí·©©9ÇÇQÌâRaò6£9^z§¼t¼—ž—•! LC¤ú Z÷]¶x[FŸ0⸠&Ò÷EÏB†ÈÌOöB z¡í*é† #,ÏNqC¼ï_BòK¬,xN‰ã’||®°®øá':YÂGTð{Ûs;„kܪÍäÕ³¿úâc°Ï3b€-œJ(¯¥Þ¡%üQ6Ⱥ9;PCÑùÝ3¯9Diù0h÷3Ødà`l7NÅý¢/^_}5O¬šC×\>Ū¢|°*Èö«Gdíê Ãó„_ÅÎ&]ëÚãJ»XþNJ›åà§aÆ'PZœŠªÿIÍ äFYö:›Á +=EiŸ`Ù ´ƒeOÕÚƒZt@kGÙT_œ²‘W6 °¹·ùp¹°…¢vEJþ09°Ým`×y¨™©¯™¡Å¥ØåÎÏðÕ×/\‹«òCY ×` œŸœÕ@¦‘™.žK#Úi'·ä,€aä1ÜëµUÅ€ùÀÃr·-,$¦¥×ÓÌÇY—VºW¯éÒ—í½9¢¼›I(9}RذÔJð6¸…,'[ø¯4GY§Ù쌟 PÅ9ˆ½0—é£4¹’b£9ýûÐBy¿\²`WáåI ¨€{Û¢…DÃBg.Ù&ðj‘*¤]$ I‚öLlry§D`3Î:ƒ‹ò)ýnß6ëç·w!ýÆNÚïÔ%oB2³²X…‰<è°| ŠÏv´8å€÷EzçǼ¶ÀïIh‡eP±çB; æ|:dz(";ÄìòjŽ0rj¦ äœÇÄþ'[u™À®p¸(üCç±ÕB7Euë`Hzibe–ñQ8/Räæ}*’i“§$YfBÒ§ãh,aæ¬48C>” ÏŒÃìá×Ö>øà}bÓ8X›Ð!âoÇ$¾çˆWÛ÷µp?Á@†ÚäÓï „¬~€ƒþ¡“U |@¥À_«}zlQhü/È=ÒDŸÀkû öûzݶ%R‰õôÂyå{gËB\]@u6‚ðœþ\Üî®hbqj1qß(o ñ«,–CðnŒ’*C‰²ŒaKÄÄž‹6Áܹ_W-«©ZÀÚ ÷c‘øê’Ž^»5C%#P'®Å‚ JvØø¨o0Y¥ÂqÊHæ61S«^ âL×k 'ÊŸcàP8i_7]¨×°ÈbB>ŲœjØ6XöH¹³™Ãz$4¼æhÅÆ)L' 6©rŸlzß&ŽÖgরø{@æ’äÊ|j©•„Þ!ÉîŽë:⢆S E FÒUHt :øR¸Ÿ^ާ]Š­Çé0.JÀâÎ÷] }à–Œ&¹é>“Í8·7¬éú…Þ¯o>XÖ‰ce8'ÝU9¾JÄa?óÚOÛÜíö›èw}­…©p’1اÞýÒ4µdLâñó"<• Û?„t¥å»bsàÌè#ü¨ªTò‡)¢”׈ù05æZŸz.$d¿p:áj„ÇØS(qFÌ@±ðNÊÃÓ§G%º=šù¸ÀtL ú¨@Õï*ÐìæàG×q‰ öÿ•£Ch àf(Ñç¾tÞ1’Ìç”æ‘piáÀ3×äòDI»N¤|¯Ï¢Øt ÌLfE€0JëF½ÅÂ&W]ya×-Ú”(DÍ?âxTéìa(Â0•wIÞ¹aþ]q$ûGµ£›„quô<èÍ{GŠCÈ1-Æ]ɱǢҋJ}D†ó\xXamUÉ…kð=F~T0Š”Ýõ4¦YWçŽ #}˜ñ°4.{Wt rLùt³~;;ˆËæÕõ*¶«tµ«÷Å B°•>å^áa±«=h{U-Ý-Êûèõð+åþ´•", ; Zo —CP:ü“×ñ½C»¨‰¦úÓ²¸$‚$ûI™õ*—W/.¯.çÿHM¨5¡]U†œòÁU0nÏà“h4dÞÙ‰7Á`'M‡|…e¬¶óƒçèÂôO G÷f¾¾˜_¤/Îbºz'dBfèÁ¹`"4Û_~ÿÝõLëé|¦Õôâjþ§¤¼ÀiÓh—VC6@9hü“ ©+è±G *åïQÁkÓx±Ì¿/k…9›8ëÆÞ’Âé6ïQùÜM ß³HO‰ÕAOè ðºîýtD…<ؽ÷ ÜÉInº%DÈXÖG}÷•ep†Á"ŠD˜áÐ5ª”®‘>¤5xÜ¥O-ü­?x¬òÿØd Ÿn?ˆÝLÆ~ûÿb.àŠ@@tTÇK†…ÿá3E{Ü Qq”ä!=ÈéÚ¿:œ ¾¦c9:cÕÅž}R5úU•È.OÈéÁ¸*‰ÓwW=Q %D棓§îçŸuCë3" ‚VÿWE¦ endstream endobj 1891 0 obj << /Length 3415 /Filter /FlateDecode >> stream xÚÕ]sã¶ñý~…úTª=!@€dútMr©39÷ês:™¹Ü¸´DIL$R%©s®¿¾»Øå— Ù¾\šNÆ3¸X.°‹ýå,„?9‹Õ,N´Ht<[Zof4¸úú™d¼ .F˜½~öÙKcf2i˜ÊÙõzLêz5{|±Ím^ÏZë ú|¾ˆ"ü-+W»¢ÜtU4m]ÜÛ¢* RÝÎÆ?æËùBí\Í|¡”•Q˜ù»ëož}uÝoÊ(#L¤ŸÈA‡}ŸdÌFb…Œ¦²"4±rñêõ߯æq\Ïc¼¸¼þ·rOF¨ÐÂbôr&A»Íi°ÌUkúÍ£>–ˬÍWôØ´ £¬æ'¢“Ñlzª»]ÃävwsU•Vçí±í¶  .¤ÒHÚn7tä˶x$r:‘÷s8lwÌ>!ܼހì)g9L$(e$tu‚8–ŽÁ¹‘0‰?+Ÿôl(l/¼±bü±-©1 ±2I…Rñl¡´ˆ-½U”í–<Ö7Žþ_Ö7MÞÞök1Ž—Va(B¥»ÅMÈk¦c´H¨¨Gúîò»«NÿÝ+™SaC3³°;;{û.œ­`ò›Y(¢xvç0÷3-TŒÄv³7ÏþÁz8YMÃéØH9RÖu«~yñæúêOÌÃD ‘p:>ùùX Ð2î°ŸÓÉ.«²i}´5è‹Tör›Õ"EÒ‘(N4鼜u,,ìc³ô)Â"Ù¤é”èõ¶ý‹Œ Ö Kd øt¨+ÔÕ÷Å*wó:Èx&Ûó)³A™x‡ã ­äÚŠ~AAø5úyýê% PÝâ6÷ ¤(BùÜ'¼#’¨—€ðQ¹Ç¶G sJJãÂI‡×I'£ƒ‰”åédÈ熼ÃÙeKç•#iÜ,úb·Û¬¥è¢¶YQ6Ý\NƒuUïqî¸ËzÀ Hî9SÏóS­<[°(uŠƒ[˜!°,@ÉÐuO!cÞ½¿ð„¢ÓeÿoòNo`o`-4xûržhpàÌúÓc½qòy÷œ„ªÒö£N´=Û°£Œô)·€, «-DžGÂS‡¼°=œ›¯; ôÌ«Žn׌¸°ÍûËvMÕ¹nÕù>«jNÞTÝN–NÓ©[÷ûXŸ®ÊHŠ0é•c–`[°àZZ‘ZÅ¡Q¥Ê)µJuPV  U5Mq»Ë „Œ8H“!Ûî½õ³Dk§ƒw³¨¾wÅ2'äy £z2º'3ö8ø”­ù J擎”Ã䬘:ÏIXc}@€àÝcߓ߽¨hb‘rH”O‰‰ËÕoM¢à5õkÄD$emüû‰‰çåüé1ÎváÉÅÄb"h?…Ee),*ã ‹åpaQ‹ø:=ñåË¿02ÛU›êØì&¯ØsÞ ]ÇÒcƒ#Àù±Aøs·©dR8‡X=n´ ©qбùÍcópÊ(ÁÇö)æ1lîœ.©|¹[Ñ +µÛÚ}ÅîEHuäÑ¡©4È*M“Í|Dxˆß…¦f¤)e&Zöué¢KAÙ9yÑÁú $Dè’(¯)žØà5ئ8†rŽfÁzhP­}’R*cŸœK¦"EJß8…-lx—%ß3´nœÌk¶^0}ì`I¬³eŽé„–ìtÆ¡Sí]åDƒU,Ïîó}U˜WtLˆ¶:.ói¬V¼^¤KšmuÜ­h| ?qÀa{]ç9Ãï¶9Gæb’6(—6 sᔫcã*míJªð¶›Ÿq‘ë|DX¿q€D{ßøí&‰Q¿Fd«‰@ë# tpxŸYµ|éHAâý ¬ ­ ÏvcÑNWJb‘œ.ÄJìu:6Ê›ógîEIù¨{‘P!`Óh¢ooœÁÚ¬®»«¸²TF;9XYCpô!¾º;•¿´Ò„z&ãÍëœV)x5Ì ð÷x8Õô¼+öE;lÈ °6ÚòûNªÇ=ÐíäEbKÙòp³ 8œI•÷UÞòá" wýl°Ï–àõ|åh_›û!ïæÕ‹ï_¿¸zñê·”’ ãIÿZÁkÿË»„‘Uã”++oÀðÖÅFl}ÄH†ÒåÌ6z¨SÖ11¤À‘$®4[+ú{Èçƒ? Ç–ž—¨l8¸¥@JÓÜ—(7Î-Ã,½;÷L`v€èq¨ l!:@Y•e¾%²øJ¯•I·F-œµBe¤ƒ oØÕ +ésBH 5Ói¼~RòF&ŽT”<®†©©7yëßq§àšcsrõ¼ ƒüç%DK|×Jޏf ÇaYÑ$lL<Ûc#„=Ngè4p°¬…;%À-úÚº¢É32ecÇéÓ³š8îý–»°Á®Õ ›Zò†1¥ò(¼‰D¢§5F^×eu&„ü4.¸â × ño$!rDÛýꪳßˬWQ >nbï#rŠ› ¼×—rž7R£;ɉ BX×ÕžF”ÞÁv%®^\Ò3—Q&¡'RtÐ8 ›Ì—x¾?9ûZ¹¯ M¢–«×Ï})y?ÈAWÕ>s.ŠóR„)ЬøÆäc xmåB>–»¼áœ–l›1€M;gÂn—½ÏCÜÊ;çy0Î>½:•§å)³é+O­§¯….°¯,“®oƒ ÂÇGƒÓîhpP8£{?³ÈvÅŠ€Ü†‘4ŸÆÃÝLÞÙÄo»TZ[Ë!žìŸÙX¶„”+‚8ßn1¨Éñ€¿çt?§r<–卵F™( .«Öµã…ªD"²¹ ¼ß‘OïvÀ&šm¬ÁcP?3 š#©3=ᥛNî]=¦Î¡54Üâ-%U …Xr×4 غëŠRHœ Ð;Ýå–UÍdTåŠë®ûj3½¿/ó;ŸN©r!3Ö©sÝ( ‘w}Õ4¡: ä6ƒªMƒo™œmqÿ7Ѽi¼Æz§øXD pOçÀWÎ9¶›q¼d¢É œ &zb˜aÔù#5)VQX!2Åô°Ùúòuvܵ§—”Âw#žô—÷¼†¬j°‘Ö{•kÀ8Âxt•ëêàMÎòA ©ttYGã/TñaÌ;Vœ7O‹!Ëí£ Õ:g’Rmûz¥ñW« tÈ$O.W7ÿ‹rõá6ùˆ6ÏI 4mó<^J¨j­ô•’žZrÊw Ud/ù Z““Ët×RÒJùòQœt‹®¦x '〻ˆD9Z€4ñ{ý*oö…SŸo½,q«;ofÒ´«W}Áî~ÙwF£oBÚçÉ¥‹5N †XƒDÂäï8}ìû>ÞìQƒ¦[?AX1$qé$+ÿØ”ñò»o¿õúv¼#¹wA<Õj¬!BDCjœ üâ{õ´{i¡vþU®y’NÌoÐzr“h—¯[ï†}:UpM‰Hå´ËU›më½$ÝIÔ£¾ʈðô~ÚuŸ¢/}£Ð ä\ paŽàøH®ªªW”}Ä}šî£7îrûa>:[8ók]j¤…5qwÙëº.‚Û¾»Ð6œÓõwÝnz_”‚ÁœTzÝWWØ­J¸ 4~†ÍQ;ßL“DWÿ¤£² æÁ´dªªLÊ @uÄüûϱK°ÑD,©±khå§0HØóæ˜ïõŽãâòúæÕÅ¥÷*=L¯©g\!¤˜zè;8j/¾÷RÃï4ä ÷ôõ‰¶CoïìçePê(Q¬6<Óš‰5$mñAI}"²Âžxä”sTÌØá—펓ôMgœ»aVŸùS Ÿ¡øì~ZЧ`™ý]ÙDû²ËÞ ‡‡ôœÈe¨E4¤P7/, ‡¯åÆKÐÈÊS…÷·!ÁÕ*{¦“ñæ«k/Ó¡»$ ãηfºö’»;¸£ö÷ˆ¸Wtlò®iÔáÓu’kQ1RQ.á¤Lp»U×'³¯ÿI¿tÅ€Ä?–Öן€lÅEÈܵÕèsÔî ºý*ºô늽`Æó=­‘ÅGv¢Gr!J@qSr¶@ ¸œÚ©á­äNˆR]º§‡ó›fl#KëÑÓÉ1/:¼±QþÙÛ±¡íÓ”¦ø÷±é›U‹òõx2#d%#GzÛË":×Ãw˜û@h©ÖôpG".Grp`G÷2ç\:|¶÷ƒ›R«y—ýIP}V̸9Žgº'ŒcóÙawl¨M/þʨ,Zê8H_—4Lxò%Ô—Tä~NŸr½õæ•vü!ŠWîFÄ*™øèS"à=­ýhwÿNtYàf`¢á endstream endobj 1900 0 obj << /Length 2816 /Filter /FlateDecode >> stream xÚÍÙnÜFòÝ_1T`uØÍ>ÈGïÚ2 ^¯<ÎîÂ1j†#q=C*<¢8_¿u4Os$ù€³0àé£XU]]wK®Bø'WN­\‰8r«ÍáIH«ÕõŠ/ŸHw €§#È¿­ŸüxfÌJ†" ¹ZïÆ¨ÖÛÕ» ¶'§*‰c¼}õV\<{urEQð¶Î*éàç´8QqЦû“÷럞¼X÷ÔŒ2Âè葬uПògWRŠÄÕñ§¬fþò¢9Áoƒ¶h«Ëm^7ôÿ¦º¼ÎšËmyHóûñ̆ãsª0¡Š€6¡ù54!ƒ™d ¦…Ò=Ц,êÆ#›0¥b`Ýt` ¨‹ËççoÖ?0kÄU~Õ6yY,‘&6ÒÝ÷OYÄ9ɵùa‰ À'p›2ÒHþpŸíš%ü YÚÏ@çqqÜ}På×7Í’ #)¢XD(=õ‰FJi=¯ ü2ƒkÓRÍM†ÉÌÓRZly “¼~šè‚²ÚfUÍ+åŽ=øû¦EÞd ‹B±Â¸þ w49…1"ÖI-NN­K‚óûèçžÉ¢lx¡ÎHŠpyR ­Üôò²?n÷ù&oöñ˜1ãTÎÑE¹ ÉªßOŒ ÀÌhûgÒN)´Â&®ãòüÕúòçóWKÇÑ ýÉ  ¸¬Ãݦgÿ~Ó{fŽ¿i]·‡lËç kÅÕ*kڪȶ D­l𯛬ðà øú—)–ëüwÔ‚ªAx’£L"pÉTŽ$7Tðî.ÐI!*\Ã+ AÚ6°Ýä›tG˜¦ä­eɺP8ÕkK¸¨"ÑËþiÿéAEDp.6"=S¬ÈêÁˆÂEܱÐq$ß †q" 24e´Ð ME"ñâxžU ¾Hx ‘3ÁmZ¥‡¬AZ ‚09#úzMµەû}‰zx"•Á5®:ÆE: s±é׫Á¶RVN¨AuÑÖáÊ™8ßлƒ«ÏX*Þ*‹Œ·HȰÐtgu±åäh3¸4::ÍoÒš?öÔPÃFô{åM;Û™¢m›´¸&ÉÂýb IQ:~ÞkbO×{Þš÷«ì·6¯øë$ì·ýgÚ(kb 6ÅMIœnÑ׊AOÏ ÷§”Ò=጗‡r›-ùu;Ð£Ï óºøÿ[ÔáBÁ@ÕÊ$VÄNcH÷>\maó§Uˆ4îò°Š„rˆl¿zóäŸ>îO¨E¡aœ*%^¹9È.D0 Ù=Î}‚Ü J· ããû11NÃîÑð!T„¡™„Ç7Ÿ:ø \ÉûÒ‡ÐçF²-V%¸»G*S{»ýŽÊd%×}eT¸§¯T¦é§ÊtüÚ!ƒ3ÖN}ÊE¶)·mƒ×8ï ;Q˜’³óûKùd”ïÉ—§6à|Ö7䦀†H&w‡QVüÆmUÞ²ã¬(†;1Ø›ÐdžÁÉ‚Kýo¶iê.|á0žJ`W•È ŒwŸ8è m¢`Ÿ_Uiõ‘w(Ńߺä"­¶<ó´ÁùšWï(͘ Þ”U•Õ|†²ØæÅ5ÓØµÅ†G¨œÙ 'š¢( !3AšïÓ«}b‹eüWwyM(£Ñ_Pëk?I!h“ë¦è F(\¢{vtÏ8ý5”ºØbÜÀ%”(åNHî¼á¥²ØäÑèŽpêïÈa(…„dÒî|p §òo‹¼S¶.ÕWéU¾ÏÄíÓÓäv8JiA†‹D|Z‡¹1eq ÿî@PY½”[)ý6î틼KVUE¹¤¬à뢰Ïú‘"62Ó”KÀL¤&õÙ‹ _£]>¶~¶DI†±ˆC^v”J7#£Ç:Êëïuu Q7þ&ŽQYóä(©~TF=#NH­ÕûC-«³ñõêaÒDã«=ÚO«”©nyžz€ ×°|W<]®3'ÉÄŽGÚ™¤äF2™ø)râ*$'N™&Œ©Ð‘ ä—`­nÀr)âàÞôÇÃóëÎÏ„>ïPÓ‰qP·› dÝ»v¿håVQqòˆŠî{bሼ+yæÓì2Ίp¸êû} §^É,ÑM&‰÷)É1Ÿu¯ £#>åå‹õ²K‰FÅ2Jr:´t¨³ªŒ©uä‹’o ­"Ø.6ÂW+äÉÝgäÜ †g°MZûÑÝ€±&AU‚úƒ ¿¾Jp I4+u()¡ø¡“%%Á8-iÎ!‡)Æ:nXp|ôËÅv†‚¹Ä‘ç‡Èeßõø³?À<Î4Ƙf)Rk–"÷~/F¾f–÷j!]çÍãÇÔP·‡]ݾ²Ã¨îwèQ˜@Æk Œ%"”ö«:H½(ÁŸüeÔ¶lñú—Kˆ¯½¡‘¢„ ¬’ƒ„­pÖ.Q $| —œIk"Cƒ’3¸®—t…7l½þùLðÒùnÑIkÌ'ô'œÏnFOü`,ÊâÔgœuÞøÎˆJ‡^í¦ç±û¨îN‚ö³Äuã†í”„pjæ|QêÆd¢#x„äËÊ©o˜y¾7ó|ìkxñTBØêJú³“8¾ åÍ>}îôã”OËݸžà…M•¥M¶åÉ•OUqìó}7.$ܸp¾p“Bb ‹úÓ°bº]JžÓ=ùc*>¢·*¨oÊv9€•˜¹óâP¸Íú· \ßýÇg&c£ÇÏ”‡‡ãŠÄS¦Xܨ½î°½ŽÓ¾å†në]å×mÙúrM™\Ç,XÖù6;Í(BA]'vªê%|§=Ò©Bš/û&N5t"QQ–¬ÁˆfÉߨ›žÈÛ3ì_peä¹<Ñôp»agé)E*ȘÝç×±…üº`ÞeÝ01Ì êçEYÒ}þgÚá­² –‰',š²<Š´w¥Ú@ée²åuÎH4Òàæt7ËxÀ¾x„@¢]9Û5H`Å7HfÜ )ç(ZÏSX™tC >Å¿…ƒ÷R6¼î”;þ¼‚Œ‰Ö pçŸZ|žPK=z •{ m–ùE‡¤Ë?¯y:š›à58TÔ-ßå yÚ¤nGÞxÁóó }ç‚NßߟŸ/EODÞÃÕùá–RO sØiñÂîOG×v“s¯}!]lY CIÁ(„/Í;‹ÁUÐCê£L÷œcÓ§Ô²Ú®9Bð¢ütJ_Oáˆõr„«ûkzC„17sJÂUSkO¦‹„Œ±.¢O!øS %´}Žî‘.ÜØ¨ºÂDZå,Ãa¤yt›&âýìùM+©äØ1~E›¼‚Ã×]=Í-ÖÝ“*[,À€–qÔ«yÊÕ»Z<#C&ð¹MÁÜõ,qÒ?ÚÆ _ŒÕzc§Ÿ"^¸!o&ø>Tòr¦ƒ¢Ü¢vPükgäÍ|ô–y‹½„rÕŽ—=¯ÔÄ}j¼ÕuOǼިoÇU,4d=Ò9+_WEØ¢„ÊJù×Äq«E2ϲ¸Ûåd§_’Ãù~¾>_ÆŒ`B߸Â*'>˜D(}y{LißííÚC#eÐ-xÛ ¹æŽvÀ”…±=šû?¡ÐøhO]õ½Ù1z¤Y[)Ї¾Œùâ`x‚‰°}-¸_N 0„ºéÚQÜ£ñÖ?ÔSNDJO<Üù«³óWçëÿ,ñì 5Õs–Ǿ:>æ«A¬ÐJÍ›ûß×g¿|t1ˆ6ý?ÌÑ_ endstream endobj 1911 0 obj << /Length 2927 /Filter /FlateDecode >> stream xÚ­YYoäÆ~ß_1yãžvŸ<öm³ñ¡À­„ ° ƒ;CIŒG¤Lröð¯OUW5Ù¤8ÖÚÐÝÕGÝ_ÕFŸÚdz“åFä&Ûì^H?ÚÝmèáêÛŠév@¸‹(ÿzýâ«oœÛ() Y¨Íõm¼ÕõaóCòú¾|ªn»3Æ$îåvg­KþQ ÷ív§³äÐãŒMn[&¹«šª+‡º¹£÷¦mv§¦†ùèÊæÐ>Ъw[—&eW—Cû(­ò4ɳíO×ñõõxk§pÖ|"‹ú Ÿð™ ­œ |Z+ŠÜŸn»s© œEœeŽ9ƒ‡gð>ç ˜3¸ýF¤Ùf§rQè‚Nx·…ý³@´”ü.,Ò™PŽÖ¼)£,o»–…X’üËn¨÷§cÉÂ?ÔýÐÕoOCÝ64ò¾îééæòF\½º¤…]õë©îªž¦†ûŠhÇv«sXFgÚ¤ªÇþ¥gʉîµSðË×Sb»KS™¼î*àjvµ§Wiß‚ˆ]òßj?ÉÒɾª–êÖN rHs Y¯ná`NÈþ)íõ>‰ ¬ßE¬úò˜§Önéš?|zݪä8Êäwyëú2(çŽEâÜ’G[!á>1çM:P?ÃÑrSÏ´„êÛYМ²¬@EÓš5ø¦:²^F >°“çÉÇ~Øê¶DlÐKXDçå‘zyÐárf7†O½hê¡þ­.õo°Ns2E|`oCçÃ×hC8õ¨r£4–‚*¬ÊÎujNÝÏ5œ³ær gm L’Ïâ¡H­[§’¶ÊfuC› £Æ 1Z*M\"%Œççö,¿^W:w"ÏSš`ÀÊ Bc„U*AYX[$õÝ=z-¿Þ–õQ¬‰ìCgŧI&‚(“vÕpêšž¶/×¶¶»Ô(§Ë›ï¿_Û"[.³@õè«­w4Ü$Ò€Ù ¢Ð}½Ç¹{Þ+›éYJ‘ãfHxêW™Ñ ™ʦe9½õçWôrê«‹/èÀ8°X»ÐAÏ™} Œ:ÍçAѲqÿ­+}(ÅäPx?–üòІ8œgl8Y=ŽÏ¬Èê=)¯É“}ÛA$ga6&ÈÇ›òa§fÏñ æ0ôªåªÀBÄ%íVñn:׉7\ø%ƒÍ!i sƒ =Í-ýÆñÑûˆ·©£dO;ì[Ò<À©=õ w]˜b¿'„¡bR÷q@BC ‰Y=ÃÇ­Ì&<»–pïQÈ\Q¯ ± œ]÷ôË èûú-*‡ ]¹Æ†q«¹ hYFË0 •MO+<7>ç¬D JËR=‹nwÕð³çco…sƒ)G0)ÙB¤šÔAÎSä{0…¸¹Pà*‰0Ì_èå_åù¾ø(8Ý[¨Ì’hd1’9³qV m³? Âú]´ÁX³€FpaK×õÐèȉxƒ~%2ÜÞ ”–-°’ZÁJ*XI­a%m¨ie@L=ÿõ."_C‹Mì¬ÉÁÆù.q4ž_|5!)ðÊ|RBJE®G˜€N½_ºªÀSÍ“;á3û…¿Ø-ƒ†,®X4ÚÞLÊE–ç3o¡×"5i F#]ÅJ;-VÛY¸üÉéäõ ü„"÷ù­ø´mL–ƒÂCPûqª 9–°Á3Gôå£á}˯àÒ Ù òKý }æƒ n2R@äÝ1¦+ÏÅ×aO 3æÛ_0¨UßãÛî°&@¨€…ËFA_¡äÎ*Eð8âÜ1i=Q \QØ,›ãþOS‹‰Ô’BHºšL’±¬UÖK j ’D~ƒã³Âb¼ ä„W¡¸A×#¯á…Mµæhž2’£e¢0£Œ(W{TÄ/t6{Ä®|GéYì"ØË5ë“K:²{λòáò.÷¼w)å¦0Ÿ«H+]òortOTê‘ ¨¤à#N€Ò/l!¦7U€!Go×ñ~ä•^|à|Íjº–…P“©ß\Þ\ý|qùÍÅåÅõÎdëLؼ˜{ú7hÔ ÖÃq9KA=ú ‘·Ýj\t¹péx/¹vPnùÝt‚{Ä](Ò|¡¼v E¹LF<îh ä<è5iòG4œxçCH÷%Aúz SëžÁj ª6éÌ„û¡¦pi–Õ7~Z²âpF !ËpXùø;ÍJÝÇù¾q cÚ;À¦lÞØ³ÂX€`¨`ˆ}©o~9•¨­j„ ÈÑÞLf§®eƒÌÍK' :©!”±¦CéûmJóQWÓî¾Öq•„ï>ïoô7°à.Ú^ጦí¿Ù(̱C¿»­ Åí£ð¡À«žVÔœãÛ¯/¿ØbwsY¸§ržBƒÉ46O>¡˜Ev&v¾€º~pD0ZBq¤~øIn0 e¤”Í{Où°Á¶nvܼyñ/F[ÅmeÚ­$KüŸh㯮¾`&fü%r5†Ï¨äYa8ÕâmœWǶ©ÈÌ"i_DÖi/Òñ'Î_ð:kfír­“Wh8ÕTûªïK´{|­ì‡ÔS‘„oo}ËÏ‚ú±‡ý}ËÁ¯£_Ê ð0µÓâšö\H¬eIù4OxÿÇDáÃäËÕ¾O)f”ü…ÏrXdÒoÕuä.Á’´ìé™Rã~ íÀ+Vc+à^™=ß%‚L<rO»D¸ÍGSŠÔ¹¡â‡GLàß:ºIøB|º Lh@Ãu¤Ñë­îDƒzÙPЂPx`_Âþý¬¡ÚWw jË)zÞ–§ã£·U-Ò ^ͳìŠì „O›ž<þƒÀ=`ÓЦÿ>e•ètW:‡ïߟöžLýöÄ1DBí_VÑ ßäðWÙúG©,Z ¢Ï~.YôKŸo›å¬c”îÐÞ…xÕm„§Õ¦´²ÜéRäÐ=7\.È¿Öz*…Sýö\KÅŒšŒ)RíOõPÆN%Ä|žÃ:Õ{X‹¦hh噂»–ÆÊ9$,Ÿ7ažrQ±,Kü=`ºäéÅ÷¾î+z­yõcǪ<í+>²°G °5¾õ;áÃnÙÑ‚©Î~Š"**5š([EÉÊP²B½¬'¬Õ U~vi G-[?RrþÆ–lÈPð¼èþøÙ©û#å“ÊÖ·UÓ¤÷\¡§ÅÔ˜·`Àøqë–¾µÇ ³0’Ïoÿ@¼´ÎýŸÛ?¦Æ¥¢)7ëþùÔýÁ*÷7°ëM`7%‘á/¡Øtæ!~~ÖJ嬯Üʵ³)ðs} ˆÊÒ}â@«ÏÁ¢€¼Éÿ #¬]Ô « —çÂi.B†ò…Û››×¯¿~óf²ùAžÎ¥ÀßË޾xM0³aàÁxØïÿ/7› endstream endobj 1922 0 obj << /Length 2996 /Filter /FlateDecode >> stream xÚíZKsã8¾÷¯ðÑžjsERžÍvgz²5ãÙMœ}TOWJm˱vd)­G2Ù_¿²¤Ðv:Éìi+‡Ð‚|E'üщdss9YíÞúiu31ƒ‹o¨¥›á¼Gùçå›?ý Ä„DŠN–›>«åzòidz9SqM¯WäâûÅlÎ9Ÿ^Õi…£púsRÌX£†G |!äDpÑ?Øv)5pBH1ƒ¸åÒì×.w2{£r" fI&0s~úLÖð¶7¹×”» 'L"³|rùæo6½VƒÃj 5«P™E?ž-¾³(s}–¬h{OñìUD$ŒãÞV©W«L†$ïk]¶:˜>èâoãW«"1eOQ+;¥VE¸]J„|™Z#8÷\sâá´¿ªVc Î::á~g½8àÓ)‡qÌ_C§a@D$&‚Ç$dá‹t†Ò©fEcõ­ùj­Ê^ÔÅÐ`¼ÐË:”VRM<`-`Jœ¶×üäS¬µKdá˜åÔ«˜+"qh ö`˜.Ñuƒ‡‰O6@B9¬÷qg…ÊNÈQ/Òi ±£AÃv¢8x©¤£š&±¡}6¹½5ƒß3ã©iÄõ'¦²ªîÂçNG»f‹X kÒÁ¡^¬[nmÐÚ”yn²m†íbÛºÚA|qómXp)uÕV•ÝDþ`¨“}¤ÈòœÎÆMˆ’ýÐG„¿TzÏ´v!ãÇóÅß­O×i:nÏcïQDp¦¸€Rߴ牀wC(S†}úá“~ÃÞÍŸ÷x.ÆË„Œ­H§zA8F!ŸPäÏVæÛÄ5 i ÇÒó@’jé¾ô‡/õ YÇLµ¬Äg“9UŒ qÇßb–ÅÓÌBc"ì<ß,{ÇÌb©üf¡µËÂoúØ.p Tã}ñØÅRŸvÌô¨]Lhy†]þzÜ.B‘8ߨ…~»]ìüyÏ.£eØ…Y» ÌŸ!ü¼5¿{¦aì±i(‘r¸ƒc¦1Ô'ä3=j0‰pGF}‹iÞ_.?;2Œ@J›°ŽmÀžqdÌüy÷È —ñ›&´–A‘}‘LøÌB£¡ôÇÍ‚Ô'd3Ý›ïó8áJ ÀÇrë`l•~m³Êq…=É>VDìqÎi´Ü¦Q27iЪϛš÷9@‰ß±(6hŸåW>.xl~© ‚ÁŸqâÍüy÷Ä—ñ¹UܹHìñªøñaaÓìÇÒ£&>!èˆeߥ¨µr9r)WÞ™YËoˢ־ʬ bÓÝ ]¶UÝ6Ž--iZZrjï WIݸKñ¦ôÖôXÔïôD÷¥+J½Õ.,ŒÌã‹ðgÔ¼Ý)ën°6Þݵ<†…¯¿¢ÿ/|‡…/ø¬„h uê°¢0…¢[^±í)#$üwmxu jÕ÷íP̈́ھ­hnƒb iV<´©±ûè@KãD9_,KÂ1Nǯ" ÛÆCQ~þþŸF ÝâMí +Öæ¥³:³ýÃØE€]ƒY“m|nEÅ Ñ~ܯn6¨š5g÷ÝAÈBÂ5þzÃJº~­Íw%xeïeS¥ÞˆRºÙð @ >J#I‚^Ÿ ¦ð(‚lñ¢ëÏ¢<ݰ€Ü*ZàCïz¾ ã¨Ô^ðvIàÆv‹Ã_#¹Ë§šûÒéj­¶Iõ]¯Á쯳bSz\ãx$^ü:‘2DC/²®ºé†œ øücû[6’úX3ˆ8¼KWÛ4¿õi €úâôÕ“D©p >¦øIQ °ý„ÿ°É„áÇ÷Y³5#4]µÓÍíÚ’›o6ÊÖN×~…ƒ½_ùZRÝ{ý²ã1(ÄáÌ#É\“ú€Lº„_N™­`kÝl©4ÈÝ£ÑP'|¨º-L…±NPølk_Z) ú#ø;œžû®ÂOÜ<Æe%8IŠ÷r¸÷3% é ¼¼¸:órb}¡s å.@îm¶ù¸O»:mšnó·I•Àþí›ßØ,3*hŽQ¼él} 3çɦ-Vû ÝS Ü—PöÓC‚l{ÓRv3$BޤûpÎÞ¤“Ue1*e0šäÙo†Ö{)ĉêä…2ÉÙˆ ‘’#À³b°Þ­ÎþûÑúmŒ|•ê1žË¢1ú¤aŒÿùŸÏŒ endstream endobj 1933 0 obj << /Length 3184 /Filter /FlateDecode >> stream xÚÝZmܶþî_±ùT]à¥ÅWQFQÀiìÔEã¶ö¥ùWy¥ÛU²+]$­/î¯ï ‡’(Ï>Ãh³|×p^Ÿߤðßdb“YɬÌ6»Ó£Ôvû 5^óˆûu[X¸ V~uùèÉ ­7ðŠãê»÷4ÎY®µï) Kµ¢{ÖÍp{“ssî®öÕpUÖ§ªéë¶Azž¼0iÈ&®$ÓRÃ'ÝîSÒ2‡Ë@Š_´k›~ð‡-h(žÎúîÕw¯¯¾yþêK¢Ç3ø#ƒçLÀ!3Ü“±êVXÎT Âç’qÍiõ7\Y ‡ŠÍ…°Éù„ÿ ⵉ‡d«½lY~?tõÛóG0¸ŸÌ“V&m·8&P»[ýMxÇÔ_ŽîeCΤQ#¯êÞëc5œ; f:r–ËV 3øå,ÍU(E'šÝ¡è¾\i ˆ«.£¢2–ÅÿW4F¦†éÔÆ4˜V—èJ– õ)W<!ñÄ»”Óhþk¿ÐvqNsÅx&=§%}í š¶oª’nu×@Oè…â¼uç¹z¯ÅÃxmþ£¼†u©á^ƒKÌ=³­g6š¤v¬u­Ðç¢MN(ÙGƒ¥IžòäòPõÕ=‡ö~¼èÆeµ;B¯78«›ÌÌSùϘ)J–ÊIÑûn÷„$Õ?q¢ƒŽë±CŒ\+fä$ºßÝ£.ßn—–¹Öæªî¯êæ\î>/n¸ýßÑ“ §:—wß@§Fó<Ükç·¢ìÏ`ÑDïåëïžÇ…à¸úšÌ”B„æY±Ýx ñüùÏÕn ùúts¬N^‡¼+-?çFß]¸â£LŸ¼FÚ¤|ç!ž{ô<žšÐñxŽ"Á‡¢Ù£ºêÜë-4nŠ®Es û¢„ –—ÂÔB×誺©‡º8ÖÿZšƒ¶t;3ÞN ž¼j‡z7í*†˜³Ü»Î[Ìñ½—V¶PËÒI³šy¬yRQí7,Ï&Ý cn Œ­§‘C1[¥?˜~–×v#-°§CÚfy6 ÆÁA¯?´ç# I§“ìðÖ[«XŽ–Þä)l–ÜÖÃ[°ü·¡BÃ;ˆ5ðA%SÌ9À{w\èÄ€‹–ÂÃ$ —Ì QÒ€;·Ͻ?*²¡DqºK[„1Æ`ûTüâƒö úÁ[¸JÃàÇá>¸ê½?ðzýÁšÜgCÝuUaí;G§8ßèG§ùóäåzgÙíä+ûyJ„ZdÞc=bí<ä l(¥’ .ÇsÕÏYvDUÀ1l¦“Ð諾R)j‡qÎ?Gë0X’¹£df¼.w¾’ã ÃÂû¨÷Ö`“>¹"r’å<ù€¡*óáì|ꤻާ /Ž™0ô¦Ñ‘”•‹¿ê/ rßXPso¦’S"º‹Âx3чà .èÃñ‰}´ 1+6zP¹ÊoqÊi£ (ƒëÿÕ@ÿqÞ`XÕ5Å‘Êt¸è¡Vá4rŒa+^|…œôè¹ø˜PJhïy]™Û„XQÝÐÆyœÏÄkça˜D¾þ\A9@]‘¤JuWÄú¥³Š†zž €tùFÜTâsB=O ãúð$ný7TnØÇÉG"¡²LóõL_ùª"ÕzÖ‘Vq«>Zoäf£¹%ðBT.¼!ç´ô{§º4õ‹{h¶i>¥¾˜ œF µ¼hs>êâÔ#÷ëÂ…Bõç!‘+Ž´UÕP+CÃ%uÓUQúÙëåçCƒÂñ*`oNg±·(Ôø‹…šS¢Ý`ÎŒAcÍC €q~[™j8¸k8ÑÌP0aÕœÈÐ>à6²ŸÔ£ñó[ïpR½òÕ0à4¿´ÈqeG¿.1ǦÁc×X”TáÞëêö?³·!ëzêR] ó í~¡^ÑxÖcç^ÃÍÑÌràÖ‡Üúk@ÖÕ€ÜýaÙ5áÑ“ÌSºdæQÛìÀ‰Ћ®ßZ3T _ÿ;Ã!®îPECé¾èÞ{¬½YÊ_rZŸ¡ÑΕ ÑF:Ô‚p.7Þñë€Èm%ˆó®–hÔ2‚ãĸÃW~"Ì 3£ã¥Ñ"Îæ?*TbóE®¹n‚í{°À².#!f‰@P³R¡ÖîÅÆJWÞ¯¸šð…†ïGKV2gÚÊeÉ b1ÈmÝBnfƒ zmëÁfé”5(³Yk~O/o¸jªÛèk[ ®urÇàºý„7¨QÄ>¥ó™Š¼nÜyŸ .øë¤=¾`âÑô6Œèd¼zC¶XEbYY˜d‡ñ±ÛŸG“q‘V;D–yD 1%°J š\i–föƒ 28M < « åŸ6à`a$…™¢?-Cez88¿?pjóg4©&& ZY h½ §/GHâ_ñ6[‘Cpré^¦È]ë#Ÿ˜%±òpÄÔ>­Jä†3“Mù2® vsa4ޤ2º9“㟇¤lÊx *‘*f­ù$$•3;èè‰ÆF`ãÐ¥ò«„d&T‚Š Úx'¯uôI¬^ õ*‚ã’±ê-„`ÙZY–¯89÷1\àƒ"â ð ôî)\s@¦™4¯\ólªš;–{·„½¯»Oa|0eüw:•ä.:ÏtNá‰]>ºíxj;x8’g,ç+– ·_üe]ë_ÙOwþ¯?ßx(Úy<lN¯øÆH–ŠÏª"B‚Â$˜–¹­ùT©B‘ÁëȽ!°¹È#ð¶ÿx57 endstream endobj 1846 0 obj << /Type /ObjStm /N 100 /First 965 /Length 1557 /Filter /FlateDecode >> stream xÚÍYÛn7 }÷Wè±}ÑŠ¤(‰€ ‰á´@[±Q´5‚"qÛ`·°×@ú÷=”/Í®×™ñlœöÁkŽæˆ¤x¥¡–9¤@-KÈäÿshý¿b!5Pé#-°i0S 9þ|¦â¡u‚‚2íYƒŸ«9TjN”ÐXœ¨¡•N´`© B©ðHÃx€Øñ*8Æ™q°ö¹ÒçÀ$w ªJsj2«AkmÐÅ !SW³T«Sý‡úXéúC@…(à +SÕ±v&rž5ƒR·KÆK2ŸT¬NÇÕ[kàœÌ) ¬äšÁ@¬š!Öeµ>Æ‹rÎX-—êü° ®äü ËˆM> >Ö„ÀH@™³€”®˜á-UÊ!+n<ƒ‡5×ζUw®á…VwŸ!ˆµ‰/ÖR뜱’’×Br]’ˆ§Ø©®)uW™€sñ%â¤t˜€såNsEZìïïÍ ’¦!—_…Ù/¿þÈH€èZ\~øðzïÉ“û$ñ6ˆËJÑi(jqv¸\¬Âþ~˜"…®Ñ‡ˆ$Èõƒ‡ÁZׯ̟n€ng‚Õ®ßy•¸™†Ì¶^Ä^ˆš½<_žÍWá$Ì^†Ùñüã*Üjqü÷_s¼xó~¾7{æ‹Õ…×¶Îyoöj~±¼9{ÿõ¾òþ endstream endobj 1945 0 obj << /Length 1564 /Filter /FlateDecode >> stream xÚ¥WYsÛ6~÷¯à#Õ±Pà™7§9šÎÄImù)Íx’ØðPxÄIú绋(’•“ÌtÂ{PM^€üáآ¥â›P#¿UuÞTÄü¼‚˜*›*dìu­[Õ“Ž„|Á2ïŒ#Sõ Å)6`%+õqe^J–4ÅÖþnv3ñâ¢ÞŸËÝ$ XÄpMƒÙD ÎUV@’ù×MoîÁ·ýAõ޲¬VŠV[EªŽ%ÞJï(¹ÚfþÊÀ*ÐãéI€ðç´,ÏØë#å®Î;BSÏð$…$=FæëÑ¥ØÈì2Óîþ¢;ðš3˜± # C0&f\fd̆|˜Œ’Ñ}ð{]᫲CÈHà*ˆÆ–?šþµ~$ÖíRHM/»â›åR§ñ€J ­ Û§ga•‹nÆCQ–$éš½\nNb޵нþ+ ¤€,Ö@Zc§ˆpÍ€ï&ÍЇÌCmn€É½«Ô¾.ú!×söxdŒÒ¤ÍPæ$:¶µy¡{kE¡Î¢—EêxŠÔC"°~×C{¨xºîËfßuçÐsÁÂHºSŸÌ3ˆY”úý¥eª½-.–>‡’3¤3Ÿ_„œô<\*52*t\™$„’ke¤QH–q›ôß\˜hÚ¬2H<ѰÚ=¶ %,–vïú­Õ´Ö`î-8O kÅÄØ¹78‡¨ÓðÓˆ¾ô.°n¹šG†ÚåÜiõö z«O¸ÁYEât8v1’¿¹{uó nPÑHj€Is<fUf,…µòWö–l–*&ÂQhÛÔ]o•Íl)쿱3¦<{u»qÆÌ"sΖ(0Ù9ÙÂÏ¥ö_˘Ïॶ9ÊõN ¥-øé^8Kà˜iv.¨ˆ1 ¦Ùår =XTÛ6Uå@ ûP¨æ#r”í¦Cüeãe0/-b>;µ–4Û C¦¢n´ÒænGÑfÜí¡@ïÐÚ«íBÔi™äiSÈÇR¢&Ng¿;øÝšŽ•’& 6Ö¿²,H endstream endobj 1949 0 obj << /Length 1529 /Filter /FlateDecode >> stream xÚ½WmoÛ6þž_!`&ËW‘,ºmÒ®)Ö´Kœm@[tŠ%Çl)“äÄÛŠýö_$˶âtm±i‰÷ÜÛû 0ü'¤T )&ƒÉâÛ§ÕUà6g?.‚ƒQïäÓñÁƒçB#5 ÆÓ>Ô8 Þ†G³äºÉªQÄ ÅÃQĹ_eͬET†imÞðpZú#WY‘UI“WîwQѲÈáýÂ=¨’"-Nêf$â0©ò¤É‡P¢âP“Ñûñ˃gãÎjAœ}¢‹íé?%øÉã1mý¤1‚;?b£HÄ4|†„Î?FœRxÿ`3)‹£!88‚×Ëré€7#wÞ¸gi^7U~¹lò²¨WΆ0DÛƒlPZ;^ß̬ºÉ³[‡PNݺèd¡F:¦±RHÆ>gï0amÿè"#%ÒR±ÆH(–·ïq»—FL«àÖž\œÃјÃ~œüä·©P0‚4Ñ)ÕéÅz)"à!7Áõ>½8 #ÊI_ï=!O`|,9Â\8µ-•g#³Ù²Q²/ãÔX1“I1™„ÅgHi3ÙñÒdrÓ®ÈcG]"ˆÓP'‹ë¹G¸Í›™Œ·l¢’µ6-‹eõÁ‰}ûš»T‘ˆÄˆ0OÅ:À_Nuøæø¹ß¥ëíQ·[šû;œ™g ƒÇ# Ÿy‘øSe3Ël( Ãú®=93A{}ç$×á €´¶«$”†oWïá6iIÃq~Lsúfʲ ´ìäcÍú8„©¶ÄÕ–¸7æèÙ¯cÄXÓð¶J®¯m Ú¢Õ•¦l…¬Hæ.;P•ƒî "Å,¼\æó4–Xºú•Té./{qrú3ÀÊ]D(çÌï´Vàå€êgOf)A³MO¹,Ò,uFÏ’¿:Ý•aç €5]“ÙI•%uWŒ×â|ø‰1™PæÅ]âÚôÉøøÌˆ ês©:NÀ ÈË¢,ʦ,2g†½Ñe­œZuºI@Ãñ;Ýa&Á1lŒØ®½o<®ãžÄŠ´™R ièÂÃM×íýgèŠ $©lO8µQ1¶U!ÎׯjÎÖÆÂ†ÑØÝÉä=·¨;7¡WJµ8ên9tÌx¤Xøäé†D„îÚ4J eõ_¢QW"Læs—þ¹+_“dÞÝÖ*[$.x”2+±é¯£š ¬Oµ­²!÷” ùdý€ :Ç‘¦ûcÅ”¶GËÖf[ ú"ùü¾¸ÙaœáXA£¥]+¦wŽæ$³¿Î°­— M:ÚžŽ “Ú'àÙÊ5H{ž‘@6è4WHA² ìÜÏgGf´ £/ùç tlÀˆÇdSÁó|ž=tÛlµîÄh£Xàðšä^„¯j"ŠÑ-'Åd¾4]Ûü¸8½8{rêö³,IMÛ3û)ø€ÖÊÌwÚüMÞÇzdæ¤@³Çêéÿì_Ë çSyë6MéÖº÷rZ™O ³KÜbR•n˜3¿Í0×r1Ãøžä÷û92ÅEBùSÄnóÚ|7Ä yh†È4Þ!Ð^¶<ìÒ4äMZ./Û²øó:µQñ ½W«ïº’R7ëZûáøä||æo€Uêö6ªF48a缺u~ÔÀ¶w¿ºZ.²¢épðo÷Ûu¢&‰'套_Ö™—¶Ÿ7fsT |fUý)m®ë³­MhkTê«.Ììæa}y±•ß>‘sÃ’¦MöPŒþ¶¯4‚h#]-ëUÓä²Þâðãö 6fæù&CŽ endstream endobj 1953 0 obj << /Length 1302 /Filter /FlateDecode >> stream xÚµX[oÛ6~ϯúR;ˆQ–|IÐYsAŠ,-\°.-Q67ItIʱ1ì¿IY’åK°-yÐ E~çös¨Ë¿ÀxÖ`Øs†½¦gn±Jç–Æg@ï³ÅF»²óçÉÙå}XÀuFîX“¸ 5‰¬ß:#¯k{£á°ßyy~qÆ7Ï]»×ëu^¢Rò;¿À¬ë ;9Lº¿O>ÝMJm8ß;Ñ4³{Ǿ°†Î¨ß÷¥yŒœ¾7fö7ð•ñœf] Ñqki‡e–-\óû@íC CÅËê»]ˆonàÇ^Ÿ¯…4:C¡·†÷·Úy®ž(‹”@bõL7Ë(–hG-_p®e{"æž§€ Âd”!ŠWãª#r³áËí}ý É©>Чx–sL²«®=ô]·sÞRqÅëˆä³c#m­Æ©¼[_¨gH2Æ•(Ø0žÞ>~Œµc…Þ2€ ¦MÇë¯2ø~ýŽ·‘áŒÉçz´Ÿ>¨'pJä–ìþ,°=ç? AôFØÿæ§U s¦“—BœI‹VGoO–Dñ€ ¾B¿â|BÈRI+H1,ø½šAU¨Çš`¯8I”´ IÔà?…YDR%gy:“Ýh4ìóÜ`Þ¢05Àø‚"´¥µìqEg 3GøàƒÁ>Ú áZ‡È(®Ve}Çêè/7rÓJܶ¸b ¦ˆ#Z ›ÎÛj¾}¸{6 s”5AÅ¢“# mÜýHä:–P§½‹”cjòÉB¡<\ˆ¸zG> }¥K¾9I‘ñ –Mã,'9Ûwº5Ž•~§ÛSžåtZ,O%æT8nÊþú ÷%ÑKFöÀTy¹}IÉ GH ΄‹)Tg ¶ÓËèOsÓÔã<‰w¡èGŽ)JQÆÙžq$(¸ Z}¸ „!mö %äUV»Í¨1ħºa«ú°¦ Ù'ŠQØîm2m ¢††Z£ÍâÅÆïêXnóè€Æ”D¨©Ñu´6ß«h“;…C=÷-ð¢êž^U`ç¢::¯ë³J*d÷HãüX$µV7*çWúær;Yö\o3j·ZxDM™v­•¯¦ÜIQ£žBNeçöXš%£ZL1áya¡PT³o''æX ×SöcAe êƒeÆGîiaý í:ÁéÊňFtVœ>Qù’ˆÓZx~yzÚMØ?ÊL´™þp/Û禕Tyƒ3ÌÛRÒfÉ3á8,-ÜHXó%„å=ê%9b*^°’lPóþQ™»Åè<Üa«Íû»8ú^«aµ‚b8Òè(Žu`Ĉ>65°ñ§KB94w=NL[FáŸzG³BB™¬í¨‰÷§MÝÚ §Í×Wã!ËÃ1&æ‹£> púŠMKù.T¼¯»Qj—tÓA'±ö^c4÷ðW’›ÛcóFch.ÇZÅùæ ¯‡IŠWÓe‚³¹sЖêgÍ–ÆêU¤þR·mà;@¤·/©ðº˜VŒ‹dÊñÝÝxüy|e<Ë2Â+É> stream xÚ½W{oÛ6ÿ?ŸÂȰMN#…ÔÓªã㺬HtÀ:x²DÙÜdÑÓ#V°ö»O[Re;ز%@r¤xÇ{þî{€þžgö¼e ,¯®NßÍ=Aܽ=òœN굓ßOO.®§áö¦q]Ô4êý¢—Áº@Y_·,Ks^÷uÛv´Q±$}Ýô´(g_l-&òÈ¥( œ.Ä:%©^¦˜~_‰,H#²\}ÇÕ‚ ¢r  ®æ[ý_§?œL¦[­Ó1Ûz¦‰êôvZ°70|×µ™™šlB›šëÀ±…­eZf³çE6‹3„>ð%àiEoÐMê+ †‹³>»O»%A<‘Ra ¢Ì‘ Š¥$¤‡˜ÃØ’ÌGa!èßè·oåq"þçÁjHÎ8cŽƒŽçhgJjˆí¶ôÙÞÅÕÇó²À$5ÄÖdaÐ(BßwÀ)±R9ÀP¬ð%Ü’¯^1ŸˆÅ_\†oØÐiÊ©Ä÷‘ts®°f’´`©¹ ßrnÁ¼ÎpZÄìÐé×ñGhÙééyµ;¬wÜ÷¹"³é’K”¶bI§Dº?E(z~°‚ôI+’¡óšlÓ5h›¢"R.hŒL«ƒ½–Ÿ*3Û¾«*\ìB8ùùf:»'÷÷-ÚÍ|þ,˜”–(•î ±´4ÀìR° þNÏ.§ëÿæ§~ÁŵGQÊ2…)V¾º90ü/ðq礒•byÂì{šù…èúÍû®3Õ!Ú†oÛÿ‘ò­(*ù×8A¯¥£«]]ÌhBá¶BûP;˜I/¯eëåFFS7² u=Ï>Âõ¢juAîM&e$«ôáöáîÍ­ —(ˆ,טº˜* ,öºò+\—uɪ,HåwÿKfï³o›ÎÜ&Õ_öwŽH\há´$e®?Š&Û×] €#¡kõ ÓñLûˆ²P«Ù5ôÄá—r»Ð4ª›F/ö,瀪l׎á{6ýÊwåY]mwZ7UÈþþêº n¤Ìö)Š¥'øQu‘ùXÀ¡VüU4Ké>ý/1VæKuVÉ},5þT}’9+{,ÓAlì®à"xg­v8.\²¡n`:Gqh¬'Ka€N…&Í+BÛf¶Á,  ;‡Ñë9Þéʵ—¯Ó”«9ƒCß÷Žuë+&AÖ©CÃUÛÛ‹&Œövr«æU*ƒÚ`A–Þgg+Fáw%Á8CÎŽÏjÆ6‚ÞÃ!äjj !Û wÉ/ i]±b¨HNÓ«;†µÀÞ ( …> stream xÚ¥TÑn›0}ÏW HÓ  Ä›ÀºªèAIÕ…HÒô€‘âXVUnÞ –„ªÅx¬¾Ót2‘P­þV$ ˆèJ)d3äCÕ¤xà%EÕc-rÂù@Uô£8þP‹EF):æ$DÅ•ðL0®–ìö7Yˆè!Ú¯°Ïv¨@*<²-Åžvôý*™_ž_MÒ8ÚWØ]DŸêf®tMî6‡'ú¶ì Ù¦¡¬‚ÍZ“wÿb­â_òì½Ngê»ÎV÷º²àleÙ°y2ì¸\M§Ê˵àåíF”Œ:j+Z:RU†7©-©™U •cp¦VåGØ„§§ÇÞ†‚ø°ÏVO„Önø\]f¾`Tè©yé“®ÞÏEÿ]¡<l[uZ5ùvWhãQ®%nf‹’¿Ý¬Œ>ª`Å8´z»¾‹_ѶfÓŒGN¤CL7*…4Éõ^/߉XpBºÔkߺcÌgéÅE4›IˆúIÕ4 Õz0ý[_ee ööï‰v©nÿÏÓ¨þážïŸRå endstream endobj 1966 0 obj << /Length 3195 /Filter /FlateDecode >> stream xÚµZëܶÿî¿b‘OÚ"KK"©G€~pë8¸ qÒ»3ŠÂ6 yÅÝU»+­õðÙé?ßÎP¯ÓÞ]¬(>†3Ãyü†º`åÃ_°ŠÃUœH‘Èxµ==ómo½_Qãú‡gÏÛÀÄÍhæßnŸ=¥õ*ðEê§Áêv7&u›¯Þz?dçÖÔë”ÒÓß­7Jiï'Óªõ&Œ½¼Áåí*ž²7¥©³¶(÷ô^Vå¦+ ?QG•yu¢UŸ×:ò²ºÈZt‚0H"/Õë÷·?>ûþ¶çZ‡Zh%Ÿ(¢›}OÎä”ÂAœa$|­HN-¤Ö…Þ `Å»^ËÐûù ðkïôxÑµÕ dÛÒë54«Íϻ͒¯¡î)G^Ž’€‚“±‚ýÕ&ôE¨xßëµ<ƒ?Ÿº¢æ—Ð˿㵓Ãѱˆ€€]x»ÙVå6[‡ ¨NÂzyùê[jåÐ\b`c©l‚DÈ8 Z?ŸA’2;>ºé O=ñróDÂ7ç^<ûó¸X7¦ÝtgkgÊkŽŠvÇÝd§ó,‹GwYÓ>‘ÒrQí£ ”UK»°™9™9hMþ›vÚ:Êrknúö?f¾ÿ§­6*‘vdCšðâÚÚ£N¼¢¡gFÞJœÔRgµ£g{0Ô¨­¹V;çŽLƒÍO;@ÖCÆ$ºÆ43"»lÛº®¬ ¶àÛ ’&mJ¤`èð»@“ µÙƒ©Áü4$1à †ŒJþŒÜ›/ÔG'’ê+½åEÓÖÅÇíµëMÞUKcwH¤ªÿÛÌ(dÇ#5¦.“X—Iåˆæ:ð€,õÞí—½óµÿ~zÿ«Îg±øÜ7ÁóæSÝöS…Ô+@‹8â™È® èñy¶Ê¯š¦øx4ÔÕVô„àŽƒ›=9.ì°bbc[Õµ9â!—¼ˆSæÝvèùˆúŠíØÃ€ë™–"5f% dÝ—âXdõWæƒ÷Ååx®däÙ“êNøûÑòˆ‰CI Yw+× QC#k-ã°ês‘Q ‰%;JûBCœf_éÊ®þИöCW—ûÀí’s~(`‘×lÁÀZbˆ¬xB¯+â†X#;¦í­’¡e%èîÿh3¡—¼* é"ŒÁO£tjÙŽ’%$ÉŒÓã]/ŽD˜. ·$Xœˆ0ˆ&r‘eª8õþu0%oîžÃaâ+gçŠY´O°³œZmO¼‹‡ŠaÈ(´Ú¦Š ’!¸KŸýñÅY ¶­ÓO 74Bgrˆ°DrgzZ»ÁQñ@l ç&Ž·‚©hLéB@hÚ>nb¬šø7‰c>uÙ‘ò:'‚—\üö`jÔ^˜B<ƒè‚j)\C€–:†tj_9¤Â OuñΔáÕwè9çBíap&^ÌT@¤¼°ñ‘hQf¤} ‰mÈ‡Ž¬æµ „ÆnÊ#°ö¾ããL©}ïîP 5JÑÀÛüM¥Š¢3Œl­IBƒÏm(¥(¡v‹ì®0Å&ýè"¿]ÄÜ¿äA¡Ž„¦>”ÕUgé3¨q÷u1F`‚í]‰Ïýí@@Ì¿OšÔ"Sp^Hý½lûv…´‘ÃddS›†â„hM‡üºN¤'글…vGg­'òcèÍæ->†àctŒ|ÙHÛœÑ$ã,G³§fJÑ0Ž©‰¿Bî¬eù ¸lÀ䬥Â+§N?ê ÜÙ*O ËÆöXaŠÃ©Ö­ Ë§WL^-7yUÓí÷à:ÖHF à©ÃS§ð]ƒÆØÓà•†ñ­¡`x m÷ž]†Úáز£‹Îd±})Ÿù±PÑÔ\-­ອ5ÚSÕCì©ÉÊÚÒ-%ï¼GR_œ5¯çã&›,ÝP4ŠˆáŒo޳éÞ hŽùý\ähÓJƒ‹T'C­¢Ätæp––^F­êZš`yÀSV”ÔuÎjDFqŒ'),ؘL™ó¼%å<;¹¢žºVOæì áÎj!q$€;N ÓžÁX‹âTå|âuW2`ÄZ¶ÆJª˜‘"Õ:t«C‘¸Õo^¿¹þðˋ뿬±…ÊÒÜÑòÈŸ˜šJEô‘£ï’ާ)¨•ûI6]3± /aEË-+/¯nn3ckXäEû"’jÄK°äPÔ§ÂfñþÃa77»¬;¶SáÈ3H´Óààü†¤ªÅ’R1â±´—iÂ;e;WªÅˆ` Ð_(‚˜éߤ\Ôš»{ùÔ_¨@zƒ¯ “)^§¼}ï¯r[0rggžV†¦ãêæÙ?ùni²[kIZRqÈfó &´š…S•XHŒF]Ž#5Ë«#»%‹‘B'þ€*•éSL"g4ÁW»%N!>û:ZÜyJSAÝ3*N£þ£ˆ @)Ç}–¸½~óýyp^ŒƒÆT¤½wT¹!ì\üjl“åÙÙìI!2üǸÊ™bÄñ ¢½½ÄÙ/®o¸<‘\ñÂh·¸üdòEÉÙoÆâiºCï΂jѳw2ˆßÓßÒÆ&åe‹óMF-†šín°ºÁ*0p2F]l4Ÿ:c~µ$rXš“+ê=fX¸îyζ:Eš|4sÂÅpÍPg{³”eˆQåû®ÄlímWÏ(ަKSNÐÓ3Š/Õhê±·Ø(¢¡ë¡cÃã5/màÀdavˆIÙ0ù!;[“wn²« ãTª³±Žö)ŽK"R>–Ý>QsùTp„2šãp©íë·SQ¯aH ¦öek ÝVW.s;b{¶ñÒ [0·äaÐŽåôNb€G82¶á>bŸ²/šORÆü‚¨”êp ¿†>ÒÕpДŠWævd¹L— lÜ çI¬óà jæê/t4°–ŸªÚTÃ\ý-M,Zç§ÄæÔšMEQ×¢ºåÜwG· Kžrªj¾°¦p6eMrµ¡Z´_:{§5û怖l/²Do‚£Jåf*7˜:•»Šr“‹"šÁ¥”’îáÙþÈM«Q¥†±æò‡ìH:Ìé#£½©ã‚Šõ†wªÜÒíÆÛwª»#«NUÍjyè¸}yM3p§Æ˜ù×”ÐÇž!Áxüš"4Œ Ì~V™öŒ¿¯¸õ›…ïHómø(¶ÄIøÅ%"¦ß×ï9gŸ1ZÚV ã9÷P›@ðî/ r³áuN´OôÃE®½í ɦES^xÏVÙKq"çØ§eâe\˜D"Mƅჸñ^Ô»òp “@©ú# a ¡”$J(8ëß Se‹$DÑŸ õ æU×_ÈNI« éËŠ”±ˆ†Rù20LB¥É$!Ü®˜:´µ‹gjƒaïƒá‚³·8ƒÙK£ÄÕ»“]ýþÎzÜ…fŽ <¥y ‘G÷ÒHÔß;iŽzÐ…´TdWÔØio¾ùvº‚®y,äNxz1-DîI©†ˆ. (Ëô"¼ço³s!‰­˜¿LÁÓr]S˜.—¬+IÀÒÃ%s™E™P¨¡Dm‹“iaC9d¤NZÕð­—Y"mÅÅzñëáø¤#ƒBâ±4@~1 ñ4˜]òô·‘»¢Ç1™eD!Ûq¢…¦ÅKUQ ^êë'é°È¸*¢Í™þ…Š(ߺúbù>X(=© #†ÝS[6Â(ìw·°ÆÉÉÿü€ò·.y@ÁÛ*rpé8GKXŠHÆOÒ‡ê‰>,¬j{ï^į D9¹/¹zýêêõÕí¿¿:©±jœ¤ 0•NÑÖoΉП>%'Ú{p÷a¥c²G”¥™Æ3ÀÐnãíÁ­éÓÅRíÃW0÷ý,Ù¦RÄ*þ’­ô¥aº‚ì‚›üŽ\+ýØÞ ¥ÈýÛŸz óHªí•yQ“:*‰Ͷ*Pb~9MÙï6Ïç¡4J5' .ÿR—S‡ì¡Ç•­)}>á`œâ-pSä<‰ƒ©ûí=l…IþÐS1S„67´¯˜á“ýDÚðÛP ¥x¼À.úbÍMß[¤võ´ÆÏšàjý·ä!Óʀ樜M˜”Ïú27%SÙu5Sz±w»5ÿ»›ÿÿ»›çb endstream endobj 1971 0 obj << /Length 3285 /Filter /FlateDecode >> stream xÚÍZmÛ6þž_ap€·¨YñE" Ü}H//·‡Þ¶—nPÚb¡Ø´­ƒ-mô’Múëo†C½®œuºiP,°¦DŠœ!Î<3$_DðÇZ,´‘ÌH½XŸDþm¹[PáÕË'<´[AÃÕ å·×O¾yÇ 1Y¾¸Þ»ºÞ,~^Úäb%¬1ÉòõÕköêéÕÅJJ¹|]¹Kjùï4¿fÙ¤‡‹_¯ÿõäùu7Z,b+y¦hmëä3 ãú ‹bE2Þ‚ˆfYd^ºÂ'³LKG…,Yk·¡§wYê7ém½ÃOBÃÒýÏ­ë¬Èé±J·‡,ß±‹•5FAžd(H¦#:xQ¢Ðf,33‰i[d[ê>/èw]äU]6ƒQMêèNj_4¯ƒ^¾ñúzqÐæ וKÆcNƒ¤› *,c±L·µ_ªX.ëýGe±\¹º¹Õ∟RKÁbÎ[ÁùœjÆæCÕü› Ì•swGŽõĪ{ˆ/[=ý·EMß¾ñ3ÒJ^·ôi«bC=dš®‹L;#$Z½wÜcú>;âÄ6GzAè=âÿ0¯%U[øDp¨¹/8¼Ì*j^ºtï÷nü<’0ÅXŸ¹mÚê‰W‹¤˜µsS/İë;âÌÆ±À&+Ø-Z¯ m’„©ØÍ›Ìl8˜¹¦¼IË¢¹Ù¹ú¦z»/SP“ºJ¢ŒfJ·£ýÅ-ÒíHr&` ‡F~âB_#±„·ÍÀ®¼ºyùüê+içrRå¬Ü2ôbÌ¢r%Á˜H°!C¼t0é° „Å’MY:Úeô‚´÷PC0!)U€ É6Žjª·s¿9?¶ñÍC_825‡"`·ÿ~ ºúo‚`ªŸØ ‰‰}×—y‡¦ÁF_§•Ã5 ueÙÎá]R¨Ñì_^½¸¼º¼þïÜ\jðÔnñ€öÌG™ÄK0†O,KŒ9{û´ö“7 =θUç`Oœ‡½äÅ´‹>^'>¡,­±ˆ£%A_³s( wTKÍ æ… %£ª!J×-J|á›#.ðMjNâBF0ƒ‘8¿Ó-þKªð~Awt÷âK4J,¯ ªŸð5aføšñ/x®L’›Ñ²HË´é,é9"«Æ»fÄ4½œÀ°©x·wä½WÃ…yfê‰H }¨;ê7â£ÈÜwõÑåWÍzíÜfvùšŒ1XÏûP‰J `A#fàóG@YhÁL#v•ˆ b ñÄqsÁÂ&bïíGšy4‰q=œŒœ™3æk³¾P04°ïpO?ÞÐ ÂÁ(XImøãV'fÖHß² ?‘¡Éoªúv®[AöKº=éÄe 6©kM´â«°õ¤B:6CݘSÆÉŒ°Z¶X1•ØÑnöv ¸À4¬û¨vxÙCË@ìÄ’B‘.Lð!´èãäÇ]‘ªw¹›*!qëtËÕOèt$vì™ïEþГ¼zýÝw °2"ñü$'±SúÙ»¦Ìª:[§š‡²98ªòÔ~ë}È} NVÀÄÌ5^-Ï1­ðFÒ[~ŸÔ±|Yô „q™@8“Nüþã1p?À.AïÓ±Åpß'@”°«Èª¯„aœ'#bÚ#Ô™ø-\{É—×{šÞÍEðbÓšI|<È>õ¨BØy AÍ­NܾíLZånÜ1&`ürXöBMCÏÃsà|åÈ¡¡ bP„û™s,³)8pq=ý–󖟃_šZ'ë¼ü´¶gy¦rkà›n>6Ð ØÁ§%NNøæÆÚ…Ñb.å àè9v%´ùøN÷Nf ”À˜‡§†Å›ÄY¯Û¬~z"ï­fˆ'!H¬~\ÄÁáXß•JäÀcH8Ìt­F]ŸžG n4¶gD?@ru<ýEn»_Á¾&€/KwHû“ |Se¿…Lü¥8¾ò«Þ¥”CÁ~Û¾²|C9¾|Þ?©\Z®Ñ)ìé1P¹ðez¨ *ÁŒîýÅ2|÷ìåõôˆ'œÆH¡Ú8b1T1Ä3"†G=ã7Ã3Ÿðùjðýé#Ÿ¶Q˜ÁvÂVªÀ!ýšÊ·é·ºŠ—Àù§’ãÞQ2ýôáTÛúI§vÐ@›¡¶Õ$¼Uxjsüît)™$»Þ§AÅ¢¤_÷Ú|±.f©§w›õ…1ÓB÷öÆ‹ö“çØoåê  Á¦}B÷~-4ÑBÊÁ^“—hÄ·M°Æ™WƒZB©A”ÏWäï󜯈S:˜›äÄ‚¡8Ë"¿se¶ý0kŒÁ£E#ö»­1\à¸óäQÆX<Ó‘¦¸SŠ?98=‘'­ñ$÷ƒúf’›ŸYµõ~÷EW-¶,‚Hàs¬„2˜% ä2æ¯çV º‹»-:ÉmûS®/°`÷)a5Y‹kÄbS†0“ü$fÞÅ•éaW”Y½?ÒãÝ>k#Ïöl?Ä¡ù7Å/ŒÐ×!,u],¿ÉÚ@^ £Ù´a¬ÀÀu³û~N¯„I­æÑ:ldûƒ·¿=hiÿNÒýðìÅIÉ “} tR°øÁ>E®û ¢Ÿ¡}ZŸVDŸ8ƒ+É)r•P‘@¢üxë龮У›ŒG T¯Ôûù«º¿êÐú³{”_±¤käí‰+˼˜Õhó(ãE­Ák™Ç92#À9Yß•ha÷ ý°_‚~|l.Ï= K`64ãp¬R=˜M²ÌF&í%x=ÞK&¦ý7$r3²BYžÕ³–Lu܉½Oƒ!wH#%K÷Þ­²¦0®gßHÃ×XXÃ~Ù6‡Ã‡ £Ð¦$_~Û™)Óˆ¥›UÈìrÍ”gÍÉ»zæ/Ľ¼¹›bB¶x¢»ì&0ç >„úÑ?¬\ðÃD0¿C$ˆ¸=»1lÙÅÐu[XÓ©Ïô:Nki&ðÇÃF†[mPs½M×i7h6žù ĘMöÆû‹,í…¸4DQë¹ÅVŠ™>ÂNdAsŽÌW8/u5f‡¼U=°,|òfœíPKó…,¹÷”–Hó_P",(”ÓA?m'í„cŽûn‚§zŒ1ºf0k™ñ`HÈóï6¨a*!oíò{P£¼ËüÅ nÚ«\†î?*n‡·: Ý7³~ |£¢¦B€²ï¡˜ôtȪ𙿵Á''ݤ8(éÉ‹™cˆîŸ†{oɃK«)n;$o›| -Ý1Íòe@0n¨ Æà$˜e—øª{ÀÙI@ û3·óð³(î¶À‰|ˆôé!¯+S¢?ê?„ËX¨§ê®ƒ–;z±-‹#%6RúÙÀâ”Ù›¦MJiŒ6Ú$>z´Ãï/\ªôp,ªú/ÔÕ=+ÐB@i“ɵÞ|C7«#ˆHÅ–/aÙ›D“°8`Hçg°ËÉ3-É  üUÅpûqàoð1øíý¿7 ú{TŒî*vo¶èZ¨øë•i€-GW–'6ömYôêãÆW lç]ž+TëÎÁ(ûlUk²¡@x…¯пóLUIðoÐ&ˆÓvÒm$ëAïý³FC3ÓCfäe‘ý„‡»™ endstream endobj 1979 0 obj << /Length 368 /Filter /FlateDecode >> stream xÚ’Ënà E÷þ –°0cü认RÕnZïÒ.h2±‘üˆ0‰Ú¿/8r¥J­¼†3sg.戹£>öÚÝw>`T¿:Ÿu"2ÃÊheÁÕá /2\æä½zŒVÕ¥k™H*SñÏgú9‹ŒòÜÕL2Êdêgݪ¶urŽõèWø´:h¿¦#í25øÛ@Xë×N× I l=ë|;8‹ > stream xÚ¥ksÛÆñ»?‚p‡WfúÁ­bÇDI%y<Çã9‘'- 08ÀŠÒ?ß}eOÇcá°w···ï]0^Dð/^äÉ"/TX¨|±Þ¿ˆÚÞ/xpõæE,ëV°p5Zù·›ß½NÓE…eTÆ‹›»1ª›ÍâCPËURE¼»|^½º\®”RÁ;g[éàgS/“"èÍnùñæ/~¸NK“4LµúJÒüê3úr O…èéK²0J5Ó—†*L–«4K‚WËU\]Yyüša³ŒƒCW}^ª8°<eÿm×]ÕÔüzmö‡]Ußã€%Ř%Ñb—a‘•|âÕ2E,ðç÷¾jå% 6ßËÞ ;Ó<Ìm\7õÚ ¯>ãËìÛ5÷¿^¼~É\ÝØˆL³À ±I΋TÐÜñ“ÏѸ¢ƒV1üM>î—^Ï장k߀ˆ 8ü+_Пço~m»Uø~¹ÒZwÆu/ùòžë2ãv ræá+é`ATuÕ=K€ëºdÓvvóMøï,˸^ÓãÙ£>¼y¿,T`Êä# íÃ?]DZ®ø÷­ õGıXé$ÌÒ“3_±þæAåøiHA‹À¬×öЙzm¿kǪ›{ÛmE‚ 趦ãQï¬ãíÝÖ2訄U‡Gž' £½²Tmµ±µ­Êƒ»¾æƒ‰þX‡¥ÖðTaœÆL”è(Âc\×ök$¤,¢á›zÃ`÷{oíŸH,¾™¾kö`k³Û=. „ËUÌ{+Ø*YÇvÔ> Žj_íLËK<SæÀÄ :„‹+~ù-J#gí©ã“–q˜çš|V˜ü‰r^SÈ©ƒíw°~؆0DG%y³8ƒqn.®>¾døÁÜ[Å*?%7IÀaFñ„æ§ý¬_ý ™§H‰VàWÌdµüt{&†¦µFÜ‚l!ÖúèC0b1H´AVÓ}'iÄzÝ·9]€{ôÇØ?ˆ©× Ÿ¸©VsÒâ@ «2P• guÛ#Ì13>QÛê~ëS$À=²µßuÕ`–Á úT ­l6Ÿ~V‘A•Šo[Ö|ppKWµs¤·v…¸2»êOÒ) ÙÚšGÌE} *¿{Ä ‹&ÆÔ0dKü…¥r˜G᳓ ŒWÛ Pžip³%-r¼†Ö4ÅåN$ixs¨¤=Xa…¼ cD0Jë\·ÞT··Ž‘“ì„=ÆíÀG’_6¤H̱»gAâ“¢!r~€ç.¬;»ÐÝ:‰Kž B½s–"*Ýs[IšÓí(ÜÖÔn5¹ù*À=’¿¸ŸSÜÀ8Y†WÊMÀE×ÖnüH5x0¾üI RQq±Ð…aé7W¿5B0ºN™†Y¤Ñ‡Y¼„³ç0‹£™0«Ó8T‘šPÿt˜õ«Ÿ¡õ)Ñrè›>€•Œ1¨IDþ±Ášæ‹˜›e©Ñ-á ´¹qº©dûÏÓÜ1;Ï?ѧÉÃxê¥pŽÝ°ÏÏ‹B&ŽãTg¤—Í«úMÕ=‘Ü>"º¦ŸsE¨Ž,=âõD>/{àø¼¨Ð ºa‡U®³ÀuvÛý¸üÒÇyÑxP½á)Žìç%ÜPçÝË[=ãM2¦ÿÑ'™ ¸ ¦8)ΰå $ŸCvM·BˆT7'aŽFžBGì–ø€z˜4üp¶›žázNž¾€Ÿâ||à¥-§Pù„ôîXYO@HÓÂ2À¾îÛO¾6EùTÀ¦uŸ€ÎOëDÌèw‘°ðÑgªDÜ4ö1RHPc®FðÅHüã·®ä@‰Ý:ç[ƒ™Ö»é†0¼•" Ç{kjÇCâ%­4‡£: Â&_TžÜsp¶I‘pô‚H„’£ð™€Íô,‡jÇkH1¾7T{#P¢úL`‚È‚Õ"MÛ²ÂîƒUåÕr·ñ©Hƒ+É&âó2J>7â‘ÔÊïG¡J¬r3N1à?}_¡v¥Á½­mk:V¶ì$³À‹Ç%¢·éXoQ$“D²âÒ,²x†IQ„e9e#š»s–†E™õjÔÐ$ ÞcÆ4ƒ>Mà ÆçìçbO«ò0M4igB糟y˜õz7Rÿ„CXé`PÛF"’ð ÄPpÁÚ:gZÊ1É&ctv~zXG)9«† µ°Ü÷R²ñ-&¦òCEd©B q“ÑôZ93iyrO¨–Ô)ıh¿Œ®ˆ¯˜‘ÌA·’7aÞlf­â8f73FãïI &÷ü‚ËÓ:Œ’|¬T\($Y‹ˆ®!ÉÝ– -ã„¡Ú°L°wêDAÕoAµÎ0çl»¶Ì»ŠJ=DBñqŒ¤ÙÉa܉‚Á¨ïÈÕ¨°h”ê\î4Öî¢Y£Ÿ¦²¤™/¾PÃÉ—Qø2õ=e×x2 Å9¦ƒó"a£út {ógd ù'Á€iÁœ³€Ey~vÌz{ÿÉ%‘)öË Ä Ë"ÈÛ¬éz*²á…”qùâ!ó5Œ¤²È§5[têYBž5Ï:FMý.5˜°É•††3ºíÔ#q¡‹Ð)iê+ÉØ¥¢žÖ3µ¿ù”Nû‚ŸhÚÖî ׿d"_Hĸ!‘Á¹pij\¤Ü þXîPdÃ=ÄWà×€0’VW­ŽaÀcñVq*l(µ|µì„âì¸Â'Á9Õ“qÆf×q\?Ý“%|ªê¦Ãêì©Z•bIªY¼Hã,—Æ@ša™ø6££yž’( s•ÏÚÓgàÉÝ㬠ÍÙó¤ÒrÖ‚¾€8* Ì]Cv1)Tš±:‰ ŽÃ&`,ÁÝ´´IÔ,ŒÍ°¬ÈÛ 0i¤¾˜ª¦ÏpP¹¹YÊ/>UÙ÷¡ÈÛ•Iýt"4©ât&ýI ¾ÛÜú¯ŽgÌ]Çá² u†Ç$|óµîä&ö0Ñl}sÊw_3ì…‚‹,ï.ß]ùúù÷Q D뤘†qžaIüác´ØÀ$s¡Î´r¿Pa’cY°[\¿øç|Ý Åp‘*ä‡(úÛË×o/ßÞü‹ièqªENKÇ‚>´Ößš›Ö œŠÄìöëD«j´®š:Gø¾c>7GyL†>dBŠ`͹#­9HЬÀNG*aà:Óv¬´C¶’šÀsh–R%F;…¡‡{œ8“9­Š+Iz)ëƒ'xH‚ç\u»³ "ܸ“>Gc‹Å³ì¤ýúêê/Kü1À‘fÔ;ÚERµ S5TS¨rH9ña¢Õ輓 )›’aª\DÉÅÛëOË$õ™£‚ 6Õ¢Ñw²Ùš7N¼8‰ÏoHæÔ;¢Ü›ÃÆðåL·ÞÔ¨Ê çxŠä³ü“…´Pw'<}¢D?¹U©Â\ç_Ãád̺sϯ TI¹(¡žM¿Õñ—Óžxó,]”:,a௢Qof«bê u#¦Î\$ád㯋°%DÌ) \ê(tbççYF‚¦–M}B; 00=MI®I9|kGœ æ=Ž´wÔ\{»®P¦_6¼nêÆqÇ™G i9¿¥1·¼hÈ™„òí'„Võ>HGcÞC:?|k§ÕäLw §]¿¶v3+¿Û%ª ä\r’‹¬s`ÿÿ¡‰~BbL©üzcÿ‰SUc_²)Ò† žõ¿Hr™~úÑ÷`,³)=äD4‹¾ÌQ. ÀŽ¥Nª‚;_M´=ϱE"Z€ î;Ÿ‰ú ÖWa”‚°3BVÿ½æ³ endstream endobj 1990 0 obj << /Length 3490 /Filter /FlateDecode >> stream xÚÕioãÆõûþ ¡@:ˆÎEƒöCŽÝÄAêMw½(Š$0h‰²˜R¤BRñn~}ß›7ÃËcY»v7)üAÃ9ß¼û³El‘ðE¢E¨E²XížE¦·¹YPãÕ7Ϙ·„‰ËÑÌ//Ÿ}öB©‹Â4JÙâr3Þêr½ø1øj›í»¼9[ !õùÙRJü#ï¶õÙ’'ÁºÅlj;å&¯ò&ëŠê†¾«ºZªÆwÔÑdÕºÞѪßÎTdM‘u9ìÃ8Óq¦g?_~÷ìùeµâ*TRœxE7û{ê8d ìÉã0R’îúu¾ÉeGp-ÂËâñ2™bN2 xÙI“½Y2Íݤp؇…©R§,5 y,KÎC¥,®‹ ÎøƒCuh®²¦½jóîjµ¯aÀBG“ƒ@¯µ;é§H9xÒ Ð!„ØIo.Þ¼rþµGU'‹$a"âìÇŸ£Åƾ[D¡L·fân!Bžà^åâõ³ZÄNãq&m%S{³δ¾xõ‰½Ä‚…šõwØgM¶ËãZßMb&€5;÷SK©êŒë óíÍE3ÜüjŠËéÖ€J9 Òn½ª«Ö»ñRá8\oÉDÈ£Uëúp]æŸÐ-•!“ñˆlÌÇF €JOÏx“ðTlÍaÕuE={øÑAmñÑb§"ÉÄÑn›Sc›Ù6‡Ê¬AªÎ7>¼pÀaÂ{œ¯æ‡xI÷·óË4ÕÀ“o¾ÿÞ·'c½´ÁìE3ºÚöŒp' ÑmW¬h 9”ö®õÆ]Á=ìÎ@g]ãQ y©#é°Û»Š‡6_S««ñ—^ë¼ ©C–ö\SÝ,3˜¡q R˜¤‘,2Ê7[ER½=tÈuÒSpÂ7xǽQåf‹¶@vHÓàrë°á~ ací¿†U™Ð}m@É·‚ò[Q7¡—¡$ˆQ”Á™T [O‚2 RW$ÊÚm}(×Ä62Ò¡ŒØT(íÍIidÖ‚”y†VÍi¦©(Æi÷Á @î’™BªÍmÑæd@×d±Z{pc!@ö \•†¤wÉâPÄ´ÕåÖN[öN•ínc-:ŠP¯ ¾rÆ7À Ö(,<Üoú˜4¦÷Ó×äEUtWû¼YåUW”¹W›r°ø *O±‚ü¸àıEÌ€ ç à Äxóä6ƒKŠÍ,Iu±ÓcÀGQ©8Õ$ ÐN¬Ÿ=1…t<È;óØÃé-¸V¡ž™Ü»Œ³ÚÞüaŒ£Â”=ßàNqb5Ö7Ï/ü<Û©žg¬ë öþ>÷&ñ°LrËD1NÌãÿÇL=(ž0£f',óå;Ôo½úû=ÜöÞ:š¬çŠ,‚ ¤ò>¤OΗ@ˤGz zâ_Ü9«ŽBu‰ðÓYYüž¯-TEGcä8°LW ‚Z3Oz|šû³–¬S@63bÃ%ÎÎCÃÀƒ&@ʬއî}S ±Êׇ&ñVQðrÓåÕd=øeÕ:oÊw ÂÀ|´¦¸> [œ¨à—‘[´™Ø°FÈí¹Bå¶Íª›œìp4a̺*-Qw6.E¢äÐ ]èÏÀâgüÁ†¦åo³Ý¾Ì-–-N9xÄeÙãt] œYICSØqŠñ-a$³'ZvDµÊFµw—†è-æÏñ’ ”7¹\, V™1ñЇ€¿»âfK Þ|^›kÚ9»º±­lÄÙÛ³q#ã¿ÂÀÁíG¬â…,˜“Í@1ÛÑ|cí (v¾‰pÄE ÔMÌb&?c»ÌHÐç÷CÍ «C®daÝ$tâGXº#y ®Ó´ú½õRV£KxÝ(p7D¯¿‰JmG§SH!"6òàà#£Ñ© FqRE³ê˜Í„ ØÙ4Æû}gÇ6Ô]£¿“D n¶°t¸èöÌJ/êŸ÷ú3 #¯äÉ^ eÕÚ·øb‚¶¢,Ì­ø8ûr–ê¾°®3hÉ“i¥B5dNî y%ìÁÐq*ȹT©%· ),ÁSÝæ7â'Å8Ž„Ãž!n4"'­w‹SH%›Iµ(!^×ROyÿžÀ‘i0Lé±À‘¡éŠÁ†€ªŽÔ£G¡ˆn%“÷–žtˆS(aW0]'4³Z€Y£` Ù+˜œä Hi F–JÇÁE ÏÝÂÌŸ40+>‚ ‘h°è $ ·Œ?A±G½è±RÑ……š™°Ðjðê‘9%$¤€T@h'§L7 Å$L”ó0q)¥4ú’”¡°©"œñSÄdÓÚxU‡. ªýúõ5„»A(͸vq%¼×Éïè°:’hãàÄŠ§ðïA‚´f @•‡Çð¸®)z¸Uó?U~ô&ÁaĈø¡M²Ø$ZNÑ>*ù—2~òÁVÛÿïã³c”“'SîáPI€ÂÄŒrÿ¢”k’Úà„Ú›¬([jÞ`!M‹|hhÜ€ŒÀ.œ'Ð3K7R§qÌÇÛxõ/MÝ̦Öåš”ÙF­¯ú©'VÈ*£Ãà‚«\R“²VÜ$“1né²ÿ¸{Áè¦>C…”ñˆg%º¤ìž„¬àóD¾×NÓPqùˆcG¦Jðq“Û &?bª¢0ô óWÁX(•œTÁFÆjHGÚªÛç÷x¸£Jšˆ¼:G%¡€£Ébècc—½½*Б÷¥@wŠX=¶Á¤C :EÄqóG ž@È£…ÙJ¤cÑÏ?†ËSUP.ÉD:ûät“cR Ï5—××{úl»zïŽMÅL2ÑÂr=ØC+÷‹VJaG+,ÆFÒl…®"tf'ÁåG’á侑XÂUúAwOÈÄðü¤†êõö>*Í"0=ѓРvb‰|Z/O¨þäš)\ž˜ÜõÄÇ»DV< ŠáŠC„o¼.8ÇdmA?’¿CYyS7àíèóv[˜*;4[L¦Úù<¨«Ïj†–Ìä‡L7¹kÐèS«vñ¯‡<ÿ=Ñ]O®¶òWo}E”H?³Ž'’‡{0ºþ;A÷Ã×/î…LƒÂ’¦Nì}ಎX=s×Áÿ½X½'±fH>1ãXÌ/³ÎÄóÌe} »­w¹ï0aö/=zbj ã§¾´¤„ ËM2ú$ošªöÞ]Òt”:4 ¶9¥–ÍGW{í,dñX³\=õê ¤ýê«—_Ÿ_ž¿¼ðú·&=ΆJ‘ßÖ6k ‘ƒ•%k6S0›BOëi.&%Â\zÅúãœ?|n³½Š*›L9Øw&'NS}¨ÖK#}Ô誛ù½Œ~6ùíøžÍêQÅßÇî §çG‰Ê0 =Öä´µýý¬ÃþŠ æ¼ ÐÙ˜ž÷x§¿Ã{ñÅ÷¯Ÿ{Ý,ÆCl掂 s{‚ß±Ï×Y…Éâ>àëH¤O>p¸›ŽäŸ)|8†ËG„¯A#uÅŽòÓ1Ï´štO ÆGYèi­!Æ$¼žh “ñ×.’¡$MuL8ËÖ{è¤8Èßæ«iR8·u¯×L5n‚ÈwX©}G,øò`a¾Ý:`³õÒÖÀ[—2½Aì«–‚óynó»wI[ÍÖkçCÖÇ×Ù ›6E£ãð >ÍEŒ€Ù“ä®l™O\Ü®?Ö µðÖW8tJQ¸”´DƒÜ+ûÂØêÍ6«o–f»ºZÑ+4òPt%\L¹­{:à#q6¯\³RjåM¬ÈѤ|‡þϤéPò^%]¾zóü¤ò%ÕØß‚/Pú¦ÈRÙQóž~ó·ã¢¹ér4å’QºÕn)áGÛŽxg§@ÚT^=¼‹.íìe‘1¢.lô]/‘ÓÜÐRJ¼<3u$W·øGÁÕÐTñùW4Œ€“þ¶¯çcE¶‘Ëa³²0I/N¯C±g.%jœ£ÔöI$@øE¯ÜK{…ɽ)_6åמƒGõs“ÞØeEÕºäÆÍò–}wÝÀV³Ö¸|×bdÛ#¿sÄ€5{Ð΂ÝH‡‡ºYY’ÔRõ{`WüÚ4æù¿+³³ù«èЂX—> »ÏOLȬÜÕm÷êá-±x³Uu›×S꘬Šd"hw>óÀ¦ó°m” 6ºº4ÏG°8ƒ*î}:í|:Ô1 MFƒ¿#ƒŸÖÄPþØljZæiÞ/S§4/i{ÁY«¬2š Û.9ëÑ ¦M=°ñÐQzoª‹w+˽M‘BÛ¬¾p àûÊcàÒÖMpdИœ46z†Ng‹ÁnØý=\%tj®N2«K7ylæW–€Äø›¿í@¤ðÅ|FA™579Ø¢?ÎíèwBªhê Њ¬ë×Ò÷o-µ›B>6-ÛÜa‹§ÜóƲ‘uˆ·µIòÍ˳V×µmq]æ½{e挎¢ÿ©qkðÝP;¸×ÑÇó«Ñ‰ý/ºñÿ  endstream endobj 1997 0 obj << /Length 774 /Filter /FlateDecode >> stream xÚÍUMoâ0½ó+rLVŵ»[¨X©¬„è¡êV(€HÔYåƒþýÇ $l¶Ýã <Ïã™ç7`ø‘@Ò@ª©X›·®wó}àÅÈ4¸1Çä×åèvÊy@0ÒX“`¹ë†Znƒ—`©Ž•ŸæOhq7Æq‡O…ÉÅÂÇÄFT…UrŒ^—ßG“åù:N9â,þÇÜZôŸ Š€¤9§m‚T Ì™Op›U룉Üñ°²U¾Jòbµ7åê˜íI™ä&qyÝNîÖItŒ$“puå'æØÃ¸î¢Œ¶ Mf‹² Öˉ*È\´0ài±z˜Ì¿ø¤öÆš<)³|0 ¢夓iÒè½ M @‰|~0%¼ §ay0Þ€š“<- ßüN¶ókÍCm­a‘! w/÷ÞSM Î;H»{¹”ƒ¢1#ªfnf½o“æêZëW“ç-î9/•Å‚!Md»Ù|:›Ï–ÏÃL4<þTZxQ榬rk¶¨Ãcï¡Æ„!"FJ!ò™Sr\¥ö´Ùîÿ“‚úñ¯tã™hj¸‰¤ˆnáÕPeQ)>—¤ÔHbÕ—ääq&Ç*)µp\Ji=&NîÏäEãu:qÎ3êÛýô/žZ“γM‹2O×ȵL3ë7Û7ê“CTË®«í³DœéCòPD¥ Dbí]³Ý ýÅö/Ðu |‘*UÐ UÙ;¿úSîéÞ’ÔúÍ|C^Ï~;Ô@„A?°KNÀÐm6¬Õe{JašTÊl°C5\÷¤9Y,V÷?ïfó¡K”BZõ“Øm¯@ ]ZürVh6eêõàYyŒ}E­khV¹0 óš/†…猖/g_9ùY+^(΃Ðí°ð@×¾ï‡tÁl<ø-àgˆ×KòÜÑãO'–bH@›4øá)èÆ|к{J€dÌú”|tÓˆ]"¥¶×D¬™Ðn«í¯Êº’ýGÁ±ìñÄÑZ¸öGí‡ý7k endstream endobj 2004 0 obj << /Length 2789 /Filter /FlateDecode >> stream xÚ½Y[oÛÈ~ϯÐ:XM8Þ‚¢ÀÖu¶Ydƒ"±Û…AKc‹Dª$'Û?ßsŠ”i;hÐ&€9÷9×oÎ9Ò‹þëEfYnUn³Åj÷"¦ÑönÁ?½Ð²n —£•¾|ñêM’,t¬Š¸Ð‹ËÛñQ—ëůÑù¦Ü÷¾=[Zk£äõÙÒ¹$úÅ÷›æli²hÝጋnYrçkß–}Ußq¿nêå¡®`~ÇmY¯›ïú|–¤QÙVeïá­Óƒq`úÌêèÐ:¿€# ëërË#"¦íG}>–}¼XšXeiÊ}8KtäñÏ¿U+­_ËÞ‰Þ’L¥pml›ÐâYÞ¢uån¿­ÎtĪqÑ È69‘ !û) ͼ¤{—ºPN'|ûÇý@7ýyžÞµÁ ¾^ @}ý—>Hˆ¤÷”°«ºêŸ%¡;왆¦íýW/–Ψ4á#“¤àuÁòóh 4lÎ/ÈN Uuü-ù#ö>Bö#¬ hŒ¸‚ÞÈ&¦ËÆúÉ‚~`üPƒ+ÐL"šááuÕõmuªoêN1 Ú©Â9øZ¥Í,¼íY¶åvÛàÁ÷"ó~#sèÊ;Ïonêal 6š’qfޏ¯ú Ò[sw¸åêý•úðã{1Ò¶Üù{¤¦i?)VÖÔ]Ñ7œÒ…ÀÒ_tµ{ö*ò²†ÛWŸÓ5l× n+Î~‰TW€°I 9‰nC]ï÷@»IbàK–µ] ƒz}ÃßC'Ó]³“ÖQPØ;,7v©ã¹=Hƒˆi 5~"EÆSþ#Nb¾“œåvm'CD8ÍíÑÊ-ìÐä‹DàK*gh´:[¦iýR~ÂK‘¤¼ˆJ$3‡înßãðWó³Í bfôO¿êyàб$ñÑD:Ö„‰ etÅñõ¡½^Ø®k`yFs¨-Öaù ¬¨u¦â5íÝaçÙWä„b|Bá”uÃ…c7™E…\Å€ U°À©TOµd‹J·¯×ÜX‘à qÃÞ,jY×:ÚCc[®°Éö”ÀBX÷uNX:vˆyõîÝÉÆ`3¬Bñè=›ú™þ¶?Àu©ªžéCÀÂïØ¸aô–¿_ÉþÜ!×,EÄ4Â>Fû²ëB ÍÌ_D¦3x~óBd&"CS5± 4ÄšðrìN”Ã+›“#(:î'È4:âo, –À²æpúfDì9Ðã×m[­ËÑ…¾ë»9§Û·Ÿ«5Q Î%zÃYÀÝD¥9{™É-ï7âeç­g°Í£©àߨ ù=cÇW:$8ø²'Ês9ï^ùÅ`íU-hñ¯A$Àüáú§‹÷Œ/A83g^ÚåÊåƒ}‘¡#-ûíáNÈïd!кñ, k3•OÄ9ÒœC ㈣Wˆ”æäešsk•I³‡HÒùþYe&ÎTæ8œ̹è}ÓW+n,ûÓ»‹Óc >Šyþ6£•5Ùƒ¸ ÞQÐÕõ"¢´Pyâ&ÎÒúþÐÖsœã±0Š4ùñêüüâãÇY5*>r|¿ñh`±f­Å&Ú”ܰY…y‚«/·VöR˜è«•ïºÛÃvû•GÐ&f1Uù¿ˆÐ7?¾}wõáâyB}{_u^|ÊB8_dsÁŒÖ|iI×uÕÍÖó™#LÝyYËP Œˆ'4æAò4­ÅÌaß°\Î#§¨§as²²lÛ2`ÃèÈBÒú0.û ˜ðÚ·[8ð+Úþ âcÆ~“ˆßX ìFÞjœЄ×Çw‚«¾ú,›cW’ë`Dˆp0d¬ "°‚ÕF1CP>z»ª Ús­2§§´ÛÓ !¶¤Xøp>Oœˆé‰%#€ï³Ñ‚ÎrÈq¦ÖÍõºÃÿ!C–ª4M¦!$!Ðˇ ±‡ à/6?qÿc¬w1ØcÄ`ŸˆL>¶›iÄÀ¼Îr£s¥s=cnÙ«æª].·TÙÅYÄi<ØÇCv )7èx=£ 4¦Ñ&ŽGÃö#ü@™Ü¦þ˜­kˆ$îæx+Rçî$JÓ<úK#T7=ßIÙ.6$3hES לdF”Q£Å€»!íñÔ”T-„º°„ìµ`È‚Ïá(Á˜$ˆ>%]®UQð$®Ôò¦±u@w ͪ‡ø$·ø ¤ÎDooùˆ!³Áu” ™ N“-œÝÏ<Á÷KSä'Y5w‚²±=Ð9hšvLógXw2î« ð¦@&»æ)J± <ÎÓS…#Çjt†xä¶\ÉBªxYŒ“‚jaUº°T])¨šª˜@KŽ•6TVŽŒë«´y9Ú=SEž\ð°Žœ2‚ü:BæGjÄö)¯9©7ýöì¥|e#]d§¬ƒ†)isÿx-9¬~†ÝÓCC‘F‡Ð5F8̦8Aõ ››é«,9, _åÜH‚ ¨.˜QàYVuÇÓ“Øúœç!¸„‘Q✛‰»Ð*>ÝHé¯áTy9› K2`í¨°G™ÂÌóšB4hÜw<¯RÍr³!ÈøÝ£ÀïòùPö‰ öQзçøÃcAÆlX¨ìøÐ>þÖ@ªÛäé(Cв+@¡Pðkn¶ÕªS 9j!ì|”0år|O&"Kà °¬ïÂøÆ‡=šÃi´£Éñ+?^N\’}䓌'W¨ÌMÓyYp’Ûäöx`‹þ?› ÏV¸IÅ­ÌÒRpÆã#IÜ"æø¡ãOJÕXksŽ\y®H0˜Óÿï,C©¥ ñäv<°¼!‡€$M  Ë¤¾ŠåžC{ù"K87H£nÓ´=7ý6IêÀµß55è…¡ã9YTî!ü\…W<“­¨díîø;!“œ,kYÇ;G£‰V™ ÿELµ–ø¡ ?GŒ G~è±z‘^š:’/¸+•…5_½<ß £å÷üã#^¾ð1V.ÕÓ ÞT[ÿš›"`‚ØjL ©éÉöÿ!y`e…1Ó ÞÖ«íaí¹ƒÑ=ÆØÞør5¶o°s£†^‚Îrü‡j|ÖÑËZmþ4¹^ÿŸù»$KIŸ;`ö÷2-n`~Æ Ã+‰½‘ç“(Bƒœ Án dJ˜-Z,[+LaGèg!j5u ü[šÃÃÎÝU ô†jFHÁ“ÁãúxMUOéŸ(v¢à–:1æ mÃé8jã„Jr]BÉ2 ÏÄeÖ4ÜšUÕºñ2Ly ¤m0+:a¤«pS‡°•fÁ.0ðûV{ˆ” endstream endobj 2007 0 obj << /Length 1142 /Filter /FlateDecode >> stream xÚÅXÙnã6}ÏWøÑjEÔbÙ EšqÓ)дðHƒ–i‡…,5If0ÿÞK‘Ô.ÅÁ hò ‰¡ÏÝν Øð‹3¦®5uƒAx¼°³U~¨›ÅÝÒûưq\Úùóêâêß ÛšÙ34XíËP«Ýàaˆlg4vfît2\߯­ÅÍýhìºîp.ï¼áï89ÓaŠ£Ñãê·‹ù*?Îw|Ë÷Ü3¹™Ý ‚.L­ÙdâI~ȶ­)°œX¶ï)ŠW—#ùò0aQ*(‹- Loxy%úØTÝ>þžQô&µ>ÅTPÑ/X²RkœŘHж »@äªkûÖ,ðà¯Ùª>pl–ç"@%œ¨ãžõ5¡ÇSôª)¼SwâÉü9Ä‘¾=aŽDÈàÊG¶¯m%/'“X§Ù¾]wBËŽ&‚ÓmZ¸ÇúøD0Ó }Í÷è+çXÓÞ3^c˜Io42&%àåXò—OŽ ÄÍ<§?& êA½ú‡vNÈRžÔ<k‘¶sÇŒiR5³†øÐøPIí‚ä<ór·âό֓$ ¯õ¨ŒúrU>=êsÚ‹ŠÆ¢‘ ªVÿ†DùXlîæ÷ºtÀï°ŠÚlúš-Î,yí•uG4î‰ÁÁ&WëNFêf©ä¦; ºœ¼céÖÈe¯¡?¨K§|B^mDl2XµKÚ­ ½îÓ¢ÕÛ•h"•ÇtOybœ þZx:!zËÇ Ë™›Ç^àœc^„Û®X'!ssZû©Ä1y°Õãꂬª±NGôJÕmbWÒ„"9kžÈ• £¡^ K´ëR%’ð@÷D²ÄŒ”~!l/×–ôI%¾eϪrÿ|(û¸×G󦂥LCY¿û4’"®;G›yœˆ”ëòÍêm¹¾½/—ê¬qKI}ëcñŸ·Èe›îÉæèNZ…øû{ã-‹¦q½˜B¶#µì:£_Ó¦ :ÍD+kb¦ôä]ªø^Ql×ùg À{«ÂîLþ7d%¯^e\–ü…  A:šy&WqS-Z!;êÆ—·Òú©×T„šë¦Ù*`(«C§š×Êf IÑôV£n¥D8‹ýgÌ)¤}hV¼ä§ 7b[¤›·.Æu!à—͸vý¿BÑ:W¡h¥Er¸y÷Ü¡dM^kgæc§’³³L@{V©¼ÔÁži¤Uâ‰Eõ¬--g³Î‰Ê`~$a„‹ž˜ßpÓ䥂Ühý`ÛH(9Êz¨sœÉ4çã§åj¡]Ÿ%áµv‘9¸9¹+ôëôŸ7 3,B…®‹ü·þ…¡Aò»>& T PƒuÐRóïmËݵÝOœìÈÐî¬yQ\<µ‹®.<§¯ –si/µU焯Cc}kWYIª)[Ùò¦d‚,yˆcЛ3iîÖÓ>¹ÿµÊÛs«Qݽ#&ÏÙØ$™½yú’ˆî/“â²m~é_JQù‰8¯k0 endstream endobj 2011 0 obj << /Length 2075 /Filter /FlateDecode >> stream xÚ½Y[sÛÆ~ׯàx¦SÐר+§~p]Ù£Œë8ºL:“dTˆ\JhH€ÀJj'ÿ½çì Jlí©ýÀv÷ì¹|çœo!:‰á?$l’¤œ¤<™Ì×G±y[ßLìàìÃuëf°pÖ[ùç‹£W樂ИdqF'˾¨‹Åä§èÝm¾iu=qÎ#ùz:BFÕím5±$Z48#¢eå–ÜèR×y[”7ö¹¬ÊÙ¶,`~m_Ôy¹¨Öv×?§REy]ä­9”ªTE4æÓ_.¾;:¹jK&‰ü@ýêG†r:II¦”@;)ØÌ¨{‰¥°ÆnËm}5×÷íU£Û«¢,ÚŸcoòúxŠb#}¿©J]¶E¾ò³ô[ÔNž@¡è˜ &_oVz¿¨0ß c愽zi·¼«58ÊŽÛ[7pþF÷ãcuý=o 8S¥q½|5¦ì±«ßØ£mÏÚg59míoѸßõ¦ªÛ¼t¯ÛÊþÎoõüW·b¹£÷)*§HµÜo•‰Ücˆ×ÇZmÇw¹SªÙÎçºi–Û±/¾éõ]Ѹ#þgüqhG8þÓåÇv´©ŠÒàŸ‚ožQít¨¶+7œç[`îôÒ7k|Ïúe¾]µC?Á&'`éCkPyEžÔÅ ÀPvq~Ó™…ÁµOÿ6û© ”±¡å¦«—(£iºö }qrvöýÙkoYYVm/šO!ògÊEùâq¾Øóô}ÑvjŸüíôâêýÛÓ—g'ÝŽÙ˜¢¿PÊžFé¦jšâz¥‡ ­uPÿ¢hÚº¸ÞöÚCX€·3z  »À¨{Og¬QÙEï¡Ú:MÜYÁÓ¥öÀð.ËË;XWµ>>(_üÖæ¶êµ·]ƒíÕƒ?Å»¬µ[°ÖpТʽ04%Ÿñ wbXÍÓãÒ²´OÕÝŽ g!')~²Û›`ˬ7{Ðó‘ G5PÞyí¼ò²º)¼b}¸ _8eÏEàä†@±Lì-Ò!ïÑwÅ›ø[º?Ñ0üæ›ÝdΈ r(çþq©·Ž¸šWeëÊľÄìêÀ‹?,mß÷rrä¼'SòÇ[_’Aø!qÞEÍÔ³AÈr˜÷É1d|d{ÚÔ»¾ë=RÕÎ/ß½;9?ßñ vÙßí&¯¥ö]Å7Éu^à¡qüNÏ1§Ï¾ä_ÿ€WïàŠœÄ@‘CÍXJÒÉŒK"b§ûûi&ÀCs[9y‚õu©k]ε• P/’IÉPj,ˆrôëòÓåÙÕç·g/{X5$ªÔwv·Šû\•ŠŒ¤”³}âÉúËa",Ð7­6Pl‘⸧Ê_NÏ/¼2ƒ–0¦‹Œ‰â¢§ uº èõŒÓŒÄD¨„J絺µäx¡@v L,_k  ÝaV„¼ cÎ53áÆÅ4qè-‰Ðyp­*þå(¶¹uV¹¥Þ¹¬úu]æ«ÁÕ³ÉÜrO˦Xh;‡­Èª‘öÕÀÎXTÎâÓõf*idïB¯Çôä²-Øàx*ƒzcx¤`¡z Œ¡\¨ûßkÄê¶ihÝn벫ÉrßžÆH4–°úÎôqßzz=ïP ¼ŠáCˆtv€Q!~Ý…mõ`½ŽªÅ“ŒÈdXªÝuaæ\—WþHÜ­BB òlÇÏFù®ú )Àмµ£¼Öv0¯Ö›m‹lEHS#ÜÂÑ8Ò3üù@bPB°5Çå¥=éøI¹· ¸Üª œ è7¯i£)öcc·ÔÛ9 B»`Àñ ²} k.Ì\Ÿ¸¡(É~±)rs·×N>®\ë¼lì¹ NwÎPÃn©Hªb»^t½ÈÔçfÌ9”¦P‰Â¶y¾Â»½H(F,éG¬Ó9ˆ‚2Û)J¸Î®ðó”"TT¡…dxûCVàq°Û²N|aBƒ »¬j†ÁÀ*<Ã÷ºÅ Neãn0j<á .„~:ðÅ à èà®H£üF‘8M¿PPºà‘@¸˜ú" 2’ÄVËØÿ,ªíõ¸Ä@ôÿNNྒྷûãUÁ2ñLhb Ž}€gðäËb#¹`F´Ç|¯³8"“éA€B]tÇOøe6m…ì?˜|•^¯ˆì’û²/ÐÞ³ap×sèÚ7½+æh À”xÂï\â­€mÀ>wŸßá!|~‡ù‹&Å5®Í}üžÕð¿HÅÊQظ1•®rLØüEDÀ™¶ŽrÒdHÈlÝ¥ÛÌñ¬‡Ôv"œé:‘yíšLÀ5Íœõ´±oÚ[?nFfÎîs½Ù,©uמq{£];Úž¦MHàY1g»íÙ¸@âwÕ†g¡w‚/Š•kžðÚµˆ1ŠÙÚý±þè qï‡ý)6JÅ¢·‹E-w$+‹ªÒiãšZf?´qïíÞp¢ÓiçØ~ʀ餻lÿÙŽI ù¨¡a‰úUÂÖ( endstream endobj 2019 0 obj << /Length 1131 /Filter /FlateDecode >> stream xÚ­VKoÜ6¾ûWè¨ "†O‘Ê-’ j îú”†¼¢m¥ZÉ•¸m_Ÿ!‡Ò®ÖrìÀÆ–æñÍÌ7b …K4O´Äl¶'4HûëgOXÔË@1;Ðüm}òæƒR £¤ KÖW‡¦ÖUò%eT®2^“§ç§çäìÝé*B¤çƒíýI¦¿—튛tW6«¯ëÏ'ïד;ÅQR<1¶Qû~€yÂ)”âc€<'TI ðß®®^­üÛé®Ýõû¿»¸¶îâ¶ìËíàczó!§‡9²Ü\zÇÁÂ_TQTSÅ¡š$‰JüÙ˜ß?SÐ\¹qSø¿|¥I?'”Hü4·‰ \{cMòçÉ1¯™7n8á š%÷ñý高Á æ”c»¶­íK×õKY¨œH3©¾Æê õw{?Q€n®^"I)Qô¨Tn)MŒ.ÆðƸŽ+­Á¨:(‹©Îz7RÁ …˜ L±ˆ¡uب·ÐÈ&íêЮnl_×!$[»ÊXºíú;¼_6]Ðßxí¿Q÷ª‹/ vÝ^G»¾Ñ,ðÞ]¡hDÛ·0A:‰¬2)óôŠ·vt)£Kí]jp BƘ ¦,S~ÓuÁ‰¤ù}0ç0q8Š Ìz@›åÎuÛÒÕ›²iîP䣷Y€uš1ÂÒ¸*/giãjíÆCÙÇ÷˶ƒ»±xX(Üjc0GH “øÌco«€N¦0ȳzƒñ¿wº„#Š©‡Fg”,ˆàSov—À2*ýf7>sÊ(ÓO±Ø]kcõÛ&vPkm5ìc™zP?؃€Ð¶°u‹ÉÁØiíó;iwÔÉg$ Ð 9êÐ%3Šh®G ‚‘œ*|IrÂDÏN;è+ûzL²\Œ=Ç_ ½>Æ7¼†¹:z´‡ti¸EìVPl;7{U¤m¯ÝÍ|ºËØfeß—ÞÊÝÊB63ZfgF#$‘ ?moWŠ¥]ïÊÖ½]W‡Í]cg™öÝ®õà ‡Xê4*nº]S¡Bl@^†¶‰*»ÁF…0 Áô‚ vuÙÔßaü»eˆ†7]noä:ôŽ£I€§CMá„݃,8õÜ~dL‹%ƒ&b,~TÝî²±‹+¾ª×?¼ç9ãDéü){žÿ|Ï T5gáÏZŒ"+d°D•zÆšŸç:_ór°‚€÷Ã¥R·n ÛöpY!ˆ–ú%À¥"ðlNÃ|<\ û>`rª@öÂàêÇ??üEè…Ï^‘šüÉS/ ΘÜ_‹^ê·‚ÿß3ÌìíÃÏŽ½¼€2V¶oîÂÈz½PÇúr‡³í5ÀÏÒî€1.Š'nF0²ÙfÌÓoÈG,ݸe„oh¾|¾žÀ„PLÃöLhO-ŒF*4ž ­gGÆB á \·;¼ìé.‘ÁJ CøGÆ ‚#:Ò!è#ˆt—‰1Þ_§C??Amæ endstream endobj 2032 0 obj << /Length 3037 /Filter /FlateDecode >> stream xÚZmsÛ¸þž_¡~£:G–‚Ì·4‰sîä|W¿ôKšñÐ"d±•(IÅMû绋(‚íø&3&µxÛÏ>» [¤ð-_¨B$…P‹ÕîMj¤Ýý‚^.?½a¶_ c¯ç_¯ßüåLÊK“2-ÙâzíOu]/¾Dï7Õà»e,„ˆäÛeœe2úE›ý2æ*ª{lÉ¢õÞv¹×­îª¡iïéw»oãCÛ@ûŽ]ÕÖûú¶”yTuM5h˜‡±¼È#–Êå×뿽ùx=ª-¹Ld&~ÐF×ûÄP†Š$K¡R%9L`öƒY¶†CédY”°hÝáFcÛÍÅMrùî‚ÄÛæ®«ºïÔòÏT¦½Öó-ªLT‘-T*“¬fË m°ð‡q³÷S‰n|ìMð¶ù2S—Ce©ùåʳ•Eõ’EÖÜU‡ • .GÌ$£™Ì |ý‰×äv<-çöò4Kxš/ò’'Ðås½c¯{Àºù¤F'ØpF ѕɢœ/ŒgÁÃz´O%Ͱ¡1Ô÷þÑ]¯©ùý‡³$äo°'œôee’r»9W£ß™?/ûÛ•âÃÁ¸ñU?üDÊ\U»‡-ÜxÛRëÀP¬­­%NÿS‹àPi‹°'!Œ¤=÷/MÓ6ÃË×äð@ í»A×ä.Or9Û¸öxƒ‹\‹ž>XôØUf  Áôè­©«¦Ú’d4ÄÎ1v5ǬfÇ r@Gí´£·ãj´màòS²eI™Í<þ|@}8ìøö;¾ò¸è¾ûwO?:ØcŠRFš™>ÃF“`„ ü°:ä0K¬éyÔ•ºN¦}b2U$¬T‹œó„±òÕãÆÇÞK8_f 1¨Ÿ².‘æ4Ÿ¿Ÿ>îd3ëX²¼°À‚Í!`*)8,ŸI™/‹í{ÝCÀ2›ÔTŸkzáA„91‡DÝieÜe'`ƒ­6¶µ·î˜KÒÝìétßШ6AÜΣsð‘*s±ÒbŽа¿Ãýk‰ 1x5ÜÜHx>t{ôçoM­k’ ›jÒ§€[Òlm#E@|ëW8qàa…Sl¼8ý@£vfkúa¶ ¨5õ0ûa2ù¸h~:õÅá®7º%ˆ³ø²ðRï4ŠeP4;6NvÛ"e펜+!ö+ é›^Û‡3æ“‹àwÇ¢áÅÍçÏ!Ä.$³3-`’.#ÿk¬®¸•­®-‰ ¸C0JUä4ÉÙ²pQNDý~§O£€p·ï´3¢j]а"¤†‘Å_‹³“€á©&œâ}ßÜmµ†Sâ7â&•S•Þ#«{$gÝžÞozÚ-oÆeðeÄiœr¤wØòöù•Œ%e)^ »˜BxcÃ)„ë0ãs©4|>®¦2€«Ü6lájQšî›ñ ®ÚÞ/h>ŸtÄU«ÑÞ±²ÇèŽ×ß,ÊÎŒ#‰qiÝÀLÒZ^ÂÑ« 1ñÀ¤×Ø-‘E´>´+;þ"œÛ³b ‡ØPÓ³Tp&âí¡»5Úß‚yÃ-èqÛ´ßVõ:t%XÁ(-Ü`)ÙÓˆ¸0a¾ÑžXî.ò ¸{95ú•rañ!˹Å”|À—)ÃN6`¼!ZÉ!|Bâ4þ† ¬úq¢L8{ÚP›ìàŠ3؉ BþÞª¸rJߌY)žuªÇ.ðó;½W¡SŠyN;íGZsV«~¨Í)YS‚Ç„é1ÃÁªÚnQߢðŽª`SƒH,U–:Æ-”†’G ì°#Sb {}òhÇÇÞ¡äq¶Ì l Jà°Á@Nxã‘_ Î9týŠ”Vö=Ñ%Ž"„CŒaà+™,Q¾C®s|ì°k6¥»Mx¯6¬äÑÜk{»±ßb¶Û=¶<Ž%˜ªÓ.ÑÜí\â5ìmãÖÆÓY¬éß]/cd€ŸŠAô¹¼nóéãÅí‡gïn>_?™’ù.;2žZ¯«Ãv˜Åõ$¨Ài&è/öîꥵÙlqÌcuo¯61k¶•ñ|÷Ž} ± D¼BSvªéùÅ?>^^ÿzñJuGdW;#;Î@ļfmϘèêÑ*įäéDøb?4+M¹§¥×“’ „¹‡!ãÅ¥™9¢Fʳf›‚?“gS‡]eaŒ(k†Úû0^²ª¥i0ŠÐÕœÍ#ï~=»^&Y§¨êÜ ÚÞï»fØìú?Ñ%}W× ^!ÇTgûe‰ê}iTú? ¹¡pÕÔ  §ƒ£8l«.@éÇ*€G¼]AÉfîcì¤ÞPaÄü¬‘¬v= ›?RrlDzÜ4£Hd¢ÎxG‡a¥0&^Ùi±6ÿ;½Ó𪽷Ú(KZ¡©ÖñÓu hÖû]…• |7çÏÊ6  6Fñ}§+“iÐ !⓪„çê9âcÕETŒCb$>c kz#x×t­W›û[Ë‚”HDΧ9X%ò¤TÊä½%&eAÄžó8^b~<ÐK§±à¬mO"8ÔQØIŠ-Ê@@*EýÄlïqÍÙTD9áεk­ò“C?-zI9Ü†ãµÆ ¨ŸC»<4tÎ ~Ù ±óA‘ †@ ¨0ÞêäíÆ`á«Ú™šЋžúSõÒï8:+R©õ¬Ñò=ÃôL穽…8NØÌ!„âJèºêL94ä)y:æö.ôSÔæ¿zVƒ˜%×^ÚN©í“”ú ³è1OÁ\ºÓkÝévå•) Ï’’»"8aæ…ŒßÞ]þy‰t¼ ÓêGž§Óì£fÂ=†î(9©&<;r_D.;ÙD^øµ£Ê‡ó«k§ÌäÜBºÈÔ”ül!p*±À ›³éQ~Ò÷2exŸõ¼Ì}oƒÜÓÃc#À›¹}&½KŽÝ+žP8ÉJQ0.RÑ#PÁ”¾üz¶eàD'Å>1Vç„rŽçU2P:V2°…B±òKãBÖ’ÔÓåf• /@² XþªÍfxì›'‹Ì¿ *Wk%K26­•z%‘“Pÿcß° gJ€û• Ëó—J"¶wìu•Df“Ží>B˜ˆåÁí).Ä\š*/>³•)™à·;æ3wÀ~ÐfØÖgl5 í 춦 è+…T¡‚)Š'”x2ÿ)É7âÖöëõV¯Ü—¢™sßy,ó©z+à³b§‘þż ™‡^?[•ç æƒÏ²>&¤¡‰“úM žÆ@B“I¬)‚ÐþwަæõÄ/gÁ,‡ÓËå«+FL‡N¿ñI"™ZðHÍÿøò5]ÔÐ×,†GÓq· Wè.ÛÅÕ›¿[Pš,Æ•LÊBàL¹²Nûºò…@<Tµpß6ޱ4`˜«òñZÜ=´}sߺ™NÞÍ >+"†v2I)äˬ À04«A]™+"ù$™T‘š7ýB"½*¨õbQD‡—~̘±¤Ä ‡6Tahég8ÏB,I– ³ÈÍ;'פñ´l€Õ@¼f)VÁ½ýõ‡íèø8> stream xÚÕYKo7¾ëWðØ^(r†r#@R×¹´E`»@[#(\[(Œ¦Và(@úïû 7Ji‹]ï*Mz‘fÉ΃óØÊÕ•Õ¥ˆÿ\%{Ʊ $G¹AŽ+F2»Ä¥‚ÿ$6!.WLÅ •F؉T›ª®T,ÎÉU%¬)NÙ¶O Š?AíÀDüÕx7ʶ ‡íR°Í3&R² –e2œ"ÜvQPÅ(ÁDá†Ã©«ýØR-´FG!ªÍP¶ˆª:Š!,@1(ÓA,ŠM5PS6Çá×êȶŠ& e5^Ð IãZ°BŠi¡dG%6Fe5XQC°1ìR;nXQA!¤7œÀ˜c¶8¡ñUPMõØž!.¨ôo'…Ž™#ASàÆÜN€M9GÛ²±˜Î Z.°i2Ti2‡J¿ÙZ>9ÖŒ‚ÞWð•!E£LŒ-ÙZ5;“­eJ.q[« *eÛÙ¨Î[àCÚ,pɤ`ˆœrh'® 4¥ \gQ­æA¦m6„2T ÚNPƘy(ø‚Šb››—)5ˆÚV’Ë8ö8ÁgAU—3œ–LÑ9›iB .K¶+ œ8˜õ@%P©¹V˜õ°<Ìz«N‚(xPpÍ%EÜ’Ø(•… CÚxà1›¸’²¹'ô(b¸ÒN}‹ãËÉlµ89Y,OÝU´ ܹ[þôó/¶>@k÷o_½z¹xòä_¹F_ ü 0eò¼?ž­ï7îäÄ-Ï «ÚáÏàd„ÛÜ=Øuˆï§Ôž¶@{Òí¢C¢íCÅC·X-_<¬o.Vwå–/NÏÜòrõnã>œâò¯×+L\ÿ¾Z,¿Á‰V÷›7n²­_,ÏWoÖonVmŒ»±ïW·w×ÏÖïÜUÀ@Öì —6õU_‚ßõ6AÑÒáŸÞ߯±éUíX{Ü`±¼xûÛ¦=wwÿÇbùlýp»z蘄—v”àâB]öÅîGÏæ…%yá ÜÓ¦Ô ·|¾¾\;Øã«oß]ÿùúÕê×ðµ)d×NˆÕ»v*¢¡ÇžqIÕgÜ«a 1pøe™ã+Ó=B{<¢<Ê#4‡†ÿHu¤f‡qCú‚œjè½2»ª´Ln¡k–º2ª«ã0K]™¦©á82•™ò|™d¾L;†ž,žÄñt¶x>£ÉDe’4I¦Ý8.<7ŽSPßÒq¬Þ "ÎÕ[™C¤>ho¿<=?à’Ç…‰8Ôï¾¢8¦âQÖ Q;ûØ[3ìQYûÌñ‘)áŸÔÿ_ç‡Òs{Dç{ZëiU<ÚûÑ£¤F+<¡€e&ω{=íôùå§•0΃öpbD!#èQ¦>4%ø$¾J¦š<Å8ÀGä½5 ƒ@Òä­ <"0×ý3µÔ>Bu]zj©òÈZªÆƒLS&ÖH;š˜,RíI45Mi÷ú×.ÿµ6|fh ’K²$í˨ÏQÁŒÉ6çÇðÄŠ~}·tÇ)[§‚~]Éç˜F§¸:2uMÄEd.©e0âܹþo’†¬³/YÕ‘jÞÑøÓ0P—Rä#“Xì¤#¹VÜ›8F ªtD ¥ìYèËïÚÓ'ižíy*ãOX'–ùÖ©#­3 'Œš4ljÀ/+õQ`:´‡I6Ø ÖÔ½.oßs:‚òvd;E²%Êvj‹y/0F¶Sï…žý¹¨/µ}JòªË”}ÆÝ)iAJo¸ØÜÞÞ½ÙÌë+ÚKEKa_ºR{—Qì]Q”OÇ3•êÑ_:‰êâVXad¿?­°öÖÁ>rñÕ¾˜ÇâcÃòoü6QË endstream endobj 2041 0 obj << /Length 1514 /Filter /FlateDecode >> stream xÚWmoÜ6 þž_ᾡÖ,˯ûÖµI‘aK±ä²/]8gÝ¿¤²Ü¢ÿ¾¤(ùìNÅŠ‰LQ)>|Èð †IP”‚•¢ýUl¤êÐâþÝ·z(F+Íß÷W¿ÞdYÀcVÅöǵ©}|yœï¢¤e>Þ=²û×w»H>NRá* ÿª‡]R†sÝí>îÿ¸ºÞ/×eIƲTü¤oNû,sÆ °™ä,ÎRròÍØ÷ãîT"ü¼Ë²°V;¶èXê‰6j%ÑA°—¯íñ¸d\äàƒ1AÞ?=ìß¾»¾{z{}óúñϽ=µñ‚sÁxœºSÇQÑ%ú,iÑÈc=wš>NrªÖ£zåõBI«ÌçÁÍëïõ‘H Vˆ,ˆÐŒ¯¼Hª"ü7Îâqô1é¯>Û€Œã6GYëIËI“BÛ¿t²—ôh²!éþ–¡<´_£¶3½‚èâ4¬‡ÆVR¦,+_X·wÿ\ß?ܾ¿ó>m"XÆ7/Kî›ôQ¬â• ´ZÁÏøKª©5XÈEØK}ÿ ó0í‘6k:’åaÝvõs'ñYØ.ÊDÞZJ'œd'æQPL§TKÈ×$¤*èñ÷3½™¢³ídFmæ¡1’ ÈŸ²ˆÁÏÒzÖ1àx›d©”ÔàÁÆ&éÓÜ©¤žÕ`|ÂdÇ,(Øÿ¯÷«Ãä$ÇÍs=œdÃ.éå¬Ê²Ä@§¦£$aœ.p 9œ‡Y=&Ý<Χ'­æáPãóCy¼Éw‘B> —pL‘½¯Z«¥,rXɱͧ…B âª*Èó”|ø ìÁ+²´¾Å>,)ÐV<\ýmI¦Úb·dZJK 2@î/6€ÍK0—•ε¥<|AdPéåê+zéfœ}>Ë)g%_,wò¨}F7¥Úh$ ÀD•la¥ÚÓYûÒ#8e²Ê÷R^°8I6EùÆ g¥iB¾ÃÊâEx£ ʱf€¬Tƒeƒä-Ô3¸ÅE3ö5ºa³ÀŒõšvÒª}ž5r¡¼‹" ÷g„;£¿`oè¾úªØoœ¦_h· ¤•­'8ò).äâ-ù ÞDç K*J«8|FÔ—v²–ôÙéê®#Ù¹¶¢a$ð@F$¥òq=Àñˆ.üà‰Œ ^,lÁ%h°¢"¥»Q·t.ãà\wf±D§–(w°ò¥ÌÍ®Ënõø:ód X~¤š´§ùy’šÖ˜ÝÍEkS´ÉÝf¼õ‚Û”G¾˜ øö¢ày¾êÎø í¬û‚æL{ø:‘ RfWÚj-u« rAI‡mãwd ‚Åsïæ‚NÀ¦3A5W™†í‰cýЦÖíÀß'4EXh÷ÙB»Æ¤£zĘ7ë·?ê J~š[å®Õ£í73¼“ /h8ò0MAÉvhµCòœåbƒê£–Êu®µË$£²ÂaÉEKÅEÖË CqèU^Q¨vp¼í_vˆ7¥ëAÿæs ;_(øv Ì8|óö†ÊÎx䡺ëÇI m´§º·«£¿?ðfàJx;"U,»LV—ùkÛ¸aùøÂïĶ{0€–> stream xÚÅkã¶ñûýŠE?ÉÀYåK§è‡´éõR´iÛ.‡ƒ,s½jlÉÕãr‹öÇw^”d[¾½}`%9’Ùá¼d}§àOßeæ.ËmœÛì®<¾Pm÷wÜùî/´à­q=ÃüÝý‹_¿J’;­âÚè»û‡ùV÷»»·Ñï‹SïÛÕÚZ%_¬ÖÎ%Ñ_|ÿجÖ&‹vθè¡”½¯}[ôU½çqÝÔë¡®`þÈ€¶¨wÍ‘W}X%iT´UÑ{ØGë4O#­²Õ»û?½øÃýHvb’8qö3ï°¯.šÁEm¬à¦á¢&Uâø¢IlãdµNR½Z¢¯¿ù™%Ñ?±q ôí±ê=ªzeu¼9ÁXGÍnÝÔ¼f[t~Ç]Ügcae7Î6Üþþ«WxUA>º[ t¦LØw«ÆÿªV&Ú}!kÏÄ—dq °è–·_ÎÚ¨Xer÷¿žôâðì–ß~õê%‹q÷íó»'¼èÍi¼ý{žò7¾_'R6ý¨õaºæÛ'èk>¿;4+“G? 9oŠãéJ' *kòó5E×&ÍÌôª®úg‰í†hœÕ´=ý—ìÿàYžuIͳG½}ýçBÙw||¥œ\ø/û8‹ÍoxîËÃFúnx·v&N& q9oõšôÛ¥›¨ê¸-¸7™Ð›¬‘=Qc±%ØpômUY^£l„٨㠑DÙèçGßzFéý„›G"ÌN€¨¦ç„œN- ÷cu,¥:´)tíâsÐÚX ?_/s“È1ü2Q.ü2.§uTÅ>¦®bºÂ‚ °A:0ô­z©ß š¹Mu dýÙ! :/àÅéDƒlÙ1¿q9áù¢DÄÇ ÊY º¯’›j¾ªP­¯¹‰@â&ÍvÜ 73àæJGG´bÌTœÜâOÜÌzª›c%ë¨lê®o‡r¾$ K޾¨l´Bøà/àBµ VéòVƒ&FïpÉI†n™Ú¡Þ®ú.^­S½‰îùÚ&:?‘@dÈR/ÙuÕö ±aGQ;æèÙEYmQ>…Óߌè ýTgš‰Ï*SÑ©hûªEËãk•CèÏ8Ö¡çAëˆäu‚݇ž”ŸHF¢'”¡.~TÚzOØw®AÈ™z÷­÷ŒÒ“O俽lHæð25—$ÄÏ9CFüÑËA`Í×¼+\W´ôøUTÛª”>IÖ¥)º/^S•²Ñâ;E‚Áì¿Zå6¨1¨»µ'åmy·åÅŒÞÔ‡'ÆBù-Ü…_‰e›cò«ßŸ ”OàÌ-ÒŠ·ŽÃM€ËÍ´ ¬‚dßoÃA¬ß9ã‘ð‰y¹&vß-(Ù,2+R_±úÆ„5ZÊ,V¹Ä÷žŒÄ_AÚ4x,DùóH¦ée@ËoM€ “§­ulÆ -dCß'éöþ„Ütiôš]5í,æê¥,ï¹ea°šö§ó¸ÒE;Ô £¾Eo~×ADŒO y—Œ¦UhG„bТªÑ]‚çåSžÆnÜ›§}Ôdxx+'[1Û ìÕAv ‡ƒ¶ô„ ’_0ïÔ %²çqÙì“AçÎgOÀ^máRŶB $f㜌 ¦%jxMë÷r7WÒvì°Ùa’2н“åÍÅÉûŠõ¤fø°…o?ßO( ›Ü§y´cÑmÝôÜñ‹²GK2YÉœè ôÐ^S2”^Æìúc$Ó‡YrF&H :סBƒ¬o†b§R›Fßøðdt„š {hÐuf®m2ðIxÌdÿ§P A¾mIr2 ¦óXÐ$:γMµ/Æ™ÉưÞ-*É ,ìÛ%.ýävÐU©(WcµL\¬ ˜ÿz–¶ï×`…qÃ(B_&/×ùçï(üfõßäÑÌËß.í½v kHÏÙó½Ðп1D 1°§ôëì` ¹èͳ2Ìç<ÿþ‹ô&Î]ö,‹òÿÓ9½Â —2@GOþ¡àŠFô°|.OO„g‘H´½•lz,ä9ÆFësÁ±i­0D°ÙŸ@é+LF:ôB6‹¾iÀåʼSè…,‘G<ÏC˜ ¸ŒY“í“èÌCØÐãñQ&€¶ƒx,Bì¨1ª([_t~Á¥¶»lºþ¢È2Î]ùÛ[¶÷K¼…æ[HÏ8ü›HÐdž1Ø"èV²V /N²#m¦2L˜‘4%Á7®®Ì,¨€AíÁ‚w‰A‰¿Q¢;ÔiŽþ¶«ïÄ¡–S¯ êª=Q4†üfu dVb¤Já —«Tˆ÷>%”JßÑ‘iÕÑ~(ZÉ™½›‘–© 4JÏy æzÉÑ çUò¢ CŽ;[ŽÚePí÷^Pá,ÁÅ»K$ öfù%ΉÔ%ùèX Ûò³(©<ãÃ)u‡AÉUwAꮢԤ•D¡*PÑ®õœB|Aúy§rJ˜`|àë 0öûÖ¹þ€®7^4N3¯q}/…REÚºá)V³‘lZ'S»†Ç]#›_­9­Î@æñÀ¨OÈD+iÖãõ„RËj‡¤z't¯xNó͈Çâ°oZ°‡ÇÞÊ̱Ú?†Z™=,ZÅØ5ì²:u9Rô—Gù8‰n©i.¢‡’[ÖÇ#Ó: Ÿ‘ÅI$ïlÛYÌ‚BéÌ)u]:Cà­Ò™6±û%åÏO–Îð7&ûÖ+Ù×à…ÙÌm6³äjìÙÚæp ï{jŠL±?~~Ý܈Ju²‰²Ëfü,ÈÏ%5+m-ÿ&Ádf]d›ŒÃl—\}cEÐXöÀAx¾ »lÁ,Á‹’ù®Ñhã\¢ø{g"åìPui<˜JéÕÒ®½œ:KŒ“©,I·–+,çz`ñµøD¼¹Â"ùBq,:Y}]hÁ%â5õYÑɆ¢“ì'ŠN#mJŠN‹e$®BYsýáÈ̪P#âPë³f oØ›Øy,‡©8ɾ‚»ck ¬ …'çf…'D¾.ÂY}¼—\àaªìnHI¹P\sá×I*Y`?LË—<…_-)Ì—úž ŸOù| ו0P9ሚU!ă“øg)›uå³óå{´žefù=–' —oŠ?~û7ŠØY› endstream endobj 2050 0 obj << /Length 3672 /Filter /FlateDecode >> stream xÚ½ZY“ܶ~ׯ˜GNJÃàª<È·R¶ìHrü`;[Üì 9æ¡Õæ×§/ðZìÛåÚª£î¯T›þÔ&Õ›4 ý,L7ûó‹€ZÛㆠo¿|¡„n„»å'ï_üõ‹8Þ¨Àσ\mÞß̧zØüè© Ûîtf‰÷ý›ïý·¯Þlwazßw¦ÅRä}SÔ[yCQm~ÿŸ¿—‹uìÇQøÌ½YêglP'~G¼Á}QUþv—Å¡÷úf»‹’ÜëO iàØ{ê¤zÓ´LPp}¨·Ê+‰(ó°j=”]ß–×ôõeSscÙñÈÎôÒP¯Ö’a0j˜†5×Û]{¿˜½ ëOv&»¬á*4ƒô@;ú*VÌ\1ô͹èKdòŽ?tæÀ‚/:n9˜®<Ö» Í×”t=w•7ü‹»„éA–É\–*Oý4Î`UZm¨‡öêTÖ®€Í«ýæê;·8¥C(ãpw²^Ç[«›~Ú­Oœí ñS ¨b?Ocú è$ñŠª5ÅáŽ+gÃ<€‘WlêA®(iê.>–g<-¬˜¶ÅSÅbs#´'ñŸmÕ]yÆž¡bQ)O”H¥~¨³¥½F]ËDùàW.Bווá&e¦½=Nz*ê£m?;FyE[œ J±7mÇôÅœð÷ï>–QáÌ}Ó!°¦DŽZÆ Y8®“Z*—šWkʺì]ç$~4ÝGâVÁ°„Õ¢ìA-Ëÿîã=+íMmÚ¢'U‚ö™Å‹fÞ{Kùa E5˜NF–Hyk®^#ów«Ù«¢ëêÆ ~O÷§£ÕÄ4ôÃD/.Yßõ/©Kqì«LÝ7J·¥U¹kr†+°Çš øØP+b.›‘„,ëV by›™yeSlµßëêƒi«»²> ñ\;ˆeá`qòt ‰÷‹]šÎ%MB5 Àܾi_¢#I¼®/ÚžÖˆ¢lG ‹ {qIÐbÝ©^¾ŽÛ âÕĺ¥wõ§¢çRÑ.ÐÙgtöXµgO4Îó–Ãtz×y ÷8¡(öSµòA±JxX§":`%Ûdœ·MÁjQš/6öÈ=ËüD§– .„k“ßÈsMÖˆV—NôîBÊ×´}a=4v£ªá/xLÙ6KKä=póKHëÔÏôÊ2,m Áœ¶9cIYp¢&è†ýUyÝí÷ –â/¨ ˜&4‚n˜ÏÛqªHgÌæE:òà ÚÄYægyN0Ï¡Ï@®¾Ò„÷–-sàgÇïf8€ßzâþÓSqé‰âþRæïÇwÈ 2Âzkžþ!©u?¿D7šx—‚üBy:È×\*@¥9À—8½‹²'À¬¥ÞÍÈ<­'¥½ñÅÃm°é€]ÌöŒö{Ä_îQ›°åD˜G6ü;Y<¨ Aº=:lY‡qUÇMÑ)*ÿò “íýÍáŒ×~ ¶Ø_ —ÃÕåp³p]ª<ò“8\^d¦te7l»„Æ ».ä«ÙOcýT ÓrË5±jÐ@áÈ…‰ç~¶XX>›¢î˜Ž0$49˜ÎcÐ<õ$€V$@Ûv#jÇÉ\>ÓÊé dp „;€àq&k|±Íá,k±òa”¼1­©÷³“Tàpc“4Zg!ãðöê»Woÿ²Ålf›ksËÓ`±×(÷35*ZY%_ÜW_G#©ªL¶Ø‹Î@d#ß´•Ï^¿{o7³ö‘÷ö~F³½(—x‹ä~¬\ë—¦·ÔM1T=ûí¹na'cx(ŒHÉw a›J!|Õ ®‰ˆ|×Z¨¨ M Hà-ÊÌ«_G ¤ãÜóhË €ìÏ?›tB” .osK”ç hBŠ·¯Ú¼{ñO1R‹Õt.2„™Àûb£¾Û†E•qi¨€‡Ñ1ÏÄéà$Ñ~šŒÇ÷R¢H&NuŒ0÷ƒr„-|Z+tâÇжЊw¤i$³#.a,M_™ö\R¸‰´M+ŠcáZìý öú à\C€â².1àþQlÎ ƒ“˜ÐÇK×$©¯ÕH>cF"ŠJ\;G;’ÆONFœ'Þ›¦/÷†Ù&,ã:öÔÏÇ).g×9(Ç(‘#¸ÞH®ÂTX͉ñà”U>*Y(jÜQk~Ê–âœÜøÍDÝ.”0'ˆ¿ ˜™+ÄãA6“íòRA$«tüäSPce «ºÙ…ë:ÚðinÍåqÖ9ï‘Í»Jý Œì"ˆO@÷?ØTF–HhœØÐ8YÈnèJ`#‡xT ñ¡r]ôµK†büèÑE4lv¾ã-±a‡Â¹é(…zÊÍq/ös¼ŸRª'Jw…1N~žñ¿`Žv§,rðØÀÝBUGÛ!‘%®$’RÎeÀ/È\yƒ! ös^ ÚÇTç«Â„òUHÂ’1M†›, „hv8g‹Æ5ϬqÆÆ‘›¤h °·!–Üq?¬œYâgØS¾DãÌ,ØO¹éÔN7yŽšÄ“ÇŒÝj§‹È¹˜‰™ é({þ­Lq&‚Üð‹P§„}˜ ®D67†}$á5¡îcmÓZÊÕ ž,º8ÇBjUcó¤#ÒÙ›€å뚌ÍX–9ÇÔ$•û¢¬: k²¹X‚e®íí6Vž9íþæŒÉ8µÑöüÀ–4·f €…Ú#û×ü^v,ðºÛ†:ßTNRHDp'a3 ÿïd1dÆis¿yúmɧ´%KÒ9L+}ãã åÊû)ùë½Î ´4YN7xž?&£y3kß ä"Ýÿq’†°ñÀ9Û ì&«[ÚÀ›HMºm†ú°k~ TÈd"dÚÙí]ÏâÕ)ó˜“Ék9}­ÐOð½gmT¬(137\ƒI£ï “Vfþh fºúÙ„êCy_Yï3B÷ñ¸¯=Ôr™Ó‹V`| ÉÑ0|a) .uŠ(ÕC aƒ—ý¶ìŒ;Ñ0$!Hôh2\/lª‡«PD”þ‘H:ê~sB‰ß‰€—aÄ4U ÿŒPäÐ x¿Sƒ¾ ×yú'ÄšÆ~¨Ò'…•8]X ŠK"€!”M,>ÒÛ%+nEz̲¹Çô$8ù¯è1ì– Â”8޵4ÏífˆƉ3pÎÐÉNŽ`³ nqöXK²Fç‚S2eMÉ©À3—®¬8³ÌÕm‰B?G¸÷Ù'__}þÝ»×_ûÆ™¬Õ~žç YÓäl'¡ÐL€URepEÙlá+=¿!7\ÛWM7ë _y‘ <ÂÕ`’%=n2Y‹Ü[ê¦ þ\«Aç °¨4Àwj°;”äz 4RvÃOè蚡ݓÿ v§Æ´: GAýûÉ@Obg‘(LûwgÊ?óƒx£ýð!¨qZxºw„yâñÉ ¿AÈR¯¸9}¤Lç©"‹Ü9ÉÃúkOµÃ]Ë…é°äxõŽM[ö'<ŒÜ>”`ǾH­ò¹6Ae϶²¯9Bc>ô®“¨Äûíž|T˜‘^D3û"ÚqwW•Ç%KàjåñÈ¢šôÑùmÁ˜×Ù1@«æ¨ÒÔÍp<Íqh(¦DÒ•÷à¢@Å]¤"~HÔ©ž, VÎÄe°±*ÒØ-Ä"F¡}–hÌãL©ŠÁá„àû,]‡¸"‹~—Ò€[´¢©T”åÂê¯4<‡ë3š­Ã ¬±iÑ8À½Ùa•sЮ™Š›¢ÛåÉ~àÁOB ª”uœŸ¬Ã&PŒx·'«x59 / ùôrålâ`Ö¹DêQ._;ä³Yª^£.ÞqÙý<‰x÷}ôuwg‡.³ëÅš÷ƒ¿'BÑhÊr¹€WžùQ”< y-ž4W  \â›? ý eZùñ(û] KfÉa œJGèzð± Œ}=eÇ›ÉCA×_œóPŒ”#¿œ¹óˬûA°ŒÕê«qöß”fNäkíÊ2ã—.ã{=ZØå{ý,‚·Yn¤ÇúÕKýâ­â+ºä­}{.{¾÷Î@JÒÖŽKôª[å”ÖŸÖÉ<Í”x㪒mš’Jü¡¥¢ì‡VótÔl ¸#øPI}½MeÙ 'Š 1³çTJWØ„{ó„?Õ£ Ñ—8`w_CŸkip˜ü%–µó; ¤!#–ÅÖ9—·v,¬Eß⽌o˜æ8À…:c§FXã"Vês¶Ä¤îfŸÄí úÞM:¶ŒÒ£Š€mC~¢E)´ãwp?l³ˆéA’Ðw2m?¥«÷ÕpŠB¾•[É6I&Ù&éÊ“u2´ÊŠ{_8ÓŽæcߪ`dMžjDØPX¥™éaŸuß¿L:EΟ͑ºG¼™ h胄C‰©|då\æah9=e‡GlÓâs®Ì•”:ä”!{aû@<û¸(Æošúw/3Ðà;LsB8žÒƒ@kÓš…Ì"m”…N(Ž|bîñ‹ƒÔ“¨ùu°ã8yuGÿk_  endstream endobj 2057 0 obj << /Length 3265 /Filter /FlateDecode >> stream xÚÅZY“ܶ~ׯ˜¼q Màå7[—7U^'òºR)EµÅÁÌЙ!×<$9¿>}—0»kIv¬òØšh Ï Wü Wi´J3åg*]mNO¢6û7^¿zʸ5 \OF~wýäë—q¼ ?òpu½›²ºÞ®ÞxÏÅ]gš‹µRÊ‹¿¹Xk{?˜îP_¬£ÔÛ¶Ø£½]-Cö¦2Mѕ՞Ÿ«ºZ÷U ý'&4Eµ­O<ëÝEœxES>a˜d‰ùÅÛë¿=yq=,;Žb?Öê‘2ÚÑš%~˜Ï(ñƒX³°eÕ–[ƒk˼z‡¿¹×„°/ß]€Ä¦âG¢(«3c·8uQæýv‘)ï)PuàÝ–ÁàîÀƒLµ½c ðŸ®]r+…"ý¦ ‹½âÈÔöP÷Ç-½¥Ó0üPV›c¿5[ÜGØ“u¨ü0YÄYjíµüj³)‰P¶¦-÷·ïˆ­+…uùpìiâ]Õ]¹1<¢;m™Fˆ´^‡Îϕ٘OÖ³›Á3¤{[ó𶦤Þ÷5ŽzÌ;úÛÐÖ¥^¹^ÖšqÓ½› +²âºt€ëé¸q×ÐÞ•¸;@‰h-ØCG‡â¸¯›²;œ–ô;™ü¡<~×Ï7(]sÿ£àÀS¹?Ð’ø‘]˜‹fo˹Ã;HÅP1\'ׯÓÖÇßý”m‰w`¸Ý˜_û²1[1?äןð¯,D¦°’©™j-Åž7Vµ&àƒÛ,Žæs.Pvíù¸x°¶ljm( Éryº»ˆCXWTŒŸY§Î|j˜FÃÁí¨<ô/[ê@bRAz8uÜ@züȼH›Ñ·2u."Ãa"PcŠ–œ>×Í…Æ&x/ûNÞóµ'ŸÐV˜¯$ó…±Û²ýŮ¹=k‘÷37)µwM>(ÉÄ%Ô}µÅƒ!Ò|?˜FŠ¿·©Ow}G*N®Hu_B U©£ÀøD6¦’t¢/I6=|,+û2rÐ:–m÷R÷q&Jÿ÷‹¥Õí;릕u¹VMGqÑ}ìHeoÙ Æv_K4´º¬ÂÐÏã8"Ý5EÚu´0³‘–‘v«oneõî¦5ÝÍ­=?â“Sm‡ìÀOthÕýßAÈëò™QøôóÕϯm6ñë"DiæG‘ZÅyà«<ÇáÍÛ`µ…NÜ×éê=<­”¥Èì¸úéÉ?$‹˜½-Ê"?² m•bþ·¯¿)f»¡B? s»¾»¢)N¼oë%‰ü4ì[|þ¶îoÆÅZ#ëÌ?š]çb ÙQ$fºVxl±š›e1®sˆ§²hrF¡Ëq­“Ô¢hÎó'ƒ®3Å›ç‹@$öº@jÆàŠô…Ñ# UG —piñØ· z˜~¨ÐûqggôMkF]žˆ§µäÃñýõë5ïêÙÍåÕËË«Ëë9%¶3§fE6™j±Ésc†Ì8Ÿuœ$ÞåŽ{ÙØ`ü³ç/¹Q8O8Ô©¯’È¡³%…9h× î°K[B?‰swßÁ/JÉCgdÛkÊSsÿ $76%í$hp‡œQoZ׉„©ö³t0’ÀwŠ Š>59/jèd´Ö e&sÍ*ëK RK“lkè¥à )–$ÇÐU0 ÝÔQëq[Ñ 2)¦˜¢ÙàăL<‚÷–ÜõÉÁ’,€ôeÐ0qÚÊ­-G(#œmãZ]Qí1½mžK¸vÂ6Ú+þ“”ÆB‚Д·½¤Ü1Ö­9îÀ8RÈ ¿ë;K=ŸE€n 'E-&ìÐ ³ Ê•ìX¸*ë0L‹líê=)ðá;ÔNçØÕÎDÓº ø©Ám»mñÀcí¾‡ jWl:Úk³Ãàµ9xXžN?ÎÂÏ µ*ý ˉ•ÒÉ#Cmö'„Úóû¨Rð)ùƒáPe™Ÿ§ñ,8P8ŒƒÀr_ëL ¸Ïx rŽªŒY)½ˆc|íA¡9ÛØ~!¿|Nˆì~—œäà(å‘OŇè‚„A‡/‰0H}§ õ¡ŸñJå°½*û,§ '”èXE@S‚S¶à…ƒw¤|aÇÓ†¾sn¥V~®âG¸år‰üc·¬‚Ù—'A׈@X)*á" ‹è õsá{¡0®:‚nT€ÄÞUÍCD¯íÌ[,¼_ÀŸ ‹–7ä¶Bþ ÄTήÏòÂpãsÆWBšµC¨á6¿ ß›æTvò0L´é(h)ö™c¶ÎÃŽ¢„`ûñôŠ«”Ÿfj¥’Ä"ûŸ¬¸š¡PENI‰ÈV[Õƒò±5ñ…¹¸i”Vö¥çdw¥æß»ÆØDVжé–03y¼(Ñ~ ¦8¯+jVyCP;ºµ;A©ŽROœÌ©n~[\Ár. Øm±=ʈöP0°Ïu’íòýç,#ÔÔ×£Û‚$7áˆç„‹8àÌN3=ë4÷à4«û]æ'¤±›ºjÝÎ%õŒ§ŽõæÕ‹«¯xU£ÁºV•v? Ѝ(ÿ•Îuàùœ1ß(,. K [¦£¸[®Mø^h @Ü“Uß(·jLŒZs£N'FÍ}ô˺ ,¦î èä¾br_¾ËÓ0b­Ï]Vhµrú$$s´Çf7á•ÞÃ+šo—Æk~½‰Ó#àS1©LaÀnèžê<ºío[“›‘Ù‹¦¬¸s((ƒù*ÂYØYäœVRðq™$ß¡š%í!Þ&Ñ%dAΫe Òêì¬!#o°5”í·“‹gç°ÿöã|?F[~Õ™&û æ;áLM?ÕÃÇ[þ8‚Ú|C‡Ð[úœßÑ& àqé§H3Ú»cYY"hlÐ%6ÃÌt]ËÌl³Kvš^.OêrI=Pú4±Z–¦ö~4] þH±Õ4Tf:CN”1M[Ò¬†î³Æ9ÉLy¾ðð0 l] ˆt”Ûï¸e¸aïé1Äo™Duæl~*:=Ô|iš”ù;9Üa‹/$ˆkQ¥û=ÅÀɧŠ"›øþÿåP endstream endobj 2065 0 obj << /Length 1253 /Filter /FlateDecode >> stream xÚ¥VmoÛ6þž_¡rQq")Jä¾eAVt@,q°ma06m Õ‹«—dé¯ß‘G)R¬v–Dïž»{îŽ4ˆáGƒŒ™äDò,Ø–±[m¾Ü}¸ ^.Áh"ùÛúâ—ß…hLT¬h°ÞOU­wÁ§Òx1Åe>Ü>»ËÛUÄ9ZÓØ·$¼ÑՊɰ×ÅêËú‹ëõhN0ADÂÿ#¶Aú_ʔРt²”Ä"AO+‘†ºèM»Š’$ë=>»£®ÂGðA†u_ító‚{'XÊÂ:wà;P7ÆŸ¬ñßukÞÃ{š…ùІ¤àe)Ÿ¦B±º*¼r½yÆ]þ9¦Ü4 F;\„%Që.¯gˆ¬ QN¨ è'º´ÿè‘iZLÂóÊùWì0;~?¶uyê;ã·v½Á#ÖE»ÐذDµˆ ¦iêQoÞquŠÖ~Ÿ0@>~¸¦/M—oÉÒÅ¿3¥n¾þ a‹“pírñë#g?Êüpô í§÷<ðÂ…nÆËvG] oÆÚª¨)UXÊH"$ÀpæûŸßFÒq!@B©J‰RÊRîÓ—8ØÁ& 'I<;É2à„ëâ î/þô¼œãB‘D1§*K=1ÓÖEßåuåñͨ,(‘ñï?YÏM5¸/ø®ýétv gtt®ê›Í1¯ž6.ò—ŒÄJÎùÓšnÓo~J (¾AëV¤V&ž6R m`´À.Ò–mÉÙåMàûŒ& ûƒ4Ö’3s4Þp]꼚ñù"‹>"â]ÞvMþˆî9Ræ->»¦¯¶ê`ÆMŸ¨¿Ð0ˆíu^`­$¡®&1“C¼3Så6]ßT^7„TNCú¦ >–§• aÝtºê–RHÂ阨—„±ð²p5®msxi-èKvåhÜã+.¹¸ÙDäåj×Zv~«Í«­y#>„Ù¾ç^}UwS;º:ØÀ8 ')­?oScŸÚëp!#¯¼¥D Á¬w‘­J™c„R?frˆ„›¶ËKÈ×£ï4¥ñ4NTRBU2ês,â¥6–°‘ÑuÕú §3XLÂôI1˜uw›×·ïÕÁT¦ÑÝc®ŸRE˜+ñ½gÆk?3Å pfouy*L›_ìa,ÛMFÝXÜ©"‚¾)î]Ý?æÝ’Á$&i<úVê¿§1Ûƒ®’HùÆ—Ÿ©Î|ctò7—×ˉ"’©Ižèí#ª@ާs·®= €V03;|AOb00ÇÉawtµó"ÆqÐNáG×èüщ¬e @u@œä~9L1’²‘;oYpV´ñˆ¡{[åP‹†]•X°¸cq|ëu›G>¯(ÅĬ¡!Hžñð¦Æ&j¢+ݶ g j¹´<ë í;¬ù¡ G[ƒä2ÃX¬  ŠÒqî¥"’Žô€HŽrkfB_Ø»”µçîRDÌuÔÌUÅRqh¯S’|>ª ÜB‘¥D&ÿkT‹:¤ÕªJ‡8O+bNËš7‹3ZZº-“FÙY9Ì5ÂEwRŽ¾Æ v'ÛéüMn“’‡8®àà"?Z»á¨mõíÒ%!±B̺ÚýÃÕÕõýý°ŒžŽiÈ÷¨¾í·[Ó¶öÊ»‡Ëo_!;ÿû!^ endstream endobj 2072 0 obj << /Length 2672 /Filter /FlateDecode >> stream xÚ½YY“Û¸~÷¯Ð#•Za à±y²×ÇLj3ÞÌÈ)¯kŠ#QS©%);Þüùt£àazg6NRS5ÄÙhôñu£%!üÉE-’T‰T%‹ÍéYhG›ý‚·ožI^·‚…«ÁÊëgß¿6f!C‘…™\¬wCRëíâ}ðã!?wE³\)¥óÃr¥µ þZt‡z¹Š’`ÛâŒv5/ÙUÑä]Yí©_ÕÕêR•0¢&¯¶õ‰v}\š8È›2ï  #eœÆ”rùaý—g¯Öžma´zâÝê/.šÀE•á¦î¢Q,B£é¢F(/W&Ž‚+à%¸}<&:ø~Lp•ÿ–7[jß¿ÔzQ_ªm±E†AéPáb…"Ž‘¿]øï×KÙp' ¶?ðÞ‘L"b `7>€œÓ€Ï±<8V¬4•™ÓW–ÄJfBF)z{îʺʞx9Ÿí™Në=Ô÷ºþ¹;{YØËà®èV—³5>0µ¼í¾#û¹ËOç#˜Ï´Çz œ~z"¤’²*»GhLꦛW÷~6¤¿+HÛÕÆ~=êýÕO/CÍ7º+6’Bÿ™nüü¸‡¾þ€T+‰ØLnõ†JËÞݰ îfØÝhàSÙ¨µ/?¢èŠ »Úk–(øå‡rƒ«xÏi pYÊ}7èhðÁÂBAd¨ãl§w 1£ƒœ'‘-–«8ÕÁuG—“ZdZÃW i$›f[´doÝ¡ ‰t‡²ª<Üœ™Ò€í’®ˆ­œÖoêªíò OìhäSVÈêÍŒ ïWmÐsinŒ"èåJdÌÞU½TìÏbÃz™i¸žm¿k‹9½Ãn ªW AWˆ9:4AS HX†ÇA¯hï.Ä-°‰Ã9õ7¨š®XÚÏ¥¾0±mÙvMùpq»MÐÕ{ZÁ$Ø$ðXžÂŽ÷p`%b/*¢;¬Q/ZÅÁ1ïlÜÀö„˜·Ôîjú^Üh> k­샓Y<”™LPúÒƒUuiîÍÃ=¸V‹æÁ"ÕŒ´¥Š…N2·s“`r  ðõŽN¯˜·öâíz#0çdÕd¨*Ì„IƆZ¢™&ÉЯ°[vüµÓûÚör²¸ƒÝ!ï\« CÅÐßäòÒÄÑœ¸/ :{ëöBç3µ ‚‚#èåâ,x®wh7í€Ûn¤p¾*mÒip,vµ¹eZ=Ãyó™†ê}ý>𿼬¾69°WЖN³à¦îÊM!Tw`ÈÇ‹~\ZQÙéÄ 4(`!±ÂºF³ÄȳB›Ä«iÄþú©q×Ocæ †Æ W·/©ñKhÂÖ’.¦IL`-3µ0a$4|1‰æÀšáŸŒl63¦5nÿj@`&›Ãñ“ÑyÄD'¡½¿\”³h½œ´÷P²Yœó=¯”2šÞS§ÀzhF÷üz²æV?r«)Q{+¶$6¬;Á}NëØw)B†)ÑZ,f.¹!KµqÄn‡œŒà/:õ‰/ŸR±Œâ×e!ù8”'Ÿ:ø°ƒóa¾ªm| P« Iç8ˆ¾cÝcç'p΀S}$†,L,sÉçÀbÕ DhµÜ3Ðe`Ÿ>$3ŠÖUg±—9ÁÝÀÇ1ìja¸únʾ9 Šb‡)‘qHÖÊVÙÐ8é¼åU LÚèoªØÊù,Ï~ë¤Hvþ©lÉk-•’©Y»‚¯•ÍIÍ€OE>°„³)žH"/ÁÆi@žRs} S%ŸL·5°XB²]~9v¼nGƒ¯òx cŽÖ0A×"£%Mºƒ×ËT'axƒIš κœž ´±)ò(ÇÎ’Eåþàr*èrŒl¶àg31ò%1YíçÜŸyŒ„-ÍW„ ªµ·Ñw7ïnï¯o^_ß\¯ÿ>'÷$iŸ-”‰r0‡yãñ3gCk… ¡Ì KbEq©’;O0MAƯãQÿ@RüPI%”JF~äãp(I-Yç8>Èù°gs>iuu¾PÇ®_Þ§ðÒ§ðaÐêËqËÝ¥©f Z¥ÂÌ>YÈ©Èzû] D¹’µCªk¢hš<”­Ï­x§¨ªø5Õh6ÎbqæWœ,« š)e5YŸ8ãGólÄaêêöšf(ˆÀaJ$)|¤Pò‡oÞ½ê·Ï„¹ñ“ÐQèN‰Û>tgº ¢á5‚Ç e|íåa85 àФTÓ{ÊD à´*MöHw«Wƒå37›p`¨ä2?|8¸®R-Ò™èªRÞ_Ž­m[> ÂÀªÒžAf²ÕÞ ·°ÉOý!hi=¥Ã…IÑôv“IJ3ê¶àãPŒ#ž`c_‘sž6~åânc sÎ'È9e¥Ûõe~,+F9DâJrôHPL‚äÿXZ€wlú„Zcˆã$$î Œ_€ãW.´@™Pñ ìމ¹kó%Æû?ò”3BŽR „Û“Ê<ôM¹û<hXTô‹ñ8“ È·r2ßoñ¸XAг””Kþ§‡µ_°¦Yƈ_ÿuAªDÄ&ñ¶±Î”NDŽÓ˜/u¶9ìÿ¿:ƒdSëÿŠÎ€R²ÎÞ¼º™×PëeÕg]3—0±Ði:£®ôwÔ¥¾A]“Ø%"Ë&±s¦ˆB`&åŸdðþ]„k³ðÍûº×–ý7Ã_…læ 3-ÿÇë«ïë_ J!fšŒ0S¹Ò.lìA*õ •2He¾˜-‚B{ü;p1› ΀âðù>B®ïòç¸È†¬¿~þÓÝ«¹C!“‹U<:íßXe(u endstream endobj 2080 0 obj << /Length 2101 /Filter /FlateDecode >> stream xÚ½X[oÛF~÷¯Ð#µ(§Î /ݧdÇZtÝTVŠ40i$r!“.IÙ›ìŸßsæR$CÇ) , ˜Ã™Ãs¿|#¹àO.âp'J$*^lï/·[´X¿½Lç¡? |½¹øñʘ… D¤r±ÙYmv‹ž”áÒS•DÞû›÷býêfé+¥¼÷­q¥½eå2L¼Sv\~ÜüóâͦgB#ŒVß©[Gý•‚1(¨Dv †‘Œ&P"^ú& ½ë¥/½õ%¨kï¿ø0Þuö%«w´^g­¥Õ¥ÝÖ6kŠò€:ƒ’¡‚…" IX/ô,þûãTÔüz»ŸøÛ‘ÿL,"`à>Ü¥8Ÿý˜ ¬J¿(»}Ø‘äżÓèjÔsF/ß1÷e*d˜ˆÛ‡^9÷ïe¥nmëŸ~ZúZkoŸ5í¤Àmvÿp•ø¤9VÕ§ïÔƒ|T”Eû¢ÍéáR*ñªºµ»?ÅoÉýåÖ=^õáúçË@³E·vÛ `)ÌßÉâWǼ›ÈeáëPD¦“šÒ÷omi1 pCˆK¹[J¯º§×Ç¥‰¼¬.\VáÆSÑæ¸’Þ¡xDïYLÈ’¶Æ§½.èļµbéÇAê­Z:.Xni·¶i²ú3m·yÖÒA›[R^j‘j O%¤áä+š¶.>Ú¢rÄ^õ ËÄû7ø6¶•«Ü6+J' –9ÉŒªÅ½j°Î,±)0•,sêÔî༜I¶U][ßi°Þ’󃳣ÜQá¡÷îò Ê«öôDÃÝã127ó¬á…ÍÐÀÇÂõ*ü.+Ž|æ”ÉÊ ?ûŸNº%ßÐÖH’ %aE?åÅIó³ð«À×MK²åŠ^ÙÌQácK”ØãƇ]I‰”ù]WK%¡<];Û,SíU´†ÆÚ=–ƒŒ°w´"C«S¹s-·\ЀüÔØKºZ&Úsa…sç¨êþáä‚te _`zUeCd}¿dý‡ý².y_½:ŠÔ‰ê(VžÙÑYêšÌgÞƒZ²ÌRb&&2I„êC j}·º¹Zݬ6¿Í¹:ÖB›ÞÕh<`Õž$P¾›>¯†Êu3¨ìÌ@%Y1×î`qbgp«$ß„Q(âTÓ¿P]Àb)¹mõïwNÒ^Whìõœ;ŒQÐì`v¦C´â³ xäEB%)Õ+w5È årB‡Q_N˜EE.ò¨[Ç^ÎD=¡ji‘ÓÄàéíHF#/Œ¼ÈëÁA„c®¹>-“ïkÂ@ÄY…ª°°ç9Ä¢v,܈ ‰¿¦CµSü-pa$Z§<…ð[8‚‘ÿdèpøxgÈ»Ïýó÷3†‰ƘÝÈå G¤ð‡›Ãê5ùè#vŠHBó>ð”rj“`Ši3´éù+EGüm &,4…}#ƒsR¡FÃÝQõQ#U†Ä +gŒù‚Aú=b ƱÅëõŠÏÄ6ŒC&ÑB«HÄêÏ·ûÞ0˜ñÍTÌ8¼¨†7¡e^|Y÷¶­z`„µ9Âx&¥úêÖ¤PØzdÙ7nLý‚S¦}I¢áK€Š‰Û0‚ ‘^€ *!˜€O MS|:ZÚBx ’У擕‡n?·Ý7µà(cäôÔd‡„}¯O ‰Ve‚ ƒža±œkÉã.$Ø¡vW¼YD¸ì»xË8ŒèC_lÀxènEÀL /'³è×gC |…°÷ OüÖxE„ë¡=›ØÆ˜ð  #(„óä}÷jý·%þô@öåõî®´|é‚QŸÓJe: ±,YH:j&PYŒô3³‘*a"Œ6# p¹ºÝtºŒ¢6§‹ ”y<À<0Ê“ñ8yÛãÝg§#ógó LbÎ¥˜)2¬†BʸëxíÄ¥&m]ì?Ï{ú.Då;<]Ö5Ž?ÎMÑ@•§z¡@ÅzÁ‡Áb‡p}:^<9Êû…aŒa:.n/~å†1’FJ@ ‘“ ¸Ìßá$À„™‰¨’`CÒ©7pçŒ%°Î ürtÁ—‰¹lQB£ý¼#¡yE&™ÉŠqÌ”ŽEè阚m›þ¯A S( À=hÈIþåèí››ù€·³³ÎÝhÆ $3ñJ¾/õâ5©â0i:‰×sñT;pßáU”Ã?6&4à™U å_SÄ¿n$ÁIÿø1}ùcõ{"ð†‘ò #éúu:ø2aÜ‚+ù©‡Ð¿ji}¾0Ù]·ÓÝ=’þŒºÒè²¢,ØÛÝõd:ªÒ`t·µu]VÏ\Xq0íäj¢Ÿ¹šh9Œ£ëÒoÖë;Ȩ»ürs¹Ú¬~¹™&CK'%(9º°\ž{°bò•éPó«W?ß¾™“ e0EWfÿœn v endstream endobj 2087 0 obj << /Length 3132 /Filter /FlateDecode >> stream xÚÛrÛ¸õ=_¡GªX$xÙ>mêfí6Mm§N6ã¡%ÈbG"½$ål¶?ßs ÒLídÆs¿1jÁ?µÊô*Ëã0³Õöô*"hû°âÅõ¯”àmqãa¾¹}õ‡·Æ¬TQ¡V·{ÿ¨ÛÝêcð§CùØÛv½‰ã80ß­7Ib‚¿ÚþЬ7: vî$Á¾”[Û¶ì«úŸë¦Þœë öO hËzלø­§µIƒ²­ÊÞÂ9J¥y(¯?ÝþøêÏ·ÙF›Ð$ñ7òè°Ÿ1š£q§ŽQ†‘I˜QözcR\-ÁõИ%ÁðÇ—å¯e»ãõ5ÐË««zÛÚ²CnfeîË2Zm´ ³Lñ ×k£‹~>W­<è`÷¼;уÉ «ñáO‘‰P®;ëàQ,Òƒ£“D t.е¡Ã‘¶D§|ÅÍã@ýy™¨ÛoÎd þ²ë_37åéñ$ÉNwlÖ:>#,£ª®ú èÎ`ƒyд½Ýý¦ó÷–Å_oéçÅ«>^þå"J„£»íÃ"TaúGæøûã<§Ÿð”Õ&ÑajðV°8zÿv 4rGƒ àÚs|®ú¯ª'­ù±^«”î‚ÂùàÞ†@%8æUþY•ÜYÛ­íº²ýÂý¡ìÝJ.ÞÁùˆ­‚ s¢’°HøC%Œômuî«IJ³ ¹‡1Á¿A" ØÂÜ—UÝ1¤?T²…õ@¨ö]hW•Î$âÓTˆ§‹ÛÖvbõN=¨|ñT¦£ Ùó/½«"ØUÇnÊN¶Džž*Š‚øRY;÷~Y»Õ]‡ÖöGˆeqTå‘wž_ƒ¾üùPmï0»¤Ùõ%±ÄÎÜ×1 „„8¨.Éo‰×D'‰Þy°cÀ¹CÉâªä,ÍIxè*!à$¶D‰Ø0PkV®*&¹™œy›àÕcÙö¼òÇ÷„ŠoP5Cöhûí‚YŠ$Êãq)jæ¼ø—%7/Â<üüžX¶_ÖlEhÁÐ%š“å'‘J5je~i9&OÜ‘ÑÒ­ OªNé®BQ)´…ÅáA^À~þÁÛuž-ePØcŠ x)À  Î Òîä  íÜÙZÞí0ps EáB6,ЉóŸ%€‹ ãR=ìÌŒK s„*‚XÀÞ õ{F>’h°,ŸŸD‰E(HF!Ô•‘ ¥~ï² £íY.>?E*i»žo!Ë[p$ºFÇÆ!ör‹À>S æõ¡DšŸÊ-bÌüp,Ûwçßj†±Œ€U·çŠ,Ù<ÎÔ;Ìî*ªý¥qfEþ¡&,ò±¤AéF9Ó…ËÌÅR2aªj1-—LJ¦…ìxâÍÚÚœrâ ù…Ÿªž*Ц&1$ã e,gZFco°-–¦e½•+›= ˜0ËgÉÞL}`}>EßÙG*Š!tt ¡À™fã«îšj+ÏÍ¢<5h!O_¨" ðj’,øç:¡nßœÉ÷ˆb̘„zÃÝgŠø˜8MçØjfì¹<éäÉ’Ñœ*¦&Bþ;›‚¢Hú+éi–ø0aÙî|ìyM™_â¦bŒ°7WSȲ˜óXi§¡Žr¦æ²YÇ <—jôÛu‘à‘¸þÐÙ%Qb8€r/–Và’jÿ´±R'Qeù:OÐþŒÑo‹A©¯¨>8µC€\ò³«‹8ôž2ÆôYÙ‘¹ò÷¦þó»9Š,D3Nô:ÅpWBub³ˆpyý†wØfì"L†eP6§ÿ‡½òûï€E{^3µW$í5eR{E¸o¯š¯ò¥û†åEÖŠ/[+D ¥Ô3kM±1É¡9L ,þk쇾d­³Ck•P•åa>'aeç\Yà¯uÕýÑ2ˆª»\cÓƒñ©~pðƒuï@u€5*жíŸã²8dôŠýlSzªÎ ¬¨Èp`‹¶V/Eñ¥i'U-M£kˆZ†!î³Ô× >yÕ¯¢Å!õHOä>•Ðô4¥é©Èžz*çwMÝ"˜†6±«ÈÜ¡NqSpLƒ¸1z ?ûSdJuœDÝK ­€Š8Šgñ=UÄp›mïéô¥~"¹Î&eß´-k_÷#\ ÆN}h2{‚⇪ɀØI£€§F]ÏOãA©rUr%˜Ôƒ!\†Ä‘g‡‚â[ £#·{±”{ä%³¸òÄÏrgè>bóâ8$%å…s¼…&À¤<€c%"/tfóŠ÷Þë"‹i ÚIôoét ¿5buRêl¤Šb{S÷uÉt¸kÔÛXpÙ¡»1¢7|>%~3ÑÛ|š°8Ø@ž‡ˆ–MÇoqp®]‘á¤uo[‹mÚ .h%ŒÑn¨À­ÞXç¾ÿþúwküÄ8Н¶òq+¦³ç84£`ê’K  U2: Žå° )Ó•(¹¸º¹u´Ìàg´E&-jIÝPhoê¥ÜÇ+QÚÎîKÙ$ãl¡›imrá’L1Ì*°{ÔKiX¾oö3™ú&9cŒ8«ío+ÊËåÑŸ‡ä¨1XAÒS@J ‘RãÇOÑj›?Bd«Ï„yZÅÔŽ«›W—ü9¹MÇÐiCG%Î^Þc ‡æ² ÏX…¹ç{£,XÁff쀥FØ5gL³ G'Ó£¿"ÄÐŒÙ×Í!ReÌÔnÈ0:ÛU5¯Ý—Ê®î³qŸmh=ÌJ1Ðf×翡ΘWüáÈÝã±$ç{m¢Ì¦›³p·ü•à&'HQÓ.É8šäý¯Fì4¢§››F˜U4_Ä%—ÕÒ  D±6+U"%cÑŽñ*–nï‡qQO³€=p¥<öx[šl»ËÕ8C†fÒ<-ÅüÙoXÆùÑða’à2`VÃ'U56¤*r )¬F4>RÉÄlø¢F°Ü1[ÀÃt+üR”|]¼ ùŸ=yBy=ûGÛuò!¬¿Ð3ëÿÚ…(c~ÛH$™ Š‚’ͤú»à˜+ÿõ`œ]<é$Ã~2ôšvJ¼IÅ|Œÿé\?½ endstream endobj 2093 0 obj << /Length 623 /Filter /FlateDecode >> stream xÚ½T]o›0}ϯ𣙆ãoìÇlMªV[º¥ä©­k %Ð9¤U÷ëg0$ ÑiÒ¦©uìã{ιçb°ý#   P )€Çý7»&n±ºœç[ ßC~'Ó…€`¤±& ÜöK…p ážO5S®—k´š-=Ÿ1ׇÄÔ+?Ç…G<Æ;ï!¼žÌà ÎþP[‡þU „ -íR‰°àN`^T^}‹£‰2“G‡¤Šž“o_kAÓ…Ä}ƒ„k¤µœÍõ{,°ƒ ݇qDù d¯:sßOŠ©ÐˆiÞÈ¡J×zï0ØØÃk€ÀKƒÜ†hÀìjn'_[S6*ªÕ7öÅS ÎVïZƒ&0b=¨NÞSlâ}R%æ0æDRHÞaß»ør›Y«±Ú”!k‡»‘,@R¨^IË>¨æ3 Œ9ð CD·B{ÌÒÿZ-‡©¡v‹9ÒËùr<0[íܬ4)W¥3!$âJä¥~“û‹¼ß¿Ïh€´îòrà°Å£)j- >×Rš¼HÝV¹uÿã]Zš¼ÊöõO _²|—¸“C¼ÚñÅ´¼Ç–Áó¹Ððª½^e‰»˜Å?b³q›¶QmüàN À²rëoöu `y,6ɦ۱ò^Ï­Ikz0~iî<î;×h»m¯ça>7Gã®}ÍÜ&ÆåXe³ì°N6ƒö]r|U9Vœ“~ŽõôFóÕ*²}¼Y^\…W7Ë12bßM­Ol¨1ì3¢ìÇ`ŸU"íœkwv‘lãã®jGê0ªB÷¥/fŸnçc¤T!É䀳þÎ~×= endstream endobj 2099 0 obj << /Length 3754 /Filter /FlateDecode >> stream xÚkܶñ»Å¢Ÿ´€W)R|Kê&qѸ©}AQ8†¡[én•ìJ[=|¾öÏw^ÔkµwvqÀ-9‡ä¼)µ àOmb½‰“ÐOÂx³?½ÚÜo¸ñöÇJðv€¸›`~ó⛬ݨÀOƒTmnnòÍ{ïχìÜÍv†¡g¿ÝÞÏEw¨·;{y‹#Æ»«徨Š&ëÊêžûU]íúª„ñš¬ÊëÏú´µ‘—5eÖ@G©(‰<¥ìöÃÍ__üåf`Ûjë[~áöÅFcØhè°S·Qù5¼Që‡~ºÝÙH{¯o^½cëý—^WÛP·ð¯hÚ‚7ÛÔànZÜ[‘3ðUQµe‡ˆ x[ü^컲®pSpØÉô°ƒÍN¾ÖÂÂÛ­…ðß¿û²‘Žöòoeîì¢lìG@€&žêªîêªàþåÕ/ù|ó_¶Êzg¸±Ä«[¤»ÂÍŽHîT⇡bÂ?#ëÙñYÚó±ìÆ[—¥Êj ?Ãn VtzØ‚ìE5Ã> ÿ Üè²òȬ7Å=ðñ’ÁûËͱ©yfšÙ{wŽ–þ=¤ïŠnןIÞ œ/q˜£dršïà³l»º­˜a}áó•—UÙ=ÄýYªé@ܾ†þ]ÁÒTíéçÙ¥Þÿô·WY@¼ÍÎh?² º¢"aê•-ÿf•üî÷Ź˪}ñM3È>œÄjÀ1 ;d·¶´¯?„–X“t&Ø)œ,*WY´>8êi7g¡hù€Š}™̽2~j ü†¾²Â}^´å}E: š*«¨8-ƒÊîÀ­ŒZ¸f–Ï`WŸ¥ƒÙP^fÌ+ZFÌËß È9ˆ{Ç@Ù3,ÛWt8í‚‹îP0d¦Jt€qDExn3˜oh¥E…ŒrÓå( ¼¶Ièá‚8r¬ÝZ+2¦âÐÓÐIÊÍ6Ž=.gI½€ pÉÆð‘;,‰¿“E›Ä™*k| Ôù¡ŒYu×€ =]×ô­Í.Ô±§‘“XZ"£-ɋё׷EëéÀ84&7€]w87cÐàÁFú‘·é[×Pmµ¯ãö÷ºúÄþÄGáQê‹£4áä(sCôO%±‡i^¼^€/€G6XHú±#ψÄÞo Xõ‹eð¢¸rˆaLâM¡‹oaâø§4Å0sÈ4˜‘Ù»qúJÌ6_‚6ûøŠ¢ÊËÏÌã÷¼£÷?ë¶ÍšÇàÈL’zçì¾` mâ%÷`ßüTÏØ¿y9ä§¹]$váü³Ç>¹¹ï³FÔŠO<Ö¼ÀDÁ%(Qt@!Ù¼Bcj^±KæE¶Gšîò¬)§EáïH+H5¥ L5a4£&ˆu!ÔB]-¿!/è(e£õZHëe:s‡¿ÑL(¾"Ùfu‚Æ…d#ðy" Q¸p¬?Õ¢·@@È`v³ÖhÓ¸fÛö CGü;pÌÖ¡î2bÎŪ,:RYtXÎs]ê.gºËcZ^³oHƒ‡Lˆ‘ÙÁ¡là â¶Á s:ÜtÉÎVÓ:ÖWv ©QFTlJFåáP:q%Õò/}æ, 8‚Àùp£…(,Ï1oy Þ²¼íE'AÜ+A™áÜ+´Ùî‚ïCÝ9H´Â<ˆÐá"‹fd ídÐè€T. ¼‡ù‚HA·}yìv¥€Û"k­„~£N+Ф€w„Ó莰¯Oç¾+´Úþ*RÞ˜°aAG‘€½ÏdÕsS³4ä2råNžÌm^Îrãh\„M†F£7Þ¯Fà~ ‡1ÍqÀ¯øS?^·MÑõ É[âýúæ×·.Âù÷·(8ˆÐj8Ô·––÷‚Mƒp¤¾‰7„yÚ„¾Ž199nÞ½øÇZlƒœ‡°i$îM¢ü7?¼~óúæ_ÌÙi¦Nz“y> ;úî£Ê:zHdã¡ @·*D$@† dǶfňë{HOºÃ‰PfãxŽtvq@œÏÎŽ7 X-±!j J8‰ÅN²6±¡KaPÚø6ÖOIpzM kJBóœ¼)£Ã'åíúxØYÄ"y˜I ¦µ”ô¾”d|Yv äTwý‘ÛàV÷’Ä»dÂY¶àÕõçYv8¿“_„~3:EDkdjÅ1\Í~dà„‹Ô+ö-lÄ·Cãçº)êIE>M»ŠÄ9†?roHà®Ø‹‡ÔnOz*|ˆFVx:Φt8R˜P´Ò*>»¦u‚¶^çâŒ3&ЖUB༟t”ÈÉ Å!ëÇFh²‰±3]ŠÜläb¯xáùÂáY@Œ9ÞÎXïãäZyg©Uí&Ϋ†+b?Ý Y)È Œf_lGJùÍ$+ë»U‹LŽ[ùfnk"h¬FƒðV`³VeÜ’}¬À_æÈu<”¬d'`=›‚Ò èL§WÈÇÆm<åVEkK@„AÕ×1«¾€Yˆ)ˆÏ ]Á`¨àÀXv–ë3USZ†²ýÄ©E 9王†Y†ûºo/éc@+¬Õ®Õ.ÆÛ5]CfC6dÎýNì™Õs{fCÉ3±Û1 ànÇAæ{cçö#Æ8&uœ§ÔÜÛ7}.†u¹ ’„=Woyäîý@SÚ]}·»b# Ýx¬¢¥–…àâÀî²Eyð÷üfipËX¼Kšy( 6?Â]1Ú+úˆrñ$àJ×MLÛúÈÈò ^ÛCe€àùÐoöÇ*f­^‘E|(éÁMÄ/ˆDKU¾«Ñš2 hšº¹’Rξ9:Õ Õl~HsEÓ0˜ÂQ®`Pk`léèÂ/H„ǵ•`î+±—­>ÙdƒÈœŒVÅeC?Ñúkj!wQg–×#iyƒ(Z®UF¸5ˆA•Ç ¥Nð£-»Þ ížÌ,¿ýžQk¤\xõýù"^³Á2BLØMq A7Ï…ÞÆx oôœ¸ô$^ðÖž!u<­Í|M5i+÷hÈK:·ç»jSÊÒÁä¹–¢V;–[w:Ô -r¾? (ú–§@ó]ÿô›Ê77’c`ü憺”'cCb"™–õ]*Ä93?vD`~°È9 qÞAŒHHNÑ«Þég®Â.Ñ`c°ÑlÎ-·µØÈ½ÅvòæIªßaX8~.×.9UÓhøåÕÄ·I¼Ns^-¥„ÀG,JI(&ºV» ?HÂ+«t«œG¾¶ƒsc)Ó¡{º/ߨzù5Àµï’pdöÞ£ÃÕ$-µÿqM¾+~…ša{ #,às] ôV–\{Q@ç8z÷¯Sa${·¥ò/íƒÀ‡ò3v]íZ»Ò96Ø BKÌ <Þšðê;a*¯/T£¯„0-y‰ìøøŸb±ÌòÜ ÁÓIºŒþ.îøçA³ö*hxF-ˆÄLDq%ñY¢ >6ƒjÖUΊ ðéC öY§×„Ü&~'—RÞ>­ŸöIýDSê[µ“æÄ×5…øP‡#qH0ÔÕâjâëÅ[ÁH½{žúPIïÉ…)YÏU¦–â¾6éÿù^HÁÊò‡«†ê_·vêÍ-”D.‰‹Æ/g8æm‘Cékf䫱·ƒëXcWëiMËH ß!¾éïB^¢l5úϤèNøqQÀñ[;FÄü,»¥Oäd†|¡ÈÜ×óBŠEÚ“ À7‘ÿ¿K endstream endobj 2103 0 obj << /Length 2779 /Filter /FlateDecode >> stream xÚÍZÝsÛ6Ï_¡—›¡n*”ø&û–«ãœ;=7ç(¶ã¡%ZâDº$'÷×ß.üR¡Ø­\Æ3,‹ÅîowòY |fÅÌ&’%ÒÎVû±ë­73z¸zý‚{º.F”ÿX¾øö\ëY§|¶¼³Z®g¿Dœ›ùB¤21Ñ»Ëwìêåå|!¥ŒÞ5yO*úWVÎE²Ýü·å/^-ûé´ÐL+ùHÙ:êG( ‹µ"×EÓÖÅÍ¡-ª2QÑà¯öN¬Õ\ØhK#·YÓ’Ø6j·™§¿­|WÕn»Ñ÷sm¢lwÈ=¯ê²$cY„‘eò;QVžf"¯f1ï)Ø|¡´ŠÎò;Pjååº(7~/ È@ù‡Ž¨IáhrO£xY[”smpâÙBè˜imf .ל¦ôüdôæìœ6¬ï©óæ°k½ømªºh·{j’Uth`kw©“4ÈÜ|\±T)˜Í0.Sší¢ºÄ¿ ¿´„ªiŠ›]N]m…¿"¢ÉÊM׿ͻwx”ÕÙš<‚Ù¢ÏÊõáºÚgEIÏN5ãÁîþ¶jrOpd'ÐÓ3¬0cé7ÏŒ7oѯq¤ÑCy¨¯ë¼(‹6´áƲÄênÇqµJÙˆè‹lWü7§')>lò2¯³­›ÕÍ|»ûŸ|Õ‚¹Xp¼V¸–{ü;ÿëo€ÖšÇØ^Ï‚KjÞ`ãch…R$L¦¦×­­h×õ5™ 1a¹WÑ4y{ý¡-]*&ìx}šÏ2n³!ÏÕ]ˆgª™±ÉÀv,Ž@WÞÕ)æíIæiï¿`çhlíÍÈÆ¨á’ºŠMYÕùšºïÑ6·`6ÎHƒ¶Ã¥a6qN[ hœ÷ØÔÈ¥“,_3zŒ hbx_ŒÁï%Ký çó<¶\y+· ï6¯ór•2r–j-†— ô6 üÕõ›—WŸ#4Xæ÷ôº‰'KT)Kx¿Ä_cûYÒ1™bBõD«ªl¼ÌD0D=ìžåìâí²fâ¿!YüŒT#YxXÏ H!±‰bµèr 9H꼇¼Îv=‹#"=@ç6k©‡F›£á¶¢Ž5̾(;±p·þ¹¹Û­K^«™n[0uä2¼³Ž›!Û€ÄFŽQÞÚ!»èjâ~Á°Ç-Dé4j³bG]´PØDˆèâ–:ËŠÈš>MÅÖ‘ô®÷ÑÍUWdëÜOQ´4r_ìvÔã%¥ÆªÚßZ vñ\A88{vh!j‹•ËòÀY¯QHì|–}F¸ø¦ Äö ödìÂþç†@…eEš<"+‰Î×'”øW O1b‡¤†` !®‰qäGŠ©AT àÛÖYÙ@ ÏD*¢% õ4=^Ú/9 BÙŒPÑQ¹·ÇÈݽË){@¾*lZ"é]YGRQ†2[$ ³vê.1°Ê{¸€\ Î3WTb/•Ø½à˜¼s½¤v–ÔìëÉiÊh‹‡f†Ò§°lØU 8µ“à Õä¸imŽeÛHZ€Q Æ| ²»©ôœ ¿_-;Eð4':ÊN÷Y½)JŒXRõI%žÐ†x’Ó“‹U­ïÝúÎqyK=®„ƒßfÙnMÌEÅU~×f˜Ãº>ÀÀ›ì¦Ø°†¶pxƒ»l¥V$)« ZÄ1¸xú€µºÇ~úÊÊ(¸ O’pšîª.ëª.WA·ÓJº‹±k_ox»Šús"oûeW¦P®Àzžye*X«¯ yÛσ¼R‰W£¤82eÐû°0*_€í1ðbß’ü¦§™`,Žž2|àÕ :øQcxÅ—zxÅ¡¬#©ºáؽ̡jÅœºÇ\-ÕsI˜ÂnH ™N»¥§ƒ 4Ku()'‚þîdŸ]~¿ƒdØr$h .u‡áðD®R‡áРÀ5Ã.†ÜÀ>ÃÖǹ=ˆû³É$Zã#»4Ý!< ÇtFxŽ ·sF§Ÿð<‚nsݦ‡n3‚nÓA·QºmÝÆC7üºÐâá;–g«ËãÞ¢-(M.O!8W–¥X=Ô÷)à·ÃÍ T'ªÕTË)T«c¨Vª\[˜ð̈íÑç´7§O þÂIÌ ÐÖ)“©šÉÄyZ¶l$SÁZ•÷äׯ.Ãp Üt©Ã‰h`©ª²$ @ëT«"áî¨qb€§Õz"~vµŠÌS¤Ï WÉiª¾v½¶_H¯ûöŠœŒ’Ÿ_¯ÓT@€’XNâž;–„ŒÓ—A˜¿äþh{ƒ§S¸„çdÈå§ö`FÉø€«%*`ŽÕbtµÊB8Ó©| £ÖÌŠ‘‘u€ _¬ÿ ²{I'T]6½0Ö:Ûºp ‹£U† —… 3¯Ê¼®Ãw X’aâ9>–î*˜YyT]\ž_\^,I6¯´‡|º„ku™¯ÙI³4Â>6>dB]²\ÈMžÃå,º…³L™'y¸–ÈIˆgöa—³PÔj}â*À)ÒEîÊv0·Ùù«8G±ÍZFA¾32¤&#Ãqº®UQæëÁÓF–*¨jäÄÈ>eI6aC…úxC f+æQµáû¼.n?†/Z ‹'€vÒ䆄©²…Õƒ8©xt§ÌÆÈ —k¿@y8Ý£‹,HÛe¿ôÓŠ”X¤׈2e<>:qXâÚ`»IŸóô—ù½íùKý9äåÔs¿-vÞ@›l·^)¿­~a–Ð1„KË“îãÄÝt¬‹Ñeœœh þÜ«÷ xŽL£3ÓçÁjÈ@¬þhRS®“ žØ&¤þ£Fa÷&ñŽ´.Th*¨ßÕ°‡x[Žkéž&õôâÒi˜¾¡PÑû¢ÚùR$é*tènª}ºÙà±e\%Ÿœ‘ãÁL/¹»ãݧk¦&××`}Y6]‡Ð6E¤ÄU<Þhª{%üõc#ë«««k ×ßÿtyv±¼øé2˜ ØñÎÚèÉçˆáÃ'¨O¨Ï WZw|‹[¬uÝ" o_l¶þ›èHÙ]wtI}kW\Zÿi ^yáYÄÂ9 8ä÷ i¡3£Õz™Çyßm~ß9öpÇæ½:°ãÏÆÌCó‰©îòÆ3í¾„RÿZŸ¯m-p… ¸êKåЦ¦ãÓÓó—?¾}tø„i† …+ 0ú¡hµÚn¾d´J&•zŽ`œxœ>"é±'’ž)ÛiñSjô¥wÚï»ï»dw|Vv2Z}‚öØP…Ûô?§€+ endstream endobj 2115 0 obj << /Length 3132 /Filter /FlateDecode >> stream xÚ­ZY“Û¸~÷¯˜·PU+.A$å·Ín6™TÙÞ²'Ƀ×åÂHÄ]‰Txxf’?Ÿ¾@‚Êã¤R®«»ÑÇ×€ÕMÿÔMßäEI~³=¿ŠˆÚn¸ñþϯ”Œ[ÃÀµ7òw¯¾ÿYë…›h£nîöþRw»›ÁGsél³Z'Iè׫ušêàíŽõjçÁ®Åž4Ø×2ä`+Û˜®¬ü]ÕÕº¯Jè?3¡1Õ®>ó¬/+¦)Mga¥²" ”ÊWŸîþúêOwÛ:Ö¡N“o”Ñ~&h‚&a’:Aã,ŒtÊ‚ê0 U´Zë,Þ3ÁíÛ¿—¹þ?)û³mÊ­91 ‡l’À6mYWÈ5h³ðµݬã(TŠ·x¿Ò*°øçŸ}ÙÈGì^ËÔÉAè<Ì`>ÂO?/­¾¦1kUã"Å»K¬˜Ó‹Kþòò’ üpئ?/³ûÁvëþB¶’µpôùs¾œV*cú5ÒÑ—U\€Ÿ ­ØLÚS½ûzøF¹YµeUv/r×ö— ØnÔMgw8úfÆa¦gr¿eÈŠ –íÙVÈdgPœ–;ê=ÿ¶õÙrë<õ  °g@ƒ¦{öƒ …Gëj@1èA ºi†gººúC;Ý¡v¨Ò< {èO†Qi¸ISøcÖbv{sjKÐuœ’®·à}0û¾¬@z & dÙ²;ò0æ ÜTÈ-»/[»Eéáìð ¾Ãóÿ­vcQ³³Û•bæ„I ‰£Áá‡[Ey…,ü¶'Xç¾{Â¥+Ù‚AUwÜã|@ £!yPwÇõD`lóPb´‹s†cì…øeú"P‡®„¼#©£Ý¢¶ŽÈ?RºšˆP[̃º¶B¼€¡.ÖÁOb,¼þ˜ð³l¯¬$so»aÜ‚#¶§òp¤s$^35¢H‚—L rƒýtzFL`I½[l‚¬Ð¤%â€ÀRÏó¼sî†}­da¤vG ±Ø Ç\K„$)ÔÄØ226øÌØfÒQ´Á6QD.D¸¶câÔþ üʵÛcÝŸ¤Íˆ [÷œÁù¢^[î,å[š.»þ9Þc&!Õ1«ìýp¤ðåófGÅ£ÇAãç m«e¨1X¨çÆ·dÞÖXöƒí}ù¼=>ò.…Ίå,v316ðÁA¢B@ÐÓ£{3BÞ4šBÞT ºX“@õT«w܇{qÃDÆ¡™©d ž@2üé2P$Ýâ¢#‚º‡ ¡oŽ ¯'..$P60û¹‚ácÙ0dÙ®š@¢€l¨j7›¤Ƚ¿¸‘IÂtîìº&ÛyÑYö¬®D[Tò°¶rI5´Á‚Å3ïB½ïl…»Ê¤Æ¯\¾‘ÕËn¶D}¾ô›ÏÑÁçÆß–ƒ×9jn!•ø¡NjsJ%(È‘¬Ç S al±ƒ-vÙêîíˆGžšo!ë׿ÝËÕÂ|»µmkš'&ó²)d°š-`€ÎJÇÑ.I2øCξ%u |RÜgB•ƒ·e¨Õ3§kW… 7Y~%"~ÍÚ7q>Z{Å Œi>ˆ‘‹ëà‡–1ÜÓôNöÄ oa¨‚AxrÏöoÒ°ØLA[/¡j[/T`‰Ì?ƒõ§býÐs¹4õÅ•)@w46*·ùÇî ö¢¡`ä{ƒt龫̭µ»v¶´Ç‘sõ!Q-œíPhlÇ4·gšŠ¢ëPýB›+K(¾-ËåÀ²“¼4 Œrˆ±ÕÁ§yŒ2sÝ$^³»B? @h¡ðâwkgè"Èøe}=ÏØT¦%[Ö(-ãï $Çj¾^ÚQ:Ïæ±<󶾦-òë™^†šÕ_P|ª]r*ðfhOÊ]ºroÔCr?ã΋§¯ô€?®xsHÑËÎüÕÕc¨7…›ˆIÀÝ-‚{@XD ˜°šÐ™„<ì9Sñ‘#ÆÏÁ@p”å°ÜŽ;ÍBMŸÔ޹»?WéóœøIÆ9÷&úž)à ö±kìÙøÇ•-å/»o@áy"–—ÈMi’ÇÏm0Lß|?¦Cé;Jc¼ÏÃUØæ¼îi9“s fÜ•34Š&’A˜’¤C>¡ðTº·Õ¶´_r|}¨§÷±©fp*¥káxÛk¹‹®qN'EXN÷Àš hÛóm’–¼MãÜ&…±ø ÊqÜÎ6íaKüäûRY?¨¼_*«Ô ­JJâ× ײ „¡:„v?v(Òskíü).F€^¥ÒM¸¡‡¸PC€'ø£bz‘›Rü§97{=L_xœn!J[wë¡‚B]o½çºÖû$øêbÈÎ`pœlæ"¤* óÈáú[¢ûU†S|â‹”ÏðÞ©‘ï ­Yò-w’äRÒ*w™µGAëøñðY™+n¥Rt+!¥gŒë ÚiHÓ* †£Mà $–/ÅN½ #µPbh~ü Æ]Ÿún|ôœÝ¬Åag~x¦}¯mZVa’ä_«5ú—öÝyYí@ã5R{ ¥Ílèh¸#G¨ˆŠ¿£„ª‡úP»òH¸{˜ {©£e ±/&¼ÒZª¯$9é<¡z"ðKjÍU˜¥›—“^:æ®éÞÿCÞ„¦â,Ÿ\ÕePš’îÿ°Yóo ¡¬Ý?-=Ùª4‡°;pϵõ`Sÿ8½Ô7ä† `)˜›}9Ôð'¢ Å—úðј²µÒÁ¯MÑ`i¬ÒæÀm*J¨(-eÂÞóÕ,Mƒw•å~q"i…ä?IERøY²²ßeµ­ÛŒÞðIÑàÎu]ÃÁ`ÿã-¤xÿ!Œ.‡jwgMá!IR¨ìÁx†;ü§‹So¯§y¼ôzE§œÄ±¼‹©ñ] k‰1Æ“kø’›ôÞ¶“·2w»S“«Ñóš¬ç.}q3÷º+q\œ7¾/ÏãÐÅ¡hŸ¸ò ^Óýo:¹ž¿Rãíì»=÷l뾡KñL.AxYæìîšùóhÆ'& ×Äið{ŵpÖ!QB/Ó‡ <¥vâ`\ö¸Q’Íþ H}! endstream endobj 2038 0 obj << /Type /ObjStm /N 100 /First 972 /Length 1653 /Filter /FlateDecode >> stream xÚÕY]o[7 }÷¯Ðãö"‹â‡$ (Ð.HW`‚6ÛŠQòßRëR7NгTú|z+w‰µþ¦M oWrv)C*.•2‘;$.©ÏD¡ ×®C¡ p3+XÀðD­KpÅRs}`ÍÔ©SÖçgvC†aé¤)Ü«ä6 ÿ5§7™3°Ž8¹ªd˜²k)8KׂpŸ•5#¹>(e#ÌÆ¸0MÀ—Òß”á·ä Ióðµõ75pcŸIÁ«­øLàPò@ ²² o…=pBÏ5i@(|àSdA¯@j>€Y1®þf…ä%LZ|&±t×S­ÐÔ}­”:cH'°•ƒJN@à‰8‘©a¤)¹ I:Þ%`jx¡PÇA[%õ9a®Õ OM=U»†V¬·Ì“’#s9Xni¢HcîÚ $”)å`}&ž¶¦¦.i0Kn `ÃÏno˜§¿ Y¬`,óô¹VS›@¯U»¾©õ8Ajž1X‚®r-bÛhBëЦ®¨%Dùç9˜× °%`Ôú†¦Ç—‹ïf 4LÂôdöù*œÞÌñÙ³ÉôÌg6¿Zú~Ö-y0–‹O—fËÕÛŸý<;¿8{µø¼ ™6¥½ 0„æøìJ€'ëøÛœHFò=œU‰Ø°·Kw˜ÞŸ2Û¤ ÇhÊt e»qûæÛÞ”hÚBIÝ‹’UñXÂ~oÙ|Z½csátDIÍÑ@a‹7Ô5º©©èGbzÞ’ª…cB›†ž36tYêùQµMÚÀܸ‹S8Fp7P*Ê.íÆq®Q‡Aq¬øûÈ…|+G¿îšÖ²™ÀªK`Ë ¬26o{º¢Í5Fë‘9õˆ öËœËÖ$:|}²‘@jÃèÎ(GoÖw¥a>h4wIbÍ´È,è,Œ˜Ð(ïRÙ2Çí9ùßíǦ›‰ˆ#Ç>‰x› “añ¿‡3·6hß¡âgwؼKà“PVò&e%^»V¯7k×Bᱫ§åHÍ·-„ÚO/~@TJÑ8>ýøöpäÑ ^ãü˵»æ›1iô€Í7£·=.Š“Äj+(ÕíNƒìõT,ûô=q¿æw±*2HÔÏ.û¿á3BÝÒÝ•:z[¯«2v]ùɸ­îžzP%'ý ªFÔ‡rîÕ¸ϾŸø­vªD«;®‚Iú¼G$úÀænO[N™¢ßÛíü–ówKsWÇ7w•¯ó·®wŠ*k¡ÍhFybæÎ5—7EK{¾¢M5‚n*‚úý†ýê™ÌqÃa?Á§¤‘øË5šŽ®œF/Ú^ù)¶êȺژRF°Ë{}5Ô½ôž8B+ݪ *ýo–`ãÍ%Øht[Ûò0ŠŸ÷t·Qû“Ù¶YE&¥´QÏšno+Ú[ *Í»ÜÕFT-ZÚ¾ ¿þ¸X.Ï.ÿÙXe­ Yýæ®Ã(mf»¢Ù'@·\õ¯KC(¹3l!-•Ý@EAVª€©Ÿ(vâü°ß¶öï9Ëæ9óë³ 9I½k—4RN1guϰ×EXÿ4¹–ý ø¸,¦Í«ÿp8²ÌøwɱeÆÐ™Q-«Ë14 Å¿°z·_·×™7ó¿g—Ë‹Åü~¡!v52÷¨Bó%B(:ÿÀþÇ_ endstream endobj 2118 0 obj << /Length 2996 /Filter /FlateDecode >> stream xÚÍZ[sÛ¸~ϯÐ[©Î %îľ¥›Ë¸Óõ¤¶Ó—4£¡%Xâ®Dº$'ûë{R$ 'Ú•ëf$”fó3¯ó½mmíø0[0!a'è?R²4 ³ Rȋҗ«»I§ß«jl°.š¶îÅ-ý‚õ¡ŒòHÂæJ˜TÛ¢,¢ÌQšݳÝQŒK»ñE¾+~³“nlië¼­jO2g)QÜŒE^ÝÎR%¿€æZÔáU LW‚%7N±ŒI>Í¡?ß,r?…Uƒv•¾û+_|WÛÍÙåM#˜f”h!ãZÑ—Vyk×QÍà`~íf®òÝÎoõP` wJ˜F*üQ:ŠÂ9š±ö À@ϪIÆÔ˜-žAGÔcµ€‹ô8 Slô´ëLÀµ­w_¼µâ`¯"p´$pIL~±+"Ð "J;½ÇUаw±š_·þB¿ƒè/«Öv§Ë[ßv¤ŸŽ5Y0ÕXž™ä®v¸czY¦†Ê®¸­s„¹/¾î(†_°èr×ëéº0²*ßú¯T¦µSÀ¬ÊÌ”J O©l"¡¤4ˆÜã–!„wóƒ">ÝÆñá§m~ß:ŸçÓþçœùº#Çkˆ~‡¡† y×|ü¹(³q KÍ”P .Æ06SB£ ¾î˜ºÁ‹ãèQ“%ÝÁ€ÍÔŸ!¨¡1Ô{Ĉ¼Ó;Ž¡l†Š$À<š0³ò¿½IaåàµoíLÔ·tž¯À6Ç]cX§3¢™¾ãá20Ù€Œ…3ŽØ.÷ëåýúÜdC#ˆ’| Lëäa ð硪Æðmã»ÎÀÕ·9ëœ&¶ÜzWŠ ‡3Gàáû=êayoó²ñãа)rÀ€Ë1ôD €ÎàNÝÄݦ"Ÿ y@üšð6-¢ ü©òÝV(œ»Øl;áSdÂ} P?¨ê@ºBä¥ü¶C hÂD?ÈÁ~Xlt–ü¨¯^]\ßt‡ ±³H /Åà,4ÆZ0XÞ”Žù­Ë¦ Å[Û»ü°k}–7ÄiìDuw…>²%1¦.0?Ñ(@¿ €Ÿ SW j»9ìò(IZsLG¾Æ^>ä[çùÿÝûs– "Œ™ £ ;ÿð1­¡ŒâúÙƒ¹ŸqP<\l7»~ñàóG»± äÄ•[ ‚·é»9XªMD¬œ‚Šôv3΃¦+F´ú¶RaüH„×ÞOzṂ#ª8öz,¾àŽ@r[8ÀÁ–éB©ðA‰­°ûÖÛ¢±Î®À# œB¬¹ñi3ï⣑ç(_ûˆÎ?½‚€R˜ý ¢@òL|Q«¿É¥cïŸß [o+h‚eš%—U[¬¬bW´¾¥ó‚Ó¶uáÏ߸³Mã‡A¤®^$.RúÖ^7¡ÕéfØòâ¸IÄëº-3—oaM/$°Ï—¹È´<„¡mèsz ó~zõÆ·x`ƒBÌk ŽšeCö¾Rƒ7uY Œ…*‘€€+I¸éÅö>êó É9úרÀvÈNŒÁ"ÞüÄ’En‘¾õQð½¯ù!¶¸£¡§‡ZCÙ…âñÐ@óì†lpE%€í7.’>„‹6üú8‹°Vû½-×¶K*iF˜Gûd®Pg¶Ö˯±³ °B¦OfF,alÐЦ€•Ý]"~¢Y4ÁsŸá;dû9u…º}ÄãÕ ìíqV} g=À?ÎòL-èSà,.%»äê;ÃY¦½#RŽþÓ7w@«Ð ˆ÷¤8Ôÿ „#¬º‡—¨˜¾1ßmª\ö> -×a0$p»P®J—hÑéoY¯Ã¬°aî«>ÂPAH2Ïï ¯[bÖU*•AÜNWðüˆRi°eÆg\⥷:O©aЄKááNS*ó˜R+Õ£`+š@jÂ{ƒú/!ög”FÔu,9ŒâÙä®5":¼~"ÑñE‡îàÜÀ<ˆ–!0o—¬vt¶£‹úé²R‘eÏ*´IÂ& ¸×‰Ð®»„Í?q_>½`Gšèîš ¼Ýuåxç‚uW+ íeòê˜:<Š^)J`Mÿš@Ó4ê°5¡›¤òS½LÉÄIˆòy‰Ð´{< 6‹~Tá)H’>¥‚dç¥<Õb@·”:?%8UÖÕcáÈÒàRBùä¦÷[lQóQðHbÇ$Á+™;|^ž_Ž5Œþ äˆKqÆŸcôï!ˆƒýD"à ŊÔ¸a&À †pƒuŸb¡‡×Zíj&Õv—_DZåóÂÎ:œ&w1î0 ¤s=ºOˆX]q6c]ÀYGצ2·TÊùSÆNž¶ðº[ŒÒ ¬´› ­­ËéŽÌ³.ÏøuΈfb;›a0¸b |ëáÙõ?…Èñsç.Á×îA³K£ï' > stream xÚíZÛnÜÈ}×WLÞ8§Ã¾“ôàìÚ†XIíCà5jÈј!µ¼X»¿U}áM=’y xÈîf±«úTÕ©¢è*†t¥ÙJ'œ$\¯¶Ç³ØŒ6w+{qõñŒºuX¸™¬üëõÙ_>H¹¢1Iã”®®wSQ×ùêsôÃ>»ïŠf½áœGòíz#„Œ>ݾ^o˜ŽògD´«Ý’»¢*š¬+«;{_ÕÕ¦¯J˜?Ú&«òúhŸúº–*Êš2ë C©JTDiºþrý·³÷×ö%“D þBýêgM¡d2Eb)¬²;»Çn_Ø ¶]ÖŒºÜƒÊIT—Õ~ºÖf[[­iTwî¹¢$U ™»úpxx¡Ì¾-r;t‹ó¿Ùë¼Øeý¡{‹v7Tá©Uá²xèêÊLÆéTc3¢‡'ÌÊC±ëܲ™a¨$*e~œ¸’iýð㇟cŸ’+SúmrAµÚœ[Uc">ÆQ<µ8¡’ÚåWÅ]Èì»ìЖÿ“ÒpГ“T˹ÂMy·7½ˆ1’¦r¢€LÙ“ ¤’°$ñ|ƒì€©;&»tŽ>p  ùðòY륄³aÕùyH‹‰ŠÕKõÐRû¥oæî(¢Ÿ."Wï.¿PNf|¬\¯]xn—4ÚÁzà ‚ÄŸÜÞÔŠR’JÉÌ‘'šh-ÀˆŒPê"mY<^Q_õÍMUV_o¶û»#Ý QñÌ^"% Â-xô‚01,­¯|týe™L‚éS±R"'æç/ñ*‡Iˆ/DèÕƒYy\qÂ4º×aõ¯³º¨:? Å Ä^”Ä¥SìãûË?;fVØ39€G; IFT¸cÌëþöP„d 6IP›ïR:Âè…"ê‚Â)áÉÜý¸Üp•¡ñ Òlu‡0CÐìÝÅXp÷8SÀ¯Í»p£:êESn³ƒ²+¿âEÓ–uE0{s›å`­s~>8š¢ˆs]nœ;ØCâ™hà’’µå³yS¼¶E1ºÇäÌ9#1ÂíèV§þ°ˆ”!ùÔþ$è|:¢œÏy¾­ËFLüÁÞ'SmÉë½O¦Š¤AÍKÿ±Nxôî*ì3`ßgMv,€ìµ!MÄS%>SØu!ÙŒ8f¿¾ªoêÝÍ=` kCæÔ/¨~Þw4$uÀsÑÅNƒN™FÈ$ Ìœ›y(»}0²€žŽ œ ¨“ÀñÉD˜½îd€$:QœèÄM½ ¼báwx%Ã8£æ¯\ºbÀÈ–%Üè±ï‚u·˜k;”••utoûrbøI‡¤„DÛN†\2uáFJ€^¶±ì‚jEѳÓ¹&Ytms²Åâ­r&]š"_•ê©£¦IBx çKô«R MáBQÊ—QÁ£Ž^©úïd±gów¾ì¬ÙèÔǵ ô5å­yÜÙ5묹Eæçil1ôÕpˆÍCÙºÕ¥[ýPa®:’QWÏEe}W¡xô Ü8Á Þ¿ Á}Yþ\0=¦Scmí  „qÞ”Xx±ÅÑ}ÝbÖÃû¶ß¢ööÙnš^2Ðl;7™iÝÜ#oÁu¶ö5/uï(~é˼ÿ¨¶n- xȬ岂tâ‹ÆÖχ1¡/ßГÖñõmfŸð¾ŠÜq],8߸Ùeéú¢´~WZÂQÍÊÖ@’g’”x]Žwu2lÿ®ª›"·JcTÈέ¿¬.^g1ÓyØ­^Ùa A…IÕ/áïÿE!4$ .¿ƒš“äbï0'IÿÞ¤i(iŲ¡°­÷}狼Ç.‘µØ›Š¶Myk‰‹ñÂwÕ‰± 8É&¸ŽÁP£*'x+Tñ;x/A]ÓW[`Eyy€“tf¸“ÈãÏ hŠHÓ•à °Cý*äA–\QRÙÿKÇ’SA¤3þk+Çe«ÂBµnrdóf¤Þ-‚y©¶¬NL"& M LZà½eb“ 3DÙ®Ü:G]êä2ö Î’Ž 5³Ã†`êhÊÙÖ ÙÜdvuÛßZ×fûÓMEÙIê'ãù.¨Ói3˼V¯ç0é':܆¾Rñ¸wD‡Þ9»-¶(ÕN›½á2HÜv¥÷>ÌûsÁÉÉØ©¬Êý«L{*@ ¦v^|8]»üòJ‡d]¦} ¢Oik×Y€hØ<ÁÄ”{ö¦æÇ`:"ÊSDüRÐùM \QD–Œ!Äs“©OÌñwq¼_# VÝÛIeš/ñ„À‰-¹ã"µŠÃn9;ë¶s{ž®n¡^¶WXÍ„BÆŽAëSŽ R<ÑPä1v—Ÿî}ª)³°9¡ ðNC Aå®&´X-‡fLzl_ Tn°Ä¢§3] o’h6iØ*'¸‚bjæ•O*'nˆm5T€<ÆF¢6cLâxسGâÖk×)öÑKÜW®¢ë›ªõ í`Ñ4þ3Ù¶6 Ï‹ ¨Ò¸?õ8¶"º‹ °!m&"{ lÚÜ1õrÁãȲÏÜZÇ{ 7>qI?£ ×O <ÕzFŠÌûn¶uÕjä˜;³Õì¼ïóÙ|°€•’(1¤cgí*PümíoƒtïXT¹Ù3 ˜ÒSKW‹â€1^LÀ·˜à:»ƒKÌù ±¥)Þfb¥g"\›½¥Üg!ù8¸ï¤³S™@ùñ‘ñÀ‘Áµ½°Á.z[¥å ÐâiW<Ú† ÜÛ†Ìt… Äu_åYSúo#~B™Æ{ÂÌ#‡´2Fêð¢¢Ê1«Ã-¾f‡›ìþ¾©…Ûm¾ q*†üO²ob¹Ç6\˜)rJ†o 75A°Í˜Weÿ!cìCš)àÒÏ—="_¢‹²ç#Â]pë!ê~-“A=pbo…økÛ)þë‚›4éÓH “g(+¹ åæûV$Vt,„6’Tø³"‹lò• \W‘$L…ÁÀ¨Ðws] l!Õ˜/|Îãðösü†~q‘ ¬ˆ‡G™(î”ùø5vú«:¨.#b> stream xÚå]“Û¶ñÝ¿B}£&B|ÝɃ3©›d»=ŸŸ‡'BcŠRHÊçkÿ|w±àçQ§s“Išfnæ.Àåb¿± ¾á/´Xh#™‘z±Þ? ´Ú.hpõ÷'ܯ[ÁÂÕ`åW×O¾xE ²$Løâz3Du-Þ\„Ë•H¤‰ƒ×/^³«g/–+)e𺶎TðCZ.… Ni±|{ýÝ“¿]wŸ‹DÄ"%I[»ú”, [EÌÂH“Œóå*ŠE´ñàj)Eðò5§£àßôó"Í?,%,=^¥M~X½Ü¬^—ùæPíkïm³;ÀnXc†¬ +2­cúðÕ2B„ðïçS^ùdOý»#¶FšÅ€À½ø¯ŸÏ¡_¹5+ž0Õ2ÿåè,Óâ"Ê= 2Èìç$µu2ilõ9 éæup8•Y^n TÙu“–ÛÂÒ+À¤ëµ=ÂÌÚ¶ë¶@Ä%Š=S^;®¸—¹ñÊ6«Óñér¥” êâ°:o‰’–¢MZ7~¯Òý±È—<(·î•¨ßz•6ö‘T’èò2o.’WŸŽG÷CÕØì“ðo,iE¹v??õæ›ï¿•çÄ+LѶÓ2#V8pÌÔ[D¶X)Áâˆ>%„åÅJõ_$Q×ô 6JÏÀ>»÷ÚVàᇠý6;KƒÃ(ÜÚ¸Zäÿ²Öj°ã/Õ‰!¬ð»Oß·¸ºC“uð¡9! =‚ë[§7…)ÅÒß§ÕÖzl–nødýÛ`Ð3,†¤óaÈyç”òr]Ù´î¨óƒu‘Öý—Ü/±ŽøV DÌŒY@RÓzèð‘PÃ`¼oC4@ã¯Þ×4Ÿ6î^°½ÊÚCI¸”~vùvgýW+ûSg™ðŠ[7”À4ÀÕ²€çK£‚–Èõa<‘£¤ü³€j#oüv§¼–†…²ãcõ%Ÿc¶%‰:®w‡S»cçóH+àìЃó ý¶†Xç7…_„^Õ«.ô¿Ä&dv“žŠ½ª·ò@›•Sÿr€tÚ¥ œ·šêÙ á©ò‚Ž9“Éă»+eÉq –£(™VÕÿŠxV)9Sáü*”/bî>1Ô=‚ 3|H\ñ—f‘Ö-²SyªÞ9ï@šw[Û¼’{'5&éMÔÈ9 l“æEM-}yS·³È{`w㽤Œ9fXoÂ$#\Ù…FˆùÊg…  >7 E+^ÔG$í:O ‚¬ÉlaÑ-8Á9ÞCrϸ|Ø&àW|‰ß0Ÿ|{} ]A|†,¬&¨³Âá2 ù{¢Nxýîc:€ú˜NëÓÊÓß:ê²ÍÀjä„{7¸ânn—Â03æàZ¦1K´4N Y¬“…dI›G}6b”Æ`™ç¤‰´ž‡¤ h*N @zá×ôËÀ•Ä"&10a’PhÚSͱM~îâ:"fÀR”6 îxôæm¸È`¼ØŸYܺ¥{팇(ÖbñêÉ?)øO$ß"‹÷Kð2 ¾v’y>ë® Ó1ª7Ö(œc¸b¢·èsxb&d4@ÃÏ¡í¢¿’蓘q"&¼º%ûäY8PÑPœ?†ax&£ÀŒDór3'Q`äJ« ú ‚Ê%Ñb°êSxz„*î=_¿‰<Ýð’%§sí#e$‚ŒcËYU4 8ƒKvñ_¦Š2pFEä@Kmà'øHÕCzø«¹3çVîerJóÅ`Ùÿ™&Lp½P c ÂÁ/ÔBLBʪ“?ˆNѬxd˜îìÊÂØ;È[È~íBÉY¤¢‹¹WœéÎ5"(¨K5Ìî¨h³!¸_ G¹£âFŸÁà Í®}2 ¨;Ä®¹C :ŠH\8(ªŽäÛöxTíÒ>ÑãX`×>_0¿_¾`gØæ²æuœúmÕyˆ†÷*=d¢:òŽ|†)0­EŸ€ÞC¢Xhø}’'88Ÿ¦¹jü Þíè3~Î!ߌÁ•åÙ…ÎbéòiNKÔcÓ’øO›–œ£ŠôåI›GR¸§Î•k&Ìè¬fI?BgåUÔY3«³x”Êå0¢ûE9Lôßå0¿ž«û©¬ø´|⮲Oç³±‹ÍÃlçzg]݃›A¡&À:uy=¨®´//¸Ç,ÇBDq‡IŠ«”%ÁKÌQnó/<ÝшJˆÙ ]•Á§æ°O›|Å]K‹«O¸ñÞ¦¥§È¥KK•Ãâ"ïÙìZb&¸õÝÔnÝ»ºvcð+¾¸‰=H´Jëj™2x¹¡WÖ‡SEÅѸ­ëÁ¨¢µ~‰c 6i^` ÐèÀÖ¾²ŠE%·,ÇîlyÓ —¨}í)=435Ó^*6›©ry3w-ˆÐƒ"dÛ‡óõZšwet˜‡oYÙ¹qØÖ”4섚2B_Q†Ùså1içv~ë:ª0ÑpTRéO?lW˺±iFìhÓìIa7ÿ>ÑöÓŽBOçÑÈÞñ^£¦RÇÎwBô5Lq9«aOݼ¢ƒ 9Sñ™æ¸Î7ÌÝœ³*x‡n¢}‹ûšû‹ÖBÝ4v|qAý>/Kï;pÂE~¬y6ç0RBàÚøtàÉòt ÄðÀùÐùLöç3”Ô[,§­õ "å°<ëºí“;ŒX>¾š$@0Ü[ð7¼rqKw+®— |›Æ¯k;'±ª)RMËܱNµoïµåd¼íq…T»›ð4n ¿®¥µ.ôïKwÃAK†˜'GÖ¶ñ,ËrêQ`@'î•9<ØçŒ3B^êÁ…ý —\s"Q jÛÐàCžÒ ëváJtÃfLJ<ÿ;xÿÝüÙ9ž†0„a¿QðàÅ"šÿºw²IË5üüðâ<«ÃMz“yÓ•æQABfÀt‡˜Yê1âí€ØP€™ë+HV.5+âÞ_ç_ÛÂÌ0˜ Š%Áé® |‡»m%ó/Öãß½ë”au/&,ƒiù{ÔC‹ñ‘Ð"ghÔ/\aÀé>h¶ýbnÄX2Òè¶‚ñÔ ìGÐP2É|¶F¢f¸¹X"¹WÖ©÷NÜŽ à·:êœ<ƒe"¾×¼.@ö4Ž” À†IuŰ ÐaÂåævGcoPS-¡dRó3j|:£Æ¼¢èOçðrÆ¥>ƒöÃe´h5›½„÷+’PL²š½» åBÌÙËGa¬ûÀå[ÚSŽ»Vö éBÕõ r—éaŽ Gm!Ï\Ž ®ß5Ò7§’Zãs¹P^Kþ&¥¤i.”èˇ6΄èVïÞÊE‰&ñiЧiAçíbI6=£>‘añ]¬ÊF#c‹e‰Öþ JWG}u¸hh4±êb6•Af4δ¼E¨˜Vɹ–wýpË[ ÂΙxï€íšˆOš°ß"Ñ)rgÙ!ø¯ÓMC §m8µ¡)xHWõ¥‰LÎß<6Ø6Æ‚÷Î=Ô{î=«õPw£¬Âi9Pñ†—ª<Ëléó÷¶?–Áx6~J ž'#ÖuÂwóý’+R†ql¥¸i”»É7p¶Ž›÷*ƒõÁ'¨ûÚV;ú“éÊ©»ˆðÆ*Ùzè a!`£–Ý0pžÂtž"ðhø…]&P9™l;ýg¯÷MéƒÐ3¹JI Ö˜ÕŽÖî€~îšÄWH±ÝaÛˆ¾Ÿ0’p¬ÀˆÍ¹`«|s7k몾Ëp>Àè¾Å2@¾ÞmüàNé°ÒzT'? ž'êtßÞÁà ¤äã”´ ÄCGÃÓ0>¢± ­ðÄ€kŒ;ë,é}÷Îð†±0pÄg–¹¡öïGíÏ2ÏÝe‰Cw»T··K5]"uêøS;ðw²ŽÂkùÑ“×øßº£Ïtô¹Ì+£ È]"ç…ÿðƒ¼ endstream endobj 2144 0 obj << /Length 2817 /Filter /FlateDecode >> stream xÚÍkoܸñ{~ÅöCm‘eħ¨ZàšÄ©‹Æ—&>ôÃÝÁPv¹¶Z­äjµvÜ_ß>ô27q' üÁ$5ç=Ã¥‹þè"c‹Ls¢y¶Xvµ½\¸ÁÛWO¨‡[àjùçó'ÏN¤\ДäiNçÛ1ªóÍâ—äùUqÝ™v¹âœ'ò‡åJ™¼6ÝU³\±,Ùìñ‹H¶¹4µi‹®¬/ݼnêÕ¡.áûÎ-´E½ivn×ÍRª¤hË¢3€‡R¥UB]þvþ×'/Ï{²%“D þÀ;è\”)’Já.Ú]¸\Ê“ÃÞlp$’Ö¬»¢¾¬ü‡²Þ÷‰'¦^WMØï-Öks {Ö~ޚ˲©P³uk=ð¦ÜwmùþÐY®”É?®Œ‡.kÔÞwȸ܊rB%uôþšÊÔKòX ‚¸µ;9ƒþ—I¹wÿëÆ/¬+S´nÐ@†ŸX‚,ä’éä°3m¹.*·Ô6@^mæ«Â£¼]‰Mû/„GXìM‹üªî€0/iOƺ¨Ýà=(lsËìñí¼0¯,‡ÚiJáæû]QUnøº±ävÆEŽ€¥ þ_[’šý¾|ÂÆ%KfɯzZÖ¯LØCAu‹L)PÑîæWH„þÝg7ŒÖ )4@%ä6¿ü–.6ð¼ÙâÖB ‘U‹wOþî ÉiŒk!Ø¢bÌóí ê%êKDžm¶w#^F®¢ÉT/»§^ËT&†ZLPveC ‰¸øÙH‹1ÙL‘×2©ÙTËÞ™5 ·ÊlQǤôΖÚòòÊf(n:øŽ¢½sKÖ¿L>9·"G©'„ ™êäÔƒÖû?qøxªu:ðáÒGÛÙáÅù®£çGR¯àì@åÎæÜíÎÆžHtáB]H’qWéMkìüÄ}ç'‚ó“zÌæt’¦Ù8¹”xLD$†²7¨L2ÌÏí±–F¡}PÇAœÌ.ƒKãTÁ íd[”~#ìÀ¤‡ûfça×e»>ìö.œBNh“H0ˆ@ŽÌ1‹_7­±ɪµ)<õÞˆ*Ll²œV¹óE–•Í&.sï–œ¸`0\ÊÙôÏwi7îj|ز³UÃÐf @BSWwn¥r ë@ƒùÐA -béˆ|ƒð‰+ÏŒ¿([™ýþéà}Aò©ß—„¾ãÜÁÐt¡Hžqm½ @gC|ðÞxÓŒ¨¨Īu1pÞ)眫@Úm Ù^Œ6ΈÌzoqäÔLÒñGEL°P"©\NšÆð€ƒ×=Q#!ÈÙISÑs’y õÁpÕ*ŸœØô º¨Q®¸€HœM+¨Ý5fÓ‚Õt?DΈîuníÞó#¸46=*|ê*(w©«]jÆ›=ÜuëL¨ÜØ*VJnítáÔmH "L„ëƒ÷l|¶Ëóä…Uú“ØÅhŸ–÷cùí$EúÓ‚|í%˜¢Ò*%ZˉÿX›[2qŸ(óqúF×{!ü0á —Ù–Žð]T Ó}qtóm’ A•=F$ð¦œ}GIÐÍæ+ / ìxž¯`¨QÉáÚµT™%Ôb¦Ø<~r%¡ÒÝIz˜rÔ¦©“3.[9ãÀÊ9KÂ>çšjÖðÂO£Ö˜Œ`Üi‡ýVvn×m‰ ®ôi Nú¤óXæu¬Ÿñæ+ºÆöÛ¸FNÁ¯-=‚kDT©ß‘kŒòPÁ}²OºE– ¢Y-ãÆ ¡žúñ€SjæÉ›âð¬$|»»¬›ð(ú¿j¶á©Ä“³óï,``ñÌŒ¦ÀG«ã ¼<ÿŸ,UüÜ9îÉÅ}Õ¹ßÞÅxB…Š1EM³ÑtH´þÏW³¡Ù˜ú Šjðëy·ÐÈ1D«Ù,s¾N¯,q›V´ž=ȦÇùؼ‡\Ñú1 [IÌÁ™LI–±/²k•ƒ³q¨d¨Œ¾ »>ÎG¥ôɤŠ™O]þ»Ð š½Æ¿EËOìs:ÅTì(²4?jào^œ·tº ï žŒ¡ñ>î,hŠ·žGÔ²túN+!l]™iCsoP:u ı€·7&fW<ûih–Œ ¨ª»{†0ã—Ð0Ö79Æ8Ñyþ°bxðD_Ùæhž®äcØ¢¢ü˜\éÔ)Ú–ç ú2ã(js®”ê‰ÍãÕ­×LßücúW§Þ*„˦-íËšÿIÀíUZ‰ûbw] [êgͯ)É׬‘iÞÃð骕c•÷e¾Jnÿ!úæJ—÷ù9í hBG+V¡ þ t¹ÚØ endstream endobj 2151 0 obj << /Length 3272 /Filter /FlateDecode >> stream xÚ­Ûnä¶õ}¿ÂèK5ÀŽª )iô¡q.»Eê.²vR ɃΖ}Õ6ž^§åe%%hˆþbs`Ъæ.›+ÀÝ™Oƒ±lpév;tåöi‰þû–´-¾å(¨s mvÌIoµ2O$˜b³“è`oú‡–dmÇ„¾ìI a>—ÛY ç,e²’¹¶!î@ -')ò°5Ô•ÍŽXm¾ °ó½›%× ßÞQrj}qtWù¨n‡õy ŒLB›–E`ŒÅÖÚX‹&I/bÙ¬Æ¾Ä jîôm ö’wƒîœ‰±Àס†bs[ÊØ-WpZÓ;|ãláfýÖ±m=ÞV¢•ºP4’ ûÀ4ÅØa%lSqŒ·n‡fÇ‚#°ÛC‰EpP–ƒª‘(kgÈW@ÆdƒPtA~~Zi ; V–02Yó%°ùSS#“fÀ”ØY™ß–,$Í©‡¸YB¦1ÏâÑ4F‹ ²¨øs^ yð®â?Ëf´Ø¨/ Îzß–Ðä`O½5IápIAŽ¡²™™Ý›Òh/’(6D Hî'æ!Žà¢óìÙ³`£üþ]@²c^DžY ÿÂL‰@i.S{ráà˜¤Ì7LpGýúGVÎ/`ƃ›s¬œ¢AéGʮھÚú§èd£\tóÄ= f£f±í×PxjµÖñŒ¸›äŒn:Wôa=1à¥Ä9`C¼ .[ÝÖ4dp¾j¶`ß­@‹#«ÔZ Pb6¶i8H³7‡[ymGìV×Üó GCM å‚årÆüœý˜5ZOyW@¹ÅÔžÄ^·*ò¹TɃ”õ}ÛUÌìyœ äeÄ›OžKxKtG°‘Êç^ñ«ül—¶Û™nžlú9ÌF]p-Œóñ>L»¡1ÑGª›Ý‘GÒ€¹0ù½¦6ÛÞ9õH(/¦þ<Î' ‰)A–W<”£¢ò91€ŸlM#´d#Wa‡'c0c9Ì'9SiðŽ3cÂ.Æ€²ä˜cXK~ˆÂè`ÛýnÜ=Ÿ”<#¼7J”i8ɤ;IàTmøƒè$z‚„ó¹·Qq›Ùˆ²ªjó‚–lY‰³ ý%ŠSnÚÁ'_ÐcÃÃ- qÁ²bWÞV5! k§çH$€[¹—ãø;sÆ ›ÈJ q'ëZƸUë™|.”3Ô>áÛŠ8ë‚õFK`‚%uÀG2Ê $ÌÔÅD>hâ‘S‹)rN´˜¡©öá2>DpV¼ãTÍ#¢ E°ÐõµvMeÅxˆÞô£äQèq¨ePG™±Ï^m'6€ý âD1¥\%xëæî@^Z)‰z+ã“2¹HâëKÍZ‡›Ífn!AróŨ‹>Þ_sÈ‚â}†v=°‡Ì\T“Í4GйW¡ ÑNDj„d±æ¶y&˜ræŽPn‹»ÓÅÔOÜBlåÒAÉ¿aŠË2VHt‘ý’ ·M#Fx­`Kª¡hˆ¬!=ãø!ÕèAYöb ä‹çÐ.ªàyÃË܉pPN„MaJÒ¢¥„DéìõÑ *nÌÒÖòîl6ÈÒ0ÏÕ³ø7¡ÖbO麕Mœ×à"Â& u?s‹šÝi¨kd©šN‚…°wO<'׫Ð5»JÒ?fý=úž»9”¡x‘þ£BÃCVPe®H¡ÆØ-šÙoó} 0Q®¹ “^W÷däfA–uCãêa¥sè'Ê'5³¯Ó¾Ÿè(*sÙ[&…#”Bf‘/ ÞKò‹cÇUߢ˜» Î ãÄžà¸lOd‡ý¹±Cn¥äÁ›µƒÐƒaÑ‚¾Ù‡v¨w'wÁ l¯¸¾?o¼Ü£1l"ßÇtLãŒÿ7¯ù®µt÷Ü}(-706¨Í^zÂ$혤ä’Öb,A 2jSXÌà“,æ8›hˆÝ^ý)öã ïTi¸Ì§|$ kôÆ-{â$&æÀM2’ððS°#ƒn,/'A!´r>“zv"jÁH}Ü8w­¢$ƒß„yO®G§'¦@¤ò²tQW]ðùíÈÈ«~ëêw‰­%Ì҉–¿ ß1Y0.œåa IÜ{6¦Îõñ§›cl¹ ß,™þD…ŘsÅ¡ù]’ÔT…iæ‹&’Se:,²âèEÉÅ¢*-|5Ÿ°Ç%6Å&‚à ÛXî£ ÀƒÅºN\‚m.¿"A·6åN`Z)î—·.&‘òn.å¶ÂÏ Ìhž)9b²£ !ªàÅø¨G±Ó‚Z°Ü"p¢E衽PhÄaI£±9ñ ØõåÆÃwÛÔewo Aâ…ÄتÙ´¤¦H=§wåèÁF'çÌÄøvy6É”ºø<€m¦Ó žOJü°×©C ‚.·Bc~¯Ü—Ýï‹”J‡q6úE)y`¬ÙoË-Ÿþænn|:-ä½ Íg>ì¦Jª³7Ì‚Ÿ°ˆ&ó…ŒêQìâmo-¾àÀŽÑ¹êS.¯n¬Z¨Ôf.„Go§¤ñ.EÕß·®e9˜òçhI0G[‚ÞkírÒ\±RÔZ@Çʹ·•ð)—BËÌMÂè>°‰j$)Í]áþ-æ¤z—$a>Ö&1ÝJ7ü!/Ërü:Ì /¨7Öm, ÝÐlGÅ”Ÿ‰søG׫‹5Éw¦ÛW½tÎ ÔôHJŽ„_~ˆ?³ÃIrˆö¯8¤ch1úøëŽXu»¦üSZEÅ7½ÆÁν;Uù¡J†[Ê&—8U—³ö3Wû‰*º§Çšÿê§·-XóŠžËI™¸XEÈKѾ3ÛMJñ8x‰Œäˆ°Y/üSÊŠ¹j×R §ñúùŸ*°•żL.~@–,ŽvšÐ'É J®xã¯ÆrôèhîǴäô*¿kà‰±Z–ÑXÿ+ N¥ñ7aÿ ù® endstream endobj 2154 0 obj << /Length 3612 /Filter /FlateDecode >> stream xÚ­ZYoä¸~Ÿ_aäI¦µ ä%“LvìÄ›,°»0äÝ­ŒZêèðx‚ýñ©‹:ÚjÏ>¬j’"‹Å:¾**¾‰à/¾IÕMšé0ÓéÍþô&¢ÖîpÃÄßÿú&–q;¸[ŒüÓÝ›¯Þ[{GaåñÍÝãrª»òæçàݱ8®»Ýi­ûõíÎ|ë†c{»SiPöØc‚ÇV†\ãºb¨šÿnÚf76ôŸ¸¡+š²=ñ[O·6 Š®*óÄq’%A¬ôí¯w{󗻉m«lhþ{ô£¿°Ñ\‡ ì6 #kx«7Í-ìlöð <À~³Àqkïœ4=?ëêTÉ®é­Þq{ûÈÏïܧ¡•w*X @ªg’a[ƒ¼|ß§j82U¶ãÃmÔ2Ñ/‘HÈ@]u®´Ä¼Ü™xkeÞ岨Å:ŒmÌ›#>é䎻£ó"éà¨ÄÒšM})YÞ¯ë5~Ñ„å†þØŽu‰´¶TT2ºàö[?ŸI%©}mà<= ö È!6”°_Ô·F€5oÑ&¢  ](dq}ÎO  nžvCu@2x¬šVÂgÓL ìYZþÕŸŠºF«ËÛhx+jÑäÌ xÉÍéŠN¼NLGÄÉû®eª¯Ù9Ì_ k&«“,Ó År!1Õå"{ç­okû•wdéR—c*hG†ÙPx…IžøA|jà…±Z~Ò©Z5÷_¨´øH€tÁ£%Ìg‰3Lç÷uÛËŒC{±ÄÄÊd›æYða÷ІG‹ëäàd¸{ì)æ1+¼éd¹iðCanõZˆc3v÷´¯{°€áf»±‹È/å[ÆÊzÁáÎUn·—C¯g~èÖ:§¶ÜtG±ã™Ž ¯Æ`¢Uðá‘×k8 '‹Wì’‘$ƒs*^¤&î*yË[ÑNÇ&4±^y‹•ÓI–š¿-Šž ú&éã Ão™ÿ%1°á— ~ô ñµ ïÁšö8ó‘ûº”©‘ΡC¯A3ôÜMž¿D±á8¾ÕÏ~†@xž­}i½Ð†{Ãt†É“:X®c’É †Û‡¯B`’^Ï5D 9˜‹‹©©d&—A-?øT¾ÃÓ˜.¨¼ÁF¾XL¸¨6áÏcѯWö¦³á¡zÐŽù ÍØ,à{út¾O°my¡( ³äZòÒ»}ù¸]ÑÏC«õ…5Aˆ¾k‡jj&~6¿Ž0Tâ š¬Íü'©ÿjIΚíÒ&•ÂT7YÙä˯å$gÁçå-"5rÍ©~(H¯9¼1š5“Rór‡n·rÛ¤|­þEñ·qSk鋱†.Ž_>pÀëÜ»#ò=äÜÊ)ú©¼6! ¾ÑÓ×Jí™…œK¯*íd¼ª´«/WÚU¨³xuýˆßBþ¤þˆ endstream endobj 2158 0 obj << /Length 2974 /Filter /FlateDecode >> stream xÚ½ÛnÜ6ö=_1šE†+J¤(؇´iÚhMÜîC[²†¶…Œ$W—¸þû=‡çP£‘9N1</‡ç~cä&†rc’ÉS‘§fS5Ïb7Û_ohðþÇg’÷í`ãn±ó»‹gÿ|­õFÆ¢ˆ ¹¹¸Z‚ºØo~d¢¶»¤Hó,úõí¯âýË·Û]š¦Ñ¯ƒíq¤¢_Êv›äÑT¶^üü쇋ù:h¡Uú•¸ùÝ4€`*bÀÐ#˜d"ÖŠ|½-T4µÕXw- dtÔÛ+ÛÛ¶²ˆЗm¤…Ö 7»D‰&Ýi éýÇw/ßÿc‹÷œ©ÿx[·Ÿ?¶öŽŽgñ’=R"— €qÇÿˆuÌ·ËmJ$jÞTuí02°\’Îü6‡Ê«7.<2ûzûúrr”…pѱÈRµÀE2.'Ý¥²q.J-i÷v$AîíU9F’åmÙ—m?ÐâU×ÓàÚ¶¶/Ç®!¦î¤Ò€è’Td1kNÝŽk¦vüØõ{М'b-òÌkÝ_³*%ºi¡6Y¦-ŠôûŸñf‹?ob¡ÌæÎíl6©HíxsØ|xöo6‡“Û’, “Y¦DÁ ÷n›§jL@¢©rÝ‚›B²D˜l–Þsâs ¶d¢°¶¤"=Jû,…4O¾¬`CæH)hó§*cà4¼Â_íË# åÜAu‡ÕRlw*O¢ß%å¡ÞÊh¿€0иì- .ÝQ¸þÞákÛ£:-˜®êX{Ò…PEáw”í>X¡fiH‚ Vz¾Šéù©¾¾™Ð#U31½ÈZ`\·ô{e‰'0‚t¬àÄÞfþ}Þj ¼ZØxcÉË[¸ï¶ïPþ®ÇæÁYú.™‰ÚÎÍJ˜AûúX¦˜49Lêòò`Æ&úÅŽ7¤({Úûî|óö7úš;\7·Û0€V‰ž¾.ýì’0cWtü­½„T0ÔÐÚ’lQ#zà$q@…ê‡Ñè½+Ž ²Ø;KqßàÏkÂn„_ψ˜Ð1Åb—öšÖVÒ‰­ê궪÷v ‘ÜÕNaDÀâ Á±•C%xQÔŒâ<ïP\B ‰Š~àÉï_½¦A9®¶·d€J8£ ¿²‚0Ú…h‰N·)°×•eFÃtH³h…µµ¥/‡¦N>ˆ—4KZ;›R s¤`àcTÎÍVe»<Ï{;ßÎûuS;ù>TÔªtW¨„ äQeaî¬ÊªYè0Úw‘'fí„yÈòÁx˜i°Æ@Ðç‘hŸCÖ½½)øåvO륷 ‚Í(F´ä½?ÙHµA‰žÉô–Èœ ã†a¨Y˜½° ›ì"¿ DGâ…Y;ïªo•«@¤6sÄó9 wRi‘+q/qÊbãÌt²Î®uôƒSÇ ´Íä ð÷ö¯©î~+J­Øñ3i—i;ÆÆ$mÀý÷tóæÚ(¼. Ápý‘ßACÀ%µ_Æ&l‚Ê$êµÂç¥^^ÀV5£õÜi~¤yvêȹd€ã.‰Àb’sïÝdCAš‹O®øiu0•ßIÅn‘ŸŸ|™øÙ%ÑígÜ‘TòœlœQáÑz|Á|;}õ­\kÐÒÌќ>æÏé&)yB*æ+•8 f±‚µÓ]oP,±æJ#Vóå1ç}0Åká̉6íIPŽUðéR <3C†«ûÕ-×õìèqãpLB¤‹Ý¼RtÀ%…øÝV½¯»g€ÝÅ€×jíß̺CÙ_ûÞ«`ÐCù’'_ûÂÁ½ßjð¤MÙzÒ5ð8àU¼®½DŠòèÆ0^»679ô9çgøAå%otõ%ü–“gqÆÄªÂ N’töA½‰ 8wÞ1êç2h]à­øãoÅ1z²T£í4–÷¹°ƒÆ6]OcL}§æÖ÷dý=±?Bi#ŒºËQDÊxC¹Ý|ÌöÜ­P±V„u «)?q‚·(³1&\w=Dæ†ÝR×óÂ`ÛY[æú\%$ØØuèAhÎö=6Äœ©_§¨ „4Ž™aRY†§Ñ9)çPøÆåϹOXóGÖå €Üˆ‹‚üèuÜU/@L…€Ê%Õ‹;ÑuÚ7„…´c´ODå F”ÅÜ|ëjû=©–çºè¹ç¯mWÂ|hfÎö!%B] ì=PV‹Þî§Ê²o¿B'×{ðåøð~4¡§^–Íß×hî^e– ½U+'*ɾРÓR/›ab8¯:mङ1yv¶lÜTÓe]Ñ >‹„•æŸ7RV‹ëMzÖµuU» |O œ<à÷z*ûG¯"«î§óÖ ìÒC1U8¾±®ªÿT£‘^s'•Õ¦Þ̰‡Ð03–εå*z`ýYUëÜeÂ3ëãº/ð4šSh9÷Æ®RÖ‰5ä¾E–ü/™u.òc«uŽFæ2Ø… < ?‡u&ÓsX¬‡õRŠäØÃ¢¬¡w\ØB%Xá¨k 5ß[îCåF9sejdý€ý2Ó3.ÓC¡ŽB‡=ÎгxN) ¿"ÍôãÛe‚F•(Bö…ØÒÇ€âÑ®~<¶½–A¥k}¾YÞÞêê|¥õõ½Þø)z½?áL!Mé禊Tež Û›Æ3'pJƒ`Šô[º½ilœl”Ôùÿá-‡Ëýhl ™®Âá—Øj4T6æ‹m_‰ÚÚ¾Ø+iJ|T8PN6v|ÕC¯ŠkÓÎg4YQKçVÁË(Ob%t6c5…:öv¨L´ÀCß$C Ê)”¹Â]3m¥ù 8Éì!ŽÕ'’_2OPfŒ!ËÊò¥#“Âîdð)%ÍEq´¯s¯Q ˆüXHmñ²5rú”€OÅÖEñØtÃÈ=¼·Ýèj\jã­z~ñ’E‹b¹º®s SøšÚ> stream xÚÍZݓ۶÷_¡öI×D ñIÒo‰·—iÝÔ9§Óq37<‰:q"‘~ä|ÿ}w± ˆÔAöµçédô Àb÷·_‹~b‘ÉE–«$WÙb}x‘ºÞîvA·~!xÞ &®&3¿¹zñÕkc"MŠ´‹«í”ÔÕfñ~ùjWÞ Uw±RJ-ÍË‹•Öfù·jص+™-7=Žèå¶å)·USuåP7·ôÜ´Íjlj?PGW6›ö@oývaì²ìêr¨€Ž6·K!ÍÅÏWß¿øî*lÛH“­žxF?ûÍm"2 )m’M‡=Ô·» ™/<›YVÖlkYmèyØUÔ8”êNÔÑ\/F×u=ù9†í–þûqƒ;zªÝ|`+1`ß'ÀWi–iqÒ=V¿]82_"9˜»«û°T]j]6Ôàn¿Ôº«ÊžŒ&­„J„tæ±wUâ8ðÉNù¤²ÄSžÝŒÝõ]ÝüvÝWÃ5ðáºnðp~yÆdaòDf¿½.÷û„çåÓy+QxÈ¡×RXšþöÂÀ®e÷ËËqm¥µ§ýÏ‹\á¡•JQƨq(»è©úpÇ«•z™¤Æ¶}sØ•ƒo1Ýö¦Ç;C0ÛÝJï±>›n5³ÈávÙ5À˜?œ‘Tþ`W» •EY¹üw*ôíØ9íµHpÿMÙ;‚¦Û ŒµcGg,€£fÒûzØÑ }{`jC P6k~,7"N uëaÕâïúÜY"ûrË‚ˆÂ+ V8]Ç#uïý'ö«Æ²#c6TÕ‰Ï50S<ßi䯤bBavIÃwe7Ôë.˜º7u?tõó$8 xQì ~[mËq?Ðì:ªAºÀæLÒ³ ¤g D¤DR#~=Ú‚ÔÉD*/Õ°:€ï“ôæ3ݳ‘› ÛxÛ1{ª©ƒ½{óîíc‹ª$l pÝ€6(›?Ç¢*%a¾p¤„âCþ€úðõÛ?ñ)fLQ"ÉE€m¸ÁòP÷ÕÇŽbe’yÌhZ“Åhƒ]ƒ~~s}ž— ÛRLY)Î@€S;3€ßŽó6µÈ–puã5OäË uüpùæ'j‘Û\­Ñ>üÒSÁŽ]ÇjLÁàà »~Zä°BÙðÛÚðe@Œí¸ß?øíì«õPñPšbÞ2ÁG[±CKö¡Q Ɇñ0»r2Š•Ð}ÏZͦZW}_v( `ÌÏØF€‹zðoq?¬´‡÷©÷Pâ{ôQ@üêü‘ªÆ‰HÜÞÌãU6ñV”õ‡Èà@ñ€6#à¾=âOÆ–y↽›tÚðd~Ÿ—zØaŒ>ÆžzLïj¦¦§ñÑ ¸Î'2†vÿ;Ç(h0À#=ú#¾9ç‹ßqN 5áœ7åM½‡·Q§MZN{Òî]> õb&a˜ÛÊ\26~ 'Æ„8 ‰" Å®ÊI%*È!\Å’(Üe©vª²£G·œ6ƒ½lĨŸuÚ^G étÄHöб‡B·UžÊ3©s¦KvVü6i,4HécG«ñâ!\X®Ùg*oàÁ]ÇUa½7íÀHBµM½áÃN8Sbˆ‚‚Ïw.=ÑÖGîÀ|ç#àèDÙá }Ñ`þ¨3% ˳ÂÖ7§Rúy,gÔhS›‰zP'UòåÔKÐÈôä<#œÛL~ºRìBoÀ;*lHÄcÖ8Sk,>jŽÐõxÞzˆ ñ'¸ 1yªÅ§m10ÇäßDz/·±ÝâFŽ‚ÈñãIN { >½ÏÔ³Ñ|ZhGʤ>#u*¨±Üø E¢úLªB¢cäðöÝw1J Ñ“#霣NLÉrA£á„§ƒ4I™½Ù„¼ý=gAqÌw=4í¡v%F]üòíQ€&l 84®g^¤F¨Fsî ‘‚ìC5ƒPÆoeÈÇQ&_¾ÚU„ðý Ú =FÃææ«€¾¢Î¦æ£h °Áæ˜xó¤ø¿¤±ǵj 2t^.!$*ØÊsäDÓ°ôæc_ìÇüRÉ»±iBé\FcdB¾£‡Y:À©Ó囟¢u£ô¿- +O F@ߌÀ¡˜Œð)¾_éà~CorÁH>r¦ÎŽº8šÄæ´Ú Ù<á\**BÇG ='¦øH¡Gg:Ét±þŸ¥¤2)ý¤BX@™X¡æW‚ËéˆTŸ-¨@ä#2ùÄzÎ\§˜.âXêCK×·íàe)í™Îó›<Æéhí*Ò¬¦ ï{W µd2”SŠ„tªZ>~O)Úun–ÊÔ‰—F¦Á Ò릪’ÊÎa±¾Ü “|NKéyügDrÍ™è<´¿Ó è¢Éà¢MÞ®z–èu}|;,¸.{nÝSÙ…wÑëþ@Ú»†î#LŠó6ÜL°o1?‚N“…*“ødðKH󈌚Ve¢2d’Læ'u‘§I ¦m$ïŽEq¶“šÝÆi?+k€QEØ"ùÎø¹C€ ౡê{ä+„T˜gÂ1b6àï=Åß hbþ0f†-xK³`ñ6ÃR* háµgU•e‡Â. e­}¢.žzS#­g&~_m‡Q V$µO&ºRN°±«owCì’àx*ÿtrÝ‚×"çñüUt»¢˜ªÅäPædV‘N¡u‹\€aAw>–‰EÕà ¥aê<æޱ¿àXÇk6¤o9ÛCl¬ÇaÕ ¢ÇÇq딣ԣ’.ÄÉÚ‘ÿã9P;%ï© 4 ½ieÿ¨çÇÚä§©£°Å’wôˆ0 ¥ÍýÒÐÞô®}"9CÿÍò+€Å쩸<va¥ZÎç°¹ŸýVZ*¬AÒØ„ÿŽÊ)ÿ±ÓeiOÎëŒ~atüöéL}Á™[—þ?¦ÜëŠËœ Ì¦Ÿgd¡`ÉmÊ–?³$d<$yŒBN‚—ë{8Bçîû¤Éç$Ç]|‹R9Û1UGoüŽ ¬÷rå÷ê>r+O¾R9ÂÉ·!œb>ÿÉDìØ2OÌÑÄ|ñÕŠ¨#²__¾y}ùæòê_Q“›OcÇzôÀûÝïý×jXЈÖ¥´ÔóXôòp‡~zÛ e൲^^¬lžú°ÄWŠ Ö¦å/QèÑíÍÍp%Ói·•¯dTþÒ)lS™C>8ͨõÔC_í·pY‘/¿ßËr@ŸŠˆXût{ð&ü6f¥ù0Jµàƒ¿™T,îƒ þlr™|4䤅ë >åaßúø±F»§Oõ4Íô~¾¹HÓ/¿ ÿŸ£j’B»(¦vd~° ƒÉl¹àÜßYbâô‹tBþ[UÝö endstream endobj 2167 0 obj << /Length 3134 /Filter /FlateDecode >> stream xÚÍZÝsÛ6Ï_¡¹'©¡ÄA¢o¹ÄɹӸz¶ópÓt<´DY¼H¤ŽqrýíbФ!Û½ÜtÒN+X»‹ýøíÒ|Á¿|–ˆY’J–Êd¶Ú¿ˆìl}7£Áå»ÜÑ-p9 üëõ‹߯ñŒGÌD†Ï®7í®×³ßæ\èÅR™êù‡‹ìòÕÅb)¥œhòGjþ>+"wÙnñûõÏ/ήûãb³XÉgòæ©2¨gœ3ÇÂ3(4‹bE e»Àwç]ÙÕ7‡¢ü|Óä-ü—Õ«ímÕ•ë¬þŠœýøVGCIE¤™„£í.£8"¢Ø ‰Jx"PÀ¥—ñß=ã’Ç,M¹åJ¤Ùþí÷h¶†ÅŸgSÉìÞRîg’‰OÜÍ®^üÃÉ6:Mrà OÇþºHåüÕåN†‘2$g)Ð;þYíó6¯›(Z°D+Oû’®±°w׆ö’…§ßå›6´+\ôów]JÅÕlÉ%ã1§÷êânÛ†. ”©ÜwLŒŒv© áö$ÚóMˆ]àD$™FÛÁ-h¸HGUÕÁ$KDìiÿÈãíà2ée(БÖsøá󼥇¶r/ê‘ñ ¦x¯Û·¯~¹: í/Ó²¿Øv›—nÓmŽƒd^çÍœ8ç«¶øŒ|æDqkg½Ø©¬¡wîaé)áá+-e!^fuo.cgÄàæcÃ8èutóc GLè^q«l·[,U”XªBN“¯iæ¾h·U×ÒÆ£™Å‡MWƒjzXUûC×fmQ• [,5ó· %»·²’Ä5±V}MNy=-øÜ© gQ§É¼*ìqmCB:žG2î{ë€Hš‚ n,Œ™SäÜçuÒÑê¡®nwù¾¡§uWåí}âßæóÙ9Ð>÷öÒqí×7oiPçmW—M认HY,¹WlÒ}ÊLW>r©²Ý¾jœ¹·!>¯‡¯÷8Ú¨Ÿ²ƒ¿0wï2a1çSï´¶Ô<éR÷^v}ùá씃EfÊ{Ó_盬۵6px§(i©§X^R¹–ןq<ïgo4ÛªnóÏnTy¿°TûªÎ½peSÀe’´Ð£&q/¿ƒSÁœÒ´w1•&ó}ž• MWúÍhÅæ54¸-=g»»ªë߃=0Ê+p…î´µvƒ$ÕLjKÚ¤Ýn[·OJû¤äS@ ¦¹év/1¥êyÎU5 ÚPžh,É»l¿ÏPõÂéÒÀºhÚº¸íZ+#b…û©•à$]ÐÛxl§nɵêu^‡ƒa‘Ò°Ë‘£  '€&Ô{opHV®³eÑæÌ퓎r‹oQ†-͸4´áå"þ÷Yýé§Ðá*ÜÐ[äµËÒíåH.Ž÷GYÓ@8hè¡Ýf-QµýÝB9X -¡}qN­Ã’•VV¨x˜„(–Ûq›¯Ã2;þ­ÈêykPRï©oÐ%R8§ji@~ž¢$p¼ezÀBDáÀ¤Z<' &¦ç ÿ²ÊîpŠŽÄ†÷º˜²†ƒU×.«à£S³‹#Ί ôBf€­aTë-ª*mÛÄ’÷€5.ÐìmÊ… L^4:Ô9#o¢~ %ﺼa½Ó¯ä ·Ÿ‚‘¸:§“‘S #';n4l)f4…3ΓGA÷>ûrK6³]ÆÜµÿ ꎤÁÅpc•~ê–LÃy¸Œ¿'Ômú9¨J¸`#ã'‘±L!r32Ó+ëŒÀl_ìѺ=M8<‚ÿ'ÌCEž¤(9LŒh™ ‚cÈu)7)^ H³C؉H“|ËŠ”³\·âÚ]`¯¶ ¶’¤&VÒ®eç¹Yë“RÖ´!¿H޵‚YHDCSéãCæN´˜*°·æNf¿7þ »àOcÿ…à i%¡PáÌ/ˆ •Æ~êDȆZêÇC†£©Ÿ w2ÊÇO4…gÄ‹^[+÷a×Ô«âaX¹ywvñqux®ÎZ_ìM¸¼!â§ËP Õ0 Ý 2²Þ–œr®Ä9W":MS™ƒ#ÊUCJ—¥v™Ëö‰À5KC€GÑè48@í¿ Ìk9?w >V2ÀØGåùaµÞoR*ŠoH@"æÀ4UŒq@|SüJb¨¶¤Ý °øw€zúGTizÚ'bÎô¤ÝƒÕŸ€kk]9€c*\…²à'úð,TÒª$Bª‡òõôÕ#ˆÂÙQ‘½ûJ$›ºÚO¶´D“ÑO›a½È ?˜²Òáà"µ{»ßüÛvCàMî'+ŽUÙÁ­lsZ Æ"\¨6#¡˜ö8”Z'˜&Ëþ’þ`@ ƒÁ¾(‹}¶cØG‰çl§ ›NûöÂíâÆ¡Ÿ‚f•Aé·¦G×ÛžNÞÆ/á•ïr_ÐL/åD3bAÒœ²HɽÉO²-Àe¡Ee¨\MÍÃÝØp2¾5¡´òe:„fošŒ§ˆQ¬mpÖB œ¶]VÒƒ»Szpm2Ü·Т,°ôgºÙ›¦´D+Öñl7€¶A”‘r»ÊôÝWê7ˆhR€âLßÚ€±omgáð»éÊ•%•ú¸0ûŠ9@†›ìp¨«/'n‹T±*oÊKžÆÔ¸ñüÚoX0Sj ,ãeSêºê¬Å³ê@Ùðx"!%¡¤? ¬M[ü#°æ2ž“+p’%Ó.$™† ž<™éT¤`§I‡ïì:m&9Ýxâš9¾ÿHI¦nrš´Ž‰TYðK 7 3Ç¢¡ ñ¨Y4€îK%ͩЈê×îeXÌõÈpQ€®%fIße…ÁºÚgÂ"šFô’»N!QŠ"Š&^±¬NÔºª¡1´ŒáPæT“ \FÈtdng——7oþþþÕùEPúà¨v¸»Î s×Úìè ׿¾Ù+Êp·(zìc×Çý= Êj¹”LñdÚcFTŸ÷½Î8ºß¾õkkú`3£òviUr~ñöüâüúŸÁrèFU°o l š²On™¤ GÊBúºø¶¥Å ;™®<Ô°šTÚ ½…‹ ‘âuŠ? OÅÁÿ¡ÉõxÔ~ür*êg´œ°œy4*έ^¬ñξ`ls ¸H 'b¦i)&ÌN¾Újóì4 D,eFèt\ñ“6OZçƒÔi£oJ_}ñ€‚P©5t6b5:Ø5lp²(Ãí È£Z?úE©˜q Ì@-— þ-]HRˆˆÛ­âT»ÎÏÀìÇŒ. âß=DÃ?¤êm}²S<ô5ç°Jj&ü±ÄH½ûŠ]ÒÑ·Q_ Ÿ»4µ…qyõáõ볫« £¿(p³éV«¼±-® dËnÇü%ýÜVi{ endstream endobj 2177 0 obj << /Length 3964 /Filter /FlateDecode >> stream xÚµÙ’ÛÆñ]_ÁGlEÏ…+Nœ8ŠírâDZçEQ¹ »„MÚròóék€„Ý•U•ÚªÅ=3Ý=}ÍFßÙäv“N.ßìNÏ4v÷n¼üë3#p[ÜFº}öÙ‹4Ý­J]šÍí]¼Õí~ó:ùó¡º uw³uÎ%éïo¶Þ§ÉßêáÐÞlmžì{œñÉ]+ ÷õ¹îª¡9ßsÿÜž·×só'èªó¾=ñªŸoÒ,©º¦jØÇ˜¬Ècó›7·ß<ûËíˆvjS•z÷‘4èÍP§4Pµ™Ò©gBSå”q7Û4³É«—7Î$ß}Xæiò_þ¼jN—cÍí—@a»ýînû=“Öóð‰ùk÷Hð¶ˆy«7[k”µ|àË›Ô$5þ{wm:éØdÿ{Y:»–4W¬§…·Û]{ÞU7¶ÂÔÌØ|ùâ9·Nx7E²¯¥_uuµ†Ï–vÝZ­œ.¼ºŒXÑ¿§±yUÛë…Ä ê‡ç|·¯*`ˆÌôÇþå#ñ`æ4çfxþz¹½m7Ôûß´ÿ]Í|?ïèóäQ¯¿ý¦Òæ s•:ö Sûú«o¿Ô^h}Uï•¡<}Πã€ý\˜Ã~„øâxýY/õò7ˆÝfë­ÊR¦¦´Fîà%òå53&izüÚämÕ?h¨=ów8Ô<ב·w ›7°BdgD†Q~xÍ¿uªûº^*¥ËRà‘ÝdÖªÒRJ•Âhü3–´s>«iX¿6X±GËcDæv€¾Ðô…òŒùë—(ÔJ ‹‰2É›çÌ:[:>Ì€Ie¯Ku<ñ¹N¬·K"³ ³M¦K•—Ož¼ WZlI8‹ ã0ªZY™\{´‰8æóg¼ßºë«#5çúݵ:6CC@N§À6ôCwݱ Æ‘Š!ðg[M§¾eý¹ž÷¼ ;`qu¾?ÖJÄÎ1m1ë¾ÐÖiPjÒ¾ŸÐ jAÇ«ãqMs§2gFk¶¦t¹*ô¨u+æNÙ7@fóöŠ‚Ð£Í1ز;^™<ÿØÞÏÖ´;¯Ú ëRUÀ|fãî3Ì„CÍòxà 373Nü•±A*?zÄ /sm7¯,¸>z¿¶K¦¬óÑ6ýx‘üQvó3Y-T^°Ök;Êi2kX¥Ê§#ÄêIá‘B'úTñݤŒL±ß¤¥ÿNöâõ½ÙÃÜ7`^¼Ë6¿ä‰hÄóŽ›WÏþÉJ8G(l‚/D ߯šÿmªUV¢àçÊ9¹ž¿µ]ÝN×âžjR…_MwÓ^ðöƒŽáè¥ê*°­Ì§d3|@'|8Ô­!bŒ2›wá0VÝš;÷ kÈô!õ6Z¯ö?^ûÛä]‰ÔÚNÆÛ弘Š3S–*-˹ˆE]ÝlóÒ%·ô?>ŠAä‰h´ÁCz_&a¶`_~åÑ®>Vè½i QÁAB…vzŒwÎp—£”îV™§c“ö‚`$'!ƒÝóùûú܃â~e8W*›/xÐÕ?wä³ô!wi¼èc“ÂEj³·”åÛhýšo™2÷•ˆ¹¶!d¹ýò%xF'-ÐŒ%ê¶„€´+Æýa/ Ÿ@u¹iìŸ›Š±d€Ê à*®ÇÕX¶„àNç“€_+ÁÔÀ§H¶Ýgx+«Òã3Uf£ÅüÝÚÖ©Êí¸³!×EL» ”¡p(ƒ`? Rá]>3ùä·ADt«…Co;…®ðèCCjmˆÌhË‹4$.”úæÛa8BjóhW_ŽÕ®3¬C´ýDòBEâk&R=U0zÅE81p.Ä.ÀÉÑ,òx?4Ç£ÜCTÁ@´ 4~¨zn«îž«às;IüŸìd¯X\ç¥f¬ûBޝ3Æ„Ôd–ŒooÀµÜþ¾¯×¤]Óuf!3žŠ}¶(c̱K© 6¡œX@‘Ðkèsm¯Ms,ÁóXœÒñHûÔäGzðNƒM)¶f©â2Œs{Ù4ÿÈ0.{$vÊ•…´(‚ú0‚³¥AL_D8®V]2«Š¥í¸ò‡U›TdÙÇ—9>_/¾8“/¼¤Ú±M¦BÂ^¤YNÛà|P³r˜…RÜ 1 ÷XÞ¡Á.V“Kˆg²cœŽáN¡àâ–¿‘/Óvô2`Y!ÿ)f¶óC÷æ­&;ƒ_Î쬎Õ»A÷±ÍéxHÒ½5³ÕkQ…Ó*Ÿ„íz¾v?ô]{ýbÌvû»j8µûU-3.G—SåxÄŠ†ç¾ß7c È´f¹ÒÙ¢*¡ [ KmôQÚC–£ºcìAD9S­¬Äx5• °~D¬KȳF£ÇKJã"¢8'8î‡\(»ñÇfé½£¸ˆ2ÅEdpd‰Yæª4nÎÈIÀ¬ëm½]‘&%¯ƒEÒ„ãìaqb„ µÀ9T‹hÆÅjãèq˜b#BaáTÃ’9Àã8ôbº(VÒÁÕë(v€v;@7NÌtˆ\µÔ“èv¡bå´cÑ!0á5ŒÍuÈ@3"@ÿzf•qŃâ%H¯j$·ÞÆÞP>æ—<ÉžÅ÷ŒuÙËT¡Ý'd¸%J uJ`^ÕZœ—x›¬1È%Ô^!í\@ñýB#\¶£k#:dýDÙ,ä³9øýCð£R J*©4qg Jî !,æÑ ÿÈhЗÙãEÕ¼Pf*‹=XŽoûÌÛŽöΗùäB° í8B Pö¡pDÀSAšÆ[Ñöl?Y”ŸKç¹üÌa¢ÆÇrî‘Fšg íT‹æôVjјÀ>^¶óe½}ªô¬'kÍoc˜uwÕ¹GSòèyl™Ž;®ˆÎòõ'*¢Œ½MËrX +Tjâ†uRk­“‚.ý©“f©¡ÔO°»È”ÍÓÇ…+çf.”ÚEB‰ÑP±ñoJõS q¾§Ð&,'‘„/=ºr“¤¾†(°É¿°¶%uXÚ¨î¥5"Ø¿J.œ^E…)بºí Ò²”œ`ˆÖzà):|ñ`|¦áâaêfò’ÚeùYRÓA¿Ú† ."ŸÓöµlòèux ±Á1=P|œ‚1ΪR®5°0‚aJó¹ŠNE(l@pn€wÜ_(}¢aŠô¾ž?Ö­òOÔÂK0œ#erí„UË_ÃŽâ 1•äsÑñÅà¼NOEžUÔ2¥ÝoªÒg:‹é—߈xeòETu%3I…ñRx¤ §–‘W4°úßÚ¸º«Icdp °z—çþ Gý깿N·3VAPýñ„ã/m\üên¦€û}ª(n¦'Ãp¿7L`E#TJ ‡M6º;$ò a¬äô"ÂÁßB…α)™Õyň‡ üó™â ZÜäªï!t^9ÖLUžšž`vzjx“"WÞ¦IˆXŒ §F•Y:F¾¦ZgÈL3þµÕ©BU³i4TäÍô5¦Ùj—2©YÂWª·:ùéÌ F"R7=3H%_þYN"ö§’÷wpŠÁqgtx$ØÛºÚ?XqGÊâ°¾tˆ—XBºv”P—óW¿2˜æÒ-ÃØ¼KÂIaò'²±¥ ôÅ;Dµp,Ì›´ºçö 9Ã/r¥d;¸Å”¹ââzX«&O¿¤™Û1C¥šOÉÂS¡qeôVbʘ¹ÈsaËðÂu,}(a6ÍÆ0Û¡ Íe!4åôˆWÔ<§…0NA> sZ$[ˆøÌ{œ¹†_ÈN²eÆEM\ô¾9qé f?À%“Dæ¢Ôóá*(o_dK-²±â.Y"aà€*%Æ?!Ì&OQ¸È§ò,NÕÕ¹gðxÏ5¡ÀGïÒ¬KÅåq©ð*þí •f¼-IÜ%’0Ê{ó;Ϋˆ@bP|štz•—Ù‡Ò Û‰8&*k&<yàÞß[ˆcð7¹–ô³’uÒïFĪ…[ƒMéˆSÝa<È€±4øªb<æö{Ò€i©t>¯Äý•n—£|Œ—§â}Ï-Ã!òÐ=㪠—ÇOüò#゜sÝÙ¶³mß7o²ûÐÎw—MeÁÌ4Dˆi†>‡ >0‚Ž`Å\Q^:=•ÓsQ1{.²A… [Bƒ~?y U(cW ˆ˜úñ*q`øËeÜž8‚¯Ûc57>‡}4øñÁHÐ)«åý8á;ÍåØÔû eÙO~Èó?Ê!y endstream endobj 2182 0 obj << /Length 3191 /Filter /FlateDecode >> stream xÚÍZK“ܶ¾ëWÌ‘›x`@ÒU>(±å(ËŠ´ªl—ŠrvÏk’£Õú×§HŽ°Òº¤¸\s<¯î_7(7)üä&W›¼ÈD‘å›ÝñQJ¥ÃÕ†/¾{$]»-4Ü.ZþíòÑ—OŒÙÈT”i)7—û¥¨Ëzóc"Uq±UeVØäÕ³WâÅãgÛ,Ë’Wc3`J'ßWÝ…*’Su¸øùòŸ¾½ Ãe„ÑÙçæ[?`‚ÊŠÔhžàPMmS4Éø+’fÂéÜ^¨c“ÿ6»‰tH%Ïú©Ý5_ÀdS\ ëœÚ·|$\pC»Æ;†ùCû UŸT”ÏÑÍ——È“>’½x–iÇ?öœB»ÈQf~JM:4[ø“\zƉÏ"u#bÁrb˜Ç¥â¿k`ç“LQ%Æy´"q-¼¶ÀI]‘bÔ¢ý±É÷ýЂòn ¸SR¹iäó4ÈjiESÌöxƒlºØ ÊÒ„0á–O˜Ù›mk:jù;NWQ5Óq½ù°ja¬ô=w`“_àt‚ê v£ï ð.6l!EQª÷GÝ]_½f%ÈòŒ `µ!œ1"ÕÖË\hŒ’‹“ƒÌiÄíÁjL»<ܶ£«œ® ) …+â®Å2a¢Ù5ãX wœ Ü dá+Yœúê4¸a„þxsš`2´b7ÿ¥Ú×íFw¸cøÛý‘ñŠ@PÝ4 ü,áG£–Ió‡F.@¨hjxƒŠ¥†a–m›8 nqë}‹ê~ ›Â€Rƒïì¤ìú5¡ïF–µï×-Êlðº'%®¹ \ß.Ù‘u5З¶)€|*&Mn¯[BuHŽÕñæÐ’y¢U–š¯¨ÙU'f­Ð%°LnÛ‰ašF…&ÍPë ‰û÷\y ÌÉÈ{Ìé-lãþ.jK²e÷½ðˆÉ–"‹ÙŒ³—P3—+õAkºP“C‡ ï V¨¡]ÙMËAýàJÂ=ÔÚ!?káõâ~ëÙ qÚ)wWœã{\“ÙU\th§éà”ùM;9ì†6ãò†r›NðRrXJ&R„.¼ÝZ¶ xœv7ÿ“ 8óS·s÷+ÓÐìÁÐPÃöJQ£PFJ½ï ÔóÅëç_üåiâb»»æ–»Ûtu„º… Û‰Kt£”ËfZ(}Œîƶ«¹¨&ô¦òÍÓ——~2+曋I…"4ÏEÆî¤R¤vmJß5îèêf_Žp­îK„¢ÞI  "¶§h¬2Ïš‰T¹Ún:ßS´Ž!º¥EžÚ‡ìj¶Ü.ïüȾ‚ëJÅÆ¤VkAªÿãÏ馆J¸wû-µ·÷Ù;$Ó,41ApÆ`·P¶ò§‰\`|_Åäf% ôåé>ªvR¨ò£Z—›µÊÌÐH‘ ŠÛ[nÏWkå$·G”~þ¦tÎ8TñD[ØããÂ}5N¡åáªZ¢ÁG.ñ3vž†-½S€=û(Š*°Å\?|Sf4´£!›bx’•kSì»Fÿrq–OðÎâ›Ü 3â÷à4"–f)¨FæðT¶•!ßÇ8g&·¹ò™){ÊhTCb^af ß1i¡gFuωgeðS5±ø¸oœºO6Ø©5A—¥H£Ò0þ™F‡ÙWºbîF8ÀÉ –6O¸â¥àèNB-½x3 f«#ÿffuÄÇc6T.eE‡[aLœùYX*Hyó; ž1Àü=™X€ª”å&¢€S~ ,ÑØ X¶(áðÿ< ðÉ}û3È õq—6Gj³VQâ×ú;Æ«0Q¹‚ep97Yò‚9¬ƒ…©k«øNÇ¢@¤04ä¹”î‚\JgvnéõÈY„Sú÷œ‡³Þ'Çô¾Úõ´±`Ú?þ$ÝšÓ©e~DF: ‰•ÏS*f|Ëg\hR  Á4Ç0š\Çí:VëxìƒÁñ­ïº¤ê£Ì\0ûœ¹{(Tgɉ£„õ¾µ÷ίïŒb _q8 Däá¸?Ù¼ùcq8ˆ°ê³àŠÂ;æÏƒûÿ(’%çI½ç\åJW/MÒƒÖ0Åq!m(â+ð½|ïP³ vCÖ_1Ù5oƒùÜÛq2püÐÐh`ðH—±ºu=éѧ‚ò}[»¢šc”ü˜PÃGh0BKlhÄP)”wV Áa| Ìp,“ã¤Æ‹õ 8?ËXŒâ‡½•ì%ÈŒ\ÄŽ1BÍ™SÝŒ µÁP<¹ÕF!ìO.uó0¤±ˆ× âcËšeˆ²5gi­ÐÌ…`åz­Pq‹Ìx]ÃA¨»¡UTG&ö¼ 8Ù=ÿßó$¹Ü’¨çrFsŸ~ÿü‡yžan“ÇÏ.£žK¾r­œ Áaò3€¢©»"Ò&µxÂLó®ÙQ0ŸÚV{¢®XQñßÙÃãZt`Ñëˆo–‰,-âÑä8§6kw[9C¶sÖ1Ê  ³£þÉ8æ_c@^H!Ký»¥÷y™Šœ Y ë¤? È1ú%‰2Sþì@n΀¼¥OâÑ_8õ9zûáÝ\_÷Ã9x™ŒD÷´Ìë>¦)8‡ ~Õ‡$x±øˆÒºÿˆ^!6°“ÖX l ¤f@ ‹„¨À!°É+/4tybxPÊ0Åã3Laša S÷ Bã9KÅ\L³IÁ¿{lÅ!&h0Å“nÞMCslwüò ÉQíF„Br«æÙC EPÀ‘.#·…ìê4õ×ÜÑ (lU`úulˆ3ÿ¹0*âÚXâßRBÍѽ˜¹ìÙ×.v–‡Ø.s ò;O»Õ‰’í‡#Á-ì»}‹çwÆ3x}¹ê¶ÃÆ•ÌÝ:ø¶³ŒÎt´âžÌŠ%Œ _ÇCX¹3“q>/¾gc}Œ³>Üé}òø_/¿úÙ…°óC]) æ DÊc; ýðÇ0ÞÒˆÔ|ÂKßý=0yÿV‚Rè¢xéµ0û>J*­JbšP¶Ý£$–¹Ñ)}3€«ÚÞÐ=¯³3tÔiú>:"m}5 sdøƒR™Ûjgd˜ò˜‰iÿàý¦$“Æá‹ä/Æð?Ô,ñ²„/Ò³YHüÒ±+ݹþ(] 8‡c,#N·lôÜïåÕúK©»oªnl¼âJŽ­ÍÃט>VpM‚7kÝW:Ý<r\žök ·ã—ÿ•œººwÌZ¡ ß‚¸r€åÓgPÁ_%ÒÓÄ›ðÍ^I·À½øK›;,BcýuŒkƒ endstream endobj 2187 0 obj << /Length 1428 /Filter /FlateDecode >> stream xÚÕX[oÔF~ϯðK%oUž«íª.¸ˆËV•FŒE.bLŠÅ»åó“³å 6'qFhãúCsp<‰@)gÞØ²7ºåWån÷TE\©®|¿“•ßÝleãWf+ýâéé¹_”æÖMm]”ÇÕÇö$KcËÎ/7výq.” Z$œãømÊÓåX@©Îÿ6:üÊ•ì:eÀ=¨i´u8 Áa޽=}XнNvQ«¶µ¡²ë}«š•Úï$È,‹Ó–áý¨v° ÄÞ.¬vkU²¿º3¬¯n‚˜ªoÒA¶j”QåN}Ãwî¬3rïWï{31Á[Ðhãaã¼ )Šdr›=¶ìø¬ Ê!¸K :øÀ²³> VÖ^µ·¶H±*KÝ8(Àê½ g¸ï}(!´•¿Uk+P&Æ(ÃG)µØt:´q š`gçrÊ'½ ´ðw§r]ö»àÂŒHVØåÙù“ß_ÍÉ$9TLdzNœK’e8UÂ8Õ€tȱ¸oúöºkuÝIsýQ¶jýÙséÄ8–çIåAX1QHÚ@ôúòõÕ¡ |R›ŽD  ^›×oÞ¥QwkIJèÆÖE$³¼vÑ«“?CòO„Q ,õ¬(–½\ä4~rõc0bâ ŠQŽöe[ÖÊb7g‰¯ v ý)αÙdæxŠ€â@·#i†/F~ijA£Ì4M*ÁLÔVÛÍw%ˆ1üM¢¬H*¼Ðgg—óvÙ ZhKö3F€©ìhêwØ$m9ËoliÁØ·P„'‡R r\Y%Ð-ôÚ_•»n•ÙÖ~{³U¶„ÙeWÖû] 'PÇé·)ˆ€r‹³ø"|]¬tS)_IÝÇz)¿ÈQÜó‰iœ!Ê÷~š3L š±y¸Ž‰Šb¨|¿Ì±á(#ƒ Ç^»—§çwj–CF³{ãQìkôr5›Ñå9Ÿ´°miîÒ•¤_éÀ„bß{)P(½ƒÉ©ò§~ƒãN×rNNA§£M³!¿²!ÆÎ"3ž! ‰ÈÕÙ¶žµ EB "½âÐ7ÝxaüÆèÙ&b1.,×gWW×ì×O_\ž^,/^\ÎvRþŠ£‘ìt4ÙÀ´u˜j\¼h¡ù4õ`æP«0+˜íað0[§¾›6[_Ü佟 ÂÄPõaF0: +ºoªÄeŸ?v¹=9‡Éf-oÆÃñ®—A¬^ÏÂÚ=&äo£ Ë+ùÆÇÁ¾Æ‹Ã?X„…ÙƒràJÿ³‡íb«j]šZWr¶‘e 8û,gˆ¶8Ô¾Œþ³ù#ÏXV¬ÈÐÉò‡w²ìV'«t/˜9Îl2ÕœßåB~hNîïcÐèiz+™àýØll>ÃS 2Åå9¾Â½miöÞ¦Uð €n„f§jˆDq,á ­´‚Ù"$ÏâÚ¦nß Ž3=lä'¹ê}A…Ãpù®ýÔ^¯[xÅúAÒô›˜mc¸üóeSªfð˜¹éC¿ÿ΀O¡Á3ê[X¥Yñßüú_> stream xÚÍZÝ“ÓFç¯ð£|……fôÔ=ãH ’Û]žE yÖÖaKF’YÈýó×_#´r–#/W«ùìéééþu÷ŒÕ*€j•êUš…~¦«òø( Öv·âÂÕ”ŒÛÀÀ3ò‡›GOžÇñJ~äjusë’ºÙ®Þx* Ö‡Yâ½~õÚ¿zúj½ ÃÐ{Ý™K‘÷KQ¯uæ‹ÃúíÍËGÿ¼–‹uìÇQø•¼ÙÑ÷LÁЀCË Nü Ž˜ÁØ}­7q¢½ëë+à)½ÿðçº:žFʦ?Ÿ¸xeþmʾjjd¹VøY$û¿ZÇÊ3øçã¹j¥¢½íw2w"¼8õ @o6eS—ŠæÓZ§ža¹ýöìùc.læmÔ‹ÖK mˆêFå~œ&Lûú4pEæv¿9Ÿ¾[o¢(òn‹®̇w]€„ªz'=Ý¡A†ïâc"œª®úèΧí·i{³ýÊ}2ý[Ãr¯Kú<¸Ô›Ÿ_zËR}óÓÏÏ‚ˆ¶‡:Pö~ ~ϽO;¨'o‘äji?‰™…,P"8T)+¯êø ÚÎß²4§¾¨Kó¤ô‰zަßËÙrC¿/z.;#dÎuÅjÑv`8¼Bm>‚U}eÝ6-@•º¾=Ã"õŽ[~âhl˜sùyÁl!Î?áIy«@ZyÀH‡¥¶±åB÷ñl̦ãH¶3fnÉZk_‡Ñ*b%û1ôY¥ɤ§-®mÛù‡ÀøÌ—ÕÙ"·O}ÍŒ¾Œøíc<\íŠáA: æSò<›là2ÙѰ;'J좰ýõ& ïEÏüÜ­Iï?ˆŒéTé ‡%CÈC? GYR÷tqhX™)=S‰mZT½?£Ø:¶€»ªßó Iè®e~ò0¹²#Pq–èDÀ„¶ƒ>/‘IàÈc‡ ¨ªN3ïïB-rǪÌO³lK3?ÊŠj‰«ØÀȈŕpDŒ[ ÅÏœ¬J}t¬x,LXQg¨%oÞ«-t¾ÀC¼£¡Ça“‡Õõ£±.M9i>ø(‘×"ÖÁ‘æ>œ?΋QÙty­AGE®®ßnf¿ƒ¥¡ Ì|.ÊÞ =öŒ[e!h£šÛÙ´Áoq•€d²92*½§‘Æ:•é°]ÅU ú<âfo.£šƒµaœ00rÒcKL8=ÈØ°ý‚±©HÑ"ßfm¹uXfnYÐD–EKŸ‰?Fs®·àÿ¨}Û‹J6BbÄóGa:!É}Љ@hŸ`Ç{C”4 ›FòZ¨†&@Üq ½_OÈ4ˆçËlþ?ž=çBÑÏzÀö²¨]êÒêœ/öõ «ºýèÌH·Ȧ¬­ïˆÆ\¢&â—Ù üÜ5-Hùè£PqêÙW] :¨KJê-$¤%õcÓIIK ðƒŽ{ ®ÚõÝáèE'{‘b騜ì 4+™WÒh®›ž (=Š•À Žƒˆa+ÛûIÌEcuOy-°ƒÁœÖ0–¤5zu¬Ñ&qQ»TkÊæx4¢ŠÐp®Eß ÌÂS´ ι°Áò|ot$àExJHVÌ-•øóY³îD|"4Ø6BX&ÆGÐÄ¡£{ˆ”"%I áˆrhHz[¡§ö„‚§Ä"620% Àä’£=` œ3œ[[s:¥±=ÐñEÈŸNmsj«¢_Â/ÞâhÏ!·(­+ÄA¯¹½ë«ÃA¼õIà@Ö&hß"îCÑîlbæê>t¹PÙùŒsÓÔ SŸÈãœy} Js¦›u¡Œ± ¹ßL¢n@n¦$c92Z¦¡Êˆ ¶Ã/\îˆ³Š“ÉæŒ£³€ãdÄG–+µ` ºOÛƒÆD ÚŠ[æÁ_ ½s]Ì÷Â(ó3­ÿ’€ÕXñS¶òKA¹Ÿ@¤01¢‹ÁÕ×ÄVჱU4­¢4XŽx öÎÓüÿ%¶B¿œ…jÁWñ_Š­Z!J=y}¿´=¥ü g‹röx /Xåì)ÊR°i)ØÆ1 ޳N–kdé8€\,Ñé¹aè™-HPd—!'•ÑÅÞd°5‹—Èí‚é:n7H ópÉÓæŒ°Ø+戔¨‡å£)(â™McÙ&K B?‹å9×çö]×ÁÓ¿+··El¶‹À¢ÂÀ×ù S%Ä*¾$9aäCP4ÝòÓí¶Cšsr\¨±,sÖ±‚Ž–K|¸8 ì¸Ä­îmW#3?UÅÒ5œ@–¤‹;ÄÔ îoQù©0´&×@Þòr6J‚¤NûqN÷;‹ã#eCðHÅnP1ª¦ ÀŽD $`áCÍjL°Crµ¯y ßé` ä.†Þë,iåJZ ’V¨”]o LÀ¹¯Xà A!j‚WÙœ[Ôc,WŒ•6 ¢]tÅ%Ö–ÒIÈFG(ÙzGÞèL±°[hÕ3Bö©ò{ âbÇå#9­N°“ÜÙ6N6Òúµ <³Ðê0ƒ×ìjäƒùB76‡ G•¤@”’¡I$†Š§)õ`Q`ÙePœeàw›a†á7M”´›‰lpµK§J´ {ΰf‡âJB2á '}®Ž `ï=^$—Â>þ©Ú^ŽÈ$Uçf„M6þ•œ€„ãvúZ2$·ÇÍt8&v `Î. €B¶ ˜§‡4"Öá0Ác(RrAå‡Á,¡3Xb$òÓ<ýàF>Fwêh¦¶yÏnòÐ{ÕôUI·ã:—;T,<‹n*Òì‰QZâhÚªäÔ,ŸÎSä=­(D ïL wnG.gQ*°…ÍÕ-놿v¶Ññ×ÍÅËÓ—Ï#ËèÖfœ @=™ÃÛt]õþ ÔûfJ]ˆÊ”ÇM0(cãoX‹•ZPð¶÷™…è‹¢0_È>ÛÇœ³å†ÊR„ÝNŸlpÁm®sÀ:óÁ³Æ|—=×8~ê¹&‹°õA³ìjÆ©,¨°Öúêt¨ÌÖÌCè-¤¶- ޵ǖ\/¦ªr M¹õ„¼Ùq oë Iy2ΰ{’“ZšD˜:®’HfŠäúYÏ ätZÊ{º£«ì+µÏñ¥ÍŽ ƒul”ŠÒi‘Ç@ Ø °q88nË^ˆÃ˜óਜuW°HÉÌ]QÊ'—™jG›Éäú)Ó,hT˜zgÛ÷ÆÎØ¡-ޤp½i;Ïp×j™¸ÛÉÑKÓàÞ rË@°E?··KnŠäÚÒ[Ûb¢Iºoøèy|Uª?ÌDýogj*ÞˆêQöœPöL¤ô Âá+ kuD¡O$4ÖÕ¥Éz# Ó1 ¿%tÜCÂñw — À "Kk6Ð@a•Y\ΰNxX‘ÃIC;`„Õ8©)b< (ñ~iZӌׄ†J éÈÃî¨_2=—$nƇUf ²}Ò(¨:1ÍÖàï M4}J³o‹#ò,uãÜ%ÞñCŽ¢Ò¬…U3HÍô}\(÷»w¬ašãcáäâ÷ϸ‰c?ˆ’¥`B¹1„²žZž3p{WuÆz+¾òU´.UqbQ¢(˜Òt]Ñ~á*À_i&þnB £ŠÝ¹•à Íñt–çîÕFøŸ½Èµ`rtõØwÛ6G?¹ ¤“s”Å·‹ûw¨/ŽôÛ€¦… ç«<þxbã A)¥³!ª$ò:šþDA£ÿA=—1-ù•)ôü•øþl;c ¾^GVÇðSòó4Lâ)}Ø>ô[ÚKTꨧ ‘ð·‡{ÖEØMƒ‰²þ)Ø:o£Ó|k+¨˜Ï¦Äó—«^ÔÆ_mÄs†=Úk_’‘M4t’ß¹4âwEû¾Ø™A!`§ZAö¦§O7°„„Óæ38 Ž#ßB"iÓIà=‹ŒÇ[­B­62û`Ȍǹµ“… d×|ýÒ1-óÆùðûˆÔÛJDßÊÜb®Ž•ž¦½üÈ– ¸z·¯¢*èä-‚Ò ’õ¾Ë O:nlËMý¤FB;Glƒ\^2pÅ ‘N2?WÉ"Ü~©Þ~Y¾yÔ¾J†{è —ŠúeIéÅ¿Z˜¨?ÀíåEãÔ×é@Oì£5³e/¾~Ì@92@1È„ýòÃÔ`n…\AØ£q_ˆØ* y½¨úþ À÷¾²‰xèü.ÉæbÆ‹ÏÙ?f.>Ç÷‹smßCR|ǹ3ATä ò‹c=>…ò›Ž×¯^_½ûíéÕßÖø+µQ_J%Á—C?žü¦Á^¥ç¯ïéRJˆM8Ñ™G-âäÙ‹ëËË$À\â%èIƽÑ^úM„.~šÍLìG#'·5·¤P|“¸ ½–E¬À|{Ÿÿ_36Nà endstream endobj 2125 0 obj << /Type /ObjStm /N 100 /First 973 /Length 1553 /Filter /FlateDecode >> stream xÚÍYKo7¾ëWðØB‘óà0$5ÜK ¶ ´5|Hc¥p›J…­é¿ï7\ Ñc]¯Ü ³»ßÌpžRcvÁQŒä"+“&{Sg²7щ}–”(‘œT1B‚ DtšÅÀäRÔÞ—šb—j6Œ¸ÌÅÞ€ÈÕÞ+Ô´'W Ÿ²«•À÷P ÍÁÅ>À¡;æ:ûè É8 £ÆÊøÊ¡-8“Â©Ó ËÕ QXrÌ0IñsljW%¦Xs€/B6‡Hs†™ ¢&²ù¥•±êVWA5³2Ts[dPM‡€CÚêÔ\Ò,‹”ª­j27däN d”búÿj5iJŽ7*;6ƒA!JÔ¼š¨l+Á?æX„‚wŒP œ„Xl9îÇâÌ;pçØÖ®  4jŒŽK0ÞÈ $ŽR,l®ÄðÌãÚ|liÑÅ Á –*pˆ4 ÙCÅÖ O mïÀÁ~ f/ÌiN‡—EJ6ŠÌ#“lÉÜáeH7y°W*5)â4¨E9;µõ(òH)4iÈUjr |Î-[±•–Qœ›ÝàÒæ3¸D³¼ >U@ Td2ýð²æfEo©MÒ?t¼”DÓaTi©P%ñO±ãU—¨y¥•˜LJE5Áp[5™zBÙ·JeïªÎNNfóËþ^¸ù›·¿/fóïVËõb¹¾·ü-¨òóÙü|q¿úx÷nqß]{÷ãâæöíëÕ'wðB«z‚—p_êõ ²î ø:ü«år¡W]×À«®kq={ùrk 9›_|ümÝž¸]þ9›¿^ÝÝ,î:máÚÖôní®„’È ˜é±EUx³¬x) Ü+wrâænþýêråæ§î›‹õÍÍíýú[­“gó±x±„,ì«u0UÏLcužº+êúè¹›ÿü˯"sªpŸ[~üðáúK8U†»ã`Lž¥ƒ@½/Ì00d?B16Oh‘Ï$ñÈ÷g‘/IŸˆêð)í¹û Õâ uW:ü™mr7ÅUÙ< ^„žY?±ÍíUíi#m*Ú~gOP4s·zw±@f¢ŽOÏÜürñi½_YN=NÓ |Û+42«÷phLž±… áf¦2 ”Ê>£å µx#‘jñAë˜ï„k'Þ»qÝŽäN.L+çð¢ÄŽíÛ˜†Žl×d³Í°Ú6¶ç(ÞvòÈ×,½­óüíúvõbõþÅOËÛ÷«»¿îš(§qé6×É­ŠÜ©TL–‰úâÛFÇ wlç&¼Ñ† ›'Û®?Ë³áø¸È‹F^èi‘—rPÐØQGyx—‚úÒ0ÃZv ‹2B5ÆVO! ûOR$“8B5*Ûs­OÝ&ôý/äãnÖ}Î¬Ý œœgݪ÷ò¬gÆåÙÜäJÞöÕV€¦»ª§$õø’Tžæ‚Çf «ÐsÚÝ3[h:ÞÅ>: L%aªO#€}îm{@œ/}ÞŸÓóñyá‹ý`'ŠÛ¡ÞÝj¶v¨ÉN|à𦇼‡ÓBm”ŠTo×#ƒ@N8)† óF¨ÆIß眎:ì•Ûñ~|¬œãžI2éñ19±MÄ)ötá8”p @±!¡·{ìYÕ‹È0jôæ™a Ff»æ{bÎL!&§IîI“üÄ4ÉõàÀ‘ùá¢(— qô„qȬÁÚ7Æ9»«ÛÜ1Büô#È´»£q²›iÛ–N´ úÚ± àðlw™°×n‰a?NF*8ØrÿìòôüàЕG–fN_}TÛ~''u¡Ã¤.aRRo;¤ÄqŽÛÃibo?Y ‘Ð5•a £ÙÏ&Ã@œÒ¥÷npH1x!ЮɊÐ×>!MÏ„žöVôøLYB{¸”²—Þqc*PsòöóÀ0Ю۳þ¿7£ª‡Ñª|ôfTéèÛ/²«nA³>×êØ~8¨¥;I„Òßü€÷vµ> stream xÚÍYYoÜF ~÷¯ÐKmÑhn©hÒm‚6i}hC^Íî XIŽýõå GZi#m#ÏAqÈ!ù‘Ó ‚4Ð,Ð1'1×Áª8ŠÜj½ ppüóõtK \Ž(:9zòRÊ€F$‰œ¬Ç¬N²à¯ðÙ6=oM½XrÎCùýb)„ 3í¶Z,™³Æîˆp]y’)M¶y¹ÁyY•Ë®Ìa¿À…:-³ªÀ¯.R…i§­>”ªX…”ÓŇ“×G/N±%“D ~O{êOU¥$‘’õŠ2E")PѼlöÛ°+»ú´iàÇ´§«l¶E•+Ó“—*ßÈK”°;G2B2™ŒÉa Ž'zÿæýq¯ßÇAh¦cÂw±8±"ÿõ! 2Ø|DDèàÒQ'L[f»àÝÑ^¯Éi,f„ÁÒD¹ß1Ÿ뵘\§$¦I/ßyZ§…‹7sª(F´=íwhѬêÎvf޵°¬ãžüåM÷𘮑ú³'ž¹ä ì©’`I9¡’"õ;f\…Ïž¿ÄAê ë¡q˜²XjÉÃ?·¦Ä0,ˆ. Û­Á¥sGkêõ‚†àªi¹r:¬ÖH0P¦»MUçí¶ÀiÞøßåª6ic2œž-€Ý5Ž×骵áaÇŒXÕ@UTuø¥²Ô—ö?8„BX8Y¬ŒZ‡—(·ˆ½ 0ÉÍc‚,oÚ:?ëÚ¼òߦµßZYæÛ´Ü€¨xËjj N¸Œ1Ãj»9 †Cóø/'æÙ¦ :I[aÈŸ9Ø08éÜ}í·yØ¡!2@¿±Í›1Xì:³¿BE(Oð çfv»Ö”Ôiñ#05Ù«¹÷Ì%„B -#”êÛ àüq!@‰˜Èø!ÀrâB}E°þbÀDäb2Òg©_À = Ø„&}ÜØ¥ß-ˆ0ž _;œæ€ Ks1Dn_CŒép $.ÌÜÁ"&E­vàc(´¹jkS˜Ýµ»:·l®|ÙU69b¨-ÕØ^z ±}Aø±ƒ{qëñN»¶*@šUºsYÈ›òQ6§€WYø*ÄUŽvÅËx§ðMŽŸæMßÓx·•çhÕlþe_Ò”‹Ú¥½IìÌ)vå3 [4ãÍ5Žwëf®|‰÷Ó_ß½˜sSU ¡'›‡¡ï0taê|}= A OLÙ} ˆÝA2!<ˆ#þþYUD¨Ð Ñ:~$Ò· Ð@óErM”ŒgÐgj3.4‰"1uùOf‹ùG5šRP·±‡0pRÌ{ãÏ/ÞÌ ¸í/Ë¿HÜÎ(!d¡øÿfŒÿa¯ƒlÁ4I’{X_ìj[¥JÖ7ƒpŽÃD&©\»5jEíôr›ï ›´8ßyzÈå—$Bû+ÿ9Ö¶0XU%V›þcD§‘Ýã‰jR@[1”WsŠ)èż·Ž‰’dèœ~˜c#¡Úú¥ƒär£dÐïHq§`ò>‚ý¹,TCw‘8–“Ä¿MÛ›deѼ@è¯)f Èùyµƒ9ÃU,Pa¹© 3w@¦½N³'Z0¬á²ØÌÍ0A¼ ˜º†D7§AD”ŽDÁ!ùd×⤭fS|HÕXN_ŸB°Ÿ>{ûæù«“WoßÌH™»%û¤æÞo†·ú>­F{ñ„ÆãièAfÏWÃËCê+õþ ‚‡E¾Ù"6¸é6=ï+ßw¾Tèß3êª+³¥/Ñ\²¯ëª>|4Mñ×Ú\> stream xÚ¥Z[“Û¶~÷¯ÐôIšF4Aðš>9uÓ&“¦­½ž<8;®„]1¡H™ ½ÞôÏ÷ÜZ*N'³3KÜqpp.ß9ZÅð§VE²*J•ºXíŽ/bjV\xó÷JÆmaà6ùÕÍ‹—_gÙJÅQWjus.u³_½_+l¶I¥Ë|ýîûwÑ›Wßo¶Zëõ;k,¥ëÖÝ&)×SÝnno¾}ñ·¿]–dQ–êßI›ýŒÀÔQ :“<г” Ì"©l³Íòd}³©ôúÕWßaE¶þ/jþ@_Š}†«G3z(ªõž›ñÀ¥Scvæ±±2r×wv„3ÂБ[õhñ¬À»2ä]¼Ú&q”%š){³ÉÔÚà¿S3H%Yï¿”¹3¾gE”Ã4ñ߯¿þ‚¹\·-3¹Z“b½«¥n>ƒ9Ö2l7ÛþÇXi®~Üdpìv2–ë÷ýÀ…ñ`xúX7íâ¶DÇV•Q•TLÍ¿NcÓwuûY²ëÓièQ>5Çz4r‚ÁÔ¿s£·'Ï0ú÷yF½5ãv:}¹Ù¦iºþ1Îâ`’ž ¬xÛI©·õñÔ6ÝÍÉÖ÷µ'u|›M׌Ÿ%«ëGÞ­ÍÌÑtHÕhöÿ×N÷†E¦ÛÑç³›¾õm]é[Þ˜*Ù-_öû|÷:N…K=ÔQ©[\nµM“(Ï.¶¿Ù”¢DI¢‰« u-PuРÃF­ÓY®Š‡÷<¾é¸ƒ7½õ‹(é–yuÇõz·3'Юy9˜ŸÍn³-k`‹¾»²d¹´5i¡¢²Ò«ØS–9Ùš(ƒ>0ðO%dtæ-¡õqó·Á æñrêÓ÷*J˜·ºªxE…JÉ-½ÁSâè[ÈT%ëSý€ªRåë$/O¥Š$*Êr•UETèì3ÔÞÃÎp¹(&dŒ`Þ¸4Y² UA6öf×Ot½møÌØÞß»©†ÇïûcÝ,wÂ*‡æn:ÏoXCz®Ù¡<1Uó¡ˆL¬=ôÒòl§»††f»—ƒÝ³p¶È×ßt¶ÙFDÀˆ°æúLîqû¸…Y’¢Üîeö‡É˜_e©û©£;¥ùdó¸ŽØ6¿š}DG‰ç¢ps ·iQ/“u3âW‘‚`ÝÔö‰KÈüN õÃðHâ'M݃‰¥ž’9;!ŒÍg%ã:ù'W)lï¨ÑˆÝ¼ØKŽ .ŠŽÐØ¥£ f?íHvçt8Ò'Þä­ ö1r8âÙvàº/˜3u P{䯏߹ÃÏ,h&Z}Ùï,”¬Lg†Úox^‚Ü$\úÀ|"J{žÓ;?Ÿ £c™5°kœÈKpœ wÖüië‹$Ý—§Äº/ø^ˆbÆ¢H#ºöIÖkƱ•ý %Gp¬“&wDÙ¹\ÜyùÞ:>ÖÖÃ{ROp 5Îÿ¸¡é`­"ögùehÑHéH2ÊV» tKÈù`P’ºõd+tĬ%*ª4ºã Ä{=9‘UqTšŠ]¤©ØåtÒ °S¬™CÁ.a1”q~øÅ^¨Ih°¬ %´èÔä`êöìàrw‚€³lÑ2å°GÀº*xètêÎ% ҙ̃Čf ¥÷#7±Q‚¦¡y88«U9”G=‡à¹…­mæn†+$y*¡I¢¶b-§ÖFVëúõðwh—4}0—ˆ^,`}qdëN¨ø½ˆA„Ñ…Þ/`e <—óÀ—Aãå+Gy"ÅDž$ß§i¬IÔºöó[Ú†VqAf˜è!bÔdI¨a²Z£rRÂÇÀ,]lYFYá¡™ŠÌV%KN§‘ε‡>8r^¯ˆª*›©Á×ÌH&uæüƒ–ød˜œ°kvvØÃº 3,x¯…•Àkaµ‘ÁÔc€UÒ=øþÒyÇ åv±à/+@ÀUM8öû®Ùy9ÐeÂ̬â$Ò*u|LÏ¡‚]âiRF‰*Bžò¤eð5‰¿7,h­ÁÑV)ÑV)Ñ0ýXcH#ƒHÙ p„XÀ5’»*rBaÙª F ››ƒÆh€¢ZÍôGz0§IXaëx ¥™ ÓºW Q§“ôÑ$$mCÐË;$ìÐ7;zÛpþ‚CŠØò½’Ûp™Y…]ÛÛEm"áÁ –<"WSp³/ÖL w“è  Z¥@]ªÜ«ÕŸC¢¨HüåÃUóf‡Ò¶ÃÔ.®¨8W¿½8µ®|ÄåâªÖ÷qí†ø¼,Ü79jÇÚô9kv ‰,FDyZÎYhÁb pR^whå\È®œBÏ‹¥K<§Uv%V’¤„kØú(cX¡Éøûb*ž‰ w<špÜA ®sv6Ð:oT›_ 4ìÜ {Ú¤,X%eå%˃ÙMƒà®ê›{ng€„“–¡-7È"¡Ã*ÚAì'¯õ;xk›;·-¹&$åDÄ\3@)â+"¬FoŽ»}ZÒQ@kHq3ÍhF«XïkP﹓|ÝZÿì bûqŠ•Ç<öÕ›·b¡Â–o¿§ (ñ®ö¼1Í+ÐÆvû¢å6Êca ÏtKg=ûU‰'‚û&(ÎÃ×ÑüS€3¢úÄJ€vºã+:< bo} ¢+Ñ0\‰_¸¸Ë``yo!c`Æ-À$. ¿_ãV¶hAyŒÙøß›û£³vä:0ÂXäS ÖH+à«t°2ÈÛMm=2‚Þ‹TZûÄÍ:– mö<^R‹\¸1cÐ$zTO2 Ž ×ºŸ,™ Ä> ''ƒ´âÞØfpýxBɃ‘Ñβ@Û-ÞI£-Ãâ‚å…0=O¡ï– ìããô=cm'ÜBÂ97´kè[é8Èä̆Bh8ÂÂ÷¹\@áÜι€BN.áÔ¦`”ã¢Ëèè™±Î}ªò¥_z–Fy¢ñyºžAª¹/­íê Õ‡Ó¹àõÒ**JïSCÓ;9’g ݤÑWzùŠKÔË÷ƒ] _¦|”¤°½ž'}.Óñ•ð;è®b̪:O±¥XH, .ÇÕº}èP¡£L·üu˜·ãUˆð8 ¼4žO»°KêeÈÚg*ÈQJᢤâò”Ø´xJìàà æ¸„¿;jØéW!)542rpr‹Ë¿]Š ø(-=NGê¼emVKbTdÑxðD;_¿íyG±bCúÕ6ÄŸ–ÉS¾ÕÊÝ^¹6‡fFŸ<¢ç”ÁÎ-©B–Gç ڳŰ"’sHâ¼P£‚¶óJÕâJ / ±5õžÉåD>Jµk©N]„ …˜€ŽaG–ÊŠ8pU¢g˜øŸ‡!4Šï„¯/É]jçÃu邿ʃé?+V… Iý` &{þÅŠÓüØä—êCañ U˜KCšeÈXßµÆ^ñh~aìj8{Rf.`s@¦Ì}tTr°‹ß 5z4„ 8ÆÀÛ…@K޼(«è&ïme&Ñ`Šg™ý¦ꢈÒ,”ÁEÁQ‘>ëÞUÄ—¿P¹Ç‘*Õeˆœ¹¸ ß…*ðMÅó·zn÷À¶qæúî(:ü£n ä9¹8ȳÕη†+¸K ¶öïl¶Ÿ?ö!>¼ #¾ÁI+Ü÷­\³•†3ÃÎÀhÀa’ÝÃag^¡•nëÎ{» Óeïa­‘þº%QîI6d¦GcR[h=}$_¹0»â½žC>^3^aÒ<áJÙk㜚Ñ]޼’0œ4|ÚbÞÍuÏ’¡"Ìóz|×Q¡DlþÑãÓùcð ßsù5K‰:]€A¾Ìz%`ç&N³'d|8úÁr±aÐüÉüp,šËí5·xÿ‡¹@h|×â üàK†4. §ÞƒÐ<:`;/A ‹f‹Âãôœ%çÊ`ÑÎì¦Îì"ˆÁ'‘úœï«Ý F@y¬TÏóXØAÔ' <@Á7·sÂ0uV€ü†_¢p$ùº1,Kó³9Ä‘S×8‹¸e0ìhÈö9g|`ÝNà•òÝÆc'¥‹ S‚ ôŒ—:0ƒ=Þ s•@ý,X(/ŠŸ3¨EîÖÂUØÙ29±aÐÔ´ã¶é¢Àù±)d¾xÖDÃÂ?)ñOT>§Ÿ/¤Pæ¼cRø×I(Î.™,O ò‹7ÒOž‚÷ŒÓ.¥¿ÃÌ„ „™ÙÅèåü¸ƒ6„[ñW'26Ýiº´4ó×#÷P/¿W©)k#ïÛü£µNÁT€®+¥À€Ð³ûûÛxµ‡N :ôH#+ ø =d»zûâ?KïÚ:-¢¢€•Àëåjþcù5È<` òíI“’|9ßîmE lŽæR€Ms)@c !9 þ¾CsDز°—Á™öÐO­Œ±.,hîŸ.¬Mðë±6 ·W=á”$/ÙÒ'¹ø;l¡£ˆÓ‘œ}ÁV²O8ÎÛ'¬ì \c¿œ0/¯%n“8‹”òðfê¦á'Ä?wûéYR³TüaŠGÝ;ÒÜÈ RrU¸Ò24¬X*X1û#²•Vq¤«WÊ‹ Ù’ß{¤€¥qÈoÄó,pô`ÊàÙ€M7ž€’“zVèùA‚:4ýnêYÀðÁkh–Î'îë©•‰Aäåž2–j™EúœXÿóË-+”ŠL/æá1…í!¦OmCØUùEjsJòÐö²…l†’¬±Æ|š´4Òpõ  N³U–E9¨ñ¸ð'Œ +é¼Z0&Ê]•Ä_µ.1¦ä'ô ŒUŒ¿``'§ ¥8Ì+(ÌCÄ7Ö¨{î{·ðÄÿ¯£ÒÜ endstream endobj 2212 0 obj << /Length 3295 /Filter /FlateDecode >> stream xÚÍZmoÜ6þž_±è'ùP«â;Õoéµé¥È½ÄÁ}h CÙ¥m]w%G/qÚ_3R+É\; Ü!Ì7‘Ùá3ÏË6ücÃ7ÆŠÜ ³Ùž¾µ»ÞPáÍÏXwÏg#¿»xöÍ ¥6¬ÈË¢d›‹«ùT»Í/ÙßoªÛÁugçBˆL}{v.¥Êþ醛ö윛l×cÌ®Ú0äÚ5®«†º¹¦zÓ6çcSCÿºªÙµúêã™ÒYÕÕÕà`Æ´Õâì·‹Ÿžýp1‰­¸Ê•Ÿ¹Ç8ú‘Z—RÂ~u^(I›}qfEF;ÑÙpã°`²mÕ‡R{E]UgÜfã~¨¨ ›íª=õïê~èê÷ãP· ½Ã¡a–› +g-CKßõn qíÎ]Ã=uÓò°nÛ´CÛÔÛzÀIþ Ö_ Ul«ýÞíP›s&ýϙșb´Á~ßÞzQ]ÃYÄ}ºÝã\û?¨>öÁzÒË“îô\wL¹±ôíg›±»ª÷ûKØÀ%®æ¤Ï*gÌæÌ²øÙ¶=ÀhQ”¾wŽ–uŸªÃíÞE?ø0W ž‹²ÜÜ”°hÚ_~+6;èüiSäÒlîüÈÃFäÜ(í7oŸý+e)tÿa*m‚Dº@xþÝ+AB½']í[Tój,'Ý Y沄Ã;âLÍ>FK*–mÁ30>|7tí~O­dVÅa·LTôF…¿¡{„Òͱ‹g}ýg´ú  ~!sÍyÚË›GÖ’&WJ/üÙ;·/Á*6;*¡Ññ/2&´µã:IÎ ™¼dzé/“Ø8yàÞär툫ý‘Ïù¡1¼CdÞŽ{ à;"7S”ŸQ›—èÏ,ø3ó¶T"Ñö1NAÓºˆÍ24?À¤£rZxÈ-.±òÞ@^àS eÌÁ:|Õ9Ïd NJê‰V³x|Û±ÙUµ ½¬Æ\Õô“'‰ó)"lOóàím ®“ö¸Z¬<”Öæ&7Šß×¾ræž*‚ö±e¥}ìB—'QØpðªñ6i ˆ\—Fy6ÍÛ¶ëÜ>†a詛ݸ=V‘¨“i ok¶Ž¾êÈ &‡¥ýpJ0°3èû‡eQ¾(-¹´hlªWã§z_W>ºCuJ%±SIŸô+Ò6T?Ö}p¢B?³KPBkŽ]s} ¤‡çZ§Ì)@Í…/¡_·C½uñPRÂRªGø±í†`e×6¡T]…Ì\RF*Wþ¤Î&\'·—Úš±yQ.Ér°«4Ù?B\$þæƒÑ×ë´ Åa‰ã –ýe¡rÉWqÿîÆ5Lõáàvx7¶¸ÝºÛ\Îw‡ú»zd!ä’-€ê”ÁÁ¢!¯­’ ZÆ¥HáÞLJ˺Jc?Ë [Þ3û7/ 7-aœO!„€CÍPhïJ Ë…“%Œ,»rÃýMr2¤_')ü×Ú†k™w¯ß½¹üùù›¿á}ÇLìÆÝÑçºXÊZæ–M1]0¬R."!è‚óó¦Âd Y¸ÍÕ‘qzQ¾ùö" ³ÈR²¨"×BÎda)õž#ù(ô’üH7$bÊÑÈí«®:88 =u®o£Ú.OéÁˆš¦¡ËH÷‡µNS®°Ú’e9+å©õvÿ†ƒ—EnŒÞÈ¢ÌU)¾ð†c±/¥·9N%”¥Uö¨¦Jؠϲ ÆfJMlEC­Õ‚ò‰»“>ƒGàxÌzwB“Íhe÷ ºdbáïàŸrߦ„— nÚãóé1jFz0JDÒcô Òƒ&Üëi ±;èX²;h˜³;ØžØÑ’naLH}ç<2‰fôÅœ¹ˆý`)y™0xÀ@1æOº÷¹ôLÍßSXø6y"@zûy'bvQ’ж€x!CܰÆE° €¡âˆ¡O „ð…y2,ä(ÂO5ÁÒ_4äi|³J©S+dkVSŸd0ç9ŒK—Þµ#ÐæÀb0\‰¤^?£ðÌX½ˆQo ´ ­‹G[wêè©‘˜ (s‡!vòˆ ­‚kB-È÷ÕQ/ýp› 0ÒÌLúr»“-^¿{õêÄõ¥fÓéÌ&l® »±@$ôÕn܇]ùìßosqÁ…MuÈ8>ç•«r„ºE“}Ã)ÿàGWº†!KÎa&/á›'œ!¦D.!&àTFéÇT¯Œ\Pî£WÀ¶V^‘ÓlˆÐ³hnvd Æe-sÇðèX* ¦r«ÊÕ V¼Z°ëGî›Ä=©)5$5¾îÐEüTÆÀIÙt D‘~<ʇq™#ÄKñYÀÜLYgJ"Wâ³PY<‚Êà 8S…}*+>/ýT8ôÊâˆÊ' "Ëgòþ1Ï.µ‡IÉÊÌ;Ð=†þžþ.}Oòbå{= #…ðâpÔwM8šÂOc=*œÆ aðA¯'. Ë2O±²€Ø+Á¥q*‹>ˆóyú%B?ÐÖÞÇQ¬\w®Ü´û*héO×µñ1»°¹)Õ"N=WKñÍ ø,Þûö.ôTS!^¹éKäæè• er©ax[‰ìC?íÈþ&•A~Uþ(k~ „y„åñúËÄ÷¹ 1Êoxv¨¯oâó6Tg\˜Ó+kRc0¶< ;ä{ÿ¸ ˜‚< µò¿1ê3ÿCßN×óëø^è«Ó%;ý‹ˆ~e¡Ó×``Þꪫ¶Ç ûOêBèÕƒ‹6¼Èé½@Ølˆ¢EÄ‚R‚WrO|ª˜.vúöàV¿!šŒs:-˜BfúhÆûˆAêágX óY!È‹«ºô™Î kÿŠ ¤U®Í†qíqìI@g šŠÅ{ÈÿtZ‘þ:©|<‰2g…½w]‘±‚¹I­¼œS[-ÔüÒ†—:b(UN\Ü ø›/»¸A…2þ8Aû¬Ú}+ÿênŸ+ê@Æý5F‘B¯¿÷b<€x©?£ø8 Xu¨†cOÝÌ6Š¿<¢·÷oT i‘Æg<<ßLJ9ÉéÁŠrƒ$FšøÐä¿c÷Ÿè£ãO© å %™îÚ¡¡nhDümÕçÔuŠwAA_…{˜ÌKÚ¯$í«CÂk?ñOxÕq„f(ˆ ýé¦õË.µÎßöY¼‰Y⫈øJ¿cóø|ç'Á/§bÍô–+fo§òøvRÓáeµó//ê˜zÎ_KCÏÓ°þ n‚[ÿ ÀxóS endstream endobj 2218 0 obj << /Length 2978 /Filter /FlateDecode >> stream xÚÍZYÛF~÷¯òÄ ¬6ûâá}òÂv0ÁÆðÚc,I`ÐRKâB"Ç<<ŽýVuUS¤†ãÉb1jöUGWuôÈE r‘ªEši‘ét±:<Š}o³]PãÍO$Ï[ÂÄåhæß¯=yiíBÆ"s¹¸ÚŒ·ºZ/~¤6K•ë,‰Þ½z'Þ<{u±ÔZGïZ×`ËD¿Õ…Ê¢¾Ø_ü~õó£W9«¬°Fß“·0û6ƒÉBJ‘[«ƒ*±5Ä`Yu¸6꫾yßöï[×½/WlšbÕ•u…|=y™Äc9e®EjR íwù-¶1M³ùxšʨ0 ð&Èøq`\ÇZh•{®T–#Û¿þ/Ö0øó"@ãÆÏ<,´P©†Ö~ñöÑ?Y¶ 5§B'v*àë‹LGÏÞüÈRL”¡¥Èdø».šâà:×´s¢$J¤‰ sÓ1®ëþÃÞÍmmpë–M¯Ã¶ü„,¹Š‰xÅ_Èv•¨M4%#Q2/ŠÀì×0ùùKjwåÁÍZ¥«›µ±©õ˜XÀ6ãÛz³+•Õ*³o» _ô±Íw­ºpî?¾¸¦Fé“Ì&«âÄ]J+ÒŒ5sy¸¾°2ª°šîé«ÖzôbV/7ÈŠ!­¨,Øv*o2í5j{ð`ñ·ª;i]Ç#ÕÉšu‰Vñ¡÷JôC5а6ú[uÆýd“´(ì_´mpk¯ cb"ús·)ú=k¸ §™LŽ)Çf=³H S!³TÅqŸ#ø,3)€ÕRIy'Ò÷­[òN@0ñôûA^¥À@y¢a2ØÄw€¼J­È3 [i‘çùÿäKÆ·™½•ß«;Ti€ÙÉœy — (ŒnÀܽEbòYÂÓ-u.¤¤÷0'cº:ÎÈæì0( /ºzóîÅÜÖJ­•%MôD¸ï0 ÌÝ•~%z¸Šp=Ÿß·wÄöÜ…«'ǹòª×N¥¡_ Ò6,>_8PGå·ïbðééé%xzÜÍ¿ Å#  ÿZ8ä_êÆùøŠ-Â#!˜rG‹`—š[¬·¦ãýn¼ƒôœñ”ì5g´·ÌŠÐvEÑÅI²¡“Ñ!¶Å>ov †¶¹Û—èüÔT˜HS­}€«ÓÑJ%[¬™¡–æÊSŒ8V˃ó\Á\ ™©ª æ¡üÜyÇ^ñ~]ÙíÀÕ@œE“†=(¢„®]Ñê &ܶtœ"GOAv„½Yi¿9¸¸¨Ÿ‰.ð¼ò^Ѻ¥ Ä¥psÄ)27`À=JÓda²\Ø4ý®#70(¿•º`ØoË"‡­Ï+R§"±Ù×ËL‰$ÏfrH±h{hÛpÉfý9f2ÞŸ8Ђ±3‡ ƒ3G@ô’Ü”Ša³¶Á›c~QÓï5x(«Yä`4LÀ«oîxk¡‡3GØÓ{'ìB :rE5õxßûÃãéŠ$Âø¤E4äFaLƒ±÷”‡ :$Ì~ e©Ðâ,µ£$5¸'ÏtpO~AD×3÷Ÿ¸°ð:‚_Ï4Ãð\ÍYW–¥«9s9 •0fH)¹äÄNƒê$éãx8K¤¬TzXOOü ŒÏ»k9êã åç\J*`\ží«p×$*œ`˜€Æ‰a$ŠÍ‡û©é}Õ\pÃ-í½ônq\{â¼ÿ™àZ©c’7›ãIaì$IrÖÍDàŽm0QuïvƒœìãPþŽ´©Ò (?‰ÉÒõY@ú’“ò;+;Qˆæ”›o÷œB$hQñýýå«——¯.¯þ=G#5cÝ#ÉAc&g§ø§î<¿OD3€h|ýÍ 'E<ðë¦pA¯ŠjëB%¬ÜÅ=\­ºÓÕ~‚€£¨º÷þàõÚÍ9 ¥,äƒùCÔm!•O%üf©ˆcù]u[ùb²iSp€}JßWm¹­ÜznsÈ*¥°rš…ß©T›“}Ýûª`*>¹ylEFs:…n×8n†â¹,Ã^®îÆ'n{Fn?ƒÆ"¯ö6ÛòÄu 1±v¼QYÒ<ì!º ¤ÇwìB™ÍÓ­îÐCW޹ŸëÀSI9Ñ­wAÁÓkjc'C‰|V»©°:ŸYߺ“ŠêÖUàÍ:ºœú$ìç¹/q\®oÉj}{}Ÿ@êkÉsqNqFJÍy öx0!ôŸ¬srüm§ßn]Û¹Ó p\±e3»¤‹Z;V0ƒýƒÉå¾=+í©¯8ÁÊ6ó*ÈÁ¤w#¸#•ÞNI™‹,½W:u»žðW?Ë)8;ÙÐ<ËáV2MÿžåPguéQ=ýú»œ4"Î&ÈC•Ì¢þúúX“‘é¤È„ãdÈР» .pád__ ˆ[f·ŸŠäPf ÕÑ,zB?__ $=ÜœçÑ%³K…¥¶›¬£Þ«âÒÓ¸Ú4ã Îû6Šé‡Ã|! bÛQÙ( `s‚* 9”ìðÃ?AñœQ•?çØ£ÞhKû£fúöï—øI‰+ô\S‘–³˜öLµ5Àiëš•>•üªªÖæNA˜KÑã"ÎIÅJe2¼J©hU´Üª74ä·Æeǯ:áÛý\ÏO©žóK|0N FFê’Ë‚qmߪä̃¢¶ZØLŽ<ãíkf’XdJ.$:h@­ïˆ LbDfS¿Ubôøugî"@¬§emµ¯[>[‘Èiürïºr9Z¦4ŠÂEê+ è”qûájïÐÿû휄‹[ï !o¿_¤8”f¼ÆfŸÁ3aÀã+8?½xõ#±ÄY×™ˆ}Õñ©ù|åZYð@éôšýäã,®4V}Ó¸!‚ŽD@sYy;*‚¾¡)#Ž© óɹՓÿA‚>Ž©èƒ"»1kƒìr ï.+fÛûxlÕ›Ùˆƒ Ô5ÍPw;-¡ìëë%´Lg‡½$n*°ñpxùÿ û.G‘ endstream endobj 2224 0 obj << /Length 3376 /Filter /FlateDecode >> stream xÚÅZëoÜ6ÿž¿bqŸä^–áSâî€\›¤.pnÏuq8¤!ïÊkõv¥­qÝ¿þf8”–’i{§- x)’‡óøÍPbÁáO,¹HRÅR•,V»Üö6›5Îß½nÞ&.½™ÿ¼xñê­1 ÁYÆ3±¸¸öI]¬nò}W4'K¥Td¾oò]{nC;‰%KâÑy¾¤øPVèkÂf Ìæ[y~ JR+–)ó´Ò§—8=óPëU¦~¹CõîOD„+Ó‘å­ßá皌ڊ¿È}á!ÛжmAÇc©£³šÆW梺Šð¢®V¿êJè² ì­]ÕŽLK/Ù¹Æz]¬Ç…ì µc ¿î^¬¡a´®ß[õæÓ=ÞÞI›æª‡v¦ÜÎT`gÔÝö«¢XW¤ÒF›ÃyÝ×T‰GÆ Ãèþ34Uf¨‰%ÅÓÔÙâ  Ó£a`ËqÆÈHÉÁW‚ûà¸S ¾.®ó~Û9´!¤3lÄç<´¤”þ,ô&iÌ2˜ý”7ÁàS=îKDš ð>Å•ü™Ñ ›¯}&*ºê›¦pް堳ɚéëlêtÖ8kÔZçPÄñßÊÝE;ÄÇó' ûiq!y4.´Ûz_„ÑÄV“ŸdlXœ,ŒæÌ$ñ³¬,ÎX‰”Òâê¥2LŠQ¹§9­ôe:]ì"MŽ9K#$L'ªY=rf|ˆOj|jXjD òÈ,¶Ü“n©ƒvfÀ†žï¿~˨õzþNÈE ÀHÊŒlý-Ä“a‰%“¿¼ ÒÑ~Šò™e7ÞÀEøðë$ê}«} &mº®^æhÏ·(o NØh¨s|a8òn¹]]Õ]]ä×1I3É,ÌC scû2V>5eO'9dxé£[žHîï²WH½Ž”Ñ…åƶeÛQËf@ñüÄc·øÝ”Qb®ññ ¾¼ir꨻T°çx ;þ:€­Æf´?@ ã¸ÈW¸Ä =¡E«¾CÞ’ÈIY)Î=5€˜:é”[çU²‚…Dl€a¾—#ózÏ?8uÏâÃCö$f<=Øu`•”ÅqXEÎVQǯ²4ÛÝŠâÀ2Mu´.~âBWxޏmTBÛ8HÞ¡ ÖI¦f.ÀוñȲ¾íèÉ!3zhë¦#4èIw í¦ÕÝMЄÁÉ i|°¢*6hv6*šL€ ¯fäÄä¦[ƒ ìq §Ãµ˜@ÚÈ ­¼~><ôL'4`+J“)8,¡Ÿr—$2õ™UEN¹ dÆ“ðH’б' ÜÎ!_`Ýàü`¾ß—Õ½ (Þw°·æ¶l9B‚c™Å­úÀýAËÔ`ÎiÐu8ë)¤çÊ=!°&8¥Zx”òYˆà8.R’©ƒRÍ`3!”°×~ø±¦m騫ƒ^øy¥¸oÎÏ/¿}~ùÛ‹Ð28ÊC apjé$ÄËL2O³‰³º+W'BØ—!ñ*žñˆhªûb ¡I¶Àj…€Ó}†XÀ§,‹äê¸ø("ÍæÒ=>‡œ)q2[*ž"~m‹j^l‚ÎÇÁÇã^BH÷¸¸N2MSÂGªI臎4(1ÍT2êcgK¦JXCs5r1 Œ6Œ·4Hû…N àãºÞå¶s¨úãä5@Œ¦¼ÂÒÐG¨4úÆÕq1j±=“H£’ˆ„“7ôä.\ÑF&N¶íàìòÆß°¤+føŠAuCìš”'Ó,Žóó,§Ú–`HDkˆköÜZܦ/ר¯Ê[?={~ ïÊÆ=•d`lɳ q\@2˜YR 8‰ß?ñr•ïi=!ý°Ux2;¢~/1lÈp>_êÌ“±³)¶yWñ{Úò7×BÍÅ_*8Ã[ö´]_NÅ|¤;Ð*Á¹ìâWTøJ[äÍ í䆞-(Ü›ù¶­©µsa —4ïëwóÛ«4¶j©ŒbÚ¦Þà™`„a1˜½Äšöø·YîíåáõÀ¥Ýt '¾¡ª¨uÉ&ÓÔ|Zí}¾±èÂD"•s¶%ày fäñýðÛ0ùq6g$=g»ÔIvÄ–‡´‚´‡µð vEPø-~é1§Äf8Ò‹kƒ£eó'³9ÇÚ¨`ª„ôàv’O ÿr„¥•»†+êØÖ¶ž-íö,P³úiS²ƒÇ$Gi+ËÎIÚÊï³Ê™í!}¼”gà"ŽòÅWuQä.èˆcÈÚ´øž8ø(•u£bøsi*™„.$¥ŽuÄÙàˆ·ÅuC† Mt©$>Ì2ª¦ÜÜtA'RHŸ®ñÆ !¸ïãuš:W »he”a.슾øè’[§3¶Ë^úTVõnßw99@ì˜_^€YcT‘Áñ}Y¬ŠÛ’,‡º,T³ï¶n•j{7¹LñÊæM¿¢\<6°Vkà ¶»k˜¶÷FsâÇ÷M}•_•Û²s%ì¬ûî@˲ ͦ؋‡6ÝTY§ Oœ qðžÏ2t-4ÈŒœ –¹·UΫUáJçß]UÙ¾i¬5¦zÔ÷¿¾ZÒO^Ìf©Ÿ2ßÀùv@¸£õpiá#1É3½ÜR°Bò—öˆ5pC“ „Ÿ¥@ò)Ÿ·ºÙ\‚ÂT+D²A§—h–‰Ï?SÍ•,$Ïlbù,§‰<¤¼H EAw4x òx@ÎŒ'¹¡àvÿz¥2ûs]Ý”ès]œÊ4$³$é+@)›b–éÐuUݬ1 „ÓÛ1¿ ¢NŒ:D¥y  ÿ6YE¯ºdtøl»üûG-µ£#G†ûîÆø5;üzˆf·ýa%h[þý…|R4(†A>åB¸MÖ°S›Ü’+Ê»’´‰l¾µƒj.ÁîÛ!Õƫ‰vDÎc ÓW¹õ˜y²ä{‰÷@b(óÙ¥N\•`B|9ÏNÞ—…MŸ]pPŽÜ€ûVà‡¾”ŒÎÞºò‡¬ü¶Üng®ÕÝž:RV¢Ò®ƒU™JîöXý¨›.¯º/(û¦r´IºIe„_ ÚÜI úÓªöÂ#uJ³Ý7iк÷Mô¹iÂ}“†óíýŽ?tyøx ²pŸ ¹½¿¦È†ò2$£ùn¿uß@f‡8 m:0ìC=YÙbÆRÇ*:u‚æÛ¾q/tô똆ØmUWSÑßUqîEÛ¼!w“ ŒùüŒèº±Ÿc3X ±”¯óÆ5 ky¹¥!²VoîÔç@VlaUEïYæa’ݵáHG9’©éwe;jçô®oƸ0¼ Èég°Nê ¢—!±> stream xÚ½XYoÛF~÷¯ÐKª¨6Ü“dÑ>ärë¢uRGAQ$Áˆ+‰…D:<⸿¾ß¤Dg;h°–»ÃÙ¹¿ÒYŒ?:KØ,I9Iy2[íOb»ÛlfnqñÓ õt .Ž(-OœJ9£1ÉâŒÎ–ëcVËbö*¢\Í,㩊^ž¿$Ïç Îyô²ÕY‰è·¼š³4êóÝüÍò—“§Ëñ:É$‘‚ßS¶úcÓcSEhžL‘X 'äÙþj.iT7]^uß1n«%Ç).rôDOdT¶æWDUí7r÷¼©¡s¹ÿ…Û+ ;¢®v¿}«ÝQ^äW]nŒð~Î’Èï6ú/½êʺrÔm¾¿Ú•ÕÆ^oˬ›z?È=`'ù‚rB%uòõ>/ ß4ºmn„O3§ vr÷ØvM¹êÜVÛ¿mµ'«×ËÚm„¹msÏî­µ‚ÖžZŽÂÚ;«ºÂ]ýÊ¿èù¦àБùBÑ8:§Þ± Å^§‰¿Õè¼µ¶âÞ å{cQíNó¢p&ÂÚ*ªñ^gcœ\9·•6 »ÖmÂ,. &aĤ"\‰!"ò¾ƒºre⑼ÀÏî $ ló·ð–dˆ…@lÑ8#18½5w߸«»­õ‰‘5ßíHHŽW’ðLÀ*ìûdz"Ldc<‹ˆØ›‹ÇONͽÞÙÇ'ÎÞXXÉðû:–q¾Û×m‡uoÔˆM¿Z;÷AŽlbF“´\‚ìôº š(ƒŽ£¸yUyQÂÒÑŽM¹ÙZ7†ø!ù“˜ó ë‚=ýÎW&˜Zd„ªt€µç¯&òrÿ üãÙqøŒÆùˆË†ýH– ß Q£}8?˜­¦¯Vyg3cƺ𶴮†ace¬¶Í«£Þ<ޱ'A4Y×õMÕ„nS7MÝxJ_59(HI&%³Á+%Éj7c„ReAPÌ£¾ê›Ë©s‰Úsù^7åúÆqQñÄLæ8‹³qb(<"~t °èb€›w#†0ä’JfJ¤Yüxõ&ž8BÙ!"™][ºýŒ–V»Ù‹“ß=ÈLCQe0lj åî|nªØÃ‹o½KpJR:ªp•7HœN7mHÅHr ït_³B¼Ù$?mGž%³#3Ҡϸ„ú)"JÀi«íæ«:KÒÿÂiàD3Ÿß?==; ìä˜y]é&ïÂ5šŠƒ¦_Á_r FLnùkib™‹ì,9¤4÷Xd;Öî(ßmê¦ì¶{÷èû³<ôæ©®Ô¯c\1_šXD1Û¶d˜À¶(ÒÚ—ßõZÿ­Ü>A5.òf4ï‡bÀßD„£õ˜(Ëè@ôÃôG'Ýó'§Ÿ” -Å‚Éûö%rY<&i*'@þ”¬,þB.8¥(‚¢¬w2°»¶Ûm H\FcÈtÐéCó’dô†…©€e˜ j$²åxRÕA b¢Ôx¥œF¦­¦QçÂø,ð"UÇuåòéÅÅ%’ýòñ³ó'g˳gçÁ>íJvPÒ;O¢Ÿk“?×¶w÷©ä† - ¿Õ|hËՀ˾}c«Ç£ýظØÇm~åÚRíѵèµ¥ö\÷U±°Ùw„¿“×çîg­¯ÝÁû¹TÈî^·cW wÓò0öY¯bÓãB¾Óm;êç[ú‰0âí"Á•³IÏúD¯ó~×Ýê¹§^ËÌr¸éôá¯/ž›»”(®> X ÞÞ§ñ¸Òºhtö!S¸KÐû »Å’”0ÆgóZÂè¿Â±”›2ËJ¤÷m>²¯Ñ||Ζ2&ŒÒ»áLÁš”Ojà Ô¤®ÜÛPNUTÚIRN2 ÛÓL¹;Pß­(QY:©AeU' t°‰¥öC¯²Co2 ½*Òôªwµ÷¶¦>õsŠV‹²eÝï0-¦ÂTÓèQïe¾ÞÂæÅÂ%£p+f·éDo±Õ žœ±Û“-v>žlJB£Ý)¦c+–ãøiΧc4N¿I€ÀµP¤Ú˜H`ÒlÒ7ÊD¾,ûŪk'ó<½=ÐûiC4>Uø0ªˆh_›%š•Ê“CÍ8©lJ÷IÅï·»Ú‡@KÆÛQƒxænÿGË17bºgQ¸Wc8OCp’ªÿbÚ¥ä¥D°‘vyñ2\רqùƒÁ™,qüÈ<:ëjLg~õ‡Éxg¶3! HŒo¯:˜Ó¶Ä7žÄ~m [x&޵ {v~zv~¶ü3¤ àA»Ý"Öñ›Í8ZšÐiãóÆƒ‰{oâÆÿKLÝþ=b endstream endobj 2237 0 obj << /Length 2758 /Filter /FlateDecode >> stream xÚYmÛ¸þž_±è—Ò@¬¢^ƒ»—l“Ëáz=$[܇$](2m«%G¢’lûç;ÃJ–Wo‹VÔ9oόՕ„?u•†Wi¦ƒL§Wåá‰tÔnwEƒ·¯Ÿ(^·†…ë“•/nž<{ÇWJ¹ÌÕÕÍö”ÕÍæê½x¹/ŽÖt«µÖZÄÏWë(ŠÅߌݷ«u˜ŠM3‘ض¼dgÓ¶jvôÞ´Ízh*˜?¡+šM{ ¯¾¬âD]UX|”J²D(®>Þüòä¯7£Øqq¤yF¿úÞAS8¨$œÔ4LGtÐ8ÐJVë8 Å #®WJ¼9ÓXü‡7«ÜÉßãĭˆ×¦é+»Ò¡¸#Â[ó/SÚªmðp½ÙéõÊ«u(ƒ,iÓ·«X ƒÿ>UÇ/¡Ø<çogª‰Ó îÛuÙ6e± 3¸DЃ¡ËýýúÕSm`¸$ÀÚqY«lÑÛn(Q•’Û¡ñbÃôŸcþíEò`ÛDž²¨ë;¼È.NçâøñP¢%íi!x†ÿ¤34Ào s»V& óy9tib?A²ðФç›Â`X£éfâ+‡Áhº–ÏÁA“¶×±¨À²Í™;9p¶áAIšŒÄ'§+Þ¤75è’Ç0Åìf¬6Þ,dŠÉ©)FR*UÞËEs Ò0õ+Ö­ëÁ]ø´'Y¤Œ!ªeó )–öÍ0Ï¡º[»énAæÛE0†«QÔÓó%®ë<„q6w‰’ÜèGº y1¦~±üÿÔ컺ÝMK[ß8ó×2ˆÿϽ×êYÿ¹³'“¡”RàûµÙCm½TgAyƒ–ip ;8cƒq†S{Gh+åL*Z2RX>“,"Éà±þî„:ŸÎöÏ‹¦UϯU]Óh²tx)ÐwÉøªºøT3™ Î7Þøá #+»§‘\’O%ye¡ßÿ/KŠûî1ã’qþ}¹S°ßdåÖ "JFâ·¢ž&|è€QméYÐó¸[áâ:–Rî¯cú®ô|MÃ|™Q÷-ÍÝ‹t3N‘0Díî˜ãŸ—.Aƒç¥¹ö×ðÃeeóé¦ìî¶àÈu.ÅÖP ÊΦsfÚ”LÝ+QvÞ¶ú•Î:ÑárnÔ¢?`Àïè®Þ/ÃP)ñ ÓGËÓe{8¶ ŒDlprÜÅ+ù»é­çë¤ZÈC_ì féÒg¤ª _¤‡ ŽŽnæ¡èH §¤ÁÁf  ~ª?râã%ÿäêôñJór)b:nî¬^¼Dm-É‹ÛHÍ3GoůmgøX°h;1w†jäÉ"@íPT¨.™ô)ÈW€âô „Ámæå@!\2OÄ‹ÁòJæÅ$ ¥T׈™‚ ïÍOå+C§¢èé ú‹OôGD8¨{~˜À†"׆Y:” õÓÑRçF*ó¶S”Žª”Ø=` ÆJçOD¨šïàtDB;Öߨk.9Ïl•°liKÅØ²¥©8@á›Û» Ã}]íö¾¼p,qÉA`Ö¥7‹±ôHºJŒÁð_v(º]ÅF!ÇfLË¥ ­®Ñ"O¢• ´å[¶Íùªþ¾¤..°O’ ’¹ÿòRAiQJÀSɘ––írxÈ,?OºäEZÔ¦gz 3¥…³Ýá€ÆÀ–Ñõ³²LóÙ•@Ün;_üW¡¼ - ÂìÂMã]ij»€”ØŠèyT}ƒ†Å$<áÁˆ"uÛ÷Áf Yž2ä§õƒÒNîy@qŒðe×3ÑÅà,šV½tùvœ9ùžÂ¬ÝT(+°U2B˜ÚT®ÎÆáræý†À‰¯.å¸,H³ì^i¾õmÕ|)7[`éRu ©/<­'}¾‚’%”ÉüfoP·œo¼‚ëÖ²æ}N:DA;šÈØ é{þüôO}Îs\ípÏ c ’M*ŽTF0 ž>T²b‘„ŠÅçÐ{ÂÞ¯ž¡$8 qP¶€7jnÖ|fCÊ'4ÄkP q{'‹†&Šá[UWEwÇ2°_=¨WïkˆÅF_óHÍ8è‹‹yÇö˜û K¸6_ª‚™H zŠ%ÎF°Ë0tÍîÄ]´JÅsëX§qèÒ§/×P4ËÀ7ñ· #w‚¡g:‡ zÙ´Ç´)¤‹$ŸaÚbK#Š].ˆâ3õ.EAÀïùâٖΕfA¨’Ù±¨ Ò\üAUn2ñ•³HË"º(¡ç: žƌ¼ÿÃ`Q§8>CF<”ÉYˆÃ1|1†c/°ëifÛù5\"f +uT„eâo{íç ¦‘+;eQ—’¨(7àSû6¦3¾I äØÅÏ燥‚aÙ˜>v½Íl˜c©‰ˆÍÅö—¼? èËpr>± Rì|•Zôœ¸ÍÁ3R‰0ß ¸`äLIÖÕÉ8ò?+Ÿ»9ò.qc BšžhPÖ[xU¢ØÂm›MÅ}+œà—L+f`2òí_ô{·ÅæÁÞ4Å0ÅÖbLH$ÅdS§Æ®¾ôU©ëL•/š–_ÆÆè‹Õè´ó]B>Õè³V鸒íÝ2jÐ8Gc[¬þç÷—ûÝ÷Ëì´û”›Ž1DY¥Ï‚»é¹Mi„48u䣓¾Ö+XÐÜoqïÚE|ΖüóÏ|a\v( ;ü™ØOÔž½‡ Ìè\ ¥×QÁ'É~êúȘ¶¨d„W®;ä¹µ*Á šÖÒ ¬[—óa©ƒZ@’ôŠ©Õò¿â~5¦@ÅD0•ïÏbússܨˆO~s¯$x2Í—þ÷ž#ï0k†±‡kø“ áôãŽʶ2 ¢dnSŽ×-ø¥u6{hÇÏ Ä 96ÛÅ_+$æ4û{8®5ÝrÉuMœeõHf¡ØŒÝò³Ÿ/ÑåeÜPÊüí¡8;g`ߪ @¬I%¥/¹2n ~xª6œïÎçM1ûÔ··`Í)–Æ&*(ùfï%›ïÍ¿ ÿ?I3 endstream endobj 2240 0 obj << /Length 3008 /Filter /FlateDecode >> stream xÚÍZ[Ûº~ϯ0úPÈEÌŠ"©KßÒæ‚8AºÙ ç,‹¶ÕÚÒF—ìn~}g8C]¼r’6éÁÁ+‰’Ùo.Z®Bø“«$Z%©©JVÛӓе6û½\½z"™n„› å_¯Ÿüù¥1+Š,Ìäêz7êºXýH•®7Q¦Ò8xÿ潸zöf½QJï[Ûà›~Ê«u”}~\ÿzý÷'/®‡åLd„ÑêyóÔßÀ`‹Ðhbð¶©qùOeaÛõF´õÉÒ[Yíêæ”we]aƒ ò°™4¨ûŽºƒ¥ŽS^VÔt›7ÜY降tðöùKž¦*x^²omÁÄ5µäŽ)üW—LLb:٦ܒ¬`ß©„4rØÊ‡£=µÂuJ-2­ÂˆŒ ^w$r\Ÿ·´›¶-a5áúøޏáà©Oë lwŠ( jÑËÞV¶QU{îhê¾™ [Ë é«mÞÙ‚Z hÁY%õ•z1ð½Ñ:¸´nû¶¢1Û¼¢ænyëö¸69Çòjo=°ˆg“fQ½/[ϬòÌ{¢Ö0&ø—Ýv~M˜òhaX`Oa¦"J}Õ77]ÑÜlû›nØ= œáQF™ˆ•ñAµGÒßFi¤R5˜*Ò <Ï5˜‚T¡·¬#ƒ¼Éä Û´Dï@9#,j‚5¾#˜g$庵LP€<½&©e˜°éaÅE©-êÏÉ®±eUvK‹cWìåEx…5}™ËÏpí‚r)7vÊ<:ãÉHgÑ\ì§ÛµAuyÕýe‰+cD’ež«k\;J’-¢¦WÆm‡j¹sÈFÑaOç©óÆæ3âcMÔðd‡¼cz”ðÿ2Cû±·ö3Œ@i xI(t¤S¥ÜÈ#/W´¹ó§#[RzØà¶!4¶`ÎÂuð†´4Ö1¹½xPGOæ‹dà[Zó—ЄŸ_Û<À»dNN0ž†|{·ž/Iîhê3>n3Ú¸‰wyÃsBC——8¥Ž úØâi§PÇ¥!*¼¢NÇ?Œr›‡oжë\¼ÃijznAU%✚*{G/SÈÂç²Ô°ó=ÌSLì.ÄǼòv fÁ̃¼©¢Ã«@ü©Ø €¶!`¡ 3FJhÑŒ/ׄ‡jË£úÝÙÆV[;š¸™Á~´4ŠFCpuóöÙÕŸÖ°G?‰[w£ãpæµfôލ%^$›’i`½ …Pž#ž±¥ s9Nž¿~wíy™y°%^LžGOx‘Kž`£d$’ôÌ©½²)¢°»¼?r\¹u~˜}0t –dŠnS&`¡‘š[VÝ™H[ÛÝl7"S1ŠëK2¦ÂòéÙÇ!çŠ@¢!=ƒÆ)f\?ÿ® è ¬îåi¥D”àŠÇÕ»'ÿà´l¶Z¤"êÔM)ÞÓÛ5DÄÊ‚2•©L=A.l%…ă➲"êcæÂÔ§|ù¢!Ø'ñW‘¥€8Í<Î;™ ˈ9«ï°À8xâ8ÔgœÌIEº$üHpM^µ“ä¼Ô÷·¾kE'Úƒêu.ÀõZCî“{çsáÛ{0ŒYwÎ÷:_=! ¥@ß›Pnj,5c®ÇˆWpj“dÂÄÉÜB^ï–2zý¢2¡Få–lI˜†žÐ§qœ2ÓÐT²‰ú„·õ6ë“ $åD¡Cô4Ix>Z¶›ca7:›îÆ­¼°¡(šR-{€4PÝ|Ê›’–›ý²M “Éå_/ø‚T œTD%ßå Ðl ÅéL}¯/8³Ü™/¸lº‚Å ¢ïÝ¡HB@nÊ}YåGú¢sJÓ²¥L·à€¶ÕÈ 8ßj©û ›©7(C¡«é}l…NðKwøëx‚œŸpàówÖqsóIV}UÿM™~ý‘þY‹…D5/³,B|gÌñˆ»m#Ä… ä*ñA\‹4–¿7Äi9E|ŠÇ‚hqX„Ê.¥O %à(ì8gÃŒ5†h@çz-ÿÄcrÞò¡Ætw^žÎ7>p.Þúycš÷1¾¼_óPò–?keþÛ`MŒ6æG` §’êw5¦¨á×jgØìêTø<ð(‡3|Ù g¢Û[ ièë®Dˆo9=¶õ‰Î€u[ŽƒN\eJ±ÊD«äݨû±/*ó¨àh[Ü}UbîÕˆô5¿s AËç˦ýNbé._Ö†4±ÓôGÀ/6ò%â ä{Ðg" i*€þÿçÙºdJÅP3»,I8f³Sà…“—6BŸ¼†¼2›—ÝDhâÅ¥ç“êÐYë$½Ô l„Šgô¶°”ëi‘$Ãæ®¯Þ¿øz®÷}¨ ~‘J–€[~v¥aX&/òÛ®¤d[2À?–Èl)®xüzoÏ‘úÙÕ;ªk í z_ƒñÓ——T]j«g†@ïoÑÁGqðšôi>'´hH)^K¯\fJ‡jTz!Ç.f¥¾˜•N‹SÄ®›“üAM_ǼÙ3zÜù€,É&, utçÞ.•HˆK†JtØCQ4˸t-—øQOV¡W—r"®˜ÄåúÚ‚Ê0†ƒtc­9,c^L ;[[ôžØ÷5–|²åš:0ÖÓ:ËU ¡fÇõH|½…*É™Ðk"¢b›ß¸#¥SÔׯøàÅÞo­-¸˜7påoUüdûrRú—>§]²1xOÆ’ŒsÌ„bß3+ö±Ë>å÷7íÇÉb©$/SÈg%y”qL—×Qñf*OS\ƒ;V÷®‰åÀC\ž ppÍü)R9ÖÕJc?Õu'h†º)ªÃö˜×9¢-ŸXý…UÓqþåë£:¨˜äT7vôÔÉoÐüèæ…/~X]“ªb¹Ã[1€p<¿Ä CuË|“ÔUAÕYà@¼꺡åñ¹G{¹Cï®>2¾†î’áèÜ2SS ºèv–5¡»ÑЉ¿ØÂoS8¹*&¬ð¯Ü]îü;2ß´_÷¸èU@jUÝÍŠ¬’[’-žžÝRTöž©ëÊN¯é”㸻xX¡DÍL²¡‡|X˜&ÙöžýĶóYë¶g _žºQ‚‹+†pp™«–9ˆ.r7ÛÍÉú[7',÷†šÈù^±¼ïzÁŸREÈ4Ê- säv‡¼9ÕÕ”`8¼žAO}½é2j² 12QPy÷¦ªE[€©,_½n¼ŽRÌÚ ojXÃrJt˜”ÄF³&Æònv±ªØ±ëxE–ã0ᨤ|{.oéþQ¢ž­ßø ¬½%‰>ÃÕÜ >PEQÇPhßAdâ®Ò„ kÐZò(Ÿòû[K¼ÁªéÉ׊¾ªÁ«œ`ã`Þ{¦=X߃ÛÀ{c“è ‰žH„Qö ™žÊÀ“F³B"^•¹" ^ž-gyòšaÐrZª•ñù…ZÝ,–;dÐæ«I#߯+P‡Ð$|díÐ4w£Ô†¦Çê‡/ÉW^ ;> stream xÚÕ[ëܶÿî¿b‘OÚÀ§Š/‘Ê7'ƒ+7µÏ(Š$0ä•îNÉ®´Ñj}uþúÎpHê±\ß9ç&- x)>†äpø›çØ*ƒl¥ùJ‘¡W›Ý“ÌÖö7+*¼üæ sý. ãŤç—WOþò\©ËÒ"+ØêêzJêªZý|u[__!õÅúBJ•|W·Ýú‚ë¤:`‹L®;×å¦n뾚ö†¾Û®½8¶ ´ï¨¢/ÛªÛѨwk•'eß”C tËMž0Q¬ºúÛ“¯¯Â²W©’â{ô½ïÙ¨ÉS¦&ÏÓLIÚìÕm ËERÕ×åq;ø=ìÕ$ukw 5]‹¿2n×,©©|Ó¼[ÛNÔeÓµ‡¡?n†¦s5D¤kZì6Òõ…\^{RnêãÁrJ·¥›nßw8æ]SÕõ>7Xs¥ŒìV\0‘2Åhgïšúj”Ø ¼È§¼à:-8‡1¶ï±=öo†ªs¨‡7›=Ð%šK2fÒ\i?lSn·Oacp3­QLGH“*Ls¨«²REjòб9ÐÒa9TºØ&$OuÎü çϾ}õu”6t“Æw{‹,{OdÝ¡»=4iŽÛékêã×ÒÚ%¬.„¥,³‰æõ±ÇÐQ±ä°ß6^8oY:o¨§ó†‚;o(Ñy+ŽâÅ’í{ú˜ÊÕtœ=ìãn —𭽊žLwM-{ÛÏʉF9±•?f*ëüЖfµ«ŠÊM/¦7„8¬ÅصÀj{ ËžR×sÒÀ@ìðîAò L1“ KòÓŸ‘–B£tõòuTàú+D ™á^Ø»H3ôÇ­Û7Ã¥ã| $Zq¤tÁA¼µ”Pà©,Ãàò¬’æ· 7z]n`¼¥”g3Æh™LO½M)—{¯_¼~éqó׆ÜHXJ±Ês™ ™#þðS¶ª Ž6•zug{îV"å‰mW¯žüÃáål6nLªDnI1æv÷ýÚˆäÙËÏÝ.fü,5,\´}Ù—»4É!¶•ïn8+Çýª;¾¶GHËé󌪘ð‘ÅD.tžJÀ¿é%~å…ËQ‡²òZN&?2!«šTYó›Ee¨-+ЕîºÒ€¾þ¹ö:ÊÀA{ó‚4 ošÃréä[Ù ÜþVÈÀ]ÓÖç¯fÈEz¾XÒ’€–UI¹=Pëp[T*-¨å…Ý NJ„š¶eSöÔÁmÑ\@= õsõ¤Êý$w1¡GXLWRÉaÄ€Cï‹jÒš&9üz¬ëßÜÈa°Šm•¤¹ƒcNëí© Ë ȯÔ<&4' BÂUqý†fW<áš ¥ÕÆö˜ûòÆWÒö Ô¹fÉØfÙ…ë][àÖ ŽAË‚'ÆñZFž ¥¶¢° %Ä8¬nÃTz_tC³±Cr|:÷ËÈ£§†í½b•ïÎwÁÒ,Scç»q†ÚÑ?¯Ëy ž¥qó#•JM1¬Gǟ鮃öÎÃìm7Ý'(U2W‘1•k€-çbGüd:Ç)Ò\èñ$ãê÷è³Þ¿¹|ñüòÅåÕ¿bs€‘*@ª—85) (ä©à9µýuTå›»ÀâxEÕ¥|ÚËbœD›º¯§À&ˆýø[ϬfkÕ–í1Üú1AÄu/Xó,âªwfÐ.ô®_À˜O¡wsâ³RªHµ~œÚÍDF¤”ü#Ô®‡m.¦"ؾ9 ûYX‚0|AÖš£Ñ«”³Ð›”þçκFðÖµÛ|˜tqx&5ü~]¯àZäEDÕËli1CÍÒ³²•d@k°éØÚÑ(û¹Bc?Âv¯2&F&ªÅ~r©'¹–ÀÅL†ó{ñúÛoϘ¸9 œ±êÑ.¶t‹¯}s}AŸÎÔ…’u$ì6g®VÑrມ‹]èùy»E»å¦bŒPhv…巧׈î a¦@Å èùˆ{Ä”<4–TúèÖ+Öµ óä1(r°Êÿ:gI:g  };eK†DÓõžJZ óÕC=.êeMœÄ`ÈÜûƒÅæ¨,²8´2i%€Ö¾nÚfx³¯ûMÝÍ¶Ž¢,ç*e³›zeù‡QVŸjpE¤a©ÊôcÄCôÝ´%ÅÁJüSaöBÀ‡bùüZµ§Œ]¸0¨»b »öPï9@ÆŠ”+Ú…?Œâ¬gP{*7›Û›?Onð Ë?‰Ü€^)´;©o¾~— §‚̸Hi°O qT‘ÑçD&”×ÅÿÈ̵3×,Í—úäË÷ˆpbŸãÚà{E‡ šÉ=‹9*l ç¸®ñI­×;@Vp~öólš×CbÛ”[Œ¸U5µ‘ô˲Uàü»Ò›±&†ÍX_:=ËT+có0c×/üR»Œ+*ðC5†QElêêØ×wγäï׃w0Ýx—²ªûí{ç ñ¤³ oÞGR–%*Á †wCçþ«§9òQž¸Ã{GÀC©¡ªPŸÂèçk#Ü#v«ÿ¡“ÚqÙñ”ƒ½….™ãiÕàBË-5Í]P5bKéf¶*t‹ŒØWˆÓ¡ilù—¸Kf¼{Ât²)m¨ê¬ã ¿»ææ–Þ~º­këzW*÷p:{77²&4=½½ înPkRxÍvÔßê{»ןlQhñ¶(U“´ØŽîÍ‚a˜‡.zØß­0xÚ!UuÎ)ýŒ(ùàÃRàÉð{œžfšÝë¤Ì– ÷\ªÂ· X‚­:ñUdËc;žœ´ƒ™a,}+C8U†ø Z´Ej¤™æ_ݱ¢ø¯ÂPuå $³Gù)L¥ä_€ë£sõÑw§(‚è¸àÞÑÆ/ s`ì’EÃFt©éÖ úØZmg(M>†íÀ2ΜBƒŸž€;Ÿ4`Ð#¹#´æàNA3Å“%¥«ÜÖ¥7„æ"mÀ / N–j>±ß¬¼I~œAm‡ÑÉ»æ0÷ñœgFñXz‡ª\8 ±ùŠ`PÈñ9îÇŒÉþàbx¥ðYocèöë×cÙs¨×”º÷KŽKIÏš÷í¶½žŠOaÚÃõ1e*`ôcd lVŒ«#)ÆåÿTäíœKqN;{z’åi&Õû>èžý¡ÇF;ÏÌ'9¾ ê ëÝ3ûÐÉÉŸÜý>’°Í„šÁÈ?-"p]8§„Ê×eƒO;X¼k@3ÚÙÎP°‰:ñN Ôœ¤ `¥5ȧd¢èK]¯]»mEk£Ú:õiÌÊ.ÛÎåQ0ýÀFÞR‘V<9âcsCù‹ßˆŒ¶SRxr"ŸœÄiÚ̉CˆÆ(; ä§‘ÀȼE‘*.1íDS >ÑTðQºÊóš*KógXvö!mùRtÕéCÑgl[6Z‚æ £4€²ºOe æ›Û 8EU4šclœ}Šw°'Ð$ç°Û¬x\z)€ÆpÕGÂÍ‹sò ñ°œˆÐ}[_G-5Œ¡eêw&ZôàÒÑ<‹ÙƒÏyä2Àíetç«ðÜ7 ˜“×e]5g ù¸ö˜€Ôíʦ=Óˆ"DÈy¯8&êØO$<»Šùd•9W³\,¨Bj[Ê ÉúŽtgák¼³Šž]01ìø–|CÊÖd¢)©nž1–-3ÂhS1õ;…ÛlÜCõŸ`en­ÏJ~ðêlú—- ~TÈ8„Œæ8Ï<ç¡"¬<Úø¿f‰'AÖ* Ù”§ñˆ)Ÿ1OÏOå)/´ž¥ó¹àŒÖ63½;&@K˜…Ià뮡 Ìð#ÀÕ4ÑL˜@äÚçéiN‘=?Mçw Š;ò¥f\–}õõKáukëPŽ7ƒõÊ”Ì)  {ô°6ÇmÙ»ýº(ÒŸAÆg‚n.§è½C,¦(±‰®‡[)TNõ×½M§†úpÏÖuÙd°§wRÅîä)ÜLÌto„ðíö1Pt ÉtÔa‡=DÓÒÊY^¸Ïq›’1¡_xµnÙáY3† H £ÉFÆ%ðþ"ÍFEJ¯º2'¡RE1ëÚ5X¤À‚½]ÿ }Ùp B–ûÔIXÄÈtQ°Á.ŸEí4LUÍg©ª»]]Qì'*7›zûÚÔ”¤za¤²¢)­x»Ð-íåP»ÜõL-ÞÀXJ_>{áÒ’À ¦kÂ*3fš‡U€gŒÐ)|ˆ€S¶©Ì1Ä2)MSŸ‚ñç™~ÒÄ£úþÕmÚåºÁ …•gú£åܯ,ØD—VK(‡ùÒ« ±Äï›W ÿWT×T”*è®V.Ú¯] i9&Rí4TÏî¿F\hlÆÆIƒ»{Önå³£ÊÔ„ÔPSÐnŒ±›€OB;ª v‹!Ï%ÈSEœ=3{$2Æž ‡åÔËU]CÙŽ9ËðUH$䙟&À–.`tðà°LÊPS…?Oñ¸ro’Ç";ÎÌj Q”Ï\0Ö âW‰¶¶âI•Û ÐGœüu‚µm}®0™3Ηù׉ endstream endobj 2254 0 obj << /Length 3122 /Filter /FlateDecode >> stream xÚÕZÝÛ¸Ï_á>Ðb†¤H‘,®éåãöÐî]“ Š":[këj[IÞ$÷×w†CÉ’Mï:Ù$háós4þ8_¤˜pø‰‰‘cSfS3™­pßZ/&Txñüã¦0p:ù·Ëži=œ9îÄäòjHêr>yÅϦҥ6K^]¼b/_œMÓ4M^5E%•ü#ßœI›lóÕٛ˟<½ì?§¥fZ¥'òÖ>dдhÊŒq­ˆÉóõõ™IU·ù¦ý ²±¿,1©|ˆÆ_ëŠ'í² ÂOžáb\Rí÷,ó– eCÿ¿rÍóÕºjZ( šÕnòu(]Uuàà ù¸ÈTwŒ¬Š«6Æ®p,u=»ùf¥%˜´i7¨.K܇(=–árH/¾h+Þ…œ@Õ1‘ÙÉT¤LhA“Û*| 1œ2@E÷ã–”©nD/*»1"º‘ÌHÓxHXño‹´ØTo7³¼-æTWë¼ÜPÙo$ŒÝT-5ÌPlË|³ Ñ*ȇ‡!ùjE¥ºh·õ¦éRcQ×UFVp\l2/Øn‚9­%r?Õš¹ À.ãNÒ*Ê 0èO¶›mý¶×o›¢}»Î?¼mÞ-ë¼-ƒÄ3>’•5Lõ’ÀŒaDìûmü¢;£ïúƒ'“$'™uŒ« Ýë7|2‡ÎŸ&¿ñÞ\OR& [M^>øg8›£¯¥\0n²ÌŠ˜_Îlš<~ñ]XÄH©€q¶ãï:¯áü´EÝÄ–’IfvàxØmìö·U#­F¤QšGE ÊAY;eySÅ ³\…ã@ƒ_"êïúÚo¼×ŠÂ$¿ùZµõP‚þ+(¦ @ìøÁþÖEN4µXUˆË÷ÔÖ¼ÛÅE8¦Ððˆþîž g±³©MuØ]{•Ý´£yT ´H©ûq¿u+C­ÀÇê ôµôE,ú³h4(ÿG‡É¨YЙKþE§Õt§Æt¢€bñaVó†*íòL$aÌ¢¼ñäõ{Ô]ÁÔm Ÿí³jÓ€V˜Á— Ü0“T à¯mb«Ñ¢õSpFÁÞyu"NnÊœšóy~Ýƨ«.~/Â7p„ëU¹YxñK´šÔÎÙ+š…Lc}Ì$ö ˜´È¤ol–Õv5§)ýÞ?ób]ÈU‹‚PJ“Ô•ÊÐ2Ûk`ÌXNŒa¯ >d «DÐ7Å{*Œ™ÄÑLzòI?u-zn±Ò´Uwj¸-Q(WDY.¦?Ëå:l?iò(@;xkî•òhïaÊxï*A£“q@5ŸÏ°+P$s(°žÄ Ò“â*ß®ÚÞ¶D̘Q(öÆ‘9µÑr8*n>Àùq®3) *plA`An·‚ §N1½Ûà¥SµÒ‚ã– ­ÌÛçO/¾#–Ŧ6:ƒ¿Ç8:RË;Uo ã8ÚÍ ž{Õ n©(̶u]‚¨¡Ó+P(J¨(Jh *7;¨Yh|tl¶¡Ù¦›Ô,UHÙY륀ŠÀ‘Æ?ß¶ó&Œ¼ÆÎîÈˈáK ‘ãå~ñìüâüòß1iËv£w€G¿¦˜³ÁŒ±'Rž·û.GÁòð‹mºQ̉Os]nÇžþºØÇêñžxðADA;,5OØ´.ì¥aÐéã ,xŒŒºF;Œ`a‡£NÖ<ôEEÊA‚;§ÿnX€R3zˆ $7.R!>჆äœq™þß@#ÐE¡d@*åŠc4¬×?XñèÀ)}÷\‰ØGèÀ¢ÃsCÓ£C£¹§£BÁ4 ÃGˆàÓ0¡úH'¨åcø£ è)ê›|ÕD·Ê¥ÌœÉÛã ”Cô)ÝD)à àu¯8È@ «T ƒýqPp½¢ÇCs5 „Ê›¨(Y·KM½M½|à Xߨ7ƒ†¸of%ùf¶çvøLg ì2† .M.*·ç»Á rÞ&6æu°LN«/’ß‹„ÈC›÷{©øc‘ˆÉ¥±ß±oºÃ[S‡g?‡ìSw³¥0&²Bk83n°!‘˜6Y –ݺå}°(³Œ¥°OHJóà´öØK;ÁÎ:±sAýyô!c`ø¿™Bk¼„¡šoÛj ~¦H>RS[‘l((,gA–· Õ«<Ì2MÇ{q’€RHE¹›Îµé>«¼^õ—qâ渦•wøð‚I8¿'(¿mSÌ T~QÅ—Y–)ñ%@àJ0ºišÂÜlp MHJt)ä;ŸûŠŠ¯_û­Â<1”Çž½÷‘ó YA|ÑéêÈþö¼¯ÉÐíSjˆEu‹2åÌèžß˯ž~nD)3paNE㺚Q,‚üøH~ŸÅL³ÌLR™Áát÷Ó{Žޤ4øhêÀ¡xL’§Ú`¥Yº“­é,EŇ|Öþ‰bÓŒgɺKPÓNøß7³æœ×`•[ÒçÖRvÎ_t•Дú2G Sú`’Ű—¯U]ú™kšY6‘|ϼü•‹´„ö™ 6Æ$M¹¾&»cÑî—›µcci½†Ö U 0ì_•> šþ eO™‰x0Ì'±7ú×Ù(Ȥp»FŒöpv _i£ÆY¡{Úë{4·!©ècD—…@ «¼õÊË!ptf×Ý!€6 »|°‡À°‡$g–üîÓÞ^ùŸ>Ù%tÝ÷‘fV”`ÅöqJ-ðöcµK Sš´ÆÓÂUïzí nÖ9ËèĈ܆q`rp¯ªc¼œ¦.RF•¤fuÒâQ‡@i•Gþ÷#'Ë÷7Ôœ¯üòs/µ†úŸf „ÚŠþ9Ê ]ú¹ÿæ2Т¬´øè÷Q(Ôù¦hqò¾S“1îÝÙÍ‹MS¶aÛ|2<ïÒèÝ®„öm»—šÿ0>¤ãß/Kº+£êàáÒ2¿&@t {ï—á'â¹ PûY¯÷¾ßZÑàˆ"GÞhàÔCñ}ÙÝÝAAKAÙѬüHµø¡45jðp%¨: ¶«„«œ/ž ¾éŽ%ƒã¦{±-çÀÙìXºã3’ÁÇîÁ11ÙDrp¸¾—ýv 6\) $¿‚ùÖŸy•x\Ž©a™>Á‹'9sö0€ÖœwÔ§Ê…$6Ö¨ôþš [šòPB€ÿ”(‚Y~³C[NY8Îw´ÊŒ?ìðìg6E^‡[_G 4E ¡mE%ë²3!~Ü“ç—ûO?Â+ aS™÷ã8DŸ5œÿdÜ2| ¦Oó#oUö>ÙÙmp¥ÁócŠŠ¯É7©|/ü+ @°¶Ï9úÖßëÇ­t£ïàtŸhTùÆPŒ œ Tª\íaeámsM|·Ë<,Ñ;WðOÏ6|ñÈ «ÁG7·>Ñ=®¬…ëZ…F«½íþéäý^z»A¹D8q@}l¹XW°º¥__ª:˜’Ä÷[ºÆLÏORÎ~’d÷ÌPÞuyõ1ªV•óì ¨UïÔD@,ƒ¹¼{…E)øBžwîEEæ”ÌäqAÕ«{Ê€ÑÙÐá¦Í–‹o»iB2aÓ/±i¸ZÒÉþ*#¶a@m'¬½kŽ1ÙqÖãS£ØÏد=;( 80ã÷4—Åmþ¯–Ið(á3>®“tE껺ØqMUpMW»'T«6* ÃÚy˜®í|zy^†ç8¹gÓm»ßš(ÐQ½û[WÆÀ댃u8Èí­ßß©,ÿJÜýòäÙQÎ,æîdLŸÂاð®8³VO݈G™•ü%¾» •-$fVáiŸèîÚ¡¹©ÖEìc‚c„èný¢ÓÕoG{$2[‰Q@_Ôõ¦Š®€C83¾cVû¨+q#ª`¢?¥xúÂß[¾ýáç‹'ç—ç?_DÏ ÏsCÛš]ômúè;„BN0¹%nºÜŽOfæm÷¤²Ë£¯û¦¾"¼ð$ èm˜|nß`Ì4õÇoð‚!Þ«îÅdNWø¼;ÂEʶhúG<1¼ãÛT)oÝU(òQ‚|U4M¿¾p‰ þL~ÉEã5§¼gP÷ìñß_Æ£:˲]‚u6ã¿€D endstream endobj 2262 0 obj << /Length 2270 /Filter /FlateDecode >> stream xÚ­X[oÛÆ~÷¯úD%˽ñ’7·±[©›ÚŠ" š\ISŒ¸ok¸<`  ²Ã§òåvG’2ÄñB6ñtEûÝ.³Bc`ÌÝÊ‚(-b¡¬ÊÎ%RA¬F±w™áÁ䆦›"O?é¼ïtA÷b¤{ýšy9.rݶ›~¿ÿ´N¤¬ý(dÞO½•ùq7›>Þ¿ò9‹)Skº·(»²®²=°rîåuÕvMŸ#(¤wm…2ri§i7+ #,á“Ý/ ñËH±ŒþžjôÈÇ} ºT[ŒŽVŽÝoë¦ìv:®&otÃ"ïLŒñÞ4n1EGA™xýòÒ†Z;•Žvî|Ð6ÏPH’4Œ&R:ò/ÃÎ<† ›Â“¢bÔ˜iˆÓ¥Ã¥0ñg_y W°Ø9‰'äÑÀ{wóæÂu"縜å8©Î¡Ò¶ÆÀXLñ_S÷±¶ÝE{àS?å(ó.«¶èJ$ ®äRzÙìíáU23î¶%\ñɲè®oªÖ¥Ï@R™DKoa=»¿º¾¼º¾ºûÛ¥^,©FØ?¸÷è*6e«a£@µG\È“ ¥Mãd‚÷kKééÕñ°}ÙvDª7D9Meä°ž5 ú©°Ð{¯³ö4LÇÀÝôÕp6<}Èʪý–€½Õ]7Õ"fEÄ<ù¶˜UРƘ#¹Šž0¾µ<—ç¯nÁ* øØñ²ý¾Æ{Q9™ Á ÎÙaÓ˜N/c A|à¦|è­u€ò¸¡Á;úk< ÏwLÈl¨Ûî;:ê™áÈ7 ’,JO‚x‘ ¯=€ˆ´ÔMSCS3kSúpÑÕ{+ºÀ õ÷WRÇœ?T>æ5ÄŒ}Ÿ³¾‚m_‰M_1‡š8 •¹"LBD@J°ã¹ò¬2õ ×¶ ¸ê"diSOêcÈ3LÞmU¾ ™ÌmŒDŠÄû‹úÇ ¾@Aʦ m†aƒº°Î»üS‡îS·°ç;ÂJ$qLóÅ^êÌóÖ–[2øÔOd”ÆŠ%Yèí³f«i§Û‘ ˜u[º*\Bz#ëÆw‰gÀ¯õÀBÀ—6lž‰°Ã[C@hè²¢Æ¾ßØZ@*„-um[>ìõª Ïì*ÏÃ;yÖêq’³€¼Ô›¬ßwc×t¸F¦ó¾óÙŒÇüÑT¿Ç“&”ç§ BúÐ < “Ô½Qf¨õÇlþÿ˜›|`êT±Œ¿ S›ÀtÂÏh½ï¹¸þž„²Ž†¹Åq>ciÀ'`g‘®ÕÉq“\€èÞ‰¹ÇÓ¦z )ƒ0J–`Î\â„ê2 ¢pÔg÷䔜J §àî3c;QþÍÿïÌÑ=í‡'§§ξ øŸA¿;ü47î{(Ý L”Úò%v¡¤kZ»kš?lZ®ÔûÙJ <Û¡*”“N”qZXbÈç,~êzµt}±R2õÎ[º0£ÃÛ²°h¨æpö‰`ƒÊfÊ!ÉiH1éÄ)†Æ·$V¼Ý%ÅD*tÕB}4¥¦B³Í©e É&¾öC¯õ?š¨Æ*@´»ÞëÃÑŽ4@>Ájd‚da¦4„1âÀ'—™`&cE¢J‡‚˜©òÔÎ öN¸Ì•e€ÏSö,E–÷`²¦‹T|ž¬³9wã<% ÂtQ ¬1bFñÓ|8‘JÍKˆ-RD‹úÐèÖ6±|ÏöÆ“¦ç»0LƒÒ…&–LF„ܺ/úh›nµýñw´Æ·ð¿Ü¹Þ¼ÛŒ2ÔÎuô±¶Æï9ÔÇðíÖžª;ç°÷90 f0Åõ›W¯¾>8¶¢F¦3,šáÕÆYÔÂ@L¾w»ϰfÖJ¸WãpnzÒ¬–Ј‹xŒ‰í÷Þ†?°÷#[åTz@*Ù"X­jg%A¡O%BÛÒNkŠ4ˆTºè‚77÷/ÿøýüêÚuI’é4 ˜Ê0Ó“»"Ð_ 3ñ.\L¶î &•1› #‹¸`QÔc/\O›”ífQ‰‘B@ 4®j{2‚…Ù8$7ôØ«¦åuˆM$4Þ17GÈpâGÐY.Ìls˜bq2?~é6@f³‘¹¬NÆLD~D2Ý ž½©»“¡Mêšm&Ï%žeßÞ´Ì–Ãq­ ›.«ºÎ^@ÂÊÜíLŽ«Äbu¡`Ì«)>ì}®ú#º¦nþKÿè›±J¦²±èKëÆ Œ7FñÕùgJ¨P‹ï±åá ‹’`\”å¹>‚^¹&›øŠÅÞUE›U$,¬’a¬6+Éy 'Ž?á ðÍðJÏJaѾÝ*­Ó€C}Mé( z}û¥gh oq¨uùœ%Ì È…Ó¯küv ˜§S?,'ü÷Ì–ÄÖï2”³Ï˜rÙÞô3©j‰67‡%Ùô—b‹-bC¢1èT-äÀ®ÈæH™—ßÁ[çÄbgF|ËY}«Ï—㌒ï¶÷0æV¹qËà êT…mÔ‹apWWµ å‚á‹ÿ¿0Žz´ endstream endobj 2267 0 obj << /Length 3035 /Filter /FlateDecode >> stream xÚÍYYoÜÈ~÷¯˜GNàéôÅkypàxíEÖp$ûà=äHÜ!Ç<,{óçSÕUÍiލ•/‚@€¦Ïêêꪯª•„?µJõ*ÍŒÈLºÚžH7Úݬ¨qñÃÅë6°p¬üëÕ“?¿ˆã•’"—¹Z]íBRWåê]¤¬^otn²$zûú­¸xöz½1ÆDoûªÃ–~*šµÎ¢±Ø¯ß_ýøäoWÓq±ŽElÍWòæWßc0À¡gP'BÆ–Œ…*]oâDGo¯ž_Siý‹~Þ6õ§µQQÕõÀžºZç6ꊦߵݡ*iðyÕôõ€+¿ÐÀEõKµê¶Á;Œ²PFrµÑJ˜<&.Ö1œ€ÿ>ŽuÇ•ßñÞ™|ãT$@Àm¼ÚlÛf[ ô>­u Ûœhß<ñ”Z‡dŸEeÅýâxìZ\þ¹>CEò/ºªXârãŽÚh)™;ðò8±êþ=Îâe5lÆãwëµöÄN‡?¥Ó/×**Ç}ÝܸUqô¯Zã!²\óM(̺©‡GyëÇãÑÕv<ä׉€èï*z§fë~=êÝËŸ×È?ßÓK¼{ù÷çÒ²\.AU„±°ß“Pžío oß#ÙÕÆj‘ĉÓ$MÕ©ŽêMô¡èQq´Îý·Í ¡¾âLIú wÿB+ºI_Ý|Ñ𱯘þpÛUÏîm?Ðp{@—ö4Áâ¬A= ¹teEn-ü‚Áñ5@û¡á俆s ¯Mj‰,àHÿq¬ªßª^°^ñüÝڽܯ=­ÂShß~¿ô”ÐÁfñd:K/–ŠLNO¶l[e üÖFŸ|W·D-1!5e´ˆÓä±s¿àŸ2–Kt¬ÐVûEŸ—¨$B›8 £PðYô¦fg\e"ͲÓb)—(f¡¬ÔW ÍxZÁ'©|•‹<щ_`Pêöèáýã à¥&ÍW‰J…” ûÝ{¹*aòÇ•„ÌVwnéa’Â~uùäKŽg¢%3!múÇËô12‹ °± *F­8ÈXN‡ÁKt">Z˜I-™+€Sƒl œÂ UŸ‹í@ÏŒC{ÄË4Úd¾8Ôîè—·È+ÐÑeÑëv¨·•_T0;õŽV7-õ§]<Í|Þ€O„áªY0kEDŠÐŒp>–YTÐòßﺣ+à(‡ª«·%8œMû”mJ °wWïyÙww·ÈF#ø‰]FUÂ=³Ä€/骖m8æíN,޽sèÑNÄa³ën+gðE„LˆÄuÝbE†¿£ÈRš('W;Μ qš 6œtè†éĈˆØ4UìoÚ@éÀݾÑö~?KH’¨ú ˆãšØe¹04Tý@­Ã¬˜éæœ]c‹•¸Æ[¸ü ÆÀ1¡àˆetÊ…ñøö®ä„œð$§`t·ŠÐ@áÙëÁûöîˆòá|ÝÙiŒ )bQ¬Rx¡À#F{ˆ.xݛÈ[øõ¦[ð©1Z2®© pj¦—¨ÚJõâî¨WðhXlŪåž8¯‹Î<æbQ…ÃäÓîi&ŒN ËÞ›Må b˜KºÝ5!š`"¨> stream xÚÍYMo7½ëWðØ^(çƒ$`Hj8—š>¤ŽP¸ ¤Âv€ôß÷ •¶´Í®WBáC„Yîã|>gL­†rN)PÒ@š!H(PíBÆ{sC¶â` œª 9°48pƒj%Ó+%¨úNhµÚwµP Ú­…–kP.¡Y×å©ë#ØL­KȵBH‚Gµ ©Êž`gwN $sï {ª°ÃC7Ix«Å¤ÃU< üÿQ®X_®¦¾CU6oku}ž’–»>Úúì¹HÕ5#Oø§.á‡Ùá_æÒ%lK3ÀÒ3‚à³4† Åšr÷kZº-¶Õ‡·¦Ýl³æ¸úJîÖ{^’y® ŠSC+$ĵäÅr-l½.T°Ä”ƒ ÉÝ'VH­K 5­.ù[í¥ÔÙ£"#¤ãGàá"< ¥ý;õyX‘ùE(EÐË`‹`Ïož’4’zxJÚÄ”´Iô/êq ŒÝyˆY*¦<胼M0Í58‡¶TÒ“ÛÒ£ Ï˜Âæ3A÷™ ü4&hÚc‚È4&ìà¬r¬EÇÞxÑ`êWõ>«×ZŽÌêíöÉé;løÏÆyœ«Lf4ͳˆòpFÓcÍh€b‘ümF£Z¢)MžÑtâì¥û³W©yØ?ڙƊO·:GÞºÊ8PL{†FŒ”ùß€Çø ­¦ã@hp‚i’©ÑLàs›8l`ì³tpSµ‰cßLœj‹ù™Ô60Ë™žÙ‰³ÜL\.ý¿^ÆL1 þ a*tÀ‰C¹e©Ë‚cõE¦2mÇù•þ~qÿGUÀ endstream endobj 2271 0 obj << /Length 1325 /Filter /FlateDecode >> stream xÚ½WIsÛ6¾ûWðÒªSÂÄJ°ÓR/©3­“ÚÊ)Éx`’ØrqH0Núëû@€’èÒ©“¸„åñ­ß[€ƒ~8HHHŠ$M‚¬:ˆ‡Óv¸ÅÅóìé" Œö(Yžrà¥qŠƒåjŸÕ2Þ„Guct»ˆ(¥!ÿq1ÆÃßµÙ4‹ˆ$aÞÙ®O²Öµn•)êµÛ×Mõu÷•;hU7•ûê‹Pµ…2ø`,¤1£‹wË'Ë­ÚœpÄ} #õ¿ Æ(圌†bΜ¡EmöÛ°¯ûöª7y{Õis•ëÒ¨•Ê jžŠxß]X&ˆ% xàñ6æ±£âé>CòD¯Ï__Œ¾ßªMÒtq:™Z¥ß¼‹ƒ._±•q;PVE$±ÌÊàòàoÙD1ŠÅļW IÃgß{#&® I,GýnT«* 1ïæL%‚´?¸˜æM]ê9ÖlÂzpæœA*Éž±—=Áf4H¤2ˆ0E˜cG}©!pDÈÐGÉ­ÇE«oJ• p´[£j@è‚Àªs'× €ñ'·ît¦ü%¤nŠõfC è GÖ°W™=°Òp8ðI?Y«U§½œåÿ©3S4µÛfMÝ/ÃËïµlwV9£Z÷™M Ê„cFY¶E÷—;jVî¿ÓmÑô¿nú:š·1¦îV·mÓ¦@ð—Ýz>…g\7þ_ëÜÝ’Y 7ÖY£ …2zÙžÆý«²jº©>8ª,DºÂôÊúÔéÂ4utÇz¥úÒ8ÚbDž˜$Qj—#F0ÒŸ ‘HP1’¡§(£@ ¨ŒA'ŸÍÿààÕ§ÙÔç^R>Fî ŽD&—ß’ù€C”ÄŽÄå 2¿ðPžáM(Š‘þ~?Ò žÎäþ4f”ƒùOá5´l³~Ò QŽ€ô1‚œpêóÿùÉù|À€ßößlÇÖ4å –²¥O¯;µš‚“;ñZZ,ö­-†œ@û]9®>s<Ô5{¥ÊuÓfS¹íí¦(µ[vªº)== ›úp¨w¶Æá$<óŸ»ò ¨·yá˯ýø}¯õßz/ìrbg7[÷~œ3L š°y´î¥)‰~šcÃQB¶‚~vÚ½:>½W3HhÎþS1þžD/[ª#Fc$%Ÿ4¨2÷éJâ/t`D1v= (Ц„y0w§n®„㮩ôœ0ƒN;›f%B~%Ûh4ê9φĖh('Ð=¡AÎY#!¶"â0 C‚qÓ̶0ø‹ýºrurqqÉ~uôòüølyöò|N †‘6ÝiÁN“ðׯæÏ­_´O%/šbDè1©nL‘iW DÏMྯÃYe'7–Ø-Œý7€J`Zû¯×þ“Æò“iÜ´qç= ÜßJßîüe¯½XHø9¸C³Ç„|6ª°Œñ~!/u×mí«8üEò~áÀ•7y°¯þ¦F&a~XVLŠ42ùðF–|å“cuŸ úä€6Oc9©}Gã`L‡šínÜAÕ i“ûûaP·úi öm/ÂûðØL2”P6)B­.êÂÌV!Ùâ­²¹ÛwÈ×ÃãÜg»þ¨³ÞUTPèÚe5$¨×о¼Chª U¹}¶¯Zx£I]AP'µÄ=Hv¯}—ì,TkUÔhÙ?Ǩà endstream endobj 2278 0 obj << /Length 1431 /Filter /FlateDecode >> stream xÚ½WioÛFýî_A¤JæšKîòHšiãN|¤Š °•&WÖ6©ð°ùï=xš’ƒ´M„ÃÕî›73oflØð¾cø‹×7âõ-Wó;CÓ×Xï³`£ÕÙùÛìàø¥¶Qh‡Ø˜-ºP³Ä¸61!Ë ÝÀ3¯.®ÐôÅÅÄr]×¼*X.,bžGéÄ Ì*ZM>ÌÞœÌwÔ¡ˆ÷¹Õ»ô A.ñœš ã!›E" H=Ç<ŸXØdå2ZØL xøÔ\d¹2â,¸ŽYrx`³Ê*½­7<ç1°—¯UÊï'€å<*™ZKx1Áf™óÛªäYZˆ8-Ù8AË6,`„¡buy/¼°üž³­Éê¹îR”@;FˆBÏñ4P€|O§ÿÆÆnÖOM®|…~`x¡h uýÁ6øía#7 Œ­Ü¹6­{e¼?øC%´ïº…8”hn4~í¿Â!D$$ûüÚ Æ´ëv 4 Þ|Ãó ² U^ÏUn@M²| 3Q>™$êw{y¶^ä1QZ8#J+„¨J Êì–°di©×–¶$PX¨.(§kPá>aK;µ ê˜b庈֛Sø[^.õAo@ÖñÝšl•Vù\›ñr—+qÄ®–ÔÉù»·O•§)ûTñœé0¡ÿäjv =y/RÀµ¢Ü áBèªKÐξ­/ ê‚.ðwë¢/GèoÏC¸ígwÀNŠÿ³øÅcnÊÝ–ã¢°Îæg¥¹ßÅFØà¶; ó…D¬ãɘu¦õoþ(ˆÃ㦴6"î;xÅWì©2™â7‡Ž@14˜cS{xúdy §ïà4WUÂÔ \-òfö’E‰¸[„½àBpÄä<„ ø'ÞÅúEtX”¢å¯=÷øÇWKBÅ”m•QfêYt~\äÙZY¢÷d¹äàsK¼‰)ÁS5ÖÄ»˜cõ Ã#…D ·WsuA.ê;dÈýG%‡Ã¼“?¯#žÞ÷ûŒ'ðÄc|‘‹!"˜ô$*AlÛ&6v.ɪÛ:·ŸŸí«Q•‘²6 *;t¼3º°âà5¦ÔÛsõø¢“g#|¤+cÃwÊQ³,LLAɰ´[°{tƒ]"]bNØN:øþ%¤Å"nk»][› "A¾ôÁe ·tMDö[ 'líPY_U2Åà£ð}6*—,^E¹NS¹lŒœ´zvû7‹ËBt8Áþ®y&NÌ_ž¾ŸMµ´¤¢Ÿi ŒÉ¼‹>±Âp?ô»S]—ÃM$p]L[\XŠà›­žH5(Üa;;O¢¾>¹¨QïX:D…%–GeöêX†Ï™l}90‹]M•DVvçK\˜úbWÇc’.zr—2ryàñÕ$ô†;Cƒ ? ~¬C’ì2 “÷uv‹u–ÁÀ¾ÓÓ=Š¡ÌH©u…֥ȊX‚pìš^ OGGM÷ŠM$Å v2‚3“ÂS^jN29ÕÙàúÖâëM–—Q}Ôa¼dñG½c1à‹`ZI/v‡¥úlï5Øíˆm¤IU³¢XT+¤.=ßòZQŸûq4î/®ÎÎ:—‡ßp7͸ͪ•6ã¨H¸`wk––èQµ*ûy‚C`Q—Vv2íåRˆR¶u~Þ†%od}§É[‰ rï,69D½E lµJŸœL§—Ó§udiš•jîS¤¸²Ò'ç‡òÇ>ó²¥}òçélþêÅéÙÕô¤=aýº÷+t ÒMV¼¹æk‘æ¬)PSþý3·‘·º#Pñ™ÄÙY endstream endobj 2281 0 obj << /Length 1219 /Filter /FlateDecode >> stream xÚíW[oÛ6~ϯ02l“ÛH!%êâ¤eNá!KÇÁ¬ƒ§H”­Ö ]rÁÐÿ¾C‘”%Ev ÙÓ@&%ò\>~çB<@ð®9p=Ëð,w$G¨z›-b0{„å:ê•?ÎN¯l{€‘1B#<˜GMQópð‡v¹ò7͆ºeYš}6Ô ±µ_h±bCÝtµ0ç_ˆ1¹dISšùEœ.ųR B&~A€PŠQ\(áÏb°Œž€Û¶kkoN¹Óà€v·íQ[ó+×RÜ=•i^dìYi)¤QFå‚„‚¢gƒãkÛ¨«I(*Ó2[„1HZ𑪠ð¹ZoKL³mÙ {ì ø©”¹4 Üƒ¤ÿß¾o{ûÉfM•7œ2 UëªÌïË"f©<¬ÉÒþâÑè% RJ¤LãÄct.á‡ëáÛ·1ù»’12¶[h>‰Ïc‰ÇV8³XZpÙàm Ú¦›,N‹ˆ¯:þ6úˆ-’Ÿ©`á+'¿Oç‹Û»ËËÉímBÒ&ô±I™IS‰“žø1Wж§¿5´/0ôó×TpzåB‚¶ š'.Ýô ¯z¢‘L[“'*–+ܾêW æ¿N+›+Q­(abŒy%ãw±à*^Ó3‰´0~A“Ía@Dx ±¶WÈ«[©`äc€‘SÔq]ÒŸB_Ū>fMÓ`]†2Jïnîf7b¼¢~¨ŠVó”ïYûü&nÊzǃÌOÕûÒÉ«ûW³¹òIÕ—ÝUAd$I¦dC;±–¹²mœ–¬ÌU&ŽD·È ]µPÙÑ© ¦íšä¿ ú®¨í4ôÀâP…uÇþmU"íÓ®„˜!-î-Kdò„A³ yvŒ ï¸Y¤‰¡^Ne8Ä2²ãdòÂWQ¢’E°¢Ág¹"êp àÄ€Ðn—ù>ŠÐv6»£G_•—A@ó<*ײýÀ/±ê‹=¯ò£Vsw}-FqËÓz_ÆÂÝ{‹ìZ·÷„À¯q_ÚE— M‹†÷‘_®‹6N°I ¨›â*õÂA{mQd£&b¼u«Û?C‚!j›m{ༀš–I Of³³³º“¬û× å½Á-úè=wO×xu1½¾›M„lzHçýÿåˆßâÿTé ê endstream endobj 2286 0 obj << /Length 387 /Filter /FlateDecode >> stream xÚ¥R]kÂ0}÷WaЊÍGkËØÃ&nl0´²ÁÒÙT;4‘XAüïKL:»ÍÁ`íÃ=½œsî¹—"à«.݈ÀˆtÁlÕð]9 ïÈò> stream xÚ•ZYãÆ~ß_1`1¼):OŽcÇŽm ðŽ‘Û0zÄÖˆŠ”yìì >UõUóÐp¼vWW_uõW¥ ïúÞåÑ]~ˆýCœß/ï¡vwhüøw¡òí‰q¿àüÛý»¿|¦waàAÞÝŸ–KÝ—w?{_žÍu°ÝnDZ—~¾Û'Iêý`‡s»ÛG¹Wö<’x§VYmc;3TÍ#úMÛìǦ¢ñ iÊö‚Yviæ™®2ƒ¥uÂ0;d^˜ä»_ïÿùî«ûéØi”úiÿÉ;:îWÍ颱ÐMÝE£ÌÒMýÄwû4‹¼¯è,ÞÿúŽ™§Þù“8bÕUGSƒTVýÐUãPµ xŸ«áŒÖw¶klv!aÅ¡×g– ÝŽ¤~XJ=¸ÛG¡E8Ê»4ô,ÿù}¬:íD^ù¹N]),ÍýŒæËÄö¡·Ý‡]tðl ÷ær­íÖ–{™¸?ŽTï¯ÓÆòçÓ¾·Ã~¼ŠUÐ^u»#“x†ž ÒÀôhë)äD•£µÝ`Kâ ?á=3‘|ÔÆN¦æ•J{%{£{5¥Î‘Ó÷‰÷aóZò¦pÕTÃ'¯Ø´zŒŠïp± ïG'ÿ¿v:Y¨±9Êç“›þüÍ÷&~ÅÆÔù{¨XÞÛãà‡‘OÖò+¯r·O"?K±k…˜ÿ•Xo”œ?²EY1y‘÷¥³÷1åÔa¬ðLн°Ù_w¡ç ŸG׆Ï|ÃÙ «t­Ç †Èó•é /ë V&+÷ ¿HúÆ~˜ê}`@>‰ N½û3›RzUi¶z|q nõ¬®´¼¼,Ú¯Gh OçN‰Ú0²¶jx†®¡`uÝx²gjÓlm±l'WHdc×èñt) |ÉàæzíÅr8 =S–ìºQ‘áU½R;ÛõЃ^5ÊŠÏEcñÁ+APUçÙô A¾Ý‹.\uÝkת[uCeûϸ{Æm4€ë(º"ƒ„|‹No­;ˆò÷êÀ«â‚*Ã4¡ÓÇyí.„…Ô —¶éi[˜ l?T2PR}fÞ·'¡ jŒMi»ú:åÖ!™(béÁ;¶P*t;¶#_7ÎbÚBep¬L]¿ÜlðK&ÝTÚÐÇa¤w/"£lOüM0‘ ЙŒéör<ˆFo¢ûi“¶áóëîN2–׎ÃÖ=ÄÎ|™\/÷ãXU÷emM‡eŠípinŸ w>ìÔ$ˆÂÀß’DY*Íàô¼7xÎÖ1AÕ¹D„¨P .8œP“Ÿ’]-¾Aý› šò[öñ˜n+Î஥ý@ѦãDü…1PCEµO$Ü;"™çÙÒÅàoÙÙ–k<Á ¨¿¶t"¨¥O›÷äÕ4úÌjïA{·¾D9j©>6´j8 %YNv¹Fds8fmòЩ³ÊÄ1E˜Y® í4R&Ý•o¾IáCà0uß‚¥¯dwü¢poì1`Ä£lB( 8d«¯u iãJ|“q`]N©Ôh¯,·§á…"…çt3IÉá®(¼É®ˆþ@ÓŸ«’ÏÊ]6;¶Ü~®è™PDEè ›ZßͯãßRno9šTEó»Ü•‹ówp,.,–è®|‰ LøÛ×ÕãYÂ^­#µé9†`9Ž!ÚbEFñë­Ö˜RÕÇøÍ×ú•“³7}~çV' cÂ)ÂqÇš¾’0Ìm×àqh¶:iaÛò…É«,ø •>º8<Žú¬íKÕumWñ»ôê`áMõûh¡ï8 5áaÙ/"¹î¤Y@IöÓØÇ…÷1•]@£üÉZ§ÿ‚ó†xòÎ5ºöa@œóõ OZ±î^ð4œéÌà)rñ| \DIƒ‚Vòï[‰¶ÁУúÿ¼V<‡N$>‹8™ÃføëlÓ(4šÇ1]ùH“ÄE×hé|ÜEä ±ôÒaV§^µc¼ëgŽ9”²¾t›¯wz ;ppqëhzÛÏDzþ£òç*7¨:¥Ö ÆÍzíé²CJJiÅþ¨ÕŸMwE“m¥jެÆ4°I73O½šU*"ļdýbðä56Š×/õ, £Ù¥h)Sþ‡áh?ˆÜJÇ1/¸ašGRñ«8æ@ÏEaôpnl¯~|2Ç’MxìOšå\OÝYNXG=$ÆY骃Y.ç#GZ'íœ'§~dS !yF–}¿+¯Eû§Þn¥Xp³,N–YR’g$y°¨µÀiÜ-+gdCÇIú9¿~dðÙ9ƒ6¾ó6˜ÇO.!s‰´Ô­tuDUjhJ"H\Nø¶ú]*_αP>AtK7@$„’/­DŠ0e×wÆL9M¸\¾¡8L.Б‹ÛÁÈîk¶kP Ç.y›±ûäøô[o‡ßžp‹ m„&R :M²»ƒ÷EYV,cÅât6MaÛ®ÇA8ôJ˜‰I™až¯ý=ˆ ¿¹$pIjÌ—Ì¢ &2YcˆPçRÍê²aúy–þÑeéÀ›÷SÿnfÕ?š’3R0®Í!ÜÝœ±B¸r@ö$·Àhñ‘!%‘áίè4>ëVÏ“>ÀñMUŽ×ч:^޽šb"ÞF‘KWšùÊ!—&ŒÐ‚ÐÓ:â5ÉìD=88@#å®–&txŽÜ‰Ë¬É` |¶Ìb:l(»KêÄ\c/“N1kÝÀ­®™b«5µí—î©þQøœÍðÙ%LOϲ­L˜É«hÏ„9Ú ôNzkl¡¯ªx—Æ)4·ÑÐâ UQŒ·Ó©.ºÂi:ÞÆ‹Fi®xJ±N¶©Ï/qÕ»jDzZ(ø(ä¥2&h>òP뢮dZ~ÎÆêzO/§¾‘¥Î»9‹a8I€Û‚¢Ûöpúç©J4 7ÑR3Z` ¡a”#“…eÒG_p°‡Î ©¶@Ï7)$'· È1äÙ[Ðf(U÷u)¼cúÞñÐe.¶oÝãºKdâiÝáAæ®Áèãt;YTh3ÀãÞàq—m•çËÑ™ `Ž›3˜+’tæX€¹y…`ù®½¶´•ÍKõq䘖s^<Ö%Ús‘¹{ž.vÅcZ3ó‘Ö,S’9‰!ª\Ä‘L)÷´;EºhíQRìlAnµÂ«=wÕ`]-”Œ+%‡VêÌßegH.4ÉX©±ÌL¹h%0•òç³”á²d]ò!WÌ%äh8r F/ /Ã/O—<7sÀ•[0û‹,`l0ÁXA@â ½÷r,Ö¢é«_K‚õIj´Ä¤lÇÎ:‰£Œµ™a?[ºÎÄ 1ð¸eÇãžÖdéR\ž¾Iö¯Ín­‚ËãÊR霎Fém!Ù‚aŽÌ"ù5 (KÍõù\MŽ4]”viLJ»üä7º÷¢h˜¾*®ÛŠ ¼êAÌ4wfºÀïRó8äËl,*à‡\kÇÔp?êÈtæÈ‡¾Ö"Z6 8ËP:!g'‚;;§j‹ÄŒvD€ßh·¿;<—öBá­´›ÑO„ŸKÉÀAÄ tîJ>y(jØiÙW8ͧªÍk¬G©GpØÆz$ÊÕz7X/ñ3‚¦:“kL‰¾Àæ EL§p8†Ç)`n(*üC2-nm} §#k$¢Œ6ó£pý®£Fƒ=²AñÜ@ÎWlœ¯$2"çÁUÅÞ8fFH7˜‚`û˜E:Žš€pMD£ômÌÜ‹pÝŠPëmá\Òã 'WÉ¢¤š¨ Šmò÷*?w0P!d«ð-OüüNÿÖ£UÿÕìt~@¬º©¾ïâ©,•lÜ~2³êÒÓs•. éF,aT—„ïßœÞ颌ö¿6<›’PÒÙ*Ð,pS[=åOîë„¸î æ|žã­ËVÇ)-lÿʇ¥GžKìL©Ü·3~4%‚Ñ®’EmÒ=Ò0JŠˆ%ÃüKÕ(äôŠ»Ì;Ò{L9Ím=.ާÚM2Õbˆ¸„oo%+ߪ‘ÖŸÁ5e«(uy¶l®yîÉc•ŽTÚ×W²;Q"†ç„R€'µ£ý±·“a¢® êd—ºdK@!¶RÓù©©¥$Ãc/ò²oþÒ1ýx£i°”ÄÄnÑs9LmËG%ÙG7u¨> stream xÚ½Y[oÛÈ~÷¯úRjÍr8Ù¢NâxÝtÔ²6[ƒ)‰0E*¼Äu‹þ÷ž3gx™Š½›E ÎõÌwnßó™ ÿøLy3  5[íN\Ý[mfÔ¸:?áfÞ&.F3__Ÿ|ÿNÊwYäF|v½ouÌ~v¸Î^$ÂÀ¹¹¼aW§—ó…¹©Ó [¾óc\̽Ðiã|þËõ_Oήûã¤'™ôÅ eëf?' d< A΀¹Ò'!OÙ|®sQÌ>—N³M±á;«ù‚;qm¾šmÜX¤Ó÷E‰â?]G’Vùc6çN±¡®$«›*»k›¬4“²š~ ˜Uš-W¥†¡ÉàG9mÙÖt(¬ë·YUic~ÄÉe‹ÍxÈ|šá‚qÉéJõ¶ló‡€` €ðYà€™ž÷3ÅÂH2å…ÝŒ¦­ ÒYùÉåbrKÀ2úêŽßïˆèá†q’dˆšA¹¦¾~°(³Ú4ï’Gj×imþ4%ÇB,å.¸dadh‹¶ºMwûû[Xz[ïʲÙŸ\éîãêÕ Çq|ó)É~À”ìöôhÏ×#ƒ w2“±`ë¥UÑ•+3žÖ{pŒÐIWYœçær¤ü&­ÒºI“¾VÒ ë¸6ûÖñnŸü`8ß”UÖlwôÙÖF¢Ï3ÚÔýlÌîÓªHs0pæ«Û·Ëë«Û×þñæô ñûó$€^ȶoJŒ !¸°‹MŠßÉŠ }B-cØ´ý{ÖU¹£–Y9IºŽÛüª¡ïó¸­ë,.Žmщ2]dë²ÚiÇrmŸ¯ftUW`ü`þúªœð¿”´æÝ<òaÏ(”tªt ú-Vé  Î")=ÜÁÕ«9hµFùãéÕwú –"} å;Æšû !GC•™S"KåÌóûIxÀ¢h3KЛôû@1(Üca9%‹tY ü‘,Óþ%xÄÜ€ÛPŸ§ÆÈIŸ Ù2˜_¼ƒXÕ4Š¢Æ&-Ò*nÊŠMºà>ãJhõeb~V4‡ ¶>}ˆraølÅ´.«}îS•H¨™”RGEÈS?ÿâΓc¾š=艻™`žÂ½òÙòäï&™Y‡yAÄ”K[q/¢C?ÎCá ÍLèTp°þ#<'nxL Aû•‰+EmŠ4™Ú\zZ{»:ޤP,áó†(Ø:0†A“—iž®0! ©Ejkú¥¬ ºÝcp…‘ ó%wìœ{Œ®$–ž—@œÀ\ Ñ¢Â&s Á]ÉÀyÓVà§:)c|¶NX—9™7|Ð1{ïq²Þ¿¦íD‹©B9ÅL&3NÁġޞŸÞ,—@§¦ò·bÁ?õa•ˆ¶[@‹s ¾ö­AöéÌJ[NËröñôòìÍ—ï?üôŒ<´öl)Eÿ"Ó'k$¿xß" %£—òZ3·­bÃDÿ W̯¨³{ƒ ÕæqÕõm.¯oÞž]^¿LÄFôö–ÛipÙ´‰±Ï?š€hç7ìyJ@]@ÝTijæéR]I¹¹â¯¸Ðß>œÃïÅ›i>/7 c¶zr-tމsÞa0ÓaüO7#ÛÕp ÉŠUÞJ ]ÃîfŽ–v f Ÿ2ðy‡ôÀ^ÑŸ\A;t ³®Ç'®§}ŒðS‚691¾×Gß©$Io r.0­ô)i#t=V…Êæb&Ñf5‰S”¦Ã„&wyÇi˯SIà-cÊp<³H r I©ÑåT¶J;©¡`jÍ–úí@ Ñ{ªkG;2ŒòäA†ß‰$ôøð峈«ßƒ'„>ó£~%ó\ñMD!2'½e„ÿ¢p”V‚yzEÕqäüìò;£ì,ˆ++dZ»u62 eæì¤lÑf'÷­kÅù~Oí ·“ù•»’¼_ «LX‡-ïQîãB“g+†,;RÜÓ]½;Ü;À(?éTOY”b_5£ÂJÎlj×vÀ1t–èÂežäݵk†½ÐÒ1~Wånß";ÓZðP:å…È©÷..’‡ IšÂ0¼†¶®ùðÃ,òÃõLñL}:³Áï— *%«g—Ù.û7e‰°¿À7Ir ò]ÚE‘®4ßð˜õçv¨ç«ªƒ]þÇ‹åj—‘.úrÆTýEÒ¥àÃ'[wÂyOÝ1>%ÔÎÌÚMöEO.¨û?§óÓ\ë}O) ƒÜ_èç'ÍthàŸØZxßKüøâÂï#Îr=Õ3uaó_½ŠÓ¢çžøažG\q%q•s=ð´:íÞî(Oá$Bcà´d¤£!:³K,Älçé_R^âpt¼”Nçöö}hFÑØ+|iÞ;|Ù¯„”µJiH×42ì¦Dƃ°5àÆz\Îí¶- ]¯@«J?·YE CòýѹžØç®Ê /x³…‘Ûò B¹ª ÇT†Eª>¤HÕ(¤àw ÷°òž´¥.Ò‹ê#”éDQõvŸ7ô¼†‰=˜ÇAåd½”§%\™á}¤s±žŒï‘d‘ê‰Ê€èWT¸èY`hÌ]hSѦ¬1nù ŸjÃCa²~V.‘Tš—˜×!êö*C¶Ák~0¸Ž îá»ü è„áÞ=pôˆ{LbÂY Ä!&Ïöèe7«Ù¹ÂNãcϳŸtxÞ¡«¡™{!Uì^èSÅŽ¦ŠcúY†Ž3UÒáo¡×@G£ÞtâuƒežÓуv°sÍqt×4@zI1vëUúa£s;ÏW,ò•mjƒc@d›Œò§ümì{T.p߃DØJ¸,¡xK»Ø¤ÿ"ÕȺ×SýQøHb>éÏ<;TüÎØiE#:ƒŸúF›Ž1œ˜{m–3ǽÀ’Òa_Œ™wܶêkÄ#Õ—F퇔@šÉŸÞü1~´3^ž ý¦1½xL§ !ÚuÓj»¹m+sâH˜í ñôÈ®Z5i½BðcÌ=óÊNö)äAÉz@+}¬)«²Uœ?}m˜ôØo¯Ò° úq e endstream endobj 2299 0 obj << /Length 1905 /Filter /FlateDecode >> stream xÚÍYÝÛ6ß¿Bè“\Ô )~Iî!½nÒmq—lžš"ÐÚôšˆ%9’¼{¹¿þf8”l¹Ú4Áâ°&‡£á|ñ7C®H8ü‰Äf‰Í%Ë¥MVÕÔö&¡Á›×"ò-qyÂùÃÕÅ‹WZ'‚³‚"¹ÚœŠºZ'¤ÿÜ–ûÞµ‹¥”2Õß/–Jéô7×o›Å2³éºÃ•nšÈrãj×–½¯oh^7õòP{X¯ˆÐ–õº©è«Û…6iÙú²w G“›T¨bñçÕ/—W£Ú:ÓL+ùDî¿j!X¡u6šƵ"C}Ý/ðÛôPÚ®ÚüйþõëKÔçÅ+ÃOý$”dZjØ2|ýžkNlº8eS,U"Ó»ßß½lû4*œiÉ„°A›,/PÝ?þäÉI8S6¹ œU"YfQØ.y{ñïhÓd·L[&À ‰aÿZä2}ùæÛhÅÄ R°\äƒ~û²-+ÑîæL1³F ¼ßQ4×ÍázçæD«‰èûܱܜxQÌm [eLå6Y ð•Q&d`žŽ‚§y ‚ÕÑóÒK “:·Æ‘Nû†(«¦Úz‰[GÔfßûªÜÑäz!RHÚ;¿î·DÙ´˜Á“/öA™Æ× øé£” 1Ýzw7¥T¾ö•ÿo8%HG1`D²Œj“¤{åʸ2•FáîX°hݧCÙ¢¹®mñ"óñ·Ÿß^Š”ÍyUäÓú¢Gܩ姵#s]ç÷k¢Šä¨À¡þX7¨ò]ô kßõ­¿>ô~ø&8%~KNšñBM£Ý•Õ~¬æ<]— &ŒDð»ýŽ(Æ. €ÔŸ#¯Û”‡]O“×å¡ë|p(||¦ ¬‡Dß²ëí&ÜJÖÁ€”¡ñ½GŸkfxñT÷fvtï?È Jr–çzêÁ¤‘VÉ=ÊŽUzµu˜ˆ¨¾`7¢­ûtð­«øÇb^"±‹+¤mCv߸92À-ôÓL€¡8Y ¤² ,0LÈ‚Ö~¤x|…˜‰ÏÀÒ<¤Œ¶Yø²¬“ Â2Ë|>â]Õ4ýOÛ’[šÛ¯ä¹bª(#áË/ò<ç %‰Bÿùƒ®ÔP:ŸAóiä/ -ÎÎ÷LèVÛ›gdSf‹¯;ÅU,¯/Ÿˆ;Bplžnf¬εÏ6=-Â8B¨IqzëSxŽ’+âm@”0˜‰Pj$éhŸ‚6 [Iƒ€öÀ7åªÝ&nÖî·Ín‡-$Ò¶Trhò^Hu"ä›3Z· HÅÏj àSØ/+ Ôºó=Båg"¸›ªYaÓ;¿ÛÑJÈ`E–¾$b¨IµËƒøÙ`G U|Gdç`”\0nÆñ¹å¬0#v¶èH¦¯i›ºô·èGdàÁ:E¼– Ë©/^bq6)}×~¦Ù®lo ÏC„È`®ã¡ì›¸1¸H¹ó¡ÊÌÐ-˜ãE ^Eʪi[·B'­ƒ9Ú„_ÓoI?C”rˆÒLDï¶ž3:¤#‡”û}Òå?Q·ûLËc8L¨•!,Ûè´äˆÚíb˜ú d÷Ñウw{¬°>ÖÚ@MIÓswâR€ói¢’UŽnf&‹ eG‡Äˆ˜á°M lIŒµ“Èã©'ÛI¤Q;¹&öÐO’ûÿ†È=ÅS#†£²=R리1íi¶)[’TÒ …•òÞˆQ-eÒZèÅÑÛðéϨ„ÌÑ]¸‡Á  Xcjòp@ôTÁK5!õ1‘ý˜€ÄQ¡º‡®§Õë`×°3d4exnÆ”¦f#ùï5B_ÚÝ–íj¨*g%ÀŸOÀÿo—Pý®MT*R}I5³œDY)Ÿ¡û®m3²3É€cà¿ß‘Ò2£‹G{ ·ý,Oê}ž3j6Ú¯5¥!wï{ìÓûžüvÖõHð¢Ó®g<ðæ =rŠ8÷ñÁJ¤5A¥H3Kê,Àdý¢yÏaª¢usw2Їçã]1VÎÑÆ©öÁÍâädj`(Õ(ïêÍ»Ë{n¨E6z•€ ¢º8ë¼×OXyÑèul6¸„û±™ž„Ó2¥¢˜4[Òä„â@®À«¸£¥rf)ÜÒqñT=ð¯Ö<ý)6ŠÔ‰¡Å!~("Qœ¯W­+;7•žce½$R³™C}b„\˜wô’È;ß÷»Èríû‡JDÌùÙð©‡C`^½üõí|ürfŽ8l› €F€Ñ§”}aò·nœ ì¥Ä×'€’ ²NA÷+øÞÊàb$Å9ËíSŸF‹ç¨)ùRs– ñ8Hð¦8ëÜçñCˆôÃÞÔ2è ̈ǫä±¹E€ÇÚGQÄ2¥³)Š„wÑ[o%,þ¿ v7å¨N ¶ôK®öìßH¡'Pa†JâÖøXàÓ˜,Ã𺩣Ôëcï¹,$ãY>õvÊñ9­ÙLŽnå±3ÿÇÑ»ñ%­öŸîù2›ÿW|4 endstream endobj 2307 0 obj << /Length 1852 /Filter /FlateDecode >> stream xÚ•XÝoÛ6ï_á½ICʼn"õÕ·vM?–¤({èŠB±i[ˆ,y’Ü,Ø?¿û eÉq–¬ãñx<ï~wŒœ…ð'gi4K3%2•ÎÛ!qÛõŒ‰«÷/¤• @0I¾™¿øí]Ïd(ò0—³ùj¬j¾œ}ñdúA”«,ñn>݈«×Ÿü@)åÝt¦EJ{—EíG™·/*ÿëügóa»8ŠE¬ÕÚæ¤˜‚J„`¡30JDk60ZD~'‘wæÒ»ü|v¥±÷/Î.?—m¹ëh¸,;_z}[Þîû²©™y_ö¦.ÊÚ-Óeí+5íÆÒkª‚VÀ!ÁiÙØiá,ˆB‘DŠMºòcéüù{_¶vyËWvíÄáq*P@ ›[ðêwô¦Y²s»b»«Ì©=ZÈ\È(ãå×»acúy~ÃkÓûÝ+?Ðöª?J½{¾à¿Â8,:¦­dQéxMÛ›%Hɗ̸F¡²^“¶Øãc´<¹*ºž×£Þ’"ÆJtàTTóƒ‡dç–uÙ?{ººéy÷ÍßšFÿÔN+Ã7X/èóì¦_>\aø•7†ÁÛP[\›EÚ…ê+j™:IìvÍyýp”…ÞÚÔ¦-zÓáPz-ÄmQ/›-¿ûqâméBoÕº9ÈHâ˜íÎÅ>!öGœ~Sô¼¤´JÖ%_‹¸E—=0í´N¢”Î!µÈµ†¯2æcpÈ?HeäÍ7¨^GÊã/äBSæÜ¢¢¦+8¢M@¦0áÂ% )hV,Óo 3FgEþïoß žx]õ›f¿Þ8ygÂÖŸ/Ûð4¡=‡´ٯצèQ6Ñ—ö2´Ÿlãß»ŽgÑ:œ¼(lFá.gÏMÕ7V¦C†!eq¬˜òÞÀåW>P/‚µ÷ÎGÕ¨ñâŒT^/ÐU›¶X›ƒ^™géAï=ÝÓˆ·À 9qæÖ,š-ä *בõY¤åÔgȠ𑢪˜Ñ!ƒ“¤·@Ê0·´b›Â)â¢ñà60Mkz©0½lÙq·뮃RydxÅýõÂrÈå°ÔlqßF‡Ãø||¼i(HëÕ¾^FäÔüÂ!˦¬åÒðÈ  («âƒUÈA«&"£üÂá&:O½KpBc‘¶oXAáýÆÔ§n‰C?IxÖI®_´¦èÐvœdÆébKSwp)œÜÈ8x¥GÀ!y‰E3FîµÕÝ7n3Ÿnœ4Ø 8·A k-:q˜}½4mõõƒËDk¡éÁ­=yJ§Þ§‚Å$Æ0¥bëd^¼¶$]€Òn.PÕX -jlÑ5V!×:HÉŠ’§ ãtVÏè"AÄÂØã`³«ÇF©ÃÜ‘2¨mÀÖDHÛòÌm>"†a°“ßGiÉ0‹ó»–ã ‚ÖÍÔ<34s8X5-Ïö.¿ºâŽbpœ[\ÿ\•éi"¹Ã»‘ÚûQʰ¾cÇ!ï\š5ÄEGz²wR>`†Uò©”€Ž@ǘãþSf1ÔW5‹ÃTÄ©¢þSÄ0Í$üȈÑ)gÜ‘ºõÁHÁ‰–ùxÛYÙtBk±G•lî—Q?ŠS!`9y†¤ÎM[›Š—v[[eëõW,Iìíòa^êôQ.3¥râÿéÀ­ô3ç=VJçÅ:#lW£ Ã‰RYeÛš˜þá#€^}ÁTg¶u˜0–‡ËªaæŠ:àR Bйܸ à†ÊÆwBeÌX£h·MÁiIAËàšu[l_b'@@R³¨+šd¸ý΢èŸÛº°élÑhHîa¸>ê¥ûmCÒž»ïÝó ¶ªyªroõTk$¸9>˜ðq¢DnmûÐà£æž_8s?dž‚hxÐjmÌ »UzÒæ‰‡e†[O¨\܇—‘«ãmHiž9T…(ôapÔŽgè6v§Eú©Fç›r[é†=U~{|n уÐJ´ö‚ŠÖÂpÝðwW@,Àµÿ{ˇ žxÿMb}K1x uÊ©:J*÷b€Þ&V„›ŠB&ͨþâ—[ F ‰ÃÞÎ@ƒJR£íP œ'4éÞÁ(Š¡ècÕ‰Zç3ˆyúþ,‚ºõÁHÁ D9ÞfŠ h#(eœÊ#Ö9¾×1¬âMµxÀ±í8úÜåc;/»ê1Âr4¬m|œ@X¥!;’t¦r-¢<{at0?ác¥ºä‡÷H±<™ít1o1Júw˜ç‡²½Åw­Á6•Ã3™I)ò8Žˆ‘H»Z…«oŸ__ýêãÿh@ϾýIV}«Í=/OÂI=Ô¹È ÂÁîÐî’O.]@ùwBÐXv6U’‰-Q&b=<®É”·¯çΘÉ=Ÿ²% ¼Â‘O$d à &rTïýÿÁÒ¬Š}e»Ã)8(nž¨‰ãβi… ’ÿjB÷ endstream endobj 2313 0 obj << /Length 1018 /Filter /FlateDecode >> stream xÚV[oÛ6~ϯÐ#5L)^$õ­ÝÒ¦+2±óÔkѱ€Hò(¹yèŸß!%Ë®DòðÜ/Í?žyR”‚–¢H6í T÷”àæþÓ|0f Îë«?>*•pF+Vñd½]ªZ×ÉWòçÎìGëÒLAÔ»4“R‘[;îú4Ë RþF’mYžlg›î Ï]ße‡®û ÎtuߢÔTib\cF z8×¥&\ñôÛúï«ëõì¶ÊUR¼1Ɖû—@ TP‘Næš2%1PE%i¦tNnÀòyµ' I~úE‘O¨韜i[¤õ[\m»o\³1Ïx¬›atÍ÷ÃØôr\.sÌ’,gTç-ß§Šë?ÿ9©ßEÙ“ú¨‚jPw`'¸sÉH83^Qž—È¿ÚÏ–Âçu +;f‡}¨º$­/yIj__û;Vp•rbÚý3Ô;öÆÖ ãýÁÀ›®_u¤ëGlŸŒÙÖv)4ßhk/—d2§Z)ŸzÇJŽ„ƒõîRŸØ8ö²B-´©?B›ªc›zÊÖMwÀÖE øãI £ãÎŒx×D%OÍ…Ì€ÁpI+)afá¬ÒK±Š9Ç"4æ¦î;‹»Ã0_Ž;Œ30BÚJ>Ö Á5OnãLƒ³ šrQ¡ Ÿ}¯kèÿïƒu¨¢öIþeŠ9ã)/°åÈV›ÑàÎ8‹›½ëƒù¦ž$_‚¼uvÓ·PØí²|žp}{÷wÞÞ`í9JH¡©‚žÓ¼¤…B”  î`äáÃó§”%nLòÙBÁ€<7çdƒ•öþy$‰Yøz}›aU!\Ô¾,ëÝŒRœµŒ§¼4P<ØåäËܨìCÇ~ÜA­¿ùy„éÛßÜþžËâZµÝšÃóˆh{L<^žÿuê÷=l}¶ endstream endobj 2319 0 obj << /Length 659 /Filter /FlateDecode >> stream xÚ­TMoœ0½ï¯ðÑpý ä–*M¤H»i7l.i‘…$Vw¡1°éÏï{·°mª¨ª8`ã™yÏoÞÀ…‡¡„£$$ ZogtøjŸ_,/f,ÄÅ"?æ³çJ!FIF3†òÇq©¼D·˜)Å<©Æ«ÅŠ,OQ,„À«¶²n%ñ¼¨#žâ¾ØDwùåìS~€S\%Å;¹í£#˜AI„Ô|OkB•ô!)Š•æxÅ WÝs´.[x% ?6Ö/ÖM Ž;/†û¦Ûa»éÌ.ÒÖ]åOJÓvÖ<ôiêÖÝÍS„‚XŽ E10I³Ì3¹Ú¹R•Ý™êÕWhƘÖPˆ1Ž2’i®C¡”$:Hþ•2±—òå O’,I‘Î(Qé ÎíE%œ]"JD–¢×!r‹¤„P-a½A׳/^Ä) Œd,ª‰4=àÒ?àrÂà†šRx‹¿áR”J"Y2†=2—´éD*•G{mÀACËÀZ®eƒH*'kF4Õ€2¤¹vBŽk§3Ÿo'¸q;l‡v*ý«pRF ›Ö™¤ƒÕQc§<ã€C³™b±-¶ß7•§øjºç¨8òDì9öuoï}Úý®Z¿…ä2b¦ ÁH‹«e” œG©Ä§'žý²zé­‚D¶¨¿ùÕº±¶Úî*A€LûÃuéÛÂ>™&tØMŒM-çÀñ]oK§ãÕj‚²UN¿@¢{j|>;ŸV ½¹ÎÏN|ÈEUW¶èšðÏðS ßz³ébSû]Ûã–ï¥9¿ÉÏ–a,t”Ž$x²Eiü¯ªó1ÃtŽèO}¯Ÿý³ñ§ó?-•é™>ŒsÄ]$ÿψã²=îOMøm endstream endobj 2326 0 obj << /Length 1677 /Filter /FlateDecode >> stream xÚXmsÛ6 þž_áÔnâDQÔK¿uëÚe×ôv‰Ó/]ϧÈt¬Í–<½$×íÏ (YT”fëõ.’@ÀàŠUÿÄ* WI*y*“Uq¼Œ´¹_ÑËõ» aõ|Pô'š?®/~x«ÔJ< 2±Z簾ÖÛÕ'öÓ>?uºñ|)%S¯¦>XùaÀãP’CמL㟿ú²±!Û¾²{kS Á€ÙØvæØ-Ü• œcQ"Ø®ÁüãÚí‡[~ýú‰å]“7_hå÷@­Öó›IÆ“4Z%â°ÇÜW°i…?"4WâJ¦w3ì÷'@8?ÆE":››Ÿn&± ¶õ³áúè:$Tx ܼPdÈ\Àçï Ž§ü^à ›‡ƒxg!Sñðm¢¾Üܨñ ò-ø(Àñ¬Š ²™’úÍi‡ùó2(¶ú›2]QÉJ†pÀ§ ”@J)%¶˜¡¶—<3æÉ­l Ù²*»—AÚŸÈ¡ºéô–.+ y¬f‘^Ù:ÌR¸Y|f,§ÏÇ&·& =„H4Ú“!']`!—ù–ÇhÚ™úÑ#XÝ>¢¬nXÃêFªnØŠlÅz€7B*o]艈gÑ€<1÷ü8IØe îáð…Þ=“?[ú4þá‹ËFTb-‹€u{M‚s)‹i)£ý='´0Úÿ³Ï”=pe¤\eêWï(N¼´–^ïúò€´\HC·§€#®—dmØ/Ðð¶`Î>¦`±Üѳª­²-¬‚Š'*€Ï¡ßƒÜÐ(@õ~!ƒ68ˆî çx‚¸„&dØlBNÙÆ‹®™1LO³¬Ïc 4òáöýû%ªñ='–q¨šÇ©¦´3L£»¾Á’ÖXÝè¼edwpÀ6-yfMþRcߤoz~Mï·­^r v‹ÄxF`o´!•¤ˆ| ‰‚ó ,(4`‰-X°‡¹€É®suOl€‰þlƒ°€oæÒðed 49²®<Ï*Lðé71Ádï2 OgÏ„.É0Á™veäV– jþl!Ë-ÈçhAE±Ó×yµ_cnÔmðØÞR s!më¼É§ƒ™š##š€újúªÈ±Eš…'­@š›zÜ—bzO¢"¯HýŽÊ˜> ™Áæ¾°Æ$¬Ââ»ÅlÏ«ûÑÛZ`@лºãó] æù¼4­L·ÁÊÎésF{ Å÷£Î«vÜ·Pí"rMÒ¡Úûªo6Æä¦xÐŦÕ݆ß4X õ&Ò€§q6X(òï‚-íáUݑז Ú¶¼;h{]2ŠÔÒ½.lÞ2µÜOg#‰:$‚4dĹÙA¾×äÇühèpÞ’>M_SÅ1¿ðnò;]¤‹«[mfOåÙ`ƒœR-åyñZM¶3Î-e6ŽÆÆyÎD‹?ïŒ>´òo;W“§Òm!8ž)m‘g}{À”mß"ÁBAØà€f½Ó®ŠI³> stream xÚ•É’ÛÆõ®¯à¬ˆº±;'ÇŠ¢¸,953r²¢Â=$l,4ÎHÉÏçmÝ8 ¨”ª×Ýoß(µ àŸZ¥z•f¡Ÿ…éjÛ¼ÚïV¼¸ùû %x@ÜL0ÿz÷âϯãx¥?rµº{˜uW®>x*ŽÖ‡Yâ½÷Þ¿ùþÝz†¡÷~0=®"ïmÑ®uæ‹zýñîÇ»s×Å:öã(üFÚ,ö3S 0ô Ð¨?ˆ#&>òõz'Ú{»Þ(ï—»W7@X{ÿÅGÄÐc=V›_Öyä}UŒ†1îÐíðÐõ)øÊ´C5®Cå}aÀùÍlǪk‘?W6•W°ÚhåGJ¨¹YÇÊ3øçcÕË‹öÊïäÛ™¬ãÔOàú°îv›m×n ”å#þ1,Þ_ƒ8€Mx¨¾zý’¥¿ë‹²2$÷‘ѺÞ™£/Q¼¡k7:ðSÅwÿ|@îŠú*‘M¶y¥¹v®|{pâ ?×ÅpkÆÍñðÝzE‘7ÔÝZ§Þ“0}[4‡ºjw²[šQcÚr`ÐÉ¢¬Ôá²Âž³Ï:«Új¼J^Û|U¤˜5z#XηɃoz0lí–W/ýðæ§WA$\ß‚)úJù¡ý…¹ý¾Þ!@ÅþGFùðÓEž}ÄcW›HûIœ‘Ææß²Ä*ó ~4äÁà#ë8v.‚;lŠ=I“hhø÷‚q·Î™!Pœ¾ý€ƒnÈnD4ÔÁ˜ó˜çQ’®’ ðužPÌÊWø£49dEì÷›É aîü1¾ }1ˆX%,Ä0‹ùPˆC*­€ ?‚eÜ;;Ã+¦ç©8ôÓ [ÅYê«(¹-öf‚¾@ÿù¡D:=“1î‹‘WOh¡]¿VÞïB2ÔÄ[‹!7JR^eT™¿ÞdQì½F-Û/Ç}5ðª1ã^‚‚ݲ‡tMQµ|%ÚŒÝ$fŠ™$yŠs”Õ0öÕý‘UƇ—àóPôc…` ѸÁ‘¯ã7àÁ¦òžªqÏ@¢§˜E¯hvÈÆ g+¡”leÅ’Ä)®NqŸ“Y B>òÌ9Ã;·]Ót­œ›‡Ö¯FóœèÈ»£ `‡T‡‹‡c+öˆo$ HWp‹@€o å¸I, Bà9íî”p¨ ¬‰!Dâûà@ñ]`»Aþ9š9D9SŽBR=M±EèžßHÑ:ÇÃà Òð˜†Â#î÷l[ÀS½îÍT6_Ä;žÁ¾µ ¬+Á·XlzáI=”$‚Jì#rÕ.iˆ…ÆÎ–Â` ‘¾;îöö]pfª‹@ñwvgN'Ã*9ŽÅÔ ¤=€G+8>¼|wƒð ±×@Šj%ü kÚ1¼¨ë³#8|&B[,` ¦<"CqQ1‡’M{LX¬Œ|DñM×˧¥‹ªк}º\E~E@Aê§Z²+?M¬Œ£4…Lca½)ØýJÜ[[ƒ5ÙÊX …ŽrŸ²«ã6ë=Å0b<Ùl‘=¦6*®©‡É©8,Í]"™ƒ9£Ž|Ž—cìäÕhúb™ÕX3&¡7@¥2òò‰6±.—ˆówõ±‘÷{.d°ÜÉ bÏ‘Ù`QÉ1ËIBg±‰„ü”C^ÇouÑï¹8Dæ(Ñ ^ÑÚƒQüŠvÁr¸º§ Aè¤, ÂMNúLP¼Tôsˆ`Áùxí÷¿*B•ŠN"Y+q¡’öÞucµ5|êžkB’¶x"fáîê\8‰•Ûw!èVx*>«hK~ï æ|9Óäv$aYao‰(äÚ¯„ Wpè8™%ÝAÖÿq“uÖÛ!îqí1ð6±ŒPÑ".ɳ v«cÀâN_4U)¸lVˆCqbª ‹`„JºÖçz~ÞµºÀMn”‡Ì⛻̧I/Úñšë¥¦ %¡ôš?HÌ ƒ} Ó:>9µº°†)ŠÝðÚРÒG`€$  `•CMb¾< ;J¾Ž4‹jœiGŠi‘‚M5\¸ ‚p·`¯Ã¾;ÖxrNÉ@€ÓÂYEIA3Ý?«Ð`Ë}°[ðCܶb¯e´Ö½Í;ˆ3%GÜU>îÙ *²8:uªm%Ù;â.—sR¿!{RÖVÜØÓÝ”À{#HP1€è®G-;ã,,( þrEPb,夌%’ÐoûØdÖ;»ÇþSØFsšª½Öø¾uO¢/iØ ýÃSò0|g68#Á’g\Τ”¸ÜÂ9—s­–üÂëJ æ+½Äm˜j?÷úÿ½È è4µî¥ÃLA×‰š› Ž$*ä_§§è…u zŸNmÕˆ K/m÷}õ8}œE’U’úÊ¿dô%!ûü,­ýH;îÿtõ(kÜ3ù@櫹z„«KÛšF:ön;‹FIÒÔÐÕgyú-YC€ó Ù“fd¼&ŠÇŒ¹ÃçAË?dskÓÙò·.¤„}–äf –ÌŠåØûOÍãXöŸàŒO_óÆ>X£ýr Ň¿è†Q¨ü$Ÿ½î1cR:Jå·è‹3þ ú‰r,k)‰F¹M€Á¬®Åóºö„ I«Üæ# 7õ¬ŽF• ¼Dë|’½J]=ÁG¢f‡Û™VX8œY³"<Ì]b—¢ ÚZÍk×Â%P£ ‹¾F dçK׌ƒîÔé½è…’‡#42–:™N”ͨøœ,-_e~œÎ'UbˆÐvT…ä%ê£è‚^çC%9prÝ uªüPŸME›â3K÷J:¸c3‹ñƒªo&ÀbY˜ð)Õׇ±r­m²©ÌûujˆÀ®ÙÑÓ¨¡·S¾Ä»•u‡ØÆïÍ’õUÿ)¸>ÑM@´L¾ÓÙðÆî Cî’‚]âÒnKøÏì•ÐPYo3³;Ÿú€ÂN%RÈ–«kø¾ g ¸„g_ÝWÔrËpæy½f[K †Ö6£óâÃEÇÁ0aS[¼%RuÁ ¿f0—"â Gt~åóQø­±íg cÊà4½ЄÜ!^î"=B¹¹å Û”ôï_°ƒÁé^*#"ü°4èü"!]µ»¿¯MQò6–má¾¶-†bW6,g1°d=‹Ìð.j—XY#’ÉBØco¨š t-À–§ÉBQ!>ØÞH¸Ÿwèšg—–¸¦Úí=ÆS3„ë:KæFp÷µi†ó“¤ Ù DCåŠ[þS§ˆ›'4ÜK–©°Úè9ç*6Ö:N[*Uj­*™ÎSþ`ÃÆïÚÌ ¤­$˜$"ê‰2´ƒ–qi<Ï“ ¢Ä© €<Ùš­†¢ÿ"ãæÎÃy"q6§æ°>™Nc9¼äiÔÉyE¶äYQ­§ÃÄt©”øž»Dò5G}~ÜŒ+LZ çÇÚWZý_6?eä±[.Ž"ÈÃÑY©\-_9®ä¾VéR¯¦.õ,J~Ug;Z$ $–#dìFj~6«U`ëÙÀPÙþ¹‰ÁÓ)ò*51#¾“§ã]]¹ó8pot:FŸÌw°cúÍÅèX~? (è.HQæC‚\ˆê;ˆêí嘮c¢Á5ÓÓ~œ_8DòØÕËgSšpà¨Cɲ4WÔGy´hdH‚ɳ‹JüHµó¼†Zfùúlf…‡¾k¦{åÌöZÂ#®p‚º;öî-Nc6íÆlÚSò»…”óßϵü~nMQNÓÈKs‰÷-–ñØBŒƒšÁ˳ÙAQïº"pãª.ÒÏ<šŽ#þ8µû¥iú?Æüw/À–|û«ëÿÌ­ endstream endobj 2337 0 obj << /Length 2369 /Filter /FlateDecode >> stream xÚÍY[s·~ׯàKgVm ‹ëzÚ7¶\eZŵ”‡N’ѬIˆÜ¹+ï.%+¿>çØITäfÏD88—ïÜ@6£ðÍt:Ó†Ãõl±=¢nµ^Íüàãû#öÍaã|´óG¯N¤œ1J2š±ÙÅÕ˜ÔÅröSòÝ:¿nm}<çœ'òõñ\™üÛ¶ëêxžêdÙà‘\UaËÊ–¶ÎÛ¢\ùyY•ó]YÀ÷­_¨órYmý©›c©’¼.òÖÆ”Q “òø—‹ïÞ]ôlËT)ø2v»ï ªAPN(HÚ š*B¥ð‚žg"Ù•‹¶¨JàNˤ¶W¶¶åÂ"? '5cŒdR¦xœÎæ)'Š1údz?^~xóñÏÇx?ÐÙÕ—Û›vY_–öÖŸWt¬g&ánc€Ž;ÿ3•4\“· ’‚(aÓ¢*›6›0“XvÛ/oOÏ/:n–EÓÖŧ-Ê %Š‹/,ð2Æœƒf9(tjd2HþÞ¶Þ°×yo-`åHT5‰)rÎaÌ•¦„±€º¢lï)²±íeÓÚëf[ĥЂd@à9EUuhûÜC(5‚ˆ,›)¥‰`ˆŸŸ~¡³%|û~F‰Ð³[·q;ã$ÕHk3;?úOð¦Ée©Ëpå(1ÀŸ»ôñá B%bIΈa=*F*H¢R¢Uoµ¿zeƒnR“ÄQÂÁz½è©ð²ôiî]’f¦hJ ðú÷âÀY&)ÕÉø¤{e/p¯eµû´±1Ò€ C280q‡§k41úIWcà¼@s ¯sx³€ÊjwÌ’ré—BìÍ’áj7Ei$qE“7›ÍhÑóÚŽÎáÐ$·ë“à$â%?%Z8:LÃì™{/¼@Ñ0ðØ[§z'ê„2Pgj‚~ë|«ÑbضEoüØ}Õo½q!ùþ3¨„cˆ`ª‡{¢ñ9Y…°UúÐÆdÈS\ãŽ;¬“<ç‘(ÆѼGö^ÀÙæ_<ì"*b¢›êCpÑøkʪõûeaíÒ.AT)ErVµÅÂv¬äíÀ”lnBTbøà®P€äÍ-‚ØYà® â»$g&®WwIÈ.}­S\Eƒa6ŽÒâQ)€àˆk(P³!øÕŠf®ˆQâH BS9Q7DºmB!çÜÍ­1t‚§ä¿3¡1"£ Kj³ƒÖ?ÿïBìOŒH¿F%ˆ¤ÕßR%ø˜._Z "#@+Aí*A×Fý>`%ˆˆ ijT5ñÌœ½ÏnäƒDö‹gI·Á¹¸é]Ü+àÑsf¤Vù¿©•Ñ™"™æÆkNm]–– œÛ(Fû ©¡¼ó‰P¡˜:¤ …` ÎGWÞ®¡1 {Í´ "tuÏÙ” ø—a|^»œ 8eË&tÁÚÄW¸B-÷š¿Èù´Åô¶ýCwÿ?»0È}àÛg™Ï’VšCË<0ÞßÝå+,:ÂåÛb;4rúÈñýæ—+]ă‚A¦&Æ×Çs(%’ôe,»„âɺX­­§ƒ>ÿ ôðêþ> ¯këïoüÉÀiR9ô>“Ý'»?ä³J½,JÿŠ‚«(T·-RLuO0)¤<¯ºEëÚ+`€ƒÚ~Þ5úÎz¿ÒŽ+í›7•ùæMõE¤¢!0eà$ìî/Ów~†ÂC ƒK a0Üò³f›c•ŠÃI™°42iDØÎÀ}• á¥Ëg›/ƒù+ÿ)÷ÓP2ÝùÅul®Ö~R[„t÷&“ûPXÏÈ‹þ‹:,¤Œ!˜Ä»=#I»ŸLž+Hžåé2 WòY]Þã¯Rjò*õþÝYx“ê…¢l°Œ¤’=v(–¦,ú źAr~°Ál0èõ}MÇ’+0ºo£zR¬kXü×áµ:ZC5<ÍÿP”hÕ¯=ñïdÌ=BxS°ä´r`ÜØéÝyøb뺧<£j½¾Ž¢-ƒÚ`\ ºø'0³ôO]Üîêêð‘}yÚ3!)ù:†KPîMµ‰Â0×è¸< ‚}TMÛuK¡X»Ç]›Ÿ‡PÙwÊ“Íx8¸ò¹ƒ>4–Aq'ôÁ@£Ùi@åž–þ1¼Ö§1üû0ÄÀèÐ^NÔ{zvrzvzñß:#Â<7ö»ðöDqcëâêîkÁú Ì-R¨ŒÒ/ê4xÃ)ÅÓo è÷?¬I(]•4w™šË ÚÉ=kÇì¶X¯þX»)I4Té_Ãn@J˜.Ea¸‰Ù È úÚwÝ ]©€œþM¶á… :͈FðPc2íJ(¸Æ?ÏKCðS¾YUuÑ®·~z».0!à°É·×›°?MªòUõ3Tü˜™NNÃq_¢Â"ü²?àáÏ;kµ#»O{#)ÆñKL.E¸q¼Ž7eCzþÛ“¯ó÷Ü}x{ò g†sO2&aì9|…PK¡£•Sçƒló³)}¦!2ße2@EQáƒÜÒ¯úgjXnªm´ŸÅz… B}‰×+zø½°QÆT“ 2¼(ºˆ ¬¬¢P¢T6iÕÆµ—­Ÿ´U´š‡ƒlZW¼ûèj‹Ëï~8{{zqúÃYô½3ÅÚ}œ†×à ®î_pC#ž1(zÍÔ`e÷.‚½L(RE÷.âbè_\lpÓu~}í+áÐÆ,w6©ÂÏôøP9wîç\Âßÿi7´KWövüƒþfg›¾»Žá]d„¥é£V…!7´{äý{¤HØŸa¡EÇ, 3ƺ¯›¨Ù²qtòæ_çïlÂ0iü*ÐC& endstream endobj 2345 0 obj << /Length 2386 /Filter /FlateDecode >> stream xÚY[oܶ~ϯXœ—h"UR—öÉMš6Å9na¯qÚÂ%Ú«fWru©ôÏwnÔJ²Öid)rHg¾ùfHþ›$Ü$iä¥Q²)ޝ|êm6ܸúöU r.ºɯw¯¾x¯õ&ð½ÌÏ‚Íî~ºÔ®Üüä:Þºa¥±ssyã]]\nÝ(Šœ›Î´ØRÎóz¦Î¶¿ì¾õÍnÜN‡ÚÓ*ú›ºYég & `äù ¡U0Œ=_+V&yÑÖÕqè€jóÃÕ6SÎÿ»íüÉ?—?\AGjÓpÃí‹zΧ~_Õx°H:µˆ¿qCߋÈ÷»ÚêÀ1øßoCÕÊGè”_ÊÜ™5uâŰMlóú#Û®hÚÖò¾jj6á1ïÛj8¼±ßíCU“² ^V ß (ß­ièÒ6nyA˜òf×£šôßçÕ»6½;<~¹u•RNwh¶aâ<½a ®óããÌ#£¥yL¤Ž©ËŽìAÊêhêÏõ÷ÔdcVuÕV¿ºéy¯ t1° *Ø›òítoØcuA?ŸÝô§ïþóÎWrìkSô° à-üŠ{qxÀŽ ð~Á•6® ½XÛ3^p·M#€\*ˆ Ÿ}íŸà:}ÿI E ¸·êd”Ž ¿4‹É¦ç­lŽÜþ½›Vyªú½ÈW‰ýˆüÓÌ=EC‘€ß=r$¶DÙ˜´ëÚeÞ–¼f ”oŸ£çM)jìIXÂ×-Ýš»HÝ0Áq»{X’:îØ>šÏfl÷"¿—‰oß½çÆb$u¬§°sR$Öð/±ŠCàþ²£œ@ä* Š,º¢~k:ÂÄÃY"C+™á‘³Ïq€GYrÜxÊj"ÍL…¤¹éÒtUkÊqÃÜš§hè¸cXõ¸Ñ‚×Xâ¬ú¹+ø(Ecé¬6ÌftvL#Có÷Â#sòQ;Oœ- Oh¶ÈÒd^ÍãpÈ_Ÿ ʯÁ×ÊWÖ× ‹Å.:;vTµØNÓvÒI˜‰Å#z GX»¢,áŽ'm±â™šåg@´›&ÞÛ‰à(ÓŸ Ë*"1ënÏvR§-Ç ‹i­*¦‹ vE^?þf\œKep¶³lG.³¶‹|miƒõ€ôÁL`L#új^(&òꎃAQäçøõ¥Äücžzd¼ ™û ;$Td©èÝ´Ag!^bõJa 2¨â[V°kjQÏΕ‚VŠ8!ã"Óˆ÷-E*Ä;¦rxmÏ­ÙcaEÊ'†#›ó§%GlKÀD@´ä,m·û4ü(’¥9yWvy6­h8Θ»ÝUâ® žµÉf‘”“¹]‹¼æÆ>D%Nƒ©’:ˆ[†'–K %à­²ÌÌ'éj(R%áø¾79• x/Èžñ¨ Žj‰4]°àÜE1´çq—wœQ½jyARQ8*…ƒDc•ÃøùÌõ8¶(¢RÊ¡±Ž ºŒ§Õ%¸ÝS~`ËË­^¼$ ÐÑ·\­ W–Ux_\šJi+2 W^œéçñªü]ƒLÊ 2£ó¸TŸUo°pKÏKÌÈÔ•¤†"ïD>—aS=˜ú”Z9¡ù¦×`B0ý^Š;°š Kšl_Ëò‡ƒÕ»^ „I'©1·LÙ'R“Ü-îk…à ž€©NâÓCÓ­"3 =•êʼ(VV‚¬{J”Sj™“×òÝîÄ LnÜ0ò²@Üý]ƒ/OÏ_enFuõâ1&€ûy$1o[C' l“ãžÝ¬4W*•ÈŒ¼XÆ)Í>9¿‚Áe º‚ ¡I§³«dªO1$9tç¨$ó=­Fà õÐÞÒü[k;>ƒñ»)naóÛSáºÊhW»ò›µÝ3/Nƒ•½Ÿmp›·mþim—Ð÷½$ OÛ¸q@wÈ5iOéø¥ýäÐQêeY¶¸dZU0eM“DÁê£%¥àÃ2ã]à 빡3 |Î @CÉ÷ f‚ðÞÛã¼ÉU€}¶þÄú†Óµ«3Oótý?¦¾$RìyE!'³éྌ]š6+g°‡˜~ ¬Ø¸CVûÄm»r¾ŠÍPy¾Öÿ§¿ø·˜V_h/9a¯`ʨv¬Ç×|£)¢Tò:Vö~4í•)éÄøµH\“¬‚3Ú¡.˜eñÓÖxv1:ž¨º¼„J}]LrU%ò>’g‰H*úéÍaú(ìËÀýâ`^(éèR;|§3üÁ‰ JùÖàC31¬Ï¯XváAôéeþŒr ÃàBò€ƒ§+²zaï±Óá5uD:çâN÷…Jn¼°Îh•o®bŒ;.T%üˆ¼%ÀÆ<’;¦”á\ð­¥@ Ï \¥82ã:oú„æ‘Hè0a¾Hâ¹OvòʆWôÖX–…Ѫ– ó6‡"ÈØŒ=¡{sŸÔHgr£Øsšßc6Û7DÂ=(5+1/ÓSåÏ‘ÛÙ7—7W·?^\ý{‹XaóÔø´z[›'žûË’ÂOSkÄ™l“Í*Y/TÑ©ø­-aÇ3eÂRÛH/¤Ë»×;«ÍŒÊVuñ!Ç«‰.Áš;ÝÒN%s~ku¥¹Ï!6Ø+s/M, <ûç«¿Ö‰M endstream endobj 2351 0 obj << /Length 3741 /Filter /FlateDecode >> stream xÚíÛ’Û¶õÝ_¡>•šX4‚7gòà4u.ÓØ{<8—±c‰TIjO¾ç^´Ôjí&3iggVàœûZð§‰^$iè§a²Xï4ÚlÜxñí%óV0q5šùõÕƒGO£h¡? 2µ¸ºƒº*¯½¿lóCg›å* C/z¼\y?Ún[/W:ñŠ¿ﺖ)[Ù&ïÊjÃýª®VǪ„ï{hòª¨÷¼êfÅ^Þ”ygŽRq{*J–o®~xð׫þØ‘ŽüÈ„÷ÄÑ;…hˆ†~˜:Duì‘aDa‘o–«(ÖÞOpïÙ‹e¨½ç¯à¤Iäý‹~<îºòf søÔ<ú,‡±PyÒ}‘/•וõê9¹^½bô‘R‰ñöL;€] ž@ÿtLÿ`±Òotȧz±Œ.üûç±l¤KËÚÉÝE‰Zø÷ožÎ_Ñœ•JýDg<óùÎZ廋 ÷xå©W؇|“k[-¡Üñ¯ó±D}¬ ¹~ã5vÝåÕfgyIÏ&ùzmðemݼ âž'~yè©Bÿ.Sã¥íVÇq/ðjÞv¼«;M»«“‚ÇË|Ø•p‰ÕFÞM¸çùÖʪì.ž¬=DÖºélq ~:†m™!ª5ý\Üêõψ÷/3õ§.VFûqtrôŸ€ïaò½‰ŒW¶ü›WÒÊØ½\|ŽŒÃãõ5ÿv[Ë=Î`i‰¢^Zð j‡zU_“Z"³h˜µÔ Oý°-×Kèn±zÇÖÊÌœPÆÏŒßÐW‘b~ ¢`¤ßç;h*—eÄ™éÀ™8´EÀ´mV=£"‰×ZËóò][Ÿ*$f¾Ê’E”¥ abRH~ß@»À?¥I3MGÆ*Ê­_ÌèâÓm„•×Lv<ÜTYax¯_8ª:m󆉽C¾L´Ñ§ˆ˜4öSm&ˆœ×¬nö…cŸ¥cûpq ißw|^ºJfB¸D:¾Dd7¦^^%k'îò&.ÆŸ¥?Œ{voæä!õ3ÕÏè¶yÇp×nCfË8dÁ-Ò[| _-[7ì»ÓønS7e·ÝËx}ò}r€€e›¢l»¦|wìDéö`‹tª… r>´ ]Cú‡að k Ûàe‹ PN‹G¤Õ‚°_¾ÏßÖu[”iqKQÜhñÔÞ:·[’-S|iÆû[ÞlÈœÉÞ­ÁŸ¹Š0MýPë;¯"óƒ4s3ÊjÝØ¼íÏh™*a–øF©)s¬wy‹»ÃAPí„Q2¥§òZekÓX¤¨GpœnǧÀ‰KÒÄï²÷ ìoBöªµÓlËÍÖÊvýÕ )v×uÕ‚nA}Óñᲈ_0EìǺ±£{&³šFîÆ’yí‹ã¬±Å'…Æwé 4Ó?'ÚE'¾í8½©ã¹k‚f #2‹Ðï3¡< 'ý¡¿Bc£c ŒÁMEA¬/Ôìm‚ç;ޝàK12òƒb•ù¡ø’G9M<Ú03P JS‡]ÌœôWâ¡lRγCÚ7NÉ 7”Õõ7?Tè`ÀH:!=xP »© ùn"•.V°Kß±7@„n>ý®'竊*?§ÆfºabÔb4k Û­+Â0ô–ê=Ù4J¹M§X†@²dº)±âìÆÌŒ¿‹pè‹ÂÍ ÇÉ[ÒjUÝ)è$÷xVBàÈ„bE0'`ÆðÅç²læØÿŒ2ŒütV~÷'`VzYYôîÿßãþpzÊ•J€p*?o‹f~7ÖÎA õØaÿ$>9eL“M®ŒÜÃ4tnÿ­`"ðSÓSó 3VÝ–á­kɬ°ëÃä¢Á¯d]Jv‘çãI°F:¹pÑེ_Α °MÃ߇×ÿ;ÇÞe*ù¿ä\x¡À…u:Æü1¯+æ¢CД½P¶ª»!Cø‰Ž¦±’„dJC@ÔJ°•J<–Ž¿s€Â9Ù BÚHeèa·2ap«[ d6,ôÓØEó¼fv—€ ±d1‚ldÉsÞ ¸NyGIôõáŸä<Ž]½‡ nïÔ <0 pOÚö´ÜDµ‰9K}báãÞ6¸–?55Dd•íÁ¤ &ö¾“pà=‚–ïyUpãKa?#'›½þî‡5Ú¬»öѶ®ß[=k`1çÓóÍŸ8gØ86r…Ði0cj)UÂ)-¨cCÂ8ÌVÆhïù5Y×Ǧ•SK(Ž ‡„M"ü+Ù =tií«4œ¶’EX—|׫}…oe;›=/[WS醈Óš˜ª.lÁeŸ‚9ʺ)Åðw °ÏKÀxÀa9|Gáã§È¸%CcÌa͇%z/ ?À—ÙlCÚ+ÊKôļo§³ Tkj>'J›z%©¯â‘:ë‘ÕÏ:ŸeáØ° A«¶³yÁ—›nøë!rû#ñ¿àŠ\ôhæ}î*œ¨¬Ò· ,i¨%ïëÓL;¸»[LX˜˜ó“ÃùJ™ÎÄ») —„,øÊô¾R _é;ù*N¸ÌW ,ð}ùJÒ-=žOoIÙW¤Gv¥Pœå>ur~}ÏÅÒ†h«0™j«5臲•êfŸ²›”ð’È•ð†ìc.¹_°€23çqÉr~äÁ]MI­ÄˆNÆtáû²ª\Žúv·+m]2Ï-é!e¾¡bÁŒõq©9IŽqžrK–scE’áó ÿRÅÚñïmýÎTÍB¡7Ë©‚€CT(ë… öIbŸ¤¢qÀYË“ŠM¾º ô"„6HÕ'—žÜúÕÀL çt›ié Ï÷Ä׌Èë,9pz¸ä„“´ n—œB?QÙ»JN<ûÂqOöb$'"–¢›éœO©îX›á­©3R¢D_©P¬#uä– åÄú,ä ­Há'Pmïòw%VWàìÙáxa¹ö!Û»C]Iú^œüFÖ•9·w¶’pÅŒ.\ 2vCÎ^Å=®eA£Ï¹7àã“ˉƒ¹“8ìõ»¤Œ˜Òúô´ö")°Æ®Ð3ÄÅÿ"÷²9­ðÛXq~:ªìÉ©`¿¬ ªãLy22ƒ'«uÇÉx#®{/Æâ7á·å»²¯Ýy\;,kñ:V9ãÔùØËÁ‚ݣ݋FŽw¹\$ùg²¹;DYý(S•ì²ßûà³îž>HÁ—!˜XA õÜ)ÖoWËÌx5·_µvNõ#e â Åå{ŠÁWá>\Ù©DªnxQ…ÆHya÷¤,˜z¯ž½ò_Ž ™²ë^ HR.ØBq…¯4éñ Å0ŠC’É;$å¡oÊ¢°û‚¸Î¥qɬ) 3ÀØÌ½Ãp¯~øûظySɇdöz¢ã@Mõ¥‰]V CÊÝs~)AêÓ™§$ ¼†h±«ìH¹Ü¯k ÷ŒK”“ðv¼Ã±å¬³ro:ÆÝ“³ ïŠ`ÇyDƒ9é%£ÙkäŸÁ{<î~'NµËIc³6¹éØ€X§ç¬‚mÊ볂¢ÁC1ê²ÉI†û_o7÷^W–1` æ(¾ÒÑæû•Ë@DdSŠvìŠ$“´0vQ|5¦*¸Ë¹qK‚õ¾_3~W­Ó˜²jÔLd}DœäJÎÇ5Þ%6)¬ril4.oö«k¸÷¢‰D )*>^'¿m¾´?ùbO’\»™Œ#ß ”×’&˜¤­ñCY–?…øXyW÷ûµc—û.—dyZ„Ãä“ "ŽŒ÷3É Î&…8…)¹‡ã=E endstream endobj 2356 0 obj << /Length 3074 /Filter /FlateDecode >> stream xÚÝZYܸ~÷¯è<Ðn­(R¢´H8¾â žuìñÓzaÈÝìieuLtÌxòëSÅ*êhsvœµc$Á#Þ,ÖñU±ØbÁŸØèx£3fRovõƒÈ¶v—*¼~þ@ð¸- Ü.FþéâÁwÏ’d#¢0r±¹8,—ºØo~ D’mã\fiðöümøúÑùÙVJ¼íM‡%¼,š³8 Æ¢:ûéâ/ž^LÛ%q&J~&mnôg§a”("ð]”D&¼ 5±nަÁ’ Ê¿IPöômZnØU¦è¨£‡£á ”x¤=Omºr‡²M];echåcÁKÞœÁŽm÷3Ž7{^½í:³ª[ L¸…ÏÄDÆ®h¨ðø Ó¨2ö0Ø¬Ø ŠDÐ醖ØÝ q» z_UEÅ—­¥w04àqÑU<©ÆýíY&ƒ—Fê%#… s¥`»$ÔNÚ/ê+KUÛ $Õá{žº’A’…H*¢IÈ7‰ 3‡“—@­îÚ¦·Ëè` ”Ušðl›*MüVQ˜¸«`2´ˆ`O£Y øŸyÕQG{ o9˜®ÀýzªZpiî¹´LÝjêL¯YÛ¢8Uœ]ÑìÛšÊ×V”»¡íH|JF$1ìü@TR«ù8t¦6Õ-õËË#¨ JdPòð«¢ÊÝX¡²aTKtr(ìËÚ4=q ª¨#øUôi»ymÓ…>ý¸ 5UÄkB¡¨.Û®Ž5UoJT,1“;`Sí†Öm?P¹lÞEB5åÀË ¡&\õ .*ØÊÊ£çán×AçÛ³G;°ô´®£p-hfu :„ez[ÅÞ‚øXÚ@|n¨Œ3ŠÀøj9Œ +ͱ·T®M*£QUÜtRät©È1`Nž8E›±{Ý€­¿¿4ÃûkKîç1¡"0å¦PT!*†"sÀ½;3Œ]Ãv½•i¦™Z‹Ï«â2(¯KËJ¬LgK °bZêaÚrð«'Ϩ€xs,w8èHM˜à+¸ÚÐwWô<Ùò¾}"hPQ•ÿtÖ*Ó·`ă1—%RïÅ4K‚ÚŒˆ\^첯 *cˆBñ¦Y²áË€Õ÷å‡ÊP“Í,v=Ç¢¹tíGãæÀiº¢¶ôˆô4pàd àBaeˆe'1±í Ø—ýЕF>´L vã2ΣÛ錳=X=ìL ÆèS½T‡*ÍæY;¨m8¾d±¨È¡ t1Z8j ª’$ò‘X«à¼ 28¡…á@è$Ã^a_6Å`z^ç@½UIÛ±A »LéJúèA$(+•e“¦ ŠeU]ƒª{•'!pÒcª=˜êèãSž‚mOƲð"@˜y—½¾Y4üžŽRt†a95U}K%ÿL;(Dq(²lÍž…¬¤ÎH˵®á¢ ®*€0Ö6¡Ÿ¢ ;ɶZÍDÅß»^F˜íКA‚>–€·Œ¼<Ù/ï`5h¢îcµSï²ÌŽ<‚øom ¸¡WR„*WB@ø á^€fÆU¨·iô#Aµ~ªÍ8æX H©…å†ÕIS"«S”#÷@é–JVh±fP Ø»Š++ž²»É^øTw¡ådà…M€²ŽN³3V2¡Å`Ë0 CAF92 08†U#ôžå*˜¨†×LgšÝÂO TôØÍC‰ƒá&ðúý«G¯w†QûR”¹¡ùi´ò– Dì êѳó6ùr˜ ã9¬´î€[g '“YZž¼xsá¨YÁ°—–(LgÏ=3l­a–‡RžÏÍ@|ß›C1Vy®+ëLØ‘@§ D±0Ysèã*b¿Ðpã‰a[Óe3|ÂÕÄœEByFÅ_âk¼d˜»©ýcº~ÅÏ$i²Q:š2¼|ýøS´ÙC'8ðPéÍYod¥jóæÁßø†¶Ú-V*L#±è×&i×WxAñÔ>“r,˜é9J‡Œº±YíÎß»¶ÒL.N]6¾UAÔ"JÿÍUãyÕâ£O:ëUïV´\ÙNí˜tTæ0`IP8M\l˜DUÂ~ô¼EWž†Þ'­Ý²m:Z'ë®ÛÉ#[UEOXÁ¢§ÆH¢…¢ÝÊpŸ#õ (fŠÐÊÑDÛÂà­/ ,º[â³ ¬¤š‘„TÖ_oOèÇ&{öÛ+˜·‹ˆ{­Ë´ád}EØ‹­§Ø{×­8:‰6?¹ûD¨òPe"}÷€ØÝòÅ X<Øh=…´QZÛs‘.+¸I©öÄhй{,@Dèî9yÐËÐî2w nëáÜ@G ®wˆò ,a}ÄË‡ä‡ø^Æ)Äyɧˆ¶^u…hÎøÔrD¦I>/y—¡âäqLƒœò…Žs¸–ü–­ƒyô%k²ÑõYÂw_ÏÒy"º£U<¶ºk^e1âP˜,+³ÙOWÁ5 /X)°r(Jž3l*Š}[óØ]ÙíÆ/`;«r}È1 Ñ·2Ý—mgÚ9\êlîó/R¤AÞ±¬-„{kÌB¯|sOM¬ìzqî©g”sý”/ÃYÃQÍeàhSs@BÛ`€…-œÈØ9(qSxòd“ Ï:Uœ>'ÐZ™¾?µƒª½ÜB´²[Eر/݈™‹ƒKÎOb–îØŽ£Ô½Ôw?Ϲž…=¡áE)NgÂ:½ Iæìöïp[8ÇÚìá8Àv \8¤_–,®ÿé°DÊ4Œó¯–àRQÊÙãçOÏý! ,—L¨5_Ê<§€Ð®uÿgIæ'6ÿØ%R€ I¬B5¬¹‹díµÏ[8úàb—~GHò¥qóõ7RÐ(c™|…¥¢H|³¸Ù«N«¥¯¿P\¤ú$ÀE"ÀO\9±S}©:^·ÔÊ`«?U}g<ˆH˜P<‹Ãû,’®âY¬3ìëU0‹uŽoÀma’~м Áæ e:årNBÛš\Χ'œaEÿ;§¸sÁ¾%ψ¸„RøuÓNv X\dÊp 1$qIÞD,œ+fhy˜õ2 œ[°Ÿu ‰}iÑ«Ä6¢Qp&çÄO.3˜ó³©e…âÿßñ[ßbg…”_ð­"Ëóoá·îD„ü³!ù DHÂ(×w{~9ñ'·'Iÿ ÓÈ"ð—z”îÛ¨Ž'鯡9"ÙÉô¿È¡xYžÖ÷«N$¬Šy²%Hcö"'ç#>WŠjÖÁýq¾ñQä²X, ßZ8þ±oxxå!ïÒ!îMÞ¾EoÛÃvlJ|}eZ¼#{ŠÐ„H@ÛËׯ¿N"¦^]RdæÊ‚êÞ!2Ùn} *õql•ß“žßEþèýÝ@¨ãIÂ_0E¦C§wø Ï> ŸM¢÷nä·øT†¬òy1$xFÇ—³3iò5Ì^q`Ý> stream xÚÕYKo7¾ëWðØBq83|F€¤®{h¶ ´5|Hc¥p›J…-é¿ï7””ÚÒZïZrF»CÎð›77Æ\p1æè(¨#­Õ‘€HµWŒŸd„¸˜²ý©ŽC±'ÙIĬV§Rf™àEr‰ÀKp™£Ñ¶Å¹º’ÀæUM@ÉL‹"Ž(4 »„¤“i§ ‚)bóR@©mZ¡µH£°RŶ­v Û’øR4=k­AáT™LBÅÛå#C U¨O,FáÄ€%;‡ 'ž…­ð "±¿ÉÀ” jÂ)Û[c‰j “Ôd`+Ó*6àrÐ œ Tñ¸h{ÖR…å•ÁŠ#lS‡¡6G{ÁPŒ9¬ŽŠh"¦)¥ (¡Ô€âà4 ½Xaè[† | 蘵˜ ”6ÊN+*æm†›ßÁŸH FKlVdÕ`8`™V±B ÖR'x+.…æp¤´BšîK¦“ୟඉ7ä¸$dRN.Ú(U‚Ši¥œ1å¬@ SÅYÉ‚ÁDACÍ/2ÜÑ(l”cC&Ë0ŽQÅe‰Ÿ$C’5´Å •49:šLÏÿýgæ¦oßý1›L¿[Ì—³ùòÖ‚ݧ“ééìvqwó~v»ŠÞöìÍìêúÝëÅ'wa)@«z Û"äK½œ`¯l~ ÿåË&èØ]ÄUÒ8uÓ_~ý J»œ*Ö¸ùÝÇ—ÏÁ—rð’ø5WŸÂã prGGnzìËŠÿDá“Jë?Àš}6¯,'Å £¹źyW\•Õ2ì>}{³x6[º ØäøÄMÏgŸ–î³àÇŒUv‹Œ6Vîi„ý|ˆ!(6WkØ`’Iì±Iâ8¸J‡oç'ú6¢l®†ÁpÿL÷@~¼´{<ÔÇÑÇÓñÇ|¦•kl©Œ?Síçá=øöyø½8àÓÃ!á]H*†¤Æ~lñ¡êù€·—…×3ÊØ^FtCÞ*ë3ï=Èû&áá&¨&ÈãMPzš`_Òì­9|>F%öHÏÆ'1ú _>PÑjotÓ;ö¶~{ˆ½§¯æó6½X5û¦Vëõ×ÄJí-}Ú’Éôìî÷eûÿÓõü¯Éôõâæjv³.M¹÷8&0Ÿ¬›â úM¥â­©SRŸUÁ÷ªyæ¦?,Îvøæû7oüÖÐ,¦t¦©ݾFõŠm¯OL’jÉ¢’×ÜFŸ0ýIˆ^J/yæ€6yõ ¥¡|˜¡À'ÏS1¾€£Ónm±¡ð)ŽÎ”vÂÚ¿IÆú7fW¯@C¤o“ÑÚÓRLãïá< #Ÿ/è1àú‚‰(!§åòW£~v(ŸRô oùj\­v¸ZäjP)=Ñ+_hv PÜmçí:dl,ÆM,®ÛîiÖDܛ´6òˆxeÌÑSHFødÔ¹M¼f„B¨3|ΖWW×·Ëñ![*r…¸ˆª‘™shÃÿaeEzh÷s¾Ýi&Ÿs:¨H(õvÕX ÚdWb€üp"%#¢RpE­MåÿbØsÎ=«¹“¥‰(ÅÛM/×àcìo ý¨ýRÄ@>‘æÙ_M"掚Ïãk>oò ¯ù˜G1¥5{M÷j~(^ñôóãÓñUÐÕ¢P¢Ô£5·ó#mö‘׃{Vò|_ú–¹cäa]ž¹g½Í‡·ÝÛtñ¥’‘¨#6Ì,û5L4=Ùœ³ôБ%aVÚχánȸ×a†ÝZÛ§âÍ?±?åù.´Yt×ë„G{H?¯ÈGÆ7jÈ{ôÞûàÙ_©ñ§Ý‰³î^mȦ¹”Ñ7]UËþÉÛ‡/)É—hßà²ÔýOß-¯/^ü<¿þ°¸ùûv\-@‹ì% t  ¥²Y0ùøHCy:ûk¯ó² ý¾qõá{’—%›’»œìA?ŒpûTKŸwÀÀí;úz?qëy~¸÷uÌ8*ƒ¼ïr=;·->k¤+•ýŒRÊ#Õc‹‡ñhU{0Z™©÷røÀlà endstream endobj 2365 0 obj << /Length 715 /Filter /FlateDecode >> stream xÚ•U]o›0}ϯà¦âú“=nkªVZ´uéÃÔV 0Ó‚IÔýú]°¡!KµNy ±¯Ï¹çpC â„Ô #†":ëí ÷«uæ˜/7—3bq>ýä§åì|.„C0ŠqLœåæ°Ô2uîÜÏyò¤eíùŒ1W|ô|Î…ûUê¼ò|ºiÓípwSYH&•¬]¨ÌüV•ò[UÀþÖ,Ô‰J«­9µóDà&u‘h u ¢À%"ö–׳‹åH[PgïÔ8 ÿ8„ X:¥‚¡…Ò^wÖmU[¯vª®ÚÕ:ÏV;Y›—ŽÒù<À‡­"E,pk_à l`">„qD9@·‹Û›AÞóÈ™†À‹‡=!Åã»줰yí`;û¹u¢!ƒo¥ócöÝÊšÜFCâˆMµ]^,>X“0('¢›µœ<¡BˆGá=3^Ê£‘«O•¦ Ãþí&²¯ ‡ÄÞ>I¥Ï8SCÇ' AÆlªL*:—C¦€RݘÁjcžI™Uu¡s›¾}^”öt“lŸÊW¼:¯î1Üd©L„ù„#ø”"Bì[’VícWë(?™Ô«]U¶[™'ú”zŠ1”½'B#h]©ætË#h‘8LÚª7¾gudîQ’I A ÿvÜ‚xl´$¼6 k¶ô¢ÍFß}x>öC–•½ÁÚCÂ…þ ˜-L¸s/ân?M`YÁØHÊâ·L >•ª)t!›.€„¸’öØ>—ê¨æ1‘S¾}™wJAù$YEc’@ÎLTt>¬˜‘U¶6mò¹MÊfAqò—\ë¢RÓ–ØW¥ŒÓò5µ]^ÌÚÖ×ÈMÑÈ-@„ņە2¸uÒØÃc¾íެkskÞ€©2pˆLôŸãf oC@úBŒ–àb~µ¸Zþ´3ÂþCÔR·µ’FSG義H endstream endobj 2371 0 obj << /Length 902 /Filter /FlateDecode >> stream xÚ­UKÛ6¾ûW¨7ê V$EJÜ[wóh 8I7ÞSŒÅµ„µ¥†–¼È¿ÏŒ†rìEaÀ’óžo>‹$‡HJ™”•â•*“õn‘O·a“pûr!¢^ŠÙ‰æõjñû ­‘s›[‘¬îO]­êä=&O3iUeØÝë;~ûÇë4SJ±»½(léºTVltÛôãê¯ÅóÕ1œ–šëBýËÜfí,!Á‚«ÂÈ9ÁBpk JPs“fÚH¶L3Á\H{H•`=~ ÅR³5Êk;:îÝ{:Ý÷!jõ]ª$@ ÔÇ~Œ »é¸ÚCjDhÝà±ÔDVÜXè¨Ð|Φn÷Ch?CÛw{TzÚßìhd¹Y-]xÀöø9ËÊBÎ SÎxüž3ž6¾óÓ 7ÿeôÝÚÇÇþž~ƒëê~Gò½ùõÐÏ›–"бqµèfhfÁ…H>-ojA…(.´ B¶¬’l?8Tqá+žÕ¹`&f%[5>xR˜ ªÉþ,]|w¤(Ù‡\ç»~>M£ƒç­ßïáEÐíºÁogo`ÜE·í@¿»vÓ¤²dÃY TÂàbÜŽÐ¾í» IC»‹Oãû¡ÝƇƓ0Oƒ´š©%pè:i±`ÐÕ:šöO\ljžïâ}œÊ§ä`å)À`UlQ@I†‹ÊkÿˆQ¡‡WiVš-o–71Y„U;·veýÆ]Î=¨]·ñ¡ap{Lü7 ‹k©xq'\Ïq¥â6¢áÍ7LJC L«„МVÊ -X·D™Xn4è FRñÒDú 5sË—#a”%·e•%yžOlñþcžÔð#åÊVÉ㤹KŠTMò6y·ø›Xå< V@)‚7Á«¼:ÆÍ/Ä•\X›hN¡Ã¿ˆ›'ºâ€uö Ûj®ª21À …Ñ—ÉGpÉ f´¤ÖÁ[‘…v JñÂåä6âÙ ÙšØ \ï¦ãÄnÚÌìöÔ.sÙ⌈©ÈÅc;4ÑÒœZÁe©æÔÆn ŸÈìÓÁ¯/†Š¬•%»—¯®¯ß]Q¤U®®Íḿ¸¸›·Ï^Ä]Fê©#¦}ˆcá¨Û1!ôhÈ/‘ÜŸ¯V·hòæŠLnaáÛàã4f«sÐh@©ÿ5ç`…¿@ ý(Õ÷ý?ÝÔ´ÊüOûñ4®˜ã~Œ endstream endobj 2376 0 obj << /Length 3005 /Filter /FlateDecode >> stream xÚÍÛnܸõ=_aôIdTQuÉ[Ò4M¶°ô!²†žQvFšJš8‹þ|Ï5–ãì[aÀ"És㹺ˆàO]äñE^$a‘äõáEDÐ~{Áƒ«_^(Á[âÚÃ|sóâ¯ï´¾PQXF¥º¸¹÷ºÙ\|þ¶«Ž£éWë$IýjµNS|0ã®[­ã<Ø ¸’÷ lMkújlÚ-ÏÛ®]ŸÚÖ è«vÓx×·•΂ªoªÑÀ9JeE¨L­¾ÜüãÅßoÙ:Ö¡N“ŸäÑb?b4F“0N-£qF:eFu˜…jµÖYürùæÍ5P˜ëà¿üùPõ¿¯tøïÃ@2MËÃ5¼}Cu8îAlÀ H¸ð%]¬c&_{µÒ*0øï?§¦—Il^ÉÖ™rtf°Ÿ6ެ뮭«U\A  ÃâÝwÛ½}÷’'Ó7 cTãJ ã ¼ÖÝû–]Óuë8 ³4æK¯Ž\ú÷<™×f\ŸŽd7`%Õ0¾dÕ_£€ÀJd倿T Á` Ï“ø¢kÚf|–ж™ÛÕr0-Jb4›Ÿd›oº7¬Ÿ¶¦Ï³—~~ÿÏ·Q* ^›z Uª0þ‚/Öif:#c´Ï äÔÂÇ '‹`V Vsw'kv4á79ápïi?6Þ³ã•M3Œ}sw›®eÈC3îx´E³)€kž~í¦™ŽÊ4…o*­˜i‡fD¤?pOÀ‹çAÔƒ—è«M#Ì„( 8ø÷ޝqj[ö°e8Õˆµ““øó¬_$(±ã@`ÆäW çTû½ÀY¨]¿iZv5tVoïtd™Wh¼áz߬‰ÃhÎ[ ‡Wq–§ˆŒ³$¸?áU„7¹iPŒ•¬hbÈm¯ïÉ©âfSÕÈÈŽgÃh޼sÜ #) ‡øhË­y,ã´øÛ›ñÔ·ÈÎ~‹t„ï?4áKôÚh>oÌšsÌ* X"NÕã³qm:¡ 6ÃÒ3¤b4”ÎÞ0ÈWªnø®xpGÁÄÀÔׯPhI\Î(›öp°ŸìahîøjT·¤Fæ0Àðº5š¤¼=w\ ¬XSˆÉ°šƒŸoPÝYg\3ˆÏV*†–;C#z%ìH2ß‘ÄeQn}É_M˜ÇcÜ5ülK£žS†iOçæ–­L ¥Ÿ«àC×›n 7ýKö‰NÂ²Ìæò©ƒÆbóæTƒÖO#›AÝõ½ÙWìl HÇ1AðûªчḮZF¹£3 C«VÜ NDofkz 9OÊàc76µ›O5°BÄ?zÄ`eeÜA|”ûÍÂË$Vq›ƒ9Kz*þÈ;VÉ%© ²¾ðÞ´[ò¯‘$7mÝ›j ËHRk|ãN‚;b¯&ÑH˜¹v!Ñî\2„"›ÜH IÑííTN¬ÁÜUÐwHó·fƒFœ²‡Åg "¬@ rƒ_¢O€ÈgÜ ³Ü5Q3ƒY 9H.¬ÂÀsš²$Žpœ¼šim:HHl½Ìà%?6Jçfæ%žÌ~˜\]/9gÕ©s@Œ²k¶»§ÿnU@ñ§iUH€ìP?Z•S=èˆE¤èÐÀÐ7"`–`â¾Þ|µÂÅuÌwcxâ½9—Î*ÌTaZÀ7N ¦Ta†Ö \„*¦RsñkN»í°P\Ÿ_#’GºA?ß¼½úb£lšñ¾ «-ºØ¬ T’Ÿ³¤œ!k@wþ\Ñl±×ú ª"(Š,QAÙ=± W•Åaœ¤3"þŒ\íþçÈ:»f.W¤ åóðóë«ë/ùóÈ“`YœÓžD ¤<þIZìg(=?”(Å—© <¾§Ü¢–²)0y5KdFÌ8 9âºÉ‚âD1Þ‹?óÕ`½ep‰¥Dùh³é†Åˆ@~è…Ô0×?«&VCƒuF™CÁÇ ªK ªbÅÑŽ.³àóªñìdIþ²Ù¤m&…MX륔’g—ÛË+ùî«~kˆŸW™†qTœ=/¿š9A¼ä*‰bqIùK\R#ŶdrWàºï®ØQÀNñ7eât.㇑wé0N#P®zÎoÊÁæÜ1Q¸t“Ra žZp„S(åj¹\µéšA¦¤ÃÓb_M/€N6¦ÿ-Rš’˱¿< óâ¬N8@¨°%f‚9awŒ\‰ +.pÂxžÎÒëJ1S“C ¨ï¥K*ȳz`T;À×e¾¹ #5{¿’ñÄðòýFL=#™Ô¡<±(Õ¢1ª2,ó?Sv’]IÿKo5—®~x\fî´ÞlÙ×}Üë(Å# £Ãw+ùž‹W\ÞóÒÔ1b.é3/íE":R3¦Ì˜³¾ bn©çKyN8ãêN{L³u:I'^:˜æ»5–Aª@|Vš\]Ë(lí;5*íQk=‚…ðˆLÁÇó;]‡LY(I&‡€S]õ#k˜ÝúvÍÓÙÁKÝ.{ 7aHyó.:6³5¤òöÞSƒü+ ›: Ì’î#~ºÉyn˜”Êö×pÈ|—Sg`óJŸ>~ ¯^äIk ý4QÚ’ `à +.hhJ¼ûëØ_^ñ;§Úƺy}õ^ðY)Ä®"çÈcn†&óf¨´ $ÙF h¨¼™šùkGÛÉ:˾Ž=·l¸À§\ÝÕ ÝÙ0’t¿ZlŠÛK¦n5uÁ;vµô[€-4U;î7[õè¯z4§é¶fÓSIÄÙ"|Þ˜û ÄþåÉN»ï ɵÆxá£v/B©pÁm.ÚF$)$ÖèBaŒ_nòi€žEqßwö£±Žö>§%œ,h‰ÈùÛ}Ì– ÉÚiŒýIܘÒeÑ l¡¼*¶JhÖKÐ7@ÌȲˆÛ¥Æ,¶ÁYkíœõ©=õ·tÂmýÍÔ·\Ü7@ñqs¿˜:dQ˜L}ÄÐfVqXªdÎÞ¯6‹À4ܾ福?…T—ÜsÊ"A€ü^E@[è-1,Ÿú§KÌüˆ]†Yê’2IÐ5%èÌV^†‰Öó¦Î`6Ò‘{Ø5®Uãõø­žíxpP€Aèì ‹2·6m·>jÈQñjm·Ð†Ì¢ÌJn$&âF—B}¦!ÔÏ´Å×H²ùFW·uçz"Kb* 3-‹™ÊyŽTYeÅü5r6[Ò;Œø'FÛµS» ¼Æ{´ç]YS!ª‚5L®Vµä—B’ìJÄ@/é'$åµ,qÆ-K‘VâˆR³æŽ[U¶cȨ~ËÖ¤åÛà®å+û“™[ňö}d¼³dqÁ}pûÙeÑó|Á³Gr@$Hlo=!Â…8?—kâýÄ…T`ç‘.qÍ5:ÃÞçä47öÌ‹YEê¹Y¨ô„Ÿ…IX¢8]¤Šõ 8f Òœ 3ØÓ(¬‰F ùM òD‹t!o³·Uí’н“ÛÞ&ÉÙhþ¸Éè‹D¶±Áƒh·ÿŸKœÛ‰ì…÷Ç D5s ØYùü endstream endobj 2382 0 obj << /Length 3479 /Filter /FlateDecode >> stream xÚÅZëoܸÿž¿bÑOëC–zè‡äÒ¤.Ð4uŠ\`È+y­Ë®ä“´qÜ¿¾3œ¡–’¹¶ƒWÈòÍÑp¿R."ø'©Z¤™™Nëݳȶv›ÎÞ<“j@™eÂ}ñY5Z-O™ ýž>™jŸ è¹VÉTvï±2&EÁߦå†Ï º¼m¨j©‚ß[œÓî·%UG1ÆÊ@ª×R­úJûTM_“†×hvØIÎ ä÷5*ù·û€•›89>ò™“œØœc±ØvUQÞQÅc+V‘­(m‘õ&D·ã’5ÿ–íþr;2RåÍé˗喝.xìèø±h°äÝÚî@fÀ÷Z,ãpšV’1_ÿ¡ÑBf0³5[ₚ7d×G€o‡”÷ºÔK‚¦‡Y£«Ç62FZ³‹¯¬j~†#A[pvg'±\V»¢û6¨±ˆ¢ÌaФ’l"êIÐ↢+×Ðà«ÍèÀ¼m%];\Ë**ûxÍtZH{až¾”ZË}Å«¶ôÛ`'E±¶É:êžœþ*ÎEˉš!ÉçÖl©ŒÌ„ýmè1\½ÞC¸Eu22P Œ€%’¿I§ç°úîÕk*”täoB àvТï™nâ,U-Œ´ýŽL/N÷Ì‹*ë¸ÊyžÖ‘wpÈW´eÜá@?œK–¹?•p¡9l*.],Š„-ÈÞZTÖÞ°B(RæžA)Ú¡yqÝ‚DËÑ|ør ®œzmؘÑbØêðà†áŽ–)‘HHkÃ!q$’tT›—•³6]EÐÂHp!HØPU—ûͦ†µÀW"»d\lzkèØ­¢ah¦‡ßz|0þ‹@^#<ˆ¾F2²ûÝI Àdì5[Ï lê…¬•fhžåÕ<€''„œñw?Üìm[ÊF «Â…xXë‡ê†ØÓƒ1(Œø Kí)+Ç ‹ Ïîy=`0›Å’z1÷Ö/««b¿\Åž¹Á™3æs!‘µüKZDÀ@äŒVàîXJ^Ÿä<åÚ!Áõªê*ÌcŒG%ÁÅÊMV"Ï™‡Ê/Þ½8ûéó\¾Çmª[šŸDA…£Ž²1m‚Lâmò‰IP?J¥~àÅ&ĨLÄf”KË«Ó÷玚 È Ò G‹ £ ­§8ö‡,¾ñÏN 1ã& AË "K úAß ÷˜ðæKÑÕE3\¬Û¶+낯Ð7+Š$SOá¿ò{?òÒn@…”É7F^“Ý4H*.Æ+cÁz‡Æ å*pìâì@¦²}o¢Dš<áˆÁÛ¦Ñ ¿ÿ̹ÇNkš_ÕˆR6éå{ŒÜ­…ç»*œ(ÛîbÛ’ׇÀZ·tëö4Of}·ÞÖëQ‘­žO²v¬Õý,·ÀÆâÇIÁù‹‘Ê l¥ 'æGˆVîL©…Žb ú»$+Ë`…Ì®”:Ý}T¶ò+[y*ô˜¥eÙ:ã™H_†¦RÅrt_¤Œmù’ôýÇ¿ÚM åLÿ€ƒV&²¾\¥R$RÏI+cDI»”N³ïµ"Óŧ'ýœù ¡Û¶ -m&Ky€ç€½Ž‹NgÅÏóÞæ¥ÓÈ»¢ Qœ‹8‹¼ðÉ„‰Í4Ž#¥j»ÂSs=™—nŒÌö@1;X ¸dÔd=S•˜°0 º£†®ú­²×Q@“?`>F/Þw¶Û;N4¦ fºÖ6ÐmìËIƒþì+¶›¼ ”-ÁbÕ„jŽ«&Þå ã£J€6q®JŽ*±Ù­¤3L¹±Ú»¬ÆB%G)»¥Ê~ýC§ôŽ'T‡ù‘ãGŒhRþ_ø1ÍS¾ÇÓÇîñbå[¡£[(,ºQ€hEx9ñ¹Þ-å=  y s”#pB£Öÿ5È7Ø,I&øŒB‘,YnÁ%´«-ººœÜ†f ëR]õ”ÈÐY<½¢Å1/ÎÞS®ßWÕü†[›Dè\_r`_fo¸E }¹$àÌðª{Úâßy»ù+o@Æ}¾ Û7ç PB©èOÏ©ù¦ØTÔšgsÚM†i|9¡ýøí¼ý¥óEfÛÒc…¨±I9Š8ÁdÈhfˆn¯kL%9ÁìÒ£ÝÕºöÒÞ™Q–€*ryY”[Ó }ÞÖÿµ)@e³6‡'£€Úö–Šv£ZÓ‡õéµ=ìEúJ“‰,±°AE +&ýf‘àé+o~ø„¿ÉL @ËQ dBªÿHþÄΘ%JR§sÒ•l(Чý¸H¸Ñ:_Ô Ï>¡Hw .7cƒ¢ýëÀx£k¢êUØÆ$½åù#†]¥#öp·µ¸äáùƒIìK läÇX¤¦Ä]ÌÑã ê²y^œ5›¶æUÝ=#ôº'œÑÄÞÙ»R“I/+Žó®Ü«4ùìuÛnV÷}`{r`•ï’$é#¼ò,¶÷XD{wÛOp2©òÓ‘b9ÓŒ“©;y5&uHd‹›Ü÷M¿D ƒ~ÀƒÖÊ=ó»äãM‹#Bq^èõ …OÊá ô$…ü ³@Wú]‘ž>è–„(Vþ?š–Ò±k(LøÉ½HE–Ïò _£`”è#Ö†`Sd>»¦…­¼áì!†‡Œ²9¨øøÛì‹ Ôuš’¸÷ Xä÷ "{€‘ kŽÐ¯aTƒ¯ÛÔ}MÃÅ×Zh„‚ ,­IÿÈçAPÄçgQøñN]‡‹:éØb¦o³f·š±¶ø}@Ü{I„µ $”ud~,äƒËA¤—«c\°íz"Ø^aƒ}”Ù'LöCš’Ú ~ugc:|l„÷VôÐÂàM*½á£/=Þ½óAP¥ù£Ζ{¯›0[N¯›°Ùe×Çqî´y{Ú{è„]g€¹÷ñ¡ï4š¿l¶H8®Q†Ü U€ËBìk:Z˜D.+±Á¸)qzH> stream xÚÝYÛnÛF}÷W}¢‚hý/´@“&†ÔhA‘ÆJ\Il$Òå%†ûõ½"eÚNê<EBígwngÎÐ8JàŽ$‰¤¢HQ­ö'‰[­6‘¸8=ÁAn‚óä‹ÅɳלG8Ai’âh±ªZdчøåV_5¦šÍ)¥1>›3Æã_M³-gs"㬶;,^—Adc Sé&/6þwQó¶Èaï*]dåÞ¿õeÆE¬«\7ô`,”ˆ± ³O‹7'¯ýµ9áˆ3ú•6vÒ· Æ(åœt†μ¡yÑÌì»q[´Õå&_.ëËÚ4—Í6/ k\êÙk‘ …%C)–p®Sñ1á‰ãéPŒ!÷ BïÎß]tþÕßš(†Xšº+•Ú;ø”Dl¾‰Ädtí$÷EDZe»èíÉïÁ°ÑiD)Ä©[÷ÛLÑøç‹'ÁŠ‘'(F «î~WºÒ{!¯§LIÁ:Ù§>¤y1#*n¦tŠ@¢“¿Ï—`bìÖÜJ èMäÔÂ[¾ [Ö~ke¯±ÕyáÖÛ²Ýeþyé o‚M+]e&ì êDcUÉð0[æ]ºGŠ ëà@w g®tqë&$ÎÊ¢»S[y$>˜H “ó&×»üoó¡ ¢BŒ:óÍÙ{ìÈd ‡rÿiV òÌsá%i¼3ÅÆ¶#ûÖ‘Ú›ì~x @Ìã8õÝq¢(!ÂHP9UeGnÃ@0ù¡¦ {XD¶›÷¾ Í‚~`ÍvQŧg/^¼õûŽ À’KN» ¯ Å­ôrgü†Ëv»áŒ´+]¶ÛÅq¶±"Èu/¸v}+0É("zWÙ†‹q¼Ï7ÛPpöçÞ×ùÎÿèãÏÞï8éüncE%ÄÊwÈN(O•ÉÚ•©ý+á]XÍëÏþÉ…¶ªÖ÷I·¨ýÃqoëfdE(:Ï%B¼§[æ'p hœé·î1÷:“pª˜¡?;}v~¶ø£ËÁú.VS—ûükÝè_4UÕÕ@ïh+«]]A ,ÿ ™*Ï—‰´¹²yçGXXë•÷ž$žvÚÅþ>°8 ÿ øå‚Þ;"90FªžñB?Øùs¶ºö‡ » JÍÊØøÇe‡+rPôvspE ”Bãfñ1t ôôh^Æ ½»¶¼V;¿„4ÒþMk¬+$ÖytÂkÆCvÀ×É^œó¡ÃyÀÕBË™d³Á0j(õÿ&µÉ÷!µÉw$µ«²¨­ÍÊPùÉ-Ž `|Y7º1SÄŒ`è~œ|‡/ú(w2•ÀlFCq)Ð0&qÄdФTþÔÓWçÓôÔñÞsžåa®TS,tìgêFþ#º45=¬¶›»=‹á´dtÚ¿þôMȈ Dåq³ƒ‡&^• òŽë;6 šOÍ)Å|øEe”¶wzSµIéÃD Éw<@œºvb‘²È<~b[lÌÏ[µUÕMú§w ÎÝËs¿u‡·aáÔæB0Ù‚³#ÌøŽÆ aÛL+SßW¶X%> stream xÚí]“Û¶ñÝ¿BÓ—P‹!A$“ÉCÚ4½¤uœ±ÏOŽgŠ“pcJTHÊgOÿ|w± ÐQwçLúÐñø„°Øï]0]$ð/]bQ”Y\fÅb½–ØÑn» Æ«ð'Öp…#¾sëWÞ3&öü–Ü5Óðû.–$·o_¹+½+ÁéViôÚ,ÛG½åû )ί$«Q•Qpº >ôh3R`0ÜÎÄuœwR‚íËIÓ´(¬w¼ÞnÌ¡¯œùD5ÉtKZÒµ{C=W^lÝáÞn­›†PÚˆ(ëØ_fU5.DátuvQ‘jÁ¯§3¤¨$sëgO¨â,O¨ywÒhܶ S ¬_ŒÖ/#nàäÌÚܶí]'£C;KÈ#¼óM¼wag­ ´üëÕ=ëršÆJ!¥¶õKäƒs'–_ön* 4¥ŒÏ$éÉ…Š«ÄÌ’XÕ"‹«œ%ñËy2)d˜ö-z±2êOG‚OoS8Sªj±*AÑùèsÛBSéÂû5É“¹»ÈÔÓñévn/ç`ï’Ç·âãü6"“Þ6)þ¿O¶2–eî“-!L#Òß‚¡BE›û›wóIN¿Lç0‡f'ú,ø†…$I㈳JA˜™Œ'ÆFy§ÀÍ€‡¶i$3X'CÆIƇÔóâP€¦‰X:™di¨·sÒ AÉ@zr)ÒƒSP¦ñ&OA^18-8vÜ]~>¯¼Õ@ÑÔÆ“þJž!™.<¨‰n÷X„Qö(;BÍšÙÜ¡á-3k—‚C­(ÎLÂø§(‡xT9òyå.yO;0ÈIT°“!þlÈ@"ÑL‚÷Ìó@ä™ä¾|ùGÅ_Á>÷Åÿ‚1Ìã’maõ$éH.Š8ÏR@ ©ò?AúåÓ¤_ü_úÿw¥ÿKpø@8Œ§EìLäÝÎtf.‘Ê@ˆEêÞÌúè4é˜0AˆØB™JŠ“dšE›z¡#†/8ŽÁ ó¼„ù~èê›Æèß̆*IäÿCÆú\?JQù’S{¸Î Ùã¿ ²(G®¯°ˆÛ­[Êâ;ˆ÷l5Ýr š«)…;6£€iæÃâ–ãÁ³T+ÀzÞÒ–RyW0LǮ錚…=·¥27ÐÞ}Ž#2ÃF6@M¹ýƒY›¾×[He'{ž_nÆà„…¨Õh¸œë~;õYº‹LÄâ lt7>ÉЈa…r|ó86èëgŽQøLqÄ¥ª’S›,ñÌ‹%AA$(pÙUÈ2.Sg„ ¿ìšc¥_•¡ØsFmz³f8wfs$¿ixÒz²i+õÊzØ%KŠF„ ¹(ërêM‡¦+­¢—Ρ>Ç+Zß›Ë6ØÊªT¥'«ØÓ§¡Ýë¡ÆÂí'­´Yd±i-® zÂ܃^¬Ñ?âPׂi8˜û»\qäüÞ:hÞÆš9UD?Y91D >ëíÕOZ¥ï愵Ȓ FíÞèÎ9Lì£Jõ´5 ü{V¾…Š“1ì»õWp…¦ÿj×¶ïM¼žÄ$q\òmnŸïlãÔ‘òc§ÃÇ)6º§>Ý7ƒ†cP¡›%PካóH68ÏYP„Ð¥8·gÖÊ*2Åìk§v8Nlæ§); m£`]1ԙ⃈®jâ´G¯Jð$e åÌŽµ˜3ÔÍr|·©žn=®äú ñk’æŸæ¶Fí-¶Ø#£ü;y±0ä?e `Jdé>#u3ˆŽÇ ßGA/_º˜Ã¢è Ǭ0‚o\”X]4O|"…¬°µÑÝ–GëïP¬1zàüˆ,7ýŸɬÿ*vÃüˆ†¼|Žr˜-çáÑáÚ20а^ ÷\·ü> ‹64‡±šwL„ÿ81Æ:g8ÍÜÉ{1‘ü|) ÿùme©88Â9}ÄPLo¤÷¿w˜œ‘±JŸ¹WÛLÕNÏÃ>%’‰{ˆMïa»â¢ Ž¡vœ-ëZ ?ÒÅöØÖvÔÞ›±Xu^yUñT.ïæ|–œ¾Sá[\AîJ™s‰Ns2ýx‘™cÊ"Nrñà1UœH9=²÷§fpQÅE©Ba¶ v‰z¢ŽÚëF÷½Å£âl¦ DžboXÉ€C42Š·E˜×}Q#¿ ¶GõÆ…,ŽÐÚéYUìOSÅfª¢T^¾`™ #£Ð-ÕaròàsuO0e™=HcPÊ‘™ºé[Ú±´jêdk=ŒŒ3mŸf1RXôËÚݳ‘ˆe:Jƶ3Ú–òps ãìGf*e¦ž,³lŒÑŠè*S¬•” Ze µ-'Ê%„3ò@‹ÍB`|ξ©›ñ{ܘ5܃Dº,o%j;¾eö@XòðżB+(Ê"zÑvÆŒ0¡®2L}lr¸j!ÉÓumÇ+Ëk?Õ¼—’eBDûÖµšú½Ýs±L¸Ò¥ —Gß"‡„Ð L‚LBŠ6¡|Ø&@ ^_A0n^íLg,,rô팰¶~ürt™Ó|OÙU5DXug»^‰¸ÌϬϦF’¯>οì¢ZU&'÷9 ]ø“°¤ý4'(í­è©FGCA€¨¢ögüô‰+Ð8·~0t·³¥TÜe ù+AyömŸä¯ ¥ºB +¦PcÎýQ%¾ –(…~rú œ-`{­{nê ¨¡‘¦Ý®àôuP&ƉóË)eÃ-š¼ó{3ûú•e¹ÍböJÅTjúv>]e9 iúh>‰J+åT[G´Ïü |ƒºË0Sm«3<´‡UÈÿÛÜ>ŒÇÎ?à ‚|Ž5/üdgX°ÇOb·'íDÞ¸XðÆ{»Øk{®ÜŒQdÛMA~Ôø_ªÒ_ endstream endobj 2400 0 obj << /Length 3040 /Filter /FlateDecode >> stream xÚ•ZÝã¶¿¿ÂÍ“=+"%RR€>$M“l4EºA’à µ¹¶r¶äJòîíßù"õ±Ú»+Xóc4g~3CžÚ$ðOmr½É‹4.Ò|³;¿Ih´;l¸ñó÷o”Ðmp;¡üæîÍ—ß³QI\&¥ÚÜ=LYÝí7¿E?V—Áu7Û4M#óÕÍ6ËLô£ŽíÍVçѾǙ,zh…äà×UCݸߴÍöÚÔ0æ®jö홿z¼16ªººðQÊ6RÖÜüq÷Ï7ÿ¸ bmb“¥Ÿ¹GOýb£9l4ةߨ¶qb2ÞèíMª¢',7ÑÝM™E-·é ´TT²Ùª<¶©|îURD{Þç·w?ß@÷'Þjçþ{­»9ØhÔ3ÍptÜø÷·ß1Yû°˜ªîànïë~èêûëP· “ÿž˜dï™"÷Tj"Ðÿ#®ídªsLߴªq;×÷U÷ TŒûÛ¨,.³Œv¥­å]Ý‘pÎÕnç.CÕì¨oa;æHf<ñϰ~»m¶¿ðÁ÷2Gßc¿·góÚLqO .Üi¯°«fïö1š^Ý­Ãr”~ÄOceXúIA;X ]{:¹=ÝãÂÏØ¶Ñ¥êª³C+çs.¦ç¬t í Λxvk¶ÅÖσ˜F©è›g^fïªëiàÎpd‰¦+Ò„î§le;%/âÂQÔš(elã)ª~¹ðá ¶ÐàÞçd¬šh©ˆØp>°RS­ã2OE«JTàÏÞ¦|ö6›ÛŒ?]Ã3lÖÛøä›0sk•/Рç–ƒ´ =µ‡-Hº«DÖ]÷ô°KS”®Ži®="àÚ&Î @×æÚ½{lºöúDx·j\¥‰S­üõ/Ђöº§Úc“M§Ÿ˜"¶y°‚L¢’ÅÃ,ÂÆ:5 0qõzmm+ ›PáÞ×VÌb + >¬±²±QA¤±Ñ ¹—lPð‘¢#x¹Á"Î ³IãÒ”Þq·€ïƒ è±çO²É€{™Ê=ë¿®z€ŒÎ!ÆLø>‘évrî°ä9™Ò±1ÙÜÌ<¤!ž1‡¸éªó‘{;%m·¯0eˆðÅéÎ-°~@ÁHº–g84@´ec–ØÀ'#Î"põÕùrrÝWkØ@W'q¡ –ewc,‰:ü [ ùSéBMCÿìĹÁyh pÄx›D¿ jþ±j’tg(O1J›„•–³Ò8£ÀQÒ‡ÎÊèÊábS{Ù=ïNõ®:@)"w¦,°«åË(ŠèBXÂÑÞ9®ü Üý¾¾¿—Ñwצ0XÂî?ËrÖ}–3Å µ8‡5#^ ³83ØR^ä²%œ[˜Ò>‘á=éï€<¹Ýà­öUt³e¬•ž¡Û±†¸KèöH ïv­?¢U+Џ,‹1ž®Ù]ª Ù6Æ;8•O.MÁ¶¦?bkŸc\·Íš{öƒ»p«–ü·òZçüZ“Y¶¯<>-ŠJˆ]{žå|@~AwŽÃ9Ø8ORoìu¿êÍ‚•$†þ(™ßçdÞ†Ÿ8¤uœO%» ‰|äg2”(ÃˤS\%é´ÒÙ¹ÿÄ>D¤×qý?b¬µœ v­´zw8;N{g¦‘N’lŒû?!ûfÓ€$ËËå8!몑"A?î ³§^ ¿¯Q#<È¡âO‡^LJû”ËÊüJ¹§Îqw´ø wî„­Qk²}ªöt 0Ó6oQa†•Œ4`l!÷쇑sàul»Êá=w1%özA¬ä꘤BeÀ1¬Gg¥<°XtýI~Œ o¦°bÎ?„ï[,Y³}ŸcO 6hsnI» ëp•hCáäKšÀŽ=SÚój´`ãã“&bªØz:ÖÞ·©+gƒíc5Ö<‚Ù8þ²Ÿpû ™÷„3ÉŠ`ÖØÁ›ÑßHc9˜ñ¯ç…äÓ0Ygei ûéÐvõpTŸ:$Wœª? Š!çËiLËæ™‰­É>É:_æmf¾y«bcõÌJ¿C§Ä2(ƒ8»kϨúñÎçÀ#ìA4µ„]=­P˜òälI9ä;nÁi,”gŸl1q}ã,K—G+×€¢Æb*+!B_ÆDûa%¼*uÆõ N‚ªOØW#Ð /QI]hí¯Ý8ê™cƒÍŠp­”K˜q§œÄˆÌd¤a/D¦ñ:æ:v ràwÌѰ7É'ÈSrY¾ûÀ!Î5½Œ×")ÿœZÔÖA®4_¢Z°ƒbríIQ¸4„+˜J@©/i ¢ë<=Š}è2óñº¤ìù É)0¢ “`={áøCC; (cÓßv·²ÎPaOÔÇÕ)á±öÕú ˆ}åàsˆŽi$¬cÑÞø$ð¨Ã«B;&ó_¬_îLüuá]x¼èëˆ`ã´Ì>ºB (ü–P£ëШm«BÏcU‡_­-‘BµhCÅùkÐÐËŠ æ|”íNZT`óÓI—ˆÁQq„äI©vE*‹6ÛÍ/½@­’ÅpcœëñbÐçÚmÂSÎð”/à)Åä˜R{ù’S{èH-8•Å‘1†21òä¶ÄP"zÅ[9õ¹/®„Ð{|”q­BLJ(ì§£¥¶x+gçÑò[¼9?× d`ó¢šÔø†€;z5¶ªYlýÌòâëéeÉD`h5²b~¯Â™O–óewN—ÝØõ§àovÖÒX}bã‹;ãëªãÙØŒwÆÖøê8«ô [1ßT¿xQ¡›€U7„ÌCϲ:4~òÕX›(_‘(L䛚²ÛT©‰ƒy4ÇÑ©Ãäc0Ìñ‹¬F«ëÐâ“_äɳI3;65Ó\®Ð°!Q3Í‹ñA(σ;äò¸•óƒt ®g€È‰C¡8À²,·¯•eEáŸaàþå§¡yæ·’êÔòÝíZÜè%ÃØÕ´_bLQ~ùU‚Û{EM‘©ç>eDŒÅ]OoôÆbо¯.>8{‰«a&;2‹!ìâNõ{ Ǽ«òeè¦G y€E†¾Ã–¿okˆRðjÝ?i†—Ìްkf·p»¶CËñóýõ4¬—%'À‘&<–¢63ã/XMþÂÅM>sqã¯NÍäå’Fƒ}b ¶È~—Í^6à ·ÍlIësµ¤­ê×Ñ!…0lþ/p0±_‡^HÔ•}…íã§ÙrL²Ó˜ µÐ¢‡6ø½tœtÖòŒZÍW! +Ínð7ç[Ú8¸Z> stream xÚ½YYsÛÈ~÷¯`ò¦¬1æÀå7'^mœÊ:Ž,—v·T9¢¥u~}ú˜ÔXRÅ®8è¹zzº¿>F.RøÉE¡E©E©‹Åj÷"%j¿YpãâÇÒ;ƒgÁÈ?_¾xuže ™Š*­äâò&\êr½ø9‘y¾?:ýƒ¤ÌløæëmçÝùèïW±ugY"LÄ›Y}Ym›2 Òy@NcuÿF†sŽò%Ü„ /3—¨Hä0˜HŒcÃ2µéÝ÷5'–>t@RX O^"÷í= 5á £9ò]óWWeÙp{ʈËxqÃì±â¦<׎ÏGS•B”,óXÎãzXä•¢gÑÏ\ý%;û†]gϳk.)\Mñq̺ @$ó=Œ»„S©…Öl™ü›Œ»Š‹KI©žiÞÕ÷5ï .-/ç:rák4§VmB3ž¶3å‡Vm¦’Ï̘¿×Ãt2…ؽ£ãVÕ÷¸x Ñœ”•—âÛ®âÒ&(* fߊêóÅç×þr, hDÖ†l@Bæ3Wí…(DJÊ'õªÌ(䙩Õg,¼Ex†óåräyVÈŒ¡µù<¨— Sp!)aÕ¯SQ¨‘éË‹O?|-}22Êmâ²Q9ËF1dÆú0Õ.e•t`ý}sð³ÌØyloÿ5š/Á¥b£!g9)`:þÜœ®„LG1æ*(V]O*Ç©?(´Â´»+¼®jWpÕ{¨dG[5UjC§ˆßc> br)5Pgeê4ÙÑ“Êa§XêÓÈÆÕ®Dà„rà ªØÂ‰ðÙÁÊ`Žã£Ú….SqJ ãtÀÛP«[.ùÓQ§á#ï£éÖödºi…ŒnZ鯹iŒÒüi7 “¢#Ãĵ- ¯éé­—v™ ¸÷8åòü?º÷<þ"8Q”’îöÇÁMÖ~»“j¶{6Gÿ :v⾺ OLòï˜^:GÅ¥DgèG}+t„y}dŒ®gϰÐ1>Õj÷\Igû^ÄTOõDÉÚMFø\}`ªs×ôâìΣ„üAÕÅ)æ[ãÛʼn\|7EâÉ)•.1•.(•Fmè£`~þÎê¥êÚ Ï·îÑ•—‡FÛ9DF‡ ºó¿Ž‚/l9–ÎßüýcT¯µD‡=eOX~ƪ]Ñ»ØXiaQo^Æö–òÞ)ê{$ô ê‚ãÞ×cf/3˜ ÇÿwW)• endstream endobj 2409 0 obj << /Length 3151 /Filter /FlateDecode >> stream xÚåZëܶÿî¿bûMxñ¥‡ƒH“¸HЩsF?$¡ÛÕÞ YI=Îv‹þïáP©åùÉÁPø`Q9çñ›áòM ÿø&›4“,“éf_?‹Mow³¡Æ«¿?ãvÜ»zöéK­7 t:OxôMCÇMÔ ·¾´R“Šåà\߀œ„‹çêžÃ ê@ž²$MÒÉ’Å£>J<²F`[ZA³¡ÆlZK° #!膳2OÇ*¨£ G? ÍF4BAlíiý| [§YtEB…¨ßŸÚñŒ+)—ü0þód_•ÆÀô 8¦¯ÑM‚¥óèLÔrTXó­iš{c´¡þáD-½Ý. }nÃéûYPÄ%Yqòxƒú)3C †¦°Ic®fT]¼ ª+FÓlã ü|»KdñÐÊ"†@9‡¦Ï¬#‘ [û‘1ÀÄu¥}žª&ÄÏ€žXñ\:ðvïNÐ,]"ÊÏq‡È‚afz‡¶§™ÒóˆÁØÅ–8ÇAqÆr8Ÿ…øU,SÙŸ”Ý`Q „éônExÐîíE=¸îlfF:šÄÉJþ>)ÍòìÂ]P\<;°Ç©sØÄxÎà©°:…áGÐ'UÄUEÌŸà\žZÇV>ÊÓ±§1…ÇiÏ‹‡´ç gÀ¡rpêç¢ïcðòŽ\¤ÔÀ`æƒõÚF4¢öˆOIˆ3bpØÉàÎ[ƒ&Ì ¸Ä/Î k5s¡dÉî[Z¶kÏg ¡Øgpi ™r€p‰„ˆÌDÅl즜ئÎc±¹â&c?81³Þ /c¶T„ƒü&R1,ùè”.½©ÇóPÝž«² [DŽÄ’G ÍY Y¥$_÷”±gÊÇ‹Ð#- Ðß64ŸÃ dSR{•³à<Õሮ<Œ{Lôiª%n’ÛWÕvh_Ý4€ …g1E@°è5ÞÄY”I¤N zÄwƒ1°ÃÈ?%ùëd‘?Œ!6  ª£L‡ÃêsùÎêYÓÛ#b’ü¯¥Žâp¨PT˜â ­¾ziiP¹ã<IZ&mÂØ\Yì‘ꉔ¦LYÅœèM?”·Ìž{æž{¼JêÛ­æQÁA aÎ糕[=P`½¾¨T¬;š¸§!]ùÛX3DóéiÐpByR«œæÝ˜½`Û˜;.h,w_ÞŽWõ¤´–K×iXë%ßÁð$HT’™2ð•&üp¨S;~.Al x~ŽIƒ0i§ùf¿4Um‹\x”ØeŽË:{Ê^ÛdR –è¼Zè\û¢«êc•- !lîœàWå±KÌ€l&®27§œKun%îP9¾sÑ2ÃêÍóÐÚ\i`R=˜& üÅÚbÃÎEl†'+(t¿láÀ)'‰„3•&˜É0(òƒu¼.T_âXÊäÔì0™Ò‰†ÄÀMÂÿHÍN(—RJ¤¡fwhÇ빨é‘Vé  ü¥éƒ%:Cvkß~,‡ž8 G ‡>sb>W,NøŠ›5¼Nòù¨Œv©Suú\ýÃ=~¡ÒÒýœÖXŠm³ú î®=NlË«S³ º`ÈtAÈZúvü};T{ôÅÁ" ê¡– ÖÚ)H†)õö¥âp1²“¡ê •„$æ£ /xñ¯a”çÀ‘x.G¥,Í“ßë¬øƒ …m>ð TÈäó›üÝÇ1y™AVì=É#)ÁÿL&7grëÛ0çäa³‡Œ/Ÿ+"³Õ ßãí-ÁñŽÞYtï©‹†º„—ÊÅÿHbçV®¤”Xj’S© =­«# )­m÷3ä# aªV6ð—4¨=®Æª~èª](¼_Küœƒû–Û|"ã‘U‘g+È…=î¶)Á^uá;UúsCèÅΣ}Jø#ÝXèíHõugÚ\ô©£ aÄÅÓ8ÀÁÓS±ß–Ö°Ž<–u˜ö•³Z¾“@C²› Ú¿6t¥ÐX¤N®=xÏ#ôdi~©Æð$ã³3ø<ä·¼‚ /wòa˜SÙH±€:”çvY¾ßÉDÏ·8 ˆÐuQ$ÇQ—©­Ñ*üR0y 4g°Ÿ Òµcˆ´›Ž~hÕ•qYáBÃð2ÕQk\€âàSºÚ‰¯FJðÙMÏ ›ÔikÔßiMîë·:ä~'‚‰³Í‹Hë áé:Cž.$<Ä…c~Þ^ïAx‚µIû¤ X.¹Ïg¹:on<Ü[˜G×dÎíÙÙÖÜ‹6œb ƒGÎ$ ¸h&£µ\1aëQ¡vü8¡V(ØÔOj‘ÿÒÔ>x.µ[Ù¤xü‰îrà-BÊÅÓÇ.°“"eYž{J»Z'Üýuî î_tz¦?—G«b(å¬nN¶dæÛ ï²÷cÃÚÊUÅÏXçï­R¬c+ö¬!¼tTÏâÑ_±{ªsqsõ/MÕJ9Órš"›œ&´Èi f±±„Y³–f•˜%Ùã§Ã‘5÷¼:öxϵ’_F~8ìýgwýþcðøo0ï’`'«Ðü×á÷Åd0Ì…Ô#˜»~N¬…93õóà·fè–Ö“ÛõçœÝé!q’”@¤‡W¦xöé³45ÛSij"=bo×<°ŸÊm©£ÓXsãj*¦kì]­%jÇdK|õ'ØbdúàŠ³m)1^§_˜«!A°^Ó}‚‰=]bã-ö{òBë·LÑ3} K¯ÁV´ƒº•»zZŠèÊœDœ¼%tÒBc8µ½mjº ¬‰ÍokÌŽš)©†©ãúSu$˜U–ôôÞÞt.ŠW+ÄùŒß·T>´¿/²ûñ^ÄJf#—­:iÀqlæºéú:*ÏÜHüìBæÑWF&/ïär¦s_.ïïB׺Kt~y«»ºÖ3Íù¶¥l†ðµ " 7²þ%\BJs@)ú•R*_ý& É„5%h,¦”]Öõ3á^ݘá…Õ |9•3P#°Ù·µ»¯ºýX÷¶ˆú6ùEâÏS†ïÚ®l—*~‡Š!¸U ž`¡+5å9·ˆÝÍ{ħÎvì—ÚAÜù™™e ÑôÖ×hé¦YôÄBÛ¬ =gºŸx(ß ]YAߨ•3’7þ…Ñg¿/íFY@ýÚÎíÍðܾXdâÔçåˆQœ›»![®·?ÐÁ6ÝHu¿þžL±÷ÿ†ûÆ endstream endobj 2414 0 obj << /Length 3263 /Filter /FlateDecode >> stream xÚÝZmoä¶þ~¿bÑOrzˈo’ Ò&—:@/©ãkQ$ÁA·K盛•\I{W·èï ‡ÔJ2ý’ØHÂLQÔœÎóÌpù*…?¾ÊÅ*/$+d¾Ú^¤®·Û­¨qñõ îÇ­aàz2ò÷—/>}¥õŠ§Ì¤†¯.¯¦¢.·«žgkad‘%o^¿a_¼>[K)“7½í°¥’?•Í™(’cYŸýtùÍ‹¯.Çé´ÐL+ùȵ…Ñ·˜­8gFk(2–jE ¬šá ¿MŽÍ±{»¯†®}ÛÛám¹-¯‡êƒ}{8ÖCu]W°^Xß§¯²tº_¡$ˆ.` NÚ©Ni˜6ÓaŠ % PÄEØë?Æ H-aýnq¢0¸ú~JW[x÷Í*e*_}t+ÉD.¡U¯¾ñg¿ÅÙdRçLçÙ|Ÿß2ùâ⿉™N$g7ay×eWì`»>¶“L°ú•D6F|Kx 6ú\øÖ!²CÇÏ//ðý·ôØ—‡ëšËx Ái(b:]µ«Êp8-Ëb*•bÔ}Øÿâ˜if̨ó)†š)†TÅ…ë¦cüùMlÍr1Æãˆ ÂqýÄýâÖJJ–)9·í-géþ“Ž¡±óHÕÐã¶ê‡®zwª¡¹€’ÝÛþ¸ÁÁ{zŠn^¤)KógÞ½¸Wœaù„ÑF6í"ü'°‚Æû¦Å×ý¦ ÕÝŽàƒ¨s!Ñ%¡€vÉÅYrÓ“lgëjï{»uÇÖóPìÆÜ9‚8ÿ¾å¬#ÌiÜôÀ#i¿t¾ý¾=Ö[jµñŸ7e·µÛ0Û%‹yò ™»c׬«&Š”*…žÆ¿!Ëv,ê9r<@?r©â†“|¤®ïœð…P…ˆ1‰,[zsZ’*ëåÜ$!é¼ð‚›Œï‘à›tÔ2ž(ñZóаwŠ‘ç‡kd_m\rˆR0 ƒÓÑé/÷ž9|÷å+Ú mJzÓcž5=‰Ä‰ {ÚHÎûwHX”Þˆ¼oã7@ÏšcK vs<" ¹‘÷“> iëJÅ.ÔS¸( ¦eæ$e©þ¸ÍÌ1ç²áˆÂˆ9îQ¥N§Þy'ƒ‘9hcƉÂ(OabúW,;Å­ù*æò!1òv±Pµ<ùëÞ61ùF éŸ/¿òËv¥·þ6Àà#%G½¿ãlOòÅ×éZ:*ÝML.D8uŠ»ïãÀŸž\c ÔÍI  ø†KªÝê‹äªk3;€¹€qŠL/`4ZÒqÜ -Lìˆõ!ÞÒK2®í"Žt¼ÒÁ=v—õxä°?€•r‘9îCýÜ7È:K?–H¸g†ø@F@é#g")å@-[np³ûHaãëÝØìàf~_×é·ðÂoê#ÙÆûqQÛ Ë£ªüÆa+»—¨é”LC•1s¢ ø¤.Æ‘¢àìA?‘¿–:a˜™Yv[~Ëï(ˆ|–†°Næ íDÜ]I×ΩúÚࢂ{ vÑuqlv<ê°žh .F¼P ¾²M‚“«[ïâÀŠFÐQ:z: bHQñ*PTiÐ<%uŸM” •B˜qŒN#ÙI¼ìá€õW71×ààiÆïpyµš'Vø»SƒÏ¹§–ë(­xL]âÁ™âÀžI–Äõ)±\ : dÏP²9,À¤ªó'ÁzÐQH' ëÇÿ{XWÓ<$®IwaP< ê‚$°žY,Á0. OZ¹a©¿fÆ;×wå¬À¹ˆ¨â‚]œÀžëØuÎY*¾ÅcŒo\Z€“ûa,õ‡ì;OÙ©u2f§8Æe§î‚«äãí­ƒ²ÿ’åIŠýq.aÅÇ€ØÑ0aE˜vU"—·¢°»òVn¤~l⪦ƒe^!|ÜsK,šmÌ ñaÛ6aiÇÎêl›US UYWÿ"âAAJbõoA&oEûm®¼šÅyˆÈú”Ö¶Ù û;²Ã°gª–5&Ø…q°2Ëd;i ½AÆ¥ô2¹Á¨:…Zm.é®&0$ìðå|h "CØøvÆO¢êyb§÷&O Î ¶Î 3Íßiž=ò4œ¼i©Ã‚Këüm ‡ºð»u/ý€€ÜÖˆåÀÜ!Ö1Ë^’I– çÂteýHéôâ­W† ÙQ3¯Q5½ Y”[ Ý;høÅ–ÓeGp”#œþ8¿d!EñÿÍ/Òçáé3ò ªì;†ª÷Kº±£k’ÁF¯G8@‹ÏPC¢€DQ­€–°»§\@hT9w¢TVЬ_õ:Î4@œ5wŠ—±,RÎ"F¿KpÕ€Er#r›ýînÍr˜--Šç¨Î éÊWB†K| Ë Ø†DÉàB¿H±s¹sÅþ²K'§Ü;µY˜‡¯˜¤lÉå¾¶CÈö¶?|a¼ÙÙÜnŽ]jÍäÒÖu«œì:¦E÷“쪹ï>.â14|^.ô¸hR5·«Êwµï ¿6ôÔ3„ïn]v@ŸC?(¸ÚBMRÚ;SìâÄÆÖ]®=bf×À#2”M¿öQ¶0çÄâçAmw°[ŸŠë,é쎒`P]fþ·eã~ú1é÷…YrðVn×hfxË×zƒøYá =üÙS]d‹7[œ'烵ñ÷àc½ÄMÜùFçÄݦh·ÍÈOzFï¹j뚘÷Ü ÔvQ1ù”97øá'’ó9}ûïþôyhO-c¡ ìóŸ()ÊS€¡%‘Yd@Ì=÷|ÉT'Gd3^½4µ¯­œî›fÇoë Ðx¦üíì¬Ðc¦\MÇ4 ·~î$çOÊ-ûjkGÚÔ‡›t¥;jöxù샹}gûûà–ƒ*3ÅŸ%¹/ðâ±ékö"½q¢Tf ÅÓàV/¨#d]rqÎ/l¢¶ÿAÀ<þÊÙå¦ô?2£H.co]^=OD–ft¨?\øå9G7&ø´®Ž/žâÓô‡PÆçÝ*M“ÎoÔ„k\hŒZ ’\R ˆíÛjqÕÌûð‹¿Ä™:/÷ÄŸ±l+’ʕ̥¿~1ÐðêêûÊÁ v¹j5ŒÝY?†êàÐèŸS mP»&ÖÁG¼ ÈëŸ|z*ìØ@Ì«o¨íž] Ž…Î`KýîVÓmËÝtúÓEóæÓm³pšþ wã*ý endstream endobj 2422 0 obj << /Length 1441 /Filter /FlateDecode >> stream xÚ½W[ÓF~ß_aчÚ+zóî×3¥iÌ?·yŵ³I¡vË›ÒN¸ÊgjG©AûtR|âÍg? 4!(`Û òg.Üdì»eîŽ^OòÇÇÜt ’&Q«U ¢µZ‹‰ª"´äE áQ?}‹D#=+ÛCžÀ½ºVë'êóU}0R߇=„.Ê ƒM¸n­rÜÐVá4íkvkÎ/fßgœPH€âî#‘êŸ uŒr·=Ö¬lâ³ì~HW;ÛÍ“n˜aFAZ_ù×G¹~ÎÓERi‘f¾YT| Ï”7yÚÔ¢ ª*!1}~þ~2Ö)-‹i×Én…uÑ7ŽC¿{ À˜ŠK«DàL·¸°•ÀkÏ´CŠ1=ȆD}9º0¨ð0ßEÕoõòÔ¡?«ø¦­$÷ù.Öò-3XcèhRIÔ^YÉ÷ŽÜž¦b˜M ¾ÝcS²â#ÚÈãc}ÿ=oº=65MÖ¼p@(Øg¬óâêZPóf*ÒZ˜!÷nS]/ƒ{-z6/˺RùÀŸé.ßk"Kãà`ï‡<Ù•0ñ“‰’4oß–z/!r~)7¨ª€ÑÞø´££WÄP@tK˜©Ã‚Ñu$ß6=˜¿èxÏ™ýåEÞëÀ®{i:×y“ëÑ‘/WeÕ$f–™ÁžÎyúIßÈvìN…3Û*É»¥J÷è˜ïY¢ªÛ4åuµ ÝŽßzµÎ ­‚Žû~lÔ_\¾~ÝéÏ¢ç`ïÐø0V$fô¬Ëv¡—iÒîäsÍo¡ö›ŽóYí¼&Ò™aVe^Ü¢aSÌK Û$“·¥ùÉÖ+ù¶Ð£YÈÓ½=lUÓ™À¨xšD}0ߎόgEQ62%äL‚âA/¯º ù—¼ÙÚ=úã|2}ñôüõåx´÷ü m&l endstream endobj 2426 0 obj << /Length 651 /Filter /FlateDecode >> stream xÚ¥UmoÚ0þίˆ*U mcü’×uûÐU´ê¤USmR‹X2‘9ÉV4õ¿ÏŽmJ R|v|Ï=÷Ü9FdØ BBX³¬ëU¾°”ñpÛAzŸ#6:;;? ;½ϳŒ5Lv¡†sëÑFì:8"¡oîGàáê¾ëBìQA¹´\ûKœwqhWñª;~îô‡Ûpö€ç’#¹™Ý ²Bù¾+ù!Á#Wðôô\EòEF(‰`¤{g]‰iß•jL 5®YQ¤ÓU³’©‘Óª0KKmÌÓ¢äé´*S–«6ýIgeÓsÆi\ äž}Ö3TO×ߣçL€s5YМò¸d|hΉ7¬ÒTt0  Jç:¯Ò€o”‘1N/Žâc\‹%«Vnj’§"y¶1QL¶ §zCFE  ŒçÁ7"UyÅ'µŽéù=XÏ„.ÿUµ{ö{O‚Y¬‹pX¨V)•ýC¼{×L¡ˆ³µ)ÂYv”T­M¡«Õ_€÷$ŠÞ”!1Ô¤éGx©õÿ€¶æù¹ÔDMþÔp‘×"§â?ùEgMäwaZ¸¨VeCÙÚW¹®yš—‰ô8‘ÓäâTÎÐ"n~Ò€x„ãæ_QZÍó‡›Ê}[Òüøn>¦¦û¾ÅÆ>>¨c“̶‰t{›s *‰I‹÷®î¦³ÃöÕIÓgs¦äÎþ÷»ád0º¾î{ ºÍ¶QN†&͵L²8•Aák¼mÝùŸßn€ÞM î ¸ ä÷×Á!Å“€HSï?ëóD•õ@œ|¡æW_ïjÊ5Ró¦‘À'ú.=ë~·K*3Ñ78°K:7òrù vºl endstream endobj 2430 0 obj << /Length 2839 /Filter /FlateDecode >> stream xÚ½]“Ó8ò_‘º'çŠx-K¶lÞ8Xn—-ŽxŠrbe¢[Ƕ3³S÷ç¯[ÝrìŒYæj9jªÆúhµúûC‹þÄBÇ É0“z±Ù?ŠÜj{½ ÁÛ—íp5‚üÇÕ£Ÿ^$ÉBDaåbqµ£º*‚g»âЛv¹’RÉ“åJ©$xmú]³\Å:(;ÜQÁ¶akS›¶èm}Móº©WÇÚÂþžÚ¢.›=ºY&iP´¶è à"ÍÒ@h±ütõÏGWÙIœ„‰’äÑCßcT£2Œ€SϨ¾óŒMBŠå*Iãà=Ð\¼~ó P©“à?ôù%Ñûe®³é›f‚ÖжvST4-m×·v}ìmSÓÊ­íw4úÅ´µ©½…Ôa*ÓÅJ¨0WŠHèö T)‚¦ß¡ü ´“µ³òÇâ(LcIÇÞ.ü÷åh[žÄAù„1Lô›“;ج;ÓÞ,ã,0%)¤+ö‡ÊÌÞì®DŠ˜%vy.vÿ¾}á¥éWǃ3"¸«j–`A·É..ñj`{¼›·Dʾ409 µ&£“0|K»7uòvJyñ$4[Ûþ›T×MO÷X\…d÷ ²ÿ妭!ÍÔ÷ùæ¥~þµˆ¢Ot1LžGŠïì°‡q(>9SZ©8LkNçß³ý‚ƒ±K¢‹É$99 l&à€K ¢Ù3жõ }ö¨cÕÛ‘ÏÒŽÙû‡é™ý®~Wô´g;¦È’ÕÕD?ûÀ ¼S$Dþ÷ï.˜Ä™¹Â™krÑ:¸ÚZµ¥)è„»O  Y¡ïh¼A=rk0þ¶I\ó­4H –jÉhŸ£ÞßÏNäá´ã1bî±×»[³ 5ý±­il{úR¸ˆutÍÞÐZQ–È3ëÆvÆŸî@#[FSÐgÏ!: øÉG»¢£ɲ½#µÝ0ÞCÛ°«µ½]¢w£a<Æ¥<ð‡=¹›‚/^Ó‘9v;cP‡‘v§e”’Œ(IÀ* 1"kƒ…߉2 –n¹Dÿî½M€éz»DÝË4xV™¢uzà[w˜àvNnF+(zB¹CaªˆöæÌö æ´9ºZŒ¾ÙNXd…î KÑ«'wA Ü¢"Íå#¦(yàÚ < ½WcÙ¸(9x]½áuྵÐHrß)(›8%¿à;ÿÈW¾õÏh 1J•Mó©"`AÎónGQ½£é‘¿Þ³“v`\´<Ø4ûCeiªbäÛÖ0€eôSŸ%R™÷=G¯Fz½ÕV(„, ^õs\U‡ÖÊ ;À]ˆLU€vÀCNÞR0¤eïN]ÕÃq‘7{F‡ü{†"â`µ9 ¬*ÆÓƒî‹ûÆzù!Ì–1íø´Såã“ó¦… b ¸nméH…)ZdȰ!•ÊÀqõ"ù>鉄…“ÆCwéœÓPpòìØ¶˜Aî¨)GŠÝHä(&ü¼Dé,Høg1LàÆØ¢ð$ w ¸ÁÁÐÒœñãº7~„Æ29~Ê.›SÂ@B¸ŸqØNÙ=Ã솓B¸û™e‡9^"ªÄÅ?%(Çàœ"fÓuvM·)g ¸µÁs›ÎÐ"‡Ëþ„Þ,’ ò¹yàVrß`åáà˜œÎÙ.4-ß»Ã[î[ Û²HG–Ç^¿º¼iýiYZ´E0­;Ú,hÕ¦H>•¦nk[`!Lû. È[|Êô4p~ØÊ;¿¶c(ËK‚‡˜¯¤NßXðeUµê M¡ {DYô>ðíj®iØc挴 õ÷-UëWXì74~×™¹Š iÊ\MŠ.•Dø|9…³Q¤°RÕH@ÖJç¦qs_`°Ã†DÈãÎâAVÒ«’¦kùPïO³­¹\Žs»% š-ÍGî7#ܱì3i¹Œè©@1HlÎ"ðÁ‘F/‹cÇ~³ÓÅ-¸à¯r±ÂûOK®—ƒâH"9ÈOºfÈõ}3Ÿä(%9Íà€ÃrI³õ?šb–<{ Y]cbÆAÛ¬ ãxTd¡ýQ)ˆã–ϸxßóx!©4!2I¤mSñ™¾›Ó›?×8¥çÉÀW "s(êk絸K5B>ui`”öSöjWWŰ7Bضk‘°n è?X?#ÅÍó!4©¡b&Z‚h¡üædëþžP!•|‹?œ±”‰Päê!âÇróM_†¤8B­Ó…ŒT˜hïG>E‹6ÁVC¥·r¿a¬QWÕâòÑ¿ø5mr[œ«0‹ATR¦tët#4œ½JðƒŒ„:ÃJ‡:l€ŸQÊæ¸ö/8SÔj‚úOe –ª2=cSÝAÍê³"jFu›ÝõV]œ‹`¿ƒæ“ȼé_ü6¯5@— ¢,~Ž 'Úì‡*íÌ¥ó4Ló©Ö.KGµ£8ò†¡9·ÃÙýBÖ¶#Š fLdZÜ”_ýé_Ʋ®¿  êbo\Ç”ºGG÷ž|ÝrkpÞÒ$.Ûá÷†”*z\îwôÈcîv`äsy•®” —fÛ¢%L÷žšF³ã§9‰oJ-TY(m8úÊÕ`®nÆ=6DÞsvyò»7Y‰/C¦Ä𧜔jZœö¼>®*bäR)óSién‹&ë2³®M}ò¬4’_ÊÙpžœRÜ(åÀñlÈ9óY0Ñ¡„û  æ¦h7>/œå@Èæò”ÍÿJÔ@¤:‘B悺÷¯$A„y&UfZýÊu– -e‚Ù’WB 5À]’øY’}³x‘I&ÉË—ª7¥Êì»è Piÿ3á÷*^ôTÙYé¢"èzÎTv9x=Æ‚ô,„àʤ1Õ)ÿR‚¿‹aZžŠ1p”Ì5ÄÊú§æcQ*}µ“G,´tÃovœ>&§ä;9 k»¹xC©|Woß]Ìa‚¦,‡‘¢'2ÄÏÿs2 _F ü>E;ú0Ò¯?£ÈtZ2É”^2p“\ÎﶸUÌlñ«ù4ȃx“$š¼²"YÃK+ÂC"at¶Þ´¦èÌ{æš~Z:ûqFŒ~A[°]+?V¶ï+YÛ~’&Ô$K°ÉÏ*Oå8ôjyñô×Ëyíeî'| } ø/”÷º‚ endstream endobj 2436 0 obj << /Length 1484 /Filter /FlateDecode >> stream xÚ½VkOÜFýί°R©õFñdž~„¦-H—%ŠDÐÖØ³àtצ¶¨¢ô·÷ÎÃ^{×KúˆÂJ̵}çžsŸ3ÄÁð#N@ d(d“,v°~[^;F¿Ú!VÏE¯£ùódçù¡Á(Âq&³®©Iê\¸$ #F,ôÝó“s4Þ;yŒ1÷¼’¥’¸{ç#ºËx>ºœ¼Þ9˜´p‚ $8û‡Üí ‚äˆqŸ6©°à† @áÈ>uGqe}S-â¦,pgEi„4«’RÖÒ<-óìnä37.³¸yu™]-ë¬È+å‹fCp4v<@£È ŸÞH–w™¼7Š™Y]Ú!Ô‰PäSß QàÛÀ„5¡û£G (?ÂH„:—ØIáÛk#…νÖ\8œƒªÏAž;g;¿š õ#("‘¶ÆÂ°ÅŸðPplà?† Ú Ü`¼‹»VMàÇ8Â\Øc(#¨%•#%t7ûùؽ­“?Ø¢ó'Ä*ðn }6žµèAN‰ Æn/nçÖÂ}Vߨþ°†É2_–S³mªYmÃR{<â#ÂlÅ,V®C±r¹oéVCÚçj¹PRHÝ¢¾‘LPׇ}Õ€{ã#ØHuFž uÀâC/±6¬ ‘gù”6*/)ò$Vw#¸RSð JP$BˤKDý;.”/.•ù†Íóƒ÷ðNpÑ/ãÛ[PVÐʪoqÓÀØwåC-˦Œ~}-sYÆu1W`”rŸo…·zgcÅõÈD6p:€Œúz…†kmÖAÏÎTâ|Ü…: t‹ïg“}廠ܽZfóÔËrS‡Uçi\¦›u½Ù¯‚AÃ’ÿÞ°ýAÓU°ùÍŒƒA·Î&¥‚ý¯3›ÖqÉÐö¸ˆ´¶GŠl Lk}Fœl&¨Ó©å(âö¸xþt¤N×û?ÆÄÓçmV1â>éfsùˆò¡3,Pbºöˆû¨‰¯Ê‘B{Ó5€£<™/Õ Qp¼ëÓ]É72NÕù®ä8‚ NCu²måü]Öµõ£š‘qŽn~êÁÓoì_SƧâÞuaÖªóqV #ÅfY7êI7ÍQc¿¶-‰Ö8|+'³¼6Ÿq–ÀßY +JÏ'ý2Bœðþm…ŒÝlwhcZ,¯š ÝÆel£ôÒ,Ðì»CÜz»ÊâêN&_öö~"?3"m%ÖJ¼•Hãˆ`†ë‘ô[Ý •ÂK`ýó®=½;C9Û—É<.-8t¡”½R\}”I]©á$Ø ƲÚ0Ý?:›ŒmJu‘gÝ'ºk3ÑÐè þ.ÖÈãô††z»7VG‹¢Ykq@V(zwƒ¢³ •^®Aˆ A¼:8i à0n!@Þ€XÖB ¥â0+«z3v²¦r–å25WšîT*ŒÐ-É0±ï£¾Óé÷ÓkY@8Ê,Q=õ½ŽŽõ¨îì’Îv=8¦•¬§‹"•ÊF/Õ¸gcÈã_nŠ¢’½a¤ï©õy.zÊ¿(xØ?•ñï`€Msy¿¢´Õ•ÏMYžÕj³2ÿE/ŽlҲʮ‹Û¢„kMÝŸÁÉL~·³µ~ƒùwJýs§¨L…¢¡cJÎÈ÷±åT-“DVÕl9GæÅ©º`ßgMôˆún´è'çoÞØþ)`†ªî!Xà/\ àZg9˹“x¹–îJ^/d^wœŸÅËyÝl²fM_é-˯ѣ\*•D¿\ù¥3£ÍÌå.±}+³ÛÜž)#U w…ÒÖ÷“ƒñøtü¢q-Ï‹º“MùȲµ&åCV¯ˆ¼?šL÷ŽÞœV[¼S³ïócUz&ábŸþ»ñ¢àgªä*NoßAÌCÞÎdu]þˆ#Ln endstream endobj 2439 0 obj << /Length 1162 /Filter /FlateDecode >> stream xÚ½WmoÛ6þž_adè&'•"êŲ›f@–ÚA†4-°ž,Q¶:›4(ÊÎ0ô¿'’Š,KF‹-ë(òÞûQÇÔ œNÐw­¾t¢õ‰]¼e‹Ž$Æ·'H3ÅA³rò—ÉÉÅÈ÷;ȶöu&Ijw~7n–á†cÖ5]×5ü7]Óó|ã=æKÚ5Àˆ3ØñŒ„ª# L0 yJrM(1s’Šýµ|ÁBÓµäÚvýž²4äXà Ôë÷ ¸Ý?&¿ž '¥Ø¾ã[¾ç~¥Žúô¢.êô­A¯çžHèì OèÛ³lß“ÊÆiÆ™ÓãJ>r’³Yñ¾#6#x÷Éömñ.APq©)°¼’ æ³Íx$ük ¼at¾Å‘Z¡}@G8ÄQ€gòÈÍ’Ò K:”5ø!~#ïn'–ð‰í¾qvÑ$Ú&lTnÁµRRÀVÕ„oøS’r`ôVÖ4‘p°£p¦÷÷À*Wÿȳã( ’lXJx1cÊx§ÃñøÃX™! ¡\Ñ ‹Ð’´ LˆSXÒùgñOÈõÈi«Ôø)åÏr»›ÌF×w÷Óñð™ÅÜT1~9æÈB Ift­ÄÓi´ØÆ Ì %‚¾o·x3Ѫ€lé•}©˜ß¢’>ÖÌèíGòɤ-‡I¬Œ¥²|¦DIùæÙlM¦7ÿË_õ‚‹Q º™kÙ¢A•7¾Õ/¾íªñç"~D ¤ÚœÉn%Ö×ï ™ ¨½~!D®<ï…„¯ûQ_0JWXå~ªÿL„‹‰Œx€ÑEÆQ˜—ShaHH™^xu®”ª)¶îH´ÊcUe§Óñõƒ¤—8ŒuñI„‰…¼¨AÐjÉÒ*Ö[ȳXËŸûׯŒçB'º“§ªÁT6¦ŒŠ(ºAŠ)m+g±rW8tžó”«&Ã÷R²l”º¢lië ­»ç¹ÏyµáP |é%e¥t­(ÝHªÐ}¶è¡@¨Þ,¢UÈ¢ªqÌ€ö<Ô:˜Àìvø ºë”wÕò€v„Ôž#Ä×·7_"ÁÞ.²Ü¾S/&,ã‡Võ%ÆIJ°ªæsÕ ?¾ü.j­ ïá`ÝLì~Ť#n‹`e[®ì/Òµ4ÆW¶¤¬ÎµW±pÉikó*\©“fê¹ÞPÆC9:¢%ŽþR'T›âK\™…ö»X¹]1·ôϱ‚&!é]¨dÊò(ÂY–ä+K¾ø ÀÙ.ÕóüŸâŠŸöÕ(o‡áX Ž&CÂn µ¡îÉ;š¯b=çµ^¬1áå“0_ñ}3 &PŽœEYÅÞ:*KmèGß8ô£ï=õÿC?üný«ÇâR endstream endobj 2443 0 obj << /Length 619 /Filter /FlateDecode >> stream xÚ¥Tkš@ýî¯ &m@¹Ãðp·~ØnÝÍ6Ö6ˆM“ncPK#`lÚ4ûß;0ÃJ“¦ÕÄ9ÎÜ{Ϲ öÉA’㚺k:Ò.Õ.ÝKx÷v3ÔZ–¯ýÁäβ$0ô©1ÉÚ¡üPú,ƒƒ MM×–×˵îÝ,Í4MyZ",¿ R¹ò)8(_ü·ƒ¹ÿLg!K·°ù—Újë &H®>µm\ê¦f:mݰ09)¥»¼"», 9ã¼ ñöTÄYz%¶H§DœoòõѰ ¶„!à{>êŠæbÃG“2)&Pc¼Øη')â–3¾œÒÝ0>ÄNÊ€•“ºã Gî7¬DÍØïŽ^sÏã÷Yé*RM«–j«Žê2d6r^ò%!Å×,œ…ûbXž]W$Z›EÈ‹£&µ–T¡u¹^,šØ¿ª(€u@¨%:Ò8-¢2H^„„R•{ çž÷Þ%ÝišS„cFKhPd”ÿͶßÈ®x§-ígU%?â¢>ÿôàoînkoÞJ·OéS ±9FЉ* ó,òh†YÂ1;&{BsEǵþÔò¨N¥ÔÏ Ñ¾ø<Ãñ¸ÔÉ :Õ1XÝM9‡é)ÙïExU^Qæx„Ë©§+H޲©fG4š6^õ_IÇ ¶gú’õ±j= wÛ‚ºmyCØMÈÄ ‡öœäìö!0.¯Q ‹(!í2ôNÔ¹%êX¶eõÌÞj}{;_­ÎrÄÝ){âNuV¤~}2q“ ®„¦fMJ}eÑþç#'õSüS.€ü endstream endobj 2447 0 obj << /Length 3173 /Filter /FlateDecode >> stream xÚÍZY“ÛÆ~ׯ`å ›2ÇÌàr*J6Ž×;ÎîúIR©°ä„M4­¤üùô58¸XI.¿¤Tµœéé¹zº¿> ½ áŸ^¥Ñ*ÍŒÊLºÚœ^„Dmö+nÜþó…¾50®'œ»ñõ·q¼Ò¡ÊÃ\¯îwӥWÁߏsÍÕÚÄß\­­ƒ\w¨¯ÖQl[±Á®–½«\Steµç~UWë¾*aüÄ„¦¨¶õ‰g½»Š“ hÊ¢s°ŽÖI–:¯ÞÜÿâ÷ñã(V±5_xGÏýä¢)\Ô¨nê/%*Œ-_4V™ÒWë8‰‚ë+£ƒ—·7pÈ4þË?×e»i\ç¸÷²ïê\sÃÝ[÷‹Ûte]q÷¦ÂÞá×´H†¤³©¤ÃÕ: •M2Þÿö*nüó[_6Ò‰‚í72wöJqªX€&Þ¯7uµ)®¢ v„'q,çŸ~øö+nð©²`ë¤_œÏMìïK¸‚ã§(W,rM[­u¦2ó†wçá¨ôçóG¼sݺ?“òØñ8 &|$Ü]é 8 6¢b»¢í¾ð<,¹²*»Ï¤íÏgÚ½n:·ý]ëï?Jµ¡ŸÏnõê»ë"OÞ°È_}÷¯ëÐÊÕî@UÌŠþƒ/{ìÚ7¸äjm#•ÄG¸Æç"´‘ÊÃà¡háDBÍÃßfTDä(«Q-H¿Â#DÁã4F0B-ù‚ ³àÕ¦n~m¹Kæ€ ¸ÉÞä©Ê!ÚñQ³è`!OM†l­µJ5.ÐÍÎø¢(¹À6N ´ô´M°*Ì"?-ÃgŽ'™1ì‚ÂQ”xD÷$Ƀ›ŽÅÐ8 ”œH‡õ¦°¢˜H—Æ¡,8²:m¼çx.ѦÀ8Ÿ›ÍKóÑ"àYf‚àÍëñ¨ø,Y8²?‰¯p´íOúèoºÒÉþ ì™.ÅirpÎé‚ùãµÅÕYƲsY·n0Ìð‰.+'Ÿ½7mbl4}µ$?«Uœf3ñ5T:X ¤Ká`ñöáÊÄñ$*.PäÌ8$1ùè€Æ (×\?Ö]¹¡¢G‰EFˆµPåôSÙaÿXþÊþŒƒ•0Sü,xõY¹Gº¨˜ ~äîZ‰^GA|Òðµ‡#ð8‰™‡]f'„>ûÓ ƒ\lSnñdÓQs¶ŸD. °­NÀäA0ÒÐ(0©sx1lù[K~c¦@K¼Où:Ô–‚ =: ^à‚ß–8À17-&§±ôɄ¯ii‹¥â߆¤gÁQZªS²4¤ä˜x9Hd1‘f…ò×8ýUœ’7ÁÔxAß5Bhãeü}2Ù}X_)Èåü4´ª%l×Ê^­½9ì?¹¶U±Ìê+ñq¨bmæ:ÝŒù['N¢aÅ¥D6'Ö¦¼<ÅÖî¸!â`¥ÄúbÇV ÓôŽ=,› Ë{bGòº\D“ðàªÅp.œÇqßbèÖW“Òpƒ…DWmÜ(P­ò8ŽÆÙ&ŒxöÏ?þ|ûö§—·¾Â¢öDÀ•{” 0œIÖæàk£±tûÒU>Ã@Ù1Á¸[›%Êà•  £\ßÜÝûÃ\Âñ“³À{&Ó2Z¬—”amt®ÂDÏßýŸv¶nWôGy¸KȹüæP7jI¨h‡:ÍuMb#‘UÕ] õ‰Ÿ¼¸¸“Ä¿K¸(µ§%=pÐ é*2¡²:}RÒK‡Š„„©™Wôæ»E)B¥¡¥t&wû -µfáU!¨Êô`²‰.\.œ&;e{‘mIcÌ´pú QZ£ò/Qì""¾Ç»õ <^áêG_ÒFøË^þÐIžŽN²\š]}]€‚æögˆÈAó'‹°Ã¡jtѹ˜UP¤ä·[ÈdÇÕ@·éh ,ÜxZÔdÆûë[ñëâˆÀç Þˆz»XÛBÔ½¯8žä“”||êÉÇ5\ãIj¡õxìPE~I,„Y¹ WûZN/€„1òtà ¥Ÿ^χÂYf‚tÉL&;=”{f¥m°ðV÷û¡±Š+Ÿl7&±OóÎ)¼¡‚¢Jä¤ßR‚¶˜lª`™eEAb¿ßCdB†nG®‰G† %ÏÀª*±d‰©Jâ®Ì‡UY<†U™( M¦¨gAÇæIýÔßɳŠBð¦a\)úÈ¥irƒ'ÎY±YPñþ »‡‚?UN}p؈fb¾´¨5× ìòI°ªÅ5³0ÿ0Œ_$–@ib®Ó/ró Ï á„ DGp´<úC@ž»5paÑ®††Ø>´ØPDZŒ4m´ÂÆo‰O£h ,Æ·Üê‰)}ObÒéÜó·èQy~Ïíim~Bjv³[’ã%€?S¹5cXLg±VBŸ ¸ÃUŸ…ä41Cð.˜³Éð2d6v¨Ók†Ý¤rlS)™àXËY¼£ƒ`¢´ÆÊöÌ œƒØi‰ —> stream xÚÍXAOd7 ¾Ï¯È±=l&Nl'‘ÐJl½´Ò ¨Ôq ìl…º©€•¶ÿ¾Ÿ3Ìv†7ô=ÞƒŠž`Çöç/ŽóbRrÁ‘vLöW]‰.&aG1APv±ÚŠªK5›§&ǹ É 98:£B.'rRÔåL¦Q]!²¸JbBt¤š”Qnk NaC8D'±1›ûŒ€¸ÄYLØœ$·µâ(‹ W3²x ö¨Éö-°¨ösC &)$¤Læ+R°] þKÜl¤ÂæÃ6e ¸`+f5 Á¥I0“ˆ­â‹¢¦\¡¬Á@0´”[PQSIÒ€jx¦ Œ’K¦‚•D-‹*¸IÕ¥D0â@.ql–bÇL H°P˜AByr€„D)ª`f@Ë"F>È@3ꄜ²YD4“PÈ`1ÐΡ‡*ç٠¤ÜÖ**Í/RaPg[èÙVXKŽ¥„³6ä‘$g2gikJ°j B\ åæ­”¶ b©VÉæ­*ªÁ&„`Y"#¡h a'Ñ(T$Ç,oIÔ$qÂѼFà+ÉbŠ0XG‡ˆ †Ä$Kž©1-7LiAnjk%·5ã!ÂÂx^³œ’Ó ‰X µ¾’Q j̶!QAA“Ö\ÙhÔœJi–Ù©ZꪵQ%X¼Ø\ óš†Z‘!¡œ9QE½rÌæGîçVpœOÜüç_~uFSfP„åçOŸ.foß>®HÁ#è~EðÓÇPwWË;wpàæÇÐ.kýcЭ"ŸûÈXèþÎc¾< ¸ùeü@ØüOíWÝüä›ÝÔšÁƦÀÍzgD3³º:]ܹs7tìæg‹/wîk gÿµÀ?._Ìæß!èÅòîÖÚSËq6?YÜ®>ß\-n×M­­ý¸øp}ùnõÅ, þ>¢| ­/õþ.o°‰u̵þ6tÊ;Ðe­°ÙñX=ԌˀRl£?òÑhfÚƒfŒfÃP ·¤-VîP€¸ZCÊñi Ì£š.—+lz¾¾R-¬v£Þ Méa<Íd6?ýüÛ]ûýÃõòÙüÝêæÃâfí6\XpWH ýØ3š:¯¸‹$Š\–蔾ÔާnþýêlåPoÎŽN¾5lFûD¸V<Ú3‘ø¯.—qG=.ûÏ’ÏÂø<<9Ýö¹¦ ¤§L§ç¿-ïyYb—%L'dÙð°Nå!&iÅŨ^pUbnð±´‰ÒsR¤§û,êí>!øh3Lb¯v‡ytÌ!dl/4Œô0cy›ôzqܽ ’ýŠÀ®â4õ*Æ<ó×$ÅcŒ{ê ´;l“yâd0þ”=@Ÿvj÷Ê*y`éÇé©‚ü¸8z%X°òŒŠ,äm4|¡Ùãyƺš»U­2ªªÛm­òÔn+Z‹´†¯v»Â½=zñšY»ïv–“Ë»ëÕ›ÕÇ7?-¯?®nþ¼íô™ªÃH4@oì´;¥ãÉbÍá~в·uÚTמ¶ôuj_ºÃýØÂs{ _&çZÿ'ävÁÚÂq<"ÜAÄ^í±ûiçêÙíM¡ PÄû5r¿^ÒàíKP¿b ¾ ØÐZS|rÛ)ïc/Ö—Üøº×=uÏÓë^Ö}œÌàÂ)yUíWŒ™ðn©/w_=~|ùX±3®/í9×4ý\ÓÀs=RO‰}ÉÔ¯Èo³šû1ŸøS¿bTöRäIij¾îQˆc÷…gLŸÂŽ]žÄao›!z}7çƒÏ0~\Lä(ÐÄcu\<®‘oÿ휶@^ {Ò+ÓÓ«Ù0N/)áŒЋìSzNEÌæ¾V©8a&|éñ íáyšÎó4ì[ؽWÕÒži*åép•×Ñ8uÓcšœÞ¦ SÒŸSÞ“ÓÓ¾0×nNÃÛ}zÿé?3j endstream endobj 2453 0 obj << /Length 1190 /Filter /FlateDecode >> stream xÚ½WÛnÛF}÷Wð¥Y”kî}÷ÑmìÔA£´²ü”#­$©òb§ßÙ %Ñ¡#.?x9ÎΜ9;g…£ þp$I$EŠÊhµ¿ÈœµÙF~1{ƒ_ Žé™ç¯‹‹ËÎ#œ!i-6ç¡ëècŒ¥HR¢©ñýìͯfIJ)ï[ÓØ‹ßçUBTÜçeòiñîâzqÜŽŽ8£/Ìmðþ:AaŒ4çdH”qæ,ª.±ßÆ}Õ7ËuÞËÖtËÕa“¯ºº±9]Þˆì¼F,Ìnì"üñÌ»q}îÆt‚?êûç˜4‘ B]FDi›òÇOY´†—ï¢ 1=:Ï}D‘6XÝ]üêíFAL£âþL¯æ?‡*F@PŒÖC~‡¼É÷¦3M;UŠ H 6øþâ[¸®ûÏ¥™ Ílh5¸¯Ëç±ä1¥Î Äaÿ«RªÒ’G)¦sì½ï ´Žf:áSгx“àxX€z2®Û$Åqö®¨+ÿ¦Þø/»ñ‹ÒlB°¼Z{Ÿ¦Øî,3ƒ}UWm×ô«,6¼ŠëÂñ·³¨`7¦= $eTÆ‹™“2´öÏ×¼`Œ!¡¶\ª^à Æ’x بßó¼c¤RY[´¾Ò¾5”®¶_AC4Cèã2t3^&ã¼Ü×­CNÄõ¡+öp¼Ý‹§0Ê'0¶þ›ë!¼ ’ñ.ïübÓC++À-žrÓß„8+„ÖH«×ÁŒ9’ЏP’¿fʇÜön¶¡¾ÏsÇR¸èЇę=ü#ÊØøÌÞÜ.n?̦6Ãp§ÖZ†(È-ޝ­<º¦…ÖùÍAkŠ• ‰8½&šÃ* hÃÃþt©²^»üàåßTÞ°îƒÂzˆÓ'´¤¨©ûjºnqkšº¤hС<<›Gïôp„êMëŸcÍÅ ´ùt^&› Ë ~”¦ ÛwV"]|ü“=^æR¬!¬Ö^íØwŠÝÍÕw×/;;¥þ“[t endstream endobj 2458 0 obj << /Length 2051 /Filter /FlateDecode >> stream xÚ•XYsÛ6~÷¯Ð#Õ©Pॾ¹uÓcÚ4åö!Íx –ØP¤J‚q?ß]ì‚"mf’ŽfDp±v¿=A¹ˆá'¹Z䅅λÓUì©íaAƒ×ß^Iæ[ãjÄùÕæê‹iº±XÇk¹Ø<Œ·Úìo¢¯æìl»\i­£ôËå*IÒè'ëŽÍr¥òhßáL=4Ìr°µm+ë½×M½êëæODhM½oN´êý2Í"Ó–ÆYØGʬÈ"™çË·›®¾Ù b§*i¢?QÇÀýLÑÕ"Mƒ¢*qš¢©(„Z®ÒLE7K-£kü»9ó4ú—¿Çi|Sv»Ö: cIÔëª4Ýê®­éõDØÀâ=êøc|ãÅJÅ"SšN}½LedñïϾlùEEû/yíÄ6i.2ØÀ/<·ÍÖl˪tKUD¶ï—`»sÁ(ð«_½¨3¢¬ü~+¹R´ëíyÇÿ}\Ž[ëVýÙûEuUƒ<^N¯ÊÚ–æ±tG²»[Êèhƒ€ü^æUeëƒ;¢¸ŸÓŠ[s:Ãv;bmYÙÓ¹OT‹P.ëÒ}TŸ®?ŸÁ³‹¨iÝÿ¯ý,°ÞùÇGzóÛRJp4“çoI¥7ßýx'¬í-€"´PoqŸÅ*Q"KùkÚá¹Æ?tT@À0–´€Zg0Ú—kËmïʦ“¦Ý–®5Vx.ü˳ôöÜßÔØv]X38œghˆN–ES&b$ðÔB¦¤ÖË9ä !!p:&ZGt"˜êд Ñ ê;"–üÜš,é‡MÍüüß‚|Õ„§K^㥬,ޝÅ|ìoË`«Þ‘;†yIk1’-ïhèá̶bQ|vå?–,Kš’ôC Ú!Σj‰Á¸’øû‡B9ÉDž è|~¸õ÷þˆ,ª­õ‰HMm‰6äi ÖVîÖ‡õ.¯6­«þ&ïG»æt†äÞ!è8A5&¬ÙáVGzãŠa÷“s=2i" Ptͨf ” ¥uÖõgÎ0% vBÔxn(P;×ö»K‰r!y+uDç™ÁYAüêXF;½%2 ½N.{•T–‹<…ê$3!5ÇñW]qLýÓWŽÈ$`®f‚0×£ ¤wt{d.ë½ýË£ ÄΙ–5†)g6‘7…Êe8žÍ_"WùÈ‹°\~× ^ ª@-ãŽ$ €nj"±ûÐË™bpDfÖpb¢¦†wÁÌãlF”f‹’D DØE1œÑUjl†TÜ×}{ï÷Åÿ]{®tnhH¢§(È´#µ3UÌ›¢ÈŸ˜×;h’C~)0¿ ÁT]C#_Ó¾ëøõhkÕžaÁ%FæÏQ=œ›ß}þö{ÓãÕO/hPòÖ‡’–Ô`¾6ž52:”Ák5ÉÑl³ß—hÐ%@Æã!šÜoO%uãhÚ MU¦=p/…“ ¹Ÿ:¡,}çèmpdT 9¯z\‡à ƒ\E3¸Çû§‘2ð.,]ç3…ó”xªö3O9™wöþü~ÖM)âbHºC Ú[gʪCµ­›¶¦«°p¥´XóÁ`&è)©ÉÜ,× Bˆã»ÎÎŽrC³¡¹½ýºµky€`0&*£°I1lP}GD/% 1ï¹á%â4öpÞBÙµ¼$„Ò!‚(áŒöÂü…™mâÃ0=ñaŽ,SQx=±%~ðÔ3%¼e˜zÇTN:ä‘yÄÔ®*G<Ïù‚…QC«“öзQ*.éùƒ:/B&.¨zû‘oqÆS}¶áª¯}<—CÍ{*ºõX;N*ž=$Gås6ã¢P”âTOs™é}ëÛúÁx`çü*Ôz=n ’DRS ¸Ž@wöè5]W’6@ÂF–‹ŒôNàÓHv6ô…Ô&Œ9°Ô5¾@,Õ!ÑÀ•-NŸ$~ð¸NÓ±Mgë:XÛ>lþ¬d™(.=“G­õw„9¨€9Ói`öúã]Öó—¦"oÀ")îjBÈ*Ô|È+­ER$“QÞ×;Ö b½ÅK:êE#)Ö) ÆWK-2©hõÝË»×÷¯®_¶Ä+ñÅ-jûH«³xš¬´H/*bVäCÖ“NS¨dp5ßKñfQTÕuØËKróýí&È21Øœ,iì3×E–Ù .ÙJäÅôòð­u!Ë>p ¥Ÿ8ä¸ì$æ ÅÊ'±œ+%¤äO"eíž@:iOÊ ‘%ò‹¨…/!Ÿ7°ÁPJ/4ôÆT߮޼{˜„ "’|ñè9O ¸:æ¸Yµ¸½ú…?õLNS… H:—cô^áÕ}fƨZŠB3BtF“ “ äëü¾é1…ÌlàÖÅP(?ˆ£†Š–÷ èd%øß$ÜzÇH㻺‹!¥÷o’ឆ´ÖVÆqŸAõÀÄ—YO ; _4`ü¼Kâ¥Äaš]kJ³0ÁWV~ómri” ·’Ž<úÊ49[Ä~Ê»¶]g s´Ç‚ï²ýÓ7>£jÈ×vàÆO+a—ðA¯áU®<…MéSÐøÎK/†&OM Ø¿¸>×ÝO û뚘)}ãŽ+ÄÐÀùKX?:Vƒ²:#Å% å”Lúl 7ғžôr*´éÜ!Ý\òÅèú7©É‡Áýä‡.HÅä·ñûuЋ endstream endobj 2463 0 obj << /Length 2755 /Filter /FlateDecode >> stream xÚ½YëÛÆÿî¿B@¿PF´æ>H.ƒ¢@jŸSŽQØw@€48ð¤=‰Dª$å³Ó¾óØåCGùŒ­ gß³óøÍÌJ.bø/™ZdV «³Åúð,¦Þf»`âýϤŸ·‚‰«ÑÌ¿^?{ñ:I2yœËÅõýx«ëÍâ×Hfv¹R¹¶itóîF¼ÿáÝr¥µŽnZ× e¢Ÿ‹j©lt*öËß®zvuÝ—¨D$F%oaö#3`P‹8 ªTĉaa…^®’TE¯®~Y®dt |e&ú7~’è¡)ŽG UD CÏ}í‰We»n\ç¸uõËõ270«‚›PÏÖU®)ººiñf );–T¼X©XdiÊ|¼_&2røç_§²ñ m¾÷k'RN2‘´°©O]Y9+óRm‹Ãq_.eTm¹c30 óš¢ÚÔ¦?.“$*š²èÜ,£+:m%sadÂg~8öÜÒŸ§¹Ü8"¨ÙU›–­+þºO]°ÙËì+9a±•UÙ=ÉB{:2uÓ¹ Î^¬ŒiÂ[&IÎó~vÝ®¦‰à)±hhI•-÷üñ¶×j¸‡åÄèV°nëаª%Š ˆ¶‹é¢‘Ž uªJPMêUÓÏèšò4^W­³•6zÓñ]¤¹1ðÕB&’ïRì÷5z×CËâívÞNm±õd}ÏccEÌ[±íÎåÕùPv»Ò«ÔŸb¦.ß÷°$ü.X[SßD—0Bæ;þV/µŒؙȹj¦<æ” Ë%è[{ϾF.”ÉA¾A %zvµ;ã*‰á^~ZãÐóÀ2¨ÕÕü=µ~¸­ž…­Ábi;”È EMj8¦{iSciã©êþ'1Ÿ9Vˆ¶õ]Ä8ÑŠ=¬ä‹Däà +™ £<¾H°–4nÇC‘%›G²i¡y8vØý™»Çw‚Ñú2ú§[wÜqjY’¸ƒ×D:Ö„Šs¡a½çªSs»±ÝVpåÍe ¶X†ék°ZàÖ¨Üëi¶§ƒ£HÑùòñ¹ÚôŽÝd¬ÈóÊ6€©œj!È•®Xm˜X“à€É¨Œ¤i2òkrð#ûb$ÛSaÞç9aÉh˜ywóöíËJ!f¡xd‚»’¹ô·ùŽKuTvÌ"~ÇÆ ½÷üýLöwâÆîUxSû@‹¶ š-˜¿™Ì ÖÚÜËÌ‹ MUÅ€ðÖ„‡cs¢žYŸ­AѰžPRɈ¿±‡M š"kE&‰íåΞ-ÆÐ}¹)Fº¶kçœîØP|,7Ä-8—×'-ìÀÂß=©e/SVózå½ìeã)Aóh*øÅ U#F oÞÐ ÁÁ—=Ñ–y÷¨Ï{k/«ŽùCÈxŽÇ `~ûãÕ;ÆŽç H™3/i¬0¶·/2täå¸?m=û]¸YHíyÝ9–†Ö™ÈÀŒ'âiÎ PqÄP"¥3æœCk¡Òì1’´®»Å«Î^&΄sœâIfLô®îʵ 'ÝùÙùù6Æ$ƒ˜çOSRh•=JÇpãe¶­Ð:Í…MÌÄY ÜŸšjîæpñØôEšüpóòåÕ‡³ªD<ÜøaçÐÀbÉZ‹U´+Zî¸c³ ãWŸn­Oì¥0ОÖk×¶÷§ýþ3÷ MÌc*ì€_ÄèëÞ¼½yõ4£5ˆ¾y([ç}JCîžggI̼ƒ”œ}Iù,®mË»½ã!2GÚ:?—¡Ì\þ 4æNò4)½™Ãº~ºßÛ9¥u8 ëë³™EÓF[Ž’æ‡~¿N o\³‡ ?£íÏ`Ð9>fì7‰÷ ŒÝùXƒ4!ú¸Öcƺ+?ú hÿí¼ê$B} ¤x[t›vÖÇ%L–cî)¤™É¼¶3¸™œ8žýÄÑқ؎BaùÔßñÂ#Ùí+5$HFH [x2= $œZ!±®Gö laR¶›Á ­r¸Žz /0r‹ä )‡@åœ]hgåÞ%ï„Ê´³œ S"W°±·K6hr±Š«›Ó°Æoö°+×h½;n’kábŠ~1Ë}qöìí ¦^ê Ë¯Rµt}YÍi<ÎxÄi/?0 ¼7I(/®æ”c Ð—öI,…Òv¶´.} …!ÂA_²2ˆÀ Vå Amôeäy·RdFNy×gIƒÁL“?\ÆSŒÄ$®-Ð@`Áï“Ù‚´VÄz>Y ýÝ‘.¤€Ch$ 3œ. …‡¾}º@Ìé‚:?óü!Í;Oô,è/$ ÊŽMfš,ðUg/#­VÎX$õâ‘¥U%à TÆ&¶}•lâ Ê{ð§˜Æ‰¾0àr¿åù ,@LMì >†ô…û)«ÓÉýøZ·Dlçî–§"¶æ,JS½ª=×uÇgR¡‹„/ ¯(h«ÎŠ"*¦ÑØs€ŽC_ñ8"}•²\˜B10g´‚Ïi`LDwòM~ ¤¼énxYÉ'%)67P̬;HM¬Æ½¹ç-ú¢çQmÔ58L©BÎ…ýLôío¿R¹¸¾ª¸”tÏg¯iZ1-aÞC(¶s|`€pE솇¨ºÊ½àqœ¢ö ÐèS‘ûbí'ÒÓ€ó“‘8{8͵HšVrz5  %ÇB*z>öŒßQiñj´zæ•wr‰íå®8rºî™2€ü:å^ççoK_ðÞ™~ûŽ{Žý˕̳󫃆©^ßþò›q˜ýÄuÏ7 ï32d­§¸Í'èéB[5 Ⱦ|…îq@¶Ê'8a]“L0ç,ʪåáIZ m.~mÈ+¡gT3[5qšÅ»+ÿj„Çp•¼š-ƒ}€a¯ OT$ÌDÖAe¾!²ú‡,3›}Œß\~cç³Ø/ä¯A_C)lñ‡„KùÅlî—‹,陸k JŽuòåãÞ§€Bá­¯¾Û—[T§<Î%4”§¹¼¶£ZÉúÍà{^+A XçEµ ý;ÖHΤÑB“ã•Üïƒ[rHHÒD¤IæŸvÃ;¹ã¬ž_ûð¼àf»«›ŽI÷‰M’ `âÆê ôB¿ýø1?©8Bæ¹Q<óÏS4£ôsþ—’Œ~)ÉÒQ€ƒEåçñÊÑcÑD«!û«a»ªºôØZü/;Z. ½KSCB¥õYø¥ñÅó%þ­¾åoñüEб0©œðºÜ»ï™ôR%¼À¹R1”¢gËÿ‡ìiåJMxS­÷§ãfô˜H ½sÅ#4Ò÷p0niQ-ÏÁøfoü§r¼×ŸÑïŠJìþ29^þŸïwMæ7’>7ÀÖ|?PL`=ÆChÄÖÈÝI ËOð‡šÇ™²0²UlN‘ {Öáä;Ïäx¦ÂïdãÇjŠ/«#Ï?Ñhà{˜^4XìÕqBoj€üÜUèž=‚ßI¿ l"\05+ûMí|7UH@}ƒµÍÙ=Ûµ>iéÛßi[) endstream endobj 2466 0 obj << /Length 1160 /Filter /FlateDecode >> stream xÚÍX[oÛ6~ϯð£L²¨‹m-ØC›xY[´b#ѶY4(*iZô¿WÝL©ŠM$‘Ô9ß¹}çÈ`ä²0šy£ÙÜwæþl.\±Jv#ysw{Ô9›´'ß®.&¿‡á¸NäF`´Ú6E­’ѽu½‡GŠÈØö}ß ÛAZÝã±íͬ¤à;µÅêÈåˆ@šæ;ùœãÜ.ó”íäy‚ò­§q8µ I!ELÓùÔ³hü°z±XU°C/tÂÀ?ÓF}úÄPŒæN4ÜNàºÎœY;uÜ0¦N.Çüe«ÀYISœ;ܹX—ŽˆI·=æ(´Û?ò'EÔ X$‚iGÁ»<¥)ÌÒ/£’k3ˆ9âÝ`Æ$ŒÕ'„¯únèD³€íŠU¥ÐÖË'zAÈ„þ’êžÕµHÇìEA@0‘wt¯¶ÀéÂñ¶³¿C˜m“4n×îŽú$-ØÙDz¶š¥ŽÂA±†–Ru­Î¨+!P!ÉÙÂWÔ½é`’Êô™½œÃL›#rÞp¤¨{ùêŸÊ51.IÑq2[Ë” ÖL‹¶™¤²ˆrkä…rAqžy•[áN»1ÍQŒŠ"¥/ݘֈ†Ò“?=(=æ:JsÚÉŽ )×þqCwýi}·¹]|RµÂ¼ÎVÉ¢¯b1r˜Ké)¹GÌÔê<¥¸?=NÓ¶“—Á¬×Á .3åÆK!\ þM^ʼ$›„åÔf‡èFˆ•§¸ÕÊÌ«!êYõžMÄmJ e9Ê)y©[ uäóf³Œ9gçØtlY#¡ß»mÈ^Oõ©ýߨê:½:¦UµÜSŠ,ãµ›™¥ö=V(~Ñü÷á-_“²¸»ZQjºJj`i»iÐ=‹Ï(.)Ò4WƼø¶eÆIW1½É2‚hITí‰rY®¯¯Ë¥Ôe*âÛŠÿ½¥-M¤Å›™?5²è÷²kœS˜æÝˆq‚:‰uÙwê£éB› †F¯â³×ÒYÃì” <žÇM¯¬·7åûÙ¡*†AB[6\51<ê©£"_]#zž½ª<¡¼ºýWRÒ+å] <ÃøØð¾H 0zÓ§’ô¡+é9ÍSìqÖ¢LI @ØMõpƒâ Ö=±º!ºks.y£˜?þ‹bZða4½ \°ÏÍ»åêNù]ää•ê›Zñéì-¥í(ý×›;=gr}Ör»_Jh×”¯ÙR e%ÙÚhþCBM‰»ÖÃ÷‘ mYJΘùd¼éÞh˜÷dàí£ -'EО¾Ê‹ë¨ºüf¦ZŽÈ@Ù|yS¡ç%Ãu¨ù|w¤¬ràßøÊ7‹¿WUs6ÚÔß>rô,æ%Žë»Ú—ˆöTÔ_¦éç}#7ùïÿ|gê endstream endobj 2470 0 obj << /Length 2030 /Filter /FlateDecode >> stream xÚÝX[sÛÆ~ׯàx¦SÒר+§~p]Ù£ÄQ\]&™I2*D.%´À`µ“ÿÞsö€%vì§ÚZ»çús¾%DðŸNb6‰NOÅQdÞÖ·»8ÿpDݾ9lœ÷vþõòèÕ{)'4"i”ÒÉåª/êr9ùiJ“h6g)OÔôê슜¿=›Í9çÓ«F׸Óï²rÆ’é6[Ï~¹üæèä2¨“L)ø¶ùÝ ät’T)öQ°•Qv*IaÜ–Ûúz©o¯Ý^çeÞþÉh“ÕÇ3;½ÕU¡Û:_øoôk´ôÎAœPtLL“›µÞ'(|íD1ˆ"s¢^½´ÞÕ:kµ]·wÚK)uµUm«›êEKfsª’(š¾|5fœ±»ßØ?ÆÖž§ÏZrÚÚ¿yãþ›ªn³Ò½n+ûwq§ÿr;V;v/Й¼r†T«ýnQË=Žx{¬×v}Ÿ9£šíb¡›fµ]ûâ{^ßçSñÐñç¡AýÙÕÇvµ©ò²ExRˆÍ3fdåÒÙPm×n¹È¶^aæìÒ·….Ûž÷«l»n‡q‚CNÀʧ֠$/oÉ“¶x˜Ê.Ïo:·0¹öé?æ<„26²ÚÔàõ e4íRײ/NÎÏ¿?í=+˪íeó)DþL¹(_<®«Oÿž·Ù'?ž^^¿{úñêü¤;13ôJÙÓ(ÝTM“߬õ¤µ é_æ æÍ¶Ð¼ÓcÝF…Ø{ºbÉ.{ÕÖYât…H—ÚÇ,+좨j}|P½ø£Í]Ôï»ß«¯Å;»ªµÛPhPô€(¤r/ mûÃ0^ãIL«yzÜZv’vVÝï„pjâæ÷¨º½ ¶ÍzwªâÌU ´·eV»¨|€ªnroX.NÙs8¹%¯qнM:Ô=Æ.}íR÷–_}µ[Ì)Tå|û¸ÕÛ@`zµëû*³k/þ´´E|üm¯(G>Y“?ÜùžtÄIô.üƒl¦žÍB€–½¯H"ã#Ç{Øö¨Þ]ßé‘¶vqõîÝÉÅÅNÅpÌþay+µ+~JYŽJ£.ûcAŸο¾‚Wïc xœDÀð@ÍYB’ÉœK""gûûY* B Û:yŒ v¥k].´• ð.’JÉPZ,ˆrÜ Xáùõ§·ç/{`5ªÔ÷ö´Šú“Š”$”sc┤ým‚06-ª²i°)à‹„G=SþvzqéÌ„1[dD=[¨³eÀ‰çœ¦$ B› Tº¨}Э¥ÂKíȲa bPD]7ö£i ¸Àp˜¡.ÈXpÍÈŒ¹ 1zsÏÒÝñs"¹<$ļ;Ïß ¤œIp˜Æ¨K§)ùO¿D“%|äOîÍÎb ‹QØzrqôww±hc2†Ø #JÂ'£õÓ,áSÄÎHn9œ$Þ¾^\G\AóTÈã±xnî%£bœÀŽÿ)@£6,RêwìKÜk€üõA¶OaBD"ŸÎˆÒ˜þ2"dJ¸J‡ùpröÒ69Îcx­† Gz:æb´ãÞxí%+Ðn¿ðE„Á˳uþoDZñ]]Aå–Ú–M($@¿®K¸mš§^5Í…6V6ùRÛo8ЬIß œ €Eå<>-63I§ö2ôzÌn@.ëÐr‰Ž'2˜7†G ªÇÀÊ…¾ð]˜;tÓ:ѺÝÖe×’å"~<)ˆ –°ûÞÌqßzz3ïѼ‹áCÈLv€Q!Ýmý`£Ž7ªÃã”ÈxتÝ}aå\…WþHܵBB òt˜ÇOÆø®û )ÀѬµ«¬Öv±¨ŠÍ¶E¶"¤énãhi‚þ|"1)¡ØuYi5Ý?I¦îm!·&gÆÍ[Zgèʃ}ÄÜØ#õv¨Ð. ^Aµ’aÝå‚™û %ý6“jšå™¹GáÛ'w:+»D®‚Ÿ»`¨á´T$Q±Ý,º…Ydús3JèDáØ"[ãå^Ä3÷3ÖÙÀDÁ˜íŒNK¸Ï®àíU¨A#^ÿ‡Dü¶¬_˜Tà"¤Ânkša2°Ë„Èð½a`‘­l< ÆŒ'b! „0O±c\²BÜi”ß(%É—  Zw <SŸÅTJâÈŠb)ûÿàɈD’íôƽ‰Ñª@Ç”@<“›ˆB$Á <þ¼äDÈ.˜EíQ?lǼ’Èdr ÐØÝi[øŸËl-Ú> å0ø"Ã^ÙU÷U3Þ`¾§Ãà.è0¶o{wÌÑ&€5ð„¿tp‰× Îû¼-sp¸°5 Õª°ßKìšØ \`/‹1BtZÃ;üM*RŽ£ÀÁiu•+ó“=ˆ¶‘r’xÈÈlã¥çÌP 6DjG~éF‘yí¦|€{šÑ µ±oÚ;—?X®Fæ›=熳ÙRën>ãŽvïè|ž> stream xÚ­WKsÜ6 ¾ûWèÈÍD Ÿ"•[ÛI2ÉL=ÓtsJ3튶•êáJڴίHP»«µ\;cK‚ |>Èæ&ä`©$…ׇJÕŽKض€ËsI2Ï.“g3úã)à2˜ÿð“1 ²g×<üùá7Ò,|~ˆ<ÔäWžBDn±Ç¼àîXôR?üïaf·?;òÒXº¾¾ -ëõB«Í{ÛkÀ;K³Ú8Ï9-ÀÈg“1#_‘8ÙŽË<ß&P|Ù|6<‚ !™–˜Ð žZ8‹Th=úÿC$çÁÀ…°.„Ý-nt›H‡`%Ð!ü"cÁ ‚ éGtˆD:„ÍžÑߟ§Cß?j „ endstream endobj 2487 0 obj << /Length 3437 /Filter /FlateDecode >> stream xÚkoÜÆñ»Å}+¯ÐmÉ}ð4Ò8vT$ŽkÉA×0¨»•ŽÉ©<;nþöÎkù8QPR8îggggçM%«þ’U¦WYnTn²Õöø,&h{·âÁ›—ÏÁÛâf‚ù÷ëgyáÜ*‰UÉêúvJêz·z%¹^otaò4zûê­zóÕ«õƽí|‹#}_ÖkG§ò°~ýgß\Û9픳æwò°0˜ƒFÅÀa`P§*v–t*Wv½q©Žž¿¼–2ý‡ÿŠ]ü¼ê¶­ï=Œ†¾®|¿9ݱÞXk£îÐ ŸÆÝU "áù§ªß³Jôë$Ú{Dþ‰çÍÁ×w=Iî‚W\•Ç{ pGä ¶rØÛ²ëç±XÊU]õOž§;Ý߃BçQÓöp«„þ­ç ¬·ôxr«w_Ufö=ŸæÝ·ß=­ô 䡌J”~DV«UêÎ6em v(%ßáÄE·msdpÙÞT}[²¸ltsêyð¯8± ÿ‚Ù‰u 9Ê¢7e½ „Ùœø{C¢òm¶ôÌů}[Šm« ká gr ³3ÑÛ>(CE´åž»ª©ù=l %ãÆv‚¬¼º  œ*äñ©Å/ãiG/…&TòÊv8Y:x0¹¿tzI GÐ.\á—î¸P&5ã-ZA|‘ V+‘F¦•Ísá×0ž~_€?áý»cy€kí§’éý]`ïR.ÿ´Åû ȲçÑ Ü÷R¼à}Éà×þiédÚÄÊÃÉþº¨½*ÓYÀøòrâXæ¤ÀÁŃþö4%¸ÈG;£Œ6gž©÷`—¦°äV´ ¦UÇOÖ!lQYZð0§m1`à—a5 XC”êÀ¡Ôÿzò,WÁ´âÁE¢0o=:f°®O  - ×rŒ³oHÀÈÞD:³£ÛTÙd8û¶9Þ—mÕ5ujmã"ú´÷`FKŽÇ¸Bå±;âõã~K{éLnØ E¥!P“¨t&þÛ=Y”G‘mû²'‹C”æö uWD;ÄëQ¶¸@Fï ‹è2Ä@\"Ì¢ýf.ÚKP@ÛÓ¦7itê¼°Tò.w{igŽ»4løíϧ㽨ŸkæPËÄpƒÍqQ|6Vñ¨s—Z4o­´6À–6J¸%=l´ì"´âEÈ%õ2pHó$™ rð‹¡ËXå’³Ÿ–(²j…©™â´³ç4®gH_=^>øz¼|Êâ`„0`Í¢ÀÞ-;ZxºÆ» ¦ Žõ=?»fTb;0ÌÝi‹´q‚GǧFÒm¨–7ÈDµƪ…Ã}IäìˆÑ4Œª˨ìΈ=ˆš3ž£eöûÀo5¡§‹gf¼ó·åéÐs”€ˆ«£ëÜD”ÈÕCٲㇱÄ€MÑA:óN8Zô89‡Ecä5ò{sãîy蕲ݭøsÇ;O‚ Só( ¹ø„Û¦S®oØÑÆzà߯àQz†Í™Dï…îÛ£XpÜ Tǰ~[vD½"¬pÝz¸R%gÊÃ]ÓB‚z ˆS}fœ]Ã,u‹ç9!î,†8#‚íyÂ>ÑJÊšœÝqÝUœ‚1FçûÓ={RlD>Žùž_]ÛuÞŸW[Ö$Ê$ù Rq†ª-åà”Nð~Ë®9dZ…õ› …ñ|©¶[?¬ÈRæù0ýžs8ŠnDb÷åg‹Nrw~ ÒÊ 6ʜҮx¢zäÍ{ù3’ăØd¡ù‡š™a­ÑIÔÀ¨eÁŽòV‡{#Xuà-)/€‚CÒzÐP€VË™04æ ”h¼z4æ;(/‡¤ä‚É~ÂȽ_'ê[,ÇÈÄ éÕb€°ÊŽiâÎ×MO†*bá«, >gnn)\Ý!fƦ‰ŒE•-8TÎ*ÌñØ·a"¦ £„uHy F&»õg{' OÉèvá^µ‹¾l¤òÈ8=±.ކ½†ÂsÁwbmžÙ¹Ñ3“¥‚‰f¸‡àlàHOÕÝ>DUt¼QÍ/9Âñ¬ì$®z±z ž¸a(©a<ø28ž‹óèªa\NÁg'0¸¾…pÔ¢ÿ=z*Eb#™…FßÅ€pÒ‰'<.?ж‚)Þ_Ö²dßú¬8 nþ!nز…Ós…Y¸™Q}ðš3ÈTPë,„š\»¥z·þ70BaˆÀå2ßì)~i"„òx "Š`T§,&õ=âJŒ±œ!sƒ+ǸˆäÄ`KÔ\¶-[¿tLÙ³ï)FÚ<Ž®If6d08"5±’Áà Ü ¥L:Ȭõ¨ÂáhMs¶6XòH v.8ž^•]H–Œ'K¸f[ öT$•Ü)Š7”‰„Š~!·‰ÒÙ9ŸêSûaw×èÜ·%m¼èÝçÅPÁ¥„ª=Í n;«Ú¯©VCÁ»¢Z†tN2¶†×h•m%)tÇPr/„¿!ÐãPê](œöÕXf"( º&+Td ãEÙmUìÜ¢p>ý’`@ع*Šbv#(lY¹,úó²ùmŒ®q€]›ZĶ;#ïgŠH3N%k±¿GþÆœ=Á@Ü Œ:Ì’¦Š‹¢ÆQÛ …%£³eoÛ¦Â\Ђ½¬dkX0.±D£…/¥ä§(I£¿f˜¤ïŒxvÛ ÔŒÈDbô¤;†°¨Û7mϰ‡Cdù¤X©óY4û”åJÏB¶ç‘<y‘=Yëæ#‰ãXÚ.:\)ð §MÏN›D‰ä)ö”йH)gúTuž kè Nšw$ÖÌ@f+ Ë- DÀYhfzAN™™{˜“ÈyÒ¨wÛ—mÏ xUö‹m¬,7’„óÇOvfø¶ìßKBÁÛH‰Û³gzbÄ0á˜PÖwÌ%²,íŽv´úL5÷ÒÔÜãi¥!Ãæ9‰~) shî.z…ÄàÇ•tî.þn[òKæè×tùTR¯©³\å™™_/Å'늡†É±†±KÍ®áWì>Û_:™rA£ZðîQ+äú) ‰é7œ“ëÀ%?^ÿ‚_TBzˆVp}9èîp}Ù´]e‹˜‹¯GÚånWáÀá‘“ÑŽ&—ˆÖœ@ÿv A«ÅÄ‹°¸»…¡gä]$-L‘9½âÜ¡“ecª“;©“ÎnBz dºÓQÞŒ™Ë9F1è²^t…œ^¦ÀbÏŽÙaئž ¼PÛ8æ ux™ úŠ) 9;'¬ö´-¹g³I)ûÀ:‹B%Ö<ª±ÇòÿáþãcAÞ ¾14*С+››³¾L_V‡nèÞŸmÄÏyFY`ÐAw [ÃׯÇo;¿Ä Š8S©‘&÷×­§OºŸTósfË €AüØÉLú „‹íoéæÐW\§"zp8«f'8!÷À§"©O%¦æ,°êàèz¿F¥hi÷cYcQ£SÇ^ƒ.ã¤;„¢í!U Ü|Mý>^ ¼!þpˆTrT‚Rê«SieO_qì%ô˜a8ɲg1ØA/fâ¡yà^ŠãôÿJH ¤ÎNB æ—ý4'‰E¾ T»CºBÉâqe¤<=¬®žýSúÅ<¸Y•Cº„-â{j͵šЇL}"Ò…ƒ¤p5©›ôéJšzŽÒvFúq1‚ŸJ]þ´fäZ¥Å¼Ë{å)´%ÁiÈœvÁMR.pü5 çm zÙð3t'¦d^ÿHñ)޾“&S =%ÜÊ)'Ž«š—…Z”–±^Š…<È’¨ÑkòP³fEh82´d˜Ô±¾”qÓ_Š‚{XQÀ­_qч.Y‡. !ÞÊbJ.24òüNha QúåH}ÖþÁÜQœ(dÌü ˜€l˹¸Ü,Š/¸ˆð=„'ßCŒ|X2bÅíƒo¿#A)šŒ¤ˆ°œƒÉá.âÛúû>XæÿìõÍ endstream endobj 2492 0 obj << /Length 967 /Filter /FlateDecode >> stream xÚUÛnã6}÷WèQ*b–ñ¢Å¾t›¶@.ÒØ»/Ù `,Æ`K^QJºßáEZ)P.0 FÃáœ3‡C’`ø‘DÒD*†“Éî´ÂÞÛî“`\ÿµ"1n ëIä§íê×?9OF.H²}˜¦Ú–ÉMúûAŸ;ÓfkÆXÊ?dë<çé?¦;4ٚʴ´îKž>41dojÓꮪ÷á½nêu_Wðý­®ËæV=f\¤º­tg !B‰”(–Ýnÿ^ý±Ëæ”#ž³wb¢ßª"rR0Ïت†ºr™šÿvæÜUM­Á±ÓÖØ °9ImUïLpŸ"*-ƒã2#éfìo˜c $5Ï1Œ–|ÜÜB¾!\ÀƒPlî™BÖ¯'  >߯cܘCjäH!Ì›ËÍæö"Øg½‰âÏ‹ÏY 2/þån Ño”ú<©/$¡ŒÊ†ÿƒŽ†>žÛ»n\‰À gHæ pÂá$ä°¦ëÏAy ¼ ;Ÿ Ý!ƒÖõñíAÛ(ôÜ÷î¾ï¢bÍ÷¾j͸ȄÛGE7.Ë£{ Ëc K¯¾Æ­ã1©êóõ¬[ ú1­C‰< ¥ƒ*YJ¿4º?Æp¨B€61£­p&,ô H ™1Ë‘¤jˆ@?“TpN]ÄZHA«(E„Èá$À¾p’Ò¾îÛ»rßÝ‘wî¬ÂŸDàé6„CãÔ¸‘#0îUÌ FŽf úòùËõ ®ï£d¨àHÈDÈ)E^nnqRÂ7`å2yò§„!*]®c²YýE5ÛŒ0‰C*‘GdW™béo׿D3&"F c‡ìA‘ù{ºÔ×¶Úצ\JÎ^À¼BeÎPÁø„Éž® ¢ŒÍå¾1›GÜVîGkí„~JS²ñT8ˆþŒ`¬CÔU½±¶º?š1 ècïÄïÖéÖ,ɉÄOâëUHlA Y„ÐwhÙýÕõsté”Ä0}5ó´ºÊF¶â@pÀý0pÎSÓFn¬íÐð® ‡?¸»aÁð… -¶'dn›.¿o˜0ˆå æEÛ´6ØOSËOgìûªÌHß:ÚÂY¨þºÝÇQé§ÁWSýŒìËä0L(øìäJÎèܽ{+È {hÚ¸ó¹mî¡v}_«ÎéêG¤Òºc0Smào×y2†ù Q³Nèä8?>/áYVŒµ~|IEcÁÇ{fzE¼ƒ8%áÆzUòbb,¶¶¶O•5hyÿ‹WÇ endstream endobj 2497 0 obj << /Length 3169 /Filter /FlateDecode >> stream xÚÅZYsÜÆ~ׯؗTaSÚ1æNò ˜’E•M)<*²ŠîbwïÑrþ|º§gp$•XvŠU‹Á==}~= _„ðDZXÄF2#ãÅúø,´½ÕnAóïŸq7oWƒ™¿|öÍ+­£Fem²Ü®Zk“K€ÒyàV:Ókqë uXgÙÔód3™E$ñIžÇ4ŒÁÖÇ=C_ôëW3Ábº³—5ÁëSÔxîæíÃsœH4íNÎ5'"·éÎ:i%¦§ã\1É£E$Sð|<®øÙ«Áô™³L‰Z6@¼œØ¸ij´uV»V‘;'¬!öÙ®¼È>B Ì›ÜOBÚ8{ÝT-ȦØQOJT!¨™¨ÅDm°¯ÕvÙ›n]N‹Ý!c ZÃӦ³@{Ρï–Öo~®Ég‰0Þôp˜s¤H0£’.B͹KÌLØùË(„ a*ØäpÒ$fPÓ~wy³'j‘I] ¦!À?±cÂý +­BŠ¡øI¿Ì‘‰˜z@†£dMð7GMØ2,6¦Ÿ†s S¦£Èç¸ÒLAžr3fwÂ(]>»õÖþ±÷f2óEyGrëŒï?„‹ ¾ßU2ZÜÙ©Çî‡Åų™9êiq&"ýˆ¼;ÏñΜ¯F’Å úªf<6Ni»€¯.:ŒNØQe˜­+À[ãç¹×wïƺ_Òuã¦(Þ­S *8¹ÜNv™’^Ób3™@©eŸn«Éœó悎 á QjìMïN^Ï©0¦3c£Êþåã #òrD@˜z0èãDEëØxÀyb˜‰~“ "õ‘ ÏQ¤ƒ··øû~¦9?Ãw'¯ˆ×´éGHßaÄ"pÏ‘FÒæ ™‚7¶ÛõöÒ„W4%uç`1HôædÏÊïY…‰!-Ö®—ô,úiéaWVIލiµPL( ôa™éÃrPÛ£…îLt¤*Û´kÌÉ«,¯Æ#áñ',œ%&¡•¯K„œw„/— ¢3Û€<§»Ð"„È{;ùŽ '¾Qþyv‘Ûå‘9s76*þÍ…@'Pßôx™Æoè²ñÛ¶†Š…WðeF4º£³Acâl0ÇjF:㥵)Á¬UDé* k`ðN80¦(áäÇ%·’Cx¼uzÜçõ9m¥R7õwÿ\”Èé]A¡®s tN×CJ’Ñ À¾Ö°4ø ö[_ÁþnkìˆÇÐþðÙûʈä}_Áá¶F|@ÚF?Ö=¾m‹¶ºÞÔUÙ^“üe(pæê¬¹^o¶is,7³F«a^cT}½vøäpFy#HD&‘ê‰ 4Ë (›¹}U ù¯ËI½úb’=¬Ãê|KO0YNãÞ 1)žb'Y¤A†‡jꨲÛCºödopÑgj§…€#=²__®dSÝÍ>+¾Ì¹–O#¢rÕ†töK¶n¡âfTà#D{ ŒTwyÝ©Â9´'Ú¸­œ¨ ¯º(¼K«(ëÚÍ8B&+„%<‚ýÁô=qµv5rŠ-¯ bÀŽíS7æÄžÿr•ÕÔw·Ïw¢Fȇ[¸¶É]šÃBg–˜›1ª¸±#õìÕ€Hk»ÅæaÄhé ašmÜísth%ÀVèN°ÇtNÝ$›&°Ñ…8|©! “wbD‹:…ìv)éWR°"r‡ÃCÙðC˜Ì¤ÌŸ@†ÛÏs¶Ä¡H6qW aD˜‹Jj–LKûÁ&ëýîÑMB&ú\A¼‚rÂ…W€y¤iÈÇ@†F†ÁYÙ䘤¤½OIƦ$Â!*âÞV`ŠSÂŽÞ,X‡'ÚzJM(曃£w“»ÂÄ®< ¨WÎËÃt€¾û%Hò‚Ƕðà d…÷W¦øN¸0_kѯŽÜ⫳«óëw/Îÿ¼Ä{Ô¡Œ‹Ì]ÉEáH¸:bá°ÄõeµN¦eµô“,˜vÄF¼¥«„-/'§—ž›Q ™å%´ˆxX›Ï0¡™”ñHºßgÌm²mÚ\»µyÐå@ìî=º(ÅædŠ.Ìci/x±Ž¶;äEsO¨3ir$ÃOÔ—ˆW åv¿øµã8Zõ"R÷Šÿ¸«ý%˜ž×þãÝD^Ë…% g9ïÐwÐpfô*¡¸à „:s”H°8ÒgµJ)[Ä/3¤Õˆô«‡ä†yÚ2âˆA¤YÆZ†’‘+o¥+oeŸ;ð-†|ûO[Fâèõ9y7%èêà6Äéqcñ‰ 't3»ê”^m,Á§ƒñzí3´·éÚ&LlSµÙÕ¥¼+/»ƒ°n¬¥Æ¤VŒ@‘žX¾vÅÐ`BçŒpŠ4Ði“6(¿Xè1›.BÐ gò†òGk†•_;:Ÿ…@: -ÞÃg—ñð¥¥{òÁpKêØ¤›BE¶>-5ê E­&Jw‰€f¡î©åºÚÂ× ÈlÝ8R)=Å›í¸…pȶh^F ð~Z¡¢ Ýd(ã­ ‚c;mxfÝÕŒÇìØÈMkLÆãld€«j·ݯ೭3¿“_‚d©EèÉϙڱâeáÙ ˜jM—nžÁˆl±ï—ª—нîK姃7}A˜U‡Ù!>˜ÄX92Ò_#ÆÆÀDRŽ11¿)ƉÄH ±6’¿CŒU“›ÛϯóyYB¾ìæ?,I³H›™(;V›Ô ÓzâÁsz›âºß]o=¿†Þ€@q.^žÍë Èõòê+Ÿ™SÌR&þU6 º k¾1dºDkl+,6eÒKÛÏÖÍ… ©†¡AˆÄnWºàHšíüâ`¡È%•Ø2ñ7Va_e¹ÅÛ,û5è}t¥)5@d=ñ-GÆjÞ^‡“Œî¬ì¯³Ÿ~Y,LÿyÆr1îAÎfþ8ÆâÑw#,¦BØ^Oógó·"ü/9õ×ãöÎýS^ÒÆ^}A/ágè®Ëc6{SIòèŽ àØ®š{èF ˈðEVUE9{¨ú/%ĸýR΃Ì]ö7åÜàFåÊËóókðöëïÞžœ^ž¾=›/H!Fô‡t!fî=ýÝ*‡ô6©~ ‡Jè‚:m<:óWÕÇ|·§à`_÷©¿Ltwà›Öß½ø 2+WùcÈ«¬î}ïuuPvGXrÛ‚ËϼJV…f8ú:{\ÒÏÁSþ§þÖǦ.'÷r'}ù&ƒîºx¬¶›]Éð⇋—s A1:¸Gœ $Rnž 3¨ö÷®óŒè'¾F™gbf”ùº™Ìüß <Îô4ø}çoÁEBEžG±.ï”Â}yÂ÷Á]›³2nKúÿHxúÒZ÷ÿ0¸LÉàû¼øËTâ {ºá>¡âð¶*îûxžüOÇü¸ Ò”Ì[ÖÀÅL endstream endobj 2506 0 obj << /Length 1925 /Filter /FlateDecode >> stream xÚXëÜ4ÿÞ¿b?fÑÆÄNœGyH…£¥èén¯B*U•Ûøn»É’GAâogÆ3Î&ià*Tév2ÛóžŸ+Wü“«D­’4i˜¬vÇ'å6÷+"®^<‘,烠?’üjûäÓçZ¯d ² “«íÝø¨m±zã}½ÏOiÖ~†ž~ºö£H{?˜n_¯}•xE‹+‘wW³È½©L“weuOßU]ù}UÂú‘M^õ‘vý¾Ö±—7eÞ8GÊ8=™êõÛíwO¾Ùjk¥…ŽÂ´ÑI`h††"K¡*ŽÈP-R¯}+ïâúôK´÷ýüèà¢lwé Ð’¸×æ·ÞTëPz]™/ovÈÚÓ÷‘Œg§cg+_"V!©pµÖÒ3øç·¾løCyÅSÞ; ”ND ا¦¾ÍoËCÙ­U꽇Èd18h³¿zFyhÉåk²¿!D´ý‘ˆz Q¥­¼çòõg¼ÄŒ…Û--ßõÕ®+ëÊÞõÃs¼ls¾,A³!R“ò5ž2܈iqùšRÅj‡$L^VŸÑªË4÷»ƒSas€¬ûµ7¼©l»¦¼íQâ8Íè õûúÂê·ß:Ø—™*%M¯OC€ìŸÇsm:¿?ÙªÉÛnC6\çÇÓj„WØú÷¤–‚w°ny8« â\ô]VtŒùãd«Ð캜]þ¨-Ù8×ʪì5¢íOxM ïLñ‘¾¢óï ¥qµ³?^õæÛï/‚ˆ½r f È!9òÏ÷øýÖ&‘)ëÙ­T¹©öZt06ü¸klÃI±×Ü®¥WvMn œ¢†õ¸-oÚ0NV¬ý8¼+×·`½² gÓîÖzÆ4|UÞð÷Ϭ֘*@4@ä% ¸åâAºÛ²IF"‹".I6•Õ¨@ZNßȵìÁœT¥0bcÏÑ"ƒêòe,dÈñ–hFx/¨?sä´óÜ“Ã%Ûhᆃƒ'cÐTi¿¿—œ‰0Ä ær°‘˜ª‚N”ˆÒ”ôån¬XÝç¥ëí1?@D;¶ÕªÙ™{§ÝKâ·ýöÄìöyG–yð’›7È}AìKdÿ´d˜ ¡³Á°Ï3W$*q_¼Ußô¨@„Áà€/?‰ýÍîQ:!Œˆi+ê Ôd˜E¶7(6 >Ë–~1¥,±sé×ïhLeP°¬b殮Q\hèW–ÚÆ…ïÆàh‚ÂZè*KÔ­3ãjöu0ª7òÎÄô(‘lßÕÇ‚ê²: 2ïao³ØtB‰4ÐÓj9_¸t™ SwWÉØ…\êÚ)q뻉X4é[Uâm÷¶jZÚÑí¹©à‡«ÓÔ~ ×ÖÕá=—Ÿ³¦*LA{Àæj$Di`UŸØŠÕ«3ïÎ<1”1ÐSheÅ·F–qϳ¢Ï{£í…P£Ù kÔØðÊ€,×Jy¯à°æ¡l 6¡lÏo,9²œU8”¿Ú6¶€.^lA&6Ÿ[cæP* õ¸ÒRŠò! Ð°xþHe±à”3…¼Ýí_¿³Kx„;ÌÊ!HŒTÞÐøí†Ø§Û=R2UsÍ´ÈD'Õÿ½:éG4jUå.jXlJ^ »ŸáŸ›‘w1ÂzzŽPò{˜·?¢÷ì’e+çá³ösO+O&ÉÜ‚(‰D =ûã<í¤Ñx~èÌÓT Pî•PEŒkA i°ùFÚ†im›þ X€“Úš¨ÊØÆ€TÝÁí=#àŽÄ Fe…ѯyÕ=ìUöʦê©ï¬nPØñ†Sj¬ôIå²I{h;šY{F­ØTX—Ådê¹p+Ì(œ[HÄ<œý§„Ô\h,Hi„qýaê+<ðÃCÙíÇMX—¯7³6þÙКuÎXıSæÙÐ 0HGK}køú|×õ[ÞÏùÿ ø~dÔ´ \êÊ ˆ‡I$„nêÐÆGNå&•©›Â40àð9C"tp`lÅ@_Iu_‚¦çôÉŒÏÕPd¬æ·5>tè¡»]8¨‰¾iÍÒìŬ¨2ÂCg©8£d© üŠÈÄÅ ×rú)øíMËìxD4Ô6Yƒ Z{¿@+ácéXÚÕ„iàÙò±,s09z…lX‘g³‰3Çf‡½¤™-Avü{6ÚlHCš÷ðËo¨¶-iB«C¥ 0øÊèÞñ÷ÆíÁ“íáãW†â‡ñX^ÈDÛT/RSª[ó—qžlz›F (v1UûªoÞ5ö¹ò8†x;k-þ•ˆYþi&Ðjøß£á‰QmTÒç Æiù3ñüЇ|lð OPs6KŠLkuÎé†=O~¼¹zwùìê¬hMömû®ŒewÇÁ0D¡ÐáðJÀ:äK²É * Ï·jÙ[ñD@x:βš\¼¼Þ:]&Q[ÒE¶º‚шZˆ‰J%’tȆûMaîòþÀ-âdsóζ†f'áfð?&7* endstream endobj 2516 0 obj << /Length 2950 /Filter /FlateDecode >> stream xÚ­YßsÛ¸~Ï_¡¾QJAæ-ãœ;©ïê}I3Z¤,¶å#©¸iÿùîb¤à8îÜxÆ"A`±v¿ývÁ1üñ… I–I½XïßĦµ}XÐÃÕÇ7Üö[AÇ•×óÏ7oþt®Ô‚Ç,s¾¸Ùø¢nÊÅçˆgér%r™¥Ñíå-»zw¹\I)£Û®jñ)‰þZ4K‘EÇb·üró—7n†é”PL%òus½OÔ  d1hè)‹UB *–1½\©TDg×7g “VÑéç¬îÖmÕWôv}³ÌeT,yÔ”Ek{–u×·õý±¯M‡ € Éü ‰+oIJÓ]-*ü÷Û±n틈ʷvìd3•f)0»¾ÀiËå*‘ñdZláѦ=ìéÛ°ÏØ¼«ïÛ¢ýF_þ«¸«ªù>K3% +ÆãÌì3Sð 6 þqa6|Úâ_òLc>YÖûmñØ£) ²šÔü|í­•G%ì¸]î U‡ U NçÊ'Iæ¾üDæõX…0ˆJT´Hºo`\éh&°™c‹d¦*íñJXrÆsRÔ6„/3½dÔöÈeîmå¶¡h\X°Mš©EX‹¤“à©&â]Wßï*ï¦,n€G‘0¥,—øù°”†˜YK¢=Ù í2i]í}[œV:CkÆŸ8P£±æÔZ³røïáÓ“"Ž£ ²d|2&ƒ,£È–ñË3h LVÅš)-_ ´Èã½±aï:ÌàÌA㘠i63 £¹r0 ½C0šeL þ2¾£¶÷ šÏ…0j5:ØE¬íq£nŰ¿³*Ý&']ˆÛÀ—®²a[€ï%=ˆ4Gœ$i´96kËØñ 5Á‡áû &%‰&TN ,<×LèĹý±9¶wFù;³ ;Pî®n¾®ËMÈ ¸JÀ” ¸ º}9ÉíQ™S..GQ.;c-*ÀX‹ ÐF¨œp+øä#t@ÓÑE‡œ&™Sú+r¬¦ïBë“9bèiã)nvGSÌÀf•ÀÂïMH€nkRZG÷^ôB¡ç`‡Vv]÷{¾ÑsñÜIÅ’ONʱU´XO·±ìúÒœž]_hyy²| ëb·Ã5HïEžO‰Mhf’\Á°õ:Âl&KÒ p„¿>=´ãWž€Pz8›f ;¨›¦µx°ƒ­§°;ØÁÞØQB0ÅådAß«+PïÔŸ µÎD‡ ùªáÂφ˜_al´^?á0b·; U=6ðèÂfáíú°ß·æp°ùÖnÑoCæHµ «+ÄŸ«;`7?\Þ}8wûéæÙ´kêìNÙ²ÚÇ]? í,4³Ÿî©ÓùÏß]¿vrLV«ÎN^ŽbòUï còØÜ9‚nIˆ|…¦é©¦—ÿpu}ñËå+Õ ^?G©°ÞØ“¥‚À¸*3ö|¶{yèëµa¶zàÕÚ1`=€ ^î3ºüÈ劉Xº”¬ʳŠà =|xÝ×[RǼÞSw;غÂà)b*ð„A…B°À‚Å,uÞ̺ÉÎ)Ð:C(v‡¶î·ûîDÎß•eÞãèêÎOHÿ­ÉXÜ7j¨þ]“!J»~úX´pÇ]Ñœ“ÎpÈø=öíê.° ©°¬Q¤°Œ¨DµóaÆÆ± çi[¯qǶÔdB> »Š¢Ö0Ä­a÷v)棉sEó0è`6? Þn8¬ž/[ì‹ÚL¬Ì)àoA?S†…-ãÜ |¡ Å˜q!ëL¡=È{ʃ™=È{€Š!Y2‘¦:R5ºuAã·±º!rgÙBä‚åÜdñŸ¿Ä‹>BÂȽx2=÷ t ]`·¸~ó·`R}.”•ê|ŒöYf8êw™UeLW˜ÌJ'ü˜X+–ðôw™Xç,Q³‰G¶µmúø1ÙLg[lÓÃXÎÉ 6aÁÁ<´ÖÕ+Û“¼=žS nã“|o#€®<>‘“Ø ´<ñg˜e (ÜRׇ #®a,ð+ .¡Á…M;ÌFd§M†@BB~ŽëÚ·•`Õ{C:€Zu6jÊYGë9æÙ¬Öÿhù/1ß@®$G-fÏM0´†ÀÂxqkʾ!¯MSHV§uœ‡úCL©ÿSu”it·‰1… ì“ÂÂ9Ö†Ü + mµ©ÚªY{Å,ûƒýZZ•0¡r/jþúîêK¼£²0…̾©žhxO€)ÉY6Öz¼(Ÿ8ÉÈûÄ­°‰."ó+BF•³‹ë§ÌäÜBºsʼnŸ=N+¦,NùÄ{?BNl2‘!R$æf /qp7̃ÇÇV¢ð…9ºvbÈÉž]„Éi’>™aBY~À/ýš}ãxˆÌN®5´«EJG¨dæ_pzüBìcRþ—ú´†¦¿WXÇÓO9“Bü_uu•SýÖŽ¦¬îM2+û€r¶ª.sA?_U—¡ZЋ—r äMF¸ù}))s½W^÷P-h&t0â¡ -¦{ÛÑQ†±âOOøµ6µ"¼Œ„ÖtÎ\](™a&as™]ItqcºmHÑ(l8­có$˜È?MmLscûuÕ®Z»¨zu,I³g Í@øõŒRý@‚çN…öË4M½ßW%Þ™›«Ý=Á7S3ûl$ÍF„ WïòÀÄèÔ”sͧ"U€ØÅ±š`Ñ«¹aœ†Ï–#mx5Ùmïr2jù¸½åõk¾,%V\ –˜¶²W7ýX1Äc½È°¢§^Iø&“ àŽy&QRêÜîW¼HÀ(ˆR’CĬΠ…Àru:D$ -Ǧ«²ú¹p%ÏĬTÚÉD²\ª—c]†P;«x^ƒPb’#êÈ6XŸÞ~@ëè,Å…&Êá¡?ÓLÁFQ¥‡ÖT:h赬ÁÔÌKW:˜ðF9æc!{Î)#i<-#“xŒ·E ¥ÀúòW‡$;z5À÷tŠy@¢{ð6ˆ=Hj‡ð“„/uMþ`ia I®™¼=€\çï/`&r¬ â¼ÿË—v¨ endstream endobj 2523 0 obj << /Length 1535 /Filter /FlateDecode >> stream xÚ•WÛnÜ6}÷WèQ[D¬(Šºä-MìÀEë ñ¦/i`È+î®]‰ª‘¿Ï ‡âJ.ƒ¶SÃáp.ggyÃ?äI‚"ÝUl¤ã) ÅÇ÷WÜêE ­4Ù_ý|#eÀcVÆ%öǵ©}|ßž«'­Æ]$„åë]”¦2ü]éó°‹’<¬'ÜIÃã`UNªWc¥›þDßýÐGsßÀ~G‚±êë¡£SïdVcSiv8ÏŠ,äE¾û²ÿõêzïÜ–‰d2ÿ1ÆEû_-2Æs°™d,–© v躡ßJ¾IðmÇæêwªžh£:ö²µ=Œ‹ |0¦>Ý}úøp¿÷þúîáÝõÍ›O¿íí©œ Æãt9Ei„KôYÑ¢VÇjn5}Øäã+¯JZJŸ7oî½×G"ÍY.d¡’¯¼HÊ<ü+–ñÐ+úŽôWŸ!' ã¸ÍQ–…Çj‚jRhº§VuŠ’¦jÒ˜žàoªCSµ¤æ‚™^Atq0|a%EÊÒ¸ô…u{÷çõÇûÛwÞÔ&‚I¾É,¹oÊDiœ³’—6tÒjÀéJžŽSc°‰°³x/‰ILs¤ÍŠŽ ’›¶zl¦…í")’ðÖêP9áà¤Zu0IA±Ã¿¹V“Ьçÿ¤œt¶™¬Â ­À$+¡È€ª1•y ¦xxVÖ{°ŽÇÛ"«q\zö`cSôÙØž•žÇÞø*„©ŽYP,ëîuÞ¯““h7ÏUR5»”—³RÊÄ@§¦£$aœçKà44r8÷óøPOº~8œOzœûC…é3†²xSï<…zæKÁ±Dö¾r­–²Èa¦…m¾: 1ˆ+Ë ËR|üñùKÔ°Ydi<Å.,ÉÑVÜ_ýaI¦Üb·`H-¥… ÷'À&ÌÉbq͵‡/ ^¸P_ÙÔÛ:xLC+@QýVµÏ*'åÿ´êr96§³öFp&ŠdUî§¢R²$K¶(}kƒ¯NBnÃÊbEx§ÊÍ›4Œ5¶ ³PÏ`ðôT‘!ã Fä†zu3é±yœ5ò¡µó< ÷g„:£¿`¯o¿m:B ⦩n€œ¦Eh¨#-m+¡`áüÂ; ÞòêMtpž°›¢´ŒÃ`d|n&kIŸCÕ¶$;WVÔ$Šâxˆ¤ÔÙ ®z,Ô¢ 5x(„z]8¢`N ÞVQ’ÒÝ ›:'98Wá2¶‘ƒèÔÛöVî:Üì.å­³3OÖ€¥Fú¨H{š'¥iÅÝ\´6E›|ÙŒ·^p[ñÈ3Ás/ Àžç«‡?á%kŸÑœy¾M$ƒ’Ù•^NÙÖ‚ŠC-¨è°mœã Ï‚ÀyîÝtàh.&¨¢æ*óV{âX'Jèîê>¡)ÂbO»&Ú5&–GŒy«~û£ç`T_çf\®Õƒ}jf0Ú{‡^¬©Ë¼£júFûH$ËX&ƒUG7¹Ú¶°.“ŒÚBˆKK´Ô\d½ØP‡‡¡ÌJ ÕÎŒ·ÝÓñ6êª×¯}N!YgŽ×o·ÀŒÃ·ïn¨íŒ‡ @ªÚn˜4qÐF{ª:»:úŸžÃø[ ×o§£’ÉËPu½¶0w™¬ ~õlíÁìYðdmªÖàà¥a(½Œn±ï>p?u¨p™Øškï£#á}_=£4ŠŒàÖ®Ï 6Üðƒý˜=àôåk#áØÑB?u“ÐáÅHµ0KœÄ©Ó¢Hz¾™Í‹ÔxQCÁRåŧ(àEç|Š…a†}ªFÀ²m /jKÜŒî¥4{¶Çø¶Çøz*$Eäm—öȨð{Lõõ¢Cl> stream xÚ­“MoÚ@†ïüŠ=®žîì÷æÖo)‰JÌ)"LC¸5úó;Þ5`HUUåƒÇöÌûÌμF&èBæ$s^WŽM–ß6ßX FŸØå唘÷2߃7ŸŒa( ˆ€¬˜õ¥Š)»åè}–Ë ¼åã«1ŒÞ^e¹RŠ×UÓFšËU&=ß–‹ì®¸|,8# ­þ²·}ö³5¨Ai+÷ J ÂèÔ åÆJ>ÌräÕæ±¦¶O×ts†Ïê&M¹šÖË/ËM3ŸTë¶á¤¯@ÐZ}Ár’÷!$ù만Ԫæi^íRq=ëDú¬(„(Y€`¥í„<8ÛÍñ«@µŸÏÏáƒà<³A€ññÄ·w‚MéÛ% ‚g»˜¹dZSªÕ/ØÍàKšÌ)Ð(„€!ª)ï\ñ®¤ZÀjóW™¦=sŒ!šcÖi¤©Ã4²EÜù¥ÝC’qýb‹`…%J,‹{ù• ¦ó5=•Ý·ü—PmIŽPuξ¿.êC¯Ùô¦~h]É¿W“Íqñi˜!^¤ÇIÝ4Õ¢> stream xÚ­YYsܸ~÷¯˜·p6„ ›ÊÃFÎî*­I®ò¬‡µ‰ƒ¼)ó®€u¤ŒÓ8i¶~û÷»Ø6‘F«¯<££~rЪD'ubÍ5"r½1q\/ÁÅëëkà21ÁñGר›¯e`ù‡¤)pÚºâŽcÞ5åïÈ?È5õå®6Q(tœòn×k#ƒÿýÖ—ýˆ‚Ý÷vîäNL"bX€&¾*[Øâco÷Ö‘ëàßŶãŽá.|Qoë¦Y…Áó¬nh¿LE*3Þõæ4ðKÿžçó¦è6ý‰ô´#o»—ÌÇM~<@;ìÈ®8¥AQ±&Áq,»òXT-²ûu,²D˪ìžå­íO¼kÝtÅî›Ö¿+ø²ª-ý<»Õ»WÿÈÓØö®HÄBþ™EqqhÞóiß]½ÎSý—[mt$b3ÛþÊêc9C“Q©•¤ÞᲡ=½ìt¸lü54á›5ÊWeÁ+º‰7L/ãU,²D¥H\'W"3ÖPÂ¥cØÎ2R=î ÖÛ'‚ƒýC=xÛ3r £Ì—›Ñ ¨K™ß×U~àÎÁî ½­I»|GÇ”¯}U5NU‘µiÍHC´ =9-ñ‰Hê3|Zã;N Iq¢Õà÷ua›Î¢á Ô’;÷åýžÐNGÝ¢¯7Vqq¤©ûj‡ÞMS7Ȉ΂’ÅÑXwÒoÁ»š5L?5ÅCY÷¤uH}6„µç„ ö‡®„³%3iy`[÷‡7EN-à®æžœ¨´Ÿ`øM¹uÓ|{ÓjA’¨àUbmÁcÝ~ÁÑgÑF›qQôô[„¡eàÇcí©Š²w… O}GrŠe³‹d"Ò${ÎîT–ŽvO),Z ‰I¾ÍÕ³h@§&øÇÅÍ©9SëÉ~©0°ÐÓífR 8»É fâ šÁP0ô--©E¤ÕÌwÍϨÇe"¾BaM bz˜Î`dà A£³XØ:éeÃÞ?/žAƒ3Ÿ;.é ÂŽ?ÙëQ3?¸öry´r7^V4c×ÔÙ 6:c›CŶ#£Æ“ô ß’Šêlƒ¤C,13?c“ƒÃg S‚:NÈ*á³=!Ë §üÀí¾¨–5ÚY6Êg“J'¥‰îÈŒ´ë9]uȦºJòŒSÇÕÔ1ÄìÁ¢ÉÅlZ àã¡Ü¶EÒ°ÀŸåݢ憉Ð*ù¿&=sF› : òÓ[9—.#²®ü˜´aLyÊ„tõâe‚ÞHY›•0™t$¤”OsGOõÆÄAs€SVsÇ2>Í ´k9…Õ¿Ô]‡«3(Loz×Us°Mýk(P )´~¤3‘op8¤¶-,Õ±´h“?g×¶ý‘MgÙä¤-;‹Å˜f§‘ Ë’•Õðæc¿wMq,ШXn,AM°ÒÊ •´h­oKp–ú‘ð8_´ü ©X“ìÝMåǺµéh8ÞÁÀ©çoÙ'EI̳#J£iõÏÜ]w1°y"¬P·mù±<””a7eç%Æ-ùpZ ’´6ïä^:v;ÂNTÞ„”¿îîQ¡°Ã¹¢³ÉÎ-I q:2¿¯[Ât²²›S´LÈâжîìl8w°ÄUmû›¢Ã¥Ý"çϱ҂óI"ýP+€q”uŽU†_ã@—®Ò–P.ÑåÇX"{sP%J›O-<– ØMÊ4i,cXjŠ%@‹væbN“IøÄížU$ °åFk‹gÖÜæçaˆ:0_SuŠãKªnbP 9Ñô#Jâ,ñy`–´ÝDÂŒ‰ jû€Ï8 9•økŒý%Õ””ç˜ ÊTvñ¬÷u¢>ò'åÎð‹Õ5nY\-¿r ŸÓ\ƒ/¾?l ¸Út¾Íyßo»Þ!…%È3€Î0˜K-èÄ.ô…!ff=½6 ¸ú¸€B ØÝØ9|ê”åà H{Ù2®-*Ç>¯žnÌ` ,¸8Ž•V}!g¾„[u<Å­ÚØ÷ MÀ .öõ¡h?}vÔXõW¢»Ñf¼æ—\%z ]a²…®Ú¸âQì½#Ð'! ÓøÓZÍîÉëŠ+Å`¡ëü^Œ·b2™S ÖA§©‡yEÏ8é±Mz¦"}‹7´`–DÈe=µËíþþkì2•ûe¯¸[ÓWK{AÖhD›y.[6ô³X…!„[@09!z¸Äò?Å<í`{uïYD\Ævƒ ÔøÑE_mÇGº_q 4„á`²c¹w:%ÀÇòì·¿¼½þðæ‡ëïÖø®èË´*mvNå‹0M½b’Ëʳ³Å¤-d,V`ñ„™(_9\(ñòêòæÖq3ÑÖE^BÂLO [ÓkÙ¨b J¦wùSaó·]q—s¾Ap³ÉøÞvöÖ8\•X’*º ™(-äàÆbƲêžHu1‚ÌN…qbÄK_’pä‹ÎÁŠßF`ÂMþ–p—EˆÞ½W;Ç `G¢<®”ˆ¼®ÃêæÅ?-œÈæèO9È -‰+_¦*@ÝY¸Z%ÁÜ5±.+ãKÃKW>£- k¬ƒRíê|ÏwÍ$Rh9«¼=#ç8¡–Ï* µˆÓYùè¦À$.JC›iCï©>¡ªæ—žgŒa–ª 8…rw)܂ޡî†Ïàq/í P£— ë†aFmþBÞ“~’·Ã?Ù= >ÆÀ Iy88¬„ŽÞú- 9° VO¬ÂŽ7^fw6½fR‹=æ¥Æy\y›L LûQé8> stream xÚT]oœ0|¿_Á£©‚ëµ1m•F­ÔT½^ž’("àã\I ¤U}Û$wU¤T't–ïÌŽgˆá¢œGy!h!ò¨î7ÌíÚ6ò‹íÅ.A`r„|¿Û¼ý(eŒ–¬„h·?.µk¢k%‹^Š"#W—Wtûî2N„äjTvY¥äKeb^¹êâÛÝçÍùî‰NrIe*þSÛŠ~E`‘Qȱ&Ï(“©9ª µ@A*Ó,‹þ_Å ã3X©ì§ ò=úm«¦ÙÕÐ8IEI>…óu5ª3\r Ó¡ ,Ö;( ŽsZªÑ7 „²ÊùÎìí`ÓA­¸^™QưE3ˆf$ (Hð½éþ¡Óµž¼íc]uÚ´Þùið›­~\˜TØ= ¼°®kU½žuBq× Å焲ûÁöKçÈŽng-¥ä‹Û ¤Îî„s 2¡ VÄë"³™í]¿ÜÕ‡öNéV™Çª›Õèkeìøæ 4OslÐU¹a’Êò–Ržò„™Û®±úù”Á¼Œ²(ã°$åú–E ¾Dÿ(rürÈ>”£zuÑ÷Í·§6Ár*2‰¥̳͋^œ_¾ œ¸!°œ,VmØìKú¡ j  3ou=˜qz±¤¤žÚm†ù¾SŽ-Ï9-0>ðŠÅYIY GCPx2B °”fœíá2í’^†Œ.áЭ!åÇXfÄs;Ô°ÿíâÖUfÚ¿é«ÉêßËL¥‚|5¡zï¾ãäÙÙ<'ïøbJšçéÚ‹‹šUÚè饖²ŒJ¼½vƒD¯qdþ(ï©È3¼îÓÆ½üeŽ”Q¶š†ðaî1å’üô> stream xÚÕZÏo[7 ¾û¯Ðq;TE‘ @»"½läÀ¶ ‡,q‡`=$)Ðý÷ûø{±ã,/ïÕ]{ ­G‰ùñ‡¤äRZH˜)”îoB.Eå Br`2'J(¹8K E;‚ƒ¤âŸ$&€  M' j¨©j Ëå TB“n9 ͲO.Á°F4XõUÔÔ)h’¡ 5g©˜ß@´Š•••\ *.Å*$©$§ —ZGaj竘ÑÔ…W,i©£TqñMÖ:ù-ä”2*” êf¨Ëþ³T؀ɩ†åY: ,l Wƒ›áƒˆ¬ay5_VÈÈ…‡l™&ê¦5u Ø"§DnU\»æ”O/F3ùâP6󯋏AXA™KÅÂ,ìR cª »€h®æsÁ–òÝËðƒâGIæ²ÌB!îCBóc Ä=&0*lONq€5\†Œ¨Ž£î$˜tÀd._°9¡ÜÉjA8wcx*ä,ˆ¸­­Õ©¤Â 7 (ì)AP–œ€Ç‚û>] û)0§¥“D+ž`¯ |#ÃW). J¨ºëÌ \V– -wöÔÔWÉ-¨ÁY€à@L¨´Ô@~ ¼fG¸àC-äëÂ×U‚À«ªG U †Ú²ëÿb¤£°š%ß=\U­tk ”/“ƒƒÉôU8EÌ*Bù(LþåWHä4BÍù‡÷ïßNž?˜¯X¬pãŒT8:^7ó›pp¦‡€I[ò"ê-  €±üááYV´»ç–ö¸¢5L…`_}JþËV«uPX­€4Ay-Èü×jšûòr4þtµ8?žÝ„Ó0ýéÕa˜žÌ>Þ„õ&Nþþk†g¿Ï&Óï°¡ÙüæÚSûüÉôhv½øpu>»^¦¸nì‡ÙÅåÙËÅÇpš0 &ÑóD+›½…¼³+,≴Óaì’7ÌZÕâ¶UÇðiM±ÀºÃwúsÙ7|?Üm‡t¼jOÛã+DÑKÜ£Œ\9Z‘1õyCBw„„ ‰é‹ù|EO—ßÕÚ’Þ1L¦Ç~»é~9ÿc2}¹¸º˜]-…¤·®Ê96aQù(E®^äRÌè P;#*/˜^tö<Ó׋“E€+¾ysôãëoÝw½£=C®ßp'nº ‚å‘nÓn+££-Ø 3|’=Õ´cOmüž¬'6ù8—˜‹Gs+ÑûáGISL…ŸhÎMŒýy»ÖûÞ©ò4ï´|Ï;Uûyg Ÿ²Å‹ cüÒjgÛáƒ6Ìw“uëjÀò\32kFDG µ"Úë€6;z_ŒcLÛ¸_ßÍÛOêõ¹æè­7Q‰ÕÅ£³-}¤uXh=Á5Ç—Ø ÷`„ö„CÂ×Ò=Ì3­E–ŠNÙä?E¾x³2~™×'†ò±@›\¿–¢+´iô Ön‘Fu9[¬?¥A+b…ϼþ4¨\ =œßÀæÈmõ+L¶5Ç7—×7ãS}³èW ]º¢‹ Þ£Hª¢¿Ô(i,ùß­jöñºß½&˜Óïߣ=§zïÙt¯2‘Ñ#ZZ‹\‰…\d2ýþ¨ú#‰Jdt&’Q»É_44râýzÖc_þÈÚ±„œ#ìÕȄî™*vÏ?‚½Ê÷J@RC–ÏÑŸ:˜€]$M”ê+µKÌÔ3äËD(Cò8#!ñ˜æ¯¦"äûw¸þ¨õ”Š Y·¯füÕ¬—™·ø´•è/©_òáG²í0Yo²ÖÓdmôu3 lyØÞnvïØu°¸Ü7çAºÛeðªM`Y4úÎÉS ꨬïœ<Þëîêr¾¸ºš½÷ÓÚ|tÂå†óŒ¿x*ŠMö§ùІrÏr 9·Z`FÕÿ@QXñ³Àt,ˆîðÈÜ·ù¨¥Xv]‘ßcÿ"ýà+ôçÍÉ%툟64Áü ›]Q endstream endobj 2546 0 obj << /Length 239 /Filter /FlateDecode >> stream xÚ±nà †w?# P8°;6j+UÊRy«:¸±ã0G˜äùK‹ÝFêR±Üý÷qºˆÌˆSÄÕZÔÚ‘ÃTÉï4ޤ¯Ï¬Ï ¿!Úêî ‘€l€´ÇÛUmOÞèîÔÓ×ZS¼gܤû!fÆ•£ýò51ô8¯È8„!vɇ±ôaü|žO%ˆ]èç©üº2´´‹¾KCÞ`kK¡öÞ¾TíÏÙ¨P ÑÿtÜè?¢.‹¡U›¨²B¢)¢(@2ŽVÑ}>…C ÅÐáj˜‹_›Ò\™Õ«DÉz¿¤è?.ÉÏaÙ\>ß}g· endstream endobj 2549 0 obj << /Length 851 /Filter /FlateDecode >> stream xÚUQoÛ8 ~ï¯ð£|€u–,Éöc·»vvEÑKž¶¡P¥ñ5–ÙFPÜŸeʉ½èSI}$?2,JáÇ¢œGy‘Ñ"Ë£M}“Z÷¡ðtÂ]†ÉÄòÃòæÏ;)#–Ò2-Y´ÜMC-·ÑWÂJ'¼Ì EV+útû'Y–‘Ukœ—ùGÛ˜¤×‡øûòóÍßËós’K*Eö›ØFë_æ0£) rES) ¤€žÅ‰TÆ #‹˜‘;À–Kò?~NN r2€Í® Âêaq—‚4®F…ÓvÛÙÆàÒ×qÆÈ4ììþb¬qºƒ òÏ%L£„åTeàð8+RµøÕøi«úx0^ÎG„<Ç'à¶Ûë¥Z¿Æþ"xWAíÍ Ò´mµÆ(àÓà·oÍì¥ÞV;LçA¶>0$ÖC¸ñõK‚§õ‰™e”ILL&\h!.~4N„d¹7ΠFA۠⨮Mg\‹gì tû*¨àzß À¶K='â-CDŸߪöh9´5t ò~§>:£;)óÉ –NëൠTIJòŸÙt¨8UÝ>DVÓÈL xaˆü°úòåžÓ¬8[A•ñm÷Ò×f˜ªê¨rå눀6Æ-ÎÐ¥ˆNMÐ9Óõ¦Á†ÀNû˜§¡— +8奚µôÌ ¨=Nuí²Ìl±?;7ÚtûÐÜÞn;¼Uöe<Œû«QgŒƒ‹ sÞoô0²½ÝtUcÃØš0ÍnÌ¥Œ–Rò‹·½±OÏ·OÄ~é@œÞ={ÀÏÖœÐ]¥³fŠ’Œmú–Ê4¼RNÍåâl´ilÛ…`3,¼€-§F³Ê_‹—#˜m_×oWA¤Šª²œ€`ׂÈǶ†Œï_‚‘­Ùéþ³„3 `ó)Vù¸Â¼?N£ ¶ ¡¬ñœô’†UÛ¹j݇‰ÙìÐkåËJF—c‚¾ž%oײ)—†T¸‘qšÂǔшÐ3²¨Úh‹‚ïh»oúÃv(ë  ìD—Ö„(°a¯M{ÿX¬|wÚùt'„ ¹èð‰qå83ÜæpóêË`Ìq6r‚Ü>.B@5¨öya„რO endstream endobj 2553 0 obj << /Length 1333 /Filter /FlateDecode >> stream xÚÕXmOãFþίˆ®êpÄxýšG% ¥‚JCUé¥Ç!ÛÚ»‘_´êï¬w×±ÛâÔVUáƒ×û23ÏÌ3³ã žÿ¨ç™=ohéCËëùÑ‘‘ÏÆO=1˜Ý!¹o¥ßÏN¯§‡ }dŒPo¾.‹š¯zŸµË Þ¦AÜX–¥9úÛv´» ݰþÀô´UÂWlmÍä–§€1N }ï”ÑAF ¬Gb"ÆtÅ"qê¹ï¸Ž Nƒ;t54²úóŽÆóÂlÇttǶވQí>êP[·l×T@MW7[ut„úÇ5µ;0E R 6z¶zãx-$ðzŽÄ ÀöÜw-‰BÌ­H’Æd™¥„Ñ„ƒº-Ý/sÝFoª‡£‘P=~ÁÑ6 ÄN õ†úÈum¾ÑêÃÞ¬ÙÒÌÓã>G¨ þΟq|Ê5rc þ¶‹ª ®I|Ã@Ø·ˆÈKªûwÓp í¸´N ÿ¨‰&PÔ¬)˜P?ÌVxy˜>Ì.¦b¼ ðŠs–×€C‡ydZmþ†”e}Ìh<Õ7ßu©ÿ×CpþÎbi[‹'œ% ÁTNÒUeõgþæUŒËlGxÝ8BS±aB¿‰žYÁ5YóG>9Òmd7›yø!VîI7Å (Á–¿~šp&ØÈkóâ÷´ôêýdú“$c³ÊzE­¯S™‚ëvZAn97äUO>šjôþ}ÑRñîÉ©€ÌA)ŠçIE÷Àò@£ƒ%"-& N±jé ýMàÿ&w¬ë 9?ö¹R_.…L4]j¹—ØáD%…ïI²ÎB™†Ÿ@z¼#ªäü:¾­â(Ôó)ûý¿};n¬¢íP­÷ŽeêF‡²«ʆ< ž"v ýgaZõZÕjA¿¼àcZo¶E6/ë=#ö$>ߣ…¿‰¦>(„·Ê«m  ×\F’Â×S|"N¼ÏfŸf0ZÚoj;Ê¡ù‚,›¾«dMYaðBÒ½ÝãŸ'óÅõÅäöa6.ñ±ÉÒ?»JДíÄà•e…Í…{Û WgT‰(ŠÙ‰øJ—woÔÞÀÒBWí3ŒOŸtð+ZIÖšìȨe{)ºå¤—r^ ›@³ðM%o ·óß^þ'®ˆ endstream endobj 2557 0 obj << /Length 1215 /Filter /FlateDecode >> stream xÚÕXûoê6þ½Ev§IP‘4΃u›t×K+¦{QÕÂê­S<%1ʃÒMûßwÛ! In§=®ÖJÄ8öy~çó1H3áiž¥y#ÛÙž¶ ÏÌ|6~ÒÄàîæ Éu:,ÔK+¿Ÿ]\»®†LÃ7}¤Í6eQ³µöÐC¾Ó×-ß {óéܸ{;íë¶m÷æ ‰ùÈé}ÀQßõ2ôg?œg…:×r ×±_i›Z}b ´‘ᇷ!ßZ>Ø94L×Fîb¥›¦k¾ùjóÙNôfp€¯è’›¤é¾á WÓÁMgˆÄ–?ò7¦¦[à»%'/ÎûÜŒÞO[‰Ñ ËÄ`ÍÄ3b©²£tKÄà‰D$Æ)‹ÅW¶ü•¬äj½ˆAÈb2(ɶ†0:¿PÖ”MTÖ¬°4fM’4fRM Øm·oÏ¢,^lbBx\À´c™^O¦“Ù/óQQlÚ¦ù ½ãÃŽE$J)­  t@—YJYMу9PjDñ!ä~Vl=W9aÏèZUXÝšßóII8Mf¾#«« ì›nëNQ'X8á`s×–\¾cñnr?»“näÁ½„M®w¤¸†ˆKŽGàÓIK¢oßÞIYç;Ìåæ¼¯äÂIJj²ÌnƒoÆS%uÅÂ݃õxYådÇø¥ŠÔÆC*9” Êq–ðü¼N9Ȭ»ÔqnÔdXT’çµ!gͲe Óº‹ÙRøh#€s‡“|%^Ò€¦”€o#ÿ™V ™‚äÑKY†JnÀØNŒö8¦87ÙC·­P˦êži ËvË‚z㬶f¡ì+²pÉPc„&ª»Š PN-ÞI-ÈÇ|ò ðZi&ǶØò­xä D>½ˆXâ€Ãc:ÿ~`ŠÆ ZUΫ– /®6EhY±(]$$]@0$Oä/z¸#sVZ™²0(¤Svp@."ò\È“ÖÂc~V[ÆK(Å-“9ºLlî҄Ƽî•—µÒˆ¦\#˜$õUðÀ_“Óß@çpÔÝĉè¨V®ì‚g—\Øü×ÈSF#A[¯È>9ž<'(³Mó et¦ÿ3e ýï3¦dÜV©®µö¿ï-ÅU&É$÷¤ò’ƒD×ÐÔ”¨ 0q õð¶¹&ùZT_k_v9Uf¶°Üoýå½±‘5àV x©›xg¥Êþ±Rç endstream endobj 2561 0 obj << /Length 747 /Filter /FlateDecode >> stream xÚ¥U[OÛ0}﯈¦¥Ð„8·606T©´Ú$@,$Në­±+ÇYAÿ}vì\ÛÒÚ‡~¶¿Ûùα 4‹6´µáÈ1GÎP‹ÒžUìÒ¹&Éy(?ƒ; Ï/ÓÞá™çiÀ2+Ú4i¦šÆÚ­~ºW Ò¾á8Žîõ ×õôo-Hß°‡zœ‰WOˆr™C iÈžË5&ØÈ1âç©Ü !ŽI*£þô=_) äyðG¾¯?ýÚO«¶=Û3=×y'ÆÒ{¨´‘ø¾+pŽÙ®6Ü;p$ØÃý¾××PþÆDþb”a,-¶P>IWCÌ2¹ñ³4RB•Ëþ¡@Ä»3xQ×—µŠ‰‰Ó;˳Љu,Wè“]Zü¡éO…Ÿãœ>$B/š¸E÷Âÿ¸0T„Í™µí6º ©Ž@YˆÕ6S £Œ~+¤ šBÎ1ÁrEºÇJ!ð†;P¶CÁHÕ^‡ª§,"˜eI¾4åÆ5ON×(S~òÛ0ªêW³ËKi­Â…xŸQ· ÐnƒËRõ@ò¥2£0/ †ª/8O9× ðI˜/Y{L_\Î&ã†[ʸ—2Ù6‘^‘µ4žI^µ\w·ÞºŠj¥vÁ…ŠL¨x‹¶‰´#ªVŒ2FÑc. ´9ž›|¬ 6‰}㮫sÙÜn¹óOJjâ`"‚™RÍNžj]ì}H$§ƒ§Í'£Ò¦¨3’ï‹R¢Gïy0_!«õv¹mß~‹ J1ä•1Αíìo=£Ýé5QoQùÍìôt|sÓ¡Ûô‹ *Û„å3S>šiˆDQ«¦¿ntÛÅ0þçÓ, þaÿó„Î endstream endobj 2566 0 obj << /Length 3003 /Filter /FlateDecode >> stream xÚÝZ_ܶ÷§Ø¾iS/KR$%9èCÚÄN‚ØMí;4@º]žOÉžö*íÚIúå;Ã!%R˳ÏŠ…—’Ãùû›‘ÅŠÃ?±ªäªªKV—Õj{ûˆ»ÙáÍŠ/Ÿ=žn„›ˆò/þôTë•à¬áX]\Ç[]ìVߢ1ëlÊÚ—/.ÙËÏ^¬7eY—£p¤Šçm¿–uqj÷ë/¾~ôÅÅtœ–šiU>·@}Æ` –Œ‡Ai׊ÔL&Ömdñ|½ÅWß]c•.þ…å'×¢øëF§ÁÉášž»n<ÝÕéØú¯± _mDÅLé}N‡€Úýþ°–Uñn¤ßÇ=ÇöönoIB×ÃáÖSÓã¶ûåH<À[ÇLžúîíZ›¢ºöhi.á‹!c+¡X£°c˜(bç{$¦M3-V ¼;¢k"Q+Úª¬‘@³Rä\,¨;·bÊ4«ˆêS¤©Š'ø0ô¨ÂãSšô§ '¦ë29¯Ï »a²Jλ¬ ”‰.‹o?вÖ^r0Äv8ù©:Íewôúxã·ÚnïÜÖ‡Þ:#>zê¶÷¤?pÍs"‘a`«^´w9Ѫº~h«”ì]^²U)>,YàJ–ñyp?AWŽd¬ÀNÑÔ6J‚±IÔXÉ„þ²Ã᪽êöÝ%ö+,T>`·ÇÃÀÖ¥ÀÏnlŸµI)N2åÒ0-&³½OŠI5móK~YÆÛÀEeUβU³ ôõ }šTŸ*=³’rQýÀyVñšÉZ<Ì5ÓóÒ;NöcþÒâ¦øcVZOÜ?YØlfs ZàÒ~A~O&lHŒUÐ$"és*€0]©‡ª`iˆ‹—:ø€S=@ åÇ*½«Ã°$\01f\„‰éÍx S¼ƒ¹nœOË ”gTêÓ!Á6£OKq …ä9bò¼?=·Ç›ƒ‹ p¦‚ŒJGÇög v¤Ÿolo‡þ„ @ÜѺø b‡'¸¦WþNHãÃtåÃtUR¦Ý€g¡ 'ß®)®‰b{ [ãB'é.‘0¶ƒ…$a6÷ìú fX§¾X2=Ùá×ù]©) K¸¡Ó@‚ûnlíÀDå ÌM0.ràgu BÂqpâ]w¼ »ƒ4ý웎2Žß~©xDn¼n‰Q²…)Mi~çÅž;02ðUÈoˆØlÛ)^»M'>æ1!úÿhí—ªdªQ+Ýð@‡†™†Wmá§31>Ë7óú ~_âný nì4ÌiV3E7ù8þñ1Mßµo¼ŠZ.9Wu€[Çœßãñûù\l9<æ‘oЈc[–g¶ùg0!œŠM(gÜ 3D0Ýï²éªÄ´ê)ÈqcŒº¹<"X õ‰$É#_çó‘6Iâʦ҄ RVèç "Yé?n‰„L´ÂŽÂ¥l<Ь³^"óù~€èÚÎÙ·21Åb‡Ë …í)À¯:tônZìëŽDì ~û­Æ±»Ú‡“÷Gå¹ *§‚*@ù´¤*#ÏUqCŽ?ŒàÁàW·½ívvBw{œÒ`롼óqk†~×…Â 0zëâüñI“hÖ@JÂ> žµ=ÍL=ÅÞ)9$ H-Ò¦K7®ý N!·ÞíÏÄàWù VQSs"³í‰½éoñni³Ü]7þ±ï~äeg{Œâí¤WfK‹Šie>ÑuyÖèÑÅÂUEðR>D2Ý·w÷‰[þ>íç=ïLës ‡Ì ;;X¯Ö9ˆ v¤­&ìB- ð%H¯7¶óæuàï”ö` 1H¬²³öîùåa] €*®âš,_Žö} •’–ÿÕa.à |dêÒˆ…©#ÁuxEÓ8+"¤vОN`0… \æ $ÎŽp ]PnÃ$.t{Œ8ïg| ra‹§«Cã%y O†–âR]?@ȯèP÷z¿'úËt„rïÄœ’GÕœ®àæ{»ÜØýtþƒ¿ÀDNKSc÷›u'ëIàHà) @{t=Üéj“»¡^Ùx¨Ž’X“àdœw²ŸßëHöÍ¢Äp¯Càv¤¹ü6dB&íÁH×ðÎrêOÃkÜÿuoßåL®‚bYOäN’\ ™ÙbJÅ"‘f7¥© ç¦X濾/Ê”¨ÜÝ@-îzø{‹jCŠÉ-ñuKõ$:†,éäXHäêxÎ8©—BOw7¦)=¨ÅíëA¤ëúíþ´³YK”æÌ­ñ9@ðÂÞÞuC¥$Í/Ûj@A2xçëwp6¯—Ü©Ò_õôîd5N·=íÛ“²æA0ßÕœ¸Ê1Ã5Ýí,ìí×Õ‡À7Øí òé½÷½,*<¯Ì^®5prÛ?g‘˜2n±º®óÕjYS „änua\æœfçÛ¸ÍÎ 熀x6œÅ "ôöÀkÇš3c#| %#èì´?ºÐ¦´ <>T­ ¬¸ÿ8ùùTç_:#ÃfáÞ½¥俍 ×*oßzéùnWÊ»æ,žws_Â^'O¸ð5œtÌÂå°&¹tšÏ¯œº<`ä´ûÊuÝÌxªšñL§E¡n¼ZaõW›b„|¼Åµ7ÖÓ&2É1Qù¢S7÷E@c ,Õçp´Ç×p‘®ë™ËB Éj9•9Ø0 ÅW©¹-ìäKê5L͔Ȧ^ªx¬Tå»90 ÆŽ\œµG²­Ð2‚¥³Rˆ Íá[@› Lÿo@1¼ëFg«F8ØŽn÷Ýo¾ó€»º0Mûå¢HR7œ·uÚnŸ‡@ÜÃÚå©ûªÔ‡22Øk@_ýÖÎz;ÔZ΋MÀN—/._¾þö³—Ÿ¬ñ#X.‘žÆª†ÕBžwÈusoÏ7e´] ط™ â>·•a²š€õ㩳û•šI1åY+{믆Ø&·À\,@±„NÄ?ç.JÓ0 °QjpOí¾~ÿ#_íà%(ëöwŽòvUÓÈÆ~õêÑß}"¶¹Lã¶Â¶½;üÙ/>ù${­šU³Ð]”ÏèFj&¸IZ¸Ù¨T Ò¢Ä}f®‡°×-eüÑø<ÙúòÁ¦£ñØ+4Ý``¯f&héA¯Ú³iñYnwûù¬ÙÓÏ®'Ê© ãzf”ºð´Yb©,dÔLŒ9å}¯}ôšâôÞöo€•̹$¼\ô¢ÂãFÄPP©Pm©ÇP$.ö#ÙD­Â3`[‘wE A°ZÕ3C„:%„w.rH4)j.#eί+W|òê@šIbQvqâ‚‹¾ƒ˜Àbã5—+¸ÌÓ¸âÕ 3g_½E“ýŸ¸"Øð ÜHÉ„¨Bˆ;.h>.¢iS²jn÷=(šÞš ž”V5œA˜ú=¡©äPpí¶ÆwQ¾EôŠi"À€Äü3rc6šKVÍ ËÇqƒ(Ð!W‘O(ÃÉ3'É z]8öUÎ7itøê:ë=œÕ•NN&Ø•Ù@ ÔqS¾ËHÎ/^^~‘õ‰ÃD>"42KQ<‹K¾ü0Àý§î %|—'ß|øÔ×ó>™Ë)*Ë7UÃø2‡ Ï° èDqã~üvoÇ‚Ÿÿµlz¾?ãWŸK0»ûl…ªe}÷_kƒ>°'蛕ê¡ÍÊ™éÿé^åMÈ̘¢3-ËУtIš)ÆÐi½=“éhsí}5}|Ûö v³¿LÖ”ÖY]¥ÿák6Øe•±tÚÏô_(3! j(X=ýì›Wù˜V»nv 00yý½³¦ endstream endobj 2575 0 obj << /Length 3039 /Filter /FlateDecode >> stream xÚ­ZY“ÛÆ~ׯØ7)‹08œ'Å‘¹ä•JÚÍKœrfI„4­7¿>} ”V•ª–sOwO÷פ®|ø§®’à*IC/ “«õá™O£ÍîŠ^?S²Î……îdåßnŸ]ÿ¤õ•ò½ÌÏÔÕívzÔíæê_Î{sìòfå†aèÄ?¬Ü(ÒÎ][T;ê«b[7î4¦ÚÔÒ®VAâô‡U:÷+þÚCvy•7¦«›våªX'ÚQY²ú÷íÏÏ^Ý”ê@{: ŸÈ–]}Æ[¼%^ tdy bÏÇò¯\‡ÎÝJ9Â32!hW«P!Cð‚¿ÄLL.Nê_¹¡ïÅAÌwÞÝÜy^ÞÀN?pŠ–7y[ìª|ý®æß”]Ý|’^Ñí¹u0ήÒÐy^*“ç‡í/ß¿¹¬,DN’9Sy¦-pIäk§,>¡4sž†hCq;XV •¥ž’”7~ýñí’"@ø¥R5Q<æõÍw>® ÷šGß÷is„¼wÝÁéo”Êç-w–5V^Ùk Dw Ä6GâH²‘ö=­ÂR#ÁïÉïÁš ÒaëK2ÖS #! ½’f?¢9ôDcÀ¡m_­1á™âp,óƒ‡\cì)±Ÿž¼´A}åR)Ú¼ÜÊm§ ˆüG_`ð&ÀÊ=̹ÈChKlp Èòà÷Ä%*7á·#šÄ_,ëJì©P[IƒÝ}øÍºÆÓGÑËgƒÆPˆœ(k}DBýšä‘øâpÆOÐËŽ#Qâ.¨9ºT:­ã· Ü€”àsȧĩ۶¸§÷!º,Âø Æ’Sññ‚1*‡‰ V¶=Ã÷8Y ±=^°—S'àƒã`÷O¼‘,•EÕ‹†×%ζ\xns‹Ò4ó0ï}‘7ÖÙ¾}þjÝ?®†L†–­>Ô^ Vÿ¡Ú}ìšÜs ¹$]ã‡cK¶ìxCM7¸*½xÒ¿ú¾¿ˆ,Ú‹ÓA¥ÚÜz þ¿¸ô¯ËÔñ•HžŽÕ··ËÅ/¦íKi3š¡ÇO¡%øZš¼µÔ ²BeüÞ<·ŸŠã\ᆈNÞ`WTC!¡Êÿ¢Úþ¾%úÞŒCìt,…Ãi^N™Ö%i¿·P6yIéè™ôÏ"c[\°°@7ð½0“<è–¢0všºïŠŠ: !ß5,0<%Ñ L¢ú–G(?…ßÎÊU·¹L Ñ ´´“o˜Æº°ŽR/§À&°?&w‹ÑËM!€’ÒσÎXŒÊÿ,ZÑ‘‡Æ3C¶®S2JV¹ïXÛG+ñ¦º†2éO—ƒÃûÆbz‰”¶aX ~º.¥>Bú‹scäóùe£™cg,sø—J%°ŠÒllÕ×|5lhû£ø£¦ãê‰?HƒÄÄJê¢|Ÿ&=~$ªò½ÛJŒ œµòR°øx%½à6±*ȶD1ÉþNb{L”øy ™Pzþ:¬IgÞifk?ýóÝ›¿_¨ÉMÑC—s ÿìÊúÞ”Üfî©9TyîKK_Ë¿¬Y”") Œ¯k!‚*1¤ØMNĶ>X?ÖåÆ-ªÆE£ëíp¢¢ÉB´ž-½n¿w ÿ@ܬ¯E`×K‹Sˆk“!òØ Ê«'Ê<ÁÞ_Õý¹´ü'‡R˦mФ´ lÿy»xe¤<­ÕWs¶ÄóÕ³‰kÁTó@AŠá²I©Gh2ü#^æ‘{dk@F¶^èSÑÝØ+I$¿HÆà¹=EöSOŸT*Ls_tD„äñçÇcî‘ú!7• s~sž…ý!ÏBŒìd°)¦™ Œ‡»Æ8‚¾i̦Ø ª6ä#Çü¥ÐÁ¹ ;úóðXMCtV\,b/Tyr©°7RþEx'Û‘z3eÓ¨‚Ò·ƒ)MÈÓR–…Q9<cÜH8QÖBùÆ.ãŠè$œã[s/ ALuä“Mw² N”§…r<†=r>šò¿÷}³ãíè^ö¶dßA èÅ‚è_ÝÙZzJ50hd ¹˜Žú ¬]Á0Ù>:D ¤þ¸¿•¹æ‹…PqRé'N¿¹…©ò24¶$ò•Ò77Àü+ßɧúø6™~…³ûÝÉü…qfç§× ö]wċεü Éãˆ<¢óÐK¢÷õØìxçóiê…DÂÄI®O™UAàA¤z¥båùñ×>0ÚÕîdùÂÇSh/MÂáP®òÛ‹!qšYµÃ0µ%3Ý)©A¤ÏHý–w±ûωŸ{˜“kÆw¹¾æXσçðÚûgÖžéÎDùX¹IŸ(R»ú+"==T$qg I|Ä脤ægÛP9”¹ôôá?ãJä«¥(½á)Ù[óÜ$@§o „«÷$mÂýlv}#w¡g1»%O†X|¹ëbýÇíAMÝK^/S^<ÖÏ„ÿ(ЬG˜ ŸàÏÁ#}¼ýðêå/Opê¶HþP$¼oÙ‰§‰—Åê¬:´XÂ’ :uät²£€Þ ¿Ív¹^œ*]δR‡¢É8(+%W‘Ü(3 æq©,¯Sç%Úeâ¼¾¹s[â,ˆùÃÜ'B×]Îë¾¼É2ð†þûê*KÁƒoÇ]ÙîŽû—`w~Éꆧ¨2¾"ê†'¨ ¨‹;êm÷Àíc/EЦ"K…ç`¬±ê—jÏOÕט–ºãÚ%ž75˜8\Š(JO±‡X÷+°7`E±Ûˆ“½5÷¬ÀNÏÿ¯÷PàØ (pà @ÙG ’% ”3AÃt{Ùê ÈŽæ@‚/ñ?éæ,à endstream endobj 2580 0 obj << /Length 3245 /Filter /FlateDecode >> stream xÚµZK“Û6¾ûWhOËIY4I|äælÅ^o%S»öø”¤¼‰’K¤B–ýï·_ A…ò8‡-WY@£ñj|ýäÄ«þÅ«,Ye¹ s•­6§gQ»ýŠo_?‹…o Œkó‡‡g/^³Š£°ˆŠxõ°ó—zØ®~ â"¿['…ÊÓàýýûðíËû»µR*xo«[:ø¹lî’<ÊãÝoÿzöãøILh´úƳ9…Elàœi͇Ô!n œ©Ï›0Í ,N<¯ßý$L³å¢ÕøT®˜ëýÛû×p­X»®=aËý¡bÒëû÷Üx·©+ºt_ÿÅzÃ|?Õ]Ù}a–_#Á–ð‡LyÓóom™½Ä>Ý™4(ëcùx¬˜Lû^ RÇi^epð4‹I¡±0*à¿8!‰Î)¾hÝüµ·‹v&°ëmH"‡¾?ÿâÅår ÷ͶÝþoµV‰‚}`Ñ~pÛv×_Ê®z±·Ç×׈ӜÞ,-²Ð$OÀÁ1¯'î4\-Igù|™5Χç <PúIV5¼_ôU·»‹ƒ^0*9šmϽGøÉi(‚M{:×Çj;-h¹7j2¶nöL'ô`cÓ6–ýÐÉjÐ3¸ù~ ¼J«0ŠFô®×—º?¬‡®Ù¯A´KHÎ 4s7A4"Xxe­  $K’P9³þ³½Sqpøe&x¸+tÐrtü–ÊdaªD¦?‚ô@¸”Ê=1¨"ØWMÕ•}ÛñX Â4&ø½Úô<~Àë[n—Ìs&y·"ÛJf’á·dÞ¡©ñÙÚîÄ}T¶³­†m»F…cÞ®l¶í‰Ûl¡èeåAeá鄈™HÀÌÃUÑ8NE‡áw6j‚Rm%ßê’øø‹–) ³"so54C÷&Àç]’x–‡:QŽ}Sp£Òñ–í0ìnÛË¡»G¢oã‰'é(‘E`á`LâC ^)ãù,@%ÕJ|É1€ÛQ¶º’†ÎR'"ò— ä1(«ñ!]6Àíê}xxÚ“ü×&è…ór³úT‰»UiÆJÍ,èKœ’ì²9ì€J°Ã_P¶CЙÄ_Œâ2Û[h<ÒRwÚǾ¬Eñ-c•¤pýxv}2S²ÓMs'Q˜d±§¿i\÷Õ§;rð¦ÇÊÚçry±Î¯b¡®¡UÆ¿lœµ8¹l2Î8ØËo‰~pÓGÑ`‡Eƒ­GQtœ\‚­8 |q md‰RætƒÄ¬§jœšñÔÌYFš¸s[/:¯hÁîÛo¨òa%^LkäB‚ñ>g" ÍÛ6¤•‰GPk1 ²^A£©.<î› “Þ§¤÷VGyX¤W–è]{"”¥N1Ùß(©þ@1_°µLñlO…O}/\b“ 2rlÚ®«Ž°|Û0¡n¶Ã»ˆ88ð«»\±£…kÙsW•=F’7Ú³<˜45$‡Pkø §à%Õ+ã ”®úc¨»j‹Î*/ØYåNû`|Švhå^–åõ»[ÇO^ò³ ¢s­# pÎE÷5‰vspÛ¥àD+0_i¶€Rtä_ßòe|„ZbºSY~KÀMÍ<æí‚”½«› Êe´öh1=qOVZ$nøuª«È¢;Ãç/Áƒ³Ó –ëÛÛS‰ž É8zzŽMåíŸÇ±0Ç ÕO2/¤E&zdš¼ã`8Jù²llÓИ¿Øf¡V….ËI˜ÅúOÙ·-‰oø7 Þr±¾ŠVÆwKȉªHãC×å‘G6¥%kƒ§ú3 “ GèÀœõj™à^Ù÷ÒÑB…m06lÿ‰ñUˆñc.;œÏd쀭d’‡ŽÄ{G?g‘ Íœ܅Œ:%Ö¹§Ä:ã™É`»\NZ²0Éç* ÓGr`Q³t™ö_…÷ÇK …3ðÎHÆ–‹ÁвXñ¶‘“Í /·ª(EÈ·’¶m$”Bú$Hèø ÝY"á–f~Ž—]Ù8 `^.Ë5å±Ý·ƒuó90Çù•ä&£kã)[]xÅé˜à0Û¥TwU/Ñ’¿wü —dÁ:º‘#Ó{2ã4}[“{í*—™à°m‡nSYæ8H‹Ã²›sï{pÄ'Ò䪛õ‚ó’¢êv%ìÏ—%žK20v+ :I ‡®d€Cé](^@|*J¾n;ôÂÉd úz3ËŽû£ ‘g , î Ýãúý–ücû;U°KÖëCdLÅæÜÒ»xŒCáöo?N,¨àî§œà„¨°¸Åõ’jv"—çAP,„÷Ì70"Zt¿ÔEk5’ B•s„œáÝÏ]]R k®Ó.£Æ¶)#0~ÄM‘GJþ]Žô#¦Ñ<Ò'ㄱàrA")ÌuU%й0‰3TÐò£N“ð«]ôræ²Û'A¼ý^DYA16Û·x)j/iïÈþÿ|d‡½\72DøŒtäY~•aã[vœ3U#ñ.æNWöKðwº¨rW3‡†íùí¡I'öÇ<[¶6Z>¸ÝÐl$"†ÞTÅÞɧ”HAÕ`yìm;ðÁ¢¢-þŽ]¡@“Œ¤Om½w#sg—ýŽò ë ø5¶´ óxÌu(›xoè¹áî‡ÂJX³Z7æ¢+îÌ…®ð%… ¯û $yÔËí¶Æe!n‰ƒ£,Ai 6ØŸÁDK¡çÎ5,,3» ÜÃǰwøߊª»9–ea¬mQõ¨ãß߇ӹvDŽHaŠ%þîŽjﵓeºƒ íôä,o®qáë­aÊ«¬$ÚͶn«ìZ¥¡J÷Ní.<æÚ±Í@þý+^x4’&ï‡æ “Dª%±†1s8+‚—ÿ~Ãt¶†Q ±R1¹]¤²ú£›BÚ‚›Bª Ü·àé*Ä¡ÑÁ¡ëÅùv&ù6Z`§ÚK^¹iÑ}Âó°£…´ÔƒÒ9DR€\®'— íåX$×óX$gõ,ez]ÍX»NÇxàX?¢¨)¦ÃþÁMÅÃ/جÕÞi=ÒS sQî@ÄUN¾9¼UËk†þV§¸Æ¥8](¾±Û ÝRýAC¬W‚ueWS “J&õãèŒÂMÓÂMÓ¹pÓtTó¥‚EÙÔ;R¬Ì)H©´¹…ÇÀ!òТÜü‰&ÏüÏa×~òÜ Žî £ ™+›`´â›™Üÿ*—çþW¹lú*·ô¾Ó7:°jÞÇ©é’|KÎtÿÛâowåÞºŽ‰l%# Þ›®>³ûB‰Éßd¼‰ŠƒÑcð»ðAJn}dõÑwý•/’Ï{Ïz…_ô&‡š8À£óiD‡©öwTÖ. 2tÓB™²èLY tð'û QÁ±î(‘;ʼ~w‡Ÿû¿VŒM£yhØYi·lVÌŒy˜èÑ”“\Å…ÿy5o©E÷½Nb´øWÅ‚×$ˆ(wõ™Å*à G…-÷Ów.݆L˜1 Ó– \!—ZQæâð(÷ªF¹ø†« .l|p¨i $€-£0‚"pèpMÕgÐýMÝs¡§M•ºQ€ ?ŽÒ¿òI[³à{@ø‘6T˜êan¾‚"ûAnåþŠáño˜ù> stream xÚíZßsÛ¸~Ï_¡Gªሟóv½^Ò»¹É´‰ót½ñ0e³•H—¤.—ÿ¾»X€$hÊvm5OÌÄ »Àî~û-ÄW)üã«L¬2+™•Ùj{|•ºÞöfEï^q?n7“‘¾zõÝ[­WQ­0ú¾nfÅ9˵A7aXªéöéý§ן>¼÷§5NºœÚë®ì¯wå¾8úëS[ß\§?PºïÞštºQBr¦R ¸¹þ‘ꔆé|:L1‚¥ã‚AÓâKÃmæd6Gáý-]íàåÏ«”©lõÅ<®$NvX}|õw¯a´šTš¥BÍÔt’ Ñ~(ÁR5hà”­Ë/KÊê” Î'ºr¯k4ßF ¬6\2®ù›|ó?ÜäßÑäšj·8_º Cdÿ¡`ÉL{%hð÷uqhnšSG¼-×T Ø>õymè´©UÑ~Y<£av˜<…%ÝŠ\1Ç +³4ón÷±ì_ÃÇàÛµäÉmQß”ô .F ØCjŒ.°Ñ(Z¦’ªãüêôØ€7™ü³ÜöÝÒ!¦ ˆdY¤ªû™sày-í-ç6L^À!„à,“ze4Ì(ÕKB@dÈÀïæÌæ9­ú·µ•É÷} Îrä»+ÚâXBüë–T1‚eF…±¯é°Ïø¸I™4—ÐHÅdžÅý.¾èšñÔ<ê]äàÁ¿;g˜yÒßbæN˜Ñ²&Ð’1 RÝ“%^Ed qF‘ ³C#”[fâUmEru[u4¤Aèqa lÛjWv³)F_…”–ÑŒ?ù®âÐ5Ô{w'*§Êm÷4,Є÷ý `ÃØ÷Ô7K›ÁÑëóìÑÝØ £|üÐ6:.3w|€¦LÂ_7ô§ãÝZó¤iûU¿¯5Ķ*ú’ÞìÖ<©º¾­>Ÿúª©;êío‹žZ§Î<íMÁÓ6ÿFÀ7•ÿƒªÖP¾à_ÔMOGà%Ž¬ï‹ öí¿ /Ier×6w>×8|EUà`Vî`ñ=®…áàjjaj’%%žW߃V®Õâ;~ÀUÛùOáÝßm[ºmðÓPcbñC¬6.ÄRÆÂÏ(éWz.–,BB8±b8o«ºZ<<­Y®<Æ­ N ÛÄ­ KSK%ÐAsD®-ÊpEÊјûº!Adì=–Eí1¯Ù/tnÙè·NúííÍõ9ÃÎSZÍ ;N'„…X>²/Pút"^hKR!k/Kݘl¥!”g™y*™œe)M¥•7åw?¾_F$˜N;šÚ‚ ªU}òöÔ^B°h¦rkóÉ‚e2²õ¼Q+®¼‡rí»¢`WKþŽí›Šà¢öh16£øýmÙƒÀ]4·J(ä4oÁÇ•ÜôÍL„æ°£žQ1ÑiÓ8ªÝn ˜ÉÅ1®î M íWà±ØY›{<ÃÖèôÝìÛa°'~Ú &?ƒ`Rž§ü x.óõ] ¢…ºx1*⥅sÏg1¾Á‘38—j X‡¢ë—„¹`ÜbDùF,,O¡çÓÀz&4Á@˜‹¡IåPo›a ÚbNeÔ BÓŒAF¡é<ûÊPÀ8Íz爎óØ’÷=Nz‹†y$s]…ŸÃ¥ð—\ [ÊùO@@†eT~.Çy•Š3¶’6ä¦ñúû“Ëx°sï—GQ¾`öêU™ÔJœ+˜Ö3†ÝÝ6§ƒÇ÷î¶hË™t@aFh_¶çƒNÌy™ú£ê˜… ?Å–Å#¶¬ ³€#J§Œ‹—3LaÊ‚N½?‘ýå—gЬt¤Í!ðˆH£‡±ÖDž3§w¶À3ÃÛ\3mÍT"@4&|ÏBŽäÜž‘o–ðÂ.10|º¢c…ؘb`Ƴÿ¾‡˜~ºßÊATÐ03Lˆ|E¸®ñ!N4€$tí[¬|bŸ©Ï‡s1ÒDÈWVf¹2¹1(mÀC ¬ ëb‰„sÇ€TNz¦DFúÈA¡\ŸE^Ÿ~ ³ÀÞ€ɲ-)êRgßDÜÚ㣺“u[ózQ} ¦kä¢úç™~ žIÔ´óBDbâö¸ÐŽD~à°$Â÷,7xðî³ Zø¶Š äÊí½L#i°ÉÉþ Ççr8´£7]¹mjßD¹,ŽÔnöôþGJ}øªí8ÆÉ¼ÚŽ/ÈU ±EfÛ`~×:’‹†Q _J@«zwÚâKÄ/å+#Bz î8¹kx$îºêó¡¤1Î$ªãÇ5½˜VIDÈ/±EEAÏso©°£ßКÖàƒAŽº,ýئ.Y¤’¯‡ÔæV>Ü](ßøw^R9^6®0°óXZùÊ/€r÷8ˆê% …3¬<Ô¿±ˆïÈ¥_’æÀ A:©,°<þ"àLÁq*n‡ž_Iޱô<ü¤@Zs»T€4¡‚aĤ¾gâÚœ‘C¹Ï·¯?ùQ“€bä$ À0²cœé\4Áä{̲þ‡ƒÉ‚;é -™‘œÍ™`ãÐûñ%™³\Íbs@%½àJ}«x+ Û; ¼ Tä€JÎP‰à€*.Ω œ %?èÿ£ÜÞŠ•A\¡Ïwû:Œ¤8„U7"ÕND/*¹âBdÚz¹JÜ°çæ²@ûæIžˆ…:™š ~~Ùº{¤JŽ^MkýDoÕ_ØIuv½°AÝÚ©Y 'ñ]œzàb9\*ïQ)ÂõÜäp+cl€jT«§ö)0 ‚IH\ÁæPÀ±¿‰8%–Î3ƒ@:^&¿ÿôË/_fŸ‡ •f,Ëõã÷~7Õ$/8fÌ% §Â²Îó¡âyöÜ2ig?â »JË¥»¦P ›¨ Tö§;S.‡M´ãŸl©è$8üy±X§*ݵOÚ´œݱsï—÷EwÐ6*Áììjú£Eª³‡š»kîò~Í]MkîýîËÿlã¯E½;”ç~×µðë $ÐÓÚâ?Ê7Kû$­ÃT¿O›£O©›=ýõW'C|<4´9®oª]MˆžÂà0~úlȉÇ_e¸ï\¬‚Fé/ñ<èšS»-iŠ Àð R.—jZÿ²ª·!×¶“,ÁÉ!iÁÌ/ˆ…Õçvˆ¥jШŽw‡òXºß«öåø;‰÷eX^v,D…ÿÂy endstream endobj 2603 0 obj << /Length 3341 /Filter /FlateDecode >> stream xÚ½Zmoã6þ¾¿Âè—*‡3+Н*îËÝa[l±]ôö8 -ö[NÔ:R*É›æßß ‡Ô[èØÝ¤E€ˆ¢(r†œy晑ù*…?¾2ÙÊXÁ¬0«ÍÍ‹Ôõ¶W+j¼ýö÷ãÖ0p=ù¯÷/¾úF©OYžæ|õ~7êývõc’¥éÅ:Ë…Õɇ7ØÛ¾¹X !’]ÙbK&ßõEf“C±¿øùýw/^¾–S™bJŠ3e £ ¨Wœ³\©,˜i–*In›Ãå¾¼ÀדC}h?ÚúêcWÜÜB/ôÕ7:*ÈeÎ,Ï`M÷úO©Ji˜Ê§Ã$Ëä04”ûm8S9¹tâd6Gyü9]mááw«”I³ºs#oV‚eF@k¿z÷â?^©Ùj™ 7jªØ‡·o¾ý›×`¶2c©ÔA6T7¦'ì&OÕDMîÕœ÷:“’ÉÔ®Ö\0®8þ¶ìál•H ºêj×´7tÓõ¶ñm:ùü fbgð`×Âȶrc‡y ü\¬Œ3+mÅàtS‘¼ÚÑÜýµ?X4Œña™–ƒÂo>¼~Y3"ùQ·Nè¦rzôAøª£ëUõ ûËúïxoÝÂîÁ¶Ü‡½ß£ÃOüþÀz°£ZYä~Gi«².Û¢oZr·¸Î¡+·lÔe<â5—ŒƒÉ¬³”kŽX:ùÇcðü–®Mβ”?ƒ¥k°ƒÌšÌí囨¡ ˜M V{ÕÒ2›å§í<¤œŠ3s™q4s™¥£™c_ Çê-o£–Žœ¥»×y`סޖíþ&¨àd|×0u:xÐ#ó¦ îÅóÄ5œ8΀ð­fçl-»íhe±c¶€®úÁfη‰k&´˜ø”’ü¬õ˜ß¦Œ>ÃïÔè¿›¸ÅÌï„ð~'¦~‡Î[ ›B¸„oÅ|L áþmaè1W3K¾VÕ}<¤|,Ú¶¸¢FâÏánàYN"2ƹx’»Ù |(‡©QýÌȲ˜#Ë0ÊŸS|VR*ÿ76%Pc3zãˆÍ˜ #Âømuó``g¹œÃõ;ÿLžèvmq‘™äþˆS ž/U›»à]:hß /›ìËúª¿ŽN J>ÔmáM¬;˜Ú]S¹iÇ@  0cÌ€™ŽF‘Yoiv?Š%™IÁ0?#ŠÛÑ$2# ZzÏñì輚Éq׃£'À}3‘σ§9IÂ!°Œ)yçÄz;S\Ôd@̹b:÷!ñÕÍí…Bp닺ÿ:&±¯J½â» .#G²óÈvæf¶›V&—E猚MW"ƒp;ßêëJߘ*¯ ö×aÎp¥}„ƦèJ¸£7&ø±Îaàºop¹;¢X9ì$3cÙVݦ-o‹zãHZîä4$§qrƒ9;zZtÔ3„wWÕôô·CÑUëïoôðßE R¸ç7eݸ}ØvYèížž^‡É ºÿ‰ Yý¡…ÉõƒW—uW5õ1ƒHgXÔÅŽ 8»æÇ2«Fn'´ßdÛ Ž?à] (Aä"‡#zâz=i!S.Û® ÄMv4xGT"h¦b€¹’6®­ÊÎ/µO ¨rĺcð™ùBÑN¤Ý;ØB%Ð̪]Lt áO.×ÇÿGÔ æ¦§  ·S²Í5¤Ê’¦ çÝéyÌYžŸZ  ¬µÈÙ6dM»­ÀÖJŠÎ}¦ÐåýËù6ô?pfès›ŒcÃ&³lNê} e›‚ßhK°òº[жbÓœéÈxÆ8‘´$%ÓÁŽQ b£5Mä±còf។m;„­9SUœé‘¹¤±Í…,AËeh!µŽåjÂ!’§ d["LƘJ&™åzŒ9ŠÌQÀ ° …ù£}Z¢ù´ÈL…¨ÏaŽê¬š„>«q8dä|;nÞBΛgĸ‘u7`yJ%¿”„ÇÞÖ`Ðmsè«Úû@ ÐÛ"ÜQB—¡×.ðß}°ú&¸ňójà`«c‚±—-îÍ×윗sçã ³Ö€ùýätc’æmÖ¯/L“õ¦¯šz‘`ÑÐK'?=*ê(Hæ†|s’•ýÔ¬ˆÈ1l ‹8AH²iΔs²‰N™á^'l9°Aá Áï&ZàmÐböƾ€v®0X›F5‚é#ÊX0E‘Ou¡ð ﮫ .~M]mùÛ¡jƒð^²çuÕìÛ…Ó ‚xZ«ÍsùéÉÉ!‹(¤DÚø Ó |^ÒS¥Ðîü!~¸b$4xøÀ3×’§I=° ¸i|'E8lLÝ;¦|‰zèiû+Ý9ê©Z›pâ8x[]8[p‚4=5|$ëºÊɰ òŸÐ ë–•<·åœ³·¡úÒ#Û"À2¾ÚÊ@ôH°ÿÚIƒ*<^ i†°ÿñèf~ÔéêÈ}½‰Æ6°ž1j=¥(’Y–òl%¬eú‰EÑʺ©ÄgE>¯ÜV—‚ËMCÛwHöÖBšPòhèn["õ©·‚Û®/\&ÍÉ6ÎQ ˆ!¦’^Š/¢y#ŒŒq<µ…ɦ“”ðô4>Ƀ+Y$4£Ã(k5DYgw¨¬¿Îï{jß];ÀƒÖb:Ë¿‰D• JÝ‘zQ=èÂÎÁ¬ŽÒJ=Ê¡Ë~F7n¬Š@ï§* ¹Ä7 !“oO r üS¨iyÕ*äu.ì Åjù‡ž-{¶ ¡rA¹ÄADò YÒ‚f! !.ÝP®ì7ƒ:©ƒÌÿ½%ŽymºèC3šVœñ‰C–!xýÙÀ’!¨g– ¿r=_±U-J£‡º«®êa_fÓ˜ä¡ûc*îè±}TÀŒ­=]&hÁ€7³³wqJô= áÇØh6Wÿ‘âDÝQˆ‘ù.;9V‰óS*çùƒôÔú‰¸¦÷$x[íèêë*Øã¯Ä=Dþ€{@× qÔl`t„Yªing‘m…ÑŸøè¢!CâçU5õór L‡v§>ºPQ­Ü†2ƒ/ÐL±6kà›ª¢¹bV/Òž7ML[!ÖD´ÐÓ¯a×s&êy7âºëæ°÷¥¾OáÁ¶©}‘*cØ× •D*NŽõ¼Û¢9ûÂwO7Ë} lùû¦¼í¯OX.öW}€p'÷C×ᓳFjPõ•+¢@¯£´uk%mòòw*v_ ûÊG`¨;mCR²¥;ga^÷IŽ·ÂåzÐ_ýKµ ±T{r¢1÷~z[Ò‘–пÙ,)v×·eqÓÄÖfô\Éä” ”Ô&:ºinnJGßñ+ÌímÛܺDÜE'iÓd_]ºO3¾Ä=äqfpTlݯ`Ί«¤dW~é*ðu¿Øë/_n÷nõöË.&öÿ¢…$6–ßÖWïHµcUz3ŒýÒWÐ —.þz¡tR\•xˆ¹N¾¹ÀrwJä¡XŠ‚–÷T&÷Ö ÝEtªP¥{bXÎö1«Ö» çí¯tá.þ¡+bNxÈ‚!·bFÌ?®?šM+Àþ‘>z¶#À.+jÂVìºvÕ•OÞB°‡~otOã#‹rãÍ1Ç>žw4Š˜ :š”ït9ë½·d¤fÊàœ¢ÄÏJf3õù-…Øœ©|عxukÃLËL&¯¯È‡>Öå]¼T.YžA¡ª»¾,¶ç)F3µ‡Ã4E $oSŸ™T…í¨ ·5ËÑ7©ÓûîkÚ`l»ý07~Ö–Þ¤éÇЇ‚Î-ɼ£ÈBº†XTôóhPÇÔ1¡zí?aNËn·ˆN€OxàÍÁO*wOâ¦EÝW 7åV3mÍspSœJ¢š9 ÜŽ}·ªëÇvïÜTZs&õ"óywWõ¡'B.Ìè±h…Âõá÷qüÉ ÝùDž¹¯‚Q– .U˜J)¨n KŒßKHFwõTŸOëR(ÈÎkEÑ!óI4 ïàs*JõE®]v¶Q»@ÙÆâô¼(L\ôXµK)òœŸYýØÏð´÷u½ø^(î⃇ª]^«Š+j7I]c¤²zú£F=ÿh?YºÌ)äÛйšEº³ÈíéŸ÷Eð3îîp…aÜ{žc$œ¤kƒ8È÷Œ†`qS)nž¯°vÆ7#ü“ŠÖ0¼qn{j:ãPiøQgÊ8êp9Du\ŸåþùÔýs™¼¢`èf_Ö˜;êv`׿&@Ïà¶ô¨ü«áJ˜ Ò8&fž¤°GŽ|¬HEã"ÜQDÀ(ñ¶3DZ†ÛŽŽ7ão.Å,G›Î䨰ôÌ1è@OÈT¤ç‹³gÎT€²é|‘éLÌg–ûÊð›”< ?þ á= endstream endobj 2614 0 obj << /Length 3307 /Filter /FlateDecode >> stream xÚ½Zmܶþî_±ýÔÝÀK‹¤HJþ–¶‰‘ 0RçŒH‚«nW·«fWÚêÅÎýûÎpHIÔI¾³ïpKQ93œyæ…ä«þøÊˆ•I$K¤YíÎ/"Û[VÔx÷æwã¶0p;ù·«¯¾UjÅ#–F)_]ÝŽ§ºÚ¯~^ÿý˜]Ú¼Þl¥”kýz³cµ~ß庺²¸­ê3=ÔY¹¯\»Ü³îΑ¬o6[øï'9äe^gmU7›-×ʨµˆøæ×«ï_|sÕSª„b*–d˾ϛ^qÎR¥„çMh©˜x+Êvƒß]}ÝÕåáºÎ›¼mº¤çÕ·:‹†Ç’)©`Iûõ/‘Šh˜JÇÃb&€7èýÛ÷ïP Û{Èì÷|¨Y*èÃýޏÕcn%¨H=·oßÿðìL`>Îý(»a몠°v gøÛÓõžÁZ‰`x±Ïo³îÔÒâì0A~å­<œ ¬Ë‘_ lÐP÷®²,êáÝX?¬DAée*ÞHeP|h¸[(Ù`KPÙ ¹Á6¶¸QÉóÂèG?Weþûb„Þ7MžE¨qÄ”V+•‚3‚Ðá)Bc¦#n§Š£gªyX¨Z€¯~œž.ŠÕU鳈UC0²H@†ÉÓĪ"–c§ž¯?RW'Á·ŠDòT¿.³Su¨º†d !ÖL€h"І^E‡Ìgˆk•€=žðäf¦„0Ü$33öžh2£‚¦ù’È|.GðN èª!ÄüÔ”ÛXê! ÎÀÄdnˆ^µù82àös‹ˆ”I¹@÷Âô<‚('LÓapÊu¶³ ÈÂJú¥(;¥ŒÃ½‚Œ]éõs?¶k`+í ônw×3vùà(À` œSO À+‡¬Å.¯py›:úh= …OŸŒS£euY”‡×s+@X£‡ŒçêòÃL0]ï²Ó©Áf²nŽUwÚS·«YÐ b»?íÑW»·YC=Eë~Ë_"®:Ȇr¤¿„†e$wËÀ‚4p”#aÿHênÆö˜ù„‡È3ž£%!H"›ìœù#õ âlÿB¢1 ÔÐ’ ñG‘:(ùñ;—íUô»ƒÔªÍ©ÑO™¤†[ Z¸”¤83›†™¬±vEÙiÕ»ÉÌn™„BI·e†ßvå®-*LÛñ‘¤  õ®+ÔÎÅÞj+¼²ÔÃïMWØDGÓØyÿ Á¢Ñ‰Ä:2?7Q©ŽƒSÅѨ0Cd„&†LÙTÙÈ×H‡‹]wÊj"à$¯à]IfÅÙ…èËoI´¶Qè½ò¼'æðx[û/štïðƒ#Ú’xýí&‘k?°©¬fAëTÜÔY] :ã£URÛÚUûfEI%hÛ×9FÜôEBi¸õù§â· Ù$öʱ~óÓÖKúÞÚ È|£¡úF¾+@z¶ÇÚüKZ>g6 ¼»j5½‡ætª¿ìbœ$Naу-} =IÙ‘YÒïH!¨ì³•1‡ÀZþ¬ÀÊVõœBÓW`¿ÊŠžËÜêâ¬~iÁ¬<äýÇÔX“ÐE'jd“Á'˜H# S% ‰À 5Æ&êÈÇ“>ðì5þõ‰xϰÜüaÌŠS6”Þ ËÁåͺ(ëÀƒ’œýÒ8¾_cƒùîpµª£‡£[© ´3ú ,žÉ>îè̽-@»·cmÁ-ÔÆ¥u´#vVUpt›OíuÑæ¾™].Þ´,÷=kcæxâºéz°)aM¹BŒÅ…ðŸ9Ûàx Ó{Ó¦Þ½r篼‰°Ù`’Cr›¦½£ÿ+­a‹­ðëxAJ2·|~†í¤&Õ“Hð§G?¬’QXvš[úfï¾~ëR2V ¬Q€‡ô¢iµ ºúª¬ül¡0 K„hB×TqŸ&ô(1Ig Ä‚ÿáɾêœNOg“ÊîíçL6›¢¤ ‡úÍΗSnkº3KBFgt SÌ iØ"’39”ÖS0‡Af“ó7å%IÒIRMã±Òß;×XHK{1‰k ‹dŸLYO0,>Ø:®KzïÁ_ªñÙ¢eܱžZãiMÕµE™¿œ#QPAü#INТê #“Œ!Nù¤"0sqmåí³¡Ž¬>tgwàº>!ˆD|v5Ó¦§pG‡B8æcõsj."tnR{œÎxdÎd¸ —m¤ÔG¥sÚšBhm¹¥š%Q¯¥”qHÛM…Ÿ}é…̇3ìlmZvñI vÝÎ-9Dà£Âñe6ŽìwÍB"̇„T[Ϻ">Úã)±Á ¾±ž;NMåf°Pÿ†gp2YíZ2MÌ(àg—5ŸÏÅáè×’rHÒìs¾Ë›†ïHu2›8èqZÙXu¾€gq9šS7K %‘^jšÅ Zp•ƒÂù!bFgò)…Кé¡Êû°‹›]¼ ìépÒë¬=‚DbÏN6™Ý¡»û6älÁ%¾ø1亳á0WLkýˆƒE÷£–TPưrì’ª%L½/˜TVu›•íë…Â=Ì—ßæ/]ãí$>QÄ…“ÙáϔߙjSfd²^Q:G %>¶¤tŒø¸Öº_ë€A¤EØÙü€)qÞ¿sãÛ¬ùºí X°^{ɧaÿ¤v¹ÀQâˆ]§"Lôˆò!™D $´C=,‹ÍŠÏô<¹[’,Ü-ñ2묵gÒö ‚‹š<öìdk$üÁâHéÝÖùl$ÁEÌLp˜óÅÇa2¶—(<7OÕê~v¹Œ"> *Œû$ÝÕ0]¿‡‚Ï[ƒ©`ly˜GYEU±G×Zasãx(Ü! ±’~¨5À(> µV%}­Uy, kç6‰bĹ¥»@RеÄ0#Ô²–ÌQg·÷dúŠ8¶³²Wã&¨LD<»ü÷¢!ü”:¬Åija4©+ ¤ë3ôÑ]°½t‡†÷q•/ľÈÙ°ï8’à¿¥»5ÜV `ØeÀQ=TX­²ÏÔæìÊ Uah»G˜1ͤ 8ÜUŸ¥RŠîK)UY°ÿ´9î³r´b_M…mˆg‰ÛSÇ€  _ÍØÝ„ÅÜ/A.?=k\MôèDn$sY—+ð¸ò<úZ†íG°‡#öÞ-¹ Ûæª/:ܾ_˜œÐätLB8oÆ$Î;;i°â©?uÊëµ×3]guÝÍ:>ÈMlžáÈÜ…=èI‹Ô“Nle„åYµJc–þ·7çuÒ{nO-ÝÚ!/Ü ë(Š .ž^º¥Æ[7I€4´C‹¤Sà?K ç%1J%ªùÚRÊbÕkì¿gó!Ø=ó¥WiöÅy6(,ÖjÂãB`¢ñìkržþ“­åDzì<áÉ‚übÈlÍÚ(gB˜…”[ëtÊÿ¤2Êô  aÚS^±ç´4oà­À½«¯jÈ]øÃ´}, í™Z4‚kÔcµUäHÀíO^‹"6¥òÅÛÄ¢Ä$ñîmJŸºcq†júýÝM„ˆÿi¡© endstream endobj 2629 0 obj << /Length 2337 /Filter /FlateDecode >> stream xÚÝZ[sÛ6~÷¯Ðô%T¦B‰+}ÛvšìtšlëØOIÆ¥%Êf"‘Z^ìõþú=o2%Ë•â‡Lfd<Îí;ç: áDliN4&óõYhï778{F½Ü g=ÉŸ/Î~z#儆Ą†N.–ý©.“ ÙtÆ ×*¸|IÎÿù~:㜗eRàHïâlÊtPÇ«éç‹ßÎ~½h—“L)øº5ÒTJ‰‘’5 2EB)œ‚iVMñÝ Îêâª.²›«2©®Ê‡lŽúüôF…}û¨àDr KÚ·?…2tbÒôÅa ŠÃÏÛþÓ*Ì$'”FV¦ ªûñs8YÀÃß&!ÑäÞJ®'œ°'[M>œýém¬ÆdD(40ìòüýÛ×Þ„#¡h-@‹Ç,oÒP5R?º¨ÝMYä锋1çððâÖjhŠz‰]‘*‹Ñ] j"tkï&[ž.^;‹ÊéŒWÉØ*RMõÖ*Ô¯2Èü(¡Q4™Q¬¤îIåZÖÙ¼JóÌ%ýVÌ=¾ÔëM A°b©C•»«ØI,’O!Y²ð:W¨¬¢ÉŸ(è¤P3âUøsFhÐ`ð÷‰¼O’ÅËä½Òš£O‘÷8U¤øw–÷Iµ+ 3ˆÅ©©ô#¾ Éa4P=Ìß:+Ó›¬UcèP(¸´}•ccFíR[…„2q–¨ |s–°Øeíè&É’"®`#.¡"껹— ” jú1M— (!î¦RqºŠ¯WÉÜéˆ(}ðâ¬J_xâ Šžx0gô»Þ®`œxýš?¦Ø8(w©Ç  v–kö<|ݧÕ5½u×Õmâ«R¸Q¥ó¦1Q߸çùòX2©û±ÜK¶•Q)ŸF%úTu*‹~Çai€°g¥Þ.X˜HhbÔ9–ЍªŽ†ây*ÕA¨”ã¨<’üpHî §6duö»¤XÏ$Ö²–ýyHqÈÂt™k/g‹|í¸½Ò¯ac¥·z\ú*š`ƒá‘‹Ê(Ä©Ñßø`ñeÁ·ÜìŽÄ €ïow¼Ã™å"Xä=¤ã‘ ÀžCN¿ D"˜ö˜9î$X˜bxb`6T§Œ(|H×›Â=’¸æà¸¤XÆskimŠdÃEK‹alßZ ¿@‹á7ño´´¸3-Å ¡L{¯6jt›òV ônî¹6" ìW+(dÖÑGÉ»"Ñs6ÔÙåß"¯¯WC²ž½C Ø _ÛMÉ®¬ £B¶  îƒE_w‰2øè2‡<bYÅ` J·P™¯½×uºZÌÒlËHÑ+É©7»Ây¬¹QücÌ^`ÝžÈÙgc䯤 t'öû«_çõô·™‚Ìrƒs˜ÁK]L5„»Çý‘m]HF-wúƒÝÍáBgö2-o3ùw°5.ڸݵïi¼zÂ:¼I]|i€xƒ8Û2í]n“5/’g[±.«Åé­ý:ùÃè¢$bQ#ñ.ÍÒµ›š*06.c3ëhï¤6Ÿ-ºúžýÇqñuÛ™éj•†L"aï:Hý÷y•ÎñÄiˆŠcD¢Ä%láŸT·È›˜ÒÈʇ¦_Ä죸HÜ`ã ü]º@\ØG¥{%v—K`_×±=µûêï`¾øùè<.“æV³x–»¿¶ÍòåÌYÖ`ºGaš™ãnTõê3\´õÆãÇð o^cLÈ ™Î7x¤¿ýQ˜3N4,†pÜžbÃfžAwŸàûuxx§ÿ™¸yÖ›`ä;öö2¾ë6½4UDºÁǶ–ÀE¿–¼ò6ý5žÚP¥»Ä=Ïn<§KqJdG¬^¹X<„ [ü}•^qñðÙÓªM|ã«# Õ¶')Ë­šSÖŸ×FÜf™ïßjÏGðÆ6×ïÓàŽõ{¬Ä+b°œõIù§0 Çë‹­™ýÛ}Éèôî\F yÌôWqQÄO/¢þæ";‚‹ÿY«ûÄò±©HŸG1@¬B~œµ½oI[š˜~—}BJÂøq.Y½ù? l¬„ endstream endobj 2641 0 obj << /Length 2013 /Filter /FlateDecode >> stream xÚ½X[Û6~ϯ0Їʃˆ)R—´X Û4ÓY$Ó`ƃ>4‹YY¢mmdÉÐeœ`ÿ|ÏáE–¹3Ý$M€1)‘‡çú¢3þÓYÈfaä“Ègéî™§žÖ›™Ü\>£f ÝÁÊ.Ÿ-^ 1£‰½˜Î–롨e6ûÝùi›ì[YÏ]ß÷àÅÜå\8wM^nô£®Ì×U½Ó“:)³ÊŒË9 n7g‘³š»ð× ÙÈRÖI[ÕÍÜ¥…Ã<þï忞ý¼ì5LÁý'šeWf[¶ùÄã¬m, žàÚ¶×ó˜ƒi›W%èšÔr-kY¦õ×3JI,ÃíÞÌe> Y¤wß]ßÝÜßÝ\_^ÌQÔÕ÷]]nî×UžÝ—ò ¥ÞÐÁ4<iJÊ{Oxæ°x¸ŒÆ™]”UݪSÒ|A¨`IØ…‘3²-&¸Ô¬è0Ž“§QâGÃÓè¹#Â#a>`€K.t`ÜvN¤´IÑhxÊ9›|»è¹–lšÔÝ#¾ç¹§à J¨Ïg.dze-Ù~k%è³'zlàµQyƒÒ F{ªw¼M>àOãN¢ÅÔÖ£ XÎeÚêPñzè}Ië§í61 Óªlò¦mô²j=ØVˆæÌõ± q[RS>òDŸÈÓ±•,Ä¡]Fp Ä-ŠHHЀ0¨lõîjmU†º×ªä°jJ…€“¸W`ö{±q]3@—`JDØ-×woÞœ,xŸ&ë£Çò—gÆÍõ¦ÛÉ#Û- ñŸ:•‹=EÄ b-¼ƒáfÎU9÷!íd½NR©ñ±­ôïåí=8Â?¢§…«½ÿð²þ*ø‡øŸ°ÏC¥eF—+­½U±@©Àn•Éø W'*#¨S™©ÚŽM(TM(TZà‹aÂù6ÕvW/úòúNv›æR54,Áü½GyªW¼ÉWuRÒ,mð ÖÑû^Uªõ¥®JAo„}l“"r;4UW+§Ã8ÕB23UU¿íVe*Œ «NìÃe?Ì…p’¼HV ·ª5÷¶ž´\?ÝÂx&â˜pFUË%Þ,%ˆ‰ê½ã'Ã&l÷»š`ã£|±mÛ=p æ9 û—ÎápP3¢f›²ëg©j Œª•ܵn V°Ú¬êÅTë3DºMS,N ¹B Aæ?Æ4ÌZ÷¸x‚C1p)cZªd‹'?ÉõØäzl2uÝáÅ«º¦Õ3C°ô$­vû¼ÙHªœ…ܼ¼Ö“N³¸Á¸¹ÄìÞtµy3‘l¦Ë#H†e]÷·[è.Ÿsáó¨‘ þŸ*{>j`Y&w®«6O ®[Š:ß`¼Û&±:ÁoïœäeÓB;‘™^l`*ÖAeQ¿îÊÝ1a( 2Ú-ÀIë\¹h”ÀõS m\”Âeœx6=~©(!—HK ÐÞ5òL†$ð ‘ým+¥6¦84ø£“ÌÂGÿ™2”G‚¤íÛk‰ VSZˆÙNi‡Äz‚ó½–~ÌNœátI‹.SÑК]Íë´ª¡©îÕhd½1?éÌÍB>7Žmâ2*ðœHbØ`UšØÔÁ¶˜e'M³ÈËÉ– ]12Åjrø;£¾fü?~æ¡Lr®Sôo!ï* ÐêfôܤÒ$íPcLäÈ»6²&;*i\~°ebÈ2íÚdU˜y²I°ôªÉàC± ô”3µêC5“ü{Ë®¨ q<…mZñ¢Pö°ð”ÆSwUׂûKY̆¦Û›$¨[™X'Ÿ`¦Šƒä´5‚,ÕlñÐOû# pĆDóQ˜àÄâq¼ß{ž7Y)‚G¶~¼ù5Énß_ÔÆÒÍOãèKÄß'u|úv‡H™=.<üÿ„/J__õu-ó} ª8€3ðÞO˜ á­æÊî~É?-âbÑS;ð€Žx ø…Ê:xˆŠ<â—‹9uþTÀ7Óð»|ɵ^_2^^ßßÞ½{÷ëÍòö;ëߪÓXþR5®Ïôd—|æ9^¡Ô 2(ÜÃ"8è91NràÀÐ~ÝV¨ð _µÀ‰½Ýà¸ìv+Y7Èò=þ”8âÕ KOÛ],€Þ µ@}a ì ªº¼»”ž÷¸äe¥ í³þ˜t᧪3¾T½Eé’<˜—X˜.¥›2çx&żr “Šýõè‰Ïžè—_×Ö‚®näI@‡Lëk kÝ+i^~ÀNã¾Ûõ¢8ó öiê¨SÆÙúU+‚α“®†´C—«q‡L2i’{ áÇ”¤a$þ$q&9Œ¡.OZ{ÊwÎ)ýõ½Â Ç+[ y‰„ß[í¯Sþ§Â]“òñ %…QÈ‹ü%Îë5/ªj¯GIëä£<ü<…FŸgÕ†§²yQ˜XUEv’ÝŸcÊÜ ý. ·2_É´HêÓRi·µœH‘j…îTbpžëêkö««Ûåñ|–7mýƒñ=X=ÌWþbq”>wã8<ëJò»—7:.ö ŠUèkÅ£d'[›ÈV&¥â,D+©—?_[©€ì§R_%ÏIÅÏÅj2µ endstream endobj 2543 0 obj << /Type /ObjStm /N 100 /First 967 /Length 1607 /Filter /FlateDecode >> stream xÚåYMo7½ëWðØÊåÇpHF€¤©ƒMØÐÖðAqT%h"’ §ÿ¾o¸R¬XJ—Úµ’C¶gµOóÅ7Ã!íYe” äÉ_ŸT²ò”MYÙÌÊeRL¬¼'yAÊÇ"$E@ÛU ¯8’¹DTÌ"§br€By‡TvQ^X•¹¬¬MHPiƒ¸à‚Í"±QÖq‚n†‹N8GV$ŽRÁyeÙ@UÆËèÄ)h‹Å˜±É Ÿ%’˜ %±*™ÖBVÎyÑzj”G[$䆃xñ+Y@œ“ ¾ycÊ;‰Š”•o£‰xëR€d“Ƿ2í‹i$Ny.òË¡ø” e‘’ŸÚ·ø,Û,4ç Räs.’Å"ú Y–³ä${EÖÉ’bɲ؅Rr%X^r%XFr%YÖIdPJ¾¬^Ill 9ˆ 6ÐÇò]6xË©HÐ] ú"³HЗÚïB_o[ !@‚ÏYòÍF¤’`,k0ÙÁ† *à ± X‘@8‹”Tð¶èË$ì@C2¢Aƒ­¢Ï9HH»^‚^$‚Äp7HМ0ŸAsŒ¢‰@^å0Ž˜Kq(¸#áz¡º)’…T’•å’Hö  ¨.‰dPKF{†D¼!¥6¼xŒZd!`Iq,"Ëe­‚ЦX@ÕFëÂèädÔSÍïü©À¸ÈY#˳›wï®F}g– ý x:Ÿ­ÔɉjNa0µøÓ ¼°ë©K §×¯²»ø^RñYv+›rO2¢“¯š¬%SU%ÒÈþb‡¶~ƒÁ ƒ§¼aà¤MwK*“ý&]0†].E?œK­[er^ f#Øÿƒo_ X²:Ëa Z ³_Ðrà°Éi̽W÷hªîèöòì—ö×woV«?6Ír5^½¯ÞèÛ=¾ÖãUóa1›6ÛT¬ð±!i™Ç¬sÚa³\ž¿¾/ŽBëÀÚ!2Hø-Ƴ×ó÷>éå«éÚ§ÝñÞhÂÖ$ ¹Ÿ–Ê”çaéYÎÿZÝ‚}ÍÙlz¾ZLÆï—=V¤‘ó› ¬‡Py8®[¥ÅDªëY¸Ãæ©í~³ÕGzwŽdötŽ4¸sD·nÉÜp¦Õ³n4QgmCºh“NÁ²º···z:»ÑóÅôn]§Ëw=x†ƒ»6¹í GSžÜ›–6•§¾{8‹æÓc7;¹ÉáÐÓáööxì-íhÓa-³3ñ%®Kì‘qŒOî®:¨O-“b7ÅÁº±Ëú }4:§ ÓÞ°ö!v‘¦P¡Qš¹ 5éñÚáÈz¤[ŽÏÛðÝt×—Ôlv«rI6ÔrƒWCÂû8ÎQËåV70€„DÝÀàIGﻄÖnj4zÂoB7С[»Xj-CëÑ8óD±´K”ö¼9ˆ(Ö×¥'Ž™Ë\ÿÿJŸ¤ºÎ1Ž;@‹ÈÄðU(ú·3ìvï6ÙÅ^lÝš!Ù­rO?ôJÃy䦟¢¶[çl(ÚØ´÷JãåÙoÏ~ÀÏùÅÙÏŸq`¬²/«ï=ø„ƒ\8åRÙ ÇMº¸ºËÜÞ8k´Ü äÑî©h²vÙuqnÐ;b7PvS %ÒŽcëîdGš%îNq½kŽvoDÙçÁ5·¾æ*ÿ›:øZ‡=x“a3ó§"cSž¿Ñ¹-$)}FÃÓÙˆsåñ(Ç6ù'_UÁÝÇ9Ò¼]pÿÚ´y‚ endstream endobj 2649 0 obj << /Length 1914 /Filter /FlateDecode >> stream xÚ­XûoÛ6þ=…×a˜œÖ´H‰zô1 ëÒ C`y`Ú"•e:a+K™D× †ýï»#©§å6C·3Eß}¼C'.ü£“MÂÈ#‘NÒõ«gË뉜P+7ÁYGò狃ùKÎ'Ô%±ÓÉŪ«êb9yã0ןÎXìEsyzIΞŸNgžç9—•(qä;¯“|Ê"g“dÓw¿]4ÇqÆ ÷½{b«¥wzt‘8|ÄG+£>à ˆË}r~8ÅíÎ/"Í’R˜bñA¤ª2«¢4ƒM.a¼6e’/ ;Î7ë…°B×"e¢Š²"`crçpŽÆÐœïÔœ Œœ]]žOaš»Îá¦Ì¯Ÿ_(©AõNl40ëÂàBíw|zi穹’+™šï¹(“òÎj̳»Ç'ˆ\wêZáë䣥*é¢ù&ˆþÞw2Òc6<«•oÊ+œ½º®²«\lß8Ä©µ¢qì…0EŸŒi“+£÷t4[Õ§—''¸Õ|‰ÏRµÒG¼º¸zùüÕÉåÙQOýï/J‘¨>Q£·h-ªdDÝHë}ÆE8ÛçGKY©r—=}•ûI†°[Ù¡Û˜4ÎÐm2¢U-Ëši}Àîn{Y(\ ¥ï§=tÚÓ[Î÷¢vÈ\*Ôšîu·­’«ÕQwÏ»í9bKïªbœ‹1g8-¶fpWlÌ MòúæE}ïâ«nòÖ~´â…ù­’õmfw®JŒ2Ê÷fžOs–†/%‹Ü¡stM0ÄñÞxl‚ ÏÜ'æK>¥ÍðáÃ6ˆþÖ:bâSÞ×óy÷’5Wi‘+{‡ûüì¶”¹Z¡ÐƒVo©çç}n…g#çýÓ»"6,ÀDq7R$t\¡v‚Q˜]ŸÑ¹ª–¶1ð gÄ+Ï/_¼8:?ØæmÓ›jkD¾´–؈X'1ºíµ|¹l̾å¿/%­ïE?¶ ó4Û,­c>­ÔRäæ§îw%3¹ŠÖ!W}>r9æ›>;îõg³ëM¥jz“E6ŒÛãó“~h–›|˜ÒÅgíàßi‡5^»×sú®ÚŠ6cJtsÏLZÔ„4á™lT±nªuz#ÒXŸ‹¾{Õûà[g¿]þ7ß™¿ ¡Ëôˆ m&vq3‘h2óBm ÷rûb)æ/è¹ ñ•b%J‘§Â(àô~$朡ìqâEÃFìpO_atn·Õ¥%4öA—Ö¡Kœ9*îŠù„ù¬‚|®c”õAˆµbu £înÅa[-ñs‰7¢$Ô"éõæÐn‡$Šá®à²úÕ€o8 ˆ+3LPï§)8Q‚³™É¸¢ÝfðÄcà÷ðDœÐ¼€RýÄ#Ö Ôá”é·^¦ûè«÷Ï: Ì«´ç‰Ãc´-7JÝ>žÏ·Û-¹Î7¤(¯çU±R[xÎ!çC¬>„«ö±îŽÖÒ»Èú7Pª‘‘±”ÆF£ÏIÀù=2×­*÷%/æ¡Ì»Oòò:Y©æä¯ö£˜D4œ€‹ F+ß¼s'KX缓­\O<ÂBT•MÎ~³TôÎb1¼ÛáIŽš|n‹ Xr8š/}…Q7¸G­ä„ºÁWó"ã! Þwõs¹–>€|F±’$8ÎH4ôì)ƒlç‚ "è·~©>*3“˜ “l iòŸháèÕÄ|vò Îö’¸³:K¡æœ]èl6f¼€^ðŽ!uQJ²¬HÑaê µWYcì“8trÂ|0Z3XH@è>%ƒuJêÕ‰0t6t0êŒS”fm)T"³ªŽ«¨ol€—c2 a22JO %Ó)§ãuƒ!oPÂ+ &ÈÿvÄBj*G¨ï?«ÍBeÂLé+×2k{·¥2)\%9϶.f þ8B¡y[]¬u!P*+¤kÓE ³–Â=áߟ|æ;¿ß˜ ¢ÖcLÑ2öô®[{Qà|˜"P•Й<—iÛ<×sRýw¥™´¾¤’Ñ^Àõ¡³ÿ+.„eÛ;AðˆíÎÍÁ% ”þ› žå§uÄÁµÆÞ„Ni ‹ò£&dzäh˜Ë ÌôyÀó\ÍX]œm¨ytjž¹yoØÁÉš\g'¤PãÂQvzI|@Ásüøœ[~ð¸?oŽ5ùÎ|4DXëc—„~8°~¥„ ¢Qäæáx8Dù²~ã>ZßÙÏñ4Á¡8‡´k©ëÌ¿l¨²÷ endstream endobj 2658 0 obj << /Length 2581 /Filter /FlateDecode >> stream xÚÝYëÛÆÿî¿B@?˜*Ì=îrù2Š©›¸)'9ß¡êÂ¥¤•ŽŽDÊ|D¾þõÇ._Ç‹í A‹â€ã>ggfg~;3’«þä*Q«$ E&«íéI@£õaÅë—O¤]çÃB´òO7O®¾‰¢• Ddru³“ºÙ­þËÏ­©×~†^ü|íky·MQx¨+‹}UŸ¸Sç宲ír­¯;­UêmÖ>üwD¦4uÞVu³öe%‘§‚hý›¿>ùú¦ç4R‘ˆtø™b¹ÕdK@6-B+'›ŠEi–-áÚbå}[®Cé˜û|k€Kà©­øûòÍ+nŒÙÆ>HÍ]Þ~/:Œœá#½ª`ª Ê6Ws°òe&¤J™`4Ô3 Ò”Piâµwv`Ìö‰\1e§€P>2€Tíú·AäǦâÞ6?ÍŽ +¼« wvE³­Í9/·÷ˆ7¼¨1mô¤å¤†ƒAH’*2’,±NJ|}Ë7ÛÂ0âm õZz[œˆ½WŦÎë{^…œ‚ÞñÁ#&®½mw2,SÞUÉs 77šª«ÝõmyÃÎv«=ÓÞöúŽãÝ`Ž´^GÐ*Žùæh&R±PNرµf‰HÒt§ˆUDÆ*"˜Aÿ¤"«ŽŒÍ×n÷GûÙ3ã±ÉÌ!fîÚöüüêêr¹ˆCÙ‰ª>\5Õ¾½äµ¹:4Ç«9£*•`þÙ„ÓÇÝÊ­~ÈØÄ–çD‰3Aª#×B‚ê|‰TÆà·4{çÁsH:œº1ε‡e“Ð@(Ý¿/ðò6Î6',ÆFº·8÷ÜÞŸå ûØ]:Cjµ¨¿ùg.›kŠC š_8Àû;SzQ¶|Ø®8- ¬C‘…ÑHb¹ø`$@q4y×¾ËZó#ªÓ˜q/òÞ›mË„:ç_8eqÔÆ¼jœ=M¶ß¤% jã°lbAg!´!ûqÂôÏÂaˆ{½R¶@çñãÉ‹oQMÕSÆ8o2Ä?2HŽ’%ȯ8 ¤H“xzE6éJmÒ—–™Ë¸8ÉZ¢œ4íM•L©OðV–BZŒÏ¢1˜àA,86&ûi‘AËtX³Å5wUƒÁöûkãnniî $©…²v¯L¹;>µ5ƒscº]5©ÿ‘î´&ðßÔ¤4@ì8SôÞgzöf5ÅѼcT+ÂgK:*´è‚-Ë6w‹ÙŽéà¡çºÏþ¦êŒ@_r“)§š²Ô õ¾mù¤sÍ}±3–¡œ?6Æ¿çæÓæcAöŽý ÎæøàÛ”ª+Åð‹ñ·$!Õ‰t½)Zb„}:›Ÿ#U¦š#G Ø>™¼¤á„/ù;}V(rq`I¸s¡ÎOãHžfò:߇SzI€ø›â~]í±(} `Þ•"Je^Pþ¾3&¡å^±IíÔfO÷6æß¢` ›®8Ú”‚«e!ÇxìËà™Öó<†3ét\(KmÝ!I]Msp¬³ýŒ÷iŽ•M7vn™Ý’Ô%¼ ¶Wù†[È…ÎܤZÇxUWÖŒš¢‘áR^ê½ÉÿÚtõ{ˆÞ_AúXù3úVª ¾¾µ5KW5T‰ö Ì/N£;ÇYÇ·_9ÇG'€x‡œ÷7–à´vfBöŽ•â|£P€É¬”TäÙ_Šïn¿?"°€ïócÆEæÍA²öN\:‘oEÞ^!\=V‰sú•ø|ÍeY*²ÄþÊPÙßÐ&y½µ֖̋/òvÎ¥Ì$ä躧ú¥útûý}Îë“_*Íæ`UúðÞ%\H<áóqmºÕ¹šÖ'fDÇXk‘¤j¡J¡Õƒ2™VE-éPKz?€)_#ôa Wôˆ€ýÌÓ´ÜëQ7UYœª²8×WeqÊVð&§Úª,œíªŽ3—–.£x¬X ùZ¨ÃY­–*²½{p¹£øü<ƒGÉ•duÚ’¬Îl*‹C?Pe‡µÀ0%-¬x /ÂbgT Íí©2‹¿P™õ%HŸ%³`öSZH]³ì—‹´vÍ$IþÏÔhÉ@¸¬‰I>¿,` ó-L.×h1 Jk´x“ËEZ„b¨Ô?eòƒ±box"¡3*ÒRÏ1k˜×¡H› EZÁë¦EÚÜ1ž…&ÿµ*-«èÿªLû˜ÿjÄvù N«Ãÿ¹:í4ÆÝ„´H@zÏÝÃñoÃ/º endstream endobj 2669 0 obj << /Length 2945 /Filter /FlateDecode >> stream xÚµZëoÜÈ ÿž¿ÂE?D[DcÍC¯¤-¹\Š$86Zàî“wgwUk¥…ñ¹Eû·—RZI–ó¸ÞÁÀjfÄ™áòGÊò,€?y«³8Ñ"ÑñÙúð(p£õîŒ/I¦óÐQþåòÑù7ax&‘©<»ÜŽ—ºÜœ}ï© Zù*ÕIä]½½Ïß®|­µwÕØ[Æ{“•+•x]V¬~¼üÛ£—Ãv¡ EhôòÖSßc02c‘ÊøŒDbò‡ ps8L4¦•¡ˆ’–wT]ÙÕººÜ}h²Ã±°4cººÏS| Ëáÿ³ü‡¬®³»ßnk7L?Q O&=ýAd¨ž«0ô²¼È®ó•ôм]©Ø»#]nìtœx¶Ü44R•ô\#Õ¾j,÷ß]¼}I­-mµUý;ØB.ž2MEh>eôËNYÛÆ¶¿™ ·µe+ˆA†Z0Á-®¤ˆàW‹È(šôÍ*50sÝæN6qèÕvkk[®íiG)Ò0T¸Bàfk0g7®ÎŇ+ÞVhç#ŽøSÚ[>c0a;‰…‰Çªä­Ò1• ¶a¢uU6½¼& ©.× ‚õ>«™d ië¥ý)ÂTö—K–‹(N@ZÈPõ›ìÍ΂aE‘W]Ãf‘÷O»ni`[ÕÔ@¡4®œ‹hD$=ˆ A½€¥÷/Ü÷]ÍWÃ×ó/ö„f¼¸Â"†ƒŽù+Ü8œÅga"‚0hë8ü1Ïø}IŽôîPuci¾9Ûú!ð‰›Ð_‚UOw³[/‚G p8˜@ ž›!N7”ˆ¯9‚Pb=;Àšk@„[áYÀóS0=ÝL‚tU<„å뮥r~‚so¨•у\u•³C>14&„F“ðˆd¼fm[àÐù}è±_8¤5©ÐJOEÒŸ ÕÈô!™¦±Ð'0üŒ!—eÿ½ j`Šþzüìâ bªØë0>´…Cö”U¬-qJ°À阈l]F`ã˜3@Òo¾‘1MPÞ«r¥%Ê|›­-e[Nîð|ýøÅº»Ã×¶Æ´Çàv¼¿¼xñü 'f=²…¶[­Vá×:èŽéP”*—E¦f†š²ž‘‚Jør2¤JTŸ¼$Ò{—Ûº¶4ÊܺÀû˜)ZÎPµå Þ‹r÷¾Xbbæ(•{L«ŽQ’ãÇ%XÐpÁ¿+Úœ"Œ€EKoC¹—Û–YŘŽG:6G š7•Oa@¡¢YDàfH*NØ£qè)ô”7÷àÓãë)ó8Ò£¿¸çïåÛ+¿!í¬†Nõˆë4èîJ,ŽÓE#ˆ•c I¿Øb‰x4wAõ£Å? h›jÛÞfµ=ÜY³(üX™ »Ÿ>RßçðžðÇ‹ž@ø-Ø$™¦”ô»Ü’ƒ=Kʱûä'ß캧Ä>îýUÓÒ«Á`g]ŽyÞ`´QEÓ†|_u ŠÆ{®«ò‡@š]W[®]ˆ[3ç‹å‚l·\"8Ö ß¿ÍÛ½€É',ñ@œ‘*Ä4´Ð5Al~[µ9ÊÆè” YÔâ¡‘t°;H;.=vÔ=Oî:y T8 ÞAŽ ¨OËYÀéÊ2/mWÝé¹?nó^‚ó³ž “X,Ë@S­h\þ¶BtqKHã Ä R®šÅM0Êİ äß÷®>&½Ê±Éu2hÍl‡–¡ƒ†‹|ªø#ÎJ®ž÷êûEk¬«EcL›œl{§¢ˆci]t‡b‰Af™_¯+> ãærÃzÁ\ö™[ë_ %¢Yö aÇ\Xñ¤ÿÁù䡘 Õm(ÉÜlfõ‹"/í¢é'bvÙϧ  æÈëÏÀdZ/|öI¨…P²„ľJfßyè•7À¬w–ÛTÅK<¬›äå îyû3ĺ6ã"`a‹ÅíŒjÑ24¤p2ý¥ 9:-—Cö ‚Þ¢õR@ÇloP/[![tÚ«(U÷â¼›Õ߉ÎÙ¼¼zûêÔ*°êtãªNDBÀï#ÀIJãÂYCd>0•JrÈFEoÐt–dN¾ùÅ` ‹é@ ¾aðŒ'Q—%„SKӼ኷¦B*ž.BÀ$µ[pt º²Éw®Š‚®»¨PØB»ùþGjÿ‰ÿ–RvO¨­”ê›põú¦1¦o†aØ7£(êþól))<Ét*8ô‹ =å³ÏE1àD7°­ŠÂ…[´O÷=ëålU\ÈÏjžÐtG°5}qq‹ð'®«áó|ÿÁ• ¸àgÚf^ø§ïqÆ#Ì9õÓ¥oí¡û‹_á_">ÿ!?úuþã ù@;Dz endstream endobj 2676 0 obj << /Length 1919 /Filter /FlateDecode >> stream xÚµXY“Û6~÷¯Ð›©­B¿egcÇ[k'™ã)IÍB$1+‘ çß§€5œÄIvjª†`³Ñèóë†ä"„?¹È¢E–Ç"³Ey|µÝ-xqýî•´|+`\yœÿ¼}õÕ[¥2EXÈÅíÖu»Yü\íõ©7írÇq¾Y®’Dw]Uï˜4ÔÕ¶iüÒêzÓØu½Œ²`8.£¯T"͈'®¡Úû¡­w÷­éLϦÂWvÇJf"Ïâ¿&½6ŸûnXÿ±ü¿£ýð Ðu_½˜öÛÖæÏ gcÂI‘ÂÿLÄYΛÞ.‹v–}ÕÔvd­ÙšÖÔ¥9Ÿ(E¡T„BÚÚÍwï®ïï®?¾ûÇSË÷_½ëúÖè#DêÁÚúªG29È …ÊYXøl‰ˆ ]-SÙÔK©‰VQY=ú¡ÜëÖ)ÄzÌ)K¡ŠÄ;_Úó'U¾Še!ÂJÜ(•dîúX®Ae«Tð‹){&@ã"Ð5/·-Õ;|ý¾2mk˜úŸ×ß”Ã#Éj_wüý¿s‘ŽâD(™;u¯ëÝ ¹wNg%}o¼æ“ÕºÕíã21ëh%’³§'~›JÁñ·Êš§kV^·ëª§ƒ`+x/ …Šsë=ÞrGPì|&ÁA#ôe9ð»æÏœB‚±ô}oñÒ˜]5–dq“÷õRÕ¯ƒs ¼’‰P´«ìPñçñ©oŸMå8ƒ2ü¢TŽž à4UÎYGæÎV©Hòì³8‘".¦I|S«ƒ†L ÄLÖ©|4‡ŽO«{z „t-F ÖCϧTôŒ‚¡3S4?NÀ¦ª±¨‹Z¥ÎLѹ2•Ê.µe‡ßµ•Ùš´„$¡”9¨’©©ík<çñHõ|?†éþ þ÷†_0ÂϹZB2$j,$q†áDÄIjs0ME ù ØlˆT¤hP\RÄ2XWµaDïÀ;z=Ó°¹ÒÂó ¾>TýÞ⸛1{_mûnN_t@8¬Ä;oæHB4[|&p*:ìäê I×_ü×wn¾}ÿö–yˆ‡Ò š§ÁeZ,Ò½x&àë~ª ˆÑ”³›(•P^üÓéÀ@NÆŸ®¬åŒ*ÓNmcuê”T5?¼úµÔYú3ïyCòÍCè©Ôõ> °”¦apØp0¼Îå](ëh—_|"À/9fðíFŒFxEd¸@eC*ƒ¬~øpÅï]Eþš›7ÒöF¾¦ BÓîÍ\Jnß0•|1ºD9{~;S´2 rbà·~oeïHNíBp.dÿ:è®Z9£gä¢Áã¨ãU&ÖÖ‘ lh$–š°Å<3ÅÎOƦ§î]÷0'y9‰OŒ¾l˜ýùèÛ‹îË臥†×wy®ž ÄV9† Ð ŒÖüÀ>ëÉà€»²³üC«×†¿ tßšõbê E^+#ÍÈ {;³XÖIZ>×ç SŸ;?Ù—›¾*Q»ZØž\«¦¬¢Õe³ë,k㶸½øýÿÙ/C½1íᑦ'|·^KâI.$‘ïD+\·VhÙœ*òVB ‡xçr‘±Q—ö“úE:&×:l‹ô¬z"Ž Òt·í,Ÿ®«¡6µÈ<Ö& éCר žt½ã©!sûRß#~6Z¥Ýøí#ó' ’8YÛN3¶@.’Äb¼mÉ”©È»m‡†Ãa{O°IÐ6ØcÜ1õ»ádÃÜö®Çðµö°Hrr¥WöV". ÈÓ¾‹»¹ïÂj½of/‘0ÛFÅ´_ýÙ;dÇ}í¥î¿,þ^·­~|Ù[üË™ðX—/§º‡Kôc‡ƒÜ1Åý`°XÁªð'˜Vcù¼ÅS„[ÆùäN˜Æ8åoxE×<˜lŽ'ŸbÁ?ýʤíz¦–­MUÖ ‘J8í¼~¶ü—3 ²Y,r*؉<”Œ- NF¤cå=›»)Á­îÏDë¢aä‘Ãñz ¬Ðd[ØÉú¥9ti,qo,–9‚WæFH|_ãû#¯5Ü‹a dñr¥hÎê" #Æ0¼6Îc³“¥ç’|b‘›kÞC˜•DìÓuÿfÖ‘p Óß«©§&³i†IÛSq¥QÉOKÀR —Ú5 ä@®¶öIIާtiéðAéˆ~0¶;o˜a»DsxmP^v¨D%²4›äÓå凜Kw·8yšlÿÏ*¡Òøw±ðµ9\X'®@5;®Ð†]«Î®E2ºéNÏndÏ."ŸqÍ?×4x½‹â‹±Æ÷J'ܯݿ6 • endstream endobj 2681 0 obj << /Length 1003 /Filter /FlateDecode >> stream xÚ­VMoÛF½ëWðHåf¿wÙ[ 4ÄE]ù”C­$¶é”ÝüûÌì.)Ñfb- X£åpfÞ¼·3b …?–ž+ˆ&©Ž+êO»]Œ›«‹~98æž¿¬WoÞ*•0J Z°d½½ µÞ$RNm–óBXÞ^ß’›Ÿ¯³\‘Þö®CK¦ïË&ã6=•‡ìãúÝê×õ”NqE”¯¬mô~V ¡PáX ׄ* |›2=5ÕP· dTÚ¹­ë\S9¬ðé„1R(Åñušä\ÍXx0ÝÜÝÞ\_ýaèÔݺfwוͦ=öûz;Ü5î1ÄÒô²W\0"©‚˜>ÖŸTј²¸t“„,zN8öéó^Hp·&1”m,Bÿð‘&xø.¡DšäÑ{A¸Á`‡äÕï‘ÀY6!¡\úPò†¬a€0k‡ä„Ê Ág¾„˜aT^?F,"‘ŠfÙÿD*M83¯D‚Z6d’ƒX˜ŠüöÿQí…<,EÍ€Çè¿©Kz`–X^\ÈÅÔ³–3ÀSP;/ô}ù7&wP £iû ä¨Ò¿\5„ƒm‹·8z¬‡}8 R=| ç^²nÝÃåµi;" nèÉbSŒ&¦ jPOzg•½ê>D-CÂk\W†üp:ìËaþ ÇÀêCÅ„HÏj¡V´XÚnà ôÞ5=^ö Âi«žñ4<1ËG§ÅVbµ=úo5BÍí¬"4ê½l„˜Ö¹Þ¯ËXêù _Ã,=âÿO¾®‹q½àó!ã&a´ÝÄ¢ëKK"´@ƒ°8%¯Û¡®2ÅR÷Ó?ê¬ÜßÔL¶'”øRðxhãçÞ£s}p…ºê‡(dIõ¥ûE AŒ`/JN[LõA»å ×µÐ/’¦`˜L )»ˆ jïkä í· &Uç<ŸQ¿–èù>º¡DOg9RÉRoxŠ/’åZñt½÷û^ŠôX6õýéP5úïÂaÌɧ˜"^|<+}¬ ¥°/›ëÃA|OÀƒ`×¾ÔÍî \>:»vØM?þêÊ…•ìú’,­ÐœIÂ`tçF=‹¿êføþýgðÖâÅi<œßÜ£ü…= ;ÀÀnW°£ÿÛ–xCIñª=:iï4iï PÜ:êÅ!XA Wsu]9œJŽÑÀž¢%|Ç.–<«Á}Û»ÆgñgUáûv4Ëà¥2K1¿ÿ}tw.Le£t._85gÑaeOfú¥ú"®8¡–%Ê-ü$Ô¯˜Œéù8“Ü@F|à»r endstream endobj 2688 0 obj << /Length 2593 /Filter /FlateDecode >> stream xÚµYY“Ç~çWLèÅ3ÄNÑuõ¶#d8,Ñòk¢w¦w§MCw`¥ÐwfeV_ÛË#LÙU™Y_ž+Wü“«H­¢X‹XG«]ù p«ÍõН~x ™n „ÛåßÎ<úÞÚ• D$ru~5>ê|¿z³~zH]Öl¶Zëuôx³5Æ®_¿x-^}û‚ÿ‘_6isC“úŠ~ÛÍV®»´ÚÈõ>mö¸hÖû¼íšüòÔå°\WHc ¬« Ù\œÿýÁwç=§VY{ÿ¥Xžú–lÈ ×xÙT(œ¡lÑfkC½~ ܼ@~½P‘  [ˆ¥Ù ŠüÏU¬¶*6 é¶o‹îPŸ®›­²É:ïø·¥ßªö ¯›¼t,à¤K›ë¬;ƒ ðS‚^U¼æ­)n)m2M–î™0/EV¢ ™û¾Ëö¼QÑ/?«@a{©…´Äüùu/›íð&zÑc“µ|owX¡Í×ÙØpæEzYdS€Ö™eG\íûr†Û1mÒ2ôµÄ’4"1ø …öleÌÕ pš>ñ)5ý‚Ò<3nî/g °—»þw¶sˆ¥Å«º™’ß8¿± C&hËñóç}ÿu F‹Hõ„yû˜DY€¢„Ñ1í½ùíb¸JŠÄZ…€å)¨Ø¯õêݳç?Ÿ¿z¸A XŸªSóÎqünÂGŒù 0bzFÞ6àÛ’ »Bå‰öõ žï!7áÊ" BOè^¬]:OG"„¦;#õæ¥s•@áé«wã“§Ù \Žä‘K÷Ã}V„Ê2ªå¿“çÒ1<—ž‹N÷iÓ¤l‚c¯GzbD÷®0ÿ5[âHêD„ºˆÊ»À½_S‘@j%ÂÈ W{s¬ö° ö)à?:Êr¥…ŠPYÅêçÿd·>¹LEVèD»£ŒN¾LúC]ìó꺷ϩu¢Ý4`ÌÎå“¡n;B‚ï \s(ùN\ Œ†­Óxëôzek Ñç–È×Â7iY¦·­“VÍóî@¤-Ä.ô˜kþ´÷'$îƒS›-šu,ⱟ™–»ßY3:ÒáM$ýàñO–ÔºŸûlê»u€ÎÝ+°ëûPø/£í}v•žŠŽ&ƒƒ$rvª »ÕL ª޹ÎA™U4Í>‹|—wYq³‰õŸ ôŦ-ûÙÀkØ’¦oa”Þ[t‡&Ëh80 ™D¨BzVÜ¿•Dÿ`L¸nwiÁû.>à ¨»t¸©?¸d´~‰iH·ó øfoiš¶óNb.3AZ vWlÙMöá”7ÙžÑÜ¡îj˜fç!}9>°.óÎ…ÝIÈsášA^ò'o—#W3¼?œ@Áµ8e ïD±JØâq¨H‹#@Ë ÿB?ö ýòùiv™uS2ÉHg+í°=<|´ˆç‰â ´úæbòíoVüþdé»»íO¹Ãê\â&È{…>»CL½¨?\h¾^ôêÿ ý¼U_)è™?g.òH¬o{ÙhâeáÀ,aägŸ—d×uÓQîÜ=^òÏ!¤ºO%^¤Ý©I çHBËŽ$Ó®Ëã©sþ'-h/Ýí€tÇ”E^º,~ò3ж¹ÓîóÛm¬ô$MFⵌìÜ=Õ§b_ý ­?‘γPlƒÉ±©áܲ¥ÙGr$0¢¸‰ãXs—žÀ/ÆÒ$˜ÇRÜhøË¼QÊõ[© Æ{ç¨Ó”pYøé7tX“V×ü1œ¸ðΙ‹,6 ˜¿(„8Õ”¨ÎyiE+/ 2Xòr2T†ֿڿ–ÖŽsoiÏ$gpòGŒƒ5F §Wàä&Ï ®ñ˜;t-z|"€¢œBË gÏ+OïbŒv)¹pšå]`‘Y†1øf5}åIÀàI×Ç ë¬ÊÀžOÇœb‚^ +¤‚x¢& ©zp»P³ )eD¬zevð’-ä`å, óèéVÆp† §¢¼DŒ™,æÔ¸ªÐ'ÖƒKyöƒÚšÌH›˜Â-lSƒ–ƒó.Ç8¾£E—KÂïГ€ …V8ƒL† §~ʯøìAÙ0yïR¢cç¹Zòueî£6Ûhƒ^µyß?ŠOA5Kë+Ø[o2´}ˆFWe%yªe/eÍ}%å’Èî×M æRañ3´n嬳Cï— ßÞÀ u ¥Õ®8í3¦q©7ªºÚžªœ`ஂ£jS ÒäiçW "m¦Jó õi:g>œb#ˆ“_²ƒ'sIo¾g°µœîrX¹:U»¾w0*ZÄUÛå;O8Û¤B¡ÎèÔ·jŒ"æ÷UV¦Íû;z:*Ymfý‡«º(Ûñìo ‚ vÃÙûv‡Où Ù÷Å0é>övÖaÛ¤}¼„ä$:dØüôìûE¬³}q!"½Ì pFã|²jq!ò ^·gs(ÃK[÷Ò¿R ¹w²Ÿ–ÝpöhÑ" uAõJ'œŠ¹#òÓÿ›peÚ¶SÄ|±T21à6ûRøýbÉø±ÀûF†¥â'Û9;¯Ð2»ûÄ£è˜ÿêH¢#uŸRÅ­\¡554v^LLn@¦'CÔé-3?º:Ï% 7´]"$NmG³ÁM}‰ƒûÏ¡ftà•‘/QîÀéÈÜ'´1B }¢[m¼¾ûà²,-¾¡)É7.ª@¾å§„ô0™"ìéýæã5ʈÊ+t;ríª)·´92¬gý’§žEßL¢~ì¨KÇÒæ¸{KÇÖKàÓ¼ºO¦šk ›ô4fPÀ6âžËYy.`¥ûŸSÌ…~†-û¹v¼¨°1ü*l{Å_Óî’:!Ø$%m·œÅ"ÑñýýP3¸®%æ!•‹ÍÃ|¤D͘ïê‚Ú’Ûb«ÇíÏŤA™2ž¬€(Éá:Æ–ëÔFÝîV+.Ô¬x€9E\5-9JS<øŠ€*…¥ögtŸÑ( PXƒB@’D_£Q­#BVAˆRs8ج'_åË(8k=9ÈN±¹¥ª Ú5pXc×D=R¨Ò­Œf%Þ¦§æ’F.Ÿ3̦%® yÿ M¨Ï~NÑÀ@¨W „1¨¬¾F͘…á*ÁBÞÆí´Ð°ÂÄfTް€ŽÞ {UG¾ÔmzµÌ´V‹ij¯>Ò0Öc›î’XÊ]D¡ÚIÍ O±¨M4·¡iïíèˆ"1È–·“\ܰ}Óô±}!…û‹Üð‰ÅÌÑI{épÜ> stream xÚ•VKoÛ8¾çWøH—O=Ži›YìzÔÙK[rD;ÉätóïwÈ!ÉPêÌ!53œÇ73ä+?¾JÅ*Í$Ídºzxº`î´Û¯¸ýrÁ=_ Œñ„óÃæâÏZ¯8£9Ëùj³›ªÚ”«oDpÅ"—YBîÖwôöjÅRJr×›ÎRŠü]4‘Èȱ¨£›?/®7ãuZhª•|§mûŒ\ä43Ê´B¯¢XÉŒ”f(ªÚ”¸««~°TNÚž ¦7HŠ®x2ƒézdÙWÏÖÓœÍH!GW4{/ô=GZ“¢®Ê%)šÒœ‹¹¤\s4¶4»âX=†q×ú(¶‡ˆ“¡j£;˜ª³œÃc1 UtY޽uÖýt#›sÒ~ö|’´OÕ0˜’Zs œÙ4œ±N!œ1Ï)ZØEš³3¸6nñ²³T8Q†B“Ú»;+²fæ¦$%d¥«¶Gë)ž|gšõÆœbG2FKVI.išj‡ªáe9üqá@4?™¢)ÈÇ h:½ñt8æÁ™¦¬þC+?âòíCµ­«v߇GëîËË­½wU¨üÔ•¦TBا¾¼]ûŒå§JåL¾œfÅ4jfº?`náï¡rÀÓ)Ù›S_ -€ï­¼Ï@m‹Íf>IHaã‚¥QÕŶ6xÜûú{àÄ݃w¸=bWs–˜‚…F±V‚lð[ žrc…¡nûГýßâm^cÕŸhûÀÒ®Šgо`;³*Ó@cKós`T¥c.oÖÿ¾CSçíÄñ!íJoA¹­sƃŒÿÛû¯›O_®×÷`òÕÝ_›Epq%×ï±[ÎT{ &ÐÖX:«H)xw}ûõæŸõÒµ9§É+,¨ÍaF®êP)„¯|!ôë`êqﺎçè=ŒÝÇÖ¥¶ô\3 ܘK‰¶vûÆðRIF3xÊ$ Ö\ýöð òñDÁÒ8¹fixY+?úÐÊœ «uŠâ7&š'šZšhBi*à‰¦sMSPù뉸ã û‚;§Jç Ìærl¡‘Pî½]·Cá…¤^Ar>e`ÿTímý[굛æ¯[‚Ÿ.ÃݨÔ?Tޝò®o´”€BÇQÖÉÜäny$Xò|ùg<›¶0|ÊÁ[Δ—£ŸáÅU×{ŸœÖÁî·Õø€ôù,±åq²›¯=#EC¶ÿ6  endstream endobj 2697 0 obj << /Length 1862 /Filter /FlateDecode >> stream xÚÕYßSÛF~ç¯Ð£=‰®·÷û’Й’–Nh‡iSÒƒÀ&xl0&%Ó¾{w²¥“OH'¡ÃŒe‰õjwïÛÝoï £ø™f™6œ®³³«êŸÎ?eáËû_w ”ËQ0¯Iîíü°/e”Xj!;:¯«:eǃ·Åõb<æœó~5Ì…ƒ‡ÈûŸÃÃß'§óbþ%ÜÌÎÃõv˜Ã`QL‡0ó‘{(£Éíb>9½[Lðñlêd¤Àç `xrt°óËÑÊRÉ$Áÿõtk)½æ›FßáB±¥oL*EðMæR1ôÇ™û­"ïÝ7ïš–5×ðÆ»†×³ÙtÈÙ`1Á îfw·áùÝtòyˆÊ T3Ÿ‹qx\9í¼ÓI',Ö…ŠBL‡Ì î–ììfE¹@k"±*,#”KG¸ŽOh6 ì1áþñ’W˜ L;Ô]fíü™bœ`€HŒ“b@LééËÀ"ñí:õvF±c(µ·3üÎiôv¬,7”hêÊ V] á_‡3âI+L1²ÃÜr££ñyqw‰¬oQÆSÕ_@c Çô$… ÎÑjØNõ"@ÖsàÇdÍÀ¨ƒ¬àš5%8R8fЉUù¸õ-£¸§T#Æ×ûy˜«¡ˆÙŸ2<°ðè‡*DýÌÂ'6§”(—ÚåRú¤ŸÃuê_3î,FÇ¿íYé§7#&Åë0’]ÎØIj”Ƚ‚Õ¢6š°£ÉéxQ¤TrL±ªÞ—ÓÉž^›”’Q–[)ðu†”¸þ¢°ñ®Í±šðu)U¤ûVj}Á×èGDp¯CŠ @u÷¢RPÂ%J’K¯GhÅPNSBHPµY„Z'Ù#BA»Iq”=bŒkt~énžÂ’¡ïÈ͆¾Nà& ¡!†±>jVB×%ýºICI¤5Ñò”\M¶-8§bÛÀyRjà˜(µD[fuÎzÛD^Û‚éè ò&÷‡ˆ6ÀWCg±$ÕË»ÓäÛB7ØeŠž,óºä{7¡)—·Ey= —“ÀË86z³†¯KËVVº6…Š“|A" û|ètó© Ì97È þW~±n¿’õ˜&¦ÎëŽd­î ÷ª*¤—3çMpÉ‘”—ð:©1–u;iPŽ‹˜ ón]j¸v>w{¸ ßÏå¿Xì¼Ëµ¢²-~+Wü¼N~k*~Ë{ðÛ³âîìâKJ©ÀÚTUø’á¾EqwTpᎠ¾ôäº $®ûÆdw[¼cµÙì/îI[³çѤ´-3k1”%ˆâÌÆíÊ–Ï€ÙpÛ™mºíßìÚÂí÷Øj¨žÌò#å”Z#(ˆ¶Ð™éF‡Ó¹Öm´-ñìFiÒa$悉M÷ÒTí†ù3ª6šC7ßL;šP#Ÿ ·Ù¨Ôˆ¶rI¤dTAќۡç&r¢}u±û»ªó”“<Ñ a´S´x1ãvr‚y£ÍÖÎù ¢&°ñ9_ƒiÀ·Üa εU_e3â¢(;Wª+,'klÃ;þ#Úïr endstream endobj 2706 0 obj << /Length 1617 /Filter /FlateDecode >> stream xÚÝY[oÛ6~ϯУ Lï—®°®M‘ ¶.ÙKšÕ–c£¾¤¶Ò¦ÛŸß!)ëf*RÚ$-†±,‘‡ß¹|iaø#‘¢‘Ò i¦¢ñò»»›ËÈ_¼}u@ » “šåóÓƒŸ…ˆFNëCN¢ó˜:J¨aZÆg'gèío'£„1Ÿm³½âñ›t5¢:¾N£‹Óプ§åt‚ $8èÛÎzßAÝvJ„÷nF‚ÄÙ4󟫱ûxb]i/M($a*÷Öùñëçï 2J8çñï3Dô/~9WˆuQ¼ß˜9q$Ä ©f{妳ÿÆs aBÅ—ÙÊ{“æëÍvçŠÜs%!qêzñò°Ïå·i>_{ð×SïëÙj>]oF$^ŽoýÃÏó|毶³ù4÷—ï°ÀëÕâ‹Ͼäf“¬>àÚÍ÷SUXñº•A„ðš‘9NDì¬Héñœ¿9Nõeo2„áU‡2€•1QB9âªÀG!Лܰg+AÏæÛ×é& -!Á*ÓÁ% ö»7Ü×É|›oæï¯ëU0 fˆØ:¢ö&ócýñâðIÑzün¼$€Ì´sQ&"]˜œïVY³ƒ kÄ%‘*~¶? † ";Cêðö£Éš‘BX‹j4ŒƒŽQUE/`l’šïÙÍUå~3eTfÊ&Xñʯ›gi%M`}íARØ ª—ªk ëÕ6OWyo{ Á`".Jÿ‚îY‹ZiLÁŸ È,pú® Í ¡ÒÚBWøÖ"ÁZbÙÊ$wa-À‰:ØÝ€UÈ<âà“õ2¯z¡&L#ÀMÞ±–Z¹šR:~Ú‘J·Ó¹¹£,¶‘1®·§¾“/³<Ûl}·=Lh_‡Hp‰†"ÃKç/ôür™Šõ'+Ÿeyê//ü“‹ïÕÖI8ªž˜[úº®õu¡·4ƹæƒÛ»KÏt‘…f à2e´o¬ Ú"džÜT¬ Za¸p UHó:eÁ’Dç’IË^¬Ý¾ÍïÔª6Ù˜Z4äNo=3‘iÔ}QŽ©(ÇðGß–üÝçò‘Ó6Ÿì?¨8 £ó p»U¸; ò¤UŒtŸ(Õ ¢Ì7Ù2; Ö{éÌý—O#I!‰¯ÝW%¤ùÅr(‹[GÞЦЫë¥}þÞQl¶H*køZlf‡P­@™üL — ³o®½qÑhÐþ¯ÓrcsÉ¡Çëžìî²N)xwpô±< "† r5PSãåÁùŽ&ðð8‚U}v¦ËJO»¢^DüéŒÓÀ_)SƒÁ÷ž†&„ÀîLIº'xsß%¥êY(ˆ›É S S·C˜B» ÷eÀÕ°KýVÈÚ²GaD±~hÙSúyGÙûeÆÁ™)­+ǧ^Òܦl@÷Q#o—6҆чÖ6ÿ:æG—6ÿXÄßR4&l°žiÈ™„iJnÄO°µt †â–âž”ÍØˆJÙPZ*úÿ×5úºæhðÙõ¤pÒ†ÔÎáÈðx“­)¿8´|ç§çLüñÏdô÷¤[zH˜H<4oà`ü&Ù" ÒÌD@ÁF˯çàÖ2í!Fã‡þ¥~M ÐgIóÇ H"UW h:óX‘ X¹&z‘ @È ë‰Ö@³¯ø9§-Íh±IaHrÝ)ͺφ>¸îÒ-¿ªv~ç3'§r¨×WêV}Å}ª/Õ¦Å%@(³ endstream endobj 2713 0 obj << /Length 1667 /Filter /FlateDecode >> stream xÚí˜[sÚF€ßý+”71-Û½_Ü´3‰¤I;žÖuú‚ý ƒÀjQ ›þùžÝ•„$/F$&qg:ž,gÏ}¿]aø#‘¢‘Ò i¦¢áì»§ËIä?œ¿:"…\û5ÉçGß¼""lHt1®«ºEƒøä&Y¬Óe¯Ï‹Õq¯Ï¹ˆßž½EçÏÎüß²ëe²üÛÿ“ýûª×'ñ:™÷Hå Gš~]bŠCëªæ¦æçZlu " )-¥§¹õgèjeåóÐL!¨›ÝŽ kùE·ûUs‹BÆ4%÷d¬îЊÛZ/yçÄy§áÄÅ”ükhì3Œ‘”¶¤5Ro'íº,§þ}î–IƒÑ‘åƒ7?>áÆ‡Y„(ýÖ7Ñ•!k­î~ÞXzU”¢Í_–L}OÒ¹·%YçËÕq(Q…&LÑU¯Ï~Ûeðëyêø/ûãÄÖ‰³¦ËMÞëÃÓ‘× @CT8£ ¬£,XQ d¼0Á i(3ɪ'Él–„”2„©šâÛì"~å¤ÝÇÍ4®ª¹I%!Ü ¬Â¦´WóóéËIÛ”Á‘DF1íD@‹Ž8’ºðð¶’5!Ž©u)òfU2D”›ÇŸÕŽ@`ªb ê@J» ®p4‚/ßD1££÷NtAä}ÓN£_~ñÛFc9Â1¢Ê€. ï²Z–g &dƒUi»MZ9¢œ‚œ¦ÒÈ(Þ G{2 :C%×Ko›,IÞhr÷qG ŒËb‡\ªOÏ%ÅÐPï‘K ù!Jí‘KÎe«Uˆ€Ñ>dLÑ+nÆæ­w6 ÍhQ!ÆwA Áï6^S­µÚØ{ ÓBòz¶¶iƒ°`YÛl˲mq$ÂÄÔ·Š­±3rØÙ£|–dóã`L“ ÆÁÔS®JCº·§¡Âæm6ç­¦@·5,y@FL¦‹›¤É‰×ÖÞ¸"Ã'Å”v”X0ã!`‘ìA‹.Ñ}&ùOã^¼["=û|`Õvvw)º£#iOÖǃÄ-d$™‡ÆkÃ7ÀHTŒŒ©]È(˜O_¼Üeñ³á0]À1„Ö¥ÆÄçéïéÐ…Óý;Ìg&¯³y:òOÞgëûIßùéI>[LÓY ª ñÌàÙi¢¸­3"|£+ˆ–÷G„îr£f¶[ã%ØЬ8TzUA—„ñð®¦6T0Í'ý*¢Pr_U½ÙÐÛèãäY}š/ž§«b@Ÿü¨²\Z°N!.Lpà ¯ov€I6 i¤y›S’º-·dš}°y·àhÁ˜Ë¨=Z¤%Ï¿[­²dÞé±[É#=k#ýöö6ŒnL4 –Ò âOòmx8„å-‚µ`Tv* "4wÀÉŠP÷'Øå†m;ë‹m4Q¤aÝzK5ƒ¿Ñ¢ŽœO‚\Ññ¨UywÂj °cºxWʶR5¨‚ü5¼ƒbØ’H m\sð«€ý„‚i²~¾(Õµ|°dø>TªjNÜn™(wOxÛOZŽóæÞ¶×É`ž¯ýLÊêÓ==é¶—t8±ìA\ß¾Lð8¡áàT Èù±e}?ÇÀîÈñtŽwW¹©ç³tÒ‚÷êê÷10; nÜDCi`Š4ãèï(¡?±©rðøÂ\NíAR~È£ÇGe®}§ Û89 ¡‹ŠÐ5ÿìwºýÜžnúù¸ÿvžóå¬@Äú®gÆÓd¢ÍÕÎ ^Z#F²›iðr— ½¹ø9(2J·Òÿȸ28Ï2Øõ? †º¸ïv»Þ¿_b¦.帰ƒ pfW÷Þœƒ*NLÓ‡Ûp®Äö.¶n[Iâ0)fa•Ðp›»Óˆ;Ó@´r±C2šxˆfkì_A‘†z endstream endobj 2719 0 obj << /Length 1617 /Filter /FlateDecode >> stream xÚÝY[sÛD~ϯoò€–={ßÐv†ZZ %å%̓«µßj;¥þŠ5e cŽ3h?ºk¬—k\;×”¼?®54fœ BÑ5F‰¶&ûÚ)Þá:»ö—h¹HMTµÄÅ‹_Yq:È„é“ZúM(˜1¢KããœP|Þ¯îŸÏ\›VM€@™×@ÒÛºÝ.ŠåÕ|2¾ŽiÕ˜ÿz“Ú¡ Z¦?Ü.ðýX^á•¥þaÿËp¼rU¹_ݬÇóY%íuf ˆ%L¿|÷´”âÃbL%ò·ÛQË'C„‘[!à%46±Ä*¦‚Œëކh)«X6Þw›n Zc€E¢@‰y½ôâ’&CüñEB ÇØÿéE§‰bœ“ä·“_CÇmÚ´ÑE%A}ÛT°  Vsã± LAâʆ•ã#†˜"Õe5±/qÆ0V+„–Òb ˇ¼†(Ù‰.´bÀTÜ<©Ån%Õý Ýô?{X…7¢Ì`Ån—oªrvñ'^Çio×a˜üŒËfÛñ}f>[­óÙº³°fóu˜ËãébRL ¤:]Ã/¢ë•}Æ-fÃóOzïÁk” çÓ|<;¡^_Æ1Ô#‚mBüKB ¢¿<ˆiåØùìF/ìieŒpÖce[Ê$zR¦|²U” ;-2¥-…“ò^¤SOÿ}Ž*tüQ4LùüGT!¡vkµ©G-TKM‹µa_.dm›0­óñ¤VuÍÔÆ‡ëE¼ìháÃp‘‹wªOc¤ßòÕí³sy»ÏAK‰´Ðé Ç$çÑ9œq7B…Îù˜Oâtme¼SÅ|T²Y ¼ßnB}®ØMæÎ‘àMR5ôrM0®»þ´"Dz°†È;âømL`| ´˜áóÙyáû'‡Ž áûgùÍj5ƽlÅ麗Š{Ýb*N´eˆ ¾æ›?Ñ´ŒÐ»_ãç;OÚ ZÝÅ×pLpk›„ hœ€0^B¸ÄWfpYVàX@Ïv×’”PjšKŠÆŠ•F$@ƒ5LÃÎÏYm·820SÁ¼²xIA´Aȉµ%wâqV„4¡Uö`Þ0ÐLbMÙ&lM¡FíÖHC$ˆCž]çt‡9 ‹QïÖl“Ša«u,ƒ)XTÕBÓʫݕ ±¶ûa&ÀÇ&BåXÝêàX-âz˜À†Q“ú·Dq…h;dÀrÍ>«Â}å¤û—éÞ‹ö¥£òn¬kÉýØ(ÛRÖ“–YRNGó©ÃËSd“ù=8Âs|Bs >v;£ãªe}¾$ÁpÄ6‰ƒ“êÿÄÁ—=ÖÁ“¶óä«FkD­™ä‹I~]Ä4J†CŠ·¸ÍO¥|? cµWqÜC®è& Û±u„s ÝÕÕ·Õ{7u•ÀC¤%jÏ ±Rv&pG–Z;îCæGÓDtb»øÃ¨ ”hl(Ù^èk^ð}G;ŽB\ÿ_G ôã‡ÎEÐþåQèÕ;¤Ñ8Ü\V—ûú‰i$[¶ÖŸŽþ½í»¹bŸeûמ?˜$ü ñÃý`µ¢çø‘F Ìç¦8î~½=…(QJ~®1tmåv 1±C ª0qUNVÂq> Uð¶˜kòõ|¹:Å*hÇÄË |~ö{—ÍÏý›â÷î+ÎåJ8,Ö£¹?<V“¿òå c endstream endobj 2725 0 obj << /Length 1681 /Filter /FlateDecode >> stream xÚåYmoÛ6þž_¡2:³äñ=ë¬Ù:´+‚®K÷%õ%vc±ÙΖm~GR¶D™²åÁMÛ,Y9ï9ÞË£#Ë(þ±LC¦ '†ëìrrDýÓùunÞþxÄJ¹> ök’ÏÏŽž¾2c”XjYvvUWu6ÌÎó“›ân9š÷úœó\÷úBÈüÝé;òö»Óððõøb^Ìÿ _fWáºèõY¾,¦=–‹ùÐ=ùp¼XÎÇ÷Ë1>žMŒø˜ì Î^ýp¶¶T‚$ø¿Ž°VÒØ4bã„"¸6P„J°iÂHXúé F#Q!Q³º]£ÙãË +”†hkW’ÿ J-ó׫øoæÙ4¨¦îï>£Ü+é%”² êÍ÷/ŽKéhw¤&jµÜèáî=•4ˆ)Q»|O)]̱š'd‰2,¬ r¥ª "™Ù¡HUÉ0¾ÚÌß×;Ä%Ìfš¢ÃŒÛó͆ø¯W%ÜšìO/8ɘ$ÞÞf¿ý61ZŒ)I4¨ Ðr¶^T¤ÜÅ‘ˆ¬`%)†ÒîŽâ-äOÂe‹C%íàÌCùRo÷%p7q&@›øÎTMgz‡nb5Dçx‹ÑÞÀ+ÚBÒùa1X¶ÓQ{ÉËžô Ìrgž”æ) !×)þM r¼¸ÂEQ®Ï41FéálRŒ§ÇÉ0©-ë'— ÂïŠ{†±§ Æ‹¿õÓóK+=÷HHð¯CÞÆä ¹¾W/™ÌÂçÃÈïุ ¹p=škŠål¾8NmU©Iúêí5½<ýu—Í/§=L‹?Üæ o0¦áÍÌgÌ0Å'0%qµÐw¦FRÔn’2Í'ˆ*¡;¦äj“¥ôOÃO:òüâÔžÝyJ‡ú›T¢f4¥;®XÇâCªxbþÊŠÕ°_h±Dø¾Ömãa®C'Z~¬7ôÊRÜM,‘¢5†‡ÔêãÁN¬§0`õÞëÑôzRëÍõDĤܶ;va#êÐ ¡W×ÄZ-rR<[³Šó™Q VÅËmZÓ¨FÚÀ:jU\GÍ“•Wš±(PÈVo7w©$9OR”ÓMR+°î¬I-ª¤¶ÑâK]ÂZbV¤Ú¼PÃÈYʸ­lg»cÈ ùV¢ÈÛ‰â*ï6ÜVKÉ”BRÎdU ÚY$–mm¶“Hk60´qH¨8$ïÈ!ÿF’X’ÆÅøzÒà‘Ë›‡Ü$ÌÓ•‰ ,°›IûÑ%Åš2.nŠ’w¤¸”ÂbÐ+ ”c ÝØ"f$¶wf;²EFM¹«]h⇂Ýö>-~ßà¿L{(ö{aEÅ~™X³ßð ¨$Ùd`®àJD}â¥w’ÉIñRÈ ‘›Ó.'¼I!ýçõ7=î*Èh9KK‰03Ô*_`.gÓa™ÿ~µ¾ó£(Íÿm<¶zÜÕŠ}¹é>¼²IÚjëÉn¶s’V’¤:©‘«&]h›¤èMXѸsŒ­Q)ZÅ«\x¶4;Œj >´Œ­œ¤½çaw’0’)|݉I#tDE6D·}×iK»5ßnM·vËöÙ”Í4ôW,r0³Go-|®ÃgÕº´Ú¿QêËšÊD} èº/I½{*£6•±k*cv4Òö‘ŒÀü«ÊuÙJ÷ÇXê5<Æ©‘ØvhÄZ{˜,zÛyŸAµW9µ‚ s¬ÙòNíDšÇ<©ˆï{ÜÓ8 [iô~Ç4 ^Ð.Øn;¸ÁE±±Û½´v÷±'ª×ís7°iz%‡(ðÇiZ€5 ¶;²Áéÿû¨‚qK ƒÃÌ*§Èvù'2«ø¢µ&=Ðù}-EŠÁ§3”PŸËÖQ<wrIÿ/‹mj endstream endobj 2644 0 obj << /Type /ObjStm /N 100 /First 955 /Length 1859 /Filter /FlateDecode >> stream xÚÍZ]o[7 }÷¯°—îaº¢>Hi( ¬+: Ø€"é€mE1¸Ž›MìÀqöe¿}‡rìú+½×v²¶@]J:W¢È#’º·,Î8ã9 ÿÆl(³ Éò’31ÈÄRoRÔ‡¢˜”õ©$F¼h›œK=Á :ÆÎIVT4¨JÉPdŒ&6Ä.ŒqŒ:V eí‚*â“v%¬Z±ªW 0ts¢kr0ÞûºžúÂÑT}Ö Šþè9©ÞLpÚ„ÞÁ×I`†¨J)åg¡n˜‹uÇ«$Qų ,ªBUBŸ`J†ƒ”:Y4!ÝrÆ%«Fø‰.ër€Ñ«Ý°ßH\Ÿ€#°1í¡ÖBþ.pE̺?¬“W©À+̪eN&f *áÔ %šäf&&Í<‹Y’÷Ub“‚ÓQtEr¦âcR!C(ºe•<)nOjXq€3…ž8L nEA‚™³$ ¬]ÀK5.úÁ“¬}ɰs:-&§xì‹@6ŒÁr”µ+†‚=t©ÄJ.o8¸:C º‚j¨KrT®‰2)VA]ÐAIá•\l$8¥”*¦Kf/= *°ÎJI­›Êj„ÚÅj…¢’n>Ô•€ J‰ F#ÑCPÞŠwú4Ô×ÅbU¤D êâø«³b#Ãê\Ú_õ‡Ef‡ÎH†C0RꎰK0I»²ÉŽj—@J¾÷ôi¯yaÞà)=ÂG¦ùó¯¿aX ÙDÅŒn..Þöž=«À—ãÑÔ<}jš—8{y† 6˘ô4Ð]£Y¿*Úš?ƒcƒV™·plã }ÉÁîÚªͫÉxp<œš7¦yõâ¥i^?NÍB¡×Ÿ®†èŸ{ÍÏPn8š^«ê̽æhx=¾™ †×³0Sû~žœ÷Ÿ?š7ºáT’õ89’Íå-ÖëO0‰’ÙÍð?FcLúfÍT­µÕ+ ×<ON†“٬=€ÖÞgëáb*ÑÖ³Hd#Î3ú´ ÜñÍ»iç·óÑÌVí{lš?Ž~ý<9›N¯~lšÛÛ[{:º±ãÉis=~?½…¦ÍéõEó½êN¥™+óŠ+… ö¶êÉm8Ÿ½õÔ8ßL;7–½ùLK¤ÃÈ‘ò&9 ÎNä`Ú$GÂÔ¤5ØÍ{â\Ø@E¬ä¬AǪ‡È:؇3ZÎÚ ÝÚâ‘ø‚XtÉ#JD´c¶™äk¨>h$âÛ¨GÐæ×Ð%¤`k ㊠ãxïlpe…®§ýéezfool`ûÓæj2:ÝU*dµ’¡ÂÙEYÍj(´wQhÒŒ/-t²×ïNïtÚÇLÖæ®aê|2¶7—àÎdØ¿°ƒ~óïÅppói8i.?½Ÿ^Á‚¸¼v®ìI£³¬µXÂ¥!$m~c*z±'FuÔ¢WSÚ‡±lôF§Ç3õvOÈɨ±)‹ËÓÂÍ”jûáõ;Ž;kÚ³éåÅw磓áÇ œKïŽ^õtŽ‡Ã“üî&§à,nߨз„«:¨¢öÝRÍܱ^Ãq`+ìÛóÈÒDýŸ‘oÚ3ÑrÆYIEK)êÑ3‘ðf&’¸W&Z6ФnîXñ†¡uãm&!\HÚqš2ÿßÞx˜kK¦-®)»&»n®YÇùˆÛŽcÔ¾èÿmÜ ó–»aæÃܱÞí€{,ã ŒçÐ’ÅoZ²¸ƒkÚ<¯Ws¹JüB½º’Ÿî½µ9‡t¦/êP·Æl¢ˆ ° ž-I+´E^ûeüzlà«'ÏÏß]œO'ý«³O÷&ÔN«kÝQ'0.e§Ìë&±NÒ#¯®Á³ëôÕs„‚@‘€jy·…+{ íÇÞ%º­ðwîÉ'.lœâÂÝNñ¾8\—lØ Äþ¬žV`Â}?'ßr}¯Ô œl‰]€%b”v IÄÒ6CI¬~ŒÙ)êÇ"¼h¸³_ÀŒ×ûÎ݈ÒeÞˆ:2ŸYO Eúr°/mõ;È:mõ[Ä´Õ¯%]踎cDAî‚cÔ^Ú 7¿­fØâ P‘v`À½ÄwÙKÐC Þt`Ü@}ÓÑm•Ë\º—¿«\\áì23÷& …MLÀùûÿ6®áXMLÜLÈÛY:Ìô=Uî€Ã=w[ìZÇQŒV?,¶õE’c˽ ¹ŸkìùÌ·ýÙR¶°EgKîÈ–õ«{¹'¬qs ¡0F0;qÇ)´=’bä.À€ÛÅÇçËrØ?Á×kVòミ6©äÃÁTò±•öÅy}ÏÝŽK'ú¿4ÚÁ[Yvû¾ðlÑ endstream endobj 2733 0 obj << /Length 1483 /Filter /FlateDecode >> stream xÚåXKsÛ6¾ûWðHMBOH“ÎÄq’Æ©=­âô¢äK´­X"]Š®“éŸï )’#MÆIϘ¤¸Øýöù$†?IIÅb2š¯°ûµ¼ŒüÍôõ©åL:’‡g?½""i¬ItvÑUu¶ˆf1%é$¡š©4~úMŸŸNÆXü~“•öŽÇ'&ŸPßšÕäãÙñÁ˳֜  ÎöÄÖHߨ†iаà`9$Î.2ÍçîòÄBº&$JÁ”[5;~{x®ù“IÂ9_\!Â~öîÜ …?ÖË{†·>¡1žz-›gÍþ›/Áÿ„ _f¹cª¢Ü4HÒ{H’"É•×tôòÕ.ÈÏm”_L=ÊuV]/ü°ÀÏçóì¦2ù`Œ½ï‹m=´À›`ud"„52澨IóþuOJĵ-XÉpânæùZ¿Úé§&Ie|ÀYK±tþªÐ!-–} ‹bm–ùNë×A¬ã§¶CaZøËÓzï®âº@5ëFr­™^Ǹ‘lü†€–ðc™Ú‹ré¡6ºAŠÐ¶E}ýØwŽ‹BËÁŠ€\Šº²N ñÇ9X›$@”0y² s»rõèr\k¨‰¨™Àý˜1†¸ìMJÿ 1¢Q h°ªý ÅŒP¶ÛJÜ\Ïa}x`>X2›׌‹#*D§ÞIp˜QèD¢e?^3²Û]cÝMéwu7¤vI EöøñtK`Îö$GÚƒ@{Ðt0” 5$Ä·3çYPHð. SÏt6‚öRJ)ùKÐO‘"íx6 =º;(Æ£CEªAÃö¹’ÅÁ¤qÚºº—2ЍN¿Î¥¶‹ÝKÉ–KÉž\Z™Ûï¢duéL˜ìÿA-s-:ÔÂ[j!ZüxjÙã€{6QpH3ùæ¢(×Y}jYdùfYYºùÒ9ÅÙƒÞö$çÎ ùª€ÕÁy ÛÅu¯­¢a$v¦# 3{I‹¢9YýfTsÄ!ƒRZ¨ì ÂÒ|YeËË«Z(]©‡85–ùêE{ÒfNÑ·žž)I¾‰ñBÚâJ<$G´ü<°Á8T`ÈL‹ŽöûÖ_íG+C΢"©‚а_¬fq´€wÇ´äùÎI®AJí$ZEïþðßµúæZMaJÚ" ~wHN)ð6ì’‡¥¦¤œus4ÌíÜî`:bãlÛ Ýÿ2ôÐܾuš÷Ó¥îîUhøl m <~6ǬÍ^ÕÁ<àûìÅÆ™'wj™ún<¼Y^®ÿ«ó,é _f'Ñ_abõÍLì*Ò¬ÂL P)Ûƒ‰1JSѯô‡úÔ¬Z*æÂÓ„*ÿ†Se endstream endobj 2739 0 obj << /Length 1577 /Filter /FlateDecode >> stream xÚíX[SÛF~çW¨O•'Õ²÷ )I(¡¦%ЃŒxÆ–[NéôÏ÷ì®$Kb…í–ÐÙb0Æbu0H8ñåÙ%:ÿñÌ_üe<\¤‹?ý—Ù­_i> ñ(]ŒìEÆËb1®Š1\žåVFp¸N‰\_œî½»¨-T ømK·*éG¾)ð! ÎU¾Q‰°àÞ7…¢Ô½LpK” Ðì„–“tyïeÚÚ˜FÂTR‡JÄœ°û¸vv–ûÛ…n:Sáþ„bD…WòëÛãƒR´•¡¬úˆ&^Hò¦¡ˆP²Ã8¤Ê¬¤²‡¹ÕRf™€6ÉšBqÍ+¡/Á#‰ŒbÚþ.e"bÈ€ëN††´pÄU”4¤ƒA@\ÔgQ0›Øÿ>È‘©%f‚¤6»:"‚ M e(EŒS/z3®x¡¸‹Ù Úg=©Ëë0|ï«ñóª7>ÕO¸3¤‘H2c‹ýêG#øé4ˆ3ýá§¶(°´±˜Dö~ õ{©J+T9H7Úü3ÒWÒÄ¢Óe“½Ù¢¨óYáacÉ?0liÖ®›WWº˜DŒ¨F‚ ³q|œa$R”…¢–jà5£6FDt²õ8ªuÌs‰T¥u’…u‚qL«ž9¥[ ÆV;þÏ—=|é(+õ5Í`YzÚ"öMûÜÛð#f(Ìu~!F:^Y9˜5´žS*`>›!·à8‡£‰4Æ£ì6]M`[)B̈K %KãëP¬ƒñ–´°ØÃÈø‡`–Áy¢+i a]: ¡ί{a Ëš'ù€jØ|¸Ô¶ §an©ã™Æ–#Öc ÕõØÂ$½Òº/ÖG¬Î7°:qšß­&P+­ ÊOѱ_ ×·mGé„(§jgN‹ÕU'ïáð:HÌ„’gXcŒL¾ÿë›@D7+Ž·$‚å­­È *ånzNBÆ'†;G›ÝB+0í[g |ÓÚ^gÂÓ†ÝAU}w¥œnÏ;/áOY ™©g7«ƒectѬš5²I”'=n-ž©¢z:ÚÒF)j…€‚Z0õO¦¨Ý¸²_]°[áÿÂf¬cÛQ,Þb¯<(x¿þ¯¹6ØX¶Ìž;k;uÍÓiK¨8&û ìè¥~(¿¦ó¯ùeÍüÔ¨|bQ>ß{öû&›ß»ñ³}°üï †–¸ŸÙ¤Ä£!Dc`–êÁǶ!.ë%_òÉÃ3¯–ìñjY C Ãr7òLÃæ¨æÜÒSîF"ÁØK3H'´ uiµ?­·)U}nyÔ`Nwóô;ßCÿ5êÿÓÉ L8¡ ink :aÉ’´œ&30RÖ Õ:€)ñ ””lO%ÖqŠô;µn†„iI`#tÉîw±I/åa‡#Gæ‹S„’/ÿPûÙ(Â>,ûv„Λ endstream endobj 2747 0 obj << /Length 866 /Filter /FlateDecode >> stream xÚ½VMoÚ@½ó+|4R=ÙÙïM?¤¦mª¤*jSÒ(œ€ä@ ¤‰Ú?ßñ® 61…CU!Ùkóx3ïÍÎ,1ú`dxd¬+L4ºí0ÿvq…ÅÅû–¸„€I yÒï*!ÇFýë:U b޶›p'¬Ž/{—pñº×M„ñå2[+Lg]nãû4ïûçwýu8Å()Ì­B?IÐP‚eX%È50%C‚¸.B"k@¥"fzȦW÷yPM>ÅiQ“&£âo]'ãò7þÅxº\-èy5Ï‹²uÛg:gõVéü…¼u˜"7°™¦Ì+R;‘ÚÏ/Îç…  ªvŒ7ø…ê‹]ÍV4]³Ó|e×Y¸Ï|˜lïé?8ÿpråäq!DÆo&Àñyh¡;JÝ÷œrô-ËX蛦yèñ›l²IWóÅò¸­@%“:¶ÓYï뾜Ïüß½ŸÅ…æIa¤O˜ÆËdN#ÌÆãêÐùxªg% endstream endobj 2751 0 obj << /Length 2630 /Filter /FlateDecode >> stream xÚíZ[“Û¶~÷¯Ð[©ÆBq%€uö¡±ãŽSדÚë'{ÇC¯¸›åRT¼nÿ|?¤DRHÅ›ØM<;³¤HààÜÏù² Å›h>ÑF#ôäjyVO‹wóüo÷X=n†³ÖÈï.îýå±RF‰¥–M.®Û¤.æ“WÑÃEò¾L‹éLé³éLJ½|ö’<ÿë3ÿðiö¶HŠþÇêÚ_×Ó‹Ê$Ÿ²hžs÷PFól]ÙÛM™áñ*wc”ÄsÎìôòâ‡{ß_l9U\¼)V3zO6 Ù$2æl<&TI/›&|:S1‡<ŽÝ—àŠÅµ\“íØxs3詂 v* ­°F5£³u-JîeIŠ"q³?úŸÎÕÝëuöŸ4´´U„q; 3„™­T·!:Šh¥Ç(gkÖ$Ÿ{Ö«›ùÚQRÈ&MmDæ– ç8¥R î¼jÒ›¤vw¼Z&p‡[ï¼ñ…Ó»ŽÒ¤X&ùŸÖþEk–s=ç¥_¤EêÉîVZ9~¨çUé×íëÝjÐ{Q?\—«"WrЮ.Ò«K' šÞ|ô’å>Ê…³¡»ÛÙΈˆ¸-£‹EŠS¤[øÌVãÏ^>}TyŒlºõ¬Ú3ï‹M)¸JrÏÐ[¯3ÿc³Nçþ}†(N“yÃlý>›×.•µ»¹×^3Ä[“Å1r—u7„±:#>¹F%Ò²]Ü8’?O•‚J‚bbL;¸UQ¾*ýMâ/~þ ‚?›û'ÞÜ]Ç܃Ƥî¾Jg$%ÎA¨ØÑ­Õ·ÎKúÇóô5e2ÏÊ´JhÕ3¨)o¸ªGíe,XP Su\%”±*Ôâsa]„]…\ƒ "¹<Í5šŠ´Üy:'¡Z4Cª V£8 6ÇjWâøˆ·tõ*Ù\->†hkK(µ½:÷fŽ+È W«?î×áZ8Ó)c >KÕ®c?>z|æÇ¢L´SØlÖ½i ŠbÛ|ëœ#DE.E?EöÈpÑ&ã\ùçÜ]tÄBD¹£ºM¼ç!ªŠHÕaΑå<úÆ_±Ëa6ÝOé±l1$VvG™éøÛÝ(Р–ÑkÁ«…iÈ'‚XXÒçýÐz‚(ŠúÐvl!-Ök¦XÜZO£K³íõv"ÊÖ0XmWšYØòRŸÊÑxúUmÒæˆíìҖ߉f££¦†ùŽùĘØkڔоÓ]:ø†ð䄾ÇËŽ›Ð]+ƒ±ÏcA„±Uš¢ð)_S¦ªB*@2eÐ@í4à4ëäÔù!B–ÄVÒ‘'ùâk*X(4bVy†ýb=ƒYèÃÆˆ`ÊèÐ7Ù¸é‡j¬úï-å1êF)¥Öü|uI's¼D_G„5“ÕÐåD°º.ÜL^Üûgo‰I4B´ŽŸyZz×¢q7êúÌêj2npõäÕ2Éò³PjèûoPƒȶͶöè9¸˜’>«Õ#¿õåêÖ_¾ ± Ð Ø~²ì2àSSˆ¾øètD]‹Æ`b´„îÿ2E뺥#ê.¦rÀ*.‚nlå6~^Õ ë-怜/²wËÄß^Ö¨.UT>[‘j·ƒF9x˜Î¬0F½N6®Õ,CY¼¢—ÁÒ†¶M³¡´ÍP¹´íð¥`?f0 ‚¶. ùæ>õÃê­í*[¡¬ðmèܬœ~«|™´ú«n5Ó ߯è½Í§=áÙe ~¿b÷rRL Ýf®h•=ðˆ£åòÁÔáèG\ Ûú &Á®Æ†Á©¶žúÄQ.Gêg½H*?LtÕÀ´Åt½[Pd+ÖíuMÕ)?n©<û]š§Þß/×g!-WßÁX¾ç¬ ˜€Ä!‰2uÉö«#'†Ù^õìqþï•éNË\Õiµß~öûe}¬ æ@$Ê›°#ù¥Áœ×Or´3urË´,${ýU§)¦A’¾Ûal¾§©îrl¸öP§n`²­ïgaØ Û Õ/ Õâü6h_.PÑY¡í{5œH†»QÇxçC ªÐ‚ŸêØù&»Q±3Ý·oKá#[_ιmSökióÔ5÷jNÑÞ3ª˜íò­B—Žë+ˆPçbU7»Ç}ßáÓý•„ÝŽÕÞeV.nC*1¨¼³öxOëªÕfîÜgñ0Htt[»Ý¬Ê=>º£8ÑÜKk»üû6×àêí»[¡YÝm´ú–²>\bﮘ™»(fñoWÌÌ@1£hëM»˜c­³ð b­²œó¹zØ_šÆ<ÜAÒ`†rÜ᥀—ˆŒ"Ö¡OTxmî|ºv—‹îÒ݃ϵÛ÷ýf~¹HË#Ø“}2øÆž­Ýqzv÷š!Ov2òüeȪ9%;€9 Ýdç!¡¿ ¸ÝÃj9Íîc59«å«b†i‡Ogê9¿ÓS™êî¡uW·ßŸ„+F$öÁm[î¶;ôA¹«¬¶£„£Ç;vÜñ޽«ã{j…ß;ÞA+<Š%vrüŒ<ý! £v°­;Ü Ü…K7.<(2ô/÷#úÇÔŽðCÑë‡ î“¦Ç&¨ƒ§ Ì";À{8šZ…ŒúI§ [bL¡~°OPÆÜdobùÇ>Mà_ÂiÂoÑÑý¡Oبãñ»;N¨ƒ»òëôÚŸ¤yet0‘¿úûw?¤”žùÏ. x€ò%B]ûN¿'Ðÿ(Hm;×åfžæeˆ´QDÝwúIÕ¹ÀØæ“»ÏØ×O‚¾~ôõ“ Súø#=ìyø{aÉ„d°»ãv4¡ñPßèø§~—¤ 3Ï9òží5kŸÿ¦A¿ R±p*3Æ©Ä è÷Ó>~R]ÈAGªiy>ììüØ1¢¥­‡Á ¥úTT}͘!4£¾ E]ObIŸ†ejR úíQ$ãXø0kQ endstream endobj 2759 0 obj << /Length 536 /Filter /FlateDecode >> stream xÚ½TMkÛ@½ûWè¸ïffö; …šÒBMIì“ト•Ô`YÅv ý÷}¹r²ŸŠ@³ˆ·oß{3+Ì€Ìh´Ï« ´_÷ÏY·¸û<Á'(GÈóÉÕ­µ‚Š1›?©æël)ˆ —upb1[¨»³\j­ÅâPߊ]NA¼Û|5ÿ:ù4?gÉ*kô…Úô[áµ@r ¬é®ëªØì®›³¯nC­W޹[Ø`BÈœŠ^‡ƒQéh2­¢=á¦êÉô˜ ½²L/GÈNÆñ«+7) šÅ“ˆ¤€œpn\¢öʳ(IZAèûó3·(Š}û®Êc¹?pW¬ДÀ¶-h~aÐy³#©hì nÙu¶šv}­Ú®N»÷›çªè–«†‰s°Jó^V¥ÐbÇ0«U.Ñ;“K/ÖåSñ²ÍQ{ n,z†^¬RÙk­ŒÇAgÅ: RS›Üß§œy^’vp¼?pþÒ˜`ÛTR#6#h†mÛº‰õ±Íö¸©w©ƒ¸'œóß)³˜r)‰gQŸ‡µÄ ¼>¹Ô±H^Gçp« î$Sh•I6ˆÿtoƒrDÿÉ<­’„¯ÌƒKEdœ  Ô}.yÐóP8QUïØ¤sâ;E}¸æñc‰ä¨Àœ®çGæÂ€?Šöò•)bþC÷&™æçø1G endstream endobj 2763 0 obj << /Length 1514 /Filter /FlateDecode >> stream xÚíYÛnÛF}÷Wð‘DÃÍÞ/nú›Ó$µP¸r_Ã`$:bQ%% úóÝ%E®½ŽèÚNŠ 0 RËáìÌÙ™332I0ü‘DÑDi†4SÉd¾‡Ýjý!ñ7G¯öH#—ƒ`Þ“|6Þ{| DB02Ød|ÞW5ž&'éó‹b¹.ë,gŒ¥j?Ë9éñè=ùÅßfïë¢þâ¿,Îýu•å$]UFÒiQOí"O§³Õºž½ß¬g°¼¨¬Œà°N)ÉNÇoö^Ž·– *<èV+}Í7¾qĸ¤­oT",¸÷M!–åBRðÇš{ V¡#{ç\S¢ç|q®Á¼ÁI]:K»ÈÓM5û”¦¢ž~Môܵ¾‚ƒW±ÆIN "T{sžfT§kx×àt}Qú›ùb^VჺyT´7ÕÂ_Ÿ¿8Xù»Ù|yY¶/–S¿x¾°Ç¨5lb¯ÁÎ ÿ`k1ÊrIx:¾°:6­ý²o?(Ø9øáìßT›úÌ©8³ÒIÞ>Ï CD/e7¯Ï6ËéÙr~¾ÚÌcÀ(V£w î åʇVµXû›ÏUé¢þè¿-ëÅÒËÕ—M0z‡áf]oªIု¡›n( a0ÀîŸ7ä-”tÑ‚ˆ—&8g I&[sßϪÅ|V\Æ t+÷·’g­øµ˜iÑ}dr#‡½rJÝNÓï‡ûa&1ÈH*Ýf`V¢ÃM*¿Ã·ö'Å´ãHHPȇ‹t;'Q ¹¥‘Ä̯Œl‘”^Lj7¼‚|óžA«+· r‰4æ=EÌ¡E¶bÝ CÊX¶=›ÊzÇ%öåÞ+]!ZG  â@büzR…ÞçÔ€äPã ÙB4‘C¢tDí¨*J§KySÉ2nziÊùˆåbkÀ ,yeL1Ô.u 0¨æ“0¨]8—祿VŽÊI|òæíÛÂP×çqhþûÙ÷nKEït c¬àcâKdÓ‡²òÆëE½Ú´×D¢¦ÑôâåÁ.“ (–ýî“§ÇÕÌÖ~’Îmw³züÚ5BŸ2׬liuâ'Œ3ÍÒB›Óh@´×›:  øPBß•|S,¡[íD›>àÕöaÁ ®G‰va@÷ñŠ&…rUÿ§‹i¼pÍúW!­MË7¡: }uG äÎ…Žt…Ž ,tß»ÀýOíw¦v ·-¹SLv’;»7roåõèÏ]FG™›§¼~*œÞ†¹Ùæ¾ø²,ë¯Ò72%WǸ_¿@1À¥÷î@"gµ‚?ìHwèÒ•€Äî‘5érµò† ­?þýG‘ÑGA¯o3úx³¡ÖA-Ðá÷9YÞ+Ä94Ð6(÷Žã—Ø‘!áýoÎlÔœ–*êz¸‹17Y}mp„nšÙÁÑÀÕ|ÿŠ9/þ²|¥k†[) *"U|°äÔ·íKFÑÙ‡BìoE~Ú­åð† Ju?_uÔ D¨ØÃÆ_êæ³ª«`ᆔ"Þ%QÕ u“BÅ–fg£ @åÃÖ5"l`#2j&îÃG¾4TÒ˜áÉèǽ‡OÞ‡»Û3rOòa”8luËìŠ2‚60øöÛ´èIøYåNmßÜ+(CaðÑÁ¿û| Ü«8 ¥ïv;Hêoû7ë¶e×k3õcÿbÿ‘÷ù˜°š endstream endobj 2769 0 obj << /Length 1202 /Filter /FlateDecode >> stream xÚåX[oÛ6~ϯÐÞ$lbx™vÒKº5mÎË¥4©fJú××èêô"cþu•”fÅýqPå?ÆÁlòþèídmNPgúÖIo9ƒ að°sJ„·Fˆ!n,Ÿ›G^ÞÛ­Wɟɼ7/þþk¬ù¬ûå¢úõÐ endstream endobj 2776 0 obj << /Length 660 /Filter /FlateDecode >> stream xÚTÉnÛ0½û+t¤Š’WI½µé‚M (ö) Åfl±Pt“¶?ß!G2dÇ@ DgÞ›…<ÉàãI.’¼¬y²ÜβhuëÕçp€t‚|?Ÿ½ù¤uÂ3Vf%Oæ÷SWóUrMÎ6õ£·.¥RJ’¿M©Rš,.¬zw‰Æ¯Í«Ý/Üt÷øïSʉ¯Û”“UíVÁ¨Èªé½kîv¾s׌V`B¦7ó/³ó=S-4ƒ³ÿ”5¢_hËA›bR1j†eZ¡¶œ©”j#@O »V¬ «(-×i°‰ÒàïêvÕmÃZ‘m ‚–¶ô1šd¤2DË ÁвÜcq<;ÊœiqËÎ9ûPû¦kOyÍK–ÁjÿAJÕž’>¸ ‘ã3úÒfZkʹaFi š1#$ú„âV·ίæ–òծݹÛX»Û‰óï™Î°¬MëÙâN¡‡­%”dPê½Pgk©£ªÈI~ŤCûpÐÝA‰4ùa—!÷›\ÉÇr@<1D 0®_æ“ 9äJýŒ[(+r-§\Ë’‰BTÛSr HÙp]* òÔ£K` b?ì¶mÏ€)äÜÖz`Òà–Eë®·+4?5~3Pµ~ÓÁ2'ÃÑÅÙ·ªB|Èoíñà( ÎUbŒf²qp˜†3º†q'èÐ2¥ñ>88ñL‡‰Y¸‚"íÓ¬Y‰ýžPY*ôËÂ|=mÚ3(”ĆáƒZÁrß¾±}o^îÐä±^[=^”ÇÚ…ÐΉт Éÿñf `:AŸÐyä22ý¹ù¹¬mk4óËâô4†#oŠß w×ÍÏÐI¶ÅÌñ2‹$§‰ë›ß–Òÿ5lwÌ endstream endobj 2782 0 obj << /Length 53 /Filter /FlateDecode >> stream xÚ3T0BCs#s c= cs…ä\.°hQº„äÎeUgbj¬gjb dcUWN" endstream endobj 2788 0 obj << /Length 3134 /Filter /FlateDecode >> stream xÚµZY“Ü6~÷¯è·¨·ÜŠxèò[²±½ÞrٵθöÁIÍjZì%ÝRGG&þ÷  EõhrT9åªi ’ø²Ø$ðOlr¹É *ßìÏÏ;Ú7Ôøðú™`ºîÊoož}ý*M7"‰Ë¤››CÈê¦Þ|Šþy_]FÓowJ©¨x±ÝiF/û¾ã¡ûª­OM{¤t¨ñ¹›ŽG;.EšéHÊtûãÍ¿Ÿ½¼ñÚ¤2S­þ¤êŽú‘þ9èŸÇ E;ýe'ØCý‹í.Í”×8סÆyÊCcÖÔ¼>•d³“E\¦1ýøîcüá›w°°ÔQßMcÓš{æ[.¢®i jé×°Ð|¸7­ùu T†GÆ{ó™Zûªm;^JœLèú³§sb~™Ì0ššÇ«áçx»Ëd}S×Í÷€J ‹TÒcÓµÕé„rò"jPF^FÍ@¿(+ºº"jî¶":š;ú=š‘—¶¨P…üh¦º£-O°ŠÙ’¢vUkúŠ…µu3Œ}s7Í‹»Í0!Ý Ï4~2ûqXì†6s°t‰ŒêÙÐT¢¢ËÔƒ|ƒàP´ÒÑ¿º-ìîÁ9üs\àF§j$;.g$™†‘fhwLfÚêîdwtx‘4¼ïΗ†­ ºdU@ѴÇî'PÜÊÝœš»¾ê?o Åäb?$iòf$g²w»€ÃsÂaô•üLíÚªé4ưJÐú›{Z¥¢=Ò…^\{É{¸{é†ÙƒžDК½Ô‡éǪ9 /È12:8…Na/Y¬%GŒ‘¯ùq#‰‹+»$:è¼é2¤ØŠ©Î4nÍ~éæaò¡oFxè¡:­‚=8s×¶°cÅp²Peß›Ø'ëÏwØ#ŒžØÜN«è–d›«°lú/-õ¿Ûޏù°?o­Û³Lò1¾Æ¿_—׆·îzão;ˆL³±øÛ¹€1TýØì§SÕ?:´=™dmXU|Yt¬t&­ªRÄ™}”äw ˆ>/2zå 7w†;<ñ”ˆ2²¸zJ´ÐrбUÑÏ©;Âah ÅØµÛÁ†·}K‹~‹ Þ 6ÏèÀG3<§øg#_Õ·°Æ Ù…¤Åb7<ÕH£ÀŠœ±`Ë˧-xïÆÒ܇¡"ðå9Z7‡V¤  Í£Š9õ kÎL1‡¼ÂER8Þ,<^X ) g$S;õ·Àø–ů\HQÆi)Ü‚=œ&ëþæ@’ÚÎÄN'Yœåò<†‰â+ndÞ¤,rµñ÷ØPh‰Äí§lÔÂ\|OÓ p@§ÎÌ_°àš°¨&‚™g1óä7!›d$8Ì–Ë V=¯@«M»òÜ6ó­gÛ )²MüßÚmd2Ns^FÕÆ`Ôk÷ˆôÆ´_צ%I,2‹öSßÒ†¬iwýÏra Æ#êÍwˆpBÀÉ@Ô‚KMµƒdÝÛêÌ,-±Û²¶ sÛY%ælp´…S·ö À -íÁ]…N)sµï»Õó÷3QnÏ >ܾ}ÿúöÕ›·/׎(/âbOâ/År_=y|‘Kµ<ùÛ}ךc|¿ê)4½ß|…hRçC(' B= $àmv4ß1^mÝî&ð! ˆ0„ÙÓ“i µ<<kÏ)¯îK«8Ër§æ0ÖôÖ¶£ pg*´¦H‘çØÀg¦ª 8Y½2'EƆãü îR[ô„:Nìˆ]_kG¼ÿ| =Xáb1õ(†##äG£‰™çè׎˜ÊÅ; _°0ÄOؼ¯˜²qK:« +ÑÔ, ÁÛ0| ð¼•Z_]Â}ãD©’¿L-Âuˆ­¦)ŽKtØ¡6»VÉ®U:÷-³küSÜOÍ”.#Ú0#@ Vå)6|áC&ÐÕ‡KÌíCw:u|À³^{Áf­¥…%\e\·—ˆÓ{c¨Y7G8R›] ï¸j„ß‹= WõLÏpÄ2¡äOFeY•ßÓàHLë[Ô¸¾©áŠ?¦‡#ôÔ6|½ƒ;‹pà.:ê¶)\Ù¹ê~±æA:‡|;¿F~ ;lZ0ãëIöB€1'QØ»s÷†á¡ÉÆÐ”p„)ûôcŸò)Cƒ´u\/ÏeRp-éÄòŽ!Ðáá§ž‘*ôÒ긂óXÍ!x·£oOÀSÅ€p ò0”ƒÕ`Ìu}C¦i,µØ¨<‡CW¶¾§0þi Ë‘°âáÖï+›k1œìg\Ä’âÞ'_äø‘Õ¾X(€­•k¤u±§ 4ŽúÔ½fjÕ 7„_ µ€[iM¥ŽEÉVûj[‚´n{y à€ásàA—i*]åFÅEYòjxYÿ±ÅbÒ:4Ì’…×(À$i鮟e”‹-Áù{àBˆÙB|‘J…Zóð;‚Á¦óLrÅš!î$Œ.®CnF‡ù˜ [åñŠ~@jx¬mNÖ˜AÇ NÐ@ ¿ÅT‡yÚ<_; ¸:QY°_g^¿x›ó€}f‡¨$̧“M sÞb>–ð¼Q ÑGO›ïŸý‡­j!M•Eœƒ‰ +‘g<…ù•Œ¥¡ ëbe·ñØ8ƒÖX¨lu]Ý|u.bú Bš8~ééiѯøäwÓ@ãþ¨±Óð`oÆ©o-°‡ZÜÐQ^“‘ZœvSÇæR´ríÓcÙYR…U-Ó£ý°RïºÑìÖÊ„VíUEPÃŽG†Ø±µl îë£ÝŒHŸ‹p•û\ÄôT‹Ém-F0ÌÁ†Ï¦-S<÷EF£]ûuGÕ%ZÀE…Ì•ƒ§D1lª’è† \‚K ô»×¿{ÍáĦ)Û†áûý4“²Yøý:üýi¦æT{f\í•Á)B‡“G°?ðð¹øï“yW¿§Ùå—×§ó|­â\ú€òDI!æj&¤…ºªÚ]@, /âéâ’aº¯Z›„Ã~¬$œKßøB·¤¬ FWö£ã;ìûæÂž¶Ü&]Ä{ð^ú £a= æ‚#¯êž. ¢ð$åOÁôù[’1'd5V#Á\r¤†GƶdŠ#ü„öÕž¿Ž;½³å[‘íÉφù•Jùx“t†ð A@óg·^ ¿bi.ä­~¿?léâÄl¥ä“ùèMšÆ*+ÿzÁ‡VïæåkoüBÄZ±Gp±ç½ýÿWÓ‡?WùÑYœê,ÜÈï~˜ø÷õ¾bé߸ØÉþ?êZWl endstream endobj 2793 0 obj << /Length 2509 /Filter /FlateDecode >> stream xÚ½Y[wÛ6~ϯÐÛR{*”ïûæ´v6{R7Mä§¶Ç SÄš"U^âzÏþøÎ`)ÓM²M÷è  sýf$>üä"Q‹$ D$‹üð·³ÍnAƒw¯^H^·‚…«ÑÊ—ë__EÑBú"ó3¹XoǤ֛ŞRñr¥² ½›ëñîâz¹ ‚À»iMƒ£ÐûNWK•z½.—?¯ÿõâr=©HDað‰¼¹Õa0E†Àg,ü($&×{³\…iämÌ]¿ÛKéU;šùÉ—‘Þµô’«0½;¸Sêñ¦Öt4[7¼ ï³×ÕÎlÜr•x4îÜYiD&ïŠKG/„SʲEYëñ˜õ €”O\÷UßÜÂá·–kÞ0½k$Â8qëuµ™£º lËV22’#âù~÷ÄAÊr ^TÃבÕhW>’®·uC£s”ÄžÞv¦2îêF ùÅ*NEš€þd,”RDö%“ؘ­îËŽ^H'swIB–æxƒ{wûíåË›W·¯¯_¯g/‘Í(·á'?ò[cèÖqYã]à“¤ù¢¥gßÂBémÀX(.ŒÀŒÜ·vÛénk4t $W°¶“7õ¬²d‚RR¬¬ó{^½¹x£«‹›7³×•/¢8>) —™÷ï¹£@ qšMW·y]m‹Ø?cm™Ÿº #Òht0HÙw`æä;8kíÁ¹ LèŽV5=ÙPq0nÉÉå7“"Ï{V¨BXufàä8VMÏÛ¸ôaœ B@ÏdcM1|DScý4‡Qàåuß }à´ê†_lp‰F–Aßÿ¡‰ºö3Q+¬º5üá`º} {o˜ú¡÷¾¨r^|¨ÛŽélÏø=Ý€Õº‰ m@œç`CÞ«œ÷Ê1ó8ÏÆ*½²¸ktë‹®5åö+zÑnc›7ű+ðF8á&¡Æ.»&¼Ã°˜x¦¢×¢:;8¯›!ˆÖÕ9ÃùçhA¹<1,MKÎFL#§cq¦VœèÐ׆ârk`_ûÕdG¢)AŽ!ïsæïÖìqíUo„ر¡ïEÇál‹>ŽÔÚ’µ *Bc è^ßÔ‡ɓ͊6óáÿ˜ŽN&T¤žÉï¯®æœ JD<)0M9Ž%Iv?º³4ˆ¤¨ÀŠÚZÀc|°%å¶.Þ¼ù[¼g8\£B>,£ØÓ=îJ–üŸâä¹,ò”•£n4èÑ4ldlá)çñ4X°÷‹õFH&9'½íLãDWt….‹ÿ|ÏOX~¹¾yûiÁØ—šw>4EçöÔôÉFõf™„£í4#º Ô1Þ†B³áתîh°¯Q]*ㄉS^VùÀtIS#ÑÀʲ¸_’fñä—Ll´ÅEˆSSàC¸³gBøR÷LÇJ wž’c[`gGöÊîI6RSâÝ“A%™Íàð`2a2Ã[ظadQ-<ˆ &¼mT ‘™±J[,'ó£Ý¬GÂÒTNqØ*J•÷O‚çV™„ÌÒ™HdÊß¡%QÐj~Ó¤z•JL%DI69 H©H‰Gâ¡„S³Å–”RH?p¹¾™ÏmPœF§:æ\ú-gæÃí³íO5Vrn‚8u2A|;•0î‹rñ$q('ðùFز`ì@a"à«»Ïje*ÌÈ«Äy¿j»¦Ïgµ.U0.) ø@·ë§ñÓymq)K¦üüsoíPïÀF.(xuI¯ŒÉ¢D¹r '„k±3Ïô"¶æLê¾°rµ{­oÀì!²ö ;Þ¨é1ŠAøz®eñ<<¤¡X:6Œûœ‚N'ž…œÃwcM†{ fiFÓcÌR|ƒ‘à”µ––ZçAB¼Õb™ÈûÅäÌ‹Fo±•6C¡ùÊí 0‡cP6ñð['æ×ÚÁö¾Õ;3…ôN36N4ƒ°uPµ­9¥ž§q)Õëóâ|.ŠÅ¾ü¿Ô¶¿¾J`k |ØkaM†ѬFÆ©øj™W9—Y v˜¶PÇaE8ð-E!NÙ¢8awœ…®ºŠT4ÛUŠýi KEŒ{&L?›¸¼P§Æ ¢.×ÝûuhÙ)• `‰ |$v?þì/6ðÔ-Âdñ`WP žX.Þ¿ø»z“ÓT „¦–” b:õí2 ¼‹wçKL®H‘ÊAú#¸>s•X‰ä„¸ì!§î0ÕÍ”épùg <é¸ù$ç e¨PøíÇ!÷½kMŠr*ÿÀ‡P9´Þ¦Í¶scÀ(#±÷¦”Pi0gg½À¿Ú$|°ì ý"&¤ŸïôêòzÞ€\4˜Ã©J›¹¤™0M?×ä³(5d:E§ßØÚÿÙ ži FœŠ8”Ÿe$Ë0‘Œ¿”,U°bðó²Ú¸„ôMe; Ñ¡ÂøL~`ÏŒER`µ¯¼KÌÕœ›,c ¿bW¬é¸®u €¬ås-˜€éõ qNý#wèÓžbŽÝF¤Š—ö¢X{]óèþ;²¯ÈŽŸr¯ß'¾à}È6ôÊLù\ªÀ ¨”[úРMòaPÕ‘M↊Öi~:ÄŸPÏ0²åbLˆŠÝÞ‚¸9Í0"J”·×G¸‡ëGÓœ«ö\Û¦¨%d綺([šå’Rb×d¤Jø2U%L4á"évRãÞÇÚpý˜žèuæÔSU€©Ûÿ>ÀÀÈÆ¸—  @ën;@'»±}¤1w rmÿñÁT >Á÷ªÍŠÛŸö”Kc’—²…Â=so!ºr¥8 óM0þX{Ÿ endstream endobj 2802 0 obj << /Length 3715 /Filter /FlateDecode >> stream xÚ¥Z[Û6~ϯð£¨YIu™‡²iÒí¢Hw3“],Ò àX´­Æ–§”Oúë÷Ü(Kަ“"`LÞÉs¾s¡âEñ"Oy¡U¡óÅúð,"ªß.¸ðæÇg±ô[AÇÕ¨çßoŸ}ÿʘE©2*ãÅíf<Õmµx·|±³÷óW+­õ²¸¾Z¥©Y¾ôþ(¤mª}Ýl¹.üàîúí–èIl²t™$ùÕûÛ>{y;pc£Lª¿’õÐû+øO2™”ù?n€¡È,-þdÀnÇõM߬»úØp­¹Jòe/W«xé| Å5í~ÿ™»Ô‡{ØK±<¶m}·w NB›åMÝõçi¹×¾þx¯Öíj¡,’?&îq®|é&œvNé[>K(ÞííÙú(U^§yÀ“„SYÅZÅ&æÚýöèënwh'W‘¢8®gj»;ö{¹#š};u¸Ó5vûÈ-ÝÎqÁ»®÷ ÏóéÊd°Jïd:Y ÃIçcßÕk±§ªLSà1Sq¢™ÇçÐÚàβñÅ¥ŠÒ6D”RZ×}€_é<¹àL‡ŽßÁd9mtfR)ãI×»í£“æªˆÒÐy [jQÒã¥ÇÓ¡tÀQ̬”E*ÒÃ෯߾ùpóöÅ‹—77sKåZ„Þõ׉ðÄ?óŠk¾ $ò•;®¸G‰|tÄm{±ÒI¡Š¬œJCۯ׮m7=Êo¡—$®ÉòXÇŸêÖ}‡B•.Ûã¦JÊ džT:)sà€„³Â‹ÆºõÒ‡¥ÁULFÖ‘Zwü{Bq²-Wš£P'Jû#7Á%3ÎXP¶¡#ˆáŒ¤cµG.4Îo½=8@¨Å!N–Nma³¦ßÚö­ãÎ,×PØÖŸ®‚þAu"ÚaÇØ-… ·xäNV"Ä}4J@ùrMØÜ×Nʸãñ†ÎâÆTy¸h"ªØ‰TØ‹vn{SØK'–ùìŽ-m :1u;¹ËLÏ:¹ÒiPß ïÈBšÀ˜é €j™$w ƒà‡Pñzy¨ #‡“íèÆ z„32fù›[Ȩ̈šYHFk~Í*u«2‹ƒö¼~ûóÏs: ;Ê<›µìem['Š†Å˜d*lxñi.ú‚Uäñò×ÈD·;œ­o¹uÀX¬ŒÅ²ÝÓÝ1úKg¾*ItVXø’×47t¤4RIruÅMúEë»íÁñ–MR7¶ßw‚ÍSù»± ¿ƒ (ε¾íÅ‚Œ¡xŽäò«,ÈXÓô¬Èhè +PÞºÆyÛ?ƒ¤&#©Qpþñ£ò|VÞ×wÞúÀ:Ì\·°±m_·;ÞÝ€2C÷äŸ2Íj'údyýÀÏzoÛ6ÌæP³\‹Dc‰\ ¬‚­+Å·B9ÚØÎîiC+m œáÊÄ- ‚×s²mr•MEt~Ç,wíÅY’:kÙØ|—Î÷ënrqéDk/ÎvƒÂ×h{'ë8ð?Ù†(è Y! ^â½?ƒäÂ@Í5` ƒ¤í´«÷Òyàœe(–Æ¢Õà€ɉA“;WvpZ_jGçk²xEĆ+/ÁjîY¨¹JG†íÂ=WîàÑzÐÀÐû´Ýb9:Tn?Ô[•ŽÛÙŠ#O©'T6Ô:+­ú`…ïO ­>ðù =8[êPùÉHô`Dø@“ˆ~ZqWÉAߨî¹ '¸Ö¾–õ˜HÚp|8[!&Œ­TY6“hlåpt#ÝY"¡P7uÇ‹×0°Ílh¸Ñ¤L'Ç ÕöTwYTgGÄXØ9Ïö†-‰ãtK: ÚÉä#)Ã*\>m«ê×ì8¥è,TÇÃtÚÕŒˆÙŽFd1]’ÂH ‘^†ùú®gXGÊÉX†~£÷noÏ-uSõëPEôc2ËøNGáL/ÿq\˜ýñ‰ƒ0 e³VN ™«Iž1ƒ¹â©f²%IjT¬³ó¥õþ,þ žfæã(‚s,Ç©PÙ%Šæy1#!âT ¬œ'fz",3¤Aw(óIè•Fʽw€LéÃܶÊBÅ盦|ëË7o>ÌF™ „ç §gw÷C™Ýµ@¼YýáØ”¨xˆj°½oÚz;¤ÇdpÈcl)zÃ/fÉ£.–/ÑæÈYÃq˜Dq>ÕÔptƒ #x…ÁΧºrâêÈb··õ“Å_Æ\ å=æA©Ý¹Ëáä@7Ñ%2)=¸(mà0¿8¡——)eüƯFÌ<Á\.Ã1¾[Ÿ=ÙB¥Ìû»—âf‡6Å{ÙŽ݊Ǘ$Åå~R²Lç“ý<þ€z?Áýå¤ü| bm ••ú2Ú9ß@àÅòËùvô˜¢-ÊsTùˆß|å×à«.Uú”È™ù6|Õ`L˜ªP…~^³2;ÃBÃû  fÅ´€KHÅ¥|äÈ|K®]þÇH’Å)€UvîØ×‘ÛçKÇù\ïèÙASR%ð‡TúÜëN¬²DO˜¥9g·ì;;5݈|My„Úð+±ì½õ]½î!†ä:FþòÌüm‚–¯Ž»üB|ö]e.q·Ú!@ó!¸““ $¶.Ò†ìÊ<úLPU5*0eƒI?IÀ®àô .l™l…Þ‰c~'vRÁ“˜Á' Lœ€@šŒä¯âS¿M0£á—Ë\âS ød¸ðnxéNpOÀ&’âe¢£/ЩÈTžN6ó'àÄŸàübÊDŽ™ɯhÊõpJn2¿ˆ>ØŠ¤?RS2¼ÁŠÐƒÈ$­m›Qzûqù »PK®‘½Ê"‰0ñ±OòµÐF¦ g °Û ”Ð Z6ê+7}Æ”š2]³¡8}E(^Ä*)áX1Žþ6HÕC@‹SÅOBjŠÅÑk¶ÎÂ%ì÷œÌ7ÌB‰S^æGåt¡’©ï?8÷éHh¹>{ÀäSf f!5`MRM¹Ä Ó†›ºäK±ˆ|bRÖžN$3œ&1P®å¥›FÁ;UÒnО¦åò·¾í&9§ ¹õœŸ¢t˜ï‹7{¢R¦#ÉÎy®_aùQ@Ê F„맸€Hä¯_&˜¤é2S@Bþ° Ë©„F©‰°eÊX0àã­ü Iï'¿œt$Ì®$”‰ @Tò|Ów|z“dl‘ûÜYIPúéG&ƒ±rŸ9qCr4¸Ç÷¾rš_†øó/ \ÛÂ]ÏNà]|¹òæ—·*ŠÒë+üiùŽØxÏ n·Z_Ç&Š˜°âª!ÕÌ0d->b•^ó±@ï$—áö¶sÕõœB\ð¢Ôß@Øa­å¿~xÅ$JHa¡oêñ²û9øÁ9 J_¾ž¦ø¶ßûð@ z Oå…rH®é”“h*Ϲ º’™,÷;COìI¤üyRîÀ¥ü8}0ær÷°ãè=|\1›:ÛXákƒ²„iºÍÆ3à–带üuP}ß œ²M‚zßT$eH­¢/ßœ§PJÊÀ#¹–É8y Žï ‰¿ë(9‡Äv”!sñ80z²8GU’Ú àiWÛÜèèË/¾®Á¸ ®ëô¼mzú¾ = ‡ïÁô(X“áÄK‚xà X.¨ðêªÄz°1æÚ`âqíæ„3 ™‚æ0’Ò~÷Œ¬$ˆzÖÛâ4“H‡a!¡ü€¡«BÝ :.ü£F„'ÎõTx~ ùU­/ó«çÏqô8‡>œ\UÛmslÁ³ŸûT@”þ?>È°Ï endstream endobj 2730 0 obj << /Type /ObjStm /N 100 /First 942 /Length 1576 /Filter /FlateDecode >> stream xÚµYAo[7 ¾ûWè¸]dQ)  ´Í²ËŠiÛ‚¢H[£+ÖÙ…“Ý¿ßG9mmç¹OñK/Ÿü‰¢È¤¤‰.¸X¢ºL®Hqí³:ŠÉ„äH2„]Jv9©+…\.j?dÇT1ÀŽ%Ì0ÀNt•ê$›²$NÔ”%ŒÆ¦LVS&®V(ï’iËR±¡âˆ C šK…¡C’Ù[B³8CEj&'ÌLÍæ,Ž"¶E†Ǿ¤6êÈ ‚Ø,g,^aA˜0® ƒšP\¤È€3V#®„ÉÑÆ ¡P €¨f4cý”†ð•6Úñc¦žmNaØ–Í%Æ©5§ZL4µ5±Š“®X+þHu)T Wq‰R™)6“°e—"ÁLN±)“°{M˜—rS/´I˜™£ùOÜü\’Š]¯ „ý6TŠ aE%[$H ýÊ&TÛxOêF?`UM,Ï•ärÜà@¸LfˆÄ‰f ÿdÆ—ruY¨M,Ìá¥dHÍSjÄ«6¬É5´±)7 3ª˜mj¼ 6ñãÌç>¨˜ &Ç9Š*$1©ÇŒ¸*laÎm%Ôâ ×s±8U¨×FÙ&…‡ÀF8¯Á0¡"~4 ³ðªËŧ´±â$‹+6„d1Á;Âðg4ò‰ ‹ e'…êìäd6?uѲ(¸s7ÿãÏ¿œy\“'Dvyóñã«Ù£G‡LÞReHÊ>À²q _áÓàÙjyíNNÜü AÕ þ ®(·"As•6_ PE2o>@Ê_aH5lëö Á¡¯¸l?}Qx¶:ִƬ™ÿ¾^½}±¸vnþûé™›¿\|¾v_ }ùß§~¸|¿˜ÍŸÂèÅòúÊÒ/ÙüÙü|qµºY¿]\mŠW{¶x÷áòÉê³»àÊ>¶¤ ¯õÖ»\C‰%ÐFǶëRÜq]‘Š9.ÞÃqÍ^$u‹Ba¦š|¨K§‚¥ƒŒ©Vá¢q ¨ª±vðe‡[Qý“¶yðºìòêãŽçKàK¹_r¾ËíäË‘¸˜=©ŽQú ;€¼BáæÈžS.(p&¢Çú‚j?Œ{‰?¤^mÓo‡p;ìÝcŸµò¡w4s¹KFœe¦’1KÉŽÅŒüpm¤¿uˆßC´¦HÔÉ‘àÐçácqD>¥8ô¥4X?ö€\Ñ—ˆ;€J ŒsŒ>ç``Oƒ-qˆ»ˆÏ”:€œ|éÙ5î1ˆé8½˜Ó4æo—œž w¢ÁZµÅï£ÎYv¶¥&fÅ@³äéÍ’Ç›àø1ã°Wº6ÈÀSh²¤óˆy$N4 ÁSPÔ§2ŽË¸>¨riÇ¢ã@\(½v¬9ã zϼÛkä‡ÛÏV¢|I;|{ˆæ/É%Ó“K:O˜Çâ"y{Ÿ23€ÒLÕ‡ÔLp±v‹EË÷ï*.$û„ÛaÕne~òl Ý%OÉ÷#O¹%àãår¥›G3«½ù˜°gFCÎæ/nÞ\·ïß>,ÿ™ÍŸ¬ÖïëÍjá•Ùô»ÉèÒΉàAvl÷ˆ O« ¸Ç-/Üü×ÕË•C$zöôùùùÏæ•£—µ‚–«çŸÛÊf@°ãBß‚N…ûRãXœÚBPjñ"ôCÎG3Oã]æi8ŠyÛ[Wõåž¹£†ê€¡29E4ߦˆòÔ‰(‘ö6ÞžnªØË+ˆao„({ºxsó~ZŠD$„½„Zv [gñöò.HK¦Á5Ÿß\º¹~}u½^\þ{u']´ô¥Á‘8Ü4t—°¡@ #©'êÐH\|ºïƒéÁ–°ÛR‚¥b¼àV…¯:-MëÀ¡µÒä4­‡Ñ=\D ó Ë÷1y•<$UŸ_1÷l§®ëŇË+ wKª†0¹RÕr[©ª~êä’…[¡$Š>âHž3JŽZ)Ú¿5d°|ü²^/WÓJVÂâæF/öÿ(_¬Ãg”†rhÕÕúõß—Ëwë«©Ë‹GG•ÑÊ% ;]‰î¹þis#u%Ò>®,ü ö?7çÕ€ endstream endobj 2808 0 obj << /Length 1252 /Filter /FlateDecode >> stream xÚÍWÑr›8}ÏWðˆwÖ*ÁËÎx7ãnã¤Øî>t;²Ã® ^Iú÷½Bc'ÔÞÙéd&QÄåêèœ{6,øÁ#óläÙ̈6V5+V†WXÇ !pØŠü}~ñ楶oùؘ/Û©æ±ñÙ$Ä ‰o{®¹˜.P0š†¶m›‹œ 9rÌë0Ï,ÃõàËüýÅxÞ,G EÔ±{b«£¿è#ŸRR$.²¨£&i1ïšeZŠ»/î¸i&±¼yçZí½aì!XÀR/þeQKEQ¿å â:èQn-Kâ®tÄj¥Â:Õ™CL`E߇0Å*úŠŠÃ¨‚yÌÔêšáºäŠÙl©¦WëìØ­C¨Š$¼`sÍ»6€AžïÔàJ%¨Õù·¡œx@«úHt¶' ÿüÅ2bxøÞ°ÃŒ§*rc؈0IÜÚ˜]|Ôªì­I<ûŠÀœ­Vn ±Ï qä°ˆtÈžÌCb{È'žñQJ±S[ðüE½m†õÿWÁ†l‰º-x aJéhµ¥”Gt´€KÖCFàÜ¢žá2Qìœ%#}Z¥"ÌMF‚›~*²Žm 쵎 îf‹·odzYWF¨\Û%mÁÄѯŠ;Qñx2‘«9˜V"è$KQŽÔõç9º–´qDYškëˆBñˋ䅨ê,,IZ{ÔUÃŽZMåÚAZ‡5nV‘e1ïZú–úö«ÅH¦Ë¼#î*6ó‡L虘ç‘H¶E’¥jb™‰åÚ´å1?°,Í<²—è~@JÞ@>ÖM –{t‰9 ±©33§Êl‰b—ʆ §€T$qÁ×tQ~H¤x6£Ê%m0°ʄw™\g=äáC äØNM!f]Bg¹´çVèrã1Ô›Ú?æQYðXý—Ë•àÌ‘D<Ï—åzýU=”u¢jØV`[Âíõ lûȳ܎¦i2YÏVyLy [ÛW=/#‰F©ù}¦†Ì•\¹Pïþp5n5iñúDþXÕ®BQæ˜OÉZsù¦ñ:IWºAa‘Ü—»rÌîeݘó¨ÈQ_âÆApw9™ÍÂñ¼'Yu‹,CÀïHK*Ö%Ÿè[;á†KÉ .l¨Å¦^I"d¯^E¨^[¸­€\ÔŽ©ã`GgÀšÞŽ‚Ñõ¬y G´á€Tg×Fþ¾¯Z¨F¨®8@b <c·¸—7ףɴÄf1IY^¿Sû¯8Û„Iz²˜Ó3k.ÕCkY›p¾U,FI}/\ñ”‹°Èĉüã‹I0¾ì 9Ê6Û5pØ£Wõñ­oºB»á&ÉsèõÉ]Lÿ˜Þü9íÕ-eú¸Ðõ”~Vƒ«ü¸ÆuÏ8Êø‰ø&ÓO£“Ë3 ॴ¢ôÔ&ÍGý Åaêk‚Ð_#ç vÜÜöR íDÔçéVdºÒᎾ*(1褎b®´ÆéøsÒܳ~ž³ìÀ—{d‡\‚÷8Æ~ü«VG[ ŽÞO^R["ü4 &£éü¿v¿aFó¼Z©ßºÖôá›b÷5œï.|–ë¢s‡Ø!ˆÁ½»›ä&ÏïðãEñÓÕosº©_ùAú È¡i endstream endobj 2814 0 obj << /Length 844 /Filter /FlateDecode >> stream xÚÍ—[—š0Çßý>”€xéõ²‡V¡Eܶ§ÛãÉBÔt…l!¬ë·o4ÁËwƒ}éñ%ÄùÍ&“4 öÍŽÙìt-½kušQÒ0ö³Ù²ÉÁMˆu[¨¬ü6Þl» ½gô@3\œnÆÍJ)ÊTͲ,¥û^ÕZ-[fS+˜Ækœ.ù{àƒº/–Ëý¼ ìvK1Ížú3ü؆۴u»eI¢—«ÿæoŸò÷,½Íœhë†Ýâ̼Y0Áüfèí^zlwذt`þ:º·Átµµ”%JQiù¹W5ÛV~¡ˆêb×3MlÛÕ{fÈ|à„Î4ü­;Ã6™Š]…ä9¾_oÙà 8UÙô“Ê8à åcHá›DvQß÷nèúžVDÒSLRnuQê’¨P]†ÜQb®Ý&kHQ|•R®wëŒÝ\è*%© ]ûúÐMÉç±ëÝÈå0y<}jÕ¶êùó`èzn(g2C8Å”ÌHAqŠxR(„ò1fX(A{½® cú2s¼Ðå¨~ÃkTÅFq5X»uÖ1t“Ô;èe©º3@§ ˜z›Í|Õ¾våÜ]A¡O×(*² ‰¤Ý¬ çEn°Ø¿Ì¤¼R@ã‚xû-¤TÛç.ŽN²GЉÂt§v8w»Ì'ît*‡•`VŒJAEíJ;qtµ­Úµ”ÿ!n0;Ræ4cãzqš†Aí+§œƒÛ«fr>ó>yþWÉÛªHR²“}#jñƒÊ$AÛÍnŽdñUÓï^è|“¬p[~Vá3wœk”« ËUûWŠ=‹9LkYj_‚#iÇ_óû$Ž'ã4k˲ç ÷V.LÅ4fŃ DÑ9’ÄùìÖ9Ÿ>]•mbV‡)NЉ6õÎÞÀŸ8®\3³eQÞ¢.,ËñBhAˆÓÚiø3oàFÒÝZÎ4'E~ìÓØ=—Æa:Z'jÔ΃‰3û}¹xÂ-àZôd(!ÙV˜~^Á"¿êŸÇ×5a†,›-7Ëܹ´5kãíÖ!ÃDŒEgpA@zºÙë\p¢ïûŸÜá?ô’áéåÍÃqgd endstream endobj 2820 0 obj << /Length 2466 /Filter /FlateDecode >> stream xÚ­XÝsÛ6÷_¡ë“Ô±pð#7“kìÖTö9òSêÑ0$,³•H$ãó»X€"e&qæ:ž±pýÀ~ü|ÀŸÅb'!KÂx–ïÏ»j¶3Üþ|ÆÝ—ʯÏþy©ÔŒ, R>[? Z³s‹¥HÃ$šß­îØíÛÕb†áü®ÑGrþ[V-D2ï²Ýâ~ýëÙźg§„bJ†¯”ÍS¿0 ˜†,)#(I"‚\·›‹ÛÛÍÏ«‹Û«ŸPŒSµT »– oâ`¯ÛǺ 1¸6d$]¼™r¢Yûx%ðšß¼»¤%ï8èªr_TòO-„g&*rzÆ>ì0*dù¨Áa58ɳŠ.iÒ3kA+5&evMYmiˆ12at!S¸-šZ)ºª3›F·+ÄÆñßÔSŠpɈ'~sA—¬Â²˜µßRBV âÈŒêvYŽn©¢yÙÒï'_\aŒ!©À˜ú‰æu¥!c*.ÀJJ5ã½À·Æõ'·ŽyA‘ÁÀBãOL³ `ŸqìJÞ0z*w;噳+MUHÙ+‚«ã÷ôpÂ_LWUö„® B„)å+\+4äö­6ŒêßUKß³]S½s\êïÜÕèÂäè”ò­ö )fΆV¬°–l€WÌÉC <òÉw]¡]1+]îÙÚòWú:H…QÎqöm\Ú!»•ÚÕ2Þè,9/}mÍ ¹}^x!q™zk²ýÞÙaE¥ÇÔÕÞŽÆÈ8Š%<Âì Ñé*áÇwYëRûz=“\úþœ¥JQ%õGcÀp} 8aõîýÅí¤ûKÆãp|åÆaÎéÊŽ­“ú»2¬ ø{¼Œøˆrc\ÀùC‡†ÏÑð6•qÂW‘œ¿­NT^œ8÷ŽÃCÅX%r)`ДÿòåÌl»ÞîH)À“Ê>BbÃé•—Ï´B~”eáv"`”$ wª‹… ‚ƒ\ú/[&€/OŽëµã#dL+˜ü3¢ƒZX¢…¶¾ü$ÜçÁSõª Û‰0R$ü74ugr7î!Œ­ ÃïÐ ¸ÜºszÉH´ˆê’‹m˜eîx²—0ŒwyãˆÈ=þw÷fÆ2¸v"¡åWMÆ5E¤Ϙ{9á¦< «À'ozXò††UÔì\mßLÕ –@sè‚ë{ÆS%C&㾞Pyq¨Á‡=esìäqÐ*Ù×¶)M}"§Ù´™9÷†´jl×Ò‘¶Ò‰’à'ASáÍ{„ 2$ꬱ-}õÖMÂÞº0QOÙ*TŒGéÝmÝa“`5™ªjô/*‚:„'!·ÅYù¶.=«xÜbh#GžõjжÝv¦rX ÖåÉP$ƒ.ÈIò¹.‹)Á!Ò ——¹K€®8‰Óq/qq|<:VE˜x×B øîBûÛ‡ ‡våŸ=`‘¶_ŸìkDÂ’±Vj=ž=ÆÆx·¢G NšŽ½Ds}Eþ˜¹®åÇúÓeq>ÓôË“äeåˆ1[œO”‹éó¬´Ï‡ojh«ú;dõiÒus|²J1ã&cØ·Æw¡Ú;›}ËòÏ)îž:ÿâbKü>£B"õOmØHT'¯îåyýÎvú—)ò éY…6v¦<" Jüõ¦k26…²Î1ôuz Y€A€f‘PE±å`eß]^.RмÄXqðá.×Sxî¢*ñþúÿ8¸Û/H£ ˆRDrP‹Ç8&¤¢pÿdñ×ñÑ"NX$£ ö¤Î÷gïƒYßÀ·>Ìž,á~2è<˜ífÎþã^*FÌB|¡HÄ,•,ÎAK¼Ôë Æ *ÿ±Ä';HNCƽaÉx'íI XK tÇ_38Ú[ò!ö™~Š€%|ª‰% 3"¬snƒ pÙî–'ÀضIÇ–לXçS7Ì(IIïû¸ý…¥E ô\Ì¢„Å ïÿai,• žäŸH¿^X¿’~žcêwÏD¶)š4=¾qÂjÿ.€_,˜´/æøÊ-A5‡R2t‹€7>—5>gÈ@ ^{nÛG\¤Šißv`fŸ%k¢ Ì«} =ÙM[#¸³Ç9RDÆAÉHóUÝêÓãÁÀ½H÷=ºû¼°m3wÿ¶ôþ endstream endobj 2824 0 obj << /Length 798 /Filter /FlateDecode >> stream xÚTÛrÓ0}ÏWøQf°°$ËÞ€¦S†>µLFåØ3‰|iéß³²Ö®]ÊÀäÁÒÞrÎêì2/„óî%© ©H¼ýiÖæà¹ÃæÓŠa\Á,òývõ棔 ifÌÛóRÛÜ»!JuîtãB’¾õƒ(’dÝ4M¥ªócUÜ .îp¡ïúÃa°s&ãˆpÁüÛ/«õvB#¹¤2ÿ }Œþþ4¦,š<¦¡Œ‡¾µ"ÆI®oCÕ:wWíxØãÀc +úzßU¦v·ªµ_AÚÎ4cf…>å>m§ºjïÎ÷¾”D5•º;ê×`à6ÎÕ•ºÑî¸WXá:”´šúø8ž´íp˜ L2G >C,¸ g¨’éÖ˜Cã3¢N~Àµ’mi‰X÷=[§-MÌÝyc/µéþ° ÛL ®°ÀÉo쪠+­rçGêÔ.x _{}îœT:c¿i5ú3ŠÉÙ±LðPåÚ9ô3ùò,sr9ÊNªEíFÐ{hˆ…G'< TÈÖO1ø÷-þ ¼–KÍu¡€Ÿ³b3JeYßW#DYG |è6žë–Ërnè]]_^bØBÞœÛãEŸ*1šIÉmÀK¨€´‚Ã9¾¾ºÞìÖ›Í×Íîó»«‹Ëõæ•ogŠôußìýnÀ»C¨;S®x.þ?‹(‹'·¡ C6‹(&.÷¶S¦Ê_¬ÎJ±—"„j"[èÇi9b))àUgÓš’®oêÁ—Ã.ÐZjg›F>|Ï ·Ä°½¬Oaé)7Yæ>”0û0~¥»æÆIQÀ•¶Ô ÓlÛ7B"‰)ì7¶bê0åygÓ”²Mëëaöšqµþœö%ËÊ2/’ÂKÀ®¼ùz9¸ïaˆ;yUwô¾¯¾áBÍ–/Ä(çñP‰erZCµyQŸÑRŸLìæÑŽ×¹Ñ01}ëØ>M\*46Ú>à°B Á6È.OëéJ…mzÕ»a‘ºÌaAc¹nè7t;£YÌ—m?*Ø VotìÛo¯:Ú· endstream endobj 2829 0 obj << /Length 53 /Filter /FlateDecode >> stream xÚ3T0BCs#s c= cs…ä\.°hQº„äÎeUgbj¬gjb dcUWN" endstream endobj 2833 0 obj << /Length 2523 /Filter /FlateDecode >> stream xÚµYÝs㸠Ï_á·Ê3Oü’¨}Û^“m:»™½¬ót{MY‰Õ±¥TIÓé_€ ¾fãÛÜMfb’‚@~!¾á/b±ˆdFÆ‹lÚÕúnAƒË'ÜÑ­€p5¡üËúäÇ3­U"ÁâHõ´?ÐáteSÜ•ùÆÇ\ ðÑ¿0±äœ/È G2Ç÷ìüã©WbÅÙhurïÙ€žÉÉpŸ·®d‚þjœçñeWÒþ)þ¨à&mÁO´fƒ~)†n—b¥[®x€ZË:ïyÙÃRë -véÍÎ-£ AÐûBQ$¦*éUúŸOŸüx8 À3«öK7èœâI!l4ùD4Ð;ß®+‚ÇqsÁYÜC5:ñõúôËúúýÇ>AtÌ¢y8׃Uw;’Q5ª¦)œúª·ªOâ(BfâäPˆõù§Óã¤À¼²O[§ú=gL0¶¨ÂûüuaÌ¡0×W—Ž'«:lÚÑŽ»=þwèWϽ®+ ÌA4$ÞTûßl~³/®?ÿõì[Ê Žÿ·KöÓßÎÅ+‚xY†.¿…Ó,¼iMBºˆû@ù‡—5‹Å@!ÆP!5àœ UV_ú¿\©iæú ¹j½j'Kõ’â_ÞúüñHß¾¯‹ñLôjö.àdФX#0ʹÎÜ“ ~ßÓ ààÒY4u¦$f`ߦ5Õ:6KoЇbÓÁŽO#ž5y>{ÑA$Bó%äWŒÇ’’:7Þ´Œr]£Â-)åÍ‘a‘âÇdgñJvŽ PI²Rù[²³LÀ’T 3¡SîÃé…?3;=dæ¡’ôi¡#¦Œ9H ½?xX ¨¡åËëºzô'fp|?߬ڽÌw"/Õ1T PÛÍÜúÅ*J&™¨#Ê‘¼Z ‹ä J>á¤d„á¤d܇®8ϳãÇ¢ÝúÔäR0c)=¾^nŒZH°\ Þúß ëܲҡ»õÕmOm¸}P7< $}Ë7Z û–6’ƒ{G¿‡2’GL$Ñ\™‰7Í+«¡"ªn_©{'Á‰~æ4ìB‹ŠŽ¨p±W-ôx뀾kK´užîM£©±¨žyòôÐ9àr7Ýî BTÁcÅHÛ5Êñ`ió‡•Ä„’f¸VÿÑ`)ŒbIü»€%²Š¥9ò*“¼á*s4²íª;^4Åsoð‡ îxy@BȀܦê ö_vB·,J¯›¼íîÖé[¼cwÞ“|zÀ<äÇ¿×`y}S5EûttözóõïÜ—‰f¡<è<¬m”xáC©i”è”w9-Îß‹z Æ!5&4¶‘xˆiÑàGJÅ}+¨Æ&?*‰û®ÐôCïx(u‘¶¹m\Ênü«½Âm\»s‘^Ò´(éù¾Èꊖš<«ÊMC«1Ôù.íQÂqwô6hdªÿlû$¸Å\=£O €]ù¾™lòz÷ä>\%“ÞL†ÞŒ­w=kNÁj¶ èS ®.ÎÏhÔ{fb¥™u[KاtÈv@¿ù&«²ÿc=žl pßâ¦ksïן±•']SØž“kú5c7yë.”D]¸7äHð Š­kEù „Õ3%êÚðhÒW°Ïl%¢]%‚Ï1VñA QR—6ç+iìrz—¬êvzVV- ÆNÒ\&4]–¹FÚÊã˷ݎЃ]J‚éÙ§‹+³®Áz¼=M+ëÕµhU;öÖ@d;üDŽY2ÞL_@d±WÕÑ@žÞ2û8‡Â̱¾ ¸æ%°ë&~}C,yø+ðË5TZÃI8›BvDlfF½¨Ú"ËßSKR….-¢(Éôºœô×e£nZAã é“ÛœêÚ'šR1–wƒ‘.óÀƒ¾÷[9ö]3436.J/$_C.ñcc߉ռÏ´ >¥ x@Mj+ -Øo±ðKGƒ¦êêÌ3ÙýÔ¢ŽÆÛ]“ —!Ä5ĉý "L0óÙÅʧÐtþý'ðÌiÆú’îÿtª endstream endobj 2839 0 obj << /Length 3223 /Filter /FlateDecode >> stream xÚíZYsÜÆ~ׯØÊèòŽ1'fòæ$’#—­rhêÉvXÐ.H"Þh’™_ŸîéË¡D™Jªœ¤¤"æÂôtO__cù&‡|SˆMa%³²ØìŽÏr?Ú]o¨qþÕ3Ömaáv±òOϾx¡õ†çÌåŽo.®–[]ì7?dBª³­pÒšìõ«×ìüËWg[)eöº¯:l©ìÛ²96ËÃÙO_?{~1‘ÓB3­ä#ÏWß? ÙpΜÖ"P–kEÜ·ã›Cu†¯gc3v—CÕ—C}¬›ëËs<Ò/L¾d‘Á¤Ñ@Õoðc®sZ¦Ýr™bB‰¸x?ìý2Yp.Uø ëðÄ?ü”oö0ùõ&g0óί¿X :‘ ¢VR;´×<¿ìËãí¡êëV)<‡‹"I!y1ªwí׃"V—}5Œ·¹˜ 6ÅœqAlK-OÓË™ÉÍŠÞ±ì®ë† òTû-gÚÉ…òóp°•Ør *Ýúî.¼U±¤µ(fPW›ÃÖf–PÝŸmUÎ3p#þ9½KÝö hÉþQí¸jÃÌ»›z‡žç†º$dßD!ÄM÷Ô˜Dâ{×USuåP· ‰œçàø‰¦â.x¶"ÏnJ$ôÿT42´ð4.ƒÓ…Aè U ÙÝÏ|{ v¶µZe7aUWõãa;—]}×ÕÃP54Z{— 4’Ö2»¼îû~I:~Ém@ÊÌXó¿¤@ýl[©(™¥>¯nVBÓL‡Cá§̸p  ÃŒ°Ÿ„ F¶â`m!k&ÐG€ðÖF©¤a“+£¸Ç[ºýÝP“nîÐc' Ä(¦­Yyžûls`¼æÆ˜œiù$¶9°­rë·’y¼¸SW·¶K°a­–v)m‘ ¨·ÒZðÜÇ#Œ„ó— °7Gê¶W´$¬-¡ÐFraºh,n>öÁL|M›ìQŽ[wÏ£÷3‚‡bŽ;šúòþ¢)××ð9&.p¶¦Â[rpþñ°Ç¦Ín»Öt½¯hN1+!‚i=éê’Rc…(î9>Úvé¼Ûƒ/ÎgHîr˜]åØƒhg‡Ð~(Ú[3éïIÐ^›«… 72×œâŸÆ^ë÷lº•4Ú«Ë+ñ¥ŠßS+\ö©L´†—fŽ1£;–?Wà±/û~Ltœ9qÞViKÞÉtèÃy6‚#öNǼÓÅÆ§ÚØ+w»¢Bè²6±/·~›0çõy€‰±ÙÅ@rÊ‹0ü°^1Ü ¬*NS£EæšâÓLSˆE*îÈä|ÿF)¬pTúãí8 Ì±›‡º©ÊŽÚ]u bê‘ ß–M­¾"‹ê|ä<¥2Ùk8ÚÒ;F \<¶8=|Xöý<%7_躧OiåÊêð¦Žãà'XÑý)é9/ á*`+ΊÂ=Æ›*·L5Q-ež½@ÇÔvä([ˆ9ŒTRhC; øñ•kÿNÓ Ì3(¡…>ïÁ‚šºÙÆ}P&¸ð6&k•ó‘Ü'`¶–Ü2<&1ÞR¡²…§£„1 ùßÃîUö¦æ¼íc3ª vvÞ 1%KžVócÎõXÁ>û8 ³wÔ®~õýz°TzŽwC?€Èï¡þ9$h^¿·£–7Ü;”™p$˜ßÈ£:²iáÏås¯ªo‡žD#\mØô¸*{´Wê}žV¹LÚhÞùƒÅÕ“pü«]x\vûjÏV /ã¡vÕí@¸ÛÓD,4n'ÁBß'È~¢AVGsÇñ¥¹c?¸C5¹ Úä†ýH´Âö‡ÐAôçÛ”‡šn.˜ †8c³n̘PÆ!"lÌP<¢Òb»;¦·ÍÊ…|L½iZôþ*‰^–¥.¿Ã ‘?Õû«@ lžT2‚»KÑÚʨ ³RŒtÍä¤Âæk&©"É”umÖõ^1W¿ÞB>ß uº¸!€E.ÜG•öYúw‹ZЕ'Ñùi²>)è€Í\Ýå·SQD·,Š@߯úNQH11ÖCclöUw¸#_‹£þûÉBFÚT>âßþÃVx9!õÔâί_½|A­ºÙ¦,„~UØ}©AOÐO UÅ‹¼öÏõt»åÛëËý83O¥Zh&yña÷  äaë¢óûʽpbaYª* ¡¼©âsY0r]íÅyïy°±¨öú÷VX"*ÂÁ`Y4ï ”"‡îF ¶›Ë1ïGwè ^È=2î­„Le‰° KOh >‚§Aw¡”wáeO³žø´‡Ï:áÙU!{)Éá~Þ÷‰P¤{«}í}¡¥9QLàLÌø#á›|1^¸)¿¥±Eíc½ëZjöØßÞc$`¢<Ô¸…÷úÅ=¯x|ÖCŒ5bãH{Q²€^9-È©ÞQöêéŽAî§­TaIJ߄×"z†±òØŽ1Ÿ!_1áæ"kª #Ë[߬Gˆq¹isx7¡QÞ†ªâ¯þ^á° “'¦ô„tø:Qý†X-627ÌÂÅ<¥ö­0Á*üV†ÇÅ(´óšŠÙé§UhdâNEÔÔ¯ž¿Jÿvv›+W÷´Éßh4€MåoK? 9dÈ'pùmÕ½iûz¸{ôé_¼üæùgü8bþ!A;é$ÙÇüz+îvšÿ<ÇÞ€xâ—?ìMðGÄdОàcá+Fo¦Êf/‡ˆOÐgõ+\£bØ—R?A§Zኺ¦0½œD¢q7o§˜žý2ÖT6Õ!iÀá’úÓ'Q’2kÚf;Ç-"e½‚£=ÐkŃ,„®åoU>òû„æÕSµõÔÅQËù»^ËáÁ+„E‰ø (|“? •Éßë`3nR º(4 Ö)q@Bãôâ©À Í J]œ¿~žÚx^@ÏÎÆCú™œ~óá£y{‚ÌÁ!Žõø®*éϳb)¿Élï yq14Ø5¢Ø ŒMû3>ðÓ_™î"‘‡±ëCû†LR¢nk¯Û€qû%ÿ’>× gÓwY…îãç²}•]à¢1¡ß ’ªƒ#hÚ!fI ºø©$ÂFð#éø¨A­¥^~Œ·û«ÿL|t`#Ú|‚ð賂ÿDÇßMpä÷££Î-¡FÔz$Wœgßýå5üküV|¬þót?J ŒVS¨„©9TB'¤°Ó÷el¦Cå‚öú`¼'#k\ç‘·™!»ï]á¯1 idøZÀÛÆWq ?7Ó֫Љ1tâ¢uè\¾ö`è´à¶kè vû/a„”Ø endstream endobj 2849 0 obj << /Length 3727 /Filter /FlateDecode >> stream xÚÍ[[sܶ~÷¯Ø·®R/K€A¦éCâ:©;OêÈOIª¡w)‰É.©\Ëê¯ï¹7a-)N:Ïxq=ÎùΔZÅðO­œ^¹,‰²Ä­¶‡g1µ¶W+.¼ùæ™’q¸™ŒüêüÙ_¾¶v¥â(sµ:¿œ’:ß­~X¿¸.nú²=Û$I²Î??Ûc×çg™Y—]_ÕWС\ªÖ:±g?ÿóÙËóa5«mdMòÈ­ùÑì/K#倦N£ØÞã«K\FæÓ‘Pt9’§1ïÏt¶.ÛwgømºªÇúÌ›­`\”9ççUŒI´3«ý˜ó7o_†(Á(õ×e ÜÒz]àO²>4mɥݙZCQ­û¢ÚûòŽ·å ï¹í¹vD“nÚªÆCô¥Œì¸¡9ö7Çž»¾-‹CˆOXšÙÄo&…΢lälæE(jýJ´-º'­6IžEÆmT)«„ä%‹OܶmÚ[­‰ ß/²Q'6ç“Û!ÊmÙÛºÜE"Ÿ×¾£)å·˜u{¬¹¡‘ß‚Û·Í ‹wÊ–™—Ð}U±ɤ«².Û¢oZîm@®¬]ÿ\nûH6M7½Islq‘ŽSÞü릯¶g®ûó Æ‘MFØØÎ¯ÝÄéšjÇþÏÒ]¶ÅCàoùþ 6WìE_ᩱ­»nŽû—eW<õö˜Zʈ[È $³¿æE·E[³Ó4^}–¿ZYêCq¸Ù—ÏYä3a8”ýuC îðFb8~\n¹|ìJ.0ã¡ðÝß¿æñ:ŽÇž}såJu)£êýÝ‚“a²æpϱîÖïHO £àŸÉ.¹¡.ËA\Èì<÷7*Škb¬[7È4¬wTÔ»ð‰õúÇØÆ²ŸÛ¶¸¹!jÌ)‘¶9ޛʄažâ­tl‹ýžpg´àAHDM@N‡H5`²¨CÃ-0vèåí–€&ŠÁN˜p¾­¶eP7â'iE’EÎÙQ+pQç¢èX’¶«}ó®Øs™U ­Šw{߇Áß®' Æâå±Þ²Ž`M€wЙG7†>(w!òÀQϯñäGàNÇÒZÉ®ü>릤äƒ,®@Z˜ÖH‰¥4ÁRE¹˃˜¢ ™Â6‘Æ&ÄÖSº>ÖÇö™rqS´¸S(íÄP¦ñ Q‰r5Ø)”º€UÌ`%Þ¾~ûÆÛû_#®3™<_¥±Šü‡ŸâÕú@Ú"ãV·4ð°J"íÖ~õý³‰™_%°#IJ”ÒÄò¢ß!Ò|ùæ39ÄŒ ¬¨ûg.@…ñÊ'IuäÒÁÌ<éå« ÑÖ ˜¥áè!\Wý§žö&ÃÄÉ\Þƒ§‚NÊ]h nE–-–øúÕ·/ƒŒ1*ÕZ÷…dàqMî?hx7Êê(VÞ¶óàïÍ ù t+è(”Í£P.raâ2|8aùa[Þô¼ O!•Š~ éÖÉ´c9ÜWi^4Ö©ëMše¤µ }DNÈû®a]UÖE6_ÜÑ`ˆQÓóL@ ƒÌäTÀïˆ2IîÖYˆ]’µƒÞj.Î î7ÉØ 5˃÷‹öŽÛ¶€! ½Pý”â{FxsÛÏ|7Õ6ì¡åd’C]²û::Iè†uÇ}/¤hË¥söXÛ5G€é%m¯+”Þ̇̓_úü2à Ž\bñO0Saá\.ãE¿yù:Œ]@mô­gWö(Ý4tu(Û÷ ׿i0g`³šáÁ#Àñ©À;Œßî‹®;ÀðÐæãH+õ[ùò · PÚ3}sœ-/®« êæ ÆƒBü;D¹14Õó`É€³F>«èv€)ΜW»€ÿ|ŒÖ(:3‚^Š\p–ºÙ¦ˆ„Ò?ºc4ÅdVÜFÉS¼"? #ô¸Û_:©ÒAtž®wU·Åˆ†ÛìÃYðáØWeY96ÇΨ¼ËH§¨ômÑB5ù| CÑ  ,Dû¢'‹Ã ±X~î2@kàgÀyºÒ–Ûò×cÕŽxš‡¼iç5^T12]ð–’(#MZFù  a{dÏàwºHJ‹4Ô4@ZÀ5ßq‰íˆÿÙœÿ4”øŸ’ËÞËFÌœ>q4qêªm$U€ì™aÕ¨æQ&æY†ib…¦Q±@ûÐó,€¾±ì SОРÀAœGó•K™°Hö€õ’<…yŠR7l8)ûg—É(F<Ò°ïñP§`|Ö8ŠõÂ:%jé2©aÔ“‘É'o„ЂV^’y ËC¤ÙHðÔCŽÓ°ê’ÃÞ mÀ Ði6W¤…ñY¢œŠ“™´¤VD 0«:ˆQàPN¶C›Kð·üÀ^x¨t2lbî¶U)äoFU„mdÈš˜e(%ïwèââuá÷Öðïey{Ÿ<+ Ÿi™ê¨—ü%ê¥ “¸|fý3ÍTúä¼,XÍt@)m³'·]´ >íIeL)=v¶Ð {#Ç?!Vak%Ã9’Éçl¬Ì « f<¢f8W ^I¢æ:7Û*[@^¦’sܶX?R"$Ö‘Ò6”zJb81¦æ8× ÕÓ¹Þ6”æOOõ2§6S.{`ÊOpÉg£6q °Æ(v» á½ØSéúCî«N–jd/K5Ñ’›!–¼ë‰°WºvE_ÈDÆ>&Xw"¬ãlrªåè9=ñGÏ1ÃV]ÃÇW±25œ. ŸßèlË@Prn¹w°âò5¹+£5vºµ²'ÑÀ

% ›¢bÒbä¼µÞ[¦RÙIã䯡¶PЄôWFÖ¥h’€–¬;Û=¡•±nä<”wåeÁF*$¸X(êÉò"¬w4gÐtÙ²÷9£ËEÞ¾~½ùòuÄO3ØrÎÞ€u#Õ¯šú²l[’æ*¤-Û¦mÅØãæ36Ð>Mʶ ÈI²RR…X£ã¡äm@ÓäåÔAû:ÑžŸÏQ@ÅõD˜Æ¡ð'„ >lPÿøš壘òÝW$9Y{§ùÏùx •¨9€¦qc3ïÔÅ3~Ë®¸i6; ¡pV{¬·bGYù’“Sʇ‰y—ØSÚ'~™ ZŠÙïûÏ4úP4éT+ØHcÁÖ·ÏòÖåhpRf–‘ ÈI剣÷bÁR~\¬¢éÓÒäè*ܘóz"(l›÷EÎëg‘ÊÌüñÞŒo“àOøÄ““ÊuSo^¿ýö[ŸU¾:„ ÞDЋ)T’Ä.ö‡Æ§³º#ýΧ¶€×â×ðv¦âxYTûOzm;@dT÷Ýÿ&O­Rïß!O¤0™û‡&ª9¯ΛoÜpììÁdÕ“Ø`r¬^~}ñ‘%>-ÉþG¦ÀNT»'%ªÕ#2Õ:DªÚÁ¥¤3Mz u$*±þq ?ÆÊ´] N“(?تï‹=Æk)\ŒJ²È?Aì°ƒxIÁÕB'ðþ.L™ñ1ÂgLØ7ÉülÇïÖ?áA¡àŸ!Ãfå%ÛNH‰rÀê´HÙe¶_Mãu«rñ™a I1È7èºû¡¦é3ˆ—+>IÃ51ýhLÚbšŸ™ïŒ†½Í‡¸©§& ŒÌøx¦Q¢“•Ò62ê“äA»8J° Hów„,…ÎËOÈ=sjâ)úîÍ=dH¯è%zÕ‹ÏŲûè XëÊ5M2«òÏý€"J²¥æÁô+z…i6ÄÏâè(ÖjñUW0¨Nì$JÃ0spÛÌŒÇÔ ½äË[˜Xn½D™dË­3¡P[¤qí—š;€H±*Ë—Ÿð™8î!ƒc›XoF…ÙM©'2µëbŒÿ±…>>ÃŽ}Y_чvP&OË7ÔWøù§• äö#Š>odAµrÐX¥?Eo‡_íÚU†Â?sßgQº0àzü¸ãÏÊ ’˜ NüYðûU3M Âݵ]==±¨·” ]9€qÄk¢Y 1–ú¯Óx&Œi,)þIÿ=ÍñÏIªèÃàŠÓ”¦aÏ>b§ó<ü4«ÁÅÈìKÁ”㈫"‡72\×Y¹d«!s ·4˜Ã]hðGî/3òƒM’C¿zÎCì8$:98õ|ñ äü-´íŒÞŽÛNOmû‹ £5]äQ'_dN^²¦_[&#ÖaS/¾ª™€}=½/‡‹ ºiá*ãp–‚oªÑø¶õà5æ—±…#pK¬ÉVW©O‚£ à®(Y—>ŽÜŽNß÷I…Xþ“H¶u‘IÝâ3…Sª0ùLâIª@òOFùÈ_*ØÙãðô{®ùÇÃóÔü{`™1¾$|ôOb=eØ#ß¡Dnþ ,OÉœ endstream endobj 2857 0 obj << /Length 2655 /Filter /FlateDecode >> stream xÚíkܶñ»Å~  k³Œø–äƒëžS±:gôCº•nOÉ®tÖ#¶óë3ážÇµ·ÎµhÀ€¤†Ã™á¼¹|Ã?¾±bcÉi7»ã£Ø­6û ^~ûˆ{¸-ng»zôÕS­7fÃ9Kµ°X+"0¯ûëCqÛ£¾ê›7]ÑvovuÓ‡¬+ë ©úꩉç\ò„3ž*8Øáxë˜Àt:SL(1û/ߎd‹4fÖG“HR$úÇŸâM¿ÛÄLÙÍ;yÜH&¬„ÑaóãzΧ‰T±„¯ØûöòÅ_< 1H@§“¶}QMÖÕ ±a³fdöKAv”ŒY¢‚%kÏãf+¹d1и…¿\óWâl®J§‹]è !¨ëßfÇ»CÑ–¿†[ð¿Íuݖ݇jm˜J’ê§Ï¾¿ FqË\÷]X™Y"Ò™.J°0쭠Π^$b~Rïú®pu·n ¢¹ñ¸/»þ&Qñ:æfW^îÓ5ü±QÑ]Àÿïp½(ü¦¶kŠìØÊ›¦>†¤!¬aZžTãZ1%ÆKɪ<ˆÌѤ÷ŠO#¼©/dÃñRã®ÍVņqÐý…rz¢û«oÈžÒ' ''uoA•Jvä€]l•RÑÞ žÐmèújO/®Ê)i;Àu}S]ðöñ(‡#f8èª‘È 0%S:åÙMˆjŽZín·¹vª€êóA,KS=ìŠƬqÛäêå«Ë"pZˆ:’ô2 >Kïš²ë /„®¦ã°Ðs“^†uG0®ÍmI×ÌNž—MÌÍÝ™H˜RÔ„`œûPZVÝ:L½í³¦+QBví4A¦Zp™dEãqí„ä¸M!²ñ#ÞÌüÙÖ*CñF¾¶Äx㉣ TQÖxªZ0î"§mpMn =°3!R& Ü̳_/´íev=zÀ•kÓàÛ&­QÉåÈç×![°N*ºå)ã"]yŒe>`ÙxÍDz*®®9†±",áLVã$N¡¿8—ø$}E^f>ÜadÐñ3¥;‰?]9ˆ“øíù´ªOÒš½ŸË2„äÏä¿€„KåþMÑ4CX^95ð“ñä'?–ŒVº««6ìž“¹,1Qyã2GÎG³š"´øÜhê7g1 ì:¢C艭þ̈þüñe‹E„X0q"èÌÊ€îtî¶>äçð𿄨Òê# Î7huÊRiAu¸ËÊC{vœÿ?O!„ͧS‘F¯¶¤ïnâ’ø‹ÑBãȾœië Gü|,ºÛÚó90£4ȉÞ¹¹ðR³‹‘uì.ú4²ÍØTšüø7©Z0/ç&þsè\Éâñjž@š"¢¿;zŸ07 ¤$CŽ[O’pé ÏØ;/5ƒ3Lˆñ^‚òVXmˆ/¸$oY‡…P%Px'÷ïw)ˤáP< 4ËÄjuØÏâ°ŸCäXfã¹?Â;¿¦˜ê5"«Ú• þTpåÛ’òS¡xô¼&sÓ8z’5‡š¾ Z–D9v6¸ŒžÏ’‚· Ï÷K×m}ètN·[ÿ¥ñ‹Cò‰‹e2XicÆÍ<*ÚŸÖ2Z¦ âùÇúŸ ‡J9u¨T¬[i‚‰ÆdR'z[pœÙtUiNáf‰QÏcÒ—(s‹‰Ëµòv]I.ÛC‡ —žH×m‚kvÙ¿H’èK‘]ÈÚ¿£~aN3ïfZ‚…ðÔü—ªîhàпßÃê1Â`ÇÃ÷ðU0ß)¯_¿¥}ª¹ËöM.% “j'þQm=G”w€(GÙÝ]S#AïKÅpð†F¨ŒÑ‡b3Í›º¯òmý:æ’FaÀøXîo]GSr¬»C‡>7;ÌÑ›šr¿wž [ëaq‡(nÇ£é"œ ÌÙP ÷å È…@ÄB=(MttÓW;ß'„Y3´;<¨ACÇåŒþx%2}’íVÛØ©Ó4zÖÑZ8¹1Úј’ÄìDk¦ÞÁ»Û“6R<†1™¨¨*Haü”ËÉN¿pÙ×›÷ bÅÖž¥P[™jˆ4«v/Õª‡Þñ/<ÿ†£ìoh²÷6…Â4Â3ëw>6zñÊkã—™á¼+Üåw‹}>aiiÕx¼þ1“¬–°#G[Ó Žc ù”e`JSd;œßúw?Íä ‹¸ix˜zÐQÂ…9KÀ`ûÕ²óÛ9Ð'dôWü#"‡Â˜É¯·D‚WÀâm_T»b©i}KÚ¥èÇ•àCé]Pj ¦7¼€€s2ø~Æ ÅÛ³Da ½˜Ñ Q`Þ4â{úøû‚ÂhœÉ¬í€9:÷íÅÑ3Žþ¨¥ê ٧7ý–vê¤VæeÛ5åuß-_…¶‚÷³‚+ýIYž—Óãù*:ljOΤ²õ*©NªÌºl>)1Õ–53‰Agà†Ñþ+ B¬¤~†:)×D䤈ܕŒnÍùb1ÄXh雯Cêät ÆÞ“ ›°p¬°¼¨Z’çÇCú‡tòU·rõ“Ÿþó•dø+ð§&YøÀ‘u¥ƒu¥Ø”9f¥_t•ÏâãL9è2‡_º2¬Ìi‡ß±FÜu9¬‡ÀHSº1HÁš>ä}Ú(<•8)ï²õçOn‚-a®ëÌ÷ía¾T/‚­|ÕÿûÃлm’*—PZ—‚¶K,¢úº-š)ìç´Ú•ÎÈÁ.÷:½#‰$³âÒ!t^(°ºM¾L©«¼žºgœâô&ÛAÉ´ÿX.œ±Ò(;´NÛ8%%uóKKS/Þë®)ºbœM·ì¤@X¼ JvÈe¢>ú­@'lu©vû5½Þ?óà9Õ…Gçª$‡ÆýØ ùå¤8v¥˜£ÏÑLÝpºvZ°4T+:œ (íôƼn¦-†Ïú\g{B^úË}…U8¦ÈJDÏaìRKŸ¸cBisè1„ù"cï7|UïÛvá'"­­×¥‡JYbÓE A…Ê€ÿ#6H EëÝîÖB%ôÊùz¯µËZÿS úчŒ†g˜!Ç71Z©Š}6ÕÙøaâ9ðk ”œoIü]-Òà endstream endobj 2864 0 obj << /Length 616 /Filter /FlateDecode >> stream xÚTÛŽ›0}ÏWðh¤âú‚1ô-]%[ªM*eIÕª­"N‚D â²ÝýûÚèfµT]å!öÌ™9g.†:Dÿ¨#™#CŽC.ì<#ÖÚ8lngtÀyè]!?&³÷K!JpD"ê$‡ëTIîü@7§ôÒ©Æõ8爒®çû­Š6Se©Òªî[×c¡/%b\º¿’ϳEò—P0…ÏߨnD¿’(µD‰þ(‘˜˜›‘H‰ë‰€Q.EV—ëQ”ê‹•§5A s?`&q<áPŒ 05)ZÙÀî¤Î&º+²!úet40e„''í9ÔeY»,D¿MšÂðÇGç4kêP§Ô@\&Ñ·7DJUpÍÕOBýJåw0Å÷v½Ýìâõ2^ÇÉ÷)­Bâ@‡pL…¢Ê‹,픕é«e+:£êÉØB]HNíuÚPG„.Z©DuQp6{îϦž½u«¦£©p†ô¨tª0&8æRê­Ê¼î÷¥šªˆë1|ÄiŠõRÅ J5UZ–OSÃ< ÆÐOÛÛÅîëünŠÄãB/n˜`ߪOå÷†n_-G¼Nv«ù7ƒ¶³{Îf=ñúŸC#/Ç¥©y=-mK«g˜‹y‘Ø£wÆÁP£Ú ¶g>ŒÚ¢¡{GŸ¶˜ñ=ï¢5í¯hãû/p¸¿¶ÓBÒ&‡‰¼­;Éf»˜hÍr~w¿ø_càÕÔæ#cQ]Y[ÔÕøx}êúf0>¸"@iÙÃúûHïç„T2ì31Rµª›RÃi8‚}•uš¼ÅãWð»Ð_A endstream endobj 2867 0 obj << /Length 53 /Filter /FlateDecode >> stream xÚ3T0BCs#s c= cs…ä\.°hQº„äÎeUgbj¬gjb dcUWN" endstream endobj 2869 0 obj << /Type /XObject /Subtype /Image /Width 416 /Height 291 /BitsPerComponent 8 /ColorSpace /DeviceGray /Length 3103 /Filter/FlateDecode /DecodeParms<> >> stream xœí½nãʆ_n¸UR$àâ\@@_A@U§IC©©M Hº4æ%hˆY¦ <—àÙ\À9žv«xŠ,’)${½¶(þÌ)½°ë]Ëôèûæ›QIƒ6÷­7‘`\µÞ¢¤ ØÒB» °¤…¤5Å}0éSÈž£´FPm~fê=!Gi$øßJ†ì 9J› £ÿ„6AûBŽÐAw‡?$.×-ßO_þ"Qi/³É$  ‰CA‡‚&M š84q®è›Ø½ ­\É$Yrãgº\ Äîi…cÐÄ¡ ‰CA‡‚&Î1A2I’$Y I’$I¸­•¤Á»“#FÀ§Íþ\\Î]¡±h½ÿúüÙ¡6‡‰Mû¡ÄŽ :´ºèñëx~¾%ýõÝôx†ÛvTI;òðG›Þ*²ìðüå[E¿;£ È}tœ‘ H³¯ÿî­¡k†ãÌ;$Œ‚Ñm1’eØÇC–áU„8ç €(xRŒ‚2PPïœå)Òl¯ÂŸŽ÷\÷¨Î mž«® ¤P8ÈT£¹ð1HBB½Xò4ͧ¥¼æRI£´ù&‘È‘eiÞú+q¸8AZK£_›)Ò,Í'.G8%èÌy>þôåó§—ÿfYŽ<¬˜gN ZëEXŠ,™§E}'•VÏ3™4ÿé× Y#;àœÇ ¥Ô‹›<ËŠ,Ã"ŸKä­DNqâFcó@?íÄ µ`zë f™¥@~O?'‰Az©PÜqmç4ñ"HÝ(¬î駃h‚ÄÁí.ֽχX)n[±<èE$AkìîRÏÃ"Ž µ@Îá§1Æ C?ý‰AfÁòº?á#È,X^ ¸ ³PX±¼îMhAô3À‚ÌBqz:ˆ°E‚Y(ìxö`A#È,.òb„d «Û€wxÄú` áÑÏ( ¢ŸQ´¦ŸQ„´(ég‰ 9ýŒ!Œ zŒë££"H­‘ra!é…Á=÷·Ç@Yìèg$-øæ¬Ñø´VXñÊ£ñ.Hpd…oAjÍ ž™%R^ûÀÏ‚–·,àlð+h+¹ƒj‰WA¢BÁT;| R[dwÛ¿< 2k®ÀÙâQÐZq…Ç‚ª+Öx¤+ä,ìñ&hiÀª| Ú*ÎPàI¬Pp Û~™5R΀œàGÐZsr„A¢Æ†×@pƒAz‹œ#|b…í‚*VØq/H³Âv‰{Ak.ñ¸Ã¹ !±a‚s‡kAfË5R§¸ÄçÇ‚êüpM§¸dÖÈXÁ9Å­ ŠST×8$+”Lpnq*h”ç°ãRЖ› îq(H ÜdpCA§@p'H ®ñxÀ  )§@îq&HHð#ì=àJá6·\ b…à G‚4×<áHÐ)È nI‰?ÊÑ nq—ÁN [–Ø~p!Èl¹ç ‚*&8_8d –ؾp ˆä{AF`Åò†½ -È'Ö‚´àÕ'Ö‚*0€|b+H l@±´å>ª_,É+.òøÄR"øæÔ§@ÊÎßþ$@ž9%hÑã÷¿cùåTŠkº¸~`ùÅj ª€\u„ÇF–ÀÏõ„ÅFPæ7ïXÒ¼&©w,U  ÿŒÄeì Œ$¸Œ‚Ñ‚ (£ñ$BÆ 2%(c Ã.£ñ,\F š#PF ª@'Hjð´|Æ ÈX"„a” ]3€B1JWyÂ1F<*Œ1‚jNRÃ1FP…‚WM ÅA¬±C2Bkì Ä;(ñÆÊ`A¬±Ã2Xkì° Ä;,C±ÆÌPA¬±3PkìÐ Ä;4ñ=á&¨ÖàQ„° „ŒCPX b‰žA‚ßœA‚jžÇÎA5WÂ3HK„ð dX"D`€ –1 ¨FÁ!8ý)Å þ‚j¤žþ‚J®“†§· Ú0ÃÅ ¿ d\ÈŽ@_AœE¢¯ N‚"ÑW'A‘è)Hs‰ž‚((=ÕœE¢Ÿ Å Xô$¸Ì‹~‚8 ŠF/A|ËI&‹îç·­Šk;-ÚÁKÿf»Hï­÷Ž›Ý ùЋάв” yõÅ G;Næc¹sÑÌ¢°Ž •»xbd঳7m‚ÚNË Ç‘ ­¾sÒŽº±ÝÞ+7¯\øˆÇŽŸhKqm§åb!Œ?Èa9Su:,ëÎ1¤EÐÔNËÕz×çÑœæf¿¨aÙJ½N’H»·”}üÝãa‹ ‰–Óé-`ûÒ‡Ò ,‡øÛçYŒå‘æòîÂçøôè›§æ)ï1Óíâ OÖm<¤Û.¯l6Ms‹;ëþ4Mûu§‡¦yÊ:›i›ÏÞå@nÿPö/Û£Ãk>·íÍÆÍƒ:<,ËGu—#]uk汫‰óNkíÇ endstream endobj 2875 0 obj << /Length 2868 /Filter /FlateDecode >> stream xÚÅYÝܶ¿¿bµ€—‘DJ¢RôÁuêØEƒ¢É%)äA§åÞ)ÖJk}ؾþõ/êãNk(Ðâ€5‘3ÙßÌp£]Ñ.‹w™ÕÊêlWžoB¢v÷;|ÿíM$|`<,8ÿr{óÕë$ÙE¡ÊÃ<ÚÝž–KÝw¿//—ý!¶kŽÕ§ýAk¼üZžø0Ám·‚ßÞ6{ຖ¾:ŽåPµ ó-?¿/šc{föŸöÖEWƒc·®q]ÁEa®£ Öùþ·Û¿ÝüõvÒ#‰•ý•öÜÏ4Ï@óLÅQb¼æÆ¨Üê…æ°¿hžê5NÒ˜ÏR|à!h œ¤5I¦Mƒû…iµÎ‚ªgúðà˜ÐŸ‹ºfÚ¯ad\}dz{bbçzWtå>΂ÿi1ðè芺göÕ ÓE}ßvðv–ö€IGÖA­¢„5èDGK z¦œ:ž‹q.Źvì™p¬À aŒÇ£ênDM{µ?da¼˜«’…Êö|F; ¥BZÑ÷ãÙ #*Æ=µìßÍÇéˆX €ñŒÿï8t:Ô:÷Z·ò*òâ°@fÖ¶ª‹»ÚÔ& ƒÛ‡J8ª‰6¸tí}Wœ™æ!G2옡ºåyл÷£kJÇo| 6¨š£›ÂÛqäÊgÍqK·ÊsU%¸Ê#ð’åû¡C{»#ÊV˜ØxDäÁ©^zp”ÆÊF¥´ô[^nUª­çø5LÂpk¥\¥yæ¹þ´µŽQÖäž#‚…"–Ô{›^x{RpÃJÑa˜<@ŽÿËR„‘±‹C '*Ï“•§³u×ñÁ×"W•4¹Š€ò%-íS-yÍ•1ÿqbRÙŽ]/aß9¿ùG í¶óqArSí$zËB€£qö“_gs4³O[Æ¡_mDÆ%»²wºCbTž±r=°%ø[ ¦9švàñeN4Ž) êðlyœA¯ Q+ºG¿„+«žP1 ݨãÀã~µí雊Nöœ_¼#\Ùz+ˆ&èèÁÌùeÝ‚¹uê2„‡3d’!4…>¹#Œ×¸„îû‡j TÓ ¢µR4ÙsˆÛ5=Z jî9£÷c‰Ò

õ¡:¥`έip» ¹“tñxù˜BU‚—4e_Ç[HžR:Øw,µ÷roBì­¯2‡ÊÀµ@286P‚ÕÜ‹ç‹Û Z¢wã±=|æž5ÎóíKœ˜jDt,¯ î§|%†#X¢ª?Î-›>¢¦SÓ³Ø-aç¦ä¨2dOÍí\hÐ…~ݹãèKy61ò N®Ÿ«÷£ë_l^SÒµçKíxÌ—Ê8‚3hÊ‚Ë[x]õ;(±]2Ÿ¡cª:¬MÞPZÜÕmwܾ«&X¢*{ÅÌßo¶ ÜÇæÖœ èýXÔ §Ähj¼ å++·éÄÓÌ›‹¡žWàËà /ƒ…Òb7U?N/ë Äõ¶Ü‹Ü1¶‹[S|Á¼-.É¥j4Ée£Ù3òžŒ=ÑFkOúËÆÃLVgA7€ù©ú3`2ÊFñ¢ ¬Ú8 u¶5–ËxÈÑ&›[( ÊÁ5ÆÀÀ¾[ Ò¸®ú·°Vƒ¬$ÖïÐ`¨«µÁ-u Ì²¸k5ç<˜jvc—÷OLë¥ Ššæ()=bцAãÈý!Ý'“D‡Þ Ó"óz¯\ZщYóÔã”òûCžó Ó³|гOOÿÀé‚8ÉX0ës‚Ûü¡âìó}®ƒÅoèÖ¹aOÎ}~„AÙöƒÌ $i<ÁÉ›—<í‰Èã"oœà˜žUËæD˜K"Ïén<‘@µñ²4}õD19±þIyø¬ä»pçf}â«Ïjn")«3€ z©×³ü Xi8v2rÊol¨ÄÇV²q²8‹•Ï"T"”ÈÍEÄ·2Œi8¿ÙÀhÙ‹îÈ\OHCÑÕN;šÌN?_Ÿå‹( †ØÂ£ÿ±‹(€§1 y'_Ǫ†â°’!NCëÝÔ­£ÑЙéN+-Çzà…dÅ0èkîα€0ø«Íà_ÿžXb, endstream endobj 2876 0 obj << /Type /XObject /Subtype /Image /Width 410 /Height 247 /BitsPerComponent 8 /ColorSpace /DeviceGray /Length 6403 /Filter/FlateDecode /DecodeParms<> >> stream xœí?lãX~Ç¿s8$X É[M`,¤Xa»¸-8H!U™)˜"@`t“†&–µ&ëUaÖ,Ž#¤´ XE°*fŠa€ðŠE -“n8¼ H.Ä)$Û’øH>’äÕ§XíXEû«÷Þï÷{¿ßï=» <Ânñ£õ£¶z’¬¥‰§Ýû8`-ÍÓvïã@‚µ4s„~»7r`—•4á¿w˜Ñ:ÆJšé1þæ0£uŒõ¨¹Å_\´éÏî ê=»íG½¶oæÀ&«QÓ{øÏÎð£ü—h‡ƒ4å Mg9HÓYÒt–ƒ4å Mg9HÓYÒt–ƒ4å Mg9HÓYÒt–ƒ4å Mg9HÓYÒt–ƒ4å Mg9HÓY~Üö T òà_ÿ@ï¸å{©gwÀ¼åûø!ò.»pæÇX}ßæø <^ÿåóÛå¯ÿã÷B¿•þëÃoÓßúÏ?yþIM·Å™r®2Ÿ¶.}zvÛoàn؈¸ìÍ­ëóÝ'üé|4/|.â% ¹º ŒÉ›ßc¹üþãbõd¯ßíARÝàxÿ¤1æoÌÛÞŸNWåY’(¾$«ŸÅ?…'Ž'š¹~MAu_}”æÅu£Ça³Ö… IÜ|ip•ÍÅÁ·‹è¾:yÒtÑB WÑÞC ãÔ™ÀP’—а¥ ˆ$aùÍ,ÀtjœŸó-Q ðˆó%Óé¢_s¼ZPü•9/ÎæÀÐþîZÙR&˜<þ<Þº‚ Ý¼6EDÖ •§éé¼ˆŽ¢M"uqÔŒŒãc@E@è8 h‰ñ‚X>ÞÿcìÂÜ~ZдÀuá8ýQœ(‰¯¾ý³ãfœ¨.®50¬ÑѯŽZI&_Ëb?ükyÛ åE_»1ptÉGW ö²×VòÖš.Nh¸z{„Ë·Ç‘ñ”¢ Î7•àÝM¾ˆ˜ßÙBõ—iÍ_­G U½vqBŽXVhŠ@}…¾·f0Ñ;‹"å…Š²á U}:ŠQCv@'G 8/ŒÊk“®ÌؽíÕG´c9 ¾Vº±ÌOÔÊM+úŽÀwšú;*?PCHžM‹ ñvíÅŽÕ”«)¯5²Òº£ÑÀ˜ƒÑ¨ÚeXé¤Ã„¯hKÌšñ2y_J©oˆ¿žG×Éé4êqSf£sùÐ8_uùópyÙÁþYh‘1ð!ݤ+Äï^¤>#\_X'û³ûÑ9iæ'ȵ—²ÈXÊrú»g²žþäðÍá êŠÓ“&2!†o2V™XÓW¼ÝIú³d¯N·¤ Öêï—J,Š™þ4±É˜âz>°8¥o°I:%ÍôÄÏ2€ í¬çE賌çɵG` öaRë’4ÆY3kÈúLÌTèt×sôFÄœOä¦^º#MxbAÈ0ÌZ ‰dÇò2ëäFC4°ŠÞ_ãtFšé‰á - ¶ d*€b Ÿf¿Â¼&0κ>©uÅå4,@ËXß9³T½j7ymO\NÕñšS†pÐíp&:q ¾ÉpW ø"Ë*Þ!>Íp=¦è¬ÓM-» ?ð¡ä-ﱜŸIâæi£Ü¨]öp: ?ð¡ÙùÊh”æ4ˆ'¸yƒLôDXjwö¥qN"ØyËLN ¹¦îHo!z"œîzŸ­Kc¨ ^îxç’ˆÑÓÃÐ+Èÿ¤« ®Û–Fµ@¼Ðݼ @ÑÆyfXl á £Ú´,ê@|“ãgòƒI†vœ+ LQGµi7£FuÀôG÷>WP¤ô]ŸÇA¯ð·#'ÂQ‘„¸VG «2 c LïR< êwpü0Š-J8ùî ¨ÅšmfãÜ—HZ»6jÿÝÕÕ»¨@Tµ=i¢%Ïyöm…O™Lò\O@l@›yx wYàcZ“f¥LîËb5¶3÷ÖrðD7Ü4 Ü€ÑLh¬ÊÈK¥@ ñÈ$?öV¿6Ç«ÜÑ"¶`KÒ0*ƒ­r€Rz¢ú¢'Ö«Íñj•1 ˜híHêŒH•Y…òýñºÞqÓ»¶Î¦ÖIX þ£iÎØ”Y¸"‡¿–h"¹Póœ6zÛs棷’G[q9Õ9“2®_–q5wQÈK†W‰ž«½úRÍ® ¾¡Q£:lÊÉ2ÁR°]FôÔÅlZFuÀFòâÆÅ˜ä;®¢GºOk^ÕK9³S– 23¬7ÝÒ¦¸4‘1¨’Òm°ÅÍ9N«{*…"æîHÍÅ¡ Kã¿ðG#ÿEÙûw,&eb=6+¹š»¦°QWö¤ K£ŽnÏÏoGiµy9ÌU,Êȹô‰\³„ Øð;²']TšÐ¿€+¿TѪ¹Sy·”úõ] ~7òl KÓ[Ù+#M8ˆàåïib¼(¾ßœèaÌ`Y˜ œ’s_ŠºœÇQx ŒJ$¥Fglep×’È)Ú1‹eastYÇ £pÎóYôª‡è¬÷ªøgø u+é± Ù';Üsž¯£Ã8‰ŠF¨>Xüù¡È@ýì³Ó¬ú¦,–ù®'éFX °4½·—Àe‘0݃-<œæÙ¸‹Ó¨2 7XžféÞC<‚öݛр󫫣ݱ 2¬ œ›l±v¼ ‚°¸ž¢Öëoš Ôø*“«¹”©Í³6‰×VV\.Ææ0…$áY©ëó£!iÂH~Šb5?éücµ;!^fýú=ІyË&t3Ò0šÍLIç½Â,f8…¼úõ5¦§Ýò›f¤1|˜ y1:Sàbõ •ÝËÉ«__ãˆ-›iHc8` ‰}Îb(@Ó`xQúvD‡%”؃Ê=Ô*ÐD™íôŒ1–•å÷ %§³",dßÖ× ªe¶¾Šdc¹J’Ô€2Lø-šõKE,ʸ_ä‡x¢Ÿæ‡4Óö¢ÐõKsÂd¨ WI:/CÀ°EX­U°×.1C}l ÇL1i~ØLa »j8¯-hP·4S R¾Ùç¸ã±„ˆ—±ñO^œ=¯+¢S³4¡ ’︬<çKý: š›žá ÿáûhÀõ¾¨Wšè,‚“k®<çKý:  Ó£Vÿª‡£WQ=Qƒz¥1|˜¹åÍø¸,ZyÎÑ# ÒvzT @oTcZkγã`ÈnršdÕ…xÃã³ûS•©sÔøSžæFIJi˜’E!ÝóÎfò‹Ìà‹o–F¿6dzú¨‰rͽU&¯˜|U§•V]šì錥—b·‰3Á«Õñ¬,Ítš5YN¿è6ߺrº66Am–@Ui"Bz«EwÒµÔæâ Í8½~ØëJâ¨*•µ³éêÄk·¾™ZÖŽô°¾$ŽŠÒÌ-(©;›Á˜éH”ÎcgÕ¯×7¥U“&RAR­³æÛÏq#žÈòÆY7vFýzV‡öìÙIiϧš4V2ïì‘ɾŸŽ‹Ééãnœ'º©[sš‹žj;?9zûn¤–5¯+5öO0L_æc·“Iç ¬Û¤ ¯~›^tœ¢OMµ}1º0UßѽÒZ› « _¥?KöU¬ þåãH!å@bJ»‡(¼€Q¯¤™PEÃÇEšæ6Ý€–#)»~Aš{cа(!èhÝ$¥l$§‚4¡³S°®·ÜK« _·­et)§ºž&5}Ôs ôK¶K« MF„fâÊá˲Ü%)×_¸í’ÁŒÓŽ>–4L)ñšKóQIiÊGž§sh)Ó™;f9¬æy`4’ ÅÄE°ùÛÊr¢¦l£_¸´Ü§Ëè¤ù¨l<¤´…½ˆ6,˜-fj¡ýæûíª.™Ú“øTIÈ »iÇVÌT\Rì­0ŒŽROÉ̳ÐJ+u: t8E\Í`ç± Ð×P®NCwa’"UéÊYv­IÐÄEÛÏ-w;Œ)ÎRÖD›€w˜³¬4Fj„†˜g&qç±Ã/­•˜ pïeWRÇ™¶Ðm?·žÓ»Ò+b§9r)ÎMÊI:èɳ’`dýÒM/ ¬tô—Ò› ”“&Õ¥ÑOKdèߨšý¦ÅÎ(ñø ùô Ö£‹Çt×3Ź)O)iR]Ý-•=C3i©6ˆ>«Œß*!¦ksÁ¹V­Œ4‘šÒ¾Ñu…ÆR›9¬Ç c@B±é5Ò¼³ ËH“æÒ¸:aiëØ9Š:VŠF×f˜ºsSŠÒø†4Çe*ÏùV¿Îw3º„4½I`pÞ½öslÜß5»£œR¿.(˜óË´-.5ÇuÚú´ƒí瘸¯–*,Oùš<‹ KY¿Ê6âë}𩘡ÈlLnè΃ˆ›%PX#*òíÚÌ÷ïß¿æÑGz]:‚ݰáÑo˜Y#LÄÆ©y¦{Èðf(IÊ›2¿Ï0Ð8¤>±&ÖFÉô&w²ŸûÍ)ˆåËè•x¬ï|IM92*Ö峎š¤ ð4*Ïù¬_—8w¥™; `ò4*Ïù`+ÁN÷âê–£4”½€ëëƒ2ØæÎ¤B*ï°ICÛ ÷4 &›ò•w˜¤‰v÷â§âÎp%ÞvoÌŠyLZƒîœßüÈÒmw,ËA¼ùW‘—VÅ ‹4sÊÖº¢)u­2Óc‹öŽÈ³e]ØÌ›0g±QáX5– ÍÚq’uWlôq6Ö­±²ÏШÑÄù¦ëIªe 2HãìäNº˜­‹oÛ»ÅÞ®_7…*–@¾4‘±X°ò<…x±XðmÈqÿ7©tGEm;[ Rí@¾4Ö¶ À'é<8•eù§¬ÅFLÜG&Z=&ÏÜÞ‘–ªÔäšáN]€¤½¬®Ìª"ÖEŽ‘‰¬¾¯í:Â6Ù:ÄþÆ«’—Ê5‰îM&‡¯å׫¿"W÷h]%µ¼M±ýç*TæšéÊãW;ætbO-]qb¬úåã_ì⛥ú®ÜUòF±™DËi t rë™½Ç #š^'š©¸_>ÎD+m äH³D#œ‡=êâP‘èÚ”O¯É–f;‰FDN®öº‡ ½Pgï=²±#]:½†*ÍÃÐVA­Î1éÜÓÚSÍaM<îH—N¯IJãž<[é(Sûæñ[].”–æQ^ë)Ô¶B¹PZBšã9DóþFð,>=l8— >½/ ±Q"½&!Í¥eÑÙq_ÖÁ³Xö ùb÷ø¸¼?X©T(-!Mÿ•õüä9^ÍkMœFÿô¼‡°ÀE‰¬´¤_3úðêêÝmï±M_<™¤ó†=¬ËCËTªÑ¢ýþ¬ÚÊÄxRIç #>$ª+ÅóÓSbh™g?ÔÊs><Ö¯ÏJK‘ƈ°žÎ܃2UP”å*DRŠÐti|ç¡Á¶Wýxø4öÍ:t¯ícG—f£Á6µŽô;÷ßlAÁ¼M•f:_õÅ^Rú|(ΪÁ…PlØP¥1V9±údªhÛe2™`ubtç†&â+±(Os²il2v %8 hŠ4Ñz×Y”öR»÷‰É—Ÿ}¦f…²Dè3Ý‹¦H³.ÙÐg‡ ãñ˜f-Ë¢=XíE³xR6 W%‡ #Áª4!Îl<´nkW¨À3)ÍÊp^>­ÊóYì<ÒQÌxR°¬#‘½¹6œ…káàÐ0ñqç1 ó›¥1b¼ðֆ3†‡ ¬éŽ«hqzW+„ Í•}ãþ;Liä›À-b@ïH:$n©Í? ®%„åè¾±®0 wÖ+‚ËqÚY¨(Þâ±iW&߸¢¢¸Î9S]ô¶4sÚ§òa¿¹ ¬GäZÖÙ뢷'4 äb Ÿ``¦ÊjûAÑ#zÀj@oIãÌq1vy•t‰±:[Ìt¾'–A´q>ØüÎMi" žd`±òØ;HÚ±|Îf@o®5V[ ´§§ÌC/EûEkJŒ¿¾Y8—‰sÖlH:$Tl}×M¾_?æxì ö—,-7&´ô³Ð÷žÏ×ñ „¿‚ãã×9_”Giæ~÷ç5ßS[ÜÈÚ‘nÁßÿ üÛ?g¿êQ ?úM«*jDXÀñhyÀá'ÿÃ`@?Hósü_Ñ3ÏÙääi€+olpŒåb¶“L?êw}MÊ*7þGö:};=åí·¥|­ß…â†Ò3ÀjÚoŽ©ÁÒåæOƒE±8÷Ô=Åõ5i(üÉ?þ$c¥‰;oKù:Ë¢á`âýì?ÃORž V£æßñ§OÕè âßýÿý¿ôçœÁ*6½5!ðÉßÖ´ðKêà¯ðññ§ñ«‚þKÚ×פ~àÖçQïqçmÔO “}m:?óîþ…ž1ØÿªŽF#àîîîîîîCÑ+¨™£Ûµ4w·á]]ÜÞë¿Å%úÿèã²Ð%[Ú×פ~àÖç%¸¶ß–ò t²¯Â‡~Úï| Œ^ÝÝÝ›ýV¿"?DR#5†=êý¸‡q¾¶Ð¦G‘Gý­¾cºdŸþ[_“ú[Ÿ— ×ßy[Ê'ÐɾvQîÿÏî8^ô@ÇW™Ï>9ý@SFMkø½ìYü Mgù ºç endstream endobj 2879 0 obj << /Length 3391 /Filter /FlateDecode >> stream xÚíÙr·ñ]_Á· +ÚÑà˜K•<ØNä#±â²¨$U¶À]pw¤™z‘Ì×§ݘ‹ÃC)Æ%;)Uq1@£Ñhô HœDðOœ¤ò$ÍT˜©ôd[=‹\o³?¡Æ÷_> ·ÀÍòó³g/^Åñ‰ˆÂ<ÊÅÉÙÅÕÙîä‡@êèt#s•%ÁÛ×oÃï?{}ºQJo[Û`Kßšã©Ì‚Þ”§?}óìÏgÃr±ŒÃX«GÒæ¡A LÂ(ÖDà±2´ Ú~‹dè«©û®8Ú–¾Lc±!s*ÓàÃiœ¦(Íyii¼82ŽÎw¦ÙðeSïSUÅqOÃeqÞ˜¦°mxºÑ© Ζ'*Û[`ƒëªlwÒ ×¾‹ºAÁn7B…"´ÂMþ€lÓÑbRÝÁRã‹?½¢íG»µmkš›ÓLϱ/l¸Gªt¼¶W]}ü]K°2¨£Æc“"ø1Š£K7P—7Ǻ*ဠÓõÑ”(hй– ×Ee6³½ÐVp®›– ü¼ è˜m³åNØ[HpoÆãËëi[»ë›S¸ZØªŽ’ààh¸r˜ŸáóžÅò»¢5;:yGHgö<ÒLç[ö†¦«¡ëXwkgf¯Í'i=î^8–A»-k$à O"É& cEuYÚÊÒâ,­§Ÿ„FÌ„æ%"ãüúõß O¬µv©eZda”g'I–„I$–…1ŒA/üÒ©Û¼gªw~þf‚`Eï–Ë8>¼±[Cµ@²zîx ­0eá¥;É@ˆt¹'!t'ùI’ªPÃŒû-‡‡ÞLÀWv°DêÈ@éFéyð•ã4Rt§E&Â\¤3ª>†Ó~þCt.–™séCNÇÔüá+b´û˜ð4ºÅS¥d(rùHžzèh]"xJd€rP㻇x«EÆò?ç­Ÿÿ½ËeÖy+$3÷»™Ç´ÂÄàÃÑ )o 1ø1“D¡Šb‚ÞLÀW…xŽt`xHT‚kÌR èRØ»ÈW§™rf]¦S?)S=7é¥Î¹©vœÁnoœRçѰÇYWDÊhRBÃ3ÌnhYÀÙR˜Ar:Mdž˜Æ/<}ŒS?cDv³C¼7´;Ðà\ëÙ8G“¡ñ&?í½=‚MíìŽ>/Ñ5n+ÅõT¦Úv`¥ã,þj‰ñ*Q3FÇ$DÃá¸eþI0‹Ã€³ˆ„ùã*ª\y/ D$'I˜§*Cˆ,ŒÓôD…yœûÓŒ"‚Ó°$” |ŒG¬Qô¢œaŠ£5¢t(õ@ÓÛ5\Y˜¨a5Ž€“; ÑɵBç-ÂQböÔÝgÎÝ?§ag°«\ç¾»"AÅ#/Á+4B´‡‘Ps¿‚˜×FpTjoyê)Ž! “<™ù“xë<äÛF`ÓEyØpœÁÆ­€i†b/ó˜Õ: Àéšâ¼GíC&GÛöC%1TmÐ4%åfeMÛ8i™V¡Œ“9[~¢¡£cWÎtÀN–j Ní_2o²)o Œ‚ƒH"6Lý@OcPd¼äd ¬ô¬Fû¸÷Å\ÐòRçÈž›ÕÏBŒ8 XQ¼…3oȬ.©Àü‹t©ÑznÃŒƒ¼[[[…ÑR½náˆ9êW´ª¦Ô¼WPhÅDOïTwù«4AÙÔ93´ÂÌ,Ô™^œÇÂR 1œã˜È×is¼ Éb»©/6?FB£  ¶u‘:HKY¼÷YúÊÍ’à/uYÕûšÌ߇͛ªhŽÔf@À@-ʪ?5 È ›ü\ã<­ˆ™¯_2ï×RLZ´KZP54æ:ÎQ’³³4ˆVF‚)È!ÌýF–¦8[€¦lkjmk²;Åq‹Té!CBø‚¥%9IŪny¨í‹Ž2ëaá5òÙâàF36.@ö·´xÇý_˜y€#mQáöúÒø$¾LKp—­íwõ¦ÛYW4Ä9Î9'Ž4 L®z8)Æ” ?/øÀ)“[IrÁÐn{iŽÛ²AJ´lŽù䶃@ÙFa3Ö~à‚~Áú‚ýÞòßué¬y¸fI7Î8¢5‚“±ë_Æšòjæèƒ]FAßÙkKFµáØnÕ/ê0ËŸÒ²ÞåÄÅã,Yò%KmÈäDzµ½g“ôãÂ'dÉŸ€3‡°zöÓ@&ô\êIä,ˆ"Ø60hy1²š8û;%RA ¥ ‘üä}ë]"™ˆ‡ÞÅeÂÕÕ·vD»{©H†™Œ•‹„z*|臢°,w1HÝ…Zx:•Á ™šÅë(æRß_š¹°ûƒ¦ì©,töôFÉE¨Û²n¹þàN ºþenQd¯ô]ç& ­FûìNÉbBñQÆ™;;T©»"|Tô⸨‰t¦([_‰Í ZQù¼âá“/ 9SßrƒµäÍ6U»Fy¦Ã<–í7DºOÖM DÃí¡(6G ”¥c‰óúhã88J~»Ø@e°Tro]ú*¬Ûîàrá«\YŽ–Ì±½n¸Ô.uÊdQ¢jŽU`¬q+"×&`/9}kéEE*¼oë¨88nÓ ýxEŠíëÅ(V3w–ÒE -J˯ÑáäÆþÜÍô¦PòÚv+el±(¢@]ô%Ö!ÊÒîÜ­®GûA¾v;ÎÀ$ºûcÌJ]!ùêj²"ØßxX®äQÂn‘´÷Ã0 “T .×I˜e‹‡Å¯m_™£cpD’•Š@äNã8ÞàËíèJ°Çч ~Ï8&ü^ÓïXIH½öA/=À*†½.迤þ±Û ÄL²-,yXzé &ÏõW¤Ü§\þ#I,=ko ãž8©v· 8ÆÏ9:*ð÷uß®hF蟮þ©˜@® endstream endobj 2885 0 obj << /Length 3387 /Filter /FlateDecode >> stream xÚå]“Û¶ñÝ¿ây3>†ø"@§yH›8q¦NãkO’žÄ“XK¢LJö¹¿¾»Ø ÒÔÉçä¡s3'`.‹ýÄEâÂÊ ëTꔽXleÚ®.¨ñãwÏ»‚‰WÑÌ¿^?úâ©1"K‹¬×·1ªëåůÉ×ûýå•tIµ[Öw—WJ©äë'ü‹?:y¾nÚK‘¨÷lw ³mã¿Z‡ºÙÑüCC¿?–»e³¥é?]:”m]*|Wíª¶¤DV(‘H-.¿þáÑ·×ý>Œ4©Ñê=7fŸÙ¹ËÓBk`@žfFÓî¾t*AÊ2ø¹ÛoÊ÷’éä°®¨ÑVÿ©ÂaÒ¾­w‹z¿áÑß2¡Ûî@[à°jüý²ÚuõyöwùÅÓ\ÅDIcÓ\å°OÏ-Íž§F˜0ã·Ìdsˆt*µ “îæÑH£p‚Ö%_Ía.µÎ…Épe¡0é°äCÒuÍWsh€Ó£‘ÄüpjýiÔ$½UûúÒ˜¤ÜÐ0Ò>K|‘¥Îôlø$6·0[‰Yv  ø <™Ãs¥M'ò,T*Œ ©×(©¨`Z%+Ò!Ü“–IÔ Fh[^Ý:½mÃØa]wÔZÖÝ¡­oŽ,Öyƒl©¨]n:^gQòpWnIä'Ë‘éh˜«]X§<0¦¶Â Âni+´“㮾mÚíæ-Lr1Õ’^]P!´ÕŠ…ö +¯P@´MªŠGú髶ܯ Es;«s¶H3¥Îê\þYtI{¤ÏÜq/7/îY.ÂŒ«ò®îÊ"Oê´J¹Ù³¤[—K`/žÅ•éʳ‰tõ,VÌ…´=c«Ílß4Äw?mßêØVi°Þ¯‰"O™e° &Goc`½Mò϶òâ›æÑ¿î1ÎFÚT³gzæép,í¨ªÊ!0ýÚd×PÒÓë(§/ _v/©2FŸÔŒ9 )º ®Ü  Ð&€FUvµY˜}쪀 "ˆ÷`’à -Ò±@D/Ÿß…ö;Œ5á9/* ‰ÔËBôÚ… Ô.ÛkÁN‰"ò[f6Ä/0[ƒõbN~¤L]¡'î8î€w½‚"¹…¤ùÍ"€„¡9BÄ€“WmÁM–»UØÏI›*À¨¹üT£ªÇÊ`M¤f™œCU¤Eac•ž7ùi>ÌúrNî)šÅ®Hßkã ^{Í)_1¢åÉ ûÒ£¹öÒìO¬£™}ËJ_€x9Vzpë ”ß¼€™ 4¦kê-’¼˜ÜŒÍX`ôÆ2”<Ã’Fêݲê£I2"!éõªSØA‹tmÕñGg½ºì(¨û¬nŽYÙxsÿžc—ƒXË}¨œ—O7Q#{ ?ëzR1hÝÃÑxBLÝY15gÅô¤ÔSô¤ü¼{NÇÜ"¯lïh°=Ž(ˆ—·åfÓQáÖ'Ø#‹ öoCpeŸº­è#â„!›AxëEynRd:{›ëŠâ¯”ɲñá´¼3‘l•”Á/ùG¶¡?{\³ÔÉà¬u4y*\o_\^$¡PýD® X—ꃂ•_æ äÔ#œ@£ÎâzÄÏ Þ—'¯!@ëý1p¹\x7[íÌ}þ¥ˆ mu8¶ó¬ì̽€ÃVƒ,—|Â%c/´£8;DU.-ì$ª"c§ 6Æ¡·&ySƒüÓØý©¢°×?'Sü¨DÆBØ«ý?훺c>„3ÅöºÄÎëKò*ÈTp¡ä{©‰@ØX=è¦g$J²m¦îo v…BÙEÝ.6>cRš£ÃPDnÐd˜C↓ڷÔ(We½ó¡ðEéå©-rf‘P“{׬M^kt¬‚•Ë– Þ–‡Ð¡ÉðѲ* æÙÖ´/yà¶i©á- Õ·šH@XÒMI€!óL3cô3÷åÉ v‚¬h‰çÅU®Mò¦­>_¤î1žŽÎ?ãÈ>®Ö™[о¥XdáwˆAMâíÀ¤r(†ÎÛÇÍŠ4,Ðÿ’Á—ñ.! c’È:Çù* -¤PãÃBØa9LCÔà1?rëcê8=0:Búî¡J±¢´Ç/†üÛÑ/e?بUו-çkqðûr×§l]Wsœ¬—Ï2üå )ó›ðe08V­Lò¼!po›³œÓ¢Ì„r‹ÁBË–Z#ÁBÚ¢¹]õêXñò·TF#†Ûð çCÌp A#ʘ äë»E‡ “)Íí7}ZoŸbم̸å|OÛ¢7 Ôë…Ú$ÌØhv‹ÍqÉ`*ŠŒppÐÛbŒ[úH¡^X­Ïf±•±[nVM ;ÜR—Âm‹áv7£ |¼ëŠ ¬Ï_µd¥–Cà…í²õ6Goèãâd|ÓìëÝŠà}Æ2a弪› v€a[Ö\6&À’t /v½,c#X9êÕ·´Ü á=”íªB%prZØÈÚ;q‡Y,žÙÎ[]_.*ë ¡óðç(uÂߣ—ŽXjÐúÃF äUßW”8ÔìfwÕrö_ú„ø¸)Û¾ðÂ'´ŒkYÝŒ„’ÌË Шv3ï$.aiÍ’õ–íP{(ƒGô( Š4Ú½§í!ÞNÀo×lFà@Øß›Mµ¥µ¼UÀɘôy1ðSÞ)p(òÍ'wÇ>ï„9ŽMŒÉßIVš—¼ûX"Å—epÒR‘ôU®Zá$>¿ñ¦uÄ…BW/ΕKF;S—S¹J<[—ëËr ÞÂHnâb_ûƒØ1w©s“‚›Z虀GŸ î¬N”ŸVBüžE¨;ŽõI>Ž„,ÛõnˆÜÚŽCZÝǽ:mzÈå±3 ‚©P?šO¢@ü)l ÝHY¼2Ì—ÉŠ}ðŽºÁÝXòð‹8Áß6èC0®ñ…r-Tr¹á&…ŸXÒÚoÊE5Yj#àb¢ÍÊw6+ãÈtj˼4[ãwÈ ÔK޹æJ²5gs%€w}&µ>í»ÏTêîiF³­ˆú3–{°/ûp;ˆÛ‰˜…Æ6wÃ"Ûù:’}Ç’Y¶dø[¾$(ûC— ›Ù¼ ëÙ»elÕá ø_²KMç¯î-•ó–*úÎM¾CMªãe/Àv4÷îZ[‚îdÏ×ìÅ…NO@‰"UNŸ=Ê÷ÊÿÔGåz\§Ãif¥O¦J«‡ÉXÏS¬§ÂW°Oõ§²™E,R9T¦f1CS Yl½ çÏò¥¥IE>1Þl¼üyzù/Ø8 `"â¹(†»=Žîöâ¯öeÝR들6púêÓL?.ð&ÄÖ153 æEj²âþzŠæôK°ÛW ¸¿‘qäBŠÀ*Mlì)UÂØÈô"Íת¦/[0k ±¶&Fƒ>ê®ýtUØY7ÔüæëÌÑ…|t…Šh¹"ïýÅ6hµp$Ã{j]&ÅÊüMʧÕå™ûŽ!ººö…\ØdÿÃ×H”YOì}ò‹WÔifŠ±îžª 5ÑL!¹btìŽ``¸´lv\7êëÅ*Š”\)QiÉd]UMß¿H¼£5òB ›Z¡ýûP¶‹,E…K…ôaÆøELøþ*B0sé:]†.%«èIÏש ú}6ÝÀïiʾ\ñ%±TÅt#:ËS—©ÑFN?ä ³Ï=EÚŸJÊ&D`µ¯'ò×kNá‰6 ].vôÖºQ²]r&…¯žá†sÊ,‹4³öÏ ¹€0.-v"u~Ë.ùÛ7Og¯q\šËÞœOS ìα®íøÕè ÿ‹þ¦•)×Ñ4 JöÛóW\.ƒãŽ0- 'WÀ§C>ÓF’Ó©*Ì$‹l6|±C "È"*G÷í&-„‹¦ïyž…'h¬¥ål%R3\òþq÷tb0.môŠÎãq;”$ ‚œ[ ìY!ªå‰FÂÑÊsGçüÜB2wžW³b­tª­:w{2XÉS.8UC öY… èÍ‹‘½—÷z¯³þØ—]E‘ Álw4Qý åO˜Ô½—X2ô‡ˆå|èYÈ{Ü#—*"RJ9oº…ë®ÿÀËÖs"¥ÈÓǪl˜gÏæŸ¿AÎ5,ýb.·G›Þéùð1NÞ(½{Of‘–,x<ŸØ¹!±;o­|•x¸óÓ‘ ûG•9_ör„! ës…KjÎ\ÿvÓU£ËA_Bp^öJBÌ&ß ¢»3!Ù3"©øuê± ÷EœGÆ“â×ìC ¹—ý£’ïib¸”Ž»¹ o‚ºè¢ŒÊîáE0øPoyƒãœzÀÅ×ü=Îþi\×Õ7þŠn¼¤¿…¢C‚ Ad“»’òήæç~Œbò¦–†)¡ò…ß§€$Î[G×Yø|¯cÄœÆûë€kѾ¹œ)'K倲^°»WÇêö__GÃÍÖ̱8 Nï ºùR´êó/?ðëËÄ—»pïl {—ÐsL þ˜GóU endstream endobj 2891 0 obj << /Length 3405 /Filter /FlateDecode >> stream xÚ­]ä¶íý~Å>zŒcËòWŠ>¤i.½ IdiäÁ;£Ùq;cÏYžìm}ù%[öjîöŠ`‰¢(Š")’rz“À_zSª›²Êâ*+o¶§W A‡‡nüøÍ«Tð6€¸ñ0ÿv÷êó×y~“&qÔéÍÝÞ'u·»ù5RZÝnTUEôö‡·ñ_þp»É²,zkÍ€-}ßt·ªŠ.Íñö÷»o_}}7-—«<ÎuöBÞö TEœäšÜ_ºíØöÝíF'eÔÒoÀæد¢Yüÿ ü·$Õ—Az­l™nÞ7§óQ÷ýÀ {Ù"…ƒà ðÝŘÿšß’ŸÄ„ôrƒ9ñB+r·µŒ5ºu­igqØ'C$ÚÜèŶád¢m*YjÝAr`”ïE2$úÑÙ‰IE›œð$XG)lÉEaÚæhF€_qš†1úNVâ›ðG´nž»_ MΖ›²àˆ‹?’0è6Ȥ6y3#Æ‘D÷2øIUÅZô³“Ë=“Å‘®þñûm}2‘7ŸMþÉg£ÁQðÙÀ¶¶äQDþ¤r[x„怘óù‚fg*NN;'‡ ·‰2zÒfk¬méâiâïéCç;]:A"Ú 1^”nÜi°µ¡c0ï.tñ)Ñåäªôtøj:Ï‘s:|@Buä¼Ô³ó_ÒåWÎ?ÎCÙ)èmuâŸ!4çø‘Æ»>´×É «ŠÄA¿kvè²$ú':äÇÖšÏ0I(…"5ü$ðвkT` ~ëiXŒÍ±—߃c3,à6É&°­+góñ‹èÿ68 û#ûdÈH…¤r‘ú»‹,@N×q­r?bocæ¥e9©tYÄF—]Ç£Ó Éq‹ôF¶ýé|éÂLkº0U.ú£ÀÃþrdXãhBl0à¼Ð–s赺²a(ÊNñ÷r>OWö%Å¥ðGU)ǰ8 † Ö~AÓÅèûa ©w1Î0 ¹ ®D.'€’ÌᤠÓýŒk¶äÄÑ–)ÛµÎ÷p4ÒZ?JDñ˜ƒ8¬Œô> ¥ªp816Å>þjßÁHòHLÑU£*`’Z䯳/â¢(g¤$ š;5VÇ<Öù”,K|UæT$Ð…"“é*®ÒŒ²WTŒúeœAŽWdE•yôh0´ ®!rD ÐïÙ²”Ó«5‡xuœªÊ¿ö“ŒÌ…îˆ!Ô3(pÕ%“ªK†ÏÆÆ%.:ÑœuN‰0Bèj‡ûfÛÛ‘oìD¼66¬è»‘þåÌ¿`ô'nË•O÷}@-çÌ´º,Ùž{k,&QZC°°C/…@Ú üròí¦à]Û3*Ò[Æ€=ñm/¼Z pKñnNì.Tž&°W¾’ – .ð|l©Y»BœIÏi>)ÔJ*7X¯‚‘–ϧça{¹€ÄV) ¦‚X‚ÂS&™#¸&ÇaØre+ äAÏJ–O–&T‚hîQZ‚í€ÔaDL,7ÇÖº¢b"þ 0îb‘u0ŽùÉg$kïƒdªl8‰ŽµZZÎú®ñh =`}âq*hy¾Çe{dÛGsÙBQ­NC=? <~žºò…… <;]Æs~-Êâ|zOzé&§¸í¦ß…Û2S‹æ³ª¤¹ H—,m2|FY§¼YP&ã!¸ñ*•žRÜ·¡Uª¸È*?µ ¾F¡vOü 8™¢ŒöA9¦þÃ܇·²O{Üš¸æƒ×ÁŒ(Ä~Wå” üÎèšÌUZÄ ê…ȵˆüÍ>˜ýq>³ú§½¥[ø¢pŰ>ðÞ ™Qõrjìó£òlÔ™¼B!—Kaç"ì¯Ö8Íñz•‡Æ™šÙTƒ¿|ü강Jâ¼Ð/°B…ç’¡‚©èÔOà N›³ G¼Ñ̯ٵž#&ìì8zçàñ0~˜S8Œ1Û“àxu¦\¶"ñ´ü)à¸Á:Éo…Iu×;BQT‹è‰€«ÉØ>™o^¥¤P¤\aQU|TIŽÿL‰ýEž‹”pË–keëO$2Äe GS¢Áá'qc1fþZÓ·KˆÿÑ„›¿ñ>šX/C¢øiªà«_Æ7~}Ã{ûiÚÕïXÜÕ5$†7¤tþì[Ð#U¦‹|à[ÁþÛk¢“e‹©é ü²Z™ÚyãÇ™$âêÓ牼ó`Ö¶»lŒ®?ØfðܫݥkñùSH8_žiyd0ï.íÀª`úK®>RáÈá¬Ç"b:ëmŽÙÉöi{$¿¡Ü ÊçR¯b–±\½4•z©Š~"óGHÊʰßìv-Gǧ‰ŠùPüÀs6Î\ÉÁ.+÷V¥o ãįµ'ð&ø(êžâ*ðò·@|‹PðöMÇ­pÀªàj›œº RÕ¢æ¬Jïµ<æBÑ×`câÒå"!µô+ÕØeþ8È(ñá/=F'n½Ï2"¹²â=O¦zìÏ.›Ä!.¾«êZ.8˜ÞB™†Þ¡ø©’FÙd ñ04ç7é&šÇV%@a딀%ÁÖ!–uÚÿ>ü%WRLIߦyßZ¼*í}Ç  ¦`ëQ|¶Y¾Ð0m”mè ±zb\¼¨Ôõ6*C O—²šJä9é1J¼mY9¿.·9}´wòûøDÔØÿ0æ¶¿…€H|Ko@ §ää¡ßîù×m Û\(*ù£A~¨‚ëý1¢†ðóË'xGþ8²÷ endstream endobj 2892 0 obj << /Type /XObject /Subtype /Image /Width 414 /Height 241 /BitsPerComponent 8 /ColorSpace /DeviceGray /Length 2281 /Filter/FlateDecode /DecodeParms<> >> stream xœí=r#EÇŸ°……Àí¼1‘HÉÌ´TqïÖ)Ukn€BªH¬#àb#ª¶4«•<;rï´ ÌÆÖŒúãu÷›™ÿ/Ò®lM{~ý>ºg$õn©‰dÏæ“—D_ü–z ÙO=7Î/²§/S"¤€WãÑù ]¤Hhš=ÇãlvADóãÔ# L3£gD³ñ ïþ9O:˜4SÑô”ˆ(»ûÇÙUÊ¡„¤©z®&D4Q6›¥L8šªçø<£óùž)M&MÕs1{ò${q÷xFY[ç×Ìeé}æOé“o~H=Š045zî1=¥ï/³Ô£C ¢çÙEïç,;M=Œ ´@Qïç“ÔCD ’[›Ñ@h G4Ð#è ôˆzD=¢Ñ@h G4Ð#è ôˆzD=¢Ñ@h G4Ð#è ôˆzD=¢ÙÜ>âEê!uǧ}+ˆÑl}göXäGܾӥ¾-õãg¾þöóÇÿÙ§=ê÷D¾óüêÌô'·$솭TYnj~àó/+ŸÚÛï÷÷úücŠƒÈÙu}£”Ú0ÆÜyí÷÷šèH²µQªdz)E+:è÷?lX­•ªGmÔOÐlc³!ê4J‘D=ºP·š÷(EÔ?4%Ñ‰Ó£Š }µþ`Ð4!ˆdéQÅ[¦b³Órp ß =ÑÜüKQÈ7$EO™ÇusGQ,ÃøÇ5F„]ä¡ëM%E± Åv ôlŠ`}š:Ïûƒ¡Ì$—Z.Ö ’ÚC”Z E†PZ=ež' œ{äùÁ@^J©g“ þˆÍfýÑÇÂr\:=E^·„r‡{©GqŸTzr %ç1z½~"HP=BåQž ”Bd9D¢Å×S¼‘-‡ˆ(χ‡"š„Øz6×â‚­äÅPBWOùFT+]‡^ç‡é×A1õèëuÄ£y£—ùáAâ1DÔ“¯¤ì˜¢ƒOÓöÑô¨U3ŠÎÿ)n†‡)IOÃòÚèõÛ£„.Žž&4ÓU”‹„Mv =zÙ˜~m+yq4HtèzŠeÓZ‚‡èlp”&€‚ëizèÜQܤ  Ðzš:w$  °zô*úú1)n>‹ßÂêU{ìéÅ*ú1CFϪ¡kJÖ›£È÷‹„‹½h›"µˆœ‚EÊš»­F/˨›<¡ô¬ãçé8¬7£ˆ»¤a’›^¶Õ‘zqo7ˆ;EG%æ_"¹©E;–¢•,ÕQ¤#Г/ù_S¹zg ÿ(«öÛ!R¯â¼ã…]ϲ}«m”‹(~˜õèVmãÔç/åÕ£ãÌ),#øam Zß²ýŸ gôtÌNŒ•QOçìDð×ÜÚr]ÔŠ\‡½†Ê¦§‹ÑmeÐ*×kwÔNè”Τ§³vûáÑÓa;aý°èQ]¶ôÏçУ /ÒdŠ`~ôtp½ó`ÉÝ_ìP8?Þzt;D”‡¹Žâ«G/Úx¿”anWöÕ³ìЄz‚œ O=­xw!®uùéYwåÚ¨ !ª°—ž¢½7ºPò¯ÿ|ôt|³à1ü'ÄCîâžzrîdï¡ç5š¶G,™ï¿v×ÓÈOùÎkÞe ³ž¢·Ú¢3Ö—sÕS¢-ØŽbífõ`§­Öµ £žk´•¬Ë›ž8Ë“žZË“¬GëY³­9\ô`ų‹×\ó×ABáÙ…æÊþzPxvS0]³×³BOmSy¶ÖƒÔfSz³ÖƒÔfOz³ÕƒÔf Kz³ÔS"µ™¢9§–zÚÌáøò5;=ò¾îM2 sÙJK¼v‡ÒÿtY鹯^›¹÷¥=XòX¢ßø¾‚¤6[ ßZm¡ÇûXÄwF[èñŽÔ¢3ÛP‚ÇŸð1ÓƒàñÁcn›éAðøà>Fz<~¸Ïn#=?ÜÃÇDÆgKxâœ}Lô`ÃÀç­=ØmóÆyçÍ@Oàñæ­ãïèAcàkï»[Ï×ypì®vëAåá`ãvóóN=%ºjÜfùN=Ü,艄Ûòd—tÕ\8‰]z\vðåÒìЃƀ—ì¶C‚‡—™¾C>\šƒz= ;Œ8Ü£^¯•‡‡.¸^J+ö³½Vr/öÙ­Vr/öÙ­Vr3Öó½Nr7ÖÙ­Nr7ÖÙ­Nr;¶3¾FO‰ÜÆŽí¶h?ŒÑƒãG[žÔ=è `yR«õÀN,[ëj=Èm!Pv­uµ|DKn¬~ºRmfØÖJ=v–)vI©R‚' vŧRJO ¬ÒR•”žPXØ*=° =è BaU5ªô¼cØŠMø z¢c>zJ¼1!6—Ñ*ô 3Crƒžp0èAg ?ˆžøXŸªÖ€g `Þу ·xëAð„Ä¢°CO|¼k· ˜ŸÞízn¹¶a~zÑ$À¼7تÁ#èI€yo`ÿó "ˆžxÖ …­zp-N ˆÑ@hÜDƒè ôˆzD=¢Ñ@h G4Ð#è ôˆzD=â˜fÿ=†qŒ¾x>{ÿxŸæÓOÿB~yD¾üôkêXñÑYÍÓ_þ8NÆDD½Û«‡?ù6ß? 7´,>ÝO=+Þ­zOêžÿýo¢Éé õpÛ‡8žOÇ“Ó5kÚu‚gÇ¿Œè :7Ñ@h G4Ð#è ôˆzD=¢Ñ@@²¯zgD4ÿjŽMœ½ÈžÞMŸß"zäq5‰èòÉM Ç“lö‚ˆ.ÇÐ#ÍÆ¢« Ñ#“Ù„ˆ.é$ƒ‰\Nˆh~B3è‘Èñ”²óÙ8»Dc-‘ËçóÑéñý=¢ArÍ?ûQ endstream endobj 2897 0 obj << /Length 3244 /Filter /FlateDecode >> stream xÚÍZ_“Û6ϧð½ÉsgEü/¦ÉCî.é¤om7tÚ>hm­­«lm$9ÙÞ§?€ eÉKۻͶ½Ù™MA ‚À Ø,ƒ?63|fr‘æÂÌ–Ûg™ëm×3j|÷õ3æé@¸QþóêÙó·JÍX–Ú̲ÙÕ͘ÕÕjöSòúöv¾àyRîVÕÝ|!„H^¿ðO|ÈäûMÓÎYÒÓ¯w»9P÷mã¾Zí—}Õ숾oèù]±[5["ÿažË¤h«¢/©ãërW¶}Ä2+XÂ¥˜ÿrõͳ7WƒŠ«TIñ@¡õ$ç:Í”$É·H.JúMI¶\»yI#“kÒJÒ~žs“”¥3¯Ê]W9‚ߨä>âXÜUµ*Ò[ãû‰Õa@•47ôÜ6­ÿ¸ÛW}q]—D |X²…(ü‚ÑÏ™Ên`@ƒ )SŒ,ïŠím]Ò¢àøfX¢‚$d³ß­ÊõÐŒ€)KK&S+%ðÕ©Ú›L7b"aL¶]O}“1IoÔ^6 ¬UÙzSÙxs¸iêºq:®vkz×UE½nÚªßlõô{‘ü«Ø/q”_ì[U]ßV×{42’baӌ۩ àBë,d響Õbb9 ìË‚z݇ï‰dj\yªE(pM<9&’)—ü@”eqN2WˆÅ¦£R©Нbh¯Bàf¿ŲŒªƒ·%x„üxžæÓ°5Š-âdlùƒ ðŠð¥I~ŒØKˆKåÉ#‘V[JD€¼=n‹ª v."æØõÿa¨Q£÷&µ?J¬\à ü¡MItŒ4»2jãÕ4T¿&:–MŽˆ,ç@çR}f pQ½Šá™é-Êh’ïx.÷^‘Ÿ¢+ â1Vä ¢Žòe&Uf€d/ ‚~ŠIG6ÎGÎ"œ‡™¸f5׃¸Ú¡%u¿ÁAI¨¦"·ÇNØ|pŠƒ×WgÜÀ ¡ŸzRŸ¹×0Àì@âÔ¦ƒMWêTVm ZŸJ˜ ÏÛð,K™9J¾ç€`§KÆ"`Ž[ãübG]•Uùß>™¾pi_xâ¾£— †Æ"Lá™À1¨!„–÷ˆ^Æ£ƒm}ÒÞÿtçñûHâ”ëÜqŸÄµA/"tŽŒ’·™:äE2òx';¢{,ø¹š¸+ø®ÚÅ5!Pr~‘c’ÖŒS[þ§ ÷0!a&uÀ"pç®*}DwïÊÑ«º¹õqgX*ÜÁ熴Bæ“9™Iö€ÈV2MX:ÒJHÖ@c[íàÜPuHØ£JW^é€É`öÅn]—žQ•–©k†4ÝA«KÓ–fH!e”¾q ×ó Ó(úJÑT».ê&¸Ë#>Åbå/:¦®,îçsÈ~^N¬÷mI7 )¥Ó„’3ëÊ/ìš²|§œ Ë1ù½OÄä(Õl’ '²ÁßðiâÖ¯ýýä,nu8…ßOò»M„sÓìlÜw¥9˜ŒŸ€>_ý°Œü8OdÈRÅÍï•î•6eź`Ô&e\LÝxdp6gÌó3s‰¤ŸC ÌÂÜëö·‹öPf‘ÃùÕïøkO§àÔæLÊRÀ¯zUG˜a~í~ zy÷2Æ P‡4Àfmƒ;‹à•æpay*ÌiÜÁ eи֩Ôêî4ÊÅYÜ10S€ ûsÎj*NÃįüå`–¢Ò “àúü––ñ-}l7Fé‰í¾ÂËn—Òº9c8 PØYÃOk8Š ÇL çø-ƒ¹Á>ßÅ| l eïß~þ^\I^O,ž&thgÂ…)pÕ)öË ~`&4„¶'Úüi ^<ƒS1w^Ò¦<“‹—çbØ%/iG^2£Š„*г|¤Éë‹&rqöF¯ŸÎæÅƒm^žµymÌŒã§P_nóŽÄ[Ðò_‘»Ä&~Þcpp¶` ÎB¶yw„+ÛQÒ,™ò¶î ecÝyjTáÒõUº³‡œËÙJ™t}yÛ¹¹Îð.ú( ó竜I¨|)ÂUA¸â‹Ðáï¨ïÔ¨…ù¿/r9 ©ó¿DiúAE1ŽÜBÄ«b¾?‘‹”à«/Þ¨¢o¢®U¤B<4Q¬mþÈœU\\«‡š¹{Å©ú‚ªu¢&ç\]ÌA”qlp\e0ÔÿÜÆ¯DXš3ûðe¥:#‡ YÄ spkZ3]ùèÂÒ¯\l¾«2o1uƒMwVR»½wéGÔ‡J÷E`BeÙbb…~L«L¡#TUb{SŒË}Ƭº¦žto|ÃÇœûõ8>x7·}µ­þn€5^‚6× P]nÏ¡¾5§+ôUHaÆÓS•OâËÂç­&µIÚW ó¹&y‘ócÙUkß¹DÎ V9P.Õ¢©'atšJ(Ÿ>táäb¡K6a³Kxè…YF7 Íõ8ÜÄÜìc1l…³iŽK3𯅏_“ â S{¹rÕ<ךáÓJ2üé.-›öWGi¬óp×ÊX‹V×DãÓÀð*$ÖéKXnªä"zŸçó%ËîC·AªÒAuØÂÍqȺ)îÉ?î‹•+Wë«e¤TŒ±FËUƹ¾NEƒ oò¤®~ – tQj1y9ÄïWwQ¸£s{±¸3§TòˆÌeßa\)Kh}’S1=JÑ]]` ïVE»¢_GØUõ$ݦð÷Uïe\7~ЫÌ(uN…ÈZœ¾ï|õú&]»_2ÁTyžœÜ!çV¤Ô>ràÅ0uª,¼¼óîOÖS Èp?êœZ@¸íG <+ýä¯Èh endstream endobj 2900 0 obj << /Type /XObject /Subtype /Image /Width 445 /Height 287 /BitsPerComponent 8 /ColorSpace /DeviceGray /Length 1955 /Filter/FlateDecode /DecodeParms<> >> stream xœíݱŽãTÅñs£Ù„SA·Ê@ çÑÒ8û+Ï”H4™GH„D?nhQüã}U¬m]Ül„Ä¥ÈìàeÖ}±}ÆçW0ÒìàÜä?vìkãK˶G"çêöZ.¿úóm’´>y¬ºu/¿y¶Õ~ ºzá tÈ@ ®Þäá?ÒoõG ÂAõ˜©3Õc¦zÌT™ê1;Ô+¦CN22çæy×ãS\‘\×ãSè}™ê1S=f] K›ÞžÄ\…~ìH½ì°S{¹àÓñóo]à˜†×¥©wuc7’þêm¼¦ŽÔGí£#[ò§©½fªÇìP¯lú6)½2àÜc7ëz(òhxòÇO˜Þ÷˜ ºÞ¶ÙŒF z¦Œühoàë=Õc6èz3ö B]/cŸ£t=zªÇLõ˜©3Õc¦zÌTÙ ëi–š™f©¥CªÇlÐõ4KÍL³ÔÒ!Õc¦zÌT™ê1S=fªÇlÐóœôÀ¡u™ê1S=fƒ®çØ?¯gÐõè©3Õc¦zÌT™ê1c›)+ô‘ªlõ~ÄÍ ›bÛrþd¹°ˆýr\¶uï“/íØ-ªlõž=g__,±m9¥Jõ˜©3Õc¦zÌØö9·] W´î1S=fªÇŒ­ÞlÙõú„­žT©3Õc¦zÌT™ê1S=flóœñ¤ëô [½¤ëôжœÌT[½¥®¥®`{ßc¿'£-¶uOªT™ê1S=fªÇLõ˜±Õ 5ÏYÁv¼·êz½Â¶îI•ê1c«·a¿1œ)¶z©êU°Õ“*Õc¦zÌT™ê1S=fªÇŒmžSw¨:R/síãè?~ƶœÌެ{W=½‰i®?[¯:Ro¬û(2Ж“™ê1S=fªÇLõ˜©3Õc¦zÌT™ê1S=fªÇLõ˜©3Õc¦zÌT™ê1S=fªÇLõ˜©3Õc¦zÌT™ê1S=fªÇLõ˜©3Õc¦zÌT™ê1S=fªÇLõ˜©3Õc¦zÌT™ê1S=fmÜŸ³¿w‹d׺§Oi>›Ö½b|e¶¬ý+³E=ml9¯ìnGœÍÌõh¯…™ê1S=fªÇLõ˜µ°Ï©Oi>›ê%爡Җ“™ê1k¡^‘Ÿÿ1ªYj}ú̹hËÉLõ˜©3Õc¦zÌT™ê1kcž³<ÿc ”Î10Ó–“™ê1Ó<'3c`¦-'3Õc¦zÌT™ê1S=fš)c¦«q™iËÉLõ˜i¦Œ™f©™iËÉLõ˜©3Õc¦zÌT™ê1ÓÕ¸ÌtŽ™¶œÌT™æ9™é3m9™©3Õc¦zÌT™ê1ÓL3]ËL[NfªÇL3eÌ4KÍL[NfªÇLõ˜©3Õcvd®eŸÙ=Ä›¿ì–%ï9Rï•åç»Ú}h°¼¯-çËc˜Ž¬{Ï_>Æ·†Ë’ª#õ¾\µ; 9‰ö9™©3Õc¦zÌT™ê1S=fªÇLõ˜©3ªzéá‹®Q{‡«^×E×ãè ªzñì5°Ìâ®ÇÑ#åõØÍ~¡c|Ü(Þƒ€9ö>œž-ßÒî<}üvØÕs†×dÎnY_²°)ÖÀ"¹6|ôs‰ñ7&a×£èM Ê Ï%šèʪFÀ»j›NÒLl¹áä7Ê"ŠÃ¨ŸëOqåòk„‡£ßÊnË›ßÛQ#á§_w=„>XazySððÞ?|ñÞ{¯ßoáö·þýþ¿|÷E'’fþøñuG‘ópÑ@qßv=&i(ŸEQàˆÅýW!PìÊ–Ú§߿ˀ$_–(Ó$øÿÿCúÇy ½É.´êñq¾ëÈé¨Îïɨ3ÕcVWÏø\{1µZR>wvËæÎMS£…@fõ‰=ó´D±lô<ý‡¢ÄûU°«ù—ÇÛaÝcœâ.ºó»Ðh`ëxç÷ Ö& óÞûýÄjI€E£Ÿüð[ë‰÷Þ/"«ÁÔ=ÆI’½÷þ‰É‚À{¿G`²0ïýnaõ4=˜4ŠçkŽæå@6ÛZMY•¸ð€ ö ›e€ƒÕÓæÚlQÍ_¯š÷½Þžk¿¿ Åæíeëäf×Y\mSS¯·çÚïîä0|nB³»+XÖË/ݬѫ_·Ïùá¹öIÍV—érl&wKÓóÙÙfM615ÛØû÷»·ËÙ¸ò2^Û-l­{yhøze€i“¡Õ՛쳽ƒúÇ8Ù²°<‡œO&ù6‰åo;à»ÿPÝ–sôõlí¦4½ „Éáú9öŠ&o\5õz|®=-Ö Ÿ×GM3@&ËJ¯s€s&×ü_Ž÷®2:®¦^ϵÁ °Y]J›jY²½ßZ,í°û6Ù9«©g}®½4:BC>9禓W|‘À–÷c3ÚI_9P‹&?[3ÿrá­Õ´ÀdÚí¾Zh±,ï–ÏòþyÚÌ.Þ†’F³¹:·ÎLç÷˜©³Ñ ` endstream endobj 2903 0 obj << /Length 3094 /Filter /FlateDecode >> stream xÚí]sÛÆñÝ¿‚à8¸à>qPâθuqfâ¶¶”fÆÎDBPЊúë»{{è(J©›ä¡£8,öööû|‘À_¤b‘ZɬL«Ý³Ä­6›]¼ûæ÷p1Æ#È?Ÿ?ûòµÖ ž°,ÉøâüjŒê|½ø ¥–±È¤5ÑÅÛ öîåÛe,¥Œ.Ú¢Á+}—WKa£}¾]þxþí³¿žÛi¡™Vò‘´õÐ'´†eJ†%Z‘o‹OHBÑt×ŶhÛ/2Ý.ExFûÖ_ìêÆ_µõÍuÙvå*Xt×5œ×F~¡»Î;ºZÕUÛ5û•¿½tPE×ÒècÂUוՆn‹ 7'²¶õ A÷„mËŸÜdØ"æÊ(æ’qÍéDB×ÑËwˆïot÷1ÑI[s†óT0•f‹” à—t gž±$ƒ\8ÎOWÆ"èßG"˜oã(~_¬º²®>ig!R? å(ÿñ zv“o z”éù¤à,KÓÉŽkL}‚Ü9RG.p#AÒDuC„y%òGÈñÆ­Ô¥—h=[Õ»›}—Î[_ ­—ªPçÄJ›®‹¶ÜThOŠô‰L§ki)¯ÖÎÖ³(¿|} ¥ð€Û]Ývt]ÕôN[tûÔ¯DôËALt Aß{‰Ðã#º¤xʸ1 “e,ÕO×¥þýx„ œù6S]Búœ.I¢üÃûƒ29.K¥i—±ñ†¡—â"½g#i¹]p$&'T¬‡ŽGà!‹˜!TŒáö_¾NZ›€Q ¼!¤ÞÒ– ÏQ¹dª£oŠªhòmùoç”`á*Z\_ÅUyU7»––¿#±Jbu›LIJМ™‘rŒ^˜ 6Xžz>XXnº ôtäFáfs î T^ñèÍ=Éé‡<]]’bÓj‘hä˜D26R‰K}µŒ¹I£ïC'3NŒè¡‘»„¾ôGØÓ¶wt»ßÞ”—{rîWy “*›êŒ³mT°£ ­–À¸a jzã%ñd)•Ö'Æ-j ðÝÇÏ«ÐI,ƒ…Ô ¿¥š*Óà9’i¦´q$ÈfÅ„ض÷þBÇKS9æðAñ‚zéÔôÐ_£šØïô$Àp!Ft Ü}rÞG&ÈóX4ÃI÷/>„ ç“å$ËtFpMx;+5hÕìy[îrÄs„öTàÔܪ‰ž)«Ç”ñýð8å=®÷‘(–XqŸO3¨ïÉäøjºè}>¢v¦Ê’™ÌN˜´ ?Ö)™N- l³ Ú¤ØAÒ?u B¾P3&Ì3Q;ŠZF/¾ðB&@8§õ!Iì£ô!±ü”>@PÌ»Î]Fà‘+ª²CO{Ú"?'Õg¶•_Âh„œ¨íI4gGÐè✩£]Y•;¨.܉)ÕûjíRm\j [È«ÍÖƒc.FL*Û`ã³ õk›rÉ1§r™:¥á™‚h¬§aá’˜ë"Ã1öðŒÉl8ýÞkŽiœKMÌõc’QÿS_âÝõþ¾éÞ&™\Ü׳9O Xh<ÙûÐÿ·¹}sf°’òUµ“\Œ’g%x”S£º·•Q¾ÝÔMÙ]ïÌ•xáj-ºª rèÿ¸×ÖÿÚ·®£â¯Vuƒ‰øönieÄ–qšØèmÝ•«¢G‡ýs˜PÀ¶›²Â|—‡v”³ýdš}ZTéÍšó’?Rz7¾Ï¾*=®¬rêû«è,"“ʺy;ï׈C›å5:ÂB1›lVã`óO1©Œð%®f ì°ÜÛK¦¡ð42zS-¥IþMëÊlö]a“/^•íª)ºb¸£¶Çº€ãÂkÐ?QLX'A:~ ®/? )h1ß6E¾¾£››@ t“mAý<<>¡Ô˜¨\9-¹²ëð(¨è3t\žv£ñ…š~©µØù·¯`ë¦ÞÑͪvÓ”k6wµ¯]shòj `cåé3}m¢¼)óËmáj>{tj"-“ rJjW’?yjâßGB=âÙ6óN·%àtñáÍœw?ºÎ¾ö­m„2›Dd’A91>Çñζ>Aô 娯 /ÊèõÒ*7?AŠrúYŠw^>îD¢{‘­Gc»ãDC$¬ÛaÌa©a·à×üFùØw;•²óî$U…å*ߺž18‰²¢g’ïzÿ[¹IÌÝÙãÄŸ§!õ:PX¦e¸&˜åGb¨Áy8‘P&›×Õ§+Á‹°4°í#Z@âÐ…3›1mgœñè/¯^ÓŠáŸà°®¡H—† 4òƒÖ…Ôö£yU"䜤œ¶õSŒ`wHBÀÈž$…Gug‚šaÕ€‡rGdoÎH)ýwøßOÃæÍ Œyjw~%€—.A¢ÕÊ­H7OÍšÓpµë_pî¢Eòýî5 îQú•n‰©Lx€c sû°®pvéX0ˆ¼ª1äÜÒMN?ÝÄWûÊyoF“°á€Wõvë®[Œ.hmüP85LšY¿ØìïqÊí2, „óì†b-^¡®â/ºZÜbˆÓ]z?ö"*Ê"à¹ÇÓ–»›­÷ok¤ÓÕD¢óºÎúóó3ÔlCÑC¦,5ø©ˆÀ\BðøòÍN-^ÕÏþñÀGÜ¢çꞘ‹¸Ø/#H:p¦ˆ7ªoÜÂUŸ]@Œ©ÐßÒ?½À»! ˜{ÃrDWÓ¯ûd„£-òf…’½öË}FÌH½_;úšž&ÿ2° yt,ryÇ!'>è™Ý‹¼®ŽÝ§è§¶vâÐ0¼Á¡½/–šG?£ŒV ¿–7øuô)Ô‡CÌ[QJžN‘¤×iÏÄ5­ÖU  1(£¾£çyKOZ°q·àÔ ±GyÓÔ—ùe¹-»²hÃAQ»ZÖÓrsd†i³'{?»ù¤ÄWGZÍɰQ[¢‹rbT ¥Å|hì4ÕO…Í@Éö”Mà¢sûAÇ`e…+×Eî딆V¡Hªèu M6¬g4^8Ù!ÀºÄi–[*r9X½éÆ$€ /]R_RŠLè» ¾,ºÌÛrEk}°™¥Ï.‡ ÃyÔ‚®½ÅXw¸Õ"Eu‡Î ëæ§–nÛAˆQjËCjOF©áPsÐW·9xÒ6ôM[z¥ÑAìò¶ßÈ;ä .ÎjËßV»õî¿Ù©0(È>iì“hÆíh#ìIœ [æ@öùáKôT8õõðX„HIŽì¤ˆ+ø]$;í4Òø ¤F±Íê&{e§Û3ïøˆ|šÈaÝ`Lâ¿qé£U^Bü;&;HW¯ Nd÷“àfø•Ñr¬iÅ¿SîÏ÷áOP$¤ë‡Fűêè0@uy#ñ¢'¬JºÏPü;?¢_üÐÿ´ávìõ4GŸ<ÐûÊdöà¨lÙ0­gã=é9øªî‡ƒe¸Ô4 ]‡™í@Û4úuv‚<ˆý´o +æšG%¦¡;hÃq‰ñ§ðöXY9JnŸY‡ò^ðËá±™ì9\|Ù«‡ÑÀå!ò>â™Ïäžl¦žTª†UP€‡³Ù̈µWÁwE·o‚Ÿ­há>o(Œ¡p9ëóìÿfnÎ endstream endobj 2907 0 obj << /Length 2680 /Filter /FlateDecode >> stream xÚ­YKsܸ¾ûWÌ‘SÉp |ÉåƒãŠ]Ní^ÖÚì!›Å4,sÈYÔc}ú 9¢,o’R•€ÍýúºGm"øS›<ÞäEI¾©o"Zµwüüéºîf”»~óÃÇ4ݨ(,£Rm®o笮÷›ïO§í..Óí›Çí.I’àý•<ñ¡ƒ/‡ÞnU0òìs·êÑöôÕ~ªÇ¦ï˜~ìùùsÕíû#“ÿs[è ²M5^ød:c+þHEe¢‚X§Û_ÿãÍ߯½iœ†©N¾ShGýŠäE–ZÃda”j–þ×f<À¹2ÀS†Çæ±6'‘ ¦ý->“`@¡„( îñŒ}bš¡9žZù|ß µ5£ÐÁl´ÍÍ„ü†¿ÂZ®‚Á £ß'ÞR|§MÕÊF¦²õ6΃Ï«ö®·pÒ〵Ù)M’ìTªT±$7¬Åº?G Ãóù4pÚ>ð¬˜f<^x84­Ùµ¬ÔþÄoL–“bqAöàEkÄp@µûµ-ûÛÑtál²®ÝFæQ¾ªýW$ütÜž7°Ž‰‰ ,g3Šùà]j•MhBj')Ëu–IY°*®éV9~ÑtüBX|#Ž|·”mš×Íïi ¨ÉôçŸÏädcŸK"*c»Šä£L{°‡™µðâ©…Õià‰B>?|Ì’¹a«8 µ*€=±½bš¥ñƒígÊQ|y㺒=àÖÜ’›ËQæ„´•½iF[±½GA[Ù;yÓ[þİú;^mºß"¥»fÄEù¨¹õÛ‰äUÓ “[1í8“¼\^”ÐÇ _âÒÅ…7ÆÁÁT8¿ÚI&˜B˜yßõ(¦ó0Ûô|©qp²ýMkŽ<‘;Ièrçì5¸_S³Æí§n¿ëAÀ„Œµ½nûI¾›xn¾Ãt<6Ýð.ó`B)³à{Â^O<ÃãT7M ;šaUßiFeé´yZÓwêÂSü¥Ñ#Æ:vD_×Í&Š“õ*›¬/ÎrGqJéYÖA¼cÁùFrÖ8ÌB¡\}Q›ýd ƒÑ;´œ‹í£ð’½¦ÁÑw{ó;²Áåej[œì !0dqrG‡‰BT fZ”¢Ó÷a&ÿ,Œ!ƧÁâ‘ÄÄaŽJø45{ÃÓëm ‰ñ¦•éOf<` û9_óòÑÊPÅ¥\#9E pÖN#ŠBðœß*ÎñVé½ûd€ÐeæI‡ÖœÌ<÷IGvøiªái¹ø‚±ÃIaÚQ0ùñƒ ‡±·2¬ø1ò]â·Ó r^óçë5Ês{Óþ°váx¼$s$xsƒf'Š}Ã×)GÇXÊg™d07©]â#¹å£Ž‡fx&‡ÌfZª0J.â"f±i\•Oë°PÞå>2‰Ê0äIAp(L“M–ié¼;’ ¡gT๱g³j–:ÔœkÁé;ÂÍ/k¼Š0KŠE¸Ù%EF·¹Â`_ëo«0óÂs«o| !çæ÷Û4ó›ÌÀsÎDÏsl‚ÍœOoW7Ôavu‚M¼ Cj€8"ô“è)Zj@§ w¸šL¸®m i3Ò›Õ»u1B{4ï>€ƒd I¾Ê7A¹Ýï0³¥A´îQay6•·È8®®®h”9õdzÁ<æñYáÎ/îT…q_ársHw©þf Êá=ú2ùHrWìb:VäZKè!!:S5 „¶åì{‹=¢0Ò>ëÞI°7g.kiLØß™³%S8M–ù@˜üð O ¦ààÂ$ ‡ËÆ¥4Ï•õ8Zªî%â2f«5Þ^>]kæPæaþŠ»ƒ5¦¹­0ŠácÕÂÀgþþv=Ú»»’"ˆS”¬Ã<-¹GEXÕ—d©Ð}â7/ø¯Š@çQúMUB½™œ]h‹ Så™Übe\—UôÞ*ÒËØWd àýB÷ qÜã|¾7‚J_ƒa„½ŒÔp…pýʦ9Æ®ô»ROñ?§žœ3OñÿÏ<ÿ-Ðͽ…^"\}ÝV‚M¶\cà˜*X扯™°›n\äPæ]”ý„/—>‡t:[B:ý<': n-µjà-£CH̃áÌ púR"Îcßv‚üœç+^ì Îõ¯y\cŸ•aq†j¯s'¸9g^÷ÖB!Îû¸¹ÁÈ—Ø.r•YépùNnÑxh«S³oŸ‘T¼‰ަ¢,Ó©°KvNØh§®®Îí³^P;·7¨ðØøNOPtüµ†ê7" êyáXa ÅѾÁâŠú®F\ƒKrv÷–Ýj¾ÉDgC5Í6ÅîÄN§hT8©,þ¯«©­º^Ù‚y’ûÆLÑ‚Ùz¿o£ËSïn•u÷Bî…#_2ÀxæI XTg/Õ| í³’ ̵ɲúJH±7£±PØSO  ,¾–Ï\TŒRbI7I+Ð0ºê¸E›qå™ Ø©\yÆk\ *ßóÅñ¼Ñ€Ì|ù‹åZž‹×)ÅÍa¹ÞÑàV²sÚ‹2g]OrÚ¦;ŸzM_—a2ö"ŒÃœŽ†­B.Îa…›V€$¾Ónøûzü†´+¬­¶ÅZ=XNPª…"¶,$v§Èý)Šg§ðj.mWœ¶WD”nTZä%÷®—{K|n*ÒÄW^å6)ÂtšR'› ){D«•tD²LÃ…Ö 4OÄ~¼´¼ì¹ÀçwÖ¥ïçfØ‚ÓCŒ‚kO¥E€#î_Á`hþžañ »½=‡ìõ÷ófçjùÍåW/ô0Òsõð+<ªHŒã;Â+ðôƇæN„¸ÕÁÍ:˜WÃùÄŒP2¨UÔE\=Vö®éЊb¸JÈ%µ´oq:6Ø_ŽEE´r…¡:žZn•f‹nNgíéWœ ÁAá^ñìhÇŠ-=ëà#,~‚À%×s×öµþT+¼üõ âÎc¹c9˜Ì+€JqMü—Õ @aYzú£Tæ«:¬_ LäO(³ ”‰[KÅeÜÞçEG[ ­öÆw²a}%0÷yS>e ÇÜ]+ொ—ýn¶ÿ’ñ”ñ®µ›@:Ķ—eD J*øPq 1;C0¦&";GùõÑXYTh…î¡i[~!WB0[ÊU~Aɇ\Ùó¤“óð1ã™Ü»é´f \¥ó»ßGP`ÓÈ ncÀ„G 72ºßøhJ|jþ¥ñhèŽK©Íáõ°qPñÃõ–ÛˆæKùyÉeÊúY¿ÂqX“ޱº2žýZ ãËTM¤|×õHwƒÈoÃýÍHц/ìJéÎÁ%t¿ÿ‚,ØÒ endstream endobj 2910 0 obj << /Length 53 /Filter /FlateDecode >> stream xÚ3T0BCs#s c= cs…ä\.°hQº„äÎeUgbj¬gjb dcUWN" endstream endobj 2805 0 obj << /Type /ObjStm /N 100 /First 964 /Length 1691 /Filter /FlateDecode >> stream xÚ½Zßo7 ~÷_¡ÇíE–DŠ’€ @»"[­-’nèCš[·Ö.gèþû}”Ô?ι󻗔¾ã‘Ò÷‘%5dçŒ3!»d¼cJ4Á}€?¬‚××Uð†È™œŠ¡äUE {<™ÈA…h„ÓB0’“>)&IT!™\ \Žð4g‚ÕpðÆ{§n|†Äj2àm}¢ñTM|Ê.Â|Xô¾ˆ¬zš®z˜‹d•zIgRð({†W"ë;†Tª…ª><”$ð@„ó:Ê&`ÔM¨£Ó?­J˜6…*$QFÙ‘J0Êú3ë`y9&A}0,KÒ/",§¤Þ¢_b©¾ÈúGMEŠñ¢ÔÙF1äÄ/UÈ‹Ž`Rp*8 ¬> B¡2#è jOÈ볂Oc •RJË!a&`Y=Ã6¥¢Núª z€ CR1@vˆUÐX*€€}}R©Î>eäæä ÇÊz†$¾>ó†“BŸ1Î\à0s‘„é:t b5ú _&•* ™M$§ÏAƒQ­e11V@k1jôeÌ#¦%9›‡#rÞÄ( bY©€0v©š(F¼Wè·¨2‘,§(„T¯À³À®>#pÄ– Fx ©ÈŠÅä’rLòÕ)žª6<¤¤H‚ÃÄ@€€`Š˜dA:$Ѱ(.jBU}|‰ôœŒÆ§³éœœ˜ñ)hÎÈè3 ˜þê|ñÂ< ÷z &«øäÉhüz>»>Ÿ,Ì…¿~~jÆo&Ÿær„WêçÍ¿Ÿ&xqõÇd4þ>'ÓÅ­V‚jj4>›ÜÎîæ×“Ûeu¨Ï~šÜ¼¿z6ûl.´ÒÄmH!›Ë%ü]ÍaDÿTý•£ç梥:·¿þh0ï‚oÌôîÇˣèygÂ¥UQÙ»(¶@}C¯d+ØHÜ ùð«l3…(_<Œµå÷›¬¡pÂZö²ÃŠF0>½à¦—{Moüt:ÁèŲ8ë°¶¼W…ÑøüîÝ¢þþñýôïÑøÙl~3™/¸KÊ5&w‚‰S±樈ÕTçâ,9è=­àœ›ñ÷³73X¿yu·øt·øýv1Ÿ\}¼ýVQÙÀ¼tË€-½²MÚ½V×äY\׎AÞŸî†hã9P7d·ô$“OÇ+ýq) ¸¤á¸äV\¶†Û6P¢Ý’

EÁ þ¸µÜéÍ”4´,3%[–¾z.XÝÖ÷]ŸúÃÕØ2<°EŽÝɤ¸;ÐDƒš¸_=õ¢#›ä@^דe£°=š-o_½ûK·BjøÅG=—‘–¢5 ü¬ú†(õ[Ö7}©î%—gUK!ù{!Ü¿òC7†ì³uz¼„̓QĶ)sãÆðå‹—¿¬o÷Z8œMØ@i÷A…do…è+9ô°®ûÞ{¯D((%<êõ‡Á^Ù'ïà>âõõQÀpŒô÷¬ú\W:ÎÝ.ó´cû“v[IçC‡|^Oâ½y»Ý¸¬­Œè8 ‡£&æ†ò™,Ÿ9íäpƒn¢³¢çò@¶À;±YúµÑ,Í7/¦ÿLæ·ïgÓZ3÷;'Û[r;7+›åWÍ“§üß@]N]J1²¾DtðzÆ–MD© ¨á;¸Diu7“Ï“›óÉÕüúÏúŠë–•[z,Ø2†v=ôªÖˡٻ‘•{N⎱Ñ+ ­X‰½xÞÀ@†§Ä:ûË—Þjzºoùõ†Ç³k̯7|1ìIžz©Ž’> stream xÚíZÝsÛÆ×_Á¾AÓâzß8“»­T'ScKmgl?@$H!!-¦}ö>ðqÐQ$]©Nf:šàbowoo÷·{ 3 d¦èL% %LÍæ›3lžÖ«™¼»<#Ž.ÂxDùêêìÏBÌF)NÉìj9fuµ˜}ˆ^ÞÝÇ4‰òrQìÎcÆXôê…½^®«¦Éê_àsL#ÊÕù§«ïÎþvÕO(¨@‚³#¥ë¨ˆ¨@D…(¼‘J„õ]/"#½ˆJD¯Îc!G‚X ¨+Šg ©cò—¿^8*ÏB! ¤†d¾Ýœƒ%¶ë¬->ëQ®íÀ£EÑ´uq³m‹ª´–Yn˹¾C¡‰cÃ3&)"4µœÿþîÐÜ·Ù²za¹×Yëfþˆ®j7gV¬·u>Àä ‰e_”Z«TÝ8îë V^EólmïçU9Ï ]ÑêË/{…Ž CDËÛ°I‰lÌãj©¯$ üø¶[ÉÆ“‘JEg¤¥¥!r&QªX¢I$DÌJ…³õGŒ±¥ã¥ªãCBŠqÄÕ,ö Š#ÊiÇ*l#¤xG WÉê˜ïîê¼iò…½-J{mózc-S-ƒ6À)”uüv¡ S¤D/Ò·A.aLRgHùÕ yˆË‹iDq¯g~w]é­® ¶è7Alþ-‰ópûÊÍh3LýˆúÉ Øü߬FJy \‘ìï2¬0‘|6¢zÌvû,¾R•€wÀEEú޲è!ÞL!¡ÄÀ<&R]†p$db|ÆÅ™Îc¦Zá”Y—HNp‰#Õ:ÄæÛ è° Ê“<45ÑçYŸ„n’‚ñ¹Ÿ=¼ Áß°ê`œ¶\6Ù®°ùm£“§€,D”­·¹½í¢h:Ž,)¬]ÒgÈÐL`J•öû«ÙÎõ$·–i{›µvÔGxŸBc=ÿ¥6ïnd54¤}<€ Ú‘ ñ´ôW­(o'Îà Š!hŒ¨^„/$Ò¡E«Z¸ëÊ¡ˆÒÞÞŒÖÊŸKAì²Üþ(’Àläk)¹"úÒí=îE‰”’Ã;88uÌ…8ø‚%ŽJðûc =:í°ÿ>Æ@•“|:å¢ÇÿaN xéq/}¦€7VûÑl4Á§¸¹ àÄ9õÛÀþ®®n²›b=àPˆž‹¼lFøÉ`~qÄÌ‹¼†Í/ddK 9Ü®­¹ª³E‘Ü:t¿x ÒX™Ï'¯»èû„Äe®·ÿø2{m²¦9ÑPÝŒÿ<4¡6ÇGLxYØrÆÎƒ»‚aÞVõ±Ó_¿{syH€mY,+ƒ¿MQU.*7.µém=xcëcW†­ò2‡ê«cÖºËuH†‚srLlè·XöÅa7Á,²ž{ '*?+¬>ÕË­¦§ú÷»¶·®Z´uT+Ö¯×C…’J:Ї…—ÇD86…ù¾ 0¨”têñ¼à*à’݈\"ÅRÑ;{´HYCar´€ø´î€åÖPxsa“O̤…ƒ’Á´±[b‹ææ¹å_èh’J·zð çnôz›òó€~DAÉ9€(­ß ä>EYÆ'……×¾Dì(jÔ\PD¤©þuž°.dVåº×Ýí­sÏN¯L+†„2ET±#1¡< :ªoÂyOÊ~yîoóÚ¹<ô’Z¢ge¾·v[ú “I>T÷FïpÀHÀwä!ßIŸ“ŒkËuµ‚µÞ ¾$”|虘LÇ(?Ý„ت)ØCÔ: Û<éÅ ê&ÔŠG»aúyD0tRÃìk®bÀ<vw’c>i=bŸàL–4d®s{×5î;ÉTP”p2ãðž"©î#ø„g øñ»F6Á½!ÝôJ®gïÏ~°Ý批;^˜ÂÆUž½¦þø“rrª¿ýá ö,9 ,|Ér³ýËÝ+Ý,‹Ê`‚#ÜóÕ9|ol/<ìc»`¸×Sº:ó ž às¿ìØÆy]Wõ!±ìÚö™ÍX£^€yz W?Ø›¾ÛhÒ³áÜbº@x¬å¿ƒÀŠ¢”òÇÛÂd\¤^êÆ€z¢þºLO/ЂÏd‚U»E2O ÑÈ}¼<Ê‚`6$×} ‰s’n5ú‡wks`^}&#êÑÐæ[ûÇ`ne‡ë=<°¤‡Ú+vØQ]„m(ØiQå÷ëû‰—¯~ ±Š‰àÀàA¿z0ê°‹=ÝRIÒ¡OPVmÞhçrî«ù.›·vÛÙÑ¥íÛÿ‹2oš¸Zƺzv¤À§uœÖÅOîü’&|àû}µÞT«ÊFžÏñûMQ—vl±8‡ Hü®±fj\ÍvRÂm2¥¡½îóqóó6«MY¡íé]׺úÉÞfm÷ºÙzdª{wúìæXÚ«Ù½ ·P8zµC®k‡|zøÌAΔ÷A¶JbŸ‘€ßv}ÈÐæÚ2>ŽîÞG 'æÓiŒ]ÞçsW+ƒ¸/±ƒ¯½ŸþdM 뀘žk\æÜe+å)K§ÚE' ø”,tàd½#Žê€&D ¨`DÇÒOT›ªîλó6+ÖM¸ÏB03<< ´ë¼©ÖÛQAyàÐØ…jf%ºº®­Öº¹’»ƒp/Œ;A!pïÏ¡lÈ¡ÊÏ¡Ç6vÿOï¿ýô¾{¢ôîÂùn”Ý“G²;~Òì~^ öÛ_Œ#pù dŸ7&_ï„/×ßc³HHŽL»g„+÷ ŠÄ°ýŸÓU öÿħÇ$œº¢8L¢‡™~hŠ]u¯ôÛ”SmrØ‘ÅuºÎ'Ìùç"³ùT߆?„‰…DœNRèï;¦ñhYÛ1D7giý ²êvÝj»ò$zSµÅÜÑØsuMrߨ&¢ÛQ{Õ1­†OØŠrµ-š[ûÀj vo²el3 Paèug7&Í›è1 Â4ñðcV»Ü”"•ô¦>ïÌgwAÎÜK†Î­À*‰’Ñkí3JE×o®Ñ»—oìͽ;rÓãmãÖÛ`Ð+aî/UITæYmcG ò÷o$'uƒ~â…u>ýfÐKQ¼\ßMnV’x|€e©’Æ"$ žÒ“±l÷~ç`+ÁV¡+eÜSd?ní¨ˆÍ™ÔžÔ§WñW¨)Ú{ܺ{bܪíû+ò Xé endstream endobj 2922 0 obj << /Length 53 /Filter /FlateDecode >> stream xÚ3T0BCs#s c= cs…ä\.°hQº„äÎeUgbj¬gjb dcUWN" endstream endobj 2928 0 obj << /Length 2562 /Filter /FlateDecode >> stream xÚÍYßsÛ6~Ï_á§5c!Äo o²Ýرã4c9çéôú@K´Í‹DêHÊ9·÷¯ß.J$CÙòµéxÆ$À°À·ØývEbø£šhÉáú`¶|»ÞòþÀ¿\¾¡An ‚ã–äÑõ›·ï¥< 1±±¥×wí©®ç¿D“Õj4f&JóyöŸÑ˜s¿óÏ£ìv‘÷e²zÄÊIi"&ìè×ëó7?^o–L)øžZ6Òß©ªAUM•¢Q•)ck£*§UµŒŽGc©ºšrš‚z~6NbØ9ÎÀb¹ô“Më$Ÿ'åÜÏs’Uu™Ý®ë¬È+?Zªö±Áh-Ní—ó‹‹Ä²_½¨¢mQ©‰y'÷‰|$°‚²ÑyñWE~ˆëÑhн:Ž.FÌFEý[蕼ô„Ü„qérêàȨ!JÒf¡Æ2¦Ö2xRäM[žB%kÄ¿äÙcRfIÂ*2ÆýÏÊ‘„³õ=zF4ò‡2Æù`ÿRjp¨Vvµ¬«qÛ¬wè-йýq¥ó G†n<ÿv“-Ò'ÿúƒ—œÂüAìC>#áõSúÍþydDT”_Éhc JŒ©%†š tG·Vì jC§Œ‡zÛÐN:ãüó(Y$_ˬzÈ“|ð€„%<=ųРÞÇE^gùºXW°šÐm@=XF!dË2òŽJŠÅD³Œ ŠÅz™ú6=ô'°ä/c)<–|KÑ`ÉK¾K 2Ðî;0gVþMÁ” ˜ôÏD“ýÝМ[½'šV;/ÀK=ŒÆ4Pá5ÇWÐDÀ)N oc+„ñØbÿ§0Ç‹ØJAÄ’.¶z7¶–XØQ¼©åYE¬¢Ëõ¢îák‘–ÿø6€  $Åi{Ô¿·‹£ó4Ž_Ä aZD@»µC`àøµGøä0Ãoy| ÷xø22¢Ûp±8ŽwÃ¥‰alè*25 þ gÕ¶{ Pà]’šèN¦p¤lž.*ÿÍ{$x´Èf‰[)Ì0‡Í%…×ücºkÀ†WÛm&èÕ1¼žtYÔØá9fp%¶Lb„¤¬¬’…'S—iýP8¦6¯|Ïïþ1]—^öéYŽÕXÕÙÇ“øå8íˆRÌ¢3·#ŽUó'ê¿ÿ×ï4&èϸõ¡(—IîÕѹ›…GÓ§y±˜‡^êÐ}9IË»E–ß§å áúTšžé‰çLÏn,o2b*Z×Ű¡Ù³èS‘¯óìmLOmmÇô®Ð·€žÅy›£Ò ÷†Ú™è4ÍSç€œÍ ©M¹€wÙó$ÓUé6šGxUÓr´06 j‘0Ï+¬c+˜œ'–¿hçä !4š<”éŽKhÚÛ ~œ?£cÉ7¾+Y®yX„ÉèΨ;shÝoŽxá;æàºnñ^ÂÕðÖ^ÕÙÒP0º³ !rÅǜƊXP¬sEí$Þ$DiLËÓ2ù 4tŽþ2©0ò ð´i ¦~ÆåwÎ`@€S†ñxµVjL/ RrO¤0îFJǯcS–Äš¶.’D"À ‹Š<×Éí·^mélÎ~îÛpµ¼\µE»·èBkæ-†òÞ1ÀG@zÜPww'§2-³ðYËÐöášK£{ËŒt:JR8÷‚g++ezL…ÚÀ¨“w¡;ž$úeW{FŽ]ô5ÑñCšã›nB³‰~Ÿ&U2bß|ñ7Yš‡®Éú>©ªÔ÷³ßUÓŽ-Æ‘ö ”Y°;`΄sæÊ€p3À¤Àp€1Wìö´ ƒ~ô¸5ÜW0U׉´—p'ñP׫woߦ«õ-ù¶&ÉŒ$õÛ4¿_@ñ¶¯"1˜¹í(¹»VÙH¯T—úõ&uj _eƸŸ±{•?&F½x“]Þ Vq’>–#°Ðÿ=¥ƒlG®z1Ô¨çb¨f› Ìsü%POˆÕ´C3±Ý¡™Øñ2Íd1'V«öeŽÛÐL §±O‰€e&÷‡Þî9¥$V´{Ÿ÷ÌU}ªÒ9åÓ›}ª¶7äÊñ}f‹¯xwbÙä*ú¾A²5ìâ8àË÷/ÌbQºE^$@ Sï<…øWŠà›ÐIl 9"ƒÝ§Ùímåû6ƒ™ %|[n¼¥]'ãòÍ4‡:žb—øŽ{p®…›½9»Ù‡3Þ„2Ü&Ç3;ãÔPŽ7tBÆåÿY°›ø:Ý4°w$Ò’E³‡<û÷:õ]žhÂÑ„V‹h‚Ðõx†‹Ü¸Ç0¶! Ï„¡-û#eø –ãËa^ÒʦÅ]QìÊ'eS2¤;˜§Œ¨a/E1þì$±j?ü-mð·€Å+hŠëï/¼œ†ÉžÏå)pº˜³ž¨ç Dn“ù«¾eŒ·<ÅU˜ëÂ?[\6õ=È\›_\ð–Ò^]гZL'ZÖ#u´,ò¢†|g“jìL>v˜ 0qW]xÎV~ºœ AO}#æK@kªˆOJÂíw6ÞË$µÁ8pñàÆ: ,ŽÎôÿúU•Ú»(XÀŽjŽ€œ±¢`{óœ0´“Ól¸,p~-DÇ;GD0ª²åzá…¡-€CvH÷C¨«û¿á"[Ÿ¿øy‘å)– ±úx:€ƒºß$°ìÏè$‡÷@ªœW𵃯aÜEø|éìÇ7ðÐÒyE¼‰lüªÓ1êÏ¥/xÎÒtW²òæå.<=WÇ_)àü›Ÿ#r_³U)æqK´ÕÍ©ø¤9¿KË4Ÿ¥}W¥´+ÃöT`¦|OG¥ZŽ “—WØ)žJù¢¤}>Ÿâ‚h){FúlQkûSFçw'-ºµD?iµ­%BÇ镯Œ0Ñ˸\µ œÎ{G«Ú·zéz­íôíûÍIˆ^ì5‰âÖ}É5¸$ˆ³àW=Иü¤2 endstream endobj 2949 0 obj << /Length 3025 /Filter /FlateDecode >> stream xÚ­ZKsÛ8¾çWøHU™ñ÷æØ‰3IœIIÎä™,Ó7¥¥d“=ì_ßn4H‘´$kk·\eâEÀ×ýõâgüñ3+ά“ÌI{6]¼ÈBëúñŒ ãë<ŽKa`ÚùêöÅË7ZŸñŒåYÎÏnºSÝÞŸ}M„ÎF©È¥3ÉçŸÙøâã(•R&Ÿëb%•Üøj$\²õóÑ_·ï^¼¾m?§…fZÉ×ÖŒ~º@3\ 0,ÓŠøõí‡+ŸÙ¿ðã/ßÞ«-30y÷…ReMòžÉŒe0SJýÿíiÆ”æøh;–ë…¯ªóQª3ž¼‹³|(~Þ/ç÷£”'±ÇW÷Ôu‡\ë‡yY=Â9…¥õÏYHÎŒåÍêþÌt&²Ì“³8ÞuÇ+Î̇_Œ„I¶›åÂoÊ)|Néd<ÒaËmDfŽÓž¥\2[ ïý1²6ñëÒo ﺨ`}øæ¦\VíÃr1®pw#-’嶺/pÜ=½wUTu¹)‹zïÞ8gŽ/.HrkvÉå T2›ÜŽœLÖ¾ªñ°¤Nn– e.¹/æ¡Á$—ËÅj»‰½“r16ÙÎGÓÏJÒV%,OÞûµ¹<ùÿüȘdóë[yŽê"‚ à ((¡U’„wc÷§°žç ð: Ž¢/Ž›_Åü@"9 [–3e’¥J–´Ìqq@²„lüúÛò{#UŽq!zÇ>ù²¢íÜ,+”,a³äÒ¯çKj] [â¿)þ#AÚ®Q°@‚˜ tX¨ýb…jC³<Ы ê[lç›ò{#¿Ø_Ö›uy·EéÝ+‹RYfeW…vɸ¨ ¿ž¢DÎâÆâ¸žºŒ‹UËåzƒò”%“®”b …2”`ýRäÉòFlf®Š•_oE Çøz3§ÙÀ×pÆ55ÉÀ‡)ÂéÇaÏ©ðås|–E›.¶iX~Ö_÷£¯ë‚4@üËœ“Ê^¤<Ë3jm§0ž ?’·È9Ë¥:3yd oÐ8QÔl‚Àâý–.7ï§ öÐùð3aý³Ífõ·—/‹ÕöŽýØ2?e~ó²¨çe={9\¨ÒŽeBözØÊ4£Ÿ.«'6ÃIòö ˜Fš1pI4›_?¼ó¹{–J%¤É[s²G€dFô´ØÂÖfÐOÝÑæTêŒlCñ÷ wÓHôÐ|‹Ö€gUùmAÍÄÿP˜´ªš[UÄÚ‡V¥ÓËeôÚ3Ü ž’d‚Ðqf­ë h«Ã”ñê9ÎNuÍ Ê-Z„`N rûû ™— Õñ|2Ù…†Í¤FFgû¡äZ3_ze–eÆB)À x9;ÆË9·‡x9çx°ö£Ṵ̈)›ÆaO—éçª`5¹)6³%Ùó}Ü(p°z¤iukÀ‰/aצkϪ+¸,'ˇ "ö'ñë†Lè¾Å&ƺ4?Ýt#Fü4Œ@æ«Û"~TÙ\O×lR—€J”ìmU‚J€µ¨Á9-;‹´Ì6êfÉ6‚-«ír[S™x Ý” æf7yGÅr׳É=»MãÔSœ j©{Þvr°‰Êº£Š¡çYGàž€îtÛÝݘԉý ‹LƒËîöà.NÂ]ÁBáŽ!ÅÐi’ÇÜqeÚá“YðP_€œðÆjïšÚ¾—~Ø9/5Þ5v¬»Š 3>Œk£Û±¨Ô-ÓWlqT­¥GàláÒÁçŽÈYŽ@É}(q¥e ÂÁ÷#†€úr=ÉOQÐKü×É—ç 3ߊ‡²î³à°סã–ùCp»«¦â/xó‚½a7qØd¬¸á,ˆv®fUÖtpÐE« ¯ÿ̸™‚…~]Þ2j¤ä†¹àtØ‘ ¯â.øø\ïb6¨ÛFkkê%9B ôÝøŽ\¡‚ нÇÁgÚØúxXrCḌÊvAVxŸB®8CWàZ»ÊEíòdÂþráíóAû ”­DŠòí`ÈcrÛ‡ÓÚcÄi׳­èK]h¡Þ9T¨›ÈÖÐÑÑlr‘ 3’4$ £º㈀ðݼhu8gvÒ“²ä}k1'sðjNuØvÉ€ë¡ +K(PqÇÆX»û‰O  ª.àèBµ‰1¾ µÿÌ8–«~®ª‰Â€Ý{Ø~×ÄȧQJ¬*§”º£L EIÙd"Ú/tœAÙT«aPLÈ'@Þ $Z#=t+Ê“„T©9i#ÏŸÑFîÄ鏿L©ü©6Ê\öˆ:œyÏúv:•ûâ{ƒ7 i•3*¤xßÙÚ'h…ã“ =‹\>OØ>BŒÐýÁÕ´]œŒðÖl~ëܰ<‚ýêÆëç³×àŽ}‚%€š¼ZŽ„LþI•ÀFX¸ [(mçóXÃÑæn`»õá ‡$L7êRNÁ™£ÅÅRð±àIN"þ¢Á? z çz4\33´Ç;<ÝNFöù Èå ’UåçusS†=â×u½B^"™ óÔð®5—"¸ðýÅåÛS|©1øÖ¨œlÍå¬ÂÛ³ˆ¾À$œìGB´jzŽÜò'· Ê :rì#‚Åâ#k’Ö! Mäû`éã²J«ˆ'ˆtèIñs=™ùå–É8zzeqˆavF£jµšïGæIŽÂò°>k]Ýž+ÿèò˜s‚wN$W#÷ ˜ß_m+¿ùSrtùÑ÷òH'!a¯’×¾.ñVå'UÃÜÅ¢ˆÇ~O×0µîvüVa¨[ÄQ~[×¥¯ÚwãÇ1{7Hur ûB×ÝÜ‹×^¥þ…©®Áp™L-?üÃ4®b÷öÊçÙIw‹Zå»»Egþ›»Ez™H ×a6÷Ì"7ðéìát¢’LsÞSUd‚û\ޱb»YÁÐüVì;Ä•R1kSe/ôѶú<Ù H‰ÃïïcâDŒ06û¶YoŸ”;žrwH­‚RÃ{¾ ïø ±g€•÷Åbµ×1Ó=ÀN*ŤäûR⢡•Â6¤L|Î)Ïç‡÷FèÌ0ì/§MhùOÛ:¢j™%«ºØÞ/[…”Ìò¾+ÓÇÊÇÊqÆ…=•>eÖ*‡QæM+쨱·æÄ$ÊmòϦ¬î T+j¢´Pî€_¯ã¨±_»û#"Š’L 9– Ìw×§@ÐdÁà÷Ü#ÉÂó#©KT'¬×‡e<€¥½¾?\vâÁ‡ ^.:Ì‹up)ÃEm2mRï!õ#µéP§Ë%RšÌJÎó çùÉ›wÞÙlà\‚ÆßT~î?Às vG\L"¨aªG L&=.×ào`ü ‘‚t( 3;Ø6•ôR/eG5E¨l`Éð•Á=Šqsÿã= —­¯ïB¬ò\®±o7×Þˆ}”?¿¨Iuæ¥ßë»ðÜ6æh8žå­î€óA1×÷˜yÐM «!P›û5»F ëñç*¦ñS†èÀ“eyƹ|œÉ—q" ”Û_δôhW»vºû4XE?n)â¶d2™–QÕÆEƒñÇb0)üf3/âÛ_P|=ƒ·7xP±æü?/DB¶ endstream endobj 2972 0 obj << /Length 1147 /Filter /FlateDecode >> stream xÚVÛnÛ8}ÏWø‘"V$EŠÜ7'm’›&H¼ûÐËmÓ6] ]Ц_¿Ã‹Ûu6s8RÃ9gEFüȨ £B2,Y1šWg™÷¶«Q0®ÏHŒK!0Ý‹¼˜ž}¸â|D2¬2EFÓåþVÓÅèo6IJ%2õÂþJRƺü+ŒvVÚfÕêÍ:ˆgǹD”“äÇtröiº{1§óœ½3ËmôŸ©ŠãT©ÀÏCªßnï´Ì¸w¸d?”XÀÞ>ì'iN8ºÕm§JѪ´:¸t½Æg“£»òÉÖaÃÃ2N±ÌøvÏïψ’9ŒÇx¹Ïfpm ¦6m ҽ­WPM•¡Ë¦õ.S‚³©ƒóV÷­{ww: Ž%É·ûžÃª¢@ŸÇ·` …&>™QÊò+¨^J&œ„èǹuÇÌsôØëÞ›Ò¨6CæçaÌ‹,Í ¾=Ø©/mJ&TF§Zª7qøäÞÈ(¼<éEÙÌ ('Y@î=*µú¿RK¹+É£®6¥/rž ´„SÔTavߨ®kês‡µD3›u'î9AV—!*ŒõóÆ#á÷Xg7•ñùç Û¥¡Ü„¸Ûr‡D n68d;h‘ehK€VCû4Ë0µ]6mÕ…™ÞŽaè,œÆD—Ï Œ¥îúè*{ÓÖ°çOsªT œK¶Ç–œ*taÜ `µïb·ÉËX| \GmײhË ‘yrô¬ÉÑU"sÔ´ì]„½‡zÕ­Lgʲ /ÔËÈ´I£ëÚ U\zÝêßïfÛ×­ÞîúÈ‘3‚¾šùÚƒ|škBa*Ä!×ÔëmS¬ ²cô÷Œˆ¹5µ+¢¢¨{ážbû܃™oꦆþš¡ ñQx¸pTìæAzœ@Œªqž03ÒŒb ªr€°ð…j§ŽÈ%VbŸ€ûþˆCñ§kÓÙ.ú ÁØlptMÉ ÖvîÚÄ-û§¶?Ï´íã}à–ÖñàRÓ±’dÅpiyd ˜C^)eXųÜõk€ 4£Ö,MkêùNx‘Á² Ê"'.ïu!Þäă;± è²ÕuižÃăàŒ)þ‚ÿŽ÷‰, Ezè0ÐŒ“b¬ÀpDžB¼.TX¼ª/õ¢©ìïí 3/ n¬‡jÕÇÏ¡2žA‘#ÐÁ¡E)X24jˆ> stream xÚ3T0BCs#s c= cs…ä\.°hQº„äÎeUgbj¬gjb dcUWN" endstream endobj 3107 0 obj << /Length 4474 /Filter /FlateDecode >> stream xÚí]o㸆ïçWäræ"¬HJ¢X¦ØbŠv/¶Y @Q[“Hœ¬?¦³ýõKÙ”yttÍeÛ]Ë Ø™dÌóñ>‡”HÑ”¼*Üòʨ+ÓhÑhs5|S컾»:üåû?¿‘þs×îƒ×à“ºyó»Uu% a +¯n>CS7‹«¾}ÿüüîZ5oÛÕbùõݵÖúí7¿?üùá]£ßîVóíòiuøÍÇÕ¢uR¦´ê­ªô»ÝüåÍ·7Gÿ•ªDUêÄ`ûO"6.b#”¬Ê>bU‹¢ûé±–LjMõö›w×UÝlK°û‡CÀ.ʃÑRè²VÑâêº,„)¼ ŸÑòª¶®Kÿ×@ön?¼ÿëß¿=|¬ŸRåÞJqøSNyøC ~’§ÿí5@u£Œ«}U)¤Õû²•û'QX÷?©öõ3ü ,$ßü´ßב‚œ†.ö´”6£H+4 …¯àþÓ#ÏÃbs\—JÔ¥¯¶§«íãw7·{ÿq½i—FÕ¼ÖûK¦´T#Êÿ¦´B{¶´üGN–%¥´çAÕt•å†J++P6¿{-›ÿUÙxq³Ë&´gËò‹• %¥lçшT5P¥<ø½9="Ý|ÿuù+„.ê׺Êj@×\eJQ4&»æ@{®æúœª9JBÍaÏãš+»;>_s?œ®¹Ýj·¾­Ÿv·óû»Û/ízùù§q ÚÊy•S¯ÁØÝWZ S ¾ý500.äd/ ­Ùr±¤”òŒ¯\•<;B}×noïgÛÙºYËBºž l¯× o0Àã…BGð‚XRð"Ï#¼nÖ©´¤ðn~¼_ÏÜ,â[ «Õ„ør`}öù`ƒ,”8Ä’yÆ`KkE]iì®mÿÓ2}WÚ}ÔgÉ–ÁØçš`1å1ÂX0bÏ#Œîƒ…]iWí¿Çèj%”Ò/õ6« /`~m|m@J¶bkÄ’RÈó¨6L7é¬qml\Ÿ??-WÛÍå_š{ òñ<^(t¤ëƒXRð"Ï#¼u79l(¼‹Ùzóy6ß>­©¼FWgM˜ƒé3· ð0¡¬‘¾ bI‰<`VÆÍ±(–w»å¢åaNðj|H5â±=Ϩé!‚C·#€e-L7G|œ}uÞ=¶ôˆ«´qÏmUcç³Ì‡ ðô ”| –~Èó ®…l4 ŸíL  Ï2`0À„RF†PK @äyPU¢.* às»˜­¶ËùOUûìóÁ@,)‚<*DZÇß;EŸ¦]ö¤Æë‘:àQCÑ#—fK jäy„º°B•º[ ^v Nî2=õÅü>Ë|€ÁJé« –€È3¨l#êÚpéà [_ê5ÈÆ °xBóýÆ’€{ám7°Zol¥ÿÂðz òñ<^(t/ˆ%/ò<ÂkŒ¨¤$ðNvM©O)ŸV0ÀÓ‚ºEhXRh!Ï#Zu-¬Ö<­s_SêÈg ðl J6 –6ÈóˆMU»R72/xM©%Ÿw0Àó†ÊGxƒXRx#Ï#Þe%Œ¬!î¶O¯ÛAÓkà ˜_Á_’e×7`,)µº]ïVóÙ¶]\Ò®»>ßl’¡=KJ* þÚ BI!‰Yݲ âØœ­Fì—‡@)Õ0t‹‹ÁQ7 Ãþ‰ål½œ­¶ôÎñ„¿ÃyÛ§žË34çxBm#Ð`€ e±¤EžI ué W<Ð{÷ãeõç x PÖPK Pä™Z•èœ>h7G"¼l„±¿Åm3ÇÊ'“Ï*àYAÅ ûàÆ’Â y&Y•útç»]<=Ζ«³:ïò(O ŸO0Àó*Eø€XRø Ï$­ÃúŸçõÓ§)ô%ŸL>«`€g‹Œ{ –VÈ3ÉJ)Ç“`u¿dß0/ïð ?¡ïµÊ]3í¹5ƒŽÈš %¥g²¤rÕb¨JØü¸›­/þQ}/@6ÞОŠ5V’}–CIÁ‹<“x éJ€Àû´Z,÷kBû¿m—Oä5S;¿ê“n8öiäÇÁ?C­ø=0–JÈ3EI[IwÂ#¥ýÏËO;Tw<±ý Ñ “>èl&ÀËd  ÏÆ’À{&™4Ýf˜†aB/¾u¯Q÷ÄÄ“ðzäãxÜPtÃÞÁXRp#Ï$nÓíoápo¦2PöiäS xJP«%K %䙤TY®Sn¯ð›/>_ÔLŸq>Ð`€ e­ùQÄ’y&–݆ºxxº{&¡v¯9Ÿ7޵ôå x`P¶š/ÀXR€!Ï$0Ýí7‰£iMðñDŸk>Ê`€G ô=K Jä™D©¡ëÉû5ý u­ËI~±Ñ ~H;ê±=Ï([³{û@ )D‡nI Òˆ&ôð~[ê;qFØòl¿çE=d—ÏíØžçŒtÅH ·¡[’[aâÑ]'Ìí]>·c{ž0r5 ¤pº¥¸©n%¬–qpϓק—M`Ñ 4äÙÁXàaÏ$½ÆE¥÷|as‰>ã| ÁÊÊ¢0– È3 ÔT|wÜ/uÒ<§~CÓç5à±Bq#XA,)X‘gkݶ¤¢XÝÏÜKí¹ÖàõõYæC xˆPÊÈ` bIˆ<“«ÒŽAlWôÛ'Ñg™1à!B)ë’…bIˆ<“Ë2ÞÓ¾ßñéåÓ xzPÃH±¤ÐCžIzZ;Âú$=z,=›î>|JÁO jU³la,)”g’’ït”·ÁiR¥Ï2b0ÀC„RòË00–ˆÈ3 Q*ºŒ@¼¸©…Ï8h0À…²FîAA,)@‘gh¡ô@™›Ð)\ù|zùô‚žÔ0r層ÐCž)zÒÊxw¼gNðë^ñ=Ùv{Ýûì³á,ÜÄüX cI€‹=“pé  ŠÁ¥;æHõ¹æ£ x”PP~~cIA‰<“(MápGPòÏ/&tïÓg™1à!B)ùK%Œ%"òLB¬‹xäfL ¢Ï2b0ÀC„RòWLK D䙄XZº>‘XÏm/ŸL>«`€gãgŒ0–VÈ3ÉJ[Ç3ÎêyúÎg™1à!B)#Ä’y&!ªÆ6§ N¤ÃùdòY<+¨X¤ÃXRX!Ï$+ÙíĈ°z|Z´5»ï3Î ð@¡¬‘ûNK Pä™Z˜xç{¾Ì‡}ÞùXƒ+7r' bIÁŠ·!/ó•náH.þnÈʼnſØ;Ý~Û#Þå endstream endobj 2912 0 obj << /Type /ObjStm /N 100 /First 980 /Length 1973 /Filter /FlateDecode >> stream xÚÍ™Ñn\·†ïõ¼Ln¸$g†3,ŒIZ ° ­á ÇY$F É¥6}ûþÃÝÑ.$9{,齑ff¿ŸΠɣ6jM%µQ,±ÿ®=uöß”žÁ°DTÝàÄ<N¢-¦©×æÔÅV“ŸÁ 4hø“’†NCS-…ÜâTksŽ¤Ú´Â³¦JÕ%𸒸5Ÿ ‡RK•iZK |Cª“·:¬ÑÝ‚VÇXK}MÕê#Á,«vŸ*CÊ«14Œ]ƒ¡aæ ,,hŒ¾·š[<Ÿ_ýÇhFS&Àsõg>–iÏÃG ƒp†ÀYÌGàSèmZ ÷îcLAgÌ <-Ô\ç`s|_³î1˜_+ƒîάИ7\¨4Aï°ÔcÐ5!ô®Û±Îu.cÇâÔ{Æ_ÛŒ=Ö‰ˆœ¬”ˆÙ¿©[…†‚,mú,S\ñÝ>G!êsôHRö•Á¤É¦–‡ jT1pòüÃ_[’2uÚ IKÛMF’ùè­'á¹æ¦IvÙˆ©"=}¾6’Ø\£Q’ÌÐQS/걂d¯Ãç1(u„ƒ‘üÍG:<§É)À÷.“‚„×µa©›¹.TKÁèK)I«KAJ©GüйEI¹óyú¨`ô°$i¾˜¹V–&õbeÉ ¢k$Cjê%Yó`—ê¥6ü˜´‰‡® d­·vöìÙÙæûô™0PÚ/Òæïÿø'Fäb19¿þðáÍÙ7ßL¿//Þ½Ü^¥×ióã÷ÏÓÍóWÿý¸Å£·¿nÏ6¾8¿Úž_}òRW'žm^l?]\_¾Û~Ú•ÿ|ö·í/ïß~wñ{z]ÒŒwnÈã Ñ7Pz{ ˆûÿ·ç瀾Þ5èl6{ƒ§qk<ó+g›—×?_ÍÏ}þ¯³Íw—¿l/w²åî&Ä•²·ª=7”œ4ÉâñlšÑà÷mzö,m^¦Í_.^]$„ì«Îÿ½½üôþâüëÝK«¯=e-³édï„Ñpékª"ÚYQ9UGöZGÓ̳SŽ’My¹ôÌÔá©ÜYê÷ù3•Ÿ£ËíxóY¬{}Î;ðîzGÛ{Aåºÿ„¬_G%àÓ‚¥qã‡±ÏØ}·ÙìÝÀ“†v;÷7¯¶¿_¬€ÖîV@+ª€ã0¶úÔ¥ÚìžöG—jû£Â¼?1±Ù75Ôã¾ñÈ7pæØÉ²aÀAÙŽ †ççZÛ²–r˯ýLÞvÜÏä´c陚vå\i{,ëÇ2á ˆ8ç±`*\œÂ§I‘N „‰)ûíâ´cÅÉiÉTp%Ëd#£é-‰"7 .®ÖráÄÊã3ýö¶cE¼iAê`7b^´B¹±-èQËÓQ/{pÒ{NqúøSœÖeåÛyæ'÷“ޏˆfºw¾íèE¸@YP24þ¯–ÆÊ=Kc_š'¾ £7ܹ ãÙÝ…©ÖrgŸ³¶¿[\ŠÃ0zF\œmìQ¨ayyyyyyyìÈóMÇÞ¨a´0( CÂèahFkkkkkkkkkk[[[[[[[[[[)Èd 2™‚LA¦ S)Èd2™ƒÌAæ s9Èd2Y‚,A– K%Èd ²Y‚,AîAîAîAîAîAîAîAîAîAîAÖ k5Èd ²Yƒ¬AÖ k-Èd ²Ù‚lA¶ [-Èäää} ¾yÌkÉX¤®5WrÃ}‹æçŽ+_»÷-O#}ì«¥fÓÜý%zh£¯­¬é§Ýš¸ öA«jú™Ø—54E±YtYIÓ àŠ›ÄЇoDÉßSÞ/:úiV\'ü-[h¶žÅt]Í‚;µ¿YÍÚq¼«j2îWýhš'WªëJ¦YyËc¾@¹_SžH=@üßS¡i^Ÿ¼î<»×瑦z}öuç)8µò¡>¹S®ÕÖ'sÆ¡ñ )-ËÊ¡E{ÿ¡ I¿‚÷¶nh½½Öö‚2Éd+ϳbžr¤Ùpí.ëv>.”EÝ–qkMW- ÿõÐùhŒÜyÝÎG†õ;(â7ÎO÷+Ž'RT\fýÁ¡©–ù3ö“ivü>jB„¦4ª¬£¹;#”ÜíHR4Ýß÷j)O£I–Çѹ„¸g[I3b‹s‰´£¬¥ž?×kí‰$qæó·d7’Mr/mݱ„ô(m«dÜWgñDÎð¸¡ùµUçÙ Ç­qÈ¡6g[]WÓÓ·R¨åfc]M»|(O\S²Öu;_ÎÔ)ÔzÃóu;_ñd”C 5©Yä3ï¦#üÜÆÅ endstream endobj 3236 0 obj << /Length 4652 /Filter /FlateDecode >> stream xÚåËo䯇ïûWè¸{P›ïGn  Œõ)„±Ä•••FÂèû¿gÈf«YÅr9öNsaÀµ¦Õõ‰dó1üÒ‹¤ÿ+½¨³‹ºÉ]“××ï’ÓŸn/†ùþoïÒñç.û¼D?ù—ï¾ù¶,/ÒĵI›^|ü„‡úxsñ¯÷YY|¸ÌÚ¼©ÞÿðÝîû?÷á2Ïó÷?-îX³Úµg³_åÈÓ³“ƒxr¸‡ü¦‡kÑ#ɹ:wUY ävwûØ7½q–v€0·²ÊX€¨ @’¬r—ÖÀåí.-\—g½ á`Ž3¶Ã„x˜¸­üJ×¢I’˜e檶áaþ´tì®mžEtFÂgo ð`q‹«œ‹jÑ€%ÉØ"sYÚJ`—W¨i{ªú,ÙrǹÚ1ÂÏÓC}ÖªPˆ†Ý<6@—&®nÖÐ-ïEóÆÕmúèq„†¹Ø MŸç ¡v ‹Q(DChJ—'©ˆè)þ­kœ¥ ÀÓí60T‹†I¦Ëþ›l`Û˜ŸŒ™€å4ë¿™áZœhrÀ©î°ÈxN7ݦÎùüŒí0a&n+¿¦Äµh`’äfÕ¸¦`>m󆄟·) À#ÅÍåW™¸ R’ -—7¹ˆtwèv‘^õÓ³“ƒxr¸‡ÂƈjÑ#ɹ¢ï"“{ÚvÏ1ÇÉØ9Á<'Ü1~¥‚kÑp"ɧ¼vEV(8]½u× ¬ÊÊåíïu]…ã1mçðÝlpI9ÎØàaâ¶ G1T‹&I`ï43òõÇ8=;9€'‡{X•,9T‹†I¦äжìë_"÷ôz¿À«I]•¥y¡^÷-ɧÎüjèÃÇ/ÑçCæóˆáQÅ”=[À¥(˜Óä€ySº$[ºƒ{¸éWÝÛîþ*þ‹Ò~–æ Àn´³VV Õ¢H’€uáú«ð&Þ§_üôìä`žî¡@Õ¢!G’rUá’ªÉÅÅÚÏÒàâV Q-€$9Xöà-ÿ ¢A7 Ð¥ýÙZJ옫,Q±gi‡ðôp+…-Õ¢áG’€IêÒVø´™ÕÆ8W;F€Çˆ*l…¨ F’L1æmâê4[ÁÈ\ ;·›<~2fNh–Ó¬cUÃqµ(8Ñä€SŸžåkœØÛqEíÊ?èäšc3NÀÎàÙà.ñ»B\‹† IØT­«Kq½xØí?G~,ó³´„x€¸•üN×¢H’€eë²ZørxÝ_ï^º›óÜ¸Æ ØÙÀ<Ü%aãBµhØä€Mq<È›Åo¥§ýA¯Ì#¼Àá{`Ç ðxq£…MÕ¢ÁK’¼ý"OY¼Ïžkû)ÙiÁ<-Ü7acDµhh‘ä€VV»&/%Z8kó³´„x€¸•@T‹ I¦uÿƒ•0¢åþ8;'€ç„;&pBµh8‘ä€SR¹¦^ãtÎËýqv60ÏwI`ƒjѰ!É”MÖÏË l6°Ü÷³4D°g­ä׸@šlJצ,@á ¯¨Ž³´„x€¸•üˆkÑ$ÉÀºtEÞHã9ŠùÉØ9Á<'Ü1ªEÉ$œªÂµå"§Cw¿cn_&¥«ê*Æos NùY[ŸÎBŸçžÎš56ËØoîãR4½*V0ßÃÁòÄOÆÎ à9ᎠœP-N$9àT´®jNq¿ØOÏNàÉáòë\‹†IÈå­Ë’R ·µ9?c;L€‡‰ÛÊŸËáZ40Ir3ëwy™s¯dó³´„x€¸•ÂÖˆjÑ$ÉÀ´qYQñv‡Û»ý K‰d‘9NÉN àiá¾Õì]V\‹†Ih%µ«+‰V·Ûokß9ÎØàaâ¶ ›ªE“$S˜mí²¦Xní(ã„Í(áó,IÜÓš½%‹ Qp$±cS¹&ixŒ}½Þ8m3Lø< w–_Ñ B0Il ú©\žÉ0£y=Û8»Ïgú<¯óAí₨Ìg* \S´ Bgôb¶±æßàðŸ´Ð~LJ QIf±á[(]^É$Þïc%Û0Éßð*JÿyáM”ÐGþâ2*DõÊYì ]ž4.my1¡çw|àòøT³ò?Ÿ…ÿñueÇ]†Õ*è?/ZiÈ€«d-’*« X$%« Æ™'`Ÿ¥[_îùå©uFE ð4dJ|$E çÃi|îö¼ëêŒ/IN5úžà¤!Ìql¢§ò=É8ÒcGz_›§Õã°*'æ’R† ÌS޹N)81•‚ž9§<2_÷B¶ç½„™úk´ DÁ.HC˜UÌQeˆ’]ÐCä ƒÄøo¼N]6z¥à¤!Ì ½ ¥Ê3(%Ï Gɹg(ÏüæëÔF£FX A²ÆJ¥V’FгâT‚žUœ7`§Æ]@OpÒæºóDOå z’+ÐÓã|½ÓRõêÐ]¿œå¹„U| YYê$€ÀG’z>œpâ#Ü$¯bº90õÚ( ‚†0—”' *) •¤€(#ô<åû䱬4mb@@È‹IÄÚS#~‚Ðãc䀟¿K~µ;v¿pï­¯÷‡Nݱyÿïý#+—WTÞ? xÿ<Îý¸ïÿü _÷ŸzeTùAåGCÖˆ¨T~€DRùLXeòÁrݪó›XI:?²ÂJ§ó›X‰:?ÏŠSúM¬„'G¢\PX•~TPúÑ•ã‘Né@%¥ŸÊiý& Âã#q5 ý¨ ô£!+K~ЀJB?”“úy {dê¸ÑöXÛ Y¹Æ¬³ýVÉöç±rÆ?„õì)™Úh4þ+ÁøGC˜§J&V*ã°’Œžgý XÁÃ%S»ŒÖ?`"XÿhÈ•õ˜HÖ?Ï„3ÿ!&Âc&‘œ9[ÍQ0ÿÑ•{4:ó@”Ì"gÿˆâKNÎïY«Ý€ v?²¶ºTÙý˜d÷óÀ8Ëþ='S—º?@)èþhÈÊ•GîPJº¿%«üó(£{Î˪ꛀI®>²rª®sõMÀDWŸÆùúŽÀÖT©QžÙYÝ}Tp÷Ñ•3;»€Jî>”ó÷y ›XÂX5~QÐøÑ•%ŒNã%Ÿ‡È©üÞº‡§á{«»—Ý6ŽˆV¡ „~4äÔ–†=%× ý¥$ôó(9©ß åò³~åé]+‘?ìÇá6Šÿ· þ£!k¸Uâ?À-‰ÿÄJÏ((z‚ †¬í!U‚B ' ==FRˆè½mñéB«Ï° >C²vþ òVÉgè±2NÃëÃîs·¹B£€ D2e¼ÑI¨$Ar"Äè×woʪLœpKÊD²‚[§Lœp‹ÊD›Ñ&¸Ÿ‡óÿMm¿V…"Š4de‡¬S(PI¡è2ÅÐx׸V±"ÐÄŠ4de«+=I¬èé1rE õ«Eè E²FO¥Qz’FÑÓcTŠ@½1=£Vè ZE²¶çTiž¤Uôôµ"ÐÛÎå8«ZP jE²r²©S+JI­èQ.ë$s¿1ÞE͸8yã"‰XÛ.5ÆE`)=Êeëâ åù_X5ª¯R$kG=Jø*EχÑ)ÎE¼Þ4 œ X¤!kìT‚E€' ==F²8§í5U«]è vE²v˜SÙždWéq†EDo“×T­ÎÅ «ä\¤!+×dtÎÅ «è\ôXïâ€UúN| Q«P BF²²…ꄌ€R2z”Œ”PF½µzžàa¤!kôTF 'y==ÆÅØýüô¸ïö/w‹Vª¤tU]G¹{M2Pþz¨§‹ÎFqêP¿Na™ªœÀTr6z¦Œ·±ûùåÐ=t_|Íöñ[»½1€0j'Ö‚å‘D¬²VYµdyô¬Ó£g½ûx‡,BØ ^£øqÂ+xIÄ*^•÷ðJÞG—q?~:t «£º?•­‹¼.ßp Âê„cµà¤!§—ìwœuIøe’þ—ñH~þ&”u^\}¿ º…ø°•ÓžBPV’ˆqOÁ~ëK§¬„_IYé9måíîáaáK{uí²l“¿ |£ãr‚/(.IÄŸ?V).¾¤¸á3šËÛîñ¡{9Ü]o}`´^z¸‚ôr0 ÍØíZ%½œÈJÒË,#¾<}íánᔺÿù¬n·µ]3{£s:Ö rL±r¤WÉ1'è’ÓK®–™Gèý²þñÇÿ,‘§®ÌÓ lÏ££ÊæÕïÕ$\ö-'*¯&H°¯æäôXtkáîwÝשÀ²¹;‘„uw’ˆ•MYåîDÞÝ9½pvÑßy¤ýòËÓ×IÛ¨ûDï¢euŸ$b…¶¤ûüóEÀ endstream endobj 3111 0 obj << /Type /ObjStm /N 100 /First 1004 /Length 2299 /Filter /FlateDecode >> stream xÚµšQo·…ßõ+øØ¾ðr†äÌ0$5Ü—0â<´5üà:B4 [Òß3”æî Тh½‹ºZžCÎìîe-ÔRIµPODâ I\ÙšjSoXjR½1R×—$£{ƒ’yƒÓ`¿˜k¢Òø­Ånþ´Y›·$QÎÃÅÔ‹Ù ÏÏF"­~]-‰¬yßJ‰†øx0(.ê=jMLø˜k™×õÄg_ЛëUM,}ö°ÄªSe$6óó’â=" 9‚†K¸z†€kwFÃ%Mf„ÜÍg¢áó3m4?ïƒ}zÚHmv+½¤FâÊRã9úΩáBoÕÔz10zÃÏÑ÷žšÎ¡aàÍæè»¦6æè1èàÜŽµà9zÈ÷:G/”z›£Ç„õÞ½®‹8CVÏfžú(³‡$)sÙE“Ð\w„Š¡8CF’*ÞC±àͼ‡R’>¼$:_kc‹,cŽ^{R¦ú’)éüL“²Í¾–¤ÓOÚÉiW™«o”T»÷0Njâ=0í:Ì×!X™so=Óì!Éj=4Yk³‡%LŸ3l$õìDê™3þ±Q||XŠá©xÓ Zori ‘¸`°¯.ûg•¦†g¸Ì©Hq̈÷E99‘äø}Råäs[}ÄD4³g ωǸ‰N Ň&y½TÏEÌ ŠÑS‹ h¤2ãe^€èæð$ŒŽ˜| „&óüÔK®úJxU·Þo^½º¹üôïݦË÷ww÷7—w_ÿþ0ÿÓ/wÿ¼¹üpÿùçÛÏé}Á ¡|¸¹üxûé!½g+™¼’jÍŒ)b¹"s¹•]^§ßòûôÝw7øïÿdjÏŽ`΂ÅYK®Ã^DbvÎag/à+“F6^‹,”êêŠ,#ã^¶”‰Ûg.È¢`Ò°,Ò˜õ¦!N¿cÓ,£r×2ed­[ ‘jîE×2ûÈþà»2E2 /2™åf³¼GvÁOz9Ì1ÎAV,_Ù¥PëYµ®e²fÊ_™µg}-“$[Ûn|¸™f¡£:i9‹æj;&µ sÀì§0Â,»*57YJ4,m÷=Ü’ìèV«çÌ+þ•¾¥¬q†[; ž£Ô<`ƒ‚¨”•eiŒ½æªÛO(ãæ°&ÆNÌ_à dÆ`œe€É}-S‘-˜Ø+6EVÍl0±˜0çSa™z³3lÖŽ‰‡‹¬f6BêÈÆlx ñÁÏè&¼í™xºÈj&ÃObsue²­“¦mÞ˜¤ˆó >­œÃ,y»câéB‹™æÎ|»úÄÄžq޵L5¬çŽi‚8˜|SôyœþˆYÍìpóÀSð =0^VÏA6EÚîÂì0A/#±}9YáõöÈÖŽ¢Äþ÷$éënb±ç•JÎý$&õ\·Úì\%­ ÛöwH-›¿- (6½GqÊ8‡ÙFCœ;faÊk™VŸÅÙ`Ld5Sá¿üý[0±ë¥Z×2fhÏ„1‘ÕL“*›ékRãÔrÆÄöL©m-³Òó8+ÌÐSιó5¦«ŒÜöL•Ã8OcvCœ»¹…1‘ú²¡–³æΤÊö­ÝÍÐó¤çg­‚¼Ý6µµõqú«/ÛÅYݽl⥞ÄÄϱg²û![gq?´Ù¾JnˆÆÒõäá~hÇ,î‡3­=‹“ÇyÒܲºÚü-Û¼ô? )n‡vHõ÷QkgÎĶâd“£ ÛIÄ/´#vX¡Fkƒ„-Ù W"GÈ“žÖØñ ÊÍM3à |OuÖˆaKlÏ„-‘#æY)[Êó8‹ÇyÒr\‰éfù®DZ]:·WR÷Lƒ:bžT)$†877Mp%‡qž´žWR÷LjkïAWò,N¸9bžTŸp=ˆss|þ…þ_'à í™p%rÄ<+Nÿ¹gr;Žó¬¼…+1Ýœ-Á•ÈÁ×cgåí€Ú# ŒÐ²Ÿƒ„'±Ý‹bX’à OZL… Ú &¨éR" É>Fu ´v»ðôÜöÊÿð¹ç·ö×é}¥"Ðü1]þò׿%ܬÛ:éî믿~ø_¯{s÷0‘ozOöxù?¨õÔô³v~(äñ7·ÿ%®bÿeÌ_ vyûùþÓ»[„˜.o_¿I—Ÿn{HžÏÔÛÿ¸½¹üÌÛ»‡/çêÐß'çËý×ÏŸnçgíñ³?ßþüËÇî{œÂŽÔ÷Ãræï{Ü¿ýø"~˜©<^?—á øó<–kžÆzjôhH44Ç`æ ¬§Eƒ£Q£ñ¤L¢ø]ÿÔ£!ÑÐhX4Êå€r(s(s(s(s(s(s(s(×P®¡\C¹†r åÊ5”k(×P®¡ÜB¹…r åÊ-”[(·Pn¡ÜB¹…råÊ=”{(÷Pî¡ÜC¹‡råÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ#”G(PŽ"¢("Š"¢("Š"¢("Š"â("Ž"â("Ž"â(".= †E#”)”)”£9j£9j£9j£9j£9j£9j£9j£9j£ù©?|Ã Ž§³–Š'mGqÔ÷z_[ôo=äHjYËvG}³×ëZfiÙg;㛽5Æ<˜2jÖ¶Rßì5¯®Ìéj¶Sk‚ŸƒúÚ8•³ZݘØìµºÆ˜_™îll;ì$Øì.KsH:jcw"P°ÙkÇ’¿uã|eúù˜¶‹Ó¿º6‡ü|Œì˜ØìõƒSˆ§Í-̲;JÆzx ñ´¼-†¼µÝñ5ɽÛÒ¼íÃrÝ}”"¹èXg7EÞnçÌÝòÊÚ(•![”Ý_òÒ¤íâo6¢¶Ã—”gål÷“Ï»i•–aþþK”ÿRŽ< endstream endobj 3238 0 obj << /Type /ObjStm /N 100 /First 1002 /Length 1790 /Filter /FlateDecode >> stream xÚµš=$¹ †óù íD#~SÀâ€3 8qä»ìàÄö»Æaøßû•¶»ª‚žJNZ,0šF©R")ªß¢(­Q"ƒ^XÆÇšc@E]Ç€‹åx˜¥x³–¤ù°•Îóa/ÔTß0ŠñÆù8ÞÍ1Ÿï…¤ Ò Y3„ 9÷K¡c†H¡4#-Ôc~f…[Îϼ07CÆN³% ë´[à€MÃñ*öi¹Rᘦ+Îi»J‘6Wýn$Fx=Ï_ˆ704°ÓúñR›Ök/ÓzÃKsZoT¤Žm&c$EÉçsZ”s>gEµ [Ì‹9Xâi½eјÖ[/šÓz,¢öi½S±ÖÇ8ö‚Û ¹4f6\cÌ-nÓ‚°âAs†OŒ†ÎY¢ÙœÑKŒÁ…à¾%lôð-¹„Ñx¦…Ëx3–)bZíŽôaKz‰žFFÉ6­Ç«’§õÙKÊ´¾·’:­ïTÒ¦õØ2¼dÌèR2¦õ‘Û§õøµ7ž3¼t„=ÎÓúž¥K Kì 06¯û°AXzŒDáÆæùIé!€b·µ±ýÜ Ãá†#C¤!´¸ÅHš³#ˆ™9 IÒ|IJ¤Å†­ÔrD#h +0¦ÿÆ4 ):§†Ì™Ó@CX÷·OŸÞÞþß>—÷¿|ùúííý§ÿþãÛüý¯¿~ù÷ÛûŸ¾þö¯Ï¿•_ÊAûûÛûß>ÿó[ù…³Õ‘e¦VÇr!wª ªÍ¤bÏñÜåÓ§òþSyÿËן¿–÷?—?8ý±üðÃþÿN¦XU¹0U*Öù5“1YëØ¼ƒ)\ƒe¯Ÿ¤U‘ “¹¢–½fê"f“Úû…ITg¯™ö;™auÂ.®žÈF•Ó^"™ú?5µŽ*ü„jo5Ûk¨û"fpEõ=™ø\Ø÷2k‹ Ó{MÝÌ4ª†*t0 ?=ö2•êèS¦fÍÜÌ”V}tO¦dÕ–¯™±ˆÉø‰^à`rT4X{ýl½z\˜UµoõSz¯ãd=˜Ík÷¾ÕOɬA'Sº×ÜÌEÈH”ô“˜^ÑÞ•õ@E?‘³ÓÞ…µ@E?lq«Íx¯›:ãDšV Þ릌¼¸¸©Z[—½nòÈ‹ SÐÑf&YíÿÁdÁ纗Ùõü’)ÄÕm/“;Rƒ/~6®¸Ýl!Nô_|ž×Ü©z·½~† n/ÌDF¾‡ù½çcGj\¶“£Õ×Ç5³,òÓ¸âæ|B½U¶×ÐXÅTô_íìX{ȽLAÿŦôÊ}3“©6={Ü7kÒëÃ3ÝÉp ®æ&eé{ýl {ö¸ª×ô­HêRá©G•6sQWBæë¬{„®¤·×-B,ºw’'êùÅË@ïż—iYÇ·ZmI×ÍL´%~éKȬªËÞB_2¾:˜èKzÊÖÜ$ô%!—ô_M÷úIŽz~a2þ€¹è¼¦f¨ççAF$ÕÔ¶ú‰¶­É‰lR›€\Ô"$º/:‘«}TõP(jùyV'Z¯æ[·Ò¥¦Ä@ãűuUMªÄyN;UÒ=•ÝÂYb¤Ä”І)œD«òAɳEÌ‘ya¢U€»{™¸. %9™h2tËn>™Þ¥†^üD« ý&-bâºÀCèy0¡ÔɶÆסLt *¶åØ<˜ÎWÀ“‰v¡›ïeî$ÍN&Ú=½ÞÁTä†^˜ã[Œ{ã–q%Ñ8™hŒbKu?˜„+‰_˜µIî]Û–ˆÛ<™øÜ,·Ö!븒´ ³ymÑ÷2WîÓÐ/ø^b 3üôÒÒ*ñÖÍ4GbäÅIô Hž­‰b†Ÿ¤k%§­õý)¯Ìyõ÷öAó!¯Ìyuó!¯ÌyuÕ9ö”W漺,lòêÁ¼‘WWÕZíH ¹¬í¾ºª"(ú’&çy}'¯®Jϧ¼z0oäÕU1ô”W漚‹jÂS^=˜7òê2æC^=˜7òê2æC^=˜7òê2&î&ã/Ò漚‹úLÅÝ$úÅÏyuó)¯Ìyuó!¯>™7òê2äwyõ ÞÈ«¹¨ò=äÕy#¯æ¢Ãó)¯ÌyuSý¼ÑW—-­ŒŸçAv§¯.c‚•—Ký¾ºlmúêÁ¼ÑW—eÊC_=˜7új.j†žúêÁ¼ÑW—1q5iz2ïôÕUk˸›˜Ÿk{§¯®ŠÛ§Àz0oÖeÌq9¹|ar§¯.[[\NÆß–Ì}uU~>õÕƒy£¯.óó¡¯Ì}uÙ~>ôÕƒy£¯.c>ôÕƒù±¾ºj;úê“x£¯žEèÿPá endstream endobj 3372 0 obj << /Length 5169 /Filter /FlateDecode >> stream xÚíKãÈ‘€ïó+êØshšoR{[Ã;‹Ý£Ñ7Ã(¨$V×z¢zªÿ½I)ÁˆŒ`:a¯»Da€©îj¥"_0™L>¾ä)þKžªô©ª³¨Îª§Íþ—øúÛîíéö‡?ÿ÷/‰úÜ×áƒ_Á'ÿøí—?üVOI­âUòôí~Õ·íÓ_¾üçéôë×´þÒ¶íǯ_³,ûò§ÿ¸ýüí×:ûr9lúöx¸ýæÛføPZå«ôKZ¿þõÛÿþò_ßLü"-¢"Ï<;«?Mzœ%Ou´*Ë\w8-£¸Èo¾.Ýó¶=÷Ýó[û6öà¿ÕàóeåI9D¸~zØ”¤Jn?ÒÉß’ùû¹ Ü§ÕÍÌäjL}T ÿÅ«áIze0ý „¡ší¯,RZâšà4ÉHOêU”¡®ðU ?M"“*H†èU᪂”–A•FuRßs0üU–‚ùÛö,BâºâÃE&üãbè9åÿþãÔt/Ç]»¡UÄI4ôú•CUm{0UÛž¥ Ó›&9KtŇ*ŠŒ©–«<*‡ñÚIõ­9s’Mꨮ“ŸŒ¬›žÞÆPz =Go’Æ4M8z°+ôpdB¯Î£$£ôœædøcµ€³WI¨Ä—„mÏ–d#ìа+>%"“’¨²¨,*ZççM³?Ѻ¨Ëaˆ¾³#5Iõr˜àêÜüÃÔUû¯à (väšÎ¢b±ƒ¾ø`G‘ ö2‹’Êýxè—]å&»ý; `}ñÁŽ"ìE•«Ú‰ý{³Y6v•›pìö x쀀ôÅ;ŠL°çi”&+»k”_ÅQy/Ø9Þ*)á¼íð¼a拚å úâÃE&¼³$ª2'ïá›n™¼URÂyÛ/àyÃÌ ¼A_|x£È„w:œ7—.Üûuß-{T¿¥&ºiÏ3ÙÛŽøŸ†%À“8ªèa|·>íÖ›Æ ¾­»¶ß»WÑŠ¨¬>Åš:ƒRmu0KÛž… ›¦)KtÅ'ŠŒyÃëÔÉsøé‚9˜ó4ÿì{®›³ÎF(gОãhQd‚¶¬£ºt¡Ý¯?¶ªëLý—Qò*?Áäm{–´QdB»È¢¢vÑþ½é>ãYŒÞ `T¶=‹ æLÚ1AW|P¡ÈUžEILï¬èÖ?vMûö¾¬ 8:Áœm{–3L¸ÄtŇ3ŠL8giTÒuÁsÓ?7ýñåÿÜ/Yòù¯à¨:•‚àU@Ûž]„Yæïœñ!; KÀ¦i”N°‡õ¾Y䂯ÊI8iÓž' ÒÎßö:âCz–N†‰pE¯µŸwëóûãBÉOðàmÛ³ƒ7D&h¨·=”*hÏQ¤W  »âAG&T‡GšQª—Cûzìö‹Ü‡uN‚iÛö,m˜v‰6èŠm™Ð.‡ó؂ηoÚ—Ën·LÚ*'Á´m{–6L{š°3pØÚ(2¡]¬†ÑwBûÜ/Ï›÷·çÍöuÝïÛÆuí(òê'¢1 Õ–3´íY†0™IÍÞ— »âÃE& ó:ªV¹“á÷¦k_ÜñQWm{0UÛž¥ Ó+Q]ñ¡Š"ªYe ¥ê¼já¯nѹ ®Ûž­ˆCªÐŸ*@‘I¤UTg©‚q‘äÎÆgµ¥Á m{–!L¦ÄtŇ!ŠL&ÕðÁÒÉðîÇgµíÁTm{–*L¯DtŇ*ŠL¨ÆãSSªg÷è\TQQ–‹{‡\*}Á…aÛ³… %5{“ìŠOa È¸0ÒUe«ÉMç~{õÝå°Y÷ÍöžîÆÒÛJ´çHNRšÔì©0ìŠI™¬‹h•’îØã= $Tâ‚K¶gK²Ijöb$ìŠOI È¤$†èyVã’¸Ê×ã*g¿Çr½íÁTm{–*L¯DtŇ*ŠL¨–y´* ÕfúÛuÈ>ïÇþ½=¼ÝÕ­¶7˜¤mÏ’„)MröZØ’(2!YÜN|$‡ýssìîýiO€`´¶=‹æXB ºâƒE&hó,Z­ÚÇÑx¶$Tâ‚K¶gK²Irvõvŧ$PdRY)®ˆñ`üÒôëE^ªP) fmš³¨AÎ¥ßöÃô4,áœfQœ»8ÿ­éÍÝ?¯¶?ªiÎB –v_Û¨Ó°j’FE™ðTßšÃ]MºÔöS´íYŒ0¥GÐ(2!§Q\;ÇáÓñÜŽ.Ýáó„z«ƒyÚö,O˜Xi°]ñá‰"cžÉ*‰ÊØÉó.O‡ôö†’í9’“” $aW5ƒ"“šÉVQûP†s³çõ¡oÇyQ‰ Fl{vlÒ˜õ—À®ø”ŠLJ"Ž!).‰öðê8Ü”i”¦Ùãþ‡ép¡>\Ø/à‡ HI.@_|jE&µ‘ÔQš—¸6ÎCy|oºsëzjþÞÙÔ9Çk¿€Ç ]óg />xQd‚7®†é#Æ{h>úóååñ4ŸÉOð oÛ³ƒ>D ú +>äQdL~5 ¬+¾kÎMÿ¸%JUh Øæ\ @B€~x ‹ù×eTǵ‹¿sÏ_ÎëoTbBiÛæm˜y6è‡m–h#Ë(K1ísãº{ñ1é‡ÊÉ[Þ‚“¦9+œ`„býðÑMNÃR]UTç+\ ?›G1È…[Þ‚ý ¦9«O`„býð²XMÂÒ×oGY9-†þyÛ¼®/»þùÒ9¯ÝÉMjÓƒ_=iš³ož¹MV5ÿömÓ¯—oOÂNxfq ósª ÇPŸ×—Oª“-’$:ô”žj.*¾QÅoÅŠÞ½ßVô.)¾5A¢ùVoÂoîsî«{ju×ó³ñÕ¹ãa-Tî­Û‹vo„97è½ìÞ½d÷Öè‰áû†þìRŽ gfeµ å8®$Íà¶$582W^jp[’\•Õƒ%Á\¼ž¬WË;YWƒv¨f\$Í8 ¡®öÕ\%øiÆM%ˆšq] D5>VÂ0o·ÁB-ãfp4ã8ÈÌàà§·%!iÆuIÕøXû¦?:jbøp\åK§@ù¸-A>ŽƒÌƒ—|܃$×Å@äc1 S‡fíx¹S•FuRßs10Lj@¹9F&rB# ¶¼Lä¶$¹®b#×5Ðu®»°´«¡ºÈ wAEŽBÌÎ ¼Tä–»¤"×܉Ž|äî^¹®ëÕK_×ÓÌ•å¦,c9 1·”àg,·e!ËuYk¹. ÷"Ђ†ƒ@u¹á.˜ËQˆYî^ærË]2—kîØ^þÖ¾¼œoB÷ë¾anÏ?ým:õaŠr—7”OÜЖ‹ÖÇPnÉ †r [Êo`où%€ S’°¼’|`¬’Ü‚”ä,Ñ’ßÈò¯‰[ð2O ÌÜT 3G!T¤lxÉÌm!H2sU Th~«„ëýÜ^~{ ¯ú„Oá©„‡ŠË5SI\ŽBÌíÛ~ârÃT—k¦D^~cz}Ä}˜Žµ‡;¼ÒªÓè-7do9 1KÖË[nÉJÞrM–¸Ë-Ùû&Êt ÷Pj2êr_P—£sCµŸºÜ—Ôå>Ñ—[øÃ@Ýõíáítl/“ÊÆÕÝǼŒh$7 !9 1 ÊKHnAIBr ŠHÉ-¨ñ1èý< ­Sè74Ý8 1;æzéÆ-MI7®i帥©ÞÞö¼9»m{pO–Š2Jòú2ƒ"ÐnP¦pbvÇò2…[’)\£ ¶pŠ¢[¶Çýó¶íšMï~h¤Î£b5·£1ù Ô{›ü zob6¿^zo›_Iï­óKßÃhõý_BªS(÷64¹7 q£³Ër~roKS’{kšDð}¥Ùœûv?|f.Ò\ß^Š—€ëš½ FÁìBÜ0&1‹ÑËìm1Jfo…‘Ú½o¿¯wÏëÓ©;~ Ýl_~¹¨Êe¨Ý[ã’ìÞ(ÄÜ^çg÷6¸D»·ÆE ßW\ãšéø¤kßt¸óç¾#6ÔÕm ®nb– —«Û”\Ýš ñu_ òïHy\ÝTÌuÞ¦,7 ¡Ê‚½èí§ó¶e!é¼uY¥÷µ,®‹jÇËa»î~ÜáJi¨´Û0¤Ý(Äì®î%í¶L%i·fJÄÝ†éæº”r¾ß•ÒPÇ·!+8¾QˆÙ½ÕËñmÉJŽoM–x¾ Ù·K;> ²éݳßOt´w‚‚½…˜Ý7½ìÝ– dïÖ±ÁÛܯ?Ä™ÔO:í ÓqX¼{`•Û’lÜ6rPÇnÛtN#÷¸ÒóÉ'M å0·¡Ì›¸§f‡T·¥,˜¸5ebã6˜/ãÕâãîÂ,·¥Y”Ö?Íà ¶@—¶á&¸´QˆYr^.m‹NrikvħýÞžûÇÍ|YJ·MYÒmB½õ1aËÂKºmËB’n«² âí÷¶ïŽË¹q/Ô¾­ñJömB­æ³{½Ÿ}ÛàíÛ/1pßð.æö½PݶÁ+è¶QˆY¼^ºm‹WÒmk¼D¹}Ãû¸‡ÏQ *nS ‚Š…P•P²•à¥â¶• ©¸u%÷­îû¾P5·a*¨¹QˆÙ½ÛKÍm™JjnÍ”è¹oLG¢ëíú4êž÷—]ßžv­ë$+)Ó¨Xý2˜ì*´Mö…6 1›}/…¶Í¾¤ÐÖÙ'm›ý{¿ƒ2T‹mÈ Zlb–¬—Û’•´Øš,Qc[²ÝãÊPŸ¶/ø´Q¿bá{ù´-|ɧ­á§¶…ÿÉî  UdP‚"…˜ÝK½Ù”¤ÈÖ ˆ&Û‚ºÇ;(C½Ö†¦àµF!fizy­-MÉk­hR·µ¥yyŒ¹¡*l _Ra£sc®Ÿ ÛÀUØ>ÑaøçÆLfwíÁu–’ƒEö/Þ¥,:jƒEÐQ£sçŒ~:j‹EÒQk,DIíÆ2ÞE»>¼í\lªd tHd2¨Š6TÑ(ÄìŽà¥Š¶—TÑ:ãD=Íøõ&’á¸öÿšñ@¥³É¸ tF!fkÜKél3.)uƉÖÙfüûã¸*}6ðé3 1»»yIŸ-|Iú¬áñ3€ÿ³=¶*[6(Ù2 1»zÉ–- I¶¬Q`á2%ñ¯}j#Pol²Ëë§fsë£7¶©ôÆ:³Xqü޽ܴõM×¾þXÖ­¾cC™÷O¨gØ+µ^¾cKYðkÊÄyªYª¥ <¡âdãÙÌÉ8ÈͳÁ^Çò3'Ûº‘Ìɪnˆ=¹í·> stream xÚµšOÞ¸ Æïó)tl/zER¤$ X`·Azi`wmƒÒì Xt‘)òØ~û>ô˜¶ ä5Š® 3Çz~–LJ”)aj©$aê‰H݉…`0.׿¥jì'mÝ I6ª5uòæ¬i°¹a‰J¥XÍ]’¡Í6܉¤ ,ÁÿÖáòR)þi”ÈÄåðƒ-ÿ‹G)²´À# ‰[þ§)7K÷§­øñ¬WqŸ‘ßRñ£±·¨xØ^ýYüǰ¥…¥ZÚÒ¢¥JciÑS•²´©Vv†–TUüšú@¨÷[9ÕÖüIURíÝ•ñZÊrM“ùh¨%]œµ%•ꃧ=iµEe$Õ^À°’Ô†·À£i'o!×ÁÞÂ0ÜÅ»Àhfdeé~2nK K&ciÑ’iYZôdÆK‹‘¬Ék}ygÍÇ qj¥û4I‹A«© y›¦Veia©©.-ZjfK‹žZ[Þe©õáŒ^R/‹á¥tZü¨sê¼8nîbÞ¢Ãojs†®ëXZXê–-õ¾xSï©ÉÜGEý}Œ’à~ß 8]÷ûÐ}ܶ\“4tñ8è°ÅU ?Úâ9âÑÍip•1º+xg)‹;¸gáÒDð"©Àaá_Ð…K‹¹É0U—«Ó0Ð0áÁ¥¡O0æp/‚H BK3’¥™Ç™û™¸Ÿá¢UÐCDÕG0÷zêÍàÏDݽ1s¸;Fš¸èr4IJ¸ ûÐÁôÈ«e¹ ܾ|ÿ9½Q²,Èmd<Œ²fE|Q·< á¶oÓ‹éöCºýñéǧt{™~×í÷é›oðï7"­gƒómÌf¹2_ĤŒ  íÙ}lCšæQ¿Ždâ9ÌÚs? Us5¹)=Ã3vf­yô˘ëëä–;BhƒJÍZêW¡Úæô“ZÆJ°#¹æÂõN?i³hn˜K7& ~ë¦LaÍ>ÙmÈ"¹Ø$Óœ×Ù+¼vgÎÚí¢—ùLlNk±sÆDüubŸC4ÇîÄFkï¥}Töh”1=üÄ—é ò#…æ÷éö—¿þ-ù o#cùüðå—_ÞÆ}¯ž>|^¤^!#èÏ·¿_è°Ü<ÿ…õƒJü—ç^X¯ü(Ü^|zÿÃ#ž7Ý^¿|•n?>þú9½ýïn¿~÷LJÛzüðù“§w‹²÷ôÓÓ—ï—kåùÚŸúùÝwO¿>‡º##çè•ðäèöëw!‚g õþeL?¿äŠþXKª¸†¬F{jÜS㞺ÝSÃÐ0,ŒFc¬††²†²†²†²†²†²†²†²†²†²…²…²…²…²…²…²…²…²…²…r åÊ-”[(·Pn¡ÜB¹…r åÊ=”{(÷Pî¡ÜC¹‡råÊ=”{(P¡‘úäR÷±åAÙÆ=æœå“±9ÑÃÄjÆ2y-©É°}%ã†eF¾¾dS“j²r®‡M=[ɬ3+R°²/e\Gn­ßaΙoY‚ñ)#óè×ö™I©ûZÆì5ýqm?‘š¨˜äEý‹™HMÊacÏ¥å;UßYCK@fx-˵/s=ê²OŽºLC®G]6æÉQÒ2‡©;òì¨ Oú€ºžuÙ˜'g]ú³ù¾ržu)4©›HKš\èä¨KŸ´9Â0óaWvÖ¥OòÚõ¨Ë†<;êRæÔTÖ£.òì¨Ë$äzÒ%'']fד.A<9é2‹¸žtÙ+rwOºÌ"®']öïýwOºÐèSNIEyu;ÎsR^¥1&ZZë«ô¤¾Úg1×úê~né~}õ·3—±òê†<-¯Î:žµÖW·ÓR'õÕYcåÕyR^5¶}?jwV]eÖ9Lņ¤˜'ÕÕ ïó™¹VW7æIuuB|>3’z8pwR]Æ$$^v`žTWÉæœòê~°ð~yu3Ê«ó¤¼J6çds”Wƒy¿¼:­—kyu#Þ/¯NCša>߉'ÕÕiãú\\Ý'ÅÕiÈŠ í‡ÔϪ«ÓFv-¯nÌ“òꡟÿ=Y£ endstream endobj 3507 0 obj << /Length 5069 /Filter /FlateDecode >> stream xÚíKÛÈ€ïþs´îðýÈ-²d ï)ZâÌ;#iIjâͯ%õ£XÝUìm ë%,àÛjW±¾"Ù¤šüâ‡hü/~(“‡²JE•–ë×ÑùO»§‡Ë?ýýC,?÷yüàgðÉ¿~ùð§òü!ŽDÕñ×GøO}Ù<üëc’Ÿ>'uZþñgñÓ_~üô9MÓ?÷mwú)ûøÏf÷)©>›—Oÿþòû¢ÃåI.ò,õÌM}ÚJ0*QE¦òK åÙ%¿ãîØ­¶Ã¦[íÚÿœøÓøx?–c€ó‡ÿüés\Æ—ÿ%“ßÅówMˆ¤K›êÂ8ˆ|ü+Õã/qr2ýHFÿ ÆŸÁ$ Ð(ĹÜq\X™TµHQ*tK¨O[‘­–ˆÇèeŽ[¢o‡Õú`wEYŠ$®ÙyYŸ`òfµ»Õ¦?:ÉgãÉaÁÓ;«ì#Ôqn¬êô»;@Žÿ þ»PsqÓ’l‹O  ÈV ©ˆKW ô÷€- ëÞæ [Â`ZäâÓ(²Õy"Šº‚-°ÞwÝjýü´j·c+¼5/Ƕ·›!NR‘TÉ{éâè-·.øèmÆ“GoXÀ¸ŽHn n(²Å-KÎgbÌÍ}i^‰lœ,ÿÒœèY«à.0ãÉ.€8âª&»¤âÓ(²Õi,ÊÔî‚Óôm{¯Üº`nf<É ãRñá†"[Ü’X$pÒýºý6Üo«ÍwÄ¥nÁ ¡‡“ýÀÄ5=7yøtÃ4¬Õ q$Ê 7Ãi>öív7^a÷ÛýîZ÷áËÆÓÃIb z1“‡±iX‹X‰4Š!²·~ØÜO¾®µ î3žlˆ#ÎS²@*>M€"ã.ÈÇVÉ´ N÷NNSgê¶X‡‚«º†rSUÛJŒ§¨NÊç9E¦âAG¶¨–ã³Ä¢ú4Ÿ›ámÿ²`ªrÛƒ©šñ$UX^Ž*HŇ*ŠlQÂUᦺ[ïwÎ9òR¨Êm¦jÆ“Tay9ª ª(²E5¯DZ¥ÕûyØÑ²VÁ]`Æ“]qp]RñéÙꂬudwÁiýuÜmúÃËv¶»'Ç>žVcæè>Nà‘ŒÇŒ'ñÀ:qx@*>xPd OZŠ,Éœx^›oÔÁwœGãü=ï®I¹½Á$Íx’$,)G¤âCE¶H&…¨³ÜI²ÚCÿºÝ-ФÜÞ`’fÇusVÕå ÆSœ'còÛ˜ŠgÙâ\å"JJç¡ùúÒÞgY`Îf<Éœã RñáŒ"[œËLŒ³e'çî¸[7C»YÒüImo0I3ž$ KÊ‘©øD‘-’E&¢¢r‘<®º¶ß¿‡ëýÎFm]073žä ÈœQa*>ÜPd‹[žŠ¼rrû¶nr낹™ñ$7X@ŽHŇŠlqËRG5æÖ¾5/«æpèö߯߮7.pµ(ÓïŽ@%7(•O¢‚5ã T(²…*MD‘bR÷¥ ³;ï¥nÁ ¡‡“ýÀp{®Éç¦a­fHç¸ä¿¥^Ê&©‡“$AU9’&’Ó°É8©Ä.”·x-*«ÌØŒ'!Âs”A*>˜Qd‹s‹¸vr¾ÅkQY`Îf<Éœ;MƒT|8£È˜s:b+ãÄÅyW0jëB¹ñ·I™ý¦âÁ G¶¸U‘HR7·¾ýºí[׳˜×{Amo0I3ž$ KÊ‘©øD‘-’Åxe’§ÉqÂ<ìõmšÚÞ`’f;W‰ªŠßÙŽFp»lb07=œäjÈq3yøp›†µ¸Å‰È‹ƒ»ß­šíY¸àv0ãÉ~€lâ$#¤âÓ(²ÕQ"¢Ê:àêg”›î·.…S[ÌÓŒ'yÂÂÆ ù¬LŇ'ŠŒyÆu,ŠÈɳý6tÍj§´‡ýx”v ³DÔéÃÕ F¥ Œ§ÀL*Ä€©x€Á‘-0U<&ºÀüÒ¶÷œf!¶ªm¦jÆ“Tay™ó)LŇ*ŠlQ-#QdNªç•ÄÌdè}ÎWÕ£2ãIT°f*Š*ÙBUŒI™ Õ¾Û8¿–Yð RU`Îf<Éœ™ÑÀT|8£Èç¬EåäÜ·M·~fæ5ééÕäßãnInJ0$3ž„«ÅíŒ H(²)­EåNH¯ûýð¼kû~·jÔ–34ãI†°˜ÜŽRñaˆ"[ “J”‰“á–j«­ æfÆ“Ü`9n n(²Å-®D’Nn}»:’WWtûFmc0=3ž¤ËÈ]G€T|è¡È½¨eAÑs^F,ë;(U€`´f<‰Ö˜C RñA‹"c´u9K‚ìaùdåö‡‚5Ã)®°À V‡UC­FDüÊø×c³¶®'ÖŠD$Izs·\ylj¬_°âÄŒ' 'QE. ‰xt k9ë ‘&°+ºv»Û:žÊÓñôV[‚?ÓKz²”Á bÆ“ iU¤$âã¶›†µý7¢ÊêIƒœïávÝnן©ò„ûsÔpZŸcêŸ$mÏÑyxÉs&aí׋´˜0?îÎ÷ëûûÃ"Ö[ƒÏ¥ i°N¿3ذHÒ”~e°ÎÃëÁ“°þiT‰q¶ÍÆ}ózxiWëýn ÔgÅ ­1<½kòtÜ «ñ¬É!fZníe26rkÎd¬ÚÀ²Ë6ØlûµãVuå-œ4›@Ÿ±iFhŒƒÌ5€—ÐØ4'4V `Ie¼6Cw?Brcӌݙk/»±iÎn,ÛÀ6Ë68v®×ÆŸæÉmbпŸþy8ë?F!.3(¢àûù5|Ö¬à[d ÿ­];ا"*³Û›ª4Ôˆ¬œ™9ø)‘M3pJdÕ –ùt=¸i¿Ÿˆ«ƒò{á²Ïª‘õa1#£ò± ;ÁËŒl:3#«N°ìÈ—NxlŽ/dG\–ì•W¸dO<Ðu¬™2ªcb–©—êØ0åTÇŠ©¥;†LÝ'û«_¦Ê(CÖd2 !mŒôqÛK†lÈr2dEÖ"c²«æøíJ¿mUå k‚ŒÈ…k’ —ÈØäDÆŠ %3–wb÷Ýê¹Ùm^è·…^óñ6Pr¬™2’cBÞd£§Ö^’cÔ“+¦Xtl!]í©¥+é;]º¢êf#Öähñ4€ä“Ü|lÄc#VÔ°‘øòš×®m^ï_k8afcMŸ6OÈYRNÒ÷1úŒÙXÑ·ìÆç¥ιÑùé¥êÖŸ^RÀUǺ%Õ1 1{zöR›®àTDz-lݱj ÷ĪŠÅx¨YVk¸¹‡ÊwN†ŒBÌq÷“!kî¬ Yq·„Èjãf;žV‡nûÖ ízp­ô>Ùêô;ú5Õ¥P·±¾mÅÉqËm+š’—ÜØPâäÆŠ’%8îÕ»ïÖ›ÇfxÝoÚE¼ƒTíRc½Ï1RcB.c£izI MNj¬hZbcMó°HšrbM“‘£³4½äĆ&''V4-Aqïõ^ÊìꜪÚÊ5^FnŒBÌâõ’¼œÜXáµÇ=ÿnÊû|Y2 4%ë¶`LÉ(„l ò†¤Ÿ)Ù´gJVmaÙ’{ý~ÊEÃmÉš&cKF!fizÙ’ MΖ¬hZÆdMs™gä@K²¦ÉX’QˆYš^–dC“³$+š–)¹¿¿`Ôî@³²îƬŒBÌö€—YÙôgV–=`Û•uŒ·¯[êEt׺G‡ú“MΟŒBÌÑôó'kš¬?YÑ´Êfÿë±mÿÛ:WWñœ³ªq YcdôÈ(Ä,F/=²ÁÈé‘FK‘Ü{½ùs1—J¡Îd—q&£s—J~Îdƒ—s&+¼–7¹ï»Ù›T×þo¨OY3e|Ê(Ä…)ýU¡ŸOÙ0å|ÊŠ©åTVLKfèZÖL×2 1ËÔ˵l˜r®eÅÔò-+¦äQx‰ïðQ eÍš5#kF!fY{Éš kNÖ¬Xcaó µóæU^м(îÏMOz#LÛ¬[ƒÖ6OÈÆ ×îxi›M_0ÚfÕXÝ|j‹¹›WWTS7kš´ºy`v7÷Q7šŒºYÑ´ôÍ ç¢OÒšfÍ“Ñ4£³D½4Í)§iVL-U³bÊ_ñ^í Œ@³¦ÉȘQˆYš^2fC““1Kš¶YѼÅ)W¨ÀY±æÎ(Äk?³fÍ œkKâÜ]r^Nã|ƨ(oèm5ÄúP´^¿Ã™ qs©Ó’l /´i έZ²AŸZâ©Ý9§áUrë瑱º$P2mº„±Lã s]âe™6]ÂY¦U—X¦é¡ùúr¾0ºãnÝ ífI§üPÓ´> 0¦iBžÈeÖ~¦iC“3M+š–mZÓ¼›Ý¡Bj—R£/ù¬¡ŸÚàå„Ô ¯%¥>ã=é[ž›¡éÚf¹Ï†J¦5YF2BÌî¸^’iC–“L+²–hZ“½~1*o KZd\Ò(Ä,A/—´!ȹ¤AË'­ ö¿>wͰÝ/ð~H¨ Z3edÐ(„dš‘L½dІ)'ƒVL-!4`z¾Bs¯i¯ t>k‚Œó…˜Ý+½œÏ† ç|–mïó™à}%í\[„ª U[p*hB¶EJµ…Ÿ Z·«‚Vmaé Ïmqº7vÚ£»fͽÿ?EªqÖì3 1wPöÓ8vœÆY±³TΚݜ÷ìŠO´¡jfÍ”Q3£s‡i?5³aÊ©™SKϬ™®I©ÁB.lBÍÌš,cfF!f´^ffC–33+²–Y“÷Ôþq<Ð’væ«ZE*gÖ93 1{Ðõ’3ŒœœYa´ÍãÓq{z'Åñzf¡jfMQ3£³‡X/5³!È©™A¬gÖ¯Lw§J¦gÖ°h=ó4À,*=³!Åè™(¬hž€bî%\ÅÔ4Lά©Ñræi€ÙC¤œÙPcäÌŠš%hÖØvýpp¼Ì¢Ñb”!ì@÷²¦Í¸—QˆÙ™—{ÙçÜËŠ¸å_ÖÄíædŠY/ñ:$﬙2þebî ?ÿ²aÊù—%SÛÁ¬™ö/ûCÛ/ýû³P‹³ÂËYœQˆ¹«ŸÅYãe-Î ¯erÖx}{ºYîef¨ÉY“eLÎ(ÄÜÉ×ÏälÈr&gEÖ²9C²mÓ-~Ç ´?k¼Œý…˜;×úÙŸ ^Îþ¬ðZh÷­é¶ãÉvµm–p!Tî¬12rgb£—ÜÙ`ääÎ £%x¶0ö‡—-µx<+EšþŸqXuÎ £sF!fž^:gƒ…Ó9+,–ÒÙ`¹‰UC¡¦g—1=£s“Z?Ó³ÁË™ž^Ëö> stream xÚµš]‹¹†ïçWè2¹ÑQ}éÌÂnŒs“€Yû"‰ñ…ãÂ’e&ŒÇ°ù÷y«çTw/ø4!Qƒ9GÓ–ÞG¥VI%á’JaJDÕ œXØ ’D»4iU/X²¾T®©Ž¥rK–Ê= ^*DEõNDŠ+zu67¯a’á DYñ¢‰ªÃD,Q“åYMÔ͙Һ<ë‰K_žÄ\ ZÐÙ¥ÛJ‰ué·Â[:®’¸.=WMÜ–®«%îKßeé¼¶$´ôÞ›±.->ª3 Íté½Q[zoøh¥y ï<”ÐlÈRÏ’[êÕ¤´ôÞZR^zo=©FõÎAâ¥÷•’¶¥÷•“öêã‚Íi0ÆÊpZÅ»àb(5I&äÝm%ˆ¢Ë5™.=¨xUM†3Zª/cŠÕѼu¤Vº÷¹Yj\¼LmBÞ ›Š·h=5ó†µz gkÝ[tJ­þì…¼EÌ ñ0º³.-,uYf]›÷¾cÙXžõÔ[YêÔ;»2þ£qËaô(&`à ªnïŸt®24 ->.ÃÒ0ZZÔ4ªøø–F[^èÀ4íui1Òè¸ø« RPG\ (Š¡ â³EY¦´ysµ˜›€Œbõy¡è4•æC1'¨ Ÿ×Š‚š{QS&>Šä^Áæbä.'@Ã4$Òî} YÜÆ›a ‰-Í@£.K3Ðhø\TØIŒNx4F /‚Æ<¼œ›Ø£èNˆ‰r÷êÕÝåý¿ÿuŸ.ß?<<>ß]Þ}ýûóò÷Ÿ~~øçÝå‡Ç§ŸîŸÒ_ÊÇ»Ë÷ŸŸÓ#Ê1ç4óo˦>óÕ¾O¯^¥Ë»tùããûÇty~¯þ}úî»;üûÿ˜¤Y}–“9Ã׿Í,c³XÆ{Ú˜þ¸ê·™T¦0uH†­³PÆô>ÕNí’‹lL%÷r2³I®mÇì%cK¹Áìs˜•si¶1ëÈ]ë¹veÃ*´2md¬ÂçÚ©”}_™Úsïí\;_¶cJÏXýÎe2|£í˜Ü2ö‚sÇ–JnØ'V&µ¬:Îeø혥æQo0¦0±gßu‚‰4ß2³Î1–ôØk.Dç"+<£í¬lø–[Ì:‡iðŒX-#L<×J­XÏicšfk'3ÅýbÇTÍeȹLv¿Ø1{ Ýb¶9L²ì±ùÊdÉ$z®E±žïæq®v.“X¼³³p¦f§Ž-#.¼í×<(×a§z'#.ñ0evì1TϵqɨÛ>Æ {Œ´sí4øFÙÙYKfkçÚ©ð ÞÙ©#ãôx®8›TÝ1ed'3—ßW&c—¡›'ÍÙ¯_µo1ŽÜs™ˆKJßvO.-÷z*’úÈ»žFËÒÏ%¶}#"*åF„@sκ„sI«Û¸RCìÅ|.Q µÝÈ".z2SÖóí|MfYëýštSÜ/vv".ýSæ0—4ÙÍ!AüUô\&U¬ç;&#þb=klköÛ_ÂÁ¤”ßßÞ°ûœ=a B“X$—z#D 9Ë{GôErp¶›«ÞbÓì·áAì½Ê¹Ä*¹ïNó › ·S‰ˆGü®9ˆ•2iÿoˆ¯Ó6š?¦Ë_þú·äæ7;#=|ýå—QïÍãÃó¢õÆ,õ—êoüW ¿ÿù«#”.ñ_Û—±ü…ËÛ§ÇÏïîÑßtyûúMº¼¿ÿõ9}ü­Ùo?ýãþîò€îž¿ø|óöné—ǯOŸï—göòìÏ÷?ýüé‡Ç__ÆÃ|"7¿'ôv¿ýôôÊKýeL¿€¿Üç{·–ëük¡Ga\ Í¢•[TnQ¹Eå^¢@Qà(H4 ¡ÜC¹‡råÊ#”G(P¡> stream xÚíÛr9’†ïû)té¾0¦Ôqï8–ÜÛÒèÐ;³ ®T¶+QjŠô¸ß~ª(€ÈJdÂll¬Ydt„e»™Îÿ—Uª@@ždÝò¤R'U­E­«“ÛÇŸ²íß®>Ÿ¼þæò—Ÿ¤ùÜÛîƒoÁ'ÿxýÓÞʼnÌD“5òäúü§®ïNþþfòüüó[U¿i—w÷ß~~«µ~súo¯?ßÿ\ë7›åíúþiùú7Óå]Û}HUy£Þ¨¢úù¿®ÿý§³ë]þB¢Èu¤XûiO±–'µhÊ2·‚U)²"¼YnVóõÝj¾lÿÑçÿÃû|º¨DQ–Ý¿¿ýl×YÉ×jð'ùýÿ·‡‡ª:ƒõξž†(ºÿ%²¦ûEª-–áß@>&ü-ˆßâQÀo”bëºÔµ§¤n„FRøÂ°Ÿö2{…!»ìµB…ñÒ®ç·~i”µÈå!”SÆ«ä*pñl@¡*Rbªeöª +„ì¤Uðüt¿\¿øµÐ”¢®ôþÕƒÖŒÖųh¡ÇR7,Z %-ʌіM.JÛU ÐÞ-V/Ÿ·ë§•OWvý]VÕ?4^š¤mo*IÏ‘X ¥DÄ™=’u.d™$?oîïZe.òªù1Q2 MK“ºx–!4SæËH‰aˆ2{ +-ʆênßæÝ¶]}]<·[©´PÝü¡Èp3­KææâYnÐÀ7 %†Êìq+;ûeÃp{ùíËjÑñ©‹¯u-°‹¡gÚ˜LÏųô !z@J =”Ù£W(QåTøÜÞ-–ë{b¬+3):Õ{4Àa¨š¶'Suñ,Uh¯Ì%KH‰¡Š2{Tsµ%äS]µ÷Ëûõ|É^¥înÓúÿcôÊ@2MI†äâYHЭРH‰„2{´u¦xHÏíê¶í.Á‡–â”WBëÿãa(ƒÄOFââY$Л % Êì!Q²3• ²yi{-5ˆìfeµSçk£“iîÂY˜ÀÕPÏætÄ ¦õHv³´º¨h”ýônìÓvk@2VÏr…žÈ@)1dQfm– ]4Úǧ»vôhÉh]<‹zºf”´(3F[tl$Õ%~]¬î»áèüó?ÆôDƶ7•$ˆçH, \¤PJIœÙ#Y5"Ï ï£ùÚÜdŽ»p#ð3DÑéˆ8Lë1,û?VˆÏ/£‚hÚ›LÑų¡¥!Ž@J H”Ù#YÔ"o¨.ók»ºÿô;Ñcf"Wù¾¿Ïb87’9»x–34<ÐB)1œQfs^‹L &0íËz~ûå^_Yâ*0^%W‹g«âPº`«H‰©”Ù«]‰¢ðŠàiµjÛõ£}¤gšžÌtÎ"Þ*]²DŽ Ã´OUm{Tè¦ï‚ï>ØÝÛ¸‘ÌØÅ³¡áJç,e %3Êìq–¥(³‚æ¼Y-Œ³q#™³‹g9CÃCœ”Î(³Ç9+·Øçǧǖ|$_KQ*9®ŽšanœIfîâYæÐüPŸ ¤Ä0G™1ónÔ&Ê#^¬B·ñýJ™æ¦rtáFèg€"Ð¥õÖ…µ×?¯ú7i‹Çç‡v¼+Ûöd¢.žE íUZ³L”¨(³GµÊE%½^÷·Íbżzs¯kÝHæìâYÎÐðÀJ‰áŒ2{œË\¨Üëu×÷÷ËÏ>äªÚ®›ãì˜!oüI&ïâYòAè RbÈ£ÌùB‹ª’4ùyûíùiÙ¿f_<üø«!lS’!¹xt+0(†Rb ¡Ì¤\ ÕÔ ¤KbT\ŠL©‘\  mãI2mÏÒ†¶‡h)1´Qf¶V¢V%C{ý´&/Æ}_ia[ÌÓų<¡±!ž@J O”Ùã©Ôöƒ4ÏÍòþÓÓêq °mK“ºx–!43ÄH‰aˆ2{ ¥Ü.ÈE 7óvµ¢VÏÎc ëL2sÏ2‡æ‡Å@J s”ÙcÞMOó öºýµJû±”ÛwŒ‡öíG¦$ŒqÉ%áâÙ’€ld£Ø’RbJeÆ%¡»ém£a×¼Yu÷ð~-øñ"ªëUj€x® 8TƾI†R"ªgöª ÎD^j\ŸVm{¬\Æ«ä*pñl@*c¿G¥ÄTÊìUAÙˆ¦‘^|}º¿£;‰1?³n$svñ,gh¸ÊØ'$PJ g”Ùã\4¢|‡kËùóËMùp†~Ö™dæ.žeÍW;܇Rb˜£Ìó¼Y^ÌŸ×ÌþãZFm HFëâY´ÐãZ %-Êì¡Õµ(ªœ@û[ÿ“d;–U¶íÉT]ÓÜT†.œcý”9û #‚!Jë£WŠªTCvÚq¢÷ÚþäCôváìzÀàT #æ½aZÿè'1\|Ìžœz\>8MJ¨ÿÍYRB}ç$©™+þ)¡þ…S¤D`ErQl—S¡:x="“=zoߟZ˜F§ï!mÃù-¤«Ž@GÔÒƒ´’º=5ÄyÈ;œwíÃzÁ¦¸äBJÎ|þWé™ðà¡Å(wCÞfuh±;Í:th±%(‹nòRPÇ5`²V›ö&Ótñ,Mh)q5îh)14Qf’f–‹j¸Ôæ»›÷÷C§|ï‡NÖ{c@2^Ïâ…‡.V %/ÊLáí¶•öž_ÛÇçÿÙ_ŸžÖ_Èí ·;'Õ{±q’ñØ64#ˆç0¼ì$q¡”Œ83‰±Ö"oã×Åê–íù{Wk»i{2YÏ’…ö†È)1dQf’lÿmRzdéyNÿذ:¼Ç†“ñ*¹\<[ G¨€”˜J@™ÉJ(•Pƒe篕°}]0ª[µih2FÏb„^†0)1Qfc!EQkãèoÕ¦íÉd]$ ‹š…¤ÄÀG™Iø::+Iø_ð­=Éð]< ÁRbà£Ì$|ÙˆrpT!€ÏÌ’GsO7mO&ëâY²Ð^Y4,Y %†,ÊL’Í‘ Þ2¼’ýÜ÷ÖO›ÇöËb=ŠA—ih2FÏb„^†0)1Qf cÑÔBû“(¿ŒU©uà¹2€,·i #¢PZ²êJT…ôŠ`»¾õØC[{’Á»x–<$B¤Ä°G™IøN)5 ÿ86ßÙ“ ßųð!| %>ÊLÂ/K‘6$tðcó=Éð]< ÁRbà£Ì$üþ¥³.hø#›Û¶'“uñ,Yhoˆ,Ce&ÉæE÷ÃL nf7—óÓ³?Þü2ŸœN.®—µµ'¾‹gáCJ•,| %>ÊLÂ×¹(ŠÚ‡ÿáÃqH+Áx•\ .ž­ˆ#T @JL% Ìd%(-»5¨„élz}Ü|kȸ”\.ž­"T@JL  Ìd ÈþkkÒ«ó÷ïw\ Æ«äJpñl%@¡JRb*e&+!S¢´_•p5ùxñáì ÷$¶PŒ3ÉÜ]<Ëšâ¤ÄpG™)îy£D–iŸûÙõÍÅq0híI…â9øøPJ|œ™„ß]ź,ü³ËËù»óSêš?8øÆždø.ž… (±ð”ø(3 ¿Ê:¥ÿüÏÓ³ãøoȸ”\.ž­B)öý”S(3Ye§¾®P œN¯®»_'דÙ¡Ä‚0n$³vñ,kh¸Rìc(%†5ÊL²Î‘ç Íúüãd:ï=Ûöd².ž% í ‘RbÈ¢Ì$Y]‹Á$ÎýålÆl‡ Ç¹‚¥ñjI2ï]8‹x¢ítÄÀ¦%Y÷gËTìëÄmLO¹/jV{øEMk¸iu2SÏ2…Ɔ˜)1LQf’iVŠÚîÀŽ˜Î.&—“WcdjZÌÔųL¡±!¦@J S”™bª›R¨¢ ™^\ž_ÖXÚº‘ÊÄs¬†XC)¬qf’uÝ]Š’ž7]žýåfzyv:¦ïêÚö&Ótñ,Mhiˆ&Ce&iV¹hªš¤yu c*ëI2qχ¶‡ˆ)1ÄQf’x™ ­é¹ðÍìϳóÿ˜°ÿµ­NfêâY¦ÐØS %†)ÊL2-´ðîÈÌsC}šùêQ2ÍÒwÏ1ˆòƒœ$÷\‹¬Tˆüûíc­³Ëé¯6î2n$3vñ,ehxˆ3Ce&YkÕ¡Óë«¿Í®'û®Ö€d¼.žÅ =áRbð¢Ì$^Õ)¨ñ´˜|†Yt“ì²<¸­ÉÂwwc_rq¸x¶8 ¡Pq)1Å2“ÅÑ)yéÇüÝùìtz==å˜Í´:™©‹g™BcCL”¦(3É4ë›PLé·‡³êÈ:“ÌÝųܡù!î@J w”™âÞïlW—5Á}¢=®~ÜŠÄsxðB)xqfoÕo”ÖÓÝ®&œÎ~ï›fÓôd®»p+ð6DÕéˆ:LK2-kQ4Ò‡ÚͱÞ׊Y{’Á»x–<$X+¥Ä°G™IøÝp»)ð{:{˜GÝŒ}ÉÅáâÙ BŤÄÊLG^ -ñ¬íãäÇówÇGo;@Æ¥äpñl @¡¾H‰©”™¬]vó,üòs69ÎÜãŠÃØ—\.ž-H(tƒRbŠe&‹£ßýXã™ûì|þ—›Éìš\j>²Ñ¾1 ¯‹gñBC×>ƒe&ñÊBè¦öñ^žÑß%<€×§Ö“dâ.ž%mRbˆ£Ì$ñ~‡ä¿>Ýß!îϨý ËÌ—\.ž- È&T@JLY ÌTYÈ~Çe=rÎ <°:bŽŽ¦¥#y§ÝÓÙûþ5Ùߎø$œWßÒ7³áüÙfŒÒ´ÙNGÔÉfƒ´ôFÛîÄèmA\ݼ{wÖ]öý7bÞügVdÙ·lÓý”Ä 0fÕ8w‰Gu»=¸Ù£º‡ ¾÷Ì5tT÷?Õ9­ endstream endobj 3509 0 obj << /Type /ObjStm /N 100 /First 1007 /Length 2310 /Filter /FlateDecode >> stream xÚµšÍŽ·…÷ó\&^²X?$ °#(›l/’Z8ö 0bhIœ·Ï)έîv0÷nÔ¤§Õ<«È"‹M6&J%5¦–je/p"^ü𿤉µzÁ’˜y¡'Í #õâ/·’ƬÐjª…ëJEQm2§4NµuÇ4I•G÷’¦ª•¼d©Íg=ÕÎó½‘êP¯Ë%Q1×㚨ƒ)Q+^ƒ["o;J0@xÖD:[ÀšÈÌl‰zŸ5ð£”YTò‚Ôü™ÀàÆ ñj:ŸÁd17Wð«Žé üèuÖhÓÄöjÒWqšŒÿ¹ ŒU^NQÁP‚‹i‚ZbkýÉ]f I<¦ÿT“”î E_P™5z’Vg‘ÄÝ/‹¸Yl5‰*ƒóź«XKÒ‡« AZ¦ïM:ÁUàb¥é{ôµ¶é{C‡óô=ÌW^RjÓ÷½&íäŒNÓ÷½%+Ó÷èn«Ó÷]ºwÖÐd<}ß-™To)þÃt¶¾d6[7YW÷ó¨ÉF/`Ž1çÊ‚fë§ÞfëÑ)gëñJ—Ùúa©«M•žºõ©Œ‘;ŠwhÁÐ-Õ¼ÔÓ¨ cWŠ ×5Øí½/ÅG¶x· ü^‹Ê¬ƒ±]æÐØSË[‚Që\RQ­ÎÑ%Õ#‚0òQôpÃ?`!êyêbUt¤Ö\ùå™Zû2"¶ì+µyL íB ¼Y«Kø’žÜ˜ýÀ¤êö®e"(;³–Ü1k6ÏÀ#æ€,%·ñ2’J9ÇNõ¸@ÞPÅXU–Úé‘¡$²ì+nDŠžÃôØ@»1‘. ѵL)¹ôÎDº€düåyvœä[.íß™HưÌq³!4ô`'Ò$¿7æ¡r“ý`'Y.íÖÜWÏa„F90B"7˜_ºn^™2zöòÆ,š‹¥ý)ÝrÇ^%˜‚|AWŸg!1ìIø€ì’ëEå$#U1Ÿï@ã¬|k‹rR`ìÁFä U#;ìd7¦´Œ-³yXìHn™Ê-ä9³žGÅÁÌFxÜÖ2+’/ÛWkìÛ3ñb&6 µî‰Ð|¬¼”É‘ÑÌR3uYËìØ‘´=Cà¦,f¶$‡qËØF4Ò¥¡ÂJ·¦ŽÜùó¤UŒ¥fû*Ƃ̓ÚZ&#ûª&÷Üûb&6&&fCöUn|÷:)+alLü#ÞÆDV2¨¯µY‰Úž!pµÌ<–2ÛkÿÎDV2t1³÷lug¶¡y™ÏiI3ßXï¾EÆ™K}yÉnvS-†P›;ýUÈgÏŠaFßWϦ’‹ÜX±Û9ymc¤_åÀÎb·˜çìÇZsï+YcÎe´µv‚ÕùÀlHÀêbfÌè{fÒ¨åÚnd ÏaÆŒ¾¯Ø­RVá¥vö%rø^Ò åj7²„/ÿþõÌÄÆ¤ðΤQ³Yê[²–ýLtcv¬2U×ú™ÉÐ}"+Ùš­õ­oNßKHK&±µ¾ed`eßlÖ×ú»åƒoÛÈ43‘™ÞW2"d`u¬õm-YôÀ¬=·6ÖŽ¡Rré{–@År×¥ËÊõx5ˆ÷ŽWOêÌŠ­ ¾–Ü=_=©3+¶&¦æ½óÕ“:³ŠÆŽ¼w¼zòz¼º1ﯞåÚëñêÆ¼w¼zÖ ½¯nÌ{Ç«íœÝn¯nÌ{Ç«g1¯Ç«óÞñêIÌëñꆼw¼Êçl<‘•ŒÃ÷’;§«•ÏÙŽc.ß×°;§«gÙ¨-÷Ã~þÎñêYDä#Íìð½ÿæñêÿ_§wMŠBóÛtùÛßÿ‘Üaþmg¤¿þòËûxïÍÓ‡ÏSëHêϯ¿™7ñ*]ư–ø/Ïí˘¿@áòöãÓß=¢½éòöõ›tùþñ·ÏéýïÍ~ûÿ.èñÃçO~1ʼ¾[úéé×?>Îgòüì¯?ýüÃ7O¿=ûÿûû׌Î-‡Ýoø´¡–ç÷§O??oYy³æ«k¡E¯…çjÏw«®…x¹ÆËu{Y¢ Q°(ô(ŒkB™B™B™B™B™B™B™B™B™B¹…r åÊ-”[(·Pn¡ÜB¹…r eeeeeeeeeee e e e e e e e e e e e e e e e e e e e e e e e e e e e e e åÊ=”{(÷Pî¡ÜC¹‡råÊ=”G(P¡> stream xÚµš=«%¹†óû+Ú‰n}©ªÃƒGÞÍ'¶'X 3fYþ÷~«ÇsÔÁ4V‚ÛçLK¤úÐ[ÒÑ!Ö¨éј½¼‰J=DSËzÈfnõ0ÛÈzY©ù¬—•[r½Œ³ ÕÆdú†'CcÖwè[bÔ“7ÖÉõ]-²±‹ÖÓlZ-Œç¨ÆgT “&”Õ´‰P1Ì0X¾ZŒ&¦W L`Œ«E4q¿Zd“ÈbØl’³¦50âšW½ÌZ˜‹XÍlàeucà‹ë»ê~Öt>]½ û¼F?ðq^£Ç¤®—šñ5zçf’Õ‹K3£êŵÙàËk®5ͪ÷féW/Ñl^ ïÙÍë=ØB®õ jXþb4¾¬AH×GhCOFX‘Å…)Æ—5À´üËD4ÿ²‘ÍÅ®þfs­ –ÕÝ¢f™ÜëIš ë) FC¯£á?‹†I{Ñ`¼k™ †¾¾›-Æ5‚I-ü$â²;Ò«ÅÔ3 L?iÖXæh)Tc3¦Êežhi×èÑ}^æs¶ô½µ ÀñÏdõ×¥ò!'m“u¼áÉàÎåŽ N-rò6-¯^¢ÍêOÙàœW/³Í¬Ñ;S›³Fï ß%ªá;‚„‰£È\"Ó€AK _­#TÁ‡G ¹]Í%5 g„ Ü¿ø,Ó,#¸ P˜Ë `–rÐXËXÌ6äíÇ·÷ÿó¯íýûOŸ>ÿúöþÿÿöëõùÏ?úçÛû>ÿò¿´Ÿé€þúöþ—ÿµý„°ínw8 B§k}6í*‰×¾o>´÷ÚûŸ>ÿø¹½ÿ±ýNÔß¾ûî ÿ~SF'¸Ñ‹©ÒsøÓö0yô@R{1Eº¦eÒè2æb2÷ÉüÀ[˜6µ;bòÅ$î¦ó,3µó\ö´I}ú“=u3¤BàÅLê6í¨ßš ì¹A„ÏNspXæ´1;vº£n‹$Û•VJ0›âlxšRO½™S³#WŸe u¤ÜÅ”ì¬r–‰@Øe^LŽîcžu[¢^šíŤèœñM&OÙÂÔÌ>mÙS§wl§ßž'Ñfd·XöÔô.ö`Oâ=L>çŠOÅ×áö¤=9­_bþ+Ó±ÍÌx`îñ[èäNcùävO±³LH“R¥/¦þ>ÙsÏV¦â l1U{Æ<ëC&®7{ŠvÄèÙX4a¿Ù“¥OÌ=yʸû¼Ù“¤cK=ËLëÂËž2!ÁžÌ™{¡½jœ2¹޳L×.±Ì)mÆÆQ’ÕŽëÅtl3q6Ý"£:¹™sP`{ˆÊ¨MÖ†-:»Kœe Wm²˜2;ÃÖdhv¾Y“!ÀRÏ2!LP›,&eÒÓ› ÔôeNž²ð¡Ü¥=ZˆcVi²˜]|œe:4»,sr@M=ËÙÿw ÷…éÞŸäô.¤%J“›9Çèi‡Í©ì´Ê@¶Ñ!ûŽæ=–¨Òd1Õú¤Ãædï¾¶1C°òY$yU&‹ÉÚçÈ£aB°óÍšñ•þPÍ-ÈU—¼S;ñ·mɶ§dë·(IAœòQ Jãå¥34ôW¦OlÛü`Îà=ÌÒé‹ O’ȳ̠ž¾|Ȫëá´v:ýæBh³×½Ï‹7¢ëCÕ·©‰}CÓ¼‹¿Í¹‡)Ù•W˜ ¢ïôpÁ°Y§‡uç÷•‰¿fa2æ&E'½…&ÊÀ8ÊPéƒoL²ÎO~»imGzÏX¡9°M³.4 ÒQ_.$6êœ|–‰z-,ê÷.GlÛˆµSÛJ@[µóÙ@utxKzc Ú}Òìâ{˜ª¨ WBF]ÕÏ2Zò¶o™Ýgže²Ôqåb2Jϧ+]LŸ۾9(ûÓIÿ&¤MH-YÁiur‡™×¥æÚ;-QÚCÙ§´‡é³çmï4$¥ñt'{ò{Ýj ¯ð4$¥|º@–=)Á,û¸í6P•=ìíbjôyÛ; iidžeJÔíÐbjÕÔg‘ur0n¡‚¬¤O¿{ØÅ$È­›×")ùÓaô&¤ÎÑ5oщB‰TÏ2Y,¦"+éasj@mÑÚÈY)ÆÙèTG¡ë+:…óÙèÔºÐ)ЬdOw›2Ÿ Ý\™"+åÙd«Ê×1í ‰bIˆÏ2¥nnn‹¤4\Ï2un¬” ÈJSή­Lè-]™"+I޳Ìú©Å\¡"HKnq–(vÇÚÈ0ÇN”g™ÁÅ+<iIŸ~j±I É@±+Vêž5žÁw1ÍQÄ/$Ê%šrviz‹VxÖ5«³:SÄzÜ´íuÑʇC…¡·ä¶¶u|úô˶]LB¹›·ð¬ãS=ž<µ‹­Pa¤¥|úÙæݓŠ‹ÖNV7­rV$ppŸ¾¢“ëôTþ¯Îü/sß endstream endobj 3643 0 obj << /Length 53 /Filter /FlateDecode >> stream xÚ3T0BCs#s c= cs…ä\.°hQº„äÎeUgbj¬gjb dcUWN" endstream endobj 3670 0 obj << /Length1 2087 /Length2 14733 /Length3 0 /Length 15980 /Filter /FlateDecode >> stream xÚöPœ[³Ç ãîœ0¸»»»»;ƒ»»kpw÷àÜÝ݃»Ãeïýž7ûœï«º·¦Šy~½º{õ­îg #RT¡2µ7ŠÛÛ¹Ð1Ñ3rDä„™ŒŒ,ôŒŒÌpddª–.6Àÿ˜áÈÔNΖövÜÿrq¹|ØD\>üäìíÒ®6&;77##€™‘‘ëí¸¢Fn–¦9z€´½ÐŽLÄÞÁÓÉÒÜÂåc›ÿyPšP˜¸¸8hÿÙ,MŒìrF.@ÛMŒl*ö&–@Ïÿ•‚’×ÂÅÅ›ÁÝÝÞÈÖ™ÞÞÉœŸŠànébP:Ü€¦€¿älÿ(£‡#¨ZX:ÿcW±7sq7r> 6–&@;çW;S àcs€Š”,@Áh÷³ì?´€ÿœ €‰žé¿éþýW"K»¿ƒLLìmŒì<-íÌf–6@€‚¸,½‹‡ -ÀÈÎô/G#gûx#7#K#ㇿ+7ˆ )Œ>þGž³‰“¥ƒ‹3½³¥Í_þJóqÊbv¦"ö¶¶@;g¸¿êµtš|»'Ã?7kmgïnçý0³´35ûK„©«ƒš¥£+PJô?.&¸?6s  €‘‘‘ƒ t=L,þJ¯êéü{ñoó‡_o{€Ù‡ ¯¥ðã ÎÛÙÈ pqrúzÿ{áÀÔÒÄ` 4·´ƒû“ýà 4û‡?.ßÉÒ ÃøÑ{LÆ¿>ÿ}Òûh/S{;Ï?îß/ƒš¶¦¼°0Í?Šÿ»&,lïð¦cgÐ1³1˜?¶çøxðýßi,ÿSÆ¿b¥ìÌì\ÿTûqLÿS±Û€ò?ÃAøß¹äí?º üÓ二lŒ&˜þ?·úß!ÿÿ:ü¯,ÿoMþ wµ±ù{™òïõÿŸe#[KÏÿ8|4­«ËÇÈÙŒÝÿuÕþ3´Âö6¦ÿwMÊÅèc „ìÌmþ{ˆ–Îâ–@SEK‹zå»Ú_3fciT´w¶ü률cbdü?kƒebýñâpþhÈ¿—€só¿·³3±7ýkÀ˜ÙØFNNFžpWüAlo¦I4züÝÂz;{—À‡8_€™½Ü_÷ÉÎ`úËô±„ÿ€AäqDÿ€Aì¿ÄÁ`ÿCL‰?Ä `üC,©?ô±ƒÜúØAþ¿Äù‘Sñ}dQþCYTþ+€Aõ}(RûCŠÔÿÐÇ~ÿ%®2úC»ÿ¡}&ÿ%¶5{›KúË_wÅ`ú/üÐ ü/²|Ô÷qè6F¶ÿòøP`ö?üÍþ…ŒæÿÂIÿEÖIžÀïÿa³ü~è´ú~H³þ~Ôoó/ü÷¯Ê>Þ ÿÊüWiöÿºþ”òáëðñ{ag4sùceúõŸYÿû¡Êñ_ø¡Êé_ø!Áù_ø!áß±\ÿ…Üþ…Üÿ óGYÿÂz<ÿÆÿ5,&®N5ºüý2û˜¤ÿῚ€@  ÜÒ¼½ OˆU]HûCž;ÝÞ8ß ÙžF:÷’S‡ët UuvІÓPÊPÊêŽå­à2á«÷qKtxk’R۳ϋA‚òÔ^Üâ$fÿDñ±P},>ªà¾Ï«£z 5x h§4Y¾£+'’b!úƒû/ ú¾¯+£aó{JûÕì2ð/_§ébÔ¢uËfÉ Œsæ°‰¡\è`¨Ñ.ÙäxÁ¢Å[ÐâëH‰‚ò)Ǻ,Q?6y}!Òz‰­cé@žðh#çŽmš.¾kúoõ¬W:~B¦˜FTp‚å»zöÿX°« I„ã^>K‹•ïiÓVk*jÏ×'²K¢¸1V(\¤!’©ËŽ('Ö–ñ.6«IÑv2“+4ˆÄ^6vX*]ÇXíx/Îj¬œ”cÔ÷—“5ì ì àGڱögr1Ó€ò&-÷¡Œ¦]íg;EНÌî/0P¸Áeņí¤üÈ ë÷Švt „9Në»4Ä'‹bK—ø?\ј—[hÕìkÌÖHI†ä 1ûE‘+ÍìqBÚ 0–·—Ãÿ„ fF>7V!«™f½T,xlÈD²Yƒ±SR'û58¡Ggs.ºÔÍžó;ÉÿÒ‚ýØ]€D.Yv­ ×ÏáOãzÆ1)dËŠ1‘챇X!]±ìZùkpÅ×ÊVÅ@”?pìId†ô{¼Ø C1Yžëäüë´ðΙçòkiÝ:¨Ü^긌¼hØ`&=— 2p†´âùQüA’ègŪ…BÖ·–Œ_Ù®œ(ÈÎiûþG¨Œ`^ÙÍÇ ­m¬gôÈ㈈€Vë3±Žâ§"CÝûEù)7gÂC‰ã9~̘tªèR3±‚½+ºûŸ1ÕáÖO_º“˜~³ƒ&NØápËÂØ“<<ÍO»‘@DÌ|¾S$ˆa ƒütI˜ˆTú;“;}rìÔ¢ ¾E›};Ä–v}Ê Ëçîš+Œé5 ÷K·Å†Y½ÆjÕô'p×ȸ„q_ûšî#äDîÊ€)m|ž«…ã3’rÍ(»žtıMGS¥XŽ™É)þ®“aFú –y)Ó L·µ’hoú¡M–à½]Ž-$|ˆ'Ö¨=Ë0z@„À÷»t[òäš&r¬ÎsŸïH®ë€Óy앸`zô†Æ— k×mo ®*ˆ¦ÄIªÄHáµtþq&Ÿ:Ä&Oœ®_‘Š¢Ðç Î5ˆ:˜…AÒ(öÆ]¿7¾Ê–¿7RSyŸÛ}»Ørä½±@7BÍAÑ—à >€õ¨ªÒ@UÇ}\VXO2^f”>“EPÊL¾Daõ.ƒß=¬©Ú"{t\6¹43~ÕÀª£zip,]IDÇ)‰lTãgï"ýÑçÃm4ui•lÒŒóùT˜ßêyú’#²ÇÌ›É(ìr_w~eÓGM¥ýí2’ƒý4&ú+v²Å^;kÎ5’dÚl¸!©òA‰'c¨¾mù‘rUù8ïžwÎH6õ¹YÝ·{µ£Ö×X¦ÂÙ]¼9m Š ’na¥©Øö>•ò[C!ƒ üý­à‹ñê»óbxª…íëïæVÃX6Ƚ!⧆¨ ^F@Y"o=#[fR!~ô½Í{3K¶rÛÞcÞ$]7€ÝjÚj]­l T{lþ`6ZXä&‘”zay{”„WEP[ƒÎ×ÕQÝff’Vk´6¸sûbŒhqF¿p±JyS¤‘Ÿöf ‰Úɇíˆã©Ìæž|š:¯\R0¡!ŘôÝ¯Î»Ü àve–Í̓™ýæÀœÂxÙ¿',ýW¼êјÔjJ ¼—°¬4êx2XÄ$€Ú<ÊÆ(dà¬ê|*¶i¹M@]ri|WÀuÍDð{ÜûiúmFÔÌ ƒ dpkBدt­ðy…®DÎÑsL{cyLgfá^á&Ûtn;íŒàÕçxL“KÆÝ¯Õîd¶‡'w…¬~î8ÝiRxGwv$¶ü= Š©†ÉЯ¸Ê˜aRf²š1w:­]?ä6 ÒRÚè¢ÆÚ/ËJE!môÕéØý{Ú›QpaBZftÜ1öSK³»4¡¯á<Ø@ÃÁõ‰„[n¹k2·Þwdo 7°ûæC˜áŽ:¬©ciÙêí5ŠÑ5Öcc `‚’ ®’Ìõ9÷8¶äC åúš±‰ãoòLïA—È\`85ð#í-¾ýÚ“° ÓËs˜"„0øª/áä·[ î·ƒô£&Ñ"á^›­¸D&'‡\k½¥DÈÚw˜ùm–½Ç†q¢Úã%(C š§ ?Q|UµöW½È[õ‚ûÔµWsKQþM(’ytìõoιé™t¯¾Káç?•Ò¡,u·{lò!5cYÏpª¤B[WòËœ]PJ< f}æ'7Þßߊ40š}.µa‘Ø(–÷…—Šf ö¡³ùòëIÌàùQCP Î )n…ÖßÙv('{=¹|ouë?µ¬_0„‘_5T”dBÓ©ä†è+8žyH¦l?š¯ÄBœc ft.+„0rª-rkxuÍ/)k¤KzÑeOCŽ}Áæšü6]lò}˜îçÀýàø0n±r¤1³G¯EdÌ"˜ê‰”ˆ+p2Ñójœg¢c„‚Ø¿.*e^¤Ñ<ÿúœÌ¨ã.q ½•]ùŽÄ¤/ŽÛEDxà>É‚™Lœo «]Ãh/ë¼uðCrê{x¢}îRüB‹Tg‚DîÊc ‰Ei±šbï§âûý{& ;z’{v5w‡ãßb†bøž?5MQ&÷VUýe¿¤J†<ùø–y  .¬úIË«ñqÑ\ª&4ɼ|œW©¨¯+CÖ.×TAVžàA“p'Æ‹Mˆ¶ D•˜ÇkRzüîiAY¸Ë‰ÓEr % Ø«ìc¢ù–äLvç­»¼íE`?úï·))I2Xb~¾sWH:Ií íÂá“z§Å~Æý®N4y%ÁCý9ЭÍZ/‚±ê°v’_Ós µŒ«€ Dæ„E$oóFs!ÂžÒ c"}o†GT¹Qtì‹ø*¦|”Rê ³S~±„‡á'êNq,á"°›ýÍ^F÷$öL›%‘¬Ž;—>“ Õ¦Lù«)Aÿ 씋¶ß›¢æQ¦ÏfJÙ ‹é[q'¡'r8Âwë»v<²žÈÀ˜½õûßKµOí'0Åù –X‘4kJ×¥2°ðLÁ´èŸ¤6û*YèÊõ®6¤3˜Úómæ‚ y Ír%Jff¨Š!ËA, Òɱ°¸Ú,Ç‘3µïUyqËÊü3QÀÌ"ÚÝ`eŒŠû’Ϋãvûú9<»ØP£¥xf‚â)%Qñ› TzÀŸpöTÙ¹†¹Ê­ÀQ2a](#@žÐ¯²˜ãå?Ÿ°ùÄò›/¹'ÊÞ§¨:¨!oi_/›ÚPüfÕåVŽªœmq½99Û9Ç„:áO2@wºfßpN -á,NdóqVµ_¶]©mÈ5q-$ìœgƒ¡þt\÷dòÙº(…ƹ,tNKOÒ9ßDvŽKðÀ÷2ø$:X™lD힨Vñšª©ƒˆëßÜ´†ãB®äP›ÈT†>»KÝjÜ—P­Þ@0 Þïšux…T1Í©y÷Ž´y@„¬qøp .öé×`YïéÑÁ÷Ë!‡ÐÒqÒ3‘ƒÔ4Ð3=~èÛäÄŠ ñkµàÇçâæ±^´>¨„x+•X±”*: ·ÃXFR3ap‚w&æGÇ)'œ›ýÎà•{[ ¸{S»ºaÛÌ $!pYõòέéEØV MtéCflÄ‘™rGEL5G˜.*~KßÀÞ·vM¯¡Àš^ÒžÚ7Õ…i÷ï¶Û šãQ‘ÛÙæE¯„xýI²ˆÑÏ£IƒãSèP6‚Ÿ Gä7²I‘×À•R´šPºÄ7æß©^S ܉–B¡/”ù“œ3+Hg!CÓ|gHƉécåé–ý;—p?oÝë¨ Ø”ÜUµeÙ<ÊR{ …ýNâõ.…û}yÇ|{kT<â9¬Âà •ó%†®# ò*åÙŠéÛExÓ{§û —Ü™ÎÎLŠZb–tªk-þ%áw ¢P–µT1ø¥•öÇzNž ÃÆ~Cþß¹¢É¶’þϸî{÷޹´ÕZgÍNIm´ð{·>Wq‹ã8XÞ‡=$ªy‰ÖViy‘]öÇoaXQA¢7T½½ÝwŠ6§âëÐ.§h É®¶œåµx06„ÑX¥\ùÊàeÍîp)¼#õa3ìÝÃ[Ãog£_ñ“ŒLÕxŸ¼VsUÁUÚÝû¼m&Ÿ}„æÈQíç­Ë2vu£&¡Z:^ˆÊÁ- ~­1ž}:S¶µW"˜k vÍV1ÉÕ]à{É"*:àEœ]5ÒŠîµÚ›“l¹ÝIþQbw¹Ð±|ò@Äß´:(o™µz«ûNë” VA¶ØobÖ!¨ÆS/²Õ‰ÁÍÊ,8KëL6"<œn¸gY¾`±ˆWBøþ‚:­%z¤Ó¬µê†çÔr”©¢)×"¶Þœò3Êf–kI=zt2—S¯0eu³²j7чéÈËiöÏjÂáëJ'³®ÙG©Õë¹@€—"0¥+ ÖÌ}‰JY}´òîò!¼WB*m‚-|ºC»×qìÞu<¹‚&Š‹,½ŒÕ¾ž(LiVA¸EÃfût?Z DÈC(Óce皸Ç8ˆâýÆ*×^<€·¾ARÂè8ÁQN á75±@–Pt£éÉ^ßQÛ¹Z¶Œ“ÓÔ´‡¯èQ‰<°‰ ¯”„ó©Ïî0$ȤV<ãL.SÃ&ϡЙpuG;?ø†¢öBñ){…^\œrÇø¬7[Yñ{ºæ Æ%åU7—çí)Á=x±ãÏ@f˱:~/UAÀ2ŒC3þ)«Ý6ï´±'/þbô}}øo˜§¥ Ú¿tx„"ZÇÝ’„·µù‹g8ûÛ\ºž« yžÍʇÕyáÞXê£ tdâóo ?½! LlLJ}Ã}åÏãæè'WÇfˆ+§YͲ ŒkOr§Ào¼¹C¢.¦‘V.ReÓäD¦³}ÁAÈk¾š‡ ?šïyî4‰Ÿ&øŽê.xŸ•æÐ¦¦ç¶ ¬örÖξJÔØï~Á3å©z;p)3±÷¥zmòŽyQv·TÆÖø¶›M-^{(P!tyŸÉÅ)—`y]IO\+ü´twb/—·Î¾E³`°[^Hh°º;ž7‹j`SĂٚ é¥Õ¥÷ÖÕ¯oöœ~ EôhoÚÂìþ¤øPÛDlв™è-¼NqiU¶¡Åal^ú ž#Ìü4½F”¹ªÞÅ/òñªý[H¨æ 5ɲQc¥/öF|ÔUÞ§ ¢¾e8-o¼RP+Ð ÿBøxI³Ù4NAÖlÂ~}ëµ*Ë 6ü æÐ·ñøn=ÚNpü° =2œÇ-Qßæ8#[štëúø|! k¯k{ŠVVÙ!ü7¡…Vý#^„ÛþYÚL9ú•‰2ÓãŸ)}ÛÙé^3F»¯NèAKnOÁ|6èÀ÷B¼7L¡:»Ï4«Ö?3E¢„wÊ@Ì8M&R¾"Htë-‡Gr÷ú01î^„<™Ë[*éK!¦ºõì>›Y ‘ ˜ûG3Såš+U!M_ŽXv!!ÇÄžö°•Œ Œ¦t¨0îs/¬2ùصdrõë$ME`@ç Æg‚^â‚>‘ÙÒjÜF½ÍîìŽ#S@²— ‹Z–èª{Ý«˜ ´JµBJÌ„ù³–Àp•A¡…Sš^ô K  ›¢EfÃÆ0©ßqÎR¬¤Šh’žP’I¿[>ôZrdëØv÷§¬`îr¡1Æìì\cß&^ô¨e(=ÖžÊe™MÞ%ü$žU1Z&²‘Kh¢îM¢, læðýØ^m ûZúËÃhŠºŽakÝx裎¡Yݶ®j­Vš‡“M2  Ä'%µy>ª[¾®X])Þ›j qÚ¹5T¦“’hD Ák#ƒ’\˜nr|?¬sº²Ä˜-³¦Ð!h íu)¤0V]‹ Èg²{êÑñiqÅѬ“£Ëí©‡xfвþÁéCƒTcLò&«¥“èt!ñÆõ$Ò¨4–‰´ifŒ"Pó^z“¶O˜¡êPtŽÈÛšý;ßsøF""“‘ýn§uÁ µ'YEùòq0 ‘ʯö‡Ÿ>Ým!ª‹­ÐŸû{7.‡.Lƒdw>N¯}Ê{Ô%B7lÄ:/4™˜œfFç$àé ÷©ˆéÿ6ŒÂ›ÓsýÔTÚÿ›ù ÒÑ:xtb!vÊ‹Ï=нû*:¢é&Çâ·‚±xI*p¹íúˆÑŸá‘¥†’dÉy•TDÑæˆ BUG©±×â[¼;`¸ˆ•µâgräŒq‚¬&šSãE™Ë§DpÃñ² Pç„aª´ÚbÊ ¦Îjc^»(†ì—Mg…Z¬‡“î3$Fe„E£c·…¿,b`~R˜°Z²ÁmR®èõÒ‡\×ÿüvñ…»¼xL°·yMÓçÀÏ 5nî5\¥_ÊÀØ>ä5lO‘E£ ²2<eyPÄ$:¬'´Ú‰tñ1N>NKüqÿ÷ÄRsóÏê¬iÍbÓª5ÝÎó^Å5·†X9è–Î@¢ÈA/gбRyå§c®Åý’èDD2ð:~¿ØmƓЋ©iÚ<îóܰ+9ÕŸPÅþ ÍJŠEæ)Aòžž4É8 €rÔGWÕœ•\%Ì-x‰Û/ê‰ÏvŸ<"ñec/¼i$~C応!¯ÖÀ£=;´Š8â` 4xq|jÉ•^಼uÔ¤ˆ|¬Æù×]=m;VÖ–'.0elå¢;vù>aJº¨ã„XÈýÀ |¡ðN“‰^!N¦'uÖ/öN΀Bö“"ø(– óf; ‘ÉMD?›<´JsÓÝYÅi¿ÌOjJ¨ñÑvŒ1©Ôãj€¨e×ñšÒ¢?F öú¼‘À1ÔñlÃ'­k4¤°Y«m¤Ù ~½ØU ÄøG¤r:êy¥SÉjüÊw*¹œhÞ\ˆck ©@*øêƒ¯Öœ¡Å‘ŽìÖ݋֧ÊÅü3™œ*Ô3'zâÚÓòÔ牡]œ*ØÂjû8+¥ ]½ø DËê‹O®u ¾`÷R(‚½´àc {¬¸Ìî÷˘֧ª0eàXù¬tÔH^é6Pm=wà¤ËäÐ ?Œøí' Hô"ÒÑáûÆ2&ѧlëåeõFÜd"k|ŒÕ–7[{–—N]õ ž&Mäž‘tµ¨W@;m§(!ëF±)Fy¹Î?SÒ8z„×1¦sR0äS½ã˜ÿx¨È„áÚJàG'f_°ÎDÉYë†4G05Ž +#‚…fÃ(BêÇÃ`u±u¾í¦a ?0àŽM–¢YO¤%¨ò § ð×9ÿŒÜAš•h‡éµÌóìšQC¯½,›ÊÙ‡ÙšÀ¹ñõ >Ĉs>Àž°Ù@¤÷S¼Ê^>)]c{Ó;^'h‚-ÿÔÜQ)f1¤©K 4E­!ÌBA÷ÒŸ;qƉ§Ãú‚ù±©1q‡­_ÊvFZü&H^ÏÁuå²+ÜÞªx1ÿI7¡:Æ‚:PY¿gåmWP)öYÏö¦á4µU`Ôå‘`ú¶2‡Ç’`²¸B=•†–hG‚8y¤];a%H7:ƒ€Îf uîÚ#‡¥­4©+áAúÊC\Ø ¾’¾2ðVú‚pc·®¹ÊÓÈ«{LÏ9ë—vÿR²ëO¶èPUFM_Øz ïb`+‹çdÌ62FÙ^^j1!>Ý0*Œ¶> 7B®¶ÈŠ`]ä£iŽ1% tR“CÊáÓÆPífß“ápi*ÒFÓ f«ÜjsJ´Ù•2ʃN¶MêQ]´5“Ÿ•˜ÐW/šø€RøzÁmQ2¾âÁ‰}ë¿ÿÉ ³ÀÚçǹýM`_{ ;£’É´?kгã|Æ®/Ðóƒl¤ìɰ1Ý€™9âío¯ÛsÏ¥n[ùä|u:yH`h$–o¸l¤©^m¤%K§A”‘~2k¥9ï$LнùX‹¯2Ulê&Th§aÌðÍ >Ö¬²´µ&Ôræ’Xx&ðdÖd‚å‹¿Ø£:+h`¸Q™°`ü9½<¡j}Š„¤¸EÞiy»Å×ßÝsW7:ªu zb×/ÚJþ”¿n¿É/-[·Êßw£®ét‚X7ùwâkgœvZAðfWeåÄBõŸêmRâ$àú¿[çÏÏÖžQÚ,ü‰ÖS8…j»"oµ\Z+&í…K³'îÒ9ß•"KÝîX,Á["Åö’:;Ëç Ì™Ýf~[Ö R”›‹ v¦€ÛÂ8û^F©=döeì·3›8•^|qæú}Ù7=‰¾#öÆÜTûäÚë÷pæ8ñ£‰cN¡OÔJ….¼q‹sÚ)ØågEeÎùᵩ_°ÊˆéâÌim1FG4 Íz4t¯“Ë^8 ,c>œ¤~¢\ÄךYÕaßd¶D3*½Çù ÁÎÐOŽá³µ&Õ8kÝ{Îàñ¤ð` JîÔuR­ïÉ|#N…Çúo©ûÂt]Ö/ª‡~¼_Žb Dø"Ô’R(ÝX´bïm²»#Ä[x·ÃÔSÒVf÷k—L>! ¸ÅY¿'X°‹YŸ|s‘Œf`®Á,”(hžOç™ÑÄÏÏÊÕ¼à¤vÿ%pN–­ZŽ~Çu %l_;Bˆ…y8鑆CAÅì!û…·ÓOÍÔo‰eáQ;œß{.ƒ¢0üŠ\‡UÜÅñ¾ú6S¹MQãD®÷ºŒ1Lä£!®/ÛŠ"ŒP:êr»S3CÕúȰ<¶@nE ²X½üÜP5ï>†ø-ߪ­£²uw¿nà>‡$ h[vf¡Hj’_•¾­Eå‚0òíˆêçj†³]|¬Ø>†FµiÏH_R>ÑÖÒá:¼àÁODd¥Lªcé(Ë-qÝ:ø¡8ô×3ªrBeLáéfpë¿î4¾&r”Í×>?~ÂF)ð—Š^óÓXѸKôH¼þ¤€y”JĆ!W ÷üÖÑÙk¶·Až%îåh£ ª4MÀIg2²˜4ð€„±¶ö,uÙ"öþöE7Û™ºÜÁ•Ä•çHЪů[5‰×¶Ùêc³ ý[mÊKªh£¹ÜÜh!%’©Ôk šÅÀî¹KÛÌÁ­FF 1ÄÛ ­L1 b‰hlúX  ÆcûÛÙÚ›CuaØ¿ùì soy¤v¤@9Ì^úûT_6Ú)é&ÑnMö ÓtúÔXªjÒdeybƒ}(’÷7^lz‚FlÝ5:Ð=‘8O#l^XTÊ}W ñÂëÇfµ©˜®$Í‚ïý 3M‹ŠÅ6öÓEG¦M2+#^¢V×¼,Ð×¢ðèדYkÁ± q9£—¤¹|tÀ5¿c\ ÌmOÙL‚»¨ 3²ÍûI‹'ÔÊ›¬ÍZOê9{®-³ÃØw¶Ê”¤°½ô¡^y—µûÒgü™Ø: b}.08ºAhš|¶êÜÑîªæÓ©lþ <¶¨˜ùG|v«·Ÿ%îm šAZÍ[9ÊÝO'-2\[,éç‘eÆð°Pà‹”›WÇ~ݵzMÕô·-ÓJã]Ž™qJžVí|{åí"§¨{»¿H &Fä÷Ú|w%ù¤ÒGÚdÁuŸ¾ŒÁæØ6ÉÊ#ÔßîºUútŠŸƒ¾HnõÍÿÎã ݧŠE=ôù¥'¹¤F Ö\³…<ý.±Ûd2qÜw¹É]®:¢ÐÓŠfaUª9ÒlFb´¸ô+F'¾ÚN§Æ L$ÎRxƒmÅN;yÇ'΀BÆèu\Μñ§W,H¡^öL™ÓV¿ -"‚ôËσOÞ'žÚ'êDTÁ=ÀÀ=Úæe“žÆÒãrp‘^=¼èD\xûž„ºÚU[­°\*;p›ÙL4´þcî9ØŒ>¿Ê‡ïjÉ ôǃv÷KË“ X5óë>š¼2²mã²èýU}Lˆè‹û68S:ÝQ…>K.ÿ mLu±¬:G‡š"@&½W%LíW)ùÁ:+"šKµ—™á½ÝÛ#™}ž˜ y{)WŒådh[*u±ZnIË´ÜpýÅ>މqÓϾ¢Ã¶ ‹òƒB¹óÂsÆu{bŸ9·…?ÕüPÛ¸u“ÁUq>íÃa·Ó~»qñìÎ:;¾`ˆXî în uåÉÆ#ÊGpù.ºª+š³o îÜJÅ ³ ™í¼Š\i꥘#6-ëÈ{x—;‡šçÓƒéÈÕR, ‚îÆ—(§ÎÕÂÆVÝ»ëäŒ]ªyøôU¶‡’–&¿J“Õ$böIòÏ?>Á@/Ñãv†8X¾[G®Ãéìͤc”ÒqÐæ œŒ^=ވ䪌ˆ:JçúÎÞ­ðA^Ùqy„÷Œ.rDìD¹µ,_Ýéï6ùYHØG¨–7•äĮԊ¨Ò\û¸"ŠØ¥‰SünºÎ™Ûù=RS¡ýIgüÀ}´î² þÅ7¨æ&Ÿ–Fçäí—¶p4Vªâ¼H„iSÅQÜ´R:vèçwÜ&7m©98…M…4UÈNÞD¾WpŸS'}ÒƒÉ+…ËùŒ:¿:ßIpÀŽ«mXöÔ‹`ÖÃé-—*×p¹Stb2 3øÁ÷]Ûã€iž :WÑÚQ€ý†#M'{/,åyi˜Å-qCþ"íªN¹^k¡qç2©òßâIwŠ2ì]Ù)±EPY.X4Ë“Á0‡Ú$²Ô“5ôAby‘¥÷ÉüWr[}½9X'S¹‡>lMjijý.ÑyÊnTÍ"c„¶mõ©(à²6ú—+ÊÇUÿ‰Z–Âeâ9ÈÚØdâO€(†ªóС&éº:‚Ä¡ç8\Js–ñ±­ºÃy½²H_˜ð£‘)}Ø×C_üoñË*tB—¿'EØ-vAŒe(v>ÝúÐÆ&ÚjW‚³lóʼ»l†[~Æ#ƒ[|ExݤúNõSÏ1ìa·[cH÷¾îº´CÞI=ÈK;µ<6ÐÕ¹µ®s¬<¹Ì¿4ØL † =…ĨܦÏ-Ö”«ò”îNp-—Pþv¸þ F›^Ä—“¹&Ô+û¼H5$H¤\ÔùËÀ—Õ¤ônˈ9ªª:Ì}kµ‘Û 6zml$óLT¿}"4ï8¸aÃÐOË»ˆÎê®ÐicÅâÕÐJ5áªÆë6 M(ÁTJ¥ÍÀþ,çØ~2é¾mRCBã9g”_x°ä™ «öÇõÎim©´¹ËøX­Þ͉™\Í‚¾FS"Q !ì ¤ ýÙ¡Ø?ÉRç§ß§×ªÒá{ £Ô0—ÝôÄ©(‘v';â“{8œvßñ+0Ãm¦ 3žL‘tEõk-qŸGÇ)F‡P~É KÉŽwÍ"Èhfôœ C¸ê™¦|¶ F¹:Ü_ïæRüŒD¤Q«RÄ8ºZË£“÷ò¢‹‘7KÒŠ4¡|;ŒR‘!Vq¨Ðv+ÜîÛŽÿn¹ú2ÉÌΗÏm×¶dg-Sÿr Aû*6Ö†u<ö* ºÜdþ¤Íï¶iR”i~þt–‹e/§]  ÉÔ•;Åa/ã–,¢PCÞ,­u\šp±ö)¹¨GdüÈ+=„Ü¢OÑŠûn ŠÅåeg³QPµ×ˆÌé©{ŸÛŠ9â t”Ñ–ÙÚqqh¢ÍÅ|v D™ž$ÙItFx&ƒ:çÏëäÎR®Óm2SÂÊÃ_é¸o ÔoðŠ»Ñ.Šw±Ø?£î ëTë"¦˜’ èã\½+S¥Ó³¼ñw.Ý^˜¦Ï?7åw¹Ÿ§.®àn6ÉYB..E˜¸‰*/«B”÷3–ÀcÃ4’¾ ²”˜ÏÕôò•p V^&MVwÄ›”'Ç=°Cgûµ¤ ÉD Ð÷V ó¯Ò;²|‚!ç¤Tw>>#H®N¬ZØÓ¬«!@ü_N¬C>üd¸²7V=$ž €jǶ½ƒ07½ðøÄ3Â%"¼Î–e…Àâo]ƒŽ‡—´À¨ò˳9ttf*(ñrÆ ©¼ ‘ûDR9r-GWl(ùGuþ§p ^‰Ç毡Y:šµbï³C6ï•™9a‹.¿o/A.Á2»cýŠ˜ƒ K®mI–æ|&ß—Sc×'3ìÜâ&)´8…à’+¿êcÆì8«eJPö†ée&Ï«Š#^–À“0EW“­€H‘ÉWÝÀÔž<§ñÛøü´ŽSퟎ ¡ºì¹óÐK}mÛj[£©u> I“I ”u6w¬VsÅÆYÔ;\h…µ ®¨<Á|˜NïLþ€U‚ñ:r0üõõ½í¥k–·ÕV‹æWÕ×í/ÃUQqçÎ))|å¾Sþ ëá‚ØŽÏ1GâROüvÔÖ¤A`ú+çÌ9ºU¹/ÓÖóíõ4À4kF@¬ø‹{ºç°Æè„¸¸¿ž…Ò(Ãt¡V/&ãŒb â^ Ûrͯª.¾ú©¯=ì~*¹üôd|¿ç¾«ßøi'"i¼þqkFU{Ĩ»3|ÉÁt|ë G_i î¿QVHGc /fî%°hÓy„&ß7r¿·8»‡ûÅS;ëJx!|+{h‡ý"ÁAeáÇBEÿhHìGíÞ ‰—¯s-=à5Ú?ÀTã •†ÔfÙ=.Þu»s«zÉsØ.É+Ú­ž¿]o}ëL$(ïz˜E ´ÌB·Y£âº÷ã[B72bÞê6åÄv“§œ×ØÎÊû÷¿µ¾[Ú|–(û°Ù"¯àƒIh³7N¡þ†jZ @ƒf…£ÁÃS‘u)~âtìT”ÛÉsùžœ:õ2Æ3W¿ãª}tØëOi-@¨?Ø& ­ÆÚ$³ö°ôöÌ»- Ì ’ñ¥ò+è/+»f*÷ô}XKt¸×uÊŸÇð=K9|8Óì*\ŽðÉ £¤iÈ©HIa$5ÄÎ(£å©Ç¬i„0úÆ®^¹g» äf}ýŠ˜‰S•èð߸!Þ±¾x°$©ß¨¤£Í6w‹é˜o)LjÓ¡­Ù󵞅.7¦_/íX¿ïÞÈùêÁgÄ*‰¬"o‡ðOÆ}16n™¨TA¯3ѧu£œL¤­ 3cV"ÌŽd¯û?Z߬ SÐç·e:5ã¸/Êl¡eb;@˜$'&±µë¡ð~Ÿ(ÓiFIÍ/0$HÐjsf.õäÝP>³¹m”än¸ÊÞ?£EàkmÚ܈$u2?8q­[^™7ǼeKmž¿¦Ð=ÛÙ N}± ƒ‹§U4ðvÅþ$oq±›óœgŒ1àµN[Þ 0‹¢a¢á(ü¦¸oæaz²*<‘µ 8µw =b‰?¢»`ÈÈ©¿OVç´@å±”ôÅ5£â¤‡B?wqŸÓ‹:>ð¹2¤²¿K¾fBQamF Ô'qþ²`§Ê­ž¾ ^Z`Ñ1öB±»ûôm+€* RFd£t)™w!oÐGר¶pnEÔ*~ü»ÒA+5.éÙvòr¤MÅž=D*·e¡l+-Vô6ˆÑzèC½xc‰4ÀÏcÆ''–oɈø7HE)š¯Ú¼™â€‡„QtIL;d@O'N*Ç™õù~0Ø\X ÷ªµ]DÎ:ï ÇFö/Å(Ùè«/Qµ±Ä¥º–bM<’ØEøHj,â¸ÔV$Ç%£Ö3Y}[½Ó‚ULoKü¸9YtùC­ ¾¶PûM?Fë'‹¡¨s¾!Ÿ°GF·í†×DI½d¤5‘R\œŠn¾N«»ß(‹ÖÛÁªüÜ-l®Ÿ«ÛO´ÇÕŸÓ5¡/)iÒ/¢ñ ±.%¹È8h\¬»ŒM•^A͵ q÷…‘£œv?Òå /—´ÞØUpg˜¹9:§üI U}“"8µ FIáTª¡Ÿ32œÁ \SˆYÛ,kqç„e”kL{°á 2+4š8(á(QLâ;[´ÊeÄï‡#²Säâç0»:˜¥®ê `|–»žh% 6J3|líXá€+D?­ñÎÒcK qQ>¼`|k¼±Tã(”¯°¦þ]›ƒ7„ã'ùŽÌ Õ‰Š"7ؽªµ`Bã•IäÐX¥*är¨*Aœüó²€oĽö"»7Rß?ëð…†¡•w»‚Ò Ÿzª ùm çX çîÍÃ5×§kÖ?ÄÌj¹æÇÛ›‹Ÿ×t)¥ §Óyh¾ì¢%-üŒÿ>’ÏŽsËBZ0SRŒ–y u›[ã%œÁ"á#”½=†ÇÖš¿ãÔN‰‰iÔ«°IÙ’‘š¢åRÒšÍ !S¬R ÆÜ|ˆâ! “¦Ý&Òn¯’Ð}/ã²u߆} qü0’;@a3QEr“ö¹Î36ÙF%ú *ù뻨(ôôÌ÷H24Ô°<üÄÐ[l,xËJ;R™ÞBvA HÚ^Z¾±}aK4¦½Ä„wInc£Oè?Ú}Ux–ãï QT½œ!|’RÈ ø /SõSÙ~‘=Û,%ýé½~M9€ä,C(¡‚þn1 Z'×OïÖ1ƒð›Ž#bT&ß\tÉ— 5é¡ üKGqùZ2ÍcΕ|Ëùçéï¶ûW» pKÚ%žçD÷lLJ$˜û¾/ËÍ£á‡,³—n0À9¸ØŸ@ Ê[åS»%Üô¨—nšûyg³(™Ÿ/y º ?Ä@ž5#­7Sƒäšœmý“„^ÁI>ñèÄH‡Ú1˜OI01“•·ظù}Âû‚|›³±ø¯Ø"9œ˜j]d'P ° Òó‹Sy°nÊB÷à” xåϤÃ=;-¤'WÓxê½Þ Û Äu+Ú¤;Ó^FCš?A/{` &;†çl%û¸M5ÍI„X³ìçE¬¯Nô¥]ñ_r¸ÐS4Iœ“©>¿øcì[5Ý”§…F]Zá·K”ê0]ÕÈ›‡høzzDU†UfÊÔ’¨œÜß›¸•9}‚Y&­_&Ò1Jÿ¼Ã˜‚“ÞŸd—öÚI<‹ã€QûÜ» šÃüƒ7p8AkñÝ<' Þ8Öz"5<µÂ¹âóòŒÚ»âµ¾ýóÊ]‘†yFÃR <)tµáܦ¢Éºt‰ÏI•ÿ™=j{Ïue͸©Vûl d×ÛÏŸ• ì?cN!¾’•¦V¨¼èþ⑬h|«icLa<‘ YO¹ý®¾Ì”ûy<}ÆËÇ+d̪2¸Ð²É§ÍÓEÎ,QŽ‚VoÏ”?8þŽèøýfï¥jW;ÝŠJ+cÃ{r›ÇHvª¾tµñµHèôdÔ+æzÌVÃëi5¢'bý—ÆœêT5Ü~–gK¶`]iˆòwß—}¬Ð.±NÉ—iÛ,‰»oª¬ø¾f’Ý‚n¶;tj¤N} Ä4hÆEzèôÐ1_£DéÖk&W™>Ãc1I"ègP"µfšÓ i¡cÝ^ß9ÑÄ„×UàU͘òùÅ%¨ÛóÐü=Ži.*ê\MŠQVž·s! ©4Þ¥¯¹¼¸¿ùpÓßÐ_ÜbIŒ+gE §k8ü¡¡d²»ðô˜ô´ת9ù¼ºÑç¯^À†ñu—7Ò¯¤xÄ"æø<…¡ü©—õëéèÍÀ9œÏè@í/}ª£ìvJ^BŒ¤þ(?{^Œq-ÉËú_8ðÐØÙÃŒ¥$íL¢¾5!5(efœ&‹ek“-ø©”¦wR¤ã¹«d@‚X‹§ kæ+ÙôþN­ÙŸî»Muâ(qNÓÿI£©õ®û9U„ÏÞô¾ÓD¶ÒAHÊ@Ê.Øw¸ÊŒa¤»|#8Ä „gÖLfÏgHõIƒ°+R+Ì3¦n—«N;ãì¼FÈÔÏ"Sæ7º9’aуx‹Ø Ç1—oóþ DÍhA}Ù‰%£öàWÖD®ýe¹êÅbè.Ù2ÄZ%`ÿ|ˆ°'!›ˆ¯T.Zýîãáà1¸ÜŽ7•-AºÞô|ò€ò›]W­DR©í”ñt­ø Þò‹$/åþÖ…6­fDêÜ÷¤æ÷ õÎB’@…ßxíC1®ì€ÁÍåÇÜÿ­zÏ2 âŽÃ´†‰©;ɉºŠhqcð]ü¨¬¿µ>Ö”_`O©Ù‘ë”ÂÜñ)v(M1±¦$'ÖU„c>¦5ÿŒEÓ(êsˆvؤð•ÍV»ÕSªhvX§“柹‚šUúxë§Fʉ o'nóïßèyde¹Æó-Ã…½½áœ£é-:Ê.ŸHöÞñO5¸”œQûq¶…‘[^?ÏpØT‚ëQ÷ç¡ v‹Ô.»U*iª‡ªTvÐÉT'•5~ë'ý£æ±…M¦Úi¤«gHœ`yÓÌÍ(R7Þëø2 qê•#xÄÖ~¹R¡mº d§ñÝu›Ï>·…kð颣÷¢Uº(|nŒNH¯#¸Âî×RüÄ -/O='I-,U—B“7ýgÍÖ¸Ïs¯mºF7¨¯E›ðIJwEr›h™öÀR5õ’Íÿ¢„%À endstream endobj 3672 0 obj << /Length1 2415 /Length2 17776 /Length3 0 /Length 19183 /Filter /FlateDecode >> stream xÚŒúePÊÖ€ #Á ®Áww‚»»·Áapw‡ÜÝ]ÜÝÝݽdŸ÷ûªî-ª`ž^¾zu÷ü€’TYQÄ d”Ù»0²2±ðÄDµYÙ,,ìL,,lˆ””êV.¶Àÿ¬#Rjœ­@ö|ÿÐs»€×Ä]ÀŠ {€¬«-€•ÀÊÅÇÊÍÇÂ`caáý"ȉ nìfeP`È‚ìΈ”b O'+ Kpœÿ|ИÒXyy¹þ6ˆØ¬Lí Æ.–@;pDSc[€ÈÔ èâù?.hø-]\ø˜™ÝÝÝ™Œíœ™@N‚´ w+K€*Ðèä4üU2@ÑØøïÒ˜)ê–VÎÿ¨Ì]Ü€ð‚­•)ÐÞlâjot€£ÔdäJ@û)ËÿKðïæX™XÿëîßÖ9²²ÿÛØØÔdç`lïieo0·²”$å™\<\Æöf)Û:ƒÀöÆnÆV¶Æ&`…¿S7HЍŒÁþ»>gS'+g&g+Û¿jdþË ¸Íöfb ;; ½‹3â_ù‰[9MÁ}÷dþ÷æÚ؃Üí½ÿCæVöfæ•aæêÀ¬aoåè ”ÿ·x ñÏšÐÀÉÂÂÂÍÅ :€¦–ÌP÷tþ-dýk\ƒ¯·È`.èkeÿAôv6v\œ\¾Þÿü/!²²̬L]&@ +{Ä?ÞÁË@ó1xÿ¬<º,àñc°üõóßOúà 3ÙÛzþQÿ{‹™•EÕä”Ôèÿ]ò…¢¢ €7#';€‘“ÀÊÊÎ àædøþ¯ec«çÁòÇVÆÞàýWºà>ý'e·ÏÍ¿-à})‚À“ Ðüt=NSð/ÖÿÏãþ·Éÿ¿)ÿËËÿë ÿߌ$]mmÿ–ÓüKáÿGnlgeëùo ð人€O|ìÿ¯ªð_GWdköe2.Æà³ boaûß6Z9KZyÍ”­\L-ÿ5.ÿZ×øë ÙZÙ•AÎV]-FV–ÿ#Ÿ.Sðõá žÉ¿E@ðáùßö¦ ³¿N'ÀØÉÉØ‘—Se¶°”Ÿ_m‰Cni„`;Â’æ¹ðsúzyý¦¨ë¾¾ù Ç/°™d»èv{{¼?í€â~¸ô—²‡ÿ¡{£þéTP}‚pÜxˆÕ’4ó#¬Ñé­¾ Œ7AH‚âèI(9ë‘êuÙN/”·ŸŠ?ŽMƒ…– ø÷…‘¡6æÕw]CÌJt“1©Ö|²Ýöï†åž#ÈÙÔrªtŽ{3DM0„FÊ ƒ@!5Ü•EÆÆyIá9ÔšÂ,n øÆê&‹§¾ šUŠš}õ™”)™8û,màþEµ¢tH..~ΚQÊ®õ-·+œidâºS– ‡k¾b†ˆ?Y_að„¬^0Ä ¿L1¨ûGòV0yš`£Žu÷eÎ`=}²Æo÷Ê·ËmÄ—:ЏŸ[z›ZŠLbù4šSzçŠ{{„Yí=Mìè(03"BW¶†hÎÝÅ ¡Ê÷%H1žæjžE›s&è£?x]‰búî”·âª]æhå\-‹cfƒ¦Ädz[º•g" }ñ›H`ººfw‹Æ¼4èF—‰ÙËöýî¶¥óÝqƒ½vUø fáZIPæ6G™&±M=ZJprÝð¾—| I Âà×áàZHå”[žI­…œ¦÷zA—jÏf¤íòwúTö-‚o¾kÐ4Gô}q6·Œælà+ÌÜn–Ö[sšªþûútÞ_0::iDv>¦¸ °ê¸ÀÁ =»PEˆP?û”„£ÝSä»,|=üWsyä4§w sïÛ•~½ùÁ/­ŽžÆ¤•w¡BB„ ¡¢^Ú# üÞm^üþ…9ßTë{°xrÿ+~dðГjjQHËfλ_‹S©/˜ßH'ȈV®yk£TÜ:W¾Åé+qúôÇ^ÀÏxšpº)C`íê;èÖ·»68 °(4Åu+“º+Rf´–ä’ê+‘Ïrš²ýÔ]ïó/攎kY±ãËH ýŒÓ¨¸9ò‚÷a¢W¦:{áZè‡K4%qM÷Ø{Ù«†ñûylz‘,O aNam[±÷EìáãÖSwëƒï»úßÏtò]dê¦PŒfšñMX™bÏ¥X¿Š=+°íp:UÈÇ^óåâíÔæ ªô…—Ì+¾+„YØKÆLlH†Û…çøÖFÄã„Ò€§—Å;…yÄ·AÇGædö«0(€Ô¬ôCÇXó£}Ç‹›$•ɈeB?>ûí¡-Î.Õjïq,ƒ©:±øä¦WP§ôldMhá‘·ÀMÀR¢ËP›¦Ï3.Tñ!ކ÷Cá>®çΚ6G L+'&iì²¶Xl•±ì]LiG#šÞÂŒ¾v6^Kq]EÚË¢-]ÓÌß'ÂzFAB‡Aî»Ä&ù–çºþýb~µý¶··e­f)¬y£|ÌO R¬~Äößèl•1ú 8^vMo@G¢J´íܱTE}ÃÖ{nÒ$PžŽô›{¥—ï§dëýEŽa`öÜî­™&f—Òƒuˆ”Ñh9ªÌçè•´ ¿¸ø8“tcUu(ø-³ÄÖÜ“ÛI.Ÿ9”E0Ü-M:ý¥Ù­$|C‚êuQóíN¼îU±(ˆ¦_ u%²8¼1?ÿrðReÖz`Q)ßRð:s}3}œU”ñ¡ bIöã…,½žâ ¡,þ3ÞP >fÌœ] /¬"2ÀH|ª[·ýp`Éåî-‚jÊ/°Váæ›6‚ª !–¿?Eáã,2ÿýÄ\®þ¦œ•4°<ºð›šýc^ï¶y´¿!:]¨>Ñz=« RìGÙQ«ô!Çád;Y€\-À¼=ë‹'Ú#$Šï]¸•”&—»q#$î&…]M¨?š—Ž üì>‹â‘ªcêé2÷ «¼RÛ˜€‰ÿ¨ßÙ‹áª,«XŒ?çe> ’:²—saÝ©¯«¼Q’ÂB@I÷¹Ži$è³ûýÖ«ÐUO%@¤÷ÕU\žO–›-q“x(!!{öâ^¢E">VîBJ€Ý¿&5ijÕùg†8nëÆ´ê[ø·üõ÷ #¦Õp¥l'ñÁ”/žâz uèj¼Ò *Ñm³Næ7R…/zœœa‰äÛ‹nغŸ?×ÑbïãÈí¨åÖùÙ7§”+|Ð~fà¡Êå6~ßgFñûûj"’ ³Fà‚çx§ç/¼Bøë2Ž&9oÚEQˆÏZâmf‚­ À£%4‡ÅÄV!Œ@Taå¯òo&±>ewä0d\rÑ(ò$ÊÚÃë^&(™:¡¦S÷¾o§´”¸ò ræJl¨«[Å™:¸JÆ:à[»“fÔ•+²ji³g”º-Ž` õFôé4òïdcícç³k5b—+=–mÙíGýa“W±©¼sØ7œuYX]>˜2·±/Ÿ÷¢„´Â"°éZÞW)ÂXŸÉ›_›KÎ0 !åBŒ$€ÐÆF GI³VÞo‰¹èßzéµã¦Á”­%¨2§8qäã(<%áÌB¤ÍKºûœ9©cô¯üëtº”G‰ cæç œ*…”ãŒCQÇä¿Q3Bô"Ž›b£—D®Ü³Kùæ«CâïS§.eÇÚw‘BÅNeÍQg1¦5½ X X‘|èpWPR«w–MV!h©{êö†CxlW_ëh¼a«ÐįPt^ŸŠy¾Bõï  ^²ŒºZ¦ œgؼÌÜ ûp :”û¾D&1^‰2ƒšh*eE+Ò妖­¦i8o%êO›¼*7eU–YÛ¼g²ÍR™´”¤´Î,R®Cd=kõ2a¬¨Ö XS ·“k iîë7g [af÷ËýUùñù.‰;‡™»»\`ĸ¯J±·aŸD(+Ú@(l¿ùÆ%ÂrØcÙ…¥*É[•©>‡ìG“C•|A±þ9ΟoøÆ²óÃýÛm¬Â›u×>\Q&òÁ eœ$®fÈÛÒ©­·Æ X!#5¾c>Y ƒjßHà êƒÿoZ)DTÖð*ÿ§{]ûï å7ýkP1ÇðXÓ›sÁ¿" &ºæãFšä41[—ê¬]!H+ßëë™lnÏRÜ9 tÐŽ Å1|¸çáOaŠj /rW0eqoã‰6l«ÊRjóyÉð4I1·©ˆ<ÐY-ö Ë“m’BO¢:¬m¡Ñ•m«Òºç©;’ÆÐ-jnÂS¹V‡ îûSžä¯f©oP=Ãç¡h”ÎCë~izÐÀÇð‡i}š˜ó%D¾Ý+c¶–<¡IÌ•ïÏY»ÛR™s?à…køú²mËžz÷x;¤Z¦4#Ì[odÑÛ²W:ŽóGd ùšÏb…Înõ?2^ãÀJùªQû ßo‚çl\©ÏÝÓÐ^+¿{BH%‡¬9ü¬c#ÆjþöËW†n­WTl\ÐS(UÉp¦ã;Æ ßVbµ‰Ä~–¦~kÔæÅ£ C0Y˜H’ÅÌ$ÎøCË þÛHæš9‡”ÁH™ÍWïýŸ£|+ˆð)õ¿×ô² &‡Mg…°«3_F,ïé1Ærü#žú ëÓ~ô©Õàf1»yZAV_NŽ8ýn¦¬»’dDZ@ËÏÌ_‹¤ÊQð]X.`Ï·°4ŠÖËtr5\¿üxoÕ,B`ØqŽ’4œL1µ¹UL›‰| ±7Êyr›Çž¥eKM\NùºCA~úžëqÒû÷9üKéþVEƒž¤Û­Æ‰Rg€í"¥Œ®EÝ Úégk.¿| 1¤ì²¯_ llÅjÎ=Q[V( “ÐNPÚ7hÍJ¦+1C`) ¥x–ûbÍìû]ë8¶Ÿ/‘XÉä|¤(ÈVO£ó.éÕ.ÙO¢½!±Ê„„táÐIKÒ„˜Ñ·Û Ôœ†ˆ_RzþPqÛFkaõ»ñŠ’JV£/K×¼J]›{†™éÃgÓ0œÈ@xw_î-¹Ïyr8Ƽxù¶Gj7­Û9¹Ý¦)ßÄ¿üšoàqÕºmxßZ0,ÿ³éW&’gihɷછqNÔIUafoóc±KßR³¡.øù;¿…m§ÚCÒJhŽÖ×ÌɸÛÖ(så\Pãi@§Â4½5C2Ê—!ó²–·åÂèàù sødêшõ~­šïÔïSÙ0/¤IçЈنˆÍ9k\„¢µZ?¯4yoG=Õ)K ÚH>/E5YùUOBkƒ¿ú¿ÕCÆõÓN©OøMÈé@‹`?)³ÀÄÁÊ*ãøÑúñnQýÌ_sëÞ2x#ƒ†é mÓæÜ'°„Vœ 2VD[¨)¦Œf…Ùšsƒe]±pÚààªå”¾‹Ç9&ý}]¯xóÚm³¥ÄATÔŽµØa²ú¶›× é’-yåyµW»{{Iuî}í®¢K¯!û5DZ ‘¾ySé|ÛΞaÝZÁ^Â\Ù©HUЍRã]yÝ'”JžžÔÅϸE¹orh|ú¿òDIKzq…d±#Î÷©çE˜îlº¼ù•z¾ íR0›älSšªÖ†nÚ·‘¾£ Þ¾JÍæÅÂ≠YQDu5TÏ8Jem@&¡:£ƒæ)PºÊøÜ>†Ð¿Í±ד!ñ!AÆ™áªÁ]”—öpUh¸ß*‘IÌ?ûM\\ HÆþäï#ÉBÔ%ûìÁ‚¾ýŠ”r«ãíýóf„)ù”g¸ŸºA¡®{ÔИÒÂì½_«œÉöœÖLé±F–Wèä]NäbFh΃ `xf…°e+Øð²_¾iºÚCÏl+š5é‡íõùžq/ ©C&] SË´Õ)vóðs8n”&ƒY¤ÅÇ‚2BuÕ.J,žnñÿ¦ ùLçOÞáâuäHÁâÞÆÅzÖ)ìóÑ̆2©GGå$“¨¾í"Oß­Š¡ãB²Î™¡ ¼ ½KH ¬puðë –ùÂppS.´¤ìØ0³É4Ø„S—ºC›ðˆ&bÜùôü´TÑiÛ%é½P€}—¾—Ï‹ˆIÍ l{L˜«ãè(\e„އ%Yuƀ…¿äs¥P£ËÖ_ìýÐ4²»ç}cXKnÛŒ6Ý.šÛ䉲íÏqéTur¤L,.‡´eùqhæ·³3×܉°1¶“ö© î»ÚüéH>ƒï;²›.ÖÜñØÈ[‡ø|†'Ú¸Ö²ç9¤«òglœ.ýdB $bòínf.SÝÊÃ+MztS=J‚7Ð>}nLÞp"”Çmì¢~"aæ3Êá‹õÓ¦7ÜKîP%—ÚÑüå¢!¾fö¾£ŽaŽ%`‹.ÐufÙëÆd·*(¹Šà¸ÔéÓäiAbDUfåõ$¾<ÄÕÀ m*ËÑ/\q Jû×O3ZclÕKxq(^R•§/+Ŭ©±Ò×WOóvCµ7²EÁg& £»¢\Rûˆ¯Ç¢‰Ä/fÚgqõX·1ÍÚ¾Õé§Ÿ?ïµ0Z 2mmUŠ1¹^a­@E!_%ùkã>°Ï¤¼è@ÿ^ÝR¤ÄYS5pÃ[ ŽüéF%QÅ—c#@ ?$¸L%-ªn”ñÉODÌô›]J«4—+¶²ñÈÄžyuÛÕ7¦ÙŸkýìNmUsóý·Z¥«“–—^t wËJ˜ÞéÿîÖÇÍá'mÀ¶¤üôI3וÆ.±] e_Ò]óêCéeÀžz-lMb80› Ó»îäE'ŸVÎ,t4èášÕE›ÂD1¯+ôàÖÖÍBF‹„„;4ÃТæj•)z–º•e>G¢ð#Š!­ÛòÍz¿ðNA®I¤Q‡ï. ¿£û}|<Èk¤BR%{/R- ç[£²¥ÎØÞ’[ókªF®U-$O)ÞÒy—¾Á}Â…ÌÈ϶²oÁ®¨ŸéRUù»×¯¶ÈÎù˜ ýÆRà©ÊŸCëÕ ä yk¥üèÇÚ³™ŸæC[iêß;¡‡¦ßœxK,›Æöˆ¶ríÛ§(‘äüøW†=’·\=É/ULqy&ì)’t ‚zÊ[~»‡†kèv+˜íŸ«t¤ü^3¯ ‡›¨wç[]%F¡Ò?Phù˜F×Èû²e Ð3åù,eÖ|+OXÈEZCI,·æ°ϺmïÐC,ï§%Nïã‚ïm¬.ç8Xb¸núˆì‘ ³ô\÷ ã÷–?z;HëÔüe6äÕ› pƒžØ<ƒ-á1áJf*™jß}Ñ7©psúؾÉ~S½ÕâGÐr¨´“^ßl‡Ö6qÌžéHC¯DĆTt’2C{œ¦õîü>)’3ù$*­¼‰m`ª‚®-vSÀè×Ï?wp:Þ‘ÀæþòeÞ[ÖÆ…t´Ýf& ¯ð…A¢IhPssÙK¼ê5б+90Þ¥¬8ׯlfdÔWü<€5wÞ÷^‹×Áâ§¾|ÕkYÝ)DþdÀ‘Q®A&·u†X¸C˜T ßý£¥?;ëÑðæô•ª ôÇî·=ŸI’ËBW’_ŽX!p:å"Š…S^øNâØqÇ”7‹o:šPú+‘ùAÙ$ÚY”I ‘æ¡zÌ©x_ËéjUcü?ºš·âÈàYFø‡|:=õUÿAšÇÚ@+7¯Ìô~PPËîx2ÙÉã]ÞåVõýcwˆ7åʼn«!~(šCÍì;]"4Äú6lÎ\?#öcVA‡õSããrëg3úXÿQ Õ‚þF'¼¬îÀïªU݃áþN*rI«mÞ´þoQ!î“p@úlÆBÛÆvÑl³ô47ÌsÁÑb¸86‡Mb]2\œk<ë™Íe$É-µ¯£ ¢°Q㌩×Þì'2ÖÆÙ•Ì4#™\±P2^þ¥;Yåéä÷h_Qm‡=ýõ™2:¹<>,džpxËV@w|žÜzÈtG'“l„î©ñfÈkøä≋¸qÓ¾ºö+öÁõôðŠ{É*Ý!DñIáäc hÓêø9Ó8S`ù0‘2£pü1Ošq–^[ºP50‹H6FMáT‰Ý³o^ý2­ÖIb'3ïMD:©”›b"JiôËvÄŒ2 ‹‚Üåè~_/ôLi–±4Ðdžn¨ü2¸£V&?BüÖL…Jš=0(N-&á¢ôë_k¤ˆëZ»Œ|GÆzw°N3TSäFþó ^g•€Vzñyø g•M¤¸þjÚûžŽÓ˜Ã’ÞH.«÷EùövWgK#ëžXi‚86ïá–F·q"ÃRèà3^l´!­º¿ÜŸ^>×DíEØ…“îØþ®`öñ®wz”x…5¿ª`ìž0Öô£j;ìsrs&s4ÙyˆF¡#©„v\.â2…XgÌÖá.‘MËŽê¾Y‚u‹6÷±Û+mèkª½¬_Î&¹˜Ýê üŒÝmŸ¡íLž¹ÙpccÓs~YjŸJt_ Oe†¤•ÐÚe„hîN锼֧š—òm÷Þu¡b;ÔØï,H—Ú’=º¼í¬²¿{EM®&öVsê*Ä2ŸDf$øN=%/©ø17Û%X3Ö_’9¾šK.ΗÛQÈEÆS¦">Eýª2ßp“ ¢0”S‹O•­ &n&aá5-a‡ð€T`øà{UÈ–ßi­ë\Ž öCWÙW·C¾\;tªÕ…I€êr.,„è—ëÍlâÄÌ/~a¸²ƒÍ…‚\n@¿˜îc!}ðùuô9N/¬ïtª)ˆXÁuÕÙó‰Ó|cr÷ø·Âbå@¢uoñ,aöºý¥dBõ‡SGÆRÙ8\³ÔD¬gûd»zO?”ófi!Ñði7躙4½g%ƒFÔ¨–,f7 òÊ’Œd&*™î l(b.ëÝ*£“ÇiÕt·(¿û’)úx9+n¶~¤ÇÖ4òC#Fðuv9}bph€@¤Ór£±3°I†­NNÚßk‚CøÈÿdÂAÍhÒBùí»C <ëOÃxk½Úx‰1¬ÅILlÝÅÐý·T¹¢nV}sŽ3ÎW´¢­½•´Éò–ûôó‚«²ïºY õ˜#Cdƒ{¸%øPžé^«&ƒìñ¯_ùf±"iIJɘÄ寳z£AJ÷Í=ו.âŒ#;·³0V5Œ¿ u n\&Šˆ^lO“sIáÔhÅü¦ŸL]›P/qÞùôƻۃ»£"ˤz’»×‡Ì&_Ù¤Ÿiƒ¨ûhkÁc­3É"|£Þ3˜8vÝ„þøêYài¿!ølu[¡íË&| (kU_-"CÑÊ]{ÏãKÔh©xeÐW)+a6#dvÒ‚>XŠÑøb$ñÙ—ª~Wö«¬ÞJ;¿ëXþ“F¿ ^.߯ßë|{y¯¹!5C,“K–Ü,bßIÞthèE<Ò,¬9ÑÂ/s‹µ¤Ÿ«uýø„6WÊö‡e½ßS¸Ÿth,wqaõy¸ÏúQ”~=Âi›}1˜š<ýþýÃ2º9Á¶$]æX‚X“©ÃO.SlJŠŒúß}Ðï–àÎÖ¿›¤}?ÞÏ´âúþÉÉ©à*&$ ó|Ž¡ åÐ&öÝöY”Bœ´(+]Lù‡õ³¯  d°þ‘hÞªâ3…̓W“Yè›÷—RN²B4º©"¹&µY66Jä¡A´ásY„¸ë7½¢L¼98ÃYéÇ*Ÿèwv7*ï‡ üÙ†í)Ñ ÎEod‡t/¦Ñ[õ–\T.µÛ©]0{&DäÞ™®Åûo²?f'âØçÂývB(DïZe™ža^¡ôX·0Ó[ìÚ:¹“¥¡¯ýØçVÛZË;.‰µ<79fÏbÁÀÏ®íâ_sQÐA|îø+GHaâ@ **Cš ¸ýyTš ‘Âï¶:r­âPí,—Ã×’Ži=½¾ïlÕ &‰ò¬GÎQTC1ò‘œÒИôm=î>8ýÊ·ªGY°‚H?A ³ØP—ÀÅg¡1è(@º½Òj6¡QÎÛÎÉyǘ֖2ÿu¿É“R¬:—lžÆQ0e)J?ýôðÃþq“Q‹ïôÄ–ðÓHM‚¹>nC¼¬>¾FcòìÚ¨³Z¦è-_%?jm(Z¥QÁú ÿÏ¡ö>—ÓzÄã¾ê¤«oôMøNRêÎoû<í‘´7ÄèϯA“/ïæŽÉ}×V”dPCˆ@Û¦ IRr+†æŒ3xSÖ Ã‰&ØÞð¦J0»ÑO£Ãò”xOoK`Àf;Ùš#j-4¬A†Ñßýã]ÀŸŠ m¦ÈtDîÄ\‹îÙk]‡ ðH¸&ƒ€äСË2 PÕåc(2‹²•>ÐÙàw¦^ªïgÝ.k¬]}Vù}A×stÉøûì]©§ C{ãêE:}²&ძjD@x+rì©Î&\qê&$²‚ôQþÈ„·Ÿ5N†#í¿zòyÅÝ6«Ö© f{j(ïþyüåˆf<ßèK]7‘©NOvü,™ž<9ÌéX7KXêÙ¾=ï·,açÇûE¤²‡ yæÕl—ŸŒß|C#WiYW+é{)+qåÜÌ<»ui ý•z/TpñS¹Î¡âAÏ8gàVQÖߢûH`ÆöÁt˜ãkñÑq¥9d¿ç„‹·qÖPnÿ’“9^"¼¨šîŒÜ$äkofç*ok™[Ä'Ò ôŸp—.ñUÒ×£‡‡e¤i8çð¿§RDöø…Ö(›¡1YN_ë¤å¬êm‘ |¿ôræL'ˆ nÒÆàí€iù 9¼ÀÏ[67þr:جhÀpn8!b‹'·ÑSÛ —ZÓ,à<ÜJ¿®8Ä.-«þ[â|ñxÓ, UH–ƽu)¤t M3Þ8éR|z ¯pÊÈdÔ{¾<-ˆó{úŒ‹õt™+"úéi3¢z‚ËÙ9Äï­á=VOÇ£=*µˆµÜ\±ÞbDWžVÙó³ýKïÒ«ã·^ÞÖpÛ°~zÞ¨¯‹Ù¾“V@ÑæõR‹yƒhýx‚K¯ù½ÔÃözIwý±æ}l¾ÙØz9Ô~Ž*®Ïݸ’>_)K€«tãúõŒ(ö.a_>å÷®qû—CV*&‡*²}&·wŒ•7_Þî]ç <²«è“7ÓÕnuá¼êß-CPŒ5Ž1ßÿv„²M-l¹¦´_}Ù‰P²¶ÉàfºªDÀsA ;—jd£Ì©wË8˜×ã%>Þ}´ýÚöaÕ-©¿n?ÖÌ"«¿}¤¯%JO°äbX:zîЙà=c€³|Â[U›7êuÈ›¨uóè°¾2B¬u1 r„BV@¯íZ+¹ÊAúT#ê BB”ɰEøm³A±Žè>ûâXMÊìCÀ“\{7Ò£‘^ÂÁû½àAE|²W1Ñ$Osƒ4‚X'$YÍ‚d´9õ>d¸Æôò a s¹G^ååŒ s]Á²/Ì60]¾¡î[£¡¥uÓn"ÛÜA­î£+ޝ˜‰('ß ül¯ Õn,<¥aó5e§'„%¨ouQh¼ˆ—ënq܉ 4¡g•` !”cêg‰œQÅÇ’kw¬-·Xã~«,0›­h«ÃÜ\ ëBx©MºPÓ<‡DŽËÍK*ÃYý®œ³Ü§‘|O9¤YüfmRz•üdš±ËòBZÓG_1O]D„ï¾ÙpS§Y¶½6¼ÑÃát¸ŒŽ‘‡{À&ÀFÏ|y÷®9Ì´i®UÐfÀDÝ¿ƒ\o`hj—u-‚‹3úðsÁõ Šç¥3Àm|‚}’|å½ô;,þ6C¶ÊǹmÒ{bÏhñÔU'vY”B(®ô8?ÜiG>Þh;ÿÝ—ª„ª8aBÝ„=/ao“@²0÷›vª¢ìE?I¬-»&Å'6œ·¼.-¤Z²²ÒŸóO¯½1¾é» a.’+©®%6«‚ˬ‹Œ*Ñ¿R E³”lí=Ì– ¶)]ºYD òK5×V<Ä© ÆÔ+L/rvœÃòŽ|$!Œ²ƒ¬ËYnãnÑ2±½s'1ªàG ¾ªα{𾳉ëŠl;Úx6¸:X ’bcH©2Ñê“‚xËñ»EÕÑaã±YØF[×õçoÓ ~+7в¼wЊàRôû˜Ír *ÇÔk9q̹³uöï³,ÔœÅõp÷²ÊW ¤åÝ9>˜Ó]Zrâ»{{,MÀ8¡;é•ïLˆký}ØämŸÇ"·†ÛeM uD¸¦aëÒs·÷à*€ r‹…b:QTÓNÙh¹u§™×I¡é®ä Ýy$õ'KØSA-êrÿ góMÒÖʪ®HÉ? GãúÜnOI}æ™ðÓ1™ÓËš¨úè÷š!a²Â† é'ÜntgÄ€sH,ä ­{Ïg޾å,«ÖŒ¤?`F[)xƒU†Ñ¦a¼.³oÏß|`¥uDlöceÌahdýKe­“©;´µë{’¿«…óD..ÝŸyK®°ˆ˜KùWk&¢•7. ¼&O0š’8m¶¯¨!å€Í~‹ÿmÚýÓ‡i'ßJ<׳™ÄËþ –^ñ¯ê0/ŽEc–syÒ¬/¦œûFvœ˜dÆ%Å9#Í€ï9SI`¾”;ÎŽ‹ÁWb@EGoh-žºíâ’Ô¢p”÷1[ì#9û!®„r)ûˆ˜ ”·¼)Ñsš½¯þ4l>ý%ÚÈÎË(OLœLÚm…Zñ?B\XÓå_ dDFop»ÜÍ3 ï“‹”eÍ ÞËØ8b­P!ØŸóþB®t‰„aÁ˜"§œ‡}Ú„y¯@-PëDãÜuV_ñøYØ +‡êÇVÈl…Åü‰rÑUR¡vÊΆ<ä¯ ;CƒÑlÜwÇTJ&£ÝFnéÞ]ïæCò>úÜ‹B¤ù©Ò”rǤu¿ß5èù}Z‚üåA°u,Ö…µÜÌ6i¦o¦!R¼+lê·LÆ¦ð‰“˜­ð“‰ì¢aÒ¦1ãXš^ƒ¶øí‚:Ü®´x‹D_•3‚Þ.Ö.-½Â ¢-´¤ç´öðÔmËdÎþ(Ù‹éê0d}G¼ù0áðç[ó„nªG9{<”‚·ÜßÔ½¯KŠçu¬ ÜÅ[.-P{û²ÄNy 톞aÓ‘Ó¤–5÷ •³|xtòÑÙ¨—TmŸ§û%½°yƒP¦–­×ñ?}”{pn¶ZQœØÀœŽ‹SZ᾿Í=Z•ì§qU¨ÓæâÏÿ(@_:7¤†Ÿ¤\W]CÀ_J¥/þRÞåßê4qUƒ¯Û“ªž¯ötúX§ÀE“^–bP3©Hò,>Ú¶Êåøk¶4Q†t@¡›K"ÞkŸq¹½.˜lAºê°ŠH{(A§ó¬Æ6ÈÓ.@O‘R9“í¦W)|”õæë‚ÚÞ¶(ùUz¸Åö¨ñó‡ÌTÜáÐy[ ²öŒÖ¨ÄKú‹ä @‘Ë×éDWÃý´•ÊZÿ“°Ž‘ÌÅšHß×ÌÓ“Ê'¥XûËëàÏ·»‘²3¯ìš¨'“yµ:ÓôÍöçAòF¥\ø<ø}@*fWRè2›Rá˜(N}Æ®“vÈ ‰æÑNÃůG·¸²×lÔ/ÎÁ¾»ûip—¤V‰u†*gõ³sÆ0nûçØêsdÃtÏ㇂ è<9ºè1¹Ñõ7›®d¬?l¹#Pp-sŸ—a{¾TÏŠW‰•?znwãCx(k ìÐï¿C¯R7ºÒÈ@°Ç¨Ê>ÑýLö“|ù“"¦lW"jò(ƒy-*å[s¾¿½Ã$FLüb°ß’¡&ë,ܵ;¤VE7eNÙ˜ n»z¶tò™½±`vPrê–6ýö(Ô± »šǵÈÎõîZ©„cR*ðÇ>_)8“ÎAÛQO «½¾Fù 1g˜Ã¦.œ`œN…þkæýZ|õóeÀ’h®GÕ¸tÚVq¦ÔÌ •_S/°6)ÁÝsVFhƒ ¯/?®0cÙÆ¬Û".“ðÈ[Ñ®IãÙnsðꢒDTëXÈT@#úûU(j£d [EƒT–r•Mþ6ºaŒ/›.å#†û 4ÍW¼ªòQ& 1ïsòíýÉpâòw· xôÞ§zÊÃp®Ô® rË*q¤+¯á„În¦(T¥7?Hf®‹P¾Ì T~$õyâEÉEä²­Î1|øUÔŽŒ%‘7µ`Å€h¶¢ M:î1yûÈ>×Ú#àþ+~“u¬ÎÎíU±(ZÛÜê‹ZúM#»»€vñJÞ(Hµƒä%¶F*â±ÕÓ±Ðê)¯ŠrùÅ(S8(GdYûžWW¯Š—ìh.\R\/êmˆˆšn>Ðë‘ 6–>|üÉ{w?ðdFžNZKuoº¿g×₵KÜóC áèwñcXñÍ¢  ­§l‡TƒT#/² Ü]OÜׯª€ B‰ E£ãÇvÂì3jnA‰ç"K4>ÀCùö;H¡Ó=¸Ê`ž…Yщ@XFΕÁÖO/;%CÏÁŸÐ‰’¿ŸÒXçx‹'òœµÎª ³q–Ÿë/& : ÷j6E½÷•,œo`î¡¥¢ÜïTË$B%â(l>åÅs•@îM…àpE.uhÙÇÌuäóYÒhG¨ô<@ªEÑ}!}°ƒÒÛ!¸‡bW­Ò !ŠÿAU§º°¡:õAÕg¬Œ¦K;W“¾íÇXšY».±XçÙ,ì1"OÑÃÂR°Oòâ0ùˆìôJ)Åh]«n+ªw˦ÍEõí5ìM·uñ 릇̠‡_Îä –ËPè÷0+(0ñ¬«ªjÌÆjûa½dzÅŒã$HVj.ú§FMHÛ‹©,Ãr\AÒÉÛPcÔ÷0ÖŸ)^bq)|4–ŽbèWQk˜L{Ì”RMÆØ;jÌÔLHÑs³ºákÇç"¦>}kHá Dgã;м ƒ©ž.•Psv¹ÅõóïˆßŽ£3¶©<°'b’“]BónnõLÌ•ý“ùßL[à“ˆ¡¿§aŠŒŠIèàaò5‚qsÑ]inı°é¹¿_,{C'µB´ôñС8’^U!“ŒÝÑÞ hCøNôÃqœÊîŠ7Ø(M³»*ÖÓdRÑ£gà{†péoÒ•¬§÷×B:ÏÙœêÓ4gÛîÞ6Ä£· ¼ºÂzXsÉÊF}®/È<ï›Ã8ÍÛ©(TO}40«ö“Þ ¹q*ªfb ÔÉ-Ö¶?ÜV¶¤ M»:l£“œ®äÇÁÖa2šÄ¹rÝÈ~ê1`õcg _óPÚ±’à8¡†j%š¹nLÓm>èoiµKÆP¦©r £î7ê>ß;v} )XxЬ§Ê%–‘ò€Ô¤ï:w w›œÄD×h›à-ƒçÏ¡ñ÷‹E¹cÆã4=:LOÕú5–¤"¼;&´¿™´Eþ‚­È£œQ½~qÃOJ§R‰±1¢)1WöAÉ]p<7…·~›ÌŒoÒê•íåò.9¹å·gœãñ²h˜;Š˜`¥/=f|ZŸiìí^é,^Қʩ>Ž\P!ͦõ‡ñb®Ññ€[}J¤´gLQ÷Œßž]Æøî#&Û¡þ°oÑhr¶s…Ãý\žͯ¬À Úç%á/Õw¿…‹_š3ð‡ös—AHj—q[ù*Ë8T3H“9S´ ^þ<„ó\¤$ôÚb¾…@‹ù0­S¥“©ã*í! [¬²?œc‡ÓJÕëQø&¥1#¡Ñ öìËà“ªú¹¦^MYÆX%.‚*Ï ø]•©~ë-°eX‚,Û=Ž ?mta2©²›{ÀÏ»Ö@%Ôòû-…l¼—Cù±ÀÍÙ7î;7`™Žo¬Ö 9©-ÏÛH£àRÕN5¸¦_ÍøAÏ/óiÌ–9Î üU”Ëuâ6Õ)?ô½;cœØ¶Çüô#ûÙŒ;ÎB}$<Í8½Á4Ì\XxoR3êÏàŸ½Œ¨£Y¥Œ(mBwÓþ¢ñˆ»,gpKJÈÞÝ÷êQY$ׂyF}‹žï-¿$vC¹hÛÙ?|2¬ë[0ð25,Bážl m¨ª—'·+K€¨… ~ìXzKGÚ)R¯}ަ/,´Ì…KŠvÿz)5Gfe©vL«óÊE@M:úJKýmÍ¢r{6(§ˆ›Vn„­Ï ­hrøÝ1Ê—¯ÈÏOhÊfÕ…ºß¿TÊ)Ãp 5ÑàÂDÑ!3b !CaÂVüÔÝÉÈ„H=¤¿I;à ¾FÓp/ ƒ:ððÔò%~;ÞDú2H§ð3Aœ§ÉûwK `õýÜòÜIÚða¼(kÁ¸á$‰.–B^yIw/Q-F+·¤†@æ¤% Â͹2o44ŸõbWâo²Ó 9>¾@t>`;IØ.» ‘GÐð869¦ªwQ~C­GˆPüÝs µjœ×2Âxn×küDu4@÷•âÅGVõ#öÏ…E¼;, ø\K2ëøîBJ‡ªÓ³Ýþ`}¢¨ô{¬%Ïb²B„zA¼Ãck÷î×4H½Úå÷×—!÷=ñÒ=äp !®îÌRÿÁ/ÅL±…uByßS®{öÅž«)Õ@ ¼¶Z ëXWóŸqŠ:º‰Å3_Lýð­(=´ÅZlhë' OZØÐd¶w_Ó³'¼ƒŒ[5ŽKˆ„®_t]³OìFTy!›®’üZéà¬ù-©Za¿—$°²[-n¿¼2.óÚ ¦„¿úŸ°g^^ßR"?Íu5ôTéˆzoñ®#…¼¢6 ºôÕí*˜Rt‰ás»”É=?̽-¸h)³”OkŽtÞ½z8hA.JuÖš`&×uÑýΰîÝ“iÄqvL:Їѿ¤ü®ú®úÜË£8¸}ˆÕ®^ý‹DÐ'™r<¤!EÚzaÃÑ‘ íµ­NRÎ;åîZ–e£Þ8a}c"8Ö1¬4“u2Ùà%ÑMR’ƒÄbdmÍÊa4Dñp!r¦¨µCä(tejÆÜ3ÉàofÒ_^- |WˆEˆ€EâÚ u ÉÉæÆyà#‹6&×_LáËO¹j–wâó##*ÿ K~’o—€Ú‰b˜Ïú©'"•¿,ÏS Óqй云v‹|ö[ž €v+*ðüüƒ (™YaôÕ 9‰®nOq±†4àû“¶p&êÁ‚Ž-¦uͳ`Ê¿qÓg–ï¤ì“e¼<Ú»Dkí<ü¬¢ýÙªÍ[½ìG±}z›þù¢j`¶fîCÁ×þð™=VǨãþÍ£GíU Z‹‡Û„§(ÃI^õê°ÝTtá`HÛ«ŽxŒcÔÀÑÖÀG¦²Võ{ê‹àRõ‡¯ýÑôN'mÙ‡ùÛcÆusUÙ 'ƒÂµéØ ™¨ïnjò²òïy±pLU6DÔ´jٛం ±M'·àh8g†„–°hûh­U“vW=ÙŸl“¶â„¯_¬w]Z/ë1Bh>ãô~ù¨Iß w׈XZ¢è-¬†¤¢”k=#5¨ïé­ó!å'Ó2Ùô‹ëÅâÎ1:­KO?ˆ@ 1éL9ÃlÆêW”ÚONªÊ"ÌEƒhüsË/]˜É+bLß¹ÇÑů? <Á®àÔ>ݦ:Úœ›EdÙeŸÕÁ¦"i.Š®FE¢³%– Ô.k.£Ò*B”@³XšÒÑ?z¤˜~ÅBp„O2̰wp&?˜*ŒsFË«nÒV W=ÓºË=‹°!Û¬>˜fß¾9§› ëS*Ø)"—öUZÜ n(`xhgÌÀ•-Ô$B,<[É9oꬼӆ8æ»Ôh^ݺuv¥KÝÉFd®çöίœ/Š´–ŽØ¬ï×íPV 8+³¥Ÿ¥-'9•ÃÒó˜t<&ÄÛàsK²¨&Ÿo¦èáuîÉ‹q­‘ˆœ>ŽGÉz`Š „fÁ•¤-G…æM’õJeÛ-Æ+ž3^kî@®öbç;Oe iST¾¸)Çí—ìfœþp¾ ÞG„–Nî0a^«XMU©±äù¬8ö­8B^ökc56£ Ôú ×»;X]ùþþ»V¤LmäÏ®íX>isèN}ØË52³gVø7ç>bŸtA®´¯ŸÃ˜S4\)~çúßQ ÕŠÅ\ c@‚2 ÕùÜl(>'J*«cJýãÌVµÄÁÀ=ÿçN sUî^/’ö-o]dØ®dÇK‰ik!P6~¾Áõ¸±uØ$%/EÉÊ}q%_R½¶WÍïpÄÙqÆv¹‘èOy[¨FœÉ0JlvM§7ÐÇær¤™ðcІ U|M¸”bdý»â \èWÓ ¦+ÏŸï´žnŠìOÒ5(\[›e5 µ ˜pô.ŠÜÝo^ˆ˜È,:ˆ¨D§¸`INèšhQŽì¨_ñèuÒkúzƒ®ÈbBˆŸ!ßüú@)¦`š( «m °Þ¬Èõ0=#´ü Áöþ‡°++éy'›Áæ %þr¼*pBPÇú(ŸÒe~Å %Õ-©\ ” » h¼é›¾Cmç¥p]ZÐ/M@t¤?‚ÑrG¬«¾&mÁl?§nìš´JµbEË·t´Z *ÍüC•3“q-ÞøNñ°7öèƒñióò¬¨ÄŽ–g×ÃZtÆ´PŒ¹aÂ!’Ìôoœh£¤™E€Û ^q»\öÎü4ü% ÉIpp‹y‚@c¡S讆rýE¤šÙ,Ê×€ªµö$÷é vÞ(³«{å?U]X$+ÁÙ»?u<7ù8SXÂImàuŠžîT ¬%Ò0ï ŒýŽ¢[Q_Åè/?»W¡ii¬·.ˆ FP¦´©+Ä“zOІ©o5˜b:ÜRzLÝÈ|–Á±³Û7A ”ßçNÅ 0=Ièïíg Ÿº¨OòV¡4VŸY]c‘°ÇÒSÆãO4J}]E0Âá]”Ë zƒÈÕ¯¥¬' z]Gš£cð_Z¢ÙÖ㢜 ¹Ž¤3Sªd÷ÊuÓ{FmÄ“M‘g…û»x«8‡eb9Ò›«-§“µE]A§’n¥g—‘ÔtŠ~€ôh`ãÏD-fÉßÈ92¿”JDűLUÆP=ÚÆßbÆïûéY}áÇ.ç·,¥ºÈk¬*“h` Ûp´%:^•ÝC…Ò`U†|CÝ€N>AN¶öeÉÈuwÒÕ¹n½Úr>¥GQ¿ƒNÒIBc»fÑ8¯ç­à™aœ];ÿðXøôA|AÏÆûsº ™ðÌ%‚ªŸ¯«i(‡µô×GWøÇ‰_6T1S_Ú‘!ìpÎi‰˜ã¡}J£½²6æ1ÑA)|SNm›ÍcC»‹±ÓK¿è$%Ìÿ ¥õí“hD §·²=É÷ÜZ¬Ö©Ôq¸ÕÚ߀SÊGv5ãq´˜› w. lä=]+lrZ†— ?žŠƒØ°‘aAÉe m“5þ–(É.à¾f'®Fu`ëb³ìkÆñ¤ Êu/½ õ“maÊ(.I\)õȋĵU.„/-G ,ÔOjÊŠbÒ¹óP¸çòüu¸âÂ=;®×KŒÀù !DwéÝ ‡J  i>ˆZÊTê|ö ŠBõ=Oþ CÑ,žÉÏÌo‡ÇéFÜ1ýYFêðgmÊ3?y¬Ú˜ R…hW5ð°¤{Ë ãÆÂ6A¬Îê¢èßگǴ^J4IŒ »ýî°Âë¥SÿëIª³ÃZ£½™F+Õ²ëx‡Þ?ÿa(Ì]ÕmŸzÞ$²pÖ5z‡È‚>6ÄØËT+-ÌÅþX{ÿç_‚ôôÄ÷áÎHmÉp]@- T(BQ^"ÑëãìÒ{7y1Û54Õ\·<‰¯ÈAž¾Nä¯içÚ‰j¬=:¹ƒ€°S÷!ï8 +E•'ôUN †€“¢1¬m°hp>Ga‚¯- TiJïýpfmÐ ªºàéùŠ—)HàÄ‘uŸ}ðê†$¥ÈAØN¸‹OO„<\-+Qàå«É7ïýï!ˆË?ÀSY•ºëÊa‘ ’XÜ·ÞØCæè0'}¹Ý_[HÙ!ª›Žasë¦ôºíq‘ØæTwxö¾›¬!"-·,"¾×Þýwˆ³êOÓÞ£PY=!Ù›½ÕÒÉìߥVpX½Ù’Zäc_Âö+ï4ügŸÛ¬XÙ*¥Åä1*~±¡ôlnBRÉ=©ÄB¬G™ám¾×“V¥\#ŸS‰O¹NY@3­)Lï šÐêØ°2ŠfF¼aìÝÅ©4£Ø[cº£~Ú¿8h\Z¥w”|]üÕˆÏÝ•.«~*»‘¶<ÒKæ±=zOc ªG†Þ<  9?}!…'¤òå¹4Ú¹¨´¸ ï¹–›ãoì¯È™U0s|ù8U¤s/òò‡àzËÇÜ‹¹né–’°Íteóüû=‡ Ñl~]ºœ9‹VõÔîx)+[$ „^DRœª &-{?»dX(ÁF#þ» >/¾>ô·ï‡~gwá¨NOGBV-÷ ·‰æÁÈaüö*7ú²³mJ},'œH®vÁBy@` ÉKAÏh£]¾1P´-ôøÓ:µ:¤«èæ&-y¢â$ ùä>v„øSßkpÛ ¦…Î)ƒRf@³•€ÖpYÇé2Ê“‹ET¥ºÿ~ÚW…=Ìf¨{I@SóxùãJyõ¤‘§¥@þÁ|çuªîBÄKâãÉ_wÂ@xßg#஑="/¸‚hüÊ«8£ú>‘ ÆÖ¥ÆÅâ@t"(?üÕH;6[¥¹m¹M>²àB$ -ý›»ì±ÃJ[„k©o]ò=™íaÙ$·"3x à –ƒºb¥,õɇ)ó °~pÉÅÊw°Xubf©ñ£OšÔ+ã5[†ÈRYôé#ÁÑ.ÿh•yBÛ[ÙǨ¬ía€X@Îi€Kå'w^cû7‰5¦Þw'{ðždcåò—W_yL0pEžZè=ð]@}2©EÁÝ.µ[5{ÂʽÍ,3äZ!ïY>t‹[ìçk3 jxþ™C¬æà4Á†ôÍ-Ñ@È®¼kC8È6ä€ÅØ«tƒG¤hUÛ¤fk´Ÿ¬ )‘t±›#G¥H¸è!æ¬ÿÆ/w¥ endstream endobj 3674 0 obj << /Length1 2119 /Length2 15743 /Length3 0 /Length 17012 /Filter /FlateDecode >> stream xÚŒ÷PÜKóÇ #ÁÝAwwwwwgqwîînÁà‚;Á=¸»ÃåœGržÿûVÝ[[µûûÌtO{¦{v—”PA™VÐÄÎ(fgëLËHÇÀ–Vfd000Ó100Á’’ªX8[ÿ;Kªtt²°³åú‡‰°#ÐÐùcLÄÐùÃRÖÎ åb `d0²q1²s10˜8ÿchçÈ1tµ0ÈÒ¤ìlN°¤ÂvöŽfæÎþó 0¦0rr²Óüí´:ZÚd Í6 ­ÊvÆ@gÿY‚‚ÇÜÙÙž‹žÞÍÍÎÐÆ‰ÎÎÑŒ’àfálP:]&€¿’ÈÚÿ“,)@ÅÜÂé_3Êv¦În†Ž@ÀÇ€µ…1ÐÖéÃÇÅÖèøP–”ÈÛmÿe,ó/À¿wÀHÇøßåþíý×B¶;ÛÙØÚzXØšL-¬y1:gwg€¡­É_††ÖNvþ†®†Ö†Fk7ˆ * ?Rüw‚NÆŽöÎNtNÖ%Iÿ×2û,jk"lgc´uv‚ýKŸˆ…#Ðøcã=èÿs¾V¶vn¶^ÿES [Ó¿1q±§WµµppJŠüÛècöϘÐÀÊÀÁÎÂÀ:€îÆæô…Pñ°þ=Éø×ðG>^övöÓD€>¦ÀX/'CW ÀÙÑèãõωÿ%XFF€‰…±3Àhfa ûgõa é¿ø£-ÜÚ È`øëõß'Ý"3±³µöøcþ÷)ÓKÉHjHÉPÿ'çÿÎ Ù¹¼Y´L¬ FvvûǃÏÿ®£`hñoÿp•´5µüµÖ_z?6ê?š]ÿ]ÿnJÀÿ.&g÷Q½@ÅŸb×a`e0þxcüÿ\ò»üÿ«ô¿Vù/öÿ+IÌÅÚúoŠ[üÿÚXX{üÛä£|]œ?ZAÖî£!lÿ¯©:ð_ , 4±p±ù¿³’Ά-!hkfýß½´p³pš(X8›ÿ«fþ5®úW¿Y[Øìœ,þºb´Œ ÿgî£ÉŒ­>®§Âü×”¡ÓGÇ9ÿ}Š1ð£§þW‚¨­±É_ÍÇÄÊ0tt4ô€ý8ùbý(„.5ºÿ]Úz:[;çÀGº>S;GØ¿N™@/ø×пˆ @/ô‡Øôˆ@/ò‡8ô¢ÿ%v½ØbЋÿ!&½ÄbÐKþ!–ZþCZ¤ÿЇ™?ô¡Eö}h‘ûCZäÿKZþÐGt¥?ô]ù}DWùCÑUÿÐG<õ?ôAó¿ÄùAë}Xþ¡eFèÃÏø¿Äòïã¶´ùcýWЛüA¦µL,€Ž@§‹óÑÇ~ÿ)™þ?r2û~1ÿ~deñü`õüPkýükó?nzÛà‡ »à‡ û?¹}œ–ýG‹Ûý#›{ˆÞñø!åY1~x8ÿ?”¹ü?”¹þ?”¹ýcŸ>”¹ÿ?”yü?”yþÿÓ*Æ.ŽŽ½ô÷÷ÑGÿá¿¿´€@w 1ìÒ/;cî ËïAµ‚_Ühw'x ÎÓ4˜h' õ Dgô·”³³–¥ËÅ–úÅô,»ä„rÖ®½~×4x°Üш˜Åýz¿KôºÇ%ú…Ô’¯ž"„ÏUâ8¢€‰Ü Ãob6 LŠäMþ½o1Ñ ½TŒ]*¸C®³»¶4K—Síd[ɹÕhHe—õæ3yî¶MlàN”Nxª\‘4Oç#l‚[ òæÏ‘¡U”~¼žH)×€Ý ’gQî!\¨µÕÄ—Ü×ã T/#q4c“r´]o €JmCmè™K§ŸŸ2X4ý´ð¸‘6Òð)Þp†$ģⓑbKÂ:i ª(¸ÔÅȾy°˜–ßþ¾GM ÚmîRe¤‰Gé®—¸ä&|>V'— èfóÒ§HÛ&Áól9pn sÁïvþ‡ˆÕt†_(ïû8Žd ‡ð6öYpûh‹6Н¯}){0¡= ]_“¦ê KqV,Å:·šÅÜî0u¹ÞeDõ‘“†÷¸æï—Å5fóP`äªy®²vñ<¥óx)«˜œ?/DkBWN•Y}¿‹ÊéÝêF~ 2F¯9Ñ D;—ªœã‰rŠlâ!Ò2 ò’Ÿ§¿»…а pä.1LK3GÕ}µAõ­ô¤©!#5ý–ˆM'â†n…|h}o]Û Ê•8"¦­0.Ó¾¬ÞÅzHʘ!å >ÑóÓ—(ž²¬Œ“Pšfú /]7(gxJ,Íó»b…èWþ¢]µË|š1$}þdf¯‡fžó• BVÌW”tºêŸÆÌ_¤ÒpÏz 7w66Ö¯$ÒÆ‘“ÝÂ/-^úº;ÏôÑà'iT +Ú#0ÍËb™W7ývkX¨ÞÎgÛ(LYjî92r<±Wí=d“޳“n\\jS<ƒGCÌc5u†~›ú>&ÞQ¿ÝU4S&·?¬ ¸XE¾8ó–7·•1có1^[µ KÛÊE±a‚Ü+¶X°†³‡hÆßXîÖãq<ÞFŠs\ú¾eŠ_¶´÷¶±ðYî1¶6U±l+Ók:Ge®2æf™ÜÑ0ÀXÞ²t—Ì/'Oï-†¬ { Ó†’.j|S—ûÎ妸¢ôæ!,/d$ëªi¬m’îî\PuOÍÕ…ÞRÁ4‚,0Y˜¶0$ (ÝõD&RiеwÖЧÞí³ú-àŸÚu@]î”»’°¦þ3erM²Fö2C]£U©õ ¤#‡Š[ ÞÙ0¢tl|öPÝ€Åhóé÷Æçéý·¹.t…öPzƒÆ!ï“´üûj×Ôw–h ‹*®>¾y>‡¹÷¯~àc(‰(N"ùhÞ6CfLÔ Û=ÅŸ5ßÞM{³a¥f>ì(À"DtRègª :!×þ^,DrÚÚY~*+Ì“jgȱÜ=ú6¯T6¼B5-Ó¥YKà>öšÓRÀÞ‹gLðùùýt¯,KÍ\¼«(Ç´ÂྊŒJ‰/hµ®„vCW›¬¥å¸‘LĽ¿ã3Là(A ²*iè6é·gƒøHî±~€MökÂãZóÒH|Ù,B¤¸î]™¾ct“þÎ)~Üiƒö­+\,ùí{Õ¨…Ç6‚ª7 FˆPhâUÈ+v†ÆN'å*Qxòýsô ÌBî õ8ü+ [9âêâüK›ß¬Œ%aÄhHþýT/LH{Ú7XáÄmW°@–Â/i¶š‰Û ç8^SÜü²ë8߬i?/2™UMe¾ËØš´D’|¶¸«ê, :*ƹgsô1R›h!{RÝ.p$Ò­þ Q(»4rgúE¿/™l¦Hcëô”=²[©¢Ë‡^jŠ%ß~#tH6EÌØ5JJp«õìv‰3NU&pp¾$)zÿ—è~5ÉŠž}ÁK`j¶“ð·R\Ìr›¦õ¥~e$Yi‚©Õ)Ò®U°AuxMpfFýøäÔp;¿÷lâ½?×f¹·ù[ådZƒ­°;¸¯)kÃ.TÈEìÎB¾›üä¾²¦í¤[C¿â7§öèaÇæ$á]a"snÀìè²®þ)í(ôÁpóCÆš’R…ߥýIh›ë ƒÆÒ¥“ë§É±Ù^­v[WÂ\ñ¢ÐøÑ"ØiÁryê*ƒBïíXÛþy¦=;BºªâT¶óßI”ñ’¢DãU/î¤Çàõ—íЧCˆfv>oê…ÕŸÿ‚ú äŸp*6sJCð2ÕøgyjÈmVöZ¸?&§Çx€UH"òèÝS”Ð ¢Ô±µ"|~åšjPy²q›“pQE•h¥… Ü¥T§}8‰~.®0ígñtÐF ¡çSˆIC¡z¢ÊXqøm#Ô(:´w8¾|òNÚ׸­‰È×eö…‰œÂ­¤¯áú¹ ¼ä—@½½‰uÛ“œ ué°ˆÈë:Y¹4žƒ·/tú¡] Àå¶Ø®yYæÛÖ‹Á&»ZÎ ­eF&ayjlîûûÝñ‡‚Ë‹¦Ééú˜FA>*CFÐè¿ÈK^'_BåBùNhojoaÝôG¦Ç~2[o•)Sê¢óM£åã—W4ò·ÏXÑÀÓ„q£D,5¸$iÏÁÓ»‹¬(EZÔÊbYw¥î}¹³‚Ùñ¹0%]‡¯Ò?~ýºHèf{¿ˆô5„Hïš½Î×]œIÑ.q –‹0¢FÙôVÊ´FÓµ#`'½È"Œ(¸Ð@§÷¼9¤^’&‚9hAyñzA5¶°·Ï[ewºëkÁˆÕræ±¥‘?Z`Ž8H×°¡^¿=Ò,6¤QÃáð(/ü›m–YxY‹V…Hàá(¶Îã‹/žÅ¸YðBÑü‰W»Ý_[½¿965tEêÞ~3­˜-{:|ìØy!騔Ñ£o7ÎË«¡îÆGI›vƒýê™=?9»=VN8†‰?‡Z^±hA𤛃ÞÀô±µEºÕÅs´D˜•ýk³°O óHFvʯ½ŠsÛßùR%$$Ç4è-§– PB‘:õ‚ð²dO"n‘‘åù¢$Ô”}ú깞hÓ‰íj/4žÈ&ãÃÆ? ÒT嘕´ â”ÝX2&@‰;†œ¼~Üo®`'×ÞÑ,FóõšÌJ:Éûe‡t•±¾yá\öúgíX÷}ö:¾›Kéç q"¶0h^|¯þdï:eê ä¤E37d8õXŸYâ¬D+ õKþv®C3* qE·+GFcfTÏÕ'÷)Ræ¦0MHÑ}ˆ¼äÜ97«-¦€¯‹¨\keôšê9j&“Ú¥ údï3¯Ù>mÂ%´CNÈŠ®º›ã­1ŒWnX¤lª`‚Ó,ÓJ5y¡Ê,ØÆpÀß®²ú :Ü›°-NÌÎ~*°±˜°ÒêuÆ:´W¹¹„n¯³^Üù’uðw6áÛ9Ã"¢]1¹Õ9´S³òDÈ”§µ†ÇûÐAz‹¯qŽôþ¡ e';F aßÇVù_ÃJT§!5flÄÒÀ «äìÈ&(¹ýHAÁEtê„Èš/´Ô¶XñuI>f®Hü¦K/Èßú­'ù@(Qg¦< 0ï3p¶¼8ä^…¨™¹ó ƒºêXÛU´ßcjbI„’Ôú<úÉýïøB‚=aÉ5ê½J÷–K_“ô^3ëëªáºê!ÇŒŠ“ YÂyû¨ DPûŠc¬¥¶×ý³ åÓ26µßÈ ÷‹-a†3CuöKv3_} _šÀö-NÝž@[U!¹Tª¾GÂË=ìų.¥Ä†ÞP”y%òÉzƒøA]ãÜŠ]^–Q Uyï÷¤‚% à)7‘~]6!¸~²ë>„c=! "JÈwZpm­´9•³`Åu€µ±KXYŸÌ¶tMiˆ~ X'ò†ì—9…$ „ËÏKÙßdG­ÐbëÛ oêSRIˆ=T;U%Šå&½çwˆÄúr;» {a’´Û°µÉo¼ßüÛA=fOHnTÔÏ:D8Š'… Ô¶Ù–aø)eNE*¥g ¿TŒÆÇ¯rWEÐaªiôUðj¢f½^ñ7k¸8›±®Úâ}\ºgqŸPSŽg-ëe²ã}£Î÷|>úç6™òq…çLèïB¯¤M3ÊãªoæÙÞq‡z3›&Rô\à+xmrsÚlâôÜÝLà; óL£j,Çf‹kƽ|.KJ$À\ÔÄÐòß\~Ï·UÌxqþM8®>hYÏ”‘ôwö“VhÓ…ŽÕá?Px"óúƒÇ†öˆ¬d*ûœÆ¶µŸBñæñ%¿!¡7­„ÔxÃ_ ¹Z«Ê!ájè0FQ§tß'J ‡Ì8ɬ9}È’ˆ7Bûo»º¢t2å%†§°[¤å—õßç¼u¼~ ƒ‹ó†ÔýhŽº^.EdœhÚ 7e]£Báu¬¦¢CÀSI½Tuãòd¹@¨If°A ÷’n 8si×âå QÛ¶X˜6©£e}¡¹\ûMe5ZÙv†ÒÛtÛdó]“€ëÇ\¶Õ=íÄ>Œ|¹Û·Ô€}Úc/³S×ü”â×h¡þóŠo„úKqÎŽÝ•©F æ6Ê®­c·ëûs9£Îî7l *=]Ó¼ñ>ú©¼;|‘”ù0ñð?ŹTFu•½‚Åê`¹CÖá± ”„xæã˜x5#T7WR½ ©µœzõÜwTd¨ô“ák43ö« Ò(å†<¾b‘«hûk¡»fÁìVyÔûÀJÞë ÑÂÏ·h<ûQ8ˆ 3š då§•ùw1K®êÌ:Íú¢Ã»ú^‚ù“F@ãj`“È‹o –D 0± ³?IÍZ•kV§ò¹›nÝÎ ÄôÉ>Óo—Ì=q)² ™ÄònV0(µU@ YMp2ÑŒMc°ÎÛ°â0ôí5{è'Oòã #ßýë¼èˆÃ7 ¢Ž sðý‡ kWá­†Q¯ÊøŽ„މÃg­ƒˆrJož¨É”ú>É·Z/¶)œSÁÔ9«cË™ÉaE%.BÍ ˜‚Bsµ÷# ^£Æt÷æ^Ù½AÏæ€´RÙ]csž'±ªI¿Æ)š!ž½6±_ü‰ –„¹VòTŽlŒ¶¼»fŒ—éÃaóç¬DaWŒÕzMë˜oó}3Ì‘ä? ©ÏÍÌ„Ñ,Ƶ­]•½­ss?]1Z—{:ñÜkÒ–™½Æ0‰Æ/D}kÓÈ´‹}»|Ñàï¶ë® éÿ4t yÍWpÅ æÈz_E䙸Hy?çP¥PÞ#߬!s`Í Ã l›æ&9c’zõ\º]úm Z /©WouZñ®ÞR®Pšž[‚³šò«.y£¤Ð8¿ ¥‡Qj)½ɦ¢r¬¸%–¢Æê[Yü¼ã‘„Ÿ=-Qc|ùD z6˜“Í"ŽXZ⦳/‹=³ZŽ«à‰Ãô^‡„‹Ìû§&ô3ô˜§]7V :ƒ¦`Ì݈8ˆ g­õœ&z‘X¦_sÛÎ.´n¡5mnq/\á¼þ6þ^*V½°ÿ È=z ô›™ Ö²ŸDÒ»ª"«C%_Næ¾¥F‹¸V³A¨«Á6—÷¦Â4öºæ´ß¢yÌ>s>¡àúFÝ.¶*Ù†Îð½»êŶs…"ب dÞM¥QÄÍŸ»¶.3ÖRšù6Kð[™?‘ºý°,æ¼ív™>Ùö‡Î"gà/þÕ'B¾(¼¹ ؼ¸…§x¿æºVo™?=Pò Î%ÄLJœÔ5²åSÉWÖ ²QJÑ\¬¨Ë-“¡Vxh&’þEÕ•%ʶ€÷;È÷sfÆ‹$Á­¢‰³ýïüe¯ú.ÊhÑD¥ô¬ë Ò‰Ýí)_©áæ[‰z|5]í·ŒøG¾ÓÃv²GÊOÑ8EUVõ‚?_róÝ>åmG´z‹âÊç%™CÌÈý†¾Ö±þ9ô%^úûh2/ÈðˆåŠùþBl{Ñõ–^Þ­ô­úÅW¦õ J='xÓ”Á©‚½:s`a|B“w]Ö×i†š°#IÙ—h‡(ä§»Ïü&$(¤¢Þ ÄÜoÒ-˜æÝB½ÞßáÖ[x’œ¥˜Àl‚GÖ3ëµbÉ77ÌSã‹Ù;¸VNrH¬gØW[]ãR¡ë#99F˜ÖBÏn™k*߾Р!ýx ‘ÓÛrbmø•à§=ÿÅõ'£Gñæi7‹QLn“i¸’o;ìjKcФ4,ùò2D€[°a-|hóBýÙ²aÅJÛh³ß¾ñYí¯ðXe •ª®R4î3ÀŸ*ɲ+ýª(ŸM<šs‹Þ­ÈŰyåkQ°óôqðɪ PD|¼TIG³«È ¯G£å³ËyÈ^—ïp/¡Ãàðhý\Ócj™·©Ì·Ÿˆµ”—™[(gXúÊuhPRŠïsȨ$Lõ ÊãDM.±bЉö¾‡ þÈzˆn·É2Úëçd§¥¤W†ó@8m›qŸcƯ§d«…8Šs"´’¸QUÆ~1ž- I'ŒÐŠî_ Á8ÂlU6YØlúRaLèüE>6ûê»AùbЧˆËdáñ€8½l˜…ŸX2ïQa[.¹Øi[±ˆ}Lçæ™ì N¼ljcÞ t‹¹Æ¾{΀âó8!˜B±l›¾WmˆŽ‘sÈÎÃE{Ôeòû.Ãð¬5yy¿=õ*É ¹jGÇV*Œ`|žÍÖ×vFžàm…é#ߦ¸Éxó…ó™9ñj`Ê“³ŽÁQ` …[šÎ½4~²AHÚUgœ DíÿNv§aô³¹ÀÉÐ´ÖØ)µãÛâ÷Ï9Ì%³n…nïŒÓÈ÷¬ê²´ ü"–÷ïß! {Ü·8¬Ü(h¢MóÌÔŸEÐû¸ê†žmÇ Dž»Ÿ¶·-bîµÛV¡Åè‰V¯øÝ—ŸÜl©€ýyæ}^@£ß|öòÛ¨zÐgbĘëpy ¦>`ÚÏ&ɰõÖb%Ÿ‘¥UÖ-fX§«Aɦ ^Ɖó!ldÁ¹(€gÅA®/Ü„SD"ß/S“Di u(ƒ œO¿côHåÖåÝþ2î÷@*6`­wà½LžÆüzç¾#w\çÇ#Åb›h¯œ¯:Ð$jv¾€úÜ´Åö…ÿÛ§’Ä ÕÖçίàYþyÉT5W¼zMô×]ëÏûŸZE*<Úñ°AåÐ8¦{v#?W#Ç:Ÿˆ­8ù뮑A#à5¬¹”ˆÔ¸ö!yáË[V(xP˜Zj•Å ,è6eå¾L÷ÁAmËÈG ‰³#Líé=-4»lþê?û‹îÎÜ£À3¨I}qT{ÿ)y—øNâµLˆ}•K"dŠQ]/µ¥ nܾ{¢c<'ª9—¹~ûë´×ÿÐ}_wGdì5Í"Ì[:¼‹È@~ÃÁnªÄ9ÃP­à¸j€Û L¹»Õr|µä×fr\-Ÿœ÷»1) Žr–rä¤iY#ê#…ˆÌ ´ÞM{b:N +[c#Mé3H —Ó-Aóˆ:ŽI¾Wº¦T÷ëo*º?]o{Ð7¨å´tÔçÉôà ÿÐzZÓ¿«\µ •VãBvXm £húV.{ác÷衜K s?Ñdøã¶ä t¡@U7ÐHuY"—½ì–kÃÆo­vRÔè]РëÿW³¼F>RcähºÛ©ßF’hùÌ@âràÅBú”§Ýr 9u_ñ¨9V=×½ŒâBþ])ÐE%RHGXK¶Ù Ì(&//Ýô÷Q dZðú¿©pÇn¹µ‘5æ€Aâfîç8™ÐÅ‘/6:ÎlE¥¿B 40{AÒÊÞ´vŸ·-ëJ³Ö±a~Úd&¦üo0s2x˜GÜI|”Ëÿ2d9Âþqx(.ÕuS! «Q¿pwÙæ³òƒÇú+›(YbT±/ìQ”_„ƒS•j…É3o-ášDLNµBÞٱà È}X;Ýã§S|ø ]îyVDÈø”$:Á•ŸS”·#_hç"OÁÀüâ!´NmmZSH,i9QšÅöK!uFŠ„"½=èŽú¿e¢ÎÅ¡v; ¿;yº‰° wêök%÷ùÁOÃ;pWÀæõô|–ÈÆ8"×IéÐcZÜsÒŸ¢pøÁ|ز èÓú¤^=ë!N½´qæÌ‘‚È#zü`Ý.=u9󹋅4°u{blìNÙ% *¸*3Oð½êkˆª§ä`b…¢/³¶s™òoeóH¡4œnöK`¼Ù@‹ªôÆúDÕ7M,oÝuxílšx-^=>%ˆÝ¢„¨á Ô¯ýi¨^Š_V\hïT^š¹Sg~;¥”ƒ§ÅMÜ*óu†"  B\{W÷CÇ‹˜Uû‘_§wȈÀØH%KÜ[w(ªfFIM³õHè5âÝ8°–ÜK‰Ž„×0í="èÏ;ØAÛn›'¤{3p+öĤ”Ñ ä¥Gf3­ö·"øzo ©æË+À' & ¿Iµ8ç…MšF>iÕ–]ÏN«VŒ_ }af,G¥IÇì6Ñ 1NÜÌ+äd:‡[E_/ƒT¤%íÇHa¸Œíän÷„z„ ¡„%ë¡ÌZ™ê@^ÎrV¹ÐHv/xº¬M8JKW{ŠùOljž|ÇòXê|0ñÕ `]bõh| ÔµC 2‘¹˜'VÃÚU¢Ró´Ù\e¦ý-ð»{Êäëãõß#_J|ÉšâdÑ`&±Ìò¶û*²ÁÇ ›§c»k ‰9%!Ì´dšÍÌüÕî.7}äÜSËåx²Z ˆÄçó cG©/‘Kà7•Va8F.ÕêÝ$°{Ïïzæ^¶{ÝöZ×–¤8ˆe±ñŽ-¦lòø«ÅKû#¥åd ÛæS¾2Û‚Ùç­#·¯Ý½+µ+”É9 àÃ)ô£`3¸eZ£)-欬@o‘|¾Â2|M™;ïŽýaWîTFzA­=«Ù.š=ÂÇX B=;箆îh^”db •x%Í k.ÜùY:­Ú›Q±.8ÓÊîpYzúD¯&’Bðò¹Ì /m”œA?îy.Á¡à$ ËÍ»qT/^"mÓ%EìG=¿Ú€éǾŒ›O"AvÙP{³Vq™‹m¼9‘è9jV _ø_ naR|¶ÖÞ‹­›Ùtgm|´Á|Ž'ÃxgOæZ*Éj+·Çý¦¡ùÊÆí¥¶ž Üùv °ÈTG¥†8z’Sýñ©ô·ˆ£ë —Eæ=8¾$Дn6LI,ZÉt½>dŠšãƒæÊ_Ì~šœ='e°ûn™ç ¡1õ(t+Ÿm»5BHc¤qçñÞ+ɜĩÙÝ:ŽúkåžQwŽ;'‚»¤‰2ÜŽl…‘¦ê°Å=2“Ö÷ËÊ !T«o niÛË*²Ö¡x˜2;g"í–¿5x* eë½Ç*÷}_³?GçÒSU§5¦t˜M½2ª$ßëÉáFâ_–²Mâ*ï×ó&Ûo—ÆvR,J-ÊÀþt-£eG(^{=¼’¦¢ 9úqoFc_ª¡uÐÆ‚ýõìé©1F»ËôRNø; z)h•­/‘ªjÚÁOoÏö!ãißÂzç‡Îõ eè+½šá11—láëQ\òKíT*}¥©g²`%Æà þ””§Dê©‘ë×½mw »¡Ä]Q-šÆr›]ì·œ1éÈÊ–æÜÏŸ“¡¿²‚=Z%X!Ò­D߬ßiýúbä3]µ’9‰Ÿ“ÿ#[fº˜Û&M9¯q5{)ÕB€~”ƒi>._ƒi‰ëÑTEÓÉX¦Ü+UôèóæQ»’HãôÈéjÓÈ2 )Àûªš³Æ0èÚsîrÕ½®ã"­X¦£!âL1𝠆lpÏžŸ`eSäΘyƒ!D³½›ˆÝ=9¹<­„Hrþî󉇊ôénðÅVÖ—­)G“=«3se¡L±ïã júÐvóÒ³H½zÍ‚ãDÖËn¡Â-¹¿¯¶£öhOC·S3‡0Y©¸¤DÛl¼ñ Vxï·®Òñ¨~¶L ÇSOÙ£°¨°]f|ñl¶©ÖÏ®‘E£m¦©­÷D9ØÛ\G­¡é·ø_¬ÈžHw6Åx¦t§‘—f¥K~Q˜îå,;KSƒN¾ãw~eÒñO#ÒH0|…öK ³þ¾ö±3·C⪠g—L¦R6gŸhyÖ¶I/ß1¨ 7·á=ÔѾ†múØÂT¶Ák¯xfh|%P®Éà̆ ®RÂn$!Eÿž²AÍÍümɤ.`#uà´Æ‡TälÎSw“­{ª‘3Î~jLæ[¦ÄÉ«¦tÐ/®`Õúù*X¾y>ö ßÏü6ˆ4ÒT¼DÝü¿I åôñpë‡ZƒC]±=ˆæ­‰rÕŸ¬R&õâ º9Ó7Bæ7_ðú¸0ˆS;_-uÌZU Çie+²ÚnÖ")önX޹ž¯Ý«RkßÊ 9f=,~6ó¶¦t %Šdý²˜¯))ðÙ-|>5·S‚g_|ŒU;È4Ó!à&Ê1¦ÍÝ_Ï<ªî}¢noGò­ùšgöv'AØ6Ài0möÆ[¤æŸƒQS%/d«)S¯÷<ß¹Š-Æ]≖oi,ˆ4töùwFך/y yjhTãÜ`#ÅÑLÔ(Qͳaß[hÝï!< ÐÁŠ÷xÂȳœ¥†X4˜¢ü€‘µ*dSÃõÈÖ§híH(QP%PXIÆ­ÍÈÙ8O‹¸Àï‡ñ( ·ÖÆŽÔ¸D»¶qÅ©ßÔ¯:èUýgò9B‡#†±±£ääLP[å8é•*\öÝ¢îNBa7b5I~0ìì³±¥ ¶.õ{< ôÕaÉ‹½s¾;œjAõi}ºJØXßsâ u ÷G:·¨+{m6'¦ç\ÆkË{¨{I¯ï-Á£gΔhØ¥T¸ ÁÍ»Ÿß"††ûŽ·Ÿp¹­©3.g<;³Ói™ÄoL²6`÷ý‰[àd)2Ò¤dQÿÐȆ±Ý{ÀJ/9¿°?f${– ïjW¸Ÿ nÊÿ;þ&Y‰c‡2 1‘ÝH›`šˆVr"%µùY_¸mضZÚ¶ùEsC%Ž\ì}LÊ›œ<2 c+ y6›D0ZŽøeðåͽ€@ãÑxÙ§ÅŽÈi׋õ&Ð=VZÑûÝù˜6‡øû×ðå"X%jLëÎô$:6œåû{9›$”‘„Õ…1)t†g÷s¹Rz.È·51l­ öÅ“€Ñ´Pó«•t¨_ƒRM©—ìëU¬¹}]l àuد;‚kþ‡ÇÅa4LïNâ:W:m{=‡x%y_Ñ[J¥c'ðÛ ·G¢ÛÖT,¢5)3.¯~ÍOÍ*Žw†Ü`èzCh¾Õ¥³éÂ\$«Ç`mp'ˆ‰UZO†7Aõ¿†_šž ýFoÉê¡XëÝv¿Xeë˜#Ç§Ý $]J)˜É<÷dÉîâS¹ûùb’«¶ö,9†6i}¾òmÞÓ½L5AÝë]¸¡8‘#³é”FKöW‘ÄUc¯lËÒ%Ú¯y¬I§”¸XlT ݽ(ñùaGù… oS0*xñSºcó«ò¦¿§Ž=Ü¡¥¡Âɘ¯Í¢à­Öÿ*^—ŽÃ‘8M¬ÿ¹¨[>6BÞ׋ŽêSØMé»´ \›d‘üÏú‚ Þ‘Ïæ~Â<ídÕgj»>² ¦Îwóˆr3<‚<”šß6B˜†±øíuÕ€ìÈ拾ðééíqGýrCP71dS>ÇÝŸhžÚ*—~7}»NJò·/¦ÇôÞ×ÿ¥Í‹Ýû؎ꚇ‘!Å™'j–¼l¥ò =+ét+Oçîc½ ¡”~$· C%äEâmi7WĪnÈ"ðÍ;êØ'‹ìU‘³|CHdh­N-Ô‡(yl,9ÚÝæ¹ú)Me\%2~ÍûŽýzYy»j*$AŠßÚÃjYp¹%E5§ ®×fÆ·±¥Y#uTöë,4œHEéô„ÓQ7Œ Î9&ùä5Ç ¾›Y+èPÿöëØpÚwIPôXq¦T’ ï€OÚD^°9‘Éžö ­êÜ|i½ÇØž*±±”Y> ºƒš·“Âæ(ͣͧH%þoŸªÂh—Á³mØŠßá.¬ëà¥ìàåÞ÷á{(ÎEs,àS˜ö¾únÔ3&¦É{ÐíÏ0+^ð‹ý0âL¨™ÝñßÐÄÔ¼øéù)^hNÓçqàl°–0Zâ”·GD¥ª ¡ˆ`™Ç[’¨»¤üØ M©M`¼PxàC”Ú,‘¶m Z¤¹sœ!¹¡ÕV‹‚Añ…pJÖo‘ Ô<‘ÁíÙµR´0¢¾ø°µ» |B̳G§V÷œ¤KR¥ô”º¥éu® I½yLJœFN ½ÒO™§û_ˆE0B­”‹DCj>~™éI¬Q#+‰žmY{’%ÿè‘âsPß`DëÅËóòrrùô™(½~’,#Ê#‹ Ãý„;8Ù3õR킽£è„¿¯ke’œl Þ)ç|ÿº¡4¶¤±ŽÝ4B2IãaÑîÑ]®Gò¯ŠœOnÍRwâ#Í»ãÆ¸î¤Ÿ iLÖIÅ­—;6fôF÷Àë)”ìB"DóF“À›Œ ו2Ò~è×óá¬ÁLcOÚ?-ï`°8ñ¯vv‡lÄ{…x5ôßf¦²‚ì5jà$ζ<˜œ ’²QJÄV ÷ªÌE™é·v^âCd8¤1/h‚/xBçä°Ÿ7“¨%†§¥õË·žûf¤–À”W„IJÇþ$TÛHµgŽûiŽ‚¨û‹Y¥¦÷w죚]öãrXè‘ãVï—?¬ ²U¶QêÎ åß‚é&ÕøåuB[õ !3'f5܆$&P¥ØM½—äÄ®âãVSâ¶Ñ>g­‚ œ!#ï”Ixgh€“³1$­×˜šMG™-L6¬ÞWÓNð\¬rnS—ì&_7‹/ÍäÜ»A÷ž¢Á ¯þBsOj›«à+?麄J M!¿f,ÔQËGØ~¨ŽU3`<}‰C½9Òÿ:]j®&òîr“|Gµ^ PìŠgK V |Ÿ–³phÀ+Î ×PRQZÓVôEl¿ÔǨWŒE¬eñƒÉ6%©¥OKa`‰$MNWRŒ)®2@!ÿ¹ôÀK‡¯Ló’§>“2:ˆc~§H˜¿F¬ýv¦i&™Û²bÝCßên‚ì6óûP b1ta²c6¡Xù¦féNÛd2Hà ¥¿¨!=EC<ùûHÞšÞXÐ6³ ãX’(U–[[U´b‚‡|àæ$_2sÐС™“ä¶ižšÛ"R|×o‹W°„…j°íÂì9w`-rvÃŒ w/Ãvc–؆»dÆ„DÓG jŒüõÃû¨‰â!ÛÒ|øÌnFRŒí¾ƒw<ƒ‡9[”")ÇKûb<ý„SÔ_·3ÚNyF¬í5徆r d192·ÍIÍ-rÉŒ¶S«—Yóɧ´{Ü2\Í;ËŸoÊŠD‘pë‰å÷Ýœ(²7ü(€8’¬³i!G =ðÍh©Ô°«Ú…ª  âiÉÉ%pD²h}#–DÈh>w®ÖC åR  ÿ§øQµ$‚‹eÝ*í”WØéˆ?©ÁÙ8j†¾†AØONhÌ@àß¾.”ßµ}X¼«‡Ö‹‚=H!Ìà@I ‚ñÝ×/jû#+…ñ°†Ò #OY +…x¹HÞð’½ÔË4)Aº+ùIú°Wµb<ã¹Ð#Õã–¤¦EÛÜ–óáÚã° ôöÃ.¨Ì2œDP½îѰœ¡¸ùjÝôœß8¥³'4~1èß´€ÏKÕ]8'JW —#´©;Órö…qVÔ‰y¬q‰tÈ>ð;š¼Ã2˜ïz1nÃLÿÔ äÑ££­-^FQÄ$;£/o¸ô„ÂK:Ã¯Š ÓBÿóÄÀ“^(^šAzo\ëVÁÚ¢–k xÚ &A5ê¶ë;E±ZΚQ†mw§JKv’ è%iM) 'µç øûmQr7—Ö& ªu}îVع Ja; §®v0‡bÒxå{ixJÔ`v QôzT}Å÷ô\… ùi¬ Ó`¾(ÂqÙ<"¸<˜Ì3–*µÃþ¸ò9ã$oƆ°p>ÆOì˜?Ÿšïb2è@õ=`kòC#·¾oˆ#¿˜¶ª˜ ­é®+tÝ@Î+Û9kŒ¥æiUîi«£Úó®ó™K…(`þybÏTpÜ1ŠŸ ÷[$Žƒ ø=Ö6§Ž“itdõ-ÄË;©ÛHTfvïˆfV ]J¨Í fR^ûÊ/˘Œa –.çOî¥r_ÊPT'θ6ê—¯Ô>I}#»ƒùløfQ=Iûm§›[‘þfºZ¿½}á*â4_ë§œ~:O•fPç¥Y¡ Y'W_F’8,Íw@"{°´¸õ¸ºOÄææ}‘Ü+‚aÓé­CGçÝ÷u2¦jûf#¾LæììžwÈÞ2e—¬+0©ÓÇ|;6=*‰#‹^Þ›íN”dêzÉ,é>Ù r«;‘©R»†plôÀ¢QÑ_c¥c®RSN‘ÐxÜm‚AŽ^f<â§G$•¦í‚ ~w+õM:~³OÜ9ûÝôF·€÷àŒžÄG­fCì'ˆªÅéj œ;ÌN¨ ¶dð DÆX5hêõì.]ðÎSñ ¸¯¦ '…|r ½êúíãg¿h^3FZÕíš-OÐg-#X†ÎÌv÷[`2$n‚âõKYÎÙׯÀ)÷ãn_½÷öó.$¥ø³;0 ýÄ ÏÌc÷K6ZäÝ331ìÄì£à~Ì)=‘#å´ Pœ°×Îé]=]i)lL“ÀùF¸‹ ò`,ê–þTâ¯JRezY9xá†ò%\Ê*u¾ulöE¦ògΦ‚±ÉÂ^¥/I󯹟Vo,–“ÕY ¹ÆñøI‘¿¦²®¬0lÇ~æûT|xËs°àQH',giD‚ ?ð›‰È$ò6UèN1¹Ûü+Wœ¡š)'Ä”ònûƒ´·ËÙ«ÕËÔ¬ÂÕ˜u=TÍ’ë~¼¿?æ,=jH£Ý®ð[K*¾§MÆl±Ò”os§"øi KR—¼“ñ–Éç8Ëz¼”>30:C°=¾»»8°š"ú›%½é!©aÐÙÎÔ^ñÕÝïá‹AZIŒ~ÕªõUö 6Ð×3âÖd­EE…å Ú––k†ˆx$Œ)/õ5|‚’õþ>þNÁ‡°é¸ßi½0D8µøƒà¸8ÚÈJáÂýŒaÑc-"WçÞ¸^7.kÛï;çšP)hôFYಃ•]e -Š4¹ÍÁ!©¬°ÔCŒ’ÒÏÐ/vÓ/sÀ»öy,paðÍÛ/»¡u'KLJŒæ*ÇÑšÖ¹CsXyF|¢a$ƒ`€ÉV>43£"ÇMÒòî$†xÛˆ'ö±ãvõèépóò$ ƒe»!…“¨ã'/(‰*‘92aq%(cyË£ò8ŸÇ­FèÀ´"ß úéBß± ´/J\”qÊæà)¥z®<š°ÀᘺT±Þkø;VËÙkp­Ô~îØf#l¾RY‡˜ÎwbD{{~µÑwÉUté@c¶|†g9,ìγÇåI}/…yØsñOEM”-—ã‰_[+:~_²Öíp7ÜÇŸÊ(WQ¢ÚäÑ2|㔥÷áîñÄÕ%Ô&>Ç%Ñ“÷§ÿ„™\xÌÍ8N<ŸP4”âØÉç¦L·Nú„ÃqȽ†üîϱ‰‹´½µ_ÒµbiÀéZYpL¦6׉åüñÛ|dò&ÊhÏï`!¸¤ùLáµh;öÉçIß¼}P&ËDPo£µ®*ï.µ÷¬€†kš°‰X'ÕvÔ¹ÿë~†E+eq‰ÆR*!v ³ðl“½G Œ±3³ã¼¯“òO]Ü‘…•ßÈ+f{`C<ÖÆ6xÚjt/ó—‚FâyDTìÖ“Z§õå4Z=Ñ®k—*Øê¿›Mh’¥Ýˆh‘Ð*:oswû¯´‘#öjR rõƒ*4Õö÷å¿äø³Ò$3ÆÉ J úÓA,u„ЬýçÞîᾋí¶q˜Às rö†­s]IP³ÝòKÏ«ªd\À4¡®|^{“Yeô ò…šâÎcÞ¬Bš±WôJð‡ ½Î22[DÑÁCPšXçšØ&I˜¹ùœ>íëTæVkmm'Jˆ¿žÓbË‡ßÆÏdtls7Rep»ÔÖ:yŸöËR®Š8÷ÊmæT–¼:{²ú¾D/@iºÖPByå¤OP—K‘õôj È8ÁO1I³0é–ƒ‚^[„>.ѸD£b1,C2NÚ¯1q²Á“¦gg&¸º^¼Iþ»Û ‡ Žž°ö‹”Í-d ³0jîí~\E•UçúÚj¬Í®ß@»gŽ ¼E‡8½ªK[Œ5Zã®CüBùͼ~ðŒB%둬kè·÷+ÑÒ@ÔLÂ$ùlÓÍ _„Ô-:9Ú¦çï$í¸C:B˜™pá?ê:æ€Õ‚ÁÁ)•º LCK¸­|³¨I£~(È- Ò÷øpÓ¡)íϽÉf¸ÙÒÑf dGÏìM÷R`Ùõ<´)ÎȃbKãmÜÄ¥†·²¶õOÊ"IÙ†tW?$ˆæ;<àQõ»…£%š<)­Ôûs+…X¤Ð˜êAÄLô^!ò³0v{¦,/ƒsO ë<GK Jdv§ “¡%é,ï°6ŽÖÕnÁöNÕ¤õ/n|®Ùy'N}ŒÜ°Âlw—ýö˜ø&Á"ÏǧÔ[è®–úæÖ¤±ðf1ÉÆy=µt‡í¬ËÊ1ùaý ƒ2!¼æš›Ùn=}µ­l&#föÎEk£K¢ÍµFjZpt¦f™9Cô‡mDÅqZÁ ÕÀvE¼±¹¨U 1êæY¸dŠÐý…anäÄ¥Á¤( Q)ºQ-}L›!¿ t»«o* ]ùÆÄ(t+B„aøø•D@k™+جuÈïÊç—½»þKñ\š¹kÖ~$[ÕoâµðËQS#ö’óÚh:é>9Hh pÏÎ3òÇ\ìz£4ÔS?4B#b¶à¹ ˆƒLaRe 5»óäõù¹:DѺ;Îæù–p9xùâ¼2¹D{á—º]”'ECn­Ü4µ«êˆÎBÙs<.͇'gDX¨º…è@2ñPâ\›üÎB•®‡§3†ÀÉyÜ 3|UY=,â&5óDÂ/¯’Ô¥h8&έüî ½á_hQ.«ÂÜ“3£Ó9Û Z£Õ ®µ¿Ô¢ODšàë[^{¬Jê¸0ШÞ!œýÙÍó5¶â©ìõ½§?ÒþÓc8‡OBã2;ÂÌt2 •} ³óµôêÙEÞI}bÐ&¥¦Z]-"ê½Ìw Ú€…ò¼Ú¹YM*„XzŸu` ‹ë! B³ãǵâž6SmPþúL¯öNžNœ)QÊ%¸¦`½Un5,mLÆ×àÁ±pÚ`íMˆ dâWÞîeÔãvô÷d•íý<ϯ¸ Ý®}aäÊ !¦+äÊPÔÿOïÿ¢&É;ã¯MóJ°·+»M/Ø–k Dk¶I㸊l)d®¿ùp=·²bÀga3Œ 0!é#@ûœŸœ*¹¨a2­-O°·¸lâ6×% ovrQÛe)¼‚š uþÏ%`äã·ïæLR·¹|f É!·A1¡öNUøæxb²íeswÞ:ônȧR×¹à¡V„à°Î\Å•BˆØ\’¡wRO¬­R,¸QþxÈϰ|diÓgo(å‹ã™¥y‘ÌúS˜:rúV×§¾çAξÜa35ž ’aZ€ÕÙ$o[诙5–¤ËÑó‡Xê endstream endobj 3676 0 obj << /Length1 1455 /Length2 6285 /Length3 0 /Length 7264 /Filter /FlateDecode >> stream xÚtT”]×6)! J Cw§t·0  1ÃCHwˆ”ÒÒÝ(]‚€¤„ !-ˆ€H}èãó¾ïóþÿZß·îµîû>×¾ö>{Ÿ}íèkÀ#o·…¨ÀaH /¿@QKÙÈàçäåçÀga1„"] ãø,Æ„“ø†"BÞbJ ä-Q <òt@  ¨??@€Ÿ_üo"!PyAíZ¼€GpÄŸEîæ‹€:8"o÷ùûÀæÅÅE¹»ä]!(hŽ×ÛÁ € … }ÿ‚]ʉt“àãóööæ¹zðÂ2Üo(Ò ñ€ ¼ v€_%´A®?¥ñâ³ ¡ àöHo¸\ `ÌãÖÅfAnw¨ktÜ °¿Èš¸äþ+Üï_ °ßÎ 0îê‚ùBa{¨  £¢É‹ôAr@0»_D‹üÖ䂺€lo ¿STäõ Û ÿÔçF@ݼP—_5òý s{ÌÊ0;E¸«+†ôÀÿ•Ÿßž»/ߟæ:ÃàÞ0Ôß+{(ÌÎþWvžn|F0¨»'D]éçÂÿ7æA„ùÅDEDwÄìÈ÷kC_7Èo#ð|[CÊ î°¿-µ‡Ü~ðQ /‰ð„ þÓðÏ>°ƒ‚‘[ˆ†ÿïè·0Äþ¯õmÿP€ÿ­ü€þ_Ï¿þ¬nf‡¹øþ›þ»Å|ÊšêºFº\Jþ—QAî@ñxÄEø@!a!€¨¨ àŸtAÐ?‰ü‡³:Ìÿ+ßÛƒú;g¯?"`ÿ3!€ÆÒ†ßJ`ÿ·Ò-ù…ùÁ·/àÿYï¿]þ2ÿåUúg¤âéâòÛÎþáÿ±ƒ\¡.¾·ÒõDÞŽüv`ÿM5ü5»Z;¨§ë[Õ‘ Ûq‡9¸üë ¡*Pˆ. vüK1áF¿fÍ ƒèÂ= ¿nŸÿ¿l·v¾½AÈîW·þ ü ÿ›ÿLÁžˆÛxÈßjº-ãïõïûñ€ñçgà`É0§ú°öµò¼y6Ƥ?°l˜dpð æž?‰pR9j²B>!NåS‡z‰×”ÙOä>2\¡v[q"[Ÿéµ]ø_Z?ÕŸØhß§x_¸+ßÐO‡GËc(·éåîoìŒÙ‚Þõˆ%ÏÝSŒH÷%Ùï7ª> ýå ï"f6ô6kD4î^–OòÄÅY—L±äÛfOS3ÝAòÐár’úÜ›:9ý@šûþ†áÑS.ü€½xÁ"”ùŠ@Âù´ßR¥¡€G7ÍCsj:ÌÒw¬(…­´GT³¨Ò¢å‚)Æ{·UY‹SÃ`¤³g›0¥.ømÔ‚·ZaH!uOΟ2JøÎŽ{¨*\ðÍ;w÷ÁI¥¢–-f«¥™!ŠÙ«’ÐuÐ~GYX´U5ðS>Wˆ EQø Ñ8ÁþlJ VOí|+…u¼G’»…c×^½ì¤Ÿ£0D¡©©èða;›s(b;?ó«xÎ)Zdêéåýâ a\É|ÄÖ™ØJ£Ër.¥*ù¢þ•OS ôûtëƒÓºÙ>’,Vˆl¹Âtœ›„\’|UœÔê•'ûö? …íŠÍ£¼RT´¾¿üôãó+¦ÌÀÊ/ØÉ;Þ/¼*?NE^S›v¯ß쪣¡¸>2u¾çŒ•@>½Ý/ ¤PʉZ¦°1»¹¬=fßÿ*I1é²*er¥cºHŒWJéöÄì ìÎ¥wþàìªÜ3Lpz›:ÅÄ~ÊÏ.Ò—¾¯‚ëú9–m<Õ HäS'pà{,8'°´Df–KjMÝšjʨ׶%Ö{ÔVé0cgd´¡NSjõS ÆáZÉN¶bE£:AsÈs…ì?¶ «EöY<íÁMºxª…=O~HcYã_ñÓŸèÜdfp’—!²T¹3ó}DÝïL-¼¬Ö÷aúˇl‚Æó¼|u>N£b‚™Ä8' «2¡~2÷7;iOdyñ|üæU°ÂqihX ÄIצ®ÛìN[û¹tÁÖgVæì”Γ( #©šu[blWÚÅjš~ïù\âÕ«ÆÈBåg±UÐ…’}‹DùÇiï¯N £-Òùîm(ëJ¾=Òߎ—L!baï/kÐx «È8*#éàÈÑ9M  jùŠ'Ó+cXê– ‘£Ú<ŒÈf'cúˆŸùÀŸ+‚#`Zw`$’\€µ¬ÎŽ>ÍÝ|ù‰yMȱ¾y«oCå¢~ÁeЀE—3OÆ[ÿòÎUfˆ²÷õŠ⯾èݵòÒ‰”=ZŠ5'}=¬Í¬~P͆n)¾è=tÑ®[é–x|Ýj³Ó­ÚÃb_ÑÆ¦A÷³/zù­&N¾}ø©…ìÓ óᛀô ¢Ú ý<ÈŽÂÇÊê쓵,î}Lv¼Þ5´/µèÜíz0â·´Ê[¼‹ Vœ¨î2;Vì/Ä.ꯤ¯Â8·ß¸¢:÷U8*8Ì?¶o Ó!/4©¼NÜ)¨±äð¥êy¸5÷ "óàô\»%.±ãêàU™E³ìŽŒû¦Y\ÕïÇwj«N'Ã;£;{$ì©*LI´z÷ˆòCØIK‘w}âÞl}—r•Û¨Ÿ®{‘3eqc2n:¬%`Ò¹SK²8oµ2‡Ä½ðÚc yͲ UÖ‹%Ÿ,2¡ ËÒšjO­tQo#¹)£¾ÛÞ°Y0°áÐ̘•¯hÝšëË€Û:PŸP{JÀó|Ó茗^ÎZ‚r±){$±÷Øž­DÛWÈ­f>÷šû\sm~UãtW[¡Þ*´ˆü×÷5ôÄD°ïO÷ö!™äƒíY³K«Š›‡ab×—´)g¦‚§‚ äkðz9N}£Yî„‘¨u©ÌB½B¸6q>J‡oÐáÊ3Èz”V˜³DdzDõ +ï/Ë9'™Šòå9©lNVùÒBQØßé”åû¤ ëÆ$F´t¦@“\ƦCkŶÜKt® yΖêäQñtó˜Z«á¶ö¨Pÿúá÷²ä”±H¯#•­—ÞscŽq:†hú¾už5L¯:aÌ~’9ß ²Øq€U+óø úìÄÛóctŸÀÚWF¼‘¿!)s´x/ÒvPÁ¾õþ¡^óJ`ÎpïËZ–ÉJý(K¨§6Ëaà.QÊz’Õv>Ç!E»ŽÀyød¯ŸôlðÍÏúø1wòsºÄøw™^·|GŒ»˜ì>¡lo5á§Á¾’|R{‘Ó «¯Mõ µ2¸¿‰éø w@=}‘ÙÚøuË·áÕ<îÃÙ'©F$Mf ÔÔ—·ÿžüŽ@®ÔUCZ2dpáEÈ“ÑèDõõ𠲕YЏ¸ «;t©k{¸1UŽÏ$jÕòç’g\ÌUÒÔ ‚( ´oŸÞ馑HU%7[û~ÖúMµÝo-ebŽf´XÓŒgÊTJføq˜¢é§„]×ë:FH‹VNÈì~Íp—&–áÝbÒÔ.K’õ'I4¾|hÛ‹Ç;Æî3p?sðç@áÆ­ç†”­- ÚMx¸ÊÉå ÓwÝž'펹çYÇ[ÉKŒ°N¥Ù8W%ž4MY§Ç¿–@OÀÍ÷’)¥ÎdqÜŶ 0—Ô^ŸF,{XŒÆ8N–ÂPËRÒȺgC3=¨ﮓ|>Üîåă÷“œ…þ?ºÚð^8¤KæB¹Ø}íWÈÍ•ÐÐí‚[ÒZù™ö7Û< ²í¸Ÿzè~,µçp8‹ ÁPÕÑð;IŲ¾ÙÝ‚gðòñaÊÉd27ƒþ´}Ò^óµr¯efõM>½–É«Ì(}DRbã«…Þ‘þ‡ ñ9Zg4»ÎˆsïîÔa«/Po²šÏ¢´@ÝŽ«:f» m»M#ݲ•¢!µ þé—;i_§†B¼Ûå==ßÊ  û•¬D[ov‡íV÷PÏΫp'iÖLßBµÜÈ"ò ƒÙÉòϸ,¹©ÝÌ­Ä^uõ½l©ò»X+ßß›»ì~=öDƒùÁùìÔ‡ºžÞfÒªÒVf¢¤œY 3ˆP½k£‰Þâ‡0DÿIù©úŠ–8}÷Ø}Î6Ýz@c'mFÖJŒí'Á°Šm…V¬{b‚S9 ¾£ŽöpJÜðs˳ŒQ_°7Q†e6ÑÀ°€ÒÔôáƒÚ¬lRÿ6i#^ªQ*n ¹Ûö;åÚ{[ëż•ÎAƒêϪWÀBR3ÛmTë ;­çæ»–] ôáÂŽ!Ùˆæˆ{4ÊyavÉú½Ë{c0æ¡M¯\/%qN¨™dûwð­l¬ë(ËÌÔ8bºôè–Ûcß½3²8‚iCÅYÄóH¨Ž3í D‚¦hLãe"â¸Ör4‡ÌJ½ì+<Þ"bì²;¢Œêï_ŽCêi\+ö¹UøìÖ3èb¦è˜ÔDïËö:d„œ¦ àoºàë4ºØ²«˜‰ª’üüT·/TËÛO1 ÂE«·*•ª«O&·•C½*”g@ç5ˆ"²—‰ƒwŸj 䋤ó-}éJéë'ÓQ«†È¯Fb ~c&–p:ØÀo½[Ô-ÒtÖl½{ü±¾¢q[»‘JûÇŒñ¤úļ°©Øçq¶®üöØôͧÀÊÍ9Ù ØžÈdƒ›§6æ¡+ªú6ô†©‚{j=B«Ù³l }B›òÅ`çl®WË4«ËÄ$Nþ«-¢‹ð•65mÝ;î¤ÑI$ÆïMío¯ Î™â¾`hãá,=úúqŽwûèóûÊ8ƒ*ÜâÔ—Ì«î)¯z¶A;WÒ 81…Ó˜Q£¦WTÓ3{Ï”ö‘¢7®zùuöô}ªGZc¶ã;úf«odª}좥±^‡ŽÑ´ÝK=ÂʇìïÎ]~kA‹ã”â”mZßdkÂLž•q¥\6x=#­Îº[ìpæØ©\AÙ/£‘Ïø·À{}'i#é±"%÷Í:âOɬ9žâÛX£î™cJRŸM5±$«š¶¼‚íG7Aaàõkl–>V³Ñ’XÕU=o0 ©:6@ûÍú¾¹„ æ%¦ãû\ž&tž>>‡Íú1Žð!.âŠ1¦‹„8úu^%káhÙ½%nÙLºž!Ø 4ò™^D¿òÕRó3`ÉWìV6 ž@ÏW›“]0´ïÅä!rŲ'–j;"|ÅccûewÀŽó9iŒ?ÃÀøäfX_âÂuâˆ;~‚ IOÜïu c禧Y6ÿLcoõf¤L¼*~üy~“]³¤ù.PXpÞÉ+Òï»cÌ$íô¶øö«”ê˜Íô¢3dæ'Šf§wÐ7âž´¼ÓéY)—àf|•|eD®øó££…jp/ ºPü–NÄ÷Nf®Bßgi"Lã2úú<$ÌC¦š,]f9/“†”¢í*ª¸-–ï\VVWGª¼4ÜÉ+ Žr1‡Œ×uuHÒÀÅ#S-QaU‡7íŽ,^â'lHJœ%#zò¢Æ"½þTÖП*7nýSE SÜb&±»éͧ»*-ïUrƒ3žuóè*›´+)×ûM{ä0óÞQëó‡-ÅTÖI\<\ à EpnW™¤ådžb?Y®6²íʲ´R.õòÀñï“Õt†×&èTN]CUâ£c|RGÙÅ¢ý€«çv¡}?żqðx³ïÚ>aʪeÑÀ} ïïQô?³¢{ôeƒJ(ß éÔÓ÷T1%ãmdJpì(þ›ªûSª ­è >&=V0ó7r¼OrŒ -†ÛoÊuüGU=™“8F²5–€U[³Â»‘gê¡…®Ãé'¼¤ƒ6>4߸æÈBž ¸›K`9­Õo#M´¨;j5Ê%ÄjŠå³<öXÝ/-á ÆNØzhµ sp2ÚCØÉñ 5yŸtœ23g¾‰±1AGžúŠ®žØ.õ“ïkW˜2S+AP‚i!j[W¼^’BWèEÐÆ‹áÎ ^]›zþÑ 6ãþÍ™E´1¯ o^+H¬Ëóñ }ºó%º~Æj³ôt¿Ì¦‘«P•OÎú£Ï›§Ç6¸«^Ø8¯²Äf¨{Ú‚.a–×ú#=©íh–± G%‹²¯j÷ÌŠ ~^ä󙘺Pêl'U[õ J’ð»ëìÓS£¬£ÝüS6v¤Íu2Ù¿r•_Ùìªáá· ¾Èš µsÄ}‹Ñ5Sae¼lœž ÛËxI2®Ä>fbÑÇGŽTÅ7¤°7îùååjüÀª™‰ßê!)4gŒ¥“ùž YûÉdD¤R"Yâý’yÜÕ°E'ŸV›²²7º¨InSI®ÕH!æ c=Ç*Ã_œqÛ4$aD¿!Ɉ/´Ükî-'Û̼?…‘×+í4Æóm[I…ØÁVÚ…æí…í&ž÷°Ÿd¢”Æ~±écüñ@¢Ï¬‰fjç|ƒ´ôŒ×1מ*ï÷Ê×zÑïÕY0ŒösÜU¯Èƒ!Ïj›€RðèæÝÆ^\6‰ìëE©e/û ·O”T½ïYä9wKêl¾A?}Ï÷ìMo†Ôš¨x¤Ø³×§¢ë50Ö4 zwðJdȘtlçr«Q4ÀY±q]/êúýtÞßH)fùypñd 4УâûASf´ÈjÍ&ð•„óÃÃìÈ6ߤv.d¤e%H›bÁ“ÌQôŸÞT³ÔTôú¢¾•àqÊëÓ¹·¢~H¤ ËUœqõgÓdû¢ÉሶÙñeù;˜$gñ¾°^Û<6u“ªÜW™o—Yn"p)—Nq¡A‰‘\É;¦nyÙ›…Ô¹ŒÜE3ßðÈö€iœI‰VuEž·‰Ù0ܼ‚衱ä¼}}ž¿n37Þ6Øo,Ëk ·wtØÌI†Vº™R«~!å±óhús•15âGâĤ•ãÙÇÕOÈOº‚gp›’«{"Ë‚‰è<å„?ø;æ†#—E…Ú5¯µ¾¦¯Ð9e8ƒ•T›„Ÿ¨›N²x¼~Jíý–óèGz~rïȺäƒuöªxf]…ùN€#\Éó(±­¯Úsí”h™Wâòè{ZÔBh(á +dmÃޣF¹p`Cô.•óùµîN¦W g‘³®ð)šÒ…Èf¼l¥Ï¦à jåÕxòqiÔø¦;ïÆiàCiMKIŠnA(½¶Å‹Ó»_ÇË`߃Htg?é˜MpƽŠ2åÅ–»Dòíüž½ÎÖÜ?BªØ ë^f{sófw$2;´Ý©»W‘˜ï>À<º’ð$S0>“Ñêl¤ ù½€1öܵqks0ô…©.Š^§,IÚnûíxLv¦™ÉUÄ7`òÇ Ä/D§O•H1Æ$ì7¯­ J§H®„R‚³Çtä×—L?U]¨êtfc•´J“ 9{ÉŒÇÊT S„¤)™ýK¯Ï—S…¾éß±–®™Üx‡G_x÷™Ž0é·È/™šKh\dfÛTˆd³XöpQ™Vwй³¢3‰ÎçNj u˜qŒhr2p\»;gò!ãT?ùƒ4®­F÷ÝqãϦ¹Mêbñ5‹TåDìüÌ®í™,¹{8ËH‡Yü¯ß%q«ÕÌ¥Ù$Y»°–¬¨µúƒs?cà ›Î]&2_ëoŸÔR@y•¨M‰Þ²xŒw~ó}±V [y‚u&ä8Ëʘ§³Â=“20^M¥*±“ Å©Ê]"¹æÆ>ÊÈ ¿)®â>Q¿Ùˆ½R´N‡IlBÉ+¥«EÂueþH‘>¤è}¾^ÐÂfW8Ô-™ljöÁ¤ß`Ùä½ýTŽâ/ió•“äýQ…Ñ´ƒ7–?á(¾e ›crÖü‹©›” <^íyº9¶³r&±ðX1ƒÆÌ‹û×Y‹l+Ù4Wðeo£P9 M¸) RCÀß[bAÕ:å¾ZϧIö¡Cçë„ê1²‰þy¾‹¿j^áqéÑÓ½ÌÐÔÆF² µTÙÆ-¦> stream xÚŒöPÚÒ€‹âîîLpwwww—ÁÝ-Xp× Á]ƒkpîîœKö‘äüïUÝ[TÁ|«½W÷(ß©¨3Šš9˜¥ì]Y™XøâŠŠ²¬,v&6JJ +[àÎ(µ€NÎVö|iˆ;]ÞÎ$Œ]Þìr®¶Vv++7 €……÷?ŠN| c7+3€"@ÎÁèŒ@)îòt²²°ty‹óŸSZ+//7Ã?æQ; “•©±=@ÑØÅh÷ÑÔØ î`jtñü4–.. >ffwww&c;g&' !Z€»•‹%@ è trš~— P2¶þ»4&J€†¥•ó¿êæ.îÆN@ÀÛ­•)ÐÞùÍÄÕÞ èx‹P—U(ƒ€öÿRVø—àßͰ2±þ×Ý¿­;²²ÿÇØØÔÔÁdlïieo0·²”¥˜\<\Æöf¿mÞìÝŒ­lMÞþIÝ %ª 0~«ðßõ9›:Y\œ™œ­l×ÈüÛÍ[›%íÍÄìì€ö.οó“°rš¾õÝ“ùß—kcïànïý2·²73ÿ]†™+ˆYÓÞÊÑ(+ño·#„?g@' 7;'èz˜Z2ÿ á þ#dý}üVƒ¯7È0+èke|ûƒàílì¸8¹}½ÿü/!°²̬L]&@ +{„?Þߎæÿâ·ûw²ò|`y?VËïŸÿ~Ò›03{[Ï?êÿ\1³º–¼²Œý¿Kþ¯PLÌÁàÍÈÎ`dãd°²pð¸ß>øþ¯c«çñ—­¬½¹à·³ßù¾5ê?9»ý{hþ½!´€ÿu¦äð6º@ÍŸI×cád1}ûÅúÿyÞÿ1ùÿ7濽ü¿NúÿÍHÊÕÖö9Í¿þäÆvV¶žÿÖx]W—·5Ptx[ûÿ«ª ü×î*ͬ\íþ¯TÖÅømDí-ÞFš‘•ƒ‰…ã_çVÎRV@3+SËÍ¿Î5/œ­•=PÅÁÙê÷ófÅÂòdo[fjóöŒ8¿Íæ¿DÆÎo+çòÏEþfàÛRýo’ö¦f¿·“ `ìädì‰ðvùoÄ ðf}[S3 Ç?Ó `f²wpy3¼Õì 0wpBø}Ñ\œfÑßGÿ".³Øâ0‹ÿ!³Ä‰›À,õ‡XÌÒˆ À,ó‡8Ìrè-‚Âz‹ ø‡Þ"(ý—xÞ"¨ü¡7Ÿjˆým þÐ[?ôV‘æz‹§õ‡Þ"èü!^³î‰÷-ãÿÒÛò2Û‚,ÿœð¾Ùšü‘¿åctùKüæÌô¿Äþfnjiõ_æü-}{Èþ ðvùÌfð­3 ­Ëß o>€ð-=àÿˆß20ÿ ßZbñ“ñßñ¸ÞÔ-~i½Íû£·¨–á[ë¬þ·6á[lÿ‹loÙÙÛ™˜ýâ­"ÛßÃûÇä­l»?&o)عþÕâ7}û?Ò·”íÿ–¾pøÓÐ7©ƒÐâïzsúÓá·ì@oόßž²¿ùýu loåþ ûo{ç¿êýÝ4Ç¿ð­9õŠõÍúOilo½q¶²ø»Áoù:Û;ÿÕOÖ·ásùcò–¡‹ñ_þfËÿ¹Óß—üw Þ4Üþ·nºÿ5oåyü…oñ=ÿà[h¯ÿøþŸÃÔÕÉéíIùç©{NþÃÿ|y@S„Å9Sþëš¶»*QBwÆ1è³´;6ƱB8—>É)Ãõì¬%ù¯R‹½¬RÖJbŽw9«óWÞÛµ¤už·Œ¤Rû¤&qs¯·à3‰Þ¿ˆÈæP›À>k§ˆ‘ð;õ©G¡}‡6³èS§Dõ¡®éYHt§Â*‘â– mSêø^U’¥€CÄ«u¼©æÒl2¨±ÃyG»i¼­‘ª”A&/Ðqà^‰¶>0<¸ŒÞKÜ(ç´sNæ‚.É?H$Á[©µœò”[ìv”ám")rdÖW¶F›rW£ti¹}y¤ÿŽ&é;·¥Q’y4ë±×=1:hK,Í)¯`7ÒìgN8)dã€Pâ/g­žt+™îÕo›Ä6rá¡òžK3=“ëO®ò©²ÆûCh_Ê·}ë)ÛcÜÌà Z¨«Rз%éq²h}̓óû)l³—oiBg´Ù>ð¤Y¶i}Yæ i ÐAggGv³J«ÐDa®ß€-Ò½õöâxÉ¿êè£Zr¬Œ²ÁˆöZ¯]öÉ(üüpÆÊ!a©$ÄF·‰®_7çFÑNWΜ µ•Â1ñ–îe]³[\e ¢~è0$}5yu0Ä>#Ò*\{èm¸Ô&#=Á‡ØnÈÎì^7¾F–1Å&þ´]îºÁg¦¨X¬“ÎktÀ¸=ï,0Ó,ñÕCó© ý}1@/ŒS‡æsãÇ9C„>B[/­ƒ«}{µ«õNbàHe-„—OJ|²¶S#ï(í§ôL±0õOkÎìã±±6y Ñ& ç^#Ípƈ#¡†b0[‡˜ÐËýc¬gô“KèÓà¨ÇÚõ5là ‡,‰Ç¬²È¡aóy™Ú‡¤ú’·]Öjƒ‘~ÌôˆÛÛ8‡€Œ4´[žm/åPÍunf¶Ì;­_Ëf ïøÍ8ò 4ŠP9ù¶ܰÈMåcé–çøé½Æ±au¢+1¼m¸…ªÓkî}BÆŽý&\;¬1²ÍcòhT¡ÂÀ‰Ù_ñ‚Í›έåŸ>MSØ4ÙÞ®R^ÛQ裥ón1öçíàÚ+Œø,ß§iŒ«°zOb`ÙçE|šÍ‘Zò6Ñhm3‡ Û<Éûæ¡0uDõñûw„alÞ­á/ë¿Nëׄ„1—¶ë4òNÕÜ3¦7øÂI2ÍgÌ—ð-ûÄD]x8ž'M(¾!yá.»K:ùÁ-dÜ—Ž.!ëæ¾ß1v'“h«Âx ÔÕ¦u’=q1²œëج“• Ú6‚[Ð(¿#Åjf·„®{ ÍÄ0ç•W–ŠÛ9¬í°ŒQ–û~ýÄ5Ûó¶ÄáŠÄˆ„5p—ør.T½6Cé…<4¶2Ó4X鬆!Y±óÕŠõ5‹I®o 'ɾɛì" \ = =i8L Òa6 ö¿Øž ¹'¬ê lÊèÆTõCy¸a´cúlK1Rd’eš`½£©÷²‘PU3qá¯@9°.lêͶAÜV¿åø6 ÃqŸ~½V»üj-J—id1®úµºžæËÿH`•*²&iˆ8Èdÿ‡ÿ]8/ð€JêMBþSè}Üýá1¼'°È“´¶ÃëŠPXô)se8íÕ ˆ­’Ü×{–•_ñ16Ì T•œ7HCS%÷õ³ ðÕŒk ºZᅳsèä|eqµÆ’œ±© ¨y§Ó÷]!®£áîó@¼fjÕmæ@1ÜöAC†hÐ~êÅ3³¨Ùßÿúä* µœéÊN:æ£O ¨ÔOßÞ%ôj\Qª J&H’žÕd©cbæ…à˜”?—òJ¢øÒ ¹À,i;oÎåḞG ï‰Pãî[$#Ã\KGùðÓ$Ù&±òI·ÚÓÁc¢Áºâ4Õ£ F½= RϳžÖW¸%Gk?H®Ÿä†žtÐÆ84ïŽ×ò¨yZuFê¼¹,ÝÊs|AE öiZʶ‹Ò ´Dǯ Ê4ÐzŒïßEã“äÉõ ÈÐ9©ÞÆÕ«rÞøkà™(ø2 qÚ`ãýTuÏW~áÆá|úHNÈ—<ϯiˆ£ "_?0Œ«$^±«®x;ku6‹¼$”Œ‚Þ?þëãÒÎ;ݼ5¹vO¶Ä!Ï~Åå´ÏeλF©ÈµáÑȦ‚ƒ%…D~C3Õ9YІ–”ÝAš<;5Ç}Ì_rðüÌçÐ yRʸj7q Y ¦ý܈­G¥Dê Ь±ÂÁpˆWs¢3}kž¶4A[ àÍã.­y¤gšq§ÇûðßñËìD¦èpã4°xã~J6Ci+[0.¥ÌuE£VÉ€vñPŒe`HÈàô¼ Ÿ»Ñ˜§¦IB$­µ ½³Y#®XGƒ5ª“µž§8=µå}¼¦®¶RÏ}–\` ­ÅÌBµ+¼Ù—¾kÌÉùµí~¨é¨™e7zvË{Ù;k")jiͼeÚÃÔetÙOO;¨úVÃæ•={RŽ  ÎåÂZoÛ»bÔj’± –Û&{„3IlH›ý>ýjƈ&‰¢î‚\¤iÊyüC|C$*È¡mÀCAâG§hZdƒÿsŸÒâ 58€BÔI–y¿Ç.›MJШ}^ÍÒ\ÖO«å˜¯ã“¥ÑÎÈ=‹m1Á›LN«pU$W’J!ËŸoPöƒK½ÚSvb* Q×§(ŠÄ¾"*@0GÆíñ5‰áÜæV穤 s¦ÆX]¹Xô®“}2Ziªq8r׊iÎÅjžÑmÚZ›súSlŠ6®[åI*ì¢VDV E©wç¿¿o™þŽÇ@¡„·›‘øù-æ{ Èoä¼â<Fg9Qô™ÇNÔkñf/ ʬC‰Ÿl;Ýf2¡¤´Öv›ŠÝ„/.ý% Qi"·êSïš?@ö” í»èÚ¯™#£ík>fD\°÷µ±¯/š_(é¸õ®Äv7—â†wT¢)@Öß¾÷¸÷¸„Ò[•¬ZUÊ}Éi|š´kõœ;ïë¶d[‡úæ#èu»Èˆž ß“¤3#HlìZ‡á½­€½[HéåŸ+ ;ÇŸ}º™¼SM«ÂmïX>|¤)ÆYò‡K£?ýAÔD´ø¾éD º@3.F­£üš %cF»†»ZÈ]¶c•iKÁBéaóîY õOùWXÆû¨SëÊ-),å¶ d ã³`µŸUÎæIu… zv¦6¬Õô»þp᣻kP]’‡á&gQ âŽW=TaÏ:˜G²™ý3iPNíz?ºƒ†^7Õ€Fn -Nf¸ áãñ™ŠÊ,óYñ1l˜êÒ¹fmè[PØÌ• L~ðØ h)Í¢¾â6þ<:*<ÖírœAà·ÉYåäjÛ•ñ OA¢ë/NÉè@|/Š— Ó“U–õHPl»è9„e±“3bhûG#h¹‰/6QmÍ£Ò’–3TûÂØÁ¡€Ìõ B£äì-Þ¨wiz" ‰Æ©új.ˆÇ¨^•Ôt]¿4ùÃ%' vBZ5L6W:9·+;ŸÚÙ’:„ÊŽå=Ù{ŠÖ‡ ]Љ¿eÄMøLjÏS~d)Ü•Œ©lIb:c3Xwª-âË¥!–*î/©Œ®ÔÎðWþZ˜ÿâk§uÀxQ¯¸!:æålälâ—½øÜãÜ$‚e˜èÜÆ ‘š³%õ±3U9A²»,Õö4jÕROÚÈüÖ˜„§0£‘‚fõrÐ@“³Ò1£næælëJš¬ìÕ­3ªéÆú,F8-÷ayD”xºq—“©Ä™¯C€_†­"´½Fض³®Æ cûL¥è×õ; \ÁÏCFÖO ÌÌñ&aɉËÏ6Ì;Þk0“I™cy˜!±?ú!·Ž‹x¤)Ñ#@cmCGýŠ|ÓÉöÏݦêG„œï¾&ä´°$Gn.‰„¾KiðÛ–€Ÿ&çáGòÿ|Y÷zå EœkpX%h!~ž_¸"|¿4ïËc¨ŸØæä4È$VF0»rˆ´¯×2zP„0X¾ ISnšÂ´#)gú…™Ï…§É­ç 囫Òè]‰Ð`û²Š·žQ`<8ÌŠÄ>U乂F\ýÐÐñ.Șc<6Ã$Vùû0&÷ÉY¹Íà[¹xéIø‘3¡¤úû{ñ q«;¨Âj("ln¶ˆlÁÕI‹2V øØ‚‹E>\ôyL»6©Ü$IGDrQ癬fIþè3>}Ø¡LB»æ8±ƒ&•쟢œ Q èQSÔÒµ„¼ðÅp·Oð5í™>µrJ™w'LÔwï³↧*ƒ ‡atW™&tkì÷µÏ\ÊpáÖbK[<¡Â!{;Э1`ñD>]{J$-vÂÚi1$O0‰2~Mñq§E—5ZGýÖcelìcÜïÜÎÈ$—­"c¡Úõi?ÁÙœb† …øžâÀ|ë2I€è˜|uC?ŠCÇÝp&3nx§*pÇêæ¬Ð¬^ûÓf–3ÕLÇù!EæSu°™6ˆ{ÇÑSmJ`€dÃQðš1Ëí#Ô“ô8–o•nó©—iúÌuå8#­Ä…ÖÜM¹BFÊ–¶ET)ø‹Ó˜ s5j'«”†¯¤þEûçµbuJ"*Å&Ϙ]ñÂ$x“û­¦/1ôð¢îØò¿ÚDßâ³à $¹¶‰mµÂ`8^î‡ ô5>¦ûQ§¹U? «z"X¯‡Nän$ùw!¦ù0V™* A…\×i@¡çžzù ¢£Cd½*<„qÏ}“¦ÿ}$W,ºz-²óP° ŽŽj4Pƒ»ŒÇÏ?<Žu̫Ɏ K4!ƒéT" F‹mãYUÝg­w°òÖ©¤_ŸIéHc¥ðƒ/SKz~ÖÞ£û{9p-—Õš•C¢Iú'>Sõ`-ÀôÞù+43 ³Ô­0În-©‰#q;52 qŠLŠA —šÆÕ©* me£0¢©s&e =ô‹Ow:Møyå#<òÒX†§,µï箽¾hŸŽXñ Àh·Ñ_B¥Ê×¶u>Íi@¹ï•:;†k”wXq9-^*$RñiëFö¶¥Ç¶,¾Ö+˜ EG„CÈÃf"‹<²Ïêª+ññ|.À¡¶€:ø²§)¼J»=£fB9ù¸äݶ/É…¼Õ;àG›¯œ€PV: ãÎùƒ™ldÃÇ&½„ˆOÁŒ·*WÖ!Ø´žH2pÓ•CÄ¢xã@n šÔ8 ì½ÜgTË£*¢{€Ÿ*9dãühÙ¶Öâ#ËÄéÚe¤ªRðk.ˆÖè¢4UUu á€æ öG"'^r­AqðjH–âZ¥ÃGb8Ni:#ájRŠ%Èë=/³£[ŸAßÍ—Ö ì!_À:8ûYQÍÊ ›ãOä{0>( x69Â׉}o è¡Æÿ8ÌuðNûha,îA»¡_¶ùŒëŽáQV£‹"<æeÌ3s1ü4\&dÕ¼ûªej™£gKõsí³TÏ _s7šráù`$Ü; ¾°(t°PJZX,c¼­LEÄçÁ2C…Ôa¢n3 º¾ð9–36}nšãb… O”'qŽóˆ‰ÀͧZ}Õ0–3º»ù“äyúF! ã’Ã×éØýqü |T¨”Ïý¶Ãhgý“z~øjôØn=)EéKakp/ž÷‡yûƘ?}ìsi…XS>W‘”ÀÞûXºEIpÖa«¸S_†ít4G0KçKžÂ©Ëk$~%PB…z¿9éz¿¹õnÈᤠç¸,7XçYjª‡ñî’6ŠÂ@e£ÚÇ* VÚ/ Åù*ˆ®lqøCÜޘNj®œmøÂU¸ «?D’º2¥VדøÔ0ÌO;NaÛ+@!ûßEUPÊ|Öðâ!ä‰ì| ŸÃÕv¬vNM%·`éÚwØÇýÀEì6°÷zº Ñ‹V„I¢ e¢YÖŸ¸vFw ZŠ£¡xµLöûùa± ¡„:ý±ã™ ¬ÛÆOÀý³ÀŸ²BNÈåÃÑ4aAÛîšq±Â'¾Hò„®?ʇ)ñŸ†ãæ?Ñf¯ìÂðÚ«Ú­>¿„°ÚÓÊ:VÆça XޮɫÒb˦ ÷š—·ñªóúpH B™ûÒÈ6<5 Î#Âä+–h|2wÞv«ª;ž@¥ÿÅ[€éaXн+Ór³•)úsEˆ¤ö}£¾VMh¡øO"aàÂÙ7–™—@ï<…Q.Ä÷'éæ×k”Ew2æ¡ÉIˆ Ï+І“_pX*^ ¹É[Õƒ‹O­^(%SݘŽ¿ÕÙ~qËï=Å)QŸÙ™4õ"88 {ôs÷Ž€«_¯¥¿äkQ®ðï©?‚Eš>‚vvÇn²&öŠÒw®£Ò¸â™<Ô‹V«`|ìùˆ¤E'eÃeðdÄꊹ;í[£ ÆŒÀDL{E²:AÁs ‚YÔØü{ó#µªbk«xçVT~Ô#¯Jíšå/%´&ÖõZ‚;5 óørr¢©ö÷Jj]f­±lBÙ–‰p²Dyu=‡òL|{Ç®Ÿ'hB~_«ÒkXÜô%ýú ¤=ÀúD\E¸bí~oN{Æé£©fGبT£W*àܯïj%x‰,b¦…Mš®2+3X"bý±þãnkB{ ª› ÕbÙ´ÝšÓ…óË´Fûg1OܨÖ[d+Þ%’ÈQÎn\A¥úã!ÊÁ¶eêO…nm#=iwš(Å]¢D7õç0lb‡&î±¼xfÙîö`º0Ôõ ŸÅȵÀ±àJU´¬ûa©J¤ýϯ"’ÑSˆk¬·‡&§+Up7Û÷k ˆÑCõ¨y‚p!E%ƒ°²wa° ¹.¶üèý¾·{ÙÔû ͘îóÛ¬h ña6ÉœQ›ý-‘Oæ«>OË,'Gp|°1Lfœœëˇ#3?±÷äæQ~Ñ®FUòÌ›F—«3䢡eâêsõ‚Û ¬¾A\ñGI® u¹©Èœ”,3?ìÖnoÆàýèà§èZŒØâ,ípºÛ°H-ómP…n#¾38¯ñ|ªëZãäkz:á¢S؆¥1~^?l,÷æø<kGÐdŸ\û•䈜š'QJÁ[Ã]Žë–¡]üËnWE2”é^8y›UÉOETj‰]v:[ß9* DÏÝ¡­ÚUD>¹_+Ũ®â«bÇ'öѼ<~ÎÀ7ñÌA· ¸ùލ®È¦Áòi½Žù&رµ>‚ÏÆL-6Óáåg¿VUàaÐý¢ÙZÖ½å`CO5¬–öþ7#¾gÜíí?iIÏÒl>íÄÓu„€¾‚ ¡Íí<É\ØzÄC l5"1‡ ¼¥EY€çàý¬0£j-L‰†ÓAïÓ©öhù«€¾~Ïp26C§FÅR }åä'^&»NlÓ@²Ë3ÝáúLù»8††OÉÁ‹è‘ïû4Âi1å¿]y—$7Çà›2ö¥8zkÏ9ç’™M/}¾ÉúŽ|ÈìÛqÜϱ²&(LòTÍð£iúŸôȶäÛÖQ6‹¼tW03‡KCÆtŒ_‚T AÓ‚ Ë]Ò·[x"}â¹;=¥•}òÂFçÜÑ%KÈI]1^˜'Ϙ8¹pGxBàÔ1z­Ñ y_Q’¨ Zˆ4²µË)°Ö嘠Iœû4ÖîîËžå*,–•’çætm´.sW5ôX`B/커ä ÌÆÛ°S™UËWºãQg|ú–%µì´’Êõ1ñ[] gÞ‘r(vs´2ƒ„qíƒòÁÑœ—Äaap»dÿŽ&Ü,V ¥Ø—¯ea†ƒ^Ø}z%¯®>”èµù£,ÕÒÏÀpÛ`Ñá‚Ùv—vüÄžcæ¾z^6Cq’§”Éw¬Ýwo­ â˜+{7¢|x(ΈË™¿îë>¾¦aŠÙ²M¥sSYŠ™·›; “Ÿ&CA.ãJ¤`¸ ñs ¢\Ew¼8õ²äòy–¸ßi2ft•/¸ÌT`hiM;9“ÍËJ„>Å­ ,ül(KÉ‘™Ab//–;/W®Õþõ$ ¬Ø‘qc›äP!ÎèC¨·ˆV±Õ…f Î«eÄSŠñ¿A–Ìò=vЇÔé3á«ä…ŽN™œÅ'ô`fçX+G±|CÛ@-ùÆüŒ%SˆcåF¬¥šäâͨÔoML°éfFü$GEØ*G“NÎ{ÔncˆÇƒg˜ŸwVÐR<”`«º~àK;òˆ"Š0õ„™Žr ÞÈZìÆ“º g·»””cQ‘öÁ´J³x¾‹B†øðM%B[¦_„p`æÄÑ<_A|2ómž]ºYØißvÌ)‘ [”ÿá’f|­¸¦âHmjOJ'´X¨þ­Ã`ÕŒ—³ÔѾâ`ò÷¿>: ZÄõjR´¥K?LîLfòf*þ÷ÖÍŒcAkù|-ã}Q)üR’dAGö;¶LÝ—úŽ®JUÑgèàš°Ë`ª(”7k$Çbˆð:^ù’+@Ùí(³ïÊ>‚ñ¸6`¼g àÆ¾ß<#sBsµk@#gÞ~ö%ŠŠˆÕ)ržÎ ¬K„+'Ó&r®ñÒ(’0Nàé~ïë¡kÊÆ°f‰vaF{7ÚÎËF &Г'!æÍ±E¡€ Ã;i”’µ^Á£(÷TáZÇ”‚ûq6äu¥Æ)õ”çµ»2GŸ1£ oäÛ ìó*óö}–¹józg2\ÅA›ƒJn‚Ÿ¤ÀP¢hHÒ¤«.ª¨ë¤ä0Ò®UÉú^[mXRP>16ÄþК|G É¢'xñ¼\Ú}¥È½m£nmœ ·¯ˆ³VüÏ’š±3·Š(ö8–vb7…oë,›G‘Cöb+W—¨„Ew]û>6Ð}bÜÂNd³ËñàGœëÇÏ-ëµB³î´Õàç¼Åöë˜^éA„÷®º`±ÍÅN³YG¦ì1jDe }é~Æ­èÏ`q?ô+TÏÊ_ÌpX¶ÎŸ|º¬ñr¸gIÏs×2==î\»ûvpAßÝÃůڲ¹ÿÝÔ·Cð—Ûã#e—©y³œ©–+lï•ÜžEÿ%r7j§bÙÅ üÆOé.ôÊM{¼éàÕ¢‹zœ×²Éuîëç{¤'/2¾Áƒ§~|Ï“OÇ99@št<è˜dŽŸ ~‰K‘Æ ÑfRa±^‹}]ªfÚ½¢Ïíˆ1Nï ?`ë!Âw/°IH&2².WÄ¡J n >YXŒ-ÉÂ`Ýmú\XY½Þݯ«‰ô‚Óv°$­92câo.æÒ(ùÉé4<^̲¿ð1špŒD¼HY‚à× e€1ʈ|‚E•E,‘õ–‡è_tÑ©ìº.”Ó†~yÃ#w«}µ®Ï xšžŠ]Ï`VT ÕŒ< uþŠù„a=: f¼R^HŠcþÈcÐ ¹i)ÆyÏ<ýÔ6 C2š Ù rèb÷j§1ÖξzÏâÏÛÓ†þAŸ¬Ÿî}%~XWÌÕóU°›¯îWS\Î æR¶›,í|àAš¹p?ºù¥Ø~t='%úîñd€ì>Ã÷´=Ú½á#êÑ-Ø bÂD{‚Ê~ˆàªC_6»ßC¡³M)¬Ø½é4·Æµ´ ðï/?8~ªKþp þòkçškv2ýηË# ®æ-GSljËà/ºš’º:Ä&YB¸Hº˜®³ð4KÇêi©òÑ[›?u#§W˜”ìRâ6 0LGè:"Ùç?À…¯ê pÍRŽŽs‹Ýftj‘,k"ÉI]‚k[߸\’Á-ß‘A’jv9à å#Å'úv'IHÖìÈFaÈ(Œ0í F©ag³\!ª§‘„ìïöÞãÌØØ/ÈŽ…‡ ÁèÀ”챆ÐdUÚÞö­‰cœ=Ÿ8T¬·QD˜×÷Ú‰Q®ìávî ¢Í7 P`^仂©;=ܲ6KD•U ´£(é€R‹¼¿.ðà‹4 ޼·ÏÏ^œ7Œ]li½`g·Ç] 7?s?:ž¶&‹ŸA@é'‚¦ sÐnsZ&½>ÃEÅËTO7•ÓòçQgæöŽ.}xè,º™Q‘@Cy!¦Ç˜«Á7DìÌI¦Ñd):;*//§Kõ6jÏ%»Q‰ÑO3ì¶b¦èº¸ÑõÁå$—i|ÃcIÐE°ÌªZ(ôþ«úÌæÇÎÔ—âñòŠ!cÖ@g\˜6¤‚Tö ’‰Û.Ue!C/.] Þd†ÎjW$šֳ$sÀ›ºü)ÍõžYˆf@myœÊ~(Ä:Uëß7 %^MãâVjÅJpÈg½7Q?ÞƒÔd˜‰²a¾3ê&>¢ûš²‹U”ÿü~,Ó3îf¾ûÓŽgÞ w€´8;¢Â;$2r6åXËvœ5ãì:¸¢û«V*ƒ¨÷-~ïªGë–)ŠŸ|ºVhø ø©‘yÝUu(ˆØa_ qnq)6_qbˆž‡U‘nó•;N­šå÷BljLÊÛ X+ bŒ˜9#íï¡~4W!ˆG(=t&uÖ |2FPÂ"Ïa&d“…öœ«Îȃ}؈#å”wX;¡AŠDëèw÷ÿR)8Z4„ð§ji†bWËÃOpß׿×ðÌøî{ÍJPÞ"ÝÕp:Vó½iæ;Ÿÿµ`¡–Ÿ‰F_òáæ¤ª(ïK\S€kùrÞ)†I±4ÉFSž›GnpÎ0÷’³~Η˜ÏTg1>˜÷i˜øFXBþC ѹJÖ­Ç#ÎŒaò¶=ëÒ¥I8ªÉ>z—•ÝÖ!0dʘî=§‹¡·åQxr²ó*ŽÞ.ã—Æ3ì5ezÉ=äÊšlmùúV¡ônÖy+Í*¢mRúÞ-í,® Ö½9óz z(©Œ'[(þt/¼Ÿõ2µQ`tU £)“If=Þ} “Ë …µÇQtÕWˆ›[Q}Ñù Ë:”ƒƒ¨Ô6roêæ‡^s.Eå½zqñ€{®Õ{>p¶–ãûàƒ_\Yäb¯G¡~ìLÈMÛ6”ìWawL-±ÍnÅzËJÞiî:Kâ7¼qR»øjKþ”~«lnø3ì̦nÑr?…ˆå"[µ7.½ _äúíægßÏáòU®©lß RéŽA£¯©,D©á­â'/Ÿ9cù~}’Ëc½‰ƒ(aY¹OçÙ²øüBõùF)šó‘Ö".–„¾ÐPÍèN{×V¥· Q¿¬b´#,, ½ÙZ*7!®cšqÚ—i¨#Ëe›@M¯‡2³ 1jDóºŒ ã4‘êØ T콬Ç&»Fqìÿæ,03î° UŸcæ‚OþL‚xs­”jǶ³ÚCÞ$Τ²pço[ó =‡Yƒ,5¯°m¿Ê½nHXG ŬV“^ð‘zJ”oZV_ß·ûÙðJ ¶ƒ$=…»÷I7E¬‚=‹°ýG6±xH±ë!ÞùÒH* †Yìù|[+®D¬i ž¡uk—ˆô‹ÓÑÀ¹à2ó"ø.²ŠùôÄÈ¢6¨/Zp¥ˆ-ʼŠóÏÖˆ‹PRæÞ©âWi(ö’ÐÁŒE‘ÂÀøÑÇ›‚^g´š9'DÔð8ä…dq„%¬]IM ª~=%®äò=ûJ×CôWšž î´~°~¿-3$žWpOyÉû²Ù¦šªañf÷OS5VÔ´1Òk%ý£z mó£\òÇÐŽ€Òõq}òŠÚñ›¡-ÏóR@ŸMðÁ,ýiRñ,•¡¡òp ®Q‘l¤,C,d&Éjæ`‹9Œ‡ä;Än¿º\ùïåu/{ÈRÊŒsÕ˜…¯*?â¤NHwØžè>Qv~¾{¿O~M„ÏCYáóëV[Ò³[ZÜŠO™øL&«¡ápµnY³y6LApÆeÿ 1Ìë°<éë^+O}¤ÆDR•Á…™‰m }dŒt&¸ss*ÜOsk©ƒa-èæ¦Û0u»¯æaBÕ¡êÀGÿš²ï­Žò»v]wv~rÅXG%F—ïÔL\‚–uÌ\ug Ü=m…"2” ©n»=ÕçØ* ;}©¦Ã¹>ºm@dŸofìºs”ÍÍÏ^Æú·X²FœaÕJGRˆ“v ›à¯r:KDœ#)TH}®…ÏJ±&­°pY®Ö9QjÀß(y ÿ´Ð®>X)W@Í@g‹ÆM7áZÆ(УÏÏ!“ÆYn<ôb$‹Ÿ…åßëÁ˜êDï*6 Æœ°ôœ™ƒ»Ùìo«ËîcRv±» Gy³¯Š Ë\¼©Þ“ŠPßedbÿ\‘?uHåz00;tÖÈføÚÒ½~Wn¯œ¥ƒ;»@wr°@º±{—<µö=àÑ%Bû$ÓØ…õk6\ÕVz ÅT˜Cø‡²`…Ú»LÖD¾öhKJ—’§7LÖg#tòrNßúLÖ…š›ŸIÒM¨ÝìX$r×ëûQ7|¡îuÆúeëñzÓùƒ^¯aÄ܃46P¨¡´bv1«±csï›’ñ½‰šåw&ÄÙ·ä`#Ñá«>DÃ(àknº£tSÂB¤Èî¶c^4AüBóΟ@v5éAøyiuŸü´¦$kÇugi_ïÌ}²·uÔo ˆhVDÒʪV[B}þn5‡©˜°ú£K1±‘n@¡9KÕV59 €Ž|ˆ#P|%jf…ÉÄ… Áˆ»¸æ{ü9u˜÷™ ʇË=bØú@ÁdîDqÊÁ3C—cPgü•tã*4—+»Ñi›>òÃ&¯±n<™¬0¡vŒÇ—i]Àøæéõ˜W¾Ó8dÖÀísm• &î&²câ…$ãU¢wïh³b®zmpA3\IѶÐÌex(Êúßah]ðÏú³ü-xá+Yñê#céÝ{îCHtÚÁ%¢‰hzï7Ëõx„ÇüÅ®5£ÉëvãÛ™¤2åñ¯& mšw¼ªFPLwêÄl$Žýv »î>¦Í~šJg*\U‚ßç:Ö® ïÐâݼdP9‡] Û“n%h‰ç˰4¼iëvBØ5«)J˜6@q~ܯ–ΩT¼ºr†HoðŸdäj ÊâU|S¶ìΜ¥˜rû<;7ô^dâ=/¶ð"Ú™2wé4º/  #¢=ÙÅ€;VÕ»|غÈ:™*îDíåhõ§÷Œ%‰ñgZ6Æwâ–*ôi·ŽªþØ0M¸%þåà’¥)¤ÃZÅtïN¶Ínˆ™EB ¬«éÑEæQ“Ô~b5ɃZMcþ8ó]ÊdIFI®Á¯A,‡çÈ2ð‹33€M”R²1<7ˆ“w`t†4|:!{¬x¼íœº¾¤e¡ÞIHs¹‹Óð÷)&]θ.' >õ_Š9‰ßIm¿ÝFêÀµ_c)•ö¾³Ë¶:[Ì•GkXÆRÞú‹QÁ…½“OðétåNPÈ÷+ßtÙö/0ß“¸ú5å I‚„}òúæJŸ×ØÌi`Ëo ZI“•*î£Í2f¼E¶L³ E^¢å~amÒGI©¦> ÓûÝ÷zåÝ ñõ‰âv7ïu››¨o{V‡=Äy˱å{>=·l«?,¥P<Ü'OGOÞÈãû9ŽÏ\0ÑÕäÔmá„§™.¼3’ëz¯¦)’šâzå6ÁŸ ¬ÂjØH8|D Wøb.YÖúŽÄYx\Í_ÜãÜ tV¢ZZé Èvòø?Ræ¢ÜŠw^~å`?Ëœ¿ûx7þñgqiåã<8Z¼7œ!ÿôÉׂe:·Ý8X9Q¥Ä#—ý7Ox0‘fH{ Âs b]®>¼C(Eƒ ò{Çü‚îuGZ xHù ú©ó+[µö ÁÈ{hýó¥oÒp£Ÿáôfâ§ø‡ù)m¸ÉçýÉ<.-Gšn2+²º¾„CY;¸%³VêÀâ3yÚžºE®åÆÂGsФ4ŠR”õèzžª»&þáæSÑ6¦;sg™›˜b†¸S‰YG#¹¾ vBÄT†Ù–VÂ>rѯß—Êt¶Úê¾»jð€-ðlÂ_ÚÔ|®º²cÏQ#m‰ø\}f¹gªHñ-9'¥e'¼Øóô:ÅëXY™¾†öÉUR¶vìZí‰ázõeêªò'¼ƒ'HÓ§ç|¶›«Ùpî4ç$[ú˜4à4ã07{‘…%üRH-6o[•y⸕Cy §Z³pt´óy;­%¦âRˆ]ˆN,6pÑß#¡m´^ï6*ØLg­ÎÙ2]Iÿ:*ÒlˆÁ Põw°_7žè¡Òý4cüÿò ñ!G¯q´Tw} ¡ÏåÁ¦Þ{Ä;ô4™BŠâèUpa/Ekî{&XqƒßRœthvNUyƒIÞzšžiµå=)pÚwEK‘Rs væÿÑmšk‡WW1ðà,6|ƒ« †’¥NÒJ¡¶‰Îƒƒ>:VIò ºƒ… ÷+ˆÉ Kn[µšÛ0½n1à ƒy6>ÓÌ‘ÿBïRÐXì-=¬$3^tÆLžYæ‚B΢¥4ñž!¿…\ѽ| ©ÄË‹9ÙÉm)ttÔ‹áÒ#ÙÝeœLز‡LK£׾Ÿûô@¬ÊÀ#7²ä¼·’b›ÏÅ0F™FŽŸWöªå»Iq’´à«/e´mŒ‹ÑãÈ·üSÆË"à•àp{¡i]Zg4°ËýO>5{õ|'ƒ0zZAÇ ”ç¹^Ö#Ë%&2»«¢#KÙ~†»Tƒ‹•“Wr&>ùï8nëBI{&Zá*Çí«•s=A@ˆ2ú'/Ôæ\›ý‹ºñ¡rƒkè‘‚k´áU¨^ªÑ¸fÓ ÁeÒb­«¼”8 Ðr–,ÄÂ,´Õ¥x·Î/ ŒQ®ÊÚN…ú‹½³™†}+”1W t•4gÄè!U´¦V`üÈ„‹7IÑw»©#¼¨øÄeqäÖ÷WèôpÕ<«‰pK°@ÊÙ»Æb>§öÜâJÒ¤´Á¦{ÀÒîÍíO%„²@¿MB M™à+鮨˜ü]>hc•Ôó§d¤ý¨ùÏ$¸¢ËDj/ÝU¬v~é>7I„怔ÿƒo%ö7€·æ¬UDDoyŠÑОÁ‚ÈŒ5¢àÛ7„^¥³AÐ "H'k~O‰íÃÂl¸qðDƒ=‚¬³ùæi \ä Ó$’¢^±ÞOÔ õöôÁ‹ū½Ò\AŠ,_b`„5 ˜4. ª ^Wð $¿L³…Ï´qպ㡲ú_syqŽó·æ žwôœ3¿üÐ@,†KÁzãp ô>=’H£©2ôS´\íßKñÏY­:ò»4H*mÀÒE³3ó7’@­Õãy½@ö¹rÓ k:6g.ÑQòbD5ÓîCÞ‚˜ôTÏÓÅÝñ>áS¿B&ûÎÿMïïŽç;Ž4«Fp}‰àò³JS^"ñ ß„Á]·÷ÔrÞ\ã•.T:ÄÒyÚ1ÿ.Uƒ˜;ž£–‹´p¤"ðç#AOßú/$ú}K%´.¢™ûÖšûÔ.ÊmJræôÒ¬„ðÃÎ$nÇ{˜if¾PúÄÀ’)$_W|,‰¸âfËß.ÂQjàsIIգݯÿ ‡€@(Aœ÷<“„‘ØåþÐ1—ô«… 9=ö|OÞ|ÔoŽåèÏ*Œà¿q8¯¹@¤\œä,íËÃøô"ûRÞõâ¦W×ï^mªæx®m©ƒèÅëÖ¿W“Æip׃4¢Ñk|­k`+;Zy*°Ú?vvP….(°-sO«]j]…˜O†±r)iðxJñ:} Œ®rþ„âˆ1:Ëræá¶li¸Î¾ ZÍŸCÀfUáõ‰gŽõ~Ðe¼'Ã&¾X×:;r‹áBD—±“Z™ÞÖc¿‘CÇ+í»öŠ!áÞ0Šœxjþ°@Ý ÛäcÝëÚeí>_}¸±¼òØû‰µ·zðBŽ š^”¤êビ‹­¨:÷C#M ì/<›R?ß`Öæ—àßN·q‹a4€å„—nW~*, íK]ÔI({)A‘µ×Sõ숯¥{G[Y¥³`ŠXaH—ÌK“6¤P ba1M­ésÃZÚkX'd"½¤ˆÐÝn@ø{ñR­•á05ÍböV-a`;êó‚N•—zâäŒùŸ>ôŽÍ:k`=Éý˜t±’ö’ù¸ß>s"³&ejïµ~MÎuQPϪäS ¬`È•ÊÁ åëe™‡û\+2D‚¼äÏ÷ä@K*#ío¤¹<øhÌv]m}gX÷­ÆÎ©×dÐïc†=p)Ü)aÀ•Ë ¸BüUÓ¿TWsŸ á;‚Ø5x_ü‹›w©Ø™Û[8lî Â‹)`£q…[0ADíBá±Ú²FR°5½Åu9—tC þ¸“H.21bfˆ©Ürx/…`¼yiùÎyÖ'¤5;™W=¤>óò¸©¥hBdo‚Z·Sk\U“o÷Ú<öÝž7swºâø>Éœ ç„ Gí¼À]†Ã XÑz1ÊÖþ%š6—³áˆ£SifÓ`àLü akÈÜ QÄ¢ï ‘FãÇ¥Fân:¦ÌTÕÄK¬Ü 'h÷!,?8‡˜ý‡¹«Š+’÷PU¨ó³/&žÏIk<ÔybÔå:rÈ'$­›ÔÌÇL舔AÃi,\î÷ÈÕì‘Å˘3E‡y—Þ•ùïû~¹©¯ûn k*%ºC:ÇÍdM˜Ò«óË’ª= ~ì¥Ì –pu£¼‚RŽÅb³cÃ…*+‡QÊŸ¶½Õcà¸yq#i|)4ñ\š­Éi?KjO«˜œ–VŠ0»´µ}Œ&äyšOW)ãwoÚ Xú„£(¤þbîÿT•!ËÊ¥Ÿã%¹d7‰Yå`®ˆWTAºØ™¯g#Pª×HþW„îŸÉÅG©N¿hø”{šÐXq÷3»TG¹*‚ÐìñÓT¥nõã7—„ª <‡Sy‹*]œfòåÿ¾ ï¤ÖZ7àR}Éü%<>Qú¿çÝûÅsˆ"öy,Ó•TàÔs!öŽ'!Òl~“µ|8ÿí\œlzÁ¹4ý¸4°ÆÇ}€©ÔçÒ´‹ 'çLüo8=žÔ”Ø=ÁïØÔ‰uº4p dN2BÊØŽ*ìÅ„0Ú]T5ö¤©ÔI*²™2¤Sõ'ÐÆ|—wÑÀV,ž4¦ú:ú“ÇS/z l‘³‚q :IúH@o#N?ä#Ù0ü‘8/•$ZÒ¯fÿÒøXÖ™Ò÷E4TõÿÊÜTòaM<ºYµ.ܑЖ¶Ãf=r@ o¡‰ñ¥/|­ö·ëïÄA…HBûd¿(z-…ˆ„*‘p)äðýÝi¾¦P¬EäH“Q0m´´C[ëW3uÅ ];Nzn”Oo[GÁ,‡A&b[¯š•t„qP»}%æÄدHKÊýmqVæü\jdM{CÎ~Ô ë¤ž¨øÀôWe…Ù¹»ë Ùv¸OC°!w\a¾w=F¥ïCÓ䘈hÔ¶BeÏW_Â[ª2Ë¡¸qhK¬éëq‚”ÑX Ó‚¤ê…Ü_uùPAåeRTĽüüM¢yE¯Á²Ì‹vÜÀhÀ­m/Çìdåj’ÌŽ*Z¾ E0”¡ž¹º³'ÇS¨ðƒa­×Iíô_´^eÐq&Ý8øIéÍšJ}x^æ ƒÁÐR™äÿ« =ì[… $Ð0ò–ç_¦®oº­³ÖË™£ßöÞŒ#Ð-žM9(©9ÈѼÉ`¤iî/X’CXwKÁu­,eh×tŒòuœM‘èSw•BEÅZS|6uíz(–ã"Ä«ÕŬ-KöЄE¶òëþ7Á˜6^\ŸA lyþ[Üyæ®x@³/[oü‡×̔ٶLžçBNÌÞ.¼Þ—Éà ˆ¾Æ¼Ï4ÏÅiH{Jôg0;©ùZ¬wÐ6¨Í‘k .£ß À¢Ž„Yì£%Ëãì!¬+ÌFk…µmÅôÑò„|ŒrÛ 7]Ž<˜³µí ­Œ 1ª‡!v›¼ÔfBfH9s - êz«ònÿ¬¨–xæ ©C\Crú·ë(cš¯Á‘§øÇ‰ñ´ÿ s¾î% »ŒYáZª¿`’KëÎbd’]à‰gdQuk'¹T7Ûû²¢I1VZ¥¹ ?ö±õö+Ì3°4æ ±¦7ç´¦‡›Ù X¾«Z¶æ#²YX£ø]ÔiG W§È ¾˜ Ê\’ó}¿åTÎë©|¢ -ÕI/Q¾å †È=d=HÎyR·6‰¸à ôÚãµ®ß?ñÚ4óYŠEܪ¡• v˜˜é©ºPˆŒÜû©:¡äs]6@ÿhGqÑmÑsí­§ÖË7Bʽs•{ÌÜöGê‰Û§ïz:!ìü¿3ù‰¶ „0ÉÕ¿à–ÿä&¯fÞ<Â>0„Aæ8©Åäî$úáÑ/u·DÙ¶ú’¼Þ2‚ë="£Ùr)¡v¦íû0/ =ÄO_èk»¡›iho{SßPèðIO÷ÚqæÖ7Y/?Š­Í&#ŠC\BC #j˜b»<Ò`îªÍÖÓÎôî#bûëñЃÑ!Kìéùƒ¢ê €<4îó·‚ùRµ '*è=·–_ Ñn®žOSx°ƒôŸ€,Eוÿ‘H¶ç=™Á—6ž°ÜÀ›õØPƒÍIçÃâŸglÀ4L›¤÷µûꩵ?[øS¯%Ri!O'u¹îêåË"­DüKŽ3Šß߃ÊÃX7%Å ‡Ù†ð*µ^D?¾È'“¾·í 1ëÜ€•Óq.¯ÒuLŽWaŠÜÌ[G2Ëcò—p—`#Æõ¯Û®éï¥ó:ÅW?·d; ¥6-§ìmã`Ò§tU=žX=Boÿ£Í'¿bÜë£"“uÉÐIsÇ-Û¥¹–¿‹âœXì ŒÙøY¯€£ÌÇ4Í«ê*‘lÃÝÙcË•¦íÆÛZÉ'ú%kjö,¯50yê4YÊE[Yw¥¶¡*¼U†!üøwïΊEerl,¢À`ˆq¬la endstream endobj 3680 0 obj << /Length1 1398 /Length2 5888 /Length3 0 /Length 6843 /Filter /FlateDecode >> stream xÚuTÓýû6("LAB¥a”Ò0º¤$¤[’±ml£AºD@º;%¤„$DAB:Dº‘þ3žßó~ï{Îûž³}?÷}Ýõ¹¯ë;NV=C~E(Ú¦ŠFáøABÒÀûÚÚê a ˆ€0€“Ó‰³‡ýmp>„a°H4Jú!îc``Þ¦ ÆáÚhPÃÙ‚Ä¥AÒBB@a!!©¿hŒ4Pì‚„µ€h à¼vtÇ á¾Îß@.7$%%Á÷+¨èà !`PŒCÀð!`{ !‚„áÜÿ•‚KÃ9J ººº €°h \Ž›èŠÄ!€0, ノ Ô;ÀþŒ&à!ØßC´-ÎŒñ{$†ÂâCœQPˆ¯4T×ê:ÂP¿ÁZ¿|À?— €þ“îOôÏDHÔ¯`0‚vp£Ü‘(8Ðiêªj àÜp|@0 ú¶Ç¢ññ`0Òlƒüj TUÔ‚ñþ™ Á qX,Òþ猂?Óà¯Y½vp€¡pXÀÏþ”‘ïî‚–û…vEyþ}²E¢ ¶?Ç€:; £NÎ0uå?¼ ð ÃÅ„$%D$Å0' Ì ‚üYÀÈÝöË úiÆÏàíéˆvÚâÇ€y#maø€'ìâ0Î0oÏÿíø÷ ¡Hhƒ#Q€²ãÍ0Ûßgüþ1H7 ¹ž~  ÐÏÏž,ñ ƒ¢QöîÿÀ­XPMOQÇÈ”÷ÏÈÿq*)¡Ý€žü" ¿°˜$$,”À?xÿ;ù§¡bÕQ¶h|Äï~ñõwÏ.HÀõG!ÜÀ'ÓAã© rýÃt !1!þ ôÿÍ÷_!ÿ7šÿÌòÿdúw¤êloÿËÏõðøÁH{÷?í›x,"Ö ™˜ù™-þÌ*;­jàÛ\?Ò3Hs4~e¶gÁþZkÿ®4v/DiÑžÏÓІávI¯ fü&Y°êìwT<®¡kGõj DY·ŒŽ¼½¤æ icäàx¬ Gë_í + €Æ¦êmý1ð–Çg‹êjà 0•ý“®DÜxQÁé™t_‰Ä¬TÜÕ¸ø8š¹­(/A«ZùØ(iFÚ5’,]è÷¥µ= 'Åu%÷å/ Ë&5 ƒýd¶³ ·®UyôãŸ6÷·÷Fš¯O–l 2:T µ-_ò£®ÏÈë¤ë¡ÍÜ›Ô 7¿Ç"ªBªÕPpgítž<¼xGBüÖ¹½óše®RïI¦GЕn¾l“³x%lÎ_lò¨q© Õ‡_ëYoõ›Öz.±ZÁ½Ê\f@žþn"1”åïb+;²4I—jæ!#Ó] .¥te& Ú<°Ž°…€Ù2š?Ä‹B¬\éI¤Tj°À#•Æëý$ã>å—š 7 4U[¿Ü\ݦRO”iƒÍŒ%ÈæZžz‰¿ZT9uŽçª+è^®Br«4)ŠO†=•_ôñ?Ÿ¤•LfÔ¢æ›]ôªc¿#U˜F ˜ÝÙfˆ™è}ž‹d€ó?ãì÷–ôñfµ|ª/s/Žs¬ÕU{@RØcsË+aÆU:¹•hû;®’¼®‰\•,iX ŒÐRìR’l%ªux1dûä"í%q‘Mê’†ý|á“KYfØfÊ$£eí“7ºQÉk.a+;zËÊ ñêTLù‰ý;„ÆÓã’ß®Q±ðV·z<ŽàìDô,2¶NÙ|¸ÉNóÕèŠs=¼:l4ö`Pxo-W™©übÂ.—;œhøæi÷+»>ú ?ɅŶÕÎSp.—‚wn•CÒe`aßP³èÀJÉ^!M$´ŽS£Í|{º¿Ø1‡§K‘ ‡‘šügã ÝÇwY2³\ Ð=ù¦ïÌ€|…Ç0³Be›¬éý˜µ©€= £~BFǤY œ0GF·¤¾BÌÑŸÇÞÖÅ–LUTÁ}N^4š\aAT|ÕÈìå~ÌüÊ“4¥0í¨l©3ôЗñN©eì‘ Íníï¦]/a& ,Åå^/+“z`[,ï;©®ˆ–Þ_`Dyé²…]søôp¥'µJùú„⻌“žUf²ÝÜÃÔ‚)©Æ±¿‰ü'»oíP•ñ^&!®–Ã`#ÞqÙNOMUyI‘+PNqÅÉúÇa­hNî23µAšÔÙg÷cß­Û]ë£'õ>)ÁÒ§:¬MúñžsÍ£c`ØD%³LuŒˆ%KàÚ:ƒZŽ$nþ‰þDð ‰N³Ø=ó¡^Ç$céUßEƒ× ^q›ºí6ÆŽŠ]ŸÞ÷½æ¥üï9k-ï!ú ›>i²V´@‹ÂÛ’ ¿˜ôUŸ9](Wõ‰„ÄRÓ(o’|@"Δ¿‘ïèùíŠ9KË̼kî7×¾ìLƒË8Õ>×ða<“Pb9^{ÞÔT³s®çé^Å  VWs[í1ÍM£‹MöÝÜØ½|‡¨:ìšÇä`Î @n]êz”(¤Î8¯"u¡ÝɃî:˜L7HkÛÐ1WÎ^V¡¥÷™aó’X ¼BÖ¼eÙØ3ňè¿Ð’Sº(âT:U‡§O™>y“²ŠÈçi0Bê†Ú OEg½K×ÉTÍSÑ$ù<î« .Žá~‘ºuséè©%UcíñƒœÀÝ…1UѵÎú½âï_ˆ® tâ JŽ,j‹ Û]Íðä⃒µ·ópÿ»ƒ7–j]¨@ªöb©pTÖEÍFN_çtà$ß`Ð øÞgëa‚•ýI¹´òÖ ÷ã7r×0—oˆÜ¸eÁaÑA›5ÒÓYyP£±Aä}) ~ÃiîªÂÃw6ésÏÔÑÜ|_+Ôç3„<’||/Zý.Ïô ‰!3ÆÉÁºt‡d#Ìd=Î?ÜpKTXXã-¿¶ìG5ªLº7vÊp©*rPéÙ©™˜èNž«¶Yñ² ┪ůªjvONF)ž÷Ò_çpù!*&|UÓûÍïa\à¢[QV oÏ„âEú\ñØÁxAœ‘ÎGrUvƒöúšB=t+bÅ­ƒ…·ÁHÜv¢ÄDýfýhc_,!B©ï¢«ÍÿÕíß=»eê>Ðd«j?ó…ñ¹žnW˜É»\¢–ZéýñKk¨’"žˆ¬°gÊ%±w õf[0Ûõ^ň®|µSu_? (Â51ÿzkEƒÏôW×÷ùêa|f ´m-‹8Rè JÚ´¥„ÍÆR3áüÃàìDØö€òÉøb¥[.êÓØÊ–£E?h‹ŠkoA€Xc\²òfVÅò¢Ë^ð,ÆæîZtm^q¥MY´‘{¬ç±¨|#—òÜÞ $ëÇø ƒâ*ˆœß­½SR3èa¹Ý20šOûšÆh£ã{n7°}ØñéѨç†ÙD$ÁŠq$‹ŸôÝ)âÔ‚£²ñ;G/òï9 ŒÆìRÚ»^Êóèì ½ÿ*öá„}<¿9Þë[f¿sL«Â^`-iw§mf—Ù,'<@ÞàÑ{ŠÔ ñô+ì‘»ßVùvåòÔFÉ,(Å*Cd¬gÝ),¨¥V¤cŠWÛö¶ 8>öòSö) ïGÆp`V¶O*ç>&%Oímotí g_ra:#¶2µÏ"Æ—òê 9æžß7øòc¼¸K‚µT¿“Ü£Á»qaé÷ ^à<­kè%ˆu“mߤ5ÃzëŒCvè ÕMNŸ êa€úèá¿À ny@‘ŠçÂêØ ±í>—=³{¸ð†râžÃ›Á ¡­ i¸P·½èJ«6F[ëüÂZöºÕ«b&ÛWU=ÑÔ“§BÍ}k--_»=ä .úHÖF´ÉüŒ,`ZzWM<€Y¿wöܵuØDxè†Ù=@5Ì3’6S”Sèqvd S“K…°¾éOèÅ3#|íè’VH^ñ–«.­kk]PêwG“ÁÌ@ëjêàˆ@I Ùï«Öü:Åörg½áù /®,ßOx˜ˆÖÊ×éÓM«ìøx™ó1A@лó8Õœ§3GvcÑ‹V;:4{‹ÀfÛ×yÄHœpúQ=ÈVÅ©ºÛ\ñmÄY„ peMÑÐ2Ø48#ò¸¢d6­°c-6RÌõ˜*þ¾Çû‘RŸ%i§sÕ‰G«<,ÏLÁ/ìjƒòQšê ñ–&Õ°.šÃÌB?vFÖ5‰¼l± ¾ö>‰WKÁä'ÛbV[¬ù„Ó÷ëIK_ic‹aÃ9 ºÚ,Jh¥~±û$Æã×ëÚ3^Õë¡ÈÜßhÖ§’}ÐáÖ¦¿»À¬¼·R§Y(ª÷3qüâ]LaÕ¢Ø0:äw²“‘R]@g —Dº‰Å­37AZ‡hx*ëlÝ?¿TÊÏ ì"Q\]”|!¢hΖ·‹kAøÒÃßM$æÍ÷ºå€C$Qä>”ùÓAâ%ö~¯bv®sñ#¿>¦„bR_ººçùÅ7TÌ¿xùEǾ§6 tk@Ôˆ½1:cèm$i¤9M”ýªU}íÖ-„ëù@Ù3·§ò?ØôÔnꦨx¹{¼ÐìWÊ8M ÒßäHŒ4›õ,ØØë ¾CY<V('®^—uÄ}±ªgw2™±¾Ml¦TÏí¯Ä>Æ8Ñÿ–=zÏêǦô]0ˆlûFÚ’ZR)…þÝ-òég”ÈB(V½6‰nóŠþe›-ã1¥ÜNþ›¸LØ{c#‚°lcþñ^®Ëö ŸoÓg„e¼Õ®~ÄЙ;Ødº<Ü©þfép/#°œy=Î܇Krþɤe¾#âc¤MZ€_Ò)Gb‰NrZâxÅYÒr@zNMÆ_“„LØõ€Ò*»o\¾/i‘Pa T+L,¯ióªN—Uuz6‘~ ‚ì,×›X_·*ÛYU÷-\&,ÚøX9u{Ջ䘌½YtÍað)¶­L|“‰@!ÚÖv3Ã~¿4¦Y];Ó-²=×TLÖÚ¿ È­~)×&{%Äm}Ü„4d³¢Tsµ Œ®¼„´ð*ò®Ë¶‘A·’§ç[‚B=ǯ$£Ú AOÚÉNŒ›wew\r¾m_v?ÙÂ=ÌØðyyUà?3oÒ$çÏjâHî¬ÍIö 6°#Úd°4d–]+Ö$˜„Ù?R}O°¼óе`;åÍë  ñÔ“NïÐp)},ƒì¸…šÊÁóÓUãŽG—ö߃N£i£¤ßN3õêT–—­WŒ$è]5˜Yjçc¥¶ÃiójØ|ahZ—蟅«Â9 l핯ô¿ÞH&n&Hó }ó âMx“ÀõHzÿòRk•Ú^i>çp?³Œ¨þšqÿu ÒÆy*~=‹£ó/íýUØåÑ»ÃÊ2_‡öRÁ•ÎÅ˘a‚üGì쬶MûijßF‹6/OnKÌ?}" Q ô·§|NÇeiG4í”OÙ¾AòS¡UxtI^¶5fhÙ"ªs7ž’à‚“—*=«|öfJ AȸJ(ì/BOrg h ³©5ñžàÊ5ÉŒ®jÞ„áá‰ÙÂÚîµI>Óí…ëeõÍ,¾ôåÞ<¼60å)_¡¯aUì›.ŸK/èÅv=ßPÉŒ›Xõ1,4§Â¸2zß3>o«…¥Š©$@‡*~°ÖKù7}2¡SxœPé8êý‘´Ä5÷”Émh1Œ>mÇ«ÛÜ–›_ÌgòºyÁ$îŠYÄ_ªóo(öhJ/ÂÚöȼÀ=«Ê¢€ð S ^¥»Y(×N6oY~ßqZ¤ßZñâ+"·à׊ ;"]PnÅ)µÜÖlÈÆP“÷Ö’I‹6ÿd‹ÆjŠg¹¥âǼ`×ÌœYß’Ä9ÈeÊñг!¥å­1‘˜«‹¥7  ªÙ “xóõA?öPÅüU¥+øÙ‰§ùD˜vì/Gù¬¼ˆ?ß°?ƒ_¤jƒ_šìœ¨µ×u++<§3¹ Ï•-'æ›2ᡟE/µÊŒªTDõ‰‘3mc* Ÿ&|T²-Hyt(uý³1½‘ ”6ö×븽Ñ~L©nY!Oí$ÁqÄ×¹ÁZñÉöû}nãôgyá˜dùÕôjÓÍDLK~â«dâKô$ߘ¬œÝÝ™P×Ì +˜sX¾ÌIÓ·LÉæ®|þØöó9¯û*Óëº_øµ‘¡t’¸tV5æ<êIç™l vÚ­‹ç „^3Ç}<5ï˲ïÂ¦Ï  m! +*Ú|i#y4Ì´Ü~›RP×y'щË$ðìÙ1 ƒ€”-O÷À„‹·Ô.:5ßÛº%lMá’'Ä¥ŽÇ9E' —ÏúBJW%ej¾ä;™Í C/‚(__‚‘xÕìîŸÈtEÐo­¦«i´õm’j¿z(ЉÊR·½°r‰}2×ò“éêùÀ&md›‚Eè/½dÃÿÃQ <Öê/=ä&|ˆÂ¾kï xpímTëýX²ORcÑòÕ"Ô|°è$“øÜ§kåÚë{‹´/¹:âÍuÖÖŠ›»n]^{¦›Â ¥=ÃTd~@Ý $1Ë™jRÅ)\u›.·8¶Qëk —kÉóÆÎÜË'¥*ESÛÝ#È\®W› Á”Ï{îôb™ê¸ ‡‡.Ž4+ &±›ï6wójóë> stream xÚtT”ïö.)]‚ˆ 0€t Ý)ÝH§ 0À30 ‚tIJHHƒÒ‚”J#)‚t7Cÿ1ÎùýϹw­{׬õÍ·÷~ö~÷~÷ó|Ì :zÜr¶0k° ŠàæãŠkjª €@ Ÿ™Y‚pÿuã3‚áîTüÃÁ ʧB pš0(@ÍÃÀ'àçü@ Ø¿€0¸8@ä ±hòÔ`P°;>óc˜«bï€@ó¯W› ;€OLL„ëw:@Î ‡Ø€ MÂì‚:Ñä ЃÙ@ÀŸÿ(Á&é€@¸Šóòzyyñ€\Üy`p{iv.€áxvÃ=Á¶€_´@.à?“ñà3ô îüz0;„ Î0Ô•áµÃ¨ÃzªmW0ôX〠ð÷n|<|ÿ.÷7ûW!ôw2ÈÆæâ ‚ú@ ö;ˆ3 ­¤ÁƒðFp@PÛ_@³; •òAœAÖ(ÀïÎA%9]5àßñÜmàW„;;Äù׈¼¿Ê nYjûæâ†"Üñõ§ƒmP×îÃûg³NP˜Ôï¯aÚÚýÂÖÃ•× qó«*ü… \øÿøìÁ€PTD@»ÀÞ6¼¿Êëû¸‚ù~¹Qø¹Â\v¨!À;0êßÏä  àà¿ÿøO Ÿ` ±A¬Áö(þ?ÕQn°Ýµ|8Ä`Dqüõû÷›Š^¶0¨³Ï?ðßûåÕÐÐUQQâü3ñ¿còò0o€Ÿ€€›_ˆ¢« @õðŸUt@¿]ÿIU…ÚÁ|À?Ý¢®é_{þ%Û_q°þ³˜ ÅZ0€í’›…€6¨ßÿ7Õ§üßþ«Êÿ‹äÿÝ’‡³óï0Ûïøÿ¹@œ}þP¤õ@   CÉúßP#ðÑj‚m!.ÿUE€PBƒÚ£ÈÌÍ'Èüㇸ+A¼Á¶:„ÃÊüñü’š3 Ö¹C~}[PY@àÅPú²qB}?ÜQ¼ü¹£Ä†ø½Æ_6%§ÿìCj³ý¥;~!aùà£V²„~|(Ú‚½3ÀË…!P)ÔÌ;ÿךù€B^È/ß_SÀëüÉ'à…ÿ6ÿãT8ÕÖo² Zú—ý[ú`°7Øff#êXÚ‚¬’£ñâ^’Ä>HGósZâ"ºGŸ.%éegͪ¿UšéäS²tü¤%ï†|ý}ê‡ßj-}à7½Ò¦=½uÂäíúx²ßùCÆI’hyF©òtâ%ð.4ÚÒÏx2¶ö]zÌ$þ¬5ÓÉ^,o”DÔÂZ´>~®z“¥AùPÌpwù ¢ÑºWM脊5gÙ%>d%Ö<*M+ƒQ]òã~’W%ébO_ïY'm[Ìs5ÏàµÃGá2E‰Þ‡ ‚8•†sùÄ×9%ž;wý¬•Éewl»ÊØS‘5ZÇ«Ç; n¯¨:qw‹4”“žeäÅõ%É&VýH4Ÿ,€~§ðæú$Àb½” [×Äx¦ëCÐöm4vMðà¼mÜ#ï¬lêx_ü­áüø÷;Q¡¡q ÁÚÊ7l.ýdñ8¯jßVœ>#‹Ns ÇŽ‹ïnm¼Ã…Ï–¯8I­9vI%‚XÎîn¿°ä/yYÔü]ÖÑñ^.NÃþeQäêÊÔÕÜHⱿöâ; ïÀœW.N Þüä“—l!F‡…2üsU+1‘‘ -#Òh—Ó¾èQ¢u¾l¹·bªæû˜©I?¨žbc2 5>»Â+8~ÁÃBPÖQÞ¥Jïí x€SpÒèYRý©UFï à‰Ñ¸PÍKMÜäØ2úi5­d æØ KŹփÌ_Y]½ ·8és¢SÎÆý ,3RŒý!7àŽìg“Å¡*eŒãåíÉ£Ä÷ý5²a+ÎCRù¡¦÷•^Qmg?Ï ~Q›ñ¬OŠ%xˆ‰õBÚ³íVé…)T aM[GïZÉr¦n–kðýVS¼íQÒ%^!+–¼ßxðù雸Á3ý!|šù̸ØqbʯŠ{ÎÔÃS•½µñã‚øøÎúgg¸ßI|í^¹­ }¨Ê¯Š¤E‰ ùÈr»bÍØ?´PVi08ãÐUÍžd.ÐÈ‘ü”­ ÓŸœùj)ÑÛz%àƒ%·IB¬n¬ìÉz'³rðîâÀ—ôõÔð¾ûƒ<@ý ›:/\uúS`y7àØ Îím¨/V,ͦkáÀgÆÅ ªåÍk6<ëïÖŠ¯î#WÖ† c¨´‡[øi(#)“ŒC•˜÷Onx4ü©m¶|Šî‚IÙ2ãùÄܱ<ŸLG˜HÊø’)% v5·“+è ;B+4D éZ5Ž(Ùíï¬^tŠ$QÜèÙX˜(À•¯©4äd7°1m¢¸‡jIáá‰iwvhi¸ 1q™Œ±gJ{9—^9‡ïž„Õý°Àn÷ü=Þ(¶4²•`ãU´Z+ƒÛñê-YNePžÕûó­dËPÂǪèWD˳íƒÃT ¡·ôX\ÜG ß;%š~Ò<*Jx<ÛÕqÙ¾_0íadáÆ£„n_Ìlh¶„ÆÀ‰Þ[ÍœM©oa×Âg/ &]¹)%àƒâ–´L)ý)XUIÞ ¥øÌKƒÁÖ{X>£„¤Q÷ÄIyL>rcÖ@ù: ârOœ Ý®ú²Lðgp&#EøQÂÊiLË{v»hm8Ó«uFî)¯Ÿk' îê¾î,®Ûî¢6˜u3?6•ˆ:Ü.>úát'Œ+WÒ;ÿ»޽O°¼^QÊtš[–øîý½ŠWÚå'“ºbÒsåÒ")êZÌòò9ô/=#}Ê•í0‘Çtö–©×hOyv³^ëyt=ĺØ4ï>ùÞÒ\:uË}sta•ØBêßÇ\MåOsïgGvA‡ó‹aW1§H/w39}ãK-ª"‰y–^§"à­(;íZÕ›=Œ(…"!<Õ²évºíî›+–ù÷³:Czº{„ipÙdUI ùRØqµ$†°(ކtÙ/QfÊáI¸&h§+@EF|æe˜ZþY`˜ï-r\κ•¸ñ\ñÃ;‘ÎPLWpÃw®›¬)ñº/†ƒ¤Õ0W‚žÉœ&L…kI|Îquƒ,å$Óvz½™‹­C›wÇÊ^-ƒ$˜´7\ë@€ã½³>ÒKŠ·Yî÷³×e¯9†Þwƒc÷¬5¦éìÌxôUlGøUÆn~€É®IÛ½Çß41 q™’"ènߤÚP?#²õzÉi@”øá»ÒPŠ5•iagê—"m‘|;—Ú”Cýã úMŒŽsO­…¿½ï2ÔŒ! €²®›“H¿¡^÷S[­Aßè¼Â±½Ñ;•+ŠÑàRçgëÕ+Z—hòûÑ0G¶íJ0ÑÞ*ÓËÆ_Õ¬”rxzpçz:`Èe#¹½zŸt]óI›˽§ŒD÷M–LkÚ&RãžôâŽmeKµÄ|š±BÏg¹Ùs';¨«”W7ðp÷É3ëÓ÷&!ÈÅBk¬ÍNèdÀñ“ùÎH0ÕeÆú4…äÔƒèÐà~9ç!ëÆ$Á@SYo7‰ÖÄ5=³‰¸C!ºÖADV»¦ÚXNìîÔd/yš¡¾fQŒb¨Ûx ݪBŦ 9:Šæ}ÖGŒfEšÂšúõèzÚ° KɄ̻e@ãQpåCÖÒs<É9R|½ ùC·|S¤à-•{¼Å$‡ûfèÒí(ç4ip4]a`0U›)OZ7^R@ÁgOaîÔŽ‘µ?¹¥Äì ´iªü®ô¨é} öºH:1‰4}B•tOÏ(ÛYäà&¾‰,>ómϱx±°÷öÜ)–.é*šs^üXÁúcCUÀGõ&Pùx1¡ÁûÏo×X¿‹ÒÞôñ8Uνàôݭãª<ç,•¼ãÇ‹1Òç/Xá?§äíK̤³YÊæ “úŽ)z9Á_ bþ`1–l[†¹«A4jÑæ3ð Šf™%bÓ¨'„ZÐ>1e‰„Î/¢!Õ¥ †)^odIf9Þ`Ï1©D§‡™03q9-ÕšîY @„ŸbjöyM„iº‹@(Ç­Ë’ýPeÍÓv¦³|‹N)´ˆ”饸ªm™¡Ñ$©¸>öÁøðÈNqè#é{x’©ö>~už÷ë­ô÷1:éo:ÍÛš6ßVñËôÓ²*‚.)—@érª µ°šðRµs0 XbËVuFìJlNÙTõ Õ†7€ºN˧Œ¿…›>¼¾¸‰¸è¨yk¨?ÁÜ·êN6•b¤«èqÓ’’»õÌçV‰?¢dŠçTnËïÂxérúbzÑë®®"Q{C d¹§¯ÿ>“9w:ïCÿ˜a»¶íÌ{KÊBtrð:Ì ‰‚½Ïá‘§Éz_ý†–> ¿Šaaüì‘9é´ª ¯cœ“µ·a7Ý(ëEXÿ!s‹¹Ö­—Í}tN—éÊWä~}FÀ^SÅÀÕdV¶ÍÌý¾RÚ•ÊÌCׯÏÀýËX|ƒ^ÑØ·¼Ø÷ÍÓ×sSšÓS(ªæ*K­y´xˆ?õ8Lc‡•/°Mµ×ïón¼=ã½J8… Õð0_¹¶MÀì:…Wqã¥9ëÓ¢°9܆ÍUbçhg¨_EQL­LOqÜ#™¼Jg¯•úº}ÀýÐz\¡ãûd᫦€¼ l^®3ÌgX>çˆ1AÞ¼£F35›‘ÈQž“â´Çò:ãg}èfÔÚ~hÖŽÈ™°¾fsà9>©÷Ô_ðnÝî°¼C¡ŠÕžh–¦§Î­™ƒ(5÷¢Ìñë5Ø<iMsöN™f@ð÷éà´oE\ãÝÓí…¤wùyÐÓ²"“V ä_p½]±i‚Ÿ°è³pŒTY€5ë×GAu›•xïèI†{tÔþ4r¯Ž¬:Â=Êòç†ê jwùY«Ó Û¯â}ŸÈZ¯©,Lî±(ÉxüKÿv¢O¸ÿ¼ ɹî r¼b´âžöPÕ3Õ–‰Ùb9/cbìΔ}¿þ§ŸH5+… ÛÝÈÃÁf,cªÓûµßMžÈ’L$©ÝWÌçqDÿ–Åfy¤˜ºsK‚ùZ³XÒ®ýüõyU˜.;·ª /–£Á Üíó§(ÒÁvfz—±8– ÷uÅí¡Ôžmèt‡\8²þ§¤Ù‚i¯wá’8ðk¿ÛbÂÖpcWå×_ˆ“ੳslͤn' Q©<°ró©×Ü?›¹¿áHš“?ÇœRÈÍX×+Qi‰Ïœ2­qÔvåÄËo¸ŒÉÂegí{p3–T# ZÛaŠ©Û›]ê6«lK©³¼¦l{L÷ZõγTÇËš²'Iñ/&…^…âÐwø?¹ QÃ[kM¿\Q#ºõèä¤ã›¯å?mÚ6ÐUO÷•JLµtT)÷ì_m]Ã.hgZ×_x½ƒë~vjÎ`ÀÄzÉÚwxìt pfXœÀd±ßÍ4 ›qüc Ö˜ãM25ÍNTHi¥v üžý'•¼ØÆ6(Á6§ûÞ@ÉŸz{¼á¸º,Ö,±ísE&^6óQ"õ‡OÃГ7«÷X$½s¢îH»}N$jÇTVJj¸¦Û‰š:)­Å€¾P_—˜c^x7^=1ê 4ÚWÑÑ2ßL¾‘4àGtË}ëDÓ¶0‹ÈêÚ;¦t9Ô¿ëjÿ=œ*‡À$¯‘d¶ea$/Œ7¹ÿó$OØ=•´[wFåáÞ·XsfÏ¢Œ=Û­§Ï¾ÊWTð>{^N(g"ÕAÔ×!¸·µÏ:ÃßE47’2yÏg šFÜÌPªñ¤U›¸|tMº6[*yŸ&D é[ƒÉ×Ǻ /mcVhÚ yN£ýœžÎ Ê—Û>8ß»”óÑÊ7ßHkÕaSÒä7Ó QW;ˆ9lÜèÞý^¾ù,"¡Ð7ùÌ¡Ïòi™ã].b3Ä2£3X“/¢{x:Èç~0Ó¬tÛ÷·ÄûÇl„ yOðöyeÚ¼<€±ÛcanŸ"sØž)¾L£±²$ƒŒçKo$è>aZˆx„­5;ƒ}êCuMЭª«®~>—YòÚS’ñ‹×H©šˆå&¯©¤é˜üîù Jæ’¸GÜA·oÆ ²Ñ á«%ÛÙB+Äaz’ Ϩ #ã+.1,öì»(—ÅιUUa¦jÖ¸]Ûõ®Õ®2\®ŸˆW>òV•$=ºÕtªu¹îKl)Õ(Ië¤Á´ªÉÇ¿1Ž •0©‘QÝQ†_ˆ›Ó¶â¿Ï$Óð±M’Í6.£ˆVïˆþCjHNZÅ|¤`K‘dõýô–%2÷%žø©a£MŽN´ì=ù*†Ûì¥Å›Œ®¾AË8R½D ùë{}zÔŸ–»ïÅçÍ pÞœ¨­Aæl&ïêO²Ü )N9-H ÷5:ÍDÐ]ÎÝôwYÐóy¢YØÚÙV²&½-Å~ƒ4›ˆIE³m¼02¸gž‰ë"?°Î?;Ká#—è‘(¶HY5¿ªÔ„Ø»o*¤(0i_òÔ# }"¨Í)¨ö«ù.,pߢ<ÿ^ÍìuÔܘj-’›²Û€eÇœtÕ4:lŠr_è*£ý§Ô»µwI¦÷å ³€+Ж³{Þã…T €ñëc5’áõz÷/‰U?O¯«v̼»%àÉ_ý2(<­ Ý{ÈZÿð ©»¸{¼¼i€r•½´àô8‹’O˜˜ÙöE¼ŸIúÁ…R¢B¢³FªÄì÷hpQI4rvyo?·ÄÖÇMO5öÐí­ž–8N5lÆún8Ä™Ä'vºµ‚‹ä·\l«·rꎘãvÆr÷B’Éʾi€¢ºÑ­ý!‰o\¾žšÖž3=_̲ úéŸìÉ£ƒ¾Bò$Ÿr±N“[‹Wpañ#þ7§ÙÓ·vÖ,‹=®v‚i®ºZ†$åÉ/¯X¹xÓ´é'b± èNÅ£kk\}Š­Ù–Tðqð;+´ <è$DFV(%Y4¿ç¼7,®ohÏ ”¯iÑX³s€ÕkU1ÌD×l*qê20±Á»Z?Ͼ™ ¡r(ù.xw§ÜHÆ÷ƒB¦èÆÃÜóY™—‚·}ÜíÈ\‘´½/ôçÍ’øe” %F¤Ï^Ÿq(è\æÕÇMu,.áñçZމõNH¤ÛE7 2½MÙúY(¥ßíhÿ4±XôÁ+@' 7P8ŒSO÷‡ELçüuùqÖÄÊw²h}¹æžph —ó ®]2:œû¥L/8%±q$*)›úäìKvAÎ(#G ]rÙY‰>¡¡î7¹0»2!’ÙûQ•ÓÁá•ýò!áç-êß?¼$×Þá%”WØnÑIH¸£M‹áSÞñ]ñÔPí%7MÄQg‰‘¦z…Wß Z汞C-ã„2¬Uâ6Íä@Iút#Ž´á“-šÇGâHò|ܼ °ˆÒ84†¯óÔ÷6Yã©qL6-¢qš«Ûз¢1¤ä¶R|éBx8‘Ê­¸°¢OÒâîLCxRq’íßéX¾hšÊî†àîVñžÏcí’bççÎ!Æ×"Žð¥¨n²åŒEYó"&fk÷œ¿\¸â–!>‡a¾|q@]i|³ë*9f5H/rìñ¬nÅU<É/ôÙçòÚ38ç‚‚ç$Ö¦Š?‰¢9™$|Á}cJ¦G‹~uôÌ­NoJ®U[±›îþÃSm9±:6ü%‹ñWÉiƒr?ã_.PÏ@Û*Êšׂ4黢1Ìn…‰žc ÔžëÁð^ùôÅÎï?1ï——xÛƒ¾ôVð#w¹5§”lJu¼iVvùàlt©¦—TÍ‘”è‰mgYò[?:>®éEë´¢³ôæ*ºËžJ#zœ¸L :æUC[WɆe¯KGʉÕÝÔms&sÂsCÉUš8= ííz‰|V{tKw~ïŽ nÈÌsмXªº£ºËÜü kBÜÁ›ÐP.ÆgÐíÍEàâVUe{÷>R,âÛôœœXà j¨ÿ½.q¾Ø~ÈSŰÚ!Ä–1Å]ÕÄ£ý´½ aäÊ¢ªÇúê³äXÄë[Ç\ ³ìTüëe²°òô GF_0mØDð=¾­ª¿§`„ÛŠñnNMLöX@)së8¼`6Õy¤ókúhOsµ¢RdßV@3= %ܾö•éjÎÙu§ÉªG&är¬Ãµ“µƒ7B±¼èö‹”챌"ÍüË}}ߊUȳù}:=ç{²°—]eú_z’üpó«#~ôqøá›Þ[;ëKµÁ¾#eÚ-§0ËÊ72`bxœ rùÔx( ×b¾lrNO¼s#Ç" ±.]|s²´­bÑ›L„æQ<¨ó´Jh‘À-Ʀdœ5 Œ°‘±¤åèïÔqM®y$æa…°×¶tµ5Š˜¹—i'Tˆ21<¾ä¼£6¤b¿~·/¤òÛ”½Ë#Ó¡¬O”p¬ü¯«‡f_aÞQbü|=ã Œâ¦ÅmQ†gøWU›?7À;¼€%Äh^R×÷Ó ürV¡ endstream endobj 3684 0 obj << /Length1 1902 /Length2 12615 /Length3 0 /Length 13808 /Filter /FlateDecode >> stream xÚ¶Pœ[Ó-ŒC @na€ îîîîî0ÀàîÜÝÝ$¸»{p‚[p÷œKÎ9ß›ó~ÿ_uoMÕ̳ºW÷îÞ½ú©+(Ó šØÄlmœhé¸Â²²’ìf:&D PìdúÇŒT98‚mm¸þEv:½ÚD ^y²¶6)g+#3€‘‹‘‹ÀÄÀÀù?D[.€ˆ¡ Ø K²µ9"…míÜÀfæN¯ÇüÏ#€Â˜ÀÈÉÉNóW8@Ðä66´È:™ƒ¬_O46´(ÛƒANîÿ•‚‚ÇÜÉÉŽ‹žÞÕÕ•ÎÐÚ‘ÎÖÁŒ’à v2(A. Àï†r†Ö ¿;£CTÌÁŽÛ•mM\ @€WƒØdãøálcr¼P–”ÈÛlþ&ËüM üs7F:Æÿ¤û'úw"°Í_Á†ÆÆ¶Öv†6î`3€)Ø “¡srs¢Ú˜ü&Z9ھƺ‚­ ^ UnT¾6øO{ŽÆ`;'G:G°Õïé§y½eQa[kk“#âïúDÀ ã×kw§ÿ{²–6¶®6žÿS°‰éï&LœíèUmÀöÎ I‘(¯&Ä?63€•ƒ™ƒ ²€ÜŒÍé§Wq·ýådüm~íÀÛÓÎÖ`úÚÈl zýAôt4tœœAÞžÿvü7Bdd˜€F 3° âŸì¯féßøuø`7€6ëö ¿?ÿyÒ}•—‰­•ûú_ó¥TÑÑ¥þ»ãÿø„„lÝž´ŒZ&V##;#€ýõÁû¿³(‚ÿ©‚áO¨¤©-€‘áïj_¯é*vùGÿ,%à¿“ÉÙ¾ª ø#rVã×/Æÿg©ÿòÿ§ðßYþo"ÿ߉9[Yý妸ËÿÿqZƒ­Üÿ!¼ŠÖÙéudm_×ÀæSÕA/­,Èìlý¿½’N†¯‹ hcö*fZF:–¿í`G1°ÈDìdlþ·dþ¶«þ^5+° HÁÖüûÝòÅÀð¿|¯ûelùúþp|Õåß.CÇ×esúkŒ¿1èuþ»Qc[“ß{ÇÄÊ0tp0tG|ý+bx2¾.¨ Èí/eèéll^C¯={Lm™@/õÛô7bÐËþAz¹ÿ ÎWŸáЫ°é ­ìÌÿX8_ÙFüL¯äô/7'€Þø?ˆù5ÜØü‡þzô&ÿ‚¯~Ðøzô¿s12¼f7ý™ôf†ÖÖÿ&°èÿý5å Ókr+Ck#“?l¯Ç[ý¾÷?!¯õZÿ y=ÐÚù_Ý¿òmþx_ °ù·÷•m÷ÇûZ‹Ý¿Šù]®ý¿àëþ_ÙÊ`z-Ülö¯ÖØ^‹w´2t4ÿW€ÞéOÈëœ ÿUÍolþ_×ÇôZ½Ûøîñ?þÿ—±³ƒÃ«úþz'¼*ïð_oxÈ dŒ¸8gkÌhQØv[%ˆïJ»3Î{–z«ÁD;^¨‡àÔ/:­ÿ#^9+sIºLl±QLÏ¢SNÈþ6{mþÊs»–¨Î冖HlߌÈ(vîår6ÁóÉjDžz²Ð®Ïý „ïºÞð›˜õ+Q½Èkz\É0JÄØ¥‚Úä:ºªJ2e°8ÕŽ7•œš†TvX¯qÈs6­c>mEꄥȥ“HótÜ!Æ»V¾ÛZAë#ìŽð—r Ø9ÿì„&Ê=D Â_©¶’ò˜óÙå(ý½§‘8º¥ö4eBIìNF¿úŒoHåˆõnÔ®swŸÅQÙc¦àj`!ª]¦â·ÓÚê+ÿ©k¢—h¸¶˜ æsìÇ…—m •V}_Pª›¼Ê÷6Œ\×éoæ‰Bz¬¦DÃ~i}h‡çA)_—ãìBIagíÚ¯‰EòD`O¡^$ÒDi}yùûhûlÌ7³2?…â€AUð¡à u+̳vnšBž>}Ö,/jø‡Êà±»lNpˆWé~·;‘‚R!ùLú1&ÏzOXÕ¯{Š49z ò‘׌óß¼ý)gÚ.—ÙFQP0ʉ° ýHi¤îAâø¨uÅY9ÄKöK¾ êywÂ…àö‘^? Êó€yɯôdtµ1,Ž¼× Þ–#d ùÓIç‹%ÏÅ÷á^eÌ—"0\,›jU½®—í³r{²B>çEK¾˜È{z09¬*ÎmÏõß›¥NófÇ¿à lé¼6Ó¼Œˆ²\Aˆsâì2¥/A® Î,ÝÔ$“!ØU!]YÍ F©U äÖñJ/by>Ø{.lÜù]~Žö?¡O%x ˆ‘$ýðtÄÑç>r¸@²4 š÷ü†:c0i‰«¼=Ð7_ƒâ-ÓkØš›g]–~iÎÌ0îø ÙÖ<1KÝå[Ýð ÉË×TJ‹Ô¼iŶƒ¨ÇÒY×úô+³S²çEתâ³Ð Y¯`Vau|ÊüÈ”€"ÿûËбy¶4ïkŒb&¡P>¨þ’éoWö_>[<åånc,#‚¶½ãyV•IJ rpóYظûõ½OÔXÝ@Úâ„à”Öµ¬i”ˆÒÜkYP¯Å+’Õ¦6n´Ï1PÂp]s Ñá€fBºp:¨ÿ˜LÂ}T¿q䩪t)z» ;€°§‘÷¤ÏšHnQ¹ž«I–§w–+•Ëö>žŽ#|N65÷L.ô“¹Í©5/bÆ`£ñÑ’Š_OÙˆ· *+³h ¿¨õÙ’†’#ÿ=ÑÌàÈôÛ½:W}áFX\¹®é]MŸ0  ‚\èõæ]ðÒN&:cí'¶³«Š[ÎoJU3ü™Çß]ì‘0¼ç›=ZåvEª0X1ñõ0JnÆ$› ÄsÓ÷–@Ã8½uŸ ’+çS'p²À/á\E„×íËlÐᬉ»‘¥ce“bÐ:^ m5J‹¸·«vÀ5c´ø —ò܃§“;Y%ki³/ÿS6í”F±Ó“ïœqdPÄ"ÿ›Ñ|m&¢ojZ$¢‡ŸÇ2Ëœb» 7MÕV£v° _²4|;c«(k'/¨áÍhaFqF«©Â¬xSÄ«¢ÄÂuLhöÅ©êMó!RwI}3IÀ™vÔ†!ü¶ÇÅ;´o&*± Qíü¢o§æeGÆ®Íi¿Œ¦h+yúôX¯– #ˤkØs覀 *üá÷äUmºH¿)ãPv‡ˆª¤æò§w}s^ñòæ›W_)m¢Ý‚›øÉÓôÔ¨,x_~rø½³N,«š’„ÛóCšÜüñZÒ¦âôfÁa±ò´dMëì =¤cH:ôâǹ–Ø3>|Sb]‚…y)´ÜéáwâOUÎ8-ß±¢§Ý…cÚ*Ô±¶{«6ÉÂjü%UðÑÄÆü¤N:@£W¨ûQd´5 j¹–@ìš7}+X'É.V¤7älHµ· Èë‚ ìºUàùP4f&Â’Ûè·íPzw\SÝsÄC¾[H{½ƒøKÿûš´]òÚ,ohƒ+æg˜îƒËYŠÝmÆ/sËD>=³J‚®·Î†¤Nr#Uöyg°S(Ÿ ?¾ƒ\Kú„§,Ÿ9)™(WÞQߊ¿íŽFèÉx"Öÿå|rï'Êp=1i?o)ºÛIÂÔõ%ÆŽÄ-æP–¸4þ çŘÝõ’†s0y_pÃï* â‚íVê…{À_Ó†,uí…|ˆÈŠ>a„V{ íË(Ki9p¾€@©pƒ¤¥·Bór:‚mJ}6nÀöMø¡òVß¼kݼò"Êò2%¤³m%ް!dX¸¾Ú p½a†!³$gh?K­O9~sVå¢jkÉI6²À|S‹QÁÊ´ 1Èáð8æ{ Ë¶ÇH%Š • ]¢aø6nyÐ΀ÖQ}«.ÎàFg:‚|àù`ô¤xS¬îûTši5‡PÓœébPßÊg JˆÚÊ4Ũ  Ñ”N¿=u¼žB#›àä¶3QYŸ÷L —8 ¬Å§% *)oC¥¥Yýœz'”áþqˆk‚Ìb„#OÙu"ª%šÛm í—ç 4¥¹µ9_ý‰|~Åo–;ë0öp³²”jN€½=¬Ã_È5:VÒ19QPåN줺ÛGùeïÝä’ÕD,œBë«bÐT9f ÏCÓÇË„pD皃vô+`•¢ße0¹È½°[ËP%"oÚv÷Ú…(¸A_dÆ$¬Ö³Í5èѵsD GK¶]ïx,‹ w°A†Î|N=ÞHÔ‚êÒñ¬i9¡µ“扞j ZõN›”&xR$S}[¸=4„Gÿ¶ù;·{aRÁSßÏCL&Õ˜x½)svgV!·”ÕZ„ý`‹ƒ SÜ.sCzØñåîzN¿“ =E\¯švSí=ÇPÛˆii 9eõ!^…Îvî®NYüR²²KËÍ3_:Eñ0|“°[à[ ÿ„ÇÂõ±ý{¦‚È0ƒ¦»9%ÅÈ÷…6wrIjsÕÔã,Úž;èÆÅÝÆwµ‡þÉ!)ß0”±_ýWð÷Ûò´+Ô`2+8§`§˜ 5ãÏAoðqò°fiB½w/jx6îµ'¶?ºæ,•RGPRÄúÙ3HÿÜö?è{Z™šow*ËuÊHˆ-n#yGïH/ëŸP>÷~Ôµuéç"h˜Ú†@È'ÿ§ÛÄ`(ÿ¢±þ¸Eþ=¢îr»Úws^ÚüŠGýA½²H".Ï1þâ¡NÕøyx²¼H¸•ë›Ùç7‹œ}öªL—w´Œ)ÆÅ~m&ç" H…¸Â;]J·¬.Ò»¢÷`µ5âû¦½»æºjnû$Ôø¨»N±ò@vu„«” Ÿêž3U3Mû¶À“½˜hån‚äºõsõ1 Óï{`ù¶o'|EÒÑ2gL$ý|œ•ò¹VÏ˹·|áÒ±–ˆ¢¬ÈbUÝ8BVh^"þó÷o ãųŽ}3¡Rók™vïv/-"£õH†,¼¥íËð;¹R˜úFëDÒÍ3Ÿ“$Õìž´7@§'›Šxg°\y=+³F 6*¬Å³o0µtw’©86rÔ¨FÍcÒ/”À¼¢Žþ‹ó6­¤uˆ)±æuÿÁÞʵ('ø…ëÒ™–86™‹e…O¢hKéOSwÓEüõkÑiDæò´·OéÑ£ÍWŠ\ÃÙ„o÷æNEÖ77¥¹úá©y)®B5~½CþRWͼµ@«f%±*®ê3œ/Š“{ÈödðŸ ÜYöë08ʾ÷"´qXåç¿­çðŒÉ Z ê ×@®É*ÆHIÜÅc  Y—ê¹, •¿WªûzÕXÔö•¡m’ë’ç’ ¥#`Pxg©Æ¼•× i}AêLÚ.c°Ò(ùY°ŒïÄ…H8&hù"7‚}ÒP*7†uŽÓbi,oIÀÿ™ŒRré0^ þknd¢5o‰6 ‹}£¯½Öç‘}ú¸ÅÏGüK$Î Í'A í…Ü‘u€Êñï »9áÉa$FlrÑ/Þ&jdàüx@* 댺=߈’Qµx[Ó› c:îÂîÉÓ¦p$Ã;úˆJ;àО¯UIîËò*gÙoæwl©4ÛÅøalýkEŠ|¦×JhŸâ©tŸÊìô^B©CŸõDpD!ê‡úlAѽ[ú%» xpÆÐ@‡g`[ë)Cyƒ :w6CoØÇŠI"ßľ7"¤äI !¢âÜ.Ò¤ ¢Ò²ÞóÀWzz8t%íéãR ™Cú¹Ž1Âòü0\9,^æhÕWcOøŠ5¢:$½¾ø¥pnWnD+‘ éïv9Z×ñŒÁzNCš¡s)^ñm‘1dg…—”e¯" —’iQ¼ö  YdžQäSÁ¯1ýe¼PãFÇ͘¤ôgJ’¬©âjnnÌô/æç2…@: ¿ºÝ_Œž§’Ù´›h;R‚Tc>°Â²<Œ¦L2šž] ¨¢ð+ÜžÛt€; Ë8)U›‚&Ó›²Í¬´Š!¿ñ÷M³¾/×·oµË“ßk$xŠ08ažóKW¸<ªG=Ÿóç[¦-Ö2Óž0CH†Y€žÂGžPWfýe 8Íà9î÷*y²$úr÷öCŒ¿L2¼"_ð[­O¡]ʲ›†§·wýý$–ifÂ2³1ˆ3 $% ¹1&¬0H3óá9±„üd-Ú5ü»|™§Ë—ª†nŽlDq[| TŽK´ëÐÇ–r& jä*׿§€,6éDöGß;FFb’W 7Ä͹¶0VN5!-©»³ÕÖ=!é>?òޝ÷ïƒå: :£:Á¨wg@>êô>M=:{.Ñ¥ylÛÚHÑå:‘µÖPf'„€P%« @ßñûœ}ÌVo¾}Ûcú)6ì®OÀº¿Ö¤]Õ‹ÆèK§Qi¶*pž»·_b©(1-‡®Öv¬xßi¨2bĹ#ÛT.åmGhç;ø®õˆšš | ¼Ý©lq/À9—¦³j†qžœ"zÆ7‡Î‡¬…ü0j(›z¶P]?-౓a?Ë4¹pW™Ü9›Âé©ö˲›É€öf¤!Ÿõ­º0ñêÉÜü:2k±P4¦«Òã—gìn²‡JšJ ë!ð˜d_ @æTj¼:ÖúY=Í3‰ã®›2£ò£*?ºÇù¼ù¼F²çL-Dœ®í‰esK?Zvf¶òé‰ÿ„‰_P³<’²r³¢¢sNÕSˆ’’=„cÔ$}3àVv¸”æ…QUÍ›Ptë€>OêÇ ËÕ‹íh«¦Ûì|\8!ã[Bg¹ÂŽþc"l udî.RSSBw÷çUüîw2|ø4D\­¥ÌœP^ç[£>p³®Á+%t?ªÄCFÁ‡‰žL¬+%‘Ü8Ðu+L#ßÅÛT%9 iýŒR½´¸2ÕÞ*_¿óâRõ-ÚY^O÷–(-óFDˆ‡ÃH¿·±¥Ópœ˜F¤ }²'4Jj1ç'ãqs€%ƒdÎÕ J½7 ßþìCæs•W£9³“}ÂütqÇaƒ®céOŸ.åõˆÅýÃ܃Ù,È5)ÑlÛœM±k-^îðö¨íYÓUéBiq+ö»©Ã~qÿ²_!1…söž EñU‹Æí¯CÇ£ y‘ &4SôU¢dÑ˶ ®h6­Ã&qeo)®2ƒ•"\Ь&ݯ«Û4qéÚˆ”ŽRlÇ?GT¹pÞ!.?—e3ö³1™ööLD[ÊmXG)XâÀÕ­×鯻ï8zÖUÕc€ :H)ë^x 1¼þ§Ê¼ç½EAa_ïöwÕkãŽXwïß³Jö|?±OŠQÒƒt–Œý°—Õ|!ñãél1DÜWvš|^fž¯Q'PñøžÄêT£êMø†Ú˜]º= ÈÖ©Ú$atXˆ7Ùú¤•É kù ÙÖ ¦QÈ‘Cêã™ÂæLyÕŠã˜ú‚ êg1¡D+ú{ÃC‚…·d«Á¶š‹w2pÞ *z+ø |â(—`å¦AÐü…öõ· ò,>¡»Ú=9y(6Öñ³§aœûAêÏõ4¤ƒz7lq(r—§÷œ¨÷‹¨Pmϼ‚ª/:BÙm&õd§®'ÓŸÈéÞ¥WP1Ûül™Ùœt© Dd¼>¥Ì—e©w »tÑrK6š×˜XjDz†»¹Š…©&6v’¿¹Ù®Õˆéô7âÉò-ˆ 3$–Ì]-ÁÎ:5Z±y!™G¯w´“JjÀ>錛ø¦•LYLií¶Ê5nëtFB4‰É/É~_Å/ Ä”¡TTõ‘/ÞÅßy³u±iG(’½›#3V´T¿è’o]¢ÝG½Háu:É–@- 8ºVoóN©<|F$E¿ ă“`ö ¿›PÂüÚR"_xÜgûMÖ‘mÞJ<=Ú¡×£§õùó¦iUK¾[º`™•ñ})ŸÏ¯R­õz¸Ï õxáÎÖ9‡5…HhïXküËqïÌìÉ8·k&–”(ÉnÖöCÓ»YžLÅõÛ+Iì`‚%‡JÅРX‘b7›=õnŸIÊ\įèé„4´¼á‰çc½¼ŠC9òµp€ÊÑoâ³CCÇ"²õ_4¦Q†÷o¬Š öáÏ)îkãpÙ7µ]iãt£ºÍbe ÕMv§k"‚bÔa} f!ü^GMÄî!¦È˜saœBµ‡5Âá£<ßø‘J©  rx¦&õÙÓ½†‘•õV6Kî^\˜ª4¥ ¢#Äí8ÄMfìíÖóÝ‘Ì,¼ö¡¤a낟^‹ˆwž×ߣL¦ýÏ.`÷*BœtV{Ú#Ã' £ëŽþlýœO“Ic¤ÄL؇—‹} xØhùO ÏT÷“¶"„Æï%)\x|®’ðDËCW8„·9¯çùò«Ø çºò/Æü 4Ëò|>ýeOGm¿P¤èt¸¶¾ÑšB5·Yj½‚»ÆðY:(Î>+V´q„Þ°ˆ—éXÇ·.7_h¨„l˜žðx™æ…+´Jª#õÿÊ“¨ý:{¸å'h†$zAfxbQféåùÉ—Ímnj?ˆÚZÉráÙ/3Â?HDž•©êïÖ*ãòA÷.Ȥb·Oºs›[kf8Øä€@it¶$h(MÕm&,ë3>.kSeB„©øeþ—>aq³¥v±ÓëÏD»•i­µ ª¼yЂ Šoföe¡w /"2Ç•C¡ÙlÌJNZÌȘý¾@Œ\h1ï&ÿ æ9›{:ê8¦`Ý.(0d<¼óŠêÁMK4Q¢LhéùÊÛ‡Ðuó¡Ú a§hHPÅh‹õýbã¦ãÄi· üeË¥cÿ朚xøKÎ0û5ÿì'íè7™îÕ÷ÖÝC<²ú#ãug w`°âé –Êaì£2?c‘7téf^¸Üaß-ÅvÜ·ðà˜˜]¥Q‰NœRqa”D|2ݨ՞0¹|q.#Î(áÔp=6² ØýHyÆ«Écé :‚:€šq»3T¿8šßè\.¸rÿÖ'Gƒn$h!™ÇŸ¹L8ϰM:·÷->Z´T¾F"GwOà°~ñ®bv€O¨^úˆwÚv ’tm¸im±™kGé0š ò‘ˆ‰|k|ÚV@Ö¥x£8DbÎaüýÓ]s~ä¹-Ô@XãÌþ›Iˆ]äõð—Õs-$Bè¾Táè^ퟵ ëQNÀÜC®.7)& è,•Ÿ ’õý?Rµx„ɶ&HÑîÞ#š$ù _坯$>T8d|-DÓ+ëç>/)%ÍÖ±v¬Š“ß7á-ÕqW úTûùîwàÝÈÁç Þg¥Ì•hb×è!Q›ÅÈãÞ¬Uã¼u7Ú5 létØJò¸Ðº33È8U¶Dó.ì>š¶óß‘b Șªy™™rMju_F’²ä³“ˆF1eìš do)ñAêÜ Ú<š4Ÿ¯›cdü&pð¼2Ó`ÌI J„Äd«èä5°R£h8þ²$¨E¶^Zom˜Ô•±Dýƪ³.`.YuÚ>ÌÀ[à”‡ah•D zRxïꆮ¨Ç/»mY×Ä÷ÐŽ@)ø¶„5×»s–ʰ ­(Ì¡{mÓØ1ˆú(ÿF¨ÒD2¾¾~A»¹Ò`¾éù`ù›Õˆ@Ýt¢ë½ÆÅ™ü†»_°ÆçJ¦ž¯e6rÆÕáýwE;çbNùÇ€Þ nLwýµ‘ùª9‘íŠr¦‘ܘ˜–¡o‚s®Á#µ ô3|Lj£Xõê¹Íï8S8nÚŒèñÈêâ¥k³`çe!¿Žó%^Ø{[h´GÈì»°Ç µK=2”E¡ÆåB] fý%Ë÷b²¥ìA8¤ ]b°{ÑÏ 3ši·!œÑogÖ¦ìçèWW -V|rƨQ‹q+­ç$•ü/®m©ù¢dµyó:Þ¶â=ÓT3ƒ¦Ñ´šuâHzc^Œ7¿¼âà ’2IwIš”h·O/&ÝCš"°®Üš{Nºò“§Âî,éOÚ"‚»FTFOÕ?g¨Ýgç$ }ÿ‰œ( S—‰ðæ2¥® j£d@‹2Žl—6GÓaâd'fÎíá;Ô‘*ø¸‚¨À±Ö øJñU~™2?µRF,ƒs¬DS(ÒÜuBð*}ýnÐz”=̉¬> ša%#j¤‹R6NøŽnIìÅÏ 'd¹h¤Æ@‘žÆ¼9*·U%ú%¼ý%rP6q#åæšŒÏ°2ºÌÊs Hs:]èf3AeÛ”ðf‡ª>ŒèG‘ Êû"‚ùV[~Pñ…ßhaäÀ¨ „潯ÊY'[L8£B‚£‡2“=Ÿ….æ°iDôý,% F}]'_ l¨Ê‹¿OS!|üù­­{ä<ÉÝO`nv—¾ ×ÀN2»­XG]¬¾ ÏQÚó±%•¾O«ˆ¹Öû/aü¨«qeKD7Ç Cï~~H°Äc® ÌÁùÍ [ ³Pýà$Áúe£’UC—êã­‡;Vyó#[h5< {³ƒ#HËh¤X:Œ¹ïT¾5ý½íÅl¶¯)uÐ…Y]gî ZãSñ÷(¸Ý}¤’éìv|Åä20ƒTyí5Ð&Xº\¼É¦¸TÇFùGƒ1òS8“–hQ}ç)Ä>Œ¤SWüëÀ÷|Çä÷P?„ÓžëßI|xßîI%êó˜¼òAoÈÞš\÷M8æ±wsãÚäëÙÀC&?+飜›ÒïØÉ ç4¯úB±Y&jÙùΧv0# lÉ_ Ûg990YÐ6œx3ÿ½ˆa™ÄÚ‡9J|štA—Wº!ú4ÀCY‹õ&òÙ]LÏ[fJžKS´+òA¦còcûv"ì&/Fîhý3÷sT*Ag_õZ«Í„”<¼Bžv޳Å#¶â¶­ö#`fòØ&¸eÙžúÖ³[•Ò+¾Æ‚¾k',™*i”Ööà2éE¼ºw…@_d0k<…_™’w!íú òɦÍ{X ±ÿ¹ª©‰°"­^¶(Ø_“3¼¶êg&å×JÚð#K¥BuœAGœš {ŠÎöWÍ0VŸZ•id…¾qñÛÓÄs $ö£™ zAXîÕ« ¨´A1n’~9I;ϿX XàÔ W¾ÉØÁÃí›&.Q·B!3ÒjxÁ hŠÙ#³š–åëÃÁØà 7þÖ§¶S%¹Jô‚©Lô«ÉåÓò‰‘  ËF¿ªädxü´1Òè…_Ñou0fOí »h|è°lÍtÿËBIÙjDS²„j+ ¿Ø<¤vÉ×5þx’è‹Z "GOv#ŠŽ’È…ò—´øèR ¬›Ï‰YrC'LqÎ(‹,cqÙ8fËt0¸L÷ho«q|€õ){É·3®'f!6e…ÕÙ5žN£ó'<€±ì$oWÐdåF¼-ß9 6¥4=JC1^â´æ®°ÔS¥0Oă‡Ú£¸Ì˜ 8‹®˜ÉÒì¹PIñ1Èz_X‡ `vc¼ƒ)<”ônï¿ìx¢ôE¸/êRn8¤ ¤£Šü|?ìu¤7Z*ó"a‹ykÍÿ^\f;ì„7_Ú*£N‘XŠæädÜGå™B!G‰ZGÖ˜yvÈèÙw©‚fÙR³_‘·íàȆþŒ®„p÷#Íó”ŠaØÉ$Üz¸ov?lyÅÉÉ/¦@‚ÍØì¹ß{?A'1Ä©¸?­ _²æŠ8ló®¶(“ÚMÖ¹ðfbæY'sQG­”ÞÍn‰Ù^ç¼0Ú  2¸j_X;Ì`g¡5DIšî<\Jœôm³èËx¸XÜ¥ßßndÄå–RäGyÖ©F_ˤ$¿£a,°þá÷û1Ïd9­T;‘ DÑÊóBqú>®ä&EáÝÏe–ã÷áÚÈø^ˆØ±V:,òáÉ[GKpŽ©,Š*¹Ø_ô¤]R®ªY}H*´±=0ð6¾“„N ·­)Þ²±»WH¤µuOn¿Û»ÈÕÝ1¨L.ošé‚òãÃH·÷+ :¨(T*«Ç󉟲’¿ÜŽ•°{àeKz6YåuXcéÏ•a±Åµ_»=|m…#dâ>–á72äŶ)ÿ*®¿WY\USmÇ8[gÙÁápÛàÂLlϸÑTÓAø‹è¸+z¯£A„ä“–Ö7»„ÊúüÀ{]$1Z¯ž@;ßk+¬JÐ׎öÿæ§õ•À¥$ ó€qì…‡¦. *(á˜è|“š€ç~!ÒnûeDrES¾5Bž/îζ؇‹'>ú5—ï€h­Z©µ&—ãp¶ø‰T Ë>WÏ‹ "OV•gq#ö]她áMï¦(n-x¸O;Ožü°OŸâD5|Mœ1øÕ`l¦8YAUÇçù"g1˜ÀŸ`îm“«”—pY¾®øŒr~:•ú<\âèê#ÕlŸò`•Úfƒ°lÂŰ1å0ò¦‚hÔ˜ áA*à’üäÃm4Pt‚÷عþ¥r¹V©û[ºëtÖ˜º C5«(dC/5àpU5Þ-Z†ÍñÉÈøÕmò°T0´Š:ëœBªAW?#õøc7ˆëŸrulUG£µß²Å‰D¬WJ¬º\MH–|“DRô+U…¨-5Üßý ÒZug7üX$ÜŠÁ3åÊR©…¿*l¯óÓ'œCÊûdBA†\S™F“‡¤d­N¶óFa (HxeĈ¯&X ®ÊeŒ ÎÏ*]Èï\ÜÏxáÎq|~›èÒéÁ¦etÏnÏ]ÛÿX…±³®‚Ø:Ž"•+ö¼k‚lzûRÊ7ü!ƒ:ÿ›Gf˜'{¯÷ÆKãXˆÜܦϗÒ5¥Â¦lt˜)ûZ!I‡] "RÄ/'¹˜))‰nf’GH”WÕ²ú™sn†e±ñm^/Äea¯Ô]ùV^kðL¨‘&±Â±&`ã*´ëö”zÌŽ{Åhœø³¤>-ŒèÞc‘ZFP{ûßš<÷Á£Ó¯PóÛÊ<Œ’2¾ô†Uÿ2Ö‰É`¶Ýâ fHI—äM¶ƒ™M0mŠ·qöÅÚ[Ëa_¥®Ç+8îE`ú ¼¬ ÷°U|ÐJÃŒ-ï™JëI^¨qTVàÞÈžÀﺥ!T~ÍÂÐQT®œ¹Ñ“JàLP<Ën|q}Tg`2èyÝ¿÷»WÙCU-x_×jˆ~“ÐÔd‚q ³uL¾lœ4<1)($¥ ;Ѹ&…?K¯¬ @‹¾i>:ý|Áü˜‹[šóe?C³%`»½]ÜF|·É7'÷Qb¾¿W¿Ø‡èâ×>$jÌ ›‚!–ñ4¡v^xÆbW”eÖ>ù›+9¯ùˆ¢íÓÌRHêI»Ü«šHÒØk¥ÑxJ-'Þmú94•H_„9!fÓÔO8ŒI©$ÑPS a‚<lÈ“.ê5š/Ã-Te'½ÑðÞ!ÿŠ„Q\OȨ́S~ãF™²9*R•žO+ûÉ®ñJd¯7ý@7äɶ~ñ²ïóH™F›C[Œe»ÍFÒPèm(ƒJWÎñ-y0û2)]ÿœÓIç™{AèYš¡Y]5±rSöB]¤Ý ¶Þ¨ŽÞa÷¶Úzäa8å3ô}."Äîš\‡†ØîY¢ÏÓœTÒè;ÉÌKë|Ãxxuô½^TØ27d¡·K$šLþ—ä4‚…g^‰F7ÑS×’ «jÎûxívÙæœ/–®Ì ý“ÞÅÙ_RÑ¢§¸\Ö.ëý–-«,éÕÇ »—ÊumÁ¿:áb€£yTóÝ,6*$̆÷_ÛŽ"l›3t–U Q ä°íБÅ-¿g#—Fåz•~êÙ‘±±ÔoG&)5DùªI×’é)µ3§ÿó)èÞáü j›êŒœ3 ‘\áSx'ô² ª3FƶԀg°5ûâ×Çdì¥D,%GvT–Ü;«ÖëÇh­6]DšÄ]²ÌW.‘¸úÓ÷§Â6KEí.§Ñ¸Ëôö»¬Þ7ÓŸùRùDÃ>l§ºÛé^V4ë›Þ ißË4uòê[r>síYÆòÉðäb ¸¡Çï±3/TE“4zù®BŸ¦tÖ5éb¿sÛò=ÜC·T¤Úú¿7/ï`pRH´USN_I%­GMX½SXÐÜÿbe­ ™(Á'N3¬c³{(@;ýÑs!.8+4¤]eµ°Šõ¸m¥ÐÛg¼µ¶º7i…; ÈrÖõ“Š{U%E7ã×gˆÈ¾§Ü#Ô»õ†d#_ºÚ{#ð±N—x¼Ra„‚ñ: ‹€s½iîb²/Ìj)³;N€ö™ÿ ®\[h+ÖKª¥hB&Ñs!H†$K>ÒijÐã"ñ†ˆ5yУÀ[“³ú«¯IžâÒ8xðBORÁDô *š0Ç7žŸà"¨›ÆoLq›þ‚eA³XâÙhóÏíP¬ ù ü”ßE« òÄ×½| »„ñˆYSÁìzް#ú¼²º2ÄâHÎ6ÎE?ª§†ž3ʸ׷‡7tO±Ûœ«©Dh/SqÙÉ^=!9á ,zLØ"›$~…è~ІÒãVIixT*'ÐâäH„ñJwLÜÂìî݈3b6Œîõ‘©¹‘ -{Kd0ÔNN¶ß)ƒ ƒøÊy¿÷ù2y7LgÛÞ…÷G"#!×§¢tR6Êx‡¬¨ý²‘¤M·a• Å`ÎÉœ +Á!”Ñù%NV‰eÌ—×s…6ä>ÎùUÿÇ&µ§¥1n©·‡Š'ÞñþðŽ?â,Ÿ«•üq†ÈtÂÈ×)\‘ \s„MŽòÀáLÇ(w"AR |ʰypJ€çž´ª0þÓÇÁÞ^ T†ÚN å¥¾÷ ·6îÛ¤sYñè¯×œÈEa¼?7Sëÿi§' endstream endobj 3686 0 obj << /Length1 1390 /Length2 5891 /Length3 0 /Length 6846 /Filter /FlateDecode >> stream xÚtT”ïö.‚€ C "0”„twHˆ„0  13C HKJ*¢€t§t#©tç )¥Òñãœóÿ{׺wÍZß|{ïgïwïw?ÏÇÁ¢«Ï+g ·‚(Ãa(^> @AKKM ñ‚$P”#䯛„Â@Bá0‰ÿP@@@(ŒO„Âà´à0€º«#@@ ðPB@TâÿÂEÔ ÅP‡Ã H¸³'jk‡Âó¯W˜ ..úàw:@Î ‚€‚A0€eqœ9ôá`(åù\’v(”³?¿»»;È ÉGØJs?¸CQv€Ç$á±ü  r‚ü™Œ„``EþñëÃmPî €q8BÁ“á ³† ˜ÃújšgìXóààïÝøþ]îoö¯BPØïd wrÁ<¡0[€ ÔÐQÖäCy @0ë_@#ŽÉ¹ Ž + àwç €²œ„ðïxH0êŒBò!¡Ž¿FäÿUsËJ0k¸“†B’üêOŠ€€1×îÉÿg³0¸;Ìë¯a…YÛüÂÚÕ™ßuq…¨)þ…`\$ÿñÙBP ˜¨˜0â€x€íø•7ðt†ü ürc&ðñr†;l0C@| 6̉䠮¯ÿø§E" °†‚Q+ˆ-FòŸê7ÄæY>ê0b¸'þúýûÍC/k8ÌÑó?ðßûå×ÕSÓ4Påù3ñ¿còòp€¯ 8€WPŠŠD1/>ÿ,£ ‚þmøŸ\5˜ “ñ§]Ì=ý«e·¿ àú«nÀ?‹iÃ1´…¸þÃr3 ŒyüsýwÊÿ⿪ü¿Xþß )»::þsýŽÿaÔÑó/ÃZWFZpŒ`ÿ }ù£Z-ˆ5ÔÕé¿£j(F r0[ ›y„ù€ÂüP¤2Ôb­ Eíþpæßð—Ö¡0ˆ. ýõqÁdÿà ì€ù€ 1Äü!1jCý^ã/‚ÑÓ?ûP‚áÖ¿„'(òB @ž$˜Õc,€—F¡ÖßÔðóÁà(L 3³ÀŽ ùµf1¿3f7pë_~’Ô»"˜ÃSsð¿ìß ‡@< `’é 8øQ}EPãI™ƒ;ïÚ$þ^Ò‰± ïPö3"T—ÒˆÅrœ~zÚŒFòt§€ò3ûmy—“Œ…Éï^èJæ*Oá#^få [f«˜‰ë#ì±x¯cFÖ Š:¬¬' òL]Xºw#n¶ËXÛvésPx߫蘊wç¤ÎSUnÔnn-ËKÓ¤e7ÚYyŒª·ê5XùAw/sÅ):p5Ò,,Q;…UC²ù”$νôæRO_ïeçݶu·€µ}ö—(J¥G½ŒŠÂ„¥FsïÈ/2?¸m§PyY©Ü’ݶî*\äN8©Ð>´Cn›³Üwę́¥ë$ÚÉÑT‰{‘’Õ';[ö=Öl¢(¶@í!0Ô"ãåçQJ?`uú2§/X^HC  ÝÕ¢…#fý"½ú¿.oþ ÆywU\ •–Ô@¼¼4äeÚŸvAµSe|µ[)\ç°ý™„ÛÀäÈÊ'F3wbžqd¤N¨F}õÖ ‰5,ð‹(É#¥N­Ul¤û`vk,mÂÑŒúH¶0Z¼€Ý»Š_0+>«Ê¬üNŠ÷Ñù–@P¯ÖÙ'ooü­RWHÒͲhŠ˜EÈ'B³ yߘÐkÈÈ’œë¶²jçéýºr±©’§¯Ðñ‘ÆÕ³žù¡¥8Láo–äŠ6e7:ö¨Š=)îÖh“ÉÈrh™Ô§'§Ó0, ˜ó7’Í”øaõqúªÝ¶Q.å:¦›2*ÎíH°—º®%³Aï yÚoïEþVd+xÜÇEåG Ѝ¸žØI£veÞ ò„ŽlyEªšØiû±s蒥Ƴ¹8D'änLv>ø9¨»«QPFF}îåB×òÚIÐ =­ó°®`‡ÞbÑ[‚ÇÏ×UÔ|“ˆÔ(?LJ”²P=T¾êÆÜtM À)õÓ0£y ‘y7{­°Küjéën¶¾¢ÀyzC•‰På™ÃfEÓg NC ·)úøÖvFÏ•‡Q‹Í¾Ý…ï±[¥¹å è¨=M°—¦Ýë Ô›N­ýè9ÚvyÖ®"ÞV´Î`Ì–ý#Ä,Z&¹§¤8E‹±èà…á}Ó冷QOž› -çóV¢E\ۊǯê½È®X÷’{®•¾8ͪû7›ÞMƒ©¥S·gíõžtÍÇ¡d ›ä(å±5†Ôðûë&twmáxÍ ²°ÎXß'+ðJÉ£C ëdîÔßÜYç;±Æ¹m@Fò¸Í!7 w÷ÊyõÄ)Fy~£‰‚½ ïd!ø½$gdÜ–NZäÁXPéWÜØžB•ªºLÆ·œSãy»:¹ŽDvjøü‚ûq†Õcœ/I/}”D›÷`wÖ±c±ç’™$ôà;=¬X7ãŒâ·Ï\]›8“È%A±t|ã á—>;Ñ5m Qûçéã??-z’Òã+}äRê*¼^pzmxÖ̳œÓÒÆ!âìxEÄVÝmÊ2ÓŠR§ÒÖ5hÜòãZªØÏ`Éæ—]Óêï0×îæåC8àBïXK“¿œw§­„äSP=ÑÍ£’6ÊBÍR–çOƒLV’Y°EnkD ê¨ØëízÀù>ºã¹rLIsðT–KXêë±ù i|O¾XI•z€&lC¸òÚ·¡gêXìœOÊ‚ìÌgÆ'[CíêC¦s& w›Š?a¯µI“ܧ üÖï WßEMå:û§þ&‹›ð4½‘ª9R#;Æ~ÃWºI8aFéæï öüJ×*Öíסsån§–cijË?UKûC¾Jn®ë¸;Ç.§½âÊÑ­û ×Þñwã‰ga·Ë•Yº„w.¬$¨†{enj‰û+„–É£gnMÈ– ·7Æ6\*=*¸A˜Íkç•yâ_×cƒKÓŸG|öÂú#pú*GpiKÚ/pûIB6˾&õž‡±…­gÆ7q1Ÿœ ¾•‘Ì—Ç~¸z\Á”| ;âœ$.™Äµ2TÄÓX›¶él¦+Tkû6K ʉËÀظI…#üPŠ7m\âÛô<«x.|~I "Šyèù` Ûϼ8…ã éè¶+G9Þ,KN)ç1’‚…&DŒf }þÂ~p1†ýî.Ń缒1ˆöñÅBíÎ =e¾lÛ÷lm±»–oÏŽ®^N¼xnõÝž <:.‘àëˆz”/¡– ô§ÛòV Rž±âµôö)îŒY0•çüøåÓýº„Z‘*•»Ë¯”íªy%ý̈»ëÀÂïMüšý3ƒ§lW+*)F Þë…c=†V™f=¨[0ö¨µuo)c|qe,X5.¸ÏÏžL+ÏKAú˜WÏ–öxw¶Ãm—8 Ä5ôÁþ s7.Ñq,àZûÕ¸È 4¬@OUl»úã„!c²©ô'aIð±ìÇÛ‚â8POe’D*3%­A;Á¶Öù·g¾œiMÞºGI5''xÒŒxô#Ïý£àÄŽÈ}Ç-ó^ç?dQ#ëâ%x,x:îÄdJ,{¡4¤ ®ÆV#Jˆû9-uÍg$h7·ËÛ,l°Y«÷—±ˆ’<Ún$gñ@óøWd|¢æå–ùW-\³P–:; b:8Wú­~ñœycOßLÞm›‘­šAúƒ™Éߢ­=>*“Ë'![0@OSº@yê¢ñêŒL¿g“J^u˜B¿tŽç|P_=BõM6Æ¡è:FO{%sýQ†…1Ôäýé±Ý‹1ÙU‰3׃¯ÔC]†¢%øñyTãR~SàµË©‹|¸Ø¨jÒÓEwßœxÐAú"©™ÝFå¡ÁN˜ÖXÜJUÂÈ,)1•s¦9 ÷ñâö¬K( c™dBí‘ʺMo[»U÷ &6,?ÛPqákhpÙnãuÆWo¦6ø®’ï2¯m0‹z°‹¸0ˆE’t—(8ÚM‰fîÃK7ì¦5ós­ˆY㨠|{Ãᵑ¬„P+®ÃÚÚ´ýÃÆ‚N¥uø š&Õ—·vÑ U²¶ííi–2ãÓÇ7¯×ßqd{sˆ/¤^å”W—ã ä¾²OÜ,jgaLX~)œ2e$`yLì‹;oÅX/*ŦnZñT,°òöŠ£¡_˜"F[íªŽ|8W&4D¤IòžÕaê3€SÚz¯±¡.4Ínr2Çc‚x'òÌoÙ¿Ür<ô:qµÉë+ã.h$»à8*†ÄT7©Øœ|+ÑR<_ ²00¸o±Ä®Ï?*-ÎzÄvSmҽȃ¥1^àtS²tw"ßV?ôHíõÎÍ_Ï”à˜s _ &?£YðÒS¨µL¯ô Öë9Ú‡Í;µR™P)39Ÿ JH&Ž¥íÕùãÄl7_y_Ó=tµÈK -RÌ‘,•u~k¼ìp‹S×ó¡hÿêƒRWk5ÃáÉÜçê!)÷F»¬ÂmìÐç_p—Ê©ä†m’‰TýµHãX]˜—¼o¢Q(`áÅíl?éèIì~“ H/°ÇL©Y°Ôñ— á0ö¼Í“OÌöC«<ÃÕv•ªÐëx”R©ïðä"AF´RSÉé#Š€Zâò`íªýœ8ÔH”¹HíŸíÀ=~¡tQûÕï§bãëš!9““üÜBëå]­çþâÖäí ï EÌ5É'm`õêd|Ã[&Gè”×﬽òôn4lãÅÊ|¤Þ ¸ ¡DGŠšÒ•ï ”æS}¥å}öÎ kI¢Æ­W ß­ê¦ì~$È"!õðòNWÆ…1ë[5½¯Ûã Q^Sj¥›_kdóŸÑXò¯Ê¡5ÔÕ²_ôÊÀ}à¸dÉ Dý4ÚÉM/jÖ²vì”®”bÞìbl¿ðÇsy`/ËÁ©hWTüóà~W_~°0o"Ëè¥Kèã³®qxÀ‰ì3©C—h5¯_k_ÕðÓëü+¡îÉæÁèÅsjöWЂ×È|~^FkdÓžnBËÜx\Û|mö çä½gßoåWíLH®f(Qáô!XÛÞÝÍ2ørÖqjZØùAß§réŸMÕß~91"žžXZ)"»³'즶’(Ir.ò¡P9 òî „’©†.‰6M?%•àG"[!ÏVÉ•¡²Ò’“HNæow oR_@‘7|xÅj(AÙ”yZbEã ùÏ._:tϯc/œöëñr+/ªm÷òœä»í6’ﬕ)Ä[rSþhwXWKôÙr鞘Ù*’¡wÍrµa˜ÒÆ›ý(ÏÑ©„U‘S£YÊŸ‰Rág0«ƒÆPÁƒ¯e~ê¿€J¾GŸtb×7²êªóÄ ËžXÅž1áäy÷ô¦æ&pMOÔŒµ6¨txãÉ„×tô·Í¶\ýŽ¯È¥ý$’ÂóÚi48”N‰ ój»a7gUR‹§Õ‡Þ˜¢7ûqÇOÞÞïƒ<ËŽü×Ú,ÓíÄfÞÂ(Þ÷’rôc¸`ï”\£¡þ›6|iÂ8­6`šÛ>Õr%XœU0$r|ù º]JÕe¡Íq–;òMÉú6%ïŽëåÚ“ ¯äÊe¯´$ 5ïø'à“R~%ägùxiÇØÅTæ¨4ðbñÞ´?ÏaGùƒÓ\á‰Dâ€GÊpV’¸È‰@Ð÷ðݧ—ÖÞx°ÂÚÍ¥ç´ï^O"¨øH$—éžg@©K3²aO}DùãØLÆÄëï=„»|OAÌÇû/5ÑÃ*wv×?JT…o›Dç~2Y"¥–žòÕ N{Ps7˜ì>šÌ¹ÚÓñJPÖ·7Ó‰t-BÃ`3‡/NA­¥Èývâ§9Õ=Œ?{þùÀKPºe|sL…À¼3ÙÄrwz(Š”ú\ ïÀ>¿'äË–ïƒá®ü’O+JÜ Ò6 ÷„.û¥'vä°*ëԪ͓Koݸ=¢éürevy—ÛÕÒßðÉ>.$|N2ˆËr!"¾b×~J¶²ªG‚ŸÌñJútÈcD]0È@³zþ°´ <7¹+†SŸÿ¾OúXã¼-³Û´Ó©ùëÃbuzåé¡[ªŸM•å]ÆIá&$O.NÑGQem㸻b>ÍLé7JV¯%kò¯‹qÕÚËTÑ.¨p|óÈ×¹J4¹ótfIÖìý-‰i|®ùúЛô…Ì úJØ?Ó'ƒ€’`Uœì˜+Š5¸Ü¥2(ö¡ï#O’±q»e—Í¥¼9iê7ÑÈ‘äøœ…®&CÞNÓÀÃ}ŸQÈ;c•j.g"¶V»£Îjöô¼-eÿUN¹µoùk@ê] o<È›‘ÁæÀ¹Yã¼ì-x’ɾ‘zBh0[¤»¤XA€Ö7®ND_§½©£üBv5> ý|¹“‚{1ËH÷Ö$Ý)¦³”·QþøKœ– ßÍkõZ2Øâuõõëí6ƒ0ÜŠÒ½§¨#Â?SÌÆh-ëÎÂ`±KŸY¼‚öÂÖÑTQòæ@…݃–zþŒ>/·šÁTÉe¬´ù J6JùÇæu¹U¥êëR_Ò])Ò®b;ùC×»µ[ÜGšb†²Ëã…ÜŠ”Ó«3ý]nGo9 T<«xrzç.Ø=o0º?ŒëÖ‹ -q¦nߦ€.>Ÿ¤w4hÊUñ¢ÇAÅF¬ê¹ž;¹Ç†Ââòá KŸY§jòYóf5o¯±®"öAÈ÷ú¹™VΟ²%°–öÀ/FU%W$\7F¾s/W{œÝsܨ˜¿/ýi<¡BFk›øÝëú†ùÉÚ)q»bà£H¼øæº,Ÿt)ûGFÕc…P¢ûŽRˆË¨lN6J&ÐÓ¤;4@áë\ÈJìsŸ;ŽV¢(û&jµkIz“YÙÑ©*<\Qsx §ë«œ+¬þ$FãV~ ™²feDÜ=ì¸a½„ î§Œ<úÒ9ÍÅÐëÆŽÙDæÆÆV¶{«?îœѧ29ðuæñ÷¤ñµ€j©j½'̓]¹QuûéäjLõ(:=|îÍ(rjE£ øEéT){Qrøè~QTøCÝ·Vá ŠšÝ?î Ï91˜&Èîè¬ß9wŸ£v/Yliz¿WÄØ‡&‰«ªn½µÂCxå†î€º‰‰ˆz¥si5H´¸Â.ïè-|è£üü.&Z|ÀÌÌȺ?õ<µàêVõp>¯$p›ÌË–çÑ&N~ßøÐee«âð/»­Ö‡­5_Ϙ›(®Ñß6Št¼%Óœþôµï »WUzûÛM¿qê:w¬¥4q¾¯òFõfÝ_p"9—ƒÒ±ïRV‡h¿5–/霃–´žI¹‰9UMu1ë°}ÌêËJOTó^ˆ“#LO¹i KiPÓÐÜeÄÖxëñá‘ äÄŠ'ùÂ3:Óž§føõØj¡Ë­›^šL!Å'÷×kwˆØ½‚6ÛßdÞ-‘óe&ß­DjÛÁ´iäU¯³Ž¨Rù¼­ð$R}.®CÙÏâ¦*V™±&Î#»¾à´'á²Ï»<¹zÄÀðé4—-`­Q¯5™OÊ‘ú$ªm};“YíV„côöíCö©–*+rd]F%©5).Ü€jwØ{¡Ê3ÒÑ+ß´§ï°úPì®MëÒùdòÖÿ¬ììí4Ôq)xyóâÓ~o ïlÇûÏ}»{í‹)Ó”Û‘?-¦ñ>jîê?Nbû”õZ2 &(3Œ¬ç‚Ÿðz€+G²)Q•²Df󺈓Ù§PM?û=âépYñ£vËGW~ãÎòDblñoÉe«(QâgÐÁ"CVVÉ– ìK0]¤¬k+¶íMò”|*_i)Úf4þl¹á¢jP³F6ä–Zñ² Od9«bB]ŸÈb[õfxާü2ž3JëtI3&c†ükIq.‹é=Úo·ôÇÓÈÁ‘t3z\–7«~0ø‡-£¶s¬ü§Þ˜ŠiBí†üõÝfêñp.»¿ÉLM½À·Äaß+i}4<ô½HY¿u/LŽaŒùud`3U׎%ùpÿý!*Ÿ‚Ì­g5_ù[Œf»9äx„+rßÊ™®îp+èɦ*êN:Ý2…î÷OÝ¿014ÿ¹:Aì endstream endobj 3688 0 obj << /Length1 2827 /Length2 24743 /Length3 0 /Length 26316 /Filter /FlateDecode >> stream xÚŒ·TUkÔ.LKwç¦KºSº»»7åfÓÝ‚¤tI+Ý J—t—„¤tÜí9ç;z¾ÿãÞÁ°ž™Ï|çœïZÐRªi²ˆ[9ZeÁn,¬ì‚Ie v;;+;;'2-­–ø™VèâjçüÃ@Òhî‘I™»Aì”Áw€ƒ ÀÁ+ÈÁ'ÈÎàdgøCGA€”¹‡@™ àº"ÓJ::y»ØÙغAÒüÏ#€Á’À! À÷ò/w€¸ÐÅÎÒ P6w³:@2ZšƒšŽ–v@7ïÿ„`¶ussdcóôôd5wpeut±e| ð´s³h].@+À¯‚*æÀ¿+cE¦hÙÚ¹þ-×t´vó4w %ì ñp[]äMy%€ªü·±Òß/ÿœ €ƒ•ãßpÿxÿ dþËÙÜÒÒÑÁÉìm¶XÛ€U%V7/·—s°Õ/Cs«#ÄßÜÃÜdn1ø‹¹9@F\`)ðŸò\-]ìœÜ\Y]í@¿JdûrÊÒ`+IG ØÍù?); %䨽Ùþîìk°£'Ø÷`m¶²þU„•»›6ØÎÙ(/õ D„ü[ftð°³³ó p€Î —¥-Û¯ðZÞNÀ¿”¿Ä ü}Ö"€þvÖ@Èd_Ws ÀÍÅèïû§â¿™ƒ`egé°ÚØ‘G‡ˆÖcHó]켆ìÙã°ÿúù÷É2^VŽ`÷oó¿úË&!©$¯©ÉüwÅÿê$$½¾,ÜìNvǯ!ãƒ<øÿ7Œš¹Ý?4þð•[;þf 9¦ÿaìñÏ0ü³Œ€ÿÆRq„L-Àð{ÈØyØ-!¿8þŸGý/—ÿ¿ ÿåÿ6äÿ›Œ;ô—šá/ýÿGmî`òþÇ2´înPv„¬ø›êÿ^Ze •»ÃÿÖÊ»™CAlú÷í\eì¼€Vjvn–¶OËßrí_[²Õ]í~]+Hkþ—²Z–¯!W‡+d$ÿR!›óß”Ò`KG«_+ÆÉà 0wq1÷F†4‚x¾]´zý5Ä6V°£Ä)Ï`íè‚ü«£¼<6ñ_¢¿/dŠ~#>›äoÄ`“úlÒÿ">v›ÌoÄ`“ýAT²ææ¿Õœ6¹ßˆ À&ÿqØ~#9ÅßBNé7‚Sþ äT~#9Õ?„Úo!§þA¸hüF.š¿K„;›?ˆóCÈiýFrÚ¿ÄZç7‚Óý äô~#9ý‘„œÁoñû âgîàY¶_æÿH¹!”Í]!jçúú·#ÄÔâ7‚Ôhábnùy¥Y»ý–sý+ÿ{-ÿU@8Yþ‹x Á,A‘ü7'÷/ÉŸMü5«lV@HJàïÓþ''$7dzÍ]mð/gwÈÎÿ[ñ/#/K¹Ã‘!õZÿ†ë? ÷/h÷Gþ y¸~AßÄ8~ ~çãùeîèîòG6ˆÍÿ7anHËm½là?, ²?ò³C*·ÿBúú9YÐrìT ¹µÙ~G渂!wÀzH펿É@œÿ£†ãô[ æyµƒÿ3ÜÿHÿÛ.H.ÈœA^á˜òþ%³sücô ‡ãrwý#'Dâü»¡¿;Ðõ¯ëìßÙâü%ttZY€þÃ…‹û·â#ï?šÿÚ ü#ý¯1ǯø£ƒ†üfÈqr:Øýwžy~Ù=þè#$ˆ+äûo©qý9­V¿ÓB^eln¶.À?†rânžŽ8@b¸ÿ!Í÷øB˜yþ1¸o¯? $¼÷rˆ>¿ÉA"ù]þNõŸ×¥» ¤¹n½°!Ûö?ø¯Ï/ Ð h‰¼0çh)f_ÖqS#Nâɲ3&2M»£›ÎÈâ»àÒé~‡þ"•±:;dÍåJõ˜ùy57þL¡ÈŒìô†«Ø×`3þvÖg壧k ‘!ìOì‘I:_‰ý4‚o¾eÅËŸç½Z…‹)òÐ^¾[fÁdÝç̪¶Óˆ7÷ÕzŒ,tqlç§ÂèI>ãl'×–7㚺P©âU·›Æâ¸Õr½’íwYK¬t\éôZÛ¿#]˜ªÌ éÛµôúÞ78¯ ùÌrñ®íf¸ùËV¯¿né«W¤6žLÒ¶†1ËK‚Ydïà+ÜFaztò¸˜/=RùàÍÃ…}CÎ$îˆ96‹ØÙ øáû GHðäûÅûW6žªt­Ï`}yb‡>‡òª<[t¿;=-"²å’6ËŽ`(È’î.XM Wª6΄V°®Wâ³J•{S(%mòÌŸ ÒsËËöí|«Ž1 ñ¶¿xÏúC§R»ý-Ï{uÊí£X–ÑýÆà!‰Ðð~+«ýÍ«$Lð¾;êÜžVzFI Çohñ…Dwiåõ¸ªfÈŠÇ”\oÍö!YPkIxP:4'`èj‰Ümö”{U©˜÷y.9×~Ó'GìŽ"¡E¤ÊÕ¨n÷§pø£}hš5©WQÚH»¼©yS^²êàÁ$™1DÛvÕ´s)¹”ß&‘•8¡j s3±.·Š)ã¬ÃõB-÷±b¡¶„géq‡êÒÎ4pÔ¸¤ (ÃXk±è±ÖŸ&ÄÑ0ªYáúë$Æ Ü* èú|ùÞòÖ"SëLôMôÎÎÉÍ’$_IJ•A—ùfãI%Ó’ày¦EãWýì¨.<¶7öeÒ, I8‡œƒ½Ü1ãY¸ý»ÃICóí|öê°íéj~ØZå÷ ÄÆÆšš¬WÃDf¯.øÒñQLGòá S».ø½Ô„¹9fÉ.DÜÆoä 1Єx3Z[ü]Ý9¾sÝgjKBÁÛeâ7ȹUÖMNû_y’Ï=X’Ó­9Ÿµµír«r{Pf™^Ë·ÖœÔW?à}ÞµŒ%f_#ûp®¬p«œ§Ïþq$Á×w0eÎè¦ã’ç<œIÅE$r ›’£5¥¯Èº¬Hx0ÌØû’@ö‹¢¯y”¤„ln'29™÷zŒ"}D§*û´Î»*^y5Ðý÷»-,Éë†=„‡3ÀÑáØ›AbD"Å‘otœ´6)Õ>‘× #D/Ý”?röú¬º'eäGÎð2e¶3•  |Bû0ù,Ð=V¶öªÿ½b ¾%#á×ñë £S›<·JºWå[ñãý—÷`­CÏÎäÝš|+#É–¬¢±EÕ«¹q±b]N/Š}~gJ%«©ª-ÇÀm¶¸! ±ÚË»cJö¤^ýGŸ[šãÛ‰ëÁ ÚþÊîÉa<ÏÕ NcÇŠ¾5@•éã+yÛ¯îû?d9ÐçÓ¬ˇ¼y¯CzWd2hea„J`ÍsOºr–Ãéšê\YŸ›2B‘!ú¤m†‘Çù[•»†9ßmUlz:¬’‡å¬¼]cIÝ•òÑC¿X³îlD%aQ¥Ã²-ûB:<ÓYæá‹þ‚äµd6ëŸ}9 NZ5iÎArqFM %¶]á ü<8’¹âï×®s@BU¾_{P¨ÛæõàÁ2ITˆ±PéPaü¾óŽIX½ýZ Û¦º§0âOŠ~ŽÊ(¦8sÓït±ÖžH;Ѽ·•÷Ÿyƒ>äךt^›»åR Š©r°å@ÉœQ¤4qy“SglYb(+›0x\1„uøøÜæ3'ˆ€„ ª¸ý@õIA´ 7¯#‘ +Aê¿§ÃønYshÉŽèeÁIðjé‰6~ ~qg»Ì›AØŠNµÖýN%¸É ¯¸BSÃ1=(,‚Á‹Kõüj4-µçŸ¡ù·ÈÀ//“œž‰C]m“ïZ’ÝñÏކř1ƒ|‰¯ê×soMŬ x¹ˆåÖÔÌ=&}ˆ´GñLkòFq?|à gªØ|ƒ] Ìy%»'ºdñy’ 0ˆ×:R)AFµñ\XiçPm´H5^\œð‹GDràê¨n¯ñFç[ý”îâÄN(]O!{°"à‰/“ÍÉnaÊÉ"—ø“$2ÿ`¿¸\ñl4²7ë¹a¾WëæŠ‡¸{eEª“ø8«!÷{ÍyN ÏfK€[yÑ 1¡-©ÔHÝ ÊU%yÀö!f>'£"O/"lýMYd“éªÑåýd(¤)/~ K1œM7Ò ’·‡ÕwØœTxù u1~Œ}Kó«æ1ri•ë­ÓÕÜîo´ý»ú÷ú.Ëpµ“”_ÓôS n)g ågôwʦóˆi÷-‹¥«[ŽÈï³D$FäI‚48®ÔÓmX¶è#†êJ¶ú,;!š.OÞæ<e5}ÙòÙ !r¸7¤Æpå“úPø±áb¡¹áYrF´ ÚÇó=Päh>[&„ë_%ÞxÓ©hm¶4q‰V鮿êpÀUHºÁg™æ »&³Ûú&'¶ü6Øz<ôñu‹ëaÖÏGú AVlúQÍ­ORí# ï B¾düBTýŸs’õ•ßMšªeÝyLe³^Ü4.p”Üc¸±ÅÍ <­¿Ù/ã²YÓDzsÿôie»ï¼sòäh [ßó;™ÔÏ+Á„7‹Vä/4ŠaWÉânX¨‡,o_â2n¶™W ·ÙnŽ Δº?#jî (&…aõk)–›ëÑl{Ú '7©†nÂxÅ’8†¾÷†“gH{î°ÇäQ*­ï±lô÷³%ï¡Iô‘ÚÄÑÿôÖ³]ÿ sçãGÁ±“½þñ¢lŽîóFPà°‡dÚÌýF †ØîãÞÜrÔ~Cæg“E^’l¹Þ“÷fæ§Ø%Ch1†Õc1˜fS]#Ò¹ï?y÷™““ øìÚ+™‡`ûÛ©Ù»³ã?è…±{¢Ûÿ"céŸÎfB÷E¯½2(÷¹ˆMý‚+Ú²ÇLáÄ¢4I7ôþöDÑL`ÖPFûÉ,­ðÇJ÷°kÅ«6¯íŸMŒ¢™’ðæÕ¿l”©XX‡3/ut­†å:R!½Y(ÕFê𙼰9°5ߎëÞ “?™!܇£wç½ÒRñq掩fÈæê™û•§ñ§·Üer™£…YßÎ3Mz'œ•€ŽuÙéÚǨ×ÅII|¢GŒŸ‹.2äÀosaÚÊ*Åù¨¾ûJEh³qº=* ^Þºî”ݿ׻L²~_ž= »ù<þxÏŒ³P¢'}Tš†9Äz°AÙ3ÑGŤ°¤É‡Þ³¨O^Hºb¿„FF7µ ¾¯€Êüa7ª»µ{[ägšJÁ ¯G&±–>V4õa•Ò»gî±Ò{¯² Æé¯Ž®ûne¬td•æ^2ïá»â}”}*Z7ak)wn胾‚¶Àøx{k@þÑ'LªÜM •눙•·¯Š5á#Lúû¤5!øªéÅ«iê±D­üft™ë;£=âÇk“™dX2bX¡ ¤¿ €”Qšœû ï³úÀãD:}Ž:×…uK<×…æˆ`…½Öñm‹›Bâ 6Ñ/ªÏ?²É\tVƒ?y×´"tˆ2nžäõ6rnay»0 ÷ &d„0_ªÐ•ÑãØ•ÇÕª¨÷ÊŸËÍŒ^NPô¼Ò<›—9!ØSyFy¡©×»Â^+ü‘±Ýv]w!¸“ÛºUFªÙ6a‰u¾^ †ÑD~’…<ìéÿø%Ê@¥EoBú²úEå<°ÑçÓÌÕ)WÇ”rÓ¼ÛñÓ“þYL€i–Wï›PXí\¿Xz½¤ÆÁÈ0Y1 í9L^y#ŠŒ°½å+ÑÁaÓ{˜aÑÙ&yvüéF#*ßy<Ä.íEŸÏgÃîÛ2ÙÖ°# Eá?ÕÖʾ0J¿âÇyÐ.ξód¬:µÁ‰ùŠç<#¸neO]ÜZ½ŒeûÂy¥8»ÃÕ¥U, YV–/a‹ªÒO}"f·ân`pîãêâÿ¾_i¶A'¦X0ȺbÖ¡£ô“8×IÂÜ©& g¿Qâœa½Uó|òƒB¶Ñr=>y%é9¾åÑ"aÐÃ-†ÂW·.{ŽÉÏYâ{.O1xU=“UOD# Ÿ^*RøA#7„§ê¬¾}›œþ¥Ö`¸¼*¬Ý«'H ²¸ôÊ’ùŠv½éX¥}YB“G â&´·úME.Uß\v½Í¾Ö÷Ž•m‹rÝD„%†:&@œ'ÂÇ›}F¼˜¸ä­p\J—Ê>}Ÿbáâ:—wBâVò’$flQÁþÈ,öh^£¯ sŒ‘ǘlEnb¦Ñ`E¢o+ºÅš;j±£Uâ²ô¡ýøýËwõS#Ò'œórj|½ÕäÇúÛºÃ,u2ÃØÒʉߌ3‡$¢7óh°¡ŒÏ8i…Õ[w7vamM6È·¾Õ¾¤^ôµ*qòœ #ƒ²»³; pDpIÕöû|õçÕ4¾Q3Ý:ÆŽnÔt¨k9©«h–Æ\«:=êªòV°Z}Þ¨$£Üûön_Ü„¸Š`O¥jY²YˆÖmyd.¼ ~W“¹E·Ͱ§€vˆúzLN‚Úbš™"@öEZ(¾‚|(NåÝ”L^Ïå¶•ãÍ­í€Ô¼7´d³—:xsy$hû庭!¾$RÓ@”]žßÓÓð{ƒÛZh457K,uUÔyuÔfÅœÄÓÙ íÉÁ’ûdiq4¤rö'…§?gG&¯0¦ûÒHbµ¶Äì[ŠXÌ@êqjüºÝdâƒqÍé0õL#%œïj~àT}Þ“Ô ÀMä´?]Ò,è6Òyb1„4‹Å%v,A¡+4ÿôîS,ó¼ìÎɧ[ö™(Ž´å¡]_ݾ)Ý^‘p:u}#zØj"@–ª5žÓ=’Öˆgäž>÷ wÒ|ƒ³ŸDS[¦ÚÐ3,m²-3ј)áÀ‡“»ÜòújP‰›æŒsI¦áá§ð¼ÙfÙ:#úǦ} ¨ìù¸ò'ó¡í ëÖôêž®“u£ýc·:"h_:è–IÞ?ánÖqéd=ãÍéÃÄnyHï X~çóZ»‡|Ùžìy'a®¡6ˆúçö7;ã:û+÷èæ–Á§wÀN®.7T:â™cšýÎG˜‘«OÄÐâáWÇ_‰ø¬¾fµÊL–8^_xA±06?o݆"9½s`¬Ò_I¶øJŒ6K§âø™úeQ‡Ü²D‰hŸ“›¡§rdFmñ×€ÆPëyÇZ¯Ïs-7eUã?×qɇ_/5_c%ÜŒßìÞ«1¾nUGy.4³¥§u«]ÂÓoHÌwtA|u% nq‰Jš3Üá¶~<+¼‚oØ2˲,dZÓUÕšŸÔ¹”‹Î9Qä­3OÀÿ¡ÍŠ‘F¤}Ï®Ÿ£fx¡°!Uîq©ø!ÉZ5ºòÆDdaÜÓj›„ÍÌÍÓR]C•#¥¥g¾K-_c¯*kZØì¦-)[ßïu²=s“U}ûÄÛÏÍâ4{%È—#]¡áÙhpA“*øâÑR±)Ìë O 2Ú­¤WèÇ‘÷›j“RëkFÉhJî1^[…tögXºD|^¡l…j™ý¸é*}ýXÁ|˜9>‡þ(æµ ÛŸ·é$õ#ÎŒ~žŒã„·¢Â€ÆMªµæ«IÆN<â3‹®^ˆ Öö-éhÇÇr%x¿”ïÓ^:è¥àÄIU-ðaD$Ç ŽO4h²HÈŸëÙN CÐì0 ¬ŽØ!‰›®uóì„RF)çz±t[×Ïo5J|•ò{ǃ-zÅ„Rõ–œ‡˜î[Tö5zÈgõ8­A*Þ ¯Ñâ\À¤™ë†R©nF}*6¼óÝÉ‹ú àFÕ¹Ý,jk›ìS£í¨¨ âë•`ÂDàä«—§û1ž{¢ )\í4?¬H<%Ùž€uA”''8þlZÕ=mWÑI‹s- BH‹>Ö{Zz›H~nÔ²ÊÞrW¥N¶F°UúúgF£ÇWOYòhWôœczÐlSyÙÞV6Ï”¬ ¸"‚. 8AŽEjÏÃ+‹h®b)¬…LÛÍ´QäLºÁ¸×ۻǩ˷ËßtcÀ^ç!ô½#KÄ—qìå¯oMæ¹6 ¤a?V°LG½_ù¯Fp(‡T_Â- ¿î#<Ñ%N#¾”Ü[E鎿 ¸Ýí^q-}ßZS¶¼GÓôÜôjE·®~§å%u‰15~:®úDDLM7'†ÁúÕñÃÃ>èó—°æåi´Þ„où=yDß{ØÎ;é+ûsôƒð$¥) „dÑ7¾D[_½b ÏT\¸ Þ~ÓÜãq¾¸'m¿xë€î´Æ’÷6=ºÝ”Aa×Ú¶–¡œª{]¤³šÓŠÛݪ˻ ÿN*˜ûc}çp-‹’ÆÏàüÓ­pE†äÖï§S㣗;Úѯ‘É{[夋÷Ê´TÚWÈ£r7R[I.fIlTSç<9pšAy²:>5$ ‰E~ËðauéΤÍž/nÄYëZ·_ŽÊ¦k%ŠM49?¯æÝ­d¢ÍTËÛðÿŽ—“< \7Û=tWÓ)"o¸Ë ÐFìMÃË^î3Ø%Fôˆz²¡vò â"«ìÃSç,CþáF:Wï”êó>‡ýθ_Õ?¡N;_},ùÊÑÍå…n‹|æÃ3´w:ÊO,¬ qìãÜAŽž¬DV+KGÏËü±"£8çüðd¾aö‰Å¹ýt9›¦¬Ý‹ ,´1€Ch‘‡fÕæ¬ŠÛ’ª¾¶\ê9æšæ¯ìÒkÕn‰¹%Ç—Û,h Æ·–»{Ü]$"Ë’"­·+|ìdÌå³gïsÉ]f%¤ÞâJ$¢óF³t¾ôšz±?®>ìêž/Ëi%ÞBGå:D?…Ù€(EŒb£O¯7ð†ìiÖ6àÐ6a|Ò»‰šPc¨IIn,ZTNØv1åbÞ° vÑW+¾ÔÆ?Èå.?€-‘èr 7ż±²²œ¿&øÊNpdÐ ÜAHÿ,ÊWVÚbŠIÏ`›§e?»KOBhL0fÓbÙ’°V(Ñ“®÷þX¸‚Ìs„’¨ƒ ›ôòô dÉ;ð>åõ‡/©¬ùÛ à"ë |áO¡çó9¨o˜EÞôãíY$¬HŠ|°™•£ÆŸöé’ï‹ß,«¡hǹ|(c:ªµU2Pe^¯¨T‘›ä˜ QŽlÛÚ¿}𔫦ø‚d9M EfÖ'ëgÍÙõ$Ú­xæ3^°,‘¥Ò+aªó²ñøçfœvfcò!‰k¥Z®]§7µPäézÉÆ<[ômqW‡ÂØ ëD{ñ| Ðå‡ÓÑe³ùh„ØÉ">Õî Õ£ÛôØPžÙ``íë0G"Ìle”=ùª¯¢1úµ¦û홬‹èc‰µß£²è0ÿäÇñä.™Òá~òCTþÕ(C¬~öÏL+ eË‚§©M ¯þ˜!†U„5']v¦Ô«íª‰†|å5î¯ò¹’lÐsKM¨¹À6Æ™©‰˜pg{‹ úDG™ƒEC··h©­Èó3”i\¡Í­°æWCÍ)âÃŒ?^½Œ !¿TÇÙ’ò3 ö_\ÉÂeˆÜ󀙯>нzAå,à2Â.ãˆA_'xÞG|Ctש7–š.ç&Úáu'^ën`k¸÷¡P!.Ä „J£“­å¤v¼6 Ÿ4…fu6™-‹Y?N–ÓG¾¢åõ¤É}´"]_ŽüK99³ÁÁêvÕ{¢üú©9‹6Û¯³Ý¯²L¯–ìã㮂XùG½wt:äMò"‰rM¯É+›*§¬! ýp9óÁ¤¦•¬¸õ Pߨø^GŠU´~>áoõ`é~»gµî¤q}b:kâ$C•€èÎ?˜Áÿ]ç”Qƒ/açK&œh/jusv$õ*IéΕvþáð×Dš{ÓB¦<-tÔws#-E%ÈyV‚5AWŒ‰ÓtÀBç ;›/#I¦@šËã ß°‹E„’&™¤* ˜|}2½àÁ@*&ÍM_©Bûs×»©a éVº±…c(÷§T÷<èǼJbýLGpåür4?ëÕ­˜cz/*=F"k®©a´ÍI©ék5ä.7 RçRµÃŽ-ôU´$ô]-,ª=æ~â“Ý@|Á{5´á2Z”BuØÓKbõcYbF•ë¾”Q…ÉçêÑά%Ô=ò×^ê’º?÷Ö•ÒªåcàRB„>m×ÜÒvUðõÃõÚ®Ó„^÷‘Îépy6¾”Ù•«Ëmh8Í0àÿÁê^Ù˜x–æS¸Y>?‘ð 2þŒ«¤Í¶}~X8µžîVOÆú¦éy6…àEûÊ‹jÅãÍ¥³Gñ]\®R¶›œ» ǯÚ,ÖÓ£¾]d_}¶7‘_)xmw«ŽÚø¡]lX‚q)«6±ç5*E±Å%ŒçtÕ •„é¡FŽ,ãð˜„PØÅ`g0nñP-g ÅV]‹YòÊ(-ókÄc¤áú›òÁí+î“i»œÒ4ù^X¡‹juédrñDõ-ÈRdO”¯ÂBGG©o…ú' õ>…‡ô0pݱ#)D2Ô:°¡›Ÿ‹­T‰|üôVYï¹ [‡0·6I …¹½o†›wnu/ŽÜ( Ÿ¦¬Ø2†çÈÊb<á{§žžyÝ•EÊ íWÅN\ÆÃa/þãW7`czžà’)Æen¿6V>Ÿ:˜©m’¡]I¯TúÕäu¾ŠLÒœcb8*nzë"Fµ¢çO¬Ÿ¯Úù–ÆR¯f`¸Z]bQøîª¶3*@øò5i^ŒÅ°zCy<Èáæ²¤­ÂÅ_åG %ëšQ`V‘Ën:ð…'Š»Uyµ–¾³ž³Nž±SC{¦fË*ÎÍ„FÕ¶%@Ÿ•–ÌÒÞÁ‰@UÿÙ,JŸÛ”ÉÇ< ¨äœò~¹§yzA¬‹sÇn?7ß7æ®í Ÿ«ç¤Öðö’è‹›!ýNÊ€4‘ɳv¬+ÿJ³éR3‘µ|Q…u ÄÁN•RfGæ—žãs ÔzÊZŽƒyòqJŠiµšKœ9ÆS-êx½LN¦=épÚéÙ×ï8\’—HIdû>h›~]½P[^1+Ø&|‰PÀ\+õ‚‡Òa/~fè¡({µ´KXòó‰DŒÀƒïÄÏ`ƒ‰vÕчjP¢oN'y$^Mo]0¹wq}m q[ï1œ›Cÿªr*Yya1ráE˜Ç°Ù$iæCy»k¯#ÎV°Ku>÷ ?_üVþ¯™Z5Êl4 !ôwÊld*OÙ«]ÁUËéTLì軅 üq®­­¾rt(¿ò¶'Ùþ Ë/GuÝùøØ˜ê3M^9Ø?áQ Ž+%½Ù%æC›«],Ú¯*ÀššDÜLþ‚h*èÅXžV$ø§Ü;ßð^¬b2i³ I0Ž‘Kè k†„毟h™.RK"Ñ+–³j¨—®…' ÓR-ºÆ;q†)[¥täráï§~kzCªµïl¹dœÊß®zŽÒÉS 'Ìœ(d4ò¶iO£ªel Ä[ZŸb4Ëy?呌ÜáÖ›×û…¨tö½½C¶þýHvìÞ•õp¦g*w »'€I„'˜U9@×·,ø!Éáó§V‹ÝÛ%-ܽ±®æ½¡TÃç#LšPß!Ãü—¨0SL_Ž»mzp] +:¥ò­¯“ï'@Vm¬…Ýsd…YÜà:aå.å¬<÷÷;T‡EŸµpï4ºöþwn°7«w´ R§ðÇaZ¡oEéhØ¿Q¯‚jzº*ºݸ$o¿Õþ(éZ¶t• ÑÑ?··sÂ(T”7xýVxé®ðFÄ}õ]Í×nTfX³hXæ&Ô{]ï‘þ½è.Û¼«~í2*õýÉŽÜtB-ÓÅÝ^´¿èwó†ÕtˆX/dŒ¾*5Ø_&Õ“jÉ€ƒô²`ðÍOjn='M½ÿ ¨ÖQç½*yQ“¡êÔ‚+ÇÚÍÜ%W¿Ó6û ëDuFeâ¸ÉTª¹q¬lV>‹…MgF”›ÊªEI™ÿî”´‡Û±¦®Ëìòñ¦´y¦'ÉC§AÏ6ǰŸ³D]£Ygä%ºèÓ‹p‹ÁÒ2ÂÈ$Š”¦€L´’oÃO|»ªÌ"9‘yf·ËC5ær¸ë c¿ðkNÀ;ëò´fÒoi^>d¨»åòJvºFˆ*PN'Õ$©ð'Èg†­ŠMjÅ}'l[5âf‡­A“äJ‡-¢n/…÷+C¥ïæík1íÐ'ºÁÞ ½nåbèá4MŠúVñ3!¢ÆáìÊ9…ßt—€øGIKË{æVj0‰²¨ŸŸàu\(å¥úÔ¬ãY<°ƒ`HíyëÚè.<Ù§Ø5Ã*—<¯.Q£èi9mì3U•Ë^Fu,©¢©Œ€­°9ˆKþâr{;oQ¼'“1µXl€ØE1òÅ)W~ÞYê”.n;’K†Â* 2Z¿X[zd&U²‘/Ó)&vÅŠŠƒ¸êÛ¢ÈÃ눜åyæ=óx SiÃñæÂã·<ÌÊ‘\íÞ@¦œ)DŒØ7ª–锨#œ.;¡ª¦±HhÛB]5Ha—t¿y î¹ÉMÃxè†j4xê– ÃÚÝQnŽéO ã 5z»†.‡o2CËFÔÏ©ihè‡ó=ÜCK¤ º0ï¾Â1(æP@«3‚Bn@«„¤B^ŽáŸÿƒÏR¯1íäJe¡H–“ý2¹?;BMaûðZ 0$[)gGÊ$»/æXoYsã£ýBÂê¹å¹²]¿4JàÇ!ó¥¤?-ÂUˆ¡ks¦|¢Ô-Ö©ã]4…//‰Y<ïÄëBú\z„KA}”¡F‹SUúŒ\ÅÞ¡nžì¦qÒkþú Õ—(uAQ7ð…?ý>6xo瘮¨°>F¬Mº}µJ ¤šŸÚhµ%­»°jW‚ãâÀ´»É÷Øé ‘¿N¡`Bû°·ƒ_Ó’ÜŸ³GA.KCeÄØu¹†¾>‘$Á.O¢¹&LPgÚcyO<\M-:GÙÐÔV{¦y%Åêƒ>¢§‚èÑ"¢J¡×bÈ(eÉÁåÊ+*3ñޝEøúäQ S¢?_7Ã>]9½4(“@{N€ópõ™Q#íŽ{Àè»…qJìàjÛzeHÌtÒÌ•¬$>¶æ2Á=pzñžË£Bƒ©¹ÜÖ4µDˆI^OE¯næÄÝ->€fÙEK”ø±U)2ˆëÈn‚ëjÔË©p#/ÙBoKÏhßh‡ü=žý‰‹£Üç™%ºXŸi…½œçÒÏ- ûÏê5j0EU]÷*ו_}R錿•}#žn€Àöø¦ÿÜ$+÷ž®ÛžÇN¿6ûÑñ1µŽ”AÛOÈ[5É£c’ÐßuRjclcíç¬*F÷Ôžš`Bbë ‡aÚQŒ~æ2¾QÓJ}€4R‹HLûÍèGï)5‹&Ôœ'ü#uŸ! ïÅœ…ŪÚvÞ‚Ë×j>Ö¸°«ÔFUn‡oPΤŒ£šþ“d( ”HÐOíh¢­?ì]^J>b½ÐúúÕÃ"p,AðHªr)­¶øZâåAß¹¹3ªá¶‰ËøœñM„náNr¿‰‹$Û %,Éýó˜ÛËëÏ·êßwyȇipþŽ?˜v4p)¼”;ç·é25‹,Ìð<<;Ì÷ÙbA¨èfi@û­Æ§RÕ‡­¶1[Õ|[ªx•eþ }:?-&DÞSwI\gsõ%ã¯Þ-s…ÜMžß³Q˜ØŠ³íí«]øóŒŸÙ¯°$u5.BÍÙT=‹^]¢Üî¤"x7­¶QOq¸-¤k„£5 f˜ߎ•w#Ëë¡ù5m»¿s¥$KÕ5êãàùHK会«¸Ñ Çå  ;1ãOY‹ÊTÏï6Ø%*†‰”,f*ØZ¼»Š¬ÇpÅhOߎðúòrKŒën_ûц»×t¶üËíQm«9t©è†Ám _ y9}ä#…ià$+Vz'šíñ;ºøw–ˆKqva}xT˜‡Ü­vï^eFK€Ò“ÏÁâšpu mĈ«×œN$VâE°2ó¦Ï÷VîNVeá¼YÉ•éÛ í½¼J!{¼+>Ü3Ön°Bop tO§f»ê²±ï "7ŸÖ~¶MÅ’LKâ`Ò#U~Ÿ]u &Œ©c">ЧL#Ô—(¤àI®é%ocÀ _çáÉtòÚpùÚÄU¢E_mW°EŸœõ2%†øÔ$”>?ÅÌPX‰#3X¹U¾`jì‚»ÖÉ®ésjÄxg…c°b"e•È`¸Ž\6i5FoñŽ‹ûÄŽ5ìçk«cVŠžGc˜ªõ:±Þõ¶ªÏà’$ؽñ”TSF%ê¾6ŒÓô»B5¸nœx¶Ð¸HBôº ‚ñzè_O/¦½ð#˧¸kVÕ! ]+Q Âî;+~7Ywõ_øJ5Ëä‡hUNJ}ƒ¿èÄ®¸”n1ÌM¯\@R‘ÍëÒ·z]š\qár*•½Ú+1ïié¡&bH°XÙ2©<’‚ŸÞ©4¶ubÎÚe³°ö]JeŽÃ}ÂÁ!¿›õ»„ «$C̰üÄ7[´•¤êi“7¹#ôF?‘Éz‘ê¸HO.’ãôå† vF>ô”ÉòÊàÚÒÕPð½K‘:Ï^â•`‚MAŸç HóJ¨ÞÂ>”\‘;žlÝ3ÂÂåú‘ÍÛ& ²ï-G½XÕâ\|—Ôd—#¯Û¢ø¦mÞ‹e9ücFšMÁÆrÕž‡‘6 O®Öh÷ê(D©¯Y¹ªf_Þ¸G&lÊ>Ë%=©z]f‰¼ó¶EÑÿªŠ„^¯dˆ”1¾ CïYÚpº…Ê“fÎêOÑF§Íÿlä8²¯ù.$ÌpØ’ µHOdÕ­¿©4=@ˆI`ƒ£çØ-ìóäÙIW2Þ§~ä±Ëæ“<•Q4‰"19Å­$ªæƒÄ?5Õâ<•V26l…B'‰=ûöÁg0X¾>±ËHXQv[_¿ˆ§o1÷@ò¢üñ e,+Mý“¸ÐÀéÒ-<6Ýûïu#ê™'ÎÞI<ùÖèA!€ß.}:Ðqf±RíHwXûÊïf.9˜³WQq¤fñ´§Ì[¡wˆ1y¯Þ°w„õ!퓉‡°”ˆ­Z»%`^hluW›Ì-ø&Z“c;.¡ÏS§àˆ¾~¿ûÅþg`er®/fˆu;BÛ (W•yÚ «mÕI§`±œ‰ùxÙ)7»1¦Èù…G×pµDÊ»¥ýz1ÿ–~4* ÿÀIæSïÅ¢‹±qjú)R~·nZæ9+–ä,Êc±C¦B¿ÑRÜ7g~;å÷¬\ÈCƒÃ©7dÈ~?s4OŸuñ†Ãí«Ã÷%V„—VûÖä¨g1¾<»',ùl*›‹oóKbTÓ¸mäfÕ½Os:18»¼Ñë8CÅÍ”Ë)ñû†wwf/sÿö2ÄòRî$¶~.a¡–1æÑŽ)Ì訆_ø>Z; ߤÃAõ3\Ù;N¤ä¬Ç×ý;ÞóPTîî™ã9Ö ÏVpΉhÕçYr‚”W|ß7ä™ ÈÄß>ª…¯ªQ,¾T1Õj1oÔpü|õôÚT)ÇλxJýÔÿ Ï$0ÛRß ŠÞq_u™ʰöznN#Ru¨/"çë ’ 9裂ÀÙ4Y‰nܔԗòÿ|—Ëdå17cÅÞIqr}ùõy’ÖQ§ä f¨;‹õ—#ÇŸ "êŽÆy⟺Ö;M{ëÞ3>-ÿÉýõ`(©ÍUÍ>BÁDÑ!€TÚÖñ;„ñÄG\¡6ÑÄêlò ¢É[óË}¬Ûí☉GgÚÝ^â&+EHÝU Ïv²ËôÙ ±¿Üê€îI_: Ý#j´$]÷K2´2ôñ÷…Ç¥2Zpg3U˜ž†"¥Ñ¶Fÿ ÏÌGçsuW±¾Ô.ªÕ¦§üóÁm_±²e÷A`†å=9y×ùKy¾6³Ä®Tª›dúë+&ÚiüE~‚ÇÃâý/±bÛÜúžö:ÀÊ8úUÆ«ž•à‘hÓ’ÄÙÛ[—X‰Þù±ÂÞNäðˆƒÛò0a:^VúÞ—”Ñ…·6‹…5ÊžY.¤G2€»û#rd< ï;˿׊Z[ËÿÃ=›«ôúnè Â`‚ ˆÀfáŒ6º Û·—`¨ ·_îå@€§šdüT§¨Ä@ìâÙv³¬;ùSÿ€“=xs ,²>4«Rwœß†üõ!¤'ûý,MVDç¼EN„À­)Ôˆ:9³Ín›þ@-+›½¨JòbëÌ‹ÐÁ½šô¤CœüÚ†°P·C84YàÁ!ìsÖ咨HPÖ>WH‘ýù8¶M.®ï6¼17 #èAá/Z•ZÿAýtÃÅêÖ+ÐglÇÁ›£™ñÎßFúJö]ä#òYΆõâ\²f'Ð;-ëÚ4Mr짘8zçà4Hr›åâà`c¯b ¢ÖCHû <ÜÉ`d(çx2ﺅ—‘KT„bgó¸’ï1á·&’`ÁbkHR•EäüŸPn–}ÈZç{£7áµ bTAö ­|àubÏ¢ñqú6Uºg®–ü"ÂУU‡E°‡hâኪÖ5Gâ¾±92Ð>Ïwx™Äwc2n,Êð¢¥ Û O žÖ¦w¯ÌÍ‚ÏÂ6ïÆ3f³ýlîpïËAÛ»0‹ÿ=6™s…’ŽK¸…[¶2Õ¬¯»‹Äp„…:È.É/!jEÛnOBÚ´óm,‹¥¤ê3[—.ЬÕçÆûO?“‹0€žha /`¸ÊÆV SÔů·|8Àhp2¾ýüˆ˜Oœ‘Í)²ÜÇ >-ˆØÑï¥SB"o(É.ЙXç÷a/ºƒE-аàI LJûíkÅÏíO^DãÝM難[rgæÌhKdÃ’O)䈹ÿ—ö2mzbEgœÍg‰Ö ÖÚ334Š-³Rl#Çî}¡ÔÙ·‹Á(4õU2€ß¬8™Ézä •ìµYä}ùºFI±ëd¥^ïÁ0bÉáÑÏ´wt{ÏBFõƒÂV½»Cîú=¶sÊ%vñAù¥-~“fkUôÛM)—MÑ'í8 ˜lm¯3ÿšþ.)¢B´QØÕ·É99‰îq‘©?}‚"£~êØáUËb{(þú-¤ˆ(˜0ì~h‚ÐÊ×iq…Õç¤ÑöÀ -áq¶ŸV@î¼–-EŸºØ¨u-åÑ8ºÓòzåÐø¨mW½Y ¨— 9<’ cBBOŒüëήB”•Ù´‡ ËÊ쳨Í4¼Ö\à ^\mך×Mšñ*Ly+r9ª©x­Þ ®½{Á[à/§½!2VæÈÖ—?Ž&Ú‹½.gØôÏÆ]p5ºT}Fl{¬N‚51kʷ׊K8ù¼GRl † x”vyEÃÖÔzZÎE°.RAÂaýÛPù6]#áæáf¨naàÒÁdz.8'âûíu` <†š5øÀ±Ìs´†Af¢gVÃ3~¾1¡ú¯öÖj]© hcaÀux\j<\áî.Sˆ!ÙSÞ0b—…,âä-Ãñ m±<ÚÿzgPÇoPNA#ZQ96+TÈü9çù‰líTÕ A7ã&ŒT+û@a•-F& ¯ÍUòcñm„E§;®™¦ãФ»!òÂvj ªŽ+tB¨rãöìÿP¨K;ÍwºÜ˜­:ýZ‚€C›ú1LƒÕíé<´N‰®IºÐŸ¡Ñ=ŽŽêÔ+VºÀ‚¸L‘ýR7Z‡únLspÔ_Õñ$QÀ$&aò(YóÄ´~H8ÑNþÖ¢½¾€Úõ|Ž4œäÊcÝö½ÿ±Väº:D'5Røqóø8ò^Q¡Êœêj±Ö™­6²]þc§ýÒ<Ä+ÀYÖ¼½§´ Ñ-HfÉùÁ£ºÅ4Ñ¡Ïüq¨‹:zuî€ÑÁ‰gÒ鶪ù×t°‹6YCèð]ÄØ§ksÈvËà «M¶%•¢±ÏŸ"»«C·tMx¯ÃŽXód“×mù¬´¶ÖŒý5±ŒÀDó$šÚ,È’÷xü’‚Æ´DZ¹@á|.ñÝC‚,'FTbý?|£°E¯ÿRÄt”2p¬éùõ ÍEös©s˜E泉b"ê>Rc͌ŠOÅœˆpq=x¿Ì•&·¦%|7È]ÖTÄÜ?ýî¶Êî_œ&xØâXºæ•$³Óò«—•ªå1”|¡]ûÓ×{öVØI­…ö8ò;fç‚ç)M‚œóå ½ÔHÜzÌËRêªÓ÷¼Jyª¼ó/o‰Qo‡}Ÿ^Óâ¤ú*¨¥Á–‹˜¶P)ýHHWÀØ`$'·‹Ÿ,#"!(å›õF:òO;ל¡3ŠGW6£®ØÛ·=dݶ-¤p6eèûÇ9×gršé‡É~S.´Çoö¼§Ò³ž†*u ›CÙ‚A¸Ìü7‰ºÀÐ²Ê Ìô1xíÍòô4#ð&²Wr.z‡;´ËÐþ-µˆ_ða¶ãëô4,;Ó *;Þ´³Êê‰JÙË]^cȱw6~“Œ…?&S»ôû*¨‡»†parKf}.ÇZãÛÞ¶ÍîbåËNR´ŠøEEbBúRŠðíçN>A˜}t8+!oëZnñ$™n ùÂê\5§úy4Ø£ÍPÜÀÝOÕ.‰‰T…ÁŒp(Áñá†pÑ$Ý¥ý©zN9pñØ6F¹IüFßbvŸ8£Ò0>®ß¬%?­&°P Š‘»‰#C:á‚h¢”µ­4Ozwí¦nMrdÖ´¸ïÝ{·ÔM,ÄD ¥æ-C¨ÿ]Á-Qé cŠëõn'Ú &e’p̓ð­¦ð ^> žt¥ý·Ñ¢‘W§8Ï}³Õ±q¼í„#XÊÿÏÖE'Ý^VG¬Îa”[ª„°Šò¿TÞª]qéËõqçŒl )v|à±äb9º¥òr7~i¨t‰¡"÷¢c…gŠÛœ‰ù”Z§Ì&¥˜t8 2¿£«˜ßžÎ|†&ŒwGª ðh–ÐÒôÉQšl>?ÆýÕ’~c]ºý=û7Úê /øDÜ‹šjõ@yš9µ±ù“DD-¤›e¡©`!Ú~Áá.†²„ÇùVŸ²,³m (}}˜æ‚ðWp¯[0y=ˆñ¯È$c¦Lww0¸²…Dù—7‹at^9…©V¥/(Ìöù ä ì©ü/æ}JÄâJÉŒLGD"é9;xT§8§˜t¸>Þg-wŽ•mµ?U¾|ë="%Â×ÓäÆE%-›úZ*vÛ°ç×çd˜ôhY„y¨"à‘Ö~gJ”Å>’õNŽ3Ƕ¯Ñ—¤Ã’¢1|õSÏOu¢ñ„/‘¬“­¬£Q/Ãå-õID˜AÉ•F¶[Ê%;Á“è% t§Z!¹irÖ,T@™;Töåj¦Ã®À40#>€O~äXZ~ŒÒç6ï£õºH…’œŒ,Ç FPd Ù<2RnÜP¸ mU©­÷Ó¿tŒ6ç(¬hà~¬žü,ÌÕXnb:‰äAÀMnÑ)ïGýIäeY¥C°!IÖoÛûÓ€Guä´——Q›a%ç˜ç©U%œŸASî‚\"G!™qØLëá§äxÑ §ÓcþÝW%œÒšvyßT‡êZŒó‰ëíaÛù›ƒVR)Ÿ>MŽJ7õ3rÅ W€ì¢“Àà{Ö›«ÝþÃ$S±Ë>2;ôÀCÖ¡:A0/>OÅõËt‹°ÉK'7èxZÒlÛÎp7O÷ªk¦øJ›G­3Îm¶¶Ë0{½âÀ\Ÿa“ºƒå\–²E¼úúì ØÄÉ}“T˜õqÀÑî7™c³²´Cö»“2£{:cÁ²/"‡@XùmŸ²“`°%c}¥"9!Å#YM!wø»ê+t'È;´Ý.Mn,G›ÉÇ©\ÐlÒ §¥-|FßOǼ8ò¥b[Ú+z†ÍŠÕuÛNPtˆü½äCüò¾ò¸ !r_D”% R5Ñ^EÙ²Û¬еtÊ#{çÎ53J.D(þ:5S(ÚÞ¾U¬ N 䌒‹7ôò`ár9rÑ CEZÏÎÛ¿d+„Å~Q}²×ŸÊ¢¿ORIOá–LïtjDÛÀ£«ÄÆçï!A|ß&¯bÛIœ¯Ê…˜¬T4ðE´Ù*×wœŠÎQÝáNªt½ ‘œÔ¹­Îàä ÒW6 EŸ‰yÕz ‚Å“!Ê 1àÁ|Øe#w‚ã²®>ÊäÆÁ^ÒµÿÑE°5BÄ¥‘,„Î4Ñè^ýˆP_f2èG2z•`6”Žg…·Ì\hÄHWyg¿§îwh¡7W]aêQ¸#°ÁPF>žhògãèËôêû„ø;”ÕÅØþ9Y"âŽçWvä^Â)Ÿð %¼´"$i·j{ç‹åºL™ŸT¦Šì]ã+¬3kT`œÌ 0ÙH‹“µÊXyLm™šV¾. àL®éßÚmÛPõÕ忨Þ[F÷çrQËm›×— Ø$‘:žòȈPº{·øGà¼Û|Šöªˆ¢èMNi¼ŽcåÊê@¤ZªåQý«Y¥À˜l½Õ¼Ð¾ï®üÿêD›'ÎMžƒÇ~¸ Ere4Ø.—4ž_õ|¸e¶§im™Šÿ™œéÅ>HÁ0T©eµ¦…,°XX@Ñwpp__‚í'êôG÷êú $¶G#•ò‘“*âˆß,,<0^³pè~‹‚ì‘E‹¢Pê¹»œ%O]^ÖbÎl™B /’­ºm Á²Ûß!ãCëÇ!Ý Äã®—Ð'0o”»¢š XúÝ„”|¢ÈÛ;^ÃJièþ‚ …» ŒÍ~¼¥I% l‹G׊œú‰ç¬ ¤®q!2è²é›žÙèÕqwY`Û’Õ Ó¼gcTà‡U@F —€l°F©—[H*žµ¨IIM`êDø.À'¢¢;øz»Q>»ôÄ„yûG„aåˆ?ëCHVwHúVžóŽ>ˆi÷V4Óh”(ÖáȸLƒûzPÇ#Ypu8bÁæS6?©UÂûDm,)Åÿ´d?"éÉXø±^º½à_2­!RSE{Ù­ê¢_…$™ää Óírà2‰.ÚÏË´E½cöŠe^†­‘ ¼}³òZ¤~vb lž:1Û"l¨ÒE=e¨É=Ö=ê¤ßKß‹V*¾„l‹NKçB¥†‹ÔÒ™*«>¾ö^Ó\mŽ1~$àØ7ýq÷oœÈ棂´|!Í ‘¢-ŸªL Ó-ž1“ãÂä[å:ić‹ßØòâLÝ‹<—¨w}±ð¥$¥›|¢-®–!zU=0S¼›¬šŸ Œ\€PÖ(þE|Eš_s/hc7ó¸ Ê}вÐ,ôh?ó¼‹AH~þ§=wo1ö/Ί7†³\3:gß/ăëI×l¨.­lQS‰› Xfeç;¸%›°ÀZ“r„ •§ºK©úgéËïþ$ç¸%{ÑíÄX#Ö¦Ô‚ž¶žÙ樬Áªa—Œ! éeyñî!7*©»å¡Ð óGKv2T+£ýæ'%þ¼~ÈÑ««7àŒÉ}K±H¶±e6¦öÔ+=R±¯¥C“W 2 |°üƒ¬ {•é'tx4Dgò˜b3„©ÖBÈ1OMu|cW>“>H’¸R|AAŸøWOb#±$5Ú=(9¶Œ9¯Mþ4<éQ˜_Pòd%5RÌQKibê6=Ê’÷¯ò¢öKOi}>ãä…K ééÙ@ñ Ÿ@  ¸ŠuB£ô )°¬Õ,dN¾ÒOº©¢hz+Ü&•`å*ŽVw`´inÅ^-ñÖ LîeçJ÷¼²ø¦™”5ŽÈf`ì÷Úlz<«A[KV6ÜqíÓÞøð€-C}ÁH…2íì)É'ŸH!ðê/[¦â¤;dÊð±”/3!\íb ’§ÐE&’㧃wÀBû¨£—ÐÆÖÒk®èð£ÁZåÌ’|£ŽL Ò«œq¶x^èxR1w )puØeýs³¨uôP33.Ð _t5ZÅ(ªuhxœá`£Í³%xp}ú¼¨ˆ´v½²ûÆ”%ùz✀{M™m§àuÈ÷òï(ÄVâî1a†ÌsÒÁâpd;­u‡Ü}@0ã iÔË„Èð} ñä’äôɬlq­Át’\ì¢_懌L+ÒÔã£ÏñnÍŒ0‹uœ*OîßHKë[¹·‰]ÆAÒ’&1ý.#%q(R;1³i®ÄÓ¦>:³ÛâöIº.K´øú|ÅyÓÆûò°Eêì>U"€-ñᛘ͹ð©ÔÌ]ÈœV“EVDìøAãL(ýibPJï-^ éèB0é;V·AÑÈ‹ÛNw¹ IÚÿ3užrÌ?O#@~ž©)~ ˜[E†};$,ì«Ú49º¾?–[bã2?ý‡M·‰{Ì—9Tmƒsœ\eöÌØŸtË|ˆ‘â=¬«Ô¶zÐJ¢ÕG7‹ŽwÑÖÏ:‰)[Ä™óƒþå^¨5•Dï`¬ñ÷P`ú¡ª£aÝÞ#²…ŽwÇÒÔ~Íåç|î¨x¨±@!y×i¸F¬ÿ+Hoïõ.y··°TBØFús˜áî”ÓDjQkGÈ”8pÉÊœÚ(”­‰Þ¦á¹n`ÉK䜉 üKšê¨¹æXy‹y«@N°eÒ= ƒFTsH3¯¶µga…ŽÛÅá%‰XÞG|Õ”:ïÏ̧AÓœúàËÙ^ÕúòX 9¡!–¨^¼g¡Åj|ß¡+â­5Ÿ7Ôx<Ö¨°êq{_â{9ã~b*‚ É'rdãc4Q1þ’Ž1G¸=a¨òáD±žÚ‚œl½æ6÷j¾·‚eŠç'l/‹ïÐ!ˆYÅ’àVf˜M¢¼ŒŸ5Iémô]DŸÇ¯—!'™ùZóNª‰KgÑ›¢–ª6ûÁLMÅ«ÈÌåg"ÇQ€˜Ðú7¯¾¥Ùõ„_ãÿ7Á^¼yLܷב)¬¿ÒW:ˆNÞ¯99âÓÖ– Ül…—ýG: Ö w ¼UÕÝü°S´A×îÆTOùf8ÏÔ1ìyJqoc#< €è´?0æ2­BxWïW¦ÏjoS‚ïtù†¯ã6& èmÉËXÍ/pŸ–ûaûO‚ù±ðy+ Ö­/J“SöÞ3„·pO ytúÆõÛÕm9´JEÑÞ¶¢1—„¯*•sÛuµs’jüF'ú©è´¿w:€(–Ì–eµ5Ý¡r…/)4ç×Õ“ÓâdDD÷Æ5S`™BÌVRjŸ¼¡²ÝüHÔyÝš’—®‡5’mrsèï}!d%¹Jò ^è¼ý‡p]¸ß­ñgéªæÜåìëú+¼C˜¸ø]ð]PºŠSéDÖÌéiP¸DAd‘ðÚ0Å[ÂP-šî’¨ÈOlêÏ@YC ¡â¶/’—]Ða=m22EñÞ S—€.ˆÇœŒwô¡9‚‹Û4ÖèØ¶‹îõ¤«jMüÙ:ö¬èÆ ¥“GL±y‚öÖ±2”¢†™¸èç<'Ɖ«²ÌyD2:_3šXD¶t­uî{¨ M;úO¾mû¿v`~8¹ ¿œä>A„RäÖm(ÁùÀF™!2¡UY1nËC¬âЈ‚ðéY$À3V“ªi~Ÿ‘×`Ósfº¦1™+;&'ÚS@Üe_q%rýgS@z¾þ6V«@ ¼Ñºæ@H'QFÃ.yð1îÄ(¢ xf±´M[ùädÊò$åck -ƒïèT^é¥ù¥1ÒNÉJqNv@E jÏ=ÒDÃ*žÐ¦\Tk¤l'ýxÉO\5¡éæ“M0­h™û:v–Éáñ¼"ÎíÞp7¹§›‡u4 ࡎ&lG˜£Æä¬s¡Hʶï«<å$…d_î3SIɸ՛™ýˆN¤¡Èx¥«i4Q¥D}–uý[bù™íRŒ;pÓ7§Ù=MR-pµÃEµ­åíQЏ"0°æj…±Üg¦ÍƳiOŽå;ù#ýh¬÷Ù¤mT>êunÃÏœ–ú×äZ‰f¸»½[^• òÝ¥~Á«+E}I_œ„R7lÆIþ@„M‡igfjù‚Jåãí<ÓÞˆ‰{"?³lÄ+÷†wu¸¹vÊÖ`´Œ?-â9^©¨•Q´¬sMïõ]©Óe¿äÆ!¬x4J6"î~°îȾÆÉ)M"F{]m± °à?7ábÅÝFÝø÷QBêõõã´„ŽŸKˆOWÔüº‡yx9§ʯîRÿDy럩l`šÐxL~¼AÍH·³Ë§Õ»‘¾ºCµ¼ª^Jœí¶‹4´ïz®Xî½g}}*Ëep¥i÷š©øÀƒ4%uð­7­˜ ì¡KÖm8ÚL^CPw‹èf«cª‚`ð=‘ý78±ÅA~¼›âp'q€Ú¶ãÐe)¥ùÂÀ Sq:{‡H®N1&µúÀ–õ©º¨êE×{áœÝ5/ÉUÝÙ; n•Þ”Î<Æ®`ç—°ž¹ÿ µÆ"•?†¥“’>} z†­R²== ˆc ˆÖèÆ-ïAÌ}•êÈë²jÈãÜð’7ŽÄ„O•Y[·ôÙØ'«¡U* BíÅ} »š lS±SNÀA <ðÀ\0ð³Q??SVuéd àf·•~ˆ ñžÖÉ/¾MœÓÉlˆ¥Ÿ —ãÙðù#Ïu7üiÕÇÚ^SËï0}‹§þ¸ÊòÜc¹°}EVÏuz§Ëh¾ãY8ÅÚb[Ý"´tŠ!·ð¿¿bã¥9ùRŽIµ};’Ýü3²®ÿ -SÕ!#†›W¡­V@Ýá¥ãñ$‚êœÇݦ;è¶Û‚¢ûµßÓr¦ÎÔ«¦\mÓgJvåG¤ÌœZPI’¦IÇò¬Fš›Ê^œ„3:§Lhj†:ûsFj4Á>:åâ‘"‚¾ÚáHdä °_ž.è±Å#³b¤#y)¿- Ó˜ÙÜýÔH—6´Øç×+¹)s‡NäaçnÏãÑî³öSò æ1 3ŒlBo,ÞS\iãñL¿áoHÇçt w}šWMÕâ;+¦ÿìR“šÖdˆ…{è8[Öá+ý‹³atàÕÂ8¿×xºX¿1²bD) [“¬˜ã¶oÜ¡Åa§PFBÔïòpR6ž™ÒŒˆgßšß¡ƒßÒH–ÿKñMÃ" ~ï¯ý³ézio= iÅ“øìjßÊà€)>Ÿ"À5wð´Øömgâº/Í endstream endobj 3690 0 obj << /Length1 1391 /Length2 6293 /Length3 0 /Length 7251 /Filter /FlateDecode >> stream xÚvTlÛ?!R£œ %5:¤%¤¤Cº° ’JÒ )Ò t7RÒ¢”( Cà›ú¼ïó>ïÿÎ÷³Ý×ïêûú]÷ë=-]9[„5X Gòðó‚$€4t„ /$@ÈʪE:ÿ „¬`W7(.ñúG®`+$S°B¢Í4p ª»_È/"Á/*@ ñ"\%€ VP[ /P»²>B8{»Bí!Ht–6œ@~qqQîßî@9ØjcjX!!`:£•Pa#½ÿ‚C‚D:KðñyzzòZÁÜx®öÒœÜ@O(Ô»]=À¶À_íŸXÁÀ¿ã%dêA n`]„ÒÓÊ DNP0Ü íà·»ѹº*ê@Mg0ü±únà_Wäçåÿw¸¿¼‚Â;[ÙØ `ÎVpo(Ühu5•Ôy‘^Hn Üö—¡•“íoåau²²Fü.Ü ¨$§ ´B÷÷Wwn6®Pg¤¯ÔéW‡|¿Â /YnûƒáH7Â_õ)@]Á6è[÷æû=VG8Âîûçl…ÛÚýjÁÖÝ™Ouq«(üe†ÿÆìÁH 0‚]€`/߯àzÞÎàßJþ_0º~_g„3ÐÝØjFÿúºYy€HWw°¿ï*þ)òóm¡6H 5Ø 'ü;:Ûý‘Ñ“w…zM@hâñA¿>ÿ>™¡¹e‹€;yÿmþ{¸|jÊ tqýnøß*yy„З‡ä¡¹ Š¢þÿŒ¢eý« Ðß¾*p;PüO±è[úWÁMŸã¯Åàþ3Öš±` Çß7 ƒlÐ_üÿgšÿvùÿ±ûW”ÿ…àÿ]’»“Óo-Ç/õÿ£µ‚A¼ÿÒ£ùêŽDs_Þø›‚ÿ¬«Øêûo­ Ò ½rp{§_"ÔM ê¶Õ‚"m ¨ò×ÿµ`NP8X áýõ Ñý—½U6ŽèGà ÍÇß*0ziþ™Rnƒ°ýµ]Â"@+WW+oBôˆÑ’0З½†¶`¯ß òñÂH´ Ýž?ÐáJøkžBâ@>ô³ô ü-£çÇ„¸‚ÿ¡OÄoù©mÜ]]Ñ‹÷›èºþ%ÿÞr0Ø lC87°yêPÚr^)Gïɳ9*õ‰uÓð5'ïœk«;Š/‰³"#xÅõT.éCÙâ†"ljìüÝ+ßÝÆ÷xaM ÚÍ—~?-âtÆ7› gǨû>æíÊÕô20ðèÉ~ñ»rñ3rÄnÄlWeÍvq#ÕÊ¡<÷ìQöªé-Y~1½©ý¥BDègÉO´~”iPá$ë[ëÌ)Zf\$#þŠ^·'ON?Q¼ùxsW5Ž‹Ð/Z0ß×xUàÕÅ”ÏR©ž€[à>À˜–û„bxœÍW~+Y•fÆ·(±oÖ«Q2ÿîî”E2Þ-ô ¨ÎKx}w•Çð\ÿçì$`(;}å焪âz* WfÍ;Í/)‘U‚Ž`Æ­6;ùyjSé{¼ñ'Yù»ï>´Qb³ÆêôÆFñ½òÿ ã{ñ&GnúªDpjvǯ¼–ï•铦®3ýž6<ÿޏgÍ~vÙq׸…óiã¶ô•…œÒÉy+ªˆ 8ïÖú§££ËQŸC¼£• u,O éÆ÷ ñ‹":»öŠYÝ<]l¦ÏFgä!M¸¥ÒnHκˆ@s)n†QDD®^]âü’íU¥ÙÑŒAßW:Q1ÒH¢Äö§#öZÒí»4I?1o -‡°_‰À’8”o‘Óå©Ê‡ù3ănÆ#Gp„r>d1Tº1t-(z=~ I{ǡȊo(ú⿽±—gjÁ[T¼¿œ,pU4éŒËUvg> ,ì¶öC±ío¯ž/ŽÔï²±ó5‘˜†ÒM’á6H³²î¹/V|Ò¡ß>¡Ó'K7!/Ö¸ºz_Ø¢v†ÿÆ ãŠû̺8_‡÷ɰ¿¾ˆ iÚˆ ‹"…Ø,¥²¢ß[ñ æg»Ó~þð“x¿}Ëjê§y©wrÚt§ÇOc‡Œ¢¬ž£ªg7 È`ƒJAy^•1Kquilþ¦Iã´ÓÅ’²·ÝÙ;m9Ö2¨ ex»»…1Ü!¾_> Íbs—:¸Û) gþP™fEØ·l¼¥’9ŒgI)ì^c˜I M9ÜzÈ'o>…· tl¡•xåX-u¬øõG®µ{é‚Êqí# êm*cOm­ÔÆ6Ñ@ ÎáAkÉ”dLzäC„§ãÇÂ/J² U ΡæWÕæ–‚¬}ÔÁ‰Ö–OVz¡í¢”ÊAçSÚ¶—uÂ#«“G<Ÿúy>H2Æœ¨fÄÍÔÄ!ŠÍ¿MÚ—Üö~c_‚÷1ò}ŒézMˆàxämõ‘®U¼Y.vì¡Ve¡‚»é<×1%í-]bÑÄ0®9íÍŽÓ¾åV@nÑÍþÿ‡]3+ËË*Ò+b‡[+F™$³æþ÷ëÍÄ¿šòìC:‡ë<¾äï~£šŽÚöjÚÄoöâKÁYÎPê:÷iÔ±T­(µ|L#›J ¸¦IëZIpºxTáOh®Ÿûˆ0LjŸÅ;2¿úÉ;Ú¢F¬åaÅÌ߸g™u_Å¿Êá–¿Çøâ^ùƒUóCe©ÙØfF ó\×#·‹¨J˜òúâP ù ìoÐ'ŒP›A{»ì9[äIÐVMôöÒõ)}F¬'OOâÃnnÿØñÃòs…N€D[^ Ü»9<FÌa¦²«ÆôñŽ™mÞû'(ÇBΗm²íÕvºÑÂéÏ0I"ŽE÷7n/phMEó”¶š¨´%W{=S¿ò4Õ£¾3O ¾Œ«ÇòiE`¸&å¶uµJæÄ¬Ëðß_í|ÌtU|Ql£À†/ü²æÐž’›´©Ü~–Lvxï€ý¶Ëi¤Üþ,¼vq‚Q8¸ª«á&ŒXÇѹo®gdnÏÈ@þV̪ø6úoP2ï…}^§åã×ø™±Õ­xÛ„¨°k¦ ˆb—ûƒ­ØA¯›s⥘NÒ+/=]³,Ö=ZõLS–ÑŽBD†¯P£Û"IdæLC<èç#Û åójŽÄ/ :Ý|Q‡Ú¸ƒ.73ý°Çp37Nv¦ æ·†Ÿ¯^˜š5Q&B»ã Í%A_W{Z2»° :»·­TâG’ébùXI0³â§¬|òQXÖ|¬H®Ç(¶US‡ý AÓ[K»ÎõÁVKÔÑØ8–žCõóƒh•»2†û!ô^MÇ'¥j\Ó sp^Ø*7º®ŵŀŽ,ˆ Tœ?ßuX™äKÏšPP­Öìw¶ ÌĪx˜§ªÒË&\)-/ð¦Þ”]c©ÒŠT;ꜛr™ÄŸë®NWĺEG$Ê"M^Wq ]’ßEhj*,¹ b]çÕëL¯Ý¢›j|4^Ü©y~B#’Ïv\œåƒ*u$šÄÝàAQè ñŒ¤IÄþêC°xçÎYš“„1àîniµYCņ•ÞÒ®Viœ®>‹šJìúçíÇcǨ'žq¥ÏȤe?²0ê_6 G‘˜Ü+brEÂ.ˆUïÕ„DÍŸDM‹fj1o¿îœp}ä—VÖHJf“¡OñôÉ<ïÓskÝ…Â8…Û&UËm‰±Õ±¥ =ëê-Õt»0­ý² dtiMçĿ««lÄžœ‰Ü€0û‰'$ã¸ÞXÓ$ì ]q~s×Vs!|vañùø\5†œc¹N¡¦]®Œ8üi')|Æ4(µdÔlú„ÌÙÐìd«,ñåùµó†ñ§°©;u/HM"Ì1M a˜`ú5Çñ”MJ |ÄÛ”µ¥{kÉ °¸œ–K}É ÙŠ`:7éC¾ùoË·?²x.äî’\P™–î¬ô õ%P±kïðÃú¿“8{‡’dp&v0V˜Ÿ˜ç½«ßî¯ ¤ûYÚó*P•t5WV^¾}›½ûDjÀ2ƒ–É×ï ícrÏ3ÏšÕŸ51²³'´”me–íK _Ã1\¡ùS'¤uxÎÅL¡ú`¯‡Sýh6…©¼ !ù¡%9;u¸`Ï©©[* ¡B~Cíø)P7øÓag¯ûŽªj0…`Nf“n¦q22QFÕ{ÓPâþôפ™íþÄÞokCÜÇ…7X[“Gí&ÁÙ9ÒwÕÞKw¸}e&o¯ð½!ðI3Œ—UgÔéô€”ßz‰|¨ø±ò YŸ,¢}^Ðß+Ú´¾‰±ÜG*'tÄñxšƒq³¾ÚñgT‘ý‚ók¤ @˜¸árÒ‚aþ¸·Ïø-y½uj)Ó1ê\“ 3ËÝÑÞcÖC)üûµEƒXŠpŽwŠèˆ¨褻ëÎþ ­ó¾F|væ±~V” ßÄ7‘?œöÕ®c\ö~ÎŽ©ôÐW.`/y^KžmíÆˆÝ_¸Ä˜|l=üúQ˜¶€…å¼Ú%*‚%P¯ö|-¶ðY—lŒ=âbeãÔïñý¦vab‰¦D1דä$a2ò9&‹Ãv`ùýïýQ*ƒIXùŸùøåFÉ9ϦS}w©•`„Q9/ðÚ=Y=(³‘jÉâæwðqj²1»À¥uŠ–3ù´µ{=±ÊüƒçúèŽÚÓz@³",sGîÑ=®K›-¯=‰§Á[üƒ’¹:¨¹€Ò}ÒÁÒXqq‚JÅ ‘²-I«™PϘkw׌OyþÓ¬A½µ×OÕ6ÃÇÏÖI*¾h@Çò+ñæQVžÏ ½»Ë‘Ÿ ¡º¸œôèd…Kf.+—Ñl¬€‘×’#.;f­>w mNP”) 3ŒKmb/PÙæ¬ÕÓ®38Š}¼\` P6ªº¥‡‡çï>EŽåá£é* Ÿ‡¡6‘0«7þè`D„š#3â¼ Ï[•SßNù`S ñi ®${7ù‰×°ªTðAQ‘ òŒ÷ÇÌTLùÎùc;JŸ-êžÊÁ*E7¡4|¸]z.¬ŸárœN:S1ØåWækÕ Á—åTíƒÇ| ¶#2jÈÈÔw…üW.]ý X y­Ø}ßowk•BíÌk–p¼«:uÍ«Më<£¹;BIs[ÖòíIÚ™&®— mzÖµïÙ¼oÁå *H­›ý|3ÐØRGJ&•sÃ'™hÞ›¡—ªÑÌ!^Õɳ‚·ÃXï&|t/¡úT€lÆÿ­ ICó¿ìÙ³©%šLx¸¹mÀ*·iü)5?«ìƒ,_=„yÒã š¦)#Í\KÙ‚g°Á×~?ìÝ;‚².#‘Î'MÆÒ`ž·ã›Á *}Bœrüžõ´µ÷3¤‹êgó;9RæM›vkH 0NtY_2ʤ—¤§””#’PZûû" +Ü@‡ö}ŽÒ™³FÏÇØù}‹“ÜEw??‚uæÃù<ÀæUÔ•³oÓr—n?kM„¾éT¯{¡Œå%¦]é‚Úþ½@{înâOïØÎ^&P4Ab|DÖ8³‰ñ‚nµÐIêÖùKgϸ«wTØt—Ñ>†1áõ'Øfÿ=³'ä–¦×[F_3uq™hî.ÝÞy¬=ãérR>Õ+lÉþÝ=ÕüɈ¼×¥*†”ûA^Ÿ•­˜ã‹eJ3vÏm×ô,Bì§îà™ÅÑ}Ý. J–ÙrâóEûꟅp8DÑ{µ&Ê’‘î›vCzT‹H…‡e">Žm×Ì&VÒŽpcØÖÕñÖ$ºN²f)Çì "{:%^@Ö¨¶jºT„ó³-+ÜăŸ¯g®Êð Ú¥iÇݘ„éÎc›Žîßöœ!ıӓ+\jQ§Ø\ÏçãÏL,†h±h%r­Z÷çè9L¼0†”ˆ´—ì·wNðN/¶ýÉöë¦ÐpŒX÷"«i%ˆÃnõ>÷"˜÷‹ˆ ¤Ä˜ *ŽSOJ‹¥*µû»9OLµ^úò^Ì%¥/wê)µË…Œ._\`†Áí±”-Óžc» ïm¾÷EO$.¿ÀQ?¨<Ô(G·>¿ñL”§Ã±VC†C¬vCÇ-ð¬ÃFKæÌ)~pQá-q/¿;‘nÙùéô›ß•ʇýpQíÄÆ)'x-™uÇ‹*e2dǦfŸ­+n7mùO8'K…‡²ŸêñºÇ-s;noíÉ3딭옽r%Ïîð¥ÑPsŽ1¼.~hg~÷wôíçù±rÏÚOgÉÎCüEž ,QSGëh¾Ä ”#ZÏõ±,·,V›”ÍJ€4¬°2on㵪$6Ö¿?#-Y™›Ð’N¨ÝçÖ\Ž­ÔQ«ô³;eÓvš'˂ݷ‡FR'Þ,AòÜÐq+3ÝußóZgnÛ`ìE¥ôþ0¬oëL&oZ ÃÙ&¥Õ[›_¦VªóT¶<ä!>=³>\a “W=mÀ*V597·¡Û50Ý5Éå€9£ÍpÜ‘·rrbM*Í MMÌÆÉ÷*]\Î[óîÎ+Ë)F bot©Oêñ<£«2ÙA}"-uešáQ´ŽY1æg.³É6¶·?^Š:‚ äó:<áÏejΫ®è¾ÍGFJà”Vz>–Çöö³—%ùï¯î3¯U´â7ŒÈW!˜°9o©yרã2ª-áíN¿jˆöÐ×ÓÝôÅ&Æ·Ûß}…-÷æ´6¥«aŒM¼ä[Lh]GzÄÀC<únÀ·Pœ™¡ƒ!ÉôÆÏ…‡í(ë}m¸™@]ß[nSÆ÷Kf±\’GN1ʈõ 6/b–©8³‰öƒØ]§æ#®ñGj=«<³6šœC¤IÒ¤‚÷’…»Ý^ŽÇ3“=,åqwdÏN iI2_u,æÏæ’GÁqƒºqæF?ŧ¬^«ü¨IHË·>ÁN@ÔÓócZñœýXÔ!eGn±j‚ò&'$›ÕßÔ5²×úî¹@ç}Êl¹VÚ_ј½½ anj.›ïÞ•0ã5ÓÛ ¡‰<~çj¿x}%Z Wmp†aäÛ%¾7Ûù÷û|†6IØpÍèàq› ³ÔƒjùE#·"<¶‘2Á¦Ikeß’ª¿úö?å½lº…§Ÿ*eñb o²Z°ºj#3¦'Òs."tÌ8`‘¯•rŒ”Û| ¨{$(”Ö><|µEºn]6g,ðÆçAâÙúµ>kÇÊQLeûJ'ÌÑ&%SË Õ×rm4:¸Š,,ª*¹GsV|NÛHG®b\ï×k{AåZårbßҞ̪ÊÛ=ÃS‹ó–¨Mé9§ê'íC ‹ûqo LNß8ÉhbKBçîÞõ³©Pž+ºO¢cF³ÅnO œ•qÝJäŸ$Üü5g¸xþvÏỎ˜ÏKš·¹ŠÔ‹9A{¯…Xóãæø¤†1;*°”ÁøÇi¯–‹äÂúêê›åÉA&ÌÝ[ÛŠÚ?ƒ®RûóÏV² L¤»ú‘_•Mž·­;m °Já¼,ux±‡JY¸?±Ž1k˘‘ìE ø¥ûŒJuW* ¡ÿ…G:i˜½Ü;•´4[ª7wA:›gZáxÏv/Ä91®T$ýuj|5ðJÅùПßVqYHߪ;ïW04|‰Žã{­œhÛ9m-pž¹]PS+S<ÏŽ[x³ƒ{é”mÞÁޏÎM0\y-¡#Ù¥+/÷†;ÖåaŽOáFÁK÷:]ExžæääsÉ®cGT´)Mêèídöˆrk<£¼R;ªÚ^ëµi×\´§±8F–·®9s—DïpɤBæNñXœXš¾ ë×龆xë ‰âhY†¤~dm èïKˆñgcR€øJj§É`ãåfÖ‰v¦Úi0Ïy©äAd z‘ÏËßEÃFGxï´?–ΩQÚ¢$1=±½8ŽöïÈë‚o9®¥ñ4ŸfS•„ûRsøHÏEn«ŠŒ&¹¼W;8è5Ãa{¹%Lô¶â“˜Ñë)ÃÊûo6¦„éïÂe„v¾h‚Éw«_·-v ¦ù†_}­ Œ' ®£¿°ÜÆ0>ì깜öüá Me)eN%ºú±Küˆ­QTäyºñ2SÇ9y£…¶ÐÙkß…ô6IØ<]“ ¯2á›{vû2X3~Ãor[âžîbÕ<þ!M´¹ãîŽ@¦›Q¡70õÄ©4››<{ú Q.†i?õ4;®Å¯ ;jº{˜·êxgÖk‘ä4l\Äyqoq¢A‘4H<¥¡ã‹VÓ²²ýA^X+®%^ö˜¿ïX%<;âÕT–Ò¼¯µ^ëp‹î‹õoÙ_ä•=ŒÒôÜd¿8Þ™tæ[¾;®âÓu·k}ºïGɱêXp$»Cµ¡AP½žäÞ¡4^IÄÀKMG“FpyÌßš82 ¼Z¢Š…å6ßêtŸŒ?Se þ&ººK£%*A}9殸¢]meaÀ·h|σæC¼rù,Áí¡ù} ÎÊG›ô¢®e/)Àã'úNŸ9N£ú‹ñ¹èªT&·ŸO.+|îä _,Æ0žË¢wKy‡›3AÓæð4QR¬¯fY!ßQŽ¢džŸ§TÙë©(5>)ðd¤úVsoûTUÂÓã¾9é6¢!»θOÞ–ãxRÈ:‰ù'Nt?®ø”#qµ¢"u÷8f4±›ÅáiXÿr­ï¦díŽõ‚ÿdÛ{¬µ[±|®¡š‹ „ÚcLc¨iSÅVE†±å{­œ}|Æ ˆ­½½Œ: ™ðkQ ’P×Å-Ñà‡i•œ$g÷èJzð§òV5-éK0S*[˜¬úis‡jbúasVÐ ‘˜¶ð´S@¢­‹TÅÎGö¸~¿¾Âí2Ë Üˆ̨w´Ñ¡s¢8̯þË„Ø?åCrµy‚Ή§9¬»Ä8–¨/Ö"åú²Î²®~¾‡Ã¦ •‹ƒÊ+±9X¦Ž–eû¥&SV:•²*„›v±rl¼“Û×Ö€ À‚‚VN€´4ZòÄ'2 "úΧpÎÀüY ËCoí¥A~̼粆ùÒ)®tŽOÔcŸy94uË/S x=j ³Zñï=édÏO?øNv"§HóŸL*F’-ÿ℟Ÿñzµõ›ÿà±èæ³R±úEÖ™W H±&Sîº4"ßGvšQ˜»©qáà NîzŸývq®ûŽ5 çè„ —¸É½:âz ۺؿà øâe«…™Ìêwܰ–èë!Ô]ã£îìmûã»JÎ3†ÃD®¾Q±ôÓãÞ‹rc3¬ i¡Á™ÝDì¥ûÏc¥ªû¿;Ÿ/ãV’MÔ½pÎóÞGMË(ÈeuÙª Ò¾ÆÐ«ó}‹_ùš¼ã$(!s^Zl»iªƒíÍ:ó£LÉòÙ1Ûœ¨£Pn¡Uãõã#¢¶»®“:Õã˜`Jμ;)öµT*3Ò‡£VZ‚''ÃXOž‰&&⢸E3éõs$yû²ô4=¦Ô~úß)à$ÿ»è&ä endstream endobj 3692 0 obj << /Length1 1488 /Length2 6864 /Length3 0 /Length 7870 /Filter /FlateDecode >> stream xÚvPZ×-MJèEé)ÒIBé½KoÒBJ’Pˆ ÒD*HQD¤H‘&EŠtiR•"Uþ¨÷»÷¿ß{3ïMf’sÖ.g¯³×>+¦âên(W¸ ‰‡H€šÆær@0XJ –X"p>ð?(@ÀŽÁ"PHÅÿe×ÄÀ¡8¦ÅÜŒQH ¿"„È*BäÁ` $¬ðGF¨ @¸%€($ ÐD¡ƒ1Oá”ÿ,B0a DAANìw8PÝŽAÀ H 1ç ÷%œƒú-P0ü¯BJž8Z ”€úb%Pa1` ç 4‡cᘸð]  Ôþ›˜@hé‰Àþ-Pî¸@($>‰%ø#Ýà ál …¾ð:ŽüãlôÇA ø×Õ!¿Óýý+ù; ƒ¡|ÑPd0étGøÀ×uŒ$pA81 éöËêƒEâ¡P„Ô•àð»p(PGÝ %ðû‹†A qX ,ÂçCЯ4„KÖFºi¢|}áHð«>-#Üz0èw[½‘¨@$þÏÚtsÿEÁÍ ²B"üüáúZy À?˜”ƒÁr ` Ü‚y‚~%· FÃ!¿`Býax4 t'P€‡!Üá„ €qxþþ½@ @7 t…{ €²`¸ûŸ=¡óDð˜ <üëó÷Ê‘ -7Ò'ø÷ßÍéÛ˜ê‹þ&ü·ICÄ‹KÊÅ%eÀ@DR(GX„ý;‹)ñWàbõ‘î( ÂŸb ·ôŸ‚þê¾Ð_ƒ! üw.A±p Ð?wË€a„/Èÿ·Ì‡üßÔý+ËÿCàÿ]Ž¿Ïo«Ð/óÿa…ú"|‚ÿ²ôê#hßE˜ä»ÚÀÿŒ«1Ü áïûßV}”0êHŸ¿/ÕAÁÝL8˜ç©üÁ­~ ˜ 7Ea¿ 8 þ/aª`Þ„GKÐãoœ04ÿ>R C¹ýš.IY ƒ-&ìd€xa ÝàA¿ I Q8B@/ èŽÂ~õSÁýü ·N€#Ò @á¡úg‚ЄçéwÇýƒBþBÿt÷oXŠûøcÿýá<1ðò˜€p¨Bä 8æð/n0 áÜoíˆÿgÿûÃà0ÀÄ ví¶×«Ûo+Õ9Å—ú•‡–l ‹ã'0þÇtiÂ/²#g1êi=m Ÿµ…öÕ&yÎðëu¯)îÖ§˜5œ„ž:'›-5Æ/½x²®^ÕÉMÅ%n©¶zæj}Ë›´Ž¸Ù@ ÏÏ_žÎ´€ù0°C7¨ª³lêCôØ’Ùò YCêÓ²â Vñ·žŽä»>eã%ljsSŠ0íÑì 3åœó$‹Â6¤Šðös’÷FC¦ŸYJb[ØùÙíÙ¸I÷™> ]Åk¬¦°~—ÍŽ8øÇJ}n!rÔ [ ’S F$Ë¿Tí&½²ì1ÿc£™º¶)¦S1™þdùL¬üfšDfy弟Û}“a ?Æ]ÆTóŠ·ùô‰œæáëÌ‹ ²±|W8”•÷Syv0÷&xT&yt÷ØÓ+®DƒhyÌhuèŒ_‡wºƒ|/sŠä#î åð^A”¶æ #d˜Uh: O©ÜRÄ œÊ«ïp²“‰í 8F:BVXY9>ŠpR}¯ñö,&ñº¸ÚøÙoƒ„jÇûªXʲ³jD懟=1°Ë¼)HÕƒâþQ›˜᜔ôÑ{<Ì-ýܤÅT ÞíéËqi.› öÏߤ¶ƒö-˜h©ÓEúTÓªÉoÂB)¾¤.Ùtz š’·’ÏF9ÞW¼rmEÈ{±‡M•fôˆãÛ=õÒÂ:ùÉG̵ïE˜ÒXo-•\OjA#¼“k]¼¶Gw¾¸´dU·j—[ £(·¾VÛìP{i˜¸ßkj©2í±Œ'¯/þuæß^cxNÛã¯åÆ=.uߌò CƒÝÞÂ=Ø_šf5§$¨m®¸~~vÈäHégnb(#mÎZžwÐ&Šc¯ÂÎWI^ÏRfî£Ï6ûp›ÁÓT³¨Mz•#1þéO¨sÆ‹7-­e€Z™åé[¸!}ƇlÚÃ[Ä½Ô±Ž·Ü;W¬¿VŒ¦”ÏxÉYC¡=-»û¼âx¾ÍáMÖ姜ⷎ/W¸\¯gLÝø&̸¥÷ü-ňº-ɤözCjÇùÓV¹JÞÕ~O‰ŒØÛ«4Ê—ÇÞ‹x=®gô¤Ó¤á¿Ð¤6©è+! òË(Cû5"@œ´îkKþ°Ët†¹K;×ú@R#|Œ(Z'Âä9Ѽ¥`Ö»ø<³¸‘d\Ýב$ç'ËIdø–Äfyðvs/gZh™sçeæ¶Ù¤ÚŸÞBÏuÎ}ÈEy‘œS.;"©#^ ¢ð5) ñgWú2¾÷agäßR‰ö/NGÓ¦§!ÖN¬iÉÕõ\Ò:m8ªØå[z±?Õ‚Ò>16ƒÑ¥È²÷´nuLTœˆŽsË¥¿w¦n0ûAeÞK;À†ÐBi<ÈVÍËCò“Jº^´nÏj²áÙÛ®f1ßñßyä´QçøZN’/úyóÝg€ 9–¥7Ú—d* Ó®çŒn[½WTE=÷£©b°q ÿùþâ·%ž\¿8’bVVÓY¢÷8¥ý‹žÄ‹Õm]}óæb/äîÑk»Ev.×Û˰(sì«´gePdîtŽe³ò]lð´`2W¯ÚP‘ì˜!¢¼>ªêCÏë7#D?¤õõzôÝ}ï}Riç0ž©®¾R¢"“æ˜c°I9E$Cƒ³æÒ³ ¥åruÃëtÐ1´ñÊæ•»#)B.½Ï?±+HÜí2/ì- †PxQóAfUýp9v?¸QÉö|,¼¯Ì¿!Îà¥W ÖDa§ÛÐÉFÎèœX¨úc³·Þª<¦ó&ë†&(þR¹3åòµ¡Å+Ì4·£!í.À7]¿]¨ñO§ª9Y°vCYÖ9—kóG?1Ùk®ßrýJ7ÇП˜Ä&ü”Ïÿ'¼puzŽbUD©€Á—¼3Œ“üürXì=¥›ö¯ß@èží¦9ÊÕd,"W-7Ó)3ÈÆ¬ÃÂ/ó¹<'C»ÔêÏ}y «ÇëœÓO0org$~M¡W]H[S¥°3¤àÔ´g¹#P–ŠeFø1´sp®wUËü“çm£’Øø»SŒ ¥¥ª±¯jSo’uµûˆ/Ñ1WÛÌù¯¼3"i±ÌÈK‘ƒæõÉ–†Ø»ƺ*/ ‡î_ª-%dÇB–1¦v~5o¸™ÛÜ9/æŽKYÁ‹sÌd½Pø3lÅ^©¦M.ÆÝ\²3ãÓþú3 ªwì¬V^5‚^mPiñÜWµt»ýö£…¶Ú³áf»­ Ö¹Q'+ðÝ®oÆ.M¶b=(’âGT4S&ŽÑ%??ŸÓiZì ]Çz‡›»Ïºð1Gl’bÙBË«æÛšþW©Î@Z |•ð¦þ”ÐÞ“°Ë'·×†ÅQÙ²B®÷ÛY¦k:.#Fº@Ç゙ Ùª‹ïš‘C»5/#òññä׈矔2QÜvyzwó@­ÊFsº÷‡w¬¤ÞCj’.ÿºÁDÇþHJÆõjCÑ[´\¢:S»Ô†Ÿ7 Î?ÙLÒÓM®ÍØØ_ Ió‡q™1œŒšßg)NZ±|É©~œVÙÆ¬Fd¥oÆÅ_Ó¼¬;öô›àY·â«ÎÒB·‹—lï Cõßî;ö•ùVØ ”wO뱈b~WtzÄGô%+×}0_Or©žÎúÎQ•`×gb;ÖÄ݃bO{ó ;.½l³,”oèA§= bÓž‚ˆn)t(“«Ÿ‘)PŽŽiºÚƒ(ŠÆ"¯ò{w–C˜g°C +)ÑóAÂã—Ñ,5ÐÑ+›-<ƒžMÄu{}Òé‹(Z**û)ã&²ÍWÎ?A–ѨÁKâ6RøÛçéó¥5Ê­cƒñØÎ6óyñtî˜`HË`åÌ´»R¯°tÀS·ž¤™æVòø‰Œ›;M.€9©Ñ€–ÃøkQøô N¶pÞÌuÄÈ ØÌz›ž·ÇüÃoSÊ Þy-Z”+žˆÿ*ÖIÄùþÑjèžç”Ãô¥m~Vß«öž&·(®QTÕð½VוÕP­áéì1î°\-&=Ýu.ÝÈ ›Po$nÕ+nݲ¼IÿÈСSåò=²>­ œD3Ó]NPxƒƒ–¦žSŒ?H}V0é¸8½,Áx2Ñ'³Lý7_àÛ7¹áÓ»âoUñĵ‹ƒ:{5d°Ô\Rbéý/uaãË#œ¨·í¸KìÑg2êCD\‰!l¢•¢óPí‹4Ý)nÒ¹ƒmUMõ×ê‹TA¶‚øÙ…¢ˆa3£•ü >PS­ûŽ1a9ì$¿~–(Ž,¾q—.p­¶OD¨œ·áÆÕrÿÅÒǘGþ[â}TqÊKªy1šH¬Ç(çÁíì>áÃä«Ò2íI%×WýåPêÝà‰» œ¢L¯ÿqÎCLt¤S’V·¢•ëdŸ¡^–¢Êzkg"Ê1„f”¸óõîÕ¸Èn]Ÿ¾„…q¦ÃõdøËmV_jTjÇ—ÍU¾ï§ÌóRo—¢%n|Ù²zÉçÎG¯ ²R$u•á?þË×»Õ å—=„±µbÅmüˆ³6×µ9Qœ› wÄUÊõuÓ ½Ó^î®7úñIPPÂ8ÕÆFoF{Ó£½B¼®­özûÝF_u7X€hx· œ]7gJmïvež¢ô˜OS»_Ñ%©èBÚ’é¹qe(™¹g¬h¬tB!ÛÎ+Ò“Újž²°>üâµTÒñè5äÒÌågŸgDöß |”Sp¥¡Ã+ªö}X­Ð*e’ìÛÇ}Œ¶…pjû|Ž bï…݈‡p?㇞žëÌ€Ih³õ)0H6û]@á YŽñ+Ï)Ìl†B=뎹žQ÷™Š}òÃÃ`B–ì2ƒ€"}¬JÚû§TjÁLYßcj1øÊ«FŽêÔEÚ;O®·Äçé«Y=H §RÕ|d”9ðüÂ×–Ü!ôÚ©b|q"eþTØÝÕhó—Ro¨¸àkgqò^©Œ"T 'ÍQ9aJ6ÙìqöÙœ‰[N+,¨z|Ù±{—m“öÐYro©½Rà;ygÇû·–Ch˜ïúʱ =϶vªØWé·Û•,9‰£_aWR¨K,ž;^Ÿm~ñn åéÚkÈÄâ6.oNî»ÛÞé¾!ä(7©­ÔDÆyø¼î÷¢, ?æ6ð}Ž>É÷™BMšwÕ€9pP.×RKñããw={‘ó¡®Ü7TF<²{q žû;É~uø5–ODl÷˜Dk­ÿÊB6±³gSÑÖb«ÇÊw…#¼o&\~Î:r뇻~(Í6‚¼{ÿîEN—á‹„²Ú¾0ª¦‰k^õ,ôC ¶wæ±Ò}g¬ÍÈx÷ˆá,“¯qÒdëœVïÁA·í3ZE·ýý‘¶Ó“ÈoòÇ—½9:‹Ìn™öÏ7æ†\H¶ä2ù2x»´@MGð!øà”¥êÜ_~ÕÀÞ˜ü‡mKtá="@ºüØmg×ýøÛ˜Ãà 2ÁϪÃÃF³?4¦Ë ªãÁÓˆùWíïËêÕž>pS$¿½–ÌÀlÉ4 ³’‹ð!3›­Í<¹¸¤qKiò2—Éáè­ÀD ›ë‹ï¸ª!Q—^ÀIÝì£óOˆÈ]ŒOeCÄ|D8é3W©XJMí˜rÍ5é(‡W=‰ù$š¼NrVÊ u.šd§zr-¶3¿h<1—2u)!š“%AqP*y¼õ¥x–ší ï+u)'¯Ý›5:Ó_Ê»‚/lEÿ3›2 endstream endobj 3694 0 obj << /Length1 1511 /Length2 7868 /Length3 0 /Length 8889 /Filter /FlateDecode >> stream xÚ´T”k6L)¡„ %5¤t7H‡´´t0Ä  %ÒÝ¥4RÒÒÒ Ò-ÝRߨç=ç=ïÿ¯õ}kÖzæÞ׎{ǵozêWšl’–s  cãbçH«h89yØ99¹±èéµ@0{à‹^uAÀÂÿ¥—†Í`LÆ †0S€Š.ö.¿0—€0''€›“Sè?†¨0@ÆÌd Pa(BÀ@g,ziˆ£;dmCÜòŸ#€Ñ‚ À%$$ÀúÛ é„‚,ÌÀ3˜ Ðq£…™=@bÂÜÿ‚QÔsæàpssc7spf‡@­Å˜Xn ˜ @è „º-¿Ê¨š9ÆŽEв9ÿ5!V073(€ìA@°3ÂÁl „w4”jŽ@ðcå?¬€¿Zàbçú;Ü_Þ¿À¿Í,, Žf`wØ`²Ôä”Ùap+À lùËÐÌÞ‚ð7s5Ù›™# ~'n“T˜!êû«:g (ÈæÌî ²ÿU!ǯ0ˆ&Ë‚-¥!@0ÌëW~2 (ÐÑuwŽßcµCÜÀžÎV °¥Õ¯,]9´Á ' ‚Ì_ëÌðqrr q€N ܆ãWp-wGào%×/‘¿·§#Ä`…(è ²"þ°<Í\ÔèíùߊKX\\K `´±þ‰Ž€VdÄä¡ 8À€A<.ç¯ßß'#·,!`{÷Ì—C_U^ú•4Ëï‚ÿVIIAàO6!7'€‹“‡ €8xÿ;Ê+3Ð_Ypþã«¶‚„þ$‹èÒvýkúŒ-àß±T!ÆŒÿÜ“Óñáú¦ùo—ÿ?vÿŠò!øÿæ#çboÿ[ËøKýÿÑš9€ìÝÿÒ#øêCp_‚Øðÿšêÿ¬« Ðäâð¿Z˜b$ÁÖö7ä,‚-_`6¨ò×þµ`ö 0ðÄôëA°qqrþ±UvˆGÃÁÇß* biþ}¥,Øbùk»¸ùøfP¨™;bĉàÉ…XCK ü7ƒì` á@”ç °‚@±~ÍáÄñ§$üápX$þàFè?€€ŒÈîo€WÀù/q7‡3Ðñfüð"›ÿ–¹0(ð¿|8ˆ䟘‚ ôð¯’-\ PÄÂÿ¦$¢ÿ‘¿.@ h5ûb!`[ÐtY.IæÆ¶1üb‚~C÷›ç,´Ùå'z"SYšß2ô‡db_Þº,ã¹ÄÕ­ç^}5zpC¼zãµ×I¬ÆØF#ÖÌ(Ñ—‘Ü=ɪn Lr6-‰M¯['/_;ÔzäVEú,'AœW.ݺäáUÝEóƒA_7Ô7Ëø•ݳEjGú~œ¤Ï6OŸ"¡yc£À`Æ?†ãNžÿ˜ÀϹ§RŒeÁòÞäÉóÔ_ᎺšòX,Ñâvn#¥#Õ'¡@=Çcð”ÚNR$žö,È[ø2¯Í£ÊÄfM^`ÃcßæN-i„ƒk;+\g[¸¾e%ž“}!ø_QXûÔJ£FXÖhN«à±Rl·XI-6ýÐi·²M&Ÿ¯ºL PÇW`g„º -¾n{Ì“™«èv4”{ûNA‰ÈvõÚŠT÷†øVáÙ>»«ôÀ ®É"_EäGëy]ýódÝj7oŒ¨•hà½=3¡cP—}Åɼq¹¡9þ½+Åtb§P$1ÔÜ)ãœ1+œç¢Ü-±æ±ßâÈ5?=ô JG㨷[Þ4k^ëkyõ‰Æö¤Ã7n¶âm€?GK˜l฻a‚kòýàäÄŽúÁìÓÔ}õ×ΣO†©\Þ,L£q„ª©¤¹Ymê™’ªâM¼iWqî¸÷W]þº]Y$’‘¯ÈðøUw"RiÂL›â]¦T±r4_K|gMt±ÞÁæÓ˜Õ8h’ÚÕbÁ¸Dèìýzïé±»QÙ_¯i³¥X>xOϽm¼¾$|þ¥¢2_CÓ8+hâÕÀç÷fÁrç;åèŒ-oÒ+IªàÐâÔ·,>-™o (š‘bS g@—èx’¹¹>ôÊ;”mõ°ç†»$]ƒð%š_èó~ïü‰¶Æ†»÷] bëη[À¤^ëîUÔ¬ Ÿ9\ŽkÉÙ…j\¼ãò€±ŸÜŒ8NÔ8ÓQDYnQôN«ªsŒN•ˆ’g⌛µc›˜¼w™ãu‰1³ AƒC?Q·.b(K=–nkŠq¡Á ~B¢$³õ ’4Ödqå!j§eß)Nš¶jD}½ø~z^¬¶~iý®‡2r¦&À: !g"Ðö…9W…O‚‚ƒÐOjÓk}†líì'„šziêà“ÞJÌéÖíÇœòùb€ÛŠTqá}ö“ÍÀŽªå—l£$ÂÖKí8¾²â¢‡¹ÂãhSl…d‹“”Tü¸±é$hÖ ø êëåú ŸEuMÅkè:?@Þ8P{Õ<¼w óÂÿt8'Ùõn¡‡fóÛùZWûQ}Å`//¡ê¶‹¾~x:®²†£úÁ÷¦›ËR_²~[‘=‹3# ãÂç¡@ÒRÌk<óEÒ@³F ™Á"•ÛYc†9°‹µÎJÁbÎ%ê çLæ²\~ÃJŸ»ÈþeäO­®—ß'5eµ;ô­kº)ºbŽh8þ(?Ù`|t°~”©»k¨-¯\^ZËN6w\‘e9xÊù䲤…åë;äôâTe+¥3¥šƒÃ™Û(EvdûÈHïÃwš9‡Ò6jÚ¹póñ G>Uƒ;f wçäº=asŽƒ* €Þ{É~¥ŸhžV³ËoÞ ”NP]`^a¬Š¥1µ2Î >&yªÞÚfÌOQ//5RÃ$Mb•öÅ>´ÍºîÅhÎRÄmU—OI^V#-lVà^TMCt„ºKlÖ$Çèpe¥gð䟡Q yå"¦mÿx<œê}”±“¹Ö³^”³‹>í²‹±mû {Á=÷¥±±_FjŒø[šHAɊΠ䨈–%¥;|“êrÝɧ͡ŽFÝÂ]P rÝ3ÞÌÎÑ&K-éÅ4%»}æ¬ëc DE×·=R2ö66[tü:¬sì?_’Î šÔ?/°µKËi•tåèÒ4q¹’§3$ÇëKxK &è~üø¡¡–õ@È ÃÚúæáÅÒ:ºó4梅Eô#o¸Áy5»¾´õ¢dæÕ| Õà9Ꙩë¥ 㘥Ð+e8DiŒwô­xëk ñÓIŸh"Ê.Ù£6±Ð„š‡ õ ’± åû‚´TÊ›¬Ð¾Ó4/ÆÔdn±2jæH__²çÏÂè·Ã²U}ã| G™üà(öû».” • ½¹鑪§ò¬0K¹XçmÞ) jçPRÒy°vÔÀt¦=›ï¢as3oPòl¹«g”²ñx¿OÌ¡ZÐÂzªéÂfD‚Æ|ŒoêÉúÙ‡Q§f´q+‹j9Ÿuεºµ3€Ššeò«¾QþãÍkp0¨ƒ¾Ì?á£^Ï©ê ÷zSeb—‡a<ϦënæÏöÊ,f„ùüú´¾kS‡ ŒõØ9ˆÏõ[u¼ÂÃY$Çü¼y‹ÐkÞb]/ïÔ?^)woª'˜ç¹b`šY盡QÓvLñês¨ÊV¬D¤¿g¡ž =o)*d<‚iô™ðv!}‰xIpÊ{üp÷­ø"·Ù)·ÎE=,sû’d·½ËI l¦N$ßO‹ ÏšJãz-ÏíÚ°ÙØÔÜ#ŒyÒH3UýŒ!²µí¸×…êxÆsps¿fq#îÉѦTatóþ\§R‘ÙŒ[û ï­®=T:!Áaߢo« V± ã·†ŽølžNL eÑéáÍíh®øÊO£øœ5¯ß<“!È+åð§U¬]ˆP醧±t3¬’Yj½eÏŽµIÿe—ëñìñ¢[W=KÖp"ŽºÛ3¾÷Žkb^~ªšõ :…÷·¢õ”ÒÈûìù(SvKšR|}ökt¢¯óKÜÆ?Êûs¶óiè¥=ÞyÉ d€þAìj–kDÙ§[–Ü© þ%9 »ª7Ÿ›,¨#ñXOÄ}ÂÏBt5û±¡âºÅ6ô)h«Î(ï“îµzi‡»I+?©R× —ž¦pß-¼høi9–‰u¥µa·B-,ô*µ"*<„Ï¡‹>H~áÅyÐFŽÆáãòpÛGóÿvðÀÉ»?)Oõ|óêãÝJÕr¹‚$PþûÅó¨×Ò(Æp† "ö FâS7>EÀ ·ä÷ŒÌb]—òBÛÕå‡íìæ²fQ¼?µ|zªùQ6wjHñͨŒކy ÓÔìó™ù8¤<± ³VþÉE2DŠ©2óiŽ!uœ¦ÿîdþðݲ)ä±8ºÐUièGÏ-¹H;!©'XÊ\¥{ŸÜ!Œê$ò±tœï§Ëx>Ñª)æ z½Y=¤‰89¬ŸêéT«„X3v5·פ—­òz¿¢>Âe€Ø7‘pÆõ_[‡ÖÕ ³©Ø±„ /"™¯W9¾±ŸuãcÇi­2ÃÓjƈ–øÊ”[ÜI‰ŸEÝ‚gbù\sªR€Ä ÛÐGàžö…°lè‘`0õ§Š{±§ú—þ.Î¥Ó>ÏyD:zbbã246UaŒà1,\š"œÇýXÏÔpïLñ%“Ã!Oàæ}G²Øgã)©jŒŠQ‹ug•°>tùÄ€3 s6Ðé²[µ¦ÐHQ £8mmóƒ=Ú¡’ãK$¡ù ™)VVÚ´gÈIu«%}Óû¯_Ì'‘ˆ°ˆ * ~Ï+î$ö-œzC õ¹´ÆÈãJá GJCÆS¨¼N…Zÿgž!ÿe¸\‰&þ³$Ù—XÁS­g½ê¡Îæ®X0²±Î¦.:1÷Ã{lk^[a%2­T /¥Šï)k88:¾-nø=°søz…&®ÙE,w¥F†'Û˜è^Ú×^Ž ÓŽßµš]ü0Ý$‹ƒ; ¿ýäרÙ47iò>èÁG™\ ³=òéËe0iû0óÔ‹K”µ2×åÄeîÛ¸ýží•óüiØ.ÅÐ}3£iùµW´‹­o€oøs­g|ò ^Û‹kNøµ}Ü%žAçk€º[='âÄ£ò”HŒšé=Ü -gi‘a½íŽÂVÇì£u ê >ß0 ºÿˆÈW*‡·ÚðB&¯÷ÝùŽV˜Ìzr‰/ Úœqž±ùcQ1ûmµt¿`M ã}à±·c`nwLî*¢¨%ëÁ¹üÚÄZ“fIk±U¶e2~Èj‘ò¦ú^ò#rM¢CS¡4¼ä¹ª\gôplÇûK Ñîþ‚q™1ßÉ3£²«)˜­D)÷R=òâD•‚4Õ4>°q!ÙKM¦^üñn©opaˆÙên Õ6FY¸ C² ™è#¶Àù}ªj’òóú ®ëV-ÔÕR~!TwG¹°ºï]b+xdžËÏ¥á¨o”U™Æ»t6D/%œWQªq.Ò\—g§œ…NJ » q}z»ÜRî†vÜÏ=Tixâýc³YÌôŽhh0 B µ[Üxå;¦ƒ“‡WW3ªfÊHÎyQ,Eu›Ñ@ÕŽÆ‚øn€6N×8pb¶z·Ç%ƒe fgÇgb¡sA÷EsTf©ß™Cpžj‹ävêS‰Î  Q$r¼ [®Âo Fw(OÃ…ö¸ÙxÂ_I`œOMŽ¿^´Öd&?xù:é¼ÈVø-ïÔFßD­`#WG6cWQ¤«„´¨™ωF鵯ºUaÿ æÍ€ ^hÅÏw7;¸¯ê,G»l6ñƒÈ›ý¢  \bÅÞ9 =ˆ"YpÁ#éÆìÃÌ1«Î9I÷íÈé¹à=/C™Œp­¥r›œ¨:—‰c°]wÕQ©à/ +Òs±*¦wÅlþœeѤÖ"¦—‘Ÿc¼ÖŤX8£UpÈÃN ##ð™ËØ,éÖá5¦Ùîˆ)n¸œ0Fk,¬Œ&wwª\¦‰økË•,.œiä·€u1ž¶ P¶U=TwØñfr°Ál$¨Þ!hhÕpAW‘Áq(TLiêG>¡Ofª[Ûª†[öÜ8&é/ó¬©$nç—ŸÇSx_4OòÓ¨xÀ¢2Œæ%™Œ”ãÓB}"˜ÀIe™ÒÆ[êÔ Íø‰‰ÔuâÒÊ߇mDèWÞà[„qÏMÅhãåN‰ cHE$·âÈ™ŸÈM•%Æ žù£_g~NV ˆC“TGœÇ2wø¥@Øw’ j®þx¶1‹­§à²ïNòÚù“8Á#ÊA® жÖÓÑhá\ù¥–e[NÈgªtŠÖE~‚•¿yJ9éõÙ’&~¶ºÓ“šƒîE…œµ œòU:jF<,n—®ªÌrÆòC‚-iLxzHW 7ˆ»«5h~eßdYÑ¢5½Qd®öc.(UƒM ?âb«l’7ã‘{mÞ„Îý®[MŽE°Nñ*Úñi“£™ŸÎ½%R^E£~ÜXö`äµDHÈb‹špzå7h…qÔ¦°J¾sÑã»ÀÌ1'‰f™¸ŸzïLð|&D‘ÌŤO€‡Qõ£èý(ò{ß’Ñ* „S¥OîþÜîÕ°M³ã–LÛ` ÷7®\Ü&Õð{aõ$t'‰éÒÚVr1þ9<Ø\ê•¥hÙzžñxë5ng¶ëÔ†ÃÌ#EêØ fÑÒ ÍJ”Þ”*ƒBÞ¯) æ5xVJr³¨ú[îѬ¹"ÉñcʞDZãfO諪úÉQ¬wlQÙFäxQá+m‰ñ‡³ó1*­þ$œcAògámtŸ’( \z5*5uh GU×”pŽYBÁfzó$"14!öd(–:ï#›Wá¹†Ž ”Ó’î‰mäE±[)ðYfçÈFzvSöß±amñX¦$'½>!Û?ª£Á\6\°ÇØ ÿ>í3•zöÁŸÝW3å!K/±nsX¬aטQ[º¹îr6õÕ¥<ÇYB³ÎCÎ8«è&ûèEpã–¬LäãjGômi¨ðIù)Å“É}u<´9ßb·Ÿ® ¦ë~&C%ô¤ŒuÖž©©U‡Ý‘­§”†é/á?±ý’Rí¥‡ªÎKÕ»)-J¨™9$†|Ûø)èDìu7_¬!ã±Ù³ñ³û6Át¿w–„|#&‡tƒsM:¼gÓquìó²¬9y‹¬Ø´ŸºÃ&-i{•‰Ú”ï$tÈX®AÆäêõ·~ÌÇÂÁÜ?‚ýUß2Œóì“É–€]-»x‹±sæžoåßtíy¢ðsÞ¼\«,•.šßÎÉwÇRíd6kÜQ.ó ÀÞ«¡&ß±ºl¢áЃ*=yÔäµVz‘ñüã …M^ý9ZËÄKïg1ƒ1!6ãä7\A ަ´ê²=m YÞ¢y¯ì>ôÎÝY÷ÏÛ}µ·/ô–•!ipç;­$ê˜Ì ÇÞïó¿?G¡×í·÷ß¿ zcöåö1 |-õF¸:µyv¯ƒYêy%2笫©+Uݵ?¹¶WdÅxèÓ¨ÕjSPAß©2Ëuò9Ã>/ïá]ò¶ÌËOØ‹O*͘¥ÓÀ¾}ô‚FnÙ0Ÿç%J›²#n#Ó2G…7~ŽÝ›âQ=iLúÔÊÅÈ•²¦djÙ'¦žŸ…ûM Ú?mÈyѰð¼ã´ïº2;ÒG|„y7‹¤¨¤-–ífJZæåÞ³žâˆY^eµ.*|ª¼âbsZo»ÉéÜ«¥})Oyí¿¿–ÁtYôh ÁíVD:Þ IÙ1Ü•}?vÑäºñ–¥‡^¾p'«ÔÑðC™i#æä¼{ªÕ»ÎlC¶C]–¹§ù±[>_ Ýæn”æ øoά ‰¼ëê\xóʶï¹ËeIÄUŒ´ØÙíý{ZÆÞÍ^×3Yy¡ù™/MáŽ÷iñáõ?öfósF±%QúãX– g„ ¼GEJ¥ó(»‹t„Îh³ŽRÍDzâ è+„ï.I|8Vƒ®f´Ž&ÍÅŒÂ7—&ƒÇ¬vý¿ºÝû•˜ž½È“1ËXÿ êckb¨Â˽Þ«z¤þª(²<ðõBà‹þ”m‹¯Gâlx÷âkö«„3°Ñy~fö´üË—CÚ¡:­·wÕOædi_6ÅØV%±®;wQ²¸¡Àè´˜>#OãŠÈõÃ.1å-­ÖC„Ïžð‹ÿ¤ Û¬Ñw,N\Žú‰ðÕRßÅxË`âVÕ‡ãgz#ÙòÞ}OaÿÂÆ¢ÀÊRÛãÜ>°ºæñÝ2ý”›^.«±FݤèXpèhØ¥“ t9‰ûGËá@$žTîjê¼^%wB ~™Ü‹ Ý‘Èÿùµ“Ñ&î<ó[hhD¨¯hSëâ3tÿAIÚÎÄ2åß7JN"Ïv´,¶Èi$™„Ø;xÕÏo“!/­qz‚N“vãRÛ3 ò^þr§Bßrl4Óe ùˆ÷‚q,¾“¶~JCÉ#Öyôýgr<®•¤´UòV’œ§Âô,?IóåÎ=½alÃqãõeI°åƒˆ…˜¾y¯TBrÈã›Û·É˜iC@ê+}‘çžøæÆž½#÷BêI¤ê¶¾ ¹Y¼Žr§š•É%l×=¦{êõ«‰h ß¿¯ÿ(šÍhÙÌ€ìïæðp‹õï¬wÓG“tÈ\»~щ³”™3¯ "ii ¯ ‹ÔdM±°ß˳Ø!-N…9×åIÕŸêJþ ”ZѸ2¯Z¹¼ ¯Ï¿õ}ã¸á)µ!;vséÖñ£Í o²d†¿.¿püí·ãn•×ùýp÷»Ç6ƒg–ÂK?P|öCo(C;eÙò+oõN9/ÍI_Óâ¢L­«=æu{"– Qv<×zŒ9 ›¨Åɦ—¬Ü~1†% :ËÕA¦¬\à ÚA˜ƒ`“$·ÑxðÆŸ-ùƒW%’\/íê]õ¼1¯/ZÍr%o¥YüF™’ôâynKеßYï?#ã—ûp[¥¦Gª‹ŸÈb´÷}¢1ÀغÐ}×÷u–ÞiiÙ£ü½Q\!¬~ñdx?ÑXÇÀª&Ñ;Ló=-Dò'cí¾©`r­j‚ñ@_]œx ;>nd—äso¦­ç§±†®ºä.Sõ_<ž€ ÑSsW»­FuúèíVÒO_¼áØQr»¢B­êÅHœF·U¨_Â+nã k&+å¶Ÿ~ëüÑ’É`®Ç‹q¦´“ËOεèxÔ›XÞàkÛ¹dú*ˉcô¶²;_$@Vâ{ëo¦§ªô}¥U;¹±ú}2QrM]|«¦ÄØÏ ˜À÷!®/}¼vÂu׊¤˜§•¸¿æzÜ }º„Y'Ó…)Sœ{\6b`S$Hý”%- &A! ê&2¥ãå¢WLÃt÷Ë·~OqÂÂ!ˆÒ²Wz̦Q¾ Œùh<~ÚÒ°eÝFùdŒën¬ëÍdÑèúÄ·•øa‚:~aUÏ á`a0–¶ñY{nÜÆ|j'<Þ©ÓÃïm¢ë#¯úÀª®OåOƒÌD"T¯Ç¾¨‹/csp—o; -±ä¸Ö^Ÿ}icÕ¼©ü ¬-±ÑÍ „Ƶ;ÙɬtæFÝü+)òWóÂþèQbnÜñ‘ƉsTº«Ë¢=(U8vK|E-½€‰•ŠÉ‚³»îgx¡<¸¯fGÆÞA—›£btòšÎ»?ÄQyšÈqcÂT“Ìÿ³–86Ú[¼E©zŒšk7[üíNFÒŦwµðï=Cv<$6t5É£«ààa¯gh‡—€ÖV¿é1M?Ù™6ØesEiåU¸.żԛ|sLa´£—e¾k}0J®ˆ>Y-7;ëáš “JYŸ &hü—¦ä4àåêm9-#¼‰ìË M»ÿ•bMb endstream endobj 3696 0 obj << /Length1 2175 /Length2 17201 /Length3 0 /Length 18497 /Filter /FlateDecode >> stream xÚŒöP^ÛÒŠ÷àšÜÝÝ]ƒ‡wwwwww‚»»»kp÷àrÙûHöùß«º·¨‚5ÚF¹ºç‚˜@N‘šßÀJ(beiOMOCÇ”V”¢§ÐÑ1ÒÐÑ1À+™Ø›ÿc‡%VÚÚ™XYrü#BШkÿaÒµÿ”¶²H8˜èô,ô¬tt::öÿZÙr„tM Ò4 +K ,± •µ‹­‰‘±ýÏdúäzvvVª¿Óü@[}]K€´®½1ÐâƒQ_× h¥o´wùŸd\ÆööÖ´´NNN4ºv4V¶F<äT'{c€Ðhë4ü% £kü·4Xb€’±‰Ý¿ŠV†öNº¶@À‡ÁÜDhi÷‘â`i´|°Å¥²Ö@ËKý+€ ðïÃÐÓÐÿ·Ü¿³ÿ*dbùw²®¾¾•…µ®¥‹‰¥ÀÐÄ‘¢±w¶§èZü¨kngõ‘¯ë¨kb®«÷ðwëº~y€î‡Âë³Ó·5±¶·£±31ÿK#í_e>ŽYØÒ@ÐÊÂhioûWB&¶@ýsw¡ý÷Ë5³´r²tû24±40üK†ƒ5íwK ¸Ð¿c>L°lF@{3+;h:ëÓþE äb üÛIÿ—ùCƒ‡›µ•5ÀðCÐÃÄøñÖÍN×°·uz¸ýÓñ¿–ž``¢oЙXÂþ©þaþ ¼[gÀºñ£Ðýõóß'Í 3°²4wùþ÷+¦RS–¥ü·äÿ:¬œnÔ, jf:==#€õãÁãëÈéšü»äŠ[ZØÿÕîÇ9ý§eÇÏÙ¿„ð¿µd¬>& û3ètÌtú¿èÿ?ûß)ÿÿ¦ü¯*ÿ¯ƒþ;q07ÿÛOö¯€ÿ¿®…‰¹Ë¿#>&×Áþc ¤­>vÁòÿ†ªÿµºÒ@‹ÿë·×ýØ~K£‰¦f§abù—ÙÄNÄÄh gb¯oü¯¡ù—ýû_ëfnb ”³²3ùë‚PÓÓÑýßÇŽé›}\"v“ù· ø±BÿK+l©oeð×®10³tmmu]`?^õb¸Ñ,¥ÐùïYÐÒXZÙ¤>$z ­laÿz¯,ÌZþ¿LÿB¬ZÁ?ˆíc´þ v­ð+€Vä¢ЊþA Z±?ˆ@+þ±h¥þ >é?èƒOæúà“ý/bûà“ûƒ>þ Å?ˆ @«ô}èûþ}°+ÿA|ªÿEì½èþ1}0èÚ}Ì‚‰ÙŸ½?è£Aý? ´7ŸÅŸ½NZƒÀCþ~0þ2ÿ…¬lÿáÿPeôøQßøÛ‡,ckãKúOćÍäðC«é?à‡<³À)æÿ€Z,þÀ[„ö•?î-Z«?ܱ_¶¸?z·þãþàµþ87«Hÿø\ÒÚü~hù‡RúÆíþ? Øÿ9˜n{c[à¾U µw²úG‡4‡ÀiŽÿ€í:ý ÙÎÿ€å]þ?¤¸þ‘òQÉhû/ªÿY;}[ÛOÐß×ãÇNþÿý½ú°Ë Vúœþ¦5þm?ù¿8QïM00! \‡ÞB«ì c;Èû r=Þ0æ…-ñwÍí‡=n¡œ0¿7š©bЙimº§„q`,×µAêíP¹O¡p?ØI90ìKvvªë0Za\4) 9ÝòÍ’cRÙ\íͧ‰r‘4UÞW_@‘6œÒÀƒND„Aa±±1ƒú·ó§·W TóÏÎuˆ³»æ›8‹Ã9zLée`ÞX)¥1ù•òåøÁZò6ý˜'ù°‡GRg 0K¼Û#ŒõMæ{ÛæïC¦g7¦ÈKÄ™!¾;u-v}ž¡Z‡ô>ô(E…WÇNªe¹Ðª*+‰ÖŸ+Ý#mvq>(ÆÔl¡ 3-{÷]­%œoÃô(øÆ^³ÌqSý»_=©ŠoÃÌj¹ÜÄÌ¿tE±IR(í-B@ýRºWÅp‰ÆI³å Utå  ½úÛ%®¶&î{·yˆ,2´‚IN>.BJ‘LCB 2#è7ýp‘[Cr±‚îQ[¥ÀùÅA—†ZÍNxêÍ,#$à´FI] >$a°3J߀g«¯vã´íB¼ƒ•9íŸIÞÏÜ­US…÷Äãâ  ¥G“šƒg϶B£‘s¤ÃÃùùhÑÎèòœÑ?ÇpÏQ '=Gö¾´ƒMú@Š54UA˧Ŝñ$L¾LÏ‹‰o¦ÅÙ‡ÕºÀÀ‡ƒIÑ̼Þn&Ó˃ëÕ–æ‡\œ`ô!ªŒ¯Â¬&5Év0÷øF Acfû èÚoª'QƒpL]haCQ¥ß<{µ‡P‡ŒÁó#k«ðJ×ôöŽinýP7¼¸³®ëgïx¯µnU.ý³"á/¶¼ié¿~ÚËÎ71ˆ¿¸ÇÕѬ“÷PU§EÁ¥ÑÎ&F¾*t”ÈÔÉBôœÏã#ƒ¢ÏO ªêéô– ˜%FÀüª‹d€¸|_ äiYÿÂþUìDFf"#f +døÞ†)ѳ듹§ðnቕá*‚æÇW?ø®µœªÇ¿²ßV"$ƒÅOý+„›á…I «]Í…E/SFb€V)X‹åU1›-Û'#J)¬l 6€ÇÎ:F¥”:îd*ší&ÓéÂ#ôn‘w3¼OX3ÊIæÕtÀ®‘ö‡`3øü{Ü#ìne˜ A¬³amå0¸¡Paa4Ù¬ñÈãÅHp[H r=ïкzÊ,¬ eŠí¼RÆ’Á|Â`ŠHƹXþIp±Èê¹eC&–¦Pì\D·®¼ØQÛö4üó™0áqp ~OcçÎ\¸_½SpÅ¿0Hm™Èª[<è<$u?.;¯¯S–é€7 nÃbf±wr ßÛ“†CeËW2­ãñ­V@?å"³®tzý »9’…õ`{nfÛß]eÎbÙïôռα}û]/ÜLFIí(÷ÒøŒ¸IÈðÒqÁóÉYö”tÊêÆŽh[I‚Tv¤õül·¼ÄœjSøÇBoZÁ,N­ ÝÏ XMDêã'ÃΧQL¸ ›|‹^µDl£È„…„íµÆ7f¯èS•Ô)Юí8Oô›À•4ù×ÍÏù¡VuQå<º PŸ/¸)çŽü`²; DÇ¿1¼Áù¸*/µ!7]vòJ¶0B5v¡Ó¾“¾Á‘^ßG}ÛT¼¤·øípÎà v+ц㡔dõâg ÇF§Ui5%±Â,Ï ¾yžð_aoj?)™¡'B…$nD¬Ê–˜³9ž½K:5´ h?§Œ9ÁÍký:[‹z¥_‰ÚýRðcÅ!cñóU.ÆB•¬F誧(_õ2%ÚÛ™†plQr—Ьk«U™eF‰«wc­Wßq®…(dÿÒLì!ßlÇ"éT“ôl§.„ý ó w)-ÎïLfyeÞ’¬T»Ðz¨PÑ઼DÕ'öÇÕ™ng¹…*®GsuõjA ®©£ŽC΂ѳl©ý83©ÜñJM:íUçÊ>eÆ”ú<­ñ<ͨ–{VG0… Æ­òùÕÞîÀ Æ;Ôec•"ºM‹ðÑ“粞äLýlZGa†#aïœÉi9Ýøª’Z'}‘zúÜUåL»ò‡&šœÙè^ã×;˜g5hY¾nµ`¼éDA„O¨S9!_ µÕýç•r½jRýûÇøÅs'AçhÕË;ªÙ«~7.ÈÅÒéC ~—õ×ôNx¹QßrÊ<…ä²°x0ŠXU/0µbþƒ_áa¿³_@´Lø)æù'=1Þô Òí¿ˆ´·ÿÚ?I’§^#<0’Œ@jk*çàJâz"ªÜ À¶á:æËØb­:½ù£R¹Q?Gîà¡7!™ƒS# Á6#š ¨cIªÃÛ©IÖÿ6·ù†š ‚öe‰«E¶Îz2ú{Â|jˆÞNÑã‘Ý"ùÛjZ"=§;¬ø¥¹Ò Íg¡h‹ž8˜5Íøq·~¡2l ʈ`FùôüËð4sèÖ½!òÈd"´¢p÷:çü¥18«õJŠñæM²~l Jx…d–§T [ºäìbSÆEÍ\Oþò|á/G¬=Úk98M¾V>¥¯ÎàHÛb>Û ‰Ö»È–wÎrKgV~ÂîM¯åFÅ8A·³ ”“°¦?òßµ|@´p™^vâ$lêáuÀ;NÉVØOܧk­Ä<ŒÚGÛ•|Kܼ@µ¦R8¿þ×ë¼=]ö> t[“8¦OÐe84ÆeMZPôäSýBFâŸá4ãóµdÑ Õl©潋­Ù Jeoù/[Zn„å­Š‘׊YÙ›©+] W©ú =ò »ýhÀ©Ì@¤Åfå´£G.²>wöø¼éÍä`â XÛ.D Ä‘j‡4öžå »þÌZåvsŒZ…ÎéÆdgSÒ·‡¡)vøªeãÙùfâæ¯DŽÕ¬Bg§w™§²þ,”¦m5K‹B%#¯‰ãWž5üÓ¿¾Fª xíùAÈå,ÉÆ ñIªÛÚ2¯•‹»Ö.‡fSê¶Üåz-oûƒñ?ÖÒC¬Ï(™Ørv¹:žr† øk·{¡ù”h''ô`°ñ²®ºæ€%?^ ¬W1_&´ ‹ý8ªfΪŽR»l6õFô_ü±ŠÖü1¾äuº”j~ P~©•[öq¼ÉßòÀ.Ãîdë“ãàöDnÉq;ÝÅ–:‡Ê·Ú &!;ï1:Ä–.²0_ÃP2iÝ¥Ÿ^é–àŸt”¥pi=õŠ€û— ga¡ËaWjîð’hð6.Xa»nmjP§Æ€ëO Î"Rƒ8—äfFvFGÕ°‡ãĸFÏ o'I±W7ÂìT¬TRb8y{æ:Ñ2Ë_Ï!sÕ÷bÃÂ55 nd/ØúÞß½pˆø‘¹£² ã À“ó®xlam‚{ºÎåš ¦ú èôªi¿n0Å!üÞ¸Wê°ÐãVœeÀ£ ‡[ ]IhaK²ï\£Õ‰[Ä.Õ´â ‘˜·‡ýÖ£bOj®'ñ¿À»ñxWÑ8ñìÐXø—’y´ >Å3Ë'T¹»/ÏaÅ84ø2Ķ_§Î—èz©®ø@RyŸw_ÿ½¼Ö’Q ÕX&&%Ær¶£x¦¢ñNfN²Ê‚Ì÷³hˆ•¾q^WL9 òTBþ"V0-¶Iq·šCiâ^fòl®K~l[’:l¥9qhMA‰béܳzã&3Eiç_—(øQ)Ô‰Üæ­DeÝ ÊEgª´U"Âõ²%Eçf‡à©=Ãúée\«ôå ©ÝAÇTßú ‹Çr¥§>'c’ívL膹æa…¯»~=XX–õéðù ÖΌԓÕ, Ô)¥¡ÀϹ¨LH ŒIì…ŒË$F#{w3ÔMÉu¸é˘@w¾À)mÇ¿ô´%&}²Ù'× lÛ–ê :™¾MDyâö›‡Åoa¶ï4³Åžn1PRÑNÿî‘AË2ª·*ëÇ7Xhž1™DSƒžrÿî„ñ„JéæRJ#«k\Õé|1Õ‰½h©5µ„ZЏ¤J,{Ïò²€õ~’|@ºKÂ'µéw9RCÙÍ.ëà\hJs€áqSéfe¶’ùëæ”Óqðʱ Š ;¥ÌÒ·3ú5m$ݾ®€áp¦Ðûç´uMÞÄxÁ§»k1aæ»ÝMT"µâÆv²Ë¾hDÑPß&Ä\i9É8vTÓ`i…“H1Kw<ëiá-¦ƒ³{yU*£ –£Lõjlðͦ?28-Â6Û7ø¿DûçÂdž¾^úŽÆcrr{iN_|é]³àW{O§WÈvïÎ$8©mæ÷7ðÏ:¥NÒ¼^Ï“¢¨‹Þ9;'Â<‚äž¹ _㾎¨Z¶J=(ò«CCÉR®XÆÖàp°Ï—^»ö¼۞,ÒO$1¹Û¡_ÅÔ‹CýšLÊ07‡ðÅ¥TŸæÌ…(5§±Ú÷H´xOºgôµªÎó‚J²-Cg1Ûpö¯ZmßrqÕ“¾\tAߟíM¿µdþœ!®üŠä¯œTŒáŒ¦‘PÅ¿B>ckLaDµjÑ5b†Ÿ¾­Iél¢ÙJõHO¸YРɓ…gÑfTÉï)NP¹Lm×3@Ž2Q=Ž•Ú3Öv7/é^ I/®Ù­kL‘OK9ëÁâöb¿„À·`ôvgx!7¨1óx[y#àn…i‚²pNj÷c ÔQÅÊõˆÀ—d#­%1\µfŸ _&U'ø˜z·sl~A¥T1gãUæIË©7뻟aÓnËofÛ*§‰ k’÷U—ÕÌŒ©œÄ\ÅLíÞF8¿ßUÎç$EÉ )áð†ÂqaegvÿÔ¢*· 9[Ÿu¾ÜLÝ·5ðÀí8Î ãêÄóÒµAò,Xq¯mi_Û¾˜k‚{ÑêP¸X¤{¦{\n…g1ë¦ô¨±kŽxt\'lŸcøH ­ì1D‡‰iCËÒ`$ë©êVz‡‹úSï÷ø —&÷€ß̃Ñý›t\vgœwî#úë2QL”a§`åtB wûóŠ ]Þ²-ñÈ–ÒÕëÛÉ-b1i½Ð˜.”úì¬5Тt*‡Ü;†øRLUvWî²ÝÙ²AúØ_edywµzŒ~DáSIJïu!>ͳZdÈ…Ð.y]3N<À«“£Ï>©+Ón*Æ}š§g 6¥…Ë>§`¼±¶l•=×´&^œuòyÏmɉ³CÚ uì=ˆcªr[º¬ÀmddÅp 嘰‘œøúµGûkAtmÛwܾ÷äË@„ŸÂ )Ö].ðïyðôS:LÄ,ÕÆKþ*Œ¸ÖýÛ¸^™ÛÕ±ãàGh«:Ó˜+‰(²Ó{ß«—”•5]÷Rc.±do,R*tÐ\o8:±”nÔCq²µv-YùZ£Æ÷\‘cs Íoüq ?eB ÙÚIãá –•Êý а!н ýÉF›³àè: ©E]’³Ý|´Çõ]$¬ì*`C”¥‡ÃÀhÜV;Ð1Ý>€e>Z“}-SïL“A ä6Æ ²§p¢ÎòY“ŒðdnõZ\«2§Ó™[ÁÉün)|Ãæ½H:xTí'ð/ÄhÝ7„‘ˆG`k’Îåîz¬ô=t]ì† Ùð‡Ê%÷Τƒ´©É f‚&h&ä’ðS]¹ÒXv‘!¸xåùÑ‘ëU~µ“t·^¬MÖל¤/¸ Cæ§ ¸Æ7Œ¦fØià9µ¶ÇÔQ/§"ѪüI¿¦ä"³`ruZ•9¶|Ç›­¡e³ïÓÐyk¦Zbß*(ErÑïÒ´<S¬qð©x¹ ¥?;¦2d[PdÎðb™øÚ3(îµãéíí¦}Ǧ²ñaÿ•þ Zi§”`æ*áŸïÌŒ9£o³G{¢Cßá2Ó?:Ì$Vž|\#MžiÉ(ëöZ7?¸Ðd-¥ð½»¼‹¡W¤ÝÍí>ÏP·Ã¯”ºa0„ù¹þ‘ÿ”geâÎbòÆÛbü‹Œ‰UÞH²f[~Ç]Û¦ÛO!‘Y,o}ª»­…ÑÎ %3-O»:^~†ÒðÅVä˜"/5GüoBþ+·Ç(še)¾Ê“v¼Njã µ—‚U¾àà÷bÝßB匈ç½Ñ^Pé5€ {“¹nX{¢®?5ò,çm2¡£.ÁKe/Ìïxβâ]èÑÒÌŸ¸z#O"éн&eüÙ‹>ÂZ™r6ž¾qŒ5Ej)¬o/#‡bŠÆxšf‘ …(b9ƒŒiLG úß¼^¯&ä®ìi´0×Ê4IÎëTæG¼ƒÏ隠㨠ý ÁŠóGP à…çÂÅ_×ÕÓKsÓœ>µæ¨ë†”^<²†Àx¥Ëê~¯I÷†5çw“©„0ÍmtМ@¯½»ÑëÉÉ…àtCãb Þ±{?iˆÇk¾åX$XÑA‚|8¦Û8$õÔ èæøMCWQűÏǪž^ª œheŽ’/­¿©}3ÍFá· Ðü’§¤¯.Ø‹0Rl<Ô™'£-uȹ T2Q(,³e¼ãóàu˜ÖŸUxwôñe8uàaXùŽ*Ì8{ìÙÌ6¤z¼Tÿ< 74ð…™T¶Oçöú.1$糘߯gãþš+S Œßgœ0~™UÁŽñ å–«c—p(Óm‡5JL_Ûvé¥è@ay·­¶0êJMn4g¹?„ÊY]¹ÚU…b# ´Œ ÜÁãåE¢ê ¶ùA¨¶”ØzhšºòÀ!f©€-Dí7”o¿¹ˆr–ËŠ÷ɪc´ç–K`¾j<æÐþú‚V¤ú桨ºIþʵ3Û9¡fwWÅvŽÞ:ø§„<[â0Ö„Âkxüü­ö"”©OöPæf0¤.†ìYûºp:.Te^8¶·Òcë“×·¢•5㡥µ5>ŒÀîÿ¯guñ8£ò¨ÆÇ(îRerE¼šU%M}¦¦>ޮǹɩÛ3–Ë¡böbu±ðí¢ƒV'Æ€ùxøîzŠ{ìé/AÓQõÆ›gO“þ` GÊ' ’~x#£ óÇ{×eÚx]I"¾Ar·%‹2>BÃýHJ }_Æ„Q.FCnbçBR¢hQj³7+ÍŠ«§»ÏUZ[lãÏ9ú4ã[aEŠˆýPLàž…×àLóíþÚ¶¨Ý¹øø·#õ¢c]¥< ^ç.i{ª¢ ?çÊ–²}ˆM´åõdÙ ÷·±Ú¹†úkTå­éÆrl×#±¸9žþIþç5Ô¾CuÞQë¤5xXŒ"Øž0!ða-C¶|¸qÝ6Ž¢âI®`‚ÌV¦wýìÔýö^w‹ã ‰Ã7zð°wäš Ü¼<-0J+^.Çïî¸ü˜ËÍszÞÇâаï]"ù†+¶}Iئ^Oª$vK S¸4׉òÅ"=„>êÆÊÍŠ¬4ý5%–1£±ãm€»‚óÅIÚœQ„Ï:ß)*¼—`’u,Ñ)+ÐX+ÛÒá*½N: ÷i/@ãµòžY¥#¹ªÛ3{}QÀˆ@´8ö³Ë‚wÿ…ĺÈì@ f·ÄÆý¨ÇiˆoÛ¹ùÓŽÅ+ ìÓvø,(Rì'.WÃì>æöiÊÖJ¼J¼ëÄê1×õV¡¦zšR-“bÔGSÕ6#6Pèðžz>æè<=†vÏ Óç&º#œéº¬Ô ²èù^jÛÅ@o˜§ ý¼„Њ(ÛÁ/È:üÖ+‘?îƒx&éª94䳞7¡õ%ùþ©æ> 5k1–vÂä8ë*¾UUÊèi¶’F'‡ÄˆË6²K‰Y½‘ }ƒª?¶äPGv‰|Ãë:V¾»K„PÖÕ¥)ÇŽ}F:³†E—’6»TeP!×»›È5oˆ*ÙHðušÿ GÀ.è‚ß7s2i}u(„¹‡IûÉÆj¼ï†ÈB¾q<‹7S.%úKÏó¥¯l6™¸è¦mÃG}õ;ĆÀX“/{ß 'ÝŠ_K­²ù¸=N—•”W‰‰ÑžÃšI˜Hy"°Ò~œeµ‚ÄÇwªˆ—„ N¦à†¥¶eØõES¬ÌÐ`â‰ð ?Œ¸Î2Oò³¯ßùËŒÿ¼«mw5.@ûi{§°LZ`à×,»`¤QM}ŒEÿM ¸“ýmyùÁ£W92ûÙµ¨ŸÛØo0à+JÄhÛ €eÄAÿ™êm=˜™ ìZ›ôt$Ô»4’Zݯ÷BmïJÏ­]7GàÕîDF9@¹ÚQ&OÕV¸ š˜®¿Ø•ÐTg5ºí³^WtfäÜG&KP“œŒÉA–-¢AdÓ‹àìAiw¦DÇcSˆØ2‰¥CÛT—é‘Ua×b%\ÜaÈühO ðîA0–~™À ¾ «¿£1ß÷îƒû é6µÒð’±°LHK"cÜûËÞì›t$–cž9ížÙ«ËÒMñ献¢Z]•ÀÙ±ÂùÝ E÷’:?(=Õ0¯<Û¾ôüáÂ"#Ñ eSûÆùã:¸a7$î·Só8Cáa½Ò^ûY6Á;Ž!ûÝa¦9Š*]Ô4É*hÛG¶%Ç;ýªiç Ña’>ó†´2­¿œ…}ÕÄ>µZ©M´$¼—ä-íîöÁ”X‹ÑøâMÕÙ€Û@¶@õ|L±:夀±|˜ËaF†E'57?n©É–O‹à^ÆŽ}-PÑßø|q‰PúÔŒõ›ìp{ÕŠ°;öTÑE$ƒN &*³Ôt<íƒ\Î~>úüÈ>˜JôBUˆF ƒ Tw±…f/9-VÊ 5!$.¢‡öÝvŸï¶izvÌÍæâ@…Ó¤¿}`áú¨óxÇ.ºåÔÓX¼N–ÆE@X“¯ùs÷Þ,"ÒÖW„–ÝXïp&eŽCýIþ¯ÞüèT|H0ÂRqÞáûa×¥/ßžb ˦Ÿ¿gàɼֲV½‘MÄ÷ÿ,"CxbÈnš]0>oåüö‚…’³Yr]õª'i¹lK*žÚgiÚÂ&ÿ=JY¢ÆŽäÛÑn/‚³phÛ;| †9Žq—u$®ë”#•húÙ¯ÜYË'ïÖÞZÛ)lbŸKž;£ÜXC‹Ô8SÎÈÉï$œÈE衒à·lyªæš”5ÂE­TØO"f»Ö½±´t˜´e¾,™u­c*ç'3Áw”-öæhŒ2ò eôÉwŒjQƒ3YssŽik@ø©‹ˆ_ ’F4KØ¡|©4F4#ü R›zbŒœŽ¯‘4îî÷‡ã’ò&¥ÝäŠ .tXº—j}ý--çP„ü5+52äºÛ¹gʯ«‡EAÅ'†RÉ:œK-©\É©ûTlÊ^šß½«Ý[ ‘®pŸ8Ò,‰‹"Ð3zÀ'ÚHú˜¥¿Q=ä2SXòÎy€ÒDú©+fƒ|ºõ‘ Aúä5ÉFìqç„Z"7êäÍ9Xªyõ3h°N¥·w!jÿвΨ£™$ÚíWE¥ñ>ÿ‰S¯è§@ÃU·Ú'®Ùi$ýtJxŒ‹(‘}=¾8f,I§»Ö5fêuË Ý&ê… f èÏ6ÄHÚÖöÝë3òÑ gKÚ?T«ò¿q 0l·þ¾{x’+²(¿öbˆ–}¼…È&0XÏ+ˆüzJ 7Ç6—w²q§c–§ŸÔþjÆåÄ”¯ým® † =ËžNýSf6pMÍv_N@.$቎8ز)åÞÏê?æö@í2 ë&dèm¤ç•íè¦Ã£¥xõ7Ø>›DS§ý"e-9-õhüÓïfK–zäú¤²04_ubðØ_ 7LtTîûRº4&ŬÚ&Ê•éü¨YAJp–ÜJIqg¡çO ×v÷ËlŸ÷[j]p¥Óx ô &NÏü9åHs˜6c'ц•'H ¿æÁ7Ýø¸ž¡Ô÷zýÀ™´L¬SärY\o«bçxîD7¿3~âeö¸ rsjnªµçnêZe *›ÏHŸQ=ˆ&†jäY­ËA…,ý´Á³‘4z_9Ê…´~ÆÊðï‹Ó¿r¦½¨¹¸þ&èd†ýÂ1ÍŽ}I1êá »†”)gìÔ~ÏY‚²Éµ6~ ƒ»ïëè­²ó¦PÚչѴ¡Ù¾DôŒõÓΑWM•~hIŸªTíâÅNYQN÷77ÎX„À]ܰ¨ÜG!·Ê"òñ¤«IµÒ_­ó[‰ÛƒTÁFà¥éõcÅ~OL̺•îÓI’[‰´]sV\ŒÛÕÅ!‰œ&Ê$L(zìUßG,òˆìn÷¡~ž(ŸKEŽ*[²b6‡r43˜3ão5àî úßy¢“H§ÏɵӾJ]Žœ~0 aR×3!£«¦O»êE+Ÿb#Ì+gzYRû][²(TzLËfý†|¼I çZM°,P˜ˆµ¹âñ†iÔK£r)Á‘OkyÚ‰ž”ý<‹r–-ŽÄ€²…Á¢¡³aj¤5øcì3£ sÍËðD& ¥{êú½;pZ!ô››R>{* PX)sâóæ'å™­+æÔsH"ꢯû‡ãu ¤=2블¥o’ª³¥D”|Ø£‡8ž±ðb Êo:FǯŸ.±uz;0~FSŧƒs‚»¾¿ J nH窖6ÿP&NÌz"™ç6Œ`¨Jý6N ú43¯ñðMB+ž1}—,á\sG 9n0Ç þÔZ8»z_ë«ÅíŽé—’/˜ª_â"f4[ùêR^zvhÌØS-P´˜iÜ’Ð>v«èWâ^ItOK‘îÝ[>B¹Î{°BЫš 5ð8L“fX4ß<ò–SI%«¼‹’%LÓgŸhHŽ±ÜŸÂÞà“ìP?÷€‰¹XPMÖ s2ø)|תË7 tKÅY܉¡ˆ b›Œa(t|î1šÉÓM¤¸À=C\ÄÐI)ÝÉ­h k²rêïÑ©‘¨‘'–>8¢øéÒ4¶[Mžë g7‘ÁÒ’ÉûG–_§“õ›c!–tzVŸ4~m›îš?k厈¸^Y9v¾§ÞQ]´= |[ˆ/Í¡ rqÁØkLNåð«è =l"|&A_Jò¯êw„2ñ_KeA˜v9Ä;ÒþŽJWS‰mŒô›`få/§ ,þŠ9ì©#JwV‚Ö×}§7‹Íé|£~nI6’ÓsDåãTpÓ;wŠÌåö=À‹~G’ ž¾]ãM/áVÛÌh΄P¸Pº+^Ó}áç*Ýg–ÓEoÅ€k¬Ò5 °Â”•˜tlµs³Ró3¨î>H‹]•|õBë—ñ±çÒ-pd 'Ç«S¿ÔÝ#¢‹Á樴¬u¯'\„{±åôÎw'8$æ]˧L—¥qJƆWpš–!÷Ía°¥›†Z¥¬‡‚d¬‚~¿•ÝΓpbº«wŽ»lž2†ò¸ <Ág°>³ÕhgÜnYK9éd½fOóÓ têð»!]Õv繸Ϲ\^üñž3ÆdyÖ±LØg@[¾ßj«AÑ Õ²à.ÈÏ!¥3,I÷a“ËOÜCñ_ûѺ^Û¤JŸ;¶¶M‡àÒ¶ÄWæpqWý왈zŸ<ÀŒô2ÏÐXÅõŸa—û@ú–ß.ý— ½5«P9úu÷M¨RCηk ]º“Ë»lŒN¥Ú·ïO„'„$.ìÁ|û%nt¶ÚüDL¿óz/éþ“7Ühr^ñÉïGøƒÈ,4¢¾•íÝÕrS_:Â,ºª¸ Ù+ªã)è(Ḏ’ æö€½â§\ÖÏ¢êN¸s[µª¡w°Œ›FXgz!ë뼟>`&fœs9Ê(¢¡ÝæÊVÖ$J¸L £,7™`˜‡Áõ'ëI²ÿñƒ‰vóÍm Þ—«¹ëVˆxŽàºÖvRZÀÆ›­Õí¨0N¹_¾ƒÞo¨më‡ÌŽrf<Ì„±§œp?ÞI¥‚÷½0¹¢6ª@@ÿ Ù¯Ô EÞ9“®W2Ž}ña!% ýu^š² sâ9+Qõ™j8¤…µ9v{­ßiÌÊ;–›–nLgé|7îôëŒ[ý ­¸êCôeÉ rÓäÂ&þwuÝ€\WØ ÌÔ¡YlëÅz]£Q€„2Ry,¿Z|¢‘$ùñéâ’ =處®·€ VÔEœÎ¥ì!òÕ…9Ô©kE#±¬yOäˆÞ©5ØQB©º”;¹Å–úDQ&òÐ$AΕš6$ÇÈúþ2„m'\Ë^úà¯Hýaµ=ŽTÚìzů¢¿r-Q”sŒ%–¼¹lº¢``ˆìåP1½·Q•„Îç4¬B5h(YÐâ/›m™|á£ju#›"¬ûЉ õïñÙÕUmÐ9Ì]6µuèeI= ¢ÃqI©DbÒü?ýËîÜ庰v=2.NbE^JÍÕ­7ûƒÓÄài%œ\žá>W¤†¹x&2ß 3IП Ñ Ša‚º\x²2ºk6 ØpŽ9¤îä³>I-Ú  ùöbηîdË*$ªPŠº`ðïYX0 .ÓiØ(".c¤8¬ŒþböP,)W!½ éðÍ‘œ—‡Âxf¡˜[hBMU›Pùˆ¥pE™õËùÚnb!x£O…ì“¢þȃâr_dE¤aÉ:H#GœÔ4ëìy·sãÂö#–-«- ž•ïÙ¡ÒfÒZ攳.\{Já8..ú§¯-…[)øÐPÔCa®Ty¯Ç]ÑNÞù0“à£= O©„Å`Rú‘8žßùÉp'à›ôÙQѶJm}"¦óï ˜v¿œŽz †'"ñ1Í=…™¡¹"°7÷4Jè¼(ð™Ñ¶qñß`"¾°òS,àã˜8ÅV†€ZæVûCeöžp™duyé¿#'Jöò·ØÂýIƒú2Î;c‰7mã\û@÷AdŸ]çÙ¶…¼[<è/d.Í…Bu¬a¼ž;qMêñe!¥rMÖÑ…%;WË| ì$ãðÚ×ßâǰÇy)º'Ÿœs•ÚBF«Û9…E<±¨ŠXîJ-Å–Œž­wq/PßÌ© «kåC(bÒѨ\}6¸…u‡èŸ‘ö÷@Þœnã%ªgÚLžòÏ–®c½ý&$AÑ·[jÇ+ˆ}A¶>íð„»ˆÒ¿ØtÚf%€Ò`„îlê)¨‹K©ÒÌбføØ]`9uÜ÷?}§ÓeáÂQ Ôžç žX'DÁ†=It#@1Ô~4„* áœKòÊlDGlñ˜Ðnï5­‘Ñ/é8hw*º‹„ŒœcÑFÀ¬r¾q#„ÙÄ´ZN=–ÈIÈêújÁ›Íºpì“ÚCʰêuÁ.Ì™MU¢U8”Üq솹4!èÆ wÒH×ÛVÅý tcê® šÕHõ¬+ÈÝ’õ›ùƧ4…Óéã ¸êþFêÀ%¼ØµýR`2ØR`2•̃{::6ŽŠô…ŒÒï.B,ïc¦ g$»ÔH!œŽ·OÒT®¯,ƒ8ì‘®wg‡_Ë)6ü͘™¦ï`[w\u£˜åœIÖÿâoZˆ­«:X0Ö˜—ÑίÖÜV âíƒ:ñ¬Ó‘ófŒUˆ£Ï„qz›fÃÆØnÆ›U:Nk¾\´)\€ƒÈ6¤+P.Ÿ¯ÖtÑŠéëoª½Óü岜ut€Rdôêð€%Ž¢Æ$diJRcà·›à{7$ý“­`vM¹ƒ]I¤þX¹ âAÑÕ”¢ ‹GÜ&1E|t§wÒGË:Þ2ÔB³¢¼ Žè©_•|²oƒÒžù×N¼Â7¼Ï¢DB?˜s]} ªs"t¡7Ý ÙV P‡fƒ>×6ˆ¯;-3õºq=]Ïs&+éRoõåP ®,æ/±¨ÅÙòÌÑ æ¶6.€ìÿUî•9š“õ“'k­ÓSX28.b7IéxÙ¢ˆî@¥©0é5F[æQÀزDϯîb¥š x,t™ïieô±Ër Xa™«Ü„±µ[¸:ñ4\Ç·;=v9I†š1#Z3vv/7-ùŠ'–¥ ~ïOu:Í’Ì'â ÷¦¼º¹×šY·vù¾¨{ÕFÎÏFÈã ¨'Jƒ!Ü;}zY_´=k–ÕˆÒ sÅ]¥#íkâ PÇZ›È-ÑÜZ[ë®ýëÕä¾û6 CI]©Æöl™âÏKûÒ£uæîjhQZŶ~ßÙpªˆj‘l»Í`77®Pïo{mêÁºç§sÝX‡óüB4†’UAQƒf:…ÿ&°âÃf7Wç® ¬¾1ÿYoÊí–‘ô*X˜„мnÔjiß.#.&ÿòøíÐ[·½Vª“Mð¡o©Ü§c3L%¨“&ÊTc/2Î%Ï›¦]ˆ+u²·ýõ8ê°x»ŽMA”'¸iF@]clmE¥m^²˜úÕV?‚ûäRô²C5ZîwY3Êw;-yWÐ ãß"3ñŸî ½.<¨WWbåÚÓÁÙ05h›$Ó‹wp=vhÁ³Óh|‹Þ+B} Öá$.åö+wÁ%‚I–^ƒ¥›uø”…”—sœ.0¬Š¼VC`g’Þ©úÂÅSÄìD|Ü,hsAÈíΊ.Ò°GÓ·ˆµF;™±ÜpïöÓ,wÍ´;[R–»6›‚îX’©aЗÎýŒ5ÎôeFQøý*4ÊS‹áîØKôÉÞ©Q]Ý /áPJ^ú¾+Æ;Ü>jq>Ä=òh%H|i†éUo™P™Þ·™ü9m7ðTòà{…ßJ¡cînßïÑí—Y¢‚TïºÒé‹¿ ^¼Â¦Mæs´~dÌï‡yØ¡›.0‡Ý øGkâwÚ7n8?8Ú5ï‰ã¼|£`{x¸9HCþb  5 Îþ‰9©BA4$4b'ÔÅ1"Pþ‘':0ÂAf'É6VË%$ è57,fχ˚³â¿Å´µpàŽ ñȧH–Ñox_X/ëÝ•'O&Šåt¢YÇú´Rè˼+FN5~ %HÙÀó•m©¢šË¿.zSWlx+Sä1ê¢k˜OΞSt2”ʸqÌæ–¬Ø-e{áÎlÝCê¸JŸØ{eTÔ4æzä'Â#5à0ÔÌî[t–+Pé9,º‹æMáøeõ»pgß Zåˆ\ªùÉË0+|ÅÚŽÅÝñŒ+únû×ä±Uwm­üL#> „¢ªDžÏíÔíTƒµtªâÕ QÅ„‰~I¤ã²#sV¯¸rÚ!—IþzmߢS9è \æ°Ͼµ! öÖO©zq°à4 ôú—U¼& ²; &ÛÛ[ëûl™—íÜçù•òR#siœ*qs ¾˜ŒN)©’’Šè!•Ut_V]™0PC,‘-† u@;¥ lü²pÌ97gÚdE–FJ-3æ3‚W§ù,ÔL~¨b°½×Eóka<*R»%-»‘ˆ¨<ñì®$îÊN~\`e;žÌ«aÍ ŸÆºˆ}›¸(=?‚YÎa·yÝO9Û€~Sî:Ó¤ Õd³†Ts}ÂØLE2“ðiòL‘Ôwbq” ¾P5I"SÕ…IÍ·×_LÁ‹,ÔÝÕÝS=3ÇìÐÛá»$qÙæ›i”ó&Þp§ÙÅЪð Ú,¸û¡°Z³/ð±Ë´Ék¹/k@¼L‚›€ÎÂ9b‡ÉPËk ÁBd) õ#_dÿeÂ63zu† ’VÐÖ& —9Cx•h¬¨‰†œqË'Uú»@;[¤{§bÆ1vKE‚•8P¢jºíÀ ÔsÚΑšQ¾xƒÿŸ <¥°{VŠUŸñ¢îJ>É!w(¾:prÿ~\üÊìöîzТéx“óCz«<ÊGî½YGw}Íã}!]“PpD³?ï–i-¥&ûþµ¸ä.5op…¬æ)n¡9E1 _µÛIÚ÷wÔ±­ÕpÞq @¼zmU ’i’…Ù·Éú3v G _üñg>5ŠéÀ®ðŽ-ÎPá\ذäf½Ô õð»ŽD˜RË0Á²Ù¼†ð]´æý«Op[Wc_zò@—¡s¬2\ÄlƒùWë»]V» _ÙÆÞ{¿")ªßt?ç G§d‘5¨à LïóSÁ¶-ö h¬ CdoM ö<‹ŒêuÕ—FËž›Á~Ò5H•g•,*™AËw†Ö2ôç¿âºŽdü,Ã&%1Î1%–L›¾èñaªÕx®¡U™wkv;»ÆÙà†äÿÉRTÙ4ã{âýY#?cxè’5HgÃ2’d™ÎL -ñðn£y}Ìó*г¡eRÙª.C>¹]”¯`Iô°×äPz[>SX°ýî‡|Tâ{Ê7߇D–ëp5= Lا"â·nrTÖ{'ËVÛŸt ¯s c>…8qAñÐÆ=[ê=à£Ã»@¡Þê¡‹ ¡è©4k«Ï§C{üeoé¯Ñž1Tbr©+ó)À@\bÒ/T¾eÑ×l7^G nݬÝãTö,£HßPb%½Ž*ÑQ€óá«ýfì>plËpµ–Ù2wÁtGßu ²â~a&é3œÊ®æÏ¿c°z“•íJÁZ­?7ùøTІLÀ(–M+{+®vÙ‡­Žé0g˲|Ö;WžS"!ëN‡!¢uÝ‹ÙX6dtK…/@Š»½d“¡[1´Ž¤kgyB ¶ÃΞîÚ9ÅôÈÿ$îc6XUòógü{¯½ÎïJ™ú¤£órµùÄÃfS=7½÷·LWæeQž­ånâ+•n5/±kÉ‘J„KíÌu9ó  ›‹¡Áö“½çQqL>–VÛÕ1¨‚»©²o‘ÀÅ^ .½ÎF÷Î#jv¡½²w3úÎAI>ÿ²vÕæÐ.YrêåCK¾ÅH–|•ó§‘ ÄdDæLó ¢ëq|ªý¤6’`½›‡Z÷De"¢$V|¨>Š—ÐìõâWø­‡˜1D7°ì셬ŋ)­›Y®; ¸FÕ1o 7duô®{û<_½;³|þÈÈO܆ç30ÓÉæ¤Ý—a Þ5×ÓF Ž3b¯ `,ŽEÚtÝø¾ÎºÂŸe´ Ùi~û&¨Zò;^òë&ÂùCwºïc‡H°‘ÜiáÃiÓürÖ&¿¡ë? A¸(ª©"³Àâm$!ªÔ; &ql€#®HY“\2ÎÞ´6Tc2t;S¥ªX¸Ry~ÂƆ*ºGkb"k¿,µÄ¼Õ$ð|Ãø&&Wë»UËb‰nýHZbì_¿»P -+%ÔõyUtXu5Ó|-ÕlÔµÐcmS–6¤–‹7<õ"ýA}ªuÚ¢!ò~RÐÂYޏ©Ò<@ó §˜Þßu­knõñK— o˜­M³¨Zrö†Ã¯¼ ¤Ü&rþ^ xõb®;’/æ p‰>޲ðŽ™qù×V¦*¸ê×jÙ?ϦðŽœjÊ´lK…÷íNÙQ¯ùŽ3w‹Á}²ŠÌ¡À:Ìå™ZÖµ`ó*ž¯ÍÕ4ÒòâRêôß@ÊkDy ( „škƒ@Ï{¾0±êƒj•~·;]‚7fw%AÎ;ãZÂýÂ=ùcB;Ò¢Œ‘4ݰé*Œ;l­7kÈÓê©åvå9hWnKy§vƒîò%ã¯y/×ÏR²9ôä÷éõ„}2rÿ.±g‡ÏsnÛýb8Hxj&‰=>Aoó့´æýRýo¾•õÀ²xIbû;ÿáŠÂ6*Ç?ÂM!^‹6Ïì?G`×ôÇfm²þ‚wKÎó‘¿ó½Ì‰Æ£F¯‰^úã'aZ‹¸re†žÚÆ\&÷à†˜ØðYÈ—(‚³Òuñç,²­Œ» ÍÑ”Ê{$.ÖgÂßagZA.¢ˆ±W AV•·ç ÀZÃÇæ¡^¢ürŒ¦‰¾5'w‘<×xøŒp÷¾ÎpW*“m×V42_ód ‹æÎçñêôü˶óÇW¶W%ÎKd{U¥ëjÈ9~XøŸzpúN–(^<þïðý­nfh[b¾»¿—ïúÞš{ÿšƒˆgNŸWQÕXÜ$«¤y-¹U} éÆá:¥c/>¾{'Tx¥Ìnæ9°ž¼#­Þ®Ðœ÷ž§=÷K–2?×ÃÛVŒVâ÷¾ ü¬ ‘&š¨æï_êïò‹Qïnèq4[ä@$Å’ö²&o3&pÏ_úps—-³®È:๊¤qà%ÀPàÏQ)”-?&ïK´Ä£wë¥ìÁ"u½+<,Œë¦çªz“¢äR‹uÈÙÁºflõ‹;âÿz¦(V€¨¶¡Y«ý/§ÍØ©:´²2#ɹ×.ßÙ˜zýà×èŠZd±p—Óù]:˜nøbÞî1 3ãaƽbÄýXàý+Fàw«ÒŽ:ÒZ€Ù«—M[scB4[$x¤ ×bÄny™º¬à•æ3ÿ‰0Z‚m ø*À-aÆ´ã`¸Œ®Õ„Úï[}A$cAîÙ¦ †Ê4pk\æ ÊFyÊWŒèÓ»ê£ýýo£–’CéYNAË@Ô áRˆ­åwœ)ŠârØžCGñbŒüs@̈ÊÓ܈kÄW«¥t)•fo ÍcQ¾ Fbo4ªÞªìØ. Ë{Fq4ÛòôŽŠ ±pO± ê“Ý:äY>à‚Ï.Krb-ÆL"'õ&„¿n-Õ³rìÙde¬~´t#Á¥Ër{}Îhâ„@jR—N´ £[“ôqs® ¤D¸<ªÞ— ,¾Ï´cÁºÿæÿ¹¤úØÌ«}æv窴á«`^O{Zò=‚¥_sû–H¶hÔZ$ÖòM\¨YÙÒ™µ¹bõ쨒E¹ć¼cT(ú$]qu‡N!Öß¿(¬1Ó€1‡,̉Þ.Ô©¼R•~•a<îLý؃´ŸÝB|g\k§½_<zìÙ«RQyn¼ß-y7½ãì=Kl¿ [ÜãDã8Ák<¦‡‘Ø=[£¦uÈÿ=œÑ _†O ƒ± M5@C²FÿvHæžö°—£Ðï˘øAhøƒ/””ær G¹U„)ºàŽhm~yØBòŒsò)k$Ê€ dEEtƒi.Ϥª8Eçl*©b}Øõ Ï]¹Ž,*/ ¾ÙÞÊã ®U—^º§Ìtø&÷ã0oËò.aš'ûnžvO].Çø'KÀÔ•·Y´ôFÚ]oBU;O÷W˜¾7ü-×’Ø6æßèGÇEê{£üAsš ¶•9€?WÊïUά:w ûÁÔ•aˆM)JÁ¶!ÓêóXyQïÅX3;tõ†®ßÞa_΃ £_n,'LpÂÅebÙ£P¾¬xÊ‹qåtîÇÌÉ4…ÄQƒFòûÁá¶“óÿ]'«K; ´/x.u·¥d:Ö¸¬iðæê• ¿kº¯eÏ9Œ~õ+÷!ìg‰6Ašgî=#«T¨ƒŽjAµ:ÑP6Ý«ÁÔ¶$ÓˆÐÐFE æêh޽÷ž^¾zA7I èÙ]ŽÙ0j¿H€à,%)©­óH2ò`)ÔL 2\º®Žü n{Œ÷êdó“Äw!ĵw°+jÜ6ÒFï÷œÈÑ£¢ò#çñÞC·FöÏKU+i‰‡|(çà>¸È(ʵ/+H¤…¥1’8b†&a‡/?}­ ( ÓâGCâ'$¥ `½z:8äûòx*Â_ÌcG“žaýðªhÔ`6Áº1“UPŠe#¬‹‹·šWË!‰¼ˆ ÒÖ@¦ï —xÁÀÑm¹¨÷kÝ!‰ƒòôž7òOo!ÐW2Ú(Ðd.M>.uE^q.þè³PI³`sëd> stream xÚveTȶ.îîNãîîÁÝ!xÐÆÝÝÝÝ‚÷à àîÁÝÝy=3çNrî{?Þ굺ûÛþUí]UTd*êL¢f&@){W&6fV~€¸¢º‚†+€••ƒ™••ŠJÃÊÕø[ƒ@õèìbå`Ïÿ‡¸3ÐØ$“0v™*:ØäÜll6n~6~VV;++ßÿ:8ó$ŒÝ­ÌŠÌ9{  •¸ƒ£—³•…¥+(ÓÿüКÒØøøxÿvˆÚ­LíŠÆ®–@;PFSc[€ºƒ©ÐÕë¿BÐ Zºº:ò³°xxx0Û¹0;8[Ó1<¬\-j@ ³;Ð ðm€’±ð_rÌT K+—Têæ®ÆÎ@H`ke ´w9¹Ù› üuY€²#Ðþc… ÿY3Û¿áþãýW +û¿MMìí½¬ì-æV¶@€²”³«§+#ÀØÞì/Cc[¿±»±•­± ÈàïâR¢ªcÇÿ0t1u¶rtuav±²ý‹%Ë_a@ -io&î`g´wuAø«> +g )hå½XþÝb{{ŸßØÜÊÞÌü/*fnŽ,šöVNn@Y‰ÿXD¿e@W+++/hcN §©%Ë_I4¼+Ùþƒxøù8:8ÌAT€~Væ@Ђ‹±;àêìôóùSñß `feê 0ZXÙ#üŽÍÿÁ .p¶ò豂š Àú×çß >3s°·õúmþ÷F³(j‹Ëhª1üKú_µ˜˜ƒ'À‡‰ÀÄÎÁàfãpóqüþ;бÕ ùÃUÖÞÜÀ÷O½ …úŸšÝÿÓ´ÿ™:ÀÇRr50@û»ßõY¹XMA_lÿß]ÿ·Ëÿ«ÙÿŠòÿÑïÿ»&)7[Û¿-hÿÇäÿ²0¶³²õú ¨…Ý\Aã è ûÿmªügŠfVnvÿ[+ëj  Q{ Pk3ñ1srÿ#¶r‘²òš©X¹šZþÝ&ÿˆ5ÿ;[+{ Šƒ‹Õ_G €‰•õé@³fj:N\@Ýù· ¥ÿÎ*ioê`ö×̱sqŒ½XAMÅÎÅða §Ðóï~°0Û;¸‚\ †~sg„¿¶–› À"ú—èÄ `‘øø,’ÿ"V‹ÔoÄ`‘þ8,²¿¨-#PL¥/(ŠÊoÄ`Qû@QÔ#N‹ÆoªSó7ÅÔþñòÿ‹8A1]@›håbóÛä`òŠ7q66µ‚ns×ßrŽåÿôï¿ ÐJ˜þΪ tØÙýÎù×α˜ýA €@PIæÿB®¿ƒ›ózP^‹? (¾åDÝêÈ `±þ‚ÈÛüADmÿ€ Âí~CÐùÀbÿ•éð›Ètwý¡êø[ òu]öÿµdœlÿ‘þ÷‚±®J§? ˆÒ„Ù@”\þ€ J¿}A§‹«¥3ðw% ægqõpøÃDÚí÷ý}‹¹˜:8ÿY?h-Üÿ€ ~¿!è`dñü‚²zýAܽ³Eò:ÿSÁÍŸ©›3ˆ¼ëßG%h8ÿÿ}ž@S„¥SPë†Ð·:QB¦½ ŽïÜš÷on¤œq¶à;Ìß”ðl*9 îxÓr%TF-…?ëA*B‚‡'JÆñxØð‰u1Ãb`†a@ÈDœ27 *ñ#]ÂÑN]±~'HŠÅËÈ?÷¹ «º×¡ÇPwÀ ~Ð=8tR†!$©*ªW>\ ãÃy >W–±õW凙î–`µŽÈ@”ûÚ2ýH#§‹Ørú³¦ Ãh~¡O ™+`.\ÁµáÒ„P§‚‡¿{ü+û“e—ü»nðÆ’èO47Œ%Ã?— “ý)(…œyTq¾Dܾ¥–JH-œ³wÜÉÆ)8zOÎчò/ eZÛ{”XÊœÇ{çñTœ rÏÊÐ^äcÌ|µš3¢ØƒÊWŠÄ /¥Œ_ÔŠž´8’ mo=Å¿³MÚ“âNú`Ø„¯ó<Ÿ:躉‚0¨!÷¾êý Ȉí ©,Ñ;k$o¬WDtæË0E›=z(¿µ€å/)¥¡ÇÛÉÖn왺C³T4ÏoÚ7ãn {Ù[½ÿÙ+¼qRqš!©BÛûtº)€Ä}’à X´ÿõ ¥P2š¨ÁÔ"øþ\!ÉÓÕ¬°æ+ ¶Õadóöw ¶“³ ¤þYp¿vÝ^°·JÑ1Z¯N(áψ¦Õ "û3Pf+4Ô¦‹zXúfk/QGhÚ!¼F“¬Ú„ˬóè÷qYKN'Ì8¾4Ig+à%Rµ“8ÕpÈ(ÍÌxаû3˜È^ǾduÕžúM¤]!Lô%dÍ4D+‘¾M{h|h½((Ã*üS}Qã˜ÑXn,Ì[19qb„QS­™Jq¯$û©|e¢@® %Œ‹}Ù‚†åY1?¾ý„íÑh,e»ÆÁÖîÕ)è÷·9*(Ÿe Ž„ÒÐL{4ïX f熘ñ©ðÔ™Íæl](3»»³9QX_/xÈHªFé"ïJÙ0ö6½-0Ý8¸.:É-8 ’5“ ¿šÞ7Üìe|†)óäƒÿÜzú Æ"ݟƯ«K£ñ¤j ®ÈŽòÉ&'£Jùc£UAb¥Ë(m ŒM›( "3ŠÁCo£šÎ‡Yjë ÏÏ? ÒÍ)‰ÿÄvßéü.ª'æRÖüã{+}çƒ|RáÚ‚kv¦ÆI`÷÷`+€{ÚÁ4·7³hÈ|’L¹Y=x\”^—{1~8PÜðÔTø¾ê¾ ¨äc“ÕCø¡œ_ÕwFa#‡W)³>í3LïçZ ÛJ)´¸XwhäLl£ê`w*³UBb–zÐÅ~‹õYYÅÛRW{'QŽHËke/\id¬ E¦³K¸¾y—ݘe Š³Þø¬ÙÚûgÔ±HÌ›†Æ& Ö¸P>Fú³0RB9cÇ‹@¡ŒåB8<*mFó£”À“{ÕÐëé{ðR‡Öà¯ÌW6[jy°Þ ½ìYÇlþgbã:·» ÑMJª¨©,dèÕÏñ7‡f²l¨ñ‡±º†K*¢ªíˆ¢YÂï9Ì»Ž²jS(¤xâÊ6Œe)E4Ž„"P{[ ®uSQøL¥Ø´nÉ?–áÃÀÞ³Q룊 áÆIh»×»O¯—µûñù^7š¶2•W¿d•yâgåP2-sÒÁNëüLxTÁx¯?ÉL⮡׳Q·)«RxµA[§bA*²üR¾½f)'ÅyÚÐôÊÉé$Cõ=WI¬•ÿã_ž$Ó$¯¿š÷¼9a^~ò)Š:}À†ÙõOÙb0¸çäÊõäÕ£9«ýVµ~𠪞ÕéæÛ¹¯­c7Qd2ž—RðJºo¶7zZ—»Ê먩µ)=ËhÃãjœÔ³ž^0~СӇ–DZ6 *“Ò—qC‰ôúcqr÷wªwÙ^C†¥÷«™4#²d¬Füû°WÔͰjèª^âÕ2{iä,¸•zG¦`hfI¦±æÁñ$ùÞÌUy…²ïd¡>L7t~)wm&ଗîbw!í|ÞQxG­æK9>ád>+«9?4-í¥ä›ÎWKrNZ“ìê5ƒRÁ éÄÉ/jíD±œå$ñ7Þfu·6 Ão~|†è÷Åqe¦"зÏR —¢9ÐâLäú¢bJƒw –OòD£5¾}ļRëïÃV³¤Sv‰3F‚ðõj¥'xð"˜’•xñ5èóó™’xí¬]ñìãØ·ìzVïë ‹âi»ôèé^=1«úgb憶/ü؆%"‡qeºI$sxbÛnò¨š.æÄl÷™3zçZ9»¡Æ©1/ߺÜ;Ø{暉V(LFŸµŒ/l”#Û&Z‘†•pý $3|S‹Ç|3³%ŸÛ5TF?°/ÐgMîÏ¢Šw:Ra×™O¿â PÒ4º{¾¨=r ×2bAój¢µîÚ¿«g ˆœv³—D" ¿nðšvÜôì•å"g*51Xöê:¢/v4X5‰_”‡\F÷VT6Ñ·ÃäD1ЬYU`au5oWŸa¤œ©ýh‘ý™) òÜ)?^CGx2 ÿçÆ±G˜˜O6>æÅëÁ§§-³;Ú³º¾,¸šÏ…Sxò üšQ×½æ%AÂÇma7yH ïK(V£”¯KÙ›á,ÀÉ[Щ}b<ƒ$oF'{k¢z°åÊ ïø‚ª£X‹ç—›ûœ¯T öµ›½§½s À•§ð2IûéóÆ»srão„ÉS7d$„>³=4áÓd\” "ÛêQ®‚Q»ú@Ä·z˜ŒÙÚ9O7TpMæÒ!ýÉWuã™!%ÜE¨>jéXr«µM½ cH”ýDX £ž:9þar%ÚW˜IafŽ&ˆÂu˜-Ô‹w¾íèF#-F­b³Yf×,z·“¥ˆ~/ú §/Ý 7TÇÖ³3¢‘$¹ê[µœ»VFk”×âÀfäHcVõ¶Àü*‹k{£?rÝÚ©Óà!þÊ®º+£Y÷bâªûŽxâGò!w9 ‹‘Û ËM¿<­¹¼#âbõIŽÇï-ú´°­fÉ~³Õúb»Ø¡s— >hFö¼»“Tfž×A쾌$Ò§½tÛ82Ëžšˆ=œÌ;º\”zFV|/¤"¶Ì؈Ð3>¸˜¹2ó_ÓÔP/FéâNý§˜rïììB:vQ’e 9Ç«º -ñG=%qÞbô,?ê;јTMo—J½]#LÜžäLD—ƒ•&C^v®Ø­RÉ2©Pc¿ 8É­êmËe€ç$Í[*ˆž_ÓCg gÁ³þY¥bÊP´ý4³¨ªmªèŠ˜ñ R$É‚‡ƒA‹# "“Õboä ìùá:ÊlVHÒ°*KŒ3*uv‚;H·ÀæL¨c –¶Äp£8µWñ©_Q¢_ëÁÅä3׺4iðÙ#n:M¦ ÈŸSÝ,é­º_ѕ苔Oål50ï„ {^1# ¨™ƒL‡_MîË\‰Û£‘úBŒÃä×ù+q¤ŽOW‰’Áwù¬ƒÞ©Ä êǘdÓAq7o”†O§æ¤½ï%0Ìó‚w&‘çHÓEû¼{s“†i›ˆ%o“4[#²¥‡35š©3‰ƒ¨G<"[­ÍÊ(ô›“”øR%C‘rBƒ•¶Ã*Pîç:Ȳ±ê~ç"ãN¯€äX@ë¨ãÁbºäc¼N¿oÖÉsµÉÑÈ@†×zc+ý†¶+áNáy€U´ 5lR7´&™õÓ èëú'ŠßŸ"2}R˜úuÓfÄjîÛX{ú3òù+Ž*i—1ñ«Òdί£CŸÍٯτ™°3tDEª&’Œ²HPÌᾎ9Œœ;"ÕOá£Ãœ'o„ñ‹>kšÄwŸå¿4‡, Òü=_RÆÏÐ/„SôP~xÉC§Ú!«eå|œ¢ò öˆçiV‰ÁhÏ"ÌÆWèðžiBAâuMZq}6Ìêõì’ÝCLåM , LBTǽ ñÈ‚âétÛ­? úD-»³º+»ñÉç”j–aÅôá(’7ùUJÊ•+.*éeØ"Ñ!§Z_Ìj¼’͇Vj¤¼ïm›‹Õ½P&åKhð%ò±Q:®ìö‘øÂŽ@XÈÿ©>°xñµ÷Ã×ëËmíVèZ˜qUÁ>ô¾kÓï\Ùk1N?ÀyÏ´b³LDæí+‚ sŠ02œã¿õN†ñ ”ŽuÒÙ^Q1@̈äÓ{· ©Eó…Ïé,Qhfã#õ[Œ÷½áìâAâý=x™Ø ~¤ïWdæëÂ~¶¬í"Oâ¬à¿8_aŒ¯Ý´%ßP·:t<¸Y-OÖ¶bñp|Ü誚çŽÖ9oßKæàA÷u…“T%mZꕌcÃgç^k[OPX¸‚Ð1}Œe¾­bÒg7ÛºšÝ.óÈܤãD€qKZazÆ×S3|máÁö\È»i8ÐëHºù•· „a›_XÆ“ ð˜eJÞPŠgÖ:1 ,ê¼L~¢<}L6E&CqŸÔxý„;×dû:!^q(ÖÃJß  p¯=ØËö¼ï+Z¤Mà˜^kTÓ2²×ÚÃ_v{Av»#?Ù!]^B¤Ý¬”,7Gú±!Pk¹‘¦<*‰vÛÜóW‹Oo{Þ®zzuæÀóÃî¦s"nÁÅ—6yã+dÐ*µwÑB°}´O>úôÚW|N7* ýØÇN¢?ˆõs½Æ±íjßèÈ Nzß³ˆA3;„ ¹Œ½éå%y)…áðy°Àšðß Ìæ•0°%õ¡½¸•±\º“O7—F|ô.ç&’Å™tëÝóxQ®Rï!ÜåãìDnDmݲ*7’«Hê›ãœhU»Á†Ž»ByüPÛ®3?à#è™dã•tÊ’³l ª ö(Ö ¯¿·¿ÕÒãÍÿÉd’XœÞ˜U–ÊÒ¤€Zœ€Š<Ã0ãkkLünôÎUw+9ºõ«Nì~Ãþ+Oúc!ØÐÇVŽ®³°iR±è¨F\ •Ý^WÀЩïþ*Ž.\ySdÄß]M©bGBû›ÕÊêâ —N,|ëôÓ½ÊÜ?¯mÑÁjDl`[-ŸPø0>D¨C}%ã[Z„ƒ†©Î=öðÇn]¿Ȇ.?Ôw7sûkDײè/6q[n2Ó ð5JÄF¢»îNºR`³±ÍVSŸÐ¿%ÌÂeÛÐ~"È: ³õY2^î\Î)‰¼ ±=gkÒ‹~—£TR* ìºEô}!8P[uü±Üc\Ù8owÇÃJ „Oƒ°]Òi,.)o—-Õ-Õ§ ÷ ÿ…ºàÎ{"Pïiƒ–åw”¼i9EW_Ü!ÁTg" C_‰¯ÛTzÀÝš33È»Ê\¾ÍùâÿÊ›9?KÜÛ÷a]®µÙ!b5ŒÿÍ ×f‰ÉL 'Ÿ©kÂÇRTV¨v´P@Qæ’JIØöJŽØ}V¦9¿®DDtƒlJePk^Ö7Ï㥥…—Ý ’&úªµ„/7I+¼ÀIGÕLI˜«—-{ïÍ$ qÉ.ÒÕ?•8Œ•xa=&(ߥtœúÍ—ãy›ñs{7WË™R{ÔÌ"Y[åIÊÆ1}ÝôÌ¥äÞÂ8öQƒh× ¡5P"áª-=e}Õ%n®VƸëZIg6t j‡2ØäÀQ þŒGŠsóVO¸uç6)PóFø‹“\>pƒ¯ ‚®:»úÛÑò¡w¤8 nÇ̉Üu*×ÞGd±¢_©5 ld1zÜ J$4“œI2…ÁZŒLöž€«rì]ñÀÑD1ð¸‰ïxKì'.#£À'~ §q¨µú;UÛ¶›Nrr¸cÒÌ)/v5À–ÝÃÊ…Ö0ºOº¾…OUVŸ÷Þ¤´ƒlTýÄúÉdfDÎ%„…¡÷ëûQ¨š¶iâds 8x2 {uG½Þëý¼yléQé$ 5¯ß¡ôÉxœÝŒË´_î]ã§]xdÎ¶ã‚æ2XÇ9ƒà'.÷½’*§ñ‚úLhçI}P,gW[7µ.´,5À6¢„þÝsXŸD½lÄÍ"µøùÕÑe&L_ĬOf],‘·®(aëfïpr[n*Y\L÷’"-×Á_Ân‰TOŽ×;hey @8 dîJÅø¹qx÷ ¾þÌYÄ ÆÕ†ðMT/F¬)ES/ˆÒíc•i L $A¾÷@¬Š¯…!ãÐþ®Ÿ¬ÍÔÝ•¶¿\ÁçÃ+õÉï©5a‡ ‰-˜ëÃp”û@ж‚‘“æXèuY¢º?.”Käq© ¸ñ™éà+&^l·«O³¿'/Ý õ)7J®‰H;¹a1¹ö¦(#d—Q­lýíòû]"V›iHbX)‹Œé0UE1D‡îó=jøÒ´‡G)é€6Ò§ë…1dk;ªkø6@2Í£™±V-:‘bê‘_ÇRM½$×ZÄ®äù²HOtô~Nš‚7;Uº6®î—q®tŽ•ø”é̈Ûn¯:=G1×Cå6ôx—à V.E›îƒÇHqð°®®»…×q<Ûyµjgâ7=SÖ³ {U¹—Å!]ýy¯q*¸­mÚX¡Kn*_Õ¾®/o%þö/#‰èìP€ÁÞ<µ·`œžÈšâ§b¡ –ÐÞȼiKë1é™Íh ïÈn1žnÒOHR¢550…£n·?KÈö–ì=6µY_Ö<Ò¤ h™ÌTïÙsæv ÍXùñl$ÞAUÚîáï!k$߆çj¶dX¢{›¯zO¾<§l¿>1á˜SÄ»0Y= _Ǩ$Z3Ÿê!«÷ŠÄ\EdKÑ íuÎÒžºçË+ð%×ÂWdˆÐbØêrv|êœÀ :¥‘‚ƒ ¯â™·øÇ+É^`¯Í኱¸¸àE½‡KzàŸQ…ç×oÔwx“£ .8U“9Çñ-Lê} ªÔ®E\¦žÞÃ#ýªÿY½|= ©ô¸"±Ï?d¬9øSj•Hiùó³ã±÷çÔãšOçQCmµ±9O¼R—ùí¦(ãýÝÀ;wCЦ&NºÙpÊÕÞYuJ³hºÕsŸZ| Ò’U —±z55ª¤övó«ù¢ÿ"Ûoè%ŸfÂø˜5ydf½½½´íI™öY×lçÇ ÇhDÿÕå ³;ûÞ”àë6ëÕ𕨬TÒÊmSÙ ­–ÈÜiØûà¥Õ÷†¼ó£Ò`X7Èe‚¶È)º±Sšæë›äÕ† ZÙ§Y;ê ¼pÕ²¤`×*±Ø6æ“9!øã]ŒuÙ pÞ-=§Õõ\Í‘•PQóî*läÑA7~¯À!µ|f‡ÃZØBüÕ‹-=ÃL¾] ùH™‹äÓ¯m¶8¾ý évcdbOU¸V8Q Š× %‚.€¡_5|àP™èbªË‰6¸ûÞ™ où³vRÅÎÃ…‰Ý '±ïmúæ„P6HÅ_ €¡´V˨ÔÅÅ](‰Ðì[GQ•|Xá˸Ý9ƒÓ¤€±X¶=¥Û_K¦¨áß@Oº>‘íûÎéòÆŽ·oûb ÑºÃøj}|¡c…åºÃJFZÍJ1„ˆÅT¨“”ô)ÞøKt£rîçý\Ç)´Áe){_](ªf85R\¬5äc<ƒvæt&QÄá-‘ŠƒN%t ©_oûž‰ïÔdjÞWÖ€]ÂUÙµää ôs9‘0ïÈt;U!’4)ü”À¶;p¢ïm1Ä äÊ)h¦àöD¬å7ƒ¦þõ´˜r¾Õˆ2}\˜ÿ~ˆTÉ5 ÒtS ãËØÐb4¯§Ä±{c­¯¿„QT÷±âNi\ˆï[RçÎOyäø¹7qĈ.9‹«ÿ¦2ãÒÙ+€î:&}Eƒ‰Õë± "P¼Kd*qZ"nØ®Î'F Õ@vNhxZC7®ÄÔ4"Q™î“m°¢.'NzÞSÌ™:lÍRR½LÁÒ8®ÂŽÿY\Çv6v#Bµ® œfÁ”2ÞÝ1Kq䇧ҥd™‹5#/…8Eܹ±€Ó IÑÓ2EžÐ*Ú>“x7Ø®zl“$AêäÔI¬BÁø½\¢Õ¾wQƒ„•¾Õ~ä,ä}ëìy/:±9Ý—rÄ —¡k(%ìq8‰`¡ïP_k¸“Só„ÂÁ»N¸|`U87µ¡È(&ÇŒ Þ«XHÝ͉àå)Õš‹Í [€µ†³kˆÞ”ÿø¡¦´ zê~N“»l«½Ø{iÑxú€è´Z4{™š¬å¯Y‡’¯4¾š4¾a*Þ#h¦„°Ž3€þX\µ ùÑ¥wAº°É]axƒ^­C·f_¬³FÀæï¶·§ˆz2Þ¤sþ¹¥°>üQgùTÿUÑWR¡R#;@ø±Q„=¢‚\Ðü”±F³Õôg€êG_í¢»©÷u½šæ–PX[g4¯;/M$šSpà‘KfTëódp¦ê]_ü‘¿<¡_ÕÄ1iwžž£CFƒ§bÑ]r*2`÷x½3Ð º'*òÅ~‰±°%d9˜¹YY¦\hZ—3Þ„ÐD¡c_ âðgúºbƒ¹k‰CáQ–éþeW*ØÐùË™åZIÿ^A8áîÊZ¹ÎšŠj‡> ¾:§n š™Àclyâí2¼ý]G0¶è^°iˉ3o©¸ûté Š¢ö€B¿™œ³6Ò¯ˆC½ožÌ=›QaPêû¯08]‡‡öecßgó1Ìt¯Q ×ijÇ!§Z¦Â<ö6aKJef ³T”!å_C"m¹â´ p¿­ŽâÊ'ÌX¯á›¾¼ÛQT Í]V™à-*äô«¤ëhÌ`:¤á‡H‰|ûàŠÑŸ’vóæ|áÆV€ÕÜ}T=ûϽ¼Nâ„Ü0ªcíI±~¸] Ì fæ2/-Å!LS¶¢ˆÖd¸]e©4ÔÅ>:¦F(»‘uî ßq¤œî&¾P«rÃÄ(]óðíRº¯°ƒÉç6¯QÞƒÊnÀý»ût‚àAhÀª‰búrÁëbÓBBö” Ýi~x¿hHžeŠL“͈¾rªµ9m©«“ ^¢ÚR&½,KÙ¼_òs¢€²}IÉf\‹åá W¦‡)>¹Iƒ.‚q×*|¼~uþÌŸ.ürn÷°ì¸’‘yaþäWP1aa¶ÌÇÏò6 ³éMOÛyPÔ(Û\l,&f_6ÝqBy”¿CÌwâtÓøÐTdÍò­T…FTÝv? 5ŒôÍ–zWŽëSÁ;L Šªã$ÛÌÆž´ßØJ3Tƒ1~»Dú)ÀÑp¼.šéªôž×á^¬ï¤–GRñžÂ£F+:•GmäÙ0‘ÉL·(w­=Y¤SŸ6ÿ¸½Ð“‡˜~K¾:3™VÀÆZ£j~TOÆëΩD²‘™älc¢½M“96+¶¢³ßræ=EÇV;Hµ§v+á…eµIlŸ@ØDÃfUý O±FCúõõÊr°›¨–þiñ´T ýÆãr‚ÿf!Ñ3–zŠ˜ô¤A|Ð%œ¦‹»j,„+e˜|ÌzÙ>Àëm†ýôð@=è¿0mRîTÿÍ™KoŠr Åö Ɉüñ,˺c¥påt˜Y¯aÂÔXõ1u¤³wù¡.s¡µ‰n÷©ÎŠ)8ž ˈ$’¨Ãs7˜$zü·í÷3~ö‘~ã‡Êʹnéª8]€E^‘±¯]vt.‘@ÆBëaá'Û¢…^xžœŽmÚÖÅ“¯«gÔ$ÙD0(5%ºÌºïê§¿3ªuï”òOÛpãKpD•@ÓëØjº’9=Ö–Š?#-ÖÊKÎøÒË®@ú§7ìBž–íÇÆZÀÿ¢«‰AT¾ÁN©ø,£öµî9&ä╺âTÂ=©“Å6…°±W'Dö$Ê“½óK±QáºDæµ.5ê`x©ÆŽA®>xùɸµ¢“õ\¤usç{®Üæ§H]KŽùn£.ßïÛxO-ðhºPŒ,X\äedLšáÇÌBË~^”l))œkXD¯)…ÙÐû` µ«K×ù‹S.bíhnÀ9ŒóÔÉw÷š­ b%ïäÃáA­!mHÑ@ ¥½Ô–Åaâ+ð•uð3ü¬=ë…©úbÚoÀ†v¬ÝQiSÝó:e†üü ˜˜Ym”&ÍPiÜãÛÈCÙ§ >NûUåÃ$‚„†Í¡f¡Æí ÎV›b\Ýì±Iì<õøÍÃÔ1î»N,<‰PO˜}σ¡;ˆÅ'ã:áÌŸKÇÃbÏXÍ•îá³Xa¨ZÊ*ÛΕkX¬-ñG 4œ"žG1¹$~Ÿùf?Í-œà¶c¥Pjòÿº6€ Ÿõë Ê|üzÐ1(£6»½™Ø¢ˆ£á›5ôôý¤sfUÚ‰Bi~çÙÂmJØôÌñQÕÌ÷ñ¨–ͼÂã}KlY¦×æq’x0G©Ó`ÇÛ°c^uË4”6”n¼37qòT4$û8eø(qÞû4'bô¯[®¯5âíDç+'p¼ÛäŒøR8t'ùý†¯#¤ÎÁZ0¶áŽsb˜cÜôž˜C¹rš‘.;Ñ.N£zD>(àkñkM<åZR`D—a1G…1œÅž=Éšy¨pH]¡óWæßD‹EÀÝï–ÝÐ`«}\ì£ÇÆ06Šõzh1K¶^ˆb;[¥ù艂—âïænÅÞbÑeô„Y6Êè• JGì•J\)Hæù,ß{ãF¸]óK¢ÊéSÖ 2¥9DP#*á{ ßPÙJ£BÑÁƒôÏñÜ ™îªÍUV‰ƒDŸï2äÅËO$Qèïäø¤ûÖ˜M ΢ÇöðCa¥ œŒ*}šaz~Rë§EÜ4NxÄ’kÖX)`™|BËóåþðý§Æ[H-¾u\¾dhÉÉ Uw-Ÿ^dûž1šçüƒ\ËTåµ8ʲ +@e£­–û¶Ž‘7R qê&ºç^aý—CŸ½­}ú+ þ¸Žn¼R“Ò"•IœúÊÄûè Í{N3B1 ·bâ¨Læ°;2–‡·Y-àà‘öÜ4-¹Þ$¿R7õ!\û\×Pxuà#²Ç¢$r.ΡËêwj¼5ÎŽC ÛN|ÐuAéûÓ^„ÈEmBA 5wüB=ÔOð!:þ{¥eœJÂÓL\.ú##‘qÀQvè´°ÌÌÀèÄÉÇ ö¨Ð̰Xi ®àßk»1U‡ƒj7·Ê›ÏËpŸÐHþ¼ßÕ§ÿ¡êž·ÅË:z/#¼ õŽŒ¸ˆí^ ÆÕ[€Ü;ωWJþ¡0`dúž36 †#ô~í–ÙÉfÈ®J"M`Êý®’¸0S‹¡e¸9¶xªu~•ÞàÝŒä6ƒgÇ çä ÃGŸ€#Ïìæ%%öå³»þºöGh:ÜC£¾<ú¶ökÍä›g̳·ÙŒ 3ªEgÈ1¦ŒR²Ÿäîlßun| =§Å"$“ðÒ¥àà¬ß¹I§`±~SdÚalv¡µj•Ú“oˆ>ÌF©kù–Ç^D3Û¿šá¦ÒbH-È5òà+‰ÍÄeÖŠ¸ñ°o%+wµVm£{þF„a„ž3†ëªUÁùÑS~‹¥Îz¢Gœ2+~ÖLE]Éy>åf†gÒ1›à…ÿ61rÍ#b£®+ÞîÚžMÿÈŒ@:Æû9^òîŽ]µ‡03'—æ’1¬Et¨.Àæ&CܼRþ ûë(q¿z@‡Žü& zë&‚7à)Ì(ãÕ§á…©>-M°¿2VXóÁØMÖòÕœEœÀë ÓíilÓÆªS‘N ËäÛ—<ÅÙ’ÇÖhº‘jÆLRzHÀ°•0ONy4$ÂÑ'è òÔŽÌ29ûÕ,Å”˜ñÔWŸàsWx«ÕCâ°ê.  ~fÊÁ· |¬Öù^_©(äÞØ[ø)môo ¬Hub:”kí´×l •ÄñÊݧó¬F;õ±YXü:=!]ç~:Uº!x`ç ·kû¾À×È”7SÝâc¹$¯yoþ0!ùhEBw̺…1·ªÝ£Ýʨìú}"!6­rYëÄ\¯uDe‚›ÍŽ]¦†øI4‹ó¾ÁgimãÄR0í»ðNȽ • ÷ú­ÊËœ¯ŒƒóT%. ñAÑû†gAJg§É®#oõch¨ØÇ¥*ã}Áˆ’Ù’«}žžYmC{™ƒ I'{P™ÙÊåàæ%&'¿I}&ÀÝ~bc°  MËP0ñ(\HóÎôa£wæÞ©«^ž=îÕJ\[ £ò¤ ´âôqr©­X³ QÅ~ö×BõßSlÔ•>Ÿ`ºB²_à‘F{ áÌ2lØûê—k~¬\üÐ錻¨(ƯL†zÙÈK#vYƒß4.q`AÜF%´ý¼äOÉàYø9iJgŒÎfq!{GBÁñ“Yˆàô;…eFco‰ËÀB`Ê›¦%7·hÎUÃu_º%9Añ¯9G’e¥÷öÐ)Ak’jm­}_… Åmíe&F<²s{ä¿Ñ~<d¥9ùL8ôSÍžÖþrJÞç„ßl½ì“t]+ 1»‘$-[j÷áóôçI4[kOT×ʼÕ†¨¸AF îÖ<j塾° ü61+N‰¤›GøN\³$Jå®[?¦f\ÞñÜLÞnjÈþ¬Ú“õÏ‚‹ÍL3ØÍðžHq?%ºÔN‰Ž†í¬éÌcº¯^ÿj›“ä]³êªI"ä& ð_´î Gß7ÏqÛcô^ò"çK:B58uì–b}äú.ç½³,™Áàw…'¶úõR¼ù;o¡ƒŽpãú“Å¡€øi䜤̌©m@öîêtmì ®¢ŒIwc¼ L9ðåÞû¬ G?“¨öš°é{+ßÔKâ4]Ci7rñ47Ã'Á"|Ì+XOåäÄ&‚‚˾¡ƒA©ÍH)ßUøpþgTF¼­¡fmglÙ“ G¾±þìpÔÇ)#ÒÔüèŒ6!q ÚÞ~ü8DÊÚ)†Èý¥D´ªcÁ³-Æî¬W„£§Ÿvaƒ´ÂFå_ÆS†w>†‚“¯i9§j]7º Õ;U(Pªþ²Jó¥u&Hú*âk±‚¿¾® óÍ`7G'ºå¸Ý⢻ÚÀÆ0Fki›ÄGÎÊž¸âUüí¨=@¨ö¥irÖa5óó òá‚Û‹F’i7K<–•VÚcLdeh¨4fw_17!ÜfêØ'2O²ç•a„jy˜VÕ1Lãv ²tþ†’RGêvM›"HˆTæ«ç{T~þŒB±—Kü7¶ tI?÷mJÑ0[<‹+ûÓAéö}ª’k@íìLÆÝ/·™f £Îý~‰RéÝj¨ÚKͪ¯Wg•“RcCjñ'Cù½ŠSÅØ.T{0 mSUîé Ð9ÐÐcJ„¨ýÜsXê0f¸ø&gŠ©äîÛç ¬ã´t¢rçx8=Ë¥‰Ìß%*a¸= «QÑ8ú8«0×ã/v ¬¿êçµ½‚áÃ}c“œwX«xBbæ`ËŽ$4¯÷I›®ù2¿tWôc=„Ä›÷±£2Á¡Ãp”^2Æ+Ã^6Wû‰*Éáúˆÿ´{µ>Ã)÷²¢ž“¶ŒRG}èì¨ô:´«ɶ´2§°a%nî°ÄÃÒ†%š—t1n¡ÙqŸÇî­¼­Þ­™È˜ïŠpÕP4—ŠB¹µ#Ëÿì½yx û]RKÚ·DóÒ*åüpS',ÿÅdŠ,{ÌDÍÒ¼P%¯“Ýñ[Ÿ¼^n²­êŠ%/¿!xØÔ ÿ¬Ž“J³Ô¤oá9w)cͶAcZI²ÝÏUÖFôÑšá6Oê«9/¨e‹0çÅ©0‡¤'¿Vh-·*õ“Æh_ Évë.Ëj“}‰¥õ“  Næ%»µ¾§.žÄF3—À£ä¥£^– fº ÅL„%}o±Æ{xXeß*Ö¾Ô¼ÀÍ•Ä4âroGöB¢©_®Ò«},óöÐ(Žg–ë "Ý[¹)mì)ì½€ì6ìdi©Ü[»! âê¸tÃ3ŽÛO€7~kR x»¹ã±º8õ¾ñ^dë=[R-™^j)¬άçó³"öâèïß§MEx ^[K±³¡A¬œXk¥*ù´&±fhN!Rƒ]¼³!2ÞÿÚ™0{6'Ôg c;K%’–ܻМ£W­ùá7Ê«€¯þÑÖœF¥½U`Ò|›Xð‰íªˆ7òÖ •…wû~Ç‚ÁG9g´ ¡°øéºqù_cC¡ðÇ©\¾ÂiYÙó—À ½ú•Œ jX’n²Ðé|ð}`–ɹÒ1.¸·îŒUU§%–ï˃H¾cH½«$\¦dë<½5ÌHŸo3Åé,¢îÉ„‰Ä¾Î¸æ/f1Õ¾+¡ì­%…+I§UÙáØKŸ®yVŽ6IyR•”BÙ„² ó–ô(7¡ fZ‰aZuƒÞH 2OPÏ^”[†…­~•%EI²dNùM¸ò"²¨T`vÁŠ?ÓÍ ‘’aÇ¥Zñ5Fò1}tCÌ )ã®*P$Ù0¦’J_c@!ÅöòD&O~寉–‘ ©ù¡Ë¸jó­‘ 1ïôh‡ïæÆ0aÏÔ‹±@°§Ua©»‹u#ÿlíÃ#Ū¯`™sžë´ õ*&:ð§–]C´‡èˆÒXøwÊ"Ê Kªâ©x˜0ĪmùàØ}87v¤™Yw9·Ú8b¢°Ô)«kR¸R{¦1¶/Ñhü‡ŽVÌ4·­´Î4Q{¹LªŒ ë ;!¢¨C`lyŒtnmª|Æ,?«ŠvuTÝçS/ÅÓÃ%÷ Y^?Š šÃ%€3®œÆq餖mé¼N‘|´\rˆ[þJ8g’¹&·7øyp1)Þ…fC«}Te.÷M4¨¹y¼%SÄuøaú5Ü€nìñFvmZÒr–±ì˜ÛÞž|o w¥î.Áþؘ¨Û‡ö6Xójü\ýi Wíµ‡„+94·Ð˜Á 6 |Nm«™žÎ“}¬ÌMO 씟|?-Âëà”…g¡–¡ÔÄÏÞCŠN]èõö×ÝÉt¬Þ!’¡<õ¦Ö²p?….f‘Þ ^v»9Tt„F¢Û %ŽÃs­ª KH»$Ü6«¡å×ÀL,{ì0ÎqxG_Óô—ÃÈÉé•»¾øu_˜ LȹI¶¾Û7 ùxŬ¿L’¯äÃ!%ÛB}mw¢;ïxk}ž-< ŸeŽÉßi[ÁicñS ksÈÉÙ^j a⿼š²ƒw$®°¿N8Wöl‰+@>W!’ÒðSI< U¿ÌjW<¿Þtæâ}ÒQÎÃç„ÙÐâr„JvÍãó²ê’™ nÝØªG.Ñô©(2sG,i—¡{ìÎ÷„뢗±ýÝ~À+¿?êÌÇí¬ÑHoä`¢B§eáØÀ良BùŠž&žÖ.ÀÆÆŒ´ ïÍï }Iªk¤5ÖÔ‚ÔéðTNßGÝèâ–ê9 { ç— Ä²XÐõ…»@o¦C:lïØ7l³³Í’@å ‘í’­et7Ó+Õ’P_•BÔû˜;l—Óßn¼khŽTWûý£UÎ2¾oæ‚H¼w-JKЩ$µ{X/kP÷'K Á2«Ï?6KrD²ÉR¡~zŽäâæok‰"¢˜Žÿš^XìX–JiãÆ›X…"S#-ü.Ò9Œ©Ùk/bAšBOx Ù½<ð6ÑG0b¦”´”‡ørcÆþ(^ü°¦ösV‚*Þ‘—VÇ 5#79Ç]‘ci¢ ºGvbÇN`#J•rv*û›ÙPµpF¹è’¸‡†)ýíð2„Ö µü–² ½lWôÔÆU¤ßˆÔ«ŠÌÓÁ5Á‘sío"b|sjJù¢ Ɖ|ðw91Ⱦ„)Ô!wív$C8Äjh¯îDÍú+R¾#dkuÓÇ3ÖóÏB5˳#pMA8î SmÂv³ø~ʉ‘>Ô¿ ‰Ã•ü¿UÁón-_‰Me_ÜJ ÷y“f£òŽ¿‡jUøɯ8·ÿ=õ5~;¶r-¬, w™¢Í-k1#Â\ah^ :°@œÄÃ)DÐÚô¢™Ø¬2§ÌUˆX±•û7rÏŽ/ü€Ø<×DßBÊë:3oÇ$ßÏ«ËCÔÒ¤¾9Þ`ŒWʾÙoPoÄØ”¦¥­Iå¾ÍŒ6?¡ía¦n×_ø.l{ƒ¿ûš!¯ì•_%ÜÒ½u•7˜ë8à˜=¾õáW^—={—óL¾ÝöJ§˜]¢HA”;•s†2Øú0øÕ‘wÝ)¾[ ΟJI*P;¸ëæyâiµ¼"vêÏÑ>M ;Tä:(4Áª"å!µ7AÛç& ¼«gL¥æ©*ù_DÞÏLõ¨{æD«0§·ˆ•«”><ùzKv*GÍ=D W¤•N2ßÑ”Hcqí>#PÒÅ3ͼx•Ë”ü \-§!T ¾. Y é-\ºŠ +ãy\œGiB~’ï“Ì<¤#~À·-̼KOåØMl»}úN#D7­ó†@vk÷¹òxÄ1EÒBáñîŠÉ¼¡inø6Œ¹ŠÔÊL¤ø®.=W㞪®kàYùeÙ nW©ígä]¶®~8S¼\g{U_hCí!ÖüÁÐŽR’×ÒÙPLmãƒ/îè²ì.3zªØF%<éÉÞ9"Ýw!Q îûÒÚ©éÒîb|IUèûí}„PWÄã¸ÃµrûçR“­ê…í_5ÏöÞ_óÖÉä=ÖO…ß6¨mÙÝËL¥Æ çúxˆd¨tß§Ì%àÇl šÊž•N ~áÉÑ(iMí›L-²\¶"íqFlEhÙ­²ì#…ôtK˜4²878“ɧâ[ë"îQ5 û—âÇ/É×\òܽùÌ}u‰g/RŽau½ƒ’wô|•q [b訋õ²…¼«ü‘i3ÙAåˆì5(Œ;?±!^#­øª§TˆÊ•Ñý´«ízÜðئSR`a ´Lsï]±Yä%êÔµ·ë {œ:W¢¾å©r»7cúm%üH" ›ÚIeŽ<”ÍÖdWOзøÍlÉRžÏÍ}qí4zçÊ0ñ6xÓ+wû¹Ì|[†qJ žñæ§aûE¿jT¦ïÌcÀæÈªÌY–ÉlÀóYú¯wŸx!?Pã`ŸU ý¤&£½ßð{Ed.çdp³Ùì1ÞÕð#SÀ1J”‡€ ©¦0uâLÚØyËKĉ~¶XOû Aô> ,Rf·Å7gÅî„ýÿzŨ, endstream endobj 3700 0 obj << /Length1 1401 /Length2 6058 /Length3 0 /Length 7007 /Filter /FlateDecode >> stream xÚwT”[Û6R"ÀC7 ‚¤tw0À3À ]Ò ¡Ò©H(%]Ò " %!ÒÝ)~cœsÞóþÿZß·f­gž}ß×]{_×^ëaaÐÖ㑵ƒÛ@”à0$?/H×ÐÓã /$€Ç¢Eº@þ²ã±B<P8Lâ?ò0eS#Q@ 8 Põtø~ ~Q ÄÿÂ=$°ÔÐàTá0EîæëupD¢êüõ °Ûrüââ¢Ü¿ÂYWˆÔ 4ÀHGˆ+ª¢-ØЃÛB!Hߥ`—rD"Ý$øø¼½½yÁ®^¸‡ƒ47à E:ºÄà büлBþŒÆ‹Çè;B¿zp{¤7Ø  .P[ ñ„ÙA<Tu@OEÐrƒÀ~ƒÕ¸?›ðóòÿîOôÏDPد`°­-ÜÕ ó…Â{¨ ÐRRçEú ¹0Ìî'ì‚€£âÁ^`¨ ØøÕ:P’ÕÀ¨ ÿ̇°õ€º!¼¨ËÏù~¦Am³"ÌNîê !x?ûS€z@lQûîË÷çpapo˜ÿ_+{(ÌÎþçvžn|0¨»'DEáeÂûÇæA H $@܈­#ßÏú¾n_NþŸfÔ þnp7À5$jAýáù#À^éá ôÿOÇ¿Wxüü€Ô Ø@ 0¼²£ÌûßkÔù{@}3Š~üèçïï7 Ãìà0ß࿎˜OIÉDÍXëÏÈ;åäà>€??À# ÄÅÅQaq ðßi´ÁÐ?müG¨ ̈ÿîµMuìõ‡ìôÁü;—&E\ÀþÏÍA [ÔƒÿÿÌö_!ÿ?’ÿÌò¿òü¿;Ròtqùågÿ øü`W¨‹ïЏžH”4à()Àþjù­\ ˆÔÓõ¿½*H0J ²0—¿7ŠP‚ú@ì´¡H[Çß|ùm7ø©4( ¢ G@Þ-?ô_>”¼lQ÷EÊ_.J=ÿ.©³…Ûý”™€°öðûâP\üùQz´ƒøü¢1ÀÇ ƒ#Q!j¼@Àî÷óL…@Ÿê€¹@ì‘?]¿­ü¬¿Ïï§ù_Um==PNä/f ZúkýKéˆÄojn+îTÞrV)Kãͳü{~±5æ‰IO´0’õsž¿£úÍŒ£îrÖve”©Ú“%‘#4œ;gC>æY!s)ʹH4Åž%¹=žüþóÜÚá£hjÌÒíÝDZ"k3L3¶$£‰«ÑNÁÕò•‚ï­ˆUSñMÀ(:e1wˆbå¾5bsc¶E·|–1Xx n î9½0cäjkçX/®¬b9YX£ÅšïàFÍi±}xñªˆp2ú ZíHTE-Ç͵8ó×Ìoù1õ!Ï G¹0g¯§ûº¶<-NxåÏç}:„lIÖ ŽEcºíÈ&s°Xs…ôA$ù½‰ŒqV]6í“ß6ÛΪ3ô‹«okb.„YÑãØnCZÝS÷hÍåÕßõ9iMýèæXùàè{Ó#”+»Å=ÿ O£"”p¥RªñMêÀú„ÓG¥Ù4®s·AÃIÎÝêë·zÒ ¶[&ä›^Ð-ñpµzš^ó¬&ë±3c\ÑiìŸ'%m=ño‘D+¬Ek{Uí¤Z\³æ¼ýŠó¥]ˆ„ž³K-b4'0X·°ý—zÿ#”ÆëýŒëºá¬‰­S:Q¯Ÿ·ÌqË‹ Pàngðì ’"eS?)<äš%C2ÕM@GÖH-Ü]ôD„´Æ)מjZF!ë&g¥ˆßãNHÝ‘kÆN¸4ŽdRydÚ2Mº“Êæ‰…}YçíkËâ ¢1štÖmbé#M½pš ôGÕ£æ9L Ó¸^ä‰Ã˜iº€fñÔ‡G¾¿ðÇÈz%æ`læ¼G³L{?Ñïu·ÊŒ~ëdúÙ·–Ü›Z*£ C½ù}¯C˜åe0±#¡Ážü–OÌ\é¶²–LGùnKRÛMáz~9ei#åæ¶¡hÏŸ|sa£ë>Æ9Ý¡ƒýÕ¦š°ºFÇ–«Ö´ûêËõ` ×r6el:&có³Ð’ùeÇS …Õ×öóˆù‡@Ù%µý…†Ó±ÉÐiGÉæH­C bÒÀø†Ø/×V½¹ÇD»~"‘ÆJ]“ƒVMªÁ¡ë¥$Q& ¤Xs»Wc ?J#íO¹õŠYj1šÛ¯ÅûŽžÁM©:¾¨éÕ'½Œ©u+¼EÆw"&¦¥õLB¦°–sÓÜ š0ݰ>$–Ï+jÀôDkÖ¡·)Ù)O*É®ð©øZ¯‡Žb19Èä+C‘ôôº¬¢îÕëoDXïÜîF̽žGsVíß°¥  Ú}¦G¶ôüùÐù«jÙd«"ÒL^÷äWÎÚW¸í/.ZiØð¬!M£9ÞÛÎ…îŸäMd[Ö®@©»Ë&sb}AäpP9ÛŠßM,šIΕÌSs§KJ;wØù!\Ž#-Óý)%tiépüFTÀ'݃@f & %Ì^¿nõ×›Wµ.ï›rŸÒÎv>K]7µ›$e%: :”…fàÓSnÚô“ÌT§¥¿¬ƒQ}´˜i—ÖŽ L˱k«¥z]#7 êœñ™û{AÓ"º¬ éÙlû‚ôì8û1`î÷Ú—Ûä†ÞÓ >&ðØ~ôæÊ„Û¡ÔÛei*Pƒ’ƒZÌqÕ *E€y” úF(ÖÖÔAš>ï+¡„ufÈjÝ\µôi¡{[—¼ï ,—ÑŒk¿œêÍ;GS'»AGçÁ‘)] ¾ê'Ò¶W2Ôªìš'(žlºã- {w“f4Ë Çž$1_N ÷aèŒå*å®`ÂÆßXwíMaÔ4!†d8Šd“GZÎò 'Åmuž&ÈâG‘% 9N‹pµ6~jõR§Ñ•\žÎå‰Â˜J›h^å£S›ŽˆpäÓÞé&Sˆ•*ã>_#ñ¼Ò%Ӽタ¼ŠÐJM¼­é[ñþ@(“ÒÈL¤3ŠîÎMhæÖÞÆcăÓ;?’#ž&¾$óèO3üyäjí!ýòXŒÆPoðᡘ¿èÝ×C†[<ƒy¸–§g^!ùiŸlå3‹%ìPšù>Fèiß7Üì ~®bæÊ©»³°–>ogNwãëv§Œq<Öîj|ô©‚É+‚šO²•ëÌ=Uï v&c'ÚçêÅ€{œ]Kg<‘¯9’¬4×Þõ-h±9)>i³'ÒÌÚÀN/4þ5)Pp°üeßXQ—~Gb¹wØ”µÝì1•g•?Z©G…Qê'K~.YNöab>Ž#|XñˆÍ¤ºô᲎o7ñ9W……ª©bq× ØGÃV¸Év$uW?¶s‡qYþö›|uR™È‘ŸOõqø!‰›ïˆÒ»kÑ܈x‡~Ç?<ÖÙO+ê¯^„3íß¾ì¾ÁÉ-¢FÜãæðDæ“æ DB6I}±dNé«oÒ‰§ñáfm[62Êõ—D°˜¡¹fÿ2K—T‡zBLe/<Ɔc{òå Ù)Š!EaèÖaÿ:ÕÛ7Í[xVÏaXƒ{™ Õ[U,¯'Ð ý"´Ÿ’MÒ*¼hI^v7ež2uPgÛd!ì¾Uî•#«y×)ó¼ƒQz¹U6Ú7÷¤’â9¥‹/ñ¼^ÞÇ(K88ýÔç-¨sûÕAÉYav‚¾Þ^5õ`QnW†ƒ-eA·Úh»?ñG%.È]š¡—SÈÕ _â‹À9s½nß' À?=s(˜o¼@Ó⡲ôG¯e›¬iˆcK4“ª8H«!eg3‰ Æ»n.‹¨¾ÄÓiês»°ñÉ5Aì2¹¸×{Ö±õó¾]æ­Á—µS_•6«³ûSõÌâÕ¹ צ—\ÊøEùÏåÍÌ«X„g#|_s¬-ïÜ2¥1g Qºf^äë&O•¡Ž»—>Oí¬6ÍBß2ß×µüîê÷úȺÌí¢¦ŸXpÖÆ<Æ»Q»jØ$]’ÚšøY$k'?âßÉtWtymшÀPšî4=±=v|8ìZgq1~¿Îy¢.5ñžËÝm/ p´š”îUõÛxl³á: Y•¸E²êè»d ›´äª†¶1ã÷ŽÉΑkr0Føð ÀmýUÏ¢JÞðÙ»ä>Å•8œ0AC¨Ía,ˆ*›à}lÿUŠ0ý¾€SX&\Žš•”ÃTss#œò-=µ{ûª,^cR2ÒËÁ‚â©àÇè2í…yø;} 7t¿¬o¤Q¥„%æÙ€]Ú¶š0†TÅœ‹ U†™­ûx1)êvCF ÆMǘNñ2H'È»d«¥È™·K2‹N™NºS‚ŒªóM¥ÊI-gˆqˆ ®·óù"8hwàÁTgeù ¥”äO–¯Zí 7 Ò!•ªy¨·ÑB¨C´&‡¬æ™̸,l°Ç—†¥ÛwW"ã•mJ7éáuY*_„2 ×V#ïHò›%–#Ô- ’®¿µu~¥Ù1Ó_érb*s roûFæ@cËU\Ê?‘ ÷„§*ÇËÅ0<¥N#à­»#¾zŸ+úË„ƒ&žÅ1ê‚?PI‰ñó‰×Ì”Do³;ïMƒ7z°ñažþOÝ(Ã= Ÿ¼×iërwÙ°Ÿ²wz ÒÀ1Ax÷‹Ï·øÛ ÷Þ¾˜Q™äN½¼=h{ÆkSx‘ã·ííFڌ޸ÜÀŸC;ßõØ“J±H_¹µ§¸†§µ“‡a 4 äôŒå&ï»qºöÄùð*ÞéÊ;µÐºÌöÖ‘åü†£j³Õt“#ùcŠÎ­ÐYYsg©Íâ£2I/¨ˆZýeDñY„ˆ3/—Þ¼¼­¿QôíAók‰§d4ØäuK’|{•údp¤:4­º&–ç¸h.[²§”×áMÞ²@FâîQ´4Ùø=®3PK¿Š–ß0z/Ò$‡ús’ò8&¯Ež 5ýbAC—J³gŠZÈÉ9Óáœt«h³Á¤~‹ó³Ïµ¡¡…¤G¦.Vþì”F•ûaÐ|£Á[2‹ wMM–Óú¥åÆ-dú7Å3CæÔªS­Hî,ºD²÷‹QÆoKÓǪçÇ»Êì˜Ji¯u®¾K÷'Ff…niÒÞSðï‚ÕJÊß1%OI×<‘-/âkzbåk{ý¾û®2œë g›ï=¬«·ÅéPLAÊ–ÁNA ¢ÀÑc!ß7Üà;Hsê3t^9-'!±ªÀë Ø9)¨èX÷:³;×;,ÝúI}\òÕ¦ù¤ÓÔ¶Et‰öáÔiß v*µÍ•ô>7¦NÒ¶C,fß[Å•„Ç ½!Ü+E]”Ä׿èŦ³@mX¡Fu¤­±vOG˜>ć§bÄÛ«á\æ[Ä-aê#ÉݶG.¹gÌæx;Ç›¥7SK³²U¸ŸÅ)Õóq†|†\ÓK:™¢Í/Ëcñ‘:Q‘˜$õºÆÑHI®Ú{œËîwêžÙ?„d«zjµÚl™toîc~=pt>p)UDç,ç~óãÅQg4&H'÷žxPnkù1ï~þõƒŽäµDÂ!t:j8ç²tśΪ¹‰J;Ãt徯Aœ¦cP Æ´=}<‡6ÏO ³¿ßÜŒ~wÊÇÍ%Ëd1¦wªŠ{„oÌÆ®ÿÆM÷f̤´¥F¸îyÊÄÒûUXÈ+ƒZyánüÜ|³È2ù¨Î·Ä±Þ4ç<«¹V9"®ÃV^ÙéYÏ Õ^©ë½­'‰räz>©ÔδÔö¢Aº%¬–Þ‘óÓ1óÓÍ‚!QŠ_ÊDH½Ž^äKëŽ$]—ÀÙ’œ]Þ÷> ZWöÀWÍŽ żè^ Óú,!°”c–å(<êþ`‰¼÷“ 5 ©¼“¦¢ûÀGñnEÎŒ:×ö˜S7CíS™ŠéR%<¥äܵÓü«••ÉK.{˲0÷ z¾ÍÌxÞ» "ià"h{˜ë¾ýfÞ£-h©TŒ Áí£ ¥I>–o²ƒÈÞ9jͤ€úÓSÇŧ—dcX~­Uk²?of¬-½Ávˆ»Â£Ã1~9³0?YÂ.žyÖ$­àQÌŸ¸B⪥ÁtˆzÇ~1¢ÐóÆ?Lj£ÛÚ¬Ö;Y¿ùòݸ2›ºª¤ž y†@6ãg‘Ûã`»¡6¹BóoÃß `geØbÓl¾ÊõÑõþK Õ·jvL [̤8Årܼ˜eáÙ œO V¥‰3‘꺣‹˜bóÁs5Jwú²ñdóùvc2B7*ð6ψ HjÍ{ã—Þ€)¬ÜÆÜ;zÈÝByt…Þ^_ôƒ^N°A9H¤ˆ~šÙõøCȳòQXe.¡øKΕº!÷¾oÓñgíaAf+¬ï^œû²³‡»¯*hÑ(>Ñ;í º˜ú›XÊ2 i?»ã9ÂRϺc;`¬v™0Aç¹|{§{¨PŒà ±òÕޣב‰š–}ß@Š,Té_‡Œ« R¥õZÅ ÍZ•±[ó—fŒrr®*RG {¦˜‹5ª; ”‚&_Ðô&È;Û?.`³âÆà‚OÐ^„jêã »Yàâ3|0ÂVø‚]Md[¥SŒ>‘]ÛÝk$ÖàiíQ4/.ì[Ôµ[Ÿrkù¢¶bßW¾¢eÔ=©·¨¶%ÒÙî-‘YÕf×PŒ…0õ”Ôó`?êš¼ÇÚÊ̜ީc—å~YÕÊDH]5™·ó ÞTYœÈ‘¤Êª3ÉB©o#ô¡ŸN—QyÂä–ÙH]ô„^‰È÷iËøçûÖò[[\ñdÙ”>q…]òPÈ>¤¼ûãÍ÷>U—tDñ‹0%þFM™4€¢KÍ' Ça幃Þ`ø¡t«´û|ÁóýIÍ3_wåó^ãx:|»,°=¨s°ô²Çêîæ^³ÞµE…è]ÓŽ±Éµ ËVÂ3¢Ù'âõhgç¡ÃG‹Ì6LtÈvbõigo¢Uãn¤ œ*ôÞ¤;†ÃȾF¯zâGùç=h­"I×c2±©’…QØ–ÍÂôÈœÇ ŒÙð÷úŠã5îÇàÍçã6£NÛ[L–ÅŽ—:‰—ÞÛÇGoö çkarj.Ÿt"·Ô´MÞœc·qéTZ7†u»|ç³bï2KëêЗ;mËC^’ñúI|Ç>HãU•xÆÒŒ}ÃQÏ%ò󈔗ӾÇʨ-zc%•ßþæËÛ\+”KÍÛKa5í†Å2ý&É·¸Nå#ÌŸ­E<U®B}·­1T÷*/û©—5 >6#†pvŠ›wªÃ5ÃLŸËsúo˜}‹PŸ˜Æêp¶±;Wà5T?ox|ÿýÇâ8…‡» _ºâ#`£³#‡ãï§,õŒÄÂC¶'«GlGüa®Ô]%ô£Ð·²aûñä^ÝøÍ…òä—:Là#& fþé—ûúRcR[– c¾ÝÝÜGLÏ\üu+¬'êÅaø§¦þN„z¦oEk#Ìøz-ên„Ö;ØX ¢€H‰¸µDmú@¾ƒKºÍ¿cŒðÙó3‘¹ú‰(‘Rýç˜"ÒγqööÅKéÕXW$E˯öˈqœÌ‚¡>vÉqr¿ŸöçTX5zSò†FZ}²®ýÚÕ™ø endstream endobj 3702 0 obj << /Length1 1711 /Length2 8082 /Length3 0 /Length 9206 /Filter /FlateDecode >> stream xÚ¸TZ6Œ€”tJH#Ý Ò H Ãà 14H§ Ý%H‡€t#ÒR‚4Ò è7z½ï}ïûÿk}ßšµfæ<ûÙûì}ö³Ï3ƒ¶—¬Ü¬‡!¸ø¸yÅòzF|¼^^n^^~ff} þÇa6;»@à0ñÿbÈ;ƒ$¦D ‰p@Õ àð ‹ó‰ˆóòøyyÅþ&ÂÅ @7ˆ@ƒ  ‡]p˜å᎞Î[rŸ¿ßØ@ì>11‘ǿݲ`gh¶`äŽ  AÀÏ…`{b‹@8Šó𸻻s\¸áÎ6Rìî„-@ìvv[~• Ð:€ÿ”ÆÃ з…¸üeЃ[#ÜÎ`€B@`˜ ÒÅfv w詨´Á°¿Èêþ€›ï?áþxÿ ýv‚@pG ̳XC `€–’:7Âñ„Yý"¡.p¤?Ð -‘„ß©J²: ²Â?õ¹€œ!ŽnôW<¿Â Yf%wpÃ.8¿òS€8ƒAÈs÷äùÓ\{Üæý÷ʳ²þU†•«# âä VQøÃAB8ÿ`6`@ˆWLXXˆv€=@¶<¿6Ð÷tÿ6þ†‘5øz;ÂÖÈ2À¾k0òÇÛè œ]Á¾Þÿmø÷ ‡`!–` çŸèHlý×ÙgˆÀ„)?>ï¯ÇÞ™"f‡A=ÿ¡ÿn1¬úSýgœJþQNîðæâp‰ óøøø„""BßÇÑBþäñ_¾*0k8@ì¯t‘çôwÊn4Àög@ØÿŽ¥ G* `ûGè/x…xAÈ'¾ÿg¹ÿvùÿSù¯(ÿW¡ÿoFJ®Pèo;Û_„ÿèzþa •ëŠ@N9 °ÿ¥>ÿ5º`+ˆ«ÃÿZU@ä4ÈÂlŠæâäæü ‡¸(A<ÀVÚÈö/Õü…üš7(Ö†»@~Ý0H/^Þÿ±!‡ d¼E\Òüm#gèßû*Â@p«_ÃÆ/$ :;=q½F®„Þ|È©´{ü3€‡G ]È}Öpgœ_äð ½àîV–п:†4ÿ¶ü±üæãðXÿ àGÎ@ ¶þožÀøü…0²)àÿ‚Lă~éæ?29›_÷*Øì䊔ÈßA1†nR/ÿaóx È³ú7y<@Gü?’繺üã‰\¡ˆ#ôŸhÈ­‘©Ã­7ܯý­þcAÖïuuùw>>dg Õo%ÿÿÕ%«³32ÌïqB¶ðïõïû öƒpægà ‰`»÷Á­×U²Ôî\›#Ë«í±F½áB–Ù7Þ¶ê˜éO'ä,¬*§hÏ•„NÌøPs^z¼ø°”¬œƒ@Qì]—;æÊüvöÁLg§²I‰X':ŠÓ¡%°0A7aMx6s"Ò%°õîkþ]»Ë–±ØÀPxIÈLˆ–ÍnßC}eÄÀ´Š2zAøšØÙ$ÕU_Å`ìõäõ•\kå7Ïu“×iC_¾ döõ¦œæ©uW W„’P’z©2dÇ÷S’Åeª6¸ °È ]Ê—$Å2R8„²,¡Yˆ,ÝLåõµÄõ ¸ÖÙhÊ<Ðzù±Þµ.4#™ÝµtJc¾‘¡ÿïac|„íãª&9æJ+”ˡԣJhN7:9£¦}á§Æ¼¨øÊHõs}æË ³¯ã¯-¢ÓãøøM“$¡¢ý+o儵¡tŽÃÖÏ>ß>IP1“h« i2Ø­º?zÌ}ñ¶Röœ>v¾Ý8Ð:Ôv g:¤%› ˆ}Þ–¾×³× "tù‰ÈCQQ­6 ï0gÉŽ™òÓÍÉF×ni*a,#67Îc(@«O4«¯¾…’ª‰m$"ë?EˆObXBûîs¹ðÇ7’’I¢þ¼/Æï)èìÇV¯?Ðéúvß,ÖÒù˜‡ËL-§ÝØÖ¢H“U! ©ß‹½Ý–3š 8™YÊ‘ûaàgNRüòEŽuôÍ닭󺣜ç²5áÆÐˆÄŽI¿uó·iÛŒû^Ó¤vŽïw·±&my(×}¿D?&±z*ÞÏ\-«j–ÿÒGa`ÒTo=oÄrîúh]þ —ÏäJBp#ÀÑl»NóÈñ¦ÔIN@LÀ:"&°^¡áÏ"æŽnè§€w!JŒ¯ äŸq£ØZ×ãl@¥Õ>“çí™0½jŒ$ªùþÔñø²›æ Is5 j¿è ­ PIôÆM[`q…ç¹–ð€§,¼£úðåÞ–é3'j…@&Œp#Á墳ÐF¢<£˜éyϵÕïø×Íù›T4•À•“¼qø(<&)IwY;Z])}ZàxחߟiÒÓê¦+&ž¤5ÅL¡žß°$®§Bé•~’¿ðS'BÕµå{G§”myRX1æËÅ“¿6,t±aÓ¸YOÃ8­ÇfjìÐ×ø^A¥i@Kጇf~ºå_MKB7?AŠ‚ÕJµ'_3¨<ˆz?õþfëá….ÑsÄÔ3‰´Ž'©ý®2lJ‹H¦¼ÉôöY¿¸Ðñ l*CÑ’ÚÏD=ÐË©1ó'ñÊÏd‹»*Ö$j>.ÿÀ“o" 2„פ,¸5gïÇKwÕ$ÒK$fVK/J=î[/*kÁXö­>)bB÷ྛ®|Ò\z¦Ž‚-%þ”Œùãì~òáL‚6{bòhKk薬ʵ¶jiMšû|:I¡•Ê ²—=èJ Èã&–.r0`_oÈ@[¥ÆÚ[m´dÄ…*÷pĨ²5÷€gßíC̘InÓÍ]£:³V®Ì^šrPhñ“%mÖתo‡üÜâ¦÷1Õ2ÚiHŸ×ìI¯&8rÌ‹¸áÏRH.hó¹ø®?%HÉ׌2;HŠÐ߬µnPyê†5i±×â•óŠL}dÆÁ~Š›ÿ=^×ë-ÉÙ™õŽwظ‘‚íâù“<ï´´5¹¤áÝßï}óÙ.üÖ¬ògžKkUæýï¦Þɘ‚èDªaT"N¬A”_ï©…ß ÚkIRü(“™1Ä/Bц+¾Z¢øjú)_Ë Íä3ÆþÕ÷†Ñ¹í©ð–@³Y¦–¨Í³SS"QhRÌFƒKKpðžØµ53ötýÍ ÞêjùáüxÍ*y@›c®DÌvÒ­«Š^ެÐiš°œ$ÑBžl!M«"-¦z¬•1d⪄Ĕc„ËÏ×;|¢oP&g*™óM:ÿÞ] 8ê\X¯Z™ö.ÅÓ, D9²evùVºsœ @iš]ÕÌ'ÜØ,7ü¼1ÚÔ,I7=ß–ž~Œ‹zpj‰È…&¤Ú ÇýÔ wë2/ÂÐÝùX#«0CÓ>`Ðq¼ÂþK}Õä,|ÕúA¢ Æ8y»£oÃmŽNÌדè5yr¼§£•Âàì: ÁŽò€/s\üX7Ø´üK†¥×SyiFæ@ð—w†íêäáèá]ím¦¯ Mâ?Û>±¶½V|4·]`ÅZÞ½ÙAÍÕT;ÀÂCÝ `>yí6ßA5·Hë0Ri|KÕ“§Ž/:Öy> >«ƒ“Σ–Gf¨+|jV[v¬âcôx÷Q /íÜ€Ú²nCiH1q„×Ù–h_¯OG”ÕO;Oýôè€î:C‡þ¯)«”NEmä‡(ãÎâŽæ:›Óï‰yÝoÙÔ—_òãéA¼lŽëM ½_§å8H‹ês›Vy• ·«48P»$ñ°ËmæÆ~Œ1rÍiÉW5óþ·[%ª ~¤cŒ&pU¯ÍƒŸ·ž¶±>7j[Æsíóñ\ãGåˆDq( =J± ;ɇ¿Nö6•/•bú¦„íeÃ0ÎñÞŒ2uß.ò—æMÀÁHÁHüT4¦WÍ]ÇæK´c&Ÿ ~ ÷LdxÖh×^5®ºaÄËóŸ·×x¤Pà(ž)3é>7c¡ElK‰ù;Õ†cçeïkº!LL—xT!OîçA1h4“#ïØO¾Òäéç ^Zñ©åäÙ—•}Œ´ûâW–‡E ãõ¢(}úŽv•Þ)¢!fXòLg‡Ù+xê¡êû¦¹çùTy]OÞžö·ÜèS"zMåÓ)(É0¾ ïYODî:iø^ÝNúHþŒJG~ŸéÒòÑîÆØvI;)¢{í»±™ÀCËiã(ëÿ¸êñI»2~!"ùÁ@‘Œ‹iÜø£äʺ”9B?î¥bjêÁ¦aÞ¼d„næjs$*7#;זв_Ûÿ xcÆÁñôP5 ^+SU½–ðÓüxWvÒO hM‡l§CŽÎðü%Ó±˜b^3y¬$Î+Si@Ùv–·ûýJs!«¥C›©ŽÁ,¹´íŒ}Ùâ2âÕ6§÷cÇÃôËK‚u˜‘taù±ã‡|ï´­~Â.?{<£×›#|¾ÞzŸæs~‘IÜ—n+¸­uÕ7Ñç~WO™~æPìŽqûæ6>ø˜ØPL±8Ö®4’–ªªN ”|XñÁšâ=Çp[)7Ï–;FO„®h3›Ìüü«t/8b_ì)p _‹¼FYøŸE(¯wáÅ(¸¯5]›æûã¶QÇ’íY½ñVŒ'*è~å0O¹šFÄÍDf¸ºeK…ȼô²g²·g2Ü«$C?Y7æ~¯$l‘G–,s:|v#u™âHÕ©|“ ó5-Ýrµ˜ŒÇñì^ÝÙý§v¥ QtóÓ²Dñ°=O˜?óÔ^{³xI<™îÈÆp8]7ˆ|#¯ÝË|{ÂÊA~çôÜ_ÿìñ„z:Êþ”Kº„ß’={xÌú¼©ò iu-ïÚóÛz¥ógïRjÂ"†VºL^—e¦së-¹2ÎòiçWGŠËG&ˆ‰Ï6Zj4Ñ:o™¾3½—$¥Z œÍ”Þµ’±š ”R%ãïNÓL£0shø*ÓtS¥ídKÈ[½]M½?èìØFYÅGjw—£DDEØ q¡E$(½zš­é{FAÝ fœºš`<§>7–úÊ¡+ùåMM”zuc—w}mWï8r—Öæ±ªkíìWœ\Y%¹¯Rª•. ®µ[ÔFCC9ËZ'ÚÁ"$Ò¼elI—X+jêtõZ {L±ÄlF*\±QP‹w‡Ód[_eDZ”Åkß½Y5R¦µäK¨[kQî÷ntê×53šH§ÄŒó†I©øS²²Âü©!•´ã)¦çDJ©ö³’dK`WŸ\ÆåüeîSµ9mÛš—šµ&è*Cæ»áþòXÇúä^K“ÖØ[ØO¦’£nîY"?•ùfTY[ïV¿0Yøêbcb~ö{QìO´¦Éoo<ƒ»ªŠdùîÖžº­îvœû©-<óÎÔ˜Zž‰.Ñ85ý&þŒR‚”È>6„0õþó5‰ûÁrôñØEÏIb¸µWU$¤sôóÃÜ\È÷Ñ. L7ÞÅKN<üñà.^¨¶3ÒßÙ_!å)Yʱ`)ÖþÒ ¯ ÑK-ë\ e­¿î-Lº=»÷âüj.gF=u/(W;E @½t}ê%¡f#øùl"šN¢Á•q§Fâû¢^Rr—[Ûðñí…üËéÕ žx%Faî*^©- ÔsÎE5©`^JÆ¡©² ɽ€—¥ƒ ¸ªéêl)ÃG÷[a­/ܾ¯²ý{Ã~BDÇy†kÃ%5œåD å·´"‘5.éïfJú<·6‡z0õs¢ä…nŸ:Û¬`ô }dŠ K‰bñ©Š©ëˆÄz™ôåiéÆœhvÊ.^n%††Ûæ2›¢(h}€w2–;9È05íÕAýøìaˆÖ\U¸>wÔÛ×ÇØº&íã©pÍ'v¾bý` Üêiå« ™Ãï”ð¥'8y¡á—šaŸÇTK_†„®“§ Ò©…Û„¡—ônçw•lÈDeê—'¦Y—ŒÌ}j>:j¾+yë§® ¡™ ø¾g,þw=¢bÜw3E-[–Tnr N?ÅNiÜA¡Âp¨Øùó&m©q˜Í9¶ŠÒ–¸t"q.CÏ@kÔ‡oÇ/ï`R°R¦%"`ÿì»}A^IêðóJÖ ÷‡´…ä™d]O ŠÞÏj.ˆªÃ­ì\fñäpÓQS$O XŸ'Y‘‰q*ŠTkn``¥YE‰z÷šžF94eñ„Q>è;!Ìn™}MV`EåFùÊ5Ã(ùò½;Ü‘ä|'!M±G;KDIþp¬ÇN›@lí´‚1ãƒM‚\dVÔhï¼öáës 93­’orj‚\a-hL Ë*}ø»?s̵0À?,>áЧ2u.[úr‰‘éðôljÔ€ý³¥ç>ôîNVÕÝ£#Ü·Ý@3,´<îÀ¾ÛiÙ-3ßå2q=’ÜljN¸ é*­2ˬ§TÍýQ¢%“Ϭ§¸´ƒ‡(¬›sà ~AÕÄc¹>Ñ}ªa¨D6Ä+ôs”Ó^e“ÿ™˜”u²oI€püº§þ\V_ö³9×®4´°Û‡±¨öëùaì NNÿ  Ù”z¤mêk#b²ö9¸ˆ=Ùò„GÌ~˜Êñ/P—{Œúœ»Tºx(g?QR#Zß›»?r`[ô ÉXxüaŠÃ㥠[=®gÆÄ1øh£ªYª®†$‹7Ý57³j€ÐRñ¦k-¡eí`÷nóñEÞHµ%ˆñaF³Í‰o6N?Äx«­ûØ$% Yƒf¹3쟺LËï¬Gbk};Ù³ Â*rŒOõn\.V¦OV»“Gãq¯Êr Å,[ÒûÄôNç†nB^ý<ï,®‘Ü#Õ{¥½6D©q)ã> ÞKÆà Å©‘PŸz t‚^\·ækúÏ•ú&  Ó£@0j$ãÓ*»èå2Œ`ÏÈc„›Ç´¸«•N¹«±§9é{}+Ƅҷ–œ[´BMç •+¬Âî§ëÂÏßËv(¨ÑiaR~³Î`³‘q7µ.4Lî2Ùõ{¹ŧôm‡ÎŒ@VÀ­»M+Ãm²’¦žÿž.Ž×÷MýÆ¥ïüó_H-]fÜ3Éðò‹ŸfBó•/ØO ¥XéÊî[°õ†ÈxÇJÞ÷|&Õq¾!õ=®rËSækïÏ&ƒÕïX¿ÿRèV–èy'?ñ”³)2°xÄ4ß—) ût”„Åe•‹¾Ð溱û¥kõ+cªß«ëáƒÔ‚À om4Ewë[³éw‰Ù§Ó¸¼´bšª´f¾óêwÕx lïaчëôb»ËٌǭµÞéݵdg0ΖB3,/½$šªSU<§_(ÎÞÿ0¼áè\l¯Û ƒ!Ófé|#” íŠ@è]}ía¦ 8`ßæqÔí¿^šï,e|È_犓ªŽºæì™¯r)2>e¥Â"­n*ºH]Ù² ×yOu~\¥%αë½ÄRRyaºQ¢.ù¯½dæ&Qóz¡Iš¼u»~E®¸‹ùxlÈ?I$©A'a'å Põ®ä‹ORÌóO4J ò…Ï$0tè{=­À¡¯„íQÎý’ºŽÏÍ^ŠKÔévA¡ý˘UäÊ ŸÚžøòl|ä¢G=!êý^†O•3O϶çO?7¦RA÷1Knì%5tÂÔVW朎ö¹gïîxÛÊ Røx+¹˜W"Á˜üŠùæfû¾_øêÌfŒ¶¥gAõ ³-åc ¹ë³!"ÚÑSλRœ“lâ(ò/­Íø’\6²Â‹û 8É85ío2·0Üœ1U?ÒãèQz´kÆ¡žèu£$à»v‹YεRb!OìD§‹}XOǰ˜({áeÏ /N‘Ëo~ù‚‚}p::ƒ÷EqŽ»f9޼fÀßRžÕ¾Uí¶‚:P´º¾› y ›{,QѦ®±À’ŒŽçz|qÒÛqkäìœä»ß5HP7m¶’?7|[ÐOÃàÉ:dN)W¼µÎp•øU¥ë .1;ƒ²Å’ó9ºÿv.€v*k»"ì3èåÝÀý÷• EÓ>›ÝBLïý ¯E6•¿…ÈixÝèö¡'ï°-…§_,ÀœðÇ]÷:Y¡Mâàš&BS|híø¾¯…ÚÃoåBP Æ Í¹ölÎÑë´Îª$UÃõ¼f;sGE=\<ÍÞøu|5)žT¸¡ww,­Hx½Àˆ"Sš†¸P+ôáz£^¢¬sæð=€Žˆvrãx"«º$OLY6Áÿ­q°3S\zš4µe­7C޲IvJ³½u³ò¸L{0D}^äŽí 4kEÕjÎn–Žwk¤OÉ’†Öè…KE¯rZ㱸JA›’v'`­Eßú(­yå¬<‘³T1·«g—ýÞƒë×W”{ÇNi‘ƒÒK?€ÝÊ6öÓ‹oú”?탢SºÑÊ‘€ÙCòQ*Û*£¤NEÃÉ¥™:×wo»¼E×oxðY›äé2—~l‡K­ïI%9'³‰{Ñ.·9¦•nûSB 27æiQºK 7öÔn3N9èˆ*@Îqðê­ ìEW×WŸp‹êŽ*›RxÕ«b½&2Õ-è®M#µŸ—VÊ<Óã4™¬tžtÕå{œûFR¹ª[F¹!û[w¹¯4Ë–R×ħu¸ó¾¤í¦—Y‡¨Y…ù§fö:DVOï[ýâì£ åw”¡s?QØ+â÷´‰1½”ôöj¨²¥"wÌmñl„ÆœbN’iÃgVÂÏŒ=;Ì•, š“Æ×ÈÐÊ߀Öùh#ÝÞE}×û €±±dwm£¦ á€Jä‰ýÆ=NOo– ?+Y£Î”.‰µÜŒ[çÅÂÂ˪à;î•°PK@Ýظö>[ÿþ¾à™XÛM?÷ºäJl®hPó]ÙVÂMåñÐBØ!@i…S§òÀw{äÈ­!E‰\‰è=]HÞU¨nÇf¢eWî0Ö»[ƒr›…µ’ËñÎ êpLQãgÀ À]<<Á,qÓ5°v´RpÄa+ó‘ÓÔÐÄšúŵñßžK ÅÁѤÁüó"ÞxÞ××/¯€ì ¨Ÿ¥¼v»cJ…@3]õËIͧOzüÕõ+Í9™7óã9dûhfo,åˆW»ýÓ>X‚n"{@{U£g#kÙߘOè%M%Zé—þ\ö²‘¶ TE|ÛÉÍr–¡ƒ@/@o>ªæKêÝ3ÍÅ_K7É <97¹yLlÌI’yHj×RܱÚ$áò#äÃdµq/#õëWš„NènÚÞ+Ñ·õŜ⸢ÏõH-ê†tå¥ ã¯ÔvÒhšt| ȱ(ôÉ«,&UÃÄ))½$pGê]†_•—ú>lk cW€Ÿ~)BþX8¢‘–S[H~()Ã{+3&­ÙŽçò‚ ¬ÚWz¦é"æ}Ô­ÎåC¦—ÿhï›Û¬P}@®,ùnöìœàæÀò±Ÿ%;àèŠÿKR SñZ f7í¦!3Ô+ ~¡?²E06ï8ª.s~•ix¹¹|Gþí´Ì™YñIR—«š'9ù1ï»JåUùcÏ+ê¬Ù…¸d'P¢ƒ5úZzæ‘'“¼pÀƒAÇŸ¡ô÷¦‰®œúÛAî$÷fp½ N˜ƒ÷¥›€Wbe}¯õ|'yLî`•Oxöyƒ¾,ÇrPm}á}ºJ<¦ðÑ>zõf1äþr$wa>ñÂyáÖi|Ã*c·§ä–¯Âä–wÝjù‚­ÈߌÌ4…wjÄ‘Tâ¢_ú˜dà)ùh(ÃF9«R½@t‚\>ÿ佩Σ¶V™’Ãòþ‰.No¿žpï`½,P¯fz0qD¸ÿªI™ÜÉqþÿÎÖñþ endstream endobj 3704 0 obj << /Length1 1389 /Length2 5990 /Length3 0 /Length 6946 /Filter /FlateDecode >> stream xÚtT”ïö.Ý(¤ƒÂ0´HHw#]Ã0À30 Ý”„t‰”JH "ÝÝÒ)Ý!‚ ÿ1Î9ÿß¹w­{׬õÍ÷>ûÙûÝû}ŸçccÑÒå‘¶FXApˆ—O «®k$àãàåãã'bcÓƒ¡¡a"6}(Ò†€‹ý/‚, F¡190 ÍSGÀ*nŽ$,ããðóñ=úÈÝaÖu^€ u%b“E8{!a¶v(ô6ÿzp@8 GDþNH;A‘0P£ì Nè!`G€.ƒ¢¼þQ‚CÜ…r=<Ø s[¡ ¿;¤µ`ô€Çs… aÎ(W^W˜ã¯¿Ê OYn-‹pr‚ÂQ®D¿ú“ƒ!¡ô±{ÿܬá÷ù»°Á­m~ aíæ | ‡¹¸A•åþRÐÑ0[( Ä÷HXXPu@=!vÀ_åõ¼œ¡¿ƒ _0z?g„3À=ÔfEÿù¸‚Ý¡Ò êçó¿ÿ\@k°‚ÚÂàDÿ©Ž†¡6ÖèËGÂ<&|hí|¿~ÿ~3CËËwôúý÷ýµÕôd4¸ÿLü ÂàÃð<@ü臈(?ÀïŸe´À°¿mðý'Wnƒ<úÓ-ú˜þÕ±û_pü5'àŸµ4hÕBÿ¹)ŸýýKýwÊÿMῪü¿Dþß )¸9:þsüŽÿa°ÌÑë/-Z7Úê´ àÿM5€þ1­:ÔææôßQemi¸-ZÌ< A^>Á?8ÌUæ µÖ‚¡ v$óúËjŽ08T á ûõmAgññýW í/ˆúûáŠÖåïmŸî+‡ ¬ùŒ_HF"Á^D|h9ñ |@hCZC=+ä…#PèzF?€ IôëZù@'ÜÍõú@k茄¡Ïãò½ nH$Ús¿%nä_ë߇B=¡¢™)äq¨}Uhã· iž/CxK+ÍÏâº"…PìÓ/}ìÔð3Ç]d,­Ëî ¤j}~>6åËÀuðmØÓ´-+h1E)…!ßµ&sÄ“×wyÚf e¶FÐÛŽˆ¤>[#?LÐfºmi‚cò É`êG˜H»ÀfùFÁÏf×MãG»'@ÑW2–T¬tNó.V´ ë ªßÈ”,Ži’榧ütä'V4,îB¦1†îÒkÍ$.½a¡7«»+Uàä•jÇ;á²pJ:*o–œÄ:ê„,•:W v¡¯²o’ãïÑ:…³/b;UM‚Yã:éøœÅŒöÒ°HÌD¤æm•‘š†Æ±A~ö^q–Þ^x/Ù$†n5"õ’5ÁXà^XdÛ«¸?¡y£ùø™bÍ—¥éd÷áÀ]°kv”nÏÑývÙÜEÃh—#¥[šWQË›méñÎ °a³»ÚåBrcƳºsjU$¾Ú И‚Ov§¦²tÏ)(îÈÞs<6ܘÎP<ÞÝÄ š’ñ¿ÀgÜ5ÈÄ}÷C~ÓdEÝâJIý$r Cø 7„rÅjÖ9gÉØªV~”¼% ÷pÀ1/¸^³=Üÿ’$F±Bw™oÞôÚ8:z¢À@ÿJ-ËÄÌÏù()»±/cÕ¬ƒUé³øåm `è.1Õ=ˆâJƒÔu2“÷¬®àÕ4_¿²{¸T–>â•ÐÍvÛêÕe½ÇÊ·Q+H ‘4êX(ÿ˺‹Ó}M1{¼…ÄìˆNȹñèp@íì« R£–{>Ï‘¾ ÝX¤gQÈš¢6;WÙÀoái» 7­öÉwÑ‚PD²×Ê[ê|àtwg2¸ëa9“Q^5h¥ªÕòfΦŸYZs>ÁRÚ“‡ß{bÀ‘¤m^øå|¨§ŸÆ|eOÎîì` ÄÝdÓ<ü8Œ÷äÖå5Çòuñ~úMæÔáã 09«ÀUÓy±o,…`ªçòùRÉÍÆ[¢âPò7E±i/ÀO û:ƒspag»ÏÆt6ÞÞ'RQªý ÄT3tW¬‘F—µ*`”ËIÿ YË‹Ãpœ˜!‚“ÞSÍqËÅÇPÒìD*ò ‚ÞIý$ó“;¦³„öK触$­½]©“‡úøš|A;®½«šcÚ«‹EïMßF†ã%å§U+ vÎ nqSb}*¦fRaj€B^¦ô³¼oŽ¥:΢УtMAŽ\Òží§pãë?qÝ!pQv¾}L|„“CΑÀC.* †),. íLo7º›sù³I¬Š§zW~®€»ÛÞõ¨>›½5—^fL¬Ïƒ„H/¿>Ê nŸ¾÷Í%¾¼ˆÚ²ýj†ÕøKsß5˜”ÍØ6Û –2ÐÄú·%£Gr4wè¤&WoÕ ½—ëGt†ã¿qåpÐŽ XÇ÷¬3´Ï.+Ür¦B†‚@súdU¢3QNÙK­¼‹&~âk"?Igbåð¸ÔEüõ \ss$•/+úbcÞù.ögÑ~ý,wûYß~î×M\ÔÃÍzPÏÛÝ9‚°íΖÁ=–)ÃGÂòÄ·™“wÚØ9âTšÉ†t=hY†kööKW†>2–,çTã ŽT‡…§ê×﨤|qy÷´Ì¸#tÁ$SåS“¶*aL—Zªè»Õ°ê‰|º'|±)½Ô߯gçlñ}{+*-õV¾8&S>OáOËÏl˜ŽíŽ8*»uw9»oÛÓªË2Ä(è aI_á“39AÓ½¾pÿn‹¯ s`Í€áãJà?}±òGK~ßõv6;äý õACá2ùAò¥3!‚mv÷7^FWÐ!ÇÇDúÊHG$ZƯu—”cƤ#‰q”¨9#|¼Ž­WeÜ™¿µ]û(­¼!‘1sâõ›ñ­—Ái[Gqz 4”e®¹8ì.ŒÙIúàû«ßÁT0²éÖøëdZl6"¨Kë}.¦)þëÁ Ýô/÷J)=uÕOЬòς۸#§o½ø`MÏˇÌT׿#3k§í=ÚŒõXä|cÃp˜nû½•Ⳟ@¨ âÊóüÈÕl'æAtêi¨‰{I.Œä)<Œ?#Ò´ƒº¢EBøÈ0dv%^aŸ-`ÖúîVfu©ËÈ“¥Cz|?¿×Q.ò4·‡’K½¬ ÂÁË,°+o×fÕ¯Ý2ÀwœZ´× Œ½4YÐÕW#ï¦ 1¥¢xüôY·êÔ¼ fm‹>Mæ_b7MP .L 7L¢g×Ný Žû'Iè1¬Å;ÈÊ#äòa´(S‹ðŠÂÿà›Ü¨„Á¢¸ƒ[¹Eü`Ž\üC}þÙF !I¹3µoÖ´n"a8bþl=Ï}¯%t€Ÿ– 9Y1·”?¥®ò#hü³ÙäIľI“Q<Á*ZacaßË{—–,`#š;åxµmòC]'“gû!ß…K8uÆ£¯Šc»nx\±7VëÌÕ†¸åeÒF.’?MËäÏt ’ÕÄ“rh¹nŠ]ì¶¥Ô5—x9Äo¾4´,ÆéN2dj¬*àôIu±r³¾DdÞàÛ SŽÓ¬t…q K ²ì’®›ùê÷;}Åǵ*õ™òKÜŽß*-iwI¥/yr6ugC.!ßx×Yÿ®Ð<›l¥AFKÇè­c2½7ðÈšS.~Á5öD¿‚t!ýAÀOV,P7_æE\Lfê3ó]ãÉ”‡ë5Å^ñn‰;O¿NÊ*È~‰¸ÕqÄôÔð&ÌQ›Úc޶gæ©î˜òh‘ÜÔ´¼÷ +òžó¥D.q,åÚz½—7Ëˉê;nä²ÂiVÉUõ+w[ï€/0q#œ?Ò½#mYN%fb©2‹:O«þ€Õ;츴?M½á_/ÉÛÿÐÒéò¡—"ò]´âëàtÅf!2\qéúóÝiå §EƒªµàW¦!w:÷˜¤óʯ7ÌHiJMÀø¡ä,ì'½[‘»µÏØFMar ?O£¾fúL Y7bOn—ÍEg EJ LmÑ«¥Â¥ °¥žs y±ã×Ĭà( ƒ>²â1z¿Š¾z‹9Ôó|½SIJ#,icP^ç×Ê nb¼É!uh LX—»{"üùU† R$…êkß™æ;·PÃ{v[0“‹ŒûšI;BZû`‡Ûw.%®ám­™2áJð\Éæ§h’Å,.Â]8:KÏòذj4„úV#„÷&,öš‹l’±K#&tκJ ù]îáÁ1B}×w%­e[4ÚÀ./¨sÈd$÷Àx>^(–ϸn9øLdÙÕ¯ˆÓT%49›Hb‘àŒÑ]“ë}BøÖnç˜ñu§IYNåÊi‡Ã¤lÚs©Ê cå61É–š-ã²ÆæOõSþêÆl:ÂU[ænñD¿N©5{ß"‚Ç«YšÞw[kÌ_Øuu¯¶F§& |n`NRð·•² ýzåsvîf÷Ù“m\0aÕ7°ŸYfa#â oEÖfÿa‚M[Ô¤ë*ê¦vH„¤6ÊvWÏg\(ÆÙÿ¹J‘jÎc2’ò„_³D€ð„®pËæN¢!Ýû÷êçKKßñä5 0KÉã^WG,ÆhÍá&•G+aZ=~ ÄôéèüÝÇ ÊýI¡viõëûK£XïFu1uíÚWÒò«KîÑ .>3I£ÏSõŽëÛ¥µ Õp¥ÉNT‡ùiät$Ùz#pÆ‹–¶3tî^b%¬BÜè5h>Ë`9TË(úf—»·ýPÙ3âêóZRâ³æÍÃ%Vì8épCA½M£Ì·÷ØyC˜Œ|¾º Ãí›ÞÉÎÞG²·Ð¯Þ*û¨†ØU.eh”SÏ:Ò©{˜ò| Â\<‡)xÇ«¶-›ƒÁ³o`3”šfHLìc*#ÁNz¹„/Ó»ú! 5ÙúlòZ$*¶9úïÅí"fN o‹Ì°;ßÛ$_7U‹ýðJT#‡í@•ßÓ/(Üx:kŸ'?¬…©k¼>Þ¼†¼Ì :`°5¨^£TMg¾&;nzu³ó´³LÉ´õ…'ŠçÛá+Q¤›íy¶Ž”ˆ–6EHãÁŸéïup£ Õ/…ƒ šf˜'½1Âî„TOšãpHµ­¾× SQz„þx7|¯»q¾´nƒ›Mp2MöºœhÜ#áüA.•ïr]²†Ð=ÊC’^?uâû¥ pj®™Ë¼µ¸/@àU·D;°ˆÞ$éO…'g;Æ1ðìÎÀ y¡%ôÈÝ•„™†u,!?žýê|áâ14tn’·ÛôO?F¥âÐ1‰C+ ¶;ÙÖiÕÇ™J‚­.ã*U‡æØ_!¸À…™ƒ:–«ËêEH"‹h:ÃAö‘°z{ÙhMXÛ(°Ü›Ž·½ý*Úò\ö*÷º]ÝÁFûY½•Ÿ»dA0®_Ìagˆ9fcuU8®ï3öX:ßž¾¦’XtyŒ½J^[I‹ˆÃ˜GBJ¸~ð.•œÄÔeñ]RÌ‹vå·¾]ádu}Ó¡2¾—Ç¿wa¾ K"í8+z— ÝQ™ß¬ç¦ÍÞ¥‰ vŒ7ÎS?-œ­‘lÓKÒÊr®ÈÊQ~óT§µ"¥?Ðf/Ž»!9¡9ô%¹¥‡«Ác¸$xÀëÖÇ´Í}œâªápÎ?=xZy«šáZVf³QvŽèÝ>'³Qž(6'-4B—?QœYoäø*ÓÍÄ÷޽ió¼xYâ÷ìHq“*\Œô½'¤'œ¢AGˆ¬–yò@ÂÙÎ}%N[‰­6Ÿ¥ocïsëͤäýõjK9ίg #)ÔDYê]µ¬®ô§¾Î¿×AØ+ý„,¨Ëª»¹Â³ö´ ±ƒh÷Œe½õ*_+Dß+Õ˜ŠŠ|×uŠ2Ñ\g¥5Êïçáå %*þ#ÝN‘TJ$ÌbkLWýÎ7*´Œø“]-mØœÏl}ù¹Ê­Ó*žÏÕ{–Iž•úr?JÙ±Ò-‰¹O§·:+Wéí5y4„J/q1õ+›×²›’[ö®‹“£¸Tç¾wæG˜ö8¬óV쟓®09VëBÖ|‘×ÏMÌȆÒ¾k³G”F³Ì‚_õ–£Ê²Î›ŽMªŒ:Aõ‚µ3]:ãÄ>ùI,wGÙ(hxiCü–ˆ¦ydú¹C;ÓoÖ^|ï†Íþ bèðÿR/®.ò>p&¼×ñEûþ䈬€ë:†«Ø _Ž_S§À §ï¹Þ[QÁJìÒu.=a²×ÅÅ·¿fMÜâGÔÖ³är¿#ê¶p‰a'ï¨Ó$³ÍêjÛÖŠ¨!¼fd Ée–Ñ/Íj{´lŸHsë*)&Bÿf_ˆY4*)³Þ™l<'îUSÓ°‘L!™|m78P=ÙäzøhW]­e¿Ñì³nIBÜ"'{æaAiG{öXá,U*gI¿íㄵ;Üÿþá)±¶e;âÎÇ ƒ@“$xÒ±17yïۘij`Uœ&¢%àÀ“ZéQßj,EîE=™èíl£éRÍ©cé5™Žíc>®Ž÷(‡A"€µa‡þqz‹èúÅM¼v¸F©‚vfà':ÌL¢)G±\°æN‰í:¬yÑ=®ª<ªe6 õ2'¬ðV“â¡<3,‘:¥ààöD/^ #ôE0¹’$¿†Ä2DÉKNS+ó7ˆ.Të‘Ú|ž:P#¾Mº?f—Aä!sJp»«Ä:9òÙ÷[O6F¯Þ¡ú.ïyi ú@ ¡Ç)Æí>z"réûyÖ“›•¦ëæ’±ŽÆݳI‚R,Žíëcœýí˜ Ö8”ß±83‘î ²hÏ«ÎHÒ†7娇,ñøNÏjX)ÕÇ»öoýÞRs“Åk•ÛËóæUO~3ü@÷²tÀVTU‘Ê š%h qæ]dòƒKÐ̳i¯óí&f[5áÓq“ð« rË>¯~(mÓÍý­¤£šG!£–†KöÅÅX7þ3Âë7Îâ½;I”«í $ö”[Uª‰™ˆNu~dµfmâÒr×2Ð`d—³Å’+tNé€Î¼K‰ðÆåzŰhWm«¢O|*ŒNü‚o($¯„6Iˆ»US´íÎIŠ?wÝ$1g›7t†Ó=ÛÊå57‡øQ3òº—2-›Oe)JÞH]T^ ¨ ®BψÇRÆqb|¸NváÝžÔãÞ¯Ý[Sh+‡7^ özÍ• ´Ë'7ž–-‚Ï7±frúÜ]T-V³[/Åy–Ëæ>øoæ?äÙíÄ.zc3›F nQLa€œ˜!í×á/ŸK­)1»;FÁmSÄŽË ˆÝîQ,:°ÓŸÐŠË)_°Úžûvz¡Œ˜]# ä”3Uh³ ”½Ž£k„ÖÒ¼o¤ëd@´ƒ3%}vŽ•Æó§X–¾zím2_—Iøg·vxm´'b0¥Y85óžÜžºëp`Vp/¬Á­\®â«r|úQHP½úñ¦Ù|ƒãÀúÍVòNNm±á(²()6ƒž±ªÝO%B°‘(exo4˜ºï…–àõG]i–ôdÑš*mÍ=¯ê4˜xõÇûƒÖšX=Û“¾Ö4«FyíÕê}H¹H´üjog¨?7uÑt÷^:S“Ág¬jC.+öQ’ÿzÐ{X endstream endobj 3706 0 obj << /Length1 2416 /Length2 20868 /Length3 0 /Length 22272 /Filter /FlateDecode >> stream xÚŒöP[Ò #Á‚ظ»»»»C l\6îÜ Aƒî®Á Áƒ»ûåÌ™™œùþ¿êÞ¢ Þ§íéîÕ½”¤*ꌢæ¦@){0#+ @\QC–•ÀÂÂÎĆHI©Ûÿ#G¤Ô:»€ìùþa!î 4¿É$LÀo†Šö9W[+;€•‹•›…ÀÆÂÂûCg>€„‰È Ès°º RŠ;8z:ƒ,­Ào<ÿùИÑXyy¹þåµ:ƒÌLìŠ&`+ Ý£™‰-@ÝÁ {þO+0Ø‘™ÙÝÝÉÄÎ…ÉÁÙRˆ–à[Ô€.@g7 9௒J&vÀ—Æ„H а¹ü­Pw°»›8o[ÐÞåÍÅÕÞè xc¨Ë*”ö+ümÀøws¬L¬ÿ ÷oï¿ìÿålbfæ`çhbï ²·X€le)&°˜`boþ—¡‰­‹Ã›¿‰› ÈÖÄôÍà_©›¤DU&oþ»>3g#Ø…ÉdûWÌ…yk³¤½¹¸ƒÐì‚øW~ g Ù[ß=™ÿ}¸6öîöÞÿA {s‹¿Ê0wudÖ´9¹e%þmó&Bü#³‚œ,,,?è­vÍ?è]ëzc×þƒÞØuþ‹xßt&ЛÎôz«ÝÔÙÄÌøö²X€ÿÈÙÿ+ÿ{1þ«x+Å쿈ó-˜™ƒíÛ4üGÂÁñ—ÄÎîá_cÂlþøF üs0!'×·}úcðÖ‹?ð- …èþKûr²ÿÝþäüKïàêüxo&–ÿ€o­þäûÖT+OG+ ý?,Þdÿ dyë´õ?à[;mþßZðÏäßúc÷¾]pÌÿˆüv¥2;üá~³}{tÿ¡~ËÝñúÍ×ñíݳÿŸ“á`ý·ôÏ…ã-IÇ·kÊá~{ö™þ Ùߨœ\Þ.Œÿqdý«Áÿèë[ñ.¾ëbkâbõƒ7¦?îo7%3ØÊøxKìîð‡·®ÿ€o sû|KËý§ûæíñøÞóð­A^’{‹ätþ›ê®3Wç·ÿõ¼ÝAÿÁÿzà@ âÏy3þëš¶»jQBwÆq6”‹È+xímI|·]Õ qûKö‚¨EÑ®ÙßQ÷똇l%¯6:8,6Fk>Q|8?ëÚ`,L·|&1]\Ù~Ëwvê}d·7·Ä9mRr¿™¡Åep:ß™ËÚ— jª¼ýfu GÝpÄ„ 5‡ÇÃÃŽ Ò.šÕ^)ö]tf¶C–ÂåBdü8éƒÔþ}FÿçæÀR$h#ƒðàÅQþ*ë@(}¯‡‹@þã$`†r»Gï1ž&èª-$ÆÔeT]˜œ?[v{òBæb;FVͲIfpº? Z|=žìlAô‹‡)õ¦?]§DIKäÏ"/vN겞òri,A)¤¾E©©£¦/ò> ߇§4\R²g2ŠF2±TÔ/½X§ÌF¢‚cA bí¶üÕ‚!rbà¬lWƒ&Àß5 ÛzÑd(IÑ"ωɃ´ ‰|¸&NF¥yAyØi£ÌmÔÌÍC˜‰Ì‡ßOð{ÍræY/ú´G¢Œ¥Ãûæ{"r¾› »)9š@«?¤2–ãå[î6„ù‚/Z7D¼ñ©RJ'ug®³?FÈ"û,ç»`L,fž›·ˆF _Cj Âñ¼ž¾^3Sm³Ï´Ó^?}Ðü>j‘‰Tî;‘çcdÆðI¤"Å;¼v„«ÇïtM8RN½³¦¬¯Öíš"¹ö TKFq^£˜ÿ™ä‹ÖOÕáCˆÕ=x6ˆ‹ò v®2×BÈ’‘ñ¾˜5®~5m›Äß¶ Ry¯;wz¿“) –ÀY0™b^Ì •oø·¢HÏ 7–mæÍ’É“b.=|)˘Èf(ÕÒuì©æ.ÓA¿çï“æ €E‰Ï¢GC1¾?§ãF@§ís¨òîå§}%‚•΋&?AS¿ ·Îà4'”·œb†×®ÌR§ÆZʵõ×áܾÇŸa笾U~}”ãø¢NÁm½§êØeUi¸CS»>;Ròð*nlMîî‰[ Gªz™ D'-­ù)Y}‹¤d9ý¸&ñmg>,Öéä|É™?ùüF§>·$K¢Ù]ϼÄ~Ú£•ñ›Œž‚†sÕ‡)Yíö$ö㢴~9¶ÇÄ"‘"¯ Uà 7ž%<àBÃeÒó4x¯Ä9v)QÊC‘x›ÜØi’õËisæ¨rÃË˾À ¶‘›Á¯”kIöÚ4Áï9]eqÖ¨¦™È"ZhW·Ë Óî a:ØÙH®¡L/öKs`´P¡ê§Ôý”¯K+ëQö¨’?>ï[­ë¸H‹’ÕnQî¢% Œ¥‘MY´ ¼ÖÇjqscVZ‘ç¦fÀiLLDæ‘ß)ˆC[f϶¨©=³ç/û*šù~ì¹HM(|Ì.­2`¶š²w6œ÷¨å%‡ÌáZû&LöSÜÙîCBì¼1/ÔÚ0¬l(-Ð-:£+ŽNäÏ„±úÈgI¨jù¹p׬´ž:ÄKÖL^)AwN1XÖ–…¹ééi(áU†(”D÷ö$‹ÏVu¿b>Ÿú Ê%`˜Okù\ÑÀÅÅÉ+¬€îLÎÖx ù #–þÒð¸£ÿ‡NEhMôÚáb_÷‹– !²&*.ßèøöFÌ{ÀòÅGLç.ÿ‡KœÎf~ëÅ-¹àú»Åf‡lҨݲbZÏD&#,ø©ƒ/¯³F–J¶Z|ç!2H+4…ïH¦¬)˜âï°Ä—q‡…¦ïÌ·1ºtó¼zØ“Ç$ŒÈHhWË<K…˪–\Ê!B]$BðÀ•ÄœDpòDww³ONfEùÅZE釾¿ûT–Gd©_Ô$­VZ¡‰‰Z íIO |A­Ñ¶N2Ô…‰B‘Plר©ð5K¢Ê¶I!l倪Bò¤XdýV‘Ï.]$ùÈ-à‹Ç}“mùãþi|¾?ÑÛy™Z·Âêü´µ¸(`|÷YôêDY/ðBURЪ™Ù^xêØûŸwZK˜Òf̵ÄáõM†1 å¼j›d’Yâ\³·±¾Oª7.;D3ë~„£¶¤å|ÿ£lŸÏ :È í‹n²³t;iJ³'€÷ûœs¯¤Yö^I½¥WYåšþD:…H¸!R~ŵÝÉ+•«ºsm«º>ˆÅ±v/C)tlÙżN¯åÚ½ß ã>dâ’Õî¾b¿³úÛ‹ö+Y*Ù©/Ý>q¨ò¹ʧ»·_ÑÛ‹Ïú¹uÞ̃ rjƒøÒLjP<ƒH àðuñxNÚ.;5ÝgU8~¸æ#]XÁm =Ž_íÃJМ#'l uùïOÙE@þôÊSâ| GÀ$(DF¾d¡`c&;†@{iá_ü…+„’Vò‡é*ÏOëÒÜ`.¸D»SìÌz'øIUFq”1—TùÆÙW‰ÀoõA‚jì¸ÃØæB¤ºË㱇¼­Šáª5°ã)ÌZs浕ð«=ô/b»+PØU÷ÚøTÁ²ç§A+D²×ŽÙ¢×ÅXVtÍ¥€^m˜êÞ= ‹c´Âj M›m¶yiª°ÍWz+-ŠRc Ëb…ÃÅ×çwWf^¼Â§Fu3žOßiø+òؾ¯\2.ÞùqÃí7D¿;pþVL¥š²À¢ß‘9%ªh˜c1§ó[¸ÁÃ8 Ô|—ñûÌ^Sèá40…òGÓ3ÍT—†p~pÆÓ{V…wLuî £ “ÐO¿d¾•¿ìß’‹Ç0~´$À…«´X¥EÔHª‘”õ ÃfʺJ¾v–"´DšáÌèvá-Kˆ«C% ¸š”Öuî ¢˜Ïû 8ýr©°ÝÕ÷¾'ÉŠïÐú!KbÇŒ(ŒÇ†ˆéîÄö¸ªÍÇÖ#¹´–¹ünå3?u ›Š¡Â†ýíÌ÷Ù;D[ƒ>ñ§Å€u¾‚”è,jÆ— ÏOØóœÀ­‰âd Æ£dÄÄX ûRjÑ×|¢”»>–|Î{’–Ò·oBqt¤æXÈ'Çz6¨Q¿õÓ‰NçaZ~9þæÏSáërlõÓž†L¬÷ð[ÔÀühj–Ý]ƒ’LÅv0Q\ e×ÚÀÀž½]Ðs2ûh0Ïÿl¢Òy.ZÍ[ÖˆeÑþÄï^Žôr[:‹ÿ夺Ìk¨m¦xgâÀ 8w ½j“h&è5xvm²}/óqî#nê GÆâDÔ:¦ÌOi£,fj0¼ö«öóÔ§ÝqW"N:Ó~h8<Þ'¥Íaè˜:ªÙ*ߥFòl:øÄyî‡PÁÝ0fŸ‡zñ"¶¬€Ùmœ.RwÑ´#B›¡aj Eõ© ˜Êv üòf!áò½ËoŸF;lòÌõ»ò(Bkb(ÒfG.,WPWBáì‘üE1@J¾À ô^Kšµüžk¬T9¯ Õ„u½ÂGW’] “•´l )úÔ c. bŒû£nµò qC+„_1÷×8§øJÑî4µ4ðÒ.¾°øÝðÐd׽׫0Rœw³aöU±q*×F(QFöºØ…ȸê»ñãîsáû™3J™ x‹ˆ$CcLd²Oóœñô¼’“Ó˜l}p£MC¿ÅëÎb•›õCkç°*gîP.¦!,ïÃÎDÖkÙ8Œ:¡;æŠí¡ŒbxÖß³ê:+Oß¼ù*àÙèqh¾ó¤Ñ–Gãñìâ P²nÚ7߈½£^5ƒ]ð ›CÓÉYhË;*w/¥v Km­“f.r#ª½Aù­?¼À´=UU¸O±~¶^ˆ—!ò '‹Ðç;îdzýE)÷š8ÀÑfÝÂ:’AÕnG½¶t3¹ã1‡j{Ä<÷1UO²è {¶ºž¥óµšO3\~R&‰»¤ù°¢ÝNrÃ殺¶ìo cÛ òŽñË|v·6±¯µ{eqtÐg¸'4ýÚ¿]wèR}¼€Z‘¬p•È—9U˜0…Yh´':{ZN.œ/ý[>Òï;è9ôàÁBHû²{QôN,%D}ÿ,©ñðKÉë/ÃhlHF7Ü’BhÅ=HôðNì“—z#$è`%í“çu0Œ¦2‚^_®´p¶ôT…ÂàÉëîÂ9¬­Š]U Fìér™£ˆ=ƒ§Ç<ΘK1ä¾~¥ÌúlÜý`y6òDøXhW°;MÃÓ" ƒ;¬«¦nk´hoaU¨u`)ëŽAê—ý¥§¡…Œñ³¿ª§Œf" ó*9-ñÜ+¸ ö”©t$ ´‹t"äá‘“ŒÿÁÛÿÙSüjYÜÔ'j²ïzckÿ÷­n,›î¤äÂíìWùCuÖ‹öôm9Þz¯Uí.—‚‘ä s‰jx™Ì,óåìDëZvJûgj[D¶¿¼rñC•Ú{ƒUYNG¶²§Ð¤¥ˆî2çv =ÁTïófÓBcËp]í;Ô§ˆªaäO7Õ ¨N©¢Ã=I+P‡ÍûJbe®ð][ž`´I/CÇŠæ¡âd²¢ØT&ážÑÄ©ªYæÛ}ÛUª¬Ý÷˜j~qÚîb¤W‰·ö†<ô²œîº†2nX+5íüšdƒé$WÁëÑJøxÝ+0˜Íg™¡«t«°}ׂÞzÙGš\qô ”c«‚ÏÕw€ªÖZ·á` Wßr'—ê ®ÕÍj©*aµi;“,˜Î»Ð:ÁNް'²çÓ¡i°Ç¤…&®B|œ6†êm¡Z¨æ #W%pyÿgs ½,Ní@ øŒTÛß}à¤ÑNTi´-@aãj«úYoNwJaYùüká­§\…j-Q— $4…€Î`›µ8‚2qõ»I|Ô¬’×ZQ{}Ø©P¾®„8nÀi¡MŠ%–ýo{'âÃ4˜ðrD+1®ÓZ#ëæý%"è!Sá ÙŠDåOÈ¿®6•åJÎn oj_vcœÓfg$ #øByˆmš_Ø„Ãð42Þ0<¨~ÕÝEm~Ü©“܇‘ë rnÓ3EÀùQ­¬>À?ëç$Åk6D~÷µÜÌ, ¿e>£Ã\a°Ð”e u¤#êó/«~½…³µà÷rŃ!ºYé2$©¸Ÿø[ÞüâÔ@[Y3;CÖbWþ|Õf¾¤]Ú¥=þ»&5é­×1ÑP`MYÄ`á>[†öDyþ´ïp¥S€J!høºGÒ{ìüØAd$Å1ÑëŒYþªÛÅÁH_TÓ×-v”Ž|f¶å¸pZZ#¬’•w7 ›ÒÔ_QY¬Øjý‹×š ¼þÔÊA¢¸„¦=K’©[æî~5húIY Óï<«qdɼð CÎ`}{†LCâ*ñ\Ü6±9H­a2:¥ "½ÙÆÁá4Ëäª_t넟–ã᲋TB#Å‘ÄCZs..iæ$%–Ð{V¦O ÔÕÇ!ÀʦeŸá4™>^=¸ Mõ_÷w‘DÝ4€Ë…ſ֪XHáß|AXa29N¥']\ƒ”0í¾†'Í„•,õ øiMyÜ4¥{Üßs*¯ýœÈz‘ó+u7Y×,Ò‘ËÄëÏyqï.Ы €@b4S‡ö÷yÉòeC†¨rÕ4Ž5+éëý†ONI 'Ó}É_Áwp*n'“ßPÏ.ÑZ‘OØc—ôŠ:Aó3+áÝ·ô?Ïh b;ÇCUfæ@ªÃ¬oII[üì×<ˆdß%iêl+¤!¯&j¢J“G”+9Y^OÑŠ0ÕNòVÚQ'g6÷f+ט¿•`Ûõ.3ؘª©­¦Ò`+(-7[(ëµ/3éÅ¢ÌÐÔPÈçãëÑçÑa)—]éÛ‰¥Ùlïm¯É\œ6Ǹ9B¾3NÜ)3#Çèv’•¨›Ízlk%ä릛Ž^ß XGŸ³kÿîRÃ}÷(tõ"™‹júÉuØ€Öûck½†6dÿªÿM í»¸O9à`1ìáÚƒA±Îi¼"¸'›Ö‡‡xò÷ŠÅÄË.a—ŒñM0[4¿aSŠ,«á”ñßZ>#T]嘰Áx<ÅNGÌ`S…Ûð–áÚ]ÏbpÆ9P–ÑUJDÁ›°ª-c<]¨Ðt¹'û±•'-4÷´~_6ð0Ñð…5:ã ËQ»#æIpü´µÂÁ+ÒnFsœüÖûe1Ôù˜`«Ç4VñwÀ4£¿«„çW>­Žèçã\IÚ}"èºÏjës7ýP¤_@Þh…«ŸDöÆÕù`hº° :#UÕýc‘.ÁÒôÞõHÎf¯Å!rE;9KÉ3­”$™¸4 dzÀïï? äuiÔÄq&tWëMJ¥ÐËÆøôî .ðƒÌÊ!o+ä._«sÃ_^ÚŠ›KÂåqÕEŸ©¨Ú¹©–¿ LÇ©æšv:gE3ÉÐU.; {›S½}hŒ.ëeXlô4niaˆ.âäß2×ï®Èˆ*¡ßS|Í‘GLyHüxäM¬ÝÙ¿Ç<—ýýýDÄ/lgöõò_0d±Ý"U5í¬&Úì¤ôJ ùÓКAºz/âÙ•ûšK<î K§ÏŽæB43¾ÕéÆˆLÙÜ \hÇ쫟ŸõX&hàÎÃu™ƒï º‘í^‘Ågõ?ÍNù®r Ô{ʼnQ9^ǶfÃÞEr‚‹i3¢T´M{Ivå üdêÆ ~Ï-4SjúÃJ ‡~§Ÿ·½Þ]þ–+Tf‡9ŠC©¬–ï€gÄDŠÔ‰¤ãï#·žý3No ôZ8ÅÜ VænåÊ+=‹¼,ÂÏ HÚ÷ýÛ–ð””ã€JôíîGo©zOƒ#±ÖA©Š›úw dY¦¿£‹'äQó×óõ³|” DA~—£;¢i,[44‰ÑñÌn ³ÀmaBêVä¦è”¤ð>0ïþ3:PÈ€­jõµWu=?‡n}¾M\ © úr„fªA³xÜÁ ªI‚]LÈM”UruÜr=)=ÿ™Æ‘׎&óŒi&&+Ž•VHü3a<|h>’EiRì¡ô7és'4þg™±*ï˜Å uoøU6)3¡St–¸1ñvh´Ø½œ à¢Å¹24G¥Ò»?WÊå2úÍÍÈÜŽ$‚´zA|4Êóz;üÒjÒú¡Ÿ+sš²îc9˜¤’ÃgÿäÓĵÊY¨ûF¿^Gkqåž{îÙ›Í/?'%IY?sÇoUÈŒb˜\(NÓ¹†"cβDZÒÓM*¡‹Hi!EßewÄ ‹¬Ù_oˆ@µ÷h%Ž&“F±æJáâ(Nag´LèþÌ!ÞLø‰¯¿T7Ê©Ö8°ÏQ5* a¬äKÖ°%¸$1G…}J°ÐšPÐlÛ›*Y~·ÌQ¹dwa+WlæŽ DIÄ ©¡ådXWðXjƻט‚—´t/6ëÅãim/Ë Êãü¡­Ç9gPpŒÙ¨¡°xÉßþ-¿zŽOÌ=Ow4Gxo‘0/¨/ð\x¶ócÝqÓð±—/ŽÃíœá¥Z7¿9Ã$\ êDsÎÛ°++eØÈÊ4ô›†WõLaH¿È&Êh!Ÿ±£ÞSϯ;ÁÉíÁèÃΘ½Ëf¡°ö(®5a5ü°÷ »ööÃÅËz%J4„ÍÏžÍZˆÐIÌ´Ó¾e $åðƒ};PžŠš•âC˜lm<_Ìè J,zÇ¥—1¸ýöÀÏ=AÈÞ8æ&Ø8}ŸE¿´Ts ?˜vÒ3Ü®Wx†® ¤Ãøò(âÈéfë¢/ňMÊ2˜Å%«/tÝíñžÓYÓò –ây;dÕÙ!¹S”oÆ´Çr!>ûð s¯§(é2Ûþ¼&Ø õ¹pG59"ÀªòÕÁ„€Yºyv¸ zðR«T­‹lû±*iâCýÇgˆ_Ḙ¼4pëPCnÛK¦n9&M¥ú@¡ÝД|9ƒÞºH"Þ[†Þmïëú?L¶ç`_xñê¶íÀÕû¨û ÈëõÅ>øF_‰ÆÂÕß}Ya ’ÍQ0 ,øüT;ÚpÔ:iÜD~}ÑCPˆíïÓ‘à¢ðöÝHUÈoízºû€KªE(ý.m»Þ•–Û…,fxÆBíÄŒs>gû¤•Ö Íµ¼¾[»É/Ã, ÑR¸ˆ.WÔcŒM¨aˆrsáùpÖ¿Š”?’9Åä&‹m7«tïÛ×  p¸ó*îDfwWM’=->Öp ·œØKážWoK¯²aþêkqK,ÃOwÀ¼õ $ÆX­\>N›ÉÑŽ«ÈN eq¸Å†œ¢…I.رQž¿›ð ÙOe!÷ô‘¯z‚è—ö‚—ûÅpi75ïG;Eü9é^,fëd]·`QýÔö}„ËînY÷=HÍ¿Eò^?¨í«:;(‹f^>Óû¨ì³‚ÐÎS·}vÝ–qñ½‰ìº‰bXwFFö<š Fõ娔äĈFˆÅiìtÔQH¤´M#øøV¼s Ç6ê}›ÑOa@Y<¬Ý-E”é'_o-²Hì8§oö÷ß ¹Ðü$³<ò)¸ T›+Œ£¾ßKõ gGRv­yDÑ»"—²a0^³u&$L—úlž›)r³8¢u(ûà MÕ(ÌKSÿØ{GM`QÌÙ£J¨ˆ9s“¿]O`töþó Ãxí¤nÅz~*viMæW݃Ç.É '6-^Ÿ‚++‰IÀ§ä™&Šc%ö™Ça?-ší2*_u¶X0e´ìÈ,:y¼½–ãYÑu±n^¨ºÇŒ=Ò)qFµCà]V!½VU åÄÿè[-¾ÿq gn~[Àt|‹–/+‚|w@ÄûîüÇ~ ‡3AzðE/á·aSYÓ› óŸ?Ò:+ñò.›Ìn½ûÈf¹š·‘Z(¡wÈ×ðØ0–æ„€ b‰(BòSj•Ò€ƒ5ÈlÆéò0KæÏ5yå$?mÇ,Q9T×Óc£®ÐÂ{ù¼bºUègÓM>êHÜ®D¤R°ïjw—¡;GÛ㮪m…ag²Ø*"Þ Áøˆ‰‡É¸¹PEýÛ^äõ™eùrîÁæ‘ÙyoËõ’pë“\‘ÐP|ÀežmÎ~k&ê̺—–ÖçfÔ>^äp\B-s¼ªšßC°Ð"v©÷åñERè«9†5üYô\Ãïµ$¾ßÑê]Ð9B©trð¡sÉ¡PóFùXïȇïÓ Í‰›Ž×õ/ºÓ…›Tù–ÄÏj½ÈbéJI„ÄQapæ\¤–©Ï:}'Ï÷†Ó’|Ì5û+‰üž¾¥^üÆ7àØ„ýc82‘áô7¹ÑiG§–}—.O±¯€Û³üÌ ™÷Oõ[ШÂÍ^Á²: „P›jgHCoÊŽ*:> ¡'q¹õkÀÙÃE¼½méc>®†0×µrùusæCå÷JìÐ iÚÏjÒ—$Y˜¬æßÃ=ÊéîŠÇŠaj-•V©ëÄ•.MVÕLZì &¾Ö³cïÜ ‡•Õƒ<¾Ž¸X]ƒ½·¿nÂÕGgIE9ºFhÍ;Z¹”ªÉ±l¶]EœV<úÉ §kƉèÅ kDÏÏýŸºmè­oÄ9Õ?}(°é®Ý9i(oÖŽÈ+.Æ~@:†¼MÝ…×w‡6Q#2)$db2o.¨ Ÿt a¸)n¶ì¼ŸÊùX<û=0ö\~¯Ãƒªú`”ÝÈ~hFæÜrs˜IÐObuéùËéXêèK-ô ɬبŽòüAB%^ ¯O¬÷ÉñÒHn„»ÆUw$iéX]Ae-CëAuÓJ¥&*¿øÂv†v•-¼ªâÈf?_–›y§d!sEœéã”´'ãœSDmìgÌDG¤E\z›B ,‚,Nœhp#Áx-YpfëÎ(1ëX$aŠ?`÷0Ñ­³eJ)á;T…ÉÍ'™ù L‚vþö™ÒXÒÔ#yá~c%ùÀ(ond`B€zÚ¨sNŒÃgî:í l.3/â=Q™YR…rŒ¥–èºøgh¡•¥À›8ìŠÇXZ¢<š-mR;ÿ;t¡¶/ÓþdÁ_.´X9ÕqÒê2OPlXí£ª<~tÍÛ¼‚ 6vÀHB´Ý)ÍáÞ §œèVp&bùoT®“Ñ!ó}SžA:jGÙ.á»Ð&rÂè¾’<ºW /³Ï~œ®¾lVç‚íWTiað+/¢ûÑ™ƒ°0Ô£rüôã?Ñi¾_A»‹@®.jøõ¥²&öÎ{²BrÚÏH úšþŒøÔÜG ëv¯ßlF…ÿû=Þ¢ +UïÚ\WX—t±Ö†ë` óIØö6=C+DÿyØä]¹jÚŸ6còwF´wpéAyAB»°%=Z üGG¯™îí[à¹ôŠê]mL{¯Òø—q1ê±å’ß.‰õþ&lþbÃ}æ:,øÌ¯sKÓï¸~ø¦;û­I»‰TlÄ(fk8—õ”#„Eã}¶ÄËøhT¸¯);.êqGgVûRQ;x_jc> hÇdµSdñ’1çUÞŸd* ú–¼­™^a®?DŠœ²w«™½WKFhŸkÄ|–ϸ¤JÇ‚®/ÐÖ§}§žp«|M}Âþ2pÆOþó!P«€°¸á²ѲE|þÁ,ëųWäÚ¶7|7}¹pï"Ðäç¥nŸoçÁ"t=ÎøxMÄ•þ^.=~ú×ÿªº>”¶ oÐeÞ }³#ê«¿hr9]{¤f¾f âE!Æ–*j)cGØû )‘HûI²˜­ ãQNDäðVxiç¤ý! –È•M7…Î3¢i¹ÔxL“fônŒx§ïšùƒt¯‰:és&{¸÷ _xÓ9ëÁ{F< —Ú¬‰¨´×®äL!RQææL°¸0X~“¡Eç&¯V 8J+ñ HÌ•Éú·3ëVY쇴ló7–г›82¦LƒOh™ñ¿‚›tÓ­ö»““bPÅf6C9oh5,àò#SùÚ›[6,È÷f\§«¬T©¡8 —Ag „m„H+ÿß›{%Òb=ªxÕµÅD‡l0î'ô MN­SÔvj?yÃÓjuƒd³\ˆ—< 6wfMep3tñ4fœ†yÔ|^ÉP²Ek¢`‘' v¡Â6·Þj:ø1ò=õ*ðXDtiûÇœóû:2!2²à‰º¹V ;ñjG/(„ë@ðñ6¦NÎz’ù †ÓcùÎ<Ð….ñcªøsr:¥‹¡†—7ôh¸e¬ª;=nÞ»vÇÈkG;Ï%KxK“ä§¿…º-¬`~÷ÎPu¸l¡Ìs~F…ë1Èûù‹j~NÓEæ–T ÍQ¿J®Þ'ïñ3™Á—Iri‰å4»0MD}©9ÉϘº1BѶÐ(e³ÚŒÏä*uÒÙš»Ó»ÝÖÅ«šž#‡]cpUbÅ.c¯é+bÚ×íéŸ ²J‚+Z²õ_@O*j‘Éöý£ ºž¦N¦|ó5:s»çJ#lnw7¶9‘GÑ&‹Õ÷ »±¼ïÜ9ÉÊù– Jy#`Ãú_ð×ä—µgíê '>Ø?Ž ¡ªU⦯]C!-ˆ&ì«€Åó?n¿R:°Þµ°fxA{Lçဵ°à»­I{·V2E‹,b¬º(¶2—[–tÉ-Ô\ìt«‡ÛÅ0è¢óþáâ/Ùï€YQbj<¦Ñɋٻ ± åt©º¨uä—ÏZÔìÆuP)Α}¤Çž£BgyŸ» [Ž#`<_ÛKÑaåm÷!†žÔ4äÇŠˆ–ì­­•Dùg£‹´h2‘öq»ª¤0dvá¶²=KŠøjÚd´FŠÀò5í¯íž«bç]%I•L¾gÜ£n\…±¼UÈ&Äz™~ù@?›Wè)xpÈf·6;@÷U›]syʹÁÝÑpäp2?ÃI6lƒAñVvØrz°ò¾LT?ìYõZqU=Š I¡C„RGÍdDÕ#“Úÿ¥‚òsãuOD*¼KXx¾²ðµ–—{ŽÜo&H+–1ÞàqG}¤K´%¸ÛwÀö3­’šàÖ+ï;褯g(°”ˆBçë¿ls࿺J®™’l©d©gžé{¿BªÑ_½wá² â †q—û«q‹ìŸ'À‹™ããgÒÍâMÞ$\±$(ÿjK^xH7`#ÕÎÑ®’T9.›Í­vŸ„¿Š‹‘•ºé¥vûE± ®.®O nk'7óœ_?&$p'so ÌY€ÜSKÚ–ÃÑ46Š+µž.=‰0ÎêÞè+{ŸmñÙc`½MEº)8µ €LØ ‡Œ6ˆã)®G«­î¤C;°¯»Û¦J£‘u¼Zí \ë#ß:¦h]BN…iKCe–h2S^ñzM`¬×^D´Þ³õþæ9¡ÓùâšÅ%ï®Bм××hßxÛÑê="]^ÀW-ýÝùV$þË:öÃE÷w‚L¼¨’~ÚŒä“iûÙ½´t?/÷GaáQÿ†ï‡«|Öfñ/|¦È%’UP‚Ü´1¿Ê£Ô8{Óia…µ¬¿Úh)|}¾ cµ¶ÊïQ1ŽލàÄŠÊ‘Cæç›SAY‹¼rÅÂp܇ÈmÚùT¯÷}üýú±ñ­B C ÇÝ"Ƚï`ÌÔJð¹q-„Çu#ûøð±os­Ñ¶òÜ#•Y&=Â$»Ï5Ò'’ð7…&¦š~¬h‡®¨‰KgPQ¬ã˜ß¼ôÍû³°l»ç‹]¦ @¾ˆ‚¥‰ Ýã—΢̗‰Ù†eK^£ íòc’ŒŸCL_î@ö¹¹²> _Êu@eZ|©;j̯Èâ,^›£¦8F‡pTÙðÉþhÞXúi;ÓIaΠi:;/L“E›ÿ¥€$é´˜EˆÊ²åó•Æå^Aé#õЃÔ>Ö©Ä…Ÿ_˜4o 9*1^¿8ßGBz5ížaK„Eœfã]33eÕÖ­à/ô¦„’H(K pJùØøí©&ZÛ¤ÇÞ'–híÆ*ˆæƒêwTc›ô0š±4F` ßIé¾FÅõW4ÚRÏÚ8yf_Û¶ñË1åFq½¿ŠZ/¼w懕ºˆiv¨É‡…¾XÁrçøn/ÚózŠ™ ÄÃf:…pÝK,³oi܃¡5MO!®žÇ´§3:¡ú©uùðèWÔÀým™úœP×Ü•Àzü™Ôó*"–ŵÁº«ä:Î…xì¡Óõi¢\»$×øŒÓ®sÏ#(M;éDrÀ#r=,ý¨äµèWÀVã®zïîÞg¨ G-Á¶ÝŸa²½#˪¤¥êeB0:¸4fØ„(ªŒŸ º0 Z #*ÚªŠþ}›Ê•–µ€¶rxêت~]ÓÖñœ*³wŒ'yçd'€BPéŸ;—Aî Ýb:Ã?< Bñ\…:<.Ø\Ûѽ[ùe 1ãµ¢œ<™d‘Ûl‘ YmRuK» uPĬÛÎíFfú+¬©ë(½NBÂПüÁ¶uåè˜â¼Fžc–xw…ú&û]n›É°‚rÆø¢Åöۆ|;Öš7ÆÌÄä¡"6æ»2ñ†˜ú¸½WÆð‘ä²J_Žž}%ÌIò03ÓýSÖO²¹:8_…ÞeÄpŸþtîV–8¬QÁ7Ž ô X'I”úÙÉA§ Aí<ŠäBÐo¢Ð¹à©× Ô¬îcXxKYâ•¿c•!Sñš; ¡<££`ºÚø&¯—¹ñ(£rÝ´úë£:âȳ:ƒ±é9¤vNÖYîD…OZ33Ø}¶Òιç!Ÿ7Bû7χ#˜]ðÈyUÚ£ µ;¤6ûkjÔçÍZ˜ÀÚçÒtIp4ŽYŽÖÕœ´&­ ó¹<š!ò’Šb=¼êöç"Ä©¸%Ͳ;?ˆnXŒïî`Ý n_,yÒ•RS‹Nú¨5µ‹O縎‹D¿™94À´´†Lliy^…ç H+cÄþ}:×3ÞzÏ2iMÜ¥VU–º ˜rñ!âº(ÎpÕ3ÝeâaÃÓîGpoÃÞH ÈÐ5®gg :¦dm‹ÅMO;"º,ûÚê-ˆ?S¯ð¦ZzeÛ:x‡¤}8¨/uïÚ5´oFn¾¢0ÎÊwJ,ƹ6Pgüý. ·~4ŸËÐtG‡ØãŸTÜîr®HΣ"ÈÖ‘î*! ûÂ΋%6Ihêú…ñ“wM:–U}oaXAŒž„½¢ºlÿÁvþäoXÆ'ËReÞùé*£»±(þÅFtIÅðDT ƒÊŠãÉXÒ¢ÎPýµ§îø­jĵ¹–>¾¾‹K·81þœML¨n7›Úd pJ ÉÉ"Ñ™fe3ÂÝìè6³Zûþ-Â?f+Çîñ©å²ÿG”ÿ÷þ¾2…F.‘1m‘–ôä|ã†À8u÷5æqíQÉT»hl‡×Á)ª¦½‘Ïm%R=Ún2nJá0(ÑS7 x¯[up;&D–æÜÈ/؆zñgîòÞÛB‘Ù(Z&ÒóCõøÕ%É£#¿–÷â8&Yìׄ’…{”“qqñ$§V#¿jÁö aÅ@< ðÉMTgÈÒÅf|¢úá2°_ºU·†~JXŸ,Ⱥ0ßÚ´cö}vâ…ÐÌý‚ RŸ-V¤Û¸ðåÝ#³¦Úz¢¦¡û ‘w [4-ÿ9|è½öé×ÁÇŸÏ®õßWæ„ùgVˆÄÇÌoÑØ ÇµkÊ´ÕJW%eSúÑø‘QpX~Q[2ÔTH¿%U±+áÉü&’ŒEТº›bø¡lr ¼wBqÿ¢De¨!Èèq‹Bºem´rÙ¼ëU*ï4Ã7ïùîÇ gû©¹N/É^¯•#o·T}ƒ÷W&Ae²A­>>þÝ ¡D°ò¶Ú¾Pof™ü/õþè§bTŒI¿®æF¥ÐJ 1êò¹‚jKQùÈ•=Ã5÷-¿ ¿ìÆTº‡î­´¥b¥æ¹#ãKÒ¬ã 9_(„³5N–”~©3æ'a¿}3óNxsÆ/†'t‰W[‹r»+‚®$ŸòO>„f2nÓ‡’1Ÿ²)bJ:ÁE7ÛrñD„1çQ{AÛ9ý:âW#Uô½å]½¯³`'yëqÔþp‡á7% }– ô+Ý©ðäÇ>ïΧB›J£Cáy•ÿqL£ø|Þåuñ­÷ùy gþܰz$~)à;eÞL¥Líñôá¯yÌ3„Z={- Šß ðð;¨PŸn`gηÎ7› x¢üÔTWxÀw~ÝÔÆ½g‘Z†ùl0-d±Ø#åVm°µž4ÞYå:°¨f¶ÿP¸ƒ8kI1R÷‘ˆìtoZfƒÉVX ±ûÄw†ýúSÈ——J/’â–TçÙ…Ï„zËb?XVß]RüP…7£dD»…(DZ&MÙ¬Lêg“}Ý ÐßÈåt¾DG¥€º­‹û5§ó'ÔÜñ?ëµ1Ãë;&ð Îú‰àðE ešùhqÀÑOÁNúëBíÉ\q4‡,å'ª…3êÃNÀC®EWm. ØßÚQmwOBÉ*Š„×PA·%AzAñ„]~¨òFt¹ÊÑÍ4yIúÒ €OÑ\‚$A^ùñÑ0ª'DìOT†$β«<4VÇðÝ'YºÏÕ±¥rªb–ÝO-w+ïh¦(,ìÉ<Å—Ø`e¸U†­¿³Üà˜‚ÃKèh>y,)ÞQki?znže‰f÷¿Öt‘8jc6ÊEB0]ãn"­¡âŸÌI¨”Ù%p¶_ôµ݇o#*‚†í2  ³ù¡/¶4êׯ¸Õž˜VQ„¯U\•(þì'½ LVf¶žv{gKwz<-ñ½ åìÙgü§R5íb뼑”FäÈâ›øª.4uB‰C„ËP˜–¯¿ÀWà’ F⻀3b=ꊤÒpCÍWuÍÃ1ü †VÙ‰'k]ìŽýñÃ$yvKƹŬi]3ñ˜ÏµÀñB´|½ŠÀpîð^‰ÊœPõöÇ„ñ`Vú¯·û´î—Šl„:€m YæB«C}jù.Š(‹0Eú¶¾[¯zJ³î¦3zÐeLY5v0h­ØÆ{ØÆ4R¯é²¿Š[Û_€yÊ߀°Ä÷\g‚~_Bk„?׿s€Ö?fÁ/Ma¤ÌàgÔŠNWÁàèDÎZëÓ•ïp9¥Œz{—!úʈn)Œ:“N¯"¸Ü– ½ ·KK“#šÆìšuqdENÖÿððÚXáÛ¬M@'º3ß™æF¬ÚÄ<›£Û±|¥*5´ŒÌC§8V"÷÷(³Òé¹qäÀuÝbü‘ô%÷Ńè5ö¬øB1ŒZбE®jD„üAâ®·Ê}<…u`áH)æÄµ‚ø—Õ1ÿ‚h7¡;ŸÍë1”̦¡p<Åžq1Éäµ@ü,zù£è:VDUÜu vˆ‘Í+~%“O¸l49¢±]¥ N¹èÍÑ_Œ)Hø·ó7Œ„)ËR‰åt®4‚–¬£~A<¤r2/1׫ÔŰb5á~Ø~vÇ ~XxØ5—eàªÐ—ív£Ì¿6H”IZº›Ó\—–K»•W­AÍö+û‘Ô|Œ²” KCçƒf1ÂÝÐÇÅÚž•­/9Ф¯(´=á½’¬Ž«àîäœA¯©væÜ%쑳„BŒy åK§ŒE;Ô¬Á!®ý„ç*-.h1r£i6åL™oþ*–x_#¥øå ƒ°KU>Íf!ÃD²Ë9¥ÑÄ@|À5?”+1lSnª¬vºÎŠÒû(_W¿à$Sݺ™Á§g=ði—÷ßg ZÆrôNköòçdï“  @¯ ›¿D}>E9®'šÕÈaM¸’Gæ='eÉVþ̃tD6HÉx…½àÃzÓä™ð¨¡C€ÄrAÍÅšY\`K‹ÖúZZs+F*™ @¥½,…›ÐqXo ¿¢Ã;xÉ3q[›+8.-²_-´T7_ ›:ÿ“WæØÁü,rQ,B=üL¤µ\hSу`ãó]Ö|é·ª£Z6u$‰¢Vò½Åðo›öï—ßïtLCBcú5jbyß04tîWûó…øX-|B;ú þæ[êlè)™ñC¹…»ÈùËGÛv”ìæ51$ꮢ–!fÛðÇI›È=¥ QBнõ£â„„eD%ÝLðßi2œÛ`u­]É «—ªDúå¡¢ðŽJd± ×joÇÈ sÛ|œ™%þf).uï=t…‡“VrX­üé® ´¿„õ1Šçü穲P03-ÍIÚ©k¶ž&çÁ+zÄ ª!^½[À4§MqvØž"rm3΄3ý7ƒó1a@A$“!e"ÿ’ÁC] ã®ã7L3ŒšÛâùã! ¢RÙ O?°]ý÷½‚‘Ñë×.Ê'•}ò*±êØ çEËÆ#&O\Çâĉ¶‹ÉFd¿åáVÄ«ä$ö{t(×'nf-ÙL™:Paƒ©PYNüÚï ¾×&úÖ›ùæ49šªÔ;©íO}ùF ^ùxfÛ¸Ö¶š«#Ýü[Ž=Ú*/Xo=ïÀ:ÊÊÿ:¾“þRXöÛŸØÂ‚H…@Ϲ¥ð³ÆN ÒªÓ ƒËkÕ»ÿI}±’Ÿâ–ä^¢¼¦7Šã>zTc„µ ¨Ÿ54”'ùUïxŒÐuþŸS¬ê[¸I²%Ø&ÿ‰rÒZ8Î\eÄý©-7ýó(Üá·X?áÔCr—êþâèX€,uÅÁNÔ7oÎŒÂ~ó¥ $û©¼ ¬Õ ËPKE]HÑŽ¹ œA[’ëræMâì !ìl{åhÖÃâ^«ºžxćqš¯µ%´Ã{ìXο~¼;ï;k‚‰åk’ðÐí›&C(àÕMÁT»’Z‚Ü€XwkªÕo¶ã”K¸ž8†P=6£Mò†ä‹E¢|0ØÌù*4}Tœ±ìJÆb¬‚ýÚëõ4µ%ûØ­m Ê †TÍõãéü$é|‰¯JÃTvl¤®ýA<c%OͦœìÑQ6/Y á£9ÈÃ]þÁü;q\h÷H”|EYrQJ2GeW{­\C§g¨öØ‹¹´Êýpx:lTUCwÍÃð­EôÐògˆ` ¯Ä3;¶¨?±üŸ²6*:Ñø:ºhÞX}­?}EAS&¹šBjè MŽ‘‚¢'ýº¿Íz@4! òóþï'×ïù¶›µ)•2Km¡  ûR û¯ø&ƒúwÚTA)5­h#'Ï^ôï£Ónb\¶_qDmn“‡¼25Ê¡¹Ï†qؼLÕf¡#ì„3OЕ—uÞ^yœkpÜã éw2Dyh]­EøÆÏÔg CNÛ&êõTpó{>ûê0þÑæŽKºá…èMY $Ü•>èÈ5¡»øD‹xGÁ[¹4PÀA½IˆS›í¯§¨kW0ÿÜcÈ]R43FŠetÍÓ«ÿrè'&ßyÉ_¨ kŠPÉa?÷ìËã 4ºŒñ.¬ä—þ†×•$!9iÿ˜Ëæ«?ª<¨@A"ÏébM "«ô¿Cöy9Ï×å‚i›Ë+Î0p¹íéâ‡y- :Ÿ?.”»D‹Z³}8äé~§¥ç©‰Ý%µ“a¸Zò¾U<Ã.;ž&Í“+/ê»Y+=ËÐïøÐß8tIÁÞ·¥!øßBÿRç¤LÝŠ‹QÏïÑš?ݲDL¡HÈ7“Ý+Þ[r›¾kårç{â]ÓPIKà¤Ù–C)[ú*`®û!e¢áF¡.$ %Õ(9‚túÝfù,ÓyMbêhÜf8i KT»XÈWÑI[™Ë©jFž„„6U 8Ú'u’E>9*ç8,Zr¾˜äí8™cÅg¼ê­œ€¦M=¤%dWKð0P¹U“yÆÕµ"t”@»Æ¥ðª¼2ŠÑ­ÌV°Þñ­‰Ðâ…l(ýL:ɪ³ØÙÜyVqS—÷Õ&±+:s|ùïNô:›ZN³ ïÍ:ø·íwoIÁàç#殉;¯'q­ìŒdW¾ ¨*ª¿3êî¹?4‰63Ì &Ð( Ôz6h!EñùÁý7)0ôͲ7Uœ”ï!ÂßÄ:—êYI“'Fé9lG¡ÊÎ’”KºëæƒÊmÉ]C$°vt🸠¿zŠ‘_rU­(nÓæ.6Ï—9söÛGxΈÍà}6‚Îw9DȬ·Û†0 øàOOÔ]A·PjâUóLÞïk¬ý5­‘ÉWaLU¬¸î^–þoë=5 #~æ&›HôÛâë~̳-õœ½¼Vé_è$íÅ“?»èÍ#‰ƒ>©Q;QV¬³ ôdÞù­·wV"¡#wF¦©Bò,·G‚,D͉9‚t¯">i©Ää|=t¡Pq &ò¥x&q¹c» û@!’uÁwÀ~¡M¥#­˜ ¶Ñ³¸ÎQgw­Ö×Ñ7Ê\£ùgèDwö×<âh$æ¼®C/ —€tp´Äޝò˧ïʧ¤Š¯u7Üì1 Û2ФoÕˆ$qÖB°°o–›¶Ìf3±åríß» /îê86‚?֔ǎFµÒÚÉ|kk:Rnâ¶öÚTõ.?C×­z÷ÖÁ‰Çe‰é¦h&… rN㌠Až_Ï‚ÔX³c #Ê6„n„@ÛÐð´Krcö„V dµ”ëéPùªêªbìã›`ÆŸbFØñ‡­†jÇŒ5/x5„×GÎôdq3VAùBq·y„˜øœžàP±Z@]çk„ì)¥7ØŠÊnÈ£Xq¢ä½NA z‘-ªÑ¡VU ®ýú Ó§ƒÁ^S<ÏTá/(–2øaVÏÔgdNH¾B&mÆ”¨Dð q+Lø)Ure[h¢ 'Ÿø*ªL½©& Ä—ŠºÉgÃÎÊò™ÓÓ;"à®õ5È\2,w‚EÈÎm½DL)TòS_¡Ñ¥ûm­º) ª*J'û"!–²ÕeYÄævï=6á°¯²7ž2|ž¨Mmøîꥠ÷ÿÛ£ÆÚ hI_¿™mƒ:÷À¼ß⟯‘+¥èx„²o;~s@r¯†GÂ[ÅÖ‘•n”y£$!g9J–5ÖH‚qÃh¹Îg댻²&4©B‘œS>šjŠÿÆ¥ð®Xœç EpAÊeÞÕj¼}Ìs,â'i¶˜X´Ü…jÂÿ꜆Õæ™›ÐpŸº‹Ñ>ï¿âJ¹ßÈßÖÓ}çiwóï9I¹GbL37ÕNÌJU6r8u4X¸SFanöýi+ê›Á@ðè?¤‡·#ßÌ^w{ýBóI§ùÌÕÝhG²®0¶›*KDÃÔ'´M¹Ø p•˜`R½F2¾îBÁíÀ+ù¬°H²ªK>EÀQòÅÝ–)DdÆ2õèÇc• Ÿþ}^ •×@á¾TÖün}ÿ4Ã*×8»ËG½4O ?% ÇòòƱé O.×­€_óò¶¦—èòCdæ©x8†ÿ‡­— YpA-ïÉíp±?C7Bé)#úú¾C¨W úNß ÔÿaÖtÍ!¹S•ÜþöáDAÓÓ,™ƒgû˜F{À¹›Í\˜E4©føvw…/ªsWÞ­ê\(Ôœüg*–ÌOÉÎÄ'Ètªái/H‚´o^z³x8ÇÈðU†À?Ô®A=®™èr ÚÂѹ:ûpÛ©=Ë 1 þ…Ê6ºÉì@;ºÎAÀ¨”o1¡¥ìþIôÿ¦Á;¸)iø¤$®º+ÃòvpÈ×g˜Õ.´,›i‡€?nrŽg¸nDqÆ~ÞdÈaÿu~z~ß°¦T]¼7ñž‰òô:è,*ÈŸè3’.)Œ €dþáod8ˆo†RVXf/Cì·—!+åŒL%5H~ÓW‹„³!Êtº÷™žÿo$ºøÊë”:ðZm®iFB{¹äFûÿ’PíÙ@qmUnÞÒ`ïÞ}yÚXúä¢`gåtÍ"gPuÒ©:ï!ê<á ’÷÷L'ëi8«¢™u2r­/e‚e?¸ðd¢ªKźþ3ƒDöÄxt:•à·A >°AÍ--”Iyvš1ÊYIÈ:ñÂKN`Ð:ÜʯÔÑúì7ËJiðu"rQêAÚ(}®\-»Ês#¤3t4àæ–¦rl^ˆ1eÄD¶Æ_ê›*Š-¢SÎ㱯#½4}B–˜øIv“‚Âú\³*žô‘$v¶,ÈÚÇ%Í9JÃRŽª¦Éƒ\r²Äâ˜Õ¿P…%MB7òo[Aº-Ê949wYj;ã0n–ð9½Ë«¹Àº”&oçK:~ùüON‚šµÌ7‘ Bzæ#úÞa¥MèaÏí¤ãèŠ\M›³©Œ½Ò~°zHâÛ¿Ö«Wÿ¶_aƒ¸0N÷]Ì¡à"?>Ã'1Ï[íùb¿Àß#ˆZ ?]M„?‚ö¡û}DüµHîûÃ…+}Ã&U * rêkÖáHî”'ž bdTß,½ÚO°þ4º™²¼e6U#ÎjLÎz`›—ïTÎGb}¯›;(ååZ´É9fËw@üÕý*'µÌ9U:_þí¦%*‹e±KØàÈüyoD¡ç ;òDÐP€x öF{•F賈¤&Yøà‹ïÍb ( „ Ìá/³39Öõ.Zǹ ¥–©âB]eu–QØðRv.æ7йzò2Ÿ·‹aÛ™jÛ¶cÊôa7AócCþ1Xw ¹m Æe3²úBÝM^h¾wMG}1]òÄ!'–° I ‹ÏŒ‚ÈT‚‘B[ï÷­Î´OÎó8©’PâG†˜ŠB´icï˜ Ý,í8õ‰·rZsÈE¬A_ÌÑÔO$²ÏÍ]‹ý8uЯGÃj¨¾q»¿¢kOÄÆ~C[ó¯3X…±ZŽ#±í¯ÛeÉQY˜ŒgÜË„PA* opªÏ¹ÊDX75„n « )‡WeÑŠízØ–*PùëaÌ}óŠÀ¢~j¢ó“í;ã"cCþQ ymT3˜€¢ËËǃœDe\-=FÙ§•„” ál›‘ué±ÛÞ{­äf§AýKÈ\ˆqÌ¥²ÎJp8éƒ5ã ø²ÞEæÞŒ9"¦+´">ÚúS~dõ)ñ•¿¨ø€EÛ€uyú¸?fôþ®Î¾Ë|ŒçÎ&©”~·(Ìü‘BÅB×ÐÎbŒÄâÔðBŽ.²>ÜëWêOóé%.ÿ‹òƒm±šÖ|eèý7#ÆGû+›êÜš§,°»¬p¹®=Ï€^ňx§•]é{$.œF0ªŒýʰB€!íÅ¢„ôz\¢2Ù§‚5RkY¾"`üô¯ÑHì^´§š¤ÝÚ ?Þ5—Òº½Ó|ëDYÝí¡3Á\ð€J±:ma´ƒïó=²øëUû& ô¶>¤Wš­õ)÷äXj[ì¨Õȉ÷7øœï endstream endobj 3708 0 obj << /Length1 2875 /Length2 20705 /Length3 0 /Length 22329 /Filter /FlateDecode >> stream xÚŒ÷TÕ[÷ ÓH‡„ôéî–îN)i6°éî éî–îîîîNA¤ónÏ9ïÑóÿ¾1îŒ!<3Ÿ9לký¤ URe6±5JØÚ81°02óDåÕÔX˜ÌÌlŒÌ̬ˆj '+àÿäˆïŽ [Þ?,D€†N`™˜¡ØPÞÖ ãl`a°pò²pñ23X™™yþghëÀ 3t™ä2¶6@GD Q[;w™¹8ÏÿþPÓXxx¸èÿr[@Ɔ6yC's 58£±¡@ÕÖtrÿOj~s'';^&&WWWFCkGF[3z€+ÈÉ t:¸M¿J(Zÿ)‘ frü[¡jkêäjè€V c #ØÅÙÆèg¨JËí€6Ëým@ø§9F–Ãýãý+Èæ/gCcc[k;CwÀd(JÈ1:¹9Ñ mL~Z9Ú‚ý ] AV†F`ƒ¿¨$„•†à ÿ©ÏÑØdçäÈè²úU#Ó¯0à6‹Û˜ˆÚZ[mœñ9Á}wgúçp-ml]m<ÿ‡LA6&¦¿Ê0q¶cR·Ù;¥Åþ±‹ËÌ€Nfffn6VÐt36gú•@ÍÝø—’å—\ƒ·§­À\Ðd ÿBôt4tœœÞž*þ‹YX& c'€Ð dƒø;:X 4ýƒÏßäÐa €ù×Ï¿é‚'ÌÄÖÆÊý·ù_G̤-&.®¡D÷OÉÿ*EDlÝž ìV66€“‡àýß(J† Xüá)mcj àù›,¸Kÿ#ìòÏPÿ³4€ÿÆR°Ï-@ý{Ì?0s0ƒÿaùÿ<ì¹üÿ›ñ_Qþ_Çüÿ2’p¶²úKOý·ÁÿÞÐdåþxnÀ; o Þ›ÿkªü{qå& gëÿ«•v2ï‚°™Õ¿9J€Ü€&J 'có¿fão±ú¯=³Ù•lA¿n 3óÿÑ—ËØ|{8‚Gò/¼;ÿÍ(nclkòkÉX98††îˆÌàIbåàx²€·ÑèöטmlÀ.puÞS[Ä_GÊÉ`þ%úq˜D~#.“èoÄ `ûxLâÿ".f“ÄoÄ`’üXLR¿€Iú7b0ÉüF`.²¿˜‹Üoæ"ÿ¹(üF`.Šÿ"n0¥ßÌEù7sQùÀ\T#0µßÌEý7syÿ¹hüF`.š¿˜‹Ö¿ˆÌEû7ûþ‹ØÀ~†Övà]úu!þkfaèh ƒŒ­ÿ•³°rþ£pY™ÿ•³³þƒÇähùûp~qúœÉè7{[:Z:šÿŸý—Øá¸;F†Æ@+ ©ÓbŽÄoö¿QYþ[þcÏÃö¯üÿ8€eü/âS4¶µoÁ¿…±ÿ’X[ÿnدõ`úÝ)6pCLl­¬þä ¾!™~÷¼LÀÿ$åü¥·w_3ÿF󯇕á­fwÈôw°…)È尿ԶΦ›˜ýNÖ›ýú þi.çw·ÙÁM4w·3Úüa–þ€`ò@ðìXþÁýú]'¸1V¿n‰ßzpwÿ¨ü0ýNÅŽe¾]~7œÚÆÙÚè×½nö%ðCÅdû›48¦í^,,àBí~«Á9ìÀ_6ÿ9v–¤ÿ=}vpuàÑÙþ>Ovpí¬œÿ(üuÅdÿ›$¸ƒöζN@£?Žçáó°€ÿè> ¸Àß9ÀNŽ@kÐŽã— Ðå#áq¿Âÿ2÷íÿl ¸ŽßiÁï““¹ðY7ÅÉÕöp çßKÎù×—£±­ÃŸ¯ËLØõuû‚³ºÿÁ§âñ›38’Ðáoÿy9ŒÀÇâô×ã~Vþ‡ÿúV݀ƈ‹s¶Æ|AUA-·•® »cï¦)v5’h<ZïQáãi*ÒÖ®…ã»ÐW¶Å©¯„–Hž<kàCšb•›¼õcT&w›&púÆs…«{‰Ô„ö¼žì½Þû[B7B¶ËPdÚ;s£*e¿¾uí‘t«î-^ žÛUÞ«à”Ez,žbˆTøà_0C‘eôuö œÑ+ZÌs7´™«ëiÌŒñ™:Dï“H¶­×ñÒ1ÝB@ÜÂ^©Y{ ±÷Æ’‡#¼ÜãîðʵH-"ÿæÙm1~b7í¶ç¦ÚÚW"þÝ>7> ýunJÅ`ÌÕ·×ì*xš >tÒè â-I¨/3ÚÿØ{f?ÍÑNâ–}ðpu%¬u·ŠÏ—æ0¬'±0Ž9ÕÆ.…BM£åÊÈ,–ýÆ{ûVHfÙ¤\h²YârT>dÿ¦S¿8ëÁã­]Õýñ»úã0˜í¯!†¾ õ‰„a WXaRZLKÛüÚU}¹¹Y!½±8â£y:Ãc”™‘ÒH]ì³7×(;p hoÌí,MëCtÊÒ(pD‡.*$ºÍT’e‹ªu?Fó«N+4t¼ E•æ½»*ÞÒ!ìŽ]Ô­|ë“4¢=Ý©½à>ä6PQò­ß_ƒRL'fú"•³v·i–Œ‡°ù£’÷w[Ìz{÷¤áÕœ£þÓXdæÒ°IíªÍ^¤ÞÑmŸkÔà´|ý4­›uÃ,ΞVy"ÖˆÀÉ £ÃîëÒh;SOf±/N¡’ýŒÃ¯|ºGLmæ^㌷*Â0kƒ•²3ÐÖiV×z+”+~¸á«ýžÄõÙçOÖ=ø«g%D_kÛ –f“Ù¢%d}¤q‚ó¸„pÔ¸„Wä•PÃù>¯FGH Ñ‚5¿¥óyW}¹MÇÚ³èÕÒ¼Ÿw.!iÉáèo¶[Ž‘nÉßÌ Sà<erÙ)·F²3CJ%Ï̲Ÿ;뜠¸jµv'¤¤ï~emÑqš˜JXʉ¨I4¿Lk0JÛ|¦]$‚"÷C4éË3#(}Dþ˜ú‰×, óGÍç"/õɳ¾¢ãS\¸»’×bµ¹N·è3&‰]™ïJSÓ8F¶øÒÔå~·àê¤8 ½$âl½À Áƒœ Vc‚˜°ÅW_™8üvÝÈç$>0U¿š-„2™í‡Ë‚×S%¡§"˜Àð5þëEW¾=N¼^éC-‹™ëÍ>kG;S~fF[»PÉÖ‡J.eC£IÂCšOõŒÉç?ýÃÅÝ´¨šŠoŽ8B%Œ}ßÙX´±nµÎÂÍcD»² G>ÞŽ°ùeH놤…uº7Tñ~ÙA1Ë*Z9 Ý=ú‘ÿPhjvBÑn—õÀúA¢HLMåY5[5ŒêZò¬º§ L¥â{ù1Ö±çM|#Qæ'2[h;ÙsúZ&°3ñ»v~Òñâ U|tY0*¤¢ç¤DÒ§nÃÍTÿ‡Ûq>ŽÕ´\%kᙺÌ÷óC«C9_RqHBÞ°é©¡"f(¹ RâWVnw•ÆèÞ¨¨¤‹æ‰ÂèUp<ñ¼½>ݤì9&ß_é§9úRÅ[@­AµGñ,Ò+YŒŒÇàðeD-+8~G äƒ$BoùºpŸÝw¬Dœ,ÕùGó¢ÖÆ}‘Á™Æ¤ž1D u|Ù4œuò=’,šìÖ4 •@Fšø†’=¯üg˜*›$« ª燌 A†óY=ÍH*¿åƒ+_ F{ó¤nØ-‚Œ‹«ÃâBבE…ru»Ñƒ²²Ë­yžop;úX2fSF®¤[‰È#-Ž=þCjSqebÐFƒ¼ö¤º¾ ¾,׿Xƒ—ƒÜ"øªÝ.ƒ s=¸.d5µ(é©O@«ºlŒÖÑ/Ÿoº3 0W¯ç¶ý“ü®çWT…Äv¡ë¨Ôï`J´X÷®K>eª·O–2(Þê!RPžzQ¿‘íåe=Êòd·»Iõ2¼vÙœawÓç ÝÊ\lz Ké¡¿L/0Ù²â 26Zµ§Oºf(ÆVp÷n"((ØÜh÷H^ÀÂÛ;×÷›“ƒj»ì4{8œ1a‚†b„·=õ¡íiMÀÜljCjbÙÝ×"²|¯ò¶Eó“…8¡N8óÆŸp”ß&2` §×{ã¡{a^¤aB`êM-P?,±´»dÈCj>.[D“¾‡ùhÉñî¨2U+ëD¼èú3xØ ·ðÍ×`ÑŠp% Ç¶Ì·µÈC‰À-xEÒŽ’g¾¬þîqFîá4'ºÄ1ۣţ¸Wåe(~X{¤^Ͼe†´å£&ûêHÑ0ð4ŒNÒ„æö1óϡĴÌЙößýš¾ùUì)`÷«#ô²õ‘ Dmp¡õøñ(:Õé°yEžs80Cÿl´ë[x~Xà†_×H"´“ëmmùì¹rjP…;`âGà5„")óâÁTŸv EÕ¦Môi"yA~,—;2wãsTŸ6úHègÈÜWü\ëžrvkÝ7ïi(^cnX­°$«Ùæ>ŠÚx³ Ôk¿8 Tz6;àvªk¿ðˆgÌÍH–o:ǰó, lØâÙ·2änú¢ºm%D©~ôJ3å!™/ìÐüÁè< âf*i$þÈèªÁ÷ð1Ù–¾7ODÎÒR¶ÖžÇô•™Ù#=¤Õ¡W e ßÔTùCÚœòëODí.oWêN¸ÔOŒ}G»ëàK ¨ê¡°BlÐ&’ÇX"Röó5ÖúJžá _Þ¯ %)8ÃÑñ¼,¡±sa„»K¢QOv=¯¯£ú£tu„‘•y m¡Ú*véÇy•k?zˆäî Õkû “¬¶ÝmæÝv Œ£÷ÈÆ°ã!_áµ:>ž}O›Ãýt¨–o&Rcóz1’GýIâH¦B SÇN· i vÈnÌ£¾ ] é@Àk8ÑŒI !&dض®‘£Uûï†pMq²û:Ä'¨|çõw2Äj÷e±R¡ØÜ…Z›õ86 ¯'Æ=¿1ø£µÜÞ¿Jwz™òVz<‰sêÁÎ.q«Žçž˜V!\ÞdÄýà9dà¼ú¢ƒJ@R[pIqØÈÖõø‘«ëìƒM@°‚ IíÑsøøEòS¦D™eiR5ìE›¢E{b+~ùúÒ] ¼v±H~ö}b8MñmRÂÏÎ øb™Zï §rלt°t>Á™¼•‘cÁ|-_3 øš¬7Õ¨`D¹•ð¬­ÑÔ¸~b:ᦵ‰ßÌÊ'ò,1†C«Bvü¿êîÝcD¡Ð\?}xŽY)Ç€‡«ì¾#¦‹­¦ðË÷„«Î{f;¾qOYásßѽ©Ø­â'âv…î*Úõ¥×¹ðRÇ™<£õ`<ÜLF߸¡˜dµŽÜcrɬOÎý¸ šŸî¸©QýZ´M•Oàá‰×xlT›7ml©dôʧÏb‘9ë[W÷mþ¨Á¶ôtiŠZ`C¸J1ù4}q@á SæDîÉ–?¥xwgurÿ£<‚«úMÚ {âÂR}Ú(?DË`½‘¸ «Ei)“K[ÿÕ§‰ Ãc¥‰ÍÝ_}OtB(8Q+'˜ CL·ixÝÚùkð烷â!ž8£šQ­6Æl£O †>[Øûìšïx™p5ì*‡dQD8¹UµG盨¨(E¶Á2‰Ÿ5:)Û±½4´©ï‚Ž&¤ä…öBƸL»sö†‚ì5ƒ c.ð*VÊpÓyq)à]ˆiÉäùGàˆ“Üç·,x¤?À&õqDšÏ®¢1|ˆ »Û‘#6šÁ0S´¡âÆ|(.+'ÅÅŸ ¦â#zþÈ‚ÙNò¥Âûi¨Ý°Ú',œ.½æº#Ë3òS›J S&ˆsµ³HÅŽ5×d¹©æ£º*œ€­ÑË·Gã§>ûé{ßÉ!ÙäF×6ÓC" ÑG0I¤³*Q#ó$qVê»8¼W\ÆÉ~m —°ŸPl¸nÆ”ìÖœU©0yÚ7­Î*xa&úKÙ¿ë­¢·–4¼¬NÀ]o(}ÛôpÒ™ŠÒ ¼’%ˆÿFC r767eãØ ÔiL1ô‹R_ŠÕHÔµš'íf5¤QbŠ‘¥ÝL…Lä*AXæ¸D;¼—Óg¹óš8Íšo(Kkwbq† p»†þ˜-ìó±³Bxw&mʼnqû.XÕPGMi@ì1SºzãwJ ¨Ç’eÍn¢ç”™ këp¿”e>ñ² ¹£Ý4)¯2ÕØ®Êo!õ€·Wíðíç·ÃD5»û•Í}hÅVû¨WUwÉÛ€›Â‹ UNTœ»°½s`î÷ÎvR6H¿W"ZjfèI0pKpß¼qÔ²Ô “ÆBB3JÆ¡L±SgÌ2ò›gžÏ5óõéœâX²Xi„çP=× o϶ç+3cJ =”h•‡‹UçUvMhIö­Nq¢Œ^[ †aA¹¶:ë÷@¿!d^Ö§ßnÝýšé`ÝWùÇeµ³éåV6â*i˜ìæ-ÁÁ×öÅ?’i‡>§LWÑ¥×e cöOM8do5qRJMĉòÌY;Àzus9Taþ”¼£à ¹qx®ã_£.1“Ôëê©©ö©pS:„Óó“ÝZ›ÁÃíÜк×ú(6KvÛGŽ%hZÏEœ¸”²îÑøEsxÇö tŸí1j‹Ní#ЋëÊ'Ãí–G¢íËÜP, Ëqä,)´ýÊ‘GÁ èËGž€fgñžã莌Ÿ+¢±¶W]',¹è€Î$1(lxˆ4EvñPµÑÖÇ‡Ïæ%ã!±©Å~­¿ J(5”$³Y~Hãó‚E‘V`¤ÓŽ¡(Øý£—;CÅ5d½±_¼Œ#G,]c×Ëo¶\šó{$Tœ&Õ“°Ù»KGoÖbvÆåsxP›E‚ ÒlébEîUº9a¶·;oETvƒ˜t°Ý–ºW­Nvñø±ŸÚx ]üÁePØ?,2ºIj,yOUaèvŽMŒÜE»9ŠƒÐŸÙì.¿+*z™ý©<îŠyŠÌ!…À1uLU´|ê]×”ûòƒÎÌÃŒ?)C> y%‡\Üš<†4ƒÀ3Îlœôw–“·i˜2<ß)“¥£ ?¾ýï5û¼^gLÛ,‚IWX†½"¡ac,ï=®¢åœl¤]Pæ’²o,¨o&oÉ¡mÛc»ŠµCX˜Q8eš 탻~*Ù%0ó¸P{<JŸžYš´mf9¨ %Îýº^:)cÁÀ0TÉÀ®mlë•]xï4Œ@ͤÓ#´íÅ'š¿¡kèÀ¹=«y…¤Ñ@Õ"¡ˆsýIùä“–Aᾌ¾HűyÁŒýÃ×ÜȤ|ƒŒãýí´=írò7¥ýgû©Fíqùò²x‰†žF¶²©Ò{6“êA¶ ®³fDl_:g#½bTÚì‰1ÎK¨î‹Ðö Uïçl¥çÞè_ÖÍ©™ „Gêè¯k×êŸX–ç<ÇqäVR)p»¢É‡RÀÓ‰óºD † ‘A7LŸùnÆæ»áðk!6¨¶F¾ù6ÖŒ¼8;+"3rÜÙ Ð÷àkÛ u¦²íuE'F¨ó¾™õ-Ø>äc·Þ‘Ÿ¨ÜÕ¿dÔ>¯”ÞÃVdPAoÉð[³å˜²"*|©åeæSDr!ã÷Ũäy×>bøeúÍ€'Öý½üpsXÝ5¥·Üžó×|ß7yìËïuF6è³õ?’;]—D³1ÖyÎõOwO>Vxî”ð󧺜ܬ4¬ãŒxÌ]†ðß#BüH˜ÈY…àq€[{SëO–fàT—<”Dî~8Q<—õþ «‘ð¦knjF gu›:ãÊ—D)WäK½-‘¶è`_j˜bú‘ª¿Â1sõ¡ß¬anSÀØ\GÜ®jÐ7ޱøo®O¯fúp:Siq¤EË£šDLëC8a4yLºîðMšCçñ$Tj"«rŸ`z~AýªU*Ãn‰íØxNEî@—ê”ò²ÇED³nM.§1¢<ƒ²-ÇKSVmvíWï<ÿ3f4¦ŽŒ1´£åÅŠ.žúD»…ˆV‰+?tÀËEXqeoš\LZK•ÓŽÅÖè†ÕCÀ¯ãø¾SóýS&Þ±Môª^²cÓ o†^¢¼g7xlo=Ö$!Ô÷äªÈ¶ÿ’ÆÛãj Çe¶/Þ]èþ{>ºã ÂO“>gŸ$š;,_&'GØì{C)¦™=kŽ‚÷µ»>bÊxõ™é&±ï[*IÁÿQÒr½ D§Í#aˆ³ëxŠ¢—Ñ4.j~ ‡ù(X!y¯ §@«ãHmŠü“B’à@1i¢“Ný„´q‘J<‘/KLC$¿#T eô&™y.µÍò¦\õ¸Ê¡‹Ûìg’/Ó^mò¼"Uaúè½´¿ ®ê‰_É¡ƒÔÙs±ñ*+V¸ée«ÅQi™ìTY˜:ë7f®¢Xa>§.ëB,ŹܯF5Å ª  `o˜ Ÿ•×]]{ë¹ ?G°ºw^èáSeâ’/|\cElI–kì÷J~Hþ‡·ø)iô}¢9=+ò^³M÷‹Š«eš¡+°_Ûü}£¿Jö.À1®¬x}¾c³×]<(¿ßQÇ̃î£Å„ÜYt¹¼%ˆ[."@ÆÍ¦x¬†|–!À&ìaI®Þ©jÜV”Þ¼À2Ž 7 ŽVpæ÷zG•%ü PZD•¬òÒ€õ¬\;TôÑ~[~­”»º°È\£nG—‰K-Ùñ[멵q‰è­=E³¹ß„ŸK€*ܪ#=Ýži1P,:nTÈP,hž)çÆ•—9o4#–Ìs2×Í„&eùì^ÌM¢WzÉÆü ßñÜ⢣ë C¥˜Ö¤³ é)ojtz€¢æò–ãñÌ,…ÝÄ ž׳$¦v¢h[ÖÊ+>Óáqü.7fêÔô‚°ïu•-ÃS}íbЇê)„3ö›AöxÌóúAt.IJS1ƒ‹ô@––·Ê÷+Çd}×®C’â„1__’@#ŒÏðûÁá:žåW’½äød‹zÒQ¹—2¨$E9[M—¶MÌYúl슢÷±-˜;ÓΣ~;ºÃ‡aë˜èXç*»T=)´<‘ÈoakaÙœÇìgu\áV+«,#ñn Zç$B”+cãVc×ÖéðÔy«͹é =€·q©áæQq'Ëë-8ßPH‡÷kßÔ·sž¤“ùáZ- ñõ¤•m„PÏNA@Õ)J›ÛïCNÞ8s[ž(Ï)1Œ —WÐéÔä3RÍÖöÅÞpNO”ÈÍ|äôÍ*Á–ÄmkÑ×éç 1]¬Ñ1Ë  gDšS¾Ç‰ô|×ÜjñJIÄKÚêÖ´;í¥Íø.Hz÷(Ûˈ½ˆ?<½ °?¯ô¸ÍÖj79IíWµ/B"ÿ ¥æç?9àzŒ@t!,>M¨XZC×ɺË¿ð†Ra¯ï^eÒL"õÕ—_©wð)×31t{d†¸É½ Îê÷q•4 ë-ŽRÆ&[€¹ºü q.ñâ-ñèþ¢cJÔd¡÷С dÏ‘àÏF•”#ɸ;ÂFþv’»óµ8VÀ.¿Qˆc9Zs"’`ÿí¥…tJ2«ªd{ÓÀ–dS°}“¬ÈÆVû^±ÒFÁƒU\L£ØH™ÄñåÆŠžÛåk1* G•X‡¢ZÊã~}üàã€x²Ø]|M:Ϩ7v‚dÊ›5]cKͧÄT6‚ùW;ß§'™’Aô)ðl)¹[g†œ*ÊÓªˆ¿}x§¼4ê'ĺ’7bMŒÑôŒØï²8z '¨ GvÙ—?%5¿tŸ?®úÓì»* äG—Qs$ØÜ,äƒ8¢Î]¹Ö¨üþ•²¦¿÷5Y¡¤ÜFúó5*+›,{LEŸJÂg±L&YK ÿMñ²ûä øïOÎ!_†ôpªÖñþð?%ÔÌÚíEb×]H_8ŒËî0®¹òÜ‘5nù×Gð¿ é–ËVô ö$J¿œï εJ@ÞÊ”æÍ±\Ǿ蟅_Gš…¸qz'¥gØ2ñ†‚µ:m -»òtS·Ò÷.ï/"¢Ê[näë‡ÅÃ;&*¿`Õ^¯{GX‡a¿`ã{ج&uÇ¥ ¿$ê›Fæ  ê‹,…åñ5çr÷9P{_îÔœÚvDRí‘¥+œW‹½œ;ªôCù“0.NOÔØË¤Žè„kar\wúMG?©ÿ­ì”©&‚rÆbUßûwnþýNMU¡¦•ëKIúõ(ýæReÖY,“™f¬¼¹k^>„”p…A„å!ú*Ëï(’h`^ο~‚5nC­µÝ iZÖûi‡DS‘cÜv•zGüAPQ“uñ[û²õÑ€³ÌVºž……¯Qév™®X¬½U|>£~NS(ƒÎ´Â¦ïýR]R õÊp3ZŒ¤A6}’ùJhŸ¦š™1Á9d[“XíÙ¢ní£6×y)”fÃ|@p —Ïø„¦›J;õg‘-Ub\ì¬ð[aVúÞaXúܺÅ÷tòýÝÂD½Îøqj*ôº[0í™é!pƒÂ_7ÕÒ›+ h"¦Éðh‘*è½Ã32û¢øXô®å#RÜ÷?ªkd§!Ø?¶œ; kä>:"‡Éð Ä$`ÃW죔F¦]‚ª1ò;7„ümx»àƒÕ2U*žÓ&*IÅ0¬Þ|Òº<…%ŽÆ9ZذI³/z´µÎ=GãŽáu~Œ,Ýëz~]µzªkgs|äº2.i9C¹ ­i:ûd{®Í¤p˜þ>…àZÀÍ”ÿÉ_šGO3ΛÍ÷ë&1YžˬØk'ñòн2™!(/Ú;¡ÃÒœ¨ÌQŸ¢–w^ÎÂBÑ݉‚_—ÙMCÞ¤¾>Ö5¯ÑñAé÷üLX±óàPTŽúðî•oÁû íE–ÎúŠùÎŽëãT‰‚ô»Fí›üKc†œÁT¼nòÄRVH· uýiz<|Ÿ9öØ !FJ*Ëå*#1¥¾ŒÏ¯ W ó^e2àrÀÞˆ©Ù,⠲ʪœQõ¶ÍuAˆ¦«œçÉŽe¹×­®Ù¾–A‰¡DÞ—ž¾×¾ém³:~yÍJP°-X1.2…Ý“@ {¥gˆ«¿>ž3fÕK€DLN¯ñ‰ãb*²°ƒs³Ÿþ n·fçI°€úôÛ½†„•ghû&Jè0÷ý8+GŸ¯Ý1Á<&Ñ ËOrôoOsæ.ê)<õíû›)ìóâ¬a"”†ó rüý@JØ\ØMÀ›VàÏ¢±kcAÞnã¥xÒ° 52f¤~y™~ÿm3ÀŽoOP¢¼ñ9ïC£múÃT«Rf9ì0fßtßÎéÕœ«+M’œ) ý@Ã÷ˆ»ÃBn#„ahÛÄK:hŠdÁ³9­w碗©YáŒBdÚ®“•õö4¥Ô2/]ù߯ÐmX$o €AÍã¹seæ9P~ø*ŽðµJ³ßè¶}òJDi˜ßy³9Lû6 6âPù?"£2½Ï€wh|Žd0•ðöqo_àìr2CIÙ|æNðؽZãFÕ6'“žq4ð\7ÂU%y ù©„Û” —S¹C*¸¹Ç%ÂémùójJÒ „¹YÐ~ìZmBXx(AÕÇ}ÿ¡ó†G[#ýÛH?ÞÔ†ºJ᤭%½›ÎÈ’YDXK;S¾ê~ BÚ&~Ãü+¯Q@Št6¾S·ÉÎz<±µhGÚñ£‘ŠRyǪ,'NÛñðQD¡''Èž¹¾¬ Ÿ.†TýÛø#PÍZ^ )È~ã[Zerº€®+7÷¦<ÓÙõ ¿ Ú´¸l û).jTnÖWqhúå˜x‘ÿ@Éè·¸‚vv!Ѷi":šÉLK’(ÒU¾úžå!«NÖ™´ÄÎ,ÁçùÏÈâ& îýJ³BQ íöÄ¢J]EUD:m¸SýKÞùì°Œí¹Ð3£pê Ÿ‹Ü×Ãy¤­óbP‚uXô-ÇTpW„»A\É:Zp÷¬ôÖ™kÙÝ‘9Œêìóc N~EþïrïêQ0ï]L˜Vè^ã/ºÑ.Åú! ›ÆØ/ Y±shŽÚ²KóÅRȼ+•RqÖ¾‡ð•‘ }ÆAˆIÍŠ› Ÿ¬^©Áž±(C´ZîÐŒ¼Ôæo¢á¶o§aËIsœXO[«+zæ½z·Åœ‹lwùVÚ7+j¾$Þ[`˜X\ûĆ™lu_û 7lòÕ úÁÖí"#».¤Y"GÏ9s]rÑ,&;ÿ*Ûd³jÉ ÈM†Á¦¿xÃ0>Áý:¾Dk౎Ý£Y„¸w¨óƒ”õ2ÖB7z¾êˆTR_ÞéÂkÎ7Á¨x] GÓ!›ˆ-wv f먮©ð·ï¨ìÝ h•,ïàX8½ì+¾¬?ÞVÓ ¾uÈë@ ¼S jâ`«ÅJ…û"+¡Ë¾M¹É!AHž‹l’Ú™”ãMÇ*Á¥º8ÄŒ”ñ•ì‡Ð›ºn‹¬üXŸŽ»¼oF©È]I¸)?»•´°RѤV¸$ÆWmLÐr˜Â `Èg¹à6ïoT¸Ó€4œ­ŸVÏŘiŒ[¾:¿eb-%%U+Ar£Q7d 4`‚€ÚcìûB¦MpÚ»u5ć—û©qÆ—™wÚ½ÙØ)PDkæûì¥<¬ÆPþ'EÕÞfÊìþ8¿KNõÈz•¹ÌÉQÛ&}¹-µyš'a?Ã)¼š,Û'{ªÞcúš æ n—¶ûzŒCÖÀ:ÎȉïÍQ†‹ÓØ[†}Wû\GDóò4‹ç aC½Y¡¡ÿêuñ½î‡b¹!Íåž 1N$ìGç±<È‘‚›…Þ‘Ìgý⨠š£€Ü¤ˆ¬àÑZ(ÕŒtÇûëG¤ÕÑÍøŽÄ†—^ :O·ùº¯Õ¹™¥ò–ý´P.´¸×]¸üÞædè¼ù.›à:\¡Û¯ÛPŒ¤l•¶~ê—é…«öc,  î‡9RçnnEH^sÚ¶Óš\]!š¼b…¼5˜Å¸2 ß1W»sWê–öÅm^¶†¹Y¬R‚×(«ÈGµ²`tÐÌz0ӵácâE#~‰2Ç<÷¾Œ¥}ø°œŒ · Z‰“ ¤ÇëèùÛ;Сqõ:QV³ðbPÍ©“gñG‘ºE(È·Ô+ËhýPG=IAÄÂú0V?'s k^¥X›P.ì†z!Ò¢S\–[|ÈÿB$c*`T„Ý»{£Ó”È`Õ&ØfÖOíùkÀQ¯5ׯ'7'ø…^:Í} [ðžù‚qšê,^WÙžBoÈ~•°Ä<¹`Û¹÷2".!óžWGƒÎ:IÇGZ oÞRwìò¦8 ?¿òþ:)}9öÂl*É6gHòwZúØV‹Öõu ØØê§¬^¯y>ö%Å„#×l¢¤‚¦Ÿ6«»È ùmCÎyªøÚלœU¤iK6ø›ÍTS‰XYœ¼û·h(”HÞÇ›Š›•ƒûŒµrÄð¢ÐÍ|1Ê Ï{½Fñ“:ag âêpMŸ ?6å¹úANºQé=¿Dè«i¶R«ß£,·yìÈ~2zÆ«tQïÍÂQ•â¤7ô6hò+g£‘¿¡^Lh0¬:«¹1n&KýšÇš#ÚjÅ=Mجì ûz Ñ7ªy0'눙d¿b¼ÐüÑÇÈVkôYÕ?èº%EúDë}\;u”ÄgŸ­ó`’ú|¯Ÿì–í— jc´ ºçŒ5e›¦½Õ¹J°AF,púá*O‰Èaìï-;Üzf¿­ø|9WPü}dÕDêKäD9íeáÇÙBÃZ"bÁÀϳsˆb´Ñ·uÚy§ëåµ3<òó]…7yÅJ9a¿¼¶å¥‡ƒ ésçÛ­Ñ‹ óc"oJ¶(ž+ÆŽ ¬-t¶>^QvžÂ}ƒc|E’Jƒma¸µ`v¦Hh1°Ò¦ùšIs³î½émnÛ±œ¾âˆIÀ`Ÿô©8‚_cN>úúžÆçò yrÿåáS_oñI®˜/L™øÂd¶dr’ov†h=6?«Q>‰7V| ú.ùTx Yü€œ«}Ú&|ûôQFw$A>ò?°{gxŠÈùdkE|´rGÖt|lª<êþ„p{‚ê—nÝ^óÆÆû­äË=§‹zôföVö§ ؇¨ Й뜸m‡^ B®ƒ,}T¸ä•l&WG¬p¿€ñ…BÛl˜˜>Ÿ¡ Œià쓯ÇÏ”ôUy¡eÿÜx|Kõ|‰+îØvÒÞÚæ¼<mµLþ6OMižb½\¿£¯´l4/©\‡ÐbÇ›¹ý„³5 ½„Zš{Üýò.Ñ(·½ÒE»±„hCµÔÑÄšv}Iøq÷E>H$ý•º¦ŒDÏ›94n‹·!¶»//X"ˆóðkS½Æ,Âw7O´»&LhtØ'#ÏMoâ‡}¡~ —[ͧy¯’ªŠc Ê×}Ó}„¥-z“ É¢Ô’¿%±¸·ßTb˜Ú£eßâ5¨A£H&¿›#“©XÓµf!…Se”¼'çɧƒ.$ðñËØuyõ•žåÁ‡½Ð·yæVÄœ³±\ ~-Ù Cd˃=)} Û¹Λøõ|®‰ÐžaöZÇÓPEpŸqxGJL~íYÅ€šsÛõ!N¨›Óç³¢h (ÏÚuI“ 7'÷uî ›®|Õj¤ÓèxÂÆ ØÚLÕ»ALZ*Î#çîõæE{>~O¨ãÕ°BjÑôa*éVîꊆŠå]_Ã3á ?Då´£=øÊ¦#•/›-4ß‘å¤%öSwnQ¶ÔI )7¼D:°R` x”ê_ÚªàXæÞ‘©Ç7;+«ðrgÒÕÆnÝ»iÇ¥ß`ÀÃY…¢"§J‡‹Àa,l”/æâÏù œy$S@ÖÓf-[”P¤•®ï¼ª@’êeF­¯YíqÜ+|»å"ö6©O·ÅƒàòŸßc;xÚÈ)±_z_Ò;#1Éí"ø²J°õ[ÒM>ÑÚª,tå¦áêëPËHšÊÊ0anE?— uˆFè§TNÊFS9x¾SÑ®˜-|äaÓôç{óÊ×üu6ç78¨R­Éç¥A‚Ç 1ðyž^ðI¼ã­1©Ÿ%§ª—qÎ0AÍ哇À:„HÝÉÇ`OF‚¹ÕN‡ØÚ>{½›¿—YAÏ3:O’:8"±Ìä¯'»qYhG𔥋àâ­ÕA/>ž±e-ê);/Mì/|b›[“qÄ s¿Ç]âzkÏIe|Ç›ñ 8Ö…2coÙîŒìÓ/¼µsSÙá˜à*­œvÿtú>-ø†Ís‘ˆ­•+X¤‚ÈšªQÒܲûxœô3®:äf³BëG©ÝÐݾ•¼­O2–kü¬€mÈt¦¥åÊ‚OÚ!Û¸#¬k ލ4¢#šAïK¸)f7Ó­ÂíŒd$D`Ñ(Ê9õ rÅU;ÀßåæÏ_ÆÞVÔºÃ?s´Ñ,ðkÍ¥šˆ1¾}EœN¼LÔÓ“–&W%M³2CÚ ü*ñúsÓÖ±QüiE@£LîÉd…I,ªƒt¶ ìd„ãLëǾ©¾È.À{GͶLï‹n¶%sÆùC™cŸÉÃhò}Ýî#èøv™uè—­è(Þ‰‘쓈»s¥|˜‹¬/™DÛ‰BÞœbI¦ZK¤çoæ&¸Ú¾§`äeç i¨Îí9-Ø+>¥\]Ùí…å])¹œm¸s Gå‹ïäŸÔqP †•gY3oZP*~¹ì,FÑ´{þéÓNQ•Ärã¬!C䌾µñÜ|ÉôÝK-SümÜK‡Û¸_C>‘y «êõÍð«$¾1…m×­¢ÊQyJ-IÞyqÁ4ÿy¹ð×ñ¢íÏYØ)%?d'ëèxB-7%¥£¨¬;ô’º ÉT.…Z ¥ýÇŽ!´“Þ|ï–2ÍgÖ(ÜP¼o³|A4hìBQYAŒRÃ’ad«6„-VQóe¬z8±×ë\´x×þ‘¥›‚Olp+åi˜)ˆ2"" ¹Ç ¼ËÃOo=6„nµˆ³YÖ €ŽÊ£Í®ÿº!¯'N£7¿’ºd*µ 0¹hÅþ­AÆE”îµ.µ¹âø•fŠ×ëÊ*þ´#Ü7£~ðÉ·•C¾*((òìŠÔùJ{ózs䥛¢8‡°i’Ý_ šƒ*~&ék°"NÓÞ33’3f(ÐèÖ†`ö‹~Öјh1òàe1€‚•:Áùúô2—‡jFÌÛ„&\‚"ÕÀX0¼ÑG}dg>‰:P1`AOfŒÀÐÿbÙ€>%œÒòì[DÍÜjàNÜO[OmK{µ~/Ò‹õS*ýv¬nÓ¡vå}A3Ü×Çß±© $Ä‘œkص‘éÙ óÞ%iÒbÞ„üí2ÿ>c;ÓG(–Yødg¯Ïõí³QÌ9²&„H¸Æ),CÛrÛÔ–µ«]–»Âõd÷B rþÛÀã|¿Ý7ü+~ÈâNˆj¼ø¥îŠ.r—:å$烜ǶÛ?öÒmQdfèý¸¡ÚaËH×ã6-¢iA·²¿ÊÝ™"JÓÄøŸ("çßÝYU|WŒ‹ÈŸçV§ft‡Q!íßÿ±ƒŒýÑQpÎ% ×W®Iò‘!¾¯“©8.©þѬ4¬ Ôþ ³…D0­Zäá×ÀDÄ9|]Q~¼9j"†ú‘?žôʼn©¡v"BÝ}•¬KEᘯ[u÷;UEUÂ<׺ЈâjÚŽ —H.î&Qq_j÷nþ6°W¸ß°«?c%££Þÿ,~üËÐ!æU~®ª5E͇J>±y'd¬c€£ tj‘‹šwã­Pz0ôP|ø$è*ÝãàÝ,\˜(´ñ$M†–Ý`íaÑïÀB7Ùªñö#p ¹ËAØQ<Ì·–’gFi¡k¡˜4=„æ.žÉ˜êz–µ âc¶é)öt—ûÏ/]Èh,Ûqæp½ Uöª‘k=YS{Øa„d‚6á4 ú-³CC×K˜ÌÍDßøOzæ¥)»jr•¿›ó…Ð.¸Pg”!·|e‰ ʵðÃbÂ…¥X@Îv÷ýÞ"c<8¶6"ÄhŒA_Ô€]›E1lh29bšàÌ|3·ísr>«ŠG󵸭M‡÷²Ýšºü†ÇÂÄÓaL¸÷åÞ4@j_ºÓìÙvÁ©£B61ŸŒøY)U²õ;FÌÄ¢Ú4§!pmúÇ=uL@÷;˜ú ‹W¢~ZùÇè÷IQghm!"èNPìoÜõ”™Æ(ñEÂNï锃N2§UË]Ÿ‘&tœ´yGæõw‰_c¼(ŸQy2²Ï iMÍ•V·¦ämÎ;äÍúF{Ô_îÆN`”tÉ̽ú\!Ey=º›ÆÞdY—¢3]W·Ó½™'„»Ÿp°Èõ¸‚kYÚE'ÏÁÜÎØÏE#HHΰ;³xð)ú½.Ñ*#mM½0¿ÓˆÄ…ÉÙú=š3é¦UãÕ‚8R®ì¢¦G[Î2›DФÄýusE³á3Òµq†‹}~·ÄÁüFé¡‘å5@¡šÏœd©2.‹kV¬ÒxE•qZ÷°Úf‹H"(Ï¿^M¬À+ó&&÷ùdòqÕ A\côÁ˜K¡Q~mˆ¦ª“ SX¹k4¯™^À³P AØ €9ZÚ¾=bÍȼϻ؄p±2Ęü{¸ôIÜn?äõR”ú§c¿ðPó5+$•Åô‘ÛÄZ¤ò„½š2uŠX«wÚ¤M|O "ŸƒZͪã‡ÞôZg¯ÛJƤ=~OB‡«úªg(vî¬/®Ek• #@µýY5ůýS9Š Áœªš‡éû3Å&ÞÞªÈÑÀÒêí'õÌSñ î[†›OÈthß:jDZX³ÆY^ßâW¹)¡bKùã¢Þ ÙëøÐ6.«WóÇWéXC,Ô¾»%¬Oy¼Kç âv–ý)eÏ$ßg¨0Š|»â¶h|É&ÙןGTì8"ZÑÕ¦ÊèÃÝTI#a8¨[‘/Œ§ë;a¬Ô6C®{sªК¤ø©XôrÚŠF²kÆ\ú.;ëãÊRmŸ¶2+„Ïí¢YH;n糤RÝãŽqÍÎhK¼[ÄÏêÔ“‘Œk‹Æ·þ‹ ðw‡ÒiL˜Ç;û Õ”$ê-mTaî0Úpñ¾÷s êš Ÿ‰Ãt,AË*h2‹ŠvËæÁIm »‚†xÎ.죶”(æSÅ( | ˘œ!Ÿõ­Ehް…ëU’ãÁ´÷Eõ‘l¨=1l ŠXËV8r!þÀ¡f¹ìÖ£àÆÝq!Q±L×íVÍ­ ªaŒ•á^VÄLË…ˆ£õ΂iºÍÌÝ·«¼kšÌkÊÚÂâI÷Æ‹Bm$–L¦,4ü¹[;¡#´A2´t@q¢ç2|(>·Àõ„þ²”ûæ»7hÄZU×?TCsX²ysž”­F‰î“Meà™VPm\%¸ìy¾>ZŠÌÇõïÉâÅ5©vÂÔ±WÃYÍ×¢çVhoòîÚ [©†ÕŸÆº}ú:n(O¼“âyßuJ¤.~?]ÀmóÐÐþ}VšÜ2_vxÕ é0zZ^ö™t4P³ÉZÒ7P^ü-²½SFu(Á¸š0¾" ¥Ï 4ª&ûBÓYèíš™öAiÇÔT=ÆÚ«×³LLùGùI‘¢>DšWþ@”t7XW#·áAú\Z6C—e­#&¯¢P"¿ 6©÷’¨d'Wbœv‡òšaâ¾X¹Ï*=õìô%@Ÿ¼xq=£àuŒ¿¹Óæ¤Äñ[Ôcü¹ÿ¨‚jx¶sÖõ"R$KG€0F2™³EÃsk>%%’n½ÔM=Y’;`FN 9ëÇÁqo{/–ž[¨ÙsƒæE²³§Š6þÖÒÛ½Ôz|á}yf ±E9¾â|לzQ3c~'n®Œqàü@ü@@2Ó&oÓ½g$ù¼Ìí4êÎËu|l±S(„ú¼ j×jHcãŸ_»ˆ>Ñ&GˆØ“E*–㤰 Yna¼(JžÊîàV"›&°I¿rЈ„¶LØí7ÓDzÁ¸L 0¡x@3\Wºƒù!|V·iÕf1m0àyP-†mJ7ó9zL´I »›aêÝZíò “dVB«ôþÓt—zŠp 8zË7”%Ô¥Rª,ˆšÏ7#Í 5¢¯…Lœèšzø­º¿Î¢ôy›çiÔÁHeÆ¡íåçõx»¯(Ýx\®ŸšZaU‘‰9“3ô—©`æh‹ÞS |¢K|¦uö7B¶šR:tyÖw„ºß‡Ú;¹°±}Ù˺ê6ÝÎŽ¾Ö ·Úfƒ/ŠW‚»o|kPw°W]¤%hE¬’òð$>6ÔžLòO)]1„‚¿ƒŒš9`®1>ò½Qm<#¢[λP_ÌË`1îב8{­Rd=F2$‡^®e¼ vË5u¡âÛHŒ%q$».ðf+–n›]Ôý¢’±,$Å9½ÌÙÏJi ƒ>(Æ‘ÿ¬0É?'’Ìå^\ WLƒý˜†˜Äýî¡Ó°ÿÕåîÚB¾Oem£{µšlÍdYrζM²F|äå²U~Ç”Å+Ø¿“¡e«ÒWÁòº èÑAÉ„a?S-ÿh÷&"S,ß*ƒÓˆŒ”ÂäÊÇ%íl ´7©Ë­–YTÕne5åÞu¯âSœ•8Ï^ua·fÓ牳ût!ë·íÊŠ|ŽÙÌNÔ­Íë˜<û† qDµžâÿ >ÁêZ…WÖyö¥y‹Ž И#UÕn!—ð#D>K¸‹Ê-Óé$Û ¥‡”57Ñæ„$û˜¼Þ Z%”_iÂŽLÖa¸™£hÆX9±± êYÐ/§O kX܃ûa‘-¥pó•/A"W»cP”¯›Ôë(äRIèt@¸B³™ù±’Ù«òûyël¯zõ5”ŸµöêŸS‘5“•,Ú[L“Œ÷~ ø~mæµ8¥…=Éâcùk/iìZyÀY樜ª'ï¸4²¨dŒè+¤–hÉ/˜4~Êï­ýÄF/ 4Ú´ ¾¦ñ{•+S ¶p{ÀÁôðF¼wý`¥]æ’ѾR›N>€Pj.ƒ¿ê=„†‘Œqü裂N¬q¼œ¸Š1#–¨Lw>‚¬Ç?–ûk¶ƒ«a\À®)Ðý*a:šsÔ9ï $V›ÇCSba?Y»XpzÉ8/Weœ¦Ò´Póˆ5°jµ/W[²©j×vþ©<åÍs“¦s”ù(±àZ  H“/^ÿ=*Š:$j 4X?ƒ“š¢F%(g®‚þãà&ƒäF+D©÷ Ma`ÑÐ5›yË Üð^5mbÀ¨ Á¯ÛÌñVH<½s••}\:®Lu&R;ÓÏ籠Vµª£†ÂÔ†H¾ÁβÊ9à„òÒÌW̧F2…`а/¸þM}*ÈhÞÓž»+%#üuF˜<0L‡~χ%& KU9”ÛáöŒž`6ŽÆîKʯFœ,j5D7;Çx’-¼À°¤@€Þ"ù å´ôBÝG=m²›$S2+,Nò›ìgµV§m$[çòQëQ€6‚ùµ 1ÿˆx¥pHµ_ÞËüŸÓ2«EX>ûp¾TMÀÒ;J:C¹bØÚѬ|ŒùÈ6ôç U¶ ~s帡ý)2ÁÊ>¿#¾›d“Ã剿耣´Qíl­œ¬*ˆ\¦ ¿æ©o>4KöXIÞ+Rc¿úOW+¼%­!«*<ðÙ$÷IÇmøïiË•ø@m,§eè»À¥ùå70ÿì dgÓfN2¯‡?sC M(-cÓ”kÉìÆ¿™aïæ0ßÉjRÁ@ÈBÉon pû³Ïnµšš¯«wÄê%kpñâûøÜÕ]Ÿª1Ü d¾˜ÔjŽ0o°ÃJZó¢ˆ ^¤‰áï ¦¡¿£¸È!ÓO˜¶ŸôÃûA‰¡B¡¹™.]ýZ!…A¼"áV°“ ’&ɧa´¸I„…Ç÷ köØZù¡’_øŸòc¾$Ès‚_»”?PA.- B bÜ‚Bo°KrõºJXÍawOlÑåkYËif»41{˜ê”Ÿa< ®a1övºý' S)B=ªñÕ[à ‚†PùYêÍ ¹£?OËÁ–±4Z'‰ÌòÓÂ1• 6Å2æ")Ô£2—”·øO»Ž£ ?iIÏÕþ}‚îB…ƒ$+*«Â(´û°ÔPA»¢å¶ŽÚ¢\còxaÊò˜+F˜hÁº#‰¥¢fŸi¥Y$ð³$ѦASËדýŠ¡K8_ …NJ&¹&žOÃ8Ol7^Ô-ÆÄ-Øp7X5Ü/šì+QÇœ5õ}°…]ƒº’+M¹ó7ª§…_ÄsY°Q¶‹Ož«eãbõòINsö8ë­ÿÅe›U Ò¸¾lüE»EJ`œ¡»Bb7§Û¬—¡ØïõÀYB7,›°œ>]ÎDú¶/ò2ÞrO‹_ÙwÚø¬©ò÷œ?úã¥tJFeXÓŒr㋚?=­sBTj\[AÉÙjzí%€M®Mý‘š}mÂzv¹ÍÀBêœïC,¾•ÉÔ"Ô³ˆsiÇ.÷ÈxåÁõC¤*¿ èÈ2oœ:—3[ú‘âë<§”ÞÇÙ?m)•VÜ^O±ieÃ÷¬Ì=Ðe‘ØÓ+$;{®”Ò–J¨õ¡¼ó·Ô.ß{_p@„GrÞbhîÕ³WuO™úº"¯¾ê{S‹_O×B)|BùYË©½¡0=’ÛÏne¼ˆ? ðñ.Á¢ù¹ïv#ÅpÚðÂNece’œ ç}¸æ.òÕ`gÖEFºÌxì µñ&€ü•/øÔ}»Q0Ơʸ–¥oâD«Ö¶F…ͯ=*©Ž3?úEsìß^^‹ëØ/D4£êD´¬ßV­ó3FXlLá\ÏyÖ®o÷X•ªé1žîp¡Ü;å.§¾Yâìö ¨ø¡,©‡”ëù«¾‚PúK•¶ œuv)lz£.Äž£AojzdÃátj7=Ñcî¿{ð‡á·ôîd‘´-7T†þÔj\Õõ6KøÚ†‹_þ´|<+äq„UƒÉÖ—øW‚XÉb³`¤µ¤XÙ^}HO„ìÌ}Ö Æ,ä}›"–›·$RÁy¦XLÐiS¨_á+Ó”«TÈØï¢Õ=á|ðµ'ÑOްÁï³Ù°Ýi÷ID4íHú Ξ5¡îMì&‚ªö»˜1!‰¼‹= •ôuz&ãç#ç–Ïý V¡6Ú„€GÏHZÅP@La7OyxávOBõ} û§Boð…"â’+¥äÕº Ö”êÝÛ„ò¡Q)!/‚³¯+ÄŠømœÂ¯|5!Μ“Ú‘ùwÙú4à ) ÷žŸdÏÎ×^_”«lòöZn'k3?š±ùÕUBi@µQçã— ü3– ZðO·VR€Ž²R¨,zeª¹† ܳ¾\”N>tJ— Ò"o3úŒoÙ ÄŽ£ïPn®YÎK)³þ$Šžp†žê<ß¼/F¢RâÇl8æùäQgÔþÒ¨yšY¯–õëmYä²÷ôÕ o£6iE‡ñX¦ÄTˆ³ìñ‚\}M'צµSÉ—$*jFhÝæîSFÒºpu¸¥„ŽÍúm·pÔ¾1b3F"™{&‘ ¥IjNKЇµK*ª!Vü3ž¸…Ï Ô\¬öY™Õ sÄ¥‚jÖJC{bÔêûã½%íá Ê¥]²OO’™„8KÚù§!!¾Msv½»ú €Í“7ìB:Fû]™aÊÅÚ‚ºßEðÚ&í-Í ä?‰]ðXüBfœ¹15«&[]W',|Nõl~2%4§ûVÖ«ëý½cÅ·Î'(yVVmÙÝW¥D¬ÈãW°{ïI-‰§™vÀáS˜D£€Õ¡½¿Gä4µ˜áoŸ69Õ÷¾û#© d+1!}=µ—E~©nÔðj¡¥r)rîiŒ àõµè>e«[$ŸÀ;7ÏCnœ§YÛÕ2ù7ÓäƒO0ÊPYú‚\Ç0Û¬ž>¡KN=É·Õèô ¤,3ªƒšo¡õ¥_šmð-M긞&¼há`ÚB)²œmäïïÍ]uÄåíétŸ'>‡³:pÛö¹cvÉ¢£–úM™C[÷ùÃìú•4Ðw®c ,Ð{v»h¶,>hûtýðÞv~~:u*²4w Ô£;n´èû*ÿiGSËÓà´í°ç­¤Á‚*×ô“ü-QôíùBxï¶Ÿã/Âd•"5 ‡öÁ*Z}Œc©–zl¸‡ü9á\¡:’OV3ðÌêwÓ뀑¯ÝHQ+ÍnVÀ+ÉØv³ŸŒ¶A»D1¯’ˆ¤znòõ£FeœYŽl“`äOZæ)FÔDYÞ‡‚µÃª!‚¥_ÕÆ8t·4š—³* ¢á¶¡#Ä­ð^muÝ’?ÅTŽä“©˜ö|â¦pI¨gxª'ûË€ã[zy?]‚¾fUÉêäDt€µB²)PŸ£á·1 oõÕå*ý/ŠrZeVÅ€ŒyØ"™Ø\Ås§›3fâPaÉ£—Ñ¥½‰'ß1º”ã¬vähvpŒ¥ºÆ)}…ä“_ ›„%ùi;€_:a¢3Êõuãý ª³d±w/_íùû§Ã×Ðf¥bùÆ­xpÔ à 0ô ÈLØà€ªƒãŸ =Þ0RCe^|¢é}K“Æ/ÌÒ4êéŠC!mÓªÆH×+¦>sŽÊg×E–³Í—MmYÌf= õæ8®zÎte”dü9À”ÀïB3}»Y4sJ­„MÔý!6ö”àãXf?ú¬'üQX#)¾cZ¯%:è ¶¤&â_Õ ùÛÐ_¸Z†rÏ/ÜÈÑpé )¾*í…h8¬#$ü+nœ9Á%Ô^š>P/a #›"çIÊb÷¶˜Â ÷EïÓv Ûï Èå,³áŸW&¹½YTäfžC3àâ'g‚ /³ÕÄÒ÷,•ÒuâűæÐÂ<”ñ¨à‘Tiµœ„-ë&ƒÆ‹üÍÏÜ(`¢Îâߎ™›cK²vaãíp­WsB[×pýåÄÁR“ÆÛ‡¿àXyzZ‹\Û?­ß¨i¨™¿ºÈý³VÄÌj§îb…«)6â=Ã7€ÃWÓÝš!QwVžÄäš«P‡Ëjm×Ò†çUù –òËßÔiGÈóÚÈl©b«`W³Ôx¥"–Ÿ›¯l6¥„Šææ«8±òÌ‚Xé`É9±P¢@«½Ð–„úò'ÏÜ6MçìGíˆ.¦P ;©q#y¡Ä€nÍ"&^F%›oOáÕvŒj’P¼:D–2•{Fž<×s®SŠÍ¹úQf²4~èS×€n¥{¦ƒoÅñš8ùMó¬õvÐ$úñ™@•_ Ķ£®-póíDûGŒŒ¹“:”@C°´ÖjÁÒ¯Š¦dH-I+6Ë‚×Ôe<"ˆøð…ÅãÝq祱ÿ­´£_5XíUÊåø:ŽS¬ã·†1M†¦~;z!‚Ÿ¦[rî´Ì²’92µùól†\À!ÞKw¶m”ÏÐz€^@÷z/r/#è|VÝ"íµ9 {A`<€.)fpr0'Â-¦'ôjd"Ô-¼\PƦm҇ܙ¢«@r¾Õ%¾YØoŠàÎÁ:É#*Ä_=ˆ§Aå–Âêã"o|l\B‰¿0)qi³¬Sæ .ÖÁÑ^ endstream endobj 3710 0 obj << /Length1 1757 /Length2 5088 /Length3 0 /Length 6162 /Filter /FlateDecode >> stream xÚ—4ÕøøeGö åS!ûÞk¯²göÈ,®;¸\÷r‡MˆˆP‘M’d¤2"JFd“”½2"[Võ»ªoù~ÿÿs~¿sÏqïëÙÏûý<ïsž2µP‡c:X A" V4,-!R,- KÑ Z¢hÄ?r:Á‹…Å(²ÐÄ! ’L J a1€ @¤ˆœD^ ¤À`Å ±8%@ ê‚F’€ƒÀÓ jb=ýp(W)Ï??a˜QT”ÿé¨{ p(A ®RF X`a(Áï_!„U\ O%ÈÇÇGê—Äâ\΋ˆ>(‚+`ŽÀ#pÞ8pÐ2` õ@ünM’N°tEá),°H‚‡H4 †ÀàI.D HÙ }CÀÄùeløË@ø}8Dò'Üoïƒ@(ÌOg( †õð„büP‰B#CI‚/A€bà†P4Kò‡zCQh¨3ÉàgéP@GÝ €’:ü݆Cyð’xú GÐAÒ1kcàšX†€§;¨O …CÀHçîú}¹î¬&àB¢0päAp¢'È ƒò""ôµ~ÛDte. ƒ¤¥„€ð…¹‚Xúy"~*!bRAžXOIj„B"H_tx¨7 àˆˆ €ÃŠÀQ0àŒpAaèþF'‰È_LºÊ°“Æ€>~]"M‹Aûý5ÿyÅ =S[- b¿[þ£ÔÐÀú@BJZ•’äe G1…¢~Wþë©AbÅ_Å’N韂½O€ðïõþËKš[ üwÌÀ²`éäÿ<ì?]þ3~åóÿV¤CD£ê…ü?z¨ í÷Û‚4·DiŒ°¤MÀü×ÔñkqpÑã¿Z}”´ êôŸƒDáuP¾¸)Šsý9¿ÄV{†Fa¦X<êàe$ `ðt¤å‚¹“^@ŸÃ¹H‡E<„¤²½!©lŸ¿(Eòö=„¤²ý~â¿îFÄáHÜÏõ#]ü?üó5E |0ºX˜r¸[yxív™:¯ÄL§” CóZô­õ´öqïY³0M•u鼘Aõ—ýŸbvÆY?K=øQénà v¿<˜£Äùái-ÒyJ<°›õÜîg¼!QêÓ…úz;'i Ü…s¹ÊüφZŸ—¸×êÌ»ôy]¡ª’¯Å®Ë4g+%‘wÆÆÐp+(H#¡žþ¢Dã±z_¾~M­s)á„ÎüNjÓ[)ÙɿŠ&Ry©˜jcZ'=0k›kg^¶Mdï ÷úNR9Û¦€‘Ëüñ6_ss‡s@v¢e‹÷mž:ôíD¨°Dûrëtò- Á“2¼´p§ESL|ÎÝpT‰.5g‡4Òë­ø4Œk$¥˜ T­ˆîa×ût²]y7ÃGæÖÐê» ¢ Ü[Ç‘ªk—õ V3Tû'mP?'º OŸ€F˜ÂTN­Ïh~¸<øiIå±öÛÒ<ÏÐ÷æY‰úuÞañs/Ô Š¯–ŸíØôk³N48]Ž-†VÏR“k9ƒ×šIbO­ ޤi&¯¹^ØHV}sD뜞]uD¨ùÔ.+ÚeåB4Yyþ«‡F,Ê ÁÏlæ[ðòúi]Ò“ÈLÜ‘Q×·¯(3s(:â?ä‰Ã矰˜õºÆþ£ÜñyJkòk¥j‰Žƒnm) Ó3ÆMq••÷d‘žéVåEÇCÐVrŠ{GÌû†R$^^|ñüÂZVRÀ5‰9a¬¢¦‚Pé]« º2'7サK©{ –­þ38¯BŽ=¤%Ù Í|Ê¢omwÔH›’DÌ`éùËÕµñ—+ï©5ã98߇6Î.¹{„™nÀBmå¦×Oˆˆ—iQ®&Ñ€ô­Õi| :jÈZC l", bÈ÷oOºÏCoþ››j¸.Âg]§ M.䎘e•‚ÄêFD$$hKÃÓ¤³6žºw¼m¾ÞÝSÿI ðú$÷xç«•Æ""×OD¡–§£uŽ•µÜ¿äüäõnöÜJ^ÊçU5žzQä¡$̯2 ²ëÚPý³Þݸv³ö®G2+4ö¬ ”5ZkªÛ1ŒïŒ²D µ ë,aÝ)æºkj™àé7;ó†2¾7÷ÀÂY°)—¡çyC’Û{¶œ–´›3>ÍËív®8ºIÝ„ã|¦©67¯_Ï:)à!Úx–­ª¸—?Ó1™Ñå¾.åÀ“ÃÜPóøf~iÒ¦—ð º\\¿àC‹Äq^ì¹`‡ÄV¿üe?°Ò°ÅUû¦w–W¸V¥ãÝrÙ¡¥Lð;´ÍØ>®{ïn ôF‹?ÅÐyª@ÄJ*o¾æ¯§’Ô'oœØg¶@LÌ(¼dÏ`t¥W£èÄr„s¾‹V–nÐTJh¢{²Ø“y*]#vñLîã@è‹UIŒ Œò¿à¬Ì)ò0å(;êX²s?(Ñú|©”X³ë*Y±-VBÃòèh1±«lK܆^f)š1ÂI´óÛˆ µ ìY:gO|¬Û×_’êoÙʬ8‰ÿžY n¿8£)»“í® ‘.ïò<ØgÖõűêy©ÁuÞy7ƽ¢EV2ù¾òâÁ°åì¸búœërç2*ÙSÎ4[ò- ÂíÉž¾(¹f¸‘óA”§×Ã10צtÛСè­üùœÎ#Èôk°íÙm"œ™)Óœm3HéýàK¤/ëšÇˆÜ7ÃSl¾Tè:¨E ±ü&bk7.©¤¸Þäty#/ìÔÓÐÞ¾‰ç¦\M„¬ûˆÅ QÓ£h‘%Þü.yggaEgµ—×)Ѐòz$qìv’p¸³_]‰öÅŒgv ËÂ4<_[é|Ô°Y8âfƒdÞŠb±Í pÈ’, >òÌÿå'Jb+OG«À~ƒ²høùäøÍÄœ‰óO>·dçVÓåkɯ£[ÃGïz¼ç“]NƒPnU9k?öd€áIŒ³ST—œžå·•ò6^j)rƒ­†žºÀ« þ»5“syåâü ·µF©%‚¦®^¡—Ôß-ƉÅÖæ]\ã¯N¨!íÊŸÛn.ðÒÉÖ˜zþ¦yhp"Úú‘Ö—Ä,Ü\­“½{§€†füN,Ôpvs¼ß¾¬œâq•¡º æº*J*r³-Ã*-“A>J#8f eÜD-¦)_¬1 a¦s:²-¦mu±É®W·fö”œCCsNºìmo5Awky2ÎñØùT}b!jre t¸ë=kâr—”ÑŸò‹Øqª4nlƒÊŸéã_qÐJ r¬pz‘Ã{lt–Ê¢mècMÕYž¢6Âú†×å^7*³¤~(­ã~Ë_ñÑrYÏéâ2aŠ¿q»›iýªmtoÇ6½ÀžüTŽ[K!<${²ÿeክ±¶ø½×z>P—GZ#Ô•¨èÜ%Á[òߪ3.,WöOXšùR½òW²7SqÓõÃ.,ì%£Ð[ Ç´D'zŠw¯š"r.=\ÚL(·sHûnr¬E]d6HršQ.6O|ÌÏ3L³½à›ùrã¢#ï·Év.[ï'-ÚZݺ®j ®\Ú½š´mûÝjíE‡†Fb ÕMwïÉs@„v ò¶Ã÷‘ȯßì^æÄ„Êɘp4~ʸHÁ^6л0•H#•>ÃY–¦g–ͼêÂyÚ§ÓÁî•dŸ„@ÅÝ{×iœx7fòÆà”7ê5½¥2Cu.ÍøœÃš[ ˜,ð£Ý£$d…Á«æ¸Çœqú§ˆ¥Ü{8öŽSWû(õŠ3öa$°ãëEÉr hå¼<ô©Ä®6<$m“X¾Ø˜—©’ŒõoŠÀ kž ÝÌ­"×À{ìwáÅZv›üïøZ+2µ³¦~‚'y¥ç¤-5m$ò¦Š6ûßáŠ7…0›Zó}5}ÔÓ»ÝS Ô ‰ ÆòiOÉWv­¥eý¶ Zïí×Ì‹m¬™oô0ú¯d}vËímðø0c-Ä)?iÅ×ñ.zç>8gÙ}î{â»h!^>›&òüô£¬­ýÛ"Á|Ú&é¢þ2[¡­íõ»êk3å 5yýô.D‘ni²é‹NGhnò o›gRIçzÓ ßštŒOžX)wº‡ßå9á®ür©ÆTùɵrÕñpZËz@èžbUð†×Ý:gnñ}ëñKìþgæÎ/d ¨olG<7ãµW¦ðuïõ”h0ñÛç8§î£$¶Å'*ï÷‚9l¬òeª»HªsÄ„ºìs™Ã ‡ få·–¬”Ù5²>°Æ*½m½Ž'ÖQ³úø™ãÝ÷:4uPóë}á?9Žz£ØÃ¶ âÛáj-_8á“ ä^S«ž~+WÖdÓ(2ý½å¢ä³D®¾øÇ1Båµ…[×yqÓÖoòÆùäž/z¼gË~Bo7Wnr)±gú¢½S<å3ÞTPfÓYÕ¶ F%gýó;ý jûãÎŒ|þÅßëm4æêToñëKáÈÛc €ÍJrë¨Ýþb-°oñQ$J!ÊeËYÆgD-4[GÍöC0²åîíè‘Å›zbê;É1®~QQ»¢å¶3ë×w€šD{þGUZ€Š)ÁŸv{Y{Ód—/xùJý¬Ì¥gÊ‘ÆoÚVÓ ]Å0ª‹"ìVÓWДoº’î~½Tb”YaßC”½¥jɨÀ­¶£“ïc$qù:[`Wua •޳^†WŠJñf"'«ãÂ3“šuóÄìñ÷·c/³¸!vöƒØá9üB‰i?¶› ‹³S)ïúšÛç»j/téL#{·‚tvó—'£§çÉ mø#ÒÙž¢PYYK¸dòµTþõŒ;wð†L~èèWEÛD§+|jjòdwÚŸÅâS%gO:îGÿ¨?FòÞ(Ù­Èpgkž ,`/zýšª­[ØÁgÂÊ~™L“\‹z4mªç#†‘>ecí’ÓÞÍŸ?”úðAˆ2¾«V$ù]v¥ŽÀ³‹Ó ðÞäžÕˆ¯73L;xØ'> xQšVÐñÉ,q»>ä$ØïÕƒüƒNßroq<ÞЭ#³*§ˆúà­ƒ«Éé^èÎØã¤¤r5‡Û…»žéfç²òeÏ—¾bxêØš`_&¸Ðø¡#Òñ6}Y½m¶Sý¤†˜ msÿ«‹´ÌšƒQº +Ûz,³"Ê£‰¹©Ô]Üf…nÅÖÖ© ¹õ¿Qø<æ}œT„j"&vkne&ÞÒæy•×Ïbâx:*HâŽ55æxÅ@ÛoWýÉûÛ뎔â…›820Øgæ«ò™Ö[¬µ«”޾Çï·°Ä¡ŠXþú1Å(’ÚÍÀáÚ@³hTÑSÌÚm5tjüvz#ŽôO”»øzlË»†…¢à³ýBÂÒõ‰+¶´ÂçüJF¶TÃÑ™·fÕåy½N‹¿Ôe|¢ãÊG¥na§ts¥ÍíÎÒ*­y­G}ØJB£ß1ÛÃH“è-£[MV¡îGA5G U©ìµòþç?׈Ù&$}3’9ô uÔ¼ Ú¤?úL­¾á5•ZGŠÙ×éÛ‹W27—°i`ÅnN´Îe£#€Wh<¿TÇ6ƒ%=xcÔû-I9 ú©² GBÐMï -káf0¶ õŒœ¬„ŠíÜ›á·ÔºÊ­AÎQ¥NG-¡  Oá*\çâ)¨æM-.Üèø¤ÝóNmMû©MÐ "šn[ïžòêí É^æ”û÷&äŽwðñV~b¼gå)kÙ˜å7ÛàW™ß*ò `uø ˜TVŒ!è›dÕ„©É±´ÈÅÓÝ8}ö$Ú+‰]vuÆChÌêX{C†Âz®:ZTÍÖèí®rt¿‰Ý• 6+¾6§U•¨Î~eX¿uI¡~MÛÍŠîZì1®·95ÑWó¢L^'ŒBÜ2÷ ÖÅ}:õzøVZŽ;5Hkï¢Å&vy¸+Å-v¬÷G¬ýž²ÂU?ð‹­ÁiNaª6禌û¼|«%ɲUbxCí²ß{±åóÄå øë'kO+SJRÜž;É‘“Šë5Ò¥O®Ššt«Óµ6#ÓÍh-ÇX&FROç÷ñ †ÐdW™–‹Ú ªYÝ¿#W}˜ù9š¨ïBë{\ì£SÁÙvUgŠÉE'wwl€…×î¾Øô£3)²MäuyêÖñ‰š'5û¨.Ýúö5¿™SºizwLäŽKØ“k‚[˜Ògé‰ÓC?¬þDP 9 endstream endobj 3712 0 obj << /Length1 2820 /Length2 18321 /Length3 0 /Length 19914 /Filter /FlateDecode >> stream xÚŒöP\i׊â®!‡† ÁÝÝÝݵqw× A‚kpîîîî 8Á=èéÌÌ?É|÷VS]ÕÝϳ|½kíw“+(Ó šØÅìlié¸Â²**œf:&22 gkà?4™ÐÑÉÂΖëaG ¡3ˆ1téÉÚÙ¤\¬ŒÌF6.Fv.çÿ)Ú9rD ]-L²t);[ ™°½‡£…™¹3(Ìÿý|0¦0rr²Óüe´:ZÚd Í6 ˆÆ†Öe;c  ³Ç\|à1wv¶ç¢§wss£3´q¢³s4㣤¸Y8›”€N@GW  àWÁ9Càß•Ñ!TÌ-œþæ•íLÝ ama ´uY¸Øš àeI€¼=Ðöoe™¿hÿôÀHÇø¯»¬9²°ýËØÐØØÎÆÞÐÖÃÂÖ `ja È‹ÉÐ9»;Ó mM~)Z;Ùì ] -¬ @ enT‚ ü§<'cG {g':' ë_%Òÿr겨­‰° ÐÖÙ áW~"Ž@cPÛ=èÿ>Y+[;7[¯€©…­‰é¯"L\ìéUm-\€’"ÿ¨€(„ßœÐÀÊÀÀÀÁÌ:€îÆæô¿Ü«xØÿþEƒ*ðñ²·³˜‚ŠúX˜A?^N†®@€³£ ÐÇëOÁ##ÀÄÂØ`4³°EøíDMÿÆ Ãw´ph3€fÀðëóï?]Ðx™ØÙZ{üVÿë|é5ä5E%©ÿ®ø_™;À‹– @ËÄÌ `ea°qr|þëDÁÐâŸ$~[JÚšÚ8ÿÎÔ¤ÿË×õŸãÿðÏjPþëKÎ4³@À‡ß#®ÃÀÊ` úbüÿ<è™üÿ›ï_^þßFüs±¶þKüá/ùÿØÐÆÂÚãÐȺ8ƒÆ_Ö´¶ÿ«ªü{ee&.6ÿ+•t6­ ­™õ¿m´p³pš(X8›ÿ5Óª¿VÌÚ¨`çdñë™ ed`øh¯Œ­@Ï 'Ð<þ%‚Öæ¿EmíL~í+ÀÐÑÑÐ4FL¬¬/FÐ"šÝÿš`=­3ȪÎ`jçˆðë@ÙXô‚¿¨¿€^è7bÐ ÿFz‘߈@/ú/bgЋýFŒzñ߈ @/ñ1è%#Ptéß]æ7E—ý@Ñå~#Ptù(ºÂoŠ®ø¢+ýF èÊ¿ €^å7å¢úrQû@¹¨ÿF \4~#P.šÿ"N¦á¿ˆ¤ihcÚ–_Ï»ÿcAûGoè1 '«ß† U£ß¤bdhlådmèdþ/ËÈÄò‹vüƒdähh ´š:ÿA³þCÿ½|ÿzeü›¶:ÿGŸ“ù_þ @µÿ‹XA)ÛYƒFõßJX~166¿+þ5Ãô&@PHào ®ÿí—ÜÁ´öÿö ” h`­ mþðj‡éo/ S ×?ÜþÛ¹üÑŠÙï ¹Ù¯ø§ (÷ß­euÌÜÃÞhû‡ˆ³ø‚’·ü‚NÚêjÎï"Ø@]°þµ·¿å VþQ#Háw(V/[оÿn(´­‹Ñ¯ç¬Ù)î z»ßIƒ|ÚýaÅÈ*Ôþ·ÃtµÛþç°Yÿaÿ{ÔÌ @ƒ ºÂÿPeû‹³°ûcvAµ·vù£0ÐÛ½ÃïÂ! Ó_O´}³ü"íœ&F¿[ÄÉöùŸì˜9ÿaÿ›##ÈŇÇêÏïXAFN@‹ÿ'ë/ ë'Ê râºSÿ-Tóÿl#(«ßaA×½³¹#ðQõÔÙÍî—ßEbþõòädlçøçÁ€¦ÃõJØíu9uÿ‚¢züA‡êù;g'O ãßüç*0vqªó_w5èžø?ü×{è4FX^°3æþhYó±í¾JÏvw‚w–lW=…’ÖkÙ±Ýå6‘²2#pÃñV0q¸mm[ôÃÀ Ñ³×æ:ØÐ–xÅÖGï'ýX¥éÝV„¥©w“ù?kû àñiUö¼Ÿ¼Õ¬ ›Á;¥È²\8Pr1îÝúÄÝkûKVÇBv÷*Ù¤ŸJfh£T#u¾Î‘å}™Ç&q¦%€£zsîŽ:ws;û&kò•H*–Áç8йÀKk“)úç¼çz™ “S)Ž6äÍ›±ir/¡ƒ$)¬E¯¢ÂÈ ÞÅLJ:°%ÛîÜs!½[úb&ZñEjßËB£i0öZ€Ü=¹uЋ ˜ÄMÊ™kã9³\Óãø”Bµ1ç©*M‚æê@Lh™šÎÛýêjyÁnžf…/f'GÄ:™æîùÜBÔOõÍäkY”~v5©oË; %/ À ÏèF1ºƒíôû3¥&_Ru—‹œ’!í‰{W“¹;vR?mžŒ‹dÓý(UT6™Ý3±¹,Ô8v¤¹DªuA¢Æ ¢TåOúâ±7˜#°&te­ªy³œ“÷·+ïSt÷8ˆ‘“•}è “¿¶æ¿+=$º%šaáUãAæK•ãÎÀm˜…Í\Û½m׿Å‹'. É·Òÿ4B ¦4=k„5Ÿ2mÖ‡4ìí^4«&k~<'Cʬ‘²zòvfÙ£…5£ì-M§É;EØ~ ̉hþG¨j-ð×Ùïƭ%ãFQޤb];pß¾ÒWyp¼½>i ^¿ïÑõ纹‚Ü•Ô!õMæ‹Í­;òŸ jÌNy·<úö~(c¨“xç(©¦»Z±«N™ J_fÂcGcÄŒªø½·˜É[NdW1º÷rõ5¬Éýãpií™ÃŽòËër„ µ äš • Zs˦”9¨®88®…š£1#ãþÙ\w¼Ÿ¾Sf„VØP ~izyZIºEuä‘ÌÌf‘Ì{Gn6LwP]ÑöB‘’cþÐ(á\¾1eb(›‡á.<ëzØ`ç’¢¼“TÓRStåZn!3ƧPÌè xÇšÕ tŒh–Ò‚NQÜÍç}­ÑwJzsDŠ,p­aÑ߆Pv‘ɽp\bÎÍĦp \­krÎšŠ«rǺ»F€û}¼âÖnù-è0yäèvœ¦+Šmöu=ýߦ=`mç-àÞY~ƒ\ÕïR…}#æRÏåt¸OZžúqЃýÇN.l[Ì%Š]•vØðÖà)ˆ)/ãÇ ús£ãOS—1›¦o°Ø´úÒÏæ+¾™§w·±yeM³å|†’=“>™z¿. v]×riÛÓÚ#QëUÎzp+¿¦½ÇhõƒÙB¼kX¶ì<JR§ *¡uV+$½vpk´ Ø€í?Ò»¨O-Ë#Úõ]ìX·´z–qà¹ßµÏÞ®à àš…GWq~B g.GZê À)îÆûoL†TÝ´”ºêQ)%Ì[ì }”p‚…>£í pMMM)æ TÛëg.²I}­àÄê<ÿ«n_F½m½Óm»JÄl–]ôž}€kD1»[ ^Áw†öØE`¶ZäLMÏI¹8ŽûÅ!Hª¢l¹‚Â>&ü¡Åƒì%FOxøæÍåOIäÒÏâšÙγ¸ÈáPuV±d2,ÉžMË2& Ý•aÒaW"××:ŠÞ2¼pófZsWíôúgËNKòÙ„ëIàm¾ÕÆ´^—H&êq`Ê{wºÐé}Ÿ–Cßw¹ÂÍp328žælaå«É¿ÿg"%ŒTÕwÎpr}¥ñ¹ð|˜Àþ6 J{Âùj}ƒzØå€Hl©ðÒ€€âAÅ/ JÒ ž(˜Í’7çbÌ-b ~¸½ s%®u´Ÿ=ç~(å¹frõ£ÿç —×CáÛbÔ›¬–P~k‰º¶TÊËä}Žù Óü\ [šˆZ”Ñdd…4ˆv ‹—¥a] r”Ä¡Gw/ÜV‚Á2S|ÑŽ°o"xΛûž œ¶£9BÁ„ý}€ômgjø–È0¨—LTšlûEÒ\wògo³¾" _–7§‘RìEB›i<¹éS=¥o…«‡ö¦À3º}\<z¼¿Ü™õ¢ƒ;Ò¾KCçÂÍ>pÙ¿ÊÁ¹ÞÔî9Ðáðhܬ¸áÎ2ĆKšëÎBTÉézl“¼™V·Ÿ^í1·È±…:ìIü" ÖÞÏ‹KÁ‹}¹%ÔÌ´‹òëL)œÀxœÝú ;Jù#æÙLtèþ±’I²XËþÕÏ,}1´ô<;o —í²ïooç%i1I*“6¡”΢‹ÑâGÇé]\6ëò|I»•œôS.FU£M¡Ž0WtCAHÄw&ý˜Ÿ1ypšÈ¡t*›‰»ËÀļ—ðÍ:ªJ/ϪBæ«´Q†èÃʉLïÒ+a oÄ]¦²£å#Zââ³$—Í«Wøò–‚æ–ej`8À"SÕÒ¿¸lª5.õý³x½Bãúj‹¶l’ÎISÀúWð›ò°Ø}#¶ÀüžÏƒÛSîÐæó)ˆSKÎO³!ºÔ¡žKú–ï,bXD;iù¹ù«( ‚ì˜PÊ>Ÿ?`/î{÷4¹µ£“»«j]mêëÀŒ`›ãSÀ)eÙeà„ƒ€•ÏÛýUaŒ³‚“µ³Þ MsPØÏ\¬DýíbàõN—Q÷Òzç~C×ßRÇðă‰G…R#Pìõâ1À1xžR”D²½sñÉík!Ö?'óÚcŸ› ´ó®G@1ZŠì¾º%•_­1" ü0¼‡Qâ·ùz)ŠçÏ È8ÙýÚµÀ„P!µ/Dä¬ëÛl…1*¶æRÛÞ—‚a.%áî›Û7UÔr_˜µ3“«˜y²[E?é·’1%žÍ]JË@ÜN{t:öâ’ Uðßg¬¾iyÂ~olÙú9]¢µìÝJ)ÊÉIÊVtRðõAŽðQ«KZë(/ßõ8·¶z5ÊïÚ–]‚\{Ï8¿Ì\RÞíÿTSd‘ºõ\ˆ`ú}+ɹÉ¢óX«æƒ7Õå^€F)©¨(xí:ž;ÇŽ…ÂW8®ö­ømDzóJ]Tº)8Ôf³²æ,ÇâQ͸õ«›ŽŒLÒ5€ÃdsŸbM¬y!ÌëÇØ¯_ˆ…tõªã¿ šóÞÝãHÀôŠñ"wµÇy}”~^1!­0LBjØX*áì€ÓöÆà x«Óâk§®»“2šíÃkÏ­ !ÏŽ‹ˆ®V8֮Ѷ/Aª\Àÿ~ßây]ùÚ¼r ±Ìb©N)õÍw uaŠÓ 3!…¶ªQ`˜¦6ŒèhÄþ”‹…‡k»€»}·{òDDج^L(*ÎÃë·Ÿ;dçr–ü‹‚ÈJA‘‡~ÞEÒ] ?ÑXéÃÐ.ý«iÕ·&¾$~9I›9}£—¼þVkG’–3o¡?*[¡Ò'Áâc|œä¹æöwG¢RyÙjÖq4Ç×RâPÈ,³ñ­)wŸ4w«ïNrÓÄ$lEÛ Ó4EH~΢èfƒ?[“’#¿Ù\tm§Óäó x“]m¤ú(‰­ì•:ÌľÂ{YMÓëcü•c\FØ»¨ºß,ˆ¬M³”ˆ“.2ö²ž?ý ; ¼^3Eí8Ò«0p{&ÉBãó>ÛLt)4õV—LeŒoì9è|åM·2|>±•_7ÝU>||ŠkŠóî{ÈÝ–6Ž|c^QµÔ}©fC(FÈ0ÌñM’r†ò\ ë|¦55ÊxtXu“5*[å®j…fËY1EyÑOý\{2(Ø3Þª']=.+&@?¶Q'4óL« „ÎKPLL²qZHž헇¦±OAбT`X®Ó>s¬žÌ6›Ki—ô7E•µeY8uú¨áW¾‡Sâ¦ç`XâÇ%±ñ, 4城x YïÉrVšuwD¿HD˜Ú¯ú»P¯»|È’¡'¢h°ÃÑe4n_¡ï&Û¿~ü\Šg8#}ЃêX“ƒà{G‰TªËCš}^ÉäRŸÇóìÊs¹(§€á+8ô$Žk•?†H« Y>0=K(Ï]ÔÚ.¤”OY^lWv¨vTÕ{®ü²ÇÓ˜ÂmدHÈéâÉ&ÝGF 4ì nkÆëUázcUÚw:µã»n;ª ÞÅ!ð­µDó¶q¾éÃn…ûùrâçA"r ÍKÚÖrvªR¼K†3÷xÊ1ÑSgáN7n3CFÖ>]mÓZk:øÍ­¨½ü1I£h³wŸçÜ6U¢ÈK‹ µÆšž)E‚%ÊqBœK€H cl¹MȾ=¬w‹ ü¸KÙu“ƒÐ[Ý=°Va;ÁøŽt” ‰Öu·9‰Cîú5X„üaŠåêÓÌLÁ°i¬‹¶ DìM{È/ÑŠ%íOëÒ%áW(}QÁLà™«Þy”ßnJ×é©è‘&â…¢ßMÊíB¹é–>E¼)¯Ê7XØ 2SÔ‘DøŽ mûè PÙÚÒXªÿ!ÅlIOšÜ¦¯Å¹É³çð©\¼ÄqÑ€å«'K>m;£Õ™ ªSâg·"wd­¬8È:äCÔ4¥¼Ü™ãóIk°19BÿÕô૵½žú:R¨¢Êóñ÷Ÿ†ñz )½æ?[ÔbøJ[[Nïª ^œÆ{ªÖùÑk0")çì8ð6½˜“³»\•B‰_«À êÏu3÷É>ýü¾åÛ£œî¼ÁZ!NÎ38ô8·˜è3ƒ}~oþ­¾÷ÓÎÃÇá|ã噪1‰|¨Á®cíØÂÚ)7¼…Ê4´ßî“d¶ z^Å…ÑËùCfµ¨j SçÿÀ[0=ˆ%‰€FSÐÖyÜ jÙÔh1Äõ¶È‡JJ@’°-'²j¦ÁmDœåGŒ•ŠÒ÷`ÖCï6¿÷ñ~g茅ÒÿõŽò;7£kœ@Î7/tÑ™²Ò¡QTd¤´·¹Ýôi¢ÇìÔü(xõsÔì=*sÐ)Ãaô¹Y¾yLq¹bÀÝȈFÉô+VJå te"W¹ˆ:`PF|ð¼ÐLE§GOxŸ>ã‹óSÿÅIöÝœu2ƒ[Ò+³´‚Ê÷Ÿk“QoÊÇzuÊÀgÛ<Ï¢ã¬ñKBuÉŒ  ìŸÍ¾¬±‹ÃáQ¶;¯ÒÞT Ÿ–ËéXzñ”×+ MÙœC&€p5ˆ(}r5˜µAEèÓÈ6o*zNæs|WÝÉÄ ÄcT¾–>Þ$5Þ[º'C G{{CJÔSH£’# Ã1),¿þ¤–ÌâM¼T†`ßrÉ HÔùˆâåžœ¸BzÌõ^ëÒ¢ƒq$´Ä:ѹ·AÏ[ñ13§Jf2̸“gJÂ6Žr ~²häç·9»{¹Ëç%]ò¾Evò.w0Q}þœ •šV«ìÇÉ·Óœ"×¹t]gøn(<ƒô»º%Ý„u‰²7U'›šë>X r-Ê.B¦ïHi¾œÍ'ÎÊÜÎí\5ò>¸¡ÚÔ2Øà©Á¡ÍíÂ'Y¤"†©ÈÛ:ãä±-Ê’hŒmãß8´íŠD›2ŒØ8qòôe¦é§ÅìÙØJl  .¢Ṳ̂µà ,¬•ÇÆå&DžZšÚŽ©.­¦Fö g¦7æ97ÒG®í÷íµƒ]º®®-n¬(8à‹’Ê)èé/šüî·òÃ\îÎç+sÛkæÄg„ŸÝãÞ #ÅG¹18iÓÀY«‰ çÝ¢0¹´Œ‹õÈœTcš7Û"„Å7RÇ0Ñ1 3³‰Ž rב! }ÉÒBÊÚÁu%ì-ªèj¼FhųaJ0—45š©8’2ýÏÅŸe&>æ“°¸®5ô,»ú÷¶j ÞC#ìÎ>nh ÜËD„¿õòsÝh‰¥€ý4!G¥ù.~”ÚÁB÷î”^O†r›0¢.‚ ÏÆcƒ—÷*,Tú¨#9µÒ×Ë¢ÞÙkÆv…Ÿ"$”©Æ—¦~§=}}Ê1ìÔ9v£vø.á–¶Ml-¸¼ðMD>L˜˜5¢ ¼G8¤éÀž¿ì¿~nà:•a7zR$!^óD_7.ë|ËÎl{bO$qkYxžÉWd&”OÛé(Enô$“ܦê—$ÑÉzpÛ ¤èfvÏ* Õ¯r\lèžÆs…V»è2½¸:MHü±]'ïu|„aÏ©Èa­ÜG¸¯s¬üÙÖBfP܇ƒ ÈZæ‘õ4˜¦e"Ítsâîñ®‚ÇÔl*ËÁ eÍÝïv²ÈÏ>Lyeáí]š=æNé-äa =Ã÷åÏÅzŸT·|86±ÚÅí<¦Ï™Xk‰’ðŸK€t˜”¢p+:Ís®hÇûêŸà—i&¿n _]°aÅ\ìðIÔõ|4o­ñäeÖÑCjµH} % ž=1èêhN*0£R­¯_ÚÁKÒ‹ OUˆ!( Fƒ( ²AÌi¬›.ô¼_)ÓBÕauaÚ <“5ïT¯*¦ÑÌm†Ÿ¬óFOHÒ±æ+Ö\Q][^H¿sà]¾AêL”Öï_zŸäÔ{ ³}g½€‹ÃE$È‹ZlJ» ÝC”¶t&|D¸ ôy xT â_{PÀÆHFû©ÉÂÀ3Y"„»ÊÛùEõž±ðiõ“¾³¦/Œ.ŒÆ[Î+_¶ÇM!:uƒ4;**YLëu‡8å)ÔÈ#ss¦gƒ Ýç{%Ü XÒÇB‰ñ ËhkÑ=Ë%Ý×îY—ÝíŹPäs=¾;¬XŠø(Û¼æG,yÍD}ɺPm ÿ2Í;ì³CÞ1ù fߎËö¥Z<Õ¢)¦<ÏÎ$ñŸB°ƒ›Ž8HDˆKÊIU™Ò«ìmî_ľ8hd“µ=ö õjßjí‰>k±³†±NÕÃj˜Œ„KÛýÒ6Õ•/ìÀãøÄ„¶±óõ‚ÐGp=â+ ¯Ýijt‰”°Î×:µ:ÓŸeàêb>|?_Mà]\`ÚsÙy»á1k%B©sÂC£ñðvàQbW©²¦ ¸§ÏÒ §6¬íÚB•ŠKÖ-ÀO/¬(ò ºb­zœÃELë`ÍÖã±®%}|£à1é„žÝæ0ä3%Ê’Š"vG0ÐFÙh±ôá­éé‚Ï\( 2a1®ñ Ð|– ù!µ;‰Ô†©JèSñ ’ì¶5Ÿ[G|w™÷ÍgOÇ„š¹Hõ{éÊ¡[†C*k=yp£ÌÊAÖǶÕñ/0ؤx̉œ¶‚æ5#|MýX«Ýö¼Á$39‚w—Uëbô]œÜÙ£œ„š¸5ä¾Öö_;‰áª¨ûˆ©xMxq{ßO!©8W:9ãß•¬¼c@â]‘Ëz€2OÞˆ ¤,(ÉœG8S™ôR)¢ûˆÏÙ(VÞ"YpÜ“ÍB¯‚In ŠôÐAœÊbÙ:jd`Ú‹þcÝD¿Ì•Ò[€/ÙÊ+Á˜9=(U|ë»×`š©ùWùŒÐB˜Õ¥þm;ò Zdÿn²;ˆKÝŸEÃtïžpÚ ^§ép |1gï‡uhi±[Ê?”¬÷áVJëm~]|ƒÕ<fÌŒ{>s©Ú‰ÁϦ g+À„ê46Q¹kÅà[[F3|—óž>!(%Ø}3óMÌTÉSŸkœÿ·õe í2¢#ù´¦“Íõ×CR„iñVíÈyOtøk´¨ãÈfù´?õÆW‚cB?iWygæàê­7Y”èÞw€G¾Dì…cXÊ99¤§H1둆É~¦PDz¨Õ2b&Š©,ì.ÿD¤ä$TY\àÓ¦‘k‰zΞpv+7£¿Ë£½»˜Ç¤aV0ׄÓ2&õÄ]ß.¥ ^­m~„ë•c)ö‘ *I{-<ŸÝ9_A¶·¶ ·I†t+Ì· üQYÖnŠJ­³ÆÔ¦OCÛ’ nMùqÑ É$©‡%~—.·;¨Ôœs‰ÆÚÊ2¾‚"jr¼qåZ±)ÕÏŠäº0;›î±GP<}ÿ¸¹bÚN%÷¨}MfÕ÷®]­¤¾ÂLî!ÙBßiù I‡y|W Sºg¾'ýmž˜*øJÀdü°¡ »…ô&iÒ„*T”‚µë tå„fЏ›—ÊC(‘Ë «—ô©C7a”Uýª[amfºç¶Š¬çÀWÜÂSkQ+b3Jûiü¸áª9‚ò-´ ‘ZšfKõÈüm3’G0ízFùêêávÑ/‰kßûå} jb¢’Ü¢” ¡L¯¯%-»§zŸn J |Y/ Å\·(ºÇ⟧o2¢t¬í=6dšÎ}ñ!Þg3Ø,šßnD¢c¿€v„ÙרV°½}k‚ ­$wû°Ê#—>߭®D©ñÚTŠ( 9}XâvBÀ7áñJ%¹ìÿÕ³\©©ìL$ƒÉ‰¦Æ ‘4kå’‘3ï‹ÝO)6Þ§Î9°çYœÌ€È‰[@ßdŒaÃP!‹¹žôe: qG”å=£IˆÙ7 E„g×hÜ£Î$ÁåE?Êà.}ì,5ùÒ“Ô¸^nßy¹EpuKXû¢Q«zËêQ48š/@$Ü-9ö„Û ¯¤¼*¦…f§º¸ð5]lŽ~J¦Ùoê¶JJ 8¸.ücg_µ8"÷ò°ö©Â ÏኰËÕ?tì‹MÔ¬Ìǯ᫛G¡†¯‹7Ù PØ¿¥<ð74DÝ0^]ŠÒÂ~„sô>B‰H˜·~ï÷dÊnâg`¾WŠ­~­üY«„…VhEæÌé©6'Áÿ2ndÀï3 À_9ñ7ÛZi ŠySÖ|³Ž¶|urŠuX­)aU.U‰4ÁX§½ÜRÇå–Ìf÷ÆI•pâ,ð5®ËÎ=„I“1¥ ‘IPËu# ù6&$'ïlSƒæ{U»?Ïd ôèÔ†à#Üljp™0¾nŸÅŸâ¹åκ8çÞ´ÆûÁϘíŒ~}µë/qŽ[!+Ên‘äŠÑ…lõ˜1ÓÕ­F !\2Ûk!.5‡‰ÃŽ•7n«ÐæŸÈ‘·ƒáoeµ‡¥¥=œž¿+íW8û"ÁX`)ì†ØÂ~.SˆQ;tBì}W›FK»¡ØNX‚Ù×25úi)’í­zÑŽÛ9¶j|G2¤ –Ç¬ŽÆÀ§%U•[:â5¦âê œü]ìCîäçÕ*ŠTÿ­V,S2sù¢¦ —5ÆkíU#rc&.TæÑÀ*kÏ3  Yé¬ýà'gWÿÝmXxlê 9Øžµ»‚‰ EØ¥Cl_’Í™¥Æ?‘öÔ>°¢üH–' ›·Çe/ 1Œà*^ TEþbÙØLþ1À*.º¾Þ1áZ!iìÞnx†œ- ¥8,Ä­ä£ïKIòê°M8²^>¾@$žN äãrv3”‚GTÉ1Ì7µûãÙç–I»G> ÓÃðyæiÙœP2ôv„hmgnh4Àõ@ا*s/G3á—SE4Œõk‰=í‰G½é2a?ØÞ1(ˆiD›¦ã“QâX_S@®B²µ!øÓSëÚŠsUV5ÊP~dí…_šm…~ÏÜ.u'p<ǼpÌåw½3t¿ ’Í9p«ç†Ý`L–ÉYPÀûºó?«Û¯2Úˆ-…`ʨ-ç1‰'^íàÄO)¢»^Iuá’Cp è´c6{óP½¿‡¢ç”¯bÁŸ7U˜°ÿXæØ ’T]&mRºŽY›•÷ÚfdfgkøòV4…½¼÷eìG$_zÚé‡ÁIÏE)D>Qôvq؛˭‡DzáÚ>Ú·Mæ¢!°ÐaTÕÐi2I@µmuÖk/¡Z”S¡£Òú®ƒ–K}ÇèÖ«/"0€9UÕèÍÏQ~ø—柎¿%“ï¤M ;RvÈZx5@c[œVšì0Vè’‹hI[í¾ËÑ…²×2q&^ó9z1vsÂ0ç²<«ÉÐ…©ýÚÓL+³ÝÐËç’bG¸ý¾Ðîl(pKpóætš•?(M%®¯x³øK¹4ÕåR]ôƒ½¸‰sÅÆ1³¨ ò@óúÿ1}#Û’ˆ6_ÚwÓ°L2[—è6Á_¼jto¢¸7Þëú¥aÅ1W _ƒ.¸vf¢ݬR\cŽ—ÔÂj´ÌeðvqHÒÒjQTÕÌåsHí2ÓP$JÅOLb&hcÖŽ²’|ŽÃü&Á.(Õ˜÷'«[Ǥ߬ùÅ©µ&-á#8Q¦b*/*ò?Ù'Çq=q*R­ï”]׃JŸæÊ|³CÆfh¥ÚТ"CÛ0J‚г± Çå¹[¤  “MP'ÕáKp®*üŒ':Qà}ºÕ2U^)+ûæ@ŠFü&êÕ­…Ó3æõ Bå>â£$j›·fñit«qOÍ‹àl>](…—¼dªT= !"c“”e ´8Ã»Ó Ï07Á®\Õ¨·67¥Dg®Æ‚ž_·½”"ú¬{Vè¹~TOaµÀ˜â6վ͠ô£¥ÿ,11<ƒûfª³£EmÅ೦‚o°|§Ce”yl††_¸^ ÏêžZ ÎÀæút4^xgtíqB]³?~ã·mè$­lê3L–(73 õ;µ@“ŠëŸé7s Ÿ`|ƒ ºÂÜF™|ñc¹‡¶OG ÏP܆ËótI—2Ë­‘}¹Û#> lbI“]±CÇ­‰€Ðrg×ÄŸ5I°Ws3Ý~ fÊ¥TD¢®BLÕ3÷ªXmh£Ó¦xÄ0qË%@ø)΢°ˆ9t;Ãò3½“)':B97ÜAN/véø>¾ljvy ùÕ›²•¶3"êä… OŸoE¢ÿ’Ö‹j—¨ÜÉ(`êði…¾ƒã§'ܧFë"±ÑOÂyg\€££@´Êå³ u´†›f¤øjOV8{7dÏ.éq®´ý[ì½éºuJ1gQBJKwˆØLŽA¯uï/Z÷{ù™<âdñ¹ñ‹Ø«YÈ-ß^VØ„¾êž—¶›ãõÁ‰¨„ÆÏ¾ „0ÀÂãõh'#àè~[6Y£‰ÏÓÙ€ìQHá‚a‚d.iXl,¿Ÿ÷#Ïc”(Äs¨¦þýFbE[~Lý½ÿ›ŒàˆµÏ”Y7—©ÒsÍ“EKœ Éõ9Àâ­´-ÈR6|ioö‹÷še{¢{Öqïcuyß´ÈÏDâ Ýõ÷WDq²}K¸\MÇOó>;2kܺÄK"ªoÅÌ6j–W˪Ct¯t†ã,{!O¢µ¼# Žì위›×þÀä °˜ÞÛö8´¢ûÞmxó„Ž/î¬'¶A{•ç"²e ö0iI69|¸Ï=Ť«X ñƒ4ìƒmpf û÷ Ä$Ñ­ôpÁkaæ•ZßñÁÒÏ#J¥~³Q¸$"(B›B¦AO‹âÙâëØœ:á¸^©’ñ·bg9¤‰°m¤-Ò‚§Vô#Ð~|,i´aoE!ä›JO=H]·¥ž1Óî×Í•ª¯*¥-ºÀÃŽóðHB|ÅáVþyÀ³“?F÷Œ1¿¾.–6mn“Ì]•Ím¯ám‡t‡2+pFª×z’v. ,÷~˜ÑðD‰ƒTóÝSà”UÍЪ)ÛD„„ 5²ÎX¦Ýö#F©]³i–aÙÍÅXhû#ì “‡Ó탿¼ÄuÕ],¤í0ïÕnÿºW"÷Ã&YþyŶe–™MË2ƒ"“YÜ’;Oº¢ýMš±<)äuƒhÞs0 C¯~cµª"ÏJ_Ñ“*Ht¡³ÿ³ÏÞœ¨¼uØÊH &"œ¿x‚õó&)ÍËb­4¼F¬GŠ^4Ò`tÒiKQ(ßK¢™/TÃáW%â÷sÏ“ziÚù¢® NpÛEf±ù¡€k“¨E ˆ]Œá{# JÆ6>5°NÙà·ƒ\æé4ïYq?4L+ »¬­½7ï×ϵð'EMw*qå{¿ Î7™æžd~,°íÐlƒÇÛnÒŒÐImø¾ËkU-]pÃT¬ ¼Ìþ¦_7`>Ÿ3榫<,ã]ƒýxJê*Œ`¿¤ßGô¥ˆ­,ÞÙ—Dãr9µÆÏÝ´d“ÒA¶k' z-hb’Ï{ëº0tZŒóqâUŠ”bGˆÓìÕ#R9Û‹š_~𣲘¿\°!Yžº{:˜r=ówå¨NÓ\$·÷ö«¸Ëâſҹô.';ë<$@CaßðE¦fŽô&ryÌD9d¸¸^%–.ô|]±9`9{XüdÍ×PÈ2XŸó<%lÅ‘E%9W‡ 6* EÕì¬ù0¾l¿­¶Eõú[°î®Y'Õ!¼¾1-²;É 3¢E †ÜÄiKà«§œÉùàczônl¤¥«aHûw®[°Ý »#“d¾ž·Éóf¡—ßq·ä´Šßátíò¿^ÂB6Rd«~lâ5/À‘¢k¸üޱùzG9@©M˜Ù=G1QÊq]tÐ\”ÌÏéTO"-uGˆ*¨ÞrÇÏò"aªã‘»¨‹@Ž8B{*MÚ^,¼© K_~¿PŸç5§ NÉ8ËÄd&hÈ}µäøVIZ4?yfW@ˆ:©¯ÐuèM(†M(ú‡á@c[±Àóé2¢nšÓ•=«'«) ¨ ë…YQ&8=éíe¥ö[¯€e&_HŸp4/ý¡ H²·œwÚ÷6‘FzŠW÷º’Ù*ß‚a¤ó«8*¡ˆK1$æ¾1W=+4¼¹‡$øT"Tc,MªöžˆÓÔ"MO!>ÔÆ\þhEÝŸT ü*™†w‡¬Và=ö«¡jCŒ±0d™3ɸt¾¼°ØÙAfú“3G™µ²‘dË=ݪ92ÄSj9Ò¢Mjð¢¸u;¬$Óš(©à0z%­»ŒGÄ-OÒ6 NÞDtˆ7ÂQäÎÁ'Ûˆ“åÏÊ7Å´ç‡óÎiäiq½à•îLô{k\Uu®ö¸JpKhmÕ†áÛ ¶oŒ«24 kеöéØál“R>ÖFU‘æh0)êS4 “N¡Jrû>9>F_L¸KçÇkÂË Gà¹CìýjÖ6†™kùP,“.%:Ðñè¾³ ¶+Ë é_Û9X.ß{û’M¦¸{QeÍÛN³v³¾Í0ÄÿO­p?iüZ$Ønµ†zB.[;ÛâwGDEqÐTÝÛ<ü&¦ûsçe÷ô‘ø¥m¦ÜÉ!~˜Ô)k;wöÏ.×èA6^sãô,"=MîÍ{†aà³ `(ô­nýÖ+ƒqûEÀÙ€1º =¹ :!µŸÁf2Ü÷ÊãÇi¹ó˜¸£Z÷s°)ëÓš)­:ÝۚܯóÈÕ¬Ú=àLæ,^kzGŠìpö°ŒÇ£”¦5Ù¼‚­ûT]’œ+Y›äFí¾†™zÚT™Í¹BõvÉÅ€ÖϜʋpµá5E~¾ºy2]ØèЈŽësf®ºäýɆÞYÔ±ÏgÝ[ƒpW}+••Cè§jÃ?7‚›´P-h§Ö²¯Än0ãl‹ËÖD,<ƒU=9…bÅØTž ý0žt·é¼ˆ[^qZ„Ý_¦s¢›Ûu”ðŒè^;IÞÑôæê2I‹§Ü+ßtK…ÃåUèï>;c×ÏŒÀdrX{@̸¥ø¦E,Äß±§w±lÂkõZ2Kô‡†ŽÃ±ˆûK2ÁuTÅ;ˆH ÇF*ÃÇí<"Öðñº Tßµ·bc™só`æ ¾ÐÄQ¼¶—Ñá{O è[Eb !dNKAxiên”mªEûù%Ų́c39Ç?Õ_ Ò*,ûS/‹“Ô¤¸K‚Q+²Í¹óÁÂÃ]'}µì@Tªž)ßûdé«€E]ŠfÝÁoú•ø'$ß§¹™Cd¨ÀX²Ë\2™NÄ­gÍEÎ,¦±ëéÐ!íøKHh´¼¶6_¦¤ÕÆvWÞwƒ“ZÏžãÕ’·oœZÙUêž³5¨·ÉŸÃ4בÆú®d2LÒ¾ —Û&œ`ø¶ „3¬`ÅÏß!#l\Îp@u¤5’”Š÷î€ Ã§Aä&~P÷¢7λ§§‘U6~+{gÏ˼ÊI½:qC:gª=³ú6ÿófÅÜz=EÒrhL£\˪ˆ,9A×1M|¡/_§ŠIÌpš'¡i]Üè)Ê>'ák1W¡’§2ú¡²~.öÏÚ´ó|Ù–­Ž zAߥnUðX¿«9D}¬÷äú¡!Èñ0æü’ëú AŸkúyk¦X•:ØÕ[œ Ydö;¿ÚL¥–‰^Öˆ“q¤\(·2S>yÝO¶h“RHÕT;鼯©j­?çDo–­åYh³©a«3|Ñ=IÐ놋{1Gë_ÁÑd‘ËÓª-)5;6¬8SB­ns†K¹Õ‡³ïŽ6ƒl¶iÏU­éPiÏùÃqÕ+d<Ö™µ¡¸qQ éRŒV©ôs:bi‘–áR$˜ùêÞ±|‚œÍôù Ìd ¥73š¬cÕ‰š Ž<‚ÊŸJ6ãêÃ%ÆD²­Ë&³»Ë\Œd[`˜œ»Í=~$hbr7„ŒíêœÑy-C+¿“õö ÏåPªEÏ_ÏfþH*»\õ](äÔâÚ#ç=oWç\àùwÅ¥ºVêKšóðGÿ=Ç»oÕ;Ô2ffƒBÓÇ.JJ»_pVëƒÁyá„jJ ´û¶}Nf-¥Ív¤Ì¾¯d´ÔVt?™ÀÏx\Ç¡C·\Ýá±ìŽéÔ*6½]â9SÇw7jÒôggú½‰p»=òúÑ':Fv¯±-mÓzömü,Aä8;˜C2kPFÑÉ2‰±\1ûv…º†È4TðnÁ Ѭˆ¬ƒË)ØNyÖàXPVã¤ÎÆQ/­§i7ŸM¯Æúû˜„з°+à×*ƒ)ª×;ÚãŠ$uѳü“{EcºÃÁÎÔT×dűë;Ñw-ž_·¾É”uí­¨Xð~i@µ»ÌCå¿5°~Pè¡1M:•nk>â<™Q›ô%ÁƒšðÈbAŸÉzVûå?`ÀL›ïÑ‘‰$Qɺò´ˆü‘oØùs5a…äÚd.Œy³[”޵hϯ¸í¥ü#£õÝÛWd½­ÚIò‡®Îõª9 ‰2,ï*ŒûÖÞMrÏ-£CìXÎ(ªì$ÈBõsª_9^Lz‚}!kïÏQÀ`.žåñyµ«ìŸš{¼í„7³)JßÁ)©-ÒIEϼ$wù\*s\h&µ€4{U´~àZ£Ÿ5>ýÒÙr«à_‘ï^Ôô)GOëȘ½TÝóôÚ%MS~’cB/ÂDØ<˜—vƒPÐ!·ß#1½Œ‘4E&²îC‹©‡’ga«ÜQè¤öõÆ:  1ü“—kÀm†´R™…äQ6ºbJûCVíWiW€NV£Ÿv~Sc° Bƒ‚F :Zn…²k¶j;5'ÎWX©î[šn¿Riˆ€êE]j0T݆áÓ(º0óOAè2#CË ¶®~²Ò‰*ïvFèKŸçûÝpGžP}]§ž=æH ‚Ù4ã|šë•3AS¨3í,ºxØa!ÕûmîzÌó~´~vÆäžòù'7¼A;ÇêÚIfÔ3i©þo[TQa‚2½%ü:`„„\ŠS‰"+D:$ƒ2늎rÒ¤î:‡m¹cí–¾\ØTÍNÚ¶@}‡>ýcšm:ˆ*8éÃRº–jÝ}µšT•–ÅÑ&’“7áð[ÖÌEÙ¥¶„Zçù³Y J;o %Âñ5¡ŸŽ¹ÆßÄÌV–üÒÐ’ÉQ:)ß=I/3o\#ùåÃÆ~ȼ¨N@%ÜI&”¤løT1˜r†e4{>à9Ô I^Î09*:ŸŸ‘|ÞA¢ìبã%Æ¿©äÂ]ø¢XͬlªZ ,©Ï‚ê®ڮÈC·íߦŽâ cW²2Fn‚ŸxªLV¦é¡'mЍ¯`xd c6I“Œsãi*g0Áb¼š„ƒÕou«Ì=~»E‘ú`dº…xަ¢¼¢ÿÈšl„k¡×«cò‘\gX)Í S•­-îíwè¯ßÑü¸*-j~ÅÛéÈ]xu\ib Z÷qð'‡ª‰gΉTMéyûó‹…sñå:|¤–Ï–ß­áE/ pM64†L,dxù|DÂ\µ‹'<§L¾O”xkä?–Á‰ÃÊnŒ‚_~DŒ¤#‡¸eÀØ©"¢£gAæ}pG÷ޱâþÂùIÒqË^=‹Ù︘ß_Œ·Ub6¸ºý¸>."qÏvo¶ô,ló›^àƒ®¯ÅgZá‹7r^Z\üyäì±í4/0E‡{à}÷<ÜnŸ\Ñ¡yêøè¯Æ|Äz‹¥ü͚߫Úq./ùF¬Š*Ï@íÙ¼ÊÆyç•ø>nJ.Âït\ó†“ R•dV†÷½‚!$GØ™ ©oÍ>އ‘la¼(=ÁSPîo1å^5ZB߯~«¬› E\<)öY€>pø@ÐÔÆ^DÊï‚U¼(Y¼yŽì#N-f¥kóÝÓuz1p3»gâ½Æèx›ì½÷î3éªZâEýLªù¹BüÕ/¸ø;ÎWÊfMKLս²…œ.1Bgùů«Ù¡w{ؽ-M‘j¨]Wáù-èqŠ»R ?é¢çw˺Uˑ֌ÕSÈ«åUÌÃÔ#,R\:Ñ µ'¶“°‚]×:V¬w¹jg+h(¼x”ÓÞøNõEƒ÷l wOH’ªëYM±e‰­÷‚—(]}ð:ªƒ}U:TH·]ßÀRàïÎ3ô]ŸpÞ~±àA`—Z/öJð³ý¬øÀ&^¾[2c®\µ@ÎlØçÝE´I·M§·‡ÇjtZà g‡«ú'œÖ܈Ô9¥„Ò¼†Ø Y£I‰Öùû“(oz?ÙÌíÕ*8Úà;͘ëêßã˜ÂCi»3à(Vƒ¾A•®q§ŠñB¾— ÍOÆ R—ê³jÀXf~L¶EÛFþóÎrÍFLû•_¼×ÌÞ+×âÅ»zö‚̸AÇqîÆ$³õ~&Ñx´y5`5«ç0¿Í«| åhôII_u®G„=€K½é³šÚ"- ëÝF†þO‡ i©Qí}¦gZWa”IAúÒ±ê1ö¯«ÒsF]•:Ç÷CÔö¦ë8º–ÁÄ?©IåB9)9O÷³‘èFaßÃïWfA`Ûxeþü¾P7Xø#T©_ `ë…‘° ]"ŒíKJùPmþvè%岨·*ô&ò¦Ú­jLôˆÂœËùHˆ]ª7"k'ºxdz¶4ÇÍùZ&UÌ&Ø ••(4!ÓæbNÏ‹6?ÐñøÚbuà%¦ ªJ$ Bô2¼¦G(Ùü~®µËŽ^¢ jñ›·°Ÿ×”ë¼oúúÿÙ &ô:wµ$£¤BÇå ê%óDY’ɻҴ”™Íª©ŠSwÃEÞdKˆÿB­‰7ûNJ÷¿×:q¬—e*èØýÐTBHJ¬+Æôï%¡¯’”Nø'ºÆÝ13Ë5}êuRX_XúåÏ¡ÁF‚J¼h~z€_Ïó,~!̯¢=‹ÍN]@«]œbNØQ½ñ7 ÉenÍ/¡ŽO­ô§má“» •GÝ×&}©9$(p÷R¼·ßâçGF*Ô/Šs½¾Ð튢ögŒw]2î.‹åýÚ‰âÁÖ·Ót]oS™p³–ˆiç1'COl¶ËñËfµ7µæeg^‹¯Ù”4—¼Š‹¤c!g •+.OIöÁÏ&ßÃ<ƒšÔ—ýîu•\óíª0\ÐbÓ$ìÓŽìÝ¡ŠfMŠ‘ ,êxEhÓnÇêÑ ÖY¢Û SÕ£ì „ÎX…ÐBv†Œ(‹$ÄHM#›Ó·_´ôÏ4ì^«y’ùZ,ÄÜ0±lƒf¼p%[¼âyh5D¨þ´KýíÍ ™= ÀFÃŒô2—MÅÊžï÷ %§ÄWJØß Mîø¡Äô ~%œ\8þH Ê› ý;}yá]4_öͨ5”Nôǽô ¼$Áu¸L Ú –f¥ä\ñŒ—ó&¾ýïÑ¿¸9•aÆ`—6]‡ˆ+l+Yü)½ÙÜ”!EVæW ‰”xˆÖ…‚ß}3¹VU5|pA¼D¤¶ð¯d›[5,ßÞÂõ°õ5QóÍ(êÕñ‘n\êÕ:nÉã2PüÊPòÐxVû[Å3sÚfÍUT@vÐmtöi­ÒSØ‘ï³m Þ*þe'j¯¢> …ô·´³øöŒ×ª’s¥ÝCé2J3]á÷€eß’¥ý:Œ')rµƒ F6¬Ý"Žéà˜Þn¥‰fvÀñ¶´|Åß6ƒÏ¾Ôòµž\H®ÈÉ/«·mìPäyã Wõ«ÈÊÿ¼“ÿMl펮ô&óqË;ß›u¨9OõäÄ-!·]éÆâð“]¶E}W¹m=2n3Ý@ËǦ?:>UŠrŸ (¤o3ÕµAÜi˜s!ã”w6¬¿(ïÚò܇Q¿2¶q‹0÷ÕTÓmÍÆøøÂgwgqòŸ£Z:t;CtÌßÌeÐñ„CCó¶Á?•ןʢ÷£°ͬýìÛYou-æ£H†Â‰7êtŠlxJ¸¹Á}ÎùÇçÏœÌ+3»/ë4l Ê–¦1‘8zÌ,ÆR¶‡P\TlŒµ†=E öÂüˆÒBS—ñ”2…Ö+¹gºÚâ9Sò\yf9ÓÀ`}{Ÿ%é9®€w¹_nîƒNí£Ø…Œ¼8¿Â‹7i'¤Ýh"ŠItü²×àŽPBQÎÈ€°Ö4Õ%RU ÌqϪ}ÂsËóZ>í…—~ÇÔð`ºmö¤¬µ¬e4ÄI×,¹ºÔ AÛ-e{w¢Z%¶0ŸNf}\Ç==ò‘²:šÁ†õëJî²:*eòQNÐ>|—Ê$«NÙ¡WëÌ€cÍ~ÞÉ0³ŽÌ ÄH.‘«0 FDÂØëŸ‚„xŸýÝÈÌÓ×^¸Ÿ–-t¿;vF¾Þù¬( @Ü\˜¸¬¯²=Iòýle‘Œ({c«¶£-Iï߯5~ˆ¼·“.·çr,¬Ìç´Ž$°àMÞ{XË·8¦]·åAiYýÁÖã­èQè¥"Ë04ôKé¤pâ‘Ǽ¥þ?= öé Ãâ r¸ßqòÎûI4?„ñÙ2ºãŠ3µa¿2R°Çè-yÅs LæeE« °¥¤°Ü ¾û#"êf¦#øDYªNfƒ×´‰’Šù¶l7®•­Ý‡#&˜ãnáH-Ó­6ß1˜ áW‡Gw‹Yr8Âü`œº´­Ž®2 i¦æƒ©$xo{wãU91O‹YÅ&qn3p¬"ýe…øß‚xrºõ¬=°¾Øøã™ôú@žŽº /’Ž"MD«ÑæìœsÑq·¥Ñ¯àlÆA_DQz@t9¾-u;Ò·ZPYÑ?’o×4FîÈrRÙâÕWØàôšæcnñ¶ÔÄáq ”1ÖìÑz—ÝT›ý§ivY³›¢ÇÜè9ôÎ3Q¸ÅÑ Eø˜0–Ò{ oRã±›UÉ[pó‘š èsk·•/%Åï¹ùR¿0Ô廚(!ÓŠìŽcŤ$ET¼-)©‰‚‡?Ì›ˆ—5þ\Þ£`ïa^¯¡†–ž¿V:˜Y8Wt’T ê¶+ŽšÚ“ûh¹õÉÞ1–ž?Ö±±Œá=6ì¶~Ãj¡P›h)¯Õ|eý¶ è,™Ôj›Ò ‘Ï-W`Á´> stream xÚSiXi–<:ŠÊ¥â§’$E €Aˆ4éiIºc§YP•¼pEÆqÑÁpÑTÜEätE¼PDFpe”8€ îþ˜§Ÿçë~«Þª®ªï-»©¡‹œ¼"õ'pʉÂø ÈWæäǹ° È™ag·£dè.†ÝR”TbÎÿ‚äK¢0EÛ0EsEU2Àq7>g6‚€3ñ> ’°C€ˆ U2ì| …–Äb¥ô¦Øpx¼Ùކpà-GIL ã@SRTNÿQ ËÀ"BŒ¡”vP ¦§”¢|6;>>žË•,‚Œëàâ1J ÂP%JªQèÁ°èŽÅ°‹¥˜²×·ˆPñ0‰Ú ÃÄ(®¤£T8‚’€.,Š÷’ƒz Ž o>€Ãâô§ë‹Ö'ÂpC0,rŒk1<H0 BüƒX”†r0Žè‰°LIÐñ°Ædp M0Tï…¦›ìkQ)&1¥d)1™¾M¶> =i?ñ%är§” }}ŒDÅôèµì[ŽÃ‰x<á ƒÃ‰¾D¥`/Á±5*T(è£Ñ&Æ€-¥âpx®Î]PXÊÖÿf±Vœ½™î$1AA(€„nMÄ$(ýb$(a5 (R…&&|éŒ@01bÐX g d§Í¨¤ÓB 1 ˆ‚hr¤ú¿VÐRC\¦ îš-ò ò›5Ðu¿ßLJЀ'Zlè=!×¾#qpºPë+ç‹x!.!ÀìÞªéq}®\Ý'fßÂ8€Á¹‚ ZÉ(`9Ä…ÄôÁùËò7„ü?Õë³üá]”¿J&3P˜ýœÿ¡ÀrL¦í#Á‹Ñˆ¯ áhï‹PSÉ¿ö )˜^ o4ŨºŠOihµFbpÜÑiÓ­¹%fÂm&"8­¤ÅÁmmsu¶3;+r¸Ïþ w­-³Mž³lŠÎ#¾Àì=´JœÕ²gáMQðíK¡Õ%aÑùbcã¾ÞiŠCž0ªnÝ5z”Ûòaó¯ßË»ÙFS:N¼¹Õ~ìï鵪sNÛmÍ+”q~ÅžÖE›ìøžïî½Å‰ë’Ä×tU»…ÀñdpÄ¢·#NbçÓvùìÔ|*=õSc$Ií}üççê3rî¹aµø†72æäÎf›â‘Ñ*8º k}sV}TÑÜ«‡د¦¿—ùöõ¡àôÆ¿¸À“+¬*<®¶>µ{þ${ÀšÝ\l\“ûmUƸ*Û&+9ë6›¼”³ØzCѼÒY'T•Û¨DÍ2â[ENÊVÆ­ë¼6s¯n3Ÿk×-’l”åoÑ\- (>;:ú1nn3‰çÑøôî½3¯ŒÜt™;Ôü‰ýЦï„íOˆ ߸{%Ÿ²ŸÆÞéDXTFOòÊçä¯üA¾-µ"NS•Bv“Uʯbz>>®œÿض§&òЫɅ-'Ø£J‹Œ;Ìh#ïÝßîÎf>²|sÆ’H¶ß!©Ùª[ð{9pß³íß6°žÐ)-óŸGW6•%‡,éÎh½¬±“—Ã,cá—4£l{Ò®s?75nâšm¯x«³q<ãÐT­i+7_RåúntOàTŠhØcZWÞ~ËÜdÔmCî¦g^Ší.جÓÅu);þýìôNÎIsj?-yË¿L*-ÌÏ>Õ>an„¿7¯XIÍå²íî,o?nõÝÅùqÊ+fA72êÁ Y¦Õˆ¤•íÅš•Zûé‘RŸ_,%îOËÿ%ÕÌáyÔ,Ýà×5^³Z|±ãã\/M¿éåÖ°lø§;=›–[™VO˜Ê>ñlôow”!/÷j&FåX¤q+ü´º×ßܸ±2µ&lÈÒ±é×Ft45¿ò3ÚäSbçV^{{øº·Ýz>¯e}stcË9~˜hêáƒÇÃÏ8•É"ö©ÉcÃÞ×m9œî·ù¢e›M^GãDß_©2aëþO «Î;,é9«»È6›žy¼~Îêm&Õ¼³^’Ù¥kˤR:Cžl}`Ù¶·tûkßHïoþ»1 bkkI“ë«ÛÌ£ÓŒ; ·Y^I!D(üÑëúø.(ålÕ¶}¬„Ò?Úˆ  endstream endobj 3716 0 obj << /Length1 721 /Length2 7244 /Length3 0 /Length 7831 /Filter /FlateDecode >> stream xÚmuePX°5îndp‡ÁÝÝ5hfÀ ƒ»  îî‚»;K Lðà—Ý}»¯^ÕW÷O÷éÓuOŸÛU—‘VÑê®ïãæáäáŠôu5x€" #£œänï •¹ƒE†`€ØÀà ày°rÎ.>nö¶vîkÖ¿A€#ÈÆÞÉÞ `àìèìiom÷ôô”ö„yp¹yHrýiÒƒîv`ÄÞ ÓÒ6VÑT°(i¾(¡`7#@ÛÃÊÑÞ no †ÂÀ¬ˆ³ÀñŸ`í µ±ÿKŒëoPO°›ûa7g'€†‚¾Œ¢–¦>@AŽ[_‚ÚÔ•ÿ´CÝa¢Ø`k7§¿¦ã¸ÿ9‚þ‹¬þ‹þ«ºyÿqañðlì­ÝV`[{(÷_¾©@!ÎÁ`—KÁþè°üñ`†üa{8:j‚œÀ9g'w°@ÃÙìè:; ÿ²@NöŽ>ÿ_Þÿ0TÜA|ÚþqødS´÷ÛhÛ»ÿ±rücÑ߸!øŸwÑÛØ{8ýÓþãÇŸµq†:úüÏ•ÆøûBnYM=C]Uöÿàï²ÔÚÙÆj Ðsÿã%ÈÍæ?àï²6ÈþŸíùWÌ¿Ûàùß\äîfï 0rýµÀ¿Î¿‘Ùÿ²de½ý8y„…œ|¼@?¿@„Ÿ7àÿȵöpsCÝÿ6üÏ,ÿæ/ì ¶ÆZ[v¶ wøØò®"P¡h¶•}vÚò5û2âÊTÏ™)¡ý ÅÞ å…>e¾õLˆ•ÄÎñ¶ÊÅ':Pgbò=m”Ù2å] }¥m`íæƒNÁ}C”ù)Š…“µ&ÊYô¹{ÆúZ¨6Û$Vîa­ªk™¡Ï{ËòŽ>T‚­ÄÕ…+¨«3Q¦Éoð7ö‚Y»ˆÂS+©»¯kH‘ùa;8gŒv…!.{‘Æ—,m"Û‹íœ?•R"8‰PE}P>CIÔR£>âÓá°æGYC DžDxnJìwÒ¡í§#¬·SCåÚ£Q‡¶9U?^ h‚ׄ×3»/²S3uÏNÊH­éÍtX I|Ï#….¶Ûȼ' ÕþҶøQMÇö‡fªÉð¶à‘²]Àr²¹ñ"} Œo¯ÕXÙ3ZsɲPе+¢Tv\ßV´}[+H¾æº×W‹ÈÁŒ»CVô˜ÞúŒ·‰e9†Nä×ÄQÊ&€-m°ÖÜø,ªâmɲk¶EÐÅ™IþÌâ©^úȽˆ¬Åúü$ tA‡r†S¿ƒ,ƒó'Û$|Ýd‰ÄõÚ(C™_˜7$ÿüúaÉäó§Ÿ‘ù-£Ý¢ÂÐy²æ| “Ô»ÑÖþï98:I W+ØAÔ¥|"ˇk¥ü«¥9Ø>US4?Ø»ƒ(DûqomP^fáX².)WIǾ_ÅÜŸŸ *y©ËÑîWæ}p¬í«ÜDÕó•wU}L­º‹AA¹ømy„À2>ª4“ýQh#6Íì•ÛËYË"ÑÆSÕѧVnÅA~#„›‚ФSjÙ•ê¢N¹ºžv²›èøƒ;¡`Ø(åVvƒ«ÂÚV¨ÕbïÄì PN¾oj*àwm ”Y¥Ê;Á‹],¡{#mçGëõhœ¹¦'hÌK 3ù}¢¸ŸPXܺÇOí-DF/pêƒ&uD£.·Í'¥é>¾û1V ‘*‰°Gœ0_-Y{ÑM”¶ åÌÄæ£ú°]%ѯ Þ8©>áá@Ôb€LtPˆNðrmôB‹°Ãª1”Uð\zJçú5Àu/"äÂî'î&Ùt7µ¶<ùi¨6°ùQ‹7u¯Å”5¿xšHóÆ®Õwë›Óã@fHLôœø°“sû»›+ÄЛkL²Ñª¦©´:{q/Z™ÄÐâÉOz6œŽœÌÈ®ãbpvÎ;å¯O?(ð?pj.Y¢sw\ÎB¨óæŸ;_K¥#~†å«ÚµòIÄѳ† 5ß²9îíWÌß$[Á®7®%;q:NR àŒÑ×f±ú¦™ÍB>r‹û”_.RËŽHÙ1ÇnY, ½‰Œ J³‡Ú wØÌ/«ö géæë¢¨,Ãè¾nÉÎŽ4²Ãñ°ëÂÓä=oiH¢„¢©ùÓ(F¶˜½#Â?VýàQëoWW~‡›4Pm€‡%F:äR#´æ^K´BðÕåMè'ýô”ü$/*XóöÏeìa&ža¤«ÖWÑhºwgþy{»†ÈKÊ”Ü"SpE¬رÉ¥§Œþ¼¿É8ÁòÓ…ËÎ_[¼aNµÙ6;z6¹ù¾7—\"±Œ_^² É,ÌdÍ"yº‘ïi¶»Ìa³¢ ÇŒ˜ÍùÅ mœO,³@ÔÑ–Ó¼H¶o›b:;ΪÿȪ$ ¥ZÏDö¼QÖK5(ð÷qî³ ±¨¾öåzW…Äg^5Oin°M•&™V @tµÑ„Çk=înÒ4e8$£và>+BbG¦"“pÃæf #Ã2c3JîìÚôAÂúò1 MÐ-¢ºEÔ«w&ˆÊ ³[} bÏc¤AEP6£pRJµUzDC×€9ÆbêwÄù"g.°Kÿr¼±¦8§JB+N´<ÅF²]Èèÿä©ku‡?Kà VV¤ÖUk•ü±nrÍ^ÔW.ăCNGÈÄàbÞÂéj½}‘ÚW/ºªÆ¦¬ËK¿³™”+Q³QáÌŒ>}f¥ ®•v®æ×RHD“&yÈÙCvã•)O¸UoI£´º¯ÃL]  .Ó=ÝÌò¦+ßÈn{Ñ.ö³Ëy¸1¥_5GÞuW&ð„ªF/MY"®H+²Óv¢•Ç #NK"àfì¬;˶~ÚUd¯89"GšmÆÍKùœJѪçUÀË2ZÇß°Jw “‰ü}ùs¥mv½;2´{‡¶¹šÒ¬:†ÀDCš{D‚ñD“°¬[‹ìTØEÉ%W®B  Óƒ> ®Ð«ï:Œëò]•Ž—ˆOsw²Þ[c¾¾Þq¶ºe¯kÑ ï$*¨€`ÇÔÿ0ÔcSaötK©¸·)yðq±«Š?H²PäÓÎ~ò èµXH{ëiÿŠÚ»ºç Goí‘—ýóýÜ$~iWå£XRú„¹^ËÜò‰$Üh¨«‹1è}–çj‹Â¯Onq/4ehp¼‰ûkßûq-ªÜžG†ëí›^hÙ’kåYà#t>•GS8ç#E«ƒ²R¸Æé2]¨Q­‹übî\©ˆJq{³zËÌñ4ÖÒæ¡-ýyïÔ°Ó¬}ÐXݶL_KE"l†Dgz\‡G£ÛÛßg¾»tµÍxô§héôòt=`ç0ž¹Ø`©ï즈‘Q¢Ò[®p+‚>0mÕ¦yç¼Óˆ¨ :Î+ýÃ$É÷^¯¾0€æê˜‡×5“–éßКW£Â̈Q›$nä™ìèª)N‡¡„­ö4\óÅ<ç ÞÓ{U–=/µ÷@~ËZº‚„é.§ßàa oÁ|lŽhæÔëâNzΤ@a=>.1=×¾T}v oB‘\^îïß½NiC5Þ…Hˆ©¹ü±¡á¿ÔqϺ°^¦&m‡îb(WFBaŸg;×"í”%/"7/Fì$òc½£¡‘•—ï´SCxÔÏL±ü˜úp'êœÕ½çG}KÏ̺ÁÆ`±ÝZ½Êh¿¸¯Ì€Ó=|Oü1C5ÀùºMá½Ò§%@ŸÒ ý©ZL$,e–ç1å» ‰é×ëç´K5¿@îËéŠ ´”î´Û1ÌÖ£D¤á& 3RHJñwC=]c™ôÇ 2Ñw»?-vzüÞŸ2«ÂÃÙWуaÔÙè$ü\÷o;B¬ñ¥)æ¿1„p¡– LÜP¾½¾¦~– º5 ½ØÏ07l2ލÙ}«|“ÖàŽß¬J•¡—4][˜'&p#ådL¼‰]†{Ùåð8I 1I×/'.#˜þ®›žÞ,¸ÜjS¼BI[ Wô`^þÕ—ò«Ü-Ò+I®Ð§Û?ÐÏËg{¢¬Ê–ÏÊ…7ÙîJ¶êûÿýŒš¦ ‰šsÔ_%=û±N ÆxxrVÕ›ƒa‚Ž­(<~êØÊPîëJE;ÓÕÅy>Ò‰gžn_›Ó%ˆ„¹Z¶!)û‡îOÞ¾ò®¶&•¢Ò ë½ òáÓZW³r¦e˜eZº¯§»¯“-xÙÑ$¯§ÊÛ·<ño¤¹ž€Uç¥4,f]÷4 oõ?Å1ÍÀ£˜>0‹¥QívwÑ”|¶ãPHQm=9à}Þ¾àxññ¨Â“ß‹@Çã ægË5B§\ù¦r›í¿P ÷ê/WôP;Ÿ·šé(h……ÎIÞM ¥B/’Vl>>¥#Êg-s{Â;{(]âPûÖ×_–Žzéæú|Íx™ÉD,†´SÓv2³¦•ë\’äÚE4Zíé›EêCwP‰dOÅ3Ž'™Í&ÍÕùÕtY¨5zRÓË“. È2E˜êèUè®hÈnwñÛn¾‰§äÂ.K¿Mk¨PUy R¹ÎþyXœ &Ÿ]JÄ÷5«%|ó±i–‰Ÿ§+5V&úñè•<5–ÔS ¦Æ<6›zŽ Z°: %„ÌUù›²W‚ˆiÞLŠ‘”˽rJ †‹°ƒœ"4–É©˜¥u†Ízþîû¢Ä æ6Ñý™ò^ညŽÌñáÜïÛ"ù¾þÅ„ |?Û3Qî„Ä Fß’Ö+ÀÏ1£ñ5.E+<Ø2w°…µ¸âò2§FmI+üSÖÅdïšQâ‘…‚hbOrˆ›:©Ô˜KyQêFH+K-”,Íö>;G<†Ò[©™hÐwXÈl¾oÃðîBiðm-…¾yµÛUctâû€‘t&Ä5^¶¾,c "´ÇlaUpÓ\ƒ‹DQy-†Nmô>xàš£z90)zn'Œ‰9‘·Æ¢Ë—ÏoôJ‘K}tÜt¢yžg8xÂ!!àÍÙfFzz< °R2“œøíÇšÜ2r?˜B¥:Geœ€'òkøƒ¢p®ø8gŽ '~<Ÿ‹ÅyI¤ZrX`ƒäµ¢TowB‚æÛeÒ‰]Ò‘¯¦ã]ø÷Cu¤sôdÜLa7ߨ;¡¹ºº¥¤c#ßzËyá[ðÔwQ^£–I¾SÔ©–!}zAmÔøÂhH±÷Å+ò[Ó/ ýÒS8ñ<I ¤BšF˜Wß ö«Ûè°7é¼ï³‡£ ° Ý©OֱŬ?å¾×|ÈŽ‰3¨ß€¦œä0Љ,ý:Àñ€¡¨ô­È$ÀJNCµfÞ•!|7bØÁÃU‰êÃ(µ”bXÇ}ÞÉ9ÓGpI²ÎâF̽²ÃÚ> #áøhëdíIY–Fg³w+ÎrGÆd2I5ŽH²Vݪ¶°yÒÃÞ¾1ú²ùì8¹‘Q¢ þ‚ ž!û›óÐ~;”çS>%¤<¤ƒqÀQ'êFVÝÈ…^ý}ÿAÌzÜ1މּ …É ¤õ~k¨ÖÔyŽñæ‡upŠÃ9þêNHÕêó”ÓÖÓ0æ&§¬BQì‰Vm Ó%­ñÚÚ3ÁŒ…©¡j½hÚ´>dêçÌ`rù|³Þädµ˜j¸dül‡þílí´™ô±Š€O Eâ·„ÅE#oÜóÐXÕi{5~-9.EÆ>?Âðig¯k~ÝÊ´‰ÇDkÊî+²¨9ü =gq§—”^z­™Ýe_¢…µ¦âພ ùÍÍK&×bƒrfúiž‰Y¤*±ßÈâ×m#cýÓ”Ø X¹½™G8·Oà%Îa«\Gå3BœJļmÕ( Ì¦ü¯e˜Ò8òÑÿˆBå@žEK1ΞšAu*ËØ—C^7–OQ{ãÒ×k'PÅ6„Ì¥›k 3 U´U‚!W´Ü„—äßÙ£Êì°VWu˜P,šî‰¥'óE°tn³-n5ñ•dÓ&° »›³ì»°Ê®GÓÜÎd‘f\F'òà“ǧ]köÅ]»wü˵O·w&¤2¯[`šJ'¬BdåÆƒŠÍÙº£~ cÓXÿMã%~¡D2—KÅúµHz*ˆimCß2œ 5¸FÂû%p6E+RÁ€"’6 b™½BëTƯX¸'ËFÎ)¹¡{>â±nÈ•üœÄß:9â¦?ëäÕ²)&烸X¤sÍÁ÷2œÓã«`_EouóŽ:¡¸£ WÂ¥²X.ãlÒuzc³®¾`B«×»EîíðÜ;HNZ”þ\2vß¾ëhú*ƒ€†ê£IAxÑéÉ>ø·¨êa!,?€€[T_œKôÝÑaÏ]ª›Î”QágζbÕSa$¿kd}¬@^üwjWÈo˜ºÏÈP`®#ûÔ ä·¾< ¡'¡ÌüqŸÑÊ$}l¨}/ —†–Ii”,n_z"ÊÔM4Ú¼95ª”Qßa¸ol÷¯ „ÕZ•ºUQ-ÔÞ¹} Ö>€µF¡}o|Ï[ðQÒ­¯áy¡\(ëÔ©‘²ä‚“Y2øÌ˜ªßè˜^Y Uøaù¢‡ª†¤ƒ‰ g“ÕC1äxÑÚé컨…94çŲðœQL&±+"è©“ ›Úß"Œä=}ß²yÑOÿd¡T‹¯ l5üÊŸ³×ýÞÙ)¯;¾æñ¡{â^G?²Q ý´ëö=6©,¡a³A>$™:5£:ëÏ/{qOzL±ƒ(ÈÝ:ꊳ?£ Þr=v ÏK»Á£hb–ÿ0‘þ¦‘xf[‡mGS²ñÏk>}`I¦á‡ó ¨6ôKàHô=‡ï^£ÃFˆÝ•ooÇtîh|ív„¸šÃOm ÿP³½Ò‘œFtõl•c¿›^™¶Ü„ÝÚÛ‚)IóD×£ÀÏRI•ÕyCð—ë4&=ï›}ø#7ãE~]·¾ïîSÆ9öRyp4SÝÛ+X¤Œàô¢I…F›‡ù~€ëë7HhÜÅ6±h÷§þŒ¨­—©‹SßW&N±ú`yò T"‡âßX=öáj`TÎØï^Ÿ@Îá,ÿ]{,MÞœñih¹AÊéx\° žT‰Þì ÊD6eš5ùå3º²ú9NœÕ×òàíG™æÁÅ•¡Ž.ü¦ÃˆaHÊzÅ œ­ýjaÜ®Öþ–ú¶ïd»ÏÇ ¸–äfy¸(™Øšl >ÑÁöâ0y%ë%íw9ðúGà²ý;ä¡D°]kž{œD˜ûÛ÷äkß®›)ÕÎWÈÖãûx ü_ßÙÇÜ{Õ 6” 7˜YhD\씄ÑÓIä}–ŠÎ¹øUÝÕk㢹¹kIËÒJ%1_R6 —1 ÐÌO½6 tŸOq¥ËeÏÊÓd;U佞›Å~(Ñr¶àê*íœM¿;Ó¿`dÇTÒ+v2j²CÊ%M/g5½2"rZýÒŠK Îóá@oõÙÛEê‘Gòm¯¬Þ×·ý´(CªûõÙðÚÁ–ûmÚ¢*^Ä|fêRG «,ú$‘_Ùúö)©’Öl2‚U^×.TzÊoW>Zw }'5²¯ì,¡mÔâjŽLÑÊõtO‘SÃíª ˆ†MÁòŸîŽÎ_¹ùˤÑ}²ŸÖ þ¹Kœ±©­ºñûB» vÆoìe—Rzvª£öΜP|¥Š÷ª¶mÙƒÍÿ3FspõfiÌB‘sŽ{jÄU§©VàQ¬09Ìt§t\¼™*ó¹_DáOx5¶q©ºô»L©pímùá¾BËÜVzLÿ ;Îö<¤íéýá¥RxOáñœê`"P|Æáâ R$ 3¾JȺWwçEtA\ªX±ÐưVªâ€6F·¹i$ï72AžÀ|JüÁ%þ"Î|W¹v2¾ÑÂ#ú‘º±cR‡í͉ㅂƒÿ³–£î„ç36±‹Ï:¾o´È´îSì•<ÌX€NÓYa_YƨâæºLHA¢;¼“ß•êGçú˜–C%†Y&Êà5/ªVï µù‰ŠûhVìNÌ»&Ôç>9IXÔû‰[é/€Øû"vÎU·mÁBÇË\µÊbf*ß‘nCh¯O uörúY½ý}èW+üý7„«ïzhÄ=òmâ6‹°Påk{ŸGÍb==&=μïCƒÆ×È+‹øÅ8áó#¥/¦n¯”›UœÆ²°;ŸùÎÙËy³ì¡Æ7‹ò£1\ù€5NæÒÖEÉUœÄùˆ^Y¶ ½"ù6LÇ=Å5|¯~ñ‘ëL_ö_˜ NÓ‹—Übx´ZÝÝ pxÑÚqX”ô }´¬ï`î§ ºñb˜âm#ªÅp¨JTÞX“–Oßd/÷ÏØ†}o°W2°~ÿžQÚ¶ºÔXåþr°Bì-U¢"vúkÑ?Xìí©-º ›vã"YÅhkÒOšwxñ€Â}ÿ:¨’š»µÇÚƒ¾‘ºŠBióÏ=€7ãFèxܧGú`>éœ@]6²/8Hé€ÒáÝÁ'¥v.`í5¤‘܈yÍ…_ÞÒ ¼D¹ŒWƒyWødoÍXøÍ«ãΤªò@Ñ=D_‡ŒÐ’%Ñ—ç“VVLö7i¨Å—±ŽVÒZÕÖoÔ¢ÂÞV¥‘*14rȇ…¶VäõŒÆ xIÃ<ЦÚìYGã¨uï;À‘¸´¹ìÒ­¢ ºn¬ÑɱX±ÍZ[¯ˆ}GiÞ£Ÿ)Ïîu»øÉÞ#YcR5¥!2£‹5#šæ-‚ÍŸƒæ)Œ®1O>˜á×—&%O~=Û%×Ú9½·´!] õM/6©~XÀ%Þ6çbw1pÊñ+ŒœìôGïB›Z¡‘Þ»e3Žžz|a&yº^^©;)>VÏÍ@É\½˜W½Î äÝdk `ytq–ãÜîgUÿdl½i¨&ÌéøôâfúAË'«¤ûFwäàrÕ²Ð^öæ—bñ(ÎÖM¾Í½ÔA›g¯ªšd5|k¸ÖÌhßf>:`ÖÀ»S¹ñ©‡;º=Ñœ~›Ï˼ôÌíw·@L“œîGX-™é϶ðÀiøÎÕJ–§Š1?a¶]°ºÆ›ÿè™ø†pÒÅNÿ›tŽ«é×¶w™ÕŽÞ‡p.¶ÿnÑé@ endstream endobj 3640 0 obj << /Type /ObjStm /N 100 /First 1027 /Length 5229 /Filter /FlateDecode >> stream xÚíÛnIö=_Ñ»»îi´ 2$@ñ`¼ãØÛ™ùú=—j»ºÛmìÄh¤ÕH¤\]]Uç~©SÆÚ)SˆB;e )v\¡´ÂŽ/´ Ø …q;±°'kQ¸ˆ“µ,‚”ØQET8GëB ö g`G‹;éPHåh>@Ñ{FA/FìÁ<+p­‘Ð3ÔƒyÖ!pã ‰ð ç±Gc¡PÒ€a"ô¾µ¢PJ!*VÊÒ ±§ ¼Æž-ŒÔsÐSÔó…ÑÐ@HõD™… aÀöVÜÅÉÂ*ÂÞ©ÐCÚœ.€/4f€)†ÆláµB €h gç¡G´YÁz‹½ˆLóÃË"F+<òs¤p×x ]D‡ìòت$î$ÊLáÜËdÐHM€eJdE€eJÓ–)ë ‹°LKša™Ö‘‰(GÔEX¦ƒ¥.,3J/`™±º°Ì”™() C–Y â,³ {ÚƒzH,`æ¡‘ÀÜAÂ2¯Â2o<±TÁãîÈGèÁø2‚ U‘Ê @({è*€r@ªíˆd"rqÌFó4 ,þ¥TüwñŸÿìÁ¿ûÁ´¢ç@¾ ˜Ö÷´1«aj±˜Fôx‘Lãz û?¦Š=J¶€©]¤ýcy+Cìn > ?¦=Pë%Liz>Ä 3úž‰a R˜¸± 2¸^X26êž•ê‡ô®‡±‚TBà…èRX¦W=pÇ6âwÑšFÕ ¢S=Ñå TÈ!>,>@:â`ÏWEyþî}A ‹=ˆ“ãÛÑèc5ïp2žÓ^‡%O?Ô’]9?/ü 8„àìPžL'§À·(OåÙàë¼øX'û¤5Ø+Ð`<Ÿa~£q=R:›ÜN/3ÎhìùàrØßŸ|e~Øh{ Ì5Ù#‹9éOaÀA šŸSkÔw©m KãÀj݃Ìï.íǽ*€hàSKðfî}ù…}kA#ïÕ¦=© Æ4Z«tÏU#„ä°Êƒ%BÞ Þ˜ŒƒÌLªH×ÊÅL#,¬µ¼<ìŠtŒ6xÇ3x_^Ÿ`@„w –²‚Àó¨yX‘ Aú·@>'§Mš“Soq{ÈÙi²ÒjDÔÇiž`v…¡9ŽÞZ÷²Òœ4N;pßñ*Þ3.wã6ðœlÄÒ|Æ5×’HÝ —-ŒYrŒùoÁ÷C¦-zk á D$p¯#bl‘é"÷Ày}QÁ“†7€õ-(تþ&-äIa±lÛÅm>ºßä°ëojKëcB¦NíšE3`¤í01µÕ µž„Þjm`…Ã6ךÆ-)Yrj!œªÔzºÏ­Uô–ÛlϼõprËÿ £æ¦ÈÑ>©ÍW9¢²Ý²Ûv 4"‘>Yij!Ç?G¶¾¾ lÿ´i~Ú{C²a\⥔ôØNŒMCÒòǺ'A ‚õñ¼kW+ MM\¨ƒ[óW¬xœáíÚ#5]Êu ks¾òZh@W½Q8nhލE2’ºÔä;@°N)Ú-` :<…“~’¢ùxæ†!ÁCŒ¹=´žÌ \¸8ñz‰.Dzã ÞE+ÒZ£)bP”Xit郷¹uß§Í÷ìr{N"·àè‹­Ó¨ >¢6¤o-I¡|Bàq²cáÈž '¶H¯ûB‰ðÈ‹A¥ùDÖ‡Ý ›9oyÝ9öQ¼¡ý]rÜ–^›Â@~¦kms†7a@€ 4†DaÄ( Y’ZdnEÖ5˜ÀqgRLÐäa±†R2MN ¬¸=‰Ôh‰jã-ŽxJ@E +!ºOƒOÜZˆÚhÌœ«Æ 9Z½xwŸ6홵 1 × ™â} £Êÿüíä¹ È“ƒc7Ç¡.¹*DOðhûDœ±}¤c„Én‘›TL&_Éœ‚b`SuW¡çÌ/·K®pÍÑ*¬ÝÅoÚQ â4Y]@LñÛ,GÍõ$°až±':suö C’Hs:¨ƒü`Üa½#œ<É’SÒ’–HÒ AEeåñ@í¿ÃyŸ½Yß¹‹tgãelJÍêÑ ^C›ÓòäÊ©Š¾w‚3;*Ÿtñ”å~<ƒHåd'ËæÒÁ”cSDmqÖ‘,U…$ÝÓÐL¼y¦Jß­XÊV,Õô0æ*ªÇy:^àR1mq‘]?_Ö ¡»EžèȨô J§ò‘¦‚Ø÷ʾ9Ë’ jµ÷sÕ¯;^¿4qJ–ÐÍÃË3XÎé2™yÎÎVÿ¾©¸Èðo§át»#²²CÓ³ýIø?å•[^Á]’~;(„r«éÂTMZQýru‹áÆ2>žÊÐ|Õê«÷ ]è¤4:W{+º$” "ÏæþrVJ²Ù‹Þz 7iÓŽfDWn銇hõ1ÒaCEn Ëp>”VƒÒál s2…|ç‰õçHßç¢[©˜î®#eå6õƒŽt `Öǃ34/ÁIr—[–²B897rЬ¡B½b9Ñ'§ë™|q´&õˆ-°ThÝb.¿7ñ0¯WÌr½cq?µ¨%¬R­ÃÇìKø½Œ‡ƒÙÅtx3ŸLù{/ú×ðæõûóûû?<ß—ÆGý«YaxÂ>}qâg`ÓÏŠLUJ4Rü¾Èì¿7¾w¯<èß< ¯¾Ìñvh¯D(øîg‰/æýÑðâÁøj4(`ûÓùàú Þ–ì•çiØìñ¥?Å/Rü«|Pî—åÃòQyX>.Ÿ”GåóòEyR¾*O˳òuù¦|[öËOåEy1MÆåe9(_/FýëòsùùsyU~)¿|»ù2—Ãò¿åo娼.Ç夼)oðË£Áç9÷¦¾ü½œ–³r^Þ–”–_ËoÿfÚ‡€±v¾ö½ïñòdÿôÙËSäå¹T«™i52ï uÜ3ãÌ|Z>+‰¥/L=_°õúºl½¦ƒÙp†ü%N Æ—ýÙäòþý1(?On§]üÇ`úÚÆß ¦ÃÉ%ðÿ÷ÛÉ|Àc(ŠÙàØk6ü B™™åüÏÉR<å_å_ƒé¤!%µ”ž?=)œtè¼4•Ê{_—œÆëRÒK)‰y•IHË»Hèmù®|ß-!Öûa]Ý™Á õ.ÿj°ÎlúGÇG'¯O€uλ¼…BÖE‡—Û¼¸WKÞ‘³Ndê g“ÞßÉ»…Z}^eš…OÓþåð¢?Ú_va´A¸Û†ðÓ7Ï^>9Ÿu®nÒ„ïX¶^gÙ?£†m¬8¬6O“Êä&}*Ó/û£›/¨6Ÿó>êΗáR#ó†èªãWÓAìq¡NàY?]öËÑ`6Õº¾Eã¾EÓ¾\õ—jvßÀ¿Ù0¹ÔÙð v›Ðg€%÷oÁšR¦‰ðØIØF&O¼8;g™tx[-+™(·#™8Û­ÄŠ:Ia«r|üë“'‡D’]I‘ö‰ m⎊¢“ !ÈÚ g+WûàìÝÃóçD_-¡J@ÒËÑd'=OÉHVÅåÒÈ HùWªþ êùzÿºB·ÃVŽöä×£ã³'ĸØágã"DÙ]¹³joåA÷ŽN17zÕå@¨(÷ÒíEìpqøû˜DÞŽ¾¿’;=%)/ó$ŽÄýkàɬ?¾,û3Ì_f¿¡BMû¿ æ”ë¤>g6UºZùÞFR5øý¶?ªå±Ÿ)ËJ‰Öèþ¹òjá«G·3J¼³ù¢ ìòÓˆ–U)=Ƨåxž¦]™¤e¶0„ Ó¶°•»öøàÍé*íp%•þha¾£?b#ý ÝúƒÌ^Y§*nåñÞ?=yv„Tu8HUy|©ÔN¬ÂwSÅjHŠ´RPo–Âm 4nÞ¿x|pBípqzáâ´Û éÝŽÍqy®a£‚¿ì<²Žò­¼ûÃW'oŽå§Çß=tK¥ïåÞãrÐ8ƒ¬:!âù0ót™+û¼Ö=-,å„‚g¤ÓvƒÑÛ……_Ïö_£»Î øŒ54,¤ù vÁçn fÂn¦ÃëAƒ¬­|þé£óã—¨?gÝ»ðùfW§Õ°Uéi]ip›Ü–T§‘Än"¶*n—mz±U yÿðÑ£·Xéê#†£ˆÕ÷Š"ÛŸVºÎ)ëN(Ã!šýí5÷çÃÑå`}ús”/ˆ”yÚí@6UËÉh›,N9ãM¦ËrSC/Ò©;oƷן€˜áÕfʲ8áðY殇—ͤ[…É''ïî?cÍRÝE7ýøöþšÕ]²:]âªòeVFΊÈÌÈ”Aä6VgÜ*–žŸ¼|÷èˆXБú»d[F½9°&ñoÛÖzËê:ùïÐzþ³Ù¤@pÿrÀ†%·Êžï¿}üè§ãƒ£WǺ³~y?}áŒ~š¥bu]MtÞKd‰™¨¥eRÀŸ,û¡ìÇU[% û/Nß¾zúÓéá«çRÄ®šGÅÏøã9Ò‹¿“™ –/òœ!n”RÛZÆY#m•V7(\c/&—Ãñ@~þ ùâÿ‹þ8×.7ÄT.Ûôc›GÙïà ˜ð~6 Ÿh^a×8ZЯÑo§³9RS ×8îW žÞ/ç_füSE4ùlòz }9(äj¡­C¨yÜÂH·0R5Œ|ŽQÜF­;ÏJ¶‰§:P2~(5ï[ù&F"GHê !{øÍ+½ü¸ÚØíhÞ_5-½µ!C–ðÝöð—M-ðm%¶&“«DÜÆíP ûˆ\ÔÌ´~ÉÒ‚ï7翹ÿ7"-ðq­þ«\ÿ]ØAÖ ìMtbKñ̼äFn &l½^oAo)£É¹árèVo½^‹nAo;Çš&Ô|£Ý(šâB-Õ4õ¢r~ìÂ[· «-œâZ5prMœî ´fÁ±þß:ŒLMivaAÍa !½>¤årþZ\/µÀÛuàMîϬ¸C@mT¸Zàýw²žùº);8øf§…QKeµ®aärŒÌT¶yøob$Û*«»“¹ŒgñBú;,²¹ÖÄ Ô>÷´pZ¡HkJZ_Cø‡3·w€íCf ¯–}…šyç¢[a_øÃf3üe³[<½-œÌË䛞 /áàD@Šôsjì¶àôÇ¿¡¦8òŠ/¡?Þ @Ô¼YäP†?tŸ쒊È*ø4÷Ò&!mÊ¿ü¡ªŽOyb`µ©¶‰©£*ÊVê•6÷¥+ŒMÓT#¶‚i+˜l½wå*ü eú™ª“tB$CÇn*ÖA…j¿…ˆb¢J QuÒ)å=@I•h'¥I0¥O T"ÍQZÜ”² ue«ý*[R>iÖU¸ãîÃ@# ¦‚`ù.:pyNÞ‡*'ÓÆ®BÝU,uºê$³–É ¨ÿ1™ endstream endobj 3720 0 obj << /Type /ObjStm /N 100 /First 933 /Length 2090 /Filter /FlateDecode >> stream xÚ¥ZÁª%¹ Ý߯¨mK¶$Ã00²IHBÈ.d1fh&¡{&$Ÿã[Rùº¨çΛÚ?7ù{V¼LÅ‹j«ñFòõy¿àz~¤ò3{aSs£,rÞéëójÅEõ8qœâ”GÃþMËw4|~ó9|LÉ]þÒúüæýÿÚÜãd¤qÒÕPÌ"ÀxS~~2û W¦·¹š·¿çg¶¯ààmähúÂ1vâëÈñ’z¼+G¶cr®ÈŠ-¸ü„bé´”—u뮺ìŸ~ùùÇO?õ¥¿ûôù x“Óþá{\5ö®ä¢Öcñ§ŸüˆŸ½`¾ƒéç‚ÃN~ãóÇoþyἜÇò´\üãÇÿ ¯f°Ð `ÑKßKi»ò,fL£ ìX펥«ÕùXmµ:Ë«'~´š±ò8—%MXW~å¡wN+¬4ɯäNCî$K¬2a]©†Úé µ÷Õî×iõ¡¶5[%ÞÚ,‘?¼þáç^øqÌÝ ÿ72súÙ9ç¬ÉéyÏ/+½  8½úè÷ñ¸ró‰ÓŽ ™-7„ÉkŠ®°:Àæ«Ýÿtµz¤HmµZ_7„ŸìNX:¤×²Ä¢ ëÊ/iѴ’׬„—3– ¹E®±|õ•¾2ôZ%Ëߡް¦">üÜ Äæ"®gΑ•zÊJ½Š°åë¬üáÔ®œJ¯NÅÕU[GJê)%»“”‹^`e$¡Èrõ”’z•’2RRh‰õÚ£ÞðkHͶÂâi”« 0†®†îkÚåjŒ lü†Úûê«‘kcäÚiäž "ÍjËTáæ^žŠ·ïÌv̉×àU¸c0Ûi0ŸVOƒÙ®³Ál§Á|ÆšÒpé×ÌvÌ'¬i0ÛÕ`¶1˜í4˜Oi¸Å6F±FñœRiuŠjÞñijC´nCc~ëi~$OJ“›Wë˜ÄÚÊrõ”†”®°x`¥Ö4¤¯ýÓWM–Xe¢+¬:°h‰õÚ‰ÂËÖP[—jO£X¯F±ŽQ¬ºÔ~Åz5ŠuŒbÕ¥öÓ(Ö«Q¬c«,µž°®´Ùݱò «¶W,¹Ò>Fßwý¿–XuÂâ ¬h¢‹—X¯ç…ðò„EV Ðk¬¢V½Àòñ÷ĪK¬I{÷ò„5´/KíyÒÞ½/µÏ“öthÿ?`.º4 endstream endobj 3731 0 obj << /Type /ObjStm /N 100 /First 884 /Length 1827 /Filter /FlateDecode >> stream xÚ}YÍÎä6¼÷Sø‚Hâ$ °X`O‹Eì Ìa 03YäñSj[¦©å§Ã×m·©"YE¹ÜýÕ,G:jÎGÕ£¦zd)x§£”vhï%Æ»¤Š÷|°âóViø¼Ñ¡ŒÏk?j)/­rÔŽë5­âºÖ£KÂ;9år¨ô#ç,‚¤TÉG.µ¹©ÌŒU„`ní¥„`EMJVELAp匷ŒåÁ­# å®ù(‰Œ®JÆ‹¾Û*åôUJM/Ac…šà3¶,©ãÁZø4W´)\ËÑ^iÔA¥§„ƒ¢Y¤á Ö—”…ðI:¨ŒK ŠˆÌ¦@ÐàSÁÂȅˤ1ÁÚ‘åR­ÎnÜ^’ÜGa9œFö¤8™’ÊÁC@†<äÎ ¹#˜^Ð ³à¥!N/qÒùÅŒë@­ãoêˆc\× æ "MÅÁ»Â*È ‰y” a™GoЊG¨ìÅhPŒòè_0ŒÁZe‚P ׸„1]ã÷‘ B<”5¡0SVR~Ô‚ù¢>&e.+c6¨ÃlP‡Ù ÷Lb6 jåkªÊ Å0µŽ`Á ôJ/‚x51‚ñW3&“° ")°]ÆÐê®Ðr{ÔÁ*¿µÂ‚ V‡øØ[HH(¥VÖ×O?½~üï—ï¿}¬b÷ýúúñ8¤óð—O_?ÿþý½çÎó¯Ÿÿ÷Þ ï³ÿ|þë;ÎúûìçŸV¹±Rßaa+<±$ÀJͰd‹E+GXlXyƒ5î6¬«Ê+M,hc]«éÿWýt¯^Ù~òÛfÉÿúòõÛw+ìߟ¾‹W ÿüãO¬ü¡èšåÖå²P¥ôlXŸä5]’Ê3©¨KÊKÎÖ,ç¢×Lr¦l/muÞ­®O…† X¦P­[,qXQ]Õôª´Åzª7«\°Lí;,­+تƶ~Àöµ:G«mÍ»ùwߨÑk>fïù˜ZÌùXgRMYT‘¨C1æÅ3u²ÅÕ%ÏrŸ]Eå5‰I‹$í,»¢ÈéÕà]bv%æm‰lZñ²3(š26ž©îJt÷à•E¦g‰óìƒɤ¢e“Ì$+Ñ0’iPúnuqS44Åô)²År›$¬«ñ%ï°²ÓºDsSL”\·Xî–T¢[’¶æ-Ûΰ52l5ÃÖô÷×êˆm³hM»Ý ÎVï½qZv»á’uŽZ]Sš(‹“Ï$KüM¼ôÝnæÚM~7$·Òv7ˆY¼,'¹X ¦N̺e±n_¢ô@1–¶UD=–Sdv¶;ÝkJ¶”‹"êÚ÷iË}rÜçˆûdܧ÷㇠V ¸ç~sÏ]·XŽûT",1¬²Åzr?«\°nî¹í¸¿h=±î¹UÃâ-VqX)Â"Ãú€ûsu‹Ø®ÆvÕí-Ö±=oÞç-ö.ó¼Å²ÿq ×5§©RË6§S¥FªTSE?°ˆku¤ƒšÊÛï¾îfv­¾ÚŸu^ßáü3RÎkRlqç;Ë™3òD6wæÅ×ÕOÁ8rg6wæÅW,'D\— ±zµÇb'‹D²˜ ój –Ûm³dæ-ÛÎ’9²d6KfÚrï,™#Kf³d¦-÷Î’9²d6Kæò÷×êˆm3a.ÛM@Ý”ºM@ÏMÀËcV_sš*‹YßIÎî#ëb³g^í9Ž7® ^³9®çCÇÕà|n8œgñ?6§æÅ©—”Î]ãòÍ©yuêÐõÌ9íÈ%çÆwóW»óâl7é®]2ӦŴ—¡‰ &³iZlz@ªN 7w;gÅÅO ¬9oh±ó;É™2²M2§ÅÀ×ÕOy)2p2§ÅÀ,gçq]fç´ØùŠÅ+RÅlš›^±ž»†"›&³iÒ-Ûδ)2m2Ó&Ýr¯ÙaEÜëýÕž¤ï°ä9x³J%Ͱd‹E+GXlXy‡ÅÏ_Óf• Öý³ qÝb‰Ã ~V!Vâ-–ãž{„eÜÓÜ_«ƒŸUˆŒm’í=#;º»û·Ö]çûž1÷ç}—£5©ÉB‹,ùù_*QÃdB”º]í„ HˆbBÚb9!ÂºŠ ‘û+;YJ$K6Y²ÄX×ê{ìÿôëºa endstream endobj 3732 0 obj << /Type /ObjStm /N 100 /First 1013 /Length 5088 /Filter /FlateDecode >> stream xÚ•\[s»‘~÷¯˜Ç£Ww •J•,Ú–lKòJ²Oj·Rª‘8–¸+‘ Iøì¯Ow ‰á ýâ3}ùú‚¨D UÕ•ªC%„­”Sª.à‡®¤÷øa* Dða+£ˆÆUÖ¯œøªPã’®+Q«ú | àhhNVBO Ìu­ñKWÂH‰_¦þ/ ¢-ѹJø@«¾’5)¦C%…B…L]IiÈ0¢’Ê£nFVÒÔ¿T%­¤/°‰áË€-ùB2Ú$‚ì2ÀT*ÔRwà?Ú£ öÙW-2¨Ÿ…mÞÐ,je¦šÀ° h¥u•FháËWZKÚ*mÈWWÚ 2œ¨t´”ÔÞ£ §*ÍéÊââL !g‡¾Ð¨©s•Ѥ³ó•±5Z`L9_WÆ{ 2@5[kÜ ì­THÐYM^ðº²VЗ©,nƒ/[Ù Pgï*W;𧽡·ãü(9Dåðø’• „)€í#Ή—žæLåµD¯[yà*n„/_óу`~h‘¯ë ¦ÂøUÐè(_Ë*X H$„à—®BØá âªq«Ö BDÔ¨ |zP¡hF¿FÀ¼€`&H†BÖh¢ÂÊİ´>!ˆc4y€I(鉤)·4}‚4-ѳ^€4M!ï%H3u þñ¤E†G„qõ^‚4[;úÔ˜(’>1gÐËð‰I#0˜=@& Þ=~‚4ðÑ‚4`ƒŸ ˆðÀíÍßþöæ/7³õS ) !ý¯Þüå³!~~m–í|Y]§‰eû•]´?aj>Ì–+Š4üÒàH©8:Y¼£·æÍßÿ¾%³Î2k·Gf”""£´ý¢ynWÕÿüöVA,ãJõÛ[y`‰4PGXÒ@Ãâ¸C¥Ï¾Iì?AßÙólÍÐdiŽ.–:KMF8YŠGq¹­5ràPÖd¨ÏC2Ôs¶k24Ë&CsØk´AEl G ´\ iYyƒuÌÍ`ö9¶Ú™ ÁPp¬”!ʪbŽâbT4R)c¨çK#´Ñ3úmT¹Ü²1çn¬eã†d÷e¶E#=›lÑÈ ¶ÅZªrø[ECÖË¢™›E4A×eYª¥¶¯–ZK{Sëp(ØRëi˜WŠcoi‡©{¬¶TK]_-ud(óvèMÏ :´SkÖÃifÉXLs:2Á”ÅÔQ1u};r(;Ûy1¨ý©-³‡µÝžÌÌÑé Ë0sTL}_1õhg`Ã<Ù2ôgÈìÑÌ|X{ ¬ %:ÊÈÒhO¥Ô÷•RfæÔôèÌÀðã V A@;fEz*°oYPºÚS! }…4`ræn! 7M>“†­Ég ;³&ÑNa<_Fx 2úÊh´'I݃N®Å“‘k‹Ä~CÚ:ѵ–#_RKÓbÈœV ¹’Ú“ Í–Û0YG›y„l²Vd2ëKýŒõEù&þ´Ü#šLN≭F‘GR¬6’‰§«´=’ÉhÑspHêzlfŽVr/ ©éáFDbù\4%µ3œr’º[¤q§ÕR0(΃D¿J—¢–‡Û!‰”Òå54‘óYR/ãb=ÝŒ9…«=rÑÄŒ&µ;œa»‰÷°4DCVmô9À¨‘1®”Œ§†ìƒ›ÉI)©Ùñ2³C+½b3©‘ /õ1^çE4Á›âŒ& ´Ü#ÜÒRlvdÈ#4ÔÛ³%¶1=Íq§ÕR0µ:Þg9°ÿ¨ÕñYì1T-ydpÄΠ&&ˆ¢’Zî‘í{—: 3À‹Œ?Vî:G·!WåäÇ6¼Q†  åR66;€0[ŠÝŽª34T*ö/vpeͰ•Q†¯c{eU™]†¢Ü¸>é÷ðù‹QÎuôuö(–,ˆŽnN@_«K‘xdô7F7_ŠêŸ˜ÔÅלE×Ü–aTÃ¥-¹ƒº<'(¢û#>Òf0Š;0 fX`eШt}ª~‰ ÆrY9(’ûà ®f 7êØ!iÓ­JXS'žO Œa‘Ë5ư/nrÀ}ñKº’,íR\r1zEnô@ ×ijÀ5K¤<…Ò–L ܾ¸¥ݰúÔ£®µœÈ²ÜÐQëmYO W_¤Xí UŒ(`q3˜Å}på„´ñJÌ#ºÓ³-]{$b¨ÚžƒÞÒµŸëu䎓 ;rhC“aØ sÛxkJ(cŸ-œ)âyãb) ã>8N3G÷%>€±æþ‘úkÇ »£ÛR¯È Žn\icÎ×lÀ…g‡ÅÖšžØZóYƒ­u(„"o\*„z´,ëé’Ä>ÃΛã;^.ØOó™HÍ´wÅé{Îrj·=ãÛm6ØÓ/QÍ•?öÑ*)ƒ†"'‘õo=bŸ 7×´•’‹ùP“GÔ?óqè–À s ´B$²ÆµR&Æ€ý5ôÍÉ?Ø_ Æ8aeÇW—ߎ*íóðG¥X,x¸XÈ=þvs [øX:~zšÌVë%Lñ³Õ»ÙÝÓlñ°l^ÿÄ8I¢NÞŸ*‡ÿ¸AÑiÓÉåÅä — ?G‰ P¦‘ ¿×œ\^MÞ_áDJÖ“ë› ¹µ;ùþþ¥˜<$¥Øw'‹ç—Åj¶ž-昘E"Gi[d¥F‹ù}û²^áYî™í|Ýܯñ8Oþš_µ–Sorü G)L&i÷ä#ŽdÑÀoI¡Èäìú¡à‹Àäš|o¥åñ5¾³ ”嘴w¯XÌyólu¿l×íÙüv¹Jø¾J"{¨Kí0jfw¯âíâîÛ{´Dsë ~ù|Tv ¿à0yõýr9_ v!Ë[Ö™ëfœ}læÓ'ÐÏŸ¢fõk±»³P>®/Û—År=›N¬÷Ïæù婽Ŗ˜Ëež»¥DQÜ€ñ¼À9¿3—h¹Xñ<6ʦxë.ôéЗÊóRawÔÄžÔ˜6lÏcÇÊ¥€çÎ˦ýi3_ÏpºHª}¶7ìÕW“R~GÙe;›Ï0Û¸»M ˜’ÜR|À§õ„ù‡³ù´ý‰¥*1úxöîä† õ>]7Òq¡çǧÅjÕ,±ʤÆéÙÅw¬Eyx ‰m8=OÏn®.QhŠŽÓ«w0â“ëôj‚£¢PoÄI¡Æ)ÖS'_œÝL = 7Èdw;½n›åý#*šçWëæé©‰uPñž(5ðEíªÅƒ'%R²à:iœ¶__cÜ©"Ë¢LZ.ô¹^O§ÞXéRü¦™–KMž¦xÈO]<üí¹Žñ|ôµçÇÑk8IçÇ_!íUy;ÈÊtèz4Æ¥\D—ñ‡×9¶PškYœÝ Õ¾þ:®Ÿ¨ˆëN»ºøˆMFb|sü» åJe;zD²B×X ¸½¹üŠO9)ÜnÚUê ø6 !„G?EE,7ÿ8|ûáû%ExùS6‰êÊÐÚÇë/øóGNýWÅ%‹¦¿¦9ß™»:¾˜\ž_Ÿž}ÀÐàb—.>^ß\½?>ÇV9Ù_œHU"M©ëªyh'‹{µÕAþó—¯ ýˆLGéÏW)~lÏ/ŸžFmO’(Ó rÒ¤CÚ«0.Åœ3[¬Cü©¥ÜùÇÆÆDôÉO9Љ”óËÆ“7l'Ú¯ošØ®WݤG‡´WÝßSÎ™Ž¼ß?^‡ˆD³ÿ>mbH¸lØ|ñ> stream xÚ]M¯ã:rÝ÷¯ðrfŒHŠ_ƒÁÅ’J–¬"©~›¾„uT‡d‘,Rl唨;å”Ú)+C¡ÜYiCAï„(ð'³¥A”Ý WºPr;) ,ùÔ&”Êb'½P¡$vJZýJ ÀH~ƒÞ)e¹+•Â’Þ•F¥Ù•¾ÄßìNK‰òÜNkiBÉï´ÓJºØáD(‰)] :´ÜëN«-<>7”~h½³ÆyÚìth»sR#Îíà-”ìwÎáoñRaIì¼.è0rçƒ((©(„/C±„¢)‚flÎW Ð%„Að%Ê2˜ aÑkãwBè¬- ¨ks  *B¨B„×,hSJR-hS%XЦ¼Šm¨iƒµÖ†z Eé' Ú4h†¢m8 EЦ,@›mF”m¦D¢%ŒŠ  h Šh³¥ rh³Öàk Í‰>´l6ð‚KªDøÂ‡yEx̓6o‡b¹“E!‚e^CQbuÂ?räªR‚ ¡=4=!e°ÌCÛÚ§ò ] ¬?_h›àó(J(–%M¨j_€6 ‡"h“Þ㯠M‰PǾmÐBQ˜ EXЦJ°ð®TÚ`´)£=h MÙmØK Ú”}À Ðä௠­¡£x¨hYJì´•*4/@[Y¢0 ÚJŠzYÚB‚6 ÚÊÐ%¡ÚJo±Ú´@ Rj Õ EЦ±Þ®Ç÷?BÓ€Ú-vߥá#ZXûQßö‡º½ÕÝCã’YìçåT÷_t‘—|yT(xØÝ7íá&ÀÿñåOÿÑœ›Ûfb6‰ÿÇ—¿þuçá¥9ãEÎâZJù” =:ƒ=WÝGÓV§ÀŠTYt]µhm¶fΗcdªL/èÈÉý Љ4“3€×ª«Î=2¡7Ã÷ð :*6¼ò¸ ÑeV|Wµ_—Û¶Èvšîë¢ßµóßsÑiozèÇ˹jZ$&ÙªÚú·P?&Ù¨ûeYìä&èT>ë±ÎncyAÇÑYÆWP꾫7d:ëíC²ŽÎü49,Å}ÕuÕÐõæwNð;¾²Y öPQncEÓ&?QSH,³öSHÌ"GæaÚ™΂V¹NAKš ¯PÐRÛHÉ‹ý žçÓ·jéYR¡6Zî×ã³u9c.aÃù: }Õ­ P£·“œ™—Ì%oâ^¢qX0¥ îêêø´8í\?w.uàßC7L¶Xm.tfPÚ„¶yôõ<@7LTd%承€ƒŒ+“Æâdòø?pt¢õO#­ŽvOðØ|}‘7Ü{Æo¶àÉè|l~aeƒÜ­LÓ+÷3ú¹Áî¡VŠ$ð\}­G¤MWÉØ…lšà~¨eÔ,· jaº‘Ú9 Doe·Ÿ78‰=Á³Nª²à±uÊ2O ug±9µcY–[ðD¶ÚHöœ• ¢†ì©)ËRçM 0Ýæg£˜/T:ëK1êï×K Óó&,#¥-\wëêsý+‚üOpoÈ“È<§Eõ"ÖÝß»:0c¢3£ê|®PD¬)}Ô—s}ëšC@EA›iΨË%0`öåíŸ6ô¶$e3“Òòlp Ñ>›°ïöã:€b©†æéÒñç1Æ?AC÷v9 „Ê"[rŸÏ=<ÝÌ Ìs68*c! ‚˜Y²¢+µ€¹´7Ä Ì07J$1£2aCËrÜKÙÀOãèmPk-§êzª5# ¦½U×Ü>ÏC5Û"Žƒ¿c³1qP{éÎC芶ôD÷ïˆØÀ¹“g*¼?‹.ê"iÖãô|? Õýðù#¸ U ÷Ìu™?™Ó:…ëo÷cš5óré}FdžÌ¶þ¨nÍ£~sÏ£[6Öqfm!F'Ì&êÛ%@¢+ùë¥éûK‹šdó[ݽ°]UvÕSÝ||"(ÏàÚå„È<ƒýrŠ5Æþ9fÈ"Ö“úSÕ£q1ÏÆ`BD®Úû)¤ùãøÞ6ïP¡ˆÉOæænÆeåéú­nÞî'¬Ð’Úûîrß>?ÂÜ»º S1© ‘@>ê®yÿ°"à Kï#ÏÇÉ>)Š&$)X>àMþ&e%yëûÑÍ5œþvDnüXÝêcr9úåÏ?F‹ªÐ|nèÞÃæWTן/—ÛgÓ†a]1õ3AÞáÒ!J¦Ø"/SBR4!vðO2™|ü{«1ᢘ.6a¾Ö][‡ô”bÒŒ/¨ºE•&¼^ú&Dè㸧BÙÔjöélFP–±±Ê±Š@)[‘§‘WU¬×ž€™=´¤Þ4‚Ü´ï—ð63ŸÃÇa{ºHß\0‰“ìo+w’ÒRÄp Á®¿¿Û™Ik@t5(ÃçEü9‰,¤¯±»áøÇ?Ú>¶Ìc˜ÔïŒöû{‡½P»T_ø”””ff ÞW÷0óÓ¾à-lÎu;UžŽ`†Œ‚Wž}^w]&®àŸƒcÍß7ìsX¡|^€MòÃy–£<ª+Y#Ä@×aXäòêBµÊ7 ÇûLóiÞÞú!Pß`P׋j0ˆPE†$ò-%'ÉbÇ€Âä{‡çØyfVÉ#:p97eS°"Tê:˜·À §XŠ9¾ñD‡ÛR°Neugg$åy›Ð°¾tǦEŠÀ„”­ôJW…ÝVèsa¿oè—ŠÙþ{«IEa¬a Ë’zOMº`v¬dÈiW×kwùN¹ÏpŠcú"ö­î¸±) í³4ÇÊŠOq/ M¶`Vˆø[âåÞ«ç†ÖÆqla=Â\öqoBH:ÜÆÁÙÇ¡°tžS%”+â``O (—Êš=Nɲ ÷Ð/§;µ8&«ÿ £&öÙܺË"œ•ÂEPópV AK‚ÂDž/P)|Ž©µ£i¡iæ:`«cu SÇa]=5cÅ©ˆÙËxÈ„×'l¤ˆ×xX “@Ïã¡Kï(*Ýô’þÇÄn£ôÞדØSÓbðt6eïì…7aq} oŽ…ñ(Y¾åo=áS.ú—²Øð ýK¹­Ö¤ý¤ªdÝtoË•|Á f4†`fÿ0U_û3NÍJ®?<Ö]ÙEiiq†s~<÷>‰ãp@L/@·ê-LO$ ÙrPl`pétFdŠÃ ¾œaƒß ~¾¿båV¥\¼jŸ«@!#,Mk±ánݰmã9ú᜿F]$¤†¥ó}¢\ ‘„Œk!“¨ëˆR99RBS¬~»‡Ý¼Ó°Ý·žžvõ´ö+™‡ý|/‡Y°Á<gèaÜg }u¾žj:æ™õ鈠c[^¦’òOg¢"R\ŒÀñÈ–gVZ#bÜÆ1EÔÞḚgÖÒxt¶~»ãÑ9æš~¶gõÄ™$nÚ,L‘³ð.))ÉQd³ùðrl—íñ„sZÇ̱V¸ýåý±¼×ϸˆÒi—MDO»lIƲۇ q9ÚBÌOBu͆¿Ãå—g–Kì‘áÀë(âÀ礅£o6iaÍìÁ-r$F<ÏHNòIðë·¸C€‰ÀÈs3ÌGÂI`ÿí^×ÿ7ètqä4âçô}·ªa™¾…€€¦ÜB-:×ò’„>Sðä4ïñkØÔ&[DMÍs>Mfg`Ú¶ÁúÕñçÏ(•ü2iådJXŽ­uÜ36jáKØ3.Š\E=ã“ØyÐc²PG&³E°UO´Ì0úJĹ[Èåú!˜£¢Æ‡å8µ-S8ŠV§Pଉ¢(l}ü†@›1Öë ¤rdDoá•àWdÀ'|›b«güªûp§T¾0 wÍñÏ/]WŸªqÅqao€ÝÛñné˜ö ‹`máoîhB\’³=_Îõ0l8æüB®U·ôB‹° í3$˜ªÒ<ìÛ=ž†Ç ðtß1á”I!öGÊR)û¥Ÿq9Y®Fäòë«ñ†“¨ÜÛå6âÊ$îùÑwß"ïSªß13ž €öÓõšÕ!ÃB9¾8_yq)Ú5|! ³ž?. íÞÆw}ô´1Ló#È•¾kT\зð—`ž‡ejú7óŽ}?ËÌìS qê:3ÆqÌÌs5œ<ë?›w:wa˜Ó’ Œ %|!R‡Ó'…ÍÆ~k1’emþù“‹0íÇáœH±àœ@Çc§Ð¦½O!èF+iŠˆyôyKò>ƒgy!Y¶p]>v{%cæ„í©Æ½F™8jÖbU‡MÍA© ˆ„é8î•Ôd¶àÅç¼ÀMR})‘0sü&IEz)=gŽÊáFؘ§d963†Zp-2ŽÌ„ð¾^™Yµ…¸Á×”¨$e³U³¸?W"σOà YÞªÔÇ¡ó„§a¾x½¯æ~†IÂ>Ø9Ó§¢žNç$¥¨{¬¿ åC=fßsr§ºìW“†¹æé±þÎÑ0¹ëÇtT#œOWÌŒí‰x "5[{“”äj}|D1KÔ–ÅËé~®‡Ì÷íêcvÒDéØsÚ1ÌMXù)áˆÊHűµƒ1Iyš^ÚüÞÇ+i,Å«Ù%(ÓÔoa™.,î\±jdg~ÃÊø1}Ò™E6göòÊ×;YuDkh 5Ýùai¶»¸ácš—?ï󘮥˜ÝÞaõê¼Å«ú|eêxÇ¥¼ââÒŒéÆõÓ]—‹ 1íp-¯¿˜®Ø]_ÐàÊÕ|k4i ^?q@=‡î¨˜.º˜n¤˜Ö|ëû',åž·MX:K2^Û`×à’î²²mrÞÒ(óË,íÍN«¦éraˆ*ãWÏÓç±c­OX¿švMê&ÔdÑßš# ”C±¢î èÞ 5Þ­ – «Võ/„ iÁ~|iÜÂVt…¢+*ÔxE(¬’¦Bº Ù¬—d_Iö•dߘ"ƫˇ‚^- !TÁ^®%k2P“š ÔÄŽ&íë»[„W YÊ’‘Lj²P“…†è1¤}}W endstream endobj 3945 0 obj << /Producer (pdfTeX-1.40.22) /Creator (TeX) /CreationDate (D:20230516164644+02'00') /ModDate (D:20230516164644+02'00') /Trapped /False /PTEX.Fullbanner (This is pdfTeX, Version 3.141592653-2.6-1.40.22 (TeX Live 2021 Gentoo Linux) kpathsea version 6.3.3) >> endobj 3933 0 obj << /Type /ObjStm /N 12 /First 109 /Length 495 /Filter /FlateDecode >> stream xÚ}”I›@„ïüŠ>f½°u4šKreU”œF#Ô†6i‰Å‚ÆÉüû<À¥ŒÅÅúÜ”ëÕ+ZVZIÆ™Ò*b"ÒÄLj1AÂ"9CÊb5k2–ˆlÍR¡"β8™@0­gLÎ"E”EÓyKž÷÷AøÙ•{R=àì'#ˆ d=Ás~qóôûwDZ-ü‡±ûÜ›CWÖçmîZoû³©‡;¶R”}> ·®u¤+N)‡»çàáaJóË@*à ®ã½Pë‘'Û¶õ®¶WÑÆ¾­HDÒiPˆF!…h½€æ vÒ¼NÆÃ:À¹í»qŽzÞ$Ð\Â]"@ Hv¿q·½;¾Ðì¿Öƺ¾1,…cÀ–[ ×Sß 2Ó­¯@vìÙEÀl‘]ûÆùÚ¾·}|¼a!%BJÔ'AF;e™©«âOõÚÕ›‡¥üüY,«(t°#±›Än»Iô*Yñ8×Ë®1®]§Lsªí"ÚfQ(B¡…W Sí]Ÿ‹}chÓ›£°¡Â† Fx)‘¸ya6žŸì@Oçÿ1Òãô×Ëɲð£ñ¦îª üa*K¢t)2¿¾ví|´T„ßLcgµ|Ÿ~òµ+Éå÷`¡Ÿìÿ(]{á endstream endobj 3946 0 obj << /Type /XRef /Index [0 3947] /Size 3947 /W [1 3 1] /Root 3944 0 R /Info 3945 0 R /ID [ ] /Length 9662 /Filter /FlateDecode >> stream xÚ%œy”#[}ßõÓ.õ:ûÞ³ï===›J£Y{¶žéõlêéÙ×ç˜3ØÉ `ÉÃıCã‡ô+Éä 8q«2:$8õHBÌŒÄØOɉY­ àØr|,Q¿2Ñçûþùœº¿[RWÕ÷û»º÷Ö½‹Åb?µXl$f±ø'úHÍÆâ±XÎ@¿˜iô‹ÃÅ3`Æb«x‡Úˆ[,7§ØuŠ)9` a0FÁ°,ËÁ °¬«Á°¬ëÁ06‚M`3ض‚m`;Øv‚]`7Øö‚ý`û@Òbkõ\Æ¹Õ à|<nÇc‰/åÀR°L€CÀ'Áp \úØãx,¹% †Àr°l“ ÿ±d-N‚þÇRí‹`ÌÅcéçip«æпóL! –€5@ä 8ƒ# PGA ÇÁ pœ§Á8΂sà<¸¦ÁEp Ì€Ëà (ƒYp\rÎ pTÀ¸æÁm ×Ý÷À}ð<À³>"„Š0pòé0a±’Œy.ýKËTyVÕA°ý‹Ìô¨è‚ PgÁUÐÿ¾ly-Ø.ƒþ—fëCà0è_U¶•Kçµöj['ÁyPý;Ê•ò` Ø.‚«à6xÚÇâX v‚Ãà(ƒyÐÿ»¹NdÁ q¢$ C#24"C#24"C#24"C#24"C#24"C#24"C#24"C#24"C#24"C#ý!24"C#24"C#24"C#ì‘¡‘¡‘¡‘¡‘¡‘¡ò2š$lDÂF8;ÂÙ‘ÜþÔb[k2öƒØj±©›1Žæ@ÿ™æ+Ã`Ø ÆAœep ô–o¤ÁX 6‚IP¤ADZE¤UDZE¤UDZE¤UDZE¤UDZE¤UDZE¤UDZE¤UDZEú>Ò*"£¢C;6§;šæ¯]}oä»q0Ö€#àà¼.çuE§Aÿ¦w’ƒÑ%²~n »Ê6ºL•'¦¿FêFeb}ƒ ¿ª,#‰#µfƒÄžR$£ëÄ–#é";ºIl±ÇIñhŽØ~b¤nD²GóÄ#§i^c\ZâKEb${DÝ#vŠ­@$< v–ÍC¤/xDl†˜>¦?þ„Ø5b4(‘.ü1žÁ«ý?ioïÿð]ºãȨxBÅ<Å8HÐ4§ˆÝ¢˜4Ò[†‰ÍQLƒ ±Ä*³ Gl=±›ó`€Øb7(ý$`ÛW¯S#Ätƒ×(Ž‚%Ä.»Jq)XÆoEšØ,Åå`± ±2Å•`1=Ä+Wƒ5Äô .S\ øQªÝ%6Cq=ØÀÐ%b—(ŽÄ®»HqØLì±iŠ[ÀV~²t-(nÛ‰Í;OqØÉÚRbç(m&v–â°—Æ\ßw†â8ØGLŸ¢8ö[Kì4ÅIp€Ø&b§(‡ˆ]&v’âaÀïBá ± Àá·B÷8Å"8JlˆØ1Š%pŒØ:b*êäÄ ÄŽRÔ:El–˜¾J9Åþ†CQ7¨_¡%Ätz8ç‰)™ŽPÔƒ&v”˜nA¢\"vŽØ!Šô21%„n_fÐOàSb(ÊHWù‘Ó}èÑɄ׉í&¶Ÿ¢ |“˜ž•»Ì?GLy´¢gž_IåŒ$SæÝ!v„Ø^ŠwÁ=bˆIîûà?š9b»)>ˆ©á‘U~§[º¾Ÿ‚gÄ&‰õm?ÜOö«wcúãÛ)ÆA‚˜’dÅ$H£øêVŠi!6Gl Å,È»Ol3Å<༤VtÅAÀOtIfÝHqŒÓ…Qê(é6P\ –“xë).+ˆ)‰×Q\ V{Fl-ÅÕ` ݵÞk(ªb1=D¢/Ý@l±UuA‰éYéëu3›‰&¶‚¢ÄVb2µ.Mq;±ÛÄ–Q” êÎHdÝÖ.°›Ÿh5´K(î{‰Ix=’q°˜Œ4Bqì'¶†˜ç$8@l±!ŠÁ!bˆIŠÃ€ŸÏ ƒšW(€Cl„˜d,‚£Ä”ˆ9Š%pŒØ1Yà8à—¸¢¿›¡xœ"¶˜ìsLsˆ¥(žg‰é×OÖ;Î+KP¼ø¡¯'&Û^—ˆ$fgÀebú‘å¯uqú_:¼ðŒâ,¸JlšØSŠ×Àubøoá Åà&1ô]xL±æˆáÉ…Goyb7ˆ=¤xÜ!F£¿ð€â]pÞ]¸OQx@ì±{õtÆ*‰écúãOˆÑh-Ü¡¨ F -ø“Q?Ùßù¸sùFœŠyŠ<5† ù­í×L‡9N‡9ßÀp sQ‹®s¾A/p¿t¢ãt¢óQb7)âºÓù‰½À³¢c§co,'v"îŒÔŸ\IŒçLg;Ng;ß µ]¸J‘¬ Ûoðkµ€FtÀãtÀó ~ÊÉFºâùÆVbèK§N7>ߥWµpŒ"ÉN‡>ߥáYPQ'«ÛM/cá(Eý!’½«g ¯ÒE’ì]’}Á¡¨$Ù»$ì‚.C‡dïꡨ«^=½¾Ý‚D!Ù»ºßC%(ÉÞÕýêöe’½Kƒ·p€¢ŒD²wùu^У“ ¯3JP.ì§(ß$F#¸ Ç.óÏ1P²ï£¨Ä!%£y‹Íý…¦†n‚)  ’=ºg±'/(Iq:êqºçqºçq:å‰/Å@$@ d@ЄG-ö³ßÕ·¨¯Þz¤-ö“ßÐŒ‚a‹ýÃ×TËÁ‹ýò¿Rl5Xa±t¹˜¬ëÀz0ÖXìŸRŸØÀy„l[ÀF‹½vLµdcQs<ÛÀÐxþvRµÛÁ.°ìã`˜;-öúgtòp,öù)U‹}9¯k¾Eñ8(Yì¿7u V¼ÏÑipÂb°\çÀ”ÅÞøŸ*Nƒóûã/ªxhxÑbßxëûÍî®XìÛoª¢nXìÿüHE)­˜.Hù»`Îb?¨êÕöÕÿËG*êú4L“æ}AÿßË15Òò™Å„Š1³þ“Ž4üJƒ¸Y|½bVe̲ÿYÅ,—ñ#­4pÊ›åþDµƒ`)5[rB1£V‚ef+Å mYe¶þÓ*®ÀZ³M³ŠmcfÛÿFÅüÝGm›Íöüª*¶€`›Ù¾ãŠí»ÌþTÅÝ`ì`?8öšië¼#àY±¢âaà€"8 Jà88NÓ` \…þü©¾€Á@‘ü-ò+^¼Jì<8.€i@³TÔœå0cvÁ×\³@Ÿ½Êf7·«ö¸ *`Üóà6¸î‚{à>x¤ §þîðAúµŸ‚gÔÆ€¸Åß}SÅI‹/{A±,È<ƒ`¬Ãßø< x+ý|)XèÓ<_V‚U@›u`Xkñ½ïÔÐ÷y>6‚M`3ØôaÐ˃€ŽÒsÞ<ßö2,ÕWí%0añ¢bêâÁ!p@œgÀ1‹Ÿýy}ì88N‚Sà4˜WÁY‹_ûžN¾Îƒ‹`\eP×,þp·N¾n€›à)˜³øÓÿ¡Ú;à.¸îƒ@ú>Á:‹Ræ™Åÿî=>Ûз ˆÜd A3з‰¾M^þ-ôÇW½?ÖgÑ·9hñ÷nU[4‡š7G-þ¾1U r}›èÛDß& 6ûª~P½‰ÒMtkn´øG~[1m"h“îes»ÅÿÅ—UªM½bþ¹8ϑޡos/˜ˆÒÜgñOü¹>†ÜMôm¢o}›èÛ¤GÛDä&"7€ÒMºÓM ÒÔ¼”ú6¯yÂ⯿CߌÜMän"wo4ϬҤ‡Ü¼`ñ/ü/L÷¼‰ðM:ÑMÔo¢~“| 4¯„oêÞ®Zü²ú,>hâƒ&.i²Ø£©uˆÜ¼mñï^ÕyØ¢‰-𨢉-𨢉-šèŠKé'ÿóš>¯šÏ¨ 'X0 KüŠåAÊâoÖTÌÍ&8–È_V-«' C`¬£–y¯j—å`X èDV[bÍ[mX¶1Klü—ª —VØ ôîn»%Æ_QÅ@÷¼@—½@ϼ@—½ wã@oYºQÐ;>:E…IK”fõzÇGo©P¼Ê+ðªl!ÉoÓ Ç-1ýcLÿ¹pœ¼“+ð®@»Àk¶ÂEÀÊÂKܼ¤1¤(ð"­0 ®ƒà&¨€9ð\³Ä£¼>F­@­ QÖpÜôá èËKŠG–xû¨>¦%-OÀS€¾L¸dªè[[âÍ­*¦úV“–xïÅзŠxÕ¾ª¿üeM—ë<UG,ñÊRÇr˜*ZV—ZâÃïQ }«h^]a‰ê7Cä*kªt¶«}¥?zCˆ\ÝP¦ºÙ¯mT"WQ¿º o«ˆWÝo‰O_Ðy¼¶[К¬2æ¬êëAKü‡¬NÑkY¬–,ñù_TL¯`Q°Š‚UÄ«jùO_­¯¿¤S±ŠŒU ¯­^¶Ä_Ó)ˆWí õí¸ŠZE£êMKüÙWCÕ*ªV‘±ª—޹zÇ?rt‚V´Š U Š‚UÄëi„†n=Dî!EO’õåîüµ¾¥«ˆÜ#u{(ØKZò}Óú,Zö,ÿ5ÉÐÚcdرdö+ª@Ëé×[fÉ•IůG®öPµG®ö¥·Þ’Û>©S"÷±‡n=^m-è HÄÞKø¼Î#C{dh¼ì!hÉz{,Yu iÚ›Ú#{(Ø#ézG,9õYǨO¦=í!rDì¡[ÝzHÖÓ°EBIŠG–|é3êЀ˜%ß?¡"½õ2Å2]ö2/†Ë`ÈR;?¡S4"µä«‡U\X8V¦C_¦ë\¦¯\^èß—W[R¿’ÃE^¶yPÔlž†tüË,Ùø†¾!ry#Ð; £/”wZòõ}:eØkÉ/L«È»ÌZµò„%ÿ(PŒîy™¾|™Žp¹/Ï·^SEÐ)/Ÿ°ä–*F§¼<èË—é­—YñV¾fúò´%ü¯õ ½[Ôs¹f-•yQZzÀD™ÿåyK-?ªŠÛ€A™Uåû€ue^ò—ZjíFGo½Îc¯Ç,51N¬N½ÎвΠ³žµÔgŸ«‚+¨£`=o©BR1£u4ªZê\[14ªëõžjŒÖW[êÆ*Õ"T'^g¨ZçqÖ7[êá€jÃÖ´Ö·ƒ`/8öYêí¿¦ó&€FO<âú!K½ãÓª`H[w,õòWUdYgðX¿N[êßTÔyìõi ·FZ¤ÈÈ¿®53–úèt2óõYÀ¯óÄëHQçÁÖo[êµ!§q¨Öeðœë,õɪ !Z<ÓVÿ9ÿî)b-…ð}+eéÓªþke,õ¥Ï©Èµ,õ5_EÖ$,0ÐÖúÃÿ¢ Di‘­%–zã#Š1ôm­°Ôw~NE’¤…P-hñœ[ë,õÿLµ$N QZÌ´xö-2¥Å³om³Ô_ÊÏ-ôh‘-²¢…(­qK…‡T‹(-½Õ¡L«¯Ì›¿¨Z¤h1†m1Ñ"SZ¨Ðê«õÓt Bµ˜žh1ªl‘-äi±tú¬N!]Zdr뢥—>Q i[$N ZhÔb`ÜBÆÖMK¯ûk‡d-4j‘--–¹méíUk¡¥£ŒMµ¸å¡¥¿_Ó)¨!­æ›b–þ6oØr%V“–’–žþMS€ ÄÓ†¥A³ôÌçTË,bIC T†,=[S…ÖµhÊJÀÒ’ÒrKß}MµZ¥²¬,)YúmÿLµ¬9)m¬*)égGkbX.€‹`TÀËŽ½O§h±›V·i9›Ö›ÍYvûœjYa_¹ XCßÐÃ~hÙ½¡jµèL«Ì´¢,aÙŽPÑÐB¯”eKV1 P¦2 žscز§ÿ­jµÚKË»´ž‹¥ò Ú` åXk,;­ÇÔ@…†–EYv曊ñØÛÀÀsn @ƒGÜ·ìÜ;užVNAÿÏ[1­ˆÒ(­ybQRã¨eJÐÆqp @ƒåI Ö5ÎXöÙ˜Ná™6u,h1Ù0cÙ¿“T-R4f¸Á6ŠF¹_ûŠjyØ ¤hðÄó–}i*XØà‰7XØÐÆ ò£ÁÃîꔾ/—tÄŽÆ3Ëý= 廤F×,»ø É™.’uÉ.t³–ýõï¨VsZ<Ó.¢tIî€e?ö²jY–×%?ºK,ûÚßWŒdê"T—4è®°ìo}OdOw ¬¶ì'Þ¦¤«¯GÆ.iÐÝhÙß©ªv`]»$N»¤U-»HÖÝeÙß}¯>Aöt‘¶‹ºlF[Ð7#cw²_¤óX×%˺¤U—ê"|÷°e¿1ªS´t­¯ô7¿ªbɲߺ®#6½tÉ™®Vž!|÷¸eø,fÙîtŠ–šMYnä­‡¨Uk$XWëÍ´ÀlÆr^T-cÓ=­2Cóî¬åöD1Ëë:E[Xм‹AºËy·*XHÚ½g¹«ïRñ!˜·ÜíA1Hõ»,÷xLv1ÃIû㓯ë(R â–{תHr}99˽ȃ!°lƒ–ûÇUËJÏâYŽ–€¥`XV€•`X Ö€µ`X6€1 +ØŠ`‹å^yIhØv€`Ø ö€½`ì`?˜ÀApG@8à8j¹_¯éO–À1pœ'ÁpÚrõg:o œçÁ0 .‚K`\W@Ì‚«àÐBÃ@Ë +`Üóà6¸î‚{à>x‚G@Û›ž€§àKcÀ@$@¤@d@ä@ €A0´]jŒ‚%`)X–ƒ`%XVƒ5`-XÖƒ ` l›Àf°lÛÀv°ì»Àn°ìã`˜ûÁ$8‚Cà08 ÀEp”À1pœ'Á)pL3à,8΃ `\—À ¸ ®€2˜7AhÑè-0nƒ;à.¸îƒà!KÎö­÷Ca™)*–IÝM–ûÊ=‰ü<OÀS€ð±€|,àc øXÀÇ>ð±€|,àc øXÀÇ>ð±€|,àc øXÀÇ>ð±€|,àc øXÀÇ>ð±€|,àc øXÀÇ>ð±€|,àc øXÀÇ>ð±€|,àc øXÀÇ>ð±€|,àc øXÀÇ>ð±€|,àc øXÀÇ>ðûbŽghÂ@$@¤@d@ä@ €A0†ÁKÀR° ,+ÀJ° ¬kÀZ°¬ÀØ6Í` Ø ¶í`Ø vÝ`Ø ÆÁ>p‡Àa ŒXî%=ƒ Ë^ÓÑP(‚£ Žãà8 NÓ` œgÁ9p\Óà"¸fÀep”Á,¸ ®ëภ*`Üóà6¸î‚{à>x‚Gà1xžÔç}ÅP€úꨠ~€úꨠ~€úꨠ~€úꨠ~€úꨠ~€úꨠ~€úꨠ~€úꨠ~€úꨠ~€úꨠ~€úꨠ~€úÁØ&f0C€Ì y€æšh y€æšh y€æšh y€æšh y€æšh y€æšh y€æ"ˆ r€È,0i¹ð€„ºjùÝÒꨠ~€úꨠ~€úꨠ~€úêlrdžpØ1À/'èé;l'tØÆã°·Åa§€Ã(ÐaÁ‹Ã´ˆÃÛ‡=¼[{ö»8t÷¶ú9¼ïqØ é°‰Ëa·ÃÖ-‡1»³°íÐa Ãþ-‡íÞ;Fö:lpØÄå°OÄa"Ôa¯–Ã|¶ÃÛ9‡Íàû²V½8ìÆrö49 û¶:€]¿ïÅÞH8lÉr6b9lÑtØzä°×Èa'¡Ãô‰ÃþA‡µ.»v^9¬ñw˜HqØÅé°eÇá_¿8ltå;ltØ~åðÁáu’CgÌa—½Ã®i‡ŸCßÌaGÃŽp‡ »“¶#9ìq˜&uØyå°AÜá]¹Ã®P‡íÎ6ý9lÄrرä<luØùç°cÉa¿ŸƒæEu ѼˆæE4/¢yÍ‹h^Dó¢v‡ yÍ‹Jöë–_ñ+ú‚ËÊÆl¸m*¢~qÈò¥o©ˆ#Šûa†"f(b†"f(b†"f(b†"f(ò$‹8¢ˆ#Š8¢ˆ#ŠÚC„#ŠÚ6‚#ŠÚ9„#Š8¢ˆ#Š8¢ˆ#Š;-ì]Æ.Ë¿gFG»-ÿ¥ßÑÑÈþ¦ŽöÚÀö÷èhÜÞ¥ÜÅ}6ð‘/êhÂ>õªŽöÛÀ÷#MÚ ÖÑ|Û[Ÿ=hƒ¿rAG‡lðã/ëè° ~ùS::bC£ÏuT°¡+/éȱ¡·]ÖQц>øYµ¡ßzë•lè§_×Ñ1žÿ%·á‡tt†?w]G'mø÷þJGšÒÓÖÆ-6ü“ïi*[»õæGï±y. ÚÁH¦,hß"™² ¥ã6’x9f#¼v±…‹-\láb [¸ØÂÅ.¶põ/h \š—¦ÀEx3¸¨ï¢¾‹ú.껨‹ú.껨ï"¼‹ð.»ï"¼‹ð.»ïr—.Â»Ü Ë ºÜ Ë ºÜ Ë ºÜ Ë ºÜ KSàÒ¸4.MKSàÒ¸4.MKSàÒ¸4.MKSàÒ¸4.MKSàÒ¸4.¸Ø¥)pi \š—¦À¥)pi \š—¦À¥)pi \š—¦À¥)pi \š—¦À¥)pi \š—¦À¥)pi \š—¦ÀÕÿ%¡)pi \š—¦À¥)pi \š—¦À¥)pi ¾æyy5Ò„"|ˆð!‡"|ˆð!‡"|ˆð!‡"|ˆð!‡"|ˆð!‡"|ˆð!‡"|ˆð!‡"|ˆð!‡"|ˆð!‡"|ˆð!‡"|ˆð!‡"|ˆð!‡"|ˆð!‡"|ˆð!‡"|ˆð!‡"|ˆð!‡"|ˆð!‡"|ˆð!‡"|ˆð!‡"|ˆð!‡"|ˆð!‡"|ˆð!‡"|ˆð!‡"|ˆð!‡ö…yÐþÈbˆƒH‚Hƒ È‚ȃ9ü©þ·Æþ?äD7š endstream endobj startxref 997411 %%EOF unuran-1.11.0/doc/unuran.info0000644001357500135600000256014214430713451013003 00000000000000This is unuran.info, produced by makeinfo version 7.0.3 from unuran.texi. Copyright © 2000–2012 Institut fuer Statistik, WU Wien. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. INFO-DIR-SECTION Scientific software START-INFO-DIR-ENTRY * unuran: (unuran). UNU.RAN – Universal Non-Uniform Random number generator END-INFO-DIR-ENTRY  File: unuran.info, Node: Top, Next: Intro, Up: (dir) UNU.RAN – Universal Non-Uniform RANdom number generators ******************************************************** * Menu: * Intro:: Introduction * Examples:: Examples * StringAPI:: String Interface * Distribution_objects:: Handling distribution objects * Methods:: Methods for generating non-uniform random variates * URNG:: Using uniform random number generators * Stddist:: UNU.RAN Library of standard distributions * Error_Debug:: Error handling and Debugging * Testing:: Testing * Misc:: Miscelleanous * RVG:: A Short Introduction to Random Variate Generation * Glossary:: Glossary * Bibliography:: Bibliography * FIndex:: Function Index This is the online-documentation of UNU.RAN. Version: 1.11.0 Date: 21 April 2023 UNU.RAN (Universal Non-Uniform RAndom Number generator) is a collection of algorithms for generating non-uniform pseudorandom variates as a library of C functions designed and implemented by the ARVAG (Automatic Random VAriate Generation) project group in Vienna, and released under the GNU Public License (GPL). It is especially designed for such situations where − a non-standard distribution or a truncated distribution is needed. − experiments with different types of distributions are made. − random variates for variance reduction techniques are used. − fast generators of predictable quality are necessary. Of course it is also well suited for standard distributions. However due to its more sophisticated programming interface it might not be as easy to use if you only look for a generator for the standard normal distribution. (Although UNU.RAN provides generators that are superior in many aspects to those found in quite a number of other libraries.) UNU.RAN implements several methods for generating random numbers. The choice depends primary on the information about the distribution can be provided and – if the user is familar with the different methods – on the preferences of the user. The design goals of UNU.RAN are to provide _reliable_, _portable_ and _robust_ (as far as this is possible) functions with a consisent and easy to use interface. It is suitable for all situation where experiments with different distributions including non-standard distributions. For example it is no problem to replace the normal distribution by an empirical distribution in a model. Since originally designed as a library for so called black-box or universal algorithms its interface is different from other libraries. (Nevertheless it also contains special generators for standard distributions.) It does not provide subroutines for random variate generation for particular distributions. Instead it uses an object-oriented interface. Distributions and generators are treated as independent objects. This approach allows one not only to have different methods for generating non-uniform random variates. It is also possible to choose the method which is optimal for a given situation (e.g. speed, quality of random numbers, using for variance reduction techniques, etc.). It also allows to sample from non-standard distribution or even from distributions that arise in a model and can only be computed in a complicated subroutine. Sampling from a particular distribution requires the following steps: 1. Create a distribution object. (Objects for standard distributions are available in the library) 2. Choose a method. 3. Initialize the generator, i.e., create the generator object. If the choosen method is not suitable for the given distribution (or if the distribution object contains too little information about the distribution) the initialization routine fails and produces an error message. Thus the generator object does (probably) not produce false results (random variates of a different distribution). 4. Use this generator object to sample from the distribution. There are four types of objects that can be manipulated independently: • *Distribution objects:* hold all information about the random variates that should be generated. The following types of distributions are available: − Continuous and Discrete distributions − Empirical distributions − Multivariate distributions Of course a library of standard distributions is included (and these can be further modified to get, e.g., truncated distributions). Moreover the library provides subroutines to build almost arbitrary distributions. • *Generator objects:* hold the generators for the given distributions. It is possible to build independent generator objects for the same distribution object which might use the same or different methods for generation. (If the choosen method is not suitable for the given method, a ‘NULL’ pointer is returned in the initialization step). • *Parameter objects:* Each transformation method requires several parameters to adjust the generator to a given distribution. The parameter object holds all this information. When created it contains all necessary default settings. It is only used to create a generator object and destroyed immediately. Altough there is no need to change these parameters or even know about their existence for “usual distributionsâ€, they allow a fine tuning of the generator to work with distributions with some awkward properties. The library provides all necessary functions to change these default parameters. • *Uniform Random Number Generators:* All generator objects need one (or more) streams of uniform random numbers that are transformed into random variates of the given distribution. These are given as pointers to appropriate functions or structures (objects). Two generator objects may have their own uniform random number generators or share a common one. Any functions that produce uniform (pseudo-) random numbers can be used. We suggest Otmar Lendl’s PRNG library.  File: unuran.info, Node: Intro, Next: Examples, Prev: Top, Up: Top 1 Introduction ************** * Menu: * UsageDoc:: Usage of this document * Installation:: Installation * UsageLib:: Using the library * Concepts:: Concepts of UNU.RAN * Contact:: Contact the authors  File: unuran.info, Node: UsageDoc, Next: Installation, Up: Intro 1.1 Usage of this document ========================== We designed this document in a way such that one can use UNU.RAN with reading as little as necessary. Read *note Installation:: for the instructions to install the library. *note Concepts of UNU.RAN: Concepts, discribes the basics of UNU.RAN. It also has a short guideline for choosing an appropriate method. In *note Examples:: examples are given that can be copied and modified. They also can be found in the directory ‘examples’ in the source tree. Further information are given in consecutive chapters. *note Handling distribution objects: Distribution_objects, describes how to create and manipulate distribution objects. *note standard distributions: Stddist, describes predefined distribution objects that are ready to use. *note Methods:: describes the various methods in detail. For each of possible distribution classes (continuous, discrete, empirical, multivariate) there exists a short overview section that can be used to choose an appropriate method followed by sections that describe each of the particular methods in detail. These are merely for users with some knowledge about the methods who want to change method-specific parameters and can be ignored by others. Abbreviations and explanation of some basic terms can be found in *note Glossary::.  File: unuran.info, Node: Installation, Next: UsageLib, Prev: UsageDoc, Up: Intro 1.2 Installation ================ UNU.RAN was developed on an Intel architecture under Linux with the GNU C compiler but should compile and run on any computing environment. It requires an ANSI compliant C compiler. Below find the installation instructions for unices. Uniform random number generator ............................... UNU.RAN can be used with any uniform random number generator but (at the moment) some features work best with Pierre L’Ecuyer’s RngStreams library (see for a description and downloading. For details on using uniform random number in UNU.RAN see *note Using uniform random number generators: URNG. Install the required libraries first. UNU.RAN ....... 1. First unzip and untar the package and change to the directory: tar zxvf unuran-1.11.0.tar.gz cd unuran-1.11.0 2. Optional: Edit the file ‘src/unuran_config.h’ 3. Run a configuration script: sh ./configure --prefix= where ‘’ is the root of the installation tree. When omitted ‘/usr/local’ is used. Use ‘./configure --help’ to get a list of other options. In particular the following flags are important: • Enable support for some external sources of uniform random number generators (*note Using uniform random number generators: URNG.): ‘--with-urng-rngstream’ URNG: use Pierre L’Ecuyer’s RNGSTREAM library [default=‘no’] ‘--with-urng-prng’ URNG: use Otmar Lendl’s PRNG library [default=‘no’] ‘--with-urng-gsl’ URNG: use random number generators from GNU Scientific Library [default=‘no’] ‘--with-urng-default’ URNG: global default URNG (builtin|rngstream) [default=‘builtin’] We strongly recommend to use RngStreams library: sh ./configure --with-urng-rngstream --with-urng-default=rngstream _Important:_ You must install the respective libraries ‘RngStreams’, ‘PRNG’ and ‘GSL’ before ‘./configure’ is executed. • Also make a shared library: ‘--enable-shared’ build shared libraries [default=‘no’] • The library provides the function ‘unur_gen_info’ for information about generator objects. This is intented for using in interactive computing environments. This feature can be enabled / disabled by means of the configure flag ‘--enable-info’ INFO: provide function with information about generator objects [default=‘yes’] • Enable support for deprecated UNU.RAN routines if you have some problems with older application after upgrading the library: ‘--enable-deprecated’ enable support for deprecated UNU.RAN routines [default=‘no’] • Enable debugging tools: ‘--enable-check-struct’ Debug: check validity of pointers to structures [default=‘no’] ‘--enable-logging’ Debug: print informations about generator into logfile [default=no] 4. Compile and install the libray: make make install Obviously ‘$(prefix)/include’ and ‘$(prefix)/lib’ must be in the search path of your compiler. You can use environment variables to add these directories to the search path. If you are using the bash type (or add to your profile): export LIBRARY_PATH="/lib" export C_INCLURE_PATH="/include" If you want to make a shared library, then making such a library can be enabled using sh ./configure --enable-shared If you want to link against the shared library make sure that it can be found when executing the binary that links to the library. If it is not installed in the usual path, then the easiest way is to set the ‘LD_LIBRARY_PATH’ environment variable. See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages. 5. Documentation in various formats (PDF, HTML, info, plain text) can be found in directory ‘doc’. 6. You can run some tests by make check However, some of these tests requires the usage of the PRNG or RngStreams library and are only executed if these are installed enabled by the corresponding configure flag. An extended set of tests is run by make fullcheck However some of these might fail occasionally due to roundoff errors or the mysteries of floating point arithmetic, since we have used some extreme settings to test the library. Upgrading ......... − _Important:_ UNU.RAN now relies on some aspects of IEEE 754 compliant floating point arithmetic. In particular, ‘1./0.’ and ‘0./0.’ must result in ‘infinity’ and ‘NaN’ (not a number), respectively, and must not cause a floating point exception. For allmost all modern compting architecture this is implemented in hardware. For others there should be a special compiler flag to get this feature (e.g., ‘-MIEEE’ on DEC alpha or ‘-mp’ for the Intel C complier). − Upgrading UNU.RAN from version 0.9.x or earlier: With UNU.RAN version 1.0.x some of the macro definitions in file ‘src/unuran_config.h’ are moved into file ‘config.h’ and are set/controlled by the ‘./configure’ script. Writting logging information into the logfile must now be enabled when running the configure script: sh ./configure --enable-logging − Upgrading UNU.RAN from version 0.7.x or earlier: With UNU.RAN version 0.8.0 the interface for changing underlying distributions and running a reinitialization routine has been simplified. The old routines can be compiled into the library using the following configure flag: sh ./configure --enable-deprecated Notice: Using these deprecated routines is not supported any more and this strong discouraged. Wrapper functions for external sources of uniform random numbers are now enabled by configure flags and not by macros defined in file ‘src/unuran_config.h’. The file ‘src/unuran_config.h’ is not installed any more. It is now only included when the library is compiled. It should be removed from the global include path of the compiler.  File: unuran.info, Node: UsageLib, Next: Concepts, Prev: Installation, Up: Intro 1.3 Using the library ===================== ANSI C Compliance ................. The library is written in ANSI C and is intended to conform to the ANSI C standard. It should be portable to any system with a working ANSI C compiler. The library does not rely on any non-ANSI extensions in the interface it exports to the user. Programs you write using UNU.RAN can be ANSI compliant. Extensions which can be used in a way compatible with pure ANSI C are supported, however, via conditional compilation. This allows the library to take advantage of compiler extensions on those platforms which support them. To avoid namespace conflicts all exported function names and variables have the prefix ‘unur_’, while exported macros have the prefix ‘UNUR_’. Compiling and Linking ..................... If you want to use the library you must include the UNU.RAN header file #include If you also need the test routines then also add #include If wrapper functions for external sources of uniform random number generators are used, the corresponding header files must also be included, e.g., #include If these header files are not installed on the standard search path of your compiler you will also need to provide its location to the preprocessor as a command line flag. The default location of the ‘unuran.h’ is ‘/usr/local/include’. A typical compilation command for a source file ‘app.c’ with the GNU C compiler ‘gcc’ is, gcc -I/usr/local/include -c app.c This results in an object file ‘app.o’. The default include path for ‘gcc’ searches ‘/usr/local/include’ automatically so the ‘-I’ option can be omitted when UNU.RAN is installed in its default location. The library is installed as a single file, ‘libunuran.a’. A shared version of the library is also installed on systems that support shared libraries. The default location of these files is ‘/usr/local/lib’. To link against the library you need to specify the main library. The following example shows how to link an application with the library (and the the RNGSTREAMS library if you decide to use this source of uniform pseudo-random numbers), gcc app.o -lunuran -lrngstreams -lm Shared Libraries ................ To run a program linked with the shared version of the library it may be necessary to define the shell variable ‘LD_LIBRARY_PATH’ to include the directory where the library is installed. For example, LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH To compile a statically linked version of the program instead, use the ‘-static’ flag in ‘gcc’, gcc -static app.o -lunuran -lrngstreams -lm Compatibility with C++ ...................... The library header files automatically define functions to have ‘extern "C"’ linkage when included in C++ programs.  File: unuran.info, Node: Concepts, Next: Contact, Prev: UsageLib, Up: Intro 1.4 Concepts of UNU.RAN ======================= UNU.RAN is a C library for generating non-uniformly distributed random variates. Its emphasis is on the generation of non-standard distribution and on streams of random variates of special purposes. It is designed to provide a consistent tool to sample from distributions with various properties. Since there is no universal method that fits for all situations, various methods for sampling are implemented. UNU.RAN solves this complex task by means of an object oriented programming interface. Three basic objects are used: • distribution object ‘UNUR_DISTR’ Hold all information about the random variates that should be generated. • generator object ‘UNUR_GEN’ Hold the generators for the given distributions. Two generator objects are completely independent of each other. They may share a common uniform random number generator or have their owns. • parameter object ‘UNUR_PAR’ Hold all information for creating a generator object. It is necessary due to various parameters and switches for each of these generation methods. Notice that the parameter objects only hold pointers to arrays but do not have their own copy of such an array. Especially, if a dynamically allocated array is used it _must not_ be freed until the generator object has been created! The idea behind these structures is that creatin distributions, choosing a generation method and draing samples are orthogonal (ie. independent) functions of the library. The parameter object is only introduced due to the necessity to deal with various parameters and switches for each of these generation methods which are required to adjust the algorithms to unusual distributions with extreme properties but have default values that are suitable for most applications. These parameters and the data for distributions are set by various functions. Once a generator object has been created sampling (from the univariate continuous distribution) can be done by the following command: double x = unur_sample_cont(generator); Analogous commands exist for discrete and multivariate distributions. For detailed examples that can be copied and modified see *note Examples::. Distribution objects -------------------- All information about a distribution are stored in objects (structures) of type ‘UNUR_DISTR’. UNU.RAN has five different types of distribution objects: ‘cont’ Continuous univariate distributions. ‘cvec’ Continuous multivariate distributions. ‘discr’ Discrete univariate distributions. ‘cemp’ Continuous empirical univariate distribution, ie. given by a sample. ‘cvemp’ Continuous empirical multivariate distribution, ie. given by a sample. ‘matr’ Matrix distributions. Distribution objects can be created from scratch by the following call distr = unur_distr__new(); where ‘’ is one of the five possible types from the above table. Notice that these commands only create an _empty_ object which still must be filled by means of calls for each type of distribution object (*note Handling distribution objects: Distribution_objects.). The naming scheme of these functions is designed to indicate the corresponding type of the distribution object and the task to be performed. It is demonstated on the following example. unur_distr_cont_set_pdf(distr, mypdf); This command stores a PDF named ‘mypdf’ in the distribution object ‘distr’ which must have the type ‘cont’. Of course UNU.RAN provides an easier way to use standard distributions. Instead of using ‘unur_distr__new’ calls and fuctions ‘unur_distr__set_<...>’ for setting data, objects for standard distribution can be created by a single call. Eg. to get an object for the normal distribution with mean 2 and standard deviation 5 use double parameter[2] = {2.0 ,5.0}; UNUR_DISTR *distr = unur_distr_normal(parameter, 2); For a list of standard distributions see *note Standard distributions: Stddist. Generation methods ------------------ The information that a distribution object must contain depends heavily on the chosen generation method choosen. Brackets indicate optional information while a tilde indicates that only an approximation must be provided. See *note Glossary::, for unfamiliar terms. Methods for continuous univariate distributions sample with ‘unur_sample_cont’ method PDF dPDF CDF mode area other AROU x x [x] T-concave ARS x x T-concave CEXT wrapper for external generator CSTD build-in standard distribution HINV [x] [x] x HRB bounded hazard rate HRD decreasing hazard rate HRI increasing hazard rate ITDR x x x monotone with pole NINV [x] x NROU x [x] PINV x [x] [~] SROU x x x T-concave SSR x x x T-concave TABL x x [~] all local extrema TDR x x T-concave UTDR x x ~ T-concave Methods for continuous empirical univariate distributions sample with ‘unur_sample_cont’ EMPK: Requires an observed sample. EMPL: Requires an observed sample. Methods for continuous multivariate distributions sample with ‘unur_sample_vec’ NORTA: Requires rank correlation matrix and marginal distributions. VNROU: Requires the PDF. MVSTD: Generator for built-in standard distributions. MVTDR: Requires PDF and gradiant of PDF. Methods for continuous empirical multivariate distributions sample with ‘unur_sample_vec’ VEMPK: Requires an observed sample. Methods for discrete univariate distributions sample with ‘unur_sample_discr’ method PMF PV mode sum other DARI x x ~ T-concave DAU [x] x DEXT wrapper for external generator DGT [x] x DSROU x x x T-concave DSS [x] x x DSTD build-in standard distribution Methods for matrix distributions sample with ‘unur_sample_matr’ MCORR: Distribution object for random correlation matrix. Markov Chain Methods for continuous multivariate distributions sample with ‘unur_sample_vec’ GIBBS: T-concave logPDF and derivatives of logPDF. HITRO: Requires PDF. Because of tremendous variety of possible problems, UNU.RAN provides many methods. All information for creating a generator object has to be collected in a parameter object first. For example, if the task is to sample from a continuous distribution the method AROU might be a good choice. Then the call UNUR_PAR *par = unur_arou_new(distribution); creates an parameter object ‘par’ with a pointer to the distribution object and default values for all necessary parameters for method AROU. Other methods can be used by replacing ‘arou’ with the name of the desired methods (in lower case letters): UNUR_PAR *par = unur__new(distribution); This sets the default values for all necessary parameters for the chosen method. These are suitable for almost all applications. Nevertheless, it is possible to control the behavior of the method using corresponding ‘set’ calls for each method. This might be necessary to adjust the algorithm for an unusual distribution with extreme properties, or just for fine tuning the perforence of the algorithm. The following example demonstrates how to change the maximum number of iterations for method NINV to the value 50: unur_ninv_set_max_iteration(par, 50); All available methods are described in details in *note Methods::. Creating a generator object --------------------------- Now it is possible to create a generator object: UNUR_GEN *generator = unur_init(par); if (generator == NULL) exit(EXIT_FAILURE); *Important:* You must always check whether ‘unur_init’ has been executed successfully. Otherwise the ‘NULL’ pointer is returned which causes a segmentation fault when used for sampling. *Important:* The call of ‘unur_init’ *destroys* the parameter object! Moreover, it is recommended to call ‘unur_init’ immediately after the parameter object ‘par’ has created and modified. An existing generator object is a rather static construct. Nevertheless, some of the parameters can still be modified by ‘chg’ calls, e.g. unur_ninv_chg_max_iteration(gen, 30); Notice that it is important _when_ parameters are changed because different functions must be used: The function name includes the term ‘set’ and the first argument must be of type ‘UNUR_PAR’ when the parameters are changed _before_ the generator object is created. The function name includes the term ‘chg’ and the first argument must be of type ‘UNUR_GEN’ when the parameters are changed for an _existing_ generator object. For details see *note Methods::. Sampling -------- You can now use your generator object in any place of your program to sample from your distribution. You only have to take care about the type of variates it computes: ‘double’, ‘int’ or a vector (array of ‘double’s). Notice that at this point it does not matter whether you are sampling from a gamma distribution, a truncated normal distribution or even an empirical distribution. Reinitializing -------------- It is possible for a generator object to change the parameters and the domain of the underlying distribution. This must be done by extracting this object by means of a ‘unur_get_distr’ call and changing the distribution using the correspondig set calls, see *note Handling distribution objects: Distribution_objects. The generator object *must* then be reinitialized by means of the ‘unur_reinit’ call. _Important_: Currently not all methods allow reinitialization, see the description of the particular method (keyword Reinit). Destroy ------- When you do not need your generator object any more, you should destroy it: unur_free(generator); Uniform random numbers ---------------------- Each generator object can have its own uniform random number generator or share one with others. When created a parameter object the pointer for the uniform random number generator is set to the default generator. However, it can be changed at any time to any other generator: unur_set_urng(par, urng); or unur_chg_urng(generator, urng); respectively. See *note Using uniform random number generators: URNG, for details.  File: unuran.info, Node: Contact, Prev: Concepts, Up: Intro 1.5 Contact the authors ======================= If you have any problems with UNU.RAN, suggestions how to improve the library, or find a bug, please contact us via email . For news please visit out homepage at .  File: unuran.info, Node: Examples, Next: StringAPI, Prev: Intro, Up: Top 2 Examples ********** * Menu: * Example_0:: As short as possible * Example_0_str:: As short as possible (String API) * Example_1:: Select a method * Example_1_str:: Select a method (String API) * Example_2:: Arbitrary distributions * Example_2_str:: Arbitrary distributions (String API) * Example_3:: Change parameters of the method * Example_3_str:: Change parameters of the method (String API) * Example_4:: Change uniform random generator * Example_reinit:: Change parameters of underlying distribution * Example_anti:: Sample pairs of antithetic random variates * Example_anti_str:: Sample pairs of antithetic random variates (String API) * Example_More:: More examples The examples in this chapter should compile cleanly and can be found in the directory ‘examples’ of the source tree of UNU.RAN. Assuming that UNU.RAN as well as the PRNG libraries have been installed properly (*note Installation::) each of these can be compiled (using the GCC in this example) with gcc -Wall -O2 -o example example.c -lunuran -lprng -lm _Remark:_ ‘-lprng’ must be omitted when the PRNG library is not installed. Then however some of the examples might not work. The library uses three objects: ‘UNUR_DISTR’, ‘UNUR_PAR’ and ‘UNUR_GEN’. It is not important to understand the details of these objects but it is important not to changed the order of their creation. The distribution object can be destroyed _after_ the generator object has been made. (The parameter object is freed automatically by the ‘unur_init’ call.) It is also important to check the result of the ‘unur_init’ call. If it has failed the ‘NULL’ pointer is returned and causes a segmentation fault when used for sampling. We give all examples with the UNU.RAN standard API and the more convenient string API.  File: unuran.info, Node: Example_0, Next: Example_0_str, Up: Examples 2.1 As short as possible ======================== Select a distribution and let UNU.RAN do all necessary steps. /* ------------------------------------------------------------- */ /* File: example0.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; /* will hold the random number */ /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Use a predefined standard distribution: */ /* Gaussian with mean zero and standard deviation 1. */ /* Since this is the standard form of the distribution, */ /* we need not give these parameters. */ distr = unur_distr_normal(NULL, 0); /* Use method AUTO: */ /* Let UNURAN select a suitable method for you. */ par = unur_auto_new(distr); /* Now you can change some of the default settings for the */ /* parameters of the chosen method. We don't do it here. */ /* Create the generator object. */ gen = unur_init(par); /* Notice that this call has also destroyed the parameter */ /* object `par' as a side effect. */ /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the standard Gaussian distribution. */ /* Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */  File: unuran.info, Node: Example_0_str, Next: Example_1, Prev: Example_0, Up: Examples 2.2 As short as possible (String API) ===================================== Select a distribution and let UNU.RAN do all necessary steps. /* ------------------------------------------------------------- */ /* File: example0_str.c */ /* ------------------------------------------------------------- */ /* String API. */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; /* will hold the random number */ /* Declare UNURAN generator object. */ UNUR_GEN *gen; /* generator object */ /* Create the generator object. */ /* Use a predefined standard distribution: */ /* Standard Gaussian distribution. */ /* Use method AUTO: */ /* Let UNURAN select a suitable method for you. */ gen = unur_str2gen("normal()"); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* Now you can use the generator object `gen' to sample from */ /* the standard Gaussian distribution. */ /* Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */  File: unuran.info, Node: Example_1, Next: Example_1_str, Prev: Example_0_str, Up: Examples 2.3 Select a method =================== Select method AROU and use it with default parameters. /* ------------------------------------------------------------- */ /* File: example1.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; /* will hold the random number */ /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Use a predefined standard distribution: */ /* Gaussian with mean zero and standard deviation 1. */ /* Since this is the standard form of the distribution, */ /* we need not give these parameters. */ distr = unur_distr_normal(NULL, 0); /* Choose a method: AROU. */ /* For other (suitable) methods replace "arou" with the */ /* respective name (in lower case letters). */ par = unur_arou_new(distr); /* Now you can change some of the default settings for the */ /* parameters of the chosen method. We don't do it here. */ /* Create the generator object. */ gen = unur_init(par); /* Notice that this call has also destroyed the parameter */ /* object `par' as a side effect. */ /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the standard Gaussian distribution. */ /* Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */  File: unuran.info, Node: Example_1_str, Next: Example_2, Prev: Example_1, Up: Examples 2.4 Select a method (String API) ================================ Select method AROU and use it with default parameters. /* ------------------------------------------------------------- */ /* File: example1_str.c */ /* ------------------------------------------------------------- */ /* String API. */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; /* will hold the random number */ /* Declare UNURAN generator object. */ UNUR_GEN *gen; /* generator object */ /* Create the generator object. */ /* Use a predefined standard distribution: */ /* Standard Gaussian distribution. */ /* Choose a method: AROU. */ /* For other (suitable) methods replace "arou" with the */ /* respective name. */ gen = unur_str2gen("normal() & method=arou"); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* Now you can use the generator object `gen' to sample from */ /* the standard Gaussian distribution. */ /* Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */  File: unuran.info, Node: Example_2, Next: Example_2_str, Prev: Example_1_str, Up: Examples 2.5 Arbitrary distributions =========================== If you want to sample from a non-standard distribution, UNU.RAN might be exactly what you need. Depending on the information is available, a method must be choosen for sampling, see *note Concepts:: for an overview and *note Methods:: for details. /* ------------------------------------------------------------- */ /* File: example2.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* In this example we build a distribution object from scratch */ /* and sample from this distribution. */ /* */ /* We use method TDR (Transformed Density Rejection) which */ /* required a PDF and the derivative of the PDF. */ /* ------------------------------------------------------------- */ /* Define the PDF and dPDF of our distribution. */ /* */ /* Our distribution has the PDF */ /* */ /* / 1 - x*x if |x| <= 1 */ /* f(x) = < */ /* \ 0 otherwise */ /* */ /* The PDF of our distribution: */ double mypdf( double x, const UNUR_DISTR *distr ) /* The second argument (`distr') can be used for parameters */ /* for the PDF. (We do not use parameters in our example.) */ { if (fabs(x) >= 1.) return 0.; else return (1.-x*x); } /* end of mypdf() */ /* The derivative of the PDF of our distribution: */ double mydpdf( double x, const UNUR_DISTR *distr ) { if (fabs(x) >= 1.) return 0.; else return (-2.*x); } /* end of mydpdf() */ /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; /* will hold the random number */ /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Create a new distribution object from scratch. */ /* It is a continuous distribution, and we need a PDF and the */ /* derivative of the PDF. Moreover we set the domain. */ /* Get empty distribution object for a continuous distribution */ distr = unur_distr_cont_new(); /* Assign the PDF and dPDF (defined above). */ unur_distr_cont_set_pdf( distr, mypdf ); unur_distr_cont_set_dpdf( distr, mydpdf ); /* Set the domain of the distribution (optional for TDR). */ unur_distr_cont_set_domain( distr, -1., 1. ); /* Choose a method: TDR. */ par = unur_tdr_new(distr); /* Now you can change some of the default settings for the */ /* parameters of the chosen method. We don't do it here. */ /* Create the generator object. */ gen = unur_init(par); /* Notice that this call has also destroyed the parameter */ /* object `par' as a side effect. */ /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */  File: unuran.info, Node: Example_2_str, Next: Example_3, Prev: Example_2, Up: Examples 2.6 Arbitrary distributions (String API) ======================================== If you want to sample from a non-standard distribution, UNU.RAN might be exactly what you need. Depending on the information is available, a method must be choosen for sampling, see *note Concepts:: for an overview and *note Methods:: for details. /* ------------------------------------------------------------- */ /* File: example2_str.c */ /* ------------------------------------------------------------- */ /* String API. */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* In this example we use a generic distribution object */ /* and sample from this distribution. */ /* */ /* The PDF of our distribution is given by */ /* */ /* / 1 - x*x if |x| <= 1 */ /* f(x) = < */ /* \ 0 otherwise */ /* */ /* We use method TDR (Transformed Density Rejection) which */ /* required a PDF and the derivative of the PDF. */ /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; /* will hold the random number */ /* Declare UNURAN generator object. */ UNUR_GEN *gen; /* generator object */ /* Create the generator object. */ /* Use a generic continuous distribution. */ /* Choose a method: TDR. */ gen = unur_str2gen( "distr = cont; pdf=\"1-x*x\"; domain=(-1,1) & method=tdr"); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */  File: unuran.info, Node: Example_3, Next: Example_3_str, Prev: Example_2_str, Up: Examples 2.7 Change parameters of the method =================================== Each method for generating random numbers allows several parameters to be modified. If you do not want to use default values, it is possible to change them. The following example illustrates how to change parameters. For details see *note Methods::. /* ------------------------------------------------------------- */ /* File: example3.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; /* will hold the random number */ double fparams[2]; /* array for parameters for distribution */ /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Use a predefined standard distribution: */ /* Gaussian with mean 2. and standard deviation 0.5. */ fparams[0] = 2.; fparams[1] = 0.5; distr = unur_distr_normal( fparams, 2 ); /* Choose a method: TDR. */ par = unur_tdr_new(distr); /* Change some of the default parameters. */ /* We want to use T(x)=log(x) for the transformation. */ unur_tdr_set_c( par, 0. ); /* We want to have the variant with immediate acceptance. */ unur_tdr_set_variant_ia( par ); /* We want to use 10 construction points for the setup */ unur_tdr_set_cpoints ( par, 10, NULL ); /* Create the generator object. */ gen = unur_init(par); /* Notice that this call has also destroyed the parameter */ /* object `par' as a side effect. */ /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* It is possible with method TDR to truncate the distribution */ /* for an existing generator object ... */ unur_tdr_chg_truncated( gen, -1., 0. ); /* ... and sample again. */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */  File: unuran.info, Node: Example_3_str, Next: Example_4, Prev: Example_3, Up: Examples 2.8 Change parameters of the method (String API) ================================================ Each method for generating random numbers allows several parameters to be modified. If you do not want to use default values, it is possible to change them. The following example illustrates how to change parameters. For details see *note Methods::. /* ------------------------------------------------------------- */ /* File: example3_str.c */ /* ------------------------------------------------------------- */ /* String API. */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; /* will hold the random number */ /* Declare UNURAN generator object. */ UNUR_GEN *gen; /* generator object */ /* Create the generator object. */ /* Use a predefined standard distribution: */ /* Gaussian with mean 2. and standard deviation 0.5. */ /* Choose a method: TDR with parameters */ /* c = 0: use T(x)=log(x) for the transformation; */ /* variant "immediate acceptance"; */ /* number of construction points = 10. */ gen = unur_str2gen( "normal(2,0.5) & method=tdr; c=0.; variant_ia; cpoints=10"); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* It is possible with method TDR to truncate the distribution */ /* for an existing generator object ... */ unur_tdr_chg_truncated( gen, -1., 0. ); /* ... and sample again. */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */  File: unuran.info, Node: Example_4, Next: Example_reinit, Prev: Example_3_str, Up: Examples 2.9 Change uniform random generator =================================== All generator object use the same default uniform random number generator by default. This can be changed to any generator of your choice such that each generator object has its own random number generator or can share it with some other objects. It is also possible to change the default generator at any time. See *note Using uniform random number generators: URNG, for details. The following example shows how the uniform random number generator can be set or changed for a generator object. It requires the RNGSTREAMS library to be installed and used. Otherwise the example must be modified accordingly. /* ------------------------------------------------------------- */ /* File: example_rngstreams.c */ /* ------------------------------------------------------------- */ #ifdef UNURAN_SUPPORTS_RNGSTREAM /* ------------------------------------------------------------- */ /* This example makes use of the RNGSTREAM library for */ /* for generating uniform random numbers. */ /* (see http://statmath.wu.ac.at/software/RngStreams/) */ /* To compile this example you must have set */ /* ./configure --with-urng-rngstream */ /* (Of course the executable has to be linked against the */ /* RNGSTREAM library.) */ /* ------------------------------------------------------------- */ /* Include UNURAN header files. */ #include #include /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; /* will hold the random number */ double fparams[2]; /* array for parameters for distribution */ /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Declare objects for uniform random number generators. */ UNUR_URNG *urng1, *urng2; /* uniform generator objects */ /* The RNGSTREAMS library sets a package seed. */ unsigned long seed[] = {111u, 222u, 333u, 444u, 555u, 666u}; RngStream_SetPackageSeed(seed); /* RngStreams only: */ /* Make a object for uniform random number generator. */ /* For details see */ /* http://statmath.wu.ac.at/software/RngStreams/ */ urng1 = unur_urng_rngstream_new("urng-1"); if (urng1 == NULL) exit (EXIT_FAILURE); /* Use a predefined standard distribution: */ /* Beta with parameters 2 and 3. */ fparams[0] = 2.; fparams[1] = 3.; distr = unur_distr_beta( fparams, 2 ); /* Choose a method: TDR. */ par = unur_tdr_new(distr); /* Set uniform generator in parameter object */ unur_set_urng( par, urng1 ); /* Create the generator object. */ gen = unur_init(par); /* Notice that this call has also destroyed the parameter */ /* object `par' as a side effect. */ /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* Now we want to switch to a different (independent) stream */ /* of uniform random numbers. */ urng2 = unur_urng_rngstream_new("urng-2"); if (urng2 == NULL) exit (EXIT_FAILURE); unur_chg_urng( gen, urng2 ); /* ... and sample again. */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); /* We also should destroy the uniform random number generators.*/ unur_urng_free(urng1); unur_urng_free(urng2); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ #else #include #include int main(void) { printf("You must enable the RNGSTREAM library to run this example!\n\n"); exit (77); /* exit code for automake check routines */ } #endif /* ------------------------------------------------------------- */  File: unuran.info, Node: Example_reinit, Next: Example_anti, Prev: Example_4, Up: Examples 2.10 Change parameters of underlying distribution ================================================= One a generator object has been created it allows to draw samples from the distribution with the given parameters. However, some methods allow to change the parameters of the underlying distribution and reinitialize the generator object again. Thus when the parameters of the distribution vary for each draw we save overhead for destroying the old object and creating a new one. The following example shows how the parameters of a GIG distribution can be changed when method CSTD is used. /* ------------------------------------------------------------- */ /* File: example_reinit.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* In this example we show how the parameters of the underlying */ /* distribution can be changed for an existing generator object. */ /* We use the GIG distribution with method CSTD. */ /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; /* will hold the random number */ /* Parameters of distribution. */ double dparam[3] = {0.5, 1., 5.}; /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Create initial GIG distribution object */ distr = unur_distr_gig(dparam, 3); /* Choose a method: CSTD. */ par = unur_cstd_new(distr); /* Create the generator object. */ gen = unur_init(par); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* It is possible for method CSTD to change the parameters of */ /* underlying distribution. However, we have to extract to */ /* pointer to the distribution. Be carefull with this pointer! */ distr = unur_get_distr(gen); /* Change the parameter(s). */ dparam[2] = 0.001; unur_distr_cont_set_pdfparams(distr,dparam,3); /* Do not forget to reinitialize the generator object. */ /* Check the return code. */ /* (and try to find a better error handling) */ if (unur_reinit(gen) != UNUR_SUCCESS) { fprintf(stderr, "ERROR: cannot reinitialize generator object\n"); exit (EXIT_FAILURE); } /* Draw a new sample. */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* Changing parameters can be repeated. */ dparam[2] = 1000; unur_distr_cont_set_pdfparams(distr,dparam,3); if (unur_reinit(gen) != UNUR_SUCCESS) { fprintf(stderr, "ERROR: cannot reinitialize generator object\n"); exit (EXIT_FAILURE); } for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */  File: unuran.info, Node: Example_anti, Next: Example_anti_str, Prev: Example_reinit, Up: Examples 2.11 Sample pairs of antithetic random variates =============================================== Using Method TDR it is easy to sample pairs of antithetic random variates. /* ------------------------------------------------------------- */ /* File: example_anti.c */ /* ------------------------------------------------------------- */ #ifdef UNURAN_SUPPORTS_PRNG /* ------------------------------------------------------------- */ /* This example makes use of the PRNG library for generating */ /* uniform random numbers. */ /* (see http://statmath.wu.ac.at/prng/) */ /* To compile this example you must have set */ /* ./configure --with-urng-prng */ /* (Of course the executable has to be linked against the */ /* PRNG library.) */ /* ------------------------------------------------------------- */ /* Example how to sample from two streams of antithetic random */ /* variates from Gaussian N(2,5) and Gamma(4) distribution, resp.*/ /* ------------------------------------------------------------- */ /* Include UNURAN header files. */ #include #include /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double xn, xg; /* will hold the random number */ double fparams[2]; /* array for parameters for distribution */ /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen_normal, *gen_gamma; /* generator objects */ /* Declare objects for uniform random number generators. */ UNUR_URNG *urng1, *urng2; /* uniform generator objects */ /* PRNG only: */ /* Make a object for uniform random number generator. */ /* For details see http://statmath.wu.ac.at/prng/. */ /* The first generator: Gaussian N(2,5) */ /* uniform generator: We use the Mersenne Twister. */ urng1 = unur_urng_prng_new("mt19937(1237)"); if (urng1 == NULL) exit (EXIT_FAILURE); /* UNURAN generator object for N(2,5) */ fparams[0] = 2.; fparams[1] = 5.; distr = unur_distr_normal( fparams, 2 ); /* Choose method TDR with variant PS. */ par = unur_tdr_new( distr ); unur_tdr_set_variant_ps( par ); /* Set uniform generator in parameter object. */ unur_set_urng( par, urng1 ); /* Set auxilliary uniform random number generator. */ /* We use the default generator. */ unur_use_urng_aux_default( par ); /* Alternatively you can create and use your own auxilliary */ /* uniform random number generator: */ /* UNUR_URNG *urng_aux; */ /* urng_aux = unur_urng_prng_new("tt800"); */ /* if (urng_aux == NULL) exit (EXIT_FAILURE); */ /* unur_set_urng_aux( par, urng_aux ); */ /* Create the generator object. */ gen_normal = unur_init(par); if (gen_normal == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* Destroy distribution object (gen_normal has its own copy). */ unur_distr_free(distr); /* The second generator: Gamma(4) with antithetic variates. */ /* uniform generator: We use the Mersenne Twister. */ urng2 = unur_urng_prng_new("anti(mt19937(1237))"); if (urng2 == NULL) exit (EXIT_FAILURE); /* UNURAN generator object for gamma(4) */ fparams[0] = 4.; distr = unur_distr_gamma( fparams, 1 ); /* Choose method TDR with variant PS. */ par = unur_tdr_new( distr ); unur_tdr_set_variant_ps( par ); /* Set uniform generator in parameter object. */ unur_set_urng( par, urng2 ); /* Set auxilliary uniform random number generator. */ /* We use the default generator. */ unur_use_urng_aux_default( par ); /* Alternatively you can create and use your own auxilliary */ /* uniform random number generator (see above). */ /* Notice that both generator objects gen_normal and */ /* gen_gamma can share the same auxilliary URNG. */ /* Create the generator object. */ gen_gamma = unur_init(par); if (gen_gamma == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* Destroy distribution object (gen_normal has its own copy). */ unur_distr_free(distr); /* Now we can sample pairs of negatively correlated random */ /* variates. E.g.: */ for (i=0; i<10; i++) { xn = unur_sample_cont(gen_normal); xg = unur_sample_cont(gen_gamma); printf("%g, %g\n",xn,xg); } /* When you do not need the generator objects any more, you */ /* can destroy it. */ unur_free(gen_normal); unur_free(gen_gamma); /* We also should destroy the uniform random number generators.*/ unur_urng_free(urng1); unur_urng_free(urng2); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ #else #include #include int main(void) { printf("You must enable the PRNG library to run this example!\n\n"); exit (77); /* exit code for automake check routines */ } #endif /* ------------------------------------------------------------- */  File: unuran.info, Node: Example_anti_str, Next: Example_More, Prev: Example_anti, Up: Examples 2.12 Sample pairs of antithetic random variates (String API) ============================================================ Using Method TDR it is easy to sample pairs of antithetic random variates. /* ------------------------------------------------------------- */ /* File: example_anti_str.c */ /* ------------------------------------------------------------- */ /* String API. */ /* ------------------------------------------------------------- */ #ifdef UNURAN_SUPPORTS_PRNG /* ------------------------------------------------------------- */ /* This example makes use of the PRNG library for generating */ /* uniform random numbers. */ /* (see http://statmath.wu.ac.at/prng/) */ /* To compile this example you must have set */ /* ./configure --with-urng-prng */ /* (Of course the executable has to be linked against the */ /* PRNG library.) */ /* ------------------------------------------------------------- */ /* Example how to sample from two streams of antithetic random */ /* variates from Gaussian N(2,5) and Gamma(4) distribution, resp.*/ /* ------------------------------------------------------------- */ /* Include UNURAN header files. */ #include #include /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double xn, xg; /* will hold the random number */ /* Declare UNURAN generator objects. */ UNUR_GEN *gen_normal, *gen_gamma; /* PRNG only: */ /* Make a object for uniform random number generator. */ /* For details see http://statmath.wu.ac.at/prng/. */ /* Create the first generator: Gaussian N(2,5) */ gen_normal = unur_str2gen("normal(2,5) & method=tdr; variant_ps & urng=mt19937(1237)"); if (gen_normal == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* Set auxilliary uniform random number generator. */ /* We use the default generator. */ unur_chgto_urng_aux_default(gen_normal); /* The second generator: Gamma(4) with antithetic variates. */ gen_gamma = unur_str2gen("gamma(4) & method=tdr; variant_ps & urng=anti(mt19937(1237))"); if (gen_gamma == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } unur_chgto_urng_aux_default(gen_gamma); /* Now we can sample pairs of negatively correlated random */ /* variates. E.g.: */ for (i=0; i<10; i++) { xn = unur_sample_cont(gen_normal); xg = unur_sample_cont(gen_gamma); printf("%g, %g\n",xn,xg); } /* When you do not need the generator objects any more, you */ /* can destroy it. */ /* But first we have to destroy the uniform random number */ /* generators. */ unur_urng_free(unur_get_urng(gen_normal)); unur_urng_free(unur_get_urng(gen_gamma)); unur_free(gen_normal); unur_free(gen_gamma); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ #else #include #include int main(void) { printf("You must enable the PRNG library to run this example!\n\n"); exit (77); /* exit code for automake check routines */ } #endif /* ------------------------------------------------------------- */  File: unuran.info, Node: Example_More, Prev: Example_anti_str, Up: Examples 2.13 More examples ================== *Note Methods for continuous univariate distributions: Methods_for_CONT. *Note Methods for continuous empirical univariate distributions: Methods_for_CEMP. *Note Methods for continuous empirical multivariate distributions: Methods_for_CVEMP. *Note Methods for discrete univariate distributions: Methods_for_DISCR.  File: unuran.info, Node: StringAPI, Next: Distribution_objects, Prev: Examples, Up: Top 3 String Interface ****************** * Menu: * StringSyntax:: Syntax of String Interface * StringDistr:: Distribution String * StringFunct:: Function String * StringMethod:: Method String * StringURNG:: Uniform RNG String The string interface (string API) provided by the ‘unur_str2gen’ call is the easiest way to use UNU.RAN. This function takes a character string as its argument. The string is parsed and the information obtained is used to create a generator object. It returns ‘NULL’ if this fails, either due to a syntax error, or due to invalid data. In both cases ‘unur_error’ is set to the corresponding error codes (*note Error reporting: Error_reporting.). Additionally there exists the call ‘unur_str2distr’ that only produces a distribution object. Notice that the string interface does not implement all features of the UNU.RAN library. For trickier tasks it might be necessary to use the UNU.RAN calls. In *note Examples::, all examples are given using both the UNU.RAN standard API and this convenient string API. The corresponding programm codes are equivalent. Function reference ------------------ -- Function: UNUR_GEN* unur_str2gen (const CHAR* STRING) Get a generator object for the distribution, method and uniform random number generator as described in the given STRING. See *note Syntax of String Interface: StringSyntax, for details. -- Function: UNUR_DISTR* unur_str2distr (const CHAR* STRING) Get a distribution object for the distribution described in STRING. See *note Syntax of String Interface: StringSyntax, and *note Distribution String: StringDistr, for details. However, only the block for the distribution object is allowed. -- Function: UNUR_GEN* unur_makegen_ssu (const CHAR* DISTRSTR, const CHAR* METHODSTR, UNUR_URNG* URNG) -- Function: UNUR_GEN* unur_makegen_dsu (const UNUR_DISTR* DISTRIBUTION, const CHAR* METHODSTR, UNUR_URNG* URNG) Make a generator object for the distribution, method and uniform random number generator. The distribution can be given either as string DISTRSTR or as a distribution object DISTR. The method must be given as a string METHODSTR. For the syntax of these strings see *note Syntax of String Interface: StringSyntax. However, the ‘method’ keyword is optional for these calls and can be omitted. If METHODSTR is the empty (blank) string or ‘NULL’ method AUTO is used. The uniform random number generator is optional. If URNG is ‘NULL’ then the default uniform random number generator is used.  File: unuran.info, Node: StringSyntax, Next: StringDistr, Up: StringAPI 3.1 Syntax of String Interface ============================== The given string holds information about the requested distribution and (optional) about the sampling method and the uniform random number generator invoked. The interpretation of the string is not case-sensitive, all white spaces are ignored. The string consists of up to three blocks, separated by ampersands ‘&’. Each block consists of ‘=’ pairs, separated by semicolons ‘;’. The first key in each block is used to indicate each block. We have three different blocks with the following (first) keys: ‘distr’ definition of the distribution (*note Distribution String: StringDistr.). ‘method’ description of the transformation method (*note Method String: StringMethod.). ‘urng’ uniform random number generation (*note Uniform RNG String: StringURNG.). The ‘distr’ block must be the very first block and is obligatory. All the other blocks are optional and can be arranged in arbitrary order. For details see the following description of each block. In the following example distr = normal(3.,0.75); domain = (0,inf) & method = tdr; c = 0 we have a distribution block for the truncated normal distribution with mean 3 and standard deviation 0.75 on domain (0,infinity); and block for choosing method TDR with parameter c set to 0. The ‘=’ pairs that follow the first (initial) pair in each block are used to set parameters. The name of the parameter is given by the ‘’ string. It is deduced from the UNU.RAN set calls by taking the part after ‘..._set_’. The ‘’ string holds the parameters to be set, separated by commata ‘,’. There are three types of parameters: _string ‘"..."’ or ‘'...'’_ i.e. any sequence of characters enclosed by double quotes ‘"..."’ or single quotes ‘'...'’ (there is no distinction between double quotes ‘"’ and single quotes ‘'’). _list ‘(...,...)’_ i.e. list of _numbers_, separated by commata ‘,’, enclosed in parenthesis ‘(...)’. _number_ a sequence of characters that is not enclosed by double quotes ‘"..."’, single quotes ‘'...'’, or parenthesis ‘(...)’. It is interpreted as float or integer depending on the type of the corresponding parameter. The ‘’ string (including the character ‘=’) can be omitted when no argument is required. At the moment not all ‘set’ calls are supported. The syntax for the ‘’ can be directly derived from the corresponding ‘set’ calls. To simplify the syntax additional shortcuts are possible. The following table lists the parameters for the ‘set’ calls that are supported by the string interface; the entry in parenthesis gives the type of the argument as ‘’ string: ‘int (number):’ The number is interpreted as an integer. ‘true’ and ‘on’ are transformed to ‘1’, ‘false’ and ‘off’ are transformed to ‘0’. A missing argument is interpreted as ‘1’. ‘int, int (number, number or list):’ The two numbers or the first two entries in the list are interpreted as a integers. ‘inf’ and ‘-inf’ are transformed to ‘INT_MAX’ and ‘INT_MIN’ respectively, i.e. the largest and smallest integers that can be represented by the computer. ‘unsigned (number):’ The number is interpreted as an unsigned hexadecimal integer. ‘double (number):’ The number is interpreted as a floating point number. ‘inf’ is transformed to ‘UNUR_INFINITY’. ‘double, double (number, number or list):’ The two numbers or the first two entries in the list are interpreted as a floating point numbers. ‘inf’ is transformed to ‘UNUR_INFINITY’. However using ‘inf’ in the list might not work for all versions of C. Then it is recommended to use two single numbers instead of a list. ‘int, double* ([number,] list or number):’ − The list is interpreted as a double array. The (first) number as its length. If it is less than the actual size of the array only the first entries of the array are used. − If only the list is given (i.e., if the first number is omitted), the first number is set to the actual size of the array. − If only the number is given (i.e., if the list is omitted), the ‘NULL’ pointer is used instead an array as argument. ‘double*, int (list [,number]):’ The list is interpreted as a double array. The (second) number as its length. If the length is omitted, it is replaced by the actual size of the array. (Only in the ‘distribution’ block!) ‘char* (string):’ The character string is passed as is to the corresponding set call. Notice that missing entries in a list of numbers are interpreted as ‘0’. E.g, a the list ‘(1,,3)’ is read as ‘(1,0,3)’, the list ‘(1,2,)’ as ‘(1,2,0)’. The the list of ‘key’ strings in *note Keys for Distribution String: KeysDistr, and *note Keys for Method String: KeysMethod, for further details.  File: unuran.info, Node: StringDistr, Next: StringFunct, Prev: StringSyntax, Up: StringAPI 3.2 Distribution String ======================= * Menu: * KeysDistr:: Keys for Distribution String The ‘distr’ block must be the very first block and is obligatory. For that reason the keyword ‘distr’ is optional and can be omitted (together with the ‘=’ character). Moreover it is ignored while parsing the string. However, to avoid some possible confusion it has to start with the letter ‘d’ (if it is given at all). The value of the ‘distr’ key is used to get the distribution object, either via a ‘unur_distr_’ call for a standard distribution via a ‘unur_distr__new’ call to get an object of a generic distribution. However not all generic distributions are supported yet. The parameters for the standard distribution are given as a list. There must not be any character (other than white space) between the name of the standard distribution and the opening parenthesis ‘(’ of this list. E.g., to get a beta distribution, use distr = beta(2,4) To get an object for a discrete distribution with probability vector (0.5,0.2,0.3), use distr = discr; pv = (0.5,0.2,0.3) It is also possible to set a PDF, PMF, or CDF using a string. E.g., to create a continuous distribution with PDF proportional to ‘exp(-sqrt(2+(x-1)^2) + (x-1))’ and domain (0,inf) use distr = cont; pdf = "exp(-sqrt(2+(x-1)^2) + (x-1))" Notice: If this string is used in an ‘unur_str2distr’ or ‘unur_str2gen’ call the double quotes ‘"’ must be protected by ‘\"’. Alternatively, single quotes may be used instead distr = cont; pdf = 'exp(-sqrt(2+(x-1)^2) + (x-1))' For the details of function strings see *note Function String: StringFunct.  File: unuran.info, Node: KeysDistr, Up: StringDistr 3.2.1 Keys for Distribution String ---------------------------------- List of standard distributions *note Standard distributions: Stddist. − ‘[distr =] beta(...)’ ⇒ *note beta:: − ‘[distr =] binomial(...)’ ⇒ *note binomial:: − ‘[distr =] cauchy(...)’ ⇒ *note cauchy:: − ‘[distr =] chi(...)’ ⇒ *note chi:: − ‘[distr =] chisquare(...)’ ⇒ *note chisquare:: − ‘[distr =] exponential(...)’ ⇒ *note exponential:: − ‘[distr =] extremeI(...)’ ⇒ *note extremeI:: − ‘[distr =] extremeII(...)’ ⇒ *note extremeII:: − ‘[distr =] F(...)’ ⇒ *note F:: − ‘[distr =] gamma(...)’ ⇒ *note gamma:: − ‘[distr =] geometric(...)’ ⇒ *note geometric:: − ‘[distr =] gig(...)’ ⇒ *note gig:: − ‘[distr =] gig2(...)’ ⇒ *note gig2:: − ‘[distr =] hyperbolic(...)’ ⇒ *note hyperbolic:: − ‘[distr =] hypergeometric(...)’ ⇒ *note hypergeometric:: − ‘[distr =] ig(...)’ ⇒ *note ig:: − ‘[distr =] laplace(...)’ ⇒ *note laplace:: − ‘[distr =] logarithmic(...)’ ⇒ *note logarithmic:: − ‘[distr =] logistic(...)’ ⇒ *note logistic:: − ‘[distr =] lognormal(...)’ ⇒ *note lognormal:: − ‘[distr =] lomax(...)’ ⇒ *note lomax:: − ‘[distr =] negativebinomial(...)’ ⇒ *note negativebinomial:: − ‘[distr =] normal(...)’ ⇒ *note normal:: − ‘[distr =] pareto(...)’ ⇒ *note pareto:: − ‘[distr =] poisson(...)’ ⇒ *note poisson:: − ‘[distr =] powerexponential(...)’ ⇒ *note powerexponential:: − ‘[distr =] rayleigh(...)’ ⇒ *note rayleigh:: − ‘[distr =] slash(...)’ ⇒ *note slash:: − ‘[distr =] student(...)’ ⇒ *note student:: − ‘[distr =] triangular(...)’ ⇒ *note triangular:: − ‘[distr =] uniform(...)’ ⇒ *note uniform:: − ‘[distr =] weibull(...)’ ⇒ *note weibull:: List of generic distributions *note Handling Distribution Objects: Distribution_objects. − ‘[distr =] cemp’ ⇒ *note CEMP:: − ‘[distr =] cont’ ⇒ *note CONT:: − ‘[distr =] discr’ ⇒ *note DISCR:: _Notice_: Order statistics for continuous distributions (*note CORDER::) are supported by using the key ‘orderstatistics’ for distributions of type ‘CONT’. List of keys that are available via the String API. For description see the corresponding UNU.RAN set calls. • All distribution types ‘name = ""’ ⇒ *note ‘unur_distr_set_name’: funct:unur_distr_set_name. • ‘cemp’ (Distribution Type) (*note CEMP::) ‘data = () [, ]’ ⇒ *note ‘unur_distr_cemp_set_data’: funct:unur_distr_cemp_set_data. ‘hist_bins = () [, ]’ ⇒ *note ‘unur_distr_cemp_set_hist_bins’: funct:unur_distr_cemp_set_hist_bins. ‘hist_domain = , | ()’ ⇒ *note ‘unur_distr_cemp_set_hist_domain’: funct:unur_distr_cemp_set_hist_domain. ‘hist_prob = () [, ]’ ⇒ *note ‘unur_distr_cemp_set_hist_prob’: funct:unur_distr_cemp_set_hist_prob. • ‘cont’ (Distribution Type) (*note CONT::) ‘cdf = ""’ ⇒ *note ‘unur_distr_cont_set_cdfstr’: funct:unur_distr_cont_set_cdfstr. ‘center = ’ ⇒ *note ‘unur_distr_cont_set_center’: funct:unur_distr_cont_set_center. ‘domain = , | ()’ ⇒ *note ‘unur_distr_cont_set_domain’: funct:unur_distr_cont_set_domain. ‘hr = ""’ ⇒ *note ‘unur_distr_cont_set_hrstr’: funct:unur_distr_cont_set_hrstr. ‘logcdf = ""’ ⇒ *note ‘unur_distr_cont_set_logcdfstr’: funct:unur_distr_cont_set_logcdfstr. ‘logpdf = ""’ ⇒ *note ‘unur_distr_cont_set_logpdfstr’: funct:unur_distr_cont_set_logpdfstr. ‘mode = ’ ⇒ *note ‘unur_distr_cont_set_mode’: funct:unur_distr_cont_set_mode. ‘pdf = ""’ ⇒ *note ‘unur_distr_cont_set_pdfstr’: funct:unur_distr_cont_set_pdfstr. ‘pdfarea = ’ ⇒ *note ‘unur_distr_cont_set_pdfarea’: funct:unur_distr_cont_set_pdfarea. ‘pdfparams = () [, ]’ ⇒ *note ‘unur_distr_cont_set_pdfparams’: funct:unur_distr_cont_set_pdfparams. ‘orderstatistics = , | ()’ Make order statistics for given distribution. The first parameter gives the sample size, the second parameter its rank. (see *note ‘unur_distr_corder_new’: funct:unur_distr_corder_new.) • ‘discr’ (Distribution Type) (*note DISCR::) ‘cdf = ""’ ⇒ *note ‘unur_distr_discr_set_cdfstr’: funct:unur_distr_discr_set_cdfstr. ‘domain = , | ()’ ⇒ *note ‘unur_distr_discr_set_domain’: funct:unur_distr_discr_set_domain. ‘mode [= ]’ ⇒ *note ‘unur_distr_discr_set_mode’: funct:unur_distr_discr_set_mode. ‘pmf = ""’ ⇒ *note ‘unur_distr_discr_set_pmfstr’: funct:unur_distr_discr_set_pmfstr. ‘pmfparams = () [, ]’ ⇒ *note ‘unur_distr_discr_set_pmfparams’: funct:unur_distr_discr_set_pmfparams. ‘pmfsum = ’ ⇒ *note ‘unur_distr_discr_set_pmfsum’: funct:unur_distr_discr_set_pmfsum. ‘pv = () [, ]’ ⇒ *note ‘unur_distr_discr_set_pv’: funct:unur_distr_discr_set_pv.  File: unuran.info, Node: StringFunct, Next: StringMethod, Prev: StringDistr, Up: StringAPI 3.3 Function String =================== In unuran it is also possible to define functions (e.g. CDF or PDF) as strings. As you can see in Example 2 (*note Example_2_str::) it is very easy to define the PDF of a distribution object by means of a string. The possibilities using this string interface are more restricted than using a pointer to a routine coded in C (*note Example_2::). But the differences in evaluation time is small. When a distribution object is defined using this string interface then of course the same conditions on the given density or CDF must be satisfied for a chosen method as for the standard API. This string interface can be used for both within the UNU.RAN string API using the ‘unur_str2gen’ call, and for calls that define the density or CDF for a particular distribution object as done with (e.g.) the call ‘unur_distr_cont_set_pdfstr’. Here is an example for the latter case: unur_distr_cont_set_pdfstr(distr,"1-x*x"); Syntax ------ The syntax for the function string is case insensitive, white spaces are ingnored. The expressions are similar to most programming languages and mathematical programs (see also the examples below). It is especially influenced by C. The usual preceedence rules are used (from highest to lowest preceedence: functions, power, multiplication, addition, relation operators). Use parentheses in case of doubt or when these preceedences should be changed. Relation operators can be used as indicator functions, i.e. the term ‘(x>1)’ is evaluted as ‘1’ if this relation is satisfied, and as ‘0’ otherwise. The first unknown symbol (letter or word) is interpreted as the variable of the function. It is recommended to use ‘x’. Only one variable can be used. _Important_: The symbol ‘e’ is used twice, for Euler’s constant (= 2.7182...) and as exponent. The multiplication operator ‘*’ must not be omitted, i.e. ‘2 x’ is interpreted as the string ‘2x’ (which will result in a syntax error). List of symbols --------------- Numbers Numbers are composed using digits and, optionally, a sign, a decimal point, and an exponent indicated by ‘e’. Symbol Explanation Examples ‘0...9’ digits ‘2343’ ‘.’ decimal point ‘165.567’ ‘-’ negative sign ‘-465.223’ ‘e’ exponet ‘13.2e-4’ (=0.00132) Constants ‘pi’ pi = 3.1415... ‘3*pi+2’ ‘e’ Euler’s constant ‘3*e+2’ (= 10.15...; do not cofuse with ‘3e2’ = 300) ‘inf’ infinity (used for domains) Special symbols ‘(’ opening parenthesis ‘2*(3+x)’ ‘)’ closing parenthesis ‘2*(3+x)’ ‘,’ (argument) list separator ‘mod(13,2)’ Relation operators (Indicator functions) ‘<’ less than ‘(x<1)’ ‘=’ equal ‘(2=x)’ ‘==’ same as ‘=’ ‘(x==3)’ ‘>’ greater than ‘(x>0)’ ‘<=’ less than or equal ‘(x<=1)’ ‘!=’ not equal ‘(x!0)’ ‘<>’ same as ‘!=’ ‘(x<>pi)’ ‘>=’ greater or equal ‘(x>=1)’ Arithmetic operators ‘+’ addition ‘2+x’ ‘-’ subtraction ‘2-x’ ‘*’ multiplication ‘2*x’ ‘/’ division ‘x/2’ ‘^’ power ‘x^2’ Functions ‘mod’ ‘mod(m,n)’ remainder of mod(x,2) devision m over n ‘exp’ exponential function ‘exp(-x^2)’ (same as (same as ‘e^x’) ‘e^(-x^2)’) ‘log’ natural logarithm ‘log(x)’ ‘sin’ sine ‘sin(x)’ ‘cos’ cosine ‘cos(x)’ ‘tan’ tangent ‘tan(x)’ ‘sec’ secant ‘sec(x*2)’ ‘sqrt’ square root ‘sqrt(2*x)’ ‘abs’ absolute value ‘abs(x)’ ‘sgn’ sign function ‘sign(x)*3’ Variable ‘x’ variable ‘3*x^2’ Examples -------- 1.231+7.9876*x-1.234e-3*x^2+3.335e-5*x^3 sin(2*pi*x)+x^2 exp(-((x-3)/2.1)^2) It is also possible to define functions using different terms on separate domains. However, instead of constructs using ‘if ... then ... else ...’ indicator functions are available. For example to define the density of triangular distribution with domain (-1,1) and mode 0 use (x>-1)*(x<0)*(1+x) + (x>=0)*(x<1)*(1-x)  File: unuran.info, Node: StringMethod, Next: StringURNG, Prev: StringFunct, Up: StringAPI 3.4 Method String ================= * Menu: * KeysMethod:: Keys for Method String The key ‘method’ is obligatory, it must be the first key and its value is the name of a method suitable for the choosen standard distribution. E.g., if method AROU is chosen, use method = arou Of course the all following keys dependend on the method choosen at first. All corresponding ‘set’ calls of UNU.RAN are available and the key is the string after the ‘unur__set_’ part of the command. E.g., UNU.RAN provides the command ‘unur_arou_set_max_sqhratio’ to set a parameter of method AROU. To call this function via the string-interface, the key ‘max_sqhratio’ can be used: max_sqhratio = 0.9 Additionally the keyword ‘debug’ can be used to set debugging flags (see *note Debugging: Debug, for details). If this block is omitted, a suitable default method is used. Notice however that the default method may change in future versions of UNU.RAN.  File: unuran.info, Node: KeysMethod, Up: StringMethod 3.4.1 Keys for Method String ---------------------------- List of methods and keys that are available via the String API. For description see the corresponding UNU.RAN set calls. • ‘method = arou’ ⇒ ‘unur_arou_new’ (*note AROU::) ‘cpoints = [, ()] | ()’ ⇒ *note ‘unur_arou_set_cpoints’: funct:unur_arou_set_cpoints. ‘darsfactor = ’ ⇒ *note ‘unur_arou_set_darsfactor’: funct:unur_arou_set_darsfactor. ‘guidefactor = ’ ⇒ *note ‘unur_arou_set_guidefactor’: funct:unur_arou_set_guidefactor. ‘max_segments [= ]’ ⇒ *note ‘unur_arou_set_max_segments’: funct:unur_arou_set_max_segments. ‘max_sqhratio = ’ ⇒ *note ‘unur_arou_set_max_sqhratio’: funct:unur_arou_set_max_sqhratio. ‘pedantic [= ]’ ⇒ *note ‘unur_arou_set_pedantic’: funct:unur_arou_set_pedantic. ‘usecenter [= ]’ ⇒ *note ‘unur_arou_set_usecenter’: funct:unur_arou_set_usecenter. ‘usedars [= ]’ ⇒ *note ‘unur_arou_set_usedars’: funct:unur_arou_set_usedars. ‘verify [= ]’ ⇒ *note ‘unur_arou_set_verify’: funct:unur_arou_set_verify. • ‘method = ars’ ⇒ ‘unur_ars_new’ (*note ARS::) ‘cpoints = [, ()] | ()’ ⇒ *note ‘unur_ars_set_cpoints’: funct:unur_ars_set_cpoints. ‘max_intervals [= ]’ ⇒ *note ‘unur_ars_set_max_intervals’: funct:unur_ars_set_max_intervals. ‘max_iter [= ]’ ⇒ *note ‘unur_ars_set_max_iter’: funct:unur_ars_set_max_iter. ‘pedantic [= ]’ ⇒ *note ‘unur_ars_set_pedantic’: funct:unur_ars_set_pedantic. ‘reinit_ncpoints [= ]’ ⇒ *note ‘unur_ars_set_reinit_ncpoints’: funct:unur_ars_set_reinit_ncpoints. ‘reinit_percentiles = [, ()] | ()’ ⇒ *note ‘unur_ars_set_reinit_percentiles’: funct:unur_ars_set_reinit_percentiles. ‘verify [= ]’ ⇒ *note ‘unur_ars_set_verify’: funct:unur_ars_set_verify. • ‘method = auto’ ⇒ ‘unur_auto_new’ (*note AUTO::) ‘logss [= ]’ ⇒ *note ‘unur_auto_set_logss’: funct:unur_auto_set_logss. • ‘method = cstd’ ⇒ ‘unur_cstd_new’ (*note CSTD::) ‘variant = ’ ⇒ *note ‘unur_cstd_set_variant’: funct:unur_cstd_set_variant. • ‘method = dari’ ⇒ ‘unur_dari_new’ (*note DARI::) ‘cpfactor = ’ ⇒ *note ‘unur_dari_set_cpfactor’: funct:unur_dari_set_cpfactor. ‘squeeze [= ]’ ⇒ *note ‘unur_dari_set_squeeze’: funct:unur_dari_set_squeeze. ‘tablesize [= ]’ ⇒ *note ‘unur_dari_set_tablesize’: funct:unur_dari_set_tablesize. ‘verify [= ]’ ⇒ *note ‘unur_dari_set_verify’: funct:unur_dari_set_verify. • ‘method = dau’ ⇒ ‘unur_dau_new’ (*note DAU::) ‘urnfactor = ’ ⇒ *note ‘unur_dau_set_urnfactor’: funct:unur_dau_set_urnfactor. • ‘method = dgt’ ⇒ ‘unur_dgt_new’ (*note DGT::) ‘guidefactor = ’ ⇒ *note ‘unur_dgt_set_guidefactor’: funct:unur_dgt_set_guidefactor. ‘variant = ’ ⇒ *note ‘unur_dgt_set_variant’: funct:unur_dgt_set_variant. • ‘method = dsrou’ ⇒ ‘unur_dsrou_new’ (*note DSROU::) ‘cdfatmode = ’ ⇒ *note ‘unur_dsrou_set_cdfatmode’: funct:unur_dsrou_set_cdfatmode. ‘verify [= ]’ ⇒ *note ‘unur_dsrou_set_verify’: funct:unur_dsrou_set_verify. • ‘method = dstd’ ⇒ ‘unur_dstd_new’ (*note DSTD::) ‘variant = ’ ⇒ *note ‘unur_dstd_set_variant’: funct:unur_dstd_set_variant. • ‘method = empk’ ⇒ ‘unur_empk_new’ (*note EMPK::) ‘beta = ’ ⇒ *note ‘unur_empk_set_beta’: funct:unur_empk_set_beta. ‘kernel = ’ ⇒ *note ‘unur_empk_set_kernel’: funct:unur_empk_set_kernel. ‘positive [= ]’ ⇒ *note ‘unur_empk_set_positive’: funct:unur_empk_set_positive. ‘smoothing = ’ ⇒ *note ‘unur_empk_set_smoothing’: funct:unur_empk_set_smoothing. ‘varcor [= ]’ ⇒ *note ‘unur_empk_set_varcor’: funct:unur_empk_set_varcor. • ‘method = gibbs’ ⇒ ‘unur_gibbs_new’ (*note GIBBS::) ‘burnin [= ]’ ⇒ *note ‘unur_gibbs_set_burnin’: funct:unur_gibbs_set_burnin. ‘c = ’ ⇒ *note ‘unur_gibbs_set_c’: funct:unur_gibbs_set_c. ‘thinning [= ]’ ⇒ *note ‘unur_gibbs_set_thinning’: funct:unur_gibbs_set_thinning. ‘variant_coordinate’ ⇒ *note ‘unur_gibbs_set_variant_coordinate’: funct:unur_gibbs_set_variant_coordinate. ‘variant_random_direction’ ⇒ *note ‘unur_gibbs_set_variant_random_direction’: funct:unur_gibbs_set_variant_random_direction. • ‘method = hinv’ ⇒ ‘unur_hinv_new’ (*note HINV::) ‘boundary = , | ()’ ⇒ *note ‘unur_hinv_set_boundary’: funct:unur_hinv_set_boundary. ‘cpoints = (), ’ ⇒ *note ‘unur_hinv_set_cpoints’: funct:unur_hinv_set_cpoints. ‘guidefactor = ’ ⇒ *note ‘unur_hinv_set_guidefactor’: funct:unur_hinv_set_guidefactor. ‘max_intervals [= ]’ ⇒ *note ‘unur_hinv_set_max_intervals’: funct:unur_hinv_set_max_intervals. ‘order [= ]’ ⇒ *note ‘unur_hinv_set_order’: funct:unur_hinv_set_order. ‘u_resolution = ’ ⇒ *note ‘unur_hinv_set_u_resolution’: funct:unur_hinv_set_u_resolution. • ‘method = hitro’ ⇒ ‘unur_hitro_new’ (*note HITRO::) ‘adaptive_multiplier = ’ ⇒ *note ‘unur_hitro_set_adaptive_multiplier’: funct:unur_hitro_set_adaptive_multiplier. ‘burnin [= ]’ ⇒ *note ‘unur_hitro_set_burnin’: funct:unur_hitro_set_burnin. ‘r = ’ ⇒ *note ‘unur_hitro_set_r’: funct:unur_hitro_set_r. ‘thinning [= ]’ ⇒ *note ‘unur_hitro_set_thinning’: funct:unur_hitro_set_thinning. ‘use_adaptiveline [= ]’ ⇒ *note ‘unur_hitro_set_use_adaptiveline’: funct:unur_hitro_set_use_adaptiveline. ‘use_adaptiverectangle [= ]’ ⇒ *note ‘unur_hitro_set_use_adaptiverectangle’: funct:unur_hitro_set_use_adaptiverectangle. ‘use_boundingrectangle [= ]’ ⇒ *note ‘unur_hitro_set_use_boundingrectangle’: funct:unur_hitro_set_use_boundingrectangle. ‘v = ’ ⇒ *note ‘unur_hitro_set_v’: funct:unur_hitro_set_v. ‘variant_coordinate’ ⇒ *note ‘unur_hitro_set_variant_coordinate’: funct:unur_hitro_set_variant_coordinate. ‘variant_random_direction’ ⇒ *note ‘unur_hitro_set_variant_random_direction’: funct:unur_hitro_set_variant_random_direction. • ‘method = hrb’ ⇒ ‘unur_hrb_new’ (*note HRB::) ‘upperbound = ’ ⇒ *note ‘unur_hrb_set_upperbound’: funct:unur_hrb_set_upperbound. ‘verify [= ]’ ⇒ *note ‘unur_hrb_set_verify’: funct:unur_hrb_set_verify. • ‘method = hrd’ ⇒ ‘unur_hrd_new’ (*note HRD::) ‘verify [= ]’ ⇒ *note ‘unur_hrd_set_verify’: funct:unur_hrd_set_verify. • ‘method = hri’ ⇒ ‘unur_hri_new’ (*note HRI::) ‘p0 = ’ ⇒ *note ‘unur_hri_set_p0’: funct:unur_hri_set_p0. ‘verify [= ]’ ⇒ *note ‘unur_hri_set_verify’: funct:unur_hri_set_verify. • ‘method = itdr’ ⇒ ‘unur_itdr_new’ (*note ITDR::) ‘cp = ’ ⇒ *note ‘unur_itdr_set_cp’: funct:unur_itdr_set_cp. ‘ct = ’ ⇒ *note ‘unur_itdr_set_ct’: funct:unur_itdr_set_ct. ‘verify [= ]’ ⇒ *note ‘unur_itdr_set_verify’: funct:unur_itdr_set_verify. ‘xi = ’ ⇒ *note ‘unur_itdr_set_xi’: funct:unur_itdr_set_xi. • ‘method = mvtdr’ ⇒ ‘unur_mvtdr_new’ (*note MVTDR::) ‘boundsplitting = ’ ⇒ *note ‘unur_mvtdr_set_boundsplitting’: funct:unur_mvtdr_set_boundsplitting. ‘maxcones [= ]’ ⇒ *note ‘unur_mvtdr_set_maxcones’: funct:unur_mvtdr_set_maxcones. ‘stepsmin [= ]’ ⇒ *note ‘unur_mvtdr_set_stepsmin’: funct:unur_mvtdr_set_stepsmin. ‘verify [= ]’ ⇒ *note ‘unur_mvtdr_set_verify’: funct:unur_mvtdr_set_verify. • ‘method = ninv’ ⇒ ‘unur_ninv_new’ (*note NINV::) ‘max_iter [= ]’ ⇒ *note ‘unur_ninv_set_max_iter’: funct:unur_ninv_set_max_iter. ‘start = , | ()’ ⇒ *note ‘unur_ninv_set_start’: funct:unur_ninv_set_start. ‘table [= ]’ ⇒ *note ‘unur_ninv_set_table’: funct:unur_ninv_set_table. ‘u_resolution = ’ ⇒ *note ‘unur_ninv_set_u_resolution’: funct:unur_ninv_set_u_resolution. ‘usebisect’ ⇒ *note ‘unur_ninv_set_usebisect’: funct:unur_ninv_set_usebisect. ‘usenewton’ ⇒ *note ‘unur_ninv_set_usenewton’: funct:unur_ninv_set_usenewton. ‘useregula’ ⇒ *note ‘unur_ninv_set_useregula’: funct:unur_ninv_set_useregula. ‘x_resolution = ’ ⇒ *note ‘unur_ninv_set_x_resolution’: funct:unur_ninv_set_x_resolution. • ‘method = nrou’ ⇒ ‘unur_nrou_new’ (*note NROU::) ‘center = ’ ⇒ *note ‘unur_nrou_set_center’: funct:unur_nrou_set_center. ‘r = ’ ⇒ *note ‘unur_nrou_set_r’: funct:unur_nrou_set_r. ‘u = , | ()’ ⇒ *note ‘unur_nrou_set_u’: funct:unur_nrou_set_u. ‘v = ’ ⇒ *note ‘unur_nrou_set_v’: funct:unur_nrou_set_v. ‘verify [= ]’ ⇒ *note ‘unur_nrou_set_verify’: funct:unur_nrou_set_verify. • ‘method = pinv’ ⇒ ‘unur_pinv_new’ (*note PINV::) ‘boundary = , | ()’ ⇒ *note ‘unur_pinv_set_boundary’: funct:unur_pinv_set_boundary. ‘extra_testpoints [= ]’ ⇒ *note ‘unur_pinv_set_extra_testpoints’: funct:unur_pinv_set_extra_testpoints. ‘keepcdf [= ]’ ⇒ *note ‘unur_pinv_set_keepcdf’: funct:unur_pinv_set_keepcdf. ‘max_intervals [= ]’ ⇒ *note ‘unur_pinv_set_max_intervals’: funct:unur_pinv_set_max_intervals. ‘order [= ]’ ⇒ *note ‘unur_pinv_set_order’: funct:unur_pinv_set_order. ‘searchboundary = , | ()’ ⇒ *note ‘unur_pinv_set_searchboundary’: funct:unur_pinv_set_searchboundary. ‘smoothness [= ]’ ⇒ *note ‘unur_pinv_set_smoothness’: funct:unur_pinv_set_smoothness. ‘u_resolution = ’ ⇒ *note ‘unur_pinv_set_u_resolution’: funct:unur_pinv_set_u_resolution. ‘use_upoints [= ]’ ⇒ *note ‘unur_pinv_set_use_upoints’: funct:unur_pinv_set_use_upoints. ‘usecdf’ ⇒ *note ‘unur_pinv_set_usecdf’: funct:unur_pinv_set_usecdf. ‘usepdf’ ⇒ *note ‘unur_pinv_set_usepdf’: funct:unur_pinv_set_usepdf. • ‘method = srou’ ⇒ ‘unur_srou_new’ (*note SROU::) ‘cdfatmode = ’ ⇒ *note ‘unur_srou_set_cdfatmode’: funct:unur_srou_set_cdfatmode. ‘pdfatmode = ’ ⇒ *note ‘unur_srou_set_pdfatmode’: funct:unur_srou_set_pdfatmode. ‘r = ’ ⇒ *note ‘unur_srou_set_r’: funct:unur_srou_set_r. ‘usemirror [= ]’ ⇒ *note ‘unur_srou_set_usemirror’: funct:unur_srou_set_usemirror. ‘usesqueeze [= ]’ ⇒ *note ‘unur_srou_set_usesqueeze’: funct:unur_srou_set_usesqueeze. ‘verify [= ]’ ⇒ *note ‘unur_srou_set_verify’: funct:unur_srou_set_verify. • ‘method = ssr’ ⇒ ‘unur_ssr_new’ (*note SSR::) ‘cdfatmode = ’ ⇒ *note ‘unur_ssr_set_cdfatmode’: funct:unur_ssr_set_cdfatmode. ‘pdfatmode = ’ ⇒ *note ‘unur_ssr_set_pdfatmode’: funct:unur_ssr_set_pdfatmode. ‘usesqueeze [= ]’ ⇒ *note ‘unur_ssr_set_usesqueeze’: funct:unur_ssr_set_usesqueeze. ‘verify [= ]’ ⇒ *note ‘unur_ssr_set_verify’: funct:unur_ssr_set_verify. • ‘method = tabl’ ⇒ ‘unur_tabl_new’ (*note TABL::) ‘areafraction = ’ ⇒ *note ‘unur_tabl_set_areafraction’: funct:unur_tabl_set_areafraction. ‘boundary = , | ()’ ⇒ *note ‘unur_tabl_set_boundary’: funct:unur_tabl_set_boundary. ‘cpoints = [, ()] | ()’ ⇒ *note ‘unur_tabl_set_cpoints’: funct:unur_tabl_set_cpoints. ‘darsfactor = ’ ⇒ *note ‘unur_tabl_set_darsfactor’: funct:unur_tabl_set_darsfactor. ‘guidefactor = ’ ⇒ *note ‘unur_tabl_set_guidefactor’: funct:unur_tabl_set_guidefactor. ‘max_intervals [= ]’ ⇒ *note ‘unur_tabl_set_max_intervals’: funct:unur_tabl_set_max_intervals. ‘max_sqhratio = ’ ⇒ *note ‘unur_tabl_set_max_sqhratio’: funct:unur_tabl_set_max_sqhratio. ‘nstp [= ]’ ⇒ *note ‘unur_tabl_set_nstp’: funct:unur_tabl_set_nstp. ‘pedantic [= ]’ ⇒ *note ‘unur_tabl_set_pedantic’: funct:unur_tabl_set_pedantic. ‘slopes = (), ’ ⇒ *note ‘unur_tabl_set_slopes’: funct:unur_tabl_set_slopes. ‘usedars [= ]’ ⇒ *note ‘unur_tabl_set_usedars’: funct:unur_tabl_set_usedars. ‘useear [= ]’ ⇒ *note ‘unur_tabl_set_useear’: funct:unur_tabl_set_useear. ‘variant_ia [= ]’ ⇒ *note ‘unur_tabl_set_variant_ia’: funct:unur_tabl_set_variant_ia. ‘variant_splitmode = ’ ⇒ *note ‘unur_tabl_set_variant_splitmode’: funct:unur_tabl_set_variant_splitmode. ‘verify [= ]’ ⇒ *note ‘unur_tabl_set_verify’: funct:unur_tabl_set_verify. • ‘method = tdr’ ⇒ ‘unur_tdr_new’ (*note TDR::) ‘c = ’ ⇒ *note ‘unur_tdr_set_c’: funct:unur_tdr_set_c. ‘cpoints = [, ()] | ()’ ⇒ *note ‘unur_tdr_set_cpoints’: funct:unur_tdr_set_cpoints. ‘darsfactor = ’ ⇒ *note ‘unur_tdr_set_darsfactor’: funct:unur_tdr_set_darsfactor. ‘guidefactor = ’ ⇒ *note ‘unur_tdr_set_guidefactor’: funct:unur_tdr_set_guidefactor. ‘max_intervals [= ]’ ⇒ *note ‘unur_tdr_set_max_intervals’: funct:unur_tdr_set_max_intervals. ‘max_sqhratio = ’ ⇒ *note ‘unur_tdr_set_max_sqhratio’: funct:unur_tdr_set_max_sqhratio. ‘pedantic [= ]’ ⇒ *note ‘unur_tdr_set_pedantic’: funct:unur_tdr_set_pedantic. ‘reinit_ncpoints [= ]’ ⇒ *note ‘unur_tdr_set_reinit_ncpoints’: funct:unur_tdr_set_reinit_ncpoints. ‘reinit_percentiles = [, ()] | ()’ ⇒ *note ‘unur_tdr_set_reinit_percentiles’: funct:unur_tdr_set_reinit_percentiles. ‘usecenter [= ]’ ⇒ *note ‘unur_tdr_set_usecenter’: funct:unur_tdr_set_usecenter. ‘usedars [= ]’ ⇒ *note ‘unur_tdr_set_usedars’: funct:unur_tdr_set_usedars. ‘usemode [= ]’ ⇒ *note ‘unur_tdr_set_usemode’: funct:unur_tdr_set_usemode. ‘variant_gw’ ⇒ *note ‘unur_tdr_set_variant_gw’: funct:unur_tdr_set_variant_gw. ‘variant_ia’ ⇒ *note ‘unur_tdr_set_variant_ia’: funct:unur_tdr_set_variant_ia. ‘variant_ps’ ⇒ *note ‘unur_tdr_set_variant_ps’: funct:unur_tdr_set_variant_ps. ‘verify [= ]’ ⇒ *note ‘unur_tdr_set_verify’: funct:unur_tdr_set_verify. • ‘method = utdr’ ⇒ ‘unur_utdr_new’ (*note UTDR::) ‘cpfactor = ’ ⇒ *note ‘unur_utdr_set_cpfactor’: funct:unur_utdr_set_cpfactor. ‘deltafactor = ’ ⇒ *note ‘unur_utdr_set_deltafactor’: funct:unur_utdr_set_deltafactor. ‘pdfatmode = ’ ⇒ *note ‘unur_utdr_set_pdfatmode’: funct:unur_utdr_set_pdfatmode. ‘verify [= ]’ ⇒ *note ‘unur_utdr_set_verify’: funct:unur_utdr_set_verify. • ‘method = vempk’ ⇒ ‘unur_vempk_new’ (*note VEMPK::) ‘smoothing = ’ ⇒ *note ‘unur_vempk_set_smoothing’: funct:unur_vempk_set_smoothing. ‘varcor [= ]’ ⇒ *note ‘unur_vempk_set_varcor’: funct:unur_vempk_set_varcor. • ‘method = vnrou’ ⇒ ‘unur_vnrou_new’ (*note VNROU::) ‘r = ’ ⇒ *note ‘unur_vnrou_set_r’: funct:unur_vnrou_set_r. ‘v = ’ ⇒ *note ‘unur_vnrou_set_v’: funct:unur_vnrou_set_v. ‘verify [= ]’ ⇒ *note ‘unur_vnrou_set_verify’: funct:unur_vnrou_set_verify.  File: unuran.info, Node: StringURNG, Prev: StringMethod, Up: StringAPI 3.5 Uniform RNG String ====================== The value of the ‘urng’ key is passed to the PRNG interface (see *Note Overview: (prng)Top. for details). However it only works when using the PRNG library is enabled, see *note Installation:: for details. There are no other keys. IMPORTANT: UNU.RAN creates a new uniform random number generator for the generator object. The pointer to this uniform generator has to be read and saved via a ‘unur_get_urng’ call in order to clear the memory _before_ the UNU.RAN generator object is destroyed. If this block is omitted the UNU.RAN default generator is used (which _must not_ be destroyed).  File: unuran.info, Node: Distribution_objects, Next: Methods, Prev: StringAPI, Up: Top 4 Handling distribution objects ******************************* * Menu: * AllDistr:: Functions for all kinds of distribution objects * CONT:: Continuous univariate distributions * CORDER:: Continuous univariate order statistics * CEMP:: Continuous empirical univariate distributions * CVEC:: Continuous multivariate distributions * CONDI:: Continuous univariate full conditional distribution * CVEMP:: Continuous empirical multivariate distributions * MATR:: MATRix distributions * DISCR:: Discrete univariate distributions Objects of type ‘UNUR_DISTR’ are used for handling distributions. All data about a distribution are stored in this object. UNU.RAN provides functions that return instances of such objects for standard distributions (*note Standard distributions: Stddist.). It is then possible to change these distribution objects by various set calls. Moreover, it is possible to build a distribution object entirely from scratch. For this purpose there exists ‘unur_distr__new’ calls that return an empty object of this type for each object type (eg. univariate contiuous) which can be filled with the appropriate set calls. UNU.RAN distinguishes between several types of distributions, each of which has its own sets of possible parameters (for details see the corresponding sections): − continuous univariate distributions − continuous univariate order statistics − continuous empirical univariate distributions − continuous multivariate distributions − continuous empirical multivariate distributions − matrix distributions − discrete univariate distributions Notice that there are essential data about a distribution, eg. the PDF, a list of (shape, scale, location) parameters for the distribution, and the domain of (the possibly truncated) distribution. And there exist parameters that are/can be derived from these, eg. the mode of the distribution or the area below the given PDF (which need not be normalized for many methods). UNU.RAN keeps track of parameters which are known. Thus if one of the essential parameters is changed all derived parameters are marked as unknown and must be set again if these are required for the chosen generation method. Additionally to set calls there are calls for updating derived parameters for objects provided by the UNU.RAN library of standard distributions (one for each parameter to avoid computational overhead since not all parameters are required for all generator methods). All parameters of distribution objects can be read by corresponding get calls. Every generator object has its own copy of a distribution object which is accessible by a ‘unur_get_distr’ call. Thus the parameter for this distribution can be read. However, *never* extract the distribution object out of a generator object and run one of the set calls on it to modify the distribution. (How should the poor generator object know what has happend?) Instead there exist calls for each of the generator methods that change particular parameters of the internal copy of the distribution object. How To Use .......... UNU.RAN collects all data required for a particular generation method in a _distribution object_. There are two ways to get an instance of a distributions object: 1. Build a distribtion from scratch, by means of the corresponding ‘unur_distr__new’ call, where ‘’ is the type of the distribution as listed in the below subsections. 2. Use the corresponding ‘unur_distr__new’ call to get prebuild distribution from the UNU.RAN library of standard distributions. Here ‘’ is the name of the standard distribution in *note Standard distributions: Stddist. In either cases the corresponding ‘unur_distr__set_’ calls to set the necessary parameters ‘’ (case 1), or change the values of the standard distribution in case 2 (if this makes sense for you). In the latter case ‘’ is the type to which the standard distribution belongs to. These ‘set’ calls return ‘UNUR_SUCCESS’ when the correspondig parameter has been set successfully. Otherwise an error code is returned. The parameters of a distribution are divided into _essential_ and _derived_ parameters. Notice, that there are some restrictions in setting parameters to avoid possible confusions. Changing essential parameters marks derived parameters as ‘unknown’. Some of the parameters cannot be changed any more when already set; some parameters block each others. In such a case a new instance of a distribution object has to be build. Additionally ‘unur_distr__upd_’ calls can be used for updating derived parameters for objects provided by the UNU.RAN library of standard distributions. All parameters of a distribution object get be read by means of ‘unur_distr__get_’ calls. Every distribution object be identified by its ‘name’ which is a string of arbitrary characters provided by the user. For standard distribution it is automatically set to ‘’ in the corresponding ‘new’ call. It can be changed to any other string.  File: unuran.info, Node: AllDistr, Next: CONT, Up: Distribution_objects 4.1 Functions for all kinds of distribution objects =================================================== The calls in this section can be applied to all distribution objects. − Destroy ‘free’ an instance of a generator object. − Ask for the ‘type’ of a generator object. − Ask for the ‘dimension’ of a generator object. − Deal with the ‘name’ (identifier string) of a generator object. Function reference ------------------ -- Function: void unur_distr_free (UNUR_DISTR* DISTRIBUTION) Destroy the DISTRIBUTION object. -- Function: int unur_distr_set_name (UNUR_DISTR* DISTRIBUTION, const CHAR* NAME) -- Function: const char* unur_distr_get_name (const UNUR_DISTR* DISTRIBUTION) Set and get NAME of DISTRIBUTION. The NAME can be an arbitrary character string. It can be used to identify generator objects for the user. It is used by UNU.RAN when printing information of the distribution object into a log files. -- Function: int unur_distr_get_dim (const UNUR_DISTR* DISTRIBUTION) Get number of components of a random vector (its dimension) the DISTRIBUTION. For univariate distributions it returns dimension ‘1’. For matrix distributions it returns the number of components (i.e., number of rows times number of columns). When the respective numbers of rows and columns are needed use ‘unur_distr_matr_get_dim’ instead. -- Function: unsigned int unur_distr_get_type (const UNUR_DISTR* DISTRIBUTION) Get type of DISTRIBUTION. Possible types are ‘UNUR_DISTR_CONT’ univariate continuous distribution ‘UNUR_DISTR_CEMP’ empirical continuous univariate distribution (i.e. a sample) ‘UNUR_DISTR_CVEC’ continuous mulitvariate distribution ‘UNUR_DISTR_CVEMP’ empirical continuous multivariate distribution (i.e. a vector sample) ‘UNUR_DISTR_DISCR’ discrete univariate distribution ‘UNUR_DISTR_MATR’ matrix distribution Alternatively the ‘unur_distr_is_’ calls can be used. -- Function: int unur_distr_is_cont (const UNUR_DISTR* DISTRIBUTION) ‘TRUE’ if DISTRIBUTION is a continuous univariate distribution. -- Function: int unur_distr_is_cvec (const UNUR_DISTR* DISTRIBUTION) ‘TRUE’ if DISTRIBUTION is a continuous multivariate distribution. -- Function: int unur_distr_is_cemp (const UNUR_DISTR* DISTRIBUTION) ‘TRUE’ if DISTRIBUTION is an empirical continuous univariate distribution, i.e. a sample. -- Function: int unur_distr_is_cvemp (const UNUR_DISTR* DISTRIBUTION) ‘TRUE’ if DISTRIBUTION is an empirical continuous multivariate distribution. -- Function: int unur_distr_is_discr (const UNUR_DISTR* DISTRIBUTION) ‘TRUE’ if DISTRIBUTION is a discrete univariate distribution. -- Function: int unur_distr_is_matr (const UNUR_DISTR* DISTRIBUTION) ‘TRUE’ if DISTRIBUTION is a matrix distribution. -- Function: int unur_distr_set_extobj (UNUR_DISTR* DISTRIBUTION, const VOID* EXTOBJ) Store a pointer to an external object. This might be usefull if the PDF, PMF, CDF or other functions used to implement a particular distribution a parameter set that cannot be stored as doubles (e.g. pointers to some structure that holds information of the distribution). *Important:* When UNU.RAN copies this distribution object into the generator object, then the address EXTOBJ that this pointer contains is simply copied. Thus the generator holds an address of a non-private object! Once the generator object has been created any change in the external object might effect the generator object. *Warning:* External objects must be used with care. Once the generator object has been created or the distribution object has been copied you _must not_ destroy this external object. -- Function: const void* unur_distr_get_extobj (const UNUR_DISTR* DISTRIBUTION) Get the pointer to the external object. _Important:_ Changing this object must be done with with extreme care.  File: unuran.info, Node: CONT, Next: CORDER, Prev: AllDistr, Up: Distribution_objects 4.2 Continuous univariate distributions ======================================= The calls in this section can be applied to continuous univariate distributions. − Create a ‘new’ instance of a continuous univariate distribution. − Handle and evaluate distribution function (CDF, ‘cdf’), probability density function (PDF, ‘pdf’) and the derivative of the density function (‘dpdf’). The following is important: . ‘pdf’ need not be normalized, i.e., any integrable nonnegative function can be used. . ‘dpdf’ must the derivate of the function provided as ‘pdf’. . ‘cdf’ must be a distribution function, i.e. it must be monotonically increasing with range [0,1]. . If ‘cdf’ and ‘pdf’ are used together for a pariticular generation method, then ‘pdf’ must be the derivate of the ‘cdf’, i.e., it must be normalized. − Handle and evaluate the logarithm of the probability density function (logPDF, ‘logpdf’) and the derivative of the logarithm of the density function (‘dlogpdf’). Some methods use the logarithm of the density if available. − Set (and change) parameters (‘pdfparams’) and the area below the graph (‘pdfarea’) of the given density. − Set the ‘mode’ (or pole) of the distribution. − Set the ‘center’ of the distribution. It is used by some generation methods to adjust the parameters of the generation algorithms to gain better performance. It can be seens as the location of the “central part†of the distribution. − Some generation methods require the hazard rate (‘hr’) of the distribution instead of its ‘pdf’. − Alternatively, ‘cdf’, ‘pdf’, ‘dpdf’, and ‘hr’ can be provided as ‘str’ings instead of function pointers. − Set the ‘domain’ of the distribution. Notice that the library also can handle truncated distributions, i.e., distributions that are derived from (standard) distributions by simply restricting its domain to a subset. However, there is a subtle difference between changing the domain of a distribution object by a ‘unur_distr_cont_set_domain’ call and changing the (truncated) domain for an existing generator object. The domain of the distribution object is used to create the generator object with hats, squeezes, tables, etc. Whereas truncating the domain of an existing generator object need not necessarily require a recomputation of these data. Thus by a ‘unur__chg_truncated’ call (if available) the sampling region is restricted to the subset of the domain of the given distribution object. However, generation methods that require a recreation of the generator object when the domain is changed have a ‘unur__chg_domain’ call instead. For these calls there are of course no restrictions on the given domain (i.e., it is possible to increase the domain of the distribution) (*note Methods::, for details). Function reference ------------------ -- Function: UNUR_DISTR* unur_distr_cont_new (void) Create a new (empty) object for univariate continuous distribution. Essential parameters .................... -- Function: int unur_distr_cont_set_pdf (UNUR_DISTR* DISTRIBUTION, UNUR_FUNCT_CONT* PDF) -- Function: int unur_distr_cont_set_dpdf (UNUR_DISTR* DISTRIBUTION, UNUR_FUNCT_CONT* DPDF) -- Function: int unur_distr_cont_set_cdf (UNUR_DISTR* DISTRIBUTION, UNUR_FUNCT_CONT* CDF) -- Function: int unur_distr_cont_set_invcdf (UNUR_DISTR* DISTRIBUTION, UNUR_FUNCT_CONT* INVCDF) Set respective pointer to the probability density function (PDF), the derivative of the probability density function (dPDF), the cumulative distribution function (CDF), and the inverse CDF of the DISTRIBUTION. Each of these function pointers must be of type ‘double funct(double x, const UNUR_DISTR *distr)’. Due to the fact that some of the methods do not require a normalized PDF the following is important: − The given CDF must be the cumulative distribution function of the (non-truncated) distribution. If a distribution from the UNU.RAN library of standard distributions (*note Standard distributions: Stddist.) is truncated, there is no need to change the CDF. − If both the CDF and the PDF are used (for a method or for order statistics), the PDF must be the derivative of the CDF. If a truncated distribution for one of the standard distributions from the UNU.RAN library of standard distributions is used, there is no need to change the PDF. − If the area below the PDF is required for a given distribution it must be given by the ‘unur_distr_cont_set_pdfarea’ call. For a truncated distribution this must be of course the integral of the PDF in the given truncated domain. For distributions from the UNU.RAN library of standard distributions this is done automatically by the ‘unur_distr_cont_upd_pdfarea’ call. It is important to note that all these functions must return a result for all values of X. Eg., if the domain of a given PDF is the interval [-1,1], then the given function must return ‘0.0’ for all points outside this interval. In case of an overflow the PDF should return ‘UNUR_INFINITY’. It is not possible to change such a function. Once the PDF or CDF is set it cannot be overwritten. This also holds when the logPDF is given or when the PDF is given by the ‘unur_distr_cont_set_pdfstr’ or ‘unur_distr_cont_set_logpdfstr’ call. A new distribution object has to be used instead. -- Function: UNUR_FUNCT_CONT* unur_distr_cont_get_pdf (const UNUR_DISTR* DISTRIBUTION) -- Function: UNUR_FUNCT_CONT* unur_distr_cont_get_dpdf (const UNUR_DISTR* DISTRIBUTION) -- Function: UNUR_FUNCT_CONT* unur_distr_cont_get_cdf (const UNUR_DISTR* DISTRIBUTION) -- Function: UNUR_FUNCT_CONT* unur_distr_cont_get_invcdf (const UNUR_DISTR* DISTRIBUTION) Get the respective pointer to the PDF, the derivative of the PDF, the CDF, and the inverse CDF of the DISTRIBUTION. The pointer is of type ‘double funct(double x, const UNUR_DISTR *distr)’. If the corresponding function is not available for the distribution, the ‘NULL’ pointer is returned. -- Function: double unur_distr_cont_eval_pdf (double X, const UNUR_DISTR* DISTRIBUTION) -- Function: double unur_distr_cont_eval_dpdf (double X, const UNUR_DISTR* DISTRIBUTION) -- Function: double unur_distr_cont_eval_cdf (double X, const UNUR_DISTR* DISTRIBUTION) -- Function: double unur_distr_cont_eval_invcdf (double U, const UNUR_DISTR* DISTRIBUTION) Evaluate the PDF, derivative of the PDF, the CDF, and the inverse CDF at X and U,respectively. Notice that DISTRIBUTION must not be the ‘NULL’ pointer. If the corresponding function is not available for the distribution, ‘UNUR_INFINITY’ is returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’. _IMPORTANT:_ In the case of a truncated standard distribution these calls always return the respective values of the _untruncated_ distribution! -- Function: int unur_distr_cont_set_logpdf (UNUR_DISTR* DISTRIBUTION, UNUR_FUNCT_CONT* LOGPDF) -- Function: int unur_distr_cont_set_dlogpdf (UNUR_DISTR* DISTRIBUTION, UNUR_FUNCT_CONT* DLOGPDF) -- Function: int unur_distr_cont_set_logcdf (UNUR_DISTR* DISTRIBUTION, UNUR_FUNCT_CONT* LOGCDF) -- Function: UNUR_FUNCT_CONT* unur_distr_cont_get_logpdf (const UNUR_DISTR* DISTRIBUTION) -- Function: UNUR_FUNCT_CONT* unur_distr_cont_get_dlogpdf (const UNUR_DISTR* DISTRIBUTION) -- Function: UNUR_FUNCT_CONT* unur_distr_cont_get_logcdf (const UNUR_DISTR* DISTRIBUTION) -- Function: double unur_distr_cont_eval_logpdf (double X, const UNUR_DISTR* DISTRIBUTION) -- Function: double unur_distr_cont_eval_dlogpdf (double X, const UNUR_DISTR* DISTRIBUTION) -- Function: double unur_distr_cont_eval_logcdf (double X, const UNUR_DISTR* DISTRIBUTION) Analogous calls for the logarithm of the density distribution functions. -- Function: int unur_distr_cont_set_pdfstr (UNUR_DISTR* DISTRIBUTION, const CHAR* PDFSTR) This function provides an alternative way to set a PDF and its derivative of the DISTRIBUTION. PDFSTR is a character string that contains the formula for the PDF, see *note Function String: StringFunct, for details. The derivative of the given PDF is computed automatically. See also the remarks for the ‘unur_distr_cont_set_pdf’ call. It is not possible to call this funtion twice or to call this function after a ‘unur_distr_cont_set_pdf’ call. -- Function: int unur_distr_cont_set_cdfstr (UNUR_DISTR* DISTRIBUTION, const CHAR* CDFSTR) This function provides an alternative way to set a CDF; analogously to the ‘unur_distr_cont_set_pdfstr’ call. The PDF and its derivative of the given CDF are computed automatically. -- Function: char* unur_distr_cont_get_pdfstr (const UNUR_DISTR* DISTRIBUTION) -- Function: char* unur_distr_cont_get_dpdfstr (const UNUR_DISTR* DISTRIBUTION) -- Function: char* unur_distr_cont_get_cdfstr (const UNUR_DISTR* DISTRIBUTION) Get pointer to respective string for PDF, derivate of PDF, and CDF of DISTRIBUTION that is given as string (instead of a function pointer). This call allocates memory to produce this string. It should be freed when it is not used any more. -- Function: int unur_distr_cont_set_pdfparams (UNUR_DISTR* DISTRIBUTION, const DOUBLE* PARAMS, int N_PARAMS) Sets array of parameters for DISTRIBUTION. There is an upper limit for the number of parameters ‘n_params’. It is given by the macro ‘UNUR_DISTR_MAXPARAMS’ in ‘unuran_config.h’. (It is set to 5 by default but can be changed to any appropriate nonnegative number.) If N_PARAMS is negative or exceeds this limit no parameters are copied into the distribution object and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_NPARAMS’. For standard distributions from the UNU.RAN library the parameters are checked. Moreover, the domain is updated automatically unless it has been changed before by a ‘unur_distr_cont_set_domain’ call. If the given parameters are invalid for the standard distribution, then no parameters are set and an error code is returned. Notice, that the given parameter list for such a distribution is handled in the same way as in the corresponding ‘new’ calls, i.e. optional parameters for the PDF that are not present in the given list are (re-)set to their default values. *Important:* If the parameters of a distribution from the UNU.RAN library of standard distributions (*note Standard distributions: Stddist.) are changed, then neither its mode nor the normalization constant are updated. Please use the respective calls ‘unur_distr_cont_upd_mode’ and ‘unur_distr_cont_upd_pdfarea’. Moreover, if the domain has been changed by a ‘unur_distr_cont_set_domain’ it is not automatically updated, either. Updating the normalization constant is in particular very important, when the CDF of the distribution is used. -- Function: int unur_distr_cont_get_pdfparams (const UNUR_DISTR* DISTRIBUTION, const DOUBLE** PARAMS) Get number of parameters of the PDF and set pointer PARAMS to array of parameters. If no parameters are stored in the object, an error code is returned and ‘params’ is set to ‘NULL’. _Important:_ Do *not* change the entries in PARAMS! -- Function: int unur_distr_cont_set_pdfparams_vec (UNUR_DISTR* DISTRIBUTION, int PAR, const DOUBLE* PARAM_VEC, int N_PARAM_VEC) This function provides an interface for additional vector parameters for a continuous DISTRIBUTION. It sets the parameter with number PAR. PAR indicates directly which of the parameters is set and must be a number between ‘0’ and ‘UNUR_DISTR_MAXPARAMS’-1 (the upper limit of possible parameters defined in ‘unuran_config.h’; it is set to 5 but can be changed to any appropriate nonnegative number.) The entries of a this parameter are given by the array PARAM_VEC of size N_PARAM_VEC. If PARAM_VEC is ‘NULL’ then the corresponding entry is cleared. If an error occurs no parameters are copied into the parameter object ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’. -- Function: int unur_distr_cont_get_pdfparams_vec (const UNUR_DISTR* DISTRIBUTION, int PAR, const DOUBLE** PARAM_VECS) Get parameter of the PDF with number PAR. The pointer to the parameter array is stored in PARAM_VECS, its size is returned by the function. If the requested parameter is not set, then an error code is returned and ‘params’ is set to ‘NULL’. _Important:_ Do *not* change the entries in PARAM_VECS! -- Function: int unur_distr_cont_set_logpdfstr (UNUR_DISTR* DISTRIBUTION, const CHAR* LOGPDFSTR) -- Function: char* unur_distr_cont_get_logpdfstr (const UNUR_DISTR* DISTRIBUTION) -- Function: char* unur_distr_cont_get_dlogpdfstr (const UNUR_DISTR* DISTRIBUTION) -- Function: int unur_distr_cont_set_logcdfstr (UNUR_DISTR* DISTRIBUTION, const CHAR* LOGCDFSTR) -- Function: char* unur_distr_cont_get_logcdfstr (const UNUR_DISTR* DISTRIBUTION) Analogous calls for the logarithm of the density and distribution functions. -- Function: int unur_distr_cont_set_domain (UNUR_DISTR* DISTRIBUTION, double LEFT, double RIGHT) Set the left and right borders of the domain of the distribution. This can also be used to truncate an existing distribution. For setting the boundary to +/- infinity use ‘+/- UNUR_INFINITY’. If RIGHT is not strictly greater than LEFT no domain is set and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_SET’. _Important:_ For some technical reasons it is assumed that the density is unimodal and thus monotone on either side of the mode! This is used in the case when the given mode is outside of the original domain. Then the mode is set to the corresponding boundary of the new domain. If this result is not the desired it must be changed by using a ‘unur_distr_cont_set_mode’ call (or a ‘unur_distr_cont_upd_mode’ call). The same holds for the center of the distribution. -- Function: int unur_distr_cont_get_domain (const UNUR_DISTR* DISTRIBUTION, double* LEFT, double* RIGHT) Get the left and right borders of the domain of the distribution. If the domain is not set ‘+/- UNUR_INFINITY’ is assumed and returned. No error is reported in this case. -- Function: int unur_distr_cont_get_truncated (const UNUR_DISTR* DISTRIBUTION, double* LEFT, double* RIGHT) Get the left and right borders of the (truncated) domain of the distribution. For non-truncated distribution this call is equivalent to the ‘unur_distr_cont_get_domain’ call. This call is only useful in connection with a ‘unur_get_distr’ call to get the boundaries of the sampling region of a generator object. -- Function: int unur_distr_cont_set_hr (UNUR_DISTR* DISTRIBUTION, UNUR_FUNCT_CONT* HAZARD) Set pointer to the hazard rate (HR) of the DISTRIBUTION. The _hazard rate_ (or failure rate) is a mathematical way of describing aging. If the lifetime X is a random variable with density f(x) and CDF F(x) the hazard rate h(x) is defined as h(x) = f(x) / (1-F(x)). In other words, h(x) represents the (conditional) rate of failure of a unit that has survived up to time x with probability 1-F(x). The key distribution is the exponential distribution as it has constant hazard rate of value 1. Hazard rates tending to infinity describe distributions with sub-exponential tails whereas distributions with hazard rates tending to zero have heavier tails than the exponential distribution. It is important to note that all these functions must return a result for all floats x. In case of an overflow the PDF should return ‘UNUR_INFINITY’. *Important*: Do not simply use f(x) / (1-F(x)), since this is numerically very unstable and results in numerical noise if F(x) is (very) close to 1. Moreover, if the density f(x) is known a generation method that uses the density is more appropriate. It is not possible to change such a function. Once the HR is set it cannot be overwritten. This also holds when the HR is given by the ‘unur_distr_cont_set_hrstr’ call. A new distribution object has to be used instead. -- Function: UNUR_FUNCT_CONT* unur_distr_cont_get_hr (const UNUR_DISTR* DISTRIBUTION) Get the pointer to the hazard rate of the DISTRIBUTION. The pointer is of type ‘double funct(double x, const UNUR_DISTR *distr)’. If the corresponding function is not available for the distribution, the ‘NULL’ pointer is returned. -- Function: double unur_distr_cont_eval_hr (double X, const UNUR_DISTR* DISTRIBUTION) Evaluate the hazard rate at X. Notice that DISTRIBUTION must not be the ‘NULL’ pointer. If the corresponding function is not available for the distribution, ‘UNUR_INFINITY’ is returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’. -- Function: int unur_distr_cont_set_hrstr (UNUR_DISTR* DISTRIBUTION, const CHAR* HRSTR) This function provides an alternative way to set a hazard rate and its derivative of the DISTRIBUTION. HRSTR is a character string that contains the formula for the HR, see *note Function String: StringFunct, for details. See also the remarks for the ‘unur_distr_cont_set_hr’ call. It is not possible to call this funtion twice or to call this function after a ‘unur_distr_cont_set_hr’ call. -- Function: char* unur_distr_cont_get_hrstr (const UNUR_DISTR* DISTRIBUTION) Get pointer to string for HR of DISTRIBUTION that is given via the string interface. This call allocates memory to produce this string. It should be freed when it is not used any more. Derived parameters .................. The following paramters *must* be set whenever one of the essential parameters has been set or changed (and the parameter is required for the chosen method). -- Function: int unur_distr_cont_set_mode (UNUR_DISTR* DISTRIBUTION, double MODE) Set mode of DISTRIBUTION. The MODE must be contained in the domain of DISTRIBUTION. Otherwise the mode is not set and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_SET’. For distributions with unbounded density, this call is used to set the pole of the PDF. Notice that the PDF should then return ‘UNUR_INFINITY’ at the pole. Notice that the mode is adjusted when the domain is set, see the remark for the ‘unur_distr_cont_set_domain’ call. -- Function: int unur_distr_cont_upd_mode (UNUR_DISTR* DISTRIBUTION) Recompute the mode of the DISTRIBUTION. This call works properly for distribution objects from the UNU.RAN library of standard distributions when the corresponding function is available. Otherwise a (slow) numerical mode finder based on Brent’s algorithm is used. If it failes ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’. -- Function: double unur_distr_cont_get_mode (UNUR_DISTR* DISTRIBUTION) Get mode of DISTRIBUTION. If the mode is not marked as known, ‘unur_distr_cont_upd_mode’ is called to compute the mode. If this is not successful ‘UNUR_INFINITY’ is returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_GET’. (There is no difference between the case where no routine for computing the mode is available and the case where no mode exists for the distribution at all.) -- Function: int unur_distr_cont_set_center (UNUR_DISTR* DISTRIBUTION, double CENTER) Set center of the DISTRIBUTION. The center is used by some methods to shift the distribution in order to decrease numerical round-off error. If not given explicitly a default is used. _Important:_ This call does not check whether the center is contained in the given domain. Default: The mode, if set by a ‘unur_distr_cont_set_mode’ or ‘unur_distr_cont_upd_mode’ call; otherwise ‘0’. -- Function: double unur_distr_cont_get_center (const UNUR_DISTR* DISTRIBUTION) Get center of the DISTRIBUTION. It always returns some point as there always exists a default for the center, see ‘unur_distr_cont_set_center’. -- Function: int unur_distr_cont_set_pdfarea (UNUR_DISTR* DISTRIBUTION, double AREA) Set the area below the PDF. If ‘area’ is non-positive, no area is set and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_SET’. For a distribution object created by the UNU.RAN library of standard distributions you always should use the ‘unur_distr_cont_upd_pdfarea’. Otherwise there might be ambiguous side-effects. -- Function: int unur_distr_cont_upd_pdfarea (UNUR_DISTR* DISTRIBUTION) Recompute the area below the PDF of the distribution. It only works for distribution objects from the UNU.RAN library of standard distributions when the corresponding function is available. Otherwise ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’. This call also sets the normalization constant such that the given PDF is the derivative of a given CDF, i.e. the area is 1. However, for truncated distributions the area is smaller than 1. The call does not work for distributions from the UNU.RAN library of standard distributions with truncated domain when the CDF is not available. -- Function: double unur_distr_cont_get_pdfarea (UNUR_DISTR* DISTRIBUTION) Get the area below the PDF of the distribution. If this area is not known, ‘unur_distr_cont_upd_pdfarea’ is called to compute it. If this is not successful ‘UNUR_INFINITY’ is returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_GET’.  File: unuran.info, Node: CORDER, Next: CEMP, Prev: CONT, Up: Distribution_objects 4.3 Continuous univariate order statistics ========================================== These are special cases of a continuous univariate distributions and thus they have most of these parameters (with the exception that functions cannot be changed). Additionally, − there is a call to extract the underlying distribution, − and a call to handle the ‘rank’ of the order statistics. Function reference ------------------ -- Function: UNUR_DISTR* unur_distr_corder_new (const UNUR_DISTR* DISTRIBUTION, int N, int K) Create an object for order statistics of sample size N and rank K. DISTRIBUTION must be a pointer to a univariate continuous distribution. The resulting generator object is of the same type as of a ‘unur_distr_cont_new’ call. (However, it cannot be used to make an order statistics out of an order statistics.) To have a PDF for the order statistics, the given distribution object must contain a CDF and a PDF. Moreover, it is assumed that the given PDF is the derivative of the given CDF. Otherwise the area below the PDF of the order statistics is not computed correctly. _Important:_ There is no warning when the computed area below the PDF of the order statistics is wrong. -- Function: const UNUR_DISTR* unur_distr_corder_get_distribution (const UNUR_DISTR* DISTRIBUTION) Get pointer to distribution object for underlying distribution. Essential parameters .................... -- Function: int unur_distr_corder_set_rank (UNUR_DISTR* DISTRIBUTION, int N, int K) Change sample size N and rank K of order statistics. In case of invalid data, no parameters are changed. The area below the PDF can be set to that of the underlying distribution by a ‘unur_distr_corder_upd_pdfarea’ call. -- Function: int unur_distr_corder_get_rank (const UNUR_DISTR* DISTRIBUTION, int* N, int* K) Get sample size N and rank K of order statistics. In case of error an error code is returned. Additionally most of the set and get calls for continuous univariate distributions work. The most important exceptions are that the PDF and CDF cannot be changed and ‘unur_distr_cont_upd_mode’ uses in any way a (slow) numerical method that might fail. -- Function: UNUR_FUNCT_CONT* unur_distr_corder_get_pdf (UNUR_DISTR* DISTRIBUTION) -- Function: UNUR_FUNCT_CONT* unur_distr_corder_get_dpdf (UNUR_DISTR* DISTRIBUTION) -- Function: UNUR_FUNCT_CONT* unur_distr_corder_get_cdf (UNUR_DISTR* DISTRIBUTION) Get the respective pointer to the PDF, the derivative of the PDF and the CDF of the distribution, respectively. The pointer is of type ‘double funct(double x, UNUR_DISTR *distr)’. If the corresponding function is not available for the distribution, the ‘NULL’ pointer is returned. See also ‘unur_distr_cont_get_pdf’. (Macro) -- Function: double unur_distr_corder_eval_pdf (double X, UNUR_DISTR* DISTRIBUTION) -- Function: double unur_distr_corder_eval_dpdf (double X, UNUR_DISTR* DISTRIBUTION) -- Function: double unur_distr_corder_eval_cdf (double X, UNUR_DISTR* DISTRIBUTION) Evaluate the PDF, derivative of the PDF. and the CDF, respectively, at X. Notice that DISTRIBUTION must not be the ‘NULL’ pointer. If the corresponding function is not available for the distribution, ‘UNUR_INFINITY’ is returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’. See also ‘unur_distr_cont_eval_pdf’. (Macro) _IMPORTANT:_ In the case of a truncated standard distribution these calls always return the respective values of the _untruncated_ distribution! -- Function: int unur_distr_corder_set_pdfparams (UNUR_DISTR* DISTRIBUTION, double* PARAMS, int N_PARAMS) Set array of parameters for underlying distribution. See ‘unur_distr_cont_set_pdfparams’ for details. (Macro) -- Function: int unur_distr_corder_get_pdfparams (UNUR_DISTR* DISTRIBUTION, double** PARAMS) Get number of parameters of the PDF of the underlying distribution and set pointer PARAMS to array of parameters. See ‘unur_distr_cont_get_pdfparams’ for details. (Macro) -- Function: int unur_distr_corder_set_domain (UNUR_DISTR* DISTRIBUTION, double LEFT, double RIGHT) Set the left and right borders of the domain of the distribution. See ‘unur_distr_cont_set_domain’ for details. (Macro) -- Function: int unur_distr_corder_get_domain (UNUR_DISTR* DISTRIBUTION, double* LEFT, double* RIGHT) Get the left and right borders of the domain of the distribution. See ‘unur_distr_cont_get_domain’ for details. (Macro) -- Function: int unur_distr_corder_get_truncated (UNUR_DISTR* DISTRIBUTION, double* LEFT, double* RIGHT) Get the left and right borders of the (truncated) domain of the distribution. See ‘unur_distr_cont_get_truncated’ for details. (Macro) Derived parameters .................. The following paramters *must* be set whenever one of the essential parameters has been set or changed (and the parameter is required for the chosen method). -- Function: int unur_distr_corder_set_mode (UNUR_DISTR* DISTRIBUTION, double MODE) Set mode of distribution. See also ‘unur_distr_corder_set_mode’. (Macro) -- Function: double unur_distr_corder_upd_mode (UNUR_DISTR* DISTRIBUTION) Recompute the mode of the distribution numerically. Notice that this routine is slow and might not work properly in every case. See also ‘unur_distr_cont_upd_mode’ for further details. (Macro) -- Function: double unur_distr_corder_get_mode (UNUR_DISTR* DISTRIBUTION) Get mode of distribution. See ‘unur_distr_cont_get_mode’ for details. (Macro) -- Function: int unur_distr_corder_set_pdfarea (UNUR_DISTR* DISTRIBUTION, double AREA) Set the area below the PDF. See ‘unur_distr_cont_set_pdfarea’ for details. (Macro) -- Function: double unur_distr_corder_upd_pdfarea (UNUR_DISTR* DISTRIBUTION) Recompute the area below the PDF of the distribution. It only works for order statistics for distribution objects from the UNU.RAN library of standard distributions when the corresponding function is available. ‘unur_distr_cont_upd_pdfarea’ assumes that the PDF of the underlying distribution is normalized, i.e. it is the derivative of its CDF. Otherwise the computed area is wrong and there is *no* warning about this failure. See ‘unur_distr_cont_upd_pdfarea’ for further details. (Macro) -- Function: double unur_distr_corder_get_pdfarea (UNUR_DISTR* DISTRIBUTION) Get the area below the PDF of the distribution. See ‘unur_distr_cont_get_pdfarea’ for details. (Macro)  File: unuran.info, Node: CEMP, Next: CVEC, Prev: CORDER, Up: Distribution_objects 4.4 Continuous empirical univariate distributions ================================================= Empirical univariate distributions are derived from observed data. There are two ways to create such a generator object: 1. By a list of _raw data_ by means of a ‘unur_distr_cemp_set_data’ call. 2. By a _histogram_ (i.e. preprocessed data) by means of a ‘unur_distr_cemp_set_hist’ call. How these data are used to sample from the empirical distribution depends from the chosen generation method. Function reference ------------------ -- Function: UNUR_DISTR* unur_distr_cemp_new (void) Create a new (empty) object for empirical univariate continuous distribution. Essential parameters .................... -- Function: int unur_distr_cemp_set_data (UNUR_DISTR* DISTRIBUTION, const DOUBLE* SAMPLE, int N_SAMPLE) Set observed sample for empirical distribution. -- Function: int unur_distr_cemp_read_data (UNUR_DISTR* DISTRIBUTION, const CHAR* FILENAME) Read data from file ‘filename’. It reads the first number from each line. Numbers are parsed by means of the C standard routine ‘strtod’. Lines that do not start with ‘+’, ‘-’, ‘.’, or a digit are ignored. (Beware of lines starting with a blank!) In case of an error (file cannot be opened, invalid string for double in line) no data are copied into the distribution object and an error code is returned. -- Function: int unur_distr_cemp_get_data (const UNUR_DISTR* DISTRIBUTION, const DOUBLE** SAMPLE) Get number of samples and set pointer SAMPLE to array of observations. If no sample has been given, an error code is returned and ‘sample’ is set to ‘NULL’. _Important:_ Do *not* change the entries in SAMPLE! -- Function: int unur_distr_cemp_set_hist (UNUR_DISTR* DISTRIBUTION, const DOUBLE* PROB, int N_PROB, double XMIN, double XMAX) Set a histogram with bins of equal width. PROB is an array of length N_PROB that contains the probabilities for the bins (in ascending order). XMIN and XMAX give the lower and upper bound of the histogram, respectively. The bins are assumed to have equal width. _Remark:_ This is shortcut for calling ‘unur_distr_cemp_set_hist_prob’ and ‘unur_distr_cemp_set_hist_domain’. _Notice:_ All sampling methods either use raw data or histogram. It is possible to set both types of data; however, it is not checked whether the given histogran corresponds to possibly given raw data. -- Function: int unur_distr_cemp_set_hist_prob (UNUR_DISTR* DISTRIBUTION, const DOUBLE* PROB, int N_PROB) Set probabilities of a histogram with N_PROB bins. Hence PROB must be an array of length N_PROB that contains the probabilities for the bins in ascending order. It is important also to set the location of the bins either with a ‘unur_distr_cemp_set_hist_domain’ for bins of equal width or ‘unur_distr_cemp_set_hist_bins’ when the bins have different width. _Notice:_ All sampling methods either use raw data or histogram. It is possible to set both types of data; however, it is not checked whether the given histogram corresponds to possibly given raw data. -- Function: int unur_distr_cemp_set_hist_domain (UNUR_DISTR* DISTRIBUTION, double XMIN, double XMAX) Set a domain of a histogram with bins of equal width. XMIN and XMAX give the lower and upper bound of the histogram, respectively. -- Function: int unur_distr_cemp_set_hist_bins (UNUR_DISTR* DISTRIBUTION, const DOUBLE* BINS, int N_BINS) Set location of bins of a histogram with N_BINS bins. Hence BINS must be an array of length N_BINS. The domain of the DISTRIBUTION is automatically set by this call and overrides any calls to ‘unur_distr_cemp_set_hist_domain’. _Important:_ The probabilities of the bins of the DISTRIBUTION must be already be set by a ‘unur_distr_cemp_set_hist_prob’ (or a ‘unur_distr_cemp_set_hist’ call) and the value of N_BINS must equal N_PROB‘+1’ from the corresponding value of the respective call.  File: unuran.info, Node: CVEC, Next: CONDI, Prev: CEMP, Up: Distribution_objects 4.5 Continuous multivariate distributions ========================================= The following calls handle multivariate distributions. However, the requirements of particular generation methods is not as unique as for univariate distributions. Moreover, random vector generation methods are still under development. The below functions are a first attempt to handle this situation. Notice that some of the parameters – when given carelessly – might contradict to others. For example: Some methods require the marginal distribution and some methods need a standardized form of the marginal distributions, where the actual mean and variance is stored in the mean vector and the covariance matrix, respectively. We also have to mention that some methods might abuse some of the parameters. Please read the discription of the chosen sampling method carfully. The following kind of calls exists: − Create a ‘new’ instance of a continuous multivariate distribution; − Handle and evaluate probability density function (PDF, ‘pdf’) and the gradient of the density function (‘dpdf’). The following is important: . ‘pdf’ need not be normalized, i.e., any integrable nonnegative function can be used. . ‘dpdf’ must the derivate of the function provided as ‘pdf’. − Handle and evaluate the logarithm of the probability density function (logPDF, ‘logpdf’) and the gradient of the logarithm of the density function (‘dlogpdf’). Some methods use the logarithm of the density if available. − Set (and change) parameters (‘pdfparams’) and the volume below the graph (‘pdfvol’) of the given density. − Set ‘mode’ and ‘mean’ of the distribution. − Set the ‘center’ of the distribution. It is used by some generation methods to adjust the parameters of the generation algorithms to gain better performance. It can be seens as the location of the “central part†of the distribution. − Handle the ‘covar’iance matrix of the distribution and its ‘cholesky’ and ‘inv’verse matrices. − Set the ‘rankcorr’elation matrix of the distribution. − Deal with ‘marginal’ distributions. − Set domain of the distribution. Function reference ------------------ -- Function: UNUR_DISTR* unur_distr_cvec_new (int DIM) Create a new (empty) object for multivariate continuous distribution. DIM is the number of components of the random vector (i.e. its dimension). It is also possible to use dimension 1. Notice, however, that this is treated as a distribution of random vectors with only one component and not as a distribution of real numbers. For the latter ‘unur_distr_cont_new’ should be used to create an object for a univariate distribution. Essential parameters .................... -- Function: int unur_distr_cvec_set_pdf (UNUR_DISTR* DISTRIBUTION, UNUR_FUNCT_CVEC* PDF) Set respective pointer to the PDF of the DISTRIBUTION. This function must be of type ‘double funct(const double *x, UNUR_DISTR *distr)’, where X must be a pointer to a double array of appropriate size (i.e. of the same size as given to the ‘unur_distr_cvec_new’ call). It is not necessary that the given PDF is normalized, i.e. the integral need not be 1. Nevertheless the volume below the PDF can be provided by a ‘unur_distr_cvec_set_pdfvol’ call. It is not possible to change the PDF. Once the PDF is set it cannot be overwritten. This also holds when the logPDF is given. A new distribution object has to be used instead. -- Function: int unur_distr_cvec_set_dpdf (UNUR_DISTR* DISTRIBUTION, UNUR_VFUNCT_CVEC* DPDF) Set pointer to the gradient of the PDF. The type of this function must be ‘int funct(double *result, const double *x, UNUR_DISTR *distr)’, where RESULT and X must be pointers to double arrays of appropriate size (i.e. of the same size as given to the ‘unur_distr_cvec_new’ call). The gradient of the PDF is stored in the array RESULT. The function should return an error code in case of an error and must return ‘UNUR_SUCCESS’ otherwise. The given function must be the gradient of the function given by a ‘unur_distr_cvec_set_pdf’ call. It is not possible to change the gradient of the PDF. Once the dPDF is set it cannot be overwritten. This also holds when the gradient of the logPDF is given. A new distribution object has to be used instead. -- Function: int unur_distr_cvec_set_pdpdf (UNUR_DISTR* DISTRIBUTION, UNUR_FUNCTD_CVEC* PDPDF) Set pointer to partial derivatives of the PDF. The type of this function must be ‘double funct(const double *x, int coord, UNUR_DISTR *distr)’, where X must be a pointer to a double array of appropriate size (i.e. of the same size as given to the ‘unur_distr_cvec_new’ call). COORD is the coordinate for which the partial dervative should be computed. Notice that COORD must be an integer from {0,...,dim-1}. It is not possible to change the partial derivative of the PDF. Once the pdPDF is set it cannot be overwritten. This also holds when the partial derivative of the logPDF is given. A new distribution object has to be used instead. -- Function: UNUR_FUNCT_CVEC* unur_distr_cvec_get_pdf (const UNUR_DISTR* DISTRIBUTION) Get the pointer to the PDF of the DISTRIBUTION. The pointer is of type ‘double funct(const double *x, UNUR_DISTR *distr)’. If the corresponding function is not available for the DISTRIBUTION, the ‘NULL’ pointer is returned. -- Function: UNUR_VFUNCT_CVEC* unur_distr_cvec_get_dpdf (const UNUR_DISTR* DISTRIBUTION) Get the pointer to the gradient of the PDF of the DISTRIBUTION. The pointer is of type ‘int double funct(double *result, const double *x, UNUR_DISTR *distr)’. If the corresponding function is not available for the DISTRIBUTION, the ‘NULL’ pointer is returned. -- Function: double unur_distr_cvec_eval_pdf (const DOUBLE* X, UNUR_DISTR* DISTRIBUTION) Evaluate the PDF of the DISTRIBUTION at X. X must be a pointer to a double array of appropriate size (i.e. of the same size as given to the ‘unur_distr_cvec_new’ call) that contains the vector for which the function has to be evaluated. Notice that DISTRIBUTION must not be the ‘NULL’ pointer. If the corresponding function is not available for the DISTRIBUTION, ‘UNUR_INFINITY’ is returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’. -- Function: int unur_distr_cvec_eval_dpdf (double* RESULT, const DOUBLE* X, UNUR_DISTR* DISTRIBUTION) Evaluate the gradient of the PDF of the DISTRIBUTION at X. The result is stored in the double array RESULT. Both RESULT and X must be pointer to double arrays of appropriate size (i.e. of the same size as given to the ‘unur_distr_cvec_new’ call). Notice that DISTRIBUTION must not be the ‘NULL’ pointer. If the corresponding function is not available for the DISTRIBUTION, an error code is returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’ (RESULT is left unmodified). -- Function: double unur_distr_cvec_eval_pdpdf (const DOUBLE* X, int COORD, UNUR_DISTR* DISTRIBUTION) Evaluate the partial derivative of the PDF of the DISTRIBUTION at X for the coordinate COORD. X must be a pointer to a double array of appropriate size (i.e. of the same size as given to the ‘unur_distr_cvec_new’ call) that contains the vector for which the function has to be evaluated. Notice that COORD must be an integer from {0,...,dim-1}. Notice that DISTRIBUTION must not be the ‘NULL’ pointer. If the corresponding function is not available for the DISTRIBUTION, ‘UNUR_INFINITY’ is returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’. -- Function: int unur_distr_cvec_set_logpdf (UNUR_DISTR* DISTRIBUTION, UNUR_FUNCT_CVEC* LOGPDF) -- Function: int unur_distr_cvec_set_dlogpdf (UNUR_DISTR* DISTRIBUTION, UNUR_VFUNCT_CVEC* DLOGPDF) -- Function: int unur_distr_cvec_set_pdlogpdf (UNUR_DISTR* DISTRIBUTION, UNUR_FUNCTD_CVEC* PDLOGPDF) -- Function: UNUR_FUNCT_CVEC* unur_distr_cvec_get_logpdf (const UNUR_DISTR* DISTRIBUTION) -- Function: UNUR_VFUNCT_CVEC* unur_distr_cvec_get_dlogpdf (const UNUR_DISTR* DISTRIBUTION) -- Function: double unur_distr_cvec_eval_logpdf (const DOUBLE* X, UNUR_DISTR* DISTRIBUTION) -- Function: int unur_distr_cvec_eval_dlogpdf (double* RESULT, const DOUBLE* X, UNUR_DISTR* DISTRIBUTION) -- Function: double unur_distr_cvec_eval_pdlogpdf (const DOUBLE* X, int COORD, UNUR_DISTR* DISTRIBUTION) Analogous calls for the logarithm of the density function. -- Function: int unur_distr_cvec_set_mean (UNUR_DISTR* DISTRIBUTION, const DOUBLE* MEAN) Set mean vector for multivariate DISTRIBUTION. MEAN must be a pointer to an array of size ‘dim’, where ‘dim’ is the dimension returned by ‘unur_distr_get_dim’. A ‘NULL’ pointer for MEAN is interpreted as the zero vector (0,...,0). *Important:* If the parameters of a distribution from the UNU.RAN library of standard distributions (*note Standard distributions: Stddist.) are changed, then neither its mode nor the normalization constant are updated. Please use the respective calls ‘unur_distr_cvec_upd_mode’ and ‘unur_distr_cvec_upd_pdfvol’. -- Function: const double* unur_distr_cvec_get_mean (const UNUR_DISTR* DISTRIBUTION) Get the mean vector of the DISTRIBUTION. The function returns a pointer to an array of size ‘dim’. If the mean vector is not marked as known the ‘NULL’ pointer is returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_GET’. _Important:_ Do *not* modify the array that holds the mean vector! -- Function: int unur_distr_cvec_set_covar (UNUR_DISTR* DISTRIBUTION, const DOUBLE* COVAR) Set covariance matrix for multivariate DISTRIBUTION. COVAR must be a pointer to an array of size ‘dim’ x ‘dim’, where ‘dim’ is the dimension returned by ‘unur_distr_get_dim’. The rows of the matrix have to be stored consecutively in this array. COVAR must be a variance-covariance matrix of the DISTRIBUTION, i.e. it must be symmetric and positive definit and its diagonal entries (i.e. the variance of the components of the random vector) must be strictly positive. The Cholesky factor is computed (and stored) to verify the positive definiteness condition. Notice that the inverse of the given covariance matrix is automatically computed when it is requested by some routine. Notice that the computation of this inverse matrix is unstable in case of high correlations and/or high dimensions. Thus it might fail and methods that require this inverse cannot be used. As an alternative the inverse of the covariance matrix can be directly set by a ‘unur_distr_cvec_set_covar_inv’ call. A ‘NULL’ pointer for COVAR is interpreted as the identity matrix. _Important:_ This entry is abused in some methods which do not require the covariance matrix. It is then used to perform some transformation to obtain better performance. _Important:_ In case of an error (e.g. because COVAR is not a valid covariance matrix) an error code is returned. Moreover, the covariance matrix is not set and is marked as unknown. A previously set covariance matrix is then no longer available. *Important:* If the parameters of a distribution from the UNU.RAN library of standard distributions (*note Standard distributions: Stddist.) are changed, then neither its mode nor the normalization constant are updated. Please use the respective calls ‘unur_distr_cvec_upd_mode’ and ‘unur_distr_cvec_upd_pdfvol’. _Remark:_ UNU.RAN does not check whether the an eventually set covariance matrix and a rank-correlation matrix do not contradict each other. -- Function: int unur_distr_cvec_set_covar_inv (UNUR_DISTR* DISTRIBUTION, const DOUBLE* COVAR_INV) Set inverse of the covariance matrix for multivariate DISTRIBUTION. COVAR_INV must be a pointer to an array of size ‘dim’ x ‘dim’, where ‘dim’ is the dimension returned by ‘unur_distr_get_dim’. The rows of the matrix have to be stored consecutively in this array. COVAR_INV must be symmetric and positive definit. Only the symmetry of the matrix is checked. A ‘NULL’ pointer for COVAR_INV is interpreted as the identity matrix. _Important:_ In case of an error (because COVAR_INV is not symetric) an error code is returned. Moreover, the inverse of the covariance matrix is not set and is marked as unknown. A previously set inverse matrix is then no longer available. _Remark:_ UNU.RAN does not check whether the given matrix is positive definit. _Remark:_ UNU.RAN does not check whether the matrix COVAR_INV is the inverse of the eventually set covariance matrix. -- Function: const double* unur_distr_cvec_get_covar (const UNUR_DISTR* DISTRIBUTION) -- Function: const double* unur_distr_cvec_get_cholesky (const UNUR_DISTR* DISTRIBUTION) -- Function: const double* unur_distr_cvec_get_covar_inv (UNUR_DISTR* DISTRIBUTION) Get covariance matrix of DISTRIBUTION, its Cholesky factor, and its inverse, respectively. The function returns a pointer to an array of size ‘dim’ x ‘dim’. The rows of the matrix are stored consecutively in this array. If the requested matrix is not marked as known the ‘NULL’ pointer is returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_GET’. _Important:_ Do *not* modify the array that holds the covariance matrix! _Remark:_ The inverse of the covariance matrix is computed if it is not already stored. -- Function: int unur_distr_cvec_set_rankcorr (UNUR_DISTR* DISTRIBUTION, const DOUBLE* RANKCORR) Set rank-correlation matrix (Spearman’s correlation) for multivariate DISTRIBUTION. RANKCORR must be a pointer to an array of size ‘dim’ x ‘dim’, where ‘dim’ is the dimension returned by ‘unur_distr_get_dim’. The rows of the matrix have to be stored consecutively in this array. RANKCORR must be a rank-correlation matrix of the DISTRIBUTION, i.e. it must be symmetric and positive definite and its diagonal entries must be equal to ‘1’. The Cholesky factor is computed (and stored) to verify the positive definiteness condition. A ‘NULL’ pointer for RANKCORR is interpreted as the identity matrix. _Important:_ In case of an error (e.g. because RANKCORR is not a valid rank-correlation matrix) an error code is returned. Moreover, the rank-correlation matrix is not set and is marked as unknown. A previously set rank-correlation matrix is then no longer available. _Remark:_ UNU.RAN does not check whether the an eventually set covariance matrix and a rank-correlation matrix do not contradict each other. -- Function: const double* unur_distr_cvec_get_rankcorr (const UNUR_DISTR* DISTRIBUTION) -- Function: const double* unur_distr_cvec_get_rk_cholesky (const UNUR_DISTR* DISTRIBUTION) Get rank-correlation matrix and its cholesky factor, respectively, of DISTRIBUTION. The function returns a pointer to an array of size ‘dim’ x ‘dim’. The rows of the matrix are stored consecutively in this array. If the requested matrix is not marked as known the ‘NULL’ pointer is returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_GET’. _Important:_ Do *not* modify the array that holds the rank-correlation matrix! -- Function: int unur_distr_cvec_set_marginals (UNUR_DISTR* DISTRIBUTION, UNUR_DISTR* MARGINAL) Sets marginal distributions of the given DISTRIBUTION to the same MARGINAL distribution object. The MARGINAL distribution must be an instance of a continuous univariate distribution object. Notice that the marginal distribution is copied into the DISTRIBUTION object. -- Function: int unur_distr_cvec_set_marginal_array (UNUR_DISTR* DISTRIBUTION, UNUR_DISTR** MARGINALS) Analogously to the above ‘unur_distr_cvec_set_marginals’ call. However, now an array MARGINALS of the pointers to each of the marginal distributions must be given. It *must* be an array of size ‘dim’, where ‘dim’ is the dimension returned by ‘unur_distr_get_dim’. _Notice_: Local copies for each of the entries are stored in the DISTRIBUTION object. If some of these entries are identical (i.e. contain the same pointer), then for each of these a new copy is made. -- Function: int unur_distr_cvec_set_marginal_list (UNUR_DISTR* DISTRIBUTION, ...) Similar to the above ‘unur_distr_cvec_set_marginal_array’ call. However, now the pointers to the particular marginal distributions can be given as parameter and does not require an array of pointers. Additionally the given distribution objects are immediately destroyed. Thus calls like ‘unur_distr_normal’ can be used as arguments. (With ‘unur_distr_cvec_set_marginal_array’ the result of such call has to be stored in a pointer since it has to be freed afterwarts to avoid memory leaks!) The number of pointers to in the list of function arguments *must* be equal to the dimension of the DISTRIBUTION, i.e. the dimension returned by ‘unur_distr_get_dim’. If one of the given pointer to marginal distributions is the ‘NULL’ pointer then the marginal distributions of DISTRIBUTION are not set (or previous settings are not changed) and an error code is returned. *Important:* All distribution objects given in the argument list are destroyed! -- Function: const UNUR_DISTR* unur_distr_cvec_get_marginal (const UNUR_DISTR* DISTRIBUTION, int N) Get pointer to the N-th marginal distribution object from the given multivariate DISTRIBUTION. If this does not exist, ‘NULL’ is returned. The marginal distributions are enumerated from ‘1’ to ‘dim’, where ‘dim’ is the dimension returned by ‘unur_distr_get_dim’. -- Function: int unur_distr_cvec_set_pdfparams (UNUR_DISTR* DISTRIBUTION, const DOUBLE* PARAMS, int N_PARAMS) Sets array of parameters for DISTRIBUTION. There is an upper limit for the number of parameters ‘n_params’. It is given by the macro ‘UNUR_DISTR_MAXPARAMS’ in ‘unuran_config.h’. (It is set to 5 by default but can be changed to any appropriate nonnegative number.) If N_PARAMS is negative or exceeds this limit no parameters are copied into the distribution object and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_NPARAMS’. For standard distributions from the UNU.RAN library the parameters are checked. Moreover, the domain is updated automatically. If the given parameters are invalid for the standard distribution, then no parameters are set and an error code is returned. Notice that the given parameter list for such a distribution is handled in the same way as in the corresponding ‘new’ calls, i.e. optional parameters for the PDF that are not present in the given list are (re-)set to their default values. *Important:* If the parameters of a distribution from the UNU.RAN library of standard distributions (*note Standard distributions: Stddist.) are changed, then neither its mode nor the normalization constant are updated. Please use the respective calls ‘unur_distr_cvec_upd_mode’ and ‘unur_distr_cvec_upd_pdfvol’. -- Function: int unur_distr_cvec_get_pdfparams (const UNUR_DISTR* DISTRIBUTION, const DOUBLE** PARAMS) Get number of parameters of the PDF and set pointer PARAMS to array of parameters. If no parameters are stored in the object, an error code is returned and ‘params’ is set to ‘NULL’. _Important:_ Do *not* change the entries in PARAMS! -- Function: int unur_distr_cvec_set_pdfparams_vec (UNUR_DISTR* DISTRIBUTION, int PAR, const DOUBLE* PARAM_VEC, int N_PARAMS) This function provides an interface for additional vector parameters for a multivariate DISTRIBUTION besides mean vector and covariance matrix which have their own calls. It sets the parameter with number PAR. PAR indicates directly which of the parameters is set and must be a number between ‘0’ and ‘UNUR_DISTR_MAXPARAMS’-1 (the upper limit of possible parameters defined in ‘unuran_config.h’; it is set to 5 but can be changed to any appropriate nonnegative number.) The entries of a this parameter are given by the array PARAM_VEC of size N_PARAMS. Notice that using this interface an An (n x m)-matrix has to be stored in an array of length N_PARAMS = n times m; where the rows of the matrix are stored consecutively in this array. Due to great variety of possible parameters for a multivariate DISTRIBUTION there is no simpler interface. If PARAM_VEC is ‘NULL’ then the corresponding entry is cleared. *Important:* If the parameters of a distribution from the UNU.RAN library of standard distributions (*note Standard distributions: Stddist.) are changed, then neither its mode nor the normalization constant are updated. Please use the respective calls ‘unur_distr_cvec_upd_mode’ and ‘unur_distr_cvec_upd_pdfvol’. If an error occurs no parameters are copied into the parameter object ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’. -- Function: int unur_distr_cvec_get_pdfparams_vec (const UNUR_DISTR* DISTRIBUTION, int PAR, const DOUBLE** PARAM_VECS) Get parameter of the PDF with number PAR. The pointer to the parameter array is stored in PARAM_VECS, its size is returned by the function. If the requested parameter is not set, then an error code is returned and ‘params’ is set to ‘NULL’. _Important:_ Do *not* change the entries in PARAM_VECS! -- Function: int unur_distr_cvec_set_domain_rect (UNUR_DISTR* DISTRIBUTION, const DOUBLE* LOWERLEFT, const DOUBLE* UPPERRIGHT) Set rectangular domain for DISTRIBUTION with LOWERLEFT and UPPERRIGHT vertices. Both must be pointer to an array of the size returned by ‘unur_distr_get_dim’. A ‘NULL’ pointer is interpreted as the zero vector (0,...,0). For setting a coordinate of the boundary to +/- infinity use ‘+/- UNUR_INFINITY’. The LOWERLEFT vertex must be strictly smaller than UPPERRIGHT in each component. Otherwise no domain is set and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_SET’. By default the domain of a distribution is unbounded. Thus one can use this call to truncate an existing distribution. _Important:_ Changing the domain of DISTRIBUTION marks derived parameters like the mode or the center as unknown and must be set _after_ changing the domain. This is important for the already set (or default) value for the center does not fall into the given domain. Notice that calls of the PDF and derived functions return ‘0.’ when the parameter is not contained in the domain. -- Function: int unur_distr_cvec_is_indomain (const DOUBLE* X, const UNUR_DISTR* DISTRIBUTION) Check whether X falls into the domain of DISTRIBUTION. Derived parameters .................. The following paramters *must* be set whenever one of the essential parameters has been set or changed (and the parameter is required for the chosen method). -- Function: int unur_distr_cvec_set_mode (UNUR_DISTR* DISTRIBUTION, const DOUBLE* MODE) Set mode of the DISTRIBUTION. MODE must be a pointer to an array of the size returned by ‘unur_distr_get_dim’. A ‘NULL’ pointer for MODE is interpreted as the zero vector (0,...,0). -- Function: int unur_distr_cvec_upd_mode (UNUR_DISTR* DISTRIBUTION) Recompute the mode of the DISTRIBUTION. This call works properly for distribution objects from the UNU.RAN library of standard distributions when the corresponding function is available. If it failes ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’. -- Function: const double* unur_distr_cvec_get_mode (UNUR_DISTR* DISTRIBUTION) Get mode of the DISTRIBUTION. The function returns a pointer to an array of the size returned by ‘unur_distr_get_dim’. If the mode is not marked as known the ‘NULL’ pointer is returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_GET’. (There is no difference between the case where no routine for computing the mode is available and the case where no mode exists for the DISTRIBUTION at all.) _Important:_ Do *not* modify the array that holds the mode! -- Function: int unur_distr_cvec_set_center (UNUR_DISTR* DISTRIBUTION, const DOUBLE* CENTER) Set center of the DISTRIBUTION. CENTER must be a pointer to an array of the size returned by ‘unur_distr_get_dim’. A ‘NULL’ pointer for CENTER is interpreted as the zero vector (0,...,0). The center is used by some methods to shift the distribution in order to decrease numerical round-off error. If not given explicitly a default is used. Moreover, it is used as starting point for several numerical search algorithm (e.g. for the mode). Then CENTER must be a pointer where the call to the PDF returns a non-zero value. In particular CENTER must contained in the domain of the distribution. Default: The mode, if given by a ‘unur_distr_cvec_set_mode’ call; else the mean, if given by a ‘unur_distr_cvec_set_mean’ call; otherwise the null vector (0,...,0). -- Function: const double* unur_distr_cvec_get_center (UNUR_DISTR* DISTRIBUTION) Get center of the DISTRIBUTION. The function returns a pointer to an array of the size returned by ‘unur_distr_get_dim’. It always returns some point as there always exists a default for the center, see ‘unur_distr_cvec_set_center’. _Important:_ Do *not* modify the array that holds the center! -- Function: int unur_distr_cvec_set_pdfvol (UNUR_DISTR* DISTRIBUTION, double VOLUME) Set the volume below the PDF. If VOL is non-positive, no volume is set and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_SET’. -- Function: int unur_distr_cvec_upd_pdfvol (UNUR_DISTR* DISTRIBUTION) Recompute the volume below the PDF of the distribution. It only works for distribution objects from the UNU.RAN library of standard distributions when the corresponding function is available. Otherwise ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’. This call also sets the normalization constant such that the given PDF is the derivative of a given CDF, i.e. the volume is 1. -- Function: double unur_distr_cvec_get_pdfvol (UNUR_DISTR* DISTRIBUTION) Get the volume below the PDF of the DISTRIBUTION. If this volume is not known, ‘unur_distr_cont_upd_pdfarea’ is called to compute it. If this is not successful ‘UNUR_INFINITY’ is returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_GET’.  File: unuran.info, Node: CONDI, Next: CVEMP, Prev: CVEC, Up: Distribution_objects 4.6 Continuous univariate full conditional distribution ======================================================= Full conditional distribution for a given continuous multivariate distributiion. The condition is a position vector and either a variable that is variated or a vector that indicates the direction on which the random vector can variate. There is a subtle difference between using direction vector and using the K-th variable. When a direction vector is given the PDF of the conditional distribution is defined by f(t) = PDF(pos + t * dir). When a variable is selected the full conditional distribution with all other variables fixed is used. This is a special case of a continuous univariate distribution and thus they have most of these parameters (with the exception that functions cannot be changed). Additionally, − there is a call to extract the underlying multivariate distribution, − and a call to handle the variables that are fixed and the direction for changing the random vector. This distibution type is primarily used for evaluation the conditional distribution and its derivative (as required for, e.g., the Gibbs sampler). The density is not normalized (i.e. does not integrate to one). Mode and area are not available and it does not make sense to use any call to set or change parameters except the ones given below. Function reference ------------------ -- Function: UNUR_DISTR* unur_distr_condi_new (const UNUR_DISTR* DISTRIBUTION, const DOUBLE* POS, const DOUBLE* DIR, int K) Create an object for full conditional distribution for the given DISTRIBUTION. The condition is given by a position vector POS and either the K-th variable that is variated or the vector DIR that contains the direction on which the random vector can variate. DISTRIBUTION must be a pointer to a multivariate continuous distribution. POS must be a pointer to an array of size ‘dim’, where ‘dim’ is the dimension of the underlying distribution object. DIR must be a pointer to an array if size ‘dim’ or ‘NULL’. K must be in the range ‘0, ..., dim-1’. If the K-th variable is used, DIR must be set to ‘NULL’. _Notice:_ There is a subtle difference between using direction vector DIR and using the K-th variable. When DIR is given, the current position POS is mapped into 0 of the conditional distribution and the derivative is taken from the function PDF(POS+t*DIR) w.r.t. t. On the other hand, when the coordinate K is used (i.e., when DIR is set to ‘NULL’), the full conditional distribution of the distribution is considered (as used for the Gibbs sampler). In particular, the current point is just projected into the one-dimensional subspace without mapping it into the point 0. _Notice:_ If a coordinate K is used, then the K-th partial derivative is used if it as available. Otherwise the gradient is computed and the K-th component is returned. The resulting generator object is of the same type as of a ‘unur_distr_cont_new’ call. -- Function: int unur_distr_condi_set_condition (struct UNUR_DISTR* DISTRIBUTION, const DOUBLE* POS, const DOUBLE* DIR, int K) Set/change condition for conditional DISTRIBUTION. Change values of fixed variables to POS and use direction DIR or K-th variable of conditional DISTRIBUTION. POS must be a pointer to an array of size ‘dim’, where ‘dim’ is the dimension of the underlying distribution object. DIR must be a pointer to an array if size ‘dim’ or ‘NULL’. K must be in the range ‘0, ..., dim-1’. If the K-th variable is used, DIR must be set to ‘NULL’. _Notice:_ There is a subtle difference between using direction vector DIR and using the K-th variable. When DIR is given, the current position POS is mapped into 0 of the conditional distribution and the derivative is taken from the function PDF(POS+t*DIR) w.r.t. t. On the other hand, when the coordinate K is used (i.e., when DIR is set to ‘NULL’), the full conditional distribution of the distribution is considered (as used for the Gibbs sampler). In particular, the current point is just projected into the one-dimensional subspace without mapping it into the point 0. -- Function: int unur_distr_condi_get_condition (struct UNUR_DISTR* DISTRIBUTION, const DOUBLE** POS, const DOUBLE** DIR, int* K) Get condition for conditional DISTRIBUTION. The values for the fixed variables are stored in POS, which must be a pointer to an array of size ‘dim’. The condition is stored in DIR and K, respectively. _Important:_ Do *not* change the entries in POS and DIR! -- Function: const UNUR_DISTR* unur_distr_condi_get_distribution (const UNUR_DISTR* DISTRIBUTION) Get pointer to distribution object for underlying distribution.  File: unuran.info, Node: CVEMP, Next: MATR, Prev: CONDI, Up: Distribution_objects 4.7 Continuous empirical multivariate distributions =================================================== Empirical multivariate distributions are just lists of vectors (with the same dimension). Thus there are only calls to insert these data. How these data are used to sample from the empirical distribution depends from the chosen generation method. Function reference ------------------ -- Function: UNUR_DISTR* unur_distr_cvemp_new (int DIM) Create a new (empty) object for an empirical multivariate continuous distribution. DIM is the number of components of the random vector (i.e. its dimension). It must be at least 2; otherwise ‘unur_distr_cemp_new’ should be used to create an object for an empirical univariate distribution. Essential parameters .................... -- Function: int unur_distr_cvemp_set_data (UNUR_DISTR* DISTRIBUTION, const DOUBLE* SAMPLE, int N_SAMPLE) Set observed sample for empirical DISTRIBUTION. SAMPLE is an array of doubles of size ‘dim’ x N_SAMPLE, where ‘dim’ is the dimension of the DISTRIBUTION returned by ‘unur_distr_get_dim’. The data points must be stored consecutively in SAMPLE, i.e., data points (x1, y1), (x2, y2), ... are given as an array {x1, y1, x2, y2, ...}. -- Function: int unur_distr_cvemp_read_data (UNUR_DISTR* DISTRIBUTION, const CHAR* FILENAME) Read data from file ‘filename’. It reads the first ‘dim’ numbers from each line, where ‘dim’ is the dimension of the DISTRIBUTION returned by ‘unur_distr_get_dim’. Numbers are parsed by means of the C standard routine ‘strtod’. Lines that do not start with ‘+’, ‘-’, ‘.’, or a digit are ignored. (Beware of lines starting with a blank!) In case of an error (file cannot be opened, too few entries in a line, invalid string for double in line) no data are copied into the distribution object and an error code is returned. -- Function: int unur_distr_cvemp_get_data (const UNUR_DISTR* DISTRIBUTION, const DOUBLE** SAMPLE) Get number of samples and set pointer SAMPLE to array of observations. If no sample has been given, an error code is returned and SAMPLE is set to ‘NULL’. If successful SAMPLE points to an array of length ‘dim’ x ‘n_sample’, where ‘dim’ is the dimension of the distribution returned by ‘unur_distr_get_dim’ and ‘n_sample’ the return value of the function. _Important:_ Do *not* modify the array SAMPLE.  File: unuran.info, Node: MATR, Next: DISCR, Prev: CVEMP, Up: Distribution_objects 4.8 MATRix distributions ======================== Distributions for random matrices. Notice that UNU.RAN uses arrays of ‘double’s to handle matrices. The rows of the matrix are stored consecutively. Function reference ------------------ -- Function: UNUR_DISTR* unur_distr_matr_new (int N_ROWS, int N_COLS) Create a new (empty) object for a matrix distribution. N_ROWS and N_COLS are the respective numbers of rows and columns of the random matrix (i.e. its dimensions). It is also possible to have only one number or rows and/or columns. Notice, however, that this is treated as a distribution of random matrices with only one row or column or component and not as a distribution of vectors or real numbers. For the latter ‘unur_distr_cont_new’ or ‘unur_distr_cvec_new’ should be used to create an object for a univariate distribution and a multivariate (vector) distribution, respectively. Essential parameters .................... -- Function: int unur_distr_matr_get_dim (const UNUR_DISTR* DISTRIBUTION, int* N_ROWS, int* N_COLS) Get number of rows and columns of random matrix (its dimension). It returns the total number of components. If successfull ‘UNUR_SUCCESS’ is returned.  File: unuran.info, Node: DISCR, Prev: MATR, Up: Distribution_objects 4.9 Discrete univariate distributions ===================================== The calls in this section can be applied to discrete univariate distributions. − Create a ‘new’ instance of a discrete univariate distribution. − Handle and evaluate distribution function (CDF, ‘cdf’) and probability mass function (PMF, ‘pmf’). The following is important: . ‘pmf’ need not be normalized, i.e., any summable nonnegative function on the set of intergers can be used. . ‘cdf’ must be a distribution function, i.e. it must be monotonically increasing with range [0,1]. . If ‘cdf’ and ‘pdf’ are used together for a pariticular generation method, then ‘pmf’ must be normalized, i.e. it must sum to 1. − Alternatively, ‘cdf’ and ‘pdf’ can be provided as ‘str’ings instead of function pointers. − Some generation methods require a (finite) probability vector (PV, ‘pv’), i.e. an array of ‘double’s. It can be automatically computed if the ‘pmf’ is given but ‘pv’ is not. − Set (and change) parameters (‘pmfparams’) and the total sum (‘pmfsum’) of the given PMF or PV. − Set the ‘mode’ of the distribution. − Set the ‘domain’ of the distribution. Function reference ------------------ -- Function: UNUR_DISTR* unur_distr_discr_new (void) Create a new (empty) object for a univariate discrete distribution. Essential parameters .................... There are two interfaces for discrete univariate distributions: Either provide a (finite) probability vector (PV). Or provide a probability mass function (PMF). For the latter case there are also a couple of derived parameters that are not required when a PV is given. It is not possible to set both a PMF and a PV directly. However, the PV can be computed from the PMF (or the CDF if no PMF is available) by means of a ‘unur_distr_discr_make_pv’ call. If both the PV and the PMF are given in the distribution object it depends on the generation method which of these is used. -- Function: int unur_distr_discr_set_pv (UNUR_DISTR* DISTRIBUTION, const DOUBLE* PV, int N_PV) Set finite probability vector (PV) for the DISTRIBUTION. It is not necessary that the entries in the given PV sum to 1. N_PV must be positive. However, there is no testing whether all entries in PV are non-negative. If no domain has been set, then the left boundary is set to ‘0’, by default. If N_PV is too large, e.g. because left boundary + N_PV exceeds the range of integers, then the call fails. Notice that it is not possible to set both a PV and a PMF or CDF. If the PMF or CDF is set first one cannot set the PV. If the PMF or CDF is set first after a PV is set, the latter is removed (and recomputed using ‘unur_distr_discr_make_pv’ when required). -- Function: int unur_distr_discr_make_pv (UNUR_DISTR* DISTRIBUTION) Compute a PV when a PMF or CDF is given. However, when the domain is not given or is too large and the sum over the PMF is given then the (right) tail of the DISTRIBUTION is chopped off such that the probability for the tail region is less than 1.e-8. If the sum over the PMF is not given a PV of maximal length is computed. The maximal size of the created PV is bounded by the macro ‘UNUR_MAX_AUTO_PV’ that is defined in ‘unuran_config.h’. If successful, the length of the generated PV is returned. If the sum over the PMF on the chopped tail is not neglible small (i.e. greater than 1.e-8 or unknown) than the negative of the length of the PV is returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_SET’. Notice that the left boundary of the PV is set to ‘0’ by default when a discrete distribution object is created from scratch. If computing a PV fails for some reasons, an error code is returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_SET’. -- Function: int unur_distr_discr_get_pv (const UNUR_DISTR* DISTRIBUTION, const DOUBLE** PV) Get length of PV of the DISTRIBUTION and set pointer PV to array of probabilities. If no PV is given, an error code is returned and PV is set to ‘NULL’. (It does not call ‘unur_distr_discr_make_pv’ !) -- Function: int unur_distr_discr_set_pmf (UNUR_DISTR* DISTRIBUTION, UNUR_FUNCT_DISCR* PMF) -- Function: int unur_distr_discr_set_cdf (UNUR_DISTR* DISTRIBUTION, UNUR_FUNCT_DISCR* CDF) Set respective pointer to the PMF and the CDF of the DISTRIBUTION. These functions must be of type ‘double funct(int k, const UNUR_DISTR *distr)’. It is important to note that all these functions must return a result for all integers K. E.g., if the domain of a given PMF is the interval {1,2,3,...,100}, than the given function must return ‘0.0’ for all points outside this interval. The default domain for the PMF or CDF is [‘0’, ‘INT_MAX’]. The domain can be changed using a ‘unur_distr_discr_set_domain’ call. It is not possible to change such a function. Once the PMF or CDF is set it cannot be overwritten. A new distribution object has to be used instead. Notice that it is not possible to set both a PV and a PMF or CDF. If the PMF or CDF is set first one cannot set the PV. If the PMF or CDF is set first after a PV is set, the latter is removed (and recomputed using ‘unur_distr_discr_make_pv’ when required). -- Function: int unur_distr_discr_set_invcdf (UNUR_DISTR* DISTRIBUTION, UNUR_IFUNCT_DISCR* INVCDF) Set inverse CDF of the DISTRIBUTION. INVCDF must be a pointer must be of type ‘int funct(double x, const UNUR_DISTR *distr)’, i.e., it should return a ‘double’. -- Function: double unur_distr_discr_eval_pv (int K, const UNUR_DISTR* DISTRIBUTION) -- Function: double unur_distr_discr_eval_pmf (int K, const UNUR_DISTR* DISTRIBUTION) -- Function: double unur_distr_discr_eval_cdf (int K, const UNUR_DISTR* DISTRIBUTION) Evaluate the PV, PMF, and the CDF, respectively, at k. Notice that DISTRIBUTION must not be the ‘NULL’ pointer. If no PV is set for the DISTRIBUTION, then ‘unur_distr_discr_eval_pv’ behaves like ‘unur_distr_discr_eval_pmf’. If the corresponding function is not available for the DISTRIBUTION, ‘UNUR_INFINITY’ is returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’. _IMPORTANT:_ In the case of a truncated standard distribution these calls always return the respective values of the _untruncated_ distribution! -- Function: int unur_distr_discr_eval_invcdf (double U, const UNUR_DISTR* DISTRIBUTION) Evaluate the inverse CDF at U. Notice that DISTRIBUTION must not be the ‘NULL’ pointer. If the corresponding function is not available for the distribution, ‘INT_MAX’ is returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’. _IMPORTANT:_ In the case of a truncated standard distribution these calls always return the respective values of the _untruncated_ distribution! -- Function: int unur_distr_discr_set_pmfstr (UNUR_DISTR* DISTRIBUTION, const CHAR* PMFSTR) This function provides an alternative way to set a PMF of the DISTRIBUTION. PMFSTR is a character string that contains the formula for the PMF, see *note Function String: StringFunct, for details. See also the remarks for the ‘unur_distr_discr_set_pmf’ call. It is not possible to call this funtion twice or to call this function after a ‘unur_distr_discr_set_pmf’ call. -- Function: int unur_distr_discr_set_cdfstr (UNUR_DISTR* DISTRIBUTION, const CHAR* CDFSTR) This function provides an alternative way to set a CDF; analogously to the ‘unur_distr_discr_set_pmfstr’ call. -- Function: char* unur_distr_discr_get_pmfstr (const UNUR_DISTR* DISTRIBUTION) -- Function: char* unur_distr_discr_get_cdfstr (const UNUR_DISTR* DISTRIBUTION) Get pointer to respective string for PMF and CDF of DISTRIBUTION that is given via the string interface. This call allocates memory to produce this string. It should be freed when it is not used any more. -- Function: int unur_distr_discr_set_pmfparams (UNUR_DISTR* DISTRIBUTION, const DOUBLE* PARAMS, int N_PARAMS) Set array of parameters for DISTRIBUTION. There is an upper limit for the number of parameters N_PARAMS. It is given by the macro ‘UNUR_DISTR_MAXPARAMS’ in ‘unuran_config.h’. (It is set to 5 but can be changed to any appropriate nonnegative number.) If N_PARAMS is negative or exceeds this limit no parameters are copied into the DISTRIBUTION object and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_NPARAMS’. For standard distributions from the UNU.RAN library the parameters are checked. Moreover, the domain is updated automatically unless it has been changed before by a ‘unur_distr_discr_set_domain’ call. If the given parameters are invalid for the standard distribution, then no parameters are set and an error code is returned. Notice that the given parameter list for such a distribution is handled in the same way as in the corresponding ‘new’ calls, i.e. optional parameters for the PDF that are not present in the given list are (re-)set to their default values. _Important:_ Integer parameter must be given as ‘double’s. -- Function: int unur_distr_discr_get_pmfparams (const UNUR_DISTR* DISTRIBUTION, const DOUBLE** PARAMS) Get number of parameters of the PMF and set pointer PARAMS to array of parameters. If no parameters are stored in the object, an error code is returned and ‘params’ is set to ‘NULL’. -- Function: int unur_distr_discr_set_domain (UNUR_DISTR* DISTRIBUTION, int LEFT, int RIGHT) Set the left and right borders of the domain of the DISTRIBUTION. This can also be used to truncate an existing distribution. For setting the boundary to +/- infinity use ‘INT_MIN’ and ‘INT_MAX’, respectively. If RIGHT is not strictly greater than LEFT no domain is set and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_SET’. It is allowed to use this call to increase the domain. If the PV of the discrete distribution is used, than the right boudary is ignored (and internally set to LEFT + size of PV - 1). Notice that ‘INT_MIN’ and ‘INT_MAX’ are interpreted as (minus/plus) infinity. Default: [‘0’, ‘INT_MAX’]. -- Function: int unur_distr_discr_get_domain (const UNUR_DISTR* DISTRIBUTION, int* LEFT, int* RIGHT) Get the left and right borders of the domain of the DISTRIBUTION. If the domain is not set explicitly the interval [‘INT_MIN’, ‘INT_MAX’] is assumed and returned. When a PV is given then the domain is set automatically to [‘0’,size of PV - 1]. Derived parameters .................. The following paramters *must* be set whenever one of the essential parameters has been set or changed (and the parameter is required for the chosen method). -- Function: int unur_distr_discr_set_mode (UNUR_DISTR* DISTRIBUTION, int MODE) Set mode of DISTRIBUTION. -- Function: int unur_distr_discr_upd_mode (UNUR_DISTR* DISTRIBUTION) Recompute the mode of the DISTRIBUTION. This call works properly for distribution objects from the UNU.RAN library of standard distributions when the corresponding function is available. Otherwise a (slow) numerical mode finder is used. It only works properly for unimodal probability mass functions. If it failes ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’. -- Function: int unur_distr_discr_get_mode (UNUR_DISTR* DISTRIBUTION) Get mode of DISTRIBUTION. If the mode is not marked as known, ‘unur_distr_discr_upd_mode’ is called to compute the mode. If this is not successful ‘INT_MAX’ is returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_GET’. (There is no difference between the case where no routine for computing the mode is available and the case where no mode exists for the distribution at all.) -- Function: int unur_distr_discr_set_pmfsum (UNUR_DISTR* DISTRIBUTION, double SUM) Set the sum over the PMF. If ‘sum’ is non-positive, no sum is set and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_SET’. For a distribution object created by the UNU.RAN library of standard distributions you always should use the ‘unur_distr_discr_upd_pmfsum’. Otherwise there might be ambiguous side-effects. -- Function: int unur_distr_discr_upd_pmfsum (UNUR_DISTR* DISTRIBUTION) Recompute the sum over the PMF of the DISTRIBUTION. In most cases the normalization constant is recomputed and thus the sum is 1. This call works for distribution objects from the UNU.RAN library of standard distributions when the corresponding function is available. When a PV, a PMF with finite domain, or a CDF is given, a simple generic function which uses a naive summation loop is used. If this computation is not possible, an error code is returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’. The call does not work for distributions from the UNU.RAN library of standard distributions with truncated domain when the CDF is not available. -- Function: double unur_distr_discr_get_pmfsum (UNUR_DISTR* DISTRIBUTION) Get the sum over the PMF of the DISTRIBUTION. If this sum is not known, ‘unur_distr_discr_upd_pmfsum’ is called to compute it. If this is not successful ‘UNUR_INFINITY’ is returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_GET’.  File: unuran.info, Node: Methods, Next: URNG, Prev: Distribution_objects, Up: Top 5 Methods for generating non-uniform random variates **************************************************** * Menu: * Methods_all:: Routines for all generator objects * AUTO:: Select method automatically * Methods_for_CONT:: Methods for continuous univariate distributions * Methods_for_CEMP:: Methods for continuous empirical univariate distributions * Methods_for_CVEC:: Methods for continuous multivariate distributions * MCMC_Methods_for_CVEC:: Markov chain samplers for continuous multivariate distributions * Methods_for_CVEMP:: Methods for continuous empirical multivariate distributions * Methods_for_DISCR:: Methods for discrete univariate distributions * Methods_for_MATR:: Methods for random matrices * Methods_for_UNID:: Methods for uniform univariate distributions * Meta_Methods:: Meta Methods for univariate distributions Sampling from a particular distribution with UNU.RAN requires the following steps: 1. Create a distribution object (*note Handling distribution objects: Distribution_objects.). 2. Select a method and create a parameter object. 3. Initizialize the generator object using ‘unur_init’. _Important_: Initialization of the generator object might fail. ‘unur_init’ returns a ‘NULL’ pointer then, which *must* not be used for sampling. 4. Draw a sample from the generator object using the corresponding sampling function (depending on the type of distribution: univariate continuous, univariate discrete, multivariate continuous, and random matrix). 5. It is possible for a generator object to change the parameters and the domain of the underlying distribution. This must be done by extracting this object by means of a ‘unur_get_distr’ call and changing the distribution using the correspondig set calls, see *note Handling distribution objects: Distribution_objects. The generator object *must* then be reinitialized by means of the ‘unur_reinit’ call. _Important_: Currently not all methods allow reinitialization, see the description of the particular method (keyword Reinit). _Important_: Reinitialization of the generator object might fail. Thus one *must* check the return code of the ‘unur_reinit’ call. _Important_: When reinitialization fails then sampling routines always return ‘UNUR_INFINITY’ (for continuous distributions) or ‘0’ (for discrete distributions), respectively. However, it is still possible to change the underlying distribution and try to reinitialize again.  File: unuran.info, Node: Methods_all, Next: AUTO, Up: Methods 5.1 Routines for all generator objects ====================================== Routines for all generator objects. Function reference ------------------ -- Function: UNUR_GEN* unur_init (UNUR_PAR* PARAMETERS) Initialize a generator object. All necessary information must be stored in the parameter object. *Important:* If an error has occurred a ‘NULL’ pointer is return. This must not be used for the sampling routines (this causes a segmentation fault). *Always* check whether the call was successful or not! _Important:_ This call destroys the PARAMETER object automatically. Thus it is not necessary/allowed to free it. -- Function: int unur_reinit (UNUR_GEN* GENERATOR) Update an existing generator object after the underlying distribution has been modified (using ‘unur_get_distr’ together with corresponding set calls. It *must* be executed before sampling using this generator object is continued as otherwise it produces an invalid sample or might even cause a segmentation fault. _Important_: Currently not all methods allow reinitialization, see the description of the particular method (keyword Reinit). _Important_: Reinitialization of the generator object might fail. Thus one *must* check the return code: ‘UNUR_SUCCESS (0x0u)’ success (no error) ‘UNUR_ERR_NO_REINIT’ reinit routine not implemented. other values some error has occured while trying to reinitialize the generator object. _Important_: When reinitialization fails then sampling routines always return ‘UNUR_INFINITY’ (for continuous distributions) or ‘0’ (for discrete distributions), respectively. However, it is still possible to change the underlying distribution and try to reinitialize again. _Important_: When one tries to run ‘unur_reinit’, but reinitialization is not implemented, then the generator object cannot be used any more and must be destroyed and a new one has to be built from scratch. -- Function: int unur_sample_discr (UNUR_GEN* GENERATOR) -- Function: double unur_sample_cont (UNUR_GEN* GENERATOR) -- Function: int unur_sample_vec (UNUR_GEN* GENERATOR, double* VECTOR) -- Function: int unur_sample_matr (UNUR_GEN* GENERATOR, double* MATRIX) Sample from generator object. The three routines depend on the type of the generator object (discrete or continuous univariate distribution, multivariate distribution, or random matrix). _Notice:_ UNU.RAN uses arrays of ‘double’s to handle matrices. There the rows of the matrix are stored consecutively. _Notice:_ The routines ‘unur_sample_vec’ and ‘unur_sample_matr’ return ‘UNUR_SUCCESS’ if generation was successful and some error code otherwise. *Important:* These routines do *not* check whether GENERATOR is an invalid ‘NULL’ pointer. -- Function: double unur_quantile (UNUR_GEN* GENERATOR, double U) Compute the U quantile of a continuous distribution using a GENERATOR object that implements an (approximate) inversion methods. The following methods are currently available: • HINV, *note HINV::. • NINV, *note NINV::. • PINV, *note PINV::. • CSTD, *note CSTD::. This requires that GENERATOR implements an inversion method. • DGT, *note DGT::. The return value is (of course) type casted to ‘double’. *Important:* This routine does *not* check whether GENERATOR is an invalid ‘NULL’ pointer. In case of an error UNUR_INFINITY or INT_MAX (depending on the type of GENERATOR) is returned. -- Function: void unur_free (UNUR_GEN* GENERATOR) Destroy (free) the given generator object. -- Function: const char* unur_gen_info (UNUR_GEN* GENERATOR, int HELP) Get a string with informations about the given GENERATOR. These informations allow some fine tuning of the generation method. If HELP is ‘TRUE’, some hints on setting parameters are given. This function is intented for using in interactive environments (like R). If an error occurs, then ‘NULL’ is returned. -- Function: int unur_get_dimension (const UNUR_GEN* GENERATOR) Get the number of dimension of a (multivariate) distribution. For a univariate distribution ‘1’ is return. -- Function: const char* unur_get_genid (const UNUR_GEN* GENERATOR) Get identifier string for generator. -- Function: unsigned int unur_get_method (const UNUR_GEN* GENERATOR) Get identifier for generating method. These identifiers are declared in ‘src/methods/unur_metthods.h’. -- Function: int unur_gen_is_inversion (const UNUR_GEN* GEN) Return ‘TRUE’ if the generator object implements an inversion method, and ‘FALSE’ otherwise. -- Function: UNUR_DISTR* unur_get_distr (const UNUR_GEN* GENERATOR) Get pointer to distribution object from generator object. This function can be used to change the parameters of the distribution and reinitialize the generator object. Notice that currently *not all* generating methods have a reinitialize routine. This function should be used with extreme care. Changing the distribution is changed and using the generator object without reinitializing might cause wrong samples or segmentation faults. Moreover, if the corresponding generator object is freed, the pointer must not be used. *Important:* The returned distribution object must not be freed. If the distribution object is changed then one *must* run ‘unur_reinit’ ! -- Function: int unur_set_use_distr_privatecopy (UNUR_PAR* PARAMETERS, int USE_PRIVATECOPY) Set flag whether the generator object should make a private copy of the given distribution object or just stores the pointer to this distribution object. Values for USE_PRIVATECOPY: ‘TRUE’ make a private copy (default) ‘FALSE’ do not make a private copy and store pointer to given (external) distribution object. By default, generator objects keep their own private copy of the given distribution object. Thus the generator object can be handled independently from other UNU.RAN objects (with uniform random number generators as the only exception). When the generator object is initialized the given distribution object is cloned and stored. However, in some rare situations it can be useful when only the pointer to the given distribution object is stored without making a private copy. A possible example is when only one random variate has to be drawn from the distribution. This behavior can be achieved when USE_LOCALCOPY is set to ‘FALSE’. *Warning!* Using a pointer to the external distribution object instead of a private copy must be done with *extreme care*! When the distrubtion object is changed or freed then the generator object does not work any more, might case a segmentation fault, or (even worse) produces garbage. On the other hand, when the generator object is initialized or used to draw a random sampling the distribution object may be changed. _Notice:_ The prototypes of all ‘unur__new’ calls use a ‘const’ qualifier for the distribution argument. However, if USE_PRIVATECOPY is set to ‘FALSE’ this qualifier is discarded and the distribution might be changed. *Important!* If USE_LOCALCOPY is set to ‘FALSE’ and the corresponding distribution object is changed then one must run ‘unur_reinit’ on the generator object. (Notice that currently not all generation methods support reinitialization.) Default: USE_PRIVATECOPY is ‘TRUE’.  File: unuran.info, Node: AUTO, Next: Methods_for_CONT, Prev: Methods_all, Up: Methods 5.2 AUTO – Select method automatically ====================================== AUTO selects a an appropriate method for the given distribution object automatically. There are no parameters for this method, yet. But it is planned to give some parameter to describe the task for which the random variate generator is used for and thus make the choice of the generating method more appropriate. Notice that the required sampling routine for the generator object depends on the type of the given distribution object. The chosen method also depends on the sample size for which the generator object will be used. If only a few random variates the order of magnitude of the sample size should be set via a ‘unur_auto_set_logss’ call. IMPORTANT: This is an experimental version and the method chosen may change in future releases of UNU.RAN. For an example see *note As short as possible: Example_0. How To Use .......... Create a generator object for the given distribution object. Function reference ------------------ -- Function: UNUR_PAR* unur_auto_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_auto_set_logss (UNUR_PAR* PARAMETERS, int LOGSS) Set the order of magnitude for the size of the sample that will be generated by the generator, i.e., the the common logarithm of the sample size. Default is 10. Notice: This feature will be used in future releases of UNU.RAN only.  File: unuran.info, Node: Methods_for_CONT, Next: Methods_for_CEMP, Prev: AUTO, Up: Methods 5.3 Methods for continuous univariate distributions =================================================== * Menu: * AROU:: Automatic Ratio-Of-Uniforms method * ARS:: Adaptive Rejection Sampling * CEXT:: wrapper for Continuous EXTernal generators * CSTD:: Continuous STandarD distributions * HINV:: Hermite interpolation based INVersion of CDF * HRB:: Hazard Rate Bounded * HRD:: Hazard Rate Decreasing * HRI:: Hazard Rate Increasing * ITDR:: Inverse Transformed Density Rejection * NINV:: Numerical INVersion * NROU:: Naive Ratio-Of-Uniforms method * PINV:: Polynomial interpolation based INVersion of CDF * SROU:: Simple Ratio-Of-Uniforms method * SSR:: Simple Setup Rejection * TABL:: a TABLe method with piecewise constant hats * TDR:: Transformed Density Rejection * UTDR:: Universal Transformed Density Rejection Overview of methods ------------------- Methods for continuous univariate distributions sample with ‘unur_sample_cont’ method PDF dPDF CDF mode area other AROU x x [x] T-concave ARS x x T-concave CEXT wrapper for external generator CSTD build-in standard distribution HINV [x] [x] x HRB bounded hazard rate HRD decreasing hazard rate HRI increasing hazard rate ITDR x x x monotone with pole NINV [x] x NROU x [x] PINV x [x] [~] SROU x x x T-concave SSR x x x T-concave TABL x x [~] all local extrema TDR x x T-concave UTDR x x ~ T-concave Example ------- /* ------------------------------------------------------------- */ /* File: example_cont.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* Example how to sample from a continuous univariate */ /* distribution. */ /* */ /* We build a distribution object from scratch and sample. */ /* ------------------------------------------------------------- */ /* Define the PDF and dPDF of our distribution. */ /* */ /* Our distribution has the PDF */ /* */ /* / 1 - x*x if |x| <= 1 */ /* f(x) = < */ /* \ 0 otherwise */ /* */ /* The PDF of our distribution: */ double mypdf( double x, const UNUR_DISTR *distr ) /* The second argument (`distr') can be used for parameters */ /* for the PDF. (We do not use parameters in our example.) */ { if (fabs(x) >= 1.) return 0.; else return (1.-x*x); } /* end of mypdf() */ /* The derivative of the PDF of our distribution: */ double mydpdf( double x, const UNUR_DISTR *distr ) { if (fabs(x) >= 1.) return 0.; else return (-2.*x); } /* end of mydpdf() */ /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; /* will hold the random number */ /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Create a new distribution object from scratch. */ /* Get empty distribution object for a continuous distribution */ distr = unur_distr_cont_new(); /* Fill the distribution object -- the provided information */ /* must fulfill the requirements of the method choosen below. */ unur_distr_cont_set_pdf(distr, mypdf); /* PDF */ unur_distr_cont_set_dpdf(distr, mydpdf); /* its derivative */ unur_distr_cont_set_mode(distr, 0.); /* mode */ unur_distr_cont_set_domain(distr, -1., 1.); /* domain */ /* Choose a method: TDR. */ par = unur_tdr_new(distr); /* Set some parameters of the method TDR. */ unur_tdr_set_variant_gw(par); unur_tdr_set_max_sqhratio(par, 0.90); unur_tdr_set_c(par, -0.5); unur_tdr_set_max_intervals(par, 100); unur_tdr_set_cpoints(par, 10, NULL); /* Create the generator object. */ gen = unur_init(par); /* Notice that this call has also destroyed the parameter */ /* object `par' as a side effect. */ /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ Example (String API) -------------------- /* ------------------------------------------------------------- */ /* File: example_cont_str.c */ /* ------------------------------------------------------------- */ /* String API. */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* Example how to sample from a continuous univariate */ /* distribution. */ /* We use a generic distribution object and sample. */ /* */ /* The PDF of our distribution is given by */ /* */ /* / 1 - x*x if |x| <= 1 */ /* f(x) = < */ /* \ 0 otherwise */ /* */ /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; /* will hold the random number */ /* Declare UNURAN generator object. */ UNUR_GEN *gen; /* generator object */ /* Create the generator object. */ /* Use a generic continuous distribution. */ /* Choose a method: TDR. */ gen = unur_str2gen( "distr = cont; pdf=\"1-x*x\"; domain=(-1,1); mode=0. & \ method=tdr; variant_gw; max_sqhratio=0.90; c=-0.5; \ max_intervals=100; cpoints=10"); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */  File: unuran.info, Node: AROU, Next: ARS, Up: Methods_for_CONT 5.3.1 AROU – Automatic Ratio-Of-Uniforms method ----------------------------------------------- Required: T-concave PDF, dPDF Optional: mode Speed: Set-up: slow, Sampling: fast Reinit: not implemented Reference: [LJa00] AROU is a variant of the ratio-of-uniforms method that uses the fact that the transformed region is convex for many distributions. It works for all T-concave distributions with T(x) = -1/sqrt(x). It is possible to use this method for correlation induction by setting an auxiliary uniform random number generator via the ‘unur_set_urng_aux’ call. (Notice that this must be done after a possible ‘unur_set_urng’ call.) When an auxiliary generator is used then the number of used uniform random numbers that is used up for one generated random variate is constant and equal to 1. There exists a test mode that verifies whether the conditions for the method are satisfied or not while sampling. It can be switched on by calling ‘unur_arou_set_verify’ and ‘unur_arou_chg_verify’, respectively. Notice however that sampling is (much) slower then. For densities with modes not close to 0 it is suggested to set either the mode or the center of the distribution by the ‘unur_distr_cont_set_mode’ or ‘unur_distr_cont_set_center’ call. The latter is the approximate location of the mode or the mean of the distribution. This location provides some information about the main part of the PDF and is used to avoid numerical problems. Function reference ------------------ -- Function: UNUR_PAR* unur_arou_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_arou_set_usedars (UNUR_PAR* PARAMETERS, int USEDARS) If USEDARS is set to ‘TRUE’, “derandomized adaptive rejection sampling†(DARS) is used in setup. Segments where the area between hat and squeeze is too large compared to the average area between hat and squeeze over all intervals are split. This procedure is repeated until the ratio between area below squeeze and area below hat exceeds the bound given by ‘unur_arou_set_max_sqhratio’ call or the maximum number of segments is reached. Moreover, it also aborts when no more segments can be found for splitting. Segments are split such that the angle of the segments are halved (corresponds to arc-mean rule of method TDR (*note TDR::)). Default is ‘TRUE’. -- Function: int unur_arou_set_darsfactor (UNUR_PAR* PARAMETERS, double FACTOR) Set factor for “derandomized adaptive rejection samplingâ€. This factor is used to determine the segments that are “too largeâ€, that is, all segments where the area between squeeze and hat is larger than FACTOR times the average area over all intervals between squeeze and hat. Notice that all segments are split when FACTOR is set to ‘0.’, and that there is no splitting at all when FACTOR is set to ‘UNUR_INFINITY’. Default is ‘0.99’. There is no need to change this parameter. -- Function: int unur_arou_set_max_sqhratio (UNUR_PAR* PARAMETERS, double MAX_RATIO) Set upper bound for the ratio (area inside squeeze) / (area inside envelope). It must be a number between 0 and 1. When the ratio exceeds the given number no further construction points are inserted via adaptive rejection sampling. Use ‘0’ if no construction points should be added after the setup. Use ‘1’ if adding new construction points should not be stopped until the maximum number of construction points is reached. Default is ‘0.99’. -- Function: double unur_arou_get_sqhratio (const UNUR_GEN* GENERATOR) Get the current ratio (area inside squeeze) / (area inside envelope) for the generator. (In case of an error ‘UNUR_INFINITY’ is returned.) -- Function: double unur_arou_get_hatarea (const UNUR_GEN* GENERATOR) Get the area below the hat for the generator. (In case of an error ‘UNUR_INFINITY’ is returned.) -- Function: double unur_arou_get_squeezearea (const UNUR_GEN* GENERATOR) Get the area below the squeeze for the generator. (In case of an error ‘UNUR_INFINITY’ is returned.) -- Function: int unur_arou_set_max_segments (UNUR_PAR* PARAMETERS, int MAX_SEGS) Set maximum number of segements. No construction points are added _after_ the setup when the number of segments succeeds MAX_SEGS. Default is ‘100’. -- Function: int unur_arou_set_cpoints (UNUR_PAR* PARAMETERS, int N_STP, const DOUBLE* STP) Set construction points for enveloping polygon. If STP is ‘NULL’, then a heuristical rule of thumb is used to get N_STP construction points. This is the default behavior when this routine is not called. The (default) number of construction points is ‘30’, then. -- Function: int unur_arou_set_usecenter (UNUR_PAR* PARAMETERS, int USECENTER) Use the center as construction point. Default is ‘TRUE’. -- Function: int unur_arou_set_guidefactor (UNUR_PAR* PARAMETERS, double FACTOR) Set factor for relative size of the guide table for indexed search (see also method DGT *note DGT::). It must be greater than or equal to ‘0’. When set to ‘0’, then sequential search is used. Default is ‘2’. -- Function: int unur_arou_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) -- Function: int unur_arou_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) Turn verifying of algorithm while sampling on/off. If the condition squeeze(x) <= PDF(x) <= hat(x) is violated for some x then ‘unur_errno’ is set to ‘UNUR_ERR_GEN_CONDITION’. However notice that this might happen due to round-off errors for a few values of x (less than 1%). Default is ‘FALSE’. -- Function: int unur_arou_set_pedantic (UNUR_PAR* PARAMETERS, int PEDANTIC) Sometimes it might happen that ‘unur_init’ has been executed successfully. But when additional construction points are added by adaptive rejection sampling, the algorithm detects that the PDF is not T-concave. With PEDANTIC being ‘TRUE’, the sampling routine is then exchanged by a routine that simply returns ‘UNUR_INFINITY’. Otherwise the new point is not added to the list of construction points. At least the hat function remains T-concave. Setting PEDANTIC to ‘FALSE’ allows sampling from a distribution which is “almost†T-concave and small errors are tolerated. However it might happen that the hat function cannot be improved significantly. When the hat function that has been constructed by the ‘unur_init’ call is extremely large then it might happen that the generation times are extremely high (even hours are possible in extremely rare cases). Default is ‘FALSE’.  File: unuran.info, Node: ARS, Next: CEXT, Prev: AROU, Up: Methods_for_CONT 5.3.2 ARS – Adaptive Rejection Sampling --------------------------------------- Required: concave logPDF, derivative of logPDF Optional: mode Speed: Set-up: fast, Sampling: slow Reinit: supported Reference: [GWa92] [HLD04: Cha.4] ARS is an acceptance/rejection method that uses the concavity of the log-density function to construct hat function and squeezes automatically. It is very similar to method TDR (*note TDR::) with variant GW, parameter ‘c = 0’, and DARS switched off. Moreover, method ARS requires the logPDF and its derivative dlogPDF to run. On the other hand, it is designed to draw only a (very) small samples and it is much more robust against densities with very large or small areas below the PDF as it occurs, for example, in conditional distributions of (high dimensional) multivariate distributions. Additionally, it can be re-initialized when the underlying distribution has been modified. Thus it is well suited for Gibbs sampling. Notice, that method ARS is a restricted version of TDR. If the full functionally of Transformed Density Rejection is needed use method *note TDR::. How To Use .......... Method ARS is designed for distributions with log-concave densities. To use this method you need a distribution object with the logarithm of the PDF and its derivative given. The number of construction points as well as a set of such points can be provided using ‘unur_ars_set_cpoints’. Notice that addition construction points are added by means of adaptive rejection sampling until the maximal number of intervals given by ‘unur_ars_set_max_intervals’ is reached. A generated distribution object can be reinitialized using the ‘unur_reinit’ call. When ‘unur_reinit’ is called construction points for the new generator are necessary. There are two options: Either the same construction points as for the initial generator (given by a ‘unur_ars_set_cpoints’ call) are used (this is the default), or percentiles of the old hat function can be used. This can be set or changed using ‘unur_ars_set_reinit_percentiles’ and ‘unur_ars_chg_reinit_percentiles’. This feature is usefull when the underlying distribution object is only moderately changed. (An example is Gibbs sampling with small correlations.) There exists a test mode that verifies whether the conditions for the method are satisfied or not. It can be switched on by calling ‘unur_ars_set_verify’ and ‘unur_ars_chg_verify’, respectively. Notice however that sampling is (much) slower then. Method ARS aborts after a given number of iterations and return UNUR_INFINITY to prevent (almost) infinite loops. This might happen when the starting hat is much too large and it is not possible to insert new construction points due to severe numerical errors or (more likely) the given PDF is not log-concave. This maximum number of iterations can be set by means of a ‘unur_ars_set_max_iter’ call. Function reference ------------------ -- Function: UNUR_PAR* unur_ars_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_ars_set_max_intervals (UNUR_PAR* PARAMETERS, int MAX_IVS) Set maximum number of intervals. No construction points are added after the setup when the number of intervals suceeds MAX_IVS. It is increased automatically to twice the number of construction points if this is larger. Default is ‘200’. -- Function: int unur_ars_set_cpoints (UNUR_PAR* PARAMETERS, int N_CPOINTS, const DOUBLE* CPOINTS) Set construction points for the hat function. If CPOINTS is ‘NULL’ then a heuristic rule of thumb is used to get N_CPOINTS construction points. This is the default behavior. N_CPOINTS should be at least ‘2’, otherwise defaults are used. The default number of construction points is 2. -- Function: int unur_ars_set_reinit_percentiles (UNUR_PAR* PARAMETERS, int N_PERCENTILES, const DOUBLE* PERCENTILES) -- Function: int unur_ars_chg_reinit_percentiles (UNUR_GEN* GENERATOR, int N_PERCENTILES, const DOUBLE* PERCENTILES) By default, when the GENERATOR object is reinitialized, it used the same construction points as for the initialization procedure. Often the underlying distribution object has been changed only moderately. For example, the full conditional distribution of a multivariate distribution. In this case it might be more appropriate to use percentilesm of the hat function for the last (unchanged) distribution. PERCENTILES must then be a pointer to an ordered array of numbers between ‘0.01’ and ‘0.99’. If PERCENTILES is ‘NULL’, then a heuristic rule of thumb is used to get N_PERCENTILES values for these percentiles. Notice that N_PERCENTILES must be at least ‘2’, otherwise defaults are used. (Then the first and third quartiles are used by default.) -- Function: int unur_ars_set_reinit_ncpoints (UNUR_PAR* PARAMETERS, int NCPOINTS) -- Function: int unur_ars_chg_reinit_ncpoints (UNUR_GEN* GENERATOR, int NCPOINTS) When reinit fails with the given construction points or the percentiles of the old hat function, another trial is undertaken with NCPOINTS construction points. NCPOINTS must be at least ‘10’. Default: ‘30’ -- Function: int unur_ars_set_max_iter (UNUR_PAR* PARAMETERS, int MAX_ITER) The rejection loop stops after MAX_ITER iterations and return UNUR_INFINITY. Default: ‘10000’ -- Function: int unur_ars_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) -- Function: int unur_ars_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) Turn verifying of algorithm while sampling on/off. If the condition squeeze(x) <= PDF(x) <= hat(x) is violated for some x then ‘unur_errno’ is set to ‘UNUR_ERR_GEN_CONDITION’. However notice that this might happen due to round-off errors for a few values of x (less than 1%). Default is ‘FALSE’. -- Function: int unur_ars_set_pedantic (UNUR_PAR* PARAMETERS, int PEDANTIC) Sometimes it might happen that ‘unur_init’ has been executed successfully. But when additional construction points are added by adaptive rejection sampling, the algorithm detects that the PDF is not log-concave. With PEDANTIC being ‘TRUE’, the sampling routine is exchanged by a routine that simply returns ‘UNUR_INFINITY’. Otherwise the new point is not added to the list of construction points. At least the hat function remains log-concave. Setting PEDANTIC to ‘FALSE’ allows sampling from a distribution which is “almost†log-concave and small errors are tolerated. However it might happen that the hat function cannot be improved significantly. When the hat functions that has been constructed by the ‘unur_init’ call is extremely large then it might happen that the generation times are extremely high (even hours are possible in extremely rare cases). Default is ‘FALSE’. -- Function: double unur_ars_get_loghatarea (const UNUR_GEN* GENERATOR) Get the logarithm of area below the hat for the generator. (In case of an error ‘UNUR_INFINITY’ is returned.) -- Function: double unur_ars_eval_invcdfhat (const UNUR_GEN* GENERATOR, double U) Evaluate the inverse of the CDF of the hat distribution at U. If U is out of the domain [0,1] then ‘unur_errno’ is set to ‘UNUR_ERR_DOMAIN’ and the respective bound of the domain of the distribution are returned (which is ‘-UNUR_INFINITY’ or ‘UNUR_INFINITY’ in the case of unbounded domains).  File: unuran.info, Node: CEXT, Next: CSTD, Prev: ARS, Up: Methods_for_CONT 5.3.3 CEXT – wrapper for Continuous EXTernal generators ------------------------------------------------------- Required: routine for sampling continuous random variates Speed: depends on external generator Reinit: supported Method CEXT is a wrapper for external generators for continuous univariate distributions. It allows the usage of external random variate generators within the UNU.RAN framework. How To Use .......... The following steps are required to use some external generator within the UNU.RAN framework (some of these are optional): 1. Make an empty generator object using a ‘unur_cext_new’ call. The argument DISTRIBUTION is optional and can be replaced by ‘NULL’. However, it is required if you want to pass parameters of the generated distribution to the external generator or for running some validation tests provided by UNU.RAN. 2. Create an initialization routine of type ‘int (*init)(UNUR_GEN *gen)’ and plug it into the generator object using the ‘unur_cext_set_init’ call. Notice that the INIT routine must return ‘UNUR_SUCCESS’ when it has been executed successfully and ‘UNUR_FAILURE’ otherwise. It is possible to get the size of and the pointer to the array of parameters of the underlying distribution object by the respective calls ‘unur_cext_get_ndistrparams’ and ‘unur_cext_get_distrparams’. Parameters for the external generator that are computed in the INIT routine can be stored in a single array or structure which is available by the ‘unur_cext_get_params’ call. Using an INIT routine is optional and can be omitted. 3. Create a sampling routine of type ‘double (*sample)(UNUR_GEN *gen)’ and plug it into the generator object using the ‘unur_cext_set_sample’ call. Uniform random numbers are provided by the ‘unur_sample_urng’ call. Do not use your own implementation of a uniform random number generator directly. If you want to use your own random number generator we recommend to use the UNU.RAN interface (see *note Using uniform random number generators: URNG.). The array or structure that contains parameters for the external generator that are computed in the INIT routine are available using the ‘unur_cext_get_params’ call. Using a SAMPLE routine is of course obligatory. It is possible to change the parameters and the domain of the chosen distribution and run ‘unur_reinit’ to reinitialize the generator object. The INIT routine is then called again. Here is a short example that demonstrates the application of this method by means of the exponential distribution: /* ------------------------------------------------------------- */ /* File: example_cext.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* This example shows how an external generator for the */ /* exponential distribution with one scale parameter can be */ /* used within the UNURAN framework. */ /* */ /* Notice, that this example does not provide the simplest */ /* solution. */ /* ------------------------------------------------------------- */ /* Initialization routine. */ /* */ /* Here we simply read the scale parameter of the exponential */ /* distribution and store it in an array for parameters of */ /* the external generator. */ /* [ Of course we could do this in the sampling routine as */ /* and avoid the necessity of this initialization routine. ] */ int exponential_init (UNUR_GEN *gen) { /* Get pointer to parameters of exponential distribution */ double *params = unur_cext_get_distrparams(gen); /* The scale parameter is the first entry (see manual) */ double lambda = (params) ? params[0] : 1.; /* Get array to store this parameter for external generator */ double *genpar = unur_cext_get_params(gen, sizeof(double)); genpar[0] = lambda; /* Executed successfully */ return UNUR_SUCCESS; } /* ------------------------------------------------------------- */ /* Sampling routine. */ /* */ /* Contains the code for the external generator. */ double exponential_sample (UNUR_GEN *gen) { /* Get scale parameter */ double *genpar = unur_cext_get_params(gen,0); double lambda = genpar[0]; /* Sample a uniformly distributed random number */ double U = unur_sample_urng(gen); /* Transform into exponentially distributed random variate */ return ( -log(1. - U) * lambda ); } /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; /* will hold the random number */ /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Use predefined exponential distribution with scale param. 2 */ double fpar[1] = { 2. }; distr = unur_distr_exponential(fpar, 1); /* Use method CEXT */ par = unur_cext_new(distr); /* Set initialization and sampling routines. */ unur_cext_set_init(par, exponential_init); unur_cext_set_sample(par, exponential_sample); /* Create the generator object. */ gen = unur_init(par); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the standard Gaussian distribution. */ /* Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ Function reference ------------------ -- Function: UNUR_PAR* unur_cext_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for new generator. -- Function: int unur_cext_set_init (UNUR_PAR* PARAMETERS, int (* INIT)(UNUR_GEN* gen )) Set initialization routine for external generator. Inside the _Important:_ The routine INIT must return ‘UNUR_SUCCESS’ when the generator was initialized successfully and ‘UNUR_FAILURE’ otherwise. Parameters that are computed in the INIT routine can be stored in an array or structure that is avaiable by means of the ‘unur_cext_get_params’ call. Parameters of the underlying distribution object can be obtained by the ‘unur_cext_get_distrparams’ call. -- Function: int unur_cext_set_sample (UNUR_PAR* PARAMETERS, double (* SAMPLE)(UNUR_GEN* gen )) Set sampling routine for external generator. _Important:_ Use ‘unur_sample_urng(gen)’ to get a uniform random number. The pointer to the array or structure that contains the parameters that are precomputed in the INIT routine are available by ‘unur_cext_get_params(gen,0)’. Additionally one can use the ‘unur_cext_get_distrparams’ call. -- Function: void* unur_cext_get_params (UNUR_GEN* GENERATOR, size_t SIZE) Get pointer to memory block for storing parameters of external generator. A memory block of size SIZE is automatically (re-) allocated if necessary and the pointer to this block is stored in the GENERATOR object. If one only needs the pointer to this memory block set SIZE to ‘0’. Notice, that SIZE is the size of the memory block and not the length of an array. _Important:_ This rountine should only be used in the initialization and sampling routine of the external generator. -- Function: double* unur_cext_get_distrparams (UNUR_GEN* GENERATOR) -- Function: int unur_cext_get_ndistrparams (UNUR_GEN* GENERATOR) Get size of and pointer to array of parameters of underlying distribution in GENERATOR object. _Important:_ These rountines should only be used in the initialization and sampling routine of the external generator.  File: unuran.info, Node: CSTD, Next: HINV, Prev: CEXT, Up: Methods_for_CONT 5.3.4 CSTD – Continuous STandarD distributions ---------------------------------------------- Required: standard distribution from UNU.RAN library (*note Standard distributions: Stddist.) or continuous distribution with inverse CDF. Speed: Set-up: fast, Sampling: depends on distribution and generator Reinit: supported CSTD is a wrapper for special generators for continuous univariate standard distributions. It only works for distributions in the UNU.RAN library of standard distributions (*note Standard distributions: Stddist.) or for continuous distributions where the inverse CDF is given. If a distribution object is provided that is build from scratch, it must provide the inverse CDF. Then CSTD implements the inversion method. Otherwise, the ‘NULL’ pointer is returned. For some distributions more than one special generator is possible. How To Use .......... Create a distribution object for a standard distribution from the UNU.RAN library (*note Standard distributions: Stddist.), or create a continuous distribution object and set the function for the inverse CDF using ‘unur_distr_cont_set_invcdf’. For some distributions more than one special generator (_variants_) is possible. These can be choosen by a ‘unur_cstd_set_variant’ call. For possible variants *note Standard distributions: Stddist. However the following are common to all distributions: ‘UNUR_STDGEN_DEFAULT’ the default generator. ‘UNUR_STDGEN_FAST’ the fastest available special generator. ‘UNUR_STDGEN_INVERSION’ the inversion method (if available). Notice that the variant ‘UNUR_STDGEN_FAST’ for a special generator may be slower than one of the universal algorithms! Additional variants may exist for particular distributions. Sampling from truncated distributions (which can be constructed by changing the default domain of a distribution by means of ‘unur_distr_cont_set_domain’ or ‘unur_cstd_chg_truncated’ calls) is possible but requires the inversion method. Moreover the CDF of the distribution must be implemented. It is possible to change the parameters and the domain of the chosen distribution and run ‘unur_reinit’ to reinitialize the generator object. Function reference ------------------ -- Function: UNUR_PAR* unur_cstd_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for new generator. It requires a distribution object for a continuous univariant distribution from the UNU.RAN library of standard distributions (*note Standard distributions: Stddist.). Using a truncated distribution is allowed only if the inversion method is available and selected by the ‘unur_cstd_set_variant’ call immediately after creating the parameter object. Use a ‘unur_distr_cont_set_domain’ call to get a truncated distribution. To change the domain of a (truncated) distribution of a generator use the ‘unur_cstd_chg_truncated’ call. -- Function: int unur_cstd_set_variant (UNUR_PAR* PARAMETERS, unsigned VARIANT) Set variant (special generator) for sampling from a given distribution. For possible variants *note Standard distributions: Stddist. Common variants are ‘UNUR_STDGEN_DEFAULT’ for the default generator, ‘UNUR_STDGEN_FAST’ for (one of the) fastest implemented special generators, and ‘UNUR_STDGEN_INVERSION’ for the inversion method (if available). If the selected variant number is not implemented, then an error code is returned and the variant is not changed. -- Function: int unur_cstd_chg_truncated (UNUR_GEN* GENERATOR, double LEFT, double RIGHT) Change left and right border of the domain of the (truncated) distribution. This is only possible if the inversion method is used. Otherwise this call has no effect and an error code is returned. Notice that the given truncated domain must be a subset of the domain of the given distribution. The generator always uses the intersection of the domain of the distribution and the truncated domain given by this call. It is not required to run ‘unur_reinit’ after this call has been used. _Important:_ If the CDF is (almost) the same for LEFT and RIGHT and (almost) equal to ‘0’ or ‘1’, then the truncated domain is not chanced and the call returns an error code. _Notice:_ If the parameters of the distribution has been changed it is recommended to set the truncated domain again, since the former call might change the domain of the distribution but not update the values for the boundaries of the truncated distribution.  File: unuran.info, Node: HINV, Next: HRB, Prev: CSTD, Up: Methods_for_CONT 5.3.5 HINV – Hermite interpolation based INVersion of CDF --------------------------------------------------------- Required: CDF Optional: PDF, dPDF Speed: Set-up: (very) slow, Sampling: (very) fast Reinit: supported Reference: [HLa03] [HLD04: Sect.7.2; Alg.7.1] HINV is a variant of numerical inversion, where the inverse CDF is approximated using Hermite interpolation, i.e., the interval [0,1] is split into several intervals and in each interval the inverse CDF is approximated by polynomials constructed by means of values of the CDF and PDF at interval boundaries. This makes it possible to improve the accuracy by splitting a particular interval without recomputations in unaffected intervals. Three types of splines are implemented: linear, cubic, and quintic interpolation. For linear interpolation only the CDF is required. Cubic interpolation also requires PDF and quintic interpolation PDF and its derivative. These splines have to be computed in a setup step. However, it only works for distributions with bounded domain; for distributions with unbounded domain the tails are chopped off such that the probability for the tail regions is small compared to the given u-resolution. The method is not exact, as it only produces random variates of the approximated distribution. Nevertheless, the maximal numerical error in "u-direction" (i.e. |U-CDF(X)|, for X = "approximate inverse CDF"(U) |U-CDF(X)|) can be set to the required resolution (within machine precision). Notice that very small values of the u-resolution are possible but may increase the cost for the setup step. As the possible maximal error is only estimated in the setup it may be necessary to set some special design points for computing the Hermite interpolation to guarantee that the maximal u-error can not be bigger than desired. Such points are points where the density is not differentiable or has a local extremum. Notice that there is no necessity to do so. However, if you do not provide these points to the algorithm there might be a small chance that the approximation error is larger than the given u-resolution, or that the required number of intervals is larger than necessary. How To Use .......... HINV works for continuous univariate distribution objects with given CDF and (optional) PDF. It uses Hermite interpolation of order 1, 3 [default] or 5. The order can be set by means of ‘unur_hinv_set_order’. For distributions with unbounded domains the tails are chopped off such that the probability for the tail regions is small compared to the given u-resulution. For finding these cut points the algorithm starts with the region ‘[-1.e20,1.e20]’. For the exceptional case where this might be too small (or one knows this region and wants to avoid this search heuristics) it can be directly set via a ‘unur_hinv_set_boundary’ call. It is possible to use this method for generating from truncated distributions. It even can be changed for an existing generator object by an ‘unur_hinv_chg_truncated’ call. This method is not exact, as it only produces random variates of the approximated distribution. Nevertheless, the numerical error in "u-direction" (i.e. |U-CDF(X)|, for X = "approximate inverse CDF"(U) |U-CDF(X)|) can be controlled by means of ‘unur_hinv_set_u_resolution’. The possible maximal error is only estimated in the setup. Thus it might be necessary to set some special design points for computing the Hermite interpolation to guarantee that the maximal u-error can not be bigger than desired. Such points (e.g. extremal points of the PDF, points with infinite derivative) can be set using using the ‘unur_hinv_set_cpoints’ call. If the mode for a unimodal distribution is set in the distribution object this mode is automatically used as design-point if the ‘unur_hinv_set_cpoints’ call is not used. As already mentioned the maximal error of this approximation is only estimated. If this error is crucial for an application we recommend to compute this error using ‘unur_hinv_estimate_error’ which runs a small Monte Carlo simulation. It is possible to change the parameters and the domain of the chosen distribution and run ‘unur_reinit’ to reinitialize the generator object. The values given by the last ‘unur_hinv_chg_truncated’ call will be then changed to the values of the domain of the underlying distribution object. Moreover, starting construction points (nodes) that are given by a ‘unur_hinv_set_cpoints’ call are ignored when ‘unur_reinit’ is called. It is important to note that for a distribution from the UNU.RAN library of standard distributions (*note Standard distributions: Stddist.) the normalization constant has to be updated using the ‘unur_distr_cont_upd_pdfarea’ call whenever its parameters have been changed by means of a ‘unur_distr_cont_set_pdfparams’ call. Function reference ------------------ -- Function: UNUR_PAR* unur_hinv_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_hinv_set_order (UNUR_PAR* PARAMETERS, int ORDER) Set order of Hermite interpolation. Valid orders are ‘1’, ‘3’, and ‘5’. Notice that ORDER greater than ‘1’ requires the density of the distribution, and ORDER greater than ‘3’ even requires the derivative of the density. Using ORDER ‘1’ results for most distributions in a huge number of intervals and is therefore not recommended. If the maximal error in u-direction is very small (say smaller than ‘1.e-10’), ORDER ‘5’ is recommended as it leads to considerably fewer design points, as long there are no poles or heavy tails. _Remark:_ When the target distribution has poles or (very) heavy tails ORDER ‘5’ (i.e., quintic interpolation) is numerically less stable and more sensitive to round-off errors than ORDER ‘3’ (i.e., cubic interpolation). Default is ‘3’ if the density is given and ‘1’ otherwise. -- Function: int unur_hinv_set_u_resolution (UNUR_PAR* PARAMETERS, double U_RESOLUTION) Set maximal error in u-direction. However, the given u-error must not be smaller than machine epsilon (‘DBL_EPSILON’) and should not be too close to this value. As the resolution of most uniform random number sources is 2^(-32) = ‘2.3e-10’, a value of ‘1.e-10’ leads to an inversion algorithm that could be called exact. For most simulations slightly bigger values for the maximal error are enough as well. Remark: The u-error might become larger than U_RESOLUTION due to rescaling of floating point numbers when the domain of the distribution is truncated by a ‘unur_hinv_chg_truncated’ call. Default is ‘1.e-10’. -- Function: int unur_hinv_set_cpoints (UNUR_PAR* PARAMETERS, const DOUBLE* STP, int N_STP) Set starting construction points (nodes) for Hermite interpolation. As the possible maximal error is only estimated in the setup it may be necessary to set some special design points for computing the Hermite interpolation to guarantee that the maximal u-error can not be bigger than desired. We suggest to include as special design points all local extrema of the density, all points where the density is not differentiable, and isolated points inside of the domain with density 0. If there is an interval with density constant equal to 0 inside of the given domain of the density, both endpoints of this interval should be included as special design points. Notice that there is no necessity to do so. However, if these points are not provided to the algorithm the approximation error might be larger than the given u-resolution, or the required number of intervals could be larger than necessary. _Important_: Notice that the given points must be in increasing order and they must be disjoint. _Important_: The boundary point of the computational region must not be given in this list! Points outside the boundary of the computational region are ignored. Default is for unimodal densities - if known - the mode of the density, if it is not equal to the border of the domain. -- Function: int unur_hinv_set_boundary (UNUR_PAR* PARAMETERS, double LEFT, double RIGHT) Set the left and right boundary of the computational interval. Of course ‘+/- UNUR_INFINITY’ is not allowed. If the CDF at LEFT and RIGHT is not close to the respective values ‘0.’ and ‘1.’ then this interval is increased by a (rather slow) search algorithm. _Important_: This call does not change the domain of the given distribution itself. But it restricts the domain for the resulting random variates. Default is ‘1.e20’. -- Function: int unur_hinv_set_guidefactor (UNUR_PAR* PARAMETERS, double FACTOR) Set factor for relative size of the guide table for indexed search (see also method DGT *note DGT::). It must be greater than or equal to ‘0’. When set to ‘0’, then sequential search is used. Default is ‘1’. -- Function: int unur_hinv_set_max_intervals (UNUR_PAR* PARAMETERS, int MAX_IVS) Set maximum number of intervals. No generator object is created if the necessary number of intervals for the Hermite interpolation exceeds MAX_IVS. It is used to prevent the algorithm to eat up all memory for very badly shaped CDFs. Default is ‘1000000’ (1.e6). -- Function: int unur_hinv_get_n_intervals (const UNUR_GEN* GENERATOR) Get number of nodes (design points) used for Hermite interpolation in the generator object. The number of intervals is the number of nodes minus 1. It returns an error code in case of an error. -- Function: double unur_hinv_eval_approxinvcdf (const UNUR_GEN* GENERATOR, double U) Evaluate Hermite interpolation of inverse CDF at U. If U is out of the domain [0,1] then ‘unur_errno’ is set to ‘UNUR_ERR_DOMAIN’ and the respective bound of the domain of the distribution are returned (which is ‘-UNUR_INFINITY’ or ‘UNUR_INFINITY’ in the case of unbounded domains). _Notice_: When the domain has been truncated by a ‘unur_hinv_chg_truncated’ call then the inverse CDF of the truncated distribution is returned. -- Function: int unur_hinv_chg_truncated (UNUR_GEN* GENERATOR, double LEFT, double RIGHT) Changes the borders of the domain of the (truncated) distribution. Notice that the given truncated domain must be a subset of the domain of the given distribution. The generator always uses the intersection of the domain of the distribution and the truncated domain given by this call. The tables of splines are not recomputed. Thus it might happen that the relative error for the generated variates from the truncated distribution is greater than the bound for the non-truncated distribution. This call also fails when the CDF values of the boundary points are too close, i.e. when only a few different floating point numbers would be computed due to round-off errors with floating point arithmetic. Remark: The u-error might become larger than the U_RESOLUTION given by a ‘unur_hinv_set_u_resolution’ call due to rescaling of floating point numbers when the domain of the distribution is truncated. When failed an error code is returned. _Important_: Always check the return code since the domain is not changed in case of an error. -- Function: int unur_hinv_estimate_error (const UNUR_GEN* GENERATOR, int SAMPLESIZE, double* MAX_ERROR, double* MAE) Estimate maximal u-error and mean absolute error (MAE) for GENERATOR by means of a (quasi-) Monte-Carlo simulation with sample size SAMPLESIZE. The results are stored in MAX_ERROR and MAE, respectively. It returns ‘UNUR_SUCCESS’ if successful.  File: unuran.info, Node: HRB, Next: HRD, Prev: HINV, Up: Methods_for_CONT 5.3.6 HRB – Hazard Rate Bounded ------------------------------- Required: bounded hazard rate Optional: upper bound for hazard rate Speed: Set-up: fast, Sampling: slow Reinit: supported Reference: [HLD04: Sect.9.1.4; Alg.9.4] Generates random variate with given hazard rate which must be bounded from above. It uses the thinning method with a constant dominating hazard function. How To Use .......... HRB requires a hazard function for a continuous distribution together with an upper bound. The latter has to be set using the ‘unur_hrb_set_upperbound’ call. If no such upper bound is given it is assumed that the upper bound can be achieved by evaluating the hazard rate at the left hand boundary of the domain of the distribution. Notice, however, that for decreasing hazard rate the method HRD (*note Hazard Rate Decreasing: HRD.) is much faster and thus the prefered method. It is important to note that the domain of the distribution can be set via a ‘unur_distr_cont_set_domain’ call. However, the left border must not be negative. Otherwise it is set to ‘0’. This is also the default if no domain is given at all. For computational reasons the right border is always set to ‘UNUR_INFINITY’ independently of the given domain. Thus for domains bounded from right the function for computing the hazard rate should return ‘UNUR_INFINITY’ right of this domain. For distributions with increasing hazard rate method HRI (*note Hazard Rate Increasing: HRI.) is required. It is possible to change the parameters and the domain of the chosen distribution and run ‘unur_reinit’ to reinitialize the generator object. Notice, that the upper bound given by the ‘unur_hrb_set_upperbound’ call cannot be changed and must be valid for the changed distribution. Function reference ------------------ -- Function: UNUR_PAR* unur_hrb_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_hrb_set_upperbound (UNUR_PAR* PARAMETERS, double UPPERBOUND) Set upper bound for hazard rate. If this call is not used it is assumed that the the maximum of the hazard rate is achieved at the left hand boundary of the domain of the distribution. -- Function: int unur_hrb_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) -- Function: int unur_hrb_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) Turn verifying of algorithm while sampling on/off. If the hazard rate is not bounded by the given bound, then ‘unur_errno’ is set to ‘UNUR_ERR_GEN_CONDITION’. Default is ‘FALSE’.  File: unuran.info, Node: HRD, Next: HRI, Prev: HRB, Up: Methods_for_CONT 5.3.7 HRD – Hazard Rate Decreasing ---------------------------------- Required: decreasing (non-increasing) hazard rate Speed: Set-up: fast, Sampling: slow Reinit: supported Reference: [HLD04: Sect.9.1.5; Alg.9.5] Generates random variate with given non-increasing hazard rate. It is necessary that the distribution object contains this hazard rate. Decreasing hazard rate implies that the corresponding PDF of the distribution has heavier tails than the exponential distribution (which has constant hazard rate). How To Use .......... HRD requires a hazard function for a continuous distribution with non-increasing hazard rate. There are no parameters for this method. It is important to note that the domain of the distribution can be set via a ‘unur_distr_cont_set_domain’ call. However, only the left hand boundary is used. For computational reasons the right hand boundary is always reset to ‘UNUR_INFINITY’. If no domain is given by the user then the left hand boundary is set to ‘0’. For distributions which do not have decreasing hazard rates but are bounded from above use method HRB (*note Hazard Rate Bounded: HRB.). For distributions with increasing hazard rate method HRI (*note Hazard Rate Increasing: HRI.) is required. It is possible to change the parameters and the domain of the chosen distribution and run ‘unur_reinit’ to reinitialize the generator object. Function reference ------------------ -- Function: UNUR_PAR* unur_hrd_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_hrd_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) -- Function: int unur_hrd_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) Turn verifying of algorithm while sampling on/off. If the hazard rate is not bounded by the given bound, then ‘unur_errno’ is set to ‘UNUR_ERR_GEN_CONDITION’. Default is ‘FALSE’.  File: unuran.info, Node: HRI, Next: ITDR, Prev: HRD, Up: Methods_for_CONT 5.3.8 HRI – Hazard Rate Increasing ---------------------------------- Required: increasing (non-decreasing) hazard rate Speed: Set-up: fast, Sampling: slow Reinit: supported Reference: [HLD04: Sect.9.1.6; Alg.9.6] Generates random variate with given non-increasing hazard rate. It is necessary that the distribution object contains this hazard rate. Increasing hazard rate implies that the corresponding PDF of the distribution has heavier tails than the exponential distribution (which has constant hazard rate). The method uses a decomposition of the hazard rate into a main part which is constant for all x beyond some point p0 and a remaining part. From both of these parts points are sampled using the thinning method and the minimum of both is returned. Sampling from the first part is easier as we have a constant dominating hazard rate. Thus p0 should be large. On the other hand, if p0 is large than the thinning algorithm needs many iteration. Thus the performance of the the algorithm deponds on the choice of p0. We found that values close to the expectation of the generated distribution result in good performance. How To Use .......... HRI requires a hazard function for a continuous distribution with non-decreasing hazard rate. The parameter p0 should be set to a value close to the expectation of the required distribution using ‘unur_hri_set_p0’. If performance is crucial one may try other values as well. It is important to note that the domain of the distribution can be set via a ‘unur_distr_cont_set_domain’ call. However, only the left hand boundary is used. For computational reasons the right hand boundary is always reset to ‘UNUR_INFINITY’. If no domain is given by the user then the left hand boundary is set to ‘0’. For distributions with decreasing hazard rate method HRD (*note Hazard Rate Decreasing: HRI.) is required. For distributions which do not have increasing or decreasing hazard rates but are bounded from above use method HRB (*note Hazard Rate Bounded: HRB.). It is possible to change the parameters and the domain of the chosen distribution and run ‘unur_reinit’ to reinitialize the generator object. Notice, that the upper bound given by the ‘unur_hrb_set_upperbound’ call cannot be changed and must be valid for the changed distribution. Notice that the parameter p0 which has been set by a ‘unur_hri_set_p0’ call cannot be changed and must be valid for the changed distribution. Function reference ------------------ -- Function: UNUR_PAR* unur_hri_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_hri_set_p0 (UNUR_PAR* PARAMETERS, double P0) Set design point for algorithm. It is used to split the domain of the distribution. Values for P0 close to the expectation of the distribution results in a relatively good performance of the algorithm. It is important that the hazard rate at this point must be greater than ‘0’ and less than ‘UNUR_INFINITY’. Default: left boundary of domain + ‘1.’ -- Function: int unur_hri_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) -- Function: int unur_hri_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) Turn verifying of algorithm while sampling on/off. If the hazard rate is not bounded by the given bound, then ‘unur_errno’ is set to ‘UNUR_ERR_GEN_CONDITION’. Default is ‘FALSE’.  File: unuran.info, Node: ITDR, Next: NINV, Prev: HRI, Up: Methods_for_CONT 5.3.9 ITDR – Inverse Transformed Density Rejection -------------------------------------------------- Required: monotone PDF, dPDF, pole Optional: splitting point between pole and tail region, c-values Speed: Set-up: moderate, Sampling: moderate Reinit: supported Reference: [HLDa07] ITDR is an acceptance/rejection method that works for monotone densities. It is especially designed for PDFs with a single pole. It uses different hat functions for the pole region and for the tail region. For the tail region _Transformed Density Rejection_ with a single construction point is used. For the pole region a variant called _Inverse Transformed Density Rejection_ is used. The optimal splitting point between the two regions and the respective maximum local concavity and inverse local concavity (*note Glossary::) that guarantee valid hat functions for each regions are estimated. This splitting point is set to the intersection point of local concavity and inverse local concavity. However, it is assumed that both, the local concavity and the inverse local concavity do not have a local minimum in the interior of the domain (which is the case for all standard distributions with a single pole). In other cases (or when the built-in search routines do not compute non-optimal values) one can provide the splitting point, and the c-values. How To Use .......... Method ITDR requires a distribution object with given PDF and its derivative and the location of the pole (or mode). The PDF must be monotone and may contain a pole. It must be set via the ‘unur_distr_cont_set_pdf’ and ‘unur_distr_cont_set_dpdf’ calls. The PDF should return UNUR_INFINITY for the pole. Alternatively, one can also set the logarithm of the PDF and its derivative via the ‘unur_distr_cont_set_logpdf’ and ‘unur_distr_cont_set_dlogpdf’ calls. This is in especially useful since then the setup and search routines are numerically more stable. Moreover, for many distributions computing the logarithm of the PDF is less expensive then computing the PDF directly. The pole of the distribution is given by a ‘unur_distr_cont_set_mode’ call. Notice that distributions with “heavy†poles may have numerical problems caused by the resultion of the floating point numbers used by computers. While the minimal distance between two different floating point numbers is about ‘1.e-320’ near ‘0.’ it increases to ‘1.e-16’ near ‘1.’ Thus any random variate generator implemented on a digital computer in fact draws samples from a discrete distribution that approximates the desired continuous distribution. For distributions with “heavy†poles not at 0 this approximation may be too crude and thus every goodness-of-fit test will fail. Besides this theoretic problem that cannot be resolved we have to take into consideration that round-off errors occur more frequently when we have PDFs with poles far away from ‘0.’ Method ITDR tries to handles this situation as good as possible by moving the pole into ‘0.’ Thus do not use a wrapper for your PDF that hides this shift since the information about the resolution of the floating point numbers near the pole gets lost. Method ITDR uses different hats for the pole region and for the tail region. The splitting point between these two regions, the optimal c-value and design points for constructing the hats using Transformed Density Rejection are computed automatically. (The results of these computations can be read using the respective calls ‘unur_itdr_get_xi’, ‘unur_itdr_get_cp’ , and ‘unur_itdr_get_ct’ for the intersection point between local concavity and inverse local concavity, the c-value for the pole and the tail region.) However, one can also analyze the local concavity and inverse local concavity set the corresponding values using ‘unur_itdr_set_xi’, ‘unur_itdr_set_cp’ , and ‘unur_itdr_set_ct’ calls. Notice, that c-values greater than -1/2 can be set to ‘-0.5’. Although this results in smaller acceptance probabities sampling from the hat distribution is much faster than for other values of c. Depending on the expenses of evaluating the PDF the resulting algorithm is usually faster. It is possible to change the parameters and the domain of the chosen distribution and run ‘unur_reinit’ to reinitialize the generator object. However, the values given by ‘unur_itdr_set_xi’, ‘unur_itdr_set_cp’ , or ‘unur_itdr_set_ct’ calls are then ignored when ‘unur_reinit’ is called. Function reference ------------------ -- Function: UNUR_PAR* unur_itdr_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_itdr_set_xi (UNUR_PAR* PARAMETERS, double XI) Sets points where local concavity and inverse local concavity are (almost) equal. It is used to estimate the respective c-values for pole region and hat regions and to determine the splitting point bx between pole and tail region. If no such point is provided it will be computed automatically. Default: not set. -- Function: int unur_itdr_set_cp (UNUR_PAR* PARAMETERS, double CP) Sets parameter CP for transformation T for inverse density in pole region. It must be at most 0 and greater than -1. A value of ‘-0.5’ is treated separately and usually results in faster marginal generation time (at the expense of smaller acceptance probabilities. If no CP-value is given it is estimated automatically. Default: not set. -- Function: int unur_itdr_set_ct (UNUR_PAR* PARAMETERS, double CT) Sets parameter CT for transformation T for density in tail region. It must be at most 0. For densities with unbounded domain it must be greater than -1. A value of ‘-0.5’ is treated separately and usually results in faster marginal generation time (at the expense of smaller acceptance probabilities. If no CT-value is given it is estimated automatically. Default: not set. -- Function: double unur_itdr_get_xi (UNUR_GEN* GENERATOR) -- Function: double unur_itdr_get_cp (UNUR_GEN* GENERATOR) -- Function: double unur_itdr_get_ct (UNUR_GEN* GENERATOR) Get intersection point XI, and c-values CP and CT, respectively. (In case of an error ‘UNUR_INFINITY’ is returned.) -- Function: double unur_itdr_get_area (UNUR_GEN* GENERATOR) Get area below hat. (In case of an error ‘UNUR_INFINITY’ is returned.) -- Function: int unur_itdr_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) Turn verifying of algorithm while sampling on/off. If the condition PDF(x) <= hat(x) is violated for some x then ‘unur_errno’ is set to ‘UNUR_ERR_GEN_CONDITION’. However, notice that this might happen due to round-off errors for a few values of x (less than 1%). Default is ‘FALSE’. -- Function: int unur_itdr_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) Change the verifying of algorithm while sampling on/off.  File: unuran.info, Node: NINV, Next: NROU, Prev: ITDR, Up: Methods_for_CONT 5.3.10 NINV – Numerical INVersion --------------------------------- Required: CDF Optional: PDF Speed: Set-up: optional, Sampling: (very) slow Reinit: supported NINV implementations of some methods for numerical inversion: Newton’s method, regula falsi (combined with interval bisectioning), and bisection method. Regula falsi and bisection method require only the CDF while Newton’s method also requires the PDF. To speed up marginal generation times a table with suitable starting points can be created during the setup. The performance of the algorithm can adjusted by the desired accuracy of the method. It is possible to use this method for generating from truncated distributions. The truncated domain can be changed for an existing generator object. How To Use .......... Method NINV generates random variates by numerical inversion and requires a continuous univariate distribution objects with given CDF. Three variants are available: − Regula falsi [default] − Newton’s method − Interval bisectioning Newton’s method additionally requires the PDF of the distribution and cannot be used otherwise (NINV automatically switches to regula falsi then). Default algorithm is regula falsi. It is slightly slower but numerically much more stable than Newton’s algorithm. Interval bisectioning is the slowest method and should only be considered as a last resort when the other methods fails. It is possible to draw samples from truncated distributions. The truncated domain can even be changed for an existing generator object by an ‘unur_ninv_chg_truncated’ call. Marginal generation times can be sped up by means of a table with suitable starting points which can be created during the setup. Using such a table can be switched on by means of a ‘unur_ninv_set_table’ call where the table size is given as a parameter. The table is still useful when the (truncated) domain is changed often, since it is computed for the domain of the given distribution. (It is not possible to enlarge this domain.) If it is necessary to recalculate the table during sampling, the command ‘unur_ninv_chg_table’ can be used. As a rule of thumb using such a table is appropriate when the number of generated points exceeds the table size by a factor of 100. The default number of iterations of NINV should be enough for all reasonable cases. Nevertheless, it is possible to adjust the maximal number of iterations with the commands ‘unur_ninv_set_max_iter’ and ‘unur_ninv_chg_max_iter’. In particular this might be necessary when the PDF has a pole or the distribution has extremely heavy tails. It is also possible to set/change the accuracy of the method (which also heavily influencies the generation time). We use two measures for the approximation error which can be used independently: x-error and u-error (*note Inversion:: for more details). It is possible to set the maximal tolerated error using with ‘unur_ninv_set_x_resolution’ and with ‘unur_ninv_set_u_resolution’, resp., and change it with the respective calls ‘unur_ninv_chg_x_resolution’ and ‘unur_ninv_chg_x_resolution’. The algorithm tries to satisfy _both_ accuracy goals (and raises an error flag it this fails). One of these accuracy checks can be disabled by setting the accuracy goal to a negative value. NINV tries to use proper starting values for both the regula falsi and bisection method, and for Newton’s method. Of course the user might have more knowledge about the properties of the target distribution and is able to share his wisdom with NINV using the respective commands ‘unur_ninv_set_start’ and ‘unur_ninv_chg_start’. It is possible to change the parameters and the domain of the chosen distribution and run ‘unur_reinit’ to reinitialize the generator object. The values given by the last ‘unur_ninv_chg_truncated’ call will be then changed to the values of the domain of the underlying distribution object. It is important to note that for a distribution from the UNU.RAN library of standard distributions (*note Standard distributions: Stddist.) the normalization constant has to be updated using the ‘unur_distr_cont_upd_pdfarea’ call whenever its parameters have been changed by means of a ‘unur_distr_cont_set_pdfparams’ call. It might happen that NINV aborts ‘unur_sample_cont’ without computing the correct value (because the maximal number iterations has been exceeded). Then the last approximate value for x is returned (with might be fairly false) and ‘unur_error’ is set to ‘UNUR_ERR_GEN_SAMPLING’. Function reference ------------------ -- Function: UNUR_PAR* unur_ninv_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_ninv_set_useregula (UNUR_PAR* PARAMETERS) Switch to regula falsi combined with interval bisectioning. (This the default.) -- Function: int unur_ninv_set_usenewton (UNUR_PAR* PARAMETERS) Switch to Newton’s method. Notice that it is numerically less stable than regula falsi. It it is not possible to invert the CDF for a particular uniform random number U when calling ‘unur_sample_cont’, ‘unur_error’ is set to ‘UNUR_ERR_GEN_SAMPLING’. Thus it is recommended to check ‘unur_error’ before using the result of the sampling routine. -- Function: int unur_ninv_set_usebisect (UNUR_PAR* PARAMETERS) Switch to bisection method. This is a slow algorithm and should only be used as a last resort. -- Function: int unur_ninv_set_max_iter (UNUR_PAR* PARAMETERS, int MAX_ITER) -- Function: int unur_ninv_chg_max_iter (UNUR_GEN* GENERATOR, int MAX_ITER) Set and change number of maximal iterations. Default is ‘100’. -- Function: int unur_ninv_set_x_resolution (UNUR_PAR* PARAMETERS, double X_RESOLUTION) -- Function: int unur_ninv_chg_x_resolution (UNUR_GEN* GENERATOR, double X_RESOLUTION) Set and change the maximal tolerated relative x-error. If X_RESOLUTION is negative then checking of the x-error is disabled. Default is ‘1.e-8’. -- Function: int unur_ninv_set_u_resolution (UNUR_PAR* PARAMETERS, double U_RESOLUTION) -- Function: int unur_ninv_chg_u_resolution (UNUR_GEN* GENERATOR, double U_RESOLUTION) Set and change the maximal tolerated (abolute) u-error. If U_RESOLUTION is negative then checking of the u-error is disabled. Default is ‘-1’ (disabled). -- Function: int unur_ninv_set_start (UNUR_PAR* PARAMETERS, double LEFT, double RIGHT) Set starting points. If not set, suitable values are chosen automatically. Newton: LEFT: starting point Regula LEFT, RIGHT: boundary of starting interval falsi: If the starting points are not set then the follwing points are used by default: Newton: LEFT: CDF(LEFT) = 0.5 Regula LEFT: CDF(LEFT) = 0.1 falsi: RIGHT: CDF(RIGHT) = 0.9 If LEFT == RIGHT, then UNU.RAN always uses the default starting points! -- Function: int unur_ninv_chg_start (UNUR_GEN* GEN, double LEFT, double RIGHT) Change the starting points for numerical inversion. If left==right, then UNU.RAN uses the default starting points (see ‘unur_ninv_set_start’ ). -- Function: int unur_ninv_set_table (UNUR_PAR* PARAMETERS, int NO_OF_POINTS) Generates a table with NO_OF_POINTS points containing suitable starting values for the iteration. The value of NO_OF_POINTS must be at least 10 (otherwise it will be set to 10 automatically). The table points are chosen such that the CDF at these points form an equidistance sequence in the interval (0,1). If a table is used, then the starting points given by ‘unur_ninv_set_start’ are ignored. No table is used by default. -- Function: int unur_ninv_chg_table (UNUR_GEN* GEN, int NO_OF_POINTS) Recomputes a table as described in ‘unur_ninv_set_table’. -- Function: int unur_ninv_chg_truncated (UNUR_GEN* GEN, double LEFT, double RIGHT) Changes the borders of the domain of the (truncated) distribution. Notice that the given truncated domain must be a subset of the domain of the given distribution. The generator always uses the intersection of the domain of the distribution and the truncated domain given by this call. Moreover the starting point(s) will not be changed. _Important:_ If the CDF is (almost) the same for LEFT and RIGHT and (almost) equal to ‘0’ or ‘1’, then the truncated domain is _not_ chanced and the call returns an error code. _Notice:_ If the parameters of the distribution has been changed by a ‘unur_distr_cont_set_pdfparams’ call it is recommended to set the truncated domain again, since the former call might change the domain of the distribution but not update the values for the boundaries of the truncated distribution. -- Function: double unur_ninv_eval_approxinvcdf (const UNUR_GEN* GENERATOR, double U) Get approximate approximate value of inverse CDF at U. If U is out of the domain [0,1] then ‘unur_errno’ is set to ‘UNUR_ERR_DOMAIN’ and the respective bound of the domain of the distribution are returned (which is ‘-UNUR_INFINITY’ or ‘UNUR_INFINITY’ in the case of unbounded domains). _Notice_: This function always evaluates the inverse CDF of the given distribution. A call to ‘unur_ninv_chg_truncated’ call has no effect.  File: unuran.info, Node: NROU, Next: PINV, Prev: NINV, Up: Methods_for_CONT 5.3.11 NROU – Naive Ratio-Of-Uniforms method -------------------------------------------- Required: PDF Optional: mode, center, bounding rectangle for acceptance region Speed: Set-up: slow or fast, Sampling: moderate Reinit: supported Reference: [HLD04: Sect.2.4 and Sect.6.4] NROU is an implementation of the (generalized) ratio-of-uniforms method which uses (minimal) bounding rectangles, see *note Ratio-of-Uniforms::. It uses a positive control parameter r for adjusting the algorithm to the given distribution to improve performance and/or to make this method applicable. Larger values of r increase the class of distributions for which the method works at the expense of a higher rejection constant. For computational reasons r=1 should be used if possible (this is the default). Moreover, this implementation uses the center mu of the distribution (see ‘unur_distr_cont_get_center’ for details of its default values). For the special case with r=1 the coordinates of the minimal bounding rectangles are given by v^+ = sup_(x) sqrt(PDF(x)), u^- = inf_(x) (x- mu) sqrt(PDF(x)), u^+ = sup_(x) (x- mu) sqrt(PDF(x)), where mu is the center of the distribution. For other values of r we have v^+ = sup_(x) (PDF(x))^(1/(r+1)), u^- = inf_(x) (x- mu) (PDF(x))^(r/(r+1)), u^+ = sup_(x) (x- mu) (PDF(x))^(r/(r+1)). These bounds can be given directly. Otherwise they are computed automatically by means of a (slow) numerical routine. Of course this routine can fail, especially when this rectangle is not bounded. It is important to note that the algorithm works with PDF(x- mu) instead of PDF(x). This is important as otherwise the acceptance region can become a very long and skinny ellipsoid along a diagonal of the (huge) bounding rectangle. How To Use .......... For using the NROU method UNU.RAN needs the PDF of the distribution. Additionally, the parameter r can be set via a ‘unur_vnrou_set_r’ call. Notice that the acceptance probability decreases when r is increased. On the other hand is is more unlikely that the bounding rectangle does not exist if r is small. A bounding rectangle can be given by the ‘unur_vnrou_set_u’ and ‘unur_vnrou_set_v’ calls. _Important:_ The bounding rectangle has to be provided for the function PDF(x-center)! Notice that ‘center’ is the center of the given distribution, see ‘unur_distr_cont_set_center’. If in doubt or if this value is not optimal, it can be changed (overridden) by a ‘unur_nrou_set_center’ call. If the coordinates of the bounding rectangle are not provided by the user then the minimal bounding rectangle is computed automatically. By means of ‘unur_vnrou_set_verify’ and ‘unur_vnrou_chg_verify’ one can run the sampling algorithm in a checking mode, i.e., in every cycle of the rejection loop it is checked whether the used rectangle indeed enclosed the acceptance region of the distribution. When in doubt (e.g., when it is not clear whether the numerical routine has worked correctly) this can be used to run a small Monte Carlo study. It is possible to change the parameters and the domain of the chosen distribution and run ‘unur_reinit’ to reinitialize the generator object. Notice, that derived parameters like the mode must also be (re-) set if the parameters or the domain has be changed. Notice, however, that then the values that has been set by ‘unur_vnrou_set_u’ and ‘unur_vnrou_set_v’ calls are removed and the coordinates of the bounding box are computed numerically. Function reference ------------------ -- Function: UNUR_PAR* unur_nrou_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_nrou_set_u (UNUR_PAR* PARAMETERS, double UMIN, double UMAX) Sets left and right boundary of bounding rectangle. If no values are given, the boundary of the minimal bounding rectangle is computed numerically. _Notice_: Computing the minimal bounding rectangle may fail under some circumstances. Moreover, for multimodal distributions the bounds might be too small as only local extrema are computed. Nevertheless, for T_c -concave distributions with c=-1/2 it should work. _Important:_ The bounding rectangle that has to be provided is for the function PDF(x-center)! Default: not set. -- Function: int unur_nrou_set_v (UNUR_PAR* PARAMETERS, double VMAX) Set upper boundary for bounding rectangle. If this value is not given then sqrt(PDF(mode)) is used instead. _Notice_: When the mode is not given for the distribution object, then it will be computed numerically. Default: not set. -- Function: int unur_nrou_set_r (UNUR_PAR* PARAMETERS, double R) Sets the parameter R of the generalized ratio-of-uniforms method. _Notice_: This parameter must satisfy R>0. Default: ‘1’. -- Function: int unur_nrou_set_center (UNUR_PAR* PARAMETERS, double CENTER) Set the center mu of the PDF. If not set the center of the given distribution object is used. Default: see ‘unur_distr_cont_set_center’. -- Function: int unur_nrou_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) Turn verifying of algorithm while sampling on/off. If the condition PDF(x) <= hat(x) is violated for some x then ‘unur_errno’ is set to ‘UNUR_ERR_GEN_CONDITION’. However, notice that this might happen due to round-off errors for a few values of x (less than 1%). Default is ‘FALSE’. -- Function: int unur_nrou_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) Change the verifying of algorithm while sampling on/off.  File: unuran.info, Node: PINV, Next: SROU, Prev: NROU, Up: Methods_for_CONT 5.3.12 PINV – Polynomial interpolation based INVersion of CDF ------------------------------------------------------------- Required: PDF Optional: domain, center, CDF, derivative of PDF Speed: Set-up: (very) slow, Sampling: (very) fast Reinit: not implemented Reference: [DHLa08] PINV is a variant of numerical inversion, where the inverse CDF is approximated using Newton’s interpolating formula. The interval [0,1] is split into several subintervals. In each of these the inverse CDF is constructed at nodes (CDF(x),x) for some points x in this subinterval. If the PDF is given, then the CDF is computed numerically from the given PDF using adaptive Gauss-Lobatto integration with 5 points. Subintervals are split until the requested accuracy goal is reached. The method is not exact, as it only produces random variates of the approximated distribution. Nevertheless, the maximal tolerated approximation error can be set to be the resolution (but of course is bounded by the machine precision). We use the u-error |U-CDF(X)| to measure the error for X = "approximate inverse CDF"(U). Notice that very small values of the u-resolution are possible but increase the cost for the setup step. We call the maximal tolerated u-error the _u-resolution_ of the algorithm in the sequel. Both the order of the interpolating polynomial and the u-resolution can be selected. The interpolating polynomials have to be computed in a setup step. However, it only works for distributions with bounded domain; for distributions with unbounded domain the tails are cut off such that the probability for the tail regions is small compared to the given u-resolution. The construction of the interpolation polynomial only works when the PDF is unimodal or when the PDF does not vanish between two modes. There are some restrictions for the given distribution: • The support of the distribution (i.e., the region where the PDF is strictly positive) must be connected. In practice this means, that the region where PDF is "not too small" must be connected. Unimodal densities satisfy this condition. If this condition is violated then the domain of the distribution might be truncated. • When the PDF is integrated numerically, then the given PDF must be continuous and should be smooth. • The PDF must be bounded. • The algorithm has problems when the distribution has heavy tails (as then the inverse CDF becomes very steep at 0 or 1) and the requested u-resolution is very small. E.g., the Cauchy distribution is likely to show this problem when the requested u-resolution is less then ‘1.e-12’. Regions with very small PDF values or heavy tails might lead to an abortion of the set-up or (even worse) the approximation error might become larger than requested, since the (computation of the) interpolating polynomial becomes numerically unstable. _Remark:_ We also have implemented experimental variants. However, we observed that these variants are more sensitive to round-off errors, especially in the right hand tail and we _do not recommend_ their usage unless there are severe reasons. − Use a function that implements the CDF instead of numerical integration of the PDF. − Use Hermite interpolation instead of Newton interpolation. Thus the first (and second) derivative of the interpolating polynomial coincides with that of the inverse CDF. Consequently the interpolant is also (twice) differentiable even at the interval boundaries. This variant can be seen as limiting case of Newton interpolation with double (or triple) points as nodes. We have used a _smoothness_ parameter to control this feature. However, besides numerical problems we observed that this variant requires more intervals and thus larger setup times and higher memory consumptions. How To Use .......... PINV works for continuous univariate distribution objects with given PDF. The corresponding distribution object should contain a typical point of the distribution, i.e., a point where the PDF is not too small, e.g., (a point near) the mode. However, it is important that the center is *not* the pole of the distribution (or a point too close to the pole). It can be set using a ‘unur_distr_cont_set_center’ or a ‘unur_distr_cont_set_mode’ call. If neither is set, or if the given center cannot be used, then a simple search routine tries to find an appropriate point for the center. It is recommended that the domain of the distribution with bounded domain is specified using a ‘unur_distr_cont_set_domain’ call. Otherwise, the boundary is searched numerically which might be rather expensive, especially when this boundary point is ‘0’. The inverse CDF is interpolated using Newton polynomials. The order of this polynomial can be set by means of a ‘unur_pinv_set_order’ call. The smoothness of the interpolant at interval boundaries can be controlled using a ‘unur_pinv_set_smoothness’ call. Then Hermite interpolation instead of Newton interpolation is used. (The former can be seen as a limiting case of Newton interpolation with double (or triple) points.) However, using higher smoothness is _not recommended_ unless differentiability at the interval boundaries is important. For distributions with unbounded domains the tails are cut off such that the probability for the tail regions is small compared to the given u-resolution. For finding these cut points the algorithm starts with the region ‘[-1.e100,1.e100]’. For the exceptional case where this does not work these starting points can be changed via a ‘unur_pinv_set_boundary’ call. This method is not exact, as it only produces random variates of the approximated distribution. Nevertheless, the numerical error in "u-direction" (i.e., |U-CDF(X)|, for X = "approximate inverse CDF"(U) |U-CDF(X)|) can be controlled by means of ‘unur_pinv_set_u_resolution’. However, the maximal error of this approximation is only estimated. For very small u-resolutions the actual approximation error might be (slightly) larger than the requested u-resolution. (Of course the size of this value depends on the given PDF.) If this error is crucial for an application we recommend to compute this error using ‘unur_pinv_estimate_error’ which runs a small Monte Carlo simulation. It is also possible to improve the error estimate during setup by means of ‘unur_pinv_set_extra_testpoints’. See also the documentation for function ‘unur_pinv_set_u_resolution’ and the remark given there. The number of required subintervals heavily depends on the order of the interpolating polynomial and the requested u-resolution: it increases when order or u-resolution are decreased. It can be checked using a ‘unur_pinv_get_n_intervals’ call. The maximum number of such subintervals is fixed but can be increased using a ‘unur_pinv_set_max_intervals’ call. If this maximum number is too small then the set-up aborts with a corresponding error message. It is also possible to use the CDF of the distribution instead of the PDF. Then the distribution object must contain a pointer to the CDF. Moreover, this variant of the algorithm has to be switched on using an ‘unur_pinv_set_usecdf’ call. Notice, however, that the setup for this variant is numerically less stable than using integration of the PDF (the default variant). Thus using the CDF is _not recommended_. Function reference ------------------ -- Function: UNUR_PAR* unur_pinv_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_pinv_set_order (UNUR_PAR* PARAMETERS, int ORDER) Set order of interpolation. Valid orders are between ‘3’ and ‘17’. Higher orders result in fewer intervals for the approximations. Default: ‘5’. -- Function: int unur_pinv_set_smoothness (UNUR_PAR* PARAMETERS, int SMOOTHNESS) Set smoothness of interpolant. By construction the interpolant is piecewise polynomial and thus smooth on each of the intervals where these polynomials are constructed. At the interval boundaries, however, it usually not be differentiable. Method PINV also implements variants of Newton interpolation where the first (or second) derivative of the interpolating polynomial coincides with the respective derivative of the inverse CDF at the nodes. The the interpolant is (twice) differentiable even at the interval boundaries. These variants can be seen as limiting case of Newton interpolation with double (or triple) points as nodes and are known as Hermite interpolation. Possible values for SMOOTHNESS: Value Effect Requirements ----------------------------------------------------------------------- ‘0’ continuous requires PDF (or CDF) ‘1’ differentiable requires PDF (optional: CDF), order of polynomial must be odd ‘2’ twice requires PDF and its derivative differentiable (optional: CDF), order must be 5, 8, 11, 14 or 17 If the order of the polynomial does not satisfy the given condition, then it is increased to the next larger possible value. _Remark:_ A higher smoothness parameter usually results in a higher number of intervals and thus a higher setup time and memory consumption. We also observed that higher smoothness parameters make the algorithm more sensible for round-off error. Then the setup fails. _Remark:_ If the interpolating polynomial cannot be constructed for the requested smoothness on a particular interval, then the smoothness parameter is reduced for that interval. _Remark:_ For order ‘3’ and smoothness ‘1’ (cubic Hermite interpolation) monotonicity is guaranteed by checking a simple monotonicity condition for the coefficients of the polynomials. _Remark:_ Using SMOOTHNESS larger than ‘0’ is _not recommended_ unless differentiability at the interval boundaries is important for ones application. Default: ‘0’. -- Function: int unur_pinv_set_u_resolution (UNUR_PAR* PARAMETERS, double U_RESOLUTION) Set maximal tolerated u-error. Values of U_RESOLUTION must at least ‘1.e-15’ and ‘1.e-5’ at most. Notice that the resolution of most uniform random number sources is 2^(-32) = ‘2.3e-10’. Thus a value of ‘1.e-10’ leads to an inversion algorithm that could be called exact. For most simulations slightly bigger values for the maximal error are enough as well. Smaller values for U_RESOLUTION increase the number of subinterval that are necessary for the approximation of the inverse CDF. For very small values (less then ‘1.e-12’) this number might exceed the maximum number of such intervals. However, this number can be increased using a ‘unur_pinv_set_max_intervals’ call. _Remark:_ We ran many experiments and found that the observed u-error was always smaller than the given U_RESOLUTION whenever this value was ‘1.e-12’. For values smaller than ‘1e-13’ the maximal observed u-error was slightly larger. One use ‘1.e-15’ if best approximation is required. However, then the actual u-error can be as large as ‘1.e-14’. Consider calling ‘unur_pinv_set_extra_testpoints’ in order to reduce the risk of larger approximation errors. *Warning!* These figures are based on our experiments (with some tolerance added to be on the safe side). There is no guarantee for these error estimates for a particular distribution. Default is ‘1.e-10’. -- Function: int unur_pinv_set_extra_testpoints (UNUR_PAR* PARAMETERS, int N_POINTS) During setup method PINV checks the current u-error by means of carefully selected test points and improves the approximation where necessary. However, it nevertheless may happen, that the maximal approximation error is larger than estimated in some interval (which usually is hit with a very small probability). This estimate can be improved by using extra test points which can be added by means of this call. However, this increases the setup time considerably. Note that these additional points are selected equidistributed in each subinterval. Default is ‘0’ (i.e., no additional test points are used). -- Function: int unur_pinv_set_use_upoints (UNUR_PAR* PARAMETERS, int USE_UPOINTS) If USE_UPOINTS is ‘TRUE’, then the nodes of the interpolating polynomial are constructed by means of Chebyshev points in u-scale not in x-scale. This results is a better approximation but almost doubles the number of PDF or CDF evaluations during the setup. (This is an experimental feature.) Default: ‘FALSE’ -- Function: int unur_pinv_set_usepdf (UNUR_PAR* PARAMETERS) Use PDF (if available) to compute approximate inverse CDF. This is the default. -- Function: int unur_pinv_set_usecdf (UNUR_PAR* PARAMETERS) Use CDF (if available) to compute approximate inverse CDF. This variant is intend for running experiments with method PINV. _Remark:_ We ran many experiments and found that for small values of the given U_RESOLUTION (less than ‘1.e-12’) the setup fails for distributions with heavy tails. We found that using the PDF (instead of the CDF) is numerically more stable. This is especially the case when the smoothness parameter is set to ‘1’ or ‘2’. Using the CDF is *not recommended*. -- Function: int unur_pinv_set_boundary (UNUR_PAR* PARAMETERS, double LEFT, double RIGHT) Set LEFT and RIGHT point for finding the cut-off points for the "computational domain", i.e., the domain that covers the essential part of the distribution. The cut-off points are computed such that the tail probabilities are smaller than given by ‘unur_pinv_set_u_resolution’. It is usually safe to use a large interval. However, ‘+/- UNUR_INFINITY’ is not allowed. _Important_: This call does not change the domain of the given distribution itself. But it restricts the domain for the resulting random variates. Default: intersection of ‘[-1.e100,+1.e100]’ and the given domain of the distribution. -- Function: int unur_pinv_set_searchboundary (UNUR_PAR* PARAMETERS, int LEFT, int RIGHT) If LEFT or RIGHT is set to ‘FALSE’ then the respective boundary as given by a ‘unur_pinv_set_boundary’ call is used without any further computations. However, these boundary points might cause numerical problems during the setup when PDF returns ‘0’ “almost everywhereâ€. If set to ‘TRUE’ (the default) then the computational interval is shortened to a more sensible region by means of a search algorithm. Switching off this search is useful, e.g., for the Gamma(2) distribution where the left border ‘0’ is fixed and finite. _Remark:_ The searching algorithm assumes that the support of the distribution is connected. _Remark:_ Do not set this parameter to ‘FALSE’ except when searching for cut-off points fails and one wants to try with precomputed values. Default: ‘TRUE’. -- Function: int unur_pinv_set_max_intervals (UNUR_PAR* PARAMETERS, int MAX_IVS) Set maximum number of intervals. MAX_IVS must be at least ‘100’ and at most ‘1000000’. Default is ‘10000’. -- Function: int unur_pinv_get_n_intervals (const UNUR_GEN* GENERATOR) Get number of intervals used for interpolation in the generator object. It returns ‘0’ in case of an error. -- Function: int unur_pinv_set_keepcdf (UNUR_PAR* PARAMETERS, int KEEPCDF) If the PDF is given, then the CDF is computed numerically from the given PDF using adaptive Gauss-Lobatto integration. Thus a table of CDF points is stored to keep the number of evaluations of the PDF minimal. Usually this table is discarded when the setup is completed. If KEEPCDF is ‘TRUE’, then this table is kept and can be used to compute the CDF of the underlying distribution by means of function ‘unur_pinv_eval_approxcdf’. This option is ignored when ‘unur_pinv_set_usecdf’ is called. Default: ‘FALSE’ -- Function: double unur_pinv_eval_approxinvcdf (const UNUR_GEN* GENERATOR, double U) Evaluate interpolation of inverse CDF at U. If U is out of the domain (0,1) then ‘unur_errno’ is set to ‘UNUR_ERR_DOMAIN’ and the respective bound of the domain of the distribution are returned (which is ‘-UNUR_INFINITY’ or ‘UNUR_INFINITY’ in the case of unbounded domains). -- Function: double unur_pinv_eval_approxcdf (const UNUR_GEN* GENERATOR, double X) Evaluate (approximate) CDF at X. If the PDF of the distribution is given, then adaptive Gauss-Lobatto integration is used to compute the CDF. If the PDF is used to create the generator object, then the table of integral values must not removed at the end of setup and thus ‘unur_pinv_set_keepcdf’ must be called. -- Function: int unur_pinv_estimate_error (const UNUR_GEN* GENERATOR, int SAMPLESIZE, double* MAX_ERROR, double* MAE) Estimate maximal u-error and mean absolute error (MAE) for GENERATOR by means of Monte-Carlo simulation with sample size SAMPLESIZE. The results are stored in MAX_ERROR and MAE, respectively. It returns ‘UNUR_SUCCESS’ if successful.  File: unuran.info, Node: SROU, Next: SSR, Prev: PINV, Up: Methods_for_CONT 5.3.13 SROU – Simple Ratio-Of-Uniforms method --------------------------------------------- Required: T-concave PDF, mode, area Speed: Set-up: fast, Sampling: slow Reinit: supported Reference: [LJa01] [LJa02] [HLD04: Sect.6.3.1; Sect.6.3.2; Sect.6.4.1; Alg.6.4; Alg.6.5; Alg.6.7] SROU is based on the ratio-of-uniforms method (*note Ratio-of-Uniforms::) that uses universal inequalities for constructing a (universal) bounding rectangle. It works for all T-concave distributions, including log-concave and T-concave distributions with T(x) = -1/sqrt(x). Moreover an (optional) parameter ‘r’ can be given, to adjust the generator to the given distribution. This parameter is strongly related to the parameter ‘c’ for transformed density rejection (*note TDR::) via the formula c = -r/(r+1). The rejection constant increases with higher values for ‘r’. On the other hand, the given density must be T_c -concave for the corresponding c. The default setting for ‘r’ is 1 which results in a very simple code. (For other settings, sampling uniformly from the acceptance region is more complicated.) Optionally the CDF at the mode can be given to increase the performance of the algorithm. Then the rejection constant is reduced by 1/2 and (if ‘r=1’) even a universal squeeze can (but need not be) used. A way to increase the performance of the algorithm when the CDF at the mode is not provided is the usage of the mirror principle (only if ‘r=1’). However, using squeezes and using the mirror principle is only recommended when the PDF is expensive to compute. The exact location of the mode and/or the area below the PDF can be replace by appropriate bounds. Then the algorithm still works but has larger rejection constants. How To Use .......... SROU works for any continuous univariate distribution object with given T_c -concave PDF with c<1, ) mode and area below PDF. Optional the CDF at the mode can be given to increase the performance of the algorithm by means of the ‘unur_srou_set_cdfatmode’ call. Additionally squeezes can be used and switched on via ‘unur_srou_set_usesqueeze’ (only if ‘r=1’). A way to increase the performance of the algorithm when the CDF at the mode is not provided is the usage of the mirror principle which can be swithced on by means of a ‘unur_srou_set_usemirror’ call (only if ‘r=1’) . However using squeezes and using the mirror principle is only recommended when the PDF is expensive to compute. The parameter ‘r’ can be given, to adjust the generator to the given distribution. This parameter is strongly related parameter ‘c’ for transformed density rejection via the formula c = -r/(r+1). The parameter ‘r’ can be any value larger than or equal to 1. Values less then 1 are automatically set to 1. The rejection constant depends on the chosen parameter ‘r’ but not on the particular distribution. It is 4 for ‘r’ equal to 1 and higher for higher values of ‘r’. It is important to note that different algorithms for different values of ‘r’: If ‘r’ equal to 1 this is much faster than the algorithm for ‘r’ greater than 1. The default setting for ‘r’ is 1. If the (exact) area below the PDF is not known, then an upper bound can be used instead (which of course increases the rejection constant). But then the squeeze flag must not be set and ‘unur_srou_set_cdfatmode’ must not be used. If the exact location of the mode is not known, then use the approximate location and provide the (exact) value of the PDF at the mode by means of the ‘unur_srou_set_pdfatmode’ call. But then ‘unur_srou_set_cdfatmode’ must not be used. Notice, that a (slow) numerical mode finder will be used if no mode is given at all. It is even possible to give an upper bound for the PDF only. However, then the (upper bound for the) area below the PDF has to be multiplied by the ratio between the upper bound and the lower bound of the PDF at the mode. Again setting the squeeze flag and using ‘unur_srou_set_cdfatmode’ is not allowed. It is possible to change the parameters and the domain of the chosen distribution and run ‘unur_reinit’ to reinitialize the generator object. Notice, that derived parameters like the mode must also be (re-) set if the parameters or the domain has be changed. Moreover, if the PDF at the mode has been provided by a ‘unur_srou_set_pdfatmode’ call, additionally ‘unur_srou_chg_pdfatmode’ must be used (otherwise this call is not necessary since then this figure is computed directly from the PDF). There exists a test mode that verifies whether the conditions for the method are satisfied or not while sampling. It can be switched on by calling ‘unur_srou_set_verify’ and ‘unur_srou_chg_verify’, respectively. Notice however that sampling is (a little bit) slower then. Function reference ------------------ -- Function: UNUR_PAR* unur_srou_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_srou_set_r (UNUR_PAR* PARAMETERS, double R) Set parameter R for transformation. Only values greater than or equal to 1 are allowed. The performance of the generator decreases when R is increased. On the other hand R must not be set to small, since the given density must be T_c-concave for c = -r/(r+1). _Notice:_ If R is set to ‘1’ a simpler and much faster algorithm is used then for R greater than one. For computational reasons values of R that are greater than ‘1’ but less than ‘1.01’ are always set to ‘1.01’. Default is ‘1’. -- Function: int unur_srou_set_cdfatmode (UNUR_PAR* PARAMETERS, double FMODE) Set CDF at mode. When set, the performance of the algorithm is increased by factor 2. However, when the parameters of the distribution are changed ‘unur_srou_chg_cdfatmode’ has to be used to update this value. Default: not set. -- Function: int unur_srou_set_pdfatmode (UNUR_PAR* PARAMETERS, double FMODE) Set pdf at mode. When set, the PDF at the mode is never changed. This is to avoid additional computations, when the PDF does not change when parameters of the distributions vary. It is only useful when the PDF at the mode does not change with changing parameters of the distribution. _IMPORTANT:_ This call has to be executed after a possible call of ‘unur_srou_set_r’. Default: not set. -- Function: int unur_srou_set_usesqueeze (UNUR_PAR* PARAMETERS, int USESQUEEZE) Set flag for using universal squeeze (default: off). Using squeezes is only useful when the evaluation of the PDF is (extremely) expensive. Using squeezes is automatically disabled when the CDF at the mode is not given (then no universal squeezes exist). Squeezes can only be used if ‘r=1’. Default is ‘FALSE’. -- Function: int unur_srou_set_usemirror (UNUR_PAR* PARAMETERS, int USEMIRROR) Set flag for using mirror principle (default: off). Using the mirror principle is only useful when the CDF at the mode is not known and the evaluation of the PDF is rather cheap compared to the marginal generation time of the underlying uniform random number generator. It is automatically disabled when the CDF at the mode is given. (Then there is no necessity to use the mirror principle. However disabling is only done during the initialization step but not at a re-initialization step.) The mirror principle can only be used if ‘r=1’. Default is ‘FALSE’. -- Function: int unur_srou_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) -- Function: int unur_srou_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) Turn verifying of algorithm while sampling on/off. If the condition squeeze(x) <= PDF(x) <= hat(x) is violated for some x then ‘unur_errno’ is set to ‘UNUR_ERR_GEN_CONDITION’. However notice that this might happen due to round-off errors for a few values of x (less than 1%). Default is ‘FALSE’. -- Function: int unur_srou_chg_cdfatmode (UNUR_GEN* GENERATOR, double FMODE) Change CDF at mode of distribution. ‘unur_reinit’ must be executed before sampling from the generator again. -- Function: int unur_srou_chg_pdfatmode (UNUR_GEN* GENERATOR, double FMODE) Change PDF at mode of distribution. ‘unur_reinit’ must be executed before sampling from the generator again.  File: unuran.info, Node: SSR, Next: TABL, Prev: SROU, Up: Methods_for_CONT 5.3.14 SSR – Simple Setup Rejection ----------------------------------- Required: T-concave PDF, mode, area Speed: Set-up: fast, Sampling: slow Reinit: supported Reference: [LJa01] [HLD04: Sect.6.3.3; Alg.6.6] SSR is an acceptance/rejection method that uses universal inequalities for constructing (universal) hats and squeezes (*note Rejection::). It works for all T-concave distributions with T(x) = -1/sqrt(x). It requires the PDF, the (exact) location of the mode and the area below the given PDF. The rejection constant is 4 for all T-concave distributions with unbounded domain and is less than 4 when the domain is bounded. Optionally the CDF at the mode can be given to increase the performance of the algorithm. Then the rejection constant is at most 2 and a universal squeeze can (but need not be) used. However, using squeezes is not recommended unless the evaluation of the PDF is expensive. The exact location of the mode and/or the area below the PDF can be replace by appropriate bounds. Then the algorithm still works but has larger rejection constants. How To Use .......... SSR works for any continuous univariate distribution object with given T-concave PDF (with T(x) = -1/sqrt(x),) mode and area below PDF. Optional the CDF at the mode can be given to increase the performance of the algorithm by means of the ‘unur_ssr_set_cdfatmode’ call. Additionally squeezes can be used and switched on via ‘unur_ssr_set_usesqueeze’. If the (exact) area below the PDF is not known, then an upper bound can be used instead (which of course increases the rejection constant). But then the squeeze flag must not be set and ‘unur_ssr_set_cdfatmode’ must not be used. If the exact location of the mode is not known, then use the approximate location and provide the (exact) value of the PDF at the mode by means of the ‘unur_ssr_set_pdfatmode’ call. But then ‘unur_ssr_set_cdfatmode’ must not be used. Notice, that a (slow) numerical mode finder will be used if no mode is given at all. It is even possible to give an upper bound for the PDF only. However, then the (upper bound for the) area below the PDF has to be multiplied by the ratio between the upper bound and the lower bound of the PDF at the mode. Again setting the squeeze flag and using ‘unur_ssr_set_cdfatmode’ is not allowed. It is possible to change the parameters and the domain of the chosen distribution and run ‘unur_reinit’ to reinitialize the generator object. Notice, that derived parameters like the mode must also be (re-) set if the parameters or the domain has be changed. Moreover, if the PDF at the mode has been provided by a ‘unur_ssr_set_pdfatmode’ call, additionally ‘unur_ssr_chg_pdfatmode’ must be used (otherwise this call is not necessary since then this figure is computed directly from the PDF). _Important:_ If any of mode, PDF or CDF at the mode, or the area below the mode has been changed, then ‘unur_reinit’ must be executed. (Otherwise the generator produces garbage). There exists a test mode that verifies whether the conditions for the method are satisfied or not while sampling. It can be switched on/off by calling ‘unur_ssr_set_verify’ and ‘unur_ssr_chg_verify’, respectively. Notice, however, that sampling is (a little bit) slower then. Function reference ------------------ -- Function: UNUR_PAR* unur_ssr_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_ssr_set_cdfatmode (UNUR_PAR* PARAMETERS, double FMODE) Set CDF at mode. When set, the performance of the algorithm is increased by factor 2. However, when the parameters of the distribution are changed ‘unur_ssr_chg_cdfatmode’ has to be used to update this value. Default: not set. -- Function: int unur_ssr_set_pdfatmode (UNUR_PAR* PARAMETERS, double FMODE) Set pdf at mode. When set, the PDF at the mode is never changed. This is to avoid additional computations, when the PDF does not change when parameters of the distributions vary. It is only useful when the PDF at the mode does not change with changing parameters for the distribution. Default: not set. -- Function: int unur_ssr_set_usesqueeze (UNUR_PAR* PARAMETERS, int USESQUEEZE) Set flag for using universal squeeze (default: off). Using squeezes is only useful when the evaluation of the PDF is (extremely) expensive. Using squeezes is automatically disabled when the CDF at the mode is not given (then no universal squeezes exist). Default is ‘FALSE’. -- Function: int unur_ssr_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) -- Function: int unur_ssr_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) Turn verifying of algorithm while sampling on/off. If the condition squeeze(x) <= PDF(x) <= hat(x) is violated for some x then ‘unur_errno’ is set to ‘UNUR_ERR_GEN_CONDITION’. However notice that this might happen due to round-off errors for a few values of x (less than 1%). Default is ‘FALSE’. -- Function: int unur_ssr_chg_cdfatmode (UNUR_GEN* GENERATOR, double FMODE) Change CDF at mode of distribution. ‘unur_reinit’ must be executed before sampling from the generator again. -- Function: int unur_ssr_chg_pdfatmode (UNUR_GEN* GENERATOR, double FMODE) Change PDF at mode of distribution. ‘unur_reinit’ must be executed before sampling from the generator again.  File: unuran.info, Node: TABL, Next: TDR, Prev: SSR, Up: Methods_for_CONT 5.3.15 TABL – a TABLe method with piecewise constant hats --------------------------------------------------------- Required: PDF, all local extrema, cut-off values for the tails Optional: approximate area Speed: Set-up: (very) slow, Sampling: fast Reinit: not implemented Reference: [AJa93] [AJa95] [HLD04: Cha.5.1] TABL (called Ahrens method in [HLD04] ) is an acceptance/rejection method (*note Rejection::) that uses a decomposition of the domain of the distribution into many short subintervals. Inside of these subintervals constant hat and squeeze functions are utilized. Thus it is easy to use the idea of immediate acceptance for points below the squeeze. This reduces the expected number of uniform random numbers per generated random variate to less than two. Using a large number of subintervals only little more than one random number is necessary on average. Thus this method becomes very fast. Due to the constant hat function this method only works for distributions with bounded domains. Thus for unbounded domains the left and right tails have to be cut off. This is no problem when the probability of falling into these tail regions is beyond computational relevance (e.g. smaller than ‘1.e-12’). For easy construction of hat and squeeze functions it is necessary to know the regions of monotonicity (called _slopes_) or equivalently all local maxima and minima of the density. The main problem for this method in the setup is the choice of the subintervals. A simple and close to optimal approach is the "equal area rule" [HLD04: Cha.5.1] . There the subintervals are selected such that the area below the hat is the same for each subinterval which can be realized with a simple recursion. If more subintervals are necessary it is possible to split either randomly chosen intervals (adaptive rejection sampling, ARS) or those intervals, where the ratio between squeeze and hat is smallest. This version of the setup is called derandomized ARS (DARS). With the default settings TABL is first calculating approximately 30 subintervals with the equal area rule. Then DARS is used till the desired fit of the hat is reached. A convenient measure to control the quality of the fit of hat and squeeze is the ratio (area below squeeze)/(area below hat) called ‘sqhratio’ which must be smaller or equal to one. The expected number of iterations in the rejection algorithm is known to be smaller than 1/sqhratio and the expected number of evaluations of the density is bounded by ‘1/sqhratio - 1’. So values of the sqhratio close to one (e.g. ‘0.95’ or ‘0.99’) lead to many subintervals. Thus a better fitting hat is constructed and the sampling algorithm becomes fast; on the other hand large tables are needed and the setup is very slow. For moderate values of sqhratio (e.g. ‘0.9’ or ‘0.8’) the sampling is slower but the required tables are smaller and the setup is not so slow. It follows from the above explanations that TABL is always requiring a slow setup and that it is not very well suited for heavy-tailed distributions. How To Use .......... For using the TABL method UNU.RAN needs a bounded interval to which the generated variates can be restricted and information about all local extrema of the distribution. For unimodal densities it is sufficient to provide the mode of the distribution. For the case of a built-in unimodal distribution with bounded domain all these information is present in the distribution object and thus no extra input is necessary (see example_TABL1 below). For a built-in unimodal distribution with unbounded domain we should specify the cut-off values for the tails. This can be done with the ‘unur_tabl_set_boundary’ call (see example_TABL2 below). For the case that we do not set these boundaries the default values of ‘+/- 1.e20’ are used. We can see in example_TABL1 that this still works fine for many standard distributions. For the case of a multimodal distribution we have to set the regions of monotonicity (called slopes) explicitly using the ‘unur_tabl_set_slopes’ command (see example_TABL3 below). To controll the fit of the hat and the size of the tables and thus the speed of the setup and the sampling it is most convenient to use the ‘unur_tabl_set_max_sqhratio’ call. The default is ‘0.9’ which is a sensible value for most distributions and applications. If very large samples of a distribution are required or the evaluation of a density is very slow it may be useful to increase the sqhratio to eg. ‘0.95’ or even ‘0.99’. With the ‘unur_tabl_get_sqhratio’ call we can check which sqhratio was really reached. If that value is below the desired value it is necessary to increase the maximal number of subintervals, which defaults to ‘1000’, using the ‘unur_tabl_set_max_intervals’ call. The ‘unur_tabl_get_n_intervals’ call can be used to find out the number of subintervals the setup calculated. It is also possible to set the number of intervals and their respective boundaries by means of the ‘unur_tabl_set_cpoints’ call. It is also possible to use method TABL for correlation induction (variance reduction) by setting of an auxiliary uniform random number generator via the ‘unur_set_urng_aux’ call. (Notice that this must be done after a possible ‘unur_set_urng’ call.) However, this only works when immediate acceptance is switched off by a ‘unur_tabl_set_variant_ia’ call. Function reference ------------------ -- Function: UNUR_PAR* unur_tabl_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_tabl_set_variant_ia (UNUR_PAR* PARAMETERS, int USE_IA) Use immediate acceptance when USE_IA is set to ‘TRUE’. This technique requires less uniform. If it is set to ‘FALSE’, “classical†acceptance/rejection from hat distribution is used. _Notice:_ Auxiliary uniform random number generators for correlation induction (variance reduction) can only be used when “classical†acceptance/rejection is used. Default: ‘TRUE’. -- Function: int unur_tabl_set_cpoints (UNUR_PAR* PARAMETERS, int N_CPOINTS, const DOUBLE* CPOINTS) Set construction points for the hat function. If STP is ‘NULL’ than a heuristic rule of thumb is used to get N_STP construction points. This is the default behavior. The default number of construction points is ‘30’. -- Function: int unur_tabl_set_nstp (UNUR_PAR* PARAMETERS, int N_STP) Set number of construction points for the hat function. N_STP must be greater than zero. After the setup there are about N_STP construction points. However it might be larger when a small fraction is given by the ‘unur_tabl_set_areafraction’ call. It also might be smaller for some variants. Default is ‘30’. -- Function: int unur_tabl_set_useear (UNUR_PAR* PARAMETERS, int USEEAR) If USEEAR is set to ‘TRUE’, the “equal area rule†is used, the given slopes are partitioned in such a way that the area below the hat function in each subinterval (“stripeâ€) has the same area (except the last the last interval which can be smaller). The area can be set by means of the ‘unur_tabl_set_areafraction’ call. Default is ‘TRUE’. -- Function: int unur_tabl_set_areafraction (UNUR_PAR* PARAMETERS, double FRACTION) Set parameter for the equal area rule. During the setup a piecewise constant hat is constructed, such that the area below each of these pieces (strips) is the same and equal to the (given) area below the PDF times FRACTION (which must be greater than zero). _Important:_ If the area below the PDF is not set in the distribution object, then 1 is assumed. Default is ‘0.1’. -- Function: int unur_tabl_set_usedars (UNUR_PAR* PARAMETERS, int USEDARS) If USEDARS is set to ‘TRUE’, “derandomized adaptive rejection sampling†(DARS) is used in the setup. Intervals, where the area between hat and squeeze is too large compared to the average area between hat and squeeze over all intervals, are split. This procedure is repeated until the ratio between squeeze and hat exceeds the bound given by ‘unur_tabl_set_max_sqhratio’ call or the maximum number of intervals is reached. Moreover, it also aborts when no more intervals can be found for splitting. For finding splitting points the arc-mean rule (a mixture of arithmetic mean and harmonic mean) is used. Default is ‘TRUE’. -- Function: int unur_tabl_set_darsfactor (UNUR_PAR* PARAMETERS, double FACTOR) Set factor for “derandomized adaptive rejection samplingâ€. This factor is used to determine the segments that are “too largeâ€, that is, all segments where the area between squeeze and hat is larger than FACTOR times the average area over all intervals between squeeze and hat. Notice that all segments are split when FACTOR is set to ‘0.’, and that there is no splitting at all when FACTOR is set to ‘UNUR_INFINITY’. Default is ‘0.99’. There is no need to change this parameter. -- Function: int unur_tabl_set_variant_splitmode (UNUR_PAR* PARAMETERS, unsigned SPLITMODE) There are three variants for adaptive rejection sampling. These differ in the way how an interval is split: splitmode ‘1’ use the generated point to split the interval. splitmode ‘2’ use the mean point of the interval. splitmode ‘3’ use the arcmean point; suggested for distributions with heavy tails. Default is splitmode ‘2’. -- Function: int unur_tabl_set_max_sqhratio (UNUR_PAR* PARAMETERS, double MAX_RATIO) Set upper bound for the ratio (area below squeeze) / (area below hat). It must be a number between 0 and 1. When the ratio exceeds the given number no further construction points are inserted via DARS in the setup. For the case of ARS (unur_tabl_set_usedars() must be set to ‘FALSE’): Use ‘0’ if no construction points should be added after the setup. Use ‘1’ if added new construction points should not be stopped until the maximum number of construction points is reached. If MAX_RATIO is close to one, many construction points are used. Default is ‘0.9’. -- Function: double unur_tabl_get_sqhratio (const UNUR_GEN* GENERATOR) Get the current ratio (area below squeeze) / (area below hat) for the generator. (In case of an error ‘UNUR_INFINITY’ is returned.) -- Function: double unur_tabl_get_hatarea (const UNUR_GEN* GENERATOR) Get the area below the hat for the generator. (In case of an error ‘UNUR_INFINITY’ is returned.) -- Function: double unur_tabl_get_squeezearea (const UNUR_GEN* GENERATOR) Get the area below the squeeze for the generator. (In case of an error ‘UNUR_INFINITY’ is returned.) -- Function: int unur_tabl_set_max_intervals (UNUR_PAR* PARAMETERS, int MAX_IVS) Set maximum number of intervals. No construction points are added in or after the setup when the number of intervals suceeds MAX_IVS. Default is ‘1000’. -- Function: int unur_tabl_get_n_intervals (const UNUR_GEN* GENERATOR) Get the current number of intervals. (In case of an error 0 is returned.) -- Function: int unur_tabl_set_slopes (UNUR_PAR* PARAMETERS, const DOUBLE* SLOPES, int N_SLOPES) Set slopes for the PDF. A slope is an interval [a,b] or [b,a] where the PDF is monotone and PDF(a) >= PDF(b). The list of slopes is given by an array SLOPES where each consecutive tuple (i.e. ‘(slopes[0], slopes[1])’, ‘(slopes[2], slopes[3])’, etc.) defines one slope. Slopes must be sorted (i.e. both ‘slopes[0]’ and ‘slopes[1]’ must not be greater than any entry of the slope ‘(slopes[2], slopes[3])’, etc.) and must not be overlapping. Otherwise no slopes are set and UNUR_ERRNO is set to ‘UNUR_ERR_PAR_SET’. _Notice:_ N_SLOPES is the number of slopes (and not the length of the array SLOPES). _Notice_ that setting slopes resets the given domain for the distribution. However, in case of a standard distribution the area below the PDF is not updated. -- Function: int unur_tabl_set_guidefactor (UNUR_PAR* PARAMETERS, double FACTOR) Set factor for relative size of the guide table for indexed search (see also method DGT *note DGT::). It must be greater than or equal to ‘0’. When set to ‘0’, then sequential search is used. Default is ‘1’. -- Function: int unur_tabl_set_boundary (UNUR_PAR* PARAMETERS, double LEFT, double RIGHT) Set the left and right boundary of the computation interval. The piecewise hat is only constructed inside this interval. The probability outside of this region must not be of computational relevance. Of course ‘+/- UNUR_INFINITY’ is not allowed. Default is ‘-1.e20,1.e20’. -- Function: int unur_tabl_chg_truncated (UNUR_GEN* GEN, double LEFT, double RIGHT) Change the borders of the domain of the (truncated) distribution. Notice that the given truncated domain must be a subset of the domain of the given distribution. The generator always uses the intersection of the domain of the distribution and the truncated domain given by this call. The hat function will not be changed. _Important:_ The ratio between the area below the hat and the area below the squeeze changes when the sampling region is restricted. In particalur it becomes (very) large when sampling from the (far) tail of the distribution. Then it is better to create a generator object for the tail of distribution only. _Important:_ This call does not work for variant ‘IA’ (immediate acceptance). In this case UNU.RAN switches _automatically_ to variant ‘RH’ (use “classical†acceptance/rejection from hat distribution) and does revert to the variant originally set by the user. _Important:_ It is not a good idea to use adaptave rejection sampling while sampling from a domain that is a strict subset of the domain that has been used to construct the hat. For that reason adaptive adding of construction points is _automatically disabled_ by this call. _Important:_ If the CDF of the hat is (almost) the same for LEFT and RIGHT and (almost) equal to ‘0’ or ‘1’, then the truncated domain is not changed and the call returns an error code. -- Function: int unur_tabl_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) -- Function: int unur_tabl_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) Turn verifying of algorithm while sampling on/off. If the condition squeeze(x) <= PDF(x) <= hat(x) is violated for some x then ‘unur_errno’ is set to ‘UNUR_ERR_GEN_CONDITION’. However notice that this might happen due to round-off errors for a few values of x (less than 1%). Default is ‘FALSE’. -- Function: int unur_tabl_set_pedantic (UNUR_PAR* PARAMETERS, int PEDANTIC) Sometimes it might happen that ‘unur_init’ has been executed successfully. But when additional construction points are added by adaptive rejection sampling, the algorithm detects that the PDF is not monotone in the given slopes. With PEDANTIC being ‘TRUE’, the sampling routine is exchanged by a routine that simply returns ‘UNUR_INFINITY’ indicating an error. Default is ‘FALSE’.  File: unuran.info, Node: TDR, Next: UTDR, Prev: TABL, Up: Methods_for_CONT 5.3.16 TDR – Transformed Density Rejection ------------------------------------------ Required: T-concave PDF, dPDF Optional: mode Speed: Set-up: slow, Sampling: fast Reinit: supported Reference: [GWa92] [HWa95] [HLD04: Cha.4] TDR is an acceptance/rejection method that uses the concavity of a transformed density to construct hat function and squeezes automatically. Such PDFs are called T-concave. Currently the following transformations are implemented and can be selected by setting their ‘c’-values by a ‘unur_tdr_set_c’ call: ‘c = 0’ T(x) = log(x) ‘c = -0.5’ T(x) = -1/sqrt(x) (Default) In future releases the transformations T(x) = -(x)^c will be available for any c with 0 > c > -1. Notice that if a PDF is T-concave for a c then it also T-concave for every c’ /* ------------------------------------------------------------- */ /* Example how to sample from an empirial continuous univariate */ /* distribution. */ /* ------------------------------------------------------------- */ int main(void) { int i; double x; /* data points */ double data[15] = { -0.1, 0.05, -0.5, 0.08, 0.13,\ -0.21,-0.44, -0.43, -0.33, -0.3, \ 0.18, 0.2, -0.37, -0.29, -0.9 }; /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Create a distribution object and set empirical sample. */ distr = unur_distr_cemp_new(); unur_distr_cemp_set_data(distr, data, 15); /* Choose a method: EMPK. */ par = unur_empk_new(distr); /* Set smooting factor. */ unur_empk_set_smoothing(par, 0.8); /* Create the generator object. */ gen = unur_init(par); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ Example (String API) -------------------- /* ------------------------------------------------------------- */ /* File: example_emp_str.c */ /* ------------------------------------------------------------- */ /* String API. */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* Example how to sample from an empirial continuous univariate */ /* distribution. */ /* ------------------------------------------------------------- */ int main(void) { int i; double x; /* Declare UNURAN generator object. */ UNUR_GEN *gen; /* generator object */ /* Create the generator object. */ gen = unur_str2gen("distr = cemp; \ data=(-0.10, 0.05,-0.50, 0.08, 0.13, \ -0.21,-0.44,-0.43,-0.33,-0.30, \ 0.18, 0.20,-0.37,-0.29,-0.90) & \ method=empk; smoothing=0.8"); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */  File: unuran.info, Node: EMPK, Next: EMPL, Up: Methods_for_CEMP 5.4.1 EMPK – EMPirical distribution with Kernel smoothing --------------------------------------------------------- Required: observed sample Speed: Set-up: slow (as sample is sorted), Sampling: fast (depends on kernel) Reinit: not implemented Reference: [HLa00] [HLD04: Sect.12.1.2] EMPK generates random variates from an empirical distribution that is given by an observed sample. The idea is that simply choosing a random point from the sample and to return it with some added noise results in a method that has very nice properties, as it can be seen as sampling from a kernel density estimate. If the underlying distribution is continuous, especially the fine structur of the resulting empirical distribution is much better than using only resampling without noise. Clearly we have to decide about the density of the noise (called kernel) and about the standard deviation of the noise. The mathematical theory of kernel density estimation shows us that we are comparatively free in choosing the kernel. It also supplies us with a simple formula to compute the optimal standarddeviation of the noise, called bandwidth (or window width) of the kernel. The variance of the estimated density is slightly larger than that of the observed sample. However, this can be easily corrected if required. There is also a correction (mirroring technique) for distributions with non-negative support. A simple robust reference method is implemented to find a good standard deviation of the noise (i.e. the bandwidth of kernel density estimation). For some cases (e.g. densities with two or more sharp distinct peaks) there kernel density estimation can be adjusted by changing the smoothness factor and the so called beta factor. How To Use .......... EMPK uses empirical distributions. The main parameter is the choice if of kernel density. The most important kernels can be set by ‘unur_empk_set_kernel’. Additionally generators for other kernels can be used by using ‘unur_empk_set_kernelgen’ instead. Additionally variance correction and a correction for non-negative variates can be switched on. The two other parameters (smoothing factor and beta factor) are only useful for people knowing the theory of kernel density estimation. It is not necessary to change them if the true underlying distribution is somehow comparable with a bell-shaped curve, even skewed or with some not too sharp extra peaks. In all these cases the simple robust reference method implemented to find a good standard deviation of the noise (i.e. the bandwidth of kernel density estimation) should give sensible results. However, it might be necessary to overwrite this automatic method to find the bandwidth eg. when resampling from data with two or more sharp distinct peaks. Then the distribution has nearly discrete components as well and our automatic method may easily choose too large a bandwidth which results in an empirical distribution which is oversmoothed (i.e. it has lower peaks than the original distribution). Then it is recommended to decrease the bandwidth using the ‘unur_empk_set_smoothing’ call. A smoothing factor of ‘1’ is the default. A smoothing factor of ‘0’ leads to naive resampling of the data. Thus an appropriate value between these extremes should be choosen. We recommend to consult a reference on kernel smoothing when doing so; but it is not a simple problem to determine an optimal bandwidth for distributions with sharp peaks. In general, for most applications it is perfectly ok to use the default values offered. Unless you have some knowledge on density estimation we do not recommend to change anything. There are two exceptions: A. In the case that the unknown underlying distribution is not continuous but discrete you should "turn off" the adding of the noise by setting: unur_empk_set_smoothing(par, 0.) B. In the case that you are especially interested in a fast sampling algorithm use the call unur_empk_set_kernel(par, UNUR_DISTR_BOXCAR); to change the used noise distribution from the default Gaussian distribution to the uniform distribution. Function reference ------------------ -- Function: UNUR_PAR* unur_empk_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_empk_set_kernel (UNUR_PAR* PARAMETERS, unsigned KERNEL) Select one of the supported kernel distributions. Currently the following kernels are supported: ‘UNUR_DISTR_GAUSSIAN’ Gaussian (normal) kernel ‘UNUR_DISTR_EPANECHNIKOV’ Epanechnikov kernel ‘UNUR_DISTR_BOXCAR’ Boxcar (uniform, rectangular) kernel ‘UNUR_DISTR_STUDENT’ t3 kernel (Student’s distribution with 3 degrees of freedom) ‘UNUR_DISTR_LOGISTIC’ logistic kernel For other kernels (including kernels with Student’s distribution with other than 3 degrees of freedom) use the ‘unur_empk_set_kernelgen’ call. It is not possible to call ‘unur_empk_set_kernel’ twice. Default is the Gaussian kernel. -- Function: int unur_empk_set_kernelgen (UNUR_PAR* PARAMETERS, const UNUR_GEN* KERNELGEN, double ALPHA, double KERNELVAR) Set generator for the kernel used for density estimation. ALPHA is used to compute the optimal bandwidth from the point of view of minimizing the mean integrated square error (MISE). It depends on the kernel K and is given by alpha(K) = Var(K)^(-2/5){ \int K(t)^2 dt}^(1/5) For standard kernels (see above) alpha is computed by the algorithm. KERNVAR is the variance of the used kernel. It is only required for the variance corrected version of density estimation (which is used by default); otherwise it is ignored. If KERNELVAR is nonpositive, variance correction is disabled. For standard kernels (see above) KERNVAR is computed by the algorithm. It is not possible to call ‘unur_empk_set_kernelgen’ after a standard kernel has been selected by a ‘unur_empk_set_kernel’ call. Notice that the uniform random number generator of the kernel generator is overwritten during the ‘unur_init’ call and at each ‘unur_chg_urng’ call with the uniform generator used for the empirical distribution. Default is the Gaussian kernel. -- Function: int unur_empk_set_beta (UNUR_PAR* PARAMETERS, double BETA) BETA is used to compute the optimal bandwidth from the point of view of minimizing the mean integrated square error (MISE). BETA depends on the (unknown) distribution of the sampled data points. By default Gaussian distribution is assumed for the sample (BETA = 1.3637439). There is no requirement to change BETA. Default: ‘1.3637439’ -- Function: int unur_empk_set_smoothing (UNUR_PAR* PARAMETERS, double SMOOTHING) -- Function: int unur_empk_chg_smoothing (UNUR_GEN* GENERATOR, double SMOOTHING) Set and change the smoothing factor. The smoothing factor controlles how “smooth†the resulting density estimation will be. A smoothing factor equal to ‘0’ results in naive resampling. A very large smoothing factor (together with the variance correction) results in a density which is approximately equal to the kernel. Default is 1 which results in a smoothing parameter minimising the MISE (mean integrated squared error) if the data are not too far away from normal. If a large smoothing factor is used, then variance correction must be switched on. Default: ‘1’ -- Function: int unur_empk_set_varcor (UNUR_PAR* PARAMETERS, int VARCOR) -- Function: int unur_empk_chg_varcor (UNUR_GEN* GENERATOR, int VARCOR) Switch variance correction in generator on/off. If VARCOR is ‘TRUE’ then the variance of the used density estimation is the same as the sample variance. However this increases the MISE of the estimation a little bit. Default is ‘FALSE’. -- Function: int unur_empk_set_positive (UNUR_PAR* PARAMETERS, int POSITIVE) If POSITIVE is ‘TRUE’ then only nonnegative random variates are generated. This is done by means of a mirroring technique. Default is ‘FALSE’.  File: unuran.info, Node: EMPL, Next: HIST, Prev: EMPK, Up: Methods_for_CEMP 5.4.2 EMPL – EMPirical distribution with Linear interpolation ------------------------------------------------------------- Required: observed sample Speed: Set-up: slow (as sample is sorted), Sampling: very fast (inversion) Reinit: not implemented Reference: [HLa00] [HLD04: Sect.12.1.3] EMPL generates random variates from an empirical distribution that is given by an observed sample. This is done by linear interpolation of the empirical CDF. Although this method is suggested in the books of Law and Kelton (2000) and Bratly, Fox, and Schrage (1987) we do not recommend this method at all since it has many theoretical drawbacks: The variance of empirical distribution function does not coincide with the variance of the given sample. Moreover, when the sample increases the empirical density function does not converge to the density of the underlying random variate. Notice that the range of the generated point set is always given by the range of the given sample. This method is provided in UNU.RAN for the sake of completeness. We always recommend to use method EMPK (*note EMPirical distribution with Kernel smoothing: EMPK.). If the data seem to be far away from having a bell shaped histogram, then we think that naive resampling is still better than linear interpolation. How To Use .......... EMPL creates and samples from an empiral distribution by linear interpolation of the empirical CDF. There are no parameters to set. _Important_: We do not recommend to use this method! Use method EMPK (*note EMPirical distribution with Kernel smoothing: EMPK.) instead. Function reference ------------------ -- Function: UNUR_PAR* unur_empl_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator.  File: unuran.info, Node: HIST, Prev: EMPL, Up: Methods_for_CEMP 5.4.3 HIST – HISTogramm of empirical distribution ------------------------------------------------- Required: histogram Speed: Set-up: moderate, Sampling: fast Reinit: not implemented Method HIST generates random variates from an empirical distribution that is given as histogram. Sampling is done using the inversion method. If observed (raw) data are provided we recommend method EMPK (*note EMPirical distribution with Kernel smoothing: EMPK.) instead of compting a histogram as this reduces information. How To Use .......... Method HIST uses empirical distributions that are given as a histgram. There are no optional parameters. Function reference ------------------ -- Function: UNUR_PAR* unur_hist_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator.  File: unuran.info, Node: Methods_for_CVEC, Next: MCMC_Methods_for_CVEC, Prev: Methods_for_CEMP, Up: Methods 5.5 Methods for continuous multivariate distributions ===================================================== * Menu: * MVSTD:: MultiVariate continuous STandarD distributions * MVTDR:: Multi-Variate Transformed Density Rejection * NORTA:: NORmal To Anything * VNROU:: Multivariate Naive Ratio-Of-Uniforms method Overview of methods ------------------- Methods for continuous multivariate distributions sample with ‘unur_sample_vec’ NORTA: Requires rank correlation matrix and marginal distributions. VNROU: Requires the PDF. MVSTD: Generator for built-in standard distributions. MVTDR: Requires PDF and gradiant of PDF.  File: unuran.info, Node: MVSTD, Next: MVTDR, Up: Methods_for_CVEC 5.5.1 MVSTD – MultiVariate continuous STandarD distributions ------------------------------------------------------------ Required: standard distribution from UNU.RAN library (*note Standard distributions: Stddist.). Speed: depends on distribution and generator Reinit: supported MVSTD is a wrapper for special generators for multivariate continuous standard distributions. It only works for distributions in the UNU.RAN library of standard distributions (*note Standard distributions: Stddist.). If a distribution object is provided that is build from scratch, or if no special generator for the given standard distribution is provided, the ‘NULL’ pointer is returned. How To Use .......... Create a distribution object for a standard distribution from the UNU.RAN library (*note Standard distributions: Stddist.). Sampling from truncated distributions (which can be constructed by changing the default domain of a distribution by means of ‘unur_distr_cvec_set_domain_rect’ call) is not possible. It is possible to change the parameters and the domain of the chosen distribution and run ‘unur_reinit’ to reinitialize the generator object. Function reference ------------------ -- Function: UNUR_PAR* unur_mvstd_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for new generator. It requires a distribution object for a multivariate continuous distribution from the UNU.RAN library of standard distributions (*note Standard distributions: Stddist.). Using a truncated distribution is not possible.  File: unuran.info, Node: MVTDR, Next: NORTA, Prev: MVSTD, Up: Methods_for_CVEC 5.5.2 MVTDR – Multi-Variate Transformed Density Rejection --------------------------------------------------------- Required: log-concave (log)PDF, gradient of (log)PDF Optional: mode Speed: Set-up: slow, Sampling: depends on dimension Reinit: not implemented Reference: [HLD04: Sect.11.3.4; Alg.11.15.] [LJa98] MVTDR a multivariate version of the Transformed Density Rection (*note TDR::) that works for log-concave densities. For this method the domain of the distribution is partitioned into cones with the mode (or the center) of the distribution as their (common) vertex. The hat function is then constructed as tangent planes of the transformed density in each of these cones. The respective construction points lie on the central lines in the cones through the vertex. The point is chosen such that the hat is minimal among all such points (see the given references for more details). The cones are created by starting with the orthants of the reals space. These are then iteratively split when the volume below the hat in such cones is too large. Thus an increasing number of cones results in a better fitting hat function. Notice however, that the required number of cones increases exponentially with the number of dimension. Moreover, due to the construction the rejection does not converge to 1 and remains strictly larger than 1. For distributions with bounded domains the cones are cut to pyramids that cover the domain. How To Use .......... Create a multivariate generator object that contains the PDF and its gradient. This object also should contain the mode of the distribution (or a point nearby should be provided as center of the distribution). The method has three parameter to adjust the method for the given distribution: ‘stepsmin’ Minimal number of iterations for splitting cones. Notice that we start with 2^dim initial cones and that we arrive at 2^(dim+stepsmin) cones after these splits. So this number must be set with care. It can be set by a ‘unur_mvtdr_set_stepsmin’ call. ‘boundsplitting’ Cones where the volume below the hat is relatively large (i.e. larger than the average volume over all cones times ‘boundsplitting’ are further split. This parameter can set via a ‘unur_mvtdr_set_boundsplitting’ call. ‘maxcones’ The maximum number of generated cones. When this number is reached, the initialization routine is stopped. Notice that the rejection constant can be still prohibitive large. This parameter can set via a ‘unur_mvtdr_set_maxcones’ call. Setting of these parameter can be quite tricky. The default settings lead to hat functions where the volume below the hat is similar in each cone. However, there might be some problems with distributions with higher correlations, since then too few cones are created. Then it might be necessary to increase the values for ‘stepsmin’ and ‘maxcones’ and to set ‘boundsplitting’ to ‘0’. The number of cones and the total volume below the hat can be controlled using the respective calls ‘unur_mvtdr_get_ncones’ and ‘unur_mvtdr_get_hatvol’. Notice, that the rejection constant is bounded from below by some figure (larger than 1) that depends on the dimension. Unfortunately, the algorithm cannot detect the quality of the constructed hat. Function reference ------------------ -- Function: UNUR_PAR* unur_mvtdr_new (const UNUR_DISTR* DISTRIBUTION) Get parameters for generator. -- Function: int unur_mvtdr_set_stepsmin (UNUR_PAR* PARAMETERS, int STEPSMIN) Set minimum number of triangulation step for each starting cone. STEPSMIN must be nonnegative. Default: ‘5’. -- Function: int unur_mvtdr_set_boundsplitting (UNUR_PAR* PARAMETERS, double BOUNDSPLITTING) Set bound for splitting cones. All cones are split which have a volume below the hat that is greater than BOUND_SPLITTING times the average over all volumes. However, the number given by the ‘unur_mvtdr_set_maxcones’ is not exceeded. Notice that the later number is always reached if BOUND_SPLITTING is less than 1. Default: ‘1.5’ -- Function: int unur_mvtdr_set_maxcones (UNUR_PAR* PARAMETERS, int MAXCONES) Set maximum number of cones. Notice that this number is always increased to 2^(dim+stepsmin) where dim is the dimension of the distribution object and stepsmin the given mimimum number of triangulation steps. Notice: For higher dimensions and/or higher correlations between the coordinates of the random vector the required number of cones can be very high. A too small maximum number of cones can lead to a very high rejection constant. Default: ‘10000’. -- Function: int unur_mvtdr_get_ncones (const UNUR_GEN* GENERATOR) Get the number of cones used for the hat function of the GENERATOR. (In case of an error ‘0’ is returned.) -- Function: double unur_mvtdr_get_hatvol (const UNUR_GEN* GENERATOR) Get the volume below the hat for the GENERATOR. (In case of an error ‘UNUR_INFINITY’ is returned.) -- Function: int unur_mvtdr_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) -- Function: int unur_mvtdr_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) Turn verifying of algorithm while sampling on/off. If the condition squeeze(x) <= PDF(x) <= hat(x) is violated for some x then ‘unur_errno’ is set to ‘UNUR_ERR_GEN_CONDITION’. However notice that this might happen due to round-off errors for a few values of x (less than 1%). Default is ‘FALSE’.  File: unuran.info, Node: NORTA, Next: VNROU, Prev: MVTDR, Up: Methods_for_CVEC 5.5.3 NORTA – NORmal To Anything -------------------------------- Required: rank correlation matrix, marginal distributions Speed: Set-up: slow, Sampling: depends on dimension Reinit: not implemented Reference: [HLD04: Sect.12.5.2; Alg.12.11.] NORTA (NORmal to anything) is a model to get random vectors with given marginal distributions and rank correlation. *Important:* Notice that marginal distribution and (rank) correlation structure do not uniquely define a multivariate distribution. Thus there are many other (more or less sensible) models. In the NORTA model multinormal random variates with the given (Spearman’s) rank correlations are generated. In a second step the (standard normal distributed) marginal variates are transformed by means of the CDF of the normal distribution to get uniform marginals. The resulting random vectors have uniform marginals and the desired rank correlation between its components. Such a random vector is called ’copula’. By means of the inverse CDF the uniform marginals are then transformed into the target marginal distributions. This transformation does not change the rank correlation. For the generation of the multinormal distribution the (Spearman’s) rank correlation matrix is transformed into the corresponding (Pearson) correlation matrix. Samples from the resulting multinormal distribution are generated by means of the Cholesky decomposition of the covariance matrix. It can happen that the desired rank correlation matrix is not feasible, i.e., it cannot occur as rank correlation matrix of a multinormal distribution. The resulting "covariance" matrix is not positive definite. In this case an eigenvector correction method is used. Then all non-positive eigenvalues are set to a small positive value and hence the rank correlation matrix of the generated random vectors is "close" to the desired matrix. How To Use .......... Create a multivariate generator object and set marginal distributions using ‘unur_distr_cvec_set_marginals’, ‘unur_distr_cvec_set_marginal_array’ , or ‘unur_distr_cvec_set_marginal_list’. (Do not use the corresponding calls for the standard marginal distributions). When the domain of the multivariate distribution is set by of a ‘unur_distr_cvec_set_domain_rect’ call then the domain of each of the marginal distributions is truncated by the respective coordinates of the given rectangle. If copulae are required (i.e. multivariate distributions with uniform marginals) such a generator object can be created by means of ‘unur_distr_copula’ . There are no optional parameters for this method. Function reference ------------------ -- Function: UNUR_PAR* unur_norta_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator.  File: unuran.info, Node: VNROU, Prev: NORTA, Up: Methods_for_CVEC 5.5.4 VNROU – Multivariate Naive Ratio-Of-Uniforms method --------------------------------------------------------- Required: PDF Optional: mode, center, bounding rectangle for acceptance region Speed: Set-up: fast or slow, Sampling: slow Reinit: supported Reference: [WGS91] VNROU is an implementation of the multivariate ratio-of-uniforms method which uses a (minimal) bounding hyper-rectangle, see also *note Ratio-of-Uniforms::. It uses an additional parameter r that can be used for adjusting the algorithm to the given distribution to improve performance and/or to make this method applicable. Larger values of r increase the class of distributions for which the method works at the expense of higher rejection constants. Moreover, this implementation uses the center mu of the distribution (which is set to the mode or mean by default, see ‘unur_distr_cvec_get_center’ for details of its default values). The minimal bounding has then the coordinates v^+ = sup_(x) (f(x))^(1/r d+1), u^-_i = inf_(x_i) (x_i- mu_i) (f(x))^(r/r d+1), u^+_i = sup_(x_i) (x_i- mu_i) (f(x))^(r/r d+1), where x_i is the i-th coordinate of point x; mu_i is the i-th coordinate of the center mu. d denotes the dimension of the distribution. These bounds can either be given directly, or are computed automatically by means of an numerical routine by Hooke and Jeeves [HJa61] called direct search (see ‘src/utils/hooke.c’ for further references and details). Of course this algorithm can fail, especially when this rectangle is not bounded. It is important to note that the algorithm works with PDF(x-center) instead of PDF(x), i.e. the bounding rectangle has to be provided for PDF(x-center). This is important as otherwise the acceptance region can become a very long and skinny ellipsoid along a diagonal of the (huge) bounding rectangle. VNROU is based on the rejection method (*note Rejection::), and it is important to note that the acceptance probability decreases exponentially with dimension. Thus even for moderately many dimensions (e.g. 5) the number of repetitions to get one random vector can be prohibitively large and the algorithm seems to stay in an infinite loop. How To Use .......... For using the VNROU method UNU.RAN needs the PDF of the distribution. Additionally, the parameter r can be set via a ‘unur_vnrou_set_r’ call. Notice that the acceptance probability decreases when r is increased. On the other hand is is more unlikely that the bounding rectangle does not exist if r is small. A bounding rectangle can be given by the ‘unur_vnrou_set_u’ and ‘unur_vnrou_set_v’ calls. _Important:_ The bounding rectangle has to be provided for the function PDF(x-center)! Notice that ‘center’ is the center of the given distribution, see ‘unur_distr_cvec_set_center’. If in doubt or if this value is not optimal, it can be changed (overridden) by a ‘unur_distr_cvec_set_center’ call. If the coordinates of the bounding rectangle are not provided by the user then the minimal bounding rectangle is computed automatically. By means of ‘unur_vnrou_set_verify’ and ‘unur_vnrou_chg_verify’ one can run the sampling algorithm in a checking mode, i.e., in every cycle of the rejection loop it is checked whether the used rectangle indeed enclosed the acceptance region of the distribution. When in doubt (e.g., when it is not clear whether the numerical routine has worked correctly) this can be used to run a small Monte Carlo study. *Important:* The rejection constant (i.e. the expected number of iterations for generationg one random vector) can be extremely high, in particular when the dimension is 4 or higher. Then the algorithm will perform almost infinite loops. Thus it is recommended to read the volume below the hat function by means of the ‘unur_vnrou_get_volumehat’ call. The returned number divided by the volume below the PDF (which is 1 in case of a normalized PDF) gives the rejection constant. It is possible to change the parameters and the domain of the chosen distribution and run ‘unur_reinit’ to reinitialize the generator object. Notice, that the coordinates of a bounding rectangle given by ‘unur_vnrou_set_u’ and ‘unur_vnrou_set_v’ calls are used also when the generator is reused. These can be changed by means of ‘unur_vnrou_chg_u’ and ‘unur_vnrou_chg_v’ calls. (If no such coordinates have been given, then they are computed numerically during the reinitialization proceedure.) Function reference ------------------ -- Function: UNUR_PAR* unur_vnrou_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_vnrou_set_u (UNUR_PAR* PARAMETERS, double* UMIN, double* UMAX) Sets left and right boundaries of bounding hyper-rectangle. If no values are given, the boundary of the minimal bounding hyper-rectangle is computed numerically. *Important*: The boundaries are those of the density shifted by the center of the distribution, i.e., for the function PDF(x-center)! _Notice_: Computing the minimal bounding rectangle may fail under some circumstances. Moreover, for multimodal distributions the bounds might be too small as only local extrema are computed. Nevertheless, for log-concave distributions it should work. Default: not set (i.e. computed automatically) -- Function: int unur_vnrou_chg_u (UNUR_GEN* GENERATOR, double* UMIN, double* UMAX) Change left and right boundaries of bounding hyper-rectangle. -- Function: int unur_vnrou_set_v (UNUR_PAR* PARAMETERS, double VMAX) Set upper boundary for bounding hyper-rectangle. If no values are given, the density at the mode is evaluated. If no mode is given for the distribution it is computed numerically (and might fail). Default: not set (i.e. computed automatically) -- Function: int unur_vnrou_chg_v (UNUR_GEN* GENERATOR, double VMAX) Change upper boundary for bounding hyper-rectangle. -- Function: int unur_vnrou_set_r (UNUR_PAR* PARAMETERS, double R) Sets the parameter R of the generalized multivariate ratio-of-uniforms method. _Notice_: This parameter must satisfy R>0. Default: ‘1’. -- Function: int unur_vnrou_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) Turn verifying of algorithm while sampling on/off. If the condition PDF(x) <= hat(x) is violated for some x then ‘unur_errno’ is set to ‘UNUR_ERR_GEN_CONDITION’. However notice that this might happen due to round-off errors for a few values of x (less than 1%). Default is ‘FALSE’. -- Function: int unur_vnrou_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) Change the verifying of algorithm while sampling on/off. -- Function: double unur_vnrou_get_volumehat (const UNUR_GEN* GENERATOR) Get the volume of below the hat. For normalized densities, i.e. when the volume below PDF is 1, this value equals the rejection constant for the vnrou method. In case of an error UNUR_INFINITY is returned.  File: unuran.info, Node: MCMC_Methods_for_CVEC, Next: Methods_for_CVEMP, Prev: Methods_for_CVEC, Up: Methods 5.6 Markov chain samplers for continuous multivariate distributions =================================================================== * Menu: * GIBBS:: Markov Chain - GIBBS sampler * HITRO:: Markov Chain - HIT-and-run sampler with Ratio-Of-uniforms Markov chain samplers generate sequences of random vectors which have the target distribution as stationary distribution. There generated vectors are (more or less) correlated and it might take a long time until the sequence has converged to the given target distribution. *Beware: MCMC sampling can be dangerous!* Overview of methods ------------------- Markov Chain Methods for continuous multivariate distributions sample with ‘unur_sample_vec’ GIBBS: T-concave logPDF and derivatives of logPDF. HITRO: Requires PDF.  File: unuran.info, Node: GIBBS, Next: HITRO, Up: MCMC_Methods_for_CVEC 5.6.1 GIBBS – Markov Chain - GIBBS sampler ------------------------------------------ Required: T-concave logPDF, derivatives of logPDF Speed: Set-up: fast, Sampling: moderate Reinit: not implemented Reference: [HLD04: Sect.14.1.2] Method GIBBS implements a Gibbs sampler for a multivariate distribution with given joint density and its gradient. When running such a Markov chain all coordinates are updated cyclically using full conditional distributions. After each step the state of the chain is returned (i.e., a random point is returned whenever a single coordinate has been updated). It is also possible to return only points after all coordinates have been updated by "thinning" the chain. Moreover, to reduce autocorrelation this thinning factor can be any integer. Notice, however, that the sampling time for a chain of given length is increased by the same factor, too. GIBBS also provides a variant of the Gibbs sampler where in each step a point from the full conditional distribution along some random direction is sampled. This direction is chosen uniformly from the sphere in each step. This method is also known as Hit-and-Run algorithm for non-uniform distributions. Our experiences shows that the original Gibbs sampler with sampling along coordinate axes is superior to random direction sampling as long as the correlations between the components of the random vector are not too high. For both variants transformed density rejection (see methods *note TDR:: and *note ARS::) is used to sample from the full conditional distributions. In opposition to the univariate case, it is important that the factor ‘c’ is as large as possible. I.e., for a log-concave density ‘c’ must be set to ‘0.’, since otherwise numerical underflow might stop the algorithm. _Important:_ GIBBS does not generate independent random points. The starting point of the Gibbs chain must be in a "typical" region of the target distribution. If such a point is not known or would be too expensive, then the first part of the chain should be discarded (burn-in of the chain). How To Use .......... For using the GIBBS method UNU.RAN needs the logarithm of the PDF of the multivariate joint distribution and its gradient or partial derivatives. It provides two variants: _coordinate direction sampling (Gibbs sampling) [default]_ The coordinates are updated cyclically. It requires the partial derivatives of the (logarithm of the) PDF of the target distribution, see ‘unur_distr_cvec_set_pdlogpdf’. Otherwise, the gradient of the logPDF (see ‘unur_distr_cvec_set_dlogpdf’ ) is used, which is more expensive. This variant can be selected using ‘unur_gibbs_set_variant_coordinate’. _random direction sampling (nonuniform Hit-and-Run algorithm)_ In each step is a direction is sampled uniformly from the sphere and the next point in the chain is sampled from the full conditional distribution along this direction. It requires the gradient of the logPDF and thus each step is more expensive than each step for coordinate direction sampling. This variant can be selected using ‘unur_gibbs_set_variant_random_direction’. It is important that the ‘c’ parameter for the TDR method is as large as possible. For logconcave distribution it must be set to ‘0’, since otherwise numerical underflow can cause the algorithm to stop. The starting point of the Gibbs chain must be "typical" for the target distribution. If such a point is not known or would be too expensive, then the first part of the chain should be discarded (burn-in of the chain). When using the ‘unur_gibbs_set_burnin’ call this is done during the setup of the Gibbs sampler object. In case of a fatal error in the generator for conditional distributions the methods generates points that contain UNUR_INFINITY. *Warning:* The algorithm requires that all full conditionals for the given distribution object are T-concave. However, this property is not checked. If this property is not satisfied, then generation from the conditional distributions becomes (very) slow and might fail or (even worse) produces random vectors from an incorrect distribution. When using ‘unur_gibbs_set_burnin’ then the setup already might fail. Thus when in doubt whether GIBBS can be used for the targent distribution it is a good idea to use a burn-in for checking. _Remark:_ It might happen (very rarely) that the chain becomes stuck due to numerical errors. (This is in particular the case when the given PDF does not fulfill the condition of this method.) When this happens during burn-in then the setup is aborted (i.e. it fails). Otherwise the chain restarts again from its starting point. *Warning:* Be carefull with debugging flags. If it contains flag ‘0x01000000u’ it produces a lot of output for each step in the algorithm. (This flag is switched of in the default debugging flags). Function reference ------------------ -- Function: UNUR_PAR* unur_gibbs_new (const UNUR_DISTR* DISTRIBUTION) ........................................................................... -- Function: int unur_gibbs_set_variant_coordinate (UNUR_PAR* PARAMETERS) Coordinate Direction Sampling: Sampling along the coordinate directions (cyclic). This is the default. -- Function: int unur_gibbs_set_variant_random_direction (UNUR_PAR* PARAMETERS) Random Direction Sampling: Sampling along the random directions. -- Function: int unur_gibbs_set_c (UNUR_PAR* PARAMETERS, double C) Set parameter C for transformation T of the transformed density rejection method. Currently only values between ‘0’ and ‘-0.5’ are allowed. If ‘c’ is between ‘0’ and ‘-0.5’ it is set to ‘-0.5’. For C ‘=0’ (for logconcave densities) method ARS (*note ARS::) is used which is very robust against badly normalized PDFs. For other values method TDR (*note TDR::) is used. The value for C should be as large as possible to avoid fatal numerical underflows. Thus for log-concave distributions C must be set to ‘0.’ Default is ‘0’. -- Function: int unur_gibbs_set_startingpoint (UNUR_PAR* PARAMETERS, const DOUBLE* X0) Sets the starting point of the Gibbs sampler. X0 must be a "typical" point of the given distribution. If such a "typical" point is not known and a starting point is merely guessed, the first part of the Gibbs chain should be discarded (_burn-in_), e.g.\ by mean of the ‘unur_gibbs_set_burnin’ call. Default is the result of ‘unur_distr_cvec_get_center’ for the given distribution object. -- Function: int unur_gibbs_set_thinning (UNUR_PAR* PARAMETERS, int THINNING) Sets the THINNING parameter. When THINNING is set to k then every k-th point from the iteration is returned by the sampling algorithm. _Notice_: This parameter must satisfy THINNING>=1. Default: ‘1’. -- Function: int unur_gibbs_set_burnin (UNUR_PAR* PARAMETERS, int BURNIN) If a "typical" point for the target distribution is not known but merely guessed, the first part of the Gibbs chain should be discarded (_burn-in_). This can be done during the initialization of the generator object. The length of the burn-in can is then BURNIN. When method GIBBS is not applicable for the target distribution then the initialization already might fail during the burn-in. Thus this reduces the risk of running a generator that returns UNUR_INFINITY cased by some fatal error during sampling. The thinning factor set by a ‘unur_gibbs_set_thinning’ call has no effect on the length of the burn-in, i.e., for the burn-in always a thinning factor ‘1’ is used. _Notice_: This parameter must satisfy THINNING>=0. Default: ‘0’. -- Function: const double* unur_gibbs_get_state (UNUR_GEN* GENERATOR) -- Function: int unur_gibbs_chg_state (UNUR_GEN* GENERATOR, const DOUBLE* STATE) Get and change the current state of the Gibbs chain. -- Function: int unur_gibbs_reset_state (UNUR_GEN* GENERATOR) Reset state of chain to starting point. _Notice:_ Currently this function does not reset the generators for conditional distributions. Thus it is not possible to get the same Gibbs chain even when the underlying uniform random number generator is reset.  File: unuran.info, Node: HITRO, Prev: GIBBS, Up: MCMC_Methods_for_CVEC 5.6.2 HITRO – Markov Chain - HIT-and-run sampler with Ratio-Of-uniforms ----------------------------------------------------------------------- Required: PDF Optional: mode, center, bounding rectangle for acceptance region Speed: Set-up: fast, Sampling: fast Reinit: not implemented Reference: [KLPa05] HITRO is an implementation of a hit-and-run sampler that runs on the acceptance region of the multivariate ratio-of-uniforms method, see *note Ratio-of-Uniforms::. The Ratio-of-Uniforms transforms the region below the density into some region that we call "region of acceptance" in the following. The minimal bounding hyperrectangle of this region is given by v^+ = sup_(x) (f(x))^(1/r d+1), u^-_i = inf_(x_i) (x_i- mu_i) (f(x))^(r/r d+1), u^+_i = sup_(x_i) (x_i- mu_i) (f(x))^(r/r d+1), where d denotes the dimension of the distribution; x_i is the i-th coordinate of point x; mu_i is the i-th coordinate of the center mu of the distribution, i.e., a point in the "main region" of the distribution. Using the center is important, since otherwise the acceptance region can become a very long and skinny ellipsoid along a diagonal of the (huge) bounding rectangle. For each step of the Hit-and-Run algorithm we have to choose some direction. This direction together with the current point of the chain determines a straight line. Then a point is sampled uniformly on intersection of this line and the region of acceptance. This is done by rejection from a uniform distribution on a line segment that covers it. Depending of the chosen variant the endpoints of this covering line are computed either by means of a (not necessary minimal) bounding hyper-rectangle, or just the "covering plate" of the bounding hyper-rectangle. The required bounds of the hyper-rectable can be given directly by the user. Otherwise, these are computed automatically by means of a numerical routine by Hooke and Jeeves [HJa61] called direct search (see ‘src/utils/hooke.c’ for further references and details). However, this expensive computation can be avoided by determine these bounds "on the fly" by the following adaptive algorithm: Start with some (small) hyper-rectangle and enlarge it whenever the endpoints of the covering line segment are not contained in the acceptance region of the Ratio-of-Unfiorms method. This approach works reliable as long as the region of acceptance is convex. The performance of the uniform sampling from the line segment is much improved if the covering line is adjusted (shortened) whenever a point is rejected (adaptive sampling). This technique reduces the expected number of iterations enormously. Method HITRO requires that the region of acceptance of the Ratio-of-Uniforms method is bounded. The shape of this region can be controlled by a parameter r. Higher values of r result in larger classes of distributions with bounded region of acceptance. (A distribution that has such a bounded region for some r also has a bounded region for every r’ greater than r.) On the other hand the acceptance probability decreases with increasing r. Moreover, round-off errors are more likely and (for large values of r) might result in a chain with a stationary distribution different from the target distribution. Method HITRO works optimal for distributions whose region of acceptance is convex. This is in particular the case for all log-concave distributions when we set r = ‘1’. For bounded but non-convex regions of acceptance convergence is yet not guarenteed by mathematical theory. How To Use .......... Method HITRO requires the PDF of the target distribution (derivatives are not necessary). The acceptance region of the Ratio-of-Uniforms transformation must be bounded. Its shape is controlled by parameter r. By default this parameter is set to ‘1’ as this guarentees a convex region of acceptance when the PDF of the given distribution is log-concave. It should only be set to a different (higher!) value using ‘unur_vnrou_set_r’ if otherwise x_i (f(x))^(r/r d+1) were not bounded for each coordinate. There are two variants of the HITRO sampler: _coordinate direction sampling. [default]_ The coordinates are updated cyclically. This can be seen as a Gibbs sampler running on the acceptance region of the Ratio-of-Uniforms method. This variant can be selected using ‘unur_hitro_set_variant_coordinate’. _random direction sampling._ In each step is a direction is sampled uniformly from the sphere. This variant can be selected using ‘unur_hitro_set_variant_random_direction’. Notice that each iteration of the coordinate direction sampler is cheaper than an iteration of the random direction sampler. Sampling uniformly from the line segment can be adjusted in several ways: _Adaptive line sampling vs. simple rejection._ When adaptive line sampling is switched on, the covering line is shortened whenever a point is rejected. However, when the region of acceptance is not convex the line segment from which we have to sample might not be connected. We found that the algorithm still works but at the time being there is no formal proof that the generated Markov chain has the required stationary distribution. Adaptive line sampling can switch on/off by means of the ‘unur_hitro_set_use_adaptiveline’ call. _Bounding hyper-rectangle vs. "covering plate"._ For computing the covering line we can use the bounding hyper-rectangle or just its upper bound. The latter saves computing time during the setup and when computing the covering during at each iteration step at the expense of a longer covering line. When adaptive line sampling is used the total generation time for the entire chain is shorter when only the "covering plate" is used. _Notice:_ When coordinate sampling is used the entire bounding rectangle is used. Using the entire bounding hyper-rectangle can be switched on/off by means of the ‘unur_hitro_set_use_boundingrectangle’ call. _Deterministic vs. adaptive bounding hyper-rectangle._ A bounding rectangle can be given by the ‘unur_vnrou_set_u’ and ‘unur_vnrou_set_v’ calls. Otherwise, the minimal bounding rectangle is computed automatically during the setup by means of a numerical algorithm. However, this is (very) slow especially in higher dimensions and it might happen that this algorithm (like any other numerical algorithm) does not return a correct result. Alternatively the bounding rectangle can be computed adaptively. In the latter case ‘unur_vnrou_set_u’ and ‘unur_vnrou_set_v’ can be used to provide a starting rectangle which must be sufficiently small. Then both endpoints of the covering line segment are always check whether they are outside the acceptance region of the Ratio-of-Uniforms method. If they are not, then the line segment and the ("bounding") rectangle are enlarged using a factor that can be given using the ‘unur_hitro_set_adaptive_multiplier’ call. Notice, that running this method in the adaptive rectangle mode requires that the region of acceptance is convex when random directions are used, or the given PDF is unimodal when coordinate direction sampling is used. Moreover, it requires two additional calls to the PDF in each iteration step of the chain. Using addaptive bounding rectangles can be switched on/off by means of the ‘unur_hitro_set_use_adaptiverectangle’ call. The algorithm takes of a bounded rectangular domain given by a ‘unur_distr_cvec_set_domain_rect’ call, i.e. the PDF is set to zero for every x outside the given domain. However, it is only the coordinate direction sampler where the boundary values are directly used to get the endpoins of the coverline line for the line sampling step. _Important:_ The bounding rectangle has to be provided for the function PDF(x-center)! Notice that ‘center’ is the center of the given distribution, see ‘unur_distr_cvec_set_center’. If in doubt or if this value is not optimal, it can be changed (overridden) by a ‘unur_distr_cvec_set_center’ call. Function reference ------------------ -- Function: UNUR_PAR* unur_hitro_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_hitro_set_variant_coordinate (UNUR_PAR* PARAMETERS) Coordinate Direction Sampling: Sampling along the coordinate directions (cyclic). _Notice:_ For this variant the entire bounding rectangle is always used independent of the ‘unur_hitro_set_use_boundingrectangle’ call. This is the default. -- Function: int unur_hitro_set_variant_random_direction (UNUR_PAR* PARAMETERS) Random Direction Sampling: Sampling along the random directions. -- Function: int unur_hitro_set_use_adaptiveline (UNUR_PAR* PARAMETERS, int ADAPTIVE) When ADAPTIVE is set to ‘TRUE’ adaptive line sampling is applied, otherwise simple rejection is used. _Notice:_ When adaptive line sampling is switched off, the entire bounding rectangle must be used since otherwise the sampling time can be arbitrarily slow. _Warning:_ When adaptive line sampling is switched off, sampling can be arbitrarily slow. In particular this happens when random direction sampling is used for distributions with rectangular domains. Then the algorithm can be trapped into a vertex (or even edge). Default is ‘TRUE’. -- Function: int unur_hitro_set_use_boundingrectangle (UNUR_PAR* PARAMETERS, int RECTANGLE) When RECTANGLE is set to ‘TRUE’ the entire bounding rectangle is used for computing the covering line. Otherwise, only an upper bound for the acceptance region is used. _Notice:_ When coordinate sampling is used the entire bounding rectangle has is always used and this call has no effect. Default: ‘FALSE’ for random direction samplig, ‘TRUE’ for coordinate direction sampling. -- Function: int unur_hitro_set_use_adaptiverectangle (UNUR_PAR* PARAMETERS, int ADAPTIVE) When ADAPTIVE is set to ‘FALSE’ the bounding rectangle is determined during the setup. Either, it is computed automatically by a (slow) numerical method, or it must be provided by ‘unur_vnrou_set_u’ and ‘unur_vnrou_set_v’ calls. If ADAPTIVE is set to ‘TRUE’ the bounding rectangle is computed adaptively. In this case the ‘unur_vnrou_set_u’ and ‘unur_vnrou_set_v’ calls can be used to provide a starting rectangle. This should be sufficiently small. If not given then we assume v_(max) = 1, u_(min)=(-0.001,-0.001,...,-0.001), and u_(max)=(0.001,0.001,...,0.001). Adaptive enlargements of the bounding hyperrectangle can be controlled set setting an enlargement factor given by a ‘unur_hitro_set_adaptive_multiplier’ call. Using adaptive computation of the bounding rectangle reduces the setup time significantly (when it is not given by the user) at the expense of two additional PDF evaluations during each iteration step. _Important:_ Using adaptive bounding rectangles requires that the region of acceptance is convex when random directions are used, or a unimodal PDF when coordinate direction sampling is used. Default: ‘FALSE’ for random direction samplig, ‘TRUE’ for coordinate direction sampling. -- Function: int unur_hitro_set_r (UNUR_PAR* PARAMETERS, double R) Sets the parameter R of the generalized multivariate ratio-of-uniforms method. _Notice_: This parameter must satisfy R>0. Default: ‘1’. -- Function: int unur_hitro_set_v (UNUR_PAR* PARAMETERS, double VMAX) Set upper boundary for bounding hyper-rectangle. If not set not set the mode of the distribution is used. If adaptive bounding rectangles the value is used for the starting rectangle. If not given (and the mode of the distribution is not known) then VMAX=‘1e-3’ is used. If deterministic bounding rectangles these values are the given values are used for the rectangle. If no value is given (and the mode of the distribution is not known), the upper bound of the minimal bounding hyper-rectangle is computed numerically (slow). Default: not set. -- Function: int unur_hitro_set_u (UNUR_PAR* PARAMETERS, const DOUBLE* UMIN, const DOUBLE* UMAX) Sets left and right boundaries of bounding hyper-rectangle. If adaptive bounding rectangles these values are used for the starting rectangle. If not given then UMIN=‘{-b,-b,...,-b}’ and UMAX=‘{b,b,...,b}’ with ‘b=1.e-3’ is used. If deterministic bounding rectangles these values are the given values are used for the rectangle. If no values are given, the boundary of the minimal bounding hyper-rectangle is computed numerically (slow). *Important*: The boundaries are those of the density shifted by the center of the distribution, i.e., for the function PDF(x-center)! _Notice_: Computing the minimal bounding rectangle may fail under some circumstances. Moreover, for multimodal distributions the bounds might be too small as only local extrema are computed. Nevertheless, for log-concave distributions it should work. Default: not set. -- Function: int unur_hitro_set_adaptive_multiplier (UNUR_PAR* PARAMETERS, double FACTOR) Adaptive enlargements of the bounding hyperrectangle can be controlled set setting the enlargement FACTOR. This must be greater than 1. Values close to 1 result in small adaptive steps and thus reduce the risk of too large bounding rectangles. On the other hand many adaptive steps might be necessary. _Notice:_ For practical reasons this call does not accept values for FACTOR less than ‘1.0001’. If this value is UNUR_INFINITY this results in infinite loops. Default: ‘1.1’ -- Function: int unur_hitro_set_startingpoint (UNUR_PAR* PARAMETERS, const DOUBLE* X0) Sets the starting point of the HITRO sampler in the original scale. X0 must be a "typical" point of the given distribution. If such a "typical" point is not known and a starting point is merely guessed, the first part of the HITRO chain should be discarded (_burn-in_), e.g.\ by mean of the ‘unur_hitro_set_burnin’ call. _Important:_ The PDF of the distribution must not vanish at the given point X0. Default is the result of ‘unur_distr_cvec_get_center’ for the given distribution object. -- Function: int unur_hitro_set_thinning (UNUR_PAR* PARAMETERS, int THINNING) Sets the THINNING parameter. When THINNING is set to k then every k-th point from the iteration is returned by the sampling algorithm. If thinning has to be set such that each coordinate is updated when using coordinate direction sampling, then THINNING should be ‘dim+1’ (or any multiple of it) where ‘dim’ is the dimension of the distribution object. _Notice_: This parameter must satisfy THINNING>=1. Default: ‘1’. -- Function: int unur_hitro_set_burnin (UNUR_PAR* PARAMETERS, int BURNIN) If a "typical" point for the target distribution is not known but merely guessed, the first part of the HITRO chain should be discarded (_burn-in_). This can be done during the initialization of the generator object. The length of the burn-in can is then BURNIN. The thinning factor set by a ‘unur_hitro_set_thinning’ call has no effect on the length of the burn-in, i.e., for the burn-in always a thinning factor ‘1’ is used. _Notice_: This parameter must satisfy THINNING>=0. Default: ‘0’. -- Function: const double* unur_hitro_get_state (UNUR_GEN* GENERATOR) -- Function: int unur_hitro_chg_state (UNUR_GEN* GENERATOR, const DOUBLE* STATE) Get and change the current state of the HITRO chain. _Notice:_ The state variable contains the point in the ‘dim+1’ dimensional point in the (tansformed) region of acceptance of the Ratio-of-Uniforms method. Its coordinate are stored in the following order: ‘state[] = {v, u1, u2, ..., udim}’. If the state can only be changed if the given STATE is inside this region. -- Function: int unur_hitro_reset_state (UNUR_GEN* GENERATOR) Reset state of chain to starting point. _Notice:_ Currently this function does not reset the generators for conditional distributions. Thus it is not possible to get the same HITRO chain even when the underlying uniform random number generator is reset.  File: unuran.info, Node: Methods_for_CVEMP, Next: Methods_for_DISCR, Prev: MCMC_Methods_for_CVEC, Up: Methods 5.7 Methods for continuous empirical multivariate distributions =============================================================== * Menu: * VEMPK:: (Vector) EMPirical distribution with Kernel smoothing Overview of methods ------------------- Methods for continuous empirical multivariate distributions sample with ‘unur_sample_vec’ VEMPK: Requires an observed sample. Example ------- /* ------------------------------------------------------------- */ /* File: example_vemp.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* Example how to sample from an empirial continuous */ /* multivariate distribution. */ /* ------------------------------------------------------------- */ int main(void) { int i; /* 4 data points of dimension 2 */ double data[] = { 1. ,1., /* 1st data point */ -1.,1., /* 2nd data point */ 1.,-1., /* 3rd data point */ -1.,-1. }; /* 4th data point */ double result[2]; /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Create a distribution object with dimension 2. */ distr = unur_distr_cvemp_new( 2 ); /* Set empirical sample. */ unur_distr_cvemp_set_data(distr, data, 4); /* Choose a method: VEMPK. */ par = unur_vempk_new(distr); /* Use variance correction. */ unur_vempk_set_varcor( par, 1 ); /* Create the generator object. */ gen = unur_init(par); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) { unur_sample_vec(gen, result); printf("(%f,%f)\n", result[0], result[1]); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ Example (String API) -------------------- (not implemented)  File: unuran.info, Node: VEMPK, Up: Methods_for_CVEMP 5.7.1 VEMPK – (Vector) EMPirical distribution with Kernel smoothing ------------------------------------------------------------------- Required: observed sample Speed: Set-up: slow, Sampling: slow (depends on dimension) Reinit: not implemented Reference: [HLa00] [HLD04: Sect.12.2.1] VEMPK generates random variates from a multivariate empirical distribution that is given by an observed sample. The idea is that simply choosing a random point from the sample and to return it with some added noise results in a method that has very nice properties, as it can be seen as sampling from a kernel density estimate. Clearly we have to decide about the density of the noise (called kernel) and about the covariance matrix of the noise. The mathematical theory of kernel density estimation shows us that we are comparatively free in choosing the kernel. It also supplies us with a simple formula to compute the optimal standarddeviation of the noise, called bandwidth (or window width) of the kernel. Currently only a Gaussian kernel with the same covariance matrix as the given sample is implemented. However it is possible to choose between a variance corrected version or those with optimal MISE. Additionally a smoothing factor can be set to adjust the estimated density to non-bell-shaped data densities. How To Use .......... VEMPK uses empirical distributions. The main parameter would be the choice if of kernel density. However, currently only Gaussian kernels are supported. The parameters for the density are computed by a simple but robust method. However, it is possible to control its behavior by changing the smoothing factor. Additionally, variance correction can be swithed on (at the price of suboptimal MISE). Function reference ------------------ -- Function: UNUR_PAR* unur_vempk_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_vempk_set_smoothing (UNUR_PAR* PARAMETERS, double SMOOTHING) -- Function: int unur_vempk_chg_smoothing (UNUR_GEN* GENERATOR, double SMOOTHING) Set and change the smoothing factor. The smoothing factor controlles how “smooth†the resulting density estimation will be. A smoothing factor equal to 0 results in naive resampling. A very large smoothing factor (together with the variance correction) results in a density which is approximately equal to the kernel. Default is 1 which results in a smoothing parameter minimising the MISE (mean integrated squared error) if the data are not too far away from normal. If a large smoothing factor is used, then variance correction must be switched on. Default: ‘1’ -- Function: int unur_vempk_set_varcor (UNUR_PAR* PARAMETERS, int VARCOR) -- Function: int unur_vempk_chg_varcor (UNUR_GEN* GENERATOR, int VARCOR) Switch variance correction in generator on/off. If VARCOR is ‘TRUE’ then the variance of the used density estimation is the same as the sample variance. However this increases the MISE of the estimation a little bit. Default is ‘FALSE’.  File: unuran.info, Node: Methods_for_DISCR, Next: Methods_for_MATR, Prev: Methods_for_CVEMP, Up: Methods 5.8 Methods for discrete univariate distributions ================================================= * Menu: * DARI:: Discrete Automatic Rejection Inversion * DAU:: (Discrete) Alias-Urn method * DEXT:: wrapper for Discrete EXTernal generators * DGT:: (Discrete) Guide Table method (indexed search) * DSROU:: Discrete Simple Ratio-Of-Uniforms method * DSS:: (Discrete) Sequential Search method * DSTD:: Discrete STandarD distributions Overview of methods ------------------- Methods for discrete univariate distributions sample with ‘unur_sample_discr’ method PMF PV mode sum other DARI x x ~ T-concave DAU [x] x DEXT wrapper for external generator DGT [x] x DSROU x x x T-concave DSS [x] x x DSTD build-in standard distribution Example ------- /* ------------------------------------------------------------- */ /* File: example_discr.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* Example how to sample from a discrete univariate distribution.*/ /* ------------------------------------------------------------- */ int main(void) { int i; double param = 0.3; double probvec[10] = {1.0, 2.0, 3.0, 4.0, 5.0,\ 6.0, 7.0, 8.0, 4.0, 3.0}; /* Declare the three UNURAN objects. */ UNUR_DISTR *distr1, *distr2; /* distribution objects */ UNUR_PAR *par1, *par2; /* parameter objects */ UNUR_GEN *gen1, *gen2; /* generator objects */ /* First distribution: defined by PMF. */ distr1 = unur_distr_geometric(¶m, 1); unur_distr_discr_set_mode(distr1, 0); /* Choose a method: DARI. */ par1 = unur_dari_new(distr1); gen1 = unur_init(par1); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen1 == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* Second distribution: defined by (finite) PV. */ distr2 = unur_distr_discr_new(); unur_distr_discr_set_pv(distr2, probvec, 10); /* Choose a method: DGT. */ par2 = unur_dgt_new(distr2); gen2 = unur_init(par2); if (gen2 == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* print some random integers */ for (i=0; i<10; i++){ printf("number %d: %d\n", i*2, unur_sample_discr(gen1) ); printf("number %d: %d\n", i*2+1, unur_sample_discr(gen2) ); } /* Destroy all objects. */ unur_distr_free(distr1); unur_distr_free(distr2); unur_free(gen1); unur_free(gen2); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ Example (String API) -------------------- /* ------------------------------------------------------------- */ /* File: example_discr_str.c */ /* ------------------------------------------------------------- */ /* String API. */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* Example how to sample from a discrete univariate distribution.*/ /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ /* Declare UNURAN generator objects. */ UNUR_GEN *gen1, *gen2; /* generator objects */ /* First distribution: defined by PMF. */ gen1 = unur_str2gen("geometric(0.3); mode=0 & method=dari"); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen1 == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* Second distribution: defined by (finite) PV. */ gen2 = unur_str2gen( "distr=discr; pv=(1,2,3,4,5,6,7,8,4,3) & method=dgt"); if (gen2 == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* print some random integers */ for (i=0; i<10; i++){ printf("number %d: %d\n", i*2, unur_sample_discr(gen1) ); printf("number %d: %d\n", i*2+1, unur_sample_discr(gen2) ); } /* Destroy all objects. */ unur_free(gen1); unur_free(gen2); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */  File: unuran.info, Node: DARI, Next: DAU, Up: Methods_for_DISCR 5.8.1 DARI – Discrete Automatic Rejection Inversion --------------------------------------------------- Required: T-concave PMF, mode, approximate area Speed: Set-up: moderate, Sampling: fast Reinit: supported Reference: [HDa96] [HLD04: Sect.10.2; Alg.10.4] DARI is based on rejection inversion, which can be seen as an adaptation of transformed density rejection to discrete distributions. The used transformation is -1/sqrt(x) . DARI uses three almost optimal points for constructing the (continuous) hat. Rejection is then done in horizontal direction. Rejection inversion uses only one uniform random variate per trial. DARI has moderate set-up times (the PMF is evaluated nine times), and good marginal speed, especially if an auxiliary array is used to store values during generation. DARI works for all T_(-1/2) -concave distributions. It requires the PMF and the location of the mode. Moreover the approximate sum over the PMF is used. (If no sum is given for the distribution the algorithm assumes that it is approximately 1.) The rejection constant is bounded from above by 4 for all T-concave distributions. How To Use .......... DARI works for discrete distribution object with given PMF. The sum over probabilities should be approximately one. Otherwise it must be set by a ‘unur_distr_discr_set_pmfsum’ call to its (approximate) value. The size of an auxiliary table can be set by ‘unur_dari_set_tablesize’. The expected number of evaluations can be reduced by switching the use of squeezes by means of ‘unur_dari_set_squeeze’. It is possible to change the parameters and the domain of the chosen distribution and run ‘unur_reinit’ to reinitialize the generator object. Notice, that derived parameters like the mode must also be (re-) set if the parameters or the domain has be changed. There exists a test mode that verifies whether the conditions for the method are satisfied or not. It can be switched on by calling ‘unur_dari_set_verify’ and ‘unur_dari_chg_verify’, respectively. Notice however that sampling is (much) slower then. Function reference ------------------ -- Function: UNUR_PAR* unur_dari_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_dari_set_squeeze (UNUR_PAR* PARAMETERS, int SQUEEZE) Turn utilization of the squeeze of the algorithm on/off. This squeeze does not resamble the squeeze of the continuous TDR method. It was especially designed for rejection inversion. The squeeze is not necessary if the size of the auxiliary table is big enough (for the given distribution). Using a squeeze is suggested to speed up the algorithm if the domain of the distribution is very big or if only small samples are produced. Default: no squeeze. -- Function: int unur_dari_set_tablesize (UNUR_PAR* PARAMETERS, int SIZE) Set the size for the auxiliary table, that stores constants computed during generation. If SIZE is set to ‘0’ no table is used. The speed-up can be impressive if the PMF is expensive to evaluate and the “main part of the distribution†is concentrated in an interval shorter than the size of the table. Default is ‘100’. -- Function: int unur_dari_set_cpfactor (UNUR_PAR* PARAMETERS, double CP_FACTOR) Set factor for position of the left and right construction point, resp. The CP_FACTOR is used to find almost optimal construction points for the hat function. The CP_FACTOR must be positive and should not exceed 2. There is no need to change this factor in almost all situations. Default is ‘0.664’. -- Function: int unur_dari_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) -- Function: int unur_dari_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) Turn verifying of algorithm while sampling on/off. If the condition is violated for some x then ‘unur_errno’ is set to ‘UNUR_ERR_GEN_CONDITION’. However notice that this might happen due to round-off errors for a few values of x (less than 1%). Default is ‘FALSE’.  File: unuran.info, Node: DAU, Next: DEXT, Prev: DARI, Up: Methods_for_DISCR 5.8.2 DAU – (Discrete) Alias-Urn method --------------------------------------- Required: probability vector (PV) Speed: Set-up: slow (linear with the vector-length), Sampling: very fast Reinit: supported Reference: [WAa77] [HLD04: Sect.3.2] DAU samples from distributions with arbitrary but finite probability vectors (PV) of length N. The algorithmus is based on an ingeneous method by A.J. Walker and requires a table of size (at least) N. It needs one random numbers and only one comparison for each generated random variate. The setup time for constructing the tables is O(N). By default the probability vector is indexed starting at ‘0’. However this can be changed in the distribution object by a ‘unur_distr_discr_set_domain’ call. The method also works when no probability vector but a PMF is given. However then additionally a bounded (not too large) domain must be given or the sum over the PMF (see ‘unur_distr_discr_make_pv’ for details). How To Use .......... Create an object for a discrete distribution either by setting a probability vector or a PMF. The performance can be slightly influenced by setting the size of the used table which can be changed by ‘unur_dau_set_urnfactor’. It is possible to change the parameters and the domain of the chosen distribution and run ‘unur_reinit’ to reinitialize the generator object. Function reference ------------------ -- Function: UNUR_PAR* unur_dau_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_dau_set_urnfactor (UNUR_PAR* PARAMETERS, double FACTOR) Set size of urn table relative to length of the probability vector. It must not be less than 1. Larger tables result in (slightly) faster generation times but require a more expensive setup. However sizes larger than 2 are not recommended. Default is ‘1’.  File: unuran.info, Node: DEXT, Next: DGT, Prev: DAU, Up: Methods_for_DISCR 5.8.3 DEXT – wrapper for Discrete EXTernal generators ----------------------------------------------------- Required: routine for sampling discrete random variates Speed: depends on external generator Reinit: supported Method DEXT is a wrapper for external generators for discrete univariate distributions. It allows the usage of external random variate generators within the UNU.RAN framework. How To Use .......... The following steps are required to use some external generator within the UNU.RAN framework (some of these are optional): 1. Make an empty generator object using a ‘unur_dext_new’ call. The argument DISTRIBUTION is optional and can be replaced by ‘NULL’. However, it is required if you want to pass parameters of the generated distribution to the external generator or for running some validation tests provided by UNU.RAN. 2. Create an initialization routine of type ‘int (*init)(UNUR_GEN *gen)’ and plug it into the generator object using the ‘unur_dext_set_init’ call. Notice that the INIT routine must return ‘UNUR_SUCCESS’ when it has been executed successfully and ‘UNUR_FAILURE’ otherwise. It is possible to get the size of and the pointer to the array of parameters of the underlying distribution object by the respective calls ‘unur_dext_get_ndistrparams’ and ‘unur_dext_get_distrparams’. Parameters for the external generator that are computed in the INIT routine can be stored in a single array or structure which is available by the ‘unur_dext_get_params’ call. Using an INIT routine is optional and can be omitted. 3. Create a sampling routine of type ‘int (*sample)(UNUR_GEN *gen)’ and plug it into the generator object using the ‘unur_dext_set_sample’ call. Uniform random numbers are provided by the ‘unur_sample_urng’ call. Do not use your own implementation of a uniform random number generator directly. If you want to use your own random number generator we recommend to use the UNU.RAN interface (see *note Using uniform random number generators: URNG.). The array or structure that contains parameters for the external generator that are computed in the INIT routine are available using the ‘unur_dext_get_params’ call. Using a SAMPLE routine is of course obligatory. It is possible to change the parameters and the domain of the chosen distribution and run ‘unur_reinit’ to reinitialize the generator object. The INIT routine is then called again. Here is a short example that demonstrates the application of this method by means of the geometric distribution: /* ------------------------------------------------------------- */ /* File: example_dext.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* This example shows how an external generator for the */ /* geometric distribution can be used within the UNURAN */ /* framework. */ /* */ /* Notice, that this example does not provide the simplest */ /* solution. */ /* ------------------------------------------------------------- */ /* Initialization routine. */ /* */ /* Here we simply read the parameter of the geometric */ /* distribution and store it in an array for parameters of */ /* the external generator. */ /* [ Of course we could do this in the sampling routine as */ /* and avoid the necessity of this initialization routine. ] */ int geometric_init (UNUR_GEN *gen) { /* Get pointer to parameters of geometric distribution */ double *params = unur_dext_get_distrparams(gen); /* The parameter is the first entry (see manual) */ double p = params[0]; /* Get array to store this parameter for external generator */ double *genpar = unur_dext_get_params(gen, sizeof(double)); genpar[0] = p; /* Executed successfully */ return UNUR_SUCCESS; } /* ------------------------------------------------------------- */ /* Sampling routine. */ /* */ /* Contains the code for the external generator. */ int geometric_sample (UNUR_GEN *gen) { /* Get scale parameter */ double *genpar = unur_dext_get_params(gen,0); double p = genpar[0]; /* Sample a uniformly distributed random number */ double U = unur_sample_urng(gen); /* Transform into geometrically distributed random variate */ return ( (int) (log(U) / log(1.-p)) ); } /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ int K; /* will hold the random number */ /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Use predefined geometric distribution with parameter 1/10 */ double fpar[1] = { 0.1 }; distr = unur_distr_geometric(fpar, 1); /* Use method DEXT */ par = unur_dext_new(distr); /* Set initialization and sampling routines. */ unur_dext_set_init(par, geometric_init); unur_dext_set_sample(par, geometric_sample); /* Create the generator object. */ gen = unur_init(par); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the standard Gaussian distribution. */ /* Eg.: */ for (i=0; i<10; i++) { K = unur_sample_discr(gen); printf("%d\n",K); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ Function reference ------------------ -- Function: UNUR_PAR* unur_dext_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for new generator. -- Function: int unur_dext_set_init (UNUR_PAR* PARAMETERS, int (* INIT)(UNUR_GEN* gen )) Set initialization routine for external generator. Inside the _Important:_ The routine INIT must return ‘UNUR_SUCCESS’ when the generator was initialized successfully and ‘UNUR_FAILURE’ otherwise. Parameters that are computed in the INIT routine can be stored in an array or structure that is avaiable by means of the ‘unur_dext_get_params’ call. Parameters of the underlying distribution object can be obtained by the ‘unur_dext_get_distrparams’ call. -- Function: int unur_dext_set_sample (UNUR_PAR* PARAMETERS, int (* SAMPLE)(UNUR_GEN* gen )) Set sampling routine for external generator. _Important:_ Use ‘unur_sample_urng(gen)’ to get a uniform random number. The pointer to the array or structure that contains the parameters that are precomputed in the INIT routine are available by ‘unur_dext_get_params(gen,0)’. Additionally one can use the ‘unur_dext_get_distrparams’ call. -- Function: void* unur_dext_get_params (UNUR_GEN* GENERATOR, size_t SIZE) Get pointer to memory block for storing parameters of external generator. A memory block of size SIZE is automatically (re-) allocated if necessary and the pointer to this block is stored in the GENERATOR object. If one only needs the pointer to this memory block set SIZE to ‘0’. Notice, that SIZE is the size of the memory block and not the length of an array. _Important:_ This rountine should only be used in the initialization and sampling routine of the external generator. -- Function: double* unur_dext_get_distrparams (UNUR_GEN* GENERATOR) -- Function: int unur_dext_get_ndistrparams (UNUR_GEN* GENERATOR) Get size of and pointer to array of parameters of underlying distribution in GENERATOR object. _Important:_ These rountines should only be used in the initialization and sampling routine of the external generator.  File: unuran.info, Node: DGT, Next: DSROU, Prev: DEXT, Up: Methods_for_DISCR 5.8.4 DGT – (Discrete) Guide Table method (indexed search) ---------------------------------------------------------- Required: probability vector (PV) Speed: Set-up: slow (linear with the vector-length), Sampling: very fast Reinit: supported Reference: [CAa74] [HLD04: Sect.3.1.2] DGT samples from arbitrary but finite probability vectors. Random numbers are generated by the inversion method, i.e., 1. Generate a random number U ~ U(0,1). 2. Find smallest integer I such that F(I) = P(X<=I) >= U. Step (2) is the crucial step. Using sequential search requires O(E(X)) comparisons, where E(X) is the expectation of the distribution. Indexed search, however, uses a guide table to jump to some I’ <= I near I to find X in constant time. Indeed the expected number of comparisons is reduced to 2, when the guide table has the same size as the probability vector (this is the default). For larger guide tables this number becomes smaller (but is always larger than 1), for smaller tables it becomes larger. For the limit case of table size 1 the algorithm simply does sequential search (but uses a more expensive setup then method DSS (*note DSS::). On the other hand the setup time for guide table is O(N), where N denotes the length of the probability vector (for size 1 no preprocessing is required). Moreover, for very large guide tables memory effects might even reduce the speed of the algorithm. So we do not recommend to use guide tables that are more than three times larger than the given probability vector. If only a few random numbers have to be generated, (much) smaller table sizes are better. The size of the guide table relative to the length of the given probability vector can be set by a ‘unur_dgt_set_guidefactor’ call. There exist two variants for the setup step which can be set by a ‘unur_dgt_set_variant’ call: Variants 1 and 2. Variant 2 is faster but more sensitive to roundoff errors when the guide table is large. By default variant 2 is used for short probability vectors (N<1000) and variant 1 otherwise. By default the probability vector is indexed starting at ‘0’. However this can be changed in the distribution object by a ‘unur_distr_discr_set_domain’ call. The method also works when no probability vector but a PMF is given. However, then additionally a bounded (not too large) domain must be given or the sum over the PMF. In the latter case the domain of the distribution is trucated (see ‘unur_distr_discr_make_pv’ for details). How To Use .......... Create an object for a discrete distribution either by setting a probability vector or a PMF. The performance can be slightly influenced by setting the size of the used table which can be changed by ‘unur_dgt_set_guidefactor’. It is possible to change the parameters and the domain of the chosen distribution and run ‘unur_reinit’ to reinitialize the generator object. Function reference ------------------ -- Function: UNUR_PAR* unur_dgt_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_dgt_set_guidefactor (UNUR_PAR* PARAMETERS, double FACTOR) Set size of guide table relative to length of PV. Larger guide tables result in faster generation time but require a more expensive setup. Sizes larger than 3 are not recommended. If the relative size is set to 0, sequential search is used. However, this is not recommended, except in exceptional cases, since method DSS (*note DSS::) is has almost no setup and is thus faster (but requires the sum over the PV as input parameter). Default is ‘1’. -- Function: int unur_dgt_set_variant (UNUR_PAR* PARAMETERS, unsigned VARIANT) Set variant for setup step. Possible values are ‘1’ or ‘2’. Variant ‘2’ is faster but more sensitive to roundoff errors when the guide table is large. By default variant ‘2’ is used for short probability vectors (N<1000) and variant ‘1’ otherwise.  File: unuran.info, Node: DSROU, Next: DSS, Prev: DGT, Up: Methods_for_DISCR 5.8.5 DSROU – Discrete Simple Ratio-Of-Uniforms method ------------------------------------------------------ Required: T-concave PMF, mode, sum over PMF Speed: Set-up: fast, Sampling: slow Reinit: supported Reference: [LJa01] [HLD04: Sect.10.3.2; Alg.10.6] DSROU is based on the ratio-of-uniforms method (*note Ratio-of-Uniforms::) but uses universal inequalities for constructing a (universal) bounding rectangle. It works for all T-concave distributions with T(x) = -1/sqrt(x) . The method requires the PMF, the (exact) location of the mode and the sum over the given PDF. The rejection constant is 4 for all T-concave distributions. Optionally the CDF at the mode can be given to increase the performance of the algorithm. Then the rejection constant is reduced to 2. How To Use .......... The method works for T-concave discrete distributions with given PMF. The sum over of the PMF or an upper bound of this sum must be known. Optionally the CDF at the mode can be given to increase the performance using ‘unur_dsrou_set_cdfatmode’. However, this *must not* be called if the sum over the PMF is replaced by an upper bound. It is possible to change the parameters and the domain of the chosen distribution and run ‘unur_reinit’ to reinitialize the generator object. If any of mode, CDF at mode, or the sum over the PMF has been changed, then ‘unur_reinit’ must be executed. (Otherwise the generator produces garbage). There exists a test mode that verifies whether the conditions for the method are satisfied or not while sampling. It can be switched on or off by calling ‘unur_dsrou_set_verify’ and ‘unur_dsrou_chg_verify’, respectively. Notice however that sampling is (a little bit) slower then. Function reference ------------------ -- Function: UNUR_PAR* unur_dsrou_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_dsrou_set_cdfatmode (UNUR_PAR* PARAMETERS, double FMODE) Set CDF at mode. When set, the performance of the algorithm is increased by factor 2. However, when the parameters of the distribution are changed ‘unur_dsrou_chg_cdfatmode’ has to be used to update this value. Notice that the algorithm detects a mode at the left boundary of the domain automatically and it is not necessary to use this call for a monotonically decreasing PMF. Default: not set. -- Function: int unur_dsrou_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) -- Function: int unur_dsrou_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) Turn verifying of algorithm while sampling on/off. If the condition squeeze(x) <= PMF(x) <= hat(x) is violated for some x then ‘unur_errno’ is set to ‘UNUR_ERR_GEN_CONDITION’. However notice that this might happen due to round-off errors for a few values of x (less than 1%). Default is ‘FALSE’. -- Function: int unur_dsrou_chg_cdfatmode (UNUR_GEN* GENERATOR, double FMODE) Change CDF at mode of distribution. ‘unur_reinit’ must be executed before sampling from the generator again.  File: unuran.info, Node: DSS, Next: DSTD, Prev: DSROU, Up: Methods_for_DISCR 5.8.6 DSS – (Discrete) Sequential Search method ----------------------------------------------- Required: probability vector (PV) and sum over PV; or probability mass function(PMF), sum over PV and domain; or or cumulative distribution function (CDF) Speed: Set-up: fast, Sampling: very slow (linear in expectation) Reinit: supported Reference: [HLD04: Sect.3.1.1; Alg.3.1] DSS samples from arbitrary discrete distributions. Random numbers are generated by the inversion method, i.e., 1. Generate a random number U ~ U(0,1). 2. Find smallest integer I such that F(I) = P(X<=I) >= U. Step (2) is the crucial step. Using sequential search requires O(E(X)) comparisons, where E(X) is the expectation of the distribution. Thus this method is only recommended when only a few random variates from the given distribution are required. Otherwise, table methods like DGT (*note DGT::) or DAU (*note DAU::) are much faster. These methods also need not the sum over the PMF (or PV) as input. On the other hand, however, these methods always compute a table. DSS runs with the PV, the PMF, or the CDF of the distribution. It uses actually uses the first one in this list (in this ordering) that could be found. How To Use .......... It works with a discrete distribution object with contains at least the PV, the PMF, or the CDF. It is possible to change the parameters and the domain of the chosen distribution and run ‘unur_reinit’ to reinitialize the generator object. Function reference ------------------ -- Function: UNUR_PAR* unur_dss_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator.  File: unuran.info, Node: DSTD, Prev: DSS, Up: Methods_for_DISCR 5.8.7 DSTD – Discrete STandarD distributions -------------------------------------------- Required: standard distribution from UNU.RAN library (*note Standard distributions: Stddist.) or discrete distribution with inverse CDF. Speed: Set-up: fast, Sampling: depends on distribution and generator Reinit: supported DSTD is a wrapper for special generators for discrete univariate standard distributions. It only works for distributions in the UNU.RAN library of standard distributions (*note Standard distributions: Stddist.) or for discrete distributions where the inverse CDF is given. If a distribution object is provided that is build from scratch, it must provide the inverse CDF. Then CSTD implements the inversion method. Otherwise, the ‘NULL’ pointer is returned. For some distributions more than one special generator is possible. How To Use .......... Create a distribution object for a standard distribution from the UNU.RAN library (*note Standard distributions: Stddist.), or create a discrete distribution object and set the function for the inverse CDF using ‘unur_distr_discr_set_invcdf’. For some distributions more than one special generator (_variants_) is possible. These can be choosen by a ‘unur_dstd_set_variant’ call. For possible variants *Note Standard distributions: Stddist. However the following are common to all distributions: ‘UNUR_STDGEN_DEFAULT’ the default generator. ‘UNUR_STDGEN_FAST’ the fastest available special generator. ‘UNUR_STDGEN_INVERSION’ the inversion method (if available). Notice that the variant ‘UNUR_STDGEN_FAST’ for a special generator might be slower than one of the universal algorithms! Additional variants may exist for particular distributions. Sampling from truncated distributions (which can be constructed by changing the default domain of a distribution by means of ‘unur_distr_discr_set_domain’ or unur_dstd_chg_truncated calls) is possible but requires the inversion method. Moreover the CDF of the distribution must be implemented. It is possible to change the parameters and the domain of the chosen distribution and run ‘unur_reinit’ to reinitialize the generator object. Function reference ------------------ -- Function: UNUR_PAR* unur_dstd_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for new generator. It requires a distribution object for a discrete univariant distribution from the UNU.RAN library of standard distributions (*note Standard distributions: Stddist.). Using a truncated distribution is allowed only if the inversion method is available and selected by the ‘unur_dstd_set_variant’ call immediately after creating the parameter object. Use a ‘unur_distr_discr_set_domain’ call to get a truncated distribution. -- Function: int unur_dstd_set_variant (UNUR_PAR* PARAMETERS, unsigned VARIANT) Set variant (special generator) for sampling from a given distribution. For possible variants *note Standard distributions: Stddist. Common variants are ‘UNUR_STDGEN_DEFAULT’ for the default generator, ‘UNUR_STDGEN_FAST’ for (one of the) fastest implemented special generators, and ‘UNUR_STDGEN_INVERSION’ for the inversion method (if available). If the selected variant number is not implemented, then an error code is returned and the variant is not changed. -- Function: int unur_dstd_chg_truncated (UNUR_GEN* GENERATOR, int LEFT, int RIGHT) Change left and right border of the domain of the (truncated) distribution. This is only possible if the inversion method is used. Otherwise this call has no effect and an error code is returned. Notice that the given truncated domain must be a subset of the domain of the given distribution. The generator always uses the intersection of the domain of the distribution and the truncated domain given by this call. It is not required to run ‘unur_reinit’ after this call has been used. _Important:_ If the CDF is (almost) the same for LEFT and RIGHT and (almost) equal to ‘0’ or ‘1’, then the truncated domain is not chanced and the call returns an error code. _Notice:_ If the parameters of the distribution has been changed it is recommended to set the truncated domain again, since the former call might change the domain of the distribution but not update the values for the boundaries of the truncated distribution.  File: unuran.info, Node: Methods_for_MATR, Next: Methods_for_UNID, Prev: Methods_for_DISCR, Up: Methods 5.9 Methods for random matrices =============================== * Menu: * MCORR:: Random CORRelation matrix Overview of methods ------------------- Methods for matrix distributions sample with ‘unur_sample_matr’ MCORR: Distribution object for random correlation matrix.  File: unuran.info, Node: MCORR, Up: Methods_for_MATR 5.9.1 MCORR – Random CORRelation matrix --------------------------------------- Required: Distribution object for random correlation matrix Speed: Set-up: fast, Sampling: depends on dimension Reinit: supported Reference: [DLa86: Sect.6.1; p.605] [MOa84] MCORR generates a random correlation matrix (Pearson’s correlation). Two methods are used: 1. When a random correlation matrix having given eigenvalues is sought, the method of Marsaglia and Olkin [MOa84] is used. In this case, the correlation matrix R is given as R=PDP' where D is a diagonal matrix containing the eigenvalues and P is a random orthonormal matrix. In higher dimensions, the rounding-errors introduced in the previous matrix multiplications could lead to a non-symmetric correlation matrix. Therefore the symmetric correlation matrix is computed as R=(PDP'+P'DP)/2 . 2. A matrix H is generated where all rows are independent random vectors of unit length uniformly on a sphere. Then HH' is a correlation matrix (and vice versa if HH' is a correlation matrix then the rows of H are random vectors on a sphere). Notice that due to round-off errors the generated matrices might not be positive definite in extremely rare cases (especially when the given eigenvalues are amost 0). There are many other possibilites (distributions) of sampling the random rows from a sphere. The chosen methods are simple but does not result in a uniform distriubution of the random correlation matrices. It only works with distribution objects of random correlation matrices (*note Random Correlation Matrix: correlation.). How To Use .......... Create a distibution object for random correlation matrices by a ‘unur_distr_correlation’ call (*note Random Correlation Matrix: correlation.). When a correlation matrix with given eigenvalues should be generated, these eigenvalues can be set by a ‘unur_mcorr_set_eigenvalues’ call. Otherwise, a faster algorithm is used that generates correlation matrices with random eigenstructure. Notice that due to round-off errors, there is a (small) chance that the resulting matrix is not positive definite for a Cholesky decomposition algorithm, especially when the dimension of the distribution is high. It is possible to change the given eigenvalues using ‘unur_mcorr_chg_eigenvalues’ and run ‘unur_reinit’ to reinitialize the generator object. Function reference ------------------ -- Function: UNUR_PAR* unur_mcorr_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_mcorr_set_eigenvalues (UNUR_PAR* PAR, const DOUBLE* EIGENVALUES) Sets the (optional) eigenvalues of the correlation matrix. If set, then the Marsaglia and Olkin algorithm will be used to generate random correlation matrices with given eigenvalues. Important: the given eigenvalues of the correlation matrix must be strictly positive and sum to the dimension of the matrix. If non-positive eigenvalues are attempted, no eigenvalues are set and an error code is returned. In case, that their sum is different from the dimension, an implicit scaling to give the correct sum is performed. -- Function: int unur_mcorr_chg_eigenvalues (UNUR_GEN* GEN, const DOUBLE* EIGENVALUES) Change the eigenvalues of the correlation matrix. One must run ‘unur_reinit’ to reinitialize the generator object then.  File: unuran.info, Node: Methods_for_UNID, Next: Meta_Methods, Prev: Methods_for_MATR, Up: Methods 5.10 Methods for uniform univariate distributions ================================================= * Menu: * UNIF:: wrapper for UNIForm random number generator  File: unuran.info, Node: UNIF, Up: Methods_for_UNID 5.10.1 UNIF – wrapper for UNIForm random number generator --------------------------------------------------------- UNIF is a simple wrapper that makes it possible to use a uniform random number generator as a UNU.RAN generator. There are no parameters for this method. How To Use .......... Create a generator object with ‘NULL’ as argument. The created generator object returns raw random numbers from the underlying uniform random number generator. Function reference ------------------ -- Function: UNUR_PAR* unur_unif_new (const UNUR_DISTR* DUMMY) Get default parameters for generator. UNIF does not need a distribution object. DUMMY is not used and can (should) be set to ‘NULL’. It is used to keep the API consistent.  File: unuran.info, Node: Meta_Methods, Prev: Methods_for_UNID, Up: Methods 5.11 Meta Methods for univariate distributions ============================================== * Menu: * MIXT:: MIXTure of distributions Example ------- /* ------------------------------------------------------------- */ /* File: example_mixt.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* Mixture of a Gaussian and a Cauchy distribution. */ /* ------------------------------------------------------------- */ int main(void) { /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *comp[2]; /* array of generator objects (components)*/ UNUR_GEN *gen; /* generator object for mixture */ double prob[2]; /* array of probabilities */ int i; /* loop variable */ double x; /* will hold the random number */ /* Create generators for components */ distr = unur_distr_normal(NULL,0); /* Gaussian distribution */ par = unur_pinv_new(distr); /* choose method PINV */ comp[0] = unur_init(par); /* initialize */ unur_distr_free(distr); /* free distribution obj. */ distr = unur_distr_cauchy(NULL,0); /* Cauchy distribution */ par = unur_tdr_new(distr); /* choose method TDR */ comp[1] = unur_init(par); /* initialize */ unur_distr_free(distr); /* free distribution obj. */ /* Probabilities for components (need not sum to 1) */ prob[0] = 0.4; prob[1] = 0.3; /* Create mixture */ par = unur_mixt_new(2,prob,comp); /* Initialize generator object */ gen = unur_init(par); /* we do not need the components any more */ for (i=0; i<2; i++) unur_free(comp[i]); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ Example (Inversion) ------------------- /* ------------------------------------------------------------- */ /* File: example_mixt_inv.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* Mixture of truncated Gaussian on (-INFINITY,0] and */ /* Exponential distribution on [0,INFINITY) */ /* ------------------------------------------------------------- */ int main(void) { /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *comp[2]; /* array of generator objects (components)*/ UNUR_GEN *gen; /* generator object for mixture */ double prob[2]; /* array of probabilities */ int i; /* loop variable */ double x; /* will hold the random number */ /* Create generators for components */ distr = unur_distr_normal(NULL,0); /* Gaussian distribution */ unur_distr_cont_set_domain(distr,-UNUR_INFINITY,0); par = unur_pinv_new(distr); /* choose method PINV */ comp[0] = unur_init(par); /* initialize */ unur_distr_free(distr); /* free distribution obj. */ distr = unur_distr_exponential(NULL,0); /* Exponential distr. */ par = unur_pinv_new(distr); /* choose method PINV */ comp[1] = unur_init(par); /* initialize */ unur_distr_free(distr); /* free distribution obj. */ /* Probabilities for components (need not sum to 1) */ prob[0] = 0.4; prob[1] = 0.3; /* Create mixture */ par = unur_mixt_new(2,prob,comp); /* We want to use inversion for the mixture as well. */ /* (Thus the above order of the components is important!) */ unur_mixt_set_useinversion(par,TRUE); /* Initialize generator object */ gen = unur_init(par); /* we do not need the components any more */ for (i=0; i<2; i++) unur_free(comp[i]); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */  File: unuran.info, Node: MIXT, Up: Meta_Methods 5.11.1 MIXT – MIXTure of distributions -------------------------------------- MIXT allows to sample from a mixture of univariate distributions. Let f_1,...,f_n be PDFs of various distributions called the components and (p_1,...,p_n) be a probability vector. Then f(x) = p_1 * f_1(x) + ...+ p_n * f_n(x) is the PDF of the so called mixture of these distributions. Method MIXT takes generator objects for the components and a probability vector and creates a generator object for this mixture. The sampling part works as follows: 1. Generate an index J as the realisation of a discrete random variate with the given probability vector. This is done by means of method DGT (*note Guide Table method: DGT.). 2. Generate a random variate X with PDF f_J. When the (interior of the) domains of the the components are disjoint then it is possible to sample from the mixture by inversion, provided that the following conditions are met: − The generator objects must use an inversion method for each component. − The domains of the PDFs f_i must not overlap. − The components must be ordered with respect to their domains. How To Use .......... Create generator objects for the components of the mixture and store the corresponding pointers in an array. Store all probabilities an a double array of the same size. Create the parameter object for the generator of the mixture distribution by means of ‘unur_mixt_new’. The components of the mixture can be any continuous or discrete univariate distributions. This also includes generators for empirical distributions and mixtures of distributions. In particular, mixtures can also be defined recursively. _Remark:_ The components of the mixture can be continuous or discrete distributions. The resulting mixture, however, is always a continuous distribution and thus ‘unur_sample_cont’ must be used! The inversion method can be switched on by means of ‘unur_mixt_set_useinversion’ call. However, the conditions for this method must then be met. Otherwise, initialization of the mixture object fails. Function reference ------------------ -- Function: UNUR_PAR* unur_mixt_new (int N, const DOUBLE* PROB, UNUR_GEN** COMP) Get default parameters for the generator for a mixture of the distributions given in the array COMP (components) of length N. The probabilities are given by PROB. The generators in COMP must be objects for (continuous or discrete) univariate distributions -- Function: int unur_mixt_set_useinversion (UNUR_PAR* PARAMETERS, int USEINV) If USEINV is ‘TRUE’, then the inversion method is used for sampling from the mixture distribution. However, the following conditions must be satisfied: − The generator objects must use an inversion method for each component. − The domains of the components must not overlap. − The components must be ordered with respect to their domains. If one of these conditions is violated, then initialization of the mixture object fails. Default is ‘FALSE’.  File: unuran.info, Node: URNG, Next: Stddist, Prev: Methods, Up: Top 6 Using uniform random number generators **************************************** * Menu: * URNG-FVOID:: Simple interface for uniform random number generators * URNG-GSL:: Interface to GSL uniform random number generators * URNG-GSLQRNG:: Interface to GSL generators for quasi-random points * URNG-PRNG:: Interface to Otmar Lendl’s pseudo-random number generators * URNG-RNGSTREAM:: Interface to L’Ecuyer’s RNGSTREAM random number generators * URNG-RANDOMSHIFT:: Combine point set generator with random shifts UNU.RAN is designed to work with many sources of (pseudo-) random numbers or low discrepancy numbers (so called quasi-random numbers) for almost all tasks in discrete event simulation, (quasi-) Monte Carlo integration or any other stochastic methods. Hence UNU.RAN uses pointers to access uniform (pseudo-) random number generators (URNG). Each UNU.RAN (non-uniform random variate) generator object has a pointer to a URNG object. Thus each UNU.RAN generator object may have its own (independent) URNG or several generator objects can share the same URNG. If no URNG is provided for a parameter or generator object a default generator is used which is the same for all generators. This URNG is defined in ‘unuran_config.h’ at compile time and can be changed at runtime. UNU.RAN uses a unified interface for all sources of random numbers. Unfortunately, the API for random number generators, like the ‘GSL’ (GNU Scientific Library), Otmar Lendl’s ‘prng’ (Pseudo random number generators), or a single function implemented by the user herself, are quite different. Hence an object of type ‘UNUR_URNG’ is introduced to store the URNG. Thus it is possible to handle different sources of such URNGs with the unified API. It is inspired from similar to Pierre L’Ecuyers ‘RngStreams’ library: − seed the random number generator; − get a uniform random number; − reset the URNG; − skip to the begining next substream; − sample antithetic numbers; − delete the URNG object. The routine to create a URNG depends on the chosen random number generator (i.e. library). Nevertheless, there exist wrapper functions to simplify this task. Currently the following sources of uniform random numbers are directly supported (i.e., there exist wrapper functions). Of course other random number generation libraries can be used. 1. ‘FVOID’ URNGs of type ‘double uniform(void *state)’. The argument STATE can be simply ignored in the implementation of ‘uniform’ when a global state variable is used. UNU.RAN contains some build-in URNGs of this type in directory ‘src/uniform/’. 2. ‘PRNG’ URNGs from Otmar Lendl’s ‘prng’ library. It provides a very flexible way to sample form arbitrary URNGs by means of an object oriented programing paradigma. Similarly to the UNU.RAN library independent generator objects can be build and used. This library has been developed by the pLab group at the university of Salzburg (Austria, EU) and implemented by Otmar Lendl. It is available from or from the pLab site at . This interface must be compiled into UNU.RAN using the configure flag ‘--with-urng-prng’. 3. ‘RNGSTREAM’ Pierre L’Ecuyer’s ‘RngStream’ library for multiple independent streams of pseudo-random numbers. A GNU-style package is available from . This interface must be compiled into UNU.RAN using the configure flag ‘--with-urng-rngstream’. 4. ‘GSL’ URNG from the GNU Scientific Library (GSL). It is available from . This interface must be compiled into UNU.RAN using the configure flag ‘--with-urng-gsl’. How To Use .......... Each UNU.RAN generator object has a pointer to a uniform (pseudo-) random number generator (URNG). It can be set via the ‘unur_set_urng’ call. It is also possible to read this pointer via ‘unur_get_urng’ or change the URNG for an existing generator object by means of ‘unur_chg_urng’. It is important to note that these calls only copy the pointer to the URNG object into the generator object. If no URNG is provided for a parameter or generator object a default URNG is used which is the same for all generators. This URNG is defined in ‘unuran_config.h’ at compile time. A pointer to this default URNG can be obtained via ‘unur_get_default_urng’. Nevertheless, it is also possible to change this default URNG by another one at runtime by means of the ‘unur_set_default_urng’ call. However, this only takes effect for new parameter objects. Some generating methods provide the possibility of correlation induction. For this feature a second auxiliary URNG is required. It can be set and changed by ‘unur_set_urng_aux’ and ‘unur_chg_urng_aux’ calls, respectively. Since the auxiliary URNG is by default the same as the main URNG, the auxiliary URNG must be set after any ‘unur_set_urng’ or ‘unur_chg_urng’ call! Since in special cases mixing of two URNG might cause problems, we supply a default auxiliary generator that can be used by a ‘unur_use_urng_aux_default’ call (after the main URNG has been set). This default auxiliary generator can be changed with analogous calls as the (main) default uniform generator. Uniform random number generators form different sources have different programming interfaces. Thus UNU.RAN stores all information about a particular uniform random number generator in a structure of type ‘UNUR_URNG’. Before a URNG can be used with UNU.RAN an appropriate object has to be created ba a ‘unur_urng_new’ call. This call takes two arguments: the pointer to the sampling routine of the generator and a pointer to a possible argument that stores the state of the generator. The function must be of type ‘double (*sampleunif)(void *params)’, but functions without any argument also work. Additionally one can set pointers to functions for reseting or jumping the streams generated by the URNG by the corresponding ‘set’ calls. UNU.RAN provides a unified API to all sources of random numbers. Notice, however, that not all functions work for all random number generators (as the respective library has not implemented the corresponding feature). There are wrapper functions for some libraries of uniform random number generators to simplify the task of creating a UNU.RAN object for URNGs. These functions must be compiled into UNU.RAN using the corresponding configure flags (see description of the respective interface below). Function reference ------------------ Set and get default uniform RNGs -------------------------------- -- Function: UNUR_URNG* unur_get_default_urng (void) Get the pointer to the default URNG. The default URNG is used by all generators where no URNG was set explicitly by a ‘unur_set_urng’ call. -- Function: UNUR_URNG* unur_set_default_urng (UNUR_URNG* URNG_NEW) Change the default URNG that is used for new parameter objects. It returns the pointer to the old default URNG that has been used. -- Function: UNUR_URNG* unur_set_default_urng_aux (UNUR_URNG* URNG_NEW) -- Function: UNUR_URNG* unur_get_default_urng_aux (void) Analogous calls for default auxiliary generator. Set, change and get uniform RNGs in generator objects ----------------------------------------------------- -- Function: int unur_set_urng (UNUR_PAR* PARAMETERS, UNUR_URNG* URNG) Use the URNG ‘urng’ for the new generator. This overrides the default URNG. It also sets the auxiliary URNG to ‘urng’. _Important_: For multivariate distributions that use marginal distributions this call does not work properly. It is then better first to create the generator object (by a ‘unur_init’ call) and then change the URNG by means of ‘unur_chg_urng’. -- Function: UNUR_URNG* unur_chg_urng (UNUR_GEN* GENERATOR, UNUR_URNG* URNG) Change the URNG for the given generator. It returns the pointer to the old URNG that has been used by the generator. It also changes the auxiliary URNG to ‘urng’ and thus it overrides the last ‘unur_chg_urng_aux’ call. -- Function: UNUR_URNG* unur_get_urng (UNUR_GEN* GENERATOR) Get the pointer to the URNG that is used by the GENERATOR. This is usefull if two generators should share the same URNG. -- Function: int unur_set_urng_aux (UNUR_PAR* PARAMETERS, UNUR_URNG* URNG_AUX) Use the auxiliary URNG ‘urng_aux’ for the new generator. (Default is the default URNG or the URNG from the last ‘unur_set_urng’ call. Thus if the auxiliary generator should be different to the main URNG, ‘unur_set_urng_aux’ must be called after ‘unur_set_urng’. The auxiliary URNG is used as second stream of uniform random number for correlation induction. It is not possible to set an auxiliary URNG for a method that does not need one. In this case an error code is returned. -- Function: int unur_use_urng_aux_default (UNUR_PAR* PARAMETERS) Use the default auxiliary URNG. (It must be set after ‘unur_get_urng’. ) It is not possible to set an auxiliary URNG for a method that does not use one (i.e. the call returns an error code). -- Function: int unur_chgto_urng_aux_default (UNUR_GEN* GENERATOR) Switch to default auxiliary URNG. (It must be set after ‘unur_get_urng’. ) It is not possible to set an auxiliary URNG for a method that does not use one (i.e. the call returns an error code). -- Function: UNUR_URNG* unur_chg_urng_aux (UNUR_GEN* GENERATOR, UNUR_URNG* URNG_AUX) Change the auxiliary URNG for the given GENERATOR. It returns the pointer to the old auxiliary URNG that has been used by the generator. It has to be called after each ‘unur_chg_urng’ when the auxiliary URNG should be different from the main URNG. It is not possible to change the auxiliary URNG for a method that does not use one (i.e. the call ‘NULL’). -- Function: UNUR_URNG* unur_get_urng_aux (UNUR_GEN* GENERATOR) Get the pointer to the auxiliary URNG that is used by the GENERATOR. This is usefull if two generators should share the same URNG. Handle uniform RNGs ------------------- _Notice:_ Some of the below function calls do not work for every source of random numbers since not every library has implemented these features. -- Function: double unur_urng_sample (UNUR_URNG* URNG) Get a uniform random number from URNG. If the ‘NULL’ pointer is given, the default uniform generator is used. -- Function: double unur_sample_urng (UNUR_GEN* GEN) Get a uniform random number from the underlying uniform random number generator of generator GEN. If the ‘NULL’ pointer is given, the default uniform generator is used. -- Function: int unur_urng_sample_array (UNUR_URNG* URNG, double* X, int DIM) Set array X of length DIM with uniform random numbers sampled from generator URNG. If URNG is the ‘NULL’ pointer, the default uniform generator is used. _Important:_ If URNG is based on a point set generator (this is the case for generators of low discrepance point sets as used in quasi-Monte Carlo methods) it has a “natural dimension†s. In this case either only the first s entries of X are filled (if s < DIM), or the first DIM coordinates of the generated point are filled. The called returns the actual number of entries filled. In case of an error ‘0’ is returned. -- Function: int unur_urng_reset (UNUR_URNG* URNG) Reset URNG object. The routine tries two ways to reset the generator (in this order): 1. It uses the reset function given by an ‘unur_urng_set_reset’ call. 2. It uses the seed given by the last ‘unur_urng_seed’ call (which requires a seeding function given by a ‘unur_urng_set_seed’ call). If neither of the two methods work resetting of the generator is not possible and an error code is returned. If the ‘NULL’ pointer is given, the default uniform generator is reset. -- Function: int unur_urng_sync (UNUR_URNG* URNG) Jump into defined state ("sync") of the generator. This is useful when point generators are used where the coordinates are sampled via ‘unur_urng_sample’. Then this call can be used to jump to the first coordinate of the next generated point. -- Function: int unur_urng_seed (UNUR_URNG* URNG, unsigned LONG SEED) Set SEED for generator URNG. It returns an error code if this is not possible for the given URNG. If the ‘NULL’ pointer is given, the default uniform generator is seeded (if possible). _Notice_: Seeding should be done only once for a particular generator (except for resetting it to the initial state). Expertise is required when multiple seeds are used to get independent streams. Thus we recommend appropriate libraries for this task, e.g. Pierre L’Ecuyer’s ‘RngStreams’ package. For this library only a package seed can be set and thus the ‘unur_urng_seed’ call will not have any effect to generators of this type. Use ‘unur_urng_reset’ or ‘unur_urng_rngstream_new’ instead, depending whether one wants to reset the stream or get a new stream that is independent from the previous ones. -- Function: int unur_urng_anti (UNUR_URNG* URNG, int ANTI) Switch to antithetic random numbers in URNG. It returns an error code if this is not possible for the given URNG. If the ‘NULL’ pointer is given, the antithetic flag of the default uniform generator is switched (if possible). -- Function: int unur_urng_nextsub (UNUR_URNG* URNG) Jump to start of the next substream of URNG. It returns an error code if this is not possible for the given URNG. If the ‘NULL’ pointer is given, the default uniform generator is set to the start of the next substream (if possible). -- Function: int unur_urng_resetsub (UNUR_URNG* URNG) Jump to start of the current substream of URNG. It returns an error code if this is not possible for the given URNG. If the ‘NULL’ pointer is given, the default uniform generator is set to the start of the current substream (if possible). -- Function: int unur_gen_sync (UNUR_GEN* GENERATOR) -- Function: int unur_gen_seed (UNUR_GEN* GENERATOR, unsigned LONG SEED) -- Function: int unur_gen_anti (UNUR_GEN* GENERATOR, int ANTI) -- Function: int unur_gen_reset (UNUR_GEN* GENERATOR) -- Function: int unur_gen_nextsub (UNUR_GEN* GENERATOR) -- Function: int unur_gen_resetsub (UNUR_GEN* GENERATOR) Analogous to ‘unur_urng_sync’, ‘unur_urng_seed’ , ‘unur_urng_anti’, ‘unur_urng_reset’ , ‘unur_urng_nextsub’, and ‘unur_urng_resetsub’, but act on the URNG object used by the GENERATOR object. _Warning:_ These calls should be used with care as it influences all generator objects that share the same URNG object! API to create a new URNG object ------------------------------- _Notice:_ These functions are provided to built a UNUR_URNG object for a particular external random number generator from scratch. For some libraries that contain random number generators (like the GSL) there are special calls, e.g. ‘unur_urng_gsl_new’, to get such an object. Then there is no need to change the UNUR_URNG object as it already contains all available features. If you have a particular library for random number generators you can either write wrapper function like those in ‘src/uniform/urng_gsl.c’ or write an email to the authors of UNU.RAN to write it for you. -- Function: UNUR_URNG* unur_urng_new (double (* SAMPLEUNIF)(void* state ), void* STATE) Get a new URNG object. SAMPLEUNIF is a function to the uniform sampling routine, STATE a pointer to its arguments which usually contains the state variables of the generator. Functions SAMPLEUNIF with a different type for P or without an argument at all also work. A typecast might be necessary to avoid compiler warnings or error messages. For functions SAMPLEUNIF that does not have any argument should use ‘NULL’ for STATE. _Important:_ SAMPLEUNIF must not be the ‘NULL’ pointer. There are appropriate calls that simplifies the task of creating URNG objects for some libraries with uniform random number generators, see below. -- Function: void unur_urng_free (UNUR_URNG* URNG) Destroy URNG object. It returns an error code if this is not possible. If the ‘NULL’ is given, this function does nothing. _Warning:_ This call must be used with care. The URNG object must not be used by any existing generator object! It is designed to work in conjunction with the wrapper functions to create URNG objects for generators of a particular library. Thus an object created by an ‘unur_urng_prng_new’ call can be simply destroyed by an ‘unur_urng_free’ call. -- Function: int unur_urng_set_sample_array (UNUR_URNG* URNG, unsigned int(* SAMPLEARRAY)(void* state, double* X, int DIM )) Set function to fill array X of length DIM with random numbers generated by generator URNG (if available). -- Function: int unur_urng_set_sync (UNUR_URNG* URNG, void (* SYNC)(void* state )) Set function for jumping into a defined state (“syncâ€). -- Function: int unur_urng_set_seed (UNUR_URNG* URNG, void (* SETSEED)(void* state, unsigned LONG SEED )) Set function to seed generator URNG (if available). -- Function: int unur_urng_set_anti (UNUR_URNG* URNG, void (* SETANTI)(void* state, int ANTI )) Set function to switch the antithetic flag of generator URNG (if available). -- Function: int unur_urng_set_reset (UNUR_URNG* URNG, void (* RESET)(void* state )) Set function for reseting the uniform random number generator URNG (if available). -- Function: int unur_urng_set_nextsub (UNUR_URNG* URNG, void (* NEXTSUB)(void* state )) Set function that allows jumping to start of the next substream of URNG (if available). -- Function: int unur_urng_set_resetsub (UNUR_URNG* URNG, void (* RESETSUB)(void* state )) Set function that allows jumping to start of the current substream of URNG (if available). -- Function: int unur_urng_set_delete (UNUR_URNG* URNG, void (* FPDELETE)(void* state )) Set function for destroying URNG (if available).  File: unuran.info, Node: URNG-FVOID, Next: URNG-GSL, Up: URNG 6.1 Simple interface for uniform random number generators ========================================================= Simple interface for URNGs of type ‘double uniform(void *state)’. UNU.RAN contains some build-in URNGs of this type: ‘unur_urng_MRG31k3p’ Combined multiple recursive generator by Pierre L’Ecuyer and Renee Touzin. ‘unur_urng_fish’ Linear congruential generator by Fishman and Moore. ‘unur_urng_mstd’ Linear congruential generator "Minimal Standard" by Park and Miller. Notice, however, that these generators are provided as a fallback for the case that no state-of-the-art uniform random number generators (e.g. *note Pierre L’Ecuyer’s ‘Rngstream’ library: URNG-RNGSTREAM.) are used. How To Use .......... Create an URNG object using ‘unur_urng_fvoid_new’. By this call a pointer to the sampling routine and (optional) a pointer to a reset routine are copied into the URNG object. Other functions, like seeding the URNG, switching to antithetic random number, or jumping to next substream, can be added to the URNG object by the respective calls, e.g. by ‘unur_urng_set_seed’. The following routines are supported for URNG objects of this type: − ‘unur_urng_sample’ − ‘unur_urng_sample_array’ − ‘unur_urng_seed’ [optional] − ‘unur_urng_reset’ [optional] − ‘unur_urng_free’ Function reference ------------------ -- Function: UNUR_URNG* unur_urng_fvoid_new (double (* URAND)(void* state ), void (* RESET)(void* state )) Make a URNG object for a generator that consists of a single function call URAND. If there is no RESET function use ‘NULL’ for the second argument.  File: unuran.info, Node: URNG-GSL, Next: URNG-GSLQRNG, Prev: URNG-FVOID, Up: URNG 6.2 Interface to GSL uniform random number generators ===================================================== Interface to the uniform random number generators from the GNU Scientific Library (GSL). Documentation and source code of this library is available from . The interface to the GSL must be compiled into UNU.RAN using the configure flag ‘--with-urng-gsl’. Notice that the GSL has to be installed before running ‘./configure’. How To Use .......... When using this interface ‘unuran_urng_gsl.h’ must be included in the corresponding C file, i.e., one must add the line #include Moreover, one must not forget to link the executable against ‘libgsl’. The following routines are supported for URNG objects of type GSL: − ‘unur_urng_sample’ − ‘unur_urng_sample_array’ − ‘unur_urng_seed’ − ‘unur_urng_reset’ − ‘unur_urng_free’ /* ------------------------------------------------------------- */ /* File: example_gsl.c */ /* ------------------------------------------------------------- */ #ifdef UNURAN_SUPPORTS_GSL /* ------------------------------------------------------------- */ /* This example makes use of the GSL library for generating */ /* uniform random numbers. */ /* (see http://www.gnu.org/software/gsl/) */ /* To compile this example you must have set */ /* ./configure --with-urng-gsl */ /* (Of course the executable has to be linked against the */ /* GSL library.) */ /* ------------------------------------------------------------- */ /* Include UNURAN header files. */ #include #include /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; /* will hold the random number */ /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Declare objects for uniform random number generators. */ UNUR_URNG *urng; /* uniform generator objects */ /* GNU Scientific Library only: */ /* Make a object for uniform random number generator. */ urng = unur_urng_gsl_new(gsl_rng_mt19937); if (urng == NULL) exit (EXIT_FAILURE); /* Create a generator object using this URNG */ distr = unur_distr_normal( NULL, 0 ); par = unur_tdr_new(distr); unur_set_urng( par, urng ); gen = unur_init(par); if (gen == NULL) exit (EXIT_FAILURE); unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* Destroy objects */ unur_free(gen); unur_urng_free(urng); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ #else #include #include int main(void) { printf("You must enable the GSL to run this example!\n\n"); exit (77); /* exit code for automake check routines */ } #endif /* ------------------------------------------------------------- */ Function reference ------------------ -- Function: UNUR_URNG* unur_urng_gsl_new (const GSL_RNG_TYPE* URNGTYPE) Make object for URNGs from the ‘GSL’ (GNU Scientific Library). URNGTYPE is the type of the chosen generator as described in the GSL manual (see Section Random Number Generation). This library is available from . -- Function: UNUR_URNG* unur_urng_gslptr_new (gsl_rng* URNG) Similar to ‘unur_urng_gsl_new’ but it uses a pointer to a generator object as returned by ‘gsl_rng_alloc(rng_type)’; see ‘GSL’ manual for details. _Notice_: There is a subtle but important difference between these two calls. When a generator object is created by a ‘unur_urng_gsl_new’ call, then resetting of the generator works. When a generator object is created by a ‘unur_urng_gslptr_new’ call, then resetting only works after a ‘unur_urng_seed(urng,myseed)’ call.  File: unuran.info, Node: URNG-GSLQRNG, Next: URNG-PRNG, Prev: URNG-GSL, Up: URNG 6.3 Interface to GSL generators for quasi-random points ======================================================= Interface to the generators for quasi-random points (also called low discrepancy point sets) from the GNU Scientific Library (GSL). Documentation and source code of this library is available from . The interface to the GSL must be compiled into UNU.RAN using the configure flag ‘--with-urng-gsl’. Notice that the GSL has to be installed before running ‘./configure’. How To Use .......... When using this interface ‘unuran_urng_gsl.h’ must be included in the corresponding C file, i.e., one must add the line #include Moreover, one must not forget to link the executable against ‘libgsl’. The following routines are supported for URNG objects of this type: − ‘unur_urng_sample’ − ‘unur_urng_sample_array’ − ‘unur_urng_reset’ − ‘unur_urng_sync’ − ‘unur_urng_free’ ‘unur_urng_sync’ is used to jump to the first coordinate of the next point generated by the generator. Function reference ------------------ -- Function: UNUR_URNG* unur_urng_gslqrng_new (const GSL_QRNG_TYPE* QRNGTYPE, unsigned INT DIM) Make object for quasi-random point generators for dimension DIM from the ‘GSL’ (GNU Scientific Library). QRNGTYPE is the type of the chosen generator as described in the GSL manual (see section Quasi-Random Sequences). This library is available from .  File: unuran.info, Node: URNG-PRNG, Next: URNG-RNGSTREAM, Prev: URNG-GSLQRNG, Up: URNG 6.4 Interface to Otmar Lendl’s pseudo-random number generators ============================================================== URNGs from Otmar Lendl’s ‘prng’ library. It provides a very flexible way to sample form arbitrary URNGs by means of an object oriented programing paradigma. Similarly to the UNU.RAN library independent generator objects can be build and used. This library has been developed by the pLab group at the university of Salzburg (Austria, EU) and implemented by Otmar Lendl. It is available from or from the pLab site at . The interface to the PRNG library must be compiled into UNU.RAN using the configure flag ‘--with-urng-prng’. Notice that the PRNG library has to be installed before running ‘./configure’. How To Use .......... When using this interface ‘unuran_urng_prng.h’ must be included in the corresponding C file, i.e., one must add the line #include Moreover, one must not forget to link the executable against ‘libprng’. The following routines are supported for URNG objects of type PRNG: − ‘unur_urng_sample’ − ‘unur_urng_sample_array’ − ‘unur_urng_seed’ (availability depends on chosen PRNG generator!) − ‘unur_urng_reset’ − ‘unur_urng_free’ Function reference ------------------ -- Function: UNUR_URNG* unur_urng_prng_new (const CHAR* PRNGSTR) Make object for URNGs from Otmar Lendl’s ‘prng’ package. PRNGSTR is a string that contains the necessary information to create a uniform random number generator. For the format of this string see the ‘prng’ user manual. The ‘prng’ library provides a very flexible way to sample form arbitrary URNGs by means of an object oriented programing paradigma. Similarly to the UNU.RAN library independent generator objects can be build and used. The library has been developed and implemented by Otmar Lendl as member of the pLab group at the university of Salzburg (Austria, EU). It is available via anonymous ftp from or from the pLab site at . -- Function: UNUR_URNG* unur_urng_prngptr_new (struct PRNG* URNG) Similar to ‘unur_urng_prng_new’ but it uses a pointer to a generator object as returned by ‘prng_new(prngstr)’; see ‘prng’ manual for details.  File: unuran.info, Node: URNG-RNGSTREAM, Next: URNG-RANDOMSHIFT, Prev: URNG-PRNG, Up: URNG 6.5 Interface to L’Ecuyer’s RNGSTREAM random number generators ============================================================== URNGs from Pierre L’Ecuyer’s ‘RngStream’ library for multiple independent streams of pseudo-random numbers. This library provides multiple independent streams of pseudo-random numbers which itselves can be splitted into many substreams. It is available from . A GNU-style package is available from . The interface to the RngStream library must be compiled into UNU.RAN using the configure flag ‘--with-urng-rngstream’. Notice that the RngStream library has to be installed before running ‘./configure’. How To Use .......... When using this interface ‘unuran_urng_rngstream.h’ must be included in the corresponding C file, i.e., one must add the line #include Moreover, one must not forget to link the executable against the ‘RngStream’ library (i.e., when using the GNU-style package in UNIX like environments one has to add ‘-lrngstreams’ when linking an executable). Notice that the ‘rngstream’ library uses a package seed, that means one should seed the uniform random number generator only once in an application using the routine ‘RngStream_SetPackageSeed’: unsigned long seed[] = {111u, 222u, 333u, 444u, 555u, 666u}; RngStream_SetPackageSeed(seed); The following routines are supported for URNG objects of this type: − ‘unur_urng_sample’ − ‘unur_urng_sample_array’ − ‘unur_urng_reset’ − ‘unur_urng_nextsub’ − ‘unur_urng_resetsub’ − ‘unur_urng_anti’ − ‘unur_urng_free’ Function reference ------------------ -- Function: UNUR_URNG* unur_urng_rngstream_new (const CHAR* URNGSTR) Make object for URNGs from Pierre L’Ecuyer’s ‘RngStream’ library. URNGSTR is an arbitrary string to label a stream. It need not be unique. -- Function: UNUR_URNG* unur_urng_rngstreamptr_new (RngStream RNGSTREAM) Similar to ‘unur_urng_rngstream_new’ but it uses a pointer to a generator object as returned by ‘RngStream_CreateStream()’.  File: unuran.info, Node: URNG-RANDOMSHIFT, Prev: URNG-RNGSTREAM, Up: URNG 6.6 Combine point set generator with random shifts ================================================== Generators of type RANDOMSHIFT combine a point set generator with generators to apply random shifts as proposed in [CPa76] : 1. Sample and store a random vector S. 2. Run a QMC simulation where S is added to each point of the generated quasi-random point (mod 1). 3. Repeat steps 1 and 2. How To Use .......... Create a URNG object for a point set generator and a URNG object for a generator to create shift vectors at random. The meta URNG object can then be created using ‘unur_urng_randomshift_new’. Notice that only pointers to the two underlying URNG generator objects are copied into the newly created meta generator. Thus manipulating the meta URNG also changes the underlying URNGs and vice versa. The following routines are supported for URNG objects of type RANDOMSHIFT: − ‘unur_urng_sample’ − ‘unur_urng_sample_array’ − ‘unur_urng_reset’ − ‘unur_urng_sync’ − ‘unur_urng_randomshift_nextshift’ − ‘unur_urng_free’ ‘unur_urng_sync’ is used to jump to the first coordinate of the next point generated by the generator. ‘unur_urng_randomshift_nextshift’ allows to replace the shift vector by another randomly chosen shift vector. _Important:_ ‘unur_urng_sync’ is only available if it is if it is implemented for the underlying point set generator. _Important:_ ‘unur_urng_reset’ is only available if it is available for both underlying generators. Function reference ------------------ -- Function: UNUR_URNG* unur_urng_randomshift_new (UNUR_URNG* QRNG, UNUR_URNG* SRNG, int DIM) Make object for URNG with randomly shifted point sets. QRNG is a generated that generates point sets of dimension DIM. SRNG is a generated that generates random numbers or vectors. _Notice:_ Only pointers to the respective objects QRNG and SRNG are copied into the created meta generator. Thus manipulating the meta URNG also changes the underlying URNGs and vice versa. -- Function: int unur_urng_randomshift_nextshift (UNUR_URNG* URNG) Get the next (randomly chosen) vector for shifting the points set, and the underlying point generator QRNG is reset.  File: unuran.info, Node: Stddist, Next: Error_Debug, Prev: URNG, Up: Top 7 UNU.RAN Library of standard distributions ******************************************* * Menu: * Stddist_CONT:: UNU.RAN Library of continuous univariate distributions * Stddist_CVEC:: UNU.RAN Library of continuous multivariate distributions * Stddist_DISCR:: UNU.RAN Library of discrete univariate distributions * Stddist_MATR:: UNU.RAN Library of random matrices Although it is not its primary target, many distributions are already implemented in UNU.RAN. This section presents these available distributions and their parameters. The syntax to get a distribuion object for distributions ‘’ is: -- --: UNUR_DISTR* unur_distr_ (double* PARAMS, int N_PARAMS) PARAMS is an array of doubles of size N_PARAMS holding the parameters. E.g. to get an object for the gamma distribution (with shape parameter) use unur_distr_gamma( params, 1 ); Distributions may have default parameters with need not be given explicitely. E.g. The gamma distribution has three parameters: the shape, scale and location parameter. Only the (first) shape parameter is required. The others can be omitted and are then set by default values. /* alpha = 5; default: beta = 1, gamma = 0 */ double fpar[] = {5.}; unur_distr_gamma( fpar, 1 ); /* alpha = 5, beta = 3; default: gamma = 0 */ double fpar[] = {5., 3.}; unur_distr_gamma( fpar, 2 ); /* alpha = 5, beta = 3, gamma = -2 double fpar[] = {5., 3., -2.}; unur_distr_gamma( fpar, 3 ); *Important:* Naturally the computational accuracy limits the possible parameters. There shouldn’t be problems when the parameters of a distribution are in a “reasonable†range but e.g. the normal distribution N(10^15,1) won’t yield the desired results. (In this case it would be better generating N(0,1) and _then_ transform the results.) Of course computational inaccuracy is not specific to UNU.RAN and should always be kept in mind when working with computers. _Important:_ The routines of the standard library are included for non-uniform random variate generation and not to provide special functions for statistical computations. Remark ------ The following keywords are used in the tables: PDF probability density function, with variable x. PMF probability mass function, with variable k. constant normalization constant for given PDF and PMF, resp. They must be multiplied by constant to get the “real†PDF and PMF. CDF gives information whether the CDF is implemented in UNU.RAN. domain domain PDF and PMF, resp. parameters N_STD (N_TOTAL): list list of parameters for distribution, where N_STD is the number of parameters for the standard form of the distribution and N_TOTAL the total number for the (non-standard form of the) distribution. LIST is the list of parameters in the order as they are stored in the array of parameters. Optional parameter that can be omitted are enclosed in square brackets ‘[...]’. A detailed list of these parameters gives then the range of valid parameters and defaults for optional parameters that are used when these are omitted. reference gives reference for distribution (*note Bibliography::). special generators lists available special generators for the distribution. The first number is the variant that to be set by ‘unur_cstd_set_variant’ and ‘unur_dstd_set_variant’ call, respectively. If no variant is set the default variant ‘DEF’ is used. In the table the respective abbreviations ‘DEF’ and ‘INV’ are used for ‘UNUR_STDGEN_DEFAULT’ and ‘UNUR_STDGEN_INVERSION’. Also the references for these methods are given (*note Bibliography::). Notice that these generators might be slower than universal methods. If ‘DEF’ is ommited, the first entry is the default generator.  File: unuran.info, Node: Stddist_CONT, Next: Stddist_CVEC, Up: Stddist 7.1 UNU.RAN Library of continuous univariate distributions ========================================================== * Menu: * F:: F-distribution * beta:: Beta distribution * cauchy:: Cauchy distribution * chi:: Chi distribution * chisquare:: Chisquare distribution * exponential:: Exponential distribution * extremeI:: Extreme value type I (Gumbel-type) distribution * extremeII:: Extreme value type II (Frechet-type) distribution * gamma:: Gamma distribution * gig:: Generalized Inverse Gaussian distribution * gig2:: Generalized Inverse Gaussian distribution * hyperbolic:: Hyperbolic distribution * ig:: Inverse Gaussian distribution * laplace:: Laplace distribution * logistic:: Logistic distribution * lognormal:: Log-Normal distribution * lomax:: Lomax distribution (Pareto distribution of second kind) * normal:: Normal distribution * pareto:: Pareto distribution (of first kind) * powerexponential:: Powerexponential (Subbotin) distribution * rayleigh:: Rayleigh distribution * slash:: Slash distribution * student:: Student’s t distribution * triangular:: Triangular distribution * uniform:: Uniform distribution * weibull:: Weibull distribution  File: unuran.info, Node: F, Next: beta, Up: Stddist_CONT 7.1.1 ‘F’ – F-distribution -------------------------- PDF: (x^(nu_1/2-1)) / (1+nu_1/nu_2 x)^((nu_1+nu_2)/2) constant: (nu_1/nu_2)^(nu_1/2) / B(nu_1/2,nu_2/2) domain: 0 < x < infinity parameters 2 (2): nu_1, nu_2 No. name default ‘[0]’ nu_1 > 0 (scale) ‘[1]’ nu_2 > 0 (scale) reference: [JKBc95: Ch.27; p.322]  File: unuran.info, Node: beta, Next: cauchy, Prev: F, Up: Stddist_CONT 7.1.2 ‘beta’ – Beta distribution -------------------------------- PDF: (x-a)^(p-1) * (b-x)^(q-1) constant: 1 / (B(p,q) * (b-a)^(p+q-1)) domain: a < x < b parameters 2 (4): p, q [, a, b ] No. name default ‘[0]’ p > 0 (scale) ‘[1]’ q > 0 (scale) ‘[2]’ a 0 (location, scale) ‘[3]’ b > a 1 (location, scale) reference: [JKBc95: Ch.25; p.210]  File: unuran.info, Node: cauchy, Next: chi, Prev: beta, Up: Stddist_CONT 7.1.3 ‘cauchy’ – Cauchy distribution ------------------------------------ PDF: 1/(1 + ((x-theta)/lambda)^2) constant: 1/(pi * lambda) domain: -infinity < x < infinity parameters 0 (2): [ theta [, lambda ] ] No. name default ‘[0]’ theta 0 (location) ‘[1]’ lambda > 0 1 (scale) reference: [JKBb94: Ch.16; p.299] special generators: ‘INV’ Inversion method  File: unuran.info, Node: chi, Next: chisquare, Prev: cauchy, Up: Stddist_CONT 7.1.4 ‘chi’ – Chi distribution ------------------------------ PDF: x^(nu-1) * exp( -x^2/2 ) constant: 1 / (2^((nu/2)-1) * Gamma(nu/2)) domain: 0 <= x < infinity parameters 1 (1): nu No. name default ‘[0]’ nu > 0 (shape) reference: [JKBb94: Ch.18; p.417] special generators: ‘DEF’ Ratio of Uniforms with shift (only for nu >= 1) [MJa87]  File: unuran.info, Node: chisquare, Next: exponential, Prev: chi, Up: Stddist_CONT 7.1.5 ‘chisquare’ – Chisquare distribution ------------------------------------------ PDF: x^((nu/2)-1) * exp( -x/2 ) constant: 1 / (2^(nu/2) * Gamma(nu/2)) domain: 0 <= x < infinity parameters 1 (1): nu No. name default ‘[0]’ nu > 0 (shape (degrees of freedom)) reference: [JKBb94: Ch.18; p.416]  File: unuran.info, Node: exponential, Next: extremeI, Prev: chisquare, Up: Stddist_CONT 7.1.6 ‘exponential’ – Exponential distribution ---------------------------------------------- PDF: exp( -(x-theta)/sigma) constant: 1/sigma domain: theta <= x < infinity parameters 0 (2): [ sigma [, theta ] ] No. name default ‘[0]’ sigma > 0 1 (scale) ‘[1]’ theta 0 (location) reference: [JKBb94: Ch.19; p.494] special generators: ‘INV’ Inversion method  File: unuran.info, Node: extremeI, Next: extremeII, Prev: exponential, Up: Stddist_CONT 7.1.7 ‘extremeI’ – Extreme value type I (Gumbel-type) distribution ------------------------------------------------------------------ PDF: exp( -exp( -(x-zeta)/theta ) - (x-zeta)/theta ) constant: 1/theta domain: -infinity < x 0 1 (scale) reference: [JKBc95: Ch.22; p.2] special generators: ‘INV’ Inversion method  File: unuran.info, Node: extremeII, Next: gamma, Prev: extremeI, Up: Stddist_CONT 7.1.8 ‘extremeII’ – Extreme value type II (Frechet-type) distribution --------------------------------------------------------------------- PDF: exp( -((x-zeta)/theta)^(-k)) * ((x-zeta)/theta)^(-k-1) constant: k/theta domain: zeta < x 0 (shape) ‘[1]’ zeta 0 (location) ‘[2]’ theta > 0 1 (scale) reference: [JKBc95: Ch.22; p.2] special generators: ‘INV’ Inversion method  File: unuran.info, Node: gamma, Next: gig, Prev: extremeII, Up: Stddist_CONT 7.1.9 ‘gamma’ – Gamma distribution ---------------------------------- PDF: ((x-gamma)/beta)^(alpha-1) * exp( -(x-gamma)/beta ) constant: 1 / (beta * Gamma(alpha)) domain: gamma < x < infinity parameters 1 (3): alpha [, beta [, gamma ] ] No. name default ‘[0]’ alpha > 0 (shape) ‘[1]’ beta > 0 1 (scale) ‘[2]’ gamma 0 (location) reference: [JKBb94: Ch.17; p.337] special generators: ‘DEF’ Acceptance Rejection combined with Acceptance Complement [ADa74] [ADa82] ‘2’ Rejection from log-logistic envelopes [CHa77]  File: unuran.info, Node: gig, Next: gig2, Prev: gamma, Up: Stddist_CONT 7.1.10 ‘gig’ – Generalized Inverse Gaussian distribution -------------------------------------------------------- PDF: x^(theta-1) * exp( -1/2 * omega * (x/eta + eta/x)) constant: not implemented! CDF: not implemented! domain: 0 < x 0 (scale) ‘[2]’ eta > 0 1 (shape) reference: [JKBb94: Ch.15; p.84] special generators: ‘DEF’ Ratio-of-Uniforms method [Dag89]  File: unuran.info, Node: gig2, Next: hyperbolic, Prev: gig, Up: Stddist_CONT 7.1.11 ‘gig2’ – Generalized Inverse Gaussian distribution --------------------------------------------------------- PDF: x^(theta-1) * exp( -1/2 * (chi/x + psi*x)) constant: not implemented! CDF: not implemented! domain: 0 < x 0 (shape) ‘[2]’ chi > 0 (shape) reference: [JKBb94: Ch.15; p.84]  File: unuran.info, Node: hyperbolic, Next: ig, Prev: gig2, Up: Stddist_CONT 7.1.12 ‘hyperbolic’ – Hyperbolic distribution --------------------------------------------- PDF: exp( -alpha * sqrt(delta^2 + (x - mu)^2) + beta*(x-mu) ) constant: not implemented! CDF: not implemented! domain: -infinity < x |beta| (shape (tail)) ‘[1]’ beta (shape (asymmetry)) ‘[2]’ delta > 0 (scale) ‘[3]’ mu (location)  File: unuran.info, Node: ig, Next: laplace, Prev: hyperbolic, Up: Stddist_CONT 7.1.13 ‘ig’ – Inverse Gaussian distribution ------------------------------------------- PDF: sqrt( lambda/2*pi*x^3 ) * exp( -(lambda*(x-mu)^2)/2*mu^2*x ) constant: 1 CDF: not implemented! domain: 0 < x 0 (mean) ‘[1]’ lambda > 0 (shape) reference: [JKBb94: Ch.15; p.259]  File: unuran.info, Node: laplace, Next: logistic, Prev: ig, Up: Stddist_CONT 7.1.14 ‘laplace’ – Laplace distribution --------------------------------------- PDF: exp( -|x-theta| / phi ) constant: 1/(2 * phi) domain: -infinity < x 0 1 (scale) reference: [JKBc95: Ch.24; p.164] special generators: ‘INV’ Inversion method  File: unuran.info, Node: logistic, Next: lognormal, Prev: laplace, Up: Stddist_CONT 7.1.15 ‘logistic’ – Logistic distribution ----------------------------------------- PDF: exp(-(x-alpha)/beta) * (1 + exp(-(x-alpha)/beta))^(-2) constant: 1/beta domain: -infinity < x 0 1 (scale) reference: [JKBc95: Ch.23; p.115] special generators: ‘INV’ Inversion method  File: unuran.info, Node: lognormal, Next: lomax, Prev: logistic, Up: Stddist_CONT 7.1.16 ‘lognormal’ – Log-Normal distribution -------------------------------------------- PDF: 1/(x-theta) * exp( -(log(x-theta)-zeta)^2/(2 sigma^2) ) constant: 1/(sigma * sqrt(2 pi)) domain: theta <= x < infinity parameters 2 (3): zeta, sigma [, theta ] No. name default ‘[0]’ zeta (shape) ‘[1]’ sigma > 0 (shape) ‘[2]’ theta 0 (location) reference: [JKBb94: Ch.14; p. 208]  File: unuran.info, Node: lomax, Next: normal, Prev: lognormal, Up: Stddist_CONT 7.1.17 ‘lomax’ – Lomax distribution (Pareto distribution of second kind) ------------------------------------------------------------------------ PDF: (x+C)^(-(a+1)) constant: a * C^a domain: 0 <= x < infinity parameters 1 (2): a [, C ] No. name default ‘[0]’ a > 0 (shape) ‘[1]’ C > 0 1 (scale) reference: [JKBb94: Ch.20; p.575] special generators: ‘INV’ Inversion method  File: unuran.info, Node: normal, Next: pareto, Prev: lomax, Up: Stddist_CONT 7.1.18 ‘normal’ – Normal distribution ------------------------------------- PDF: exp( -1/2 * ((x-mu)/sigma)^2 ) constant: 1 / (sigma * sqrt(2 pi)) domain: -infinity < x < infinity parameters 0 (2): [ mu [, sigma ] ] No. name default ‘[0]’ mu 0 (location) ‘[1]’ sigma > 0 1 (scale) reference: [JKBb94: Ch.13; p.80] special generators: ‘DEF’ ACR method (Acceptance-Complement Ratio) [HDa90] ‘1’ Box-Muller method [BMa58] ‘2’ Polar method with rejection [MGa62] ‘3’ Kindermann-Ramage method [KRa76] ‘INV’ Inversion method (slow)  File: unuran.info, Node: pareto, Next: powerexponential, Prev: normal, Up: Stddist_CONT 7.1.19 ‘pareto’ – Pareto distribution (of first kind) ----------------------------------------------------- PDF: x^(-(a+1)) constant: a * k^a domain: k < x < infinity parameters 2 (2): k, a No. name default ‘[0]’ k > 0 (shape, location) ‘[1]’ a > 0 (shape) reference: [JKBb94: Ch.20; p.574] special generators: ‘INV’ Inversion method  File: unuran.info, Node: powerexponential, Next: rayleigh, Prev: pareto, Up: Stddist_CONT 7.1.20 ‘powerexponential’ – Powerexponential (Subbotin) distribution -------------------------------------------------------------------- PDF: exp( -|x|^tau ) constant: 1 / (2 * Gamma(1+1/tau)) domain: -infinity < x < infinity parameters 1 (1): tau No. name default ‘[0]’ tau > 0 (shape) reference: [JKBc95: Ch.24; p.195] special generators: ‘DEF’ Transformed density rejection (only for tau >= 1) [DLa86]  File: unuran.info, Node: rayleigh, Next: slash, Prev: powerexponential, Up: Stddist_CONT 7.1.21 ‘rayleigh’ – Rayleigh distribution ----------------------------------------- PDF: x * exp( -1/2 * (x/sigma)^2 ) constant: 1 / sigma^2 domain: 0 <= x < infinity parameters 1 (1): sigma No. name default ‘[0]’ sigma > 0 (scale) reference: [JKBb94: Ch.18; p.456]  File: unuran.info, Node: slash, Next: student, Prev: rayleigh, Up: Stddist_CONT 7.1.22 ‘slash’ – Slash distribution ----------------------------------- PDF: (1 - exp(-x^2/2)) / x^2 constant: 1 / sqrt(2 pi) CDF: not implemented! domain: -infinity < x < infinity reference: [JKBb94: Ch.12; p.63] special generators: ‘DEF’ Ratio of normal and uniform random variates  File: unuran.info, Node: student, Next: triangular, Prev: slash, Up: Stddist_CONT 7.1.23 ‘student’ – Student’s t distribution ------------------------------------------- PDF: (1+t^2/nu)^(-(nu+1)/2) constant: 1 / (sqrt(nu) * B(1/2,nu/2)) CDF: not implemented! domain: -infinity < x < infinity parameters 1 (1): nu No. name default ‘[0]’ nu > 0 (shape) reference: [JKBc95: Ch.28; p.362]  File: unuran.info, Node: triangular, Next: uniform, Prev: student, Up: Stddist_CONT 7.1.24 ‘triangular’ – Triangular distribution --------------------------------------------- PDF: 2*x / H, for 0 <= x <= H 2*(1-x) / (1-H), for H <= x <= 1 constant: 1 domain: 0 <= x <= 1 parameters 0 (1): [ H ] No. name default ‘[0]’ H 0 <= H <= 1 1/2 (shape) reference: [JKBc95: Ch.26; p.297] special generators: ‘INV’ Inversion method  File: unuran.info, Node: uniform, Next: weibull, Prev: triangular, Up: Stddist_CONT 7.1.25 ‘uniform’ – Uniform distribution --------------------------------------- PDF: 1 / (b-a) constant: 1 domain: a < x < b parameters 0 (2): [ a, b ] No. name default ‘[0]’ a 0 (location) ‘[1]’ b > a 1 (location) reference: [JKBc95: Ch.26; p.276] special generators: ‘INV’ Inversion method  File: unuran.info, Node: weibull, Prev: uniform, Up: Stddist_CONT 7.1.26 ‘weibull’ – Weibull distribution --------------------------------------- PDF: ((x-zeta)/alpha)^(c-1) * exp( -((x-zeta)/alpha)^c ) constant: c / alpha domain: zeta < x < infinity parameters 1 (3): c [, alpha [, zeta ] ] No. name default ‘[0]’ c > 0 (shape) ‘[1]’ alpha > 0 1 (scale) ‘[2]’ zeta 0 (location) reference: [JKBb94: Ch.21; p.628] special generators: ‘INV’ Inversion method  File: unuran.info, Node: Stddist_CVEC, Next: Stddist_DISCR, Prev: Stddist_CONT, Up: Stddist 7.2 UNU.RAN Library of continuous multivariate distributions ============================================================ * Menu: * copula:: Copula (distribution with uniform marginals) * multicauchy:: Multicauchy distribution * multiexponential:: Multiexponential distribution * multinormal:: Multinormal distribution * multistudent:: Multistudent distribution  File: unuran.info, Node: copula, Next: multicauchy, Up: Stddist_CVEC 7.2.1 ‘copula’ – Copula (distribution with uniform marginals) ------------------------------------------------------------- ‘UNUR_DISTR *unur_distr_copula(int dim, const double *rankcorr)’ creates a distribution object for a copula with DIM components. RANKCORR is an array of size DIMxDIM and holds the rank correlation matrix (Spearman’s correlation), where the rows of the matrix are stored consecutively in this array. The ‘NULL’ pointer can be used instead the identity matrix. If COVAR is not a valid rank correlation matrix (i.e., not positive definite) then no distribution object is created and ‘NULL’ is returned.  File: unuran.info, Node: multicauchy, Next: multiexponential, Prev: copula, Up: Stddist_CVEC 7.2.2 ‘multicauchy’ – Multicauchy distribution ---------------------------------------------- PDF: f(x) = 1 / ( 1 + (x-mu)^t . Sigma^(-1) . (x-mu) )^((dim+1)/2) constant: Gamma((dim+1)/2) / ( pi^((dim+1)/2) * sqrt(det(Sigma)) ) domain: -infinity^(dim) < x < infinity^(dim) parameters 0 (2): [ mu, Sigma ] No. name default ‘[0]’ mu (0,...,0) (location) ‘[1]’ Sigma Symm, Pos. I (shape) def. special generators: ‘DEF’ Cholesky factor  File: unuran.info, Node: multiexponential, Next: multinormal, Prev: multicauchy, Up: Stddist_CVEC 7.2.3 ‘multiexponential’ – Multiexponential distribution -------------------------------------------------------- PDF: f(x) = Prod_(i=0)^(i=dim-1) exp(-(dim-i) (x_(i)-x_(i-1) - (theta_i-theta_(i-1)) ) / sigma_i); with x_(-1)=0 and theta_(i-1)=0 constant: Prod_(i=0)^(i=dim-1) 1/sigma_i domain: 0^(dim) <= x < infinity^(dim) parameters 0 (2): [ sigma, theta ] No. name default ‘[0]’ sigma (1,...,1) (shape) ‘[1]’ theta (0,...,0) (location)  File: unuran.info, Node: multinormal, Next: multistudent, Prev: multiexponential, Up: Stddist_CVEC 7.2.4 ‘multinormal’ – Multinormal distribution ---------------------------------------------- PDF: f(x) = exp( -1/2 * (x-mu)^t . Sigma^(-1) . (x-mu) ) constant: 1 / ( (2 pi)^(dim/2) * sqrt(det(Sigma)) ) domain: -infinity^(dim) < x < infinity^(dim) parameters 0 (2): [ mu, Sigma ] No. name default ‘[0]’ mu (0,...,0) (location) ‘[1]’ Sigma Symm, Pos. I (shape) def. reference: [KBJe00: Ch.45; p.105]  File: unuran.info, Node: multistudent, Prev: multinormal, Up: Stddist_CVEC 7.2.5 ‘multistudent’ – Multistudent distribution ------------------------------------------------ PDF: f(x) = 1 / ( 1 + (x-mu)^t . Sigma^(-1) . (x-mu) / m)^((dim+m)/2) ) constant: Gamma((dim+m)/2) / ( Gamma(m/2) (m*pi)^(dim/2) * sqrt(det(Sigma)) ) domain: -infinity^(dim) < x < infinity^(dim) parameters 0 (3): [ m, mu, Sigma ] No. name default ‘[0]’ m m>0 1 (location) ‘[1]’ mu (0,...,0) (location) ‘[2]’ Sigma Symm, Pos. I (shape) def.  File: unuran.info, Node: Stddist_DISCR, Next: Stddist_MATR, Prev: Stddist_CVEC, Up: Stddist 7.3 UNU.RAN Library of discrete univariate distributions ======================================================== * Menu: * binomial:: Binomial distribution * geometric:: Geometric distribution * hypergeometric:: Hypergeometric distribution * logarithmic:: Logarithmic distribution * negativebinomial:: Negative Binomial distribution * poisson:: Poisson distribution At the moment there are no CDFs implemented for discrete distribution. Thus ‘unur_distr_discr_upd_pmfsum’ does not work properly for truncated distribution.  File: unuran.info, Node: binomial, Next: geometric, Up: Stddist_DISCR 7.3.1 ‘binomial’ – Binomial distribution ---------------------------------------- PMF: (n \choose k) * p^k * (1-p)^(n-k) constant: 1 domain: 0 <= k <= n parameters 2 (2): n, p No. name default ‘[0]’ n >= 1 (no. of elements) ‘[1]’ p 0 < p < 1 (shape) reference: [JKKa92: Ch.3; p.105] special generators: ‘DEF’ Ratio of Uniforms/Inversion [STa89]  File: unuran.info, Node: geometric, Next: hypergeometric, Prev: binomial, Up: Stddist_DISCR 7.3.2 ‘geometric’ – Geometric distribution ------------------------------------------ PMF: p * (1-p)^k constant: 1 domain: 0 <= k < infinity parameters 1 (1): p No. name default ‘[0]’ p 0 < p < 1 (shape) reference: [JKKa92: Ch.5.2; p.201] special generators: ‘INV’ Inversion method  File: unuran.info, Node: hypergeometric, Next: logarithmic, Prev: geometric, Up: Stddist_DISCR 7.3.3 ‘hypergeometric’ – Hypergeometric distribution ---------------------------------------------------- PMF: (M \choose k) * (N-M \choose n-k) / (N \choose n) constant: 1 domain: max(0,n-N+M) <= k <= min(n,M) parameters 3 (3): N, M, n No. name default ‘[0]’ N >= 1 (no. of elements) ‘[1]’ M 1 <= M <= N (shape) ‘[2]’ n 1 <= n <= N (shape) reference: [JKKa92: Ch.6; p.237] special generators: ‘DEF’ Ratio of Uniforms/Inversion [STa89]  File: unuran.info, Node: logarithmic, Next: negativebinomial, Prev: hypergeometric, Up: Stddist_DISCR 7.3.4 ‘logarithmic’ – Logarithmic distribution ---------------------------------------------- PMF: theta^k / k constant: - log( 1.-theta); domain: 1 <= k < infinity parameters 1 (1): theta No. name default ‘[0]’ theta 0 < theta < (shape) 1 reference: [JKKa92: Ch.7; p.285] special generators: ‘DEF’ Inversion/Transformation [KAa81]  File: unuran.info, Node: negativebinomial, Next: poisson, Prev: logarithmic, Up: Stddist_DISCR 7.3.5 ‘negativebinomial’ – Negative Binomial distribution --------------------------------------------------------- PMF: (k+r-1 \choose r-1) * p^r * (1-p)^k constant: 1 domain: 0 <= k < infinity parameters 2 (2): p, r No. name default ‘[0]’ p 0 < p < 1 (shape) ‘[1]’ r > 0 (shape) reference: [JKKa92: Ch.5.1; p.200]  File: unuran.info, Node: poisson, Prev: negativebinomial, Up: Stddist_DISCR 7.3.6 ‘poisson’ – Poisson distribution -------------------------------------- PMF: theta^k / k! constant: exp(theta) domain: 0 <= k < infinity parameters 1 (1): theta No. name default ‘[0]’ theta > 0 (shape) reference: [JKKa92: Ch.4; p.151] special generators: ‘DEF’ Tabulated Inversion combined with Acceptance Complement [ADb82] ‘2’ Tabulated Inversion combined with Patchwork Rejection [ZHa94]  File: unuran.info, Node: Stddist_MATR, Prev: Stddist_DISCR, Up: Stddist 7.4 UNU.RAN Library of random matrices ====================================== * Menu: * correlation:: Random correlation matrix  File: unuran.info, Node: correlation, Up: Stddist_MATR 7.4.1 ‘correlation’ – Random correlation matrix ----------------------------------------------- ‘UNUR_DISTR *unur_distr_correlation( int n )’ creates a distribution object for a random correlation matrix of N rows and columns. It can be used with method MCORR (*note Random Correlation Matrix: MCORR.) to generate random correlation matrices of the given size.  File: unuran.info, Node: Error_Debug, Next: Testing, Prev: Stddist, Up: Top 8 Error handling and Debugging ****************************** * Menu: * Output_streams:: Output streams * Debug:: Debugging * Error_reporting:: Error reporting * Errno:: Error codes * Error_handlers:: Error handlers UNU.RAN routines report an error whenever they cannot perform the requested task. Additionally it is possible to get information about the generated distribution of generator objects for debugging purposes. However, the latter must be enabled when compiling and installing the library. (It is disabled by default.) This chapter describes all necessary details: • Choose an output stream to for writing the requested information. • Select a debugging level. • Select an error handler. • Write your own error handler. • Get more information for a particular error code.  File: unuran.info, Node: Output_streams, Next: Debug, Up: Error_Debug 8.1 Output streams ================== UNU.RAN uses a logfile for writing all error messages, warnings, and debugging information onto an output stream. This stream can be set at runtime by the ‘unur_set_stream’ call. If no such stream is given by the user a default stream is used by the library: all messages are written into the file ‘unuran.log’ in the current working directory. The name of this logfile is defined by the macro ‘UNUR_LOG_FILE’ in ‘unuran_config.h’. (If UNU.RAN fails to open this file for writing, ‘stderr’ is used instead.) To destinguish between messages for different objects each of these has its own identifier which is composed by the name of the distribution obejct and generator type, resp., followed by a dot and three digits. (If there are more than 999 generators then the identifiers are not unique.) _Remark:_ Writting debugging information must be switched on at compile time using the configure flag ‘--enable-logging’, see *note Debugging: Debug. Function reference ------------------ -- Function: FILE* unur_set_stream (FILE* NEW_STREAM) This function sets a new file handler for the output stream, NEW_STREAM, for the UNU.RAN library routines. The previous handler is returned (so that you can restore it later). Note that the pointer to a user defined file handler is stored in a static variable, so there can be only one output stream handler per program. This function should be not be used in multi-threaded programs except to set up a program-wide error handler from a master thread. The ‘NULL’ pointer is not allowed. (If you want to disable logging of debugging information use unur_set_default_debug(UNUR_DEBUG_OFF) instead. If you want to disable error messages at all use ‘unur_set_error_handler_off’. ) -- Function: FILE* unur_get_stream (void) Get the file handle for the current output stream. It can be used to allow applications to write additional information into the logfile.  File: unuran.info, Node: Debug, Next: Error_reporting, Prev: Output_streams, Up: Error_Debug 8.2 Debugging ============= The UNU.RAN library has several debugging levels which can be switched on/off by debugging flags. This debugging feature must be enabled when building the library using the ‘--enable-logging’ configure flag. The debugging levels range from print a short description of the created generator object to a detailed description of hat functions and tracing the sampling routines. The output is printed onto the debugging output stream (*note Output streams: Output_streams.). The debugging flags can be set or changed by the respective calls ‘unur_set_debug’ and ‘unur_chg_debug’ independently for each generator. By default flag ‘UNUR_DEBUG_INIT’ (see below) is used. This default flags is set by the macro ‘UNUR_DEBUGFLAG_DEFAULT’ in ‘unuran_config.h’ and can be changed at runtime by a ‘unur_set_default_debug’ call. Off course these debugging flags depend on the chosen method. Since most of these are merely for debugging the library itself, a description of the flags are given in the corresponding source files of the method. Nevertheless, the following flags can be used with all methods. Common debug flags: ‘UNUR_DEBUG_OFF’ switch off all debuging information ‘UNUR_DEBUG_ALL’ all avaivable information ‘UNUR_DEBUG_INIT’ parameters of generator object after initialization ‘UNUR_DEBUG_SETUP’ data created at setup ‘UNUR_DEBUG_ADAPT’ data created during adaptive steps ‘UNUR_DEBUG_SAMPLE’ trace sampling Notice that these are flags which could be combined using the ‘|’ operator. Almost all routines check a given pointer before they read from or write to the given address. This does not hold for time-critical routines like all sampling routines. Thus you are responsible for checking a pointer that is returned from a ‘unur_init’ call. However, it is possible to turn on checking for invalid ‘NULL’ pointers even in such time-critical routines by building the library using the ‘--enable-check-struct’ configure flag. Another debugging tool used in the library are magic cookies that validate a given pointer. It produces an error whenever a given pointer points to an object that is invalid in the context. The usage of magic cookies is also switched on by the ‘--enable-check-struct’ configure flag. Function reference ------------------ -- Function: int unur_set_debug (UNUR_PAR* PARAMETERS, unsigned DEBUG) Set debugging flags for generator. -- Function: int unur_chg_debug (UNUR_GEN* GENERATOR, unsigned DEBUG) Change debugging flags for generator. -- Function: int unur_set_default_debug (unsigned DEBUG) Change default debugging flag.  File: unuran.info, Node: Error_reporting, Next: Errno, Prev: Debug, Up: Error_Debug 8.3 Error reporting =================== UNU.RAN routines report an error whenever they cannot perform the requested task. For example, applying transformed density rejection to a distribution that violates the T-concavity condition, or trying to set a parameter that is out of range, result in an error message. It might also happen that the setup fails for transformed density rejection for a T-concave distribution with some extreme density function simply because of round-off errors that makes the generation of a hat function numerically impossible. Situations like this may happen when using black box algorithms and you should check the return values of all routines. All ‘..._set_...’, and ‘..._chg_...’ calls return ‘UNUR_SUCCESS’ if they could be executed successfully. Otherwise, some error codes are returned if it was not possible to set or change the desired parameters, e.g. because the given values are out of range, or simply because the set call does not work for the chosen method. All routines that return a pointer to the requested object will return a ‘NULL’ pointer in case of error. (Thus you should always check the pointer to avoid possible segmentation faults. Sampling routines usually do not check the given pointer to the generator object.) The library distinguishes between two major classes of error: _(fatal) errors:_ The library was not able to construct the requested object. _warnings:_ Some problems encounters while constructing a generator object. The routine has tried to solve the problem but the resulting object might not be what you want. For example, chosing a special variant of a method does not work and the initialization routine might switch to another variant. Then the generator produces random variates of the requested distribution but correlation induction is not possible. However, it also might happen that changing the domain of a distribution has failed. Then the generator produced random variates with too large/too small range, i.e. their distribution is not correct. It is obvious from the example that this distinction between errors and warning is rather crude and sometimes arbitrary. UNU.RAN routines use the global variable UNUR_ERRNO to report errors, completely analogously to ERRNO in the ANSI C standard library. (However this approach is not thread-safe. There can be only one instance of a global variable per program. Different threads of execution may overwrite UNUR_ERRNO simultaneously). Thus when an error occurs the caller of the routine can examine the error code in UNUR_ERRNO to get more details about the reason why a routine failed. You get a short description of the error by a ‘unur_get_strerror’ call. All the error code numbers have prefix ‘UNUR_ERR_’ and expand to non-zero constant unsigned integer values. Error codes are divided into six main groups, see *note Error codes: Errno. Alternatively, the variable UNUR_ERRNO can also read by a ‘unur_get_errno’ call and can be reset by the ‘unur_reset_errno’ call (this is in particular required for the Windows version of the library). Additionally, there exists a error handler (*note Error handlers: Error_handlers.) that is invoked in case of an error. In addition to reporting errors by setting error codes in UNUR_ERRNO, the library also has an error handler function. This function is called by other library functions when they report an error, just before they return to the caller (*note Error handlers: Error_handlers.). The default behavior of the error handler is to print a short message: AROU.004: [error] arou.c:1500 - (generator) condition for method violated: AROU.004: ..> PDF not unimodal The purpose of the error handler is to provide a function where a breakpoint can be set that will catch library errors when running under the debugger. It is not intended for use in production programs, which should handle any errors using the return codes. Function reference ------------------ -- Variable: extern int unur_errno Global variable for reporting diagnostics of error. -- Function: int unur_get_errno (void) Get current value of global variable UNUR_ERRNO. -- Function: void unur_reset_errno (void) Reset global variable UNUR_ERRNO to ‘UNUR_SUCCESS’ (i.e., no errors occured). -- Function: const char* unur_get_strerror (const INT ERRNOCODE) Get a short description for error code value.  File: unuran.info, Node: Errno, Next: Error_handlers, Prev: Error_reporting, Up: Error_Debug 8.4 Error codes =============== List of error codes ................... • Procedure executed successfully (no error) ‘UNUR_SUCCESS (0x0u)’ success (no error) • Errors that occurred while handling distribution objects. ‘UNUR_ERR_DISTR_SET’ set failed (invalid parameter). ‘UNUR_ERR_DISTR_GET’ get failed (parameter not set). ‘UNUR_ERR_DISTR_NPARAMS’ invalid number of parameters. ‘UNUR_ERR_DISTR_DOMAIN’ parameter(s) out of domain. ‘UNUR_ERR_DISTR_GEN’ invalid variant for special generator. ‘UNUR_ERR_DISTR_REQUIRED’ incomplete distribution object, entry missing. ‘UNUR_ERR_DISTR_UNKNOWN’ unknown distribution, cannot handle. ‘UNUR_ERR_DISTR_INVALID’ invalid distribution object. ‘UNUR_ERR_DISTR_DATA’ data are missing. ‘UNUR_ERR_DISTR_PROP’ desired property does not exist • Errors that occurred while handling parameter objects. ‘UNUR_ERR_PAR_SET’ set failed (invalid parameter) ‘UNUR_ERR_PAR_VARIANT’ invalid variant -> using default ‘UNUR_ERR_PAR_INVALID’ invalid parameter object • Errors that occurred while handling generator objects. ‘UNUR_ERR_GEN’ error with generator object. ‘UNUR_ERR_GEN_DATA’ (possibly) invalid data. ‘UNUR_ERR_GEN_CONDITION’ condition for method violated. ‘UNUR_ERR_GEN_INVALID’ invalid generator object. ‘UNUR_ERR_GEN_SAMPLING’ sampling error. ‘UNUR_ERR_NO_REINIT’ reinit routine not implemented. ‘UNUR_ERR_NO_QUANTILE’ quantile routine not implemented. • Errors that occurred while handling URNG objects. ‘UNUR_ERR_URNG’ generic error with URNG object. ‘UNUR_ERR_URNG_MISS’ missing functionality. • Errors that occurred while parsing strings. ‘UNUR_ERR_STR’ error in string. ‘UNUR_ERR_STR_UNKNOWN’ unknown keyword. ‘UNUR_ERR_STR_SYNTAX’ syntax error. ‘UNUR_ERR_STR_INVALID’ invalid parameter. ‘UNUR_ERR_FSTR_SYNTAX’ syntax error in function string. ‘UNUR_ERR_FSTR_DERIV’ cannot derivate function. • Other run time errors. ‘UNUR_ERR_DOMAIN’ argument out of domain. ‘UNUR_ERR_ROUNDOFF’ (serious) round-off error. ‘UNUR_ERR_MALLOC’ virtual memory exhausted. ‘UNUR_ERR_NULL’ invalid ‘NULL’ pointer. ‘UNUR_ERR_COOKIE’ invalid cookie. ‘UNUR_ERR_GENERIC’ generic error. ‘UNUR_ERR_SILENT’ silent error (no error message). ‘UNUR_ERR_INF’ infinity occured. ‘UNUR_ERR_NAN’ NaN occured. ‘UNUR_ERR_COMPILE’ Requested routine requires different compilation switches. Recompilation of library necessary. ‘UNUR_ERR_SHOULD_NOT_HAPPEN’ Internal error, that should not happen. Please report this bug!  File: unuran.info, Node: Error_handlers, Prev: Errno, Up: Error_Debug 8.5 Error handlers ================== The default behavior of the UNU.RAN error handler is to print a short message onto the output stream, usually a logfile (*note Output streams: Output_streams.), e.g., AROU.004: [error] arou.c:1500 - (generator) condition for method violated: AROU.004: ..> PDF not unimodal This error handler can be switched off using the ‘unur_set_error_handler_off’ call, or replace it by a new one. Thus it allows to set a breakpoint that will catch library errors when running under the debugger. It also can be used to redirect error messages when UNU.RAN is included in general purpose libraries or in interactive programming environments. -- Data Type: UNUR_ERROR_HANDLER This is the type of UNU.RAN error handler functions. An error handler will be passed six arguments which specify the identifier of the object where the error occured (a string), the name of the source file in which it occurred (also a string), the line number in that file (an integer), the type of error (a string: ‘"error"’ or ‘"warning"’), the error number (an integert), and the reason for the error (a string). The source file and line number are set at compile time using the ‘__FILE__’ and ‘__LINE__’ directives in the preprocessor. The error number can be translated into a short description using a ‘unur_get_strerror’ call. An error handler function returns type ‘void’. Error handler functions should be defined like this, void my_handler( const char *objid, const char *file, int line, const char *errortype, int unur_errno, const char *reason ) To request the use of your own error handler you need the call ‘unur_set_error_handler’. Function reference ------------------ -- Function: UNUR_ERROR_HANDLER* unur_set_error_handler (UNUR_ERROR_HANDLER* NEW_HANDLER) This function sets a new error handler, NEW_HANDLER, for the UNU.RAN library routines. The previous handler is returned (so that you can restore it later). Note that the pointer to a user defined error handler function is stored in a static variable, so there can be only one error handler per program. This function should be not be used in multi-threaded programs except to set up a program-wide error handler from a master thread. To use the default behavior set the error handler to ‘NULL’. -- Function: UNUR_ERROR_HANDLER* unur_set_error_handler_off (void) This function turns off the error handler by defining an error handler which does nothing (except of setting UNUR_ERRNO. The previous handler is returned (so that you can restore it later).  File: unuran.info, Node: Testing, Next: Misc, Prev: Error_Debug, Up: Top 9 Testing ********* The following routines can be used to test the performance of the implemented generators and can be used to verify the implementions. They are declared in ‘unuran_tests.h’ which has to be included. Function reference ------------------ -- Function: void unur_run_tests (UNUR_PAR* PARAMETERS, unsigned TESTS, FILE* OUT) Run a battery of tests. The following tests are available (use ‘|’ to combine these tests): ‘UNUR_TEST_ALL’ run all possible tests. ‘UNUR_TEST_TIME’ estimate generation times. ‘UNUR_TEST_N_URNG’ count number of uniform random numbers ‘UNUR_TEST_N_PDF’ count number of PDF calls ‘UNUR_TEST_CHI2’ run chi^2 test for goodness of fit ‘UNUR_TEST_SAMPLE’ print a small sample. All these tests can be started individually (see below). -- Function: void unur_test_printsample (UNUR_GEN* GENERATOR, int N_ROWS, int N_COLS, FILE* OUT) Print a small sample with N_ROWS rows and N_COLS columns. OUT is the output stream to which all results are written. -- Function: UNUR_GEN* unur_test_timing (UNUR_PAR* PARAMETERS, int LOG10_SAMPLESIZE, double* TIME_SETUP, double* TIME_SAMPLE, int VERBOSITY, FILE* OUT) Timing. PARAMETERS is an parameter object for which setup time and marginal generation times have to be measured. The results are written into TIME_SETUP and TIME_SAMPLE, respectively. LOG10_SAMPLESIZE is the common logarithm of the sample size that is used for timing. If VERBOSITY is ‘TRUE’ then a small table is printed to output stream OUT with setup time, marginal generation time and average generation times for generating 10, 100, ... random variates. All times are given in micro seconds and relative to the generation times for the underlying uniform random number (using the UNIF interface) and an exponential distributed random variate using the inversion method. The created generator object is returned. If a generator object could not be created successfully, then ‘NULL’ is returned. If VERBOSITY is ‘TRUE’ the result is written to the output stream OUT. Notice: All timing results are subject to heavy changes. Reruning timings usually results in different results. Minor changes in the source code can cause changes in such timings up to 25 percent. -- Function: double unur_test_timing_R (UNUR_PAR* PARAMETERS, const CHAR* DISTRSTR, const CHAR* METHODSTR, double LOG10_SAMPLESIZE, double* TIME_SETUP, double* TIME_MARGINAL) Timing. PARAMETERS is an parameter object for which setup time and marginal generation times have to be measured. The results are written into TIME_SETUP and TIME_MARGINAL, respectively. LOG10_SAMPLESIZE is the common logarithm of the sample size that is used for timing. Alternatively, one could provide the "parameter object" using strings DISTRSTR and METHODSTR as used for ‘unur_makegen_ssu’. The results are more accurate than those of function ‘unur_test_timing’ as the timings are computed using linear regression with several timings for sample size 1 and 10^LOG10_SAMPLESIZE. For each sample size total generation time (including setup) is measured 10 times. Since the these timings can be influenced by external effects (like disc sync or handling of interupts) the 2 fastest and the 3 slowest timings are discarded. Intercept and slope for simple linear regression are than stored and R^2 is returned. In case of an error ‘-100.’ is returned. Notice: All timing results are subject to heavy changes. Reruning timings usually results in different results. Minor changes in the source code can cause changes in such timings up to 25 percent. -- Function: double unur_test_timing_uniform (const UNUR_PAR* PARAMETERS, int LOG10_SAMPLESIZE) -- Function: double unur_test_timing_exponential (const UNUR_PAR* PARAMETERS, int LOG10_SAMPLESIZE) Marginal generation times for the underlying uniform random number (using the UNIF interface) and an exponential distributed random variate using the inversion method. These times are used in ‘unur_test_timing’ to compute the relative timings results. -- Function: double unur_test_timing_total (const UNUR_PAR* PARAMETERS, int SAMPLESIZE, double AVG_DURATION) Timing. PARAMETERS is an parameter object for which average times a sample of size SAMPLESIZE (including setup) are estimated. Thus sampling is repeated and the median of these timings is returned (in micro seconds). The number of iterations is computed automatically such that the total amount of time necessary for the test ist approximately AVG_DURATION (given in seconds). However, for very slow generator with expensive setup time the time necessary for this test may be (much) larger. If an error occurs then ‘-1’ is returned. Notice: All timing results are subject to heavy changes. Reruning timings usually results in different results. Minor changes in the source code can cause changes in such timings up to 25 percent. -- Function: int unur_test_count_urn (UNUR_GEN* GENERATOR, int SAMPLESIZE, int VERBOSITY, FILE* OUT) Count used uniform random numbers. It returns the total number of uniform random numbers required for a sample of non-uniform random variates of size SAMPLESIZE. In case of an error ‘-1’ is returned. If VERBOSITY is ‘TRUE’ the result is written to the output stream OUT. _Notice:_ This test uses global variables to store counters. Thus it is not thread save. -- Function: int unur_test_count_pdf (UNUR_GEN* GENERATOR, int SAMPLESIZE, int VERBOSITY, FILE* OUT) Count evaluations of PDF and similar functions. It returns the total number of evaluations of all such functions required for a sample of non-uniform random variates of size SAMPLESIZE. If VERBOSITY is ‘TRUE’ then a more detailed report is printed to the output stream OUT. In case of an error ‘-1’ is returned. This test is run on a copy of the given generator object. _Notice:_ The printed numbers of evaluation should be interpreted with care. For example, methods either use the PDF or the logPDF; if only the logPDF is given, but a method needs the PDF then both the logPDF and the PDF (a wrapper around the logPDF) are called and thus one call to the PDF is counted twice. _Notice:_ This test uses global variables to store function pointers and counters. Thus it is not thread save. -- Function: int unur_test_par_count_pdf (UNUR_PAR* PARAMETERS, int SAMPLESIZE, int VERBOSITY, FILE* OUT) Same as ‘unur_test_count_pdf’ except that it is run on a parameter object. Thus it also prints the number of function evaluations for the setup. The temporary created generator object is destroyed before the results are returned. -- Function: double unur_test_chi2 (UNUR_GEN* GENERATOR, int INTERVALS, int SAMPLESIZE, int CLASSMIN, int VERBOSITY, FILE* OUT) Run a Chi^2 test with the GENERATOR. The resulting p-value is returned. It works with discrete und continuous univariate distributions. For the latter the CDF of the distribution is required. INTERVALS is the number of intervals that is used for continuous univariate distributions. SAMPLESIZE is the size of the sample that is used for testing. If it is set to ‘0’ then a sample of size INTERVALS^2 is used (bounded to some upper bound). CLASSMIN is the minimum number of expected entries per class. If a class has to few entries then some classes are joined. VERBOSITY controls the output of the routine. If it is set to ‘1’ then the result is written to the output stream OUT. If it is set to ‘2’ additionally the list of expected and observed data is printed. If it is set to ‘3’ then all generated numbers are printed. There is no output when it is set to ‘0’. _Notice:_ For multivariate distributions the generated points are transformed by the inverse of the Cholesky factor of the covariance matrix and the mean vectors (if given for the underlying distribution). The marginal distributions of the transformed vectors are then tested against the marginal distribution given by a ‘unur_distr_cvec_set_marginals’ or ‘unur_distr_cvec_set_marginal_array’ call. (Notice that these marginal distributions are never set by default for any of the distributions provided by UNU.RAN.) Then the Bonferroni corrected p-value of all these tests is returned. However, the test may not be performed correctly if the domain of the underlying distribution is truncated by a ‘unur_distr_cvec_set_domain_rect’ call and the components of the distribution are correlated (i.e. ‘unur_distr_cvec_set_covar’ is called with the non-NULL argument). Then it almost surely will fail. -- Function: int unur_test_moments (UNUR_GEN* GENERATOR, double* MOMENTS, int N_MOMENTS, int SAMPLESIZE, int VERBOSITY, FILE* OUT) Computes the first N_MOMENTS central moments for a sample of size SAMPLESIZE. The result is stored into the array MOMENTS. N_MOMENTS must be an integer between ‘1’ and ‘4’. For multivariate distributions the moments are stored consecutively for each dimension and the provided MOMENTS-array must have a length of at least (N_MOMENTS+1) * DIM, where DIM is the dimension of the multivariate distribution. The M’th moment for the D’th dimension (0<=D= f(x) for all x in the domain of the distribution. To generate the pair (X,Y) we generate X from the distribution with density proportional to h(x) and Y uniformly between 0 and h(X). The first step (generate X ) is usually done by inversion (*note Inversion::). Thus the general rejection algorithm for a hat h(x) with inverse CDF H^(-1) consists of the following steps: 1. Generate a U(0,1) random number U. 2. Set X to H^(-1)(U). 3. Generate a U(0,1) random number V. 4. Set Y to V h(X). 5. If Y <= f(X) accept X as the random variate. 6. Else try again. If the evaluation of the density f(x) is expensive (i.e., time consuming) it is possible to use a simple lower bound of the density as so called _squeeze function_ s(x) (the triangular shaped function in the above figure is an example for such a squeeze). We can then accept X when Y <= s(X) and can thus often save the evaluation of the density. We have seen so far that the rejection principle leads to short and simple generation algorithms. The main practical problem to apply the rejection algorithm is the search for a good fitting hat function and for squeezes. We do not discuss these topics here as they are the heart of the different automatic algorithms implemented in UNU.RAN. Information about the construction of hat and squeeze can therefore be found in the descriptions of the methods. The performance characteristics of rejection algorithms mainly depend on the fit of the hat and the squeeze. It is not difficult to prove that: • The expected number of trials to generate one variate is the ratio between the area below the hat and the area below the density. • The expected number of evaluations of the density necessary to generate one variate is equal to the ratio between the area below the hat and the area below the density, when no squeeze is used. Otherwise, when a squeeze is given it is equal to the ratio between the area between hat and squeeze and the area below the hat. • The ‘sqhratio’ (i.e., the ratio between the area below the squeeze and the area below the hat) used in some of the UNU.RAN methods is easy to compute. It is useful as its reciprocal is an upper bound for the expected number of trials of the rejection algoritm. The expected number of evaluations of the density is bounded by (1/sqhratio)-1.  File: unuran.info, Node: Composition, Next: Ratio-of-Uniforms, Prev: Rejection, Up: RVG A.3 The Composition Method ========================== The composition method is an important principle to facilitate and speed up random variate generation. The basic idea is simple. To generate random variates with a given density we first split the domain of the density into subintervals. Then we select one of these randomly with probabilities given by the area below the density in the respective subintervals. Finally we generate a random variate from the density of the selected part by inversion and return it as random variate of the full distribution. Composition can be combined with rejection. Thus it is possible to decompose the domain of the distribution into subintervals and to construct hat and squeeze functions seperatly in every subinterval. The area below the hat must be determined in every subinterval. Then the Composition rejection algorithm contains the following steps: 1. Generate the index J of the subinterval as the realisation of a discrete random variate with probabilities proportional to the area below the hat. 2. Generate a random variate X proportional to the hat in interval J. 3. Generate the U(0,f(X)) random number Y. 4. If Y <= f(X) accept X as random variate. 5. Else start again with generating the index J. The first step can be done in constant time (i.e., independent of the number of chosen subintervals) by means of the indexed search method (*note IndexedSearch::). It is possible to reduce the number of uniform random numbers required in the above algorithm by recycling the random numbers used in Step 1 and additionally by applying the principle of _immediate acceptance_. For details see [HLD04: Sect. 3.1] .  File: unuran.info, Node: Ratio-of-Uniforms, Next: DiscreteInversion, Prev: Composition, Up: RVG A.4 The Ratio-of-Uniforms Method ================================ The construction of an appropriate hat function for the given density is the crucial step for constructing rejection algorithms. Equivalently we can try to find an appropriate envelope for the region between the graph of the density and the x-axis, such that we can easily sample uniformly distributed random points. This task could become easier if we can find transformations that map the region between the density and the axis into a region of more suitable shape (for example into a bounded region). As a first example we consider the following simple algorithm for the Cauchy distribution. 1. Generate a U(-1,1) random number U and a U(0,1) random number V. 2. If U^2 + V^2 <= 1 accept X=U/V as a Cauchy random variate. 3. Else try again. It is possible to prove that the above algorithm indeed generates Cauchy random variates. The fundamental principle behind this algorithm is the fact that the region below the density is mapped by the transformation (X,Y) -> (U,V)=(2 Xsqrt(Y),2 sqrt(Y)) into a half-disc in such a way that the ratio between the area of the image to the area of the preimage is constant. This is due to the fact that that the Jacobian of this transformation is constant. [image src="figures/rou-cauchy.png" text=" ^ v | | +---------------------------*-***********-*---------------------------+ | *****.......|.......***** | | ****............|............**** | | **................|................** | | **...................|...................** | | *.....................|.....................* | | *.......................|.......................* | | *........................|.........................* | | *..........................|..........................* | | *...........................|...........................* | | *............................|............................* | | *.............................|.............................* | | *..............................|..............................* | | *...............................|...............................* | | *...............................|................................* | | *................................|................................* | | *................................|................................* | |*.................................|.................................*| |*.................................|.................................*| *..................................|..................................* *..................................|..................................* *..................................|..................................* ---*----------------------------------+----------------------------------*--> u "] The above example is a special case of a more general principle, called the _Ratio-of-uniforms (RoU) method_. It is based on the fact that for a random variable X with density f(x) and some constant mu we can generate X from the desired density by calculating X=U/V+ mu for a pair (U,V) uniformly distributed in the set A_f= { (u,v) : 0 < v <= sqrt(f(u/v+ mu)) } . For most distributions it is best to set the constant mu equal to the mode of the distribution. For sampling random points uniformly distributed in A_f rejection from a convenient enveloping region is used, usually the minimal bounding rectangle, i.e., the smallest possible rectangle that contains A_f (see the above figure). It is given by (u^-,u^+)x(0,v^+) where v^+ = sup_(b_l P 4. Set X to X+1 and P to P+p(X). 5. Return X. With the exception of some very simple discrete distributions, sequential search algorithms become very slow as the while-loop has to be repeated very often. The expected number of iterations, i.e., the number of comparisons in the while condition, is equal to the expectation of the distribution plus 1. It can therefore become arbitrary large or even infinity if the tail of the distribution is very heavy. Another serious problem can be critical round-off errors due to summing up many probabilities p(k). To speed up the search procedure it is best to use indexed search.  File: unuran.info, Node: IndexedSearch, Prev: DiscreteInversion, Up: RVG A.6 Indexed Search (Guide Table Method) ======================================= The idea to speed up the sequential search algorithm is easy to understand. Instead of starting always at 0 we store a table of size C with starting points for our search. For this table we compute F^(-1)(U) for C equidistributed values of U, i.e., for u_i = i/C, i=0,...,C-1. Such a table is called _guide table_ or _hash table_. Then it is easy to prove that for every U in (0,1) the guide table entry for k=floor(UC) is bounded by F^(-1)(U). This shows that we can really start our sequential search procedure from the table entry for k and the index k of the correct table entry can be found rapidly by means of the truncation operation. The two main differences between _indexed search_ and _sequential search_ are that we start searching at the number determined by the guide table, and that we have to compute and store the cumulative probabilities in the setup as we have to know the cumulative probability for the starting point of the search algorithm. The rounding problems that can occur in the sequential search algorithm can occur here as well. Compared to sequential search we have now the obvious drawback of a slow setup. The computation of the cumulative probabilities grows linear with the size of the domain of the distribution L. What we gain is really high speed as the marginal execution time of the sampling algorithm becomes very small. The expected number of comparisons is bounded by 1+L/C. This shows that there is a trade-off between speed and the size of the guide table. Cache-effects in modern computers will however slow down the speed-up for really large table sizes. Thus we recommend to use a guide table that is about two times larger than the probability vector to obtain optimal speed.  File: unuran.info, Node: Glossary, Next: Bibliography, Prev: RVG, Up: Top Appendix B Glossary ******************* *CDF* cumulative distribution function. *HR* hazard rate (or failure rate). *inverse local concavity* local concavity of inverse PDF f^(-1)(y) expressed in term of x = f^(-1)(y). Is is given by ilc_f(x) = 1 + x f''(x) / f'(x) *local concavity* maximum value of c such that PDF f(x) is T_c. Is is given by lc_f(x) = 1 - f''(x) f(x) / f'(x)^2 *PDF* probability density function. *dPDF* derivative (gradient) of probability density function. *PMF* probability mass function. *PV* (finite) probability vector. *URNG* uniform random number generator. *U(a,b)* continuous uniform distribution on the interval (a,b). *T-concave* a function f(x) is called T-convace if the transformed function T(f(x)) is concave. We only deal with transformations T_c, where ‘c = 0’ T(x) = log(x) ‘c = -0.5’ T(x) = -1/sqrt(x) ‘c != 0’ T(x) = sign(x) * x^c *u-error* for a given approximate inverse CDF X=G^(-1)(U) the u-error is given as uerror = |U-F(G^(-1)(U))| where F denotes the exact CDF. Goodness-of-fit tests like the Kolmogorov-Smirnov test or the chi-squared test look at this type of error. See *note Inversion:: for more details. *u-resolution* the maximal tolerated u-error for an approximate inverse CDF. *x-error* for a given approximate inverse CDF X=G^(-1)(U) the x-error is given as xerror = |F^(-1)(U)-G^(-1)(U)| where F^(-1) denotes the exact inverse CDF. The x-error measure the deviation of G^(-1)(U) from the exact result. Notice that we have to distinguish between _absolute_ and _relative_ x-error. In UNU.RAN we use the absolute x-error near 0 and the relative x-error otherwise. See *note Inversion:: for more details. *x-resolution* the maximal tolerated x-error for an approximate inverse CDF.  File: unuran.info, Node: Bibliography, Next: FIndex, Prev: Glossary, Up: Top Appendix C Bibliography *********************** Standard Distributions ---------------------- [JKKa92] N.L. JOHNSON, S. KOTZ, AND A.W. KEMP (1992). Univariate Discrete Distributions, 2nd edition, John Wiley & Sons, Inc., New York. [JKBb94] N.L. JOHNSON, S. KOTZ, AND N. BALAKRISHNAN (1994). Continuous Univariate Distributions, Volume 1, 2nd edition, John Wiley & Sons, Inc., New York. [JKBc95] N.L. JOHNSON, S. KOTZ, AND N. BALAKRISHNAN (1995). Continuous Univariate Distributions, Volume 2, 2nd edition, John Wiley & Sons, Inc., New York. [JKBd97] N.L. JOHNSON, S. KOTZ, AND N. BALAKRISHNAN (1997). Discrete Multivariate Distributions, John Wiley & Sons, Inc., New York. [KBJe00] S. KOTZ, N. BALAKRISHNAN, AND N.L. JOHNSON (2000). Continuous Multivariate Distributions, Volume 1: Models and Applications, John Wiley & Sons, Inc., New York. Universal Methods – Surveys --------------------------- [HLD04] W. HÖRMANN, J. LEYDOLD, AND G. DERFLINGER (2004). Automatic Nonuniform Random Variate Generation, Springer, Berlin. Universal Methods ----------------- [AJa93] J.H. AHRENS (1993). Sampling from general distributions by suboptimal division of domains, Grazer Math. Berichte 319, 30pp. [AJa95] J.H. AHRENS (1995). An one-table method for sampling from continuous and discrete distributions, Computing 54(2), pp. 127-146. [CAa74] H.C. CHEN AND Y. ASAU (1974). On generating random variates from an empirical distribution, AIIE Trans. 6, pp. 163-166. [DHLa08] G. DERFLINGER, W. HÖRMANN, AND J. LEYDOLD (2008). Numerical inversion when only the density function is known, Research Report Series of the Department of Statistics and Mathematics 78, WU Wien, Augasse 2–6, A-1090 Wien, Austria, . [DLa86] L. DEVROYE (1986). Non-Uniform Random Variate Generation, Springer Verlag, New York. [GWa92] W.R. GILKS AND P. WILD (1992). Adaptive rejection sampling for Gibbs sampling, Applied Statistics 41, pp. 337-348. [HWa95] W. HÖRMANN (1995). A rejection technique for sampling from T-concave distributions, ACM Trans. Math. Software 21(2), pp. 182-193. [HDa96] W. HÖRMANN AND G. DERFLINGER (1996). Rejection-inversion to generate variates from monotone discrete distributions, ACM TOMACS 6(3), 169-184. [HLa00] W. HÖRMANN AND J. LEYDOLD (2000). Automatic random variate generation for simulation input. In: J.A. Joines, R. Barton, P. Fishwick, K. Kang (eds.), Proceedings of the 2000 Winter Simulation Conference, pp. 675-682. [HLa03] W. HÖRMANN AND J. LEYDOLD (2003). Continuous Random Variate Generation by Fast Numerical Inversion, ACM TOMACS 13(4), 347-362. [HLDa07] W. HÖRMANN, J. LEYDOLD, AND G. DERFLINGER (2007). Automatic Random Variate Generation for Unbounded Densities, ACM Trans. Model. Comput. Simul. 17(4), pp.18. [KLPa05] R. KARAWATZKI, J. LEYDOLD, AND K. PÖTZELBERGER (2005). Automatic Markov chain Monte Carlo procedures for sampling from multivariate distributions, Research Report Series of the Department of Statistics and Mathematics 27, WU Wien, Augasse 2–6, A-1090 Wien, Austria, . [LJa98] J. LEYDOLD (1998). A Rejection Technique for Sampling from Log-Concave Multivariate Distributions, ACM TOMACS 8(3), pp. 254-280. [LJa00] J. LEYDOLD (2000). Automatic Sampling with the Ratio-of-Uniforms Method, ACM Trans. Math. Software 26(1), pp. 78-98. [LJa01] J. LEYDOLD (2001). A simple universal generator for continuous and discrete univariate T-concave distributions, ACM Trans. Math. Software 27(1), pp. 66-82. [LJa02] J. LEYDOLD (2003). Short universal generators via generalized ratio-of-uniforms method, Math. Comp. 72(243), pp. 1453-1471. [WGS91] J.C. WAKEFIELD, A.E. GELFAND, AND A.F.M. SMITH (1992). Efficient generation of random variates via the ratio-of-uniforms method, Statist. Comput. 1(2), pp. 129-133. [WAa77] A.J. WALKER (1977). An efficient method for generating discrete random variables with general distributions, ACM Trans. Math. Software 3, pp. 253-256. Special Generators ------------------ [ADa74] J.H. AHRENS, U. DIETER (1974). Computer methods for sampling from gamma, beta, Poisson and binomial distributions, Computing 12, 223-246. [ADa82] J.H. AHRENS, U. DIETER (1982). Generating gamma variates by a modified rejection technique, Communications of the ACM 25, 47-54. [ADb82] J.H. AHRENS, U. DIETER (1982). Computer generation of Poisson deviates from modified normal distributions, ACM Trans. Math. Software 8, 163-179. [BMa58] G.E.P. BOX AND M.E. MULLER (1958). A note on the generation of random normal deviates, Annals Math. Statist. 29, 610-611. [CHa77] R.C.H. CHENG (1977). The Generation of Gamma Variables with Non-Integral Shape Parameter, Appl. Statist. 26(1), 71-75. [Dag89] J.S. DAGPUNAR (1989). An Easily Implemented Generalised Inverse Gaussian Generator, Commun. Statist. Simul. 18(2), 703-710. [HDa90] W. HÖRMANN AND G. DERFLINGER (1990). The ACR Method for generating normal random variables, OR Spektrum 12, 181-185. [KAa81] A.W. KEMP (1981). Efficient generation of logarithmically distributed pseudo-random variables, Appl. Statist. 30, 249-253. [KRa76] A.J. KINDERMAN AND J.G. RAMAGE (1976). Computer Generation of Normal Random Variables, J. Am. Stat. Assoc. 71(356), 893 - 898. [MJa87] J.F. MONAHAN (1987). An algorithm for generating chi random variables, ACM Trans. Math. Software 13, 168-172. [MGa62] G. MARSAGLIA (1962). Improving the Polar Method for Generating a Pair of Random Variables, Boeing Sci. Res. Lab., Seattle, Washington. [MOa84] G. MARSAGLIA AND I. OLKIN (1984). Generating Correlation Matrices, SIAM J. Sci. Stat. Comput 5, 470-475. [STa89] E. STADLOBER (1989). Sampling from Poisson, binomial and hypergeometric distributions: ratio of uniforms as a simple and fast alternative, Bericht 303, Math. Stat. Sektion, Forschungsgesellschaft Joanneum, Graz. [ZHa94] H. ZECHNER (1994). Efficient sampling from continuous and discrete unimodal distributions, Pd.D. Thesis, 156 pp., Technical University Graz, Austria. Other references ---------------- [CPa76] R. CRANLEY AND T.N.L. PATTERSON (1976). Randomization of number theoretic methods for multiple integration, SIAM J. Num. Anal., Vol. 13, pp. 904-914. [HJa61] R. HOOKE AND T.A. JEEVES (1961). Direct Search Solution of Numerical and Statistical Problems, Journal of the ACM, Vol. 8, April 1961, pp. 212-229.  File: unuran.info, Node: FIndex, Prev: Bibliography, Up: Top Appendix D Function Index ************************* [index] * Menu: * FALSE: Math. (line 18) * INT_MAX: Math. (line 12) * INT_MIN: Math. (line 13) * TRUE: Math. (line 17) * unur_arou_chg_verify: AROU. (line 128) * unur_arou_get_hatarea: AROU. (line 91) * unur_arou_get_sqhratio: AROU. (line 86) * unur_arou_get_squeezearea: AROU. (line 95) * unur_arou_new: AROU. (line 43) * unur_arou_set_cpoints: AROU. (line 107) * unur_arou_set_darsfactor: AROU. (line 62) * unur_arou_set_guidefactor: AROU. (line 118) * unur_arou_set_max_segments: AROU. (line 100) * unur_arou_set_max_sqhratio: AROU. (line 74) * unur_arou_set_pedantic: AROU. (line 137) * unur_arou_set_usecenter: AROU. (line 114) * unur_arou_set_usedars: AROU. (line 46) * unur_arou_set_verify: AROU. (line 126) * unur_ars_chg_reinit_ncpoints: ARS. (line 112) * unur_ars_chg_reinit_percentiles: ARS. (line 95) * unur_ars_chg_verify: ARS. (line 128) * unur_ars_eval_invcdfhat: ARS. (line 163) * unur_ars_get_loghatarea: ARS. (line 159) * unur_ars_new: ARS. (line 72) * unur_ars_set_cpoints: ARS. (line 84) * unur_ars_set_max_intervals: ARS. (line 75) * unur_ars_set_max_iter: ARS. (line 120) * unur_ars_set_pedantic: ARS. (line 137) * unur_ars_set_reinit_ncpoints: ARS. (line 110) * unur_ars_set_reinit_percentiles: ARS. (line 93) * unur_ars_set_verify: ARS. (line 127) * unur_auto_new: AUTO. (line 32) * unur_auto_set_logss: AUTO. (line 35) * unur_cext_get_distrparams: CEXT. (line 227) * unur_cext_get_ndistrparams: CEXT. (line 228) * unur_cext_get_params: CEXT. (line 213) * unur_cext_new: CEXT. (line 186) * unur_cext_set_init: CEXT. (line 189) * unur_cext_set_sample: CEXT. (line 203) * unur_chgto_urng_aux_default: URNG. (line 205) * unur_chg_debug: Debug. (line 65) * unur_chg_urng: URNG. (line 177) * unur_chg_urng_aux: URNG. (line 211) * unur_cstd_chg_truncated: CSTD. (line 86) * unur_cstd_new: CSTD. (line 60) * unur_cstd_set_variant: CSTD. (line 73) * unur_dari_chg_verify: DARI. (line 95) * unur_dari_new: DARI. (line 57) * unur_dari_set_cpfactor: DARI. (line 83) * unur_dari_set_squeeze: DARI. (line 60) * unur_dari_set_tablesize: DARI. (line 73) * unur_dari_set_verify: DARI. (line 93) * unur_dau_new: DAU. (line 42) * unur_dau_set_urnfactor: DAU. (line 45) * UNUR_DEBUG_ADAPT: Debug. (line 37) * UNUR_DEBUG_ADAPT <1>: Debug. (line 38) * UNUR_DEBUG_ALL: Debug. (line 31) * UNUR_DEBUG_ALL <1>: Debug. (line 32) * UNUR_DEBUG_INIT: Debug. (line 33) * UNUR_DEBUG_INIT <1>: Debug. (line 34) * UNUR_DEBUG_OFF: Debug. (line 29) * UNUR_DEBUG_OFF <1>: Debug. (line 30) * UNUR_DEBUG_SAMPLE: Debug. (line 39) * UNUR_DEBUG_SAMPLE <1>: Debug. (line 40) * UNUR_DEBUG_SETUP: Debug. (line 35) * UNUR_DEBUG_SETUP <1>: Debug. (line 36) * unur_dext_get_distrparams: DEXT. (line 227) * unur_dext_get_ndistrparams: DEXT. (line 228) * unur_dext_get_params: DEXT. (line 213) * unur_dext_new: DEXT. (line 186) * unur_dext_set_init: DEXT. (line 189) * unur_dext_set_sample: DEXT. (line 203) * unur_dgt_new: DGT. (line 68) * unur_dgt_set_guidefactor: DGT. (line 71) * unur_dgt_set_variant: DGT. (line 83) * unur_distr_: Stddist. (line 20) * unur_distr_beta: beta. (line 6) * unur_distr_binomial: binomial. (line 6) * unur_distr_cauchy: cauchy. (line 6) * unur_distr_cemp_get_data: CEMP. (line 40) * unur_distr_cemp_new: CEMP. (line 18) * unur_distr_cemp_read_data: CEMP. (line 29) * unur_distr_cemp_set_data: CEMP. (line 25) * unur_distr_cemp_set_hist: CEMP. (line 48) * unur_distr_cemp_set_hist_bins: CEMP. (line 82) * unur_distr_cemp_set_hist_domain: CEMP. (line 77) * unur_distr_cemp_set_hist_prob: CEMP. (line 63) * unur_distr_chi: chi. (line 6) * unur_distr_chisquare: chisquare. (line 6) * unur_distr_condi_get_condition: CONDI. (line 91) * unur_distr_condi_get_distribution: CONDI. (line 100) * unur_distr_condi_new: CONDI. (line 36) * unur_distr_condi_set_condition: CONDI. (line 68) * unur_distr_cont_eval_cdf: CONT. (line 141) * unur_distr_cont_eval_dlogpdf: CONT. (line 169) * unur_distr_cont_eval_dpdf: CONT. (line 139) * unur_distr_cont_eval_hr: CONT. (line 354) * unur_distr_cont_eval_invcdf: CONT. (line 143) * unur_distr_cont_eval_logcdf: CONT. (line 171) * unur_distr_cont_eval_logpdf: CONT. (line 167) * unur_distr_cont_eval_pdf: CONT. (line 137) * unur_distr_cont_get_cdf: CONT. (line 127) * unur_distr_cont_get_cdfstr: CONT. (line 198) * unur_distr_cont_get_center: CONT. (line 423) * unur_distr_cont_get_dlogpdf: CONT. (line 163) * unur_distr_cont_get_dlogpdfstr: CONT. (line 276) * unur_distr_cont_get_domain: CONT. (line 302) * unur_distr_cont_get_dpdf: CONT. (line 125) * unur_distr_cont_get_dpdfstr: CONT. (line 196) * unur_distr_cont_get_hr: CONT. (line 347) * unur_distr_cont_get_hrstr: CONT. (line 372) * unur_distr_cont_get_invcdf: CONT. (line 129) * unur_distr_cont_get_logcdf: CONT. (line 165) * unur_distr_cont_get_logcdfstr: CONT. (line 280) * unur_distr_cont_get_logpdf: CONT. (line 161) * unur_distr_cont_get_logpdfstr: CONT. (line 274) * unur_distr_cont_get_mode: CONT. (line 403) * unur_distr_cont_get_pdf: CONT. (line 123) * unur_distr_cont_get_pdfarea: CONT. (line 453) * unur_distr_cont_get_pdfparams: CONT. (line 235) * unur_distr_cont_get_pdfparams_vec: CONT. (line 263) * unur_distr_cont_get_pdfstr: CONT. (line 194) * unur_distr_cont_get_truncated: CONT. (line 308) * unur_distr_cont_new: CONT. (line 68) * unur_distr_cont_set_cdf: CONT. (line 78) * unur_distr_cont_set_cdfstr: CONT. (line 188) * unur_distr_cont_set_center: CONT. (line 411) * unur_distr_cont_set_dlogpdf: CONT. (line 157) * unur_distr_cont_set_domain: CONT. (line 285) * unur_distr_cont_set_dpdf: CONT. (line 76) * unur_distr_cont_set_hr: CONT. (line 317) * unur_distr_cont_set_hrstr: CONT. (line 361) * unur_distr_cont_set_invcdf: CONT. (line 80) * unur_distr_cont_set_logcdf: CONT. (line 159) * unur_distr_cont_set_logcdfstr: CONT. (line 278) * unur_distr_cont_set_logpdf: CONT. (line 155) * unur_distr_cont_set_logpdfstr: CONT. (line 272) * unur_distr_cont_set_mode: CONT. (line 385) * unur_distr_cont_set_pdf: CONT. (line 74) * unur_distr_cont_set_pdfarea: CONT. (line 429) * unur_distr_cont_set_pdfparams: CONT. (line 205) * unur_distr_cont_set_pdfparams_vec: CONT. (line 243) * unur_distr_cont_set_pdfstr: CONT. (line 176) * unur_distr_cont_upd_mode: CONT. (line 395) * unur_distr_cont_upd_pdfarea: CONT. (line 439) * unur_distr_copula: copula. (line 6) * unur_distr_corder_eval_cdf: CORDER. (line 75) * unur_distr_corder_eval_dpdf: CORDER. (line 73) * unur_distr_corder_eval_pdf: CORDER. (line 71) * unur_distr_corder_get_cdf: CORDER. (line 62) * unur_distr_corder_get_distribution: CORDER. (line 34) * unur_distr_corder_get_domain: CORDER. (line 104) * unur_distr_corder_get_dpdf: CORDER. (line 60) * unur_distr_corder_get_mode: CORDER. (line 133) * unur_distr_corder_get_pdf: CORDER. (line 58) * unur_distr_corder_get_pdfarea: CORDER. (line 154) * unur_distr_corder_get_pdfparams: CORDER. (line 93) * unur_distr_corder_get_rank: CORDER. (line 48) * unur_distr_corder_get_truncated: CORDER. (line 109) * unur_distr_corder_new: CORDER. (line 17) * unur_distr_corder_set_domain: CORDER. (line 99) * unur_distr_corder_set_mode: CORDER. (line 122) * unur_distr_corder_set_pdfarea: CORDER. (line 138) * unur_distr_corder_set_pdfparams: CORDER. (line 88) * unur_distr_corder_set_rank: CORDER. (line 41) * unur_distr_corder_upd_mode: CORDER. (line 127) * unur_distr_corder_upd_pdfarea: CORDER. (line 143) * unur_distr_correlation: correlation. (line 6) * unur_distr_cvec_eval_dlogpdf: CVEC. (line 188) * unur_distr_cvec_eval_dpdf: CVEC. (line 149) * unur_distr_cvec_eval_logpdf: CVEC. (line 186) * unur_distr_cvec_eval_pdf: CVEC. (line 137) * unur_distr_cvec_eval_pdlogpdf: CVEC. (line 190) * unur_distr_cvec_eval_pdpdf: CVEC. (line 161) * unur_distr_cvec_get_center: CVEC. (line 536) * unur_distr_cvec_get_cholesky: CVEC. (line 282) * unur_distr_cvec_get_covar: CVEC. (line 280) * unur_distr_cvec_get_covar_inv: CVEC. (line 284) * unur_distr_cvec_get_dlogpdf: CVEC. (line 184) * unur_distr_cvec_get_dpdf: CVEC. (line 130) * unur_distr_cvec_get_logpdf: CVEC. (line 182) * unur_distr_cvec_get_marginal: CVEC. (line 381) * unur_distr_cvec_get_mean: CVEC. (line 207) * unur_distr_cvec_get_mode: CVEC. (line 507) * unur_distr_cvec_get_pdf: CVEC. (line 123) * unur_distr_cvec_get_pdfparams: CVEC. (line 414) * unur_distr_cvec_get_pdfparams_vec: CVEC. (line 453) * unur_distr_cvec_get_pdfvol: CVEC. (line 558) * unur_distr_cvec_get_rankcorr: CVEC. (line 327) * unur_distr_cvec_get_rk_cholesky: CVEC. (line 329) * unur_distr_cvec_is_indomain: CVEC. (line 484) * unur_distr_cvec_new: CVEC. (line 61) * unur_distr_cvec_set_center: CVEC. (line 518) * unur_distr_cvec_set_covar: CVEC. (line 216) * unur_distr_cvec_set_covar_inv: CVEC. (line 256) * unur_distr_cvec_set_dlogpdf: CVEC. (line 178) * unur_distr_cvec_set_domain_rect: CVEC. (line 462) * unur_distr_cvec_set_dpdf: CVEC. (line 89) * unur_distr_cvec_set_logpdf: CVEC. (line 176) * unur_distr_cvec_set_marginals: CVEC. (line 341) * unur_distr_cvec_set_marginal_array: CVEC. (line 349) * unur_distr_cvec_set_marginal_list: CVEC. (line 360) * unur_distr_cvec_set_mean: CVEC. (line 194) * unur_distr_cvec_set_mode: CVEC. (line 495) * unur_distr_cvec_set_pdf: CVEC. (line 73) * unur_distr_cvec_set_pdfparams: CVEC. (line 389) * unur_distr_cvec_set_pdfparams_vec: CVEC. (line 422) * unur_distr_cvec_set_pdfvol: CVEC. (line 544) * unur_distr_cvec_set_pdlogpdf: CVEC. (line 180) * unur_distr_cvec_set_pdpdf: CVEC. (line 107) * unur_distr_cvec_set_rankcorr: CVEC. (line 299) * unur_distr_cvec_upd_mode: CVEC. (line 501) * unur_distr_cvec_upd_pdfvol: CVEC. (line 549) * unur_distr_cvemp_get_data: CVEMP. (line 46) * unur_distr_cvemp_new: CVEMP. (line 14) * unur_distr_cvemp_read_data: CVEMP. (line 33) * unur_distr_cvemp_set_data: CVEMP. (line 24) * unur_distr_discr_eval_cdf: DISCR. (line 135) * unur_distr_discr_eval_invcdf: DISCR. (line 148) * unur_distr_discr_eval_pmf: DISCR. (line 133) * unur_distr_discr_eval_pv: DISCR. (line 131) * unur_distr_discr_get_cdfstr: DISCR. (line 177) * unur_distr_discr_get_domain: DISCR. (line 226) * unur_distr_discr_get_mode: DISCR. (line 252) * unur_distr_discr_get_pmfparams: DISCR. (line 206) * unur_distr_discr_get_pmfstr: DISCR. (line 175) * unur_distr_discr_get_pmfsum: DISCR. (line 284) * unur_distr_discr_get_pv: DISCR. (line 93) * unur_distr_discr_make_pv: DISCR. (line 72) * unur_distr_discr_new: DISCR. (line 39) * unur_distr_discr_set_cdf: DISCR. (line 102) * unur_distr_discr_set_cdfstr: DISCR. (line 170) * unur_distr_discr_set_domain: DISCR. (line 212) * unur_distr_discr_set_invcdf: DISCR. (line 125) * unur_distr_discr_set_mode: DISCR. (line 240) * unur_distr_discr_set_pmf: DISCR. (line 100) * unur_distr_discr_set_pmfparams: DISCR. (line 184) * unur_distr_discr_set_pmfstr: DISCR. (line 159) * unur_distr_discr_set_pmfsum: DISCR. (line 260) * unur_distr_discr_set_pv: DISCR. (line 56) * unur_distr_discr_upd_mode: DISCR. (line 244) * unur_distr_discr_upd_pmfsum: DISCR. (line 270) * unur_distr_exponential: exponential. (line 6) * unur_distr_extremeI: extremeI. (line 6) * unur_distr_extremeII: extremeII. (line 6) * unur_distr_F: F. (line 6) * unur_distr_free: AllDistr. (line 19) * unur_distr_gamma: gamma. (line 6) * unur_distr_geometric: geometric. (line 6) * unur_distr_get_dim: AllDistr. (line 31) * unur_distr_get_extobj: AllDistr. (line 100) * unur_distr_get_name: AllDistr. (line 24) * unur_distr_get_type: AllDistr. (line 42) * unur_distr_gig: gig. (line 6) * unur_distr_gig2: gig2. (line 6) * unur_distr_hyperbolic: hyperbolic. (line 6) * unur_distr_hypergeometric: hypergeometric. (line 6) * unur_distr_ig: ig. (line 6) * unur_distr_is_cemp: AllDistr. (line 67) * unur_distr_is_cont: AllDistr. (line 61) * unur_distr_is_cvec: AllDistr. (line 64) * unur_distr_is_cvemp: AllDistr. (line 71) * unur_distr_is_discr: AllDistr. (line 75) * unur_distr_is_matr: AllDistr. (line 78) * unur_distr_laplace: laplace. (line 6) * unur_distr_logarithmic: logarithmic. (line 6) * unur_distr_logistic: logistic. (line 6) * unur_distr_lognormal: lognormal. (line 6) * unur_distr_lomax: lomax. (line 6) * unur_distr_matr_get_dim: MATR. (line 28) * unur_distr_matr_new: MATR. (line 13) * unur_distr_multicauchy: multicauchy. (line 6) * unur_distr_multiexponential: multiexponential. (line 6) * unur_distr_multinormal: multinormal. (line 6) * unur_distr_multistudent: multistudent. (line 6) * unur_distr_negativebinomial: negativebinomial. (line 6) * unur_distr_normal: normal. (line 6) * unur_distr_pareto: pareto. (line 6) * unur_distr_poisson: poisson. (line 6) * unur_distr_powerexponential: powerexponential. (line 6) * unur_distr_rayleigh: rayleigh. (line 6) * unur_distr_set_extobj: AllDistr. (line 81) * unur_distr_set_name: AllDistr. (line 22) * unur_distr_slash: slash. (line 6) * unur_distr_student: student. (line 6) * unur_distr_triangular: triangular. (line 6) * unur_distr_uniform: uniform. (line 6) * unur_distr_weibull: weibull. (line 6) * unur_dsrou_chg_cdfatmode: DSROU. (line 78) * unur_dsrou_chg_verify: DSROU. (line 68) * unur_dsrou_new: DSROU. (line 52) * unur_dsrou_set_cdfatmode: DSROU. (line 55) * unur_dsrou_set_verify: DSROU. (line 66) * unur_dss_new: DSS. (line 47) * unur_dstd_chg_truncated: DSTD. (line 83) * unur_dstd_new: DSTD. (line 59) * unur_dstd_set_variant: DSTD. (line 70) * unur_empk_chg_smoothing: EMPK. (line 159) * unur_empk_chg_varcor: EMPK. (line 175) * unur_empk_new: EMPK. (line 94) * unur_empk_set_beta: EMPK. (line 148) * unur_empk_set_kernel: EMPK. (line 97) * unur_empk_set_kernelgen: EMPK. (line 121) * unur_empk_set_positive: EMPK. (line 183) * unur_empk_set_smoothing: EMPK. (line 157) * unur_empk_set_varcor: EMPK. (line 173) * unur_empl_new: EMPL. (line 46) * unur_errno: Error_reporting. (line 85) * UNUR_ERR_COMPILE: Errno. (line 98) * UNUR_ERR_COOKIE: Errno. (line 88) * UNUR_ERR_DISTR_DATA: Errno. (line 30) * UNUR_ERR_DISTR_DOMAIN: Errno. (line 20) * UNUR_ERR_DISTR_GEN: Errno. (line 22) * UNUR_ERR_DISTR_GET: Errno. (line 16) * UNUR_ERR_DISTR_INVALID: Errno. (line 28) * UNUR_ERR_DISTR_NPARAMS: Errno. (line 18) * UNUR_ERR_DISTR_PROP: Errno. (line 32) * UNUR_ERR_DISTR_REQUIRED: Errno. (line 24) * UNUR_ERR_DISTR_SET: Errno. (line 14) * UNUR_ERR_DISTR_UNKNOWN: Errno. (line 26) * UNUR_ERR_DOMAIN: Errno. (line 80) * UNUR_ERR_FSTR_DERIV: Errno. (line 76) * UNUR_ERR_FSTR_SYNTAX: Errno. (line 74) * UNUR_ERR_GEN: Errno. (line 44) * UNUR_ERR_GENERIC: Errno. (line 90) * UNUR_ERR_GEN_CONDITION: Errno. (line 48) * UNUR_ERR_GEN_DATA: Errno. (line 46) * UNUR_ERR_GEN_INVALID: Errno. (line 50) * UNUR_ERR_GEN_SAMPLING: Errno. (line 52) * UNUR_ERR_INF: Errno. (line 94) * UNUR_ERR_MALLOC: Errno. (line 84) * UNUR_ERR_NAN: Errno. (line 96) * UNUR_ERR_NO_QUANTILE: Errno. (line 56) * UNUR_ERR_NO_REINIT: Errno. (line 54) * UNUR_ERR_NULL: Errno. (line 86) * UNUR_ERR_PAR_INVALID: Errno. (line 40) * UNUR_ERR_PAR_SET: Errno. (line 36) * UNUR_ERR_PAR_VARIANT: Errno. (line 38) * UNUR_ERR_ROUNDOFF: Errno. (line 82) * UNUR_ERR_SHOULD_NOT_HAPPEN: Errno. (line 101) * UNUR_ERR_SILENT: Errno. (line 92) * UNUR_ERR_STR: Errno. (line 66) * UNUR_ERR_STR_INVALID: Errno. (line 72) * UNUR_ERR_STR_SYNTAX: Errno. (line 70) * UNUR_ERR_STR_UNKNOWN: Errno. (line 68) * UNUR_ERR_URNG: Errno. (line 60) * UNUR_ERR_URNG_MISS: Errno. (line 62) * unur_free: Methods_all. (line 95) * unur_gen_anti: URNG. (line 319) * unur_gen_info: Methods_all. (line 98) * unur_gen_is_inversion: Methods_all. (line 119) * unur_gen_nextsub: URNG. (line 321) * unur_gen_reset: URNG. (line 320) * unur_gen_resetsub: URNG. (line 322) * unur_gen_seed: URNG. (line 317) * unur_gen_sync: URNG. (line 316) * unur_get_default_urng: URNG. (line 152) * unur_get_default_urng_aux: URNG. (line 162) * unur_get_dimension: Methods_all. (line 108) * unur_get_distr: Methods_all. (line 123) * unur_get_errno: Error_reporting. (line 87) * unur_get_genid: Methods_all. (line 112) * unur_get_method: Methods_all. (line 115) * unur_get_stream: Output_streams. (line 43) * unur_get_strerror: Error_reporting. (line 94) * unur_get_urng: URNG. (line 184) * unur_get_urng_aux: URNG. (line 220) * unur_gibbs_chg_state: GIBBS. (line 184) * unur_gibbs_get_state: GIBBS. (line 183) * unur_gibbs_new: GIBBS. (line 112) * unur_gibbs_reset_state: GIBBS. (line 188) * unur_gibbs_set_burnin: GIBBS. (line 162) * unur_gibbs_set_c: GIBBS. (line 126) * unur_gibbs_set_startingpoint: GIBBS. (line 141) * unur_gibbs_set_thinning: GIBBS. (line 152) * unur_gibbs_set_variant_coordinate: GIBBS. (line 115) * unur_gibbs_set_variant_random_direction: GIBBS. (line 122) * unur_hinv_chg_truncated: HINV. (line 212) * unur_hinv_estimate_error: HINV. (line 236) * unur_hinv_eval_approxinvcdf: HINV. (line 200) * unur_hinv_get_n_intervals: HINV. (line 195) * unur_hinv_new: HINV. (line 100) * unur_hinv_set_boundary: HINV. (line 165) * unur_hinv_set_cpoints: HINV. (line 137) * unur_hinv_set_guidefactor: HINV. (line 178) * unur_hinv_set_max_intervals: HINV. (line 186) * unur_hinv_set_order: HINV. (line 103) * unur_hinv_set_u_resolution: HINV. (line 121) * unur_hist_new: HIST. (line 30) * unur_hitro_chg_state: HITRO. (line 356) * unur_hitro_get_state: HITRO. (line 355) * unur_hitro_new: HITRO. (line 176) * unur_hitro_reset_state: HITRO. (line 368) * unur_hitro_set_adaptive_multiplier: HITRO. (line 298) * unur_hitro_set_burnin: HITRO. (line 339) * unur_hitro_set_r: HITRO. (line 252) * unur_hitro_set_startingpoint: HITRO. (line 312) * unur_hitro_set_thinning: HITRO. (line 326) * unur_hitro_set_u: HITRO. (line 275) * unur_hitro_set_use_adaptiveline: HITRO. (line 194) * unur_hitro_set_use_adaptiverectangle: HITRO. (line 223) * unur_hitro_set_use_boundingrectangle: HITRO. (line 211) * unur_hitro_set_v: HITRO. (line 260) * unur_hitro_set_variant_coordinate: HITRO. (line 179) * unur_hitro_set_variant_random_direction: HITRO. (line 190) * unur_hrb_chg_verify: HRB. (line 62) * unur_hrb_new: HRB. (line 52) * unur_hrb_set_upperbound: HRB. (line 55) * unur_hrb_set_verify: HRB. (line 61) * unur_hrd_chg_verify: HRD. (line 48) * unur_hrd_new: HRD. (line 44) * unur_hrd_set_verify: HRD. (line 47) * unur_hri_chg_verify: HRI. (line 75) * unur_hri_new: HRI. (line 62) * unur_hri_set_p0: HRI. (line 65) * unur_hri_set_verify: HRI. (line 74) * UNUR_INFINITY: Math. (line 8) * unur_init: Methods_all. (line 11) * unur_itdr_chg_verify: ITDR. (line 143) * unur_itdr_get_area: ITDR. (line 128) * unur_itdr_get_cp: ITDR. (line 123) * unur_itdr_get_ct: ITDR. (line 124) * unur_itdr_get_xi: ITDR. (line 122) * unur_itdr_new: ITDR. (line 90) * unur_itdr_set_cp: ITDR. (line 102) * unur_itdr_set_ct: ITDR. (line 112) * unur_itdr_set_verify: ITDR. (line 132) * unur_itdr_set_xi: ITDR. (line 93) * unur_makegen_dsu: StringAPI. (line 47) * unur_makegen_ssu: StringAPI. (line 45) * unur_mcorr_chg_eigenvalues: MCORR. (line 84) * unur_mcorr_new: MCORR. (line 68) * unur_mcorr_set_eigenvalues: MCORR. (line 71) * unur_mixt_new: MIXT. (line 56) * unur_mixt_set_useinversion: MIXT. (line 65) * unur_mvstd_new: MVSTD. (line 37) * unur_mvtdr_chg_verify: MVTDR. (line 129) * unur_mvtdr_get_hatvol: MVTDR. (line 123) * unur_mvtdr_get_ncones: MVTDR. (line 119) * unur_mvtdr_new: MVTDR. (line 84) * unur_mvtdr_set_boundsplitting: MVTDR. (line 94) * unur_mvtdr_set_maxcones: MVTDR. (line 104) * unur_mvtdr_set_stepsmin: MVTDR. (line 87) * unur_mvtdr_set_verify: MVTDR. (line 127) * unur_ninv_chg_max_iter: NINV. (line 120) * unur_ninv_chg_start: NINV. (line 161) * unur_ninv_chg_table: NINV. (line 181) * unur_ninv_chg_truncated: NINV. (line 184) * unur_ninv_chg_u_resolution: NINV. (line 135) * unur_ninv_chg_x_resolution: NINV. (line 126) * unur_ninv_eval_approxinvcdf: NINV. (line 204) * unur_ninv_new: NINV. (line 99) * unur_ninv_set_max_iter: NINV. (line 118) * unur_ninv_set_start: NINV. (line 142) * unur_ninv_set_table: NINV. (line 167) * unur_ninv_set_usebisect: NINV. (line 114) * unur_ninv_set_usenewton: NINV. (line 106) * unur_ninv_set_useregula: NINV. (line 102) * unur_ninv_set_u_resolution: NINV. (line 133) * unur_ninv_set_x_resolution: NINV. (line 124) * unur_norta_new: NORTA. (line 71) * unur_nrou_chg_verify: NROU. (line 142) * unur_nrou_new: NROU. (line 88) * unur_nrou_set_center: NROU. (line 124) * unur_nrou_set_r: NROU. (line 117) * unur_nrou_set_u: NROU. (line 91) * unur_nrou_set_v: NROU. (line 108) * unur_nrou_set_verify: NROU. (line 131) * unur_pinv_estimate_error: PINV. (line 361) * unur_pinv_eval_approxcdf: PINV. (line 353) * unur_pinv_eval_approxinvcdf: PINV. (line 345) * unur_pinv_get_n_intervals: PINV. (line 328) * unur_pinv_new: PINV. (line 152) * unur_pinv_set_boundary: PINV. (line 284) * unur_pinv_set_extra_testpoints: PINV. (line 242) * unur_pinv_set_keepcdf: PINV. (line 332) * unur_pinv_set_max_intervals: PINV. (line 321) * unur_pinv_set_order: PINV. (line 155) * unur_pinv_set_searchboundary: PINV. (line 300) * unur_pinv_set_smoothness: PINV. (line 161) * unur_pinv_set_usecdf: PINV. (line 271) * unur_pinv_set_usepdf: PINV. (line 266) * unur_pinv_set_use_upoints: PINV. (line 256) * unur_pinv_set_u_resolution: PINV. (line 211) * unur_quantile: Methods_all. (line 75) * unur_reinit: Methods_all. (line 24) * unur_reset_errno: Error_reporting. (line 90) * unur_run_tests: Testing. (line 13) * unur_sample_cont: Methods_all. (line 58) * unur_sample_discr: Methods_all. (line 57) * unur_sample_matr: Methods_all. (line 60) * unur_sample_urng: URNG. (line 236) * unur_sample_vec: Methods_all. (line 59) * unur_set_debug: Debug. (line 62) * unur_set_default_debug: Debug. (line 68) * unur_set_default_urng: URNG. (line 157) * unur_set_default_urng_aux: URNG. (line 161) * unur_set_error_handler: Error_handlers. (line 49) * unur_set_error_handler_off: Error_handlers. (line 61) * unur_set_stream: Output_streams. (line 28) * unur_set_urng: URNG. (line 168) * unur_set_urng_aux: URNG. (line 188) * unur_set_use_distr_privatecopy: Methods_all. (line 138) * unur_srou_chg_cdfatmode: SROU. (line 176) * unur_srou_chg_pdfatmode: SROU. (line 181) * unur_srou_chg_verify: SROU. (line 167) * unur_srou_new: SROU. (line 101) * unur_srou_set_cdfatmode: SROU. (line 118) * unur_srou_set_pdfatmode: SROU. (line 127) * unur_srou_set_r: SROU. (line 104) * unur_srou_set_usemirror: SROU. (line 150) * unur_srou_set_usesqueeze: SROU. (line 138) * unur_srou_set_verify: SROU. (line 165) * unur_ssr_chg_cdfatmode: SSR. (line 121) * unur_ssr_chg_pdfatmode: SSR. (line 126) * unur_ssr_chg_verify: SSR. (line 112) * unur_ssr_new: SSR. (line 79) * unur_ssr_set_cdfatmode: SSR. (line 82) * unur_ssr_set_pdfatmode: SSR. (line 91) * unur_ssr_set_usesqueeze: SSR. (line 101) * unur_ssr_set_verify: SSR. (line 111) * unur_str2distr: StringAPI. (line 39) * unur_str2gen: StringAPI. (line 34) * UNUR_SUCCESS (0x0u): Errno. (line 10) * unur_tabl_chg_truncated: TABL. (line 284) * unur_tabl_chg_verify: TABL. (line 317) * unur_tabl_get_hatarea: TABL. (line 228) * unur_tabl_get_n_intervals: TABL. (line 244) * unur_tabl_get_sqhratio: TABL. (line 224) * unur_tabl_get_squeezearea: TABL. (line 232) * unur_tabl_new: TABL. (line 112) * unur_tabl_set_areafraction: TABL. (line 154) * unur_tabl_set_boundary: TABL. (line 275) * unur_tabl_set_cpoints: TABL. (line 127) * unur_tabl_set_darsfactor: TABL. (line 183) * unur_tabl_set_guidefactor: TABL. (line 267) * unur_tabl_set_max_intervals: TABL. (line 237) * unur_tabl_set_max_sqhratio: TABL. (line 209) * unur_tabl_set_nstp: TABL. (line 135) * unur_tabl_set_pedantic: TABL. (line 326) * unur_tabl_set_slopes: TABL. (line 248) * unur_tabl_set_usedars: TABL. (line 167) * unur_tabl_set_useear: TABL. (line 144) * unur_tabl_set_variant_ia: TABL. (line 115) * unur_tabl_set_variant_splitmode: TABL. (line 195) * unur_tabl_set_verify: TABL. (line 315) * unur_tdr_chg_reinit_ncpoints: TDR. (line 195) * unur_tdr_chg_reinit_percentiles: TDR. (line 178) * unur_tdr_chg_truncated: TDR. (line 203) * unur_tdr_chg_verify: TDR. (line 292) * unur_tdr_eval_invcdfhat: TDR. (line 323) * unur_tdr_get_hatarea: TDR. (line 248) * unur_tdr_get_sqhratio: TDR. (line 244) * unur_tdr_get_squeezearea: TDR. (line 252) * unur_tdr_new: TDR. (line 96) * unur_tdr_set_c: TDR. (line 99) * unur_tdr_set_cpoints: TDR. (line 168) * unur_tdr_set_darsfactor: TDR. (line 156) * unur_tdr_set_guidefactor: TDR. (line 283) * unur_tdr_set_max_intervals: TDR. (line 257) * unur_tdr_set_max_sqhratio: TDR. (line 232) * unur_tdr_set_pedantic: TDR. (line 301) * unur_tdr_set_reinit_ncpoints: TDR. (line 193) * unur_tdr_set_reinit_percentiles: TDR. (line 176) * unur_tdr_set_usecenter: TDR. (line 266) * unur_tdr_set_usedars: TDR. (line 118) * unur_tdr_set_usemode: TDR. (line 270) * unur_tdr_set_variant_gw: TDR. (line 106) * unur_tdr_set_variant_ia: TDR. (line 114) * unur_tdr_set_variant_ps: TDR. (line 110) * unur_tdr_set_verify: TDR. (line 291) * unur_test_chi2: Testing. (line 152) * unur_test_correlation: Testing. (line 206) * unur_test_count_pdf: Testing. (line 127) * unur_test_count_urn: Testing. (line 115) * unur_test_moments: Testing. (line 190) * unur_test_par_count_pdf: Testing. (line 145) * unur_test_printsample: Testing. (line 31) * unur_test_quartiles: Testing. (line 216) * unur_test_timing: Testing. (line 36) * unur_test_timing_exponential: Testing. (line 91) * unur_test_timing_R: Testing. (line 63) * unur_test_timing_total: Testing. (line 98) * unur_test_timing_uniform: Testing. (line 89) * unur_test_u_error: Testing. (line 235) * unur_unif_new: UNIF. (line 20) * unur_urng_anti: URNG. (line 295) * unur_urng_free: URNG. (line 363) * unur_urng_fvoid_new: URNG-FVOID. (line 42) * unur_urng_gslptr_new: URNG-GSL. (line 114) * unur_urng_gslqrng_new: URNG-GSLQRNG. (line 38) * unur_urng_gsl_new: URNG-GSL. (line 107) * unur_urng_new: URNG. (line 344) * unur_urng_nextsub: URNG. (line 302) * unur_urng_prngptr_new: URNG-PRNG. (line 58) * unur_urng_prng_new: URNG-PRNG. (line 41) * unur_urng_randomshift_new: URNG-RANDOMSHIFT. (line 47) * unur_urng_randomshift_nextshift: URNG-RANDOMSHIFT. (line 57) * unur_urng_reset: URNG. (line 256) * unur_urng_resetsub: URNG. (line 309) * unur_urng_rngstreamptr_new: URNG-RNGSTREAM. (line 55) * unur_urng_rngstream_new: URNG-RNGSTREAM. (line 50) * unur_urng_sample: URNG. (line 232) * unur_urng_sample_array: URNG. (line 241) * unur_urng_seed: URNG. (line 279) * unur_urng_set_anti: URNG. (line 389) * unur_urng_set_delete: URNG. (line 409) * unur_urng_set_nextsub: URNG. (line 399) * unur_urng_set_reset: URNG. (line 394) * unur_urng_set_resetsub: URNG. (line 404) * unur_urng_set_sample_array: URNG. (line 376) * unur_urng_set_seed: URNG. (line 385) * unur_urng_set_sync: URNG. (line 381) * unur_urng_sync: URNG. (line 273) * unur_use_urng_aux_default: URNG. (line 199) * unur_utdr_chg_pdfatmode: UTDR. (line 98) * unur_utdr_chg_verify: UTDR. (line 89) * unur_utdr_new: UTDR. (line 56) * unur_utdr_set_cpfactor: UTDR. (line 69) * unur_utdr_set_deltafactor: UTDR. (line 78) * unur_utdr_set_pdfatmode: UTDR. (line 59) * unur_utdr_set_verify: UTDR. (line 87) * unur_vempk_chg_smoothing: VEMPK. (line 51) * unur_vempk_chg_varcor: VEMPK. (line 67) * unur_vempk_new: VEMPK. (line 46) * unur_vempk_set_smoothing: VEMPK. (line 49) * unur_vempk_set_varcor: VEMPK. (line 65) * unur_vnrou_chg_u: VNROU. (line 120) * unur_vnrou_chg_v: VNROU. (line 131) * unur_vnrou_chg_verify: VNROU. (line 153) * unur_vnrou_get_volumehat: VNROU. (line 157) * unur_vnrou_new: VNROU. (line 101) * unur_vnrou_set_r: VNROU. (line 134) * unur_vnrou_set_u: VNROU. (line 104) * unur_vnrou_set_v: VNROU. (line 124) * unur_vnrou_set_verify: VNROU. (line 142)  Tag Table: Node: Top454 Node: Intro6597 Node: UsageDoc6874 Node: Installation8289 Node: UsageLib15178 Node: Concepts18181 Node: Contact29211 Node: Examples29555 Node: Example_031457 Node: Example_0_str34653 Node: Example_137132 Node: Example_1_str40406 Node: Example_242955 Node: Example_2_str48257 Node: Example_351650 Node: Example_3_str55554 Node: Example_458753 Node: Example_reinit64706 Node: Example_anti69541 Node: Example_anti_str76289 Node: Example_More80662 Node: StringAPI81110 Ref: funct:unur_str2gen82357 Ref: funct:unur_str2distr82619 Ref: funct:unur_makegen_ssu82944 Ref: funct:unur_makegen_dsu82944 Node: StringSyntax83834 Node: StringDistr89192 Node: KeysDistr91022 Node: StringFunct97159 Node: StringMethod102125 Node: KeysMethod103216 Node: StringURNG122234 Node: Distribution_objects122967 Node: AllDistr128280 Ref: funct:unur_distr_free128824 Ref: funct:unur_distr_set_name128925 Ref: funct:unur_distr_get_name128925 Ref: funct:unur_distr_get_dim129364 Ref: funct:unur_distr_get_type129821 Ref: funct:unur_distr_is_cont130525 Ref: funct:unur_distr_is_cvec130669 Ref: funct:unur_distr_is_cemp130815 Ref: funct:unur_distr_is_cvemp130991 Ref: funct:unur_distr_is_discr131154 Ref: funct:unur_distr_is_matr131297 Ref: funct:unur_distr_set_extobj131426 Ref: funct:unur_distr_get_extobj132382 Node: CONT132601 Ref: funct:unur_distr_cont_new135901 Ref: funct:unur_distr_cont_set_pdf136071 Ref: funct:unur_distr_cont_set_dpdf136071 Ref: funct:unur_distr_cont_set_cdf136071 Ref: funct:unur_distr_cont_set_invcdf136071 Ref: funct:unur_distr_cont_get_pdf138687 Ref: funct:unur_distr_cont_get_dpdf138687 Ref: funct:unur_distr_cont_get_cdf138687 Ref: funct:unur_distr_cont_get_invcdf138687 Ref: funct:unur_distr_cont_eval_pdf139410 Ref: funct:unur_distr_cont_eval_dpdf139410 Ref: funct:unur_distr_cont_eval_cdf139410 Ref: funct:unur_distr_cont_eval_invcdf139410 Ref: funct:unur_distr_cont_set_logpdf140314 Ref: funct:unur_distr_cont_set_dlogpdf140314 Ref: funct:unur_distr_cont_set_logcdf140314 Ref: funct:unur_distr_cont_get_logpdf140314 Ref: funct:unur_distr_cont_get_dlogpdf140314 Ref: funct:unur_distr_cont_get_logcdf140314 Ref: funct:unur_distr_cont_eval_logpdf140314 Ref: funct:unur_distr_cont_eval_dlogpdf140314 Ref: funct:unur_distr_cont_eval_logcdf140314 Ref: funct:unur_distr_cont_set_pdfstr141332 Ref: funct:unur_distr_cont_set_cdfstr141934 Ref: funct:unur_distr_cont_get_pdfstr142239 Ref: funct:unur_distr_cont_get_dpdfstr142239 Ref: funct:unur_distr_cont_get_cdfstr142239 Ref: funct:unur_distr_cont_set_pdfparams142773 Ref: funct:unur_distr_cont_get_pdfparams144593 Ref: funct:unur_distr_cont_set_pdfparams_vec144973 Ref: funct:unur_distr_cont_get_pdfparams_vec145878 Ref: funct:unur_distr_cont_set_logpdfstr146343 Ref: funct:unur_distr_cont_get_logpdfstr146343 Ref: funct:unur_distr_cont_get_dlogpdfstr146343 Ref: funct:unur_distr_cont_set_logcdfstr146343 Ref: funct:unur_distr_cont_get_logcdfstr146343 Ref: funct:unur_distr_cont_set_domain146927 Ref: funct:unur_distr_cont_get_domain147895 Ref: funct:unur_distr_cont_get_truncated148204 Ref: funct:unur_distr_cont_set_hr148671 Ref: funct:unur_distr_cont_get_hr150217 Ref: funct:unur_distr_cont_eval_hr150576 Ref: funct:unur_distr_cont_set_hrstr150948 Ref: funct:unur_distr_cont_get_hrstr151487 Ref: funct:unur_distr_cont_set_mode151977 Ref: funct:unur_distr_cont_upd_mode152560 Ref: funct:unur_distr_cont_get_mode152996 Ref: funct:unur_distr_cont_set_center153500 Ref: funct:unur_distr_cont_get_center154033 Ref: funct:unur_distr_cont_set_pdfarea154289 Ref: funct:unur_distr_cont_upd_pdfarea154742 Ref: funct:unur_distr_cont_get_pdfarea155459 Node: CORDER155822 Ref: funct:unur_distr_corder_new156350 Ref: funct:unur_distr_corder_get_distribution157202 Ref: funct:unur_distr_corder_set_rank157425 Ref: funct:unur_distr_corder_get_rank157769 Ref: funct:unur_distr_corder_get_pdf158240 Ref: funct:unur_distr_corder_get_dpdf158240 Ref: funct:unur_distr_corder_get_cdf158240 Ref: funct:unur_distr_corder_eval_pdf158894 Ref: funct:unur_distr_corder_eval_dpdf158894 Ref: funct:unur_distr_corder_eval_cdf158894 Ref: funct:unur_distr_corder_set_pdfparams159718 Ref: funct:unur_distr_corder_get_pdfparams159962 Ref: funct:unur_distr_corder_set_domain160259 Ref: funct:unur_distr_corder_get_domain160506 Ref: funct:unur_distr_corder_get_truncated160755 Ref: funct:unur_distr_corder_set_mode161225 Ref: funct:unur_distr_corder_upd_mode161409 Ref: funct:unur_distr_corder_get_mode161709 Ref: funct:unur_distr_corder_set_pdfarea161889 Ref: funct:unur_distr_corder_upd_pdfarea162086 Ref: funct:unur_distr_corder_get_pdfarea162720 Node: CEMP162928 Ref: funct:unur_distr_cemp_new163580 Ref: funct:unur_distr_cemp_set_data163765 Ref: funct:unur_distr_cemp_read_data163935 Ref: funct:unur_distr_cemp_get_data164504 Ref: funct:unur_distr_cemp_set_hist164853 Ref: funct:unur_distr_cemp_set_hist_prob165635 Ref: funct:unur_distr_cemp_set_hist_domain166373 Ref: funct:unur_distr_cemp_set_hist_bins166629 Node: CVEC167294 Ref: funct:unur_distr_cvec_new169753 Ref: funct:unur_distr_cvec_set_pdf170325 Ref: funct:unur_distr_cvec_set_dpdf171128 Ref: funct:unur_distr_cvec_set_pdpdf172067 Ref: funct:unur_distr_cvec_get_pdf172882 Ref: funct:unur_distr_cvec_get_dpdf173235 Ref: funct:unur_distr_cvec_eval_pdf173625 Ref: funct:unur_distr_cvec_eval_dpdf174231 Ref: funct:unur_distr_cvec_eval_pdpdf174884 Ref: funct:unur_distr_cvec_set_logpdf175622 Ref: funct:unur_distr_cvec_set_dlogpdf175622 Ref: funct:unur_distr_cvec_set_pdlogpdf175622 Ref: funct:unur_distr_cvec_get_logpdf175622 Ref: funct:unur_distr_cvec_get_dlogpdf175622 Ref: funct:unur_distr_cvec_eval_logpdf175622 Ref: funct:unur_distr_cvec_eval_dlogpdf175622 Ref: funct:unur_distr_cvec_eval_pdlogpdf175622 Ref: funct:unur_distr_cvec_set_mean176556 Ref: funct:unur_distr_cvec_get_mean177274 Ref: funct:unur_distr_cvec_set_covar177703 Ref: funct:unur_distr_cvec_set_covar_inv179940 Ref: funct:unur_distr_cvec_get_covar181026 Ref: funct:unur_distr_cvec_get_cholesky181026 Ref: funct:unur_distr_cvec_get_covar_inv181026 Ref: funct:unur_distr_cvec_set_rankcorr181902 Ref: funct:unur_distr_cvec_get_rankcorr183155 Ref: funct:unur_distr_cvec_get_rk_cholesky183155 Ref: funct:unur_distr_cvec_set_marginals183842 Ref: funct:unur_distr_cvec_set_marginal_array184245 Ref: funct:unur_distr_cvec_set_marginal_list184885 Ref: funct:unur_distr_cvec_get_marginal186030 Ref: funct:unur_distr_cvec_set_pdfparams186452 Ref: funct:unur_distr_cvec_get_pdfparams187937 Ref: funct:unur_distr_cvec_set_pdfparams_vec188317 Ref: funct:unur_distr_cvec_get_pdfparams_vec189948 Ref: funct:unur_distr_cvec_set_domain_rect190413 Ref: funct:unur_distr_cvec_is_indomain191635 Ref: funct:unur_distr_cvec_set_mode192000 Ref: funct:unur_distr_cvec_upd_mode192308 Ref: funct:unur_distr_cvec_get_mode192655 Ref: funct:unur_distr_cvec_set_center193253 Ref: funct:unur_distr_cvec_get_center194204 Ref: funct:unur_distr_cvec_set_pdfvol194628 Ref: funct:unur_distr_cvec_upd_pdfvol194864 Ref: funct:unur_distr_cvec_get_pdfvol195353 Node: CONDI195719 Ref: funct:unur_distr_condi_new197234 Ref: funct:unur_distr_condi_set_condition198976 Ref: funct:unur_distr_condi_get_condition200249 Ref: funct:unur_distr_condi_get_distribution200681 Node: CVEMP200860 Ref: funct:unur_distr_cvemp_new201343 Ref: funct:unur_distr_cvemp_set_data201766 Ref: funct:unur_distr_cvemp_read_data202258 Ref: funct:unur_distr_cvemp_get_data202967 Node: MATR203543 Ref: funct:unur_distr_matr_new203878 Ref: funct:unur_distr_matr_get_dim204641 Node: DISCR204924 Ref: funct:unur_distr_discr_new206391 Ref: funct:unur_distr_discr_set_pv207150 Ref: funct:unur_distr_discr_make_pv207986 Ref: funct:unur_distr_discr_get_pv209116 Ref: funct:unur_distr_discr_set_pmf209451 Ref: funct:unur_distr_discr_set_cdf209451 Ref: funct:unur_distr_discr_set_invcdf210690 Ref: funct:unur_distr_discr_eval_pv210986 Ref: funct:unur_distr_discr_eval_pmf210986 Ref: funct:unur_distr_discr_eval_cdf210986 Ref: funct:unur_distr_discr_eval_invcdf211866 Ref: funct:unur_distr_discr_set_pmfstr212395 Ref: funct:unur_distr_discr_set_cdfstr212916 Ref: funct:unur_distr_discr_get_pmfstr213145 Ref: funct:unur_distr_discr_get_cdfstr213145 Ref: funct:unur_distr_discr_set_pmfparams213555 Ref: funct:unur_distr_discr_get_pmfparams214827 Ref: funct:unur_distr_discr_set_domain215150 Ref: funct:unur_distr_discr_get_domain215951 Ref: funct:unur_distr_discr_set_mode216539 Ref: funct:unur_distr_discr_upd_mode216662 Ref: funct:unur_distr_discr_get_mode217135 Ref: funct:unur_distr_discr_set_pmfsum217632 Ref: funct:unur_distr_discr_upd_pmfsum218080 Ref: funct:unur_distr_discr_get_pmfsum218872 Node: Methods219227 Node: Methods_all221901 Ref: funct:unur_init222124 Ref: funct:unur_reinit222645 Ref: funct:unur_sample_discr224088 Ref: funct:unur_sample_cont224088 Ref: funct:unur_sample_vec224088 Ref: funct:unur_sample_matr224088 Ref: funct:unur_quantile224968 Ref: funct:unur_free225745 Ref: funct:unur_gen_info225845 Ref: funct:unur_get_dimension226268 Ref: funct:unur_get_genid226456 Ref: funct:unur_get_method226568 Ref: funct:unur_gen_is_inversion226758 Ref: funct:unur_get_distr226932 Ref: funct:unur_set_use_distr_privatecopy227736 Node: AUTO229949 Ref: funct:unur_auto_new231082 Ref: funct:unur_auto_set_logss231197 Node: Methods_for_CONT231533 Node: AROU241527 Ref: funct:unur_arou_new243152 Ref: funct:unur_arou_set_usedars243267 Ref: funct:unur_arou_set_darsfactor244087 Ref: funct:unur_arou_set_max_sqhratio244722 Ref: funct:unur_arou_get_sqhratio245318 Ref: funct:unur_arou_get_hatarea245550 Ref: funct:unur_arou_get_squeezearea245734 Ref: funct:unur_arou_set_max_segments245936 Ref: funct:unur_arou_set_cpoints246199 Ref: funct:unur_arou_set_usecenter246596 Ref: funct:unur_arou_set_guidefactor246754 Ref: funct:unur_arou_set_verify247090 Ref: funct:unur_arou_chg_verify247090 Ref: funct:unur_arou_set_pedantic247589 Node: ARS248670 Ref: funct:unur_ars_new251781 Ref: funct:unur_ars_set_max_intervals251895 Ref: funct:unur_ars_set_cpoints252257 Ref: funct:unur_ars_set_reinit_percentiles252690 Ref: funct:unur_ars_chg_reinit_percentiles252690 Ref: funct:unur_ars_set_reinit_ncpoints253778 Ref: funct:unur_ars_chg_reinit_ncpoints253778 Ref: funct:unur_ars_set_max_iter254202 Ref: funct:unur_ars_set_verify254404 Ref: funct:unur_ars_chg_verify254404 Ref: funct:unur_ars_set_pedantic254891 Ref: funct:unur_ars_get_loghatarea255973 Ref: funct:unur_ars_eval_invcdfhat256172 Node: CEXT256601 Ref: funct:unur_cext_new264532 Ref: funct:unur_cext_set_init264651 Ref: funct:unur_cext_set_sample265270 Ref: funct:unur_cext_get_params265760 Ref: funct:unur_cext_get_distrparams266380 Ref: funct:unur_cext_get_ndistrparams266380 Node: CSTD266753 Ref: funct:unur_cstd_new269141 Ref: funct:unur_cstd_set_variant269849 Ref: funct:unur_cstd_chg_truncated270462 Node: HINV271589 Ref: funct:unur_hinv_new276655 Ref: funct:unur_hinv_set_order276770 Ref: funct:unur_hinv_set_u_resolution277774 Ref: funct:unur_hinv_set_cpoints278569 Ref: funct:unur_hinv_set_boundary280065 Ref: funct:unur_hinv_set_guidefactor280654 Ref: funct:unur_hinv_set_max_intervals280990 Ref: funct:unur_hinv_get_n_intervals281377 Ref: funct:unur_hinv_eval_approxinvcdf281661 Ref: funct:unur_hinv_chg_truncated282249 Ref: funct:unur_hinv_estimate_error283483 Node: HRB283888 Ref: funct:unur_hrb_new285843 Ref: funct:unur_hrb_set_upperbound285957 Ref: funct:unur_hrb_set_verify286253 Ref: funct:unur_hrb_chg_verify286253 Node: HRD286612 Ref: funct:unur_hrd_new288172 Ref: funct:unur_hrd_set_verify288286 Ref: funct:unur_hrd_chg_verify288286 Node: HRI288645 Ref: funct:unur_hri_new291283 Ref: funct:unur_hri_set_p0291397 Ref: funct:unur_hri_set_verify291861 Ref: funct:unur_hri_chg_verify291861 Node: ITDR292220 Ref: funct:unur_itdr_new296916 Ref: funct:unur_itdr_set_xi297031 Ref: funct:unur_itdr_set_cp297447 Ref: funct:unur_itdr_set_ct297898 Ref: funct:unur_itdr_get_xi298385 Ref: funct:unur_itdr_get_cp298385 Ref: funct:unur_itdr_get_ct298385 Ref: funct:unur_itdr_get_area298696 Ref: funct:unur_itdr_set_verify298845 Ref: funct:unur_itdr_chg_verify299258 Node: NINV299394 Ref: funct:unur_ninv_new304180 Ref: funct:unur_ninv_set_useregula304295 Ref: funct:unur_ninv_set_usenewton304452 Ref: funct:unur_ninv_set_usebisect304912 Ref: funct:unur_ninv_set_max_iter305084 Ref: funct:unur_ninv_chg_max_iter305084 Ref: funct:unur_ninv_set_x_resolution305333 Ref: funct:unur_ninv_chg_x_resolution305333 Ref: funct:unur_ninv_set_u_resolution305697 Ref: funct:unur_ninv_chg_u_resolution305697 Ref: funct:unur_ninv_set_start306070 Ref: funct:unur_ninv_chg_start306724 Ref: funct:unur_ninv_set_table306980 Ref: funct:unur_ninv_chg_table307543 Ref: funct:unur_ninv_chg_truncated307683 Ref: funct:unur_ninv_eval_approxinvcdf308683 Node: NROU309270 Ref: funct:unur_nrou_new312986 Ref: funct:unur_nrou_set_u313101 Ref: funct:unur_nrou_set_v313780 Ref: funct:unur_nrou_set_r314109 Ref: funct:unur_nrou_set_center314321 Ref: funct:unur_nrou_set_verify314566 Ref: funct:unur_nrou_chg_verify314979 Node: PINV315115 Ref: funct:unur_pinv_new322816 Ref: funct:unur_pinv_set_order322931 Ref: funct:unur_pinv_set_smoothness323178 Ref: funct:unur_pinv_set_u_resolution325632 Ref: funct:unur_pinv_set_extra_testpoints327247 Ref: funct:unur_pinv_set_use_upoints328011 Ref: funct:unur_pinv_set_usepdf328456 Ref: funct:unur_pinv_set_usecdf328610 Ref: funct:unur_pinv_set_boundary329216 Ref: funct:unur_pinv_set_searchboundary329992 Ref: funct:unur_pinv_set_max_intervals330982 Ref: funct:unur_pinv_get_n_intervals331211 Ref: funct:unur_pinv_set_keepcdf331407 Ref: funct:unur_pinv_eval_approxinvcdf332071 Ref: funct:unur_pinv_eval_approxcdf332486 Ref: funct:unur_pinv_estimate_error332924 Node: SROU333318 Ref: funct:unur_srou_new338369 Ref: funct:unur_srou_set_r338484 Ref: funct:unur_srou_set_cdfatmode339112 Ref: funct:unur_srou_set_pdfatmode339462 Ref: funct:unur_srou_set_usesqueeze339983 Ref: funct:unur_srou_set_usemirror340434 Ref: funct:unur_srou_set_verify341147 Ref: funct:unur_srou_chg_verify341147 Ref: funct:unur_srou_chg_cdfatmode341646 Ref: funct:unur_srou_chg_pdfatmode341859 Node: SSR342072 Ref: funct:unur_ssr_new345554 Ref: funct:unur_ssr_set_cdfatmode345668 Ref: funct:unur_ssr_set_pdfatmode346016 Ref: funct:unur_ssr_set_usesqueeze346441 Ref: funct:unur_ssr_set_verify346845 Ref: funct:unur_ssr_chg_verify346845 Ref: funct:unur_ssr_chg_cdfatmode347332 Ref: funct:unur_ssr_chg_pdfatmode347544 Node: TABL347756 Ref: funct:unur_tabl_new353421 Ref: funct:unur_tabl_set_variant_ia353536 Ref: funct:unur_tabl_set_cpoints354047 Ref: funct:unur_tabl_set_nstp354407 Ref: funct:unur_tabl_set_useear354831 Ref: funct:unur_tabl_set_areafraction355308 Ref: funct:unur_tabl_set_usedars355824 Ref: funct:unur_tabl_set_darsfactor356610 Ref: funct:unur_tabl_set_variant_splitmode357245 Ref: funct:unur_tabl_set_max_sqhratio357765 Ref: funct:unur_tabl_get_sqhratio358491 Ref: funct:unur_tabl_get_hatarea358711 Ref: funct:unur_tabl_get_squeezearea358895 Ref: funct:unur_tabl_set_max_intervals359097 Ref: funct:unur_tabl_get_n_intervals359364 Ref: funct:unur_tabl_set_slopes359522 Ref: funct:unur_tabl_set_guidefactor360494 Ref: funct:unur_tabl_set_boundary360830 Ref: funct:unur_tabl_chg_truncated361242 Ref: funct:unur_tabl_set_verify362835 Ref: funct:unur_tabl_chg_verify362835 Ref: funct:unur_tabl_set_pedantic363334 Node: TDR363858 Ref: funct:unur_tdr_new367649 Ref: funct:unur_tdr_set_c367763 Ref: funct:unur_tdr_set_variant_gw368019 Ref: funct:unur_tdr_set_variant_ps368194 Ref: funct:unur_tdr_set_variant_ia368382 Ref: funct:unur_tdr_set_usedars368582 Ref: funct:unur_tdr_set_darsfactor370689 Ref: funct:unur_tdr_set_cpoints371326 Ref: funct:unur_tdr_set_reinit_percentiles371671 Ref: funct:unur_tdr_chg_reinit_percentiles371671 Ref: funct:unur_tdr_set_reinit_ncpoints372759 Ref: funct:unur_tdr_chg_reinit_ncpoints372759 Ref: funct:unur_tdr_chg_truncated373183 Ref: funct:unur_tdr_set_max_sqhratio374694 Ref: funct:unur_tdr_get_sqhratio375269 Ref: funct:unur_tdr_get_hatarea375488 Ref: funct:unur_tdr_get_squeezearea375671 Ref: funct:unur_tdr_set_max_intervals375872 Ref: funct:unur_tdr_set_usecenter376234 Ref: funct:unur_tdr_set_usemode376391 Ref: funct:unur_tdr_set_guidefactor377047 Ref: funct:unur_tdr_set_verify377376 Ref: funct:unur_tdr_chg_verify377376 Ref: funct:unur_tdr_set_pedantic377863 Ref: funct:unur_tdr_eval_invcdfhat378939 Node: UTDR379986 Ref: funct:unur_utdr_new382237 Ref: funct:unur_utdr_set_pdfatmode382352 Ref: funct:unur_utdr_set_cpfactor382778 Ref: funct:unur_utdr_set_deltafactor383137 Ref: funct:unur_utdr_set_verify383489 Ref: funct:unur_utdr_chg_verify383489 Ref: funct:unur_utdr_chg_pdfatmode383988 Node: Methods_for_CEMP384201 Node: EMPK389979 Ref: funct:unur_empk_new394309 Ref: funct:unur_empk_set_kernel394424 Ref: funct:unur_empk_set_kernelgen395260 Ref: funct:unur_empk_set_beta396542 Ref: funct:unur_empk_set_smoothing396987 Ref: funct:unur_empk_chg_smoothing396987 Ref: funct:unur_empk_set_varcor397805 Ref: funct:unur_empk_chg_varcor397805 Ref: funct:unur_empk_set_positive398236 Node: EMPL398493 Ref: funct:unur_empl_new400237 Node: HIST400352 Ref: funct:unur_hist_new401126 Node: Methods_for_CVEC401241 Node: MVSTD401984 Ref: funct:unur_mvstd_new403287 Node: MVTDR403647 Ref: funct:unur_mvtdr_new407191 Ref: funct:unur_mvtdr_set_stepsmin407299 Ref: funct:unur_mvtdr_set_boundsplitting407518 Ref: funct:unur_mvtdr_set_maxcones407996 Ref: funct:unur_mvtdr_get_ncones408595 Ref: funct:unur_mvtdr_get_hatvol408785 Ref: funct:unur_mvtdr_set_verify408971 Ref: funct:unur_mvtdr_chg_verify408971 Node: NORTA409482 Ref: funct:unur_norta_new412289 Node: VNROU412405 Ref: funct:unur_vnrou_new417083 Ref: funct:unur_vnrou_set_u417199 Ref: funct:unur_vnrou_chg_u417946 Ref: funct:unur_vnrou_set_v418109 Ref: funct:unur_vnrou_chg_v418449 Ref: funct:unur_vnrou_set_r418577 Ref: funct:unur_vnrou_set_verify418808 Ref: funct:unur_vnrou_chg_verify419221 Ref: funct:unur_vnrou_get_volumehat419368 Node: MCMC_Methods_for_CVEC419681 Node: GIBBS420584 Ref: funct:unur_gibbs_new425741 Ref: funct:unur_gibbs_set_variant_coordinate425895 Ref: funct:unur_gibbs_set_variant_random_direction426100 Ref: funct:unur_gibbs_set_c426262 Ref: funct:unur_gibbs_set_startingpoint426949 Ref: funct:unur_gibbs_set_thinning427482 Ref: funct:unur_gibbs_set_burnin427804 Ref: funct:unur_gibbs_get_state428717 Ref: funct:unur_gibbs_chg_state428717 Ref: funct:unur_gibbs_reset_state428939 Node: HITRO429284 Ref: funct:unur_hitro_new437749 Ref: funct:unur_hitro_set_variant_coordinate437865 Ref: funct:unur_hitro_set_variant_random_direction438226 Ref: funct:unur_hitro_set_use_adaptiveline438388 Ref: funct:unur_hitro_set_use_boundingrectangle439096 Ref: funct:unur_hitro_set_use_adaptiverectangle439629 Ref: funct:unur_hitro_set_r441092 Ref: funct:unur_hitro_set_v441323 Ref: funct:unur_hitro_set_u442001 Ref: funct:unur_hitro_set_adaptive_multiplier443045 Ref: funct:unur_hitro_set_startingpoint443682 Ref: funct:unur_hitro_set_thinning444327 Ref: funct:unur_hitro_set_burnin444891 Ref: funct:unur_hitro_get_state445536 Ref: funct:unur_hitro_chg_state445536 Ref: funct:unur_hitro_reset_state446115 Node: Methods_for_CVEMP446460 Node: VEMPK450086 Ref: funct:unur_vempk_new451952 Ref: funct:unur_vempk_set_smoothing452068 Ref: funct:unur_vempk_chg_smoothing452068 Ref: funct:unur_vempk_set_varcor452882 Ref: funct:unur_vempk_chg_varcor452882 Node: Methods_for_DISCR453325 Node: DARI459325 Ref: funct:unur_dari_new461569 Ref: funct:unur_dari_set_squeeze461684 Ref: funct:unur_dari_set_tablesize462266 Ref: funct:unur_dari_set_cpfactor462717 Ref: funct:unur_dari_set_verify463148 Ref: funct:unur_dari_chg_verify463148 Node: DAU463611 Ref: funct:unur_dau_new465134 Ref: funct:unur_dau_set_urnfactor465248 Node: DEXT465625 Ref: funct:unur_dext_new473506 Ref: funct:unur_dext_set_init473625 Ref: funct:unur_dext_set_sample474244 Ref: funct:unur_dext_get_params474731 Ref: funct:unur_dext_get_distrparams475351 Ref: funct:unur_dext_get_ndistrparams475351 Node: DGT475724 Ref: funct:unur_dgt_new478800 Ref: funct:unur_dgt_set_guidefactor478914 Ref: funct:unur_dgt_set_variant479502 Node: DSROU479883 Ref: funct:unur_dsrou_new481786 Ref: funct:unur_dsrou_set_cdfatmode481902 Ref: funct:unur_dsrou_set_verify482432 Ref: funct:unur_dsrou_chg_verify482432 Ref: funct:unur_dsrou_chg_cdfatmode482943 Node: DSS483157 Ref: funct:unur_dss_new484808 Node: DSTD484922 Ref: funct:unur_dstd_new487276 Ref: funct:unur_dstd_set_variant487863 Ref: funct:unur_dstd_chg_truncated488476 Node: Methods_for_MATR489597 Node: MCORR489988 Ref: funct:unur_mcorr_new492558 Ref: funct:unur_mcorr_set_eigenvalues492674 Ref: funct:unur_mcorr_chg_eigenvalues493342 Node: Methods_for_UNID493576 Node: UNIF493846 Ref: funct:unur_unif_new494406 Node: Meta_Methods494665 Node: MIXT501503 Ref: funct:unur_mixt_new503721 Ref: funct:unur_mixt_set_useinversion504097 Node: URNG504718 Ref: funct:unur_get_default_urng511701 Ref: funct:unur_set_default_urng511915 Ref: funct:unur_set_default_urng_aux512127 Ref: funct:unur_get_default_urng_aux512127 Ref: funct:unur_set_urng512422 Ref: funct:unur_chg_urng512906 Ref: funct:unur_get_urng513244 Ref: funct:unur_set_urng_aux513438 Ref: funct:unur_use_urng_aux_default514067 Ref: funct:unur_chgto_urng_aux_default514353 Ref: funct:unur_chg_urng_aux514642 Ref: funct:unur_get_urng_aux515135 Ref: funct:unur_urng_sample515536 Ref: funct:unur_sample_urng515718 Ref: funct:unur_urng_sample_array515962 Ref: funct:unur_urng_reset516692 Ref: funct:unur_urng_sync517311 Ref: funct:unur_urng_seed517632 Ref: funct:unur_urng_anti518589 Ref: funct:unur_urng_nextsub518903 Ref: funct:unur_urng_resetsub519217 Ref: funct:unur_gen_sync519538 Ref: funct:unur_gen_seed519538 Ref: funct:unur_gen_anti519538 Ref: funct:unur_gen_reset519538 Ref: funct:unur_gen_nextsub519538 Ref: funct:unur_gen_resetsub519538 Ref: funct:unur_urng_new520935 Ref: funct:unur_urng_free521740 Ref: funct:unur_urng_set_sample_array522327 Ref: funct:unur_urng_set_sync522581 Ref: funct:unur_urng_set_seed522741 Ref: funct:unur_urng_set_anti522916 Ref: funct:unur_urng_set_reset523111 Ref: funct:unur_urng_set_nextsub523301 Ref: funct:unur_urng_set_resetsub523500 Ref: funct:unur_urng_set_delete523704 Node: URNG-FVOID523859 Ref: funct:unur_urng_fvoid_new525374 Node: URNG-GSL525661 Ref: funct:unur_urng_gsl_new529769 Ref: funct:unur_urng_gslptr_new530125 Node: URNG-GSLQRNG530728 Ref: funct:unur_urng_gslqrng_new531976 Node: URNG-PRNG532401 Ref: funct:unur_urng_prng_new533893 Ref: funct:unur_urng_prngptr_new534747 Node: URNG-RNGSTREAM534985 Ref: funct:unur_urng_rngstream_new536893 Ref: funct:unur_urng_rngstreamptr_new537128 Node: URNG-RANDOMSHIFT537355 Ref: funct:unur_urng_randomshift_new539040 Ref: funct:unur_urng_randomshift_nextshift539551 Node: Stddist539747 Node: Stddist_CONT543763 Node: F545002 Ref: funct:unur_distr_F545126 Node: beta545507 Ref: funct:unur_distr_beta545658 Node: cauchy546142 Ref: funct:unur_distr_cauchy546303 Node: chi546725 Ref: funct:unur_distr_chi546879 Node: chisquare547264 Ref: funct:unur_distr_chisquare547447 Node: exponential547797 Ref: funct:unur_distr_exponential547993 Node: extremeI548397 Ref: funct:unur_distr_extremeI548633 Node: extremeII549061 Ref: funct:unur_distr_extremeII549297 Node: gamma549790 Ref: funct:unur_distr_gamma549951 Node: gig550602 Ref: funct:unur_distr_gig550802 Node: gig2551338 Ref: funct:unur_distr_gig2551545 Node: hyperbolic551988 Ref: funct:unur_distr_hyperbolic552170 Node: ig552686 Ref: funct:unur_distr_ig552867 Node: laplace553248 Ref: funct:unur_distr_laplace553419 Node: logistic553828 Ref: funct:unur_distr_logistic554010 Node: lognormal554446 Ref: funct:unur_distr_lognormal554632 Node: lomax555085 Ref: funct:unur_distr_lomax555325 Node: normal555702 Ref: funct:unur_distr_normal555869 Node: pareto556542 Ref: funct:unur_distr_pareto556752 Node: powerexponential557130 Ref: funct:unur_distr_powerexponential557372 Node: rayleigh557750 Ref: funct:unur_distr_rayleigh557937 Node: slash558207 Ref: funct:unur_distr_slash558373 Node: student558635 Ref: funct:unur_distr_student558821 Node: triangular559133 Ref: funct:unur_distr_triangular559323 Node: uniform559674 Ref: funct:unur_distr_uniform559852 Node: weibull560216 Ref: funct:unur_distr_weibull560375 Node: Stddist_CVEC560870 Node: copula561334 Ref: funct:unur_distr_copula561540 Node: multicauchy562063 Ref: funct:unur_distr_multicauchy562264 Node: multiexponential562753 Ref: funct:unur_distr_multiexponential562979 Node: multinormal563416 Ref: funct:unur_distr_multinormal563623 Node: multistudent564065 Ref: funct:unur_distr_multistudent564251 Node: Stddist_DISCR564766 Node: binomial565397 Ref: funct:unur_distr_binomial565562 Node: geometric565971 Ref: funct:unur_distr_geometric566163 Node: hypergeometric566465 Ref: funct:unur_distr_hypergeometric566680 Node: logarithmic567186 Ref: funct:unur_distr_logarithmic567396 Node: negativebinomial567757 Ref: funct:unur_distr_negativebinomial567982 Node: poisson568308 Ref: funct:unur_distr_poisson568475 Node: Stddist_MATR568931 Node: correlation569140 Ref: funct:unur_distr_correlation569303 Node: Error_Debug569577 Node: Output_streams570477 Ref: funct:unur_set_stream571613 Ref: funct:unur_get_stream572421 Node: Debug572619 Ref: funct:unur_set_debug575142 Ref: funct:unur_chg_debug575255 Ref: funct:unur_set_default_debug575370 Node: Error_reporting575465 Ref: var:unur_errno579658 Ref: funct:unur_get_errno579752 Ref: funct:unur_reset_errno579847 Ref: funct:unur_get_strerror579983 Node: Errno580101 Node: Error_handlers583445 Ref: funct:unur_set_error_handler585467 Ref: funct:unur_set_error_handler_off586112 Node: Testing586387 Ref: funct:unur_run_tests586730 Ref: funct:unur_test_printsample587387 Ref: funct:unur_test_timing587624 Ref: funct:unur_test_timing_R588983 Ref: funct:unur_test_timing_uniform590448 Ref: funct:unur_test_timing_exponential590448 Ref: funct:unur_test_timing_total590944 Ref: funct:unur_test_count_urn591867 Ref: funct:unur_test_count_pdf592388 Ref: funct:unur_test_par_count_pdf593372 Ref: funct:unur_test_chi2593746 Ref: funct:unur_test_moments595852 Ref: funct:unur_test_correlation596664 Ref: funct:unur_test_quartiles597075 Ref: funct:unur_test_u_error597586 Node: Misc599434 Node: Math599572 Node: RVG600043 Node: Inversion601784 Node: Rejection608669 Node: Composition615888 Node: Ratio-of-Uniforms617693 Node: DiscreteInversion623748 Node: IndexedSearch627166 Node: Glossary629065 Node: Bibliography631125 Ref: bib:JKKa92631305 Ref: bib:JKBb94631454 Ref: bib:JKBc95631626 Ref: bib:JKBd97631798 Ref: bib:KBJe00631942 Ref: bib:HLD04632187 Ref: bib:AJa93632361 Ref: bib:AJa95632506 Ref: bib:CAa74632658 Ref: bib:DHLa08632800 Ref: bib:DLa86633097 Ref: bib:GWa92633202 Ref: bib:HWa95633338 Ref: bib:HDa96633496 Ref: bib:HLa00633664 Ref: bib:HLa03633913 Ref: bib:HLDa07634061 Ref: bib:KLPa05634249 Ref: bib:LJa98634587 Ref: bib:LJa00634741 Ref: bib:LJa01634881 Ref: bib:LJa02635064 Ref: bib:WGS91635211 Ref: bib:WAa77635404 Ref: bib:ADa74635621 Ref: bib:ADa82635784 Ref: bib:ADb82635933 Ref: bib:BMa58636104 Ref: bib:CHa77636248 Ref: bib:Dag89636389 Ref: bib:HDa90636536 Ref: bib:KAa81636674 Ref: bib:KRa76636819 Ref: bib:MJa87636969 Ref: bib:MGa62637101 Ref: bib:MOa84637263 Ref: bib:STa89637390 Ref: bib:ZHa94637634 Ref: bib:CPa76637844 Ref: bib:HJa61638022 Node: FIndex638197  End Tag Table  Local Variables: coding: utf-8 End: unuran-1.11.0/doc/stamp-10000644001357500135600000000014114430713451012005 00000000000000@set UPDATED 21 April 2023 @set UPDATED-MONTH April 2023 @set EDITION 1.11.0 @set VERSION 1.11.0 unuran-1.11.0/doc/Makefile.in0000644001357500135600000011137314430713360012656 00000000000000# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = doc ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/version.texi \ $(srcdir)/stamp-vti $(srcdir)/version_win32.texi \ $(srcdir)/stamp-1 $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = AM_V_DVIPS = $(am__v_DVIPS_@AM_V@) am__v_DVIPS_ = $(am__v_DVIPS_@AM_DEFAULT_V@) am__v_DVIPS_0 = @echo " DVIPS " $@; am__v_DVIPS_1 = AM_V_MAKEINFO = $(am__v_MAKEINFO_@AM_V@) am__v_MAKEINFO_ = $(am__v_MAKEINFO_@AM_DEFAULT_V@) am__v_MAKEINFO_0 = @echo " MAKEINFO" $@; am__v_MAKEINFO_1 = AM_V_INFOHTML = $(am__v_INFOHTML_@AM_V@) am__v_INFOHTML_ = $(am__v_INFOHTML_@AM_DEFAULT_V@) am__v_INFOHTML_0 = @echo " INFOHTML" $@; am__v_INFOHTML_1 = AM_V_TEXI2DVI = $(am__v_TEXI2DVI_@AM_V@) am__v_TEXI2DVI_ = $(am__v_TEXI2DVI_@AM_DEFAULT_V@) am__v_TEXI2DVI_0 = @echo " TEXI2DVI" $@; am__v_TEXI2DVI_1 = AM_V_TEXI2PDF = $(am__v_TEXI2PDF_@AM_V@) am__v_TEXI2PDF_ = $(am__v_TEXI2PDF_@AM_DEFAULT_V@) am__v_TEXI2PDF_0 = @echo " TEXI2PDF" $@; am__v_TEXI2PDF_1 = AM_V_texinfo = $(am__v_texinfo_@AM_V@) am__v_texinfo_ = $(am__v_texinfo_@AM_DEFAULT_V@) am__v_texinfo_0 = -q am__v_texinfo_1 = AM_V_texidevnull = $(am__v_texidevnull_@AM_V@) am__v_texidevnull_ = $(am__v_texidevnull_@AM_DEFAULT_V@) am__v_texidevnull_0 = > /dev/null am__v_texidevnull_1 = INFO_DEPS = $(srcdir)/unuran.info $(srcdir)/unuran_win32.info am__TEXINFO_TEX_DIR = $(srcdir)/./src DVIS = unuran.dvi unuran_win32.dvi PDFS = unuran.pdf unuran_win32.pdf PSS = unuran.ps unuran_win32.ps HTMLS = unuran.html unuran_win32.html TEXINFOS = unuran.texi unuran_win32.texi TEXI2DVI = texi2dvi TEXI2PDF = $(TEXI2DVI) --pdf --batch MAKEINFOHTML = $(MAKEINFO) --html DVIPS = dvips RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__installdirs = "$(DESTDIR)$(infodir)" am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } DATA = $(noinst_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir distdir-am am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in \ $(top_srcdir)/autoconf/mdate-sh $(unuran_TEXINFOS) \ $(unuran_win32_TEXINFOS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILECMD = @FILECMD@ GREP = @GREP@ HAVE_DIVIDE_BY_ZERO = @HAVE_DIVIDE_BY_ZERO@ HAVE_IEEE_COMPARISONS = @HAVE_IEEE_COMPARISONS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNURAN_LT_VERSION = @UNURAN_LT_VERSION@ UNURAN_SUPPORTS_GSL = @UNURAN_SUPPORTS_GSL@ UNURAN_SUPPORTS_PRNG = @UNURAN_SUPPORTS_PRNG@ UNURAN_SUPPORTS_RNGSTREAM = @UNURAN_SUPPORTS_RNGSTREAM@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ have_valgrind = @have_valgrind@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = src figures . info_TEXINFOS = unuran.texi unuran_win32.texi # Location of same source files TEXINFO_TEX = ./src/texinfo.tex AM_MAKEINFOFLAGS = \ -I $(top_srcdir)/doc \ -I $(top_srcdir)/doc/src \ --no-split AM_MAKEINFOHTMLFLAGS = \ -I $(top_srcdir)/doc \ -I $(top_srcdir)/doc/src \ --css-include=$(top_srcdir)/doc/src/unuran.css \ --no-split # Automatically created part of manual unuran_src = ./src/unuran_src.texi # Files with examples. # These example files are generated from the corresponding # files $(top_srcdir)/examples/example*.c unuran_examples = \ ./src/ref_example0.texi ./src/ref_example0_str.texi \ ./src/ref_example1.texi ./src/ref_example1_str.texi \ ./src/ref_example2.texi ./src/ref_example2_str.texi \ ./src/ref_example3.texi ./src/ref_example3_str.texi \ ./src/ref_example_reinit.texi \ ./src/ref_example_gsl.texi \ ./src/ref_example_rngstreams.texi \ ./src/ref_example_anti.texi ./src/ref_example_anti_str.texi \ ./src/ref_example_cext.texi \ ./src/ref_example_cont.texi ./src/ref_example_cont_str.texi \ ./src/ref_example_dext.texi \ ./src/ref_example_discr.texi ./src/ref_example_discr_str.texi \ ./src/ref_example_emp.texi ./src/ref_example_emp_str.texi \ ./src/ref_example_vemp.texi ./src/ref_example_FuncStr.texi \ ./src/ref_example_mixt.texi ./src/ref_example_mixt_inv.texi # Sources for UNU.RAN manual unuran_TEXINFOS = \ unuran.texi \ ./src/methods_cont.texi \ ./src/methods_discr.texi \ ./src/methods_cemp.texi \ ./src/methods_cvec.texi \ ./src/methods_mcmc.texi \ ./src/methods_cvemp.texi \ ./src/methods_matr.texi \ $(unuran_src) \ $(unuran_examples) \ $(top_srcdir)/doc/figures/*.eps \ $(top_srcdir)/doc/figures/*.pdf \ $(top_srcdir)/doc/figures/*.png \ $(top_srcdir)/doc/figures/*.txt # Sources for (short) Win32 manual # Files with examples. # These example files are generated from the corresponding # files $(top_srcdir)/scripts/win32/example?.c unuran_win32_examples = \ ./src/ref_example_win32_1.texi \ ./src/ref_example_win32_2.texi unuran_win32_TEXINFOS = \ unuran_win32.texi \ unuran_win32_libname.texi \ $(unuran_win32_examples) noinst_DATA = EXTRA_DIST = \ unuran.html \ unuran.txt \ unuran.pdf \ unuran_win32.html \ unuran_win32.pdf # Clean backup and temp files CLEANFILES = \ *~ # Clean generated files MAINTAINERCLEANFILES = \ Makefile.in \ mdate-sh \ $(unuran_src) \ $(unuran_examples) \ $(unuran_win32_examples) \ unuran_win32_libname.texi \ unuran.txt \ \ $(top_srcdir)/aclocal.m4 \ $(top_srcdir)/config.h.in \ $(top_srcdir)/configure all: all-recursive .SUFFIXES: .SUFFIXES: .dvi .html .info .pdf .ps .texi $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign doc/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs .texi.info: $(AM_V_MAKEINFO)restore=: && backupdir="$(am__leading_dot)am$$$$" && \ am__cwd=`pwd` && $(am__cd) $(srcdir) && \ rm -rf $$backupdir && mkdir $$backupdir && \ if ($(MAKEINFO) --version) >/dev/null 2>&1; then \ for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \ if test -f $$f; then mv $$f $$backupdir; restore=mv; else :; fi; \ done; \ else :; fi && \ cd "$$am__cwd"; \ if $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ -o $@ $<; \ then \ rc=0; \ $(am__cd) $(srcdir); \ else \ rc=$$?; \ $(am__cd) $(srcdir) && \ $$restore $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \ fi; \ rm -rf $$backupdir; exit $$rc .texi.dvi: $(AM_V_TEXI2DVI)TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \ $(TEXI2DVI) $(AM_V_texinfo) --build-dir=$(@:.dvi=.t2d) -o $@ $(AM_V_texidevnull) \ $< .texi.pdf: $(AM_V_TEXI2PDF)TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \ $(TEXI2PDF) $(AM_V_texinfo) --build-dir=$(@:.pdf=.t2p) -o $@ $(AM_V_texidevnull) \ $< .texi.html: $(AM_V_MAKEINFO)rm -rf $(@:.html=.htp) $(AM_V_at)if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ -o $(@:.html=.htp) $<; \ then \ rm -rf $@ && mv $(@:.html=.htp) $@; \ else \ rm -rf $(@:.html=.htp); exit 1; \ fi $(srcdir)/unuran.info: unuran.texi $(srcdir)/version.texi $(unuran_TEXINFOS) unuran.dvi: unuran.texi $(srcdir)/version.texi $(unuran_TEXINFOS) unuran.pdf: unuran.texi $(srcdir)/version.texi $(unuran_TEXINFOS) unuran.html: unuran.texi $(srcdir)/version.texi $(unuran_TEXINFOS) $(srcdir)/version.texi: @MAINTAINER_MODE_TRUE@ $(srcdir)/stamp-vti $(srcdir)/stamp-vti: unuran.texi $(top_srcdir)/configure @(dir=.; test -f ./unuran.texi || dir=$(srcdir); \ set `$(SHELL) $(top_srcdir)/autoconf/mdate-sh $$dir/unuran.texi`; \ echo "@set UPDATED $$1 $$2 $$3"; \ echo "@set UPDATED-MONTH $$2 $$3"; \ echo "@set EDITION $(VERSION)"; \ echo "@set VERSION $(VERSION)") > vti.tmp$$$$ && \ (cmp -s vti.tmp$$$$ $(srcdir)/version.texi \ || (echo "Updating $(srcdir)/version.texi" && \ cp vti.tmp$$$$ $(srcdir)/version.texi.tmp$$$$ && \ mv $(srcdir)/version.texi.tmp$$$$ $(srcdir)/version.texi)) && \ rm -f vti.tmp$$$$ $(srcdir)/version.texi.$$$$ @cp $(srcdir)/version.texi $@ mostlyclean-vti: -rm -f vti.tmp* $(srcdir)/version.texi.tmp* maintainer-clean-vti: @MAINTAINER_MODE_TRUE@ -rm -f $(srcdir)/stamp-vti $(srcdir)/version.texi $(srcdir)/unuran_win32.info: unuran_win32.texi $(srcdir)/version_win32.texi $(unuran_win32_TEXINFOS) unuran_win32.dvi: unuran_win32.texi $(srcdir)/version_win32.texi $(unuran_win32_TEXINFOS) unuran_win32.pdf: unuran_win32.texi $(srcdir)/version_win32.texi $(unuran_win32_TEXINFOS) unuran_win32.html: unuran_win32.texi $(srcdir)/version_win32.texi $(unuran_win32_TEXINFOS) $(srcdir)/version_win32.texi: @MAINTAINER_MODE_TRUE@ $(srcdir)/stamp-1 $(srcdir)/stamp-1: unuran_win32.texi $(top_srcdir)/configure @(dir=.; test -f ./unuran_win32.texi || dir=$(srcdir); \ set `$(SHELL) $(top_srcdir)/autoconf/mdate-sh $$dir/unuran_win32.texi`; \ echo "@set UPDATED $$1 $$2 $$3"; \ echo "@set UPDATED-MONTH $$2 $$3"; \ echo "@set EDITION $(VERSION)"; \ echo "@set VERSION $(VERSION)") > 1.tmp$$$$ && \ (cmp -s 1.tmp$$$$ $(srcdir)/version_win32.texi \ || (echo "Updating $(srcdir)/version_win32.texi" && \ cp 1.tmp$$$$ $(srcdir)/version_win32.texi.tmp$$$$ && \ mv $(srcdir)/version_win32.texi.tmp$$$$ $(srcdir)/version_win32.texi)) && \ rm -f 1.tmp$$$$ $(srcdir)/version_win32.texi.$$$$ @cp $(srcdir)/version_win32.texi $@ mostlyclean-1: -rm -f 1.tmp* $(srcdir)/version_win32.texi.tmp* maintainer-clean-1: @MAINTAINER_MODE_TRUE@ -rm -f $(srcdir)/stamp-1 $(srcdir)/version_win32.texi .dvi.ps: $(AM_V_DVIPS)TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ $(DVIPS) $(AM_V_texinfo) -o $@ $< uninstall-dvi-am: @$(NORMAL_UNINSTALL) @list='$(DVIS)'; test -n "$(dvidir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(dvidir)/$$f'"; \ rm -f "$(DESTDIR)$(dvidir)/$$f"; \ done uninstall-html-am: @$(NORMAL_UNINSTALL) @list='$(HTMLS)'; test -n "$(htmldir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " rm -rf '$(DESTDIR)$(htmldir)/$$f'"; \ rm -rf "$(DESTDIR)$(htmldir)/$$f"; \ done uninstall-info-am: @$(PRE_UNINSTALL) @if test -d '$(DESTDIR)$(infodir)' && $(am__can_run_installinfo); then \ list='$(INFO_DEPS)'; \ for file in $$list; do \ relfile=`echo "$$file" | sed 's|^.*/||'`; \ echo " install-info --info-dir='$(DESTDIR)$(infodir)' --remove '$(DESTDIR)$(infodir)/$$relfile'"; \ if install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$$relfile"; \ then :; else test ! -f "$(DESTDIR)$(infodir)/$$relfile" || exit 1; fi; \ done; \ else :; fi @$(NORMAL_UNINSTALL) @list='$(INFO_DEPS)'; \ for file in $$list; do \ relfile=`echo "$$file" | sed 's|^.*/||'`; \ relfile_i=`echo "$$relfile" | sed 's|\.info$$||;s|$$|.i|'`; \ (if test -d "$(DESTDIR)$(infodir)" && cd "$(DESTDIR)$(infodir)"; then \ echo " cd '$(DESTDIR)$(infodir)' && rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]"; \ rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]; \ else :; fi); \ done uninstall-pdf-am: @$(NORMAL_UNINSTALL) @list='$(PDFS)'; test -n "$(pdfdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(pdfdir)/$$f'"; \ rm -f "$(DESTDIR)$(pdfdir)/$$f"; \ done uninstall-ps-am: @$(NORMAL_UNINSTALL) @list='$(PSS)'; test -n "$(psdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(psdir)/$$f'"; \ rm -f "$(DESTDIR)$(psdir)/$$f"; \ done dist-info: $(INFO_DEPS) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ list='$(INFO_DEPS)'; \ for base in $$list; do \ case $$base in \ $(srcdir)/*) base=`echo "$$base" | sed "s|^$$srcdirstrip/||"`;; \ esac; \ if test -f $$base; then d=.; else d=$(srcdir); fi; \ base_i=`echo "$$base" | sed 's|\.info$$||;s|$$|.i|'`; \ for file in $$d/$$base $$d/$$base-[0-9] $$d/$$base-[0-9][0-9] $$d/$$base_i[0-9] $$d/$$base_i[0-9][0-9]; do \ if test -f $$file; then \ relfile=`expr "$$file" : "$$d/\(.*\)"`; \ test -f "$(distdir)/$$relfile" || \ cp -p $$file "$(distdir)/$$relfile"; \ else :; fi; \ done; \ done mostlyclean-aminfo: -rm -rf unuran.t2d unuran.t2p unuran_win32.t2d unuran_win32.t2p clean-aminfo: -test -z "unuran.dvi unuran.pdf unuran.ps unuran.html unuran_win32.dvi \ unuran_win32.pdf unuran_win32.ps unuran_win32.html" \ || rm -rf unuran.dvi unuran.pdf unuran.ps unuran.html unuran_win32.dvi \ unuran_win32.pdf unuran_win32.ps unuran_win32.html maintainer-clean-aminfo: @list='$(INFO_DEPS)'; for i in $$list; do \ i_i=`echo "$$i" | sed 's|\.info$$||;s|$$|.i|'`; \ echo " rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]"; \ rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]; \ done # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" distdir="$(distdir)" \ dist-info check-am: all-am check: check-recursive all-am: Makefile $(INFO_DEPS) $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(infodir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-recursive clean-am: clean-aminfo clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: $(DVIS) html: html-recursive html-am: $(HTMLS) info: info-recursive info-am: $(INFO_DEPS) install-data-am: install-info-am install-dvi: install-dvi-recursive install-dvi-am: $(DVIS) @$(NORMAL_INSTALL) @list='$(DVIS)'; test -n "$(dvidir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(dvidir)'"; \ $(MKDIR_P) "$(DESTDIR)$(dvidir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(dvidir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(dvidir)" || exit $$?; \ done install-exec-am: install-html: install-html-recursive install-html-am: $(HTMLS) @$(NORMAL_INSTALL) @list='$(HTMLS)'; list2=; test -n "$(htmldir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)'"; \ $(MKDIR_P) "$(DESTDIR)$(htmldir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p" || test -d "$$p"; then d=; else d="$(srcdir)/"; fi; \ $(am__strip_dir) \ d2=$$d$$p; \ if test -d "$$d2"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)/$$f'"; \ $(MKDIR_P) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \ echo " $(INSTALL_DATA) '$$d2'/* '$(DESTDIR)$(htmldir)/$$f'"; \ $(INSTALL_DATA) "$$d2"/* "$(DESTDIR)$(htmldir)/$$f" || exit $$?; \ else \ list2="$$list2 $$d2"; \ fi; \ done; \ test -z "$$list2" || { echo "$$list2" | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(htmldir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(htmldir)" || exit $$?; \ done; } install-info: install-info-recursive install-info-am: $(INFO_DEPS) @$(NORMAL_INSTALL) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(infodir)'"; \ $(MKDIR_P) "$(DESTDIR)$(infodir)" || exit 1; \ fi; \ for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ esac; \ if test -f $$file; then d=.; else d=$(srcdir); fi; \ file_i=`echo "$$file" | sed 's|\.info$$||;s|$$|.i|'`; \ for ifile in $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9] \ $$d/$$file_i[0-9] $$d/$$file_i[0-9][0-9] ; do \ if test -f $$ifile; then \ echo "$$ifile"; \ else : ; fi; \ done; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(infodir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(infodir)" || exit $$?; done @$(POST_INSTALL) @if $(am__can_run_installinfo); then \ list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \ for file in $$list; do \ relfile=`echo "$$file" | sed 's|^.*/||'`; \ echo " install-info --info-dir='$(DESTDIR)$(infodir)' '$(DESTDIR)$(infodir)/$$relfile'";\ install-info --info-dir="$(DESTDIR)$(infodir)" "$(DESTDIR)$(infodir)/$$relfile" || :;\ done; \ else : ; fi install-man: install-pdf: install-pdf-recursive install-pdf-am: $(PDFS) @$(NORMAL_INSTALL) @list='$(PDFS)'; test -n "$(pdfdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(pdfdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pdfdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pdfdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(pdfdir)" || exit $$?; done install-ps: install-ps-recursive install-ps-am: $(PSS) @$(NORMAL_INSTALL) @list='$(PSS)'; test -n "$(psdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(psdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(psdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(psdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(psdir)" || exit $$?; done installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-1 \ maintainer-clean-aminfo maintainer-clean-generic \ maintainer-clean-vti mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-1 mostlyclean-aminfo mostlyclean-generic \ mostlyclean-libtool mostlyclean-vti pdf: pdf-recursive pdf-am: $(PDFS) ps: ps-recursive ps-am: $(PSS) uninstall-am: uninstall-dvi-am uninstall-html-am uninstall-info-am \ uninstall-pdf-am uninstall-ps-am .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-aminfo clean-generic clean-libtool \ cscopelist-am ctags ctags-am dist-info distclean \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs installdirs-am \ maintainer-clean maintainer-clean-1 maintainer-clean-aminfo \ maintainer-clean-generic maintainer-clean-vti mostlyclean \ mostlyclean-1 mostlyclean-aminfo mostlyclean-generic \ mostlyclean-libtool mostlyclean-vti pdf pdf-am ps ps-am tags \ tags-am uninstall uninstall-am uninstall-dvi-am \ uninstall-html-am uninstall-info-am uninstall-pdf-am \ uninstall-ps-am .PRECIOUS: Makefile # Generated texi files ... sinclude ./src/.dep-unuran_src_texi $(unuran_src): $(top_srcdir)/doc/src/make_texi.pl $(top_srcdir)/doc/src/make_texi.pl $(top_srcdir) > $(unuran_src) # Generated texi files for examples ... $(unuran_examples): $(top_srcdir)/examples/example*.c sed 's/{/@{/g;s/}/@}/g' < $(top_srcdir)/examples/`echo $* | sed 's/src\/ref_//'`.c > $@ $(unuran_win32_examples): $(top_srcdir)/scripts/win32/example*.c sed 's/{/@{/g;s/}/@}/g' < \ $(top_srcdir)/scripts/win32/`echo $* | sed 's/src\/ref_//' | sed 's/_win32_//'`.c > $@ # Rules for creating info, html, dvi, ps, and pdf files are provided by automake. # Add new rules for txt. unuran.txt: unuran.texi version.texi $(unuran_TEXINFOS) $(MAKEINFO) $(AM_MAKEINFOFLAGS) --fill-column=80 --no-headers --number-sections \ unuran.texi -o unuran.txt txt: unuran.txt # Name of Win32 libfile unuran_win32_libname.texi: @echo -n "@set LIBUNURAN libunuran" > unuran_win32_libname.texi @grep PACKAGE_VERSION $(top_srcdir)/config.h | \ sed 's/.*_VERSION\s*\"\(.*\)\..*\"/\1/' | sed 's/\.//' \ >> unuran_win32_libname.texi @echo -n "@set ZIPFILENAME unuran-" >> unuran_win32_libname.texi @grep PACKAGE_VERSION $(top_srcdir)/config.h | \ sed 's/.*_VERSION\s*\"\(.*\)\"/\1-win32.zip/' \ >> unuran_win32_libname.texi # Remark: the last three lines are an ugly hack # to remove these files in the top source directory. # It cannot be done in $(top_srcdir)/Makefile.am as # this breaks the cleaning process. # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: unuran-1.11.0/doc/figures/0000755001357500135600000000000014430713526012333 500000000000000unuran-1.11.0/doc/figures/texpict2img.pl0000754001357500135600000003111414420445767015061 00000000000000#!/usr/bin/perl ############################################################ use strict; use Getopt::Std; ############################################################ # programms my $LATEX="latex"; my $DVIPS="dvips"; my $GS="gs"; my $PS2EPSI="ps2epsi"; my $EPSTOPDF="epstopdf"; ############################################################ sub usage { my $progname = $0; $progname =~ s#^.*/##g; print STDERR < Read TeX file that contains a single picture and converts it into EPS, PDF, PNG, JPEG and TXT format. It is assumed that these pictures are produced by pstricks commands. Each of these is written into the respective file where FORMAT is "eps", "pdf", "png", "jpg" or "txt". The path information is stripped and the files are written in working directory (i.e. the directory where the command has been executed). Options: -r ... resolution for PNG and JPEG format [default: 150] -h ... height and width for TXT format (in characters) -w [defautl: -h 30 - w 77] Height and width in PS and PDF format are given by units in TeX file. WARNING! QUICK & DIRTY HACK! EOM exit -1; } ############################################################ # Defaults my $resolution = 150; my $txt_isize = 77; my $txt_jsize = 30; ############################################################ # Read arguments our ($opt_r, $opt_h, $opt_w); getopts('r:h:w:'); $resolution = $opt_r if $opt_r; $txt_isize = $opt_w if $opt_w; $txt_jsize = $opt_h if $opt_h; print STDERR "resolution = $resolution\n"; print STDERR "TXT width = $txt_isize\n"; print STDERR "TXT height = $txt_jsize\n"; print STDERR "----------------------\n"; ############################################################ # Ret name of TeX file # and compose names of all temp and output files # # Read name of TeX file from argument list ... my $tex_file = shift; (usage and die) unless $tex_file; # Get base of TeX file name my $file_base = $tex_file; $file_base =~ s[^.*/]{}; $file_base =~ s/(.*)\..*$/$1/; # Output files my $eps_file = "$file_base.eps"; my $pdf_file = "$file_base.pdf"; my $png_file = "$file_base.png"; my $jpg_file = "$file_base.jpg"; my $txt_file = "$file_base.txt"; print STDERR "TeX file = $tex_file\n"; print STDERR "EPS file = $eps_file\n"; print STDERR "PDF file = $pdf_file\n"; print STDERR "PNG file = $png_file\n"; print STDERR "JPG file = $jpg_file\n"; print STDERR "TXT file = $txt_file\n"; print STDERR "----------------------\n"; # Temp files my $tmp_base = "tmp-$file_base-$$"; my $tmp_tex_file = "$tmp_base.tex"; # TeX file for processing picture my $tmp_dvi_file = "$tmp_base.dvi"; # dvi file with picture my $tmp_ps_file_1 = "$tmp_base-1.ps"; # result of dvips my $tmp_ps_file_2 = "$tmp_base-2.ps"; # stripped PS file (with wrong bounding boxes) my $tmp_ps_file = "$tmp_base.ps"; # PS file with correct bounding boxes my $tmp_epsi_file = "$tmp_base.epsi"; # result of ps2epsi (to be needed for epstopdf) ############################################################ # Read TeX file and estimate TeX bounding box my $tex_bx0 = "a"; my $tex_by0 = 0; my $tex_bx1 = 0; my $tex_by1 = 0; my $tex_code; open TEX, "$tex_file"; while () { # store tex code $tex_code .= $_; if ( /\\begin\{pspicture\}\((-?[\d\.]+),\s*(-?[\d\.]+)\)\((-?[\d\.]+),\s*(-?[\d\.]+)\)/ ) { print STDERR "junk!!\n\n"; $tex_bx0 = $1; $tex_by0 = $2; $tex_bx1 = $3; $tex_by1 = $4; } } close TEX; if ($tex_bx0 eq "a") { die "Cannot find bounding box"; } print STDERR "TeX bounding box = ($tex_bx0,$tex_by0) x ($tex_bx1,$tex_by1)\n"; print STDERR "----------------------\n"; ############################################################ print STDERR "make temp file $tmp_tex_file\n"; open TEX, ">$tmp_tex_file" or die "Cannot open file $tmp_tex_file"; print TEX "\\documentclass{article}\n", "\\usepackage{pstricks,pst-plot,pst-node}\n", "\\usepackage{amsfonts}\n", "\\usepackage{amssymb}\n", "\\pagestyle{empty}\n", "\\parindent 0pt\n", "\\parskip 0pt\n", "\\newcommand{\\onehalf}{{\\textstyle\\frac{1}{2}}}\n", "\\begin{document}\n", "\\mbox{}\\vfill\n", "\\centering\n", "\\input{$tex_file}\n", "\\vfill\\mbox{}\n", "\\end{document}\n"; close TEX; # Make dvi system("$LATEX $tmp_tex_file"); print STDERR "----------------------\n"; # Make ps system("$DVIPS -o $tmp_ps_file_1 $tmp_dvi_file"); print STDERR "----------------------\n"; # Get PS bounding box my $bbox = `$GS -q -sDEVICE=bbox -dNOPAUSE -dBATCH $tmp_ps_file_1 2>&1`; my $boundingbox; my $hiresboundingbox; foreach my $l (split /\n/, $bbox) { $boundingbox = $l if ($l =~ /%%BoundingBox:/); $hiresboundingbox = $l if ($l =~ /%%HiResBoundingBox:/); } ($boundingbox) or die "Cannot find bounding box"; $boundingbox =~ m/^%%BoundingBox: ([0-9]+) ([0-9]+) ([0-9]+) ([0-9]+)/m; my $PS_bx0 = $1; my $PS_by0 = $2; my $PS_bx1 = $3; my $PS_by1 = $4; system("cat $tmp_ps_file_1 | sed -e 's/%%BoundingBox:.*\$/$boundingbox/' | sed -e 's/%%HiResBoundingBox:.*\$/$hiresboundingbox/'> $tmp_ps_file"); ############################################################ # Make eps print STDERR "Create EPS file ...\n"; system("$GS -q -dNOPAUSE -dBATCH -sDEVICE=pswrite -sOutputFile=$tmp_ps_file_2 -f $tmp_ps_file_1"); system("cat $tmp_ps_file_2 | sed -e 's/%%BoundingBox:.*\$/$boundingbox/' | sed -e 's/%%HiResBoundingBox:.*\$/$hiresboundingbox/'> $eps_file"); # Make pdf print STDERR "Create PDF file ...\n"; system("$PS2EPSI $tmp_ps_file_1 $tmp_epsi_file"); system("$EPSTOPDF --outfile=$pdf_file $tmp_epsi_file"); # Make png print STDERR "Create PNG file ...\n"; my $translate="-$PS_bx0 -$PS_by0 translate"; my $geometry = int($resolution*($PS_bx1-$PS_bx0)/72) ."x". int($resolution*($PS_by1-$PS_by0)/72); system("$GS -q -dNOPAUSE -dBATCH -sDEVICE=pnggray -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sOutputFile=$png_file -r$resolution -g$geometry -c $translate -f $tmp_ps_file"); # Make jpeg print STDERR "Create JPEG file ...\n"; system("$GS -q -dNOPAUSE -dBATCH -sDEVICE=jpeggray -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sOutputFile=$jpg_file -r$resolution -g$geometry -c $translate -f $tmp_ps_file"); print STDERR "----------------------\n"; ############################################################ # Make txt file # (very primitive support) print STDERR "Create TXT file ...\n"; # make blank page my $txt_string = " " x ($txt_isize); $txt_string .= "\n"; $txt_string = $txt_string x ($txt_jsize); # remove % from code $tex_code =~ s/\%//g; # scan tex code while (1) { # axes if ($tex_code =~ /\\psaxes\s*(\[.*?\])?(\{.*?\})?(.*?)([\n])/s) { my $line = $3; $line =~ s/^\s*\(//; $line =~ s/\)\s*$//; $tex_code =~ s/\\psaxes\s*(\[.*?\])?(\{.*?\})?(.*?)([\n])/$4/s; my @points = split /\s*\)\s*\(\s*/, $line; if ($#points == 0) { (my $x, my $y) = split /\,/, $points[0], 2; txt_joint_points("0,0","$x,0"); txt_joint_points("0,0","0,$y"); txt_draw_point($x,0,">"); txt_draw_point(0,$y,"^"); } else { die "Cannot handle psaxes: #points = $#points; tex = $line!\n\n\n"; } next; } # lines if ($tex_code =~ /\\psline\s*(\[.*?\])?(\{.*?\})?(.*?)([\n])/s) { my $line = $3; $line =~ s/^\s*\(//; $line =~ s/\)\s*$//; $tex_code =~ s/\\psline\s*(\[.*?\])?(\{.*?\})?(.*?)([\n])/$3/s; my @points = split /\s*\)\s*\(\s*/, $line; for my $n (0..$#points-1) { txt_joint_points($points[$n],$points[$n+1]); } next; } # circles if ($tex_code =~ /\\pscircle\*?\s*(\[.*?\])?(.*?)(\{.*?\})([\n])/s) { my $line = $2; $line =~ s/^\s*\(//; $line =~ s/\)\s*$//; $tex_code =~ s/\\pscircle\*?\s*(\[.*?\])?(.*?)(\{.*?\})([\n])/$4/s; (my $x, my $y) = split /\,/, $line, 2; txt_draw_point($x,$y,"o"); next; } # plot if ($tex_code =~ /\\psplot\s*(\[.*?\])?\s*\{(.*?)\}\s*\{(.*?)\}\s*\{(.*?)\}\s*([\n])/s) { my $x0 = $2; my $x1 = $3; my $code = $4; print "plot [$x0:$x1] $code\n"; $tex_code =~ s/\\psplot\s*(\[.*?\])?\s*\{(.*?)\}\s*\{(.*?)\}\s*\{(.*?)\}\s*([\n])/$5/s; txt_plot($x0,$x1,$code); next; } # parametric plot if ($tex_code =~ /\\parametricplot\s*(\[.*?\])?\s*\{(.*?)\}\s*\{(.*?)\}\s*\{(.*?)\}\s*([\n])/s) { my $x0 = $2; my $x1 = $3; my $code = $4; print "parametric plot [$x0:$x1] $code\n"; $tex_code =~ s/\\parametricplot\s*(\[.*?\])?\s*\{(.*?)\}\s*\{(.*?)\}\s*\{(.*?)\}\s*([\n])/$5/s; txt_parametricplot($x0,$x1,$code); next; } else { last; } } # print page open TXT, ">$txt_file"; print TXT $txt_string; close TXT; print STDERR "----------------------\n"; ############################################################ # Clear working space system("rm -v $tmp_base*.*"); exit 0; ############################################################ sub txt_draw { (my $i, my $j, my $c) = @_; $j = ($txt_jsize-1)-$j; $i=0 if $i<0; $i=$txt_isize-1 if $i>=$txt_isize; $j=0 if $j<0; $j=$txt_jsize-1 if $j>=$txt_jsize; my $pos = $j*($txt_isize+1) + $i; my $oc = substr($txt_string, $pos, 1); CHAR: { if ($c eq "-" and $oc eq "|" || $oc eq "+") { $c="+"; last CHAR; } if ($c eq "|" and $oc eq "-" || $oc eq "+") { $c="+"; last CHAR; } } substr($txt_string, $pos, 1) = $c; } sub txt_draw_point { (my $x, my $y, my $c) = @_; (my $i, my $j) = txt_xy2ij($x,$y); txt_draw($i,$j,$c); } sub txt_xy2ij { (my $x, my $y) = @_; my $i = int( ($x-$tex_bx0)/($tex_bx1-$tex_bx0) * $txt_isize); my $j = int( ($y-$tex_by0)/($tex_by1-$tex_by0) * $txt_jsize); return ($i,$j); } sub txt_joint_points { (my $first, my $second) = @_; (my $x0, my $y0) = split /\,/, $first, 2; (my $x1, my $y1) = split /\,/, $second, 2; print STDERR "line ($x0,$y0) -> ($x1,$y1): "; # get drawing character (dependent on slope) my $c = "."; (my $i0, my $j0) = txt_xy2ij($x0,$y0); (my $i1, my $j1) = txt_xy2ij($x1,$y1); my $s = atan2 ($j1-$j0,$i1-$i0); CHAR: { if ($s > -0.16 && $s < 0.16 or $s > 3.00 or $s < -3.00) { $c="-"; last CHAR; } if ($s > 1.41 && $s < 1.73 or $s > -1.73 && $s < -1.41) { $c="|"; last CHAR; } if ($s > 0.62 && $s < 0.95 or $s > -2.52 && $s < -2.28) { $c="/"; last CHAR; } if ($s < -0.62 && $s > -0.95 or $s < 2.52 && $s > 2.28) { $c="\\"; last CHAR; } } # number of steps my $steps = 1; if ($s > 0.78 && $s < 2.36 or $s < -0.78 && $s > -2.36) { $steps = $j1-$j0; } else { $steps = $i1-$i0; } $steps *= -1 if $steps < 0; print STDERR "slope = $s, steps = $steps, char = $c\n"; # draw line for my $t (0..$steps) { my $x = ($t * $x0 + ($steps-$t)*$x1)/$steps; my $y = ($t * $y0 + ($steps-$t)*$y1)/$steps; txt_draw_point($x,$y,$c); } } sub txt_plot { (my $x0, my $x1, my $code) = @_; # trim blanks $code =~ s/^\s+//; $code =~ s/\s+$//; # number of steps (my $i0, my $j0) = txt_xy2ij($x0,"0"); (my $i1, my $j1) = txt_xy2ij($x1,"0"); my $steps = $i1-$i0; $steps *= -1 if $steps < 0; # make plot for my $t (0..$steps) { my $x = ($t * $x0 + ($steps-$t)*$x1)/$steps; my $y = (txt_plot_eval($x,$code))[0]; txt_draw_point($x,$y,"*"); } } sub txt_parametricplot { (my $t0, my $t1, my $code) = @_; # trim blanks $code =~ s/^\s+//; $code =~ s/\s+$//; # number of steps my $steps = 100; # make plot for my $s (0..$steps) { my $t = ($s * $t0 + ($steps-$s)*$t1)/$steps; my @x = txt_plot_eval($t,$code); txt_draw_point($x[0],$x[1],"*"); } } # \parametricplot[plotstyle=curve,linestyle=none,fillstyle=solid,fillcolor=gray]% # {0}{180}{t cos t sin 0.75 mul} sub txt_plot_eval { (my $x, my $code) = @_; my @commands = split /\s+/, $code; my @stack; foreach my $cmd (@commands) { CMD:{ if ($cmd =~ /^\-?\d*\.?\d*$/) { push @stack, $cmd; last CMD; } if ($cmd eq "x" or $cmd eq "t") { push @stack, $x; last CMD; } if ($cmd eq "neg") { my $a = pop @stack; push @stack, (-$a); last CMD; } if ($cmd eq "mul") { my $a = pop @stack; my $b = pop @stack; push @stack, ($a*$b); last CMD; } if ($cmd eq "sub") { my $a = pop @stack; my $b = pop @stack; push @stack, ($b-$a); last CMD; } if ($cmd eq "exp") { my $a = pop @stack; my $b = pop @stack; push @stack, ($b ** $a); last CMD; } if ($cmd eq "sin") { my $a = pop @stack; push @stack, sin($a/57.29578); last CMD; } if ($cmd eq "cos") { my $a = pop @stack; push @stack, cos($a/57.29578); last CMD; } else { die "Unknown PS command: $cmd"; } } } return @stack; } unuran-1.11.0/doc/figures/discrete_inversion.eps0000644001357500135600000001044614420304141016653 00000000000000%!PS-Adobe-3.0 %%Pages: (atend) %%BoundingBox: 192 374 406 512 %%HiResBoundingBox: 192.743994 374.993989 405.366061 511.710049 %......................................... %%Creator: ESP Ghostscript 707 (pswrite) %%CreationDate: 2004/03/17 12:59:09 %%DocumentData: Clean7Bit %%LanguageLevel: 2 %%EndComments %%BeginProlog % This copyright applies to everything between here and the %%EndProlog: % Copyright 2003 artofcode LLC and Easy Software Products, all rights reserved. %%BeginResource: procset GS_pswrite_2_0_1001 /GS_pswrite_2_0_1001 80 dict dup begin /PageSize 2 array def/setpagesize{ PageSize aload pop 3 index eq exch 4 index eq and{ pop pop pop}{ PageSize dup 1 5 -1 roll put 0 4 -1 roll put dup null eq {false} {dup where} ifelse{ exch get exec} { pop/setpagedevice where { pop 1 dict dup /PageSize PageSize put setpagedevice} { /setpage where{ pop PageSize aload pop pageparams 3 {exch pop} repeat setpage}if}ifelse}ifelse}ifelse} bind def /!{bind def}bind def/#{load def}!/N/counttomark # /rG{3{3 -1 roll 255 div}repeat setrgbcolor}!/G{255 div setgray}!/K{0 G}! /r6{dup 3 -1 roll rG}!/r5{dup 3 1 roll rG}!/r3{dup rG}! /w/setlinewidth #/J/setlinecap # /j/setlinejoin #/M/setmiterlimit #/d/setdash #/i/setflat # /m/moveto #/l/lineto #/c/rcurveto # /p{N 2 idiv{N -2 roll rlineto}repeat}! /P{N 0 gt{N -2 roll moveto p}if}! /h{p closepath}!/H{P closepath}! /lx{0 rlineto}!/ly{0 exch rlineto}!/v{0 0 6 2 roll c}!/y{2 copy c}! /re{4 -2 roll m exch dup lx exch ly neg lx h}! /^{3 index neg 3 index neg}! /f{P fill}!/f*{P eofill}!/s{H stroke}!/S{P stroke}! /q/gsave #/Q/grestore #/rf{re fill}! /Y{P clip newpath}!/Y*{P eoclip newpath}!/rY{re Y}! /|={pop exch 4 1 roll 1 array astore cvx 3 array astore cvx exch 1 index def exec}! /|{exch string readstring |=}! /+{dup type/nametype eq{2 index 7 add -3 bitshift 2 index mul}if}! /@/currentfile #/${+ @ |}! /B{{2 copy string{readstring pop}aload pop 4 array astore cvx 3 1 roll}repeat pop pop true}! /Ix{[1 0 0 1 11 -2 roll exch neg exch neg]exch}! /,{true exch Ix imagemask}!/If{false exch Ix imagemask}!/I{exch Ix image}! /Ic{exch Ix false 3 colorimage}! /F{/Columns counttomark 3 add -2 roll/Rows exch/K -1/BlackIs1 true>> /CCITTFaxDecode filter}!/FX{<MFJ,O<^s8'LFs8W-!s8W-!s6BX\s8/ksoma*TrR0SFXjse\ V/.GdKV=2uA4jW~> , 2376 3752 36 66 /1O $C 0F`Iu"GRYps8W-!s8W-!s8W-!s8W-!s8W#4r.TS[3$d]54?`-~> , 2736 3752 47 66 /6H $C 4rV2j^$k=02W!9EmIhLRmIota[r1$6G3h;6pMSg#gUHS , 3105 3750 47 68 /1S $C +p5X`KH)0f"/%rk$+^GS=%Tu0%DDE&DuY=SDm6MCp"._I8sKQP&5k2(;NPk8L?q(X^A!'O6+mMG p](9FHGWki>?c5YV.$$jK*2lC$:0>q~> , 3473 3752 49 67 /6L $C +N#kR&:7Hms8W+h"](OP)=P=YrP%1dID>LQJ*lt0g[5$Mg])3j^>Jg9^\7PSmIpS4n*baQqq_~> , 3842 3750 47 68 /1W $C +p(%4T]$NVF:`>A@FB%WH?r<_V#L!V\ef^Arr:lW0X:Y]l`[93?X$0G[DX9A&/8_~> , 2059.18 5003.66 -32.38 0 S 1922 3835 6D , 1930 4971 1O , 11.9552 w 2026.8 3983.19 368.5 0 S 2395.3 4323.34 368.5 0 S 2763.81 4776.89 368.5 0 S 3132.31 5003.66 737.01 0 S [ 40.0169 20.0084 ] 0 d 4.98132 w 2395.3 3983.19 0 340.14 S [ 39.4394 19.7197 ] 0 d 2763.81 4323.34 0 453.55 S [ 41.2306 20.6153 ] 0 d 3132.31 4776.89 0 226.77 S 2746.37 3918.62 17.43 -48.82 17.43 48.82 -17.43 -19.53 f [ ] 0 d 9.96264 w 2026.8 4550.12 737.01 0 0 -651.03 S cleartomark end end pagesave restore showpage %%PageTrailer %%Trailer %%Pages: 1 %%EOF unuran-1.11.0/doc/figures/rou-cauchy.pdf0000644001357500135600000000623714420304141015021 00000000000000%PDF-1.3 %Çì¢ 6 0 obj <> stream xœ•–AŽ-5 E絊 a@Hb;q¦H,~ï ¥þuZ_€Ø=ÇIUõ£¡7¨—ª8¹¶¯¯ýžJ®©Äï|>¿ïÇ¿júúí(y––¾5ývÔ1%×™ji¹§·OkV<,Uñ,Ub]³²¶‘‹[zŽý%7å‹e·ÁÓ=÷–júŒuÏ­¦VkíËÂ%;o¤äÖ5WÖÚsŸqçÙXwËu ɳ¥†]_W ¼²$…†u°S4›$É6cnŽ‘ÌJƧ,áÌe ©0o Ž  f'\±nš¥¥N*ZÛUr©·NäbY\Ç+k¤ÂH®HêFÆtYØ 0¼é< âz@u'à“8[»§>‰'†…å™F‚Xó ÐÀQõ°¨wi¹6_e[¨r4¨Ô1eþ•‡RÓè#k_w¨‘ú4ɈHiXr…OÜâJm3wÎ-}¹¡8>“WR"`9ãol°tÇ e OÊÂ$\f–<"¶\"›®ÚC˜ ùw#¶-ÂÁžœ¬µed’äƒÍ^ÁM'rGX´>×™|pXVd‚çN,áë sšxÑûX0žDOBKòÙ@úÆL³¶¬‡êœšpÓuѶFº$ÍENdˆu–ÁšPz¬Éì›ð½oÚòŠÌòƶ£e;Ö“ ÊX|žŠá\¼-…Á  ÏZ¨-jjª¶N€†fR„e§¯[¨ˆI…„”L«œƒ{cger³p<¾4²1! ÄVýXWˆ¯ò`áÔÀÐvŸéPÅ{¿®ôŽÅç“ã> &!0bÜ^91/c<øÂg°íŠÌ ô'ä¹"7g+’Wl_šÜÁ‘͇ä,Áù¾Ne{éw‚{d3"u Ÿp?P¤ËÒë‹B½†„ØM1›`^ë‹„†ËЛ¦Qß”ÃMcÓÍê›çcÆC%^õ»R¬†ÞjI€@Ë«ÚB#¨¯jTÎnê.WEB8ÿ.h%b$\¯ÄÃÜA`©£.—fw²[S„; ¥ò¡:BK •¼tI"Ñeܺ%D’&ô!lÑn\ô–>€q¹ÝÒ@ܨ[<#{Ñ¿¨–[][„8Xêk4> /Contents 6 0 R >> endobj 3 0 obj << /Type /Pages /Kids [ 5 0 R ] /Count 1 >> endobj 1 0 obj <> endobj 4 0 obj <> endobj 9 0 obj <> endobj 8 0 obj <>stream xœcd`ab`ddäó tñ óÓvöõõ44‰Èýfü!ÃôC–yEÃÍ?üXWþ¨ún!øÝ˜ÿ»¾3#£›O´s~AeQfzF‰‚†³¦‚¡¥¥¹‚cnjQfrbž‚obIFjnb “£œŸœ™ZR©§à˜“£ÒQ¬”ZœZT–š±Ó9?· ´$µHÁ7?%µ(©´Œ!Œ!œèDv†ÝŒÿ}Cøþ3Ù”hXøCw!ã­ÓÓŽ3ÿtXtZÒºÂmÝëº-š½zÎú'º{9¦6uw4vµ×vÈÕW¸'vs”5ÎX³pú®Éë䧬Ÿº~Êú¾YS7öÏš°hêÆî‰sk§Ô´ve6ËU8Åÿv®ëjO¶vêæoܱáðò[K/ÈO_9af÷<ŽÙ"uÒ~«65NíîÚÓ;{‚Ü’G7lìæ˜2»+»¸!¯µF>M£Ì·;ŠCçBÑÁ³ëw,œ#Ç÷ŸñÉŽ7ß>=õøwñ—Ì?2~pˆ,œ]YT\XZ7¡uZƒÜ‚ò…Ýé‰~¿+sF”¬ÛxÙ•U÷ä&ÍÛ¬›ŠbóŠÛ­èæ˜<§;»¨± ¥R>þ7G]lwÇo†ÇÕ;¿Ûù~¿_éŸö /›6mÛïÄi쫸.sËq±˜Ïçá\2‘‡‡³àY endstream endobj 11 0 obj 514 endobj 12 0 obj <> endobj 13 0 obj <> endobj 10 0 obj <> endobj 2 0 obj <>endobj xref 0 14 0000000000 65535 f 0000001671 00000 n 0000002823 00000 n 0000001612 00000 n 0000001719 00000 n 0000001452 00000 n 0000000015 00000 n 0000001432 00000 n 0000001999 00000 n 0000001788 00000 n 0000002680 00000 n 0000002598 00000 n 0000002618 00000 n 0000002648 00000 n trailer << /Size 14 /Root 1 0 R /Info 2 0 R >> startxref 2873 %%EOF unuran-1.11.0/doc/figures/rou-cauchy.png0000644001357500135600000000454014420304141015027 00000000000000‰PNG  IHDRžñÞÂŽè pHYsÊ&ó?tEXtSoftwareESP Ghostscript 7.07¦¼ž§éIDATxœí=r#EÇŸ°……Àí¼1‘HÉÌ´TqïÖ)Ukn€BªH¬#àb#ª¶4«•<;rï´ ÌÆÖŒúãu÷›™ÿ/Ò®lM{~ý>ºg$õn©‰dÏæ“—D_ü–z ÙO=7Î/²§/S"¤€WãÑù ]¤Hhš=ÇãlvADóãÔ# L3£gD³ñ ïþ9O:˜4SÑô”ˆ(»ûÇÙUÊ¡„¤©z®&D4Q6›¥L8šªçø<£óùž)M&MÕs1{ò${q÷xFY[ç×Ìeé}æOé“o~H=Š045zî1=¥ï/³Ô£C ¢çÙEïç,;M=Œ ´@Qïç“ÔCD ’[›Ñ@h G4Ð#è ôˆzD=¢Ñ@h G4Ð#è ôˆzD=¢Ñ@h G4Ð#è ôˆzD=¢ÙÜ>âEê!uǧ}+ˆÑl}göXäGܾӥ¾-õãg¾þöóÇÿÙ§=ê÷D¾óüêÌô'·$솭TYnj~àó/+ŸÚÛï÷÷úücŠƒÈÙu}£”Ú0ÆÜyí÷÷šèH²µQªdz)E+:è÷?lX­•ªGmÔOÐlc³!ê4J‘D=ºP·š÷(EÔ?4%Ñ‰Ó£Š }µþ`Ð4!ˆdéQÅ[¦b³Órp ß =ÑÜüKQÈ7$EO™ÇusGQ,ÃøÇ5F„]ä¡ëM%E± Åv ôlŠ`}š:Ïûƒ¡Ì$—Z.Ö ’ÚC”Z E†PZ=ež' œ{äùÁ@^J©g“ þˆÍfýÑÇÂr\:=E^·„r‡{©GqŸTzr %ç1z½~"HP=BåQž ”Bd9D¢Å×S¼‘-‡ˆ(χ‡"š„Øz6×â‚­äÅPBWOùFT+]‡^ç‡é×A1õèëuÄ£y£—ùáAâ1DÔ“¯¤ì˜¢ƒOÓöÑô¨U3ŠÎÿ)n†‡)IOÃòÚèõÛ£„.Žž&4ÓU”‹„Mv =zÙ˜~m+yq4HtèzŠeÓZ‚‡èlp”&€‚ëizèÜQܤ  Ðzš:w$  °zô*úú1)n>‹ßÂêU{ìéÅ*ú1CFϪ¡kJÖ›£È÷‹„‹½h›"µˆœ‚EÊš»­F/˨›<¡ô¬ãçé8¬7£ˆ»¤a’›^¶Õ‘zqo7ˆ;EG%æ_"¹©E;–¢•,ÕQ¤#Г/ù_S¹zg ÿ(«öÛ!R¯â¼ã…]ϲ}«m”‹(~˜õèVmãÔç/åÕ£ãÌ),#øam Zß²ýŸ gôtÌNŒ•QOçìDð×ÜÚr]ÔŠ\‡½†Ê¦§‹ÑmeÐ*×kwÔNè”Τ§³vûáÑÓa;aý°èQ]¶ôÏçУ /ÒdŠ`~ôtp½ó`ÉÝ_ìP8?Þzt;D”‡¹Žâ«G/Úx¿”anWöÕ³ìЄz‚œ O=­xw!®uùéYwåÚ¨ !ª°—ž¢½7ºPò¯ÿ|ôt|³à1ü'ÄCîâžzrîdï¡ç5š¶G,™ï¿v×ÓÈOùÎkÞe ³ž¢·Ú¢3Ö—sÕS¢-ØŽbífõ`§­Öµ £žk´•¬Ë›ž8Ë“žZË“¬GëY³­9\ô`ų‹×\ó×ABáÙ…æÊþzPxvS0]³×³BOmSy¶ÖƒÔfSz³ÖƒÔfOz³ÕƒÔf Kz³ÔS"µ™¢9§–zÚÌáøò5;=ò¾îM2 sÙJK¼v‡ÒÿtY鹯^›¹÷¥=XòX¢ßø¾‚¤6[ ßZm¡ÇûXÄwF[èñŽÔ¢3ÛP‚ÇŸð1ÓƒàñÁcn›éAðøà>Fz<~¸Ïn#=?ÜÃÇDÆgKxâœ}Lô`ÃÀç­=ØmóÆyçÍ@Oàñæ­ãïèAcàkï»[Ï×ypì®vëAåá`ãvóóN=%ºjÜfùN=Ü,艄Ûòd—tÕ\8‰]z\vðåÒìЃƀ—ì¶C‚‡—™¾C>\šƒz= ;Œ8Ü£^¯•‡‡.¸^J+ö³½Vr/öÙ­Vr/öÙ­Vr3Öó½Nr7ÖÙ­Nr7ÖÙ­Nr;¶3¾FO‰ÜÆŽí¶h?ŒÑƒãG[žÔ=è `yR«õÀN,[ëj=Èm!Pv­uµ|DKn¬~ºRmfØÖJ=v–)vI©R‚' vŧRJO ¬ÒR•”žPXØ*=° =è BaU5ªô¼cØŠMø z¢c>zJ¼1!6—Ñ*ô 3Crƒžp0èAg ?ˆžøXŸªÖ€g `Þу ·xëAð„Ä¢°CO|¼k· ˜ŸÞízn¹¶a~zÑ$À¼7تÁ#èI€yo`ÿó "ˆžxÖ …­zp-N ˆÑ@hÜDƒè ôˆzD=¢Ñ@h G4Ð#è ôˆzD=â˜fÿ=†qŒ¾x>{ÿxŸæÓOÿB~yD¾üôkêXñÑYÍÓ_þ8NÆDD½Û«‡?ù6ß? 7´,>ÝO=+Þ­zOêžÿýo¢Éé õpÛ‡8žOÇ“Ó5kÚu‚gÇ¿Œè :7Ñ@h G4Ð#è ôˆzD=¢Ñ@@²¯zgD4ÿjŽMœ½ÈžÞMŸß"zäq5‰èòÉM Ç“lö‚ˆ.ÇÐ#ÍÆ¢« Ñ#“Ù„ˆ.é$ƒ‰\Nˆh~B3è‘Èñ”²óÙ8»Dc-‘ËçóÑéñý=¢ArÍ?ûQ/bÇ.IEND®B`‚unuran-1.11.0/doc/figures/Makefile.in0000644001357500135600000003144214430713360014320 00000000000000# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = doc/figures ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILECMD = @FILECMD@ GREP = @GREP@ HAVE_DIVIDE_BY_ZERO = @HAVE_DIVIDE_BY_ZERO@ HAVE_IEEE_COMPARISONS = @HAVE_IEEE_COMPARISONS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNURAN_LT_VERSION = @UNURAN_LT_VERSION@ UNURAN_SUPPORTS_GSL = @UNURAN_SUPPORTS_GSL@ UNURAN_SUPPORTS_PRNG = @UNURAN_SUPPORTS_PRNG@ UNURAN_SUPPORTS_RNGSTREAM = @UNURAN_SUPPORTS_RNGSTREAM@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ have_valgrind = @have_valgrind@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = \ texpict2img.pl \ discrete_inversion.eps discrete_inversion.pdf discrete_inversion.png discrete_inversion.txt \ inversion.eps inversion.pdf inversion.png inversion.txt \ rejection_from_constant_hat.eps rejection_from_constant_hat.pdf rejection_from_constant_hat.png rejection_from_constant_hat.txt \ rou-cauchy.eps rou-cauchy.pdf rou-cauchy.png rou-cauchy.txt # clean backup files CLEANFILES = \ *~ \ tmp-* # clean generated files MAINTAINERCLEANFILES = \ Makefile.in all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/figures/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign doc/figures/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ cscopelist-am ctags-am distclean distclean-generic \ distclean-libtool distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags-am uninstall uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: unuran-1.11.0/doc/figures/rejection_from_constant_hat.png0000644001357500135600000001457214420304141020530 00000000000000‰PNG  IHDRš÷pÍ pHYsÊ&ó?tEXtSoftwareESP Ghostscript 7.07¦¼ž§IDATxœí?lãX~Ç¿s8$X É[M`,¤Xa»¸-8H!U™)˜"@`t“†&–µ&ëUaÖ,Ž#¤´ XE°*fŠa€ðŠE -“n8¼ H.Ä)$Û’øH>’äÕ§XíXEû«÷Þï÷{¿ßï=» <Ânñ£õ£¶z’¬¥‰§Ýû8`-ÍÓvïã@‚µ4s„~»7r`—•4á¿w˜Ñ:ÆJšé1þæ0£uŒõ¨¹Å_\´éÏî ê=»íG½¶oæÀ&«QÓ{øÏÎð£ü—h‡ƒ4å Mg9HÓYÒt–ƒ4å Mg9HÓYÒt–ƒ4å Mg9HÓYÒt–ƒ4å Mg9HÓYÒt–ƒ4å Mg9HÓY~Üö T òà_ÿ@ï¸å{©gwÀ¼åûø!ò.»pæÇX}ßæø <^ÿåóÛå¯ÿã÷B¿•þëÃoÓßúÏ?yþIM·Å™r®2Ÿ¶.}zvÛoàn؈¸ìÍ­ëóÝ'üé|4/|.â% ¹º ŒÉ›ßc¹üþãbõd¯ßíARÝàxÿ¤1æoÌÛÞŸNWåY’(¾$«ŸÅ?…'Ž'š¹~MAu_}”æÅu£Ça³Ö… IÜ|ip•ÍÅÁ·‹è¾:yÒtÑB WÑÞC ãÔ™ÀP’—а¥ ˆ$aùÍ,ÀtjœŸó-Q ðˆó%Óé¢_s¼ZPü•9/ÎæÀÐþîZÙR&˜<þ<Þº‚ Ý¼6EDÖ •§éé¼ˆŽ¢M"uqÔŒŒãc@E@è8 h‰ñ‚X>ÞÿcìÂÜ~ZдÀuá8ýQœ(‰¯¾ý³ãfœ¨.®50¬ÑѯŽZI&_Ëb?ükyÛ åE_»1ptÉGW ö²×VòÖš.Nh¸z{„Ë·Ç‘ñ”¢ Î7•àÝM¾ˆ˜ßÙBõ—iÍ_­G U½vqBŽXVhŠ@}…¾·f0Ñ;‹"å…Š²á U}:ŠQCv@'G 8/ŒÊk“®ÌؽíÕG´c9 ¾Vº±ÌOÔÊM+úŽÀwšú;*?PCHžM‹ ñvíÅŽÕ”«)¯5²Òº£ÑÀ˜ƒÑ¨ÚeXé¤Ã„¯hKÌšñ2y_J©oˆ¿žG×Éé4êqSf£sùÐ8_uùópyÙÁþYh‘1ð!ݤ+Äï^¤>#\_X'û³ûÑ9iæ'ȵ—²ÈXÊrú»g²žþäðÍá êŠÓ“&2!†o2V™XÓW¼ÝIú³d¯N·¤ Öêï—J,Š™þ4±É˜âz>°8¥o°I:%ÍôÄÏ2€ í¬çE賌çɵG` öaRë’4ÆY3kÈúLÌTèt×sôFÄœOä¦^º#MxbAÈ0ÌZ ‰dÇò2ëäFC4°ŠÞ_ãtFšé‰á - ¶ d*€b Ÿf¿Â¼&0κ>©uÅå4,@ËXß9³T½j7ymO\NÕñšS†pÐíp&:q ¾ÉpW ø"Ë*Þ!>Íp=¦è¬ÓM-» ?ð¡ä-ﱜŸIâæi£Ü¨]öp: ?ð¡ÙùÊh”æ4ˆ'¸yƒLôDXjwö¥qN"ØyËLN ¹¦îHo!z"œîzŸ­Kc¨ ^îxç’ˆÑÓÃÐ+Èÿ¤« ®Û–Fµ@¼Ðݼ @ÑÆyfXl á £Ú´,ê@|“ãgòƒI†vœ+ LQGµi7£FuÀôG÷>WP¤ô]ŸÇA¯ð·#'ÂQ‘„¸VG «2 c LïR< êwpü0Š-J8ùî ¨ÅšmfãÜ—HZ»6jÿÝÕÕ»¨@Tµ=i¢%Ïyöm…O™Lò\O@l@›yx wYàcZ“f¥LîËb5¶3÷ÖrðD7Ü4 Ü€ÑLh¬ÊÈK¥@ ñÈ$?öV¿6Ç«ÜÑ"¶`KÒ0*ƒ­r€Rz¢ú¢'Ö«Íñj•1 ˜híHêŒH•Y…òýñºÞqÓ»¶Î¦ÖIX þ£iÎØ”Y¸"‡¿–h"¹Póœ6zÛs棷’G[q9Õ9“2®_–q5wQÈK†W‰ž«½úRÍ® ¾¡Q£:lÊÉ2ÁR°]FôÔÅlZFuÀFòâÆÅ˜ä;®¢GºOk^ÕK9³S– 23¬7ÝÒ¦¸4‘1¨’Òm°ÅÍ9N«{*…"æîHÍÅ¡ Kã¿ðG#ÿEÙûw,&eb=6+¹š»¦°QWö¤ K£ŽnÏÏoGiµy9ÌU,Êȹô‰\³„ Øð;²']TšÐ¿€+¿TѪ¹Sy·”úõ] ~7òl KÓ[Ù+#M8ˆàåïib¼(¾ßœèaÌ`Y˜ œ’s_ŠºœÇQx ŒJ$¥Fglep×’È)Ú1‹eastYÇ £pÎóYôª‡è¬÷ªøgø u+é± Ù';Üsž¯£Ã8‰ŠF¨>Xüù¡È@ýì³Ó¬ú¦,–ù®'éFX °4½·—Àe‘0݃-<œæÙ¸‹Ó¨2 7XžféÞC<‚öݛр󫫣ݱ 2¬ œ›l±v¼ ‚°¸ž¢Öëoš Ôø*“«¹”©Í³6‰×VV\.Ææ0…$áY©ëó£!iÂH~Šb5?éücµ;!^fýú=ІyË&t3Ò0šÍLIç½Â,f8…¼úõ5¦§Ýò›f¤1|˜ y1:Sàbõ •ÝËÉ«__ãˆ-›iHc8` ‰}Îb(@Ó`xQúvD‡%”؃Ê=Ô*ÐD™íôŒ1–•å÷ %§³",dßÖ× ªe¶¾Šdc¹J’Ô€2Lø-šõKE,ʸ_ä‡x¢Ÿæ‡4Óö¢ÐõKsÂd¨ WI:/CÀ°EX­U°×.1C}l ÇL1i~ØLa »j8¯-hP·4S R¾Ùç¸ã±„ˆ—±ñO^œ=¯+¢S³4¡ ’︬<çKý: š›žá ÿáûhÀõ¾¨Wšè,‚“k®<çKý:  Ó£Vÿª‡£WQ=Qƒz¥1|˜¹åÍø¸,ZyÎÑ# ÒvzT @oTcZkγã`ÈnršdÕ…xÃã³ûS•©sÔøSžæFIJi˜’E!ÝóÎfò‹Ìà‹o–F¿6dzú¨‰rͽU&¯˜|U§•V]šì錥—b·‰3Á«Õñ¬,Ítš5YN¿è6ߺrº66Am–@Ui"Bz«EwÒµÔæâ Í8½~ØëJâ¨*•µ³éêÄk·¾™ZÖŽô°¾$ŽŠÒÌ-(©;›Á˜éH”ÎcgÕ¯×7¥U“&RAR­³æÛÏq#žÈòÆY7vFýzV‡öìÙIiϧš4V2ïì‘ɾŸŽ‹Ééãnœ'º©[sš‹žj;?9zûn¤–5¯+5öO0L_æc·“Iç ¬Û¤ ¯~›^tœ¢OMµ}1º0UßѽÒZ› « _¥?KöU¬ þåãH!å@bJ»‡(¼€Q¯¤™PEÃÇEšæ6Ý€–#)»~Aš{cа(!èhÝ$¥l$§‚4¡³S°®·ÜK« _·­et)§ºž&5}Ôs ôK¶K« MF„fâÊá˲Ü%)×_¸í’ÁŒÓŽ>–4L)ñšKóQIiÊGž§sh)Ó™;f9¬æy`4’ ÅÄE°ùÛÊr¢¦l£_¸´Ü§Ëè¤ù¨l<¤´…½ˆ6,˜-fj¡ýæûíª.™Ú“øTIÈ »iÇVÌT\Rì­0ŒŽROÉ̳ÐJ+u: t8E\Í`ç± Ð×P®NCwa’"UéÊYv­IÐÄEÛÏ-w;Œ)ÎRÖD›€w˜³¬4Fj„†˜g&qç±Ã/­•˜ pïeWRÇ™¶Ðm?·žÓ»Ò+b§9r)ÎMÊI:èɳ’`dýÒM/ ¬tô—Ò› ”“&Õ¥ÑOKdèߨšý¦ÅÎ(ñø ùô Ö£‹Çt×3Ź)O)iR]Ý-•=C3i©6ˆ>«Œß*!¦ksÁ¹V­Œ4‘šÒ¾Ñu…ÆR›9¬Ç c@B±é5Ò¼³ ËH“æÒ¸:aiëØ9Š:VŠF×f˜ºsSŠÒø†4Çe*ÏùV¿Îw3º„4½I`pÞ½öslÜß5»£œR¿.(˜óË´-.5ÇuÚú´ƒí瘸¯–*,Oùš<‹ KY¿Ê6âë}𩘡ÈlLnè΃ˆ›%PX#*òíÚÌ÷ïß¿æÑGz]:‚ݰáÑo˜Y#LÄÆ©y¦{Èðf(IÊ›2¿Ï0Ð8¤>±&ÖFÉô&w²ŸûÍ)ˆåËè•x¬ï|IM92*Ö峎š¤ ð4*Ïù¬_—8w¥™; `ò4*Ïù`+ÁN÷âê–£4”½€ëëƒ2ØæÎ¤B*ï°ICÛ ÷4 &›ò•w˜¤‰v÷â§âÎp%ÞvoÌŠyLZƒîœßüÈÒmw,ËA¼ùW‘—VÅ ‹4sÊÖº¢)u­2Óc‹öŽÈ³e]ØÌ›0g±QáX5– ÍÚq’uWlôq6Ö­±²ÏШÑÄù¦ëIªe 2HãìäNº˜­‹oÛ»ÅÞ®_7…*–@¾4‘±X°ò<…x±XðmÈqÿ7©tGEm;[ Rí@¾4Ö¶ À'é<8•eù§¬ÅFLÜG&Z=&ÏÜÞ‘–ªÔäšáN]€¤½¬®Ìª"ÖEŽ‘‰¬¾¯í:Â6Ù:ÄþÆ«’—Ê5‰îM&‡¯å׫¿"W÷h]%µ¼M±ýç*TæšéÊãW;ætbO-]qb¬úåã_ì⛥ú®ÜUòF±™DËi t rë™½Ç #š^'š©¸_>ÎD+m äH³D#œ‡=êâP‘èÚ”O¯É–f;‰FDN®öº‡ ½Pgï=²±#]:½†*ÍÃÐVA­Î1éÜÓÚSÍaM<îH—N¯IJãž<[é(Sûæñ[].”–æQ^ë)Ô¶B¹PZBšã9DóþFð,>=l8— >½/ ±Q"½&!Í¥eÑÙq_ÖÁ³Xö ùb÷ø¸¼?X©T(-!Mÿ•õüä9^ÍkMœFÿô¼‡°ÀE‰¬´¤_3úðêêÝmï±M_<™¤ó†=¬ËCËTªÑ¢ýþ¬ÚÊÄxRIç #>$ª+ÅóÓSbh™g?ÔÊs><Ö¯ÏJK‘ƈ°žÎ܃2UP”å*DRŠÐti|ç¡Á¶Wýxø4öÍ:t¯ícG—f£Á6µŽô;÷ßlAÁ¼M•f:_õÅ^Rú|(ΪÁ…PlØP¥1V9±údªhÛe2™`ubtç†&â+±(Os²il2v %8 hŠ4Ñz×Y”öR»÷‰É—Ÿ}¦f…²Dè3Ý‹¦H³.ÙÐg‡ ãñ˜f-Ë¢=XíE³xR6 W%‡ #Áª4!Îl<´nkW¨À3)ÍÊp^>­ÊóYì<ÒQÌxR°¬#‘½¹6œ…káàÐ0ñqç1 ó›¥1b¼ðֆ3†‡ ¬éŽ«hqzW+„ Í•}ãþ;Liä›À-b@ïH:$n©Í? ®%„åè¾±®0 wÖ+‚ËqÚY¨(Þâ±iW&߸¢¢¸Î9S]ô¶4sÚ§òa¿¹ ¬GäZÖÙ뢷'4 äb Ÿ``¦ÊjûAÑ#zÀj@oIãÌq1vy•t‰±:[Ìt¾'–A´q>ØüÎMi" žd`±òØ;HÚ±|Îf@o®5V[ ´§§ÌC/EûEkJŒ¿¾Y8—‰sÖlH:$Tl}×M¾_?æxì ö—,-7&´ô³Ð÷žÏ×ñ „¿‚ãã×9_”Giæ~÷ç5ßS[ÜÈÚ‘nÁßÿ üÛ?g¿êQ ?úM«*jDXÀñhyÀá'ÿÃ`@?Hósü_Ñ3ÏÙääi€+olpŒåb¶“L?êw}MÊ*7þGö:};=åí·¥|­ß…â†Ò3ÀjÚoŽ©ÁÒåæOƒE±8÷Ô=Åõ5i(üÉ?þ$c¥‰;oKù:Ë¢á`âýì?ÃORž V£æßñ§OÕè âßýÿý¿ôçœÁ*6½5!ðÉßÖ´ðKêà¯ðññ§ñ«‚þKÚ×פ~àÖçQïqçmÔO “}m:?óîþ…ž1ØÿªŽF#àîîîîîîCÑ+¨™£Ûµ4w·á]]ÜÞë¿Å%úÿèã²Ð%[Ú×פ~àÖç%¸¶ß–ò t²¯Â‡~Úï| Œ^ÝÝÝ›ýV¿"?DR#5†=êý¸‡q¾¶Ð¦G‘Gý­¾cºdŸþ[_“ú[Ÿ— ×ßy[Ê'ÐɾvQîÿÏî8^ô@ÇW™Ï>9ý@SFMkø½ìYü Mgù ºçU>¨³IEND®B`‚unuran-1.11.0/doc/figures/Makefile.am0000644001357500135600000000105014420445767014313 00000000000000## Process this file with automake to produce Makefile.in EXTRA_DIST = \ texpict2img.pl \ discrete_inversion.eps discrete_inversion.pdf discrete_inversion.png discrete_inversion.txt \ inversion.eps inversion.pdf inversion.png inversion.txt \ rejection_from_constant_hat.eps rejection_from_constant_hat.pdf rejection_from_constant_hat.png rejection_from_constant_hat.txt \ rou-cauchy.eps rou-cauchy.pdf rou-cauchy.png rou-cauchy.txt # clean backup files CLEANFILES = \ *~ \ tmp-* # clean generated files MAINTAINERCLEANFILES = \ Makefile.in unuran-1.11.0/doc/figures/discrete_inversion.png0000644001357500135600000000403214420304141016642 00000000000000‰PNG  IHDR½ð‘G} pHYsÊ&ó?tEXtSoftwareESP Ghostscript 7.07¦¼ž§£IDATxœíݱŽãTÅñs£Ù„SA·Ê@ çÑÒ8û+Ï”H4™GH„D?nhQüã}U¬m]Ül„Ä¥ÈìàeÖ}±}ÆçW0ÒìàÜä?vìkãK˶G"çêöZ.¿úóm’´>y¬ºu/¿y¶Õ~ ºzá tÈ@ ®Þäá?ÒoõG ÂAõ˜©3Õc¦zÌT™ê1;Ô+¦CN22çæy×ãS\‘\×ãSè}™ê1S=f] K›ÞžÄ\…~ìH½ì°S{¹àÓñóo]à˜†×¥©wuc7’þêm¼¦ŽÔGí£#[ò§©½fªÇìP¯lú6)½2àÜc7ëz(òhxòÇO˜Þ÷˜ ºÞ¶ÙŒF z¦Œühoàë=Õc6èz3ö B]/cŸ£t=zªÇLõ˜©3Õc¦zÌTÙ ëi–š™f©¥CªÇlÐõ4KÍL³ÔÒ!Õc¦zÌT™ê1S=fªÇlÐóœôÀ¡u™ê1S=fƒ®çØ?¯gÐõè©3Õc¦zÌT™ê1c›)+ô‘ªlõ~ÄÍ ›bÛrþd¹°ˆýr\¶uï“/íØ-ªlõž=g__,±m9¥Jõ˜©3Õc¦zÌØö9·] W´î1S=fªÇŒ­ÞlÙõú„­žT©3Õc¦zÌT™ê1S=flóœñ¤ëô [½¤ëôжœÌT[½¥®¥®`{ßc¿'£-¶uOªT™ê1S=fªÇLõ˜±Õ 5ÏYÁv¼·êz½Â¶îI•ê1c«·a¿1œ)¶z©êU°Õ“*Õc¦zÌT™ê1S=fªÇŒmžSw¨:R/síãè?~ƶœÌެ{W=½‰i®?[¯:Ro¬û(2Ж“™ê1S=fªÇLõ˜©3Õc¦zÌT™ê1S=fªÇLõ˜©3Õc¦zÌT™ê1S=fªÇLõ˜©3Õc¦zÌT™ê1S=fªÇLõ˜©3Õc¦zÌT™ê1S=fªÇLõ˜©3Õc¦zÌT™ê1S=fmÜŸ³¿w‹d׺§Oi>›Ö½b|e¶¬ý+³E=ml9¯ìnGœÍÌõh¯…™ê1S=fªÇLõ˜µ°Ï©Oi>›ê%爡Җ“™ê1k¡^‘Ÿÿ1ªYj}ú̹hËÉLõ˜©3Õc¦zÌT™ê1kcž³<ÿc ”Î10Ó–“™ê1Ó<'3c`¦-'3Õc¦zÌT™ê1S=fš)c¦«q™iËÉLõ˜i¦Œ™f©™iËÉLõ˜©3Õc¦zÌT™ê1ÓÕ¸ÌtŽ™¶œÌT™æ9™é3m9™©3Õc¦zÌT™ê1ÓL3]ËL[NfªÇL3eÌ4KÍL[NfªÇLõ˜©3Õcvd®eŸÙ=Ä›¿ì–%ï9Rï•åç»Ú}h°¼¯-çËc˜Ž¬{Ï_>Æ·†Ë’ª#õ¾\µ; 9‰ö9™©3Õc¦zÌT™ê1S=fªÇLõ˜©3ªzéá‹®Q{‡«^×E×ãè ªzñì5°Ìâ®ÇÑ#åõØÍ~¡c|Ü(Þƒ€9ö>œž-ßÒî<}üvØÕs†×dÎnY_²°)ÖÀ"¹6|ôs‰ñ7&a×£èM Ê Ï%šèʪFÀ»j›NÒLl¹áä7Ê"ŠÃ¨ŸëOqåòk„‡£ßÊnË›ßÛQ#á§_w=„>XazySððÞ?|ñÞ{¯ßoáö·þýþ¿|÷E'’fþøñuG‘ópÑ@qßv=&i(ŸEQàˆÅýW!PìÊ–Ú§߿ˀ$_–(Ó$øÿÿCúÇy ½É.´êñq¾ëÈé¨Îïɨ3ÕcVWÏø\{1µZR>wvËæÎMS£…@fõ‰=ó´D±lô<ý‡¢ÄûU°«ù—ÇÛaÝcœâ.ºó»Ðh`ëxç÷ Ö& óÞûýÄjI€E£Ÿüð[ë‰÷Þ/"«ÁÔ=ÆI’½÷þ‰É‚À{¿G`²0ïýnaõ4=˜4ŠçkŽæå@6ÛZMY•¸ð€ ö ›e€ƒÕÓæÚlQÍ_¯š÷½Þžk¿¿ Åæíeëäf×Y\mSS¯·çÚïîä0|nB³»+XÖË/ݬѫ_·Ïùá¹öIÍV—érl&wKÓóÙÙfM615ÛØû÷»·ËÙ¸ò2^Û-l­{yhøze€i“¡Õ՛쳽ƒúÇ8Ù²°<‡œO&ù6‰åo;à»ÿPÝ–sôõlí¦4½ „Éáú9öŠ&o\5õz|®=-Ö Ÿ×GM3@&ËJ¯s€s&×ü_Ž÷®2:®¦^ϵÁ °Y]J›jY²½ßZ,í°û6Ù9«©g}®½4:BC>9禓W|‘À–÷c3ÚI_9P‹&?[3ÿrá­Õ´ÀdÚí¾Zh±,ï–ÏòþyÚÌ.Þ†’F³¹:·ÎLç÷˜©³Ñ `OXV1IEND®B`‚unuran-1.11.0/doc/figures/rejection_from_constant_hat.eps0000644001357500135600000002417214420304141020530 00000000000000%!PS-Adobe-3.0 %%Pages: (atend) %%BoundingBox: 208 385 405 504 %%HiResBoundingBox: 208.322132 385.778133 404.324478 503.118850 %......................................... %%Creator: ESP Ghostscript 707 (pswrite) %%CreationDate: 2004/03/17 09:32:10 %%DocumentData: Clean7Bit %%LanguageLevel: 2 %%EndComments %%BeginProlog % This copyright applies to everything between here and the %%EndProlog: % Copyright 2003 artofcode LLC and Easy Software Products, all rights reserved. %%BeginResource: procset GS_pswrite_2_0_1001 /GS_pswrite_2_0_1001 80 dict dup begin /PageSize 2 array def/setpagesize{ PageSize aload pop 3 index eq exch 4 index eq and{ pop pop pop}{ PageSize dup 1 5 -1 roll put 0 4 -1 roll put dup null eq {false} {dup where} ifelse{ exch get exec} { pop/setpagedevice where { pop 1 dict dup /PageSize PageSize put setpagedevice} { /setpage where{ pop PageSize aload pop pageparams 3 {exch pop} repeat setpage}if}ifelse}ifelse}ifelse} bind def /!{bind def}bind def/#{load def}!/N/counttomark # /rG{3{3 -1 roll 255 div}repeat setrgbcolor}!/G{255 div setgray}!/K{0 G}! /r6{dup 3 -1 roll rG}!/r5{dup 3 1 roll rG}!/r3{dup rG}! /w/setlinewidth #/J/setlinecap # /j/setlinejoin #/M/setmiterlimit #/d/setdash #/i/setflat # /m/moveto #/l/lineto #/c/rcurveto # /p{N 2 idiv{N -2 roll rlineto}repeat}! /P{N 0 gt{N -2 roll moveto p}if}! /h{p closepath}!/H{P closepath}! /lx{0 rlineto}!/ly{0 exch rlineto}!/v{0 0 6 2 roll c}!/y{2 copy c}! /re{4 -2 roll m exch dup lx exch ly neg lx h}! /^{3 index neg 3 index neg}! /f{P fill}!/f*{P eofill}!/s{H stroke}!/S{P stroke}! /q/gsave #/Q/grestore #/rf{re fill}! /Y{P clip newpath}!/Y*{P eoclip newpath}!/rY{re Y}! /|={pop exch 4 1 roll 1 array astore cvx 3 array astore cvx exch 1 index def exec}! /|{exch string readstring |=}! /+{dup type/nametype eq{2 index 7 add -3 bitshift 2 index mul}if}! /@/currentfile #/${+ @ |}! /B{{2 copy string{readstring pop}aload pop 4 array astore cvx 3 1 roll}repeat pop pop true}! /Ix{[1 0 0 1 11 -2 roll exch neg exch neg]exch}! /,{true exch Ix imagemask}!/If{false exch Ix imagemask}!/I{exch Ix image}! /Ic{exch Ix false 3 colorimage}! /F{/Columns counttomark 3 add -2 roll/Rows exch/K -1/BlackIs1 true>> /CCITTFaxDecode filter}!/FX{< 0 1 2 3 4 5 unuran-1.11.0/doc/figures/rou-cauchy.txt0000644001357500135600000000407514420304141015065 00000000000000 ^ v | | +---------------------------*-***********-*---------------------------+ | *****.......|.......***** | | ****............|............**** | | **................|................** | | **...................|...................** | | *.....................|.....................* | | *.......................|.......................* | | *........................|.........................* | | *..........................|..........................* | | *...........................|...........................* | | *............................|............................* | | *.............................|.............................* | | *..............................|..............................* | | *...............................|...............................* | | *...............................|................................* | | *................................|................................* | | *................................|................................* | |*.................................|.................................*| |*.................................|.................................*| *..................................|..................................* *..................................|..................................* *..................................|..................................* ---*----------------------------------+----------------------------------*--> u unuran-1.11.0/doc/figures/inversion.pdf0000644001357500135600000000754114420304141014755 00000000000000%PDF-1.3 %Çì¢ 6 0 obj <> stream xœ•—½Ž]» …ûý*oŠ(¢D‰R MºÏ8¸AOaH·Ï·¸Ïœxœ"0àcr“âÏZ¤äï¥U+M¿__¯ï×þâåoÿ¼N=«//ÿ¾¬üý²¾«óSwy½l¶:§—Þ{m}[£Z;¥ÏSãôò¯ËÂë\£ôãµû*¶gíeôY›ãq¢n;eàa6Ë׫·Sûö2N«}nÎnµµ^Üvma¥^g?Å}×w,¢x¬zä1½³‘U¬ÒWÔ>;Yí#Ø5F/s’Í,}Ÿêƒˆz¡›Õã§,8Š0lT’_$}|“¼WãÃòU}Œ2ƪ ÿµ6 „Hε¶Bâ1ùÒ£DÛGùau¬S‚vÎ[±z Î\”?êZ³Ä"–[ñ¶(ìóëåD]%Ù,Mó²–ǤA-ËÝÃjÃÙë ï­¼‚ËgÙ«eó=&z<í,“ÇŽj£ìMúcZ¤{hP'Éi`Þ‡«mf·º)Œbk_t´€gêõ2ê÷8~;Ì•®ÄÑ#ktH¡fœºóPw U1½s’87Ù„’¤lú(‘ÌnkŒêü­mC¾FvÀ¾ÀkOyÀð\й¹ˆl2¼'9ÄVƒyêòUpbº²„3 uWQb'ŽƒHe;ÄReÉ*$¥V¸ƒ¡0ºòúéÔÏŽ£Šp°Z*†½}\žê'&KYNív,è`ŠG}1§¶ké&\_æÝŸF1-Ë•’w¿ûÈ®ñ;·iSš •Æy–†V²:<*Cø½lBƒP–+‡Ê&`ÍqËÒO”}\KÉɃ£|ßmˆž\ÕeJ®s¯»\y-¡`äÑÒÚÒ4dQìV",Ê>"çÉBH:Õª–åã&$²/žmŒvoq[„^JR›BÜâIHäÐ ,Òìcpdˆ`uj¤¥ÑH÷xÛ·¬z…¬›‰=ËÈÝÆ­ƒtǹe#ô²É˜~ߊî·Fë[ô¼EüâøÝF¶Y"±Y>o?›(»Æ5ÁØýçúrá·!6®^þüãƒK»è<ÄoÛcqóNÄâ°ó5“7ƒ¥u9R¡¶ùÓà·«}óƒÍ—Ÿ¥rKÌQçbÈ\˜ü-V ‚Ù›Á³’Û4Øñ´øö´ |ÿ+›lh›”'CÃ×wÍîykÊjCÁÐÃàiõÔ|°bsnÍú»ÕSóÑÊÙ"ƻ՛æ£ÕœïVošVß¹ò™ýøùúZþøÂsñí±ýòÛu¿Ä¡{…ù‹Íëæåõú¥ýîå—öt˜¬^þzýb©‚£ó©êŸUã³£¶šRýé¥üÊÈñ„Ô}ÓwçëuDÓ\ó·æÿ¯ç÷ºšö\Îͳž¦[ œŸÕÜäM§AaºØ»‰NäÍôFp½4´»ßÞ-Ø bÕƒCy;®§<4?ó‚õ;oÍg졦þˆ=òÝû1öÓâSìÅóÿ(|8åMó3¯/ׯüù/ƒ ›endstream endobj 7 0 obj 1570 endobj 5 0 obj <> /Contents 6 0 R >> endobj 3 0 obj << /Type /Pages /Kids [ 5 0 R ] /Count 1 >> endobj 1 0 obj <> endobj 4 0 obj <> endobj 9 0 obj <> endobj 8 0 obj <>stream xœ’}LSgÆßKáÞ+ Njenî¶É–Mçæ¨€¦²¥|l€šM±ƒJ+…¶|´¬`(¶#·=¡ 8t£¡TŠ˜+–1H ²EÈ2IÐàÔ1øƒ,hF6À°½/Év!Ï_ç$çyÎùå(< ±]“ž™õù'Ò5yÊøÍÿNð{Ãø7$½Õ¼i]Ñÿòp,NÛ‰“và÷_A‚ÈÈ>^Qé°––íŠ}éûJ•êˆ"Õb°–ëÊÝh°èìbaVäW—쎃ŠT³Y‘·9aSälkA¿™^a©¬¶¬ M…Þ`-G‘ñÊC ‰IíD±HŠv!Ú(qYD!ºO$ÃÃþ#4'ÇðlupýÕ ó¸m^ÂáÌ6Íi—T:È…´ª³MMA2¤\V©‡ÎÔŽÂ8<îùóöô•§ð-”32=9–œ“ð &à˜jïÄQ¿^ AL9:÷}•jÈÈtf׿—gùh18~ 8î‘ÿ°¾KÖ ÍvF“& ÍT@´ë¡7¾¡JØ%c2“ý¾øNÔô³4g¢”lû |Óè ^[[áXÃ…‹þ$N“YÉ&‹»°±Þí:Õ@ Yä?/pªJ>õá \8!”9àÛž"7™õ>Ä4~ëŽ\ù9 8üð*N~¦~'Æk²¹›÷ˆdæ~:ð¶:W]<‹ oÝ9õ 7:u}è¡«• žO« å–‚RÖêuym7¸¼n/4ÒÒ §³üÌ97˜¹_Ø›Q^X”âŸ0Êû›¸ |KTÊm¦‹…ñÏaÇ,.®Îå<}³‹ÙbŠ_ãx] w>ùøaœt¥«d¸3‘,ñ8S™39äƒïEÝ…!‘a •êi/,SÒçÜ;|½¥î .F˜Ü(À¡ÝKb–ß±u8û çqÜ|,ü]ÀáóÄIÿyke8Jµ, ‚¢:c ƒ?£_ö¹ow> endobj 13 0 obj <> endobj 10 0 obj <> endobj 2 0 obj <>endobj xref 0 14 0000000000 65535 f 0000001894 00000 n 0000003529 00000 n 0000001835 00000 n 0000001942 00000 n 0000001675 00000 n 0000000015 00000 n 0000001655 00000 n 0000002246 00000 n 0000002011 00000 n 0000003373 00000 n 0000003291 00000 n 0000003311 00000 n 0000003341 00000 n trailer << /Size 14 /Root 1 0 R /Info 2 0 R >> startxref 3579 %%EOF unuran-1.11.0/doc/figures/inversion.eps0000644001357500135600000001350114420304141014764 00000000000000%!PS-Adobe-3.0 %%Pages: (atend) %%BoundingBox: 201 372 401 512 %%HiResBoundingBox: 201.023994 372.113989 400.935495 511.710049 %......................................... %%Creator: ESP Ghostscript 707 (pswrite) %%CreationDate: 2004/03/16 20:27:37 %%DocumentData: Clean7Bit %%LanguageLevel: 2 %%EndComments %%BeginProlog % This copyright applies to everything between here and the %%EndProlog: % Copyright 2003 artofcode LLC and Easy Software Products, all rights reserved. %%BeginResource: procset GS_pswrite_2_0_1001 /GS_pswrite_2_0_1001 80 dict dup begin /PageSize 2 array def/setpagesize{ PageSize aload pop 3 index eq exch 4 index eq and{ pop pop pop}{ PageSize dup 1 5 -1 roll put 0 4 -1 roll put dup null eq {false} {dup where} ifelse{ exch get exec} { pop/setpagedevice where { pop 1 dict dup /PageSize PageSize put setpagedevice} { /setpage where{ pop PageSize aload pop pageparams 3 {exch pop} repeat setpage}if}ifelse}ifelse}ifelse} bind def /!{bind def}bind def/#{load def}!/N/counttomark # /rG{3{3 -1 roll 255 div}repeat setrgbcolor}!/G{255 div setgray}!/K{0 G}! /r6{dup 3 -1 roll rG}!/r5{dup 3 1 roll rG}!/r3{dup rG}! /w/setlinewidth #/J/setlinecap # /j/setlinejoin #/M/setmiterlimit #/d/setdash #/i/setflat # /m/moveto #/l/lineto #/c/rcurveto # /p{N 2 idiv{N -2 roll rlineto}repeat}! /P{N 0 gt{N -2 roll moveto p}if}! /h{p closepath}!/H{P closepath}! /lx{0 rlineto}!/ly{0 exch rlineto}!/v{0 0 6 2 roll c}!/y{2 copy c}! /re{4 -2 roll m exch dup lx exch ly neg lx h}! /^{3 index neg 3 index neg}! /f{P fill}!/f*{P eofill}!/s{H stroke}!/S{P stroke}! /q/gsave #/Q/grestore #/rf{re fill}! /Y{P clip newpath}!/Y*{P eoclip newpath}!/rY{re Y}! /|={pop exch 4 1 roll 1 array astore cvx 3 array astore cvx exch 1 index def exec}! /|{exch string readstring |=}! /+{dup type/nametype eq{2 index 7 add -3 bitshift 2 index mul}if}! /@/currentfile #/${+ @ |}! /B{{2 copy string{readstring pop}aload pop 4 array astore cvx 3 1 roll}repeat pop pop true}! /Ix{[1 0 0 1 11 -2 roll exch neg exch neg]exch}! /,{true exch Ix imagemask}!/If{false exch Ix imagemask}!/I{exch Ix image}! /Ic{exch Ix false 3 colorimage}! /F{/Columns counttomark 3 add -2 roll/Rows exch/K -1/BlackIs1 true>> /CCITTFaxDecode filter}!/FX{<MFJ,O<^s8'LFs8W-!s8W-!s6BX\s8/ksoma*TrR0SFXjse\ V/.GdKV=2uA4jW~> , 2460 3723 36 66 /1Q $C 0F`Iu"GRYps8W-!s8W-!s8W-!s8W-!s8W#4r.TS[3$d]54?`-~> , 2792 3723 47 66 /6J $C 4rV2j^$k=02W!9EmIhLRmIota[r1$6G3h;6pMSg#gUHS , 3131 3721 47 68 /1U $C +p5X`KH)0f"/%rk$+^GS=%Tu0%DDE&DuY=SDm6MCp"._I8sKQP&5k2(;NPk8L?q(X^A!'O6+mMG p](9FHGWki>?c5YV.$$jK*2lC$:0>q~> , 3472 3723 49 67 /6N $C +N#kR&:7Hms8W+h"](OP)=P=YrP%1dID>LQJ*lt0g[5$Mg])3j^>Jg9^\7PSmIpS4n*baQqq_~> , 3812 3721 47 68 /1Y $C +p(%4T]$NVF:`>A@FB%WH?r<_V#L!V\ef^Arr:lW0X:Y]l`[93?X$0G[DX9A&/8_~> , 2170.78 5003.66 -64.76 0 S 2004 3835 6F , 2012 4971 1Q , 3144.95 3904.67 12.45 -34.87 12.45 34.87 -12.45 -13.95 f 2138.4 4946.96 1019.01 0 0 -1056.24 S 2299.7 3904.67 12.45 -34.87 12.45 34.87 -12.45 -13.95 f 2138.4 4323.34 173.75 0 0 -432.61 S cleartomark end end pagesave restore showpage %%PageTrailer %%Trailer %%Pages: 1 %%EOF unuran-1.11.0/doc/figures/rejection_from_constant_hat.txt0000644001357500135600000000421214420304141020551 00000000000000 ^ | +------------------------------**+***------------------------------+ | o****./.\..**** o | | **..../...\.....** | | **...../.....\......** | | **...../.........\......** | | *....../...........\.......* o | | o *....../..............\......* | | **...../......X..........\......** | | *....../...................\.......* o | | *....../......................\......* | | *...../.........................\......* | | *..X../...........................\......* | | *...../..................X...........\.....* | | *..../.................................\.....* | | *..../.................................X..\....* o | | *..../........X.............................\....* | | *.../.................................X.......\....* | | *.../............................................\...* | | *.../....................................X.........\...* | | *../...........................X.....................\...* | | *./............X.......................................\..* | | o *./......................................................\.* | | */.........................................................\.* | | */.....................................................X......\* | |*/......................................X.......................\*| *---------------+---+--+-------+----++---+----++-+-------+---------*----> unuran-1.11.0/doc/figures/rou-cauchy.eps0000644001357500135600000001231014420304141015024 00000000000000%!PS-Adobe-3.0 %%Pages: (atend) %%BoundingBox: 208 387 407 503 %%HiResBoundingBox: 208.736172 387.827988 406.943988 502.631985 %......................................... %%Creator: ESP Ghostscript 707 (pswrite) %%CreationDate: 2004/03/17 11:35:01 %%DocumentData: Clean7Bit %%LanguageLevel: 2 %%EndComments %%BeginProlog % This copyright applies to everything between here and the %%EndProlog: % Copyright 2003 artofcode LLC and Easy Software Products, all rights reserved. %%BeginResource: procset GS_pswrite_2_0_1001 /GS_pswrite_2_0_1001 80 dict dup begin /PageSize 2 array def/setpagesize{ PageSize aload pop 3 index eq exch 4 index eq and{ pop pop pop}{ PageSize dup 1 5 -1 roll put 0 4 -1 roll put dup null eq {false} {dup where} ifelse{ exch get exec} { pop/setpagedevice where { pop 1 dict dup /PageSize PageSize put setpagedevice} { /setpage where{ pop PageSize aload pop pageparams 3 {exch pop} repeat setpage}if}ifelse}ifelse}ifelse} bind def /!{bind def}bind def/#{load def}!/N/counttomark # /rG{3{3 -1 roll 255 div}repeat setrgbcolor}!/G{255 div setgray}!/K{0 G}! /r6{dup 3 -1 roll rG}!/r5{dup 3 1 roll rG}!/r3{dup rG}! /w/setlinewidth #/J/setlinecap # /j/setlinejoin #/M/setmiterlimit #/d/setdash #/i/setflat # /m/moveto #/l/lineto #/c/rcurveto # /p{N 2 idiv{N -2 roll rlineto}repeat}! /P{N 0 gt{N -2 roll moveto p}if}! /h{p closepath}!/H{P closepath}! /lx{0 rlineto}!/ly{0 exch rlineto}!/v{0 0 6 2 roll c}!/y{2 copy c}! /re{4 -2 roll m exch dup lx exch ly neg lx h}! /^{3 index neg 3 index neg}! /f{P fill}!/f*{P eofill}!/s{H stroke}!/S{P stroke}! /q/gsave #/Q/grestore #/rf{re fill}! /Y{P clip newpath}!/Y*{P eoclip newpath}!/rY{re Y}! /|={pop exch 4 1 roll 1 array astore cvx 3 array astore cvx exch 1 index def exec}! /|{exch string readstring |=}! /+{dup type/nametype eq{2 index 7 add -3 bitshift 2 index mul}if}! /@/currentfile #/${+ @ |}! /B{{2 copy string{readstring pop}aload pop 4 array astore cvx 3 1 roll}repeat pop pop true}! /Ix{[1 0 0 1 11 -2 roll exch neg exch neg]exch}! /,{true exch Ix imagemask}!/If{false exch Ix imagemask}!/I{exch Ix image}! /Ic{exch Ix false 3 colorimage}! /F{/Columns counttomark 3 add -2 roll/Rows exch/K -1/BlackIs1 true>> /CCITTFaxDecode filter}!/FX{<K5!89]t1YUVE=7shtQ%%s8RGZhr2?-GPh8eGPCjFn"9VtrpKfps1Sg(de~> , 3035.25 4968.2 -12.45 34.87 -12.45 -34.87 12.45 13.95 f 3022.8 3982.6 0 999.54 S 2942 4981 50 45 /1Q $C .KtD6&MFWUDNfBaXm*F3^Ae$,n%8%8n%[]9J+%`6hqcWY\,H("[\*#j^A?]glJ6=SBf0@k(em6~> , cleartomark end end pagesave restore showpage %%PageTrailer %%Trailer %%Pages: 1 %%EOF unuran-1.11.0/doc/figures/discrete_inversion.txt0000644001357500135600000000267314420304141016706 00000000000000 ^ | 1 + ======================= | . | . | . | ===========. | . | . +---------------------+ | | | | | ===========| | . | | . | | . | | . | +==========. | | V +----------+----------+----------+----------+----------+----> 0 1 2 3 4 5 unuran-1.11.0/doc/figures/discrete_inversion.pdf0000644001357500135600000000541014420304141016630 00000000000000%PDF-1.3 %Çì¢ 6 0 obj <> stream xœ•T=oÜ0 Ýõ+4& Ë}q-Ð¥[rÞ‚N R´8‡ùû¡lKÖÙíP8ƒÔ3ùžy7@ë³½_gws_žƒÿùÇÐBÂþñÿîÈÿr„ Š'Rû-R`Ý«»8F-=a ÙL"s‡4€0p”š bH±ÞÖVwmŽ˜ËJç@e‰Øê*-˜zR{0’2`4Œc™BG\;"$ ù›#æâBŽ (Ñãheóʸ‚¹cz<`ˆM§ÐÞ©Å#&„2`Z> /Contents 6 0 R >> endobj 3 0 obj << /Type /Pages /Kids [ 5 0 R ] /Count 1 >> endobj 1 0 obj <> endobj 4 0 obj <> endobj 9 0 obj <> endobj 8 0 obj <>stream xœ’}LSgÆßËǽW@œÔÊÜÜm“-›ÎÍQMeKùXPš±ƒ •B?€¶€ Åvä¶'TWÝh(•"æJ€e ’ƒl²L48u þ š‘ 0lïÅK²]Èó×9Éyžs~9ŠCAlÏÏÊÈ*È:¡ÎS$l6þM‚߯¿Þ[ÃÖ•‘ý¯Çáô8yþð5N™Ùg2*«ì–ò2½M¾/c¿\¡T‘§™t–ò­Y®ÖÚô:“Ö&Fy~eI¹Îf?(O3åy›VyžÎª³ÔêJ·"3*MU56E®®,ÕYÌ!2Aq(1)¡(IÐ.$E»%.‹(äDˆâIXRØÂ„úôÉXž­ ®¿$`·Ï‡óÅxF ³Í³úÇš%e‡r!½úÜACfó'©WCªá£3u£0OºFþ¼3}õüF eÂŒ´N†ìKŽIxð Lµwâè_¯… ¦ìû¾Êä@*sd7|gúh18~ 8þq8þa}—´ZlŒ:; @©€h5ÖCo|C•± Æ`$û½ ð¨ègiÎ@)Xß lÓè)^[[áXÃE‹áüiœ.µÍ&WQSƒËyj€Ž“ÿ¼Ä ˜™‡å=˜TÌ ±BdÚG‡òï‚×ß}¨ÇÞ£wºÁÃ27ŒÞzqø¨2¥àãSj™pJ¨p8À Ö=ýôQ¼d¥+¥¸3‰,s;Ò˜Z#9äƒïE݃!‘a-•æö È–)É î=¾P„ÞZ™…F'#Ln”GâÐn%1Ëo‹Ü:‡ý…s‚8~>þ.äð…?â%ÿм5R­\Paq½¾ŒÁŸS/û\w€Æ;.Þhe¯º ûü¡îî‹¡ŠKz—&yú}éÕ%,‘ÅŠ­ ·üØì#…s×).j:š‰Š8ˆÙ¼3ˆÙŽÐÿêh¾K endstream endobj 11 0 obj 959 endobj 12 0 obj <> endobj 13 0 obj <> endobj 10 0 obj <> endobj 2 0 obj <>endobj xref 0 14 0000000000 65535 f 0000000782 00000 n 0000002416 00000 n 0000000723 00000 n 0000000830 00000 n 0000000563 00000 n 0000000015 00000 n 0000000544 00000 n 0000001134 00000 n 0000000899 00000 n 0000002260 00000 n 0000002178 00000 n 0000002198 00000 n 0000002228 00000 n trailer << /Size 14 /Root 1 0 R /Info 2 0 R >> startxref 2466 %%EOF unuran-1.11.0/doc/figures/inversion.png0000644001357500135600000000622614420304141014767 00000000000000‰PNG  IHDR #QyŠó pHYsÊ&ó?tEXtSoftwareESP Ghostscript 7.07¦¼ž§ IDATxœí½nãʆ_n¸UR$àâ\@@_A@U§IC©©M Hº4æ%hˆY¦ <—àÙ\À9žv«xŠ,’)${½¶(þÌ)½°ë]Ëôèûæ›QIƒ6÷­7‘`\µÞ¢¤ ØÒB» °¤…¤5Å}0éSÈž£´FPm~fê=!Gi$øßJ†ì 9J› £ÿ„6AûBŽÐAw‡?$.×-ßO_þ"Qi/³É$  ‰CA‡‚&M š84q®è›Ø½ ­\É$Yrãgº\ Äîi…cÐÄ¡ ‰CA‡‚&Î1A2I’$Y I’$I¸­•¤Á»“#FÀ§Íþ\\Î]¡±h½ÿúüÙ¡6‡‰Mû¡ÄŽ :´ºèñëx~¾%ýõÝôx†ÛvTI;òðG›Þ*²ìðüå[E¿;£ È}tœ‘ H³¯ÿî­¡k†ãÌ;$Œ‚Ñm1’eØÇC–áU„8ç €(xRŒ‚2PPïœå)Òl¯ÂŸŽ÷\÷¨Î mž«® ¤P8ÈT£¹ð1HBB½Xò4ͧ¥¼æRI£´ù&‘È‘eiÞú+q¸8AZK£_›)Ò,Í'.G8%èÌy>þôåó§—ÿfYŽ<¬˜gN ZëEXŠ,™§E}'•VÏ3™4ÿé× Y#;àœÇ ¥Ô‹›<ËŠ,Ã"ŸKä­DNqâFcó@?íÄ µ`zë f™¥@~O?'‰Az©PÜqmç4ñ"HÝ(¬î駃h‚ÄÁí.ֽχX)n[±<èE$AkìîRÏÃ"Ž µ@Îá§1Æ C?ý‰AfÁòº?á#È,X^ ¸ ³PX±¼îMhAô3À‚ÌBqz:ˆ°E‚Y(ìxö`A#È,.òb„d «Û€wxÄú` áÑÏ( ¢ŸQ´¦ŸQ„´(ég‰ 9ýŒ!Œ zŒë££"H­‘ra!é…Á=÷·Ç@Yìèg$-øæ¬Ñø´VXñÊ£ñ.Hpd…oAjÍ ž™%R^ûÀÏ‚–·,àlð+h+¹ƒj‰WA¢BÁT;| R[dwÛ¿< 2k®ÀÙâQÐZq…Ç‚ª+Öx¤+ä,ìñ&hiÀª| Ú*ÎPàI¬Pp Û~™5R΀œàGÐZsr„A¢Æ†×@pƒAz‹œ#|b…í‚*VØq/H³Âv‰{Ak.ñ¸Ã¹ !±a‚s‡kAfË5R§¸ÄçÇ‚êüpM§¸dÖÈXÁ9Å­ ŠST×8$+”Lpnq*h”ç°ãRЖ› îq(H ÜdpCA§@p'H ®ñxÀ  )§@îq&HHð#ì=àJá6·\ b…à G‚4×<áHÐ)È nI‰?ÊÑ nq—ÁN [–Ø~p!Èl¹ç ‚*&8_8d –ؾp ˆä{AF`Åò†½ -È'Ö‚´àÕ'Ö‚*0€|b+H l@±´å>ª_,É+.òøÄR"øæÔ§@ÊÎßþ$@ž9%hÑã÷¿cùåTŠkº¸~`ùÅj ª€\u„ÇF–ÀÏõ„ÅFPæ7ïXÒ¼&©w,U  ÿŒÄeì Œ$¸Œ‚Ñ‚ (£ñ$BÆ 2%(c Ã.£ñ,\F š#PF ª@'Hjð´|Æ ÈX"„a” ]3€B1JWyÂ1F<*Œ1‚jNRÃ1FP…‚WM ÅA¬±C2Bkì Ä;(ñÆÊ`A¬±Ã2Xkì° Ä;,C±ÆÌPA¬±3PkìÐ Ä;4ñ=á&¨ÖàQ„° „ŒCPX b‰žA‚ßœA‚jžÇÎA5WÂ3HK„ð dX"D`€ –1 ¨FÁ!8ý)Å þ‚j¤žþ‚J®“†§· Ú0ÃÅ ¿ d\ÈŽ@_AœE¢¯ N‚"ÑW'A‘è)Hs‰ž‚((=ÕœE¢Ÿ Å Xô$¸Ì‹~‚8 ŠF/A|ËI&‹îç·­Šk;-ÚÁKÿf»Hï­÷Ž›Ý ùЋάв” yõÅ G;Næc¹sÑÌ¢°Ž •»xbd঳7m‚ÚNË Ç‘ ­¾sÒŽº±ÝÞ+7¯\øˆÇŽŸhKqm§åb!Œ?Èa9Su:,ëÎ1¤EÐÔNËÕz×çÑœæf¿¨aÙJ½N’H»·”}üÝãa‹ ‰–Óé-`ûÒ‡Ò ,‡øÛçYŒå‘æòîÂçøôè›§æ)ï1Óíâ OÖm<¤Û.¯l6Ms‹;ëþ4Mûu§‡¦yÊ:›i›ÏÞå@nÿPö/Û£Ãk>·íÍÆÍƒ:<,ËGu—#]uk汫‰óNkíÇ5ñ¦òIEND®B`‚unuran-1.11.0/doc/figures/rejection_from_constant_hat.pdf0000644001357500135600000000712614420304141020512 00000000000000%PDF-1.3 %Çì¢ 6 0 obj <> stream xœí™¹®¹†óóý4÷åœÙ G2fl@ <ðÛûû‹K÷¹#e/\›¬õg-<¿]Þ…Ëëßúûõûë·×Ÿþš¯_ÿýònøxýú ׿^©¸2F½²wѳúýU†K=÷«×sW näV®à“kµ^ÿyõìr ù ±¸Ó5Šk!Açâbnìì.Â3Ôæ|»¾¾Bô®_¡w× St>Ç+j[ŒË®æ|Å8\/IûKs!Ž+–àb‡qí.µ+6ï CÇ‚ƒŠÅŒä2¬Sˆ(›` ËdD½bhS‰®G¬Öë•;¬rp>BÃrtIN®ö~e–u¢VB¹2ÚW´Œ –üÍųå†w>áH”¬U2’.£LæK„G âyakWŠ7—«D|dF§„{Z¼ ^QÊÂг¿F×´þ¦t“ÓЉVˆ.ásÍ; S¹j HM,û®šêÛ ¦ËxµÂx\9bGW­:°«Ì¯=¹„xöçfñªpjxãvðñ% FkíjÉ»ìíÀð8­a¾Íà"HUV!Þ@æjMñî(à"kGGWZ—¾tO<¦f!-EAN”ŠNáêÄV„æ®èµkÀˆEn©T†G—®è5¼0R€nÕ Ñ#´«ÍêåÓ ã ç.£=îäbT06<ë ß%ðЯÀj µâï:®!Då .<á”+¶!ýâa«ÔÀÿ˜â›î¯ùÖÄ·Œˆò¨çb“N Vxe4” -Ïx Ü=p'¸#׺)Ø~¬‹4"Ùß…\î à ŽA$ŸåÔ0"ˆ ´£2.4#¡QgXŒ&’‚RÇT>â^œ%d$±´Œ€w‰#¡âÐ TbwQa£ˆ!'É t¥LºËKCØhJ&\¸‚y|h=Ü4ØH>=OàбWÄ“¬A"82GW(ÃC«1„õzôÆ%yþvap{XmŒZ>~ Þ²Æñ[ÀB¬zx6xá.×:ò Œ4mFN$˜mY¾°Ñvä±,€ ÿ„º#_mð¡¼Np¡Z„v¢ÏrkhŠæÂ'Êà‘7~Åx`äD¸Éˆà£®€RäìBݼwÇ@^w,ªL »dv‘QŸ|?o©¹‰$O¢Ÿ÷X1ŽÀãÜr褜ÙW¨:‘€Òf¦ÀÁ3Ó¯L‚Œ<°Ær‰HBG^ÉH@JÍ\…’ tpÉf6›"@ÅÂò” ɹ²²!~Ë€7Ì|i"HŸøi&Ô¤²æmC™õ–꘷j&d E®Jõ+e‹%è 9ÍŒ®X,ãgsm –÷Tð} oÖ ÑQZUÅ”*Ŭª#-JV\WQÂqbEÊœekÌâ›U¬®ÙÒ Â³î¡d$ÄYu‹Bµü1k'*ø  ˜¥UÅ;eY9‹¯I¨D%ËbF^©ä]¼‹ÚÁ{•÷y'«*[ àƒèÎþ³Ö†ÙA˜Ù |ÄÝc DC€õ :ÁÞîP, |”Ýà ¢ñ‰+6{”jàÃRœº n'F”¯­O :€¨«“Bä_¿¼B"‰ò÷Ï>ë³Ïúì³>û¬Ï>ë³Ïúì³>û¬Ï>ëÿØg}yé¨Êß}–¥/Ðñýµ÷ï•oìÇQh³ÿã×{ÿîÔ´ÿo8]@ ®XÎÙëï—¿þñ¹wNœdÜrÌyrº5Š×ŸÀ tùA{ñ<ëõ†7¢šÀËR-Uý•£Ô@{O±ŽÊ49 J÷ž_àö#¹Üùågî¤Pf¦ŸÑš;B²ËUP»w‘ƒàþíE Ð={¾=öT×ϵûãÎ/ÇË[šmÜ$5£Ú¥†¦õGØÉAäßñ°Û IêwåI¢ÁUÚ¯bºW¢ÚGcv$ƒ^IͺzªMS›I½³B¢<§ÃáÐK†Œµâ±NW`q  Ä3›V!œZì•£åâðÑŽ¯¯* UÙŒ¬^VQÚ k=l@@rŒ9tÝXuo‹¦m ä—{ù]EèpXô¡kÜK‰Þçi= û‘°i,ÎŽ­ôbðnÃ4,“CƒZkÌ”çï÷J¤wÃJý5T-Ü3-@—›¦Û®ÍZ¨³ƒ$šÉà‡Ã¦— NìŠÈ \›C4gt’[ƦÕÑO-ÎŽ­åæðÁޝo³å掘”„øcÈÊu!ž^ȨQóNR”ÏJÕœ§zÈÕ¥’ÆJ’#Ç©62ì¦ió) ­Þ+¥’”éÍaÓK'öJRX¨˜›ƒÂ?â-cÑ%–kåh¹8|´C¾8\ŽöÊ›HŒ´²Æ¡üqV C@-Ä”8äJ/ïªònš1„ì +yv€_6½dhÒY+i¶Ž‡CœãÙ‘÷¸v´Ø;¶–›Ã;äÍåöÀ^yzàNhMi½Ú¬AÿÁö{AÙˆn"ÚsŃngÒÙÖC“hØJi÷OeŸÓÊäph¡l/h}7ƒAÄÛ-a‘šÇ¦ ûûÑp7aÞø>¬\5šÃb ß @hW)e5ƃàNQPß4iºj|¯÷Êf¡+<6½D(±¯0P”57 Zñ–±hiK‹½c)¹¼ñ~Û7·;Ò{åiœT¬Ukï² Ö^±w M­ŒøÊÌÃÛóÈp­’©Mãm¸¿[]îó›^8°Wèý‹MÖ“:\m‹ÔX¸4X+GÃuþ£ æ‡Åä¿Þm'UT²©&„hÀ^!†±[Ù7YÏ­ªÙ“v`Ó*¤®ÏÊ ¬(ón‡^2dÍZ!ˆiÂtr ÆÖŸo‹–Œ¥ÅÙ±´<Þíý›Ë퀽òæ†*'DjJ a¶+¶¢×³â»z| ë(­7z›¶!ÙͳÃk"‹7‡Eo²g®hâK6âN„3J³-cÓ6V›÷Ž©åÍáÝóÀâòðÀZyó€FÝ¢.˜¨þ÷J`®ÊzUe@W7›=È1ógשi™A’ðÜÈ·zo; ½DØDn+ `Û0³8¤n!K¢´}jp>OïÓï&˜ñ“ÅÃö¹ðfzbvx‰)¿[;wVHTÌ[šû™7˜$ITµèå€|4Ú¡Mµä7îÕæü›Ã¢—Œ¯¯³BD»§7‡œ N[Æ¢ubi±wl-7‡vLû'—§æÊ»4·S IŒjľß+lÎQoãz¡¯"s{ÆÐL|h½J$½P?vè©j<,z‰°§’¹‚ËlxÞ4vi4Þ2mo%¦ÄÙ°t< Þ­0û“‡ýkåÇe>dEA/aÞÚëïgŪ¨=—µí Î÷I“}lš´žO˜ÕõÐrv${å¿9LzËЉµ¢Y^¼‡¡Bn›^O4zÍ=;–އû³Ø‡B§¤ŸN¨>Zœ÷ ­EW¢Wn…_Ó[š^¼JbȬ‡Ö3 sz~làvç'ƒE/:0Wìm¤êáÆÔ®îv$lZ¦÷Ž©ãÍàÝŠmuvÞÆ›8÷JÒ3Ÿ¡š~©Ðó ¦T¯ú¥àÐ’Le•QgWÉ^í6‡E/¦ë\ ”¹¢‹ƒ×/Cñ–±h{ÆšZœKËÃáÝŽ÷ffó{ày­üÏMݸ‡VÌ+{…‹Yƒ^µFÒc^z×£—>ÔCë•‹Ãý±A“ã“Á¢—X+U¯cöše ±½‰n ‹Ö¥ÃÞ±uÜ >X±"®_¨Ó˰§¨½¢HY¸:áÎx—õ‚×ToÆ¡õX¦GâôØ¡Ê'‡E/ö‚7W´~í8²D‡[Æ¢í ojqv,-‡w;¦uáßÿOÑrendstream endobj 7 0 obj 2914 endobj 5 0 obj <> /Contents 6 0 R >> endobj 3 0 obj << /Type /Pages /Kids [ 5 0 R ] /Count 1 >> endobj 1 0 obj <> endobj 4 0 obj <> endobj 8 0 obj <> endobj 2 0 obj <>endobj xref 0 9 0000000000 65535 f 0000003218 00000 n 0000003364 00000 n 0000003159 00000 n 0000003266 00000 n 0000003019 00000 n 0000000015 00000 n 0000002999 00000 n 0000003335 00000 n trailer << /Size 9 /Root 1 0 R /Info 2 0 R >> startxref 3414 %%EOF unuran-1.11.0/doc/version_win32.texi0000644001357500135600000000014114430713451014202 00000000000000@set UPDATED 21 April 2023 @set UPDATED-MONTH April 2023 @set EDITION 1.11.0 @set VERSION 1.11.0 unuran-1.11.0/doc/unuran.txt0000644001357500135600000244122614430713522012667 00000000000000UNU.RAN – Universal Non-Uniform RANdom number generators 1 Introduction 1.1 Usage of this document 1.2 Installation 1.3 Using the library 1.4 Concepts of UNU.RAN 1.5 Contact the authors 2 Examples 2.1 As short as possible 2.2 As short as possible (String API) 2.3 Select a method 2.4 Select a method (String API) 2.5 Arbitrary distributions 2.6 Arbitrary distributions (String API) 2.7 Change parameters of the method 2.8 Change parameters of the method (String API) 2.9 Change uniform random generator 2.10 Change parameters of underlying distribution 2.11 Sample pairs of antithetic random variates 2.12 Sample pairs of antithetic random variates (String API) 2.13 More examples 3 String Interface 3.1 Syntax of String Interface 3.2 Distribution String 3.2.1 Keys for Distribution String 3.3 Function String 3.4 Method String 3.4.1 Keys for Method String 3.5 Uniform RNG String 4 Handling distribution objects 4.1 Functions for all kinds of distribution objects 4.2 Continuous univariate distributions 4.3 Continuous univariate order statistics 4.4 Continuous empirical univariate distributions 4.5 Continuous multivariate distributions 4.6 Continuous univariate full conditional distribution 4.7 Continuous empirical multivariate distributions 4.8 MATRix distributions 4.9 Discrete univariate distributions 5 Methods for generating non-uniform random variates 5.1 Routines for all generator objects 5.2 AUTO – Select method automatically 5.3 Methods for continuous univariate distributions 5.3.1 AROU – Automatic Ratio-Of-Uniforms method 5.3.2 ARS – Adaptive Rejection Sampling 5.3.3 CEXT – wrapper for Continuous EXTernal generators 5.3.4 CSTD – Continuous STandarD distributions 5.3.5 HINV – Hermite interpolation based INVersion of CDF 5.3.6 HRB – Hazard Rate Bounded 5.3.7 HRD – Hazard Rate Decreasing 5.3.8 HRI – Hazard Rate Increasing 5.3.9 ITDR – Inverse Transformed Density Rejection 5.3.10 NINV – Numerical INVersion 5.3.11 NROU – Naive Ratio-Of-Uniforms method 5.3.12 PINV – Polynomial interpolation based INVersion of CDF 5.3.13 SROU – Simple Ratio-Of-Uniforms method 5.3.14 SSR – Simple Setup Rejection 5.3.15 TABL – a TABLe method with piecewise constant hats 5.3.16 TDR – Transformed Density Rejection 5.3.17 UTDR – Universal Transformed Density Rejection 5.4 Methods for continuous empirical univariate distributions 5.4.1 EMPK – EMPirical distribution with Kernel smoothing 5.4.2 EMPL – EMPirical distribution with Linear interpolation 5.4.3 HIST – HISTogramm of empirical distribution 5.5 Methods for continuous multivariate distributions 5.5.1 MVSTD – MultiVariate continuous STandarD distributions 5.5.2 MVTDR – Multi-Variate Transformed Density Rejection 5.5.3 NORTA – NORmal To Anything 5.5.4 VNROU – Multivariate Naive Ratio-Of-Uniforms method 5.6 Markov chain samplers for continuous multivariate distributions 5.6.1 GIBBS – Markov Chain - GIBBS sampler 5.6.2 HITRO – Markov Chain - HIT-and-run sampler with Ratio-Of-uniforms 5.7 Methods for continuous empirical multivariate distributions 5.7.1 VEMPK – (Vector) EMPirical distribution with Kernel smoothing 5.8 Methods for discrete univariate distributions 5.8.1 DARI – Discrete Automatic Rejection Inversion 5.8.2 DAU – (Discrete) Alias-Urn method 5.8.3 DEXT – wrapper for Discrete EXTernal generators 5.8.4 DGT – (Discrete) Guide Table method (indexed search) 5.8.5 DSROU – Discrete Simple Ratio-Of-Uniforms method 5.8.6 DSS – (Discrete) Sequential Search method 5.8.7 DSTD – Discrete STandarD distributions 5.9 Methods for random matrices 5.9.1 MCORR – Random CORRelation matrix 5.10 Methods for uniform univariate distributions 5.10.1 UNIF – wrapper for UNIForm random number generator 5.11 Meta Methods for univariate distributions 5.11.1 MIXT – MIXTure of distributions 6 Using uniform random number generators 6.1 Simple interface for uniform random number generators 6.2 Interface to GSL uniform random number generators 6.3 Interface to GSL generators for quasi-random points 6.4 Interface to Otmar Lendl’s pseudo-random number generators 6.5 Interface to L’Ecuyer’s RNGSTREAM random number generators 6.6 Combine point set generator with random shifts 7 UNU.RAN Library of standard distributions 7.1 UNU.RAN Library of continuous univariate distributions 7.1.1 ‘F’ – F-distribution 7.1.2 ‘beta’ – Beta distribution 7.1.3 ‘cauchy’ – Cauchy distribution 7.1.4 ‘chi’ – Chi distribution 7.1.5 ‘chisquare’ – Chisquare distribution 7.1.6 ‘exponential’ – Exponential distribution 7.1.7 ‘extremeI’ – Extreme value type I (Gumbel-type) distribution 7.1.8 ‘extremeII’ – Extreme value type II (Frechet-type) distribution 7.1.9 ‘gamma’ – Gamma distribution 7.1.10 ‘gig’ – Generalized Inverse Gaussian distribution 7.1.11 ‘gig2’ – Generalized Inverse Gaussian distribution 7.1.12 ‘hyperbolic’ – Hyperbolic distribution 7.1.13 ‘ig’ – Inverse Gaussian distribution 7.1.14 ‘laplace’ – Laplace distribution 7.1.15 ‘logistic’ – Logistic distribution 7.1.16 ‘lognormal’ – Log-Normal distribution 7.1.17 ‘lomax’ – Lomax distribution (Pareto distribution of second kind) 7.1.18 ‘normal’ – Normal distribution 7.1.19 ‘pareto’ – Pareto distribution (of first kind) 7.1.20 ‘powerexponential’ – Powerexponential (Subbotin) distribution 7.1.21 ‘rayleigh’ – Rayleigh distribution 7.1.22 ‘slash’ – Slash distribution 7.1.23 ‘student’ – Student’s t distribution 7.1.24 ‘triangular’ – Triangular distribution 7.1.25 ‘uniform’ – Uniform distribution 7.1.26 ‘weibull’ – Weibull distribution 7.2 UNU.RAN Library of continuous multivariate distributions 7.2.1 ‘copula’ – Copula (distribution with uniform marginals) 7.2.2 ‘multicauchy’ – Multicauchy distribution 7.2.3 ‘multiexponential’ – Multiexponential distribution 7.2.4 ‘multinormal’ – Multinormal distribution 7.2.5 ‘multistudent’ – Multistudent distribution 7.3 UNU.RAN Library of discrete univariate distributions 7.3.1 ‘binomial’ – Binomial distribution 7.3.2 ‘geometric’ – Geometric distribution 7.3.3 ‘hypergeometric’ – Hypergeometric distribution 7.3.4 ‘logarithmic’ – Logarithmic distribution 7.3.5 ‘negativebinomial’ – Negative Binomial distribution 7.3.6 ‘poisson’ – Poisson distribution 7.4 UNU.RAN Library of random matrices 7.4.1 ‘correlation’ – Random correlation matrix 8 Error handling and Debugging 8.1 Output streams 8.2 Debugging 8.3 Error reporting 8.4 Error codes 8.5 Error handlers 9 Testing 10 Miscelleanous 10.1 Mathematics Appendix A A Short Introduction to Random Variate Generation A.1 The Inversion Method A.2 The Rejection Method A.3 The Composition Method A.4 The Ratio-of-Uniforms Method A.5 Inversion for Discrete Distributions A.6 Indexed Search (Guide Table Method) Appendix B Glossary Appendix C Bibliography Appendix D Function Index UNU.RAN – Universal Non-Uniform RANdom number generators ******************************************************** This is the online-documentation of UNU.RAN. Version: 1.11.0 Date: 21 April 2023 UNU.RAN (Universal Non-Uniform RAndom Number generator) is a collection of algorithms for generating non-uniform pseudorandom variates as a library of C functions designed and implemented by the ARVAG (Automatic Random VAriate Generation) project group in Vienna, and released under the GNU Public License (GPL). It is especially designed for such situations where − a non-standard distribution or a truncated distribution is needed. − experiments with different types of distributions are made. − random variates for variance reduction techniques are used. − fast generators of predictable quality are necessary. Of course it is also well suited for standard distributions. However due to its more sophisticated programming interface it might not be as easy to use if you only look for a generator for the standard normal distribution. (Although UNU.RAN provides generators that are superior in many aspects to those found in quite a number of other libraries.) UNU.RAN implements several methods for generating random numbers. The choice depends primary on the information about the distribution can be provided and – if the user is familar with the different methods – on the preferences of the user. The design goals of UNU.RAN are to provide _reliable_, _portable_ and _robust_ (as far as this is possible) functions with a consisent and easy to use interface. It is suitable for all situation where experiments with different distributions including non-standard distributions. For example it is no problem to replace the normal distribution by an empirical distribution in a model. Since originally designed as a library for so called black-box or universal algorithms its interface is different from other libraries. (Nevertheless it also contains special generators for standard distributions.) It does not provide subroutines for random variate generation for particular distributions. Instead it uses an object-oriented interface. Distributions and generators are treated as independent objects. This approach allows one not only to have different methods for generating non-uniform random variates. It is also possible to choose the method which is optimal for a given situation (e.g. speed, quality of random numbers, using for variance reduction techniques, etc.). It also allows to sample from non-standard distribution or even from distributions that arise in a model and can only be computed in a complicated subroutine. Sampling from a particular distribution requires the following steps: 1. Create a distribution object. (Objects for standard distributions are available in the library) 2. Choose a method. 3. Initialize the generator, i.e., create the generator object. If the choosen method is not suitable for the given distribution (or if the distribution object contains too little information about the distribution) the initialization routine fails and produces an error message. Thus the generator object does (probably) not produce false results (random variates of a different distribution). 4. Use this generator object to sample from the distribution. There are four types of objects that can be manipulated independently: • *Distribution objects:* hold all information about the random variates that should be generated. The following types of distributions are available: − Continuous and Discrete distributions − Empirical distributions − Multivariate distributions Of course a library of standard distributions is included (and these can be further modified to get, e.g., truncated distributions). Moreover the library provides subroutines to build almost arbitrary distributions. • *Generator objects:* hold the generators for the given distributions. It is possible to build independent generator objects for the same distribution object which might use the same or different methods for generation. (If the choosen method is not suitable for the given method, a ‘NULL’ pointer is returned in the initialization step). • *Parameter objects:* Each transformation method requires several parameters to adjust the generator to a given distribution. The parameter object holds all this information. When created it contains all necessary default settings. It is only used to create a generator object and destroyed immediately. Altough there is no need to change these parameters or even know about their existence for “usual distributionsâ€, they allow a fine tuning of the generator to work with distributions with some awkward properties. The library provides all necessary functions to change these default parameters. • *Uniform Random Number Generators:* All generator objects need one (or more) streams of uniform random numbers that are transformed into random variates of the given distribution. These are given as pointers to appropriate functions or structures (objects). Two generator objects may have their own uniform random number generators or share a common one. Any functions that produce uniform (pseudo-) random numbers can be used. We suggest Otmar Lendl’s PRNG library. 1 Introduction ************** 1.1 Usage of this document ========================== We designed this document in a way such that one can use UNU.RAN with reading as little as necessary. Read *note Installation:: for the instructions to install the library. *note Concepts of UNU.RAN: Concepts, discribes the basics of UNU.RAN. It also has a short guideline for choosing an appropriate method. In *note Examples:: examples are given that can be copied and modified. They also can be found in the directory ‘examples’ in the source tree. Further information are given in consecutive chapters. *note Handling distribution objects: Distribution_objects, describes how to create and manipulate distribution objects. *note standard distributions: Stddist, describes predefined distribution objects that are ready to use. *note Methods:: describes the various methods in detail. For each of possible distribution classes (continuous, discrete, empirical, multivariate) there exists a short overview section that can be used to choose an appropriate method followed by sections that describe each of the particular methods in detail. These are merely for users with some knowledge about the methods who want to change method-specific parameters and can be ignored by others. Abbreviations and explanation of some basic terms can be found in *note Glossary::. 1.2 Installation ================ UNU.RAN was developed on an Intel architecture under Linux with the GNU C compiler but should compile and run on any computing environment. It requires an ANSI compliant C compiler. Below find the installation instructions for unices. Uniform random number generator ............................... UNU.RAN can be used with any uniform random number generator but (at the moment) some features work best with Pierre L’Ecuyer’s RngStreams library (see for a description and downloading. For details on using uniform random number in UNU.RAN see *note Using uniform random number generators: URNG. Install the required libraries first. UNU.RAN ....... 1. First unzip and untar the package and change to the directory: tar zxvf unuran-1.11.0.tar.gz cd unuran-1.11.0 2. Optional: Edit the file ‘src/unuran_config.h’ 3. Run a configuration script: sh ./configure --prefix= where ‘’ is the root of the installation tree. When omitted ‘/usr/local’ is used. Use ‘./configure --help’ to get a list of other options. In particular the following flags are important: • Enable support for some external sources of uniform random number generators (*note Using uniform random number generators: URNG.): ‘--with-urng-rngstream’ URNG: use Pierre L’Ecuyer’s RNGSTREAM library [default=‘no’] ‘--with-urng-prng’ URNG: use Otmar Lendl’s PRNG library [default=‘no’] ‘--with-urng-gsl’ URNG: use random number generators from GNU Scientific Library [default=‘no’] ‘--with-urng-default’ URNG: global default URNG (builtin|rngstream) [default=‘builtin’] We strongly recommend to use RngStreams library: sh ./configure --with-urng-rngstream --with-urng-default=rngstream _Important:_ You must install the respective libraries ‘RngStreams’, ‘PRNG’ and ‘GSL’ before ‘./configure’ is executed. • Also make a shared library: ‘--enable-shared’ build shared libraries [default=‘no’] • The library provides the function ‘unur_gen_info’ for information about generator objects. This is intented for using in interactive computing environments. This feature can be enabled / disabled by means of the configure flag ‘--enable-info’ INFO: provide function with information about generator objects [default=‘yes’] • Enable support for deprecated UNU.RAN routines if you have some problems with older application after upgrading the library: ‘--enable-deprecated’ enable support for deprecated UNU.RAN routines [default=‘no’] • Enable debugging tools: ‘--enable-check-struct’ Debug: check validity of pointers to structures [default=‘no’] ‘--enable-logging’ Debug: print informations about generator into logfile [default=no] 4. Compile and install the libray: make make install Obviously ‘$(prefix)/include’ and ‘$(prefix)/lib’ must be in the search path of your compiler. You can use environment variables to add these directories to the search path. If you are using the bash type (or add to your profile): export LIBRARY_PATH="/lib" export C_INCLURE_PATH="/include" If you want to make a shared library, then making such a library can be enabled using sh ./configure --enable-shared If you want to link against the shared library make sure that it can be found when executing the binary that links to the library. If it is not installed in the usual path, then the easiest way is to set the ‘LD_LIBRARY_PATH’ environment variable. See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages. 5. Documentation in various formats (PDF, HTML, info, plain text) can be found in directory ‘doc’. 6. You can run some tests by make check However, some of these tests requires the usage of the PRNG or RngStreams library and are only executed if these are installed enabled by the corresponding configure flag. An extended set of tests is run by make fullcheck However some of these might fail occasionally due to roundoff errors or the mysteries of floating point arithmetic, since we have used some extreme settings to test the library. Upgrading ......... − _Important:_ UNU.RAN now relies on some aspects of IEEE 754 compliant floating point arithmetic. In particular, ‘1./0.’ and ‘0./0.’ must result in ‘infinity’ and ‘NaN’ (not a number), respectively, and must not cause a floating point exception. For allmost all modern compting architecture this is implemented in hardware. For others there should be a special compiler flag to get this feature (e.g., ‘-MIEEE’ on DEC alpha or ‘-mp’ for the Intel C complier). − Upgrading UNU.RAN from version 0.9.x or earlier: With UNU.RAN version 1.0.x some of the macro definitions in file ‘src/unuran_config.h’ are moved into file ‘config.h’ and are set/controlled by the ‘./configure’ script. Writting logging information into the logfile must now be enabled when running the configure script: sh ./configure --enable-logging − Upgrading UNU.RAN from version 0.7.x or earlier: With UNU.RAN version 0.8.0 the interface for changing underlying distributions and running a reinitialization routine has been simplified. The old routines can be compiled into the library using the following configure flag: sh ./configure --enable-deprecated Notice: Using these deprecated routines is not supported any more and this strong discouraged. Wrapper functions for external sources of uniform random numbers are now enabled by configure flags and not by macros defined in file ‘src/unuran_config.h’. The file ‘src/unuran_config.h’ is not installed any more. It is now only included when the library is compiled. It should be removed from the global include path of the compiler. 1.3 Using the library ===================== ANSI C Compliance ................. The library is written in ANSI C and is intended to conform to the ANSI C standard. It should be portable to any system with a working ANSI C compiler. The library does not rely on any non-ANSI extensions in the interface it exports to the user. Programs you write using UNU.RAN can be ANSI compliant. Extensions which can be used in a way compatible with pure ANSI C are supported, however, via conditional compilation. This allows the library to take advantage of compiler extensions on those platforms which support them. To avoid namespace conflicts all exported function names and variables have the prefix ‘unur_’, while exported macros have the prefix ‘UNUR_’. Compiling and Linking ..................... If you want to use the library you must include the UNU.RAN header file #include If you also need the test routines then also add #include If wrapper functions for external sources of uniform random number generators are used, the corresponding header files must also be included, e.g., #include If these header files are not installed on the standard search path of your compiler you will also need to provide its location to the preprocessor as a command line flag. The default location of the ‘unuran.h’ is ‘/usr/local/include’. A typical compilation command for a source file ‘app.c’ with the GNU C compiler ‘gcc’ is, gcc -I/usr/local/include -c app.c This results in an object file ‘app.o’. The default include path for ‘gcc’ searches ‘/usr/local/include’ automatically so the ‘-I’ option can be omitted when UNU.RAN is installed in its default location. The library is installed as a single file, ‘libunuran.a’. A shared version of the library is also installed on systems that support shared libraries. The default location of these files is ‘/usr/local/lib’. To link against the library you need to specify the main library. The following example shows how to link an application with the library (and the the RNGSTREAMS library if you decide to use this source of uniform pseudo-random numbers), gcc app.o -lunuran -lrngstreams -lm Shared Libraries ................ To run a program linked with the shared version of the library it may be necessary to define the shell variable ‘LD_LIBRARY_PATH’ to include the directory where the library is installed. For example, LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH To compile a statically linked version of the program instead, use the ‘-static’ flag in ‘gcc’, gcc -static app.o -lunuran -lrngstreams -lm Compatibility with C++ ...................... The library header files automatically define functions to have ‘extern "C"’ linkage when included in C++ programs. 1.4 Concepts of UNU.RAN ======================= UNU.RAN is a C library for generating non-uniformly distributed random variates. Its emphasis is on the generation of non-standard distribution and on streams of random variates of special purposes. It is designed to provide a consistent tool to sample from distributions with various properties. Since there is no universal method that fits for all situations, various methods for sampling are implemented. UNU.RAN solves this complex task by means of an object oriented programming interface. Three basic objects are used: • distribution object ‘UNUR_DISTR’ Hold all information about the random variates that should be generated. • generator object ‘UNUR_GEN’ Hold the generators for the given distributions. Two generator objects are completely independent of each other. They may share a common uniform random number generator or have their owns. • parameter object ‘UNUR_PAR’ Hold all information for creating a generator object. It is necessary due to various parameters and switches for each of these generation methods. Notice that the parameter objects only hold pointers to arrays but do not have their own copy of such an array. Especially, if a dynamically allocated array is used it _must not_ be freed until the generator object has been created! The idea behind these structures is that creatin distributions, choosing a generation method and draing samples are orthogonal (ie. independent) functions of the library. The parameter object is only introduced due to the necessity to deal with various parameters and switches for each of these generation methods which are required to adjust the algorithms to unusual distributions with extreme properties but have default values that are suitable for most applications. These parameters and the data for distributions are set by various functions. Once a generator object has been created sampling (from the univariate continuous distribution) can be done by the following command: double x = unur_sample_cont(generator); Analogous commands exist for discrete and multivariate distributions. For detailed examples that can be copied and modified see *note Examples::. Distribution objects -------------------- All information about a distribution are stored in objects (structures) of type ‘UNUR_DISTR’. UNU.RAN has five different types of distribution objects: ‘cont’ Continuous univariate distributions. ‘cvec’ Continuous multivariate distributions. ‘discr’ Discrete univariate distributions. ‘cemp’ Continuous empirical univariate distribution, ie. given by a sample. ‘cvemp’ Continuous empirical multivariate distribution, ie. given by a sample. ‘matr’ Matrix distributions. Distribution objects can be created from scratch by the following call distr = unur_distr__new(); where ‘’ is one of the five possible types from the above table. Notice that these commands only create an _empty_ object which still must be filled by means of calls for each type of distribution object (*note Handling distribution objects: Distribution_objects.). The naming scheme of these functions is designed to indicate the corresponding type of the distribution object and the task to be performed. It is demonstated on the following example. unur_distr_cont_set_pdf(distr, mypdf); This command stores a PDF named ‘mypdf’ in the distribution object ‘distr’ which must have the type ‘cont’. Of course UNU.RAN provides an easier way to use standard distributions. Instead of using ‘unur_distr__new’ calls and fuctions ‘unur_distr__set_<...>’ for setting data, objects for standard distribution can be created by a single call. Eg. to get an object for the normal distribution with mean 2 and standard deviation 5 use double parameter[2] = {2.0 ,5.0}; UNUR_DISTR *distr = unur_distr_normal(parameter, 2); For a list of standard distributions see *note Standard distributions: Stddist. Generation methods ------------------ The information that a distribution object must contain depends heavily on the chosen generation method choosen. Brackets indicate optional information while a tilde indicates that only an approximation must be provided. See *note Glossary::, for unfamiliar terms. Methods for continuous univariate distributions sample with ‘unur_sample_cont’ method PDF dPDF CDF mode area other AROU x x [x] T-concave ARS x x T-concave CEXT wrapper for external generator CSTD build-in standard distribution HINV [x] [x] x HRB bounded hazard rate HRD decreasing hazard rate HRI increasing hazard rate ITDR x x x monotone with pole NINV [x] x NROU x [x] PINV x [x] [~] SROU x x x T-concave SSR x x x T-concave TABL x x [~] all local extrema TDR x x T-concave UTDR x x ~ T-concave Methods for continuous empirical univariate distributions sample with ‘unur_sample_cont’ EMPK: Requires an observed sample. EMPL: Requires an observed sample. Methods for continuous multivariate distributions sample with ‘unur_sample_vec’ NORTA: Requires rank correlation matrix and marginal distributions. VNROU: Requires the PDF. MVSTD: Generator for built-in standard distributions. MVTDR: Requires PDF and gradiant of PDF. Methods for continuous empirical multivariate distributions sample with ‘unur_sample_vec’ VEMPK: Requires an observed sample. Methods for discrete univariate distributions sample with ‘unur_sample_discr’ method PMF PV mode sum other DARI x x ~ T-concave DAU [x] x DEXT wrapper for external generator DGT [x] x DSROU x x x T-concave DSS [x] x x DSTD build-in standard distribution Methods for matrix distributions sample with ‘unur_sample_matr’ MCORR: Distribution object for random correlation matrix. Markov Chain Methods for continuous multivariate distributions sample with ‘unur_sample_vec’ GIBBS: T-concave logPDF and derivatives of logPDF. HITRO: Requires PDF. Because of tremendous variety of possible problems, UNU.RAN provides many methods. All information for creating a generator object has to be collected in a parameter object first. For example, if the task is to sample from a continuous distribution the method AROU might be a good choice. Then the call UNUR_PAR *par = unur_arou_new(distribution); creates an parameter object ‘par’ with a pointer to the distribution object and default values for all necessary parameters for method AROU. Other methods can be used by replacing ‘arou’ with the name of the desired methods (in lower case letters): UNUR_PAR *par = unur__new(distribution); This sets the default values for all necessary parameters for the chosen method. These are suitable for almost all applications. Nevertheless, it is possible to control the behavior of the method using corresponding ‘set’ calls for each method. This might be necessary to adjust the algorithm for an unusual distribution with extreme properties, or just for fine tuning the perforence of the algorithm. The following example demonstrates how to change the maximum number of iterations for method NINV to the value 50: unur_ninv_set_max_iteration(par, 50); All available methods are described in details in *note Methods::. Creating a generator object --------------------------- Now it is possible to create a generator object: UNUR_GEN *generator = unur_init(par); if (generator == NULL) exit(EXIT_FAILURE); *Important:* You must always check whether ‘unur_init’ has been executed successfully. Otherwise the ‘NULL’ pointer is returned which causes a segmentation fault when used for sampling. *Important:* The call of ‘unur_init’ *destroys* the parameter object! Moreover, it is recommended to call ‘unur_init’ immediately after the parameter object ‘par’ has created and modified. An existing generator object is a rather static construct. Nevertheless, some of the parameters can still be modified by ‘chg’ calls, e.g. unur_ninv_chg_max_iteration(gen, 30); Notice that it is important _when_ parameters are changed because different functions must be used: The function name includes the term ‘set’ and the first argument must be of type ‘UNUR_PAR’ when the parameters are changed _before_ the generator object is created. The function name includes the term ‘chg’ and the first argument must be of type ‘UNUR_GEN’ when the parameters are changed for an _existing_ generator object. For details see *note Methods::. Sampling -------- You can now use your generator object in any place of your program to sample from your distribution. You only have to take care about the type of variates it computes: ‘double’, ‘int’ or a vector (array of ‘double’s). Notice that at this point it does not matter whether you are sampling from a gamma distribution, a truncated normal distribution or even an empirical distribution. Reinitializing -------------- It is possible for a generator object to change the parameters and the domain of the underlying distribution. This must be done by extracting this object by means of a ‘unur_get_distr’ call and changing the distribution using the correspondig set calls, see *note Handling distribution objects: Distribution_objects. The generator object *must* then be reinitialized by means of the ‘unur_reinit’ call. _Important_: Currently not all methods allow reinitialization, see the description of the particular method (keyword Reinit). Destroy ------- When you do not need your generator object any more, you should destroy it: unur_free(generator); Uniform random numbers ---------------------- Each generator object can have its own uniform random number generator or share one with others. When created a parameter object the pointer for the uniform random number generator is set to the default generator. However, it can be changed at any time to any other generator: unur_set_urng(par, urng); or unur_chg_urng(generator, urng); respectively. See *note Using uniform random number generators: URNG, for details. 1.5 Contact the authors ======================= If you have any problems with UNU.RAN, suggestions how to improve the library, or find a bug, please contact us via email . For news please visit out homepage at . 2 Examples ********** The examples in this chapter should compile cleanly and can be found in the directory ‘examples’ of the source tree of UNU.RAN. Assuming that UNU.RAN as well as the PRNG libraries have been installed properly (*note Installation::) each of these can be compiled (using the GCC in this example) with gcc -Wall -O2 -o example example.c -lunuran -lprng -lm _Remark:_ ‘-lprng’ must be omitted when the PRNG library is not installed. Then however some of the examples might not work. The library uses three objects: ‘UNUR_DISTR’, ‘UNUR_PAR’ and ‘UNUR_GEN’. It is not important to understand the details of these objects but it is important not to changed the order of their creation. The distribution object can be destroyed _after_ the generator object has been made. (The parameter object is freed automatically by the ‘unur_init’ call.) It is also important to check the result of the ‘unur_init’ call. If it has failed the ‘NULL’ pointer is returned and causes a segmentation fault when used for sampling. We give all examples with the UNU.RAN standard API and the more convenient string API. 2.1 As short as possible ======================== Select a distribution and let UNU.RAN do all necessary steps. /* ------------------------------------------------------------- */ /* File: example0.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; /* will hold the random number */ /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Use a predefined standard distribution: */ /* Gaussian with mean zero and standard deviation 1. */ /* Since this is the standard form of the distribution, */ /* we need not give these parameters. */ distr = unur_distr_normal(NULL, 0); /* Use method AUTO: */ /* Let UNURAN select a suitable method for you. */ par = unur_auto_new(distr); /* Now you can change some of the default settings for the */ /* parameters of the chosen method. We don't do it here. */ /* Create the generator object. */ gen = unur_init(par); /* Notice that this call has also destroyed the parameter */ /* object `par' as a side effect. */ /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the standard Gaussian distribution. */ /* Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ 2.2 As short as possible (String API) ===================================== Select a distribution and let UNU.RAN do all necessary steps. /* ------------------------------------------------------------- */ /* File: example0_str.c */ /* ------------------------------------------------------------- */ /* String API. */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; /* will hold the random number */ /* Declare UNURAN generator object. */ UNUR_GEN *gen; /* generator object */ /* Create the generator object. */ /* Use a predefined standard distribution: */ /* Standard Gaussian distribution. */ /* Use method AUTO: */ /* Let UNURAN select a suitable method for you. */ gen = unur_str2gen("normal()"); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* Now you can use the generator object `gen' to sample from */ /* the standard Gaussian distribution. */ /* Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ 2.3 Select a method =================== Select method AROU and use it with default parameters. /* ------------------------------------------------------------- */ /* File: example1.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; /* will hold the random number */ /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Use a predefined standard distribution: */ /* Gaussian with mean zero and standard deviation 1. */ /* Since this is the standard form of the distribution, */ /* we need not give these parameters. */ distr = unur_distr_normal(NULL, 0); /* Choose a method: AROU. */ /* For other (suitable) methods replace "arou" with the */ /* respective name (in lower case letters). */ par = unur_arou_new(distr); /* Now you can change some of the default settings for the */ /* parameters of the chosen method. We don't do it here. */ /* Create the generator object. */ gen = unur_init(par); /* Notice that this call has also destroyed the parameter */ /* object `par' as a side effect. */ /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the standard Gaussian distribution. */ /* Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ 2.4 Select a method (String API) ================================ Select method AROU and use it with default parameters. /* ------------------------------------------------------------- */ /* File: example1_str.c */ /* ------------------------------------------------------------- */ /* String API. */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; /* will hold the random number */ /* Declare UNURAN generator object. */ UNUR_GEN *gen; /* generator object */ /* Create the generator object. */ /* Use a predefined standard distribution: */ /* Standard Gaussian distribution. */ /* Choose a method: AROU. */ /* For other (suitable) methods replace "arou" with the */ /* respective name. */ gen = unur_str2gen("normal() & method=arou"); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* Now you can use the generator object `gen' to sample from */ /* the standard Gaussian distribution. */ /* Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ 2.5 Arbitrary distributions =========================== If you want to sample from a non-standard distribution, UNU.RAN might be exactly what you need. Depending on the information is available, a method must be choosen for sampling, see *note Concepts:: for an overview and *note Methods:: for details. /* ------------------------------------------------------------- */ /* File: example2.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* In this example we build a distribution object from scratch */ /* and sample from this distribution. */ /* */ /* We use method TDR (Transformed Density Rejection) which */ /* required a PDF and the derivative of the PDF. */ /* ------------------------------------------------------------- */ /* Define the PDF and dPDF of our distribution. */ /* */ /* Our distribution has the PDF */ /* */ /* / 1 - x*x if |x| <= 1 */ /* f(x) = < */ /* \ 0 otherwise */ /* */ /* The PDF of our distribution: */ double mypdf( double x, const UNUR_DISTR *distr ) /* The second argument (`distr') can be used for parameters */ /* for the PDF. (We do not use parameters in our example.) */ { if (fabs(x) >= 1.) return 0.; else return (1.-x*x); } /* end of mypdf() */ /* The derivative of the PDF of our distribution: */ double mydpdf( double x, const UNUR_DISTR *distr ) { if (fabs(x) >= 1.) return 0.; else return (-2.*x); } /* end of mydpdf() */ /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; /* will hold the random number */ /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Create a new distribution object from scratch. */ /* It is a continuous distribution, and we need a PDF and the */ /* derivative of the PDF. Moreover we set the domain. */ /* Get empty distribution object for a continuous distribution */ distr = unur_distr_cont_new(); /* Assign the PDF and dPDF (defined above). */ unur_distr_cont_set_pdf( distr, mypdf ); unur_distr_cont_set_dpdf( distr, mydpdf ); /* Set the domain of the distribution (optional for TDR). */ unur_distr_cont_set_domain( distr, -1., 1. ); /* Choose a method: TDR. */ par = unur_tdr_new(distr); /* Now you can change some of the default settings for the */ /* parameters of the chosen method. We don't do it here. */ /* Create the generator object. */ gen = unur_init(par); /* Notice that this call has also destroyed the parameter */ /* object `par' as a side effect. */ /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ 2.6 Arbitrary distributions (String API) ======================================== If you want to sample from a non-standard distribution, UNU.RAN might be exactly what you need. Depending on the information is available, a method must be choosen for sampling, see *note Concepts:: for an overview and *note Methods:: for details. /* ------------------------------------------------------------- */ /* File: example2_str.c */ /* ------------------------------------------------------------- */ /* String API. */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* In this example we use a generic distribution object */ /* and sample from this distribution. */ /* */ /* The PDF of our distribution is given by */ /* */ /* / 1 - x*x if |x| <= 1 */ /* f(x) = < */ /* \ 0 otherwise */ /* */ /* We use method TDR (Transformed Density Rejection) which */ /* required a PDF and the derivative of the PDF. */ /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; /* will hold the random number */ /* Declare UNURAN generator object. */ UNUR_GEN *gen; /* generator object */ /* Create the generator object. */ /* Use a generic continuous distribution. */ /* Choose a method: TDR. */ gen = unur_str2gen( "distr = cont; pdf=\"1-x*x\"; domain=(-1,1) & method=tdr"); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ 2.7 Change parameters of the method =================================== Each method for generating random numbers allows several parameters to be modified. If you do not want to use default values, it is possible to change them. The following example illustrates how to change parameters. For details see *note Methods::. /* ------------------------------------------------------------- */ /* File: example3.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; /* will hold the random number */ double fparams[2]; /* array for parameters for distribution */ /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Use a predefined standard distribution: */ /* Gaussian with mean 2. and standard deviation 0.5. */ fparams[0] = 2.; fparams[1] = 0.5; distr = unur_distr_normal( fparams, 2 ); /* Choose a method: TDR. */ par = unur_tdr_new(distr); /* Change some of the default parameters. */ /* We want to use T(x)=log(x) for the transformation. */ unur_tdr_set_c( par, 0. ); /* We want to have the variant with immediate acceptance. */ unur_tdr_set_variant_ia( par ); /* We want to use 10 construction points for the setup */ unur_tdr_set_cpoints ( par, 10, NULL ); /* Create the generator object. */ gen = unur_init(par); /* Notice that this call has also destroyed the parameter */ /* object `par' as a side effect. */ /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* It is possible with method TDR to truncate the distribution */ /* for an existing generator object ... */ unur_tdr_chg_truncated( gen, -1., 0. ); /* ... and sample again. */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ 2.8 Change parameters of the method (String API) ================================================ Each method for generating random numbers allows several parameters to be modified. If you do not want to use default values, it is possible to change them. The following example illustrates how to change parameters. For details see *note Methods::. /* ------------------------------------------------------------- */ /* File: example3_str.c */ /* ------------------------------------------------------------- */ /* String API. */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; /* will hold the random number */ /* Declare UNURAN generator object. */ UNUR_GEN *gen; /* generator object */ /* Create the generator object. */ /* Use a predefined standard distribution: */ /* Gaussian with mean 2. and standard deviation 0.5. */ /* Choose a method: TDR with parameters */ /* c = 0: use T(x)=log(x) for the transformation; */ /* variant "immediate acceptance"; */ /* number of construction points = 10. */ gen = unur_str2gen( "normal(2,0.5) & method=tdr; c=0.; variant_ia; cpoints=10"); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* It is possible with method TDR to truncate the distribution */ /* for an existing generator object ... */ unur_tdr_chg_truncated( gen, -1., 0. ); /* ... and sample again. */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ 2.9 Change uniform random generator =================================== All generator object use the same default uniform random number generator by default. This can be changed to any generator of your choice such that each generator object has its own random number generator or can share it with some other objects. It is also possible to change the default generator at any time. See *note Using uniform random number generators: URNG, for details. The following example shows how the uniform random number generator can be set or changed for a generator object. It requires the RNGSTREAMS library to be installed and used. Otherwise the example must be modified accordingly. /* ------------------------------------------------------------- */ /* File: example_rngstreams.c */ /* ------------------------------------------------------------- */ #ifdef UNURAN_SUPPORTS_RNGSTREAM /* ------------------------------------------------------------- */ /* This example makes use of the RNGSTREAM library for */ /* for generating uniform random numbers. */ /* (see http://statmath.wu.ac.at/software/RngStreams/) */ /* To compile this example you must have set */ /* ./configure --with-urng-rngstream */ /* (Of course the executable has to be linked against the */ /* RNGSTREAM library.) */ /* ------------------------------------------------------------- */ /* Include UNURAN header files. */ #include #include /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; /* will hold the random number */ double fparams[2]; /* array for parameters for distribution */ /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Declare objects for uniform random number generators. */ UNUR_URNG *urng1, *urng2; /* uniform generator objects */ /* The RNGSTREAMS library sets a package seed. */ unsigned long seed[] = {111u, 222u, 333u, 444u, 555u, 666u}; RngStream_SetPackageSeed(seed); /* RngStreams only: */ /* Make a object for uniform random number generator. */ /* For details see */ /* http://statmath.wu.ac.at/software/RngStreams/ */ urng1 = unur_urng_rngstream_new("urng-1"); if (urng1 == NULL) exit (EXIT_FAILURE); /* Use a predefined standard distribution: */ /* Beta with parameters 2 and 3. */ fparams[0] = 2.; fparams[1] = 3.; distr = unur_distr_beta( fparams, 2 ); /* Choose a method: TDR. */ par = unur_tdr_new(distr); /* Set uniform generator in parameter object */ unur_set_urng( par, urng1 ); /* Create the generator object. */ gen = unur_init(par); /* Notice that this call has also destroyed the parameter */ /* object `par' as a side effect. */ /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* Now we want to switch to a different (independent) stream */ /* of uniform random numbers. */ urng2 = unur_urng_rngstream_new("urng-2"); if (urng2 == NULL) exit (EXIT_FAILURE); unur_chg_urng( gen, urng2 ); /* ... and sample again. */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); /* We also should destroy the uniform random number generators.*/ unur_urng_free(urng1); unur_urng_free(urng2); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ #else #include #include int main(void) { printf("You must enable the RNGSTREAM library to run this example!\n\n"); exit (77); /* exit code for automake check routines */ } #endif /* ------------------------------------------------------------- */ 2.10 Change parameters of underlying distribution ================================================= One a generator object has been created it allows to draw samples from the distribution with the given parameters. However, some methods allow to change the parameters of the underlying distribution and reinitialize the generator object again. Thus when the parameters of the distribution vary for each draw we save overhead for destroying the old object and creating a new one. The following example shows how the parameters of a GIG distribution can be changed when method CSTD is used. /* ------------------------------------------------------------- */ /* File: example_reinit.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* In this example we show how the parameters of the underlying */ /* distribution can be changed for an existing generator object. */ /* We use the GIG distribution with method CSTD. */ /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; /* will hold the random number */ /* Parameters of distribution. */ double dparam[3] = {0.5, 1., 5.}; /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Create initial GIG distribution object */ distr = unur_distr_gig(dparam, 3); /* Choose a method: CSTD. */ par = unur_cstd_new(distr); /* Create the generator object. */ gen = unur_init(par); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* It is possible for method CSTD to change the parameters of */ /* underlying distribution. However, we have to extract to */ /* pointer to the distribution. Be carefull with this pointer! */ distr = unur_get_distr(gen); /* Change the parameter(s). */ dparam[2] = 0.001; unur_distr_cont_set_pdfparams(distr,dparam,3); /* Do not forget to reinitialize the generator object. */ /* Check the return code. */ /* (and try to find a better error handling) */ if (unur_reinit(gen) != UNUR_SUCCESS) { fprintf(stderr, "ERROR: cannot reinitialize generator object\n"); exit (EXIT_FAILURE); } /* Draw a new sample. */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* Changing parameters can be repeated. */ dparam[2] = 1000; unur_distr_cont_set_pdfparams(distr,dparam,3); if (unur_reinit(gen) != UNUR_SUCCESS) { fprintf(stderr, "ERROR: cannot reinitialize generator object\n"); exit (EXIT_FAILURE); } for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ 2.11 Sample pairs of antithetic random variates =============================================== Using Method TDR it is easy to sample pairs of antithetic random variates. /* ------------------------------------------------------------- */ /* File: example_anti.c */ /* ------------------------------------------------------------- */ #ifdef UNURAN_SUPPORTS_PRNG /* ------------------------------------------------------------- */ /* This example makes use of the PRNG library for generating */ /* uniform random numbers. */ /* (see http://statmath.wu.ac.at/prng/) */ /* To compile this example you must have set */ /* ./configure --with-urng-prng */ /* (Of course the executable has to be linked against the */ /* PRNG library.) */ /* ------------------------------------------------------------- */ /* Example how to sample from two streams of antithetic random */ /* variates from Gaussian N(2,5) and Gamma(4) distribution, resp.*/ /* ------------------------------------------------------------- */ /* Include UNURAN header files. */ #include #include /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double xn, xg; /* will hold the random number */ double fparams[2]; /* array for parameters for distribution */ /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen_normal, *gen_gamma; /* generator objects */ /* Declare objects for uniform random number generators. */ UNUR_URNG *urng1, *urng2; /* uniform generator objects */ /* PRNG only: */ /* Make a object for uniform random number generator. */ /* For details see http://statmath.wu.ac.at/prng/. */ /* The first generator: Gaussian N(2,5) */ /* uniform generator: We use the Mersenne Twister. */ urng1 = unur_urng_prng_new("mt19937(1237)"); if (urng1 == NULL) exit (EXIT_FAILURE); /* UNURAN generator object for N(2,5) */ fparams[0] = 2.; fparams[1] = 5.; distr = unur_distr_normal( fparams, 2 ); /* Choose method TDR with variant PS. */ par = unur_tdr_new( distr ); unur_tdr_set_variant_ps( par ); /* Set uniform generator in parameter object. */ unur_set_urng( par, urng1 ); /* Set auxilliary uniform random number generator. */ /* We use the default generator. */ unur_use_urng_aux_default( par ); /* Alternatively you can create and use your own auxilliary */ /* uniform random number generator: */ /* UNUR_URNG *urng_aux; */ /* urng_aux = unur_urng_prng_new("tt800"); */ /* if (urng_aux == NULL) exit (EXIT_FAILURE); */ /* unur_set_urng_aux( par, urng_aux ); */ /* Create the generator object. */ gen_normal = unur_init(par); if (gen_normal == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* Destroy distribution object (gen_normal has its own copy). */ unur_distr_free(distr); /* The second generator: Gamma(4) with antithetic variates. */ /* uniform generator: We use the Mersenne Twister. */ urng2 = unur_urng_prng_new("anti(mt19937(1237))"); if (urng2 == NULL) exit (EXIT_FAILURE); /* UNURAN generator object for gamma(4) */ fparams[0] = 4.; distr = unur_distr_gamma( fparams, 1 ); /* Choose method TDR with variant PS. */ par = unur_tdr_new( distr ); unur_tdr_set_variant_ps( par ); /* Set uniform generator in parameter object. */ unur_set_urng( par, urng2 ); /* Set auxilliary uniform random number generator. */ /* We use the default generator. */ unur_use_urng_aux_default( par ); /* Alternatively you can create and use your own auxilliary */ /* uniform random number generator (see above). */ /* Notice that both generator objects gen_normal and */ /* gen_gamma can share the same auxilliary URNG. */ /* Create the generator object. */ gen_gamma = unur_init(par); if (gen_gamma == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* Destroy distribution object (gen_normal has its own copy). */ unur_distr_free(distr); /* Now we can sample pairs of negatively correlated random */ /* variates. E.g.: */ for (i=0; i<10; i++) { xn = unur_sample_cont(gen_normal); xg = unur_sample_cont(gen_gamma); printf("%g, %g\n",xn,xg); } /* When you do not need the generator objects any more, you */ /* can destroy it. */ unur_free(gen_normal); unur_free(gen_gamma); /* We also should destroy the uniform random number generators.*/ unur_urng_free(urng1); unur_urng_free(urng2); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ #else #include #include int main(void) { printf("You must enable the PRNG library to run this example!\n\n"); exit (77); /* exit code for automake check routines */ } #endif /* ------------------------------------------------------------- */ 2.12 Sample pairs of antithetic random variates (String API) ============================================================ Using Method TDR it is easy to sample pairs of antithetic random variates. /* ------------------------------------------------------------- */ /* File: example_anti_str.c */ /* ------------------------------------------------------------- */ /* String API. */ /* ------------------------------------------------------------- */ #ifdef UNURAN_SUPPORTS_PRNG /* ------------------------------------------------------------- */ /* This example makes use of the PRNG library for generating */ /* uniform random numbers. */ /* (see http://statmath.wu.ac.at/prng/) */ /* To compile this example you must have set */ /* ./configure --with-urng-prng */ /* (Of course the executable has to be linked against the */ /* PRNG library.) */ /* ------------------------------------------------------------- */ /* Example how to sample from two streams of antithetic random */ /* variates from Gaussian N(2,5) and Gamma(4) distribution, resp.*/ /* ------------------------------------------------------------- */ /* Include UNURAN header files. */ #include #include /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double xn, xg; /* will hold the random number */ /* Declare UNURAN generator objects. */ UNUR_GEN *gen_normal, *gen_gamma; /* PRNG only: */ /* Make a object for uniform random number generator. */ /* For details see http://statmath.wu.ac.at/prng/. */ /* Create the first generator: Gaussian N(2,5) */ gen_normal = unur_str2gen("normal(2,5) & method=tdr; variant_ps & urng=mt19937(1237)"); if (gen_normal == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* Set auxilliary uniform random number generator. */ /* We use the default generator. */ unur_chgto_urng_aux_default(gen_normal); /* The second generator: Gamma(4) with antithetic variates. */ gen_gamma = unur_str2gen("gamma(4) & method=tdr; variant_ps & urng=anti(mt19937(1237))"); if (gen_gamma == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } unur_chgto_urng_aux_default(gen_gamma); /* Now we can sample pairs of negatively correlated random */ /* variates. E.g.: */ for (i=0; i<10; i++) { xn = unur_sample_cont(gen_normal); xg = unur_sample_cont(gen_gamma); printf("%g, %g\n",xn,xg); } /* When you do not need the generator objects any more, you */ /* can destroy it. */ /* But first we have to destroy the uniform random number */ /* generators. */ unur_urng_free(unur_get_urng(gen_normal)); unur_urng_free(unur_get_urng(gen_gamma)); unur_free(gen_normal); unur_free(gen_gamma); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ #else #include #include int main(void) { printf("You must enable the PRNG library to run this example!\n\n"); exit (77); /* exit code for automake check routines */ } #endif /* ------------------------------------------------------------- */ 2.13 More examples ================== *Note Methods for continuous univariate distributions: Methods_for_CONT. *Note Methods for continuous empirical univariate distributions: Methods_for_CEMP. *Note Methods for continuous empirical multivariate distributions: Methods_for_CVEMP. *Note Methods for discrete univariate distributions: Methods_for_DISCR. 3 String Interface ****************** The string interface (string API) provided by the ‘unur_str2gen’ call is the easiest way to use UNU.RAN. This function takes a character string as its argument. The string is parsed and the information obtained is used to create a generator object. It returns ‘NULL’ if this fails, either due to a syntax error, or due to invalid data. In both cases ‘unur_error’ is set to the corresponding error codes (*note Error reporting: Error_reporting.). Additionally there exists the call ‘unur_str2distr’ that only produces a distribution object. Notice that the string interface does not implement all features of the UNU.RAN library. For trickier tasks it might be necessary to use the UNU.RAN calls. In *note Examples::, all examples are given using both the UNU.RAN standard API and this convenient string API. The corresponding programm codes are equivalent. Function reference ------------------ -- Function: UNUR_GEN* unur_str2gen (const CHAR* STRING) Get a generator object for the distribution, method and uniform random number generator as described in the given STRING. See *note Syntax of String Interface: StringSyntax, for details. -- Function: UNUR_DISTR* unur_str2distr (const CHAR* STRING) Get a distribution object for the distribution described in STRING. See *note Syntax of String Interface: StringSyntax, and *note Distribution String: StringDistr, for details. However, only the block for the distribution object is allowed. -- Function: UNUR_GEN* unur_makegen_ssu (const CHAR* DISTRSTR, const CHAR* METHODSTR, UNUR_URNG* URNG) -- Function: UNUR_GEN* unur_makegen_dsu (const UNUR_DISTR* DISTRIBUTION, const CHAR* METHODSTR, UNUR_URNG* URNG) Make a generator object for the distribution, method and uniform random number generator. The distribution can be given either as string DISTRSTR or as a distribution object DISTR. The method must be given as a string METHODSTR. For the syntax of these strings see *note Syntax of String Interface: StringSyntax. However, the ‘method’ keyword is optional for these calls and can be omitted. If METHODSTR is the empty (blank) string or ‘NULL’ method AUTO is used. The uniform random number generator is optional. If URNG is ‘NULL’ then the default uniform random number generator is used. 3.1 Syntax of String Interface ============================== The given string holds information about the requested distribution and (optional) about the sampling method and the uniform random number generator invoked. The interpretation of the string is not case-sensitive, all white spaces are ignored. The string consists of up to three blocks, separated by ampersands ‘&’. Each block consists of ‘=’ pairs, separated by semicolons ‘;’. The first key in each block is used to indicate each block. We have three different blocks with the following (first) keys: ‘distr’ definition of the distribution (*note Distribution String: StringDistr.). ‘method’ description of the transformation method (*note Method String: StringMethod.). ‘urng’ uniform random number generation (*note Uniform RNG String: StringURNG.). The ‘distr’ block must be the very first block and is obligatory. All the other blocks are optional and can be arranged in arbitrary order. For details see the following description of each block. In the following example distr = normal(3.,0.75); domain = (0,inf) & method = tdr; c = 0 we have a distribution block for the truncated normal distribution with mean 3 and standard deviation 0.75 on domain (0,infinity); and block for choosing method TDR with parameter c set to 0. The ‘=’ pairs that follow the first (initial) pair in each block are used to set parameters. The name of the parameter is given by the ‘’ string. It is deduced from the UNU.RAN set calls by taking the part after ‘..._set_’. The ‘’ string holds the parameters to be set, separated by commata ‘,’. There are three types of parameters: _string ‘"..."’ or ‘'...'’_ i.e. any sequence of characters enclosed by double quotes ‘"..."’ or single quotes ‘'...'’ (there is no distinction between double quotes ‘"’ and single quotes ‘'’). _list ‘(...,...)’_ i.e. list of _numbers_, separated by commata ‘,’, enclosed in parenthesis ‘(...)’. _number_ a sequence of characters that is not enclosed by double quotes ‘"..."’, single quotes ‘'...'’, or parenthesis ‘(...)’. It is interpreted as float or integer depending on the type of the corresponding parameter. The ‘’ string (including the character ‘=’) can be omitted when no argument is required. At the moment not all ‘set’ calls are supported. The syntax for the ‘’ can be directly derived from the corresponding ‘set’ calls. To simplify the syntax additional shortcuts are possible. The following table lists the parameters for the ‘set’ calls that are supported by the string interface; the entry in parenthesis gives the type of the argument as ‘’ string: ‘int (number):’ The number is interpreted as an integer. ‘true’ and ‘on’ are transformed to ‘1’, ‘false’ and ‘off’ are transformed to ‘0’. A missing argument is interpreted as ‘1’. ‘int, int (number, number or list):’ The two numbers or the first two entries in the list are interpreted as a integers. ‘inf’ and ‘-inf’ are transformed to ‘INT_MAX’ and ‘INT_MIN’ respectively, i.e. the largest and smallest integers that can be represented by the computer. ‘unsigned (number):’ The number is interpreted as an unsigned hexadecimal integer. ‘double (number):’ The number is interpreted as a floating point number. ‘inf’ is transformed to ‘UNUR_INFINITY’. ‘double, double (number, number or list):’ The two numbers or the first two entries in the list are interpreted as a floating point numbers. ‘inf’ is transformed to ‘UNUR_INFINITY’. However using ‘inf’ in the list might not work for all versions of C. Then it is recommended to use two single numbers instead of a list. ‘int, double* ([number,] list or number):’ − The list is interpreted as a double array. The (first) number as its length. If it is less than the actual size of the array only the first entries of the array are used. − If only the list is given (i.e., if the first number is omitted), the first number is set to the actual size of the array. − If only the number is given (i.e., if the list is omitted), the ‘NULL’ pointer is used instead an array as argument. ‘double*, int (list [,number]):’ The list is interpreted as a double array. The (second) number as its length. If the length is omitted, it is replaced by the actual size of the array. (Only in the ‘distribution’ block!) ‘char* (string):’ The character string is passed as is to the corresponding set call. Notice that missing entries in a list of numbers are interpreted as ‘0’. E.g, a the list ‘(1,,3)’ is read as ‘(1,0,3)’, the list ‘(1,2,)’ as ‘(1,2,0)’. The the list of ‘key’ strings in *note Keys for Distribution String: KeysDistr, and *note Keys for Method String: KeysMethod, for further details. 3.2 Distribution String ======================= The ‘distr’ block must be the very first block and is obligatory. For that reason the keyword ‘distr’ is optional and can be omitted (together with the ‘=’ character). Moreover it is ignored while parsing the string. However, to avoid some possible confusion it has to start with the letter ‘d’ (if it is given at all). The value of the ‘distr’ key is used to get the distribution object, either via a ‘unur_distr_’ call for a standard distribution via a ‘unur_distr__new’ call to get an object of a generic distribution. However not all generic distributions are supported yet. The parameters for the standard distribution are given as a list. There must not be any character (other than white space) between the name of the standard distribution and the opening parenthesis ‘(’ of this list. E.g., to get a beta distribution, use distr = beta(2,4) To get an object for a discrete distribution with probability vector (0.5,0.2,0.3), use distr = discr; pv = (0.5,0.2,0.3) It is also possible to set a PDF, PMF, or CDF using a string. E.g., to create a continuous distribution with PDF proportional to ‘exp(-sqrt(2+(x-1)^2) + (x-1))’ and domain (0,inf) use distr = cont; pdf = "exp(-sqrt(2+(x-1)^2) + (x-1))" Notice: If this string is used in an ‘unur_str2distr’ or ‘unur_str2gen’ call the double quotes ‘"’ must be protected by ‘\"’. Alternatively, single quotes may be used instead distr = cont; pdf = 'exp(-sqrt(2+(x-1)^2) + (x-1))' For the details of function strings see *note Function String: StringFunct. 3.2.1 Keys for Distribution String ---------------------------------- List of standard distributions *note Standard distributions: Stddist. − ‘[distr =] beta(...)’ ⇒ *note beta:: − ‘[distr =] binomial(...)’ ⇒ *note binomial:: − ‘[distr =] cauchy(...)’ ⇒ *note cauchy:: − ‘[distr =] chi(...)’ ⇒ *note chi:: − ‘[distr =] chisquare(...)’ ⇒ *note chisquare:: − ‘[distr =] exponential(...)’ ⇒ *note exponential:: − ‘[distr =] extremeI(...)’ ⇒ *note extremeI:: − ‘[distr =] extremeII(...)’ ⇒ *note extremeII:: − ‘[distr =] F(...)’ ⇒ *note F:: − ‘[distr =] gamma(...)’ ⇒ *note gamma:: − ‘[distr =] geometric(...)’ ⇒ *note geometric:: − ‘[distr =] gig(...)’ ⇒ *note gig:: − ‘[distr =] gig2(...)’ ⇒ *note gig2:: − ‘[distr =] hyperbolic(...)’ ⇒ *note hyperbolic:: − ‘[distr =] hypergeometric(...)’ ⇒ *note hypergeometric:: − ‘[distr =] ig(...)’ ⇒ *note ig:: − ‘[distr =] laplace(...)’ ⇒ *note laplace:: − ‘[distr =] logarithmic(...)’ ⇒ *note logarithmic:: − ‘[distr =] logistic(...)’ ⇒ *note logistic:: − ‘[distr =] lognormal(...)’ ⇒ *note lognormal:: − ‘[distr =] lomax(...)’ ⇒ *note lomax:: − ‘[distr =] negativebinomial(...)’ ⇒ *note negativebinomial:: − ‘[distr =] normal(...)’ ⇒ *note normal:: − ‘[distr =] pareto(...)’ ⇒ *note pareto:: − ‘[distr =] poisson(...)’ ⇒ *note poisson:: − ‘[distr =] powerexponential(...)’ ⇒ *note powerexponential:: − ‘[distr =] rayleigh(...)’ ⇒ *note rayleigh:: − ‘[distr =] slash(...)’ ⇒ *note slash:: − ‘[distr =] student(...)’ ⇒ *note student:: − ‘[distr =] triangular(...)’ ⇒ *note triangular:: − ‘[distr =] uniform(...)’ ⇒ *note uniform:: − ‘[distr =] weibull(...)’ ⇒ *note weibull:: List of generic distributions *note Handling Distribution Objects: Distribution_objects. − ‘[distr =] cemp’ ⇒ *note CEMP:: − ‘[distr =] cont’ ⇒ *note CONT:: − ‘[distr =] discr’ ⇒ *note DISCR:: _Notice_: Order statistics for continuous distributions (*note CORDER::) are supported by using the key ‘orderstatistics’ for distributions of type ‘CONT’. List of keys that are available via the String API. For description see the corresponding UNU.RAN set calls. • All distribution types ‘name = ""’ ⇒ *note ‘unur_distr_set_name’: funct:unur_distr_set_name. • ‘cemp’ (Distribution Type) (*note CEMP::) ‘data = () [, ]’ ⇒ *note ‘unur_distr_cemp_set_data’: funct:unur_distr_cemp_set_data. ‘hist_bins = () [, ]’ ⇒ *note ‘unur_distr_cemp_set_hist_bins’: funct:unur_distr_cemp_set_hist_bins. ‘hist_domain = , | ()’ ⇒ *note ‘unur_distr_cemp_set_hist_domain’: funct:unur_distr_cemp_set_hist_domain. ‘hist_prob = () [, ]’ ⇒ *note ‘unur_distr_cemp_set_hist_prob’: funct:unur_distr_cemp_set_hist_prob. • ‘cont’ (Distribution Type) (*note CONT::) ‘cdf = ""’ ⇒ *note ‘unur_distr_cont_set_cdfstr’: funct:unur_distr_cont_set_cdfstr. ‘center = ’ ⇒ *note ‘unur_distr_cont_set_center’: funct:unur_distr_cont_set_center. ‘domain = , | ()’ ⇒ *note ‘unur_distr_cont_set_domain’: funct:unur_distr_cont_set_domain. ‘hr = ""’ ⇒ *note ‘unur_distr_cont_set_hrstr’: funct:unur_distr_cont_set_hrstr. ‘logcdf = ""’ ⇒ *note ‘unur_distr_cont_set_logcdfstr’: funct:unur_distr_cont_set_logcdfstr. ‘logpdf = ""’ ⇒ *note ‘unur_distr_cont_set_logpdfstr’: funct:unur_distr_cont_set_logpdfstr. ‘mode = ’ ⇒ *note ‘unur_distr_cont_set_mode’: funct:unur_distr_cont_set_mode. ‘pdf = ""’ ⇒ *note ‘unur_distr_cont_set_pdfstr’: funct:unur_distr_cont_set_pdfstr. ‘pdfarea = ’ ⇒ *note ‘unur_distr_cont_set_pdfarea’: funct:unur_distr_cont_set_pdfarea. ‘pdfparams = () [, ]’ ⇒ *note ‘unur_distr_cont_set_pdfparams’: funct:unur_distr_cont_set_pdfparams. ‘orderstatistics = , | ()’ Make order statistics for given distribution. The first parameter gives the sample size, the second parameter its rank. (see *note ‘unur_distr_corder_new’: funct:unur_distr_corder_new.) • ‘discr’ (Distribution Type) (*note DISCR::) ‘cdf = ""’ ⇒ *note ‘unur_distr_discr_set_cdfstr’: funct:unur_distr_discr_set_cdfstr. ‘domain = , | ()’ ⇒ *note ‘unur_distr_discr_set_domain’: funct:unur_distr_discr_set_domain. ‘mode [= ]’ ⇒ *note ‘unur_distr_discr_set_mode’: funct:unur_distr_discr_set_mode. ‘pmf = ""’ ⇒ *note ‘unur_distr_discr_set_pmfstr’: funct:unur_distr_discr_set_pmfstr. ‘pmfparams = () [, ]’ ⇒ *note ‘unur_distr_discr_set_pmfparams’: funct:unur_distr_discr_set_pmfparams. ‘pmfsum = ’ ⇒ *note ‘unur_distr_discr_set_pmfsum’: funct:unur_distr_discr_set_pmfsum. ‘pv = () [, ]’ ⇒ *note ‘unur_distr_discr_set_pv’: funct:unur_distr_discr_set_pv. 3.3 Function String =================== In unuran it is also possible to define functions (e.g. CDF or PDF) as strings. As you can see in Example 2 (*note Example_2_str::) it is very easy to define the PDF of a distribution object by means of a string. The possibilities using this string interface are more restricted than using a pointer to a routine coded in C (*note Example_2::). But the differences in evaluation time is small. When a distribution object is defined using this string interface then of course the same conditions on the given density or CDF must be satisfied for a chosen method as for the standard API. This string interface can be used for both within the UNU.RAN string API using the ‘unur_str2gen’ call, and for calls that define the density or CDF for a particular distribution object as done with (e.g.) the call ‘unur_distr_cont_set_pdfstr’. Here is an example for the latter case: unur_distr_cont_set_pdfstr(distr,"1-x*x"); Syntax ------ The syntax for the function string is case insensitive, white spaces are ingnored. The expressions are similar to most programming languages and mathematical programs (see also the examples below). It is especially influenced by C. The usual preceedence rules are used (from highest to lowest preceedence: functions, power, multiplication, addition, relation operators). Use parentheses in case of doubt or when these preceedences should be changed. Relation operators can be used as indicator functions, i.e. the term ‘(x>1)’ is evaluted as ‘1’ if this relation is satisfied, and as ‘0’ otherwise. The first unknown symbol (letter or word) is interpreted as the variable of the function. It is recommended to use ‘x’. Only one variable can be used. _Important_: The symbol ‘e’ is used twice, for Euler’s constant (= 2.7182...) and as exponent. The multiplication operator ‘*’ must not be omitted, i.e. ‘2 x’ is interpreted as the string ‘2x’ (which will result in a syntax error). List of symbols --------------- Numbers Numbers are composed using digits and, optionally, a sign, a decimal point, and an exponent indicated by ‘e’. Symbol Explanation Examples ‘0...9’ digits ‘2343’ ‘.’ decimal point ‘165.567’ ‘-’ negative sign ‘-465.223’ ‘e’ exponet ‘13.2e-4’ (=0.00132) Constants ‘pi’ pi = 3.1415... ‘3*pi+2’ ‘e’ Euler’s constant ‘3*e+2’ (= 10.15...; do not cofuse with ‘3e2’ = 300) ‘inf’ infinity (used for domains) Special symbols ‘(’ opening parenthesis ‘2*(3+x)’ ‘)’ closing parenthesis ‘2*(3+x)’ ‘,’ (argument) list separator ‘mod(13,2)’ Relation operators (Indicator functions) ‘<’ less than ‘(x<1)’ ‘=’ equal ‘(2=x)’ ‘==’ same as ‘=’ ‘(x==3)’ ‘>’ greater than ‘(x>0)’ ‘<=’ less than or equal ‘(x<=1)’ ‘!=’ not equal ‘(x!0)’ ‘<>’ same as ‘!=’ ‘(x<>pi)’ ‘>=’ greater or equal ‘(x>=1)’ Arithmetic operators ‘+’ addition ‘2+x’ ‘-’ subtraction ‘2-x’ ‘*’ multiplication ‘2*x’ ‘/’ division ‘x/2’ ‘^’ power ‘x^2’ Functions ‘mod’ ‘mod(m,n)’ remainder of mod(x,2) devision m over n ‘exp’ exponential function ‘exp(-x^2)’ (same as (same as ‘e^x’) ‘e^(-x^2)’) ‘log’ natural logarithm ‘log(x)’ ‘sin’ sine ‘sin(x)’ ‘cos’ cosine ‘cos(x)’ ‘tan’ tangent ‘tan(x)’ ‘sec’ secant ‘sec(x*2)’ ‘sqrt’ square root ‘sqrt(2*x)’ ‘abs’ absolute value ‘abs(x)’ ‘sgn’ sign function ‘sign(x)*3’ Variable ‘x’ variable ‘3*x^2’ Examples -------- 1.231+7.9876*x-1.234e-3*x^2+3.335e-5*x^3 sin(2*pi*x)+x^2 exp(-((x-3)/2.1)^2) It is also possible to define functions using different terms on separate domains. However, instead of constructs using ‘if ... then ... else ...’ indicator functions are available. For example to define the density of triangular distribution with domain (-1,1) and mode 0 use (x>-1)*(x<0)*(1+x) + (x>=0)*(x<1)*(1-x) 3.4 Method String ================= The key ‘method’ is obligatory, it must be the first key and its value is the name of a method suitable for the choosen standard distribution. E.g., if method AROU is chosen, use method = arou Of course the all following keys dependend on the method choosen at first. All corresponding ‘set’ calls of UNU.RAN are available and the key is the string after the ‘unur__set_’ part of the command. E.g., UNU.RAN provides the command ‘unur_arou_set_max_sqhratio’ to set a parameter of method AROU. To call this function via the string-interface, the key ‘max_sqhratio’ can be used: max_sqhratio = 0.9 Additionally the keyword ‘debug’ can be used to set debugging flags (see *note Debugging: Debug, for details). If this block is omitted, a suitable default method is used. Notice however that the default method may change in future versions of UNU.RAN. 3.4.1 Keys for Method String ---------------------------- List of methods and keys that are available via the String API. For description see the corresponding UNU.RAN set calls. • ‘method = arou’ ⇒ ‘unur_arou_new’ (*note AROU::) ‘cpoints = [, ()] | ()’ ⇒ *note ‘unur_arou_set_cpoints’: funct:unur_arou_set_cpoints. ‘darsfactor = ’ ⇒ *note ‘unur_arou_set_darsfactor’: funct:unur_arou_set_darsfactor. ‘guidefactor = ’ ⇒ *note ‘unur_arou_set_guidefactor’: funct:unur_arou_set_guidefactor. ‘max_segments [= ]’ ⇒ *note ‘unur_arou_set_max_segments’: funct:unur_arou_set_max_segments. ‘max_sqhratio = ’ ⇒ *note ‘unur_arou_set_max_sqhratio’: funct:unur_arou_set_max_sqhratio. ‘pedantic [= ]’ ⇒ *note ‘unur_arou_set_pedantic’: funct:unur_arou_set_pedantic. ‘usecenter [= ]’ ⇒ *note ‘unur_arou_set_usecenter’: funct:unur_arou_set_usecenter. ‘usedars [= ]’ ⇒ *note ‘unur_arou_set_usedars’: funct:unur_arou_set_usedars. ‘verify [= ]’ ⇒ *note ‘unur_arou_set_verify’: funct:unur_arou_set_verify. • ‘method = ars’ ⇒ ‘unur_ars_new’ (*note ARS::) ‘cpoints = [, ()] | ()’ ⇒ *note ‘unur_ars_set_cpoints’: funct:unur_ars_set_cpoints. ‘max_intervals [= ]’ ⇒ *note ‘unur_ars_set_max_intervals’: funct:unur_ars_set_max_intervals. ‘max_iter [= ]’ ⇒ *note ‘unur_ars_set_max_iter’: funct:unur_ars_set_max_iter. ‘pedantic [= ]’ ⇒ *note ‘unur_ars_set_pedantic’: funct:unur_ars_set_pedantic. ‘reinit_ncpoints [= ]’ ⇒ *note ‘unur_ars_set_reinit_ncpoints’: funct:unur_ars_set_reinit_ncpoints. ‘reinit_percentiles = [, ()] | ()’ ⇒ *note ‘unur_ars_set_reinit_percentiles’: funct:unur_ars_set_reinit_percentiles. ‘verify [= ]’ ⇒ *note ‘unur_ars_set_verify’: funct:unur_ars_set_verify. • ‘method = auto’ ⇒ ‘unur_auto_new’ (*note AUTO::) ‘logss [= ]’ ⇒ *note ‘unur_auto_set_logss’: funct:unur_auto_set_logss. • ‘method = cstd’ ⇒ ‘unur_cstd_new’ (*note CSTD::) ‘variant = ’ ⇒ *note ‘unur_cstd_set_variant’: funct:unur_cstd_set_variant. • ‘method = dari’ ⇒ ‘unur_dari_new’ (*note DARI::) ‘cpfactor = ’ ⇒ *note ‘unur_dari_set_cpfactor’: funct:unur_dari_set_cpfactor. ‘squeeze [= ]’ ⇒ *note ‘unur_dari_set_squeeze’: funct:unur_dari_set_squeeze. ‘tablesize [= ]’ ⇒ *note ‘unur_dari_set_tablesize’: funct:unur_dari_set_tablesize. ‘verify [= ]’ ⇒ *note ‘unur_dari_set_verify’: funct:unur_dari_set_verify. • ‘method = dau’ ⇒ ‘unur_dau_new’ (*note DAU::) ‘urnfactor = ’ ⇒ *note ‘unur_dau_set_urnfactor’: funct:unur_dau_set_urnfactor. • ‘method = dgt’ ⇒ ‘unur_dgt_new’ (*note DGT::) ‘guidefactor = ’ ⇒ *note ‘unur_dgt_set_guidefactor’: funct:unur_dgt_set_guidefactor. ‘variant = ’ ⇒ *note ‘unur_dgt_set_variant’: funct:unur_dgt_set_variant. • ‘method = dsrou’ ⇒ ‘unur_dsrou_new’ (*note DSROU::) ‘cdfatmode = ’ ⇒ *note ‘unur_dsrou_set_cdfatmode’: funct:unur_dsrou_set_cdfatmode. ‘verify [= ]’ ⇒ *note ‘unur_dsrou_set_verify’: funct:unur_dsrou_set_verify. • ‘method = dstd’ ⇒ ‘unur_dstd_new’ (*note DSTD::) ‘variant = ’ ⇒ *note ‘unur_dstd_set_variant’: funct:unur_dstd_set_variant. • ‘method = empk’ ⇒ ‘unur_empk_new’ (*note EMPK::) ‘beta = ’ ⇒ *note ‘unur_empk_set_beta’: funct:unur_empk_set_beta. ‘kernel = ’ ⇒ *note ‘unur_empk_set_kernel’: funct:unur_empk_set_kernel. ‘positive [= ]’ ⇒ *note ‘unur_empk_set_positive’: funct:unur_empk_set_positive. ‘smoothing = ’ ⇒ *note ‘unur_empk_set_smoothing’: funct:unur_empk_set_smoothing. ‘varcor [= ]’ ⇒ *note ‘unur_empk_set_varcor’: funct:unur_empk_set_varcor. • ‘method = gibbs’ ⇒ ‘unur_gibbs_new’ (*note GIBBS::) ‘burnin [= ]’ ⇒ *note ‘unur_gibbs_set_burnin’: funct:unur_gibbs_set_burnin. ‘c = ’ ⇒ *note ‘unur_gibbs_set_c’: funct:unur_gibbs_set_c. ‘thinning [= ]’ ⇒ *note ‘unur_gibbs_set_thinning’: funct:unur_gibbs_set_thinning. ‘variant_coordinate’ ⇒ *note ‘unur_gibbs_set_variant_coordinate’: funct:unur_gibbs_set_variant_coordinate. ‘variant_random_direction’ ⇒ *note ‘unur_gibbs_set_variant_random_direction’: funct:unur_gibbs_set_variant_random_direction. • ‘method = hinv’ ⇒ ‘unur_hinv_new’ (*note HINV::) ‘boundary = , | ()’ ⇒ *note ‘unur_hinv_set_boundary’: funct:unur_hinv_set_boundary. ‘cpoints = (), ’ ⇒ *note ‘unur_hinv_set_cpoints’: funct:unur_hinv_set_cpoints. ‘guidefactor = ’ ⇒ *note ‘unur_hinv_set_guidefactor’: funct:unur_hinv_set_guidefactor. ‘max_intervals [= ]’ ⇒ *note ‘unur_hinv_set_max_intervals’: funct:unur_hinv_set_max_intervals. ‘order [= ]’ ⇒ *note ‘unur_hinv_set_order’: funct:unur_hinv_set_order. ‘u_resolution = ’ ⇒ *note ‘unur_hinv_set_u_resolution’: funct:unur_hinv_set_u_resolution. • ‘method = hitro’ ⇒ ‘unur_hitro_new’ (*note HITRO::) ‘adaptive_multiplier = ’ ⇒ *note ‘unur_hitro_set_adaptive_multiplier’: funct:unur_hitro_set_adaptive_multiplier. ‘burnin [= ]’ ⇒ *note ‘unur_hitro_set_burnin’: funct:unur_hitro_set_burnin. ‘r = ’ ⇒ *note ‘unur_hitro_set_r’: funct:unur_hitro_set_r. ‘thinning [= ]’ ⇒ *note ‘unur_hitro_set_thinning’: funct:unur_hitro_set_thinning. ‘use_adaptiveline [= ]’ ⇒ *note ‘unur_hitro_set_use_adaptiveline’: funct:unur_hitro_set_use_adaptiveline. ‘use_adaptiverectangle [= ]’ ⇒ *note ‘unur_hitro_set_use_adaptiverectangle’: funct:unur_hitro_set_use_adaptiverectangle. ‘use_boundingrectangle [= ]’ ⇒ *note ‘unur_hitro_set_use_boundingrectangle’: funct:unur_hitro_set_use_boundingrectangle. ‘v = ’ ⇒ *note ‘unur_hitro_set_v’: funct:unur_hitro_set_v. ‘variant_coordinate’ ⇒ *note ‘unur_hitro_set_variant_coordinate’: funct:unur_hitro_set_variant_coordinate. ‘variant_random_direction’ ⇒ *note ‘unur_hitro_set_variant_random_direction’: funct:unur_hitro_set_variant_random_direction. • ‘method = hrb’ ⇒ ‘unur_hrb_new’ (*note HRB::) ‘upperbound = ’ ⇒ *note ‘unur_hrb_set_upperbound’: funct:unur_hrb_set_upperbound. ‘verify [= ]’ ⇒ *note ‘unur_hrb_set_verify’: funct:unur_hrb_set_verify. • ‘method = hrd’ ⇒ ‘unur_hrd_new’ (*note HRD::) ‘verify [= ]’ ⇒ *note ‘unur_hrd_set_verify’: funct:unur_hrd_set_verify. • ‘method = hri’ ⇒ ‘unur_hri_new’ (*note HRI::) ‘p0 = ’ ⇒ *note ‘unur_hri_set_p0’: funct:unur_hri_set_p0. ‘verify [= ]’ ⇒ *note ‘unur_hri_set_verify’: funct:unur_hri_set_verify. • ‘method = itdr’ ⇒ ‘unur_itdr_new’ (*note ITDR::) ‘cp = ’ ⇒ *note ‘unur_itdr_set_cp’: funct:unur_itdr_set_cp. ‘ct = ’ ⇒ *note ‘unur_itdr_set_ct’: funct:unur_itdr_set_ct. ‘verify [= ]’ ⇒ *note ‘unur_itdr_set_verify’: funct:unur_itdr_set_verify. ‘xi = ’ ⇒ *note ‘unur_itdr_set_xi’: funct:unur_itdr_set_xi. • ‘method = mvtdr’ ⇒ ‘unur_mvtdr_new’ (*note MVTDR::) ‘boundsplitting = ’ ⇒ *note ‘unur_mvtdr_set_boundsplitting’: funct:unur_mvtdr_set_boundsplitting. ‘maxcones [= ]’ ⇒ *note ‘unur_mvtdr_set_maxcones’: funct:unur_mvtdr_set_maxcones. ‘stepsmin [= ]’ ⇒ *note ‘unur_mvtdr_set_stepsmin’: funct:unur_mvtdr_set_stepsmin. ‘verify [= ]’ ⇒ *note ‘unur_mvtdr_set_verify’: funct:unur_mvtdr_set_verify. • ‘method = ninv’ ⇒ ‘unur_ninv_new’ (*note NINV::) ‘max_iter [= ]’ ⇒ *note ‘unur_ninv_set_max_iter’: funct:unur_ninv_set_max_iter. ‘start = , | ()’ ⇒ *note ‘unur_ninv_set_start’: funct:unur_ninv_set_start. ‘table [= ]’ ⇒ *note ‘unur_ninv_set_table’: funct:unur_ninv_set_table. ‘u_resolution = ’ ⇒ *note ‘unur_ninv_set_u_resolution’: funct:unur_ninv_set_u_resolution. ‘usebisect’ ⇒ *note ‘unur_ninv_set_usebisect’: funct:unur_ninv_set_usebisect. ‘usenewton’ ⇒ *note ‘unur_ninv_set_usenewton’: funct:unur_ninv_set_usenewton. ‘useregula’ ⇒ *note ‘unur_ninv_set_useregula’: funct:unur_ninv_set_useregula. ‘x_resolution = ’ ⇒ *note ‘unur_ninv_set_x_resolution’: funct:unur_ninv_set_x_resolution. • ‘method = nrou’ ⇒ ‘unur_nrou_new’ (*note NROU::) ‘center = ’ ⇒ *note ‘unur_nrou_set_center’: funct:unur_nrou_set_center. ‘r = ’ ⇒ *note ‘unur_nrou_set_r’: funct:unur_nrou_set_r. ‘u = , | ()’ ⇒ *note ‘unur_nrou_set_u’: funct:unur_nrou_set_u. ‘v = ’ ⇒ *note ‘unur_nrou_set_v’: funct:unur_nrou_set_v. ‘verify [= ]’ ⇒ *note ‘unur_nrou_set_verify’: funct:unur_nrou_set_verify. • ‘method = pinv’ ⇒ ‘unur_pinv_new’ (*note PINV::) ‘boundary = , | ()’ ⇒ *note ‘unur_pinv_set_boundary’: funct:unur_pinv_set_boundary. ‘extra_testpoints [= ]’ ⇒ *note ‘unur_pinv_set_extra_testpoints’: funct:unur_pinv_set_extra_testpoints. ‘keepcdf [= ]’ ⇒ *note ‘unur_pinv_set_keepcdf’: funct:unur_pinv_set_keepcdf. ‘max_intervals [= ]’ ⇒ *note ‘unur_pinv_set_max_intervals’: funct:unur_pinv_set_max_intervals. ‘order [= ]’ ⇒ *note ‘unur_pinv_set_order’: funct:unur_pinv_set_order. ‘searchboundary = , | ()’ ⇒ *note ‘unur_pinv_set_searchboundary’: funct:unur_pinv_set_searchboundary. ‘smoothness [= ]’ ⇒ *note ‘unur_pinv_set_smoothness’: funct:unur_pinv_set_smoothness. ‘u_resolution = ’ ⇒ *note ‘unur_pinv_set_u_resolution’: funct:unur_pinv_set_u_resolution. ‘use_upoints [= ]’ ⇒ *note ‘unur_pinv_set_use_upoints’: funct:unur_pinv_set_use_upoints. ‘usecdf’ ⇒ *note ‘unur_pinv_set_usecdf’: funct:unur_pinv_set_usecdf. ‘usepdf’ ⇒ *note ‘unur_pinv_set_usepdf’: funct:unur_pinv_set_usepdf. • ‘method = srou’ ⇒ ‘unur_srou_new’ (*note SROU::) ‘cdfatmode = ’ ⇒ *note ‘unur_srou_set_cdfatmode’: funct:unur_srou_set_cdfatmode. ‘pdfatmode = ’ ⇒ *note ‘unur_srou_set_pdfatmode’: funct:unur_srou_set_pdfatmode. ‘r = ’ ⇒ *note ‘unur_srou_set_r’: funct:unur_srou_set_r. ‘usemirror [= ]’ ⇒ *note ‘unur_srou_set_usemirror’: funct:unur_srou_set_usemirror. ‘usesqueeze [= ]’ ⇒ *note ‘unur_srou_set_usesqueeze’: funct:unur_srou_set_usesqueeze. ‘verify [= ]’ ⇒ *note ‘unur_srou_set_verify’: funct:unur_srou_set_verify. • ‘method = ssr’ ⇒ ‘unur_ssr_new’ (*note SSR::) ‘cdfatmode = ’ ⇒ *note ‘unur_ssr_set_cdfatmode’: funct:unur_ssr_set_cdfatmode. ‘pdfatmode = ’ ⇒ *note ‘unur_ssr_set_pdfatmode’: funct:unur_ssr_set_pdfatmode. ‘usesqueeze [= ]’ ⇒ *note ‘unur_ssr_set_usesqueeze’: funct:unur_ssr_set_usesqueeze. ‘verify [= ]’ ⇒ *note ‘unur_ssr_set_verify’: funct:unur_ssr_set_verify. • ‘method = tabl’ ⇒ ‘unur_tabl_new’ (*note TABL::) ‘areafraction = ’ ⇒ *note ‘unur_tabl_set_areafraction’: funct:unur_tabl_set_areafraction. ‘boundary = , | ()’ ⇒ *note ‘unur_tabl_set_boundary’: funct:unur_tabl_set_boundary. ‘cpoints = [, ()] | ()’ ⇒ *note ‘unur_tabl_set_cpoints’: funct:unur_tabl_set_cpoints. ‘darsfactor = ’ ⇒ *note ‘unur_tabl_set_darsfactor’: funct:unur_tabl_set_darsfactor. ‘guidefactor = ’ ⇒ *note ‘unur_tabl_set_guidefactor’: funct:unur_tabl_set_guidefactor. ‘max_intervals [= ]’ ⇒ *note ‘unur_tabl_set_max_intervals’: funct:unur_tabl_set_max_intervals. ‘max_sqhratio = ’ ⇒ *note ‘unur_tabl_set_max_sqhratio’: funct:unur_tabl_set_max_sqhratio. ‘nstp [= ]’ ⇒ *note ‘unur_tabl_set_nstp’: funct:unur_tabl_set_nstp. ‘pedantic [= ]’ ⇒ *note ‘unur_tabl_set_pedantic’: funct:unur_tabl_set_pedantic. ‘slopes = (), ’ ⇒ *note ‘unur_tabl_set_slopes’: funct:unur_tabl_set_slopes. ‘usedars [= ]’ ⇒ *note ‘unur_tabl_set_usedars’: funct:unur_tabl_set_usedars. ‘useear [= ]’ ⇒ *note ‘unur_tabl_set_useear’: funct:unur_tabl_set_useear. ‘variant_ia [= ]’ ⇒ *note ‘unur_tabl_set_variant_ia’: funct:unur_tabl_set_variant_ia. ‘variant_splitmode = ’ ⇒ *note ‘unur_tabl_set_variant_splitmode’: funct:unur_tabl_set_variant_splitmode. ‘verify [= ]’ ⇒ *note ‘unur_tabl_set_verify’: funct:unur_tabl_set_verify. • ‘method = tdr’ ⇒ ‘unur_tdr_new’ (*note TDR::) ‘c = ’ ⇒ *note ‘unur_tdr_set_c’: funct:unur_tdr_set_c. ‘cpoints = [, ()] | ()’ ⇒ *note ‘unur_tdr_set_cpoints’: funct:unur_tdr_set_cpoints. ‘darsfactor = ’ ⇒ *note ‘unur_tdr_set_darsfactor’: funct:unur_tdr_set_darsfactor. ‘guidefactor = ’ ⇒ *note ‘unur_tdr_set_guidefactor’: funct:unur_tdr_set_guidefactor. ‘max_intervals [= ]’ ⇒ *note ‘unur_tdr_set_max_intervals’: funct:unur_tdr_set_max_intervals. ‘max_sqhratio = ’ ⇒ *note ‘unur_tdr_set_max_sqhratio’: funct:unur_tdr_set_max_sqhratio. ‘pedantic [= ]’ ⇒ *note ‘unur_tdr_set_pedantic’: funct:unur_tdr_set_pedantic. ‘reinit_ncpoints [= ]’ ⇒ *note ‘unur_tdr_set_reinit_ncpoints’: funct:unur_tdr_set_reinit_ncpoints. ‘reinit_percentiles = [, ()] | ()’ ⇒ *note ‘unur_tdr_set_reinit_percentiles’: funct:unur_tdr_set_reinit_percentiles. ‘usecenter [= ]’ ⇒ *note ‘unur_tdr_set_usecenter’: funct:unur_tdr_set_usecenter. ‘usedars [= ]’ ⇒ *note ‘unur_tdr_set_usedars’: funct:unur_tdr_set_usedars. ‘usemode [= ]’ ⇒ *note ‘unur_tdr_set_usemode’: funct:unur_tdr_set_usemode. ‘variant_gw’ ⇒ *note ‘unur_tdr_set_variant_gw’: funct:unur_tdr_set_variant_gw. ‘variant_ia’ ⇒ *note ‘unur_tdr_set_variant_ia’: funct:unur_tdr_set_variant_ia. ‘variant_ps’ ⇒ *note ‘unur_tdr_set_variant_ps’: funct:unur_tdr_set_variant_ps. ‘verify [= ]’ ⇒ *note ‘unur_tdr_set_verify’: funct:unur_tdr_set_verify. • ‘method = utdr’ ⇒ ‘unur_utdr_new’ (*note UTDR::) ‘cpfactor = ’ ⇒ *note ‘unur_utdr_set_cpfactor’: funct:unur_utdr_set_cpfactor. ‘deltafactor = ’ ⇒ *note ‘unur_utdr_set_deltafactor’: funct:unur_utdr_set_deltafactor. ‘pdfatmode = ’ ⇒ *note ‘unur_utdr_set_pdfatmode’: funct:unur_utdr_set_pdfatmode. ‘verify [= ]’ ⇒ *note ‘unur_utdr_set_verify’: funct:unur_utdr_set_verify. • ‘method = vempk’ ⇒ ‘unur_vempk_new’ (*note VEMPK::) ‘smoothing = ’ ⇒ *note ‘unur_vempk_set_smoothing’: funct:unur_vempk_set_smoothing. ‘varcor [= ]’ ⇒ *note ‘unur_vempk_set_varcor’: funct:unur_vempk_set_varcor. • ‘method = vnrou’ ⇒ ‘unur_vnrou_new’ (*note VNROU::) ‘r = ’ ⇒ *note ‘unur_vnrou_set_r’: funct:unur_vnrou_set_r. ‘v = ’ ⇒ *note ‘unur_vnrou_set_v’: funct:unur_vnrou_set_v. ‘verify [= ]’ ⇒ *note ‘unur_vnrou_set_verify’: funct:unur_vnrou_set_verify. 3.5 Uniform RNG String ====================== The value of the ‘urng’ key is passed to the PRNG interface (see *Note Overview: (prng)Top. for details). However it only works when using the PRNG library is enabled, see *note Installation:: for details. There are no other keys. IMPORTANT: UNU.RAN creates a new uniform random number generator for the generator object. The pointer to this uniform generator has to be read and saved via a ‘unur_get_urng’ call in order to clear the memory _before_ the UNU.RAN generator object is destroyed. If this block is omitted the UNU.RAN default generator is used (which _must not_ be destroyed). 4 Handling distribution objects ******************************* Objects of type ‘UNUR_DISTR’ are used for handling distributions. All data about a distribution are stored in this object. UNU.RAN provides functions that return instances of such objects for standard distributions (*note Standard distributions: Stddist.). It is then possible to change these distribution objects by various set calls. Moreover, it is possible to build a distribution object entirely from scratch. For this purpose there exists ‘unur_distr__new’ calls that return an empty object of this type for each object type (eg. univariate contiuous) which can be filled with the appropriate set calls. UNU.RAN distinguishes between several types of distributions, each of which has its own sets of possible parameters (for details see the corresponding sections): − continuous univariate distributions − continuous univariate order statistics − continuous empirical univariate distributions − continuous multivariate distributions − continuous empirical multivariate distributions − matrix distributions − discrete univariate distributions Notice that there are essential data about a distribution, eg. the PDF, a list of (shape, scale, location) parameters for the distribution, and the domain of (the possibly truncated) distribution. And there exist parameters that are/can be derived from these, eg. the mode of the distribution or the area below the given PDF (which need not be normalized for many methods). UNU.RAN keeps track of parameters which are known. Thus if one of the essential parameters is changed all derived parameters are marked as unknown and must be set again if these are required for the chosen generation method. Additionally to set calls there are calls for updating derived parameters for objects provided by the UNU.RAN library of standard distributions (one for each parameter to avoid computational overhead since not all parameters are required for all generator methods). All parameters of distribution objects can be read by corresponding get calls. Every generator object has its own copy of a distribution object which is accessible by a ‘unur_get_distr’ call. Thus the parameter for this distribution can be read. However, *never* extract the distribution object out of a generator object and run one of the set calls on it to modify the distribution. (How should the poor generator object know what has happend?) Instead there exist calls for each of the generator methods that change particular parameters of the internal copy of the distribution object. How To Use .......... UNU.RAN collects all data required for a particular generation method in a _distribution object_. There are two ways to get an instance of a distributions object: 1. Build a distribtion from scratch, by means of the corresponding ‘unur_distr__new’ call, where ‘’ is the type of the distribution as listed in the below subsections. 2. Use the corresponding ‘unur_distr__new’ call to get prebuild distribution from the UNU.RAN library of standard distributions. Here ‘’ is the name of the standard distribution in *note Standard distributions: Stddist. In either cases the corresponding ‘unur_distr__set_’ calls to set the necessary parameters ‘’ (case 1), or change the values of the standard distribution in case 2 (if this makes sense for you). In the latter case ‘’ is the type to which the standard distribution belongs to. These ‘set’ calls return ‘UNUR_SUCCESS’ when the correspondig parameter has been set successfully. Otherwise an error code is returned. The parameters of a distribution are divided into _essential_ and _derived_ parameters. Notice, that there are some restrictions in setting parameters to avoid possible confusions. Changing essential parameters marks derived parameters as ‘unknown’. Some of the parameters cannot be changed any more when already set; some parameters block each others. In such a case a new instance of a distribution object has to be build. Additionally ‘unur_distr__upd_’ calls can be used for updating derived parameters for objects provided by the UNU.RAN library of standard distributions. All parameters of a distribution object get be read by means of ‘unur_distr__get_’ calls. Every distribution object be identified by its ‘name’ which is a string of arbitrary characters provided by the user. For standard distribution it is automatically set to ‘’ in the corresponding ‘new’ call. It can be changed to any other string. 4.1 Functions for all kinds of distribution objects =================================================== The calls in this section can be applied to all distribution objects. − Destroy ‘free’ an instance of a generator object. − Ask for the ‘type’ of a generator object. − Ask for the ‘dimension’ of a generator object. − Deal with the ‘name’ (identifier string) of a generator object. Function reference ------------------ -- Function: void unur_distr_free (UNUR_DISTR* DISTRIBUTION) Destroy the DISTRIBUTION object. -- Function: int unur_distr_set_name (UNUR_DISTR* DISTRIBUTION, const CHAR* NAME) -- Function: const char* unur_distr_get_name (const UNUR_DISTR* DISTRIBUTION) Set and get NAME of DISTRIBUTION. The NAME can be an arbitrary character string. It can be used to identify generator objects for the user. It is used by UNU.RAN when printing information of the distribution object into a log files. -- Function: int unur_distr_get_dim (const UNUR_DISTR* DISTRIBUTION) Get number of components of a random vector (its dimension) the DISTRIBUTION. For univariate distributions it returns dimension ‘1’. For matrix distributions it returns the number of components (i.e., number of rows times number of columns). When the respective numbers of rows and columns are needed use ‘unur_distr_matr_get_dim’ instead. -- Function: unsigned int unur_distr_get_type (const UNUR_DISTR* DISTRIBUTION) Get type of DISTRIBUTION. Possible types are ‘UNUR_DISTR_CONT’ univariate continuous distribution ‘UNUR_DISTR_CEMP’ empirical continuous univariate distribution (i.e. a sample) ‘UNUR_DISTR_CVEC’ continuous mulitvariate distribution ‘UNUR_DISTR_CVEMP’ empirical continuous multivariate distribution (i.e. a vector sample) ‘UNUR_DISTR_DISCR’ discrete univariate distribution ‘UNUR_DISTR_MATR’ matrix distribution Alternatively the ‘unur_distr_is_’ calls can be used. -- Function: int unur_distr_is_cont (const UNUR_DISTR* DISTRIBUTION) ‘TRUE’ if DISTRIBUTION is a continuous univariate distribution. -- Function: int unur_distr_is_cvec (const UNUR_DISTR* DISTRIBUTION) ‘TRUE’ if DISTRIBUTION is a continuous multivariate distribution. -- Function: int unur_distr_is_cemp (const UNUR_DISTR* DISTRIBUTION) ‘TRUE’ if DISTRIBUTION is an empirical continuous univariate distribution, i.e. a sample. -- Function: int unur_distr_is_cvemp (const UNUR_DISTR* DISTRIBUTION) ‘TRUE’ if DISTRIBUTION is an empirical continuous multivariate distribution. -- Function: int unur_distr_is_discr (const UNUR_DISTR* DISTRIBUTION) ‘TRUE’ if DISTRIBUTION is a discrete univariate distribution. -- Function: int unur_distr_is_matr (const UNUR_DISTR* DISTRIBUTION) ‘TRUE’ if DISTRIBUTION is a matrix distribution. -- Function: int unur_distr_set_extobj (UNUR_DISTR* DISTRIBUTION, const VOID* EXTOBJ) Store a pointer to an external object. This might be usefull if the PDF, PMF, CDF or other functions used to implement a particular distribution a parameter set that cannot be stored as doubles (e.g. pointers to some structure that holds information of the distribution). *Important:* When UNU.RAN copies this distribution object into the generator object, then the address EXTOBJ that this pointer contains is simply copied. Thus the generator holds an address of a non-private object! Once the generator object has been created any change in the external object might effect the generator object. *Warning:* External objects must be used with care. Once the generator object has been created or the distribution object has been copied you _must not_ destroy this external object. -- Function: const void* unur_distr_get_extobj (const UNUR_DISTR* DISTRIBUTION) Get the pointer to the external object. _Important:_ Changing this object must be done with with extreme care. 4.2 Continuous univariate distributions ======================================= The calls in this section can be applied to continuous univariate distributions. − Create a ‘new’ instance of a continuous univariate distribution. − Handle and evaluate distribution function (CDF, ‘cdf’), probability density function (PDF, ‘pdf’) and the derivative of the density function (‘dpdf’). The following is important: . ‘pdf’ need not be normalized, i.e., any integrable nonnegative function can be used. . ‘dpdf’ must the derivate of the function provided as ‘pdf’. . ‘cdf’ must be a distribution function, i.e. it must be monotonically increasing with range [0,1]. . If ‘cdf’ and ‘pdf’ are used together for a pariticular generation method, then ‘pdf’ must be the derivate of the ‘cdf’, i.e., it must be normalized. − Handle and evaluate the logarithm of the probability density function (logPDF, ‘logpdf’) and the derivative of the logarithm of the density function (‘dlogpdf’). Some methods use the logarithm of the density if available. − Set (and change) parameters (‘pdfparams’) and the area below the graph (‘pdfarea’) of the given density. − Set the ‘mode’ (or pole) of the distribution. − Set the ‘center’ of the distribution. It is used by some generation methods to adjust the parameters of the generation algorithms to gain better performance. It can be seens as the location of the “central part†of the distribution. − Some generation methods require the hazard rate (‘hr’) of the distribution instead of its ‘pdf’. − Alternatively, ‘cdf’, ‘pdf’, ‘dpdf’, and ‘hr’ can be provided as ‘str’ings instead of function pointers. − Set the ‘domain’ of the distribution. Notice that the library also can handle truncated distributions, i.e., distributions that are derived from (standard) distributions by simply restricting its domain to a subset. However, there is a subtle difference between changing the domain of a distribution object by a ‘unur_distr_cont_set_domain’ call and changing the (truncated) domain for an existing generator object. The domain of the distribution object is used to create the generator object with hats, squeezes, tables, etc. Whereas truncating the domain of an existing generator object need not necessarily require a recomputation of these data. Thus by a ‘unur__chg_truncated’ call (if available) the sampling region is restricted to the subset of the domain of the given distribution object. However, generation methods that require a recreation of the generator object when the domain is changed have a ‘unur__chg_domain’ call instead. For these calls there are of course no restrictions on the given domain (i.e., it is possible to increase the domain of the distribution) (*note Methods::, for details). Function reference ------------------ -- Function: UNUR_DISTR* unur_distr_cont_new (void) Create a new (empty) object for univariate continuous distribution. Essential parameters .................... -- Function: int unur_distr_cont_set_pdf (UNUR_DISTR* DISTRIBUTION, UNUR_FUNCT_CONT* PDF) -- Function: int unur_distr_cont_set_dpdf (UNUR_DISTR* DISTRIBUTION, UNUR_FUNCT_CONT* DPDF) -- Function: int unur_distr_cont_set_cdf (UNUR_DISTR* DISTRIBUTION, UNUR_FUNCT_CONT* CDF) -- Function: int unur_distr_cont_set_invcdf (UNUR_DISTR* DISTRIBUTION, UNUR_FUNCT_CONT* INVCDF) Set respective pointer to the probability density function (PDF), the derivative of the probability density function (dPDF), the cumulative distribution function (CDF), and the inverse CDF of the DISTRIBUTION. Each of these function pointers must be of type ‘double funct(double x, const UNUR_DISTR *distr)’. Due to the fact that some of the methods do not require a normalized PDF the following is important: − The given CDF must be the cumulative distribution function of the (non-truncated) distribution. If a distribution from the UNU.RAN library of standard distributions (*note Standard distributions: Stddist.) is truncated, there is no need to change the CDF. − If both the CDF and the PDF are used (for a method or for order statistics), the PDF must be the derivative of the CDF. If a truncated distribution for one of the standard distributions from the UNU.RAN library of standard distributions is used, there is no need to change the PDF. − If the area below the PDF is required for a given distribution it must be given by the ‘unur_distr_cont_set_pdfarea’ call. For a truncated distribution this must be of course the integral of the PDF in the given truncated domain. For distributions from the UNU.RAN library of standard distributions this is done automatically by the ‘unur_distr_cont_upd_pdfarea’ call. It is important to note that all these functions must return a result for all values of X. Eg., if the domain of a given PDF is the interval [-1,1], then the given function must return ‘0.0’ for all points outside this interval. In case of an overflow the PDF should return ‘UNUR_INFINITY’. It is not possible to change such a function. Once the PDF or CDF is set it cannot be overwritten. This also holds when the logPDF is given or when the PDF is given by the ‘unur_distr_cont_set_pdfstr’ or ‘unur_distr_cont_set_logpdfstr’ call. A new distribution object has to be used instead. -- Function: UNUR_FUNCT_CONT* unur_distr_cont_get_pdf (const UNUR_DISTR* DISTRIBUTION) -- Function: UNUR_FUNCT_CONT* unur_distr_cont_get_dpdf (const UNUR_DISTR* DISTRIBUTION) -- Function: UNUR_FUNCT_CONT* unur_distr_cont_get_cdf (const UNUR_DISTR* DISTRIBUTION) -- Function: UNUR_FUNCT_CONT* unur_distr_cont_get_invcdf (const UNUR_DISTR* DISTRIBUTION) Get the respective pointer to the PDF, the derivative of the PDF, the CDF, and the inverse CDF of the DISTRIBUTION. The pointer is of type ‘double funct(double x, const UNUR_DISTR *distr)’. If the corresponding function is not available for the distribution, the ‘NULL’ pointer is returned. -- Function: double unur_distr_cont_eval_pdf (double X, const UNUR_DISTR* DISTRIBUTION) -- Function: double unur_distr_cont_eval_dpdf (double X, const UNUR_DISTR* DISTRIBUTION) -- Function: double unur_distr_cont_eval_cdf (double X, const UNUR_DISTR* DISTRIBUTION) -- Function: double unur_distr_cont_eval_invcdf (double U, const UNUR_DISTR* DISTRIBUTION) Evaluate the PDF, derivative of the PDF, the CDF, and the inverse CDF at X and U,respectively. Notice that DISTRIBUTION must not be the ‘NULL’ pointer. If the corresponding function is not available for the distribution, ‘UNUR_INFINITY’ is returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’. _IMPORTANT:_ In the case of a truncated standard distribution these calls always return the respective values of the _untruncated_ distribution! -- Function: int unur_distr_cont_set_logpdf (UNUR_DISTR* DISTRIBUTION, UNUR_FUNCT_CONT* LOGPDF) -- Function: int unur_distr_cont_set_dlogpdf (UNUR_DISTR* DISTRIBUTION, UNUR_FUNCT_CONT* DLOGPDF) -- Function: int unur_distr_cont_set_logcdf (UNUR_DISTR* DISTRIBUTION, UNUR_FUNCT_CONT* LOGCDF) -- Function: UNUR_FUNCT_CONT* unur_distr_cont_get_logpdf (const UNUR_DISTR* DISTRIBUTION) -- Function: UNUR_FUNCT_CONT* unur_distr_cont_get_dlogpdf (const UNUR_DISTR* DISTRIBUTION) -- Function: UNUR_FUNCT_CONT* unur_distr_cont_get_logcdf (const UNUR_DISTR* DISTRIBUTION) -- Function: double unur_distr_cont_eval_logpdf (double X, const UNUR_DISTR* DISTRIBUTION) -- Function: double unur_distr_cont_eval_dlogpdf (double X, const UNUR_DISTR* DISTRIBUTION) -- Function: double unur_distr_cont_eval_logcdf (double X, const UNUR_DISTR* DISTRIBUTION) Analogous calls for the logarithm of the density distribution functions. -- Function: int unur_distr_cont_set_pdfstr (UNUR_DISTR* DISTRIBUTION, const CHAR* PDFSTR) This function provides an alternative way to set a PDF and its derivative of the DISTRIBUTION. PDFSTR is a character string that contains the formula for the PDF, see *note Function String: StringFunct, for details. The derivative of the given PDF is computed automatically. See also the remarks for the ‘unur_distr_cont_set_pdf’ call. It is not possible to call this funtion twice or to call this function after a ‘unur_distr_cont_set_pdf’ call. -- Function: int unur_distr_cont_set_cdfstr (UNUR_DISTR* DISTRIBUTION, const CHAR* CDFSTR) This function provides an alternative way to set a CDF; analogously to the ‘unur_distr_cont_set_pdfstr’ call. The PDF and its derivative of the given CDF are computed automatically. -- Function: char* unur_distr_cont_get_pdfstr (const UNUR_DISTR* DISTRIBUTION) -- Function: char* unur_distr_cont_get_dpdfstr (const UNUR_DISTR* DISTRIBUTION) -- Function: char* unur_distr_cont_get_cdfstr (const UNUR_DISTR* DISTRIBUTION) Get pointer to respective string for PDF, derivate of PDF, and CDF of DISTRIBUTION that is given as string (instead of a function pointer). This call allocates memory to produce this string. It should be freed when it is not used any more. -- Function: int unur_distr_cont_set_pdfparams (UNUR_DISTR* DISTRIBUTION, const DOUBLE* PARAMS, int N_PARAMS) Sets array of parameters for DISTRIBUTION. There is an upper limit for the number of parameters ‘n_params’. It is given by the macro ‘UNUR_DISTR_MAXPARAMS’ in ‘unuran_config.h’. (It is set to 5 by default but can be changed to any appropriate nonnegative number.) If N_PARAMS is negative or exceeds this limit no parameters are copied into the distribution object and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_NPARAMS’. For standard distributions from the UNU.RAN library the parameters are checked. Moreover, the domain is updated automatically unless it has been changed before by a ‘unur_distr_cont_set_domain’ call. If the given parameters are invalid for the standard distribution, then no parameters are set and an error code is returned. Notice, that the given parameter list for such a distribution is handled in the same way as in the corresponding ‘new’ calls, i.e. optional parameters for the PDF that are not present in the given list are (re-)set to their default values. *Important:* If the parameters of a distribution from the UNU.RAN library of standard distributions (*note Standard distributions: Stddist.) are changed, then neither its mode nor the normalization constant are updated. Please use the respective calls ‘unur_distr_cont_upd_mode’ and ‘unur_distr_cont_upd_pdfarea’. Moreover, if the domain has been changed by a ‘unur_distr_cont_set_domain’ it is not automatically updated, either. Updating the normalization constant is in particular very important, when the CDF of the distribution is used. -- Function: int unur_distr_cont_get_pdfparams (const UNUR_DISTR* DISTRIBUTION, const DOUBLE** PARAMS) Get number of parameters of the PDF and set pointer PARAMS to array of parameters. If no parameters are stored in the object, an error code is returned and ‘params’ is set to ‘NULL’. _Important:_ Do *not* change the entries in PARAMS! -- Function: int unur_distr_cont_set_pdfparams_vec (UNUR_DISTR* DISTRIBUTION, int PAR, const DOUBLE* PARAM_VEC, int N_PARAM_VEC) This function provides an interface for additional vector parameters for a continuous DISTRIBUTION. It sets the parameter with number PAR. PAR indicates directly which of the parameters is set and must be a number between ‘0’ and ‘UNUR_DISTR_MAXPARAMS’-1 (the upper limit of possible parameters defined in ‘unuran_config.h’; it is set to 5 but can be changed to any appropriate nonnegative number.) The entries of a this parameter are given by the array PARAM_VEC of size N_PARAM_VEC. If PARAM_VEC is ‘NULL’ then the corresponding entry is cleared. If an error occurs no parameters are copied into the parameter object ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’. -- Function: int unur_distr_cont_get_pdfparams_vec (const UNUR_DISTR* DISTRIBUTION, int PAR, const DOUBLE** PARAM_VECS) Get parameter of the PDF with number PAR. The pointer to the parameter array is stored in PARAM_VECS, its size is returned by the function. If the requested parameter is not set, then an error code is returned and ‘params’ is set to ‘NULL’. _Important:_ Do *not* change the entries in PARAM_VECS! -- Function: int unur_distr_cont_set_logpdfstr (UNUR_DISTR* DISTRIBUTION, const CHAR* LOGPDFSTR) -- Function: char* unur_distr_cont_get_logpdfstr (const UNUR_DISTR* DISTRIBUTION) -- Function: char* unur_distr_cont_get_dlogpdfstr (const UNUR_DISTR* DISTRIBUTION) -- Function: int unur_distr_cont_set_logcdfstr (UNUR_DISTR* DISTRIBUTION, const CHAR* LOGCDFSTR) -- Function: char* unur_distr_cont_get_logcdfstr (const UNUR_DISTR* DISTRIBUTION) Analogous calls for the logarithm of the density and distribution functions. -- Function: int unur_distr_cont_set_domain (UNUR_DISTR* DISTRIBUTION, double LEFT, double RIGHT) Set the left and right borders of the domain of the distribution. This can also be used to truncate an existing distribution. For setting the boundary to +/- infinity use ‘+/- UNUR_INFINITY’. If RIGHT is not strictly greater than LEFT no domain is set and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_SET’. _Important:_ For some technical reasons it is assumed that the density is unimodal and thus monotone on either side of the mode! This is used in the case when the given mode is outside of the original domain. Then the mode is set to the corresponding boundary of the new domain. If this result is not the desired it must be changed by using a ‘unur_distr_cont_set_mode’ call (or a ‘unur_distr_cont_upd_mode’ call). The same holds for the center of the distribution. -- Function: int unur_distr_cont_get_domain (const UNUR_DISTR* DISTRIBUTION, double* LEFT, double* RIGHT) Get the left and right borders of the domain of the distribution. If the domain is not set ‘+/- UNUR_INFINITY’ is assumed and returned. No error is reported in this case. -- Function: int unur_distr_cont_get_truncated (const UNUR_DISTR* DISTRIBUTION, double* LEFT, double* RIGHT) Get the left and right borders of the (truncated) domain of the distribution. For non-truncated distribution this call is equivalent to the ‘unur_distr_cont_get_domain’ call. This call is only useful in connection with a ‘unur_get_distr’ call to get the boundaries of the sampling region of a generator object. -- Function: int unur_distr_cont_set_hr (UNUR_DISTR* DISTRIBUTION, UNUR_FUNCT_CONT* HAZARD) Set pointer to the hazard rate (HR) of the DISTRIBUTION. The _hazard rate_ (or failure rate) is a mathematical way of describing aging. If the lifetime X is a random variable with density f(x) and CDF F(x) the hazard rate h(x) is defined as h(x) = f(x) / (1-F(x)). In other words, h(x) represents the (conditional) rate of failure of a unit that has survived up to time x with probability 1-F(x). The key distribution is the exponential distribution as it has constant hazard rate of value 1. Hazard rates tending to infinity describe distributions with sub-exponential tails whereas distributions with hazard rates tending to zero have heavier tails than the exponential distribution. It is important to note that all these functions must return a result for all floats x. In case of an overflow the PDF should return ‘UNUR_INFINITY’. *Important*: Do not simply use f(x) / (1-F(x)), since this is numerically very unstable and results in numerical noise if F(x) is (very) close to 1. Moreover, if the density f(x) is known a generation method that uses the density is more appropriate. It is not possible to change such a function. Once the HR is set it cannot be overwritten. This also holds when the HR is given by the ‘unur_distr_cont_set_hrstr’ call. A new distribution object has to be used instead. -- Function: UNUR_FUNCT_CONT* unur_distr_cont_get_hr (const UNUR_DISTR* DISTRIBUTION) Get the pointer to the hazard rate of the DISTRIBUTION. The pointer is of type ‘double funct(double x, const UNUR_DISTR *distr)’. If the corresponding function is not available for the distribution, the ‘NULL’ pointer is returned. -- Function: double unur_distr_cont_eval_hr (double X, const UNUR_DISTR* DISTRIBUTION) Evaluate the hazard rate at X. Notice that DISTRIBUTION must not be the ‘NULL’ pointer. If the corresponding function is not available for the distribution, ‘UNUR_INFINITY’ is returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’. -- Function: int unur_distr_cont_set_hrstr (UNUR_DISTR* DISTRIBUTION, const CHAR* HRSTR) This function provides an alternative way to set a hazard rate and its derivative of the DISTRIBUTION. HRSTR is a character string that contains the formula for the HR, see *note Function String: StringFunct, for details. See also the remarks for the ‘unur_distr_cont_set_hr’ call. It is not possible to call this funtion twice or to call this function after a ‘unur_distr_cont_set_hr’ call. -- Function: char* unur_distr_cont_get_hrstr (const UNUR_DISTR* DISTRIBUTION) Get pointer to string for HR of DISTRIBUTION that is given via the string interface. This call allocates memory to produce this string. It should be freed when it is not used any more. Derived parameters .................. The following paramters *must* be set whenever one of the essential parameters has been set or changed (and the parameter is required for the chosen method). -- Function: int unur_distr_cont_set_mode (UNUR_DISTR* DISTRIBUTION, double MODE) Set mode of DISTRIBUTION. The MODE must be contained in the domain of DISTRIBUTION. Otherwise the mode is not set and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_SET’. For distributions with unbounded density, this call is used to set the pole of the PDF. Notice that the PDF should then return ‘UNUR_INFINITY’ at the pole. Notice that the mode is adjusted when the domain is set, see the remark for the ‘unur_distr_cont_set_domain’ call. -- Function: int unur_distr_cont_upd_mode (UNUR_DISTR* DISTRIBUTION) Recompute the mode of the DISTRIBUTION. This call works properly for distribution objects from the UNU.RAN library of standard distributions when the corresponding function is available. Otherwise a (slow) numerical mode finder based on Brent’s algorithm is used. If it failes ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’. -- Function: double unur_distr_cont_get_mode (UNUR_DISTR* DISTRIBUTION) Get mode of DISTRIBUTION. If the mode is not marked as known, ‘unur_distr_cont_upd_mode’ is called to compute the mode. If this is not successful ‘UNUR_INFINITY’ is returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_GET’. (There is no difference between the case where no routine for computing the mode is available and the case where no mode exists for the distribution at all.) -- Function: int unur_distr_cont_set_center (UNUR_DISTR* DISTRIBUTION, double CENTER) Set center of the DISTRIBUTION. The center is used by some methods to shift the distribution in order to decrease numerical round-off error. If not given explicitly a default is used. _Important:_ This call does not check whether the center is contained in the given domain. Default: The mode, if set by a ‘unur_distr_cont_set_mode’ or ‘unur_distr_cont_upd_mode’ call; otherwise ‘0’. -- Function: double unur_distr_cont_get_center (const UNUR_DISTR* DISTRIBUTION) Get center of the DISTRIBUTION. It always returns some point as there always exists a default for the center, see ‘unur_distr_cont_set_center’. -- Function: int unur_distr_cont_set_pdfarea (UNUR_DISTR* DISTRIBUTION, double AREA) Set the area below the PDF. If ‘area’ is non-positive, no area is set and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_SET’. For a distribution object created by the UNU.RAN library of standard distributions you always should use the ‘unur_distr_cont_upd_pdfarea’. Otherwise there might be ambiguous side-effects. -- Function: int unur_distr_cont_upd_pdfarea (UNUR_DISTR* DISTRIBUTION) Recompute the area below the PDF of the distribution. It only works for distribution objects from the UNU.RAN library of standard distributions when the corresponding function is available. Otherwise ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’. This call also sets the normalization constant such that the given PDF is the derivative of a given CDF, i.e. the area is 1. However, for truncated distributions the area is smaller than 1. The call does not work for distributions from the UNU.RAN library of standard distributions with truncated domain when the CDF is not available. -- Function: double unur_distr_cont_get_pdfarea (UNUR_DISTR* DISTRIBUTION) Get the area below the PDF of the distribution. If this area is not known, ‘unur_distr_cont_upd_pdfarea’ is called to compute it. If this is not successful ‘UNUR_INFINITY’ is returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_GET’. 4.3 Continuous univariate order statistics ========================================== These are special cases of a continuous univariate distributions and thus they have most of these parameters (with the exception that functions cannot be changed). Additionally, − there is a call to extract the underlying distribution, − and a call to handle the ‘rank’ of the order statistics. Function reference ------------------ -- Function: UNUR_DISTR* unur_distr_corder_new (const UNUR_DISTR* DISTRIBUTION, int N, int K) Create an object for order statistics of sample size N and rank K. DISTRIBUTION must be a pointer to a univariate continuous distribution. The resulting generator object is of the same type as of a ‘unur_distr_cont_new’ call. (However, it cannot be used to make an order statistics out of an order statistics.) To have a PDF for the order statistics, the given distribution object must contain a CDF and a PDF. Moreover, it is assumed that the given PDF is the derivative of the given CDF. Otherwise the area below the PDF of the order statistics is not computed correctly. _Important:_ There is no warning when the computed area below the PDF of the order statistics is wrong. -- Function: const UNUR_DISTR* unur_distr_corder_get_distribution (const UNUR_DISTR* DISTRIBUTION) Get pointer to distribution object for underlying distribution. Essential parameters .................... -- Function: int unur_distr_corder_set_rank (UNUR_DISTR* DISTRIBUTION, int N, int K) Change sample size N and rank K of order statistics. In case of invalid data, no parameters are changed. The area below the PDF can be set to that of the underlying distribution by a ‘unur_distr_corder_upd_pdfarea’ call. -- Function: int unur_distr_corder_get_rank (const UNUR_DISTR* DISTRIBUTION, int* N, int* K) Get sample size N and rank K of order statistics. In case of error an error code is returned. Additionally most of the set and get calls for continuous univariate distributions work. The most important exceptions are that the PDF and CDF cannot be changed and ‘unur_distr_cont_upd_mode’ uses in any way a (slow) numerical method that might fail. -- Function: UNUR_FUNCT_CONT* unur_distr_corder_get_pdf (UNUR_DISTR* DISTRIBUTION) -- Function: UNUR_FUNCT_CONT* unur_distr_corder_get_dpdf (UNUR_DISTR* DISTRIBUTION) -- Function: UNUR_FUNCT_CONT* unur_distr_corder_get_cdf (UNUR_DISTR* DISTRIBUTION) Get the respective pointer to the PDF, the derivative of the PDF and the CDF of the distribution, respectively. The pointer is of type ‘double funct(double x, UNUR_DISTR *distr)’. If the corresponding function is not available for the distribution, the ‘NULL’ pointer is returned. See also ‘unur_distr_cont_get_pdf’. (Macro) -- Function: double unur_distr_corder_eval_pdf (double X, UNUR_DISTR* DISTRIBUTION) -- Function: double unur_distr_corder_eval_dpdf (double X, UNUR_DISTR* DISTRIBUTION) -- Function: double unur_distr_corder_eval_cdf (double X, UNUR_DISTR* DISTRIBUTION) Evaluate the PDF, derivative of the PDF. and the CDF, respectively, at X. Notice that DISTRIBUTION must not be the ‘NULL’ pointer. If the corresponding function is not available for the distribution, ‘UNUR_INFINITY’ is returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’. See also ‘unur_distr_cont_eval_pdf’. (Macro) _IMPORTANT:_ In the case of a truncated standard distribution these calls always return the respective values of the _untruncated_ distribution! -- Function: int unur_distr_corder_set_pdfparams (UNUR_DISTR* DISTRIBUTION, double* PARAMS, int N_PARAMS) Set array of parameters for underlying distribution. See ‘unur_distr_cont_set_pdfparams’ for details. (Macro) -- Function: int unur_distr_corder_get_pdfparams (UNUR_DISTR* DISTRIBUTION, double** PARAMS) Get number of parameters of the PDF of the underlying distribution and set pointer PARAMS to array of parameters. See ‘unur_distr_cont_get_pdfparams’ for details. (Macro) -- Function: int unur_distr_corder_set_domain (UNUR_DISTR* DISTRIBUTION, double LEFT, double RIGHT) Set the left and right borders of the domain of the distribution. See ‘unur_distr_cont_set_domain’ for details. (Macro) -- Function: int unur_distr_corder_get_domain (UNUR_DISTR* DISTRIBUTION, double* LEFT, double* RIGHT) Get the left and right borders of the domain of the distribution. See ‘unur_distr_cont_get_domain’ for details. (Macro) -- Function: int unur_distr_corder_get_truncated (UNUR_DISTR* DISTRIBUTION, double* LEFT, double* RIGHT) Get the left and right borders of the (truncated) domain of the distribution. See ‘unur_distr_cont_get_truncated’ for details. (Macro) Derived parameters .................. The following paramters *must* be set whenever one of the essential parameters has been set or changed (and the parameter is required for the chosen method). -- Function: int unur_distr_corder_set_mode (UNUR_DISTR* DISTRIBUTION, double MODE) Set mode of distribution. See also ‘unur_distr_corder_set_mode’. (Macro) -- Function: double unur_distr_corder_upd_mode (UNUR_DISTR* DISTRIBUTION) Recompute the mode of the distribution numerically. Notice that this routine is slow and might not work properly in every case. See also ‘unur_distr_cont_upd_mode’ for further details. (Macro) -- Function: double unur_distr_corder_get_mode (UNUR_DISTR* DISTRIBUTION) Get mode of distribution. See ‘unur_distr_cont_get_mode’ for details. (Macro) -- Function: int unur_distr_corder_set_pdfarea (UNUR_DISTR* DISTRIBUTION, double AREA) Set the area below the PDF. See ‘unur_distr_cont_set_pdfarea’ for details. (Macro) -- Function: double unur_distr_corder_upd_pdfarea (UNUR_DISTR* DISTRIBUTION) Recompute the area below the PDF of the distribution. It only works for order statistics for distribution objects from the UNU.RAN library of standard distributions when the corresponding function is available. ‘unur_distr_cont_upd_pdfarea’ assumes that the PDF of the underlying distribution is normalized, i.e. it is the derivative of its CDF. Otherwise the computed area is wrong and there is *no* warning about this failure. See ‘unur_distr_cont_upd_pdfarea’ for further details. (Macro) -- Function: double unur_distr_corder_get_pdfarea (UNUR_DISTR* DISTRIBUTION) Get the area below the PDF of the distribution. See ‘unur_distr_cont_get_pdfarea’ for details. (Macro) 4.4 Continuous empirical univariate distributions ================================================= Empirical univariate distributions are derived from observed data. There are two ways to create such a generator object: 1. By a list of _raw data_ by means of a ‘unur_distr_cemp_set_data’ call. 2. By a _histogram_ (i.e. preprocessed data) by means of a ‘unur_distr_cemp_set_hist’ call. How these data are used to sample from the empirical distribution depends from the chosen generation method. Function reference ------------------ -- Function: UNUR_DISTR* unur_distr_cemp_new (void) Create a new (empty) object for empirical univariate continuous distribution. Essential parameters .................... -- Function: int unur_distr_cemp_set_data (UNUR_DISTR* DISTRIBUTION, const DOUBLE* SAMPLE, int N_SAMPLE) Set observed sample for empirical distribution. -- Function: int unur_distr_cemp_read_data (UNUR_DISTR* DISTRIBUTION, const CHAR* FILENAME) Read data from file ‘filename’. It reads the first number from each line. Numbers are parsed by means of the C standard routine ‘strtod’. Lines that do not start with ‘+’, ‘-’, ‘.’, or a digit are ignored. (Beware of lines starting with a blank!) In case of an error (file cannot be opened, invalid string for double in line) no data are copied into the distribution object and an error code is returned. -- Function: int unur_distr_cemp_get_data (const UNUR_DISTR* DISTRIBUTION, const DOUBLE** SAMPLE) Get number of samples and set pointer SAMPLE to array of observations. If no sample has been given, an error code is returned and ‘sample’ is set to ‘NULL’. _Important:_ Do *not* change the entries in SAMPLE! -- Function: int unur_distr_cemp_set_hist (UNUR_DISTR* DISTRIBUTION, const DOUBLE* PROB, int N_PROB, double XMIN, double XMAX) Set a histogram with bins of equal width. PROB is an array of length N_PROB that contains the probabilities for the bins (in ascending order). XMIN and XMAX give the lower and upper bound of the histogram, respectively. The bins are assumed to have equal width. _Remark:_ This is shortcut for calling ‘unur_distr_cemp_set_hist_prob’ and ‘unur_distr_cemp_set_hist_domain’. _Notice:_ All sampling methods either use raw data or histogram. It is possible to set both types of data; however, it is not checked whether the given histogran corresponds to possibly given raw data. -- Function: int unur_distr_cemp_set_hist_prob (UNUR_DISTR* DISTRIBUTION, const DOUBLE* PROB, int N_PROB) Set probabilities of a histogram with N_PROB bins. Hence PROB must be an array of length N_PROB that contains the probabilities for the bins in ascending order. It is important also to set the location of the bins either with a ‘unur_distr_cemp_set_hist_domain’ for bins of equal width or ‘unur_distr_cemp_set_hist_bins’ when the bins have different width. _Notice:_ All sampling methods either use raw data or histogram. It is possible to set both types of data; however, it is not checked whether the given histogram corresponds to possibly given raw data. -- Function: int unur_distr_cemp_set_hist_domain (UNUR_DISTR* DISTRIBUTION, double XMIN, double XMAX) Set a domain of a histogram with bins of equal width. XMIN and XMAX give the lower and upper bound of the histogram, respectively. -- Function: int unur_distr_cemp_set_hist_bins (UNUR_DISTR* DISTRIBUTION, const DOUBLE* BINS, int N_BINS) Set location of bins of a histogram with N_BINS bins. Hence BINS must be an array of length N_BINS. The domain of the DISTRIBUTION is automatically set by this call and overrides any calls to ‘unur_distr_cemp_set_hist_domain’. _Important:_ The probabilities of the bins of the DISTRIBUTION must be already be set by a ‘unur_distr_cemp_set_hist_prob’ (or a ‘unur_distr_cemp_set_hist’ call) and the value of N_BINS must equal N_PROB‘+1’ from the corresponding value of the respective call. 4.5 Continuous multivariate distributions ========================================= The following calls handle multivariate distributions. However, the requirements of particular generation methods is not as unique as for univariate distributions. Moreover, random vector generation methods are still under development. The below functions are a first attempt to handle this situation. Notice that some of the parameters – when given carelessly – might contradict to others. For example: Some methods require the marginal distribution and some methods need a standardized form of the marginal distributions, where the actual mean and variance is stored in the mean vector and the covariance matrix, respectively. We also have to mention that some methods might abuse some of the parameters. Please read the discription of the chosen sampling method carfully. The following kind of calls exists: − Create a ‘new’ instance of a continuous multivariate distribution; − Handle and evaluate probability density function (PDF, ‘pdf’) and the gradient of the density function (‘dpdf’). The following is important: . ‘pdf’ need not be normalized, i.e., any integrable nonnegative function can be used. . ‘dpdf’ must the derivate of the function provided as ‘pdf’. − Handle and evaluate the logarithm of the probability density function (logPDF, ‘logpdf’) and the gradient of the logarithm of the density function (‘dlogpdf’). Some methods use the logarithm of the density if available. − Set (and change) parameters (‘pdfparams’) and the volume below the graph (‘pdfvol’) of the given density. − Set ‘mode’ and ‘mean’ of the distribution. − Set the ‘center’ of the distribution. It is used by some generation methods to adjust the parameters of the generation algorithms to gain better performance. It can be seens as the location of the “central part†of the distribution. − Handle the ‘covar’iance matrix of the distribution and its ‘cholesky’ and ‘inv’verse matrices. − Set the ‘rankcorr’elation matrix of the distribution. − Deal with ‘marginal’ distributions. − Set domain of the distribution. Function reference ------------------ -- Function: UNUR_DISTR* unur_distr_cvec_new (int DIM) Create a new (empty) object for multivariate continuous distribution. DIM is the number of components of the random vector (i.e. its dimension). It is also possible to use dimension 1. Notice, however, that this is treated as a distribution of random vectors with only one component and not as a distribution of real numbers. For the latter ‘unur_distr_cont_new’ should be used to create an object for a univariate distribution. Essential parameters .................... -- Function: int unur_distr_cvec_set_pdf (UNUR_DISTR* DISTRIBUTION, UNUR_FUNCT_CVEC* PDF) Set respective pointer to the PDF of the DISTRIBUTION. This function must be of type ‘double funct(const double *x, UNUR_DISTR *distr)’, where X must be a pointer to a double array of appropriate size (i.e. of the same size as given to the ‘unur_distr_cvec_new’ call). It is not necessary that the given PDF is normalized, i.e. the integral need not be 1. Nevertheless the volume below the PDF can be provided by a ‘unur_distr_cvec_set_pdfvol’ call. It is not possible to change the PDF. Once the PDF is set it cannot be overwritten. This also holds when the logPDF is given. A new distribution object has to be used instead. -- Function: int unur_distr_cvec_set_dpdf (UNUR_DISTR* DISTRIBUTION, UNUR_VFUNCT_CVEC* DPDF) Set pointer to the gradient of the PDF. The type of this function must be ‘int funct(double *result, const double *x, UNUR_DISTR *distr)’, where RESULT and X must be pointers to double arrays of appropriate size (i.e. of the same size as given to the ‘unur_distr_cvec_new’ call). The gradient of the PDF is stored in the array RESULT. The function should return an error code in case of an error and must return ‘UNUR_SUCCESS’ otherwise. The given function must be the gradient of the function given by a ‘unur_distr_cvec_set_pdf’ call. It is not possible to change the gradient of the PDF. Once the dPDF is set it cannot be overwritten. This also holds when the gradient of the logPDF is given. A new distribution object has to be used instead. -- Function: int unur_distr_cvec_set_pdpdf (UNUR_DISTR* DISTRIBUTION, UNUR_FUNCTD_CVEC* PDPDF) Set pointer to partial derivatives of the PDF. The type of this function must be ‘double funct(const double *x, int coord, UNUR_DISTR *distr)’, where X must be a pointer to a double array of appropriate size (i.e. of the same size as given to the ‘unur_distr_cvec_new’ call). COORD is the coordinate for which the partial dervative should be computed. Notice that COORD must be an integer from {0,...,dim-1}. It is not possible to change the partial derivative of the PDF. Once the pdPDF is set it cannot be overwritten. This also holds when the partial derivative of the logPDF is given. A new distribution object has to be used instead. -- Function: UNUR_FUNCT_CVEC* unur_distr_cvec_get_pdf (const UNUR_DISTR* DISTRIBUTION) Get the pointer to the PDF of the DISTRIBUTION. The pointer is of type ‘double funct(const double *x, UNUR_DISTR *distr)’. If the corresponding function is not available for the DISTRIBUTION, the ‘NULL’ pointer is returned. -- Function: UNUR_VFUNCT_CVEC* unur_distr_cvec_get_dpdf (const UNUR_DISTR* DISTRIBUTION) Get the pointer to the gradient of the PDF of the DISTRIBUTION. The pointer is of type ‘int double funct(double *result, const double *x, UNUR_DISTR *distr)’. If the corresponding function is not available for the DISTRIBUTION, the ‘NULL’ pointer is returned. -- Function: double unur_distr_cvec_eval_pdf (const DOUBLE* X, UNUR_DISTR* DISTRIBUTION) Evaluate the PDF of the DISTRIBUTION at X. X must be a pointer to a double array of appropriate size (i.e. of the same size as given to the ‘unur_distr_cvec_new’ call) that contains the vector for which the function has to be evaluated. Notice that DISTRIBUTION must not be the ‘NULL’ pointer. If the corresponding function is not available for the DISTRIBUTION, ‘UNUR_INFINITY’ is returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’. -- Function: int unur_distr_cvec_eval_dpdf (double* RESULT, const DOUBLE* X, UNUR_DISTR* DISTRIBUTION) Evaluate the gradient of the PDF of the DISTRIBUTION at X. The result is stored in the double array RESULT. Both RESULT and X must be pointer to double arrays of appropriate size (i.e. of the same size as given to the ‘unur_distr_cvec_new’ call). Notice that DISTRIBUTION must not be the ‘NULL’ pointer. If the corresponding function is not available for the DISTRIBUTION, an error code is returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’ (RESULT is left unmodified). -- Function: double unur_distr_cvec_eval_pdpdf (const DOUBLE* X, int COORD, UNUR_DISTR* DISTRIBUTION) Evaluate the partial derivative of the PDF of the DISTRIBUTION at X for the coordinate COORD. X must be a pointer to a double array of appropriate size (i.e. of the same size as given to the ‘unur_distr_cvec_new’ call) that contains the vector for which the function has to be evaluated. Notice that COORD must be an integer from {0,...,dim-1}. Notice that DISTRIBUTION must not be the ‘NULL’ pointer. If the corresponding function is not available for the DISTRIBUTION, ‘UNUR_INFINITY’ is returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’. -- Function: int unur_distr_cvec_set_logpdf (UNUR_DISTR* DISTRIBUTION, UNUR_FUNCT_CVEC* LOGPDF) -- Function: int unur_distr_cvec_set_dlogpdf (UNUR_DISTR* DISTRIBUTION, UNUR_VFUNCT_CVEC* DLOGPDF) -- Function: int unur_distr_cvec_set_pdlogpdf (UNUR_DISTR* DISTRIBUTION, UNUR_FUNCTD_CVEC* PDLOGPDF) -- Function: UNUR_FUNCT_CVEC* unur_distr_cvec_get_logpdf (const UNUR_DISTR* DISTRIBUTION) -- Function: UNUR_VFUNCT_CVEC* unur_distr_cvec_get_dlogpdf (const UNUR_DISTR* DISTRIBUTION) -- Function: double unur_distr_cvec_eval_logpdf (const DOUBLE* X, UNUR_DISTR* DISTRIBUTION) -- Function: int unur_distr_cvec_eval_dlogpdf (double* RESULT, const DOUBLE* X, UNUR_DISTR* DISTRIBUTION) -- Function: double unur_distr_cvec_eval_pdlogpdf (const DOUBLE* X, int COORD, UNUR_DISTR* DISTRIBUTION) Analogous calls for the logarithm of the density function. -- Function: int unur_distr_cvec_set_mean (UNUR_DISTR* DISTRIBUTION, const DOUBLE* MEAN) Set mean vector for multivariate DISTRIBUTION. MEAN must be a pointer to an array of size ‘dim’, where ‘dim’ is the dimension returned by ‘unur_distr_get_dim’. A ‘NULL’ pointer for MEAN is interpreted as the zero vector (0,...,0). *Important:* If the parameters of a distribution from the UNU.RAN library of standard distributions (*note Standard distributions: Stddist.) are changed, then neither its mode nor the normalization constant are updated. Please use the respective calls ‘unur_distr_cvec_upd_mode’ and ‘unur_distr_cvec_upd_pdfvol’. -- Function: const double* unur_distr_cvec_get_mean (const UNUR_DISTR* DISTRIBUTION) Get the mean vector of the DISTRIBUTION. The function returns a pointer to an array of size ‘dim’. If the mean vector is not marked as known the ‘NULL’ pointer is returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_GET’. _Important:_ Do *not* modify the array that holds the mean vector! -- Function: int unur_distr_cvec_set_covar (UNUR_DISTR* DISTRIBUTION, const DOUBLE* COVAR) Set covariance matrix for multivariate DISTRIBUTION. COVAR must be a pointer to an array of size ‘dim’ x ‘dim’, where ‘dim’ is the dimension returned by ‘unur_distr_get_dim’. The rows of the matrix have to be stored consecutively in this array. COVAR must be a variance-covariance matrix of the DISTRIBUTION, i.e. it must be symmetric and positive definit and its diagonal entries (i.e. the variance of the components of the random vector) must be strictly positive. The Cholesky factor is computed (and stored) to verify the positive definiteness condition. Notice that the inverse of the given covariance matrix is automatically computed when it is requested by some routine. Notice that the computation of this inverse matrix is unstable in case of high correlations and/or high dimensions. Thus it might fail and methods that require this inverse cannot be used. As an alternative the inverse of the covariance matrix can be directly set by a ‘unur_distr_cvec_set_covar_inv’ call. A ‘NULL’ pointer for COVAR is interpreted as the identity matrix. _Important:_ This entry is abused in some methods which do not require the covariance matrix. It is then used to perform some transformation to obtain better performance. _Important:_ In case of an error (e.g. because COVAR is not a valid covariance matrix) an error code is returned. Moreover, the covariance matrix is not set and is marked as unknown. A previously set covariance matrix is then no longer available. *Important:* If the parameters of a distribution from the UNU.RAN library of standard distributions (*note Standard distributions: Stddist.) are changed, then neither its mode nor the normalization constant are updated. Please use the respective calls ‘unur_distr_cvec_upd_mode’ and ‘unur_distr_cvec_upd_pdfvol’. _Remark:_ UNU.RAN does not check whether the an eventually set covariance matrix and a rank-correlation matrix do not contradict each other. -- Function: int unur_distr_cvec_set_covar_inv (UNUR_DISTR* DISTRIBUTION, const DOUBLE* COVAR_INV) Set inverse of the covariance matrix for multivariate DISTRIBUTION. COVAR_INV must be a pointer to an array of size ‘dim’ x ‘dim’, where ‘dim’ is the dimension returned by ‘unur_distr_get_dim’. The rows of the matrix have to be stored consecutively in this array. COVAR_INV must be symmetric and positive definit. Only the symmetry of the matrix is checked. A ‘NULL’ pointer for COVAR_INV is interpreted as the identity matrix. _Important:_ In case of an error (because COVAR_INV is not symetric) an error code is returned. Moreover, the inverse of the covariance matrix is not set and is marked as unknown. A previously set inverse matrix is then no longer available. _Remark:_ UNU.RAN does not check whether the given matrix is positive definit. _Remark:_ UNU.RAN does not check whether the matrix COVAR_INV is the inverse of the eventually set covariance matrix. -- Function: const double* unur_distr_cvec_get_covar (const UNUR_DISTR* DISTRIBUTION) -- Function: const double* unur_distr_cvec_get_cholesky (const UNUR_DISTR* DISTRIBUTION) -- Function: const double* unur_distr_cvec_get_covar_inv (UNUR_DISTR* DISTRIBUTION) Get covariance matrix of DISTRIBUTION, its Cholesky factor, and its inverse, respectively. The function returns a pointer to an array of size ‘dim’ x ‘dim’. The rows of the matrix are stored consecutively in this array. If the requested matrix is not marked as known the ‘NULL’ pointer is returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_GET’. _Important:_ Do *not* modify the array that holds the covariance matrix! _Remark:_ The inverse of the covariance matrix is computed if it is not already stored. -- Function: int unur_distr_cvec_set_rankcorr (UNUR_DISTR* DISTRIBUTION, const DOUBLE* RANKCORR) Set rank-correlation matrix (Spearman’s correlation) for multivariate DISTRIBUTION. RANKCORR must be a pointer to an array of size ‘dim’ x ‘dim’, where ‘dim’ is the dimension returned by ‘unur_distr_get_dim’. The rows of the matrix have to be stored consecutively in this array. RANKCORR must be a rank-correlation matrix of the DISTRIBUTION, i.e. it must be symmetric and positive definite and its diagonal entries must be equal to ‘1’. The Cholesky factor is computed (and stored) to verify the positive definiteness condition. A ‘NULL’ pointer for RANKCORR is interpreted as the identity matrix. _Important:_ In case of an error (e.g. because RANKCORR is not a valid rank-correlation matrix) an error code is returned. Moreover, the rank-correlation matrix is not set and is marked as unknown. A previously set rank-correlation matrix is then no longer available. _Remark:_ UNU.RAN does not check whether the an eventually set covariance matrix and a rank-correlation matrix do not contradict each other. -- Function: const double* unur_distr_cvec_get_rankcorr (const UNUR_DISTR* DISTRIBUTION) -- Function: const double* unur_distr_cvec_get_rk_cholesky (const UNUR_DISTR* DISTRIBUTION) Get rank-correlation matrix and its cholesky factor, respectively, of DISTRIBUTION. The function returns a pointer to an array of size ‘dim’ x ‘dim’. The rows of the matrix are stored consecutively in this array. If the requested matrix is not marked as known the ‘NULL’ pointer is returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_GET’. _Important:_ Do *not* modify the array that holds the rank-correlation matrix! -- Function: int unur_distr_cvec_set_marginals (UNUR_DISTR* DISTRIBUTION, UNUR_DISTR* MARGINAL) Sets marginal distributions of the given DISTRIBUTION to the same MARGINAL distribution object. The MARGINAL distribution must be an instance of a continuous univariate distribution object. Notice that the marginal distribution is copied into the DISTRIBUTION object. -- Function: int unur_distr_cvec_set_marginal_array (UNUR_DISTR* DISTRIBUTION, UNUR_DISTR** MARGINALS) Analogously to the above ‘unur_distr_cvec_set_marginals’ call. However, now an array MARGINALS of the pointers to each of the marginal distributions must be given. It *must* be an array of size ‘dim’, where ‘dim’ is the dimension returned by ‘unur_distr_get_dim’. _Notice_: Local copies for each of the entries are stored in the DISTRIBUTION object. If some of these entries are identical (i.e. contain the same pointer), then for each of these a new copy is made. -- Function: int unur_distr_cvec_set_marginal_list (UNUR_DISTR* DISTRIBUTION, ...) Similar to the above ‘unur_distr_cvec_set_marginal_array’ call. However, now the pointers to the particular marginal distributions can be given as parameter and does not require an array of pointers. Additionally the given distribution objects are immediately destroyed. Thus calls like ‘unur_distr_normal’ can be used as arguments. (With ‘unur_distr_cvec_set_marginal_array’ the result of such call has to be stored in a pointer since it has to be freed afterwarts to avoid memory leaks!) The number of pointers to in the list of function arguments *must* be equal to the dimension of the DISTRIBUTION, i.e. the dimension returned by ‘unur_distr_get_dim’. If one of the given pointer to marginal distributions is the ‘NULL’ pointer then the marginal distributions of DISTRIBUTION are not set (or previous settings are not changed) and an error code is returned. *Important:* All distribution objects given in the argument list are destroyed! -- Function: const UNUR_DISTR* unur_distr_cvec_get_marginal (const UNUR_DISTR* DISTRIBUTION, int N) Get pointer to the N-th marginal distribution object from the given multivariate DISTRIBUTION. If this does not exist, ‘NULL’ is returned. The marginal distributions are enumerated from ‘1’ to ‘dim’, where ‘dim’ is the dimension returned by ‘unur_distr_get_dim’. -- Function: int unur_distr_cvec_set_pdfparams (UNUR_DISTR* DISTRIBUTION, const DOUBLE* PARAMS, int N_PARAMS) Sets array of parameters for DISTRIBUTION. There is an upper limit for the number of parameters ‘n_params’. It is given by the macro ‘UNUR_DISTR_MAXPARAMS’ in ‘unuran_config.h’. (It is set to 5 by default but can be changed to any appropriate nonnegative number.) If N_PARAMS is negative or exceeds this limit no parameters are copied into the distribution object and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_NPARAMS’. For standard distributions from the UNU.RAN library the parameters are checked. Moreover, the domain is updated automatically. If the given parameters are invalid for the standard distribution, then no parameters are set and an error code is returned. Notice that the given parameter list for such a distribution is handled in the same way as in the corresponding ‘new’ calls, i.e. optional parameters for the PDF that are not present in the given list are (re-)set to their default values. *Important:* If the parameters of a distribution from the UNU.RAN library of standard distributions (*note Standard distributions: Stddist.) are changed, then neither its mode nor the normalization constant are updated. Please use the respective calls ‘unur_distr_cvec_upd_mode’ and ‘unur_distr_cvec_upd_pdfvol’. -- Function: int unur_distr_cvec_get_pdfparams (const UNUR_DISTR* DISTRIBUTION, const DOUBLE** PARAMS) Get number of parameters of the PDF and set pointer PARAMS to array of parameters. If no parameters are stored in the object, an error code is returned and ‘params’ is set to ‘NULL’. _Important:_ Do *not* change the entries in PARAMS! -- Function: int unur_distr_cvec_set_pdfparams_vec (UNUR_DISTR* DISTRIBUTION, int PAR, const DOUBLE* PARAM_VEC, int N_PARAMS) This function provides an interface for additional vector parameters for a multivariate DISTRIBUTION besides mean vector and covariance matrix which have their own calls. It sets the parameter with number PAR. PAR indicates directly which of the parameters is set and must be a number between ‘0’ and ‘UNUR_DISTR_MAXPARAMS’-1 (the upper limit of possible parameters defined in ‘unuran_config.h’; it is set to 5 but can be changed to any appropriate nonnegative number.) The entries of a this parameter are given by the array PARAM_VEC of size N_PARAMS. Notice that using this interface an An (n x m)-matrix has to be stored in an array of length N_PARAMS = n times m; where the rows of the matrix are stored consecutively in this array. Due to great variety of possible parameters for a multivariate DISTRIBUTION there is no simpler interface. If PARAM_VEC is ‘NULL’ then the corresponding entry is cleared. *Important:* If the parameters of a distribution from the UNU.RAN library of standard distributions (*note Standard distributions: Stddist.) are changed, then neither its mode nor the normalization constant are updated. Please use the respective calls ‘unur_distr_cvec_upd_mode’ and ‘unur_distr_cvec_upd_pdfvol’. If an error occurs no parameters are copied into the parameter object ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’. -- Function: int unur_distr_cvec_get_pdfparams_vec (const UNUR_DISTR* DISTRIBUTION, int PAR, const DOUBLE** PARAM_VECS) Get parameter of the PDF with number PAR. The pointer to the parameter array is stored in PARAM_VECS, its size is returned by the function. If the requested parameter is not set, then an error code is returned and ‘params’ is set to ‘NULL’. _Important:_ Do *not* change the entries in PARAM_VECS! -- Function: int unur_distr_cvec_set_domain_rect (UNUR_DISTR* DISTRIBUTION, const DOUBLE* LOWERLEFT, const DOUBLE* UPPERRIGHT) Set rectangular domain for DISTRIBUTION with LOWERLEFT and UPPERRIGHT vertices. Both must be pointer to an array of the size returned by ‘unur_distr_get_dim’. A ‘NULL’ pointer is interpreted as the zero vector (0,...,0). For setting a coordinate of the boundary to +/- infinity use ‘+/- UNUR_INFINITY’. The LOWERLEFT vertex must be strictly smaller than UPPERRIGHT in each component. Otherwise no domain is set and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_SET’. By default the domain of a distribution is unbounded. Thus one can use this call to truncate an existing distribution. _Important:_ Changing the domain of DISTRIBUTION marks derived parameters like the mode or the center as unknown and must be set _after_ changing the domain. This is important for the already set (or default) value for the center does not fall into the given domain. Notice that calls of the PDF and derived functions return ‘0.’ when the parameter is not contained in the domain. -- Function: int unur_distr_cvec_is_indomain (const DOUBLE* X, const UNUR_DISTR* DISTRIBUTION) Check whether X falls into the domain of DISTRIBUTION. Derived parameters .................. The following paramters *must* be set whenever one of the essential parameters has been set or changed (and the parameter is required for the chosen method). -- Function: int unur_distr_cvec_set_mode (UNUR_DISTR* DISTRIBUTION, const DOUBLE* MODE) Set mode of the DISTRIBUTION. MODE must be a pointer to an array of the size returned by ‘unur_distr_get_dim’. A ‘NULL’ pointer for MODE is interpreted as the zero vector (0,...,0). -- Function: int unur_distr_cvec_upd_mode (UNUR_DISTR* DISTRIBUTION) Recompute the mode of the DISTRIBUTION. This call works properly for distribution objects from the UNU.RAN library of standard distributions when the corresponding function is available. If it failes ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’. -- Function: const double* unur_distr_cvec_get_mode (UNUR_DISTR* DISTRIBUTION) Get mode of the DISTRIBUTION. The function returns a pointer to an array of the size returned by ‘unur_distr_get_dim’. If the mode is not marked as known the ‘NULL’ pointer is returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_GET’. (There is no difference between the case where no routine for computing the mode is available and the case where no mode exists for the DISTRIBUTION at all.) _Important:_ Do *not* modify the array that holds the mode! -- Function: int unur_distr_cvec_set_center (UNUR_DISTR* DISTRIBUTION, const DOUBLE* CENTER) Set center of the DISTRIBUTION. CENTER must be a pointer to an array of the size returned by ‘unur_distr_get_dim’. A ‘NULL’ pointer for CENTER is interpreted as the zero vector (0,...,0). The center is used by some methods to shift the distribution in order to decrease numerical round-off error. If not given explicitly a default is used. Moreover, it is used as starting point for several numerical search algorithm (e.g. for the mode). Then CENTER must be a pointer where the call to the PDF returns a non-zero value. In particular CENTER must contained in the domain of the distribution. Default: The mode, if given by a ‘unur_distr_cvec_set_mode’ call; else the mean, if given by a ‘unur_distr_cvec_set_mean’ call; otherwise the null vector (0,...,0). -- Function: const double* unur_distr_cvec_get_center (UNUR_DISTR* DISTRIBUTION) Get center of the DISTRIBUTION. The function returns a pointer to an array of the size returned by ‘unur_distr_get_dim’. It always returns some point as there always exists a default for the center, see ‘unur_distr_cvec_set_center’. _Important:_ Do *not* modify the array that holds the center! -- Function: int unur_distr_cvec_set_pdfvol (UNUR_DISTR* DISTRIBUTION, double VOLUME) Set the volume below the PDF. If VOL is non-positive, no volume is set and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_SET’. -- Function: int unur_distr_cvec_upd_pdfvol (UNUR_DISTR* DISTRIBUTION) Recompute the volume below the PDF of the distribution. It only works for distribution objects from the UNU.RAN library of standard distributions when the corresponding function is available. Otherwise ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’. This call also sets the normalization constant such that the given PDF is the derivative of a given CDF, i.e. the volume is 1. -- Function: double unur_distr_cvec_get_pdfvol (UNUR_DISTR* DISTRIBUTION) Get the volume below the PDF of the DISTRIBUTION. If this volume is not known, ‘unur_distr_cont_upd_pdfarea’ is called to compute it. If this is not successful ‘UNUR_INFINITY’ is returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_GET’. 4.6 Continuous univariate full conditional distribution ======================================================= Full conditional distribution for a given continuous multivariate distributiion. The condition is a position vector and either a variable that is variated or a vector that indicates the direction on which the random vector can variate. There is a subtle difference between using direction vector and using the K-th variable. When a direction vector is given the PDF of the conditional distribution is defined by f(t) = PDF(pos + t * dir). When a variable is selected the full conditional distribution with all other variables fixed is used. This is a special case of a continuous univariate distribution and thus they have most of these parameters (with the exception that functions cannot be changed). Additionally, − there is a call to extract the underlying multivariate distribution, − and a call to handle the variables that are fixed and the direction for changing the random vector. This distibution type is primarily used for evaluation the conditional distribution and its derivative (as required for, e.g., the Gibbs sampler). The density is not normalized (i.e. does not integrate to one). Mode and area are not available and it does not make sense to use any call to set or change parameters except the ones given below. Function reference ------------------ -- Function: UNUR_DISTR* unur_distr_condi_new (const UNUR_DISTR* DISTRIBUTION, const DOUBLE* POS, const DOUBLE* DIR, int K) Create an object for full conditional distribution for the given DISTRIBUTION. The condition is given by a position vector POS and either the K-th variable that is variated or the vector DIR that contains the direction on which the random vector can variate. DISTRIBUTION must be a pointer to a multivariate continuous distribution. POS must be a pointer to an array of size ‘dim’, where ‘dim’ is the dimension of the underlying distribution object. DIR must be a pointer to an array if size ‘dim’ or ‘NULL’. K must be in the range ‘0, ..., dim-1’. If the K-th variable is used, DIR must be set to ‘NULL’. _Notice:_ There is a subtle difference between using direction vector DIR and using the K-th variable. When DIR is given, the current position POS is mapped into 0 of the conditional distribution and the derivative is taken from the function PDF(POS+t*DIR) w.r.t. t. On the other hand, when the coordinate K is used (i.e., when DIR is set to ‘NULL’), the full conditional distribution of the distribution is considered (as used for the Gibbs sampler). In particular, the current point is just projected into the one-dimensional subspace without mapping it into the point 0. _Notice:_ If a coordinate K is used, then the K-th partial derivative is used if it as available. Otherwise the gradient is computed and the K-th component is returned. The resulting generator object is of the same type as of a ‘unur_distr_cont_new’ call. -- Function: int unur_distr_condi_set_condition (struct UNUR_DISTR* DISTRIBUTION, const DOUBLE* POS, const DOUBLE* DIR, int K) Set/change condition for conditional DISTRIBUTION. Change values of fixed variables to POS and use direction DIR or K-th variable of conditional DISTRIBUTION. POS must be a pointer to an array of size ‘dim’, where ‘dim’ is the dimension of the underlying distribution object. DIR must be a pointer to an array if size ‘dim’ or ‘NULL’. K must be in the range ‘0, ..., dim-1’. If the K-th variable is used, DIR must be set to ‘NULL’. _Notice:_ There is a subtle difference between using direction vector DIR and using the K-th variable. When DIR is given, the current position POS is mapped into 0 of the conditional distribution and the derivative is taken from the function PDF(POS+t*DIR) w.r.t. t. On the other hand, when the coordinate K is used (i.e., when DIR is set to ‘NULL’), the full conditional distribution of the distribution is considered (as used for the Gibbs sampler). In particular, the current point is just projected into the one-dimensional subspace without mapping it into the point 0. -- Function: int unur_distr_condi_get_condition (struct UNUR_DISTR* DISTRIBUTION, const DOUBLE** POS, const DOUBLE** DIR, int* K) Get condition for conditional DISTRIBUTION. The values for the fixed variables are stored in POS, which must be a pointer to an array of size ‘dim’. The condition is stored in DIR and K, respectively. _Important:_ Do *not* change the entries in POS and DIR! -- Function: const UNUR_DISTR* unur_distr_condi_get_distribution (const UNUR_DISTR* DISTRIBUTION) Get pointer to distribution object for underlying distribution. 4.7 Continuous empirical multivariate distributions =================================================== Empirical multivariate distributions are just lists of vectors (with the same dimension). Thus there are only calls to insert these data. How these data are used to sample from the empirical distribution depends from the chosen generation method. Function reference ------------------ -- Function: UNUR_DISTR* unur_distr_cvemp_new (int DIM) Create a new (empty) object for an empirical multivariate continuous distribution. DIM is the number of components of the random vector (i.e. its dimension). It must be at least 2; otherwise ‘unur_distr_cemp_new’ should be used to create an object for an empirical univariate distribution. Essential parameters .................... -- Function: int unur_distr_cvemp_set_data (UNUR_DISTR* DISTRIBUTION, const DOUBLE* SAMPLE, int N_SAMPLE) Set observed sample for empirical DISTRIBUTION. SAMPLE is an array of doubles of size ‘dim’ x N_SAMPLE, where ‘dim’ is the dimension of the DISTRIBUTION returned by ‘unur_distr_get_dim’. The data points must be stored consecutively in SAMPLE, i.e., data points (x1, y1), (x2, y2), ... are given as an array {x1, y1, x2, y2, ...}. -- Function: int unur_distr_cvemp_read_data (UNUR_DISTR* DISTRIBUTION, const CHAR* FILENAME) Read data from file ‘filename’. It reads the first ‘dim’ numbers from each line, where ‘dim’ is the dimension of the DISTRIBUTION returned by ‘unur_distr_get_dim’. Numbers are parsed by means of the C standard routine ‘strtod’. Lines that do not start with ‘+’, ‘-’, ‘.’, or a digit are ignored. (Beware of lines starting with a blank!) In case of an error (file cannot be opened, too few entries in a line, invalid string for double in line) no data are copied into the distribution object and an error code is returned. -- Function: int unur_distr_cvemp_get_data (const UNUR_DISTR* DISTRIBUTION, const DOUBLE** SAMPLE) Get number of samples and set pointer SAMPLE to array of observations. If no sample has been given, an error code is returned and SAMPLE is set to ‘NULL’. If successful SAMPLE points to an array of length ‘dim’ x ‘n_sample’, where ‘dim’ is the dimension of the distribution returned by ‘unur_distr_get_dim’ and ‘n_sample’ the return value of the function. _Important:_ Do *not* modify the array SAMPLE. 4.8 MATRix distributions ======================== Distributions for random matrices. Notice that UNU.RAN uses arrays of ‘double’s to handle matrices. The rows of the matrix are stored consecutively. Function reference ------------------ -- Function: UNUR_DISTR* unur_distr_matr_new (int N_ROWS, int N_COLS) Create a new (empty) object for a matrix distribution. N_ROWS and N_COLS are the respective numbers of rows and columns of the random matrix (i.e. its dimensions). It is also possible to have only one number or rows and/or columns. Notice, however, that this is treated as a distribution of random matrices with only one row or column or component and not as a distribution of vectors or real numbers. For the latter ‘unur_distr_cont_new’ or ‘unur_distr_cvec_new’ should be used to create an object for a univariate distribution and a multivariate (vector) distribution, respectively. Essential parameters .................... -- Function: int unur_distr_matr_get_dim (const UNUR_DISTR* DISTRIBUTION, int* N_ROWS, int* N_COLS) Get number of rows and columns of random matrix (its dimension). It returns the total number of components. If successfull ‘UNUR_SUCCESS’ is returned. 4.9 Discrete univariate distributions ===================================== The calls in this section can be applied to discrete univariate distributions. − Create a ‘new’ instance of a discrete univariate distribution. − Handle and evaluate distribution function (CDF, ‘cdf’) and probability mass function (PMF, ‘pmf’). The following is important: . ‘pmf’ need not be normalized, i.e., any summable nonnegative function on the set of intergers can be used. . ‘cdf’ must be a distribution function, i.e. it must be monotonically increasing with range [0,1]. . If ‘cdf’ and ‘pdf’ are used together for a pariticular generation method, then ‘pmf’ must be normalized, i.e. it must sum to 1. − Alternatively, ‘cdf’ and ‘pdf’ can be provided as ‘str’ings instead of function pointers. − Some generation methods require a (finite) probability vector (PV, ‘pv’), i.e. an array of ‘double’s. It can be automatically computed if the ‘pmf’ is given but ‘pv’ is not. − Set (and change) parameters (‘pmfparams’) and the total sum (‘pmfsum’) of the given PMF or PV. − Set the ‘mode’ of the distribution. − Set the ‘domain’ of the distribution. Function reference ------------------ -- Function: UNUR_DISTR* unur_distr_discr_new (void) Create a new (empty) object for a univariate discrete distribution. Essential parameters .................... There are two interfaces for discrete univariate distributions: Either provide a (finite) probability vector (PV). Or provide a probability mass function (PMF). For the latter case there are also a couple of derived parameters that are not required when a PV is given. It is not possible to set both a PMF and a PV directly. However, the PV can be computed from the PMF (or the CDF if no PMF is available) by means of a ‘unur_distr_discr_make_pv’ call. If both the PV and the PMF are given in the distribution object it depends on the generation method which of these is used. -- Function: int unur_distr_discr_set_pv (UNUR_DISTR* DISTRIBUTION, const DOUBLE* PV, int N_PV) Set finite probability vector (PV) for the DISTRIBUTION. It is not necessary that the entries in the given PV sum to 1. N_PV must be positive. However, there is no testing whether all entries in PV are non-negative. If no domain has been set, then the left boundary is set to ‘0’, by default. If N_PV is too large, e.g. because left boundary + N_PV exceeds the range of integers, then the call fails. Notice that it is not possible to set both a PV and a PMF or CDF. If the PMF or CDF is set first one cannot set the PV. If the PMF or CDF is set first after a PV is set, the latter is removed (and recomputed using ‘unur_distr_discr_make_pv’ when required). -- Function: int unur_distr_discr_make_pv (UNUR_DISTR* DISTRIBUTION) Compute a PV when a PMF or CDF is given. However, when the domain is not given or is too large and the sum over the PMF is given then the (right) tail of the DISTRIBUTION is chopped off such that the probability for the tail region is less than 1.e-8. If the sum over the PMF is not given a PV of maximal length is computed. The maximal size of the created PV is bounded by the macro ‘UNUR_MAX_AUTO_PV’ that is defined in ‘unuran_config.h’. If successful, the length of the generated PV is returned. If the sum over the PMF on the chopped tail is not neglible small (i.e. greater than 1.e-8 or unknown) than the negative of the length of the PV is returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_SET’. Notice that the left boundary of the PV is set to ‘0’ by default when a discrete distribution object is created from scratch. If computing a PV fails for some reasons, an error code is returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_SET’. -- Function: int unur_distr_discr_get_pv (const UNUR_DISTR* DISTRIBUTION, const DOUBLE** PV) Get length of PV of the DISTRIBUTION and set pointer PV to array of probabilities. If no PV is given, an error code is returned and PV is set to ‘NULL’. (It does not call ‘unur_distr_discr_make_pv’ !) -- Function: int unur_distr_discr_set_pmf (UNUR_DISTR* DISTRIBUTION, UNUR_FUNCT_DISCR* PMF) -- Function: int unur_distr_discr_set_cdf (UNUR_DISTR* DISTRIBUTION, UNUR_FUNCT_DISCR* CDF) Set respective pointer to the PMF and the CDF of the DISTRIBUTION. These functions must be of type ‘double funct(int k, const UNUR_DISTR *distr)’. It is important to note that all these functions must return a result for all integers K. E.g., if the domain of a given PMF is the interval {1,2,3,...,100}, than the given function must return ‘0.0’ for all points outside this interval. The default domain for the PMF or CDF is [‘0’, ‘INT_MAX’]. The domain can be changed using a ‘unur_distr_discr_set_domain’ call. It is not possible to change such a function. Once the PMF or CDF is set it cannot be overwritten. A new distribution object has to be used instead. Notice that it is not possible to set both a PV and a PMF or CDF. If the PMF or CDF is set first one cannot set the PV. If the PMF or CDF is set first after a PV is set, the latter is removed (and recomputed using ‘unur_distr_discr_make_pv’ when required). -- Function: int unur_distr_discr_set_invcdf (UNUR_DISTR* DISTRIBUTION, UNUR_IFUNCT_DISCR* INVCDF) Set inverse CDF of the DISTRIBUTION. INVCDF must be a pointer must be of type ‘int funct(double x, const UNUR_DISTR *distr)’, i.e., it should return a ‘double’. -- Function: double unur_distr_discr_eval_pv (int K, const UNUR_DISTR* DISTRIBUTION) -- Function: double unur_distr_discr_eval_pmf (int K, const UNUR_DISTR* DISTRIBUTION) -- Function: double unur_distr_discr_eval_cdf (int K, const UNUR_DISTR* DISTRIBUTION) Evaluate the PV, PMF, and the CDF, respectively, at k. Notice that DISTRIBUTION must not be the ‘NULL’ pointer. If no PV is set for the DISTRIBUTION, then ‘unur_distr_discr_eval_pv’ behaves like ‘unur_distr_discr_eval_pmf’. If the corresponding function is not available for the DISTRIBUTION, ‘UNUR_INFINITY’ is returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’. _IMPORTANT:_ In the case of a truncated standard distribution these calls always return the respective values of the _untruncated_ distribution! -- Function: int unur_distr_discr_eval_invcdf (double U, const UNUR_DISTR* DISTRIBUTION) Evaluate the inverse CDF at U. Notice that DISTRIBUTION must not be the ‘NULL’ pointer. If the corresponding function is not available for the distribution, ‘INT_MAX’ is returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’. _IMPORTANT:_ In the case of a truncated standard distribution these calls always return the respective values of the _untruncated_ distribution! -- Function: int unur_distr_discr_set_pmfstr (UNUR_DISTR* DISTRIBUTION, const CHAR* PMFSTR) This function provides an alternative way to set a PMF of the DISTRIBUTION. PMFSTR is a character string that contains the formula for the PMF, see *note Function String: StringFunct, for details. See also the remarks for the ‘unur_distr_discr_set_pmf’ call. It is not possible to call this funtion twice or to call this function after a ‘unur_distr_discr_set_pmf’ call. -- Function: int unur_distr_discr_set_cdfstr (UNUR_DISTR* DISTRIBUTION, const CHAR* CDFSTR) This function provides an alternative way to set a CDF; analogously to the ‘unur_distr_discr_set_pmfstr’ call. -- Function: char* unur_distr_discr_get_pmfstr (const UNUR_DISTR* DISTRIBUTION) -- Function: char* unur_distr_discr_get_cdfstr (const UNUR_DISTR* DISTRIBUTION) Get pointer to respective string for PMF and CDF of DISTRIBUTION that is given via the string interface. This call allocates memory to produce this string. It should be freed when it is not used any more. -- Function: int unur_distr_discr_set_pmfparams (UNUR_DISTR* DISTRIBUTION, const DOUBLE* PARAMS, int N_PARAMS) Set array of parameters for DISTRIBUTION. There is an upper limit for the number of parameters N_PARAMS. It is given by the macro ‘UNUR_DISTR_MAXPARAMS’ in ‘unuran_config.h’. (It is set to 5 but can be changed to any appropriate nonnegative number.) If N_PARAMS is negative or exceeds this limit no parameters are copied into the DISTRIBUTION object and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_NPARAMS’. For standard distributions from the UNU.RAN library the parameters are checked. Moreover, the domain is updated automatically unless it has been changed before by a ‘unur_distr_discr_set_domain’ call. If the given parameters are invalid for the standard distribution, then no parameters are set and an error code is returned. Notice that the given parameter list for such a distribution is handled in the same way as in the corresponding ‘new’ calls, i.e. optional parameters for the PDF that are not present in the given list are (re-)set to their default values. _Important:_ Integer parameter must be given as ‘double’s. -- Function: int unur_distr_discr_get_pmfparams (const UNUR_DISTR* DISTRIBUTION, const DOUBLE** PARAMS) Get number of parameters of the PMF and set pointer PARAMS to array of parameters. If no parameters are stored in the object, an error code is returned and ‘params’ is set to ‘NULL’. -- Function: int unur_distr_discr_set_domain (UNUR_DISTR* DISTRIBUTION, int LEFT, int RIGHT) Set the left and right borders of the domain of the DISTRIBUTION. This can also be used to truncate an existing distribution. For setting the boundary to +/- infinity use ‘INT_MIN’ and ‘INT_MAX’, respectively. If RIGHT is not strictly greater than LEFT no domain is set and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_SET’. It is allowed to use this call to increase the domain. If the PV of the discrete distribution is used, than the right boudary is ignored (and internally set to LEFT + size of PV - 1). Notice that ‘INT_MIN’ and ‘INT_MAX’ are interpreted as (minus/plus) infinity. Default: [‘0’, ‘INT_MAX’]. -- Function: int unur_distr_discr_get_domain (const UNUR_DISTR* DISTRIBUTION, int* LEFT, int* RIGHT) Get the left and right borders of the domain of the DISTRIBUTION. If the domain is not set explicitly the interval [‘INT_MIN’, ‘INT_MAX’] is assumed and returned. When a PV is given then the domain is set automatically to [‘0’,size of PV - 1]. Derived parameters .................. The following paramters *must* be set whenever one of the essential parameters has been set or changed (and the parameter is required for the chosen method). -- Function: int unur_distr_discr_set_mode (UNUR_DISTR* DISTRIBUTION, int MODE) Set mode of DISTRIBUTION. -- Function: int unur_distr_discr_upd_mode (UNUR_DISTR* DISTRIBUTION) Recompute the mode of the DISTRIBUTION. This call works properly for distribution objects from the UNU.RAN library of standard distributions when the corresponding function is available. Otherwise a (slow) numerical mode finder is used. It only works properly for unimodal probability mass functions. If it failes ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’. -- Function: int unur_distr_discr_get_mode (UNUR_DISTR* DISTRIBUTION) Get mode of DISTRIBUTION. If the mode is not marked as known, ‘unur_distr_discr_upd_mode’ is called to compute the mode. If this is not successful ‘INT_MAX’ is returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_GET’. (There is no difference between the case where no routine for computing the mode is available and the case where no mode exists for the distribution at all.) -- Function: int unur_distr_discr_set_pmfsum (UNUR_DISTR* DISTRIBUTION, double SUM) Set the sum over the PMF. If ‘sum’ is non-positive, no sum is set and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_SET’. For a distribution object created by the UNU.RAN library of standard distributions you always should use the ‘unur_distr_discr_upd_pmfsum’. Otherwise there might be ambiguous side-effects. -- Function: int unur_distr_discr_upd_pmfsum (UNUR_DISTR* DISTRIBUTION) Recompute the sum over the PMF of the DISTRIBUTION. In most cases the normalization constant is recomputed and thus the sum is 1. This call works for distribution objects from the UNU.RAN library of standard distributions when the corresponding function is available. When a PV, a PMF with finite domain, or a CDF is given, a simple generic function which uses a naive summation loop is used. If this computation is not possible, an error code is returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_DATA’. The call does not work for distributions from the UNU.RAN library of standard distributions with truncated domain when the CDF is not available. -- Function: double unur_distr_discr_get_pmfsum (UNUR_DISTR* DISTRIBUTION) Get the sum over the PMF of the DISTRIBUTION. If this sum is not known, ‘unur_distr_discr_upd_pmfsum’ is called to compute it. If this is not successful ‘UNUR_INFINITY’ is returned and ‘unur_errno’ is set to ‘UNUR_ERR_DISTR_GET’. 5 Methods for generating non-uniform random variates **************************************************** Sampling from a particular distribution with UNU.RAN requires the following steps: 1. Create a distribution object (*note Handling distribution objects: Distribution_objects.). 2. Select a method and create a parameter object. 3. Initizialize the generator object using ‘unur_init’. _Important_: Initialization of the generator object might fail. ‘unur_init’ returns a ‘NULL’ pointer then, which *must* not be used for sampling. 4. Draw a sample from the generator object using the corresponding sampling function (depending on the type of distribution: univariate continuous, univariate discrete, multivariate continuous, and random matrix). 5. It is possible for a generator object to change the parameters and the domain of the underlying distribution. This must be done by extracting this object by means of a ‘unur_get_distr’ call and changing the distribution using the correspondig set calls, see *note Handling distribution objects: Distribution_objects. The generator object *must* then be reinitialized by means of the ‘unur_reinit’ call. _Important_: Currently not all methods allow reinitialization, see the description of the particular method (keyword Reinit). _Important_: Reinitialization of the generator object might fail. Thus one *must* check the return code of the ‘unur_reinit’ call. _Important_: When reinitialization fails then sampling routines always return ‘UNUR_INFINITY’ (for continuous distributions) or ‘0’ (for discrete distributions), respectively. However, it is still possible to change the underlying distribution and try to reinitialize again. 5.1 Routines for all generator objects ====================================== Routines for all generator objects. Function reference ------------------ -- Function: UNUR_GEN* unur_init (UNUR_PAR* PARAMETERS) Initialize a generator object. All necessary information must be stored in the parameter object. *Important:* If an error has occurred a ‘NULL’ pointer is return. This must not be used for the sampling routines (this causes a segmentation fault). *Always* check whether the call was successful or not! _Important:_ This call destroys the PARAMETER object automatically. Thus it is not necessary/allowed to free it. -- Function: int unur_reinit (UNUR_GEN* GENERATOR) Update an existing generator object after the underlying distribution has been modified (using ‘unur_get_distr’ together with corresponding set calls. It *must* be executed before sampling using this generator object is continued as otherwise it produces an invalid sample or might even cause a segmentation fault. _Important_: Currently not all methods allow reinitialization, see the description of the particular method (keyword Reinit). _Important_: Reinitialization of the generator object might fail. Thus one *must* check the return code: ‘UNUR_SUCCESS (0x0u)’ success (no error) ‘UNUR_ERR_NO_REINIT’ reinit routine not implemented. other values some error has occured while trying to reinitialize the generator object. _Important_: When reinitialization fails then sampling routines always return ‘UNUR_INFINITY’ (for continuous distributions) or ‘0’ (for discrete distributions), respectively. However, it is still possible to change the underlying distribution and try to reinitialize again. _Important_: When one tries to run ‘unur_reinit’, but reinitialization is not implemented, then the generator object cannot be used any more and must be destroyed and a new one has to be built from scratch. -- Function: int unur_sample_discr (UNUR_GEN* GENERATOR) -- Function: double unur_sample_cont (UNUR_GEN* GENERATOR) -- Function: int unur_sample_vec (UNUR_GEN* GENERATOR, double* VECTOR) -- Function: int unur_sample_matr (UNUR_GEN* GENERATOR, double* MATRIX) Sample from generator object. The three routines depend on the type of the generator object (discrete or continuous univariate distribution, multivariate distribution, or random matrix). _Notice:_ UNU.RAN uses arrays of ‘double’s to handle matrices. There the rows of the matrix are stored consecutively. _Notice:_ The routines ‘unur_sample_vec’ and ‘unur_sample_matr’ return ‘UNUR_SUCCESS’ if generation was successful and some error code otherwise. *Important:* These routines do *not* check whether GENERATOR is an invalid ‘NULL’ pointer. -- Function: double unur_quantile (UNUR_GEN* GENERATOR, double U) Compute the U quantile of a continuous distribution using a GENERATOR object that implements an (approximate) inversion methods. The following methods are currently available: • HINV, *note HINV::. • NINV, *note NINV::. • PINV, *note PINV::. • CSTD, *note CSTD::. This requires that GENERATOR implements an inversion method. • DGT, *note DGT::. The return value is (of course) type casted to ‘double’. *Important:* This routine does *not* check whether GENERATOR is an invalid ‘NULL’ pointer. In case of an error UNUR_INFINITY or INT_MAX (depending on the type of GENERATOR) is returned. -- Function: void unur_free (UNUR_GEN* GENERATOR) Destroy (free) the given generator object. -- Function: const char* unur_gen_info (UNUR_GEN* GENERATOR, int HELP) Get a string with informations about the given GENERATOR. These informations allow some fine tuning of the generation method. If HELP is ‘TRUE’, some hints on setting parameters are given. This function is intented for using in interactive environments (like R). If an error occurs, then ‘NULL’ is returned. -- Function: int unur_get_dimension (const UNUR_GEN* GENERATOR) Get the number of dimension of a (multivariate) distribution. For a univariate distribution ‘1’ is return. -- Function: const char* unur_get_genid (const UNUR_GEN* GENERATOR) Get identifier string for generator. -- Function: unsigned int unur_get_method (const UNUR_GEN* GENERATOR) Get identifier for generating method. These identifiers are declared in ‘src/methods/unur_metthods.h’. -- Function: int unur_gen_is_inversion (const UNUR_GEN* GEN) Return ‘TRUE’ if the generator object implements an inversion method, and ‘FALSE’ otherwise. -- Function: UNUR_DISTR* unur_get_distr (const UNUR_GEN* GENERATOR) Get pointer to distribution object from generator object. This function can be used to change the parameters of the distribution and reinitialize the generator object. Notice that currently *not all* generating methods have a reinitialize routine. This function should be used with extreme care. Changing the distribution is changed and using the generator object without reinitializing might cause wrong samples or segmentation faults. Moreover, if the corresponding generator object is freed, the pointer must not be used. *Important:* The returned distribution object must not be freed. If the distribution object is changed then one *must* run ‘unur_reinit’ ! -- Function: int unur_set_use_distr_privatecopy (UNUR_PAR* PARAMETERS, int USE_PRIVATECOPY) Set flag whether the generator object should make a private copy of the given distribution object or just stores the pointer to this distribution object. Values for USE_PRIVATECOPY: ‘TRUE’ make a private copy (default) ‘FALSE’ do not make a private copy and store pointer to given (external) distribution object. By default, generator objects keep their own private copy of the given distribution object. Thus the generator object can be handled independently from other UNU.RAN objects (with uniform random number generators as the only exception). When the generator object is initialized the given distribution object is cloned and stored. However, in some rare situations it can be useful when only the pointer to the given distribution object is stored without making a private copy. A possible example is when only one random variate has to be drawn from the distribution. This behavior can be achieved when USE_LOCALCOPY is set to ‘FALSE’. *Warning!* Using a pointer to the external distribution object instead of a private copy must be done with *extreme care*! When the distrubtion object is changed or freed then the generator object does not work any more, might case a segmentation fault, or (even worse) produces garbage. On the other hand, when the generator object is initialized or used to draw a random sampling the distribution object may be changed. _Notice:_ The prototypes of all ‘unur__new’ calls use a ‘const’ qualifier for the distribution argument. However, if USE_PRIVATECOPY is set to ‘FALSE’ this qualifier is discarded and the distribution might be changed. *Important!* If USE_LOCALCOPY is set to ‘FALSE’ and the corresponding distribution object is changed then one must run ‘unur_reinit’ on the generator object. (Notice that currently not all generation methods support reinitialization.) Default: USE_PRIVATECOPY is ‘TRUE’. 5.2 AUTO – Select method automatically ====================================== AUTO selects a an appropriate method for the given distribution object automatically. There are no parameters for this method, yet. But it is planned to give some parameter to describe the task for which the random variate generator is used for and thus make the choice of the generating method more appropriate. Notice that the required sampling routine for the generator object depends on the type of the given distribution object. The chosen method also depends on the sample size for which the generator object will be used. If only a few random variates the order of magnitude of the sample size should be set via a ‘unur_auto_set_logss’ call. IMPORTANT: This is an experimental version and the method chosen may change in future releases of UNU.RAN. For an example see *note As short as possible: Example_0. How To Use .......... Create a generator object for the given distribution object. Function reference ------------------ -- Function: UNUR_PAR* unur_auto_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_auto_set_logss (UNUR_PAR* PARAMETERS, int LOGSS) Set the order of magnitude for the size of the sample that will be generated by the generator, i.e., the the common logarithm of the sample size. Default is 10. Notice: This feature will be used in future releases of UNU.RAN only. 5.3 Methods for continuous univariate distributions =================================================== Overview of methods ------------------- Methods for continuous univariate distributions sample with ‘unur_sample_cont’ method PDF dPDF CDF mode area other AROU x x [x] T-concave ARS x x T-concave CEXT wrapper for external generator CSTD build-in standard distribution HINV [x] [x] x HRB bounded hazard rate HRD decreasing hazard rate HRI increasing hazard rate ITDR x x x monotone with pole NINV [x] x NROU x [x] PINV x [x] [~] SROU x x x T-concave SSR x x x T-concave TABL x x [~] all local extrema TDR x x T-concave UTDR x x ~ T-concave Example ------- /* ------------------------------------------------------------- */ /* File: example_cont.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* Example how to sample from a continuous univariate */ /* distribution. */ /* */ /* We build a distribution object from scratch and sample. */ /* ------------------------------------------------------------- */ /* Define the PDF and dPDF of our distribution. */ /* */ /* Our distribution has the PDF */ /* */ /* / 1 - x*x if |x| <= 1 */ /* f(x) = < */ /* \ 0 otherwise */ /* */ /* The PDF of our distribution: */ double mypdf( double x, const UNUR_DISTR *distr ) /* The second argument (`distr') can be used for parameters */ /* for the PDF. (We do not use parameters in our example.) */ { if (fabs(x) >= 1.) return 0.; else return (1.-x*x); } /* end of mypdf() */ /* The derivative of the PDF of our distribution: */ double mydpdf( double x, const UNUR_DISTR *distr ) { if (fabs(x) >= 1.) return 0.; else return (-2.*x); } /* end of mydpdf() */ /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; /* will hold the random number */ /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Create a new distribution object from scratch. */ /* Get empty distribution object for a continuous distribution */ distr = unur_distr_cont_new(); /* Fill the distribution object -- the provided information */ /* must fulfill the requirements of the method choosen below. */ unur_distr_cont_set_pdf(distr, mypdf); /* PDF */ unur_distr_cont_set_dpdf(distr, mydpdf); /* its derivative */ unur_distr_cont_set_mode(distr, 0.); /* mode */ unur_distr_cont_set_domain(distr, -1., 1.); /* domain */ /* Choose a method: TDR. */ par = unur_tdr_new(distr); /* Set some parameters of the method TDR. */ unur_tdr_set_variant_gw(par); unur_tdr_set_max_sqhratio(par, 0.90); unur_tdr_set_c(par, -0.5); unur_tdr_set_max_intervals(par, 100); unur_tdr_set_cpoints(par, 10, NULL); /* Create the generator object. */ gen = unur_init(par); /* Notice that this call has also destroyed the parameter */ /* object `par' as a side effect. */ /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ Example (String API) -------------------- /* ------------------------------------------------------------- */ /* File: example_cont_str.c */ /* ------------------------------------------------------------- */ /* String API. */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* Example how to sample from a continuous univariate */ /* distribution. */ /* We use a generic distribution object and sample. */ /* */ /* The PDF of our distribution is given by */ /* */ /* / 1 - x*x if |x| <= 1 */ /* f(x) = < */ /* \ 0 otherwise */ /* */ /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; /* will hold the random number */ /* Declare UNURAN generator object. */ UNUR_GEN *gen; /* generator object */ /* Create the generator object. */ /* Use a generic continuous distribution. */ /* Choose a method: TDR. */ gen = unur_str2gen( "distr = cont; pdf=\"1-x*x\"; domain=(-1,1); mode=0. & \ method=tdr; variant_gw; max_sqhratio=0.90; c=-0.5; \ max_intervals=100; cpoints=10"); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ 5.3.1 AROU – Automatic Ratio-Of-Uniforms method ----------------------------------------------- Required: T-concave PDF, dPDF Optional: mode Speed: Set-up: slow, Sampling: fast Reinit: not implemented Reference: [LJa00] AROU is a variant of the ratio-of-uniforms method that uses the fact that the transformed region is convex for many distributions. It works for all T-concave distributions with T(x) = -1/sqrt(x). It is possible to use this method for correlation induction by setting an auxiliary uniform random number generator via the ‘unur_set_urng_aux’ call. (Notice that this must be done after a possible ‘unur_set_urng’ call.) When an auxiliary generator is used then the number of used uniform random numbers that is used up for one generated random variate is constant and equal to 1. There exists a test mode that verifies whether the conditions for the method are satisfied or not while sampling. It can be switched on by calling ‘unur_arou_set_verify’ and ‘unur_arou_chg_verify’, respectively. Notice however that sampling is (much) slower then. For densities with modes not close to 0 it is suggested to set either the mode or the center of the distribution by the ‘unur_distr_cont_set_mode’ or ‘unur_distr_cont_set_center’ call. The latter is the approximate location of the mode or the mean of the distribution. This location provides some information about the main part of the PDF and is used to avoid numerical problems. Function reference ------------------ -- Function: UNUR_PAR* unur_arou_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_arou_set_usedars (UNUR_PAR* PARAMETERS, int USEDARS) If USEDARS is set to ‘TRUE’, “derandomized adaptive rejection sampling†(DARS) is used in setup. Segments where the area between hat and squeeze is too large compared to the average area between hat and squeeze over all intervals are split. This procedure is repeated until the ratio between area below squeeze and area below hat exceeds the bound given by ‘unur_arou_set_max_sqhratio’ call or the maximum number of segments is reached. Moreover, it also aborts when no more segments can be found for splitting. Segments are split such that the angle of the segments are halved (corresponds to arc-mean rule of method TDR (*note TDR::)). Default is ‘TRUE’. -- Function: int unur_arou_set_darsfactor (UNUR_PAR* PARAMETERS, double FACTOR) Set factor for “derandomized adaptive rejection samplingâ€. This factor is used to determine the segments that are “too largeâ€, that is, all segments where the area between squeeze and hat is larger than FACTOR times the average area over all intervals between squeeze and hat. Notice that all segments are split when FACTOR is set to ‘0.’, and that there is no splitting at all when FACTOR is set to ‘UNUR_INFINITY’. Default is ‘0.99’. There is no need to change this parameter. -- Function: int unur_arou_set_max_sqhratio (UNUR_PAR* PARAMETERS, double MAX_RATIO) Set upper bound for the ratio (area inside squeeze) / (area inside envelope). It must be a number between 0 and 1. When the ratio exceeds the given number no further construction points are inserted via adaptive rejection sampling. Use ‘0’ if no construction points should be added after the setup. Use ‘1’ if adding new construction points should not be stopped until the maximum number of construction points is reached. Default is ‘0.99’. -- Function: double unur_arou_get_sqhratio (const UNUR_GEN* GENERATOR) Get the current ratio (area inside squeeze) / (area inside envelope) for the generator. (In case of an error ‘UNUR_INFINITY’ is returned.) -- Function: double unur_arou_get_hatarea (const UNUR_GEN* GENERATOR) Get the area below the hat for the generator. (In case of an error ‘UNUR_INFINITY’ is returned.) -- Function: double unur_arou_get_squeezearea (const UNUR_GEN* GENERATOR) Get the area below the squeeze for the generator. (In case of an error ‘UNUR_INFINITY’ is returned.) -- Function: int unur_arou_set_max_segments (UNUR_PAR* PARAMETERS, int MAX_SEGS) Set maximum number of segements. No construction points are added _after_ the setup when the number of segments succeeds MAX_SEGS. Default is ‘100’. -- Function: int unur_arou_set_cpoints (UNUR_PAR* PARAMETERS, int N_STP, const DOUBLE* STP) Set construction points for enveloping polygon. If STP is ‘NULL’, then a heuristical rule of thumb is used to get N_STP construction points. This is the default behavior when this routine is not called. The (default) number of construction points is ‘30’, then. -- Function: int unur_arou_set_usecenter (UNUR_PAR* PARAMETERS, int USECENTER) Use the center as construction point. Default is ‘TRUE’. -- Function: int unur_arou_set_guidefactor (UNUR_PAR* PARAMETERS, double FACTOR) Set factor for relative size of the guide table for indexed search (see also method DGT *note DGT::). It must be greater than or equal to ‘0’. When set to ‘0’, then sequential search is used. Default is ‘2’. -- Function: int unur_arou_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) -- Function: int unur_arou_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) Turn verifying of algorithm while sampling on/off. If the condition squeeze(x) <= PDF(x) <= hat(x) is violated for some x then ‘unur_errno’ is set to ‘UNUR_ERR_GEN_CONDITION’. However notice that this might happen due to round-off errors for a few values of x (less than 1%). Default is ‘FALSE’. -- Function: int unur_arou_set_pedantic (UNUR_PAR* PARAMETERS, int PEDANTIC) Sometimes it might happen that ‘unur_init’ has been executed successfully. But when additional construction points are added by adaptive rejection sampling, the algorithm detects that the PDF is not T-concave. With PEDANTIC being ‘TRUE’, the sampling routine is then exchanged by a routine that simply returns ‘UNUR_INFINITY’. Otherwise the new point is not added to the list of construction points. At least the hat function remains T-concave. Setting PEDANTIC to ‘FALSE’ allows sampling from a distribution which is “almost†T-concave and small errors are tolerated. However it might happen that the hat function cannot be improved significantly. When the hat function that has been constructed by the ‘unur_init’ call is extremely large then it might happen that the generation times are extremely high (even hours are possible in extremely rare cases). Default is ‘FALSE’. 5.3.2 ARS – Adaptive Rejection Sampling --------------------------------------- Required: concave logPDF, derivative of logPDF Optional: mode Speed: Set-up: fast, Sampling: slow Reinit: supported Reference: [GWa92] [HLD04: Cha.4] ARS is an acceptance/rejection method that uses the concavity of the log-density function to construct hat function and squeezes automatically. It is very similar to method TDR (*note TDR::) with variant GW, parameter ‘c = 0’, and DARS switched off. Moreover, method ARS requires the logPDF and its derivative dlogPDF to run. On the other hand, it is designed to draw only a (very) small samples and it is much more robust against densities with very large or small areas below the PDF as it occurs, for example, in conditional distributions of (high dimensional) multivariate distributions. Additionally, it can be re-initialized when the underlying distribution has been modified. Thus it is well suited for Gibbs sampling. Notice, that method ARS is a restricted version of TDR. If the full functionally of Transformed Density Rejection is needed use method *note TDR::. How To Use .......... Method ARS is designed for distributions with log-concave densities. To use this method you need a distribution object with the logarithm of the PDF and its derivative given. The number of construction points as well as a set of such points can be provided using ‘unur_ars_set_cpoints’. Notice that addition construction points are added by means of adaptive rejection sampling until the maximal number of intervals given by ‘unur_ars_set_max_intervals’ is reached. A generated distribution object can be reinitialized using the ‘unur_reinit’ call. When ‘unur_reinit’ is called construction points for the new generator are necessary. There are two options: Either the same construction points as for the initial generator (given by a ‘unur_ars_set_cpoints’ call) are used (this is the default), or percentiles of the old hat function can be used. This can be set or changed using ‘unur_ars_set_reinit_percentiles’ and ‘unur_ars_chg_reinit_percentiles’. This feature is usefull when the underlying distribution object is only moderately changed. (An example is Gibbs sampling with small correlations.) There exists a test mode that verifies whether the conditions for the method are satisfied or not. It can be switched on by calling ‘unur_ars_set_verify’ and ‘unur_ars_chg_verify’, respectively. Notice however that sampling is (much) slower then. Method ARS aborts after a given number of iterations and return UNUR_INFINITY to prevent (almost) infinite loops. This might happen when the starting hat is much too large and it is not possible to insert new construction points due to severe numerical errors or (more likely) the given PDF is not log-concave. This maximum number of iterations can be set by means of a ‘unur_ars_set_max_iter’ call. Function reference ------------------ -- Function: UNUR_PAR* unur_ars_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_ars_set_max_intervals (UNUR_PAR* PARAMETERS, int MAX_IVS) Set maximum number of intervals. No construction points are added after the setup when the number of intervals suceeds MAX_IVS. It is increased automatically to twice the number of construction points if this is larger. Default is ‘200’. -- Function: int unur_ars_set_cpoints (UNUR_PAR* PARAMETERS, int N_CPOINTS, const DOUBLE* CPOINTS) Set construction points for the hat function. If CPOINTS is ‘NULL’ then a heuristic rule of thumb is used to get N_CPOINTS construction points. This is the default behavior. N_CPOINTS should be at least ‘2’, otherwise defaults are used. The default number of construction points is 2. -- Function: int unur_ars_set_reinit_percentiles (UNUR_PAR* PARAMETERS, int N_PERCENTILES, const DOUBLE* PERCENTILES) -- Function: int unur_ars_chg_reinit_percentiles (UNUR_GEN* GENERATOR, int N_PERCENTILES, const DOUBLE* PERCENTILES) By default, when the GENERATOR object is reinitialized, it used the same construction points as for the initialization procedure. Often the underlying distribution object has been changed only moderately. For example, the full conditional distribution of a multivariate distribution. In this case it might be more appropriate to use percentilesm of the hat function for the last (unchanged) distribution. PERCENTILES must then be a pointer to an ordered array of numbers between ‘0.01’ and ‘0.99’. If PERCENTILES is ‘NULL’, then a heuristic rule of thumb is used to get N_PERCENTILES values for these percentiles. Notice that N_PERCENTILES must be at least ‘2’, otherwise defaults are used. (Then the first and third quartiles are used by default.) -- Function: int unur_ars_set_reinit_ncpoints (UNUR_PAR* PARAMETERS, int NCPOINTS) -- Function: int unur_ars_chg_reinit_ncpoints (UNUR_GEN* GENERATOR, int NCPOINTS) When reinit fails with the given construction points or the percentiles of the old hat function, another trial is undertaken with NCPOINTS construction points. NCPOINTS must be at least ‘10’. Default: ‘30’ -- Function: int unur_ars_set_max_iter (UNUR_PAR* PARAMETERS, int MAX_ITER) The rejection loop stops after MAX_ITER iterations and return UNUR_INFINITY. Default: ‘10000’ -- Function: int unur_ars_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) -- Function: int unur_ars_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) Turn verifying of algorithm while sampling on/off. If the condition squeeze(x) <= PDF(x) <= hat(x) is violated for some x then ‘unur_errno’ is set to ‘UNUR_ERR_GEN_CONDITION’. However notice that this might happen due to round-off errors for a few values of x (less than 1%). Default is ‘FALSE’. -- Function: int unur_ars_set_pedantic (UNUR_PAR* PARAMETERS, int PEDANTIC) Sometimes it might happen that ‘unur_init’ has been executed successfully. But when additional construction points are added by adaptive rejection sampling, the algorithm detects that the PDF is not log-concave. With PEDANTIC being ‘TRUE’, the sampling routine is exchanged by a routine that simply returns ‘UNUR_INFINITY’. Otherwise the new point is not added to the list of construction points. At least the hat function remains log-concave. Setting PEDANTIC to ‘FALSE’ allows sampling from a distribution which is “almost†log-concave and small errors are tolerated. However it might happen that the hat function cannot be improved significantly. When the hat functions that has been constructed by the ‘unur_init’ call is extremely large then it might happen that the generation times are extremely high (even hours are possible in extremely rare cases). Default is ‘FALSE’. -- Function: double unur_ars_get_loghatarea (const UNUR_GEN* GENERATOR) Get the logarithm of area below the hat for the generator. (In case of an error ‘UNUR_INFINITY’ is returned.) -- Function: double unur_ars_eval_invcdfhat (const UNUR_GEN* GENERATOR, double U) Evaluate the inverse of the CDF of the hat distribution at U. If U is out of the domain [0,1] then ‘unur_errno’ is set to ‘UNUR_ERR_DOMAIN’ and the respective bound of the domain of the distribution are returned (which is ‘-UNUR_INFINITY’ or ‘UNUR_INFINITY’ in the case of unbounded domains). 5.3.3 CEXT – wrapper for Continuous EXTernal generators ------------------------------------------------------- Required: routine for sampling continuous random variates Speed: depends on external generator Reinit: supported Method CEXT is a wrapper for external generators for continuous univariate distributions. It allows the usage of external random variate generators within the UNU.RAN framework. How To Use .......... The following steps are required to use some external generator within the UNU.RAN framework (some of these are optional): 1. Make an empty generator object using a ‘unur_cext_new’ call. The argument DISTRIBUTION is optional and can be replaced by ‘NULL’. However, it is required if you want to pass parameters of the generated distribution to the external generator or for running some validation tests provided by UNU.RAN. 2. Create an initialization routine of type ‘int (*init)(UNUR_GEN *gen)’ and plug it into the generator object using the ‘unur_cext_set_init’ call. Notice that the INIT routine must return ‘UNUR_SUCCESS’ when it has been executed successfully and ‘UNUR_FAILURE’ otherwise. It is possible to get the size of and the pointer to the array of parameters of the underlying distribution object by the respective calls ‘unur_cext_get_ndistrparams’ and ‘unur_cext_get_distrparams’. Parameters for the external generator that are computed in the INIT routine can be stored in a single array or structure which is available by the ‘unur_cext_get_params’ call. Using an INIT routine is optional and can be omitted. 3. Create a sampling routine of type ‘double (*sample)(UNUR_GEN *gen)’ and plug it into the generator object using the ‘unur_cext_set_sample’ call. Uniform random numbers are provided by the ‘unur_sample_urng’ call. Do not use your own implementation of a uniform random number generator directly. If you want to use your own random number generator we recommend to use the UNU.RAN interface (see *note Using uniform random number generators: URNG.). The array or structure that contains parameters for the external generator that are computed in the INIT routine are available using the ‘unur_cext_get_params’ call. Using a SAMPLE routine is of course obligatory. It is possible to change the parameters and the domain of the chosen distribution and run ‘unur_reinit’ to reinitialize the generator object. The INIT routine is then called again. Here is a short example that demonstrates the application of this method by means of the exponential distribution: /* ------------------------------------------------------------- */ /* File: example_cext.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* This example shows how an external generator for the */ /* exponential distribution with one scale parameter can be */ /* used within the UNURAN framework. */ /* */ /* Notice, that this example does not provide the simplest */ /* solution. */ /* ------------------------------------------------------------- */ /* Initialization routine. */ /* */ /* Here we simply read the scale parameter of the exponential */ /* distribution and store it in an array for parameters of */ /* the external generator. */ /* [ Of course we could do this in the sampling routine as */ /* and avoid the necessity of this initialization routine. ] */ int exponential_init (UNUR_GEN *gen) { /* Get pointer to parameters of exponential distribution */ double *params = unur_cext_get_distrparams(gen); /* The scale parameter is the first entry (see manual) */ double lambda = (params) ? params[0] : 1.; /* Get array to store this parameter for external generator */ double *genpar = unur_cext_get_params(gen, sizeof(double)); genpar[0] = lambda; /* Executed successfully */ return UNUR_SUCCESS; } /* ------------------------------------------------------------- */ /* Sampling routine. */ /* */ /* Contains the code for the external generator. */ double exponential_sample (UNUR_GEN *gen) { /* Get scale parameter */ double *genpar = unur_cext_get_params(gen,0); double lambda = genpar[0]; /* Sample a uniformly distributed random number */ double U = unur_sample_urng(gen); /* Transform into exponentially distributed random variate */ return ( -log(1. - U) * lambda ); } /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; /* will hold the random number */ /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Use predefined exponential distribution with scale param. 2 */ double fpar[1] = { 2. }; distr = unur_distr_exponential(fpar, 1); /* Use method CEXT */ par = unur_cext_new(distr); /* Set initialization and sampling routines. */ unur_cext_set_init(par, exponential_init); unur_cext_set_sample(par, exponential_sample); /* Create the generator object. */ gen = unur_init(par); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the standard Gaussian distribution. */ /* Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ Function reference ------------------ -- Function: UNUR_PAR* unur_cext_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for new generator. -- Function: int unur_cext_set_init (UNUR_PAR* PARAMETERS, int (* INIT)(UNUR_GEN* gen )) Set initialization routine for external generator. Inside the _Important:_ The routine INIT must return ‘UNUR_SUCCESS’ when the generator was initialized successfully and ‘UNUR_FAILURE’ otherwise. Parameters that are computed in the INIT routine can be stored in an array or structure that is avaiable by means of the ‘unur_cext_get_params’ call. Parameters of the underlying distribution object can be obtained by the ‘unur_cext_get_distrparams’ call. -- Function: int unur_cext_set_sample (UNUR_PAR* PARAMETERS, double (* SAMPLE)(UNUR_GEN* gen )) Set sampling routine for external generator. _Important:_ Use ‘unur_sample_urng(gen)’ to get a uniform random number. The pointer to the array or structure that contains the parameters that are precomputed in the INIT routine are available by ‘unur_cext_get_params(gen,0)’. Additionally one can use the ‘unur_cext_get_distrparams’ call. -- Function: void* unur_cext_get_params (UNUR_GEN* GENERATOR, size_t SIZE) Get pointer to memory block for storing parameters of external generator. A memory block of size SIZE is automatically (re-) allocated if necessary and the pointer to this block is stored in the GENERATOR object. If one only needs the pointer to this memory block set SIZE to ‘0’. Notice, that SIZE is the size of the memory block and not the length of an array. _Important:_ This rountine should only be used in the initialization and sampling routine of the external generator. -- Function: double* unur_cext_get_distrparams (UNUR_GEN* GENERATOR) -- Function: int unur_cext_get_ndistrparams (UNUR_GEN* GENERATOR) Get size of and pointer to array of parameters of underlying distribution in GENERATOR object. _Important:_ These rountines should only be used in the initialization and sampling routine of the external generator. 5.3.4 CSTD – Continuous STandarD distributions ---------------------------------------------- Required: standard distribution from UNU.RAN library (*note Standard distributions: Stddist.) or continuous distribution with inverse CDF. Speed: Set-up: fast, Sampling: depends on distribution and generator Reinit: supported CSTD is a wrapper for special generators for continuous univariate standard distributions. It only works for distributions in the UNU.RAN library of standard distributions (*note Standard distributions: Stddist.) or for continuous distributions where the inverse CDF is given. If a distribution object is provided that is build from scratch, it must provide the inverse CDF. Then CSTD implements the inversion method. Otherwise, the ‘NULL’ pointer is returned. For some distributions more than one special generator is possible. How To Use .......... Create a distribution object for a standard distribution from the UNU.RAN library (*note Standard distributions: Stddist.), or create a continuous distribution object and set the function for the inverse CDF using ‘unur_distr_cont_set_invcdf’. For some distributions more than one special generator (_variants_) is possible. These can be choosen by a ‘unur_cstd_set_variant’ call. For possible variants *note Standard distributions: Stddist. However the following are common to all distributions: ‘UNUR_STDGEN_DEFAULT’ the default generator. ‘UNUR_STDGEN_FAST’ the fastest available special generator. ‘UNUR_STDGEN_INVERSION’ the inversion method (if available). Notice that the variant ‘UNUR_STDGEN_FAST’ for a special generator may be slower than one of the universal algorithms! Additional variants may exist for particular distributions. Sampling from truncated distributions (which can be constructed by changing the default domain of a distribution by means of ‘unur_distr_cont_set_domain’ or ‘unur_cstd_chg_truncated’ calls) is possible but requires the inversion method. Moreover the CDF of the distribution must be implemented. It is possible to change the parameters and the domain of the chosen distribution and run ‘unur_reinit’ to reinitialize the generator object. Function reference ------------------ -- Function: UNUR_PAR* unur_cstd_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for new generator. It requires a distribution object for a continuous univariant distribution from the UNU.RAN library of standard distributions (*note Standard distributions: Stddist.). Using a truncated distribution is allowed only if the inversion method is available and selected by the ‘unur_cstd_set_variant’ call immediately after creating the parameter object. Use a ‘unur_distr_cont_set_domain’ call to get a truncated distribution. To change the domain of a (truncated) distribution of a generator use the ‘unur_cstd_chg_truncated’ call. -- Function: int unur_cstd_set_variant (UNUR_PAR* PARAMETERS, unsigned VARIANT) Set variant (special generator) for sampling from a given distribution. For possible variants *note Standard distributions: Stddist. Common variants are ‘UNUR_STDGEN_DEFAULT’ for the default generator, ‘UNUR_STDGEN_FAST’ for (one of the) fastest implemented special generators, and ‘UNUR_STDGEN_INVERSION’ for the inversion method (if available). If the selected variant number is not implemented, then an error code is returned and the variant is not changed. -- Function: int unur_cstd_chg_truncated (UNUR_GEN* GENERATOR, double LEFT, double RIGHT) Change left and right border of the domain of the (truncated) distribution. This is only possible if the inversion method is used. Otherwise this call has no effect and an error code is returned. Notice that the given truncated domain must be a subset of the domain of the given distribution. The generator always uses the intersection of the domain of the distribution and the truncated domain given by this call. It is not required to run ‘unur_reinit’ after this call has been used. _Important:_ If the CDF is (almost) the same for LEFT and RIGHT and (almost) equal to ‘0’ or ‘1’, then the truncated domain is not chanced and the call returns an error code. _Notice:_ If the parameters of the distribution has been changed it is recommended to set the truncated domain again, since the former call might change the domain of the distribution but not update the values for the boundaries of the truncated distribution. 5.3.5 HINV – Hermite interpolation based INVersion of CDF --------------------------------------------------------- Required: CDF Optional: PDF, dPDF Speed: Set-up: (very) slow, Sampling: (very) fast Reinit: supported Reference: [HLa03] [HLD04: Sect.7.2; Alg.7.1] HINV is a variant of numerical inversion, where the inverse CDF is approximated using Hermite interpolation, i.e., the interval [0,1] is split into several intervals and in each interval the inverse CDF is approximated by polynomials constructed by means of values of the CDF and PDF at interval boundaries. This makes it possible to improve the accuracy by splitting a particular interval without recomputations in unaffected intervals. Three types of splines are implemented: linear, cubic, and quintic interpolation. For linear interpolation only the CDF is required. Cubic interpolation also requires PDF and quintic interpolation PDF and its derivative. These splines have to be computed in a setup step. However, it only works for distributions with bounded domain; for distributions with unbounded domain the tails are chopped off such that the probability for the tail regions is small compared to the given u-resolution. The method is not exact, as it only produces random variates of the approximated distribution. Nevertheless, the maximal numerical error in "u-direction" (i.e. |U-CDF(X)|, for X = "approximate inverse CDF"(U) |U-CDF(X)|) can be set to the required resolution (within machine precision). Notice that very small values of the u-resolution are possible but may increase the cost for the setup step. As the possible maximal error is only estimated in the setup it may be necessary to set some special design points for computing the Hermite interpolation to guarantee that the maximal u-error can not be bigger than desired. Such points are points where the density is not differentiable or has a local extremum. Notice that there is no necessity to do so. However, if you do not provide these points to the algorithm there might be a small chance that the approximation error is larger than the given u-resolution, or that the required number of intervals is larger than necessary. How To Use .......... HINV works for continuous univariate distribution objects with given CDF and (optional) PDF. It uses Hermite interpolation of order 1, 3 [default] or 5. The order can be set by means of ‘unur_hinv_set_order’. For distributions with unbounded domains the tails are chopped off such that the probability for the tail regions is small compared to the given u-resulution. For finding these cut points the algorithm starts with the region ‘[-1.e20,1.e20]’. For the exceptional case where this might be too small (or one knows this region and wants to avoid this search heuristics) it can be directly set via a ‘unur_hinv_set_boundary’ call. It is possible to use this method for generating from truncated distributions. It even can be changed for an existing generator object by an ‘unur_hinv_chg_truncated’ call. This method is not exact, as it only produces random variates of the approximated distribution. Nevertheless, the numerical error in "u-direction" (i.e. |U-CDF(X)|, for X = "approximate inverse CDF"(U) |U-CDF(X)|) can be controlled by means of ‘unur_hinv_set_u_resolution’. The possible maximal error is only estimated in the setup. Thus it might be necessary to set some special design points for computing the Hermite interpolation to guarantee that the maximal u-error can not be bigger than desired. Such points (e.g. extremal points of the PDF, points with infinite derivative) can be set using using the ‘unur_hinv_set_cpoints’ call. If the mode for a unimodal distribution is set in the distribution object this mode is automatically used as design-point if the ‘unur_hinv_set_cpoints’ call is not used. As already mentioned the maximal error of this approximation is only estimated. If this error is crucial for an application we recommend to compute this error using ‘unur_hinv_estimate_error’ which runs a small Monte Carlo simulation. It is possible to change the parameters and the domain of the chosen distribution and run ‘unur_reinit’ to reinitialize the generator object. The values given by the last ‘unur_hinv_chg_truncated’ call will be then changed to the values of the domain of the underlying distribution object. Moreover, starting construction points (nodes) that are given by a ‘unur_hinv_set_cpoints’ call are ignored when ‘unur_reinit’ is called. It is important to note that for a distribution from the UNU.RAN library of standard distributions (*note Standard distributions: Stddist.) the normalization constant has to be updated using the ‘unur_distr_cont_upd_pdfarea’ call whenever its parameters have been changed by means of a ‘unur_distr_cont_set_pdfparams’ call. Function reference ------------------ -- Function: UNUR_PAR* unur_hinv_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_hinv_set_order (UNUR_PAR* PARAMETERS, int ORDER) Set order of Hermite interpolation. Valid orders are ‘1’, ‘3’, and ‘5’. Notice that ORDER greater than ‘1’ requires the density of the distribution, and ORDER greater than ‘3’ even requires the derivative of the density. Using ORDER ‘1’ results for most distributions in a huge number of intervals and is therefore not recommended. If the maximal error in u-direction is very small (say smaller than ‘1.e-10’), ORDER ‘5’ is recommended as it leads to considerably fewer design points, as long there are no poles or heavy tails. _Remark:_ When the target distribution has poles or (very) heavy tails ORDER ‘5’ (i.e., quintic interpolation) is numerically less stable and more sensitive to round-off errors than ORDER ‘3’ (i.e., cubic interpolation). Default is ‘3’ if the density is given and ‘1’ otherwise. -- Function: int unur_hinv_set_u_resolution (UNUR_PAR* PARAMETERS, double U_RESOLUTION) Set maximal error in u-direction. However, the given u-error must not be smaller than machine epsilon (‘DBL_EPSILON’) and should not be too close to this value. As the resolution of most uniform random number sources is 2^(-32) = ‘2.3e-10’, a value of ‘1.e-10’ leads to an inversion algorithm that could be called exact. For most simulations slightly bigger values for the maximal error are enough as well. Remark: The u-error might become larger than U_RESOLUTION due to rescaling of floating point numbers when the domain of the distribution is truncated by a ‘unur_hinv_chg_truncated’ call. Default is ‘1.e-10’. -- Function: int unur_hinv_set_cpoints (UNUR_PAR* PARAMETERS, const DOUBLE* STP, int N_STP) Set starting construction points (nodes) for Hermite interpolation. As the possible maximal error is only estimated in the setup it may be necessary to set some special design points for computing the Hermite interpolation to guarantee that the maximal u-error can not be bigger than desired. We suggest to include as special design points all local extrema of the density, all points where the density is not differentiable, and isolated points inside of the domain with density 0. If there is an interval with density constant equal to 0 inside of the given domain of the density, both endpoints of this interval should be included as special design points. Notice that there is no necessity to do so. However, if these points are not provided to the algorithm the approximation error might be larger than the given u-resolution, or the required number of intervals could be larger than necessary. _Important_: Notice that the given points must be in increasing order and they must be disjoint. _Important_: The boundary point of the computational region must not be given in this list! Points outside the boundary of the computational region are ignored. Default is for unimodal densities - if known - the mode of the density, if it is not equal to the border of the domain. -- Function: int unur_hinv_set_boundary (UNUR_PAR* PARAMETERS, double LEFT, double RIGHT) Set the left and right boundary of the computational interval. Of course ‘+/- UNUR_INFINITY’ is not allowed. If the CDF at LEFT and RIGHT is not close to the respective values ‘0.’ and ‘1.’ then this interval is increased by a (rather slow) search algorithm. _Important_: This call does not change the domain of the given distribution itself. But it restricts the domain for the resulting random variates. Default is ‘1.e20’. -- Function: int unur_hinv_set_guidefactor (UNUR_PAR* PARAMETERS, double FACTOR) Set factor for relative size of the guide table for indexed search (see also method DGT *note DGT::). It must be greater than or equal to ‘0’. When set to ‘0’, then sequential search is used. Default is ‘1’. -- Function: int unur_hinv_set_max_intervals (UNUR_PAR* PARAMETERS, int MAX_IVS) Set maximum number of intervals. No generator object is created if the necessary number of intervals for the Hermite interpolation exceeds MAX_IVS. It is used to prevent the algorithm to eat up all memory for very badly shaped CDFs. Default is ‘1000000’ (1.e6). -- Function: int unur_hinv_get_n_intervals (const UNUR_GEN* GENERATOR) Get number of nodes (design points) used for Hermite interpolation in the generator object. The number of intervals is the number of nodes minus 1. It returns an error code in case of an error. -- Function: double unur_hinv_eval_approxinvcdf (const UNUR_GEN* GENERATOR, double U) Evaluate Hermite interpolation of inverse CDF at U. If U is out of the domain [0,1] then ‘unur_errno’ is set to ‘UNUR_ERR_DOMAIN’ and the respective bound of the domain of the distribution are returned (which is ‘-UNUR_INFINITY’ or ‘UNUR_INFINITY’ in the case of unbounded domains). _Notice_: When the domain has been truncated by a ‘unur_hinv_chg_truncated’ call then the inverse CDF of the truncated distribution is returned. -- Function: int unur_hinv_chg_truncated (UNUR_GEN* GENERATOR, double LEFT, double RIGHT) Changes the borders of the domain of the (truncated) distribution. Notice that the given truncated domain must be a subset of the domain of the given distribution. The generator always uses the intersection of the domain of the distribution and the truncated domain given by this call. The tables of splines are not recomputed. Thus it might happen that the relative error for the generated variates from the truncated distribution is greater than the bound for the non-truncated distribution. This call also fails when the CDF values of the boundary points are too close, i.e. when only a few different floating point numbers would be computed due to round-off errors with floating point arithmetic. Remark: The u-error might become larger than the U_RESOLUTION given by a ‘unur_hinv_set_u_resolution’ call due to rescaling of floating point numbers when the domain of the distribution is truncated. When failed an error code is returned. _Important_: Always check the return code since the domain is not changed in case of an error. -- Function: int unur_hinv_estimate_error (const UNUR_GEN* GENERATOR, int SAMPLESIZE, double* MAX_ERROR, double* MAE) Estimate maximal u-error and mean absolute error (MAE) for GENERATOR by means of a (quasi-) Monte-Carlo simulation with sample size SAMPLESIZE. The results are stored in MAX_ERROR and MAE, respectively. It returns ‘UNUR_SUCCESS’ if successful. 5.3.6 HRB – Hazard Rate Bounded ------------------------------- Required: bounded hazard rate Optional: upper bound for hazard rate Speed: Set-up: fast, Sampling: slow Reinit: supported Reference: [HLD04: Sect.9.1.4; Alg.9.4] Generates random variate with given hazard rate which must be bounded from above. It uses the thinning method with a constant dominating hazard function. How To Use .......... HRB requires a hazard function for a continuous distribution together with an upper bound. The latter has to be set using the ‘unur_hrb_set_upperbound’ call. If no such upper bound is given it is assumed that the upper bound can be achieved by evaluating the hazard rate at the left hand boundary of the domain of the distribution. Notice, however, that for decreasing hazard rate the method HRD (*note Hazard Rate Decreasing: HRD.) is much faster and thus the prefered method. It is important to note that the domain of the distribution can be set via a ‘unur_distr_cont_set_domain’ call. However, the left border must not be negative. Otherwise it is set to ‘0’. This is also the default if no domain is given at all. For computational reasons the right border is always set to ‘UNUR_INFINITY’ independently of the given domain. Thus for domains bounded from right the function for computing the hazard rate should return ‘UNUR_INFINITY’ right of this domain. For distributions with increasing hazard rate method HRI (*note Hazard Rate Increasing: HRI.) is required. It is possible to change the parameters and the domain of the chosen distribution and run ‘unur_reinit’ to reinitialize the generator object. Notice, that the upper bound given by the ‘unur_hrb_set_upperbound’ call cannot be changed and must be valid for the changed distribution. Function reference ------------------ -- Function: UNUR_PAR* unur_hrb_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_hrb_set_upperbound (UNUR_PAR* PARAMETERS, double UPPERBOUND) Set upper bound for hazard rate. If this call is not used it is assumed that the the maximum of the hazard rate is achieved at the left hand boundary of the domain of the distribution. -- Function: int unur_hrb_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) -- Function: int unur_hrb_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) Turn verifying of algorithm while sampling on/off. If the hazard rate is not bounded by the given bound, then ‘unur_errno’ is set to ‘UNUR_ERR_GEN_CONDITION’. Default is ‘FALSE’. 5.3.7 HRD – Hazard Rate Decreasing ---------------------------------- Required: decreasing (non-increasing) hazard rate Speed: Set-up: fast, Sampling: slow Reinit: supported Reference: [HLD04: Sect.9.1.5; Alg.9.5] Generates random variate with given non-increasing hazard rate. It is necessary that the distribution object contains this hazard rate. Decreasing hazard rate implies that the corresponding PDF of the distribution has heavier tails than the exponential distribution (which has constant hazard rate). How To Use .......... HRD requires a hazard function for a continuous distribution with non-increasing hazard rate. There are no parameters for this method. It is important to note that the domain of the distribution can be set via a ‘unur_distr_cont_set_domain’ call. However, only the left hand boundary is used. For computational reasons the right hand boundary is always reset to ‘UNUR_INFINITY’. If no domain is given by the user then the left hand boundary is set to ‘0’. For distributions which do not have decreasing hazard rates but are bounded from above use method HRB (*note Hazard Rate Bounded: HRB.). For distributions with increasing hazard rate method HRI (*note Hazard Rate Increasing: HRI.) is required. It is possible to change the parameters and the domain of the chosen distribution and run ‘unur_reinit’ to reinitialize the generator object. Function reference ------------------ -- Function: UNUR_PAR* unur_hrd_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_hrd_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) -- Function: int unur_hrd_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) Turn verifying of algorithm while sampling on/off. If the hazard rate is not bounded by the given bound, then ‘unur_errno’ is set to ‘UNUR_ERR_GEN_CONDITION’. Default is ‘FALSE’. 5.3.8 HRI – Hazard Rate Increasing ---------------------------------- Required: increasing (non-decreasing) hazard rate Speed: Set-up: fast, Sampling: slow Reinit: supported Reference: [HLD04: Sect.9.1.6; Alg.9.6] Generates random variate with given non-increasing hazard rate. It is necessary that the distribution object contains this hazard rate. Increasing hazard rate implies that the corresponding PDF of the distribution has heavier tails than the exponential distribution (which has constant hazard rate). The method uses a decomposition of the hazard rate into a main part which is constant for all x beyond some point p0 and a remaining part. From both of these parts points are sampled using the thinning method and the minimum of both is returned. Sampling from the first part is easier as we have a constant dominating hazard rate. Thus p0 should be large. On the other hand, if p0 is large than the thinning algorithm needs many iteration. Thus the performance of the the algorithm deponds on the choice of p0. We found that values close to the expectation of the generated distribution result in good performance. How To Use .......... HRI requires a hazard function for a continuous distribution with non-decreasing hazard rate. The parameter p0 should be set to a value close to the expectation of the required distribution using ‘unur_hri_set_p0’. If performance is crucial one may try other values as well. It is important to note that the domain of the distribution can be set via a ‘unur_distr_cont_set_domain’ call. However, only the left hand boundary is used. For computational reasons the right hand boundary is always reset to ‘UNUR_INFINITY’. If no domain is given by the user then the left hand boundary is set to ‘0’. For distributions with decreasing hazard rate method HRD (*note Hazard Rate Decreasing: HRI.) is required. For distributions which do not have increasing or decreasing hazard rates but are bounded from above use method HRB (*note Hazard Rate Bounded: HRB.). It is possible to change the parameters and the domain of the chosen distribution and run ‘unur_reinit’ to reinitialize the generator object. Notice, that the upper bound given by the ‘unur_hrb_set_upperbound’ call cannot be changed and must be valid for the changed distribution. Notice that the parameter p0 which has been set by a ‘unur_hri_set_p0’ call cannot be changed and must be valid for the changed distribution. Function reference ------------------ -- Function: UNUR_PAR* unur_hri_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_hri_set_p0 (UNUR_PAR* PARAMETERS, double P0) Set design point for algorithm. It is used to split the domain of the distribution. Values for P0 close to the expectation of the distribution results in a relatively good performance of the algorithm. It is important that the hazard rate at this point must be greater than ‘0’ and less than ‘UNUR_INFINITY’. Default: left boundary of domain + ‘1.’ -- Function: int unur_hri_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) -- Function: int unur_hri_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) Turn verifying of algorithm while sampling on/off. If the hazard rate is not bounded by the given bound, then ‘unur_errno’ is set to ‘UNUR_ERR_GEN_CONDITION’. Default is ‘FALSE’. 5.3.9 ITDR – Inverse Transformed Density Rejection -------------------------------------------------- Required: monotone PDF, dPDF, pole Optional: splitting point between pole and tail region, c-values Speed: Set-up: moderate, Sampling: moderate Reinit: supported Reference: [HLDa07] ITDR is an acceptance/rejection method that works for monotone densities. It is especially designed for PDFs with a single pole. It uses different hat functions for the pole region and for the tail region. For the tail region _Transformed Density Rejection_ with a single construction point is used. For the pole region a variant called _Inverse Transformed Density Rejection_ is used. The optimal splitting point between the two regions and the respective maximum local concavity and inverse local concavity (*note Glossary::) that guarantee valid hat functions for each regions are estimated. This splitting point is set to the intersection point of local concavity and inverse local concavity. However, it is assumed that both, the local concavity and the inverse local concavity do not have a local minimum in the interior of the domain (which is the case for all standard distributions with a single pole). In other cases (or when the built-in search routines do not compute non-optimal values) one can provide the splitting point, and the c-values. How To Use .......... Method ITDR requires a distribution object with given PDF and its derivative and the location of the pole (or mode). The PDF must be monotone and may contain a pole. It must be set via the ‘unur_distr_cont_set_pdf’ and ‘unur_distr_cont_set_dpdf’ calls. The PDF should return UNUR_INFINITY for the pole. Alternatively, one can also set the logarithm of the PDF and its derivative via the ‘unur_distr_cont_set_logpdf’ and ‘unur_distr_cont_set_dlogpdf’ calls. This is in especially useful since then the setup and search routines are numerically more stable. Moreover, for many distributions computing the logarithm of the PDF is less expensive then computing the PDF directly. The pole of the distribution is given by a ‘unur_distr_cont_set_mode’ call. Notice that distributions with “heavy†poles may have numerical problems caused by the resultion of the floating point numbers used by computers. While the minimal distance between two different floating point numbers is about ‘1.e-320’ near ‘0.’ it increases to ‘1.e-16’ near ‘1.’ Thus any random variate generator implemented on a digital computer in fact draws samples from a discrete distribution that approximates the desired continuous distribution. For distributions with “heavy†poles not at 0 this approximation may be too crude and thus every goodness-of-fit test will fail. Besides this theoretic problem that cannot be resolved we have to take into consideration that round-off errors occur more frequently when we have PDFs with poles far away from ‘0.’ Method ITDR tries to handles this situation as good as possible by moving the pole into ‘0.’ Thus do not use a wrapper for your PDF that hides this shift since the information about the resolution of the floating point numbers near the pole gets lost. Method ITDR uses different hats for the pole region and for the tail region. The splitting point between these two regions, the optimal c-value and design points for constructing the hats using Transformed Density Rejection are computed automatically. (The results of these computations can be read using the respective calls ‘unur_itdr_get_xi’, ‘unur_itdr_get_cp’ , and ‘unur_itdr_get_ct’ for the intersection point between local concavity and inverse local concavity, the c-value for the pole and the tail region.) However, one can also analyze the local concavity and inverse local concavity set the corresponding values using ‘unur_itdr_set_xi’, ‘unur_itdr_set_cp’ , and ‘unur_itdr_set_ct’ calls. Notice, that c-values greater than -1/2 can be set to ‘-0.5’. Although this results in smaller acceptance probabities sampling from the hat distribution is much faster than for other values of c. Depending on the expenses of evaluating the PDF the resulting algorithm is usually faster. It is possible to change the parameters and the domain of the chosen distribution and run ‘unur_reinit’ to reinitialize the generator object. However, the values given by ‘unur_itdr_set_xi’, ‘unur_itdr_set_cp’ , or ‘unur_itdr_set_ct’ calls are then ignored when ‘unur_reinit’ is called. Function reference ------------------ -- Function: UNUR_PAR* unur_itdr_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_itdr_set_xi (UNUR_PAR* PARAMETERS, double XI) Sets points where local concavity and inverse local concavity are (almost) equal. It is used to estimate the respective c-values for pole region and hat regions and to determine the splitting point bx between pole and tail region. If no such point is provided it will be computed automatically. Default: not set. -- Function: int unur_itdr_set_cp (UNUR_PAR* PARAMETERS, double CP) Sets parameter CP for transformation T for inverse density in pole region. It must be at most 0 and greater than -1. A value of ‘-0.5’ is treated separately and usually results in faster marginal generation time (at the expense of smaller acceptance probabilities. If no CP-value is given it is estimated automatically. Default: not set. -- Function: int unur_itdr_set_ct (UNUR_PAR* PARAMETERS, double CT) Sets parameter CT for transformation T for density in tail region. It must be at most 0. For densities with unbounded domain it must be greater than -1. A value of ‘-0.5’ is treated separately and usually results in faster marginal generation time (at the expense of smaller acceptance probabilities. If no CT-value is given it is estimated automatically. Default: not set. -- Function: double unur_itdr_get_xi (UNUR_GEN* GENERATOR) -- Function: double unur_itdr_get_cp (UNUR_GEN* GENERATOR) -- Function: double unur_itdr_get_ct (UNUR_GEN* GENERATOR) Get intersection point XI, and c-values CP and CT, respectively. (In case of an error ‘UNUR_INFINITY’ is returned.) -- Function: double unur_itdr_get_area (UNUR_GEN* GENERATOR) Get area below hat. (In case of an error ‘UNUR_INFINITY’ is returned.) -- Function: int unur_itdr_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) Turn verifying of algorithm while sampling on/off. If the condition PDF(x) <= hat(x) is violated for some x then ‘unur_errno’ is set to ‘UNUR_ERR_GEN_CONDITION’. However, notice that this might happen due to round-off errors for a few values of x (less than 1%). Default is ‘FALSE’. -- Function: int unur_itdr_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) Change the verifying of algorithm while sampling on/off. 5.3.10 NINV – Numerical INVersion --------------------------------- Required: CDF Optional: PDF Speed: Set-up: optional, Sampling: (very) slow Reinit: supported NINV implementations of some methods for numerical inversion: Newton’s method, regula falsi (combined with interval bisectioning), and bisection method. Regula falsi and bisection method require only the CDF while Newton’s method also requires the PDF. To speed up marginal generation times a table with suitable starting points can be created during the setup. The performance of the algorithm can adjusted by the desired accuracy of the method. It is possible to use this method for generating from truncated distributions. The truncated domain can be changed for an existing generator object. How To Use .......... Method NINV generates random variates by numerical inversion and requires a continuous univariate distribution objects with given CDF. Three variants are available: − Regula falsi [default] − Newton’s method − Interval bisectioning Newton’s method additionally requires the PDF of the distribution and cannot be used otherwise (NINV automatically switches to regula falsi then). Default algorithm is regula falsi. It is slightly slower but numerically much more stable than Newton’s algorithm. Interval bisectioning is the slowest method and should only be considered as a last resort when the other methods fails. It is possible to draw samples from truncated distributions. The truncated domain can even be changed for an existing generator object by an ‘unur_ninv_chg_truncated’ call. Marginal generation times can be sped up by means of a table with suitable starting points which can be created during the setup. Using such a table can be switched on by means of a ‘unur_ninv_set_table’ call where the table size is given as a parameter. The table is still useful when the (truncated) domain is changed often, since it is computed for the domain of the given distribution. (It is not possible to enlarge this domain.) If it is necessary to recalculate the table during sampling, the command ‘unur_ninv_chg_table’ can be used. As a rule of thumb using such a table is appropriate when the number of generated points exceeds the table size by a factor of 100. The default number of iterations of NINV should be enough for all reasonable cases. Nevertheless, it is possible to adjust the maximal number of iterations with the commands ‘unur_ninv_set_max_iter’ and ‘unur_ninv_chg_max_iter’. In particular this might be necessary when the PDF has a pole or the distribution has extremely heavy tails. It is also possible to set/change the accuracy of the method (which also heavily influencies the generation time). We use two measures for the approximation error which can be used independently: x-error and u-error (*note Inversion:: for more details). It is possible to set the maximal tolerated error using with ‘unur_ninv_set_x_resolution’ and with ‘unur_ninv_set_u_resolution’, resp., and change it with the respective calls ‘unur_ninv_chg_x_resolution’ and ‘unur_ninv_chg_x_resolution’. The algorithm tries to satisfy _both_ accuracy goals (and raises an error flag it this fails). One of these accuracy checks can be disabled by setting the accuracy goal to a negative value. NINV tries to use proper starting values for both the regula falsi and bisection method, and for Newton’s method. Of course the user might have more knowledge about the properties of the target distribution and is able to share his wisdom with NINV using the respective commands ‘unur_ninv_set_start’ and ‘unur_ninv_chg_start’. It is possible to change the parameters and the domain of the chosen distribution and run ‘unur_reinit’ to reinitialize the generator object. The values given by the last ‘unur_ninv_chg_truncated’ call will be then changed to the values of the domain of the underlying distribution object. It is important to note that for a distribution from the UNU.RAN library of standard distributions (*note Standard distributions: Stddist.) the normalization constant has to be updated using the ‘unur_distr_cont_upd_pdfarea’ call whenever its parameters have been changed by means of a ‘unur_distr_cont_set_pdfparams’ call. It might happen that NINV aborts ‘unur_sample_cont’ without computing the correct value (because the maximal number iterations has been exceeded). Then the last approximate value for x is returned (with might be fairly false) and ‘unur_error’ is set to ‘UNUR_ERR_GEN_SAMPLING’. Function reference ------------------ -- Function: UNUR_PAR* unur_ninv_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_ninv_set_useregula (UNUR_PAR* PARAMETERS) Switch to regula falsi combined with interval bisectioning. (This the default.) -- Function: int unur_ninv_set_usenewton (UNUR_PAR* PARAMETERS) Switch to Newton’s method. Notice that it is numerically less stable than regula falsi. It it is not possible to invert the CDF for a particular uniform random number U when calling ‘unur_sample_cont’, ‘unur_error’ is set to ‘UNUR_ERR_GEN_SAMPLING’. Thus it is recommended to check ‘unur_error’ before using the result of the sampling routine. -- Function: int unur_ninv_set_usebisect (UNUR_PAR* PARAMETERS) Switch to bisection method. This is a slow algorithm and should only be used as a last resort. -- Function: int unur_ninv_set_max_iter (UNUR_PAR* PARAMETERS, int MAX_ITER) -- Function: int unur_ninv_chg_max_iter (UNUR_GEN* GENERATOR, int MAX_ITER) Set and change number of maximal iterations. Default is ‘100’. -- Function: int unur_ninv_set_x_resolution (UNUR_PAR* PARAMETERS, double X_RESOLUTION) -- Function: int unur_ninv_chg_x_resolution (UNUR_GEN* GENERATOR, double X_RESOLUTION) Set and change the maximal tolerated relative x-error. If X_RESOLUTION is negative then checking of the x-error is disabled. Default is ‘1.e-8’. -- Function: int unur_ninv_set_u_resolution (UNUR_PAR* PARAMETERS, double U_RESOLUTION) -- Function: int unur_ninv_chg_u_resolution (UNUR_GEN* GENERATOR, double U_RESOLUTION) Set and change the maximal tolerated (abolute) u-error. If U_RESOLUTION is negative then checking of the u-error is disabled. Default is ‘-1’ (disabled). -- Function: int unur_ninv_set_start (UNUR_PAR* PARAMETERS, double LEFT, double RIGHT) Set starting points. If not set, suitable values are chosen automatically. Newton: LEFT: starting point Regula falsi: LEFT, RIGHT: boundary of starting interval If the starting points are not set then the follwing points are used by default: Newton: LEFT: CDF(LEFT) = 0.5 Regula falsi: LEFT: CDF(LEFT) = 0.1 RIGHT: CDF(RIGHT) = 0.9 If LEFT == RIGHT, then UNU.RAN always uses the default starting points! -- Function: int unur_ninv_chg_start (UNUR_GEN* GEN, double LEFT, double RIGHT) Change the starting points for numerical inversion. If left==right, then UNU.RAN uses the default starting points (see ‘unur_ninv_set_start’ ). -- Function: int unur_ninv_set_table (UNUR_PAR* PARAMETERS, int NO_OF_POINTS) Generates a table with NO_OF_POINTS points containing suitable starting values for the iteration. The value of NO_OF_POINTS must be at least 10 (otherwise it will be set to 10 automatically). The table points are chosen such that the CDF at these points form an equidistance sequence in the interval (0,1). If a table is used, then the starting points given by ‘unur_ninv_set_start’ are ignored. No table is used by default. -- Function: int unur_ninv_chg_table (UNUR_GEN* GEN, int NO_OF_POINTS) Recomputes a table as described in ‘unur_ninv_set_table’. -- Function: int unur_ninv_chg_truncated (UNUR_GEN* GEN, double LEFT, double RIGHT) Changes the borders of the domain of the (truncated) distribution. Notice that the given truncated domain must be a subset of the domain of the given distribution. The generator always uses the intersection of the domain of the distribution and the truncated domain given by this call. Moreover the starting point(s) will not be changed. _Important:_ If the CDF is (almost) the same for LEFT and RIGHT and (almost) equal to ‘0’ or ‘1’, then the truncated domain is _not_ chanced and the call returns an error code. _Notice:_ If the parameters of the distribution has been changed by a ‘unur_distr_cont_set_pdfparams’ call it is recommended to set the truncated domain again, since the former call might change the domain of the distribution but not update the values for the boundaries of the truncated distribution. -- Function: double unur_ninv_eval_approxinvcdf (const UNUR_GEN* GENERATOR, double U) Get approximate approximate value of inverse CDF at U. If U is out of the domain [0,1] then ‘unur_errno’ is set to ‘UNUR_ERR_DOMAIN’ and the respective bound of the domain of the distribution are returned (which is ‘-UNUR_INFINITY’ or ‘UNUR_INFINITY’ in the case of unbounded domains). _Notice_: This function always evaluates the inverse CDF of the given distribution. A call to ‘unur_ninv_chg_truncated’ call has no effect. 5.3.11 NROU – Naive Ratio-Of-Uniforms method -------------------------------------------- Required: PDF Optional: mode, center, bounding rectangle for acceptance region Speed: Set-up: slow or fast, Sampling: moderate Reinit: supported Reference: [HLD04: Sect.2.4 and Sect.6.4] NROU is an implementation of the (generalized) ratio-of-uniforms method which uses (minimal) bounding rectangles, see *note Ratio-of-Uniforms::. It uses a positive control parameter r for adjusting the algorithm to the given distribution to improve performance and/or to make this method applicable. Larger values of r increase the class of distributions for which the method works at the expense of a higher rejection constant. For computational reasons r=1 should be used if possible (this is the default). Moreover, this implementation uses the center mu of the distribution (see ‘unur_distr_cont_get_center’ for details of its default values). For the special case with r=1 the coordinates of the minimal bounding rectangles are given by v^+ = sup_(x) sqrt(PDF(x)), u^- = inf_(x) (x- mu) sqrt(PDF(x)), u^+ = sup_(x) (x- mu) sqrt(PDF(x)), where mu is the center of the distribution. For other values of r we have v^+ = sup_(x) (PDF(x))^(1/(r+1)), u^- = inf_(x) (x- mu) (PDF(x))^(r/(r+1)), u^+ = sup_(x) (x- mu) (PDF(x))^(r/(r+1)). These bounds can be given directly. Otherwise they are computed automatically by means of a (slow) numerical routine. Of course this routine can fail, especially when this rectangle is not bounded. It is important to note that the algorithm works with PDF(x- mu) instead of PDF(x). This is important as otherwise the acceptance region can become a very long and skinny ellipsoid along a diagonal of the (huge) bounding rectangle. How To Use .......... For using the NROU method UNU.RAN needs the PDF of the distribution. Additionally, the parameter r can be set via a ‘unur_vnrou_set_r’ call. Notice that the acceptance probability decreases when r is increased. On the other hand is is more unlikely that the bounding rectangle does not exist if r is small. A bounding rectangle can be given by the ‘unur_vnrou_set_u’ and ‘unur_vnrou_set_v’ calls. _Important:_ The bounding rectangle has to be provided for the function PDF(x-center)! Notice that ‘center’ is the center of the given distribution, see ‘unur_distr_cont_set_center’. If in doubt or if this value is not optimal, it can be changed (overridden) by a ‘unur_nrou_set_center’ call. If the coordinates of the bounding rectangle are not provided by the user then the minimal bounding rectangle is computed automatically. By means of ‘unur_vnrou_set_verify’ and ‘unur_vnrou_chg_verify’ one can run the sampling algorithm in a checking mode, i.e., in every cycle of the rejection loop it is checked whether the used rectangle indeed enclosed the acceptance region of the distribution. When in doubt (e.g., when it is not clear whether the numerical routine has worked correctly) this can be used to run a small Monte Carlo study. It is possible to change the parameters and the domain of the chosen distribution and run ‘unur_reinit’ to reinitialize the generator object. Notice, that derived parameters like the mode must also be (re-) set if the parameters or the domain has be changed. Notice, however, that then the values that has been set by ‘unur_vnrou_set_u’ and ‘unur_vnrou_set_v’ calls are removed and the coordinates of the bounding box are computed numerically. Function reference ------------------ -- Function: UNUR_PAR* unur_nrou_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_nrou_set_u (UNUR_PAR* PARAMETERS, double UMIN, double UMAX) Sets left and right boundary of bounding rectangle. If no values are given, the boundary of the minimal bounding rectangle is computed numerically. _Notice_: Computing the minimal bounding rectangle may fail under some circumstances. Moreover, for multimodal distributions the bounds might be too small as only local extrema are computed. Nevertheless, for T_c -concave distributions with c=-1/2 it should work. _Important:_ The bounding rectangle that has to be provided is for the function PDF(x-center)! Default: not set. -- Function: int unur_nrou_set_v (UNUR_PAR* PARAMETERS, double VMAX) Set upper boundary for bounding rectangle. If this value is not given then sqrt(PDF(mode)) is used instead. _Notice_: When the mode is not given for the distribution object, then it will be computed numerically. Default: not set. -- Function: int unur_nrou_set_r (UNUR_PAR* PARAMETERS, double R) Sets the parameter R of the generalized ratio-of-uniforms method. _Notice_: This parameter must satisfy R>0. Default: ‘1’. -- Function: int unur_nrou_set_center (UNUR_PAR* PARAMETERS, double CENTER) Set the center mu of the PDF. If not set the center of the given distribution object is used. Default: see ‘unur_distr_cont_set_center’. -- Function: int unur_nrou_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) Turn verifying of algorithm while sampling on/off. If the condition PDF(x) <= hat(x) is violated for some x then ‘unur_errno’ is set to ‘UNUR_ERR_GEN_CONDITION’. However, notice that this might happen due to round-off errors for a few values of x (less than 1%). Default is ‘FALSE’. -- Function: int unur_nrou_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) Change the verifying of algorithm while sampling on/off. 5.3.12 PINV – Polynomial interpolation based INVersion of CDF ------------------------------------------------------------- Required: PDF Optional: domain, center, CDF, derivative of PDF Speed: Set-up: (very) slow, Sampling: (very) fast Reinit: not implemented Reference: [DHLa08] PINV is a variant of numerical inversion, where the inverse CDF is approximated using Newton’s interpolating formula. The interval [0,1] is split into several subintervals. In each of these the inverse CDF is constructed at nodes (CDF(x),x) for some points x in this subinterval. If the PDF is given, then the CDF is computed numerically from the given PDF using adaptive Gauss-Lobatto integration with 5 points. Subintervals are split until the requested accuracy goal is reached. The method is not exact, as it only produces random variates of the approximated distribution. Nevertheless, the maximal tolerated approximation error can be set to be the resolution (but of course is bounded by the machine precision). We use the u-error |U-CDF(X)| to measure the error for X = "approximate inverse CDF"(U). Notice that very small values of the u-resolution are possible but increase the cost for the setup step. We call the maximal tolerated u-error the _u-resolution_ of the algorithm in the sequel. Both the order of the interpolating polynomial and the u-resolution can be selected. The interpolating polynomials have to be computed in a setup step. However, it only works for distributions with bounded domain; for distributions with unbounded domain the tails are cut off such that the probability for the tail regions is small compared to the given u-resolution. The construction of the interpolation polynomial only works when the PDF is unimodal or when the PDF does not vanish between two modes. There are some restrictions for the given distribution: • The support of the distribution (i.e., the region where the PDF is strictly positive) must be connected. In practice this means, that the region where PDF is "not too small" must be connected. Unimodal densities satisfy this condition. If this condition is violated then the domain of the distribution might be truncated. • When the PDF is integrated numerically, then the given PDF must be continuous and should be smooth. • The PDF must be bounded. • The algorithm has problems when the distribution has heavy tails (as then the inverse CDF becomes very steep at 0 or 1) and the requested u-resolution is very small. E.g., the Cauchy distribution is likely to show this problem when the requested u-resolution is less then ‘1.e-12’. Regions with very small PDF values or heavy tails might lead to an abortion of the set-up or (even worse) the approximation error might become larger than requested, since the (computation of the) interpolating polynomial becomes numerically unstable. _Remark:_ We also have implemented experimental variants. However, we observed that these variants are more sensitive to round-off errors, especially in the right hand tail and we _do not recommend_ their usage unless there are severe reasons. − Use a function that implements the CDF instead of numerical integration of the PDF. − Use Hermite interpolation instead of Newton interpolation. Thus the first (and second) derivative of the interpolating polynomial coincides with that of the inverse CDF. Consequently the interpolant is also (twice) differentiable even at the interval boundaries. This variant can be seen as limiting case of Newton interpolation with double (or triple) points as nodes. We have used a _smoothness_ parameter to control this feature. However, besides numerical problems we observed that this variant requires more intervals and thus larger setup times and higher memory consumptions. How To Use .......... PINV works for continuous univariate distribution objects with given PDF. The corresponding distribution object should contain a typical point of the distribution, i.e., a point where the PDF is not too small, e.g., (a point near) the mode. However, it is important that the center is *not* the pole of the distribution (or a point too close to the pole). It can be set using a ‘unur_distr_cont_set_center’ or a ‘unur_distr_cont_set_mode’ call. If neither is set, or if the given center cannot be used, then a simple search routine tries to find an appropriate point for the center. It is recommended that the domain of the distribution with bounded domain is specified using a ‘unur_distr_cont_set_domain’ call. Otherwise, the boundary is searched numerically which might be rather expensive, especially when this boundary point is ‘0’. The inverse CDF is interpolated using Newton polynomials. The order of this polynomial can be set by means of a ‘unur_pinv_set_order’ call. The smoothness of the interpolant at interval boundaries can be controlled using a ‘unur_pinv_set_smoothness’ call. Then Hermite interpolation instead of Newton interpolation is used. (The former can be seen as a limiting case of Newton interpolation with double (or triple) points.) However, using higher smoothness is _not recommended_ unless differentiability at the interval boundaries is important. For distributions with unbounded domains the tails are cut off such that the probability for the tail regions is small compared to the given u-resolution. For finding these cut points the algorithm starts with the region ‘[-1.e100,1.e100]’. For the exceptional case where this does not work these starting points can be changed via a ‘unur_pinv_set_boundary’ call. This method is not exact, as it only produces random variates of the approximated distribution. Nevertheless, the numerical error in "u-direction" (i.e., |U-CDF(X)|, for X = "approximate inverse CDF"(U) |U-CDF(X)|) can be controlled by means of ‘unur_pinv_set_u_resolution’. However, the maximal error of this approximation is only estimated. For very small u-resolutions the actual approximation error might be (slightly) larger than the requested u-resolution. (Of course the size of this value depends on the given PDF.) If this error is crucial for an application we recommend to compute this error using ‘unur_pinv_estimate_error’ which runs a small Monte Carlo simulation. It is also possible to improve the error estimate during setup by means of ‘unur_pinv_set_extra_testpoints’. See also the documentation for function ‘unur_pinv_set_u_resolution’ and the remark given there. The number of required subintervals heavily depends on the order of the interpolating polynomial and the requested u-resolution: it increases when order or u-resolution are decreased. It can be checked using a ‘unur_pinv_get_n_intervals’ call. The maximum number of such subintervals is fixed but can be increased using a ‘unur_pinv_set_max_intervals’ call. If this maximum number is too small then the set-up aborts with a corresponding error message. It is also possible to use the CDF of the distribution instead of the PDF. Then the distribution object must contain a pointer to the CDF. Moreover, this variant of the algorithm has to be switched on using an ‘unur_pinv_set_usecdf’ call. Notice, however, that the setup for this variant is numerically less stable than using integration of the PDF (the default variant). Thus using the CDF is _not recommended_. Function reference ------------------ -- Function: UNUR_PAR* unur_pinv_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_pinv_set_order (UNUR_PAR* PARAMETERS, int ORDER) Set order of interpolation. Valid orders are between ‘3’ and ‘17’. Higher orders result in fewer intervals for the approximations. Default: ‘5’. -- Function: int unur_pinv_set_smoothness (UNUR_PAR* PARAMETERS, int SMOOTHNESS) Set smoothness of interpolant. By construction the interpolant is piecewise polynomial and thus smooth on each of the intervals where these polynomials are constructed. At the interval boundaries, however, it usually not be differentiable. Method PINV also implements variants of Newton interpolation where the first (or second) derivative of the interpolating polynomial coincides with the respective derivative of the inverse CDF at the nodes. The the interpolant is (twice) differentiable even at the interval boundaries. These variants can be seen as limiting case of Newton interpolation with double (or triple) points as nodes and are known as Hermite interpolation. Possible values for SMOOTHNESS: Value Effect Requirements ------------------------------------------------------------------------------- ‘0’ continuous requires PDF (or CDF) ‘1’ differentiable requires PDF (optional: CDF), order of polynomial must be odd ‘2’ twice requires PDF and its derivative (optional: differentiable CDF), order must be 5, 8, 11, 14 or 17 If the order of the polynomial does not satisfy the given condition, then it is increased to the next larger possible value. _Remark:_ A higher smoothness parameter usually results in a higher number of intervals and thus a higher setup time and memory consumption. We also observed that higher smoothness parameters make the algorithm more sensible for round-off error. Then the setup fails. _Remark:_ If the interpolating polynomial cannot be constructed for the requested smoothness on a particular interval, then the smoothness parameter is reduced for that interval. _Remark:_ For order ‘3’ and smoothness ‘1’ (cubic Hermite interpolation) monotonicity is guaranteed by checking a simple monotonicity condition for the coefficients of the polynomials. _Remark:_ Using SMOOTHNESS larger than ‘0’ is _not recommended_ unless differentiability at the interval boundaries is important for ones application. Default: ‘0’. -- Function: int unur_pinv_set_u_resolution (UNUR_PAR* PARAMETERS, double U_RESOLUTION) Set maximal tolerated u-error. Values of U_RESOLUTION must at least ‘1.e-15’ and ‘1.e-5’ at most. Notice that the resolution of most uniform random number sources is 2^(-32) = ‘2.3e-10’. Thus a value of ‘1.e-10’ leads to an inversion algorithm that could be called exact. For most simulations slightly bigger values for the maximal error are enough as well. Smaller values for U_RESOLUTION increase the number of subinterval that are necessary for the approximation of the inverse CDF. For very small values (less then ‘1.e-12’) this number might exceed the maximum number of such intervals. However, this number can be increased using a ‘unur_pinv_set_max_intervals’ call. _Remark:_ We ran many experiments and found that the observed u-error was always smaller than the given U_RESOLUTION whenever this value was ‘1.e-12’. For values smaller than ‘1e-13’ the maximal observed u-error was slightly larger. One use ‘1.e-15’ if best approximation is required. However, then the actual u-error can be as large as ‘1.e-14’. Consider calling ‘unur_pinv_set_extra_testpoints’ in order to reduce the risk of larger approximation errors. *Warning!* These figures are based on our experiments (with some tolerance added to be on the safe side). There is no guarantee for these error estimates for a particular distribution. Default is ‘1.e-10’. -- Function: int unur_pinv_set_extra_testpoints (UNUR_PAR* PARAMETERS, int N_POINTS) During setup method PINV checks the current u-error by means of carefully selected test points and improves the approximation where necessary. However, it nevertheless may happen, that the maximal approximation error is larger than estimated in some interval (which usually is hit with a very small probability). This estimate can be improved by using extra test points which can be added by means of this call. However, this increases the setup time considerably. Note that these additional points are selected equidistributed in each subinterval. Default is ‘0’ (i.e., no additional test points are used). -- Function: int unur_pinv_set_use_upoints (UNUR_PAR* PARAMETERS, int USE_UPOINTS) If USE_UPOINTS is ‘TRUE’, then the nodes of the interpolating polynomial are constructed by means of Chebyshev points in u-scale not in x-scale. This results is a better approximation but almost doubles the number of PDF or CDF evaluations during the setup. (This is an experimental feature.) Default: ‘FALSE’ -- Function: int unur_pinv_set_usepdf (UNUR_PAR* PARAMETERS) Use PDF (if available) to compute approximate inverse CDF. This is the default. -- Function: int unur_pinv_set_usecdf (UNUR_PAR* PARAMETERS) Use CDF (if available) to compute approximate inverse CDF. This variant is intend for running experiments with method PINV. _Remark:_ We ran many experiments and found that for small values of the given U_RESOLUTION (less than ‘1.e-12’) the setup fails for distributions with heavy tails. We found that using the PDF (instead of the CDF) is numerically more stable. This is especially the case when the smoothness parameter is set to ‘1’ or ‘2’. Using the CDF is *not recommended*. -- Function: int unur_pinv_set_boundary (UNUR_PAR* PARAMETERS, double LEFT, double RIGHT) Set LEFT and RIGHT point for finding the cut-off points for the "computational domain", i.e., the domain that covers the essential part of the distribution. The cut-off points are computed such that the tail probabilities are smaller than given by ‘unur_pinv_set_u_resolution’. It is usually safe to use a large interval. However, ‘+/- UNUR_INFINITY’ is not allowed. _Important_: This call does not change the domain of the given distribution itself. But it restricts the domain for the resulting random variates. Default: intersection of ‘[-1.e100,+1.e100]’ and the given domain of the distribution. -- Function: int unur_pinv_set_searchboundary (UNUR_PAR* PARAMETERS, int LEFT, int RIGHT) If LEFT or RIGHT is set to ‘FALSE’ then the respective boundary as given by a ‘unur_pinv_set_boundary’ call is used without any further computations. However, these boundary points might cause numerical problems during the setup when PDF returns ‘0’ “almost everywhereâ€. If set to ‘TRUE’ (the default) then the computational interval is shortened to a more sensible region by means of a search algorithm. Switching off this search is useful, e.g., for the Gamma(2) distribution where the left border ‘0’ is fixed and finite. _Remark:_ The searching algorithm assumes that the support of the distribution is connected. _Remark:_ Do not set this parameter to ‘FALSE’ except when searching for cut-off points fails and one wants to try with precomputed values. Default: ‘TRUE’. -- Function: int unur_pinv_set_max_intervals (UNUR_PAR* PARAMETERS, int MAX_IVS) Set maximum number of intervals. MAX_IVS must be at least ‘100’ and at most ‘1000000’. Default is ‘10000’. -- Function: int unur_pinv_get_n_intervals (const UNUR_GEN* GENERATOR) Get number of intervals used for interpolation in the generator object. It returns ‘0’ in case of an error. -- Function: int unur_pinv_set_keepcdf (UNUR_PAR* PARAMETERS, int KEEPCDF) If the PDF is given, then the CDF is computed numerically from the given PDF using adaptive Gauss-Lobatto integration. Thus a table of CDF points is stored to keep the number of evaluations of the PDF minimal. Usually this table is discarded when the setup is completed. If KEEPCDF is ‘TRUE’, then this table is kept and can be used to compute the CDF of the underlying distribution by means of function ‘unur_pinv_eval_approxcdf’. This option is ignored when ‘unur_pinv_set_usecdf’ is called. Default: ‘FALSE’ -- Function: double unur_pinv_eval_approxinvcdf (const UNUR_GEN* GENERATOR, double U) Evaluate interpolation of inverse CDF at U. If U is out of the domain (0,1) then ‘unur_errno’ is set to ‘UNUR_ERR_DOMAIN’ and the respective bound of the domain of the distribution are returned (which is ‘-UNUR_INFINITY’ or ‘UNUR_INFINITY’ in the case of unbounded domains). -- Function: double unur_pinv_eval_approxcdf (const UNUR_GEN* GENERATOR, double X) Evaluate (approximate) CDF at X. If the PDF of the distribution is given, then adaptive Gauss-Lobatto integration is used to compute the CDF. If the PDF is used to create the generator object, then the table of integral values must not removed at the end of setup and thus ‘unur_pinv_set_keepcdf’ must be called. -- Function: int unur_pinv_estimate_error (const UNUR_GEN* GENERATOR, int SAMPLESIZE, double* MAX_ERROR, double* MAE) Estimate maximal u-error and mean absolute error (MAE) for GENERATOR by means of Monte-Carlo simulation with sample size SAMPLESIZE. The results are stored in MAX_ERROR and MAE, respectively. It returns ‘UNUR_SUCCESS’ if successful. 5.3.13 SROU – Simple Ratio-Of-Uniforms method --------------------------------------------- Required: T-concave PDF, mode, area Speed: Set-up: fast, Sampling: slow Reinit: supported Reference: [LJa01] [LJa02] [HLD04: Sect.6.3.1; Sect.6.3.2; Sect.6.4.1; Alg.6.4; Alg.6.5; Alg.6.7] SROU is based on the ratio-of-uniforms method (*note Ratio-of-Uniforms::) that uses universal inequalities for constructing a (universal) bounding rectangle. It works for all T-concave distributions, including log-concave and T-concave distributions with T(x) = -1/sqrt(x). Moreover an (optional) parameter ‘r’ can be given, to adjust the generator to the given distribution. This parameter is strongly related to the parameter ‘c’ for transformed density rejection (*note TDR::) via the formula c = -r/(r+1). The rejection constant increases with higher values for ‘r’. On the other hand, the given density must be T_c -concave for the corresponding c. The default setting for ‘r’ is 1 which results in a very simple code. (For other settings, sampling uniformly from the acceptance region is more complicated.) Optionally the CDF at the mode can be given to increase the performance of the algorithm. Then the rejection constant is reduced by 1/2 and (if ‘r=1’) even a universal squeeze can (but need not be) used. A way to increase the performance of the algorithm when the CDF at the mode is not provided is the usage of the mirror principle (only if ‘r=1’). However, using squeezes and using the mirror principle is only recommended when the PDF is expensive to compute. The exact location of the mode and/or the area below the PDF can be replace by appropriate bounds. Then the algorithm still works but has larger rejection constants. How To Use .......... SROU works for any continuous univariate distribution object with given T_c -concave PDF with c<1, ) mode and area below PDF. Optional the CDF at the mode can be given to increase the performance of the algorithm by means of the ‘unur_srou_set_cdfatmode’ call. Additionally squeezes can be used and switched on via ‘unur_srou_set_usesqueeze’ (only if ‘r=1’). A way to increase the performance of the algorithm when the CDF at the mode is not provided is the usage of the mirror principle which can be swithced on by means of a ‘unur_srou_set_usemirror’ call (only if ‘r=1’) . However using squeezes and using the mirror principle is only recommended when the PDF is expensive to compute. The parameter ‘r’ can be given, to adjust the generator to the given distribution. This parameter is strongly related parameter ‘c’ for transformed density rejection via the formula c = -r/(r+1). The parameter ‘r’ can be any value larger than or equal to 1. Values less then 1 are automatically set to 1. The rejection constant depends on the chosen parameter ‘r’ but not on the particular distribution. It is 4 for ‘r’ equal to 1 and higher for higher values of ‘r’. It is important to note that different algorithms for different values of ‘r’: If ‘r’ equal to 1 this is much faster than the algorithm for ‘r’ greater than 1. The default setting for ‘r’ is 1. If the (exact) area below the PDF is not known, then an upper bound can be used instead (which of course increases the rejection constant). But then the squeeze flag must not be set and ‘unur_srou_set_cdfatmode’ must not be used. If the exact location of the mode is not known, then use the approximate location and provide the (exact) value of the PDF at the mode by means of the ‘unur_srou_set_pdfatmode’ call. But then ‘unur_srou_set_cdfatmode’ must not be used. Notice, that a (slow) numerical mode finder will be used if no mode is given at all. It is even possible to give an upper bound for the PDF only. However, then the (upper bound for the) area below the PDF has to be multiplied by the ratio between the upper bound and the lower bound of the PDF at the mode. Again setting the squeeze flag and using ‘unur_srou_set_cdfatmode’ is not allowed. It is possible to change the parameters and the domain of the chosen distribution and run ‘unur_reinit’ to reinitialize the generator object. Notice, that derived parameters like the mode must also be (re-) set if the parameters or the domain has be changed. Moreover, if the PDF at the mode has been provided by a ‘unur_srou_set_pdfatmode’ call, additionally ‘unur_srou_chg_pdfatmode’ must be used (otherwise this call is not necessary since then this figure is computed directly from the PDF). There exists a test mode that verifies whether the conditions for the method are satisfied or not while sampling. It can be switched on by calling ‘unur_srou_set_verify’ and ‘unur_srou_chg_verify’, respectively. Notice however that sampling is (a little bit) slower then. Function reference ------------------ -- Function: UNUR_PAR* unur_srou_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_srou_set_r (UNUR_PAR* PARAMETERS, double R) Set parameter R for transformation. Only values greater than or equal to 1 are allowed. The performance of the generator decreases when R is increased. On the other hand R must not be set to small, since the given density must be T_c-concave for c = -r/(r+1). _Notice:_ If R is set to ‘1’ a simpler and much faster algorithm is used then for R greater than one. For computational reasons values of R that are greater than ‘1’ but less than ‘1.01’ are always set to ‘1.01’. Default is ‘1’. -- Function: int unur_srou_set_cdfatmode (UNUR_PAR* PARAMETERS, double FMODE) Set CDF at mode. When set, the performance of the algorithm is increased by factor 2. However, when the parameters of the distribution are changed ‘unur_srou_chg_cdfatmode’ has to be used to update this value. Default: not set. -- Function: int unur_srou_set_pdfatmode (UNUR_PAR* PARAMETERS, double FMODE) Set pdf at mode. When set, the PDF at the mode is never changed. This is to avoid additional computations, when the PDF does not change when parameters of the distributions vary. It is only useful when the PDF at the mode does not change with changing parameters of the distribution. _IMPORTANT:_ This call has to be executed after a possible call of ‘unur_srou_set_r’. Default: not set. -- Function: int unur_srou_set_usesqueeze (UNUR_PAR* PARAMETERS, int USESQUEEZE) Set flag for using universal squeeze (default: off). Using squeezes is only useful when the evaluation of the PDF is (extremely) expensive. Using squeezes is automatically disabled when the CDF at the mode is not given (then no universal squeezes exist). Squeezes can only be used if ‘r=1’. Default is ‘FALSE’. -- Function: int unur_srou_set_usemirror (UNUR_PAR* PARAMETERS, int USEMIRROR) Set flag for using mirror principle (default: off). Using the mirror principle is only useful when the CDF at the mode is not known and the evaluation of the PDF is rather cheap compared to the marginal generation time of the underlying uniform random number generator. It is automatically disabled when the CDF at the mode is given. (Then there is no necessity to use the mirror principle. However disabling is only done during the initialization step but not at a re-initialization step.) The mirror principle can only be used if ‘r=1’. Default is ‘FALSE’. -- Function: int unur_srou_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) -- Function: int unur_srou_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) Turn verifying of algorithm while sampling on/off. If the condition squeeze(x) <= PDF(x) <= hat(x) is violated for some x then ‘unur_errno’ is set to ‘UNUR_ERR_GEN_CONDITION’. However notice that this might happen due to round-off errors for a few values of x (less than 1%). Default is ‘FALSE’. -- Function: int unur_srou_chg_cdfatmode (UNUR_GEN* GENERATOR, double FMODE) Change CDF at mode of distribution. ‘unur_reinit’ must be executed before sampling from the generator again. -- Function: int unur_srou_chg_pdfatmode (UNUR_GEN* GENERATOR, double FMODE) Change PDF at mode of distribution. ‘unur_reinit’ must be executed before sampling from the generator again. 5.3.14 SSR – Simple Setup Rejection ----------------------------------- Required: T-concave PDF, mode, area Speed: Set-up: fast, Sampling: slow Reinit: supported Reference: [LJa01] [HLD04: Sect.6.3.3; Alg.6.6] SSR is an acceptance/rejection method that uses universal inequalities for constructing (universal) hats and squeezes (*note Rejection::). It works for all T-concave distributions with T(x) = -1/sqrt(x). It requires the PDF, the (exact) location of the mode and the area below the given PDF. The rejection constant is 4 for all T-concave distributions with unbounded domain and is less than 4 when the domain is bounded. Optionally the CDF at the mode can be given to increase the performance of the algorithm. Then the rejection constant is at most 2 and a universal squeeze can (but need not be) used. However, using squeezes is not recommended unless the evaluation of the PDF is expensive. The exact location of the mode and/or the area below the PDF can be replace by appropriate bounds. Then the algorithm still works but has larger rejection constants. How To Use .......... SSR works for any continuous univariate distribution object with given T-concave PDF (with T(x) = -1/sqrt(x),) mode and area below PDF. Optional the CDF at the mode can be given to increase the performance of the algorithm by means of the ‘unur_ssr_set_cdfatmode’ call. Additionally squeezes can be used and switched on via ‘unur_ssr_set_usesqueeze’. If the (exact) area below the PDF is not known, then an upper bound can be used instead (which of course increases the rejection constant). But then the squeeze flag must not be set and ‘unur_ssr_set_cdfatmode’ must not be used. If the exact location of the mode is not known, then use the approximate location and provide the (exact) value of the PDF at the mode by means of the ‘unur_ssr_set_pdfatmode’ call. But then ‘unur_ssr_set_cdfatmode’ must not be used. Notice, that a (slow) numerical mode finder will be used if no mode is given at all. It is even possible to give an upper bound for the PDF only. However, then the (upper bound for the) area below the PDF has to be multiplied by the ratio between the upper bound and the lower bound of the PDF at the mode. Again setting the squeeze flag and using ‘unur_ssr_set_cdfatmode’ is not allowed. It is possible to change the parameters and the domain of the chosen distribution and run ‘unur_reinit’ to reinitialize the generator object. Notice, that derived parameters like the mode must also be (re-) set if the parameters or the domain has be changed. Moreover, if the PDF at the mode has been provided by a ‘unur_ssr_set_pdfatmode’ call, additionally ‘unur_ssr_chg_pdfatmode’ must be used (otherwise this call is not necessary since then this figure is computed directly from the PDF). _Important:_ If any of mode, PDF or CDF at the mode, or the area below the mode has been changed, then ‘unur_reinit’ must be executed. (Otherwise the generator produces garbage). There exists a test mode that verifies whether the conditions for the method are satisfied or not while sampling. It can be switched on/off by calling ‘unur_ssr_set_verify’ and ‘unur_ssr_chg_verify’, respectively. Notice, however, that sampling is (a little bit) slower then. Function reference ------------------ -- Function: UNUR_PAR* unur_ssr_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_ssr_set_cdfatmode (UNUR_PAR* PARAMETERS, double FMODE) Set CDF at mode. When set, the performance of the algorithm is increased by factor 2. However, when the parameters of the distribution are changed ‘unur_ssr_chg_cdfatmode’ has to be used to update this value. Default: not set. -- Function: int unur_ssr_set_pdfatmode (UNUR_PAR* PARAMETERS, double FMODE) Set pdf at mode. When set, the PDF at the mode is never changed. This is to avoid additional computations, when the PDF does not change when parameters of the distributions vary. It is only useful when the PDF at the mode does not change with changing parameters for the distribution. Default: not set. -- Function: int unur_ssr_set_usesqueeze (UNUR_PAR* PARAMETERS, int USESQUEEZE) Set flag for using universal squeeze (default: off). Using squeezes is only useful when the evaluation of the PDF is (extremely) expensive. Using squeezes is automatically disabled when the CDF at the mode is not given (then no universal squeezes exist). Default is ‘FALSE’. -- Function: int unur_ssr_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) -- Function: int unur_ssr_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) Turn verifying of algorithm while sampling on/off. If the condition squeeze(x) <= PDF(x) <= hat(x) is violated for some x then ‘unur_errno’ is set to ‘UNUR_ERR_GEN_CONDITION’. However notice that this might happen due to round-off errors for a few values of x (less than 1%). Default is ‘FALSE’. -- Function: int unur_ssr_chg_cdfatmode (UNUR_GEN* GENERATOR, double FMODE) Change CDF at mode of distribution. ‘unur_reinit’ must be executed before sampling from the generator again. -- Function: int unur_ssr_chg_pdfatmode (UNUR_GEN* GENERATOR, double FMODE) Change PDF at mode of distribution. ‘unur_reinit’ must be executed before sampling from the generator again. 5.3.15 TABL – a TABLe method with piecewise constant hats --------------------------------------------------------- Required: PDF, all local extrema, cut-off values for the tails Optional: approximate area Speed: Set-up: (very) slow, Sampling: fast Reinit: not implemented Reference: [AJa93] [AJa95] [HLD04: Cha.5.1] TABL (called Ahrens method in [HLD04] ) is an acceptance/rejection method (*note Rejection::) that uses a decomposition of the domain of the distribution into many short subintervals. Inside of these subintervals constant hat and squeeze functions are utilized. Thus it is easy to use the idea of immediate acceptance for points below the squeeze. This reduces the expected number of uniform random numbers per generated random variate to less than two. Using a large number of subintervals only little more than one random number is necessary on average. Thus this method becomes very fast. Due to the constant hat function this method only works for distributions with bounded domains. Thus for unbounded domains the left and right tails have to be cut off. This is no problem when the probability of falling into these tail regions is beyond computational relevance (e.g. smaller than ‘1.e-12’). For easy construction of hat and squeeze functions it is necessary to know the regions of monotonicity (called _slopes_) or equivalently all local maxima and minima of the density. The main problem for this method in the setup is the choice of the subintervals. A simple and close to optimal approach is the "equal area rule" [HLD04: Cha.5.1] . There the subintervals are selected such that the area below the hat is the same for each subinterval which can be realized with a simple recursion. If more subintervals are necessary it is possible to split either randomly chosen intervals (adaptive rejection sampling, ARS) or those intervals, where the ratio between squeeze and hat is smallest. This version of the setup is called derandomized ARS (DARS). With the default settings TABL is first calculating approximately 30 subintervals with the equal area rule. Then DARS is used till the desired fit of the hat is reached. A convenient measure to control the quality of the fit of hat and squeeze is the ratio (area below squeeze)/(area below hat) called ‘sqhratio’ which must be smaller or equal to one. The expected number of iterations in the rejection algorithm is known to be smaller than 1/sqhratio and the expected number of evaluations of the density is bounded by ‘1/sqhratio - 1’. So values of the sqhratio close to one (e.g. ‘0.95’ or ‘0.99’) lead to many subintervals. Thus a better fitting hat is constructed and the sampling algorithm becomes fast; on the other hand large tables are needed and the setup is very slow. For moderate values of sqhratio (e.g. ‘0.9’ or ‘0.8’) the sampling is slower but the required tables are smaller and the setup is not so slow. It follows from the above explanations that TABL is always requiring a slow setup and that it is not very well suited for heavy-tailed distributions. How To Use .......... For using the TABL method UNU.RAN needs a bounded interval to which the generated variates can be restricted and information about all local extrema of the distribution. For unimodal densities it is sufficient to provide the mode of the distribution. For the case of a built-in unimodal distribution with bounded domain all these information is present in the distribution object and thus no extra input is necessary (see example_TABL1 below). For a built-in unimodal distribution with unbounded domain we should specify the cut-off values for the tails. This can be done with the ‘unur_tabl_set_boundary’ call (see example_TABL2 below). For the case that we do not set these boundaries the default values of ‘+/- 1.e20’ are used. We can see in example_TABL1 that this still works fine for many standard distributions. For the case of a multimodal distribution we have to set the regions of monotonicity (called slopes) explicitly using the ‘unur_tabl_set_slopes’ command (see example_TABL3 below). To controll the fit of the hat and the size of the tables and thus the speed of the setup and the sampling it is most convenient to use the ‘unur_tabl_set_max_sqhratio’ call. The default is ‘0.9’ which is a sensible value for most distributions and applications. If very large samples of a distribution are required or the evaluation of a density is very slow it may be useful to increase the sqhratio to eg. ‘0.95’ or even ‘0.99’. With the ‘unur_tabl_get_sqhratio’ call we can check which sqhratio was really reached. If that value is below the desired value it is necessary to increase the maximal number of subintervals, which defaults to ‘1000’, using the ‘unur_tabl_set_max_intervals’ call. The ‘unur_tabl_get_n_intervals’ call can be used to find out the number of subintervals the setup calculated. It is also possible to set the number of intervals and their respective boundaries by means of the ‘unur_tabl_set_cpoints’ call. It is also possible to use method TABL for correlation induction (variance reduction) by setting of an auxiliary uniform random number generator via the ‘unur_set_urng_aux’ call. (Notice that this must be done after a possible ‘unur_set_urng’ call.) However, this only works when immediate acceptance is switched off by a ‘unur_tabl_set_variant_ia’ call. Function reference ------------------ -- Function: UNUR_PAR* unur_tabl_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_tabl_set_variant_ia (UNUR_PAR* PARAMETERS, int USE_IA) Use immediate acceptance when USE_IA is set to ‘TRUE’. This technique requires less uniform. If it is set to ‘FALSE’, “classical†acceptance/rejection from hat distribution is used. _Notice:_ Auxiliary uniform random number generators for correlation induction (variance reduction) can only be used when “classical†acceptance/rejection is used. Default: ‘TRUE’. -- Function: int unur_tabl_set_cpoints (UNUR_PAR* PARAMETERS, int N_CPOINTS, const DOUBLE* CPOINTS) Set construction points for the hat function. If STP is ‘NULL’ than a heuristic rule of thumb is used to get N_STP construction points. This is the default behavior. The default number of construction points is ‘30’. -- Function: int unur_tabl_set_nstp (UNUR_PAR* PARAMETERS, int N_STP) Set number of construction points for the hat function. N_STP must be greater than zero. After the setup there are about N_STP construction points. However it might be larger when a small fraction is given by the ‘unur_tabl_set_areafraction’ call. It also might be smaller for some variants. Default is ‘30’. -- Function: int unur_tabl_set_useear (UNUR_PAR* PARAMETERS, int USEEAR) If USEEAR is set to ‘TRUE’, the “equal area rule†is used, the given slopes are partitioned in such a way that the area below the hat function in each subinterval (“stripeâ€) has the same area (except the last the last interval which can be smaller). The area can be set by means of the ‘unur_tabl_set_areafraction’ call. Default is ‘TRUE’. -- Function: int unur_tabl_set_areafraction (UNUR_PAR* PARAMETERS, double FRACTION) Set parameter for the equal area rule. During the setup a piecewise constant hat is constructed, such that the area below each of these pieces (strips) is the same and equal to the (given) area below the PDF times FRACTION (which must be greater than zero). _Important:_ If the area below the PDF is not set in the distribution object, then 1 is assumed. Default is ‘0.1’. -- Function: int unur_tabl_set_usedars (UNUR_PAR* PARAMETERS, int USEDARS) If USEDARS is set to ‘TRUE’, “derandomized adaptive rejection sampling†(DARS) is used in the setup. Intervals, where the area between hat and squeeze is too large compared to the average area between hat and squeeze over all intervals, are split. This procedure is repeated until the ratio between squeeze and hat exceeds the bound given by ‘unur_tabl_set_max_sqhratio’ call or the maximum number of intervals is reached. Moreover, it also aborts when no more intervals can be found for splitting. For finding splitting points the arc-mean rule (a mixture of arithmetic mean and harmonic mean) is used. Default is ‘TRUE’. -- Function: int unur_tabl_set_darsfactor (UNUR_PAR* PARAMETERS, double FACTOR) Set factor for “derandomized adaptive rejection samplingâ€. This factor is used to determine the segments that are “too largeâ€, that is, all segments where the area between squeeze and hat is larger than FACTOR times the average area over all intervals between squeeze and hat. Notice that all segments are split when FACTOR is set to ‘0.’, and that there is no splitting at all when FACTOR is set to ‘UNUR_INFINITY’. Default is ‘0.99’. There is no need to change this parameter. -- Function: int unur_tabl_set_variant_splitmode (UNUR_PAR* PARAMETERS, unsigned SPLITMODE) There are three variants for adaptive rejection sampling. These differ in the way how an interval is split: splitmode ‘1’ use the generated point to split the interval. splitmode ‘2’ use the mean point of the interval. splitmode ‘3’ use the arcmean point; suggested for distributions with heavy tails. Default is splitmode ‘2’. -- Function: int unur_tabl_set_max_sqhratio (UNUR_PAR* PARAMETERS, double MAX_RATIO) Set upper bound for the ratio (area below squeeze) / (area below hat). It must be a number between 0 and 1. When the ratio exceeds the given number no further construction points are inserted via DARS in the setup. For the case of ARS (unur_tabl_set_usedars() must be set to ‘FALSE’): Use ‘0’ if no construction points should be added after the setup. Use ‘1’ if added new construction points should not be stopped until the maximum number of construction points is reached. If MAX_RATIO is close to one, many construction points are used. Default is ‘0.9’. -- Function: double unur_tabl_get_sqhratio (const UNUR_GEN* GENERATOR) Get the current ratio (area below squeeze) / (area below hat) for the generator. (In case of an error ‘UNUR_INFINITY’ is returned.) -- Function: double unur_tabl_get_hatarea (const UNUR_GEN* GENERATOR) Get the area below the hat for the generator. (In case of an error ‘UNUR_INFINITY’ is returned.) -- Function: double unur_tabl_get_squeezearea (const UNUR_GEN* GENERATOR) Get the area below the squeeze for the generator. (In case of an error ‘UNUR_INFINITY’ is returned.) -- Function: int unur_tabl_set_max_intervals (UNUR_PAR* PARAMETERS, int MAX_IVS) Set maximum number of intervals. No construction points are added in or after the setup when the number of intervals suceeds MAX_IVS. Default is ‘1000’. -- Function: int unur_tabl_get_n_intervals (const UNUR_GEN* GENERATOR) Get the current number of intervals. (In case of an error 0 is returned.) -- Function: int unur_tabl_set_slopes (UNUR_PAR* PARAMETERS, const DOUBLE* SLOPES, int N_SLOPES) Set slopes for the PDF. A slope is an interval [a,b] or [b,a] where the PDF is monotone and PDF(a) >= PDF(b). The list of slopes is given by an array SLOPES where each consecutive tuple (i.e. ‘(slopes[0], slopes[1])’, ‘(slopes[2], slopes[3])’, etc.) defines one slope. Slopes must be sorted (i.e. both ‘slopes[0]’ and ‘slopes[1]’ must not be greater than any entry of the slope ‘(slopes[2], slopes[3])’, etc.) and must not be overlapping. Otherwise no slopes are set and UNUR_ERRNO is set to ‘UNUR_ERR_PAR_SET’. _Notice:_ N_SLOPES is the number of slopes (and not the length of the array SLOPES). _Notice_ that setting slopes resets the given domain for the distribution. However, in case of a standard distribution the area below the PDF is not updated. -- Function: int unur_tabl_set_guidefactor (UNUR_PAR* PARAMETERS, double FACTOR) Set factor for relative size of the guide table for indexed search (see also method DGT *note DGT::). It must be greater than or equal to ‘0’. When set to ‘0’, then sequential search is used. Default is ‘1’. -- Function: int unur_tabl_set_boundary (UNUR_PAR* PARAMETERS, double LEFT, double RIGHT) Set the left and right boundary of the computation interval. The piecewise hat is only constructed inside this interval. The probability outside of this region must not be of computational relevance. Of course ‘+/- UNUR_INFINITY’ is not allowed. Default is ‘-1.e20,1.e20’. -- Function: int unur_tabl_chg_truncated (UNUR_GEN* GEN, double LEFT, double RIGHT) Change the borders of the domain of the (truncated) distribution. Notice that the given truncated domain must be a subset of the domain of the given distribution. The generator always uses the intersection of the domain of the distribution and the truncated domain given by this call. The hat function will not be changed. _Important:_ The ratio between the area below the hat and the area below the squeeze changes when the sampling region is restricted. In particalur it becomes (very) large when sampling from the (far) tail of the distribution. Then it is better to create a generator object for the tail of distribution only. _Important:_ This call does not work for variant ‘IA’ (immediate acceptance). In this case UNU.RAN switches _automatically_ to variant ‘RH’ (use “classical†acceptance/rejection from hat distribution) and does revert to the variant originally set by the user. _Important:_ It is not a good idea to use adaptave rejection sampling while sampling from a domain that is a strict subset of the domain that has been used to construct the hat. For that reason adaptive adding of construction points is _automatically disabled_ by this call. _Important:_ If the CDF of the hat is (almost) the same for LEFT and RIGHT and (almost) equal to ‘0’ or ‘1’, then the truncated domain is not changed and the call returns an error code. -- Function: int unur_tabl_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) -- Function: int unur_tabl_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) Turn verifying of algorithm while sampling on/off. If the condition squeeze(x) <= PDF(x) <= hat(x) is violated for some x then ‘unur_errno’ is set to ‘UNUR_ERR_GEN_CONDITION’. However notice that this might happen due to round-off errors for a few values of x (less than 1%). Default is ‘FALSE’. -- Function: int unur_tabl_set_pedantic (UNUR_PAR* PARAMETERS, int PEDANTIC) Sometimes it might happen that ‘unur_init’ has been executed successfully. But when additional construction points are added by adaptive rejection sampling, the algorithm detects that the PDF is not monotone in the given slopes. With PEDANTIC being ‘TRUE’, the sampling routine is exchanged by a routine that simply returns ‘UNUR_INFINITY’ indicating an error. Default is ‘FALSE’. 5.3.16 TDR – Transformed Density Rejection ------------------------------------------ Required: T-concave PDF, dPDF Optional: mode Speed: Set-up: slow, Sampling: fast Reinit: supported Reference: [GWa92] [HWa95] [HLD04: Cha.4] TDR is an acceptance/rejection method that uses the concavity of a transformed density to construct hat function and squeezes automatically. Such PDFs are called T-concave. Currently the following transformations are implemented and can be selected by setting their ‘c’-values by a ‘unur_tdr_set_c’ call: ‘c = 0’ T(x) = log(x) ‘c = -0.5’ T(x) = -1/sqrt(x) (Default) In future releases the transformations T(x) = -(x)^c will be available for any c with 0 > c > -1. Notice that if a PDF is T-concave for a c then it also T-concave for every c’ /* ------------------------------------------------------------- */ /* Example how to sample from an empirial continuous univariate */ /* distribution. */ /* ------------------------------------------------------------- */ int main(void) { int i; double x; /* data points */ double data[15] = { -0.1, 0.05, -0.5, 0.08, 0.13,\ -0.21,-0.44, -0.43, -0.33, -0.3, \ 0.18, 0.2, -0.37, -0.29, -0.9 }; /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Create a distribution object and set empirical sample. */ distr = unur_distr_cemp_new(); unur_distr_cemp_set_data(distr, data, 15); /* Choose a method: EMPK. */ par = unur_empk_new(distr); /* Set smooting factor. */ unur_empk_set_smoothing(par, 0.8); /* Create the generator object. */ gen = unur_init(par); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ Example (String API) -------------------- /* ------------------------------------------------------------- */ /* File: example_emp_str.c */ /* ------------------------------------------------------------- */ /* String API. */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* Example how to sample from an empirial continuous univariate */ /* distribution. */ /* ------------------------------------------------------------- */ int main(void) { int i; double x; /* Declare UNURAN generator object. */ UNUR_GEN *gen; /* generator object */ /* Create the generator object. */ gen = unur_str2gen("distr = cemp; \ data=(-0.10, 0.05,-0.50, 0.08, 0.13, \ -0.21,-0.44,-0.43,-0.33,-0.30, \ 0.18, 0.20,-0.37,-0.29,-0.90) & \ method=empk; smoothing=0.8"); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ 5.4.1 EMPK – EMPirical distribution with Kernel smoothing --------------------------------------------------------- Required: observed sample Speed: Set-up: slow (as sample is sorted), Sampling: fast (depends on kernel) Reinit: not implemented Reference: [HLa00] [HLD04: Sect.12.1.2] EMPK generates random variates from an empirical distribution that is given by an observed sample. The idea is that simply choosing a random point from the sample and to return it with some added noise results in a method that has very nice properties, as it can be seen as sampling from a kernel density estimate. If the underlying distribution is continuous, especially the fine structur of the resulting empirical distribution is much better than using only resampling without noise. Clearly we have to decide about the density of the noise (called kernel) and about the standard deviation of the noise. The mathematical theory of kernel density estimation shows us that we are comparatively free in choosing the kernel. It also supplies us with a simple formula to compute the optimal standarddeviation of the noise, called bandwidth (or window width) of the kernel. The variance of the estimated density is slightly larger than that of the observed sample. However, this can be easily corrected if required. There is also a correction (mirroring technique) for distributions with non-negative support. A simple robust reference method is implemented to find a good standard deviation of the noise (i.e. the bandwidth of kernel density estimation). For some cases (e.g. densities with two or more sharp distinct peaks) there kernel density estimation can be adjusted by changing the smoothness factor and the so called beta factor. How To Use .......... EMPK uses empirical distributions. The main parameter is the choice if of kernel density. The most important kernels can be set by ‘unur_empk_set_kernel’. Additionally generators for other kernels can be used by using ‘unur_empk_set_kernelgen’ instead. Additionally variance correction and a correction for non-negative variates can be switched on. The two other parameters (smoothing factor and beta factor) are only useful for people knowing the theory of kernel density estimation. It is not necessary to change them if the true underlying distribution is somehow comparable with a bell-shaped curve, even skewed or with some not too sharp extra peaks. In all these cases the simple robust reference method implemented to find a good standard deviation of the noise (i.e. the bandwidth of kernel density estimation) should give sensible results. However, it might be necessary to overwrite this automatic method to find the bandwidth eg. when resampling from data with two or more sharp distinct peaks. Then the distribution has nearly discrete components as well and our automatic method may easily choose too large a bandwidth which results in an empirical distribution which is oversmoothed (i.e. it has lower peaks than the original distribution). Then it is recommended to decrease the bandwidth using the ‘unur_empk_set_smoothing’ call. A smoothing factor of ‘1’ is the default. A smoothing factor of ‘0’ leads to naive resampling of the data. Thus an appropriate value between these extremes should be choosen. We recommend to consult a reference on kernel smoothing when doing so; but it is not a simple problem to determine an optimal bandwidth for distributions with sharp peaks. In general, for most applications it is perfectly ok to use the default values offered. Unless you have some knowledge on density estimation we do not recommend to change anything. There are two exceptions: A. In the case that the unknown underlying distribution is not continuous but discrete you should "turn off" the adding of the noise by setting: unur_empk_set_smoothing(par, 0.) B. In the case that you are especially interested in a fast sampling algorithm use the call unur_empk_set_kernel(par, UNUR_DISTR_BOXCAR); to change the used noise distribution from the default Gaussian distribution to the uniform distribution. Function reference ------------------ -- Function: UNUR_PAR* unur_empk_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_empk_set_kernel (UNUR_PAR* PARAMETERS, unsigned KERNEL) Select one of the supported kernel distributions. Currently the following kernels are supported: ‘UNUR_DISTR_GAUSSIAN’ Gaussian (normal) kernel ‘UNUR_DISTR_EPANECHNIKOV’ Epanechnikov kernel ‘UNUR_DISTR_BOXCAR’ Boxcar (uniform, rectangular) kernel ‘UNUR_DISTR_STUDENT’ t3 kernel (Student’s distribution with 3 degrees of freedom) ‘UNUR_DISTR_LOGISTIC’ logistic kernel For other kernels (including kernels with Student’s distribution with other than 3 degrees of freedom) use the ‘unur_empk_set_kernelgen’ call. It is not possible to call ‘unur_empk_set_kernel’ twice. Default is the Gaussian kernel. -- Function: int unur_empk_set_kernelgen (UNUR_PAR* PARAMETERS, const UNUR_GEN* KERNELGEN, double ALPHA, double KERNELVAR) Set generator for the kernel used for density estimation. ALPHA is used to compute the optimal bandwidth from the point of view of minimizing the mean integrated square error (MISE). It depends on the kernel K and is given by alpha(K) = Var(K)^(-2/5){ \int K(t)^2 dt}^(1/5) For standard kernels (see above) alpha is computed by the algorithm. KERNVAR is the variance of the used kernel. It is only required for the variance corrected version of density estimation (which is used by default); otherwise it is ignored. If KERNELVAR is nonpositive, variance correction is disabled. For standard kernels (see above) KERNVAR is computed by the algorithm. It is not possible to call ‘unur_empk_set_kernelgen’ after a standard kernel has been selected by a ‘unur_empk_set_kernel’ call. Notice that the uniform random number generator of the kernel generator is overwritten during the ‘unur_init’ call and at each ‘unur_chg_urng’ call with the uniform generator used for the empirical distribution. Default is the Gaussian kernel. -- Function: int unur_empk_set_beta (UNUR_PAR* PARAMETERS, double BETA) BETA is used to compute the optimal bandwidth from the point of view of minimizing the mean integrated square error (MISE). BETA depends on the (unknown) distribution of the sampled data points. By default Gaussian distribution is assumed for the sample (BETA = 1.3637439). There is no requirement to change BETA. Default: ‘1.3637439’ -- Function: int unur_empk_set_smoothing (UNUR_PAR* PARAMETERS, double SMOOTHING) -- Function: int unur_empk_chg_smoothing (UNUR_GEN* GENERATOR, double SMOOTHING) Set and change the smoothing factor. The smoothing factor controlles how “smooth†the resulting density estimation will be. A smoothing factor equal to ‘0’ results in naive resampling. A very large smoothing factor (together with the variance correction) results in a density which is approximately equal to the kernel. Default is 1 which results in a smoothing parameter minimising the MISE (mean integrated squared error) if the data are not too far away from normal. If a large smoothing factor is used, then variance correction must be switched on. Default: ‘1’ -- Function: int unur_empk_set_varcor (UNUR_PAR* PARAMETERS, int VARCOR) -- Function: int unur_empk_chg_varcor (UNUR_GEN* GENERATOR, int VARCOR) Switch variance correction in generator on/off. If VARCOR is ‘TRUE’ then the variance of the used density estimation is the same as the sample variance. However this increases the MISE of the estimation a little bit. Default is ‘FALSE’. -- Function: int unur_empk_set_positive (UNUR_PAR* PARAMETERS, int POSITIVE) If POSITIVE is ‘TRUE’ then only nonnegative random variates are generated. This is done by means of a mirroring technique. Default is ‘FALSE’. 5.4.2 EMPL – EMPirical distribution with Linear interpolation ------------------------------------------------------------- Required: observed sample Speed: Set-up: slow (as sample is sorted), Sampling: very fast (inversion) Reinit: not implemented Reference: [HLa00] [HLD04: Sect.12.1.3] EMPL generates random variates from an empirical distribution that is given by an observed sample. This is done by linear interpolation of the empirical CDF. Although this method is suggested in the books of Law and Kelton (2000) and Bratly, Fox, and Schrage (1987) we do not recommend this method at all since it has many theoretical drawbacks: The variance of empirical distribution function does not coincide with the variance of the given sample. Moreover, when the sample increases the empirical density function does not converge to the density of the underlying random variate. Notice that the range of the generated point set is always given by the range of the given sample. This method is provided in UNU.RAN for the sake of completeness. We always recommend to use method EMPK (*note EMPirical distribution with Kernel smoothing: EMPK.). If the data seem to be far away from having a bell shaped histogram, then we think that naive resampling is still better than linear interpolation. How To Use .......... EMPL creates and samples from an empiral distribution by linear interpolation of the empirical CDF. There are no parameters to set. _Important_: We do not recommend to use this method! Use method EMPK (*note EMPirical distribution with Kernel smoothing: EMPK.) instead. Function reference ------------------ -- Function: UNUR_PAR* unur_empl_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. 5.4.3 HIST – HISTogramm of empirical distribution ------------------------------------------------- Required: histogram Speed: Set-up: moderate, Sampling: fast Reinit: not implemented Method HIST generates random variates from an empirical distribution that is given as histogram. Sampling is done using the inversion method. If observed (raw) data are provided we recommend method EMPK (*note EMPirical distribution with Kernel smoothing: EMPK.) instead of compting a histogram as this reduces information. How To Use .......... Method HIST uses empirical distributions that are given as a histgram. There are no optional parameters. Function reference ------------------ -- Function: UNUR_PAR* unur_hist_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. 5.5 Methods for continuous multivariate distributions ===================================================== Overview of methods ------------------- Methods for continuous multivariate distributions sample with ‘unur_sample_vec’ NORTA: Requires rank correlation matrix and marginal distributions. VNROU: Requires the PDF. MVSTD: Generator for built-in standard distributions. MVTDR: Requires PDF and gradiant of PDF. 5.5.1 MVSTD – MultiVariate continuous STandarD distributions ------------------------------------------------------------ Required: standard distribution from UNU.RAN library (*note Standard distributions: Stddist.). Speed: depends on distribution and generator Reinit: supported MVSTD is a wrapper for special generators for multivariate continuous standard distributions. It only works for distributions in the UNU.RAN library of standard distributions (*note Standard distributions: Stddist.). If a distribution object is provided that is build from scratch, or if no special generator for the given standard distribution is provided, the ‘NULL’ pointer is returned. How To Use .......... Create a distribution object for a standard distribution from the UNU.RAN library (*note Standard distributions: Stddist.). Sampling from truncated distributions (which can be constructed by changing the default domain of a distribution by means of ‘unur_distr_cvec_set_domain_rect’ call) is not possible. It is possible to change the parameters and the domain of the chosen distribution and run ‘unur_reinit’ to reinitialize the generator object. Function reference ------------------ -- Function: UNUR_PAR* unur_mvstd_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for new generator. It requires a distribution object for a multivariate continuous distribution from the UNU.RAN library of standard distributions (*note Standard distributions: Stddist.). Using a truncated distribution is not possible. 5.5.2 MVTDR – Multi-Variate Transformed Density Rejection --------------------------------------------------------- Required: log-concave (log)PDF, gradient of (log)PDF Optional: mode Speed: Set-up: slow, Sampling: depends on dimension Reinit: not implemented Reference: [HLD04: Sect.11.3.4; Alg.11.15.] [LJa98] MVTDR a multivariate version of the Transformed Density Rection (*note TDR::) that works for log-concave densities. For this method the domain of the distribution is partitioned into cones with the mode (or the center) of the distribution as their (common) vertex. The hat function is then constructed as tangent planes of the transformed density in each of these cones. The respective construction points lie on the central lines in the cones through the vertex. The point is chosen such that the hat is minimal among all such points (see the given references for more details). The cones are created by starting with the orthants of the reals space. These are then iteratively split when the volume below the hat in such cones is too large. Thus an increasing number of cones results in a better fitting hat function. Notice however, that the required number of cones increases exponentially with the number of dimension. Moreover, due to the construction the rejection does not converge to 1 and remains strictly larger than 1. For distributions with bounded domains the cones are cut to pyramids that cover the domain. How To Use .......... Create a multivariate generator object that contains the PDF and its gradient. This object also should contain the mode of the distribution (or a point nearby should be provided as center of the distribution). The method has three parameter to adjust the method for the given distribution: ‘stepsmin’ Minimal number of iterations for splitting cones. Notice that we start with 2^dim initial cones and that we arrive at 2^(dim+stepsmin) cones after these splits. So this number must be set with care. It can be set by a ‘unur_mvtdr_set_stepsmin’ call. ‘boundsplitting’ Cones where the volume below the hat is relatively large (i.e. larger than the average volume over all cones times ‘boundsplitting’ are further split. This parameter can set via a ‘unur_mvtdr_set_boundsplitting’ call. ‘maxcones’ The maximum number of generated cones. When this number is reached, the initialization routine is stopped. Notice that the rejection constant can be still prohibitive large. This parameter can set via a ‘unur_mvtdr_set_maxcones’ call. Setting of these parameter can be quite tricky. The default settings lead to hat functions where the volume below the hat is similar in each cone. However, there might be some problems with distributions with higher correlations, since then too few cones are created. Then it might be necessary to increase the values for ‘stepsmin’ and ‘maxcones’ and to set ‘boundsplitting’ to ‘0’. The number of cones and the total volume below the hat can be controlled using the respective calls ‘unur_mvtdr_get_ncones’ and ‘unur_mvtdr_get_hatvol’. Notice, that the rejection constant is bounded from below by some figure (larger than 1) that depends on the dimension. Unfortunately, the algorithm cannot detect the quality of the constructed hat. Function reference ------------------ -- Function: UNUR_PAR* unur_mvtdr_new (const UNUR_DISTR* DISTRIBUTION) Get parameters for generator. -- Function: int unur_mvtdr_set_stepsmin (UNUR_PAR* PARAMETERS, int STEPSMIN) Set minimum number of triangulation step for each starting cone. STEPSMIN must be nonnegative. Default: ‘5’. -- Function: int unur_mvtdr_set_boundsplitting (UNUR_PAR* PARAMETERS, double BOUNDSPLITTING) Set bound for splitting cones. All cones are split which have a volume below the hat that is greater than BOUND_SPLITTING times the average over all volumes. However, the number given by the ‘unur_mvtdr_set_maxcones’ is not exceeded. Notice that the later number is always reached if BOUND_SPLITTING is less than 1. Default: ‘1.5’ -- Function: int unur_mvtdr_set_maxcones (UNUR_PAR* PARAMETERS, int MAXCONES) Set maximum number of cones. Notice that this number is always increased to 2^(dim+stepsmin) where dim is the dimension of the distribution object and stepsmin the given mimimum number of triangulation steps. Notice: For higher dimensions and/or higher correlations between the coordinates of the random vector the required number of cones can be very high. A too small maximum number of cones can lead to a very high rejection constant. Default: ‘10000’. -- Function: int unur_mvtdr_get_ncones (const UNUR_GEN* GENERATOR) Get the number of cones used for the hat function of the GENERATOR. (In case of an error ‘0’ is returned.) -- Function: double unur_mvtdr_get_hatvol (const UNUR_GEN* GENERATOR) Get the volume below the hat for the GENERATOR. (In case of an error ‘UNUR_INFINITY’ is returned.) -- Function: int unur_mvtdr_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) -- Function: int unur_mvtdr_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) Turn verifying of algorithm while sampling on/off. If the condition squeeze(x) <= PDF(x) <= hat(x) is violated for some x then ‘unur_errno’ is set to ‘UNUR_ERR_GEN_CONDITION’. However notice that this might happen due to round-off errors for a few values of x (less than 1%). Default is ‘FALSE’. 5.5.3 NORTA – NORmal To Anything -------------------------------- Required: rank correlation matrix, marginal distributions Speed: Set-up: slow, Sampling: depends on dimension Reinit: not implemented Reference: [HLD04: Sect.12.5.2; Alg.12.11.] NORTA (NORmal to anything) is a model to get random vectors with given marginal distributions and rank correlation. *Important:* Notice that marginal distribution and (rank) correlation structure do not uniquely define a multivariate distribution. Thus there are many other (more or less sensible) models. In the NORTA model multinormal random variates with the given (Spearman’s) rank correlations are generated. In a second step the (standard normal distributed) marginal variates are transformed by means of the CDF of the normal distribution to get uniform marginals. The resulting random vectors have uniform marginals and the desired rank correlation between its components. Such a random vector is called ’copula’. By means of the inverse CDF the uniform marginals are then transformed into the target marginal distributions. This transformation does not change the rank correlation. For the generation of the multinormal distribution the (Spearman’s) rank correlation matrix is transformed into the corresponding (Pearson) correlation matrix. Samples from the resulting multinormal distribution are generated by means of the Cholesky decomposition of the covariance matrix. It can happen that the desired rank correlation matrix is not feasible, i.e., it cannot occur as rank correlation matrix of a multinormal distribution. The resulting "covariance" matrix is not positive definite. In this case an eigenvector correction method is used. Then all non-positive eigenvalues are set to a small positive value and hence the rank correlation matrix of the generated random vectors is "close" to the desired matrix. How To Use .......... Create a multivariate generator object and set marginal distributions using ‘unur_distr_cvec_set_marginals’, ‘unur_distr_cvec_set_marginal_array’ , or ‘unur_distr_cvec_set_marginal_list’. (Do not use the corresponding calls for the standard marginal distributions). When the domain of the multivariate distribution is set by of a ‘unur_distr_cvec_set_domain_rect’ call then the domain of each of the marginal distributions is truncated by the respective coordinates of the given rectangle. If copulae are required (i.e. multivariate distributions with uniform marginals) such a generator object can be created by means of ‘unur_distr_copula’ . There are no optional parameters for this method. Function reference ------------------ -- Function: UNUR_PAR* unur_norta_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. 5.5.4 VNROU – Multivariate Naive Ratio-Of-Uniforms method --------------------------------------------------------- Required: PDF Optional: mode, center, bounding rectangle for acceptance region Speed: Set-up: fast or slow, Sampling: slow Reinit: supported Reference: [WGS91] VNROU is an implementation of the multivariate ratio-of-uniforms method which uses a (minimal) bounding hyper-rectangle, see also *note Ratio-of-Uniforms::. It uses an additional parameter r that can be used for adjusting the algorithm to the given distribution to improve performance and/or to make this method applicable. Larger values of r increase the class of distributions for which the method works at the expense of higher rejection constants. Moreover, this implementation uses the center mu of the distribution (which is set to the mode or mean by default, see ‘unur_distr_cvec_get_center’ for details of its default values). The minimal bounding has then the coordinates v^+ = sup_(x) (f(x))^(1/r d+1), u^-_i = inf_(x_i) (x_i- mu_i) (f(x))^(r/r d+1), u^+_i = sup_(x_i) (x_i- mu_i) (f(x))^(r/r d+1), where x_i is the i-th coordinate of point x; mu_i is the i-th coordinate of the center mu. d denotes the dimension of the distribution. These bounds can either be given directly, or are computed automatically by means of an numerical routine by Hooke and Jeeves [HJa61] called direct search (see ‘src/utils/hooke.c’ for further references and details). Of course this algorithm can fail, especially when this rectangle is not bounded. It is important to note that the algorithm works with PDF(x-center) instead of PDF(x), i.e. the bounding rectangle has to be provided for PDF(x-center). This is important as otherwise the acceptance region can become a very long and skinny ellipsoid along a diagonal of the (huge) bounding rectangle. VNROU is based on the rejection method (*note Rejection::), and it is important to note that the acceptance probability decreases exponentially with dimension. Thus even for moderately many dimensions (e.g. 5) the number of repetitions to get one random vector can be prohibitively large and the algorithm seems to stay in an infinite loop. How To Use .......... For using the VNROU method UNU.RAN needs the PDF of the distribution. Additionally, the parameter r can be set via a ‘unur_vnrou_set_r’ call. Notice that the acceptance probability decreases when r is increased. On the other hand is is more unlikely that the bounding rectangle does not exist if r is small. A bounding rectangle can be given by the ‘unur_vnrou_set_u’ and ‘unur_vnrou_set_v’ calls. _Important:_ The bounding rectangle has to be provided for the function PDF(x-center)! Notice that ‘center’ is the center of the given distribution, see ‘unur_distr_cvec_set_center’. If in doubt or if this value is not optimal, it can be changed (overridden) by a ‘unur_distr_cvec_set_center’ call. If the coordinates of the bounding rectangle are not provided by the user then the minimal bounding rectangle is computed automatically. By means of ‘unur_vnrou_set_verify’ and ‘unur_vnrou_chg_verify’ one can run the sampling algorithm in a checking mode, i.e., in every cycle of the rejection loop it is checked whether the used rectangle indeed enclosed the acceptance region of the distribution. When in doubt (e.g., when it is not clear whether the numerical routine has worked correctly) this can be used to run a small Monte Carlo study. *Important:* The rejection constant (i.e. the expected number of iterations for generationg one random vector) can be extremely high, in particular when the dimension is 4 or higher. Then the algorithm will perform almost infinite loops. Thus it is recommended to read the volume below the hat function by means of the ‘unur_vnrou_get_volumehat’ call. The returned number divided by the volume below the PDF (which is 1 in case of a normalized PDF) gives the rejection constant. It is possible to change the parameters and the domain of the chosen distribution and run ‘unur_reinit’ to reinitialize the generator object. Notice, that the coordinates of a bounding rectangle given by ‘unur_vnrou_set_u’ and ‘unur_vnrou_set_v’ calls are used also when the generator is reused. These can be changed by means of ‘unur_vnrou_chg_u’ and ‘unur_vnrou_chg_v’ calls. (If no such coordinates have been given, then they are computed numerically during the reinitialization proceedure.) Function reference ------------------ -- Function: UNUR_PAR* unur_vnrou_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_vnrou_set_u (UNUR_PAR* PARAMETERS, double* UMIN, double* UMAX) Sets left and right boundaries of bounding hyper-rectangle. If no values are given, the boundary of the minimal bounding hyper-rectangle is computed numerically. *Important*: The boundaries are those of the density shifted by the center of the distribution, i.e., for the function PDF(x-center)! _Notice_: Computing the minimal bounding rectangle may fail under some circumstances. Moreover, for multimodal distributions the bounds might be too small as only local extrema are computed. Nevertheless, for log-concave distributions it should work. Default: not set (i.e. computed automatically) -- Function: int unur_vnrou_chg_u (UNUR_GEN* GENERATOR, double* UMIN, double* UMAX) Change left and right boundaries of bounding hyper-rectangle. -- Function: int unur_vnrou_set_v (UNUR_PAR* PARAMETERS, double VMAX) Set upper boundary for bounding hyper-rectangle. If no values are given, the density at the mode is evaluated. If no mode is given for the distribution it is computed numerically (and might fail). Default: not set (i.e. computed automatically) -- Function: int unur_vnrou_chg_v (UNUR_GEN* GENERATOR, double VMAX) Change upper boundary for bounding hyper-rectangle. -- Function: int unur_vnrou_set_r (UNUR_PAR* PARAMETERS, double R) Sets the parameter R of the generalized multivariate ratio-of-uniforms method. _Notice_: This parameter must satisfy R>0. Default: ‘1’. -- Function: int unur_vnrou_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) Turn verifying of algorithm while sampling on/off. If the condition PDF(x) <= hat(x) is violated for some x then ‘unur_errno’ is set to ‘UNUR_ERR_GEN_CONDITION’. However notice that this might happen due to round-off errors for a few values of x (less than 1%). Default is ‘FALSE’. -- Function: int unur_vnrou_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) Change the verifying of algorithm while sampling on/off. -- Function: double unur_vnrou_get_volumehat (const UNUR_GEN* GENERATOR) Get the volume of below the hat. For normalized densities, i.e. when the volume below PDF is 1, this value equals the rejection constant for the vnrou method. In case of an error UNUR_INFINITY is returned. 5.6 Markov chain samplers for continuous multivariate distributions =================================================================== Markov chain samplers generate sequences of random vectors which have the target distribution as stationary distribution. There generated vectors are (more or less) correlated and it might take a long time until the sequence has converged to the given target distribution. *Beware: MCMC sampling can be dangerous!* Overview of methods ------------------- Markov Chain Methods for continuous multivariate distributions sample with ‘unur_sample_vec’ GIBBS: T-concave logPDF and derivatives of logPDF. HITRO: Requires PDF. 5.6.1 GIBBS – Markov Chain - GIBBS sampler ------------------------------------------ Required: T-concave logPDF, derivatives of logPDF Speed: Set-up: fast, Sampling: moderate Reinit: not implemented Reference: [HLD04: Sect.14.1.2] Method GIBBS implements a Gibbs sampler for a multivariate distribution with given joint density and its gradient. When running such a Markov chain all coordinates are updated cyclically using full conditional distributions. After each step the state of the chain is returned (i.e., a random point is returned whenever a single coordinate has been updated). It is also possible to return only points after all coordinates have been updated by "thinning" the chain. Moreover, to reduce autocorrelation this thinning factor can be any integer. Notice, however, that the sampling time for a chain of given length is increased by the same factor, too. GIBBS also provides a variant of the Gibbs sampler where in each step a point from the full conditional distribution along some random direction is sampled. This direction is chosen uniformly from the sphere in each step. This method is also known as Hit-and-Run algorithm for non-uniform distributions. Our experiences shows that the original Gibbs sampler with sampling along coordinate axes is superior to random direction sampling as long as the correlations between the components of the random vector are not too high. For both variants transformed density rejection (see methods *note TDR:: and *note ARS::) is used to sample from the full conditional distributions. In opposition to the univariate case, it is important that the factor ‘c’ is as large as possible. I.e., for a log-concave density ‘c’ must be set to ‘0.’, since otherwise numerical underflow might stop the algorithm. _Important:_ GIBBS does not generate independent random points. The starting point of the Gibbs chain must be in a "typical" region of the target distribution. If such a point is not known or would be too expensive, then the first part of the chain should be discarded (burn-in of the chain). How To Use .......... For using the GIBBS method UNU.RAN needs the logarithm of the PDF of the multivariate joint distribution and its gradient or partial derivatives. It provides two variants: _coordinate direction sampling (Gibbs sampling) [default]_ The coordinates are updated cyclically. It requires the partial derivatives of the (logarithm of the) PDF of the target distribution, see ‘unur_distr_cvec_set_pdlogpdf’. Otherwise, the gradient of the logPDF (see ‘unur_distr_cvec_set_dlogpdf’ ) is used, which is more expensive. This variant can be selected using ‘unur_gibbs_set_variant_coordinate’. _random direction sampling (nonuniform Hit-and-Run algorithm)_ In each step is a direction is sampled uniformly from the sphere and the next point in the chain is sampled from the full conditional distribution along this direction. It requires the gradient of the logPDF and thus each step is more expensive than each step for coordinate direction sampling. This variant can be selected using ‘unur_gibbs_set_variant_random_direction’. It is important that the ‘c’ parameter for the TDR method is as large as possible. For logconcave distribution it must be set to ‘0’, since otherwise numerical underflow can cause the algorithm to stop. The starting point of the Gibbs chain must be "typical" for the target distribution. If such a point is not known or would be too expensive, then the first part of the chain should be discarded (burn-in of the chain). When using the ‘unur_gibbs_set_burnin’ call this is done during the setup of the Gibbs sampler object. In case of a fatal error in the generator for conditional distributions the methods generates points that contain UNUR_INFINITY. *Warning:* The algorithm requires that all full conditionals for the given distribution object are T-concave. However, this property is not checked. If this property is not satisfied, then generation from the conditional distributions becomes (very) slow and might fail or (even worse) produces random vectors from an incorrect distribution. When using ‘unur_gibbs_set_burnin’ then the setup already might fail. Thus when in doubt whether GIBBS can be used for the targent distribution it is a good idea to use a burn-in for checking. _Remark:_ It might happen (very rarely) that the chain becomes stuck due to numerical errors. (This is in particular the case when the given PDF does not fulfill the condition of this method.) When this happens during burn-in then the setup is aborted (i.e. it fails). Otherwise the chain restarts again from its starting point. *Warning:* Be carefull with debugging flags. If it contains flag ‘0x01000000u’ it produces a lot of output for each step in the algorithm. (This flag is switched of in the default debugging flags). Function reference ------------------ -- Function: UNUR_PAR* unur_gibbs_new (const UNUR_DISTR* DISTRIBUTION) ........................................................................... -- Function: int unur_gibbs_set_variant_coordinate (UNUR_PAR* PARAMETERS) Coordinate Direction Sampling: Sampling along the coordinate directions (cyclic). This is the default. -- Function: int unur_gibbs_set_variant_random_direction (UNUR_PAR* PARAMETERS) Random Direction Sampling: Sampling along the random directions. -- Function: int unur_gibbs_set_c (UNUR_PAR* PARAMETERS, double C) Set parameter C for transformation T of the transformed density rejection method. Currently only values between ‘0’ and ‘-0.5’ are allowed. If ‘c’ is between ‘0’ and ‘-0.5’ it is set to ‘-0.5’. For C ‘=0’ (for logconcave densities) method ARS (*note ARS::) is used which is very robust against badly normalized PDFs. For other values method TDR (*note TDR::) is used. The value for C should be as large as possible to avoid fatal numerical underflows. Thus for log-concave distributions C must be set to ‘0.’ Default is ‘0’. -- Function: int unur_gibbs_set_startingpoint (UNUR_PAR* PARAMETERS, const DOUBLE* X0) Sets the starting point of the Gibbs sampler. X0 must be a "typical" point of the given distribution. If such a "typical" point is not known and a starting point is merely guessed, the first part of the Gibbs chain should be discarded (_burn-in_), e.g.\ by mean of the ‘unur_gibbs_set_burnin’ call. Default is the result of ‘unur_distr_cvec_get_center’ for the given distribution object. -- Function: int unur_gibbs_set_thinning (UNUR_PAR* PARAMETERS, int THINNING) Sets the THINNING parameter. When THINNING is set to k then every k-th point from the iteration is returned by the sampling algorithm. _Notice_: This parameter must satisfy THINNING>=1. Default: ‘1’. -- Function: int unur_gibbs_set_burnin (UNUR_PAR* PARAMETERS, int BURNIN) If a "typical" point for the target distribution is not known but merely guessed, the first part of the Gibbs chain should be discarded (_burn-in_). This can be done during the initialization of the generator object. The length of the burn-in can is then BURNIN. When method GIBBS is not applicable for the target distribution then the initialization already might fail during the burn-in. Thus this reduces the risk of running a generator that returns UNUR_INFINITY cased by some fatal error during sampling. The thinning factor set by a ‘unur_gibbs_set_thinning’ call has no effect on the length of the burn-in, i.e., for the burn-in always a thinning factor ‘1’ is used. _Notice_: This parameter must satisfy THINNING>=0. Default: ‘0’. -- Function: const double* unur_gibbs_get_state (UNUR_GEN* GENERATOR) -- Function: int unur_gibbs_chg_state (UNUR_GEN* GENERATOR, const DOUBLE* STATE) Get and change the current state of the Gibbs chain. -- Function: int unur_gibbs_reset_state (UNUR_GEN* GENERATOR) Reset state of chain to starting point. _Notice:_ Currently this function does not reset the generators for conditional distributions. Thus it is not possible to get the same Gibbs chain even when the underlying uniform random number generator is reset. 5.6.2 HITRO – Markov Chain - HIT-and-run sampler with Ratio-Of-uniforms ----------------------------------------------------------------------- Required: PDF Optional: mode, center, bounding rectangle for acceptance region Speed: Set-up: fast, Sampling: fast Reinit: not implemented Reference: [KLPa05] HITRO is an implementation of a hit-and-run sampler that runs on the acceptance region of the multivariate ratio-of-uniforms method, see *note Ratio-of-Uniforms::. The Ratio-of-Uniforms transforms the region below the density into some region that we call "region of acceptance" in the following. The minimal bounding hyperrectangle of this region is given by v^+ = sup_(x) (f(x))^(1/r d+1), u^-_i = inf_(x_i) (x_i- mu_i) (f(x))^(r/r d+1), u^+_i = sup_(x_i) (x_i- mu_i) (f(x))^(r/r d+1), where d denotes the dimension of the distribution; x_i is the i-th coordinate of point x; mu_i is the i-th coordinate of the center mu of the distribution, i.e., a point in the "main region" of the distribution. Using the center is important, since otherwise the acceptance region can become a very long and skinny ellipsoid along a diagonal of the (huge) bounding rectangle. For each step of the Hit-and-Run algorithm we have to choose some direction. This direction together with the current point of the chain determines a straight line. Then a point is sampled uniformly on intersection of this line and the region of acceptance. This is done by rejection from a uniform distribution on a line segment that covers it. Depending of the chosen variant the endpoints of this covering line are computed either by means of a (not necessary minimal) bounding hyper-rectangle, or just the "covering plate" of the bounding hyper-rectangle. The required bounds of the hyper-rectable can be given directly by the user. Otherwise, these are computed automatically by means of a numerical routine by Hooke and Jeeves [HJa61] called direct search (see ‘src/utils/hooke.c’ for further references and details). However, this expensive computation can be avoided by determine these bounds "on the fly" by the following adaptive algorithm: Start with some (small) hyper-rectangle and enlarge it whenever the endpoints of the covering line segment are not contained in the acceptance region of the Ratio-of-Unfiorms method. This approach works reliable as long as the region of acceptance is convex. The performance of the uniform sampling from the line segment is much improved if the covering line is adjusted (shortened) whenever a point is rejected (adaptive sampling). This technique reduces the expected number of iterations enormously. Method HITRO requires that the region of acceptance of the Ratio-of-Uniforms method is bounded. The shape of this region can be controlled by a parameter r. Higher values of r result in larger classes of distributions with bounded region of acceptance. (A distribution that has such a bounded region for some r also has a bounded region for every r’ greater than r.) On the other hand the acceptance probability decreases with increasing r. Moreover, round-off errors are more likely and (for large values of r) might result in a chain with a stationary distribution different from the target distribution. Method HITRO works optimal for distributions whose region of acceptance is convex. This is in particular the case for all log-concave distributions when we set r = ‘1’. For bounded but non-convex regions of acceptance convergence is yet not guarenteed by mathematical theory. How To Use .......... Method HITRO requires the PDF of the target distribution (derivatives are not necessary). The acceptance region of the Ratio-of-Uniforms transformation must be bounded. Its shape is controlled by parameter r. By default this parameter is set to ‘1’ as this guarentees a convex region of acceptance when the PDF of the given distribution is log-concave. It should only be set to a different (higher!) value using ‘unur_vnrou_set_r’ if otherwise x_i (f(x))^(r/r d+1) were not bounded for each coordinate. There are two variants of the HITRO sampler: _coordinate direction sampling. [default]_ The coordinates are updated cyclically. This can be seen as a Gibbs sampler running on the acceptance region of the Ratio-of-Uniforms method. This variant can be selected using ‘unur_hitro_set_variant_coordinate’. _random direction sampling._ In each step is a direction is sampled uniformly from the sphere. This variant can be selected using ‘unur_hitro_set_variant_random_direction’. Notice that each iteration of the coordinate direction sampler is cheaper than an iteration of the random direction sampler. Sampling uniformly from the line segment can be adjusted in several ways: _Adaptive line sampling vs. simple rejection._ When adaptive line sampling is switched on, the covering line is shortened whenever a point is rejected. However, when the region of acceptance is not convex the line segment from which we have to sample might not be connected. We found that the algorithm still works but at the time being there is no formal proof that the generated Markov chain has the required stationary distribution. Adaptive line sampling can switch on/off by means of the ‘unur_hitro_set_use_adaptiveline’ call. _Bounding hyper-rectangle vs. "covering plate"._ For computing the covering line we can use the bounding hyper-rectangle or just its upper bound. The latter saves computing time during the setup and when computing the covering during at each iteration step at the expense of a longer covering line. When adaptive line sampling is used the total generation time for the entire chain is shorter when only the "covering plate" is used. _Notice:_ When coordinate sampling is used the entire bounding rectangle is used. Using the entire bounding hyper-rectangle can be switched on/off by means of the ‘unur_hitro_set_use_boundingrectangle’ call. _Deterministic vs. adaptive bounding hyper-rectangle._ A bounding rectangle can be given by the ‘unur_vnrou_set_u’ and ‘unur_vnrou_set_v’ calls. Otherwise, the minimal bounding rectangle is computed automatically during the setup by means of a numerical algorithm. However, this is (very) slow especially in higher dimensions and it might happen that this algorithm (like any other numerical algorithm) does not return a correct result. Alternatively the bounding rectangle can be computed adaptively. In the latter case ‘unur_vnrou_set_u’ and ‘unur_vnrou_set_v’ can be used to provide a starting rectangle which must be sufficiently small. Then both endpoints of the covering line segment are always check whether they are outside the acceptance region of the Ratio-of-Uniforms method. If they are not, then the line segment and the ("bounding") rectangle are enlarged using a factor that can be given using the ‘unur_hitro_set_adaptive_multiplier’ call. Notice, that running this method in the adaptive rectangle mode requires that the region of acceptance is convex when random directions are used, or the given PDF is unimodal when coordinate direction sampling is used. Moreover, it requires two additional calls to the PDF in each iteration step of the chain. Using addaptive bounding rectangles can be switched on/off by means of the ‘unur_hitro_set_use_adaptiverectangle’ call. The algorithm takes of a bounded rectangular domain given by a ‘unur_distr_cvec_set_domain_rect’ call, i.e. the PDF is set to zero for every x outside the given domain. However, it is only the coordinate direction sampler where the boundary values are directly used to get the endpoins of the coverline line for the line sampling step. _Important:_ The bounding rectangle has to be provided for the function PDF(x-center)! Notice that ‘center’ is the center of the given distribution, see ‘unur_distr_cvec_set_center’. If in doubt or if this value is not optimal, it can be changed (overridden) by a ‘unur_distr_cvec_set_center’ call. Function reference ------------------ -- Function: UNUR_PAR* unur_hitro_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_hitro_set_variant_coordinate (UNUR_PAR* PARAMETERS) Coordinate Direction Sampling: Sampling along the coordinate directions (cyclic). _Notice:_ For this variant the entire bounding rectangle is always used independent of the ‘unur_hitro_set_use_boundingrectangle’ call. This is the default. -- Function: int unur_hitro_set_variant_random_direction (UNUR_PAR* PARAMETERS) Random Direction Sampling: Sampling along the random directions. -- Function: int unur_hitro_set_use_adaptiveline (UNUR_PAR* PARAMETERS, int ADAPTIVE) When ADAPTIVE is set to ‘TRUE’ adaptive line sampling is applied, otherwise simple rejection is used. _Notice:_ When adaptive line sampling is switched off, the entire bounding rectangle must be used since otherwise the sampling time can be arbitrarily slow. _Warning:_ When adaptive line sampling is switched off, sampling can be arbitrarily slow. In particular this happens when random direction sampling is used for distributions with rectangular domains. Then the algorithm can be trapped into a vertex (or even edge). Default is ‘TRUE’. -- Function: int unur_hitro_set_use_boundingrectangle (UNUR_PAR* PARAMETERS, int RECTANGLE) When RECTANGLE is set to ‘TRUE’ the entire bounding rectangle is used for computing the covering line. Otherwise, only an upper bound for the acceptance region is used. _Notice:_ When coordinate sampling is used the entire bounding rectangle has is always used and this call has no effect. Default: ‘FALSE’ for random direction samplig, ‘TRUE’ for coordinate direction sampling. -- Function: int unur_hitro_set_use_adaptiverectangle (UNUR_PAR* PARAMETERS, int ADAPTIVE) When ADAPTIVE is set to ‘FALSE’ the bounding rectangle is determined during the setup. Either, it is computed automatically by a (slow) numerical method, or it must be provided by ‘unur_vnrou_set_u’ and ‘unur_vnrou_set_v’ calls. If ADAPTIVE is set to ‘TRUE’ the bounding rectangle is computed adaptively. In this case the ‘unur_vnrou_set_u’ and ‘unur_vnrou_set_v’ calls can be used to provide a starting rectangle. This should be sufficiently small. If not given then we assume v_(max) = 1, u_(min)=(-0.001,-0.001,...,-0.001), and u_(max)=(0.001,0.001,...,0.001). Adaptive enlargements of the bounding hyperrectangle can be controlled set setting an enlargement factor given by a ‘unur_hitro_set_adaptive_multiplier’ call. Using adaptive computation of the bounding rectangle reduces the setup time significantly (when it is not given by the user) at the expense of two additional PDF evaluations during each iteration step. _Important:_ Using adaptive bounding rectangles requires that the region of acceptance is convex when random directions are used, or a unimodal PDF when coordinate direction sampling is used. Default: ‘FALSE’ for random direction samplig, ‘TRUE’ for coordinate direction sampling. -- Function: int unur_hitro_set_r (UNUR_PAR* PARAMETERS, double R) Sets the parameter R of the generalized multivariate ratio-of-uniforms method. _Notice_: This parameter must satisfy R>0. Default: ‘1’. -- Function: int unur_hitro_set_v (UNUR_PAR* PARAMETERS, double VMAX) Set upper boundary for bounding hyper-rectangle. If not set not set the mode of the distribution is used. If adaptive bounding rectangles the value is used for the starting rectangle. If not given (and the mode of the distribution is not known) then VMAX=‘1e-3’ is used. If deterministic bounding rectangles these values are the given values are used for the rectangle. If no value is given (and the mode of the distribution is not known), the upper bound of the minimal bounding hyper-rectangle is computed numerically (slow). Default: not set. -- Function: int unur_hitro_set_u (UNUR_PAR* PARAMETERS, const DOUBLE* UMIN, const DOUBLE* UMAX) Sets left and right boundaries of bounding hyper-rectangle. If adaptive bounding rectangles these values are used for the starting rectangle. If not given then UMIN=‘{-b,-b,...,-b}’ and UMAX=‘{b,b,...,b}’ with ‘b=1.e-3’ is used. If deterministic bounding rectangles these values are the given values are used for the rectangle. If no values are given, the boundary of the minimal bounding hyper-rectangle is computed numerically (slow). *Important*: The boundaries are those of the density shifted by the center of the distribution, i.e., for the function PDF(x-center)! _Notice_: Computing the minimal bounding rectangle may fail under some circumstances. Moreover, for multimodal distributions the bounds might be too small as only local extrema are computed. Nevertheless, for log-concave distributions it should work. Default: not set. -- Function: int unur_hitro_set_adaptive_multiplier (UNUR_PAR* PARAMETERS, double FACTOR) Adaptive enlargements of the bounding hyperrectangle can be controlled set setting the enlargement FACTOR. This must be greater than 1. Values close to 1 result in small adaptive steps and thus reduce the risk of too large bounding rectangles. On the other hand many adaptive steps might be necessary. _Notice:_ For practical reasons this call does not accept values for FACTOR less than ‘1.0001’. If this value is UNUR_INFINITY this results in infinite loops. Default: ‘1.1’ -- Function: int unur_hitro_set_startingpoint (UNUR_PAR* PARAMETERS, const DOUBLE* X0) Sets the starting point of the HITRO sampler in the original scale. X0 must be a "typical" point of the given distribution. If such a "typical" point is not known and a starting point is merely guessed, the first part of the HITRO chain should be discarded (_burn-in_), e.g.\ by mean of the ‘unur_hitro_set_burnin’ call. _Important:_ The PDF of the distribution must not vanish at the given point X0. Default is the result of ‘unur_distr_cvec_get_center’ for the given distribution object. -- Function: int unur_hitro_set_thinning (UNUR_PAR* PARAMETERS, int THINNING) Sets the THINNING parameter. When THINNING is set to k then every k-th point from the iteration is returned by the sampling algorithm. If thinning has to be set such that each coordinate is updated when using coordinate direction sampling, then THINNING should be ‘dim+1’ (or any multiple of it) where ‘dim’ is the dimension of the distribution object. _Notice_: This parameter must satisfy THINNING>=1. Default: ‘1’. -- Function: int unur_hitro_set_burnin (UNUR_PAR* PARAMETERS, int BURNIN) If a "typical" point for the target distribution is not known but merely guessed, the first part of the HITRO chain should be discarded (_burn-in_). This can be done during the initialization of the generator object. The length of the burn-in can is then BURNIN. The thinning factor set by a ‘unur_hitro_set_thinning’ call has no effect on the length of the burn-in, i.e., for the burn-in always a thinning factor ‘1’ is used. _Notice_: This parameter must satisfy THINNING>=0. Default: ‘0’. -- Function: const double* unur_hitro_get_state (UNUR_GEN* GENERATOR) -- Function: int unur_hitro_chg_state (UNUR_GEN* GENERATOR, const DOUBLE* STATE) Get and change the current state of the HITRO chain. _Notice:_ The state variable contains the point in the ‘dim+1’ dimensional point in the (tansformed) region of acceptance of the Ratio-of-Uniforms method. Its coordinate are stored in the following order: ‘state[] = {v, u1, u2, ..., udim}’. If the state can only be changed if the given STATE is inside this region. -- Function: int unur_hitro_reset_state (UNUR_GEN* GENERATOR) Reset state of chain to starting point. _Notice:_ Currently this function does not reset the generators for conditional distributions. Thus it is not possible to get the same HITRO chain even when the underlying uniform random number generator is reset. 5.7 Methods for continuous empirical multivariate distributions =============================================================== Overview of methods ------------------- Methods for continuous empirical multivariate distributions sample with ‘unur_sample_vec’ VEMPK: Requires an observed sample. Example ------- /* ------------------------------------------------------------- */ /* File: example_vemp.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* Example how to sample from an empirial continuous */ /* multivariate distribution. */ /* ------------------------------------------------------------- */ int main(void) { int i; /* 4 data points of dimension 2 */ double data[] = { 1. ,1., /* 1st data point */ -1.,1., /* 2nd data point */ 1.,-1., /* 3rd data point */ -1.,-1. }; /* 4th data point */ double result[2]; /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Create a distribution object with dimension 2. */ distr = unur_distr_cvemp_new( 2 ); /* Set empirical sample. */ unur_distr_cvemp_set_data(distr, data, 4); /* Choose a method: VEMPK. */ par = unur_vempk_new(distr); /* Use variance correction. */ unur_vempk_set_varcor( par, 1 ); /* Create the generator object. */ gen = unur_init(par); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) { unur_sample_vec(gen, result); printf("(%f,%f)\n", result[0], result[1]); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ Example (String API) -------------------- (not implemented) 5.7.1 VEMPK – (Vector) EMPirical distribution with Kernel smoothing ------------------------------------------------------------------- Required: observed sample Speed: Set-up: slow, Sampling: slow (depends on dimension) Reinit: not implemented Reference: [HLa00] [HLD04: Sect.12.2.1] VEMPK generates random variates from a multivariate empirical distribution that is given by an observed sample. The idea is that simply choosing a random point from the sample and to return it with some added noise results in a method that has very nice properties, as it can be seen as sampling from a kernel density estimate. Clearly we have to decide about the density of the noise (called kernel) and about the covariance matrix of the noise. The mathematical theory of kernel density estimation shows us that we are comparatively free in choosing the kernel. It also supplies us with a simple formula to compute the optimal standarddeviation of the noise, called bandwidth (or window width) of the kernel. Currently only a Gaussian kernel with the same covariance matrix as the given sample is implemented. However it is possible to choose between a variance corrected version or those with optimal MISE. Additionally a smoothing factor can be set to adjust the estimated density to non-bell-shaped data densities. How To Use .......... VEMPK uses empirical distributions. The main parameter would be the choice if of kernel density. However, currently only Gaussian kernels are supported. The parameters for the density are computed by a simple but robust method. However, it is possible to control its behavior by changing the smoothing factor. Additionally, variance correction can be swithed on (at the price of suboptimal MISE). Function reference ------------------ -- Function: UNUR_PAR* unur_vempk_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_vempk_set_smoothing (UNUR_PAR* PARAMETERS, double SMOOTHING) -- Function: int unur_vempk_chg_smoothing (UNUR_GEN* GENERATOR, double SMOOTHING) Set and change the smoothing factor. The smoothing factor controlles how “smooth†the resulting density estimation will be. A smoothing factor equal to 0 results in naive resampling. A very large smoothing factor (together with the variance correction) results in a density which is approximately equal to the kernel. Default is 1 which results in a smoothing parameter minimising the MISE (mean integrated squared error) if the data are not too far away from normal. If a large smoothing factor is used, then variance correction must be switched on. Default: ‘1’ -- Function: int unur_vempk_set_varcor (UNUR_PAR* PARAMETERS, int VARCOR) -- Function: int unur_vempk_chg_varcor (UNUR_GEN* GENERATOR, int VARCOR) Switch variance correction in generator on/off. If VARCOR is ‘TRUE’ then the variance of the used density estimation is the same as the sample variance. However this increases the MISE of the estimation a little bit. Default is ‘FALSE’. 5.8 Methods for discrete univariate distributions ================================================= Overview of methods ------------------- Methods for discrete univariate distributions sample with ‘unur_sample_discr’ method PMF PV mode sum other DARI x x ~ T-concave DAU [x] x DEXT wrapper for external generator DGT [x] x DSROU x x x T-concave DSS [x] x x DSTD build-in standard distribution Example ------- /* ------------------------------------------------------------- */ /* File: example_discr.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* Example how to sample from a discrete univariate distribution.*/ /* ------------------------------------------------------------- */ int main(void) { int i; double param = 0.3; double probvec[10] = {1.0, 2.0, 3.0, 4.0, 5.0,\ 6.0, 7.0, 8.0, 4.0, 3.0}; /* Declare the three UNURAN objects. */ UNUR_DISTR *distr1, *distr2; /* distribution objects */ UNUR_PAR *par1, *par2; /* parameter objects */ UNUR_GEN *gen1, *gen2; /* generator objects */ /* First distribution: defined by PMF. */ distr1 = unur_distr_geometric(¶m, 1); unur_distr_discr_set_mode(distr1, 0); /* Choose a method: DARI. */ par1 = unur_dari_new(distr1); gen1 = unur_init(par1); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen1 == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* Second distribution: defined by (finite) PV. */ distr2 = unur_distr_discr_new(); unur_distr_discr_set_pv(distr2, probvec, 10); /* Choose a method: DGT. */ par2 = unur_dgt_new(distr2); gen2 = unur_init(par2); if (gen2 == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* print some random integers */ for (i=0; i<10; i++){ printf("number %d: %d\n", i*2, unur_sample_discr(gen1) ); printf("number %d: %d\n", i*2+1, unur_sample_discr(gen2) ); } /* Destroy all objects. */ unur_distr_free(distr1); unur_distr_free(distr2); unur_free(gen1); unur_free(gen2); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ Example (String API) -------------------- /* ------------------------------------------------------------- */ /* File: example_discr_str.c */ /* ------------------------------------------------------------- */ /* String API. */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* Example how to sample from a discrete univariate distribution.*/ /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ /* Declare UNURAN generator objects. */ UNUR_GEN *gen1, *gen2; /* generator objects */ /* First distribution: defined by PMF. */ gen1 = unur_str2gen("geometric(0.3); mode=0 & method=dari"); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen1 == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* Second distribution: defined by (finite) PV. */ gen2 = unur_str2gen( "distr=discr; pv=(1,2,3,4,5,6,7,8,4,3) & method=dgt"); if (gen2 == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* print some random integers */ for (i=0; i<10; i++){ printf("number %d: %d\n", i*2, unur_sample_discr(gen1) ); printf("number %d: %d\n", i*2+1, unur_sample_discr(gen2) ); } /* Destroy all objects. */ unur_free(gen1); unur_free(gen2); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ 5.8.1 DARI – Discrete Automatic Rejection Inversion --------------------------------------------------- Required: T-concave PMF, mode, approximate area Speed: Set-up: moderate, Sampling: fast Reinit: supported Reference: [HDa96] [HLD04: Sect.10.2; Alg.10.4] DARI is based on rejection inversion, which can be seen as an adaptation of transformed density rejection to discrete distributions. The used transformation is -1/sqrt(x) . DARI uses three almost optimal points for constructing the (continuous) hat. Rejection is then done in horizontal direction. Rejection inversion uses only one uniform random variate per trial. DARI has moderate set-up times (the PMF is evaluated nine times), and good marginal speed, especially if an auxiliary array is used to store values during generation. DARI works for all T_(-1/2) -concave distributions. It requires the PMF and the location of the mode. Moreover the approximate sum over the PMF is used. (If no sum is given for the distribution the algorithm assumes that it is approximately 1.) The rejection constant is bounded from above by 4 for all T-concave distributions. How To Use .......... DARI works for discrete distribution object with given PMF. The sum over probabilities should be approximately one. Otherwise it must be set by a ‘unur_distr_discr_set_pmfsum’ call to its (approximate) value. The size of an auxiliary table can be set by ‘unur_dari_set_tablesize’. The expected number of evaluations can be reduced by switching the use of squeezes by means of ‘unur_dari_set_squeeze’. It is possible to change the parameters and the domain of the chosen distribution and run ‘unur_reinit’ to reinitialize the generator object. Notice, that derived parameters like the mode must also be (re-) set if the parameters or the domain has be changed. There exists a test mode that verifies whether the conditions for the method are satisfied or not. It can be switched on by calling ‘unur_dari_set_verify’ and ‘unur_dari_chg_verify’, respectively. Notice however that sampling is (much) slower then. Function reference ------------------ -- Function: UNUR_PAR* unur_dari_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_dari_set_squeeze (UNUR_PAR* PARAMETERS, int SQUEEZE) Turn utilization of the squeeze of the algorithm on/off. This squeeze does not resamble the squeeze of the continuous TDR method. It was especially designed for rejection inversion. The squeeze is not necessary if the size of the auxiliary table is big enough (for the given distribution). Using a squeeze is suggested to speed up the algorithm if the domain of the distribution is very big or if only small samples are produced. Default: no squeeze. -- Function: int unur_dari_set_tablesize (UNUR_PAR* PARAMETERS, int SIZE) Set the size for the auxiliary table, that stores constants computed during generation. If SIZE is set to ‘0’ no table is used. The speed-up can be impressive if the PMF is expensive to evaluate and the “main part of the distribution†is concentrated in an interval shorter than the size of the table. Default is ‘100’. -- Function: int unur_dari_set_cpfactor (UNUR_PAR* PARAMETERS, double CP_FACTOR) Set factor for position of the left and right construction point, resp. The CP_FACTOR is used to find almost optimal construction points for the hat function. The CP_FACTOR must be positive and should not exceed 2. There is no need to change this factor in almost all situations. Default is ‘0.664’. -- Function: int unur_dari_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) -- Function: int unur_dari_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) Turn verifying of algorithm while sampling on/off. If the condition is violated for some x then ‘unur_errno’ is set to ‘UNUR_ERR_GEN_CONDITION’. However notice that this might happen due to round-off errors for a few values of x (less than 1%). Default is ‘FALSE’. 5.8.2 DAU – (Discrete) Alias-Urn method --------------------------------------- Required: probability vector (PV) Speed: Set-up: slow (linear with the vector-length), Sampling: very fast Reinit: supported Reference: [WAa77] [HLD04: Sect.3.2] DAU samples from distributions with arbitrary but finite probability vectors (PV) of length N. The algorithmus is based on an ingeneous method by A.J. Walker and requires a table of size (at least) N. It needs one random numbers and only one comparison for each generated random variate. The setup time for constructing the tables is O(N). By default the probability vector is indexed starting at ‘0’. However this can be changed in the distribution object by a ‘unur_distr_discr_set_domain’ call. The method also works when no probability vector but a PMF is given. However then additionally a bounded (not too large) domain must be given or the sum over the PMF (see ‘unur_distr_discr_make_pv’ for details). How To Use .......... Create an object for a discrete distribution either by setting a probability vector or a PMF. The performance can be slightly influenced by setting the size of the used table which can be changed by ‘unur_dau_set_urnfactor’. It is possible to change the parameters and the domain of the chosen distribution and run ‘unur_reinit’ to reinitialize the generator object. Function reference ------------------ -- Function: UNUR_PAR* unur_dau_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_dau_set_urnfactor (UNUR_PAR* PARAMETERS, double FACTOR) Set size of urn table relative to length of the probability vector. It must not be less than 1. Larger tables result in (slightly) faster generation times but require a more expensive setup. However sizes larger than 2 are not recommended. Default is ‘1’. 5.8.3 DEXT – wrapper for Discrete EXTernal generators ----------------------------------------------------- Required: routine for sampling discrete random variates Speed: depends on external generator Reinit: supported Method DEXT is a wrapper for external generators for discrete univariate distributions. It allows the usage of external random variate generators within the UNU.RAN framework. How To Use .......... The following steps are required to use some external generator within the UNU.RAN framework (some of these are optional): 1. Make an empty generator object using a ‘unur_dext_new’ call. The argument DISTRIBUTION is optional and can be replaced by ‘NULL’. However, it is required if you want to pass parameters of the generated distribution to the external generator or for running some validation tests provided by UNU.RAN. 2. Create an initialization routine of type ‘int (*init)(UNUR_GEN *gen)’ and plug it into the generator object using the ‘unur_dext_set_init’ call. Notice that the INIT routine must return ‘UNUR_SUCCESS’ when it has been executed successfully and ‘UNUR_FAILURE’ otherwise. It is possible to get the size of and the pointer to the array of parameters of the underlying distribution object by the respective calls ‘unur_dext_get_ndistrparams’ and ‘unur_dext_get_distrparams’. Parameters for the external generator that are computed in the INIT routine can be stored in a single array or structure which is available by the ‘unur_dext_get_params’ call. Using an INIT routine is optional and can be omitted. 3. Create a sampling routine of type ‘int (*sample)(UNUR_GEN *gen)’ and plug it into the generator object using the ‘unur_dext_set_sample’ call. Uniform random numbers are provided by the ‘unur_sample_urng’ call. Do not use your own implementation of a uniform random number generator directly. If you want to use your own random number generator we recommend to use the UNU.RAN interface (see *note Using uniform random number generators: URNG.). The array or structure that contains parameters for the external generator that are computed in the INIT routine are available using the ‘unur_dext_get_params’ call. Using a SAMPLE routine is of course obligatory. It is possible to change the parameters and the domain of the chosen distribution and run ‘unur_reinit’ to reinitialize the generator object. The INIT routine is then called again. Here is a short example that demonstrates the application of this method by means of the geometric distribution: /* ------------------------------------------------------------- */ /* File: example_dext.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* This example shows how an external generator for the */ /* geometric distribution can be used within the UNURAN */ /* framework. */ /* */ /* Notice, that this example does not provide the simplest */ /* solution. */ /* ------------------------------------------------------------- */ /* Initialization routine. */ /* */ /* Here we simply read the parameter of the geometric */ /* distribution and store it in an array for parameters of */ /* the external generator. */ /* [ Of course we could do this in the sampling routine as */ /* and avoid the necessity of this initialization routine. ] */ int geometric_init (UNUR_GEN *gen) { /* Get pointer to parameters of geometric distribution */ double *params = unur_dext_get_distrparams(gen); /* The parameter is the first entry (see manual) */ double p = params[0]; /* Get array to store this parameter for external generator */ double *genpar = unur_dext_get_params(gen, sizeof(double)); genpar[0] = p; /* Executed successfully */ return UNUR_SUCCESS; } /* ------------------------------------------------------------- */ /* Sampling routine. */ /* */ /* Contains the code for the external generator. */ int geometric_sample (UNUR_GEN *gen) { /* Get scale parameter */ double *genpar = unur_dext_get_params(gen,0); double p = genpar[0]; /* Sample a uniformly distributed random number */ double U = unur_sample_urng(gen); /* Transform into geometrically distributed random variate */ return ( (int) (log(U) / log(1.-p)) ); } /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ int K; /* will hold the random number */ /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Use predefined geometric distribution with parameter 1/10 */ double fpar[1] = { 0.1 }; distr = unur_distr_geometric(fpar, 1); /* Use method DEXT */ par = unur_dext_new(distr); /* Set initialization and sampling routines. */ unur_dext_set_init(par, geometric_init); unur_dext_set_sample(par, geometric_sample); /* Create the generator object. */ gen = unur_init(par); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the standard Gaussian distribution. */ /* Eg.: */ for (i=0; i<10; i++) { K = unur_sample_discr(gen); printf("%d\n",K); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ Function reference ------------------ -- Function: UNUR_PAR* unur_dext_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for new generator. -- Function: int unur_dext_set_init (UNUR_PAR* PARAMETERS, int (* INIT)(UNUR_GEN* gen )) Set initialization routine for external generator. Inside the _Important:_ The routine INIT must return ‘UNUR_SUCCESS’ when the generator was initialized successfully and ‘UNUR_FAILURE’ otherwise. Parameters that are computed in the INIT routine can be stored in an array or structure that is avaiable by means of the ‘unur_dext_get_params’ call. Parameters of the underlying distribution object can be obtained by the ‘unur_dext_get_distrparams’ call. -- Function: int unur_dext_set_sample (UNUR_PAR* PARAMETERS, int (* SAMPLE)(UNUR_GEN* gen )) Set sampling routine for external generator. _Important:_ Use ‘unur_sample_urng(gen)’ to get a uniform random number. The pointer to the array or structure that contains the parameters that are precomputed in the INIT routine are available by ‘unur_dext_get_params(gen,0)’. Additionally one can use the ‘unur_dext_get_distrparams’ call. -- Function: void* unur_dext_get_params (UNUR_GEN* GENERATOR, size_t SIZE) Get pointer to memory block for storing parameters of external generator. A memory block of size SIZE is automatically (re-) allocated if necessary and the pointer to this block is stored in the GENERATOR object. If one only needs the pointer to this memory block set SIZE to ‘0’. Notice, that SIZE is the size of the memory block and not the length of an array. _Important:_ This rountine should only be used in the initialization and sampling routine of the external generator. -- Function: double* unur_dext_get_distrparams (UNUR_GEN* GENERATOR) -- Function: int unur_dext_get_ndistrparams (UNUR_GEN* GENERATOR) Get size of and pointer to array of parameters of underlying distribution in GENERATOR object. _Important:_ These rountines should only be used in the initialization and sampling routine of the external generator. 5.8.4 DGT – (Discrete) Guide Table method (indexed search) ---------------------------------------------------------- Required: probability vector (PV) Speed: Set-up: slow (linear with the vector-length), Sampling: very fast Reinit: supported Reference: [CAa74] [HLD04: Sect.3.1.2] DGT samples from arbitrary but finite probability vectors. Random numbers are generated by the inversion method, i.e., 1. Generate a random number U ~ U(0,1). 2. Find smallest integer I such that F(I) = P(X<=I) >= U. Step (2) is the crucial step. Using sequential search requires O(E(X)) comparisons, where E(X) is the expectation of the distribution. Indexed search, however, uses a guide table to jump to some I’ <= I near I to find X in constant time. Indeed the expected number of comparisons is reduced to 2, when the guide table has the same size as the probability vector (this is the default). For larger guide tables this number becomes smaller (but is always larger than 1), for smaller tables it becomes larger. For the limit case of table size 1 the algorithm simply does sequential search (but uses a more expensive setup then method DSS (*note DSS::). On the other hand the setup time for guide table is O(N), where N denotes the length of the probability vector (for size 1 no preprocessing is required). Moreover, for very large guide tables memory effects might even reduce the speed of the algorithm. So we do not recommend to use guide tables that are more than three times larger than the given probability vector. If only a few random numbers have to be generated, (much) smaller table sizes are better. The size of the guide table relative to the length of the given probability vector can be set by a ‘unur_dgt_set_guidefactor’ call. There exist two variants for the setup step which can be set by a ‘unur_dgt_set_variant’ call: Variants 1 and 2. Variant 2 is faster but more sensitive to roundoff errors when the guide table is large. By default variant 2 is used for short probability vectors (N<1000) and variant 1 otherwise. By default the probability vector is indexed starting at ‘0’. However this can be changed in the distribution object by a ‘unur_distr_discr_set_domain’ call. The method also works when no probability vector but a PMF is given. However, then additionally a bounded (not too large) domain must be given or the sum over the PMF. In the latter case the domain of the distribution is trucated (see ‘unur_distr_discr_make_pv’ for details). How To Use .......... Create an object for a discrete distribution either by setting a probability vector or a PMF. The performance can be slightly influenced by setting the size of the used table which can be changed by ‘unur_dgt_set_guidefactor’. It is possible to change the parameters and the domain of the chosen distribution and run ‘unur_reinit’ to reinitialize the generator object. Function reference ------------------ -- Function: UNUR_PAR* unur_dgt_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_dgt_set_guidefactor (UNUR_PAR* PARAMETERS, double FACTOR) Set size of guide table relative to length of PV. Larger guide tables result in faster generation time but require a more expensive setup. Sizes larger than 3 are not recommended. If the relative size is set to 0, sequential search is used. However, this is not recommended, except in exceptional cases, since method DSS (*note DSS::) is has almost no setup and is thus faster (but requires the sum over the PV as input parameter). Default is ‘1’. -- Function: int unur_dgt_set_variant (UNUR_PAR* PARAMETERS, unsigned VARIANT) Set variant for setup step. Possible values are ‘1’ or ‘2’. Variant ‘2’ is faster but more sensitive to roundoff errors when the guide table is large. By default variant ‘2’ is used for short probability vectors (N<1000) and variant ‘1’ otherwise. 5.8.5 DSROU – Discrete Simple Ratio-Of-Uniforms method ------------------------------------------------------ Required: T-concave PMF, mode, sum over PMF Speed: Set-up: fast, Sampling: slow Reinit: supported Reference: [LJa01] [HLD04: Sect.10.3.2; Alg.10.6] DSROU is based on the ratio-of-uniforms method (*note Ratio-of-Uniforms::) but uses universal inequalities for constructing a (universal) bounding rectangle. It works for all T-concave distributions with T(x) = -1/sqrt(x) . The method requires the PMF, the (exact) location of the mode and the sum over the given PDF. The rejection constant is 4 for all T-concave distributions. Optionally the CDF at the mode can be given to increase the performance of the algorithm. Then the rejection constant is reduced to 2. How To Use .......... The method works for T-concave discrete distributions with given PMF. The sum over of the PMF or an upper bound of this sum must be known. Optionally the CDF at the mode can be given to increase the performance using ‘unur_dsrou_set_cdfatmode’. However, this *must not* be called if the sum over the PMF is replaced by an upper bound. It is possible to change the parameters and the domain of the chosen distribution and run ‘unur_reinit’ to reinitialize the generator object. If any of mode, CDF at mode, or the sum over the PMF has been changed, then ‘unur_reinit’ must be executed. (Otherwise the generator produces garbage). There exists a test mode that verifies whether the conditions for the method are satisfied or not while sampling. It can be switched on or off by calling ‘unur_dsrou_set_verify’ and ‘unur_dsrou_chg_verify’, respectively. Notice however that sampling is (a little bit) slower then. Function reference ------------------ -- Function: UNUR_PAR* unur_dsrou_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_dsrou_set_cdfatmode (UNUR_PAR* PARAMETERS, double FMODE) Set CDF at mode. When set, the performance of the algorithm is increased by factor 2. However, when the parameters of the distribution are changed ‘unur_dsrou_chg_cdfatmode’ has to be used to update this value. Notice that the algorithm detects a mode at the left boundary of the domain automatically and it is not necessary to use this call for a monotonically decreasing PMF. Default: not set. -- Function: int unur_dsrou_set_verify (UNUR_PAR* PARAMETERS, int VERIFY) -- Function: int unur_dsrou_chg_verify (UNUR_GEN* GENERATOR, int VERIFY) Turn verifying of algorithm while sampling on/off. If the condition squeeze(x) <= PMF(x) <= hat(x) is violated for some x then ‘unur_errno’ is set to ‘UNUR_ERR_GEN_CONDITION’. However notice that this might happen due to round-off errors for a few values of x (less than 1%). Default is ‘FALSE’. -- Function: int unur_dsrou_chg_cdfatmode (UNUR_GEN* GENERATOR, double FMODE) Change CDF at mode of distribution. ‘unur_reinit’ must be executed before sampling from the generator again. 5.8.6 DSS – (Discrete) Sequential Search method ----------------------------------------------- Required: probability vector (PV) and sum over PV; or probability mass function(PMF), sum over PV and domain; or or cumulative distribution function (CDF) Speed: Set-up: fast, Sampling: very slow (linear in expectation) Reinit: supported Reference: [HLD04: Sect.3.1.1; Alg.3.1] DSS samples from arbitrary discrete distributions. Random numbers are generated by the inversion method, i.e., 1. Generate a random number U ~ U(0,1). 2. Find smallest integer I such that F(I) = P(X<=I) >= U. Step (2) is the crucial step. Using sequential search requires O(E(X)) comparisons, where E(X) is the expectation of the distribution. Thus this method is only recommended when only a few random variates from the given distribution are required. Otherwise, table methods like DGT (*note DGT::) or DAU (*note DAU::) are much faster. These methods also need not the sum over the PMF (or PV) as input. On the other hand, however, these methods always compute a table. DSS runs with the PV, the PMF, or the CDF of the distribution. It uses actually uses the first one in this list (in this ordering) that could be found. How To Use .......... It works with a discrete distribution object with contains at least the PV, the PMF, or the CDF. It is possible to change the parameters and the domain of the chosen distribution and run ‘unur_reinit’ to reinitialize the generator object. Function reference ------------------ -- Function: UNUR_PAR* unur_dss_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. 5.8.7 DSTD – Discrete STandarD distributions -------------------------------------------- Required: standard distribution from UNU.RAN library (*note Standard distributions: Stddist.) or discrete distribution with inverse CDF. Speed: Set-up: fast, Sampling: depends on distribution and generator Reinit: supported DSTD is a wrapper for special generators for discrete univariate standard distributions. It only works for distributions in the UNU.RAN library of standard distributions (*note Standard distributions: Stddist.) or for discrete distributions where the inverse CDF is given. If a distribution object is provided that is build from scratch, it must provide the inverse CDF. Then CSTD implements the inversion method. Otherwise, the ‘NULL’ pointer is returned. For some distributions more than one special generator is possible. How To Use .......... Create a distribution object for a standard distribution from the UNU.RAN library (*note Standard distributions: Stddist.), or create a discrete distribution object and set the function for the inverse CDF using ‘unur_distr_discr_set_invcdf’. For some distributions more than one special generator (_variants_) is possible. These can be choosen by a ‘unur_dstd_set_variant’ call. For possible variants *Note Standard distributions: Stddist. However the following are common to all distributions: ‘UNUR_STDGEN_DEFAULT’ the default generator. ‘UNUR_STDGEN_FAST’ the fastest available special generator. ‘UNUR_STDGEN_INVERSION’ the inversion method (if available). Notice that the variant ‘UNUR_STDGEN_FAST’ for a special generator might be slower than one of the universal algorithms! Additional variants may exist for particular distributions. Sampling from truncated distributions (which can be constructed by changing the default domain of a distribution by means of ‘unur_distr_discr_set_domain’ or unur_dstd_chg_truncated calls) is possible but requires the inversion method. Moreover the CDF of the distribution must be implemented. It is possible to change the parameters and the domain of the chosen distribution and run ‘unur_reinit’ to reinitialize the generator object. Function reference ------------------ -- Function: UNUR_PAR* unur_dstd_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for new generator. It requires a distribution object for a discrete univariant distribution from the UNU.RAN library of standard distributions (*note Standard distributions: Stddist.). Using a truncated distribution is allowed only if the inversion method is available and selected by the ‘unur_dstd_set_variant’ call immediately after creating the parameter object. Use a ‘unur_distr_discr_set_domain’ call to get a truncated distribution. -- Function: int unur_dstd_set_variant (UNUR_PAR* PARAMETERS, unsigned VARIANT) Set variant (special generator) for sampling from a given distribution. For possible variants *note Standard distributions: Stddist. Common variants are ‘UNUR_STDGEN_DEFAULT’ for the default generator, ‘UNUR_STDGEN_FAST’ for (one of the) fastest implemented special generators, and ‘UNUR_STDGEN_INVERSION’ for the inversion method (if available). If the selected variant number is not implemented, then an error code is returned and the variant is not changed. -- Function: int unur_dstd_chg_truncated (UNUR_GEN* GENERATOR, int LEFT, int RIGHT) Change left and right border of the domain of the (truncated) distribution. This is only possible if the inversion method is used. Otherwise this call has no effect and an error code is returned. Notice that the given truncated domain must be a subset of the domain of the given distribution. The generator always uses the intersection of the domain of the distribution and the truncated domain given by this call. It is not required to run ‘unur_reinit’ after this call has been used. _Important:_ If the CDF is (almost) the same for LEFT and RIGHT and (almost) equal to ‘0’ or ‘1’, then the truncated domain is not chanced and the call returns an error code. _Notice:_ If the parameters of the distribution has been changed it is recommended to set the truncated domain again, since the former call might change the domain of the distribution but not update the values for the boundaries of the truncated distribution. 5.9 Methods for random matrices =============================== Overview of methods ------------------- Methods for matrix distributions sample with ‘unur_sample_matr’ MCORR: Distribution object for random correlation matrix. 5.9.1 MCORR – Random CORRelation matrix --------------------------------------- Required: Distribution object for random correlation matrix Speed: Set-up: fast, Sampling: depends on dimension Reinit: supported Reference: [DLa86: Sect.6.1; p.605] [MOa84] MCORR generates a random correlation matrix (Pearson’s correlation). Two methods are used: 1. When a random correlation matrix having given eigenvalues is sought, the method of Marsaglia and Olkin [MOa84] is used. In this case, the correlation matrix R is given as R=PDP' where D is a diagonal matrix containing the eigenvalues and P is a random orthonormal matrix. In higher dimensions, the rounding-errors introduced in the previous matrix multiplications could lead to a non-symmetric correlation matrix. Therefore the symmetric correlation matrix is computed as R=(PDP'+P'DP)/2 . 2. A matrix H is generated where all rows are independent random vectors of unit length uniformly on a sphere. Then HH' is a correlation matrix (and vice versa if HH' is a correlation matrix then the rows of H are random vectors on a sphere). Notice that due to round-off errors the generated matrices might not be positive definite in extremely rare cases (especially when the given eigenvalues are amost 0). There are many other possibilites (distributions) of sampling the random rows from a sphere. The chosen methods are simple but does not result in a uniform distriubution of the random correlation matrices. It only works with distribution objects of random correlation matrices (*note Random Correlation Matrix: correlation.). How To Use .......... Create a distibution object for random correlation matrices by a ‘unur_distr_correlation’ call (*note Random Correlation Matrix: correlation.). When a correlation matrix with given eigenvalues should be generated, these eigenvalues can be set by a ‘unur_mcorr_set_eigenvalues’ call. Otherwise, a faster algorithm is used that generates correlation matrices with random eigenstructure. Notice that due to round-off errors, there is a (small) chance that the resulting matrix is not positive definite for a Cholesky decomposition algorithm, especially when the dimension of the distribution is high. It is possible to change the given eigenvalues using ‘unur_mcorr_chg_eigenvalues’ and run ‘unur_reinit’ to reinitialize the generator object. Function reference ------------------ -- Function: UNUR_PAR* unur_mcorr_new (const UNUR_DISTR* DISTRIBUTION) Get default parameters for generator. -- Function: int unur_mcorr_set_eigenvalues (UNUR_PAR* PAR, const DOUBLE* EIGENVALUES) Sets the (optional) eigenvalues of the correlation matrix. If set, then the Marsaglia and Olkin algorithm will be used to generate random correlation matrices with given eigenvalues. Important: the given eigenvalues of the correlation matrix must be strictly positive and sum to the dimension of the matrix. If non-positive eigenvalues are attempted, no eigenvalues are set and an error code is returned. In case, that their sum is different from the dimension, an implicit scaling to give the correct sum is performed. -- Function: int unur_mcorr_chg_eigenvalues (UNUR_GEN* GEN, const DOUBLE* EIGENVALUES) Change the eigenvalues of the correlation matrix. One must run ‘unur_reinit’ to reinitialize the generator object then. 5.10 Methods for uniform univariate distributions ================================================= 5.10.1 UNIF – wrapper for UNIForm random number generator --------------------------------------------------------- UNIF is a simple wrapper that makes it possible to use a uniform random number generator as a UNU.RAN generator. There are no parameters for this method. How To Use .......... Create a generator object with ‘NULL’ as argument. The created generator object returns raw random numbers from the underlying uniform random number generator. Function reference ------------------ -- Function: UNUR_PAR* unur_unif_new (const UNUR_DISTR* DUMMY) Get default parameters for generator. UNIF does not need a distribution object. DUMMY is not used and can (should) be set to ‘NULL’. It is used to keep the API consistent. 5.11 Meta Methods for univariate distributions ============================================== Example ------- /* ------------------------------------------------------------- */ /* File: example_mixt.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* Mixture of a Gaussian and a Cauchy distribution. */ /* ------------------------------------------------------------- */ int main(void) { /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *comp[2]; /* array of generator objects (components)*/ UNUR_GEN *gen; /* generator object for mixture */ double prob[2]; /* array of probabilities */ int i; /* loop variable */ double x; /* will hold the random number */ /* Create generators for components */ distr = unur_distr_normal(NULL,0); /* Gaussian distribution */ par = unur_pinv_new(distr); /* choose method PINV */ comp[0] = unur_init(par); /* initialize */ unur_distr_free(distr); /* free distribution obj. */ distr = unur_distr_cauchy(NULL,0); /* Cauchy distribution */ par = unur_tdr_new(distr); /* choose method TDR */ comp[1] = unur_init(par); /* initialize */ unur_distr_free(distr); /* free distribution obj. */ /* Probabilities for components (need not sum to 1) */ prob[0] = 0.4; prob[1] = 0.3; /* Create mixture */ par = unur_mixt_new(2,prob,comp); /* Initialize generator object */ gen = unur_init(par); /* we do not need the components any more */ for (i=0; i<2; i++) unur_free(comp[i]); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ Example (Inversion) ------------------- /* ------------------------------------------------------------- */ /* File: example_mixt_inv.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* Mixture of truncated Gaussian on (-INFINITY,0] and */ /* Exponential distribution on [0,INFINITY) */ /* ------------------------------------------------------------- */ int main(void) { /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *comp[2]; /* array of generator objects (components)*/ UNUR_GEN *gen; /* generator object for mixture */ double prob[2]; /* array of probabilities */ int i; /* loop variable */ double x; /* will hold the random number */ /* Create generators for components */ distr = unur_distr_normal(NULL,0); /* Gaussian distribution */ unur_distr_cont_set_domain(distr,-UNUR_INFINITY,0); par = unur_pinv_new(distr); /* choose method PINV */ comp[0] = unur_init(par); /* initialize */ unur_distr_free(distr); /* free distribution obj. */ distr = unur_distr_exponential(NULL,0); /* Exponential distr. */ par = unur_pinv_new(distr); /* choose method PINV */ comp[1] = unur_init(par); /* initialize */ unur_distr_free(distr); /* free distribution obj. */ /* Probabilities for components (need not sum to 1) */ prob[0] = 0.4; prob[1] = 0.3; /* Create mixture */ par = unur_mixt_new(2,prob,comp); /* We want to use inversion for the mixture as well. */ /* (Thus the above order of the components is important!) */ unur_mixt_set_useinversion(par,TRUE); /* Initialize generator object */ gen = unur_init(par); /* we do not need the components any more */ for (i=0; i<2; i++) unur_free(comp[i]); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ 5.11.1 MIXT – MIXTure of distributions -------------------------------------- MIXT allows to sample from a mixture of univariate distributions. Let f_1,...,f_n be PDFs of various distributions called the components and (p_1,...,p_n) be a probability vector. Then f(x) = p_1 * f_1(x) + ...+ p_n * f_n(x) is the PDF of the so called mixture of these distributions. Method MIXT takes generator objects for the components and a probability vector and creates a generator object for this mixture. The sampling part works as follows: 1. Generate an index J as the realisation of a discrete random variate with the given probability vector. This is done by means of method DGT (*note Guide Table method: DGT.). 2. Generate a random variate X with PDF f_J. When the (interior of the) domains of the the components are disjoint then it is possible to sample from the mixture by inversion, provided that the following conditions are met: − The generator objects must use an inversion method for each component. − The domains of the PDFs f_i must not overlap. − The components must be ordered with respect to their domains. How To Use .......... Create generator objects for the components of the mixture and store the corresponding pointers in an array. Store all probabilities an a double array of the same size. Create the parameter object for the generator of the mixture distribution by means of ‘unur_mixt_new’. The components of the mixture can be any continuous or discrete univariate distributions. This also includes generators for empirical distributions and mixtures of distributions. In particular, mixtures can also be defined recursively. _Remark:_ The components of the mixture can be continuous or discrete distributions. The resulting mixture, however, is always a continuous distribution and thus ‘unur_sample_cont’ must be used! The inversion method can be switched on by means of ‘unur_mixt_set_useinversion’ call. However, the conditions for this method must then be met. Otherwise, initialization of the mixture object fails. Function reference ------------------ -- Function: UNUR_PAR* unur_mixt_new (int N, const DOUBLE* PROB, UNUR_GEN** COMP) Get default parameters for the generator for a mixture of the distributions given in the array COMP (components) of length N. The probabilities are given by PROB. The generators in COMP must be objects for (continuous or discrete) univariate distributions -- Function: int unur_mixt_set_useinversion (UNUR_PAR* PARAMETERS, int USEINV) If USEINV is ‘TRUE’, then the inversion method is used for sampling from the mixture distribution. However, the following conditions must be satisfied: − The generator objects must use an inversion method for each component. − The domains of the components must not overlap. − The components must be ordered with respect to their domains. If one of these conditions is violated, then initialization of the mixture object fails. Default is ‘FALSE’. 6 Using uniform random number generators **************************************** UNU.RAN is designed to work with many sources of (pseudo-) random numbers or low discrepancy numbers (so called quasi-random numbers) for almost all tasks in discrete event simulation, (quasi-) Monte Carlo integration or any other stochastic methods. Hence UNU.RAN uses pointers to access uniform (pseudo-) random number generators (URNG). Each UNU.RAN (non-uniform random variate) generator object has a pointer to a URNG object. Thus each UNU.RAN generator object may have its own (independent) URNG or several generator objects can share the same URNG. If no URNG is provided for a parameter or generator object a default generator is used which is the same for all generators. This URNG is defined in ‘unuran_config.h’ at compile time and can be changed at runtime. UNU.RAN uses a unified interface for all sources of random numbers. Unfortunately, the API for random number generators, like the ‘GSL’ (GNU Scientific Library), Otmar Lendl’s ‘prng’ (Pseudo random number generators), or a single function implemented by the user herself, are quite different. Hence an object of type ‘UNUR_URNG’ is introduced to store the URNG. Thus it is possible to handle different sources of such URNGs with the unified API. It is inspired from similar to Pierre L’Ecuyers ‘RngStreams’ library: − seed the random number generator; − get a uniform random number; − reset the URNG; − skip to the begining next substream; − sample antithetic numbers; − delete the URNG object. The routine to create a URNG depends on the chosen random number generator (i.e. library). Nevertheless, there exist wrapper functions to simplify this task. Currently the following sources of uniform random numbers are directly supported (i.e., there exist wrapper functions). Of course other random number generation libraries can be used. 1. ‘FVOID’ URNGs of type ‘double uniform(void *state)’. The argument STATE can be simply ignored in the implementation of ‘uniform’ when a global state variable is used. UNU.RAN contains some build-in URNGs of this type in directory ‘src/uniform/’. 2. ‘PRNG’ URNGs from Otmar Lendl’s ‘prng’ library. It provides a very flexible way to sample form arbitrary URNGs by means of an object oriented programing paradigma. Similarly to the UNU.RAN library independent generator objects can be build and used. This library has been developed by the pLab group at the university of Salzburg (Austria, EU) and implemented by Otmar Lendl. It is available from or from the pLab site at . This interface must be compiled into UNU.RAN using the configure flag ‘--with-urng-prng’. 3. ‘RNGSTREAM’ Pierre L’Ecuyer’s ‘RngStream’ library for multiple independent streams of pseudo-random numbers. A GNU-style package is available from . This interface must be compiled into UNU.RAN using the configure flag ‘--with-urng-rngstream’. 4. ‘GSL’ URNG from the GNU Scientific Library (GSL). It is available from . This interface must be compiled into UNU.RAN using the configure flag ‘--with-urng-gsl’. How To Use .......... Each UNU.RAN generator object has a pointer to a uniform (pseudo-) random number generator (URNG). It can be set via the ‘unur_set_urng’ call. It is also possible to read this pointer via ‘unur_get_urng’ or change the URNG for an existing generator object by means of ‘unur_chg_urng’. It is important to note that these calls only copy the pointer to the URNG object into the generator object. If no URNG is provided for a parameter or generator object a default URNG is used which is the same for all generators. This URNG is defined in ‘unuran_config.h’ at compile time. A pointer to this default URNG can be obtained via ‘unur_get_default_urng’. Nevertheless, it is also possible to change this default URNG by another one at runtime by means of the ‘unur_set_default_urng’ call. However, this only takes effect for new parameter objects. Some generating methods provide the possibility of correlation induction. For this feature a second auxiliary URNG is required. It can be set and changed by ‘unur_set_urng_aux’ and ‘unur_chg_urng_aux’ calls, respectively. Since the auxiliary URNG is by default the same as the main URNG, the auxiliary URNG must be set after any ‘unur_set_urng’ or ‘unur_chg_urng’ call! Since in special cases mixing of two URNG might cause problems, we supply a default auxiliary generator that can be used by a ‘unur_use_urng_aux_default’ call (after the main URNG has been set). This default auxiliary generator can be changed with analogous calls as the (main) default uniform generator. Uniform random number generators form different sources have different programming interfaces. Thus UNU.RAN stores all information about a particular uniform random number generator in a structure of type ‘UNUR_URNG’. Before a URNG can be used with UNU.RAN an appropriate object has to be created ba a ‘unur_urng_new’ call. This call takes two arguments: the pointer to the sampling routine of the generator and a pointer to a possible argument that stores the state of the generator. The function must be of type ‘double (*sampleunif)(void *params)’, but functions without any argument also work. Additionally one can set pointers to functions for reseting or jumping the streams generated by the URNG by the corresponding ‘set’ calls. UNU.RAN provides a unified API to all sources of random numbers. Notice, however, that not all functions work for all random number generators (as the respective library has not implemented the corresponding feature). There are wrapper functions for some libraries of uniform random number generators to simplify the task of creating a UNU.RAN object for URNGs. These functions must be compiled into UNU.RAN using the corresponding configure flags (see description of the respective interface below). Function reference ------------------ Set and get default uniform RNGs -------------------------------- -- Function: UNUR_URNG* unur_get_default_urng (void) Get the pointer to the default URNG. The default URNG is used by all generators where no URNG was set explicitly by a ‘unur_set_urng’ call. -- Function: UNUR_URNG* unur_set_default_urng (UNUR_URNG* URNG_NEW) Change the default URNG that is used for new parameter objects. It returns the pointer to the old default URNG that has been used. -- Function: UNUR_URNG* unur_set_default_urng_aux (UNUR_URNG* URNG_NEW) -- Function: UNUR_URNG* unur_get_default_urng_aux (void) Analogous calls for default auxiliary generator. Set, change and get uniform RNGs in generator objects ----------------------------------------------------- -- Function: int unur_set_urng (UNUR_PAR* PARAMETERS, UNUR_URNG* URNG) Use the URNG ‘urng’ for the new generator. This overrides the default URNG. It also sets the auxiliary URNG to ‘urng’. _Important_: For multivariate distributions that use marginal distributions this call does not work properly. It is then better first to create the generator object (by a ‘unur_init’ call) and then change the URNG by means of ‘unur_chg_urng’. -- Function: UNUR_URNG* unur_chg_urng (UNUR_GEN* GENERATOR, UNUR_URNG* URNG) Change the URNG for the given generator. It returns the pointer to the old URNG that has been used by the generator. It also changes the auxiliary URNG to ‘urng’ and thus it overrides the last ‘unur_chg_urng_aux’ call. -- Function: UNUR_URNG* unur_get_urng (UNUR_GEN* GENERATOR) Get the pointer to the URNG that is used by the GENERATOR. This is usefull if two generators should share the same URNG. -- Function: int unur_set_urng_aux (UNUR_PAR* PARAMETERS, UNUR_URNG* URNG_AUX) Use the auxiliary URNG ‘urng_aux’ for the new generator. (Default is the default URNG or the URNG from the last ‘unur_set_urng’ call. Thus if the auxiliary generator should be different to the main URNG, ‘unur_set_urng_aux’ must be called after ‘unur_set_urng’. The auxiliary URNG is used as second stream of uniform random number for correlation induction. It is not possible to set an auxiliary URNG for a method that does not need one. In this case an error code is returned. -- Function: int unur_use_urng_aux_default (UNUR_PAR* PARAMETERS) Use the default auxiliary URNG. (It must be set after ‘unur_get_urng’. ) It is not possible to set an auxiliary URNG for a method that does not use one (i.e. the call returns an error code). -- Function: int unur_chgto_urng_aux_default (UNUR_GEN* GENERATOR) Switch to default auxiliary URNG. (It must be set after ‘unur_get_urng’. ) It is not possible to set an auxiliary URNG for a method that does not use one (i.e. the call returns an error code). -- Function: UNUR_URNG* unur_chg_urng_aux (UNUR_GEN* GENERATOR, UNUR_URNG* URNG_AUX) Change the auxiliary URNG for the given GENERATOR. It returns the pointer to the old auxiliary URNG that has been used by the generator. It has to be called after each ‘unur_chg_urng’ when the auxiliary URNG should be different from the main URNG. It is not possible to change the auxiliary URNG for a method that does not use one (i.e. the call ‘NULL’). -- Function: UNUR_URNG* unur_get_urng_aux (UNUR_GEN* GENERATOR) Get the pointer to the auxiliary URNG that is used by the GENERATOR. This is usefull if two generators should share the same URNG. Handle uniform RNGs ------------------- _Notice:_ Some of the below function calls do not work for every source of random numbers since not every library has implemented these features. -- Function: double unur_urng_sample (UNUR_URNG* URNG) Get a uniform random number from URNG. If the ‘NULL’ pointer is given, the default uniform generator is used. -- Function: double unur_sample_urng (UNUR_GEN* GEN) Get a uniform random number from the underlying uniform random number generator of generator GEN. If the ‘NULL’ pointer is given, the default uniform generator is used. -- Function: int unur_urng_sample_array (UNUR_URNG* URNG, double* X, int DIM) Set array X of length DIM with uniform random numbers sampled from generator URNG. If URNG is the ‘NULL’ pointer, the default uniform generator is used. _Important:_ If URNG is based on a point set generator (this is the case for generators of low discrepance point sets as used in quasi-Monte Carlo methods) it has a “natural dimension†s. In this case either only the first s entries of X are filled (if s < DIM), or the first DIM coordinates of the generated point are filled. The called returns the actual number of entries filled. In case of an error ‘0’ is returned. -- Function: int unur_urng_reset (UNUR_URNG* URNG) Reset URNG object. The routine tries two ways to reset the generator (in this order): 1. It uses the reset function given by an ‘unur_urng_set_reset’ call. 2. It uses the seed given by the last ‘unur_urng_seed’ call (which requires a seeding function given by a ‘unur_urng_set_seed’ call). If neither of the two methods work resetting of the generator is not possible and an error code is returned. If the ‘NULL’ pointer is given, the default uniform generator is reset. -- Function: int unur_urng_sync (UNUR_URNG* URNG) Jump into defined state ("sync") of the generator. This is useful when point generators are used where the coordinates are sampled via ‘unur_urng_sample’. Then this call can be used to jump to the first coordinate of the next generated point. -- Function: int unur_urng_seed (UNUR_URNG* URNG, unsigned LONG SEED) Set SEED for generator URNG. It returns an error code if this is not possible for the given URNG. If the ‘NULL’ pointer is given, the default uniform generator is seeded (if possible). _Notice_: Seeding should be done only once for a particular generator (except for resetting it to the initial state). Expertise is required when multiple seeds are used to get independent streams. Thus we recommend appropriate libraries for this task, e.g. Pierre L’Ecuyer’s ‘RngStreams’ package. For this library only a package seed can be set and thus the ‘unur_urng_seed’ call will not have any effect to generators of this type. Use ‘unur_urng_reset’ or ‘unur_urng_rngstream_new’ instead, depending whether one wants to reset the stream or get a new stream that is independent from the previous ones. -- Function: int unur_urng_anti (UNUR_URNG* URNG, int ANTI) Switch to antithetic random numbers in URNG. It returns an error code if this is not possible for the given URNG. If the ‘NULL’ pointer is given, the antithetic flag of the default uniform generator is switched (if possible). -- Function: int unur_urng_nextsub (UNUR_URNG* URNG) Jump to start of the next substream of URNG. It returns an error code if this is not possible for the given URNG. If the ‘NULL’ pointer is given, the default uniform generator is set to the start of the next substream (if possible). -- Function: int unur_urng_resetsub (UNUR_URNG* URNG) Jump to start of the current substream of URNG. It returns an error code if this is not possible for the given URNG. If the ‘NULL’ pointer is given, the default uniform generator is set to the start of the current substream (if possible). -- Function: int unur_gen_sync (UNUR_GEN* GENERATOR) -- Function: int unur_gen_seed (UNUR_GEN* GENERATOR, unsigned LONG SEED) -- Function: int unur_gen_anti (UNUR_GEN* GENERATOR, int ANTI) -- Function: int unur_gen_reset (UNUR_GEN* GENERATOR) -- Function: int unur_gen_nextsub (UNUR_GEN* GENERATOR) -- Function: int unur_gen_resetsub (UNUR_GEN* GENERATOR) Analogous to ‘unur_urng_sync’, ‘unur_urng_seed’ , ‘unur_urng_anti’, ‘unur_urng_reset’ , ‘unur_urng_nextsub’, and ‘unur_urng_resetsub’, but act on the URNG object used by the GENERATOR object. _Warning:_ These calls should be used with care as it influences all generator objects that share the same URNG object! API to create a new URNG object ------------------------------- _Notice:_ These functions are provided to built a UNUR_URNG object for a particular external random number generator from scratch. For some libraries that contain random number generators (like the GSL) there are special calls, e.g. ‘unur_urng_gsl_new’, to get such an object. Then there is no need to change the UNUR_URNG object as it already contains all available features. If you have a particular library for random number generators you can either write wrapper function like those in ‘src/uniform/urng_gsl.c’ or write an email to the authors of UNU.RAN to write it for you. -- Function: UNUR_URNG* unur_urng_new (double (* SAMPLEUNIF)(void* state ), void* STATE) Get a new URNG object. SAMPLEUNIF is a function to the uniform sampling routine, STATE a pointer to its arguments which usually contains the state variables of the generator. Functions SAMPLEUNIF with a different type for P or without an argument at all also work. A typecast might be necessary to avoid compiler warnings or error messages. For functions SAMPLEUNIF that does not have any argument should use ‘NULL’ for STATE. _Important:_ SAMPLEUNIF must not be the ‘NULL’ pointer. There are appropriate calls that simplifies the task of creating URNG objects for some libraries with uniform random number generators, see below. -- Function: void unur_urng_free (UNUR_URNG* URNG) Destroy URNG object. It returns an error code if this is not possible. If the ‘NULL’ is given, this function does nothing. _Warning:_ This call must be used with care. The URNG object must not be used by any existing generator object! It is designed to work in conjunction with the wrapper functions to create URNG objects for generators of a particular library. Thus an object created by an ‘unur_urng_prng_new’ call can be simply destroyed by an ‘unur_urng_free’ call. -- Function: int unur_urng_set_sample_array (UNUR_URNG* URNG, unsigned int(* SAMPLEARRAY)(void* state, double* X, int DIM )) Set function to fill array X of length DIM with random numbers generated by generator URNG (if available). -- Function: int unur_urng_set_sync (UNUR_URNG* URNG, void (* SYNC)(void* state )) Set function for jumping into a defined state (“syncâ€). -- Function: int unur_urng_set_seed (UNUR_URNG* URNG, void (* SETSEED)(void* state, unsigned LONG SEED )) Set function to seed generator URNG (if available). -- Function: int unur_urng_set_anti (UNUR_URNG* URNG, void (* SETANTI)(void* state, int ANTI )) Set function to switch the antithetic flag of generator URNG (if available). -- Function: int unur_urng_set_reset (UNUR_URNG* URNG, void (* RESET)(void* state )) Set function for reseting the uniform random number generator URNG (if available). -- Function: int unur_urng_set_nextsub (UNUR_URNG* URNG, void (* NEXTSUB)(void* state )) Set function that allows jumping to start of the next substream of URNG (if available). -- Function: int unur_urng_set_resetsub (UNUR_URNG* URNG, void (* RESETSUB)(void* state )) Set function that allows jumping to start of the current substream of URNG (if available). -- Function: int unur_urng_set_delete (UNUR_URNG* URNG, void (* FPDELETE)(void* state )) Set function for destroying URNG (if available). 6.1 Simple interface for uniform random number generators ========================================================= Simple interface for URNGs of type ‘double uniform(void *state)’. UNU.RAN contains some build-in URNGs of this type: ‘unur_urng_MRG31k3p’ Combined multiple recursive generator by Pierre L’Ecuyer and Renee Touzin. ‘unur_urng_fish’ Linear congruential generator by Fishman and Moore. ‘unur_urng_mstd’ Linear congruential generator "Minimal Standard" by Park and Miller. Notice, however, that these generators are provided as a fallback for the case that no state-of-the-art uniform random number generators (e.g. *note Pierre L’Ecuyer’s ‘Rngstream’ library: URNG-RNGSTREAM.) are used. How To Use .......... Create an URNG object using ‘unur_urng_fvoid_new’. By this call a pointer to the sampling routine and (optional) a pointer to a reset routine are copied into the URNG object. Other functions, like seeding the URNG, switching to antithetic random number, or jumping to next substream, can be added to the URNG object by the respective calls, e.g. by ‘unur_urng_set_seed’. The following routines are supported for URNG objects of this type: − ‘unur_urng_sample’ − ‘unur_urng_sample_array’ − ‘unur_urng_seed’ [optional] − ‘unur_urng_reset’ [optional] − ‘unur_urng_free’ Function reference ------------------ -- Function: UNUR_URNG* unur_urng_fvoid_new (double (* URAND)(void* state ), void (* RESET)(void* state )) Make a URNG object for a generator that consists of a single function call URAND. If there is no RESET function use ‘NULL’ for the second argument. 6.2 Interface to GSL uniform random number generators ===================================================== Interface to the uniform random number generators from the GNU Scientific Library (GSL). Documentation and source code of this library is available from . The interface to the GSL must be compiled into UNU.RAN using the configure flag ‘--with-urng-gsl’. Notice that the GSL has to be installed before running ‘./configure’. How To Use .......... When using this interface ‘unuran_urng_gsl.h’ must be included in the corresponding C file, i.e., one must add the line #include Moreover, one must not forget to link the executable against ‘libgsl’. The following routines are supported for URNG objects of type GSL: − ‘unur_urng_sample’ − ‘unur_urng_sample_array’ − ‘unur_urng_seed’ − ‘unur_urng_reset’ − ‘unur_urng_free’ /* ------------------------------------------------------------- */ /* File: example_gsl.c */ /* ------------------------------------------------------------- */ #ifdef UNURAN_SUPPORTS_GSL /* ------------------------------------------------------------- */ /* This example makes use of the GSL library for generating */ /* uniform random numbers. */ /* (see http://www.gnu.org/software/gsl/) */ /* To compile this example you must have set */ /* ./configure --with-urng-gsl */ /* (Of course the executable has to be linked against the */ /* GSL library.) */ /* ------------------------------------------------------------- */ /* Include UNURAN header files. */ #include #include /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; /* will hold the random number */ /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Declare objects for uniform random number generators. */ UNUR_URNG *urng; /* uniform generator objects */ /* GNU Scientific Library only: */ /* Make a object for uniform random number generator. */ urng = unur_urng_gsl_new(gsl_rng_mt19937); if (urng == NULL) exit (EXIT_FAILURE); /* Create a generator object using this URNG */ distr = unur_distr_normal( NULL, 0 ); par = unur_tdr_new(distr); unur_set_urng( par, urng ); gen = unur_init(par); if (gen == NULL) exit (EXIT_FAILURE); unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* Destroy objects */ unur_free(gen); unur_urng_free(urng); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ #else #include #include int main(void) { printf("You must enable the GSL to run this example!\n\n"); exit (77); /* exit code for automake check routines */ } #endif /* ------------------------------------------------------------- */ Function reference ------------------ -- Function: UNUR_URNG* unur_urng_gsl_new (const GSL_RNG_TYPE* URNGTYPE) Make object for URNGs from the ‘GSL’ (GNU Scientific Library). URNGTYPE is the type of the chosen generator as described in the GSL manual (see Section Random Number Generation). This library is available from . -- Function: UNUR_URNG* unur_urng_gslptr_new (gsl_rng* URNG) Similar to ‘unur_urng_gsl_new’ but it uses a pointer to a generator object as returned by ‘gsl_rng_alloc(rng_type)’; see ‘GSL’ manual for details. _Notice_: There is a subtle but important difference between these two calls. When a generator object is created by a ‘unur_urng_gsl_new’ call, then resetting of the generator works. When a generator object is created by a ‘unur_urng_gslptr_new’ call, then resetting only works after a ‘unur_urng_seed(urng,myseed)’ call. 6.3 Interface to GSL generators for quasi-random points ======================================================= Interface to the generators for quasi-random points (also called low discrepancy point sets) from the GNU Scientific Library (GSL). Documentation and source code of this library is available from . The interface to the GSL must be compiled into UNU.RAN using the configure flag ‘--with-urng-gsl’. Notice that the GSL has to be installed before running ‘./configure’. How To Use .......... When using this interface ‘unuran_urng_gsl.h’ must be included in the corresponding C file, i.e., one must add the line #include Moreover, one must not forget to link the executable against ‘libgsl’. The following routines are supported for URNG objects of this type: − ‘unur_urng_sample’ − ‘unur_urng_sample_array’ − ‘unur_urng_reset’ − ‘unur_urng_sync’ − ‘unur_urng_free’ ‘unur_urng_sync’ is used to jump to the first coordinate of the next point generated by the generator. Function reference ------------------ -- Function: UNUR_URNG* unur_urng_gslqrng_new (const GSL_QRNG_TYPE* QRNGTYPE, unsigned INT DIM) Make object for quasi-random point generators for dimension DIM from the ‘GSL’ (GNU Scientific Library). QRNGTYPE is the type of the chosen generator as described in the GSL manual (see section Quasi-Random Sequences). This library is available from . 6.4 Interface to Otmar Lendl’s pseudo-random number generators ============================================================== URNGs from Otmar Lendl’s ‘prng’ library. It provides a very flexible way to sample form arbitrary URNGs by means of an object oriented programing paradigma. Similarly to the UNU.RAN library independent generator objects can be build and used. This library has been developed by the pLab group at the university of Salzburg (Austria, EU) and implemented by Otmar Lendl. It is available from or from the pLab site at . The interface to the PRNG library must be compiled into UNU.RAN using the configure flag ‘--with-urng-prng’. Notice that the PRNG library has to be installed before running ‘./configure’. How To Use .......... When using this interface ‘unuran_urng_prng.h’ must be included in the corresponding C file, i.e., one must add the line #include Moreover, one must not forget to link the executable against ‘libprng’. The following routines are supported for URNG objects of type PRNG: − ‘unur_urng_sample’ − ‘unur_urng_sample_array’ − ‘unur_urng_seed’ (availability depends on chosen PRNG generator!) − ‘unur_urng_reset’ − ‘unur_urng_free’ Function reference ------------------ -- Function: UNUR_URNG* unur_urng_prng_new (const CHAR* PRNGSTR) Make object for URNGs from Otmar Lendl’s ‘prng’ package. PRNGSTR is a string that contains the necessary information to create a uniform random number generator. For the format of this string see the ‘prng’ user manual. The ‘prng’ library provides a very flexible way to sample form arbitrary URNGs by means of an object oriented programing paradigma. Similarly to the UNU.RAN library independent generator objects can be build and used. The library has been developed and implemented by Otmar Lendl as member of the pLab group at the university of Salzburg (Austria, EU). It is available via anonymous ftp from or from the pLab site at . -- Function: UNUR_URNG* unur_urng_prngptr_new (struct PRNG* URNG) Similar to ‘unur_urng_prng_new’ but it uses a pointer to a generator object as returned by ‘prng_new(prngstr)’; see ‘prng’ manual for details. 6.5 Interface to L’Ecuyer’s RNGSTREAM random number generators ============================================================== URNGs from Pierre L’Ecuyer’s ‘RngStream’ library for multiple independent streams of pseudo-random numbers. This library provides multiple independent streams of pseudo-random numbers which itselves can be splitted into many substreams. It is available from . A GNU-style package is available from . The interface to the RngStream library must be compiled into UNU.RAN using the configure flag ‘--with-urng-rngstream’. Notice that the RngStream library has to be installed before running ‘./configure’. How To Use .......... When using this interface ‘unuran_urng_rngstream.h’ must be included in the corresponding C file, i.e., one must add the line #include Moreover, one must not forget to link the executable against the ‘RngStream’ library (i.e., when using the GNU-style package in UNIX like environments one has to add ‘-lrngstreams’ when linking an executable). Notice that the ‘rngstream’ library uses a package seed, that means one should seed the uniform random number generator only once in an application using the routine ‘RngStream_SetPackageSeed’: unsigned long seed[] = {111u, 222u, 333u, 444u, 555u, 666u}; RngStream_SetPackageSeed(seed); The following routines are supported for URNG objects of this type: − ‘unur_urng_sample’ − ‘unur_urng_sample_array’ − ‘unur_urng_reset’ − ‘unur_urng_nextsub’ − ‘unur_urng_resetsub’ − ‘unur_urng_anti’ − ‘unur_urng_free’ Function reference ------------------ -- Function: UNUR_URNG* unur_urng_rngstream_new (const CHAR* URNGSTR) Make object for URNGs from Pierre L’Ecuyer’s ‘RngStream’ library. URNGSTR is an arbitrary string to label a stream. It need not be unique. -- Function: UNUR_URNG* unur_urng_rngstreamptr_new (RngStream RNGSTREAM) Similar to ‘unur_urng_rngstream_new’ but it uses a pointer to a generator object as returned by ‘RngStream_CreateStream()’. 6.6 Combine point set generator with random shifts ================================================== Generators of type RANDOMSHIFT combine a point set generator with generators to apply random shifts as proposed in [CPa76] : 1. Sample and store a random vector S. 2. Run a QMC simulation where S is added to each point of the generated quasi-random point (mod 1). 3. Repeat steps 1 and 2. How To Use .......... Create a URNG object for a point set generator and a URNG object for a generator to create shift vectors at random. The meta URNG object can then be created using ‘unur_urng_randomshift_new’. Notice that only pointers to the two underlying URNG generator objects are copied into the newly created meta generator. Thus manipulating the meta URNG also changes the underlying URNGs and vice versa. The following routines are supported for URNG objects of type RANDOMSHIFT: − ‘unur_urng_sample’ − ‘unur_urng_sample_array’ − ‘unur_urng_reset’ − ‘unur_urng_sync’ − ‘unur_urng_randomshift_nextshift’ − ‘unur_urng_free’ ‘unur_urng_sync’ is used to jump to the first coordinate of the next point generated by the generator. ‘unur_urng_randomshift_nextshift’ allows to replace the shift vector by another randomly chosen shift vector. _Important:_ ‘unur_urng_sync’ is only available if it is if it is implemented for the underlying point set generator. _Important:_ ‘unur_urng_reset’ is only available if it is available for both underlying generators. Function reference ------------------ -- Function: UNUR_URNG* unur_urng_randomshift_new (UNUR_URNG* QRNG, UNUR_URNG* SRNG, int DIM) Make object for URNG with randomly shifted point sets. QRNG is a generated that generates point sets of dimension DIM. SRNG is a generated that generates random numbers or vectors. _Notice:_ Only pointers to the respective objects QRNG and SRNG are copied into the created meta generator. Thus manipulating the meta URNG also changes the underlying URNGs and vice versa. -- Function: int unur_urng_randomshift_nextshift (UNUR_URNG* URNG) Get the next (randomly chosen) vector for shifting the points set, and the underlying point generator QRNG is reset. 7 UNU.RAN Library of standard distributions ******************************************* Although it is not its primary target, many distributions are already implemented in UNU.RAN. This section presents these available distributions and their parameters. The syntax to get a distribuion object for distributions ‘’ is: -- --: UNUR_DISTR* unur_distr_ (double* PARAMS, int N_PARAMS) PARAMS is an array of doubles of size N_PARAMS holding the parameters. E.g. to get an object for the gamma distribution (with shape parameter) use unur_distr_gamma( params, 1 ); Distributions may have default parameters with need not be given explicitely. E.g. The gamma distribution has three parameters: the shape, scale and location parameter. Only the (first) shape parameter is required. The others can be omitted and are then set by default values. /* alpha = 5; default: beta = 1, gamma = 0 */ double fpar[] = {5.}; unur_distr_gamma( fpar, 1 ); /* alpha = 5, beta = 3; default: gamma = 0 */ double fpar[] = {5., 3.}; unur_distr_gamma( fpar, 2 ); /* alpha = 5, beta = 3, gamma = -2 double fpar[] = {5., 3., -2.}; unur_distr_gamma( fpar, 3 ); *Important:* Naturally the computational accuracy limits the possible parameters. There shouldn’t be problems when the parameters of a distribution are in a “reasonable†range but e.g. the normal distribution N(10^15,1) won’t yield the desired results. (In this case it would be better generating N(0,1) and _then_ transform the results.) Of course computational inaccuracy is not specific to UNU.RAN and should always be kept in mind when working with computers. _Important:_ The routines of the standard library are included for non-uniform random variate generation and not to provide special functions for statistical computations. Remark ------ The following keywords are used in the tables: PDF probability density function, with variable x. PMF probability mass function, with variable k. constant normalization constant for given PDF and PMF, resp. They must be multiplied by constant to get the “real†PDF and PMF. CDF gives information whether the CDF is implemented in UNU.RAN. domain domain PDF and PMF, resp. parameters N_STD (N_TOTAL): list list of parameters for distribution, where N_STD is the number of parameters for the standard form of the distribution and N_TOTAL the total number for the (non-standard form of the) distribution. LIST is the list of parameters in the order as they are stored in the array of parameters. Optional parameter that can be omitted are enclosed in square brackets ‘[...]’. A detailed list of these parameters gives then the range of valid parameters and defaults for optional parameters that are used when these are omitted. reference gives reference for distribution (*note Bibliography::). special generators lists available special generators for the distribution. The first number is the variant that to be set by ‘unur_cstd_set_variant’ and ‘unur_dstd_set_variant’ call, respectively. If no variant is set the default variant ‘DEF’ is used. In the table the respective abbreviations ‘DEF’ and ‘INV’ are used for ‘UNUR_STDGEN_DEFAULT’ and ‘UNUR_STDGEN_INVERSION’. Also the references for these methods are given (*note Bibliography::). Notice that these generators might be slower than universal methods. If ‘DEF’ is ommited, the first entry is the default generator. 7.1 UNU.RAN Library of continuous univariate distributions ========================================================== 7.1.1 ‘F’ – F-distribution -------------------------- PDF: (x^(nu_1/2-1)) / (1+nu_1/nu_2 x)^((nu_1+nu_2)/2) constant: (nu_1/nu_2)^(nu_1/2) / B(nu_1/2,nu_2/2) domain: 0 < x < infinity parameters 2 (2): nu_1, nu_2 No. name default ‘[0]’ nu_1 > 0 (scale) ‘[1]’ nu_2 > 0 (scale) reference: [JKBc95: Ch.27; p.322] 7.1.2 ‘beta’ – Beta distribution -------------------------------- PDF: (x-a)^(p-1) * (b-x)^(q-1) constant: 1 / (B(p,q) * (b-a)^(p+q-1)) domain: a < x < b parameters 2 (4): p, q [, a, b ] No. name default ‘[0]’ p > 0 (scale) ‘[1]’ q > 0 (scale) ‘[2]’ a 0 (location, scale) ‘[3]’ b > a 1 (location, scale) reference: [JKBc95: Ch.25; p.210] 7.1.3 ‘cauchy’ – Cauchy distribution ------------------------------------ PDF: 1/(1 + ((x-theta)/lambda)^2) constant: 1/(pi * lambda) domain: -infinity < x < infinity parameters 0 (2): [ theta [, lambda ] ] No. name default ‘[0]’ theta 0 (location) ‘[1]’ lambda > 0 1 (scale) reference: [JKBb94: Ch.16; p.299] special generators: ‘INV’ Inversion method 7.1.4 ‘chi’ – Chi distribution ------------------------------ PDF: x^(nu-1) * exp( -x^2/2 ) constant: 1 / (2^((nu/2)-1) * Gamma(nu/2)) domain: 0 <= x < infinity parameters 1 (1): nu No. name default ‘[0]’ nu > 0 (shape) reference: [JKBb94: Ch.18; p.417] special generators: ‘DEF’ Ratio of Uniforms with shift (only for nu >= 1) [MJa87] 7.1.5 ‘chisquare’ – Chisquare distribution ------------------------------------------ PDF: x^((nu/2)-1) * exp( -x/2 ) constant: 1 / (2^(nu/2) * Gamma(nu/2)) domain: 0 <= x < infinity parameters 1 (1): nu No. name default ‘[0]’ nu > 0 (shape (degrees of freedom)) reference: [JKBb94: Ch.18; p.416] 7.1.6 ‘exponential’ – Exponential distribution ---------------------------------------------- PDF: exp( -(x-theta)/sigma) constant: 1/sigma domain: theta <= x < infinity parameters 0 (2): [ sigma [, theta ] ] No. name default ‘[0]’ sigma > 0 1 (scale) ‘[1]’ theta 0 (location) reference: [JKBb94: Ch.19; p.494] special generators: ‘INV’ Inversion method 7.1.7 ‘extremeI’ – Extreme value type I (Gumbel-type) distribution ------------------------------------------------------------------ PDF: exp( -exp( -(x-zeta)/theta ) - (x-zeta)/theta ) constant: 1/theta domain: -infinity < x 0 1 (scale) reference: [JKBc95: Ch.22; p.2] special generators: ‘INV’ Inversion method 7.1.8 ‘extremeII’ – Extreme value type II (Frechet-type) distribution --------------------------------------------------------------------- PDF: exp( -((x-zeta)/theta)^(-k)) * ((x-zeta)/theta)^(-k-1) constant: k/theta domain: zeta < x 0 (shape) ‘[1]’ zeta 0 (location) ‘[2]’ theta > 0 1 (scale) reference: [JKBc95: Ch.22; p.2] special generators: ‘INV’ Inversion method 7.1.9 ‘gamma’ – Gamma distribution ---------------------------------- PDF: ((x-gamma)/beta)^(alpha-1) * exp( -(x-gamma)/beta ) constant: 1 / (beta * Gamma(alpha)) domain: gamma < x < infinity parameters 1 (3): alpha [, beta [, gamma ] ] No. name default ‘[0]’ alpha > 0 (shape) ‘[1]’ beta > 0 1 (scale) ‘[2]’ gamma 0 (location) reference: [JKBb94: Ch.17; p.337] special generators: ‘DEF’ Acceptance Rejection combined with Acceptance Complement [ADa74] [ADa82] ‘2’ Rejection from log-logistic envelopes [CHa77] 7.1.10 ‘gig’ – Generalized Inverse Gaussian distribution -------------------------------------------------------- PDF: x^(theta-1) * exp( -1/2 * omega * (x/eta + eta/x)) constant: not implemented! CDF: not implemented! domain: 0 < x 0 (scale) ‘[2]’ eta > 0 1 (shape) reference: [JKBb94: Ch.15; p.84] special generators: ‘DEF’ Ratio-of-Uniforms method [Dag89] 7.1.11 ‘gig2’ – Generalized Inverse Gaussian distribution --------------------------------------------------------- PDF: x^(theta-1) * exp( -1/2 * (chi/x + psi*x)) constant: not implemented! CDF: not implemented! domain: 0 < x 0 (shape) ‘[2]’ chi > 0 (shape) reference: [JKBb94: Ch.15; p.84] 7.1.12 ‘hyperbolic’ – Hyperbolic distribution --------------------------------------------- PDF: exp( -alpha * sqrt(delta^2 + (x - mu)^2) + beta*(x-mu) ) constant: not implemented! CDF: not implemented! domain: -infinity < x |beta| (shape (tail)) ‘[1]’ beta (shape (asymmetry)) ‘[2]’ delta > 0 (scale) ‘[3]’ mu (location) 7.1.13 ‘ig’ – Inverse Gaussian distribution ------------------------------------------- PDF: sqrt( lambda/2*pi*x^3 ) * exp( -(lambda*(x-mu)^2)/2*mu^2*x ) constant: 1 CDF: not implemented! domain: 0 < x 0 (mean) ‘[1]’ lambda > 0 (shape) reference: [JKBb94: Ch.15; p.259] 7.1.14 ‘laplace’ – Laplace distribution --------------------------------------- PDF: exp( -|x-theta| / phi ) constant: 1/(2 * phi) domain: -infinity < x 0 1 (scale) reference: [JKBc95: Ch.24; p.164] special generators: ‘INV’ Inversion method 7.1.15 ‘logistic’ – Logistic distribution ----------------------------------------- PDF: exp(-(x-alpha)/beta) * (1 + exp(-(x-alpha)/beta))^(-2) constant: 1/beta domain: -infinity < x 0 1 (scale) reference: [JKBc95: Ch.23; p.115] special generators: ‘INV’ Inversion method 7.1.16 ‘lognormal’ – Log-Normal distribution -------------------------------------------- PDF: 1/(x-theta) * exp( -(log(x-theta)-zeta)^2/(2 sigma^2) ) constant: 1/(sigma * sqrt(2 pi)) domain: theta <= x < infinity parameters 2 (3): zeta, sigma [, theta ] No. name default ‘[0]’ zeta (shape) ‘[1]’ sigma > 0 (shape) ‘[2]’ theta 0 (location) reference: [JKBb94: Ch.14; p. 208] 7.1.17 ‘lomax’ – Lomax distribution (Pareto distribution of second kind) ------------------------------------------------------------------------ PDF: (x+C)^(-(a+1)) constant: a * C^a domain: 0 <= x < infinity parameters 1 (2): a [, C ] No. name default ‘[0]’ a > 0 (shape) ‘[1]’ C > 0 1 (scale) reference: [JKBb94: Ch.20; p.575] special generators: ‘INV’ Inversion method 7.1.18 ‘normal’ – Normal distribution ------------------------------------- PDF: exp( -1/2 * ((x-mu)/sigma)^2 ) constant: 1 / (sigma * sqrt(2 pi)) domain: -infinity < x < infinity parameters 0 (2): [ mu [, sigma ] ] No. name default ‘[0]’ mu 0 (location) ‘[1]’ sigma > 0 1 (scale) reference: [JKBb94: Ch.13; p.80] special generators: ‘DEF’ ACR method (Acceptance-Complement Ratio) [HDa90] ‘1’ Box-Muller method [BMa58] ‘2’ Polar method with rejection [MGa62] ‘3’ Kindermann-Ramage method [KRa76] ‘INV’ Inversion method (slow) 7.1.19 ‘pareto’ – Pareto distribution (of first kind) ----------------------------------------------------- PDF: x^(-(a+1)) constant: a * k^a domain: k < x < infinity parameters 2 (2): k, a No. name default ‘[0]’ k > 0 (shape, location) ‘[1]’ a > 0 (shape) reference: [JKBb94: Ch.20; p.574] special generators: ‘INV’ Inversion method 7.1.20 ‘powerexponential’ – Powerexponential (Subbotin) distribution -------------------------------------------------------------------- PDF: exp( -|x|^tau ) constant: 1 / (2 * Gamma(1+1/tau)) domain: -infinity < x < infinity parameters 1 (1): tau No. name default ‘[0]’ tau > 0 (shape) reference: [JKBc95: Ch.24; p.195] special generators: ‘DEF’ Transformed density rejection (only for tau >= 1) [DLa86] 7.1.21 ‘rayleigh’ – Rayleigh distribution ----------------------------------------- PDF: x * exp( -1/2 * (x/sigma)^2 ) constant: 1 / sigma^2 domain: 0 <= x < infinity parameters 1 (1): sigma No. name default ‘[0]’ sigma > 0 (scale) reference: [JKBb94: Ch.18; p.456] 7.1.22 ‘slash’ – Slash distribution ----------------------------------- PDF: (1 - exp(-x^2/2)) / x^2 constant: 1 / sqrt(2 pi) CDF: not implemented! domain: -infinity < x < infinity reference: [JKBb94: Ch.12; p.63] special generators: ‘DEF’ Ratio of normal and uniform random variates 7.1.23 ‘student’ – Student’s t distribution ------------------------------------------- PDF: (1+t^2/nu)^(-(nu+1)/2) constant: 1 / (sqrt(nu) * B(1/2,nu/2)) CDF: not implemented! domain: -infinity < x < infinity parameters 1 (1): nu No. name default ‘[0]’ nu > 0 (shape) reference: [JKBc95: Ch.28; p.362] 7.1.24 ‘triangular’ – Triangular distribution --------------------------------------------- PDF: 2*x / H, for 0 <= x <= H 2*(1-x) / (1-H), for H <= x <= 1 constant: 1 domain: 0 <= x <= 1 parameters 0 (1): [ H ] No. name default ‘[0]’ H 0 <= H <= 1 1/2 (shape) reference: [JKBc95: Ch.26; p.297] special generators: ‘INV’ Inversion method 7.1.25 ‘uniform’ – Uniform distribution --------------------------------------- PDF: 1 / (b-a) constant: 1 domain: a < x < b parameters 0 (2): [ a, b ] No. name default ‘[0]’ a 0 (location) ‘[1]’ b > a 1 (location) reference: [JKBc95: Ch.26; p.276] special generators: ‘INV’ Inversion method 7.1.26 ‘weibull’ – Weibull distribution --------------------------------------- PDF: ((x-zeta)/alpha)^(c-1) * exp( -((x-zeta)/alpha)^c ) constant: c / alpha domain: zeta < x < infinity parameters 1 (3): c [, alpha [, zeta ] ] No. name default ‘[0]’ c > 0 (shape) ‘[1]’ alpha > 0 1 (scale) ‘[2]’ zeta 0 (location) reference: [JKBb94: Ch.21; p.628] special generators: ‘INV’ Inversion method 7.2 UNU.RAN Library of continuous multivariate distributions ============================================================ 7.2.1 ‘copula’ – Copula (distribution with uniform marginals) ------------------------------------------------------------- ‘UNUR_DISTR *unur_distr_copula(int dim, const double *rankcorr)’ creates a distribution object for a copula with DIM components. RANKCORR is an array of size DIMxDIM and holds the rank correlation matrix (Spearman’s correlation), where the rows of the matrix are stored consecutively in this array. The ‘NULL’ pointer can be used instead the identity matrix. If COVAR is not a valid rank correlation matrix (i.e., not positive definite) then no distribution object is created and ‘NULL’ is returned. 7.2.2 ‘multicauchy’ – Multicauchy distribution ---------------------------------------------- PDF: f(x) = 1 / ( 1 + (x-mu)^t . Sigma^(-1) . (x-mu) )^((dim+1)/2) constant: Gamma((dim+1)/2) / ( pi^((dim+1)/2) * sqrt(det(Sigma)) ) domain: -infinity^(dim) < x < infinity^(dim) parameters 0 (2): [ mu, Sigma ] No. name default ‘[0]’ mu (0,...,0) (location) ‘[1]’ Sigma Symm, Pos. I (shape) def. special generators: ‘DEF’ Cholesky factor 7.2.3 ‘multiexponential’ – Multiexponential distribution -------------------------------------------------------- PDF: f(x) = Prod_(i=0)^(i=dim-1) exp(-(dim-i) (x_(i)-x_(i-1) - (theta_i-theta_(i-1)) ) / sigma_i); with x_(-1)=0 and theta_(i-1)=0 constant: Prod_(i=0)^(i=dim-1) 1/sigma_i domain: 0^(dim) <= x < infinity^(dim) parameters 0 (2): [ sigma, theta ] No. name default ‘[0]’ sigma (1,...,1) (shape) ‘[1]’ theta (0,...,0) (location) 7.2.4 ‘multinormal’ – Multinormal distribution ---------------------------------------------- PDF: f(x) = exp( -1/2 * (x-mu)^t . Sigma^(-1) . (x-mu) ) constant: 1 / ( (2 pi)^(dim/2) * sqrt(det(Sigma)) ) domain: -infinity^(dim) < x < infinity^(dim) parameters 0 (2): [ mu, Sigma ] No. name default ‘[0]’ mu (0,...,0) (location) ‘[1]’ Sigma Symm, Pos. I (shape) def. reference: [KBJe00: Ch.45; p.105] 7.2.5 ‘multistudent’ – Multistudent distribution ------------------------------------------------ PDF: f(x) = 1 / ( 1 + (x-mu)^t . Sigma^(-1) . (x-mu) / m)^((dim+m)/2) ) constant: Gamma((dim+m)/2) / ( Gamma(m/2) (m*pi)^(dim/2) * sqrt(det(Sigma)) ) domain: -infinity^(dim) < x < infinity^(dim) parameters 0 (3): [ m, mu, Sigma ] No. name default ‘[0]’ m m>0 1 (location) ‘[1]’ mu (0,...,0) (location) ‘[2]’ Sigma Symm, Pos. I (shape) def. 7.3 UNU.RAN Library of discrete univariate distributions ======================================================== At the moment there are no CDFs implemented for discrete distribution. Thus ‘unur_distr_discr_upd_pmfsum’ does not work properly for truncated distribution. 7.3.1 ‘binomial’ – Binomial distribution ---------------------------------------- PMF: (n \choose k) * p^k * (1-p)^(n-k) constant: 1 domain: 0 <= k <= n parameters 2 (2): n, p No. name default ‘[0]’ n >= 1 (no. of elements) ‘[1]’ p 0 < p < 1 (shape) reference: [JKKa92: Ch.3; p.105] special generators: ‘DEF’ Ratio of Uniforms/Inversion [STa89] 7.3.2 ‘geometric’ – Geometric distribution ------------------------------------------ PMF: p * (1-p)^k constant: 1 domain: 0 <= k < infinity parameters 1 (1): p No. name default ‘[0]’ p 0 < p < 1 (shape) reference: [JKKa92: Ch.5.2; p.201] special generators: ‘INV’ Inversion method 7.3.3 ‘hypergeometric’ – Hypergeometric distribution ---------------------------------------------------- PMF: (M \choose k) * (N-M \choose n-k) / (N \choose n) constant: 1 domain: max(0,n-N+M) <= k <= min(n,M) parameters 3 (3): N, M, n No. name default ‘[0]’ N >= 1 (no. of elements) ‘[1]’ M 1 <= M <= N (shape) ‘[2]’ n 1 <= n <= N (shape) reference: [JKKa92: Ch.6; p.237] special generators: ‘DEF’ Ratio of Uniforms/Inversion [STa89] 7.3.4 ‘logarithmic’ – Logarithmic distribution ---------------------------------------------- PMF: theta^k / k constant: - log( 1.-theta); domain: 1 <= k < infinity parameters 1 (1): theta No. name default ‘[0]’ theta 0 < theta < (shape) 1 reference: [JKKa92: Ch.7; p.285] special generators: ‘DEF’ Inversion/Transformation [KAa81] 7.3.5 ‘negativebinomial’ – Negative Binomial distribution --------------------------------------------------------- PMF: (k+r-1 \choose r-1) * p^r * (1-p)^k constant: 1 domain: 0 <= k < infinity parameters 2 (2): p, r No. name default ‘[0]’ p 0 < p < 1 (shape) ‘[1]’ r > 0 (shape) reference: [JKKa92: Ch.5.1; p.200] 7.3.6 ‘poisson’ – Poisson distribution -------------------------------------- PMF: theta^k / k! constant: exp(theta) domain: 0 <= k < infinity parameters 1 (1): theta No. name default ‘[0]’ theta > 0 (shape) reference: [JKKa92: Ch.4; p.151] special generators: ‘DEF’ Tabulated Inversion combined with Acceptance Complement [ADb82] ‘2’ Tabulated Inversion combined with Patchwork Rejection [ZHa94] 7.4 UNU.RAN Library of random matrices ====================================== 7.4.1 ‘correlation’ – Random correlation matrix ----------------------------------------------- ‘UNUR_DISTR *unur_distr_correlation( int n )’ creates a distribution object for a random correlation matrix of N rows and columns. It can be used with method MCORR (*note Random Correlation Matrix: MCORR.) to generate random correlation matrices of the given size. 8 Error handling and Debugging ****************************** UNU.RAN routines report an error whenever they cannot perform the requested task. Additionally it is possible to get information about the generated distribution of generator objects for debugging purposes. However, the latter must be enabled when compiling and installing the library. (It is disabled by default.) This chapter describes all necessary details: • Choose an output stream to for writing the requested information. • Select a debugging level. • Select an error handler. • Write your own error handler. • Get more information for a particular error code. 8.1 Output streams ================== UNU.RAN uses a logfile for writing all error messages, warnings, and debugging information onto an output stream. This stream can be set at runtime by the ‘unur_set_stream’ call. If no such stream is given by the user a default stream is used by the library: all messages are written into the file ‘unuran.log’ in the current working directory. The name of this logfile is defined by the macro ‘UNUR_LOG_FILE’ in ‘unuran_config.h’. (If UNU.RAN fails to open this file for writing, ‘stderr’ is used instead.) To destinguish between messages for different objects each of these has its own identifier which is composed by the name of the distribution obejct and generator type, resp., followed by a dot and three digits. (If there are more than 999 generators then the identifiers are not unique.) _Remark:_ Writting debugging information must be switched on at compile time using the configure flag ‘--enable-logging’, see *note Debugging: Debug. Function reference ------------------ -- Function: FILE* unur_set_stream (FILE* NEW_STREAM) This function sets a new file handler for the output stream, NEW_STREAM, for the UNU.RAN library routines. The previous handler is returned (so that you can restore it later). Note that the pointer to a user defined file handler is stored in a static variable, so there can be only one output stream handler per program. This function should be not be used in multi-threaded programs except to set up a program-wide error handler from a master thread. The ‘NULL’ pointer is not allowed. (If you want to disable logging of debugging information use unur_set_default_debug(UNUR_DEBUG_OFF) instead. If you want to disable error messages at all use ‘unur_set_error_handler_off’. ) -- Function: FILE* unur_get_stream (void) Get the file handle for the current output stream. It can be used to allow applications to write additional information into the logfile. 8.2 Debugging ============= The UNU.RAN library has several debugging levels which can be switched on/off by debugging flags. This debugging feature must be enabled when building the library using the ‘--enable-logging’ configure flag. The debugging levels range from print a short description of the created generator object to a detailed description of hat functions and tracing the sampling routines. The output is printed onto the debugging output stream (*note Output streams: Output_streams.). The debugging flags can be set or changed by the respective calls ‘unur_set_debug’ and ‘unur_chg_debug’ independently for each generator. By default flag ‘UNUR_DEBUG_INIT’ (see below) is used. This default flags is set by the macro ‘UNUR_DEBUGFLAG_DEFAULT’ in ‘unuran_config.h’ and can be changed at runtime by a ‘unur_set_default_debug’ call. Off course these debugging flags depend on the chosen method. Since most of these are merely for debugging the library itself, a description of the flags are given in the corresponding source files of the method. Nevertheless, the following flags can be used with all methods. Common debug flags: ‘UNUR_DEBUG_OFF’ switch off all debuging information ‘UNUR_DEBUG_ALL’ all avaivable information ‘UNUR_DEBUG_INIT’ parameters of generator object after initialization ‘UNUR_DEBUG_SETUP’ data created at setup ‘UNUR_DEBUG_ADAPT’ data created during adaptive steps ‘UNUR_DEBUG_SAMPLE’ trace sampling Notice that these are flags which could be combined using the ‘|’ operator. Almost all routines check a given pointer before they read from or write to the given address. This does not hold for time-critical routines like all sampling routines. Thus you are responsible for checking a pointer that is returned from a ‘unur_init’ call. However, it is possible to turn on checking for invalid ‘NULL’ pointers even in such time-critical routines by building the library using the ‘--enable-check-struct’ configure flag. Another debugging tool used in the library are magic cookies that validate a given pointer. It produces an error whenever a given pointer points to an object that is invalid in the context. The usage of magic cookies is also switched on by the ‘--enable-check-struct’ configure flag. Function reference ------------------ -- Function: int unur_set_debug (UNUR_PAR* PARAMETERS, unsigned DEBUG) Set debugging flags for generator. -- Function: int unur_chg_debug (UNUR_GEN* GENERATOR, unsigned DEBUG) Change debugging flags for generator. -- Function: int unur_set_default_debug (unsigned DEBUG) Change default debugging flag. 8.3 Error reporting =================== UNU.RAN routines report an error whenever they cannot perform the requested task. For example, applying transformed density rejection to a distribution that violates the T-concavity condition, or trying to set a parameter that is out of range, result in an error message. It might also happen that the setup fails for transformed density rejection for a T-concave distribution with some extreme density function simply because of round-off errors that makes the generation of a hat function numerically impossible. Situations like this may happen when using black box algorithms and you should check the return values of all routines. All ‘..._set_...’, and ‘..._chg_...’ calls return ‘UNUR_SUCCESS’ if they could be executed successfully. Otherwise, some error codes are returned if it was not possible to set or change the desired parameters, e.g. because the given values are out of range, or simply because the set call does not work for the chosen method. All routines that return a pointer to the requested object will return a ‘NULL’ pointer in case of error. (Thus you should always check the pointer to avoid possible segmentation faults. Sampling routines usually do not check the given pointer to the generator object.) The library distinguishes between two major classes of error: _(fatal) errors:_ The library was not able to construct the requested object. _warnings:_ Some problems encounters while constructing a generator object. The routine has tried to solve the problem but the resulting object might not be what you want. For example, chosing a special variant of a method does not work and the initialization routine might switch to another variant. Then the generator produces random variates of the requested distribution but correlation induction is not possible. However, it also might happen that changing the domain of a distribution has failed. Then the generator produced random variates with too large/too small range, i.e. their distribution is not correct. It is obvious from the example that this distinction between errors and warning is rather crude and sometimes arbitrary. UNU.RAN routines use the global variable UNUR_ERRNO to report errors, completely analogously to ERRNO in the ANSI C standard library. (However this approach is not thread-safe. There can be only one instance of a global variable per program. Different threads of execution may overwrite UNUR_ERRNO simultaneously). Thus when an error occurs the caller of the routine can examine the error code in UNUR_ERRNO to get more details about the reason why a routine failed. You get a short description of the error by a ‘unur_get_strerror’ call. All the error code numbers have prefix ‘UNUR_ERR_’ and expand to non-zero constant unsigned integer values. Error codes are divided into six main groups, see *note Error codes: Errno. Alternatively, the variable UNUR_ERRNO can also read by a ‘unur_get_errno’ call and can be reset by the ‘unur_reset_errno’ call (this is in particular required for the Windows version of the library). Additionally, there exists a error handler (*note Error handlers: Error_handlers.) that is invoked in case of an error. In addition to reporting errors by setting error codes in UNUR_ERRNO, the library also has an error handler function. This function is called by other library functions when they report an error, just before they return to the caller (*note Error handlers: Error_handlers.). The default behavior of the error handler is to print a short message: AROU.004: [error] arou.c:1500 - (generator) condition for method violated: AROU.004: ..> PDF not unimodal The purpose of the error handler is to provide a function where a breakpoint can be set that will catch library errors when running under the debugger. It is not intended for use in production programs, which should handle any errors using the return codes. Function reference ------------------ -- Variable: extern int unur_errno Global variable for reporting diagnostics of error. -- Function: int unur_get_errno (void) Get current value of global variable UNUR_ERRNO. -- Function: void unur_reset_errno (void) Reset global variable UNUR_ERRNO to ‘UNUR_SUCCESS’ (i.e., no errors occured). -- Function: const char* unur_get_strerror (const INT ERRNOCODE) Get a short description for error code value. 8.4 Error codes =============== List of error codes ................... • Procedure executed successfully (no error) ‘UNUR_SUCCESS (0x0u)’ success (no error) • Errors that occurred while handling distribution objects. ‘UNUR_ERR_DISTR_SET’ set failed (invalid parameter). ‘UNUR_ERR_DISTR_GET’ get failed (parameter not set). ‘UNUR_ERR_DISTR_NPARAMS’ invalid number of parameters. ‘UNUR_ERR_DISTR_DOMAIN’ parameter(s) out of domain. ‘UNUR_ERR_DISTR_GEN’ invalid variant for special generator. ‘UNUR_ERR_DISTR_REQUIRED’ incomplete distribution object, entry missing. ‘UNUR_ERR_DISTR_UNKNOWN’ unknown distribution, cannot handle. ‘UNUR_ERR_DISTR_INVALID’ invalid distribution object. ‘UNUR_ERR_DISTR_DATA’ data are missing. ‘UNUR_ERR_DISTR_PROP’ desired property does not exist • Errors that occurred while handling parameter objects. ‘UNUR_ERR_PAR_SET’ set failed (invalid parameter) ‘UNUR_ERR_PAR_VARIANT’ invalid variant -> using default ‘UNUR_ERR_PAR_INVALID’ invalid parameter object • Errors that occurred while handling generator objects. ‘UNUR_ERR_GEN’ error with generator object. ‘UNUR_ERR_GEN_DATA’ (possibly) invalid data. ‘UNUR_ERR_GEN_CONDITION’ condition for method violated. ‘UNUR_ERR_GEN_INVALID’ invalid generator object. ‘UNUR_ERR_GEN_SAMPLING’ sampling error. ‘UNUR_ERR_NO_REINIT’ reinit routine not implemented. ‘UNUR_ERR_NO_QUANTILE’ quantile routine not implemented. • Errors that occurred while handling URNG objects. ‘UNUR_ERR_URNG’ generic error with URNG object. ‘UNUR_ERR_URNG_MISS’ missing functionality. • Errors that occurred while parsing strings. ‘UNUR_ERR_STR’ error in string. ‘UNUR_ERR_STR_UNKNOWN’ unknown keyword. ‘UNUR_ERR_STR_SYNTAX’ syntax error. ‘UNUR_ERR_STR_INVALID’ invalid parameter. ‘UNUR_ERR_FSTR_SYNTAX’ syntax error in function string. ‘UNUR_ERR_FSTR_DERIV’ cannot derivate function. • Other run time errors. ‘UNUR_ERR_DOMAIN’ argument out of domain. ‘UNUR_ERR_ROUNDOFF’ (serious) round-off error. ‘UNUR_ERR_MALLOC’ virtual memory exhausted. ‘UNUR_ERR_NULL’ invalid ‘NULL’ pointer. ‘UNUR_ERR_COOKIE’ invalid cookie. ‘UNUR_ERR_GENERIC’ generic error. ‘UNUR_ERR_SILENT’ silent error (no error message). ‘UNUR_ERR_INF’ infinity occured. ‘UNUR_ERR_NAN’ NaN occured. ‘UNUR_ERR_COMPILE’ Requested routine requires different compilation switches. Recompilation of library necessary. ‘UNUR_ERR_SHOULD_NOT_HAPPEN’ Internal error, that should not happen. Please report this bug! 8.5 Error handlers ================== The default behavior of the UNU.RAN error handler is to print a short message onto the output stream, usually a logfile (*note Output streams: Output_streams.), e.g., AROU.004: [error] arou.c:1500 - (generator) condition for method violated: AROU.004: ..> PDF not unimodal This error handler can be switched off using the ‘unur_set_error_handler_off’ call, or replace it by a new one. Thus it allows to set a breakpoint that will catch library errors when running under the debugger. It also can be used to redirect error messages when UNU.RAN is included in general purpose libraries or in interactive programming environments. -- Data Type: UNUR_ERROR_HANDLER This is the type of UNU.RAN error handler functions. An error handler will be passed six arguments which specify the identifier of the object where the error occured (a string), the name of the source file in which it occurred (also a string), the line number in that file (an integer), the type of error (a string: ‘"error"’ or ‘"warning"’), the error number (an integert), and the reason for the error (a string). The source file and line number are set at compile time using the ‘__FILE__’ and ‘__LINE__’ directives in the preprocessor. The error number can be translated into a short description using a ‘unur_get_strerror’ call. An error handler function returns type ‘void’. Error handler functions should be defined like this, void my_handler( const char *objid, const char *file, int line, const char *errortype, int unur_errno, const char *reason ) To request the use of your own error handler you need the call ‘unur_set_error_handler’. Function reference ------------------ -- Function: UNUR_ERROR_HANDLER* unur_set_error_handler (UNUR_ERROR_HANDLER* NEW_HANDLER) This function sets a new error handler, NEW_HANDLER, for the UNU.RAN library routines. The previous handler is returned (so that you can restore it later). Note that the pointer to a user defined error handler function is stored in a static variable, so there can be only one error handler per program. This function should be not be used in multi-threaded programs except to set up a program-wide error handler from a master thread. To use the default behavior set the error handler to ‘NULL’. -- Function: UNUR_ERROR_HANDLER* unur_set_error_handler_off (void) This function turns off the error handler by defining an error handler which does nothing (except of setting UNUR_ERRNO. The previous handler is returned (so that you can restore it later). 9 Testing ********* The following routines can be used to test the performance of the implemented generators and can be used to verify the implementions. They are declared in ‘unuran_tests.h’ which has to be included. Function reference ------------------ -- Function: void unur_run_tests (UNUR_PAR* PARAMETERS, unsigned TESTS, FILE* OUT) Run a battery of tests. The following tests are available (use ‘|’ to combine these tests): ‘UNUR_TEST_ALL’ run all possible tests. ‘UNUR_TEST_TIME’ estimate generation times. ‘UNUR_TEST_N_URNG’ count number of uniform random numbers ‘UNUR_TEST_N_PDF’ count number of PDF calls ‘UNUR_TEST_CHI2’ run chi^2 test for goodness of fit ‘UNUR_TEST_SAMPLE’ print a small sample. All these tests can be started individually (see below). -- Function: void unur_test_printsample (UNUR_GEN* GENERATOR, int N_ROWS, int N_COLS, FILE* OUT) Print a small sample with N_ROWS rows and N_COLS columns. OUT is the output stream to which all results are written. -- Function: UNUR_GEN* unur_test_timing (UNUR_PAR* PARAMETERS, int LOG10_SAMPLESIZE, double* TIME_SETUP, double* TIME_SAMPLE, int VERBOSITY, FILE* OUT) Timing. PARAMETERS is an parameter object for which setup time and marginal generation times have to be measured. The results are written into TIME_SETUP and TIME_SAMPLE, respectively. LOG10_SAMPLESIZE is the common logarithm of the sample size that is used for timing. If VERBOSITY is ‘TRUE’ then a small table is printed to output stream OUT with setup time, marginal generation time and average generation times for generating 10, 100, ... random variates. All times are given in micro seconds and relative to the generation times for the underlying uniform random number (using the UNIF interface) and an exponential distributed random variate using the inversion method. The created generator object is returned. If a generator object could not be created successfully, then ‘NULL’ is returned. If VERBOSITY is ‘TRUE’ the result is written to the output stream OUT. Notice: All timing results are subject to heavy changes. Reruning timings usually results in different results. Minor changes in the source code can cause changes in such timings up to 25 percent. -- Function: double unur_test_timing_R (UNUR_PAR* PARAMETERS, const CHAR* DISTRSTR, const CHAR* METHODSTR, double LOG10_SAMPLESIZE, double* TIME_SETUP, double* TIME_MARGINAL) Timing. PARAMETERS is an parameter object for which setup time and marginal generation times have to be measured. The results are written into TIME_SETUP and TIME_MARGINAL, respectively. LOG10_SAMPLESIZE is the common logarithm of the sample size that is used for timing. Alternatively, one could provide the "parameter object" using strings DISTRSTR and METHODSTR as used for ‘unur_makegen_ssu’. The results are more accurate than those of function ‘unur_test_timing’ as the timings are computed using linear regression with several timings for sample size 1 and 10^LOG10_SAMPLESIZE. For each sample size total generation time (including setup) is measured 10 times. Since the these timings can be influenced by external effects (like disc sync or handling of interupts) the 2 fastest and the 3 slowest timings are discarded. Intercept and slope for simple linear regression are than stored and R^2 is returned. In case of an error ‘-100.’ is returned. Notice: All timing results are subject to heavy changes. Reruning timings usually results in different results. Minor changes in the source code can cause changes in such timings up to 25 percent. -- Function: double unur_test_timing_uniform (const UNUR_PAR* PARAMETERS, int LOG10_SAMPLESIZE) -- Function: double unur_test_timing_exponential (const UNUR_PAR* PARAMETERS, int LOG10_SAMPLESIZE) Marginal generation times for the underlying uniform random number (using the UNIF interface) and an exponential distributed random variate using the inversion method. These times are used in ‘unur_test_timing’ to compute the relative timings results. -- Function: double unur_test_timing_total (const UNUR_PAR* PARAMETERS, int SAMPLESIZE, double AVG_DURATION) Timing. PARAMETERS is an parameter object for which average times a sample of size SAMPLESIZE (including setup) are estimated. Thus sampling is repeated and the median of these timings is returned (in micro seconds). The number of iterations is computed automatically such that the total amount of time necessary for the test ist approximately AVG_DURATION (given in seconds). However, for very slow generator with expensive setup time the time necessary for this test may be (much) larger. If an error occurs then ‘-1’ is returned. Notice: All timing results are subject to heavy changes. Reruning timings usually results in different results. Minor changes in the source code can cause changes in such timings up to 25 percent. -- Function: int unur_test_count_urn (UNUR_GEN* GENERATOR, int SAMPLESIZE, int VERBOSITY, FILE* OUT) Count used uniform random numbers. It returns the total number of uniform random numbers required for a sample of non-uniform random variates of size SAMPLESIZE. In case of an error ‘-1’ is returned. If VERBOSITY is ‘TRUE’ the result is written to the output stream OUT. _Notice:_ This test uses global variables to store counters. Thus it is not thread save. -- Function: int unur_test_count_pdf (UNUR_GEN* GENERATOR, int SAMPLESIZE, int VERBOSITY, FILE* OUT) Count evaluations of PDF and similar functions. It returns the total number of evaluations of all such functions required for a sample of non-uniform random variates of size SAMPLESIZE. If VERBOSITY is ‘TRUE’ then a more detailed report is printed to the output stream OUT. In case of an error ‘-1’ is returned. This test is run on a copy of the given generator object. _Notice:_ The printed numbers of evaluation should be interpreted with care. For example, methods either use the PDF or the logPDF; if only the logPDF is given, but a method needs the PDF then both the logPDF and the PDF (a wrapper around the logPDF) are called and thus one call to the PDF is counted twice. _Notice:_ This test uses global variables to store function pointers and counters. Thus it is not thread save. -- Function: int unur_test_par_count_pdf (UNUR_PAR* PARAMETERS, int SAMPLESIZE, int VERBOSITY, FILE* OUT) Same as ‘unur_test_count_pdf’ except that it is run on a parameter object. Thus it also prints the number of function evaluations for the setup. The temporary created generator object is destroyed before the results are returned. -- Function: double unur_test_chi2 (UNUR_GEN* GENERATOR, int INTERVALS, int SAMPLESIZE, int CLASSMIN, int VERBOSITY, FILE* OUT) Run a Chi^2 test with the GENERATOR. The resulting p-value is returned. It works with discrete und continuous univariate distributions. For the latter the CDF of the distribution is required. INTERVALS is the number of intervals that is used for continuous univariate distributions. SAMPLESIZE is the size of the sample that is used for testing. If it is set to ‘0’ then a sample of size INTERVALS^2 is used (bounded to some upper bound). CLASSMIN is the minimum number of expected entries per class. If a class has to few entries then some classes are joined. VERBOSITY controls the output of the routine. If it is set to ‘1’ then the result is written to the output stream OUT. If it is set to ‘2’ additionally the list of expected and observed data is printed. If it is set to ‘3’ then all generated numbers are printed. There is no output when it is set to ‘0’. _Notice:_ For multivariate distributions the generated points are transformed by the inverse of the Cholesky factor of the covariance matrix and the mean vectors (if given for the underlying distribution). The marginal distributions of the transformed vectors are then tested against the marginal distribution given by a ‘unur_distr_cvec_set_marginals’ or ‘unur_distr_cvec_set_marginal_array’ call. (Notice that these marginal distributions are never set by default for any of the distributions provided by UNU.RAN.) Then the Bonferroni corrected p-value of all these tests is returned. However, the test may not be performed correctly if the domain of the underlying distribution is truncated by a ‘unur_distr_cvec_set_domain_rect’ call and the components of the distribution are correlated (i.e. ‘unur_distr_cvec_set_covar’ is called with the non-NULL argument). Then it almost surely will fail. -- Function: int unur_test_moments (UNUR_GEN* GENERATOR, double* MOMENTS, int N_MOMENTS, int SAMPLESIZE, int VERBOSITY, FILE* OUT) Computes the first N_MOMENTS central moments for a sample of size SAMPLESIZE. The result is stored into the array MOMENTS. N_MOMENTS must be an integer between ‘1’ and ‘4’. For multivariate distributions the moments are stored consecutively for each dimension and the provided MOMENTS-array must have a length of at least (N_MOMENTS+1) * DIM, where DIM is the dimension of the multivariate distribution. The M’th moment for the D’th dimension (0<=D 0 1 2 3 4 5 This algorithm is so simple that inversion is certainly the method of choice if the inverse CDF is available in closed form. This is the case e.g. for the exponential and the Cauchy distribution. The inversion method also has other special advantages that make it even more attractive for simulation purposes. It preserves the structural properties of the underlying uniform pseudo-random number generator. Consequently it can be used, e.g., for variance reduction techniques, it is easy to sample from truncated distributions, from marginal distributions, and from order statistics. Moreover, the quality of the generated random variables depends only on the underlying uniform (pseudo-) random number generator. Another important advantage of the inversion method is that we can easily characterize its performance. To generate one random variate we always need exactly one uniform variate and one evaluation of the inverse CDF. So its speed mainly depends on the costs for evaluating the inverse CDF. Hence inversion is often considered as the method of choice in the simulation literature. Unfortunately computing the inverse CDF is, for many important standard distributions (e.g. for normal, student, gamma, and beta-distributions), comparatively difficult and slow. Often no such routines are available in standard programming libraries. Then numerical methods for inverting the CDF are necessary, e.g. Newton’s method or (polynomial or rational) approximations of the inverse CDF. Such procedures, however, have the disadvantage that they are not exact and/or slow. UNU.RAN implements several methods: NINV (*note NINV::), HINV (*note HINV::) and PINV (*note PINV::). For such approximate inversion methods the approximation error is important for the quality of the generated point set. Let X=G^(-1)(U) denote the approximate inverse CDF, and let F and F^(-1) be the exact CDF and inverse CDF of the distribution, resp. There are three measures for the approximation error: _u-error_ is given by uerror = |U-F(G^(-1)(U))| Goodness-of-fit tests like the Kolmogorov-Smirnov test or the chi-squared test look at this type of error. We are also convinced that it is the most suitable error measure for Monte Carlo simulations as pseudo-random numbers and points of low discrepancy sets are located on a grid of restricted resolution. _x-error_ is given by absolute xerror = |F^(-1)(U)-G^(-1)(U)| relative xerror = |F^(-1)(U)-G^(-1)(U)| * |F^(-1)(U)| The x-error measure the deviation of G^(-1)(U) from the exact result. This measure is suitable when the inverse CDF is used as a quantile function in some computations. The main problem with the x-error is that we have to use the _absolute x-error_ for X=F^(-1)(U) close to zero and the _relative x-error_ in the tails. We use the terms _u-resolution_ and _x-resolution_ as the maximal tolerated u-error and x-error, resp. UNU.RAN allows to set u-resolution and x-resolution independently. Both requirements must be fulfilled. We use the following strategy for checking whether the precision goal is reached: _checking u-error:_ The u-error must be slightly smaller than the given u-resolution: |U-F(G^(-1)(U))| < 0.9 * uresolution. There is no necessity to consinder the relative u-error as we have 0 < U < 1. _checking x-error:_ We combine absoute and relative x-error and use the criterion |F^(-1)(U)-G^(-1)(U)| < xresolution * (|G^(-1)(U)| + xresolution). *Remark:* It should be noted here that the criterion based on the u-error is too stringent whereever the CDF is extremely steep (and thus the PDF has a pole or a high and narrow peak). This is in particular a problem for distributions with a pole (e.g., the gamma distribution with shape parameter less than 0.5). On the other hand using a criterion based on the x-error causes problems whereever the CDF is extremly flat. This is in particular the case in the (far) tails of heavy-tailed distributions (e.g., for the Cauchy distribution). A.2 The Rejection Method ======================== The rejection method, often called _acceptance-rejection method_, has been suggested by John von Neumann in 1951. Since then it has proven to be the most flexible and most efficient method to generate variates from continuous distributions. We explain the rejection principle first for the density f(x) = sin(x)/2 on the interval (0, pi). To generate random variates from this distribution we also can sample random points that are uniformly distributed in the region between the graph of f(x) and the x-axis, i.e., the shaded region in the below figure. ^ | +------------------------------**+***------------------------------+ | o****./.\..**** o | | **..../...\.....** | | **...../.....\......** | | **...../.........\......** | | *....../...........\.......* o | | o *....../..............\......* | | **...../......X..........\......** | | *....../...................\.......* o | | *....../......................\......* | | *...../.........................\......* | | *..X../...........................\......* | | *...../..................X...........\.....* | | *..../.................................\.....* | | *..../.................................X..\....* o | | *..../........X.............................\....* | | *.../.................................X.......\....* | | *.../............................................\...* | | *.../....................................X.........\...* | | *../...........................X.....................\...* | | *./............X.......................................\..* | | o *./......................................................\.* | | */.........................................................\.* | | */.....................................................X......\* | |*/......................................X.......................\*| *---------------+---+--+-------+----++---+----++-+-------+---------*----> In general this is not a trivial task but in this example we can easily use the rejection trick: Sample a random point (X,Y) uniformly in the bounding rectangle (0, pi)x(0,0.5). This is easy since each coordinate can be sampled independently from the respective uniform distributions U(0, pi) and U(0,0.5). Whenever the point falls into the shaded region below the graph (indicated by dots in the figure), i.e., when Y < sin(X)/2, we accept it and return X as a random variate from the distribution with density f(x). Otherwise we have to reject the point (indicated by small circles in the figure), and try again. It is quite clear that this idea works for every distribution with a bounded density on a bounded domain. Moreover, we can use this procedure with any multiple of the density, i.e., with any positive bounded function with bounded integral and it is not necessary to know the integral of this function. So we use the term density in the sequel for any positive function with bounded integral. From the figure we can conclude that the performance of a rejection algorithm depends heavily on the area of the enveloping rectangle. Moreover, the method does not work if the target distribution has infinite tails (or is unbounded). Hence non-rectangular shaped regions for the envelopes are important and we have to solve the problem of sampling points uniformly from such domains. Looking again at the example above we notice that the x-coordinate of the random point (X,Y) was sampled by inversion from the uniform distribution on the domain of the given density. This motivates us to replace the density of the uniform distribution by the (multiple of a) density h(x) of some other appropriate distribution. We only have to take care that it is chosen such that it is always an upper bound, i.e., h(x) >= f(x) for all x in the domain of the distribution. To generate the pair (X,Y) we generate X from the distribution with density proportional to h(x) and Y uniformly between 0 and h(X). The first step (generate X ) is usually done by inversion (*note Inversion::). Thus the general rejection algorithm for a hat h(x) with inverse CDF H^(-1) consists of the following steps: 1. Generate a U(0,1) random number U. 2. Set X to H^(-1)(U). 3. Generate a U(0,1) random number V. 4. Set Y to V h(X). 5. If Y <= f(X) accept X as the random variate. 6. Else try again. If the evaluation of the density f(x) is expensive (i.e., time consuming) it is possible to use a simple lower bound of the density as so called _squeeze function_ s(x) (the triangular shaped function in the above figure is an example for such a squeeze). We can then accept X when Y <= s(X) and can thus often save the evaluation of the density. We have seen so far that the rejection principle leads to short and simple generation algorithms. The main practical problem to apply the rejection algorithm is the search for a good fitting hat function and for squeezes. We do not discuss these topics here as they are the heart of the different automatic algorithms implemented in UNU.RAN. Information about the construction of hat and squeeze can therefore be found in the descriptions of the methods. The performance characteristics of rejection algorithms mainly depend on the fit of the hat and the squeeze. It is not difficult to prove that: • The expected number of trials to generate one variate is the ratio between the area below the hat and the area below the density. • The expected number of evaluations of the density necessary to generate one variate is equal to the ratio between the area below the hat and the area below the density, when no squeeze is used. Otherwise, when a squeeze is given it is equal to the ratio between the area between hat and squeeze and the area below the hat. • The ‘sqhratio’ (i.e., the ratio between the area below the squeeze and the area below the hat) used in some of the UNU.RAN methods is easy to compute. It is useful as its reciprocal is an upper bound for the expected number of trials of the rejection algoritm. The expected number of evaluations of the density is bounded by (1/sqhratio)-1. A.3 The Composition Method ========================== The composition method is an important principle to facilitate and speed up random variate generation. The basic idea is simple. To generate random variates with a given density we first split the domain of the density into subintervals. Then we select one of these randomly with probabilities given by the area below the density in the respective subintervals. Finally we generate a random variate from the density of the selected part by inversion and return it as random variate of the full distribution. Composition can be combined with rejection. Thus it is possible to decompose the domain of the distribution into subintervals and to construct hat and squeeze functions seperatly in every subinterval. The area below the hat must be determined in every subinterval. Then the Composition rejection algorithm contains the following steps: 1. Generate the index J of the subinterval as the realisation of a discrete random variate with probabilities proportional to the area below the hat. 2. Generate a random variate X proportional to the hat in interval J. 3. Generate the U(0,f(X)) random number Y. 4. If Y <= f(X) accept X as random variate. 5. Else start again with generating the index J. The first step can be done in constant time (i.e., independent of the number of chosen subintervals) by means of the indexed search method (*note IndexedSearch::). It is possible to reduce the number of uniform random numbers required in the above algorithm by recycling the random numbers used in Step 1 and additionally by applying the principle of _immediate acceptance_. For details see [HLD04: Sect. 3.1] . A.4 The Ratio-of-Uniforms Method ================================ The construction of an appropriate hat function for the given density is the crucial step for constructing rejection algorithms. Equivalently we can try to find an appropriate envelope for the region between the graph of the density and the x-axis, such that we can easily sample uniformly distributed random points. This task could become easier if we can find transformations that map the region between the density and the axis into a region of more suitable shape (for example into a bounded region). As a first example we consider the following simple algorithm for the Cauchy distribution. 1. Generate a U(-1,1) random number U and a U(0,1) random number V. 2. If U^2 + V^2 <= 1 accept X=U/V as a Cauchy random variate. 3. Else try again. It is possible to prove that the above algorithm indeed generates Cauchy random variates. The fundamental principle behind this algorithm is the fact that the region below the density is mapped by the transformation (X,Y) -> (U,V)=(2 Xsqrt(Y),2 sqrt(Y)) into a half-disc in such a way that the ratio between the area of the image to the area of the preimage is constant. This is due to the fact that that the Jacobian of this transformation is constant. ^ v | | +---------------------------*-***********-*---------------------------+ | *****.......|.......***** | | ****............|............**** | | **................|................** | | **...................|...................** | | *.....................|.....................* | | *.......................|.......................* | | *........................|.........................* | | *..........................|..........................* | | *...........................|...........................* | | *............................|............................* | | *.............................|.............................* | | *..............................|..............................* | | *...............................|...............................* | | *...............................|................................* | | *................................|................................* | | *................................|................................* | |*.................................|.................................*| |*.................................|.................................*| *..................................|..................................* *..................................|..................................* *..................................|..................................* ---*----------------------------------+----------------------------------*--> u The above example is a special case of a more general principle, called the _Ratio-of-uniforms (RoU) method_. It is based on the fact that for a random variable X with density f(x) and some constant mu we can generate X from the desired density by calculating X=U/V+ mu for a pair (U,V) uniformly distributed in the set A_f= { (u,v) : 0 < v <= sqrt(f(u/v+ mu)) } . For most distributions it is best to set the constant mu equal to the mode of the distribution. For sampling random points uniformly distributed in A_f rejection from a convenient enveloping region is used, usually the minimal bounding rectangle, i.e., the smallest possible rectangle that contains A_f (see the above figure). It is given by (u^-,u^+)x(0,v^+) where v^+ = sup_(b_l 0 1 2 3 4 5 To realize this idea on a computer we have to use a search algorithm. For the simplest version called _Sequential Search_ the CDF is computed on-the-fly as sum of the probabilities p(k), since this is usually much cheaper than computing the CDF directly. It is obvious that the basic form of the search algorithm only works for discrete random variables with probability mass functions p(k) for nonnegative k. The sequential search algorithm consists of the following basic steps: 1. Generate a U(0,1) random number U. 2. Set X to 0 and P to p(0). 3. Do while U > P 4. Set X to X+1 and P to P+p(X). 5. Return X. With the exception of some very simple discrete distributions, sequential search algorithms become very slow as the while-loop has to be repeated very often. The expected number of iterations, i.e., the number of comparisons in the while condition, is equal to the expectation of the distribution plus 1. It can therefore become arbitrary large or even infinity if the tail of the distribution is very heavy. Another serious problem can be critical round-off errors due to summing up many probabilities p(k). To speed up the search procedure it is best to use indexed search. A.6 Indexed Search (Guide Table Method) ======================================= The idea to speed up the sequential search algorithm is easy to understand. Instead of starting always at 0 we store a table of size C with starting points for our search. For this table we compute F^(-1)(U) for C equidistributed values of U, i.e., for u_i = i/C, i=0,...,C-1. Such a table is called _guide table_ or _hash table_. Then it is easy to prove that for every U in (0,1) the guide table entry for k=floor(UC) is bounded by F^(-1)(U). This shows that we can really start our sequential search procedure from the table entry for k and the index k of the correct table entry can be found rapidly by means of the truncation operation. The two main differences between _indexed search_ and _sequential search_ are that we start searching at the number determined by the guide table, and that we have to compute and store the cumulative probabilities in the setup as we have to know the cumulative probability for the starting point of the search algorithm. The rounding problems that can occur in the sequential search algorithm can occur here as well. Compared to sequential search we have now the obvious drawback of a slow setup. The computation of the cumulative probabilities grows linear with the size of the domain of the distribution L. What we gain is really high speed as the marginal execution time of the sampling algorithm becomes very small. The expected number of comparisons is bounded by 1+L/C. This shows that there is a trade-off between speed and the size of the guide table. Cache-effects in modern computers will however slow down the speed-up for really large table sizes. Thus we recommend to use a guide table that is about two times larger than the probability vector to obtain optimal speed. Appendix B Glossary ******************* *CDF* cumulative distribution function. *HR* hazard rate (or failure rate). *inverse local concavity* local concavity of inverse PDF f^(-1)(y) expressed in term of x = f^(-1)(y). Is is given by ilc_f(x) = 1 + x f''(x) / f'(x) *local concavity* maximum value of c such that PDF f(x) is T_c. Is is given by lc_f(x) = 1 - f''(x) f(x) / f'(x)^2 *PDF* probability density function. *dPDF* derivative (gradient) of probability density function. *PMF* probability mass function. *PV* (finite) probability vector. *URNG* uniform random number generator. *U(a,b)* continuous uniform distribution on the interval (a,b). *T-concave* a function f(x) is called T-convace if the transformed function T(f(x)) is concave. We only deal with transformations T_c, where ‘c = 0’ T(x) = log(x) ‘c = -0.5’ T(x) = -1/sqrt(x) ‘c != 0’ T(x) = sign(x) * x^c *u-error* for a given approximate inverse CDF X=G^(-1)(U) the u-error is given as uerror = |U-F(G^(-1)(U))| where F denotes the exact CDF. Goodness-of-fit tests like the Kolmogorov-Smirnov test or the chi-squared test look at this type of error. See *note Inversion:: for more details. *u-resolution* the maximal tolerated u-error for an approximate inverse CDF. *x-error* for a given approximate inverse CDF X=G^(-1)(U) the x-error is given as xerror = |F^(-1)(U)-G^(-1)(U)| where F^(-1) denotes the exact inverse CDF. The x-error measure the deviation of G^(-1)(U) from the exact result. Notice that we have to distinguish between _absolute_ and _relative_ x-error. In UNU.RAN we use the absolute x-error near 0 and the relative x-error otherwise. See *note Inversion:: for more details. *x-resolution* the maximal tolerated x-error for an approximate inverse CDF. Appendix C Bibliography *********************** Standard Distributions ---------------------- [JKKa92] N.L. JOHNSON, S. KOTZ, AND A.W. KEMP (1992). Univariate Discrete Distributions, 2nd edition, John Wiley & Sons, Inc., New York. [JKBb94] N.L. JOHNSON, S. KOTZ, AND N. BALAKRISHNAN (1994). Continuous Univariate Distributions, Volume 1, 2nd edition, John Wiley & Sons, Inc., New York. [JKBc95] N.L. JOHNSON, S. KOTZ, AND N. BALAKRISHNAN (1995). Continuous Univariate Distributions, Volume 2, 2nd edition, John Wiley & Sons, Inc., New York. [JKBd97] N.L. JOHNSON, S. KOTZ, AND N. BALAKRISHNAN (1997). Discrete Multivariate Distributions, John Wiley & Sons, Inc., New York. [KBJe00] S. KOTZ, N. BALAKRISHNAN, AND N.L. JOHNSON (2000). Continuous Multivariate Distributions, Volume 1: Models and Applications, John Wiley & Sons, Inc., New York. Universal Methods – Surveys --------------------------- [HLD04] W. HÖRMANN, J. LEYDOLD, AND G. DERFLINGER (2004). Automatic Nonuniform Random Variate Generation, Springer, Berlin. Universal Methods ----------------- [AJa93] J.H. AHRENS (1993). Sampling from general distributions by suboptimal division of domains, Grazer Math. Berichte 319, 30pp. [AJa95] J.H. AHRENS (1995). An one-table method for sampling from continuous and discrete distributions, Computing 54(2), pp. 127-146. [CAa74] H.C. CHEN AND Y. ASAU (1974). On generating random variates from an empirical distribution, AIIE Trans. 6, pp. 163-166. [DHLa08] G. DERFLINGER, W. HÖRMANN, AND J. LEYDOLD (2008). Numerical inversion when only the density function is known, Research Report Series of the Department of Statistics and Mathematics 78, WU Wien, Augasse 2–6, A-1090 Wien, Austria, . [DLa86] L. DEVROYE (1986). Non-Uniform Random Variate Generation, Springer Verlag, New York. [GWa92] W.R. GILKS AND P. WILD (1992). Adaptive rejection sampling for Gibbs sampling, Applied Statistics 41, pp. 337-348. [HWa95] W. HÖRMANN (1995). A rejection technique for sampling from T-concave distributions, ACM Trans. Math. Software 21(2), pp. 182-193. [HDa96] W. HÖRMANN AND G. DERFLINGER (1996). Rejection-inversion to generate variates from monotone discrete distributions, ACM TOMACS 6(3), 169-184. [HLa00] W. HÖRMANN AND J. LEYDOLD (2000). Automatic random variate generation for simulation input. In: J.A. Joines, R. Barton, P. Fishwick, K. Kang (eds.), Proceedings of the 2000 Winter Simulation Conference, pp. 675-682. [HLa03] W. HÖRMANN AND J. LEYDOLD (2003). Continuous Random Variate Generation by Fast Numerical Inversion, ACM TOMACS 13(4), 347-362. [HLDa07] W. HÖRMANN, J. LEYDOLD, AND G. DERFLINGER (2007). Automatic Random Variate Generation for Unbounded Densities, ACM Trans. Model. Comput. Simul. 17(4), pp.18. [KLPa05] R. KARAWATZKI, J. LEYDOLD, AND K. PÖTZELBERGER (2005). Automatic Markov chain Monte Carlo procedures for sampling from multivariate distributions, Research Report Series of the Department of Statistics and Mathematics 27, WU Wien, Augasse 2–6, A-1090 Wien, Austria, . [LJa98] J. LEYDOLD (1998). A Rejection Technique for Sampling from Log-Concave Multivariate Distributions, ACM TOMACS 8(3), pp. 254-280. [LJa00] J. LEYDOLD (2000). Automatic Sampling with the Ratio-of-Uniforms Method, ACM Trans. Math. Software 26(1), pp. 78-98. [LJa01] J. LEYDOLD (2001). A simple universal generator for continuous and discrete univariate T-concave distributions, ACM Trans. Math. Software 27(1), pp. 66-82. [LJa02] J. LEYDOLD (2003). Short universal generators via generalized ratio-of-uniforms method, Math. Comp. 72(243), pp. 1453-1471. [WGS91] J.C. WAKEFIELD, A.E. GELFAND, AND A.F.M. SMITH (1992). Efficient generation of random variates via the ratio-of-uniforms method, Statist. Comput. 1(2), pp. 129-133. [WAa77] A.J. WALKER (1977). An efficient method for generating discrete random variables with general distributions, ACM Trans. Math. Software 3, pp. 253-256. Special Generators ------------------ [ADa74] J.H. AHRENS, U. DIETER (1974). Computer methods for sampling from gamma, beta, Poisson and binomial distributions, Computing 12, 223-246. [ADa82] J.H. AHRENS, U. DIETER (1982). Generating gamma variates by a modified rejection technique, Communications of the ACM 25, 47-54. [ADb82] J.H. AHRENS, U. DIETER (1982). Computer generation of Poisson deviates from modified normal distributions, ACM Trans. Math. Software 8, 163-179. [BMa58] G.E.P. BOX AND M.E. MULLER (1958). A note on the generation of random normal deviates, Annals Math. Statist. 29, 610-611. [CHa77] R.C.H. CHENG (1977). The Generation of Gamma Variables with Non-Integral Shape Parameter, Appl. Statist. 26(1), 71-75. [Dag89] J.S. DAGPUNAR (1989). An Easily Implemented Generalised Inverse Gaussian Generator, Commun. Statist. Simul. 18(2), 703-710. [HDa90] W. HÖRMANN AND G. DERFLINGER (1990). The ACR Method for generating normal random variables, OR Spektrum 12, 181-185. [KAa81] A.W. KEMP (1981). Efficient generation of logarithmically distributed pseudo-random variables, Appl. Statist. 30, 249-253. [KRa76] A.J. KINDERMAN AND J.G. RAMAGE (1976). Computer Generation of Normal Random Variables, J. Am. Stat. Assoc. 71(356), 893 - 898. [MJa87] J.F. MONAHAN (1987). An algorithm for generating chi random variables, ACM Trans. Math. Software 13, 168-172. [MGa62] G. MARSAGLIA (1962). Improving the Polar Method for Generating a Pair of Random Variables, Boeing Sci. Res. Lab., Seattle, Washington. [MOa84] G. MARSAGLIA AND I. OLKIN (1984). Generating Correlation Matrices, SIAM J. Sci. Stat. Comput 5, 470-475. [STa89] E. STADLOBER (1989). Sampling from Poisson, binomial and hypergeometric distributions: ratio of uniforms as a simple and fast alternative, Bericht 303, Math. Stat. Sektion, Forschungsgesellschaft Joanneum, Graz. [ZHa94] H. ZECHNER (1994). Efficient sampling from continuous and discrete unimodal distributions, Pd.D. Thesis, 156 pp., Technical University Graz, Austria. Other references ---------------- [CPa76] R. CRANLEY AND T.N.L. PATTERSON (1976). Randomization of number theoretic methods for multiple integration, SIAM J. Num. Anal., Vol. 13, pp. 904-914. [HJa61] R. HOOKE AND T.A. JEEVES (1961). Direct Search Solution of Numerical and Statistical Problems, Journal of the ACM, Vol. 8, April 1961, pp. 212-229. Appendix D Function Index ************************* * Menu: * FALSE: Math. (line 12945) * INT_MAX: Math. (line 12939) * INT_MIN: Math. (line 12940) * TRUE: Math. (line 12944) * unur_arou_chg_verify: AROU. (line 5236) * unur_arou_get_hatarea: AROU. (line 5202) * unur_arou_get_sqhratio: AROU. (line 5198) * unur_arou_get_squeezearea: AROU. (line 5206) * unur_arou_new: AROU. (line 5159) * unur_arou_set_cpoints: AROU. (line 5217) * unur_arou_set_darsfactor: AROU. (line 5177) * unur_arou_set_guidefactor: AROU. (line 5227) * unur_arou_set_max_segments: AROU. (line 5210) * unur_arou_set_max_sqhratio: AROU. (line 5187) * unur_arou_set_pedantic: AROU. (line 5244) * unur_arou_set_usecenter: AROU. (line 5224) * unur_arou_set_usedars: AROU. (line 5162) * unur_arou_set_verify: AROU. (line 5235) * unur_ars_chg_reinit_ncpoints: ARS. (line 5365) * unur_ars_chg_reinit_percentiles: ARS. (line 5349) * unur_ars_chg_verify: ARS. (line 5380) * unur_ars_eval_invcdfhat: ARS. (line 5411) * unur_ars_get_loghatarea: ARS. (line 5407) * unur_ars_new: ARS. (line 5328) * unur_ars_set_cpoints: ARS. (line 5338) * unur_ars_set_max_intervals: ARS. (line 5331) * unur_ars_set_max_iter: ARS. (line 5373) * unur_ars_set_pedantic: ARS. (line 5388) * unur_ars_set_reinit_ncpoints: ARS. (line 5363) * unur_ars_set_reinit_percentiles: ARS. (line 5347) * unur_ars_set_verify: ARS. (line 5379) * unur_auto_new: AUTO. (line 4893) * unur_auto_set_logss: AUTO. (line 4896) * unur_cext_get_distrparams: CEXT. (line 5637) * unur_cext_get_ndistrparams: CEXT. (line 5638) * unur_cext_get_params: CEXT. (line 5625) * unur_cext_new: CEXT. (line 5600) * unur_cext_set_init: CEXT. (line 5603) * unur_cext_set_sample: CEXT. (line 5615) * unur_chgto_urng_aux_default: URNG. (line 10804) * unur_chg_debug: Debug. (line 12419) * unur_chg_urng: URNG. (line 10781) * unur_chg_urng_aux: URNG. (line 10809) * unur_cstd_chg_truncated: CSTD. (line 5721) * unur_cstd_new: CSTD. (line 5699) * unur_cstd_set_variant: CSTD. (line 5711) * unur_dari_chg_verify: DARI. (line 9699) * unur_dari_new: DARI. (line 9665) * unur_dari_set_cpfactor: DARI. (line 9689) * unur_dari_set_squeeze: DARI. (line 9668) * unur_dari_set_tablesize: DARI. (line 9680) * unur_dari_set_verify: DARI. (line 9698) * unur_dau_new: DAU. (line 9745) * unur_dau_set_urnfactor: DAU. (line 9748) * UNUR_DEBUG_ADAPT: Debug. (line 12394) * UNUR_DEBUG_ADAPT <1>: Debug. (line 12395) * UNUR_DEBUG_ALL: Debug. (line 12388) * UNUR_DEBUG_ALL <1>: Debug. (line 12389) * UNUR_DEBUG_INIT: Debug. (line 12390) * UNUR_DEBUG_INIT <1>: Debug. (line 12391) * UNUR_DEBUG_OFF: Debug. (line 12386) * UNUR_DEBUG_OFF <1>: Debug. (line 12387) * UNUR_DEBUG_SAMPLE: Debug. (line 12396) * UNUR_DEBUG_SAMPLE <1>: Debug. (line 12397) * UNUR_DEBUG_SETUP: Debug. (line 12392) * UNUR_DEBUG_SETUP <1>: Debug. (line 12393) * unur_dext_get_distrparams: DEXT. (line 9973) * unur_dext_get_ndistrparams: DEXT. (line 9974) * unur_dext_get_params: DEXT. (line 9961) * unur_dext_new: DEXT. (line 9936) * unur_dext_set_init: DEXT. (line 9939) * unur_dext_set_sample: DEXT. (line 9951) * unur_dgt_new: DGT. (line 10043) * unur_dgt_set_guidefactor: DGT. (line 10046) * unur_dgt_set_variant: DGT. (line 10056) * unur_distr_: Stddist. (line 11381) * unur_distr_beta: beta. (line 11490) * unur_distr_binomial: binomial. (line 12162) * unur_distr_cauchy: cauchy. (line 11511) * unur_distr_cemp_get_data: CEMP. (line 3642) * unur_distr_cemp_new: CEMP. (line 3620) * unur_distr_cemp_read_data: CEMP. (line 3631) * unur_distr_cemp_set_data: CEMP. (line 3627) * unur_distr_cemp_set_hist: CEMP. (line 3650) * unur_distr_cemp_set_hist_bins: CEMP. (line 3680) * unur_distr_cemp_set_hist_domain: CEMP. (line 3675) * unur_distr_cemp_set_hist_prob: CEMP. (line 3663) * unur_distr_chi: chi. (line 11534) * unur_distr_chisquare: chisquare. (line 11556) * unur_distr_condi_get_condition: CONDI. (line 4301) * unur_distr_condi_get_distribution: CONDI. (line 4309) * unur_distr_condi_new: CONDI. (line 4252) * unur_distr_condi_set_condition: CONDI. (line 4281) * unur_distr_cont_eval_cdf: CONT. (line 3167) * unur_distr_cont_eval_dlogpdf: CONT. (line 3194) * unur_distr_cont_eval_dpdf: CONT. (line 3165) * unur_distr_cont_eval_hr: CONT. (line 3367) * unur_distr_cont_eval_invcdf: CONT. (line 3169) * unur_distr_cont_eval_logcdf: CONT. (line 3196) * unur_distr_cont_eval_logpdf: CONT. (line 3192) * unur_distr_cont_eval_pdf: CONT. (line 3163) * unur_distr_cont_get_cdf: CONT. (line 3154) * unur_distr_cont_get_cdfstr: CONT. (line 3219) * unur_distr_cont_get_center: CONT. (line 3431) * unur_distr_cont_get_dlogpdf: CONT. (line 3188) * unur_distr_cont_get_dlogpdfstr: CONT. (line 3292) * unur_distr_cont_get_domain: CONT. (line 3317) * unur_distr_cont_get_dpdf: CONT. (line 3152) * unur_distr_cont_get_dpdfstr: CONT. (line 3218) * unur_distr_cont_get_hr: CONT. (line 3360) * unur_distr_cont_get_hrstr: CONT. (line 3384) * unur_distr_cont_get_invcdf: CONT. (line 3156) * unur_distr_cont_get_logcdf: CONT. (line 3190) * unur_distr_cont_get_logcdfstr: CONT. (line 3296) * unur_distr_cont_get_logpdf: CONT. (line 3186) * unur_distr_cont_get_logpdfstr: CONT. (line 3290) * unur_distr_cont_get_mode: CONT. (line 3411) * unur_distr_cont_get_pdf: CONT. (line 3150) * unur_distr_cont_get_pdfarea: CONT. (line 3457) * unur_distr_cont_get_pdfparams: CONT. (line 3252) * unur_distr_cont_get_pdfparams_vec: CONT. (line 3279) * unur_distr_cont_get_pdfstr: CONT. (line 3217) * unur_distr_cont_get_truncated: CONT. (line 3323) * unur_distr_cont_new: CONT. (line 3098) * unur_distr_cont_set_cdf: CONT. (line 3108) * unur_distr_cont_set_cdfstr: CONT. (line 3211) * unur_distr_cont_set_center: CONT. (line 3419) * unur_distr_cont_set_dlogpdf: CONT. (line 3182) * unur_distr_cont_set_domain: CONT. (line 3301) * unur_distr_cont_set_dpdf: CONT. (line 3106) * unur_distr_cont_set_hr: CONT. (line 3332) * unur_distr_cont_set_hrstr: CONT. (line 3374) * unur_distr_cont_set_invcdf: CONT. (line 3110) * unur_distr_cont_set_logcdf: CONT. (line 3184) * unur_distr_cont_set_logcdfstr: CONT. (line 3294) * unur_distr_cont_set_logpdf: CONT. (line 3180) * unur_distr_cont_set_logpdfstr: CONT. (line 3288) * unur_distr_cont_set_mode: CONT. (line 3395) * unur_distr_cont_set_pdf: CONT. (line 3104) * unur_distr_cont_set_pdfarea: CONT. (line 3435) * unur_distr_cont_set_pdfparams: CONT. (line 3225) * unur_distr_cont_set_pdfparams_vec: CONT. (line 3260) * unur_distr_cont_set_pdfstr: CONT. (line 3200) * unur_distr_cont_upd_mode: CONT. (line 3404) * unur_distr_cont_upd_pdfarea: CONT. (line 3444) * unur_distr_copula: copula. (line 12066) * unur_distr_corder_eval_cdf: CORDER. (line 3532) * unur_distr_corder_eval_dpdf: CORDER. (line 3530) * unur_distr_corder_eval_pdf: CORDER. (line 3528) * unur_distr_corder_get_cdf: CORDER. (line 3520) * unur_distr_corder_get_distribution: CORDER. (line 3493) * unur_distr_corder_get_domain: CORDER. (line 3559) * unur_distr_corder_get_dpdf: CORDER. (line 3518) * unur_distr_corder_get_mode: CORDER. (line 3584) * unur_distr_corder_get_pdf: CORDER. (line 3516) * unur_distr_corder_get_pdfarea: CORDER. (line 3602) * unur_distr_corder_get_pdfparams: CORDER. (line 3548) * unur_distr_corder_get_rank: CORDER. (line 3506) * unur_distr_corder_get_truncated: CORDER. (line 3564) * unur_distr_corder_new: CORDER. (line 3477) * unur_distr_corder_set_domain: CORDER. (line 3554) * unur_distr_corder_set_mode: CORDER. (line 3575) * unur_distr_corder_set_pdfarea: CORDER. (line 3588) * unur_distr_corder_set_pdfparams: CORDER. (line 3543) * unur_distr_corder_set_rank: CORDER. (line 3500) * unur_distr_corder_upd_mode: CORDER. (line 3579) * unur_distr_corder_upd_pdfarea: CORDER. (line 3593) * unur_distr_correlation: correlation. (line 12300) * unur_distr_cvec_eval_dlogpdf: CVEC. (line 3867) * unur_distr_cvec_eval_dpdf: CVEC. (line 3829) * unur_distr_cvec_eval_logpdf: CVEC. (line 3865) * unur_distr_cvec_eval_pdf: CVEC. (line 3817) * unur_distr_cvec_eval_pdlogpdf: CVEC. (line 3869) * unur_distr_cvec_eval_pdpdf: CVEC. (line 3841) * unur_distr_cvec_get_center: CVEC. (line 4192) * unur_distr_cvec_get_cholesky: CVEC. (line 3957) * unur_distr_cvec_get_covar: CVEC. (line 3955) * unur_distr_cvec_get_covar_inv: CVEC. (line 3959) * unur_distr_cvec_get_dlogpdf: CVEC. (line 3863) * unur_distr_cvec_get_dpdf: CVEC. (line 3810) * unur_distr_cvec_get_logpdf: CVEC. (line 3861) * unur_distr_cvec_get_marginal: CVEC. (line 4047) * unur_distr_cvec_get_mean: CVEC. (line 3886) * unur_distr_cvec_get_mode: CVEC. (line 4165) * unur_distr_cvec_get_pdf: CVEC. (line 3803) * unur_distr_cvec_get_pdfparams: CVEC. (line 4077) * unur_distr_cvec_get_pdfparams_vec: CVEC. (line 4114) * unur_distr_cvec_get_pdfvol: CVEC. (line 4214) * unur_distr_cvec_get_rankcorr: CVEC. (line 3996) * unur_distr_cvec_get_rk_cholesky: CVEC. (line 3998) * unur_distr_cvec_is_indomain: CVEC. (line 4143) * unur_distr_cvec_new: CVEC. (line 3746) * unur_distr_cvec_set_center: CVEC. (line 4175) * unur_distr_cvec_set_covar: CVEC. (line 3894) * unur_distr_cvec_set_covar_inv: CVEC. (line 3932) * unur_distr_cvec_set_dlogpdf: CVEC. (line 3857) * unur_distr_cvec_set_domain_rect: CVEC. (line 4123) * unur_distr_cvec_set_dpdf: CVEC. (line 3772) * unur_distr_cvec_set_logpdf: CVEC. (line 3855) * unur_distr_cvec_set_marginals: CVEC. (line 4009) * unur_distr_cvec_set_marginal_array: CVEC. (line 4016) * unur_distr_cvec_set_marginal_list: CVEC. (line 4026) * unur_distr_cvec_set_mean: CVEC. (line 3873) * unur_distr_cvec_set_mode: CVEC. (line 4153) * unur_distr_cvec_set_pdf: CVEC. (line 3757) * unur_distr_cvec_set_pdfparams: CVEC. (line 4054) * unur_distr_cvec_set_pdfparams_vec: CVEC. (line 4085) * unur_distr_cvec_set_pdfvol: CVEC. (line 4200) * unur_distr_cvec_set_pdlogpdf: CVEC. (line 3859) * unur_distr_cvec_set_pdpdf: CVEC. (line 3788) * unur_distr_cvec_set_rankcorr: CVEC. (line 3972) * unur_distr_cvec_upd_mode: CVEC. (line 4159) * unur_distr_cvec_upd_pdfvol: CVEC. (line 4205) * unur_distr_cvemp_get_data: CVEMP. (line 4354) * unur_distr_cvemp_new: CVEMP. (line 4324) * unur_distr_cvemp_read_data: CVEMP. (line 4342) * unur_distr_cvemp_set_data: CVEMP. (line 4334) * unur_distr_discr_eval_cdf: DISCR. (line 4520) * unur_distr_discr_eval_invcdf: DISCR. (line 4532) * unur_distr_discr_eval_pmf: DISCR. (line 4518) * unur_distr_discr_eval_pv: DISCR. (line 4516) * unur_distr_discr_get_cdfstr: DISCR. (line 4558) * unur_distr_discr_get_domain: DISCR. (line 4602) * unur_distr_discr_get_mode: DISCR. (line 4625) * unur_distr_discr_get_pmfparams: DISCR. (line 4583) * unur_distr_discr_get_pmfstr: DISCR. (line 4557) * unur_distr_discr_get_pmfsum: DISCR. (line 4654) * unur_distr_discr_get_pv: DISCR. (line 4479) * unur_distr_discr_make_pv: DISCR. (line 4458) * unur_distr_discr_new: DISCR. (line 4426) * unur_distr_discr_set_cdf: DISCR. (line 4488) * unur_distr_discr_set_cdfstr: DISCR. (line 4552) * unur_distr_discr_set_domain: DISCR. (line 4589) * unur_distr_discr_set_invcdf: DISCR. (line 4510) * unur_distr_discr_set_mode: DISCR. (line 4615) * unur_distr_discr_set_pmf: DISCR. (line 4486) * unur_distr_discr_set_pmfparams: DISCR. (line 4563) * unur_distr_discr_set_pmfstr: DISCR. (line 4542) * unur_distr_discr_set_pmfsum: DISCR. (line 4633) * unur_distr_discr_set_pv: DISCR. (line 4442) * unur_distr_discr_upd_mode: DISCR. (line 4618) * unur_distr_discr_upd_pmfsum: DISCR. (line 4642) * unur_distr_exponential: exponential. (line 11575) * unur_distr_extremeI: extremeI. (line 11598) * unur_distr_extremeII: extremeII. (line 11621) * unur_distr_F: F. (line 11471) * unur_distr_free: AllDistr. (line 2957) * unur_distr_gamma: gamma. (line 11645) * unur_distr_geometric: geometric. (line 12185) * unur_distr_get_dim: AllDistr. (line 2968) * unur_distr_get_extobj: AllDistr. (line 3032) * unur_distr_get_name: AllDistr. (line 2962) * unur_distr_get_type: AllDistr. (line 2978) * unur_distr_gig: gig. (line 11672) * unur_distr_gig2: gig2. (line 11699) * unur_distr_hyperbolic: hyperbolic. (line 11722) * unur_distr_hypergeometric: hypergeometric. (line 12207) * unur_distr_ig: ig. (line 11744) * unur_distr_is_cemp: AllDistr. (line 3001) * unur_distr_is_cont: AllDistr. (line 2995) * unur_distr_is_cvec: AllDistr. (line 2998) * unur_distr_is_cvemp: AllDistr. (line 3005) * unur_distr_is_discr: AllDistr. (line 3009) * unur_distr_is_matr: AllDistr. (line 3012) * unur_distr_laplace: laplace. (line 11766) * unur_distr_logarithmic: logarithmic. (line 12231) * unur_distr_logistic: logistic. (line 11789) * unur_distr_lognormal: lognormal. (line 11812) * unur_distr_lomax: lomax. (line 11832) * unur_distr_matr_get_dim: MATR. (line 4387) * unur_distr_matr_new: MATR. (line 4373) * unur_distr_multicauchy: multicauchy. (line 12078) * unur_distr_multiexponential: multiexponential. (line 12099) * unur_distr_multinormal: multinormal. (line 12117) * unur_distr_multistudent: multistudent. (line 12137) * unur_distr_negativebinomial: negativebinomial. (line 12254) * unur_distr_normal: normal. (line 11855) * unur_distr_pareto: pareto. (line 11886) * unur_distr_poisson: poisson. (line 12273) * unur_distr_powerexponential: powerexponential. (line 11909) * unur_distr_rayleigh: rayleigh. (line 11931) * unur_distr_set_extobj: AllDistr. (line 3015) * unur_distr_set_name: AllDistr. (line 2960) * unur_distr_slash: slash. (line 11949) * unur_distr_student: student. (line 11971) * unur_distr_triangular: triangular. (line 11992) * unur_distr_uniform: uniform. (line 12016) * unur_distr_weibull: weibull. (line 12039) * unur_dsrou_chg_cdfatmode: DSROU. (line 10129) * unur_dsrou_chg_verify: DSROU. (line 10121) * unur_dsrou_new: DSROU. (line 10107) * unur_dsrou_set_cdfatmode: DSROU. (line 10110) * unur_dsrou_set_verify: DSROU. (line 10120) * unur_dss_new: DSS. (line 10175) * unur_dstd_chg_truncated: DSTD. (line 10251) * unur_dstd_new: DSTD. (line 10231) * unur_dstd_set_variant: DSTD. (line 10241) * unur_empk_chg_smoothing: EMPK. (line 8251) * unur_empk_chg_varcor: EMPK. (line 8265) * unur_empk_new: EMPK. (line 8190) * unur_empk_set_beta: EMPK. (line 8240) * unur_empk_set_kernel: EMPK. (line 8193) * unur_empk_set_kernelgen: EMPK. (line 8215) * unur_empk_set_positive: EMPK. (line 8272) * unur_empk_set_smoothing: EMPK. (line 8249) * unur_empk_set_varcor: EMPK. (line 8264) * unur_empl_new: EMPL. (line 8319) * unur_errno: Error_reporting. (line 12504) * UNUR_ERR_COMPILE: Errno. (line 12611) * UNUR_ERR_COOKIE: Errno. (line 12601) * UNUR_ERR_DISTR_DATA: Errno. (line 12543) * UNUR_ERR_DISTR_DOMAIN: Errno. (line 12533) * UNUR_ERR_DISTR_GEN: Errno. (line 12535) * UNUR_ERR_DISTR_GET: Errno. (line 12529) * UNUR_ERR_DISTR_INVALID: Errno. (line 12541) * UNUR_ERR_DISTR_NPARAMS: Errno. (line 12531) * UNUR_ERR_DISTR_PROP: Errno. (line 12545) * UNUR_ERR_DISTR_REQUIRED: Errno. (line 12537) * UNUR_ERR_DISTR_SET: Errno. (line 12527) * UNUR_ERR_DISTR_UNKNOWN: Errno. (line 12539) * UNUR_ERR_DOMAIN: Errno. (line 12593) * UNUR_ERR_FSTR_DERIV: Errno. (line 12589) * UNUR_ERR_FSTR_SYNTAX: Errno. (line 12587) * UNUR_ERR_GEN: Errno. (line 12557) * UNUR_ERR_GENERIC: Errno. (line 12603) * UNUR_ERR_GEN_CONDITION: Errno. (line 12561) * UNUR_ERR_GEN_DATA: Errno. (line 12559) * UNUR_ERR_GEN_INVALID: Errno. (line 12563) * UNUR_ERR_GEN_SAMPLING: Errno. (line 12565) * UNUR_ERR_INF: Errno. (line 12607) * UNUR_ERR_MALLOC: Errno. (line 12597) * UNUR_ERR_NAN: Errno. (line 12609) * UNUR_ERR_NO_QUANTILE: Errno. (line 12569) * UNUR_ERR_NO_REINIT: Errno. (line 12567) * UNUR_ERR_NULL: Errno. (line 12599) * UNUR_ERR_PAR_INVALID: Errno. (line 12553) * UNUR_ERR_PAR_SET: Errno. (line 12549) * UNUR_ERR_PAR_VARIANT: Errno. (line 12551) * UNUR_ERR_ROUNDOFF: Errno. (line 12595) * UNUR_ERR_SHOULD_NOT_HAPPEN: Errno. (line 12614) * UNUR_ERR_SILENT: Errno. (line 12605) * UNUR_ERR_STR: Errno. (line 12579) * UNUR_ERR_STR_INVALID: Errno. (line 12585) * UNUR_ERR_STR_SYNTAX: Errno. (line 12583) * UNUR_ERR_STR_UNKNOWN: Errno. (line 12581) * UNUR_ERR_URNG: Errno. (line 12573) * UNUR_ERR_URNG_MISS: Errno. (line 12575) * unur_free: Methods_all. (line 4784) * unur_gen_anti: URNG. (line 10908) * unur_gen_info: Methods_all. (line 4787) * unur_gen_is_inversion: Methods_all. (line 4807) * unur_gen_nextsub: URNG. (line 10910) * unur_gen_reset: URNG. (line 10909) * unur_gen_resetsub: URNG. (line 10911) * unur_gen_seed: URNG. (line 10907) * unur_gen_sync: URNG. (line 10906) * unur_get_default_urng: URNG. (line 10757) * unur_get_default_urng_aux: URNG. (line 10766) * unur_get_dimension: Methods_all. (line 4796) * unur_get_distr: Methods_all. (line 4811) * unur_get_errno: Error_reporting. (line 12506) * unur_get_genid: Methods_all. (line 4800) * unur_get_method: Methods_all. (line 4803) * unur_get_stream: Output_streams. (line 12356) * unur_get_strerror: Error_reporting. (line 12513) * unur_get_urng: URNG. (line 10786) * unur_get_urng_aux: URNG. (line 10817) * unur_gibbs_chg_state: GIBBS. (line 8936) * unur_gibbs_get_state: GIBBS. (line 8935) * unur_gibbs_new: GIBBS. (line 8871) * unur_gibbs_reset_state: GIBBS. (line 8940) * unur_gibbs_set_burnin: GIBBS. (line 8916) * unur_gibbs_set_c: GIBBS. (line 8883) * unur_gibbs_set_startingpoint: GIBBS. (line 8897) * unur_gibbs_set_thinning: GIBBS. (line 8908) * unur_gibbs_set_variant_coordinate: GIBBS. (line 8874) * unur_gibbs_set_variant_random_direction: GIBBS. (line 8880) * unur_hinv_chg_truncated: HINV. (line 5940) * unur_hinv_estimate_error: HINV. (line 5963) * unur_hinv_eval_approxinvcdf: HINV. (line 5930) * unur_hinv_get_n_intervals: HINV. (line 5925) * unur_hinv_new: HINV. (line 5835) * unur_hinv_set_boundary: HINV. (line 5896) * unur_hinv_set_cpoints: HINV. (line 5869) * unur_hinv_set_guidefactor: HINV. (line 5908) * unur_hinv_set_max_intervals: HINV. (line 5916) * unur_hinv_set_order: HINV. (line 5838) * unur_hinv_set_u_resolution: HINV. (line 5854) * unur_hist_new: HIST. (line 8348) * unur_hitro_chg_state: HITRO. (line 9279) * unur_hitro_get_state: HITRO. (line 9278) * unur_hitro_new: HITRO. (line 9110) * unur_hitro_reset_state: HITRO. (line 9290) * unur_hitro_set_adaptive_multiplier: HITRO. (line 9225) * unur_hitro_set_burnin: HITRO. (line 9264) * unur_hitro_set_r: HITRO. (line 9180) * unur_hitro_set_startingpoint: HITRO. (line 9239) * unur_hitro_set_thinning: HITRO. (line 9253) * unur_hitro_set_u: HITRO. (line 9203) * unur_hitro_set_use_adaptiveline: HITRO. (line 9125) * unur_hitro_set_use_adaptiverectangle: HITRO. (line 9153) * unur_hitro_set_use_boundingrectangle: HITRO. (line 9141) * unur_hitro_set_v: HITRO. (line 9188) * unur_hitro_set_variant_coordinate: HITRO. (line 9113) * unur_hitro_set_variant_random_direction: HITRO. (line 9122) * unur_hrb_chg_verify: HRB. (line 6028) * unur_hrb_new: HRB. (line 6018) * unur_hrb_set_upperbound: HRB. (line 6021) * unur_hrb_set_verify: HRB. (line 6027) * unur_hrd_chg_verify: HRD. (line 6079) * unur_hrd_new: HRD. (line 6075) * unur_hrd_set_verify: HRD. (line 6078) * unur_hri_chg_verify: HRI. (line 6155) * unur_hri_new: HRI. (line 6142) * unur_hri_set_p0: HRI. (line 6145) * unur_hri_set_verify: HRI. (line 6154) * UNUR_INFINITY: Math. (line 12935) * unur_init: Methods_all. (line 4705) * unur_itdr_chg_verify: ITDR. (line 6290) * unur_itdr_get_area: ITDR. (line 6278) * unur_itdr_get_cp: ITDR. (line 6273) * unur_itdr_get_ct: ITDR. (line 6274) * unur_itdr_get_xi: ITDR. (line 6272) * unur_itdr_new: ITDR. (line 6243) * unur_itdr_set_cp: ITDR. (line 6254) * unur_itdr_set_ct: ITDR. (line 6263) * unur_itdr_set_verify: ITDR. (line 6281) * unur_itdr_set_xi: ITDR. (line 6246) * unur_makegen_dsu: StringAPI. (line 2035) * unur_makegen_ssu: StringAPI. (line 2033) * unur_mcorr_chg_eigenvalues: MCORR. (line 10360) * unur_mcorr_new: MCORR. (line 10345) * unur_mcorr_set_eigenvalues: MCORR. (line 10348) * unur_mixt_new: MIXT. (line 10600) * unur_mixt_set_useinversion: MIXT. (line 10609) * unur_mvstd_new: MVSTD. (line 8399) * unur_mvtdr_chg_verify: MVTDR. (line 8524) * unur_mvtdr_get_hatvol: MVTDR. (line 8519) * unur_mvtdr_get_ncones: MVTDR. (line 8515) * unur_mvtdr_new: MVTDR. (line 8482) * unur_mvtdr_set_boundsplitting: MVTDR. (line 8491) * unur_mvtdr_set_maxcones: MVTDR. (line 8501) * unur_mvtdr_set_stepsmin: MVTDR. (line 8485) * unur_mvtdr_set_verify: MVTDR. (line 8523) * unur_ninv_chg_max_iter: NINV. (line 6403) * unur_ninv_chg_start: NINV. (line 6439) * unur_ninv_chg_table: NINV. (line 6456) * unur_ninv_chg_truncated: NINV. (line 6459) * unur_ninv_chg_u_resolution: NINV. (line 6417) * unur_ninv_chg_x_resolution: NINV. (line 6408) * unur_ninv_eval_approxinvcdf: NINV. (line 6478) * unur_ninv_new: NINV. (line 6384) * unur_ninv_set_max_iter: NINV. (line 6402) * unur_ninv_set_start: NINV. (line 6424) * unur_ninv_set_table: NINV. (line 6443) * unur_ninv_set_usebisect: NINV. (line 6398) * unur_ninv_set_usenewton: NINV. (line 6391) * unur_ninv_set_useregula: NINV. (line 6387) * unur_ninv_set_u_resolution: NINV. (line 6415) * unur_ninv_set_x_resolution: NINV. (line 6406) * unur_norta_new: NORTA. (line 8595) * unur_nrou_chg_verify: NROU. (line 6618) * unur_nrou_new: NROU. (line 6568) * unur_nrou_set_center: NROU. (line 6603) * unur_nrou_set_r: NROU. (line 6596) * unur_nrou_set_u: NROU. (line 6571) * unur_nrou_set_v: NROU. (line 6587) * unur_nrou_set_verify: NROU. (line 6609) * unur_pinv_estimate_error: PINV. (line 6960) * unur_pinv_eval_approxcdf: PINV. (line 6952) * unur_pinv_eval_approxinvcdf: PINV. (line 6945) * unur_pinv_get_n_intervals: PINV. (line 6930) * unur_pinv_new: PINV. (line 6763) * unur_pinv_set_boundary: PINV. (line 6889) * unur_pinv_set_extra_testpoints: PINV. (line 6850) * unur_pinv_set_keepcdf: PINV. (line 6934) * unur_pinv_set_max_intervals: PINV. (line 6923) * unur_pinv_set_order: PINV. (line 6766) * unur_pinv_set_searchboundary: PINV. (line 6904) * unur_pinv_set_smoothness: PINV. (line 6772) * unur_pinv_set_usecdf: PINV. (line 6877) * unur_pinv_set_usepdf: PINV. (line 6872) * unur_pinv_set_use_upoints: PINV. (line 6863) * unur_pinv_set_u_resolution: PINV. (line 6820) * unur_quantile: Methods_all. (line 4765) * unur_reinit: Methods_all. (line 4718) * unur_reset_errno: Error_reporting. (line 12509) * unur_run_tests: Testing. (line 12688) * unur_sample_cont: Methods_all. (line 4749) * unur_sample_discr: Methods_all. (line 4748) * unur_sample_matr: Methods_all. (line 4751) * unur_sample_urng: URNG. (line 10831) * unur_sample_vec: Methods_all. (line 4750) * unur_set_debug: Debug. (line 12416) * unur_set_default_debug: Debug. (line 12422) * unur_set_default_urng: URNG. (line 10761) * unur_set_default_urng_aux: URNG. (line 10765) * unur_set_error_handler: Error_handlers. (line 12661) * unur_set_error_handler_off: Error_handlers. (line 12673) * unur_set_stream: Output_streams. (line 12342) * unur_set_urng: URNG. (line 10772) * unur_set_urng_aux: URNG. (line 10790) * unur_set_use_distr_privatecopy: Methods_all. (line 4824) * unur_srou_chg_cdfatmode: SROU. (line 7126) * unur_srou_chg_pdfatmode: SROU. (line 7130) * unur_srou_chg_verify: SROU. (line 7118) * unur_srou_new: SROU. (line 7060) * unur_srou_set_cdfatmode: SROU. (line 7077) * unur_srou_set_pdfatmode: SROU. (line 7084) * unur_srou_set_r: SROU. (line 7063) * unur_srou_set_usemirror: SROU. (line 7104) * unur_srou_set_usesqueeze: SROU. (line 7093) * unur_srou_set_verify: SROU. (line 7117) * unur_ssr_chg_cdfatmode: SSR. (line 7239) * unur_ssr_chg_pdfatmode: SSR. (line 7243) * unur_ssr_chg_verify: SSR. (line 7231) * unur_ssr_new: SSR. (line 7204) * unur_ssr_set_cdfatmode: SSR. (line 7207) * unur_ssr_set_pdfatmode: SSR. (line 7214) * unur_ssr_set_usesqueeze: SSR. (line 7222) * unur_ssr_set_verify: SSR. (line 7230) * unur_str2distr: StringAPI. (line 2027) * unur_str2gen: StringAPI. (line 2022) * UNUR_SUCCESS (0x0u): Errno. (line 12523) * unur_tabl_chg_truncated: TABL. (line 7507) * unur_tabl_chg_verify: TABL. (line 7537) * unur_tabl_get_hatarea: TABL. (line 7454) * unur_tabl_get_n_intervals: TABL. (line 7469) * unur_tabl_get_sqhratio: TABL. (line 7450) * unur_tabl_get_squeezearea: TABL. (line 7458) * unur_tabl_new: TABL. (line 7346) * unur_tabl_set_areafraction: TABL. (line 7386) * unur_tabl_set_boundary: TABL. (line 7498) * unur_tabl_set_cpoints: TABL. (line 7360) * unur_tabl_set_darsfactor: TABL. (line 7413) * unur_tabl_set_guidefactor: TABL. (line 7490) * unur_tabl_set_max_intervals: TABL. (line 7462) * unur_tabl_set_max_sqhratio: TABL. (line 7436) * unur_tabl_set_nstp: TABL. (line 7368) * unur_tabl_set_pedantic: TABL. (line 7545) * unur_tabl_set_slopes: TABL. (line 7472) * unur_tabl_set_usedars: TABL. (line 7398) * unur_tabl_set_useear: TABL. (line 7377) * unur_tabl_set_variant_ia: TABL. (line 7349) * unur_tabl_set_variant_splitmode: TABL. (line 7423) * unur_tabl_set_verify: TABL. (line 7536) * unur_tdr_chg_reinit_ncpoints: TDR. (line 7737) * unur_tdr_chg_reinit_percentiles: TDR. (line 7721) * unur_tdr_chg_truncated: TDR. (line 7745) * unur_tdr_chg_verify: TDR. (line 7824) * unur_tdr_eval_invcdfhat: TDR. (line 7851) * unur_tdr_get_hatarea: TDR. (line 7787) * unur_tdr_get_sqhratio: TDR. (line 7783) * unur_tdr_get_squeezearea: TDR. (line 7791) * unur_tdr_new: TDR. (line 7646) * unur_tdr_set_c: TDR. (line 7649) * unur_tdr_set_cpoints: TDR. (line 7711) * unur_tdr_set_darsfactor: TDR. (line 7701) * unur_tdr_set_guidefactor: TDR. (line 7816) * unur_tdr_set_max_intervals: TDR. (line 7795) * unur_tdr_set_max_sqhratio: TDR. (line 7772) * unur_tdr_set_pedantic: TDR. (line 7832) * unur_tdr_set_reinit_ncpoints: TDR. (line 7735) * unur_tdr_set_reinit_percentiles: TDR. (line 7719) * unur_tdr_set_usecenter: TDR. (line 7802) * unur_tdr_set_usedars: TDR. (line 7667) * unur_tdr_set_usemode: TDR. (line 7805) * unur_tdr_set_variant_gw: TDR. (line 7655) * unur_tdr_set_variant_ia: TDR. (line 7663) * unur_tdr_set_variant_ps: TDR. (line 7659) * unur_tdr_set_verify: TDR. (line 7823) * unur_test_chi2: Testing. (line 12820) * unur_test_correlation: Testing. (line 12868) * unur_test_count_pdf: Testing. (line 12795) * unur_test_count_urn: Testing. (line 12784) * unur_test_moments: Testing. (line 12855) * unur_test_par_count_pdf: Testing. (line 12813) * unur_test_printsample: Testing. (line 12706) * unur_test_quartiles: Testing. (line 12876) * unur_test_timing: Testing. (line 12711) * unur_test_timing_exponential: Testing. (line 12761) * unur_test_timing_R: Testing. (line 12735) * unur_test_timing_total: Testing. (line 12768) * unur_test_timing_uniform: Testing. (line 12759) * unur_test_u_error: Testing. (line 12894) * unur_unif_new: UNIF. (line 10383) * unur_urng_anti: URNG. (line 10885) * unur_urng_free: URNG. (line 10951) * unur_urng_fvoid_new: URNG-FVOID. (line 11036) * unur_urng_gslptr_new: URNG-GSL. (line 11153) * unur_urng_gslqrng_new: URNG-GSLQRNG. (line 11197) * unur_urng_gsl_new: URNG-GSL. (line 11147) * unur_urng_new: URNG. (line 10932) * unur_urng_nextsub: URNG. (line 10892) * unur_urng_prngptr_new: URNG-PRNG. (line 11258) * unur_urng_prng_new: URNG-PRNG. (line 11243) * unur_urng_randomshift_new: URNG-RANDOMSHIFT. (line 11358) * unur_urng_randomshift_nextshift: URNG-RANDOMSHIFT. (line 11368) * unur_urng_reset: URNG. (line 10850) * unur_urng_resetsub: URNG. (line 10899) * unur_urng_rngstreamptr_new: URNG-RNGSTREAM. (line 11312) * unur_urng_rngstream_new: URNG-RNGSTREAM. (line 11308) * unur_urng_sample: URNG. (line 10827) * unur_urng_sample_array: URNG. (line 10836) * unur_urng_seed: URNG. (line 10870) * unur_urng_set_anti: URNG. (line 10976) * unur_urng_set_delete: URNG. (line 10996) * unur_urng_set_nextsub: URNG. (line 10986) * unur_urng_set_reset: URNG. (line 10981) * unur_urng_set_resetsub: URNG. (line 10991) * unur_urng_set_sample_array: URNG. (line 10963) * unur_urng_set_seed: URNG. (line 10972) * unur_urng_set_sync: URNG. (line 10968) * unur_urng_sync: URNG. (line 10864) * unur_use_urng_aux_default: URNG. (line 10799) * unur_utdr_chg_pdfatmode: UTDR. (line 7955) * unur_utdr_chg_verify: UTDR. (line 7947) * unur_utdr_new: UTDR. (line 7920) * unur_utdr_set_cpfactor: UTDR. (line 7931) * unur_utdr_set_deltafactor: UTDR. (line 7939) * unur_utdr_set_pdfatmode: UTDR. (line 7923) * unur_utdr_set_verify: UTDR. (line 7946) * unur_vempk_chg_smoothing: VEMPK. (line 9438) * unur_vempk_chg_varcor: VEMPK. (line 9452) * unur_vempk_new: VEMPK. (line 9433) * unur_vempk_set_smoothing: VEMPK. (line 9436) * unur_vempk_set_varcor: VEMPK. (line 9451) * unur_vnrou_chg_u: VNROU. (line 8710) * unur_vnrou_chg_v: VNROU. (line 8721) * unur_vnrou_chg_verify: VNROU. (line 8741) * unur_vnrou_get_volumehat: VNROU. (line 8744) * unur_vnrou_new: VNROU. (line 8691) * unur_vnrou_set_r: VNROU. (line 8724) * unur_vnrou_set_u: VNROU. (line 8694) * unur_vnrou_set_v: VNROU. (line 8714) * unur_vnrou_set_verify: VNROU. (line 8732) unuran-1.11.0/doc/Makefile.am0000644001357500135600000001002614420445767012652 00000000000000## Process this file with automake to produce Makefile.in SUBDIRS = src figures . info_TEXINFOS = unuran.texi unuran_win32.texi # Location of same source files TEXINFO_TEX = ./src/texinfo.tex AM_MAKEINFOFLAGS = \ -I $(top_srcdir)/doc \ -I $(top_srcdir)/doc/src \ --no-split AM_MAKEINFOHTMLFLAGS = \ -I $(top_srcdir)/doc \ -I $(top_srcdir)/doc/src \ --css-include=$(top_srcdir)/doc/src/unuran.css \ --no-split # Automatically created part of manual unuran_src = ./src/unuran_src.texi # Files with examples. # These example files are generated from the corresponding # files $(top_srcdir)/examples/example*.c unuran_examples = \ ./src/ref_example0.texi ./src/ref_example0_str.texi \ ./src/ref_example1.texi ./src/ref_example1_str.texi \ ./src/ref_example2.texi ./src/ref_example2_str.texi \ ./src/ref_example3.texi ./src/ref_example3_str.texi \ ./src/ref_example_reinit.texi \ ./src/ref_example_gsl.texi \ ./src/ref_example_rngstreams.texi \ ./src/ref_example_anti.texi ./src/ref_example_anti_str.texi \ ./src/ref_example_cext.texi \ ./src/ref_example_cont.texi ./src/ref_example_cont_str.texi \ ./src/ref_example_dext.texi \ ./src/ref_example_discr.texi ./src/ref_example_discr_str.texi \ ./src/ref_example_emp.texi ./src/ref_example_emp_str.texi \ ./src/ref_example_vemp.texi ./src/ref_example_FuncStr.texi \ ./src/ref_example_mixt.texi ./src/ref_example_mixt_inv.texi # Sources for UNU.RAN manual unuran_TEXINFOS = \ unuran.texi \ ./src/methods_cont.texi \ ./src/methods_discr.texi \ ./src/methods_cemp.texi \ ./src/methods_cvec.texi \ ./src/methods_mcmc.texi \ ./src/methods_cvemp.texi \ ./src/methods_matr.texi \ $(unuran_src) \ $(unuran_examples) \ $(top_srcdir)/doc/figures/*.eps \ $(top_srcdir)/doc/figures/*.pdf \ $(top_srcdir)/doc/figures/*.png \ $(top_srcdir)/doc/figures/*.txt # Sources for (short) Win32 manual # Files with examples. # These example files are generated from the corresponding # files $(top_srcdir)/scripts/win32/example?.c unuran_win32_examples = \ ./src/ref_example_win32_1.texi \ ./src/ref_example_win32_2.texi unuran_win32_TEXINFOS = \ unuran_win32.texi \ unuran_win32_libname.texi \ $(unuran_win32_examples) noinst_DATA = EXTRA_DIST = \ unuran.html \ unuran.txt \ unuran.pdf \ unuran_win32.html \ unuran_win32.pdf # Generated texi files ... sinclude ./src/.dep-unuran_src_texi $(unuran_src): $(top_srcdir)/doc/src/make_texi.pl $(top_srcdir)/doc/src/make_texi.pl $(top_srcdir) > $(unuran_src) # Generated texi files for examples ... $(unuran_examples): $(top_srcdir)/examples/example*.c sed 's/{/@{/g;s/}/@}/g' < $(top_srcdir)/examples/`echo $* | sed 's/src\/ref_//'`.c > $@ $(unuran_win32_examples): $(top_srcdir)/scripts/win32/example*.c sed 's/{/@{/g;s/}/@}/g' < \ $(top_srcdir)/scripts/win32/`echo $* | sed 's/src\/ref_//' | sed 's/_win32_//'`.c > $@ # Rules for creating info, html, dvi, ps, and pdf files are provided by automake. # Add new rules for txt. unuran.txt: unuran.texi version.texi $(unuran_TEXINFOS) $(MAKEINFO) $(AM_MAKEINFOFLAGS) --fill-column=80 --no-headers --number-sections \ unuran.texi -o unuran.txt txt: unuran.txt # Name of Win32 libfile unuran_win32_libname.texi: @echo -n "@set LIBUNURAN libunuran" > unuran_win32_libname.texi @grep PACKAGE_VERSION $(top_srcdir)/config.h | \ sed 's/.*_VERSION\s*\"\(.*\)\..*\"/\1/' | sed 's/\.//' \ >> unuran_win32_libname.texi @echo -n "@set ZIPFILENAME unuran-" >> unuran_win32_libname.texi @grep PACKAGE_VERSION $(top_srcdir)/config.h | \ sed 's/.*_VERSION\s*\"\(.*\)\"/\1-win32.zip/' \ >> unuran_win32_libname.texi # Clean backup and temp files CLEANFILES = \ *~ # Clean generated files MAINTAINERCLEANFILES = \ Makefile.in \ mdate-sh \ $(unuran_src) \ $(unuran_examples) \ $(unuran_win32_examples) \ unuran_win32_libname.texi \ unuran.txt \ \ $(top_srcdir)/aclocal.m4 \ $(top_srcdir)/config.h.in \ $(top_srcdir)/configure # Remark: the last three lines are an ugly hack # to remove these files in the top source directory. # It cannot be done in $(top_srcdir)/Makefile.am as # this breaks the cleaning process. unuran-1.11.0/doc/unuran_win32.texi0000644001357500135600000002752614420445767014060 00000000000000\input texinfo @c -*-texinfo-*- @c %**start of header @setfilename unuran_win32.info @settitle Using UNU.RAN with Microsoft Visual C @iftex @afourpaper @end iftex @footnotestyle end @setchapternewpage odd @c %**end of header @c ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc @c @c Some data about this software @c @dircategory Scientific software @direntry * unuran_win32: (unuran_win32). Using UNU.RAN with Microsoft Visual C @end direntry @c Version ... @include version_win32.texi @include unuran_win32_libname.texi @c ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc @c @c Copyright @c @copying @noindent Copyright @copyright{} 2000--2007 Institut fuer Statistik, WU Wien. @noindent Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. @end copying @c ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc @c @c Titlepage ... @c @titlepage @title Using UNU.RAN with Microsoft Visual C @subtitle UNU.RAN -- Universal Non-Uniform RANdom number generators @subtitle Version @value{VERSION}, @value{UPDATED} @author Josef Leydold @author Wolfgang H@"ormann @author Engin Durmaz @page @vskip 0pt plus 1filll @insertcopying @end titlepage @c ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc @c @c Table of contents @c @contents @c ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc @c @c insert automatically generated documentation ... @c @node TOP @top Using UNU.RAN with Microsoft Visual C @menu * Installation:: Installation of binary distribution * URNG:: Uniform random number generator * IDE:: Building your own project in Visual Studio * CLI:: Building your own project on the command line * Examples:: Two Examples @end menu @ifinfo @noindent This is the online-documentation of UNU.RAN.@* Version: @value{VERSION}@* Date: @value{UPDATED} @end ifinfo This document describes how to use Microsoft Visual Studio to create a C or C++ project and link the target with UNU.RAN. @uref{http://statmath.wu.ac.at/unuran,UNU.RAN} (Universal Non-Uniform RAndom Number generator) is a collection of algorithms for generating non-uniform pseudorandom variates as a library of C functions designed and implemented by the @uref{http://statmath.wu.ac.at/arvag,ARVAG} (Automatic Random VAriate Generation) project group in Vienna, and released under the GNU Public License (GPL). This binary distribution also has support for Pierre L'Ecuyers @uref{http://statmath.wu.ac.at/software/RngStreams,RngStreams} library. This library is already compiled into the distributed DLL, the corresponding header file is included in this package. The DLL is linked against the C run-time library @file{MSVCRT.lib}. Thus the file @file{MSVCR80.DLL} must be available at run time for applications linked with UNU.RAN and @file{MSVCRT.lib} (i.e., included in the envirenment variate @env{PATH}). For details see the @uref{http://msdn2.microsoft.com/en-us/library/60k1461a(VS.80).aspx,Microsoft Visual C++} manual. @c -------------------------------------------------------------------- @node Installation, URNG, TOP, TOP @chapter Installation of Binary Distribution @enumerate @item Download @value{ZIPFILENAME} from the UNU.RAN @uref{http://statmath.wu.ac.at/unuran/download.html,download} page. @item Unpack @value{ZIPFILENAME}. It creates directory @file{unuran} which contains the following files: @table @file @item unuran.h Header file to be included in your application source file. (Contains function prototypes, typedefs and macros.) @item RngStream.h @itemx unuran_urng_rngstreams.h Header files required for using the @file{RngStream} library. @item @value{LIBUNURAN}.def Module-definition file. (Declares all functions exported the UNU.RAN library.) @item @value{LIBUNURAN}.dll @itemx @value{LIBUNURAN}.dll.manifest DLL (Dynamic link library) and its manifest file (must always be located in the same directory). @item @value{LIBUNURAN}.lib Import library file. @item @value{LIBUNURAN}.exp Library export file. @item unuran.pdf UNU.RAN User Manual. @item unuran_win32.pdf Short description for building your own application using UNU.RAN with Microsoft Visual C. @item example1.c @itemx example2.c Two example files. @end table @item @emph{Optional:} Move directory @file{unuran} into an appropriate place, e.g. @file{C:\unuran} (or maybe the folder where you build your application). Throughout this document, the UNU.RAN installation folder is referred to as @file{}. For example, if UNU.RAN has been installed in the folder @file{C:\unuran}, references to @file{\@value{LIBUNURAN}.lib} represent @file{C:\unuran\@value{LIBUNURAN}.lib}. @item @emph{Optional:} Add @file{} to the @env{PATH} environment variable. Thus your application can find the location of @value{LIBUNURAN}.dll when it is started. @end enumerate @c -------------------------------------------------------------------- @node URNG, IDE, Installation, TOP @chapter Uniform Random Number Generator This binary distribution uses Pierre L'Ecuyers @uref{http://statmath.wu.ac.at/software/RngStreams,RngStreams} library as its default uniform random number generator. This library uses a package seed. Thus you should add the following piece of code at the beginning of your application (at least before you call any of the UNU.RAN functions): @example unsigned long seed[] = @{111u, 222u, 333u, 444u, 555u, 666u@}; RngStream_SetPackageSeed(seed); @end example @noindent where @code{111u}, @dots{}, @code{666u} should be replaced by your seeds. @sp 1 @noindent @emph{Remark:} UNU.RAN works with any source of uniform random numbers. We refer to the UNU.RAN for details if you want to use your own uniform random number generator instead of the @file{RngStreams} library. @c -------------------------------------------------------------------- @node IDE, CLI, URNG, TOP @chapter Building Your Own Project in Visual Studio @emph{Note:} The information below applies to the Visual C++ .NET 2005. @sp 1 Let us assume that you want to build a target named @file{example.exe} and have: @itemize @item a source file named @file{example.c} which uses the C API of the UNU.RAN library (or alternatively a C++ file @file{example.cpp}); @item a folder where this file is located and which we refer to as @file{}. @end itemize One way to build your project is to create a @emph{Solution} named @file{example.sln} as described here. @enumerate @item Start Microsoft Visual Studio .NET 2005. @item Build the @file{example.sln} solution: From the @file{File} menu, select @file{New}, and then @file{Project}. When the @file{New Project} dialog box appears then @itemize @minus @item In the @file{Project Types} pane, select @file{Visual C++ Win32 Projects}. @item In the @file{Templates pane}, select the @file{Win32 Console Project} icon. @item Fill in the project name (@samp{example}). @item If necessary, correct the location of the project (to @file{}). @item Click @file{OK}. @end itemize When the Win32 Application Wizard appears then @itemize @minus @item Click on @file{Application Settings}. @item Select @file{Console Application} as application type. @item Make sure that @file{Empty Project} is checked in @file{Additional Options}. @item Click @file{Finish}. @end itemize This creates a solution, @file{example}, with a single project, @file{example}. You can view the contents of the solution by selecting @file{Solution Explorer} in the @file{View} menu. @item Add your source file to the project. From the @file{Project} menu, choose @file{Add Existing Item}: @itemize @minus @item Move to folder @file{} and select @file{example.c}. @item Click @file{Add}. @end itemize @item Set some options so that the project knows where to find the UNU.RAN include files and the UNU.RAN libraries. @itemize @minus @item From the @file{Project} menu, choose @file{example Properties}. The @file{example Property Pages} dialog box appears. @item In the @file{Configuration} drop-down list, select @file{Release}. @item Select @file{C/C++} in the @file{Configuration Properties} tree. @item Select @file{General}. @item In the @file{Additional Include Directories} field @itemize . @item add directory @file{}; @item choose @file{No} for @file{Detect 64-bit Portability Issues}. @end itemize @item Select @file{Linker} in the @file{Configuration Properties} tree. @itemize . @item Select @file{General} and then select @file{Additional Library Directories}. @item Add directory @file{}. @item Select @file{Input} and then select @file{Additional Dependencies}. Add library file @file{@value{LIBUNURAN}.lib}. @end itemize @item Click @file{OK} to close the @file{example Property Pages} dialog box. @end itemize @item Set the default project configuration. @itemize @minus @item From the @file{Build} menu, select @file{Configuration Manager}. @item Select @file{Release} in the @file{Active Solution Configuration} drop-down list. @item Click @file{Close}. @end itemize @item Finally, to build the project, from the @file{Build} menu, select @file{Build Solution}. @end enumerate After completion of the compiling and linking process, the target is created. The full path of the executable is @file{\example\Release\example.exe}. Notice that, if you want to run the @file{example.exe} by clicking on it, you need to locate the DLL file in the same directory or adjust the @env{PATH} environment variable for the DLL (@pxref{Installation}). @c -------------------------------------------------------------------- @node CLI, Examples, IDE, TOP @chapter Building Your Own Project on the Command Line First you have to set the appropriate environment variables to enable 32-bit command-line builds by means of the @file{vcvars32.bat} file: @enumerate @item At the command prompt, change to the @file{\bin} subdirectory of your Visual C++ installation. @item Run @file{vcvars32.bat} by typing @code{VCVARS32}. @end enumerate Then change to your application folder @file{}) that contains your source file(s) (C or C++). Assume you have one C source file @file{example.c}. Then you can compile and link your executable by @example cl /O2 /W3 /MD /I example.c @value{LIBUNURAN}.lib /link /LIBPATH: @end example which creates the file @file{example.exe}. When you want to run @file{example} then the location of the DLL @value{LIBUNURAN}.dll (and that of the C run-time library @file{msvcr80.dll}) have to be included in the environment variable @env{PATH} (or you need to locate these DLLs in the same directory). @c -------------------------------------------------------------------- @node Examples, Example1, CLI, TOP @chapter Two Examples Here we give small examples. These show @itemize @item How to seed the seed for the @uref{http://statmath.wu.ac.at/software/RngStreams,RngStreams} library. @item How to create an UNU.RAN generator for a given target distribution. For more detailed information we refer to the @uref{http://statmath.wu.ac.at/unuran/doc/unuran.html,UNU.RAN manual}. @item How to use an independent stream of uniform random numbers for one of these UNU.RAN generators. @item We demonstrate the usage of the easy to use String API. @item We furthermore show the same example with the more flexible C API. @end itemize @menu * Example1:: The String API * Example2:: The C API @end menu @c -------------------------------------------------------------------- @node Example1, Example2, Examples, Examples @section The String API @smallexample @include ref_example_win32_1.texi @end smallexample @c -------------------------------------------------------------------- @node Example2, , Example1, Examples @section The C API @smallexample @include ref_example_win32_2.texi @end smallexample @c -------------------------------------------------------------------- @bye unuran-1.11.0/doc/unuran_win32_libname.texi0000644001357500135600000000010514430713451015514 00000000000000@set LIBUNURAN libunuran111 @set ZIPFILENAME unuran-1.11.0-win32.zip unuran-1.11.0/doc/src/0000755001357500135600000000000014430713526011456 500000000000000unuran-1.11.0/doc/src/intro.dh0000644001357500135600000003615114420445767013064 00000000000000 =NODE Intro Introduction =UP TOP [10] =EON /*---------------------------------------------------------------------------*/ =NODE UsageDoc Usage of this document =UP Intro [20] =DESCRIPTION We designed this document in a way such that one can use UNU.RAN with reading as little as necessary. Read @ref{Installation} for the instructions to install the library. @ref{Concepts,,Concepts of UNU.RAN}, discribes the basics of UNU.RAN. It also has a short guideline for choosing an appropriate method. In @ref{Examples} examples are given that can be copied and modified. They also can be found in the directory @file{examples} in the source tree. Further information are given in consecutive chapters. @ref{Distribution_objects,,Handling distribution objects}, describes how to create and manipulate distribution objects. @ref{Stddist,,standard distributions}, describes predefined distribution objects that are ready to use. @ref{Methods} describes the various methods in detail. For each of possible distribution classes (continuous, discrete, empirical, multivariate) there exists a short overview section that can be used to choose an appropriate method followed by sections that describe each of the particular methods in detail. These are merely for users with some knowledge about the methods who want to change method-specific parameters and can be ignored by others. Abbreviations and explanation of some basic terms can be found in @ref{Glossary}. =EON /*---------------------------------------------------------------------------*/ =NODE UsageLib Using the library =UP Intro [40] =DESCRIPTION @subsubheading ANSI C Compliance The library is written in ANSI C and is intended to conform to the ANSI C standard. It should be portable to any system with a working ANSI C compiler. The library does not rely on any non-ANSI extensions in the interface it exports to the user. Programs you write using UNU.RAN can be ANSI compliant. Extensions which can be used in a way compatible with pure ANSI C are supported, however, via conditional compilation. This allows the library to take advantage of compiler extensions on those platforms which support them. To avoid namespace conflicts all exported function names and variables have the prefix @code{unur_}, while exported macros have the prefix @code{UNUR_}. @subsubheading Compiling and Linking If you want to use the library you must include the UNU.RAN header file @example #include @end example @noindent If you also need the test routines then also add @example #include @end example @noindent If wrapper functions for external sources of uniform random number generators are used, the corresponding header files must also be included, e.g., @example #include @end example @noindent If these header files are not installed on the standard search path of your compiler you will also need to provide its location to the preprocessor as a command line flag. The default location of the @file{unuran.h} is @file{/usr/local/include}. A typical compilation command for a source file @file{app.c} with the GNU C compiler @code{gcc} is, @example gcc -I/usr/local/include -c app.c @end example @noindent This results in an object file @file{app.o}. The default include path for @code{gcc} searches @file{/usr/local/include} automatically so the @code{-I} option can be omitted when UNU.RAN is installed in its default location. The library is installed as a single file, @file{libunuran.a}. A shared version of the library is also installed on systems that support shared libraries. The default location of these files is @file{/usr/local/lib}. To link against the library you need to specify the main library. The following example shows how to link an application with the library (and the the RNGSTREAMS library if you decide to use this source of uniform pseudo-random numbers), @example gcc app.o -lunuran -lrngstreams -lm @end example @subsubheading Shared Libraries To run a program linked with the shared version of the library it may be necessary to define the shell variable @code{LD_LIBRARY_PATH} to include the directory where the library is installed. For example, @example LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH @end example @noindent To compile a statically linked version of the program instead, use the @code{-static} flag in @code{gcc}, @example gcc -static app.o -lunuran -lrngstreams -lm @end example @subsubheading Compatibility with C++ The library header files automatically define functions to have @code{extern "C"} linkage when included in C++ programs. =EON /*---------------------------------------------------------------------------*/ =NODE Concepts Concepts of UNU.RAN =UP Intro [50] =DESCRIPTION UNU.RAN is a C library for generating non-uniformly distributed random variates. Its emphasis is on the generation of non-standard distribution and on streams of random variates of special purposes. It is designed to provide a consistent tool to sample from distributions with various properties. Since there is no universal method that fits for all situations, various methods for sampling are implemented. UNU.RAN solves this complex task by means of an object oriented programming interface. Three basic objects are used: @itemize @bullet @item distribution object @code{UNUR_DISTR}@* Hold all information about the random variates that should be generated. @item generator object @code{UNUR_GEN}@* Hold the generators for the given distributions. Two generator objects are completely independent of each other. They may share a common uniform random number generator or have their owns. @item parameter object @code{UNUR_PAR}@* Hold all information for creating a generator object. It is necessary due to various parameters and switches for each of these generation methods. Notice that the parameter objects only hold pointers to arrays but do not have their own copy of such an array. Especially, if a dynamically allocated array is used it @emph{must not} be freed until the generator object has been created! @end itemize The idea behind these structures is that creatin distributions, choosing a generation method and draing samples are orthogonal (ie. independent) functions of the library. The parameter object is only introduced due to the necessity to deal with various parameters and switches for each of these generation methods which are required to adjust the algorithms to unusual distributions with extreme properties but have default values that are suitable for most applications. These parameters and the data for distributions are set by various functions. Once a generator object has been created sampling (from the univariate continuous distribution) can be done by the following command: @example double x = unur_sample_cont(generator); @end example @noindent Analogous commands exist for discrete and multivariate distributions. For detailed examples that can be copied and modified see @ref{Examples}. @subheading Distribution objects All information about a distribution are stored in objects (structures) of type @code{UNUR_DISTR}. UNU.RAN has five different types of distribution objects: @table @code @item cont Continuous univariate distributions. @item cvec Continuous multivariate distributions. @item discr Discrete univariate distributions. @item cemp Continuous empirical univariate distribution, ie. given by a sample. @item cvemp Continuous empirical multivariate distribution, ie. given by a sample. @item matr Matrix distributions. @end table @noindent Distribution objects can be created from scratch by the following call @example distr = unur_distr__new(); @end example @noindent where @code{} is one of the five possible types from the above table. Notice that these commands only create an @emph{empty} object which still must be filled by means of calls for each type of distribution object (@pxref{Distribution_objects,,Handling distribution objects}). The naming scheme of these functions is designed to indicate the corresponding type of the distribution object and the task to be performed. It is demonstated on the following example. @example unur_distr_cont_set_pdf(distr, mypdf); @end example @noindent This command stores a PDF named @code{mypdf} in the distribution object @code{distr} which must have the type @code{cont}. Of course UNU.RAN provides an easier way to use standard distributions. Instead of using @command{unur_distr__new} calls and fuctions @command{unur_distr__set_<@dots{}>} for setting data, objects for standard distribution can be created by a single call. Eg. to get an object for the normal distribution with mean 2 and standard deviation 5 use @example double parameter[2] = @{2.0 ,5.0@}; UNUR_DISTR *distr = unur_distr_normal(parameter, 2); @end example @noindent For a list of standard distributions see @ref{Stddist,,Standard distributions}. @subheading Generation methods The information that a distribution object must contain depends heavily on the chosen generation method choosen. Brackets indicate optional information while a tilde indicates that only an approximation must be provided. See @ref{Glossary}, for unfamiliar terms. @include methods_cont.texi @include methods_cemp.texi @include methods_cvec.texi @include methods_cvemp.texi @include methods_discr.texi @include methods_matr.texi @include methods_mcmc.texi Because of tremendous variety of possible problems, UNU.RAN provides many methods. All information for creating a generator object has to be collected in a parameter object first. For example, if the task is to sample from a continuous distribution the method AROU might be a good choice. Then the call @example UNUR_PAR *par = unur_arou_new(distribution); @end example @noindent creates an parameter object @code{par} with a pointer to the distribution object and default values for all necessary parameters for method AROU. Other methods can be used by replacing @code{arou} with the name of the desired methods (in lower case letters): @example UNUR_PAR *par = unur__new(distribution); @end example @noindent This sets the default values for all necessary parameters for the chosen method. These are suitable for almost all applications. Nevertheless, it is possible to control the behavior of the method using corresponding @command{set} calls for each method. This might be necessary to adjust the algorithm for an unusual distribution with extreme properties, or just for fine tuning the perforence of the algorithm. The following example demonstrates how to change the maximum number of iterations for method NINV to the value 50: @example unur_ninv_set_max_iteration(par, 50); @end example @noindent All available methods are described in details in @ref{Methods}. @subheading Creating a generator object Now it is possible to create a generator object: @example UNUR_GEN *generator = unur_init(par); if (generator == NULL) exit(EXIT_FAILURE); @end example @noindent @strong{Important:} You must always check whether unur_init() has been executed successfully. Otherwise the NULL pointer is returned which causes a segmentation fault when used for sampling. @noindent @strong{Important:} The call of unur_init() @strong{destroys} the parameter object!@* Moreover, it is recommended to call unur_init() immediately after the parameter object @code{par} has created and modified. An existing generator object is a rather static construct. Nevertheless, some of the parameters can still be modified by @command{chg} calls, e.g. @example unur_ninv_chg_max_iteration(gen, 30); @end example @noindent Notice that it is important @emph{when} parameters are changed because different functions must be used: The function name includes the term @command{set} and the first argument must be of type @code{UNUR_PAR} when the parameters are changed @emph{before} the generator object is created. The function name includes the term @command{chg} and the first argument must be of type @code{UNUR_GEN} when the parameters are changed for an @emph{existing} generator object. For details see @ref{Methods}. @subheading Sampling You can now use your generator object in any place of your program to sample from your distribution. You only have to take care about the type of variates it computes: @code{double}, @code{int} or a vector (array of @code{double}s). Notice that at this point it does not matter whether you are sampling from a gamma distribution, a truncated normal distribution or even an empirical distribution. @subheading Reinitializing It is possible for a generator object to change the parameters and the domain of the underlying distribution. This must be done by extracting this object by means of a unur_get_distr() call and changing the distribution using the correspondig set calls, see @ref{Distribution_objects,,Handling distribution objects}. The generator object @strong{must} then be reinitialized by means of the unur_reinit() call. @emph{Important}: Currently not all methods allow reinitialization, see the description of the particular method (keyword @i{Reinit}). @subheading Destroy When you do not need your generator object any more, you should destroy it: @example unur_free(generator); @end example @subheading Uniform random numbers Each generator object can have its own uniform random number generator or share one with others. When created a parameter object the pointer for the uniform random number generator is set to the default generator. However, it can be changed at any time to any other generator: @example unur_set_urng(par, urng); @end example @noindent or @example unur_chg_urng(generator, urng); @end example @noindent respectively. See @ref{URNG,,Using uniform random number generators}, for details. =EON /*---------------------------------------------------------------------------*/ =NODE Contact Contact the authors =UP Intro [60] =DESCRIPTION If you have any problems with UNU.RAN, suggestions how to improve the library, or find a bug, please contact us via email @email{unuran@@statmath.wu.ac.at}. For news please visit out homepage at @uref{http://statmath.wu.ac.at/unuran/}. =EON /*---------------------------------------------------------------------------*/ unuran-1.11.0/doc/src/methods_mcmc.texi0000644001357500135600000000035114420445767014742 00000000000000@cartouche @noindent Markov Chain Methods for @b{continuous multivariate distributions}@* sample with @command{unur_sample_vec} @noindent GIBBS: T-concave logPDF and derivatives of logPDF. @* HITRO: Requires PDF. @end cartouche unuran-1.11.0/doc/src/ref_example2_str.texi0000644001357500135600000000524214430713446015536 00000000000000/* ------------------------------------------------------------- */ /* File: example2_str.c */ /* ------------------------------------------------------------- */ /* String API. */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* In this example we use a generic distribution object */ /* and sample from this distribution. */ /* */ /* The PDF of our distribution is given by */ /* */ /* / 1 - x*x if |x| <= 1 */ /* f(x) = < */ /* \ 0 otherwise */ /* */ /* We use method TDR (Transformed Density Rejection) which */ /* required a PDF and the derivative of the PDF. */ /* ------------------------------------------------------------- */ int main(void) @{ int i; /* loop variable */ double x; /* will hold the random number */ /* Declare UNURAN generator object. */ UNUR_GEN *gen; /* generator object */ /* Create the generator object. */ /* Use a generic continuous distribution. */ /* Choose a method: TDR. */ gen = unur_str2gen( "distr = cont; pdf=\"1-x*x\"; domain=(-1,1) & method=tdr"); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) @{ fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); @} /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) @{ x = unur_sample_cont(gen); printf("%f\n",x); @} /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); @} /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/doc/src/ref_example_discr.texi0000644001357500135600000000461014430713446015746 00000000000000/* ------------------------------------------------------------- */ /* File: example_discr.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* Example how to sample from a discrete univariate distribution.*/ /* ------------------------------------------------------------- */ int main(void) @{ int i; double param = 0.3; double probvec[10] = @{1.0, 2.0, 3.0, 4.0, 5.0,\ 6.0, 7.0, 8.0, 4.0, 3.0@}; /* Declare the three UNURAN objects. */ UNUR_DISTR *distr1, *distr2; /* distribution objects */ UNUR_PAR *par1, *par2; /* parameter objects */ UNUR_GEN *gen1, *gen2; /* generator objects */ /* First distribution: defined by PMF. */ distr1 = unur_distr_geometric(¶m, 1); unur_distr_discr_set_mode(distr1, 0); /* Choose a method: DARI. */ par1 = unur_dari_new(distr1); gen1 = unur_init(par1); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen1 == NULL) @{ fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); @} /* Second distribution: defined by (finite) PV. */ distr2 = unur_distr_discr_new(); unur_distr_discr_set_pv(distr2, probvec, 10); /* Choose a method: DGT. */ par2 = unur_dgt_new(distr2); gen2 = unur_init(par2); if (gen2 == NULL) @{ fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); @} /* print some random integers */ for (i=0; i<10; i++)@{ printf("number %d: %d\n", i*2, unur_sample_discr(gen1) ); printf("number %d: %d\n", i*2+1, unur_sample_discr(gen2) ); @} /* Destroy all objects. */ unur_distr_free(distr1); unur_distr_free(distr2); unur_free(gen1); unur_free(gen2); exit (EXIT_SUCCESS); @} /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/doc/src/ref_example_emp_str.texi0000644001357500135600000000401414430713446016311 00000000000000/* ------------------------------------------------------------- */ /* File: example_emp_str.c */ /* ------------------------------------------------------------- */ /* String API. */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* Example how to sample from an empirial continuous univariate */ /* distribution. */ /* ------------------------------------------------------------- */ int main(void) @{ int i; double x; /* Declare UNURAN generator object. */ UNUR_GEN *gen; /* generator object */ /* Create the generator object. */ gen = unur_str2gen("distr = cemp; \ data=(-0.10, 0.05,-0.50, 0.08, 0.13, \ -0.21,-0.44,-0.43,-0.33,-0.30, \ 0.18, 0.20,-0.37,-0.29,-0.90) & \ method=empk; smoothing=0.8"); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) @{ fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); @} /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) @{ x = unur_sample_cont(gen); printf("%f\n",x); @} /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); @} /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/doc/src/ref_example_anti.texi0000644001357500135600000001342514430713446015601 00000000000000/* ------------------------------------------------------------- */ /* File: example_anti.c */ /* ------------------------------------------------------------- */ #ifdef UNURAN_SUPPORTS_PRNG /* ------------------------------------------------------------- */ /* This example makes use of the PRNG library for generating */ /* uniform random numbers. */ /* (see http://statmath.wu.ac.at/prng/) */ /* To compile this example you must have set */ /* ./configure --with-urng-prng */ /* (Of course the executable has to be linked against the */ /* PRNG library.) */ /* ------------------------------------------------------------- */ /* Example how to sample from two streams of antithetic random */ /* variates from Gaussian N(2,5) and Gamma(4) distribution, resp.*/ /* ------------------------------------------------------------- */ /* Include UNURAN header files. */ #include #include /* ------------------------------------------------------------- */ int main(void) @{ int i; /* loop variable */ double xn, xg; /* will hold the random number */ double fparams[2]; /* array for parameters for distribution */ /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen_normal, *gen_gamma; /* generator objects */ /* Declare objects for uniform random number generators. */ UNUR_URNG *urng1, *urng2; /* uniform generator objects */ /* PRNG only: */ /* Make a object for uniform random number generator. */ /* For details see http://statmath.wu.ac.at/prng/. */ /* The first generator: Gaussian N(2,5) */ /* uniform generator: We use the Mersenne Twister. */ urng1 = unur_urng_prng_new("mt19937(1237)"); if (urng1 == NULL) exit (EXIT_FAILURE); /* UNURAN generator object for N(2,5) */ fparams[0] = 2.; fparams[1] = 5.; distr = unur_distr_normal( fparams, 2 ); /* Choose method TDR with variant PS. */ par = unur_tdr_new( distr ); unur_tdr_set_variant_ps( par ); /* Set uniform generator in parameter object. */ unur_set_urng( par, urng1 ); /* Set auxilliary uniform random number generator. */ /* We use the default generator. */ unur_use_urng_aux_default( par ); /* Alternatively you can create and use your own auxilliary */ /* uniform random number generator: */ /* UNUR_URNG *urng_aux; */ /* urng_aux = unur_urng_prng_new("tt800"); */ /* if (urng_aux == NULL) exit (EXIT_FAILURE); */ /* unur_set_urng_aux( par, urng_aux ); */ /* Create the generator object. */ gen_normal = unur_init(par); if (gen_normal == NULL) @{ fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); @} /* Destroy distribution object (gen_normal has its own copy). */ unur_distr_free(distr); /* The second generator: Gamma(4) with antithetic variates. */ /* uniform generator: We use the Mersenne Twister. */ urng2 = unur_urng_prng_new("anti(mt19937(1237))"); if (urng2 == NULL) exit (EXIT_FAILURE); /* UNURAN generator object for gamma(4) */ fparams[0] = 4.; distr = unur_distr_gamma( fparams, 1 ); /* Choose method TDR with variant PS. */ par = unur_tdr_new( distr ); unur_tdr_set_variant_ps( par ); /* Set uniform generator in parameter object. */ unur_set_urng( par, urng2 ); /* Set auxilliary uniform random number generator. */ /* We use the default generator. */ unur_use_urng_aux_default( par ); /* Alternatively you can create and use your own auxilliary */ /* uniform random number generator (see above). */ /* Notice that both generator objects gen_normal and */ /* gen_gamma can share the same auxilliary URNG. */ /* Create the generator object. */ gen_gamma = unur_init(par); if (gen_gamma == NULL) @{ fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); @} /* Destroy distribution object (gen_normal has its own copy). */ unur_distr_free(distr); /* Now we can sample pairs of negatively correlated random */ /* variates. E.g.: */ for (i=0; i<10; i++) @{ xn = unur_sample_cont(gen_normal); xg = unur_sample_cont(gen_gamma); printf("%g, %g\n",xn,xg); @} /* When you do not need the generator objects any more, you */ /* can destroy it. */ unur_free(gen_normal); unur_free(gen_gamma); /* We also should destroy the uniform random number generators.*/ unur_urng_free(urng1); unur_urng_free(urng2); exit (EXIT_SUCCESS); @} /* end of main() */ /* ------------------------------------------------------------- */ #else #include #include int main(void) @{ printf("You must enable the PRNG library to run this example!\n\n"); exit (77); /* exit code for automake check routines */ @} #endif /* ------------------------------------------------------------- */ unuran-1.11.0/doc/src/ref_example1_str.texi0000644001357500135600000000413614430713446015536 00000000000000/* ------------------------------------------------------------- */ /* File: example1_str.c */ /* ------------------------------------------------------------- */ /* String API. */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ int main(void) @{ int i; /* loop variable */ double x; /* will hold the random number */ /* Declare UNURAN generator object. */ UNUR_GEN *gen; /* generator object */ /* Create the generator object. */ /* Use a predefined standard distribution: */ /* Standard Gaussian distribution. */ /* Choose a method: AROU. */ /* For other (suitable) methods replace "arou" with the */ /* respective name. */ gen = unur_str2gen("normal() & method=arou"); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) @{ fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); @} /* Now you can use the generator object `gen' to sample from */ /* the standard Gaussian distribution. */ /* Eg.: */ for (i=0; i<10; i++) @{ x = unur_sample_cont(gen); printf("%f\n",x); @} /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); @} /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/doc/src/ref_example0_str.texi0000644001357500135600000000401414430713446015530 00000000000000/* ------------------------------------------------------------- */ /* File: example0_str.c */ /* ------------------------------------------------------------- */ /* String API. */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ int main(void) @{ int i; /* loop variable */ double x; /* will hold the random number */ /* Declare UNURAN generator object. */ UNUR_GEN *gen; /* generator object */ /* Create the generator object. */ /* Use a predefined standard distribution: */ /* Standard Gaussian distribution. */ /* Use method AUTO: */ /* Let UNURAN select a suitable method for you. */ gen = unur_str2gen("normal()"); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) @{ fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); @} /* Now you can use the generator object `gen' to sample from */ /* the standard Gaussian distribution. */ /* Eg.: */ for (i=0; i<10; i++) @{ x = unur_sample_cont(gen); printf("%f\n",x); @} /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); @} /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/doc/src/methods_cvec.texi0000644001357500135600000000052314420445767014744 00000000000000@cartouche @noindent Methods for @b{continuous multivariate distributions}@* sample with @command{unur_sample_vec} @noindent NORTA: Requires rank correlation matrix and marginal distributions. @* VNROU: Requires the PDF. @* MVSTD: Generator for built-in standard distributions. @* MVTDR: Requires PDF and gradiant of PDF. @end cartouche unuran-1.11.0/doc/src/methods_cemp.texi0000644001357500135600000000034114420445767014746 00000000000000@cartouche @noindent Methods for @b{continuous empirical univariate distributions}@* sample with @command{unur_sample_cont} @noindent EMPK: Requires an observed sample. @* EMPL: Requires an observed sample. @end cartouche unuran-1.11.0/doc/src/ref_example3_str.texi0000644001357500135600000000472714430713446015546 00000000000000/* ------------------------------------------------------------- */ /* File: example3_str.c */ /* ------------------------------------------------------------- */ /* String API. */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ int main(void) @{ int i; /* loop variable */ double x; /* will hold the random number */ /* Declare UNURAN generator object. */ UNUR_GEN *gen; /* generator object */ /* Create the generator object. */ /* Use a predefined standard distribution: */ /* Gaussian with mean 2. and standard deviation 0.5. */ /* Choose a method: TDR with parameters */ /* c = 0: use T(x)=log(x) for the transformation; */ /* variant "immediate acceptance"; */ /* number of construction points = 10. */ gen = unur_str2gen( "normal(2,0.5) & method=tdr; c=0.; variant_ia; cpoints=10"); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) @{ fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); @} /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) @{ x = unur_sample_cont(gen); printf("%f\n",x); @} /* It is possible with method TDR to truncate the distribution */ /* for an existing generator object ... */ unur_tdr_chg_truncated( gen, -1., 0. ); /* ... and sample again. */ for (i=0; i<10; i++) @{ x = unur_sample_cont(gen); printf("%f\n",x); @} /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); @} /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/doc/src/make_texi.pl0000754001357500135600000012435214420445767013722 00000000000000#!/usr/bin/perl ############################################################################## # # # UNURAN -- Universal Non-Uniform Random number generator # # # ############################################################################## # # # FILE: merge_h.pl # # # # Read all UNU.RAN header files, extract manual, and create texinfo file # # # ############################################################################## # # # Copyright (c) 2000-2011 Wolfgang Hoermann and Josef Leydold # # Department of Statistics and Mathematics, WU Wien, Austria # # # # This program is free software; you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # # the Free Software Foundation; either version 2 of the License, or # # (at your option) any later version. # # # # This program is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with this program; if not, write to the # # Free Software Foundation, Inc., # # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA # # # ############################################################################## use strict; # set to 0 to disable output of nodes to stderr my $VERBOSE = 1; # set to 0 if no additinal page breaks should be included my $PAGEBREAKS = 1; # set to 0 if no list of calls should be added to top of # Function Reference sections (only in HTML output) my $LISTOFCALLS = 1; ############################################################ # constants my $DEP_file = "./src/.dep-unuran_src_texi"; my $greeks = # small greek letters "alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|". "mu|nu|xi|omikron|pi|rho|sigma|tau|ypsilon|phi|chi|psi|omega|". # capital greek letters "Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Phi|Psi|Omega"; ############################################################ sub usage { my $progname = $0; $progname =~ s#^.*/##g; print STDERR < Perl script extracts documentation for unuran library from header files and transform it into texinfo format. The output is written on STDOUT. For a detailed description see README. EOM exit; } ############################################################ use FileHandle; ############################################################ my %node_TAGs = ( "=TOP" => { "format" => \&texi_NODE }, "=NODE" => { "format" => \&texi_NODE }, "=NODEX" => { "format" => \&texi_NODE }, "=DISTR" => { "format" => \&texi_NODE }, "=METHOD" => { "format" => \&texi_NODE }, "=APPENDIX" => { "format" => \&texi_NODE }, ); #........................................................... my %TAGs = ( "=UP" => { "scan" => \&scan_UP }, "=DESCRIPTION" => { "scan" => \&scan_do_nothing }, "=HOWTOUSE" => { "scan" => \&scan_do_nothing }, "=ROUTINES" => { "scan" => \&scan_ROUTINES }, "=REQUIRED" => { "scan" => \&scan_chop_blanks }, "=OPTIONAL" => { "scan" => \&scan_chop_blanks }, "=SPEED" => { "scan" => \&scan_chop_blanks }, "=REINIT" => { "scan" => \&scan_chop_blanks }, "=SEEALSO" => { "scan" => \&scan_do_nothing }, "=ABSTRACT" => { "scan" => \&scan_do_nothing }, "=REF" => { "scan" => \&scan_REF }, "=PDF" => { "scan" => \&scan_PDF }, "=PMF" => { "scan" => \&scan_PDF }, "=CONST" => { "scan" => \&scan_PDF }, "=CDF" => { "scan" => \&scan_PDF }, "=DOMAIN" => { "scan" => \&scan_PDF }, "=FPARAM" => { "scan" => \&scan_FPARAM }, "=STDGEN" => { "scan" => \&scan_STDGEN }, "=END" => { "scan" => \&scan_do_nothing }, ); ############################################################# # list of nodes my $LIST_nodes; my @LIST_nodes_sorted; # list of routines my $LIST_routines; # scanned input # it is stored in the form # $IN->{node name}->{TAG} = entry my $IN; # texinfo output my $TEXI = "\@c automatically generated by `make_texi.pl'\n\n"; # dependencies my $DEP = "\$(unuran_src): "; ############################################################# # read directory name from argument list ... my $top_dir = shift; (usage and die) unless $top_dir; # header files in directory tree ... # files are stored with key = filename and # value = complete path of file. my %header_files; scan_dir($top_dir); # now scan all header files foreach my $file (sort keys %header_files) { scan_file($file); } # check node structure check_node_structure(); # format texinfo output texi_node("TOP",0); # write all output on STDOUT print $TEXI; # write dependencies open DEP, ">$DEP_file" or die "Cannot open file for writing: $DEP_file"; print DEP "$DEP\n"; close DEP; # end of job exit 0; ############################################################# # get all header files in all sub directories ... # sub scan_dir { my $dir = $_[0]; # search subtree for header files ... open (FILES, "find $dir |") or die "cannot find directory \"$dir\"."; while () { chomp; next unless /^.*\/+(.*\.d?h)$/; next if /\.\#/; next if /source/; # we are not interested in these files next if /struct/; # we are not interested in these files $header_files{$1} = $_; # store file and path of file } close FILES; } # end of scan_dir() ############################################################# # scan given file ... # sub scan_file { my $file = $_[0]; my $file_handle = new FileHandle; # open file ... open $file_handle, $header_files{$file} or die "cannot find file $file\n"; # scan file my $have_found_TAG = 0; while (1) { # search for node TAG while (<$file_handle>) { last if /^\s*=[A-Z]/; } # is there a node TAG ? unless (/^\s*(\/\*)?\s*(=[A-Z]+)/) { print STDERR "[$file] -- no doc --\n" if $VERBOSE and not $have_found_TAG; close $file_handle or die "wrong file handle"; return; } # prepare line with node TAG s/^\s*//; s/\s*$//; # trim blanks my $node_line = $_; # store line # have found node TAG (my $node_type, my $node_name, my $node_title) = split /\s+/, $node_line, 3; # print info on screen print STDERR "[$file] $node_type ($node_name):\t" if $VERBOSE; # is this a valid node TAG unless ($node_TAGs{$node_type}) { print STDERR "\n\t[$file] invalid node TAG `$node_type' (skip over rest of file)\n"; close $file_handle or die "wrong file handle"; return; } # node must be unique if ($LIST_nodes->{$node_name}) { print STDERR "\n\t[$file] node `$node_name' used twice (skip over node)\n"; close $file_handle or die "wrong file handle"; return; } # store node name $LIST_nodes->{$node_name} = 1; $have_found_TAG = 1; # read till end of node my $node_text = $node_line."\n"; while (<$file_handle>) { if (/^\s*(\/\*)?\s*=EON/) { # End-Of-Node TAG last; } else { # add line to stored text s/^\s*//; s/\s*$//; # trim blanks $node_text .= $_."\n"; # store content of node } } # add dependency $DEP .= "$header_files{$file} "; # now scan node text; scan_node($node_text, $file); } } # end of scan_file() ############################################################# # scan mode ... # sub scan_node { my $node_text = $_[0]; my $file = $_[1]; # add =END TAG to text (for convienience) $node_text .= "\n=END"; # split into lines my @lines = split /\n/, $node_text; # first line contains node definition my $node_line = shift @lines; # get node name (my $node_type, my $node_name, my $node_title) = split /\s+/, $node_line, 3; # store node $IN->{$node_name}->{"=NODE_TYPE"} = $node_type; $IN->{$node_name}->{"=TITLE"} = $node_title; $IN->{$node_name}->{"=FILE"} = $file; # scan all TAGs (node sections) my $this_TAG = "=END"; # add =END tag to node TAG foreach my $l (@lines) { # next TAG ? if ($l =~ /^\s*(\/\*)?\s*(=[A-Z]+)\s*(.*)$/) { # store next TAG $this_TAG = $2; # save rest of line $l = $3; print STDERR " $this_TAG" if $VERBOSE and $this_TAG ne "=END"; unless ($TAGs{$this_TAG}) { print STDERR "\n\t[$file] $node_name: invalid TAG `$this_TAG'\n"; last; } } # append to stored lines # (except for =END TAG) unless ($this_TAG eq "=END") { $IN->{$node_name}->{$this_TAG} .= $l."\n"; } } # scan and format all node sections foreach my $tag (keys %TAGs) { &{$TAGs{$tag}{"scan"}} ($node_name,$tag); # make some modifications transform_special_strings(\($IN->{$node_name}->{$tag})); } # close line on screen print STDERR "\n" if $VERBOSE; # there must be an UP TAG die "UP missing for node $node_name" unless $IN->{$node_name}->{"=UP"}; } # end of scan_node() ############################################################# # check node structure # sub check_node_structure { # we need a TOP node die "TOP node missing" unless $IN->{TOP}; # add node `(dir)' to list of node $LIST_nodes->{"(dir)"} = 1; # check =UP nodes foreach my $n (keys %{$IN}) { unless ($LIST_nodes->{$IN->{$n}->{"=UP"}}) { print STDERR "$n: invalid UP node `".$IN->{$n}->{"=UP"}."'\n"; } } # sort nodes @LIST_nodes_sorted = sort nodes_by_order_tag keys %$LIST_nodes; # print node structure print_node("TOP",""); } # end of check_node_structure() sub print_node { my $node = $_[0]; # node for which all subnodes should be printed my $indent = $_[1]; # line indent # print node on screen print STDERR "$indent$node: (".$IN->{$node}->{"=TITLE"}.")\n" if $VERBOSE; # search for all subnodes foreach my $n (@LIST_nodes_sorted) { next unless $IN->{$n}->{"=UP"} eq $node; print_node($n,"$indent\t"); } } # end if print_node() ############################################################# # compare two nodes by their order TAG (lexicographically) # sub nodes_by_order_tag { $IN->{$a}->{"=ORDERING"} cmp $IN->{$b}->{"=ORDERING"}; } ############################################################# # make texinfo output # sub texi_node { my $node = $_[0]; # node for which all subnodes should be printed my $level = $_[1]; # level for node. # make section type my $section = ''; if ($IN->{$node}->{"=NODE_TYPE"} eq "=APPENDIX") { LEVEL: { if ($level == 0) { # TOP node $section = "\@top "; last LEVEL; } if ($level == 1) { $section = "\@appendix "; last LEVEL; } if ($level == 2) { $section = "\@appendixsec"; last LEVEL; } if ($level == 3) { $section = "\@appendixsubsec "; last LEVEL; } if ($level >= 4) { $section = "\@appendixsubsubsec "; last LEVEL; } } } else { LEVEL: { if ($level == 0) { # TOP node $section = "\@top "; last LEVEL; } if ($level == 1) { $section = "\@chapter "; last LEVEL; } if ($level == 2) { $section = "\@section "; last LEVEL; } if ($level == 3) { $section = "\@subsection "; last LEVEL; } if ($level >= 4) { $section = "\@subsubsection "; last LEVEL; } } } # make title my $title = $IN->{$node}->{"=TITLE"}; if ($IN->{$node}->{"=NODE_TYPE"} eq "=METHOD") { $title = "$node -- ".$IN->{$node}->{"=TITLE"}; } if ($IN->{$node}->{"=NODE_TYPE"} eq "=DISTR") { $title = "\@code{$node} -- ".$IN->{$node}->{"=TITLE"}."\n"; $title .= "\@anchor{funct:unur_distr_$node}\n"; $title .= "\@findex unur_distr_$node\n"; } # make menu my $menu; foreach my $n (@LIST_nodes_sorted) { next unless $IN->{$n}->{"=UP"} eq $node; $menu .= "* $n\:\: ".$IN->{$n}->{"=TITLE"}."\n"; } if ($menu) { $menu = "\@menu\n".$menu."\@end menu\n\n"; } # print header file name $TEXI .= "\@c -------------------------------------\n"; $TEXI .= "\@c ".$IN->{$node}->{"=FILE"}."\n"; $TEXI .= "\@c\n\n"; # page break (?) if ($PAGEBREAKS) { if (($IN->{$node}->{"=NODE_TYPE"} eq "=METHOD") or ($IN->{$node}->{"=NODE_TYPE"} eq "=NODEX")) { $TEXI .= "\@page\n"; } } # print node and section $TEXI .= "\@node $node\n"; $TEXI .= "$section $title\n\n"; # print menu $TEXI .= $menu; # print REQUIRED, OPTIONAL, etc. of method if ($IN->{$node}->{"=NODE_TYPE"} eq "=METHOD") { if ($IN->{$node}->{"=REQUIRED"}) { $TEXI .= "\@table \@i\n"; if ($IN->{$node}->{"=REQUIRED"}) { $TEXI .= "\@item Required:\n".$IN->{$node}->{"=REQUIRED"}."\n"; } if ($IN->{$node}->{"=OPTIONAL"}) { $TEXI .= "\@item Optional:\n".$IN->{$node}->{"=OPTIONAL"}."\n"; } if ($IN->{$node}->{"=SPEED"}) { $TEXI .= "\@item Speed:\n".$IN->{$node}->{"=SPEED"}."\n"; } if ($IN->{$node}->{"=REINIT"}) { $TEXI .= "\@item Reinit:\n".$IN->{$node}->{"=REINIT"}."\n"; } if ($IN->{$node}->{"=REF"}) { $TEXI .= "\@item Reference:\n".$IN->{$node}->{"=REF"}."\n"; } $TEXI .= "\@end table\n\n"; } } # print PDF, domain, etc. distribution if ($IN->{$node}->{"=NODE_TYPE"} eq "=DISTR") { $TEXI .= "\@table \@i\n"; if ($IN->{$node}->{"=PDF"}) { $TEXI .= "\@item PDF:\n".$IN->{$node}->{"=PDF"}."\n"; } if ($IN->{$node}->{"=PMF"}) { $TEXI .= "\@item PMF:\n".$IN->{$node}->{"=PMF"}."\n"; } if ($IN->{$node}->{"=CONST"}) { $TEXI .= "\@item constant:\n".$IN->{$node}->{"=CONST"}."\n"; } if ($IN->{$node}->{"=CDF"}) { $TEXI .= "\@item CDF:\n".$IN->{$node}->{"=CDF"}."\n"; } if ($IN->{$node}->{"=DOMAIN"}) { $TEXI .= "\@item domain:\n".$IN->{$node}->{"=DOMAIN"}."\n"; } if ($IN->{$node}->{"=FPARAM"}) { $TEXI .= $IN->{$node}->{"=FPARAM"}; } if ($IN->{$node}->{"=REF"}) { $TEXI .= "\@item reference:\n".$IN->{$node}->{"=REF"}."\n"; } if ($IN->{$node}->{"=STDGEN"}) { $TEXI .= "\@item special generators:\n".$IN->{$node}->{"=STDGEN"}."\n"; } $TEXI .= "\@end table\n\n"; } # print description $TEXI .= $IN->{$node}->{"=DESCRIPTION"}; # print howtouse if ($IN->{$node}->{"=HOWTOUSE"}) { $TEXI .= "\n\@subsubheading How To Use\n\n"; $TEXI .= $IN->{$node}->{"=HOWTOUSE"}."\n\n"; } # print function reference if ($IN->{$node}->{"=ROUTINES"}) { $TEXI .= "\n\@subheading Function reference\n\n"; if ($LISTOFCALLS) { $TEXI .= $IN->{$node}->{"=ROUTINESLIST"}."\n\n"; } $TEXI .= $IN->{$node}->{"=ROUTINES"}."\n\n"; } # print `end of header file' $TEXI .= "\n\@c\n"; $TEXI .= "\@c end of ".$IN->{$node}->{"=FILE"}."\n"; $TEXI .= "\@c -------------------------------------\n"; # search for all subnodes foreach my $n (@LIST_nodes_sorted) { next unless $IN->{$n}->{"=UP"} eq $node; # print all sub nodes texi_node($n,$level+1); } } # end of texi_node() ############################################################# # scan bibligraphic references # sub scan_REF { my $node_name = $_[0]; # name of node my $tag = $_[1]; # TAG (node section) # content of node my $entry = $IN->{$node_name}->{$tag}; # empty ? return unless $entry; # split into entries my @bibrefs = split /\]\s*\[/, $entry; # now print entries $IN->{$node_name}->{$tag} = ""; foreach my $bre (@bibrefs) { $bre =~ s/[\[\]]//g; # remove all square brackets $IN->{$node_name}->{$tag} .= transform_bibref($bre); } } # end of scan_REF() ############################################################# # texify string # sub texify_string { my $string = $_[0]; # infinity --> oo $string =~ s/(infinity)/\\infty/g; # replace '*' by space $string =~ s/\*/\\, /g; # name of functions $string =~ s/(exp|log|max|min|sqrt|det)/\\$1/g; # greek letters $string =~ s/($greeks)/\\$1/g; # <, <=, etc. $string =~ s/<=/\\leq/g; $string =~ s/>=/\\geq/g; # fractions $string =~ s/\\frac\{([^\}]+)\}\{([^\}]+)\}/\{$1\\over $2\}/g; return $string; } # end of texify_string() ############################################################# # scan domain for distribution # sub scan_DOMAIN { my $node_name = $_[0]; # name of node my $tag = $_[1]; # TAG (node section) # content of node my $entry = $IN->{$node_name}->{$tag}; # empty ? return unless $entry; # trim heading blanks $entry =~ s/^\s*//; # chop off trailing blanks $entry =~ s/\s+$//; # remove newlines $entry =~ s/\n+/ /g; # format tex output my $texentry = texify_string($entry); # return result $IN->{$node_name}->{$tag} = "\@iftex\n\@tex\n\$$texentry\$\n\@end tex\n\@end iftex\n"; $IN->{$node_name}->{$tag} .= "\@ifnottex\n$entry\n\@end ifnottex\n"; } # end of scan_DOMAIN() ############################################################# # scan PDF for distribution # sub scan_PDF { my $node_name = $_[0]; # name of node my $tag = $_[1]; # TAG (node section) my $texentry; # content of node converted to TeX # content of node my $entry = $IN->{$node_name}->{$tag}; # empty ? return unless $entry; # trim heading blanks $entry =~ s/^\s*//; # chop off trailing blanks $entry =~ s/\s+$//; # remove newlines $entry =~ s/\n+/ /g; # text mode if ($entry =~ /\@text\{(.*)\}/) { $texentry = $1; $entry = $1; } else { # format tex output $texentry = "\$".texify_string($entry)."\$"; # format other output $entry =~ s/\\over\s+/\//g; $entry =~ s/\\hbox\{\s*(\w+)\s*\}/ $1 /g; $entry =~ s/\\hfil+\\break/\n\n/g; $entry =~ s/\\frac\{([^\}]+[\s\+\-]+[^\}]+)\}\{([^\}]+[\s\+\-]+[^\}]+)\}/\($1\)\/\($2\)/g; $entry =~ s/\\frac\{([^\}]+)\}\{([^\}]+[\s\+\-]+[^\}]+)\}/$1\/\($2\)/g; $entry =~ s/\\frac\{([^\}]+[\s\+\-]+[^\}]+)\}\{([^\}]+)\}/\($1\)\/$2/g; $entry =~ s/\\frac\{([^\}]+)\}\{([^\}]+)\}/$1\/$2/g; $entry =~ s/\{/\(/g; $entry =~ s/\}/\)/g; } # return result $IN->{$node_name}->{$tag} = "\@iftex\n\@tex\n$texentry\n\@end tex\n\@end iftex\n"; $IN->{$node_name}->{$tag} .= "\@ifnottex\n$entry\n\@end ifnottex\n"; } # end of scan_PDF() ############################################################# # scan list of parameters for distribution # sub scan_FPARAM { my $node_name = $_[0]; # name of node my $tag = $_[1]; # TAG (node section) # content of node my $entry = $IN->{$node_name}->{$tag}; # empty ? return unless $entry; # trim heading blanks $entry =~ s/^\s*//; # chop off trailing blanks $entry =~ s/\s+$//; # remove blanks around `:' $entry =~ s/[ \t]*\:[ \t]*/\:/g; # split into lines my @lines = split /\n+/, $entry; # process lines my $out; my $texout; my $flist; my $n_total = 0; my $n_optional = 0; my $opt_level; my $last_opt_level; foreach my $l (@lines) { # each line must start with a [\d+] next unless $l =~ /\[*\d+/; # split into columns my @cols = split /\:/, $l; die "\nwrong number of columns for =FPARAM: $#cols" if $#cols != 4; # get entries my $number = $cols[0]; $number =~ s/(.*)(\d+).*/\[$2\]/; $opt_level = $1; my $name = $cols[1]; my $cond = $cols[2]; my $default = $cols[3]; my $type = $cols[4]; # append list of parameters if ($opt_level ne $last_opt_level) { $last_opt_level = $opt_level; $flist .= " ["; } if ($n_total) { $flist .= ", $name"; } else { $flist .= " $name"; } # process $out .= "\@item \@code{$number} \@tab $name \@tab $cond \@tab $default \@tab \@i{($type)}\n"; $texout .= "\@item \@code{$number}\n"; $texout .= "\@tab\@tex\$$name \$\@end tex\n"; $texout .= "\@tab\@tex\$$cond \$\@end tex\n"; $texout .= "\@tab $default\n"; $texout .= "\@tab (\@i{$type})\n"; ++$n_total; ++$n_optional if length $default; } my $n_required = $n_total - $n_optional; $last_opt_level =~ s/\[/ \]/g; $flist .= $last_opt_level; # make TeX output $texout =~ s/<=/\\leq/g; $texout =~ s/>=/\\geq/g; $texout =~ s/($greeks)(\W|\_)/\\$1$2/g; my $texout_header = "\@iftex\n"; $texout_header .= "\@item parameters $n_required ($n_total): \@r{$flist}\n\n"; $texout_header .= "\@multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx}\n"; $texout_header .= "\@item No. \@tab name \@tab \@tab default\n"; $IN->{$node_name}->{$tag} = $texout_header.$texout."\@end multitable\n\@end iftex\n"; # make other output my $out_header = "\@ifnottex\n"; $out_header .= "\@item parameters $n_required ($n_total): $flist\n"; $out_header .= "\@multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx}\n"; $out_header .= "\@item No. \@tab name \@tab \@tab default\n"; $IN->{$node_name}->{$tag} .= $out_header.$out."\@end multitable\n\@end ifnottex\n"; } # end of scan_FPARAM() ############################################################# # scan list of parameters for distribution # sub scan_STDGEN { my $node_name = $_[0]; # name of node my $tag = $_[1]; # TAG (node section) # content of node my $entry = $IN->{$node_name}->{$tag}; # empty ? return unless $entry; # trim heading blanks $entry =~ s/^\s*//; # chop off trailing blanks $entry =~ s/\s+$//; # split into lines my @lines = split /\n+/, $entry; my $out = "\@table \@code\n"; # process lines foreach my $l (@lines) { # split into indicator and description (my $id, my $body) = split /\s+/, $l, 2; if ($body =~ /\[(\w+)\]/) { # there are references my @references; while ($body =~ /\[(\w+)\]/) { $body =~ s /\[(\w+)\]\s*//; push @references, $1; } $out .= "\@item $id\n"; # tex output my $texbody = texify_string($body); $texbody =~ s/(\@tex)/\n$1/g; $texbody =~ s/(\@end\s+tex)/\n$1\n/g; $out .= "\@iftex\n"; $out .= $texbody; foreach my $r (@references) { $out .= " [$r]"; } $out .= "\n\@end iftex\n"; # remove tex marks $body =~ s/\$//g; $body =~ s/\@tex//g; $body =~ s/\@end\s+tex//g; $out .= "\@ifhtml\n"; $out .= "$body "; foreach my $r (@references) { $out .= "\@ref{bib:$r, [$r]} "; } $out .= "\n\@end ifhtml\n"; $out .= "\@ifinfo\n"; $out .= "$body "; foreach my $r (@references) { $out .= "[$r] "; } $out .= "\n\@end ifinfo\n"; } else { # there is no reference $out .= "\@item $id\n"; $out .= "$body\n"; } } $out .= "\@end table\n"; # make other output $IN->{$node_name}->{$tag} = $out; } # end of scan_STDGEN() ############################################################# # chop off trailing blanks # sub scan_chop_blanks { my $node_name = $_[0]; # name of node my $tag = $_[1]; # TAG (node section) # content of node my $entry = $IN->{$node_name}->{$tag}; # trim heading blanks $entry =~ s/^\s*//; # chop off trailing blanks $entry =~ s/\s+$//; # remove newlines $entry =~ s/\n+/ /g; # return result $IN->{$node_name}->{$tag} = $entry; } # end of scan_chop_blanks() ############################################################# # dummy routine # sub scan_do_nothing { my $node_name = $_[0]; # name of node my $tag = $_[1]; # TAG (node section) # we have to process @unur macros process_unur_macros("tex|html|info",\($IN->{$node_name}->{$tag})); # nothing else to do return; } # end of scan_do_nothing() ############################################################# # scan TAG (node section) =UP # sub scan_UP { my $node_name = $_[0]; # name of node my $tag = $_[1]; # TAG (node section); not used # content of node my $entry = $IN->{$node_name}->{"=UP"}; $entry =~ s/^\s*//; # trim heading blanks # we have two entries which are separated by blanks # the first entry is the name of the UP node # the second entry is used to order within this upper node (my $upper_name, my $order) = split /\s+/, $entry, 2; # store upper node $IN->{$node_name}->{"=UP"} = $upper_name; # extract string for ordering (lexicographic ordering is used) if ($order =~ /\[(\w+)\]/) { $IN->{$node_name}->{"=ORDERING"} = $1; } else { # use node name $IN->{$node_name}->{"=ORDERING"} = $node_name; } } # end if scan_UP() ############################################################# # scan TAG (node section) =ROUTINES # sub scan_ROUTINES { my $node_name = $_[0]; # name of node my $tag = $_[1]; # TAG (node section) # valid C data types my @C_TYPES = ( "UNUR_PAR", "UNUR_GEN", "UNUR_DISTR", "UNUR_URNG", "UNUR_ERROR_HANDLER", "UNUR_FUNCT_CONT", "UNUR_FUNCT_CVEC", "UNUR_VFUNCT_CVEC", "FILE", "extern", "struct", "const", "void", "int", "double", "float", "long", "char", "short", "unsigned", "signed" ); # content of node my $entry = $IN->{$node_name}->{"=ROUTINES"}; # trim heading blanks $entry =~ s/^\s*//; # remove double blank lines $entry =~ s/\n\s*\n\s*\n/\n\n/g; # simplify comment markers: /** --> /* $entry =~ s/\/\*+/\/\*/g; $entry =~ s/\*+\//\*\//g; # remove blanks and new lines inside comments at markers $entry =~ s/\/\*\s+/\/\*/g; $entry =~ s/\s+\*\//\*\//g; # remove blank lines at begin and end of entry $entry =~ s/^(\s*\n)+//g; $entry =~ s/(\s*\n)+$//g; # if there are blocks of comments, separated by empty lines # then delete all but the first block of comments ## $entry =~ s/\*\/\s*\n\s*\n\s*\/\*[.\n]*\*\//\*\//g; # split into blocks my @blocks = split /\*\/\s*\n\s*\n/, $entry ; # store processed text my $proc = ''; # local list of functions my $listhtml; my $listinfo; # deftypefn block closed my $defblock_open = 0; # Store fuunction and anchor my $fkt_block = ''; my $anchor_block = ''; # process blocks foreach my $block (@blocks) { # remove anyting that starts with an # $block =~ s/^\#.*$//mg; # remove all comment markers $block =~ s/\*\/\s*//g; $block =~ s/\s*\/\*//g; # skill over empty blocks next unless $block; # "verbatim" block ? if ($block =~/^\s*==DOC/) { # remove subTAG and copy text verbatim $block =~ s/^\s*==DOC\s*//; $proc .= "$block\n\n"; next; # next block } # split into function declaration and its description (my $fkt, my $body) = split /\;/, $block, 2; # check function type my $type_ok = 0; foreach my $type (@C_TYPES) { if ("$fkt " =~ /^\s*$type /) { $type_ok = 1; last; } } # if this is not a valid type, skip to next block. next unless $type_ok; # add blanks around braces $fkt =~ s/\(/ \( /g; $fkt =~ s/\)/ \) /g; # move pointer '*' from name to type $fkt =~ s/\s+(\*+)/$1 /g; # get argument list of function (my $fkt_decl, my $fn_args) = split /\s+\(\s+/, $fkt, 2; $fn_args =~ s/\s*\)\s*$//; my @argslist = split /\s*\,\s*/, $fn_args; # $fkt_decl should contain of at least two words unless ($fkt_decl =~ /^\s*(.*)\s+([\*\w+]+)\s*$/ ) { die "type or name missing for function: '$fkt_decl'"; } # get function type and name # the first part in $fkt_decl is the function type, # the last word is the function name my $fn_type = $1; my $fn_name = $2; # routine name must be unique die "Function defined twice: $fn_name" if $LIST_routines->{$fn_name}; # store in list of all routines $LIST_routines->{$fn_name} = 1; # write entry my $first = 1; if (@argslist) { # this is a function with arguments # store in table of routines $listhtml .= "\@item \@ref{funct:$fn_name,$fn_name}\n"; $listinfo .= "\@item $fn_name\n"; # make anchor $anchor_block .= "\@anchor{funct:$fn_name}\n"; # make texinfo tag $fkt_block .= (($defblock_open) ? "\@deftypefnx" : "\@deftypefn"); $fkt_block .= " %%%Function%%% \{$fn_type\} $fn_name ("; foreach my $arg (@argslist) { (my $type, my $arg_name) = split /\s+/, $arg, 2; if ($first) { $first = 0; } else { $fkt_block .= ", "; } if ($arg_name) { # we have to take care of args that are function points if ($arg_name =~ /\s*\(/ ) { $arg_name =~ s/\s*\(\s*/\(/g; $arg_name =~ s/\s*\((\* )*(.*?)\s*\)\s*(.*)/\($1\@var\{$2\}\)$3/; $fkt_block .= "$type $arg_name"; } else { $arg_name =~ s/(.*?)(\s*\))*\s*$/\@var\{$1\}$2/; $fkt_block .= "$type $arg_name"; } } else { $fkt_block .= "$type"; } } $fkt_block .= ")\n"; } else { # this is a function does not have arguments # maybe it is an variable # store in table of routines $listhtml .= "\@item \@ref{var:$fn_name,$fn_name}\n"; $listinfo .= "\@item $fn_name\n"; # make anchor $anchor_block .= "\@anchor{var:$fn_name}\n"; # make texinfo tag $fkt_block .= (($defblock_open) ? "\@deftypevarx" : "\@deftypevar"); $fkt_block .= " \{$fn_type\} $fn_name\n"; $fkt_block .= "\@findex $fn_name\n"; } # description if ($body) { $fkt_block .= "$body\n"; if (@argslist) { $fkt_block .= "\@end deftypefn\n"; } else { $fkt_block .= "\@end deftypevar\n"; } $defblock_open = 0; # for info file my $fkt_string = $anchor_block . $fkt_block; process_unur_macros("have_info",\$fkt_string); $fkt_string =~ s/%%%Function%%%/Function/g; $proc .= "\@ifinfo\n$fkt_string\@end ifinfo\n"; # for other output formats $fkt_string = $anchor_block . $fkt_block; process_unur_macros("tex|html",\$fkt_string); $fkt_string =~ s/%%%Function%%%/{}/g; $proc .= "\@ifnotinfo\n$fkt_string\@end ifnotinfo\n\n"; # clear blocks $fkt_block = ''; $anchor_block = ''; } else { $defblock_open = 1; } } die "last function without description: $fkt_block" if $defblock_open; # make list of routines my $listproc; if ($listhtml) { $listproc = "\@ifhtml\n\@itemize\n".$listhtml."\@end itemize\n\@end ifhtml\n"; ## Currently we only display list of calls in HTML output ## $listproc .= "\@ifnothtml\n\@itemize\n".$listinfo."\@end itemize\n\n\@end ifnothtml\n"; } # store new lines $IN->{$node_name}->{"=ROUTINES"} = $proc; $IN->{$node_name}->{"=ROUTINESLIST"} = $listproc; return; } # end of scan_ROUTINES() ############################################################# # format texinfo output for =NODE # sub texi_NODE { my $node = $_[0]; # node string is used AS IS. return $node; } # end of texi_TOP() ############################################################# # transform special strings # sub transform_special_strings { my $line = $_[0]; # trim blanks $$line =~ s/[ \t\r\f]+\n/\n/g; # @cc_start --> /* # @cc_stop --> */ $$line =~ s/\@cc_start/\/*/g; $$line =~ s/\@cc_stop/*\//g; # NULL --> @code{NULL} # TRUE --> @code{TRUE} # FALSE --> @code{FALSE} $$line =~ s/ (NULL|TRUE|FALSE)/ \@code\{$1\}/g; $$line =~ s/^(NULL|TRUE|FALSE)/\@code\{$1\}/g; $$line =~ s/\n(NULL|TRUE|FALSE)/\n\@code\{$1\}/g; # transform (\w+)\(\) --> @command($1) my $first = "\n\@ifhtml\n\@ref\{funct:"; my $middle = "\}\n\@end ifhtml\n\@ifnothtml\n"; my $last = "\n\@end ifnothtml\n"; $$line =~ s/\s+(\w+)\(\)([\.\,\;\:])\s*/$first$1,\@command\{$1\}$2$middle\@command\{$1\}$2$last/g; $$line =~ s/\s+(\w+)\(\)(\n|\s*)/$first$1,\@command\{$1\}$middle\@command\{$1\}$last/g; } # end of transform_special_strings() ############################################################# # transform special strings # sub process_unur_macros { my $iftype = $_[0]; my $lineptr = $_[1]; my $line = $$lineptr; while ((my $macroidx = index $line, "\@unur") > -1) { # start of macrobody my $bodyidx = 1 + index $line, "{", $macroidx; die "Cannot find opening brace for \@unur macro" unless $bodyidx > $macroidx; # end of macrobody my $idx = $bodyidx; my $open = 1; while ($open) { ++$open if substr($line, $idx, 1) eq "{"; --$open if substr($line, $idx, 1) eq "}"; ++$idx; die "Cannot find closing brace for \@unur macro" if $idx > length($line); } my $bodyendidx = $idx; # get name of macro my $macro = substr $line, $macroidx, $bodyidx-$macroidx-1; # get body of macro my $body = substr $line, $bodyidx, $bodyendidx-$bodyidx-1; # evaluate macro my $replacement = ""; MACRO: { if ($macro =~ /\@unurbibref\s*$/) { $replacement = transform_bibref($body); substr($line, $bodyendidx) =~ s/^[ \t]*\n?[ \t]*//; last MACRO; } if ($macro =~ /\@unurmath\s*$/) { $replacement .= transform_tex($iftype,$body,0); substr($line, $bodyendidx) =~ s/^[ \t]*\n?[ \t]*//; last MACRO; } if ($macro =~ /\@unurmathdisplay\s*$/) { $replacement .= transform_tex($iftype,$body,1); substr($line, $bodyendidx) =~ s/^[\s]+//s; last MACRO; } if ($macro =~ /\@unurimage\s*$/) { $replacement = "\n\n\@image{$body}\n\n"; last MACRO; } else { die "Unknown \@unur macro: $macro"; } } # replace macro substr $line, $macroidx, $bodyendidx-$macroidx, $replacement; # trim white space substr($line, 0, $macroidx) =~ s/[\s\n]+$/\n/s; } $$lineptr = $line; } # end of process_unur_macros() ############################################################# sub transform_bibref { my $entry = $_[0]; # entry to be transformed # empty ? return unless $entry; # remove newlines $entry =~ s/\n+/ /g; # trim heading blanks $entry =~ s/^\s*//; # chop off trailing blanks $entry =~ s/\s+$//; # split into ref and optional remark # which is separated by a colon (my $anchor, my $remark) = split /[\:\,]\s*/, $entry, 2; if ($remark) { $remark =~ s/\,/\;/g; # we cannot use a comma here $remark = ": $remark"; } # output my $entrywithlink = "\@ref{bib:$anchor,, [$anchor$remark]}"; $entry = "[$anchor$remark]"; # output my $output = "\@ifhtml\n$entrywithlink\n\@end ifhtml\n". "\@ifnothtml\n$entry\n\@end ifnothtml\n"; return $output; } # end of transform_bibref() ############################################################# sub transform_tex { my $iftype = $_[0]; my $entry = $_[1]; # entry to be transformed my $display = $_[2]; # whether this is a display or not my $tex; my $html; my $info; parse_tex($entry,\$tex,\$html,\$info); my $output; if ($iftype =~ /tex/) { my $tmp = "\@math{$tex}\n"; if ($display) { $tmp = "\n\@quotation\n".$tmp."\@end quotation\n\n"; } unless ($iftype =~ /have_tex/) { $tmp = "\@iftex\n".$tmp."\@end iftex\n"; } $output .= $tmp; } if ($iftype =~ /html/) { my $tmp = "\@html\n$html\n\@end html\n"; if ($display) { $tmp = "\@quotation\n".$tmp."\@end quotation\n"; } unless ($iftype =~ /have_html/) { $tmp = "\@ifhtml\n".$tmp."\@end ifhtml\n"; } $output .= $tmp; } if ($iftype =~ /info/) { my $tmp = "\@math{$info}\n"; if ($display) { $tmp = "\@quotation\n".$tmp."\@end quotation\n"; } unless ($iftype =~ /have_info/) { $tmp = "\@ifinfo\n".$tmp."\@end ifinfo\n"; } if ($display) { $tmp .= "\n"; } $output .= $tmp; } if ($display) { $output .= "\@noindent\n"; } return $output; } # end of transform_tex() ############################################################# sub parse_tex { my $entry = $_[0]; # entry to be parsed my $tex = $_[1]; # pointer to output string for all formats my $html = $_[2]; my $info = $_[3]; # replace special characters $entry =~ s/[\s\n]+/ /g; # trim blanks $entry =~ s/\s*:\s*/\\colon /g; # : $entry =~ s/\s*<=\s*/\\leq /g; # <= $entry =~ s/\s*>=\s*/\\geq /g; # >= $entry =~ s/\s*\\\{\s*/\\lbrace /g; # { $entry =~ s/\s*\\\}\s*/\\rbrace /g; # } # scan TeX my @token; until ($entry eq "") { if ($entry =~ s/^(\s|\n)+//) { # white space push @token, {type=>"blank", value=>" "}; next; } if ($entry =~ s/^([a-zA-Z]+)//) { # text push @token, {type=>"letter", value=>"$1"}; next; } if ($entry =~ s/^([0-9]+)//) { # number push @token, {type=>"number", value=>"$1"}; next; } if ($entry =~ s/^(\[|\]|\(|\)|\_|\'|\,|\;|\.|\=|\/|\+|\-|\<|\>|\|)//) { # other printable symbols push @token, {type=>"symbol", value=>"$1"}; next; } if ($entry =~ s/^\\([a-zA-Z]+)(\s*)//) { # macro push @token, {type=>"macro", value=>"\\$1$2"}; next; } if ($entry =~ s/^\\(\\|\,|\;|{|})(\s*)//) { # macro with special charcter push @token, {type=>"macro", value=>"\\$1$2"}; next; } if ($entry =~ s/^(\_|\^|\.|\,|\!)//) { # special characters push @token, {type=>"special", value=>"$1"}; next; } if ($entry =~ /^\{/) { # block --> find end of block my $idx = 1; my $open = 1; while ($open) { ++$open if substr($entry, $idx, 1) eq "{"; --$open if substr($entry, $idx, 1) eq "}"; ++$idx; die "Cannot find closing brace for \@unur macro" if $idx > length($entry); } # store block my $block = substr $entry, 1, $idx-2; push @token, {type=>"block", value=>"$block"}; # update $entry $entry = substr $entry, $idx; next; } # else: unknown character: print STDERR "\n\@unurmath: $entry\n"; die "Unknown Character: '".substr($entry,0,1)."' "; } # write text while ( @token ) { next_tex_token(\@token,$tex,$html,$info); } # trim blanks $$html =~ s/[\s\n]+/ /g; $$html =~ s/^[\s\n]+//g; $$html =~ s/[\s\n]+$//g; $$info =~ s/[\s\n]+/ /g; $$info =~ s/^[\s\n]+//g; $$info =~ s/[\s\n]+$//g; } # end of parse_tex() ############################################################# sub next_tex_token { my $token = $_[0]; # pointer to token list my $tex = $_[1]; # pointer to output string for all formats my $html = $_[2]; my $info = $_[3]; # get next token my $tok = shift @$token; # check token die "token missing" unless $tok; my $type = $tok->{type}; my $value = $tok->{value}; ## print STDERR "{type = $type\t value = $value}\n"; if ($type eq "block") { $$tex .= "{"; $$html .= ""; $$info .= "("; parse_tex($value,$tex,$html,$info); $$tex .= "}"; $$html .= ""; $$info .= ")"; return; } # letters if ($type =~ /^(letter)$/ ) { $$tex .= $value; $$html .= "$value"; $$info .= $value; return; } # numbers and symbols if ($type =~ /^(blank|number|symbol)$/ ) { $$tex .= $value; $$html .= $value; $$info .= $value; return; } # macros if ($type eq "macro") { if ($value =~ /^(\\;|\\,)\s*$/) { # white spaces $$tex .= $value; $value =~ s/^(\\;|\\,)$/ /; $$info .= $value; $$html .= $value; return; } if ($value =~ /^\\\\\s*$/) { # new line $$tex .= "\\hfil\\break "; $$info .= "\@*"; $$html .= "\@*"; return; } if ($value =~ /^\\(colon|leq|geq|mapsto|times|rbrace|lbrace|ldots)\s*$/) { # :, <=, >=, ->, x, {, } $$tex .= $value; $value =~ s/^\\(colon)\s*/ : /g; $value =~ s/^\\(leq)\s*/ <= /g; $value =~ s/^\\(geq)\s*/ >= /g; $value =~ s/^\\(mapsto)\s*/ -> /g; $value =~ s/^\\(times)\s*/x/g; $value =~ s/^\\(rbrace)\s*/ \@} /g; $value =~ s/^\\(lbrace)\s*/ \@{ /g; $value =~ s/^\\(ldots)\s*/.../g; $$html .= $value; $$info .= $value; return; } if ($value =~ /^\\(pm|infty|cdot)\s*$/) { # +/-, infinity $$tex .= $value; $value =~ s/^\\(pm)\s*/ +\/- /g; $value =~ s/^\\(infty)\s*/ infinity /g; $value =~ s/^\\(cdot)\s*/ * /g; $$html .= $value; $$info .= $value; return; } if ($value =~ /^\\(inf|sup|min|max|log|exp|det)\s*$/) { # macros that are printed as is in non-TeX formats $$tex .= $value; $$html .= " $1"; $$info .= " $1"; return; } if ($value =~ /^\\(in|subset)\s*$/) { # macros that are printed as is in non-TeX formats $$tex .= $value; $$html .= " $1 "; $$info .= " $1 "; return; } if ($value =~ /^\\($greeks)(\s*)$/) { # greek letters $$tex .= $value; $$html .= " $1$2"; $$info .= " $1$2"; return; } if ($value =~ /^\\(limits)\s*$/) { # macros that are ignored in non-TeX formats $$tex .= $value; return; } if ($value =~ /^\\(sqrt)\s*$/) { # sqrt $$tex .= $value; $value =~ s/^\\(sqrt)\s*/sqrt/g; $$html .= "$value("; $$info .= $value; next_tex_token($token,$tex,$html,$info); $$html .= ")"; $$info .= ""; return; } # $$tex .= $value; # $$html .= $value; # $$info .= $value; # return; } # special characters if ($type eq "special") { if ($value =~ /^(\_|\^)$/) { $$tex .= $value; $$info .= $value; $$html .= ($value =~ /^(\_)$/) ? "" : ""; next_tex_token($token,$tex,$html,$info); $$html .= ($value =~ /^(\_)$/) ? "" : ""; return; } if ($value =~ /^(\.|\,|\!)$/) { $$tex .= $value; $$info .= $value; $$html .= $value; return; } } # else --> error die "\nPanic: don't know what to do with type '$type', value = '$value'\n"; } # end of next_tex_token() ############################################################# unuran-1.11.0/doc/src/ref_example_dext.texi0000644001357500135600000001075614430713446015616 00000000000000/* ------------------------------------------------------------- */ /* File: example_dext.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* This example shows how an external generator for the */ /* geometric distribution can be used within the UNURAN */ /* framework. */ /* */ /* Notice, that this example does not provide the simplest */ /* solution. */ /* ------------------------------------------------------------- */ /* Initialization routine. */ /* */ /* Here we simply read the parameter of the geometric */ /* distribution and store it in an array for parameters of */ /* the external generator. */ /* [ Of course we could do this in the sampling routine as */ /* and avoid the necessity of this initialization routine. ] */ int geometric_init (UNUR_GEN *gen) @{ /* Get pointer to parameters of geometric distribution */ double *params = unur_dext_get_distrparams(gen); /* The parameter is the first entry (see manual) */ double p = params[0]; /* Get array to store this parameter for external generator */ double *genpar = unur_dext_get_params(gen, sizeof(double)); genpar[0] = p; /* Executed successfully */ return UNUR_SUCCESS; @} /* ------------------------------------------------------------- */ /* Sampling routine. */ /* */ /* Contains the code for the external generator. */ int geometric_sample (UNUR_GEN *gen) @{ /* Get scale parameter */ double *genpar = unur_dext_get_params(gen,0); double p = genpar[0]; /* Sample a uniformly distributed random number */ double U = unur_sample_urng(gen); /* Transform into geometrically distributed random variate */ return ( (int) (log(U) / log(1.-p)) ); @} /* ------------------------------------------------------------- */ int main(void) @{ int i; /* loop variable */ int K; /* will hold the random number */ /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Use predefined geometric distribution with parameter 1/10 */ double fpar[1] = @{ 0.1 @}; distr = unur_distr_geometric(fpar, 1); /* Use method DEXT */ par = unur_dext_new(distr); /* Set initialization and sampling routines. */ unur_dext_set_init(par, geometric_init); unur_dext_set_sample(par, geometric_sample); /* Create the generator object. */ gen = unur_init(par); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) @{ fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); @} /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the standard Gaussian distribution. */ /* Eg.: */ for (i=0; i<10; i++) @{ K = unur_sample_discr(gen); printf("%d\n",K); @} /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); @} /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/doc/src/ref_example_rngstreams.texi0000644001357500135600000001113414430713446017026 00000000000000/* ------------------------------------------------------------- */ /* File: example_rngstreams.c */ /* ------------------------------------------------------------- */ #ifdef UNURAN_SUPPORTS_RNGSTREAM /* ------------------------------------------------------------- */ /* This example makes use of the RNGSTREAM library for */ /* for generating uniform random numbers. */ /* (see http://statmath.wu.ac.at/software/RngStreams/) */ /* To compile this example you must have set */ /* ./configure --with-urng-rngstream */ /* (Of course the executable has to be linked against the */ /* RNGSTREAM library.) */ /* ------------------------------------------------------------- */ /* Include UNURAN header files. */ #include #include /* ------------------------------------------------------------- */ int main(void) @{ int i; /* loop variable */ double x; /* will hold the random number */ double fparams[2]; /* array for parameters for distribution */ /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Declare objects for uniform random number generators. */ UNUR_URNG *urng1, *urng2; /* uniform generator objects */ /* The RNGSTREAMS library sets a package seed. */ unsigned long seed[] = @{111u, 222u, 333u, 444u, 555u, 666u@}; RngStream_SetPackageSeed(seed); /* RngStreams only: */ /* Make a object for uniform random number generator. */ /* For details see */ /* http://statmath.wu.ac.at/software/RngStreams/ */ urng1 = unur_urng_rngstream_new("urng-1"); if (urng1 == NULL) exit (EXIT_FAILURE); /* Use a predefined standard distribution: */ /* Beta with parameters 2 and 3. */ fparams[0] = 2.; fparams[1] = 3.; distr = unur_distr_beta( fparams, 2 ); /* Choose a method: TDR. */ par = unur_tdr_new(distr); /* Set uniform generator in parameter object */ unur_set_urng( par, urng1 ); /* Create the generator object. */ gen = unur_init(par); /* Notice that this call has also destroyed the parameter */ /* object `par' as a side effect. */ /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) @{ fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); @} /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) @{ x = unur_sample_cont(gen); printf("%f\n",x); @} /* Now we want to switch to a different (independent) stream */ /* of uniform random numbers. */ urng2 = unur_urng_rngstream_new("urng-2"); if (urng2 == NULL) exit (EXIT_FAILURE); unur_chg_urng( gen, urng2 ); /* ... and sample again. */ for (i=0; i<10; i++) @{ x = unur_sample_cont(gen); printf("%f\n",x); @} /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); /* We also should destroy the uniform random number generators.*/ unur_urng_free(urng1); unur_urng_free(urng2); exit (EXIT_SUCCESS); @} /* end of main() */ /* ------------------------------------------------------------- */ #else #include #include int main(void) @{ printf("You must enable the RNGSTREAM library to run this example!\n\n"); exit (77); /* exit code for automake check routines */ @} #endif /* ------------------------------------------------------------- */ unuran-1.11.0/doc/src/error_debug.dh0000644001357500135600000000147214420445767014226 00000000000000=NODE Error_Debug Error handling and Debugging =UP TOP [60] =DESCRIPTION UNU.RAN routines report an error whenever they cannot perform the requested task. Additionally it is possible to get information about the generated distribution of generator objects for debugging purposes. However, the latter must be enabled when compiling and installing the library. (It is disabled by default.) This chapter describes all necessary details: @itemize @item Choose an output stream to for writing the requested information. @item Select a debugging level. @item Select an error handler. @item Write your own error handler. @item Get more information for a particular error code. @end itemize =EON /*---------------------------------------------------------------------------*/ unuran-1.11.0/doc/src/glossary.dh0000644001357500135600000000417214420445767013572 00000000000000 =APPENDIX Glossary Glossary =UP TOP [a05] =DESCRIPTION @table @strong @item CDF cumulative distribution function. @item HR hazard rate (or failure rate). @item inverse local concavity local concavity of inverse PDF @unurmath{f^{-1}(y)} expressed in term of @unurmath{x = f^{-1}(y).} Is is given by @unurmath{ilc_f(x) = 1 + x\,f''(x) / f'(x)} @item local concavity maximum value of @i{c} such that PDF @i{f(x)} is @unurmath{T_c.} Is is given by @unurmath{lc_f(x) = 1 - f''(x)\,f(x) / f'(x)^2} @item PDF probability density function. @item dPDF derivative (gradient) of probability density function. @item PMF probability mass function. @item PV (finite) probability vector. @item URNG uniform random number generator. @item @math{U(a,b)} continuous uniform distribution on the interval @unurmath{(a,b).} @item T-concave a function @i{f(x)} is called @i{T}-convace if the transformed function @i{T(f(x))} is concave. We only deal with transformations @unurmath{T_c,} where @table @code @item @i{c} = 0 @unurmath{T(x) = \log(x)} @item @i{c} = @math{-0.5} @unurmath{T(x) = -1/\sqrt{x}} @item @i{c} != 0 @unurmath{T(x) = sign(x) \cdot x^c} @end table @item u-error for a given approximate inverse CDF @unurmath{X=G^{-1}(U)} the u-error is given as @unurmathdisplay{uerror = |U-F(G^{-1}(U))|} where @unurmath{F} denotes the exact CDF. Goodness-of-fit tests like the Kolmogorov-Smirnov test or the chi-squared test look at this type of error. See @ref{Inversion} for more details. @item u-resolution the maximal tolerated u-error for an approximate inverse CDF. @item x-error for a given approximate inverse CDF @unurmath{X=G^{-1}(U)} the x-error is given as @unurmathdisplay{xerror = |F^{-1}(U)-G^{-1}(U)|} where @unurmath{F^{-1}} denotes the exact inverse CDF. The x-error measure the deviation of @unurmath{G^{-1}(U)} from the exact result. Notice that we have to distinguish between @emph{absolute} and @emph{relative} x-error. In UNU.RAN we use the absolute x-error near 0 and the relative x-error otherwise. See @ref{Inversion} for more details. @item x-resolution the maximal tolerated x-error for an approximate inverse CDF. @end table =EON unuran-1.11.0/doc/src/ref_example_mixt.texi0000644001357500135600000000544014430713446015625 00000000000000/* ------------------------------------------------------------- */ /* File: example_mixt.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* Mixture of a Gaussian and a Cauchy distribution. */ /* ------------------------------------------------------------- */ int main(void) @{ /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *comp[2]; /* array of generator objects (components)*/ UNUR_GEN *gen; /* generator object for mixture */ double prob[2]; /* array of probabilities */ int i; /* loop variable */ double x; /* will hold the random number */ /* Create generators for components */ distr = unur_distr_normal(NULL,0); /* Gaussian distribution */ par = unur_pinv_new(distr); /* choose method PINV */ comp[0] = unur_init(par); /* initialize */ unur_distr_free(distr); /* free distribution obj. */ distr = unur_distr_cauchy(NULL,0); /* Cauchy distribution */ par = unur_tdr_new(distr); /* choose method TDR */ comp[1] = unur_init(par); /* initialize */ unur_distr_free(distr); /* free distribution obj. */ /* Probabilities for components (need not sum to 1) */ prob[0] = 0.4; prob[1] = 0.3; /* Create mixture */ par = unur_mixt_new(2,prob,comp); /* Initialize generator object */ gen = unur_init(par); /* we do not need the components any more */ for (i=0; i<2; i++) unur_free(comp[i]); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) @{ fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); @} /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) @{ x = unur_sample_cont(gen); printf("%f\n",x); @} /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); @} /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/doc/src/ref_example_emp.texi0000644001357500135600000000504314430713446015424 00000000000000/* ------------------------------------------------------------- */ /* File: example_emp.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* Example how to sample from an empirial continuous univariate */ /* distribution. */ /* ------------------------------------------------------------- */ int main(void) @{ int i; double x; /* data points */ double data[15] = @{ -0.1, 0.05, -0.5, 0.08, 0.13,\ -0.21,-0.44, -0.43, -0.33, -0.3, \ 0.18, 0.2, -0.37, -0.29, -0.9 @}; /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Create a distribution object and set empirical sample. */ distr = unur_distr_cemp_new(); unur_distr_cemp_set_data(distr, data, 15); /* Choose a method: EMPK. */ par = unur_empk_new(distr); /* Set smooting factor. */ unur_empk_set_smoothing(par, 0.8); /* Create the generator object. */ gen = unur_init(par); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) @{ fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); @} /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) @{ x = unur_sample_cont(gen); printf("%f\n",x); @} /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); @} /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/doc/src/Makefile.in0000644001357500135600000003153514430713360013446 00000000000000# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = doc/src ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in README texinfo.tex DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILECMD = @FILECMD@ GREP = @GREP@ HAVE_DIVIDE_BY_ZERO = @HAVE_DIVIDE_BY_ZERO@ HAVE_IEEE_COMPARISONS = @HAVE_IEEE_COMPARISONS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNURAN_LT_VERSION = @UNURAN_LT_VERSION@ UNURAN_SUPPORTS_GSL = @UNURAN_SUPPORTS_GSL@ UNURAN_SUPPORTS_PRNG = @UNURAN_SUPPORTS_PRNG@ UNURAN_SUPPORTS_RNGSTREAM = @UNURAN_SUPPORTS_RNGSTREAM@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ have_valgrind = @have_valgrind@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = \ README \ texinfo.tex \ make_texi.pl \ arvag.dh \ error_debug.dh \ examples.dh \ glossary.dh \ index.dh \ intro.dh \ installation.dh \ methods.dh \ misc.dh \ references.dh \ stddist.dh \ top.dh # clean backup files CLEANFILES = *~ # clean generated files MAINTAINERCLEANFILES = \ Makefile.in \ .dep-unuran_src_texi all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign doc/src/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" distdir="$(distdir)" \ dist-hook check-am: all-am check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ cscopelist-am ctags-am dist-hook distclean distclean-generic \ distclean-libtool distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags-am uninstall uninstall-am .PRECIOUS: Makefile # do not distribute dependencies for unuran_src.texi dist-hook: rm -f .dep-unuran_src_texi # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: unuran-1.11.0/doc/src/ref_example_vemp.texi0000644001357500135600000000534514430713446015617 00000000000000/* ------------------------------------------------------------- */ /* File: example_vemp.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* Example how to sample from an empirial continuous */ /* multivariate distribution. */ /* ------------------------------------------------------------- */ int main(void) @{ int i; /* 4 data points of dimension 2 */ double data[] = @{ 1. ,1., /* 1st data point */ -1.,1., /* 2nd data point */ 1.,-1., /* 3rd data point */ -1.,-1. @}; /* 4th data point */ double result[2]; /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Create a distribution object with dimension 2. */ distr = unur_distr_cvemp_new( 2 ); /* Set empirical sample. */ unur_distr_cvemp_set_data(distr, data, 4); /* Choose a method: VEMPK. */ par = unur_vempk_new(distr); /* Use variance correction. */ unur_vempk_set_varcor( par, 1 ); /* Create the generator object. */ gen = unur_init(par); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) @{ fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); @} /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) @{ unur_sample_vec(gen, result); printf("(%f,%f)\n", result[0], result[1]); @} /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); @} /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/doc/src/Makefile.am0000644001357500135600000000076414420445767013451 00000000000000## Process this file with automake to produce Makefile.in EXTRA_DIST = \ README \ texinfo.tex \ make_texi.pl \ arvag.dh \ error_debug.dh \ examples.dh \ glossary.dh \ index.dh \ intro.dh \ installation.dh \ methods.dh \ misc.dh \ references.dh \ stddist.dh \ top.dh # do not distribute dependencies for unuran_src.texi dist-hook: rm -f .dep-unuran_src_texi # clean backup files CLEANFILES = *~ # clean generated files MAINTAINERCLEANFILES = \ Makefile.in \ .dep-unuran_src_texi unuran-1.11.0/doc/src/ref_example_win32_1.texi0000644001357500135600000000671014430713451016023 00000000000000/* ------------------------------------------------------------- */ /* File: example1.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header files. */ #include #include /* ------------------------------------------------------------- */ int main(void) @{ int i; /* loop variable */ double x; int k; /* will hold the random number */ /* Declare UNU.RAN objects. */ UNUR_GEN *gen1, *gen2, *gen3; /* generator objects */ /* Declare objects for uniform random number generators. */ UNUR_URNG *urng2; /* uniform RN generator object */ /* -- Optional: Set seed for RNGSTREAMS library -------------- */ /* The RNGSTREAMS library sets a package seed. */ unsigned long seed[] = @{111u, 222u, 333u, 444u, 555u, 666u@}; RngStream_SetPackageSeed(seed); /* -- Example 1 ---------------------------------------------- */ /* Beta distribution with shape parameters 2 and 3. */ /* Use method 'AUTO' (AUTOmatic). */ /* Create generator object. */ gen1 = unur_str2gen("beta(2,3)"); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen1' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen1 == NULL) @{ fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); @} /* Now you can use the generator object `gen1' to sample from */ /* the target distribution. Eg.: */ for (i=0; i<10; i++) @{ x = unur_sample_cont(gen1); printf("%f\n",x); @} /* -- Example 2 ---------------------------------------------- */ /* Student's t distribution with 3 degrees of freedom. */ /* Use method 'TDR' (Transformed Density Rejection) with */ /* "immediate acception" */ gen2 = unur_str2gen("student(3) & method=TDR; variant_ia"); if (gen2 == NULL) exit (EXIT_FAILURE); /* However, this time we use a (new) independent stream of */ /* uniformrandom numbers. */ urng2 = unur_urng_rngstream_new("urng2"); unur_chg_urng( gen2, urng2 ); /* Draw a sample. */ for (i=0; i<10; i++) @{ x = unur_sample_cont(gen2); printf("%f\n",x); @} /* -- Example 3 ---------------------------------------------- */ /* Discrete distribution with given probability vector. */ /* Use method 'DGT' (Discrete Guide Table method). */ gen3 = unur_str2gen("discr; pv=(0.5,1.5,1.0,0.3) & method=DGT"); if (gen3 == NULL) exit (EXIT_FAILURE); /* we use the default URNG again. So there is nothing to do. */ /* Draw a sample. Notice that we get integers! */ for (i=0; i<10; i++) @{ k = unur_sample_discr(gen3); printf("%d\n",k); @} /* -- Call destructor ---------------------------------------- */ /* When generators are not needed any they can be destroyed. */ unur_free(gen1); unur_free(gen2); unur_urng_free(urng2); unur_free(gen3); exit (EXIT_SUCCESS); @} /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/doc/src/examples.dh0000644001357500135600000001605614420445767013551 00000000000000 =NODE Examples Examples =UP TOP [20] =DESCRIPTION The examples in this chapter should compile cleanly and can be found in the directory @file{examples} of the source tree of UNU.RAN. Assuming that UNU.RAN as well as the PRNG libraries have been installed properly (@pxref{Installation}) each of these can be compiled (using the GCC in this example) with @example gcc -Wall -O2 -o example example.c -lunuran -lprng -lm @end example @noindent @emph{Remark:} @code{-lprng} must be omitted when the PRNG library is not installed. Then however some of the examples might not work. The library uses three objects: @code{UNUR_DISTR}, @code{UNUR_PAR} and @code{UNUR_GEN}. It is not important to understand the details of these objects but it is important not to changed the order of their creation. The distribution object can be destroyed @emph{after} the generator object has been made. (The parameter object is freed automatically by the unur_init() call.) It is also important to check the result of the unur_init() call. If it has failed the NULL pointer is returned and causes a segmentation fault when used for sampling. We give all examples with the UNU.RAN standard API and the more convenient string API. =EON /*---------------------------------------------------------------------------*/ =NODEX Example_0 As short as possible =UP Examples [05] =DESCRIPTION Select a distribution and let UNU.RAN do all necessary steps. @smallexample @include ref_example0.texi @end smallexample =EON /*---------------------------------------------------------------------------*/ =NODEX Example_0_str As short as possible (String API) =UP Examples [06] =DESCRIPTION Select a distribution and let UNU.RAN do all necessary steps. @smallexample @include ref_example0_str.texi @end smallexample =EON /*---------------------------------------------------------------------------*/ =NODEX Example_1 Select a method =UP Examples [10] =DESCRIPTION Select method AROU and use it with default parameters. @smallexample @include ref_example1.texi @end smallexample =EON /*---------------------------------------------------------------------------*/ =NODEX Example_1_str Select a method (String API) =UP Examples [11] =DESCRIPTION Select method AROU and use it with default parameters. @smallexample @include ref_example1_str.texi @end smallexample =EON /*---------------------------------------------------------------------------*/ =NODEX Example_2 Arbitrary distributions =UP Examples [20] =DESCRIPTION If you want to sample from a non-standard distribution, UNU.RAN might be exactly what you need. Depending on the information is available, a method must be choosen for sampling, see @ref{Concepts} for an overview and @ref{Methods} for details. @smallexample @include ref_example2.texi @end smallexample =EON /*---------------------------------------------------------------------------*/ =NODEX Example_2_str Arbitrary distributions (String API) =UP Examples [21] =DESCRIPTION If you want to sample from a non-standard distribution, UNU.RAN might be exactly what you need. Depending on the information is available, a method must be choosen for sampling, see @ref{Concepts} for an overview and @ref{Methods} for details. @smallexample @include ref_example2_str.texi @end smallexample =EON /*---------------------------------------------------------------------------*/ =NODEX Example_3 Change parameters of the method =UP Examples [30] =DESCRIPTION Each method for generating random numbers allows several parameters to be modified. If you do not want to use default values, it is possible to change them. The following example illustrates how to change parameters. For details see @ref{Methods}. @smallexample @include ref_example3.texi @end smallexample =EON /*---------------------------------------------------------------------------*/ =NODEX Example_3_str Change parameters of the method (String API) =UP Examples [31] =DESCRIPTION Each method for generating random numbers allows several parameters to be modified. If you do not want to use default values, it is possible to change them. The following example illustrates how to change parameters. For details see @ref{Methods}. @smallexample @include ref_example3_str.texi @end smallexample =EON /*---------------------------------------------------------------------------*/ =NODEX Example_4 Change uniform random generator =UP Examples [40] =DESCRIPTION All generator object use the same default uniform random number generator by default. This can be changed to any generator of your choice such that each generator object has its own random number generator or can share it with some other objects. It is also possible to change the default generator at any time. See @ref{URNG,,Using uniform random number generators}, for details. The following example shows how the uniform random number generator can be set or changed for a generator object. It requires the RNGSTREAMS library to be installed and used. Otherwise the example must be modified accordingly. @smallexample @include ref_example_rngstreams.texi @end smallexample =EON /*---------------------------------------------------------------------------*/ =NODEX Example_reinit Change parameters of underlying distribution =UP Examples [43] =DESCRIPTION One a generator object has been created it allows to draw samples from the distribution with the given parameters. However, some methods allow to change the parameters of the underlying distribution and reinitialize the generator object again. Thus when the parameters of the distribution vary for each draw we save overhead for destroying the old object and creating a new one. The following example shows how the parameters of a GIG distribution can be changed when method CSTD is used. @smallexample @include ref_example_reinit.texi @end smallexample =EON /*---------------------------------------------------------------------------*/ =NODEX Example_anti Sample pairs of antithetic random variates =UP Examples [50] =DESCRIPTION Using Method TDR it is easy to sample pairs of antithetic random variates. @smallexample @include ref_example_anti.texi @end smallexample =EON /*---------------------------------------------------------------------------*/ =NODEX Example_anti_str Sample pairs of antithetic random variates (String API) =UP Examples [51] =DESCRIPTION Using Method TDR it is easy to sample pairs of antithetic random variates. @smallexample @include ref_example_anti_str.texi @end smallexample =EON /*---------------------------------------------------------------------------*/ =NODEX Example_More More examples =UP Examples [60] =DESCRIPTION @xref{Methods_for_CONT,,Methods for continuous univariate distributions}. @xref{Methods_for_CEMP,,Methods for continuous empirical univariate distributions}. @xref{Methods_for_CVEMP,,Methods for continuous empirical multivariate distributions}. @xref{Methods_for_DISCR,,Methods for discrete univariate distributions}. =EON /*---------------------------------------------------------------------------*/ unuran-1.11.0/doc/src/ref_example_anti_str.texi0000644001357500135600000000717614430713446016477 00000000000000/* ------------------------------------------------------------- */ /* File: example_anti_str.c */ /* ------------------------------------------------------------- */ /* String API. */ /* ------------------------------------------------------------- */ #ifdef UNURAN_SUPPORTS_PRNG /* ------------------------------------------------------------- */ /* This example makes use of the PRNG library for generating */ /* uniform random numbers. */ /* (see http://statmath.wu.ac.at/prng/) */ /* To compile this example you must have set */ /* ./configure --with-urng-prng */ /* (Of course the executable has to be linked against the */ /* PRNG library.) */ /* ------------------------------------------------------------- */ /* Example how to sample from two streams of antithetic random */ /* variates from Gaussian N(2,5) and Gamma(4) distribution, resp.*/ /* ------------------------------------------------------------- */ /* Include UNURAN header files. */ #include #include /* ------------------------------------------------------------- */ int main(void) @{ int i; /* loop variable */ double xn, xg; /* will hold the random number */ /* Declare UNURAN generator objects. */ UNUR_GEN *gen_normal, *gen_gamma; /* PRNG only: */ /* Make a object for uniform random number generator. */ /* For details see http://statmath.wu.ac.at/prng/. */ /* Create the first generator: Gaussian N(2,5) */ gen_normal = unur_str2gen("normal(2,5) & method=tdr; variant_ps & urng=mt19937(1237)"); if (gen_normal == NULL) @{ fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); @} /* Set auxilliary uniform random number generator. */ /* We use the default generator. */ unur_chgto_urng_aux_default(gen_normal); /* The second generator: Gamma(4) with antithetic variates. */ gen_gamma = unur_str2gen("gamma(4) & method=tdr; variant_ps & urng=anti(mt19937(1237))"); if (gen_gamma == NULL) @{ fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); @} unur_chgto_urng_aux_default(gen_gamma); /* Now we can sample pairs of negatively correlated random */ /* variates. E.g.: */ for (i=0; i<10; i++) @{ xn = unur_sample_cont(gen_normal); xg = unur_sample_cont(gen_gamma); printf("%g, %g\n",xn,xg); @} /* When you do not need the generator objects any more, you */ /* can destroy it. */ /* But first we have to destroy the uniform random number */ /* generators. */ unur_urng_free(unur_get_urng(gen_normal)); unur_urng_free(unur_get_urng(gen_gamma)); unur_free(gen_normal); unur_free(gen_gamma); exit (EXIT_SUCCESS); @} /* end of main() */ /* ------------------------------------------------------------- */ #else #include #include int main(void) @{ printf("You must enable the PRNG library to run this example!\n\n"); exit (77); /* exit code for automake check routines */ @} #endif /* ------------------------------------------------------------- */ unuran-1.11.0/doc/src/arvag.dh0000644001357500135600000005621014420445767013027 00000000000000/* =APPENDIX RVG A Short Introduction to Random Variate Generation =UP TOP [a03] =DESCRIPTION Random variate generation is the small field of research that deals with algorithms to generate random variates from various distributions. It is common to assume that a uniform random number generator is available. This is a program that produces a sequence of independent and identically distributed continuous @unurmath{U(0,1)} random variates (i.e. uniform random variates on the interval @unurmath{(0,1)}). Of course real world computers can never generate ideal random numbers and they cannot produce numbers of arbitrary precision but state-of-the-art uniform random number generators come close to this aim. Thus random variate generation deals with the problem of transforming such a sequence of @unurmath{U(0,1)} random numbers into non-uniform random variates. Here we shortly explain the basic ideas of the @emph{inversion}, @emph{rejection}, and the @emph{ratio of uniforms} method. How these ideas can be used to design a particular automatic random variate generation algorithms that can be applied to large classes of distributions is shortly explained in the description of the different methods included in this manual. For a deeper treatment of the ideas presented here, for other basic methods and for automatic generators we refer the interested reader to our book [HLD04]. =EON */ /* ------------------------------------------------------------------------- */ /* =NODE Inversion The Inversion Method =UP RVG [10] =DESCRIPTION When the inverse @unurmath{F^{-1}} of the cumulative distribution function is known, then random variate generation is easy. We just generate a uniformly @unurmath{U(0,1)} distributed random number @unurmath{U} and return @unurmathdisplay{X=F^{-1}(U).} The following figure shows how the inversion method works for the exponential distribution. @unurimage{figures/inversion} This algorithm is so simple that inversion is certainly the method of choice if the inverse CDF is available in closed form. This is the case e.g. for the exponential and the Cauchy distribution. The inversion method also has other special advantages that make it even more attractive for simulation purposes. It preserves the structural properties of the underlying uniform pseudo-random number generator. Consequently it can be used, e.g., for variance reduction techniques, it is easy to sample from truncated distributions, from marginal distributions, and from order statistics. Moreover, the quality of the generated random variables depends only on the underlying uniform (pseudo-) random number generator. Another important advantage of the inversion method is that we can easily characterize its performance. To generate one random variate we always need exactly one uniform variate and one evaluation of the inverse CDF. So its speed mainly depends on the costs for evaluating the inverse CDF. Hence inversion is often considered as the method of choice in the simulation literature. Unfortunately computing the inverse CDF is, for many important standard distributions (e.g. for normal, student, gamma, and beta-distributions), comparatively difficult and slow. Often no such routines are available in standard programming libraries. Then numerical methods for inverting the CDF are necessary, e.g. Newton's method or (polynomial or rational) approximations of the inverse CDF. Such procedures, however, have the disadvantage that they are not exact and/or slow. UNU.RAN implements several methods: NINV (@pxref{NINV}), HINV (@pxref{HINV}) and PINV (@pxref{PINV}). For such approximate inversion methods the approximation error is important for the quality of the generated point set. Let @unurmath{X=G^{-1}(U)} denote the approximate inverse CDF, and let @unurmath{F} and @unurmath{F^{-1}} be the exact CDF and inverse CDF of the distribution, resp. There are three measures for the approximation error: @table @emph @item u-error is given by @unurmathdisplay{uerror = |U-F(G^{-1}(U))|} Goodness-of-fit tests like the Kolmogorov-Smirnov test or the chi-squared test look at this type of error. We are also convinced that it is the most suitable error measure for Monte Carlo simulations as pseudo-random numbers and points of low discrepancy sets are located on a grid of restricted resolution. @item x-error is given by @unurmathdisplay{absolute xerror = |F^{-1}(U)-G^{-1}(U)|} @unurmathdisplay{relative xerror = |F^{-1}(U)-G^{-1}(U)|\cdot |F^{-1}(U)|} The x-error measure the deviation of @unurmath{G^{-1}(U)} from the exact result. This measure is suitable when the inverse CDF is used as a quantile function in some computations. The main problem with the x-error is that we have to use the @emph{absolute x-error} for @unurmath{X=F^{-1}(U)} close to zero and the @emph{relative x-error} in the tails. @end table We use the terms @emph{u-resolution} and @emph{x-resolution} as the maximal tolerated u-error and x-error, resp. UNU.RAN allows to set u-resolution and x-resolution independently. Both requirements must be fulfilled. We use the following strategy for checking whether the precision goal is reached: @table @emph @item checking u-error: The u-error must be slightly smaller than the given u-resolution: @unurmathdisplay{|U-F(G^{-1}(U))| < 0.9\cdot uresolution.} There is no necessity to consinder the relative u-error as we have @unurmath{0 < U < 1.} @item checking x-error: We combine absoute and relative x-error and use the criterion @unurmathdisplay{|F^{-1}(U)-G^{-1}(U)| < xresolution \cdot (|G^{-1}(U)| + xresolution).} @end table @strong{Remark:} It should be noted here that the criterion based on the u-error is too stringent whereever the CDF is extremely steep (and thus the PDF has a pole or a high and narrow peak). This is in particular a problem for distributions with a pole (e.g., the gamma distribution with shape parameter less than 0.5). On the other hand using a criterion based on the x-error causes problems whereever the CDF is extremly flat. This is in particular the case in the (far) tails of heavy-tailed distributions (e.g., for the Cauchy distribution). =EON */ /* ------------------------------------------------------------------------- */ /* =NODE Rejection The Rejection Method =UP RVG [20] =DESCRIPTION The rejection method, often called @emph{acceptance-rejection method}, has been suggested by John von Neumann in 1951. Since then it has proven to be the most flexible and most efficient method to generate variates from continuous distributions. We explain the rejection principle first for the density @unurmath{f(x) = sin(x)/2} on the interval @unurmath{(0,\pi).} To generate random variates from this distribution we also can sample random points that are uniformly distributed in the region between the graph of @unurmath{f(x)} and the @i{x}-axis, i.e., the shaded region in the below figure. @unurimage{figures/rejection_from_constant_hat} In general this is not a trivial task but in this example we can easily use the rejection trick: Sample a random point @unurmath{(X,Y)} uniformly in the bounding rectangle @unurmath{(0,\pi)\times(0,0.5).} This is easy since each coordinate can be sampled independently from the respective uniform distributions @unurmath{U(0,\pi)} and @unurmath{U(0,0.5).} Whenever the point falls into the shaded region below the graph (indicated by dots in the figure), i.e., when @unurmath{Y < sin(X)/2,} we accept it and return @unurmath{X} as a random variate from the distribution with density @unurmath{f(x).} Otherwise we have to reject the point (indicated by small circles in the figure), and try again. It is quite clear that this idea works for every distribution with a bounded density on a bounded domain. Moreover, we can use this procedure with any multiple of the density, i.e., with any positive bounded function with bounded integral and it is not necessary to know the integral of this function. So we use the term density in the sequel for any positive function with bounded integral. From the figure we can conclude that the performance of a rejection algorithm depends heavily on the area of the enveloping rectangle. Moreover, the method does not work if the target distribution has infinite tails (or is unbounded). Hence non-rectangular shaped regions for the envelopes are important and we have to solve the problem of sampling points uniformly from such domains. Looking again at the example above we notice that the @i{x}-coordinate of the random point @unurmath{(X,Y)} was sampled by inversion from the uniform distribution on the domain of the given density. This motivates us to replace the density of the uniform distribution by the (multiple of a) density @unurmath{h(x)} of some other appropriate distribution. We only have to take care that it is chosen such that it is always an upper bound, i.e., @unurmath{h(x) >= f(x)} for all @unurmath{x} in the domain of the distribution. To generate the pair @unurmath{(X,Y)} we generate @unurmath{X} from the distribution with density proportional to @unurmath{h(x)} and @unurmath{Y} uniformly between @unurmath{0} and @unurmath{h(X).} The first step (generate @unurmath{X}) is usually done by inversion (@pxref{Inversion}). Thus the general rejection algorithm for a hat @unurmath{h(x)} with inverse CDF @unurmath{H^{-1}}consists of the following steps: @enumerate @item Generate a @unurmath{U(0,1)} random number @unurmath{U.} @item Set @unurmath{X} to @unurmath{H^{-1}(U).} @item Generate a @unurmath{U(0,1)} random number @unurmath{V.} @item Set @unurmath{Y} to @unurmath{V h(X).} @item If @unurmath{Y <= f(X)} accept @unurmath{X} as the random variate. @item Else try again. @end enumerate If the evaluation of the density @unurmath{f(x)} is expensive (i.e., time consuming) it is possible to use a simple lower bound of the density as so called @emph{squeeze function} @unurmath{s(x)} (the triangular shaped function in the above figure is an example for such a squeeze). We can then accept @unurmath{X} when @unurmath{Y <= s(X)} and can thus often save the evaluation of the density. We have seen so far that the rejection principle leads to short and simple generation algorithms. The main practical problem to apply the rejection algorithm is the search for a good fitting hat function and for squeezes. We do not discuss these topics here as they are the heart of the different automatic algorithms implemented in UNU.RAN. Information about the construction of hat and squeeze can therefore be found in the descriptions of the methods. The performance characteristics of rejection algorithms mainly depend on the fit of the hat and the squeeze. It is not difficult to prove that: @itemize @bullet @item The expected number of trials to generate one variate is the ratio between the area below the hat and the area below the density. @item The expected number of evaluations of the density necessary to generate one variate is equal to the ratio between the area below the hat and the area below the density, when no squeeze is used. Otherwise, when a squeeze is given it is equal to the ratio between the area between hat and squeeze and the area below the hat. @item The @code{sqhratio} (i.e., the ratio between the area below the squeeze and the area below the hat) used in some of the UNU.RAN methods is easy to compute. It is useful as its reciprocal is an upper bound for the expected number of trials of the rejection algoritm. The expected number of evaluations of the density is bounded by @unurmath{(1/sqhratio)-1.} @end itemize =EON */ /* ------------------------------------------------------------------------- */ /* =NODE Composition The Composition Method =UP RVG [30] =DESCRIPTION The composition method is an important principle to facilitate and speed up random variate generation. The basic idea is simple. To generate random variates with a given density we first split the domain of the density into subintervals. Then we select one of these randomly with probabilities given by the area below the density in the respective subintervals. Finally we generate a random variate from the density of the selected part by inversion and return it as random variate of the full distribution. Composition can be combined with rejection. Thus it is possible to decompose the domain of the distribution into subintervals and to construct hat and squeeze functions seperatly in every subinterval. The area below the hat must be determined in every subinterval. Then the Composition rejection algorithm contains the following steps: @enumerate @item Generate the index @unurmath{J} of the subinterval as the realisation of a discrete random variate with probabilities proportional to the area below the hat. @item Generate a random variate @unurmath{X} proportional to the hat in interval @unurmath{J.} @item Generate the @unurmath{U(0,f(X))} random number @unurmath{Y.} @item If @unurmath{Y <= f(X)} accept @unurmath{X} as random variate. @item Else start again with generating the index @unurmath{J.} @end enumerate The first step can be done in constant time (i.e., independent of the number of chosen subintervals) by means of the indexed search method (@pxref{IndexedSearch}). It is possible to reduce the number of uniform random numbers required in the above algorithm by recycling the random numbers used in Step 1 and additionally by applying the principle of @emph{immediate acceptance}. For details see @unurbibref{HLD04: Sect. 3.1}. =EON */ /* ------------------------------------------------------------------------- */ /* =NODE Ratio-of-Uniforms The Ratio-of-Uniforms Method =UP RVG [40] =DESCRIPTION The construction of an appropriate hat function for the given density is the crucial step for constructing rejection algorithms. Equivalently we can try to find an appropriate envelope for the region between the graph of the density and the @i{x}-axis, such that we can easily sample uniformly distributed random points. This task could become easier if we can find transformations that map the region between the density and the axis into a region of more suitable shape (for example into a bounded region). As a first example we consider the following simple algorithm for the Cauchy distribution. @enumerate @item Generate a @unurmath{U(-1,1)} random number @unurmath{U} and a @unurmath{U(0,1)} random number @unurmath{V.} @item If @unurmath{U^2 + V^2 <= 1} accept @unurmath{X=U/V} as a Cauchy random variate. @item Else try again. @end enumerate It is possible to prove that the above algorithm indeed generates Cauchy random variates. The fundamental principle behind this algorithm is the fact that the region below the density is mapped by the transformation @unurmathdisplay{(X,Y)\mapsto(U,V)=(2\,X\sqrt{Y},2\,\sqrt{Y})} into a half-disc in such a way that the ratio between the area of the image to the area of the preimage is constant. This is due to the fact that that the Jacobian of this transformation is constant. @unurimage{figures/rou-cauchy} The above example is a special case of a more general principle, called the @emph{Ratio-of-uniforms (RoU) method}. It is based on the fact that for a random variable @unurmath{X} with density @unurmath{f(x)} and some constant @unurmath{\mu} we can generate @unurmath{X} from the desired density by calculating @unurmath{X=U/V+\mu} for a pair @unurmath{(U,V)} uniformly distributed in the set @unurmathdisplay{A_f= \{(u,v)\colon 0 < v \leq \sqrt{f(u/v+\mu)}\}.} For most distributions it is best to set the constant @unurmath{\mu} equal to the mode of the distribution. For sampling random points uniformly distributed in @unurmath{A_f} rejection from a convenient enveloping region is used, usually the minimal bounding rectangle, i.e., the smallest possible rectangle that contains @unurmath{A_f} (see the above figure). It is given by @unurmath{(u^-,u^+)\times (0,v^+)} where @unurmathdisplay{ v^+ = \sup\limits_{b_l P} @item @w{ } @w{ } @w{ } Set @unurmath{X} to @unurmath{X+1} and @unurmath{P} to @unurmath{P+p(X).} @item Return @unurmath{X.} @end enumerate With the exception of some very simple discrete distributions, sequential search algorithms become very slow as the while-loop has to be repeated very often. The expected number of iterations, i.e., the number of comparisons in the while condition, is equal to the expectation of the distribution plus @unurmath{1.} It can therefore become arbitrary large or even infinity if the tail of the distribution is very heavy. Another serious problem can be critical round-off errors due to summing up many probabilities @unurmath{p(k).} To speed up the search procedure it is best to use indexed search. =EON */ /* ------------------------------------------------------------------------- */ /* =NODE IndexedSearch Indexed Search (Guide Table Method) =UP RVG [60] =DESCRIPTION The idea to speed up the sequential search algorithm is easy to understand. Instead of starting always at @unurmath{0} we store a table of size @unurmath{C} with starting points for our search. For this table we compute @unurmath{F^{-1}(U)} for @unurmath{C} equidistributed values of @unurmath{U,} i.e., for @unurmath{u_i = i/C,} @unurmath{i=0,...,C-1.} Such a table is called @emph{guide table} or @emph{hash table}. Then it is easy to prove that for every @unurmath{U} in @unurmath{(0,1)} the guide table entry for @unurmath{k=floor(UC)} is bounded by @unurmath{F^{-1}(U).} This shows that we can really start our sequential search procedure from the table entry for @unurmath{k} and the index @unurmath{k} of the correct table entry can be found rapidly by means of the truncation operation. The two main differences between @emph{indexed search} and @emph{sequential search} are that we start searching at the number determined by the guide table, and that we have to compute and store the cumulative probabilities in the setup as we have to know the cumulative probability for the starting point of the search algorithm. The rounding problems that can occur in the sequential search algorithm can occur here as well. Compared to sequential search we have now the obvious drawback of a slow setup. The computation of the cumulative probabilities grows linear with the size of the domain of the distribution @unurmath{L.} What we gain is really high speed as the marginal execution time of the sampling algorithm becomes very small. The expected number of comparisons is bounded by @unurmath{1+L/C.} This shows that there is a trade-off between speed and the size of the guide table. Cache-effects in modern computers will however slow down the speed-up for really large table sizes. Thus we recommend to use a guide table that is about two times larger than the probability vector to obtain optimal speed. =EON */ /* ------------------------------------------------------------------------- */ unuran-1.11.0/doc/src/ref_example2.texi0000644001357500135600000001056314430713446014650 00000000000000/* ------------------------------------------------------------- */ /* File: example2.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* In this example we build a distribution object from scratch */ /* and sample from this distribution. */ /* */ /* We use method TDR (Transformed Density Rejection) which */ /* required a PDF and the derivative of the PDF. */ /* ------------------------------------------------------------- */ /* Define the PDF and dPDF of our distribution. */ /* */ /* Our distribution has the PDF */ /* */ /* / 1 - x*x if |x| <= 1 */ /* f(x) = < */ /* \ 0 otherwise */ /* */ /* The PDF of our distribution: */ double mypdf( double x, const UNUR_DISTR *distr ) /* The second argument (`distr') can be used for parameters */ /* for the PDF. (We do not use parameters in our example.) */ @{ if (fabs(x) >= 1.) return 0.; else return (1.-x*x); @} /* end of mypdf() */ /* The derivative of the PDF of our distribution: */ double mydpdf( double x, const UNUR_DISTR *distr ) @{ if (fabs(x) >= 1.) return 0.; else return (-2.*x); @} /* end of mydpdf() */ /* ------------------------------------------------------------- */ int main(void) @{ int i; /* loop variable */ double x; /* will hold the random number */ /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Create a new distribution object from scratch. */ /* It is a continuous distribution, and we need a PDF and the */ /* derivative of the PDF. Moreover we set the domain. */ /* Get empty distribution object for a continuous distribution */ distr = unur_distr_cont_new(); /* Assign the PDF and dPDF (defined above). */ unur_distr_cont_set_pdf( distr, mypdf ); unur_distr_cont_set_dpdf( distr, mydpdf ); /* Set the domain of the distribution (optional for TDR). */ unur_distr_cont_set_domain( distr, -1., 1. ); /* Choose a method: TDR. */ par = unur_tdr_new(distr); /* Now you can change some of the default settings for the */ /* parameters of the chosen method. We don't do it here. */ /* Create the generator object. */ gen = unur_init(par); /* Notice that this call has also destroyed the parameter */ /* object `par' as a side effect. */ /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) @{ fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); @} /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) @{ x = unur_sample_cont(gen); printf("%f\n",x); @} /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); @} /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/doc/src/references.dh0000644001357500135600000002005514420445767014046 00000000000000/*---------------------------------------------------------------------------*/ =APPENDIX Bibliography Bibliography =UP TOP [a07] =DESCRIPTION @subheading Standard Distributions @table @t @anchor{bib:JKKa92} @item [JKKa92] @sc{N.L. Johnson, S. Kotz, and A.W. Kemp} (1992). @i{Univariate Discrete Distributions}, 2nd edition, John Wiley & Sons, Inc., New York. @anchor{bib:JKBb94} @item [JKBb94] @sc{N.L. Johnson, S. Kotz, and N. Balakrishnan} (1994). @i{Continuous Univariate Distributions}, Volume 1, 2nd edition, John Wiley & Sons, Inc., New York. @anchor{bib:JKBc95} @item [JKBc95] @sc{N.L. Johnson, S. Kotz, and N. Balakrishnan} (1995). @i{Continuous Univariate Distributions}, Volume 2, 2nd edition, John Wiley & Sons, Inc., New York. @anchor{bib:JKBd97} @item [JKBd97] @sc{N.L. Johnson, S. Kotz, and N. Balakrishnan} (1997). @i{Discrete Multivariate Distributions}, John Wiley & Sons, Inc., New York. @anchor{bib:KBJe00} @item [KBJe00] @sc{S. Kotz, N. Balakrishnan, and N.L. Johnson} (2000). @i{Continuous Multivariate Distributions}, Volume 1: Models and Applications, John Wiley & Sons, Inc., New York. @end table @c ------------------------------------------------------- @subheading Universal Methods -- Surveys @table @t @anchor{bib:HLD04} @item [HLD04] @sc{W. H@"ormann, J. Leydold, and G. Derflinger} (2004). @i{Automatic Nonuniform Random Variate Generation}, Springer, Berlin. @end table @c ------------------------------------------------------- @subheading Universal Methods @table @t @anchor{bib:AJa93} @item [AJa93] @sc{J.H. Ahrens} (1993). @i{Sampling from general distributions by suboptimal division of domains}, Grazer Math. Berichte 319, 30pp. @anchor{bib:AJa95} @item [AJa95] @sc{J.H. Ahrens} (1995). @i{An one-table method for sampling from continuous and discrete distributions}, Computing 54(2), pp. 127-146. @anchor{bib:CAa74} @item [CAa74] @sc{H.C. Chen and Y. Asau} (1974). @i{On generating random variates from an empirical distribution}, AIIE Trans. 6, pp. 163-166. @anchor{bib:DHLa08} @item [DHLa08] @sc{G. Derflinger, W. H@"ormann, and J. Leydold} (2008). @i{Numerical inversion when only the density function is known}, Research Report Series of the Department of Statistics and Mathematics 78, WU Wien, Augasse 2--6, A-1090 Wien, Austria, @uref{http://epub.wu.ac.at/english/}. @anchor{bib:DLa86} @item [DLa86] @sc{L. Devroye} (1986). @i{Non-Uniform Random Variate Generation}, Springer Verlag, New York. @anchor{bib:GWa92} @item [GWa92] @sc{W.R. Gilks and P. Wild} (1992). @i{Adaptive rejection sampling for Gibbs sampling}, Applied Statistics 41, pp. 337-348. @anchor{bib:HWa95} @item [HWa95] @sc{W. H@"ormann} (1995). @i{A rejection technique for sampling from T-concave distributions}, ACM Trans. Math. Software 21(2), pp. 182-193. @anchor{bib:HDa96} @item [HDa96] @sc{W. H@"ormann and G. Derflinger} (1996). @i{Rejection-inversion to generate variates from monotone discrete distributions}, ACM TOMACS 6(3), 169-184. @anchor{bib:HLa00} @item [HLa00] @sc{W. H@"ormann and J. Leydold} (2000). @i{Automatic random variate generation for simulation input.} In: J.A. Joines, R. Barton, P. Fishwick, K. Kang (eds.), Proceedings of the 2000 Winter Simulation Conference, pp. 675-682. @anchor{bib:HLa03} @item [HLa03] @sc{W. H@"ormann and J. Leydold} (2003). @i{Continuous Random Variate Generation by Fast Numerical Inversion}, ACM TOMACS 13(4), 347-362. @anchor{bib:HLDa07} @item [HLDa07] @sc{W. H@"ormann, J. Leydold, and G. Derflinger} (2007). @i{Automatic Random Variate Generation for Unbounded Densities}, ACM Trans. Model. Comput. Simul. 17(4), pp.18. @anchor{bib:KLPa05} @item [KLPa05] @sc{R. Karawatzki, J. Leydold, and K. P@"otzelberger} (2005). @i{Automatic Markov chain Monte Carlo procedures for sampling from multivariate distributions}, Research Report Series of the Department of Statistics and Mathematics 27, WU Wien, Augasse 2--6, A-1090 Wien, Austria, @uref{http://epub.wu.ac.at/english/}. @anchor{bib:LJa98} @item [LJa98] @sc{J. Leydold} (1998). @i{A Rejection Technique for Sampling from Log-Concave Multivariate Distributions}, ACM TOMACS 8(3), pp. 254-280. @anchor{bib:LJa00} @item [LJa00] @sc{J. Leydold} (2000). @i{Automatic Sampling with the Ratio-of-Uniforms Method}, ACM Trans. Math. Software 26(1), pp. 78-98. @anchor{bib:LJa01} @item [LJa01] @sc{J. Leydold} (2001). @i{A simple universal generator for continuous and discrete univariate T-concave distributions}, ACM Trans. Math. Software 27(1), pp. 66-82. @anchor{bib:LJa02} @item [LJa02] @sc{J. Leydold} (2003). @i{Short universal generators via generalized ratio-of-uniforms method}, Math. Comp. 72(243), pp. 1453-1471. @anchor{bib:WGS91} @item [WGS91] @sc{J.C. Wakefield, A.E. Gelfand, and A.F.M. Smith} (1992). @i{Efficient generation of random variates via the ratio-of-uniforms method}, Statist. Comput. 1(2), pp. 129-133. @anchor{bib:WAa77} @item [WAa77] @sc{A.J. Walker} (1977). @i{An efficient method for generating discrete random variables with general distributions}, ACM Trans. Math. Software 3, pp. 253-256. @end table @c ------------------------------------------------------- @subheading Special Generators @table @t @anchor{bib:ADa74} @item [ADa74] @sc{J.H. Ahrens, U. Dieter} (1974). @i{Computer methods for sampling from gamma, beta, Poisson and binomial distributions}, Computing 12, 223-246. @anchor{bib:ADa82} @item [ADa82] @sc{J.H. Ahrens, U. Dieter} (1982). @i{Generating gamma variates by a modified rejection technique}, Communications of the ACM 25, 47-54. @anchor{bib:ADb82} @item [ADb82] @sc{J.H. Ahrens, U. Dieter} (1982). @i{Computer generation of Poisson deviates from modified normal distributions}, ACM Trans. Math. Software 8, 163-179. @anchor{bib:BMa58} @item [BMa58] @sc{G.E.P. Box and M.E. Muller} (1958). @i{A note on the generation of random normal deviates}, Annals Math. Statist. 29, 610-611. @anchor{bib:CHa77} @item [CHa77] @sc{R.C.H. Cheng} (1977). @i{The Generation of Gamma Variables with Non-Integral Shape Parameter}, Appl. Statist. 26(1), 71-75. @anchor{bib:Dag89} @item [Dag89] @sc{J.S. Dagpunar} (1989). @i{An Easily Implemented Generalised Inverse Gaussian Generator}, Commun. Statist. Simul. 18(2), 703-710. @anchor{bib:HDa90} @item [HDa90] @sc{W. H@"ormann and G. Derflinger} (1990). @i{The ACR Method for generating normal random variables}, OR Spektrum 12, 181-185. @anchor{bib:KAa81} @item [KAa81] @sc{A.W. Kemp} (1981). @i{Efficient generation of logarithmically distributed pseudo-random variables}, Appl. Statist. 30, 249-253. @anchor{bib:KRa76} @item [KRa76] @sc{A.J. Kinderman and J.G. Ramage} (1976). @i{Computer Generation of Normal Random Variables}, J. Am. Stat. Assoc. 71(356), 893 - 898. @anchor{bib:MJa87} @item [MJa87] @sc{J.F. Monahan} (1987). @i{An algorithm for generating chi random variables}, ACM Trans. Math. Software 13, 168-172. @anchor{bib:MGa62} @item [MGa62] @sc{G. Marsaglia} (1962). @i{Improving the Polar Method for Generating a Pair of Random Variables}, Boeing Sci. Res. Lab., Seattle, Washington. @anchor{bib:MOa84} @item [MOa84] @sc{G. Marsaglia and I. Olkin} (1984). @i{Generating Correlation Matrices}, SIAM J. Sci. Stat. Comput 5, 470-475. @anchor{bib:STa89} @item [STa89] @sc{E. Stadlober} (1989). @i{Sampling from Poisson, binomial and hypergeometric distributions: ratio of uniforms as a simple and fast alternative}, Bericht 303, Math. Stat. Sektion, Forschungsgesellschaft Joanneum, Graz. @anchor{bib:ZHa94} @item [ZHa94] @sc{H. Zechner} (1994). @i{Efficient sampling from continuous and discrete unimodal distributions}, Pd.D. Thesis, 156 pp., Technical University Graz, Austria. @end table @c ------------------------------------------------------- @subheading Other references @table @t @anchor{bib:CPa76} @item [CPa76] @sc{R. Cranley and T.N.L. Patterson} (1976). @i{Randomization of number theoretic methods for multiple integration}, SIAM J. Num. Anal., Vol. 13, pp. 904-914. @anchor{bib:HJa61} @item [HJa61] @sc{R. Hooke and T.A. Jeeves} (1961). @i{Direct Search Solution of Numerical and Statistical Problems}, Journal of the ACM, Vol. 8, April 1961, pp. 212-229. @end table @c ------------------------------------------------------- =EON unuran-1.11.0/doc/src/methods_discr.texi0000644001357500135600000000135414420445767015133 00000000000000@cartouche @noindent Methods for @b{discrete univariate distributions}@* sample with @command{unur_sample_discr} @multitable {method} {PMF} {PV} {mode} {area} {build-in standard distribution} @item method@tab PMF @tab PV @tab mode @tab sum @tab other @item DARI @tab x @tab @tab x @tab ~ @tab T-concave @item DAU @tab [x] @tab x @tab @tab @tab @item DEXT @tab @tab @tab @tab @tab wrapper for external generator @item DGT @tab [x] @tab x @tab @tab @tab @item DSROU @tab x @tab @tab x @tab x @tab T-concave @item DSS @tab [x] @tab x @tab @tab x @tab @item DSTD @tab @tab @tab @tab @tab build-in standard distribution @end multitable @end cartouche unuran-1.11.0/doc/src/texinfo.tex0000644001357500135600000112651614420445767013620 00000000000000% texinfo.tex -- TeX macros to handle Texinfo files. % % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % \def\texinfoversion{2011-05-23.16} % % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, % 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. % % This texinfo.tex file is free software: you can redistribute it and/or % modify it under the terms of the GNU General Public License as % published by the Free Software Foundation, either version 3 of the % License, or (at your option) any later version. % % This texinfo.tex file is distributed in the hope that it will be % useful, but WITHOUT ANY WARRANTY; without even the implied warranty % of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU % General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program. If not, see . % % As a special exception, when this file is read by TeX when processing % a Texinfo source document, you may use the result without % restriction. (This has been our intent since Texinfo was invented.) % % Please try the latest version of texinfo.tex before submitting bug % reports; you can get the latest version from: % http://www.gnu.org/software/texinfo/ (the Texinfo home page), or % ftp://tug.org/tex/texinfo.tex % (and all CTAN mirrors, see http://www.ctan.org). % The texinfo.tex in any given distribution could well be out % of date, so if that's what you're using, please check. % % Send bug reports to bug-texinfo@gnu.org. Please include including a % complete document in each bug report with which we can reproduce the % problem. Patches are, of course, greatly appreciated. % % To process a Texinfo manual with TeX, it's most reliable to use the % texi2dvi shell script that comes with the distribution. For a simple % manual foo.texi, however, you can get away with this: % tex foo.texi % texindex foo.?? % tex foo.texi % tex foo.texi % dvips foo.dvi -o # or whatever; this makes foo.ps. % The extra TeX runs get the cross-reference information correct. % Sometimes one run after texindex suffices, and sometimes you need more % than two; texi2dvi does it as many times as necessary. % % It is possible to adapt texinfo.tex for other languages, to some % extent. You can get the existing language-specific files from the % full Texinfo distribution. % % The GNU Texinfo home page is http://www.gnu.org/software/texinfo. \message{Loading texinfo [version \texinfoversion]:} % If in a .fmt file, print the version number % and turn on active characters that we couldn't do earlier because % they might have appeared in the input file name. \everyjob{\message{[Texinfo version \texinfoversion]}% \catcode`+=\active \catcode`\_=\active} \chardef\other=12 % We never want plain's \outer definition of \+ in Texinfo. % For @tex, we can use \tabalign. \let\+ = \relax % Save some plain tex macros whose names we will redefine. \let\ptexb=\b \let\ptexbullet=\bullet \let\ptexc=\c \let\ptexcomma=\, \let\ptexdot=\. \let\ptexdots=\dots \let\ptexend=\end \let\ptexequiv=\equiv \let\ptexexclam=\! \let\ptexfootnote=\footnote \let\ptexgtr=> \let\ptexhat=^ \let\ptexi=\i \let\ptexindent=\indent \let\ptexinsert=\insert \let\ptexlbrace=\{ \let\ptexless=< \let\ptexnewwrite\newwrite \let\ptexnoindent=\noindent \let\ptexplus=+ \let\ptexraggedright=\raggedright \let\ptexrbrace=\} \let\ptexslash=\/ \let\ptexstar=\* \let\ptext=\t \let\ptextop=\top {\catcode`\'=\active \global\let\ptexquoteright'}% active in plain's math mode % If this character appears in an error message or help string, it % starts a new line in the output. \newlinechar = `^^J % Use TeX 3.0's \inputlineno to get the line number, for better error % messages, but if we're using an old version of TeX, don't do anything. % \ifx\inputlineno\thisisundefined \let\linenumber = \empty % Pre-3.0. \else \def\linenumber{l.\the\inputlineno:\space} \fi % Set up fixed words for English if not already set. \ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi \ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi \ifx\putwordfile\undefined \gdef\putwordfile{file}\fi \ifx\putwordin\undefined \gdef\putwordin{in}\fi \ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi \ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi \ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi \ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi \ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi \ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi \ifx\putwordof\undefined \gdef\putwordof{of}\fi \ifx\putwordon\undefined \gdef\putwordon{on}\fi \ifx\putwordpage\undefined \gdef\putwordpage{page}\fi \ifx\putwordsection\undefined \gdef\putwordsection{section}\fi \ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi \ifx\putwordsee\undefined \gdef\putwordsee{see}\fi \ifx\putwordSee\undefined \gdef\putwordSee{See}\fi \ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi \ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi % \ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi \ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi \ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi \ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi \ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi \ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi \ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi \ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi \ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi \ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi \ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi \ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi % \ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi \ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi \ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi \ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi \ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi % Since the category of space is not known, we have to be careful. \chardef\spacecat = 10 \def\spaceisspace{\catcode`\ =\spacecat} % sometimes characters are active, so we need control sequences. \chardef\ampChar = `\& \chardef\colonChar = `\: \chardef\commaChar = `\, \chardef\dashChar = `\- \chardef\dotChar = `\. \chardef\exclamChar= `\! \chardef\hashChar = `\# \chardef\lquoteChar= `\` \chardef\questChar = `\? \chardef\rquoteChar= `\' \chardef\semiChar = `\; \chardef\slashChar = `\/ \chardef\underChar = `\_ % Ignore a token. % \def\gobble#1{} % The following is used inside several \edef's. \def\makecsname#1{\expandafter\noexpand\csname#1\endcsname} % Hyphenation fixes. \hyphenation{ Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script ap-pen-dix bit-map bit-maps data-base data-bases eshell fall-ing half-way long-est man-u-script man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces spell-ing spell-ings stand-alone strong-est time-stamp time-stamps which-ever white-space wide-spread wrap-around } % Margin to add to right of even pages, to left of odd pages. \newdimen\bindingoffset \newdimen\normaloffset \newdimen\pagewidth \newdimen\pageheight % For a final copy, take out the rectangles % that mark overfull boxes (in case you have decided % that the text looks ok even though it passes the margin). % \def\finalout{\overfullrule=0pt } % Sometimes it is convenient to have everything in the transcript file % and nothing on the terminal. We don't just call \tracingall here, % since that produces some useless output on the terminal. We also make % some effort to order the tracing commands to reduce output in the log % file; cf. trace.sty in LaTeX. % \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}% \def\loggingall{% \tracingstats2 \tracingpages1 \tracinglostchars2 % 2 gives us more in etex \tracingparagraphs1 \tracingoutput1 \tracingmacros2 \tracingrestores1 \showboxbreadth\maxdimen \showboxdepth\maxdimen \ifx\eTeXversion\thisisundefined\else % etex gives us more logging \tracingscantokens1 \tracingifs1 \tracinggroups1 \tracingnesting2 \tracingassigns1 \fi \tracingcommands3 % 3 gives us more in etex \errorcontextlines16 }% % add check for \lastpenalty to plain's definitions. If the last thing % we did was a \nobreak, we don't want to insert more space. % \def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount \removelastskip\penalty-50\smallskip\fi\fi} \def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount \removelastskip\penalty-100\medskip\fi\fi} \def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount \removelastskip\penalty-200\bigskip\fi\fi} % Do @cropmarks to get crop marks. % \newif\ifcropmarks \let\cropmarks = \cropmarkstrue % % Dimensions to add cropmarks at corners. % Added by P. A. MacKay, 12 Nov. 1986 % \newdimen\outerhsize \newdimen\outervsize % set by the paper size routines \newdimen\cornerlong \cornerlong=1pc \newdimen\cornerthick \cornerthick=.3pt \newdimen\topandbottommargin \topandbottommargin=.75in % Output a mark which sets \thischapter, \thissection and \thiscolor. % We dump everything together because we only have one kind of mark. % This works because we only use \botmark / \topmark, not \firstmark. % % A mark contains a subexpression of the \ifcase ... \fi construct. % \get*marks macros below extract the needed part using \ifcase. % % Another complication is to let the user choose whether \thischapter % (\thissection) refers to the chapter (section) in effect at the top % of a page, or that at the bottom of a page. The solution is % described on page 260 of The TeXbook. It involves outputting two % marks for the sectioning macros, one before the section break, and % one after. I won't pretend I can describe this better than DEK... \def\domark{% \toks0=\expandafter{\lastchapterdefs}% \toks2=\expandafter{\lastsectiondefs}% \toks4=\expandafter{\prevchapterdefs}% \toks6=\expandafter{\prevsectiondefs}% \toks8=\expandafter{\lastcolordefs}% \mark{% \the\toks0 \the\toks2 \noexpand\or \the\toks4 \the\toks6 \noexpand\else \the\toks8 }% } % \topmark doesn't work for the very first chapter (after the title % page or the contents), so we use \firstmark there -- this gets us % the mark with the chapter defs, unless the user sneaks in, e.g., % @setcolor (or @url, or @link, etc.) between @contents and the very % first @chapter. \def\gettopheadingmarks{% \ifcase0\topmark\fi \ifx\thischapter\empty \ifcase0\firstmark\fi \fi } \def\getbottomheadingmarks{\ifcase1\botmark\fi} \def\getcolormarks{\ifcase2\topmark\fi} % Avoid "undefined control sequence" errors. \def\lastchapterdefs{} \def\lastsectiondefs{} \def\prevchapterdefs{} \def\prevsectiondefs{} \def\lastcolordefs{} % Main output routine. \chardef\PAGE = 255 \output = {\onepageout{\pagecontents\PAGE}} \newbox\headlinebox \newbox\footlinebox % \onepageout takes a vbox as an argument. Note that \pagecontents % does insertions, but you have to call it yourself. \def\onepageout#1{% \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi % \ifodd\pageno \advance\hoffset by \bindingoffset \else \advance\hoffset by -\bindingoffset\fi % % Do this outside of the \shipout so @code etc. will be expanded in % the headline as they should be, not taken literally (outputting ''code). \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}% \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}% % {% % Have to do this stuff outside the \shipout because we want it to % take effect in \write's, yet the group defined by the \vbox ends % before the \shipout runs. % \indexdummies % don't expand commands in the output. \normalturnoffactive % \ in index entries must not stay \, e.g., if % the page break happens to be in the middle of an example. % We don't want .vr (or whatever) entries like this: % \entry{{\tt \indexbackslash }acronym}{32}{\code {\acronym}} % "\acronym" won't work when it's read back in; % it needs to be % {\code {{\tt \backslashcurfont }acronym} \shipout\vbox{% % Do this early so pdf references go to the beginning of the page. \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi % \ifcropmarks \vbox to \outervsize\bgroup \hsize = \outerhsize \vskip-\topandbottommargin \vtop to0pt{% \line{\ewtop\hfil\ewtop}% \nointerlineskip \line{% \vbox{\moveleft\cornerthick\nstop}% \hfill \vbox{\moveright\cornerthick\nstop}% }% \vss}% \vskip\topandbottommargin \line\bgroup \hfil % center the page within the outer (page) hsize. \ifodd\pageno\hskip\bindingoffset\fi \vbox\bgroup \fi % \unvbox\headlinebox \pagebody{#1}% \ifdim\ht\footlinebox > 0pt % Only leave this space if the footline is nonempty. % (We lessened \vsize for it in \oddfootingyyy.) % The \baselineskip=24pt in plain's \makefootline has no effect. \vskip 24pt \unvbox\footlinebox \fi % \ifcropmarks \egroup % end of \vbox\bgroup \hfil\egroup % end of (centering) \line\bgroup \vskip\topandbottommargin plus1fill minus1fill \boxmaxdepth = \cornerthick \vbox to0pt{\vss \line{% \vbox{\moveleft\cornerthick\nsbot}% \hfill \vbox{\moveright\cornerthick\nsbot}% }% \nointerlineskip \line{\ewbot\hfil\ewbot}% }% \egroup % \vbox from first cropmarks clause \fi }% end of \shipout\vbox }% end of group with \indexdummies \advancepageno \ifnum\outputpenalty>-20000 \else\dosupereject\fi } \newinsert\margin \dimen\margin=\maxdimen \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}} {\catcode`\@ =11 \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi % marginal hacks, juha@viisa.uucp (Juha Takala) \ifvoid\margin\else % marginal info is present \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi \dimen@=\dp#1\relax \unvbox#1\relax \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi \ifr@ggedbottom \kern-\dimen@ \vfil \fi} } % Here are the rules for the cropmarks. Note that they are % offset so that the space between them is truly \outerhsize or \outervsize % (P. A. MacKay, 12 November, 1986) % \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong} \def\nstop{\vbox {\hrule height\cornerthick depth\cornerlong width\cornerthick}} \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong} \def\nsbot{\vbox {\hrule height\cornerlong depth\cornerthick width\cornerthick}} % Parse an argument, then pass it to #1. The argument is the rest of % the input line (except we remove a trailing comment). #1 should be a % macro which expects an ordinary undelimited TeX argument. % \def\parsearg{\parseargusing{}} \def\parseargusing#1#2{% \def\argtorun{#2}% \begingroup \obeylines \spaceisspace #1% \parseargline\empty% Insert the \empty token, see \finishparsearg below. } {\obeylines % \gdef\parseargline#1^^M{% \endgroup % End of the group started in \parsearg. \argremovecomment #1\comment\ArgTerm% }% } % First remove any @comment, then any @c comment. \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm} \def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm} % Each occurrence of `\^^M' or `\^^M' is replaced by a single space. % % \argremovec might leave us with trailing space, e.g., % @end itemize @c foo % This space token undergoes the same procedure and is eventually removed % by \finishparsearg. % \def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M} \def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M} \def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{% \def\temp{#3}% \ifx\temp\empty % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp: \let\temp\finishparsearg \else \let\temp\argcheckspaces \fi % Put the space token in: \temp#1 #3\ArgTerm } % If a _delimited_ argument is enclosed in braces, they get stripped; so % to get _exactly_ the rest of the line, we had to prevent such situation. % We prepended an \empty token at the very beginning and we expand it now, % just before passing the control to \argtorun. % (Similarly, we have to think about #3 of \argcheckspacesY above: it is % either the null string, or it ends with \^^M---thus there is no danger % that a pair of braces would be stripped. % % But first, we have to remove the trailing space token. % \def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}} % \parseargdef\foo{...} % is roughly equivalent to % \def\foo{\parsearg\Xfoo} % \def\Xfoo#1{...} % % Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my % favourite TeX trick. --kasal, 16nov03 \def\parseargdef#1{% \expandafter \doparseargdef \csname\string#1\endcsname #1% } \def\doparseargdef#1#2{% \def#2{\parsearg#1}% \def#1##1% } % Several utility definitions with active space: { \obeyspaces \gdef\obeyedspace{ } % Make each space character in the input produce a normal interword % space in the output. Don't allow a line break at this space, as this % is used only in environments like @example, where each line of input % should produce a line of output anyway. % \gdef\sepspaces{\obeyspaces\let =\tie} % If an index command is used in an @example environment, any spaces % therein should become regular spaces in the raw index file, not the % expansion of \tie (\leavevmode \penalty \@M \ ). \gdef\unsepspaces{\let =\space} } \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next} % Define the framework for environments in texinfo.tex. It's used like this: % % \envdef\foo{...} % \def\Efoo{...} % % It's the responsibility of \envdef to insert \begingroup before the % actual body; @end closes the group after calling \Efoo. \envdef also % defines \thisenv, so the current environment is known; @end checks % whether the environment name matches. The \checkenv macro can also be % used to check whether the current environment is the one expected. % % Non-false conditionals (@iftex, @ifset) don't fit into this, so they % are not treated as environments; they don't open a group. (The % implementation of @end takes care not to call \endgroup in this % special case.) % At run-time, environments start with this: \def\startenvironment#1{\begingroup\def\thisenv{#1}} % initialize \let\thisenv\empty % ... but they get defined via ``\envdef\foo{...}'': \long\def\envdef#1#2{\def#1{\startenvironment#1#2}} \def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}} % Check whether we're in the right environment: \def\checkenv#1{% \def\temp{#1}% \ifx\thisenv\temp \else \badenverr \fi } % Environment mismatch, #1 expected: \def\badenverr{% \errhelp = \EMsimple \errmessage{This command can appear only \inenvironment\temp, not \inenvironment\thisenv}% } \def\inenvironment#1{% \ifx#1\empty outside of any environment% \else in environment \expandafter\string#1% \fi } % @end foo executes the definition of \Efoo. % But first, it executes a specialized version of \checkenv % \parseargdef\end{% \if 1\csname iscond.#1\endcsname \else % The general wording of \badenverr may not be ideal. \expandafter\checkenv\csname#1\endcsname \csname E#1\endcsname \endgroup \fi } \newhelp\EMsimple{Press RETURN to continue.} % Be sure we're in horizontal mode when doing a tie, since we make space % equivalent to this in @example-like environments. Otherwise, a space % at the beginning of a line will start with \penalty -- and % since \penalty is valid in vertical mode, we'd end up putting the % penalty on the vertical list instead of in the new paragraph. {\catcode`@ = 11 % Avoid using \@M directly, because that causes trouble % if the definition is written into an index file. \global\let\tiepenalty = \@M \gdef\tie{\leavevmode\penalty\tiepenalty\ } } % @: forces normal size whitespace following. \def\:{\spacefactor=1000 } % @* forces a line break. \def\*{\hfil\break\hbox{}\ignorespaces} % @/ allows a line break. \let\/=\allowbreak % @. is an end-of-sentence period. \def\.{.\spacefactor=\endofsentencespacefactor\space} % @! is an end-of-sentence bang. \def\!{!\spacefactor=\endofsentencespacefactor\space} % @? is an end-of-sentence query. \def\?{?\spacefactor=\endofsentencespacefactor\space} % @frenchspacing on|off says whether to put extra space after punctuation. % \def\onword{on} \def\offword{off} % \parseargdef\frenchspacing{% \def\temp{#1}% \ifx\temp\onword \plainfrenchspacing \else\ifx\temp\offword \plainnonfrenchspacing \else \errhelp = \EMsimple \errmessage{Unknown @frenchspacing option `\temp', must be on|off}% \fi\fi } % @w prevents a word break. Without the \leavevmode, @w at the % beginning of a paragraph, when TeX is still in vertical mode, would % produce a whole line of output instead of starting the paragraph. \def\w#1{\leavevmode\hbox{#1}} % @group ... @end group forces ... to be all on one page, by enclosing % it in a TeX vbox. We use \vtop instead of \vbox to construct the box % to keep its height that of a normal line. According to the rules for % \topskip (p.114 of the TeXbook), the glue inserted is % max (\topskip - \ht (first item), 0). If that height is large, % therefore, no glue is inserted, and the space between the headline and % the text is small, which looks bad. % % Another complication is that the group might be very large. This can % cause the glue on the previous page to be unduly stretched, because it % does not have much material. In this case, it's better to add an % explicit \vfill so that the extra space is at the bottom. The % threshold for doing this is if the group is more than \vfilllimit % percent of a page (\vfilllimit can be changed inside of @tex). % \newbox\groupbox \def\vfilllimit{0.7} % \envdef\group{% \ifnum\catcode`\^^M=\active \else \errhelp = \groupinvalidhelp \errmessage{@group invalid in context where filling is enabled}% \fi \startsavinginserts % \setbox\groupbox = \vtop\bgroup % Do @comment since we are called inside an environment such as % @example, where each end-of-line in the input causes an % end-of-line in the output. We don't want the end-of-line after % the `@group' to put extra space in the output. Since @group % should appear on a line by itself (according to the Texinfo % manual), we don't worry about eating any user text. \comment } % % The \vtop produces a box with normal height and large depth; thus, TeX puts % \baselineskip glue before it, and (when the next line of text is done) % \lineskip glue after it. Thus, space below is not quite equal to space % above. But it's pretty close. \def\Egroup{% % To get correct interline space between the last line of the group % and the first line afterwards, we have to propagate \prevdepth. \endgraf % Not \par, as it may have been set to \lisppar. \global\dimen1 = \prevdepth \egroup % End the \vtop. % \dimen0 is the vertical size of the group's box. \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox % \dimen2 is how much space is left on the page (more or less). \dimen2 = \pageheight \advance\dimen2 by -\pagetotal % if the group doesn't fit on the current page, and it's a big big % group, force a page break. \ifdim \dimen0 > \dimen2 \ifdim \pagetotal < \vfilllimit\pageheight \page \fi \fi \box\groupbox \prevdepth = \dimen1 \checkinserts } % % TeX puts in an \escapechar (i.e., `@') at the beginning of the help % message, so this ends up printing `@group can only ...'. % \newhelp\groupinvalidhelp{% group can only be used in environments such as @example,^^J% where each line of input produces a line of output.} % @need space-in-mils % forces a page break if there is not space-in-mils remaining. \newdimen\mil \mil=0.001in \parseargdef\need{% % Ensure vertical mode, so we don't make a big box in the middle of a % paragraph. \par % % If the @need value is less than one line space, it's useless. \dimen0 = #1\mil \dimen2 = \ht\strutbox \advance\dimen2 by \dp\strutbox \ifdim\dimen0 > \dimen2 % % Do a \strut just to make the height of this box be normal, so the % normal leading is inserted relative to the preceding line. % And a page break here is fine. \vtop to #1\mil{\strut\vfil}% % % TeX does not even consider page breaks if a penalty added to the % main vertical list is 10000 or more. But in order to see if the % empty box we just added fits on the page, we must make it consider % page breaks. On the other hand, we don't want to actually break the % page after the empty box. So we use a penalty of 9999. % % There is an extremely small chance that TeX will actually break the % page at this \penalty, if there are no other feasible breakpoints in % sight. (If the user is using lots of big @group commands, which % almost-but-not-quite fill up a page, TeX will have a hard time doing % good page breaking, for example.) However, I could not construct an % example where a page broke at this \penalty; if it happens in a real % document, then we can reconsider our strategy. \penalty9999 % % Back up by the size of the box, whether we did a page break or not. \kern -#1\mil % % Do not allow a page break right after this kern. \nobreak \fi } % @br forces paragraph break (and is undocumented). \let\br = \par % @page forces the start of a new page. % \def\page{\par\vfill\supereject} % @exdent text.... % outputs text on separate line in roman font, starting at standard page margin % This records the amount of indent in the innermost environment. % That's how much \exdent should take out. \newskip\exdentamount % This defn is used inside fill environments such as @defun. \parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break} % This defn is used inside nofill environments such as @example. \parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount \leftline{\hskip\leftskip{\rm#1}}}} % @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current % paragraph. For more general purposes, use the \margin insertion % class. WHICH is `l' or `r'. Not documented, written for gawk manual. % \newskip\inmarginspacing \inmarginspacing=1cm \def\strutdepth{\dp\strutbox} % \def\doinmargin#1#2{\strut\vadjust{% \nobreak \kern-\strutdepth \vtop to \strutdepth{% \baselineskip=\strutdepth \vss % if you have multiple lines of stuff to put here, you'll need to % make the vbox yourself of the appropriate size. \ifx#1l% \llap{\ignorespaces #2\hskip\inmarginspacing}% \else \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}% \fi \null }% }} \def\inleftmargin{\doinmargin l} \def\inrightmargin{\doinmargin r} % % @inmargin{TEXT [, RIGHT-TEXT]} % (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right; % else use TEXT for both). % \def\inmargin#1{\parseinmargin #1,,\finish} \def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing. \setbox0 = \hbox{\ignorespaces #2}% \ifdim\wd0 > 0pt \def\lefttext{#1}% have both texts \def\righttext{#2}% \else \def\lefttext{#1}% have only one text \def\righttext{#1}% \fi % \ifodd\pageno \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin \else \def\temp{\inleftmargin\lefttext}% \fi \temp } % @| inserts a changebar to the left of the current line. It should % surround any changed text. This approach does *not* work if the % change spans more than two lines of output. To handle that, we would % have adopt a much more difficult approach (putting marks into the main % vertical list for the beginning and end of each change). This command % is not documented, not supported, and doesn't work. % \def\|{% % \vadjust can only be used in horizontal mode. \leavevmode % % Append this vertical mode material after the current line in the output. \vadjust{% % We want to insert a rule with the height and depth of the current % leading; that is exactly what \strutbox is supposed to record. \vskip-\baselineskip % % \vadjust-items are inserted at the left edge of the type. So % the \llap here moves out into the left-hand margin. \llap{% % % For a thicker or thinner bar, change the `1pt'. \vrule height\baselineskip width1pt % % This is the space between the bar and the text. \hskip 12pt }% }% } % @include FILE -- \input text of FILE. % \def\include{\parseargusing\filenamecatcodes\includezzz} \def\includezzz#1{% \pushthisfilestack \def\thisfile{#1}% {% \makevalueexpandable % we want to expand any @value in FILE. \turnoffactive % and allow special characters in the expansion \indexnofonts % Allow `@@' and other weird things in file names. \wlog{texinfo.tex: doing @include of #1^^J}% \edef\temp{\noexpand\input #1 }% % % This trickery is to read FILE outside of a group, in case it makes % definitions, etc. \expandafter }\temp \popthisfilestack } \def\filenamecatcodes{% \catcode`\\=\other \catcode`~=\other \catcode`^=\other \catcode`_=\other \catcode`|=\other \catcode`<=\other \catcode`>=\other \catcode`+=\other \catcode`-=\other \catcode`\`=\other \catcode`\'=\other } \def\pushthisfilestack{% \expandafter\pushthisfilestackX\popthisfilestack\StackTerm } \def\pushthisfilestackX{% \expandafter\pushthisfilestackY\thisfile\StackTerm } \def\pushthisfilestackY #1\StackTerm #2\StackTerm {% \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}% } \def\popthisfilestack{\errthisfilestackempty} \def\errthisfilestackempty{\errmessage{Internal error: the stack of filenames is empty.}} \def\thisfile{} % @center line % outputs that line, centered. % \parseargdef\center{% \ifhmode \let\next\centerH \else \let\next\centerV \fi \next{\hfil \ignorespaces#1\unskip \hfil}% } \def\centerH#1{% {% \hfil\break \advance\hsize by -\leftskip \advance\hsize by -\rightskip \line{#1}% \break }% } \def\centerV#1{\line{\kern\leftskip #1\kern\rightskip}} % @sp n outputs n lines of vertical space \parseargdef\sp{\vskip #1\baselineskip} % @comment ...line which is ignored... % @c is the same as @comment % @ignore ... @end ignore is another way to write a comment \def\comment{\begingroup \catcode`\^^M=\other% \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other% \commentxxx} {\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}} \let\c=\comment % @paragraphindent NCHARS % We'll use ems for NCHARS, close enough. % NCHARS can also be the word `asis' or `none'. % We cannot feasibly implement @paragraphindent asis, though. % \def\asisword{asis} % no translation, these are keywords \def\noneword{none} % \parseargdef\paragraphindent{% \def\temp{#1}% \ifx\temp\asisword \else \ifx\temp\noneword \defaultparindent = 0pt \else \defaultparindent = #1em \fi \fi \parindent = \defaultparindent } % @exampleindent NCHARS % We'll use ems for NCHARS like @paragraphindent. % It seems @exampleindent asis isn't necessary, but % I preserve it to make it similar to @paragraphindent. \parseargdef\exampleindent{% \def\temp{#1}% \ifx\temp\asisword \else \ifx\temp\noneword \lispnarrowing = 0pt \else \lispnarrowing = #1em \fi \fi } % @firstparagraphindent WORD % If WORD is `none', then suppress indentation of the first paragraph % after a section heading. If WORD is `insert', then do indent at such % paragraphs. % % The paragraph indentation is suppressed or not by calling % \suppressfirstparagraphindent, which the sectioning commands do. % We switch the definition of this back and forth according to WORD. % By default, we suppress indentation. % \def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent} \def\insertword{insert} % \parseargdef\firstparagraphindent{% \def\temp{#1}% \ifx\temp\noneword \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent \else\ifx\temp\insertword \let\suppressfirstparagraphindent = \relax \else \errhelp = \EMsimple \errmessage{Unknown @firstparagraphindent option `\temp'}% \fi\fi } % Here is how we actually suppress indentation. Redefine \everypar to % \kern backwards by \parindent, and then reset itself to empty. % % We also make \indent itself not actually do anything until the next % paragraph. % \gdef\dosuppressfirstparagraphindent{% \gdef\indent{% \restorefirstparagraphindent \indent }% \gdef\noindent{% \restorefirstparagraphindent \noindent }% \global\everypar = {% \kern -\parindent \restorefirstparagraphindent }% } \gdef\restorefirstparagraphindent{% \global \let \indent = \ptexindent \global \let \noindent = \ptexnoindent \global \everypar = {}% } % @refill is a no-op. \let\refill=\relax % If working on a large document in chapters, it is convenient to % be able to disable indexing, cross-referencing, and contents, for test runs. % This is done with @novalidate (before @setfilename). % \newif\iflinks \linkstrue % by default we want the aux files. \let\novalidate = \linksfalse % @setfilename is done at the beginning of every texinfo file. % So open here the files we need to have open while reading the input. % This makes it possible to make a .fmt file for texinfo. \def\setfilename{% \fixbackslash % Turn off hack to swallow `\input texinfo'. \iflinks \tryauxfile % Open the new aux file. TeX will close it automatically at exit. \immediate\openout\auxfile=\jobname.aux \fi % \openindices needs to do some work in any case. \openindices \let\setfilename=\comment % Ignore extra @setfilename cmds. % % If texinfo.cnf is present on the system, read it. % Useful for site-wide @afourpaper, etc. \openin 1 texinfo.cnf \ifeof 1 \else \input texinfo.cnf \fi \closein 1 % \comment % Ignore the actual filename. } % Called from \setfilename. % \def\openindices{% \newindex{cp}% \newcodeindex{fn}% \newcodeindex{vr}% \newcodeindex{tp}% \newcodeindex{ky}% \newcodeindex{pg}% } % @bye. \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend} \message{pdf,} % adobe `portable' document format \newcount\tempnum \newcount\lnkcount \newtoks\filename \newcount\filenamelength \newcount\pgn \newtoks\toksA \newtoks\toksB \newtoks\toksC \newtoks\toksD \newbox\boxA \newcount\countA \newif\ifpdf \newif\ifpdfmakepagedest % when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1 % can be set). So we test for \relax and 0 as well as being undefined. \ifx\pdfoutput\thisisundefined \else \ifx\pdfoutput\relax \else \ifcase\pdfoutput \else \pdftrue \fi \fi \fi % PDF uses PostScript string constants for the names of xref targets, % for display in the outlines, and in other places. Thus, we have to % double any backslashes. Otherwise, a name like "\node" will be % interpreted as a newline (\n), followed by o, d, e. Not good. % http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html % (and related messages, the final outcome is that it is up to the TeX % user to double the backslashes and otherwise make the string valid, so % that's what we do). % double active backslashes. % {\catcode`\@=0 \catcode`\\=\active @gdef@activebackslashdouble{% @catcode`@\=@active @let\=@doublebackslash} } % To handle parens, we must adopt a different approach, since parens are % not active characters. hyperref.dtx (which has the same problem as % us) handles it with this amazing macro to replace tokens, with minor % changes for Texinfo. It is included here under the GPL by permission % from the author, Heiko Oberdiek. % % #1 is the tokens to replace. % #2 is the replacement. % #3 is the control sequence with the string. % \def\HyPsdSubst#1#2#3{% \def\HyPsdReplace##1#1##2\END{% ##1% \ifx\\##2\\% \else #2% \HyReturnAfterFi{% \HyPsdReplace##2\END }% \fi }% \xdef#3{\expandafter\HyPsdReplace#3#1\END}% } \long\def\HyReturnAfterFi#1\fi{\fi#1} % #1 is a control sequence in which to do the replacements. \def\backslashparens#1{% \xdef#1{#1}% redefine it as its expansion; the definition is simply % \lastnode when called from \setref -> \pdfmkdest. \HyPsdSubst{(}{\realbackslash(}{#1}% \HyPsdSubst{)}{\realbackslash)}{#1}% } \newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images with PDF output, and none of those formats could be found. (.eps cannot be supported due to the design of the PDF format; use regular TeX (DVI output) for that.)} \ifpdf % % Color manipulation macros based on pdfcolor.tex, % except using rgb instead of cmyk; the latter is said to render as a % very dark gray on-screen and a very dark halftone in print, instead % of actual black. \def\rgbDarkRed{0.50 0.09 0.12} \def\rgbBlack{0 0 0} % % k sets the color for filling (usual text, etc.); % K sets the color for stroking (thin rules, e.g., normal _'s). \def\pdfsetcolor#1{\pdfliteral{#1 rg #1 RG}} % % Set color, and create a mark which defines \thiscolor accordingly, % so that \makeheadline knows which color to restore. \def\setcolor#1{% \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}% \domark \pdfsetcolor{#1}% } % \def\maincolor{\rgbBlack} \pdfsetcolor{\maincolor} \edef\thiscolor{\maincolor} \def\lastcolordefs{} % \def\makefootline{% \baselineskip24pt \line{\pdfsetcolor{\maincolor}\the\footline}% } % \def\makeheadline{% \vbox to 0pt{% \vskip-22.5pt \line{% \vbox to8.5pt{}% % Extract \thiscolor definition from the marks. \getcolormarks % Typeset the headline with \maincolor, then restore the color. \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}% }% \vss }% \nointerlineskip } % % \pdfcatalog{/PageMode /UseOutlines} % % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto). \def\dopdfimage#1#2#3{% \def\imagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}% \def\imageheight{#3}\setbox2 = \hbox{\ignorespaces #3}% % % pdftex (and the PDF format) support .png, .jpg, .pdf (among % others). Let's try in that order. \let\pdfimgext=\empty \begingroup \openin 1 #1.png \ifeof 1 \openin 1 #1.jpg \ifeof 1 \openin 1 #1.jpeg \ifeof 1 \openin 1 #1.JPG \ifeof 1 \openin 1 #1.pdf \ifeof 1 \openin 1 #1.PDF \ifeof 1 \errhelp = \nopdfimagehelp \errmessage{Could not find image file #1 for pdf}% \else \gdef\pdfimgext{PDF}% \fi \else \gdef\pdfimgext{pdf}% \fi \else \gdef\pdfimgext{JPG}% \fi \else \gdef\pdfimgext{jpeg}% \fi \else \gdef\pdfimgext{jpg}% \fi \else \gdef\pdfimgext{png}% \fi \closein 1 \endgroup % % without \immediate, ancient pdftex seg faults when the same image is % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.) \ifnum\pdftexversion < 14 \immediate\pdfimage \else \immediate\pdfximage \fi \ifdim \wd0 >0pt width \imagewidth \fi \ifdim \wd2 >0pt height \imageheight \fi \ifnum\pdftexversion<13 #1.\pdfimgext \else {#1.\pdfimgext}% \fi \ifnum\pdftexversion < 14 \else \pdfrefximage \pdflastximage \fi} % \def\pdfmkdest#1{{% % We have to set dummies so commands such as @code, and characters % such as \, aren't expanded when present in a section title. \indexnofonts \turnoffactive \activebackslashdouble \makevalueexpandable \def\pdfdestname{#1}% \backslashparens\pdfdestname \safewhatsit{\pdfdest name{\pdfdestname} xyz}% }} % % used to mark target names; must be expandable. \def\pdfmkpgn#1{#1} % % by default, use a color that is dark enough to print on paper as % nearly black, but still distinguishable for online viewing. \def\urlcolor{\rgbDarkRed} \def\linkcolor{\rgbDarkRed} \def\endlink{\setcolor{\maincolor}\pdfendlink} % % Adding outlines to PDF; macros for calculating structure of outlines % come from Petr Olsak \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% \else \csname#1\endcsname \fi} \def\advancenumber#1{\tempnum=\expnumber{#1}\relax \advance\tempnum by 1 \expandafter\xdef\csname#1\endcsname{\the\tempnum}} % % #1 is the section text, which is what will be displayed in the % outline by the pdf viewer. #2 is the pdf expression for the number % of subentries (or empty, for subsubsections). #3 is the node text, % which might be empty if this toc entry had no corresponding node. % #4 is the page number % \def\dopdfoutline#1#2#3#4{% % Generate a link to the node text if that exists; else, use the % page number. We could generate a destination for the section % text in the case where a section has no node, but it doesn't % seem worth the trouble, since most documents are normally structured. \def\pdfoutlinedest{#3}% \ifx\pdfoutlinedest\empty \def\pdfoutlinedest{#4}% \else % Doubled backslashes in the name. {\activebackslashdouble \xdef\pdfoutlinedest{#3}% \backslashparens\pdfoutlinedest}% \fi % % Also double the backslashes in the display string. {\activebackslashdouble \xdef\pdfoutlinetext{#1}% \backslashparens\pdfoutlinetext}% % \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}% } % \def\pdfmakeoutlines{% \begingroup % Thanh's hack / proper braces in bookmarks \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace % % Read toc silently, to get counts of subentries for \pdfoutline. \def\partentry##1##2##3##4{}% ignore parts in the outlines \def\numchapentry##1##2##3##4{% \def\thischapnum{##2}% \def\thissecnum{0}% \def\thissubsecnum{0}% }% \def\numsecentry##1##2##3##4{% \advancenumber{chap\thischapnum}% \def\thissecnum{##2}% \def\thissubsecnum{0}% }% \def\numsubsecentry##1##2##3##4{% \advancenumber{sec\thissecnum}% \def\thissubsecnum{##2}% }% \def\numsubsubsecentry##1##2##3##4{% \advancenumber{subsec\thissubsecnum}% }% \def\thischapnum{0}% \def\thissecnum{0}% \def\thissubsecnum{0}% % % use \def rather than \let here because we redefine \chapentry et % al. a second time, below. \def\appentry{\numchapentry}% \def\appsecentry{\numsecentry}% \def\appsubsecentry{\numsubsecentry}% \def\appsubsubsecentry{\numsubsubsecentry}% \def\unnchapentry{\numchapentry}% \def\unnsecentry{\numsecentry}% \def\unnsubsecentry{\numsubsecentry}% \def\unnsubsubsecentry{\numsubsubsecentry}% \readdatafile{toc}% % % Read toc second time, this time actually producing the outlines. % The `-' means take the \expnumber as the absolute number of % subentries, which we calculated on our first read of the .toc above. % % We use the node names as the destinations. \def\numchapentry##1##2##3##4{% \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}% \def\numsecentry##1##2##3##4{% \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}% \def\numsubsecentry##1##2##3##4{% \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}% \def\numsubsubsecentry##1##2##3##4{% count is always zero \dopdfoutline{##1}{}{##3}{##4}}% % % PDF outlines are displayed using system fonts, instead of % document fonts. Therefore we cannot use special characters, % since the encoding is unknown. For example, the eogonek from % Latin 2 (0xea) gets translated to a | character. Info from % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100. % % xx to do this right, we have to translate 8-bit characters to % their "best" equivalent, based on the @documentencoding. Right % now, I guess we'll just let the pdf reader have its way. \indexnofonts \setupdatafile \catcode`\\=\active \otherbackslash \input \tocreadfilename \endgroup } % \def\skipspaces#1{\def\PP{#1}\def\D{|}% \ifx\PP\D\let\nextsp\relax \else\let\nextsp\skipspaces \ifx\p\space\else\addtokens{\filename}{\PP}% \advance\filenamelength by 1 \fi \fi \nextsp} \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax} \ifnum\pdftexversion < 14 \let \startlink \pdfannotlink \else \let \startlink \pdfstartlink \fi % make a live url in pdf output. \def\pdfurl#1{% \begingroup % it seems we really need yet another set of dummies; have not % tried to figure out what each command should do in the context % of @url. for now, just make @/ a no-op, that's the only one % people have actually reported a problem with. % \normalturnoffactive \def\@{@}% \let\/=\empty \makevalueexpandable % do we want to go so far as to use \indexnofonts instead of just % special-casing \var here? \def\var##1{##1}% % \leavevmode\setcolor{\urlcolor}% \startlink attr{/Border [0 0 0]}% user{/Subtype /Link /A << /S /URI /URI (#1) >>}% \endgroup} \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}} \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks} \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}} \def\maketoks{% \expandafter\poptoks\the\toksA|ENDTOKS|\relax \ifx\first0\adn0 \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 \else \ifnum0=\countA\else\makelink\fi \ifx\first.\let\next=\done\else \let\next=\maketoks \addtokens{\toksB}{\the\toksD} \ifx\first,\addtokens{\toksB}{\space}\fi \fi \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi \next} \def\makelink{\addtokens{\toksB}% {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} \def\pdflink#1{% \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}} \setcolor{\linkcolor}#1\endlink} \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} \else % non-pdf mode \let\pdfmkdest = \gobble \let\pdfurl = \gobble \let\endlink = \relax \let\setcolor = \gobble \let\pdfsetcolor = \gobble \let\pdfmakeoutlines = \relax \fi % \ifx\pdfoutput \message{fonts,} % Change the current font style to #1, remembering it in \curfontstyle. % For now, we do not accumulate font styles: @b{@i{foo}} prints foo in % italics, not bold italics. % \def\setfontstyle#1{% \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd. \csname ten#1\endcsname % change the current font } % Select #1 fonts with the current style. % \def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname} \def\rm{\fam=0 \setfontstyle{rm}} \def\it{\fam=\itfam \setfontstyle{it}} \def\sl{\fam=\slfam \setfontstyle{sl}} \def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf} \def\tt{\fam=\ttfam \setfontstyle{tt}} % Unfortunately, we have to override this for titles and the like, since % in those cases "rm" is bold. Sigh. \def\rmisbold{\rm\def\curfontstyle{bf}} % Texinfo sort of supports the sans serif font style, which plain TeX does not. % So we set up a \sf. \newfam\sffam \def\sf{\fam=\sffam \setfontstyle{sf}} \let\li = \sf % Sometimes we call it \li, not \sf. % We don't need math for this font style. \def\ttsl{\setfontstyle{ttsl}} % Default leading. \newdimen\textleading \textleading = 13.2pt % Set the baselineskip to #1, and the lineskip and strut size % correspondingly. There is no deep meaning behind these magic numbers % used as factors; they just match (closely enough) what Knuth defined. % \def\lineskipfactor{.08333} \def\strutheightpercent{.70833} \def\strutdepthpercent {.29167} % % can get a sort of poor man's double spacing by redefining this. \def\baselinefactor{1} % \def\setleading#1{% \dimen0 = #1\relax \normalbaselineskip = \baselinefactor\dimen0 \normallineskip = \lineskipfactor\normalbaselineskip \normalbaselines \setbox\strutbox =\hbox{% \vrule width0pt height\strutheightpercent\baselineskip depth \strutdepthpercent \baselineskip }% } % PDF CMaps. See also LaTeX's t1.cmap. % % do nothing with this by default. \expandafter\let\csname cmapOT1\endcsname\gobble \expandafter\let\csname cmapOT1IT\endcsname\gobble \expandafter\let\csname cmapOT1TT\endcsname\gobble % if we are producing pdf, and we have \pdffontattr, then define cmaps. % (\pdffontattr was introduced many years ago, but people still run % older pdftex's; it's easy to conditionalize, so we do.) \ifpdf \ifx\pdffontattr\thisisundefined \else \begingroup \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap %%DocumentNeededResources: ProcSet (CIDInit) %%IncludeResource: ProcSet (CIDInit) %%BeginResource: CMap (TeX-OT1-0) %%Title: (TeX-OT1-0 TeX OT1 0) %%Version: 1.000 %%EndComments /CIDInit /ProcSet findresource begin 12 dict begin begincmap /CIDSystemInfo << /Registry (TeX) /Ordering (OT1) /Supplement 0 >> def /CMapName /TeX-OT1-0 def /CMapType 2 def 1 begincodespacerange <00> <7F> endcodespacerange 8 beginbfrange <00> <01> <0393> <09> <0A> <03A8> <23> <26> <0023> <28> <3B> <0028> <3F> <5B> <003F> <5D> <5E> <005D> <61> <7A> <0061> <7B> <7C> <2013> endbfrange 40 beginbfchar <02> <0398> <03> <039B> <04> <039E> <05> <03A0> <06> <03A3> <07> <03D2> <08> <03A6> <0B> <00660066> <0C> <00660069> <0D> <0066006C> <0E> <006600660069> <0F> <00660066006C> <10> <0131> <11> <0237> <12> <0060> <13> <00B4> <14> <02C7> <15> <02D8> <16> <00AF> <17> <02DA> <18> <00B8> <19> <00DF> <1A> <00E6> <1B> <0153> <1C> <00F8> <1D> <00C6> <1E> <0152> <1F> <00D8> <21> <0021> <22> <201D> <27> <2019> <3C> <00A1> <3D> <003D> <3E> <00BF> <5C> <201C> <5F> <02D9> <60> <2018> <7D> <02DD> <7E> <007E> <7F> <00A8> endbfchar endcmap CMapName currentdict /CMap defineresource pop end end %%EndResource %%EOF }\endgroup \expandafter\edef\csname cmapOT1\endcsname#1{% \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% }% % % \cmapOT1IT \begingroup \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap %%DocumentNeededResources: ProcSet (CIDInit) %%IncludeResource: ProcSet (CIDInit) %%BeginResource: CMap (TeX-OT1IT-0) %%Title: (TeX-OT1IT-0 TeX OT1IT 0) %%Version: 1.000 %%EndComments /CIDInit /ProcSet findresource begin 12 dict begin begincmap /CIDSystemInfo << /Registry (TeX) /Ordering (OT1IT) /Supplement 0 >> def /CMapName /TeX-OT1IT-0 def /CMapType 2 def 1 begincodespacerange <00> <7F> endcodespacerange 8 beginbfrange <00> <01> <0393> <09> <0A> <03A8> <25> <26> <0025> <28> <3B> <0028> <3F> <5B> <003F> <5D> <5E> <005D> <61> <7A> <0061> <7B> <7C> <2013> endbfrange 42 beginbfchar <02> <0398> <03> <039B> <04> <039E> <05> <03A0> <06> <03A3> <07> <03D2> <08> <03A6> <0B> <00660066> <0C> <00660069> <0D> <0066006C> <0E> <006600660069> <0F> <00660066006C> <10> <0131> <11> <0237> <12> <0060> <13> <00B4> <14> <02C7> <15> <02D8> <16> <00AF> <17> <02DA> <18> <00B8> <19> <00DF> <1A> <00E6> <1B> <0153> <1C> <00F8> <1D> <00C6> <1E> <0152> <1F> <00D8> <21> <0021> <22> <201D> <23> <0023> <24> <00A3> <27> <2019> <3C> <00A1> <3D> <003D> <3E> <00BF> <5C> <201C> <5F> <02D9> <60> <2018> <7D> <02DD> <7E> <007E> <7F> <00A8> endbfchar endcmap CMapName currentdict /CMap defineresource pop end end %%EndResource %%EOF }\endgroup \expandafter\edef\csname cmapOT1IT\endcsname#1{% \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% }% % % \cmapOT1TT \begingroup \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap %%DocumentNeededResources: ProcSet (CIDInit) %%IncludeResource: ProcSet (CIDInit) %%BeginResource: CMap (TeX-OT1TT-0) %%Title: (TeX-OT1TT-0 TeX OT1TT 0) %%Version: 1.000 %%EndComments /CIDInit /ProcSet findresource begin 12 dict begin begincmap /CIDSystemInfo << /Registry (TeX) /Ordering (OT1TT) /Supplement 0 >> def /CMapName /TeX-OT1TT-0 def /CMapType 2 def 1 begincodespacerange <00> <7F> endcodespacerange 5 beginbfrange <00> <01> <0393> <09> <0A> <03A8> <21> <26> <0021> <28> <5F> <0028> <61> <7E> <0061> endbfrange 32 beginbfchar <02> <0398> <03> <039B> <04> <039E> <05> <03A0> <06> <03A3> <07> <03D2> <08> <03A6> <0B> <2191> <0C> <2193> <0D> <0027> <0E> <00A1> <0F> <00BF> <10> <0131> <11> <0237> <12> <0060> <13> <00B4> <14> <02C7> <15> <02D8> <16> <00AF> <17> <02DA> <18> <00B8> <19> <00DF> <1A> <00E6> <1B> <0153> <1C> <00F8> <1D> <00C6> <1E> <0152> <1F> <00D8> <20> <2423> <27> <2019> <60> <2018> <7F> <00A8> endbfchar endcmap CMapName currentdict /CMap defineresource pop end end %%EndResource %%EOF }\endgroup \expandafter\edef\csname cmapOT1TT\endcsname#1{% \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% }% \fi\fi % Set the font macro #1 to the font named #2, adding on the % specified font prefix (normally `cm'). % #3 is the font's design size, #4 is a scale factor, #5 is the CMap % encoding (currently only OT1, OT1IT and OT1TT are allowed, pass % empty to omit). \def\setfont#1#2#3#4#5{% \font#1=\fontprefix#2#3 scaled #4 \csname cmap#5\endcsname#1% } % This is what gets called when #5 of \setfont is empty. \let\cmap\gobble % emacs-page end of cmaps % Use cm as the default font prefix. % To specify the font prefix, you must define \fontprefix % before you read in texinfo.tex. \ifx\fontprefix\thisisundefined \def\fontprefix{cm} \fi % Support font families that don't use the same naming scheme as CM. \def\rmshape{r} \def\rmbshape{bx} %where the normal face is bold \def\bfshape{b} \def\bxshape{bx} \def\ttshape{tt} \def\ttbshape{tt} \def\ttslshape{sltt} \def\itshape{ti} \def\itbshape{bxti} \def\slshape{sl} \def\slbshape{bxsl} \def\sfshape{ss} \def\sfbshape{ss} \def\scshape{csc} \def\scbshape{csc} % Definitions for a main text size of 11pt. This is the default in % Texinfo. % \def\definetextfontsizexi{% % Text fonts (11.2pt, magstep1). \def\textnominalsize{11pt} \edef\mainmagstep{\magstephalf} \setfont\textrm\rmshape{10}{\mainmagstep}{OT1} \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT} \setfont\textbf\bfshape{10}{\mainmagstep}{OT1} \setfont\textit\itshape{10}{\mainmagstep}{OT1IT} \setfont\textsl\slshape{10}{\mainmagstep}{OT1} \setfont\textsf\sfshape{10}{\mainmagstep}{OT1} \setfont\textsc\scshape{10}{\mainmagstep}{OT1} \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT} \font\texti=cmmi10 scaled \mainmagstep \font\textsy=cmsy10 scaled \mainmagstep \def\textecsize{1095} % A few fonts for @defun names and args. \setfont\defbf\bfshape{10}{\magstep1}{OT1} \setfont\deftt\ttshape{10}{\magstep1}{OT1TT} \setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT} \def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} % Fonts for indices, footnotes, small examples (9pt). \def\smallnominalsize{9pt} \setfont\smallrm\rmshape{9}{1000}{OT1} \setfont\smalltt\ttshape{9}{1000}{OT1TT} \setfont\smallbf\bfshape{10}{900}{OT1} \setfont\smallit\itshape{9}{1000}{OT1IT} \setfont\smallsl\slshape{9}{1000}{OT1} \setfont\smallsf\sfshape{9}{1000}{OT1} \setfont\smallsc\scshape{10}{900}{OT1} \setfont\smallttsl\ttslshape{10}{900}{OT1TT} \font\smalli=cmmi9 \font\smallsy=cmsy9 \def\smallecsize{0900} % Fonts for small examples (8pt). \def\smallernominalsize{8pt} \setfont\smallerrm\rmshape{8}{1000}{OT1} \setfont\smallertt\ttshape{8}{1000}{OT1TT} \setfont\smallerbf\bfshape{10}{800}{OT1} \setfont\smallerit\itshape{8}{1000}{OT1IT} \setfont\smallersl\slshape{8}{1000}{OT1} \setfont\smallersf\sfshape{8}{1000}{OT1} \setfont\smallersc\scshape{10}{800}{OT1} \setfont\smallerttsl\ttslshape{10}{800}{OT1TT} \font\smalleri=cmmi8 \font\smallersy=cmsy8 \def\smallerecsize{0800} % Fonts for title page (20.4pt): \def\titlenominalsize{20pt} \setfont\titlerm\rmbshape{12}{\magstep3}{OT1} \setfont\titleit\itbshape{10}{\magstep4}{OT1IT} \setfont\titlesl\slbshape{10}{\magstep4}{OT1} \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT} \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT} \setfont\titlesf\sfbshape{17}{\magstep1}{OT1} \let\titlebf=\titlerm \setfont\titlesc\scbshape{10}{\magstep4}{OT1} \font\titlei=cmmi12 scaled \magstep3 \font\titlesy=cmsy10 scaled \magstep4 \def\titleecsize{2074} % Chapter (and unnumbered) fonts (17.28pt). \def\chapnominalsize{17pt} \setfont\chaprm\rmbshape{12}{\magstep2}{OT1} \setfont\chapit\itbshape{10}{\magstep3}{OT1IT} \setfont\chapsl\slbshape{10}{\magstep3}{OT1} \setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT} \setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT} \setfont\chapsf\sfbshape{17}{1000}{OT1} \let\chapbf=\chaprm \setfont\chapsc\scbshape{10}{\magstep3}{OT1} \font\chapi=cmmi12 scaled \magstep2 \font\chapsy=cmsy10 scaled \magstep3 \def\chapecsize{1728} % Section fonts (14.4pt). \def\secnominalsize{14pt} \setfont\secrm\rmbshape{12}{\magstep1}{OT1} \setfont\secit\itbshape{10}{\magstep2}{OT1IT} \setfont\secsl\slbshape{10}{\magstep2}{OT1} \setfont\sectt\ttbshape{12}{\magstep1}{OT1TT} \setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT} \setfont\secsf\sfbshape{12}{\magstep1}{OT1} \let\secbf\secrm \setfont\secsc\scbshape{10}{\magstep2}{OT1} \font\seci=cmmi12 scaled \magstep1 \font\secsy=cmsy10 scaled \magstep2 \def\sececsize{1440} % Subsection fonts (13.15pt). \def\ssecnominalsize{13pt} \setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1} \setfont\ssecit\itbshape{10}{1315}{OT1IT} \setfont\ssecsl\slbshape{10}{1315}{OT1} \setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT} \setfont\ssecttsl\ttslshape{10}{1315}{OT1TT} \setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1} \let\ssecbf\ssecrm \setfont\ssecsc\scbshape{10}{1315}{OT1} \font\sseci=cmmi12 scaled \magstephalf \font\ssecsy=cmsy10 scaled 1315 \def\ssececsize{1200} % Reduced fonts for @acro in text (10pt). \def\reducednominalsize{10pt} \setfont\reducedrm\rmshape{10}{1000}{OT1} \setfont\reducedtt\ttshape{10}{1000}{OT1TT} \setfont\reducedbf\bfshape{10}{1000}{OT1} \setfont\reducedit\itshape{10}{1000}{OT1IT} \setfont\reducedsl\slshape{10}{1000}{OT1} \setfont\reducedsf\sfshape{10}{1000}{OT1} \setfont\reducedsc\scshape{10}{1000}{OT1} \setfont\reducedttsl\ttslshape{10}{1000}{OT1TT} \font\reducedi=cmmi10 \font\reducedsy=cmsy10 \def\reducedecsize{1000} \textleading = 13.2pt % line spacing for 11pt CM \textfonts % reset the current fonts \rm } % end of 11pt text font size definitions % Definitions to make the main text be 10pt Computer Modern, with % section, chapter, etc., sizes following suit. This is for the GNU % Press printing of the Emacs 22 manual. Maybe other manuals in the % future. Used with @smallbook, which sets the leading to 12pt. % \def\definetextfontsizex{% % Text fonts (10pt). \def\textnominalsize{10pt} \edef\mainmagstep{1000} \setfont\textrm\rmshape{10}{\mainmagstep}{OT1} \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT} \setfont\textbf\bfshape{10}{\mainmagstep}{OT1} \setfont\textit\itshape{10}{\mainmagstep}{OT1IT} \setfont\textsl\slshape{10}{\mainmagstep}{OT1} \setfont\textsf\sfshape{10}{\mainmagstep}{OT1} \setfont\textsc\scshape{10}{\mainmagstep}{OT1} \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT} \font\texti=cmmi10 scaled \mainmagstep \font\textsy=cmsy10 scaled \mainmagstep \def\textecsize{1000} % A few fonts for @defun names and args. \setfont\defbf\bfshape{10}{\magstephalf}{OT1} \setfont\deftt\ttshape{10}{\magstephalf}{OT1TT} \setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT} \def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} % Fonts for indices, footnotes, small examples (9pt). \def\smallnominalsize{9pt} \setfont\smallrm\rmshape{9}{1000}{OT1} \setfont\smalltt\ttshape{9}{1000}{OT1TT} \setfont\smallbf\bfshape{10}{900}{OT1} \setfont\smallit\itshape{9}{1000}{OT1IT} \setfont\smallsl\slshape{9}{1000}{OT1} \setfont\smallsf\sfshape{9}{1000}{OT1} \setfont\smallsc\scshape{10}{900}{OT1} \setfont\smallttsl\ttslshape{10}{900}{OT1TT} \font\smalli=cmmi9 \font\smallsy=cmsy9 \def\smallecsize{0900} % Fonts for small examples (8pt). \def\smallernominalsize{8pt} \setfont\smallerrm\rmshape{8}{1000}{OT1} \setfont\smallertt\ttshape{8}{1000}{OT1TT} \setfont\smallerbf\bfshape{10}{800}{OT1} \setfont\smallerit\itshape{8}{1000}{OT1IT} \setfont\smallersl\slshape{8}{1000}{OT1} \setfont\smallersf\sfshape{8}{1000}{OT1} \setfont\smallersc\scshape{10}{800}{OT1} \setfont\smallerttsl\ttslshape{10}{800}{OT1TT} \font\smalleri=cmmi8 \font\smallersy=cmsy8 \def\smallerecsize{0800} % Fonts for title page (20.4pt): \def\titlenominalsize{20pt} \setfont\titlerm\rmbshape{12}{\magstep3}{OT1} \setfont\titleit\itbshape{10}{\magstep4}{OT1IT} \setfont\titlesl\slbshape{10}{\magstep4}{OT1} \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT} \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT} \setfont\titlesf\sfbshape{17}{\magstep1}{OT1} \let\titlebf=\titlerm \setfont\titlesc\scbshape{10}{\magstep4}{OT1} \font\titlei=cmmi12 scaled \magstep3 \font\titlesy=cmsy10 scaled \magstep4 \def\titleecsize{2074} % Chapter fonts (14.4pt). \def\chapnominalsize{14pt} \setfont\chaprm\rmbshape{12}{\magstep1}{OT1} \setfont\chapit\itbshape{10}{\magstep2}{OT1IT} \setfont\chapsl\slbshape{10}{\magstep2}{OT1} \setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT} \setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT} \setfont\chapsf\sfbshape{12}{\magstep1}{OT1} \let\chapbf\chaprm \setfont\chapsc\scbshape{10}{\magstep2}{OT1} \font\chapi=cmmi12 scaled \magstep1 \font\chapsy=cmsy10 scaled \magstep2 \def\chapecsize{1440} % Section fonts (12pt). \def\secnominalsize{12pt} \setfont\secrm\rmbshape{12}{1000}{OT1} \setfont\secit\itbshape{10}{\magstep1}{OT1IT} \setfont\secsl\slbshape{10}{\magstep1}{OT1} \setfont\sectt\ttbshape{12}{1000}{OT1TT} \setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT} \setfont\secsf\sfbshape{12}{1000}{OT1} \let\secbf\secrm \setfont\secsc\scbshape{10}{\magstep1}{OT1} \font\seci=cmmi12 \font\secsy=cmsy10 scaled \magstep1 \def\sececsize{1200} % Subsection fonts (10pt). \def\ssecnominalsize{10pt} \setfont\ssecrm\rmbshape{10}{1000}{OT1} \setfont\ssecit\itbshape{10}{1000}{OT1IT} \setfont\ssecsl\slbshape{10}{1000}{OT1} \setfont\ssectt\ttbshape{10}{1000}{OT1TT} \setfont\ssecttsl\ttslshape{10}{1000}{OT1TT} \setfont\ssecsf\sfbshape{10}{1000}{OT1} \let\ssecbf\ssecrm \setfont\ssecsc\scbshape{10}{1000}{OT1} \font\sseci=cmmi10 \font\ssecsy=cmsy10 \def\ssececsize{1000} % Reduced fonts for @acro in text (9pt). \def\reducednominalsize{9pt} \setfont\reducedrm\rmshape{9}{1000}{OT1} \setfont\reducedtt\ttshape{9}{1000}{OT1TT} \setfont\reducedbf\bfshape{10}{900}{OT1} \setfont\reducedit\itshape{9}{1000}{OT1IT} \setfont\reducedsl\slshape{9}{1000}{OT1} \setfont\reducedsf\sfshape{9}{1000}{OT1} \setfont\reducedsc\scshape{10}{900}{OT1} \setfont\reducedttsl\ttslshape{10}{900}{OT1TT} \font\reducedi=cmmi9 \font\reducedsy=cmsy9 \def\reducedecsize{0900} \divide\parskip by 2 % reduce space between paragraphs \textleading = 12pt % line spacing for 10pt CM \textfonts % reset the current fonts \rm } % end of 10pt text font size definitions % We provide the user-level command % @fonttextsize 10 % (or 11) to redefine the text font size. pt is assumed. % \def\xiword{11} \def\xword{10} \def\xwordpt{10pt} % \parseargdef\fonttextsize{% \def\textsizearg{#1}% %\wlog{doing @fonttextsize \textsizearg}% % % Set \globaldefs so that documents can use this inside @tex, since % makeinfo 4.8 does not support it, but we need it nonetheless. % \begingroup \globaldefs=1 \ifx\textsizearg\xword \definetextfontsizex \else \ifx\textsizearg\xiword \definetextfontsizexi \else \errhelp=\EMsimple \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'} \fi\fi \endgroup } % In order for the font changes to affect most math symbols and letters, % we have to define the \textfont of the standard families. Since % texinfo doesn't allow for producing subscripts and superscripts except % in the main text, we don't bother to reset \scriptfont and % \scriptscriptfont (which would also require loading a lot more fonts). % \def\resetmathfonts{% \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf \textfont\ttfam=\tentt \textfont\sffam=\tensf } % The font-changing commands redefine the meanings of \tenSTYLE, instead % of just \STYLE. We do this because \STYLE needs to also set the % current \fam for math mode. Our \STYLE (e.g., \rm) commands hardwire % \tenSTYLE to set the current font. % % Each font-changing command also sets the names \lsize (one size lower) % and \lllsize (three sizes lower). These relative commands are used in % the LaTeX logo and acronyms. % % This all needs generalizing, badly. % \def\textfonts{% \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl \def\curfontsize{text}% \def\lsize{reduced}\def\lllsize{smaller}% \resetmathfonts \setleading{\textleading}} \def\titlefonts{% \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy \let\tenttsl=\titlettsl \def\curfontsize{title}% \def\lsize{chap}\def\lllsize{subsec}% \resetmathfonts \setleading{27pt}} \def\titlefont#1{{\titlefonts\rmisbold #1}} \def\chapfonts{% \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl \def\curfontsize{chap}% \def\lsize{sec}\def\lllsize{text}% \resetmathfonts \setleading{19pt}} \def\secfonts{% \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl \def\curfontsize{sec}% \def\lsize{subsec}\def\lllsize{reduced}% \resetmathfonts \setleading{16pt}} \def\subsecfonts{% \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl \def\curfontsize{ssec}% \def\lsize{text}\def\lllsize{small}% \resetmathfonts \setleading{15pt}} \let\subsubsecfonts = \subsecfonts \def\reducedfonts{% \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy \let\tenttsl=\reducedttsl \def\curfontsize{reduced}% \def\lsize{small}\def\lllsize{smaller}% \resetmathfonts \setleading{10.5pt}} \def\smallfonts{% \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy \let\tenttsl=\smallttsl \def\curfontsize{small}% \def\lsize{smaller}\def\lllsize{smaller}% \resetmathfonts \setleading{10.5pt}} \def\smallerfonts{% \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy \let\tenttsl=\smallerttsl \def\curfontsize{smaller}% \def\lsize{smaller}\def\lllsize{smaller}% \resetmathfonts \setleading{9.5pt}} % Fonts for short table of contents. \setfont\shortcontrm\rmshape{12}{1000}{OT1} \setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12 \setfont\shortcontsl\slshape{12}{1000}{OT1} \setfont\shortconttt\ttshape{12}{1000}{OT1TT} % Define these just so they can be easily changed for other fonts. \def\angleleft{$\langle$} \def\angleright{$\rangle$} % Set the fonts to use with the @small... environments. \let\smallexamplefonts = \smallfonts % About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample % can fit this many characters: % 8.5x11=86 smallbook=72 a4=90 a5=69 % If we use \scriptfonts (8pt), then we can fit this many characters: % 8.5x11=90+ smallbook=80 a4=90+ a5=77 % For me, subjectively, the few extra characters that fit aren't worth % the additional smallness of 8pt. So I'm making the default 9pt. % % By the way, for comparison, here's what fits with @example (10pt): % 8.5x11=71 smallbook=60 a4=75 a5=58 % --karl, 24jan03. % Set up the default fonts, so we can use them for creating boxes. % \definetextfontsizexi \message{markup,} % Check if we are currently using a typewriter font. Since all the % Computer Modern typewriter fonts have zero interword stretch (and % shrink), and it is reasonable to expect all typewriter fonts to have % this property, we can check that font parameter. % \def\ifmonospace{\ifdim\fontdimen3\font=0pt } % Markup style infrastructure. \defmarkupstylesetup\INITMACRO will % define and register \INITMACRO to be called on markup style changes. % \INITMACRO can check \currentmarkupstyle for the innermost % style and the set of \ifmarkupSTYLE switches for all styles % currently in effect. \newif\ifmarkupvar \newif\ifmarkupsamp \newif\ifmarkupkey %\newif\ifmarkupfile % @file == @samp. %\newif\ifmarkupoption % @option == @samp. \newif\ifmarkupcode \newif\ifmarkupkbd %\newif\ifmarkupenv % @env == @code. %\newif\ifmarkupcommand % @command == @code. \newif\ifmarkuptex % @tex (and part of @math, for now). \newif\ifmarkupexample \newif\ifmarkupverb \newif\ifmarkupverbatim \let\currentmarkupstyle\empty \def\setupmarkupstyle#1{% \csname markup#1true\endcsname \def\currentmarkupstyle{#1}% \markupstylesetup } \let\markupstylesetup\empty \def\defmarkupstylesetup#1{% \expandafter\def\expandafter\markupstylesetup \expandafter{\markupstylesetup #1}% \def#1% } % Markup style setup for left and right quotes. \defmarkupstylesetup\markupsetuplq{% \expandafter\let\expandafter \temp \csname markupsetuplq\currentmarkupstyle\endcsname \ifx\temp\relax \markupsetuplqdefault \else \temp \fi } \defmarkupstylesetup\markupsetuprq{% \expandafter\let\expandafter \temp \csname markupsetuprq\currentmarkupstyle\endcsname \ifx\temp\relax \markupsetuprqdefault \else \temp \fi } { \catcode`\'=\active \catcode`\`=\active \gdef\markupsetuplqdefault{\let`\lq} \gdef\markupsetuprqdefault{\let'\rq} \gdef\markupsetcodequoteleft{\let`\codequoteleft} \gdef\markupsetcodequoteright{\let'\codequoteright} \gdef\markupsetnoligaturesquoteleft{\let`\noligaturesquoteleft} } \let\markupsetuplqcode \markupsetcodequoteleft \let\markupsetuprqcode \markupsetcodequoteright % \let\markupsetuplqexample \markupsetcodequoteleft \let\markupsetuprqexample \markupsetcodequoteright % \let\markupsetuplqsamp \markupsetcodequoteleft \let\markupsetuprqsamp \markupsetcodequoteright % \let\markupsetuplqverb \markupsetcodequoteleft \let\markupsetuprqverb \markupsetcodequoteright % \let\markupsetuplqverbatim \markupsetcodequoteleft \let\markupsetuprqverbatim \markupsetcodequoteright \let\markupsetuplqkbd \markupsetnoligaturesquoteleft % Allow an option to not use regular directed right quote/apostrophe % (char 0x27), but instead the undirected quote from cmtt (char 0x0d). % The undirected quote is ugly, so don't make it the default, but it % works for pasting with more pdf viewers (at least evince), the % lilypond developers report. xpdf does work with the regular 0x27. % \def\codequoteright{% \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax '% \else \char'15 \fi \else \char'15 \fi } % % and a similar option for the left quote char vs. a grave accent. % Modern fonts display ASCII 0x60 as a grave accent, so some people like % the code environments to do likewise. % \def\codequoteleft{% \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax % [Knuth] pp. 380,381,391 % \relax disables Spanish ligatures ?` and !` of \tt font. \relax`% \else \char'22 \fi \else \char'22 \fi } % Commands to set the quote options. % \parseargdef\codequoteundirected{% \def\temp{#1}% \ifx\temp\onword \expandafter\let\csname SETtxicodequoteundirected\endcsname = t% \else\ifx\temp\offword \expandafter\let\csname SETtxicodequoteundirected\endcsname = \relax \else \errhelp = \EMsimple \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}% \fi\fi } % \parseargdef\codequotebacktick{% \def\temp{#1}% \ifx\temp\onword \expandafter\let\csname SETtxicodequotebacktick\endcsname = t% \else\ifx\temp\offword \expandafter\let\csname SETtxicodequotebacktick\endcsname = \relax \else \errhelp = \EMsimple \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}% \fi\fi } % [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font. \def\noligaturesquoteleft{\relax\lq} % Count depth in font-changes, for error checks \newcount\fontdepth \fontdepth=0 % Font commands. % #1 is the font command (\sl or \it), #2 is the text to slant. % If we are in a monospaced environment, however, 1) always use \ttsl, % and 2) do not add an italic correction. \def\dosmartslant#1#2{% \ifusingtt {{\ttsl #2}\let\next=\relax}% {\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}% \next } \def\smartslanted{\dosmartslant\sl} \def\smartitalic{\dosmartslant\it} % Output an italic correction unless \next (presumed to be the following % character) is such as not to need one. \def\smartitaliccorrection{% \ifx\next,% \else\ifx\next-% \else\ifx\next.% \else\ptexslash \fi\fi\fi} % like \smartslanted except unconditionally uses \ttsl, and no ic. % @var is set to this for defun arguments. \def\ttslanted#1{{\ttsl #1}} % @cite is like \smartslanted except unconditionally use \sl. We never want % ttsl for book titles, do we? \def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection} \let\i=\smartitalic \let\slanted=\smartslanted \def\var#1{\smartslanted{#1}} \let\dfn=\smartslanted \let\emph=\smartitalic % Explicit font changes: @r, @sc, undocumented @ii. \def\r#1{{\rm #1}} % roman font \def\sc#1{{\smallcaps#1}} % smallcaps font \def\ii#1{{\it #1}} % italic font % @b, explicit bold. Also @strong. \def\b#1{{\bf #1}} \let\strong=\b % @sansserif, explicit sans. \def\sansserif#1{{\sf #1}} % We can't just use \exhyphenpenalty, because that only has effect at % the end of a paragraph. Restore normal hyphenation at the end of the % group within which \nohyphenation is presumably called. % \def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation} \def\restorehyphenation{\hyphenchar\font = `- } % Set sfcode to normal for the chars that usually have another value. % Can't use plain's \frenchspacing because it uses the `\x notation, and % sometimes \x has an active definition that messes things up. % \catcode`@=11 \def\plainfrenchspacing{% \sfcode\dotChar =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m \def\endofsentencespacefactor{1000}% for @. and friends } \def\plainnonfrenchspacing{% \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000 \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250 \def\endofsentencespacefactor{3000}% for @. and friends } \catcode`@=\other \def\endofsentencespacefactor{3000}% default % @t, explicit typewriter. \def\t#1{% {\tt \rawbackslash \plainfrenchspacing #1}% \null } % @samp. \def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}} % definition of @key that produces a lozenge. Doesn't adjust to text size. %\setfont\keyrm\rmshape{8}{1000}{OT1} %\font\keysy=cmsy9 %\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{% % \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{% % \vbox{\hrule\kern-0.4pt % \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}% % \kern-0.4pt\hrule}% % \kern-.06em\raise0.4pt\hbox{\angleright}}}} % definition of @key with no lozenge. If the current font is already % monospace, don't change it; that way, we respect @kbdinputstyle. But % if it isn't monospace, then use \tt. % \def\key#1{{\setupmarkupstyle{key}% \nohyphenation \ifmonospace\else\tt\fi #1}\null} % ctrl is no longer a Texinfo command. \def\ctrl #1{{\tt \rawbackslash \hat}#1} % @file, @option are the same as @samp. \let\file=\samp \let\option=\samp % @code is a modification of @t, % which makes spaces the same size as normal in the surrounding text. \def\tclose#1{% {% % Change normal interword space to be same as for the current font. \spaceskip = \fontdimen2\font % % Switch to typewriter. \tt % % But `\ ' produces the large typewriter interword space. \def\ {{\spaceskip = 0pt{} }}% % % Turn off hyphenation. \nohyphenation % \rawbackslash \plainfrenchspacing #1% }% \null } % We *must* turn on hyphenation at `-' and `_' in @code. % Otherwise, it is too hard to avoid overfull hboxes % in the Emacs manual, the Library manual, etc. % Unfortunately, TeX uses one parameter (\hyphenchar) to control % both hyphenation at - and hyphenation within words. % We must therefore turn them both off (\tclose does that) % and arrange explicitly to hyphenate at a dash. % -- rms. { \catcode`\-=\active \catcode`\_=\active \catcode`\'=\active \catcode`\`=\active \global\let'=\rq \global\let`=\lq % default definitions % \global\def\code{\begingroup \setupmarkupstyle{code}% % The following should really be moved into \setupmarkupstyle handlers. \catcode\dashChar=\active \catcode\underChar=\active \ifallowcodebreaks \let-\codedash \let_\codeunder \else \let-\realdash \let_\realunder \fi \codex } } \def\codex #1{\tclose{#1}\endgroup} \def\realdash{-} \def\codedash{-\discretionary{}{}{}} \def\codeunder{% % this is all so @math{@code{var_name}+1} can work. In math mode, _ % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.) % will therefore expand the active definition of _, which is us % (inside @code that is), therefore an endless loop. \ifusingtt{\ifmmode \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_. \else\normalunderscore \fi \discretionary{}{}{}}% {\_}% } % An additional complication: the above will allow breaks after, e.g., % each of the four underscores in __typeof__. This is undesirable in % some manuals, especially if they don't have long identifiers in % general. @allowcodebreaks provides a way to control this. % \newif\ifallowcodebreaks \allowcodebreakstrue \def\keywordtrue{true} \def\keywordfalse{false} \parseargdef\allowcodebreaks{% \def\txiarg{#1}% \ifx\txiarg\keywordtrue \allowcodebreakstrue \else\ifx\txiarg\keywordfalse \allowcodebreaksfalse \else \errhelp = \EMsimple \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}% \fi\fi } % @uref (abbreviation for `urlref') takes an optional (comma-separated) % second argument specifying the text to display and an optional third % arg as text to display instead of (rather than in addition to) the url % itself. First (mandatory) arg is the url. % (This \urefnobreak definition isn't used now, leaving it for a while % for comparison.) \def\urefnobreak#1{\dourefnobreak #1,,,\finish} \def\dourefnobreak#1,#2,#3,#4\finish{\begingroup \unsepspaces \pdfurl{#1}% \setbox0 = \hbox{\ignorespaces #3}% \ifdim\wd0 > 0pt \unhbox0 % third arg given, show only that \else \setbox0 = \hbox{\ignorespaces #2}% \ifdim\wd0 > 0pt \ifpdf \unhbox0 % PDF: 2nd arg given, show only it \else \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url \fi \else \code{#1}% only url given, so show it \fi \fi \endlink \endgroup} % This \urefbreak definition is the active one. \def\urefbreak{\begingroup \urefcatcodes \dourefbreak} \let\uref=\urefbreak \def\dourefbreak#1{\urefbreakfinish #1,,,\finish} \def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example \unsepspaces \pdfurl{#1}% \setbox0 = \hbox{\ignorespaces #3}% \ifdim\wd0 > 0pt \unhbox0 % third arg given, show only that \else \setbox0 = \hbox{\ignorespaces #2}% \ifdim\wd0 > 0pt \ifpdf \unhbox0 % PDF: 2nd arg given, show only it \else \unhbox0\ (\urefcode{#1})% DVI: 2nd arg given, show both it and url \fi \else \urefcode{#1}% only url given, so show it \fi \fi \endlink \endgroup} % Allow line breaks around only a few characters (only). \def\urefcatcodes{% \catcode\ampChar=\active \catcode\dotChar=\active \catcode\hashChar=\active \catcode\questChar=\active \catcode\slashChar=\active } { \urefcatcodes % \global\def\urefcode{\begingroup \setupmarkupstyle{code}% \urefcatcodes \let&\urefcodeamp \let.\urefcodedot \let#\urefcodehash \let?\urefcodequest \let/\urefcodeslash \codex } % % By default, they are just regular characters. \global\def&{\normalamp} \global\def.{\normaldot} \global\def#{\normalhash} \global\def?{\normalquest} \global\def/{\normalslash} } % we put a little stretch before and after the breakable chars, to help % line breaking of long url's. The unequal skips make look better in % cmtt at least, especially for dots. \def\urefprestretch{\urefprebreak \hskip0pt plus.13em } \def\urefpoststretch{\urefpostbreak \hskip0pt plus.1em } % \def\urefcodeamp{\urefprestretch \&\urefpoststretch} \def\urefcodedot{\urefprestretch .\urefpoststretch} \def\urefcodehash{\urefprestretch \#\urefpoststretch} \def\urefcodequest{\urefprestretch ?\urefpoststretch} \def\urefcodeslash{\futurelet\next\urefcodeslashfinish} { \catcode`\/=\active \global\def\urefcodeslashfinish{% \urefprestretch \slashChar % Allow line break only after the final / in a sequence of % slashes, to avoid line break between the slashes in http://. \ifx\next/\else \urefpoststretch \fi } } % One more complication: by default we'll break after the special % characters, but some people like to break before the special chars, so % allow that. Also allow no breaking at all, for manual control. % \parseargdef\urefbreakstyle{% \def\txiarg{#1}% \ifx\txiarg\wordnone \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak} \else\ifx\txiarg\wordbefore \def\urefprebreak{\allowbreak}\def\urefpostbreak{\nobreak} \else\ifx\txiarg\wordafter \def\urefprebreak{\nobreak}\def\urefpostbreak{\allowbreak} \else \errhelp = \EMsimple \errmessage{Unknown @urefbreakstyle setting `\txiarg'}% \fi\fi\fi } \def\wordafter{after} \def\wordbefore{before} \def\wordnone{none} \urefbreakstyle after % @url synonym for @uref, since that's how everyone uses it. % \let\url=\uref % rms does not like angle brackets --karl, 17may97. % So now @email is just like @uref, unless we are pdf. % %\def\email#1{\angleleft{\tt #1}\angleright} \ifpdf \def\email#1{\doemail#1,,\finish} \def\doemail#1,#2,#3\finish{\begingroup \unsepspaces \pdfurl{mailto:#1}% \setbox0 = \hbox{\ignorespaces #2}% \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi \endlink \endgroup} \else \let\email=\uref \fi % @kbd is like @code, except that if the argument is just one @key command, % then @kbd has no effect. \def\kbd#1{{\setupmarkupstyle{kbd}\def\look{#1}\expandafter\kbdfoo\look??\par}} % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), % `example' (@kbd uses ttsl only inside of @example and friends), % or `code' (@kbd uses normal tty font always). \parseargdef\kbdinputstyle{% \def\txiarg{#1}% \ifx\txiarg\worddistinct \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% \else\ifx\txiarg\wordexample \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% \else\ifx\txiarg\wordcode \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% \else \errhelp = \EMsimple \errmessage{Unknown @kbdinputstyle setting `\txiarg'}% \fi\fi\fi } \def\worddistinct{distinct} \def\wordexample{example} \def\wordcode{code} % Default is `distinct'. \kbdinputstyle distinct \def\xkey{\key} \def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}% \ifx\one\xkey\ifx\threex\three \key{#2}% \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi} % For @indicateurl, @env, @command quotes seem unnecessary, so use \code. \let\indicateurl=\code \let\env=\code \let\command=\code % @clicksequence{File @click{} Open ...} \def\clicksequence#1{\begingroup #1\endgroup} % @clickstyle @arrow (by default) \parseargdef\clickstyle{\def\click{#1}} \def\click{\arrow} % Typeset a dimension, e.g., `in' or `pt'. The only reason for the % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt. % \def\dmn#1{\thinspace #1} % @l was never documented to mean ``switch to the Lisp font'', % and it is not used as such in any manual I can find. We need it for % Polish suppressed-l. --karl, 22sep96. %\def\l#1{{\li #1}\null} % @acronym for "FBI", "NATO", and the like. % We print this one point size smaller, since it's intended for % all-uppercase. % \def\acronym#1{\doacronym #1,,\finish} \def\doacronym#1,#2,#3\finish{% {\selectfonts\lsize #1}% \def\temp{#2}% \ifx\temp\empty \else \space ({\unsepspaces \ignorespaces \temp \unskip})% \fi } % @abbr for "Comput. J." and the like. % No font change, but don't do end-of-sentence spacing. % \def\abbr#1{\doabbr #1,,\finish} \def\doabbr#1,#2,#3\finish{% {\plainfrenchspacing #1}% \def\temp{#2}% \ifx\temp\empty \else \space ({\unsepspaces \ignorespaces \temp \unskip})% \fi } % @asis just yields its argument. Used with @table, for example. % \def\asis#1{#1} % @math outputs its argument in math mode. % % One complication: _ usually means subscripts, but it could also mean % an actual _ character, as in @math{@var{some_variable} + 1}. So make % _ active, and distinguish by seeing if the current family is \slfam, % which is what @var uses. { \catcode`\_ = \active \gdef\mathunderscore{% \catcode`\_=\active \def_{\ifnum\fam=\slfam \_\else\sb\fi}% } } % Another complication: we want \\ (and @\) to output a math (or tt) \. % FYI, plain.tex uses \\ as a temporary control sequence (for no % particular reason), but this is not advertised and we don't care. % % The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\. \def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi} % \def\math{% \tex \mathunderscore \let\\ = \mathbackslash \mathactive % make the texinfo accent commands work in math mode \let\"=\ddot \let\'=\acute \let\==\bar \let\^=\hat \let\`=\grave \let\u=\breve \let\v=\check \let\~=\tilde \let\dotaccent=\dot $\finishmath } \def\finishmath#1{#1$\endgroup} % Close the group opened by \tex. % Some active characters (such as <) are spaced differently in math. % We have to reset their definitions in case the @math was an argument % to a command which sets the catcodes (such as @item or @section). % { \catcode`^ = \active \catcode`< = \active \catcode`> = \active \catcode`+ = \active \catcode`' = \active \gdef\mathactive{% \let^ = \ptexhat \let< = \ptexless \let> = \ptexgtr \let+ = \ptexplus \let' = \ptexquoteright } } \message{glyphs,} % and logos. % @@ prints an @. \def\@{\char64 } % Used to generate quoted braces. Unless we're in typewriter, use % \ecfont because the CM text fonts do not have braces, and we don't % want to switch into math. \def\mylbrace{{\ifmonospace\else\ecfont\fi \char123}} \def\myrbrace{{\ifmonospace\else\ecfont\fi \char125}} \let\{=\mylbrace \let\}=\myrbrace \begingroup % Definitions to produce \{ and \} commands for indices, % and @{ and @} for the aux/toc files. \catcode`\{ = \other \catcode`\} = \other \catcode`\[ = 1 \catcode`\] = 2 \catcode`\! = 0 \catcode`\\ = \other !gdef!lbracecmd[\{]% !gdef!rbracecmd[\}]% !gdef!lbraceatcmd[@{]% !gdef!rbraceatcmd[@}]% !endgroup % @comma{} to avoid , parsing problems. \let\comma = , % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent % Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H. \let\, = \ptexc \let\dotaccent = \ptexdot \def\ringaccent#1{{\accent23 #1}} \let\tieaccent = \ptext \let\ubaraccent = \ptexb \let\udotaccent = \d % Other special characters: @questiondown @exclamdown @ordf @ordm % Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss. \def\questiondown{?`} \def\exclamdown{!`} \def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}} \def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}} % Dotless i and dotless j, used for accents. \def\imacro{i} \def\jmacro{j} \def\dotless#1{% \def\temp{#1}% \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi \else \errmessage{@dotless can be used only with i or j}% \fi\fi } % The \TeX{} logo, as in plain, but resetting the spacing so that a % period following counts as ending a sentence. (Idea found in latex.) % \edef\TeX{\TeX \spacefactor=1000 } % @LaTeX{} logo. Not quite the same results as the definition in % latex.ltx, since we use a different font for the raised A; it's most % convenient for us to use an explicitly smaller font, rather than using % the \scriptstyle font (since we don't reset \scriptstyle and % \scriptscriptstyle). % \def\LaTeX{% L\kern-.36em {\setbox0=\hbox{T}% \vbox to \ht0{\hbox{% \ifx\textnominalsize\xwordpt % for 10pt running text, \lllsize (8pt) is too small for the A in LaTeX. % Revert to plain's \scriptsize, which is 7pt. \count255=\the\fam $\fam\count255 \scriptstyle A$% \else % For 11pt, we can use our lllsize. \selectfonts\lllsize A% \fi }% \vss }}% \kern-.15em \TeX } % Some math mode symbols. \def\bullet{$\ptexbullet$} \def\geq{\ifmmode \ge\else $\ge$\fi} \def\leq{\ifmmode \le\else $\le$\fi} \def\minus{\ifmmode -\else $-$\fi} % @dots{} outputs an ellipsis using the current font. % We do .5em per period so that it has the same spacing in the cm % typewriter fonts as three actual period characters; on the other hand, % in other typewriter fonts three periods are wider than 1.5em. So do % whichever is larger. % \def\dots{% \leavevmode \setbox0=\hbox{...}% get width of three periods \ifdim\wd0 > 1.5em \dimen0 = \wd0 \else \dimen0 = 1.5em \fi \hbox to \dimen0{% \hskip 0pt plus.25fil .\hskip 0pt plus1fil .\hskip 0pt plus1fil .\hskip 0pt plus.5fil }% } % @enddots{} is an end-of-sentence ellipsis. % \def\enddots{% \dots \spacefactor=\endofsentencespacefactor } % @point{}, @result{}, @expansion{}, @print{}, @equiv{}. % % Since these characters are used in examples, they should be an even number of % \tt widths. Each \tt character is 1en, so two makes it 1em. % \def\point{$\star$} \def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}} \def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}} \def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}} \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}} \def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}} % The @error{} command. % Adapted from the TeXbook's \boxit. % \newbox\errorbox % {\tentt \global\dimen0 = 3em}% Width of the box. \dimen2 = .55pt % Thickness of rules % The text. (`r' is open on the right, `e' somewhat less so on the left.) \setbox0 = \hbox{\kern-.75pt \reducedsf error\kern-1.5pt} % \setbox\errorbox=\hbox to \dimen0{\hfil \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. \advance\hsize by -2\dimen2 % Rules. \vbox{% \hrule height\dimen2 \hbox{\vrule width\dimen2 \kern3pt % Space to left of text. \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below. \kern3pt\vrule width\dimen2}% Space to right. \hrule height\dimen2} \hfil} % \def\error{\leavevmode\lower.7ex\copy\errorbox} % @pounds{} is a sterling sign, which Knuth put in the CM italic font. % \def\pounds{{\it\$}} % @euro{} comes from a separate font, depending on the current style. % We use the free feym* fonts from the eurosym package by Henrik % Theiling, which support regular, slanted, bold and bold slanted (and % "outlined" (blackboard board, sort of) versions, which we don't need). % It is available from http://www.ctan.org/tex-archive/fonts/eurosym. % % Although only regular is the truly official Euro symbol, we ignore % that. The Euro is designed to be slightly taller than the regular % font height. % % feymr - regular % feymo - slanted % feybr - bold % feybo - bold slanted % % There is no good (free) typewriter version, to my knowledge. % A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide. % Hmm. % % Also doesn't work in math. Do we need to do math with euro symbols? % Hope not. % % \def\euro{{\eurofont e}} \def\eurofont{% % We set the font at each command, rather than predefining it in % \textfonts and the other font-switching commands, so that % installations which never need the symbol don't have to have the % font installed. % % There is only one designed size (nominal 10pt), so we always scale % that to the current nominal size. % % By the way, simply using "at 1em" works for cmr10 and the like, but % does not work for cmbx10 and other extended/shrunken fonts. % \def\eurosize{\csname\curfontsize nominalsize\endcsname}% % \ifx\curfontstyle\bfstylename % bold: \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize \else % regular: \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize \fi \thiseurofont } % Glyphs from the EC fonts. We don't use \let for the aliases, because % sometimes we redefine the original macro, and the alias should reflect % the redefinition. % % Use LaTeX names for the Icelandic letters. \def\DH{{\ecfont \char"D0}} % Eth \def\dh{{\ecfont \char"F0}} % eth \def\TH{{\ecfont \char"DE}} % Thorn \def\th{{\ecfont \char"FE}} % thorn % \def\guillemetleft{{\ecfont \char"13}} \def\guillemotleft{\guillemetleft} \def\guillemetright{{\ecfont \char"14}} \def\guillemotright{\guillemetright} \def\guilsinglleft{{\ecfont \char"0E}} \def\guilsinglright{{\ecfont \char"0F}} \def\quotedblbase{{\ecfont \char"12}} \def\quotesinglbase{{\ecfont \char"0D}} % % This positioning is not perfect (see the ogonek LaTeX package), but % we have the precomposed glyphs for the most common cases. We put the % tests to use those glyphs in the single \ogonek macro so we have fewer % dummy definitions to worry about for index entries, etc. % % ogonek is also used with other letters in Lithuanian (IOU), but using % the precomposed glyphs for those is not so easy since they aren't in % the same EC font. \def\ogonek#1{{% \def\temp{#1}% \ifx\temp\macrocharA\Aogonek \else\ifx\temp\macrochara\aogonek \else\ifx\temp\macrocharE\Eogonek \else\ifx\temp\macrochare\eogonek \else \ecfont \setbox0=\hbox{#1}% \ifdim\ht0=1ex\accent"0C #1% \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}% \fi \fi\fi\fi\fi }% } \def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A} \def\aogonek{{\ecfont \char"A1}}\def\macrochara{a} \def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E} \def\eogonek{{\ecfont \char"A6}}\def\macrochare{e} % % Use the ec* fonts (cm-super in outline format) for non-CM glyphs. \def\ecfont{% % We can't distinguish serif/sans and italic/slanted, but this % is used for crude hacks anyway (like adding French and German % quotes to documents typeset with CM, where we lose kerning), so % hopefully nobody will notice/care. \edef\ecsize{\csname\curfontsize ecsize\endcsname}% \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}% \ifx\curfontstyle\bfstylename % bold: \font\thisecfont = ecb\ifusingit{i}{x}\ecsize \space at \nominalsize \else % regular: \font\thisecfont = ec\ifusingit{ti}{rm}\ecsize \space at \nominalsize \fi \thisecfont } % @registeredsymbol - R in a circle. The font for the R should really % be smaller yet, but lllsize is the best we can do for now. % Adapted from the plain.tex definition of \copyright. % \def\registeredsymbol{% $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}% \hfil\crcr\Orb}}% }$% } % @textdegree - the normal degrees sign. % \def\textdegree{$^\circ$} % Laurent Siebenmann reports \Orb undefined with: % Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38 % so we'll define it if necessary. % \ifx\Orb\thisisundefined \def\Orb{\mathhexbox20D} \fi % Quotes. \chardef\quotedblleft="5C \chardef\quotedblright=`\" \chardef\quoteleft=`\` \chardef\quoteright=`\' \message{page headings,} \newskip\titlepagetopglue \titlepagetopglue = 1.5in \newskip\titlepagebottomglue \titlepagebottomglue = 2pc % First the title page. Must do @settitle before @titlepage. \newif\ifseenauthor \newif\iffinishedtitlepage % Do an implicit @contents or @shortcontents after @end titlepage if the % user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage. % \newif\ifsetcontentsaftertitlepage \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue \newif\ifsetshortcontentsaftertitlepage \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue \parseargdef\shorttitlepage{% \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}% \endgroup\page\hbox{}\page} \envdef\titlepage{% % Open one extra group, as we want to close it in the middle of \Etitlepage. \begingroup \parindent=0pt \textfonts % Leave some space at the very top of the page. \vglue\titlepagetopglue % No rule at page bottom unless we print one at the top with @title. \finishedtitlepagetrue % % Most title ``pages'' are actually two pages long, with space % at the top of the second. We don't want the ragged left on the second. \let\oldpage = \page \def\page{% \iffinishedtitlepage\else \finishtitlepage \fi \let\page = \oldpage \page \null }% } \def\Etitlepage{% \iffinishedtitlepage\else \finishtitlepage \fi % It is important to do the page break before ending the group, % because the headline and footline are only empty inside the group. % If we use the new definition of \page, we always get a blank page % after the title page, which we certainly don't want. \oldpage \endgroup % % Need this before the \...aftertitlepage checks so that if they are % in effect the toc pages will come out with page numbers. \HEADINGSon % % If they want short, they certainly want long too. \ifsetshortcontentsaftertitlepage \shortcontents \contents \global\let\shortcontents = \relax \global\let\contents = \relax \fi % \ifsetcontentsaftertitlepage \contents \global\let\contents = \relax \global\let\shortcontents = \relax \fi } \def\finishtitlepage{% \vskip4pt \hrule height 2pt width \hsize \vskip\titlepagebottomglue \finishedtitlepagetrue } % Macros to be used within @titlepage: \let\subtitlerm=\tenrm \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines} \parseargdef\title{% \checkenv\titlepage \leftline{\titlefonts\rmisbold #1} % print a rule at the page bottom also. \finishedtitlepagefalse \vskip4pt \hrule height 4pt width \hsize \vskip4pt } \parseargdef\subtitle{% \checkenv\titlepage {\subtitlefont \rightline{#1}}% } % @author should come last, but may come many times. % It can also be used inside @quotation. % \parseargdef\author{% \def\temp{\quotation}% \ifx\thisenv\temp \def\quotationauthor{#1}% printed in \Equotation. \else \checkenv\titlepage \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi {\secfonts\rmisbold \leftline{#1}}% \fi } % Set up page headings and footings. \let\thispage=\folio \newtoks\evenheadline % headline on even pages \newtoks\oddheadline % headline on odd pages \newtoks\evenfootline % footline on even pages \newtoks\oddfootline % footline on odd pages % Now make TeX use those variables \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline \else \the\evenheadline \fi}} \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline \else \the\evenfootline \fi}\HEADINGShook} \let\HEADINGShook=\relax % Commands to set those variables. % For example, this is what @headings on does % @evenheading @thistitle|@thispage|@thischapter % @oddheading @thischapter|@thispage|@thistitle % @evenfooting @thisfile|| % @oddfooting ||@thisfile \def\evenheading{\parsearg\evenheadingxxx} \def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish} \def\evenheadingyyy #1\|#2\|#3\|#4\finish{% \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} \def\oddheading{\parsearg\oddheadingxxx} \def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish} \def\oddheadingyyy #1\|#2\|#3\|#4\finish{% \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} \parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}% \def\evenfooting{\parsearg\evenfootingxxx} \def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish} \def\evenfootingyyy #1\|#2\|#3\|#4\finish{% \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} \def\oddfooting{\parsearg\oddfootingxxx} \def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish} \def\oddfootingyyy #1\|#2\|#3\|#4\finish{% \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}% % % Leave some space for the footline. Hopefully ok to assume % @evenfooting will not be used by itself. \global\advance\pageheight by -12pt \global\advance\vsize by -12pt } \parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}} % @evenheadingmarks top \thischapter <- chapter at the top of a page % @evenheadingmarks bottom \thischapter <- chapter at the bottom of a page % % The same set of arguments for: % % @oddheadingmarks % @evenfootingmarks % @oddfootingmarks % @everyheadingmarks % @everyfootingmarks \def\evenheadingmarks{\headingmarks{even}{heading}} \def\oddheadingmarks{\headingmarks{odd}{heading}} \def\evenfootingmarks{\headingmarks{even}{footing}} \def\oddfootingmarks{\headingmarks{odd}{footing}} \def\everyheadingmarks#1 {\headingmarks{even}{heading}{#1} \headingmarks{odd}{heading}{#1} } \def\everyfootingmarks#1 {\headingmarks{even}{footing}{#1} \headingmarks{odd}{footing}{#1} } % #1 = even/odd, #2 = heading/footing, #3 = top/bottom. \def\headingmarks#1#2#3 {% \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname \global\expandafter\let\csname get#1#2marks\endcsname \temp } \everyheadingmarks bottom \everyfootingmarks bottom % @headings double turns headings on for double-sided printing. % @headings single turns headings on for single-sided printing. % @headings off turns them off. % @headings on same as @headings double, retained for compatibility. % @headings after turns on double-sided headings after this page. % @headings doubleafter turns on double-sided headings after this page. % @headings singleafter turns on single-sided headings after this page. % By default, they are off at the start of a document, % and turned `on' after @end titlepage. \def\headings #1 {\csname HEADINGS#1\endcsname} \def\headingsoff{% non-global headings elimination \evenheadline={\hfil}\evenfootline={\hfil}% \oddheadline={\hfil}\oddfootline={\hfil}% } \def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting \HEADINGSoff % it's the default % When we turn headings on, set the page number to 1. % For double-sided printing, put current file name in lower left corner, % chapter name on inside top of right hand pages, document % title on inside top of left hand pages, and page numbers on outside top % edge of all pages. \def\HEADINGSdouble{% \global\pageno=1 \global\evenfootline={\hfil} \global\oddfootline={\hfil} \global\evenheadline={\line{\folio\hfil\thistitle}} \global\oddheadline={\line{\thischapter\hfil\folio}} \global\let\contentsalignmacro = \chapoddpage } \let\contentsalignmacro = \chappager % For single-sided printing, chapter title goes across top left of page, % page number on top right. \def\HEADINGSsingle{% \global\pageno=1 \global\evenfootline={\hfil} \global\oddfootline={\hfil} \global\evenheadline={\line{\thischapter\hfil\folio}} \global\oddheadline={\line{\thischapter\hfil\folio}} \global\let\contentsalignmacro = \chappager } \def\HEADINGSon{\HEADINGSdouble} \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex} \let\HEADINGSdoubleafter=\HEADINGSafter \def\HEADINGSdoublex{% \global\evenfootline={\hfil} \global\oddfootline={\hfil} \global\evenheadline={\line{\folio\hfil\thistitle}} \global\oddheadline={\line{\thischapter\hfil\folio}} \global\let\contentsalignmacro = \chapoddpage } \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex} \def\HEADINGSsinglex{% \global\evenfootline={\hfil} \global\oddfootline={\hfil} \global\evenheadline={\line{\thischapter\hfil\folio}} \global\oddheadline={\line{\thischapter\hfil\folio}} \global\let\contentsalignmacro = \chappager } % Subroutines used in generating headings % This produces Day Month Year style of output. % Only define if not already defined, in case a txi-??.tex file has set % up a different format (e.g., txi-cs.tex does this). \ifx\today\thisisundefined \def\today{% \number\day\space \ifcase\month \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec \fi \space\number\year} \fi % @settitle line... specifies the title of the document, for headings. % It generates no output of its own. \def\thistitle{\putwordNoTitle} \def\settitle{\parsearg{\gdef\thistitle}} \message{tables,} % Tables -- @table, @ftable, @vtable, @item(x). % default indentation of table text \newdimen\tableindent \tableindent=.8in % default indentation of @itemize and @enumerate text \newdimen\itemindent \itemindent=.3in % margin between end of table item and start of table text. \newdimen\itemmargin \itemmargin=.1in % used internally for \itemindent minus \itemmargin \newdimen\itemmax % Note @table, @ftable, and @vtable define @item, @itemx, etc., with % these defs. % They also define \itemindex % to index the item name in whatever manner is desired (perhaps none). \newif\ifitemxneedsnegativevskip \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi} \def\internalBitem{\smallbreak \parsearg\itemzzz} \def\internalBitemx{\itemxpar \parsearg\itemzzz} \def\itemzzz #1{\begingroup % \advance\hsize by -\rightskip \advance\hsize by -\tableindent \setbox0=\hbox{\itemindicate{#1}}% \itemindex{#1}% \nobreak % This prevents a break before @itemx. % % If the item text does not fit in the space we have, put it on a line % by itself, and do not allow a page break either before or after that % line. We do not start a paragraph here because then if the next % command is, e.g., @kindex, the whatsit would get put into the % horizontal list on a line by itself, resulting in extra blank space. \ifdim \wd0>\itemmax % % Make this a paragraph so we get the \parskip glue and wrapping, % but leave it ragged-right. \begingroup \advance\leftskip by-\tableindent \advance\hsize by\tableindent \advance\rightskip by0pt plus1fil\relax \leavevmode\unhbox0\par \endgroup % % We're going to be starting a paragraph, but we don't want the % \parskip glue -- logically it's part of the @item we just started. \nobreak \vskip-\parskip % % Stop a page break at the \parskip glue coming up. However, if % what follows is an environment such as @example, there will be no % \parskip glue; then the negative vskip we just inserted would % cause the example and the item to crash together. So we use this % bizarre value of 10001 as a signal to \aboveenvbreak to insert % \parskip glue after all. Section titles are handled this way also. % \penalty 10001 \endgroup \itemxneedsnegativevskipfalse \else % The item text fits into the space. Start a paragraph, so that the % following text (if any) will end up on the same line. \noindent % Do this with kerns and \unhbox so that if there is a footnote in % the item text, it can migrate to the main vertical list and % eventually be printed. \nobreak\kern-\tableindent \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0 \unhbox0 \nobreak\kern\dimen0 \endgroup \itemxneedsnegativevskiptrue \fi } \def\item{\errmessage{@item while not in a list environment}} \def\itemx{\errmessage{@itemx while not in a list environment}} % @table, @ftable, @vtable. \envdef\table{% \let\itemindex\gobble \tablecheck{table}% } \envdef\ftable{% \def\itemindex ##1{\doind {fn}{\code{##1}}}% \tablecheck{ftable}% } \envdef\vtable{% \def\itemindex ##1{\doind {vr}{\code{##1}}}% \tablecheck{vtable}% } \def\tablecheck#1{% \ifnum \the\catcode`\^^M=\active \endgroup \errmessage{This command won't work in this context; perhaps the problem is that we are \inenvironment\thisenv}% \def\next{\doignore{#1}}% \else \let\next\tablex \fi \next } \def\tablex#1{% \def\itemindicate{#1}% \parsearg\tabley } \def\tabley#1{% {% \makevalueexpandable \edef\temp{\noexpand\tablez #1\space\space\space}% \expandafter }\temp \endtablez } \def\tablez #1 #2 #3 #4\endtablez{% \aboveenvbreak \ifnum 0#1>0 \advance \leftskip by #1\mil \fi \ifnum 0#2>0 \tableindent=#2\mil \fi \ifnum 0#3>0 \advance \rightskip by #3\mil \fi \itemmax=\tableindent \advance \itemmax by -\itemmargin \advance \leftskip by \tableindent \exdentamount=\tableindent \parindent = 0pt \parskip = \smallskipamount \ifdim \parskip=0pt \parskip=2pt \fi \let\item = \internalBitem \let\itemx = \internalBitemx } \def\Etable{\endgraf\afterenvbreak} \let\Eftable\Etable \let\Evtable\Etable \let\Eitemize\Etable \let\Eenumerate\Etable % This is the counter used by @enumerate, which is really @itemize \newcount \itemno \envdef\itemize{\parsearg\doitemize} \def\doitemize#1{% \aboveenvbreak \itemmax=\itemindent \advance\itemmax by -\itemmargin \advance\leftskip by \itemindent \exdentamount=\itemindent \parindent=0pt \parskip=\smallskipamount \ifdim\parskip=0pt \parskip=2pt \fi % % Try typesetting the item mark that if the document erroneously says % something like @itemize @samp (intending @table), there's an error % right away at the @itemize. It's not the best error message in the % world, but it's better than leaving it to the @item. This means if % the user wants an empty mark, they have to say @w{} not just @w. \def\itemcontents{#1}% \setbox0 = \hbox{\itemcontents}% % % @itemize with no arg is equivalent to @itemize @bullet. \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi % \let\item=\itemizeitem } % Definition of @item while inside @itemize and @enumerate. % \def\itemizeitem{% \advance\itemno by 1 % for enumerations {\let\par=\endgraf \smallbreak}% reasonable place to break {% % If the document has an @itemize directly after a section title, a % \nobreak will be last on the list, and \sectionheading will have % done a \vskip-\parskip. In that case, we don't want to zero % parskip, or the item text will crash with the heading. On the % other hand, when there is normal text preceding the item (as there % usually is), we do want to zero parskip, or there would be too much % space. In that case, we won't have a \nobreak before. At least % that's the theory. \ifnum\lastpenalty<10000 \parskip=0in \fi \noindent \hbox to 0pt{\hss \itemcontents \kern\itemmargin}% % \vadjust{\penalty 1200}}% not good to break after first line of item. \flushcr } % \splitoff TOKENS\endmark defines \first to be the first token in % TOKENS, and \rest to be the remainder. % \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}% % Allow an optional argument of an uppercase letter, lowercase letter, % or number, to specify the first label in the enumerated list. No % argument is the same as `1'. % \envparseargdef\enumerate{\enumeratey #1 \endenumeratey} \def\enumeratey #1 #2\endenumeratey{% % If we were given no argument, pretend we were given `1'. \def\thearg{#1}% \ifx\thearg\empty \def\thearg{1}\fi % % Detect if the argument is a single token. If so, it might be a % letter. Otherwise, the only valid thing it can be is a number. % (We will always have one token, because of the test we just made. % This is a good thing, since \splitoff doesn't work given nothing at % all -- the first parameter is undelimited.) \expandafter\splitoff\thearg\endmark \ifx\rest\empty % Only one token in the argument. It could still be anything. % A ``lowercase letter'' is one whose \lccode is nonzero. % An ``uppercase letter'' is one whose \lccode is both nonzero, and % not equal to itself. % Otherwise, we assume it's a number. % % We need the \relax at the end of the \ifnum lines to stop TeX from % continuing to look for a . % \ifnum\lccode\expandafter`\thearg=0\relax \numericenumerate % a number (we hope) \else % It's a letter. \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax \lowercaseenumerate % lowercase letter \else \uppercaseenumerate % uppercase letter \fi \fi \else % Multiple tokens in the argument. We hope it's a number. \numericenumerate \fi } % An @enumerate whose labels are integers. The starting integer is % given in \thearg. % \def\numericenumerate{% \itemno = \thearg \startenumeration{\the\itemno}% } % The starting (lowercase) letter is in \thearg. \def\lowercaseenumerate{% \itemno = \expandafter`\thearg \startenumeration{% % Be sure we're not beyond the end of the alphabet. \ifnum\itemno=0 \errmessage{No more lowercase letters in @enumerate; get a bigger alphabet}% \fi \char\lccode\itemno }% } % The starting (uppercase) letter is in \thearg. \def\uppercaseenumerate{% \itemno = \expandafter`\thearg \startenumeration{% % Be sure we're not beyond the end of the alphabet. \ifnum\itemno=0 \errmessage{No more uppercase letters in @enumerate; get a bigger alphabet} \fi \char\uccode\itemno }% } % Call \doitemize, adding a period to the first argument and supplying the % common last two arguments. Also subtract one from the initial value in % \itemno, since @item increments \itemno. % \def\startenumeration#1{% \advance\itemno by -1 \doitemize{#1.}\flushcr } % @alphaenumerate and @capsenumerate are abbreviations for giving an arg % to @enumerate. % \def\alphaenumerate{\enumerate{a}} \def\capsenumerate{\enumerate{A}} \def\Ealphaenumerate{\Eenumerate} \def\Ecapsenumerate{\Eenumerate} % @multitable macros % Amy Hendrickson, 8/18/94, 3/6/96 % % @multitable ... @end multitable will make as many columns as desired. % Contents of each column will wrap at width given in preamble. Width % can be specified either with sample text given in a template line, % or in percent of \hsize, the current width of text on page. % Table can continue over pages but will only break between lines. % To make preamble: % % Either define widths of columns in terms of percent of \hsize: % @multitable @columnfractions .25 .3 .45 % @item ... % % Numbers following @columnfractions are the percent of the total % current hsize to be used for each column. You may use as many % columns as desired. % Or use a template: % @multitable {Column 1 template} {Column 2 template} {Column 3 template} % @item ... % using the widest term desired in each column. % Each new table line starts with @item, each subsequent new column % starts with @tab. Empty columns may be produced by supplying @tab's % with nothing between them for as many times as empty columns are needed, % ie, @tab@tab@tab will produce two empty columns. % @item, @tab do not need to be on their own lines, but it will not hurt % if they are. % Sample multitable: % @multitable {Column 1 template} {Column 2 template} {Column 3 template} % @item first col stuff @tab second col stuff @tab third col % @item % first col stuff % @tab % second col stuff % @tab % third col % @item first col stuff @tab second col stuff % @tab Many paragraphs of text may be used in any column. % % They will wrap at the width determined by the template. % @item@tab@tab This will be in third column. % @end multitable % Default dimensions may be reset by user. % @multitableparskip is vertical space between paragraphs in table. % @multitableparindent is paragraph indent in table. % @multitablecolmargin is horizontal space to be left between columns. % @multitablelinespace is space to leave between table items, baseline % to baseline. % 0pt means it depends on current normal line spacing. % \newskip\multitableparskip \newskip\multitableparindent \newdimen\multitablecolspace \newskip\multitablelinespace \multitableparskip=0pt \multitableparindent=6pt \multitablecolspace=12pt \multitablelinespace=0pt % Macros used to set up halign preamble: % \let\endsetuptable\relax \def\xendsetuptable{\endsetuptable} \let\columnfractions\relax \def\xcolumnfractions{\columnfractions} \newif\ifsetpercent % #1 is the @columnfraction, usually a decimal number like .5, but might % be just 1. We just use it, whatever it is. % \def\pickupwholefraction#1 {% \global\advance\colcount by 1 \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}% \setuptable } \newcount\colcount \def\setuptable#1{% \def\firstarg{#1}% \ifx\firstarg\xendsetuptable \let\go = \relax \else \ifx\firstarg\xcolumnfractions \global\setpercenttrue \else \ifsetpercent \let\go\pickupwholefraction \else \global\advance\colcount by 1 \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a % separator; typically that is always in the input, anyway. \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}% \fi \fi \ifx\go\pickupwholefraction % Put the argument back for the \pickupwholefraction call, so % we'll always have a period there to be parsed. \def\go{\pickupwholefraction#1}% \else \let\go = \setuptable \fi% \fi \go } % multitable-only commands. % % @headitem starts a heading row, which we typeset in bold. % Assignments have to be global since we are inside the implicit group % of an alignment entry. \everycr resets \everytab so we don't have to % undo it ourselves. \def\headitemfont{\b}% for people to use in the template row; not changeable \def\headitem{% \checkenv\multitable \crcr \global\everytab={\bf}% can't use \headitemfont since the parsing differs \the\everytab % for the first item }% % % A \tab used to include \hskip1sp. But then the space in a template % line is not enough. That is bad. So let's go back to just `&' until % we again encounter the problem the 1sp was intended to solve. % --karl, nathan@acm.org, 20apr99. \def\tab{\checkenv\multitable &\the\everytab}% % @multitable ... @end multitable definitions: % \newtoks\everytab % insert after every tab. % \envdef\multitable{% \vskip\parskip \startsavinginserts % % @item within a multitable starts a normal row. % We use \def instead of \let so that if one of the multitable entries % contains an @itemize, we don't choke on the \item (seen as \crcr aka % \endtemplate) expanding \doitemize. \def\item{\crcr}% % \tolerance=9500 \hbadness=9500 \setmultitablespacing \parskip=\multitableparskip \parindent=\multitableparindent \overfullrule=0pt \global\colcount=0 % \everycr = {% \noalign{% \global\everytab={}% \global\colcount=0 % Reset the column counter. % Check for saved footnotes, etc. \checkinserts % Keeps underfull box messages off when table breaks over pages. %\filbreak % Maybe so, but it also creates really weird page breaks when the % table breaks over pages. Wouldn't \vfil be better? Wait until the % problem manifests itself, so it can be fixed for real --karl. }% }% % \parsearg\domultitable } \def\domultitable#1{% % To parse everything between @multitable and @item: \setuptable#1 \endsetuptable % % This preamble sets up a generic column definition, which will % be used as many times as user calls for columns. % \vtop will set a single line and will also let text wrap and % continue for many paragraphs if desired. \halign\bgroup &% \global\advance\colcount by 1 \multistrut \vtop{% % Use the current \colcount to find the correct column width: \hsize=\expandafter\csname col\the\colcount\endcsname % % In order to keep entries from bumping into each other % we will add a \leftskip of \multitablecolspace to all columns after % the first one. % % If a template has been used, we will add \multitablecolspace % to the width of each template entry. % % If the user has set preamble in terms of percent of \hsize we will % use that dimension as the width of the column, and the \leftskip % will keep entries from bumping into each other. Table will start at % left margin and final column will justify at right margin. % % Make sure we don't inherit \rightskip from the outer environment. \rightskip=0pt \ifnum\colcount=1 % The first column will be indented with the surrounding text. \advance\hsize by\leftskip \else \ifsetpercent \else % If user has not set preamble in terms of percent of \hsize % we will advance \hsize by \multitablecolspace. \advance\hsize by \multitablecolspace \fi % In either case we will make \leftskip=\multitablecolspace: \leftskip=\multitablecolspace \fi % Ignoring space at the beginning and end avoids an occasional spurious % blank line, when TeX decides to break the line at the space before the % box from the multistrut, so the strut ends up on a line by itself. % For example: % @multitable @columnfractions .11 .89 % @item @code{#} % @tab Legal holiday which is valid in major parts of the whole country. % Is automatically provided with highlighting sequences respectively % marking characters. \noindent\ignorespaces##\unskip\multistrut }\cr } \def\Emultitable{% \crcr \egroup % end the \halign \global\setpercentfalse } \def\setmultitablespacing{% \def\multistrut{\strut}% just use the standard line spacing % % Compute \multitablelinespace (if not defined by user) for use in % \multitableparskip calculation. We used define \multistrut based on % this, but (ironically) that caused the spacing to be off. % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100. \ifdim\multitablelinespace=0pt \setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip \global\advance\multitablelinespace by-\ht0 \fi % Test to see if parskip is larger than space between lines of % table. If not, do nothing. % If so, set to same dimension as multitablelinespace. \ifdim\multitableparskip>\multitablelinespace \global\multitableparskip=\multitablelinespace \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller %% than skip between lines in the table. \fi% \ifdim\multitableparskip=0pt \global\multitableparskip=\multitablelinespace \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller %% than skip between lines in the table. \fi} \message{conditionals,} % @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext, % @ifnotxml always succeed. They currently do nothing; we don't % attempt to check whether the conditionals are properly nested. But we % have to remember that they are conditionals, so that @end doesn't % attempt to close an environment group. % \def\makecond#1{% \expandafter\let\csname #1\endcsname = \relax \expandafter\let\csname iscond.#1\endcsname = 1 } \makecond{iftex} \makecond{ifnotdocbook} \makecond{ifnothtml} \makecond{ifnotinfo} \makecond{ifnotplaintext} \makecond{ifnotxml} % Ignore @ignore, @ifhtml, @ifinfo, and the like. % \def\direntry{\doignore{direntry}} \def\documentdescription{\doignore{documentdescription}} \def\docbook{\doignore{docbook}} \def\html{\doignore{html}} \def\ifdocbook{\doignore{ifdocbook}} \def\ifhtml{\doignore{ifhtml}} \def\ifinfo{\doignore{ifinfo}} \def\ifnottex{\doignore{ifnottex}} \def\ifplaintext{\doignore{ifplaintext}} \def\ifxml{\doignore{ifxml}} \def\ignore{\doignore{ignore}} \def\menu{\doignore{menu}} \def\xml{\doignore{xml}} % Ignore text until a line `@end #1', keeping track of nested conditionals. % % A count to remember the depth of nesting. \newcount\doignorecount \def\doignore#1{\begingroup % Scan in ``verbatim'' mode: \obeylines \catcode`\@ = \other \catcode`\{ = \other \catcode`\} = \other % % Make sure that spaces turn into tokens that match what \doignoretext wants. \spaceisspace % % Count number of #1's that we've seen. \doignorecount = 0 % % Swallow text until we reach the matching `@end #1'. \dodoignore{#1}% } { \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source. \obeylines % % \gdef\dodoignore#1{% % #1 contains the command name as a string, e.g., `ifinfo'. % % Define a command to find the next `@end #1'. \long\def\doignoretext##1^^M@end #1{% \doignoretextyyy##1^^M@#1\_STOP_}% % % And this command to find another #1 command, at the beginning of a % line. (Otherwise, we would consider a line `@c @ifset', for % example, to count as an @ifset for nesting.) \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}% % % And now expand that command. \doignoretext ^^M% }% } \def\doignoreyyy#1{% \def\temp{#1}% \ifx\temp\empty % Nothing found. \let\next\doignoretextzzz \else % Found a nested condition, ... \advance\doignorecount by 1 \let\next\doignoretextyyy % ..., look for another. % If we're here, #1 ends with ^^M\ifinfo (for example). \fi \next #1% the token \_STOP_ is present just after this macro. } % We have to swallow the remaining "\_STOP_". % \def\doignoretextzzz#1{% \ifnum\doignorecount = 0 % We have just found the outermost @end. \let\next\enddoignore \else % Still inside a nested condition. \advance\doignorecount by -1 \let\next\doignoretext % Look for the next @end. \fi \next } % Finish off ignored text. { \obeylines% % Ignore anything after the last `@end #1'; this matters in verbatim % environments, where otherwise the newline after an ignored conditional % would result in a blank line in the output. \gdef\enddoignore#1^^M{\endgroup\ignorespaces}% } % @set VAR sets the variable VAR to an empty value. % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE. % % Since we want to separate VAR from REST-OF-LINE (which might be % empty), we can't just use \parsearg; we have to insert a space of our % own to delimit the rest of the line, and then take it out again if we % didn't need it. % We rely on the fact that \parsearg sets \catcode`\ =10. % \parseargdef\set{\setyyy#1 \endsetyyy} \def\setyyy#1 #2\endsetyyy{% {% \makevalueexpandable \def\temp{#2}% \edef\next{\gdef\makecsname{SET#1}}% \ifx\temp\empty \next{}% \else \setzzz#2\endsetzzz \fi }% } % Remove the trailing space \setxxx inserted. \def\setzzz#1 \endsetzzz{\next{#1}} % @clear VAR clears (i.e., unsets) the variable VAR. % \parseargdef\clear{% {% \makevalueexpandable \global\expandafter\let\csname SET#1\endcsname=\relax }% } % @value{foo} gets the text saved in variable foo. \def\value{\begingroup\makevalueexpandable\valuexxx} \def\valuexxx#1{\expandablevalue{#1}\endgroup} { \catcode`\- = \active \catcode`\_ = \active % \gdef\makevalueexpandable{% \let\value = \expandablevalue % We don't want these characters active, ... \catcode`\-=\other \catcode`\_=\other % ..., but we might end up with active ones in the argument if % we're called from @code, as @code{@value{foo-bar_}}, though. % So \let them to their normal equivalents. \let-\realdash \let_\normalunderscore } } % We have this subroutine so that we can handle at least some @value's % properly in indexes (we call \makevalueexpandable in \indexdummies). % The command has to be fully expandable (if the variable is set), since % the result winds up in the index file. This means that if the % variable's value contains other Texinfo commands, it's almost certain % it will fail (although perhaps we could fix that with sufficient work % to do a one-level expansion on the result, instead of complete). % \def\expandablevalue#1{% \expandafter\ifx\csname SET#1\endcsname\relax {[No value for ``#1'']}% \message{Variable `#1', used in @value, is not set.}% \else \csname SET#1\endcsname \fi } % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined % with @set. % % To get special treatment of `@end ifset,' call \makeond and the redefine. % \makecond{ifset} \def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}} \def\doifset#1#2{% {% \makevalueexpandable \let\next=\empty \expandafter\ifx\csname SET#2\endcsname\relax #1% If not set, redefine \next. \fi \expandafter }\next } \def\ifsetfail{\doignore{ifset}} % @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been % defined with @set, or has been undefined with @clear. % % The `\else' inside the `\doifset' parameter is a trick to reuse the % above code: if the variable is not set, do nothing, if it is set, % then redefine \next to \ifclearfail. % \makecond{ifclear} \def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}} \def\ifclearfail{\doignore{ifclear}} % @dircategory CATEGORY -- specify a category of the dir file % which this file should belong to. Ignore this in TeX. \let\dircategory=\comment % @defininfoenclose. \let\definfoenclose=\comment \message{indexing,} % Index generation facilities % Define \newwrite to be identical to plain tex's \newwrite % except not \outer, so it can be used within macros and \if's. \edef\newwrite{\makecsname{ptexnewwrite}} % \newindex {foo} defines an index named foo. % It automatically defines \fooindex such that % \fooindex ...rest of line... puts an entry in the index foo. % It also defines \fooindfile to be the number of the output channel for % the file that accumulates this index. The file's extension is foo. % The name of an index should be no more than 2 characters long % for the sake of vms. % \def\newindex#1{% \iflinks \expandafter\newwrite \csname#1indfile\endcsname \openout \csname#1indfile\endcsname \jobname.#1 % Open the file \fi \expandafter\xdef\csname#1index\endcsname{% % Define @#1index \noexpand\doindex{#1}} } % @defindex foo == \newindex{foo} % \def\defindex{\parsearg\newindex} % Define @defcodeindex, like @defindex except put all entries in @code. % \def\defcodeindex{\parsearg\newcodeindex} % \def\newcodeindex#1{% \iflinks \expandafter\newwrite \csname#1indfile\endcsname \openout \csname#1indfile\endcsname \jobname.#1 \fi \expandafter\xdef\csname#1index\endcsname{% \noexpand\docodeindex{#1}}% } % @synindex foo bar makes index foo feed into index bar. % Do this instead of @defindex foo if you don't want it as a separate index. % % @syncodeindex foo bar similar, but put all entries made for index foo % inside @code. % \def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}} \def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}} % #1 is \doindex or \docodeindex, #2 the index getting redefined (foo), % #3 the target index (bar). \def\dosynindex#1#2#3{% % Only do \closeout if we haven't already done it, else we'll end up % closing the target index. \expandafter \ifx\csname donesynindex#2\endcsname \relax % The \closeout helps reduce unnecessary open files; the limit on the % Acorn RISC OS is a mere 16 files. \expandafter\closeout\csname#2indfile\endcsname \expandafter\let\csname donesynindex#2\endcsname = 1 \fi % redefine \fooindfile: \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname \expandafter\let\csname#2indfile\endcsname=\temp % redefine \fooindex: \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}% } % Define \doindex, the driver for all \fooindex macros. % Argument #1 is generated by the calling \fooindex macro, % and it is "foo", the name of the index. % \doindex just uses \parsearg; it calls \doind for the actual work. % This is because \doind is more useful to call from other macros. % There is also \dosubind {index}{topic}{subtopic} % which makes an entry in a two-level index such as the operation index. \def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer} \def\singleindexer #1{\doind{\indexname}{#1}} % like the previous two, but they put @code around the argument. \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer} \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}} % Take care of Texinfo commands that can appear in an index entry. % Since there are some commands we want to expand, and others we don't, % we have to laboriously prevent expansion for those that we don't. % \def\indexdummies{% \escapechar = `\\ % use backslash in output files. \def\@{@}% change to @@ when we switch to @ as escape char in index files. \def\ {\realbackslash\space }% % % Need these unexpandable (because we define \tt as a dummy) % definitions when @{ or @} appear in index entry text. Also, more % complicated, when \tex is in effect and \{ is a \delimiter again. % We can't use \lbracecmd and \rbracecmd because texindex assumes % braces and backslashes are used only as delimiters. Perhaps we % should define @lbrace and @rbrace commands a la @comma. \def\{{{\tt\char123}}% \def\}{{\tt\char125}}% % % I don't entirely understand this, but when an index entry is % generated from a macro call, the \endinput which \scanmacro inserts % causes processing to be prematurely terminated. This is, % apparently, because \indexsorttmp is fully expanded, and \endinput % is an expandable command. The redefinition below makes \endinput % disappear altogether for that purpose -- although logging shows that % processing continues to some further point. On the other hand, it % seems \endinput does not hurt in the printed index arg, since that % is still getting written without apparent harm. % % Sample source (mac-idx3.tex, reported by Graham Percival to % help-texinfo, 22may06): % @macro funindex {WORD} % @findex xyz % @end macro % ... % @funindex commtest % % The above is not enough to reproduce the bug, but it gives the flavor. % % Sample whatsit resulting: % .@write3{\entry{xyz}{@folio }{@code {xyz@endinput }}} % % So: \let\endinput = \empty % % Do the redefinitions. \commondummies } % For the aux and toc files, @ is the escape character. So we want to % redefine everything using @ as the escape character (instead of % \realbackslash, still used for index files). When everything uses @, % this will be simpler. % \def\atdummies{% \def\@{@@}% \def\ {@ }% \let\{ = \lbraceatcmd \let\} = \rbraceatcmd % % Do the redefinitions. \commondummies \otherbackslash } % Called from \indexdummies and \atdummies. % \def\commondummies{% % % \definedummyword defines \#1 as \string\#1\space, thus effectively % preventing its expansion. This is used only for control words, % not control letters, because the \space would be incorrect for % control characters, but is needed to separate the control word % from whatever follows. % % For control letters, we have \definedummyletter, which omits the % space. % % These can be used both for control words that take an argument and % those that do not. If it is followed by {arg} in the input, then % that will dutifully get written to the index (or wherever). % \def\definedummyword ##1{\def##1{\string##1\space}}% \def\definedummyletter##1{\def##1{\string##1}}% \let\definedummyaccent\definedummyletter % \commondummiesnofonts % \definedummyletter\_% \definedummyletter\-% % % Non-English letters. \definedummyword\AA \definedummyword\AE \definedummyword\DH \definedummyword\L \definedummyword\O \definedummyword\OE \definedummyword\TH \definedummyword\aa \definedummyword\ae \definedummyword\dh \definedummyword\exclamdown \definedummyword\l \definedummyword\o \definedummyword\oe \definedummyword\ordf \definedummyword\ordm \definedummyword\questiondown \definedummyword\ss \definedummyword\th % % Although these internal commands shouldn't show up, sometimes they do. \definedummyword\bf \definedummyword\gtr \definedummyword\hat \definedummyword\less \definedummyword\sf \definedummyword\sl \definedummyword\tclose \definedummyword\tt % \definedummyword\LaTeX \definedummyword\TeX % % Assorted special characters. \definedummyword\arrow \definedummyword\bullet \definedummyword\comma \definedummyword\copyright \definedummyword\registeredsymbol \definedummyword\dots \definedummyword\enddots \definedummyword\entrybreak \definedummyword\equiv \definedummyword\error \definedummyword\euro \definedummyword\expansion \definedummyword\geq \definedummyword\guillemetleft \definedummyword\guillemetright \definedummyword\guilsinglleft \definedummyword\guilsinglright \definedummyword\leq \definedummyword\minus \definedummyword\ogonek \definedummyword\pounds \definedummyword\point \definedummyword\print \definedummyword\quotedblbase \definedummyword\quotedblleft \definedummyword\quotedblright \definedummyword\quoteleft \definedummyword\quoteright \definedummyword\quotesinglbase \definedummyword\result \definedummyword\textdegree % % We want to disable all macros so that they are not expanded by \write. \macrolist % \normalturnoffactive % % Handle some cases of @value -- where it does not contain any % (non-fully-expandable) commands. \makevalueexpandable } % \commondummiesnofonts: common to \commondummies and \indexnofonts. % \def\commondummiesnofonts{% % Control letters and accents. \definedummyletter\!% \definedummyaccent\"% \definedummyaccent\'% \definedummyletter\*% \definedummyaccent\,% \definedummyletter\.% \definedummyletter\/% \definedummyletter\:% \definedummyaccent\=% \definedummyletter\?% \definedummyaccent\^% \definedummyaccent\`% \definedummyaccent\~% \definedummyword\u \definedummyword\v \definedummyword\H \definedummyword\dotaccent \definedummyword\ogonek \definedummyword\ringaccent \definedummyword\tieaccent \definedummyword\ubaraccent \definedummyword\udotaccent \definedummyword\dotless % % Texinfo font commands. \definedummyword\b \definedummyword\i \definedummyword\r \definedummyword\sansserif \definedummyword\sc \definedummyword\slanted \definedummyword\t % % Commands that take arguments. \definedummyword\acronym \definedummyword\cite \definedummyword\code \definedummyword\command \definedummyword\dfn \definedummyword\dmn \definedummyword\email \definedummyword\emph \definedummyword\env \definedummyword\file \definedummyword\indicateurl \definedummyword\kbd \definedummyword\key \definedummyword\math \definedummyword\option \definedummyword\pxref \definedummyword\ref \definedummyword\samp \definedummyword\strong \definedummyword\tie \definedummyword\uref \definedummyword\url \definedummyword\var \definedummyword\verb \definedummyword\w \definedummyword\xref } % \indexnofonts is used when outputting the strings to sort the index % by, and when constructing control sequence names. It eliminates all % control sequences and just writes whatever the best ASCII sort string % would be for a given command (usually its argument). % \def\indexnofonts{% % Accent commands should become @asis. \def\definedummyaccent##1{\let##1\asis}% % We can just ignore other control letters. \def\definedummyletter##1{\let##1\empty}% % All control words become @asis by default; overrides below. \let\definedummyword\definedummyaccent % \commondummiesnofonts % % Don't no-op \tt, since it isn't a user-level command % and is used in the definitions of the active chars like <, >, |, etc. % Likewise with the other plain tex font commands. %\let\tt=\asis % \def\ { }% \def\@{@}% \def\_{\normalunderscore}% \def\-{}% @- shouldn't affect sorting % % Unfortunately, texindex is not prepared to handle braces in the % content at all. So for index sorting, we map @{ and @} to strings % starting with |, since that ASCII character is between ASCII { and }. \def\{{|a}% \def\}{|b}% % % Non-English letters. \def\AA{AA}% \def\AE{AE}% \def\DH{DZZ}% \def\L{L}% \def\OE{OE}% \def\O{O}% \def\TH{ZZZ}% \def\aa{aa}% \def\ae{ae}% \def\dh{dzz}% \def\exclamdown{!}% \def\l{l}% \def\oe{oe}% \def\ordf{a}% \def\ordm{o}% \def\o{o}% \def\questiondown{?}% \def\ss{ss}% \def\th{zzz}% % \def\LaTeX{LaTeX}% \def\TeX{TeX}% % % Assorted special characters. % (The following {} will end up in the sort string, but that's ok.) \def\arrow{->}% \def\bullet{bullet}% \def\comma{,}% \def\copyright{copyright}% \def\dots{...}% \def\enddots{...}% \def\equiv{==}% \def\error{error}% \def\euro{euro}% \def\expansion{==>}% \def\geq{>=}% \def\guillemetleft{<<}% \def\guillemetright{>>}% \def\guilsinglleft{<}% \def\guilsinglright{>}% \def\leq{<=}% \def\minus{-}% \def\point{.}% \def\pounds{pounds}% \def\print{-|}% \def\quotedblbase{"}% \def\quotedblleft{"}% \def\quotedblright{"}% \def\quoteleft{`}% \def\quoteright{'}% \def\quotesinglbase{,}% \def\registeredsymbol{R}% \def\result{=>}% \def\textdegree{o}% % \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax \else \indexlquoteignore \fi % % We need to get rid of all macros, leaving only the arguments (if present). % Of course this is not nearly correct, but it is the best we can do for now. % makeinfo does not expand macros in the argument to @deffn, which ends up % writing an index entry, and texindex isn't prepared for an index sort entry % that starts with \. % % Since macro invocations are followed by braces, we can just redefine them % to take a single TeX argument. The case of a macro invocation that % goes to end-of-line is not handled. % \macrolist } % Undocumented (for FSFS 2nd ed.): @set txiindexlquoteignore makes us % ignore left quotes in the sort term. {\catcode`\`=\active \gdef\indexlquoteignore{\let`=\empty}} \let\indexbackslash=0 %overridden during \printindex. \let\SETmarginindex=\relax % put index entries in margin (undocumented)? % Most index entries go through here, but \dosubind is the general case. % #1 is the index name, #2 is the entry text. \def\doind#1#2{\dosubind{#1}{#2}{}} % Workhorse for all \fooindexes. % #1 is name of index, #2 is stuff to put there, #3 is subentry -- % empty if called from \doind, as we usually are (the main exception % is with most defuns, which call us directly). % \def\dosubind#1#2#3{% \iflinks {% % Store the main index entry text (including the third arg). \toks0 = {#2}% % If third arg is present, precede it with a space. \def\thirdarg{#3}% \ifx\thirdarg\empty \else \toks0 = \expandafter{\the\toks0 \space #3}% \fi % \edef\writeto{\csname#1indfile\endcsname}% % \safewhatsit\dosubindwrite }% \fi } % Write the entry in \toks0 to the index file: % \def\dosubindwrite{% % Put the index entry in the margin if desired. \ifx\SETmarginindex\relax\else \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}% \fi % % Remember, we are within a group. \indexdummies % Must do this here, since \bf, etc expand at this stage \def\backslashcurfont{\indexbackslash}% \indexbackslash isn't defined now % so it will be output as is; and it will print as backslash. % % Process the index entry with all font commands turned off, to % get the string to sort by. {\indexnofonts \edef\temp{\the\toks0}% need full expansion \xdef\indexsorttmp{\temp}% }% % % Set up the complete index entry, with both the sort key and % the original text, including any font commands. We write % three arguments to \entry to the .?? file (four in the % subentry case), texindex reduces to two when writing the .??s % sorted result. \edef\temp{% \write\writeto{% \string\entry{\indexsorttmp}{\noexpand\folio}{\the\toks0}}% }% \temp } % Take care of unwanted page breaks/skips around a whatsit: % % If a skip is the last thing on the list now, preserve it % by backing up by \lastskip, doing the \write, then inserting % the skip again. Otherwise, the whatsit generated by the % \write or \pdfdest will make \lastskip zero. The result is that % sequences like this: % @end defun % @tindex whatever % @defun ... % will have extra space inserted, because the \medbreak in the % start of the @defun won't see the skip inserted by the @end of % the previous defun. % % But don't do any of this if we're not in vertical mode. We % don't want to do a \vskip and prematurely end a paragraph. % % Avoid page breaks due to these extra skips, too. % % But wait, there is a catch there: % We'll have to check whether \lastskip is zero skip. \ifdim is not % sufficient for this purpose, as it ignores stretch and shrink parts % of the skip. The only way seems to be to check the textual % representation of the skip. % % The following is almost like \def\zeroskipmacro{0.0pt} except that % the ``p'' and ``t'' characters have catcode \other, not 11 (letter). % \edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname} % \newskip\whatsitskip \newcount\whatsitpenalty % % ..., ready, GO: % \def\safewhatsit#1{% \ifhmode #1% \else % \lastskip and \lastpenalty cannot both be nonzero simultaneously. \whatsitskip = \lastskip \edef\lastskipmacro{\the\lastskip}% \whatsitpenalty = \lastpenalty % % If \lastskip is nonzero, that means the last item was a % skip. And since a skip is discardable, that means this % -\whatsitskip glue we're inserting is preceded by a % non-discardable item, therefore it is not a potential % breakpoint, therefore no \nobreak needed. \ifx\lastskipmacro\zeroskipmacro \else \vskip-\whatsitskip \fi % #1% % \ifx\lastskipmacro\zeroskipmacro % If \lastskip was zero, perhaps the last item was a penalty, and % perhaps it was >=10000, e.g., a \nobreak. In that case, we want % to re-insert the same penalty (values >10000 are used for various % signals); since we just inserted a non-discardable item, any % following glue (such as a \parskip) would be a breakpoint. For example: % % @deffn deffn-whatever % @vindex index-whatever % Description. % would allow a break between the index-whatever whatsit % and the "Description." paragraph. \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi \else % On the other hand, if we had a nonzero \lastskip, % this make-up glue would be preceded by a non-discardable item % (the whatsit from the \write), so we must insert a \nobreak. \nobreak\vskip\whatsitskip \fi \fi } % The index entry written in the file actually looks like % \entry {sortstring}{page}{topic} % or % \entry {sortstring}{page}{topic}{subtopic} % The texindex program reads in these files and writes files % containing these kinds of lines: % \initial {c} % before the first topic whose initial is c % \entry {topic}{pagelist} % for a topic that is used without subtopics % \primary {topic} % for the beginning of a topic that is used with subtopics % \secondary {subtopic}{pagelist} % for each subtopic. % Define the user-accessible indexing commands % @findex, @vindex, @kindex, @cindex. \def\findex {\fnindex} \def\kindex {\kyindex} \def\cindex {\cpindex} \def\vindex {\vrindex} \def\tindex {\tpindex} \def\pindex {\pgindex} \def\cindexsub {\begingroup\obeylines\cindexsub} {\obeylines % \gdef\cindexsub "#1" #2^^M{\endgroup % \dosubind{cp}{#2}{#1}}} % Define the macros used in formatting output of the sorted index material. % @printindex causes a particular index (the ??s file) to get printed. % It does not print any chapter heading (usually an @unnumbered). % \parseargdef\printindex{\begingroup \dobreak \chapheadingskip{10000}% % \smallfonts \rm \tolerance = 9500 \plainfrenchspacing \everypar = {}% don't want the \kern\-parindent from indentation suppression. % % See if the index file exists and is nonempty. % Change catcode of @ here so that if the index file contains % \initial {@} % as its first line, TeX doesn't complain about mismatched braces % (because it thinks @} is a control sequence). \catcode`\@ = 11 \openin 1 \jobname.#1s \ifeof 1 % \enddoublecolumns gets confused if there is no text in the index, % and it loses the chapter title and the aux file entries for the % index. The easiest way to prevent this problem is to make sure % there is some text. \putwordIndexNonexistent \else % % If the index file exists but is empty, then \openin leaves \ifeof % false. We have to make TeX try to read something from the file, so % it can discover if there is anything in it. \read 1 to \temp \ifeof 1 \putwordIndexIsEmpty \else % Index files are almost Texinfo source, but we use \ as the escape % character. It would be better to use @, but that's too big a change % to make right now. \def\indexbackslash{\backslashcurfont}% \catcode`\\ = 0 \escapechar = `\\ \begindoublecolumns \input \jobname.#1s \enddoublecolumns \fi \fi \closein 1 \endgroup} % These macros are used by the sorted index file itself. % Change them to control the appearance of the index. \def\initial#1{{% % Some minor font changes for the special characters. \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt % % Remove any glue we may have, we'll be inserting our own. \removelastskip % % We like breaks before the index initials, so insert a bonus. \nobreak \vskip 0pt plus 3\baselineskip \penalty 0 \vskip 0pt plus -3\baselineskip % % Typeset the initial. Making this add up to a whole number of % baselineskips increases the chance of the dots lining up from column % to column. It still won't often be perfect, because of the stretch % we need before each entry, but it's better. % % No shrink because it confuses \balancecolumns. \vskip 1.67\baselineskip plus .5\baselineskip \leftline{\secbf #1}% % Do our best not to break after the initial. \nobreak \vskip .33\baselineskip plus .1\baselineskip }} % \entry typesets a paragraph consisting of the text (#1), dot leaders, and % then page number (#2) flushed to the right margin. It is used for index % and table of contents entries. The paragraph is indented by \leftskip. % % A straightforward implementation would start like this: % \def\entry#1#2{... % But this freezes the catcodes in the argument, and can cause problems to % @code, which sets - active. This problem was fixed by a kludge--- % ``-'' was active throughout whole index, but this isn't really right. % The right solution is to prevent \entry from swallowing the whole text. % --kasal, 21nov03 \def\entry{% \begingroup % % Start a new paragraph if necessary, so our assignments below can't % affect previous text. \par % % Do not fill out the last line with white space. \parfillskip = 0in % % No extra space above this paragraph. \parskip = 0in % % Do not prefer a separate line ending with a hyphen to fewer lines. \finalhyphendemerits = 0 % % \hangindent is only relevant when the entry text and page number % don't both fit on one line. In that case, bob suggests starting the % dots pretty far over on the line. Unfortunately, a large % indentation looks wrong when the entry text itself is broken across % lines. So we use a small indentation and put up with long leaders. % % \hangafter is reset to 1 (which is the value we want) at the start % of each paragraph, so we need not do anything with that. \hangindent = 2em % % When the entry text needs to be broken, just fill out the first line % with blank space. \rightskip = 0pt plus1fil % % A bit of stretch before each entry for the benefit of balancing % columns. \vskip 0pt plus1pt % % When reading the text of entry, convert explicit line breaks % from @* into spaces. The user might give these in long section % titles, for instance. \def\*{\unskip\space\ignorespaces}% \def\entrybreak{\hfil\break}% % % Swallow the left brace of the text (first parameter): \afterassignment\doentry \let\temp = } \def\entrybreak{\unskip\space\ignorespaces}% \def\doentry{% \bgroup % Instead of the swallowed brace. \noindent \aftergroup\finishentry % And now comes the text of the entry. } \def\finishentry#1{% % #1 is the page number. % % The following is kludged to not output a line of dots in the index if % there are no page numbers. The next person who breaks this will be % cursed by a Unix daemon. \setbox\boxA = \hbox{#1}% \ifdim\wd\boxA = 0pt \ % \else % % If we must, put the page number on a line of its own, and fill out % this line with blank space. (The \hfil is overwhelmed with the % fill leaders glue in \indexdotfill if the page number does fit.) \hfil\penalty50 \null\nobreak\indexdotfill % Have leaders before the page number. % % The `\ ' here is removed by the implicit \unskip that TeX does as % part of (the primitive) \par. Without it, a spurious underfull % \hbox ensues. \ifpdf \pdfgettoks#1.% \ \the\toksA \else \ #1% \fi \fi \par \endgroup } % Like plain.tex's \dotfill, except uses up at least 1 em. \def\indexdotfill{\cleaders \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1fill} \def\primary #1{\line{#1\hfil}} \newskip\secondaryindent \secondaryindent=0.5cm \def\secondary#1#2{{% \parfillskip=0in \parskip=0in \hangindent=1in \hangafter=1 \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill \ifpdf \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph. \else #2 \fi \par }} % Define two-column mode, which we use to typeset indexes. % Adapted from the TeXbook, page 416, which is to say, % the manmac.tex format used to print the TeXbook itself. \catcode`\@=11 \newbox\partialpage \newdimen\doublecolumnhsize \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns % Grab any single-column material above us. \output = {% % % Here is a possibility not foreseen in manmac: if we accumulate a % whole lot of material, we might end up calling this \output % routine twice in a row (see the doublecol-lose test, which is % essentially a couple of indexes with @setchapternewpage off). In % that case we just ship out what is in \partialpage with the normal % output routine. Generally, \partialpage will be empty when this % runs and this will be a no-op. See the indexspread.tex test case. \ifvoid\partialpage \else \onepageout{\pagecontents\partialpage}% \fi % \global\setbox\partialpage = \vbox{% % Unvbox the main output page. \unvbox\PAGE \kern-\topskip \kern\baselineskip }% }% \eject % run that output routine to set \partialpage % % Use the double-column output routine for subsequent pages. \output = {\doublecolumnout}% % % Change the page size parameters. We could do this once outside this % routine, in each of @smallbook, @afourpaper, and the default 8.5x11 % format, but then we repeat the same computation. Repeating a couple % of assignments once per index is clearly meaningless for the % execution time, so we may as well do it in one place. % % First we halve the line length, less a little for the gutter between % the columns. We compute the gutter based on the line length, so it % changes automatically with the paper format. The magic constant % below is chosen so that the gutter has the same value (well, +-<1pt) % as it did when we hard-coded it. % % We put the result in a separate register, \doublecolumhsize, so we % can restore it in \pagesofar, after \hsize itself has (potentially) % been clobbered. % \doublecolumnhsize = \hsize \advance\doublecolumnhsize by -.04154\hsize \divide\doublecolumnhsize by 2 \hsize = \doublecolumnhsize % % Double the \vsize as well. (We don't need a separate register here, % since nobody clobbers \vsize.) \vsize = 2\vsize } % The double-column output routine for all double-column pages except % the last. % \def\doublecolumnout{% \splittopskip=\topskip \splitmaxdepth=\maxdepth % Get the available space for the double columns -- the normal % (undoubled) page height minus any material left over from the % previous page. \dimen@ = \vsize \divide\dimen@ by 2 \advance\dimen@ by -\ht\partialpage % % box0 will be the left-hand column, box2 the right. \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@ \onepageout\pagesofar \unvbox255 \penalty\outputpenalty } % % Re-output the contents of the output page -- any previous material, % followed by the two boxes we just split, in box0 and box2. \def\pagesofar{% \unvbox\partialpage % \hsize = \doublecolumnhsize \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}% } % % All done with double columns. \def\enddoublecolumns{% % The following penalty ensures that the page builder is exercised % _before_ we change the output routine. This is necessary in the % following situation: % % The last section of the index consists only of a single entry. % Before this section, \pagetotal is less than \pagegoal, so no % break occurs before the last section starts. However, the last % section, consisting of \initial and the single \entry, does not % fit on the page and has to be broken off. Without the following % penalty the page builder will not be exercised until \eject % below, and by that time we'll already have changed the output % routine to the \balancecolumns version, so the next-to-last % double-column page will be processed with \balancecolumns, which % is wrong: The two columns will go to the main vertical list, with % the broken-off section in the recent contributions. As soon as % the output routine finishes, TeX starts reconsidering the page % break. The two columns and the broken-off section both fit on the % page, because the two columns now take up only half of the page % goal. When TeX sees \eject from below which follows the final % section, it invokes the new output routine that we've set after % \balancecolumns below; \onepageout will try to fit the two columns % and the final section into the vbox of \pageheight (see % \pagebody), causing an overfull box. % % Note that glue won't work here, because glue does not exercise the % page builder, unlike penalties (see The TeXbook, pp. 280-281). \penalty0 % \output = {% % Split the last of the double-column material. Leave it on the % current page, no automatic page break. \balancecolumns % % If we end up splitting too much material for the current page, % though, there will be another page break right after this \output % invocation ends. Having called \balancecolumns once, we do not % want to call it again. Therefore, reset \output to its normal % definition right away. (We hope \balancecolumns will never be % called on to balance too much material, but if it is, this makes % the output somewhat more palatable.) \global\output = {\onepageout{\pagecontents\PAGE}}% }% \eject \endgroup % started in \begindoublecolumns % % \pagegoal was set to the doubled \vsize above, since we restarted % the current page. We're now back to normal single-column % typesetting, so reset \pagegoal to the normal \vsize (after the % \endgroup where \vsize got restored). \pagegoal = \vsize } % % Called at the end of the double column material. \def\balancecolumns{% \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120. \dimen@ = \ht0 \advance\dimen@ by \topskip \advance\dimen@ by-\baselineskip \divide\dimen@ by 2 % target to split to %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}% \splittopskip = \topskip % Loop until we get a decent breakpoint. {% \vbadness = 10000 \loop \global\setbox3 = \copy0 \global\setbox1 = \vsplit3 to \dimen@ \ifdim\ht3>\dimen@ \global\advance\dimen@ by 1pt \repeat }% %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}% \setbox0=\vbox to\dimen@{\unvbox1}% \setbox2=\vbox to\dimen@{\unvbox3}% % \pagesofar } \catcode`\@ = \other \message{sectioning,} % Chapters, sections, etc. % Let's start with @part. \outer\parseargdef\part{\partzzz{#1}} \def\partzzz#1{% \chapoddpage \null \vskip.3\vsize % move it down on the page a bit \begingroup \noindent \titlefonts\rmisbold #1\par % the text \let\lastnode=\empty % no node to associate with \writetocentry{part}{#1}{}% but put it in the toc \headingsoff % no headline or footline on the part page \chapoddpage \endgroup } % \unnumberedno is an oxymoron. But we count the unnumbered % sections so that we can refer to them unambiguously in the pdf % outlines by their "section number". We avoid collisions with chapter % numbers by starting them at 10000. (If a document ever has 10000 % chapters, we're in trouble anyway, I'm sure.) \newcount\unnumberedno \unnumberedno = 10000 \newcount\chapno \newcount\secno \secno=0 \newcount\subsecno \subsecno=0 \newcount\subsubsecno \subsubsecno=0 % This counter is funny since it counts through charcodes of letters A, B, ... \newcount\appendixno \appendixno = `\@ % % \def\appendixletter{\char\the\appendixno} % We do the following ugly conditional instead of the above simple % construct for the sake of pdftex, which needs the actual % letter in the expansion, not just typeset. % \def\appendixletter{% \ifnum\appendixno=`A A% \else\ifnum\appendixno=`B B% \else\ifnum\appendixno=`C C% \else\ifnum\appendixno=`D D% \else\ifnum\appendixno=`E E% \else\ifnum\appendixno=`F F% \else\ifnum\appendixno=`G G% \else\ifnum\appendixno=`H H% \else\ifnum\appendixno=`I I% \else\ifnum\appendixno=`J J% \else\ifnum\appendixno=`K K% \else\ifnum\appendixno=`L L% \else\ifnum\appendixno=`M M% \else\ifnum\appendixno=`N N% \else\ifnum\appendixno=`O O% \else\ifnum\appendixno=`P P% \else\ifnum\appendixno=`Q Q% \else\ifnum\appendixno=`R R% \else\ifnum\appendixno=`S S% \else\ifnum\appendixno=`T T% \else\ifnum\appendixno=`U U% \else\ifnum\appendixno=`V V% \else\ifnum\appendixno=`W W% \else\ifnum\appendixno=`X X% \else\ifnum\appendixno=`Y Y% \else\ifnum\appendixno=`Z Z% % The \the is necessary, despite appearances, because \appendixletter is % expanded while writing the .toc file. \char\appendixno is not % expandable, thus it is written literally, thus all appendixes come out % with the same letter (or @) in the toc without it. \else\char\the\appendixno \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} % Each @chapter defines these (using marks) as the number+name, number % and name of the chapter. Page headings and footings can use % these. @section does likewise. \def\thischapter{} \def\thischapternum{} \def\thischaptername{} \def\thissection{} \def\thissectionnum{} \def\thissectionname{} \newcount\absseclevel % used to calculate proper heading level \newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count % @raisesections: treat @section as chapter, @subsection as section, etc. \def\raisesections{\global\advance\secbase by -1} \let\up=\raisesections % original BFox name % @lowersections: treat @chapter as section, @section as subsection, etc. \def\lowersections{\global\advance\secbase by 1} \let\down=\lowersections % original BFox name % we only have subsub. \chardef\maxseclevel = 3 % % A numbered section within an unnumbered changes to unnumbered too. % To achieve this, remember the "biggest" unnum. sec. we are currently in: \chardef\unnlevel = \maxseclevel % % Trace whether the current chapter is an appendix or not: % \chapheadtype is "N" or "A", unnumbered chapters are ignored. \def\chapheadtype{N} % Choose a heading macro % #1 is heading type % #2 is heading level % #3 is text for heading \def\genhead#1#2#3{% % Compute the abs. sec. level: \absseclevel=#2 \advance\absseclevel by \secbase % Make sure \absseclevel doesn't fall outside the range: \ifnum \absseclevel < 0 \absseclevel = 0 \else \ifnum \absseclevel > 3 \absseclevel = 3 \fi \fi % The heading type: \def\headtype{#1}% \if \headtype U% \ifnum \absseclevel < \unnlevel \chardef\unnlevel = \absseclevel \fi \else % Check for appendix sections: \ifnum \absseclevel = 0 \edef\chapheadtype{\headtype}% \else \if \headtype A\if \chapheadtype N% \errmessage{@appendix... within a non-appendix chapter}% \fi\fi \fi % Check for numbered within unnumbered: \ifnum \absseclevel > \unnlevel \def\headtype{U}% \else \chardef\unnlevel = 3 \fi \fi % Now print the heading: \if \headtype U% \ifcase\absseclevel \unnumberedzzz{#3}% \or \unnumberedseczzz{#3}% \or \unnumberedsubseczzz{#3}% \or \unnumberedsubsubseczzz{#3}% \fi \else \if \headtype A% \ifcase\absseclevel \appendixzzz{#3}% \or \appendixsectionzzz{#3}% \or \appendixsubseczzz{#3}% \or \appendixsubsubseczzz{#3}% \fi \else \ifcase\absseclevel \chapterzzz{#3}% \or \seczzz{#3}% \or \numberedsubseczzz{#3}% \or \numberedsubsubseczzz{#3}% \fi \fi \fi \suppressfirstparagraphindent } % an interface: \def\numhead{\genhead N} \def\apphead{\genhead A} \def\unnmhead{\genhead U} % @chapter, @appendix, @unnumbered. Increment top-level counter, reset % all lower-level sectioning counters to zero. % % Also set \chaplevelprefix, which we prepend to @float sequence numbers % (e.g., figures), q.v. By default (before any chapter), that is empty. \let\chaplevelprefix = \empty % \outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz \def\chapterzzz#1{% % section resetting is \global in case the chapter is in a group, such % as an @include file. \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 \global\advance\chapno by 1 % % Used for \float. \gdef\chaplevelprefix{\the\chapno.}% \resetallfloatnos % % \putwordChapter can contain complex things in translations. \toks0=\expandafter{\putwordChapter}% \message{\the\toks0 \space \the\chapno}% % % Write the actual heading. \chapmacro{#1}{Ynumbered}{\the\chapno}% % % So @section and the like are numbered underneath this chapter. \global\let\section = \numberedsec \global\let\subsection = \numberedsubsec \global\let\subsubsection = \numberedsubsubsec } \outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz % \def\appendixzzz#1{% \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 \global\advance\appendixno by 1 \gdef\chaplevelprefix{\appendixletter.}% \resetallfloatnos % % \putwordAppendix can contain complex things in translations. \toks0=\expandafter{\putwordAppendix}% \message{\the\toks0 \space \appendixletter}% % \chapmacro{#1}{Yappendix}{\appendixletter}% % \global\let\section = \appendixsec \global\let\subsection = \appendixsubsec \global\let\subsubsection = \appendixsubsubsec } % normally unnmhead0 calls unnumberedzzz: \outer\parseargdef\unnumbered{\unnmhead0{#1}} \def\unnumberedzzz#1{% \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 \global\advance\unnumberedno by 1 % % Since an unnumbered has no number, no prefix for figures. \global\let\chaplevelprefix = \empty \resetallfloatnos % % This used to be simply \message{#1}, but TeX fully expands the % argument to \message. Therefore, if #1 contained @-commands, TeX % expanded them. For example, in `@unnumbered The @cite{Book}', TeX % expanded @cite (which turns out to cause errors because \cite is meant % to be executed, not expanded). % % Anyway, we don't want the fully-expanded definition of @cite to appear % as a result of the \message, we just want `@cite' itself. We use % \the to achieve this: TeX expands \the only once, % simply yielding the contents of . (We also do this for % the toc entries.) \toks0 = {#1}% \message{(\the\toks0)}% % \chapmacro{#1}{Ynothing}{\the\unnumberedno}% % \global\let\section = \unnumberedsec \global\let\subsection = \unnumberedsubsec \global\let\subsubsection = \unnumberedsubsubsec } % @centerchap is like @unnumbered, but the heading is centered. \outer\parseargdef\centerchap{% % Well, we could do the following in a group, but that would break % an assumption that \chapmacro is called at the outermost level. % Thus we are safer this way: --kasal, 24feb04 \let\centerparametersmaybe = \centerparameters \unnmhead0{#1}% \let\centerparametersmaybe = \relax } % @top is like @unnumbered. \let\top\unnumbered % Sections. % \outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz \def\seczzz#1{% \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}% } % normally calls appendixsectionzzz: \outer\parseargdef\appendixsection{\apphead1{#1}} \def\appendixsectionzzz#1{% \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}% } \let\appendixsec\appendixsection % normally calls unnumberedseczzz: \outer\parseargdef\unnumberedsec{\unnmhead1{#1}} \def\unnumberedseczzz#1{% \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}% } % Subsections. % % normally calls numberedsubseczzz: \outer\parseargdef\numberedsubsec{\numhead2{#1}} \def\numberedsubseczzz#1{% \global\subsubsecno=0 \global\advance\subsecno by 1 \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}% } % normally calls appendixsubseczzz: \outer\parseargdef\appendixsubsec{\apphead2{#1}} \def\appendixsubseczzz#1{% \global\subsubsecno=0 \global\advance\subsecno by 1 \sectionheading{#1}{subsec}{Yappendix}% {\appendixletter.\the\secno.\the\subsecno}% } % normally calls unnumberedsubseczzz: \outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} \def\unnumberedsubseczzz#1{% \global\subsubsecno=0 \global\advance\subsecno by 1 \sectionheading{#1}{subsec}{Ynothing}% {\the\unnumberedno.\the\secno.\the\subsecno}% } % Subsubsections. % % normally numberedsubsubseczzz: \outer\parseargdef\numberedsubsubsec{\numhead3{#1}} \def\numberedsubsubseczzz#1{% \global\advance\subsubsecno by 1 \sectionheading{#1}{subsubsec}{Ynumbered}% {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}% } % normally appendixsubsubseczzz: \outer\parseargdef\appendixsubsubsec{\apphead3{#1}} \def\appendixsubsubseczzz#1{% \global\advance\subsubsecno by 1 \sectionheading{#1}{subsubsec}{Yappendix}% {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}% } % normally unnumberedsubsubseczzz: \outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} \def\unnumberedsubsubseczzz#1{% \global\advance\subsubsecno by 1 \sectionheading{#1}{subsubsec}{Ynothing}% {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}% } % These macros control what the section commands do, according % to what kind of chapter we are in (ordinary, appendix, or unnumbered). % Define them by default for a numbered chapter. \let\section = \numberedsec \let\subsection = \numberedsubsec \let\subsubsection = \numberedsubsubsec % Define @majorheading, @heading and @subheading % NOTE on use of \vbox for chapter headings, section headings, and such: % 1) We use \vbox rather than the earlier \line to permit % overlong headings to fold. % 2) \hyphenpenalty is set to 10000 because hyphenation in a % heading is obnoxious; this forbids it. % 3) Likewise, headings look best if no \parindent is used, and % if justification is not attempted. Hence \raggedright. \def\majorheading{% {\advance\chapheadingskip by 10pt \chapbreak }% \parsearg\chapheadingzzz } \def\chapheading{\chapbreak \parsearg\chapheadingzzz} \def\chapheadingzzz#1{% {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 \parindent=0pt\ptexraggedright \rmisbold #1\hfill}}% \bigskip \par\penalty 200\relax \suppressfirstparagraphindent } % @heading, @subheading, @subsubheading. \parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{} \suppressfirstparagraphindent} \parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{} \suppressfirstparagraphindent} \parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{} \suppressfirstparagraphindent} % These macros generate a chapter, section, etc. heading only % (including whitespace, linebreaking, etc. around it), % given all the information in convenient, parsed form. % Args are the skip and penalty (usually negative) \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi} % Parameter controlling skip before chapter headings (if needed) \newskip\chapheadingskip % Define plain chapter starts, and page on/off switching for it. \def\chapbreak{\dobreak \chapheadingskip {-4000}} \def\chappager{\par\vfill\supereject} % Because \domark is called before \chapoddpage, the filler page will % get the headings for the next chapter, which is wrong. But we don't % care -- we just disable all headings on the filler page. \def\chapoddpage{% \chappager \ifodd\pageno \else \begingroup \headingsoff \null \chappager \endgroup \fi } \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname} \def\CHAPPAGoff{% \global\let\contentsalignmacro = \chappager \global\let\pchapsepmacro=\chapbreak \global\let\pagealignmacro=\chappager} \def\CHAPPAGon{% \global\let\contentsalignmacro = \chappager \global\let\pchapsepmacro=\chappager \global\let\pagealignmacro=\chappager \global\def\HEADINGSon{\HEADINGSsingle}} \def\CHAPPAGodd{% \global\let\contentsalignmacro = \chapoddpage \global\let\pchapsepmacro=\chapoddpage \global\let\pagealignmacro=\chapoddpage \global\def\HEADINGSon{\HEADINGSdouble}} \CHAPPAGon % Chapter opening. % % #1 is the text, #2 is the section type (Ynumbered, Ynothing, % Yappendix, Yomitfromtoc), #3 the chapter number. % % To test against our argument. \def\Ynothingkeyword{Ynothing} \def\Yomitfromtockeyword{Yomitfromtoc} \def\Yappendixkeyword{Yappendix} % \def\chapmacro#1#2#3{% % Insert the first mark before the heading break (see notes for \domark). \let\prevchapterdefs=\lastchapterdefs \let\prevsectiondefs=\lastsectiondefs \gdef\lastsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}% \gdef\thissection{}}% % \def\temptype{#2}% \ifx\temptype\Ynothingkeyword \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}% \gdef\thischapter{\thischaptername}}% \else\ifx\temptype\Yomitfromtockeyword \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}% \gdef\thischapter{}}% \else\ifx\temptype\Yappendixkeyword \toks0={#1}% \xdef\lastchapterdefs{% \gdef\noexpand\thischaptername{\the\toks0}% \gdef\noexpand\thischapternum{\appendixletter}% % \noexpand\putwordAppendix avoids expanding indigestible % commands in some of the translations. \gdef\noexpand\thischapter{\noexpand\putwordAppendix{} \noexpand\thischapternum: \noexpand\thischaptername}% }% \else \toks0={#1}% \xdef\lastchapterdefs{% \gdef\noexpand\thischaptername{\the\toks0}% \gdef\noexpand\thischapternum{\the\chapno}% % \noexpand\putwordChapter avoids expanding indigestible % commands in some of the translations. \gdef\noexpand\thischapter{\noexpand\putwordChapter{} \noexpand\thischapternum: \noexpand\thischaptername}% }% \fi\fi\fi % % Output the mark. Pass it through \safewhatsit, to take care of % the preceding space. \safewhatsit\domark % % Insert the chapter heading break. \pchapsepmacro % % Now the second mark, after the heading break. No break points % between here and the heading. \let\prevchapterdefs=\lastchapterdefs \let\prevsectiondefs=\lastsectiondefs \domark % {% \chapfonts \rmisbold % % Have to define \lastsection before calling \donoderef, because the % xref code eventually uses it. On the other hand, it has to be called % after \pchapsepmacro, or the headline will change too soon. \gdef\lastsection{#1}% % % Only insert the separating space if we have a chapter/appendix % number, and don't print the unnumbered ``number''. \ifx\temptype\Ynothingkeyword \setbox0 = \hbox{}% \def\toctype{unnchap}% \else\ifx\temptype\Yomitfromtockeyword \setbox0 = \hbox{}% contents like unnumbered, but no toc entry \def\toctype{omit}% \else\ifx\temptype\Yappendixkeyword \setbox0 = \hbox{\putwordAppendix{} #3\enspace}% \def\toctype{app}% \else \setbox0 = \hbox{#3\enspace}% \def\toctype{numchap}% \fi\fi\fi % % Write the toc entry for this chapter. Must come before the % \donoderef, because we include the current node name in the toc % entry, and \donoderef resets it to empty. \writetocentry{\toctype}{#1}{#3}% % % For pdftex, we have to write out the node definition (aka, make % the pdfdest) after any page break, but before the actual text has % been typeset. If the destination for the pdf outline is after the % text, then jumping from the outline may wind up with the text not % being visible, for instance under high magnification. \donoderef{#2}% % % Typeset the actual heading. \nobreak % Avoid page breaks at the interline glue. \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright \hangindent=\wd0 \centerparametersmaybe \unhbox0 #1\par}% }% \nobreak\bigskip % no page break after a chapter title \nobreak } % @centerchap -- centered and unnumbered. \let\centerparametersmaybe = \relax \def\centerparameters{% \advance\rightskip by 3\rightskip \leftskip = \rightskip \parfillskip = 0pt } % I don't think this chapter style is supported any more, so I'm not % updating it with the new noderef stuff. We'll see. --karl, 11aug03. % \def\setchapterstyle #1 {\csname CHAPF#1\endcsname} % \def\unnchfopen #1{% \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 \parindent=0pt\ptexraggedright \rmisbold #1\hfill}}\bigskip \par\nobreak } \def\chfopen #1#2{\chapoddpage {\chapfonts \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}% \par\penalty 5000 % } \def\centerchfopen #1{% \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 \parindent=0pt \hfill {\rmisbold #1}\hfill}}\bigskip \par\nobreak } \def\CHAPFopen{% \global\let\chapmacro=\chfopen \global\let\centerchapmacro=\centerchfopen} % Section titles. These macros combine the section number parts and % call the generic \sectionheading to do the printing. % \newskip\secheadingskip \def\secheadingbreak{\dobreak \secheadingskip{-1000}} % Subsection titles. \newskip\subsecheadingskip \def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}} % Subsubsection titles. \def\subsubsecheadingskip{\subsecheadingskip} \def\subsubsecheadingbreak{\subsecheadingbreak} % Print any size, any type, section title. % % #1 is the text, #2 is the section level (sec/subsec/subsubsec), #3 is % the section type for xrefs (Ynumbered, Ynothing, Yappendix), #4 is the % section number. % \def\seckeyword{sec} % \def\sectionheading#1#2#3#4{% {% \checkenv{}% should not be in an environment. % % Switch to the right set of fonts. \csname #2fonts\endcsname \rmisbold % \def\sectionlevel{#2}% \def\temptype{#3}% % % Insert first mark before the heading break (see notes for \domark). \let\prevsectiondefs=\lastsectiondefs \ifx\temptype\Ynothingkeyword \ifx\sectionlevel\seckeyword \gdef\lastsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}% \gdef\thissection{\thissectionname}}% \fi \else\ifx\temptype\Yomitfromtockeyword % Don't redefine \thissection. \else\ifx\temptype\Yappendixkeyword \ifx\sectionlevel\seckeyword \toks0={#1}% \xdef\lastsectiondefs{% \gdef\noexpand\thissectionname{\the\toks0}% \gdef\noexpand\thissectionnum{#4}% % \noexpand\putwordSection avoids expanding indigestible % commands in some of the translations. \gdef\noexpand\thissection{\noexpand\putwordSection{} \noexpand\thissectionnum: \noexpand\thissectionname}% }% \fi \else \ifx\sectionlevel\seckeyword \toks0={#1}% \xdef\lastsectiondefs{% \gdef\noexpand\thissectionname{\the\toks0}% \gdef\noexpand\thissectionnum{#4}% % \noexpand\putwordSection avoids expanding indigestible % commands in some of the translations. \gdef\noexpand\thissection{\noexpand\putwordSection{} \noexpand\thissectionnum: \noexpand\thissectionname}% }% \fi \fi\fi\fi % % Go into vertical mode. Usually we'll already be there, but we % don't want the following whatsit to end up in a preceding paragraph % if the document didn't happen to have a blank line. \par % % Output the mark. Pass it through \safewhatsit, to take care of % the preceding space. \safewhatsit\domark % % Insert space above the heading. \csname #2headingbreak\endcsname % % Now the second mark, after the heading break. No break points % between here and the heading. \let\prevsectiondefs=\lastsectiondefs \domark % % Only insert the space after the number if we have a section number. \ifx\temptype\Ynothingkeyword \setbox0 = \hbox{}% \def\toctype{unn}% \gdef\lastsection{#1}% \else\ifx\temptype\Yomitfromtockeyword % for @headings -- no section number, don't include in toc, % and don't redefine \lastsection. \setbox0 = \hbox{}% \def\toctype{omit}% \let\sectionlevel=\empty \else\ifx\temptype\Yappendixkeyword \setbox0 = \hbox{#4\enspace}% \def\toctype{app}% \gdef\lastsection{#1}% \else \setbox0 = \hbox{#4\enspace}% \def\toctype{num}% \gdef\lastsection{#1}% \fi\fi\fi % % Write the toc entry (before \donoderef). See comments in \chapmacro. \writetocentry{\toctype\sectionlevel}{#1}{#4}% % % Write the node reference (= pdf destination for pdftex). % Again, see comments in \chapmacro. \donoderef{#3}% % % Interline glue will be inserted when the vbox is completed. % That glue will be a valid breakpoint for the page, since it'll be % preceded by a whatsit (usually from the \donoderef, or from the % \writetocentry if there was no node). We don't want to allow that % break, since then the whatsits could end up on page n while the % section is on page n+1, thus toc/etc. are wrong. Debian bug 276000. \nobreak % % Output the actual section heading. \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright \hangindent=\wd0 % zero if no section number \unhbox0 #1}% }% % Add extra space after the heading -- half of whatever came above it. % Don't allow stretch, though. \kern .5 \csname #2headingskip\endcsname % % Do not let the kern be a potential breakpoint, as it would be if it % was followed by glue. \nobreak % % We'll almost certainly start a paragraph next, so don't let that % glue accumulate. (Not a breakpoint because it's preceded by a % discardable item.) \vskip-\parskip % % This is purely so the last item on the list is a known \penalty > % 10000. This is so \startdefun can avoid allowing breakpoints after % section headings. Otherwise, it would insert a valid breakpoint between: % % @section sec-whatever % @deffn def-whatever \penalty 10001 } \message{toc,} % Table of contents. \newwrite\tocfile % Write an entry to the toc file, opening it if necessary. % Called from @chapter, etc. % % Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno} % We append the current node name (if any) and page number as additional % arguments for the \{chap,sec,...}entry macros which will eventually % read this. The node name is used in the pdf outlines as the % destination to jump to. % % We open the .toc file for writing here instead of at @setfilename (or % any other fixed time) so that @contents can be anywhere in the document. % But if #1 is `omit', then we don't do anything. This is used for the % table of contents chapter openings themselves. % \newif\iftocfileopened \def\omitkeyword{omit}% % \def\writetocentry#1#2#3{% \edef\writetoctype{#1}% \ifx\writetoctype\omitkeyword \else \iftocfileopened\else \immediate\openout\tocfile = \jobname.toc \global\tocfileopenedtrue \fi % \iflinks {\atdummies \edef\temp{% \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}% \temp }% \fi \fi % % Tell \shipout to create a pdf destination on each page, if we're % writing pdf. These are used in the table of contents. We can't % just write one on every page because the title pages are numbered % 1 and 2 (the page numbers aren't printed), and so are the first % two pages of the document. Thus, we'd have two destinations named % `1', and two named `2'. \ifpdf \global\pdfmakepagedesttrue \fi } % These characters do not print properly in the Computer Modern roman % fonts, so we must take special care. This is more or less redundant % with the Texinfo input format setup at the end of this file. % \def\activecatcodes{% \catcode`\"=\active \catcode`\$=\active \catcode`\<=\active \catcode`\>=\active \catcode`\\=\active \catcode`\^=\active \catcode`\_=\active \catcode`\|=\active \catcode`\~=\active } % Read the toc file, which is essentially Texinfo input. \def\readtocfile{% \setupdatafile \activecatcodes \input \tocreadfilename } \newskip\contentsrightmargin \contentsrightmargin=1in \newcount\savepageno \newcount\lastnegativepageno \lastnegativepageno = -1 % Prepare to read what we've written to \tocfile. % \def\startcontents#1{% % If @setchapternewpage on, and @headings double, the contents should % start on an odd page, unlike chapters. Thus, we maintain % \contentsalignmacro in parallel with \pagealignmacro. % From: Torbjorn Granlund \contentsalignmacro \immediate\closeout\tocfile % % Don't need to put `Contents' or `Short Contents' in the headline. % It is abundantly clear what they are. \chapmacro{#1}{Yomitfromtoc}{}% % \savepageno = \pageno \begingroup % Set up to handle contents files properly. \raggedbottom % Worry more about breakpoints than the bottom. \advance\hsize by -\contentsrightmargin % Don't use the full line length. % % Roman numerals for page numbers. \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi } % redefined for the two-volume lispref. We always output on % \jobname.toc even if this is redefined. % \def\tocreadfilename{\jobname.toc} % Normal (long) toc. % \def\contents{% \startcontents{\putwordTOC}% \openin 1 \tocreadfilename\space \ifeof 1 \else \readtocfile \fi \vfill \eject \contentsalignmacro % in case @setchapternewpage odd is in effect \ifeof 1 \else \pdfmakeoutlines \fi \closein 1 \endgroup \lastnegativepageno = \pageno \global\pageno = \savepageno } % And just the chapters. \def\summarycontents{% \startcontents{\putwordShortTOC}% % \let\partentry = \shortpartentry \let\numchapentry = \shortchapentry \let\appentry = \shortchapentry \let\unnchapentry = \shortunnchapentry % We want a true roman here for the page numbers. \secfonts \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl \let\tt=\shortconttt \rm \hyphenpenalty = 10000 \advance\baselineskip by 1pt % Open it up a little. \def\numsecentry##1##2##3##4{} \let\appsecentry = \numsecentry \let\unnsecentry = \numsecentry \let\numsubsecentry = \numsecentry \let\appsubsecentry = \numsecentry \let\unnsubsecentry = \numsecentry \let\numsubsubsecentry = \numsecentry \let\appsubsubsecentry = \numsecentry \let\unnsubsubsecentry = \numsecentry \openin 1 \tocreadfilename\space \ifeof 1 \else \readtocfile \fi \closein 1 \vfill \eject \contentsalignmacro % in case @setchapternewpage odd is in effect \endgroup \lastnegativepageno = \pageno \global\pageno = \savepageno } \let\shortcontents = \summarycontents % Typeset the label for a chapter or appendix for the short contents. % The arg is, e.g., `A' for an appendix, or `3' for a chapter. % \def\shortchaplabel#1{% % This space should be enough, since a single number is .5em, and the % widest letter (M) is 1em, at least in the Computer Modern fonts. % But use \hss just in case. % (This space doesn't include the extra space that gets added after % the label; that gets put in by \shortchapentry above.) % % We'd like to right-justify chapter numbers, but that looks strange % with appendix letters. And right-justifying numbers and % left-justifying letters looks strange when there is less than 10 % chapters. Have to read the whole toc once to know how many chapters % there are before deciding ... \hbox to 1em{#1\hss}% } % These macros generate individual entries in the table of contents. % The first argument is the chapter or section name. % The last argument is the page number. % The arguments in between are the chapter number, section number, ... % Parts, in the main contents. Replace the part number, which doesn't % exist, with an empty box. Let's hope all the numbers have the same width. % Also ignore the page number, which is conventionally not printed. \def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}} \def\partentry#1#2#3#4{\dochapentry{\numeralbox\labelspace#1}{}} % % Parts, in the short toc. \def\shortpartentry#1#2#3#4{% \penalty-300 \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip \shortchapentry{{\bf #1}}{\numeralbox}{}{}% } % Chapters, in the main contents. \def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}} % % Chapters, in the short toc. % See comments in \dochapentry re vbox and related settings. \def\shortchapentry#1#2#3#4{% \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}% } % Appendices, in the main contents. % Need the word Appendix, and a fixed-size box. % \def\appendixbox#1{% % We use M since it's probably the widest letter. \setbox0 = \hbox{\putwordAppendix{} M}% \hbox to \wd0{\putwordAppendix{} #1\hss}} % \def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\labelspace#1}{#4}} % Unnumbered chapters. \def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}} \def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}} % Sections. \def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}} \let\appsecentry=\numsecentry \def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}} % Subsections. \def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}} \let\appsubsecentry=\numsubsecentry \def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}} % And subsubsections. \def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}} \let\appsubsubsecentry=\numsubsubsecentry \def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}} % This parameter controls the indentation of the various levels. % Same as \defaultparindent. \newdimen\tocindent \tocindent = 15pt % Now for the actual typesetting. In all these, #1 is the text and #2 is the % page number. % % If the toc has to be broken over pages, we want it to be at chapters % if at all possible; hence the \penalty. \def\dochapentry#1#2{% \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip \begingroup \chapentryfonts \tocentry{#1}{\dopageno\bgroup#2\egroup}% \endgroup \nobreak\vskip .25\baselineskip plus.1\baselineskip } \def\dosecentry#1#2{\begingroup \secentryfonts \leftskip=\tocindent \tocentry{#1}{\dopageno\bgroup#2\egroup}% \endgroup} \def\dosubsecentry#1#2{\begingroup \subsecentryfonts \leftskip=2\tocindent \tocentry{#1}{\dopageno\bgroup#2\egroup}% \endgroup} \def\dosubsubsecentry#1#2{\begingroup \subsubsecentryfonts \leftskip=3\tocindent \tocentry{#1}{\dopageno\bgroup#2\egroup}% \endgroup} % We use the same \entry macro as for the index entries. \let\tocentry = \entry % Space between chapter (or whatever) number and the title. \def\labelspace{\hskip1em \relax} \def\dopageno#1{{\rm #1}} \def\doshortpageno#1{{\rm #1}} \def\chapentryfonts{\secfonts \rm} \def\secentryfonts{\textfonts} \def\subsecentryfonts{\textfonts} \def\subsubsecentryfonts{\textfonts} \message{environments,} % @foo ... @end foo. % @tex ... @end tex escapes into raw TeX temporarily. % One exception: @ is still an escape character, so that @end tex works. % But \@ or @@ will get a plain @ character. \envdef\tex{% \setupmarkupstyle{tex}% \catcode `\\=0 \catcode `\{=1 \catcode `\}=2 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6 \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie \catcode `\%=14 \catcode `\+=\other \catcode `\"=\other \catcode `\|=\other \catcode `\<=\other \catcode `\>=\other \catcode`\`=\other \catcode`\'=\other \escapechar=`\\ % % ' is active in math mode (mathcode"8000). So reset it, and all our % other math active characters (just in case), to plain's definitions. \mathactive % \let\b=\ptexb \let\bullet=\ptexbullet \let\c=\ptexc \let\,=\ptexcomma \let\.=\ptexdot \let\dots=\ptexdots \let\equiv=\ptexequiv \let\!=\ptexexclam \let\i=\ptexi \let\indent=\ptexindent \let\noindent=\ptexnoindent \let\{=\ptexlbrace \let\+=\tabalign \let\}=\ptexrbrace \let\/=\ptexslash \let\*=\ptexstar \let\t=\ptext \expandafter \let\csname top\endcsname=\ptextop % outer \let\frenchspacing=\plainfrenchspacing % \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}% \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}% \def\@{@}% } % There is no need to define \Etex. % Define @lisp ... @end lisp. % @lisp environment forms a group so it can rebind things, % including the definition of @end lisp (which normally is erroneous). % Amount to narrow the margins by for @lisp. \newskip\lispnarrowing \lispnarrowing=0.4in % This is the definition that ^^M gets inside @lisp, @example, and other % such environments. \null is better than a space, since it doesn't % have any width. \def\lisppar{\null\endgraf} % This space is always present above and below environments. \newskip\envskipamount \envskipamount = 0pt % Make spacing and below environment symmetrical. We use \parskip here % to help in doing that, since in @example-like environments \parskip % is reset to zero; thus the \afterenvbreak inserts no space -- but the % start of the next paragraph will insert \parskip. % \def\aboveenvbreak{{% % =10000 instead of <10000 because of a special case in \itemzzz and % \sectionheading, q.v. \ifnum \lastpenalty=10000 \else \advance\envskipamount by \parskip \endgraf \ifdim\lastskip<\envskipamount \removelastskip % it's not a good place to break if the last penalty was \nobreak % or better ... \ifnum\lastpenalty<10000 \penalty-50 \fi \vskip\envskipamount \fi \fi }} \let\afterenvbreak = \aboveenvbreak % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will % also clear it, so that its embedded environments do the narrowing again. \let\nonarrowing=\relax % @cartouche ... @end cartouche: draw rectangle w/rounded corners around % environment contents. \font\circle=lcircle10 \newdimen\circthick \newdimen\cartouter\newdimen\cartinner \newskip\normbskip\newskip\normpskip\newskip\normlskip \circthick=\fontdimen8\circle % \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth \def\ctr{{\hskip 6pt\circle\char'010}} \def\cbl{{\circle\char'012\hskip -6pt}} \def\cbr{{\hskip 6pt\circle\char'011}} \def\carttop{\hbox to \cartouter{\hskip\lskip \ctl\leaders\hrule height\circthick\hfil\ctr \hskip\rskip}} \def\cartbot{\hbox to \cartouter{\hskip\lskip \cbl\leaders\hrule height\circthick\hfil\cbr \hskip\rskip}} % \newskip\lskip\newskip\rskip \envdef\cartouche{% \ifhmode\par\fi % can't be in the midst of a paragraph. \startsavinginserts \lskip=\leftskip \rskip=\rightskip \leftskip=0pt\rightskip=0pt % we want these *outside*. \cartinner=\hsize \advance\cartinner by-\lskip \advance\cartinner by-\rskip \cartouter=\hsize \advance\cartouter by 18.4pt % allow for 3pt kerns on either % side, and for 6pt waste from % each corner char, and rule thickness \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip % Flag to tell @lisp, etc., not to narrow margin. \let\nonarrowing = t% \vbox\bgroup \baselineskip=0pt\parskip=0pt\lineskip=0pt \carttop \hbox\bgroup \hskip\lskip \vrule\kern3pt \vbox\bgroup \kern3pt \hsize=\cartinner \baselineskip=\normbskip \lineskip=\normlskip \parskip=\normpskip \vskip -\parskip \comment % For explanation, see the end of \def\group. } \def\Ecartouche{% \ifhmode\par\fi \kern3pt \egroup \kern3pt\vrule \hskip\rskip \egroup \cartbot \egroup \checkinserts } % This macro is called at the beginning of all the @example variants, % inside a group. \newdimen\nonfillparindent \def\nonfillstart{% \aboveenvbreak \hfuzz = 12pt % Don't be fussy \sepspaces % Make spaces be word-separators rather than space tokens. \let\par = \lisppar % don't ignore blank lines \obeylines % each line of input is a line of output \parskip = 0pt % Turn off paragraph indentation but redefine \indent to emulate % the normal \indent. \nonfillparindent=\parindent \parindent = 0pt \let\indent\nonfillindent % \emergencystretch = 0pt % don't try to avoid overfull boxes \ifx\nonarrowing\relax \advance \leftskip by \lispnarrowing \exdentamount=\lispnarrowing \else \let\nonarrowing = \relax \fi \let\exdent=\nofillexdent } \begingroup \obeyspaces % We want to swallow spaces (but not other tokens) after the fake % @indent in our nonfill-environments, where spaces are normally % active and set to @tie, resulting in them not being ignored after % @indent. \gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}% \gdef\nonfillindentcheck{% \ifx\temp % \expandafter\nonfillindentgobble% \else% \leavevmode\nonfillindentbox% \fi% }% \endgroup \def\nonfillindentgobble#1{\nonfillindent} \def\nonfillindentbox{\hbox to \nonfillparindent{\hss}} % If you want all examples etc. small: @set dispenvsize small. % If you want even small examples the full size: @set dispenvsize nosmall. % This affects the following displayed environments: % @example, @display, @format, @lisp % \def\smallword{small} \def\nosmallword{nosmall} \let\SETdispenvsize\relax \def\setnormaldispenv{% \ifx\SETdispenvsize\smallword % end paragraph for sake of leading, in case document has no blank % line. This is redundant with what happens in \aboveenvbreak, but % we need to do it before changing the fonts, and it's inconvenient % to change the fonts afterward. \ifnum \lastpenalty=10000 \else \endgraf \fi \smallexamplefonts \rm \fi } \def\setsmalldispenv{% \ifx\SETdispenvsize\nosmallword \else \ifnum \lastpenalty=10000 \else \endgraf \fi \smallexamplefonts \rm \fi } % We often define two environments, @foo and @smallfoo. % Let's do it in one command. #1 is the env name, #2 the definition. \def\makedispenvdef#1#2{% \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}% \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}% \expandafter\let\csname E#1\endcsname \afterenvbreak \expandafter\let\csname Esmall#1\endcsname \afterenvbreak } % Define two environment synonyms (#1 and #2) for an environment. \def\maketwodispenvdef#1#2#3{% \makedispenvdef{#1}{#3}% \makedispenvdef{#2}{#3}% } % % @lisp: indented, narrowed, typewriter font; % @example: same as @lisp. % % @smallexample and @smalllisp: use smaller fonts. % Originally contributed by Pavel@xerox. % \maketwodispenvdef{lisp}{example}{% \nonfillstart \tt\setupmarkupstyle{example}% \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. \gobble % eat return } % @display/@smalldisplay: same as @lisp except keep current font. % \makedispenvdef{display}{% \nonfillstart \gobble } % @format/@smallformat: same as @display except don't narrow margins. % \makedispenvdef{format}{% \let\nonarrowing = t% \nonfillstart \gobble } % @flushleft: same as @format, but doesn't obey \SETdispenvsize. \envdef\flushleft{% \let\nonarrowing = t% \nonfillstart \gobble } \let\Eflushleft = \afterenvbreak % @flushright. % \envdef\flushright{% \let\nonarrowing = t% \nonfillstart \advance\leftskip by 0pt plus 1fill\relax \gobble } \let\Eflushright = \afterenvbreak % @raggedright does more-or-less normal line breaking but no right % justification. From plain.tex. \envdef\raggedright{% \rightskip0pt plus2em \spaceskip.3333em \xspaceskip.5em\relax } \let\Eraggedright\par \envdef\raggedleft{% \parindent=0pt \leftskip0pt plus2em \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt \hbadness=10000 % Last line will usually be underfull, so turn off % badness reporting. } \let\Eraggedleft\par \envdef\raggedcenter{% \parindent=0pt \rightskip0pt plus1em \leftskip0pt plus1em \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt \hbadness=10000 % Last line will usually be underfull, so turn off % badness reporting. } \let\Eraggedcenter\par % @quotation does normal linebreaking (hence we can't use \nonfillstart) % and narrows the margins. We keep \parskip nonzero in general, since % we're doing normal filling. So, when using \aboveenvbreak and % \afterenvbreak, temporarily make \parskip 0. % \makedispenvdef{quotation}{\quotationstart} % \def\quotationstart{% {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip \parindent=0pt % % @cartouche defines \nonarrowing to inhibit narrowing at next level down. \ifx\nonarrowing\relax \advance\leftskip by \lispnarrowing \advance\rightskip by \lispnarrowing \exdentamount = \lispnarrowing \else \let\nonarrowing = \relax \fi \parsearg\quotationlabel } % We have retained a nonzero parskip for the environment, since we're % doing normal filling. % \def\Equotation{% \par \ifx\quotationauthor\thisisundefined\else % indent a bit. \leftline{\kern 2\leftskip \sl ---\quotationauthor}% \fi {\parskip=0pt \afterenvbreak}% } \def\Esmallquotation{\Equotation} % If we're given an argument, typeset it in bold with a colon after. \def\quotationlabel#1{% \def\temp{#1}% \ifx\temp\empty \else {\bf #1: }% \fi } % LaTeX-like @verbatim...@end verbatim and @verb{...} % If we want to allow any as delimiter, % we need the curly braces so that makeinfo sees the @verb command, eg: % `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org % % [Knuth]: Donald Ervin Knuth, 1996. The TeXbook. % % [Knuth] p.344; only we need to do the other characters Texinfo sets % active too. Otherwise, they get lost as the first character on a % verbatim line. \def\dospecials{% \do\ \do\\\do\{\do\}\do\$\do\&% \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~% \do\<\do\>\do\|\do\@\do+\do\"% % Don't do the quotes -- if we do, @set txicodequoteundirected and % @set txicodequotebacktick will not have effect on @verb and % @verbatim, and ?` and !` ligatures won't get disabled. %\do\`\do\'% } % % [Knuth] p. 380 \def\uncatcodespecials{% \def\do##1{\catcode`##1=\other}\dospecials} % % Setup for the @verb command. % % Eight spaces for a tab \begingroup \catcode`\^^I=\active \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }} \endgroup % \def\setupverb{% \tt % easiest (and conventionally used) font for verbatim \def\par{\leavevmode\endgraf}% \setupmarkupstyle{verb}% \tabeightspaces % Respect line breaks, % print special symbols as themselves, and % make each space count % must do in this order: \obeylines \uncatcodespecials \sepspaces } % Setup for the @verbatim environment % % Real tab expansion. \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount % % We typeset each line of the verbatim in an \hbox, so we can handle % tabs. The \global is in case the verbatim line starts with an accent, % or some other command that starts with a begin-group. Otherwise, the % entire \verbbox would disappear at the corresponding end-group, before % it is typeset. Meanwhile, we can't have nested verbatim commands % (can we?), so the \global won't be overwriting itself. \newbox\verbbox \def\starttabbox{\global\setbox\verbbox=\hbox\bgroup} % \begingroup \catcode`\^^I=\active \gdef\tabexpand{% \catcode`\^^I=\active \def^^I{\leavevmode\egroup \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab \divide\dimen\verbbox by\tabw \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw \advance\dimen\verbbox by\tabw % advance to next multiple of \tabw \wd\verbbox=\dimen\verbbox \box\verbbox \starttabbox }% } \endgroup % start the verbatim environment. \def\setupverbatim{% \let\nonarrowing = t% \nonfillstart \tt % easiest (and conventionally used) font for verbatim % The \leavevmode here is for blank lines. Otherwise, we would % never \starttabox and the \egroup would end verbatim mode. \def\par{\leavevmode\egroup\box\verbbox\endgraf}% \tabexpand \setupmarkupstyle{verbatim}% % Respect line breaks, % print special symbols as themselves, and % make each space count. % Must do in this order: \obeylines \uncatcodespecials \sepspaces \everypar{\starttabbox}% } % Do the @verb magic: verbatim text is quoted by unique % delimiter characters. Before first delimiter expect a % right brace, after last delimiter expect closing brace: % % \def\doverb'{'#1'}'{#1} % % [Knuth] p. 382; only eat outer {} \begingroup \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next] \endgroup % \def\verb{\begingroup\setupverb\doverb} % % % Do the @verbatim magic: define the macro \doverbatim so that % the (first) argument ends when '@end verbatim' is reached, ie: % % \def\doverbatim#1@end verbatim{#1} % % For Texinfo it's a lot easier than for LaTeX, % because texinfo's \verbatim doesn't stop at '\end{verbatim}': % we need not redefine '\', '{' and '}'. % % Inspired by LaTeX's verbatim command set [latex.ltx] % \begingroup \catcode`\ =\active \obeylines % % ignore everything up to the first ^^M, that's the newline at the end % of the @verbatim input line itself. Otherwise we get an extra blank % line in the output. \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}% % We really want {...\end verbatim} in the body of the macro, but % without the active space; thus we have to use \xdef and \gobble. \endgroup % \envdef\verbatim{% \setupverbatim\doverbatim } \let\Everbatim = \afterenvbreak % @verbatiminclude FILE - insert text of file in verbatim environment. % \def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude} % \def\doverbatiminclude#1{% {% \makevalueexpandable \setupverbatim \indexnofonts % Allow `@@' and other weird things in file names. \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}% \input #1 \afterenvbreak }% } % @copying ... @end copying. % Save the text away for @insertcopying later. % % We save the uninterpreted tokens, rather than creating a box. % Saving the text in a box would be much easier, but then all the % typesetting commands (@smallbook, font changes, etc.) have to be done % beforehand -- and a) we want @copying to be done first in the source % file; b) letting users define the frontmatter in as flexible order as % possible is very desirable. % \def\copying{\checkenv{}\begingroup\scanargctxt\docopying} \def\docopying#1@end copying{\endgroup\def\copyingtext{#1}} % \def\insertcopying{% \begingroup \parindent = 0pt % paragraph indentation looks wrong on title page \scanexp\copyingtext \endgroup } \message{defuns,} % @defun etc. \newskip\defbodyindent \defbodyindent=.4in \newskip\defargsindent \defargsindent=50pt \newskip\deflastargmargin \deflastargmargin=18pt \newcount\defunpenalty % Start the processing of @deffn: \def\startdefun{% \ifnum\lastpenalty<10000 \medbreak \defunpenalty=10003 % Will keep this @deffn together with the % following @def command, see below. \else % If there are two @def commands in a row, we'll have a \nobreak, % which is there to keep the function description together with its % header. But if there's nothing but headers, we need to allow a % break somewhere. Check specifically for penalty 10002, inserted % by \printdefunline, instead of 10000, since the sectioning % commands also insert a nobreak penalty, and we don't want to allow % a break between a section heading and a defun. % % As a further refinement, we avoid "club" headers by signalling % with penalty of 10003 after the very first @deffn in the % sequence (see above), and penalty of 10002 after any following % @def command. \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi % % Similarly, after a section heading, do not allow a break. % But do insert the glue. \medskip % preceded by discardable penalty, so not a breakpoint \fi % \parindent=0in \advance\leftskip by \defbodyindent \exdentamount=\defbodyindent } \def\dodefunx#1{% % First, check whether we are in the right environment: \checkenv#1% % % As above, allow line break if we have multiple x headers in a row. % It's not a great place, though. \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi % % And now, it's time to reuse the body of the original defun: \expandafter\gobbledefun#1% } \def\gobbledefun#1\startdefun{} % \printdefunline \deffnheader{text} % \def\printdefunline#1#2{% \begingroup % call \deffnheader: #1#2 \endheader % common ending: \interlinepenalty = 10000 \advance\rightskip by 0pt plus 1fil\relax \endgraf \nobreak\vskip -\parskip \penalty\defunpenalty % signal to \startdefun and \dodefunx % Some of the @defun-type tags do not enable magic parentheses, % rendering the following check redundant. But we don't optimize. \checkparencounts \endgroup } \def\Edefun{\endgraf\medbreak} % \makedefun{deffn} creates \deffn, \deffnx and \Edeffn; % the only thing remaining is to define \deffnheader. % \def\makedefun#1{% \expandafter\let\csname E#1\endcsname = \Edefun \edef\temp{\noexpand\domakedefun \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}% \temp } % \domakedefun \deffn \deffnx \deffnheader % % Define \deffn and \deffnx, without parameters. % \deffnheader has to be defined explicitly. % \def\domakedefun#1#2#3{% \envdef#1{% \startdefun \doingtypefnfalse % distinguish typed functions from all else \parseargusing\activeparens{\printdefunline#3}% }% \def#2{\dodefunx#1}% \def#3% } \newif\ifdoingtypefn % doing typed function? \newif\ifrettypeownline % typeset return type on its own line? % @deftypefnnewline on|off says whether the return type of typed functions % are printed on their own line. This affects @deftypefn, @deftypefun, % @deftypeop, and @deftypemethod. % \parseargdef\deftypefnnewline{% \def\temp{#1}% \ifx\temp\onword \expandafter\let\csname SETtxideftypefnnl\endcsname = \empty \else\ifx\temp\offword \expandafter\let\csname SETtxideftypefnnl\endcsname = \relax \else \errhelp = \EMsimple \errmessage{Unknown @txideftypefnnl value `\temp', must be on|off}% \fi\fi } % Untyped functions: % @deffn category name args \makedefun{deffn}{\deffngeneral{}} % @deffn category class name args \makedefun{defop}#1 {\defopon{#1\ \putwordon}} % \defopon {category on}class name args \def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } % \deffngeneral {subind}category name args % \def\deffngeneral#1#2 #3 #4\endheader{% % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}. \dosubind{fn}{\code{#3}}{#1}% \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}% } % Typed functions: % @deftypefn category type name args \makedefun{deftypefn}{\deftypefngeneral{}} % @deftypeop category class type name args \makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}} % \deftypeopon {category on}class type name args \def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } % \deftypefngeneral {subind}category type name args % \def\deftypefngeneral#1#2 #3 #4 #5\endheader{% \dosubind{fn}{\code{#4}}{#1}% \doingtypefntrue \defname{#2}{#3}{#4}\defunargs{#5\unskip}% } % Typed variables: % @deftypevr category type var args \makedefun{deftypevr}{\deftypecvgeneral{}} % @deftypecv category class type var args \makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}} % \deftypecvof {category of}class type var args \def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} } % \deftypecvgeneral {subind}category type var args % \def\deftypecvgeneral#1#2 #3 #4 #5\endheader{% \dosubind{vr}{\code{#4}}{#1}% \defname{#2}{#3}{#4}\defunargs{#5\unskip}% } % Untyped variables: % @defvr category var args \makedefun{defvr}#1 {\deftypevrheader{#1} {} } % @defcv category class var args \makedefun{defcv}#1 {\defcvof{#1\ \putwordof}} % \defcvof {category of}class var args \def\defcvof#1#2 {\deftypecvof{#1}#2 {} } % Types: % @deftp category name args \makedefun{deftp}#1 #2 #3\endheader{% \doind{tp}{\code{#2}}% \defname{#1}{}{#2}\defunargs{#3\unskip}% } % Remaining @defun-like shortcuts: \makedefun{defun}{\deffnheader{\putwordDeffunc} } \makedefun{defmac}{\deffnheader{\putwordDefmac} } \makedefun{defspec}{\deffnheader{\putwordDefspec} } \makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} } \makedefun{defvar}{\defvrheader{\putwordDefvar} } \makedefun{defopt}{\defvrheader{\putwordDefopt} } \makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} } \makedefun{defmethod}{\defopon\putwordMethodon} \makedefun{deftypemethod}{\deftypeopon\putwordMethodon} \makedefun{defivar}{\defcvof\putwordInstanceVariableof} \makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof} % \defname, which formats the name of the @def (not the args). % #1 is the category, such as "Function". % #2 is the return type, if any. % #3 is the function name. % % We are followed by (but not passed) the arguments, if any. % \def\defname#1#2#3{% \par % Get the values of \leftskip and \rightskip as they were outside the @def... \advance\leftskip by -\defbodyindent % % Determine if we are typesetting the return type of a typed function % on a line by itself. \rettypeownlinefalse \ifdoingtypefn % doing a typed function specifically? % then check user option for putting return type on its own line: \expandafter\ifx\csname SETtxideftypefnnl\endcsname\relax \else \rettypeownlinetrue \fi \fi % % How we'll format the category name. Putting it in brackets helps % distinguish it from the body text that may end up on the next line % just below it. \def\temp{#1}% \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi} % % Figure out line sizes for the paragraph shape. We'll always have at % least two. \tempnum = 2 % % The first line needs space for \box0; but if \rightskip is nonzero, % we need only space for the part of \box0 which exceeds it: \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip % % If doing a return type on its own line, we'll have another line. \ifrettypeownline \advance\tempnum by 1 \def\maybeshapeline{0in \hsize}% \else \def\maybeshapeline{}% \fi % % The continuations: \dimen2=\hsize \advance\dimen2 by -\defargsindent % % The final paragraph shape: \parshape \tempnum 0in \dimen0 \maybeshapeline \defargsindent \dimen2 % % Put the category name at the right margin. \noindent \hbox to 0pt{% \hfil\box0 \kern-\hsize % \hsize has to be shortened this way: \kern\leftskip % Intentionally do not respect \rightskip, since we need the space. }% % % Allow all lines to be underfull without complaint: \tolerance=10000 \hbadness=10000 \exdentamount=\defbodyindent {% % defun fonts. We use typewriter by default (used to be bold) because: % . we're printing identifiers, they should be in tt in principle. % . in languages with many accents, such as Czech or French, it's % common to leave accents off identifiers. The result looks ok in % tt, but exceedingly strange in rm. % . we don't want -- and --- to be treated as ligatures. % . this still does not fix the ?` and !` ligatures, but so far no % one has made identifiers using them :). \df \tt \def\temp{#2}% text of the return type \ifx\temp\empty\else \tclose{\temp}% typeset the return type \ifrettypeownline % put return type on its own line; prohibit line break following: \hfil\vadjust{\nobreak}\break \else \space % type on same line, so just followed by a space \fi \fi % no return type #3% output function name }% {\rm\enskip}% hskip 0.5 em of \tenrm % \boldbrax % arguments will be output next, if any. } % Print arguments in slanted roman (not ttsl), inconsistently with using % tt for the name. This is because literal text is sometimes needed in % the argument list (groff manual), and ttsl and tt are not very % distinguishable. Prevent hyphenation at `-' chars. % \def\defunargs#1{% % use sl by default (not ttsl), % tt for the names. \df \sl \hyphenchar\font=0 % % On the other hand, if an argument has two dashes (for instance), we % want a way to get ttsl. Let's try @var for that. \def\var##1{{\setupmarkupstyle{var}\ttslanted{##1}}}% #1% \sl\hyphenchar\font=45 } % We want ()&[] to print specially on the defun line. % \def\activeparens{% \catcode`\(=\active \catcode`\)=\active \catcode`\[=\active \catcode`\]=\active \catcode`\&=\active } % Make control sequences which act like normal parenthesis chars. \let\lparen = ( \let\rparen = ) % Be sure that we always have a definition for `(', etc. For example, % if the fn name has parens in it, \boldbrax will not be in effect yet, % so TeX would otherwise complain about undefined control sequence. { \activeparens \global\let(=\lparen \global\let)=\rparen \global\let[=\lbrack \global\let]=\rbrack \global\let& = \& \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb} \gdef\magicamp{\let&=\amprm} } \newcount\parencount % If we encounter &foo, then turn on ()-hacking afterwards \newif\ifampseen \def\amprm#1 {\ampseentrue{\bf\ }} \def\parenfont{% \ifampseen % At the first level, print parens in roman, % otherwise use the default font. \ifnum \parencount=1 \rm \fi \else % The \sf parens (in \boldbrax) actually are a little bolder than % the contained text. This is especially needed for [ and ] . \sf \fi } \def\infirstlevel#1{% \ifampseen \ifnum\parencount=1 #1% \fi \fi } \def\bfafterword#1 {#1 \bf} \def\opnr{% \global\advance\parencount by 1 {\parenfont(}% \infirstlevel \bfafterword } \def\clnr{% {\parenfont)}% \infirstlevel \sl \global\advance\parencount by -1 } \newcount\brackcount \def\lbrb{% \global\advance\brackcount by 1 {\bf[}% } \def\rbrb{% {\bf]}% \global\advance\brackcount by -1 } \def\checkparencounts{% \ifnum\parencount=0 \else \badparencount \fi \ifnum\brackcount=0 \else \badbrackcount \fi } % these should not use \errmessage; the glibc manual, at least, actually % has such constructs (when documenting function pointers). \def\badparencount{% \message{Warning: unbalanced parentheses in @def...}% \global\parencount=0 } \def\badbrackcount{% \message{Warning: unbalanced square brackets in @def...}% \global\brackcount=0 } \message{macros,} % @macro. % To do this right we need a feature of e-TeX, \scantokens, % which we arrange to emulate with a temporary file in ordinary TeX. \ifx\eTeXversion\thisisundefined \newwrite\macscribble \def\scantokens#1{% \toks0={#1}% \immediate\openout\macscribble=\jobname.tmp \immediate\write\macscribble{\the\toks0}% \immediate\closeout\macscribble \input \jobname.tmp } \fi \def\scanmacro#1{\begingroup \newlinechar`\^^M \let\xeatspaces\eatspaces % % Undo catcode changes of \startcontents and \doprintindex % When called from @insertcopying or (short)caption, we need active % backslash to get it printed correctly. Previously, we had % \catcode`\\=\other instead. We'll see whether a problem appears % with macro expansion. --kasal, 19aug04 \catcode`\@=0 \catcode`\\=\active \escapechar=`\@ % % ... and for \example: \spaceisspace % % The \empty here causes a following catcode 5 newline to be eaten as % part of reading whitespace after a control sequence. It does not % eat a catcode 13 newline. There's no good way to handle the two % cases (untried: maybe e-TeX's \everyeof could help, though plain TeX % would then have different behavior). See the Macro Details node in % the manual for the workaround we recommend for macros and % line-oriented commands. % \scantokens{#1\empty}% \endgroup} \def\scanexp#1{% \edef\temp{\noexpand\scanmacro{#1}}% \temp } \newcount\paramno % Count of parameters \newtoks\macname % Macro name \newif\ifrecursive % Is it recursive? % List of all defined macros in the form % \definedummyword\macro1\definedummyword\macro2... % Currently is also contains all @aliases; the list can be split % if there is a need. \def\macrolist{} % Add the macro to \macrolist \def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname} \def\addtomacrolistxxx#1{% \toks0 = \expandafter{\macrolist\definedummyword#1}% \xdef\macrolist{\the\toks0}% } % Utility routines. % This does \let #1 = #2, with \csnames; that is, % \let \csname#1\endcsname = \csname#2\endcsname % (except of course we have to play expansion games). % \def\cslet#1#2{% \expandafter\let \csname#1\expandafter\endcsname \csname#2\endcsname } % Trim leading and trailing spaces off a string. % Concepts from aro-bend problem 15 (see CTAN). {\catcode`\@=11 \gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }} \gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@} \gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @} \def\unbrace#1{#1} \unbrace{\gdef\trim@@@ #1 } #2@{#1} } % Trim a single trailing ^^M off a string. {\catcode`\^^M=\other \catcode`\Q=3% \gdef\eatcr #1{\eatcra #1Q^^MQ}% \gdef\eatcra#1^^MQ{\eatcrb#1Q}% \gdef\eatcrb#1Q#2Q{#1}% } % Macro bodies are absorbed as an argument in a context where % all characters are catcode 10, 11 or 12, except \ which is active % (as in normal texinfo). It is necessary to change the definition of \ % to recognize macro arguments; this is the job of \mbodybackslash. % % Non-ASCII encodings make 8-bit characters active, so un-activate % them to avoid their expansion. Must do this non-globally, to % confine the change to the current group. % % It's necessary to have hard CRs when the macro is executed. This is % done by making ^^M (\endlinechar) catcode 12 when reading the macro % body, and then making it the \newlinechar in \scanmacro. % \def\scanctxt{% used as subroutine \catcode`\"=\other \catcode`\+=\other \catcode`\<=\other \catcode`\>=\other \catcode`\@=\other \catcode`\^=\other \catcode`\_=\other \catcode`\|=\other \catcode`\~=\other \ifx\declaredencoding\ascii \else \setnonasciicharscatcodenonglobal\other \fi } \def\scanargctxt{% used for copying and captions, not macros. \scanctxt \catcode`\\=\other \catcode`\^^M=\other } \def\macrobodyctxt{% used for @macro definitions \scanctxt \catcode`\{=\other \catcode`\}=\other \catcode`\^^M=\other \usembodybackslash } \def\macroargctxt{% used when scanning invocations \scanctxt \catcode`\\=0 } % why catcode 0 for \ in the above? To recognize \\ \{ \} as "escapes" % for the single characters \ { }. Thus, we end up with the "commands" % that would be written @\ @{ @} in a Texinfo document. % % We already have @{ and @}. For @\, we define it here, and only for % this purpose, to produce a typewriter backslash (so, the @\ that we % define for @math can't be used with @macro calls): % \def\\{\normalbackslash}% % % We would like to do this for \, too, since that is what makeinfo does. % But it is not possible, because Texinfo already has a command @, for a % cedilla accent. Documents must use @comma{} instead. % % \anythingelse will almost certainly be an error of some kind. % \mbodybackslash is the definition of \ in @macro bodies. % It maps \foo\ => \csname macarg.foo\endcsname => #N % where N is the macro parameter number. % We define \csname macarg.\endcsname to be \realbackslash, so % \\ in macro replacement text gets you a backslash. % {\catcode`@=0 @catcode`@\=@active @gdef@usembodybackslash{@let\=@mbodybackslash} @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname} } \expandafter\def\csname macarg.\endcsname{\realbackslash} \def\margbackslash#1{\char`\#1 } \def\macro{\recursivefalse\parsearg\macroxxx} \def\rmacro{\recursivetrue\parsearg\macroxxx} \def\macroxxx#1{% \getargs{#1}% now \macname is the macname and \argl the arglist \ifx\argl\empty % no arguments \paramno=0 \else \expandafter\parsemargdef \argl;% \fi \if1\csname ismacro.\the\macname\endcsname \message{Warning: redefining \the\macname}% \else \expandafter\ifx\csname \the\macname\endcsname \relax \else \errmessage{Macro name \the\macname\space already defined}\fi \global\cslet{macsave.\the\macname}{\the\macname}% \global\expandafter\let\csname ismacro.\the\macname\endcsname=1% \addtomacrolist{\the\macname}% \fi \begingroup \macrobodyctxt \ifrecursive \expandafter\parsermacbody \else \expandafter\parsemacbody \fi} \parseargdef\unmacro{% \if1\csname ismacro.#1\endcsname \global\cslet{#1}{macsave.#1}% \global\expandafter\let \csname ismacro.#1\endcsname=0% % Remove the macro name from \macrolist: \begingroup \expandafter\let\csname#1\endcsname \relax \let\definedummyword\unmacrodo \xdef\macrolist{\macrolist}% \endgroup \else \errmessage{Macro #1 not defined}% \fi } % Called by \do from \dounmacro on each macro. The idea is to omit any % macro definitions that have been changed to \relax. % \def\unmacrodo#1{% \ifx #1\relax % remove this \else \noexpand\definedummyword \noexpand#1% \fi } % This makes use of the obscure feature that if the last token of a % is #, then the preceding argument is delimited by % an opening brace, and that opening brace is not consumed. \def\getargs#1{\getargsxxx#1{}} \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs} \def\getmacname#1 #2\relax{\macname={#1}} \def\getmacargs#1{\def\argl{#1}} % Parse the optional {params} list. Set up \paramno and \paramlist % so \defmacro knows what to do. Define \macarg.blah for each blah % in the params list to be ##N where N is the position in that list. % That gets used by \mbodybackslash (above). % % We need to get `macro parameter char #' into several definitions. % The technique used is stolen from LaTeX: let \hash be something % unexpandable, insert that wherever you need a #, and then redefine % it to # just before using the token list produced. % % The same technique is used to protect \eatspaces till just before % the macro is used. \def\parsemargdef#1;{% \paramno=0\def\paramlist{}% \let\hash\relax \let\xeatspaces\relax \parsemargdefxxx#1,;,% } \def\parsemargdefxxx#1,{% \if#1;\let\next=\relax \else \let\next=\parsemargdefxxx \advance\paramno by 1 \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname {\xeatspaces{\hash\the\paramno}}% \edef\paramlist{\paramlist\hash\the\paramno,}% \fi\next} % These two commands read recursive and nonrecursive macro bodies. % (They're different since rec and nonrec macros end differently.) % \long\def\parsemacbody#1@end macro% {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% \long\def\parsermacbody#1@end rmacro% {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% % This defines the macro itself. There are six cases: recursive and % nonrecursive macros of zero, one, and many arguments. % Much magic with \expandafter here. % \xdef is used so that macro definitions will survive the file % they're defined in; @include reads the file inside a group. % \def\defmacro{% \let\hash=##% convert placeholders to macro parameter chars \ifrecursive \ifcase\paramno % 0 \expandafter\xdef\csname\the\macname\endcsname{% \noexpand\scanmacro{\temp}}% \or % 1 \expandafter\xdef\csname\the\macname\endcsname{% \bgroup\noexpand\macroargctxt \noexpand\braceorline \expandafter\noexpand\csname\the\macname xxx\endcsname}% \expandafter\xdef\csname\the\macname xxx\endcsname##1{% \egroup\noexpand\scanmacro{\temp}}% \else % many \expandafter\xdef\csname\the\macname\endcsname{% \bgroup\noexpand\macroargctxt \noexpand\csname\the\macname xx\endcsname}% \expandafter\xdef\csname\the\macname xx\endcsname##1{% \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% \expandafter\expandafter \expandafter\xdef \expandafter\expandafter \csname\the\macname xxx\endcsname \paramlist{\egroup\noexpand\scanmacro{\temp}}% \fi \else \ifcase\paramno % 0 \expandafter\xdef\csname\the\macname\endcsname{% \noexpand\norecurse{\the\macname}% \noexpand\scanmacro{\temp}\egroup}% \or % 1 \expandafter\xdef\csname\the\macname\endcsname{% \bgroup\noexpand\macroargctxt \noexpand\braceorline \expandafter\noexpand\csname\the\macname xxx\endcsname}% \expandafter\xdef\csname\the\macname xxx\endcsname##1{% \egroup \noexpand\norecurse{\the\macname}% \noexpand\scanmacro{\temp}\egroup}% \else % many \expandafter\xdef\csname\the\macname\endcsname{% \bgroup\noexpand\macroargctxt \expandafter\noexpand\csname\the\macname xx\endcsname}% \expandafter\xdef\csname\the\macname xx\endcsname##1{% \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% \expandafter\expandafter \expandafter\xdef \expandafter\expandafter \csname\the\macname xxx\endcsname \paramlist{% \egroup \noexpand\norecurse{\the\macname}% \noexpand\scanmacro{\temp}\egroup}% \fi \fi} \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} % \braceorline decides whether the next nonwhitespace character is a % {. If so it reads up to the closing }, if not, it reads the whole % line. Whatever was read is then fed to the next control sequence % as an argument (by \parsebrace or \parsearg). % \def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx} \def\braceorlinexxx{% \ifx\nchar\bgroup\else \expandafter\parsearg \fi \macnamexxx} % @alias. % We need some trickery to remove the optional spaces around the equal % sign. Make them active and then expand them all to nothing. % \def\alias{\parseargusing\obeyspaces\aliasxxx} \def\aliasxxx #1{\aliasyyy#1\relax} \def\aliasyyy #1=#2\relax{% {% \expandafter\let\obeyedspace=\empty \addtomacrolist{#1}% \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}% }% \next } \message{cross references,} \newwrite\auxfile \newif\ifhavexrefs % True if xref values are known. \newif\ifwarnedxrefs % True if we warned once that they aren't known. % @inforef is relatively simple. \def\inforef #1{\inforefzzz #1,,,,**} \def\inforefzzz #1,#2,#3,#4**{% \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, node \samp{\ignorespaces#1{}}} % @node's only job in TeX is to define \lastnode, which is used in % cross-references. The @node line might or might not have commas, and % might or might not have spaces before the first comma, like: % @node foo , bar , ... % We don't want such trailing spaces in the node name. % \parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse} % % also remove a trailing comma, in case of something like this: % @node Help-Cross, , , Cross-refs \def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse} \def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}} \let\nwnode=\node \let\lastnode=\empty % Write a cross-reference definition for the current node. #1 is the % type (Ynumbered, Yappendix, Ynothing). % \def\donoderef#1{% \ifx\lastnode\empty\else \setref{\lastnode}{#1}% \global\let\lastnode=\empty \fi } % @anchor{NAME} -- define xref target at arbitrary point. % \newcount\savesfregister % \def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi} \def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi} \def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces} % \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an % anchor), which consists of three parts: % 1) NAME-title - the current sectioning name taken from \lastsection, % or the anchor name. % 2) NAME-snt - section number and type, passed as the SNT arg, or % empty for anchors. % 3) NAME-pg - the page number. % % This is called from \donoderef, \anchor, and \dofloat. In the case of % floats, there is an additional part, which is not written here: % 4) NAME-lof - the text as it should appear in a @listoffloats. % \def\setref#1#2{% \pdfmkdest{#1}% \iflinks {% \atdummies % preserve commands, but don't expand them \edef\writexrdef##1##2{% \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef ##1}{##2}}% these are parameters of \writexrdef }% \toks0 = \expandafter{\lastsection}% \immediate \writexrdef{title}{\the\toks0 }% \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc. \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout }% \fi } % @xrefautosectiontitle on|off says whether @section(ing) names are used % automatically in xrefs, if the third arg is not explicitly specified. % This was provided as a "secret" @set xref-automatic-section-title % variable, now it's official. % \parseargdef\xrefautomaticsectiontitle{% \def\temp{#1}% \ifx\temp\onword \expandafter\let\csname SETxref-automatic-section-title\endcsname = \empty \else\ifx\temp\offword \expandafter\let\csname SETxref-automatic-section-title\endcsname = \relax \else \errhelp = \EMsimple \errmessage{Unknown @xrefautomaticsectiontitle value `\temp', must be on|off}% \fi\fi } % @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is % the node name, #2 the name of the Info cross-reference, #3 the printed % node name, #4 the name of the Info file, #5 the name of the printed % manual. All but the node name can be omitted. % \def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]} \def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]} \def\ref#1{\xrefX[#1,,,,,,,]} \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup \unsepspaces \def\printedmanual{\ignorespaces #5}% \def\printedrefname{\ignorespaces #3}% \setbox1=\hbox{\printedmanual\unskip}% \setbox0=\hbox{\printedrefname\unskip}% \ifdim \wd0 = 0pt % No printed node name was explicitly given. \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax % Use the node name inside the square brackets. \def\printedrefname{\ignorespaces #1}% \else % Use the actual chapter/section title appear inside % the square brackets. Use the real section title if we have it. \ifdim \wd1 > 0pt % It is in another manual, so we don't have it. \def\printedrefname{\ignorespaces #1}% \else \ifhavexrefs % We know the real title if we have the xref values. \def\printedrefname{\refx{#1-title}{}}% \else % Otherwise just copy the Info node name. \def\printedrefname{\ignorespaces #1}% \fi% \fi \fi \fi % % Make link in pdf output. \ifpdf {\indexnofonts \turnoffactive % This expands tokens, so do it after making catcode changes, so _ % etc. don't get their TeX definitions. \getfilename{#4}% % % See comments at \activebackslashdouble. {\activebackslashdouble \xdef\pdfxrefdest{#1}% \backslashparens\pdfxrefdest}% % \leavevmode \startlink attr{/Border [0 0 0]}% \ifnum\filenamelength>0 goto file{\the\filename.pdf} name{\pdfxrefdest}% \else goto name{\pdfmkpgn{\pdfxrefdest}}% \fi }% \setcolor{\linkcolor}% \fi % % Float references are printed completely differently: "Figure 1.2" % instead of "[somenode], p.3". We distinguish them by the % LABEL-title being set to a magic string. {% % Have to otherify everything special to allow the \csname to % include an _ in the xref name, etc. \indexnofonts \turnoffactive \expandafter\global\expandafter\let\expandafter\Xthisreftitle \csname XR#1-title\endcsname }% \iffloat\Xthisreftitle % If the user specified the print name (third arg) to the ref, % print it instead of our usual "Figure 1.2". \ifdim\wd0 = 0pt \refx{#1-snt}{}% \else \printedrefname \fi % % if the user also gave the printed manual name (fifth arg), append % "in MANUALNAME". \ifdim \wd1 > 0pt \space \putwordin{} \cite{\printedmanual}% \fi \else % node/anchor (non-float) references. % % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not % insert empty discretionaries after hyphens, which means that it will % not find a line break at a hyphen in a node names. Since some manuals % are best written with fairly long node names, containing hyphens, this % is a loss. Therefore, we give the text of the node name again, so it % is as if TeX is seeing it for the first time. \ifdim \wd1 > 0pt \putwordSection{} ``\printedrefname'' \putwordin{} \cite{\printedmanual}% \else % _ (for example) has to be the character _ for the purposes of the % control sequence corresponding to the node, but it has to expand % into the usual \leavevmode...\vrule stuff for purposes of % printing. So we \turnoffactive for the \refx-snt, back on for the % printing, back off for the \refx-pg. {\turnoffactive % Only output a following space if the -snt ref is nonempty; for % @unnumbered and @anchor, it won't be. \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi }% % output the `[mynode]' via a macro so it can be overridden. \xrefprintnodename\printedrefname % % But we always want a comma and a space: ,\space % % output the `page 3'. \turnoffactive \putwordpage\tie\refx{#1-pg}{}% \fi \fi \endlink \endgroup} % This macro is called from \xrefX for the `[nodename]' part of xref % output. It's a separate macro only so it can be changed more easily, % since square brackets don't work well in some documents. Particularly % one that Bob is working on :). % \def\xrefprintnodename#1{[#1]} % Things referred to by \setref. % \def\Ynothing{} \def\Yomitfromtoc{} \def\Ynumbered{% \ifnum\secno=0 \putwordChapter@tie \the\chapno \else \ifnum\subsecno=0 \putwordSection@tie \the\chapno.\the\secno \else \ifnum\subsubsecno=0 \putwordSection@tie \the\chapno.\the\secno.\the\subsecno \else \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno \fi\fi\fi } \def\Yappendix{% \ifnum\secno=0 \putwordAppendix@tie @char\the\appendixno{}% \else \ifnum\subsecno=0 \putwordSection@tie @char\the\appendixno.\the\secno \else \ifnum\subsubsecno=0 \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno \else \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno \fi\fi\fi } % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME. % If its value is nonempty, SUFFIX is output afterward. % \def\refx#1#2{% {% \indexnofonts \otherbackslash \expandafter\global\expandafter\let\expandafter\thisrefX \csname XR#1\endcsname }% \ifx\thisrefX\relax % If not defined, say something at least. \angleleft un\-de\-fined\angleright \iflinks \ifhavexrefs {\toks0 = {#1}% avoid expansion of possibly-complex value \message{\linenumber Undefined cross reference `\the\toks0'.}}% \else \ifwarnedxrefs\else \global\warnedxrefstrue \message{Cross reference values unknown; you must run TeX again.}% \fi \fi \fi \else % It's defined, so just use it. \thisrefX \fi #2% Output the suffix in any case. } % This is the macro invoked by entries in the aux file. Usually it's % just a \def (we prepend XR to the control sequence name to avoid % collisions). But if this is a float type, we have more work to do. % \def\xrdef#1#2{% {% The node name might contain 8-bit characters, which in our current % implementation are changed to commands like @'e. Don't let these % mess up the control sequence name. \indexnofonts \turnoffactive \xdef\safexrefname{#1}% }% % \expandafter\gdef\csname XR\safexrefname\endcsname{#2}% remember this xref % % Was that xref control sequence that we just defined for a float? \expandafter\iffloat\csname XR\safexrefname\endcsname % it was a float, and we have the (safe) float type in \iffloattype. \expandafter\let\expandafter\floatlist \csname floatlist\iffloattype\endcsname % % Is this the first time we've seen this float type? \expandafter\ifx\floatlist\relax \toks0 = {\do}% yes, so just \do \else % had it before, so preserve previous elements in list. \toks0 = \expandafter{\floatlist\do}% \fi % % Remember this xref in the control sequence \floatlistFLOATTYPE, % for later use in \listoffloats. \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0 {\safexrefname}}% \fi } % Read the last existing aux file, if any. No error if none exists. % \def\tryauxfile{% \openin 1 \jobname.aux \ifeof 1 \else \readdatafile{aux}% \global\havexrefstrue \fi \closein 1 } \def\setupdatafile{% \catcode`\^^@=\other \catcode`\^^A=\other \catcode`\^^B=\other \catcode`\^^C=\other \catcode`\^^D=\other \catcode`\^^E=\other \catcode`\^^F=\other \catcode`\^^G=\other \catcode`\^^H=\other \catcode`\^^K=\other \catcode`\^^L=\other \catcode`\^^N=\other \catcode`\^^P=\other \catcode`\^^Q=\other \catcode`\^^R=\other \catcode`\^^S=\other \catcode`\^^T=\other \catcode`\^^U=\other \catcode`\^^V=\other \catcode`\^^W=\other \catcode`\^^X=\other \catcode`\^^Z=\other \catcode`\^^[=\other \catcode`\^^\=\other \catcode`\^^]=\other \catcode`\^^^=\other \catcode`\^^_=\other % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc. % in xref tags, i.e., node names. But since ^^e4 notation isn't % supported in the main text, it doesn't seem desirable. Furthermore, % that is not enough: for node names that actually contain a ^ % character, we would end up writing a line like this: 'xrdef {'hat % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first % argument, and \hat is not an expandable control sequence. It could % all be worked out, but why? Either we support ^^ or we don't. % % The other change necessary for this was to define \auxhat: % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter % and then to call \auxhat in \setq. % \catcode`\^=\other % % Special characters. Should be turned off anyway, but... \catcode`\~=\other \catcode`\[=\other \catcode`\]=\other \catcode`\"=\other \catcode`\_=\other \catcode`\|=\other \catcode`\<=\other \catcode`\>=\other \catcode`\$=\other \catcode`\#=\other \catcode`\&=\other \catcode`\%=\other \catcode`+=\other % avoid \+ for paranoia even though we've turned it off % % This is to support \ in node names and titles, since the \ % characters end up in a \csname. It's easier than % leaving it active and making its active definition an actual \ % character. What I don't understand is why it works in the *value* % of the xrdef. Seems like it should be a catcode12 \, and that % should not typeset properly. But it works, so I'm moving on for % now. --karl, 15jan04. \catcode`\\=\other % % Make the characters 128-255 be printing characters. {% \count1=128 \def\loop{% \catcode\count1=\other \advance\count1 by 1 \ifnum \count1<256 \loop \fi }% }% % % @ is our escape character in .aux files, and we need braces. \catcode`\{=1 \catcode`\}=2 \catcode`\@=0 } \def\readdatafile#1{% \begingroup \setupdatafile \input\jobname.#1 \endgroup} \message{insertions,} % including footnotes. \newcount \footnoteno % The trailing space in the following definition for supereject is % vital for proper filling; pages come out unaligned when you do a % pagealignmacro call if that space before the closing brace is % removed. (Generally, numeric constants should always be followed by a % space to prevent strange expansion errors.) \def\supereject{\par\penalty -20000\footnoteno =0 } % @footnotestyle is meaningful for info output only. \let\footnotestyle=\comment {\catcode `\@=11 % % Auto-number footnotes. Otherwise like plain. \gdef\footnote{% \let\indent=\ptexindent \let\noindent=\ptexnoindent \global\advance\footnoteno by \@ne \edef\thisfootno{$^{\the\footnoteno}$}% % % In case the footnote comes at the end of a sentence, preserve the % extra spacing after we do the footnote number. \let\@sf\empty \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi % % Remove inadvertent blank space before typesetting the footnote number. \unskip \thisfootno\@sf \dofootnote }% % Don't bother with the trickery in plain.tex to not require the % footnote text as a parameter. Our footnotes don't need to be so general. % % Oh yes, they do; otherwise, @ifset (and anything else that uses % \parseargline) fails inside footnotes because the tokens are fixed when % the footnote is read. --karl, 16nov96. % \gdef\dofootnote{% \insert\footins\bgroup % We want to typeset this text as a normal paragraph, even if the % footnote reference occurs in (for example) a display environment. % So reset some parameters. \hsize=\pagewidth \interlinepenalty\interfootnotelinepenalty \splittopskip\ht\strutbox % top baseline for broken footnotes \splitmaxdepth\dp\strutbox \floatingpenalty\@MM \leftskip\z@skip \rightskip\z@skip \spaceskip\z@skip \xspaceskip\z@skip \parindent\defaultparindent % \smallfonts \rm % % Because we use hanging indentation in footnotes, a @noindent appears % to exdent this text, so make it be a no-op. makeinfo does not use % hanging indentation so @noindent can still be needed within footnote % text after an @example or the like (not that this is good style). \let\noindent = \relax % % Hang the footnote text off the number. Use \everypar in case the % footnote extends for more than one paragraph. \everypar = {\hang}% \textindent{\thisfootno}% % % Don't crash into the line above the footnote text. Since this % expands into a box, it must come within the paragraph, lest it % provide a place where TeX can split the footnote. \footstrut \futurelet\next\fo@t } }%end \catcode `\@=11 % In case a @footnote appears in a vbox, save the footnote text and create % the real \insert just after the vbox finished. Otherwise, the insertion % would be lost. % Similarly, if a @footnote appears inside an alignment, save the footnote % text to a box and make the \insert when a row of the table is finished. % And the same can be done for other insert classes. --kasal, 16nov03. % Replace the \insert primitive by a cheating macro. % Deeper inside, just make sure that the saved insertions are not spilled % out prematurely. % \def\startsavinginserts{% \ifx \insert\ptexinsert \let\insert\saveinsert \else \let\checkinserts\relax \fi } % This \insert replacement works for both \insert\footins{foo} and % \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}. % \def\saveinsert#1{% \edef\next{\noexpand\savetobox \makeSAVEname#1}% \afterassignment\next % swallow the left brace \let\temp = } \def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}} \def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1} \def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi} \def\placesaveins#1{% \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname {\box#1}% } % eat @SAVE -- beware, all of them have catcode \other: { \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-) \gdef\gobblesave @SAVE{} } % initialization: \def\newsaveins #1{% \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}% \next } \def\newsaveinsX #1{% \csname newbox\endcsname #1% \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts \checksaveins #1}% } % initialize: \let\checkinserts\empty \newsaveins\footins \newsaveins\margin % @image. We use the macros from epsf.tex to support this. % If epsf.tex is not installed and @image is used, we complain. % % Check for and read epsf.tex up front. If we read it only at @image % time, we might be inside a group, and then its definitions would get % undone and the next image would fail. \openin 1 = epsf.tex \ifeof 1 \else % Do not bother showing banner with epsf.tex v2.7k (available in % doc/epsf.tex and on ctan). \def\epsfannounce{\toks0 = }% \input epsf.tex \fi \closein 1 % % We will only complain once about lack of epsf.tex. \newif\ifwarnednoepsf \newhelp\noepsfhelp{epsf.tex must be installed for images to work. It is also included in the Texinfo distribution, or you can get it from ftp://tug.org/tex/epsf.tex.} % \def\image#1{% \ifx\epsfbox\thisiundefined \ifwarnednoepsf \else \errhelp = \noepsfhelp \errmessage{epsf.tex not found, images will be ignored}% \global\warnednoepsftrue \fi \else \imagexxx #1,,,,,\finish \fi } % % Arguments to @image: % #1 is (mandatory) image filename; we tack on .eps extension. % #2 is (optional) width, #3 is (optional) height. % #4 is (ignored optional) html alt text. % #5 is (ignored optional) extension. % #6 is just the usual extra ignored arg for parsing stuff. \newif\ifimagevmode \def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup \catcode`\^^M = 5 % in case we're inside an example \normalturnoffactive % allow _ et al. in names % If the image is by itself, center it. \ifvmode \imagevmodetrue \nobreak\medskip % Usually we'll have text after the image which will insert % \parskip glue, so insert it here too to equalize the space % above and below. \nobreak\vskip\parskip \nobreak \fi % % Leave vertical mode so that indentation from an enclosing % environment such as @quotation is respected. On the other hand, if % it's at the top level, we don't want the normal paragraph indentation. \noindent % % Output the image. \ifpdf \dopdfimage{#1}{#2}{#3}% \else % \epsfbox itself resets \epsf?size at each figure. \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi \epsfbox{#1.eps}% \fi % \ifimagevmode \medskip \fi % space after the standalone image \endgroup} % @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables, % etc. We don't actually implement floating yet, we always include the % float "here". But it seemed the best name for the future. % \envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish} % There may be a space before second and/or third parameter; delete it. \def\eatcommaspace#1, {#1,} % #1 is the optional FLOATTYPE, the text label for this float, typically % "Figure", "Table", "Example", etc. Can't contain commas. If omitted, % this float will not be numbered and cannot be referred to. % % #2 is the optional xref label. Also must be present for the float to % be referable. % % #3 is the optional positioning argument; for now, it is ignored. It % will somehow specify the positions allowed to float to (here, top, bottom). % % We keep a separate counter for each FLOATTYPE, which we reset at each % chapter-level command. \let\resetallfloatnos=\empty % \def\dofloat#1,#2,#3,#4\finish{% \let\thiscaption=\empty \let\thisshortcaption=\empty % % don't lose footnotes inside @float. % % BEWARE: when the floats start float, we have to issue warning whenever an % insert appears inside a float which could possibly float. --kasal, 26may04 % \startsavinginserts % % We can't be used inside a paragraph. \par % \vtop\bgroup \def\floattype{#1}% \def\floatlabel{#2}% \def\floatloc{#3}% we do nothing with this yet. % \ifx\floattype\empty \let\safefloattype=\empty \else {% % the floattype might have accents or other special characters, % but we need to use it in a control sequence name. \indexnofonts \turnoffactive \xdef\safefloattype{\floattype}% }% \fi % % If label is given but no type, we handle that as the empty type. \ifx\floatlabel\empty \else % We want each FLOATTYPE to be numbered separately (Figure 1, % Table 1, Figure 2, ...). (And if no label, no number.) % \expandafter\getfloatno\csname\safefloattype floatno\endcsname \global\advance\floatno by 1 % {% % This magic value for \lastsection is output by \setref as the % XREFLABEL-title value. \xrefX uses it to distinguish float % labels (which have a completely different output format) from % node and anchor labels. And \xrdef uses it to construct the % lists of floats. % \edef\lastsection{\floatmagic=\safefloattype}% \setref{\floatlabel}{Yfloat}% }% \fi % % start with \parskip glue, I guess. \vskip\parskip % % Don't suppress indentation if a float happens to start a section. \restorefirstparagraphindent } % we have these possibilities: % @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap % @float Foo,lbl & no caption: Foo 1.1 % @float Foo & @caption{Cap}: Foo: Cap % @float Foo & no caption: Foo % @float ,lbl & Caption{Cap}: 1.1: Cap % @float ,lbl & no caption: 1.1 % @float & @caption{Cap}: Cap % @float & no caption: % \def\Efloat{% \let\floatident = \empty % % In all cases, if we have a float type, it comes first. \ifx\floattype\empty \else \def\floatident{\floattype}\fi % % If we have an xref label, the number comes next. \ifx\floatlabel\empty \else \ifx\floattype\empty \else % if also had float type, need tie first. \appendtomacro\floatident{\tie}% \fi % the number. \appendtomacro\floatident{\chaplevelprefix\the\floatno}% \fi % % Start the printed caption with what we've constructed in % \floatident, but keep it separate; we need \floatident again. \let\captionline = \floatident % \ifx\thiscaption\empty \else \ifx\floatident\empty \else \appendtomacro\captionline{: }% had ident, so need a colon between \fi % % caption text. \appendtomacro\captionline{\scanexp\thiscaption}% \fi % % If we have anything to print, print it, with space before. % Eventually this needs to become an \insert. \ifx\captionline\empty \else \vskip.5\parskip \captionline % % Space below caption. \vskip\parskip \fi % % If have an xref label, write the list of floats info. Do this % after the caption, to avoid chance of it being a breakpoint. \ifx\floatlabel\empty \else % Write the text that goes in the lof to the aux file as % \floatlabel-lof. Besides \floatident, we include the short % caption if specified, else the full caption if specified, else nothing. {% \atdummies % % since we read the caption text in the macro world, where ^^M % is turned into a normal character, we have to scan it back, so % we don't write the literal three characters "^^M" into the aux file. \scanexp{% \xdef\noexpand\gtemp{% \ifx\thisshortcaption\empty \thiscaption \else \thisshortcaption \fi }% }% \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident \ifx\gtemp\empty \else : \gtemp \fi}}% }% \fi \egroup % end of \vtop % % place the captured inserts % % BEWARE: when the floats start floating, we have to issue warning % whenever an insert appears inside a float which could possibly % float. --kasal, 26may04 % \checkinserts } % Append the tokens #2 to the definition of macro #1, not expanding either. % \def\appendtomacro#1#2{% \expandafter\def\expandafter#1\expandafter{#1#2}% } % @caption, @shortcaption % \def\caption{\docaption\thiscaption} \def\shortcaption{\docaption\thisshortcaption} \def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption} \def\defcaption#1#2{\egroup \def#1{#2}} % The parameter is the control sequence identifying the counter we are % going to use. Create it if it doesn't exist and assign it to \floatno. \def\getfloatno#1{% \ifx#1\relax % Haven't seen this figure type before. \csname newcount\endcsname #1% % % Remember to reset this floatno at the next chap. \expandafter\gdef\expandafter\resetallfloatnos \expandafter{\resetallfloatnos #1=0 }% \fi \let\floatno#1% } % \setref calls this to get the XREFLABEL-snt value. We want an @xref % to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we % first read the @float command. % \def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}% % Magic string used for the XREFLABEL-title value, so \xrefX can % distinguish floats from other xref types. \def\floatmagic{!!float!!} % #1 is the control sequence we are passed; we expand into a conditional % which is true if #1 represents a float ref. That is, the magic % \lastsection value which we \setref above. % \def\iffloat#1{\expandafter\doiffloat#1==\finish} % % #1 is (maybe) the \floatmagic string. If so, #2 will be the % (safe) float type for this float. We set \iffloattype to #2. % \def\doiffloat#1=#2=#3\finish{% \def\temp{#1}% \def\iffloattype{#2}% \ifx\temp\floatmagic } % @listoffloats FLOATTYPE - print a list of floats like a table of contents. % \parseargdef\listoffloats{% \def\floattype{#1}% floattype {% % the floattype might have accents or other special characters, % but we need to use it in a control sequence name. \indexnofonts \turnoffactive \xdef\safefloattype{\floattype}% }% % % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE. \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax \ifhavexrefs % if the user said @listoffloats foo but never @float foo. \message{\linenumber No `\safefloattype' floats to list.}% \fi \else \begingroup \leftskip=\tocindent % indent these entries like a toc \let\do=\listoffloatsdo \csname floatlist\safefloattype\endcsname \endgroup \fi } % This is called on each entry in a list of floats. We're passed the % xref label, in the form LABEL-title, which is how we save it in the % aux file. We strip off the -title and look up \XRLABEL-lof, which % has the text we're supposed to typeset here. % % Figures without xref labels will not be included in the list (since % they won't appear in the aux file). % \def\listoffloatsdo#1{\listoffloatsdoentry#1\finish} \def\listoffloatsdoentry#1-title\finish{{% % Can't fully expand XR#1-lof because it can contain anything. Just % pass the control sequence. On the other hand, XR#1-pg is just the % page number, and we want to fully expand that so we can get a link % in pdf output. \toksA = \expandafter{\csname XR#1-lof\endcsname}% % % use the same \entry macro we use to generate the TOC and index. \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}% \writeentry }} \message{localization,} % For single-language documents, @documentlanguage is usually given very % early, just after @documentencoding. Single argument is the language % (de) or locale (de_DE) abbreviation. % { \catcode`\_ = \active \globaldefs=1 \parseargdef\documentlanguage{\begingroup \let_=\normalunderscore % normal _ character for filenames \tex % read txi-??.tex file in plain TeX. % Read the file by the name they passed if it exists. \openin 1 txi-#1.tex \ifeof 1 \documentlanguagetrywithoutunderscore{#1_\finish}% \else \globaldefs = 1 % everything in the txi-LL files needs to persist \input txi-#1.tex \fi \closein 1 \endgroup % end raw TeX \endgroup} % % If they passed de_DE, and txi-de_DE.tex doesn't exist, % try txi-de.tex. % \gdef\documentlanguagetrywithoutunderscore#1_#2\finish{% \openin 1 txi-#1.tex \ifeof 1 \errhelp = \nolanghelp \errmessage{Cannot read language file txi-#1.tex}% \else \globaldefs = 1 % everything in the txi-LL files needs to persist \input txi-#1.tex \fi \closein 1 } }% end of special _ catcode % \newhelp\nolanghelp{The given language definition file cannot be found or is empty. Maybe you need to install it? Putting it in the current directory should work if nowhere else does.} % This macro is called from txi-??.tex files; the first argument is the % \language name to set (without the "\lang@" prefix), the second and % third args are \{left,right}hyphenmin. % % The language names to pass are determined when the format is built. % See the etex.log file created at that time, e.g., % /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log. % % With TeX Live 2008, etex now includes hyphenation patterns for all % available languages. This means we can support hyphenation in % Texinfo, at least to some extent. (This still doesn't solve the % accented characters problem.) % \catcode`@=11 \def\txisetlanguage#1#2#3{% % do not set the language if the name is undefined in the current TeX. \expandafter\ifx\csname lang@#1\endcsname \relax \message{no patterns for #1}% \else \global\language = \csname lang@#1\endcsname \fi % but there is no harm in adjusting the hyphenmin values regardless. \global\lefthyphenmin = #2\relax \global\righthyphenmin = #3\relax } % Helpers for encodings. % Set the catcode of characters 128 through 255 to the specified number. % \def\setnonasciicharscatcode#1{% \count255=128 \loop\ifnum\count255<256 \global\catcode\count255=#1\relax \advance\count255 by 1 \repeat } \def\setnonasciicharscatcodenonglobal#1{% \count255=128 \loop\ifnum\count255<256 \catcode\count255=#1\relax \advance\count255 by 1 \repeat } % @documentencoding sets the definition of non-ASCII characters % according to the specified encoding. % \parseargdef\documentencoding{% % Encoding being declared for the document. \def\declaredencoding{\csname #1.enc\endcsname}% % % Supported encodings: names converted to tokens in order to be able % to compare them with \ifx. \def\ascii{\csname US-ASCII.enc\endcsname}% \def\latnine{\csname ISO-8859-15.enc\endcsname}% \def\latone{\csname ISO-8859-1.enc\endcsname}% \def\lattwo{\csname ISO-8859-2.enc\endcsname}% \def\utfeight{\csname UTF-8.enc\endcsname}% % \ifx \declaredencoding \ascii \asciichardefs % \else \ifx \declaredencoding \lattwo \setnonasciicharscatcode\active \lattwochardefs % \else \ifx \declaredencoding \latone \setnonasciicharscatcode\active \latonechardefs % \else \ifx \declaredencoding \latnine \setnonasciicharscatcode\active \latninechardefs % \else \ifx \declaredencoding \utfeight \setnonasciicharscatcode\active \utfeightchardefs % \else \message{Unknown document encoding #1, ignoring.}% % \fi % utfeight \fi % latnine \fi % latone \fi % lattwo \fi % ascii } % A message to be logged when using a character that isn't available % the default font encoding (OT1). % \def\missingcharmsg#1{\message{Character missing in OT1 encoding: #1.}} % Take account of \c (plain) vs. \, (Texinfo) difference. \def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi} % First, make active non-ASCII characters in order for them to be % correctly categorized when TeX reads the replacement text of % macros containing the character definitions. \setnonasciicharscatcode\active % % Latin1 (ISO-8859-1) character definitions. \def\latonechardefs{% \gdef^^a0{\tie} \gdef^^a1{\exclamdown} \gdef^^a2{\missingcharmsg{CENT SIGN}} \gdef^^a3{{\pounds}} \gdef^^a4{\missingcharmsg{CURRENCY SIGN}} \gdef^^a5{\missingcharmsg{YEN SIGN}} \gdef^^a6{\missingcharmsg{BROKEN BAR}} \gdef^^a7{\S} \gdef^^a8{\"{}} \gdef^^a9{\copyright} \gdef^^aa{\ordf} \gdef^^ab{\guillemetleft} \gdef^^ac{$\lnot$} \gdef^^ad{\-} \gdef^^ae{\registeredsymbol} \gdef^^af{\={}} % \gdef^^b0{\textdegree} \gdef^^b1{$\pm$} \gdef^^b2{$^2$} \gdef^^b3{$^3$} \gdef^^b4{\'{}} \gdef^^b5{$\mu$} \gdef^^b6{\P} % \gdef^^b7{$^.$} \gdef^^b8{\cedilla\ } \gdef^^b9{$^1$} \gdef^^ba{\ordm} % \gdef^^bb{\guillemetright} \gdef^^bc{$1\over4$} \gdef^^bd{$1\over2$} \gdef^^be{$3\over4$} \gdef^^bf{\questiondown} % \gdef^^c0{\`A} \gdef^^c1{\'A} \gdef^^c2{\^A} \gdef^^c3{\~A} \gdef^^c4{\"A} \gdef^^c5{\ringaccent A} \gdef^^c6{\AE} \gdef^^c7{\cedilla C} \gdef^^c8{\`E} \gdef^^c9{\'E} \gdef^^ca{\^E} \gdef^^cb{\"E} \gdef^^cc{\`I} \gdef^^cd{\'I} \gdef^^ce{\^I} \gdef^^cf{\"I} % \gdef^^d0{\DH} \gdef^^d1{\~N} \gdef^^d2{\`O} \gdef^^d3{\'O} \gdef^^d4{\^O} \gdef^^d5{\~O} \gdef^^d6{\"O} \gdef^^d7{$\times$} \gdef^^d8{\O} \gdef^^d9{\`U} \gdef^^da{\'U} \gdef^^db{\^U} \gdef^^dc{\"U} \gdef^^dd{\'Y} \gdef^^de{\TH} \gdef^^df{\ss} % \gdef^^e0{\`a} \gdef^^e1{\'a} \gdef^^e2{\^a} \gdef^^e3{\~a} \gdef^^e4{\"a} \gdef^^e5{\ringaccent a} \gdef^^e6{\ae} \gdef^^e7{\cedilla c} \gdef^^e8{\`e} \gdef^^e9{\'e} \gdef^^ea{\^e} \gdef^^eb{\"e} \gdef^^ec{\`{\dotless i}} \gdef^^ed{\'{\dotless i}} \gdef^^ee{\^{\dotless i}} \gdef^^ef{\"{\dotless i}} % \gdef^^f0{\dh} \gdef^^f1{\~n} \gdef^^f2{\`o} \gdef^^f3{\'o} \gdef^^f4{\^o} \gdef^^f5{\~o} \gdef^^f6{\"o} \gdef^^f7{$\div$} \gdef^^f8{\o} \gdef^^f9{\`u} \gdef^^fa{\'u} \gdef^^fb{\^u} \gdef^^fc{\"u} \gdef^^fd{\'y} \gdef^^fe{\th} \gdef^^ff{\"y} } % Latin9 (ISO-8859-15) encoding character definitions. \def\latninechardefs{% % Encoding is almost identical to Latin1. \latonechardefs % \gdef^^a4{\euro} \gdef^^a6{\v S} \gdef^^a8{\v s} \gdef^^b4{\v Z} \gdef^^b8{\v z} \gdef^^bc{\OE} \gdef^^bd{\oe} \gdef^^be{\"Y} } % Latin2 (ISO-8859-2) character definitions. \def\lattwochardefs{% \gdef^^a0{\tie} \gdef^^a1{\ogonek{A}} \gdef^^a2{\u{}} \gdef^^a3{\L} \gdef^^a4{\missingcharmsg{CURRENCY SIGN}} \gdef^^a5{\v L} \gdef^^a6{\'S} \gdef^^a7{\S} \gdef^^a8{\"{}} \gdef^^a9{\v S} \gdef^^aa{\cedilla S} \gdef^^ab{\v T} \gdef^^ac{\'Z} \gdef^^ad{\-} \gdef^^ae{\v Z} \gdef^^af{\dotaccent Z} % \gdef^^b0{\textdegree} \gdef^^b1{\ogonek{a}} \gdef^^b2{\ogonek{ }} \gdef^^b3{\l} \gdef^^b4{\'{}} \gdef^^b5{\v l} \gdef^^b6{\'s} \gdef^^b7{\v{}} \gdef^^b8{\cedilla\ } \gdef^^b9{\v s} \gdef^^ba{\cedilla s} \gdef^^bb{\v t} \gdef^^bc{\'z} \gdef^^bd{\H{}} \gdef^^be{\v z} \gdef^^bf{\dotaccent z} % \gdef^^c0{\'R} \gdef^^c1{\'A} \gdef^^c2{\^A} \gdef^^c3{\u A} \gdef^^c4{\"A} \gdef^^c5{\'L} \gdef^^c6{\'C} \gdef^^c7{\cedilla C} \gdef^^c8{\v C} \gdef^^c9{\'E} \gdef^^ca{\ogonek{E}} \gdef^^cb{\"E} \gdef^^cc{\v E} \gdef^^cd{\'I} \gdef^^ce{\^I} \gdef^^cf{\v D} % \gdef^^d0{\DH} \gdef^^d1{\'N} \gdef^^d2{\v N} \gdef^^d3{\'O} \gdef^^d4{\^O} \gdef^^d5{\H O} \gdef^^d6{\"O} \gdef^^d7{$\times$} \gdef^^d8{\v R} \gdef^^d9{\ringaccent U} \gdef^^da{\'U} \gdef^^db{\H U} \gdef^^dc{\"U} \gdef^^dd{\'Y} \gdef^^de{\cedilla T} \gdef^^df{\ss} % \gdef^^e0{\'r} \gdef^^e1{\'a} \gdef^^e2{\^a} \gdef^^e3{\u a} \gdef^^e4{\"a} \gdef^^e5{\'l} \gdef^^e6{\'c} \gdef^^e7{\cedilla c} \gdef^^e8{\v c} \gdef^^e9{\'e} \gdef^^ea{\ogonek{e}} \gdef^^eb{\"e} \gdef^^ec{\v e} \gdef^^ed{\'{\dotless{i}}} \gdef^^ee{\^{\dotless{i}}} \gdef^^ef{\v d} % \gdef^^f0{\dh} \gdef^^f1{\'n} \gdef^^f2{\v n} \gdef^^f3{\'o} \gdef^^f4{\^o} \gdef^^f5{\H o} \gdef^^f6{\"o} \gdef^^f7{$\div$} \gdef^^f8{\v r} \gdef^^f9{\ringaccent u} \gdef^^fa{\'u} \gdef^^fb{\H u} \gdef^^fc{\"u} \gdef^^fd{\'y} \gdef^^fe{\cedilla t} \gdef^^ff{\dotaccent{}} } % UTF-8 character definitions. % % This code to support UTF-8 is based on LaTeX's utf8.def, with some % changes for Texinfo conventions. It is included here under the GPL by % permission from Frank Mittelbach and the LaTeX team. % \newcount\countUTFx \newcount\countUTFy \newcount\countUTFz \gdef\UTFviiiTwoOctets#1#2{\expandafter \UTFviiiDefined\csname u8:#1\string #2\endcsname} % \gdef\UTFviiiThreeOctets#1#2#3{\expandafter \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname} % \gdef\UTFviiiFourOctets#1#2#3#4{\expandafter \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname} \gdef\UTFviiiDefined#1{% \ifx #1\relax \message{\linenumber Unicode char \string #1 not defined for Texinfo}% \else \expandafter #1% \fi } \begingroup \catcode`\~13 \catcode`\"12 \def\UTFviiiLoop{% \global\catcode\countUTFx\active \uccode`\~\countUTFx \uppercase\expandafter{\UTFviiiTmp}% \advance\countUTFx by 1 \ifnum\countUTFx < \countUTFy \expandafter\UTFviiiLoop \fi} \countUTFx = "C2 \countUTFy = "E0 \def\UTFviiiTmp{% \xdef~{\noexpand\UTFviiiTwoOctets\string~}} \UTFviiiLoop \countUTFx = "E0 \countUTFy = "F0 \def\UTFviiiTmp{% \xdef~{\noexpand\UTFviiiThreeOctets\string~}} \UTFviiiLoop \countUTFx = "F0 \countUTFy = "F4 \def\UTFviiiTmp{% \xdef~{\noexpand\UTFviiiFourOctets\string~}} \UTFviiiLoop \endgroup \begingroup \catcode`\"=12 \catcode`\<=12 \catcode`\.=12 \catcode`\,=12 \catcode`\;=12 \catcode`\!=12 \catcode`\~=13 \gdef\DeclareUnicodeCharacter#1#2{% \countUTFz = "#1\relax %\wlog{\space\space defining Unicode char U+#1 (decimal \the\countUTFz)}% \begingroup \parseXMLCharref \def\UTFviiiTwoOctets##1##2{% \csname u8:##1\string ##2\endcsname}% \def\UTFviiiThreeOctets##1##2##3{% \csname u8:##1\string ##2\string ##3\endcsname}% \def\UTFviiiFourOctets##1##2##3##4{% \csname u8:##1\string ##2\string ##3\string ##4\endcsname}% \expandafter\expandafter\expandafter\expandafter \expandafter\expandafter\expandafter \gdef\UTFviiiTmp{#2}% \endgroup} \gdef\parseXMLCharref{% \ifnum\countUTFz < "A0\relax \errhelp = \EMsimple \errmessage{Cannot define Unicode char value < 00A0}% \else\ifnum\countUTFz < "800\relax \parseUTFviiiA,% \parseUTFviiiB C\UTFviiiTwoOctets.,% \else\ifnum\countUTFz < "10000\relax \parseUTFviiiA;% \parseUTFviiiA,% \parseUTFviiiB E\UTFviiiThreeOctets.{,;}% \else \parseUTFviiiA;% \parseUTFviiiA,% \parseUTFviiiA!% \parseUTFviiiB F\UTFviiiFourOctets.{!,;}% \fi\fi\fi } \gdef\parseUTFviiiA#1{% \countUTFx = \countUTFz \divide\countUTFz by 64 \countUTFy = \countUTFz \multiply\countUTFz by 64 \advance\countUTFx by -\countUTFz \advance\countUTFx by 128 \uccode `#1\countUTFx \countUTFz = \countUTFy} \gdef\parseUTFviiiB#1#2#3#4{% \advance\countUTFz by "#10\relax \uccode `#3\countUTFz \uppercase{\gdef\UTFviiiTmp{#2#3#4}}} \endgroup \def\utfeightchardefs{% \DeclareUnicodeCharacter{00A0}{\tie} \DeclareUnicodeCharacter{00A1}{\exclamdown} \DeclareUnicodeCharacter{00A3}{\pounds} \DeclareUnicodeCharacter{00A8}{\"{ }} \DeclareUnicodeCharacter{00A9}{\copyright} \DeclareUnicodeCharacter{00AA}{\ordf} \DeclareUnicodeCharacter{00AB}{\guillemetleft} \DeclareUnicodeCharacter{00AD}{\-} \DeclareUnicodeCharacter{00AE}{\registeredsymbol} \DeclareUnicodeCharacter{00AF}{\={ }} \DeclareUnicodeCharacter{00B0}{\ringaccent{ }} \DeclareUnicodeCharacter{00B4}{\'{ }} \DeclareUnicodeCharacter{00B8}{\cedilla{ }} \DeclareUnicodeCharacter{00BA}{\ordm} \DeclareUnicodeCharacter{00BB}{\guillemetright} \DeclareUnicodeCharacter{00BF}{\questiondown} \DeclareUnicodeCharacter{00C0}{\`A} \DeclareUnicodeCharacter{00C1}{\'A} \DeclareUnicodeCharacter{00C2}{\^A} \DeclareUnicodeCharacter{00C3}{\~A} \DeclareUnicodeCharacter{00C4}{\"A} \DeclareUnicodeCharacter{00C5}{\AA} \DeclareUnicodeCharacter{00C6}{\AE} \DeclareUnicodeCharacter{00C7}{\cedilla{C}} \DeclareUnicodeCharacter{00C8}{\`E} \DeclareUnicodeCharacter{00C9}{\'E} \DeclareUnicodeCharacter{00CA}{\^E} \DeclareUnicodeCharacter{00CB}{\"E} \DeclareUnicodeCharacter{00CC}{\`I} \DeclareUnicodeCharacter{00CD}{\'I} \DeclareUnicodeCharacter{00CE}{\^I} \DeclareUnicodeCharacter{00CF}{\"I} \DeclareUnicodeCharacter{00D0}{\DH} \DeclareUnicodeCharacter{00D1}{\~N} \DeclareUnicodeCharacter{00D2}{\`O} \DeclareUnicodeCharacter{00D3}{\'O} \DeclareUnicodeCharacter{00D4}{\^O} \DeclareUnicodeCharacter{00D5}{\~O} \DeclareUnicodeCharacter{00D6}{\"O} \DeclareUnicodeCharacter{00D8}{\O} \DeclareUnicodeCharacter{00D9}{\`U} \DeclareUnicodeCharacter{00DA}{\'U} \DeclareUnicodeCharacter{00DB}{\^U} \DeclareUnicodeCharacter{00DC}{\"U} \DeclareUnicodeCharacter{00DD}{\'Y} \DeclareUnicodeCharacter{00DE}{\TH} \DeclareUnicodeCharacter{00DF}{\ss} \DeclareUnicodeCharacter{00E0}{\`a} \DeclareUnicodeCharacter{00E1}{\'a} \DeclareUnicodeCharacter{00E2}{\^a} \DeclareUnicodeCharacter{00E3}{\~a} \DeclareUnicodeCharacter{00E4}{\"a} \DeclareUnicodeCharacter{00E5}{\aa} \DeclareUnicodeCharacter{00E6}{\ae} \DeclareUnicodeCharacter{00E7}{\cedilla{c}} \DeclareUnicodeCharacter{00E8}{\`e} \DeclareUnicodeCharacter{00E9}{\'e} \DeclareUnicodeCharacter{00EA}{\^e} \DeclareUnicodeCharacter{00EB}{\"e} \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}} \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}} \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}} \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}} \DeclareUnicodeCharacter{00F0}{\dh} \DeclareUnicodeCharacter{00F1}{\~n} \DeclareUnicodeCharacter{00F2}{\`o} \DeclareUnicodeCharacter{00F3}{\'o} \DeclareUnicodeCharacter{00F4}{\^o} \DeclareUnicodeCharacter{00F5}{\~o} \DeclareUnicodeCharacter{00F6}{\"o} \DeclareUnicodeCharacter{00F8}{\o} \DeclareUnicodeCharacter{00F9}{\`u} \DeclareUnicodeCharacter{00FA}{\'u} \DeclareUnicodeCharacter{00FB}{\^u} \DeclareUnicodeCharacter{00FC}{\"u} \DeclareUnicodeCharacter{00FD}{\'y} \DeclareUnicodeCharacter{00FE}{\th} \DeclareUnicodeCharacter{00FF}{\"y} \DeclareUnicodeCharacter{0100}{\=A} \DeclareUnicodeCharacter{0101}{\=a} \DeclareUnicodeCharacter{0102}{\u{A}} \DeclareUnicodeCharacter{0103}{\u{a}} \DeclareUnicodeCharacter{0104}{\ogonek{A}} \DeclareUnicodeCharacter{0105}{\ogonek{a}} \DeclareUnicodeCharacter{0106}{\'C} \DeclareUnicodeCharacter{0107}{\'c} \DeclareUnicodeCharacter{0108}{\^C} \DeclareUnicodeCharacter{0109}{\^c} \DeclareUnicodeCharacter{0118}{\ogonek{E}} \DeclareUnicodeCharacter{0119}{\ogonek{e}} \DeclareUnicodeCharacter{010A}{\dotaccent{C}} \DeclareUnicodeCharacter{010B}{\dotaccent{c}} \DeclareUnicodeCharacter{010C}{\v{C}} \DeclareUnicodeCharacter{010D}{\v{c}} \DeclareUnicodeCharacter{010E}{\v{D}} \DeclareUnicodeCharacter{0112}{\=E} \DeclareUnicodeCharacter{0113}{\=e} \DeclareUnicodeCharacter{0114}{\u{E}} \DeclareUnicodeCharacter{0115}{\u{e}} \DeclareUnicodeCharacter{0116}{\dotaccent{E}} \DeclareUnicodeCharacter{0117}{\dotaccent{e}} \DeclareUnicodeCharacter{011A}{\v{E}} \DeclareUnicodeCharacter{011B}{\v{e}} \DeclareUnicodeCharacter{011C}{\^G} \DeclareUnicodeCharacter{011D}{\^g} \DeclareUnicodeCharacter{011E}{\u{G}} \DeclareUnicodeCharacter{011F}{\u{g}} \DeclareUnicodeCharacter{0120}{\dotaccent{G}} \DeclareUnicodeCharacter{0121}{\dotaccent{g}} \DeclareUnicodeCharacter{0124}{\^H} \DeclareUnicodeCharacter{0125}{\^h} \DeclareUnicodeCharacter{0128}{\~I} \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}} \DeclareUnicodeCharacter{012A}{\=I} \DeclareUnicodeCharacter{012B}{\={\dotless{i}}} \DeclareUnicodeCharacter{012C}{\u{I}} \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}} \DeclareUnicodeCharacter{0130}{\dotaccent{I}} \DeclareUnicodeCharacter{0131}{\dotless{i}} \DeclareUnicodeCharacter{0132}{IJ} \DeclareUnicodeCharacter{0133}{ij} \DeclareUnicodeCharacter{0134}{\^J} \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}} \DeclareUnicodeCharacter{0139}{\'L} \DeclareUnicodeCharacter{013A}{\'l} \DeclareUnicodeCharacter{0141}{\L} \DeclareUnicodeCharacter{0142}{\l} \DeclareUnicodeCharacter{0143}{\'N} \DeclareUnicodeCharacter{0144}{\'n} \DeclareUnicodeCharacter{0147}{\v{N}} \DeclareUnicodeCharacter{0148}{\v{n}} \DeclareUnicodeCharacter{014C}{\=O} \DeclareUnicodeCharacter{014D}{\=o} \DeclareUnicodeCharacter{014E}{\u{O}} \DeclareUnicodeCharacter{014F}{\u{o}} \DeclareUnicodeCharacter{0150}{\H{O}} \DeclareUnicodeCharacter{0151}{\H{o}} \DeclareUnicodeCharacter{0152}{\OE} \DeclareUnicodeCharacter{0153}{\oe} \DeclareUnicodeCharacter{0154}{\'R} \DeclareUnicodeCharacter{0155}{\'r} \DeclareUnicodeCharacter{0158}{\v{R}} \DeclareUnicodeCharacter{0159}{\v{r}} \DeclareUnicodeCharacter{015A}{\'S} \DeclareUnicodeCharacter{015B}{\'s} \DeclareUnicodeCharacter{015C}{\^S} \DeclareUnicodeCharacter{015D}{\^s} \DeclareUnicodeCharacter{015E}{\cedilla{S}} \DeclareUnicodeCharacter{015F}{\cedilla{s}} \DeclareUnicodeCharacter{0160}{\v{S}} \DeclareUnicodeCharacter{0161}{\v{s}} \DeclareUnicodeCharacter{0162}{\cedilla{t}} \DeclareUnicodeCharacter{0163}{\cedilla{T}} \DeclareUnicodeCharacter{0164}{\v{T}} \DeclareUnicodeCharacter{0168}{\~U} \DeclareUnicodeCharacter{0169}{\~u} \DeclareUnicodeCharacter{016A}{\=U} \DeclareUnicodeCharacter{016B}{\=u} \DeclareUnicodeCharacter{016C}{\u{U}} \DeclareUnicodeCharacter{016D}{\u{u}} \DeclareUnicodeCharacter{016E}{\ringaccent{U}} \DeclareUnicodeCharacter{016F}{\ringaccent{u}} \DeclareUnicodeCharacter{0170}{\H{U}} \DeclareUnicodeCharacter{0171}{\H{u}} \DeclareUnicodeCharacter{0174}{\^W} \DeclareUnicodeCharacter{0175}{\^w} \DeclareUnicodeCharacter{0176}{\^Y} \DeclareUnicodeCharacter{0177}{\^y} \DeclareUnicodeCharacter{0178}{\"Y} \DeclareUnicodeCharacter{0179}{\'Z} \DeclareUnicodeCharacter{017A}{\'z} \DeclareUnicodeCharacter{017B}{\dotaccent{Z}} \DeclareUnicodeCharacter{017C}{\dotaccent{z}} \DeclareUnicodeCharacter{017D}{\v{Z}} \DeclareUnicodeCharacter{017E}{\v{z}} \DeclareUnicodeCharacter{01C4}{D\v{Z}} \DeclareUnicodeCharacter{01C5}{D\v{z}} \DeclareUnicodeCharacter{01C6}{d\v{z}} \DeclareUnicodeCharacter{01C7}{LJ} \DeclareUnicodeCharacter{01C8}{Lj} \DeclareUnicodeCharacter{01C9}{lj} \DeclareUnicodeCharacter{01CA}{NJ} \DeclareUnicodeCharacter{01CB}{Nj} \DeclareUnicodeCharacter{01CC}{nj} \DeclareUnicodeCharacter{01CD}{\v{A}} \DeclareUnicodeCharacter{01CE}{\v{a}} \DeclareUnicodeCharacter{01CF}{\v{I}} \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}} \DeclareUnicodeCharacter{01D1}{\v{O}} \DeclareUnicodeCharacter{01D2}{\v{o}} \DeclareUnicodeCharacter{01D3}{\v{U}} \DeclareUnicodeCharacter{01D4}{\v{u}} \DeclareUnicodeCharacter{01E2}{\={\AE}} \DeclareUnicodeCharacter{01E3}{\={\ae}} \DeclareUnicodeCharacter{01E6}{\v{G}} \DeclareUnicodeCharacter{01E7}{\v{g}} \DeclareUnicodeCharacter{01E8}{\v{K}} \DeclareUnicodeCharacter{01E9}{\v{k}} \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}} \DeclareUnicodeCharacter{01F1}{DZ} \DeclareUnicodeCharacter{01F2}{Dz} \DeclareUnicodeCharacter{01F3}{dz} \DeclareUnicodeCharacter{01F4}{\'G} \DeclareUnicodeCharacter{01F5}{\'g} \DeclareUnicodeCharacter{01F8}{\`N} \DeclareUnicodeCharacter{01F9}{\`n} \DeclareUnicodeCharacter{01FC}{\'{\AE}} \DeclareUnicodeCharacter{01FD}{\'{\ae}} \DeclareUnicodeCharacter{01FE}{\'{\O}} \DeclareUnicodeCharacter{01FF}{\'{\o}} \DeclareUnicodeCharacter{021E}{\v{H}} \DeclareUnicodeCharacter{021F}{\v{h}} \DeclareUnicodeCharacter{0226}{\dotaccent{A}} \DeclareUnicodeCharacter{0227}{\dotaccent{a}} \DeclareUnicodeCharacter{0228}{\cedilla{E}} \DeclareUnicodeCharacter{0229}{\cedilla{e}} \DeclareUnicodeCharacter{022E}{\dotaccent{O}} \DeclareUnicodeCharacter{022F}{\dotaccent{o}} \DeclareUnicodeCharacter{0232}{\=Y} \DeclareUnicodeCharacter{0233}{\=y} \DeclareUnicodeCharacter{0237}{\dotless{j}} \DeclareUnicodeCharacter{02DB}{\ogonek{ }} \DeclareUnicodeCharacter{1E02}{\dotaccent{B}} \DeclareUnicodeCharacter{1E03}{\dotaccent{b}} \DeclareUnicodeCharacter{1E04}{\udotaccent{B}} \DeclareUnicodeCharacter{1E05}{\udotaccent{b}} \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}} \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}} \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}} \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}} \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}} \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}} \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}} \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}} \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}} \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}} \DeclareUnicodeCharacter{1E20}{\=G} \DeclareUnicodeCharacter{1E21}{\=g} \DeclareUnicodeCharacter{1E22}{\dotaccent{H}} \DeclareUnicodeCharacter{1E23}{\dotaccent{h}} \DeclareUnicodeCharacter{1E24}{\udotaccent{H}} \DeclareUnicodeCharacter{1E25}{\udotaccent{h}} \DeclareUnicodeCharacter{1E26}{\"H} \DeclareUnicodeCharacter{1E27}{\"h} \DeclareUnicodeCharacter{1E30}{\'K} \DeclareUnicodeCharacter{1E31}{\'k} \DeclareUnicodeCharacter{1E32}{\udotaccent{K}} \DeclareUnicodeCharacter{1E33}{\udotaccent{k}} \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}} \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}} \DeclareUnicodeCharacter{1E36}{\udotaccent{L}} \DeclareUnicodeCharacter{1E37}{\udotaccent{l}} \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}} \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}} \DeclareUnicodeCharacter{1E3E}{\'M} \DeclareUnicodeCharacter{1E3F}{\'m} \DeclareUnicodeCharacter{1E40}{\dotaccent{M}} \DeclareUnicodeCharacter{1E41}{\dotaccent{m}} \DeclareUnicodeCharacter{1E42}{\udotaccent{M}} \DeclareUnicodeCharacter{1E43}{\udotaccent{m}} \DeclareUnicodeCharacter{1E44}{\dotaccent{N}} \DeclareUnicodeCharacter{1E45}{\dotaccent{n}} \DeclareUnicodeCharacter{1E46}{\udotaccent{N}} \DeclareUnicodeCharacter{1E47}{\udotaccent{n}} \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}} \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}} \DeclareUnicodeCharacter{1E54}{\'P} \DeclareUnicodeCharacter{1E55}{\'p} \DeclareUnicodeCharacter{1E56}{\dotaccent{P}} \DeclareUnicodeCharacter{1E57}{\dotaccent{p}} \DeclareUnicodeCharacter{1E58}{\dotaccent{R}} \DeclareUnicodeCharacter{1E59}{\dotaccent{r}} \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}} \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}} \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}} \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}} \DeclareUnicodeCharacter{1E60}{\dotaccent{S}} \DeclareUnicodeCharacter{1E61}{\dotaccent{s}} \DeclareUnicodeCharacter{1E62}{\udotaccent{S}} \DeclareUnicodeCharacter{1E63}{\udotaccent{s}} \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}} \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}} \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}} \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}} \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}} \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}} \DeclareUnicodeCharacter{1E7C}{\~V} \DeclareUnicodeCharacter{1E7D}{\~v} \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}} \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}} \DeclareUnicodeCharacter{1E80}{\`W} \DeclareUnicodeCharacter{1E81}{\`w} \DeclareUnicodeCharacter{1E82}{\'W} \DeclareUnicodeCharacter{1E83}{\'w} \DeclareUnicodeCharacter{1E84}{\"W} \DeclareUnicodeCharacter{1E85}{\"w} \DeclareUnicodeCharacter{1E86}{\dotaccent{W}} \DeclareUnicodeCharacter{1E87}{\dotaccent{w}} \DeclareUnicodeCharacter{1E88}{\udotaccent{W}} \DeclareUnicodeCharacter{1E89}{\udotaccent{w}} \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}} \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}} \DeclareUnicodeCharacter{1E8C}{\"X} \DeclareUnicodeCharacter{1E8D}{\"x} \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}} \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}} \DeclareUnicodeCharacter{1E90}{\^Z} \DeclareUnicodeCharacter{1E91}{\^z} \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}} \DeclareUnicodeCharacter{1E93}{\udotaccent{z}} \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}} \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}} \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}} \DeclareUnicodeCharacter{1E97}{\"t} \DeclareUnicodeCharacter{1E98}{\ringaccent{w}} \DeclareUnicodeCharacter{1E99}{\ringaccent{y}} \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}} \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}} \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}} \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}} \DeclareUnicodeCharacter{1EBC}{\~E} \DeclareUnicodeCharacter{1EBD}{\~e} \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}} \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}} \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}} \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}} \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}} \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}} \DeclareUnicodeCharacter{1EF2}{\`Y} \DeclareUnicodeCharacter{1EF3}{\`y} \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}} \DeclareUnicodeCharacter{1EF8}{\~Y} \DeclareUnicodeCharacter{1EF9}{\~y} \DeclareUnicodeCharacter{2013}{--} \DeclareUnicodeCharacter{2014}{---} \DeclareUnicodeCharacter{2018}{\quoteleft} \DeclareUnicodeCharacter{2019}{\quoteright} \DeclareUnicodeCharacter{201A}{\quotesinglbase} \DeclareUnicodeCharacter{201C}{\quotedblleft} \DeclareUnicodeCharacter{201D}{\quotedblright} \DeclareUnicodeCharacter{201E}{\quotedblbase} \DeclareUnicodeCharacter{2022}{\bullet} \DeclareUnicodeCharacter{2026}{\dots} \DeclareUnicodeCharacter{2039}{\guilsinglleft} \DeclareUnicodeCharacter{203A}{\guilsinglright} \DeclareUnicodeCharacter{20AC}{\euro} \DeclareUnicodeCharacter{2192}{\expansion} \DeclareUnicodeCharacter{21D2}{\result} \DeclareUnicodeCharacter{2212}{\minus} \DeclareUnicodeCharacter{2217}{\point} \DeclareUnicodeCharacter{2261}{\equiv} }% end of \utfeightchardefs % US-ASCII character definitions. \def\asciichardefs{% nothing need be done \relax } % Make non-ASCII characters printable again for compatibility with % existing Texinfo documents that may use them, even without declaring a % document encoding. % \setnonasciicharscatcode \other \message{formatting,} \newdimen\defaultparindent \defaultparindent = 15pt \chapheadingskip = 15pt plus 4pt minus 2pt \secheadingskip = 12pt plus 3pt minus 2pt \subsecheadingskip = 9pt plus 2pt minus 2pt % Prevent underfull vbox error messages. \vbadness = 10000 % Don't be very finicky about underfull hboxes, either. \hbadness = 6666 % Following George Bush, get rid of widows and orphans. \widowpenalty=10000 \clubpenalty=10000 % Use TeX 3.0's \emergencystretch to help line breaking, but if we're % using an old version of TeX, don't do anything. We want the amount of % stretch added to depend on the line length, hence the dependence on % \hsize. We call this whenever the paper size is set. % \def\setemergencystretch{% \ifx\emergencystretch\thisisundefined % Allow us to assign to \emergencystretch anyway. \def\emergencystretch{\dimen0}% \else \emergencystretch = .15\hsize \fi } % Parameters in order: 1) textheight; 2) textwidth; % 3) voffset; 4) hoffset; 5) binding offset; 6) topskip; % 7) physical page height; 8) physical page width. % % We also call \setleading{\textleading}, so the caller should define % \textleading. The caller should also set \parskip. % \def\internalpagesizes#1#2#3#4#5#6#7#8{% \voffset = #3\relax \topskip = #6\relax \splittopskip = \topskip % \vsize = #1\relax \advance\vsize by \topskip \outervsize = \vsize \advance\outervsize by 2\topandbottommargin \pageheight = \vsize % \hsize = #2\relax \outerhsize = \hsize \advance\outerhsize by 0.5in \pagewidth = \hsize % \normaloffset = #4\relax \bindingoffset = #5\relax % \ifpdf \pdfpageheight #7\relax \pdfpagewidth #8\relax % if we don't reset these, they will remain at "1 true in" of % whatever layout pdftex was dumped with. \pdfhorigin = 1 true in \pdfvorigin = 1 true in \fi % \setleading{\textleading} % \parindent = \defaultparindent \setemergencystretch } % @letterpaper (the default). \def\letterpaper{{\globaldefs = 1 \parskip = 3pt plus 2pt minus 1pt \textleading = 13.2pt % % If page is nothing but text, make it come out even. \internalpagesizes{607.2pt}{6in}% that's 46 lines {\voffset}{.25in}% {\bindingoffset}{36pt}% {11in}{8.5in}% }} % Use @smallbook to reset parameters for 7x9.25 trim size. \def\smallbook{{\globaldefs = 1 \parskip = 2pt plus 1pt \textleading = 12pt % \internalpagesizes{7.5in}{5in}% {-.2in}{0in}% {\bindingoffset}{16pt}% {9.25in}{7in}% % \lispnarrowing = 0.3in \tolerance = 700 \hfuzz = 1pt \contentsrightmargin = 0pt \defbodyindent = .5cm }} % Use @smallerbook to reset parameters for 6x9 trim size. % (Just testing, parameters still in flux.) \def\smallerbook{{\globaldefs = 1 \parskip = 1.5pt plus 1pt \textleading = 12pt % \internalpagesizes{7.4in}{4.8in}% {-.2in}{-.4in}% {0pt}{14pt}% {9in}{6in}% % \lispnarrowing = 0.25in \tolerance = 700 \hfuzz = 1pt \contentsrightmargin = 0pt \defbodyindent = .4cm }} % Use @afourpaper to print on European A4 paper. \def\afourpaper{{\globaldefs = 1 \parskip = 3pt plus 2pt minus 1pt \textleading = 13.2pt % % Double-side printing via postscript on Laserjet 4050 % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm. % To change the settings for a different printer or situation, adjust % \normaloffset until the front-side and back-side texts align. Then % do the same for \bindingoffset. You can set these for testing in % your texinfo source file like this: % @tex % \global\normaloffset = -6mm % \global\bindingoffset = 10mm % @end tex \internalpagesizes{673.2pt}{160mm}% that's 51 lines {\voffset}{\hoffset}% {\bindingoffset}{44pt}% {297mm}{210mm}% % \tolerance = 700 \hfuzz = 1pt \contentsrightmargin = 0pt \defbodyindent = 5mm }} % Use @afivepaper to print on European A5 paper. % From romildo@urano.iceb.ufop.br, 2 July 2000. % He also recommends making @example and @lisp be small. \def\afivepaper{{\globaldefs = 1 \parskip = 2pt plus 1pt minus 0.1pt \textleading = 12.5pt % \internalpagesizes{160mm}{120mm}% {\voffset}{\hoffset}% {\bindingoffset}{8pt}% {210mm}{148mm}% % \lispnarrowing = 0.2in \tolerance = 800 \hfuzz = 1.2pt \contentsrightmargin = 0pt \defbodyindent = 2mm \tableindent = 12mm }} % A specific text layout, 24x15cm overall, intended for A4 paper. \def\afourlatex{{\globaldefs = 1 \afourpaper \internalpagesizes{237mm}{150mm}% {\voffset}{4.6mm}% {\bindingoffset}{7mm}% {297mm}{210mm}% % % Must explicitly reset to 0 because we call \afourpaper. \globaldefs = 0 }} % Use @afourwide to print on A4 paper in landscape format. \def\afourwide{{\globaldefs = 1 \afourpaper \internalpagesizes{241mm}{165mm}% {\voffset}{-2.95mm}% {\bindingoffset}{7mm}% {297mm}{210mm}% \globaldefs = 0 }} % @pagesizes TEXTHEIGHT[,TEXTWIDTH] % Perhaps we should allow setting the margins, \topskip, \parskip, % and/or leading, also. Or perhaps we should compute them somehow. % \parseargdef\pagesizes{\pagesizesyyy #1,,\finish} \def\pagesizesyyy#1,#2,#3\finish{{% \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi \globaldefs = 1 % \parskip = 3pt plus 2pt minus 1pt \setleading{\textleading}% % \dimen0 = #1\relax \advance\dimen0 by \voffset % \dimen2 = \hsize \advance\dimen2 by \normaloffset % \internalpagesizes{#1}{\hsize}% {\voffset}{\normaloffset}% {\bindingoffset}{44pt}% {\dimen0}{\dimen2}% }} % Set default to letter. % \letterpaper \message{and turning on texinfo input format.} \def^^L{\par} % remove \outer, so ^L can appear in an @comment % DEL is a comment character, in case @c does not suffice. \catcode`\^^? = 14 % Define macros to output various characters with catcode for normal text. \catcode`\"=\other \def\normaldoublequote{"} \catcode`\$=\other \def\normaldollar{$}%$ font-lock fix \catcode`\+=\other \def\normalplus{+} \catcode`\<=\other \def\normalless{<} \catcode`\>=\other \def\normalgreater{>} \catcode`\^=\other \def\normalcaret{^} \catcode`\_=\other \def\normalunderscore{_} \catcode`\|=\other \def\normalverticalbar{|} \catcode`\~=\other \def\normaltilde{~} % This macro is used to make a character print one way in \tt % (where it can probably be output as-is), and another way in other fonts, % where something hairier probably needs to be done. % % #1 is what to print if we are indeed using \tt; #2 is what to print % otherwise. Since all the Computer Modern typewriter fonts have zero % interword stretch (and shrink), and it is reasonable to expect all % typewriter fonts to have this, we can check that font parameter. % \def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi} % Same as above, but check for italic font. Actually this also catches % non-italic slanted fonts since it is impossible to distinguish them from % italic fonts. But since this is only used by $ and it uses \sl anyway % this is not a problem. \def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi} % Turn off all special characters except @ % (and those which the user can use as if they were ordinary). % Most of these we simply print from the \tt font, but for some, we can % use math or other variants that look better in normal text. \catcode`\"=\active \def\activedoublequote{{\tt\char34}} \let"=\activedoublequote \catcode`\~=\active \def~{{\tt\char126}} \chardef\hat=`\^ \catcode`\^=\active \def^{{\tt \hat}} \catcode`\_=\active \def_{\ifusingtt\normalunderscore\_} \let\realunder=_ % Subroutine for the previous macro. \def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em } \catcode`\|=\active \def|{{\tt\char124}} \chardef \less=`\< \catcode`\<=\active \def<{{\tt \less}} \chardef \gtr=`\> \catcode`\>=\active \def>{{\tt \gtr}} \catcode`\+=\active \def+{{\tt \char 43}} \catcode`\$=\active \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix % If a .fmt file is being used, characters that might appear in a file % name cannot be active until we have parsed the command line. % So turn them off again, and have \everyjob (or @setfilename) turn them on. % \otherifyactive is called near the end of this file. \def\otherifyactive{\catcode`+=\other \catcode`\_=\other} % Used sometimes to turn off (effectively) the active characters even after % parsing them. \def\turnoffactive{% \normalturnoffactive \otherbackslash } \catcode`\@=0 % \backslashcurfont outputs one backslash character in current font, % as in \char`\\. \global\chardef\backslashcurfont=`\\ \global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work % \realbackslash is an actual character `\' with catcode other, and % \doublebackslash is two of them (for the pdf outlines). {\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}} % In texinfo, backslash is an active character; it prints the backslash % in fixed width font. \catcode`\\=\active @def@normalbackslash{{@tt@backslashcurfont}} % On startup, @fixbackslash assigns: % @let \ = @normalbackslash % \rawbackslash defines an active \ to do \backslashcurfont. % \otherbackslash defines an active \ to be a literal `\' character with % catcode other. @gdef@rawbackslash{@let\=@backslashcurfont} @gdef@otherbackslash{@let\=@realbackslash} % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of % the literal character `\'. % @def@normalturnoffactive{% @let"=@normaldoublequote @let$=@normaldollar %$ font-lock fix @let+=@normalplus @let<=@normalless @let>=@normalgreater @let\=@normalbackslash @let^=@normalcaret @let_=@normalunderscore @let|=@normalverticalbar @let~=@normaltilde @markupsetuplqdefault @markupsetuprqdefault @unsepspaces } % Make _ and + \other characters, temporarily. % This is canceled by @fixbackslash. @otherifyactive % If a .fmt file is being used, we don't want the `\input texinfo' to show up. % That is what \eatinput is for; after that, the `\' should revert to printing % a backslash. % @gdef@eatinput input texinfo{@fixbackslash} @global@let\ = @eatinput % On the other hand, perhaps the file did not have a `\input texinfo'. Then % the first `\' in the file would cause an error. This macro tries to fix % that, assuming it is called before the first `\' could plausibly occur. % Also turn back on active characters that might appear in the input % file name, in case not using a pre-dumped format. % @gdef@fixbackslash{% @ifx\@eatinput @let\ = @normalbackslash @fi @catcode`+=@active @catcode`@_=@active } % Say @foo, not \foo, in error messages. @escapechar = `@@ % These (along with & and #) are made active for url-breaking, so need % active definitions as the normal characters. @def@normaldot{.} @def@normalquest{?} @def@normalslash{/} % These look ok in all fonts, so just make them not special. @catcode`@& = @other @def@normalamp{&} @catcode`@# = @other @def@normalhash{#} @catcode`@% = @other @def@normalpercent{%} @c Finally, make ` and ' active, so that txicodequoteundirected and @c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}. If we @c don't make ` and ' active, @code will not get them as active chars. @c Do this last of all since we use ` in the previous @catcode assignments. @catcode`@'=@active @catcode`@`=@active @markupsetuplqdefault @markupsetuprqdefault @c Local variables: @c eval: (add-hook 'write-file-hooks 'time-stamp) @c page-delimiter: "^\\\\message" @c time-stamp-start: "def\\\\texinfoversion{" @c time-stamp-format: "%:y-%02m-%02d.%02H" @c time-stamp-end: "}" @c End: @c vim:sw=2: @ignore arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115 @end ignore unuran-1.11.0/doc/src/unuran_src.texi0000644001357500135600000377743014430713446014476 00000000000000@c automatically generated by `make_texi.pl' @c ------------------------------------- @c top.dh @c @node TOP @top UNU.RAN -- Universal Non-Uniform RANdom number generators @menu * Intro:: Introduction * Examples:: Examples * StringAPI:: String Interface * Distribution_objects:: Handling distribution objects * Methods:: Methods for generating non-uniform random variates * URNG:: Using uniform random number generators * Stddist:: UNU.RAN Library of standard distributions * Error_Debug:: Error handling and Debugging * Testing:: Testing * Misc:: Miscelleanous * RVG:: A Short Introduction to Random Variate Generation * Glossary:: Glossary * Bibliography:: Bibliography * FIndex:: Function Index @end menu @ifinfo @noindent This is the online-documentation of UNU.RAN.@* Version: @value{VERSION}@* Date: @value{UPDATED} @end ifinfo UNU.RAN (Universal Non-Uniform RAndom Number generator) is a collection of algorithms for generating non-uniform pseudorandom variates as a library of C functions designed and implemented by the ARVAG (Automatic Random VAriate Generation) project group in Vienna, and released under the GNU Public License (GPL). It is especially designed for such situations where @itemize @minus @item a non-standard distribution or a truncated distribution is needed. @item experiments with different types of distributions are made. @item random variates for variance reduction techniques are used. @item fast generators of predictable quality are necessary. @end itemize Of course it is also well suited for standard distributions. However due to its more sophisticated programming interface it might not be as easy to use if you only look for a generator for the standard normal distribution. (Although UNU.RAN provides generators that are superior in many aspects to those found in quite a number of other libraries.) UNU.RAN implements several methods for generating random numbers. The choice depends primary on the information about the distribution can be provided and -- if the user is familar with the different methods -- on the preferences of the user. The design goals of UNU.RAN are to provide @emph{reliable}, @emph{portable} and @emph{robust} (as far as this is possible) functions with a consisent and easy to use interface. It is suitable for all situation where experiments with different distributions including non-standard distributions. For example it is no problem to replace the normal distribution by an empirical distribution in a model. Since originally designed as a library for so called black-box or universal algorithms its interface is different from other libraries. (Nevertheless it also contains special generators for standard distributions.) It does not provide subroutines for random variate generation for particular distributions. Instead it uses an object-oriented interface. Distributions and generators are treated as independent objects. This approach allows one not only to have different methods for generating non-uniform random variates. It is also possible to choose the method which is optimal for a given situation (e.g. speed, quality of random numbers, using for variance reduction techniques, etc.). It also allows to sample from non-standard distribution or even from distributions that arise in a model and can only be computed in a complicated subroutine. Sampling from a particular distribution requires the following steps: @enumerate @item Create a distribution object. (Objects for standard distributions are available in the library) @item Choose a method. @item Initialize the generator, i.e., create the generator object. If the choosen method is not suitable for the given distribution (or if the distribution object contains too little information about the distribution) the initialization routine fails and produces an error message. Thus the generator object does (probably) not produce false results (random variates of a different distribution). @item Use this generator object to sample from the distribution. @end enumerate There are four types of objects that can be manipulated independently: @itemize @bullet @item @strong{Distribution objects:} hold all information about the random variates that should be generated. The following types of distributions are available: @itemize @minus @item Continuous and Discrete distributions @item Empirical distributions @item Multivariate distributions @end itemize Of course a library of standard distributions is included (and these can be further modified to get, e.g., truncated distributions). Moreover the library provides subroutines to build almost arbitrary distributions. @item @strong{Generator objects:} hold the generators for the given distributions. It is possible to build independent generator objects for the same distribution object which might use the same or different methods for generation. (If the choosen method is not suitable for the given method, a @code{NULL} pointer is returned in the initialization step). @item @strong{Parameter objects:} Each transformation method requires several parameters to adjust the generator to a given distribution. The parameter object holds all this information. When created it contains all necessary default settings. It is only used to create a generator object and destroyed immediately. Altough there is no need to change these parameters or even know about their existence for ``usual distributions'', they allow a fine tuning of the generator to work with distributions with some awkward properties. The library provides all necessary functions to change these default parameters. @item @strong{Uniform Random Number Generators:} All generator objects need one (or more) streams of uniform random numbers that are transformed into random variates of the given distribution. These are given as pointers to appropriate functions or structures (objects). Two generator objects may have their own uniform random number generators or share a common one. Any functions that produce uniform (pseudo-) random numbers can be used. We suggest Otmar Lendl's PRNG library. @end itemize @c @c end of top.dh @c ------------------------------------- @c ------------------------------------- @c intro.dh @c @node Intro @chapter Introduction @menu * UsageDoc:: Usage of this document * Installation:: Installation * UsageLib:: Using the library * Concepts:: Concepts of UNU.RAN * Contact:: Contact the authors @end menu @c @c end of intro.dh @c ------------------------------------- @c ------------------------------------- @c intro.dh @c @node UsageDoc @section Usage of this document We designed this document in a way such that one can use UNU.RAN with reading as little as necessary. Read @ref{Installation} for the instructions to install the library. @ref{Concepts,,Concepts of UNU.RAN}, discribes the basics of UNU.RAN. It also has a short guideline for choosing an appropriate method. In @ref{Examples} examples are given that can be copied and modified. They also can be found in the directory @file{examples} in the source tree. Further information are given in consecutive chapters. @ref{Distribution_objects,,Handling distribution objects}, describes how to create and manipulate distribution objects. @ref{Stddist,,standard distributions}, describes predefined distribution objects that are ready to use. @ref{Methods} describes the various methods in detail. For each of possible distribution classes (continuous, discrete, empirical, multivariate) there exists a short overview section that can be used to choose an appropriate method followed by sections that describe each of the particular methods in detail. These are merely for users with some knowledge about the methods who want to change method-specific parameters and can be ignored by others. Abbreviations and explanation of some basic terms can be found in @ref{Glossary}. @c @c end of intro.dh @c ------------------------------------- @c ------------------------------------- @c installation.dh @c @node Installation @section Installation UNU.RAN was developed on an Intel architecture under Linux with the GNU C compiler but should compile and run on any computing environment. It requires an ANSI compliant C compiler. Below find the installation instructions for unices. @subsubheading Uniform random number generator UNU.RAN can be used with any uniform random number generator but (at the moment) some features work best with Pierre L'Ecuyer's RngStreams library (see @url{http://statmath.wu.ac.at/software/RngStreams/} for a description and downloading. For details on using uniform random number in UNU.RAN see @ref{URNG,,Using uniform random number generators}. Install the required libraries first. @subsubheading UNU.RAN @enumerate @item First unzip and untar the package and change to the directory: @example tar zxvf unuran-@value{VERSION}.tar.gz cd unuran-@value{VERSION} @end example @item Optional: Edit the file @file{src/unuran_config.h} @item Run a configuration script: @example sh ./configure --prefix= @end example @noindent where @code{} is the root of the installation tree. When omitted @file{/usr/local} is used. Use @code{./configure --help} to get a list of other options. In particular the following flags are important: @itemize @bullet @item Enable support for some external sources of uniform random number generators (@pxref{URNG,,Using uniform random number generators}): @table @code @item --with-urng-rngstream URNG: use Pierre L'Ecuyer's RNGSTREAM library [default=@code{no}] @item --with-urng-prng URNG: use Otmar Lendl's PRNG library [default=@code{no}] @item --with-urng-gsl URNG: use random number generators from GNU Scientific Library [default=@code{no}] @item --with-urng-default URNG: global default URNG (builtin|rngstream) [default=@code{builtin}] @end table We strongly recommend to use RngStreams library: @example sh ./configure --with-urng-rngstream --with-urng-default=rngstream @end example @emph{Important:} You must install the respective libraries @file{RngStreams}, @file{PRNG} and @file{GSL} before @code{./configure} is executed. @item Also make a shared library: @table @code @item --enable-shared build shared libraries [default=@code{no}] @end table @item The library provides the function @code{unur_gen_info} for information about generator objects. This is intented for using in interactive computing environments. This feature can be enabled / disabled by means of the configure flag @table @code @item --enable-info INFO: provide function with information about generator objects [default=@code{yes}] @end table @item Enable support for deprecated UNU.RAN routines if you have some problems with older application after upgrading the library: @table @code @item --enable-deprecated enable support for deprecated UNU.RAN routines [default=@code{no}] @end table @item Enable debugging tools: @table @code @item --enable-check-struct Debug: check validity of pointers to structures [default=@code{no}] @item --enable-logging Debug: print informations about generator into logfile [default=no] @end table @end itemize @item Compile and install the libray: @example make make install @end example @noindent Obviously @code{$(prefix)/include} and @code{$(prefix)/lib} must be in the search path of your compiler. You can use environment variables to add these directories to the search path. If you are using the bash type (or add to your profile): @example export LIBRARY_PATH="/lib" export C_INCLURE_PATH="/include" @end example @noindent If you want to make a shared library, then making such a library can be enabled using @example sh ./configure --enable-shared @end example @noindent If you want to link against the shared library make sure that it can be found when executing the binary that links to the library. If it is not installed in the usual path, then the easiest way is to set the @code{LD_LIBRARY_PATH} environment variable. See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages. @item Documentation in various formats (PDF, HTML, info, plain text) can be found in directory @file{doc}. @item You can run some tests by @example make check @end example @noindent However, some of these tests requires the usage of the PRNG or RngStreams library and are only executed if these are installed enabled by the corresponding configure flag. An extended set of tests is run by @example make fullcheck @end example @noindent However some of these might fail occasionally due to roundoff errors or the mysteries of floating point arithmetic, since we have used some extreme settings to test the library. @end enumerate @subsubheading Upgrading @itemize @minus @item @emph{Important:} UNU.RAN now relies on some aspects of IEEE 754 compliant floating point arithmetic. In particular, @code{1./0.} and @code{0./0.} must result in @code{infinity} and @code{NaN} (not a number), respectively, and must not cause a floating point exception. For allmost all modern compting architecture this is implemented in hardware. For others there should be a special compiler flag to get this feature (e.g., @code{-MIEEE} on DEC alpha or @code{-mp} for the Intel C complier). @item Upgrading UNU.RAN from version 0.9.x or earlier: With UNU.RAN version 1.0.x some of the macro definitions in file @file{src/unuran_config.h} are moved into file @file{config.h} and are set/controlled by the @code{./configure} script. Writting logging information into the logfile must now be enabled when running the configure script: @example sh ./configure --enable-logging @end example @item Upgrading UNU.RAN from version 0.7.x or earlier: With UNU.RAN version 0.8.0 the interface for changing underlying distributions and running a reinitialization routine has been simplified. The old routines can be compiled into the library using the following configure flag: @example sh ./configure --enable-deprecated @end example @noindent Notice: Using these deprecated routines is not supported any more and this strong discouraged. Wrapper functions for external sources of uniform random numbers are now enabled by configure flags and not by macros defined in file @file{src/unuran_config.h}. The file @file{src/unuran_config.h} is not installed any more. It is now only included when the library is compiled. It should be removed from the global include path of the compiler. @end itemize @c @c end of installation.dh @c ------------------------------------- @c ------------------------------------- @c intro.dh @c @node UsageLib @section Using the library @subsubheading ANSI C Compliance The library is written in ANSI C and is intended to conform to the ANSI C standard. It should be portable to any system with a working ANSI C compiler. The library does not rely on any non-ANSI extensions in the interface it exports to the user. Programs you write using UNU.RAN can be ANSI compliant. Extensions which can be used in a way compatible with pure ANSI C are supported, however, via conditional compilation. This allows the library to take advantage of compiler extensions on those platforms which support them. To avoid namespace conflicts all exported function names and variables have the prefix @code{unur_}, while exported macros have the prefix @code{UNUR_}. @subsubheading Compiling and Linking If you want to use the library you must include the UNU.RAN header file @example #include @end example @noindent If you also need the test routines then also add @example #include @end example @noindent If wrapper functions for external sources of uniform random number generators are used, the corresponding header files must also be included, e.g., @example #include @end example @noindent If these header files are not installed on the standard search path of your compiler you will also need to provide its location to the preprocessor as a command line flag. The default location of the @file{unuran.h} is @file{/usr/local/include}. A typical compilation command for a source file @file{app.c} with the GNU C compiler @code{gcc} is, @example gcc -I/usr/local/include -c app.c @end example @noindent This results in an object file @file{app.o}. The default include path for @code{gcc} searches @file{/usr/local/include} automatically so the @code{-I} option can be omitted when UNU.RAN is installed in its default location. The library is installed as a single file, @file{libunuran.a}. A shared version of the library is also installed on systems that support shared libraries. The default location of these files is @file{/usr/local/lib}. To link against the library you need to specify the main library. The following example shows how to link an application with the library (and the the RNGSTREAMS library if you decide to use this source of uniform pseudo-random numbers), @example gcc app.o -lunuran -lrngstreams -lm @end example @subsubheading Shared Libraries To run a program linked with the shared version of the library it may be necessary to define the shell variable @code{LD_LIBRARY_PATH} to include the directory where the library is installed. For example, @example LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH @end example @noindent To compile a statically linked version of the program instead, use the @code{-static} flag in @code{gcc}, @example gcc -static app.o -lunuran -lrngstreams -lm @end example @subsubheading Compatibility with C++ The library header files automatically define functions to have @code{extern "C"} linkage when included in C++ programs. @c @c end of intro.dh @c ------------------------------------- @c ------------------------------------- @c intro.dh @c @node Concepts @section Concepts of UNU.RAN UNU.RAN is a C library for generating non-uniformly distributed random variates. Its emphasis is on the generation of non-standard distribution and on streams of random variates of special purposes. It is designed to provide a consistent tool to sample from distributions with various properties. Since there is no universal method that fits for all situations, various methods for sampling are implemented. UNU.RAN solves this complex task by means of an object oriented programming interface. Three basic objects are used: @itemize @bullet @item distribution object @code{UNUR_DISTR}@* Hold all information about the random variates that should be generated. @item generator object @code{UNUR_GEN}@* Hold the generators for the given distributions. Two generator objects are completely independent of each other. They may share a common uniform random number generator or have their owns. @item parameter object @code{UNUR_PAR}@* Hold all information for creating a generator object. It is necessary due to various parameters and switches for each of these generation methods. Notice that the parameter objects only hold pointers to arrays but do not have their own copy of such an array. Especially, if a dynamically allocated array is used it @emph{must not} be freed until the generator object has been created! @end itemize The idea behind these structures is that creatin distributions, choosing a generation method and draing samples are orthogonal (ie. independent) functions of the library. The parameter object is only introduced due to the necessity to deal with various parameters and switches for each of these generation methods which are required to adjust the algorithms to unusual distributions with extreme properties but have default values that are suitable for most applications. These parameters and the data for distributions are set by various functions. Once a generator object has been created sampling (from the univariate continuous distribution) can be done by the following command: @example double x = unur_sample_cont(generator); @end example @noindent Analogous commands exist for discrete and multivariate distributions. For detailed examples that can be copied and modified see @ref{Examples}. @subheading Distribution objects All information about a distribution are stored in objects (structures) of type @code{UNUR_DISTR}. UNU.RAN has five different types of distribution objects: @table @code @item cont Continuous univariate distributions. @item cvec Continuous multivariate distributions. @item discr Discrete univariate distributions. @item cemp Continuous empirical univariate distribution, ie. given by a sample. @item cvemp Continuous empirical multivariate distribution, ie. given by a sample. @item matr Matrix distributions. @end table @noindent Distribution objects can be created from scratch by the following call @example distr = unur_distr__new(); @end example @noindent where @code{} is one of the five possible types from the above table. Notice that these commands only create an @emph{empty} object which still must be filled by means of calls for each type of distribution object (@pxref{Distribution_objects,,Handling distribution objects}). The naming scheme of these functions is designed to indicate the corresponding type of the distribution object and the task to be performed. It is demonstated on the following example. @example unur_distr_cont_set_pdf(distr, mypdf); @end example @noindent This command stores a PDF named @code{mypdf} in the distribution object @code{distr} which must have the type @code{cont}. Of course UNU.RAN provides an easier way to use standard distributions. Instead of using @command{unur_distr__new} calls and fuctions @command{unur_distr__set_<@dots{}>} for setting data, objects for standard distribution can be created by a single call. Eg. to get an object for the normal distribution with mean 2 and standard deviation 5 use @example double parameter[2] = @{2.0 ,5.0@}; UNUR_DISTR *distr = unur_distr_normal(parameter, 2); @end example @noindent For a list of standard distributions see @ref{Stddist,,Standard distributions}. @subheading Generation methods The information that a distribution object must contain depends heavily on the chosen generation method choosen. Brackets indicate optional information while a tilde indicates that only an approximation must be provided. See @ref{Glossary}, for unfamiliar terms. @include methods_cont.texi @include methods_cemp.texi @include methods_cvec.texi @include methods_cvemp.texi @include methods_discr.texi @include methods_matr.texi @include methods_mcmc.texi Because of tremendous variety of possible problems, UNU.RAN provides many methods. All information for creating a generator object has to be collected in a parameter object first. For example, if the task is to sample from a continuous distribution the method AROU might be a good choice. Then the call @example UNUR_PAR *par = unur_arou_new(distribution); @end example @noindent creates an parameter object @code{par} with a pointer to the distribution object and default values for all necessary parameters for method AROU. Other methods can be used by replacing @code{arou} with the name of the desired methods (in lower case letters): @example UNUR_PAR *par = unur__new(distribution); @end example @noindent This sets the default values for all necessary parameters for the chosen method. These are suitable for almost all applications. Nevertheless, it is possible to control the behavior of the method using corresponding @command{set} calls for each method. This might be necessary to adjust the algorithm for an unusual distribution with extreme properties, or just for fine tuning the perforence of the algorithm. The following example demonstrates how to change the maximum number of iterations for method NINV to the value 50: @example unur_ninv_set_max_iteration(par, 50); @end example @noindent All available methods are described in details in @ref{Methods}. @subheading Creating a generator object Now it is possible to create a generator object: @example UNUR_GEN *generator = unur_init(par); if (generator == @code{NULL}) exit(EXIT_FAILURE); @end example @noindent @strong{Important:} You must always check whether @ifhtml @ref{funct:unur_init,@command{unur_init}} @end ifhtml @ifnothtml @command{unur_init} @end ifnothtml has been executed successfully. Otherwise the @code{NULL} pointer is returned which causes a segmentation fault when used for sampling. @noindent @strong{Important:} The call of @ifhtml @ref{funct:unur_init,@command{unur_init}} @end ifhtml @ifnothtml @command{unur_init} @end ifnothtml @strong{destroys} the parameter object!@* Moreover, it is recommended to call @ifhtml @ref{funct:unur_init,@command{unur_init}} @end ifhtml @ifnothtml @command{unur_init} @end ifnothtml immediately after the parameter object @code{par} has created and modified. An existing generator object is a rather static construct. Nevertheless, some of the parameters can still be modified by @command{chg} calls, e.g. @example unur_ninv_chg_max_iteration(gen, 30); @end example @noindent Notice that it is important @emph{when} parameters are changed because different functions must be used: The function name includes the term @command{set} and the first argument must be of type @code{UNUR_PAR} when the parameters are changed @emph{before} the generator object is created. The function name includes the term @command{chg} and the first argument must be of type @code{UNUR_GEN} when the parameters are changed for an @emph{existing} generator object. For details see @ref{Methods}. @subheading Sampling You can now use your generator object in any place of your program to sample from your distribution. You only have to take care about the type of variates it computes: @code{double}, @code{int} or a vector (array of @code{double}s). Notice that at this point it does not matter whether you are sampling from a gamma distribution, a truncated normal distribution or even an empirical distribution. @subheading Reinitializing It is possible for a generator object to change the parameters and the domain of the underlying distribution. This must be done by extracting this object by means of a @ifhtml @ref{funct:unur_get_distr,@command{unur_get_distr}} @end ifhtml @ifnothtml @command{unur_get_distr} @end ifnothtml call and changing the distribution using the correspondig set calls, see @ref{Distribution_objects,,Handling distribution objects}. The generator object @strong{must} then be reinitialized by means of the @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml call. @emph{Important}: Currently not all methods allow reinitialization, see the description of the particular method (keyword @i{Reinit}). @subheading Destroy When you do not need your generator object any more, you should destroy it: @example unur_free(generator); @end example @subheading Uniform random numbers Each generator object can have its own uniform random number generator or share one with others. When created a parameter object the pointer for the uniform random number generator is set to the default generator. However, it can be changed at any time to any other generator: @example unur_set_urng(par, urng); @end example @noindent or @example unur_chg_urng(generator, urng); @end example @noindent respectively. See @ref{URNG,,Using uniform random number generators}, for details. @c @c end of intro.dh @c ------------------------------------- @c ------------------------------------- @c intro.dh @c @node Contact @section Contact the authors If you have any problems with UNU.RAN, suggestions how to improve the library, or find a bug, please contact us via email @email{unuran@@statmath.wu.ac.at}. For news please visit out homepage at @uref{http://statmath.wu.ac.at/unuran/}. @c @c end of intro.dh @c ------------------------------------- @c ------------------------------------- @c examples.dh @c @node Examples @chapter Examples @menu * Example_0:: As short as possible * Example_0_str:: As short as possible (String API) * Example_1:: Select a method * Example_1_str:: Select a method (String API) * Example_2:: Arbitrary distributions * Example_2_str:: Arbitrary distributions (String API) * Example_3:: Change parameters of the method * Example_3_str:: Change parameters of the method (String API) * Example_4:: Change uniform random generator * Example_reinit:: Change parameters of underlying distribution * Example_anti:: Sample pairs of antithetic random variates * Example_anti_str:: Sample pairs of antithetic random variates (String API) * Example_More:: More examples @end menu The examples in this chapter should compile cleanly and can be found in the directory @file{examples} of the source tree of UNU.RAN. Assuming that UNU.RAN as well as the PRNG libraries have been installed properly (@pxref{Installation}) each of these can be compiled (using the GCC in this example) with @example gcc -Wall -O2 -o example example.c -lunuran -lprng -lm @end example @noindent @emph{Remark:} @code{-lprng} must be omitted when the PRNG library is not installed. Then however some of the examples might not work. The library uses three objects: @code{UNUR_DISTR}, @code{UNUR_PAR} and @code{UNUR_GEN}. It is not important to understand the details of these objects but it is important not to changed the order of their creation. The distribution object can be destroyed @emph{after} the generator object has been made. (The parameter object is freed automatically by the @ifhtml @ref{funct:unur_init,@command{unur_init}} @end ifhtml @ifnothtml @command{unur_init} @end ifnothtml call.) It is also important to check the result of the @ifhtml @ref{funct:unur_init,@command{unur_init}} @end ifhtml @ifnothtml @command{unur_init} @end ifnothtml call. If it has failed the @code{NULL} pointer is returned and causes a segmentation fault when used for sampling. We give all examples with the UNU.RAN standard API and the more convenient string API. @c @c end of examples.dh @c ------------------------------------- @c ------------------------------------- @c examples.dh @c @page @node Example_0 @section As short as possible Select a distribution and let UNU.RAN do all necessary steps. @smallexample @include ref_example0.texi @end smallexample @c @c end of examples.dh @c ------------------------------------- @c ------------------------------------- @c examples.dh @c @page @node Example_0_str @section As short as possible (String API) Select a distribution and let UNU.RAN do all necessary steps. @smallexample @include ref_example0_str.texi @end smallexample @c @c end of examples.dh @c ------------------------------------- @c ------------------------------------- @c examples.dh @c @page @node Example_1 @section Select a method Select method AROU and use it with default parameters. @smallexample @include ref_example1.texi @end smallexample @c @c end of examples.dh @c ------------------------------------- @c ------------------------------------- @c examples.dh @c @page @node Example_1_str @section Select a method (String API) Select method AROU and use it with default parameters. @smallexample @include ref_example1_str.texi @end smallexample @c @c end of examples.dh @c ------------------------------------- @c ------------------------------------- @c examples.dh @c @page @node Example_2 @section Arbitrary distributions If you want to sample from a non-standard distribution, UNU.RAN might be exactly what you need. Depending on the information is available, a method must be choosen for sampling, see @ref{Concepts} for an overview and @ref{Methods} for details. @smallexample @include ref_example2.texi @end smallexample @c @c end of examples.dh @c ------------------------------------- @c ------------------------------------- @c examples.dh @c @page @node Example_2_str @section Arbitrary distributions (String API) If you want to sample from a non-standard distribution, UNU.RAN might be exactly what you need. Depending on the information is available, a method must be choosen for sampling, see @ref{Concepts} for an overview and @ref{Methods} for details. @smallexample @include ref_example2_str.texi @end smallexample @c @c end of examples.dh @c ------------------------------------- @c ------------------------------------- @c examples.dh @c @page @node Example_3 @section Change parameters of the method Each method for generating random numbers allows several parameters to be modified. If you do not want to use default values, it is possible to change them. The following example illustrates how to change parameters. For details see @ref{Methods}. @smallexample @include ref_example3.texi @end smallexample @c @c end of examples.dh @c ------------------------------------- @c ------------------------------------- @c examples.dh @c @page @node Example_3_str @section Change parameters of the method (String API) Each method for generating random numbers allows several parameters to be modified. If you do not want to use default values, it is possible to change them. The following example illustrates how to change parameters. For details see @ref{Methods}. @smallexample @include ref_example3_str.texi @end smallexample @c @c end of examples.dh @c ------------------------------------- @c ------------------------------------- @c examples.dh @c @page @node Example_4 @section Change uniform random generator All generator object use the same default uniform random number generator by default. This can be changed to any generator of your choice such that each generator object has its own random number generator or can share it with some other objects. It is also possible to change the default generator at any time. See @ref{URNG,,Using uniform random number generators}, for details. The following example shows how the uniform random number generator can be set or changed for a generator object. It requires the RNGSTREAMS library to be installed and used. Otherwise the example must be modified accordingly. @smallexample @include ref_example_rngstreams.texi @end smallexample @c @c end of examples.dh @c ------------------------------------- @c ------------------------------------- @c examples.dh @c @page @node Example_reinit @section Change parameters of underlying distribution One a generator object has been created it allows to draw samples from the distribution with the given parameters. However, some methods allow to change the parameters of the underlying distribution and reinitialize the generator object again. Thus when the parameters of the distribution vary for each draw we save overhead for destroying the old object and creating a new one. The following example shows how the parameters of a GIG distribution can be changed when method CSTD is used. @smallexample @include ref_example_reinit.texi @end smallexample @c @c end of examples.dh @c ------------------------------------- @c ------------------------------------- @c examples.dh @c @page @node Example_anti @section Sample pairs of antithetic random variates Using Method TDR it is easy to sample pairs of antithetic random variates. @smallexample @include ref_example_anti.texi @end smallexample @c @c end of examples.dh @c ------------------------------------- @c ------------------------------------- @c examples.dh @c @page @node Example_anti_str @section Sample pairs of antithetic random variates (String API) Using Method TDR it is easy to sample pairs of antithetic random variates. @smallexample @include ref_example_anti_str.texi @end smallexample @c @c end of examples.dh @c ------------------------------------- @c ------------------------------------- @c examples.dh @c @page @node Example_More @section More examples @xref{Methods_for_CONT,,Methods for continuous univariate distributions}. @xref{Methods_for_CEMP,,Methods for continuous empirical univariate distributions}. @xref{Methods_for_CVEMP,,Methods for continuous empirical multivariate distributions}. @xref{Methods_for_DISCR,,Methods for discrete univariate distributions}. @c @c end of examples.dh @c ------------------------------------- @c ------------------------------------- @c parser.h @c @node StringAPI @chapter String Interface @menu * StringSyntax:: Syntax of String Interface * StringDistr:: Distribution String * StringFunct:: Function String * StringMethod:: Method String * StringURNG:: Uniform RNG String @end menu The string interface (string API) provided by the @ifhtml @ref{funct:unur_str2gen,@command{unur_str2gen}} @end ifhtml @ifnothtml @command{unur_str2gen} @end ifnothtml call is the easiest way to use UNU.RAN. This function takes a character string as its argument. The string is parsed and the information obtained is used to create a generator object. It returns @code{NULL} if this fails, either due to a syntax error, or due to invalid data. In both cases @code{unur_error} is set to the corresponding error codes (@pxref{Error_reporting,,Error reporting}). Additionally there exists the call @ifhtml @ref{funct:unur_str2distr,@command{unur_str2distr}} @end ifhtml @ifnothtml @command{unur_str2distr} @end ifnothtml that only produces a distribution object. Notice that the string interface does not implement all features of the UNU.RAN library. For trickier tasks it might be necessary to use the UNU.RAN calls. In @ref{Examples}, all examples are given using both the UNU.RAN standard API and this convenient string API. The corresponding programm codes are equivalent. @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_str2gen,unur_str2gen} @item @ref{funct:unur_str2distr,unur_str2distr} @item @ref{funct:unur_makegen_ssu,unur_makegen_ssu} @item @ref{funct:unur_makegen_dsu,unur_makegen_dsu} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_str2gen} @deftypefn Function {UNUR_GEN*} unur_str2gen (const @var{char* string}) Get a generator object for the distribution, method and uniform random number generator as described in the given @var{string}. See @ref{StringSyntax,,Syntax of String Interface}, for details. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_str2gen} @deftypefn {} {UNUR_GEN*} unur_str2gen (const @var{char* string}) Get a generator object for the distribution, method and uniform random number generator as described in the given @var{string}. See @ref{StringSyntax,,Syntax of String Interface}, for details. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_str2distr} @deftypefn Function {UNUR_DISTR*} unur_str2distr (const @var{char* string}) Get a distribution object for the distribution described in @var{string}. See @ref{StringSyntax,,Syntax of String Interface}, and @ref{StringDistr,,Distribution String}, for details. However, only the block for the distribution object is allowed. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_str2distr} @deftypefn {} {UNUR_DISTR*} unur_str2distr (const @var{char* string}) Get a distribution object for the distribution described in @var{string}. See @ref{StringSyntax,,Syntax of String Interface}, and @ref{StringDistr,,Distribution String}, for details. However, only the block for the distribution object is allowed. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_makegen_ssu} @anchor{funct:unur_makegen_dsu} @deftypefn Function {UNUR_GEN*} unur_makegen_ssu (const @var{char* distrstr}, const @var{char* methodstr}, UNUR_URNG* @var{urng}) @deftypefnx Function {UNUR_GEN*} unur_makegen_dsu (const @var{UNUR_DISTR* distribution}, const @var{char* methodstr}, UNUR_URNG* @var{urng}) Make a generator object for the distribution, method and uniform random number generator. The distribution can be given either as string @var{distrstr} or as a distribution object @var{distr}. The method must be given as a string @var{methodstr}. For the syntax of these strings see @ref{StringSyntax,,Syntax of String Interface}. However, the @code{method} keyword is optional for these calls and can be omitted. If @var{methodstr} is the empty (blank) string or @code{NULL} method AUTO is used. The uniform random number generator is optional. If @var{urng} is @code{NULL} then the default uniform random number generator is used. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_makegen_ssu} @anchor{funct:unur_makegen_dsu} @deftypefn {} {UNUR_GEN*} unur_makegen_ssu (const @var{char* distrstr}, const @var{char* methodstr}, UNUR_URNG* @var{urng}) @deftypefnx {} {UNUR_GEN*} unur_makegen_dsu (const @var{UNUR_DISTR* distribution}, const @var{char* methodstr}, UNUR_URNG* @var{urng}) Make a generator object for the distribution, method and uniform random number generator. The distribution can be given either as string @var{distrstr} or as a distribution object @var{distr}. The method must be given as a string @var{methodstr}. For the syntax of these strings see @ref{StringSyntax,,Syntax of String Interface}. However, the @code{method} keyword is optional for these calls and can be omitted. If @var{methodstr} is the empty (blank) string or @code{NULL} method AUTO is used. The uniform random number generator is optional. If @var{urng} is @code{NULL} then the default uniform random number generator is used. @end deftypefn @end ifnotinfo @c @c end of parser.h @c ------------------------------------- @c ------------------------------------- @c parser.h @c @node StringSyntax @section Syntax of String Interface The given string holds information about the requested distribution and (optional) about the sampling method and the uniform random number generator invoked. The interpretation of the string is not case-sensitive, all white spaces are ignored. The string consists of up to three blocks, separated by ampersands @code{&}. Each block consists of @code{=} pairs, separated by semicolons @code{;}. The first key in each block is used to indicate each block. We have three different blocks with the following (first) keys: @table @code @item distr definition of the distribution (@pxref{StringDistr,,Distribution String}). @item method description of the transformation method (@pxref{StringMethod,,Method String}). @item urng uniform random number generation (@pxref{StringURNG,,Uniform RNG String}). @end table The @code{distr} block must be the very first block and is obligatory. All the other blocks are optional and can be arranged in arbitrary order. For details see the following description of each block. In the following example @example distr = normal(3.,0.75); domain = (0,inf) & method = tdr; c = 0 @end example @noindent we have a distribution block for the truncated normal distribution with mean 3 and standard deviation 0.75 on domain (0,infinity); and block for choosing method TDR with parameter c set to 0. The @code{=} pairs that follow the first (initial) pair in each block are used to set parameters. The name of the parameter is given by the @code{} string. It is deduced from the UNU.RAN set calls by taking the part after @code{@dots{}_set_}. The @code{} string holds the parameters to be set, separated by commata @code{,}. There are three types of parameters: @table @emph @item string @code{"@dots{}"} or @code{'@dots{}'} i.e. any sequence of characters enclosed by double quotes @code{"@dots{}"} or single quotes @code{'@dots{}'} (there is no distinction between double quotes @code{"} and single quotes @code{'}). @item list @code{(@dots{},@dots{})} i.e. list of @emph{numbers}, separated by commata @code{,}, enclosed in parenthesis @code{(...)}. @item number a sequence of characters that is not enclosed by double quotes @code{"@dots{}"}, single quotes @code{'@dots{}'}, or parenthesis @code{(...)}. It is interpreted as float or integer depending on the type of the corresponding parameter. @end table The @code{} string (including the character @code{=}) can be omitted when no argument is required. At the moment not all @command{set} calls are supported. The syntax for the @code{} can be directly derived from the corresponding @command{set} calls. To simplify the syntax additional shortcuts are possible. The following table lists the parameters for the @code{set} calls that are supported by the string interface; the entry in parenthesis gives the type of the argument as @code{} string: @table @code @item int @i{(number)}: The @i{number} is interpreted as an integer. @code{true} and @code{on} are transformed to @code{1}, @code{false} and @code{off} are transformed to @code{0}. A missing argument is interpreted as @code{1}. @item int, int @i{(number, number} @r{or} @i{list)}: The two numbers or the first two entries in the list are interpreted as a integers. @code{inf} and @code{-inf} are transformed to @code{INT_MAX} and @code{INT_MIN} respectively, i.e. the largest and smallest integers that can be represented by the computer. @item unsigned @i{(number)}: The @i{number} is interpreted as an unsigned hexadecimal integer. @item double @i{(number)}: The number is interpreted as a floating point number. @code{inf} is transformed to @code{UNUR_INFINITY}. @item double, double @i{(number, number} @r{or} @i{list)}: The two numbers or the first two entries in the list are interpreted as a floating point numbers. @code{inf} is transformed to @code{UNUR_INFINITY}. However using @code{inf} in the list might not work for all versions of C. Then it is recommended to use two single numbers instead of a list. @item int, double* @i{([number,] list} @r{or} @i{number)}: @itemize @minus @item The list is interpreted as a double array. The (first) number as its length. If it is less than the actual size of the array only the first entries of the array are used. @item If only the list is given (i.e., if the first number is omitted), the first number is set to the actual size of the array. @item If only the number is given (i.e., if the list is omitted), the @code{NULL} pointer is used instead an array as argument. @end itemize @item double*, int @i{(list [,number])}: The list is interpreted as a double array. The (second) number as its length. If the length is omitted, it is replaced by the actual size of the array. (Only in the @code{distribution} block!) @item char* @i{(string)}: The character string is passed as is to the corresponding set call. @end table Notice that missing entries in a list of numbers are interpreted as @code{0}. E.g, a the list @code{(1,,3)} is read as @code{(1,0,3)}, the list @code{(1,2,)} as @code{(1,2,0)}. The the list of @code{key} strings in @ref{KeysDistr,,Keys for Distribution String}, and @ref{KeysMethod,,Keys for Method String}, for further details. @c @c end of parser.h @c ------------------------------------- @c ------------------------------------- @c parser.h @c @page @node StringDistr @section Distribution String @menu * KeysDistr:: Keys for Distribution String @end menu The @code{distr} block must be the very first block and is obligatory. For that reason the keyword @code{distr} is optional and can be omitted (together with the @code{=} character). Moreover it is ignored while parsing the string. However, to avoid some possible confusion it has to start with the letter @code{d} (if it is given at all). The value of the @code{distr} key is used to get the distribution object, either via a @command{unur_distr_} call for a standard distribution via a @command{unur_distr__new} call to get an object of a generic distribution. However not all generic distributions are supported yet. The parameters for the standard distribution are given as a list. There must not be any character (other than white space) between the name of the standard distribution and the opening parenthesis @code{(} of this list. E.g., to get a beta distribution, use @example distr = beta(2,4) @end example To get an object for a discrete distribution with probability vector (0.5,0.2,0.3), use @example distr = discr; pv = (0.5,0.2,0.3) @end example It is also possible to set a PDF, PMF, or CDF using a string. E.g., to create a continuous distribution with PDF proportional to @code{exp(-sqrt(2+(x-1)^2) + (x-1))} and domain (0,inf) use @example distr = cont; pdf = "exp(-sqrt(2+(x-1)^2) + (x-1))" @end example @noindent Notice: If this string is used in an @ifhtml @ref{funct:unur_str2distr,@command{unur_str2distr}} @end ifhtml @ifnothtml @command{unur_str2distr} @end ifnothtml or @ifhtml @ref{funct:unur_str2gen,@command{unur_str2gen}} @end ifhtml @ifnothtml @command{unur_str2gen} @end ifnothtml call the double quotes @code{"} must be protected by @code{\"}. Alternatively, single quotes may be used instead @example distr = cont; pdf = 'exp(-sqrt(2+(x-1)^2) + (x-1))' @end example For the details of function strings see @ref{StringFunct,,Function String}. @c @c end of parser.h @c ------------------------------------- @c ------------------------------------- @c stringparser_doc.dh @c @node KeysDistr @subsection Keys for Distribution String List of standard distributions @pxref{Stddist,,Standard distributions} @itemize @minus @item @code{[distr =] beta(@dots{})} @ @ @ @ @result{} @pxref{beta} @item @code{[distr =] binomial(@dots{})} @ @ @ @ @result{} @pxref{binomial} @item @code{[distr =] cauchy(@dots{})} @ @ @ @ @result{} @pxref{cauchy} @item @code{[distr =] chi(@dots{})} @ @ @ @ @result{} @pxref{chi} @item @code{[distr =] chisquare(@dots{})} @ @ @ @ @result{} @pxref{chisquare} @item @code{[distr =] exponential(@dots{})} @ @ @ @ @result{} @pxref{exponential} @item @code{[distr =] extremeI(@dots{})} @ @ @ @ @result{} @pxref{extremeI} @item @code{[distr =] extremeII(@dots{})} @ @ @ @ @result{} @pxref{extremeII} @item @code{[distr =] F(@dots{})} @ @ @ @ @result{} @pxref{F} @item @code{[distr =] gamma(@dots{})} @ @ @ @ @result{} @pxref{gamma} @item @code{[distr =] geometric(@dots{})} @ @ @ @ @result{} @pxref{geometric} @item @code{[distr =] gig(@dots{})} @ @ @ @ @result{} @pxref{gig} @item @code{[distr =] gig2(@dots{})} @ @ @ @ @result{} @pxref{gig2} @item @code{[distr =] hyperbolic(@dots{})} @ @ @ @ @result{} @pxref{hyperbolic} @item @code{[distr =] hypergeometric(@dots{})} @ @ @ @ @result{} @pxref{hypergeometric} @item @code{[distr =] ig(@dots{})} @ @ @ @ @result{} @pxref{ig} @item @code{[distr =] laplace(@dots{})} @ @ @ @ @result{} @pxref{laplace} @item @code{[distr =] logarithmic(@dots{})} @ @ @ @ @result{} @pxref{logarithmic} @item @code{[distr =] logistic(@dots{})} @ @ @ @ @result{} @pxref{logistic} @item @code{[distr =] lognormal(@dots{})} @ @ @ @ @result{} @pxref{lognormal} @item @code{[distr =] lomax(@dots{})} @ @ @ @ @result{} @pxref{lomax} @item @code{[distr =] negativebinomial(@dots{})} @ @ @ @ @result{} @pxref{negativebinomial} @item @code{[distr =] normal(@dots{})} @ @ @ @ @result{} @pxref{normal} @item @code{[distr =] pareto(@dots{})} @ @ @ @ @result{} @pxref{pareto} @item @code{[distr =] poisson(@dots{})} @ @ @ @ @result{} @pxref{poisson} @item @code{[distr =] powerexponential(@dots{})} @ @ @ @ @result{} @pxref{powerexponential} @item @code{[distr =] rayleigh(@dots{})} @ @ @ @ @result{} @pxref{rayleigh} @item @code{[distr =] slash(@dots{})} @ @ @ @ @result{} @pxref{slash} @item @code{[distr =] student(@dots{})} @ @ @ @ @result{} @pxref{student} @item @code{[distr =] triangular(@dots{})} @ @ @ @ @result{} @pxref{triangular} @item @code{[distr =] uniform(@dots{})} @ @ @ @ @result{} @pxref{uniform} @item @code{[distr =] weibull(@dots{})} @ @ @ @ @result{} @pxref{weibull} @end itemize List of generic distributions @pxref{Distribution_objects,,Handling Distribution Objects} @itemize @minus @item @code{[distr =] cemp} @ @ @ @ @result{} @pxref{CEMP} @item @code{[distr =] cont} @ @ @ @ @result{} @pxref{CONT} @item @code{[distr =] discr} @ @ @ @ @result{} @pxref{DISCR} @end itemize @emph{Notice}: Order statistics for continuous distributions (@pxref{CORDER}) are supported by using the key @code{orderstatistics} for distributions of type @code{CONT}. List of keys that are available via the String API. For description see the corresponding UNU.RAN set calls. @itemize @bullet @item All distribution types @table @code @item name = "@i{}" @result{} @pxref{funct:unur_distr_set_name,,@command{unur_distr_set_name}} @end table @item @code{cemp} @ @i{(Distribution Type)}@ @ @ @ (@pxref{CEMP}) @table @code @item data = (@i{}) [, @i{}] @result{} @pxref{funct:unur_distr_cemp_set_data,,@command{unur_distr_cemp_set_data}} @item hist_bins = (@i{}) [, @i{}] @result{} @pxref{funct:unur_distr_cemp_set_hist_bins,,@command{unur_distr_cemp_set_hist_bins}} @item hist_domain = @i{}, @i{} | (@i{}) @result{} @pxref{funct:unur_distr_cemp_set_hist_domain,,@command{unur_distr_cemp_set_hist_domain}} @item hist_prob = (@i{}) [, @i{}] @result{} @pxref{funct:unur_distr_cemp_set_hist_prob,,@command{unur_distr_cemp_set_hist_prob}} @end table @item @code{cont} @ @i{(Distribution Type)}@ @ @ @ (@pxref{CONT}) @table @code @item cdf = "@i{}" @result{} @pxref{funct:unur_distr_cont_set_cdfstr,,@command{unur_distr_cont_set_cdfstr}} @item center = @i{} @result{} @pxref{funct:unur_distr_cont_set_center,,@command{unur_distr_cont_set_center}} @item domain = @i{}, @i{} | (@i{}) @result{} @pxref{funct:unur_distr_cont_set_domain,,@command{unur_distr_cont_set_domain}} @item hr = "@i{}" @result{} @pxref{funct:unur_distr_cont_set_hrstr,,@command{unur_distr_cont_set_hrstr}} @item logcdf = "@i{}" @result{} @pxref{funct:unur_distr_cont_set_logcdfstr,,@command{unur_distr_cont_set_logcdfstr}} @item logpdf = "@i{}" @result{} @pxref{funct:unur_distr_cont_set_logpdfstr,,@command{unur_distr_cont_set_logpdfstr}} @item mode = @i{} @result{} @pxref{funct:unur_distr_cont_set_mode,,@command{unur_distr_cont_set_mode}} @item pdf = "@i{}" @result{} @pxref{funct:unur_distr_cont_set_pdfstr,,@command{unur_distr_cont_set_pdfstr}} @item pdfarea = @i{} @result{} @pxref{funct:unur_distr_cont_set_pdfarea,,@command{unur_distr_cont_set_pdfarea}} @item pdfparams = (@i{}) [, @i{}] @result{} @pxref{funct:unur_distr_cont_set_pdfparams,,@command{unur_distr_cont_set_pdfparams}} @item orderstatistics = @i{}, @i{} | (@i{}) Make order statistics for given distribution. The first parameter gives the sample size, the second parameter its rank. (see @pxref{funct:unur_distr_corder_new,,@command{unur_distr_corder_new}}) @end table @item @code{discr} @ @i{(Distribution Type)}@ @ @ @ (@pxref{DISCR}) @table @code @item cdf = "@i{}" @result{} @pxref{funct:unur_distr_discr_set_cdfstr,,@command{unur_distr_discr_set_cdfstr}} @item domain = @i{}, @i{} | (@i{}) @result{} @pxref{funct:unur_distr_discr_set_domain,,@command{unur_distr_discr_set_domain}} @item mode [= @i{}] @result{} @pxref{funct:unur_distr_discr_set_mode,,@command{unur_distr_discr_set_mode}} @item pmf = "@i{}" @result{} @pxref{funct:unur_distr_discr_set_pmfstr,,@command{unur_distr_discr_set_pmfstr}} @item pmfparams = (@i{}) [, @i{}] @result{} @pxref{funct:unur_distr_discr_set_pmfparams,,@command{unur_distr_discr_set_pmfparams}} @item pmfsum = @i{} @result{} @pxref{funct:unur_distr_discr_set_pmfsum,,@command{unur_distr_discr_set_pmfsum}} @item pv = (@i{}) [, @i{}] @result{} @pxref{funct:unur_distr_discr_set_pv,,@command{unur_distr_discr_set_pv}} @end table @end itemize @c @c end of stringparser_doc.dh @c ------------------------------------- @c ------------------------------------- @c functparser_doc.dh @c @page @node StringFunct @section Function String In unuran it is also possible to define functions (e.g. CDF or PDF) as strings. As you can see in Example 2 (@ref{Example_2_str}) it is very easy to define the PDF of a distribution object by means of a string. The possibilities using this string interface are more restricted than using a pointer to a routine coded in C (@ref{Example_2}). But the differences in evaluation time is small. When a distribution object is defined using this string interface then of course the same conditions on the given density or CDF must be satisfied for a chosen method as for the standard API. This string interface can be used for both within the UNU.RAN string API using the @ifhtml @ref{funct:unur_str2gen,@command{unur_str2gen}} @end ifhtml @ifnothtml @command{unur_str2gen} @end ifnothtml call, and for calls that define the density or CDF for a particular distribution object as done with (e.g.) the call @ifhtml @ref{funct:unur_distr_cont_set_pdfstr,@command{unur_distr_cont_set_pdfstr}.} @end ifhtml @ifnothtml @command{unur_distr_cont_set_pdfstr}. @end ifnothtml Here is an example for the latter case: @example unur_distr_cont_set_pdfstr(distr,"1-x*x"); @end example @subheading Syntax The syntax for the function string is case insensitive, white spaces are ingnored. The expressions are similar to most programming languages and mathematical programs (see also the examples below). It is especially influenced by C. The usual preceedence rules are used (from highest to lowest preceedence: functions, power, multiplication, addition, relation operators). Use parentheses in case of doubt or when these preceedences should be changed. Relation operators can be used as indicator functions, i.e. the term @code{(x>1)} is evaluted as @code{1} if this relation is satisfied, and as @code{0} otherwise. The first unknown symbol (letter or word) is interpreted as the variable of the function. It is recommended to use @code{x}. Only one variable can be used. @noindent @emph{Important}: The symbol @code{e} is used twice, for Euler's constant (= 2.7182@dots{}) and as exponent. The multiplication operator @code{*} must not be omitted, i.e. @code{2 x} is interpreted as the string @code{2x} (which will result in a syntax error). @subheading List of symbols @cartouche @noindent @b{Numbers} @noindent Numbers are composed using digits and, optionally, a sign, a decimal point, and an exponent indicated by @code{e}. @multitable {xxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} @item Symbol @tab Explanation @tab Examples @item @code{0@dots{}9} @tab @i{digits} @tab @code{2343} @item @code{.} @tab @i{decimal point} @tab @code{165.567} @item @code{-} @tab @i{negative sign} @tab @code{-465.223} @item @code{e} @tab @i{exponet} @tab @code{13.2e-4} (=0.00132) @end multitable @end cartouche @cartouche @noindent @b{Constants} @multitable {xxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} @item @code{pi} @tab @i{pi = 3.1415@dots{}} @tab @code{3*pi+2} @item @code{e} @tab @i{Euler's constant} @tab @code{3*e+2} (= 10.15@dots{}; do not cofuse with @code{3e2} = 300) @item @code{inf} @tab @i{infinity} @tab (used for domains) @end multitable @end cartouche @cartouche @noindent @b{Special symbols} @multitable {xxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} @item @code{(} @tab @i{opening parenthesis} @tab @code{2*(3+x)} @item @code{)} @tab @i{closing parenthesis} @tab @code{2*(3+x)} @item @code{,} @tab @i{(argument) list separator} @tab @code{mod(13,2)} @end multitable @end cartouche @cartouche @noindent @b{Relation operators (Indicator functions)} @multitable {xxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} @item @code{<} @tab @i{less than} @tab @code{(x<1)} @item @code{=} @tab @i{equal} @tab @code{(2=x)} @item @code{==} @tab @i{same as} @code{=} @tab @code{(x==3)} @item @code{>} @tab @i{greater than} @tab @code{(x>0)} @item @code{<=} @tab @i{less than or equal} @tab @code{(x<=1)} @item @code{!=} @tab @i{not equal} @tab @code{(x!0)} @item @code{<>} @tab @i{same as} @code{!=} @tab @code{(x<>pi)} @item @code{>=} @tab @i{greater or equal} @tab @code{(x>=1)} @end multitable @end cartouche @cartouche @noindent @b{Arithmetic operators} @multitable {xxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} @item @code{+} @tab @i{addition} @tab @code{2+x} @item @code{-} @tab @i{subtraction} @tab @code{2-x} @item @code{*} @tab @i{multiplication} @tab @code{2*x} @item @code{/} @tab @i{division} @tab @code{x/2} @item @code{^} @tab @i{power} @tab @code{x^2} @end multitable @end cartouche @cartouche @noindent @b{Functions} @multitable {xxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} @item @code{mod} @tab @code{mod(m,n)} @i{remainder of devision m over n} @tab mod(x,2) @item @code{exp} @tab @i{exponential function (same as @code{e^x})} @tab @code{exp(-x^2)} (same as @code{e^(-x^2)}) @item @code{log} @tab @i{natural logarithm} @tab @code{log(x)} @item @code{sin} @tab @i{sine} @tab @code{sin(x)} @item @code{cos} @tab @i{cosine} @tab @code{cos(x)} @item @code{tan} @tab @i{tangent} @tab @code{tan(x)} @item @code{sec} @tab @i{secant} @tab @code{sec(x*2)} @item @code{sqrt} @tab @i{square root} @tab @code{sqrt(2*x)} @item @code{abs} @tab @i{absolute value} @tab @code{abs(x)} @item @code{sgn} @tab @i{sign function} @tab @code{sign(x)*3} @end multitable @end cartouche @cartouche @noindent @b{Variable} @multitable {xxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} @item @code{x} @tab @i{variable} @tab @code{3*x^2} @end multitable @end cartouche @subheading Examples @example 1.231+7.9876*x-1.234e-3*x^2+3.335e-5*x^3 sin(2*pi*x)+x^2 exp(-((x-3)/2.1)^2) @end example @noindent It is also possible to define functions using different terms on separate domains. However, instead of constructs using @code{if @dots{} then @dots{} else @dots{}} indicator functions are available. @noindent For example to define the density of triangular distribution with domain (-1,1) and mode 0 use @example (x>-1)*(x<0)*(1+x) + (x>=0)*(x<1)*(1-x) @end example @c @c end of functparser_doc.dh @c ------------------------------------- @c ------------------------------------- @c parser.h @c @page @node StringMethod @section Method String @menu * KeysMethod:: Keys for Method String @end menu The key @code{method} is obligatory, it must be the first key and its value is the name of a method suitable for the choosen standard distribution. E.g., if method AROU is chosen, use @example method = arou @end example Of course the all following keys dependend on the method choosen at first. All corresponding @command{set} calls of UNU.RAN are available and the key is the string after the @command{unur__set_} part of the command. E.g., UNU.RAN provides the command @command{unur_arou_set_max_sqhratio} to set a parameter of method AROU. To call this function via the string-interface, the key @code{max_sqhratio} can be used: @example max_sqhratio = 0.9 @end example @noindent Additionally the keyword @code{debug} can be used to set debugging flags (see @ref{Debug,,Debugging}, for details). If this block is omitted, a suitable default method is used. Notice however that the default method may change in future versions of UNU.RAN. @c @c end of parser.h @c ------------------------------------- @c ------------------------------------- @c stringparser_doc.dh @c @node KeysMethod @subsection Keys for Method String List of methods and keys that are available via the String API. For description see the corresponding UNU.RAN set calls. @itemize @bullet @item @code{method = arou} @ @ @ @ @result{} @command{unur_arou_new} (@pxref{AROU}) @table @code @item cpoints = @i{} [, (@i{})] | (@i{}) @result{} @pxref{funct:unur_arou_set_cpoints,,@command{unur_arou_set_cpoints}} @item darsfactor = @i{} @result{} @pxref{funct:unur_arou_set_darsfactor,,@command{unur_arou_set_darsfactor}} @item guidefactor = @i{} @result{} @pxref{funct:unur_arou_set_guidefactor,,@command{unur_arou_set_guidefactor}} @item max_segments [= @i{}] @result{} @pxref{funct:unur_arou_set_max_segments,,@command{unur_arou_set_max_segments}} @item max_sqhratio = @i{} @result{} @pxref{funct:unur_arou_set_max_sqhratio,,@command{unur_arou_set_max_sqhratio}} @item pedantic [= @i{}] @result{} @pxref{funct:unur_arou_set_pedantic,,@command{unur_arou_set_pedantic}} @item usecenter [= @i{}] @result{} @pxref{funct:unur_arou_set_usecenter,,@command{unur_arou_set_usecenter}} @item usedars [= @i{}] @result{} @pxref{funct:unur_arou_set_usedars,,@command{unur_arou_set_usedars}} @item verify [= @i{}] @result{} @pxref{funct:unur_arou_set_verify,,@command{unur_arou_set_verify}} @end table @item @code{method = ars} @ @ @ @ @result{} @command{unur_ars_new} (@pxref{ARS}) @table @code @item cpoints = @i{} [, (@i{})] | (@i{}) @result{} @pxref{funct:unur_ars_set_cpoints,,@command{unur_ars_set_cpoints}} @item max_intervals [= @i{}] @result{} @pxref{funct:unur_ars_set_max_intervals,,@command{unur_ars_set_max_intervals}} @item max_iter [= @i{}] @result{} @pxref{funct:unur_ars_set_max_iter,,@command{unur_ars_set_max_iter}} @item pedantic [= @i{}] @result{} @pxref{funct:unur_ars_set_pedantic,,@command{unur_ars_set_pedantic}} @item reinit_ncpoints [= @i{}] @result{} @pxref{funct:unur_ars_set_reinit_ncpoints,,@command{unur_ars_set_reinit_ncpoints}} @item reinit_percentiles = @i{} [, (@i{})] | (@i{}) @result{} @pxref{funct:unur_ars_set_reinit_percentiles,,@command{unur_ars_set_reinit_percentiles}} @item verify [= @i{}] @result{} @pxref{funct:unur_ars_set_verify,,@command{unur_ars_set_verify}} @end table @item @code{method = auto} @ @ @ @ @result{} @command{unur_auto_new} (@pxref{AUTO}) @table @code @item logss [= @i{}] @result{} @pxref{funct:unur_auto_set_logss,,@command{unur_auto_set_logss}} @end table @item @code{method = cstd} @ @ @ @ @result{} @command{unur_cstd_new} (@pxref{CSTD}) @table @code @item variant = @i{} @result{} @pxref{funct:unur_cstd_set_variant,,@command{unur_cstd_set_variant}} @end table @item @code{method = dari} @ @ @ @ @result{} @command{unur_dari_new} (@pxref{DARI}) @table @code @item cpfactor = @i{} @result{} @pxref{funct:unur_dari_set_cpfactor,,@command{unur_dari_set_cpfactor}} @item squeeze [= @i{}] @result{} @pxref{funct:unur_dari_set_squeeze,,@command{unur_dari_set_squeeze}} @item tablesize [= @i{}] @result{} @pxref{funct:unur_dari_set_tablesize,,@command{unur_dari_set_tablesize}} @item verify [= @i{}] @result{} @pxref{funct:unur_dari_set_verify,,@command{unur_dari_set_verify}} @end table @item @code{method = dau} @ @ @ @ @result{} @command{unur_dau_new} (@pxref{DAU}) @table @code @item urnfactor = @i{} @result{} @pxref{funct:unur_dau_set_urnfactor,,@command{unur_dau_set_urnfactor}} @end table @item @code{method = dgt} @ @ @ @ @result{} @command{unur_dgt_new} (@pxref{DGT}) @table @code @item guidefactor = @i{} @result{} @pxref{funct:unur_dgt_set_guidefactor,,@command{unur_dgt_set_guidefactor}} @item variant = @i{} @result{} @pxref{funct:unur_dgt_set_variant,,@command{unur_dgt_set_variant}} @end table @item @code{method = dsrou} @ @ @ @ @result{} @command{unur_dsrou_new} (@pxref{DSROU}) @table @code @item cdfatmode = @i{} @result{} @pxref{funct:unur_dsrou_set_cdfatmode,,@command{unur_dsrou_set_cdfatmode}} @item verify [= @i{}] @result{} @pxref{funct:unur_dsrou_set_verify,,@command{unur_dsrou_set_verify}} @end table @item @code{method = dstd} @ @ @ @ @result{} @command{unur_dstd_new} (@pxref{DSTD}) @table @code @item variant = @i{} @result{} @pxref{funct:unur_dstd_set_variant,,@command{unur_dstd_set_variant}} @end table @item @code{method = empk} @ @ @ @ @result{} @command{unur_empk_new} (@pxref{EMPK}) @table @code @item beta = @i{} @result{} @pxref{funct:unur_empk_set_beta,,@command{unur_empk_set_beta}} @item kernel = @i{} @result{} @pxref{funct:unur_empk_set_kernel,,@command{unur_empk_set_kernel}} @item positive [= @i{}] @result{} @pxref{funct:unur_empk_set_positive,,@command{unur_empk_set_positive}} @item smoothing = @i{} @result{} @pxref{funct:unur_empk_set_smoothing,,@command{unur_empk_set_smoothing}} @item varcor [= @i{}] @result{} @pxref{funct:unur_empk_set_varcor,,@command{unur_empk_set_varcor}} @end table @item @code{method = gibbs} @ @ @ @ @result{} @command{unur_gibbs_new} (@pxref{GIBBS}) @table @code @item burnin [= @i{}] @result{} @pxref{funct:unur_gibbs_set_burnin,,@command{unur_gibbs_set_burnin}} @item c = @i{} @result{} @pxref{funct:unur_gibbs_set_c,,@command{unur_gibbs_set_c}} @item thinning [= @i{}] @result{} @pxref{funct:unur_gibbs_set_thinning,,@command{unur_gibbs_set_thinning}} @item variant_coordinate @result{} @pxref{funct:unur_gibbs_set_variant_coordinate,,@command{unur_gibbs_set_variant_coordinate}} @item variant_random_direction @result{} @pxref{funct:unur_gibbs_set_variant_random_direction,,@command{unur_gibbs_set_variant_random_direction}} @end table @item @code{method = hinv} @ @ @ @ @result{} @command{unur_hinv_new} (@pxref{HINV}) @table @code @item boundary = @i{}, @i{} | (@i{}) @result{} @pxref{funct:unur_hinv_set_boundary,,@command{unur_hinv_set_boundary}} @item cpoints = (@i{}), @i{} @result{} @pxref{funct:unur_hinv_set_cpoints,,@command{unur_hinv_set_cpoints}} @item guidefactor = @i{} @result{} @pxref{funct:unur_hinv_set_guidefactor,,@command{unur_hinv_set_guidefactor}} @item max_intervals [= @i{}] @result{} @pxref{funct:unur_hinv_set_max_intervals,,@command{unur_hinv_set_max_intervals}} @item order [= @i{}] @result{} @pxref{funct:unur_hinv_set_order,,@command{unur_hinv_set_order}} @item u_resolution = @i{} @result{} @pxref{funct:unur_hinv_set_u_resolution,,@command{unur_hinv_set_u_resolution}} @end table @item @code{method = hitro} @ @ @ @ @result{} @command{unur_hitro_new} (@pxref{HITRO}) @table @code @item adaptive_multiplier = @i{} @result{} @pxref{funct:unur_hitro_set_adaptive_multiplier,,@command{unur_hitro_set_adaptive_multiplier}} @item burnin [= @i{}] @result{} @pxref{funct:unur_hitro_set_burnin,,@command{unur_hitro_set_burnin}} @item r = @i{} @result{} @pxref{funct:unur_hitro_set_r,,@command{unur_hitro_set_r}} @item thinning [= @i{}] @result{} @pxref{funct:unur_hitro_set_thinning,,@command{unur_hitro_set_thinning}} @item use_adaptiveline [= @i{}] @result{} @pxref{funct:unur_hitro_set_use_adaptiveline,,@command{unur_hitro_set_use_adaptiveline}} @item use_adaptiverectangle [= @i{}] @result{} @pxref{funct:unur_hitro_set_use_adaptiverectangle,,@command{unur_hitro_set_use_adaptiverectangle}} @item use_boundingrectangle [= @i{}] @result{} @pxref{funct:unur_hitro_set_use_boundingrectangle,,@command{unur_hitro_set_use_boundingrectangle}} @item v = @i{} @result{} @pxref{funct:unur_hitro_set_v,,@command{unur_hitro_set_v}} @item variant_coordinate @result{} @pxref{funct:unur_hitro_set_variant_coordinate,,@command{unur_hitro_set_variant_coordinate}} @item variant_random_direction @result{} @pxref{funct:unur_hitro_set_variant_random_direction,,@command{unur_hitro_set_variant_random_direction}} @end table @item @code{method = hrb} @ @ @ @ @result{} @command{unur_hrb_new} (@pxref{HRB}) @table @code @item upperbound = @i{} @result{} @pxref{funct:unur_hrb_set_upperbound,,@command{unur_hrb_set_upperbound}} @item verify [= @i{}] @result{} @pxref{funct:unur_hrb_set_verify,,@command{unur_hrb_set_verify}} @end table @item @code{method = hrd} @ @ @ @ @result{} @command{unur_hrd_new} (@pxref{HRD}) @table @code @item verify [= @i{}] @result{} @pxref{funct:unur_hrd_set_verify,,@command{unur_hrd_set_verify}} @end table @item @code{method = hri} @ @ @ @ @result{} @command{unur_hri_new} (@pxref{HRI}) @table @code @item p0 = @i{} @result{} @pxref{funct:unur_hri_set_p0,,@command{unur_hri_set_p0}} @item verify [= @i{}] @result{} @pxref{funct:unur_hri_set_verify,,@command{unur_hri_set_verify}} @end table @item @code{method = itdr} @ @ @ @ @result{} @command{unur_itdr_new} (@pxref{ITDR}) @table @code @item cp = @i{} @result{} @pxref{funct:unur_itdr_set_cp,,@command{unur_itdr_set_cp}} @item ct = @i{} @result{} @pxref{funct:unur_itdr_set_ct,,@command{unur_itdr_set_ct}} @item verify [= @i{}] @result{} @pxref{funct:unur_itdr_set_verify,,@command{unur_itdr_set_verify}} @item xi = @i{} @result{} @pxref{funct:unur_itdr_set_xi,,@command{unur_itdr_set_xi}} @end table @item @code{method = mvtdr} @ @ @ @ @result{} @command{unur_mvtdr_new} (@pxref{MVTDR}) @table @code @item boundsplitting = @i{} @result{} @pxref{funct:unur_mvtdr_set_boundsplitting,,@command{unur_mvtdr_set_boundsplitting}} @item maxcones [= @i{}] @result{} @pxref{funct:unur_mvtdr_set_maxcones,,@command{unur_mvtdr_set_maxcones}} @item stepsmin [= @i{}] @result{} @pxref{funct:unur_mvtdr_set_stepsmin,,@command{unur_mvtdr_set_stepsmin}} @item verify [= @i{}] @result{} @pxref{funct:unur_mvtdr_set_verify,,@command{unur_mvtdr_set_verify}} @end table @item @code{method = ninv} @ @ @ @ @result{} @command{unur_ninv_new} (@pxref{NINV}) @table @code @item max_iter [= @i{}] @result{} @pxref{funct:unur_ninv_set_max_iter,,@command{unur_ninv_set_max_iter}} @item start = @i{}, @i{} | (@i{}) @result{} @pxref{funct:unur_ninv_set_start,,@command{unur_ninv_set_start}} @item table [= @i{}] @result{} @pxref{funct:unur_ninv_set_table,,@command{unur_ninv_set_table}} @item u_resolution = @i{} @result{} @pxref{funct:unur_ninv_set_u_resolution,,@command{unur_ninv_set_u_resolution}} @item usebisect @result{} @pxref{funct:unur_ninv_set_usebisect,,@command{unur_ninv_set_usebisect}} @item usenewton @result{} @pxref{funct:unur_ninv_set_usenewton,,@command{unur_ninv_set_usenewton}} @item useregula @result{} @pxref{funct:unur_ninv_set_useregula,,@command{unur_ninv_set_useregula}} @item x_resolution = @i{} @result{} @pxref{funct:unur_ninv_set_x_resolution,,@command{unur_ninv_set_x_resolution}} @end table @item @code{method = nrou} @ @ @ @ @result{} @command{unur_nrou_new} (@pxref{NROU}) @table @code @item center = @i{} @result{} @pxref{funct:unur_nrou_set_center,,@command{unur_nrou_set_center}} @item r = @i{} @result{} @pxref{funct:unur_nrou_set_r,,@command{unur_nrou_set_r}} @item u = @i{}, @i{} | (@i{}) @result{} @pxref{funct:unur_nrou_set_u,,@command{unur_nrou_set_u}} @item v = @i{} @result{} @pxref{funct:unur_nrou_set_v,,@command{unur_nrou_set_v}} @item verify [= @i{}] @result{} @pxref{funct:unur_nrou_set_verify,,@command{unur_nrou_set_verify}} @end table @item @code{method = pinv} @ @ @ @ @result{} @command{unur_pinv_new} (@pxref{PINV}) @table @code @item boundary = @i{}, @i{} | (@i{}) @result{} @pxref{funct:unur_pinv_set_boundary,,@command{unur_pinv_set_boundary}} @item extra_testpoints [= @i{}] @result{} @pxref{funct:unur_pinv_set_extra_testpoints,,@command{unur_pinv_set_extra_testpoints}} @item keepcdf [= @i{}] @result{} @pxref{funct:unur_pinv_set_keepcdf,,@command{unur_pinv_set_keepcdf}} @item max_intervals [= @i{}] @result{} @pxref{funct:unur_pinv_set_max_intervals,,@command{unur_pinv_set_max_intervals}} @item order [= @i{}] @result{} @pxref{funct:unur_pinv_set_order,,@command{unur_pinv_set_order}} @item searchboundary = @i{}, @i{} | (@i{}) @result{} @pxref{funct:unur_pinv_set_searchboundary,,@command{unur_pinv_set_searchboundary}} @item smoothness [= @i{}] @result{} @pxref{funct:unur_pinv_set_smoothness,,@command{unur_pinv_set_smoothness}} @item u_resolution = @i{} @result{} @pxref{funct:unur_pinv_set_u_resolution,,@command{unur_pinv_set_u_resolution}} @item use_upoints [= @i{}] @result{} @pxref{funct:unur_pinv_set_use_upoints,,@command{unur_pinv_set_use_upoints}} @item usecdf @result{} @pxref{funct:unur_pinv_set_usecdf,,@command{unur_pinv_set_usecdf}} @item usepdf @result{} @pxref{funct:unur_pinv_set_usepdf,,@command{unur_pinv_set_usepdf}} @end table @item @code{method = srou} @ @ @ @ @result{} @command{unur_srou_new} (@pxref{SROU}) @table @code @item cdfatmode = @i{} @result{} @pxref{funct:unur_srou_set_cdfatmode,,@command{unur_srou_set_cdfatmode}} @item pdfatmode = @i{} @result{} @pxref{funct:unur_srou_set_pdfatmode,,@command{unur_srou_set_pdfatmode}} @item r = @i{} @result{} @pxref{funct:unur_srou_set_r,,@command{unur_srou_set_r}} @item usemirror [= @i{}] @result{} @pxref{funct:unur_srou_set_usemirror,,@command{unur_srou_set_usemirror}} @item usesqueeze [= @i{}] @result{} @pxref{funct:unur_srou_set_usesqueeze,,@command{unur_srou_set_usesqueeze}} @item verify [= @i{}] @result{} @pxref{funct:unur_srou_set_verify,,@command{unur_srou_set_verify}} @end table @item @code{method = ssr} @ @ @ @ @result{} @command{unur_ssr_new} (@pxref{SSR}) @table @code @item cdfatmode = @i{} @result{} @pxref{funct:unur_ssr_set_cdfatmode,,@command{unur_ssr_set_cdfatmode}} @item pdfatmode = @i{} @result{} @pxref{funct:unur_ssr_set_pdfatmode,,@command{unur_ssr_set_pdfatmode}} @item usesqueeze [= @i{}] @result{} @pxref{funct:unur_ssr_set_usesqueeze,,@command{unur_ssr_set_usesqueeze}} @item verify [= @i{}] @result{} @pxref{funct:unur_ssr_set_verify,,@command{unur_ssr_set_verify}} @end table @item @code{method = tabl} @ @ @ @ @result{} @command{unur_tabl_new} (@pxref{TABL}) @table @code @item areafraction = @i{} @result{} @pxref{funct:unur_tabl_set_areafraction,,@command{unur_tabl_set_areafraction}} @item boundary = @i{}, @i{} | (@i{}) @result{} @pxref{funct:unur_tabl_set_boundary,,@command{unur_tabl_set_boundary}} @item cpoints = @i{} [, (@i{})] | (@i{}) @result{} @pxref{funct:unur_tabl_set_cpoints,,@command{unur_tabl_set_cpoints}} @item darsfactor = @i{} @result{} @pxref{funct:unur_tabl_set_darsfactor,,@command{unur_tabl_set_darsfactor}} @item guidefactor = @i{} @result{} @pxref{funct:unur_tabl_set_guidefactor,,@command{unur_tabl_set_guidefactor}} @item max_intervals [= @i{}] @result{} @pxref{funct:unur_tabl_set_max_intervals,,@command{unur_tabl_set_max_intervals}} @item max_sqhratio = @i{} @result{} @pxref{funct:unur_tabl_set_max_sqhratio,,@command{unur_tabl_set_max_sqhratio}} @item nstp [= @i{}] @result{} @pxref{funct:unur_tabl_set_nstp,,@command{unur_tabl_set_nstp}} @item pedantic [= @i{}] @result{} @pxref{funct:unur_tabl_set_pedantic,,@command{unur_tabl_set_pedantic}} @item slopes = (@i{}), @i{} @result{} @pxref{funct:unur_tabl_set_slopes,,@command{unur_tabl_set_slopes}} @item usedars [= @i{}] @result{} @pxref{funct:unur_tabl_set_usedars,,@command{unur_tabl_set_usedars}} @item useear [= @i{}] @result{} @pxref{funct:unur_tabl_set_useear,,@command{unur_tabl_set_useear}} @item variant_ia [= @i{}] @result{} @pxref{funct:unur_tabl_set_variant_ia,,@command{unur_tabl_set_variant_ia}} @item variant_splitmode = @i{} @result{} @pxref{funct:unur_tabl_set_variant_splitmode,,@command{unur_tabl_set_variant_splitmode}} @item verify [= @i{}] @result{} @pxref{funct:unur_tabl_set_verify,,@command{unur_tabl_set_verify}} @end table @item @code{method = tdr} @ @ @ @ @result{} @command{unur_tdr_new} (@pxref{TDR}) @table @code @item c = @i{} @result{} @pxref{funct:unur_tdr_set_c,,@command{unur_tdr_set_c}} @item cpoints = @i{} [, (@i{})] | (@i{}) @result{} @pxref{funct:unur_tdr_set_cpoints,,@command{unur_tdr_set_cpoints}} @item darsfactor = @i{} @result{} @pxref{funct:unur_tdr_set_darsfactor,,@command{unur_tdr_set_darsfactor}} @item guidefactor = @i{} @result{} @pxref{funct:unur_tdr_set_guidefactor,,@command{unur_tdr_set_guidefactor}} @item max_intervals [= @i{}] @result{} @pxref{funct:unur_tdr_set_max_intervals,,@command{unur_tdr_set_max_intervals}} @item max_sqhratio = @i{} @result{} @pxref{funct:unur_tdr_set_max_sqhratio,,@command{unur_tdr_set_max_sqhratio}} @item pedantic [= @i{}] @result{} @pxref{funct:unur_tdr_set_pedantic,,@command{unur_tdr_set_pedantic}} @item reinit_ncpoints [= @i{}] @result{} @pxref{funct:unur_tdr_set_reinit_ncpoints,,@command{unur_tdr_set_reinit_ncpoints}} @item reinit_percentiles = @i{} [, (@i{})] | (@i{}) @result{} @pxref{funct:unur_tdr_set_reinit_percentiles,,@command{unur_tdr_set_reinit_percentiles}} @item usecenter [= @i{}] @result{} @pxref{funct:unur_tdr_set_usecenter,,@command{unur_tdr_set_usecenter}} @item usedars [= @i{}] @result{} @pxref{funct:unur_tdr_set_usedars,,@command{unur_tdr_set_usedars}} @item usemode [= @i{}] @result{} @pxref{funct:unur_tdr_set_usemode,,@command{unur_tdr_set_usemode}} @item variant_gw @result{} @pxref{funct:unur_tdr_set_variant_gw,,@command{unur_tdr_set_variant_gw}} @item variant_ia @result{} @pxref{funct:unur_tdr_set_variant_ia,,@command{unur_tdr_set_variant_ia}} @item variant_ps @result{} @pxref{funct:unur_tdr_set_variant_ps,,@command{unur_tdr_set_variant_ps}} @item verify [= @i{}] @result{} @pxref{funct:unur_tdr_set_verify,,@command{unur_tdr_set_verify}} @end table @item @code{method = utdr} @ @ @ @ @result{} @command{unur_utdr_new} (@pxref{UTDR}) @table @code @item cpfactor = @i{} @result{} @pxref{funct:unur_utdr_set_cpfactor,,@command{unur_utdr_set_cpfactor}} @item deltafactor = @i{} @result{} @pxref{funct:unur_utdr_set_deltafactor,,@command{unur_utdr_set_deltafactor}} @item pdfatmode = @i{} @result{} @pxref{funct:unur_utdr_set_pdfatmode,,@command{unur_utdr_set_pdfatmode}} @item verify [= @i{}] @result{} @pxref{funct:unur_utdr_set_verify,,@command{unur_utdr_set_verify}} @end table @item @code{method = vempk} @ @ @ @ @result{} @command{unur_vempk_new} (@pxref{VEMPK}) @table @code @item smoothing = @i{} @result{} @pxref{funct:unur_vempk_set_smoothing,,@command{unur_vempk_set_smoothing}} @item varcor [= @i{}] @result{} @pxref{funct:unur_vempk_set_varcor,,@command{unur_vempk_set_varcor}} @end table @item @code{method = vnrou} @ @ @ @ @result{} @command{unur_vnrou_new} (@pxref{VNROU}) @table @code @item r = @i{} @result{} @pxref{funct:unur_vnrou_set_r,,@command{unur_vnrou_set_r}} @item v = @i{} @result{} @pxref{funct:unur_vnrou_set_v,,@command{unur_vnrou_set_v}} @item verify [= @i{}] @result{} @pxref{funct:unur_vnrou_set_verify,,@command{unur_vnrou_set_verify}} @end table @end itemize @c @c end of stringparser_doc.dh @c ------------------------------------- @c ------------------------------------- @c parser.h @c @page @node StringURNG @section Uniform RNG String The value of the @code{urng} key is passed to the PRNG interface (see @ifinfo @xref{Top,,Overview,prng,PRNG Manual}. @end ifinfo @ifnotinfo @uref{http://statmath.wu.ac.at/prng/manual/,PRNG manual} @end ifnotinfo for details). However it only works when using the PRNG library is enabled, see @ref{Installation} for details. There are no other keys. IMPORTANT: UNU.RAN creates a new uniform random number generator for the generator object. The pointer to this uniform generator has to be read and saved via a @ifhtml @ref{funct:unur_get_urng,@command{unur_get_urng}} @end ifhtml @ifnothtml @command{unur_get_urng} @end ifnothtml call in order to clear the memory @emph{before} the UNU.RAN generator object is destroyed. If this block is omitted the UNU.RAN default generator is used (which @emph{must not} be destroyed). @c @c end of parser.h @c ------------------------------------- @c ------------------------------------- @c distr.h @c @page @node Distribution_objects @chapter Handling distribution objects @menu * AllDistr:: Functions for all kinds of distribution objects * CONT:: Continuous univariate distributions * CORDER:: Continuous univariate order statistics * CEMP:: Continuous empirical univariate distributions * CVEC:: Continuous multivariate distributions * CONDI:: Continuous univariate full conditional distribution * CVEMP:: Continuous empirical multivariate distributions * MATR:: MATRix distributions * DISCR:: Discrete univariate distributions @end menu Objects of type @code{UNUR_DISTR} are used for handling distributions. All data about a distribution are stored in this object. UNU.RAN provides functions that return instances of such objects for standard distributions (@pxref{Stddist,,Standard distributions}). It is then possible to change these distribution objects by various set calls. Moreover, it is possible to build a distribution object entirely from scratch. For this purpose there exists @command{unur_distr__new} calls that return an empty object of this type for each object type (eg. univariate contiuous) which can be filled with the appropriate set calls. UNU.RAN distinguishes between several types of distributions, each of which has its own sets of possible parameters (for details see the corresponding sections): @itemize @minus @item continuous univariate distributions @item continuous univariate order statistics @item continuous empirical univariate distributions @item continuous multivariate distributions @item continuous empirical multivariate distributions @item matrix distributions @item discrete univariate distributions @end itemize Notice that there are essential data about a distribution, eg. the PDF, a list of (shape, scale, location) parameters for the distribution, and the domain of (the possibly truncated) distribution. And there exist parameters that are/can be derived from these, eg. the mode of the distribution or the area below the given PDF (which need not be normalized for many methods). UNU.RAN keeps track of parameters which are known. Thus if one of the essential parameters is changed all derived parameters are marked as unknown and must be set again if these are required for the chosen generation method. Additionally to set calls there are calls for updating derived parameters for objects provided by the UNU.RAN library of standard distributions (one for each parameter to avoid computational overhead since not all parameters are required for all generator methods). All parameters of distribution objects can be read by corresponding get calls. Every generator object has its own copy of a distribution object which is accessible by a @ifhtml @ref{funct:unur_get_distr,@command{unur_get_distr}} @end ifhtml @ifnothtml @command{unur_get_distr} @end ifnothtml call. Thus the parameter for this distribution can be read. However, @strong{never} extract the distribution object out of a generator object and run one of the set calls on it to modify the distribution. (How should the poor generator object know what has happend?) Instead there exist calls for each of the generator methods that change particular parameters of the internal copy of the distribution object. @subsubheading How To Use UNU.RAN collects all data required for a particular generation method in a @emph{distribution object}. There are two ways to get an instance of a distributions object: @enumerate @item Build a distribtion from scratch, by means of the corresponding @command{unur_distr__new} call, where @command{} is the type of the distribution as listed in the below subsections. @item Use the corresponding @command{unur_distr__new} call to get prebuild distribution from the UNU.RAN library of standard distributions. Here @command{} is the name of the standard distribution in @ref{Stddist,,Standard distributions}. @end enumerate In either cases the corresponding @command{unur_distr__set_} calls to set the necessary parameters @command{} (case 1), or change the values of the standard distribution in case 2 (if this makes sense for you). In the latter case @command{} is the type to which the standard distribution belongs to. These @command{set} calls return @code{UNUR_SUCCESS} when the correspondig parameter has been set successfully. Otherwise an error code is returned. The parameters of a distribution are divided into @emph{essential} and @emph{derived} parameters. Notice, that there are some restrictions in setting parameters to avoid possible confusions. Changing essential parameters marks derived parameters as @code{unknown}. Some of the parameters cannot be changed any more when already set; some parameters block each others. In such a case a new instance of a distribution object has to be build. Additionally @command{unur_distr__upd_} calls can be used for updating derived parameters for objects provided by the UNU.RAN library of standard distributions. All parameters of a distribution object get be read by means of @command{unur_distr__get_} calls. Every distribution object be identified by its @code{name} which is a string of arbitrary characters provided by the user. For standard distribution it is automatically set to @command{} in the corresponding @command{new} call. It can be changed to any other string. @c @c end of distr.h @c ------------------------------------- @c ------------------------------------- @c distr.h @c @page @node AllDistr @section Functions for all kinds of distribution objects The calls in this section can be applied to all distribution objects. @itemize @minus @item Destroy @command{free} an instance of a generator object. @item Ask for the @command{type} of a generator object. @item Ask for the @command{dimension} of a generator object. @item Deal with the @command{name} (identifier string) of a generator object. @end itemize @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_distr_free,unur_distr_free} @item @ref{funct:unur_distr_set_name,unur_distr_set_name} @item @ref{funct:unur_distr_get_name,unur_distr_get_name} @item @ref{funct:unur_distr_get_dim,unur_distr_get_dim} @item @ref{funct:unur_distr_get_type,unur_distr_get_type} @item @ref{funct:unur_distr_is_cont,unur_distr_is_cont} @item @ref{funct:unur_distr_is_cvec,unur_distr_is_cvec} @item @ref{funct:unur_distr_is_cemp,unur_distr_is_cemp} @item @ref{funct:unur_distr_is_cvemp,unur_distr_is_cvemp} @item @ref{funct:unur_distr_is_discr,unur_distr_is_discr} @item @ref{funct:unur_distr_is_matr,unur_distr_is_matr} @item @ref{funct:unur_distr_set_extobj,unur_distr_set_extobj} @item @ref{funct:unur_distr_get_extobj,unur_distr_get_extobj} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_distr_free} @deftypefn Function {void} unur_distr_free (UNUR_DISTR* @var{distribution}) Destroy the @var{distribution} object. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_free} @deftypefn {} {void} unur_distr_free (UNUR_DISTR* @var{distribution}) Destroy the @var{distribution} object. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_set_name} @anchor{funct:unur_distr_get_name} @deftypefn Function {int} unur_distr_set_name (UNUR_DISTR* @var{distribution}, const @var{char* name}) @deftypefnx Function {const char*} unur_distr_get_name (const @var{UNUR_DISTR* distribution}) Set and get @var{name} of @var{distribution}. The @var{name} can be an arbitrary character string. It can be used to identify generator objects for the user. It is used by UNU.RAN when printing information of the distribution object into a log files. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_set_name} @anchor{funct:unur_distr_get_name} @deftypefn {} {int} unur_distr_set_name (UNUR_DISTR* @var{distribution}, const @var{char* name}) @deftypefnx {} {const char*} unur_distr_get_name (const @var{UNUR_DISTR* distribution}) Set and get @var{name} of @var{distribution}. The @var{name} can be an arbitrary character string. It can be used to identify generator objects for the user. It is used by UNU.RAN when printing information of the distribution object into a log files. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_get_dim} @deftypefn Function {int} unur_distr_get_dim (const @var{UNUR_DISTR* distribution}) Get number of components of a random vector (its dimension) the @var{distribution}. For univariate distributions it returns dimension @code{1}. For matrix distributions it returns the number of components (i.e., number of rows times number of columns). When the respective numbers of rows and columns are needed use @ifhtml @ref{funct:unur_distr_matr_get_dim,@command{unur_distr_matr_get_dim}} @end ifhtml @ifnothtml @command{unur_distr_matr_get_dim} @end ifnothtml instead. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_get_dim} @deftypefn {} {int} unur_distr_get_dim (const @var{UNUR_DISTR* distribution}) Get number of components of a random vector (its dimension) the @var{distribution}. For univariate distributions it returns dimension @code{1}. For matrix distributions it returns the number of components (i.e., number of rows times number of columns). When the respective numbers of rows and columns are needed use @ifhtml @ref{funct:unur_distr_matr_get_dim,@command{unur_distr_matr_get_dim}} @end ifhtml @ifnothtml @command{unur_distr_matr_get_dim} @end ifnothtml instead. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_get_type} @deftypefn Function {unsigned int} unur_distr_get_type (const @var{UNUR_DISTR* distribution}) Get type of @var{distribution}. Possible types are @table @code @item UNUR_DISTR_CONT univariate continuous distribution @item UNUR_DISTR_CEMP empirical continuous univariate distribution (i.e. a sample) @item UNUR_DISTR_CVEC continuous mulitvariate distribution @item UNUR_DISTR_CVEMP empirical continuous multivariate distribution (i.e. a vector sample) @item UNUR_DISTR_DISCR discrete univariate distribution @item UNUR_DISTR_MATR matrix distribution @end table Alternatively the @command{unur_distr_is_} calls can be used. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_get_type} @deftypefn {} {unsigned int} unur_distr_get_type (const @var{UNUR_DISTR* distribution}) Get type of @var{distribution}. Possible types are @table @code @item UNUR_DISTR_CONT univariate continuous distribution @item UNUR_DISTR_CEMP empirical continuous univariate distribution (i.e. a sample) @item UNUR_DISTR_CVEC continuous mulitvariate distribution @item UNUR_DISTR_CVEMP empirical continuous multivariate distribution (i.e. a vector sample) @item UNUR_DISTR_DISCR discrete univariate distribution @item UNUR_DISTR_MATR matrix distribution @end table Alternatively the @command{unur_distr_is_} calls can be used. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_is_cont} @deftypefn Function {int} unur_distr_is_cont (const @var{UNUR_DISTR* distribution}) @code{TRUE} if @var{distribution} is a continuous univariate distribution. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_is_cont} @deftypefn {} {int} unur_distr_is_cont (const @var{UNUR_DISTR* distribution}) @code{TRUE} if @var{distribution} is a continuous univariate distribution. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_is_cvec} @deftypefn Function {int} unur_distr_is_cvec (const @var{UNUR_DISTR* distribution}) @code{TRUE} if @var{distribution} is a continuous multivariate distribution. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_is_cvec} @deftypefn {} {int} unur_distr_is_cvec (const @var{UNUR_DISTR* distribution}) @code{TRUE} if @var{distribution} is a continuous multivariate distribution. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_is_cemp} @deftypefn Function {int} unur_distr_is_cemp (const @var{UNUR_DISTR* distribution}) @code{TRUE} if @var{distribution} is an empirical continuous univariate distribution, i.e. a sample. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_is_cemp} @deftypefn {} {int} unur_distr_is_cemp (const @var{UNUR_DISTR* distribution}) @code{TRUE} if @var{distribution} is an empirical continuous univariate distribution, i.e. a sample. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_is_cvemp} @deftypefn Function {int} unur_distr_is_cvemp (const @var{UNUR_DISTR* distribution}) @code{TRUE} if @var{distribution} is an empirical continuous multivariate distribution. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_is_cvemp} @deftypefn {} {int} unur_distr_is_cvemp (const @var{UNUR_DISTR* distribution}) @code{TRUE} if @var{distribution} is an empirical continuous multivariate distribution. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_is_discr} @deftypefn Function {int} unur_distr_is_discr (const @var{UNUR_DISTR* distribution}) @code{TRUE} if @var{distribution} is a discrete univariate distribution. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_is_discr} @deftypefn {} {int} unur_distr_is_discr (const @var{UNUR_DISTR* distribution}) @code{TRUE} if @var{distribution} is a discrete univariate distribution. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_is_matr} @deftypefn Function {int} unur_distr_is_matr (const @var{UNUR_DISTR* distribution}) @code{TRUE} if @var{distribution} is a matrix distribution. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_is_matr} @deftypefn {} {int} unur_distr_is_matr (const @var{UNUR_DISTR* distribution}) @code{TRUE} if @var{distribution} is a matrix distribution. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_set_extobj} @deftypefn Function {int} unur_distr_set_extobj (UNUR_DISTR* @var{distribution}, const @var{void* extobj}) Store a pointer to an external object. This might be usefull if the PDF, PMF, CDF or other functions used to implement a particular distribution a parameter set that cannot be stored as doubles (e.g. pointers to some structure that holds information of the distribution). @strong{Important:} When UNU.RAN copies this distribution object into the generator object, then the address @var{extobj} that this pointer contains is simply copied. Thus the generator holds an address of a non-private object! Once the generator object has been created any change in the external object might effect the generator object. @strong{Warning:} External objects must be used with care. Once the generator object has been created or the distribution object has been copied you @emph{must not} destroy this external object. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_set_extobj} @deftypefn {} {int} unur_distr_set_extobj (UNUR_DISTR* @var{distribution}, const @var{void* extobj}) Store a pointer to an external object. This might be usefull if the PDF, PMF, CDF or other functions used to implement a particular distribution a parameter set that cannot be stored as doubles (e.g. pointers to some structure that holds information of the distribution). @strong{Important:} When UNU.RAN copies this distribution object into the generator object, then the address @var{extobj} that this pointer contains is simply copied. Thus the generator holds an address of a non-private object! Once the generator object has been created any change in the external object might effect the generator object. @strong{Warning:} External objects must be used with care. Once the generator object has been created or the distribution object has been copied you @emph{must not} destroy this external object. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_get_extobj} @deftypefn Function {const void*} unur_distr_get_extobj (const @var{UNUR_DISTR* distribution}) Get the pointer to the external object. @emph{Important:} Changing this object must be done with with extreme care. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_get_extobj} @deftypefn {} {const void*} unur_distr_get_extobj (const @var{UNUR_DISTR* distribution}) Get the pointer to the external object. @emph{Important:} Changing this object must be done with with extreme care. @end deftypefn @end ifnotinfo @c @c end of distr.h @c ------------------------------------- @c ------------------------------------- @c cont.h @c @page @node CONT @section Continuous univariate distributions The calls in this section can be applied to continuous univariate distributions. @itemize @minus @item Create a @command{new} instance of a continuous univariate distribution. @item Handle and evaluate distribution function (CDF, @command{cdf}), probability density function (PDF, @command{pdf}) and the derivative of the density function (@command{dpdf}). The following is important: @itemize . @item @command{pdf} need not be normalized, i.e., any integrable nonnegative function can be used. @item @command{dpdf} must the derivate of the function provided as @command{pdf}. @item @command{cdf} must be a distribution function, i.e. it must be monotonically increasing with range [0,1]. @item If @command{cdf} and @command{pdf} are used together for a pariticular generation method, then @command{pdf} must be the derivate of the @command{cdf}, i.e., it must be normalized. @end itemize @item Handle and evaluate the logarithm of the probability density function (logPDF, @command{logpdf}) and the derivative of the logarithm of the density function (@command{dlogpdf}). Some methods use the logarithm of the density if available. @item Set (and change) parameters (@command{pdfparams}) and the area below the graph (@command{pdfarea}) of the given density. @item Set the @command{mode} (or pole) of the distribution. @item Set the @command{center} of the distribution. It is used by some generation methods to adjust the parameters of the generation algorithms to gain better performance. It can be seens as the location of the ``central part'' of the distribution. @item Some generation methods require the hazard rate (@command{hr}) of the distribution instead of its @command{pdf}. @item Alternatively, @command{cdf}, @command{pdf}, @command{dpdf}, and @command{hr} can be provided as @command{str}ings instead of function pointers. @item Set the @command{domain} of the distribution. Notice that the library also can handle truncated distributions, i.e., distributions that are derived from (standard) distributions by simply restricting its domain to a subset. However, there is a subtle difference between changing the domain of a distribution object by a @ifhtml @ref{funct:unur_distr_cont_set_domain,@command{unur_distr_cont_set_domain}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_domain} @end ifnothtml call and changing the (truncated) domain for an existing generator object. The domain of the distribution object is used to create the generator object with hats, squeezes, tables, etc. Whereas truncating the domain of an existing generator object need not necessarily require a recomputation of these data. Thus by a @command{unur__chg_truncated} call (if available) the sampling region is restricted to the subset of the domain of the given distribution object. However, generation methods that require a recreation of the generator object when the domain is changed have a @command{unur__chg_domain} call instead. For these calls there are of course no restrictions on the given domain (i.e., it is possible to increase the domain of the distribution) (@pxref{Methods}, for details). @end itemize @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_distr_cont_new,unur_distr_cont_new} @item @ref{funct:unur_distr_cont_set_pdf,unur_distr_cont_set_pdf} @item @ref{funct:unur_distr_cont_set_dpdf,unur_distr_cont_set_dpdf} @item @ref{funct:unur_distr_cont_set_cdf,unur_distr_cont_set_cdf} @item @ref{funct:unur_distr_cont_set_invcdf,unur_distr_cont_set_invcdf} @item @ref{funct:unur_distr_cont_get_pdf,unur_distr_cont_get_pdf} @item @ref{funct:unur_distr_cont_get_dpdf,unur_distr_cont_get_dpdf} @item @ref{funct:unur_distr_cont_get_cdf,unur_distr_cont_get_cdf} @item @ref{funct:unur_distr_cont_get_invcdf,unur_distr_cont_get_invcdf} @item @ref{funct:unur_distr_cont_eval_pdf,unur_distr_cont_eval_pdf} @item @ref{funct:unur_distr_cont_eval_dpdf,unur_distr_cont_eval_dpdf} @item @ref{funct:unur_distr_cont_eval_cdf,unur_distr_cont_eval_cdf} @item @ref{funct:unur_distr_cont_eval_invcdf,unur_distr_cont_eval_invcdf} @item @ref{funct:unur_distr_cont_set_logpdf,unur_distr_cont_set_logpdf} @item @ref{funct:unur_distr_cont_set_dlogpdf,unur_distr_cont_set_dlogpdf} @item @ref{funct:unur_distr_cont_set_logcdf,unur_distr_cont_set_logcdf} @item @ref{funct:unur_distr_cont_get_logpdf,unur_distr_cont_get_logpdf} @item @ref{funct:unur_distr_cont_get_dlogpdf,unur_distr_cont_get_dlogpdf} @item @ref{funct:unur_distr_cont_get_logcdf,unur_distr_cont_get_logcdf} @item @ref{funct:unur_distr_cont_eval_logpdf,unur_distr_cont_eval_logpdf} @item @ref{funct:unur_distr_cont_eval_dlogpdf,unur_distr_cont_eval_dlogpdf} @item @ref{funct:unur_distr_cont_eval_logcdf,unur_distr_cont_eval_logcdf} @item @ref{funct:unur_distr_cont_set_pdfstr,unur_distr_cont_set_pdfstr} @item @ref{funct:unur_distr_cont_set_cdfstr,unur_distr_cont_set_cdfstr} @item @ref{funct:unur_distr_cont_get_pdfstr,unur_distr_cont_get_pdfstr} @item @ref{funct:unur_distr_cont_get_dpdfstr,unur_distr_cont_get_dpdfstr} @item @ref{funct:unur_distr_cont_get_cdfstr,unur_distr_cont_get_cdfstr} @item @ref{funct:unur_distr_cont_set_pdfparams,unur_distr_cont_set_pdfparams} @item @ref{funct:unur_distr_cont_get_pdfparams,unur_distr_cont_get_pdfparams} @item @ref{funct:unur_distr_cont_set_pdfparams_vec,unur_distr_cont_set_pdfparams_vec} @item @ref{funct:unur_distr_cont_get_pdfparams_vec,unur_distr_cont_get_pdfparams_vec} @item @ref{funct:unur_distr_cont_set_logpdfstr,unur_distr_cont_set_logpdfstr} @item @ref{funct:unur_distr_cont_get_logpdfstr,unur_distr_cont_get_logpdfstr} @item @ref{funct:unur_distr_cont_get_dlogpdfstr,unur_distr_cont_get_dlogpdfstr} @item @ref{funct:unur_distr_cont_set_logcdfstr,unur_distr_cont_set_logcdfstr} @item @ref{funct:unur_distr_cont_get_logcdfstr,unur_distr_cont_get_logcdfstr} @item @ref{funct:unur_distr_cont_set_domain,unur_distr_cont_set_domain} @item @ref{funct:unur_distr_cont_get_domain,unur_distr_cont_get_domain} @item @ref{funct:unur_distr_cont_get_truncated,unur_distr_cont_get_truncated} @item @ref{funct:unur_distr_cont_set_hr,unur_distr_cont_set_hr} @item @ref{funct:unur_distr_cont_get_hr,unur_distr_cont_get_hr} @item @ref{funct:unur_distr_cont_eval_hr,unur_distr_cont_eval_hr} @item @ref{funct:unur_distr_cont_set_hrstr,unur_distr_cont_set_hrstr} @item @ref{funct:unur_distr_cont_get_hrstr,unur_distr_cont_get_hrstr} @item @ref{funct:unur_distr_cont_set_mode,unur_distr_cont_set_mode} @item @ref{funct:unur_distr_cont_upd_mode,unur_distr_cont_upd_mode} @item @ref{funct:unur_distr_cont_get_mode,unur_distr_cont_get_mode} @item @ref{funct:unur_distr_cont_set_center,unur_distr_cont_set_center} @item @ref{funct:unur_distr_cont_get_center,unur_distr_cont_get_center} @item @ref{funct:unur_distr_cont_set_pdfarea,unur_distr_cont_set_pdfarea} @item @ref{funct:unur_distr_cont_upd_pdfarea,unur_distr_cont_upd_pdfarea} @item @ref{funct:unur_distr_cont_get_pdfarea,unur_distr_cont_get_pdfarea} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_distr_cont_new} @deftypefn Function {UNUR_DISTR*} unur_distr_cont_new (void) Create a new (empty) object for univariate continuous distribution. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cont_new} @deftypefn {} {UNUR_DISTR*} unur_distr_cont_new (void) Create a new (empty) object for univariate continuous distribution. @end deftypefn @end ifnotinfo @subsubheading Essential parameters @ifinfo @anchor{funct:unur_distr_cont_set_pdf} @anchor{funct:unur_distr_cont_set_dpdf} @anchor{funct:unur_distr_cont_set_cdf} @anchor{funct:unur_distr_cont_set_invcdf} @deftypefn Function {int} unur_distr_cont_set_pdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_CONT* @var{pdf}) @deftypefnx Function {int} unur_distr_cont_set_dpdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_CONT* @var{dpdf}) @deftypefnx Function {int} unur_distr_cont_set_cdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_CONT* @var{cdf}) @deftypefnx Function {int} unur_distr_cont_set_invcdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_CONT* @var{invcdf}) Set respective pointer to the probability density function (PDF), the derivative of the probability density function (dPDF), the cumulative distribution function (CDF), and the inverse CDF of the @var{distribution}. Each of these function pointers must be of type @code{double funct(double x, const UNUR_DISTR *distr)}. Due to the fact that some of the methods do not require a normalized PDF the following is important: @itemize @minus @item The given CDF must be the cumulative distribution function of the (non-truncated) distribution. If a distribution from the UNU.RAN library of standard distributions (@pxref{Stddist,,Standard distributions}) is truncated, there is no need to change the CDF. @item If both the CDF and the PDF are used (for a method or for order statistics), the PDF must be the derivative of the CDF. If a truncated distribution for one of the standard distributions from the UNU.RAN library of standard distributions is used, there is no need to change the PDF. @item If the area below the PDF is required for a given distribution it must be given by the @ifhtml @ref{funct:unur_distr_cont_set_pdfarea,@command{unur_distr_cont_set_pdfarea}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_pdfarea} @end ifnothtml call. For a truncated distribution this must be of course the integral of the PDF in the given truncated domain. For distributions from the UNU.RAN library of standard distributions this is done automatically by the @ifhtml @ref{funct:unur_distr_cont_upd_pdfarea,@command{unur_distr_cont_upd_pdfarea}} @end ifhtml @ifnothtml @command{unur_distr_cont_upd_pdfarea} @end ifnothtml call. @end itemize It is important to note that all these functions must return a result for all values of @var{x}. Eg., if the domain of a given PDF is the interval [-1,1], then the given function must return @code{0.0} for all points outside this interval. In case of an overflow the PDF should return @code{UNUR_INFINITY}. It is not possible to change such a function. Once the PDF or CDF is set it cannot be overwritten. This also holds when the logPDF is given or when the PDF is given by the @ifhtml @ref{funct:unur_distr_cont_set_pdfstr,@command{unur_distr_cont_set_pdfstr}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_pdfstr} @end ifnothtml or @ifhtml @ref{funct:unur_distr_cont_set_logpdfstr,@command{unur_distr_cont_set_logpdfstr}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_logpdfstr} @end ifnothtml call. A new distribution object has to be used instead. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cont_set_pdf} @anchor{funct:unur_distr_cont_set_dpdf} @anchor{funct:unur_distr_cont_set_cdf} @anchor{funct:unur_distr_cont_set_invcdf} @deftypefn {} {int} unur_distr_cont_set_pdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_CONT* @var{pdf}) @deftypefnx {} {int} unur_distr_cont_set_dpdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_CONT* @var{dpdf}) @deftypefnx {} {int} unur_distr_cont_set_cdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_CONT* @var{cdf}) @deftypefnx {} {int} unur_distr_cont_set_invcdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_CONT* @var{invcdf}) Set respective pointer to the probability density function (PDF), the derivative of the probability density function (dPDF), the cumulative distribution function (CDF), and the inverse CDF of the @var{distribution}. Each of these function pointers must be of type @code{double funct(double x, const UNUR_DISTR *distr)}. Due to the fact that some of the methods do not require a normalized PDF the following is important: @itemize @minus @item The given CDF must be the cumulative distribution function of the (non-truncated) distribution. If a distribution from the UNU.RAN library of standard distributions (@pxref{Stddist,,Standard distributions}) is truncated, there is no need to change the CDF. @item If both the CDF and the PDF are used (for a method or for order statistics), the PDF must be the derivative of the CDF. If a truncated distribution for one of the standard distributions from the UNU.RAN library of standard distributions is used, there is no need to change the PDF. @item If the area below the PDF is required for a given distribution it must be given by the @ifhtml @ref{funct:unur_distr_cont_set_pdfarea,@command{unur_distr_cont_set_pdfarea}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_pdfarea} @end ifnothtml call. For a truncated distribution this must be of course the integral of the PDF in the given truncated domain. For distributions from the UNU.RAN library of standard distributions this is done automatically by the @ifhtml @ref{funct:unur_distr_cont_upd_pdfarea,@command{unur_distr_cont_upd_pdfarea}} @end ifhtml @ifnothtml @command{unur_distr_cont_upd_pdfarea} @end ifnothtml call. @end itemize It is important to note that all these functions must return a result for all values of @var{x}. Eg., if the domain of a given PDF is the interval [-1,1], then the given function must return @code{0.0} for all points outside this interval. In case of an overflow the PDF should return @code{UNUR_INFINITY}. It is not possible to change such a function. Once the PDF or CDF is set it cannot be overwritten. This also holds when the logPDF is given or when the PDF is given by the @ifhtml @ref{funct:unur_distr_cont_set_pdfstr,@command{unur_distr_cont_set_pdfstr}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_pdfstr} @end ifnothtml or @ifhtml @ref{funct:unur_distr_cont_set_logpdfstr,@command{unur_distr_cont_set_logpdfstr}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_logpdfstr} @end ifnothtml call. A new distribution object has to be used instead. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cont_get_pdf} @anchor{funct:unur_distr_cont_get_dpdf} @anchor{funct:unur_distr_cont_get_cdf} @anchor{funct:unur_distr_cont_get_invcdf} @deftypefn Function {UNUR_FUNCT_CONT*} unur_distr_cont_get_pdf (const @var{UNUR_DISTR* distribution}) @deftypefnx Function {UNUR_FUNCT_CONT*} unur_distr_cont_get_dpdf (const @var{UNUR_DISTR* distribution}) @deftypefnx Function {UNUR_FUNCT_CONT*} unur_distr_cont_get_cdf (const @var{UNUR_DISTR* distribution}) @deftypefnx Function {UNUR_FUNCT_CONT*} unur_distr_cont_get_invcdf (const @var{UNUR_DISTR* distribution}) Get the respective pointer to the PDF, the derivative of the PDF, the CDF, and the inverse CDF of the @var{distribution}. The pointer is of type @code{double funct(double x, const UNUR_DISTR *distr)}. If the corresponding function is not available for the distribution, the @code{NULL} pointer is returned. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cont_get_pdf} @anchor{funct:unur_distr_cont_get_dpdf} @anchor{funct:unur_distr_cont_get_cdf} @anchor{funct:unur_distr_cont_get_invcdf} @deftypefn {} {UNUR_FUNCT_CONT*} unur_distr_cont_get_pdf (const @var{UNUR_DISTR* distribution}) @deftypefnx {} {UNUR_FUNCT_CONT*} unur_distr_cont_get_dpdf (const @var{UNUR_DISTR* distribution}) @deftypefnx {} {UNUR_FUNCT_CONT*} unur_distr_cont_get_cdf (const @var{UNUR_DISTR* distribution}) @deftypefnx {} {UNUR_FUNCT_CONT*} unur_distr_cont_get_invcdf (const @var{UNUR_DISTR* distribution}) Get the respective pointer to the PDF, the derivative of the PDF, the CDF, and the inverse CDF of the @var{distribution}. The pointer is of type @code{double funct(double x, const UNUR_DISTR *distr)}. If the corresponding function is not available for the distribution, the @code{NULL} pointer is returned. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cont_eval_pdf} @anchor{funct:unur_distr_cont_eval_dpdf} @anchor{funct:unur_distr_cont_eval_cdf} @anchor{funct:unur_distr_cont_eval_invcdf} @deftypefn Function {double} unur_distr_cont_eval_pdf (double @var{x}, const @var{UNUR_DISTR* distribution}) @deftypefnx Function {double} unur_distr_cont_eval_dpdf (double @var{x}, const @var{UNUR_DISTR* distribution}) @deftypefnx Function {double} unur_distr_cont_eval_cdf (double @var{x}, const @var{UNUR_DISTR* distribution}) @deftypefnx Function {double} unur_distr_cont_eval_invcdf (double @var{u}, const @var{UNUR_DISTR* distribution}) Evaluate the PDF, derivative of the PDF, the CDF, and the inverse CDF at @var{x} and @var{u},respectively. Notice that @var{distribution} must not be the @code{NULL} pointer. If the corresponding function is not available for the distribution, @code{UNUR_INFINITY} is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. @emph{IMPORTANT:} In the case of a truncated standard distribution these calls always return the respective values of the @emph{untruncated} distribution! @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cont_eval_pdf} @anchor{funct:unur_distr_cont_eval_dpdf} @anchor{funct:unur_distr_cont_eval_cdf} @anchor{funct:unur_distr_cont_eval_invcdf} @deftypefn {} {double} unur_distr_cont_eval_pdf (double @var{x}, const @var{UNUR_DISTR* distribution}) @deftypefnx {} {double} unur_distr_cont_eval_dpdf (double @var{x}, const @var{UNUR_DISTR* distribution}) @deftypefnx {} {double} unur_distr_cont_eval_cdf (double @var{x}, const @var{UNUR_DISTR* distribution}) @deftypefnx {} {double} unur_distr_cont_eval_invcdf (double @var{u}, const @var{UNUR_DISTR* distribution}) Evaluate the PDF, derivative of the PDF, the CDF, and the inverse CDF at @var{x} and @var{u},respectively. Notice that @var{distribution} must not be the @code{NULL} pointer. If the corresponding function is not available for the distribution, @code{UNUR_INFINITY} is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. @emph{IMPORTANT:} In the case of a truncated standard distribution these calls always return the respective values of the @emph{untruncated} distribution! @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cont_set_logpdf} @anchor{funct:unur_distr_cont_set_dlogpdf} @anchor{funct:unur_distr_cont_set_logcdf} @anchor{funct:unur_distr_cont_get_logpdf} @anchor{funct:unur_distr_cont_get_dlogpdf} @anchor{funct:unur_distr_cont_get_logcdf} @anchor{funct:unur_distr_cont_eval_logpdf} @anchor{funct:unur_distr_cont_eval_dlogpdf} @anchor{funct:unur_distr_cont_eval_logcdf} @deftypefn Function {int} unur_distr_cont_set_logpdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_CONT* @var{logpdf}) @deftypefnx Function {int} unur_distr_cont_set_dlogpdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_CONT* @var{dlogpdf}) @deftypefnx Function {int} unur_distr_cont_set_logcdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_CONT* @var{logcdf}) @deftypefnx Function {UNUR_FUNCT_CONT*} unur_distr_cont_get_logpdf (const @var{UNUR_DISTR* distribution}) @deftypefnx Function {UNUR_FUNCT_CONT*} unur_distr_cont_get_dlogpdf (const @var{UNUR_DISTR* distribution}) @deftypefnx Function {UNUR_FUNCT_CONT*} unur_distr_cont_get_logcdf (const @var{UNUR_DISTR* distribution}) @deftypefnx Function {double} unur_distr_cont_eval_logpdf (double @var{x}, const @var{UNUR_DISTR* distribution}) @deftypefnx Function {double} unur_distr_cont_eval_dlogpdf (double @var{x}, const @var{UNUR_DISTR* distribution}) @deftypefnx Function {double} unur_distr_cont_eval_logcdf (double @var{x}, const @var{UNUR_DISTR* distribution}) Analogous calls for the logarithm of the density distribution functions. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cont_set_logpdf} @anchor{funct:unur_distr_cont_set_dlogpdf} @anchor{funct:unur_distr_cont_set_logcdf} @anchor{funct:unur_distr_cont_get_logpdf} @anchor{funct:unur_distr_cont_get_dlogpdf} @anchor{funct:unur_distr_cont_get_logcdf} @anchor{funct:unur_distr_cont_eval_logpdf} @anchor{funct:unur_distr_cont_eval_dlogpdf} @anchor{funct:unur_distr_cont_eval_logcdf} @deftypefn {} {int} unur_distr_cont_set_logpdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_CONT* @var{logpdf}) @deftypefnx {} {int} unur_distr_cont_set_dlogpdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_CONT* @var{dlogpdf}) @deftypefnx {} {int} unur_distr_cont_set_logcdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_CONT* @var{logcdf}) @deftypefnx {} {UNUR_FUNCT_CONT*} unur_distr_cont_get_logpdf (const @var{UNUR_DISTR* distribution}) @deftypefnx {} {UNUR_FUNCT_CONT*} unur_distr_cont_get_dlogpdf (const @var{UNUR_DISTR* distribution}) @deftypefnx {} {UNUR_FUNCT_CONT*} unur_distr_cont_get_logcdf (const @var{UNUR_DISTR* distribution}) @deftypefnx {} {double} unur_distr_cont_eval_logpdf (double @var{x}, const @var{UNUR_DISTR* distribution}) @deftypefnx {} {double} unur_distr_cont_eval_dlogpdf (double @var{x}, const @var{UNUR_DISTR* distribution}) @deftypefnx {} {double} unur_distr_cont_eval_logcdf (double @var{x}, const @var{UNUR_DISTR* distribution}) Analogous calls for the logarithm of the density distribution functions. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cont_set_pdfstr} @deftypefn Function {int} unur_distr_cont_set_pdfstr (UNUR_DISTR* @var{distribution}, const @var{char* pdfstr}) This function provides an alternative way to set a PDF and its derivative of the @var{distribution}. @var{pdfstr} is a character string that contains the formula for the PDF, see @ref{StringFunct,,Function String}, for details. The derivative of the given PDF is computed automatically. See also the remarks for the @ifhtml @ref{funct:unur_distr_cont_set_pdf,@command{unur_distr_cont_set_pdf}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_pdf} @end ifnothtml call. It is not possible to call this funtion twice or to call this function after a @ifhtml @ref{funct:unur_distr_cont_set_pdf,@command{unur_distr_cont_set_pdf}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_pdf} @end ifnothtml call. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cont_set_pdfstr} @deftypefn {} {int} unur_distr_cont_set_pdfstr (UNUR_DISTR* @var{distribution}, const @var{char* pdfstr}) This function provides an alternative way to set a PDF and its derivative of the @var{distribution}. @var{pdfstr} is a character string that contains the formula for the PDF, see @ref{StringFunct,,Function String}, for details. The derivative of the given PDF is computed automatically. See also the remarks for the @ifhtml @ref{funct:unur_distr_cont_set_pdf,@command{unur_distr_cont_set_pdf}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_pdf} @end ifnothtml call. It is not possible to call this funtion twice or to call this function after a @ifhtml @ref{funct:unur_distr_cont_set_pdf,@command{unur_distr_cont_set_pdf}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_pdf} @end ifnothtml call. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cont_set_cdfstr} @deftypefn Function {int} unur_distr_cont_set_cdfstr (UNUR_DISTR* @var{distribution}, const @var{char* cdfstr}) This function provides an alternative way to set a CDF; analogously to the @ifhtml @ref{funct:unur_distr_cont_set_pdfstr,@command{unur_distr_cont_set_pdfstr}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_pdfstr} @end ifnothtml call. The PDF and its derivative of the given CDF are computed automatically. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cont_set_cdfstr} @deftypefn {} {int} unur_distr_cont_set_cdfstr (UNUR_DISTR* @var{distribution}, const @var{char* cdfstr}) This function provides an alternative way to set a CDF; analogously to the @ifhtml @ref{funct:unur_distr_cont_set_pdfstr,@command{unur_distr_cont_set_pdfstr}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_pdfstr} @end ifnothtml call. The PDF and its derivative of the given CDF are computed automatically. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cont_get_pdfstr} @anchor{funct:unur_distr_cont_get_dpdfstr} @anchor{funct:unur_distr_cont_get_cdfstr} @deftypefn Function {char*} unur_distr_cont_get_pdfstr (const @var{UNUR_DISTR* distribution}) @deftypefnx Function {char*} unur_distr_cont_get_dpdfstr (const @var{UNUR_DISTR* distribution}) @deftypefnx Function {char*} unur_distr_cont_get_cdfstr (const @var{UNUR_DISTR* distribution}) Get pointer to respective string for PDF, derivate of PDF, and CDF of @var{distribution} that is given as string (instead of a function pointer). This call allocates memory to produce this string. It should be freed when it is not used any more. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cont_get_pdfstr} @anchor{funct:unur_distr_cont_get_dpdfstr} @anchor{funct:unur_distr_cont_get_cdfstr} @deftypefn {} {char*} unur_distr_cont_get_pdfstr (const @var{UNUR_DISTR* distribution}) @deftypefnx {} {char*} unur_distr_cont_get_dpdfstr (const @var{UNUR_DISTR* distribution}) @deftypefnx {} {char*} unur_distr_cont_get_cdfstr (const @var{UNUR_DISTR* distribution}) Get pointer to respective string for PDF, derivate of PDF, and CDF of @var{distribution} that is given as string (instead of a function pointer). This call allocates memory to produce this string. It should be freed when it is not used any more. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cont_set_pdfparams} @deftypefn Function {int} unur_distr_cont_set_pdfparams (UNUR_DISTR* @var{distribution}, const @var{double* params}, int @var{n_params}) Sets array of parameters for @var{distribution}. There is an upper limit for the number of parameters @code{n_params}. It is given by the macro @code{UNUR_DISTR_MAXPARAMS} in @file{unuran_config.h}. (It is set to 5 by default but can be changed to any appropriate nonnegative number.) If @var{n_params} is negative or exceeds this limit no parameters are copied into the distribution object and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_NPARAMS}. For standard distributions from the UNU.RAN library the parameters are checked. Moreover, the domain is updated automatically unless it has been changed before by a @ifhtml @ref{funct:unur_distr_cont_set_domain,@command{unur_distr_cont_set_domain}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_domain} @end ifnothtml call. If the given parameters are invalid for the standard distribution, then no parameters are set and an error code is returned. Notice, that the given parameter list for such a distribution is handled in the same way as in the corresponding @command{new} calls, i.e. optional parameters for the PDF that are not present in the given list are (re-)set to their default values. @strong{Important:} If the parameters of a distribution from the UNU.RAN library of standard distributions (@pxref{Stddist,,Standard distributions}) are changed, then neither its mode nor the normalization constant are updated. Please use the respective calls @ifhtml @ref{funct:unur_distr_cont_upd_mode,@command{unur_distr_cont_upd_mode}} @end ifhtml @ifnothtml @command{unur_distr_cont_upd_mode} @end ifnothtml and @ifhtml @ref{funct:unur_distr_cont_upd_pdfarea,@command{unur_distr_cont_upd_pdfarea}.} @end ifhtml @ifnothtml @command{unur_distr_cont_upd_pdfarea}. @end ifnothtml Moreover, if the domain has been changed by a @ifhtml @ref{funct:unur_distr_cont_set_domain,@command{unur_distr_cont_set_domain}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_domain} @end ifnothtml it is not automatically updated, either. Updating the normalization constant is in particular very important, when the CDF of the distribution is used. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cont_set_pdfparams} @deftypefn {} {int} unur_distr_cont_set_pdfparams (UNUR_DISTR* @var{distribution}, const @var{double* params}, int @var{n_params}) Sets array of parameters for @var{distribution}. There is an upper limit for the number of parameters @code{n_params}. It is given by the macro @code{UNUR_DISTR_MAXPARAMS} in @file{unuran_config.h}. (It is set to 5 by default but can be changed to any appropriate nonnegative number.) If @var{n_params} is negative or exceeds this limit no parameters are copied into the distribution object and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_NPARAMS}. For standard distributions from the UNU.RAN library the parameters are checked. Moreover, the domain is updated automatically unless it has been changed before by a @ifhtml @ref{funct:unur_distr_cont_set_domain,@command{unur_distr_cont_set_domain}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_domain} @end ifnothtml call. If the given parameters are invalid for the standard distribution, then no parameters are set and an error code is returned. Notice, that the given parameter list for such a distribution is handled in the same way as in the corresponding @command{new} calls, i.e. optional parameters for the PDF that are not present in the given list are (re-)set to their default values. @strong{Important:} If the parameters of a distribution from the UNU.RAN library of standard distributions (@pxref{Stddist,,Standard distributions}) are changed, then neither its mode nor the normalization constant are updated. Please use the respective calls @ifhtml @ref{funct:unur_distr_cont_upd_mode,@command{unur_distr_cont_upd_mode}} @end ifhtml @ifnothtml @command{unur_distr_cont_upd_mode} @end ifnothtml and @ifhtml @ref{funct:unur_distr_cont_upd_pdfarea,@command{unur_distr_cont_upd_pdfarea}.} @end ifhtml @ifnothtml @command{unur_distr_cont_upd_pdfarea}. @end ifnothtml Moreover, if the domain has been changed by a @ifhtml @ref{funct:unur_distr_cont_set_domain,@command{unur_distr_cont_set_domain}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_domain} @end ifnothtml it is not automatically updated, either. Updating the normalization constant is in particular very important, when the CDF of the distribution is used. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cont_get_pdfparams} @deftypefn Function {int} unur_distr_cont_get_pdfparams (const @var{UNUR_DISTR* distribution}, const @var{double** params}) Get number of parameters of the PDF and set pointer @var{params} to array of parameters. If no parameters are stored in the object, an error code is returned and @code{params} is set to @code{NULL}. @emph{Important:} Do @strong{not} change the entries in @var{params}! @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cont_get_pdfparams} @deftypefn {} {int} unur_distr_cont_get_pdfparams (const @var{UNUR_DISTR* distribution}, const @var{double** params}) Get number of parameters of the PDF and set pointer @var{params} to array of parameters. If no parameters are stored in the object, an error code is returned and @code{params} is set to @code{NULL}. @emph{Important:} Do @strong{not} change the entries in @var{params}! @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cont_set_pdfparams_vec} @deftypefn Function {int} unur_distr_cont_set_pdfparams_vec (UNUR_DISTR* @var{distribution}, int @var{par}, const @var{double* param_vec}, int @var{n_param_vec}) This function provides an interface for additional vector parameters for a continuous @var{distribution}. It sets the parameter with number @var{par}. @var{par} indicates directly which of the parameters is set and must be a number between @code{0} and @code{UNUR_DISTR_MAXPARAMS}-1 (the upper limit of possible parameters defined in @file{unuran_config.h}; it is set to 5 but can be changed to any appropriate nonnegative number.) The entries of a this parameter are given by the array @var{param_vec} of size @var{n_param_vec}. If @var{param_vec} is @code{NULL} then the corresponding entry is cleared. If an error occurs no parameters are copied into the parameter object @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cont_set_pdfparams_vec} @deftypefn {} {int} unur_distr_cont_set_pdfparams_vec (UNUR_DISTR* @var{distribution}, int @var{par}, const @var{double* param_vec}, int @var{n_param_vec}) This function provides an interface for additional vector parameters for a continuous @var{distribution}. It sets the parameter with number @var{par}. @var{par} indicates directly which of the parameters is set and must be a number between @code{0} and @code{UNUR_DISTR_MAXPARAMS}-1 (the upper limit of possible parameters defined in @file{unuran_config.h}; it is set to 5 but can be changed to any appropriate nonnegative number.) The entries of a this parameter are given by the array @var{param_vec} of size @var{n_param_vec}. If @var{param_vec} is @code{NULL} then the corresponding entry is cleared. If an error occurs no parameters are copied into the parameter object @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cont_get_pdfparams_vec} @deftypefn Function {int} unur_distr_cont_get_pdfparams_vec (const @var{UNUR_DISTR* distribution}, int @var{par}, const @var{double** param_vecs}) Get parameter of the PDF with number @var{par}. The pointer to the parameter array is stored in @var{param_vecs}, its size is returned by the function. If the requested parameter is not set, then an error code is returned and @code{params} is set to @code{NULL}. @emph{Important:} Do @strong{not} change the entries in @var{param_vecs}! @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cont_get_pdfparams_vec} @deftypefn {} {int} unur_distr_cont_get_pdfparams_vec (const @var{UNUR_DISTR* distribution}, int @var{par}, const @var{double** param_vecs}) Get parameter of the PDF with number @var{par}. The pointer to the parameter array is stored in @var{param_vecs}, its size is returned by the function. If the requested parameter is not set, then an error code is returned and @code{params} is set to @code{NULL}. @emph{Important:} Do @strong{not} change the entries in @var{param_vecs}! @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cont_set_logpdfstr} @anchor{funct:unur_distr_cont_get_logpdfstr} @anchor{funct:unur_distr_cont_get_dlogpdfstr} @anchor{funct:unur_distr_cont_set_logcdfstr} @anchor{funct:unur_distr_cont_get_logcdfstr} @deftypefn Function {int} unur_distr_cont_set_logpdfstr (UNUR_DISTR* @var{distribution}, const @var{char* logpdfstr}) @deftypefnx Function {char*} unur_distr_cont_get_logpdfstr (const @var{UNUR_DISTR* distribution}) @deftypefnx Function {char*} unur_distr_cont_get_dlogpdfstr (const @var{UNUR_DISTR* distribution}) @deftypefnx Function {int} unur_distr_cont_set_logcdfstr (UNUR_DISTR* @var{distribution}, const @var{char* logcdfstr}) @deftypefnx Function {char*} unur_distr_cont_get_logcdfstr (const @var{UNUR_DISTR* distribution}) Analogous calls for the logarithm of the density and distribution functions. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cont_set_logpdfstr} @anchor{funct:unur_distr_cont_get_logpdfstr} @anchor{funct:unur_distr_cont_get_dlogpdfstr} @anchor{funct:unur_distr_cont_set_logcdfstr} @anchor{funct:unur_distr_cont_get_logcdfstr} @deftypefn {} {int} unur_distr_cont_set_logpdfstr (UNUR_DISTR* @var{distribution}, const @var{char* logpdfstr}) @deftypefnx {} {char*} unur_distr_cont_get_logpdfstr (const @var{UNUR_DISTR* distribution}) @deftypefnx {} {char*} unur_distr_cont_get_dlogpdfstr (const @var{UNUR_DISTR* distribution}) @deftypefnx {} {int} unur_distr_cont_set_logcdfstr (UNUR_DISTR* @var{distribution}, const @var{char* logcdfstr}) @deftypefnx {} {char*} unur_distr_cont_get_logcdfstr (const @var{UNUR_DISTR* distribution}) Analogous calls for the logarithm of the density and distribution functions. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cont_set_domain} @deftypefn Function {int} unur_distr_cont_set_domain (UNUR_DISTR* @var{distribution}, double @var{left}, double @var{right}) Set the left and right borders of the domain of the distribution. This can also be used to truncate an existing distribution. For setting the boundary to @math{+/- infinity} use @code{+/- UNUR_INFINITY}. If @var{right} is not strictly greater than @var{left} no domain is set and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_SET}. @emph{Important:} For some technical reasons it is assumed that the density is unimodal and thus monotone on either side of the mode! This is used in the case when the given mode is outside of the original domain. Then the mode is set to the corresponding boundary of the new domain. If this result is not the desired it must be changed by using a @ifhtml @ref{funct:unur_distr_cont_set_mode,@command{unur_distr_cont_set_mode}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_mode} @end ifnothtml call (or a @ifhtml @ref{funct:unur_distr_cont_upd_mode,@command{unur_distr_cont_upd_mode}} @end ifhtml @ifnothtml @command{unur_distr_cont_upd_mode} @end ifnothtml call). The same holds for the center of the distribution. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cont_set_domain} @deftypefn {} {int} unur_distr_cont_set_domain (UNUR_DISTR* @var{distribution}, double @var{left}, double @var{right}) Set the left and right borders of the domain of the distribution. This can also be used to truncate an existing distribution. For setting the boundary to @iftex @math{\pm\infty} @end iftex @ifhtml @html +/- infinity @end html @end ifhtml use @code{+/- UNUR_INFINITY}. If @var{right} is not strictly greater than @var{left} no domain is set and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_SET}. @emph{Important:} For some technical reasons it is assumed that the density is unimodal and thus monotone on either side of the mode! This is used in the case when the given mode is outside of the original domain. Then the mode is set to the corresponding boundary of the new domain. If this result is not the desired it must be changed by using a @ifhtml @ref{funct:unur_distr_cont_set_mode,@command{unur_distr_cont_set_mode}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_mode} @end ifnothtml call (or a @ifhtml @ref{funct:unur_distr_cont_upd_mode,@command{unur_distr_cont_upd_mode}} @end ifhtml @ifnothtml @command{unur_distr_cont_upd_mode} @end ifnothtml call). The same holds for the center of the distribution. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cont_get_domain} @deftypefn Function {int} unur_distr_cont_get_domain (const @var{UNUR_DISTR* distribution}, double* @var{left}, double* @var{right}) Get the left and right borders of the domain of the distribution. If the domain is not set @code{+/- UNUR_INFINITY} is assumed and returned. No error is reported in this case. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cont_get_domain} @deftypefn {} {int} unur_distr_cont_get_domain (const @var{UNUR_DISTR* distribution}, double* @var{left}, double* @var{right}) Get the left and right borders of the domain of the distribution. If the domain is not set @code{+/- UNUR_INFINITY} is assumed and returned. No error is reported in this case. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cont_get_truncated} @deftypefn Function {int} unur_distr_cont_get_truncated (const @var{UNUR_DISTR* distribution}, double* @var{left}, double* @var{right}) Get the left and right borders of the (truncated) domain of the distribution. For non-truncated distribution this call is equivalent to the @ifhtml @ref{funct:unur_distr_cont_get_domain,@command{unur_distr_cont_get_domain}} @end ifhtml @ifnothtml @command{unur_distr_cont_get_domain} @end ifnothtml call. This call is only useful in connection with a @ifhtml @ref{funct:unur_get_distr,@command{unur_get_distr}} @end ifhtml @ifnothtml @command{unur_get_distr} @end ifnothtml call to get the boundaries of the sampling region of a generator object. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cont_get_truncated} @deftypefn {} {int} unur_distr_cont_get_truncated (const @var{UNUR_DISTR* distribution}, double* @var{left}, double* @var{right}) Get the left and right borders of the (truncated) domain of the distribution. For non-truncated distribution this call is equivalent to the @ifhtml @ref{funct:unur_distr_cont_get_domain,@command{unur_distr_cont_get_domain}} @end ifhtml @ifnothtml @command{unur_distr_cont_get_domain} @end ifnothtml call. This call is only useful in connection with a @ifhtml @ref{funct:unur_get_distr,@command{unur_get_distr}} @end ifhtml @ifnothtml @command{unur_get_distr} @end ifnothtml call to get the boundaries of the sampling region of a generator object. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cont_set_hr} @deftypefn Function {int} unur_distr_cont_set_hr (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_CONT* @var{hazard}) Set pointer to the hazard rate (HR) of the @var{distribution}. The @emph{hazard rate} (or failure rate) is a mathematical way of describing aging. If the lifetime @i{X} is a random variable with density @i{f(x)} and CDF @i{F(x)} the hazard rate @i{h(x)} is defined as @i{h(x) = f(x) / (1-F(x))}. In other words, @i{h(x)} represents the (conditional) rate of failure of a unit that has survived up to time @i{x} with probability @i{1-F(x)}. The key distribution is the exponential distribution as it has constant hazard rate of value 1. Hazard rates tending to infinity describe distributions with sub-exponential tails whereas distributions with hazard rates tending to zero have heavier tails than the exponential distribution. It is important to note that all these functions must return a result for all floats @i{x}. In case of an overflow the PDF should return @code{UNUR_INFINITY}. @strong{Important}: Do not simply use @i{f(x) / (1-F(x))}, since this is numerically very unstable and results in numerical noise if @i{F(x)} is (very) close to 1. Moreover, if the density @i{f(x)} is known a generation method that uses the density is more appropriate. It is not possible to change such a function. Once the HR is set it cannot be overwritten. This also holds when the HR is given by the @ifhtml @ref{funct:unur_distr_cont_set_hrstr,@command{unur_distr_cont_set_hrstr}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_hrstr} @end ifnothtml call. A new distribution object has to be used instead. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cont_set_hr} @deftypefn {} {int} unur_distr_cont_set_hr (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_CONT* @var{hazard}) Set pointer to the hazard rate (HR) of the @var{distribution}. The @emph{hazard rate} (or failure rate) is a mathematical way of describing aging. If the lifetime @i{X} is a random variable with density @i{f(x)} and CDF @i{F(x)} the hazard rate @i{h(x)} is defined as @i{h(x) = f(x) / (1-F(x))}. In other words, @i{h(x)} represents the (conditional) rate of failure of a unit that has survived up to time @i{x} with probability @i{1-F(x)}. The key distribution is the exponential distribution as it has constant hazard rate of value 1. Hazard rates tending to infinity describe distributions with sub-exponential tails whereas distributions with hazard rates tending to zero have heavier tails than the exponential distribution. It is important to note that all these functions must return a result for all floats @i{x}. In case of an overflow the PDF should return @code{UNUR_INFINITY}. @strong{Important}: Do not simply use @i{f(x) / (1-F(x))}, since this is numerically very unstable and results in numerical noise if @i{F(x)} is (very) close to 1. Moreover, if the density @i{f(x)} is known a generation method that uses the density is more appropriate. It is not possible to change such a function. Once the HR is set it cannot be overwritten. This also holds when the HR is given by the @ifhtml @ref{funct:unur_distr_cont_set_hrstr,@command{unur_distr_cont_set_hrstr}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_hrstr} @end ifnothtml call. A new distribution object has to be used instead. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cont_get_hr} @deftypefn Function {UNUR_FUNCT_CONT*} unur_distr_cont_get_hr (const @var{UNUR_DISTR* distribution}) Get the pointer to the hazard rate of the @var{distribution}. The pointer is of type @code{double funct(double x, const UNUR_DISTR *distr)}. If the corresponding function is not available for the distribution, the @code{NULL} pointer is returned. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cont_get_hr} @deftypefn {} {UNUR_FUNCT_CONT*} unur_distr_cont_get_hr (const @var{UNUR_DISTR* distribution}) Get the pointer to the hazard rate of the @var{distribution}. The pointer is of type @code{double funct(double x, const UNUR_DISTR *distr)}. If the corresponding function is not available for the distribution, the @code{NULL} pointer is returned. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cont_eval_hr} @deftypefn Function {double} unur_distr_cont_eval_hr (double @var{x}, const @var{UNUR_DISTR* distribution}) Evaluate the hazard rate at @var{x}. Notice that @var{distribution} must not be the @code{NULL} pointer. If the corresponding function is not available for the distribution, @code{UNUR_INFINITY} is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cont_eval_hr} @deftypefn {} {double} unur_distr_cont_eval_hr (double @var{x}, const @var{UNUR_DISTR* distribution}) Evaluate the hazard rate at @var{x}. Notice that @var{distribution} must not be the @code{NULL} pointer. If the corresponding function is not available for the distribution, @code{UNUR_INFINITY} is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cont_set_hrstr} @deftypefn Function {int} unur_distr_cont_set_hrstr (UNUR_DISTR* @var{distribution}, const @var{char* hrstr}) This function provides an alternative way to set a hazard rate and its derivative of the @var{distribution}. @var{hrstr} is a character string that contains the formula for the HR, see @ref{StringFunct,,Function String}, for details. See also the remarks for the @ifhtml @ref{funct:unur_distr_cont_set_hr,@command{unur_distr_cont_set_hr}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_hr} @end ifnothtml call. It is not possible to call this funtion twice or to call this function after a @ifhtml @ref{funct:unur_distr_cont_set_hr,@command{unur_distr_cont_set_hr}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_hr} @end ifnothtml call. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cont_set_hrstr} @deftypefn {} {int} unur_distr_cont_set_hrstr (UNUR_DISTR* @var{distribution}, const @var{char* hrstr}) This function provides an alternative way to set a hazard rate and its derivative of the @var{distribution}. @var{hrstr} is a character string that contains the formula for the HR, see @ref{StringFunct,,Function String}, for details. See also the remarks for the @ifhtml @ref{funct:unur_distr_cont_set_hr,@command{unur_distr_cont_set_hr}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_hr} @end ifnothtml call. It is not possible to call this funtion twice or to call this function after a @ifhtml @ref{funct:unur_distr_cont_set_hr,@command{unur_distr_cont_set_hr}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_hr} @end ifnothtml call. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cont_get_hrstr} @deftypefn Function {char*} unur_distr_cont_get_hrstr (const @var{UNUR_DISTR* distribution}) Get pointer to string for HR of @var{distribution} that is given via the string interface. This call allocates memory to produce this string. It should be freed when it is not used any more. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cont_get_hrstr} @deftypefn {} {char*} unur_distr_cont_get_hrstr (const @var{UNUR_DISTR* distribution}) Get pointer to string for HR of @var{distribution} that is given via the string interface. This call allocates memory to produce this string. It should be freed when it is not used any more. @end deftypefn @end ifnotinfo @subsubheading Derived parameters The following paramters @strong{must} be set whenever one of the essential parameters has been set or changed (and the parameter is required for the chosen method). @ifinfo @anchor{funct:unur_distr_cont_set_mode} @deftypefn Function {int} unur_distr_cont_set_mode (UNUR_DISTR* @var{distribution}, double @var{mode}) Set mode of @var{distribution}. The @var{mode} must be contained in the domain of @var{distribution}. Otherwise the mode is not set and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_SET}. For distributions with unbounded density, this call is used to set the pole of the PDF. Notice that the PDF should then return @code{UNUR_INFINITY} at the pole. Notice that the mode is adjusted when the domain is set, see the remark for the @ifhtml @ref{funct:unur_distr_cont_set_domain,@command{unur_distr_cont_set_domain}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_domain} @end ifnothtml call. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cont_set_mode} @deftypefn {} {int} unur_distr_cont_set_mode (UNUR_DISTR* @var{distribution}, double @var{mode}) Set mode of @var{distribution}. The @var{mode} must be contained in the domain of @var{distribution}. Otherwise the mode is not set and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_SET}. For distributions with unbounded density, this call is used to set the pole of the PDF. Notice that the PDF should then return @code{UNUR_INFINITY} at the pole. Notice that the mode is adjusted when the domain is set, see the remark for the @ifhtml @ref{funct:unur_distr_cont_set_domain,@command{unur_distr_cont_set_domain}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_domain} @end ifnothtml call. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cont_upd_mode} @deftypefn Function {int} unur_distr_cont_upd_mode (UNUR_DISTR* @var{distribution}) Recompute the mode of the @var{distribution}. This call works properly for distribution objects from the UNU.RAN library of standard distributions when the corresponding function is available. Otherwise a (slow) numerical mode finder based on Brent's algorithm is used. If it failes @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cont_upd_mode} @deftypefn {} {int} unur_distr_cont_upd_mode (UNUR_DISTR* @var{distribution}) Recompute the mode of the @var{distribution}. This call works properly for distribution objects from the UNU.RAN library of standard distributions when the corresponding function is available. Otherwise a (slow) numerical mode finder based on Brent's algorithm is used. If it failes @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cont_get_mode} @deftypefn Function {double} unur_distr_cont_get_mode (UNUR_DISTR* @var{distribution}) Get mode of @var{distribution}. If the mode is not marked as known, @ifhtml @ref{funct:unur_distr_cont_upd_mode,@command{unur_distr_cont_upd_mode}} @end ifhtml @ifnothtml @command{unur_distr_cont_upd_mode} @end ifnothtml is called to compute the mode. If this is not successful @code{UNUR_INFINITY} is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_GET}. (There is no difference between the case where no routine for computing the mode is available and the case where no mode exists for the distribution at all.) @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cont_get_mode} @deftypefn {} {double} unur_distr_cont_get_mode (UNUR_DISTR* @var{distribution}) Get mode of @var{distribution}. If the mode is not marked as known, @ifhtml @ref{funct:unur_distr_cont_upd_mode,@command{unur_distr_cont_upd_mode}} @end ifhtml @ifnothtml @command{unur_distr_cont_upd_mode} @end ifnothtml is called to compute the mode. If this is not successful @code{UNUR_INFINITY} is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_GET}. (There is no difference between the case where no routine for computing the mode is available and the case where no mode exists for the distribution at all.) @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cont_set_center} @deftypefn Function {int} unur_distr_cont_set_center (UNUR_DISTR* @var{distribution}, double @var{center}) Set center of the @var{distribution}. The center is used by some methods to shift the distribution in order to decrease numerical round-off error. If not given explicitly a default is used. @emph{Important:} This call does not check whether the center is contained in the given domain. Default: The mode, if set by a @ifhtml @ref{funct:unur_distr_cont_set_mode,@command{unur_distr_cont_set_mode}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_mode} @end ifnothtml or @ifhtml @ref{funct:unur_distr_cont_upd_mode,@command{unur_distr_cont_upd_mode}} @end ifhtml @ifnothtml @command{unur_distr_cont_upd_mode} @end ifnothtml call; otherwise @code{0}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cont_set_center} @deftypefn {} {int} unur_distr_cont_set_center (UNUR_DISTR* @var{distribution}, double @var{center}) Set center of the @var{distribution}. The center is used by some methods to shift the distribution in order to decrease numerical round-off error. If not given explicitly a default is used. @emph{Important:} This call does not check whether the center is contained in the given domain. Default: The mode, if set by a @ifhtml @ref{funct:unur_distr_cont_set_mode,@command{unur_distr_cont_set_mode}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_mode} @end ifnothtml or @ifhtml @ref{funct:unur_distr_cont_upd_mode,@command{unur_distr_cont_upd_mode}} @end ifhtml @ifnothtml @command{unur_distr_cont_upd_mode} @end ifnothtml call; otherwise @code{0}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cont_get_center} @deftypefn Function {double} unur_distr_cont_get_center (const @var{UNUR_DISTR* distribution}) Get center of the @var{distribution}. It always returns some point as there always exists a default for the center, see @ifhtml @ref{funct:unur_distr_cont_set_center,@command{unur_distr_cont_set_center}.} @end ifhtml @ifnothtml @command{unur_distr_cont_set_center}. @end ifnothtml @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cont_get_center} @deftypefn {} {double} unur_distr_cont_get_center (const @var{UNUR_DISTR* distribution}) Get center of the @var{distribution}. It always returns some point as there always exists a default for the center, see @ifhtml @ref{funct:unur_distr_cont_set_center,@command{unur_distr_cont_set_center}.} @end ifhtml @ifnothtml @command{unur_distr_cont_set_center}. @end ifnothtml @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cont_set_pdfarea} @deftypefn Function {int} unur_distr_cont_set_pdfarea (UNUR_DISTR* @var{distribution}, double @var{area}) Set the area below the PDF. If @code{area} is non-positive, no area is set and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_SET}. For a distribution object created by the UNU.RAN library of standard distributions you always should use the @ifhtml @ref{funct:unur_distr_cont_upd_pdfarea,@command{unur_distr_cont_upd_pdfarea}.} @end ifhtml @ifnothtml @command{unur_distr_cont_upd_pdfarea}. @end ifnothtml Otherwise there might be ambiguous side-effects. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cont_set_pdfarea} @deftypefn {} {int} unur_distr_cont_set_pdfarea (UNUR_DISTR* @var{distribution}, double @var{area}) Set the area below the PDF. If @code{area} is non-positive, no area is set and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_SET}. For a distribution object created by the UNU.RAN library of standard distributions you always should use the @ifhtml @ref{funct:unur_distr_cont_upd_pdfarea,@command{unur_distr_cont_upd_pdfarea}.} @end ifhtml @ifnothtml @command{unur_distr_cont_upd_pdfarea}. @end ifnothtml Otherwise there might be ambiguous side-effects. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cont_upd_pdfarea} @deftypefn Function {int} unur_distr_cont_upd_pdfarea (UNUR_DISTR* @var{distribution}) Recompute the area below the PDF of the distribution. It only works for distribution objects from the UNU.RAN library of standard distributions when the corresponding function is available. Otherwise @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. This call also sets the normalization constant such that the given PDF is the derivative of a given CDF, i.e. the area is 1. However, for truncated distributions the area is smaller than 1. The call does not work for distributions from the UNU.RAN library of standard distributions with truncated domain when the CDF is not available. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cont_upd_pdfarea} @deftypefn {} {int} unur_distr_cont_upd_pdfarea (UNUR_DISTR* @var{distribution}) Recompute the area below the PDF of the distribution. It only works for distribution objects from the UNU.RAN library of standard distributions when the corresponding function is available. Otherwise @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. This call also sets the normalization constant such that the given PDF is the derivative of a given CDF, i.e. the area is 1. However, for truncated distributions the area is smaller than 1. The call does not work for distributions from the UNU.RAN library of standard distributions with truncated domain when the CDF is not available. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cont_get_pdfarea} @deftypefn Function {double} unur_distr_cont_get_pdfarea (UNUR_DISTR* @var{distribution}) Get the area below the PDF of the distribution. If this area is not known,@* @ifhtml @ref{funct:unur_distr_cont_upd_pdfarea,@command{unur_distr_cont_upd_pdfarea}} @end ifhtml @ifnothtml @command{unur_distr_cont_upd_pdfarea} @end ifnothtml is called to compute it. If this is not successful @code{UNUR_INFINITY} is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_GET}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cont_get_pdfarea} @deftypefn {} {double} unur_distr_cont_get_pdfarea (UNUR_DISTR* @var{distribution}) Get the area below the PDF of the distribution. If this area is not known,@* @ifhtml @ref{funct:unur_distr_cont_upd_pdfarea,@command{unur_distr_cont_upd_pdfarea}} @end ifhtml @ifnothtml @command{unur_distr_cont_upd_pdfarea} @end ifnothtml is called to compute it. If this is not successful @code{UNUR_INFINITY} is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_GET}. @end deftypefn @end ifnotinfo @c @c end of cont.h @c ------------------------------------- @c ------------------------------------- @c corder.h @c @page @node CORDER @section Continuous univariate order statistics These are special cases of a continuous univariate distributions and thus they have most of these parameters (with the exception that functions cannot be changed). Additionally, @itemize @minus @item there is a call to extract the underlying distribution, @item and a call to handle the @command{rank} of the order statistics. @end itemize @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_distr_corder_new,unur_distr_corder_new} @item @ref{funct:unur_distr_corder_get_distribution,unur_distr_corder_get_distribution} @item @ref{funct:unur_distr_corder_set_rank,unur_distr_corder_set_rank} @item @ref{funct:unur_distr_corder_get_rank,unur_distr_corder_get_rank} @item @ref{funct:unur_distr_corder_get_pdf,unur_distr_corder_get_pdf} @item @ref{funct:unur_distr_corder_get_dpdf,unur_distr_corder_get_dpdf} @item @ref{funct:unur_distr_corder_get_cdf,unur_distr_corder_get_cdf} @item @ref{funct:unur_distr_corder_eval_pdf,unur_distr_corder_eval_pdf} @item @ref{funct:unur_distr_corder_eval_dpdf,unur_distr_corder_eval_dpdf} @item @ref{funct:unur_distr_corder_eval_cdf,unur_distr_corder_eval_cdf} @item @ref{funct:unur_distr_corder_set_pdfparams,unur_distr_corder_set_pdfparams} @item @ref{funct:unur_distr_corder_get_pdfparams,unur_distr_corder_get_pdfparams} @item @ref{funct:unur_distr_corder_set_domain,unur_distr_corder_set_domain} @item @ref{funct:unur_distr_corder_get_domain,unur_distr_corder_get_domain} @item @ref{funct:unur_distr_corder_get_truncated,unur_distr_corder_get_truncated} @item @ref{funct:unur_distr_corder_set_mode,unur_distr_corder_set_mode} @item @ref{funct:unur_distr_corder_upd_mode,unur_distr_corder_upd_mode} @item @ref{funct:unur_distr_corder_get_mode,unur_distr_corder_get_mode} @item @ref{funct:unur_distr_corder_set_pdfarea,unur_distr_corder_set_pdfarea} @item @ref{funct:unur_distr_corder_upd_pdfarea,unur_distr_corder_upd_pdfarea} @item @ref{funct:unur_distr_corder_get_pdfarea,unur_distr_corder_get_pdfarea} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_distr_corder_new} @deftypefn Function {UNUR_DISTR*} unur_distr_corder_new (const @var{UNUR_DISTR* distribution}, int @var{n}, int @var{k}) Create an object for order statistics of sample size @var{n} and rank @var{k}. @var{distribution} must be a pointer to a univariate continuous distribution. The resulting generator object is of the same type as of a @ifhtml @ref{funct:unur_distr_cont_new,@command{unur_distr_cont_new}} @end ifhtml @ifnothtml @command{unur_distr_cont_new} @end ifnothtml call. (However, it cannot be used to make an order statistics out of an order statistics.) To have a PDF for the order statistics, the given distribution object must contain a CDF and a PDF. Moreover, it is assumed that the given PDF is the derivative of the given CDF. Otherwise the area below the PDF of the order statistics is not computed correctly. @emph{Important:} There is no warning when the computed area below the PDF of the order statistics is wrong. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_corder_new} @deftypefn {} {UNUR_DISTR*} unur_distr_corder_new (const @var{UNUR_DISTR* distribution}, int @var{n}, int @var{k}) Create an object for order statistics of sample size @var{n} and rank @var{k}. @var{distribution} must be a pointer to a univariate continuous distribution. The resulting generator object is of the same type as of a @ifhtml @ref{funct:unur_distr_cont_new,@command{unur_distr_cont_new}} @end ifhtml @ifnothtml @command{unur_distr_cont_new} @end ifnothtml call. (However, it cannot be used to make an order statistics out of an order statistics.) To have a PDF for the order statistics, the given distribution object must contain a CDF and a PDF. Moreover, it is assumed that the given PDF is the derivative of the given CDF. Otherwise the area below the PDF of the order statistics is not computed correctly. @emph{Important:} There is no warning when the computed area below the PDF of the order statistics is wrong. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_corder_get_distribution} @deftypefn Function {const UNUR_DISTR*} unur_distr_corder_get_distribution (const @var{UNUR_DISTR* distribution}) Get pointer to distribution object for underlying distribution. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_corder_get_distribution} @deftypefn {} {const UNUR_DISTR*} unur_distr_corder_get_distribution (const @var{UNUR_DISTR* distribution}) Get pointer to distribution object for underlying distribution. @end deftypefn @end ifnotinfo @subsubheading Essential parameters @ifinfo @anchor{funct:unur_distr_corder_set_rank} @deftypefn Function {int} unur_distr_corder_set_rank (UNUR_DISTR* @var{distribution}, int @var{n}, int @var{k}) Change sample size @var{n} and rank @var{k} of order statistics. In case of invalid data, no parameters are changed. The area below the PDF can be set to that of the underlying distribution by a @ifhtml @ref{funct:unur_distr_corder_upd_pdfarea,@command{unur_distr_corder_upd_pdfarea}} @end ifhtml @ifnothtml @command{unur_distr_corder_upd_pdfarea} @end ifnothtml call. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_corder_set_rank} @deftypefn {} {int} unur_distr_corder_set_rank (UNUR_DISTR* @var{distribution}, int @var{n}, int @var{k}) Change sample size @var{n} and rank @var{k} of order statistics. In case of invalid data, no parameters are changed. The area below the PDF can be set to that of the underlying distribution by a @ifhtml @ref{funct:unur_distr_corder_upd_pdfarea,@command{unur_distr_corder_upd_pdfarea}} @end ifhtml @ifnothtml @command{unur_distr_corder_upd_pdfarea} @end ifnothtml call. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_corder_get_rank} @deftypefn Function {int} unur_distr_corder_get_rank (const @var{UNUR_DISTR* distribution}, int* @var{n}, int* @var{k}) Get sample size @var{n} and rank @var{k} of order statistics. In case of error an error code is returned. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_corder_get_rank} @deftypefn {} {int} unur_distr_corder_get_rank (const @var{UNUR_DISTR* distribution}, int* @var{n}, int* @var{k}) Get sample size @var{n} and rank @var{k} of order statistics. In case of error an error code is returned. @end deftypefn @end ifnotinfo Additionally most of the set and get calls for continuous univariate distributions work. The most important exceptions are that the PDF and CDF cannot be changed and @ifhtml @ref{funct:unur_distr_cont_upd_mode,@command{unur_distr_cont_upd_mode}} @end ifhtml @ifnothtml @command{unur_distr_cont_upd_mode} @end ifnothtml uses in any way a (slow) numerical method that might fail. @ifinfo @anchor{funct:unur_distr_corder_get_pdf} @anchor{funct:unur_distr_corder_get_dpdf} @anchor{funct:unur_distr_corder_get_cdf} @deftypefn Function {UNUR_FUNCT_CONT*} unur_distr_corder_get_pdf (UNUR_DISTR* @var{distribution}) @deftypefnx Function {UNUR_FUNCT_CONT*} unur_distr_corder_get_dpdf (UNUR_DISTR* @var{distribution}) @deftypefnx Function {UNUR_FUNCT_CONT*} unur_distr_corder_get_cdf (UNUR_DISTR* @var{distribution}) Get the respective pointer to the PDF, the derivative of the PDF and the CDF of the distribution, respectively. The pointer is of type @code{double funct(double x, UNUR_DISTR *distr)}. If the corresponding function is not available for the distribution, the @code{NULL} pointer is returned. See also @ifhtml @ref{funct:unur_distr_cont_get_pdf,@command{unur_distr_cont_get_pdf}.} @end ifhtml @ifnothtml @command{unur_distr_cont_get_pdf}. @end ifnothtml (Macro) @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_corder_get_pdf} @anchor{funct:unur_distr_corder_get_dpdf} @anchor{funct:unur_distr_corder_get_cdf} @deftypefn {} {UNUR_FUNCT_CONT*} unur_distr_corder_get_pdf (UNUR_DISTR* @var{distribution}) @deftypefnx {} {UNUR_FUNCT_CONT*} unur_distr_corder_get_dpdf (UNUR_DISTR* @var{distribution}) @deftypefnx {} {UNUR_FUNCT_CONT*} unur_distr_corder_get_cdf (UNUR_DISTR* @var{distribution}) Get the respective pointer to the PDF, the derivative of the PDF and the CDF of the distribution, respectively. The pointer is of type @code{double funct(double x, UNUR_DISTR *distr)}. If the corresponding function is not available for the distribution, the @code{NULL} pointer is returned. See also @ifhtml @ref{funct:unur_distr_cont_get_pdf,@command{unur_distr_cont_get_pdf}.} @end ifhtml @ifnothtml @command{unur_distr_cont_get_pdf}. @end ifnothtml (Macro) @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_corder_eval_pdf} @anchor{funct:unur_distr_corder_eval_dpdf} @anchor{funct:unur_distr_corder_eval_cdf} @deftypefn Function {double} unur_distr_corder_eval_pdf (double @var{x}, UNUR_DISTR* @var{distribution}) @deftypefnx Function {double} unur_distr_corder_eval_dpdf (double @var{x}, UNUR_DISTR* @var{distribution}) @deftypefnx Function {double} unur_distr_corder_eval_cdf (double @var{x}, UNUR_DISTR* @var{distribution}) Evaluate the PDF, derivative of the PDF. and the CDF, respectively, at @var{x}. Notice that @var{distribution} must not be the @code{NULL} pointer. If the corresponding function is not available for the distribution, @code{UNUR_INFINITY} is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. See also @ifhtml @ref{funct:unur_distr_cont_eval_pdf,@command{unur_distr_cont_eval_pdf}.} @end ifhtml @ifnothtml @command{unur_distr_cont_eval_pdf}. @end ifnothtml (Macro) @emph{IMPORTANT:} In the case of a truncated standard distribution these calls always return the respective values of the @emph{untruncated} distribution! @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_corder_eval_pdf} @anchor{funct:unur_distr_corder_eval_dpdf} @anchor{funct:unur_distr_corder_eval_cdf} @deftypefn {} {double} unur_distr_corder_eval_pdf (double @var{x}, UNUR_DISTR* @var{distribution}) @deftypefnx {} {double} unur_distr_corder_eval_dpdf (double @var{x}, UNUR_DISTR* @var{distribution}) @deftypefnx {} {double} unur_distr_corder_eval_cdf (double @var{x}, UNUR_DISTR* @var{distribution}) Evaluate the PDF, derivative of the PDF. and the CDF, respectively, at @var{x}. Notice that @var{distribution} must not be the @code{NULL} pointer. If the corresponding function is not available for the distribution, @code{UNUR_INFINITY} is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. See also @ifhtml @ref{funct:unur_distr_cont_eval_pdf,@command{unur_distr_cont_eval_pdf}.} @end ifhtml @ifnothtml @command{unur_distr_cont_eval_pdf}. @end ifnothtml (Macro) @emph{IMPORTANT:} In the case of a truncated standard distribution these calls always return the respective values of the @emph{untruncated} distribution! @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_corder_set_pdfparams} @deftypefn Function {int} unur_distr_corder_set_pdfparams (UNUR_DISTR* @var{distribution}, double* @var{params}, int @var{n_params}) Set array of parameters for underlying distribution. See @ifhtml @ref{funct:unur_distr_cont_set_pdfparams,@command{unur_distr_cont_set_pdfparams}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_pdfparams} @end ifnothtml for details. (Macro) @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_corder_set_pdfparams} @deftypefn {} {int} unur_distr_corder_set_pdfparams (UNUR_DISTR* @var{distribution}, double* @var{params}, int @var{n_params}) Set array of parameters for underlying distribution. See @ifhtml @ref{funct:unur_distr_cont_set_pdfparams,@command{unur_distr_cont_set_pdfparams}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_pdfparams} @end ifnothtml for details. (Macro) @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_corder_get_pdfparams} @deftypefn Function {int} unur_distr_corder_get_pdfparams (UNUR_DISTR* @var{distribution}, double** @var{params}) Get number of parameters of the PDF of the underlying distribution and set pointer @var{params} to array of parameters. See @ifhtml @ref{funct:unur_distr_cont_get_pdfparams,@command{unur_distr_cont_get_pdfparams}} @end ifhtml @ifnothtml @command{unur_distr_cont_get_pdfparams} @end ifnothtml for details. (Macro) @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_corder_get_pdfparams} @deftypefn {} {int} unur_distr_corder_get_pdfparams (UNUR_DISTR* @var{distribution}, double** @var{params}) Get number of parameters of the PDF of the underlying distribution and set pointer @var{params} to array of parameters. See @ifhtml @ref{funct:unur_distr_cont_get_pdfparams,@command{unur_distr_cont_get_pdfparams}} @end ifhtml @ifnothtml @command{unur_distr_cont_get_pdfparams} @end ifnothtml for details. (Macro) @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_corder_set_domain} @deftypefn Function {int} unur_distr_corder_set_domain (UNUR_DISTR* @var{distribution}, double @var{left}, double @var{right}) Set the left and right borders of the domain of the distribution. See @ifhtml @ref{funct:unur_distr_cont_set_domain,@command{unur_distr_cont_set_domain}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_domain} @end ifnothtml for details. (Macro) @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_corder_set_domain} @deftypefn {} {int} unur_distr_corder_set_domain (UNUR_DISTR* @var{distribution}, double @var{left}, double @var{right}) Set the left and right borders of the domain of the distribution. See @ifhtml @ref{funct:unur_distr_cont_set_domain,@command{unur_distr_cont_set_domain}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_domain} @end ifnothtml for details. (Macro) @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_corder_get_domain} @deftypefn Function {int} unur_distr_corder_get_domain (UNUR_DISTR* @var{distribution}, double* @var{left}, double* @var{right}) Get the left and right borders of the domain of the distribution. See @ifhtml @ref{funct:unur_distr_cont_get_domain,@command{unur_distr_cont_get_domain}} @end ifhtml @ifnothtml @command{unur_distr_cont_get_domain} @end ifnothtml for details. (Macro) @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_corder_get_domain} @deftypefn {} {int} unur_distr_corder_get_domain (UNUR_DISTR* @var{distribution}, double* @var{left}, double* @var{right}) Get the left and right borders of the domain of the distribution. See @ifhtml @ref{funct:unur_distr_cont_get_domain,@command{unur_distr_cont_get_domain}} @end ifhtml @ifnothtml @command{unur_distr_cont_get_domain} @end ifnothtml for details. (Macro) @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_corder_get_truncated} @deftypefn Function {int} unur_distr_corder_get_truncated (UNUR_DISTR* @var{distribution}, double* @var{left}, double* @var{right}) Get the left and right borders of the (truncated) domain of the distribution. See @ifhtml @ref{funct:unur_distr_cont_get_truncated,@command{unur_distr_cont_get_truncated}} @end ifhtml @ifnothtml @command{unur_distr_cont_get_truncated} @end ifnothtml for details. (Macro) @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_corder_get_truncated} @deftypefn {} {int} unur_distr_corder_get_truncated (UNUR_DISTR* @var{distribution}, double* @var{left}, double* @var{right}) Get the left and right borders of the (truncated) domain of the distribution. See @ifhtml @ref{funct:unur_distr_cont_get_truncated,@command{unur_distr_cont_get_truncated}} @end ifhtml @ifnothtml @command{unur_distr_cont_get_truncated} @end ifnothtml for details. (Macro) @end deftypefn @end ifnotinfo @subsubheading Derived parameters The following paramters @strong{must} be set whenever one of the essential parameters has been set or changed (and the parameter is required for the chosen method). @ifinfo @anchor{funct:unur_distr_corder_set_mode} @deftypefn Function {int} unur_distr_corder_set_mode (UNUR_DISTR* @var{distribution}, double @var{mode}) Set mode of distribution. See also @ifhtml @ref{funct:unur_distr_corder_set_mode,@command{unur_distr_corder_set_mode}.} @end ifhtml @ifnothtml @command{unur_distr_corder_set_mode}. @end ifnothtml (Macro) @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_corder_set_mode} @deftypefn {} {int} unur_distr_corder_set_mode (UNUR_DISTR* @var{distribution}, double @var{mode}) Set mode of distribution. See also @ifhtml @ref{funct:unur_distr_corder_set_mode,@command{unur_distr_corder_set_mode}.} @end ifhtml @ifnothtml @command{unur_distr_corder_set_mode}. @end ifnothtml (Macro) @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_corder_upd_mode} @deftypefn Function {double} unur_distr_corder_upd_mode (UNUR_DISTR* @var{distribution}) Recompute the mode of the distribution numerically. Notice that this routine is slow and might not work properly in every case. See also @ifhtml @ref{funct:unur_distr_cont_upd_mode,@command{unur_distr_cont_upd_mode}} @end ifhtml @ifnothtml @command{unur_distr_cont_upd_mode} @end ifnothtml for further details. (Macro) @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_corder_upd_mode} @deftypefn {} {double} unur_distr_corder_upd_mode (UNUR_DISTR* @var{distribution}) Recompute the mode of the distribution numerically. Notice that this routine is slow and might not work properly in every case. See also @ifhtml @ref{funct:unur_distr_cont_upd_mode,@command{unur_distr_cont_upd_mode}} @end ifhtml @ifnothtml @command{unur_distr_cont_upd_mode} @end ifnothtml for further details. (Macro) @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_corder_get_mode} @deftypefn Function {double} unur_distr_corder_get_mode (UNUR_DISTR* @var{distribution}) Get mode of distribution. See @ifhtml @ref{funct:unur_distr_cont_get_mode,@command{unur_distr_cont_get_mode}} @end ifhtml @ifnothtml @command{unur_distr_cont_get_mode} @end ifnothtml for details. (Macro) @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_corder_get_mode} @deftypefn {} {double} unur_distr_corder_get_mode (UNUR_DISTR* @var{distribution}) Get mode of distribution. See @ifhtml @ref{funct:unur_distr_cont_get_mode,@command{unur_distr_cont_get_mode}} @end ifhtml @ifnothtml @command{unur_distr_cont_get_mode} @end ifnothtml for details. (Macro) @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_corder_set_pdfarea} @deftypefn Function {int} unur_distr_corder_set_pdfarea (UNUR_DISTR* @var{distribution}, double @var{area}) Set the area below the PDF. See @ifhtml @ref{funct:unur_distr_cont_set_pdfarea,@command{unur_distr_cont_set_pdfarea}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_pdfarea} @end ifnothtml for details. (Macro) @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_corder_set_pdfarea} @deftypefn {} {int} unur_distr_corder_set_pdfarea (UNUR_DISTR* @var{distribution}, double @var{area}) Set the area below the PDF. See @ifhtml @ref{funct:unur_distr_cont_set_pdfarea,@command{unur_distr_cont_set_pdfarea}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_pdfarea} @end ifnothtml for details. (Macro) @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_corder_upd_pdfarea} @deftypefn Function {double} unur_distr_corder_upd_pdfarea (UNUR_DISTR* @var{distribution}) Recompute the area below the PDF of the distribution. It only works for order statistics for distribution objects from the UNU.RAN library of standard distributions when the corresponding function is available. @ifhtml @ref{funct:unur_distr_cont_upd_pdfarea,@command{unur_distr_cont_upd_pdfarea}} @end ifhtml @ifnothtml @command{unur_distr_cont_upd_pdfarea} @end ifnothtml assumes that the PDF of the underlying distribution is normalized, i.e. it is the derivative of its CDF. Otherwise the computed area is wrong and there is @strong{no} warning about this failure. See @ifhtml @ref{funct:unur_distr_cont_upd_pdfarea,@command{unur_distr_cont_upd_pdfarea}} @end ifhtml @ifnothtml @command{unur_distr_cont_upd_pdfarea} @end ifnothtml for further details. (Macro) @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_corder_upd_pdfarea} @deftypefn {} {double} unur_distr_corder_upd_pdfarea (UNUR_DISTR* @var{distribution}) Recompute the area below the PDF of the distribution. It only works for order statistics for distribution objects from the UNU.RAN library of standard distributions when the corresponding function is available. @ifhtml @ref{funct:unur_distr_cont_upd_pdfarea,@command{unur_distr_cont_upd_pdfarea}} @end ifhtml @ifnothtml @command{unur_distr_cont_upd_pdfarea} @end ifnothtml assumes that the PDF of the underlying distribution is normalized, i.e. it is the derivative of its CDF. Otherwise the computed area is wrong and there is @strong{no} warning about this failure. See @ifhtml @ref{funct:unur_distr_cont_upd_pdfarea,@command{unur_distr_cont_upd_pdfarea}} @end ifhtml @ifnothtml @command{unur_distr_cont_upd_pdfarea} @end ifnothtml for further details. (Macro) @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_corder_get_pdfarea} @deftypefn Function {double} unur_distr_corder_get_pdfarea (UNUR_DISTR* @var{distribution}) Get the area below the PDF of the distribution. See @ifhtml @ref{funct:unur_distr_cont_get_pdfarea,@command{unur_distr_cont_get_pdfarea}} @end ifhtml @ifnothtml @command{unur_distr_cont_get_pdfarea} @end ifnothtml for details. (Macro) @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_corder_get_pdfarea} @deftypefn {} {double} unur_distr_corder_get_pdfarea (UNUR_DISTR* @var{distribution}) Get the area below the PDF of the distribution. See @ifhtml @ref{funct:unur_distr_cont_get_pdfarea,@command{unur_distr_cont_get_pdfarea}} @end ifhtml @ifnothtml @command{unur_distr_cont_get_pdfarea} @end ifnothtml for details. (Macro) @end deftypefn @end ifnotinfo @c @c end of corder.h @c ------------------------------------- @c ------------------------------------- @c cemp.h @c @page @node CEMP @section Continuous empirical univariate distributions Empirical univariate distributions are derived from observed data. There are two ways to create such a generator object: @enumerate @item By a list of @emph{raw data} by means of a @ifhtml @ref{funct:unur_distr_cemp_set_data,@command{unur_distr_cemp_set_data}} @end ifhtml @ifnothtml @command{unur_distr_cemp_set_data} @end ifnothtml call. @item By a @emph{histogram} (i.e. preprocessed data) by means of a @ifhtml @ref{funct:unur_distr_cemp_set_hist,@command{unur_distr_cemp_set_hist}} @end ifhtml @ifnothtml @command{unur_distr_cemp_set_hist} @end ifnothtml call. @end enumerate How these data are used to sample from the empirical distribution depends from the chosen generation method. @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_distr_cemp_new,unur_distr_cemp_new} @item @ref{funct:unur_distr_cemp_set_data,unur_distr_cemp_set_data} @item @ref{funct:unur_distr_cemp_read_data,unur_distr_cemp_read_data} @item @ref{funct:unur_distr_cemp_get_data,unur_distr_cemp_get_data} @item @ref{funct:unur_distr_cemp_set_hist,unur_distr_cemp_set_hist} @item @ref{funct:unur_distr_cemp_set_hist_prob,unur_distr_cemp_set_hist_prob} @item @ref{funct:unur_distr_cemp_set_hist_domain,unur_distr_cemp_set_hist_domain} @item @ref{funct:unur_distr_cemp_set_hist_bins,unur_distr_cemp_set_hist_bins} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_distr_cemp_new} @deftypefn Function {UNUR_DISTR*} unur_distr_cemp_new (void) Create a new (empty) object for empirical univariate continuous distribution. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cemp_new} @deftypefn {} {UNUR_DISTR*} unur_distr_cemp_new (void) Create a new (empty) object for empirical univariate continuous distribution. @end deftypefn @end ifnotinfo @subsubheading Essential parameters @ifinfo @anchor{funct:unur_distr_cemp_set_data} @deftypefn Function {int} unur_distr_cemp_set_data (UNUR_DISTR* @var{distribution}, const @var{double* sample}, int @var{n_sample}) Set observed sample for empirical distribution. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cemp_set_data} @deftypefn {} {int} unur_distr_cemp_set_data (UNUR_DISTR* @var{distribution}, const @var{double* sample}, int @var{n_sample}) Set observed sample for empirical distribution. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cemp_read_data} @deftypefn Function {int} unur_distr_cemp_read_data (UNUR_DISTR* @var{distribution}, const @var{char* filename}) Read data from file @file{filename}. It reads the first number from each line. Numbers are parsed by means of the C standard routine @command{strtod}. Lines that do not start with @code{+}, @code{-}, @code{.}, or a digit are ignored. (Beware of lines starting with a blank!) In case of an error (file cannot be opened, invalid string for double in line) no data are copied into the distribution object and an error code is returned. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cemp_read_data} @deftypefn {} {int} unur_distr_cemp_read_data (UNUR_DISTR* @var{distribution}, const @var{char* filename}) Read data from file @file{filename}. It reads the first number from each line. Numbers are parsed by means of the C standard routine @command{strtod}. Lines that do not start with @code{+}, @code{-}, @code{.}, or a digit are ignored. (Beware of lines starting with a blank!) In case of an error (file cannot be opened, invalid string for double in line) no data are copied into the distribution object and an error code is returned. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cemp_get_data} @deftypefn Function {int} unur_distr_cemp_get_data (const @var{UNUR_DISTR* distribution}, const @var{double** sample}) Get number of samples and set pointer @var{sample} to array of observations. If no sample has been given, an error code is returned and @code{sample} is set to @code{NULL}. @emph{Important:} Do @strong{not} change the entries in @var{sample}! @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cemp_get_data} @deftypefn {} {int} unur_distr_cemp_get_data (const @var{UNUR_DISTR* distribution}, const @var{double** sample}) Get number of samples and set pointer @var{sample} to array of observations. If no sample has been given, an error code is returned and @code{sample} is set to @code{NULL}. @emph{Important:} Do @strong{not} change the entries in @var{sample}! @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cemp_set_hist} @deftypefn Function {int} unur_distr_cemp_set_hist (UNUR_DISTR* @var{distribution}, const @var{double* prob}, int @var{n_prob}, double @var{xmin}, double @var{xmax}) Set a histogram with bins of equal width. @var{prob} is an array of length @var{n_prob} that contains the probabilities for the bins (in ascending order). @var{xmin} and @var{xmax} give the lower and upper bound of the histogram, respectively. The bins are assumed to have equal width. @emph{Remark:} This is shortcut for calling @ifhtml @ref{funct:unur_distr_cemp_set_hist_prob,@command{unur_distr_cemp_set_hist_prob}} @end ifhtml @ifnothtml @command{unur_distr_cemp_set_hist_prob} @end ifnothtml and @ifhtml @ref{funct:unur_distr_cemp_set_hist_domain,@command{unur_distr_cemp_set_hist_domain}.} @end ifhtml @ifnothtml @command{unur_distr_cemp_set_hist_domain}. @end ifnothtml @emph{Notice:} All sampling methods either use raw data or histogram. It is possible to set both types of data; however, it is not checked whether the given histogran corresponds to possibly given raw data. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cemp_set_hist} @deftypefn {} {int} unur_distr_cemp_set_hist (UNUR_DISTR* @var{distribution}, const @var{double* prob}, int @var{n_prob}, double @var{xmin}, double @var{xmax}) Set a histogram with bins of equal width. @var{prob} is an array of length @var{n_prob} that contains the probabilities for the bins (in ascending order). @var{xmin} and @var{xmax} give the lower and upper bound of the histogram, respectively. The bins are assumed to have equal width. @emph{Remark:} This is shortcut for calling @ifhtml @ref{funct:unur_distr_cemp_set_hist_prob,@command{unur_distr_cemp_set_hist_prob}} @end ifhtml @ifnothtml @command{unur_distr_cemp_set_hist_prob} @end ifnothtml and @ifhtml @ref{funct:unur_distr_cemp_set_hist_domain,@command{unur_distr_cemp_set_hist_domain}.} @end ifhtml @ifnothtml @command{unur_distr_cemp_set_hist_domain}. @end ifnothtml @emph{Notice:} All sampling methods either use raw data or histogram. It is possible to set both types of data; however, it is not checked whether the given histogran corresponds to possibly given raw data. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cemp_set_hist_prob} @deftypefn Function {int} unur_distr_cemp_set_hist_prob (UNUR_DISTR* @var{distribution}, const @var{double* prob}, int @var{n_prob}) Set probabilities of a histogram with @var{n_prob} bins. Hence @var{prob} must be an array of length @var{n_prob} that contains the probabilities for the bins in ascending order. It is important also to set the location of the bins either with a @ifhtml @ref{funct:unur_distr_cemp_set_hist_domain,@command{unur_distr_cemp_set_hist_domain}} @end ifhtml @ifnothtml @command{unur_distr_cemp_set_hist_domain} @end ifnothtml for bins of equal width or @ifhtml @ref{funct:unur_distr_cemp_set_hist_bins,@command{unur_distr_cemp_set_hist_bins}} @end ifhtml @ifnothtml @command{unur_distr_cemp_set_hist_bins} @end ifnothtml when the bins have different width. @emph{Notice:} All sampling methods either use raw data or histogram. It is possible to set both types of data; however, it is not checked whether the given histogram corresponds to possibly given raw data. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cemp_set_hist_prob} @deftypefn {} {int} unur_distr_cemp_set_hist_prob (UNUR_DISTR* @var{distribution}, const @var{double* prob}, int @var{n_prob}) Set probabilities of a histogram with @var{n_prob} bins. Hence @var{prob} must be an array of length @var{n_prob} that contains the probabilities for the bins in ascending order. It is important also to set the location of the bins either with a @ifhtml @ref{funct:unur_distr_cemp_set_hist_domain,@command{unur_distr_cemp_set_hist_domain}} @end ifhtml @ifnothtml @command{unur_distr_cemp_set_hist_domain} @end ifnothtml for bins of equal width or @ifhtml @ref{funct:unur_distr_cemp_set_hist_bins,@command{unur_distr_cemp_set_hist_bins}} @end ifhtml @ifnothtml @command{unur_distr_cemp_set_hist_bins} @end ifnothtml when the bins have different width. @emph{Notice:} All sampling methods either use raw data or histogram. It is possible to set both types of data; however, it is not checked whether the given histogram corresponds to possibly given raw data. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cemp_set_hist_domain} @deftypefn Function {int} unur_distr_cemp_set_hist_domain (UNUR_DISTR* @var{distribution}, double @var{xmin}, double @var{xmax}) Set a domain of a histogram with bins of equal width. @var{xmin} and @var{xmax} give the lower and upper bound of the histogram, respectively. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cemp_set_hist_domain} @deftypefn {} {int} unur_distr_cemp_set_hist_domain (UNUR_DISTR* @var{distribution}, double @var{xmin}, double @var{xmax}) Set a domain of a histogram with bins of equal width. @var{xmin} and @var{xmax} give the lower and upper bound of the histogram, respectively. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cemp_set_hist_bins} @deftypefn Function {int} unur_distr_cemp_set_hist_bins (UNUR_DISTR* @var{distribution}, const @var{double* bins}, int @var{n_bins}) Set location of bins of a histogram with @var{n_bins} bins. Hence @var{bins} must be an array of length @var{n_bins}. The domain of the @var{distribution} is automatically set by this call and overrides any calls to @ifhtml @ref{funct:unur_distr_cemp_set_hist_domain,@command{unur_distr_cemp_set_hist_domain}.} @end ifhtml @ifnothtml @command{unur_distr_cemp_set_hist_domain}. @end ifnothtml @emph{Important:} The probabilities of the bins of the @var{distribution} must be already be set by a @ifhtml @ref{funct:unur_distr_cemp_set_hist_prob,@command{unur_distr_cemp_set_hist_prob}} @end ifhtml @ifnothtml @command{unur_distr_cemp_set_hist_prob} @end ifnothtml (or a @ifhtml @ref{funct:unur_distr_cemp_set_hist,@command{unur_distr_cemp_set_hist}} @end ifhtml @ifnothtml @command{unur_distr_cemp_set_hist} @end ifnothtml call) and the value of @var{n_bins} must equal @var{n_prob}@code{+1} from the corresponding value of the respective call. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cemp_set_hist_bins} @deftypefn {} {int} unur_distr_cemp_set_hist_bins (UNUR_DISTR* @var{distribution}, const @var{double* bins}, int @var{n_bins}) Set location of bins of a histogram with @var{n_bins} bins. Hence @var{bins} must be an array of length @var{n_bins}. The domain of the @var{distribution} is automatically set by this call and overrides any calls to @ifhtml @ref{funct:unur_distr_cemp_set_hist_domain,@command{unur_distr_cemp_set_hist_domain}.} @end ifhtml @ifnothtml @command{unur_distr_cemp_set_hist_domain}. @end ifnothtml @emph{Important:} The probabilities of the bins of the @var{distribution} must be already be set by a @ifhtml @ref{funct:unur_distr_cemp_set_hist_prob,@command{unur_distr_cemp_set_hist_prob}} @end ifhtml @ifnothtml @command{unur_distr_cemp_set_hist_prob} @end ifnothtml (or a @ifhtml @ref{funct:unur_distr_cemp_set_hist,@command{unur_distr_cemp_set_hist}} @end ifhtml @ifnothtml @command{unur_distr_cemp_set_hist} @end ifnothtml call) and the value of @var{n_bins} must equal @var{n_prob}@code{+1} from the corresponding value of the respective call. @end deftypefn @end ifnotinfo @c @c end of cemp.h @c ------------------------------------- @c ------------------------------------- @c cvec.h @c @page @node CVEC @section Continuous multivariate distributions The following calls handle multivariate distributions. However, the requirements of particular generation methods is not as unique as for univariate distributions. Moreover, random vector generation methods are still under development. The below functions are a first attempt to handle this situation. Notice that some of the parameters -- when given carelessly -- might contradict to others. For example: Some methods require the marginal distribution and some methods need a standardized form of the marginal distributions, where the actual mean and variance is stored in the mean vector and the covariance matrix, respectively. We also have to mention that some methods might abuse some of the parameters. Please read the discription of the chosen sampling method carfully. The following kind of calls exists: @itemize @minus @item Create a @command{new} instance of a continuous multivariate distribution; @item Handle and evaluate probability density function (PDF, @command{pdf}) and the gradient of the density function (@command{dpdf}). The following is important: @itemize . @item @command{pdf} need not be normalized, i.e., any integrable nonnegative function can be used. @item @command{dpdf} must the derivate of the function provided as @command{pdf}. @end itemize @item Handle and evaluate the logarithm of the probability density function (logPDF, @command{logpdf}) and the gradient of the logarithm of the density function (@command{dlogpdf}). Some methods use the logarithm of the density if available. @item Set (and change) parameters (@command{pdfparams}) and the volume below the graph (@command{pdfvol}) of the given density. @item Set @command{mode} and @command{mean} of the distribution. @item Set the @command{center} of the distribution. It is used by some generation methods to adjust the parameters of the generation algorithms to gain better performance. It can be seens as the location of the ``central part'' of the distribution. @item Handle the @command{covar}iance matrix of the distribution and its @command{cholesky} and @command{inv}verse matrices. @item Set the @command{rankcorr}elation matrix of the distribution. @item Deal with @command{marginal} distributions. @item Set domain of the distribution. @end itemize @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_distr_cvec_new,unur_distr_cvec_new} @item @ref{funct:unur_distr_cvec_set_pdf,unur_distr_cvec_set_pdf} @item @ref{funct:unur_distr_cvec_set_dpdf,unur_distr_cvec_set_dpdf} @item @ref{funct:unur_distr_cvec_set_pdpdf,unur_distr_cvec_set_pdpdf} @item @ref{funct:unur_distr_cvec_get_pdf,unur_distr_cvec_get_pdf} @item @ref{funct:unur_distr_cvec_get_dpdf,unur_distr_cvec_get_dpdf} @item @ref{funct:unur_distr_cvec_eval_pdf,unur_distr_cvec_eval_pdf} @item @ref{funct:unur_distr_cvec_eval_dpdf,unur_distr_cvec_eval_dpdf} @item @ref{funct:unur_distr_cvec_eval_pdpdf,unur_distr_cvec_eval_pdpdf} @item @ref{funct:unur_distr_cvec_set_logpdf,unur_distr_cvec_set_logpdf} @item @ref{funct:unur_distr_cvec_set_dlogpdf,unur_distr_cvec_set_dlogpdf} @item @ref{funct:unur_distr_cvec_set_pdlogpdf,unur_distr_cvec_set_pdlogpdf} @item @ref{funct:unur_distr_cvec_get_logpdf,unur_distr_cvec_get_logpdf} @item @ref{funct:unur_distr_cvec_get_dlogpdf,unur_distr_cvec_get_dlogpdf} @item @ref{funct:unur_distr_cvec_eval_logpdf,unur_distr_cvec_eval_logpdf} @item @ref{funct:unur_distr_cvec_eval_dlogpdf,unur_distr_cvec_eval_dlogpdf} @item @ref{funct:unur_distr_cvec_eval_pdlogpdf,unur_distr_cvec_eval_pdlogpdf} @item @ref{funct:unur_distr_cvec_set_mean,unur_distr_cvec_set_mean} @item @ref{funct:unur_distr_cvec_get_mean,unur_distr_cvec_get_mean} @item @ref{funct:unur_distr_cvec_set_covar,unur_distr_cvec_set_covar} @item @ref{funct:unur_distr_cvec_set_covar_inv,unur_distr_cvec_set_covar_inv} @item @ref{funct:unur_distr_cvec_get_covar,unur_distr_cvec_get_covar} @item @ref{funct:unur_distr_cvec_get_cholesky,unur_distr_cvec_get_cholesky} @item @ref{funct:unur_distr_cvec_get_covar_inv,unur_distr_cvec_get_covar_inv} @item @ref{funct:unur_distr_cvec_set_rankcorr,unur_distr_cvec_set_rankcorr} @item @ref{funct:unur_distr_cvec_get_rankcorr,unur_distr_cvec_get_rankcorr} @item @ref{funct:unur_distr_cvec_get_rk_cholesky,unur_distr_cvec_get_rk_cholesky} @item @ref{funct:unur_distr_cvec_set_marginals,unur_distr_cvec_set_marginals} @item @ref{funct:unur_distr_cvec_set_marginal_array,unur_distr_cvec_set_marginal_array} @item @ref{funct:unur_distr_cvec_set_marginal_list,unur_distr_cvec_set_marginal_list} @item @ref{funct:unur_distr_cvec_get_marginal,unur_distr_cvec_get_marginal} @item @ref{funct:unur_distr_cvec_set_pdfparams,unur_distr_cvec_set_pdfparams} @item @ref{funct:unur_distr_cvec_get_pdfparams,unur_distr_cvec_get_pdfparams} @item @ref{funct:unur_distr_cvec_set_pdfparams_vec,unur_distr_cvec_set_pdfparams_vec} @item @ref{funct:unur_distr_cvec_get_pdfparams_vec,unur_distr_cvec_get_pdfparams_vec} @item @ref{funct:unur_distr_cvec_set_domain_rect,unur_distr_cvec_set_domain_rect} @item @ref{funct:unur_distr_cvec_is_indomain,unur_distr_cvec_is_indomain} @item @ref{funct:unur_distr_cvec_set_mode,unur_distr_cvec_set_mode} @item @ref{funct:unur_distr_cvec_upd_mode,unur_distr_cvec_upd_mode} @item @ref{funct:unur_distr_cvec_get_mode,unur_distr_cvec_get_mode} @item @ref{funct:unur_distr_cvec_set_center,unur_distr_cvec_set_center} @item @ref{funct:unur_distr_cvec_get_center,unur_distr_cvec_get_center} @item @ref{funct:unur_distr_cvec_set_pdfvol,unur_distr_cvec_set_pdfvol} @item @ref{funct:unur_distr_cvec_upd_pdfvol,unur_distr_cvec_upd_pdfvol} @item @ref{funct:unur_distr_cvec_get_pdfvol,unur_distr_cvec_get_pdfvol} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_distr_cvec_new} @deftypefn Function {UNUR_DISTR*} unur_distr_cvec_new (int @var{dim}) Create a new (empty) object for multivariate continuous distribution. @var{dim} is the number of components of the random vector (i.e. its dimension). It is also possible to use dimension 1. Notice, however, that this is treated as a distribution of random vectors with only one component and not as a distribution of real numbers. For the latter @ifhtml @ref{funct:unur_distr_cont_new,@command{unur_distr_cont_new}} @end ifhtml @ifnothtml @command{unur_distr_cont_new} @end ifnothtml should be used to create an object for a univariate distribution. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cvec_new} @deftypefn {} {UNUR_DISTR*} unur_distr_cvec_new (int @var{dim}) Create a new (empty) object for multivariate continuous distribution. @var{dim} is the number of components of the random vector (i.e. its dimension). It is also possible to use dimension 1. Notice, however, that this is treated as a distribution of random vectors with only one component and not as a distribution of real numbers. For the latter @ifhtml @ref{funct:unur_distr_cont_new,@command{unur_distr_cont_new}} @end ifhtml @ifnothtml @command{unur_distr_cont_new} @end ifnothtml should be used to create an object for a univariate distribution. @end deftypefn @end ifnotinfo @subsubheading Essential parameters @ifinfo @anchor{funct:unur_distr_cvec_set_pdf} @deftypefn Function {int} unur_distr_cvec_set_pdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_CVEC* @var{pdf}) Set respective pointer to the PDF of the @var{distribution}. This function must be of type @code{double funct(const double *x, UNUR_DISTR *distr)}, where @var{x} must be a pointer to a double array of appropriate size (i.e. of the same size as given to the @ifhtml @ref{funct:unur_distr_cvec_new,@command{unur_distr_cvec_new}} @end ifhtml @ifnothtml @command{unur_distr_cvec_new} @end ifnothtml call). It is not necessary that the given PDF is normalized, i.e. the integral need not be 1. Nevertheless the volume below the PDF can be provided by a @ifhtml @ref{funct:unur_distr_cvec_set_pdfvol,@command{unur_distr_cvec_set_pdfvol}} @end ifhtml @ifnothtml @command{unur_distr_cvec_set_pdfvol} @end ifnothtml call. It is not possible to change the PDF. Once the PDF is set it cannot be overwritten. This also holds when the logPDF is given. A new distribution object has to be used instead. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cvec_set_pdf} @deftypefn {} {int} unur_distr_cvec_set_pdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_CVEC* @var{pdf}) Set respective pointer to the PDF of the @var{distribution}. This function must be of type @code{double funct(const double *x, UNUR_DISTR *distr)}, where @var{x} must be a pointer to a double array of appropriate size (i.e. of the same size as given to the @ifhtml @ref{funct:unur_distr_cvec_new,@command{unur_distr_cvec_new}} @end ifhtml @ifnothtml @command{unur_distr_cvec_new} @end ifnothtml call). It is not necessary that the given PDF is normalized, i.e. the integral need not be 1. Nevertheless the volume below the PDF can be provided by a @ifhtml @ref{funct:unur_distr_cvec_set_pdfvol,@command{unur_distr_cvec_set_pdfvol}} @end ifhtml @ifnothtml @command{unur_distr_cvec_set_pdfvol} @end ifnothtml call. It is not possible to change the PDF. Once the PDF is set it cannot be overwritten. This also holds when the logPDF is given. A new distribution object has to be used instead. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cvec_set_dpdf} @deftypefn Function {int} unur_distr_cvec_set_dpdf (UNUR_DISTR* @var{distribution}, UNUR_VFUNCT_CVEC* @var{dpdf}) Set pointer to the gradient of the PDF. The type of this function must be @code{int funct(double *result, const double *x, UNUR_DISTR *distr)}, where @var{result} and @var{x} must be pointers to double arrays of appropriate size (i.e. of the same size as given to the @ifhtml @ref{funct:unur_distr_cvec_new,@command{unur_distr_cvec_new}} @end ifhtml @ifnothtml @command{unur_distr_cvec_new} @end ifnothtml call). The gradient of the PDF is stored in the array @var{result}. The function should return an error code in case of an error and must return @code{UNUR_SUCCESS} otherwise. The given function must be the gradient of the function given by a @ifhtml @ref{funct:unur_distr_cvec_set_pdf,@command{unur_distr_cvec_set_pdf}} @end ifhtml @ifnothtml @command{unur_distr_cvec_set_pdf} @end ifnothtml call. It is not possible to change the gradient of the PDF. Once the dPDF is set it cannot be overwritten. This also holds when the gradient of the logPDF is given. A new distribution object has to be used instead. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cvec_set_dpdf} @deftypefn {} {int} unur_distr_cvec_set_dpdf (UNUR_DISTR* @var{distribution}, UNUR_VFUNCT_CVEC* @var{dpdf}) Set pointer to the gradient of the PDF. The type of this function must be @code{int funct(double *result, const double *x, UNUR_DISTR *distr)}, where @var{result} and @var{x} must be pointers to double arrays of appropriate size (i.e. of the same size as given to the @ifhtml @ref{funct:unur_distr_cvec_new,@command{unur_distr_cvec_new}} @end ifhtml @ifnothtml @command{unur_distr_cvec_new} @end ifnothtml call). The gradient of the PDF is stored in the array @var{result}. The function should return an error code in case of an error and must return @code{UNUR_SUCCESS} otherwise. The given function must be the gradient of the function given by a @ifhtml @ref{funct:unur_distr_cvec_set_pdf,@command{unur_distr_cvec_set_pdf}} @end ifhtml @ifnothtml @command{unur_distr_cvec_set_pdf} @end ifnothtml call. It is not possible to change the gradient of the PDF. Once the dPDF is set it cannot be overwritten. This also holds when the gradient of the logPDF is given. A new distribution object has to be used instead. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cvec_set_pdpdf} @deftypefn Function {int} unur_distr_cvec_set_pdpdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCTD_CVEC* @var{pdpdf}) Set pointer to partial derivatives of the PDF. The type of this function must be @code{double funct(const double *x, int coord, UNUR_DISTR *distr)}, where @var{x} must be a pointer to a double array of appropriate size (i.e. of the same size as given to the @ifhtml @ref{funct:unur_distr_cvec_new,@command{unur_distr_cvec_new}} @end ifhtml @ifnothtml @command{unur_distr_cvec_new} @end ifnothtml call). @var{coord} is the coordinate for which the partial dervative should be computed. Notice that @var{coord} must be an integer from @{0,@dots{},dim-1@}. It is not possible to change the partial derivative of the PDF. Once the pdPDF is set it cannot be overwritten. This also holds when the partial derivative of the logPDF is given. A new distribution object has to be used instead. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cvec_set_pdpdf} @deftypefn {} {int} unur_distr_cvec_set_pdpdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCTD_CVEC* @var{pdpdf}) Set pointer to partial derivatives of the PDF. The type of this function must be @code{double funct(const double *x, int coord, UNUR_DISTR *distr)}, where @var{x} must be a pointer to a double array of appropriate size (i.e. of the same size as given to the @ifhtml @ref{funct:unur_distr_cvec_new,@command{unur_distr_cvec_new}} @end ifhtml @ifnothtml @command{unur_distr_cvec_new} @end ifnothtml call). @var{coord} is the coordinate for which the partial dervative should be computed. Notice that @var{coord} must be an integer from @{0,@dots{},dim-1@}. It is not possible to change the partial derivative of the PDF. Once the pdPDF is set it cannot be overwritten. This also holds when the partial derivative of the logPDF is given. A new distribution object has to be used instead. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cvec_get_pdf} @deftypefn Function {UNUR_FUNCT_CVEC*} unur_distr_cvec_get_pdf (const @var{UNUR_DISTR* distribution}) Get the pointer to the PDF of the @var{distribution}. The pointer is of type @code{double funct(const double *x, UNUR_DISTR *distr)}. If the corresponding function is not available for the @var{distribution}, the @code{NULL} pointer is returned. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cvec_get_pdf} @deftypefn {} {UNUR_FUNCT_CVEC*} unur_distr_cvec_get_pdf (const @var{UNUR_DISTR* distribution}) Get the pointer to the PDF of the @var{distribution}. The pointer is of type @code{double funct(const double *x, UNUR_DISTR *distr)}. If the corresponding function is not available for the @var{distribution}, the @code{NULL} pointer is returned. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cvec_get_dpdf} @deftypefn Function {UNUR_VFUNCT_CVEC*} unur_distr_cvec_get_dpdf (const @var{UNUR_DISTR* distribution}) Get the pointer to the gradient of the PDF of the @var{distribution}. The pointer is of type @code{int double funct(double *result, const double *x, UNUR_DISTR *distr)}. If the corresponding function is not available for the @var{distribution}, the @code{NULL} pointer is returned. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cvec_get_dpdf} @deftypefn {} {UNUR_VFUNCT_CVEC*} unur_distr_cvec_get_dpdf (const @var{UNUR_DISTR* distribution}) Get the pointer to the gradient of the PDF of the @var{distribution}. The pointer is of type @code{int double funct(double *result, const double *x, UNUR_DISTR *distr)}. If the corresponding function is not available for the @var{distribution}, the @code{NULL} pointer is returned. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cvec_eval_pdf} @deftypefn Function {double} unur_distr_cvec_eval_pdf (const @var{double* x}, UNUR_DISTR* @var{distribution}) Evaluate the PDF of the @var{distribution} at @var{x}. @var{x} must be a pointer to a double array of appropriate size (i.e. of the same size as given to the @ifhtml @ref{funct:unur_distr_cvec_new,@command{unur_distr_cvec_new}} @end ifhtml @ifnothtml @command{unur_distr_cvec_new} @end ifnothtml call) that contains the vector for which the function has to be evaluated. Notice that @var{distribution} must not be the @code{NULL} pointer. If the corresponding function is not available for the @var{distribution}, @code{UNUR_INFINITY} is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cvec_eval_pdf} @deftypefn {} {double} unur_distr_cvec_eval_pdf (const @var{double* x}, UNUR_DISTR* @var{distribution}) Evaluate the PDF of the @var{distribution} at @var{x}. @var{x} must be a pointer to a double array of appropriate size (i.e. of the same size as given to the @ifhtml @ref{funct:unur_distr_cvec_new,@command{unur_distr_cvec_new}} @end ifhtml @ifnothtml @command{unur_distr_cvec_new} @end ifnothtml call) that contains the vector for which the function has to be evaluated. Notice that @var{distribution} must not be the @code{NULL} pointer. If the corresponding function is not available for the @var{distribution}, @code{UNUR_INFINITY} is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cvec_eval_dpdf} @deftypefn Function {int} unur_distr_cvec_eval_dpdf (double* @var{result}, const @var{double* x}, UNUR_DISTR* @var{distribution}) Evaluate the gradient of the PDF of the @var{distribution} at @var{x}. The result is stored in the double array @var{result}. Both @var{result} and @var{x} must be pointer to double arrays of appropriate size (i.e. of the same size as given to the @ifhtml @ref{funct:unur_distr_cvec_new,@command{unur_distr_cvec_new}} @end ifhtml @ifnothtml @command{unur_distr_cvec_new} @end ifnothtml call). Notice that @var{distribution} must not be the @code{NULL} pointer. If the corresponding function is not available for the @var{distribution}, an error code is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA} (@var{result} is left unmodified). @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cvec_eval_dpdf} @deftypefn {} {int} unur_distr_cvec_eval_dpdf (double* @var{result}, const @var{double* x}, UNUR_DISTR* @var{distribution}) Evaluate the gradient of the PDF of the @var{distribution} at @var{x}. The result is stored in the double array @var{result}. Both @var{result} and @var{x} must be pointer to double arrays of appropriate size (i.e. of the same size as given to the @ifhtml @ref{funct:unur_distr_cvec_new,@command{unur_distr_cvec_new}} @end ifhtml @ifnothtml @command{unur_distr_cvec_new} @end ifnothtml call). Notice that @var{distribution} must not be the @code{NULL} pointer. If the corresponding function is not available for the @var{distribution}, an error code is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA} (@var{result} is left unmodified). @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cvec_eval_pdpdf} @deftypefn Function {double} unur_distr_cvec_eval_pdpdf (const @var{double* x}, int @var{coord}, UNUR_DISTR* @var{distribution}) Evaluate the partial derivative of the PDF of the @var{distribution} at @var{x} for the coordinate @var{coord}. @var{x} must be a pointer to a double array of appropriate size (i.e. of the same size as given to the @ifhtml @ref{funct:unur_distr_cvec_new,@command{unur_distr_cvec_new}} @end ifhtml @ifnothtml @command{unur_distr_cvec_new} @end ifnothtml call) that contains the vector for which the function has to be evaluated. Notice that @var{coord} must be an integer from @{0,@dots{},dim-1@}. Notice that @var{distribution} must not be the @code{NULL} pointer. If the corresponding function is not available for the @var{distribution}, @code{UNUR_INFINITY} is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cvec_eval_pdpdf} @deftypefn {} {double} unur_distr_cvec_eval_pdpdf (const @var{double* x}, int @var{coord}, UNUR_DISTR* @var{distribution}) Evaluate the partial derivative of the PDF of the @var{distribution} at @var{x} for the coordinate @var{coord}. @var{x} must be a pointer to a double array of appropriate size (i.e. of the same size as given to the @ifhtml @ref{funct:unur_distr_cvec_new,@command{unur_distr_cvec_new}} @end ifhtml @ifnothtml @command{unur_distr_cvec_new} @end ifnothtml call) that contains the vector for which the function has to be evaluated. Notice that @var{coord} must be an integer from @{0,@dots{},dim-1@}. Notice that @var{distribution} must not be the @code{NULL} pointer. If the corresponding function is not available for the @var{distribution}, @code{UNUR_INFINITY} is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cvec_set_logpdf} @anchor{funct:unur_distr_cvec_set_dlogpdf} @anchor{funct:unur_distr_cvec_set_pdlogpdf} @anchor{funct:unur_distr_cvec_get_logpdf} @anchor{funct:unur_distr_cvec_get_dlogpdf} @anchor{funct:unur_distr_cvec_eval_logpdf} @anchor{funct:unur_distr_cvec_eval_dlogpdf} @anchor{funct:unur_distr_cvec_eval_pdlogpdf} @deftypefn Function {int} unur_distr_cvec_set_logpdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_CVEC* @var{logpdf}) @deftypefnx Function {int} unur_distr_cvec_set_dlogpdf (UNUR_DISTR* @var{distribution}, UNUR_VFUNCT_CVEC* @var{dlogpdf}) @deftypefnx Function {int} unur_distr_cvec_set_pdlogpdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCTD_CVEC* @var{pdlogpdf}) @deftypefnx Function {UNUR_FUNCT_CVEC*} unur_distr_cvec_get_logpdf (const @var{UNUR_DISTR* distribution}) @deftypefnx Function {UNUR_VFUNCT_CVEC*} unur_distr_cvec_get_dlogpdf (const @var{UNUR_DISTR* distribution}) @deftypefnx Function {double} unur_distr_cvec_eval_logpdf (const @var{double* x}, UNUR_DISTR* @var{distribution}) @deftypefnx Function {int} unur_distr_cvec_eval_dlogpdf (double* @var{result}, const @var{double* x}, UNUR_DISTR* @var{distribution}) @deftypefnx Function {double} unur_distr_cvec_eval_pdlogpdf (const @var{double* x}, int @var{coord}, UNUR_DISTR* @var{distribution}) Analogous calls for the logarithm of the density function. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cvec_set_logpdf} @anchor{funct:unur_distr_cvec_set_dlogpdf} @anchor{funct:unur_distr_cvec_set_pdlogpdf} @anchor{funct:unur_distr_cvec_get_logpdf} @anchor{funct:unur_distr_cvec_get_dlogpdf} @anchor{funct:unur_distr_cvec_eval_logpdf} @anchor{funct:unur_distr_cvec_eval_dlogpdf} @anchor{funct:unur_distr_cvec_eval_pdlogpdf} @deftypefn {} {int} unur_distr_cvec_set_logpdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_CVEC* @var{logpdf}) @deftypefnx {} {int} unur_distr_cvec_set_dlogpdf (UNUR_DISTR* @var{distribution}, UNUR_VFUNCT_CVEC* @var{dlogpdf}) @deftypefnx {} {int} unur_distr_cvec_set_pdlogpdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCTD_CVEC* @var{pdlogpdf}) @deftypefnx {} {UNUR_FUNCT_CVEC*} unur_distr_cvec_get_logpdf (const @var{UNUR_DISTR* distribution}) @deftypefnx {} {UNUR_VFUNCT_CVEC*} unur_distr_cvec_get_dlogpdf (const @var{UNUR_DISTR* distribution}) @deftypefnx {} {double} unur_distr_cvec_eval_logpdf (const @var{double* x}, UNUR_DISTR* @var{distribution}) @deftypefnx {} {int} unur_distr_cvec_eval_dlogpdf (double* @var{result}, const @var{double* x}, UNUR_DISTR* @var{distribution}) @deftypefnx {} {double} unur_distr_cvec_eval_pdlogpdf (const @var{double* x}, int @var{coord}, UNUR_DISTR* @var{distribution}) Analogous calls for the logarithm of the density function. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cvec_set_mean} @deftypefn Function {int} unur_distr_cvec_set_mean (UNUR_DISTR* @var{distribution}, const @var{double* mean}) Set mean vector for multivariate @var{distribution}. @var{mean} must be a pointer to an array of size @code{dim}, where @code{dim} is the dimension returned by @ifhtml @ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} @end ifhtml @ifnothtml @command{unur_distr_get_dim}. @end ifnothtml A @code{NULL} pointer for @var{mean} is interpreted as the zero vector (0,@dots{},0). @strong{Important:} If the parameters of a distribution from the UNU.RAN library of standard distributions (@pxref{Stddist,,Standard distributions}) are changed, then neither its mode nor the normalization constant are updated. Please use the respective calls @ifhtml @ref{funct:unur_distr_cvec_upd_mode,@command{unur_distr_cvec_upd_mode}} @end ifhtml @ifnothtml @command{unur_distr_cvec_upd_mode} @end ifnothtml and @ifhtml @ref{funct:unur_distr_cvec_upd_pdfvol,@command{unur_distr_cvec_upd_pdfvol}.} @end ifhtml @ifnothtml @command{unur_distr_cvec_upd_pdfvol}. @end ifnothtml @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cvec_set_mean} @deftypefn {} {int} unur_distr_cvec_set_mean (UNUR_DISTR* @var{distribution}, const @var{double* mean}) Set mean vector for multivariate @var{distribution}. @var{mean} must be a pointer to an array of size @code{dim}, where @code{dim} is the dimension returned by @ifhtml @ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} @end ifhtml @ifnothtml @command{unur_distr_get_dim}. @end ifnothtml A @code{NULL} pointer for @var{mean} is interpreted as the zero vector (0,@dots{},0). @strong{Important:} If the parameters of a distribution from the UNU.RAN library of standard distributions (@pxref{Stddist,,Standard distributions}) are changed, then neither its mode nor the normalization constant are updated. Please use the respective calls @ifhtml @ref{funct:unur_distr_cvec_upd_mode,@command{unur_distr_cvec_upd_mode}} @end ifhtml @ifnothtml @command{unur_distr_cvec_upd_mode} @end ifnothtml and @ifhtml @ref{funct:unur_distr_cvec_upd_pdfvol,@command{unur_distr_cvec_upd_pdfvol}.} @end ifhtml @ifnothtml @command{unur_distr_cvec_upd_pdfvol}. @end ifnothtml @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cvec_get_mean} @deftypefn Function {const double*} unur_distr_cvec_get_mean (const @var{UNUR_DISTR* distribution}) Get the mean vector of the @var{distribution}. The function returns a pointer to an array of size @code{dim}. If the mean vector is not marked as known the @code{NULL} pointer is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_GET}. @emph{Important:} Do @strong{not} modify the array that holds the mean vector! @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cvec_get_mean} @deftypefn {} {const double*} unur_distr_cvec_get_mean (const @var{UNUR_DISTR* distribution}) Get the mean vector of the @var{distribution}. The function returns a pointer to an array of size @code{dim}. If the mean vector is not marked as known the @code{NULL} pointer is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_GET}. @emph{Important:} Do @strong{not} modify the array that holds the mean vector! @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cvec_set_covar} @deftypefn Function {int} unur_distr_cvec_set_covar (UNUR_DISTR* @var{distribution}, const @var{double* covar}) Set covariance matrix for multivariate @var{distribution}. @var{covar} must be a pointer to an array of size @code{dim} x @code{dim}, where @code{dim} is the dimension returned by @ifhtml @ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} @end ifhtml @ifnothtml @command{unur_distr_get_dim}. @end ifnothtml The rows of the matrix have to be stored consecutively in this array. @var{covar} must be a variance-covariance matrix of the @var{distribution}, i.e. it must be symmetric and positive definit and its diagonal entries (i.e. the variance of the components of the random vector) must be strictly positive. The Cholesky factor is computed (and stored) to verify the positive definiteness condition. Notice that the inverse of the given covariance matrix is automatically computed when it is requested by some routine. Notice that the computation of this inverse matrix is unstable in case of high correlations and/or high dimensions. Thus it might fail and methods that require this inverse cannot be used. As an alternative the inverse of the covariance matrix can be directly set by a @ifhtml @ref{funct:unur_distr_cvec_set_covar_inv,@command{unur_distr_cvec_set_covar_inv}} @end ifhtml @ifnothtml @command{unur_distr_cvec_set_covar_inv} @end ifnothtml call. A @code{NULL} pointer for @var{covar} is interpreted as the identity matrix. @emph{Important:} This entry is abused in some methods which do not require the covariance matrix. It is then used to perform some transformation to obtain better performance. @emph{Important:} In case of an error (e.g. because @var{covar} is not a valid covariance matrix) an error code is returned. Moreover, the covariance matrix is not set and is marked as unknown. A previously set covariance matrix is then no longer available. @strong{Important:} If the parameters of a distribution from the UNU.RAN library of standard distributions (@pxref{Stddist,,Standard distributions}) are changed, then neither its mode nor the normalization constant are updated. Please use the respective calls @ifhtml @ref{funct:unur_distr_cvec_upd_mode,@command{unur_distr_cvec_upd_mode}} @end ifhtml @ifnothtml @command{unur_distr_cvec_upd_mode} @end ifnothtml and @ifhtml @ref{funct:unur_distr_cvec_upd_pdfvol,@command{unur_distr_cvec_upd_pdfvol}.} @end ifhtml @ifnothtml @command{unur_distr_cvec_upd_pdfvol}. @end ifnothtml @emph{Remark:} UNU.RAN does not check whether the an eventually set covariance matrix and a rank-correlation matrix do not contradict each other. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cvec_set_covar} @deftypefn {} {int} unur_distr_cvec_set_covar (UNUR_DISTR* @var{distribution}, const @var{double* covar}) Set covariance matrix for multivariate @var{distribution}. @var{covar} must be a pointer to an array of size @code{dim} x @code{dim}, where @code{dim} is the dimension returned by @ifhtml @ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} @end ifhtml @ifnothtml @command{unur_distr_get_dim}. @end ifnothtml The rows of the matrix have to be stored consecutively in this array. @var{covar} must be a variance-covariance matrix of the @var{distribution}, i.e. it must be symmetric and positive definit and its diagonal entries (i.e. the variance of the components of the random vector) must be strictly positive. The Cholesky factor is computed (and stored) to verify the positive definiteness condition. Notice that the inverse of the given covariance matrix is automatically computed when it is requested by some routine. Notice that the computation of this inverse matrix is unstable in case of high correlations and/or high dimensions. Thus it might fail and methods that require this inverse cannot be used. As an alternative the inverse of the covariance matrix can be directly set by a @ifhtml @ref{funct:unur_distr_cvec_set_covar_inv,@command{unur_distr_cvec_set_covar_inv}} @end ifhtml @ifnothtml @command{unur_distr_cvec_set_covar_inv} @end ifnothtml call. A @code{NULL} pointer for @var{covar} is interpreted as the identity matrix. @emph{Important:} This entry is abused in some methods which do not require the covariance matrix. It is then used to perform some transformation to obtain better performance. @emph{Important:} In case of an error (e.g. because @var{covar} is not a valid covariance matrix) an error code is returned. Moreover, the covariance matrix is not set and is marked as unknown. A previously set covariance matrix is then no longer available. @strong{Important:} If the parameters of a distribution from the UNU.RAN library of standard distributions (@pxref{Stddist,,Standard distributions}) are changed, then neither its mode nor the normalization constant are updated. Please use the respective calls @ifhtml @ref{funct:unur_distr_cvec_upd_mode,@command{unur_distr_cvec_upd_mode}} @end ifhtml @ifnothtml @command{unur_distr_cvec_upd_mode} @end ifnothtml and @ifhtml @ref{funct:unur_distr_cvec_upd_pdfvol,@command{unur_distr_cvec_upd_pdfvol}.} @end ifhtml @ifnothtml @command{unur_distr_cvec_upd_pdfvol}. @end ifnothtml @emph{Remark:} UNU.RAN does not check whether the an eventually set covariance matrix and a rank-correlation matrix do not contradict each other. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cvec_set_covar_inv} @deftypefn Function {int} unur_distr_cvec_set_covar_inv (UNUR_DISTR* @var{distribution}, const @var{double* covar_inv}) Set inverse of the covariance matrix for multivariate @var{distribution}. @var{covar_inv} must be a pointer to an array of size @code{dim} x @code{dim}, where @code{dim} is the dimension returned by @ifhtml @ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} @end ifhtml @ifnothtml @command{unur_distr_get_dim}. @end ifnothtml The rows of the matrix have to be stored consecutively in this array. @var{covar_inv} must be symmetric and positive definit. Only the symmetry of the matrix is checked. A @code{NULL} pointer for @var{covar_inv} is interpreted as the identity matrix. @emph{Important:} In case of an error (because @var{covar_inv} is not symetric) an error code is returned. Moreover, the inverse of the covariance matrix is not set and is marked as unknown. A previously set inverse matrix is then no longer available. @emph{Remark:} UNU.RAN does not check whether the given matrix is positive definit. @emph{Remark:} UNU.RAN does not check whether the matrix @var{covar_inv} is the inverse of the eventually set covariance matrix. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cvec_set_covar_inv} @deftypefn {} {int} unur_distr_cvec_set_covar_inv (UNUR_DISTR* @var{distribution}, const @var{double* covar_inv}) Set inverse of the covariance matrix for multivariate @var{distribution}. @var{covar_inv} must be a pointer to an array of size @code{dim} x @code{dim}, where @code{dim} is the dimension returned by @ifhtml @ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} @end ifhtml @ifnothtml @command{unur_distr_get_dim}. @end ifnothtml The rows of the matrix have to be stored consecutively in this array. @var{covar_inv} must be symmetric and positive definit. Only the symmetry of the matrix is checked. A @code{NULL} pointer for @var{covar_inv} is interpreted as the identity matrix. @emph{Important:} In case of an error (because @var{covar_inv} is not symetric) an error code is returned. Moreover, the inverse of the covariance matrix is not set and is marked as unknown. A previously set inverse matrix is then no longer available. @emph{Remark:} UNU.RAN does not check whether the given matrix is positive definit. @emph{Remark:} UNU.RAN does not check whether the matrix @var{covar_inv} is the inverse of the eventually set covariance matrix. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cvec_get_covar} @anchor{funct:unur_distr_cvec_get_cholesky} @anchor{funct:unur_distr_cvec_get_covar_inv} @deftypefn Function {const double*} unur_distr_cvec_get_covar (const @var{UNUR_DISTR* distribution}) @deftypefnx Function {const double*} unur_distr_cvec_get_cholesky (const @var{UNUR_DISTR* distribution}) @deftypefnx Function {const double*} unur_distr_cvec_get_covar_inv (UNUR_DISTR* @var{distribution}) Get covariance matrix of @var{distribution}, its Cholesky factor, and its inverse, respectively. The function returns a pointer to an array of size @code{dim} x @code{dim}. The rows of the matrix are stored consecutively in this array. If the requested matrix is not marked as known the @code{NULL} pointer is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_GET}. @emph{Important:} Do @strong{not} modify the array that holds the covariance matrix! @emph{Remark:} The inverse of the covariance matrix is computed if it is not already stored. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cvec_get_covar} @anchor{funct:unur_distr_cvec_get_cholesky} @anchor{funct:unur_distr_cvec_get_covar_inv} @deftypefn {} {const double*} unur_distr_cvec_get_covar (const @var{UNUR_DISTR* distribution}) @deftypefnx {} {const double*} unur_distr_cvec_get_cholesky (const @var{UNUR_DISTR* distribution}) @deftypefnx {} {const double*} unur_distr_cvec_get_covar_inv (UNUR_DISTR* @var{distribution}) Get covariance matrix of @var{distribution}, its Cholesky factor, and its inverse, respectively. The function returns a pointer to an array of size @code{dim} x @code{dim}. The rows of the matrix are stored consecutively in this array. If the requested matrix is not marked as known the @code{NULL} pointer is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_GET}. @emph{Important:} Do @strong{not} modify the array that holds the covariance matrix! @emph{Remark:} The inverse of the covariance matrix is computed if it is not already stored. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cvec_set_rankcorr} @deftypefn Function {int} unur_distr_cvec_set_rankcorr (UNUR_DISTR* @var{distribution}, const @var{double* rankcorr}) Set rank-correlation matrix (Spearman's correlation) for multivariate @var{distribution}. @var{rankcorr} must be a pointer to an array of size @code{dim} x @code{dim}, where @code{dim} is the dimension returned by @ifhtml @ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} @end ifhtml @ifnothtml @command{unur_distr_get_dim}. @end ifnothtml The rows of the matrix have to be stored consecutively in this array. @var{rankcorr} must be a rank-correlation matrix of the @var{distribution}, i.e. it must be symmetric and positive definite and its diagonal entries must be equal to @code{1}. The Cholesky factor is computed (and stored) to verify the positive definiteness condition. A @code{NULL} pointer for @var{rankcorr} is interpreted as the identity matrix. @emph{Important:} In case of an error (e.g. because @var{rankcorr} is not a valid rank-correlation matrix) an error code is returned. Moreover, the rank-correlation matrix is not set and is marked as unknown. A previously set rank-correlation matrix is then no longer available. @emph{Remark:} UNU.RAN does not check whether the an eventually set covariance matrix and a rank-correlation matrix do not contradict each other. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cvec_set_rankcorr} @deftypefn {} {int} unur_distr_cvec_set_rankcorr (UNUR_DISTR* @var{distribution}, const @var{double* rankcorr}) Set rank-correlation matrix (Spearman's correlation) for multivariate @var{distribution}. @var{rankcorr} must be a pointer to an array of size @code{dim} x @code{dim}, where @code{dim} is the dimension returned by @ifhtml @ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} @end ifhtml @ifnothtml @command{unur_distr_get_dim}. @end ifnothtml The rows of the matrix have to be stored consecutively in this array. @var{rankcorr} must be a rank-correlation matrix of the @var{distribution}, i.e. it must be symmetric and positive definite and its diagonal entries must be equal to @code{1}. The Cholesky factor is computed (and stored) to verify the positive definiteness condition. A @code{NULL} pointer for @var{rankcorr} is interpreted as the identity matrix. @emph{Important:} In case of an error (e.g. because @var{rankcorr} is not a valid rank-correlation matrix) an error code is returned. Moreover, the rank-correlation matrix is not set and is marked as unknown. A previously set rank-correlation matrix is then no longer available. @emph{Remark:} UNU.RAN does not check whether the an eventually set covariance matrix and a rank-correlation matrix do not contradict each other. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cvec_get_rankcorr} @anchor{funct:unur_distr_cvec_get_rk_cholesky} @deftypefn Function {const double*} unur_distr_cvec_get_rankcorr (const @var{UNUR_DISTR* distribution}) @deftypefnx Function {const double*} unur_distr_cvec_get_rk_cholesky (const @var{UNUR_DISTR* distribution}) Get rank-correlation matrix and its cholesky factor, respectively, of @var{distribution}. The function returns a pointer to an array of size @code{dim} x @code{dim}. The rows of the matrix are stored consecutively in this array. If the requested matrix is not marked as known the @code{NULL} pointer is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_GET}. @emph{Important:} Do @strong{not} modify the array that holds the rank-correlation matrix! @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cvec_get_rankcorr} @anchor{funct:unur_distr_cvec_get_rk_cholesky} @deftypefn {} {const double*} unur_distr_cvec_get_rankcorr (const @var{UNUR_DISTR* distribution}) @deftypefnx {} {const double*} unur_distr_cvec_get_rk_cholesky (const @var{UNUR_DISTR* distribution}) Get rank-correlation matrix and its cholesky factor, respectively, of @var{distribution}. The function returns a pointer to an array of size @code{dim} x @code{dim}. The rows of the matrix are stored consecutively in this array. If the requested matrix is not marked as known the @code{NULL} pointer is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_GET}. @emph{Important:} Do @strong{not} modify the array that holds the rank-correlation matrix! @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cvec_set_marginals} @deftypefn Function {int} unur_distr_cvec_set_marginals (UNUR_DISTR* @var{distribution}, UNUR_DISTR* @var{marginal}) Sets marginal distributions of the given @var{distribution} to the same @var{marginal} distribution object. The @var{marginal} distribution must be an instance of a continuous univariate distribution object. Notice that the marginal distribution is copied into the @var{distribution} object. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cvec_set_marginals} @deftypefn {} {int} unur_distr_cvec_set_marginals (UNUR_DISTR* @var{distribution}, UNUR_DISTR* @var{marginal}) Sets marginal distributions of the given @var{distribution} to the same @var{marginal} distribution object. The @var{marginal} distribution must be an instance of a continuous univariate distribution object. Notice that the marginal distribution is copied into the @var{distribution} object. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cvec_set_marginal_array} @deftypefn Function {int} unur_distr_cvec_set_marginal_array (UNUR_DISTR* @var{distribution}, UNUR_DISTR** @var{marginals}) Analogously to the above @ifhtml @ref{funct:unur_distr_cvec_set_marginals,@command{unur_distr_cvec_set_marginals}} @end ifhtml @ifnothtml @command{unur_distr_cvec_set_marginals} @end ifnothtml call. However, now an array @var{marginals} of the pointers to each of the marginal distributions must be given. It @strong{must} be an array of size @code{dim}, where @code{dim} is the dimension returned by @ifhtml @ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} @end ifhtml @ifnothtml @command{unur_distr_get_dim}. @end ifnothtml @emph{Notice}: Local copies for each of the entries are stored in the @var{distribution} object. If some of these entries are identical (i.e. contain the same pointer), then for each of these a new copy is made. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cvec_set_marginal_array} @deftypefn {} {int} unur_distr_cvec_set_marginal_array (UNUR_DISTR* @var{distribution}, UNUR_DISTR** @var{marginals}) Analogously to the above @ifhtml @ref{funct:unur_distr_cvec_set_marginals,@command{unur_distr_cvec_set_marginals}} @end ifhtml @ifnothtml @command{unur_distr_cvec_set_marginals} @end ifnothtml call. However, now an array @var{marginals} of the pointers to each of the marginal distributions must be given. It @strong{must} be an array of size @code{dim}, where @code{dim} is the dimension returned by @ifhtml @ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} @end ifhtml @ifnothtml @command{unur_distr_get_dim}. @end ifnothtml @emph{Notice}: Local copies for each of the entries are stored in the @var{distribution} object. If some of these entries are identical (i.e. contain the same pointer), then for each of these a new copy is made. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cvec_set_marginal_list} @deftypefn Function {int} unur_distr_cvec_set_marginal_list (UNUR_DISTR* @var{distribution}, ...) Similar to the above @ifhtml @ref{funct:unur_distr_cvec_set_marginal_array,@command{unur_distr_cvec_set_marginal_array}} @end ifhtml @ifnothtml @command{unur_distr_cvec_set_marginal_array} @end ifnothtml call. However, now the pointers to the particular marginal distributions can be given as parameter and does not require an array of pointers. Additionally the given distribution objects are immediately destroyed. Thus calls like @ifhtml @ref{funct:unur_distr_normal,@command{unur_distr_normal}} @end ifhtml @ifnothtml @command{unur_distr_normal} @end ifnothtml can be used as arguments. (With @ifhtml @ref{funct:unur_distr_cvec_set_marginal_array,@command{unur_distr_cvec_set_marginal_array}} @end ifhtml @ifnothtml @command{unur_distr_cvec_set_marginal_array} @end ifnothtml the result of such call has to be stored in a pointer since it has to be freed afterwarts to avoid memory leaks!) The number of pointers to in the list of function arguments @strong{must} be equal to the dimension of the @var{distribution}, i.e. the dimension returned by @ifhtml @ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} @end ifhtml @ifnothtml @command{unur_distr_get_dim}. @end ifnothtml If one of the given pointer to marginal distributions is the @code{NULL} pointer then the marginal distributions of @var{distribution} are not set (or previous settings are not changed) and an error code is returned. @strong{Important:} All distribution objects given in the argument list are destroyed! @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cvec_set_marginal_list} @deftypefn {} {int} unur_distr_cvec_set_marginal_list (UNUR_DISTR* @var{distribution}, ...) Similar to the above @ifhtml @ref{funct:unur_distr_cvec_set_marginal_array,@command{unur_distr_cvec_set_marginal_array}} @end ifhtml @ifnothtml @command{unur_distr_cvec_set_marginal_array} @end ifnothtml call. However, now the pointers to the particular marginal distributions can be given as parameter and does not require an array of pointers. Additionally the given distribution objects are immediately destroyed. Thus calls like @ifhtml @ref{funct:unur_distr_normal,@command{unur_distr_normal}} @end ifhtml @ifnothtml @command{unur_distr_normal} @end ifnothtml can be used as arguments. (With @ifhtml @ref{funct:unur_distr_cvec_set_marginal_array,@command{unur_distr_cvec_set_marginal_array}} @end ifhtml @ifnothtml @command{unur_distr_cvec_set_marginal_array} @end ifnothtml the result of such call has to be stored in a pointer since it has to be freed afterwarts to avoid memory leaks!) The number of pointers to in the list of function arguments @strong{must} be equal to the dimension of the @var{distribution}, i.e. the dimension returned by @ifhtml @ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} @end ifhtml @ifnothtml @command{unur_distr_get_dim}. @end ifnothtml If one of the given pointer to marginal distributions is the @code{NULL} pointer then the marginal distributions of @var{distribution} are not set (or previous settings are not changed) and an error code is returned. @strong{Important:} All distribution objects given in the argument list are destroyed! @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cvec_get_marginal} @deftypefn Function {const UNUR_DISTR*} unur_distr_cvec_get_marginal (const @var{UNUR_DISTR* distribution}, int @var{n}) Get pointer to the @var{n}-th marginal distribution object from the given multivariate @var{distribution}. If this does not exist, @code{NULL} is returned. The marginal distributions are enumerated from @code{1} to @code{dim}, where @code{dim} is the dimension returned by @ifhtml @ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} @end ifhtml @ifnothtml @command{unur_distr_get_dim}. @end ifnothtml @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cvec_get_marginal} @deftypefn {} {const UNUR_DISTR*} unur_distr_cvec_get_marginal (const @var{UNUR_DISTR* distribution}, int @var{n}) Get pointer to the @var{n}-th marginal distribution object from the given multivariate @var{distribution}. If this does not exist, @code{NULL} is returned. The marginal distributions are enumerated from @code{1} to @code{dim}, where @code{dim} is the dimension returned by @ifhtml @ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} @end ifhtml @ifnothtml @command{unur_distr_get_dim}. @end ifnothtml @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cvec_set_pdfparams} @deftypefn Function {int} unur_distr_cvec_set_pdfparams (UNUR_DISTR* @var{distribution}, const @var{double* params}, int @var{n_params}) Sets array of parameters for @var{distribution}. There is an upper limit for the number of parameters @code{n_params}. It is given by the macro @code{UNUR_DISTR_MAXPARAMS} in @file{unuran_config.h}. (It is set to 5 by default but can be changed to any appropriate nonnegative number.) If @var{n_params} is negative or exceeds this limit no parameters are copied into the distribution object and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_NPARAMS}. For standard distributions from the UNU.RAN library the parameters are checked. Moreover, the domain is updated automatically. If the given parameters are invalid for the standard distribution, then no parameters are set and an error code is returned. Notice that the given parameter list for such a distribution is handled in the same way as in the corresponding @command{new} calls, i.e. optional parameters for the PDF that are not present in the given list are (re-)set to their default values. @strong{Important:} If the parameters of a distribution from the UNU.RAN library of standard distributions (@pxref{Stddist,,Standard distributions}) are changed, then neither its mode nor the normalization constant are updated. Please use the respective calls @ifhtml @ref{funct:unur_distr_cvec_upd_mode,@command{unur_distr_cvec_upd_mode}} @end ifhtml @ifnothtml @command{unur_distr_cvec_upd_mode} @end ifnothtml and @ifhtml @ref{funct:unur_distr_cvec_upd_pdfvol,@command{unur_distr_cvec_upd_pdfvol}.} @end ifhtml @ifnothtml @command{unur_distr_cvec_upd_pdfvol}. @end ifnothtml @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cvec_set_pdfparams} @deftypefn {} {int} unur_distr_cvec_set_pdfparams (UNUR_DISTR* @var{distribution}, const @var{double* params}, int @var{n_params}) Sets array of parameters for @var{distribution}. There is an upper limit for the number of parameters @code{n_params}. It is given by the macro @code{UNUR_DISTR_MAXPARAMS} in @file{unuran_config.h}. (It is set to 5 by default but can be changed to any appropriate nonnegative number.) If @var{n_params} is negative or exceeds this limit no parameters are copied into the distribution object and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_NPARAMS}. For standard distributions from the UNU.RAN library the parameters are checked. Moreover, the domain is updated automatically. If the given parameters are invalid for the standard distribution, then no parameters are set and an error code is returned. Notice that the given parameter list for such a distribution is handled in the same way as in the corresponding @command{new} calls, i.e. optional parameters for the PDF that are not present in the given list are (re-)set to their default values. @strong{Important:} If the parameters of a distribution from the UNU.RAN library of standard distributions (@pxref{Stddist,,Standard distributions}) are changed, then neither its mode nor the normalization constant are updated. Please use the respective calls @ifhtml @ref{funct:unur_distr_cvec_upd_mode,@command{unur_distr_cvec_upd_mode}} @end ifhtml @ifnothtml @command{unur_distr_cvec_upd_mode} @end ifnothtml and @ifhtml @ref{funct:unur_distr_cvec_upd_pdfvol,@command{unur_distr_cvec_upd_pdfvol}.} @end ifhtml @ifnothtml @command{unur_distr_cvec_upd_pdfvol}. @end ifnothtml @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cvec_get_pdfparams} @deftypefn Function {int} unur_distr_cvec_get_pdfparams (const @var{UNUR_DISTR* distribution}, const @var{double** params}) Get number of parameters of the PDF and set pointer @var{params} to array of parameters. If no parameters are stored in the object, an error code is returned and @code{params} is set to @code{NULL}. @emph{Important:} Do @strong{not} change the entries in @var{params}! @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cvec_get_pdfparams} @deftypefn {} {int} unur_distr_cvec_get_pdfparams (const @var{UNUR_DISTR* distribution}, const @var{double** params}) Get number of parameters of the PDF and set pointer @var{params} to array of parameters. If no parameters are stored in the object, an error code is returned and @code{params} is set to @code{NULL}. @emph{Important:} Do @strong{not} change the entries in @var{params}! @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cvec_set_pdfparams_vec} @deftypefn Function {int} unur_distr_cvec_set_pdfparams_vec (UNUR_DISTR* @var{distribution}, int @var{par}, const @var{double* param_vec}, int @var{n_params}) This function provides an interface for additional vector parameters for a multivariate @var{distribution} besides mean vector and covariance matrix which have their own calls. It sets the parameter with number @var{par}. @var{par} indicates directly which of the parameters is set and must be a number between @code{0} and @code{UNUR_DISTR_MAXPARAMS}-1 (the upper limit of possible parameters defined in @file{unuran_config.h}; it is set to 5 but can be changed to any appropriate nonnegative number.) The entries of a this parameter are given by the array @var{param_vec} of size @var{n_params}. Notice that using this interface an An (@i{n} x @i{m})-matrix has to be stored in an array of length @var{n_params} = @i{n} times @i{m}; where the rows of the matrix are stored consecutively in this array. Due to great variety of possible parameters for a multivariate @var{distribution} there is no simpler interface. If @var{param_vec} is @code{NULL} then the corresponding entry is cleared. @strong{Important:} If the parameters of a distribution from the UNU.RAN library of standard distributions (@pxref{Stddist,,Standard distributions}) are changed, then neither its mode nor the normalization constant are updated. Please use the respective calls @ifhtml @ref{funct:unur_distr_cvec_upd_mode,@command{unur_distr_cvec_upd_mode}} @end ifhtml @ifnothtml @command{unur_distr_cvec_upd_mode} @end ifnothtml and @ifhtml @ref{funct:unur_distr_cvec_upd_pdfvol,@command{unur_distr_cvec_upd_pdfvol}.} @end ifhtml @ifnothtml @command{unur_distr_cvec_upd_pdfvol}. @end ifnothtml If an error occurs no parameters are copied into the parameter object @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cvec_set_pdfparams_vec} @deftypefn {} {int} unur_distr_cvec_set_pdfparams_vec (UNUR_DISTR* @var{distribution}, int @var{par}, const @var{double* param_vec}, int @var{n_params}) This function provides an interface for additional vector parameters for a multivariate @var{distribution} besides mean vector and covariance matrix which have their own calls. It sets the parameter with number @var{par}. @var{par} indicates directly which of the parameters is set and must be a number between @code{0} and @code{UNUR_DISTR_MAXPARAMS}-1 (the upper limit of possible parameters defined in @file{unuran_config.h}; it is set to 5 but can be changed to any appropriate nonnegative number.) The entries of a this parameter are given by the array @var{param_vec} of size @var{n_params}. Notice that using this interface an An (@i{n} x @i{m})-matrix has to be stored in an array of length @var{n_params} = @i{n} times @i{m}; where the rows of the matrix are stored consecutively in this array. Due to great variety of possible parameters for a multivariate @var{distribution} there is no simpler interface. If @var{param_vec} is @code{NULL} then the corresponding entry is cleared. @strong{Important:} If the parameters of a distribution from the UNU.RAN library of standard distributions (@pxref{Stddist,,Standard distributions}) are changed, then neither its mode nor the normalization constant are updated. Please use the respective calls @ifhtml @ref{funct:unur_distr_cvec_upd_mode,@command{unur_distr_cvec_upd_mode}} @end ifhtml @ifnothtml @command{unur_distr_cvec_upd_mode} @end ifnothtml and @ifhtml @ref{funct:unur_distr_cvec_upd_pdfvol,@command{unur_distr_cvec_upd_pdfvol}.} @end ifhtml @ifnothtml @command{unur_distr_cvec_upd_pdfvol}. @end ifnothtml If an error occurs no parameters are copied into the parameter object @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cvec_get_pdfparams_vec} @deftypefn Function {int} unur_distr_cvec_get_pdfparams_vec (const @var{UNUR_DISTR* distribution}, int @var{par}, const @var{double** param_vecs}) Get parameter of the PDF with number @var{par}. The pointer to the parameter array is stored in @var{param_vecs}, its size is returned by the function. If the requested parameter is not set, then an error code is returned and @code{params} is set to @code{NULL}. @emph{Important:} Do @strong{not} change the entries in @var{param_vecs}! @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cvec_get_pdfparams_vec} @deftypefn {} {int} unur_distr_cvec_get_pdfparams_vec (const @var{UNUR_DISTR* distribution}, int @var{par}, const @var{double** param_vecs}) Get parameter of the PDF with number @var{par}. The pointer to the parameter array is stored in @var{param_vecs}, its size is returned by the function. If the requested parameter is not set, then an error code is returned and @code{params} is set to @code{NULL}. @emph{Important:} Do @strong{not} change the entries in @var{param_vecs}! @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cvec_set_domain_rect} @deftypefn Function {int} unur_distr_cvec_set_domain_rect (UNUR_DISTR* @var{distribution}, const @var{double* lowerleft}, const @var{double* upperright}) Set rectangular domain for @var{distribution} with @var{lowerleft} and @var{upperright} vertices. Both must be pointer to an array of the size returned by @ifhtml @ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} @end ifhtml @ifnothtml @command{unur_distr_get_dim}. @end ifnothtml A @code{NULL} pointer is interpreted as the zero vector (0,@dots{},0). For setting a coordinate of the boundary to @math{+/- infinity} use @code{+/- UNUR_INFINITY}. The @var{lowerleft} vertex must be strictly smaller than @var{upperright} in each component. Otherwise no domain is set and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_SET}. By default the domain of a distribution is unbounded. Thus one can use this call to truncate an existing distribution. @emph{Important:} Changing the domain of @var{distribution} marks derived parameters like the mode or the center as unknown and must be set @emph{after} changing the domain. This is important for the already set (or default) value for the center does not fall into the given domain. Notice that calls of the PDF and derived functions return @code{0.} when the parameter is not contained in the domain. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cvec_set_domain_rect} @deftypefn {} {int} unur_distr_cvec_set_domain_rect (UNUR_DISTR* @var{distribution}, const @var{double* lowerleft}, const @var{double* upperright}) Set rectangular domain for @var{distribution} with @var{lowerleft} and @var{upperright} vertices. Both must be pointer to an array of the size returned by @ifhtml @ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} @end ifhtml @ifnothtml @command{unur_distr_get_dim}. @end ifnothtml A @code{NULL} pointer is interpreted as the zero vector (0,@dots{},0). For setting a coordinate of the boundary to @iftex @math{\pm\infty} @end iftex @ifhtml @html +/- infinity @end html @end ifhtml use @code{+/- UNUR_INFINITY}. The @var{lowerleft} vertex must be strictly smaller than @var{upperright} in each component. Otherwise no domain is set and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_SET}. By default the domain of a distribution is unbounded. Thus one can use this call to truncate an existing distribution. @emph{Important:} Changing the domain of @var{distribution} marks derived parameters like the mode or the center as unknown and must be set @emph{after} changing the domain. This is important for the already set (or default) value for the center does not fall into the given domain. Notice that calls of the PDF and derived functions return @code{0.} when the parameter is not contained in the domain. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cvec_is_indomain} @deftypefn Function {int} unur_distr_cvec_is_indomain (const @var{double* x}, const @var{UNUR_DISTR* distribution}) Check whether @var{x} falls into the domain of @var{distribution}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cvec_is_indomain} @deftypefn {} {int} unur_distr_cvec_is_indomain (const @var{double* x}, const @var{UNUR_DISTR* distribution}) Check whether @var{x} falls into the domain of @var{distribution}. @end deftypefn @end ifnotinfo @subsubheading Derived parameters The following paramters @strong{must} be set whenever one of the essential parameters has been set or changed (and the parameter is required for the chosen method). @ifinfo @anchor{funct:unur_distr_cvec_set_mode} @deftypefn Function {int} unur_distr_cvec_set_mode (UNUR_DISTR* @var{distribution}, const @var{double* mode}) Set mode of the @var{distribution}. @var{mode} must be a pointer to an array of the size returned by @ifhtml @ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} @end ifhtml @ifnothtml @command{unur_distr_get_dim}. @end ifnothtml A @code{NULL} pointer for @var{mode} is interpreted as the zero vector (0,@dots{},0). @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cvec_set_mode} @deftypefn {} {int} unur_distr_cvec_set_mode (UNUR_DISTR* @var{distribution}, const @var{double* mode}) Set mode of the @var{distribution}. @var{mode} must be a pointer to an array of the size returned by @ifhtml @ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} @end ifhtml @ifnothtml @command{unur_distr_get_dim}. @end ifnothtml A @code{NULL} pointer for @var{mode} is interpreted as the zero vector (0,@dots{},0). @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cvec_upd_mode} @deftypefn Function {int} unur_distr_cvec_upd_mode (UNUR_DISTR* @var{distribution}) Recompute the mode of the @var{distribution}. This call works properly for distribution objects from the UNU.RAN library of standard distributions when the corresponding function is available. If it failes @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cvec_upd_mode} @deftypefn {} {int} unur_distr_cvec_upd_mode (UNUR_DISTR* @var{distribution}) Recompute the mode of the @var{distribution}. This call works properly for distribution objects from the UNU.RAN library of standard distributions when the corresponding function is available. If it failes @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cvec_get_mode} @deftypefn Function {const double*} unur_distr_cvec_get_mode (UNUR_DISTR* @var{distribution}) Get mode of the @var{distribution}. The function returns a pointer to an array of the size returned by @ifhtml @ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} @end ifhtml @ifnothtml @command{unur_distr_get_dim}. @end ifnothtml If the mode is not marked as known the @code{NULL} pointer is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_GET}. (There is no difference between the case where no routine for computing the mode is available and the case where no mode exists for the @var{distribution} at all.) @emph{Important:} Do @strong{not} modify the array that holds the mode! @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cvec_get_mode} @deftypefn {} {const double*} unur_distr_cvec_get_mode (UNUR_DISTR* @var{distribution}) Get mode of the @var{distribution}. The function returns a pointer to an array of the size returned by @ifhtml @ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} @end ifhtml @ifnothtml @command{unur_distr_get_dim}. @end ifnothtml If the mode is not marked as known the @code{NULL} pointer is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_GET}. (There is no difference between the case where no routine for computing the mode is available and the case where no mode exists for the @var{distribution} at all.) @emph{Important:} Do @strong{not} modify the array that holds the mode! @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cvec_set_center} @deftypefn Function {int} unur_distr_cvec_set_center (UNUR_DISTR* @var{distribution}, const @var{double* center}) Set center of the @var{distribution}. @var{center} must be a pointer to an array of the size returned by @ifhtml @ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} @end ifhtml @ifnothtml @command{unur_distr_get_dim}. @end ifnothtml A @code{NULL} pointer for @var{center} is interpreted as the zero vector (0,@dots{},0). The center is used by some methods to shift the distribution in order to decrease numerical round-off error. If not given explicitly a default is used. Moreover, it is used as starting point for several numerical search algorithm (e.g. for the mode). Then @var{center} must be a pointer where the call to the PDF returns a non-zero value. In particular @var{center} must contained in the domain of the distribution. Default: The mode, if given by a @ifhtml @ref{funct:unur_distr_cvec_set_mode,@command{unur_distr_cvec_set_mode}} @end ifhtml @ifnothtml @command{unur_distr_cvec_set_mode} @end ifnothtml call; else the mean, if given by a @ifhtml @ref{funct:unur_distr_cvec_set_mean,@command{unur_distr_cvec_set_mean}} @end ifhtml @ifnothtml @command{unur_distr_cvec_set_mean} @end ifnothtml call; otherwise the null vector (0,@dots{},0). @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cvec_set_center} @deftypefn {} {int} unur_distr_cvec_set_center (UNUR_DISTR* @var{distribution}, const @var{double* center}) Set center of the @var{distribution}. @var{center} must be a pointer to an array of the size returned by @ifhtml @ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} @end ifhtml @ifnothtml @command{unur_distr_get_dim}. @end ifnothtml A @code{NULL} pointer for @var{center} is interpreted as the zero vector (0,@dots{},0). The center is used by some methods to shift the distribution in order to decrease numerical round-off error. If not given explicitly a default is used. Moreover, it is used as starting point for several numerical search algorithm (e.g. for the mode). Then @var{center} must be a pointer where the call to the PDF returns a non-zero value. In particular @var{center} must contained in the domain of the distribution. Default: The mode, if given by a @ifhtml @ref{funct:unur_distr_cvec_set_mode,@command{unur_distr_cvec_set_mode}} @end ifhtml @ifnothtml @command{unur_distr_cvec_set_mode} @end ifnothtml call; else the mean, if given by a @ifhtml @ref{funct:unur_distr_cvec_set_mean,@command{unur_distr_cvec_set_mean}} @end ifhtml @ifnothtml @command{unur_distr_cvec_set_mean} @end ifnothtml call; otherwise the null vector (0,@dots{},0). @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cvec_get_center} @deftypefn Function {const double*} unur_distr_cvec_get_center (UNUR_DISTR* @var{distribution}) Get center of the @var{distribution}. The function returns a pointer to an array of the size returned by @ifhtml @ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} @end ifhtml @ifnothtml @command{unur_distr_get_dim}. @end ifnothtml It always returns some point as there always exists a default for the center, see @ifhtml @ref{funct:unur_distr_cvec_set_center,@command{unur_distr_cvec_set_center}.} @end ifhtml @ifnothtml @command{unur_distr_cvec_set_center}. @end ifnothtml @emph{Important:} Do @strong{not} modify the array that holds the center! @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cvec_get_center} @deftypefn {} {const double*} unur_distr_cvec_get_center (UNUR_DISTR* @var{distribution}) Get center of the @var{distribution}. The function returns a pointer to an array of the size returned by @ifhtml @ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} @end ifhtml @ifnothtml @command{unur_distr_get_dim}. @end ifnothtml It always returns some point as there always exists a default for the center, see @ifhtml @ref{funct:unur_distr_cvec_set_center,@command{unur_distr_cvec_set_center}.} @end ifhtml @ifnothtml @command{unur_distr_cvec_set_center}. @end ifnothtml @emph{Important:} Do @strong{not} modify the array that holds the center! @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cvec_set_pdfvol} @deftypefn Function {int} unur_distr_cvec_set_pdfvol (UNUR_DISTR* @var{distribution}, double @var{volume}) Set the volume below the PDF. If @var{vol} is non-positive, no volume is set and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_SET}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cvec_set_pdfvol} @deftypefn {} {int} unur_distr_cvec_set_pdfvol (UNUR_DISTR* @var{distribution}, double @var{volume}) Set the volume below the PDF. If @var{vol} is non-positive, no volume is set and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_SET}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cvec_upd_pdfvol} @deftypefn Function {int} unur_distr_cvec_upd_pdfvol (UNUR_DISTR* @var{distribution}) Recompute the volume below the PDF of the distribution. It only works for distribution objects from the UNU.RAN library of standard distributions when the corresponding function is available. Otherwise @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. This call also sets the normalization constant such that the given PDF is the derivative of a given CDF, i.e. the volume is 1. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cvec_upd_pdfvol} @deftypefn {} {int} unur_distr_cvec_upd_pdfvol (UNUR_DISTR* @var{distribution}) Recompute the volume below the PDF of the distribution. It only works for distribution objects from the UNU.RAN library of standard distributions when the corresponding function is available. Otherwise @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. This call also sets the normalization constant such that the given PDF is the derivative of a given CDF, i.e. the volume is 1. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cvec_get_pdfvol} @deftypefn Function {double} unur_distr_cvec_get_pdfvol (UNUR_DISTR* @var{distribution}) Get the volume below the PDF of the @var{distribution}. If this volume is not known,@* @ifhtml @ref{funct:unur_distr_cont_upd_pdfarea,@command{unur_distr_cont_upd_pdfarea}} @end ifhtml @ifnothtml @command{unur_distr_cont_upd_pdfarea} @end ifnothtml is called to compute it. If this is not successful @code{UNUR_INFINITY} is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_GET}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cvec_get_pdfvol} @deftypefn {} {double} unur_distr_cvec_get_pdfvol (UNUR_DISTR* @var{distribution}) Get the volume below the PDF of the @var{distribution}. If this volume is not known,@* @ifhtml @ref{funct:unur_distr_cont_upd_pdfarea,@command{unur_distr_cont_upd_pdfarea}} @end ifhtml @ifnothtml @command{unur_distr_cont_upd_pdfarea} @end ifnothtml is called to compute it. If this is not successful @code{UNUR_INFINITY} is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_GET}. @end deftypefn @end ifnotinfo @c @c end of cvec.h @c ------------------------------------- @c ------------------------------------- @c condi.h @c @page @node CONDI @section Continuous univariate full conditional distribution Full conditional distribution for a given continuous multivariate distributiion. The condition is a position vector and either a variable that is variated or a vector that indicates the direction on which the random vector can variate. There is a subtle difference between using direction vector and using the @var{k}-th variable. When a direction vector is given the PDF of the conditional distribution is defined by @iftex @math{f(t) = PDF(pos + t\cdot dir).} @end iftex @ifhtml @html f(t) = PDF(pos + t * dir). @end html @end ifhtml @ifinfo @math{f(t) = PDF(pos + t * dir).} @end ifinfo When a variable is selected the full conditional distribution with all other variables fixed is used. This is a special case of a continuous univariate distribution and thus they have most of these parameters (with the exception that functions cannot be changed). Additionally, @itemize @minus @item there is a call to extract the underlying multivariate distribution, @item and a call to handle the variables that are fixed and the direction for changing the random vector. @end itemize This distibution type is primarily used for evaluation the conditional distribution and its derivative (as required for, e.g., the Gibbs sampler). The density is not normalized (i.e. does not integrate to one). Mode and area are not available and it does not make sense to use any call to set or change parameters except the ones given below. @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_distr_condi_new,unur_distr_condi_new} @item @ref{funct:unur_distr_condi_set_condition,unur_distr_condi_set_condition} @item @ref{funct:unur_distr_condi_get_condition,unur_distr_condi_get_condition} @item @ref{funct:unur_distr_condi_get_distribution,unur_distr_condi_get_distribution} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_distr_condi_new} @deftypefn Function {UNUR_DISTR*} unur_distr_condi_new (const @var{UNUR_DISTR* distribution}, const @var{double* pos}, const @var{double* dir}, int @var{k}) Create an object for full conditional distribution for the given @var{distribution}. The condition is given by a position vector @var{pos} and either the @var{k}-th variable that is variated or the vector @var{dir} that contains the direction on which the random vector can variate. @var{distribution} must be a pointer to a multivariate continuous distribution. @var{pos} must be a pointer to an array of size @code{dim}, where @code{dim} is the dimension of the underlying distribution object. @var{dir} must be a pointer to an array if size @code{dim} or @code{NULL}. @var{k} must be in the range @code{0, @dots{}, dim-1}. If the @var{k}-th variable is used, @var{dir} must be set to @code{NULL}. @emph{Notice:} There is a subtle difference between using direction vector @var{dir} and using the @var{k}-th variable. When @var{dir} is given, the current position @var{pos} is mapped into 0 of the conditional distribution and the derivative is taken from the function PDF(@var{pos}+t*@var{dir}) w.r.t. @i{t}. On the other hand, when the coordinate @var{k} is used (i.e., when @var{dir} is set to @code{NULL}), the full conditional distribution of the distribution is considered (as used for the Gibbs sampler). In particular, the current point is just projected into the one-dimensional subspace without mapping it into the point 0. @emph{Notice:} If a coordinate @var{k} is used, then the @var{k}-th partial derivative is used if it as available. Otherwise the gradient is computed and the @var{k}-th component is returned. The resulting generator object is of the same type as of a @ifhtml @ref{funct:unur_distr_cont_new,@command{unur_distr_cont_new}} @end ifhtml @ifnothtml @command{unur_distr_cont_new} @end ifnothtml call. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_condi_new} @deftypefn {} {UNUR_DISTR*} unur_distr_condi_new (const @var{UNUR_DISTR* distribution}, const @var{double* pos}, const @var{double* dir}, int @var{k}) Create an object for full conditional distribution for the given @var{distribution}. The condition is given by a position vector @var{pos} and either the @var{k}-th variable that is variated or the vector @var{dir} that contains the direction on which the random vector can variate. @var{distribution} must be a pointer to a multivariate continuous distribution. @var{pos} must be a pointer to an array of size @code{dim}, where @code{dim} is the dimension of the underlying distribution object. @var{dir} must be a pointer to an array if size @code{dim} or @code{NULL}. @var{k} must be in the range @code{0, @dots{}, dim-1}. If the @var{k}-th variable is used, @var{dir} must be set to @code{NULL}. @emph{Notice:} There is a subtle difference between using direction vector @var{dir} and using the @var{k}-th variable. When @var{dir} is given, the current position @var{pos} is mapped into 0 of the conditional distribution and the derivative is taken from the function PDF(@var{pos}+t*@var{dir}) w.r.t. @i{t}. On the other hand, when the coordinate @var{k} is used (i.e., when @var{dir} is set to @code{NULL}), the full conditional distribution of the distribution is considered (as used for the Gibbs sampler). In particular, the current point is just projected into the one-dimensional subspace without mapping it into the point 0. @emph{Notice:} If a coordinate @var{k} is used, then the @var{k}-th partial derivative is used if it as available. Otherwise the gradient is computed and the @var{k}-th component is returned. The resulting generator object is of the same type as of a @ifhtml @ref{funct:unur_distr_cont_new,@command{unur_distr_cont_new}} @end ifhtml @ifnothtml @command{unur_distr_cont_new} @end ifnothtml call. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_condi_set_condition} @deftypefn Function {int} unur_distr_condi_set_condition (struct @var{unur_distr* distribution}, const @var{double* pos}, const @var{double* dir}, int @var{k}) Set/change condition for conditional @var{distribution}. Change values of fixed variables to @var{pos} and use direction @var{dir} or @var{k}-th variable of conditional @var{distribution}. @var{pos} must be a pointer to an array of size @code{dim}, where @code{dim} is the dimension of the underlying distribution object. @var{dir} must be a pointer to an array if size @code{dim} or @code{NULL}. @var{k} must be in the range @code{0, @dots{}, dim-1}. If the @var{k}-th variable is used, @var{dir} must be set to @code{NULL}. @emph{Notice:} There is a subtle difference between using direction vector @var{dir} and using the @var{k}-th variable. When @var{dir} is given, the current position @var{pos} is mapped into 0 of the conditional distribution and the derivative is taken from the function PDF(@var{pos}+t*@var{dir}) w.r.t. @i{t}. On the other hand, when the coordinate @var{k} is used (i.e., when @var{dir} is set to @code{NULL}), the full conditional distribution of the distribution is considered (as used for the Gibbs sampler). In particular, the current point is just projected into the one-dimensional subspace without mapping it into the point 0. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_condi_set_condition} @deftypefn {} {int} unur_distr_condi_set_condition (struct @var{unur_distr* distribution}, const @var{double* pos}, const @var{double* dir}, int @var{k}) Set/change condition for conditional @var{distribution}. Change values of fixed variables to @var{pos} and use direction @var{dir} or @var{k}-th variable of conditional @var{distribution}. @var{pos} must be a pointer to an array of size @code{dim}, where @code{dim} is the dimension of the underlying distribution object. @var{dir} must be a pointer to an array if size @code{dim} or @code{NULL}. @var{k} must be in the range @code{0, @dots{}, dim-1}. If the @var{k}-th variable is used, @var{dir} must be set to @code{NULL}. @emph{Notice:} There is a subtle difference between using direction vector @var{dir} and using the @var{k}-th variable. When @var{dir} is given, the current position @var{pos} is mapped into 0 of the conditional distribution and the derivative is taken from the function PDF(@var{pos}+t*@var{dir}) w.r.t. @i{t}. On the other hand, when the coordinate @var{k} is used (i.e., when @var{dir} is set to @code{NULL}), the full conditional distribution of the distribution is considered (as used for the Gibbs sampler). In particular, the current point is just projected into the one-dimensional subspace without mapping it into the point 0. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_condi_get_condition} @deftypefn Function {int} unur_distr_condi_get_condition (struct @var{unur_distr* distribution}, const @var{double** pos}, const @var{double** dir}, int* @var{k}) Get condition for conditional @var{distribution}. The values for the fixed variables are stored in @var{pos}, which must be a pointer to an array of size @code{dim}. The condition is stored in @var{dir} and @var{k}, respectively. @emph{Important:} Do @strong{not} change the entries in @var{pos} and @var{dir}! @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_condi_get_condition} @deftypefn {} {int} unur_distr_condi_get_condition (struct @var{unur_distr* distribution}, const @var{double** pos}, const @var{double** dir}, int* @var{k}) Get condition for conditional @var{distribution}. The values for the fixed variables are stored in @var{pos}, which must be a pointer to an array of size @code{dim}. The condition is stored in @var{dir} and @var{k}, respectively. @emph{Important:} Do @strong{not} change the entries in @var{pos} and @var{dir}! @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_condi_get_distribution} @deftypefn Function {const UNUR_DISTR*} unur_distr_condi_get_distribution (const @var{UNUR_DISTR* distribution}) Get pointer to distribution object for underlying distribution. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_condi_get_distribution} @deftypefn {} {const UNUR_DISTR*} unur_distr_condi_get_distribution (const @var{UNUR_DISTR* distribution}) Get pointer to distribution object for underlying distribution. @end deftypefn @end ifnotinfo @c @c end of condi.h @c ------------------------------------- @c ------------------------------------- @c cvemp.h @c @page @node CVEMP @section Continuous empirical multivariate distributions Empirical multivariate distributions are just lists of vectors (with the same dimension). Thus there are only calls to insert these data. How these data are used to sample from the empirical distribution depends from the chosen generation method. @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_distr_cvemp_new,unur_distr_cvemp_new} @item @ref{funct:unur_distr_cvemp_set_data,unur_distr_cvemp_set_data} @item @ref{funct:unur_distr_cvemp_read_data,unur_distr_cvemp_read_data} @item @ref{funct:unur_distr_cvemp_get_data,unur_distr_cvemp_get_data} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_distr_cvemp_new} @deftypefn Function {UNUR_DISTR*} unur_distr_cvemp_new (int @var{dim}) Create a new (empty) object for an empirical multivariate continuous distribution. @var{dim} is the number of components of the random vector (i.e. its dimension). It must be at least 2; otherwise @ifhtml @ref{funct:unur_distr_cemp_new,@command{unur_distr_cemp_new}} @end ifhtml @ifnothtml @command{unur_distr_cemp_new} @end ifnothtml should be used to create an object for an empirical univariate distribution. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cvemp_new} @deftypefn {} {UNUR_DISTR*} unur_distr_cvemp_new (int @var{dim}) Create a new (empty) object for an empirical multivariate continuous distribution. @var{dim} is the number of components of the random vector (i.e. its dimension). It must be at least 2; otherwise @ifhtml @ref{funct:unur_distr_cemp_new,@command{unur_distr_cemp_new}} @end ifhtml @ifnothtml @command{unur_distr_cemp_new} @end ifnothtml should be used to create an object for an empirical univariate distribution. @end deftypefn @end ifnotinfo @subsubheading Essential parameters @ifinfo @anchor{funct:unur_distr_cvemp_set_data} @deftypefn Function {int} unur_distr_cvemp_set_data (UNUR_DISTR* @var{distribution}, const @var{double* sample}, int @var{n_sample}) Set observed sample for empirical @var{distribution}. @var{sample} is an array of doubles of size @code{dim} x @var{n_sample}, where @code{dim} is the dimension of the @var{distribution} returned by @ifhtml @ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} @end ifhtml @ifnothtml @command{unur_distr_get_dim}. @end ifnothtml The data points must be stored consecutively in @var{sample}, i.e., data points (x1, y1), (x2, y2), @dots{} are given as an array @{x1, y1, x2, y2, @dots{}@}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cvemp_set_data} @deftypefn {} {int} unur_distr_cvemp_set_data (UNUR_DISTR* @var{distribution}, const @var{double* sample}, int @var{n_sample}) Set observed sample for empirical @var{distribution}. @var{sample} is an array of doubles of size @code{dim} x @var{n_sample}, where @code{dim} is the dimension of the @var{distribution} returned by @ifhtml @ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} @end ifhtml @ifnothtml @command{unur_distr_get_dim}. @end ifnothtml The data points must be stored consecutively in @var{sample}, i.e., data points (x1, y1), (x2, y2), @dots{} are given as an array @{x1, y1, x2, y2, @dots{}@}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cvemp_read_data} @deftypefn Function {int} unur_distr_cvemp_read_data (UNUR_DISTR* @var{distribution}, const @var{char* filename}) Read data from file @file{filename}. It reads the first @code{dim} numbers from each line, where @code{dim} is the dimension of the @var{distribution} returned by @ifhtml @ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} @end ifhtml @ifnothtml @command{unur_distr_get_dim}. @end ifnothtml Numbers are parsed by means of the C standard routine @command{strtod}. Lines that do not start with @code{+}, @code{-}, @code{.}, or a digit are ignored. (Beware of lines starting with a blank!) In case of an error (file cannot be opened, too few entries in a line, invalid string for double in line) no data are copied into the distribution object and an error code is returned. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cvemp_read_data} @deftypefn {} {int} unur_distr_cvemp_read_data (UNUR_DISTR* @var{distribution}, const @var{char* filename}) Read data from file @file{filename}. It reads the first @code{dim} numbers from each line, where @code{dim} is the dimension of the @var{distribution} returned by @ifhtml @ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}.} @end ifhtml @ifnothtml @command{unur_distr_get_dim}. @end ifnothtml Numbers are parsed by means of the C standard routine @command{strtod}. Lines that do not start with @code{+}, @code{-}, @code{.}, or a digit are ignored. (Beware of lines starting with a blank!) In case of an error (file cannot be opened, too few entries in a line, invalid string for double in line) no data are copied into the distribution object and an error code is returned. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_cvemp_get_data} @deftypefn Function {int} unur_distr_cvemp_get_data (const @var{UNUR_DISTR* distribution}, const @var{double** sample}) Get number of samples and set pointer @var{sample} to array of observations. If no sample has been given, an error code is returned and @var{sample} is set to @code{NULL}. If successful @var{sample} points to an array of length @code{dim} x @code{n_sample}, where @code{dim} is the dimension of the distribution returned by @ifhtml @ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}} @end ifhtml @ifnothtml @command{unur_distr_get_dim} @end ifnothtml and @code{n_sample} the return value of the function. @emph{Important:} Do @strong{not} modify the array @var{sample}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_cvemp_get_data} @deftypefn {} {int} unur_distr_cvemp_get_data (const @var{UNUR_DISTR* distribution}, const @var{double** sample}) Get number of samples and set pointer @var{sample} to array of observations. If no sample has been given, an error code is returned and @var{sample} is set to @code{NULL}. If successful @var{sample} points to an array of length @code{dim} x @code{n_sample}, where @code{dim} is the dimension of the distribution returned by @ifhtml @ref{funct:unur_distr_get_dim,@command{unur_distr_get_dim}} @end ifhtml @ifnothtml @command{unur_distr_get_dim} @end ifnothtml and @code{n_sample} the return value of the function. @emph{Important:} Do @strong{not} modify the array @var{sample}. @end deftypefn @end ifnotinfo @c @c end of cvemp.h @c ------------------------------------- @c ------------------------------------- @c matr.h @c @page @node MATR @section MATRix distributions Distributions for random matrices. Notice that UNU.RAN uses arrays of @code{double}s to handle matrices. The rows of the matrix are stored consecutively. @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_distr_matr_new,unur_distr_matr_new} @item @ref{funct:unur_distr_matr_get_dim,unur_distr_matr_get_dim} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_distr_matr_new} @deftypefn Function {UNUR_DISTR*} unur_distr_matr_new (int @var{n_rows}, int @var{n_cols}) Create a new (empty) object for a matrix distribution. @var{n_rows} and @var{n_cols} are the respective numbers of rows and columns of the random matrix (i.e. its dimensions). It is also possible to have only one number or rows and/or columns. Notice, however, that this is treated as a distribution of random matrices with only one row or column or component and not as a distribution of vectors or real numbers. For the latter @ifhtml @ref{funct:unur_distr_cont_new,@command{unur_distr_cont_new}} @end ifhtml @ifnothtml @command{unur_distr_cont_new} @end ifnothtml or @ifhtml @ref{funct:unur_distr_cvec_new,@command{unur_distr_cvec_new}} @end ifhtml @ifnothtml @command{unur_distr_cvec_new} @end ifnothtml should be used to create an object for a univariate distribution and a multivariate (vector) distribution, respectively. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_matr_new} @deftypefn {} {UNUR_DISTR*} unur_distr_matr_new (int @var{n_rows}, int @var{n_cols}) Create a new (empty) object for a matrix distribution. @var{n_rows} and @var{n_cols} are the respective numbers of rows and columns of the random matrix (i.e. its dimensions). It is also possible to have only one number or rows and/or columns. Notice, however, that this is treated as a distribution of random matrices with only one row or column or component and not as a distribution of vectors or real numbers. For the latter @ifhtml @ref{funct:unur_distr_cont_new,@command{unur_distr_cont_new}} @end ifhtml @ifnothtml @command{unur_distr_cont_new} @end ifnothtml or @ifhtml @ref{funct:unur_distr_cvec_new,@command{unur_distr_cvec_new}} @end ifhtml @ifnothtml @command{unur_distr_cvec_new} @end ifnothtml should be used to create an object for a univariate distribution and a multivariate (vector) distribution, respectively. @end deftypefn @end ifnotinfo @subsubheading Essential parameters @ifinfo @anchor{funct:unur_distr_matr_get_dim} @deftypefn Function {int} unur_distr_matr_get_dim (const @var{UNUR_DISTR* distribution}, int* @var{n_rows}, int* @var{n_cols}) Get number of rows and columns of random matrix (its dimension). It returns the total number of components. If successfull @code{UNUR_SUCCESS} is returned. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_matr_get_dim} @deftypefn {} {int} unur_distr_matr_get_dim (const @var{UNUR_DISTR* distribution}, int* @var{n_rows}, int* @var{n_cols}) Get number of rows and columns of random matrix (its dimension). It returns the total number of components. If successfull @code{UNUR_SUCCESS} is returned. @end deftypefn @end ifnotinfo @c @c end of matr.h @c ------------------------------------- @c ------------------------------------- @c discr.h @c @page @node DISCR @section Discrete univariate distributions The calls in this section can be applied to discrete univariate distributions. @itemize @minus @item Create a @command{new} instance of a discrete univariate distribution. @item Handle and evaluate distribution function (CDF, @command{cdf}) and probability mass function (PMF, @command{pmf}). The following is important: @itemize . @item @command{pmf} need not be normalized, i.e., any summable nonnegative function on the set of intergers can be used. @item @command{cdf} must be a distribution function, i.e. it must be monotonically increasing with range [0,1]. @item If @command{cdf} and @command{pdf} are used together for a pariticular generation method, then @command{pmf} must be normalized, i.e. it must sum to 1. @end itemize @item Alternatively, @command{cdf} and @command{pdf} can be provided as @command{str}ings instead of function pointers. @item Some generation methods require a (finite) probability vector (PV, @command{pv}), i.e. an array of @code{double}s. It can be automatically computed if the @command{pmf} is given but @command{pv} is not. @item Set (and change) parameters (@command{pmfparams}) and the total sum (@command{pmfsum}) of the given PMF or PV. @item Set the @command{mode} of the distribution. @item Set the @command{domain} of the distribution. @end itemize @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_distr_discr_new,unur_distr_discr_new} @item @ref{funct:unur_distr_discr_set_pv,unur_distr_discr_set_pv} @item @ref{funct:unur_distr_discr_make_pv,unur_distr_discr_make_pv} @item @ref{funct:unur_distr_discr_get_pv,unur_distr_discr_get_pv} @item @ref{funct:unur_distr_discr_set_pmf,unur_distr_discr_set_pmf} @item @ref{funct:unur_distr_discr_set_cdf,unur_distr_discr_set_cdf} @item @ref{funct:unur_distr_discr_set_invcdf,unur_distr_discr_set_invcdf} @item @ref{funct:unur_distr_discr_eval_pv,unur_distr_discr_eval_pv} @item @ref{funct:unur_distr_discr_eval_pmf,unur_distr_discr_eval_pmf} @item @ref{funct:unur_distr_discr_eval_cdf,unur_distr_discr_eval_cdf} @item @ref{funct:unur_distr_discr_eval_invcdf,unur_distr_discr_eval_invcdf} @item @ref{funct:unur_distr_discr_set_pmfstr,unur_distr_discr_set_pmfstr} @item @ref{funct:unur_distr_discr_set_cdfstr,unur_distr_discr_set_cdfstr} @item @ref{funct:unur_distr_discr_get_pmfstr,unur_distr_discr_get_pmfstr} @item @ref{funct:unur_distr_discr_get_cdfstr,unur_distr_discr_get_cdfstr} @item @ref{funct:unur_distr_discr_set_pmfparams,unur_distr_discr_set_pmfparams} @item @ref{funct:unur_distr_discr_get_pmfparams,unur_distr_discr_get_pmfparams} @item @ref{funct:unur_distr_discr_set_domain,unur_distr_discr_set_domain} @item @ref{funct:unur_distr_discr_get_domain,unur_distr_discr_get_domain} @item @ref{funct:unur_distr_discr_set_mode,unur_distr_discr_set_mode} @item @ref{funct:unur_distr_discr_upd_mode,unur_distr_discr_upd_mode} @item @ref{funct:unur_distr_discr_get_mode,unur_distr_discr_get_mode} @item @ref{funct:unur_distr_discr_set_pmfsum,unur_distr_discr_set_pmfsum} @item @ref{funct:unur_distr_discr_upd_pmfsum,unur_distr_discr_upd_pmfsum} @item @ref{funct:unur_distr_discr_get_pmfsum,unur_distr_discr_get_pmfsum} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_distr_discr_new} @deftypefn Function {UNUR_DISTR*} unur_distr_discr_new (void) Create a new (empty) object for a univariate discrete distribution. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_discr_new} @deftypefn {} {UNUR_DISTR*} unur_distr_discr_new (void) Create a new (empty) object for a univariate discrete distribution. @end deftypefn @end ifnotinfo @subsubheading Essential parameters There are two interfaces for discrete univariate distributions: Either provide a (finite) probability vector (PV). Or provide a probability mass function (PMF). For the latter case there are also a couple of derived parameters that are not required when a PV is given. It is not possible to set both a PMF and a PV directly. However, the PV can be computed from the PMF (or the CDF if no PMF is available) by means of a @ifhtml @ref{funct:unur_distr_discr_make_pv,@command{unur_distr_discr_make_pv}} @end ifhtml @ifnothtml @command{unur_distr_discr_make_pv} @end ifnothtml call. If both the PV and the PMF are given in the distribution object it depends on the generation method which of these is used. @ifinfo @anchor{funct:unur_distr_discr_set_pv} @deftypefn Function {int} unur_distr_discr_set_pv (UNUR_DISTR* @var{distribution}, const @var{double* pv}, int @var{n_pv}) Set finite probability vector (PV) for the @var{distribution}. It is not necessary that the entries in the given PV sum to 1. @var{n_pv} must be positive. However, there is no testing whether all entries in @var{pv} are non-negative. If no domain has been set, then the left boundary is set to @code{0}, by default. If @var{n_pv} is too large, e.g. because left boundary + @var{n_pv} exceeds the range of integers, then the call fails. Notice that it is not possible to set both a PV and a PMF or CDF. If the PMF or CDF is set first one cannot set the PV. If the PMF or CDF is set first after a PV is set, the latter is removed (and recomputed using @ifhtml @ref{funct:unur_distr_discr_make_pv,@command{unur_distr_discr_make_pv}} @end ifhtml @ifnothtml @command{unur_distr_discr_make_pv} @end ifnothtml when required). @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_discr_set_pv} @deftypefn {} {int} unur_distr_discr_set_pv (UNUR_DISTR* @var{distribution}, const @var{double* pv}, int @var{n_pv}) Set finite probability vector (PV) for the @var{distribution}. It is not necessary that the entries in the given PV sum to 1. @var{n_pv} must be positive. However, there is no testing whether all entries in @var{pv} are non-negative. If no domain has been set, then the left boundary is set to @code{0}, by default. If @var{n_pv} is too large, e.g. because left boundary + @var{n_pv} exceeds the range of integers, then the call fails. Notice that it is not possible to set both a PV and a PMF or CDF. If the PMF or CDF is set first one cannot set the PV. If the PMF or CDF is set first after a PV is set, the latter is removed (and recomputed using @ifhtml @ref{funct:unur_distr_discr_make_pv,@command{unur_distr_discr_make_pv}} @end ifhtml @ifnothtml @command{unur_distr_discr_make_pv} @end ifnothtml when required). @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_discr_make_pv} @deftypefn Function {int} unur_distr_discr_make_pv (UNUR_DISTR* @var{distribution}) Compute a PV when a PMF or CDF is given. However, when the domain is not given or is too large and the sum over the PMF is given then the (right) tail of the @var{distribution} is chopped off such that the probability for the tail region is less than 1.e-8. If the sum over the PMF is not given a PV of maximal length is computed. The maximal size of the created PV is bounded by the macro @code{UNUR_MAX_AUTO_PV} that is defined in @file{unuran_config.h}. If successful, the length of the generated PV is returned. If the sum over the PMF on the chopped tail is not neglible small (i.e. greater than 1.e-8 or unknown) than the negative of the length of the PV is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_SET}. Notice that the left boundary of the PV is set to @code{0} by default when a discrete distribution object is created from scratch. If computing a PV fails for some reasons, an error code is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_SET}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_discr_make_pv} @deftypefn {} {int} unur_distr_discr_make_pv (UNUR_DISTR* @var{distribution}) Compute a PV when a PMF or CDF is given. However, when the domain is not given or is too large and the sum over the PMF is given then the (right) tail of the @var{distribution} is chopped off such that the probability for the tail region is less than 1.e-8. If the sum over the PMF is not given a PV of maximal length is computed. The maximal size of the created PV is bounded by the macro @code{UNUR_MAX_AUTO_PV} that is defined in @file{unuran_config.h}. If successful, the length of the generated PV is returned. If the sum over the PMF on the chopped tail is not neglible small (i.e. greater than 1.e-8 or unknown) than the negative of the length of the PV is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_SET}. Notice that the left boundary of the PV is set to @code{0} by default when a discrete distribution object is created from scratch. If computing a PV fails for some reasons, an error code is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_SET}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_discr_get_pv} @deftypefn Function {int} unur_distr_discr_get_pv (const @var{UNUR_DISTR* distribution}, const @var{double** pv}) Get length of PV of the @var{distribution} and set pointer @var{pv} to array of probabilities. If no PV is given, an error code is returned and @var{pv} is set to @code{NULL}.@* (It does not call @ifhtml @ref{funct:unur_distr_discr_make_pv,@command{unur_distr_discr_make_pv}} @end ifhtml @ifnothtml @command{unur_distr_discr_make_pv} @end ifnothtml !) @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_discr_get_pv} @deftypefn {} {int} unur_distr_discr_get_pv (const @var{UNUR_DISTR* distribution}, const @var{double** pv}) Get length of PV of the @var{distribution} and set pointer @var{pv} to array of probabilities. If no PV is given, an error code is returned and @var{pv} is set to @code{NULL}.@* (It does not call @ifhtml @ref{funct:unur_distr_discr_make_pv,@command{unur_distr_discr_make_pv}} @end ifhtml @ifnothtml @command{unur_distr_discr_make_pv} @end ifnothtml !) @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_discr_set_pmf} @anchor{funct:unur_distr_discr_set_cdf} @deftypefn Function {int} unur_distr_discr_set_pmf (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_DISCR* @var{pmf}) @deftypefnx Function {int} unur_distr_discr_set_cdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_DISCR* @var{cdf}) Set respective pointer to the PMF and the CDF of the @var{distribution}. These functions must be of type @code{double funct(int k, const UNUR_DISTR *distr)}. It is important to note that all these functions must return a result for all integers @var{k}. E.g., if the domain of a given PMF is the interval @{1,2,3,@dots{},100@}, than the given function must return @code{0.0} for all points outside this interval. The default domain for the PMF or CDF is [@code{0}, @code{INT_MAX}]. The domain can be changed using a @ifhtml @ref{funct:unur_distr_discr_set_domain,@command{unur_distr_discr_set_domain}} @end ifhtml @ifnothtml @command{unur_distr_discr_set_domain} @end ifnothtml call. It is not possible to change such a function. Once the PMF or CDF is set it cannot be overwritten. A new distribution object has to be used instead. Notice that it is not possible to set both a PV and a PMF or CDF. If the PMF or CDF is set first one cannot set the PV. If the PMF or CDF is set first after a PV is set, the latter is removed (and recomputed using @ifhtml @ref{funct:unur_distr_discr_make_pv,@command{unur_distr_discr_make_pv}} @end ifhtml @ifnothtml @command{unur_distr_discr_make_pv} @end ifnothtml when required). @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_discr_set_pmf} @anchor{funct:unur_distr_discr_set_cdf} @deftypefn {} {int} unur_distr_discr_set_pmf (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_DISCR* @var{pmf}) @deftypefnx {} {int} unur_distr_discr_set_cdf (UNUR_DISTR* @var{distribution}, UNUR_FUNCT_DISCR* @var{cdf}) Set respective pointer to the PMF and the CDF of the @var{distribution}. These functions must be of type @code{double funct(int k, const UNUR_DISTR *distr)}. It is important to note that all these functions must return a result for all integers @var{k}. E.g., if the domain of a given PMF is the interval @{1,2,3,@dots{},100@}, than the given function must return @code{0.0} for all points outside this interval. The default domain for the PMF or CDF is [@code{0}, @code{INT_MAX}]. The domain can be changed using a @ifhtml @ref{funct:unur_distr_discr_set_domain,@command{unur_distr_discr_set_domain}} @end ifhtml @ifnothtml @command{unur_distr_discr_set_domain} @end ifnothtml call. It is not possible to change such a function. Once the PMF or CDF is set it cannot be overwritten. A new distribution object has to be used instead. Notice that it is not possible to set both a PV and a PMF or CDF. If the PMF or CDF is set first one cannot set the PV. If the PMF or CDF is set first after a PV is set, the latter is removed (and recomputed using @ifhtml @ref{funct:unur_distr_discr_make_pv,@command{unur_distr_discr_make_pv}} @end ifhtml @ifnothtml @command{unur_distr_discr_make_pv} @end ifnothtml when required). @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_discr_set_invcdf} @deftypefn Function {int} unur_distr_discr_set_invcdf (UNUR_DISTR* @var{distribution}, UNUR_IFUNCT_DISCR* @var{invcdf}) Set inverse CDF of the @var{distribution}. @var{invcdf} must be a pointer must be of type @code{int funct(double x, const UNUR_DISTR *distr)}, i.e., it should return a @code{double}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_discr_set_invcdf} @deftypefn {} {int} unur_distr_discr_set_invcdf (UNUR_DISTR* @var{distribution}, UNUR_IFUNCT_DISCR* @var{invcdf}) Set inverse CDF of the @var{distribution}. @var{invcdf} must be a pointer must be of type @code{int funct(double x, const UNUR_DISTR *distr)}, i.e., it should return a @code{double}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_discr_eval_pv} @anchor{funct:unur_distr_discr_eval_pmf} @anchor{funct:unur_distr_discr_eval_cdf} @deftypefn Function {double} unur_distr_discr_eval_pv (int @var{k}, const @var{UNUR_DISTR* distribution}) @deftypefnx Function {double} unur_distr_discr_eval_pmf (int @var{k}, const @var{UNUR_DISTR* distribution}) @deftypefnx Function {double} unur_distr_discr_eval_cdf (int @var{k}, const @var{UNUR_DISTR* distribution}) Evaluate the PV, PMF, and the CDF, respectively, at k. Notice that @var{distribution} must not be the @code{NULL} pointer. If no PV is set for the @var{distribution}, then @ifhtml @ref{funct:unur_distr_discr_eval_pv,@command{unur_distr_discr_eval_pv}} @end ifhtml @ifnothtml @command{unur_distr_discr_eval_pv} @end ifnothtml behaves like @ifhtml @ref{funct:unur_distr_discr_eval_pmf,@command{unur_distr_discr_eval_pmf}.} @end ifhtml @ifnothtml @command{unur_distr_discr_eval_pmf}. @end ifnothtml If the corresponding function is not available for the @var{distribution}, @code{UNUR_INFINITY} is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. @emph{IMPORTANT:} In the case of a truncated standard distribution these calls always return the respective values of the @emph{untruncated} distribution! @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_discr_eval_pv} @anchor{funct:unur_distr_discr_eval_pmf} @anchor{funct:unur_distr_discr_eval_cdf} @deftypefn {} {double} unur_distr_discr_eval_pv (int @var{k}, const @var{UNUR_DISTR* distribution}) @deftypefnx {} {double} unur_distr_discr_eval_pmf (int @var{k}, const @var{UNUR_DISTR* distribution}) @deftypefnx {} {double} unur_distr_discr_eval_cdf (int @var{k}, const @var{UNUR_DISTR* distribution}) Evaluate the PV, PMF, and the CDF, respectively, at k. Notice that @var{distribution} must not be the @code{NULL} pointer. If no PV is set for the @var{distribution}, then @ifhtml @ref{funct:unur_distr_discr_eval_pv,@command{unur_distr_discr_eval_pv}} @end ifhtml @ifnothtml @command{unur_distr_discr_eval_pv} @end ifnothtml behaves like @ifhtml @ref{funct:unur_distr_discr_eval_pmf,@command{unur_distr_discr_eval_pmf}.} @end ifhtml @ifnothtml @command{unur_distr_discr_eval_pmf}. @end ifnothtml If the corresponding function is not available for the @var{distribution}, @code{UNUR_INFINITY} is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. @emph{IMPORTANT:} In the case of a truncated standard distribution these calls always return the respective values of the @emph{untruncated} distribution! @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_discr_eval_invcdf} @deftypefn Function {int} unur_distr_discr_eval_invcdf (double @var{u}, const @var{UNUR_DISTR* distribution}) Evaluate the inverse CDF at @var{u}. Notice that @var{distribution} must not be the @code{NULL} pointer. If the corresponding function is not available for the distribution, @code{INT_MAX} is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. @emph{IMPORTANT:} In the case of a truncated standard distribution these calls always return the respective values of the @emph{untruncated} distribution! @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_discr_eval_invcdf} @deftypefn {} {int} unur_distr_discr_eval_invcdf (double @var{u}, const @var{UNUR_DISTR* distribution}) Evaluate the inverse CDF at @var{u}. Notice that @var{distribution} must not be the @code{NULL} pointer. If the corresponding function is not available for the distribution, @code{INT_MAX} is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. @emph{IMPORTANT:} In the case of a truncated standard distribution these calls always return the respective values of the @emph{untruncated} distribution! @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_discr_set_pmfstr} @deftypefn Function {int} unur_distr_discr_set_pmfstr (UNUR_DISTR* @var{distribution}, const @var{char* pmfstr}) This function provides an alternative way to set a PMF of the @var{distribution}. @var{pmfstr} is a character string that contains the formula for the PMF, see @ref{StringFunct,,Function String}, for details. See also the remarks for the @ifhtml @ref{funct:unur_distr_discr_set_pmf,@command{unur_distr_discr_set_pmf}} @end ifhtml @ifnothtml @command{unur_distr_discr_set_pmf} @end ifnothtml call. It is not possible to call this funtion twice or to call this function after a @ifhtml @ref{funct:unur_distr_discr_set_pmf,@command{unur_distr_discr_set_pmf}} @end ifhtml @ifnothtml @command{unur_distr_discr_set_pmf} @end ifnothtml call. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_discr_set_pmfstr} @deftypefn {} {int} unur_distr_discr_set_pmfstr (UNUR_DISTR* @var{distribution}, const @var{char* pmfstr}) This function provides an alternative way to set a PMF of the @var{distribution}. @var{pmfstr} is a character string that contains the formula for the PMF, see @ref{StringFunct,,Function String}, for details. See also the remarks for the @ifhtml @ref{funct:unur_distr_discr_set_pmf,@command{unur_distr_discr_set_pmf}} @end ifhtml @ifnothtml @command{unur_distr_discr_set_pmf} @end ifnothtml call. It is not possible to call this funtion twice or to call this function after a @ifhtml @ref{funct:unur_distr_discr_set_pmf,@command{unur_distr_discr_set_pmf}} @end ifhtml @ifnothtml @command{unur_distr_discr_set_pmf} @end ifnothtml call. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_discr_set_cdfstr} @deftypefn Function {int} unur_distr_discr_set_cdfstr (UNUR_DISTR* @var{distribution}, const @var{char* cdfstr}) This function provides an alternative way to set a CDF; analogously to the @ifhtml @ref{funct:unur_distr_discr_set_pmfstr,@command{unur_distr_discr_set_pmfstr}} @end ifhtml @ifnothtml @command{unur_distr_discr_set_pmfstr} @end ifnothtml call. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_discr_set_cdfstr} @deftypefn {} {int} unur_distr_discr_set_cdfstr (UNUR_DISTR* @var{distribution}, const @var{char* cdfstr}) This function provides an alternative way to set a CDF; analogously to the @ifhtml @ref{funct:unur_distr_discr_set_pmfstr,@command{unur_distr_discr_set_pmfstr}} @end ifhtml @ifnothtml @command{unur_distr_discr_set_pmfstr} @end ifnothtml call. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_discr_get_pmfstr} @anchor{funct:unur_distr_discr_get_cdfstr} @deftypefn Function {char*} unur_distr_discr_get_pmfstr (const @var{UNUR_DISTR* distribution}) @deftypefnx Function {char*} unur_distr_discr_get_cdfstr (const @var{UNUR_DISTR* distribution}) Get pointer to respective string for PMF and CDF of @var{distribution} that is given via the string interface. This call allocates memory to produce this string. It should be freed when it is not used any more. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_discr_get_pmfstr} @anchor{funct:unur_distr_discr_get_cdfstr} @deftypefn {} {char*} unur_distr_discr_get_pmfstr (const @var{UNUR_DISTR* distribution}) @deftypefnx {} {char*} unur_distr_discr_get_cdfstr (const @var{UNUR_DISTR* distribution}) Get pointer to respective string for PMF and CDF of @var{distribution} that is given via the string interface. This call allocates memory to produce this string. It should be freed when it is not used any more. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_discr_set_pmfparams} @deftypefn Function {int} unur_distr_discr_set_pmfparams (UNUR_DISTR* @var{distribution}, const @var{double* params}, int @var{n_params}) Set array of parameters for @var{distribution}. There is an upper limit for the number of parameters @var{n_params}. It is given by the macro @code{UNUR_DISTR_MAXPARAMS} in @file{unuran_config.h}. (It is set to 5 but can be changed to any appropriate nonnegative number.) If @var{n_params} is negative or exceeds this limit no parameters are copied into the @var{distribution} object and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_NPARAMS}. For standard distributions from the UNU.RAN library the parameters are checked. Moreover, the domain is updated automatically unless it has been changed before by a @ifhtml @ref{funct:unur_distr_discr_set_domain,@command{unur_distr_discr_set_domain}} @end ifhtml @ifnothtml @command{unur_distr_discr_set_domain} @end ifnothtml call. If the given parameters are invalid for the standard distribution, then no parameters are set and an error code is returned. Notice that the given parameter list for such a distribution is handled in the same way as in the corresponding @command{new} calls, i.e. optional parameters for the PDF that are not present in the given list are (re-)set to their default values. @emph{Important:} Integer parameter must be given as @code{double}s. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_discr_set_pmfparams} @deftypefn {} {int} unur_distr_discr_set_pmfparams (UNUR_DISTR* @var{distribution}, const @var{double* params}, int @var{n_params}) Set array of parameters for @var{distribution}. There is an upper limit for the number of parameters @var{n_params}. It is given by the macro @code{UNUR_DISTR_MAXPARAMS} in @file{unuran_config.h}. (It is set to 5 but can be changed to any appropriate nonnegative number.) If @var{n_params} is negative or exceeds this limit no parameters are copied into the @var{distribution} object and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_NPARAMS}. For standard distributions from the UNU.RAN library the parameters are checked. Moreover, the domain is updated automatically unless it has been changed before by a @ifhtml @ref{funct:unur_distr_discr_set_domain,@command{unur_distr_discr_set_domain}} @end ifhtml @ifnothtml @command{unur_distr_discr_set_domain} @end ifnothtml call. If the given parameters are invalid for the standard distribution, then no parameters are set and an error code is returned. Notice that the given parameter list for such a distribution is handled in the same way as in the corresponding @command{new} calls, i.e. optional parameters for the PDF that are not present in the given list are (re-)set to their default values. @emph{Important:} Integer parameter must be given as @code{double}s. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_discr_get_pmfparams} @deftypefn Function {int} unur_distr_discr_get_pmfparams (const @var{UNUR_DISTR* distribution}, const @var{double** params}) Get number of parameters of the PMF and set pointer @var{params} to array of parameters. If no parameters are stored in the object, an error code is returned and @code{params} is set to @code{NULL}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_discr_get_pmfparams} @deftypefn {} {int} unur_distr_discr_get_pmfparams (const @var{UNUR_DISTR* distribution}, const @var{double** params}) Get number of parameters of the PMF and set pointer @var{params} to array of parameters. If no parameters are stored in the object, an error code is returned and @code{params} is set to @code{NULL}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_discr_set_domain} @deftypefn Function {int} unur_distr_discr_set_domain (UNUR_DISTR* @var{distribution}, int @var{left}, int @var{right}) Set the left and right borders of the domain of the @var{distribution}. This can also be used to truncate an existing distribution. For setting the boundary to @math{+/- infinity} use @code{INT_MIN} and @code{INT_MAX}, respectively. If @var{right} is not strictly greater than @var{left} no domain is set and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_SET}. It is allowed to use this call to increase the domain. If the PV of the discrete distribution is used, than the right boudary is ignored (and internally set to @var{left} + size of PV @math{- 1}). Notice that @code{INT_MIN} and @code{INT_MAX} are interpreted as (minus/plus) infinity. Default: [@code{0}, @code{INT_MAX}]. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_discr_set_domain} @deftypefn {} {int} unur_distr_discr_set_domain (UNUR_DISTR* @var{distribution}, int @var{left}, int @var{right}) Set the left and right borders of the domain of the @var{distribution}. This can also be used to truncate an existing distribution. For setting the boundary to @iftex @math{\pm\infty} @end iftex @ifhtml @html +/- infinity @end html @end ifhtml use @code{INT_MIN} and @code{INT_MAX}, respectively. If @var{right} is not strictly greater than @var{left} no domain is set and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_SET}. It is allowed to use this call to increase the domain. If the PV of the discrete distribution is used, than the right boudary is ignored (and internally set to @var{left} + size of PV @math{- 1}). Notice that @code{INT_MIN} and @code{INT_MAX} are interpreted as (minus/plus) infinity. Default: [@code{0}, @code{INT_MAX}]. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_discr_get_domain} @deftypefn Function {int} unur_distr_discr_get_domain (const @var{UNUR_DISTR* distribution}, int* @var{left}, int* @var{right}) Get the left and right borders of the domain of the @var{distribution}. If the domain is not set explicitly the interval [@code{INT_MIN}, @code{INT_MAX}] is assumed and returned. When a PV is given then the domain is set automatically to [@code{0},size of PV @math{- 1}]. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_discr_get_domain} @deftypefn {} {int} unur_distr_discr_get_domain (const @var{UNUR_DISTR* distribution}, int* @var{left}, int* @var{right}) Get the left and right borders of the domain of the @var{distribution}. If the domain is not set explicitly the interval [@code{INT_MIN}, @code{INT_MAX}] is assumed and returned. When a PV is given then the domain is set automatically to [@code{0},size of PV @math{- 1}]. @end deftypefn @end ifnotinfo @subsubheading Derived parameters The following paramters @strong{must} be set whenever one of the essential parameters has been set or changed (and the parameter is required for the chosen method). @ifinfo @anchor{funct:unur_distr_discr_set_mode} @deftypefn Function {int} unur_distr_discr_set_mode (UNUR_DISTR* @var{distribution}, int @var{mode}) Set mode of @var{distribution}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_discr_set_mode} @deftypefn {} {int} unur_distr_discr_set_mode (UNUR_DISTR* @var{distribution}, int @var{mode}) Set mode of @var{distribution}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_discr_upd_mode} @deftypefn Function {int} unur_distr_discr_upd_mode (UNUR_DISTR* @var{distribution}) Recompute the mode of the @var{distribution}. This call works properly for distribution objects from the UNU.RAN library of standard distributions when the corresponding function is available. Otherwise a (slow) numerical mode finder is used. It only works properly for unimodal probability mass functions. If it failes @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_discr_upd_mode} @deftypefn {} {int} unur_distr_discr_upd_mode (UNUR_DISTR* @var{distribution}) Recompute the mode of the @var{distribution}. This call works properly for distribution objects from the UNU.RAN library of standard distributions when the corresponding function is available. Otherwise a (slow) numerical mode finder is used. It only works properly for unimodal probability mass functions. If it failes @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_discr_get_mode} @deftypefn Function {int} unur_distr_discr_get_mode (UNUR_DISTR* @var{distribution}) Get mode of @var{distribution}. If the mode is not marked as known, @ifhtml @ref{funct:unur_distr_discr_upd_mode,@command{unur_distr_discr_upd_mode}} @end ifhtml @ifnothtml @command{unur_distr_discr_upd_mode} @end ifnothtml is called to compute the mode. If this is not successful @code{INT_MAX} is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_GET}. (There is no difference between the case where no routine for computing the mode is available and the case where no mode exists for the distribution at all.) @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_discr_get_mode} @deftypefn {} {int} unur_distr_discr_get_mode (UNUR_DISTR* @var{distribution}) Get mode of @var{distribution}. If the mode is not marked as known, @ifhtml @ref{funct:unur_distr_discr_upd_mode,@command{unur_distr_discr_upd_mode}} @end ifhtml @ifnothtml @command{unur_distr_discr_upd_mode} @end ifnothtml is called to compute the mode. If this is not successful @code{INT_MAX} is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_GET}. (There is no difference between the case where no routine for computing the mode is available and the case where no mode exists for the distribution at all.) @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_discr_set_pmfsum} @deftypefn Function {int} unur_distr_discr_set_pmfsum (UNUR_DISTR* @var{distribution}, double @var{sum}) Set the sum over the PMF. If @code{sum} is non-positive, no sum is set and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_SET}. For a distribution object created by the UNU.RAN library of standard distributions you always should use the @ifhtml @ref{funct:unur_distr_discr_upd_pmfsum,@command{unur_distr_discr_upd_pmfsum}.} @end ifhtml @ifnothtml @command{unur_distr_discr_upd_pmfsum}. @end ifnothtml Otherwise there might be ambiguous side-effects. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_discr_set_pmfsum} @deftypefn {} {int} unur_distr_discr_set_pmfsum (UNUR_DISTR* @var{distribution}, double @var{sum}) Set the sum over the PMF. If @code{sum} is non-positive, no sum is set and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_SET}. For a distribution object created by the UNU.RAN library of standard distributions you always should use the @ifhtml @ref{funct:unur_distr_discr_upd_pmfsum,@command{unur_distr_discr_upd_pmfsum}.} @end ifhtml @ifnothtml @command{unur_distr_discr_upd_pmfsum}. @end ifnothtml Otherwise there might be ambiguous side-effects. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_discr_upd_pmfsum} @deftypefn Function {int} unur_distr_discr_upd_pmfsum (UNUR_DISTR* @var{distribution}) Recompute the sum over the PMF of the @var{distribution}. In most cases the normalization constant is recomputed and thus the sum is 1. This call works for distribution objects from the UNU.RAN library of standard distributions when the corresponding function is available. When a PV, a PMF with finite domain, or a CDF is given, a simple generic function which uses a naive summation loop is used. If this computation is not possible, an error code is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. The call does not work for distributions from the UNU.RAN library of standard distributions with truncated domain when the CDF is not available. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_discr_upd_pmfsum} @deftypefn {} {int} unur_distr_discr_upd_pmfsum (UNUR_DISTR* @var{distribution}) Recompute the sum over the PMF of the @var{distribution}. In most cases the normalization constant is recomputed and thus the sum is 1. This call works for distribution objects from the UNU.RAN library of standard distributions when the corresponding function is available. When a PV, a PMF with finite domain, or a CDF is given, a simple generic function which uses a naive summation loop is used. If this computation is not possible, an error code is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. The call does not work for distributions from the UNU.RAN library of standard distributions with truncated domain when the CDF is not available. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_distr_discr_get_pmfsum} @deftypefn Function {double} unur_distr_discr_get_pmfsum (UNUR_DISTR* @var{distribution}) Get the sum over the PMF of the @var{distribution}. If this sum is not known, @ifhtml @ref{funct:unur_distr_discr_upd_pmfsum,@command{unur_distr_discr_upd_pmfsum}} @end ifhtml @ifnothtml @command{unur_distr_discr_upd_pmfsum} @end ifnothtml is called to compute it. If this is not successful @code{UNUR_INFINITY} is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_GET}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_distr_discr_get_pmfsum} @deftypefn {} {double} unur_distr_discr_get_pmfsum (UNUR_DISTR* @var{distribution}) Get the sum over the PMF of the @var{distribution}. If this sum is not known, @ifhtml @ref{funct:unur_distr_discr_upd_pmfsum,@command{unur_distr_discr_upd_pmfsum}} @end ifhtml @ifnothtml @command{unur_distr_discr_upd_pmfsum} @end ifnothtml is called to compute it. If this is not successful @code{UNUR_INFINITY} is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_GET}. @end deftypefn @end ifnotinfo @c @c end of discr.h @c ------------------------------------- @c ------------------------------------- @c methods.dh @c @node Methods @chapter Methods for generating non-uniform random variates @menu * Methods_all:: Routines for all generator objects * AUTO:: Select method automatically * Methods_for_CONT:: Methods for continuous univariate distributions * Methods_for_CEMP:: Methods for continuous empirical univariate distributions * Methods_for_CVEC:: Methods for continuous multivariate distributions * MCMC_Methods_for_CVEC:: Markov chain samplers for continuous multivariate distributions * Methods_for_CVEMP:: Methods for continuous empirical multivariate distributions * Methods_for_DISCR:: Methods for discrete univariate distributions * Methods_for_MATR:: Methods for random matrices * Methods_for_UNID:: Methods for uniform univariate distributions * Meta_Methods:: Meta Methods for univariate distributions @end menu Sampling from a particular distribution with UNU.RAN requires the following steps: @enumerate @item Create a distribution object (@pxref{Distribution_objects,,Handling distribution objects}). @item Select a method and create a parameter object. @item Initizialize the generator object using @ifhtml @ref{funct:unur_init,@command{unur_init}.} @end ifhtml @ifnothtml @command{unur_init}. @end ifnothtml @emph{Important}: Initialization of the generator object might fail. @ifhtml @ref{funct:unur_init,@command{unur_init}} @end ifhtml @ifnothtml @command{unur_init} @end ifnothtml returns a @code{NULL} pointer then, which @strong{must} not be used for sampling. @item Draw a sample from the generator object using the corresponding sampling function (depending on the type of distribution: univariate continuous, univariate discrete, multivariate continuous, and random matrix). @item It is possible for a generator object to change the parameters and the domain of the underlying distribution. This must be done by extracting this object by means of a @ifhtml @ref{funct:unur_get_distr,@command{unur_get_distr}} @end ifhtml @ifnothtml @command{unur_get_distr} @end ifnothtml call and changing the distribution using the correspondig set calls, see @ref{Distribution_objects,,Handling distribution objects}. The generator object @strong{must} then be reinitialized by means of the @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml call. @emph{Important}: Currently not all methods allow reinitialization, see the description of the particular method (keyword @i{Reinit}). @emph{Important}: Reinitialization of the generator object might fail. Thus one @strong{must} check the return code of the @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml call. @emph{Important}: When reinitialization fails then sampling routines always return @code{UNUR_INFINITY} (for continuous distributions) or @code{0} (for discrete distributions), respectively. However, it is still possible to change the underlying distribution and try to reinitialize again. @end enumerate @c @c end of methods.dh @c ------------------------------------- @c ------------------------------------- @c x_gen.h @c @node Methods_all @section Routines for all generator objects Routines for all generator objects. @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_init,unur_init} @item @ref{funct:unur_reinit,unur_reinit} @item @ref{funct:unur_sample_discr,unur_sample_discr} @item @ref{funct:unur_sample_cont,unur_sample_cont} @item @ref{funct:unur_sample_vec,unur_sample_vec} @item @ref{funct:unur_sample_matr,unur_sample_matr} @item @ref{funct:unur_quantile,unur_quantile} @item @ref{funct:unur_free,unur_free} @item @ref{funct:unur_gen_info,unur_gen_info} @item @ref{funct:unur_get_dimension,unur_get_dimension} @item @ref{funct:unur_get_genid,unur_get_genid} @item @ref{funct:unur_get_method,unur_get_method} @item @ref{funct:unur_gen_is_inversion,unur_gen_is_inversion} @item @ref{funct:unur_get_distr,unur_get_distr} @item @ref{funct:unur_set_use_distr_privatecopy,unur_set_use_distr_privatecopy} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_init} @deftypefn Function {UNUR_GEN*} unur_init (UNUR_PAR* @var{parameters}) Initialize a generator object. All necessary information must be stored in the parameter object. @strong{Important:} If an error has occurred a @code{NULL} pointer is return. This must not be used for the sampling routines (this causes a segmentation fault). @strong{Always} check whether the call was successful or not! @emph{Important:} This call destroys the @var{parameter} object automatically. Thus it is not necessary/allowed to free it. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_init} @deftypefn {} {UNUR_GEN*} unur_init (UNUR_PAR* @var{parameters}) Initialize a generator object. All necessary information must be stored in the parameter object. @strong{Important:} If an error has occurred a @code{NULL} pointer is return. This must not be used for the sampling routines (this causes a segmentation fault). @strong{Always} check whether the call was successful or not! @emph{Important:} This call destroys the @var{parameter} object automatically. Thus it is not necessary/allowed to free it. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_reinit} @deftypefn Function {int} unur_reinit (UNUR_GEN* @var{generator}) Update an existing generator object after the underlying distribution has been modified (using @ifhtml @ref{funct:unur_get_distr,@command{unur_get_distr}} @end ifhtml @ifnothtml @command{unur_get_distr} @end ifnothtml together with corresponding set calls. It @strong{must} be executed before sampling using this generator object is continued as otherwise it produces an invalid sample or might even cause a segmentation fault. @emph{Important}: Currently not all methods allow reinitialization, see the description of the particular method (keyword @i{Reinit}). @emph{Important}: Reinitialization of the generator object might fail. Thus one @strong{must} check the return code: @table @asis @item @code{UNUR_SUCCESS (0x0u)} success (no error) @item @code{UNUR_ERR_NO_REINIT} reinit routine not implemented. @item other values some error has occured while trying to reinitialize the generator object. @end table @emph{Important}: When reinitialization fails then sampling routines always return @code{UNUR_INFINITY} (for continuous distributions) or @code{0} (for discrete distributions), respectively. However, it is still possible to change the underlying distribution and try to reinitialize again. @emph{Important}: When one tries to run @ifhtml @ref{funct:unur_reinit,@command{unur_reinit},} @end ifhtml @ifnothtml @command{unur_reinit}, @end ifnothtml but reinitialization is not implemented, then the generator object cannot be used any more and must be destroyed and a new one has to be built from scratch. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_reinit} @deftypefn {} {int} unur_reinit (UNUR_GEN* @var{generator}) Update an existing generator object after the underlying distribution has been modified (using @ifhtml @ref{funct:unur_get_distr,@command{unur_get_distr}} @end ifhtml @ifnothtml @command{unur_get_distr} @end ifnothtml together with corresponding set calls. It @strong{must} be executed before sampling using this generator object is continued as otherwise it produces an invalid sample or might even cause a segmentation fault. @emph{Important}: Currently not all methods allow reinitialization, see the description of the particular method (keyword @i{Reinit}). @emph{Important}: Reinitialization of the generator object might fail. Thus one @strong{must} check the return code: @table @asis @item @code{UNUR_SUCCESS (0x0u)} success (no error) @item @code{UNUR_ERR_NO_REINIT} reinit routine not implemented. @item other values some error has occured while trying to reinitialize the generator object. @end table @emph{Important}: When reinitialization fails then sampling routines always return @code{UNUR_INFINITY} (for continuous distributions) or @code{0} (for discrete distributions), respectively. However, it is still possible to change the underlying distribution and try to reinitialize again. @emph{Important}: When one tries to run @ifhtml @ref{funct:unur_reinit,@command{unur_reinit},} @end ifhtml @ifnothtml @command{unur_reinit}, @end ifnothtml but reinitialization is not implemented, then the generator object cannot be used any more and must be destroyed and a new one has to be built from scratch. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_sample_discr} @anchor{funct:unur_sample_cont} @anchor{funct:unur_sample_vec} @anchor{funct:unur_sample_matr} @deftypefn Function {int } unur_sample_discr (UNUR_GEN* @var{generator}) @deftypefnx Function {double} unur_sample_cont (UNUR_GEN* @var{generator}) @deftypefnx Function {int } unur_sample_vec (UNUR_GEN* @var{generator}, double* @var{vector}) @deftypefnx Function {int } unur_sample_matr (UNUR_GEN* @var{generator}, double* @var{matrix}) Sample from generator object. The three routines depend on the type of the generator object (discrete or continuous univariate distribution, multivariate distribution, or random matrix). @emph{Notice:} UNU.RAN uses arrays of @code{double}s to handle matrices. There the rows of the matrix are stored consecutively. @emph{Notice:} The routines @ifhtml @ref{funct:unur_sample_vec,@command{unur_sample_vec}} @end ifhtml @ifnothtml @command{unur_sample_vec} @end ifnothtml and @ifhtml @ref{funct:unur_sample_matr,@command{unur_sample_matr}} @end ifhtml @ifnothtml @command{unur_sample_matr} @end ifnothtml return @code{UNUR_SUCCESS} if generation was successful and some error code otherwise. @strong{Important:} These routines do @strong{not} check whether @var{generator} is an invalid @code{NULL} pointer. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_sample_discr} @anchor{funct:unur_sample_cont} @anchor{funct:unur_sample_vec} @anchor{funct:unur_sample_matr} @deftypefn {} {int } unur_sample_discr (UNUR_GEN* @var{generator}) @deftypefnx {} {double} unur_sample_cont (UNUR_GEN* @var{generator}) @deftypefnx {} {int } unur_sample_vec (UNUR_GEN* @var{generator}, double* @var{vector}) @deftypefnx {} {int } unur_sample_matr (UNUR_GEN* @var{generator}, double* @var{matrix}) Sample from generator object. The three routines depend on the type of the generator object (discrete or continuous univariate distribution, multivariate distribution, or random matrix). @emph{Notice:} UNU.RAN uses arrays of @code{double}s to handle matrices. There the rows of the matrix are stored consecutively. @emph{Notice:} The routines @ifhtml @ref{funct:unur_sample_vec,@command{unur_sample_vec}} @end ifhtml @ifnothtml @command{unur_sample_vec} @end ifnothtml and @ifhtml @ref{funct:unur_sample_matr,@command{unur_sample_matr}} @end ifhtml @ifnothtml @command{unur_sample_matr} @end ifnothtml return @code{UNUR_SUCCESS} if generation was successful and some error code otherwise. @strong{Important:} These routines do @strong{not} check whether @var{generator} is an invalid @code{NULL} pointer. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_quantile} @deftypefn Function {double} unur_quantile (UNUR_GEN* @var{generator}, double @var{U}) Compute the @var{U} quantile of a continuous distribution using a @var{generator} object that implements an (approximate) inversion methods. The following methods are currently available: @itemize @item HINV, @pxref{HINV}. @item NINV, @pxref{NINV}. @item PINV, @pxref{PINV}. @item CSTD, @pxref{CSTD}. @* This requires that @var{generator} implements an inversion method. @item DGT, @pxref{DGT}. @* The return value is (of course) type casted to @code{double}. @end itemize @strong{Important:} This routine does @strong{not} check whether @var{generator} is an invalid @code{NULL} pointer. In case of an error UNUR_INFINITY or INT_MAX (depending on the type of @var{generator}) is returned. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_quantile} @deftypefn {} {double} unur_quantile (UNUR_GEN* @var{generator}, double @var{U}) Compute the @var{U} quantile of a continuous distribution using a @var{generator} object that implements an (approximate) inversion methods. The following methods are currently available: @itemize @item HINV, @pxref{HINV}. @item NINV, @pxref{NINV}. @item PINV, @pxref{PINV}. @item CSTD, @pxref{CSTD}. @* This requires that @var{generator} implements an inversion method. @item DGT, @pxref{DGT}. @* The return value is (of course) type casted to @code{double}. @end itemize @strong{Important:} This routine does @strong{not} check whether @var{generator} is an invalid @code{NULL} pointer. In case of an error UNUR_INFINITY or INT_MAX (depending on the type of @var{generator}) is returned. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_free} @deftypefn Function {void } unur_free (UNUR_GEN* @var{generator}) Destroy (free) the given generator object. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_free} @deftypefn {} {void } unur_free (UNUR_GEN* @var{generator}) Destroy (free) the given generator object. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_gen_info} @deftypefn Function {const char*} unur_gen_info (UNUR_GEN* @var{generator}, int @var{help}) Get a string with informations about the given @var{generator}. These informations allow some fine tuning of the generation method. If @var{help} is @code{TRUE}, some hints on setting parameters are given. This function is intented for using in interactive environments (like @t{R}). If an error occurs, then @code{NULL} is returned. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_gen_info} @deftypefn {} {const char*} unur_gen_info (UNUR_GEN* @var{generator}, int @var{help}) Get a string with informations about the given @var{generator}. These informations allow some fine tuning of the generation method. If @var{help} is @code{TRUE}, some hints on setting parameters are given. This function is intented for using in interactive environments (like @t{R}). If an error occurs, then @code{NULL} is returned. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_get_dimension} @deftypefn Function {int} unur_get_dimension (const @var{UNUR_GEN* generator}) Get the number of dimension of a (multivariate) distribution. For a univariate distribution @code{1} is return. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_get_dimension} @deftypefn {} {int} unur_get_dimension (const @var{UNUR_GEN* generator}) Get the number of dimension of a (multivariate) distribution. For a univariate distribution @code{1} is return. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_get_genid} @deftypefn Function {const char*} unur_get_genid (const @var{UNUR_GEN* generator}) Get identifier string for generator. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_get_genid} @deftypefn {} {const char*} unur_get_genid (const @var{UNUR_GEN* generator}) Get identifier string for generator. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_get_method} @deftypefn Function {unsigned int} unur_get_method (const @var{UNUR_GEN* generator}) Get identifier for generating method. These identifiers are declared in @file{src/methods/unur_metthods.h}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_get_method} @deftypefn {} {unsigned int} unur_get_method (const @var{UNUR_GEN* generator}) Get identifier for generating method. These identifiers are declared in @file{src/methods/unur_metthods.h}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_gen_is_inversion} @deftypefn Function {int} unur_gen_is_inversion (const @var{UNUR_GEN* gen}) Return @code{TRUE} if the generator object implements an inversion method, and @code{FALSE} otherwise. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_gen_is_inversion} @deftypefn {} {int} unur_gen_is_inversion (const @var{UNUR_GEN* gen}) Return @code{TRUE} if the generator object implements an inversion method, and @code{FALSE} otherwise. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_get_distr} @deftypefn Function {UNUR_DISTR*} unur_get_distr (const @var{UNUR_GEN* generator}) Get pointer to distribution object from generator object. This function can be used to change the parameters of the distribution and reinitialize the generator object. Notice that currently @strong{not all} generating methods have a reinitialize routine. This function should be used with extreme care. Changing the distribution is changed and using the generator object without reinitializing might cause wrong samples or segmentation faults. Moreover, if the corresponding generator object is freed, the pointer must not be used. @strong{Important:} The returned distribution object must not be freed. If the distribution object is changed then one @strong{must} run @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml ! @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_get_distr} @deftypefn {} {UNUR_DISTR*} unur_get_distr (const @var{UNUR_GEN* generator}) Get pointer to distribution object from generator object. This function can be used to change the parameters of the distribution and reinitialize the generator object. Notice that currently @strong{not all} generating methods have a reinitialize routine. This function should be used with extreme care. Changing the distribution is changed and using the generator object without reinitializing might cause wrong samples or segmentation faults. Moreover, if the corresponding generator object is freed, the pointer must not be used. @strong{Important:} The returned distribution object must not be freed. If the distribution object is changed then one @strong{must} run @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml ! @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_set_use_distr_privatecopy} @deftypefn Function {int} unur_set_use_distr_privatecopy (UNUR_PAR* @var{parameters}, int @var{use_privatecopy}) Set flag whether the generator object should make a private copy of the given distribution object or just stores the pointer to this distribution object. Values for @var{use_privatecopy}: @table @code @item @code{TRUE} make a private copy (default) @item @code{FALSE} do not make a private copy and store pointer to given (external) distribution object. @end table By default, generator objects keep their own private copy of the given distribution object. Thus the generator object can be handled independently from other UNU.RAN objects (with uniform random number generators as the only exception). When the generator object is initialized the given distribution object is cloned and stored. However, in some rare situations it can be useful when only the pointer to the given distribution object is stored without making a private copy. A possible example is when only one random variate has to be drawn from the distribution. This behavior can be achieved when @var{use_localcopy} is set to @code{FALSE}. @strong{Warning!} Using a pointer to the external distribution object instead of a private copy must be done with @strong{extreme care}! When the distrubtion object is changed or freed then the generator object does not work any more, might case a segmentation fault, or (even worse) produces garbage. On the other hand, when the generator object is initialized or used to draw a random sampling the distribution object may be changed. @emph{Notice:} The prototypes of all @code{unur__new} calls use a @code{const} qualifier for the distribution argument. However, if @var{use_privatecopy} is set to @code{FALSE} this qualifier is discarded and the distribution might be changed. @strong{Important!} If @var{use_localcopy} is set to @code{FALSE} and the corresponding distribution object is changed then one must run @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml on the generator object. (Notice that currently not all generation methods support reinitialization.) Default: @var{use_privatecopy} is @code{TRUE}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_set_use_distr_privatecopy} @deftypefn {} {int} unur_set_use_distr_privatecopy (UNUR_PAR* @var{parameters}, int @var{use_privatecopy}) Set flag whether the generator object should make a private copy of the given distribution object or just stores the pointer to this distribution object. Values for @var{use_privatecopy}: @table @code @item @code{TRUE} make a private copy (default) @item @code{FALSE} do not make a private copy and store pointer to given (external) distribution object. @end table By default, generator objects keep their own private copy of the given distribution object. Thus the generator object can be handled independently from other UNU.RAN objects (with uniform random number generators as the only exception). When the generator object is initialized the given distribution object is cloned and stored. However, in some rare situations it can be useful when only the pointer to the given distribution object is stored without making a private copy. A possible example is when only one random variate has to be drawn from the distribution. This behavior can be achieved when @var{use_localcopy} is set to @code{FALSE}. @strong{Warning!} Using a pointer to the external distribution object instead of a private copy must be done with @strong{extreme care}! When the distrubtion object is changed or freed then the generator object does not work any more, might case a segmentation fault, or (even worse) produces garbage. On the other hand, when the generator object is initialized or used to draw a random sampling the distribution object may be changed. @emph{Notice:} The prototypes of all @code{unur__new} calls use a @code{const} qualifier for the distribution argument. However, if @var{use_privatecopy} is set to @code{FALSE} this qualifier is discarded and the distribution might be changed. @strong{Important!} If @var{use_localcopy} is set to @code{FALSE} and the corresponding distribution object is changed then one must run @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml on the generator object. (Notice that currently not all generation methods support reinitialization.) Default: @var{use_privatecopy} is @code{TRUE}. @end deftypefn @end ifnotinfo @c @c end of x_gen.h @c ------------------------------------- @c ------------------------------------- @c auto.h @c @page @node AUTO @section AUTO -- Select method automatically AUTO selects a an appropriate method for the given distribution object automatically. There are no parameters for this method, yet. But it is planned to give some parameter to describe the task for which the random variate generator is used for and thus make the choice of the generating method more appropriate. Notice that the required sampling routine for the generator object depends on the type of the given distribution object. The chosen method also depends on the sample size for which the generator object will be used. If only a few random variates the order of magnitude of the sample size should be set via a @ifhtml @ref{funct:unur_auto_set_logss,@command{unur_auto_set_logss}} @end ifhtml @ifnothtml @command{unur_auto_set_logss} @end ifnothtml call. IMPORTANT: This is an experimental version and the method chosen may change in future releases of UNU.RAN. For an example see @ref{Example_0,As short as possible,Example: As short as possible}. @subsubheading How To Use Create a generator object for the given distribution object. @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_auto_new,unur_auto_new} @item @ref{funct:unur_auto_set_logss,unur_auto_set_logss} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_auto_new} @deftypefn Function {UNUR_PAR*} unur_auto_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_auto_new} @deftypefn {} {UNUR_PAR*} unur_auto_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_auto_set_logss} @deftypefn Function {int} unur_auto_set_logss (UNUR_PAR* @var{parameters}, int @var{logss}) Set the order of magnitude for the size of the sample that will be generated by the generator, i.e., the the common logarithm of the sample size. Default is 10. Notice: This feature will be used in future releases of UNU.RAN only. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_auto_set_logss} @deftypefn {} {int} unur_auto_set_logss (UNUR_PAR* @var{parameters}, int @var{logss}) Set the order of magnitude for the size of the sample that will be generated by the generator, i.e., the the common logarithm of the sample size. Default is 10. Notice: This feature will be used in future releases of UNU.RAN only. @end deftypefn @end ifnotinfo @c @c end of auto.h @c ------------------------------------- @c ------------------------------------- @c methods.dh @c @page @node Methods_for_CONT @section Methods for continuous univariate distributions @menu * AROU:: Automatic Ratio-Of-Uniforms method * ARS:: Adaptive Rejection Sampling * CEXT:: wrapper for Continuous EXTernal generators * CSTD:: Continuous STandarD distributions * HINV:: Hermite interpolation based INVersion of CDF * HRB:: Hazard Rate Bounded * HRD:: Hazard Rate Decreasing * HRI:: Hazard Rate Increasing * ITDR:: Inverse Transformed Density Rejection * NINV:: Numerical INVersion * NROU:: Naive Ratio-Of-Uniforms method * PINV:: Polynomial interpolation based INVersion of CDF * SROU:: Simple Ratio-Of-Uniforms method * SSR:: Simple Setup Rejection * TABL:: a TABLe method with piecewise constant hats * TDR:: Transformed Density Rejection * UTDR:: Universal Transformed Density Rejection @end menu @subheading Overview of methods @include methods_cont.texi @subheading Example @smallexample @include ref_example_cont.texi @end smallexample @subheading Example (String API) @smallexample @include ref_example_cont_str.texi @end smallexample @c @c end of methods.dh @c ------------------------------------- @c ------------------------------------- @c arou.h @c @page @node AROU @subsection AROU -- Automatic Ratio-Of-Uniforms method @table @i @item Required: T-concave PDF, dPDF @item Optional: mode @item Speed: Set-up: slow, Sampling: fast @item Reinit: not implemented @item Reference: @ifhtml @ref{bib:LJa00,, [LJa00]} @end ifhtml @ifnothtml [LJa00] @end ifnothtml @end table AROU is a variant of the ratio-of-uniforms method that uses the fact that the transformed region is convex for many distributions. It works for all T-concave distributions with T(x) = -1/sqrt(x). It is possible to use this method for correlation induction by setting an auxiliary uniform random number generator via the @ifhtml @ref{funct:unur_set_urng_aux,@command{unur_set_urng_aux}} @end ifhtml @ifnothtml @command{unur_set_urng_aux} @end ifnothtml call. (Notice that this must be done after a possible @ifhtml @ref{funct:unur_set_urng,@command{unur_set_urng}} @end ifhtml @ifnothtml @command{unur_set_urng} @end ifnothtml call.) When an auxiliary generator is used then the number of used uniform random numbers that is used up for one generated random variate is constant and equal to 1. There exists a test mode that verifies whether the conditions for the method are satisfied or not while sampling. It can be switched on by calling @ifhtml @ref{funct:unur_arou_set_verify,@command{unur_arou_set_verify}} @end ifhtml @ifnothtml @command{unur_arou_set_verify} @end ifnothtml and @ifhtml @ref{funct:unur_arou_chg_verify,@command{unur_arou_chg_verify},} @end ifhtml @ifnothtml @command{unur_arou_chg_verify}, @end ifnothtml respectively. Notice however that sampling is (much) slower then. For densities with modes not close to 0 it is suggested to set either the mode or the center of the distribution by the @ifhtml @ref{funct:unur_distr_cont_set_mode,@command{unur_distr_cont_set_mode}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_mode} @end ifnothtml or @ifhtml @ref{funct:unur_distr_cont_set_center,@command{unur_distr_cont_set_center}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_center} @end ifnothtml call. The latter is the approximate location of the mode or the mean of the distribution. This location provides some information about the main part of the PDF and is used to avoid numerical problems. @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_arou_new,unur_arou_new} @item @ref{funct:unur_arou_set_usedars,unur_arou_set_usedars} @item @ref{funct:unur_arou_set_darsfactor,unur_arou_set_darsfactor} @item @ref{funct:unur_arou_set_max_sqhratio,unur_arou_set_max_sqhratio} @item @ref{funct:unur_arou_get_sqhratio,unur_arou_get_sqhratio} @item @ref{funct:unur_arou_get_hatarea,unur_arou_get_hatarea} @item @ref{funct:unur_arou_get_squeezearea,unur_arou_get_squeezearea} @item @ref{funct:unur_arou_set_max_segments,unur_arou_set_max_segments} @item @ref{funct:unur_arou_set_cpoints,unur_arou_set_cpoints} @item @ref{funct:unur_arou_set_usecenter,unur_arou_set_usecenter} @item @ref{funct:unur_arou_set_guidefactor,unur_arou_set_guidefactor} @item @ref{funct:unur_arou_set_verify,unur_arou_set_verify} @item @ref{funct:unur_arou_chg_verify,unur_arou_chg_verify} @item @ref{funct:unur_arou_set_pedantic,unur_arou_set_pedantic} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_arou_new} @deftypefn Function {UNUR_PAR*} unur_arou_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_arou_new} @deftypefn {} {UNUR_PAR*} unur_arou_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_arou_set_usedars} @deftypefn Function {int} unur_arou_set_usedars (UNUR_PAR* @var{parameters}, int @var{usedars}) If @var{usedars} is set to @code{TRUE}, ``derandomized adaptive rejection sampling'' (DARS) is used in setup. Segments where the area between hat and squeeze is too large compared to the average area between hat and squeeze over all intervals are split. This procedure is repeated until the ratio between area below squeeze and area below hat exceeds the bound given by @ifhtml @ref{funct:unur_arou_set_max_sqhratio,@command{unur_arou_set_max_sqhratio}} @end ifhtml @ifnothtml @command{unur_arou_set_max_sqhratio} @end ifnothtml call or the maximum number of segments is reached. Moreover, it also aborts when no more segments can be found for splitting. Segments are split such that the angle of the segments are halved (corresponds to arc-mean rule of method TDR (@pxref{TDR})). Default is @code{TRUE}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_arou_set_usedars} @deftypefn {} {int} unur_arou_set_usedars (UNUR_PAR* @var{parameters}, int @var{usedars}) If @var{usedars} is set to @code{TRUE}, ``derandomized adaptive rejection sampling'' (DARS) is used in setup. Segments where the area between hat and squeeze is too large compared to the average area between hat and squeeze over all intervals are split. This procedure is repeated until the ratio between area below squeeze and area below hat exceeds the bound given by @ifhtml @ref{funct:unur_arou_set_max_sqhratio,@command{unur_arou_set_max_sqhratio}} @end ifhtml @ifnothtml @command{unur_arou_set_max_sqhratio} @end ifnothtml call or the maximum number of segments is reached. Moreover, it also aborts when no more segments can be found for splitting. Segments are split such that the angle of the segments are halved (corresponds to arc-mean rule of method TDR (@pxref{TDR})). Default is @code{TRUE}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_arou_set_darsfactor} @deftypefn Function {int} unur_arou_set_darsfactor (UNUR_PAR* @var{parameters}, double @var{factor}) Set factor for ``derandomized adaptive rejection sampling''. This factor is used to determine the segments that are ``too large'', that is, all segments where the area between squeeze and hat is larger than @var{factor} times the average area over all intervals between squeeze and hat. Notice that all segments are split when @var{factor} is set to @code{0.}, and that there is no splitting at all when @var{factor} is set to @code{UNUR_INFINITY}. Default is @code{0.99}. There is no need to change this parameter. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_arou_set_darsfactor} @deftypefn {} {int} unur_arou_set_darsfactor (UNUR_PAR* @var{parameters}, double @var{factor}) Set factor for ``derandomized adaptive rejection sampling''. This factor is used to determine the segments that are ``too large'', that is, all segments where the area between squeeze and hat is larger than @var{factor} times the average area over all intervals between squeeze and hat. Notice that all segments are split when @var{factor} is set to @code{0.}, and that there is no splitting at all when @var{factor} is set to @code{UNUR_INFINITY}. Default is @code{0.99}. There is no need to change this parameter. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_arou_set_max_sqhratio} @deftypefn Function {int} unur_arou_set_max_sqhratio (UNUR_PAR* @var{parameters}, double @var{max_ratio}) Set upper bound for the ratio (area inside squeeze) / (area inside envelope). It must be a number between 0 and 1. When the ratio exceeds the given number no further construction points are inserted via adaptive rejection sampling. Use @code{0} if no construction points should be added after the setup. Use @code{1} if adding new construction points should not be stopped until the maximum number of construction points is reached. Default is @code{0.99}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_arou_set_max_sqhratio} @deftypefn {} {int} unur_arou_set_max_sqhratio (UNUR_PAR* @var{parameters}, double @var{max_ratio}) Set upper bound for the ratio (area inside squeeze) / (area inside envelope). It must be a number between 0 and 1. When the ratio exceeds the given number no further construction points are inserted via adaptive rejection sampling. Use @code{0} if no construction points should be added after the setup. Use @code{1} if adding new construction points should not be stopped until the maximum number of construction points is reached. Default is @code{0.99}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_arou_get_sqhratio} @deftypefn Function {double} unur_arou_get_sqhratio (const @var{UNUR_GEN* generator}) Get the current ratio (area inside squeeze) / (area inside envelope) for the generator. (In case of an error @code{UNUR_INFINITY} is returned.) @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_arou_get_sqhratio} @deftypefn {} {double} unur_arou_get_sqhratio (const @var{UNUR_GEN* generator}) Get the current ratio (area inside squeeze) / (area inside envelope) for the generator. (In case of an error @code{UNUR_INFINITY} is returned.) @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_arou_get_hatarea} @deftypefn Function {double} unur_arou_get_hatarea (const @var{UNUR_GEN* generator}) Get the area below the hat for the generator. (In case of an error @code{UNUR_INFINITY} is returned.) @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_arou_get_hatarea} @deftypefn {} {double} unur_arou_get_hatarea (const @var{UNUR_GEN* generator}) Get the area below the hat for the generator. (In case of an error @code{UNUR_INFINITY} is returned.) @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_arou_get_squeezearea} @deftypefn Function {double} unur_arou_get_squeezearea (const @var{UNUR_GEN* generator}) Get the area below the squeeze for the generator. (In case of an error @code{UNUR_INFINITY} is returned.) @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_arou_get_squeezearea} @deftypefn {} {double} unur_arou_get_squeezearea (const @var{UNUR_GEN* generator}) Get the area below the squeeze for the generator. (In case of an error @code{UNUR_INFINITY} is returned.) @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_arou_set_max_segments} @deftypefn Function {int} unur_arou_set_max_segments (UNUR_PAR* @var{parameters}, int @var{max_segs}) Set maximum number of segements. No construction points are added @emph{after} the setup when the number of segments succeeds @var{max_segs}. Default is @code{100}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_arou_set_max_segments} @deftypefn {} {int} unur_arou_set_max_segments (UNUR_PAR* @var{parameters}, int @var{max_segs}) Set maximum number of segements. No construction points are added @emph{after} the setup when the number of segments succeeds @var{max_segs}. Default is @code{100}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_arou_set_cpoints} @deftypefn Function {int} unur_arou_set_cpoints (UNUR_PAR* @var{parameters}, int @var{n_stp}, const @var{double* stp}) Set construction points for enveloping polygon. If @var{stp} is @code{NULL}, then a heuristical rule of thumb is used to get @var{n_stp} construction points. This is the default behavior when this routine is not called. The (default) number of construction points is @code{30}, then. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_arou_set_cpoints} @deftypefn {} {int} unur_arou_set_cpoints (UNUR_PAR* @var{parameters}, int @var{n_stp}, const @var{double* stp}) Set construction points for enveloping polygon. If @var{stp} is @code{NULL}, then a heuristical rule of thumb is used to get @var{n_stp} construction points. This is the default behavior when this routine is not called. The (default) number of construction points is @code{30}, then. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_arou_set_usecenter} @deftypefn Function {int} unur_arou_set_usecenter (UNUR_PAR* @var{parameters}, int @var{usecenter}) Use the center as construction point. Default is @code{TRUE}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_arou_set_usecenter} @deftypefn {} {int} unur_arou_set_usecenter (UNUR_PAR* @var{parameters}, int @var{usecenter}) Use the center as construction point. Default is @code{TRUE}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_arou_set_guidefactor} @deftypefn Function {int} unur_arou_set_guidefactor (UNUR_PAR* @var{parameters}, double @var{factor}) Set factor for relative size of the guide table for indexed search (see also method DGT @ref{DGT}). It must be greater than or equal to @code{0}. When set to @code{0}, then sequential search is used. Default is @code{2}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_arou_set_guidefactor} @deftypefn {} {int} unur_arou_set_guidefactor (UNUR_PAR* @var{parameters}, double @var{factor}) Set factor for relative size of the guide table for indexed search (see also method DGT @ref{DGT}). It must be greater than or equal to @code{0}. When set to @code{0}, then sequential search is used. Default is @code{2}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_arou_set_verify} @anchor{funct:unur_arou_chg_verify} @deftypefn Function {int} unur_arou_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) @deftypefnx Function {int} unur_arou_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) Turn verifying of algorithm while sampling on/off. If the condition squeeze(@i{x}) <= PDF(@i{x}) <= hat(@i{x}) is violated for some @i{x} then @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. However notice that this might happen due to round-off errors for a few values of @i{x} (less than 1%). Default is @code{FALSE}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_arou_set_verify} @anchor{funct:unur_arou_chg_verify} @deftypefn {} {int} unur_arou_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) @deftypefnx {} {int} unur_arou_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) Turn verifying of algorithm while sampling on/off. If the condition squeeze(@i{x}) <= PDF(@i{x}) <= hat(@i{x}) is violated for some @i{x} then @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. However notice that this might happen due to round-off errors for a few values of @i{x} (less than 1%). Default is @code{FALSE}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_arou_set_pedantic} @deftypefn Function {int} unur_arou_set_pedantic (UNUR_PAR* @var{parameters}, int @var{pedantic}) Sometimes it might happen that @ifhtml @ref{funct:unur_init,@command{unur_init}} @end ifhtml @ifnothtml @command{unur_init} @end ifnothtml has been executed successfully. But when additional construction points are added by adaptive rejection sampling, the algorithm detects that the PDF is not T-concave. With @var{pedantic} being @code{TRUE}, the sampling routine is then exchanged by a routine that simply returns @code{UNUR_INFINITY}. Otherwise the new point is not added to the list of construction points. At least the hat function remains T-concave. Setting @var{pedantic} to @code{FALSE} allows sampling from a distribution which is ``almost'' T-concave and small errors are tolerated. However it might happen that the hat function cannot be improved significantly. When the hat function that has been constructed by the @ifhtml @ref{funct:unur_init,@command{unur_init}} @end ifhtml @ifnothtml @command{unur_init} @end ifnothtml call is extremely large then it might happen that the generation times are extremely high (even hours are possible in extremely rare cases). Default is @code{FALSE}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_arou_set_pedantic} @deftypefn {} {int} unur_arou_set_pedantic (UNUR_PAR* @var{parameters}, int @var{pedantic}) Sometimes it might happen that @ifhtml @ref{funct:unur_init,@command{unur_init}} @end ifhtml @ifnothtml @command{unur_init} @end ifnothtml has been executed successfully. But when additional construction points are added by adaptive rejection sampling, the algorithm detects that the PDF is not T-concave. With @var{pedantic} being @code{TRUE}, the sampling routine is then exchanged by a routine that simply returns @code{UNUR_INFINITY}. Otherwise the new point is not added to the list of construction points. At least the hat function remains T-concave. Setting @var{pedantic} to @code{FALSE} allows sampling from a distribution which is ``almost'' T-concave and small errors are tolerated. However it might happen that the hat function cannot be improved significantly. When the hat function that has been constructed by the @ifhtml @ref{funct:unur_init,@command{unur_init}} @end ifhtml @ifnothtml @command{unur_init} @end ifnothtml call is extremely large then it might happen that the generation times are extremely high (even hours are possible in extremely rare cases). Default is @code{FALSE}. @end deftypefn @end ifnotinfo @c @c end of arou.h @c ------------------------------------- @c ------------------------------------- @c ars.h @c @page @node ARS @subsection ARS -- Adaptive Rejection Sampling @table @i @item Required: concave logPDF, derivative of logPDF @item Optional: mode @item Speed: Set-up: fast, Sampling: slow @item Reinit: supported @item Reference: @ifhtml @ref{bib:GWa92,, [GWa92]} @end ifhtml @ifnothtml [GWa92] @end ifnothtml @ifhtml @ref{bib:HLD04,, [HLD04: Cha.4]} @end ifhtml @ifnothtml [HLD04: Cha.4] @end ifnothtml @end table ARS is an acceptance/rejection method that uses the concavity of the log-density function to construct hat function and squeezes automatically. It is very similar to method TDR (@pxref{TDR}) with variant GW, parameter @code{c = 0}, and DARS switched off. Moreover, method ARS requires the logPDF and its derivative dlogPDF to run. On the other hand, it is designed to draw only a (very) small samples and it is much more robust against densities with very large or small areas below the PDF as it occurs, for example, in conditional distributions of (high dimensional) multivariate distributions. Additionally, it can be re-initialized when the underlying distribution has been modified. Thus it is well suited for Gibbs sampling. Notice, that method ARS is a restricted version of TDR. If the full functionally of Transformed Density Rejection is needed use method @ref{TDR}. @subsubheading How To Use Method ARS is designed for distributions with log-concave densities. To use this method you need a distribution object with the logarithm of the PDF and its derivative given. The number of construction points as well as a set of such points can be provided using @ifhtml @ref{funct:unur_ars_set_cpoints,@command{unur_ars_set_cpoints}.} @end ifhtml @ifnothtml @command{unur_ars_set_cpoints}. @end ifnothtml Notice that addition construction points are added by means of adaptive rejection sampling until the maximal number of intervals given by @ifhtml @ref{funct:unur_ars_set_max_intervals,@command{unur_ars_set_max_intervals}} @end ifhtml @ifnothtml @command{unur_ars_set_max_intervals} @end ifnothtml is reached. A generated distribution object can be reinitialized using the @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml call. When @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml is called construction points for the new generator are necessary. There are two options: Either the same construction points as for the initial generator (given by a @ifhtml @ref{funct:unur_ars_set_cpoints,@command{unur_ars_set_cpoints}} @end ifhtml @ifnothtml @command{unur_ars_set_cpoints} @end ifnothtml call) are used (this is the default), or percentiles of the old hat function can be used. This can be set or changed using @ifhtml @ref{funct:unur_ars_set_reinit_percentiles,@command{unur_ars_set_reinit_percentiles}} @end ifhtml @ifnothtml @command{unur_ars_set_reinit_percentiles} @end ifnothtml and @ifhtml @ref{funct:unur_ars_chg_reinit_percentiles,@command{unur_ars_chg_reinit_percentiles}.} @end ifhtml @ifnothtml @command{unur_ars_chg_reinit_percentiles}. @end ifnothtml This feature is usefull when the underlying distribution object is only moderately changed. (An example is Gibbs sampling with small correlations.) There exists a test mode that verifies whether the conditions for the method are satisfied or not. It can be switched on by calling @ifhtml @ref{funct:unur_ars_set_verify,@command{unur_ars_set_verify}} @end ifhtml @ifnothtml @command{unur_ars_set_verify} @end ifnothtml and @ifhtml @ref{funct:unur_ars_chg_verify,@command{unur_ars_chg_verify},} @end ifhtml @ifnothtml @command{unur_ars_chg_verify}, @end ifnothtml respectively. Notice however that sampling is (much) slower then. Method ARS aborts after a given number of iterations and return UNUR_INFINITY to prevent (almost) infinite loops. This might happen when the starting hat is much too large and it is not possible to insert new construction points due to severe numerical errors or (more likely) the given PDF is not log-concave. This maximum number of iterations can be set by means of a @ifhtml @ref{funct:unur_ars_set_max_iter,@command{unur_ars_set_max_iter}} @end ifhtml @ifnothtml @command{unur_ars_set_max_iter} @end ifnothtml call. @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_ars_new,unur_ars_new} @item @ref{funct:unur_ars_set_max_intervals,unur_ars_set_max_intervals} @item @ref{funct:unur_ars_set_cpoints,unur_ars_set_cpoints} @item @ref{funct:unur_ars_set_reinit_percentiles,unur_ars_set_reinit_percentiles} @item @ref{funct:unur_ars_chg_reinit_percentiles,unur_ars_chg_reinit_percentiles} @item @ref{funct:unur_ars_set_reinit_ncpoints,unur_ars_set_reinit_ncpoints} @item @ref{funct:unur_ars_chg_reinit_ncpoints,unur_ars_chg_reinit_ncpoints} @item @ref{funct:unur_ars_set_max_iter,unur_ars_set_max_iter} @item @ref{funct:unur_ars_set_verify,unur_ars_set_verify} @item @ref{funct:unur_ars_chg_verify,unur_ars_chg_verify} @item @ref{funct:unur_ars_set_pedantic,unur_ars_set_pedantic} @item @ref{funct:unur_ars_get_loghatarea,unur_ars_get_loghatarea} @item @ref{funct:unur_ars_eval_invcdfhat,unur_ars_eval_invcdfhat} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_ars_new} @deftypefn Function {UNUR_PAR*} unur_ars_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_ars_new} @deftypefn {} {UNUR_PAR*} unur_ars_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_ars_set_max_intervals} @deftypefn Function {int} unur_ars_set_max_intervals (UNUR_PAR* @var{parameters}, int @var{max_ivs}) Set maximum number of intervals. No construction points are added after the setup when the number of intervals suceeds @var{max_ivs}. It is increased automatically to twice the number of construction points if this is larger. Default is @code{200}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_ars_set_max_intervals} @deftypefn {} {int} unur_ars_set_max_intervals (UNUR_PAR* @var{parameters}, int @var{max_ivs}) Set maximum number of intervals. No construction points are added after the setup when the number of intervals suceeds @var{max_ivs}. It is increased automatically to twice the number of construction points if this is larger. Default is @code{200}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_ars_set_cpoints} @deftypefn Function {int} unur_ars_set_cpoints (UNUR_PAR* @var{parameters}, int @var{n_cpoints}, const @var{double* cpoints}) Set construction points for the hat function. If @var{cpoints} is @code{NULL} then a heuristic rule of thumb is used to get @var{n_cpoints} construction points. This is the default behavior. @var{n_cpoints} should be at least @code{2}, otherwise defaults are used. The default number of construction points is 2. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_ars_set_cpoints} @deftypefn {} {int} unur_ars_set_cpoints (UNUR_PAR* @var{parameters}, int @var{n_cpoints}, const @var{double* cpoints}) Set construction points for the hat function. If @var{cpoints} is @code{NULL} then a heuristic rule of thumb is used to get @var{n_cpoints} construction points. This is the default behavior. @var{n_cpoints} should be at least @code{2}, otherwise defaults are used. The default number of construction points is 2. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_ars_set_reinit_percentiles} @anchor{funct:unur_ars_chg_reinit_percentiles} @deftypefn Function {int} unur_ars_set_reinit_percentiles (UNUR_PAR* @var{parameters}, int @var{n_percentiles}, const @var{double* percentiles}) @deftypefnx Function {int} unur_ars_chg_reinit_percentiles (UNUR_GEN* @var{generator}, int @var{n_percentiles}, const @var{double* percentiles}) By default, when the @var{generator} object is reinitialized, it used the same construction points as for the initialization procedure. Often the underlying distribution object has been changed only moderately. For example, the full conditional distribution of a multivariate distribution. In this case it might be more appropriate to use percentilesm of the hat function for the last (unchanged) distribution. @var{percentiles} must then be a pointer to an ordered array of numbers between @code{0.01} and @code{0.99}. If @var{percentiles} is @code{NULL}, then a heuristic rule of thumb is used to get @var{n_percentiles} values for these percentiles. Notice that @var{n_percentiles} must be at least @code{2}, otherwise defaults are used. (Then the first and third quartiles are used by default.) @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_ars_set_reinit_percentiles} @anchor{funct:unur_ars_chg_reinit_percentiles} @deftypefn {} {int} unur_ars_set_reinit_percentiles (UNUR_PAR* @var{parameters}, int @var{n_percentiles}, const @var{double* percentiles}) @deftypefnx {} {int} unur_ars_chg_reinit_percentiles (UNUR_GEN* @var{generator}, int @var{n_percentiles}, const @var{double* percentiles}) By default, when the @var{generator} object is reinitialized, it used the same construction points as for the initialization procedure. Often the underlying distribution object has been changed only moderately. For example, the full conditional distribution of a multivariate distribution. In this case it might be more appropriate to use percentilesm of the hat function for the last (unchanged) distribution. @var{percentiles} must then be a pointer to an ordered array of numbers between @code{0.01} and @code{0.99}. If @var{percentiles} is @code{NULL}, then a heuristic rule of thumb is used to get @var{n_percentiles} values for these percentiles. Notice that @var{n_percentiles} must be at least @code{2}, otherwise defaults are used. (Then the first and third quartiles are used by default.) @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_ars_set_reinit_ncpoints} @anchor{funct:unur_ars_chg_reinit_ncpoints} @deftypefn Function {int} unur_ars_set_reinit_ncpoints (UNUR_PAR* @var{parameters}, int @var{ncpoints}) @deftypefnx Function {int} unur_ars_chg_reinit_ncpoints (UNUR_GEN* @var{generator}, int @var{ncpoints}) When reinit fails with the given construction points or the percentiles of the old hat function, another trial is undertaken with @var{ncpoints} construction points. @var{ncpoints} must be at least @code{10}. Default: @code{30} @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_ars_set_reinit_ncpoints} @anchor{funct:unur_ars_chg_reinit_ncpoints} @deftypefn {} {int} unur_ars_set_reinit_ncpoints (UNUR_PAR* @var{parameters}, int @var{ncpoints}) @deftypefnx {} {int} unur_ars_chg_reinit_ncpoints (UNUR_GEN* @var{generator}, int @var{ncpoints}) When reinit fails with the given construction points or the percentiles of the old hat function, another trial is undertaken with @var{ncpoints} construction points. @var{ncpoints} must be at least @code{10}. Default: @code{30} @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_ars_set_max_iter} @deftypefn Function {int} unur_ars_set_max_iter (UNUR_PAR* @var{parameters}, int @var{max_iter}) The rejection loop stops after @var{max_iter} iterations and return UNUR_INFINITY. Default: @code{10000} @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_ars_set_max_iter} @deftypefn {} {int} unur_ars_set_max_iter (UNUR_PAR* @var{parameters}, int @var{max_iter}) The rejection loop stops after @var{max_iter} iterations and return UNUR_INFINITY. Default: @code{10000} @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_ars_set_verify} @anchor{funct:unur_ars_chg_verify} @deftypefn Function {int} unur_ars_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) @deftypefnx Function {int} unur_ars_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) Turn verifying of algorithm while sampling on/off. If the condition squeeze(@i{x}) <= PDF(@i{x}) <= hat(@i{x}) is violated for some @i{x} then @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. However notice that this might happen due to round-off errors for a few values of @i{x} (less than 1%). Default is @code{FALSE}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_ars_set_verify} @anchor{funct:unur_ars_chg_verify} @deftypefn {} {int} unur_ars_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) @deftypefnx {} {int} unur_ars_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) Turn verifying of algorithm while sampling on/off. If the condition squeeze(@i{x}) <= PDF(@i{x}) <= hat(@i{x}) is violated for some @i{x} then @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. However notice that this might happen due to round-off errors for a few values of @i{x} (less than 1%). Default is @code{FALSE}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_ars_set_pedantic} @deftypefn Function {int} unur_ars_set_pedantic (UNUR_PAR* @var{parameters}, int @var{pedantic}) Sometimes it might happen that @ifhtml @ref{funct:unur_init,@command{unur_init}} @end ifhtml @ifnothtml @command{unur_init} @end ifnothtml has been executed successfully. But when additional construction points are added by adaptive rejection sampling, the algorithm detects that the PDF is not log-concave. With @var{pedantic} being @code{TRUE}, the sampling routine is exchanged by a routine that simply returns @code{UNUR_INFINITY}. Otherwise the new point is not added to the list of construction points. At least the hat function remains log-concave. Setting @var{pedantic} to @code{FALSE} allows sampling from a distribution which is ``almost'' log-concave and small errors are tolerated. However it might happen that the hat function cannot be improved significantly. When the hat functions that has been constructed by the @ifhtml @ref{funct:unur_init,@command{unur_init}} @end ifhtml @ifnothtml @command{unur_init} @end ifnothtml call is extremely large then it might happen that the generation times are extremely high (even hours are possible in extremely rare cases). Default is @code{FALSE}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_ars_set_pedantic} @deftypefn {} {int} unur_ars_set_pedantic (UNUR_PAR* @var{parameters}, int @var{pedantic}) Sometimes it might happen that @ifhtml @ref{funct:unur_init,@command{unur_init}} @end ifhtml @ifnothtml @command{unur_init} @end ifnothtml has been executed successfully. But when additional construction points are added by adaptive rejection sampling, the algorithm detects that the PDF is not log-concave. With @var{pedantic} being @code{TRUE}, the sampling routine is exchanged by a routine that simply returns @code{UNUR_INFINITY}. Otherwise the new point is not added to the list of construction points. At least the hat function remains log-concave. Setting @var{pedantic} to @code{FALSE} allows sampling from a distribution which is ``almost'' log-concave and small errors are tolerated. However it might happen that the hat function cannot be improved significantly. When the hat functions that has been constructed by the @ifhtml @ref{funct:unur_init,@command{unur_init}} @end ifhtml @ifnothtml @command{unur_init} @end ifnothtml call is extremely large then it might happen that the generation times are extremely high (even hours are possible in extremely rare cases). Default is @code{FALSE}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_ars_get_loghatarea} @deftypefn Function {double} unur_ars_get_loghatarea (const @var{UNUR_GEN* generator}) Get the logarithm of area below the hat for the generator. (In case of an error @code{UNUR_INFINITY} is returned.) @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_ars_get_loghatarea} @deftypefn {} {double} unur_ars_get_loghatarea (const @var{UNUR_GEN* generator}) Get the logarithm of area below the hat for the generator. (In case of an error @code{UNUR_INFINITY} is returned.) @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_ars_eval_invcdfhat} @deftypefn Function {double} unur_ars_eval_invcdfhat (const @var{UNUR_GEN* generator}, double @var{u}) Evaluate the inverse of the CDF of the hat distribution at @var{u}. If @var{u} is out of the domain [0,1] then @code{unur_errno} is set to @code{UNUR_ERR_DOMAIN} and the respective bound of the domain of the distribution are returned (which is @code{-UNUR_INFINITY} or @code{UNUR_INFINITY} in the case of unbounded domains). @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_ars_eval_invcdfhat} @deftypefn {} {double} unur_ars_eval_invcdfhat (const @var{UNUR_GEN* generator}, double @var{u}) Evaluate the inverse of the CDF of the hat distribution at @var{u}. If @var{u} is out of the domain [0,1] then @code{unur_errno} is set to @code{UNUR_ERR_DOMAIN} and the respective bound of the domain of the distribution are returned (which is @code{-UNUR_INFINITY} or @code{UNUR_INFINITY} in the case of unbounded domains). @end deftypefn @end ifnotinfo @c @c end of ars.h @c ------------------------------------- @c ------------------------------------- @c cext.h @c @page @node CEXT @subsection CEXT -- wrapper for Continuous EXTernal generators @table @i @item Required: routine for sampling continuous random variates @item Speed: depends on external generator @item Reinit: supported @end table Method CEXT is a wrapper for external generators for continuous univariate distributions. It allows the usage of external random variate generators within the UNU.RAN framework. @subsubheading How To Use The following steps are required to use some external generator within the UNU.RAN framework (some of these are optional): @enumerate @item Make an empty generator object using a @ifhtml @ref{funct:unur_cext_new,@command{unur_cext_new}} @end ifhtml @ifnothtml @command{unur_cext_new} @end ifnothtml call. The argument @var{distribution} is optional and can be replaced by @code{NULL}. However, it is required if you want to pass parameters of the generated distribution to the external generator or for running some validation tests provided by UNU.RAN. @item Create an initialization routine of type @code{int (*init)(UNUR_GEN *gen)} and plug it into the generator object using the @ifhtml @ref{funct:unur_cext_set_init,@command{unur_cext_set_init}} @end ifhtml @ifnothtml @command{unur_cext_set_init} @end ifnothtml call. Notice that the @var{init} routine must return @code{UNUR_SUCCESS} when it has been executed successfully and @code{UNUR_FAILURE} otherwise. It is possible to get the size of and the pointer to the array of parameters of the underlying distribution object by the respective calls @ifhtml @ref{funct:unur_cext_get_ndistrparams,@command{unur_cext_get_ndistrparams}} @end ifhtml @ifnothtml @command{unur_cext_get_ndistrparams} @end ifnothtml and @ifhtml @ref{funct:unur_cext_get_distrparams,@command{unur_cext_get_distrparams}.} @end ifhtml @ifnothtml @command{unur_cext_get_distrparams}. @end ifnothtml Parameters for the external generator that are computed in the @var{init} routine can be stored in a single array or structure which is available by the @ifhtml @ref{funct:unur_cext_get_params,@command{unur_cext_get_params}} @end ifhtml @ifnothtml @command{unur_cext_get_params} @end ifnothtml call. Using an @var{init} routine is optional and can be omitted. @item Create a sampling routine of type @code{double (*sample)(UNUR_GEN *gen)} and plug it into the generator object using the @ifhtml @ref{funct:unur_cext_set_sample,@command{unur_cext_set_sample}} @end ifhtml @ifnothtml @command{unur_cext_set_sample} @end ifnothtml call. Uniform random numbers are provided by the @ifhtml @ref{funct:unur_sample_urng,@command{unur_sample_urng}} @end ifhtml @ifnothtml @command{unur_sample_urng} @end ifnothtml call. Do not use your own implementation of a uniform random number generator directly. If you want to use your own random number generator we recommend to use the UNU.RAN interface (see @pxref{URNG,,Using uniform random number generators}). The array or structure that contains parameters for the external generator that are computed in the @var{init} routine are available using the @ifhtml @ref{funct:unur_cext_get_params,@command{unur_cext_get_params}} @end ifhtml @ifnothtml @command{unur_cext_get_params} @end ifnothtml call. Using a @var{sample} routine is of course obligatory. @end enumerate It is possible to change the parameters and the domain of the chosen distribution and run @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml to reinitialize the generator object. The @var{init} routine is then called again. Here is a short example that demonstrates the application of this method by means of the exponential distribution: @smallexample @include ref_example_cext.texi @end smallexample @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_cext_new,unur_cext_new} @item @ref{funct:unur_cext_set_init,unur_cext_set_init} @item @ref{funct:unur_cext_set_sample,unur_cext_set_sample} @item @ref{funct:unur_cext_get_params,unur_cext_get_params} @item @ref{funct:unur_cext_get_distrparams,unur_cext_get_distrparams} @item @ref{funct:unur_cext_get_ndistrparams,unur_cext_get_ndistrparams} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_cext_new} @deftypefn Function {UNUR_PAR*} unur_cext_new (const @var{UNUR_DISTR* distribution}) Get default parameters for new generator. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_cext_new} @deftypefn {} {UNUR_PAR*} unur_cext_new (const @var{UNUR_DISTR* distribution}) Get default parameters for new generator. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_cext_set_init} @deftypefn Function {int} unur_cext_set_init (UNUR_PAR* @var{parameters}, int (* @var{init})(UNUR_GEN* gen )) Set initialization routine for external generator. Inside the @emph{Important:} The routine @var{init} must return @code{UNUR_SUCCESS} when the generator was initialized successfully and @code{UNUR_FAILURE} otherwise. Parameters that are computed in the @var{init} routine can be stored in an array or structure that is avaiable by means of the @ifhtml @ref{funct:unur_cext_get_params,@command{unur_cext_get_params}} @end ifhtml @ifnothtml @command{unur_cext_get_params} @end ifnothtml call. Parameters of the underlying distribution object can be obtained by the @ifhtml @ref{funct:unur_cext_get_distrparams,@command{unur_cext_get_distrparams}} @end ifhtml @ifnothtml @command{unur_cext_get_distrparams} @end ifnothtml call. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_cext_set_init} @deftypefn {} {int} unur_cext_set_init (UNUR_PAR* @var{parameters}, int (* @var{init})(UNUR_GEN* gen )) Set initialization routine for external generator. Inside the @emph{Important:} The routine @var{init} must return @code{UNUR_SUCCESS} when the generator was initialized successfully and @code{UNUR_FAILURE} otherwise. Parameters that are computed in the @var{init} routine can be stored in an array or structure that is avaiable by means of the @ifhtml @ref{funct:unur_cext_get_params,@command{unur_cext_get_params}} @end ifhtml @ifnothtml @command{unur_cext_get_params} @end ifnothtml call. Parameters of the underlying distribution object can be obtained by the @ifhtml @ref{funct:unur_cext_get_distrparams,@command{unur_cext_get_distrparams}} @end ifhtml @ifnothtml @command{unur_cext_get_distrparams} @end ifnothtml call. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_cext_set_sample} @deftypefn Function {int} unur_cext_set_sample (UNUR_PAR* @var{parameters}, double (* @var{sample})(UNUR_GEN* gen )) Set sampling routine for external generator. @emph{Important:} Use @code{unur_sample_urng(gen)} to get a uniform random number. The pointer to the array or structure that contains the parameters that are precomputed in the @var{init} routine are available by @code{unur_cext_get_params(gen,0)}. Additionally one can use the @ifhtml @ref{funct:unur_cext_get_distrparams,@command{unur_cext_get_distrparams}} @end ifhtml @ifnothtml @command{unur_cext_get_distrparams} @end ifnothtml call. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_cext_set_sample} @deftypefn {} {int} unur_cext_set_sample (UNUR_PAR* @var{parameters}, double (* @var{sample})(UNUR_GEN* gen )) Set sampling routine for external generator. @emph{Important:} Use @code{unur_sample_urng(gen)} to get a uniform random number. The pointer to the array or structure that contains the parameters that are precomputed in the @var{init} routine are available by @code{unur_cext_get_params(gen,0)}. Additionally one can use the @ifhtml @ref{funct:unur_cext_get_distrparams,@command{unur_cext_get_distrparams}} @end ifhtml @ifnothtml @command{unur_cext_get_distrparams} @end ifnothtml call. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_cext_get_params} @deftypefn Function {void*} unur_cext_get_params (UNUR_GEN* @var{generator}, size_t @var{size}) Get pointer to memory block for storing parameters of external generator. A memory block of size @var{size} is automatically (re-) allocated if necessary and the pointer to this block is stored in the @var{generator} object. If one only needs the pointer to this memory block set @var{size} to @code{0}. Notice, that @var{size} is the size of the memory block and not the length of an array. @emph{Important:} This rountine should only be used in the initialization and sampling routine of the external generator. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_cext_get_params} @deftypefn {} {void*} unur_cext_get_params (UNUR_GEN* @var{generator}, size_t @var{size}) Get pointer to memory block for storing parameters of external generator. A memory block of size @var{size} is automatically (re-) allocated if necessary and the pointer to this block is stored in the @var{generator} object. If one only needs the pointer to this memory block set @var{size} to @code{0}. Notice, that @var{size} is the size of the memory block and not the length of an array. @emph{Important:} This rountine should only be used in the initialization and sampling routine of the external generator. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_cext_get_distrparams} @anchor{funct:unur_cext_get_ndistrparams} @deftypefn Function {double*} unur_cext_get_distrparams (UNUR_GEN* @var{generator}) @deftypefnx Function {int} unur_cext_get_ndistrparams (UNUR_GEN* @var{generator}) Get size of and pointer to array of parameters of underlying distribution in @var{generator} object. @emph{Important:} These rountines should only be used in the initialization and sampling routine of the external generator. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_cext_get_distrparams} @anchor{funct:unur_cext_get_ndistrparams} @deftypefn {} {double*} unur_cext_get_distrparams (UNUR_GEN* @var{generator}) @deftypefnx {} {int} unur_cext_get_ndistrparams (UNUR_GEN* @var{generator}) Get size of and pointer to array of parameters of underlying distribution in @var{generator} object. @emph{Important:} These rountines should only be used in the initialization and sampling routine of the external generator. @end deftypefn @end ifnotinfo @c @c end of cext.h @c ------------------------------------- @c ------------------------------------- @c cstd.h @c @page @node CSTD @subsection CSTD -- Continuous STandarD distributions @table @i @item Required: standard distribution from UNU.RAN library (@pxref{Stddist,,Standard distributions}) or continuous distribution with inverse CDF. @item Speed: Set-up: fast, Sampling: depends on distribution and generator @item Reinit: supported @end table CSTD is a wrapper for special generators for continuous univariate standard distributions. It only works for distributions in the UNU.RAN library of standard distributions (@pxref{Stddist,,Standard distributions}) or for continuous distributions where the inverse CDF is given. If a distribution object is provided that is build from scratch, it must provide the inverse CDF. Then CSTD implements the inversion method. Otherwise, the @code{NULL} pointer is returned. For some distributions more than one special generator is possible. @subsubheading How To Use Create a distribution object for a standard distribution from the UNU.RAN library (@pxref{Stddist,,Standard distributions}), or create a continuous distribution object and set the function for the inverse CDF using @ifhtml @ref{funct:unur_distr_cont_set_invcdf,@command{unur_distr_cont_set_invcdf}.} @end ifhtml @ifnothtml @command{unur_distr_cont_set_invcdf}. @end ifnothtml For some distributions more than one special generator (@emph{variants}) is possible. These can be choosen by a @ifhtml @ref{funct:unur_cstd_set_variant,@command{unur_cstd_set_variant}} @end ifhtml @ifnothtml @command{unur_cstd_set_variant} @end ifnothtml call. For possible variants @pxref{Stddist,,Standard distributions}. However the following are common to all distributions: @table @code @item UNUR_STDGEN_DEFAULT the default generator. @item UNUR_STDGEN_FAST the fastest available special generator. @item UNUR_STDGEN_INVERSION the inversion method (if available). @end table Notice that the variant @code{UNUR_STDGEN_FAST} for a special generator may be slower than one of the universal algorithms! Additional variants may exist for particular distributions. Sampling from truncated distributions (which can be constructed by changing the default domain of a distribution by means of @ifhtml @ref{funct:unur_distr_cont_set_domain,@command{unur_distr_cont_set_domain}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_domain} @end ifnothtml or @ifhtml @ref{funct:unur_cstd_chg_truncated,@command{unur_cstd_chg_truncated}} @end ifhtml @ifnothtml @command{unur_cstd_chg_truncated} @end ifnothtml calls) is possible but requires the inversion method. Moreover the CDF of the distribution must be implemented. It is possible to change the parameters and the domain of the chosen distribution and run @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml to reinitialize the generator object. @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_cstd_new,unur_cstd_new} @item @ref{funct:unur_cstd_set_variant,unur_cstd_set_variant} @item @ref{funct:unur_cstd_chg_truncated,unur_cstd_chg_truncated} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_cstd_new} @deftypefn Function {UNUR_PAR*} unur_cstd_new (const @var{UNUR_DISTR* distribution}) Get default parameters for new generator. It requires a distribution object for a continuous univariant distribution from the UNU.RAN library of standard distributions (@pxref{Stddist,,Standard distributions}). Using a truncated distribution is allowed only if the inversion method is available and selected by the @ifhtml @ref{funct:unur_cstd_set_variant,@command{unur_cstd_set_variant}} @end ifhtml @ifnothtml @command{unur_cstd_set_variant} @end ifnothtml call immediately after creating the parameter object. Use a @ifhtml @ref{funct:unur_distr_cont_set_domain,@command{unur_distr_cont_set_domain}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_domain} @end ifnothtml call to get a truncated distribution. To change the domain of a (truncated) distribution of a generator use the @ifhtml @ref{funct:unur_cstd_chg_truncated,@command{unur_cstd_chg_truncated}} @end ifhtml @ifnothtml @command{unur_cstd_chg_truncated} @end ifnothtml call. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_cstd_new} @deftypefn {} {UNUR_PAR*} unur_cstd_new (const @var{UNUR_DISTR* distribution}) Get default parameters for new generator. It requires a distribution object for a continuous univariant distribution from the UNU.RAN library of standard distributions (@pxref{Stddist,,Standard distributions}). Using a truncated distribution is allowed only if the inversion method is available and selected by the @ifhtml @ref{funct:unur_cstd_set_variant,@command{unur_cstd_set_variant}} @end ifhtml @ifnothtml @command{unur_cstd_set_variant} @end ifnothtml call immediately after creating the parameter object. Use a @ifhtml @ref{funct:unur_distr_cont_set_domain,@command{unur_distr_cont_set_domain}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_domain} @end ifnothtml call to get a truncated distribution. To change the domain of a (truncated) distribution of a generator use the @ifhtml @ref{funct:unur_cstd_chg_truncated,@command{unur_cstd_chg_truncated}} @end ifhtml @ifnothtml @command{unur_cstd_chg_truncated} @end ifnothtml call. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_cstd_set_variant} @deftypefn Function {int} unur_cstd_set_variant (UNUR_PAR* @var{parameters}, unsigned @var{variant}) Set variant (special generator) for sampling from a given distribution. For possible variants @pxref{Stddist,,Standard distributions}. Common variants are @code{UNUR_STDGEN_DEFAULT} for the default generator, @code{UNUR_STDGEN_FAST} for (one of the) fastest implemented special generators, and @code{UNUR_STDGEN_INVERSION} for the inversion method (if available). If the selected variant number is not implemented, then an error code is returned and the variant is not changed. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_cstd_set_variant} @deftypefn {} {int} unur_cstd_set_variant (UNUR_PAR* @var{parameters}, unsigned @var{variant}) Set variant (special generator) for sampling from a given distribution. For possible variants @pxref{Stddist,,Standard distributions}. Common variants are @code{UNUR_STDGEN_DEFAULT} for the default generator, @code{UNUR_STDGEN_FAST} for (one of the) fastest implemented special generators, and @code{UNUR_STDGEN_INVERSION} for the inversion method (if available). If the selected variant number is not implemented, then an error code is returned and the variant is not changed. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_cstd_chg_truncated} @deftypefn Function {int} unur_cstd_chg_truncated (UNUR_GEN* @var{generator}, double @var{left}, double @var{right}) Change left and right border of the domain of the (truncated) distribution. This is only possible if the inversion method is used. Otherwise this call has no effect and an error code is returned. Notice that the given truncated domain must be a subset of the domain of the given distribution. The generator always uses the intersection of the domain of the distribution and the truncated domain given by this call. It is not required to run @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml after this call has been used. @emph{Important:} If the CDF is (almost) the same for @var{left} and @var{right} and (almost) equal to @code{0} or @code{1}, then the truncated domain is not chanced and the call returns an error code. @emph{Notice:} If the parameters of the distribution has been changed it is recommended to set the truncated domain again, since the former call might change the domain of the distribution but not update the values for the boundaries of the truncated distribution. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_cstd_chg_truncated} @deftypefn {} {int} unur_cstd_chg_truncated (UNUR_GEN* @var{generator}, double @var{left}, double @var{right}) Change left and right border of the domain of the (truncated) distribution. This is only possible if the inversion method is used. Otherwise this call has no effect and an error code is returned. Notice that the given truncated domain must be a subset of the domain of the given distribution. The generator always uses the intersection of the domain of the distribution and the truncated domain given by this call. It is not required to run @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml after this call has been used. @emph{Important:} If the CDF is (almost) the same for @var{left} and @var{right} and (almost) equal to @code{0} or @code{1}, then the truncated domain is not chanced and the call returns an error code. @emph{Notice:} If the parameters of the distribution has been changed it is recommended to set the truncated domain again, since the former call might change the domain of the distribution but not update the values for the boundaries of the truncated distribution. @end deftypefn @end ifnotinfo @c @c end of cstd.h @c ------------------------------------- @c ------------------------------------- @c hinv.h @c @page @node HINV @subsection HINV -- Hermite interpolation based INVersion of CDF @table @i @item Required: CDF @item Optional: PDF, dPDF @item Speed: Set-up: (very) slow, Sampling: (very) fast @item Reinit: supported @item Reference: @ifhtml @ref{bib:HLa03,, [HLa03]} @end ifhtml @ifnothtml [HLa03] @end ifnothtml @ifhtml @ref{bib:HLD04,, [HLD04: Sect.7.2; Alg.7.1]} @end ifhtml @ifnothtml [HLD04: Sect.7.2; Alg.7.1] @end ifnothtml @end table HINV is a variant of numerical inversion, where the inverse CDF is approximated using Hermite interpolation, i.e., the interval [0,1] is split into several intervals and in each interval the inverse CDF is approximated by polynomials constructed by means of values of the CDF and PDF at interval boundaries. This makes it possible to improve the accuracy by splitting a particular interval without recomputations in unaffected intervals. Three types of splines are implemented: linear, cubic, and quintic interpolation. For linear interpolation only the CDF is required. Cubic interpolation also requires PDF and quintic interpolation PDF and its derivative. These splines have to be computed in a setup step. However, it only works for distributions with bounded domain; for distributions with unbounded domain the tails are chopped off such that the probability for the tail regions is small compared to the given u-resolution. The method is not exact, as it only produces random variates of the approximated distribution. Nevertheless, the maximal numerical error in "u-direction" (i.e. |U-CDF(X)|, for X = "approximate inverse CDF"(U) |U-CDF(X)|) can be set to the required resolution (within machine precision). Notice that very small values of the u-resolution are possible but may increase the cost for the setup step. As the possible maximal error is only estimated in the setup it may be necessary to set some special design points for computing the Hermite interpolation to guarantee that the maximal u-error can not be bigger than desired. Such points are points where the density is not differentiable or has a local extremum. Notice that there is no necessity to do so. However, if you do not provide these points to the algorithm there might be a small chance that the approximation error is larger than the given u-resolution, or that the required number of intervals is larger than necessary. @subsubheading How To Use HINV works for continuous univariate distribution objects with given CDF and (optional) PDF. It uses Hermite interpolation of order 1, 3 [default] or 5. The order can be set by means of @ifhtml @ref{funct:unur_hinv_set_order,@command{unur_hinv_set_order}.} @end ifhtml @ifnothtml @command{unur_hinv_set_order}. @end ifnothtml For distributions with unbounded domains the tails are chopped off such that the probability for the tail regions is small compared to the given u-resulution. For finding these cut points the algorithm starts with the region @code{[-1.e20,1.e20]}. For the exceptional case where this might be too small (or one knows this region and wants to avoid this search heuristics) it can be directly set via a @ifhtml @ref{funct:unur_hinv_set_boundary,@command{unur_hinv_set_boundary}} @end ifhtml @ifnothtml @command{unur_hinv_set_boundary} @end ifnothtml call. It is possible to use this method for generating from truncated distributions. It even can be changed for an existing generator object by an @ifhtml @ref{funct:unur_hinv_chg_truncated,@command{unur_hinv_chg_truncated}} @end ifhtml @ifnothtml @command{unur_hinv_chg_truncated} @end ifnothtml call. This method is not exact, as it only produces random variates of the approximated distribution. Nevertheless, the numerical error in "u-direction" (i.e. |U-CDF(X)|, for X = "approximate inverse CDF"(U) |U-CDF(X)|) can be controlled by means of @ifhtml @ref{funct:unur_hinv_set_u_resolution,@command{unur_hinv_set_u_resolution}.} @end ifhtml @ifnothtml @command{unur_hinv_set_u_resolution}. @end ifnothtml The possible maximal error is only estimated in the setup. Thus it might be necessary to set some special design points for computing the Hermite interpolation to guarantee that the maximal u-error can not be bigger than desired. Such points (e.g. extremal points of the PDF, points with infinite derivative) can be set using using the @ifhtml @ref{funct:unur_hinv_set_cpoints,@command{unur_hinv_set_cpoints}} @end ifhtml @ifnothtml @command{unur_hinv_set_cpoints} @end ifnothtml call. If the mode for a unimodal distribution is set in the distribution object this mode is automatically used as design-point if the @ifhtml @ref{funct:unur_hinv_set_cpoints,@command{unur_hinv_set_cpoints}} @end ifhtml @ifnothtml @command{unur_hinv_set_cpoints} @end ifnothtml call is not used. As already mentioned the maximal error of this approximation is only estimated. If this error is crucial for an application we recommend to compute this error using @ifhtml @ref{funct:unur_hinv_estimate_error,@command{unur_hinv_estimate_error}} @end ifhtml @ifnothtml @command{unur_hinv_estimate_error} @end ifnothtml which runs a small Monte Carlo simulation. It is possible to change the parameters and the domain of the chosen distribution and run @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml to reinitialize the generator object. The values given by the last @ifhtml @ref{funct:unur_hinv_chg_truncated,@command{unur_hinv_chg_truncated}} @end ifhtml @ifnothtml @command{unur_hinv_chg_truncated} @end ifnothtml call will be then changed to the values of the domain of the underlying distribution object. Moreover, starting construction points (nodes) that are given by a @ifhtml @ref{funct:unur_hinv_set_cpoints,@command{unur_hinv_set_cpoints}} @end ifhtml @ifnothtml @command{unur_hinv_set_cpoints} @end ifnothtml call are ignored when @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml is called. It is important to note that for a distribution from the UNU.RAN library of standard distributions (@pxref{Stddist,,Standard distributions}) the normalization constant has to be updated using the @ifhtml @ref{funct:unur_distr_cont_upd_pdfarea,@command{unur_distr_cont_upd_pdfarea}} @end ifhtml @ifnothtml @command{unur_distr_cont_upd_pdfarea} @end ifnothtml call whenever its parameters have been changed by means of a @ifhtml @ref{funct:unur_distr_cont_set_pdfparams,@command{unur_distr_cont_set_pdfparams}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_pdfparams} @end ifnothtml call. @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_hinv_new,unur_hinv_new} @item @ref{funct:unur_hinv_set_order,unur_hinv_set_order} @item @ref{funct:unur_hinv_set_u_resolution,unur_hinv_set_u_resolution} @item @ref{funct:unur_hinv_set_cpoints,unur_hinv_set_cpoints} @item @ref{funct:unur_hinv_set_boundary,unur_hinv_set_boundary} @item @ref{funct:unur_hinv_set_guidefactor,unur_hinv_set_guidefactor} @item @ref{funct:unur_hinv_set_max_intervals,unur_hinv_set_max_intervals} @item @ref{funct:unur_hinv_get_n_intervals,unur_hinv_get_n_intervals} @item @ref{funct:unur_hinv_eval_approxinvcdf,unur_hinv_eval_approxinvcdf} @item @ref{funct:unur_hinv_chg_truncated,unur_hinv_chg_truncated} @item @ref{funct:unur_hinv_estimate_error,unur_hinv_estimate_error} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_hinv_new} @deftypefn Function {UNUR_PAR*} unur_hinv_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_hinv_new} @deftypefn {} {UNUR_PAR*} unur_hinv_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_hinv_set_order} @deftypefn Function {int} unur_hinv_set_order (UNUR_PAR* @var{parameters}, int @var{order}) Set order of Hermite interpolation. Valid orders are @code{1}, @code{3}, and @code{5}. Notice that @var{order} greater than @code{1} requires the density of the distribution, and @var{order} greater than @code{3} even requires the derivative of the density. Using @var{order} @code{1} results for most distributions in a huge number of intervals and is therefore not recommended. If the maximal error in u-direction is very small (say smaller than @code{1.e-10}), @var{order} @code{5} is recommended as it leads to considerably fewer design points, as long there are no poles or heavy tails. @emph{Remark:} When the target distribution has poles or (very) heavy tails @var{order} @code{5} (i.e., quintic interpolation) is numerically less stable and more sensitive to round-off errors than @var{order} @code{3} (i.e., cubic interpolation). Default is @code{3} if the density is given and @code{1} otherwise. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_hinv_set_order} @deftypefn {} {int} unur_hinv_set_order (UNUR_PAR* @var{parameters}, int @var{order}) Set order of Hermite interpolation. Valid orders are @code{1}, @code{3}, and @code{5}. Notice that @var{order} greater than @code{1} requires the density of the distribution, and @var{order} greater than @code{3} even requires the derivative of the density. Using @var{order} @code{1} results for most distributions in a huge number of intervals and is therefore not recommended. If the maximal error in u-direction is very small (say smaller than @code{1.e-10}), @var{order} @code{5} is recommended as it leads to considerably fewer design points, as long there are no poles or heavy tails. @emph{Remark:} When the target distribution has poles or (very) heavy tails @var{order} @code{5} (i.e., quintic interpolation) is numerically less stable and more sensitive to round-off errors than @var{order} @code{3} (i.e., cubic interpolation). Default is @code{3} if the density is given and @code{1} otherwise. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_hinv_set_u_resolution} @deftypefn Function {int} unur_hinv_set_u_resolution (UNUR_PAR* @var{parameters}, double @var{u_resolution}) Set maximal error in u-direction. However, the given u-error must not be smaller than machine epsilon (@code{DBL_EPSILON}) and should not be too close to this value. As the resolution of most uniform random number sources is 2^(-32) = @code{2.3e-10}, a value of @code{1.e-10} leads to an inversion algorithm that could be called exact. For most simulations slightly bigger values for the maximal error are enough as well. Remark: The u-error might become larger than @var{u_resolution} due to rescaling of floating point numbers when the domain of the distribution is truncated by a @ifhtml @ref{funct:unur_hinv_chg_truncated,@command{unur_hinv_chg_truncated}} @end ifhtml @ifnothtml @command{unur_hinv_chg_truncated} @end ifnothtml call. Default is @code{1.e-10}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_hinv_set_u_resolution} @deftypefn {} {int} unur_hinv_set_u_resolution (UNUR_PAR* @var{parameters}, double @var{u_resolution}) Set maximal error in u-direction. However, the given u-error must not be smaller than machine epsilon (@code{DBL_EPSILON}) and should not be too close to this value. As the resolution of most uniform random number sources is 2^(-32) = @code{2.3e-10}, a value of @code{1.e-10} leads to an inversion algorithm that could be called exact. For most simulations slightly bigger values for the maximal error are enough as well. Remark: The u-error might become larger than @var{u_resolution} due to rescaling of floating point numbers when the domain of the distribution is truncated by a @ifhtml @ref{funct:unur_hinv_chg_truncated,@command{unur_hinv_chg_truncated}} @end ifhtml @ifnothtml @command{unur_hinv_chg_truncated} @end ifnothtml call. Default is @code{1.e-10}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_hinv_set_cpoints} @deftypefn Function {int} unur_hinv_set_cpoints (UNUR_PAR* @var{parameters}, const @var{double* stp}, int @var{n_stp}) Set starting construction points (nodes) for Hermite interpolation. As the possible maximal error is only estimated in the setup it may be necessary to set some special design points for computing the Hermite interpolation to guarantee that the maximal u-error can not be bigger than desired. We suggest to include as special design points all local extrema of the density, all points where the density is not differentiable, and isolated points inside of the domain with density 0. If there is an interval with density constant equal to 0 inside of the given domain of the density, both endpoints of this interval should be included as special design points. Notice that there is no necessity to do so. However, if these points are not provided to the algorithm the approximation error might be larger than the given u-resolution, or the required number of intervals could be larger than necessary. @emph{Important}: Notice that the given points must be in increasing order and they must be disjoint. @emph{Important}: The boundary point of the computational region must not be given in this list! Points outside the boundary of the computational region are ignored. Default is for unimodal densities - if known - the mode of the density, if it is not equal to the border of the domain. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_hinv_set_cpoints} @deftypefn {} {int} unur_hinv_set_cpoints (UNUR_PAR* @var{parameters}, const @var{double* stp}, int @var{n_stp}) Set starting construction points (nodes) for Hermite interpolation. As the possible maximal error is only estimated in the setup it may be necessary to set some special design points for computing the Hermite interpolation to guarantee that the maximal u-error can not be bigger than desired. We suggest to include as special design points all local extrema of the density, all points where the density is not differentiable, and isolated points inside of the domain with density 0. If there is an interval with density constant equal to 0 inside of the given domain of the density, both endpoints of this interval should be included as special design points. Notice that there is no necessity to do so. However, if these points are not provided to the algorithm the approximation error might be larger than the given u-resolution, or the required number of intervals could be larger than necessary. @emph{Important}: Notice that the given points must be in increasing order and they must be disjoint. @emph{Important}: The boundary point of the computational region must not be given in this list! Points outside the boundary of the computational region are ignored. Default is for unimodal densities - if known - the mode of the density, if it is not equal to the border of the domain. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_hinv_set_boundary} @deftypefn Function {int} unur_hinv_set_boundary (UNUR_PAR* @var{parameters}, double @var{left}, double @var{right}) Set the left and right boundary of the computational interval. Of course @code{+/- UNUR_INFINITY} is not allowed. If the CDF at @var{left} and @var{right} is not close to the respective values @code{0.} and @code{1.} then this interval is increased by a (rather slow) search algorithm. @emph{Important}: This call does not change the domain of the given distribution itself. But it restricts the domain for the resulting random variates. Default is @code{1.e20}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_hinv_set_boundary} @deftypefn {} {int} unur_hinv_set_boundary (UNUR_PAR* @var{parameters}, double @var{left}, double @var{right}) Set the left and right boundary of the computational interval. Of course @code{+/- UNUR_INFINITY} is not allowed. If the CDF at @var{left} and @var{right} is not close to the respective values @code{0.} and @code{1.} then this interval is increased by a (rather slow) search algorithm. @emph{Important}: This call does not change the domain of the given distribution itself. But it restricts the domain for the resulting random variates. Default is @code{1.e20}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_hinv_set_guidefactor} @deftypefn Function {int} unur_hinv_set_guidefactor (UNUR_PAR* @var{parameters}, double @var{factor}) Set factor for relative size of the guide table for indexed search (see also method DGT @ref{DGT}). It must be greater than or equal to @code{0}. When set to @code{0}, then sequential search is used. Default is @code{1}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_hinv_set_guidefactor} @deftypefn {} {int} unur_hinv_set_guidefactor (UNUR_PAR* @var{parameters}, double @var{factor}) Set factor for relative size of the guide table for indexed search (see also method DGT @ref{DGT}). It must be greater than or equal to @code{0}. When set to @code{0}, then sequential search is used. Default is @code{1}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_hinv_set_max_intervals} @deftypefn Function {int} unur_hinv_set_max_intervals (UNUR_PAR* @var{parameters}, int @var{max_ivs}) Set maximum number of intervals. No generator object is created if the necessary number of intervals for the Hermite interpolation exceeds @var{max_ivs}. It is used to prevent the algorithm to eat up all memory for very badly shaped CDFs. Default is @code{1000000} (1.e6). @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_hinv_set_max_intervals} @deftypefn {} {int} unur_hinv_set_max_intervals (UNUR_PAR* @var{parameters}, int @var{max_ivs}) Set maximum number of intervals. No generator object is created if the necessary number of intervals for the Hermite interpolation exceeds @var{max_ivs}. It is used to prevent the algorithm to eat up all memory for very badly shaped CDFs. Default is @code{1000000} (1.e6). @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_hinv_get_n_intervals} @deftypefn Function {int} unur_hinv_get_n_intervals (const @var{UNUR_GEN* generator}) Get number of nodes (design points) used for Hermite interpolation in the generator object. The number of intervals is the number of nodes minus 1. It returns an error code in case of an error. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_hinv_get_n_intervals} @deftypefn {} {int} unur_hinv_get_n_intervals (const @var{UNUR_GEN* generator}) Get number of nodes (design points) used for Hermite interpolation in the generator object. The number of intervals is the number of nodes minus 1. It returns an error code in case of an error. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_hinv_eval_approxinvcdf} @deftypefn Function {double} unur_hinv_eval_approxinvcdf (const @var{UNUR_GEN* generator}, double @var{u}) Evaluate Hermite interpolation of inverse CDF at @var{u}. If @var{u} is out of the domain [0,1] then @code{unur_errno} is set to @code{UNUR_ERR_DOMAIN} and the respective bound of the domain of the distribution are returned (which is @code{-UNUR_INFINITY} or @code{UNUR_INFINITY} in the case of unbounded domains). @emph{Notice}: When the domain has been truncated by a @ifhtml @ref{funct:unur_hinv_chg_truncated,@command{unur_hinv_chg_truncated}} @end ifhtml @ifnothtml @command{unur_hinv_chg_truncated} @end ifnothtml call then the inverse CDF of the truncated distribution is returned. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_hinv_eval_approxinvcdf} @deftypefn {} {double} unur_hinv_eval_approxinvcdf (const @var{UNUR_GEN* generator}, double @var{u}) Evaluate Hermite interpolation of inverse CDF at @var{u}. If @var{u} is out of the domain [0,1] then @code{unur_errno} is set to @code{UNUR_ERR_DOMAIN} and the respective bound of the domain of the distribution are returned (which is @code{-UNUR_INFINITY} or @code{UNUR_INFINITY} in the case of unbounded domains). @emph{Notice}: When the domain has been truncated by a @ifhtml @ref{funct:unur_hinv_chg_truncated,@command{unur_hinv_chg_truncated}} @end ifhtml @ifnothtml @command{unur_hinv_chg_truncated} @end ifnothtml call then the inverse CDF of the truncated distribution is returned. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_hinv_chg_truncated} @deftypefn Function {int} unur_hinv_chg_truncated (UNUR_GEN* @var{generator}, double @var{left}, double @var{right}) Changes the borders of the domain of the (truncated) distribution. Notice that the given truncated domain must be a subset of the domain of the given distribution. The generator always uses the intersection of the domain of the distribution and the truncated domain given by this call. The tables of splines are not recomputed. Thus it might happen that the relative error for the generated variates from the truncated distribution is greater than the bound for the non-truncated distribution. This call also fails when the CDF values of the boundary points are too close, i.e. when only a few different floating point numbers would be computed due to round-off errors with floating point arithmetic. Remark: The u-error might become larger than the @var{u_resolution} given by a @ifhtml @ref{funct:unur_hinv_set_u_resolution,@command{unur_hinv_set_u_resolution}} @end ifhtml @ifnothtml @command{unur_hinv_set_u_resolution} @end ifnothtml call due to rescaling of floating point numbers when the domain of the distribution is truncated. When failed an error code is returned. @emph{Important}: Always check the return code since the domain is not changed in case of an error. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_hinv_chg_truncated} @deftypefn {} {int} unur_hinv_chg_truncated (UNUR_GEN* @var{generator}, double @var{left}, double @var{right}) Changes the borders of the domain of the (truncated) distribution. Notice that the given truncated domain must be a subset of the domain of the given distribution. The generator always uses the intersection of the domain of the distribution and the truncated domain given by this call. The tables of splines are not recomputed. Thus it might happen that the relative error for the generated variates from the truncated distribution is greater than the bound for the non-truncated distribution. This call also fails when the CDF values of the boundary points are too close, i.e. when only a few different floating point numbers would be computed due to round-off errors with floating point arithmetic. Remark: The u-error might become larger than the @var{u_resolution} given by a @ifhtml @ref{funct:unur_hinv_set_u_resolution,@command{unur_hinv_set_u_resolution}} @end ifhtml @ifnothtml @command{unur_hinv_set_u_resolution} @end ifnothtml call due to rescaling of floating point numbers when the domain of the distribution is truncated. When failed an error code is returned. @emph{Important}: Always check the return code since the domain is not changed in case of an error. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_hinv_estimate_error} @deftypefn Function {int} unur_hinv_estimate_error (const @var{UNUR_GEN* generator}, int @var{samplesize}, double* @var{max_error}, double* @var{MAE}) Estimate maximal u-error and mean absolute error (MAE) for @var{generator} by means of a (quasi-) Monte-Carlo simulation with sample size @var{samplesize}. The results are stored in @var{max_error} and @var{MAE}, respectively. It returns @code{UNUR_SUCCESS} if successful. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_hinv_estimate_error} @deftypefn {} {int} unur_hinv_estimate_error (const @var{UNUR_GEN* generator}, int @var{samplesize}, double* @var{max_error}, double* @var{MAE}) Estimate maximal u-error and mean absolute error (MAE) for @var{generator} by means of a (quasi-) Monte-Carlo simulation with sample size @var{samplesize}. The results are stored in @var{max_error} and @var{MAE}, respectively. It returns @code{UNUR_SUCCESS} if successful. @end deftypefn @end ifnotinfo @c @c end of hinv.h @c ------------------------------------- @c ------------------------------------- @c hrb.h @c @page @node HRB @subsection HRB -- Hazard Rate Bounded @table @i @item Required: bounded hazard rate @item Optional: upper bound for hazard rate @item Speed: Set-up: fast, Sampling: slow @item Reinit: supported @item Reference: @ifhtml @ref{bib:HLD04,, [HLD04: Sect.9.1.4; Alg.9.4]} @end ifhtml @ifnothtml [HLD04: Sect.9.1.4; Alg.9.4] @end ifnothtml @end table Generates random variate with given hazard rate which must be bounded from above. It uses the thinning method with a constant dominating hazard function. @subsubheading How To Use HRB requires a hazard function for a continuous distribution together with an upper bound. The latter has to be set using the @ifhtml @ref{funct:unur_hrb_set_upperbound,@command{unur_hrb_set_upperbound}} @end ifhtml @ifnothtml @command{unur_hrb_set_upperbound} @end ifnothtml call. If no such upper bound is given it is assumed that the upper bound can be achieved by evaluating the hazard rate at the left hand boundary of the domain of the distribution. Notice, however, that for decreasing hazard rate the method HRD (@pxref{HRD,,Hazard Rate Decreasing}) is much faster and thus the prefered method. It is important to note that the domain of the distribution can be set via a @ifhtml @ref{funct:unur_distr_cont_set_domain,@command{unur_distr_cont_set_domain}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_domain} @end ifnothtml call. However, the left border must not be negative. Otherwise it is set to @code{0}. This is also the default if no domain is given at all. For computational reasons the right border is always set to @code{UNUR_INFINITY} independently of the given domain. Thus for domains bounded from right the function for computing the hazard rate should return @code{UNUR_INFINITY} right of this domain. For distributions with increasing hazard rate method HRI (@pxref{HRI,,Hazard Rate Increasing}) is required. It is possible to change the parameters and the domain of the chosen distribution and run @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml to reinitialize the generator object. Notice, that the upper bound given by the @ifhtml @ref{funct:unur_hrb_set_upperbound,@command{unur_hrb_set_upperbound}} @end ifhtml @ifnothtml @command{unur_hrb_set_upperbound} @end ifnothtml call cannot be changed and must be valid for the changed distribution. @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_hrb_new,unur_hrb_new} @item @ref{funct:unur_hrb_set_upperbound,unur_hrb_set_upperbound} @item @ref{funct:unur_hrb_set_verify,unur_hrb_set_verify} @item @ref{funct:unur_hrb_chg_verify,unur_hrb_chg_verify} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_hrb_new} @deftypefn Function {UNUR_PAR*} unur_hrb_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_hrb_new} @deftypefn {} {UNUR_PAR*} unur_hrb_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_hrb_set_upperbound} @deftypefn Function {int} unur_hrb_set_upperbound (UNUR_PAR* @var{parameters}, double @var{upperbound}) Set upper bound for hazard rate. If this call is not used it is assumed that the the maximum of the hazard rate is achieved at the left hand boundary of the domain of the distribution. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_hrb_set_upperbound} @deftypefn {} {int} unur_hrb_set_upperbound (UNUR_PAR* @var{parameters}, double @var{upperbound}) Set upper bound for hazard rate. If this call is not used it is assumed that the the maximum of the hazard rate is achieved at the left hand boundary of the domain of the distribution. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_hrb_set_verify} @anchor{funct:unur_hrb_chg_verify} @deftypefn Function {int} unur_hrb_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) @deftypefnx Function {int} unur_hrb_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) Turn verifying of algorithm while sampling on/off. If the hazard rate is not bounded by the given bound, then @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. Default is @code{FALSE}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_hrb_set_verify} @anchor{funct:unur_hrb_chg_verify} @deftypefn {} {int} unur_hrb_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) @deftypefnx {} {int} unur_hrb_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) Turn verifying of algorithm while sampling on/off. If the hazard rate is not bounded by the given bound, then @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. Default is @code{FALSE}. @end deftypefn @end ifnotinfo @c @c end of hrb.h @c ------------------------------------- @c ------------------------------------- @c hrd.h @c @page @node HRD @subsection HRD -- Hazard Rate Decreasing @table @i @item Required: decreasing (non-increasing) hazard rate @item Speed: Set-up: fast, Sampling: slow @item Reinit: supported @item Reference: @ifhtml @ref{bib:HLD04,, [HLD04: Sect.9.1.5; Alg.9.5]} @end ifhtml @ifnothtml [HLD04: Sect.9.1.5; Alg.9.5] @end ifnothtml @end table Generates random variate with given non-increasing hazard rate. It is necessary that the distribution object contains this hazard rate. Decreasing hazard rate implies that the corresponding PDF of the distribution has heavier tails than the exponential distribution (which has constant hazard rate). @subsubheading How To Use HRD requires a hazard function for a continuous distribution with non-increasing hazard rate. There are no parameters for this method. It is important to note that the domain of the distribution can be set via a @ifhtml @ref{funct:unur_distr_cont_set_domain,@command{unur_distr_cont_set_domain}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_domain} @end ifnothtml call. However, only the left hand boundary is used. For computational reasons the right hand boundary is always reset to @code{UNUR_INFINITY}. If no domain is given by the user then the left hand boundary is set to @code{0}. For distributions which do not have decreasing hazard rates but are bounded from above use method HRB (@pxref{HRB,,Hazard Rate Bounded}). For distributions with increasing hazard rate method HRI (@pxref{HRI,,Hazard Rate Increasing}) is required. It is possible to change the parameters and the domain of the chosen distribution and run @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml to reinitialize the generator object. @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_hrd_new,unur_hrd_new} @item @ref{funct:unur_hrd_set_verify,unur_hrd_set_verify} @item @ref{funct:unur_hrd_chg_verify,unur_hrd_chg_verify} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_hrd_new} @deftypefn Function {UNUR_PAR*} unur_hrd_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_hrd_new} @deftypefn {} {UNUR_PAR*} unur_hrd_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_hrd_set_verify} @anchor{funct:unur_hrd_chg_verify} @deftypefn Function {int} unur_hrd_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) @deftypefnx Function {int} unur_hrd_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) Turn verifying of algorithm while sampling on/off. If the hazard rate is not bounded by the given bound, then @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. Default is @code{FALSE}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_hrd_set_verify} @anchor{funct:unur_hrd_chg_verify} @deftypefn {} {int} unur_hrd_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) @deftypefnx {} {int} unur_hrd_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) Turn verifying of algorithm while sampling on/off. If the hazard rate is not bounded by the given bound, then @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. Default is @code{FALSE}. @end deftypefn @end ifnotinfo @c @c end of hrd.h @c ------------------------------------- @c ------------------------------------- @c hri.h @c @page @node HRI @subsection HRI -- Hazard Rate Increasing @table @i @item Required: increasing (non-decreasing) hazard rate @item Speed: Set-up: fast, Sampling: slow @item Reinit: supported @item Reference: @ifhtml @ref{bib:HLD04,, [HLD04: Sect.9.1.6; Alg.9.6]} @end ifhtml @ifnothtml [HLD04: Sect.9.1.6; Alg.9.6] @end ifnothtml @end table Generates random variate with given non-increasing hazard rate. It is necessary that the distribution object contains this hazard rate. Increasing hazard rate implies that the corresponding PDF of the distribution has heavier tails than the exponential distribution (which has constant hazard rate). The method uses a decomposition of the hazard rate into a main part which is constant for all @i{x} beyond some point @i{p0} and a remaining part. From both of these parts points are sampled using the thinning method and the minimum of both is returned. Sampling from the first part is easier as we have a constant dominating hazard rate. Thus @i{p0} should be large. On the other hand, if @i{p0} is large than the thinning algorithm needs many iteration. Thus the performance of the the algorithm deponds on the choice of @i{p0}. We found that values close to the expectation of the generated distribution result in good performance. @subsubheading How To Use HRI requires a hazard function for a continuous distribution with non-decreasing hazard rate. The parameter @i{p0} should be set to a value close to the expectation of the required distribution using @ifhtml @ref{funct:unur_hri_set_p0,@command{unur_hri_set_p0}.} @end ifhtml @ifnothtml @command{unur_hri_set_p0}. @end ifnothtml If performance is crucial one may try other values as well. It is important to note that the domain of the distribution can be set via a @ifhtml @ref{funct:unur_distr_cont_set_domain,@command{unur_distr_cont_set_domain}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_domain} @end ifnothtml call. However, only the left hand boundary is used. For computational reasons the right hand boundary is always reset to @code{UNUR_INFINITY}. If no domain is given by the user then the left hand boundary is set to @code{0}. For distributions with decreasing hazard rate method HRD (@pxref{HRI,,Hazard Rate Decreasing}) is required. For distributions which do not have increasing or decreasing hazard rates but are bounded from above use method HRB (@pxref{HRB,,Hazard Rate Bounded}). It is possible to change the parameters and the domain of the chosen distribution and run @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml to reinitialize the generator object. Notice, that the upper bound given by the @ifhtml @ref{funct:unur_hrb_set_upperbound,@command{unur_hrb_set_upperbound}} @end ifhtml @ifnothtml @command{unur_hrb_set_upperbound} @end ifnothtml call cannot be changed and must be valid for the changed distribution. Notice that the parameter @i{p0} which has been set by a @ifhtml @ref{funct:unur_hri_set_p0,@command{unur_hri_set_p0}} @end ifhtml @ifnothtml @command{unur_hri_set_p0} @end ifnothtml call cannot be changed and must be valid for the changed distribution. @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_hri_new,unur_hri_new} @item @ref{funct:unur_hri_set_p0,unur_hri_set_p0} @item @ref{funct:unur_hri_set_verify,unur_hri_set_verify} @item @ref{funct:unur_hri_chg_verify,unur_hri_chg_verify} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_hri_new} @deftypefn Function {UNUR_PAR*} unur_hri_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_hri_new} @deftypefn {} {UNUR_PAR*} unur_hri_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_hri_set_p0} @deftypefn Function {int} unur_hri_set_p0 (UNUR_PAR* @var{parameters}, double @var{p0}) Set design point for algorithm. It is used to split the domain of the distribution. Values for @var{p0} close to the expectation of the distribution results in a relatively good performance of the algorithm. It is important that the hazard rate at this point must be greater than @code{0} and less than @code{UNUR_INFINITY}. Default: left boundary of domain + @code{1.} @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_hri_set_p0} @deftypefn {} {int} unur_hri_set_p0 (UNUR_PAR* @var{parameters}, double @var{p0}) Set design point for algorithm. It is used to split the domain of the distribution. Values for @var{p0} close to the expectation of the distribution results in a relatively good performance of the algorithm. It is important that the hazard rate at this point must be greater than @code{0} and less than @code{UNUR_INFINITY}. Default: left boundary of domain + @code{1.} @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_hri_set_verify} @anchor{funct:unur_hri_chg_verify} @deftypefn Function {int} unur_hri_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) @deftypefnx Function {int} unur_hri_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) Turn verifying of algorithm while sampling on/off. If the hazard rate is not bounded by the given bound, then @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. Default is @code{FALSE}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_hri_set_verify} @anchor{funct:unur_hri_chg_verify} @deftypefn {} {int} unur_hri_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) @deftypefnx {} {int} unur_hri_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) Turn verifying of algorithm while sampling on/off. If the hazard rate is not bounded by the given bound, then @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. Default is @code{FALSE}. @end deftypefn @end ifnotinfo @c @c end of hri.h @c ------------------------------------- @c ------------------------------------- @c itdr.h @c @page @node ITDR @subsection ITDR -- Inverse Transformed Density Rejection @table @i @item Required: monotone PDF, dPDF, pole @item Optional: splitting point between pole and tail region, c-values @item Speed: Set-up: moderate, Sampling: moderate @item Reinit: supported @item Reference: @ifhtml @ref{bib:HLDa07,, [HLDa07]} @end ifhtml @ifnothtml [HLDa07] @end ifnothtml @end table ITDR is an acceptance/rejection method that works for monotone densities. It is especially designed for PDFs with a single pole. It uses different hat functions for the pole region and for the tail region. For the tail region @emph{Transformed Density Rejection} with a single construction point is used. For the pole region a variant called @emph{Inverse Transformed Density Rejection} is used. The optimal splitting point between the two regions and the respective maximum local concavity and inverse local concavity (@pxref{Glossary}) that guarantee valid hat functions for each regions are estimated. This splitting point is set to the intersection point of local concavity and inverse local concavity. However, it is assumed that both, the local concavity and the inverse local concavity do not have a local minimum in the interior of the domain (which is the case for all standard distributions with a single pole). In other cases (or when the built-in search routines do not compute non-optimal values) one can provide the splitting point, and the @i{c}-values. @subsubheading How To Use Method ITDR requires a distribution object with given PDF and its derivative and the location of the pole (or mode). The PDF must be monotone and may contain a pole. It must be set via the @ifhtml @ref{funct:unur_distr_cont_set_pdf,@command{unur_distr_cont_set_pdf}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_pdf} @end ifnothtml and @ifhtml @ref{funct:unur_distr_cont_set_dpdf,@command{unur_distr_cont_set_dpdf}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_dpdf} @end ifnothtml calls. The PDF should return UNUR_INFINITY for the pole. Alternatively, one can also set the logarithm of the PDF and its derivative via the @ifhtml @ref{funct:unur_distr_cont_set_logpdf,@command{unur_distr_cont_set_logpdf}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_logpdf} @end ifnothtml and @ifhtml @ref{funct:unur_distr_cont_set_dlogpdf,@command{unur_distr_cont_set_dlogpdf}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_dlogpdf} @end ifnothtml calls. This is in especially useful since then the setup and search routines are numerically more stable. Moreover, for many distributions computing the logarithm of the PDF is less expensive then computing the PDF directly. The pole of the distribution is given by a @ifhtml @ref{funct:unur_distr_cont_set_mode,@command{unur_distr_cont_set_mode}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_mode} @end ifnothtml call. Notice that distributions with ``heavy'' poles may have numerical problems caused by the resultion of the floating point numbers used by computers. While the minimal distance between two different floating point numbers is about @code{1.e-320} near @code{0.} it increases to @code{1.e-16} near @code{1.} Thus any random variate generator implemented on a digital computer in fact draws samples from a discrete distribution that approximates the desired continuous distribution. For distributions with ``heavy'' poles not at 0 this approximation may be too crude and thus every goodness-of-fit test will fail. Besides this theoretic problem that cannot be resolved we have to take into consideration that round-off errors occur more frequently when we have PDFs with poles far away from @code{0.} Method ITDR tries to handles this situation as good as possible by moving the pole into @code{0.} Thus do not use a wrapper for your PDF that hides this shift since the information about the resolution of the floating point numbers near the pole gets lost. Method ITDR uses different hats for the pole region and for the tail region. The splitting point between these two regions, the optimal @i{c}-value and design points for constructing the hats using Transformed Density Rejection are computed automatically. (The results of these computations can be read using the respective calls @ifhtml @ref{funct:unur_itdr_get_xi,@command{unur_itdr_get_xi},} @end ifhtml @ifnothtml @command{unur_itdr_get_xi}, @end ifnothtml @ifhtml @ref{funct:unur_itdr_get_cp,@command{unur_itdr_get_cp}} @end ifhtml @ifnothtml @command{unur_itdr_get_cp} @end ifnothtml , and @ifhtml @ref{funct:unur_itdr_get_ct,@command{unur_itdr_get_ct}} @end ifhtml @ifnothtml @command{unur_itdr_get_ct} @end ifnothtml for the intersection point between local concavity and inverse local concavity, the @i{c}-value for the pole and the tail region.) However, one can also analyze the local concavity and inverse local concavity set the corresponding values using @ifhtml @ref{funct:unur_itdr_set_xi,@command{unur_itdr_set_xi},} @end ifhtml @ifnothtml @command{unur_itdr_set_xi}, @end ifnothtml @ifhtml @ref{funct:unur_itdr_set_cp,@command{unur_itdr_set_cp}} @end ifhtml @ifnothtml @command{unur_itdr_set_cp} @end ifnothtml , and @ifhtml @ref{funct:unur_itdr_set_ct,@command{unur_itdr_set_ct}} @end ifhtml @ifnothtml @command{unur_itdr_set_ct} @end ifnothtml calls. Notice, that @i{c}-values greater than -1/2 can be set to @code{-0.5}. Although this results in smaller acceptance probabities sampling from the hat distribution is much faster than for other values of @i{c}. Depending on the expenses of evaluating the PDF the resulting algorithm is usually faster. It is possible to change the parameters and the domain of the chosen distribution and run @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml to reinitialize the generator object. However, the values given by @ifhtml @ref{funct:unur_itdr_set_xi,@command{unur_itdr_set_xi},} @end ifhtml @ifnothtml @command{unur_itdr_set_xi}, @end ifnothtml @ifhtml @ref{funct:unur_itdr_set_cp,@command{unur_itdr_set_cp}} @end ifhtml @ifnothtml @command{unur_itdr_set_cp} @end ifnothtml , or @ifhtml @ref{funct:unur_itdr_set_ct,@command{unur_itdr_set_ct}} @end ifhtml @ifnothtml @command{unur_itdr_set_ct} @end ifnothtml calls are then ignored when @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml is called. @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_itdr_new,unur_itdr_new} @item @ref{funct:unur_itdr_set_xi,unur_itdr_set_xi} @item @ref{funct:unur_itdr_set_cp,unur_itdr_set_cp} @item @ref{funct:unur_itdr_set_ct,unur_itdr_set_ct} @item @ref{funct:unur_itdr_get_xi,unur_itdr_get_xi} @item @ref{funct:unur_itdr_get_cp,unur_itdr_get_cp} @item @ref{funct:unur_itdr_get_ct,unur_itdr_get_ct} @item @ref{funct:unur_itdr_get_area,unur_itdr_get_area} @item @ref{funct:unur_itdr_set_verify,unur_itdr_set_verify} @item @ref{funct:unur_itdr_chg_verify,unur_itdr_chg_verify} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_itdr_new} @deftypefn Function {UNUR_PAR*} unur_itdr_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_itdr_new} @deftypefn {} {UNUR_PAR*} unur_itdr_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_itdr_set_xi} @deftypefn Function {int} unur_itdr_set_xi (UNUR_PAR* @var{parameters}, double @var{xi}) Sets points where local concavity and inverse local concavity are (almost) equal. It is used to estimate the respective c-values for pole region and hat regions and to determine the splitting point @i{bx} between pole and tail region. If no such point is provided it will be computed automatically. Default: not set. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_itdr_set_xi} @deftypefn {} {int} unur_itdr_set_xi (UNUR_PAR* @var{parameters}, double @var{xi}) Sets points where local concavity and inverse local concavity are (almost) equal. It is used to estimate the respective c-values for pole region and hat regions and to determine the splitting point @i{bx} between pole and tail region. If no such point is provided it will be computed automatically. Default: not set. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_itdr_set_cp} @deftypefn Function {int} unur_itdr_set_cp (UNUR_PAR* @var{parameters}, double @var{cp}) Sets parameter @var{cp} for transformation T for inverse density in pole region. It must be at most 0 and greater than -1. A value of @code{-0.5} is treated separately and usually results in faster marginal generation time (at the expense of smaller acceptance probabilities. If no @var{cp}-value is given it is estimated automatically. Default: not set. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_itdr_set_cp} @deftypefn {} {int} unur_itdr_set_cp (UNUR_PAR* @var{parameters}, double @var{cp}) Sets parameter @var{cp} for transformation T for inverse density in pole region. It must be at most 0 and greater than -1. A value of @code{-0.5} is treated separately and usually results in faster marginal generation time (at the expense of smaller acceptance probabilities. If no @var{cp}-value is given it is estimated automatically. Default: not set. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_itdr_set_ct} @deftypefn Function {int} unur_itdr_set_ct (UNUR_PAR* @var{parameters}, double @var{ct}) Sets parameter @var{ct} for transformation T for density in tail region. It must be at most 0. For densities with unbounded domain it must be greater than -1. A value of @code{-0.5} is treated separately and usually results in faster marginal generation time (at the expense of smaller acceptance probabilities. If no @var{ct}-value is given it is estimated automatically. Default: not set. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_itdr_set_ct} @deftypefn {} {int} unur_itdr_set_ct (UNUR_PAR* @var{parameters}, double @var{ct}) Sets parameter @var{ct} for transformation T for density in tail region. It must be at most 0. For densities with unbounded domain it must be greater than -1. A value of @code{-0.5} is treated separately and usually results in faster marginal generation time (at the expense of smaller acceptance probabilities. If no @var{ct}-value is given it is estimated automatically. Default: not set. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_itdr_get_xi} @anchor{funct:unur_itdr_get_cp} @anchor{funct:unur_itdr_get_ct} @deftypefn Function {double} unur_itdr_get_xi (UNUR_GEN* @var{generator}) @deftypefnx Function {double} unur_itdr_get_cp (UNUR_GEN* @var{generator}) @deftypefnx Function {double} unur_itdr_get_ct (UNUR_GEN* @var{generator}) Get intersection point @var{xi}, and c-values @var{cp} and @var{ct}, respectively. (In case of an error @code{UNUR_INFINITY} is returned.) @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_itdr_get_xi} @anchor{funct:unur_itdr_get_cp} @anchor{funct:unur_itdr_get_ct} @deftypefn {} {double} unur_itdr_get_xi (UNUR_GEN* @var{generator}) @deftypefnx {} {double} unur_itdr_get_cp (UNUR_GEN* @var{generator}) @deftypefnx {} {double} unur_itdr_get_ct (UNUR_GEN* @var{generator}) Get intersection point @var{xi}, and c-values @var{cp} and @var{ct}, respectively. (In case of an error @code{UNUR_INFINITY} is returned.) @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_itdr_get_area} @deftypefn Function {double} unur_itdr_get_area (UNUR_GEN* @var{generator}) Get area below hat. (In case of an error @code{UNUR_INFINITY} is returned.) @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_itdr_get_area} @deftypefn {} {double} unur_itdr_get_area (UNUR_GEN* @var{generator}) Get area below hat. (In case of an error @code{UNUR_INFINITY} is returned.) @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_itdr_set_verify} @deftypefn Function {int} unur_itdr_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) Turn verifying of algorithm while sampling on/off. If the condition @math{PDF(x) <= hat(x)} is violated for some @i{x} then @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. However, notice that this might happen due to round-off errors for a few values of @i{x} (less than 1%). Default is @code{FALSE}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_itdr_set_verify} @deftypefn {} {int} unur_itdr_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) Turn verifying of algorithm while sampling on/off. If the condition @iftex @math{PDF(x) \leq hat(x)} @end iftex @ifhtml @html PDF(x) <= hat(x) @end html @end ifhtml is violated for some @i{x} then @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. However, notice that this might happen due to round-off errors for a few values of @i{x} (less than 1%). Default is @code{FALSE}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_itdr_chg_verify} @deftypefn Function {int} unur_itdr_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) Change the verifying of algorithm while sampling on/off. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_itdr_chg_verify} @deftypefn {} {int} unur_itdr_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) Change the verifying of algorithm while sampling on/off. @end deftypefn @end ifnotinfo @c @c end of itdr.h @c ------------------------------------- @c ------------------------------------- @c ninv.h @c @page @node NINV @subsection NINV -- Numerical INVersion @table @i @item Required: CDF @item Optional: PDF @item Speed: Set-up: optional, Sampling: (very) slow @item Reinit: supported @end table NINV implementations of some methods for numerical inversion: Newton's method, regula falsi (combined with interval bisectioning), and bisection method. Regula falsi and bisection method require only the CDF while Newton's method also requires the PDF. To speed up marginal generation times a table with suitable starting points can be created during the setup. The performance of the algorithm can adjusted by the desired accuracy of the method. It is possible to use this method for generating from truncated distributions. The truncated domain can be changed for an existing generator object. @subsubheading How To Use Method NINV generates random variates by numerical inversion and requires a continuous univariate distribution objects with given CDF. Three variants are available: @itemize @minus @item Regula falsi [default] @item Newton's method @item Interval bisectioning @end itemize Newton's method additionally requires the PDF of the distribution and cannot be used otherwise (NINV automatically switches to regula falsi then). Default algorithm is regula falsi. It is slightly slower but numerically much more stable than Newton's algorithm. Interval bisectioning is the slowest method and should only be considered as a last resort when the other methods fails. It is possible to draw samples from truncated distributions. The truncated domain can even be changed for an existing generator object by an @ifhtml @ref{funct:unur_ninv_chg_truncated,@command{unur_ninv_chg_truncated}} @end ifhtml @ifnothtml @command{unur_ninv_chg_truncated} @end ifnothtml call. Marginal generation times can be sped up by means of a table with suitable starting points which can be created during the setup. Using such a table can be switched on by means of a @ifhtml @ref{funct:unur_ninv_set_table,@command{unur_ninv_set_table}} @end ifhtml @ifnothtml @command{unur_ninv_set_table} @end ifnothtml call where the table size is given as a parameter. The table is still useful when the (truncated) domain is changed often, since it is computed for the domain of the given distribution. (It is not possible to enlarge this domain.) If it is necessary to recalculate the table during sampling, the command @ifhtml @ref{funct:unur_ninv_chg_table,@command{unur_ninv_chg_table}} @end ifhtml @ifnothtml @command{unur_ninv_chg_table} @end ifnothtml can be used. As a rule of thumb using such a table is appropriate when the number of generated points exceeds the table size by a factor of 100. The default number of iterations of NINV should be enough for all reasonable cases. Nevertheless, it is possible to adjust the maximal number of iterations with the commands @ifhtml @ref{funct:unur_ninv_set_max_iter,@command{unur_ninv_set_max_iter}} @end ifhtml @ifnothtml @command{unur_ninv_set_max_iter} @end ifnothtml and @ifhtml @ref{funct:unur_ninv_chg_max_iter,@command{unur_ninv_chg_max_iter}.} @end ifhtml @ifnothtml @command{unur_ninv_chg_max_iter}. @end ifnothtml In particular this might be necessary when the PDF has a pole or the distribution has extremely heavy tails. It is also possible to set/change the accuracy of the method (which also heavily influencies the generation time). We use two measures for the approximation error which can be used independently: x-error and u-error (@pxref{Inversion} for more details). It is possible to set the maximal tolerated error using with @ifhtml @ref{funct:unur_ninv_set_x_resolution,@command{unur_ninv_set_x_resolution}} @end ifhtml @ifnothtml @command{unur_ninv_set_x_resolution} @end ifnothtml and with @ifhtml @ref{funct:unur_ninv_set_u_resolution,@command{unur_ninv_set_u_resolution},} @end ifhtml @ifnothtml @command{unur_ninv_set_u_resolution}, @end ifnothtml resp., and change it with the respective calls @ifhtml @ref{funct:unur_ninv_chg_x_resolution,@command{unur_ninv_chg_x_resolution}} @end ifhtml @ifnothtml @command{unur_ninv_chg_x_resolution} @end ifnothtml and @ifhtml @ref{funct:unur_ninv_chg_x_resolution,@command{unur_ninv_chg_x_resolution}.} @end ifhtml @ifnothtml @command{unur_ninv_chg_x_resolution}. @end ifnothtml The algorithm tries to satisfy @emph{both} accuracy goals (and raises an error flag it this fails). One of these accuracy checks can be disabled by setting the accuracy goal to a negative value. NINV tries to use proper starting values for both the regula falsi and bisection method, and for Newton's method. Of course the user might have more knowledge about the properties of the target distribution and is able to share his wisdom with NINV using the respective commands @ifhtml @ref{funct:unur_ninv_set_start,@command{unur_ninv_set_start}} @end ifhtml @ifnothtml @command{unur_ninv_set_start} @end ifnothtml and @ifhtml @ref{funct:unur_ninv_chg_start,@command{unur_ninv_chg_start}.} @end ifhtml @ifnothtml @command{unur_ninv_chg_start}. @end ifnothtml It is possible to change the parameters and the domain of the chosen distribution and run @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml to reinitialize the generator object. The values given by the last @ifhtml @ref{funct:unur_ninv_chg_truncated,@command{unur_ninv_chg_truncated}} @end ifhtml @ifnothtml @command{unur_ninv_chg_truncated} @end ifnothtml call will be then changed to the values of the domain of the underlying distribution object. It is important to note that for a distribution from the UNU.RAN library of standard distributions (@pxref{Stddist,,Standard distributions}) the normalization constant has to be updated using the @ifhtml @ref{funct:unur_distr_cont_upd_pdfarea,@command{unur_distr_cont_upd_pdfarea}} @end ifhtml @ifnothtml @command{unur_distr_cont_upd_pdfarea} @end ifnothtml call whenever its parameters have been changed by means of a @ifhtml @ref{funct:unur_distr_cont_set_pdfparams,@command{unur_distr_cont_set_pdfparams}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_pdfparams} @end ifnothtml call. It might happen that NINV aborts @ifhtml @ref{funct:unur_sample_cont,@command{unur_sample_cont}} @end ifhtml @ifnothtml @command{unur_sample_cont} @end ifnothtml without computing the correct value (because the maximal number iterations has been exceeded). Then the last approximate value for @i{x} is returned (with might be fairly false) and @code{unur_error} is set to @code{UNUR_ERR_GEN_SAMPLING}. @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_ninv_new,unur_ninv_new} @item @ref{funct:unur_ninv_set_useregula,unur_ninv_set_useregula} @item @ref{funct:unur_ninv_set_usenewton,unur_ninv_set_usenewton} @item @ref{funct:unur_ninv_set_usebisect,unur_ninv_set_usebisect} @item @ref{funct:unur_ninv_set_max_iter,unur_ninv_set_max_iter} @item @ref{funct:unur_ninv_chg_max_iter,unur_ninv_chg_max_iter} @item @ref{funct:unur_ninv_set_x_resolution,unur_ninv_set_x_resolution} @item @ref{funct:unur_ninv_chg_x_resolution,unur_ninv_chg_x_resolution} @item @ref{funct:unur_ninv_set_u_resolution,unur_ninv_set_u_resolution} @item @ref{funct:unur_ninv_chg_u_resolution,unur_ninv_chg_u_resolution} @item @ref{funct:unur_ninv_set_start,unur_ninv_set_start} @item @ref{funct:unur_ninv_chg_start,unur_ninv_chg_start} @item @ref{funct:unur_ninv_set_table,unur_ninv_set_table} @item @ref{funct:unur_ninv_chg_table,unur_ninv_chg_table} @item @ref{funct:unur_ninv_chg_truncated,unur_ninv_chg_truncated} @item @ref{funct:unur_ninv_eval_approxinvcdf,unur_ninv_eval_approxinvcdf} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_ninv_new} @deftypefn Function {UNUR_PAR*} unur_ninv_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_ninv_new} @deftypefn {} {UNUR_PAR*} unur_ninv_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_ninv_set_useregula} @deftypefn Function {int} unur_ninv_set_useregula (UNUR_PAR* @var{parameters}) Switch to regula falsi combined with interval bisectioning. (This the default.) @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_ninv_set_useregula} @deftypefn {} {int} unur_ninv_set_useregula (UNUR_PAR* @var{parameters}) Switch to regula falsi combined with interval bisectioning. (This the default.) @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_ninv_set_usenewton} @deftypefn Function {int} unur_ninv_set_usenewton (UNUR_PAR* @var{parameters}) Switch to Newton's method. Notice that it is numerically less stable than regula falsi. It it is not possible to invert the CDF for a particular uniform random number @i{U} when calling @ifhtml @ref{funct:unur_sample_cont,@command{unur_sample_cont},} @end ifhtml @ifnothtml @command{unur_sample_cont}, @end ifnothtml @code{unur_error} is set to @code{UNUR_ERR_GEN_SAMPLING}. Thus it is recommended to check @code{unur_error} before using the result of the sampling routine. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_ninv_set_usenewton} @deftypefn {} {int} unur_ninv_set_usenewton (UNUR_PAR* @var{parameters}) Switch to Newton's method. Notice that it is numerically less stable than regula falsi. It it is not possible to invert the CDF for a particular uniform random number @i{U} when calling @ifhtml @ref{funct:unur_sample_cont,@command{unur_sample_cont},} @end ifhtml @ifnothtml @command{unur_sample_cont}, @end ifnothtml @code{unur_error} is set to @code{UNUR_ERR_GEN_SAMPLING}. Thus it is recommended to check @code{unur_error} before using the result of the sampling routine. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_ninv_set_usebisect} @deftypefn Function {int} unur_ninv_set_usebisect (UNUR_PAR* @var{parameters}) Switch to bisection method. This is a slow algorithm and should only be used as a last resort. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_ninv_set_usebisect} @deftypefn {} {int} unur_ninv_set_usebisect (UNUR_PAR* @var{parameters}) Switch to bisection method. This is a slow algorithm and should only be used as a last resort. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_ninv_set_max_iter} @anchor{funct:unur_ninv_chg_max_iter} @deftypefn Function {int} unur_ninv_set_max_iter (UNUR_PAR* @var{parameters}, int @var{max_iter}) @deftypefnx Function {int} unur_ninv_chg_max_iter (UNUR_GEN* @var{generator}, int @var{max_iter}) Set and change number of maximal iterations. Default is @code{100}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_ninv_set_max_iter} @anchor{funct:unur_ninv_chg_max_iter} @deftypefn {} {int} unur_ninv_set_max_iter (UNUR_PAR* @var{parameters}, int @var{max_iter}) @deftypefnx {} {int} unur_ninv_chg_max_iter (UNUR_GEN* @var{generator}, int @var{max_iter}) Set and change number of maximal iterations. Default is @code{100}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_ninv_set_x_resolution} @anchor{funct:unur_ninv_chg_x_resolution} @deftypefn Function {int} unur_ninv_set_x_resolution (UNUR_PAR* @var{parameters}, double @var{x_resolution}) @deftypefnx Function {int} unur_ninv_chg_x_resolution (UNUR_GEN* @var{generator}, double @var{x_resolution}) Set and change the maximal tolerated relative x-error. If @var{x_resolution} is negative then checking of the x-error is disabled. Default is @code{1.e-8}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_ninv_set_x_resolution} @anchor{funct:unur_ninv_chg_x_resolution} @deftypefn {} {int} unur_ninv_set_x_resolution (UNUR_PAR* @var{parameters}, double @var{x_resolution}) @deftypefnx {} {int} unur_ninv_chg_x_resolution (UNUR_GEN* @var{generator}, double @var{x_resolution}) Set and change the maximal tolerated relative x-error. If @var{x_resolution} is negative then checking of the x-error is disabled. Default is @code{1.e-8}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_ninv_set_u_resolution} @anchor{funct:unur_ninv_chg_u_resolution} @deftypefn Function {int} unur_ninv_set_u_resolution (UNUR_PAR* @var{parameters}, double @var{u_resolution}) @deftypefnx Function {int} unur_ninv_chg_u_resolution (UNUR_GEN* @var{generator}, double @var{u_resolution}) Set and change the maximal tolerated (abolute) u-error. If @var{u_resolution} is negative then checking of the u-error is disabled. Default is @code{-1} (disabled). @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_ninv_set_u_resolution} @anchor{funct:unur_ninv_chg_u_resolution} @deftypefn {} {int} unur_ninv_set_u_resolution (UNUR_PAR* @var{parameters}, double @var{u_resolution}) @deftypefnx {} {int} unur_ninv_chg_u_resolution (UNUR_GEN* @var{generator}, double @var{u_resolution}) Set and change the maximal tolerated (abolute) u-error. If @var{u_resolution} is negative then checking of the u-error is disabled. Default is @code{-1} (disabled). @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_ninv_set_start} @deftypefn Function {int} unur_ninv_set_start (UNUR_PAR* @var{parameters}, double @var{left}, double @var{right}) Set starting points. If not set, suitable values are chosen automatically. @multitable @columnfractions 0.2 0.2 0.6 @item Newton: @tab @var{left}: @tab starting point @item Regula falsi: @tab @var{left}, @var{right}: @tab boundary of starting interval @end multitable If the starting points are not set then the follwing points are used by default: @multitable @columnfractions 0.2 0.2 0.6 @item Newton: @tab @var{left}: @tab CDF(@var{left}) = 0.5 @item Regula falsi: @tab @var{left}: @tab CDF(@var{left}) = 0.1 @item @tab @var{right}: @tab CDF(@var{right}) = 0.9 @end multitable If @var{left} == @var{right}, then UNU.RAN always uses the default starting points! @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_ninv_set_start} @deftypefn {} {int} unur_ninv_set_start (UNUR_PAR* @var{parameters}, double @var{left}, double @var{right}) Set starting points. If not set, suitable values are chosen automatically. @multitable @columnfractions 0.2 0.2 0.6 @item Newton: @tab @var{left}: @tab starting point @item Regula falsi: @tab @var{left}, @var{right}: @tab boundary of starting interval @end multitable If the starting points are not set then the follwing points are used by default: @multitable @columnfractions 0.2 0.2 0.6 @item Newton: @tab @var{left}: @tab CDF(@var{left}) = 0.5 @item Regula falsi: @tab @var{left}: @tab CDF(@var{left}) = 0.1 @item @tab @var{right}: @tab CDF(@var{right}) = 0.9 @end multitable If @var{left} == @var{right}, then UNU.RAN always uses the default starting points! @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_ninv_chg_start} @deftypefn Function {int} unur_ninv_chg_start (UNUR_GEN* @var{gen}, double @var{left}, double @var{right}) Change the starting points for numerical inversion. If left==right, then UNU.RAN uses the default starting points (see @ifhtml @ref{funct:unur_ninv_set_start,@command{unur_ninv_set_start}} @end ifhtml @ifnothtml @command{unur_ninv_set_start} @end ifnothtml ). @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_ninv_chg_start} @deftypefn {} {int} unur_ninv_chg_start (UNUR_GEN* @var{gen}, double @var{left}, double @var{right}) Change the starting points for numerical inversion. If left==right, then UNU.RAN uses the default starting points (see @ifhtml @ref{funct:unur_ninv_set_start,@command{unur_ninv_set_start}} @end ifhtml @ifnothtml @command{unur_ninv_set_start} @end ifnothtml ). @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_ninv_set_table} @deftypefn Function {int} unur_ninv_set_table (UNUR_PAR* @var{parameters}, int @var{no_of_points}) Generates a table with @var{no_of_points} points containing suitable starting values for the iteration. The value of @var{no_of_points} must be at least 10 (otherwise it will be set to 10 automatically). The table points are chosen such that the CDF at these points form an equidistance sequence in the interval (0,1). If a table is used, then the starting points given by @ifhtml @ref{funct:unur_ninv_set_start,@command{unur_ninv_set_start}} @end ifhtml @ifnothtml @command{unur_ninv_set_start} @end ifnothtml are ignored. No table is used by default. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_ninv_set_table} @deftypefn {} {int} unur_ninv_set_table (UNUR_PAR* @var{parameters}, int @var{no_of_points}) Generates a table with @var{no_of_points} points containing suitable starting values for the iteration. The value of @var{no_of_points} must be at least 10 (otherwise it will be set to 10 automatically). The table points are chosen such that the CDF at these points form an equidistance sequence in the interval (0,1). If a table is used, then the starting points given by @ifhtml @ref{funct:unur_ninv_set_start,@command{unur_ninv_set_start}} @end ifhtml @ifnothtml @command{unur_ninv_set_start} @end ifnothtml are ignored. No table is used by default. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_ninv_chg_table} @deftypefn Function {int} unur_ninv_chg_table (UNUR_GEN* @var{gen}, int @var{no_of_points}) Recomputes a table as described in @ifhtml @ref{funct:unur_ninv_set_table,@command{unur_ninv_set_table}.} @end ifhtml @ifnothtml @command{unur_ninv_set_table}. @end ifnothtml @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_ninv_chg_table} @deftypefn {} {int} unur_ninv_chg_table (UNUR_GEN* @var{gen}, int @var{no_of_points}) Recomputes a table as described in @ifhtml @ref{funct:unur_ninv_set_table,@command{unur_ninv_set_table}.} @end ifhtml @ifnothtml @command{unur_ninv_set_table}. @end ifnothtml @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_ninv_chg_truncated} @deftypefn Function {int} unur_ninv_chg_truncated (UNUR_GEN* @var{gen}, double @var{left}, double @var{right}) Changes the borders of the domain of the (truncated) distribution. Notice that the given truncated domain must be a subset of the domain of the given distribution. The generator always uses the intersection of the domain of the distribution and the truncated domain given by this call. Moreover the starting point(s) will not be changed. @emph{Important:} If the CDF is (almost) the same for @var{left} and @var{right} and (almost) equal to @code{0} or @code{1}, then the truncated domain is @emph{not} chanced and the call returns an error code. @emph{Notice:} If the parameters of the distribution has been changed by a @ifhtml @ref{funct:unur_distr_cont_set_pdfparams,@command{unur_distr_cont_set_pdfparams}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_pdfparams} @end ifnothtml call it is recommended to set the truncated domain again, since the former call might change the domain of the distribution but not update the values for the boundaries of the truncated distribution. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_ninv_chg_truncated} @deftypefn {} {int} unur_ninv_chg_truncated (UNUR_GEN* @var{gen}, double @var{left}, double @var{right}) Changes the borders of the domain of the (truncated) distribution. Notice that the given truncated domain must be a subset of the domain of the given distribution. The generator always uses the intersection of the domain of the distribution and the truncated domain given by this call. Moreover the starting point(s) will not be changed. @emph{Important:} If the CDF is (almost) the same for @var{left} and @var{right} and (almost) equal to @code{0} or @code{1}, then the truncated domain is @emph{not} chanced and the call returns an error code. @emph{Notice:} If the parameters of the distribution has been changed by a @ifhtml @ref{funct:unur_distr_cont_set_pdfparams,@command{unur_distr_cont_set_pdfparams}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_pdfparams} @end ifnothtml call it is recommended to set the truncated domain again, since the former call might change the domain of the distribution but not update the values for the boundaries of the truncated distribution. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_ninv_eval_approxinvcdf} @deftypefn Function {double} unur_ninv_eval_approxinvcdf (const @var{UNUR_GEN* generator}, double @var{u}) Get approximate approximate value of inverse CDF at @var{u}. If @var{u} is out of the domain [0,1] then @code{unur_errno} is set to @code{UNUR_ERR_DOMAIN} and the respective bound of the domain of the distribution are returned (which is @code{-UNUR_INFINITY} or @code{UNUR_INFINITY} in the case of unbounded domains). @emph{Notice}: This function always evaluates the inverse CDF of the given distribution. A call to @ifhtml @ref{funct:unur_ninv_chg_truncated,@command{unur_ninv_chg_truncated}} @end ifhtml @ifnothtml @command{unur_ninv_chg_truncated} @end ifnothtml call has no effect. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_ninv_eval_approxinvcdf} @deftypefn {} {double} unur_ninv_eval_approxinvcdf (const @var{UNUR_GEN* generator}, double @var{u}) Get approximate approximate value of inverse CDF at @var{u}. If @var{u} is out of the domain [0,1] then @code{unur_errno} is set to @code{UNUR_ERR_DOMAIN} and the respective bound of the domain of the distribution are returned (which is @code{-UNUR_INFINITY} or @code{UNUR_INFINITY} in the case of unbounded domains). @emph{Notice}: This function always evaluates the inverse CDF of the given distribution. A call to @ifhtml @ref{funct:unur_ninv_chg_truncated,@command{unur_ninv_chg_truncated}} @end ifhtml @ifnothtml @command{unur_ninv_chg_truncated} @end ifnothtml call has no effect. @end deftypefn @end ifnotinfo @c @c end of ninv.h @c ------------------------------------- @c ------------------------------------- @c nrou.h @c @page @node NROU @subsection NROU -- Naive Ratio-Of-Uniforms method @table @i @item Required: PDF @item Optional: mode, center, bounding rectangle for acceptance region @item Speed: Set-up: slow or fast, Sampling: moderate @item Reinit: supported @item Reference: @ifhtml @ref{bib:HLD04,, [HLD04: Sect.2.4 and Sect.6.4]} @end ifhtml @ifnothtml [HLD04: Sect.2.4 and Sect.6.4] @end ifnothtml @end table NROU is an implementation of the (generalized) ratio-of-uniforms method which uses (minimal) bounding rectangles, see @ref{Ratio-of-Uniforms}. It uses a positive control parameter @i{r} for adjusting the algorithm to the given distribution to improve performance and/or to make this method applicable. Larger values of @i{r} increase the class of distributions for which the method works at the expense of a higher rejection constant. For computational reasons @i{r=1} should be used if possible (this is the default). Moreover, this implementation uses the center @iftex @math{\mu} @end iftex @ifhtml @html mu @end html @end ifhtml @ifinfo @math{mu} @end ifinfo of the distribution (see @ifhtml @ref{funct:unur_distr_cont_get_center,@command{unur_distr_cont_get_center}} @end ifhtml @ifnothtml @command{unur_distr_cont_get_center} @end ifnothtml for details of its default values). For the special case with @iftex @math{r=1} @end iftex @ifhtml @html r=1 @end html @end ifhtml @ifinfo @math{r=1} @end ifinfo the coordinates of the minimal bounding rectangles are given by @iftex @quotation @math{ v^+ = \sup\limits_{x} \sqrt{PDF(x)}, \hfil\break u^- = \inf\limits_{x} (x-\mu) \sqrt{PDF(x)}, \hfil\break u^+ = \sup\limits_{x} (x-\mu) \sqrt{PDF(x)}, } @end quotation @end iftex @ifhtml @quotation @html v+ = sup_x sqrt(PDF(x)), @*u- = inf_x (x- mu) sqrt(PDF(x)), @*u+ = sup_x (x- mu) sqrt(PDF(x)), @end html @end quotation @end ifhtml @ifinfo @quotation @math{v^+ = sup_(x) sqrt(PDF(x)), @*u^- = inf_(x) (x- mu) sqrt(PDF(x)), @*u^+ = sup_(x) (x- mu) sqrt(PDF(x)),} @end quotation @end ifinfo @noindent where @iftex @math{\mu} @end iftex @ifhtml @html mu @end html @end ifhtml @ifinfo @math{mu} @end ifinfo is the center of the distribution. For other values of @i{r} we have @iftex @quotation @math{ v^+ = \sup\limits_{x} (PDF(x))^{1/(r+1)}, \hfil\break u^- = \inf\limits_{x} (x-\mu) (PDF(x))^{r/(r+1)}, \hfil\break u^+ = \sup\limits_{x} (x-\mu) (PDF(x))^{r/(r+1)}. } @end quotation @end iftex @ifhtml @quotation @html v+ = sup_x (PDF(x))1/(r+1), @*u- = inf_x (x- mu) (PDF(x))r/(r+1), @*u+ = sup_x (x- mu) (PDF(x))r/(r+1). @end html @end quotation @end ifhtml @ifinfo @quotation @math{v^+ = sup_(x) (PDF(x))^(1/(r+1)), @*u^- = inf_(x) (x- mu) (PDF(x))^(r/(r+1)), @*u^+ = sup_(x) (x- mu) (PDF(x))^(r/(r+1)).} @end quotation @end ifinfo @noindent These bounds can be given directly. Otherwise they are computed automatically by means of a (slow) numerical routine. Of course this routine can fail, especially when this rectangle is not bounded. It is important to note that the algorithm works with @iftex @math{PDF(x-\mu)} @end iftex @ifhtml @html PDF(x- mu) @end html @end ifhtml @ifinfo @math{PDF(x- mu)} @end ifinfo instead of @iftex @math{PDF(x).} @end iftex @ifhtml @html PDF(x). @end html @end ifhtml @ifinfo @math{PDF(x).} @end ifinfo This is important as otherwise the acceptance region can become a very long and skinny ellipsoid along a diagonal of the (huge) bounding rectangle. @subsubheading How To Use For using the NROU method UNU.RAN needs the PDF of the distribution. Additionally, the parameter @i{r} can be set via a @ifhtml @ref{funct:unur_vnrou_set_r,@command{unur_vnrou_set_r}} @end ifhtml @ifnothtml @command{unur_vnrou_set_r} @end ifnothtml call. Notice that the acceptance probability decreases when @i{r} is increased. On the other hand is is more unlikely that the bounding rectangle does not exist if @i{r} is small. A bounding rectangle can be given by the @ifhtml @ref{funct:unur_vnrou_set_u,@command{unur_vnrou_set_u}} @end ifhtml @ifnothtml @command{unur_vnrou_set_u} @end ifnothtml and @ifhtml @ref{funct:unur_vnrou_set_v,@command{unur_vnrou_set_v}} @end ifhtml @ifnothtml @command{unur_vnrou_set_v} @end ifnothtml calls. @emph{Important:} The bounding rectangle has to be provided for the function @iftex @math{PDF(x-center)!} @end iftex @ifhtml @html PDF(x-center)! @end html @end ifhtml @ifinfo @math{PDF(x-center)!} @end ifinfo Notice that @code{center} is the center of the given distribution, see @ifhtml @ref{funct:unur_distr_cont_set_center,@command{unur_distr_cont_set_center}.} @end ifhtml @ifnothtml @command{unur_distr_cont_set_center}. @end ifnothtml If in doubt or if this value is not optimal, it can be changed (overridden) by a @ifhtml @ref{funct:unur_nrou_set_center,@command{unur_nrou_set_center}} @end ifhtml @ifnothtml @command{unur_nrou_set_center} @end ifnothtml call. If the coordinates of the bounding rectangle are not provided by the user then the minimal bounding rectangle is computed automatically. By means of @ifhtml @ref{funct:unur_vnrou_set_verify,@command{unur_vnrou_set_verify}} @end ifhtml @ifnothtml @command{unur_vnrou_set_verify} @end ifnothtml and @ifhtml @ref{funct:unur_vnrou_chg_verify,@command{unur_vnrou_chg_verify}} @end ifhtml @ifnothtml @command{unur_vnrou_chg_verify} @end ifnothtml one can run the sampling algorithm in a checking mode, i.e., in every cycle of the rejection loop it is checked whether the used rectangle indeed enclosed the acceptance region of the distribution. When in doubt (e.g., when it is not clear whether the numerical routine has worked correctly) this can be used to run a small Monte Carlo study. It is possible to change the parameters and the domain of the chosen distribution and run @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml to reinitialize the generator object. Notice, that derived parameters like the mode must also be (re-) set if the parameters or the domain has be changed. Notice, however, that then the values that has been set by @ifhtml @ref{funct:unur_vnrou_set_u,@command{unur_vnrou_set_u}} @end ifhtml @ifnothtml @command{unur_vnrou_set_u} @end ifnothtml and @ifhtml @ref{funct:unur_vnrou_set_v,@command{unur_vnrou_set_v}} @end ifhtml @ifnothtml @command{unur_vnrou_set_v} @end ifnothtml calls are removed and the coordinates of the bounding box are computed numerically. @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_nrou_new,unur_nrou_new} @item @ref{funct:unur_nrou_set_u,unur_nrou_set_u} @item @ref{funct:unur_nrou_set_v,unur_nrou_set_v} @item @ref{funct:unur_nrou_set_r,unur_nrou_set_r} @item @ref{funct:unur_nrou_set_center,unur_nrou_set_center} @item @ref{funct:unur_nrou_set_verify,unur_nrou_set_verify} @item @ref{funct:unur_nrou_chg_verify,unur_nrou_chg_verify} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_nrou_new} @deftypefn Function {UNUR_PAR*} unur_nrou_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_nrou_new} @deftypefn {} {UNUR_PAR*} unur_nrou_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_nrou_set_u} @deftypefn Function {int} unur_nrou_set_u (UNUR_PAR* @var{parameters}, double @var{umin}, double @var{umax}) Sets left and right boundary of bounding rectangle. If no values are given, the boundary of the minimal bounding rectangle is computed numerically. @emph{Notice}: Computing the minimal bounding rectangle may fail under some circumstances. Moreover, for multimodal distributions the bounds might be too small as only local extrema are computed. Nevertheless, for @math{T_c} -concave distributions with @math{c=-1/2} it should work. @emph{Important:} The bounding rectangle that has to be provided is for the function @math{PDF(x-center)!} Default: not set. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_nrou_set_u} @deftypefn {} {int} unur_nrou_set_u (UNUR_PAR* @var{parameters}, double @var{umin}, double @var{umax}) Sets left and right boundary of bounding rectangle. If no values are given, the boundary of the minimal bounding rectangle is computed numerically. @emph{Notice}: Computing the minimal bounding rectangle may fail under some circumstances. Moreover, for multimodal distributions the bounds might be too small as only local extrema are computed. Nevertheless, for @iftex @math{T_c} @end iftex @ifhtml @html T_c @end html @end ifhtml -concave distributions with @iftex @math{c=-1/2} @end iftex @ifhtml @html c=-1/2 @end html @end ifhtml it should work. @emph{Important:} The bounding rectangle that has to be provided is for the function @iftex @math{PDF(x-center)!} @end iftex @ifhtml @html PDF(x-center)! @end html @end ifhtml Default: not set. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_nrou_set_v} @deftypefn Function {int} unur_nrou_set_v (UNUR_PAR* @var{parameters}, double @var{vmax}) Set upper boundary for bounding rectangle. If this value is not given then @math{sqrt(PDF(mode))} is used instead. @emph{Notice}: When the mode is not given for the distribution object, then it will be computed numerically. Default: not set. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_nrou_set_v} @deftypefn {} {int} unur_nrou_set_v (UNUR_PAR* @var{parameters}, double @var{vmax}) Set upper boundary for bounding rectangle. If this value is not given then @iftex @math{\sqrt{PDF(mode)}} @end iftex @ifhtml @html sqrt(PDF(mode)) @end html @end ifhtml is used instead. @emph{Notice}: When the mode is not given for the distribution object, then it will be computed numerically. Default: not set. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_nrou_set_r} @deftypefn Function {int} unur_nrou_set_r (UNUR_PAR* @var{parameters}, double @var{r}) Sets the parameter @var{r} of the generalized ratio-of-uniforms method. @emph{Notice}: This parameter must satisfy @var{r}>0. Default: @code{1}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_nrou_set_r} @deftypefn {} {int} unur_nrou_set_r (UNUR_PAR* @var{parameters}, double @var{r}) Sets the parameter @var{r} of the generalized ratio-of-uniforms method. @emph{Notice}: This parameter must satisfy @var{r}>0. Default: @code{1}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_nrou_set_center} @deftypefn Function {int} unur_nrou_set_center (UNUR_PAR* @var{parameters}, double @var{center}) Set the center @math{mu} of the PDF. If not set the center of the given distribution object is used. Default: see @ifhtml @ref{funct:unur_distr_cont_set_center,@command{unur_distr_cont_set_center}.} @end ifhtml @ifnothtml @command{unur_distr_cont_set_center}. @end ifnothtml @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_nrou_set_center} @deftypefn {} {int} unur_nrou_set_center (UNUR_PAR* @var{parameters}, double @var{center}) Set the center @iftex @math{\mu} @end iftex @ifhtml @html mu @end html @end ifhtml of the PDF. If not set the center of the given distribution object is used. Default: see @ifhtml @ref{funct:unur_distr_cont_set_center,@command{unur_distr_cont_set_center}.} @end ifhtml @ifnothtml @command{unur_distr_cont_set_center}. @end ifnothtml @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_nrou_set_verify} @deftypefn Function {int} unur_nrou_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) Turn verifying of algorithm while sampling on/off. If the condition @math{PDF(x) <= hat(x)} is violated for some @i{x} then @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. However, notice that this might happen due to round-off errors for a few values of @i{x} (less than 1%). Default is @code{FALSE}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_nrou_set_verify} @deftypefn {} {int} unur_nrou_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) Turn verifying of algorithm while sampling on/off. If the condition @iftex @math{PDF(x) \leq hat(x)} @end iftex @ifhtml @html PDF(x) <= hat(x) @end html @end ifhtml is violated for some @i{x} then @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. However, notice that this might happen due to round-off errors for a few values of @i{x} (less than 1%). Default is @code{FALSE}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_nrou_chg_verify} @deftypefn Function {int} unur_nrou_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) Change the verifying of algorithm while sampling on/off. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_nrou_chg_verify} @deftypefn {} {int} unur_nrou_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) Change the verifying of algorithm while sampling on/off. @end deftypefn @end ifnotinfo @c @c end of nrou.h @c ------------------------------------- @c ------------------------------------- @c pinv.h @c @page @node PINV @subsection PINV -- Polynomial interpolation based INVersion of CDF @table @i @item Required: PDF @item Optional: domain, center, CDF, derivative of PDF @item Speed: Set-up: (very) slow, Sampling: (very) fast @item Reinit: not implemented @item Reference: @ifhtml @ref{bib:DHLa08,, [DHLa08]} @end ifhtml @ifnothtml [DHLa08] @end ifnothtml @end table PINV is a variant of numerical inversion, where the inverse CDF is approximated using Newton's interpolating formula. The interval [0,1] is split into several subintervals. In each of these the inverse CDF is constructed at nodes @iftex @math{(CDF(x),x)} @end iftex @ifhtml @html (CDF(x),x) @end html @end ifhtml @ifinfo @math{(CDF(x),x)} @end ifinfo for some points @i{x} in this subinterval. If the PDF is given, then the CDF is computed numerically from the given PDF using adaptive Gauss-Lobatto integration with 5 points. Subintervals are split until the requested accuracy goal is reached. The method is not exact, as it only produces random variates of the approximated distribution. Nevertheless, the maximal tolerated approximation error can be set to be the resolution (but of course is bounded by the machine precision). We use the u-error @iftex @math{|U-CDF(X)|} @end iftex @ifhtml @html |U-CDF(X)| @end html @end ifhtml @ifinfo @math{|U-CDF(X)|} @end ifinfo to measure the error for @i{X} = "approximate inverse CDF"(@i{U}). Notice that very small values of the u-resolution are possible but increase the cost for the setup step. We call the maximal tolerated u-error the @emph{u-resolution} of the algorithm in the sequel. Both the order of the interpolating polynomial and the u-resolution can be selected. The interpolating polynomials have to be computed in a setup step. However, it only works for distributions with bounded domain; for distributions with unbounded domain the tails are cut off such that the probability for the tail regions is small compared to the given u-resolution. The construction of the interpolation polynomial only works when the PDF is unimodal or when the PDF does not vanish between two modes. There are some restrictions for the given distribution: @itemize @item The support of the distribution (i.e., the region where the PDF is strictly positive) must be connected. In practice this means, that the region where PDF is "not too small" must be connected. Unimodal densities satisfy this condition. If this condition is violated then the domain of the distribution might be truncated. @item When the PDF is integrated numerically, then the given PDF must be continuous and should be smooth. @item The PDF must be bounded. @item The algorithm has problems when the distribution has heavy tails (as then the inverse CDF becomes very steep at 0 or 1) and the requested u-resolution is very small. E.g., the Cauchy distribution is likely to show this problem when the requested u-resolution is less then @code{1.e-12}. @end itemize Regions with very small PDF values or heavy tails might lead to an abortion of the set-up or (even worse) the approximation error might become larger than requested, since the (computation of the) interpolating polynomial becomes numerically unstable. @emph{Remark:} We also have implemented experimental variants. However, we observed that these variants are more sensitive to round-off errors, especially in the right hand tail and we @emph{do not recommend} their usage unless there are severe reasons. @itemize @minus @item Use a function that implements the CDF instead of numerical integration of the PDF. @item Use Hermite interpolation instead of Newton interpolation. Thus the first (and second) derivative of the interpolating polynomial coincides with that of the inverse CDF. Consequently the interpolant is also (twice) differentiable even at the interval boundaries. This variant can be seen as limiting case of Newton interpolation with double (or triple) points as nodes. We have used a @emph{smoothness} parameter to control this feature. However, besides numerical problems we observed that this variant requires more intervals and thus larger setup times and higher memory consumptions. @end itemize @subsubheading How To Use PINV works for continuous univariate distribution objects with given PDF. The corresponding distribution object should contain a typical point of the distribution, i.e., a point where the PDF is not too small, e.g., (a point near) the mode. However, it is important that the center is @strong{not} the pole of the distribution (or a point too close to the pole). It can be set using a @ifhtml @ref{funct:unur_distr_cont_set_center,@command{unur_distr_cont_set_center}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_center} @end ifnothtml or a @ifhtml @ref{funct:unur_distr_cont_set_mode,@command{unur_distr_cont_set_mode}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_mode} @end ifnothtml call. If neither is set, or if the given center cannot be used, then a simple search routine tries to find an appropriate point for the center. It is recommended that the domain of the distribution with bounded domain is specified using a @ifhtml @ref{funct:unur_distr_cont_set_domain,@command{unur_distr_cont_set_domain}} @end ifhtml @ifnothtml @command{unur_distr_cont_set_domain} @end ifnothtml call. Otherwise, the boundary is searched numerically which might be rather expensive, especially when this boundary point is @code{0}. The inverse CDF is interpolated using Newton polynomials. The order of this polynomial can be set by means of a @ifhtml @ref{funct:unur_pinv_set_order,@command{unur_pinv_set_order}} @end ifhtml @ifnothtml @command{unur_pinv_set_order} @end ifnothtml call. The smoothness of the interpolant at interval boundaries can be controlled using a @ifhtml @ref{funct:unur_pinv_set_smoothness,@command{unur_pinv_set_smoothness}} @end ifhtml @ifnothtml @command{unur_pinv_set_smoothness} @end ifnothtml call. Then Hermite interpolation instead of Newton interpolation is used. (The former can be seen as a limiting case of Newton interpolation with double (or triple) points.) However, using higher smoothness is @emph{not recommended} unless differentiability at the interval boundaries is important. For distributions with unbounded domains the tails are cut off such that the probability for the tail regions is small compared to the given u-resolution. For finding these cut points the algorithm starts with the region @code{[-1.e100,1.e100]}. For the exceptional case where this does not work these starting points can be changed via a @ifhtml @ref{funct:unur_pinv_set_boundary,@command{unur_pinv_set_boundary}} @end ifhtml @ifnothtml @command{unur_pinv_set_boundary} @end ifnothtml call. This method is not exact, as it only produces random variates of the approximated distribution. Nevertheless, the numerical error in "u-direction" (i.e., |U-CDF(X)|, for X = "approximate inverse CDF"(U) |U-CDF(X)|) can be controlled by means of @ifhtml @ref{funct:unur_pinv_set_u_resolution,@command{unur_pinv_set_u_resolution}.} @end ifhtml @ifnothtml @command{unur_pinv_set_u_resolution}. @end ifnothtml However, the maximal error of this approximation is only estimated. For very small u-resolutions the actual approximation error might be (slightly) larger than the requested u-resolution. (Of course the size of this value depends on the given PDF.) If this error is crucial for an application we recommend to compute this error using @ifhtml @ref{funct:unur_pinv_estimate_error,@command{unur_pinv_estimate_error}} @end ifhtml @ifnothtml @command{unur_pinv_estimate_error} @end ifnothtml which runs a small Monte Carlo simulation. It is also possible to improve the error estimate during setup by means of @ifhtml @ref{funct:unur_pinv_set_extra_testpoints,@command{unur_pinv_set_extra_testpoints}.} @end ifhtml @ifnothtml @command{unur_pinv_set_extra_testpoints}. @end ifnothtml See also the documentation for function @ifhtml @ref{funct:unur_pinv_set_u_resolution,@command{unur_pinv_set_u_resolution}} @end ifhtml @ifnothtml @command{unur_pinv_set_u_resolution} @end ifnothtml and the remark given there. The number of required subintervals heavily depends on the order of the interpolating polynomial and the requested u-resolution: it increases when order or u-resolution are decreased. It can be checked using a @ifhtml @ref{funct:unur_pinv_get_n_intervals,@command{unur_pinv_get_n_intervals}} @end ifhtml @ifnothtml @command{unur_pinv_get_n_intervals} @end ifnothtml call. The maximum number of such subintervals is fixed but can be increased using a @ifhtml @ref{funct:unur_pinv_set_max_intervals,@command{unur_pinv_set_max_intervals}} @end ifhtml @ifnothtml @command{unur_pinv_set_max_intervals} @end ifnothtml call. If this maximum number is too small then the set-up aborts with a corresponding error message. It is also possible to use the CDF of the distribution instead of the PDF. Then the distribution object must contain a pointer to the CDF. Moreover, this variant of the algorithm has to be switched on using an @ifhtml @ref{funct:unur_pinv_set_usecdf,@command{unur_pinv_set_usecdf}} @end ifhtml @ifnothtml @command{unur_pinv_set_usecdf} @end ifnothtml call. Notice, however, that the setup for this variant is numerically less stable than using integration of the PDF (the default variant). Thus using the CDF is @emph{not recommended}. @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_pinv_new,unur_pinv_new} @item @ref{funct:unur_pinv_set_order,unur_pinv_set_order} @item @ref{funct:unur_pinv_set_smoothness,unur_pinv_set_smoothness} @item @ref{funct:unur_pinv_set_u_resolution,unur_pinv_set_u_resolution} @item @ref{funct:unur_pinv_set_extra_testpoints,unur_pinv_set_extra_testpoints} @item @ref{funct:unur_pinv_set_use_upoints,unur_pinv_set_use_upoints} @item @ref{funct:unur_pinv_set_usepdf,unur_pinv_set_usepdf} @item @ref{funct:unur_pinv_set_usecdf,unur_pinv_set_usecdf} @item @ref{funct:unur_pinv_set_boundary,unur_pinv_set_boundary} @item @ref{funct:unur_pinv_set_searchboundary,unur_pinv_set_searchboundary} @item @ref{funct:unur_pinv_set_max_intervals,unur_pinv_set_max_intervals} @item @ref{funct:unur_pinv_get_n_intervals,unur_pinv_get_n_intervals} @item @ref{funct:unur_pinv_set_keepcdf,unur_pinv_set_keepcdf} @item @ref{funct:unur_pinv_eval_approxinvcdf,unur_pinv_eval_approxinvcdf} @item @ref{funct:unur_pinv_eval_approxcdf,unur_pinv_eval_approxcdf} @item @ref{funct:unur_pinv_estimate_error,unur_pinv_estimate_error} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_pinv_new} @deftypefn Function {UNUR_PAR*} unur_pinv_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_pinv_new} @deftypefn {} {UNUR_PAR*} unur_pinv_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_pinv_set_order} @deftypefn Function {int} unur_pinv_set_order (UNUR_PAR* @var{parameters}, int @var{order}) Set order of interpolation. Valid orders are between @code{3} and @code{17}. Higher orders result in fewer intervals for the approximations. Default: @code{5}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_pinv_set_order} @deftypefn {} {int} unur_pinv_set_order (UNUR_PAR* @var{parameters}, int @var{order}) Set order of interpolation. Valid orders are between @code{3} and @code{17}. Higher orders result in fewer intervals for the approximations. Default: @code{5}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_pinv_set_smoothness} @deftypefn Function {int} unur_pinv_set_smoothness (UNUR_PAR* @var{parameters}, int @var{smoothness}) Set smoothness of interpolant. By construction the interpolant is piecewise polynomial and thus smooth on each of the intervals where these polynomials are constructed. At the interval boundaries, however, it usually not be differentiable. Method PINV also implements variants of Newton interpolation where the first (or second) derivative of the interpolating polynomial coincides with the respective derivative of the inverse CDF at the nodes. The the interpolant is (twice) differentiable even at the interval boundaries. These variants can be seen as limiting case of Newton interpolation with double (or triple) points as nodes and are known as Hermite interpolation. Possible values for @var{smoothness}: @multitable @columnfractions .1 .25 .60 @headitem Value @tab Effect @tab Requirements @item @code{0} @tab continuous @tab requires PDF (or CDF) @item @code{1} @tab differentiable @tab requires PDF (optional: CDF), @* order of polynomial must be odd @item @code{2} @tab twice differentiable @tab requires PDF and its derivative (optional: CDF), @* order must be 5, 8, 11, 14 or 17 @end multitable If the order of the polynomial does not satisfy the given condition, then it is increased to the next larger possible value. @emph{Remark:} A higher smoothness parameter usually results in a higher number of intervals and thus a higher setup time and memory consumption. We also observed that higher smoothness parameters make the algorithm more sensible for round-off error. Then the setup fails. @emph{Remark:} If the interpolating polynomial cannot be constructed for the requested smoothness on a particular interval, then the smoothness parameter is reduced for that interval. @emph{Remark:} For order @code{3} and smoothness @code{1} (cubic Hermite interpolation) monotonicity is guaranteed by checking a simple monotonicity condition for the coefficients of the polynomials. @emph{Remark:} Using @var{smoothness} larger than @code{0} is @emph{not recommended} unless differentiability at the interval boundaries is important for ones application. Default: @code{0}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_pinv_set_smoothness} @deftypefn {} {int} unur_pinv_set_smoothness (UNUR_PAR* @var{parameters}, int @var{smoothness}) Set smoothness of interpolant. By construction the interpolant is piecewise polynomial and thus smooth on each of the intervals where these polynomials are constructed. At the interval boundaries, however, it usually not be differentiable. Method PINV also implements variants of Newton interpolation where the first (or second) derivative of the interpolating polynomial coincides with the respective derivative of the inverse CDF at the nodes. The the interpolant is (twice) differentiable even at the interval boundaries. These variants can be seen as limiting case of Newton interpolation with double (or triple) points as nodes and are known as Hermite interpolation. Possible values for @var{smoothness}: @multitable @columnfractions .1 .25 .60 @headitem Value @tab Effect @tab Requirements @item @code{0} @tab continuous @tab requires PDF (or CDF) @item @code{1} @tab differentiable @tab requires PDF (optional: CDF), @* order of polynomial must be odd @item @code{2} @tab twice differentiable @tab requires PDF and its derivative (optional: CDF), @* order must be 5, 8, 11, 14 or 17 @end multitable If the order of the polynomial does not satisfy the given condition, then it is increased to the next larger possible value. @emph{Remark:} A higher smoothness parameter usually results in a higher number of intervals and thus a higher setup time and memory consumption. We also observed that higher smoothness parameters make the algorithm more sensible for round-off error. Then the setup fails. @emph{Remark:} If the interpolating polynomial cannot be constructed for the requested smoothness on a particular interval, then the smoothness parameter is reduced for that interval. @emph{Remark:} For order @code{3} and smoothness @code{1} (cubic Hermite interpolation) monotonicity is guaranteed by checking a simple monotonicity condition for the coefficients of the polynomials. @emph{Remark:} Using @var{smoothness} larger than @code{0} is @emph{not recommended} unless differentiability at the interval boundaries is important for ones application. Default: @code{0}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_pinv_set_u_resolution} @deftypefn Function {int} unur_pinv_set_u_resolution (UNUR_PAR* @var{parameters}, double @var{u_resolution}) Set maximal tolerated u-error. Values of @var{u_resolution} must at least @code{1.e-15} and @code{1.e-5} at most. Notice that the resolution of most uniform random number sources is @math{2^(-32)} = @code{2.3e-10}. Thus a value of @code{1.e-10} leads to an inversion algorithm that could be called exact. For most simulations slightly bigger values for the maximal error are enough as well. Smaller values for @var{u_resolution} increase the number of subinterval that are necessary for the approximation of the inverse CDF. For very small values (less then @code{1.e-12}) this number might exceed the maximum number of such intervals. However, this number can be increased using a @ifhtml @ref{funct:unur_pinv_set_max_intervals,@command{unur_pinv_set_max_intervals}} @end ifhtml @ifnothtml @command{unur_pinv_set_max_intervals} @end ifnothtml call. @emph{Remark:} We ran many experiments and found that the observed u-error was always smaller than the given @var{u_resolution} whenever this value was @code{1.e-12}. For values smaller than @code{1e-13} the maximal observed u-error was slightly larger. One use @code{1.e-15} if best approximation is required. However, then the actual u-error can be as large as @code{1.e-14}. Consider calling @ifhtml @ref{funct:unur_pinv_set_extra_testpoints,@command{unur_pinv_set_extra_testpoints}} @end ifhtml @ifnothtml @command{unur_pinv_set_extra_testpoints} @end ifnothtml in order to reduce the risk of larger approximation errors. @strong{Warning!} These figures are based on our experiments (with some tolerance added to be on the safe side). There is no guarantee for these error estimates for a particular distribution. Default is @code{1.e-10}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_pinv_set_u_resolution} @deftypefn {} {int} unur_pinv_set_u_resolution (UNUR_PAR* @var{parameters}, double @var{u_resolution}) Set maximal tolerated u-error. Values of @var{u_resolution} must at least @code{1.e-15} and @code{1.e-5} at most. Notice that the resolution of most uniform random number sources is @iftex @math{2^{-32}} @end iftex @ifhtml @html 2-32 @end html @end ifhtml = @code{2.3e-10}. Thus a value of @code{1.e-10} leads to an inversion algorithm that could be called exact. For most simulations slightly bigger values for the maximal error are enough as well. Smaller values for @var{u_resolution} increase the number of subinterval that are necessary for the approximation of the inverse CDF. For very small values (less then @code{1.e-12}) this number might exceed the maximum number of such intervals. However, this number can be increased using a @ifhtml @ref{funct:unur_pinv_set_max_intervals,@command{unur_pinv_set_max_intervals}} @end ifhtml @ifnothtml @command{unur_pinv_set_max_intervals} @end ifnothtml call. @emph{Remark:} We ran many experiments and found that the observed u-error was always smaller than the given @var{u_resolution} whenever this value was @code{1.e-12}. For values smaller than @code{1e-13} the maximal observed u-error was slightly larger. One use @code{1.e-15} if best approximation is required. However, then the actual u-error can be as large as @code{1.e-14}. Consider calling @ifhtml @ref{funct:unur_pinv_set_extra_testpoints,@command{unur_pinv_set_extra_testpoints}} @end ifhtml @ifnothtml @command{unur_pinv_set_extra_testpoints} @end ifnothtml in order to reduce the risk of larger approximation errors. @strong{Warning!} These figures are based on our experiments (with some tolerance added to be on the safe side). There is no guarantee for these error estimates for a particular distribution. Default is @code{1.e-10}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_pinv_set_extra_testpoints} @deftypefn Function {int} unur_pinv_set_extra_testpoints (UNUR_PAR* @var{parameters}, int @var{n_points}) During setup method PINV checks the current u-error by means of carefully selected test points and improves the approximation where necessary. However, it nevertheless may happen, that the maximal approximation error is larger than estimated in some interval (which usually is hit with a very small probability). This estimate can be improved by using extra test points which can be added by means of this call. However, this increases the setup time considerably. Note that these additional points are selected equidistributed in each subinterval. Default is @code{0} (i.e., no additional test points are used). @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_pinv_set_extra_testpoints} @deftypefn {} {int} unur_pinv_set_extra_testpoints (UNUR_PAR* @var{parameters}, int @var{n_points}) During setup method PINV checks the current u-error by means of carefully selected test points and improves the approximation where necessary. However, it nevertheless may happen, that the maximal approximation error is larger than estimated in some interval (which usually is hit with a very small probability). This estimate can be improved by using extra test points which can be added by means of this call. However, this increases the setup time considerably. Note that these additional points are selected equidistributed in each subinterval. Default is @code{0} (i.e., no additional test points are used). @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_pinv_set_use_upoints} @deftypefn Function {int} unur_pinv_set_use_upoints (UNUR_PAR* @var{parameters}, int @var{use_upoints}) If @var{use_upoints} is @code{TRUE}, then the nodes of the interpolating polynomial are constructed by means of Chebyshev points in u-scale not in x-scale. This results is a better approximation but almost doubles the number of PDF or CDF evaluations during the setup. (This is an experimental feature.) Default: @code{FALSE} @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_pinv_set_use_upoints} @deftypefn {} {int} unur_pinv_set_use_upoints (UNUR_PAR* @var{parameters}, int @var{use_upoints}) If @var{use_upoints} is @code{TRUE}, then the nodes of the interpolating polynomial are constructed by means of Chebyshev points in u-scale not in x-scale. This results is a better approximation but almost doubles the number of PDF or CDF evaluations during the setup. (This is an experimental feature.) Default: @code{FALSE} @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_pinv_set_usepdf} @deftypefn Function {int} unur_pinv_set_usepdf (UNUR_PAR* @var{parameters}) Use PDF (if available) to compute approximate inverse CDF. This is the default. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_pinv_set_usepdf} @deftypefn {} {int} unur_pinv_set_usepdf (UNUR_PAR* @var{parameters}) Use PDF (if available) to compute approximate inverse CDF. This is the default. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_pinv_set_usecdf} @deftypefn Function {int} unur_pinv_set_usecdf (UNUR_PAR* @var{parameters}) Use CDF (if available) to compute approximate inverse CDF. This variant is intend for running experiments with method PINV. @emph{Remark:} We ran many experiments and found that for small values of the given @var{u_resolution} (less than @code{1.e-12}) the setup fails for distributions with heavy tails. We found that using the PDF (instead of the CDF) is numerically more stable. This is especially the case when the smoothness parameter is set to @code{1} or @code{2}. Using the CDF is @strong{not recommended}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_pinv_set_usecdf} @deftypefn {} {int} unur_pinv_set_usecdf (UNUR_PAR* @var{parameters}) Use CDF (if available) to compute approximate inverse CDF. This variant is intend for running experiments with method PINV. @emph{Remark:} We ran many experiments and found that for small values of the given @var{u_resolution} (less than @code{1.e-12}) the setup fails for distributions with heavy tails. We found that using the PDF (instead of the CDF) is numerically more stable. This is especially the case when the smoothness parameter is set to @code{1} or @code{2}. Using the CDF is @strong{not recommended}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_pinv_set_boundary} @deftypefn Function {int} unur_pinv_set_boundary (UNUR_PAR* @var{parameters}, double @var{left}, double @var{right}) Set @var{left} and @var{right} point for finding the cut-off points for the "computational domain", i.e., the domain that covers the essential part of the distribution. The cut-off points are computed such that the tail probabilities are smaller than given by @ifhtml @ref{funct:unur_pinv_set_u_resolution,@command{unur_pinv_set_u_resolution}.} @end ifhtml @ifnothtml @command{unur_pinv_set_u_resolution}. @end ifnothtml It is usually safe to use a large interval. However, @code{+/- UNUR_INFINITY} is not allowed. @emph{Important}: This call does not change the domain of the given distribution itself. But it restricts the domain for the resulting random variates. Default: intersection of @code{[-1.e100,+1.e100]} and the given domain of the distribution. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_pinv_set_boundary} @deftypefn {} {int} unur_pinv_set_boundary (UNUR_PAR* @var{parameters}, double @var{left}, double @var{right}) Set @var{left} and @var{right} point for finding the cut-off points for the "computational domain", i.e., the domain that covers the essential part of the distribution. The cut-off points are computed such that the tail probabilities are smaller than given by @ifhtml @ref{funct:unur_pinv_set_u_resolution,@command{unur_pinv_set_u_resolution}.} @end ifhtml @ifnothtml @command{unur_pinv_set_u_resolution}. @end ifnothtml It is usually safe to use a large interval. However, @code{+/- UNUR_INFINITY} is not allowed. @emph{Important}: This call does not change the domain of the given distribution itself. But it restricts the domain for the resulting random variates. Default: intersection of @code{[-1.e100,+1.e100]} and the given domain of the distribution. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_pinv_set_searchboundary} @deftypefn Function {int} unur_pinv_set_searchboundary (UNUR_PAR* @var{parameters}, int @var{left}, int @var{right}) If @var{left} or @var{right} is set to @code{FALSE} then the respective boundary as given by a @ifhtml @ref{funct:unur_pinv_set_boundary,@command{unur_pinv_set_boundary}} @end ifhtml @ifnothtml @command{unur_pinv_set_boundary} @end ifnothtml call is used without any further computations. However, these boundary points might cause numerical problems during the setup when PDF returns @code{0} ``almost everywhere''. If set to @code{TRUE} (the default) then the computational interval is shortened to a more sensible region by means of a search algorithm. Switching off this search is useful, e.g., for the Gamma(2) distribution where the left border @code{0} is fixed and finite. @emph{Remark:} The searching algorithm assumes that the support of the distribution is connected. @emph{Remark:} Do not set this parameter to @code{FALSE} except when searching for cut-off points fails and one wants to try with precomputed values. Default: @code{TRUE}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_pinv_set_searchboundary} @deftypefn {} {int} unur_pinv_set_searchboundary (UNUR_PAR* @var{parameters}, int @var{left}, int @var{right}) If @var{left} or @var{right} is set to @code{FALSE} then the respective boundary as given by a @ifhtml @ref{funct:unur_pinv_set_boundary,@command{unur_pinv_set_boundary}} @end ifhtml @ifnothtml @command{unur_pinv_set_boundary} @end ifnothtml call is used without any further computations. However, these boundary points might cause numerical problems during the setup when PDF returns @code{0} ``almost everywhere''. If set to @code{TRUE} (the default) then the computational interval is shortened to a more sensible region by means of a search algorithm. Switching off this search is useful, e.g., for the Gamma(2) distribution where the left border @code{0} is fixed and finite. @emph{Remark:} The searching algorithm assumes that the support of the distribution is connected. @emph{Remark:} Do not set this parameter to @code{FALSE} except when searching for cut-off points fails and one wants to try with precomputed values. Default: @code{TRUE}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_pinv_set_max_intervals} @deftypefn Function {int} unur_pinv_set_max_intervals (UNUR_PAR* @var{parameters}, int @var{max_ivs}) Set maximum number of intervals. @var{max_ivs} must be at least @code{100} and at most @code{1000000}. Default is @code{10000}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_pinv_set_max_intervals} @deftypefn {} {int} unur_pinv_set_max_intervals (UNUR_PAR* @var{parameters}, int @var{max_ivs}) Set maximum number of intervals. @var{max_ivs} must be at least @code{100} and at most @code{1000000}. Default is @code{10000}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_pinv_get_n_intervals} @deftypefn Function {int} unur_pinv_get_n_intervals (const @var{UNUR_GEN* generator}) Get number of intervals used for interpolation in the generator object. It returns @code{0} in case of an error. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_pinv_get_n_intervals} @deftypefn {} {int} unur_pinv_get_n_intervals (const @var{UNUR_GEN* generator}) Get number of intervals used for interpolation in the generator object. It returns @code{0} in case of an error. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_pinv_set_keepcdf} @deftypefn Function {int} unur_pinv_set_keepcdf (UNUR_PAR* @var{parameters}, int @var{keepcdf}) If the PDF is given, then the CDF is computed numerically from the given PDF using adaptive Gauss-Lobatto integration. Thus a table of CDF points is stored to keep the number of evaluations of the PDF minimal. Usually this table is discarded when the setup is completed. If @var{keepcdf} is @code{TRUE}, then this table is kept and can be used to compute the CDF of the underlying distribution by means of function @ifhtml @ref{funct:unur_pinv_eval_approxcdf,@command{unur_pinv_eval_approxcdf}.} @end ifhtml @ifnothtml @command{unur_pinv_eval_approxcdf}. @end ifnothtml This option is ignored when @ifhtml @ref{funct:unur_pinv_set_usecdf,@command{unur_pinv_set_usecdf}} @end ifhtml @ifnothtml @command{unur_pinv_set_usecdf} @end ifnothtml is called. Default: @code{FALSE} @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_pinv_set_keepcdf} @deftypefn {} {int} unur_pinv_set_keepcdf (UNUR_PAR* @var{parameters}, int @var{keepcdf}) If the PDF is given, then the CDF is computed numerically from the given PDF using adaptive Gauss-Lobatto integration. Thus a table of CDF points is stored to keep the number of evaluations of the PDF minimal. Usually this table is discarded when the setup is completed. If @var{keepcdf} is @code{TRUE}, then this table is kept and can be used to compute the CDF of the underlying distribution by means of function @ifhtml @ref{funct:unur_pinv_eval_approxcdf,@command{unur_pinv_eval_approxcdf}.} @end ifhtml @ifnothtml @command{unur_pinv_eval_approxcdf}. @end ifnothtml This option is ignored when @ifhtml @ref{funct:unur_pinv_set_usecdf,@command{unur_pinv_set_usecdf}} @end ifhtml @ifnothtml @command{unur_pinv_set_usecdf} @end ifnothtml is called. Default: @code{FALSE} @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_pinv_eval_approxinvcdf} @deftypefn Function {double} unur_pinv_eval_approxinvcdf (const @var{UNUR_GEN* generator}, double @var{u}) Evaluate interpolation of inverse CDF at @var{u}. If @var{u} is out of the domain (0,1) then @code{unur_errno} is set to @code{UNUR_ERR_DOMAIN} and the respective bound of the domain of the distribution are returned (which is @code{-UNUR_INFINITY} or @code{UNUR_INFINITY} in the case of unbounded domains). @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_pinv_eval_approxinvcdf} @deftypefn {} {double} unur_pinv_eval_approxinvcdf (const @var{UNUR_GEN* generator}, double @var{u}) Evaluate interpolation of inverse CDF at @var{u}. If @var{u} is out of the domain (0,1) then @code{unur_errno} is set to @code{UNUR_ERR_DOMAIN} and the respective bound of the domain of the distribution are returned (which is @code{-UNUR_INFINITY} or @code{UNUR_INFINITY} in the case of unbounded domains). @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_pinv_eval_approxcdf} @deftypefn Function {double} unur_pinv_eval_approxcdf (const @var{UNUR_GEN* generator}, double @var{x}) Evaluate (approximate) CDF at @var{x}. If the PDF of the distribution is given, then adaptive Gauss-Lobatto integration is used to compute the CDF. If the PDF is used to create the generator object, then the table of integral values must not removed at the end of setup and thus @ifhtml @ref{funct:unur_pinv_set_keepcdf,@command{unur_pinv_set_keepcdf}} @end ifhtml @ifnothtml @command{unur_pinv_set_keepcdf} @end ifnothtml must be called. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_pinv_eval_approxcdf} @deftypefn {} {double} unur_pinv_eval_approxcdf (const @var{UNUR_GEN* generator}, double @var{x}) Evaluate (approximate) CDF at @var{x}. If the PDF of the distribution is given, then adaptive Gauss-Lobatto integration is used to compute the CDF. If the PDF is used to create the generator object, then the table of integral values must not removed at the end of setup and thus @ifhtml @ref{funct:unur_pinv_set_keepcdf,@command{unur_pinv_set_keepcdf}} @end ifhtml @ifnothtml @command{unur_pinv_set_keepcdf} @end ifnothtml must be called. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_pinv_estimate_error} @deftypefn Function {int} unur_pinv_estimate_error (const @var{UNUR_GEN* generator}, int @var{samplesize}, double* @var{max_error}, double* @var{MAE}) Estimate maximal u-error and mean absolute error (MAE) for @var{generator} by means of Monte-Carlo simulation with sample size @var{samplesize}. The results are stored in @var{max_error} and @var{MAE}, respectively. It returns @code{UNUR_SUCCESS} if successful. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_pinv_estimate_error} @deftypefn {} {int} unur_pinv_estimate_error (const @var{UNUR_GEN* generator}, int @var{samplesize}, double* @var{max_error}, double* @var{MAE}) Estimate maximal u-error and mean absolute error (MAE) for @var{generator} by means of Monte-Carlo simulation with sample size @var{samplesize}. The results are stored in @var{max_error} and @var{MAE}, respectively. It returns @code{UNUR_SUCCESS} if successful. @end deftypefn @end ifnotinfo @c @c end of pinv.h @c ------------------------------------- @c ------------------------------------- @c srou.h @c @page @node SROU @subsection SROU -- Simple Ratio-Of-Uniforms method @table @i @item Required: T-concave PDF, mode, area @item Speed: Set-up: fast, Sampling: slow @item Reinit: supported @item Reference: @ifhtml @ref{bib:LJa01,, [LJa01]} @end ifhtml @ifnothtml [LJa01] @end ifnothtml @ifhtml @ref{bib:LJa02,, [LJa02]} @end ifhtml @ifnothtml [LJa02] @end ifnothtml @ifhtml @ref{bib:HLD04,, [HLD04: Sect.6.3.1; Sect.6.3.2; Sect.6.4.1; Alg.6.4; Alg.6.5; Alg.6.7]} @end ifhtml @ifnothtml [HLD04: Sect.6.3.1; Sect.6.3.2; Sect.6.4.1; Alg.6.4; Alg.6.5; Alg.6.7] @end ifnothtml @end table SROU is based on the ratio-of-uniforms method (@pxref{Ratio-of-Uniforms}) that uses universal inequalities for constructing a (universal) bounding rectangle. It works for all @i{T}-concave distributions, including log-concave and @i{T}-concave distributions with @iftex @math{T(x) = -1/\sqrt{x}.} @end iftex @ifhtml @html T(x) = -1/sqrt(x). @end html @end ifhtml @ifinfo @math{T(x) = -1/sqrt(x).} @end ifinfo Moreover an (optional) parameter @code{r} can be given, to adjust the generator to the given distribution. This parameter is strongly related to the parameter @code{c} for transformed density rejection (@pxref{TDR}) via the formula @i{c = -r/(r+1)}. The rejection constant increases with higher values for @code{r}. On the other hand, the given density must be @iftex @math{T_c} @end iftex @ifhtml @html T_c @end html @end ifhtml @ifinfo @math{T_c} @end ifinfo -concave for the corresponding @i{c}. The default setting for @code{r} is 1 which results in a very simple code. (For other settings, sampling uniformly from the acceptance region is more complicated.) Optionally the CDF at the mode can be given to increase the performance of the algorithm. Then the rejection constant is reduced by 1/2 and (if @code{r=1}) even a universal squeeze can (but need not be) used. A way to increase the performance of the algorithm when the CDF at the mode is not provided is the usage of the mirror principle (only if @code{r=1}). However, using squeezes and using the mirror principle is only recommended when the PDF is expensive to compute. The exact location of the mode and/or the area below the PDF can be replace by appropriate bounds. Then the algorithm still works but has larger rejection constants. @subsubheading How To Use SROU works for any continuous univariate distribution object with given @iftex @math{T_c} @end iftex @ifhtml @html T_c @end html @end ifhtml @ifinfo @math{T_c} @end ifinfo -concave PDF with @iftex @math{c<1,} @end iftex @ifhtml @html c<1, @end html @end ifhtml @ifinfo @math{c<1,} @end ifinfo ) mode and area below PDF. Optional the CDF at the mode can be given to increase the performance of the algorithm by means of the @ifhtml @ref{funct:unur_srou_set_cdfatmode,@command{unur_srou_set_cdfatmode}} @end ifhtml @ifnothtml @command{unur_srou_set_cdfatmode} @end ifnothtml call. Additionally squeezes can be used and switched on via @ifhtml @ref{funct:unur_srou_set_usesqueeze,@command{unur_srou_set_usesqueeze}} @end ifhtml @ifnothtml @command{unur_srou_set_usesqueeze} @end ifnothtml (only if @code{r=1}). A way to increase the performance of the algorithm when the CDF at the mode is not provided is the usage of the mirror principle which can be swithced on by means of a @ifhtml @ref{funct:unur_srou_set_usemirror,@command{unur_srou_set_usemirror}} @end ifhtml @ifnothtml @command{unur_srou_set_usemirror} @end ifnothtml call (only if @code{r=1}) . However using squeezes and using the mirror principle is only recommended when the PDF is expensive to compute. The parameter @code{r} can be given, to adjust the generator to the given distribution. This parameter is strongly related parameter @code{c} for transformed density rejection via the formula @i{c = -r/(r+1)}. The parameter @code{r} can be any value larger than or equal to 1. Values less then 1 are automatically set to 1. The rejection constant depends on the chosen parameter @code{r} but not on the particular distribution. It is 4 for @code{r} equal to 1 and higher for higher values of @code{r}. It is important to note that different algorithms for different values of @code{r}: If @code{r} equal to 1 this is much faster than the algorithm for @code{r} greater than 1. The default setting for @code{r} is 1. If the (exact) area below the PDF is not known, then an upper bound can be used instead (which of course increases the rejection constant). But then the squeeze flag must not be set and @ifhtml @ref{funct:unur_srou_set_cdfatmode,@command{unur_srou_set_cdfatmode}} @end ifhtml @ifnothtml @command{unur_srou_set_cdfatmode} @end ifnothtml must not be used. If the exact location of the mode is not known, then use the approximate location and provide the (exact) value of the PDF at the mode by means of the @ifhtml @ref{funct:unur_srou_set_pdfatmode,@command{unur_srou_set_pdfatmode}} @end ifhtml @ifnothtml @command{unur_srou_set_pdfatmode} @end ifnothtml call. But then @ifhtml @ref{funct:unur_srou_set_cdfatmode,@command{unur_srou_set_cdfatmode}} @end ifhtml @ifnothtml @command{unur_srou_set_cdfatmode} @end ifnothtml must not be used. Notice, that a (slow) numerical mode finder will be used if no mode is given at all. It is even possible to give an upper bound for the PDF only. However, then the (upper bound for the) area below the PDF has to be multiplied by the ratio between the upper bound and the lower bound of the PDF at the mode. Again setting the squeeze flag and using @ifhtml @ref{funct:unur_srou_set_cdfatmode,@command{unur_srou_set_cdfatmode}} @end ifhtml @ifnothtml @command{unur_srou_set_cdfatmode} @end ifnothtml is not allowed. It is possible to change the parameters and the domain of the chosen distribution and run @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml to reinitialize the generator object. Notice, that derived parameters like the mode must also be (re-) set if the parameters or the domain has be changed. Moreover, if the PDF at the mode has been provided by a @ifhtml @ref{funct:unur_srou_set_pdfatmode,@command{unur_srou_set_pdfatmode}} @end ifhtml @ifnothtml @command{unur_srou_set_pdfatmode} @end ifnothtml call, additionally @ifhtml @ref{funct:unur_srou_chg_pdfatmode,@command{unur_srou_chg_pdfatmode}} @end ifhtml @ifnothtml @command{unur_srou_chg_pdfatmode} @end ifnothtml must be used (otherwise this call is not necessary since then this figure is computed directly from the PDF). There exists a test mode that verifies whether the conditions for the method are satisfied or not while sampling. It can be switched on by calling @ifhtml @ref{funct:unur_srou_set_verify,@command{unur_srou_set_verify}} @end ifhtml @ifnothtml @command{unur_srou_set_verify} @end ifnothtml and @ifhtml @ref{funct:unur_srou_chg_verify,@command{unur_srou_chg_verify},} @end ifhtml @ifnothtml @command{unur_srou_chg_verify}, @end ifnothtml respectively. Notice however that sampling is (a little bit) slower then. @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_srou_new,unur_srou_new} @item @ref{funct:unur_srou_set_r,unur_srou_set_r} @item @ref{funct:unur_srou_set_cdfatmode,unur_srou_set_cdfatmode} @item @ref{funct:unur_srou_set_pdfatmode,unur_srou_set_pdfatmode} @item @ref{funct:unur_srou_set_usesqueeze,unur_srou_set_usesqueeze} @item @ref{funct:unur_srou_set_usemirror,unur_srou_set_usemirror} @item @ref{funct:unur_srou_set_verify,unur_srou_set_verify} @item @ref{funct:unur_srou_chg_verify,unur_srou_chg_verify} @item @ref{funct:unur_srou_chg_cdfatmode,unur_srou_chg_cdfatmode} @item @ref{funct:unur_srou_chg_pdfatmode,unur_srou_chg_pdfatmode} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_srou_new} @deftypefn Function {UNUR_PAR*} unur_srou_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_srou_new} @deftypefn {} {UNUR_PAR*} unur_srou_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_srou_set_r} @deftypefn Function {int} unur_srou_set_r (UNUR_PAR* @var{parameters}, double @var{r}) Set parameter @var{r} for transformation. Only values greater than or equal to 1 are allowed. The performance of the generator decreases when @var{r} is increased. On the other hand @var{r} must not be set to small, since the given density must be T_c-concave for @i{c = -r/(r+1)}. @emph{Notice:} If @var{r} is set to @code{1} a simpler and much faster algorithm is used then for @var{r} greater than one. For computational reasons values of @var{r} that are greater than @code{1} but less than @code{1.01} are always set to @code{1.01}. Default is @code{1}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_srou_set_r} @deftypefn {} {int} unur_srou_set_r (UNUR_PAR* @var{parameters}, double @var{r}) Set parameter @var{r} for transformation. Only values greater than or equal to 1 are allowed. The performance of the generator decreases when @var{r} is increased. On the other hand @var{r} must not be set to small, since the given density must be T_c-concave for @i{c = -r/(r+1)}. @emph{Notice:} If @var{r} is set to @code{1} a simpler and much faster algorithm is used then for @var{r} greater than one. For computational reasons values of @var{r} that are greater than @code{1} but less than @code{1.01} are always set to @code{1.01}. Default is @code{1}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_srou_set_cdfatmode} @deftypefn Function {int} unur_srou_set_cdfatmode (UNUR_PAR* @var{parameters}, double @var{Fmode}) Set CDF at mode. When set, the performance of the algorithm is increased by factor 2. However, when the parameters of the distribution are changed @ifhtml @ref{funct:unur_srou_chg_cdfatmode,@command{unur_srou_chg_cdfatmode}} @end ifhtml @ifnothtml @command{unur_srou_chg_cdfatmode} @end ifnothtml has to be used to update this value. Default: not set. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_srou_set_cdfatmode} @deftypefn {} {int} unur_srou_set_cdfatmode (UNUR_PAR* @var{parameters}, double @var{Fmode}) Set CDF at mode. When set, the performance of the algorithm is increased by factor 2. However, when the parameters of the distribution are changed @ifhtml @ref{funct:unur_srou_chg_cdfatmode,@command{unur_srou_chg_cdfatmode}} @end ifhtml @ifnothtml @command{unur_srou_chg_cdfatmode} @end ifnothtml has to be used to update this value. Default: not set. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_srou_set_pdfatmode} @deftypefn Function {int} unur_srou_set_pdfatmode (UNUR_PAR* @var{parameters}, double @var{fmode}) Set pdf at mode. When set, the PDF at the mode is never changed. This is to avoid additional computations, when the PDF does not change when parameters of the distributions vary. It is only useful when the PDF at the mode does not change with changing parameters of the distribution. @emph{IMPORTANT:} This call has to be executed after a possible call of @ifhtml @ref{funct:unur_srou_set_r,@command{unur_srou_set_r}.} @end ifhtml @ifnothtml @command{unur_srou_set_r}. @end ifnothtml Default: not set. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_srou_set_pdfatmode} @deftypefn {} {int} unur_srou_set_pdfatmode (UNUR_PAR* @var{parameters}, double @var{fmode}) Set pdf at mode. When set, the PDF at the mode is never changed. This is to avoid additional computations, when the PDF does not change when parameters of the distributions vary. It is only useful when the PDF at the mode does not change with changing parameters of the distribution. @emph{IMPORTANT:} This call has to be executed after a possible call of @ifhtml @ref{funct:unur_srou_set_r,@command{unur_srou_set_r}.} @end ifhtml @ifnothtml @command{unur_srou_set_r}. @end ifnothtml Default: not set. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_srou_set_usesqueeze} @deftypefn Function {int} unur_srou_set_usesqueeze (UNUR_PAR* @var{parameters}, int @var{usesqueeze}) Set flag for using universal squeeze (default: off). Using squeezes is only useful when the evaluation of the PDF is (extremely) expensive. Using squeezes is automatically disabled when the CDF at the mode is not given (then no universal squeezes exist). Squeezes can only be used if @code{r=1}. Default is @code{FALSE}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_srou_set_usesqueeze} @deftypefn {} {int} unur_srou_set_usesqueeze (UNUR_PAR* @var{parameters}, int @var{usesqueeze}) Set flag for using universal squeeze (default: off). Using squeezes is only useful when the evaluation of the PDF is (extremely) expensive. Using squeezes is automatically disabled when the CDF at the mode is not given (then no universal squeezes exist). Squeezes can only be used if @code{r=1}. Default is @code{FALSE}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_srou_set_usemirror} @deftypefn Function {int} unur_srou_set_usemirror (UNUR_PAR* @var{parameters}, int @var{usemirror}) Set flag for using mirror principle (default: off). Using the mirror principle is only useful when the CDF at the mode is not known and the evaluation of the PDF is rather cheap compared to the marginal generation time of the underlying uniform random number generator. It is automatically disabled when the CDF at the mode is given. (Then there is no necessity to use the mirror principle. However disabling is only done during the initialization step but not at a re-initialization step.) The mirror principle can only be used if @code{r=1}. Default is @code{FALSE}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_srou_set_usemirror} @deftypefn {} {int} unur_srou_set_usemirror (UNUR_PAR* @var{parameters}, int @var{usemirror}) Set flag for using mirror principle (default: off). Using the mirror principle is only useful when the CDF at the mode is not known and the evaluation of the PDF is rather cheap compared to the marginal generation time of the underlying uniform random number generator. It is automatically disabled when the CDF at the mode is given. (Then there is no necessity to use the mirror principle. However disabling is only done during the initialization step but not at a re-initialization step.) The mirror principle can only be used if @code{r=1}. Default is @code{FALSE}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_srou_set_verify} @anchor{funct:unur_srou_chg_verify} @deftypefn Function {int} unur_srou_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) @deftypefnx Function {int} unur_srou_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) Turn verifying of algorithm while sampling on/off. If the condition squeeze(@i{x}) <= PDF(@i{x}) <= hat(@i{x}) is violated for some @i{x} then @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. However notice that this might happen due to round-off errors for a few values of @i{x} (less than 1%). Default is @code{FALSE}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_srou_set_verify} @anchor{funct:unur_srou_chg_verify} @deftypefn {} {int} unur_srou_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) @deftypefnx {} {int} unur_srou_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) Turn verifying of algorithm while sampling on/off. If the condition squeeze(@i{x}) <= PDF(@i{x}) <= hat(@i{x}) is violated for some @i{x} then @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. However notice that this might happen due to round-off errors for a few values of @i{x} (less than 1%). Default is @code{FALSE}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_srou_chg_cdfatmode} @deftypefn Function {int} unur_srou_chg_cdfatmode (UNUR_GEN* @var{generator}, double @var{Fmode}) Change CDF at mode of distribution. @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml must be executed before sampling from the generator again. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_srou_chg_cdfatmode} @deftypefn {} {int} unur_srou_chg_cdfatmode (UNUR_GEN* @var{generator}, double @var{Fmode}) Change CDF at mode of distribution. @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml must be executed before sampling from the generator again. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_srou_chg_pdfatmode} @deftypefn Function {int} unur_srou_chg_pdfatmode (UNUR_GEN* @var{generator}, double @var{fmode}) Change PDF at mode of distribution. @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml must be executed before sampling from the generator again. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_srou_chg_pdfatmode} @deftypefn {} {int} unur_srou_chg_pdfatmode (UNUR_GEN* @var{generator}, double @var{fmode}) Change PDF at mode of distribution. @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml must be executed before sampling from the generator again. @end deftypefn @end ifnotinfo @c @c end of srou.h @c ------------------------------------- @c ------------------------------------- @c ssr.h @c @page @node SSR @subsection SSR -- Simple Setup Rejection @table @i @item Required: T-concave PDF, mode, area @item Speed: Set-up: fast, Sampling: slow @item Reinit: supported @item Reference: @ifhtml @ref{bib:LJa01,, [LJa01]} @end ifhtml @ifnothtml [LJa01] @end ifnothtml @ifhtml @ref{bib:HLD04,, [HLD04: Sect.6.3.3; Alg.6.6]} @end ifhtml @ifnothtml [HLD04: Sect.6.3.3; Alg.6.6] @end ifnothtml @end table SSR is an acceptance/rejection method that uses universal inequalities for constructing (universal) hats and squeezes (@pxref{Rejection}). It works for all @i{T}-concave distributions with @iftex @math{T(x) = -1/\sqrt{x}.} @end iftex @ifhtml @html T(x) = -1/sqrt(x). @end html @end ifhtml @ifinfo @math{T(x) = -1/sqrt(x).} @end ifinfo It requires the PDF, the (exact) location of the mode and the area below the given PDF. The rejection constant is 4 for all @i{T}-concave distributions with unbounded domain and is less than 4 when the domain is bounded. Optionally the CDF at the mode can be given to increase the performance of the algorithm. Then the rejection constant is at most 2 and a universal squeeze can (but need not be) used. However, using squeezes is not recommended unless the evaluation of the PDF is expensive. The exact location of the mode and/or the area below the PDF can be replace by appropriate bounds. Then the algorithm still works but has larger rejection constants. @subsubheading How To Use SSR works for any continuous univariate distribution object with given @i{T}-concave PDF (with @iftex @math{T(x) = -1/\sqrt{x},)} @end iftex @ifhtml @html T(x) = -1/sqrt(x),) @end html @end ifhtml @ifinfo @math{T(x) = -1/sqrt(x),)} @end ifinfo mode and area below PDF. Optional the CDF at the mode can be given to increase the performance of the algorithm by means of the @ifhtml @ref{funct:unur_ssr_set_cdfatmode,@command{unur_ssr_set_cdfatmode}} @end ifhtml @ifnothtml @command{unur_ssr_set_cdfatmode} @end ifnothtml call. Additionally squeezes can be used and switched on via @ifhtml @ref{funct:unur_ssr_set_usesqueeze,@command{unur_ssr_set_usesqueeze}.} @end ifhtml @ifnothtml @command{unur_ssr_set_usesqueeze}. @end ifnothtml If the (exact) area below the PDF is not known, then an upper bound can be used instead (which of course increases the rejection constant). But then the squeeze flag must not be set and @ifhtml @ref{funct:unur_ssr_set_cdfatmode,@command{unur_ssr_set_cdfatmode}} @end ifhtml @ifnothtml @command{unur_ssr_set_cdfatmode} @end ifnothtml must not be used. If the exact location of the mode is not known, then use the approximate location and provide the (exact) value of the PDF at the mode by means of the @ifhtml @ref{funct:unur_ssr_set_pdfatmode,@command{unur_ssr_set_pdfatmode}} @end ifhtml @ifnothtml @command{unur_ssr_set_pdfatmode} @end ifnothtml call. But then @ifhtml @ref{funct:unur_ssr_set_cdfatmode,@command{unur_ssr_set_cdfatmode}} @end ifhtml @ifnothtml @command{unur_ssr_set_cdfatmode} @end ifnothtml must not be used. Notice, that a (slow) numerical mode finder will be used if no mode is given at all. It is even possible to give an upper bound for the PDF only. However, then the (upper bound for the) area below the PDF has to be multiplied by the ratio between the upper bound and the lower bound of the PDF at the mode. Again setting the squeeze flag and using @ifhtml @ref{funct:unur_ssr_set_cdfatmode,@command{unur_ssr_set_cdfatmode}} @end ifhtml @ifnothtml @command{unur_ssr_set_cdfatmode} @end ifnothtml is not allowed. It is possible to change the parameters and the domain of the chosen distribution and run @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml to reinitialize the generator object. Notice, that derived parameters like the mode must also be (re-) set if the parameters or the domain has be changed. Moreover, if the PDF at the mode has been provided by a @ifhtml @ref{funct:unur_ssr_set_pdfatmode,@command{unur_ssr_set_pdfatmode}} @end ifhtml @ifnothtml @command{unur_ssr_set_pdfatmode} @end ifnothtml call, additionally @ifhtml @ref{funct:unur_ssr_chg_pdfatmode,@command{unur_ssr_chg_pdfatmode}} @end ifhtml @ifnothtml @command{unur_ssr_chg_pdfatmode} @end ifnothtml must be used (otherwise this call is not necessary since then this figure is computed directly from the PDF). @emph{Important:} If any of mode, PDF or CDF at the mode, or the area below the mode has been changed, then @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml must be executed. (Otherwise the generator produces garbage). There exists a test mode that verifies whether the conditions for the method are satisfied or not while sampling. It can be switched on/off by calling @ifhtml @ref{funct:unur_ssr_set_verify,@command{unur_ssr_set_verify}} @end ifhtml @ifnothtml @command{unur_ssr_set_verify} @end ifnothtml and @ifhtml @ref{funct:unur_ssr_chg_verify,@command{unur_ssr_chg_verify},} @end ifhtml @ifnothtml @command{unur_ssr_chg_verify}, @end ifnothtml respectively. Notice, however, that sampling is (a little bit) slower then. @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_ssr_new,unur_ssr_new} @item @ref{funct:unur_ssr_set_cdfatmode,unur_ssr_set_cdfatmode} @item @ref{funct:unur_ssr_set_pdfatmode,unur_ssr_set_pdfatmode} @item @ref{funct:unur_ssr_set_usesqueeze,unur_ssr_set_usesqueeze} @item @ref{funct:unur_ssr_set_verify,unur_ssr_set_verify} @item @ref{funct:unur_ssr_chg_verify,unur_ssr_chg_verify} @item @ref{funct:unur_ssr_chg_cdfatmode,unur_ssr_chg_cdfatmode} @item @ref{funct:unur_ssr_chg_pdfatmode,unur_ssr_chg_pdfatmode} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_ssr_new} @deftypefn Function {UNUR_PAR*} unur_ssr_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_ssr_new} @deftypefn {} {UNUR_PAR*} unur_ssr_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_ssr_set_cdfatmode} @deftypefn Function {int} unur_ssr_set_cdfatmode (UNUR_PAR* @var{parameters}, double @var{Fmode}) Set CDF at mode. When set, the performance of the algorithm is increased by factor 2. However, when the parameters of the distribution are changed @ifhtml @ref{funct:unur_ssr_chg_cdfatmode,@command{unur_ssr_chg_cdfatmode}} @end ifhtml @ifnothtml @command{unur_ssr_chg_cdfatmode} @end ifnothtml has to be used to update this value. Default: not set. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_ssr_set_cdfatmode} @deftypefn {} {int} unur_ssr_set_cdfatmode (UNUR_PAR* @var{parameters}, double @var{Fmode}) Set CDF at mode. When set, the performance of the algorithm is increased by factor 2. However, when the parameters of the distribution are changed @ifhtml @ref{funct:unur_ssr_chg_cdfatmode,@command{unur_ssr_chg_cdfatmode}} @end ifhtml @ifnothtml @command{unur_ssr_chg_cdfatmode} @end ifnothtml has to be used to update this value. Default: not set. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_ssr_set_pdfatmode} @deftypefn Function {int} unur_ssr_set_pdfatmode (UNUR_PAR* @var{parameters}, double @var{fmode}) Set pdf at mode. When set, the PDF at the mode is never changed. This is to avoid additional computations, when the PDF does not change when parameters of the distributions vary. It is only useful when the PDF at the mode does not change with changing parameters for the distribution. Default: not set. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_ssr_set_pdfatmode} @deftypefn {} {int} unur_ssr_set_pdfatmode (UNUR_PAR* @var{parameters}, double @var{fmode}) Set pdf at mode. When set, the PDF at the mode is never changed. This is to avoid additional computations, when the PDF does not change when parameters of the distributions vary. It is only useful when the PDF at the mode does not change with changing parameters for the distribution. Default: not set. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_ssr_set_usesqueeze} @deftypefn Function {int} unur_ssr_set_usesqueeze (UNUR_PAR* @var{parameters}, int @var{usesqueeze}) Set flag for using universal squeeze (default: off). Using squeezes is only useful when the evaluation of the PDF is (extremely) expensive. Using squeezes is automatically disabled when the CDF at the mode is not given (then no universal squeezes exist). Default is @code{FALSE}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_ssr_set_usesqueeze} @deftypefn {} {int} unur_ssr_set_usesqueeze (UNUR_PAR* @var{parameters}, int @var{usesqueeze}) Set flag for using universal squeeze (default: off). Using squeezes is only useful when the evaluation of the PDF is (extremely) expensive. Using squeezes is automatically disabled when the CDF at the mode is not given (then no universal squeezes exist). Default is @code{FALSE}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_ssr_set_verify} @anchor{funct:unur_ssr_chg_verify} @deftypefn Function {int} unur_ssr_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) @deftypefnx Function {int} unur_ssr_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) Turn verifying of algorithm while sampling on/off. If the condition squeeze(@i{x}) <= PDF(@i{x}) <= hat(@i{x}) is violated for some @i{x} then @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. However notice that this might happen due to round-off errors for a few values of @i{x} (less than 1%). Default is @code{FALSE}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_ssr_set_verify} @anchor{funct:unur_ssr_chg_verify} @deftypefn {} {int} unur_ssr_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) @deftypefnx {} {int} unur_ssr_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) Turn verifying of algorithm while sampling on/off. If the condition squeeze(@i{x}) <= PDF(@i{x}) <= hat(@i{x}) is violated for some @i{x} then @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. However notice that this might happen due to round-off errors for a few values of @i{x} (less than 1%). Default is @code{FALSE}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_ssr_chg_cdfatmode} @deftypefn Function {int} unur_ssr_chg_cdfatmode (UNUR_GEN* @var{generator}, double @var{Fmode}) Change CDF at mode of distribution. @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml must be executed before sampling from the generator again. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_ssr_chg_cdfatmode} @deftypefn {} {int} unur_ssr_chg_cdfatmode (UNUR_GEN* @var{generator}, double @var{Fmode}) Change CDF at mode of distribution. @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml must be executed before sampling from the generator again. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_ssr_chg_pdfatmode} @deftypefn Function {int} unur_ssr_chg_pdfatmode (UNUR_GEN* @var{generator}, double @var{fmode}) Change PDF at mode of distribution. @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml must be executed before sampling from the generator again. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_ssr_chg_pdfatmode} @deftypefn {} {int} unur_ssr_chg_pdfatmode (UNUR_GEN* @var{generator}, double @var{fmode}) Change PDF at mode of distribution. @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml must be executed before sampling from the generator again. @end deftypefn @end ifnotinfo @c @c end of ssr.h @c ------------------------------------- @c ------------------------------------- @c tabl.h @c @page @node TABL @subsection TABL -- a TABLe method with piecewise constant hats @table @i @item Required: PDF, all local extrema, cut-off values for the tails @item Optional: approximate area @item Speed: Set-up: (very) slow, Sampling: fast @item Reinit: not implemented @item Reference: @ifhtml @ref{bib:AJa93,, [AJa93]} @end ifhtml @ifnothtml [AJa93] @end ifnothtml @ifhtml @ref{bib:AJa95,, [AJa95]} @end ifhtml @ifnothtml [AJa95] @end ifnothtml @ifhtml @ref{bib:HLD04,, [HLD04: Cha.5.1]} @end ifhtml @ifnothtml [HLD04: Cha.5.1] @end ifnothtml @end table TABL (called Ahrens method in @ifhtml @ref{bib:HLD04,, [HLD04]} @end ifhtml @ifnothtml [HLD04] @end ifnothtml ) is an acceptance/rejection method (@pxref{Rejection}) that uses a decomposition of the domain of the distribution into many short subintervals. Inside of these subintervals constant hat and squeeze functions are utilized. Thus it is easy to use the idea of immediate acceptance for points below the squeeze. This reduces the expected number of uniform random numbers per generated random variate to less than two. Using a large number of subintervals only little more than one random number is necessary on average. Thus this method becomes very fast. Due to the constant hat function this method only works for distributions with bounded domains. Thus for unbounded domains the left and right tails have to be cut off. This is no problem when the probability of falling into these tail regions is beyond computational relevance (e.g. smaller than @code{1.e-12}). For easy construction of hat and squeeze functions it is necessary to know the regions of monotonicity (called @emph{slopes}) or equivalently all local maxima and minima of the density. The main problem for this method in the setup is the choice of the subintervals. A simple and close to optimal approach is the "equal area rule" @ifhtml @ref{bib:HLD04,, [HLD04: Cha.5.1]} @end ifhtml @ifnothtml [HLD04: Cha.5.1] @end ifnothtml . There the subintervals are selected such that the area below the hat is the same for each subinterval which can be realized with a simple recursion. If more subintervals are necessary it is possible to split either randomly chosen intervals (adaptive rejection sampling, ARS) or those intervals, where the ratio between squeeze and hat is smallest. This version of the setup is called derandomized ARS (DARS). With the default settings TABL is first calculating approximately 30 subintervals with the equal area rule. Then DARS is used till the desired fit of the hat is reached. A convenient measure to control the quality of the fit of hat and squeeze is the ratio (area below squeeze)/(area below hat) called @code{sqhratio} which must be smaller or equal to one. The expected number of iterations in the rejection algorithm is known to be smaller than 1/sqhratio and the expected number of evaluations of the density is bounded by @code{1/sqhratio - 1}. So values of the sqhratio close to one (e.g. @code{0.95} or @code{0.99}) lead to many subintervals. Thus a better fitting hat is constructed and the sampling algorithm becomes fast; on the other hand large tables are needed and the setup is very slow. For moderate values of sqhratio (e.g. @code{0.9} or @code{0.8}) the sampling is slower but the required tables are smaller and the setup is not so slow. It follows from the above explanations that TABL is always requiring a slow setup and that it is not very well suited for heavy-tailed distributions. @subsubheading How To Use For using the TABL method UNU.RAN needs a bounded interval to which the generated variates can be restricted and information about all local extrema of the distribution. For unimodal densities it is sufficient to provide the mode of the distribution. For the case of a built-in unimodal distribution with bounded domain all these information is present in the distribution object and thus no extra input is necessary (see example_TABL1 below). For a built-in unimodal distribution with unbounded domain we should specify the cut-off values for the tails. This can be done with the @ifhtml @ref{funct:unur_tabl_set_boundary,@command{unur_tabl_set_boundary}} @end ifhtml @ifnothtml @command{unur_tabl_set_boundary} @end ifnothtml call (see example_TABL2 below). For the case that we do not set these boundaries the default values of @code{+/- 1.e20} are used. We can see in example_TABL1 that this still works fine for many standard distributions. For the case of a multimodal distribution we have to set the regions of monotonicity (called slopes) explicitly using the @ifhtml @ref{funct:unur_tabl_set_slopes,@command{unur_tabl_set_slopes}} @end ifhtml @ifnothtml @command{unur_tabl_set_slopes} @end ifnothtml command (see example_TABL3 below). To controll the fit of the hat and the size of the tables and thus the speed of the setup and the sampling it is most convenient to use the @ifhtml @ref{funct:unur_tabl_set_max_sqhratio,@command{unur_tabl_set_max_sqhratio}} @end ifhtml @ifnothtml @command{unur_tabl_set_max_sqhratio} @end ifnothtml call. The default is @code{0.9} which is a sensible value for most distributions and applications. If very large samples of a distribution are required or the evaluation of a density is very slow it may be useful to increase the sqhratio to eg. @code{0.95} or even @code{0.99}. With the @ifhtml @ref{funct:unur_tabl_get_sqhratio,@command{unur_tabl_get_sqhratio}} @end ifhtml @ifnothtml @command{unur_tabl_get_sqhratio} @end ifnothtml call we can check which sqhratio was really reached. If that value is below the desired value it is necessary to increase the maximal number of subintervals, which defaults to @code{1000}, using the @ifhtml @ref{funct:unur_tabl_set_max_intervals,@command{unur_tabl_set_max_intervals}} @end ifhtml @ifnothtml @command{unur_tabl_set_max_intervals} @end ifnothtml call. The @ifhtml @ref{funct:unur_tabl_get_n_intervals,@command{unur_tabl_get_n_intervals}} @end ifhtml @ifnothtml @command{unur_tabl_get_n_intervals} @end ifnothtml call can be used to find out the number of subintervals the setup calculated. It is also possible to set the number of intervals and their respective boundaries by means of the @ifhtml @ref{funct:unur_tabl_set_cpoints,@command{unur_tabl_set_cpoints}} @end ifhtml @ifnothtml @command{unur_tabl_set_cpoints} @end ifnothtml call. It is also possible to use method TABL for correlation induction (variance reduction) by setting of an auxiliary uniform random number generator via the @ifhtml @ref{funct:unur_set_urng_aux,@command{unur_set_urng_aux}} @end ifhtml @ifnothtml @command{unur_set_urng_aux} @end ifnothtml call. (Notice that this must be done after a possible @ifhtml @ref{funct:unur_set_urng,@command{unur_set_urng}} @end ifhtml @ifnothtml @command{unur_set_urng} @end ifnothtml call.) However, this only works when immediate acceptance is switched off by a @ifhtml @ref{funct:unur_tabl_set_variant_ia,@command{unur_tabl_set_variant_ia}} @end ifhtml @ifnothtml @command{unur_tabl_set_variant_ia} @end ifnothtml call. @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_tabl_new,unur_tabl_new} @item @ref{funct:unur_tabl_set_variant_ia,unur_tabl_set_variant_ia} @item @ref{funct:unur_tabl_set_cpoints,unur_tabl_set_cpoints} @item @ref{funct:unur_tabl_set_nstp,unur_tabl_set_nstp} @item @ref{funct:unur_tabl_set_useear,unur_tabl_set_useear} @item @ref{funct:unur_tabl_set_areafraction,unur_tabl_set_areafraction} @item @ref{funct:unur_tabl_set_usedars,unur_tabl_set_usedars} @item @ref{funct:unur_tabl_set_darsfactor,unur_tabl_set_darsfactor} @item @ref{funct:unur_tabl_set_variant_splitmode,unur_tabl_set_variant_splitmode} @item @ref{funct:unur_tabl_set_max_sqhratio,unur_tabl_set_max_sqhratio} @item @ref{funct:unur_tabl_get_sqhratio,unur_tabl_get_sqhratio} @item @ref{funct:unur_tabl_get_hatarea,unur_tabl_get_hatarea} @item @ref{funct:unur_tabl_get_squeezearea,unur_tabl_get_squeezearea} @item @ref{funct:unur_tabl_set_max_intervals,unur_tabl_set_max_intervals} @item @ref{funct:unur_tabl_get_n_intervals,unur_tabl_get_n_intervals} @item @ref{funct:unur_tabl_set_slopes,unur_tabl_set_slopes} @item @ref{funct:unur_tabl_set_guidefactor,unur_tabl_set_guidefactor} @item @ref{funct:unur_tabl_set_boundary,unur_tabl_set_boundary} @item @ref{funct:unur_tabl_chg_truncated,unur_tabl_chg_truncated} @item @ref{funct:unur_tabl_set_verify,unur_tabl_set_verify} @item @ref{funct:unur_tabl_chg_verify,unur_tabl_chg_verify} @item @ref{funct:unur_tabl_set_pedantic,unur_tabl_set_pedantic} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_tabl_new} @deftypefn Function {UNUR_PAR*} unur_tabl_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_tabl_new} @deftypefn {} {UNUR_PAR*} unur_tabl_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_tabl_set_variant_ia} @deftypefn Function {int} unur_tabl_set_variant_ia (UNUR_PAR* @var{parameters}, int @var{use_ia}) Use immediate acceptance when @var{use_ia} is set to @code{TRUE}. This technique requires less uniform. If it is set to @code{FALSE}, ``classical'' acceptance/rejection from hat distribution is used. @emph{Notice:} Auxiliary uniform random number generators for correlation induction (variance reduction) can only be used when ``classical'' acceptance/rejection is used. Default: @code{TRUE}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_tabl_set_variant_ia} @deftypefn {} {int} unur_tabl_set_variant_ia (UNUR_PAR* @var{parameters}, int @var{use_ia}) Use immediate acceptance when @var{use_ia} is set to @code{TRUE}. This technique requires less uniform. If it is set to @code{FALSE}, ``classical'' acceptance/rejection from hat distribution is used. @emph{Notice:} Auxiliary uniform random number generators for correlation induction (variance reduction) can only be used when ``classical'' acceptance/rejection is used. Default: @code{TRUE}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_tabl_set_cpoints} @deftypefn Function {int} unur_tabl_set_cpoints (UNUR_PAR* @var{parameters}, int @var{n_cpoints}, const @var{double* cpoints}) Set construction points for the hat function. If @var{stp} is @code{NULL} than a heuristic rule of thumb is used to get @var{n_stp} construction points. This is the default behavior. The default number of construction points is @code{30}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_tabl_set_cpoints} @deftypefn {} {int} unur_tabl_set_cpoints (UNUR_PAR* @var{parameters}, int @var{n_cpoints}, const @var{double* cpoints}) Set construction points for the hat function. If @var{stp} is @code{NULL} than a heuristic rule of thumb is used to get @var{n_stp} construction points. This is the default behavior. The default number of construction points is @code{30}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_tabl_set_nstp} @deftypefn Function {int} unur_tabl_set_nstp (UNUR_PAR* @var{parameters}, int @var{n_stp}) Set number of construction points for the hat function. @var{n_stp} must be greater than zero. After the setup there are about @var{n_stp} construction points. However it might be larger when a small fraction is given by the @ifhtml @ref{funct:unur_tabl_set_areafraction,@command{unur_tabl_set_areafraction}} @end ifhtml @ifnothtml @command{unur_tabl_set_areafraction} @end ifnothtml call. It also might be smaller for some variants. Default is @code{30}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_tabl_set_nstp} @deftypefn {} {int} unur_tabl_set_nstp (UNUR_PAR* @var{parameters}, int @var{n_stp}) Set number of construction points for the hat function. @var{n_stp} must be greater than zero. After the setup there are about @var{n_stp} construction points. However it might be larger when a small fraction is given by the @ifhtml @ref{funct:unur_tabl_set_areafraction,@command{unur_tabl_set_areafraction}} @end ifhtml @ifnothtml @command{unur_tabl_set_areafraction} @end ifnothtml call. It also might be smaller for some variants. Default is @code{30}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_tabl_set_useear} @deftypefn Function {int} unur_tabl_set_useear (UNUR_PAR* @var{parameters}, int @var{useear}) If @var{useear} is set to @code{TRUE}, the ``equal area rule'' is used, the given slopes are partitioned in such a way that the area below the hat function in each subinterval (``stripe'') has the same area (except the last the last interval which can be smaller). The area can be set by means of the @ifhtml @ref{funct:unur_tabl_set_areafraction,@command{unur_tabl_set_areafraction}} @end ifhtml @ifnothtml @command{unur_tabl_set_areafraction} @end ifnothtml call. Default is @code{TRUE}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_tabl_set_useear} @deftypefn {} {int} unur_tabl_set_useear (UNUR_PAR* @var{parameters}, int @var{useear}) If @var{useear} is set to @code{TRUE}, the ``equal area rule'' is used, the given slopes are partitioned in such a way that the area below the hat function in each subinterval (``stripe'') has the same area (except the last the last interval which can be smaller). The area can be set by means of the @ifhtml @ref{funct:unur_tabl_set_areafraction,@command{unur_tabl_set_areafraction}} @end ifhtml @ifnothtml @command{unur_tabl_set_areafraction} @end ifnothtml call. Default is @code{TRUE}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_tabl_set_areafraction} @deftypefn Function {int} unur_tabl_set_areafraction (UNUR_PAR* @var{parameters}, double @var{fraction}) Set parameter for the equal area rule. During the setup a piecewise constant hat is constructed, such that the area below each of these pieces (strips) is the same and equal to the (given) area below the PDF times @var{fraction} (which must be greater than zero). @emph{Important:} If the area below the PDF is not set in the distribution object, then 1 is assumed. Default is @code{0.1}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_tabl_set_areafraction} @deftypefn {} {int} unur_tabl_set_areafraction (UNUR_PAR* @var{parameters}, double @var{fraction}) Set parameter for the equal area rule. During the setup a piecewise constant hat is constructed, such that the area below each of these pieces (strips) is the same and equal to the (given) area below the PDF times @var{fraction} (which must be greater than zero). @emph{Important:} If the area below the PDF is not set in the distribution object, then 1 is assumed. Default is @code{0.1}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_tabl_set_usedars} @deftypefn Function {int} unur_tabl_set_usedars (UNUR_PAR* @var{parameters}, int @var{usedars}) If @var{usedars} is set to @code{TRUE}, ``derandomized adaptive rejection sampling'' (DARS) is used in the setup. Intervals, where the area between hat and squeeze is too large compared to the average area between hat and squeeze over all intervals, are split. This procedure is repeated until the ratio between squeeze and hat exceeds the bound given by @ifhtml @ref{funct:unur_tabl_set_max_sqhratio,@command{unur_tabl_set_max_sqhratio}} @end ifhtml @ifnothtml @command{unur_tabl_set_max_sqhratio} @end ifnothtml call or the maximum number of intervals is reached. Moreover, it also aborts when no more intervals can be found for splitting. For finding splitting points the arc-mean rule (a mixture of arithmetic mean and harmonic mean) is used. Default is @code{TRUE}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_tabl_set_usedars} @deftypefn {} {int} unur_tabl_set_usedars (UNUR_PAR* @var{parameters}, int @var{usedars}) If @var{usedars} is set to @code{TRUE}, ``derandomized adaptive rejection sampling'' (DARS) is used in the setup. Intervals, where the area between hat and squeeze is too large compared to the average area between hat and squeeze over all intervals, are split. This procedure is repeated until the ratio between squeeze and hat exceeds the bound given by @ifhtml @ref{funct:unur_tabl_set_max_sqhratio,@command{unur_tabl_set_max_sqhratio}} @end ifhtml @ifnothtml @command{unur_tabl_set_max_sqhratio} @end ifnothtml call or the maximum number of intervals is reached. Moreover, it also aborts when no more intervals can be found for splitting. For finding splitting points the arc-mean rule (a mixture of arithmetic mean and harmonic mean) is used. Default is @code{TRUE}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_tabl_set_darsfactor} @deftypefn Function {int} unur_tabl_set_darsfactor (UNUR_PAR* @var{parameters}, double @var{factor}) Set factor for ``derandomized adaptive rejection sampling''. This factor is used to determine the segments that are ``too large'', that is, all segments where the area between squeeze and hat is larger than @var{factor} times the average area over all intervals between squeeze and hat. Notice that all segments are split when @var{factor} is set to @code{0.}, and that there is no splitting at all when @var{factor} is set to @code{UNUR_INFINITY}. Default is @code{0.99}. There is no need to change this parameter. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_tabl_set_darsfactor} @deftypefn {} {int} unur_tabl_set_darsfactor (UNUR_PAR* @var{parameters}, double @var{factor}) Set factor for ``derandomized adaptive rejection sampling''. This factor is used to determine the segments that are ``too large'', that is, all segments where the area between squeeze and hat is larger than @var{factor} times the average area over all intervals between squeeze and hat. Notice that all segments are split when @var{factor} is set to @code{0.}, and that there is no splitting at all when @var{factor} is set to @code{UNUR_INFINITY}. Default is @code{0.99}. There is no need to change this parameter. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_tabl_set_variant_splitmode} @deftypefn Function {int} unur_tabl_set_variant_splitmode (UNUR_PAR* @var{parameters}, unsigned @var{splitmode}) There are three variants for adaptive rejection sampling. These differ in the way how an interval is split: @table @r @item splitmode @code{1} use the generated point to split the interval. @item splitmode @code{2} use the mean point of the interval. @item splitmode @code{3} use the arcmean point; suggested for distributions with heavy tails. @end table Default is splitmode @code{2}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_tabl_set_variant_splitmode} @deftypefn {} {int} unur_tabl_set_variant_splitmode (UNUR_PAR* @var{parameters}, unsigned @var{splitmode}) There are three variants for adaptive rejection sampling. These differ in the way how an interval is split: @table @r @item splitmode @code{1} use the generated point to split the interval. @item splitmode @code{2} use the mean point of the interval. @item splitmode @code{3} use the arcmean point; suggested for distributions with heavy tails. @end table Default is splitmode @code{2}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_tabl_set_max_sqhratio} @deftypefn Function {int} unur_tabl_set_max_sqhratio (UNUR_PAR* @var{parameters}, double @var{max_ratio}) Set upper bound for the ratio (area below squeeze) / (area below hat). It must be a number between 0 and 1. When the ratio exceeds the given number no further construction points are inserted via DARS in the setup. For the case of ARS (unur_tabl_set_usedars() must be set to @code{FALSE}): Use @code{0} if no construction points should be added after the setup. Use @code{1} if added new construction points should not be stopped until the maximum number of construction points is reached. If @var{max_ratio} is close to one, many construction points are used. Default is @code{0.9}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_tabl_set_max_sqhratio} @deftypefn {} {int} unur_tabl_set_max_sqhratio (UNUR_PAR* @var{parameters}, double @var{max_ratio}) Set upper bound for the ratio (area below squeeze) / (area below hat). It must be a number between 0 and 1. When the ratio exceeds the given number no further construction points are inserted via DARS in the setup. For the case of ARS (unur_tabl_set_usedars() must be set to @code{FALSE}): Use @code{0} if no construction points should be added after the setup. Use @code{1} if added new construction points should not be stopped until the maximum number of construction points is reached. If @var{max_ratio} is close to one, many construction points are used. Default is @code{0.9}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_tabl_get_sqhratio} @deftypefn Function {double} unur_tabl_get_sqhratio (const @var{UNUR_GEN* generator}) Get the current ratio (area below squeeze) / (area below hat) for the generator. (In case of an error @code{UNUR_INFINITY} is returned.) @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_tabl_get_sqhratio} @deftypefn {} {double} unur_tabl_get_sqhratio (const @var{UNUR_GEN* generator}) Get the current ratio (area below squeeze) / (area below hat) for the generator. (In case of an error @code{UNUR_INFINITY} is returned.) @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_tabl_get_hatarea} @deftypefn Function {double} unur_tabl_get_hatarea (const @var{UNUR_GEN* generator}) Get the area below the hat for the generator. (In case of an error @code{UNUR_INFINITY} is returned.) @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_tabl_get_hatarea} @deftypefn {} {double} unur_tabl_get_hatarea (const @var{UNUR_GEN* generator}) Get the area below the hat for the generator. (In case of an error @code{UNUR_INFINITY} is returned.) @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_tabl_get_squeezearea} @deftypefn Function {double} unur_tabl_get_squeezearea (const @var{UNUR_GEN* generator}) Get the area below the squeeze for the generator. (In case of an error @code{UNUR_INFINITY} is returned.) @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_tabl_get_squeezearea} @deftypefn {} {double} unur_tabl_get_squeezearea (const @var{UNUR_GEN* generator}) Get the area below the squeeze for the generator. (In case of an error @code{UNUR_INFINITY} is returned.) @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_tabl_set_max_intervals} @deftypefn Function {int} unur_tabl_set_max_intervals (UNUR_PAR* @var{parameters}, int @var{max_ivs}) Set maximum number of intervals. No construction points are added in or after the setup when the number of intervals suceeds @var{max_ivs}. Default is @code{1000}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_tabl_set_max_intervals} @deftypefn {} {int} unur_tabl_set_max_intervals (UNUR_PAR* @var{parameters}, int @var{max_ivs}) Set maximum number of intervals. No construction points are added in or after the setup when the number of intervals suceeds @var{max_ivs}. Default is @code{1000}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_tabl_get_n_intervals} @deftypefn Function {int} unur_tabl_get_n_intervals (const @var{UNUR_GEN* generator}) Get the current number of intervals. (In case of an error 0 is returned.) @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_tabl_get_n_intervals} @deftypefn {} {int} unur_tabl_get_n_intervals (const @var{UNUR_GEN* generator}) Get the current number of intervals. (In case of an error 0 is returned.) @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_tabl_set_slopes} @deftypefn Function {int} unur_tabl_set_slopes (UNUR_PAR* @var{parameters}, const @var{double* slopes}, int @var{n_slopes}) Set slopes for the PDF. A slope is an interval [a,b] or [b,a] where the PDF is monotone and PDF(a) >= PDF(b). The list of slopes is given by an array @var{slopes} where each consecutive tuple (i.e. @code{(slopes[0], slopes[1])}, @code{(slopes[2], slopes[3])}, etc.) defines one slope. Slopes must be sorted (i.e. both @code{slopes[0]} and @code{slopes[1]} must not be greater than any entry of the slope @code{(slopes[2], slopes[3])}, etc.) and must not be overlapping. Otherwise no slopes are set and @var{unur_errno} is set to @code{UNUR_ERR_PAR_SET}. @emph{Notice:} @var{n_slopes} is the number of slopes (and not the length of the array @var{slopes}). @emph{Notice} that setting slopes resets the given domain for the distribution. However, in case of a standard distribution the area below the PDF is not updated. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_tabl_set_slopes} @deftypefn {} {int} unur_tabl_set_slopes (UNUR_PAR* @var{parameters}, const @var{double* slopes}, int @var{n_slopes}) Set slopes for the PDF. A slope is an interval [a,b] or [b,a] where the PDF is monotone and PDF(a) >= PDF(b). The list of slopes is given by an array @var{slopes} where each consecutive tuple (i.e. @code{(slopes[0], slopes[1])}, @code{(slopes[2], slopes[3])}, etc.) defines one slope. Slopes must be sorted (i.e. both @code{slopes[0]} and @code{slopes[1]} must not be greater than any entry of the slope @code{(slopes[2], slopes[3])}, etc.) and must not be overlapping. Otherwise no slopes are set and @var{unur_errno} is set to @code{UNUR_ERR_PAR_SET}. @emph{Notice:} @var{n_slopes} is the number of slopes (and not the length of the array @var{slopes}). @emph{Notice} that setting slopes resets the given domain for the distribution. However, in case of a standard distribution the area below the PDF is not updated. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_tabl_set_guidefactor} @deftypefn Function {int} unur_tabl_set_guidefactor (UNUR_PAR* @var{parameters}, double @var{factor}) Set factor for relative size of the guide table for indexed search (see also method DGT @ref{DGT}). It must be greater than or equal to @code{0}. When set to @code{0}, then sequential search is used. Default is @code{1}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_tabl_set_guidefactor} @deftypefn {} {int} unur_tabl_set_guidefactor (UNUR_PAR* @var{parameters}, double @var{factor}) Set factor for relative size of the guide table for indexed search (see also method DGT @ref{DGT}). It must be greater than or equal to @code{0}. When set to @code{0}, then sequential search is used. Default is @code{1}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_tabl_set_boundary} @deftypefn Function {int} unur_tabl_set_boundary (UNUR_PAR* @var{parameters}, double @var{left}, double @var{right}) Set the left and right boundary of the computation interval. The piecewise hat is only constructed inside this interval. The probability outside of this region must not be of computational relevance. Of course @code{+/- UNUR_INFINITY} is not allowed. Default is @code{-1.e20,1.e20}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_tabl_set_boundary} @deftypefn {} {int} unur_tabl_set_boundary (UNUR_PAR* @var{parameters}, double @var{left}, double @var{right}) Set the left and right boundary of the computation interval. The piecewise hat is only constructed inside this interval. The probability outside of this region must not be of computational relevance. Of course @code{+/- UNUR_INFINITY} is not allowed. Default is @code{-1.e20,1.e20}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_tabl_chg_truncated} @deftypefn Function {int} unur_tabl_chg_truncated (UNUR_GEN* @var{gen}, double @var{left}, double @var{right}) Change the borders of the domain of the (truncated) distribution. Notice that the given truncated domain must be a subset of the domain of the given distribution. The generator always uses the intersection of the domain of the distribution and the truncated domain given by this call. The hat function will not be changed. @emph{Important:} The ratio between the area below the hat and the area below the squeeze changes when the sampling region is restricted. In particalur it becomes (very) large when sampling from the (far) tail of the distribution. Then it is better to create a generator object for the tail of distribution only. @emph{Important:} This call does not work for variant @code{IA} (immediate acceptance). In this case UNU.RAN switches @emph{automatically} to variant @code{RH} (use ``classical'' acceptance/rejection from hat distribution) and does revert to the variant originally set by the user. @emph{Important:} It is not a good idea to use adaptave rejection sampling while sampling from a domain that is a strict subset of the domain that has been used to construct the hat. For that reason adaptive adding of construction points is @emph{automatically disabled} by this call. @emph{Important:} If the CDF of the hat is (almost) the same for @var{left} and @var{right} and (almost) equal to @code{0} or @code{1}, then the truncated domain is not changed and the call returns an error code. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_tabl_chg_truncated} @deftypefn {} {int} unur_tabl_chg_truncated (UNUR_GEN* @var{gen}, double @var{left}, double @var{right}) Change the borders of the domain of the (truncated) distribution. Notice that the given truncated domain must be a subset of the domain of the given distribution. The generator always uses the intersection of the domain of the distribution and the truncated domain given by this call. The hat function will not be changed. @emph{Important:} The ratio between the area below the hat and the area below the squeeze changes when the sampling region is restricted. In particalur it becomes (very) large when sampling from the (far) tail of the distribution. Then it is better to create a generator object for the tail of distribution only. @emph{Important:} This call does not work for variant @code{IA} (immediate acceptance). In this case UNU.RAN switches @emph{automatically} to variant @code{RH} (use ``classical'' acceptance/rejection from hat distribution) and does revert to the variant originally set by the user. @emph{Important:} It is not a good idea to use adaptave rejection sampling while sampling from a domain that is a strict subset of the domain that has been used to construct the hat. For that reason adaptive adding of construction points is @emph{automatically disabled} by this call. @emph{Important:} If the CDF of the hat is (almost) the same for @var{left} and @var{right} and (almost) equal to @code{0} or @code{1}, then the truncated domain is not changed and the call returns an error code. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_tabl_set_verify} @anchor{funct:unur_tabl_chg_verify} @deftypefn Function {int} unur_tabl_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) @deftypefnx Function {int} unur_tabl_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) Turn verifying of algorithm while sampling on/off. If the condition squeeze(@i{x}) <= PDF(@i{x}) <= hat(@i{x}) is violated for some @i{x} then @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. However notice that this might happen due to round-off errors for a few values of @i{x} (less than 1%). Default is @code{FALSE}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_tabl_set_verify} @anchor{funct:unur_tabl_chg_verify} @deftypefn {} {int} unur_tabl_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) @deftypefnx {} {int} unur_tabl_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) Turn verifying of algorithm while sampling on/off. If the condition squeeze(@i{x}) <= PDF(@i{x}) <= hat(@i{x}) is violated for some @i{x} then @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. However notice that this might happen due to round-off errors for a few values of @i{x} (less than 1%). Default is @code{FALSE}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_tabl_set_pedantic} @deftypefn Function {int} unur_tabl_set_pedantic (UNUR_PAR* @var{parameters}, int @var{pedantic}) Sometimes it might happen that @ifhtml @ref{funct:unur_init,@command{unur_init}} @end ifhtml @ifnothtml @command{unur_init} @end ifnothtml has been executed successfully. But when additional construction points are added by adaptive rejection sampling, the algorithm detects that the PDF is not monotone in the given slopes. With @var{pedantic} being @code{TRUE}, the sampling routine is exchanged by a routine that simply returns @code{UNUR_INFINITY} indicating an error. Default is @code{FALSE}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_tabl_set_pedantic} @deftypefn {} {int} unur_tabl_set_pedantic (UNUR_PAR* @var{parameters}, int @var{pedantic}) Sometimes it might happen that @ifhtml @ref{funct:unur_init,@command{unur_init}} @end ifhtml @ifnothtml @command{unur_init} @end ifnothtml has been executed successfully. But when additional construction points are added by adaptive rejection sampling, the algorithm detects that the PDF is not monotone in the given slopes. With @var{pedantic} being @code{TRUE}, the sampling routine is exchanged by a routine that simply returns @code{UNUR_INFINITY} indicating an error. Default is @code{FALSE}. @end deftypefn @end ifnotinfo @c @c end of tabl.h @c ------------------------------------- @c ------------------------------------- @c tdr.h @c @page @node TDR @subsection TDR -- Transformed Density Rejection @table @i @item Required: T-concave PDF, dPDF @item Optional: mode @item Speed: Set-up: slow, Sampling: fast @item Reinit: supported @item Reference: @ifhtml @ref{bib:GWa92,, [GWa92]} @end ifhtml @ifnothtml [GWa92] @end ifnothtml @ifhtml @ref{bib:HWa95,, [HWa95]} @end ifhtml @ifnothtml [HWa95] @end ifnothtml @ifhtml @ref{bib:HLD04,, [HLD04: Cha.4]} @end ifhtml @ifnothtml [HLD04: Cha.4] @end ifnothtml @end table TDR is an acceptance/rejection method that uses the concavity of a transformed density to construct hat function and squeezes automatically. Such PDFs are called T-concave. Currently the following transformations are implemented and can be selected by setting their @code{c}-values by a @ifhtml @ref{funct:unur_tdr_set_c,@command{unur_tdr_set_c}} @end ifhtml @ifnothtml @command{unur_tdr_set_c} @end ifnothtml call: @table @code @item c = 0 T(x) = log(x) @item c = -0.5 T(x) = -1/sqrt(x) @ @ @ @ @ (Default) @end table In future releases the transformations T(x) = -(x)^c will be available for any c with 0 > c > -1. Notice that if a PDF is T-concave for a c then it also T-concave for every c'T(x) = -1/sqrt(()x). @end html @end ifhtml @ifinfo @math{T(x) = -1/sqrt(x).} @end ifinfo It requires the PDF and the (exact) location of the mode. Notice that if no mode is given at all, a (slow) numerical mode finder will be used. Moreover the approximate area below the given PDF is used. (If no area is given for the distribution the algorithm assumes that it is approximately 1.) The rejection constant is bounded from above by 4 for all @i{T}-concave distributions. @subsubheading How To Use UTDR works for any continuous univariate distribution object with given @i{T}-concave PDF (with @iftex @math{T(x) = -1/\sqrt{x},)} @end iftex @ifhtml @html T(x) = -1/sqrt(x),) @end html @end ifhtml @ifinfo @math{T(x) = -1/sqrt(x),)} @end ifinfo mode and approximate area below PDF. When the PDF does not change at the mode for varying parameters, then this value can be set with @ifhtml @ref{funct:unur_utdr_set_pdfatmode,@command{unur_utdr_set_pdfatmode}} @end ifhtml @ifnothtml @command{unur_utdr_set_pdfatmode} @end ifnothtml to avoid some computations. Since this value will not be updated any more when the parameters of the distribution are changed, the @ifhtml @ref{funct:unur_utdr_chg_pdfatmode,@command{unur_utdr_chg_pdfatmode}} @end ifhtml @ifnothtml @command{unur_utdr_chg_pdfatmode} @end ifnothtml call is necessary to do this manually. It is possible to change the parameters and the domain of the chosen distribution and run @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml to reinitialize the generator object. Notice, that derived parameters like the mode must also be (re-) set if the parameters or the domain has be changed. Moreover, if the PDF at the mode has been provided by a @ifhtml @ref{funct:unur_utdr_set_pdfatmode,@command{unur_utdr_set_pdfatmode}} @end ifhtml @ifnothtml @command{unur_utdr_set_pdfatmode} @end ifnothtml call, additionally @ifhtml @ref{funct:unur_utdr_chg_pdfatmode,@command{unur_utdr_chg_pdfatmode}} @end ifhtml @ifnothtml @command{unur_utdr_chg_pdfatmode} @end ifnothtml must be used (otherwise this call is not necessary since then this figure is computed directly from the PDF). There exists a test mode that verifies whether the conditions for the method are satisfied or not. It can be switched on by calling @ifhtml @ref{funct:unur_utdr_set_verify,@command{unur_utdr_set_verify}} @end ifhtml @ifnothtml @command{unur_utdr_set_verify} @end ifnothtml and @ifhtml @ref{funct:unur_utdr_chg_verify,@command{unur_utdr_chg_verify},} @end ifhtml @ifnothtml @command{unur_utdr_chg_verify}, @end ifnothtml respectively. Notice however that sampling is slower then. @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_utdr_new,unur_utdr_new} @item @ref{funct:unur_utdr_set_pdfatmode,unur_utdr_set_pdfatmode} @item @ref{funct:unur_utdr_set_cpfactor,unur_utdr_set_cpfactor} @item @ref{funct:unur_utdr_set_deltafactor,unur_utdr_set_deltafactor} @item @ref{funct:unur_utdr_set_verify,unur_utdr_set_verify} @item @ref{funct:unur_utdr_chg_verify,unur_utdr_chg_verify} @item @ref{funct:unur_utdr_chg_pdfatmode,unur_utdr_chg_pdfatmode} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_utdr_new} @deftypefn Function {UNUR_PAR*} unur_utdr_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_utdr_new} @deftypefn {} {UNUR_PAR*} unur_utdr_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_utdr_set_pdfatmode} @deftypefn Function {int} unur_utdr_set_pdfatmode (UNUR_PAR* @var{parameters}, double @var{fmode}) Set pdf at mode. When set, the PDF at the mode is never changed. This is to avoid additional computations, when the PDF does not change when parameters of the distributions vary. It is only useful when the PDF at the mode does not change with changing parameters for the distribution. Default: not set. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_utdr_set_pdfatmode} @deftypefn {} {int} unur_utdr_set_pdfatmode (UNUR_PAR* @var{parameters}, double @var{fmode}) Set pdf at mode. When set, the PDF at the mode is never changed. This is to avoid additional computations, when the PDF does not change when parameters of the distributions vary. It is only useful when the PDF at the mode does not change with changing parameters for the distribution. Default: not set. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_utdr_set_cpfactor} @deftypefn Function {int} unur_utdr_set_cpfactor (UNUR_PAR* @var{parameters}, double @var{cp_factor}) Set factor for position of left and right construction point. The @var{cp_factor} is used to find almost optimal construction points for the hat function. There is no need to change this factor in almost all situations. Default is @code{0.664}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_utdr_set_cpfactor} @deftypefn {} {int} unur_utdr_set_cpfactor (UNUR_PAR* @var{parameters}, double @var{cp_factor}) Set factor for position of left and right construction point. The @var{cp_factor} is used to find almost optimal construction points for the hat function. There is no need to change this factor in almost all situations. Default is @code{0.664}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_utdr_set_deltafactor} @deftypefn Function {int} unur_utdr_set_deltafactor (UNUR_PAR* @var{parameters}, double @var{delta}) Set factor for replacing tangents by secants. higher factors increase the rejection constant but reduces the risk of serious round-off errors. There is no need to change this factor it almost all situations. Default is @code{1.e-5}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_utdr_set_deltafactor} @deftypefn {} {int} unur_utdr_set_deltafactor (UNUR_PAR* @var{parameters}, double @var{delta}) Set factor for replacing tangents by secants. higher factors increase the rejection constant but reduces the risk of serious round-off errors. There is no need to change this factor it almost all situations. Default is @code{1.e-5}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_utdr_set_verify} @anchor{funct:unur_utdr_chg_verify} @deftypefn Function {int} unur_utdr_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) @deftypefnx Function {int} unur_utdr_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) Turn verifying of algorithm while sampling on/off. If the condition squeeze(@i{x}) <= PDF(@i{x}) <= hat(@i{x}) is violated for some @i{x} then @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. However notice that this might happen due to round-off errors for a few values of @i{x} (less than 1%). Default is @code{FALSE}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_utdr_set_verify} @anchor{funct:unur_utdr_chg_verify} @deftypefn {} {int} unur_utdr_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) @deftypefnx {} {int} unur_utdr_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) Turn verifying of algorithm while sampling on/off. If the condition squeeze(@i{x}) <= PDF(@i{x}) <= hat(@i{x}) is violated for some @i{x} then @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. However notice that this might happen due to round-off errors for a few values of @i{x} (less than 1%). Default is @code{FALSE}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_utdr_chg_pdfatmode} @deftypefn Function {int} unur_utdr_chg_pdfatmode (UNUR_GEN* @var{generator}, double @var{fmode}) Change PDF at mode of distribution. @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml must be executed before sampling from the generator again. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_utdr_chg_pdfatmode} @deftypefn {} {int} unur_utdr_chg_pdfatmode (UNUR_GEN* @var{generator}, double @var{fmode}) Change PDF at mode of distribution. @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml must be executed before sampling from the generator again. @end deftypefn @end ifnotinfo @c @c end of utdr.h @c ------------------------------------- @c ------------------------------------- @c methods.dh @c @page @node Methods_for_CEMP @section Methods for continuous empirical univariate distributions @menu * EMPK:: EMPirical distribution with Kernel smoothing * EMPL:: EMPirical distribution with Linear interpolation * HIST:: HISTogramm of empirical distribution @end menu @subheading Overview of methods @include methods_cemp.texi @subheading Example @smallexample @include ref_example_emp.texi @end smallexample @subheading Example (String API) @smallexample @include ref_example_emp_str.texi @end smallexample @c @c end of methods.dh @c ------------------------------------- @c ------------------------------------- @c empk.h @c @page @node EMPK @subsection EMPK -- EMPirical distribution with Kernel smoothing @table @i @item Required: observed sample @item Speed: Set-up: slow (as sample is sorted), Sampling: fast (depends on kernel) @item Reinit: not implemented @item Reference: @ifhtml @ref{bib:HLa00,, [HLa00]} @end ifhtml @ifnothtml [HLa00] @end ifnothtml @ifhtml @ref{bib:HLD04,, [HLD04: Sect.12.1.2]} @end ifhtml @ifnothtml [HLD04: Sect.12.1.2] @end ifnothtml @end table EMPK generates random variates from an empirical distribution that is given by an observed sample. The idea is that simply choosing a random point from the sample and to return it with some added noise results in a method that has very nice properties, as it can be seen as sampling from a kernel density estimate. If the underlying distribution is continuous, especially the fine structur of the resulting empirical distribution is much better than using only resampling without noise. Clearly we have to decide about the density of the noise (called kernel) and about the standard deviation of the noise. The mathematical theory of kernel density estimation shows us that we are comparatively free in choosing the kernel. It also supplies us with a simple formula to compute the optimal standarddeviation of the noise, called bandwidth (or window width) of the kernel. The variance of the estimated density is slightly larger than that of the observed sample. However, this can be easily corrected if required. There is also a correction (mirroring technique) for distributions with non-negative support. A simple robust reference method is implemented to find a good standard deviation of the noise (i.e. the bandwidth of kernel density estimation). For some cases (e.g. densities with two or more sharp distinct peaks) there kernel density estimation can be adjusted by changing the smoothness factor and the so called beta factor. @subsubheading How To Use EMPK uses empirical distributions. The main parameter is the choice if of kernel density. The most important kernels can be set by @ifhtml @ref{funct:unur_empk_set_kernel,@command{unur_empk_set_kernel}.} @end ifhtml @ifnothtml @command{unur_empk_set_kernel}. @end ifnothtml Additionally generators for other kernels can be used by using @ifhtml @ref{funct:unur_empk_set_kernelgen,@command{unur_empk_set_kernelgen}} @end ifhtml @ifnothtml @command{unur_empk_set_kernelgen} @end ifnothtml instead. Additionally variance correction and a correction for non-negative variates can be switched on. The two other parameters (smoothing factor and beta factor) are only useful for people knowing the theory of kernel density estimation. It is not necessary to change them if the true underlying distribution is somehow comparable with a bell-shaped curve, even skewed or with some not too sharp extra peaks. In all these cases the simple robust reference method implemented to find a good standard deviation of the noise (i.e. the bandwidth of kernel density estimation) should give sensible results. However, it might be necessary to overwrite this automatic method to find the bandwidth eg. when resampling from data with two or more sharp distinct peaks. Then the distribution has nearly discrete components as well and our automatic method may easily choose too large a bandwidth which results in an empirical distribution which is oversmoothed (i.e. it has lower peaks than the original distribution). Then it is recommended to decrease the bandwidth using the @ifhtml @ref{funct:unur_empk_set_smoothing,@command{unur_empk_set_smoothing}} @end ifhtml @ifnothtml @command{unur_empk_set_smoothing} @end ifnothtml call. A smoothing factor of @code{1} is the default. A smoothing factor of @code{0} leads to naive resampling of the data. Thus an appropriate value between these extremes should be choosen. We recommend to consult a reference on kernel smoothing when doing so; but it is not a simple problem to determine an optimal bandwidth for distributions with sharp peaks. In general, for most applications it is perfectly ok to use the default values offered. Unless you have some knowledge on density estimation we do not recommend to change anything. There are two exceptions: @enumerate A @item In the case that the unknown underlying distribution is not continuous but discrete you should "turn off" the adding of the noise by setting: @example unur_empk_set_smoothing(par, 0.) @end example @item In the case that you are especially interested in a fast sampling algorithm use the call @example unur_empk_set_kernel(par, UNUR_DISTR_BOXCAR); @end example to change the used noise distribution from the default Gaussian distribution to the uniform distribution. @end enumerate @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_empk_new,unur_empk_new} @item @ref{funct:unur_empk_set_kernel,unur_empk_set_kernel} @item @ref{funct:unur_empk_set_kernelgen,unur_empk_set_kernelgen} @item @ref{funct:unur_empk_set_beta,unur_empk_set_beta} @item @ref{funct:unur_empk_set_smoothing,unur_empk_set_smoothing} @item @ref{funct:unur_empk_chg_smoothing,unur_empk_chg_smoothing} @item @ref{funct:unur_empk_set_varcor,unur_empk_set_varcor} @item @ref{funct:unur_empk_chg_varcor,unur_empk_chg_varcor} @item @ref{funct:unur_empk_set_positive,unur_empk_set_positive} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_empk_new} @deftypefn Function {UNUR_PAR*} unur_empk_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_empk_new} @deftypefn {} {UNUR_PAR*} unur_empk_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_empk_set_kernel} @deftypefn Function {int} unur_empk_set_kernel (UNUR_PAR* @var{parameters}, unsigned @var{kernel}) Select one of the supported kernel distributions. Currently the following kernels are supported: @table @code @item UNUR_DISTR_GAUSSIAN Gaussian (normal) kernel @item UNUR_DISTR_EPANECHNIKOV Epanechnikov kernel @item UNUR_DISTR_BOXCAR Boxcar (uniform, rectangular) kernel @item UNUR_DISTR_STUDENT t3 kernel (Student's distribution with 3 degrees of freedom) @item UNUR_DISTR_LOGISTIC logistic kernel @end table For other kernels (including kernels with Student's distribution with other than 3 degrees of freedom) use the @ifhtml @ref{funct:unur_empk_set_kernelgen,@command{unur_empk_set_kernelgen}} @end ifhtml @ifnothtml @command{unur_empk_set_kernelgen} @end ifnothtml call. It is not possible to call @ifhtml @ref{funct:unur_empk_set_kernel,@command{unur_empk_set_kernel}} @end ifhtml @ifnothtml @command{unur_empk_set_kernel} @end ifnothtml twice. Default is the Gaussian kernel. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_empk_set_kernel} @deftypefn {} {int} unur_empk_set_kernel (UNUR_PAR* @var{parameters}, unsigned @var{kernel}) Select one of the supported kernel distributions. Currently the following kernels are supported: @table @code @item UNUR_DISTR_GAUSSIAN Gaussian (normal) kernel @item UNUR_DISTR_EPANECHNIKOV Epanechnikov kernel @item UNUR_DISTR_BOXCAR Boxcar (uniform, rectangular) kernel @item UNUR_DISTR_STUDENT t3 kernel (Student's distribution with 3 degrees of freedom) @item UNUR_DISTR_LOGISTIC logistic kernel @end table For other kernels (including kernels with Student's distribution with other than 3 degrees of freedom) use the @ifhtml @ref{funct:unur_empk_set_kernelgen,@command{unur_empk_set_kernelgen}} @end ifhtml @ifnothtml @command{unur_empk_set_kernelgen} @end ifnothtml call. It is not possible to call @ifhtml @ref{funct:unur_empk_set_kernel,@command{unur_empk_set_kernel}} @end ifhtml @ifnothtml @command{unur_empk_set_kernel} @end ifnothtml twice. Default is the Gaussian kernel. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_empk_set_kernelgen} @deftypefn Function {int} unur_empk_set_kernelgen (UNUR_PAR* @var{parameters}, const @var{UNUR_GEN* kernelgen}, double @var{alpha}, double @var{kernelvar}) Set generator for the kernel used for density estimation. @var{alpha} is used to compute the optimal bandwidth from the point of view of minimizing the mean integrated square error (MISE). It depends on the kernel K and is given by @example alpha(K) = Var(K)^(-2/5)@{ \int K(t)^2 dt@}^(1/5) @end example For standard kernels (see above) alpha is computed by the algorithm. @var{kernvar} is the variance of the used kernel. It is only required for the variance corrected version of density estimation (which is used by default); otherwise it is ignored. If @var{kernelvar} is nonpositive, variance correction is disabled. For standard kernels (see above) @var{kernvar} is computed by the algorithm. It is not possible to call @ifhtml @ref{funct:unur_empk_set_kernelgen,@command{unur_empk_set_kernelgen}} @end ifhtml @ifnothtml @command{unur_empk_set_kernelgen} @end ifnothtml after a standard kernel has been selected by a @ifhtml @ref{funct:unur_empk_set_kernel,@command{unur_empk_set_kernel}} @end ifhtml @ifnothtml @command{unur_empk_set_kernel} @end ifnothtml call. Notice that the uniform random number generator of the kernel generator is overwritten during the @ifhtml @ref{funct:unur_init,@command{unur_init}} @end ifhtml @ifnothtml @command{unur_init} @end ifnothtml call and at each @ifhtml @ref{funct:unur_chg_urng,@command{unur_chg_urng}} @end ifhtml @ifnothtml @command{unur_chg_urng} @end ifnothtml call with the uniform generator used for the empirical distribution. Default is the Gaussian kernel. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_empk_set_kernelgen} @deftypefn {} {int} unur_empk_set_kernelgen (UNUR_PAR* @var{parameters}, const @var{UNUR_GEN* kernelgen}, double @var{alpha}, double @var{kernelvar}) Set generator for the kernel used for density estimation. @var{alpha} is used to compute the optimal bandwidth from the point of view of minimizing the mean integrated square error (MISE). It depends on the kernel K and is given by @example alpha(K) = Var(K)^(-2/5)@{ \int K(t)^2 dt@}^(1/5) @end example For standard kernels (see above) alpha is computed by the algorithm. @var{kernvar} is the variance of the used kernel. It is only required for the variance corrected version of density estimation (which is used by default); otherwise it is ignored. If @var{kernelvar} is nonpositive, variance correction is disabled. For standard kernels (see above) @var{kernvar} is computed by the algorithm. It is not possible to call @ifhtml @ref{funct:unur_empk_set_kernelgen,@command{unur_empk_set_kernelgen}} @end ifhtml @ifnothtml @command{unur_empk_set_kernelgen} @end ifnothtml after a standard kernel has been selected by a @ifhtml @ref{funct:unur_empk_set_kernel,@command{unur_empk_set_kernel}} @end ifhtml @ifnothtml @command{unur_empk_set_kernel} @end ifnothtml call. Notice that the uniform random number generator of the kernel generator is overwritten during the @ifhtml @ref{funct:unur_init,@command{unur_init}} @end ifhtml @ifnothtml @command{unur_init} @end ifnothtml call and at each @ifhtml @ref{funct:unur_chg_urng,@command{unur_chg_urng}} @end ifhtml @ifnothtml @command{unur_chg_urng} @end ifnothtml call with the uniform generator used for the empirical distribution. Default is the Gaussian kernel. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_empk_set_beta} @deftypefn Function {int} unur_empk_set_beta (UNUR_PAR* @var{parameters}, double @var{beta}) @var{beta} is used to compute the optimal bandwidth from the point of view of minimizing the mean integrated square error (MISE). @var{beta} depends on the (unknown) distribution of the sampled data points. By default Gaussian distribution is assumed for the sample (@var{beta} = 1.3637439). There is no requirement to change @var{beta}. Default: @code{1.3637439} @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_empk_set_beta} @deftypefn {} {int} unur_empk_set_beta (UNUR_PAR* @var{parameters}, double @var{beta}) @var{beta} is used to compute the optimal bandwidth from the point of view of minimizing the mean integrated square error (MISE). @var{beta} depends on the (unknown) distribution of the sampled data points. By default Gaussian distribution is assumed for the sample (@var{beta} = 1.3637439). There is no requirement to change @var{beta}. Default: @code{1.3637439} @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_empk_set_smoothing} @anchor{funct:unur_empk_chg_smoothing} @deftypefn Function {int} unur_empk_set_smoothing (UNUR_PAR* @var{parameters}, double @var{smoothing}) @deftypefnx Function {int} unur_empk_chg_smoothing (UNUR_GEN* @var{generator}, double @var{smoothing}) Set and change the smoothing factor. The smoothing factor controlles how ``smooth'' the resulting density estimation will be. A smoothing factor equal to @code{0} results in naive resampling. A very large smoothing factor (together with the variance correction) results in a density which is approximately equal to the kernel. Default is 1 which results in a smoothing parameter minimising the MISE (mean integrated squared error) if the data are not too far away from normal. If a large smoothing factor is used, then variance correction must be switched on. Default: @code{1} @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_empk_set_smoothing} @anchor{funct:unur_empk_chg_smoothing} @deftypefn {} {int} unur_empk_set_smoothing (UNUR_PAR* @var{parameters}, double @var{smoothing}) @deftypefnx {} {int} unur_empk_chg_smoothing (UNUR_GEN* @var{generator}, double @var{smoothing}) Set and change the smoothing factor. The smoothing factor controlles how ``smooth'' the resulting density estimation will be. A smoothing factor equal to @code{0} results in naive resampling. A very large smoothing factor (together with the variance correction) results in a density which is approximately equal to the kernel. Default is 1 which results in a smoothing parameter minimising the MISE (mean integrated squared error) if the data are not too far away from normal. If a large smoothing factor is used, then variance correction must be switched on. Default: @code{1} @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_empk_set_varcor} @anchor{funct:unur_empk_chg_varcor} @deftypefn Function {int} unur_empk_set_varcor (UNUR_PAR* @var{parameters}, int @var{varcor}) @deftypefnx Function {int} unur_empk_chg_varcor (UNUR_GEN* @var{generator}, int @var{varcor}) Switch variance correction in generator on/off. If @var{varcor} is @code{TRUE} then the variance of the used density estimation is the same as the sample variance. However this increases the MISE of the estimation a little bit. Default is @code{FALSE}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_empk_set_varcor} @anchor{funct:unur_empk_chg_varcor} @deftypefn {} {int} unur_empk_set_varcor (UNUR_PAR* @var{parameters}, int @var{varcor}) @deftypefnx {} {int} unur_empk_chg_varcor (UNUR_GEN* @var{generator}, int @var{varcor}) Switch variance correction in generator on/off. If @var{varcor} is @code{TRUE} then the variance of the used density estimation is the same as the sample variance. However this increases the MISE of the estimation a little bit. Default is @code{FALSE}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_empk_set_positive} @deftypefn Function {int} unur_empk_set_positive (UNUR_PAR* @var{parameters}, int @var{positive}) If @var{positive} is @code{TRUE} then only nonnegative random variates are generated. This is done by means of a mirroring technique. Default is @code{FALSE}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_empk_set_positive} @deftypefn {} {int} unur_empk_set_positive (UNUR_PAR* @var{parameters}, int @var{positive}) If @var{positive} is @code{TRUE} then only nonnegative random variates are generated. This is done by means of a mirroring technique. Default is @code{FALSE}. @end deftypefn @end ifnotinfo @c @c end of empk.h @c ------------------------------------- @c ------------------------------------- @c empl.h @c @page @node EMPL @subsection EMPL -- EMPirical distribution with Linear interpolation @table @i @item Required: observed sample @item Speed: Set-up: slow (as sample is sorted), Sampling: very fast (inversion) @item Reinit: not implemented @item Reference: @ifhtml @ref{bib:HLa00,, [HLa00]} @end ifhtml @ifnothtml [HLa00] @end ifnothtml @ifhtml @ref{bib:HLD04,, [HLD04: Sect.12.1.3]} @end ifhtml @ifnothtml [HLD04: Sect.12.1.3] @end ifnothtml @end table EMPL generates random variates from an empirical distribution that is given by an observed sample. This is done by linear interpolation of the empirical CDF. Although this method is suggested in the books of Law and Kelton (2000) and Bratly, Fox, and Schrage (1987) we do not recommend this method at all since it has many theoretical drawbacks: The variance of empirical distribution function does not coincide with the variance of the given sample. Moreover, when the sample increases the empirical density function does not converge to the density of the underlying random variate. Notice that the range of the generated point set is always given by the range of the given sample. This method is provided in UNU.RAN for the sake of completeness. We always recommend to use method EMPK (@pxref{EMPK,,EMPirical distribution with Kernel smoothing}). If the data seem to be far away from having a bell shaped histogram, then we think that naive resampling is still better than linear interpolation. @subsubheading How To Use EMPL creates and samples from an empiral distribution by linear interpolation of the empirical CDF. There are no parameters to set. @noindent @emph{Important}: We do not recommend to use this method! Use method EMPK (@pxref{EMPK,,EMPirical distribution with Kernel smoothing}) instead. @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_empl_new,unur_empl_new} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_empl_new} @deftypefn Function {UNUR_PAR*} unur_empl_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_empl_new} @deftypefn {} {UNUR_PAR*} unur_empl_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifnotinfo @c @c end of empl.h @c ------------------------------------- @c ------------------------------------- @c hist.h @c @page @node HIST @subsection HIST -- HISTogramm of empirical distribution @table @i @item Required: histogram @item Speed: Set-up: moderate, Sampling: fast @item Reinit: not implemented @end table Method HIST generates random variates from an empirical distribution that is given as histogram. Sampling is done using the inversion method. If observed (raw) data are provided we recommend method EMPK (@pxref{EMPK,,EMPirical distribution with Kernel smoothing}) instead of compting a histogram as this reduces information. @subsubheading How To Use Method HIST uses empirical distributions that are given as a histgram. There are no optional parameters. @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_hist_new,unur_hist_new} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_hist_new} @deftypefn Function {UNUR_PAR*} unur_hist_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_hist_new} @deftypefn {} {UNUR_PAR*} unur_hist_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifnotinfo @c @c end of hist.h @c ------------------------------------- @c ------------------------------------- @c methods.dh @c @page @node Methods_for_CVEC @section Methods for continuous multivariate distributions @menu * MVSTD:: MultiVariate continuous STandarD distributions * MVTDR:: Multi-Variate Transformed Density Rejection * NORTA:: NORmal To Anything * VNROU:: Multivariate Naive Ratio-Of-Uniforms method @end menu @subheading Overview of methods @include methods_cvec.texi @c @c end of methods.dh @c ------------------------------------- @c ------------------------------------- @c mvstd.h @c @page @node MVSTD @subsection MVSTD -- MultiVariate continuous STandarD distributions @table @i @item Required: standard distribution from UNU.RAN library (@pxref{Stddist,,Standard distributions}). @item Speed: depends on distribution and generator @item Reinit: supported @end table MVSTD is a wrapper for special generators for multivariate continuous standard distributions. It only works for distributions in the UNU.RAN library of standard distributions (@pxref{Stddist,,Standard distributions}). If a distribution object is provided that is build from scratch, or if no special generator for the given standard distribution is provided, the @code{NULL} pointer is returned. @subsubheading How To Use Create a distribution object for a standard distribution from the UNU.RAN library (@pxref{Stddist,,Standard distributions}). Sampling from truncated distributions (which can be constructed by changing the default domain of a distribution by means of @ifhtml @ref{funct:unur_distr_cvec_set_domain_rect,@command{unur_distr_cvec_set_domain_rect}} @end ifhtml @ifnothtml @command{unur_distr_cvec_set_domain_rect} @end ifnothtml call) is not possible. It is possible to change the parameters and the domain of the chosen distribution and run @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml to reinitialize the generator object. @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_mvstd_new,unur_mvstd_new} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_mvstd_new} @deftypefn Function {UNUR_PAR*} unur_mvstd_new (const @var{UNUR_DISTR* distribution}) Get default parameters for new generator. It requires a distribution object for a multivariate continuous distribution from the UNU.RAN library of standard distributions (@pxref{Stddist,,Standard distributions}). Using a truncated distribution is not possible. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_mvstd_new} @deftypefn {} {UNUR_PAR*} unur_mvstd_new (const @var{UNUR_DISTR* distribution}) Get default parameters for new generator. It requires a distribution object for a multivariate continuous distribution from the UNU.RAN library of standard distributions (@pxref{Stddist,,Standard distributions}). Using a truncated distribution is not possible. @end deftypefn @end ifnotinfo @c @c end of mvstd.h @c ------------------------------------- @c ------------------------------------- @c mvtdr.h @c @page @node MVTDR @subsection MVTDR -- Multi-Variate Transformed Density Rejection @table @i @item Required: log-concave (log)PDF, gradient of (log)PDF @item Optional: mode @item Speed: Set-up: slow, Sampling: depends on dimension @item Reinit: not implemented @item Reference: @ifhtml @ref{bib:HLD04,, [HLD04: Sect.11.3.4; Alg.11.15.]} @end ifhtml @ifnothtml [HLD04: Sect.11.3.4; Alg.11.15.] @end ifnothtml @ifhtml @ref{bib:LJa98,, [LJa98]} @end ifhtml @ifnothtml [LJa98] @end ifnothtml @end table MVTDR a multivariate version of the Transformed Density Rection (@pxref{TDR}) that works for log-concave densities. For this method the domain of the distribution is partitioned into cones with the mode (or the center) of the distribution as their (common) vertex. The hat function is then constructed as tangent planes of the transformed density in each of these cones. The respective construction points lie on the central lines in the cones through the vertex. The point is chosen such that the hat is minimal among all such points (see the given references for more details). The cones are created by starting with the orthants of the reals space. These are then iteratively split when the volume below the hat in such cones is too large. Thus an increasing number of cones results in a better fitting hat function. Notice however, that the required number of cones increases exponentially with the number of dimension. Moreover, due to the construction the rejection does not converge to 1 and remains strictly larger than 1. For distributions with bounded domains the cones are cut to pyramids that cover the domain. @subsubheading How To Use Create a multivariate generator object that contains the PDF and its gradient. This object also should contain the mode of the distribution (or a point nearby should be provided as center of the distribution). The method has three parameter to adjust the method for the given distribution: @table @code @item stepsmin Minimal number of iterations for splitting cones. Notice that we start with 2^dim initial cones and that we arrive at 2^(dim+stepsmin) cones after these splits. So this number must be set with care. It can be set by a @ifhtml @ref{funct:unur_mvtdr_set_stepsmin,@command{unur_mvtdr_set_stepsmin}} @end ifhtml @ifnothtml @command{unur_mvtdr_set_stepsmin} @end ifnothtml call. @item boundsplitting Cones where the volume below the hat is relatively large (i.e. larger than the average volume over all cones times @code{boundsplitting} are further split. This parameter can set via a @ifhtml @ref{funct:unur_mvtdr_set_boundsplitting,@command{unur_mvtdr_set_boundsplitting}} @end ifhtml @ifnothtml @command{unur_mvtdr_set_boundsplitting} @end ifnothtml call. @item maxcones The maximum number of generated cones. When this number is reached, the initialization routine is stopped. Notice that the rejection constant can be still prohibitive large. This parameter can set via a @ifhtml @ref{funct:unur_mvtdr_set_maxcones,@command{unur_mvtdr_set_maxcones}} @end ifhtml @ifnothtml @command{unur_mvtdr_set_maxcones} @end ifnothtml call. @end table Setting of these parameter can be quite tricky. The default settings lead to hat functions where the volume below the hat is similar in each cone. However, there might be some problems with distributions with higher correlations, since then too few cones are created. Then it might be necessary to increase the values for @code{stepsmin} and @code{maxcones} and to set @code{boundsplitting} to @code{0}. The number of cones and the total volume below the hat can be controlled using the respective calls @ifhtml @ref{funct:unur_mvtdr_get_ncones,@command{unur_mvtdr_get_ncones}} @end ifhtml @ifnothtml @command{unur_mvtdr_get_ncones} @end ifnothtml and @ifhtml @ref{funct:unur_mvtdr_get_hatvol,@command{unur_mvtdr_get_hatvol}.} @end ifhtml @ifnothtml @command{unur_mvtdr_get_hatvol}. @end ifnothtml Notice, that the rejection constant is bounded from below by some figure (larger than 1) that depends on the dimension. Unfortunately, the algorithm cannot detect the quality of the constructed hat. @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_mvtdr_new,unur_mvtdr_new} @item @ref{funct:unur_mvtdr_set_stepsmin,unur_mvtdr_set_stepsmin} @item @ref{funct:unur_mvtdr_set_boundsplitting,unur_mvtdr_set_boundsplitting} @item @ref{funct:unur_mvtdr_set_maxcones,unur_mvtdr_set_maxcones} @item @ref{funct:unur_mvtdr_get_ncones,unur_mvtdr_get_ncones} @item @ref{funct:unur_mvtdr_get_hatvol,unur_mvtdr_get_hatvol} @item @ref{funct:unur_mvtdr_set_verify,unur_mvtdr_set_verify} @item @ref{funct:unur_mvtdr_chg_verify,unur_mvtdr_chg_verify} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_mvtdr_new} @deftypefn Function {UNUR_PAR*} unur_mvtdr_new (const @var{UNUR_DISTR* distribution}) Get parameters for generator. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_mvtdr_new} @deftypefn {} {UNUR_PAR*} unur_mvtdr_new (const @var{UNUR_DISTR* distribution}) Get parameters for generator. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_mvtdr_set_stepsmin} @deftypefn Function {int} unur_mvtdr_set_stepsmin (UNUR_PAR* @var{parameters}, int @var{stepsmin}) Set minimum number of triangulation step for each starting cone. @var{stepsmin} must be nonnegative. Default: @code{5}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_mvtdr_set_stepsmin} @deftypefn {} {int} unur_mvtdr_set_stepsmin (UNUR_PAR* @var{parameters}, int @var{stepsmin}) Set minimum number of triangulation step for each starting cone. @var{stepsmin} must be nonnegative. Default: @code{5}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_mvtdr_set_boundsplitting} @deftypefn Function {int} unur_mvtdr_set_boundsplitting (UNUR_PAR* @var{parameters}, double @var{boundsplitting}) Set bound for splitting cones. All cones are split which have a volume below the hat that is greater than @var{bound_splitting} times the average over all volumes. However, the number given by the @ifhtml @ref{funct:unur_mvtdr_set_maxcones,@command{unur_mvtdr_set_maxcones}} @end ifhtml @ifnothtml @command{unur_mvtdr_set_maxcones} @end ifnothtml is not exceeded. Notice that the later number is always reached if @var{bound_splitting} is less than 1. Default: @code{1.5} @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_mvtdr_set_boundsplitting} @deftypefn {} {int} unur_mvtdr_set_boundsplitting (UNUR_PAR* @var{parameters}, double @var{boundsplitting}) Set bound for splitting cones. All cones are split which have a volume below the hat that is greater than @var{bound_splitting} times the average over all volumes. However, the number given by the @ifhtml @ref{funct:unur_mvtdr_set_maxcones,@command{unur_mvtdr_set_maxcones}} @end ifhtml @ifnothtml @command{unur_mvtdr_set_maxcones} @end ifnothtml is not exceeded. Notice that the later number is always reached if @var{bound_splitting} is less than 1. Default: @code{1.5} @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_mvtdr_set_maxcones} @deftypefn Function {int} unur_mvtdr_set_maxcones (UNUR_PAR* @var{parameters}, int @var{maxcones}) Set maximum number of cones. Notice that this number is always increased to @math{2^(dim+stepsmin)} where @i{dim} is the dimension of the distribution object and @i{stepsmin} the given mimimum number of triangulation steps. Notice: For higher dimensions and/or higher correlations between the coordinates of the random vector the required number of cones can be very high. A too small maximum number of cones can lead to a very high rejection constant. Default: @code{10000}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_mvtdr_set_maxcones} @deftypefn {} {int} unur_mvtdr_set_maxcones (UNUR_PAR* @var{parameters}, int @var{maxcones}) Set maximum number of cones. Notice that this number is always increased to @iftex @math{2^{dim+stepsmin}} @end iftex @ifhtml @html 2dim+stepsmin @end html @end ifhtml where @i{dim} is the dimension of the distribution object and @i{stepsmin} the given mimimum number of triangulation steps. Notice: For higher dimensions and/or higher correlations between the coordinates of the random vector the required number of cones can be very high. A too small maximum number of cones can lead to a very high rejection constant. Default: @code{10000}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_mvtdr_get_ncones} @deftypefn Function {int} unur_mvtdr_get_ncones (const @var{UNUR_GEN* generator}) Get the number of cones used for the hat function of the @var{generator}. (In case of an error @code{0} is returned.) @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_mvtdr_get_ncones} @deftypefn {} {int} unur_mvtdr_get_ncones (const @var{UNUR_GEN* generator}) Get the number of cones used for the hat function of the @var{generator}. (In case of an error @code{0} is returned.) @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_mvtdr_get_hatvol} @deftypefn Function {double} unur_mvtdr_get_hatvol (const @var{UNUR_GEN* generator}) Get the volume below the hat for the @var{generator}. (In case of an error @code{UNUR_INFINITY} is returned.) @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_mvtdr_get_hatvol} @deftypefn {} {double} unur_mvtdr_get_hatvol (const @var{UNUR_GEN* generator}) Get the volume below the hat for the @var{generator}. (In case of an error @code{UNUR_INFINITY} is returned.) @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_mvtdr_set_verify} @anchor{funct:unur_mvtdr_chg_verify} @deftypefn Function {int} unur_mvtdr_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) @deftypefnx Function {int} unur_mvtdr_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) Turn verifying of algorithm while sampling on/off. If the condition squeeze(@i{x}) <= PDF(@i{x}) <= hat(@i{x}) is violated for some @i{x} then @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. However notice that this might happen due to round-off errors for a few values of @i{x} (less than 1%). Default is @code{FALSE}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_mvtdr_set_verify} @anchor{funct:unur_mvtdr_chg_verify} @deftypefn {} {int} unur_mvtdr_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) @deftypefnx {} {int} unur_mvtdr_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) Turn verifying of algorithm while sampling on/off. If the condition squeeze(@i{x}) <= PDF(@i{x}) <= hat(@i{x}) is violated for some @i{x} then @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. However notice that this might happen due to round-off errors for a few values of @i{x} (less than 1%). Default is @code{FALSE}. @end deftypefn @end ifnotinfo @c @c end of mvtdr.h @c ------------------------------------- @c ------------------------------------- @c norta.h @c @page @node NORTA @subsection NORTA -- NORmal To Anything @table @i @item Required: rank correlation matrix, marginal distributions @item Speed: Set-up: slow, Sampling: depends on dimension @item Reinit: not implemented @item Reference: @ifhtml @ref{bib:HLD04,, [HLD04: Sect.12.5.2; Alg.12.11.]} @end ifhtml @ifnothtml [HLD04: Sect.12.5.2; Alg.12.11.] @end ifnothtml @end table NORTA (NORmal to anything) is a model to get random vectors with given marginal distributions and rank correlation. @strong{Important:} Notice that marginal distribution and (rank) correlation structure do not uniquely define a multivariate distribution. Thus there are many other (more or less sensible) models. In the NORTA model multinormal random variates with the given (Spearman's) rank correlations are generated. In a second step the (standard normal distributed) marginal variates are transformed by means of the CDF of the normal distribution to get uniform marginals. The resulting random vectors have uniform marginals and the desired rank correlation between its components. Such a random vector is called 'copula'. By means of the inverse CDF the uniform marginals are then transformed into the target marginal distributions. This transformation does not change the rank correlation. For the generation of the multinormal distribution the (Spearman's) rank correlation matrix is transformed into the corresponding (Pearson) correlation matrix. Samples from the resulting multinormal distribution are generated by means of the Cholesky decomposition of the covariance matrix. It can happen that the desired rank correlation matrix is not feasible, i.e., it cannot occur as rank correlation matrix of a multinormal distribution. The resulting "covariance" matrix is not positive definite. In this case an eigenvector correction method is used. Then all non-positive eigenvalues are set to a small positive value and hence the rank correlation matrix of the generated random vectors is "close" to the desired matrix. @subsubheading How To Use Create a multivariate generator object and set marginal distributions using @ifhtml @ref{funct:unur_distr_cvec_set_marginals,@command{unur_distr_cvec_set_marginals},} @end ifhtml @ifnothtml @command{unur_distr_cvec_set_marginals}, @end ifnothtml @ifhtml @ref{funct:unur_distr_cvec_set_marginal_array,@command{unur_distr_cvec_set_marginal_array}} @end ifhtml @ifnothtml @command{unur_distr_cvec_set_marginal_array} @end ifnothtml , or @ifhtml @ref{funct:unur_distr_cvec_set_marginal_list,@command{unur_distr_cvec_set_marginal_list}.} @end ifhtml @ifnothtml @command{unur_distr_cvec_set_marginal_list}. @end ifnothtml (Do not use the corresponding calls for the standard marginal distributions). When the domain of the multivariate distribution is set by of a @ifhtml @ref{funct:unur_distr_cvec_set_domain_rect,@command{unur_distr_cvec_set_domain_rect}} @end ifhtml @ifnothtml @command{unur_distr_cvec_set_domain_rect} @end ifnothtml call then the domain of each of the marginal distributions is truncated by the respective coordinates of the given rectangle. If copulae are required (i.e. multivariate distributions with uniform marginals) such a generator object can be created by means of @ifhtml @ref{funct:unur_distr_copula,@command{unur_distr_copula}} @end ifhtml @ifnothtml @command{unur_distr_copula} @end ifnothtml . There are no optional parameters for this method. @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_norta_new,unur_norta_new} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_norta_new} @deftypefn Function {UNUR_PAR*} unur_norta_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_norta_new} @deftypefn {} {UNUR_PAR*} unur_norta_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifnotinfo @c @c end of norta.h @c ------------------------------------- @c ------------------------------------- @c vnrou.h @c @page @node VNROU @subsection VNROU -- Multivariate Naive Ratio-Of-Uniforms method @table @i @item Required: PDF @item Optional: mode, center, bounding rectangle for acceptance region @item Speed: Set-up: fast or slow, Sampling: slow @item Reinit: supported @item Reference: @ifhtml @ref{bib:WGS91,, [WGS91]} @end ifhtml @ifnothtml [WGS91] @end ifnothtml @end table VNROU is an implementation of the multivariate ratio-of-uniforms method which uses a (minimal) bounding hyper-rectangle, see also @ref{Ratio-of-Uniforms}. It uses an additional parameter @i{r} that can be used for adjusting the algorithm to the given distribution to improve performance and/or to make this method applicable. Larger values of @i{r} increase the class of distributions for which the method works at the expense of higher rejection constants. Moreover, this implementation uses the center @iftex @math{\mu} @end iftex @ifhtml @html mu @end html @end ifhtml @ifinfo @math{mu} @end ifinfo of the distribution (which is set to the mode or mean by default, see @ifhtml @ref{funct:unur_distr_cvec_get_center,@command{unur_distr_cvec_get_center}} @end ifhtml @ifnothtml @command{unur_distr_cvec_get_center} @end ifnothtml for details of its default values). The minimal bounding has then the coordinates @iftex @quotation @math{ v^+ = \sup\limits_{x} (f(x))^{1/r\,d+1}, \hfil\break u^-_i = \inf\limits_{x_i} (x_i-\mu_i) (f(x))^{r/r\,d+1}, \hfil\break u^+_i = \sup\limits_{x_i} (x_i-\mu_i) (f(x))^{r/r\,d+1}, } @end quotation @end iftex @ifhtml @quotation @html v+ = sup_x (f(x))1/r d+1, @*u-_i = inf_x_i (x_i- mu_i) (f(x))r/r d+1, @*u+_i = sup_x_i (x_i- mu_i) (f(x))r/r d+1, @end html @end quotation @end ifhtml @ifinfo @quotation @math{v^+ = sup_(x) (f(x))^(1/r d+1), @*u^-_i = inf_(x_i) (x_i- mu_i) (f(x))^(r/r d+1), @*u^+_i = sup_(x_i) (x_i- mu_i) (f(x))^(r/r d+1),} @end quotation @end ifinfo @noindent where @iftex @math{x_i} @end iftex @ifhtml @html x_i @end html @end ifhtml @ifinfo @math{x_i} @end ifinfo is the @i{i}-th coordinate of point @i{x}; @iftex @math{\mu_i} @end iftex @ifhtml @html mu_i @end html @end ifhtml @ifinfo @math{mu_i} @end ifinfo is the @i{i}-th coordinate of the center @iftex @math{\mu.} @end iftex @ifhtml @html mu. @end html @end ifhtml @ifinfo @math{mu.} @end ifinfo @iftex @math{d} @end iftex @ifhtml @html d @end html @end ifhtml @ifinfo @math{d} @end ifinfo denotes the dimension of the distribution. These bounds can either be given directly, or are computed automatically by means of an numerical routine by Hooke and Jeeves @ifhtml @ref{bib:HJa61,, [HJa61]} @end ifhtml @ifnothtml [HJa61] @end ifnothtml called direct search (see @file{src/utils/hooke.c} for further references and details). Of course this algorithm can fail, especially when this rectangle is not bounded. It is important to note that the algorithm works with @iftex @math{PDF(x-center)} @end iftex @ifhtml @html PDF(x-center) @end html @end ifhtml @ifinfo @math{PDF(x-center)} @end ifinfo instead of @iftex @math{PDF(x),} @end iftex @ifhtml @html PDF(x), @end html @end ifhtml @ifinfo @math{PDF(x),} @end ifinfo i.e. the bounding rectangle has to be provided for @iftex @math{PDF(x-center).} @end iftex @ifhtml @html PDF(x-center). @end html @end ifhtml @ifinfo @math{PDF(x-center).} @end ifinfo This is important as otherwise the acceptance region can become a very long and skinny ellipsoid along a diagonal of the (huge) bounding rectangle. VNROU is based on the rejection method (@pxref{Rejection}), and it is important to note that the acceptance probability decreases exponentially with dimension. Thus even for moderately many dimensions (e.g. 5) the number of repetitions to get one random vector can be prohibitively large and the algorithm seems to stay in an infinite loop. @subsubheading How To Use For using the VNROU method UNU.RAN needs the PDF of the distribution. Additionally, the parameter @i{r} can be set via a @ifhtml @ref{funct:unur_vnrou_set_r,@command{unur_vnrou_set_r}} @end ifhtml @ifnothtml @command{unur_vnrou_set_r} @end ifnothtml call. Notice that the acceptance probability decreases when @i{r} is increased. On the other hand is is more unlikely that the bounding rectangle does not exist if @i{r} is small. A bounding rectangle can be given by the @ifhtml @ref{funct:unur_vnrou_set_u,@command{unur_vnrou_set_u}} @end ifhtml @ifnothtml @command{unur_vnrou_set_u} @end ifnothtml and @ifhtml @ref{funct:unur_vnrou_set_v,@command{unur_vnrou_set_v}} @end ifhtml @ifnothtml @command{unur_vnrou_set_v} @end ifnothtml calls. @emph{Important:} The bounding rectangle has to be provided for the function @iftex @math{PDF(x-center)!} @end iftex @ifhtml @html PDF(x-center)! @end html @end ifhtml @ifinfo @math{PDF(x-center)!} @end ifinfo Notice that @code{center} is the center of the given distribution, see @ifhtml @ref{funct:unur_distr_cvec_set_center,@command{unur_distr_cvec_set_center}.} @end ifhtml @ifnothtml @command{unur_distr_cvec_set_center}. @end ifnothtml If in doubt or if this value is not optimal, it can be changed (overridden) by a @ifhtml @ref{funct:unur_distr_cvec_set_center,@command{unur_distr_cvec_set_center}} @end ifhtml @ifnothtml @command{unur_distr_cvec_set_center} @end ifnothtml call. If the coordinates of the bounding rectangle are not provided by the user then the minimal bounding rectangle is computed automatically. By means of @ifhtml @ref{funct:unur_vnrou_set_verify,@command{unur_vnrou_set_verify}} @end ifhtml @ifnothtml @command{unur_vnrou_set_verify} @end ifnothtml and @ifhtml @ref{funct:unur_vnrou_chg_verify,@command{unur_vnrou_chg_verify}} @end ifhtml @ifnothtml @command{unur_vnrou_chg_verify} @end ifnothtml one can run the sampling algorithm in a checking mode, i.e., in every cycle of the rejection loop it is checked whether the used rectangle indeed enclosed the acceptance region of the distribution. When in doubt (e.g., when it is not clear whether the numerical routine has worked correctly) this can be used to run a small Monte Carlo study. @strong{Important:} The rejection constant (i.e. the expected number of iterations for generationg one random vector) can be extremely high, in particular when the dimension is 4 or higher. Then the algorithm will perform almost infinite loops. Thus it is recommended to read the volume below the hat function by means of the @ifhtml @ref{funct:unur_vnrou_get_volumehat,@command{unur_vnrou_get_volumehat}} @end ifhtml @ifnothtml @command{unur_vnrou_get_volumehat} @end ifnothtml call. The returned number divided by the volume below the PDF (which is 1 in case of a normalized PDF) gives the rejection constant. It is possible to change the parameters and the domain of the chosen distribution and run @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml to reinitialize the generator object. Notice, that the coordinates of a bounding rectangle given by @ifhtml @ref{funct:unur_vnrou_set_u,@command{unur_vnrou_set_u}} @end ifhtml @ifnothtml @command{unur_vnrou_set_u} @end ifnothtml and @ifhtml @ref{funct:unur_vnrou_set_v,@command{unur_vnrou_set_v}} @end ifhtml @ifnothtml @command{unur_vnrou_set_v} @end ifnothtml calls are used also when the generator is reused. These can be changed by means of @ifhtml @ref{funct:unur_vnrou_chg_u,@command{unur_vnrou_chg_u}} @end ifhtml @ifnothtml @command{unur_vnrou_chg_u} @end ifnothtml and @ifhtml @ref{funct:unur_vnrou_chg_v,@command{unur_vnrou_chg_v}} @end ifhtml @ifnothtml @command{unur_vnrou_chg_v} @end ifnothtml calls. (If no such coordinates have been given, then they are computed numerically during the reinitialization proceedure.) @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_vnrou_new,unur_vnrou_new} @item @ref{funct:unur_vnrou_set_u,unur_vnrou_set_u} @item @ref{funct:unur_vnrou_chg_u,unur_vnrou_chg_u} @item @ref{funct:unur_vnrou_set_v,unur_vnrou_set_v} @item @ref{funct:unur_vnrou_chg_v,unur_vnrou_chg_v} @item @ref{funct:unur_vnrou_set_r,unur_vnrou_set_r} @item @ref{funct:unur_vnrou_set_verify,unur_vnrou_set_verify} @item @ref{funct:unur_vnrou_chg_verify,unur_vnrou_chg_verify} @item @ref{funct:unur_vnrou_get_volumehat,unur_vnrou_get_volumehat} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_vnrou_new} @deftypefn Function {UNUR_PAR*} unur_vnrou_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_vnrou_new} @deftypefn {} {UNUR_PAR*} unur_vnrou_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_vnrou_set_u} @deftypefn Function {int} unur_vnrou_set_u (UNUR_PAR* @var{parameters}, double* @var{umin}, double* @var{umax}) Sets left and right boundaries of bounding hyper-rectangle. If no values are given, the boundary of the minimal bounding hyper-rectangle is computed numerically. @strong{Important}: The boundaries are those of the density shifted by the center of the distribution, i.e., for the function @math{PDF(x-center)!} @emph{Notice}: Computing the minimal bounding rectangle may fail under some circumstances. Moreover, for multimodal distributions the bounds might be too small as only local extrema are computed. Nevertheless, for log-concave distributions it should work. Default: not set (i.e. computed automatically) @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_vnrou_set_u} @deftypefn {} {int} unur_vnrou_set_u (UNUR_PAR* @var{parameters}, double* @var{umin}, double* @var{umax}) Sets left and right boundaries of bounding hyper-rectangle. If no values are given, the boundary of the minimal bounding hyper-rectangle is computed numerically. @strong{Important}: The boundaries are those of the density shifted by the center of the distribution, i.e., for the function @iftex @math{PDF(x-center)!} @end iftex @ifhtml @html PDF(x-center)! @end html @end ifhtml @emph{Notice}: Computing the minimal bounding rectangle may fail under some circumstances. Moreover, for multimodal distributions the bounds might be too small as only local extrema are computed. Nevertheless, for log-concave distributions it should work. Default: not set (i.e. computed automatically) @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_vnrou_chg_u} @deftypefn Function {int} unur_vnrou_chg_u (UNUR_GEN* @var{generator}, double* @var{umin}, double* @var{umax}) Change left and right boundaries of bounding hyper-rectangle. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_vnrou_chg_u} @deftypefn {} {int} unur_vnrou_chg_u (UNUR_GEN* @var{generator}, double* @var{umin}, double* @var{umax}) Change left and right boundaries of bounding hyper-rectangle. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_vnrou_set_v} @deftypefn Function {int} unur_vnrou_set_v (UNUR_PAR* @var{parameters}, double @var{vmax}) Set upper boundary for bounding hyper-rectangle. If no values are given, the density at the mode is evaluated. If no mode is given for the distribution it is computed numerically (and might fail). Default: not set (i.e. computed automatically) @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_vnrou_set_v} @deftypefn {} {int} unur_vnrou_set_v (UNUR_PAR* @var{parameters}, double @var{vmax}) Set upper boundary for bounding hyper-rectangle. If no values are given, the density at the mode is evaluated. If no mode is given for the distribution it is computed numerically (and might fail). Default: not set (i.e. computed automatically) @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_vnrou_chg_v} @deftypefn Function {int} unur_vnrou_chg_v (UNUR_GEN* @var{generator}, double @var{vmax}) Change upper boundary for bounding hyper-rectangle. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_vnrou_chg_v} @deftypefn {} {int} unur_vnrou_chg_v (UNUR_GEN* @var{generator}, double @var{vmax}) Change upper boundary for bounding hyper-rectangle. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_vnrou_set_r} @deftypefn Function {int} unur_vnrou_set_r (UNUR_PAR* @var{parameters}, double @var{r}) Sets the parameter @var{r} of the generalized multivariate ratio-of-uniforms method. @emph{Notice}: This parameter must satisfy @var{r}>0. Default: @code{1}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_vnrou_set_r} @deftypefn {} {int} unur_vnrou_set_r (UNUR_PAR* @var{parameters}, double @var{r}) Sets the parameter @var{r} of the generalized multivariate ratio-of-uniforms method. @emph{Notice}: This parameter must satisfy @var{r}>0. Default: @code{1}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_vnrou_set_verify} @deftypefn Function {int} unur_vnrou_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) Turn verifying of algorithm while sampling on/off. If the condition PDF(@i{x}) <= hat(@i{x}) is violated for some @i{x} then @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. However notice that this might happen due to round-off errors for a few values of @i{x} (less than 1%). Default is @code{FALSE}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_vnrou_set_verify} @deftypefn {} {int} unur_vnrou_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) Turn verifying of algorithm while sampling on/off. If the condition PDF(@i{x}) <= hat(@i{x}) is violated for some @i{x} then @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. However notice that this might happen due to round-off errors for a few values of @i{x} (less than 1%). Default is @code{FALSE}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_vnrou_chg_verify} @deftypefn Function {int} unur_vnrou_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) Change the verifying of algorithm while sampling on/off. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_vnrou_chg_verify} @deftypefn {} {int} unur_vnrou_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) Change the verifying of algorithm while sampling on/off. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_vnrou_get_volumehat} @deftypefn Function {double} unur_vnrou_get_volumehat (const @var{UNUR_GEN* generator}) Get the volume of below the hat. For normalized densities, i.e. when the volume below PDF is 1, this value equals the rejection constant for the vnrou method. In case of an error UNUR_INFINITY is returned. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_vnrou_get_volumehat} @deftypefn {} {double} unur_vnrou_get_volumehat (const @var{UNUR_GEN* generator}) Get the volume of below the hat. For normalized densities, i.e. when the volume below PDF is 1, this value equals the rejection constant for the vnrou method. In case of an error UNUR_INFINITY is returned. @end deftypefn @end ifnotinfo @c @c end of vnrou.h @c ------------------------------------- @c ------------------------------------- @c methods.dh @c @page @node MCMC_Methods_for_CVEC @section Markov chain samplers for continuous multivariate distributions @menu * GIBBS:: Markov Chain - GIBBS sampler * HITRO:: Markov Chain - HIT-and-run sampler with Ratio-Of-uniforms @end menu Markov chain samplers generate sequences of random vectors which have the target distribution as stationary distribution. There generated vectors are (more or less) correlated and it might take a long time until the sequence has converged to the given target distribution. @strong{Beware: MCMC sampling can be dangerous!} @subheading Overview of methods @include methods_mcmc.texi @c @c end of methods.dh @c ------------------------------------- @c ------------------------------------- @c gibbs.h @c @page @node GIBBS @subsection GIBBS -- Markov Chain - GIBBS sampler @table @i @item Required: T-concave logPDF, derivatives of logPDF @item Speed: Set-up: fast, Sampling: moderate @item Reinit: not implemented @item Reference: @ifhtml @ref{bib:HLD04,, [HLD04: Sect.14.1.2]} @end ifhtml @ifnothtml [HLD04: Sect.14.1.2] @end ifnothtml @end table Method GIBBS implements a Gibbs sampler for a multivariate distribution with given joint density and its gradient. When running such a Markov chain all coordinates are updated cyclically using full conditional distributions. After each step the state of the chain is returned (i.e., a random point is returned whenever a single coordinate has been updated). It is also possible to return only points after all coordinates have been updated by "thinning" the chain. Moreover, to reduce autocorrelation this thinning factor can be any integer. Notice, however, that the sampling time for a chain of given length is increased by the same factor, too. GIBBS also provides a variant of the Gibbs sampler where in each step a point from the full conditional distribution along some random direction is sampled. This direction is chosen uniformly from the sphere in each step. This method is also known as Hit-and-Run algorithm for non-uniform distributions. Our experiences shows that the original Gibbs sampler with sampling along coordinate axes is superior to random direction sampling as long as the correlations between the components of the random vector are not too high. For both variants transformed density rejection (see methods @pxref{TDR} and @pxref{ARS}) is used to sample from the full conditional distributions. In opposition to the univariate case, it is important that the factor @code{c} is as large as possible. I.e., for a log-concave density @code{c} must be set to @code{0.}, since otherwise numerical underflow might stop the algorithm. @emph{Important:} GIBBS does not generate independent random points. The starting point of the Gibbs chain must be in a "typical" region of the target distribution. If such a point is not known or would be too expensive, then the first part of the chain should be discarded (burn-in of the chain). @subsubheading How To Use For using the GIBBS method UNU.RAN needs the logarithm of the PDF of the multivariate joint distribution and its gradient or partial derivatives. It provides two variants: @table @emph @item coordinate direction sampling (Gibbs sampling) [default] The coordinates are updated cyclically. It requires the partial derivatives of the (logarithm of the) PDF of the target distribution, see @ifhtml @ref{funct:unur_distr_cvec_set_pdlogpdf,@command{unur_distr_cvec_set_pdlogpdf}.} @end ifhtml @ifnothtml @command{unur_distr_cvec_set_pdlogpdf}. @end ifnothtml Otherwise, the gradient of the logPDF (see @ifhtml @ref{funct:unur_distr_cvec_set_dlogpdf,@command{unur_distr_cvec_set_dlogpdf}} @end ifhtml @ifnothtml @command{unur_distr_cvec_set_dlogpdf} @end ifnothtml ) is used, which is more expensive. This variant can be selected using @ifhtml @ref{funct:unur_gibbs_set_variant_coordinate,@command{unur_gibbs_set_variant_coordinate}.} @end ifhtml @ifnothtml @command{unur_gibbs_set_variant_coordinate}. @end ifnothtml @item random direction sampling (nonuniform Hit-and-Run algorithm) In each step is a direction is sampled uniformly from the sphere and the next point in the chain is sampled from the full conditional distribution along this direction. It requires the gradient of the logPDF and thus each step is more expensive than each step for coordinate direction sampling. This variant can be selected using @ifhtml @ref{funct:unur_gibbs_set_variant_random_direction,@command{unur_gibbs_set_variant_random_direction}.} @end ifhtml @ifnothtml @command{unur_gibbs_set_variant_random_direction}. @end ifnothtml @end table It is important that the @code{c} parameter for the TDR method is as large as possible. For logconcave distribution it must be set to @code{0}, since otherwise numerical underflow can cause the algorithm to stop. The starting point of the Gibbs chain must be "typical" for the target distribution. If such a point is not known or would be too expensive, then the first part of the chain should be discarded (burn-in of the chain). When using the @ifhtml @ref{funct:unur_gibbs_set_burnin,@command{unur_gibbs_set_burnin}} @end ifhtml @ifnothtml @command{unur_gibbs_set_burnin} @end ifnothtml call this is done during the setup of the Gibbs sampler object. In case of a fatal error in the generator for conditional distributions the methods generates points that contain UNUR_INFINITY. @strong{Warning:} The algorithm requires that all full conditionals for the given distribution object are @i{T}-concave. However, this property is not checked. If this property is not satisfied, then generation from the conditional distributions becomes (very) slow and might fail or (even worse) produces random vectors from an incorrect distribution. When using @ifhtml @ref{funct:unur_gibbs_set_burnin,@command{unur_gibbs_set_burnin}} @end ifhtml @ifnothtml @command{unur_gibbs_set_burnin} @end ifnothtml then the setup already might fail. Thus when in doubt whether GIBBS can be used for the targent distribution it is a good idea to use a burn-in for checking. @emph{Remark:} It might happen (very rarely) that the chain becomes stuck due to numerical errors. (This is in particular the case when the given PDF does not fulfill the condition of this method.) When this happens during burn-in then the setup is aborted (i.e. it fails). Otherwise the chain restarts again from its starting point. @strong{Warning:} Be carefull with debugging flags. If it contains flag @code{0x01000000u} it produces a lot of output for each step in the algorithm. (This flag is switched of in the default debugging flags). @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_gibbs_new,unur_gibbs_new} @item @ref{funct:unur_gibbs_set_variant_coordinate,unur_gibbs_set_variant_coordinate} @item @ref{funct:unur_gibbs_set_variant_random_direction,unur_gibbs_set_variant_random_direction} @item @ref{funct:unur_gibbs_set_c,unur_gibbs_set_c} @item @ref{funct:unur_gibbs_set_startingpoint,unur_gibbs_set_startingpoint} @item @ref{funct:unur_gibbs_set_thinning,unur_gibbs_set_thinning} @item @ref{funct:unur_gibbs_set_burnin,unur_gibbs_set_burnin} @item @ref{funct:unur_gibbs_get_state,unur_gibbs_get_state} @item @ref{funct:unur_gibbs_chg_state,unur_gibbs_chg_state} @item @ref{funct:unur_gibbs_reset_state,unur_gibbs_reset_state} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_gibbs_new} @deftypefn Function {UNUR_PAR*} unur_gibbs_new (const @var{UNUR_DISTR* distribution}) ........................................................................... @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_gibbs_new} @deftypefn {} {UNUR_PAR*} unur_gibbs_new (const @var{UNUR_DISTR* distribution}) ........................................................................... @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_gibbs_set_variant_coordinate} @deftypefn Function {int} unur_gibbs_set_variant_coordinate (UNUR_PAR* @var{parameters}) Coordinate Direction Sampling: Sampling along the coordinate directions (cyclic). This is the default. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_gibbs_set_variant_coordinate} @deftypefn {} {int} unur_gibbs_set_variant_coordinate (UNUR_PAR* @var{parameters}) Coordinate Direction Sampling: Sampling along the coordinate directions (cyclic). This is the default. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_gibbs_set_variant_random_direction} @deftypefn Function {int} unur_gibbs_set_variant_random_direction (UNUR_PAR* @var{parameters}) Random Direction Sampling: Sampling along the random directions. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_gibbs_set_variant_random_direction} @deftypefn {} {int} unur_gibbs_set_variant_random_direction (UNUR_PAR* @var{parameters}) Random Direction Sampling: Sampling along the random directions. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_gibbs_set_c} @deftypefn Function {int} unur_gibbs_set_c (UNUR_PAR* @var{parameters}, double @var{c}) Set parameter @var{c} for transformation @math{T} of the transformed density rejection method. Currently only values between @code{0} and @code{-0.5} are allowed. If @code{c} is between @code{0} and @code{-0.5} it is set to @code{-0.5}. For @var{c} @code{=0} (for logconcave densities) method ARS (@pxref{ARS}) is used which is very robust against badly normalized PDFs. For other values method TDR (@pxref{TDR}) is used. The value for @var{c} should be as large as possible to avoid fatal numerical underflows. Thus for log-concave distributions @var{c} must be set to @code{0.} Default is @code{0}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_gibbs_set_c} @deftypefn {} {int} unur_gibbs_set_c (UNUR_PAR* @var{parameters}, double @var{c}) Set parameter @var{c} for transformation @iftex @math{T} @end iftex @ifhtml @html T @end html @end ifhtml of the transformed density rejection method. Currently only values between @code{0} and @code{-0.5} are allowed. If @code{c} is between @code{0} and @code{-0.5} it is set to @code{-0.5}. For @var{c} @code{=0} (for logconcave densities) method ARS (@pxref{ARS}) is used which is very robust against badly normalized PDFs. For other values method TDR (@pxref{TDR}) is used. The value for @var{c} should be as large as possible to avoid fatal numerical underflows. Thus for log-concave distributions @var{c} must be set to @code{0.} Default is @code{0}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_gibbs_set_startingpoint} @deftypefn Function {int} unur_gibbs_set_startingpoint (UNUR_PAR* @var{parameters}, const @var{double* x0}) Sets the starting point of the Gibbs sampler. @var{x0} must be a "typical" point of the given distribution. If such a "typical" point is not known and a starting point is merely guessed, the first part of the Gibbs chain should be discarded (@emph{burn-in}), e.g.\ by mean of the @ifhtml @ref{funct:unur_gibbs_set_burnin,@command{unur_gibbs_set_burnin}} @end ifhtml @ifnothtml @command{unur_gibbs_set_burnin} @end ifnothtml call. Default is the result of @ifhtml @ref{funct:unur_distr_cvec_get_center,@command{unur_distr_cvec_get_center}} @end ifhtml @ifnothtml @command{unur_distr_cvec_get_center} @end ifnothtml for the given distribution object. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_gibbs_set_startingpoint} @deftypefn {} {int} unur_gibbs_set_startingpoint (UNUR_PAR* @var{parameters}, const @var{double* x0}) Sets the starting point of the Gibbs sampler. @var{x0} must be a "typical" point of the given distribution. If such a "typical" point is not known and a starting point is merely guessed, the first part of the Gibbs chain should be discarded (@emph{burn-in}), e.g.\ by mean of the @ifhtml @ref{funct:unur_gibbs_set_burnin,@command{unur_gibbs_set_burnin}} @end ifhtml @ifnothtml @command{unur_gibbs_set_burnin} @end ifnothtml call. Default is the result of @ifhtml @ref{funct:unur_distr_cvec_get_center,@command{unur_distr_cvec_get_center}} @end ifhtml @ifnothtml @command{unur_distr_cvec_get_center} @end ifnothtml for the given distribution object. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_gibbs_set_thinning} @deftypefn Function {int} unur_gibbs_set_thinning (UNUR_PAR* @var{parameters}, int @var{thinning}) Sets the @var{thinning} parameter. When @var{thinning} is set to @i{k} then every @i{k}-th point from the iteration is returned by the sampling algorithm. @emph{Notice}: This parameter must satisfy @var{thinning}>=1. Default: @code{1}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_gibbs_set_thinning} @deftypefn {} {int} unur_gibbs_set_thinning (UNUR_PAR* @var{parameters}, int @var{thinning}) Sets the @var{thinning} parameter. When @var{thinning} is set to @i{k} then every @i{k}-th point from the iteration is returned by the sampling algorithm. @emph{Notice}: This parameter must satisfy @var{thinning}>=1. Default: @code{1}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_gibbs_set_burnin} @deftypefn Function {int} unur_gibbs_set_burnin (UNUR_PAR* @var{parameters}, int @var{burnin}) If a "typical" point for the target distribution is not known but merely guessed, the first part of the Gibbs chain should be discarded (@emph{burn-in}). This can be done during the initialization of the generator object. The length of the burn-in can is then @var{burnin}. When method GIBBS is not applicable for the target distribution then the initialization already might fail during the burn-in. Thus this reduces the risk of running a generator that returns UNUR_INFINITY cased by some fatal error during sampling. The thinning factor set by a @ifhtml @ref{funct:unur_gibbs_set_thinning,@command{unur_gibbs_set_thinning}} @end ifhtml @ifnothtml @command{unur_gibbs_set_thinning} @end ifnothtml call has no effect on the length of the burn-in, i.e., for the burn-in always a thinning factor @code{1} is used. @emph{Notice}: This parameter must satisfy @var{thinning}>=0. Default: @code{0}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_gibbs_set_burnin} @deftypefn {} {int} unur_gibbs_set_burnin (UNUR_PAR* @var{parameters}, int @var{burnin}) If a "typical" point for the target distribution is not known but merely guessed, the first part of the Gibbs chain should be discarded (@emph{burn-in}). This can be done during the initialization of the generator object. The length of the burn-in can is then @var{burnin}. When method GIBBS is not applicable for the target distribution then the initialization already might fail during the burn-in. Thus this reduces the risk of running a generator that returns UNUR_INFINITY cased by some fatal error during sampling. The thinning factor set by a @ifhtml @ref{funct:unur_gibbs_set_thinning,@command{unur_gibbs_set_thinning}} @end ifhtml @ifnothtml @command{unur_gibbs_set_thinning} @end ifnothtml call has no effect on the length of the burn-in, i.e., for the burn-in always a thinning factor @code{1} is used. @emph{Notice}: This parameter must satisfy @var{thinning}>=0. Default: @code{0}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_gibbs_get_state} @anchor{funct:unur_gibbs_chg_state} @deftypefn Function {const double*} unur_gibbs_get_state (UNUR_GEN* @var{generator}) @deftypefnx Function {int} unur_gibbs_chg_state (UNUR_GEN* @var{generator}, const @var{double* state}) Get and change the current state of the Gibbs chain. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_gibbs_get_state} @anchor{funct:unur_gibbs_chg_state} @deftypefn {} {const double*} unur_gibbs_get_state (UNUR_GEN* @var{generator}) @deftypefnx {} {int} unur_gibbs_chg_state (UNUR_GEN* @var{generator}, const @var{double* state}) Get and change the current state of the Gibbs chain. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_gibbs_reset_state} @deftypefn Function {int} unur_gibbs_reset_state (UNUR_GEN* @var{generator}) Reset state of chain to starting point. @emph{Notice:} Currently this function does not reset the generators for conditional distributions. Thus it is not possible to get the same Gibbs chain even when the underlying uniform random number generator is reset. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_gibbs_reset_state} @deftypefn {} {int} unur_gibbs_reset_state (UNUR_GEN* @var{generator}) Reset state of chain to starting point. @emph{Notice:} Currently this function does not reset the generators for conditional distributions. Thus it is not possible to get the same Gibbs chain even when the underlying uniform random number generator is reset. @end deftypefn @end ifnotinfo @c @c end of gibbs.h @c ------------------------------------- @c ------------------------------------- @c hitro.h @c @page @node HITRO @subsection HITRO -- Markov Chain - HIT-and-run sampler with Ratio-Of-uniforms @table @i @item Required: PDF @item Optional: mode, center, bounding rectangle for acceptance region @item Speed: Set-up: fast, Sampling: fast @item Reinit: not implemented @item Reference: @ifhtml @ref{bib:KLPa05,, [KLPa05]} @end ifhtml @ifnothtml [KLPa05] @end ifnothtml @end table HITRO is an implementation of a hit-and-run sampler that runs on the acceptance region of the multivariate ratio-of-uniforms method, see @ref{Ratio-of-Uniforms}. The Ratio-of-Uniforms transforms the region below the density into some region that we call "region of acceptance" in the following. The minimal bounding hyperrectangle of this region is given by @iftex @quotation @math{ v^+ = \sup\limits_{x} (f(x))^{1/r\,d+1}, \hfil\break u^-_i = \inf\limits_{x_i} (x_i-\mu_i) (f(x))^{r/r\,d+1}, \hfil\break u^+_i = \sup\limits_{x_i} (x_i-\mu_i) (f(x))^{r/r\,d+1}, } @end quotation @end iftex @ifhtml @quotation @html v+ = sup_x (f(x))1/r d+1, @*u-_i = inf_x_i (x_i- mu_i) (f(x))r/r d+1, @*u+_i = sup_x_i (x_i- mu_i) (f(x))r/r d+1, @end html @end quotation @end ifhtml @ifinfo @quotation @math{v^+ = sup_(x) (f(x))^(1/r d+1), @*u^-_i = inf_(x_i) (x_i- mu_i) (f(x))^(r/r d+1), @*u^+_i = sup_(x_i) (x_i- mu_i) (f(x))^(r/r d+1),} @end quotation @end ifinfo @noindent where @i{d} denotes the dimension of the distribution; @iftex @math{x_i} @end iftex @ifhtml @html x_i @end html @end ifhtml @ifinfo @math{x_i} @end ifinfo is the @i{i}-th coordinate of point @i{x}; @iftex @math{\mu_i} @end iftex @ifhtml @html mu_i @end html @end ifhtml @ifinfo @math{mu_i} @end ifinfo is the @i{i}-th coordinate of the center @iftex @math{\mu} @end iftex @ifhtml @html mu @end html @end ifhtml @ifinfo @math{mu} @end ifinfo of the distribution, i.e., a point in the "main region" of the distribution. Using the center is important, since otherwise the acceptance region can become a very long and skinny ellipsoid along a diagonal of the (huge) bounding rectangle. For each step of the Hit-and-Run algorithm we have to choose some direction. This direction together with the current point of the chain determines a straight line. Then a point is sampled uniformly on intersection of this line and the region of acceptance. This is done by rejection from a uniform distribution on a line segment that covers it. Depending of the chosen variant the endpoints of this covering line are computed either by means of a (not necessary minimal) bounding hyper-rectangle, or just the "covering plate" of the bounding hyper-rectangle. The required bounds of the hyper-rectable can be given directly by the user. Otherwise, these are computed automatically by means of a numerical routine by Hooke and Jeeves @ifhtml @ref{bib:HJa61,, [HJa61]} @end ifhtml @ifnothtml [HJa61] @end ifnothtml called direct search (see @file{src/utils/hooke.c} for further references and details). However, this expensive computation can be avoided by determine these bounds "on the fly" by the following adaptive algorithm: Start with some (small) hyper-rectangle and enlarge it whenever the endpoints of the covering line segment are not contained in the acceptance region of the Ratio-of-Unfiorms method. This approach works reliable as long as the region of acceptance is convex. The performance of the uniform sampling from the line segment is much improved if the covering line is adjusted (shortened) whenever a point is rejected (adaptive sampling). This technique reduces the expected number of iterations enormously. Method HITRO requires that the region of acceptance of the Ratio-of-Uniforms method is bounded. The shape of this region can be controlled by a parameter @i{r}. Higher values of @i{r} result in larger classes of distributions with bounded region of acceptance. (A distribution that has such a bounded region for some @i{r} also has a bounded region for every @i{r'} greater than @i{r}.) On the other hand the acceptance probability decreases with increasing @i{r}. Moreover, round-off errors are more likely and (for large values of @i{r}) might result in a chain with a stationary distribution different from the target distribution. Method HITRO works optimal for distributions whose region of acceptance is convex. This is in particular the case for all log-concave distributions when we set @i{r} = @code{1}. For bounded but non-convex regions of acceptance convergence is yet not guarenteed by mathematical theory. @subsubheading How To Use Method HITRO requires the PDF of the target distribution (derivatives are not necessary). The acceptance region of the Ratio-of-Uniforms transformation must be bounded. Its shape is controlled by parameter @i{r}. By default this parameter is set to @code{1} as this guarentees a convex region of acceptance when the PDF of the given distribution is log-concave. It should only be set to a different (higher!) value using @ifhtml @ref{funct:unur_vnrou_set_r,@command{unur_vnrou_set_r}} @end ifhtml @ifnothtml @command{unur_vnrou_set_r} @end ifnothtml if otherwise @iftex @math{x_i\,(f(x))^{r/r\,d+1}} @end iftex @ifhtml @html x_i (f(x))r/r d+1 @end html @end ifhtml @ifinfo @math{x_i (f(x))^(r/r d+1)} @end ifinfo were not bounded for each coordinate. There are two variants of the HITRO sampler: @table @emph @item coordinate direction sampling. [default] The coordinates are updated cyclically. This can be seen as a Gibbs sampler running on the acceptance region of the Ratio-of-Uniforms method. This variant can be selected using @ifhtml @ref{funct:unur_hitro_set_variant_coordinate,@command{unur_hitro_set_variant_coordinate}.} @end ifhtml @ifnothtml @command{unur_hitro_set_variant_coordinate}. @end ifnothtml @item random direction sampling. In each step is a direction is sampled uniformly from the sphere. This variant can be selected using @ifhtml @ref{funct:unur_hitro_set_variant_random_direction,@command{unur_hitro_set_variant_random_direction}.} @end ifhtml @ifnothtml @command{unur_hitro_set_variant_random_direction}. @end ifnothtml @end table Notice that each iteration of the coordinate direction sampler is cheaper than an iteration of the random direction sampler. Sampling uniformly from the line segment can be adjusted in several ways: @table @emph @item Adaptive line sampling vs. simple rejection. When adaptive line sampling is switched on, the covering line is shortened whenever a point is rejected. However, when the region of acceptance is not convex the line segment from which we have to sample might not be connected. We found that the algorithm still works but at the time being there is no formal proof that the generated Markov chain has the required stationary distribution. Adaptive line sampling can switch on/off by means of the @ifhtml @ref{funct:unur_hitro_set_use_adaptiveline,@command{unur_hitro_set_use_adaptiveline}} @end ifhtml @ifnothtml @command{unur_hitro_set_use_adaptiveline} @end ifnothtml call. @item Bounding hyper-rectangle vs. "covering plate". For computing the covering line we can use the bounding hyper-rectangle or just its upper bound. The latter saves computing time during the setup and when computing the covering during at each iteration step at the expense of a longer covering line. When adaptive line sampling is used the total generation time for the entire chain is shorter when only the "covering plate" is used. @emph{Notice:} When coordinate sampling is used the entire bounding rectangle is used. Using the entire bounding hyper-rectangle can be switched on/off by means of the @ifhtml @ref{funct:unur_hitro_set_use_boundingrectangle,@command{unur_hitro_set_use_boundingrectangle}} @end ifhtml @ifnothtml @command{unur_hitro_set_use_boundingrectangle} @end ifnothtml call. @item Deterministic vs. adaptive bounding hyper-rectangle. A bounding rectangle can be given by the @ifhtml @ref{funct:unur_vnrou_set_u,@command{unur_vnrou_set_u}} @end ifhtml @ifnothtml @command{unur_vnrou_set_u} @end ifnothtml and @ifhtml @ref{funct:unur_vnrou_set_v,@command{unur_vnrou_set_v}} @end ifhtml @ifnothtml @command{unur_vnrou_set_v} @end ifnothtml calls. Otherwise, the minimal bounding rectangle is computed automatically during the setup by means of a numerical algorithm. However, this is (very) slow especially in higher dimensions and it might happen that this algorithm (like any other numerical algorithm) does not return a correct result. Alternatively the bounding rectangle can be computed adaptively. In the latter case @ifhtml @ref{funct:unur_vnrou_set_u,@command{unur_vnrou_set_u}} @end ifhtml @ifnothtml @command{unur_vnrou_set_u} @end ifnothtml and @ifhtml @ref{funct:unur_vnrou_set_v,@command{unur_vnrou_set_v}} @end ifhtml @ifnothtml @command{unur_vnrou_set_v} @end ifnothtml can be used to provide a starting rectangle which must be sufficiently small. Then both endpoints of the covering line segment are always check whether they are outside the acceptance region of the Ratio-of-Uniforms method. If they are not, then the line segment and the ("bounding") rectangle are enlarged using a factor that can be given using the @ifhtml @ref{funct:unur_hitro_set_adaptive_multiplier,@command{unur_hitro_set_adaptive_multiplier}} @end ifhtml @ifnothtml @command{unur_hitro_set_adaptive_multiplier} @end ifnothtml call. Notice, that running this method in the adaptive rectangle mode requires that the region of acceptance is convex when random directions are used, or the given PDF is unimodal when coordinate direction sampling is used. Moreover, it requires two additional calls to the PDF in each iteration step of the chain. Using addaptive bounding rectangles can be switched on/off by means of the @ifhtml @ref{funct:unur_hitro_set_use_adaptiverectangle,@command{unur_hitro_set_use_adaptiverectangle}} @end ifhtml @ifnothtml @command{unur_hitro_set_use_adaptiverectangle} @end ifnothtml call. @end table The algorithm takes of a bounded rectangular domain given by a @ifhtml @ref{funct:unur_distr_cvec_set_domain_rect,@command{unur_distr_cvec_set_domain_rect}} @end ifhtml @ifnothtml @command{unur_distr_cvec_set_domain_rect} @end ifnothtml call, i.e. the PDF is set to zero for every @i{x} outside the given domain. However, it is only the coordinate direction sampler where the boundary values are directly used to get the endpoins of the coverline line for the line sampling step. @emph{Important:} The bounding rectangle has to be provided for the function @iftex @math{PDF(x-center)!} @end iftex @ifhtml @html PDF(x-center)! @end html @end ifhtml @ifinfo @math{PDF(x-center)!} @end ifinfo Notice that @code{center} is the center of the given distribution, see @ifhtml @ref{funct:unur_distr_cvec_set_center,@command{unur_distr_cvec_set_center}.} @end ifhtml @ifnothtml @command{unur_distr_cvec_set_center}. @end ifnothtml If in doubt or if this value is not optimal, it can be changed (overridden) by a @ifhtml @ref{funct:unur_distr_cvec_set_center,@command{unur_distr_cvec_set_center}} @end ifhtml @ifnothtml @command{unur_distr_cvec_set_center} @end ifnothtml call. @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_hitro_new,unur_hitro_new} @item @ref{funct:unur_hitro_set_variant_coordinate,unur_hitro_set_variant_coordinate} @item @ref{funct:unur_hitro_set_variant_random_direction,unur_hitro_set_variant_random_direction} @item @ref{funct:unur_hitro_set_use_adaptiveline,unur_hitro_set_use_adaptiveline} @item @ref{funct:unur_hitro_set_use_boundingrectangle,unur_hitro_set_use_boundingrectangle} @item @ref{funct:unur_hitro_set_use_adaptiverectangle,unur_hitro_set_use_adaptiverectangle} @item @ref{funct:unur_hitro_set_r,unur_hitro_set_r} @item @ref{funct:unur_hitro_set_v,unur_hitro_set_v} @item @ref{funct:unur_hitro_set_u,unur_hitro_set_u} @item @ref{funct:unur_hitro_set_adaptive_multiplier,unur_hitro_set_adaptive_multiplier} @item @ref{funct:unur_hitro_set_startingpoint,unur_hitro_set_startingpoint} @item @ref{funct:unur_hitro_set_thinning,unur_hitro_set_thinning} @item @ref{funct:unur_hitro_set_burnin,unur_hitro_set_burnin} @item @ref{funct:unur_hitro_get_state,unur_hitro_get_state} @item @ref{funct:unur_hitro_chg_state,unur_hitro_chg_state} @item @ref{funct:unur_hitro_reset_state,unur_hitro_reset_state} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_hitro_new} @deftypefn Function {UNUR_PAR*} unur_hitro_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_hitro_new} @deftypefn {} {UNUR_PAR*} unur_hitro_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_hitro_set_variant_coordinate} @deftypefn Function {int} unur_hitro_set_variant_coordinate (UNUR_PAR* @var{parameters}) Coordinate Direction Sampling: Sampling along the coordinate directions (cyclic). @emph{Notice:} For this variant the entire bounding rectangle is always used independent of the @ifhtml @ref{funct:unur_hitro_set_use_boundingrectangle,@command{unur_hitro_set_use_boundingrectangle}} @end ifhtml @ifnothtml @command{unur_hitro_set_use_boundingrectangle} @end ifnothtml call. This is the default. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_hitro_set_variant_coordinate} @deftypefn {} {int} unur_hitro_set_variant_coordinate (UNUR_PAR* @var{parameters}) Coordinate Direction Sampling: Sampling along the coordinate directions (cyclic). @emph{Notice:} For this variant the entire bounding rectangle is always used independent of the @ifhtml @ref{funct:unur_hitro_set_use_boundingrectangle,@command{unur_hitro_set_use_boundingrectangle}} @end ifhtml @ifnothtml @command{unur_hitro_set_use_boundingrectangle} @end ifnothtml call. This is the default. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_hitro_set_variant_random_direction} @deftypefn Function {int} unur_hitro_set_variant_random_direction (UNUR_PAR* @var{parameters}) Random Direction Sampling: Sampling along the random directions. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_hitro_set_variant_random_direction} @deftypefn {} {int} unur_hitro_set_variant_random_direction (UNUR_PAR* @var{parameters}) Random Direction Sampling: Sampling along the random directions. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_hitro_set_use_adaptiveline} @deftypefn Function {int} unur_hitro_set_use_adaptiveline (UNUR_PAR* @var{parameters}, int @var{adaptive}) When @var{adaptive} is set to @code{TRUE} adaptive line sampling is applied, otherwise simple rejection is used. @emph{Notice:} When adaptive line sampling is switched off, the entire bounding rectangle must be used since otherwise the sampling time can be arbitrarily slow. @emph{Warning:} When adaptive line sampling is switched off, sampling can be arbitrarily slow. In particular this happens when random direction sampling is used for distributions with rectangular domains. Then the algorithm can be trapped into a vertex (or even edge). Default is @code{TRUE}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_hitro_set_use_adaptiveline} @deftypefn {} {int} unur_hitro_set_use_adaptiveline (UNUR_PAR* @var{parameters}, int @var{adaptive}) When @var{adaptive} is set to @code{TRUE} adaptive line sampling is applied, otherwise simple rejection is used. @emph{Notice:} When adaptive line sampling is switched off, the entire bounding rectangle must be used since otherwise the sampling time can be arbitrarily slow. @emph{Warning:} When adaptive line sampling is switched off, sampling can be arbitrarily slow. In particular this happens when random direction sampling is used for distributions with rectangular domains. Then the algorithm can be trapped into a vertex (or even edge). Default is @code{TRUE}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_hitro_set_use_boundingrectangle} @deftypefn Function {int} unur_hitro_set_use_boundingrectangle (UNUR_PAR* @var{parameters}, int @var{rectangle}) When @var{rectangle} is set to @code{TRUE} the entire bounding rectangle is used for computing the covering line. Otherwise, only an upper bound for the acceptance region is used. @emph{Notice:} When coordinate sampling is used the entire bounding rectangle has is always used and this call has no effect. Default: @code{FALSE} for random direction samplig, @code{TRUE} for coordinate direction sampling. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_hitro_set_use_boundingrectangle} @deftypefn {} {int} unur_hitro_set_use_boundingrectangle (UNUR_PAR* @var{parameters}, int @var{rectangle}) When @var{rectangle} is set to @code{TRUE} the entire bounding rectangle is used for computing the covering line. Otherwise, only an upper bound for the acceptance region is used. @emph{Notice:} When coordinate sampling is used the entire bounding rectangle has is always used and this call has no effect. Default: @code{FALSE} for random direction samplig, @code{TRUE} for coordinate direction sampling. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_hitro_set_use_adaptiverectangle} @deftypefn Function {int} unur_hitro_set_use_adaptiverectangle (UNUR_PAR* @var{parameters}, int @var{adaptive}) When @var{adaptive} is set to @code{FALSE} the bounding rectangle is determined during the setup. Either, it is computed automatically by a (slow) numerical method, or it must be provided by @ifhtml @ref{funct:unur_vnrou_set_u,@command{unur_vnrou_set_u}} @end ifhtml @ifnothtml @command{unur_vnrou_set_u} @end ifnothtml and @ifhtml @ref{funct:unur_vnrou_set_v,@command{unur_vnrou_set_v}} @end ifhtml @ifnothtml @command{unur_vnrou_set_v} @end ifnothtml calls. If @var{adaptive} is set to @code{TRUE} the bounding rectangle is computed adaptively. In this case the @ifhtml @ref{funct:unur_vnrou_set_u,@command{unur_vnrou_set_u}} @end ifhtml @ifnothtml @command{unur_vnrou_set_u} @end ifnothtml and @ifhtml @ref{funct:unur_vnrou_set_v,@command{unur_vnrou_set_v}} @end ifhtml @ifnothtml @command{unur_vnrou_set_v} @end ifnothtml calls can be used to provide a starting rectangle. This should be sufficiently small. If not given then we assume @math{v_(max) = 1,} @math{u_(min)=(-0.001,-0.001,...,-0.001),} and @math{u_(max)=(0.001,0.001,...,0.001).} Adaptive enlargements of the bounding hyperrectangle can be controlled set setting an enlargement factor given by a @ifhtml @ref{funct:unur_hitro_set_adaptive_multiplier,@command{unur_hitro_set_adaptive_multiplier}} @end ifhtml @ifnothtml @command{unur_hitro_set_adaptive_multiplier} @end ifnothtml call. Using adaptive computation of the bounding rectangle reduces the setup time significantly (when it is not given by the user) at the expense of two additional PDF evaluations during each iteration step. @emph{Important:} Using adaptive bounding rectangles requires that the region of acceptance is convex when random directions are used, or a unimodal PDF when coordinate direction sampling is used. Default: @code{FALSE} for random direction samplig, @code{TRUE} for coordinate direction sampling. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_hitro_set_use_adaptiverectangle} @deftypefn {} {int} unur_hitro_set_use_adaptiverectangle (UNUR_PAR* @var{parameters}, int @var{adaptive}) When @var{adaptive} is set to @code{FALSE} the bounding rectangle is determined during the setup. Either, it is computed automatically by a (slow) numerical method, or it must be provided by @ifhtml @ref{funct:unur_vnrou_set_u,@command{unur_vnrou_set_u}} @end ifhtml @ifnothtml @command{unur_vnrou_set_u} @end ifnothtml and @ifhtml @ref{funct:unur_vnrou_set_v,@command{unur_vnrou_set_v}} @end ifhtml @ifnothtml @command{unur_vnrou_set_v} @end ifnothtml calls. If @var{adaptive} is set to @code{TRUE} the bounding rectangle is computed adaptively. In this case the @ifhtml @ref{funct:unur_vnrou_set_u,@command{unur_vnrou_set_u}} @end ifhtml @ifnothtml @command{unur_vnrou_set_u} @end ifnothtml and @ifhtml @ref{funct:unur_vnrou_set_v,@command{unur_vnrou_set_v}} @end ifhtml @ifnothtml @command{unur_vnrou_set_v} @end ifnothtml calls can be used to provide a starting rectangle. This should be sufficiently small. If not given then we assume @iftex @math{v_{max} = 1,} @end iftex @ifhtml @html v_max = 1, @end html @end ifhtml @iftex @math{u_{min}=(-0.001,-0.001,\ldots,-0.001),} @end iftex @ifhtml @html u_min=(-0.001,-0.001,...,-0.001), @end html @end ifhtml and @iftex @math{u_{max}=(0.001,0.001,\ldots,0.001).} @end iftex @ifhtml @html u_max=(0.001,0.001,...,0.001). @end html @end ifhtml Adaptive enlargements of the bounding hyperrectangle can be controlled set setting an enlargement factor given by a @ifhtml @ref{funct:unur_hitro_set_adaptive_multiplier,@command{unur_hitro_set_adaptive_multiplier}} @end ifhtml @ifnothtml @command{unur_hitro_set_adaptive_multiplier} @end ifnothtml call. Using adaptive computation of the bounding rectangle reduces the setup time significantly (when it is not given by the user) at the expense of two additional PDF evaluations during each iteration step. @emph{Important:} Using adaptive bounding rectangles requires that the region of acceptance is convex when random directions are used, or a unimodal PDF when coordinate direction sampling is used. Default: @code{FALSE} for random direction samplig, @code{TRUE} for coordinate direction sampling. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_hitro_set_r} @deftypefn Function {int} unur_hitro_set_r (UNUR_PAR* @var{parameters}, double @var{r}) Sets the parameter @var{r} of the generalized multivariate ratio-of-uniforms method. @emph{Notice}: This parameter must satisfy @var{r}>0. Default: @code{1}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_hitro_set_r} @deftypefn {} {int} unur_hitro_set_r (UNUR_PAR* @var{parameters}, double @var{r}) Sets the parameter @var{r} of the generalized multivariate ratio-of-uniforms method. @emph{Notice}: This parameter must satisfy @var{r}>0. Default: @code{1}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_hitro_set_v} @deftypefn Function {int} unur_hitro_set_v (UNUR_PAR* @var{parameters}, double @var{vmax}) Set upper boundary for bounding hyper-rectangle. If not set not set the mode of the distribution is used. If adaptive bounding rectangles the value is used for the starting rectangle. If not given (and the mode of the distribution is not known) then @var{vmax}=@code{1e-3} is used. If deterministic bounding rectangles these values are the given values are used for the rectangle. If no value is given (and the mode of the distribution is not known), the upper bound of the minimal bounding hyper-rectangle is computed numerically (slow). Default: not set. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_hitro_set_v} @deftypefn {} {int} unur_hitro_set_v (UNUR_PAR* @var{parameters}, double @var{vmax}) Set upper boundary for bounding hyper-rectangle. If not set not set the mode of the distribution is used. If adaptive bounding rectangles the value is used for the starting rectangle. If not given (and the mode of the distribution is not known) then @var{vmax}=@code{1e-3} is used. If deterministic bounding rectangles these values are the given values are used for the rectangle. If no value is given (and the mode of the distribution is not known), the upper bound of the minimal bounding hyper-rectangle is computed numerically (slow). Default: not set. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_hitro_set_u} @deftypefn Function {int} unur_hitro_set_u (UNUR_PAR* @var{parameters}, const @var{double* umin}, const @var{double* umax}) Sets left and right boundaries of bounding hyper-rectangle. If adaptive bounding rectangles these values are used for the starting rectangle. If not given then @var{umin}=@code{@{-b,-b,@dots{},-b@}} and @var{umax}=@code{@{b,b,@dots{},b@}} with @code{b=1.e-3} is used. If deterministic bounding rectangles these values are the given values are used for the rectangle. If no values are given, the boundary of the minimal bounding hyper-rectangle is computed numerically (slow). @strong{Important}: The boundaries are those of the density shifted by the center of the distribution, i.e., for the function @math{PDF(x-center)!} @emph{Notice}: Computing the minimal bounding rectangle may fail under some circumstances. Moreover, for multimodal distributions the bounds might be too small as only local extrema are computed. Nevertheless, for log-concave distributions it should work. Default: not set. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_hitro_set_u} @deftypefn {} {int} unur_hitro_set_u (UNUR_PAR* @var{parameters}, const @var{double* umin}, const @var{double* umax}) Sets left and right boundaries of bounding hyper-rectangle. If adaptive bounding rectangles these values are used for the starting rectangle. If not given then @var{umin}=@code{@{-b,-b,@dots{},-b@}} and @var{umax}=@code{@{b,b,@dots{},b@}} with @code{b=1.e-3} is used. If deterministic bounding rectangles these values are the given values are used for the rectangle. If no values are given, the boundary of the minimal bounding hyper-rectangle is computed numerically (slow). @strong{Important}: The boundaries are those of the density shifted by the center of the distribution, i.e., for the function @iftex @math{PDF(x-center)!} @end iftex @ifhtml @html PDF(x-center)! @end html @end ifhtml @emph{Notice}: Computing the minimal bounding rectangle may fail under some circumstances. Moreover, for multimodal distributions the bounds might be too small as only local extrema are computed. Nevertheless, for log-concave distributions it should work. Default: not set. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_hitro_set_adaptive_multiplier} @deftypefn Function {int} unur_hitro_set_adaptive_multiplier (UNUR_PAR* @var{parameters}, double @var{factor}) Adaptive enlargements of the bounding hyperrectangle can be controlled set setting the enlargement @var{factor}. This must be greater than 1. Values close to 1 result in small adaptive steps and thus reduce the risk of too large bounding rectangles. On the other hand many adaptive steps might be necessary. @emph{Notice:} For practical reasons this call does not accept values for @var{factor} less than @code{1.0001}. If this value is UNUR_INFINITY this results in infinite loops. Default: @code{1.1} @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_hitro_set_adaptive_multiplier} @deftypefn {} {int} unur_hitro_set_adaptive_multiplier (UNUR_PAR* @var{parameters}, double @var{factor}) Adaptive enlargements of the bounding hyperrectangle can be controlled set setting the enlargement @var{factor}. This must be greater than 1. Values close to 1 result in small adaptive steps and thus reduce the risk of too large bounding rectangles. On the other hand many adaptive steps might be necessary. @emph{Notice:} For practical reasons this call does not accept values for @var{factor} less than @code{1.0001}. If this value is UNUR_INFINITY this results in infinite loops. Default: @code{1.1} @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_hitro_set_startingpoint} @deftypefn Function {int} unur_hitro_set_startingpoint (UNUR_PAR* @var{parameters}, const @var{double* x0}) Sets the starting point of the HITRO sampler in the original scale. @var{x0} must be a "typical" point of the given distribution. If such a "typical" point is not known and a starting point is merely guessed, the first part of the HITRO chain should be discarded (@emph{burn-in}), e.g.\ by mean of the @ifhtml @ref{funct:unur_hitro_set_burnin,@command{unur_hitro_set_burnin}} @end ifhtml @ifnothtml @command{unur_hitro_set_burnin} @end ifnothtml call. @emph{Important:} The PDF of the distribution must not vanish at the given point @var{x0}. Default is the result of @ifhtml @ref{funct:unur_distr_cvec_get_center,@command{unur_distr_cvec_get_center}} @end ifhtml @ifnothtml @command{unur_distr_cvec_get_center} @end ifnothtml for the given distribution object. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_hitro_set_startingpoint} @deftypefn {} {int} unur_hitro_set_startingpoint (UNUR_PAR* @var{parameters}, const @var{double* x0}) Sets the starting point of the HITRO sampler in the original scale. @var{x0} must be a "typical" point of the given distribution. If such a "typical" point is not known and a starting point is merely guessed, the first part of the HITRO chain should be discarded (@emph{burn-in}), e.g.\ by mean of the @ifhtml @ref{funct:unur_hitro_set_burnin,@command{unur_hitro_set_burnin}} @end ifhtml @ifnothtml @command{unur_hitro_set_burnin} @end ifnothtml call. @emph{Important:} The PDF of the distribution must not vanish at the given point @var{x0}. Default is the result of @ifhtml @ref{funct:unur_distr_cvec_get_center,@command{unur_distr_cvec_get_center}} @end ifhtml @ifnothtml @command{unur_distr_cvec_get_center} @end ifnothtml for the given distribution object. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_hitro_set_thinning} @deftypefn Function {int} unur_hitro_set_thinning (UNUR_PAR* @var{parameters}, int @var{thinning}) Sets the @var{thinning} parameter. When @var{thinning} is set to @i{k} then every @i{k}-th point from the iteration is returned by the sampling algorithm. If thinning has to be set such that each coordinate is updated when using coordinate direction sampling, then @var{thinning} should be @code{dim+1} (or any multiple of it) where @code{dim} is the dimension of the distribution object. @emph{Notice}: This parameter must satisfy @var{thinning}>=1. Default: @code{1}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_hitro_set_thinning} @deftypefn {} {int} unur_hitro_set_thinning (UNUR_PAR* @var{parameters}, int @var{thinning}) Sets the @var{thinning} parameter. When @var{thinning} is set to @i{k} then every @i{k}-th point from the iteration is returned by the sampling algorithm. If thinning has to be set such that each coordinate is updated when using coordinate direction sampling, then @var{thinning} should be @code{dim+1} (or any multiple of it) where @code{dim} is the dimension of the distribution object. @emph{Notice}: This parameter must satisfy @var{thinning}>=1. Default: @code{1}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_hitro_set_burnin} @deftypefn Function {int} unur_hitro_set_burnin (UNUR_PAR* @var{parameters}, int @var{burnin}) If a "typical" point for the target distribution is not known but merely guessed, the first part of the HITRO chain should be discarded (@emph{burn-in}). This can be done during the initialization of the generator object. The length of the burn-in can is then @var{burnin}. The thinning factor set by a @ifhtml @ref{funct:unur_hitro_set_thinning,@command{unur_hitro_set_thinning}} @end ifhtml @ifnothtml @command{unur_hitro_set_thinning} @end ifnothtml call has no effect on the length of the burn-in, i.e., for the burn-in always a thinning factor @code{1} is used. @emph{Notice}: This parameter must satisfy @var{thinning}>=0. Default: @code{0}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_hitro_set_burnin} @deftypefn {} {int} unur_hitro_set_burnin (UNUR_PAR* @var{parameters}, int @var{burnin}) If a "typical" point for the target distribution is not known but merely guessed, the first part of the HITRO chain should be discarded (@emph{burn-in}). This can be done during the initialization of the generator object. The length of the burn-in can is then @var{burnin}. The thinning factor set by a @ifhtml @ref{funct:unur_hitro_set_thinning,@command{unur_hitro_set_thinning}} @end ifhtml @ifnothtml @command{unur_hitro_set_thinning} @end ifnothtml call has no effect on the length of the burn-in, i.e., for the burn-in always a thinning factor @code{1} is used. @emph{Notice}: This parameter must satisfy @var{thinning}>=0. Default: @code{0}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_hitro_get_state} @anchor{funct:unur_hitro_chg_state} @deftypefn Function {const double*} unur_hitro_get_state (UNUR_GEN* @var{generator}) @deftypefnx Function {int} unur_hitro_chg_state (UNUR_GEN* @var{generator}, const @var{double* state}) Get and change the current state of the HITRO chain. @emph{Notice:} The state variable contains the point in the @code{dim+1} dimensional point in the (tansformed) region of acceptance of the Ratio-of-Uniforms method. Its coordinate are stored in the following order: @code{state[] = @{v, u1, u2, @dots{}, udim@}}. If the state can only be changed if the given @var{state} is inside this region. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_hitro_get_state} @anchor{funct:unur_hitro_chg_state} @deftypefn {} {const double*} unur_hitro_get_state (UNUR_GEN* @var{generator}) @deftypefnx {} {int} unur_hitro_chg_state (UNUR_GEN* @var{generator}, const @var{double* state}) Get and change the current state of the HITRO chain. @emph{Notice:} The state variable contains the point in the @code{dim+1} dimensional point in the (tansformed) region of acceptance of the Ratio-of-Uniforms method. Its coordinate are stored in the following order: @code{state[] = @{v, u1, u2, @dots{}, udim@}}. If the state can only be changed if the given @var{state} is inside this region. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_hitro_reset_state} @deftypefn Function {int} unur_hitro_reset_state (UNUR_GEN* @var{generator}) Reset state of chain to starting point. @emph{Notice:} Currently this function does not reset the generators for conditional distributions. Thus it is not possible to get the same HITRO chain even when the underlying uniform random number generator is reset. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_hitro_reset_state} @deftypefn {} {int} unur_hitro_reset_state (UNUR_GEN* @var{generator}) Reset state of chain to starting point. @emph{Notice:} Currently this function does not reset the generators for conditional distributions. Thus it is not possible to get the same HITRO chain even when the underlying uniform random number generator is reset. @end deftypefn @end ifnotinfo @c @c end of hitro.h @c ------------------------------------- @c ------------------------------------- @c methods.dh @c @page @node Methods_for_CVEMP @section Methods for continuous empirical multivariate distributions @menu * VEMPK:: (Vector) EMPirical distribution with Kernel smoothing @end menu @subheading Overview of methods @include methods_cvemp.texi @subheading Example @smallexample @include ref_example_vemp.texi @end smallexample @subheading Example (String API) (not implemented) @c @c end of methods.dh @c ------------------------------------- @c ------------------------------------- @c vempk.h @c @page @node VEMPK @subsection VEMPK -- (Vector) EMPirical distribution with Kernel smoothing @table @i @item Required: observed sample @item Speed: Set-up: slow, Sampling: slow (depends on dimension) @item Reinit: not implemented @item Reference: @ifhtml @ref{bib:HLa00,, [HLa00]} @end ifhtml @ifnothtml [HLa00] @end ifnothtml @ifhtml @ref{bib:HLD04,, [HLD04: Sect.12.2.1]} @end ifhtml @ifnothtml [HLD04: Sect.12.2.1] @end ifnothtml @end table VEMPK generates random variates from a multivariate empirical distribution that is given by an observed sample. The idea is that simply choosing a random point from the sample and to return it with some added noise results in a method that has very nice properties, as it can be seen as sampling from a kernel density estimate. Clearly we have to decide about the density of the noise (called kernel) and about the covariance matrix of the noise. The mathematical theory of kernel density estimation shows us that we are comparatively free in choosing the kernel. It also supplies us with a simple formula to compute the optimal standarddeviation of the noise, called bandwidth (or window width) of the kernel. Currently only a Gaussian kernel with the same covariance matrix as the given sample is implemented. However it is possible to choose between a variance corrected version or those with optimal MISE. Additionally a smoothing factor can be set to adjust the estimated density to non-bell-shaped data densities. @subsubheading How To Use VEMPK uses empirical distributions. The main parameter would be the choice if of kernel density. However, currently only Gaussian kernels are supported. The parameters for the density are computed by a simple but robust method. However, it is possible to control its behavior by changing the smoothing factor. Additionally, variance correction can be swithed on (at the price of suboptimal MISE). @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_vempk_new,unur_vempk_new} @item @ref{funct:unur_vempk_set_smoothing,unur_vempk_set_smoothing} @item @ref{funct:unur_vempk_chg_smoothing,unur_vempk_chg_smoothing} @item @ref{funct:unur_vempk_set_varcor,unur_vempk_set_varcor} @item @ref{funct:unur_vempk_chg_varcor,unur_vempk_chg_varcor} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_vempk_new} @deftypefn Function {UNUR_PAR*} unur_vempk_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_vempk_new} @deftypefn {} {UNUR_PAR*} unur_vempk_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_vempk_set_smoothing} @anchor{funct:unur_vempk_chg_smoothing} @deftypefn Function {int} unur_vempk_set_smoothing (UNUR_PAR* @var{parameters}, double @var{smoothing}) @deftypefnx Function {int} unur_vempk_chg_smoothing (UNUR_GEN* @var{generator}, double @var{smoothing}) Set and change the smoothing factor. The smoothing factor controlles how ``smooth'' the resulting density estimation will be. A smoothing factor equal to 0 results in naive resampling. A very large smoothing factor (together with the variance correction) results in a density which is approximately equal to the kernel. Default is 1 which results in a smoothing parameter minimising the MISE (mean integrated squared error) if the data are not too far away from normal. If a large smoothing factor is used, then variance correction must be switched on. Default: @code{1} @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_vempk_set_smoothing} @anchor{funct:unur_vempk_chg_smoothing} @deftypefn {} {int} unur_vempk_set_smoothing (UNUR_PAR* @var{parameters}, double @var{smoothing}) @deftypefnx {} {int} unur_vempk_chg_smoothing (UNUR_GEN* @var{generator}, double @var{smoothing}) Set and change the smoothing factor. The smoothing factor controlles how ``smooth'' the resulting density estimation will be. A smoothing factor equal to 0 results in naive resampling. A very large smoothing factor (together with the variance correction) results in a density which is approximately equal to the kernel. Default is 1 which results in a smoothing parameter minimising the MISE (mean integrated squared error) if the data are not too far away from normal. If a large smoothing factor is used, then variance correction must be switched on. Default: @code{1} @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_vempk_set_varcor} @anchor{funct:unur_vempk_chg_varcor} @deftypefn Function {int} unur_vempk_set_varcor (UNUR_PAR* @var{parameters}, int @var{varcor}) @deftypefnx Function {int} unur_vempk_chg_varcor (UNUR_GEN* @var{generator}, int @var{varcor}) Switch variance correction in generator on/off. If @var{varcor} is @code{TRUE} then the variance of the used density estimation is the same as the sample variance. However this increases the MISE of the estimation a little bit. Default is @code{FALSE}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_vempk_set_varcor} @anchor{funct:unur_vempk_chg_varcor} @deftypefn {} {int} unur_vempk_set_varcor (UNUR_PAR* @var{parameters}, int @var{varcor}) @deftypefnx {} {int} unur_vempk_chg_varcor (UNUR_GEN* @var{generator}, int @var{varcor}) Switch variance correction in generator on/off. If @var{varcor} is @code{TRUE} then the variance of the used density estimation is the same as the sample variance. However this increases the MISE of the estimation a little bit. Default is @code{FALSE}. @end deftypefn @end ifnotinfo @c @c end of vempk.h @c ------------------------------------- @c ------------------------------------- @c methods.dh @c @page @node Methods_for_DISCR @section Methods for discrete univariate distributions @menu * DARI:: Discrete Automatic Rejection Inversion * DAU:: (Discrete) Alias-Urn method * DEXT:: wrapper for Discrete EXTernal generators * DGT:: (Discrete) Guide Table method (indexed search) * DSROU:: Discrete Simple Ratio-Of-Uniforms method * DSS:: (Discrete) Sequential Search method * DSTD:: Discrete STandarD distributions @end menu @subheading Overview of methods @include methods_discr.texi @subheading Example @smallexample @include ref_example_discr.texi @end smallexample @subheading Example (String API) @smallexample @include ref_example_discr_str.texi @end smallexample @c @c end of methods.dh @c ------------------------------------- @c ------------------------------------- @c dari.h @c @page @node DARI @subsection DARI -- Discrete Automatic Rejection Inversion @table @i @item Required: T-concave PMF, mode, approximate area @item Speed: Set-up: moderate, Sampling: fast @item Reinit: supported @item Reference: @ifhtml @ref{bib:HDa96,, [HDa96]} @end ifhtml @ifnothtml [HDa96] @end ifnothtml @ifhtml @ref{bib:HLD04,, [HLD04: Sect.10.2; Alg.10.4]} @end ifhtml @ifnothtml [HLD04: Sect.10.2; Alg.10.4] @end ifnothtml @end table DARI is based on rejection inversion, which can be seen as an adaptation of transformed density rejection to discrete distributions. The used transformation is @iftex @math{-1/\sqrt{x}} @end iftex @ifhtml @html -1/sqrt(x) @end html @end ifhtml @ifinfo @math{-1/sqrt(x)} @end ifinfo . DARI uses three almost optimal points for constructing the (continuous) hat. Rejection is then done in horizontal direction. Rejection inversion uses only one uniform random variate per trial. DARI has moderate set-up times (the PMF is evaluated nine times), and good marginal speed, especially if an auxiliary array is used to store values during generation. DARI works for all @iftex @math{T_{-1/2}} @end iftex @ifhtml @html T_-1/2 @end html @end ifhtml @ifinfo @math{T_(-1/2)} @end ifinfo -concave distributions. It requires the PMF and the location of the mode. Moreover the approximate sum over the PMF is used. (If no sum is given for the distribution the algorithm assumes that it is approximately 1.) The rejection constant is bounded from above by 4 for all @i{T}-concave distributions. @subsubheading How To Use DARI works for discrete distribution object with given PMF. The sum over probabilities should be approximately one. Otherwise it must be set by a @ifhtml @ref{funct:unur_distr_discr_set_pmfsum,@command{unur_distr_discr_set_pmfsum}} @end ifhtml @ifnothtml @command{unur_distr_discr_set_pmfsum} @end ifnothtml call to its (approximate) value. The size of an auxiliary table can be set by @ifhtml @ref{funct:unur_dari_set_tablesize,@command{unur_dari_set_tablesize}.} @end ifhtml @ifnothtml @command{unur_dari_set_tablesize}. @end ifnothtml The expected number of evaluations can be reduced by switching the use of squeezes by means of @ifhtml @ref{funct:unur_dari_set_squeeze,@command{unur_dari_set_squeeze}.} @end ifhtml @ifnothtml @command{unur_dari_set_squeeze}. @end ifnothtml It is possible to change the parameters and the domain of the chosen distribution and run @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml to reinitialize the generator object. Notice, that derived parameters like the mode must also be (re-) set if the parameters or the domain has be changed. There exists a test mode that verifies whether the conditions for the method are satisfied or not. It can be switched on by calling @ifhtml @ref{funct:unur_dari_set_verify,@command{unur_dari_set_verify}} @end ifhtml @ifnothtml @command{unur_dari_set_verify} @end ifnothtml and @ifhtml @ref{funct:unur_dari_chg_verify,@command{unur_dari_chg_verify},} @end ifhtml @ifnothtml @command{unur_dari_chg_verify}, @end ifnothtml respectively. Notice however that sampling is (much) slower then. @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_dari_new,unur_dari_new} @item @ref{funct:unur_dari_set_squeeze,unur_dari_set_squeeze} @item @ref{funct:unur_dari_set_tablesize,unur_dari_set_tablesize} @item @ref{funct:unur_dari_set_cpfactor,unur_dari_set_cpfactor} @item @ref{funct:unur_dari_set_verify,unur_dari_set_verify} @item @ref{funct:unur_dari_chg_verify,unur_dari_chg_verify} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_dari_new} @deftypefn Function {UNUR_PAR*} unur_dari_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_dari_new} @deftypefn {} {UNUR_PAR*} unur_dari_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_dari_set_squeeze} @deftypefn Function {int} unur_dari_set_squeeze (UNUR_PAR* @var{parameters}, int @var{squeeze}) Turn utilization of the squeeze of the algorithm on/off. This squeeze does not resamble the squeeze of the continuous TDR method. It was especially designed for rejection inversion. The squeeze is not necessary if the size of the auxiliary table is big enough (for the given distribution). Using a squeeze is suggested to speed up the algorithm if the domain of the distribution is very big or if only small samples are produced. Default: no squeeze. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_dari_set_squeeze} @deftypefn {} {int} unur_dari_set_squeeze (UNUR_PAR* @var{parameters}, int @var{squeeze}) Turn utilization of the squeeze of the algorithm on/off. This squeeze does not resamble the squeeze of the continuous TDR method. It was especially designed for rejection inversion. The squeeze is not necessary if the size of the auxiliary table is big enough (for the given distribution). Using a squeeze is suggested to speed up the algorithm if the domain of the distribution is very big or if only small samples are produced. Default: no squeeze. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_dari_set_tablesize} @deftypefn Function {int} unur_dari_set_tablesize (UNUR_PAR* @var{parameters}, int @var{size}) Set the size for the auxiliary table, that stores constants computed during generation. If @var{size} is set to @code{0} no table is used. The speed-up can be impressive if the PMF is expensive to evaluate and the ``main part of the distribution'' is concentrated in an interval shorter than the size of the table. Default is @code{100}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_dari_set_tablesize} @deftypefn {} {int} unur_dari_set_tablesize (UNUR_PAR* @var{parameters}, int @var{size}) Set the size for the auxiliary table, that stores constants computed during generation. If @var{size} is set to @code{0} no table is used. The speed-up can be impressive if the PMF is expensive to evaluate and the ``main part of the distribution'' is concentrated in an interval shorter than the size of the table. Default is @code{100}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_dari_set_cpfactor} @deftypefn Function {int} unur_dari_set_cpfactor (UNUR_PAR* @var{parameters}, double @var{cp_factor}) Set factor for position of the left and right construction point, resp. The @var{cp_factor} is used to find almost optimal construction points for the hat function. The @var{cp_factor} must be positive and should not exceed 2. There is no need to change this factor in almost all situations. Default is @code{0.664}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_dari_set_cpfactor} @deftypefn {} {int} unur_dari_set_cpfactor (UNUR_PAR* @var{parameters}, double @var{cp_factor}) Set factor for position of the left and right construction point, resp. The @var{cp_factor} is used to find almost optimal construction points for the hat function. The @var{cp_factor} must be positive and should not exceed 2. There is no need to change this factor in almost all situations. Default is @code{0.664}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_dari_set_verify} @anchor{funct:unur_dari_chg_verify} @deftypefn Function {int} unur_dari_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) @deftypefnx Function {int} unur_dari_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) Turn verifying of algorithm while sampling on/off. If the condition is violated for some @i{x} then @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. However notice that this might happen due to round-off errors for a few values of @i{x} (less than 1%). Default is @code{FALSE}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_dari_set_verify} @anchor{funct:unur_dari_chg_verify} @deftypefn {} {int} unur_dari_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) @deftypefnx {} {int} unur_dari_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) Turn verifying of algorithm while sampling on/off. If the condition is violated for some @i{x} then @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. However notice that this might happen due to round-off errors for a few values of @i{x} (less than 1%). Default is @code{FALSE}. @end deftypefn @end ifnotinfo @c @c end of dari.h @c ------------------------------------- @c ------------------------------------- @c dau.h @c @page @node DAU @subsection DAU -- (Discrete) Alias-Urn method @table @i @item Required: probability vector (PV) @item Speed: Set-up: slow (linear with the vector-length), Sampling: very fast @item Reinit: supported @item Reference: @ifhtml @ref{bib:WAa77,, [WAa77]} @end ifhtml @ifnothtml [WAa77] @end ifnothtml @ifhtml @ref{bib:HLD04,, [HLD04: Sect.3.2]} @end ifhtml @ifnothtml [HLD04: Sect.3.2] @end ifnothtml @end table DAU samples from distributions with arbitrary but finite probability vectors (PV) of length @i{N}. The algorithmus is based on an ingeneous method by A.J. Walker and requires a table of size (at least) @i{N}. It needs one random numbers and only one comparison for each generated random variate. The setup time for constructing the tables is @i{O(N)}. By default the probability vector is indexed starting at @code{0}. However this can be changed in the distribution object by a @ifhtml @ref{funct:unur_distr_discr_set_domain,@command{unur_distr_discr_set_domain}} @end ifhtml @ifnothtml @command{unur_distr_discr_set_domain} @end ifnothtml call. The method also works when no probability vector but a PMF is given. However then additionally a bounded (not too large) domain must be given or the sum over the PMF (see @ifhtml @ref{funct:unur_distr_discr_make_pv,@command{unur_distr_discr_make_pv}} @end ifhtml @ifnothtml @command{unur_distr_discr_make_pv} @end ifnothtml for details). @subsubheading How To Use Create an object for a discrete distribution either by setting a probability vector or a PMF. The performance can be slightly influenced by setting the size of the used table which can be changed by @ifhtml @ref{funct:unur_dau_set_urnfactor,@command{unur_dau_set_urnfactor}.} @end ifhtml @ifnothtml @command{unur_dau_set_urnfactor}. @end ifnothtml It is possible to change the parameters and the domain of the chosen distribution and run @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml to reinitialize the generator object. @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_dau_new,unur_dau_new} @item @ref{funct:unur_dau_set_urnfactor,unur_dau_set_urnfactor} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_dau_new} @deftypefn Function {UNUR_PAR*} unur_dau_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_dau_new} @deftypefn {} {UNUR_PAR*} unur_dau_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_dau_set_urnfactor} @deftypefn Function {int} unur_dau_set_urnfactor (UNUR_PAR* @var{parameters}, double @var{factor}) Set size of urn table relative to length of the probability vector. It must not be less than 1. Larger tables result in (slightly) faster generation times but require a more expensive setup. However sizes larger than 2 are not recommended. Default is @code{1}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_dau_set_urnfactor} @deftypefn {} {int} unur_dau_set_urnfactor (UNUR_PAR* @var{parameters}, double @var{factor}) Set size of urn table relative to length of the probability vector. It must not be less than 1. Larger tables result in (slightly) faster generation times but require a more expensive setup. However sizes larger than 2 are not recommended. Default is @code{1}. @end deftypefn @end ifnotinfo @c @c end of dau.h @c ------------------------------------- @c ------------------------------------- @c dext.h @c @page @node DEXT @subsection DEXT -- wrapper for Discrete EXTernal generators @table @i @item Required: routine for sampling discrete random variates @item Speed: depends on external generator @item Reinit: supported @end table Method DEXT is a wrapper for external generators for discrete univariate distributions. It allows the usage of external random variate generators within the UNU.RAN framework. @subsubheading How To Use The following steps are required to use some external generator within the UNU.RAN framework (some of these are optional): @enumerate @item Make an empty generator object using a @ifhtml @ref{funct:unur_dext_new,@command{unur_dext_new}} @end ifhtml @ifnothtml @command{unur_dext_new} @end ifnothtml call. The argument @var{distribution} is optional and can be replaced by @code{NULL}. However, it is required if you want to pass parameters of the generated distribution to the external generator or for running some validation tests provided by UNU.RAN. @item Create an initialization routine of type @code{int (*init)(UNUR_GEN *gen)} and plug it into the generator object using the @ifhtml @ref{funct:unur_dext_set_init,@command{unur_dext_set_init}} @end ifhtml @ifnothtml @command{unur_dext_set_init} @end ifnothtml call. Notice that the @var{init} routine must return @code{UNUR_SUCCESS} when it has been executed successfully and @code{UNUR_FAILURE} otherwise. It is possible to get the size of and the pointer to the array of parameters of the underlying distribution object by the respective calls @ifhtml @ref{funct:unur_dext_get_ndistrparams,@command{unur_dext_get_ndistrparams}} @end ifhtml @ifnothtml @command{unur_dext_get_ndistrparams} @end ifnothtml and @ifhtml @ref{funct:unur_dext_get_distrparams,@command{unur_dext_get_distrparams}.} @end ifhtml @ifnothtml @command{unur_dext_get_distrparams}. @end ifnothtml Parameters for the external generator that are computed in the @var{init} routine can be stored in a single array or structure which is available by the @ifhtml @ref{funct:unur_dext_get_params,@command{unur_dext_get_params}} @end ifhtml @ifnothtml @command{unur_dext_get_params} @end ifnothtml call. Using an @var{init} routine is optional and can be omitted. @item Create a sampling routine of type @code{int (*sample)(UNUR_GEN *gen)} and plug it into the generator object using the @ifhtml @ref{funct:unur_dext_set_sample,@command{unur_dext_set_sample}} @end ifhtml @ifnothtml @command{unur_dext_set_sample} @end ifnothtml call. Uniform random numbers are provided by the @ifhtml @ref{funct:unur_sample_urng,@command{unur_sample_urng}} @end ifhtml @ifnothtml @command{unur_sample_urng} @end ifnothtml call. Do not use your own implementation of a uniform random number generator directly. If you want to use your own random number generator we recommend to use the UNU.RAN interface (see @pxref{URNG,,Using uniform random number generators}). The array or structure that contains parameters for the external generator that are computed in the @var{init} routine are available using the @ifhtml @ref{funct:unur_dext_get_params,@command{unur_dext_get_params}} @end ifhtml @ifnothtml @command{unur_dext_get_params} @end ifnothtml call. Using a @var{sample} routine is of course obligatory. @end enumerate It is possible to change the parameters and the domain of the chosen distribution and run @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml to reinitialize the generator object. The @var{init} routine is then called again. Here is a short example that demonstrates the application of this method by means of the geometric distribution: @smallexample @include ref_example_dext.texi @end smallexample @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_dext_new,unur_dext_new} @item @ref{funct:unur_dext_set_init,unur_dext_set_init} @item @ref{funct:unur_dext_set_sample,unur_dext_set_sample} @item @ref{funct:unur_dext_get_params,unur_dext_get_params} @item @ref{funct:unur_dext_get_distrparams,unur_dext_get_distrparams} @item @ref{funct:unur_dext_get_ndistrparams,unur_dext_get_ndistrparams} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_dext_new} @deftypefn Function {UNUR_PAR*} unur_dext_new (const @var{UNUR_DISTR* distribution}) Get default parameters for new generator. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_dext_new} @deftypefn {} {UNUR_PAR*} unur_dext_new (const @var{UNUR_DISTR* distribution}) Get default parameters for new generator. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_dext_set_init} @deftypefn Function {int} unur_dext_set_init (UNUR_PAR* @var{parameters}, int (* @var{init})(UNUR_GEN* gen )) Set initialization routine for external generator. Inside the @emph{Important:} The routine @var{init} must return @code{UNUR_SUCCESS} when the generator was initialized successfully and @code{UNUR_FAILURE} otherwise. Parameters that are computed in the @var{init} routine can be stored in an array or structure that is avaiable by means of the @ifhtml @ref{funct:unur_dext_get_params,@command{unur_dext_get_params}} @end ifhtml @ifnothtml @command{unur_dext_get_params} @end ifnothtml call. Parameters of the underlying distribution object can be obtained by the @ifhtml @ref{funct:unur_dext_get_distrparams,@command{unur_dext_get_distrparams}} @end ifhtml @ifnothtml @command{unur_dext_get_distrparams} @end ifnothtml call. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_dext_set_init} @deftypefn {} {int} unur_dext_set_init (UNUR_PAR* @var{parameters}, int (* @var{init})(UNUR_GEN* gen )) Set initialization routine for external generator. Inside the @emph{Important:} The routine @var{init} must return @code{UNUR_SUCCESS} when the generator was initialized successfully and @code{UNUR_FAILURE} otherwise. Parameters that are computed in the @var{init} routine can be stored in an array or structure that is avaiable by means of the @ifhtml @ref{funct:unur_dext_get_params,@command{unur_dext_get_params}} @end ifhtml @ifnothtml @command{unur_dext_get_params} @end ifnothtml call. Parameters of the underlying distribution object can be obtained by the @ifhtml @ref{funct:unur_dext_get_distrparams,@command{unur_dext_get_distrparams}} @end ifhtml @ifnothtml @command{unur_dext_get_distrparams} @end ifnothtml call. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_dext_set_sample} @deftypefn Function {int} unur_dext_set_sample (UNUR_PAR* @var{parameters}, int (* @var{sample})(UNUR_GEN* gen )) Set sampling routine for external generator. @emph{Important:} Use @code{unur_sample_urng(gen)} to get a uniform random number. The pointer to the array or structure that contains the parameters that are precomputed in the @var{init} routine are available by @code{unur_dext_get_params(gen,0)}. Additionally one can use the @ifhtml @ref{funct:unur_dext_get_distrparams,@command{unur_dext_get_distrparams}} @end ifhtml @ifnothtml @command{unur_dext_get_distrparams} @end ifnothtml call. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_dext_set_sample} @deftypefn {} {int} unur_dext_set_sample (UNUR_PAR* @var{parameters}, int (* @var{sample})(UNUR_GEN* gen )) Set sampling routine for external generator. @emph{Important:} Use @code{unur_sample_urng(gen)} to get a uniform random number. The pointer to the array or structure that contains the parameters that are precomputed in the @var{init} routine are available by @code{unur_dext_get_params(gen,0)}. Additionally one can use the @ifhtml @ref{funct:unur_dext_get_distrparams,@command{unur_dext_get_distrparams}} @end ifhtml @ifnothtml @command{unur_dext_get_distrparams} @end ifnothtml call. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_dext_get_params} @deftypefn Function {void*} unur_dext_get_params (UNUR_GEN* @var{generator}, size_t @var{size}) Get pointer to memory block for storing parameters of external generator. A memory block of size @var{size} is automatically (re-) allocated if necessary and the pointer to this block is stored in the @var{generator} object. If one only needs the pointer to this memory block set @var{size} to @code{0}. Notice, that @var{size} is the size of the memory block and not the length of an array. @emph{Important:} This rountine should only be used in the initialization and sampling routine of the external generator. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_dext_get_params} @deftypefn {} {void*} unur_dext_get_params (UNUR_GEN* @var{generator}, size_t @var{size}) Get pointer to memory block for storing parameters of external generator. A memory block of size @var{size} is automatically (re-) allocated if necessary and the pointer to this block is stored in the @var{generator} object. If one only needs the pointer to this memory block set @var{size} to @code{0}. Notice, that @var{size} is the size of the memory block and not the length of an array. @emph{Important:} This rountine should only be used in the initialization and sampling routine of the external generator. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_dext_get_distrparams} @anchor{funct:unur_dext_get_ndistrparams} @deftypefn Function {double*} unur_dext_get_distrparams (UNUR_GEN* @var{generator}) @deftypefnx Function {int} unur_dext_get_ndistrparams (UNUR_GEN* @var{generator}) Get size of and pointer to array of parameters of underlying distribution in @var{generator} object. @emph{Important:} These rountines should only be used in the initialization and sampling routine of the external generator. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_dext_get_distrparams} @anchor{funct:unur_dext_get_ndistrparams} @deftypefn {} {double*} unur_dext_get_distrparams (UNUR_GEN* @var{generator}) @deftypefnx {} {int} unur_dext_get_ndistrparams (UNUR_GEN* @var{generator}) Get size of and pointer to array of parameters of underlying distribution in @var{generator} object. @emph{Important:} These rountines should only be used in the initialization and sampling routine of the external generator. @end deftypefn @end ifnotinfo @c @c end of dext.h @c ------------------------------------- @c ------------------------------------- @c dgt.h @c @page @node DGT @subsection DGT -- (Discrete) Guide Table method (indexed search) @table @i @item Required: probability vector (PV) @item Speed: Set-up: slow (linear with the vector-length), Sampling: very fast @item Reinit: supported @item Reference: @ifhtml @ref{bib:CAa74,, [CAa74]} @end ifhtml @ifnothtml [CAa74] @end ifnothtml @ifhtml @ref{bib:HLD04,, [HLD04: Sect.3.1.2]} @end ifhtml @ifnothtml [HLD04: Sect.3.1.2] @end ifnothtml @end table DGT samples from arbitrary but finite probability vectors. Random numbers are generated by the inversion method, i.e., @enumerate @item Generate a random number U ~ U(0,1). @item Find smallest integer I such that F(I) = P(X<=I) >= U. @end enumerate Step (2) is the crucial step. Using sequential search requires @i{O(E(X))} comparisons, where @i{E(X)} is the expectation of the distribution. Indexed search, however, uses a guide table to jump to some @i{I'} <= @i{I} near @i{I} to find @i{X} in constant time. Indeed the expected number of comparisons is reduced to 2, when the guide table has the same size as the probability vector (this is the default). For larger guide tables this number becomes smaller (but is always larger than 1), for smaller tables it becomes larger. For the limit case of table size 1 the algorithm simply does sequential search (but uses a more expensive setup then method DSS (@pxref{DSS}). On the other hand the setup time for guide table is @i{O(N)}, where @i{N} denotes the length of the probability vector (for size 1 no preprocessing is required). Moreover, for very large guide tables memory effects might even reduce the speed of the algorithm. So we do not recommend to use guide tables that are more than three times larger than the given probability vector. If only a few random numbers have to be generated, (much) smaller table sizes are better. The size of the guide table relative to the length of the given probability vector can be set by a @ifhtml @ref{funct:unur_dgt_set_guidefactor,@command{unur_dgt_set_guidefactor}} @end ifhtml @ifnothtml @command{unur_dgt_set_guidefactor} @end ifnothtml call. There exist two variants for the setup step which can be set by a @ifhtml @ref{funct:unur_dgt_set_variant,@command{unur_dgt_set_variant}} @end ifhtml @ifnothtml @command{unur_dgt_set_variant} @end ifnothtml call: Variants 1 and 2. Variant 2 is faster but more sensitive to roundoff errors when the guide table is large. By default variant 2 is used for short probability vectors (@i{N}<1000) and variant 1 otherwise. By default the probability vector is indexed starting at @code{0}. However this can be changed in the distribution object by a @ifhtml @ref{funct:unur_distr_discr_set_domain,@command{unur_distr_discr_set_domain}} @end ifhtml @ifnothtml @command{unur_distr_discr_set_domain} @end ifnothtml call. The method also works when no probability vector but a PMF is given. However, then additionally a bounded (not too large) domain must be given or the sum over the PMF. In the latter case the domain of the distribution is trucated (see @ifhtml @ref{funct:unur_distr_discr_make_pv,@command{unur_distr_discr_make_pv}} @end ifhtml @ifnothtml @command{unur_distr_discr_make_pv} @end ifnothtml for details). @subsubheading How To Use Create an object for a discrete distribution either by setting a probability vector or a PMF. The performance can be slightly influenced by setting the size of the used table which can be changed by @ifhtml @ref{funct:unur_dgt_set_guidefactor,@command{unur_dgt_set_guidefactor}.} @end ifhtml @ifnothtml @command{unur_dgt_set_guidefactor}. @end ifnothtml It is possible to change the parameters and the domain of the chosen distribution and run @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml to reinitialize the generator object. @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_dgt_new,unur_dgt_new} @item @ref{funct:unur_dgt_set_guidefactor,unur_dgt_set_guidefactor} @item @ref{funct:unur_dgt_set_variant,unur_dgt_set_variant} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_dgt_new} @deftypefn Function {UNUR_PAR*} unur_dgt_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_dgt_new} @deftypefn {} {UNUR_PAR*} unur_dgt_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_dgt_set_guidefactor} @deftypefn Function {int} unur_dgt_set_guidefactor (UNUR_PAR* @var{parameters}, double @var{factor}) Set size of guide table relative to length of PV. Larger guide tables result in faster generation time but require a more expensive setup. Sizes larger than 3 are not recommended. If the relative size is set to 0, sequential search is used. However, this is not recommended, except in exceptional cases, since method DSS (@pxref{DSS}) is has almost no setup and is thus faster (but requires the sum over the PV as input parameter). Default is @code{1}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_dgt_set_guidefactor} @deftypefn {} {int} unur_dgt_set_guidefactor (UNUR_PAR* @var{parameters}, double @var{factor}) Set size of guide table relative to length of PV. Larger guide tables result in faster generation time but require a more expensive setup. Sizes larger than 3 are not recommended. If the relative size is set to 0, sequential search is used. However, this is not recommended, except in exceptional cases, since method DSS (@pxref{DSS}) is has almost no setup and is thus faster (but requires the sum over the PV as input parameter). Default is @code{1}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_dgt_set_variant} @deftypefn Function {int} unur_dgt_set_variant (UNUR_PAR* @var{parameters}, unsigned @var{variant}) Set variant for setup step. Possible values are @code{1} or @code{2}. Variant @code{2} is faster but more sensitive to roundoff errors when the guide table is large. By default variant @code{2} is used for short probability vectors (@i{N}<1000) and variant @code{1} otherwise. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_dgt_set_variant} @deftypefn {} {int} unur_dgt_set_variant (UNUR_PAR* @var{parameters}, unsigned @var{variant}) Set variant for setup step. Possible values are @code{1} or @code{2}. Variant @code{2} is faster but more sensitive to roundoff errors when the guide table is large. By default variant @code{2} is used for short probability vectors (@i{N}<1000) and variant @code{1} otherwise. @end deftypefn @end ifnotinfo @c @c end of dgt.h @c ------------------------------------- @c ------------------------------------- @c dsrou.h @c @page @node DSROU @subsection DSROU -- Discrete Simple Ratio-Of-Uniforms method @table @i @item Required: T-concave PMF, mode, sum over PMF @item Speed: Set-up: fast, Sampling: slow @item Reinit: supported @item Reference: @ifhtml @ref{bib:LJa01,, [LJa01]} @end ifhtml @ifnothtml [LJa01] @end ifnothtml @ifhtml @ref{bib:HLD04,, [HLD04: Sect.10.3.2; Alg.10.6]} @end ifhtml @ifnothtml [HLD04: Sect.10.3.2; Alg.10.6] @end ifnothtml @end table DSROU is based on the ratio-of-uniforms method (@pxref{Ratio-of-Uniforms}) but uses universal inequalities for constructing a (universal) bounding rectangle. It works for all @i{T}-concave distributions with @iftex @math{T(x) = -1/\sqrt{x}} @end iftex @ifhtml @html T(x) = -1/sqrt(x) @end html @end ifhtml @ifinfo @math{T(x) = -1/sqrt(x)} @end ifinfo . The method requires the PMF, the (exact) location of the mode and the sum over the given PDF. The rejection constant is 4 for all @i{T}-concave distributions. Optionally the CDF at the mode can be given to increase the performance of the algorithm. Then the rejection constant is reduced to 2. @subsubheading How To Use The method works for @i{T}-concave discrete distributions with given PMF. The sum over of the PMF or an upper bound of this sum must be known. Optionally the CDF at the mode can be given to increase the performance using @ifhtml @ref{funct:unur_dsrou_set_cdfatmode,@command{unur_dsrou_set_cdfatmode}.} @end ifhtml @ifnothtml @command{unur_dsrou_set_cdfatmode}. @end ifnothtml However, this @strong{must not} be called if the sum over the PMF is replaced by an upper bound. It is possible to change the parameters and the domain of the chosen distribution and run @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml to reinitialize the generator object. If any of mode, CDF at mode, or the sum over the PMF has been changed, then @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml must be executed. (Otherwise the generator produces garbage). There exists a test mode that verifies whether the conditions for the method are satisfied or not while sampling. It can be switched on or off by calling @ifhtml @ref{funct:unur_dsrou_set_verify,@command{unur_dsrou_set_verify}} @end ifhtml @ifnothtml @command{unur_dsrou_set_verify} @end ifnothtml and @ifhtml @ref{funct:unur_dsrou_chg_verify,@command{unur_dsrou_chg_verify},} @end ifhtml @ifnothtml @command{unur_dsrou_chg_verify}, @end ifnothtml respectively. Notice however that sampling is (a little bit) slower then. @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_dsrou_new,unur_dsrou_new} @item @ref{funct:unur_dsrou_set_cdfatmode,unur_dsrou_set_cdfatmode} @item @ref{funct:unur_dsrou_set_verify,unur_dsrou_set_verify} @item @ref{funct:unur_dsrou_chg_verify,unur_dsrou_chg_verify} @item @ref{funct:unur_dsrou_chg_cdfatmode,unur_dsrou_chg_cdfatmode} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_dsrou_new} @deftypefn Function {UNUR_PAR*} unur_dsrou_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_dsrou_new} @deftypefn {} {UNUR_PAR*} unur_dsrou_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_dsrou_set_cdfatmode} @deftypefn Function {int} unur_dsrou_set_cdfatmode (UNUR_PAR* @var{parameters}, double @var{Fmode}) Set CDF at mode. When set, the performance of the algorithm is increased by factor 2. However, when the parameters of the distribution are changed @ifhtml @ref{funct:unur_dsrou_chg_cdfatmode,@command{unur_dsrou_chg_cdfatmode}} @end ifhtml @ifnothtml @command{unur_dsrou_chg_cdfatmode} @end ifnothtml has to be used to update this value. Notice that the algorithm detects a mode at the left boundary of the domain automatically and it is not necessary to use this call for a monotonically decreasing PMF. Default: not set. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_dsrou_set_cdfatmode} @deftypefn {} {int} unur_dsrou_set_cdfatmode (UNUR_PAR* @var{parameters}, double @var{Fmode}) Set CDF at mode. When set, the performance of the algorithm is increased by factor 2. However, when the parameters of the distribution are changed @ifhtml @ref{funct:unur_dsrou_chg_cdfatmode,@command{unur_dsrou_chg_cdfatmode}} @end ifhtml @ifnothtml @command{unur_dsrou_chg_cdfatmode} @end ifnothtml has to be used to update this value. Notice that the algorithm detects a mode at the left boundary of the domain automatically and it is not necessary to use this call for a monotonically decreasing PMF. Default: not set. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_dsrou_set_verify} @anchor{funct:unur_dsrou_chg_verify} @deftypefn Function {int} unur_dsrou_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) @deftypefnx Function {int} unur_dsrou_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) Turn verifying of algorithm while sampling on/off. If the condition squeeze(@i{x}) <= PMF(@i{x}) <= hat(@i{x}) is violated for some @i{x} then @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. However notice that this might happen due to round-off errors for a few values of @i{x} (less than 1%). Default is @code{FALSE}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_dsrou_set_verify} @anchor{funct:unur_dsrou_chg_verify} @deftypefn {} {int} unur_dsrou_set_verify (UNUR_PAR* @var{parameters}, int @var{verify}) @deftypefnx {} {int} unur_dsrou_chg_verify (UNUR_GEN* @var{generator}, int @var{verify}) Turn verifying of algorithm while sampling on/off. If the condition squeeze(@i{x}) <= PMF(@i{x}) <= hat(@i{x}) is violated for some @i{x} then @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. However notice that this might happen due to round-off errors for a few values of @i{x} (less than 1%). Default is @code{FALSE}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_dsrou_chg_cdfatmode} @deftypefn Function {int} unur_dsrou_chg_cdfatmode (UNUR_GEN* @var{generator}, double @var{Fmode}) Change CDF at mode of distribution. @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml must be executed before sampling from the generator again. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_dsrou_chg_cdfatmode} @deftypefn {} {int} unur_dsrou_chg_cdfatmode (UNUR_GEN* @var{generator}, double @var{Fmode}) Change CDF at mode of distribution. @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml must be executed before sampling from the generator again. @end deftypefn @end ifnotinfo @c @c end of dsrou.h @c ------------------------------------- @c ------------------------------------- @c dss.h @c @page @node DSS @subsection DSS -- (Discrete) Sequential Search method @table @i @item Required: probability vector (PV) and sum over PV; or probability mass function(PMF), sum over PV and domain; or or cumulative distribution function (CDF) @item Speed: Set-up: fast, Sampling: very slow (linear in expectation) @item Reinit: supported @item Reference: @ifhtml @ref{bib:HLD04,, [HLD04: Sect.3.1.1; Alg.3.1]} @end ifhtml @ifnothtml [HLD04: Sect.3.1.1; Alg.3.1] @end ifnothtml @end table DSS samples from arbitrary discrete distributions. Random numbers are generated by the inversion method, i.e., @enumerate @item Generate a random number U ~ U(0,1). @item Find smallest integer I such that F(I) = P(X<=I) >= U. @end enumerate Step (2) is the crucial step. Using sequential search requires @i{O(E(X))} comparisons, where @i{E(X)} is the expectation of the distribution. Thus this method is only recommended when only a few random variates from the given distribution are required. Otherwise, table methods like DGT (@pxref{DGT}) or DAU (@pxref{DAU}) are much faster. These methods also need not the sum over the PMF (or PV) as input. On the other hand, however, these methods always compute a table. DSS runs with the PV, the PMF, or the CDF of the distribution. It uses actually uses the first one in this list (in this ordering) that could be found. @subsubheading How To Use It works with a discrete distribution object with contains at least the PV, the PMF, or the CDF. It is possible to change the parameters and the domain of the chosen distribution and run @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml to reinitialize the generator object. @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_dss_new,unur_dss_new} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_dss_new} @deftypefn Function {UNUR_PAR*} unur_dss_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_dss_new} @deftypefn {} {UNUR_PAR*} unur_dss_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifnotinfo @c @c end of dss.h @c ------------------------------------- @c ------------------------------------- @c dstd.h @c @page @node DSTD @subsection DSTD -- Discrete STandarD distributions @table @i @item Required: standard distribution from UNU.RAN library (@pxref{Stddist,,Standard distributions}) or discrete distribution with inverse CDF. @item Speed: Set-up: fast, Sampling: depends on distribution and generator @item Reinit: supported @end table DSTD is a wrapper for special generators for discrete univariate standard distributions. It only works for distributions in the UNU.RAN library of standard distributions (@pxref{Stddist,,Standard distributions}) or for discrete distributions where the inverse CDF is given. If a distribution object is provided that is build from scratch, it must provide the inverse CDF. Then CSTD implements the inversion method. Otherwise, the @code{NULL} pointer is returned. For some distributions more than one special generator is possible. @subsubheading How To Use Create a distribution object for a standard distribution from the UNU.RAN library (@pxref{Stddist,,Standard distributions}), or create a discrete distribution object and set the function for the inverse CDF using @ifhtml @ref{funct:unur_distr_discr_set_invcdf,@command{unur_distr_discr_set_invcdf}.} @end ifhtml @ifnothtml @command{unur_distr_discr_set_invcdf}. @end ifnothtml For some distributions more than one special generator (@emph{variants}) is possible. These can be choosen by a @ifhtml @ref{funct:unur_dstd_set_variant,@command{unur_dstd_set_variant}} @end ifhtml @ifnothtml @command{unur_dstd_set_variant} @end ifnothtml call. For possible variants @xref{Stddist,,Standard distributions}. However the following are common to all distributions: @table @code @item UNUR_STDGEN_DEFAULT the default generator. @item UNUR_STDGEN_FAST the fastest available special generator. @item UNUR_STDGEN_INVERSION the inversion method (if available). @end table Notice that the variant @code{UNUR_STDGEN_FAST} for a special generator might be slower than one of the universal algorithms! Additional variants may exist for particular distributions. Sampling from truncated distributions (which can be constructed by changing the default domain of a distribution by means of @ifhtml @ref{funct:unur_distr_discr_set_domain,@command{unur_distr_discr_set_domain}} @end ifhtml @ifnothtml @command{unur_distr_discr_set_domain} @end ifnothtml or unur_dstd_chg_truncated calls) is possible but requires the inversion method. Moreover the CDF of the distribution must be implemented. It is possible to change the parameters and the domain of the chosen distribution and run @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml to reinitialize the generator object. @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_dstd_new,unur_dstd_new} @item @ref{funct:unur_dstd_set_variant,unur_dstd_set_variant} @item @ref{funct:unur_dstd_chg_truncated,unur_dstd_chg_truncated} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_dstd_new} @deftypefn Function {UNUR_PAR*} unur_dstd_new (const @var{UNUR_DISTR* distribution}) Get default parameters for new generator. It requires a distribution object for a discrete univariant distribution from the UNU.RAN library of standard distributions (@pxref{Stddist,,Standard distributions}). Using a truncated distribution is allowed only if the inversion method is available and selected by the @ifhtml @ref{funct:unur_dstd_set_variant,@command{unur_dstd_set_variant}} @end ifhtml @ifnothtml @command{unur_dstd_set_variant} @end ifnothtml call immediately after creating the parameter object. Use a @ifhtml @ref{funct:unur_distr_discr_set_domain,@command{unur_distr_discr_set_domain}} @end ifhtml @ifnothtml @command{unur_distr_discr_set_domain} @end ifnothtml call to get a truncated distribution. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_dstd_new} @deftypefn {} {UNUR_PAR*} unur_dstd_new (const @var{UNUR_DISTR* distribution}) Get default parameters for new generator. It requires a distribution object for a discrete univariant distribution from the UNU.RAN library of standard distributions (@pxref{Stddist,,Standard distributions}). Using a truncated distribution is allowed only if the inversion method is available and selected by the @ifhtml @ref{funct:unur_dstd_set_variant,@command{unur_dstd_set_variant}} @end ifhtml @ifnothtml @command{unur_dstd_set_variant} @end ifnothtml call immediately after creating the parameter object. Use a @ifhtml @ref{funct:unur_distr_discr_set_domain,@command{unur_distr_discr_set_domain}} @end ifhtml @ifnothtml @command{unur_distr_discr_set_domain} @end ifnothtml call to get a truncated distribution. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_dstd_set_variant} @deftypefn Function {int} unur_dstd_set_variant (UNUR_PAR* @var{parameters}, unsigned @var{variant}) Set variant (special generator) for sampling from a given distribution. For possible variants @pxref{Stddist,,Standard distributions}. Common variants are @code{UNUR_STDGEN_DEFAULT} for the default generator, @code{UNUR_STDGEN_FAST} for (one of the) fastest implemented special generators, and @code{UNUR_STDGEN_INVERSION} for the inversion method (if available). If the selected variant number is not implemented, then an error code is returned and the variant is not changed. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_dstd_set_variant} @deftypefn {} {int} unur_dstd_set_variant (UNUR_PAR* @var{parameters}, unsigned @var{variant}) Set variant (special generator) for sampling from a given distribution. For possible variants @pxref{Stddist,,Standard distributions}. Common variants are @code{UNUR_STDGEN_DEFAULT} for the default generator, @code{UNUR_STDGEN_FAST} for (one of the) fastest implemented special generators, and @code{UNUR_STDGEN_INVERSION} for the inversion method (if available). If the selected variant number is not implemented, then an error code is returned and the variant is not changed. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_dstd_chg_truncated} @deftypefn Function {int} unur_dstd_chg_truncated (UNUR_GEN* @var{generator}, int @var{left}, int @var{right}) Change left and right border of the domain of the (truncated) distribution. This is only possible if the inversion method is used. Otherwise this call has no effect and an error code is returned. Notice that the given truncated domain must be a subset of the domain of the given distribution. The generator always uses the intersection of the domain of the distribution and the truncated domain given by this call. It is not required to run @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml after this call has been used. @emph{Important:} If the CDF is (almost) the same for @var{left} and @var{right} and (almost) equal to @code{0} or @code{1}, then the truncated domain is not chanced and the call returns an error code. @emph{Notice:} If the parameters of the distribution has been changed it is recommended to set the truncated domain again, since the former call might change the domain of the distribution but not update the values for the boundaries of the truncated distribution. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_dstd_chg_truncated} @deftypefn {} {int} unur_dstd_chg_truncated (UNUR_GEN* @var{generator}, int @var{left}, int @var{right}) Change left and right border of the domain of the (truncated) distribution. This is only possible if the inversion method is used. Otherwise this call has no effect and an error code is returned. Notice that the given truncated domain must be a subset of the domain of the given distribution. The generator always uses the intersection of the domain of the distribution and the truncated domain given by this call. It is not required to run @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml after this call has been used. @emph{Important:} If the CDF is (almost) the same for @var{left} and @var{right} and (almost) equal to @code{0} or @code{1}, then the truncated domain is not chanced and the call returns an error code. @emph{Notice:} If the parameters of the distribution has been changed it is recommended to set the truncated domain again, since the former call might change the domain of the distribution but not update the values for the boundaries of the truncated distribution. @end deftypefn @end ifnotinfo @c @c end of dstd.h @c ------------------------------------- @c ------------------------------------- @c methods.dh @c @page @node Methods_for_MATR @section Methods for random matrices @menu * MCORR:: Random CORRelation matrix @end menu @subheading Overview of methods @include methods_matr.texi @c @c end of methods.dh @c ------------------------------------- @c ------------------------------------- @c mcorr.h @c @page @node MCORR @subsection MCORR -- Random CORRelation matrix @table @i @item Required: Distribution object for random correlation matrix @item Speed: Set-up: fast, Sampling: depends on dimension @item Reinit: supported @item Reference: @ifhtml @ref{bib:DLa86,, [DLa86: Sect.6.1; p.605]} @end ifhtml @ifnothtml [DLa86: Sect.6.1; p.605] @end ifnothtml @ifhtml @ref{bib:MOa84,, [MOa84]} @end ifhtml @ifnothtml [MOa84] @end ifnothtml @end table MCORR generates a random correlation matrix (Pearson's correlation). Two methods are used: @enumerate @item When a random correlation matrix having given eigenvalues is sought, the method of Marsaglia and Olkin [MOa84] is used. In this case, the correlation matrix @iftex @math{R} @end iftex @ifhtml @html R @end html @end ifhtml @ifinfo @math{R} @end ifinfo is given as @iftex @math{R=PDP'} @end iftex @ifhtml @html R=PDP' @end html @end ifhtml @ifinfo @math{R=PDP'} @end ifinfo where @iftex @math{D} @end iftex @ifhtml @html D @end html @end ifhtml @ifinfo @math{D} @end ifinfo is a diagonal matrix containing the eigenvalues and @iftex @math{P} @end iftex @ifhtml @html P @end html @end ifhtml @ifinfo @math{P} @end ifinfo is a random orthonormal matrix. In higher dimensions, the rounding-errors introduced in the previous matrix multiplications could lead to a non-symmetric correlation matrix. Therefore the symmetric correlation matrix is computed as @iftex @math{R=(PDP'+P'DP)/2} @end iftex @ifhtml @html R=(PDP'+P'DP)/2 @end html @end ifhtml @ifinfo @math{R=(PDP'+P'DP)/2} @end ifinfo . @item A matrix @iftex @math{H} @end iftex @ifhtml @html H @end html @end ifhtml @ifinfo @math{H} @end ifinfo is generated where all rows are independent random vectors of unit length uniformly on a sphere. Then @iftex @math{HH'} @end iftex @ifhtml @html HH' @end html @end ifhtml @ifinfo @math{HH'} @end ifinfo is a correlation matrix (and vice versa if @iftex @math{HH'} @end iftex @ifhtml @html HH' @end html @end ifhtml @ifinfo @math{HH'} @end ifinfo is a correlation matrix then the rows of @iftex @math{H} @end iftex @ifhtml @html H @end html @end ifhtml @ifinfo @math{H} @end ifinfo are random vectors on a sphere). @end enumerate Notice that due to round-off errors the generated matrices might not be positive definite in extremely rare cases (especially when the given eigenvalues are amost 0). There are many other possibilites (distributions) of sampling the random rows from a sphere. The chosen methods are simple but does not result in a uniform distriubution of the random correlation matrices. It only works with distribution objects of random correlation matrices (@pxref{correlation,,Random Correlation Matrix}). @subsubheading How To Use Create a distibution object for random correlation matrices by a @code{unur_distr_correlation} call (@pxref{correlation,,Random Correlation Matrix}). When a correlation matrix with given eigenvalues should be generated, these eigenvalues can be set by a @ifhtml @ref{funct:unur_mcorr_set_eigenvalues,@command{unur_mcorr_set_eigenvalues}} @end ifhtml @ifnothtml @command{unur_mcorr_set_eigenvalues} @end ifnothtml call. Otherwise, a faster algorithm is used that generates correlation matrices with random eigenstructure. Notice that due to round-off errors, there is a (small) chance that the resulting matrix is not positive definite for a Cholesky decomposition algorithm, especially when the dimension of the distribution is high. It is possible to change the given eigenvalues using @ifhtml @ref{funct:unur_mcorr_chg_eigenvalues,@command{unur_mcorr_chg_eigenvalues}} @end ifhtml @ifnothtml @command{unur_mcorr_chg_eigenvalues} @end ifnothtml and run @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml to reinitialize the generator object. @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_mcorr_new,unur_mcorr_new} @item @ref{funct:unur_mcorr_set_eigenvalues,unur_mcorr_set_eigenvalues} @item @ref{funct:unur_mcorr_chg_eigenvalues,unur_mcorr_chg_eigenvalues} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_mcorr_new} @deftypefn Function {UNUR_PAR*} unur_mcorr_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_mcorr_new} @deftypefn {} {UNUR_PAR*} unur_mcorr_new (const @var{UNUR_DISTR* distribution}) Get default parameters for generator. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_mcorr_set_eigenvalues} @deftypefn Function {int} unur_mcorr_set_eigenvalues (UNUR_PAR* @var{par}, const @var{double* eigenvalues}) Sets the (optional) eigenvalues of the correlation matrix. If set, then the Marsaglia and Olkin algorithm will be used to generate random correlation matrices with given eigenvalues. Important: the given eigenvalues of the correlation matrix must be strictly positive and sum to the dimension of the matrix. If non-positive eigenvalues are attempted, no eigenvalues are set and an error code is returned. In case, that their sum is different from the dimension, an implicit scaling to give the correct sum is performed. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_mcorr_set_eigenvalues} @deftypefn {} {int} unur_mcorr_set_eigenvalues (UNUR_PAR* @var{par}, const @var{double* eigenvalues}) Sets the (optional) eigenvalues of the correlation matrix. If set, then the Marsaglia and Olkin algorithm will be used to generate random correlation matrices with given eigenvalues. Important: the given eigenvalues of the correlation matrix must be strictly positive and sum to the dimension of the matrix. If non-positive eigenvalues are attempted, no eigenvalues are set and an error code is returned. In case, that their sum is different from the dimension, an implicit scaling to give the correct sum is performed. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_mcorr_chg_eigenvalues} @deftypefn Function {int} unur_mcorr_chg_eigenvalues (UNUR_GEN* @var{gen}, const @var{double* eigenvalues}) Change the eigenvalues of the correlation matrix. One must run @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml to reinitialize the generator object then. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_mcorr_chg_eigenvalues} @deftypefn {} {int} unur_mcorr_chg_eigenvalues (UNUR_GEN* @var{gen}, const @var{double* eigenvalues}) Change the eigenvalues of the correlation matrix. One must run @ifhtml @ref{funct:unur_reinit,@command{unur_reinit}} @end ifhtml @ifnothtml @command{unur_reinit} @end ifnothtml to reinitialize the generator object then. @end deftypefn @end ifnotinfo @c @c end of mcorr.h @c ------------------------------------- @c ------------------------------------- @c methods.dh @c @page @node Methods_for_UNID @section Methods for uniform univariate distributions @menu * UNIF:: wrapper for UNIForm random number generator @end menu @c @c end of methods.dh @c ------------------------------------- @c ------------------------------------- @c unif.h @c @page @node UNIF @subsection UNIF -- wrapper for UNIForm random number generator UNIF is a simple wrapper that makes it possible to use a uniform random number generator as a UNU.RAN generator. There are no parameters for this method. @subsubheading How To Use Create a generator object with @code{NULL} as argument. The created generator object returns raw random numbers from the underlying uniform random number generator. @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_unif_new,unur_unif_new} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_unif_new} @deftypefn Function {UNUR_PAR*} unur_unif_new (const @var{UNUR_DISTR* dummy}) Get default parameters for generator. UNIF does not need a distribution object. @var{dummy} is not used and can (should) be set to @code{NULL}. It is used to keep the API consistent. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_unif_new} @deftypefn {} {UNUR_PAR*} unur_unif_new (const @var{UNUR_DISTR* dummy}) Get default parameters for generator. UNIF does not need a distribution object. @var{dummy} is not used and can (should) be set to @code{NULL}. It is used to keep the API consistent. @end deftypefn @end ifnotinfo @c @c end of unif.h @c ------------------------------------- @c ------------------------------------- @c methods.dh @c @page @node Meta_Methods @section Meta Methods for univariate distributions @menu * MIXT:: MIXTure of distributions @end menu @subheading Example @smallexample @include ref_example_mixt.texi @end smallexample @subheading Example (Inversion) @smallexample @include ref_example_mixt_inv.texi @end smallexample @c @c end of methods.dh @c ------------------------------------- @c ------------------------------------- @c mixt.h @c @page @node MIXT @subsection MIXT -- MIXTure of distributions MIXT allows to sample from a mixture of univariate distributions. Let @iftex @math{f_1,\ldots,f_n} @end iftex @ifhtml @html f_1,...,f_n @end html @end ifhtml @ifinfo @math{f_1,...,f_n} @end ifinfo be PDFs of various distributions called the components and @iftex @math{(p_1,\ldots,p_n)} @end iftex @ifhtml @html (p_1,...,p_n) @end html @end ifhtml @ifinfo @math{(p_1,...,p_n)} @end ifinfo be a probability vector. Then @iftex @math{f(x) = p_1\cdot f_1(x) + \ldots + p_n\cdot f_n(x)} @end iftex @ifhtml @html f(x) = p_1 * f_1(x) + ...+ p_n * f_n(x) @end html @end ifhtml @ifinfo @math{f(x) = p_1 * f_1(x) + ...+ p_n * f_n(x)} @end ifinfo is the PDF of the so called mixture of these distributions. Method MIXT takes generator objects for the components and a probability vector and creates a generator object for this mixture. The sampling part works as follows: @enumerate @item Generate an index @i{J} as the realisation of a discrete random variate with the given probability vector. This is done by means of method DGT (@pxref{DGT,Guide Table method}). @item Generate a random variate @i{X} with PDF @iftex @math{f_J.} @end iftex @ifhtml @html f_J. @end html @end ifhtml @ifinfo @math{f_J.} @end ifinfo @end enumerate When the (interior of the) domains of the the components are disjoint then it is possible to sample from the mixture by inversion, provided that the following conditions are met: @itemize @minus @item The generator objects must use an inversion method for each component. @item The domains of the PDFs @iftex @math{f_i} @end iftex @ifhtml @html f_i @end html @end ifhtml @ifinfo @math{f_i} @end ifinfo must not overlap. @item The components must be ordered with respect to their domains. @end itemize @subsubheading How To Use Create generator objects for the components of the mixture and store the corresponding pointers in an array. Store all probabilities an a double array of the same size. Create the parameter object for the generator of the mixture distribution by means of @ifhtml @ref{funct:unur_mixt_new,@command{unur_mixt_new}.} @end ifhtml @ifnothtml @command{unur_mixt_new}. @end ifnothtml The components of the mixture can be any continuous or discrete univariate distributions. This also includes generators for empirical distributions and mixtures of distributions. In particular, mixtures can also be defined recursively. @emph{Remark:} The components of the mixture can be continuous or discrete distributions. The resulting mixture, however, is always a continuous distribution and thus @ifhtml @ref{funct:unur_sample_cont,@command{unur_sample_cont}} @end ifhtml @ifnothtml @command{unur_sample_cont} @end ifnothtml must be used! The inversion method can be switched on by means of @ifhtml @ref{funct:unur_mixt_set_useinversion,@command{unur_mixt_set_useinversion}} @end ifhtml @ifnothtml @command{unur_mixt_set_useinversion} @end ifnothtml call. However, the conditions for this method must then be met. Otherwise, initialization of the mixture object fails. @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_mixt_new,unur_mixt_new} @item @ref{funct:unur_mixt_set_useinversion,unur_mixt_set_useinversion} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_mixt_new} @deftypefn Function {UNUR_PAR*} unur_mixt_new (int @var{n}, const @var{double* prob}, UNUR_GEN** @var{comp}) Get default parameters for the generator for a mixture of the distributions given in the array @var{comp} (components) of length @var{n}. The probabilities are given by @var{prob}. The generators in @var{comp} must be objects for (continuous or discrete) univariate distributions @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_mixt_new} @deftypefn {} {UNUR_PAR*} unur_mixt_new (int @var{n}, const @var{double* prob}, UNUR_GEN** @var{comp}) Get default parameters for the generator for a mixture of the distributions given in the array @var{comp} (components) of length @var{n}. The probabilities are given by @var{prob}. The generators in @var{comp} must be objects for (continuous or discrete) univariate distributions @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_mixt_set_useinversion} @deftypefn Function {int} unur_mixt_set_useinversion (UNUR_PAR* @var{parameters}, int @var{useinv}) If @var{useinv} is @code{TRUE}, then the inversion method is used for sampling from the mixture distribution. However, the following conditions must be satisfied: @itemize @minus @item The generator objects must use an inversion method for each component. @item The domains of the components must not overlap. @item The components must be ordered with respect to their domains. @end itemize If one of these conditions is violated, then initialization of the mixture object fails. Default is @code{FALSE}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_mixt_set_useinversion} @deftypefn {} {int} unur_mixt_set_useinversion (UNUR_PAR* @var{parameters}, int @var{useinv}) If @var{useinv} is @code{TRUE}, then the inversion method is used for sampling from the mixture distribution. However, the following conditions must be satisfied: @itemize @minus @item The generator objects must use an inversion method for each component. @item The domains of the components must not overlap. @item The components must be ordered with respect to their domains. @end itemize If one of these conditions is violated, then initialization of the mixture object fails. Default is @code{FALSE}. @end deftypefn @end ifnotinfo @c @c end of mixt.h @c ------------------------------------- @c ------------------------------------- @c urng.h @c @node URNG @chapter Using uniform random number generators @menu * URNG-FVOID:: Simple interface for uniform random number generators * URNG-GSL:: Interface to GSL uniform random number generators * URNG-GSLQRNG:: Interface to GSL generators for quasi-random points * URNG-PRNG:: Interface to Otmar Lendl's pseudo-random number generators * URNG-RNGSTREAM:: Interface to L'Ecuyer's RNGSTREAM random number generators * URNG-RANDOMSHIFT:: Combine point set generator with random shifts @end menu UNU.RAN is designed to work with many sources of (pseudo-) random numbers or low discrepancy numbers (so called quasi-random numbers) for almost all tasks in discrete event simulation, (quasi-) Monte Carlo integration or any other stochastic methods. Hence UNU.RAN uses pointers to access uniform (pseudo-) random number generators (URNG). Each UNU.RAN (non-uniform random variate) generator object has a pointer to a URNG object. Thus each UNU.RAN generator object may have its own (independent) URNG or several generator objects can share the same URNG. If no URNG is provided for a parameter or generator object a default generator is used which is the same for all generators. This URNG is defined in @file{unuran_config.h} at compile time and can be changed at runtime. UNU.RAN uses a unified interface for all sources of random numbers. Unfortunately, the API for random number generators, like the @file{GSL} (GNU Scientific Library), Otmar Lendl's @file{prng} (Pseudo random number generators), or a single function implemented by the user herself, are quite different. Hence an object of type @code{UNUR_URNG} is introduced to store the URNG. Thus it is possible to handle different sources of such URNGs with the unified API. It is inspired from similar to Pierre L'Ecuyers @file{RngStreams} library: @itemize @minus @item seed the random number generator; @item get a uniform random number; @item reset the URNG; @item skip to the begining next substream; @item sample antithetic numbers; @item delete the URNG object. @end itemize The routine to create a URNG depends on the chosen random number generator (i.e. library). Nevertheless, there exist wrapper functions to simplify this task. Currently the following sources of uniform random numbers are directly supported (i.e., there exist wrapper functions). Of course other random number generation libraries can be used. @enumerate @item @code{FVOID} URNGs of type @code{double uniform(void *state)}. The argument @var{state} can be simply ignored in the implementation of @code{uniform} when a global state variable is used. UNU.RAN contains some build-in URNGs of this type in directory @file{src/uniform/}. @item @code{PRNG} URNGs from Otmar Lendl's @code{prng} library. It provides a very flexible way to sample form arbitrary URNGs by means of an object oriented programing paradigma. Similarly to the UNU.RAN library independent generator objects can be build and used. This library has been developed by the pLab group at the university of Salzburg (Austria, EU) and implemented by Otmar Lendl. It is available from @uref{http://statmath.wu.ac.at/prng/} or from the pLab site at @uref{http://random.mat.sbg.ac.at/}. This interface must be compiled into UNU.RAN using the configure flag @code{--with-urng-prng}. @item @code{RNGSTREAM} Pierre L'Ecuyer's @code{RngStream} library for multiple independent streams of pseudo-random numbers. A GNU-style package is available from @uref{http://statmath.wu.ac.at/software/RngStreams/}. This interface must be compiled into UNU.RAN using the configure flag @code{--with-urng-rngstream}. @item @code{GSL} URNG from the GNU Scientific Library (GSL). It is available from @uref{http://www.gnu.org/software/gsl/}. This interface must be compiled into UNU.RAN using the configure flag @code{--with-urng-gsl}. @end enumerate @subsubheading How To Use Each UNU.RAN generator object has a pointer to a uniform (pseudo-) random number generator (URNG). It can be set via the @ifhtml @ref{funct:unur_set_urng,@command{unur_set_urng}} @end ifhtml @ifnothtml @command{unur_set_urng} @end ifnothtml call. It is also possible to read this pointer via @ifhtml @ref{funct:unur_get_urng,@command{unur_get_urng}} @end ifhtml @ifnothtml @command{unur_get_urng} @end ifnothtml or change the URNG for an existing generator object by means of @ifhtml @ref{funct:unur_chg_urng,@command{unur_chg_urng}.} @end ifhtml @ifnothtml @command{unur_chg_urng}. @end ifnothtml It is important to note that these calls only copy the pointer to the URNG object into the generator object. If no URNG is provided for a parameter or generator object a default URNG is used which is the same for all generators. This URNG is defined in @file{unuran_config.h} at compile time. A pointer to this default URNG can be obtained via @ifhtml @ref{funct:unur_get_default_urng,@command{unur_get_default_urng}.} @end ifhtml @ifnothtml @command{unur_get_default_urng}. @end ifnothtml Nevertheless, it is also possible to change this default URNG by another one at runtime by means of the @ifhtml @ref{funct:unur_set_default_urng,@command{unur_set_default_urng}} @end ifhtml @ifnothtml @command{unur_set_default_urng} @end ifnothtml call. However, this only takes effect for new parameter objects. Some generating methods provide the possibility of correlation induction. For this feature a second auxiliary URNG is required. It can be set and changed by @ifhtml @ref{funct:unur_set_urng_aux,@command{unur_set_urng_aux}} @end ifhtml @ifnothtml @command{unur_set_urng_aux} @end ifnothtml and @ifhtml @ref{funct:unur_chg_urng_aux,@command{unur_chg_urng_aux}} @end ifhtml @ifnothtml @command{unur_chg_urng_aux} @end ifnothtml calls, respectively. Since the auxiliary URNG is by default the same as the main URNG, the auxiliary URNG must be set after any @ifhtml @ref{funct:unur_set_urng,@command{unur_set_urng}} @end ifhtml @ifnothtml @command{unur_set_urng} @end ifnothtml or @ifhtml @ref{funct:unur_chg_urng,@command{unur_chg_urng}} @end ifhtml @ifnothtml @command{unur_chg_urng} @end ifnothtml call! Since in special cases mixing of two URNG might cause problems, we supply a default auxiliary generator that can be used by a @ifhtml @ref{funct:unur_use_urng_aux_default,@command{unur_use_urng_aux_default}} @end ifhtml @ifnothtml @command{unur_use_urng_aux_default} @end ifnothtml call (after the main URNG has been set). This default auxiliary generator can be changed with analogous calls as the (main) default uniform generator. Uniform random number generators form different sources have different programming interfaces. Thus UNU.RAN stores all information about a particular uniform random number generator in a structure of type @code{UNUR_URNG}. Before a URNG can be used with UNU.RAN an appropriate object has to be created ba a @ifhtml @ref{funct:unur_urng_new,@command{unur_urng_new}} @end ifhtml @ifnothtml @command{unur_urng_new} @end ifnothtml call. This call takes two arguments: the pointer to the sampling routine of the generator and a pointer to a possible argument that stores the state of the generator. The function must be of type @code{double (*sampleunif)(void *params)}, but functions without any argument also work. Additionally one can set pointers to functions for reseting or jumping the streams generated by the URNG by the corresponding @code{set} calls. UNU.RAN provides a unified API to all sources of random numbers. Notice, however, that not all functions work for all random number generators (as the respective library has not implemented the corresponding feature). There are wrapper functions for some libraries of uniform random number generators to simplify the task of creating a UNU.RAN object for URNGs. These functions must be compiled into UNU.RAN using the corresponding configure flags (see description of the respective interface below). @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_get_default_urng,unur_get_default_urng} @item @ref{funct:unur_set_default_urng,unur_set_default_urng} @item @ref{funct:unur_set_default_urng_aux,unur_set_default_urng_aux} @item @ref{funct:unur_get_default_urng_aux,unur_get_default_urng_aux} @item @ref{funct:unur_set_urng,unur_set_urng} @item @ref{funct:unur_chg_urng,unur_chg_urng} @item @ref{funct:unur_get_urng,unur_get_urng} @item @ref{funct:unur_set_urng_aux,unur_set_urng_aux} @item @ref{funct:unur_use_urng_aux_default,unur_use_urng_aux_default} @item @ref{funct:unur_chgto_urng_aux_default,unur_chgto_urng_aux_default} @item @ref{funct:unur_chg_urng_aux,unur_chg_urng_aux} @item @ref{funct:unur_get_urng_aux,unur_get_urng_aux} @item @ref{funct:unur_urng_sample,unur_urng_sample} @item @ref{funct:unur_sample_urng,unur_sample_urng} @item @ref{funct:unur_urng_sample_array,unur_urng_sample_array} @item @ref{funct:unur_urng_reset,unur_urng_reset} @item @ref{funct:unur_urng_sync,unur_urng_sync} @item @ref{funct:unur_urng_seed,unur_urng_seed} @item @ref{funct:unur_urng_anti,unur_urng_anti} @item @ref{funct:unur_urng_nextsub,unur_urng_nextsub} @item @ref{funct:unur_urng_resetsub,unur_urng_resetsub} @item @ref{funct:unur_gen_sync,unur_gen_sync} @item @ref{funct:unur_gen_seed,unur_gen_seed} @item @ref{funct:unur_gen_anti,unur_gen_anti} @item @ref{funct:unur_gen_reset,unur_gen_reset} @item @ref{funct:unur_gen_nextsub,unur_gen_nextsub} @item @ref{funct:unur_gen_resetsub,unur_gen_resetsub} @item @ref{funct:unur_urng_new,unur_urng_new} @item @ref{funct:unur_urng_free,unur_urng_free} @item @ref{funct:unur_urng_set_sample_array,unur_urng_set_sample_array} @item @ref{funct:unur_urng_set_sync,unur_urng_set_sync} @item @ref{funct:unur_urng_set_seed,unur_urng_set_seed} @item @ref{funct:unur_urng_set_anti,unur_urng_set_anti} @item @ref{funct:unur_urng_set_reset,unur_urng_set_reset} @item @ref{funct:unur_urng_set_nextsub,unur_urng_set_nextsub} @item @ref{funct:unur_urng_set_resetsub,unur_urng_set_resetsub} @item @ref{funct:unur_urng_set_delete,unur_urng_set_delete} @end itemize @end ifhtml @subheading Set and get default uniform RNGs @ifinfo @anchor{funct:unur_get_default_urng} @deftypefn Function {UNUR_URNG*} unur_get_default_urng (void) Get the pointer to the default URNG. The default URNG is used by all generators where no URNG was set explicitly by a @ifhtml @ref{funct:unur_set_urng,@command{unur_set_urng}} @end ifhtml @ifnothtml @command{unur_set_urng} @end ifnothtml call. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_get_default_urng} @deftypefn {} {UNUR_URNG*} unur_get_default_urng (void) Get the pointer to the default URNG. The default URNG is used by all generators where no URNG was set explicitly by a @ifhtml @ref{funct:unur_set_urng,@command{unur_set_urng}} @end ifhtml @ifnothtml @command{unur_set_urng} @end ifnothtml call. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_set_default_urng} @deftypefn Function {UNUR_URNG*} unur_set_default_urng (UNUR_URNG* @var{urng_new}) Change the default URNG that is used for new parameter objects. It returns the pointer to the old default URNG that has been used. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_set_default_urng} @deftypefn {} {UNUR_URNG*} unur_set_default_urng (UNUR_URNG* @var{urng_new}) Change the default URNG that is used for new parameter objects. It returns the pointer to the old default URNG that has been used. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_set_default_urng_aux} @anchor{funct:unur_get_default_urng_aux} @deftypefn Function {UNUR_URNG*} unur_set_default_urng_aux (UNUR_URNG* @var{urng_new}) @deftypefnx Function {UNUR_URNG*} unur_get_default_urng_aux (void) Analogous calls for default auxiliary generator. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_set_default_urng_aux} @anchor{funct:unur_get_default_urng_aux} @deftypefn {} {UNUR_URNG*} unur_set_default_urng_aux (UNUR_URNG* @var{urng_new}) @deftypefnx {} {UNUR_URNG*} unur_get_default_urng_aux (void) Analogous calls for default auxiliary generator. @end deftypefn @end ifnotinfo @subheading Set, change and get uniform RNGs in generator objects @ifinfo @anchor{funct:unur_set_urng} @deftypefn Function {int} unur_set_urng (UNUR_PAR* @var{parameters}, UNUR_URNG* @var{urng}) Use the URNG @code{urng} for the new generator. This overrides the default URNG. It also sets the auxiliary URNG to @code{urng}. @emph{Important}: For multivariate distributions that use marginal distributions this call does not work properly. It is then better first to create the generator object (by a @ifhtml @ref{funct:unur_init,@command{unur_init}} @end ifhtml @ifnothtml @command{unur_init} @end ifnothtml call) and then change the URNG by means of @ifhtml @ref{funct:unur_chg_urng,@command{unur_chg_urng}.} @end ifhtml @ifnothtml @command{unur_chg_urng}. @end ifnothtml @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_set_urng} @deftypefn {} {int} unur_set_urng (UNUR_PAR* @var{parameters}, UNUR_URNG* @var{urng}) Use the URNG @code{urng} for the new generator. This overrides the default URNG. It also sets the auxiliary URNG to @code{urng}. @emph{Important}: For multivariate distributions that use marginal distributions this call does not work properly. It is then better first to create the generator object (by a @ifhtml @ref{funct:unur_init,@command{unur_init}} @end ifhtml @ifnothtml @command{unur_init} @end ifnothtml call) and then change the URNG by means of @ifhtml @ref{funct:unur_chg_urng,@command{unur_chg_urng}.} @end ifhtml @ifnothtml @command{unur_chg_urng}. @end ifnothtml @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_chg_urng} @deftypefn Function {UNUR_URNG*} unur_chg_urng (UNUR_GEN* @var{generator}, UNUR_URNG* @var{urng}) Change the URNG for the given generator. It returns the pointer to the old URNG that has been used by the generator. It also changes the auxiliary URNG to @code{urng} and thus it overrides the last @ifhtml @ref{funct:unur_chg_urng_aux,@command{unur_chg_urng_aux}} @end ifhtml @ifnothtml @command{unur_chg_urng_aux} @end ifnothtml call. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_chg_urng} @deftypefn {} {UNUR_URNG*} unur_chg_urng (UNUR_GEN* @var{generator}, UNUR_URNG* @var{urng}) Change the URNG for the given generator. It returns the pointer to the old URNG that has been used by the generator. It also changes the auxiliary URNG to @code{urng} and thus it overrides the last @ifhtml @ref{funct:unur_chg_urng_aux,@command{unur_chg_urng_aux}} @end ifhtml @ifnothtml @command{unur_chg_urng_aux} @end ifnothtml call. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_get_urng} @deftypefn Function {UNUR_URNG*} unur_get_urng (UNUR_GEN* @var{generator}) Get the pointer to the URNG that is used by the @var{generator}. This is usefull if two generators should share the same URNG. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_get_urng} @deftypefn {} {UNUR_URNG*} unur_get_urng (UNUR_GEN* @var{generator}) Get the pointer to the URNG that is used by the @var{generator}. This is usefull if two generators should share the same URNG. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_set_urng_aux} @deftypefn Function {int} unur_set_urng_aux (UNUR_PAR* @var{parameters}, UNUR_URNG* @var{urng_aux}) Use the auxiliary URNG @code{urng_aux} for the new generator. (Default is the default URNG or the URNG from the last @ifhtml @ref{funct:unur_set_urng,@command{unur_set_urng}} @end ifhtml @ifnothtml @command{unur_set_urng} @end ifnothtml call. Thus if the auxiliary generator should be different to the main URNG, @ifhtml @ref{funct:unur_set_urng_aux,@command{unur_set_urng_aux}} @end ifhtml @ifnothtml @command{unur_set_urng_aux} @end ifnothtml must be called after @ifhtml @ref{funct:unur_set_urng,@command{unur_set_urng}.} @end ifhtml @ifnothtml @command{unur_set_urng}. @end ifnothtml The auxiliary URNG is used as second stream of uniform random number for correlation induction. It is not possible to set an auxiliary URNG for a method that does not need one. In this case an error code is returned. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_set_urng_aux} @deftypefn {} {int} unur_set_urng_aux (UNUR_PAR* @var{parameters}, UNUR_URNG* @var{urng_aux}) Use the auxiliary URNG @code{urng_aux} for the new generator. (Default is the default URNG or the URNG from the last @ifhtml @ref{funct:unur_set_urng,@command{unur_set_urng}} @end ifhtml @ifnothtml @command{unur_set_urng} @end ifnothtml call. Thus if the auxiliary generator should be different to the main URNG, @ifhtml @ref{funct:unur_set_urng_aux,@command{unur_set_urng_aux}} @end ifhtml @ifnothtml @command{unur_set_urng_aux} @end ifnothtml must be called after @ifhtml @ref{funct:unur_set_urng,@command{unur_set_urng}.} @end ifhtml @ifnothtml @command{unur_set_urng}. @end ifnothtml The auxiliary URNG is used as second stream of uniform random number for correlation induction. It is not possible to set an auxiliary URNG for a method that does not need one. In this case an error code is returned. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_use_urng_aux_default} @deftypefn Function {int} unur_use_urng_aux_default (UNUR_PAR* @var{parameters}) Use the default auxiliary URNG. (It must be set after @ifhtml @ref{funct:unur_get_urng,@command{unur_get_urng}.} @end ifhtml @ifnothtml @command{unur_get_urng}. @end ifnothtml ) It is not possible to set an auxiliary URNG for a method that does not use one (i.e. the call returns an error code). @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_use_urng_aux_default} @deftypefn {} {int} unur_use_urng_aux_default (UNUR_PAR* @var{parameters}) Use the default auxiliary URNG. (It must be set after @ifhtml @ref{funct:unur_get_urng,@command{unur_get_urng}.} @end ifhtml @ifnothtml @command{unur_get_urng}. @end ifnothtml ) It is not possible to set an auxiliary URNG for a method that does not use one (i.e. the call returns an error code). @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_chgto_urng_aux_default} @deftypefn Function {int} unur_chgto_urng_aux_default (UNUR_GEN* @var{generator}) Switch to default auxiliary URNG. (It must be set after @ifhtml @ref{funct:unur_get_urng,@command{unur_get_urng}.} @end ifhtml @ifnothtml @command{unur_get_urng}. @end ifnothtml ) It is not possible to set an auxiliary URNG for a method that does not use one (i.e. the call returns an error code). @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_chgto_urng_aux_default} @deftypefn {} {int} unur_chgto_urng_aux_default (UNUR_GEN* @var{generator}) Switch to default auxiliary URNG. (It must be set after @ifhtml @ref{funct:unur_get_urng,@command{unur_get_urng}.} @end ifhtml @ifnothtml @command{unur_get_urng}. @end ifnothtml ) It is not possible to set an auxiliary URNG for a method that does not use one (i.e. the call returns an error code). @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_chg_urng_aux} @deftypefn Function {UNUR_URNG*} unur_chg_urng_aux (UNUR_GEN* @var{generator}, UNUR_URNG* @var{urng_aux}) Change the auxiliary URNG for the given @var{generator}. It returns the pointer to the old auxiliary URNG that has been used by the generator. It has to be called after each @ifhtml @ref{funct:unur_chg_urng,@command{unur_chg_urng}} @end ifhtml @ifnothtml @command{unur_chg_urng} @end ifnothtml when the auxiliary URNG should be different from the main URNG. It is not possible to change the auxiliary URNG for a method that does not use one (i.e. the call @code{NULL}). @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_chg_urng_aux} @deftypefn {} {UNUR_URNG*} unur_chg_urng_aux (UNUR_GEN* @var{generator}, UNUR_URNG* @var{urng_aux}) Change the auxiliary URNG for the given @var{generator}. It returns the pointer to the old auxiliary URNG that has been used by the generator. It has to be called after each @ifhtml @ref{funct:unur_chg_urng,@command{unur_chg_urng}} @end ifhtml @ifnothtml @command{unur_chg_urng} @end ifnothtml when the auxiliary URNG should be different from the main URNG. It is not possible to change the auxiliary URNG for a method that does not use one (i.e. the call @code{NULL}). @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_get_urng_aux} @deftypefn Function {UNUR_URNG*} unur_get_urng_aux (UNUR_GEN* @var{generator}) Get the pointer to the auxiliary URNG that is used by the @var{generator}. This is usefull if two generators should share the same URNG. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_get_urng_aux} @deftypefn {} {UNUR_URNG*} unur_get_urng_aux (UNUR_GEN* @var{generator}) Get the pointer to the auxiliary URNG that is used by the @var{generator}. This is usefull if two generators should share the same URNG. @end deftypefn @end ifnotinfo @subheading Handle uniform RNGs @emph{Notice:} Some of the below function calls do not work for every source of random numbers since not every library has implemented these features. @ifinfo @anchor{funct:unur_urng_sample} @deftypefn Function {double} unur_urng_sample (UNUR_URNG* @var{urng}) Get a uniform random number from @var{urng}. If the @code{NULL} pointer is given, the default uniform generator is used. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_urng_sample} @deftypefn {} {double} unur_urng_sample (UNUR_URNG* @var{urng}) Get a uniform random number from @var{urng}. If the @code{NULL} pointer is given, the default uniform generator is used. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_sample_urng} @deftypefn Function {double} unur_sample_urng (UNUR_GEN* @var{gen}) Get a uniform random number from the underlying uniform random number generator of generator @var{gen}. If the @code{NULL} pointer is given, the default uniform generator is used. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_sample_urng} @deftypefn {} {double} unur_sample_urng (UNUR_GEN* @var{gen}) Get a uniform random number from the underlying uniform random number generator of generator @var{gen}. If the @code{NULL} pointer is given, the default uniform generator is used. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_urng_sample_array} @deftypefn Function {int} unur_urng_sample_array (UNUR_URNG* @var{urng}, double* @var{X}, int @var{dim}) Set array @var{X} of length @var{dim} with uniform random numbers sampled from generator @var{urng}. If @var{urng} is the @code{NULL} pointer, the default uniform generator is used. @emph{Important:} If @var{urng} is based on a point set generator (this is the case for generators of low discrepance point sets as used in quasi-Monte Carlo methods) it has a ``natural dimension'' @i{s}. In this case either only the first @i{s} entries of @var{X} are filled (if @i{s} < @var{dim}), or the first @var{dim} coordinates of the generated point are filled. The called returns the actual number of entries filled. In case of an error @code{0} is returned. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_urng_sample_array} @deftypefn {} {int} unur_urng_sample_array (UNUR_URNG* @var{urng}, double* @var{X}, int @var{dim}) Set array @var{X} of length @var{dim} with uniform random numbers sampled from generator @var{urng}. If @var{urng} is the @code{NULL} pointer, the default uniform generator is used. @emph{Important:} If @var{urng} is based on a point set generator (this is the case for generators of low discrepance point sets as used in quasi-Monte Carlo methods) it has a ``natural dimension'' @i{s}. In this case either only the first @i{s} entries of @var{X} are filled (if @i{s} < @var{dim}), or the first @var{dim} coordinates of the generated point are filled. The called returns the actual number of entries filled. In case of an error @code{0} is returned. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_urng_reset} @deftypefn Function {int} unur_urng_reset (UNUR_URNG* @var{urng}) Reset @var{urng} object. The routine tries two ways to reset the generator (in this order): @enumerate @item It uses the reset function given by an @ifhtml @ref{funct:unur_urng_set_reset,@command{unur_urng_set_reset}} @end ifhtml @ifnothtml @command{unur_urng_set_reset} @end ifnothtml call. @item It uses the seed given by the last @ifhtml @ref{funct:unur_urng_seed,@command{unur_urng_seed}} @end ifhtml @ifnothtml @command{unur_urng_seed} @end ifnothtml call (which requires a seeding function given by a @ifhtml @ref{funct:unur_urng_set_seed,@command{unur_urng_set_seed}} @end ifhtml @ifnothtml @command{unur_urng_set_seed} @end ifnothtml call). @end enumerate If neither of the two methods work resetting of the generator is not possible and an error code is returned. If the @code{NULL} pointer is given, the default uniform generator is reset. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_urng_reset} @deftypefn {} {int} unur_urng_reset (UNUR_URNG* @var{urng}) Reset @var{urng} object. The routine tries two ways to reset the generator (in this order): @enumerate @item It uses the reset function given by an @ifhtml @ref{funct:unur_urng_set_reset,@command{unur_urng_set_reset}} @end ifhtml @ifnothtml @command{unur_urng_set_reset} @end ifnothtml call. @item It uses the seed given by the last @ifhtml @ref{funct:unur_urng_seed,@command{unur_urng_seed}} @end ifhtml @ifnothtml @command{unur_urng_seed} @end ifnothtml call (which requires a seeding function given by a @ifhtml @ref{funct:unur_urng_set_seed,@command{unur_urng_set_seed}} @end ifhtml @ifnothtml @command{unur_urng_set_seed} @end ifnothtml call). @end enumerate If neither of the two methods work resetting of the generator is not possible and an error code is returned. If the @code{NULL} pointer is given, the default uniform generator is reset. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_urng_sync} @deftypefn Function {int} unur_urng_sync (UNUR_URNG* @var{urng}) Jump into defined state ("sync") of the generator. This is useful when point generators are used where the coordinates are sampled via @ifhtml @ref{funct:unur_urng_sample,@command{unur_urng_sample}.} @end ifhtml @ifnothtml @command{unur_urng_sample}. @end ifnothtml Then this call can be used to jump to the first coordinate of the next generated point. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_urng_sync} @deftypefn {} {int} unur_urng_sync (UNUR_URNG* @var{urng}) Jump into defined state ("sync") of the generator. This is useful when point generators are used where the coordinates are sampled via @ifhtml @ref{funct:unur_urng_sample,@command{unur_urng_sample}.} @end ifhtml @ifnothtml @command{unur_urng_sample}. @end ifnothtml Then this call can be used to jump to the first coordinate of the next generated point. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_urng_seed} @deftypefn Function {int} unur_urng_seed (UNUR_URNG* @var{urng}, unsigned @var{long seed}) Set @var{seed} for generator @var{urng}. It returns an error code if this is not possible for the given URNG. If the @code{NULL} pointer is given, the default uniform generator is seeded (if possible). @emph{Notice}: Seeding should be done only once for a particular generator (except for resetting it to the initial state). Expertise is required when multiple seeds are used to get independent streams. Thus we recommend appropriate libraries for this task, e.g. Pierre L'Ecuyer's @file{RngStreams} package. For this library only a package seed can be set and thus the @ifhtml @ref{funct:unur_urng_seed,@command{unur_urng_seed}} @end ifhtml @ifnothtml @command{unur_urng_seed} @end ifnothtml call will not have any effect to generators of this type. Use @ifhtml @ref{funct:unur_urng_reset,@command{unur_urng_reset}} @end ifhtml @ifnothtml @command{unur_urng_reset} @end ifnothtml or @ifhtml @ref{funct:unur_urng_rngstream_new,@command{unur_urng_rngstream_new}} @end ifhtml @ifnothtml @command{unur_urng_rngstream_new} @end ifnothtml instead, depending whether one wants to reset the stream or get a new stream that is independent from the previous ones. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_urng_seed} @deftypefn {} {int} unur_urng_seed (UNUR_URNG* @var{urng}, unsigned @var{long seed}) Set @var{seed} for generator @var{urng}. It returns an error code if this is not possible for the given URNG. If the @code{NULL} pointer is given, the default uniform generator is seeded (if possible). @emph{Notice}: Seeding should be done only once for a particular generator (except for resetting it to the initial state). Expertise is required when multiple seeds are used to get independent streams. Thus we recommend appropriate libraries for this task, e.g. Pierre L'Ecuyer's @file{RngStreams} package. For this library only a package seed can be set and thus the @ifhtml @ref{funct:unur_urng_seed,@command{unur_urng_seed}} @end ifhtml @ifnothtml @command{unur_urng_seed} @end ifnothtml call will not have any effect to generators of this type. Use @ifhtml @ref{funct:unur_urng_reset,@command{unur_urng_reset}} @end ifhtml @ifnothtml @command{unur_urng_reset} @end ifnothtml or @ifhtml @ref{funct:unur_urng_rngstream_new,@command{unur_urng_rngstream_new}} @end ifhtml @ifnothtml @command{unur_urng_rngstream_new} @end ifnothtml instead, depending whether one wants to reset the stream or get a new stream that is independent from the previous ones. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_urng_anti} @deftypefn Function {int} unur_urng_anti (UNUR_URNG* @var{urng}, int @var{anti}) Switch to antithetic random numbers in @var{urng}. It returns an error code if this is not possible for the given URNG. If the @code{NULL} pointer is given, the antithetic flag of the default uniform generator is switched (if possible). @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_urng_anti} @deftypefn {} {int} unur_urng_anti (UNUR_URNG* @var{urng}, int @var{anti}) Switch to antithetic random numbers in @var{urng}. It returns an error code if this is not possible for the given URNG. If the @code{NULL} pointer is given, the antithetic flag of the default uniform generator is switched (if possible). @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_urng_nextsub} @deftypefn Function {int} unur_urng_nextsub (UNUR_URNG* @var{urng}) Jump to start of the next substream of @var{urng}. It returns an error code if this is not possible for the given URNG. If the @code{NULL} pointer is given, the default uniform generator is set to the start of the next substream (if possible). @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_urng_nextsub} @deftypefn {} {int} unur_urng_nextsub (UNUR_URNG* @var{urng}) Jump to start of the next substream of @var{urng}. It returns an error code if this is not possible for the given URNG. If the @code{NULL} pointer is given, the default uniform generator is set to the start of the next substream (if possible). @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_urng_resetsub} @deftypefn Function {int} unur_urng_resetsub (UNUR_URNG* @var{urng}) Jump to start of the current substream of @var{urng}. It returns an error code if this is not possible for the given URNG. If the @code{NULL} pointer is given, the default uniform generator is set to the start of the current substream (if possible). @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_urng_resetsub} @deftypefn {} {int} unur_urng_resetsub (UNUR_URNG* @var{urng}) Jump to start of the current substream of @var{urng}. It returns an error code if this is not possible for the given URNG. If the @code{NULL} pointer is given, the default uniform generator is set to the start of the current substream (if possible). @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_gen_sync} @anchor{funct:unur_gen_seed} @anchor{funct:unur_gen_anti} @anchor{funct:unur_gen_reset} @anchor{funct:unur_gen_nextsub} @anchor{funct:unur_gen_resetsub} @deftypefn Function {int} unur_gen_sync (UNUR_GEN* @var{generator}) @deftypefnx Function {int} unur_gen_seed (UNUR_GEN* @var{generator}, unsigned @var{long seed}) @deftypefnx Function {int} unur_gen_anti (UNUR_GEN* @var{generator}, int @var{anti}) @deftypefnx Function {int} unur_gen_reset (UNUR_GEN* @var{generator}) @deftypefnx Function {int} unur_gen_nextsub (UNUR_GEN* @var{generator}) @deftypefnx Function {int} unur_gen_resetsub (UNUR_GEN* @var{generator}) Analogous to @ifhtml @ref{funct:unur_urng_sync,@command{unur_urng_sync},} @end ifhtml @ifnothtml @command{unur_urng_sync}, @end ifnothtml @ifhtml @ref{funct:unur_urng_seed,@command{unur_urng_seed}} @end ifhtml @ifnothtml @command{unur_urng_seed} @end ifnothtml , @ifhtml @ref{funct:unur_urng_anti,@command{unur_urng_anti},} @end ifhtml @ifnothtml @command{unur_urng_anti}, @end ifnothtml @ifhtml @ref{funct:unur_urng_reset,@command{unur_urng_reset}} @end ifhtml @ifnothtml @command{unur_urng_reset} @end ifnothtml , @ifhtml @ref{funct:unur_urng_nextsub,@command{unur_urng_nextsub},} @end ifhtml @ifnothtml @command{unur_urng_nextsub}, @end ifnothtml and @ifhtml @ref{funct:unur_urng_resetsub,@command{unur_urng_resetsub},} @end ifhtml @ifnothtml @command{unur_urng_resetsub}, @end ifnothtml but act on the URNG object used by the @var{generator} object. @emph{Warning:} These calls should be used with care as it influences all generator objects that share the same URNG object! @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_gen_sync} @anchor{funct:unur_gen_seed} @anchor{funct:unur_gen_anti} @anchor{funct:unur_gen_reset} @anchor{funct:unur_gen_nextsub} @anchor{funct:unur_gen_resetsub} @deftypefn {} {int} unur_gen_sync (UNUR_GEN* @var{generator}) @deftypefnx {} {int} unur_gen_seed (UNUR_GEN* @var{generator}, unsigned @var{long seed}) @deftypefnx {} {int} unur_gen_anti (UNUR_GEN* @var{generator}, int @var{anti}) @deftypefnx {} {int} unur_gen_reset (UNUR_GEN* @var{generator}) @deftypefnx {} {int} unur_gen_nextsub (UNUR_GEN* @var{generator}) @deftypefnx {} {int} unur_gen_resetsub (UNUR_GEN* @var{generator}) Analogous to @ifhtml @ref{funct:unur_urng_sync,@command{unur_urng_sync},} @end ifhtml @ifnothtml @command{unur_urng_sync}, @end ifnothtml @ifhtml @ref{funct:unur_urng_seed,@command{unur_urng_seed}} @end ifhtml @ifnothtml @command{unur_urng_seed} @end ifnothtml , @ifhtml @ref{funct:unur_urng_anti,@command{unur_urng_anti},} @end ifhtml @ifnothtml @command{unur_urng_anti}, @end ifnothtml @ifhtml @ref{funct:unur_urng_reset,@command{unur_urng_reset}} @end ifhtml @ifnothtml @command{unur_urng_reset} @end ifnothtml , @ifhtml @ref{funct:unur_urng_nextsub,@command{unur_urng_nextsub},} @end ifhtml @ifnothtml @command{unur_urng_nextsub}, @end ifnothtml and @ifhtml @ref{funct:unur_urng_resetsub,@command{unur_urng_resetsub},} @end ifhtml @ifnothtml @command{unur_urng_resetsub}, @end ifnothtml but act on the URNG object used by the @var{generator} object. @emph{Warning:} These calls should be used with care as it influences all generator objects that share the same URNG object! @end deftypefn @end ifnotinfo @subheading API to create a new URNG object @emph{Notice:} These functions are provided to built a UNUR_URNG object for a particular external random number generator from scratch. For some libraries that contain random number generators (like the GSL) there are special calls, e.g. @ifhtml @ref{funct:unur_urng_gsl_new,@command{unur_urng_gsl_new},} @end ifhtml @ifnothtml @command{unur_urng_gsl_new}, @end ifnothtml to get such an object. Then there is no need to change the UNUR_URNG object as it already contains all available features. If you have a particular library for random number generators you can either write wrapper function like those in @file{src/uniform/urng_gsl.c} or write an email to the authors of UNU.RAN to write it for you. @ifinfo @anchor{funct:unur_urng_new} @deftypefn Function {UNUR_URNG*} unur_urng_new (double (* @var{sampleunif})(void* state ), void* @var{state}) Get a new URNG object. @var{sampleunif} is a function to the uniform sampling routine, @var{state} a pointer to its arguments which usually contains the state variables of the generator. Functions @var{sampleunif} with a different type for @var{p} or without an argument at all also work. A typecast might be necessary to avoid compiler warnings or error messages. For functions @var{sampleunif} that does not have any argument should use @code{NULL} for @var{state}. @emph{Important:} @var{sampleunif} must not be the @code{NULL} pointer. There are appropriate calls that simplifies the task of creating URNG objects for some libraries with uniform random number generators, see below. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_urng_new} @deftypefn {} {UNUR_URNG*} unur_urng_new (double (* @var{sampleunif})(void* state ), void* @var{state}) Get a new URNG object. @var{sampleunif} is a function to the uniform sampling routine, @var{state} a pointer to its arguments which usually contains the state variables of the generator. Functions @var{sampleunif} with a different type for @var{p} or without an argument at all also work. A typecast might be necessary to avoid compiler warnings or error messages. For functions @var{sampleunif} that does not have any argument should use @code{NULL} for @var{state}. @emph{Important:} @var{sampleunif} must not be the @code{NULL} pointer. There are appropriate calls that simplifies the task of creating URNG objects for some libraries with uniform random number generators, see below. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_urng_free} @deftypefn Function {void} unur_urng_free (UNUR_URNG* @var{urng}) Destroy @var{urng} object. It returns an error code if this is not possible. If the @code{NULL} is given, this function does nothing. @emph{Warning:} This call must be used with care. The @var{urng} object must not be used by any existing generator object! It is designed to work in conjunction with the wrapper functions to create URNG objects for generators of a particular library. Thus an object created by an @ifhtml @ref{funct:unur_urng_prng_new,@command{unur_urng_prng_new}} @end ifhtml @ifnothtml @command{unur_urng_prng_new} @end ifnothtml call can be simply destroyed by an @ifhtml @ref{funct:unur_urng_free,@command{unur_urng_free}} @end ifhtml @ifnothtml @command{unur_urng_free} @end ifnothtml call. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_urng_free} @deftypefn {} {void} unur_urng_free (UNUR_URNG* @var{urng}) Destroy @var{urng} object. It returns an error code if this is not possible. If the @code{NULL} is given, this function does nothing. @emph{Warning:} This call must be used with care. The @var{urng} object must not be used by any existing generator object! It is designed to work in conjunction with the wrapper functions to create URNG objects for generators of a particular library. Thus an object created by an @ifhtml @ref{funct:unur_urng_prng_new,@command{unur_urng_prng_new}} @end ifhtml @ifnothtml @command{unur_urng_prng_new} @end ifnothtml call can be simply destroyed by an @ifhtml @ref{funct:unur_urng_free,@command{unur_urng_free}} @end ifhtml @ifnothtml @command{unur_urng_free} @end ifnothtml call. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_urng_set_sample_array} @deftypefn Function {int} unur_urng_set_sample_array (UNUR_URNG* @var{urng}, unsigned int(* @var{samplearray})(void* state, double* @var{X}, int @var{dim} )) Set function to fill array @var{X} of length @var{dim} with random numbers generated by generator @var{urng} (if available). @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_urng_set_sample_array} @deftypefn {} {int} unur_urng_set_sample_array (UNUR_URNG* @var{urng}, unsigned int(* @var{samplearray})(void* state, double* @var{X}, int @var{dim} )) Set function to fill array @var{X} of length @var{dim} with random numbers generated by generator @var{urng} (if available). @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_urng_set_sync} @deftypefn Function {int} unur_urng_set_sync (UNUR_URNG* @var{urng}, void (* @var{sync})(void* state )) Set function for jumping into a defined state (``sync''). @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_urng_set_sync} @deftypefn {} {int} unur_urng_set_sync (UNUR_URNG* @var{urng}, void (* @var{sync})(void* state )) Set function for jumping into a defined state (``sync''). @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_urng_set_seed} @deftypefn Function {int} unur_urng_set_seed (UNUR_URNG* @var{urng}, void (* @var{setseed})(void* state, unsigned @var{long seed} )) Set function to seed generator @var{urng} (if available). @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_urng_set_seed} @deftypefn {} {int} unur_urng_set_seed (UNUR_URNG* @var{urng}, void (* @var{setseed})(void* state, unsigned @var{long seed} )) Set function to seed generator @var{urng} (if available). @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_urng_set_anti} @deftypefn Function {int} unur_urng_set_anti (UNUR_URNG* @var{urng}, void (* @var{setanti})(void* state, int @var{anti} )) Set function to switch the antithetic flag of generator @var{urng} (if available). @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_urng_set_anti} @deftypefn {} {int} unur_urng_set_anti (UNUR_URNG* @var{urng}, void (* @var{setanti})(void* state, int @var{anti} )) Set function to switch the antithetic flag of generator @var{urng} (if available). @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_urng_set_reset} @deftypefn Function {int} unur_urng_set_reset (UNUR_URNG* @var{urng}, void (* @var{reset})(void* state )) Set function for reseting the uniform random number generator @var{urng} (if available). @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_urng_set_reset} @deftypefn {} {int} unur_urng_set_reset (UNUR_URNG* @var{urng}, void (* @var{reset})(void* state )) Set function for reseting the uniform random number generator @var{urng} (if available). @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_urng_set_nextsub} @deftypefn Function {int} unur_urng_set_nextsub (UNUR_URNG* @var{urng}, void (* @var{nextsub})(void* state )) Set function that allows jumping to start of the next substream of @var{urng} (if available). @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_urng_set_nextsub} @deftypefn {} {int} unur_urng_set_nextsub (UNUR_URNG* @var{urng}, void (* @var{nextsub})(void* state )) Set function that allows jumping to start of the next substream of @var{urng} (if available). @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_urng_set_resetsub} @deftypefn Function {int} unur_urng_set_resetsub (UNUR_URNG* @var{urng}, void (* @var{resetsub})(void* state )) Set function that allows jumping to start of the current substream of @var{urng} (if available). @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_urng_set_resetsub} @deftypefn {} {int} unur_urng_set_resetsub (UNUR_URNG* @var{urng}, void (* @var{resetsub})(void* state )) Set function that allows jumping to start of the current substream of @var{urng} (if available). @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_urng_set_delete} @deftypefn Function {int} unur_urng_set_delete (UNUR_URNG* @var{urng}, void (* @var{fpdelete})(void* state )) Set function for destroying @var{urng} (if available). @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_urng_set_delete} @deftypefn {} {int} unur_urng_set_delete (UNUR_URNG* @var{urng}, void (* @var{fpdelete})(void* state )) Set function for destroying @var{urng} (if available). @end deftypefn @end ifnotinfo @c @c end of urng.h @c ------------------------------------- @c ------------------------------------- @c urng_fvoid.h @c @node URNG-FVOID @section Simple interface for uniform random number generators Simple interface for URNGs of type @code{double uniform(void *state)}. UNU.RAN contains some build-in URNGs of this type: @table @code @item unur_urng_MRG31k3p Combined multiple recursive generator by Pierre L'Ecuyer and Renee Touzin. @item unur_urng_fish Linear congruential generator by Fishman and Moore. @item unur_urng_mstd Linear congruential generator "Minimal Standard" by Park and Miller. @end table Notice, however, that these generators are provided as a fallback for the case that no state-of-the-art uniform random number generators (e.g. @pxref{URNG-RNGSTREAM,Pierre L'Ecuyer's @file{Rngstream} library, Pierre L'Ecuyer's @file{Rngstream} library}) are used. @subsubheading How To Use Create an URNG object using @ifhtml @ref{funct:unur_urng_fvoid_new,@command{unur_urng_fvoid_new}.} @end ifhtml @ifnothtml @command{unur_urng_fvoid_new}. @end ifnothtml By this call a pointer to the sampling routine and (optional) a pointer to a reset routine are copied into the URNG object. Other functions, like seeding the URNG, switching to antithetic random number, or jumping to next substream, can be added to the URNG object by the respective calls, e.g. by @ifhtml @ref{funct:unur_urng_set_seed,@command{unur_urng_set_seed}.} @end ifhtml @ifnothtml @command{unur_urng_set_seed}. @end ifnothtml The following routines are supported for URNG objects of this type: @itemize @minus @item @ifhtml @ref{funct:unur_urng_sample,@command{unur_urng_sample}} @end ifhtml @ifnothtml @command{unur_urng_sample} @end ifnothtml @item @ifhtml @ref{funct:unur_urng_sample_array,@command{unur_urng_sample_array}} @end ifhtml @ifnothtml @command{unur_urng_sample_array} @end ifnothtml @item @ifhtml @ref{funct:unur_urng_seed,@command{unur_urng_seed}} @end ifhtml @ifnothtml @command{unur_urng_seed} @end ifnothtml [optional] @item @ifhtml @ref{funct:unur_urng_reset,@command{unur_urng_reset}} @end ifhtml @ifnothtml @command{unur_urng_reset} @end ifnothtml [optional] @item @ifhtml @ref{funct:unur_urng_free,@command{unur_urng_free}} @end ifhtml @ifnothtml @command{unur_urng_free} @end ifnothtml @end itemize @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_urng_fvoid_new,unur_urng_fvoid_new} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_urng_fvoid_new} @deftypefn Function {UNUR_URNG*} unur_urng_fvoid_new (double (* @var{urand})(void* state ), void (* @var{reset})(void* state )) Make a URNG object for a generator that consists of a single function call @var{urand}. If there is no @var{reset} function use @code{NULL} for the second argument. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_urng_fvoid_new} @deftypefn {} {UNUR_URNG*} unur_urng_fvoid_new (double (* @var{urand})(void* state ), void (* @var{reset})(void* state )) Make a URNG object for a generator that consists of a single function call @var{urand}. If there is no @var{reset} function use @code{NULL} for the second argument. @end deftypefn @end ifnotinfo @c @c end of urng_fvoid.h @c ------------------------------------- @c ------------------------------------- @c urng_gsl.h @c @node URNG-GSL @section Interface to GSL uniform random number generators Interface to the uniform random number generators from the GNU Scientific Library (GSL). Documentation and source code of this library is available from @uref{http://www.gnu.org/software/gsl/}. The interface to the GSL must be compiled into UNU.RAN using the configure flag @code{--with-urng-gsl}. Notice that the GSL has to be installed before running @code{./configure}. @subsubheading How To Use When using this interface @file{unuran_urng_gsl.h} must be included in the corresponding C file, i.e., one must add the line @example #include @end example @noindent Moreover, one must not forget to link the executable against @file{libgsl}. The following routines are supported for URNG objects of type GSL: @itemize @minus @item @ifhtml @ref{funct:unur_urng_sample,@command{unur_urng_sample}} @end ifhtml @ifnothtml @command{unur_urng_sample} @end ifnothtml @item @ifhtml @ref{funct:unur_urng_sample_array,@command{unur_urng_sample_array}} @end ifhtml @ifnothtml @command{unur_urng_sample_array} @end ifnothtml @item @ifhtml @ref{funct:unur_urng_seed,@command{unur_urng_seed}} @end ifhtml @ifnothtml @command{unur_urng_seed} @end ifnothtml @item @ifhtml @ref{funct:unur_urng_reset,@command{unur_urng_reset}} @end ifhtml @ifnothtml @command{unur_urng_reset} @end ifnothtml @item @ifhtml @ref{funct:unur_urng_free,@command{unur_urng_free}} @end ifhtml @ifnothtml @command{unur_urng_free} @end ifnothtml @end itemize @smallexample @include ref_example_gsl.texi @end smallexample @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_urng_gsl_new,unur_urng_gsl_new} @item @ref{funct:unur_urng_gslptr_new,unur_urng_gslptr_new} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_urng_gsl_new} @deftypefn Function {UNUR_URNG*} unur_urng_gsl_new (const @var{gsl_rng_type* urngtype}) Make object for URNGs from the @file{GSL} (GNU Scientific Library). @var{urngtype} is the type of the chosen generator as described in the GSL manual (see Section Random Number Generation). This library is available from @uref{http://www.gnu.org/software/gsl/}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_urng_gsl_new} @deftypefn {} {UNUR_URNG*} unur_urng_gsl_new (const @var{gsl_rng_type* urngtype}) Make object for URNGs from the @file{GSL} (GNU Scientific Library). @var{urngtype} is the type of the chosen generator as described in the GSL manual (see Section Random Number Generation). This library is available from @uref{http://www.gnu.org/software/gsl/}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_urng_gslptr_new} @deftypefn Function {UNUR_URNG*} unur_urng_gslptr_new (gsl_rng* @var{urng}) Similar to @ifhtml @ref{funct:unur_urng_gsl_new,@command{unur_urng_gsl_new}} @end ifhtml @ifnothtml @command{unur_urng_gsl_new} @end ifnothtml but it uses a pointer to a generator object as returned by @code{gsl_rng_alloc(rng_type)}; see @file{GSL} manual for details. @emph{Notice}: There is a subtle but important difference between these two calls. When a generator object is created by a @ifhtml @ref{funct:unur_urng_gsl_new,@command{unur_urng_gsl_new}} @end ifhtml @ifnothtml @command{unur_urng_gsl_new} @end ifnothtml call, then resetting of the generator works. When a generator object is created by a @ifhtml @ref{funct:unur_urng_gslptr_new,@command{unur_urng_gslptr_new}} @end ifhtml @ifnothtml @command{unur_urng_gslptr_new} @end ifnothtml call, then resetting only works after a @code{unur_urng_seed(urng,myseed)} call. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_urng_gslptr_new} @deftypefn {} {UNUR_URNG*} unur_urng_gslptr_new (gsl_rng* @var{urng}) Similar to @ifhtml @ref{funct:unur_urng_gsl_new,@command{unur_urng_gsl_new}} @end ifhtml @ifnothtml @command{unur_urng_gsl_new} @end ifnothtml but it uses a pointer to a generator object as returned by @code{gsl_rng_alloc(rng_type)}; see @file{GSL} manual for details. @emph{Notice}: There is a subtle but important difference between these two calls. When a generator object is created by a @ifhtml @ref{funct:unur_urng_gsl_new,@command{unur_urng_gsl_new}} @end ifhtml @ifnothtml @command{unur_urng_gsl_new} @end ifnothtml call, then resetting of the generator works. When a generator object is created by a @ifhtml @ref{funct:unur_urng_gslptr_new,@command{unur_urng_gslptr_new}} @end ifhtml @ifnothtml @command{unur_urng_gslptr_new} @end ifnothtml call, then resetting only works after a @code{unur_urng_seed(urng,myseed)} call. @end deftypefn @end ifnotinfo @c @c end of urng_gsl.h @c ------------------------------------- @c ------------------------------------- @c urng_gslqrng.h @c @node URNG-GSLQRNG @section Interface to GSL generators for quasi-random points Interface to the generators for quasi-random points (also called low discrepancy point sets) from the GNU Scientific Library (GSL). Documentation and source code of this library is available from @uref{http://www.gnu.org/software/gsl/}. The interface to the GSL must be compiled into UNU.RAN using the configure flag @code{--with-urng-gsl}. Notice that the GSL has to be installed before running @code{./configure}. @subsubheading How To Use When using this interface @file{unuran_urng_gsl.h} must be included in the corresponding C file, i.e., one must add the line @example #include @end example @noindent Moreover, one must not forget to link the executable against @file{libgsl}. The following routines are supported for URNG objects of this type: @itemize @minus @item @ifhtml @ref{funct:unur_urng_sample,@command{unur_urng_sample}} @end ifhtml @ifnothtml @command{unur_urng_sample} @end ifnothtml @item @ifhtml @ref{funct:unur_urng_sample_array,@command{unur_urng_sample_array}} @end ifhtml @ifnothtml @command{unur_urng_sample_array} @end ifnothtml @item @ifhtml @ref{funct:unur_urng_reset,@command{unur_urng_reset}} @end ifhtml @ifnothtml @command{unur_urng_reset} @end ifnothtml @item @ifhtml @ref{funct:unur_urng_sync,@command{unur_urng_sync}} @end ifhtml @ifnothtml @command{unur_urng_sync} @end ifnothtml @item @ifhtml @ref{funct:unur_urng_free,@command{unur_urng_free}} @end ifhtml @ifnothtml @command{unur_urng_free} @end ifnothtml @end itemize @ifhtml @ref{funct:unur_urng_sync,@command{unur_urng_sync}} @end ifhtml @ifnothtml @command{unur_urng_sync} @end ifnothtml is used to jump to the first coordinate of the next point generated by the generator. @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_urng_gslqrng_new,unur_urng_gslqrng_new} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_urng_gslqrng_new} @deftypefn Function {UNUR_URNG*} unur_urng_gslqrng_new (const @var{gsl_qrng_type* qrngtype}, unsigned @var{int dim}) Make object for quasi-random point generators for dimension @var{dim} from the @file{GSL} (GNU Scientific Library). @var{qrngtype} is the type of the chosen generator as described in the GSL manual (see section Quasi-Random Sequences). This library is available from @uref{http://www.gnu.org/software/gsl/}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_urng_gslqrng_new} @deftypefn {} {UNUR_URNG*} unur_urng_gslqrng_new (const @var{gsl_qrng_type* qrngtype}, unsigned @var{int dim}) Make object for quasi-random point generators for dimension @var{dim} from the @file{GSL} (GNU Scientific Library). @var{qrngtype} is the type of the chosen generator as described in the GSL manual (see section Quasi-Random Sequences). This library is available from @uref{http://www.gnu.org/software/gsl/}. @end deftypefn @end ifnotinfo @c @c end of urng_gslqrng.h @c ------------------------------------- @c ------------------------------------- @c urng_prng.h @c @node URNG-PRNG @section Interface to Otmar Lendl's pseudo-random number generators URNGs from Otmar Lendl's @code{prng} library. It provides a very flexible way to sample form arbitrary URNGs by means of an object oriented programing paradigma. Similarly to the UNU.RAN library independent generator objects can be build and used. This library has been developed by the pLab group at the university of Salzburg (Austria, EU) and implemented by Otmar Lendl. It is available from @uref{http://statmath.wu.ac.at/prng/} or from the pLab site at @uref{http://random.mat.sbg.ac.at/}. The interface to the PRNG library must be compiled into UNU.RAN using the configure flag @code{--with-urng-prng}. Notice that the PRNG library has to be installed before running @code{./configure}. @subsubheading How To Use When using this interface @file{unuran_urng_prng.h} must be included in the corresponding C file, i.e., one must add the line @example #include @end example @noindent Moreover, one must not forget to link the executable against @file{libprng}. The following routines are supported for URNG objects of type PRNG: @itemize @minus @item @ifhtml @ref{funct:unur_urng_sample,@command{unur_urng_sample}} @end ifhtml @ifnothtml @command{unur_urng_sample} @end ifnothtml @item @ifhtml @ref{funct:unur_urng_sample_array,@command{unur_urng_sample_array}} @end ifhtml @ifnothtml @command{unur_urng_sample_array} @end ifnothtml @item @ifhtml @ref{funct:unur_urng_seed,@command{unur_urng_seed}} @end ifhtml @ifnothtml @command{unur_urng_seed} @end ifnothtml (availability depends on chosen PRNG generator!) @item @ifhtml @ref{funct:unur_urng_reset,@command{unur_urng_reset}} @end ifhtml @ifnothtml @command{unur_urng_reset} @end ifnothtml @item @ifhtml @ref{funct:unur_urng_free,@command{unur_urng_free}} @end ifhtml @ifnothtml @command{unur_urng_free} @end ifnothtml @end itemize @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_urng_prng_new,unur_urng_prng_new} @item @ref{funct:unur_urng_prngptr_new,unur_urng_prngptr_new} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_urng_prng_new} @deftypefn Function {UNUR_URNG*} unur_urng_prng_new (const @var{char* prngstr}) Make object for URNGs from Otmar Lendl's @file{prng} package. @var{prngstr} is a string that contains the necessary information to create a uniform random number generator. For the format of this string see the @file{prng} user manual. The @file{prng} library provides a very flexible way to sample form arbitrary URNGs by means of an object oriented programing paradigma. Similarly to the UNU.RAN library independent generator objects can be build and used. The library has been developed and implemented by Otmar Lendl as member of the pLab group at the university of Salzburg (Austria, EU). It is available via anonymous ftp from @uref{http://statmath.wu.ac.at/prng/} or from the pLab site at @uref{http://random.mat.sbg.ac.at/}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_urng_prng_new} @deftypefn {} {UNUR_URNG*} unur_urng_prng_new (const @var{char* prngstr}) Make object for URNGs from Otmar Lendl's @file{prng} package. @var{prngstr} is a string that contains the necessary information to create a uniform random number generator. For the format of this string see the @file{prng} user manual. The @file{prng} library provides a very flexible way to sample form arbitrary URNGs by means of an object oriented programing paradigma. Similarly to the UNU.RAN library independent generator objects can be build and used. The library has been developed and implemented by Otmar Lendl as member of the pLab group at the university of Salzburg (Austria, EU). It is available via anonymous ftp from @uref{http://statmath.wu.ac.at/prng/} or from the pLab site at @uref{http://random.mat.sbg.ac.at/}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_urng_prngptr_new} @deftypefn Function {UNUR_URNG*} unur_urng_prngptr_new (struct @var{prng* urng}) Similar to @ifhtml @ref{funct:unur_urng_prng_new,@command{unur_urng_prng_new}} @end ifhtml @ifnothtml @command{unur_urng_prng_new} @end ifnothtml but it uses a pointer to a generator object as returned by @code{prng_new(prngstr)}; see @file{prng} manual for details. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_urng_prngptr_new} @deftypefn {} {UNUR_URNG*} unur_urng_prngptr_new (struct @var{prng* urng}) Similar to @ifhtml @ref{funct:unur_urng_prng_new,@command{unur_urng_prng_new}} @end ifhtml @ifnothtml @command{unur_urng_prng_new} @end ifnothtml but it uses a pointer to a generator object as returned by @code{prng_new(prngstr)}; see @file{prng} manual for details. @end deftypefn @end ifnotinfo @c @c end of urng_prng.h @c ------------------------------------- @c ------------------------------------- @c urng_rngstreams.h @c @node URNG-RNGSTREAM @section Interface to L'Ecuyer's RNGSTREAM random number generators URNGs from Pierre L'Ecuyer's @file{RngStream} library for multiple independent streams of pseudo-random numbers. This library provides multiple independent streams of pseudo-random numbers which itselves can be splitted into many substreams. It is available from @uref{http://www.iro.umontreal.ca/~lecuyer/myftp/streams00/c/}. A GNU-style package is available from @uref{http://statmath.wu.ac.at/software/RngStreams/}. The interface to the RngStream library must be compiled into UNU.RAN using the configure flag @code{--with-urng-rngstream}. Notice that the RngStream library has to be installed before running @code{./configure}. @subsubheading How To Use When using this interface @file{unuran_urng_rngstream.h} must be included in the corresponding C file, i.e., one must add the line @example #include @end example @noindent Moreover, one must not forget to link the executable against the @file{RngStream} library (i.e., when using the GNU-style package in UNIX like environments one has to add @code{-lrngstreams} when linking an executable). Notice that the @file{rngstream} library uses a package seed, that means one should seed the uniform random number generator only once in an application using the routine @uref{http://statmath.wu.ac.at/software/RngStreams/doc/rngstreams.html#index-RngStream_005fSetPackageSeed-2,,@code{RngStream_SetPackageSeed}}: @example unsigned long seed[] = @{111u, 222u, 333u, 444u, 555u, 666u@}; RngStream_SetPackageSeed(seed); @end example @noindent The following routines are supported for URNG objects of this type: @itemize @minus @item @ifhtml @ref{funct:unur_urng_sample,@command{unur_urng_sample}} @end ifhtml @ifnothtml @command{unur_urng_sample} @end ifnothtml @item @ifhtml @ref{funct:unur_urng_sample_array,@command{unur_urng_sample_array}} @end ifhtml @ifnothtml @command{unur_urng_sample_array} @end ifnothtml @item @ifhtml @ref{funct:unur_urng_reset,@command{unur_urng_reset}} @end ifhtml @ifnothtml @command{unur_urng_reset} @end ifnothtml @item @ifhtml @ref{funct:unur_urng_nextsub,@command{unur_urng_nextsub}} @end ifhtml @ifnothtml @command{unur_urng_nextsub} @end ifnothtml @item @ifhtml @ref{funct:unur_urng_resetsub,@command{unur_urng_resetsub}} @end ifhtml @ifnothtml @command{unur_urng_resetsub} @end ifnothtml @item @ifhtml @ref{funct:unur_urng_anti,@command{unur_urng_anti}} @end ifhtml @ifnothtml @command{unur_urng_anti} @end ifnothtml @item @ifhtml @ref{funct:unur_urng_free,@command{unur_urng_free}} @end ifhtml @ifnothtml @command{unur_urng_free} @end ifnothtml @end itemize @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_urng_rngstream_new,unur_urng_rngstream_new} @item @ref{funct:unur_urng_rngstreamptr_new,unur_urng_rngstreamptr_new} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_urng_rngstream_new} @deftypefn Function {UNUR_URNG*} unur_urng_rngstream_new (const @var{char* urngstr}) Make object for URNGs from Pierre L'Ecuyer's @file{RngStream} library. @var{urngstr} is an arbitrary string to label a stream. It need not be unique. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_urng_rngstream_new} @deftypefn {} {UNUR_URNG*} unur_urng_rngstream_new (const @var{char* urngstr}) Make object for URNGs from Pierre L'Ecuyer's @file{RngStream} library. @var{urngstr} is an arbitrary string to label a stream. It need not be unique. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_urng_rngstreamptr_new} @deftypefn Function {UNUR_URNG*} unur_urng_rngstreamptr_new (RngStream @var{rngstream}) Similar to @ifhtml @ref{funct:unur_urng_rngstream_new,@command{unur_urng_rngstream_new}} @end ifhtml @ifnothtml @command{unur_urng_rngstream_new} @end ifnothtml but it uses a pointer to a generator object as returned by @code{RngStream_CreateStream()}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_urng_rngstreamptr_new} @deftypefn {} {UNUR_URNG*} unur_urng_rngstreamptr_new (RngStream @var{rngstream}) Similar to @ifhtml @ref{funct:unur_urng_rngstream_new,@command{unur_urng_rngstream_new}} @end ifhtml @ifnothtml @command{unur_urng_rngstream_new} @end ifnothtml but it uses a pointer to a generator object as returned by @code{RngStream_CreateStream()}. @end deftypefn @end ifnotinfo @c @c end of urng_rngstreams.h @c ------------------------------------- @c ------------------------------------- @c urng_randomshift.h @c @node URNG-RANDOMSHIFT @section Combine point set generator with random shifts Generators of type RANDOMSHIFT combine a point set generator with generators to apply random shifts as proposed in @ifhtml @ref{bib:CPa76,, [CPa76]} @end ifhtml @ifnothtml [CPa76] @end ifnothtml : @enumerate @item Sample and store a random vector S. @item Run a QMC simulation where S is added to each point of the generated quasi-random point (mod 1). @item Repeat steps 1 and 2. @end enumerate @subsubheading How To Use Create a URNG object for a point set generator and a URNG object for a generator to create shift vectors at random. The meta URNG object can then be created using @ifhtml @ref{funct:unur_urng_randomshift_new,@command{unur_urng_randomshift_new}.} @end ifhtml @ifnothtml @command{unur_urng_randomshift_new}. @end ifnothtml Notice that only pointers to the two underlying URNG generator objects are copied into the newly created meta generator. Thus manipulating the meta URNG also changes the underlying URNGs and vice versa. The following routines are supported for URNG objects of type RANDOMSHIFT: @itemize @minus @item @ifhtml @ref{funct:unur_urng_sample,@command{unur_urng_sample}} @end ifhtml @ifnothtml @command{unur_urng_sample} @end ifnothtml @item @ifhtml @ref{funct:unur_urng_sample_array,@command{unur_urng_sample_array}} @end ifhtml @ifnothtml @command{unur_urng_sample_array} @end ifnothtml @item @ifhtml @ref{funct:unur_urng_reset,@command{unur_urng_reset}} @end ifhtml @ifnothtml @command{unur_urng_reset} @end ifnothtml @item @ifhtml @ref{funct:unur_urng_sync,@command{unur_urng_sync}} @end ifhtml @ifnothtml @command{unur_urng_sync} @end ifnothtml @item @ifhtml @ref{funct:unur_urng_randomshift_nextshift,@command{unur_urng_randomshift_nextshift}} @end ifhtml @ifnothtml @command{unur_urng_randomshift_nextshift} @end ifnothtml @item @ifhtml @ref{funct:unur_urng_free,@command{unur_urng_free}} @end ifhtml @ifnothtml @command{unur_urng_free} @end ifnothtml @end itemize @ifhtml @ref{funct:unur_urng_sync,@command{unur_urng_sync}} @end ifhtml @ifnothtml @command{unur_urng_sync} @end ifnothtml is used to jump to the first coordinate of the next point generated by the generator. @ifhtml @ref{funct:unur_urng_randomshift_nextshift,@command{unur_urng_randomshift_nextshift}} @end ifhtml @ifnothtml @command{unur_urng_randomshift_nextshift} @end ifnothtml allows to replace the shift vector by another randomly chosen shift vector. @emph{Important:} @ifhtml @ref{funct:unur_urng_sync,@command{unur_urng_sync}} @end ifhtml @ifnothtml @command{unur_urng_sync} @end ifnothtml is only available if it is if it is implemented for the underlying point set generator. @emph{Important:} @ifhtml @ref{funct:unur_urng_reset,@command{unur_urng_reset}} @end ifhtml @ifnothtml @command{unur_urng_reset} @end ifnothtml is only available if it is available for both underlying generators. @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_urng_randomshift_new,unur_urng_randomshift_new} @item @ref{funct:unur_urng_randomshift_nextshift,unur_urng_randomshift_nextshift} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_urng_randomshift_new} @deftypefn Function {UNUR_URNG*} unur_urng_randomshift_new (UNUR_URNG* @var{qrng}, UNUR_URNG* @var{srng}, int @var{dim}) Make object for URNG with randomly shifted point sets. @var{qrng} is a generated that generates point sets of dimension @var{dim}. @var{srng} is a generated that generates random numbers or vectors. @emph{Notice:} Only pointers to the respective objects @var{qrng} and @var{srng} are copied into the created meta generator. Thus manipulating the meta URNG also changes the underlying URNGs and vice versa. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_urng_randomshift_new} @deftypefn {} {UNUR_URNG*} unur_urng_randomshift_new (UNUR_URNG* @var{qrng}, UNUR_URNG* @var{srng}, int @var{dim}) Make object for URNG with randomly shifted point sets. @var{qrng} is a generated that generates point sets of dimension @var{dim}. @var{srng} is a generated that generates random numbers or vectors. @emph{Notice:} Only pointers to the respective objects @var{qrng} and @var{srng} are copied into the created meta generator. Thus manipulating the meta URNG also changes the underlying URNGs and vice versa. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_urng_randomshift_nextshift} @deftypefn Function {int} unur_urng_randomshift_nextshift (UNUR_URNG* @var{urng}) Get the next (randomly chosen) vector for shifting the points set, and the underlying point generator @var{qrng} is reset. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_urng_randomshift_nextshift} @deftypefn {} {int} unur_urng_randomshift_nextshift (UNUR_URNG* @var{urng}) Get the next (randomly chosen) vector for shifting the points set, and the underlying point generator @var{qrng} is reset. @end deftypefn @end ifnotinfo @c @c end of urng_randomshift.h @c ------------------------------------- @c ------------------------------------- @c stddist.dh @c @node Stddist @chapter UNU.RAN Library of standard distributions @menu * Stddist_CONT:: UNU.RAN Library of continuous univariate distributions * Stddist_CVEC:: UNU.RAN Library of continuous multivariate distributions * Stddist_DISCR:: UNU.RAN Library of discrete univariate distributions * Stddist_MATR:: UNU.RAN Library of random matrices @end menu Although it is not its primary target, many distributions are already implemented in UNU.RAN. This section presents these available distributions and their parameters. The syntax to get a distribuion object for distributions @code{} is: @deftypefn -- {UNUR_DISTR*} unur_distr_@code{} (double* @var{params}, int @var{n_params}) @var{params} is an array of doubles of size @var{n_params} holding the parameters. @end deftypefn @noindent E.g. to get an object for the gamma distribution (with shape parameter) use @example unur_distr_gamma( params, 1 ); @end example @noindent Distributions may have default parameters with need not be given explicitely. E.g. The gamma distribution has three parameters: the shape, scale and location parameter. Only the (first) shape parameter is required. The others can be omitted and are then set by default values. @example /* alpha = 5; default: beta = 1, gamma = 0 */ double fpar[] = @{5.@}; unur_distr_gamma( fpar, 1 ); /* alpha = 5, beta = 3; default: gamma = 0 */ double fpar[] = @{5., 3.@}; unur_distr_gamma( fpar, 2 ); /* alpha = 5, beta = 3, gamma = -2 double fpar[] = @{5., 3., -2.@}; unur_distr_gamma( fpar, 3 ); @end example @strong{Important:} Naturally the computational accuracy limits the possible parameters. There shouldn't be problems when the parameters of a distribution are in a ``reasonable'' range but e.g. the normal distribution N(10^15,1) won't yield the desired results. (In this case it would be better generating N(0,1) and @emph{then} transform the results.) @* Of course computational inaccuracy is not specific to UNU.RAN and should always be kept in mind when working with computers. @emph{Important:} The routines of the standard library are included for non-uniform random variate generation and not to provide special functions for statistical computations. @subheading Remark The following keywords are used in the tables: @table @i @item PDF probability density function, with variable @i{x}. @item PMF probability mass function, with variable @i{k}. @item constant normalization constant for given PDF and PMF, resp. They must be multiplied by @i{constant} to get the ``real'' PDF and PMF. @item CDF gives information whether the CDF is implemented in UNU.RAN. @item domain domain PDF and PMF, resp. @item parameters @var{n_std} (@var{n_total}): @r{list} list of parameters for distribution, where @var{n_std} is the number of parameters for the standard form of the distribution and @var{n_total} the total number for the (non-standard form of the) distribution. @var{list} is the list of parameters in the order as they are stored in the array of parameters. Optional parameter that can be omitted are enclosed in square brackets @code{[@dots{}]}. A detailed list of these parameters gives then the range of valid parameters and defaults for optional parameters that are used when these are omitted. @item reference gives reference for distribution (@pxref{Bibliography}). @item special generators lists available special generators for the distribution. The first number is the variant that to be set by @ifhtml @ref{funct:unur_cstd_set_variant,@command{unur_cstd_set_variant}} @end ifhtml @ifnothtml @command{unur_cstd_set_variant} @end ifnothtml and @ifhtml @ref{funct:unur_dstd_set_variant,@command{unur_dstd_set_variant}} @end ifhtml @ifnothtml @command{unur_dstd_set_variant} @end ifnothtml call, respectively. If no variant is set the default variant @code{DEF} is used. In the table the respective abbreviations @code{DEF} and @code{INV} are used for @code{UNUR_STDGEN_DEFAULT} and @code{UNUR_STDGEN_INVERSION}. Also the references for these methods are given (@pxref{Bibliography}). Notice that these generators might be slower than universal methods. If @code{DEF} is ommited, the first entry is the default generator. @end table @c @c end of stddist.dh @c ------------------------------------- @c ------------------------------------- @c stddist.dh @c @page @node Stddist_CONT @section UNU.RAN Library of continuous univariate distributions @menu * F:: F-distribution * beta:: Beta distribution * cauchy:: Cauchy distribution * chi:: Chi distribution * chisquare:: Chisquare distribution * exponential:: Exponential distribution * extremeI:: Extreme value type I (Gumbel-type) distribution * extremeII:: Extreme value type II (Frechet-type) distribution * gamma:: Gamma distribution * gig:: Generalized Inverse Gaussian distribution * gig2:: Generalized Inverse Gaussian distribution * hyperbolic:: Hyperbolic distribution * ig:: Inverse Gaussian distribution * laplace:: Laplace distribution * logistic:: Logistic distribution * lognormal:: Log-Normal distribution * lomax:: Lomax distribution (Pareto distribution of second kind) * normal:: Normal distribution * pareto:: Pareto distribution (of first kind) * powerexponential:: Powerexponential (Subbotin) distribution * rayleigh:: Rayleigh distribution * slash:: Slash distribution * student:: Student's t distribution * triangular:: Triangular distribution * uniform:: Uniform distribution * weibull:: Weibull distribution @end menu @c @c end of stddist.dh @c ------------------------------------- @c ------------------------------------- @c unur_distributions.h @c @node F @subsection @code{F} -- F-distribution @anchor{funct:unur_distr_F} @findex unur_distr_F @table @i @item PDF: @iftex @tex $(x^{\nu_1/2-1}) / (1+\nu_1/\nu_2 x)^{(\nu_1+\nu_2)/2}$ @end tex @end iftex @ifnottex (x^(nu_1/2-1)) / (1+nu_1/nu_2 x)^((nu_1+nu_2)/2) @end ifnottex @item constant: @iftex @tex $(\nu_1/\nu_2)^{\nu_1/2} / B(\nu_1/2,\nu_2/2)$ @end tex @end iftex @ifnottex (nu_1/nu_2)^(nu_1/2) / B(nu_1/2,nu_2/2) @end ifnottex @item domain: @iftex @tex $0 < x < \infty$ @end tex @end iftex @ifnottex 0 < x < infinity @end ifnottex @iftex @item parameters 2 (2): @r{ nu_1, nu_2} @multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab@tex$\nu_1 $@end tex @tab@tex$> 0 $@end tex @tab @tab (@i{scale}) @item @code{[1]} @tab@tex$\nu_2 $@end tex @tab@tex$> 0 $@end tex @tab @tab (@i{scale}) @end multitable @end iftex @ifnottex @item parameters 2 (2): nu_1, nu_2 @multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab nu_1 @tab > 0 @tab @tab @i{(scale)} @item @code{[1]} @tab nu_2 @tab > 0 @tab @tab @i{(scale)} @end multitable @end ifnottex @item reference: @ifhtml @ref{bib:JKBc95,, [JKBc95: Ch.27; p.322]} @end ifhtml @ifnothtml [JKBc95: Ch.27; p.322] @end ifnothtml @end table @c @c end of unur_distributions.h @c ------------------------------------- @c ------------------------------------- @c unur_distributions.h @c @node beta @subsection @code{beta} -- Beta distribution @anchor{funct:unur_distr_beta} @findex unur_distr_beta @table @i @item PDF: @iftex @tex $(x-a)^{p-1} \, (b-x)^{q-1}$ @end tex @end iftex @ifnottex (x-a)^(p-1) * (b-x)^(q-1) @end ifnottex @item constant: @iftex @tex $1 / (B(p,q) \, (b-a)^{p+q-1})$ @end tex @end iftex @ifnottex 1 / (B(p,q) * (b-a)^(p+q-1)) @end ifnottex @item domain: @iftex @tex $a < x < b$ @end tex @end iftex @ifnottex a < x < b @end ifnottex @iftex @item parameters 2 (4): @r{ p, q [, a, b ]} @multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab@tex$p $@end tex @tab@tex$> 0 $@end tex @tab @tab (@i{scale}) @item @code{[1]} @tab@tex$q $@end tex @tab@tex$> 0 $@end tex @tab @tab (@i{scale}) @item @code{[2]} @tab@tex$a $@end tex @tab@tex$ $@end tex @tab 0 @tab (@i{location, scale}) @item @code{[3]} @tab@tex$b $@end tex @tab@tex$> a $@end tex @tab 1 @tab (@i{location, scale}) @end multitable @end iftex @ifnottex @item parameters 2 (4): p, q [, a, b ] @multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab p @tab > 0 @tab @tab @i{(scale)} @item @code{[1]} @tab q @tab > 0 @tab @tab @i{(scale)} @item @code{[2]} @tab a @tab @tab 0 @tab @i{(location, scale)} @item @code{[3]} @tab b @tab > a @tab 1 @tab @i{(location, scale)} @end multitable @end ifnottex @item reference: @ifhtml @ref{bib:JKBc95,, [JKBc95: Ch.25; p.210]} @end ifhtml @ifnothtml [JKBc95: Ch.25; p.210] @end ifnothtml @end table @c @c end of unur_distributions.h @c ------------------------------------- @c ------------------------------------- @c unur_distributions.h @c @node cauchy @subsection @code{cauchy} -- Cauchy distribution @anchor{funct:unur_distr_cauchy} @findex unur_distr_cauchy @table @i @item PDF: @iftex @tex $1/(1 + ((x-\theta)/\lambda)^2)$ @end tex @end iftex @ifnottex 1/(1 + ((x-theta)/lambda)^2) @end ifnottex @item constant: @iftex @tex $1/(\pi \, \lambda)$ @end tex @end iftex @ifnottex 1/(pi * lambda) @end ifnottex @item domain: @iftex @tex $-\infty < x < \infty$ @end tex @end iftex @ifnottex -infinity < x < infinity @end ifnottex @iftex @item parameters 0 (2): @r{ [ theta [, lambda ] ]} @multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab@tex$\theta $@end tex @tab@tex$ $@end tex @tab 0 @tab (@i{location}) @item @code{[1]} @tab@tex$\lambda $@end tex @tab@tex$> 0 $@end tex @tab 1 @tab (@i{scale}) @end multitable @end iftex @ifnottex @item parameters 0 (2): [ theta [, lambda ] ] @multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab theta @tab @tab 0 @tab @i{(location)} @item @code{[1]} @tab lambda @tab > 0 @tab 1 @tab @i{(scale)} @end multitable @end ifnottex @item reference: @ifhtml @ref{bib:JKBb94,, [JKBb94: Ch.16; p.299]} @end ifhtml @ifnothtml [JKBb94: Ch.16; p.299] @end ifnothtml @item special generators: @table @code @item INV Inversion method @end table @end table @c @c end of unur_distributions.h @c ------------------------------------- @c ------------------------------------- @c unur_distributions.h @c @node chi @subsection @code{chi} -- Chi distribution @anchor{funct:unur_distr_chi} @findex unur_distr_chi @table @i @item PDF: @iftex @tex $x^{\nu-1} \, \exp( -x^2/2 )$ @end tex @end iftex @ifnottex x^(nu-1) * exp( -x^2/2 ) @end ifnottex @item constant: @iftex @tex $1 / (2^{(\nu/2)-1} \, \Gamma(\nu/2))$ @end tex @end iftex @ifnottex 1 / (2^((nu/2)-1) * Gamma(nu/2)) @end ifnottex @item domain: @iftex @tex $0 \leq x < \infty$ @end tex @end iftex @ifnottex 0 <= x < infinity @end ifnottex @iftex @item parameters 1 (1): @r{ nu} @multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab@tex$\nu $@end tex @tab@tex$> 0 $@end tex @tab @tab (@i{shape}) @end multitable @end iftex @ifnottex @item parameters 1 (1): nu @multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab nu @tab > 0 @tab @tab @i{(shape)} @end multitable @end ifnottex @item reference: @ifhtml @ref{bib:JKBb94,, [JKBb94: Ch.18; p.417]} @end ifhtml @ifnothtml [JKBb94: Ch.18; p.417] @end ifnothtml @item special generators: @table @code @item DEF @iftex Ratio of Uniforms with shift (only for @tex $\nu \geq 1$ @end tex ) [MJa87] @end iftex @ifhtml Ratio of Uniforms with shift (only for nu >= 1) @ref{bib:MJa87, [MJa87]} @end ifhtml @ifinfo Ratio of Uniforms with shift (only for nu >= 1) [MJa87] @end ifinfo @end table @end table @c @c end of unur_distributions.h @c ------------------------------------- @c ------------------------------------- @c unur_distributions.h @c @node chisquare @subsection @code{chisquare} -- Chisquare distribution @anchor{funct:unur_distr_chisquare} @findex unur_distr_chisquare @table @i @item PDF: @iftex @tex $x^{(\nu/2)-1} \, \exp( -x/2 )$ @end tex @end iftex @ifnottex x^((nu/2)-1) * exp( -x/2 ) @end ifnottex @item constant: @iftex @tex $1 / (2^{\nu/2} \, \Gamma(\nu/2))$ @end tex @end iftex @ifnottex 1 / (2^(nu/2) * Gamma(nu/2)) @end ifnottex @item domain: @iftex @tex $0 \leq x < \infty$ @end tex @end iftex @ifnottex 0 <= x < infinity @end ifnottex @iftex @item parameters 1 (1): @r{ nu} @multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab@tex$\nu $@end tex @tab@tex$> 0 $@end tex @tab @tab (@i{shape (degrees of freedom)}) @end multitable @end iftex @ifnottex @item parameters 1 (1): nu @multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab nu @tab > 0 @tab @tab @i{(shape (degrees of freedom))} @end multitable @end ifnottex @item reference: @ifhtml @ref{bib:JKBb94,, [JKBb94: Ch.18; p.416]} @end ifhtml @ifnothtml [JKBb94: Ch.18; p.416] @end ifnothtml @end table @c @c end of unur_distributions.h @c ------------------------------------- @c ------------------------------------- @c unur_distributions.h @c @node exponential @subsection @code{exponential} -- Exponential distribution @anchor{funct:unur_distr_exponential} @findex unur_distr_exponential @table @i @item PDF: @iftex @tex $\exp( -(x-\theta)/\sigma)$ @end tex @end iftex @ifnottex exp( -(x-theta)/sigma) @end ifnottex @item constant: @iftex @tex $1/\sigma$ @end tex @end iftex @ifnottex 1/sigma @end ifnottex @item domain: @iftex @tex $\theta \leq x < \infty$ @end tex @end iftex @ifnottex theta <= x < infinity @end ifnottex @iftex @item parameters 0 (2): @r{ [ sigma [, theta ] ]} @multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab@tex$\sigma $@end tex @tab@tex$> 0 $@end tex @tab 1 @tab (@i{scale}) @item @code{[1]} @tab@tex$\theta $@end tex @tab@tex$ $@end tex @tab 0 @tab (@i{location}) @end multitable @end iftex @ifnottex @item parameters 0 (2): [ sigma [, theta ] ] @multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab sigma @tab > 0 @tab 1 @tab @i{(scale)} @item @code{[1]} @tab theta @tab @tab 0 @tab @i{(location)} @end multitable @end ifnottex @item reference: @ifhtml @ref{bib:JKBb94,, [JKBb94: Ch.19; p.494]} @end ifhtml @ifnothtml [JKBb94: Ch.19; p.494] @end ifnothtml @item special generators: @table @code @item INV Inversion method @end table @end table @c @c end of unur_distributions.h @c ------------------------------------- @c ------------------------------------- @c unur_distributions.h @c @node extremeI @subsection @code{extremeI} -- Extreme value type I (Gumbel-type) distribution @anchor{funct:unur_distr_extremeI} @findex unur_distr_extremeI @table @i @item PDF: @iftex @tex $\exp( -\exp( -{x-\zeta\over \theta} ) - {x-\zeta\over \theta} )$ @end tex @end iftex @ifnottex exp( -exp( -(x-zeta)/theta ) - (x-zeta)/theta ) @end ifnottex @item constant: @iftex @tex $1/\theta$ @end tex @end iftex @ifnottex 1/theta @end ifnottex @item domain: @iftex @tex $-\infty < x <\infty$ @end tex @end iftex @ifnottex -infinity < x 0 $@end tex @tab 1 @tab (@i{scale}) @end multitable @end iftex @ifnottex @item parameters 0 (2): [ zeta [, theta ] ] @multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab zeta @tab @tab 0 @tab @i{(location)} @item @code{[1]} @tab theta @tab > 0 @tab 1 @tab @i{(scale)} @end multitable @end ifnottex @item reference: @ifhtml @ref{bib:JKBc95,, [JKBc95: Ch.22; p.2]} @end ifhtml @ifnothtml [JKBc95: Ch.22; p.2] @end ifnothtml @item special generators: @table @code @item INV Inversion method @end table @end table @c @c end of unur_distributions.h @c ------------------------------------- @c ------------------------------------- @c unur_distributions.h @c @node extremeII @subsection @code{extremeII} -- Extreme value type II (Frechet-type) distribution @anchor{funct:unur_distr_extremeII} @findex unur_distr_extremeII @table @i @item PDF: @iftex @tex $\exp( -({x-\zeta\over \theta})^{-k}) \, ({x-\zeta\over \theta})^{-k-1}$ @end tex @end iftex @ifnottex exp( -((x-zeta)/theta)^(-k)) * ((x-zeta)/theta)^(-k-1) @end ifnottex @item constant: @iftex @tex $k/\theta$ @end tex @end iftex @ifnottex k/theta @end ifnottex @item domain: @iftex @tex $\zeta < x <\infty$ @end tex @end iftex @ifnottex zeta < x 0 $@end tex @tab @tab (@i{shape}) @item @code{[1]} @tab@tex$\zeta $@end tex @tab@tex$ $@end tex @tab 0 @tab (@i{location}) @item @code{[2]} @tab@tex$\theta $@end tex @tab@tex$> 0 $@end tex @tab 1 @tab (@i{scale}) @end multitable @end iftex @ifnottex @item parameters 1 (3): k [, zeta [, theta ] ] @multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab k @tab > 0 @tab @tab @i{(shape)} @item @code{[1]} @tab zeta @tab @tab 0 @tab @i{(location)} @item @code{[2]} @tab theta @tab > 0 @tab 1 @tab @i{(scale)} @end multitable @end ifnottex @item reference: @ifhtml @ref{bib:JKBc95,, [JKBc95: Ch.22; p.2]} @end ifhtml @ifnothtml [JKBc95: Ch.22; p.2] @end ifnothtml @item special generators: @table @code @item INV Inversion method @end table @end table @c @c end of unur_distributions.h @c ------------------------------------- @c ------------------------------------- @c unur_distributions.h @c @node gamma @subsection @code{gamma} -- Gamma distribution @anchor{funct:unur_distr_gamma} @findex unur_distr_gamma @table @i @item PDF: @iftex @tex $({x-\gamma\over \beta})^{\alpha-1} \, \exp( -{x-\gamma\over \beta} )$ @end tex @end iftex @ifnottex ((x-gamma)/beta)^(alpha-1) * exp( -(x-gamma)/beta ) @end ifnottex @item constant: @iftex @tex $1 / (\beta \, \Gamma(\alpha))$ @end tex @end iftex @ifnottex 1 / (beta * Gamma(alpha)) @end ifnottex @item domain: @iftex @tex $\gamma < x < \infty$ @end tex @end iftex @ifnottex gamma < x < infinity @end ifnottex @iftex @item parameters 1 (3): @r{ alpha [, beta [, gamma ] ]} @multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab@tex$\alpha $@end tex @tab@tex$> 0 $@end tex @tab @tab (@i{shape}) @item @code{[1]} @tab@tex$\beta $@end tex @tab@tex$> 0 $@end tex @tab 1 @tab (@i{scale}) @item @code{[2]} @tab@tex$\gamma $@end tex @tab@tex$ $@end tex @tab 0 @tab (@i{location}) @end multitable @end iftex @ifnottex @item parameters 1 (3): alpha [, beta [, gamma ] ] @multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab alpha @tab > 0 @tab @tab @i{(shape)} @item @code{[1]} @tab beta @tab > 0 @tab 1 @tab @i{(scale)} @item @code{[2]} @tab gamma @tab @tab 0 @tab @i{(location)} @end multitable @end ifnottex @item reference: @ifhtml @ref{bib:JKBb94,, [JKBb94: Ch.17; p.337]} @end ifhtml @ifnothtml [JKBb94: Ch.17; p.337] @end ifnothtml @item special generators: @table @code @item DEF @iftex Acceptance Rejection combined with Acceptance Complement [ADa74] [ADa82] @end iftex @ifhtml Acceptance Rejection combined with Acceptance Complement @ref{bib:ADa74, [ADa74]} @ref{bib:ADa82, [ADa82]} @end ifhtml @ifinfo Acceptance Rejection combined with Acceptance Complement [ADa74] [ADa82] @end ifinfo @item 2 @iftex Rejection from \log-\logistic envelopes [CHa77] @end iftex @ifhtml Rejection from log-logistic envelopes @ref{bib:CHa77, [CHa77]} @end ifhtml @ifinfo Rejection from log-logistic envelopes [CHa77] @end ifinfo @end table @end table @c @c end of unur_distributions.h @c ------------------------------------- @c ------------------------------------- @c unur_distributions.h @c @node gig @subsection @code{gig} -- Generalized Inverse Gaussian distribution @anchor{funct:unur_distr_gig} @findex unur_distr_gig @table @i @item PDF: @iftex @tex $x^{\theta-1} \, \exp( -{1\over 2} \, \omega \, ({x\over \eta} + {\eta\over x}))$ @end tex @end iftex @ifnottex x^(theta-1) * exp( -1/2 * omega * (x/eta + eta/x)) @end ifnottex @item constant: @iftex @tex not implemented! @end tex @end iftex @ifnottex not implemented! @end ifnottex @item CDF: @iftex @tex not implemented! @end tex @end iftex @ifnottex not implemented! @end ifnottex @item domain: @iftex @tex $0 < x <\infty$ @end tex @end iftex @ifnottex 0 < x 0 $@end tex @tab @tab (@i{scale}) @item @code{[2]} @tab@tex$\eta $@end tex @tab@tex$> 0 $@end tex @tab 1 @tab (@i{shape}) @end multitable @end iftex @ifnottex @item parameters 2 (3): theta, omega [, eta ] @multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab theta @tab @tab @tab @i{(shape)} @item @code{[1]} @tab omega @tab > 0 @tab @tab @i{(scale)} @item @code{[2]} @tab eta @tab > 0 @tab 1 @tab @i{(shape)} @end multitable @end ifnottex @item reference: @ifhtml @ref{bib:JKBb94,, [JKBb94: Ch.15; p.84]} @end ifhtml @ifnothtml [JKBb94: Ch.15; p.84] @end ifnothtml @item special generators: @table @code @item DEF @iftex Ratio-of-Uniforms method [Dag89] @end iftex @ifhtml Ratio-of-Uniforms method @ref{bib:Dag89, [Dag89]} @end ifhtml @ifinfo Ratio-of-Uniforms method [Dag89] @end ifinfo @end table @end table @c @c end of unur_distributions.h @c ------------------------------------- @c ------------------------------------- @c unur_distributions.h @c @node gig2 @subsection @code{gig2} -- Generalized Inverse Gaussian distribution @anchor{funct:unur_distr_gig2} @findex unur_distr_gig2 @table @i @item PDF: @iftex @tex $x^{\theta-1} \, \exp( -{1\over 2} \, ({\chi\over x} + \psi\, x))$ @end tex @end iftex @ifnottex x^(theta-1) * exp( -1/2 * (chi/x + psi*x)) @end ifnottex @item constant: @iftex @tex not implemented! @end tex @end iftex @ifnottex not implemented! @end ifnottex @item CDF: @iftex @tex not implemented! @end tex @end iftex @ifnottex not implemented! @end ifnottex @item domain: @iftex @tex $0 < x <\infty$ @end tex @end iftex @ifnottex 0 < x 0 $@end tex @tab @tab (@i{shape}) @item @code{[2]} @tab@tex$\chi $@end tex @tab@tex$> 0 $@end tex @tab @tab (@i{shape}) @end multitable @end iftex @ifnottex @item parameters 3 (3): theta, psi, chi @multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab theta @tab @tab @tab @i{(shape)} @item @code{[1]} @tab psi @tab > 0 @tab @tab @i{(shape)} @item @code{[2]} @tab chi @tab > 0 @tab @tab @i{(shape)} @end multitable @end ifnottex @item reference: @ifhtml @ref{bib:JKBb94,, [JKBb94: Ch.15; p.84]} @end ifhtml @ifnothtml [JKBb94: Ch.15; p.84] @end ifnothtml @end table @c @c end of unur_distributions.h @c ------------------------------------- @c ------------------------------------- @c unur_distributions.h @c @node hyperbolic @subsection @code{hyperbolic} -- Hyperbolic distribution @anchor{funct:unur_distr_hyperbolic} @findex unur_distr_hyperbolic @table @i @item PDF: @iftex @tex $\exp( -\alpha \, \sqrt{\delta^2 + (x - \mu)^2} + \beta\, (x-\mu) )$ @end tex @end iftex @ifnottex exp( -alpha * sqrt(delta^2 + (x - mu)^2) + beta*(x-mu) ) @end ifnottex @item constant: @iftex @tex not implemented! @end tex @end iftex @ifnottex not implemented! @end ifnottex @item CDF: @iftex @tex not implemented! @end tex @end iftex @ifnottex not implemented! @end ifnottex @item domain: @iftex @tex $-\infty < x <\infty$ @end tex @end iftex @ifnottex -infinity < x |\beta| $@end tex @tab @tab (@i{shape (tail)}) @item @code{[1]} @tab@tex$\beta $@end tex @tab@tex$ $@end tex @tab @tab (@i{shape (asymmetry)}) @item @code{[2]} @tab@tex$\delta $@end tex @tab@tex$> 0 $@end tex @tab @tab (@i{scale}) @item @code{[3]} @tab@tex$\mu $@end tex @tab@tex$ $@end tex @tab @tab (@i{location}) @end multitable @end iftex @ifnottex @item parameters 4 (4): alpha, beta, delta, mu @multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab alpha @tab >|beta| @tab @tab @i{(shape (tail))} @item @code{[1]} @tab beta @tab @tab @tab @i{(shape (asymmetry))} @item @code{[2]} @tab delta @tab > 0 @tab @tab @i{(scale)} @item @code{[3]} @tab mu @tab @tab @tab @i{(location)} @end multitable @end ifnottex @end table @c @c end of unur_distributions.h @c ------------------------------------- @c ------------------------------------- @c unur_distributions.h @c @node ig @subsection @code{ig} -- Inverse Gaussian distribution @anchor{funct:unur_distr_ig} @findex unur_distr_ig @table @i @item PDF: @iftex @tex $\sqrt{ {\lambda\over 2\, \pi\, x^3} } \, \exp( -{\lambda\, (x-\mu)^2\over 2\, \mu^2\, x} )$ @end tex @end iftex @ifnottex sqrt( lambda/2*pi*x^3 ) * exp( -(lambda*(x-mu)^2)/2*mu^2*x ) @end ifnottex @item constant: @iftex @tex $1$ @end tex @end iftex @ifnottex 1 @end ifnottex @item CDF: @iftex @tex not implemented! @end tex @end iftex @ifnottex not implemented! @end ifnottex @item domain: @iftex @tex $0 < x <\infty$ @end tex @end iftex @ifnottex 0 < x 0 $@end tex @tab @tab (@i{mean}) @item @code{[1]} @tab@tex$\lambda $@end tex @tab@tex$> 0 $@end tex @tab @tab (@i{shape}) @end multitable @end iftex @ifnottex @item parameters 2 (2): mu, lambda @multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab mu @tab > 0 @tab @tab @i{(mean)} @item @code{[1]} @tab lambda @tab > 0 @tab @tab @i{(shape)} @end multitable @end ifnottex @item reference: @ifhtml @ref{bib:JKBb94,, [JKBb94: Ch.15; p.259]} @end ifhtml @ifnothtml [JKBb94: Ch.15; p.259] @end ifnothtml @end table @c @c end of unur_distributions.h @c ------------------------------------- @c ------------------------------------- @c unur_distributions.h @c @node laplace @subsection @code{laplace} -- Laplace distribution @anchor{funct:unur_distr_laplace} @findex unur_distr_laplace @table @i @item PDF: @iftex @tex $\exp( -|x-\theta| / \phi )$ @end tex @end iftex @ifnottex exp( -|x-theta| / phi ) @end ifnottex @item constant: @iftex @tex $1/(2 \, \phi)$ @end tex @end iftex @ifnottex 1/(2 * phi) @end ifnottex @item domain: @iftex @tex $-\infty < x <\infty$ @end tex @end iftex @ifnottex -infinity < x 0 $@end tex @tab 1 @tab (@i{scale}) @end multitable @end iftex @ifnottex @item parameters 0 (2): [ theta [, phi ] ] @multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab theta @tab @tab 0 @tab @i{(location)} @item @code{[1]} @tab phi @tab > 0 @tab 1 @tab @i{(scale)} @end multitable @end ifnottex @item reference: @ifhtml @ref{bib:JKBc95,, [JKBc95: Ch.24; p.164]} @end ifhtml @ifnothtml [JKBc95: Ch.24; p.164] @end ifnothtml @item special generators: @table @code @item INV Inversion method @end table @end table @c @c end of unur_distributions.h @c ------------------------------------- @c ------------------------------------- @c unur_distributions.h @c @node logistic @subsection @code{logistic} -- Logistic distribution @anchor{funct:unur_distr_logistic} @findex unur_distr_logistic @table @i @item PDF: @iftex @tex $\exp(-{x-\alpha\over \beta}) \, (1 + \exp(-{x-\alpha\over \beta}))^{-2}$ @end tex @end iftex @ifnottex exp(-(x-alpha)/beta) * (1 + exp(-(x-alpha)/beta))^(-2) @end ifnottex @item constant: @iftex @tex $1/\beta$ @end tex @end iftex @ifnottex 1/beta @end ifnottex @item domain: @iftex @tex $-\infty < x <\infty$ @end tex @end iftex @ifnottex -infinity < x 0 $@end tex @tab 1 @tab (@i{scale}) @end multitable @end iftex @ifnottex @item parameters 0 (2): [ alpha [, beta ] ] @multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab alpha @tab @tab 0 @tab @i{(location)} @item @code{[1]} @tab beta @tab > 0 @tab 1 @tab @i{(scale)} @end multitable @end ifnottex @item reference: @ifhtml @ref{bib:JKBc95,, [JKBc95: Ch.23; p.115]} @end ifhtml @ifnothtml [JKBc95: Ch.23; p.115] @end ifnothtml @item special generators: @table @code @item INV Inversion method @end table @end table @c @c end of unur_distributions.h @c ------------------------------------- @c ------------------------------------- @c unur_distributions.h @c @node lognormal @subsection @code{lognormal} -- Log-Normal distribution @anchor{funct:unur_distr_lognormal} @findex unur_distr_lognormal @table @i @item PDF: @iftex @tex $1/(x-\theta) \, \exp( -(\log(x-\theta)-\zeta)^2/(2 \sigma^2) )$ @end tex @end iftex @ifnottex 1/(x-theta) * exp( -(log(x-theta)-zeta)^2/(2 sigma^2) ) @end ifnottex @item constant: @iftex @tex $1/(\sigma \, \sqrt{2 \pi})$ @end tex @end iftex @ifnottex 1/(sigma * sqrt(2 pi)) @end ifnottex @item domain: @iftex @tex $\theta \leq x < \infty$ @end tex @end iftex @ifnottex theta <= x < infinity @end ifnottex @iftex @item parameters 2 (3): @r{ zeta, sigma [, theta ]} @multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab@tex$\zeta $@end tex @tab@tex$ $@end tex @tab @tab (@i{shape}) @item @code{[1]} @tab@tex$\sigma $@end tex @tab@tex$> 0 $@end tex @tab @tab (@i{shape}) @item @code{[2]} @tab@tex$\theta $@end tex @tab@tex$ $@end tex @tab 0 @tab (@i{location}) @end multitable @end iftex @ifnottex @item parameters 2 (3): zeta, sigma [, theta ] @multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab zeta @tab @tab @tab @i{(shape)} @item @code{[1]} @tab sigma @tab > 0 @tab @tab @i{(shape)} @item @code{[2]} @tab theta @tab @tab 0 @tab @i{(location)} @end multitable @end ifnottex @item reference: @ifhtml @ref{bib:JKBb94,, [JKBb94: Ch.14; p. 208]} @end ifhtml @ifnothtml [JKBb94: Ch.14; p. 208] @end ifnothtml @end table @c @c end of unur_distributions.h @c ------------------------------------- @c ------------------------------------- @c unur_distributions.h @c @node lomax @subsection @code{lomax} -- Lomax distribution (Pareto distribution of second kind) @anchor{funct:unur_distr_lomax} @findex unur_distr_lomax @table @i @item PDF: @iftex @tex $(x+C)^{-(a+1)}$ @end tex @end iftex @ifnottex (x+C)^(-(a+1)) @end ifnottex @item constant: @iftex @tex $a \, C^a$ @end tex @end iftex @ifnottex a * C^a @end ifnottex @item domain: @iftex @tex $0 \leq x < \infty$ @end tex @end iftex @ifnottex 0 <= x < infinity @end ifnottex @iftex @item parameters 1 (2): @r{ a [, C ]} @multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab@tex$a $@end tex @tab@tex$> 0 $@end tex @tab @tab (@i{shape}) @item @code{[1]} @tab@tex$C $@end tex @tab@tex$> 0 $@end tex @tab 1 @tab (@i{scale}) @end multitable @end iftex @ifnottex @item parameters 1 (2): a [, C ] @multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab a @tab > 0 @tab @tab @i{(shape)} @item @code{[1]} @tab C @tab > 0 @tab 1 @tab @i{(scale)} @end multitable @end ifnottex @item reference: @ifhtml @ref{bib:JKBb94,, [JKBb94: Ch.20; p.575]} @end ifhtml @ifnothtml [JKBb94: Ch.20; p.575] @end ifnothtml @item special generators: @table @code @item INV Inversion method @end table @end table @c @c end of unur_distributions.h @c ------------------------------------- @c ------------------------------------- @c unur_distributions.h @c @node normal @subsection @code{normal} -- Normal distribution @anchor{funct:unur_distr_normal} @findex unur_distr_normal @table @i @item PDF: @iftex @tex $\exp( -{1\over 2} \, ({x-\mu\over \sigma})^2 )$ @end tex @end iftex @ifnottex exp( -1/2 * ((x-mu)/sigma)^2 ) @end ifnottex @item constant: @iftex @tex $1 / (\sigma \, \sqrt{2 \pi})$ @end tex @end iftex @ifnottex 1 / (sigma * sqrt(2 pi)) @end ifnottex @item domain: @iftex @tex $-\infty < x < \infty$ @end tex @end iftex @ifnottex -infinity < x < infinity @end ifnottex @iftex @item parameters 0 (2): @r{ [ mu [, sigma ] ]} @multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab@tex$\mu $@end tex @tab@tex$ $@end tex @tab 0 @tab (@i{location}) @item @code{[1]} @tab@tex$\sigma $@end tex @tab@tex$> 0 $@end tex @tab 1 @tab (@i{scale}) @end multitable @end iftex @ifnottex @item parameters 0 (2): [ mu [, sigma ] ] @multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab mu @tab @tab 0 @tab @i{(location)} @item @code{[1]} @tab sigma @tab > 0 @tab 1 @tab @i{(scale)} @end multitable @end ifnottex @item reference: @ifhtml @ref{bib:JKBb94,, [JKBb94: Ch.13; p.80]} @end ifhtml @ifnothtml [JKBb94: Ch.13; p.80] @end ifnothtml @item special generators: @table @code @item DEF @iftex ACR method (Acceptance-Complement Ratio) [HDa90] @end iftex @ifhtml ACR method (Acceptance-Complement Ratio) @ref{bib:HDa90, [HDa90]} @end ifhtml @ifinfo ACR method (Acceptance-Complement Ratio) [HDa90] @end ifinfo @item 1 @iftex Box-Muller method [BMa58] @end iftex @ifhtml Box-Muller method @ref{bib:BMa58, [BMa58]} @end ifhtml @ifinfo Box-Muller method [BMa58] @end ifinfo @item 2 @iftex Polar method with rejection [MGa62] @end iftex @ifhtml Polar method with rejection @ref{bib:MGa62, [MGa62]} @end ifhtml @ifinfo Polar method with rejection [MGa62] @end ifinfo @item 3 @iftex Kindermann-Ramage method [KRa76] @end iftex @ifhtml Kindermann-Ramage method @ref{bib:KRa76, [KRa76]} @end ifhtml @ifinfo Kindermann-Ramage method [KRa76] @end ifinfo @item INV Inversion method (slow) @end table @end table @c @c end of unur_distributions.h @c ------------------------------------- @c ------------------------------------- @c unur_distributions.h @c @node pareto @subsection @code{pareto} -- Pareto distribution (of first kind) @anchor{funct:unur_distr_pareto} @findex unur_distr_pareto @table @i @item PDF: @iftex @tex $x^{-(a+1)}$ @end tex @end iftex @ifnottex x^(-(a+1)) @end ifnottex @item constant: @iftex @tex $a \, k^a$ @end tex @end iftex @ifnottex a * k^a @end ifnottex @item domain: @iftex @tex $k < x < \infty$ @end tex @end iftex @ifnottex k < x < infinity @end ifnottex @iftex @item parameters 2 (2): @r{ k, a} @multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab@tex$k $@end tex @tab@tex$> 0 $@end tex @tab @tab (@i{shape, location}) @item @code{[1]} @tab@tex$a $@end tex @tab@tex$> 0 $@end tex @tab @tab (@i{shape}) @end multitable @end iftex @ifnottex @item parameters 2 (2): k, a @multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab k @tab > 0 @tab @tab @i{(shape, location)} @item @code{[1]} @tab a @tab > 0 @tab @tab @i{(shape)} @end multitable @end ifnottex @item reference: @ifhtml @ref{bib:JKBb94,, [JKBb94: Ch.20; p.574]} @end ifhtml @ifnothtml [JKBb94: Ch.20; p.574] @end ifnothtml @item special generators: @table @code @item INV Inversion method @end table @end table @c @c end of unur_distributions.h @c ------------------------------------- @c ------------------------------------- @c unur_distributions.h @c @node powerexponential @subsection @code{powerexponential} -- Powerexponential (Subbotin) distribution @anchor{funct:unur_distr_powerexponential} @findex unur_distr_powerexponential @table @i @item PDF: @iftex @tex $\exp( -|x|^\tau )$ @end tex @end iftex @ifnottex exp( -|x|^tau ) @end ifnottex @item constant: @iftex @tex $1 / (2 \, \Gamma(1+1/\tau))$ @end tex @end iftex @ifnottex 1 / (2 * Gamma(1+1/tau)) @end ifnottex @item domain: @iftex @tex $-\infty < x < \infty$ @end tex @end iftex @ifnottex -infinity < x < infinity @end ifnottex @iftex @item parameters 1 (1): @r{ tau} @multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab@tex$\tau $@end tex @tab@tex$> 0 $@end tex @tab @tab (@i{shape}) @end multitable @end iftex @ifnottex @item parameters 1 (1): tau @multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab tau @tab > 0 @tab @tab @i{(shape)} @end multitable @end ifnottex @item reference: @ifhtml @ref{bib:JKBc95,, [JKBc95: Ch.24; p.195]} @end ifhtml @ifnothtml [JKBc95: Ch.24; p.195] @end ifnothtml @item special generators: @table @code @item DEF @iftex Transformed density rejection (only for @tex $\tau \geq 1$ @end tex ) [DLa86] @end iftex @ifhtml Transformed density rejection (only for tau >= 1) @ref{bib:DLa86, [DLa86]} @end ifhtml @ifinfo Transformed density rejection (only for tau >= 1) [DLa86] @end ifinfo @end table @end table @c @c end of unur_distributions.h @c ------------------------------------- @c ------------------------------------- @c unur_distributions.h @c @node rayleigh @subsection @code{rayleigh} -- Rayleigh distribution @anchor{funct:unur_distr_rayleigh} @findex unur_distr_rayleigh @table @i @item PDF: @iftex @tex $x \, \exp( -1/2 \, ({x\over \sigma})^2 )$ @end tex @end iftex @ifnottex x * exp( -1/2 * (x/sigma)^2 ) @end ifnottex @item constant: @iftex @tex $1 / \sigma^2$ @end tex @end iftex @ifnottex 1 / sigma^2 @end ifnottex @item domain: @iftex @tex $0 \leq x < \infty$ @end tex @end iftex @ifnottex 0 <= x < infinity @end ifnottex @iftex @item parameters 1 (1): @r{ sigma} @multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab@tex$\sigma $@end tex @tab@tex$> 0 $@end tex @tab @tab (@i{scale}) @end multitable @end iftex @ifnottex @item parameters 1 (1): sigma @multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab sigma @tab > 0 @tab @tab @i{(scale)} @end multitable @end ifnottex @item reference: @ifhtml @ref{bib:JKBb94,, [JKBb94: Ch.18; p.456]} @end ifhtml @ifnothtml [JKBb94: Ch.18; p.456] @end ifnothtml @end table @c @c end of unur_distributions.h @c ------------------------------------- @c ------------------------------------- @c unur_distributions.h @c @node slash @subsection @code{slash} -- Slash distribution @anchor{funct:unur_distr_slash} @findex unur_distr_slash @table @i @item PDF: @iftex @tex $(1 - \exp(-x^2/2)) / x^2$ @end tex @end iftex @ifnottex (1 - exp(-x^2/2)) / x^2 @end ifnottex @item constant: @iftex @tex $1 / \sqrt{2 \pi}$ @end tex @end iftex @ifnottex 1 / sqrt(2 pi) @end ifnottex @item CDF: @iftex @tex not implemented! @end tex @end iftex @ifnottex not implemented! @end ifnottex @item domain: @iftex @tex $-\infty < x < \infty$ @end tex @end iftex @ifnottex -infinity < x < infinity @end ifnottex @item reference: @ifhtml @ref{bib:JKBb94,, [JKBb94: Ch.12; p.63]} @end ifhtml @ifnothtml [JKBb94: Ch.12; p.63] @end ifnothtml @item special generators: @table @code @item DEF Ratio of normal and uniform random variates @end table @end table @c @c end of unur_distributions.h @c ------------------------------------- @c ------------------------------------- @c unur_distributions.h @c @node student @subsection @code{student} -- Student's t distribution @anchor{funct:unur_distr_student} @findex unur_distr_student @table @i @item PDF: @iftex @tex $(1+{t^2\over \nu})^{-(\nu+1)/2}$ @end tex @end iftex @ifnottex (1+t^2/nu)^(-(nu+1)/2) @end ifnottex @item constant: @iftex @tex $1 / (\sqrt{\nu} \, B(1/2,\nu/2))$ @end tex @end iftex @ifnottex 1 / (sqrt(nu) * B(1/2,nu/2)) @end ifnottex @item CDF: @iftex @tex not implemented! @end tex @end iftex @ifnottex not implemented! @end ifnottex @item domain: @iftex @tex $-\infty < x < \infty$ @end tex @end iftex @ifnottex -infinity < x < infinity @end ifnottex @iftex @item parameters 1 (1): @r{ nu} @multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab@tex$\nu $@end tex @tab@tex$> 0 $@end tex @tab @tab (@i{shape}) @end multitable @end iftex @ifnottex @item parameters 1 (1): nu @multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab nu @tab > 0 @tab @tab @i{(shape)} @end multitable @end ifnottex @item reference: @ifhtml @ref{bib:JKBc95,, [JKBc95: Ch.28; p.362]} @end ifhtml @ifnothtml [JKBc95: Ch.28; p.362] @end ifnothtml @end table @c @c end of unur_distributions.h @c ------------------------------------- @c ------------------------------------- @c unur_distributions.h @c @node triangular @subsection @code{triangular} -- Triangular distribution @anchor{funct:unur_distr_triangular} @findex unur_distr_triangular @table @i @item PDF: @iftex @tex $2\, x / H, \hbox{ for } 0 \leq x \leq H \hfill\break 2\, (1-x) / (1-H), \hbox{ for } H \leq x \leq 1$ @end tex @end iftex @ifnottex 2*x / H, for 0 <= x <= H 2*(1-x) / (1-H), for H <= x <= 1 @end ifnottex @item constant: @iftex @tex $1$ @end tex @end iftex @ifnottex 1 @end ifnottex @item domain: @iftex @tex $0 \leq x \leq 1$ @end tex @end iftex @ifnottex 0 <= x <= 1 @end ifnottex @iftex @item parameters 0 (1): @r{ [ H ]} @multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab@tex$H $@end tex @tab@tex$0 \leq H \leq 1 $@end tex @tab 1/2 @tab (@i{shape}) @end multitable @end iftex @ifnottex @item parameters 0 (1): [ H ] @multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab H @tab 0 <= H <= 1 @tab 1/2 @tab @i{(shape)} @end multitable @end ifnottex @item reference: @ifhtml @ref{bib:JKBc95,, [JKBc95: Ch.26; p.297]} @end ifhtml @ifnothtml [JKBc95: Ch.26; p.297] @end ifnothtml @item special generators: @table @code @item INV Inversion method @end table @end table @c @c end of unur_distributions.h @c ------------------------------------- @c ------------------------------------- @c unur_distributions.h @c @node uniform @subsection @code{uniform} -- Uniform distribution @anchor{funct:unur_distr_uniform} @findex unur_distr_uniform @table @i @item PDF: @iftex @tex $1 / (b-a)$ @end tex @end iftex @ifnottex 1 / (b-a) @end ifnottex @item constant: @iftex @tex $1$ @end tex @end iftex @ifnottex 1 @end ifnottex @item domain: @iftex @tex $a < x < b$ @end tex @end iftex @ifnottex a < x < b @end ifnottex @iftex @item parameters 0 (2): @r{ [ a, b ]} @multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab@tex$a $@end tex @tab@tex$ $@end tex @tab 0 @tab (@i{location}) @item @code{[1]} @tab@tex$b $@end tex @tab@tex$> a $@end tex @tab 1 @tab (@i{location}) @end multitable @end iftex @ifnottex @item parameters 0 (2): [ a, b ] @multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab a @tab @tab 0 @tab @i{(location)} @item @code{[1]} @tab b @tab > a @tab 1 @tab @i{(location)} @end multitable @end ifnottex @item reference: @ifhtml @ref{bib:JKBc95,, [JKBc95: Ch.26; p.276]} @end ifhtml @ifnothtml [JKBc95: Ch.26; p.276] @end ifnothtml @item special generators: @table @code @item INV Inversion method @end table @end table @c @c end of unur_distributions.h @c ------------------------------------- @c ------------------------------------- @c unur_distributions.h @c @node weibull @subsection @code{weibull} -- Weibull distribution @anchor{funct:unur_distr_weibull} @findex unur_distr_weibull @table @i @item PDF: @iftex @tex $({x-\zeta\over \alpha})^{c-1} \, \exp( -({x-\zeta\over \alpha})^c )$ @end tex @end iftex @ifnottex ((x-zeta)/alpha)^(c-1) * exp( -((x-zeta)/alpha)^c ) @end ifnottex @item constant: @iftex @tex $c / \alpha$ @end tex @end iftex @ifnottex c / alpha @end ifnottex @item domain: @iftex @tex $\zeta < x < \infty$ @end tex @end iftex @ifnottex zeta < x < infinity @end ifnottex @iftex @item parameters 1 (3): @r{ c [, alpha [, zeta ] ]} @multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab@tex$c $@end tex @tab@tex$> 0 $@end tex @tab @tab (@i{shape}) @item @code{[1]} @tab@tex$\alpha $@end tex @tab@tex$> 0 $@end tex @tab 1 @tab (@i{scale}) @item @code{[2]} @tab@tex$\zeta $@end tex @tab@tex$ $@end tex @tab 0 @tab (@i{location}) @end multitable @end iftex @ifnottex @item parameters 1 (3): c [, alpha [, zeta ] ] @multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab c @tab > 0 @tab @tab @i{(shape)} @item @code{[1]} @tab alpha @tab > 0 @tab 1 @tab @i{(scale)} @item @code{[2]} @tab zeta @tab @tab 0 @tab @i{(location)} @end multitable @end ifnottex @item reference: @ifhtml @ref{bib:JKBb94,, [JKBb94: Ch.21; p.628]} @end ifhtml @ifnothtml [JKBb94: Ch.21; p.628] @end ifnothtml @item special generators: @table @code @item INV Inversion method @end table @end table @c @c end of unur_distributions.h @c ------------------------------------- @c ------------------------------------- @c stddist.dh @c @page @node Stddist_CVEC @section UNU.RAN Library of continuous multivariate distributions @menu * copula:: Copula (distribution with uniform marginals) * multicauchy:: Multicauchy distribution * multiexponential:: Multiexponential distribution * multinormal:: Multinormal distribution * multistudent:: Multistudent distribution @end menu @c @c end of stddist.dh @c ------------------------------------- @c ------------------------------------- @c unur_distributions.h @c @node copula @subsection @code{copula} -- Copula (distribution with uniform marginals) @anchor{funct:unur_distr_copula} @findex unur_distr_copula @table @i @end table @code{UNUR_DISTR *unur_distr_copula(int dim, const double *rankcorr)} creates a distribution object for a copula with @var{dim} components. @var{rankcorr} is an array of size @var{dim}x@var{dim} and holds the rank correlation matrix (Spearman's correlation), where the rows of the matrix are stored consecutively in this array. The @code{NULL} pointer can be used instead the identity matrix. If @var{covar} is not a valid rank correlation matrix (i.e., not positive definite) then no distribution object is created and @code{NULL} is returned. @c @c end of unur_distributions.h @c ------------------------------------- @c ------------------------------------- @c unur_distributions.h @c @node multicauchy @subsection @code{multicauchy} -- Multicauchy distribution @anchor{funct:unur_distr_multicauchy} @findex unur_distr_multicauchy @table @i @item PDF: @iftex @tex $f(x) = 1 / ( 1 + (x-\mu)^t . \Sigma^{-1} . (x-\mu) )^{(dim+1)/2}$ @end tex @end iftex @ifnottex f(x) = 1 / ( 1 + (x-mu)^t . Sigma^(-1) . (x-mu) )^((dim+1)/2) @end ifnottex @item constant: @iftex @tex $\Gamma((dim+1)/2) / ( \pi^{(dim+1)/2} \, \sqrt{\det(\Sigma)} )$ @end tex @end iftex @ifnottex Gamma((dim+1)/2) / ( pi^((dim+1)/2) * sqrt(det(Sigma)) ) @end ifnottex @item domain: @iftex @tex $-\infty^{dim} < x < \infty^{dim}$ @end tex @end iftex @ifnottex -infinity^(dim) < x < infinity^(dim) @end ifnottex @iftex @item parameters 0 (2): @r{ [ mu, Sigma ]} @multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab@tex$\mu $@end tex @tab@tex$ $@end tex @tab (0,@dots{},0) @tab (@i{location}) @item @code{[1]} @tab@tex$\Sigma $@end tex @tab@tex$Symm, Pos. def. $@end tex @tab I @tab (@i{shape}) @end multitable @end iftex @ifnottex @item parameters 0 (2): [ mu, Sigma ] @multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab mu @tab @tab (0,@dots{},0) @tab @i{(location)} @item @code{[1]} @tab Sigma @tab Symm, Pos. def. @tab I @tab @i{(shape)} @end multitable @end ifnottex @item special generators: @table @code @item DEF Cholesky factor @end table @end table @c @c end of unur_distributions.h @c ------------------------------------- @c ------------------------------------- @c unur_distributions.h @c @node multiexponential @subsection @code{multiexponential} -- Multiexponential distribution @anchor{funct:unur_distr_multiexponential} @findex unur_distr_multiexponential @table @i @item PDF: @iftex @tex $f(x) = Prod_{i=0}^{i=dim-1} \exp(-(dim-i) (x_{i}-x_{i-1} - (\theta_i-\theta_{i-1}) ) / \sigma_i); with x_{-1}=0 and \theta_{i-1}=0$ @end tex @end iftex @ifnottex f(x) = Prod_(i=0)^(i=dim-1) exp(-(dim-i) (x_(i)-x_(i-1) - (theta_i-theta_(i-1)) ) / sigma_i); with x_(-1)=0 and theta_(i-1)=0 @end ifnottex @item constant: @iftex @tex $Prod_{i=0}^{i=dim-1} 1/\sigma_i$ @end tex @end iftex @ifnottex Prod_(i=0)^(i=dim-1) 1/sigma_i @end ifnottex @item domain: @iftex @tex $0^{dim} \leq x < \infty^{dim}$ @end tex @end iftex @ifnottex 0^(dim) <= x < infinity^(dim) @end ifnottex @iftex @item parameters 0 (2): @r{ [ sigma, theta ]} @multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab@tex$\sigma $@end tex @tab@tex$ $@end tex @tab (1,@dots{},1) @tab (@i{shape}) @item @code{[1]} @tab@tex$\theta $@end tex @tab@tex$ $@end tex @tab (0,@dots{},0) @tab (@i{location}) @end multitable @end iftex @ifnottex @item parameters 0 (2): [ sigma, theta ] @multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab sigma @tab @tab (1,@dots{},1) @tab @i{(shape)} @item @code{[1]} @tab theta @tab @tab (0,@dots{},0) @tab @i{(location)} @end multitable @end ifnottex @end table @c @c end of unur_distributions.h @c ------------------------------------- @c ------------------------------------- @c unur_distributions.h @c @node multinormal @subsection @code{multinormal} -- Multinormal distribution @anchor{funct:unur_distr_multinormal} @findex unur_distr_multinormal @table @i @item PDF: @iftex @tex $f(x) = \exp( -1/2 \, (x-\mu)^t . \Sigma^{-1} . (x-\mu) )$ @end tex @end iftex @ifnottex f(x) = exp( -1/2 * (x-mu)^t . Sigma^(-1) . (x-mu) ) @end ifnottex @item constant: @iftex @tex $1 / ( (2 \pi)^{dim/2} \, \sqrt{\det(\Sigma)} )$ @end tex @end iftex @ifnottex 1 / ( (2 pi)^(dim/2) * sqrt(det(Sigma)) ) @end ifnottex @item domain: @iftex @tex $-\infty^{dim} < x < \infty^{dim}$ @end tex @end iftex @ifnottex -infinity^(dim) < x < infinity^(dim) @end ifnottex @iftex @item parameters 0 (2): @r{ [ mu, Sigma ]} @multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab@tex$\mu $@end tex @tab@tex$ $@end tex @tab (0,@dots{},0) @tab (@i{location}) @item @code{[1]} @tab@tex$\Sigma $@end tex @tab@tex$Symm, Pos. def. $@end tex @tab I @tab (@i{shape}) @end multitable @end iftex @ifnottex @item parameters 0 (2): [ mu, Sigma ] @multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab mu @tab @tab (0,@dots{},0) @tab @i{(location)} @item @code{[1]} @tab Sigma @tab Symm, Pos. def. @tab I @tab @i{(shape)} @end multitable @end ifnottex @item reference: @ifhtml @ref{bib:KBJe00,, [KBJe00: Ch.45; p.105]} @end ifhtml @ifnothtml [KBJe00: Ch.45; p.105] @end ifnothtml @end table @c @c end of unur_distributions.h @c ------------------------------------- @c ------------------------------------- @c unur_distributions.h @c @node multistudent @subsection @code{multistudent} -- Multistudent distribution @anchor{funct:unur_distr_multistudent} @findex unur_distr_multistudent @table @i @item PDF: @iftex @tex $f(x) = 1 / ( 1 + (x-\mu)^t . \Sigma^{-1} . (x-\mu) / m)^{(dim+m)/2} )$ @end tex @end iftex @ifnottex f(x) = 1 / ( 1 + (x-mu)^t . Sigma^(-1) . (x-mu) / m)^((dim+m)/2) ) @end ifnottex @item constant: @iftex @tex $\Gamma((dim+m)/2) / ( \Gamma(m/2) (m\, \pi)^{dim/2} \, \sqrt{\det(\Sigma)} )$ @end tex @end iftex @ifnottex Gamma((dim+m)/2) / ( Gamma(m/2) (m*pi)^(dim/2) * sqrt(det(Sigma)) ) @end ifnottex @item domain: @iftex @tex $-\infty^{dim} < x < \infty^{dim}$ @end tex @end iftex @ifnottex -infinity^(dim) < x < infinity^(dim) @end ifnottex @iftex @item parameters 0 (3): @r{ [ m, mu, Sigma ]} @multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab@tex$m $@end tex @tab@tex$m>0 $@end tex @tab 1 @tab (@i{location}) @item @code{[1]} @tab@tex$\mu $@end tex @tab@tex$ $@end tex @tab (0,@dots{},0) @tab (@i{location}) @item @code{[2]} @tab@tex$\Sigma $@end tex @tab@tex$Symm, Pos. def. $@end tex @tab I @tab (@i{shape}) @end multitable @end iftex @ifnottex @item parameters 0 (3): [ m, mu, Sigma ] @multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab m @tab m>0 @tab 1 @tab @i{(location)} @item @code{[1]} @tab mu @tab @tab (0,@dots{},0) @tab @i{(location)} @item @code{[2]} @tab Sigma @tab Symm, Pos. def. @tab I @tab @i{(shape)} @end multitable @end ifnottex @end table @c @c end of unur_distributions.h @c ------------------------------------- @c ------------------------------------- @c stddist.dh @c @page @node Stddist_DISCR @section UNU.RAN Library of discrete univariate distributions @menu * binomial:: Binomial distribution * geometric:: Geometric distribution * hypergeometric:: Hypergeometric distribution * logarithmic:: Logarithmic distribution * negativebinomial:: Negative Binomial distribution * poisson:: Poisson distribution @end menu At the moment there are no CDFs implemented for discrete distribution. Thus @ifhtml @ref{funct:unur_distr_discr_upd_pmfsum,@command{unur_distr_discr_upd_pmfsum}} @end ifhtml @ifnothtml @command{unur_distr_discr_upd_pmfsum} @end ifnothtml does not work properly for truncated distribution. @c @c end of stddist.dh @c ------------------------------------- @c ------------------------------------- @c unur_distributions.h @c @node binomial @subsection @code{binomial} -- Binomial distribution @anchor{funct:unur_distr_binomial} @findex unur_distr_binomial @table @i @item PMF: @iftex @tex ${n \choose k} \, p^k \, (1-p)^{n-k}$ @end tex @end iftex @ifnottex (n \choose k) * p^k * (1-p)^(n-k) @end ifnottex @item constant: @iftex @tex $1$ @end tex @end iftex @ifnottex 1 @end ifnottex @item domain: @iftex @tex $0 \leq k \leq n$ @end tex @end iftex @ifnottex 0 <= k <= n @end ifnottex @iftex @item parameters 2 (2): @r{ n, p} @multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab@tex$n $@end tex @tab@tex$\geq 1 $@end tex @tab @tab (@i{no. of elements}) @item @code{[1]} @tab@tex$p $@end tex @tab@tex$0 < p < 1 $@end tex @tab @tab (@i{shape}) @end multitable @end iftex @ifnottex @item parameters 2 (2): n, p @multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab n @tab >= 1 @tab @tab @i{(no. of elements)} @item @code{[1]} @tab p @tab 0 < p < 1 @tab @tab @i{(shape)} @end multitable @end ifnottex @item reference: @ifhtml @ref{bib:JKKa92,, [JKKa92: Ch.3; p.105]} @end ifhtml @ifnothtml [JKKa92: Ch.3; p.105] @end ifnothtml @item special generators: @table @code @item DEF @iftex Ratio of Uniforms/Inversion [STa89] @end iftex @ifhtml Ratio of Uniforms/Inversion @ref{bib:STa89, [STa89]} @end ifhtml @ifinfo Ratio of Uniforms/Inversion [STa89] @end ifinfo @end table @end table @c @c end of unur_distributions.h @c ------------------------------------- @c ------------------------------------- @c unur_distributions.h @c @node geometric @subsection @code{geometric} -- Geometric distribution @anchor{funct:unur_distr_geometric} @findex unur_distr_geometric @table @i @item PMF: @iftex @tex $p \, (1-p)^k$ @end tex @end iftex @ifnottex p * (1-p)^k @end ifnottex @item constant: @iftex @tex $1$ @end tex @end iftex @ifnottex 1 @end ifnottex @item domain: @iftex @tex $0 \leq k < \infty$ @end tex @end iftex @ifnottex 0 <= k < infinity @end ifnottex @iftex @item parameters 1 (1): @r{ p} @multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab@tex$p $@end tex @tab@tex$0 < p < 1 $@end tex @tab @tab (@i{shape}) @end multitable @end iftex @ifnottex @item parameters 1 (1): p @multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab p @tab 0 < p < 1 @tab @tab @i{(shape)} @end multitable @end ifnottex @item reference: @ifhtml @ref{bib:JKKa92,, [JKKa92: Ch.5.2; p.201]} @end ifhtml @ifnothtml [JKKa92: Ch.5.2; p.201] @end ifnothtml @item special generators: @table @code @item INV Inversion method @end table @end table @c @c end of unur_distributions.h @c ------------------------------------- @c ------------------------------------- @c unur_distributions.h @c @node hypergeometric @subsection @code{hypergeometric} -- Hypergeometric distribution @anchor{funct:unur_distr_hypergeometric} @findex unur_distr_hypergeometric @table @i @item PMF: @iftex @tex ${M \choose k} \, {N-M \choose n-k} / {N \choose n}$ @end tex @end iftex @ifnottex (M \choose k) * (N-M \choose n-k) / (N \choose n) @end ifnottex @item constant: @iftex @tex $1$ @end tex @end iftex @ifnottex 1 @end ifnottex @item domain: @iftex @tex $\max(0,n-N+M) \leq k \leq \min(n,M)$ @end tex @end iftex @ifnottex max(0,n-N+M) <= k <= min(n,M) @end ifnottex @iftex @item parameters 3 (3): @r{ N, M, n} @multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab@tex$N $@end tex @tab@tex$\geq 1 $@end tex @tab @tab (@i{no. of elements}) @item @code{[1]} @tab@tex$M $@end tex @tab@tex$1 \leq M \leq N $@end tex @tab @tab (@i{shape}) @item @code{[2]} @tab@tex$n $@end tex @tab@tex$1 \leq n \leq N $@end tex @tab @tab (@i{shape}) @end multitable @end iftex @ifnottex @item parameters 3 (3): N, M, n @multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab N @tab >= 1 @tab @tab @i{(no. of elements)} @item @code{[1]} @tab M @tab 1 <= M <= N @tab @tab @i{(shape)} @item @code{[2]} @tab n @tab 1 <= n <= N @tab @tab @i{(shape)} @end multitable @end ifnottex @item reference: @ifhtml @ref{bib:JKKa92,, [JKKa92: Ch.6; p.237]} @end ifhtml @ifnothtml [JKKa92: Ch.6; p.237] @end ifnothtml @item special generators: @table @code @item DEF @iftex Ratio of Uniforms/Inversion [STa89] @end iftex @ifhtml Ratio of Uniforms/Inversion @ref{bib:STa89, [STa89]} @end ifhtml @ifinfo Ratio of Uniforms/Inversion [STa89] @end ifinfo @end table @end table @c @c end of unur_distributions.h @c ------------------------------------- @c ------------------------------------- @c unur_distributions.h @c @node logarithmic @subsection @code{logarithmic} -- Logarithmic distribution @anchor{funct:unur_distr_logarithmic} @findex unur_distr_logarithmic @table @i @item PMF: @iftex @tex $\theta^k / k$ @end tex @end iftex @ifnottex theta^k / k @end ifnottex @item constant: @iftex @tex $- \log( 1.-\theta);$ @end tex @end iftex @ifnottex - log( 1.-theta); @end ifnottex @item domain: @iftex @tex $1 \leq k < \infty$ @end tex @end iftex @ifnottex 1 <= k < infinity @end ifnottex @iftex @item parameters 1 (1): @r{ theta} @multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab@tex$\theta $@end tex @tab@tex$0 < \theta < 1 $@end tex @tab @tab (@i{shape}) @end multitable @end iftex @ifnottex @item parameters 1 (1): theta @multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab theta @tab 0 < theta < 1 @tab @tab @i{(shape)} @end multitable @end ifnottex @item reference: @ifhtml @ref{bib:JKKa92,, [JKKa92: Ch.7; p.285]} @end ifhtml @ifnothtml [JKKa92: Ch.7; p.285] @end ifnothtml @item special generators: @table @code @item DEF @iftex Inversion/Transformation [KAa81] @end iftex @ifhtml Inversion/Transformation @ref{bib:KAa81, [KAa81]} @end ifhtml @ifinfo Inversion/Transformation [KAa81] @end ifinfo @end table @end table @c @c end of unur_distributions.h @c ------------------------------------- @c ------------------------------------- @c unur_distributions.h @c @node negativebinomial @subsection @code{negativebinomial} -- Negative Binomial distribution @anchor{funct:unur_distr_negativebinomial} @findex unur_distr_negativebinomial @table @i @item PMF: @iftex @tex ${k+r-1 \choose r-1} \, p^r \, (1-p)^k$ @end tex @end iftex @ifnottex (k+r-1 \choose r-1) * p^r * (1-p)^k @end ifnottex @item constant: @iftex @tex $1$ @end tex @end iftex @ifnottex 1 @end ifnottex @item domain: @iftex @tex $0 \leq k < \infty$ @end tex @end iftex @ifnottex 0 <= k < infinity @end ifnottex @iftex @item parameters 2 (2): @r{ p, r} @multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab@tex$p $@end tex @tab@tex$0 < p < 1 $@end tex @tab @tab (@i{shape}) @item @code{[1]} @tab@tex$r $@end tex @tab@tex$> 0 $@end tex @tab @tab (@i{shape}) @end multitable @end iftex @ifnottex @item parameters 2 (2): p, r @multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab p @tab 0 < p < 1 @tab @tab @i{(shape)} @item @code{[1]} @tab r @tab > 0 @tab @tab @i{(shape)} @end multitable @end ifnottex @item reference: @ifhtml @ref{bib:JKKa92,, [JKKa92: Ch.5.1; p.200]} @end ifhtml @ifnothtml [JKKa92: Ch.5.1; p.200] @end ifnothtml @end table @c @c end of unur_distributions.h @c ------------------------------------- @c ------------------------------------- @c unur_distributions.h @c @node poisson @subsection @code{poisson} -- Poisson distribution @anchor{funct:unur_distr_poisson} @findex unur_distr_poisson @table @i @item PMF: @iftex @tex $\theta^k / k!$ @end tex @end iftex @ifnottex theta^k / k! @end ifnottex @item constant: @iftex @tex $\exp(\theta)$ @end tex @end iftex @ifnottex exp(theta) @end ifnottex @item domain: @iftex @tex $0 \leq k < \infty$ @end tex @end iftex @ifnottex 0 <= k < infinity @end ifnottex @iftex @item parameters 1 (1): @r{ theta} @multitable {No.} {namex} {999999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab@tex$\theta $@end tex @tab@tex$> 0 $@end tex @tab @tab (@i{shape}) @end multitable @end iftex @ifnottex @item parameters 1 (1): theta @multitable {No.xx} {namexxx} {99999999999} {defaultx} {xxxxxxxxxxxxxxxxxxxxxxxx} @item No. @tab name @tab @tab default @item @code{[0]} @tab theta @tab > 0 @tab @tab @i{(shape)} @end multitable @end ifnottex @item reference: @ifhtml @ref{bib:JKKa92,, [JKKa92: Ch.4; p.151]} @end ifhtml @ifnothtml [JKKa92: Ch.4; p.151] @end ifnothtml @item special generators: @table @code @item DEF @iftex Tabulated Inversion combined with Acceptance Complement [ADb82] @end iftex @ifhtml Tabulated Inversion combined with Acceptance Complement @ref{bib:ADb82, [ADb82]} @end ifhtml @ifinfo Tabulated Inversion combined with Acceptance Complement [ADb82] @end ifinfo @item 2 @iftex Tabulated Inversion combined with Patchwork Rejection [ZHa94] @end iftex @ifhtml Tabulated Inversion combined with Patchwork Rejection @ref{bib:ZHa94, [ZHa94]} @end ifhtml @ifinfo Tabulated Inversion combined with Patchwork Rejection [ZHa94] @end ifinfo @end table @end table @c @c end of unur_distributions.h @c ------------------------------------- @c ------------------------------------- @c stddist.dh @c @page @node Stddist_MATR @section UNU.RAN Library of random matrices @menu * correlation:: Random correlation matrix @end menu @c @c end of stddist.dh @c ------------------------------------- @c ------------------------------------- @c unur_distributions.h @c @node correlation @subsection @code{correlation} -- Random correlation matrix @anchor{funct:unur_distr_correlation} @findex unur_distr_correlation @table @i @end table @code{UNUR_DISTR *unur_distr_correlation( int n )} creates a distribution object for a random correlation matrix of @var{n} rows and columns. It can be used with method MCORR (@pxref{MCORR,,Random Correlation Matrix}) to generate random correlation matrices of the given size. @c @c end of unur_distributions.h @c ------------------------------------- @c ------------------------------------- @c error_debug.dh @c @node Error_Debug @chapter Error handling and Debugging @menu * Output_streams:: Output streams * Debug:: Debugging * Error_reporting:: Error reporting * Errno:: Error codes * Error_handlers:: Error handlers @end menu UNU.RAN routines report an error whenever they cannot perform the requested task. Additionally it is possible to get information about the generated distribution of generator objects for debugging purposes. However, the latter must be enabled when compiling and installing the library. (It is disabled by default.) This chapter describes all necessary details: @itemize @item Choose an output stream to for writing the requested information. @item Select a debugging level. @item Select an error handler. @item Write your own error handler. @item Get more information for a particular error code. @end itemize @c @c end of error_debug.dh @c ------------------------------------- @c ------------------------------------- @c stream.h @c @node Output_streams @section Output streams @cindex Error handlers @cindex Output streams UNU.RAN uses a logfile for writing all error messages, warnings, and debugging information onto an output stream. This stream can be set at runtime by the @ifhtml @ref{funct:unur_set_stream,@command{unur_set_stream}} @end ifhtml @ifnothtml @command{unur_set_stream} @end ifnothtml call. If no such stream is given by the user a default stream is used by the library: all messages are written into the file @file{unuran.log} in the current working directory. The name of this logfile is defined by the macro @code{UNUR_LOG_FILE} in @file{unuran_config.h}. (If UNU.RAN fails to open this file for writing, @file{stderr} is used instead.) To destinguish between messages for different objects each of these has its own identifier which is composed by the name of the distribution obejct and generator type, resp., followed by a dot and three digits. (If there are more than 999 generators then the identifiers are not unique.) @emph{Remark:} Writting debugging information must be switched on at compile time using the configure flag @code{--enable-logging}, see @ref{Debug,,Debugging}. @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_set_stream,unur_set_stream} @item @ref{funct:unur_get_stream,unur_get_stream} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_set_stream} @deftypefn Function {FILE*} unur_set_stream (FILE* @var{new_stream}) This function sets a new file handler for the output stream, @var{new_stream}, for the UNU.RAN library routines. The previous handler is returned (so that you can restore it later). Note that the pointer to a user defined file handler is stored in a static variable, so there can be only one output stream handler per program. This function should be not be used in multi-threaded programs except to set up a program-wide error handler from a master thread. The @code{NULL} pointer is not allowed. (If you want to disable logging of debugging information use unur_set_default_debug(UNUR_DEBUG_OFF) instead. If you want to disable error messages at all use @ifhtml @ref{funct:unur_set_error_handler_off,@command{unur_set_error_handler_off}.} @end ifhtml @ifnothtml @command{unur_set_error_handler_off}. @end ifnothtml ) @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_set_stream} @deftypefn {} {FILE*} unur_set_stream (FILE* @var{new_stream}) This function sets a new file handler for the output stream, @var{new_stream}, for the UNU.RAN library routines. The previous handler is returned (so that you can restore it later). Note that the pointer to a user defined file handler is stored in a static variable, so there can be only one output stream handler per program. This function should be not be used in multi-threaded programs except to set up a program-wide error handler from a master thread. The @code{NULL} pointer is not allowed. (If you want to disable logging of debugging information use unur_set_default_debug(UNUR_DEBUG_OFF) instead. If you want to disable error messages at all use @ifhtml @ref{funct:unur_set_error_handler_off,@command{unur_set_error_handler_off}.} @end ifhtml @ifnothtml @command{unur_set_error_handler_off}. @end ifnothtml ) @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_get_stream} @deftypefn Function {FILE*} unur_get_stream (void) Get the file handle for the current output stream. It can be used to allow applications to write additional information into the logfile. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_get_stream} @deftypefn {} {FILE*} unur_get_stream (void) Get the file handle for the current output stream. It can be used to allow applications to write additional information into the logfile. @end deftypefn @end ifnotinfo @c @c end of stream.h @c ------------------------------------- @c ------------------------------------- @c debug.h @c @node Debug @section Debugging The UNU.RAN library has several debugging levels which can be switched on/off by debugging flags. This debugging feature must be enabled when building the library using the @code{--enable-logging} configure flag. The debugging levels range from print a short description of the created generator object to a detailed description of hat functions and tracing the sampling routines. The output is printed onto the debugging output stream (@pxref{Output_streams,,Output streams}). The debugging flags can be set or changed by the respective calls @ifhtml @ref{funct:unur_set_debug,@command{unur_set_debug}} @end ifhtml @ifnothtml @command{unur_set_debug} @end ifnothtml and @ifhtml @ref{funct:unur_chg_debug,@command{unur_chg_debug}} @end ifhtml @ifnothtml @command{unur_chg_debug} @end ifnothtml independently for each generator. By default flag @code{UNUR_DEBUG_INIT} (see below) is used. This default flags is set by the macro @code{UNUR_DEBUGFLAG_DEFAULT} in @file{unuran_config.h} and can be changed at runtime by a @ifhtml @ref{funct:unur_set_default_debug,@command{unur_set_default_debug}} @end ifhtml @ifnothtml @command{unur_set_default_debug} @end ifnothtml call. Off course these debugging flags depend on the chosen method. Since most of these are merely for debugging the library itself, a description of the flags are given in the corresponding source files of the method. Nevertheless, the following flags can be used with all methods. Common debug flags: @ftable @code @item UNUR_DEBUG_OFF @findex UNUR_DEBUG_OFF switch off all debuging information @item UNUR_DEBUG_ALL @findex UNUR_DEBUG_ALL all avaivable information @item UNUR_DEBUG_INIT @findex UNUR_DEBUG_INIT parameters of generator object after initialization @item UNUR_DEBUG_SETUP @findex UNUR_DEBUG_SETUP data created at setup @item UNUR_DEBUG_ADAPT @findex UNUR_DEBUG_ADAPT data created during adaptive steps @item UNUR_DEBUG_SAMPLE @findex UNUR_DEBUG_SAMPLE trace sampling @end ftable Notice that these are flags which could be combined using the @code{|} operator. Almost all routines check a given pointer before they read from or write to the given address. This does not hold for time-critical routines like all sampling routines. Thus you are responsible for checking a pointer that is returned from a @ifhtml @ref{funct:unur_init,@command{unur_init}} @end ifhtml @ifnothtml @command{unur_init} @end ifnothtml call. However, it is possible to turn on checking for invalid @code{NULL} pointers even in such time-critical routines by building the library using the @code{--enable-check-struct} configure flag. Another debugging tool used in the library are magic cookies that validate a given pointer. It produces an error whenever a given pointer points to an object that is invalid in the context. The usage of magic cookies is also switched on by the @code{--enable-check-struct} configure flag. @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_set_debug,unur_set_debug} @item @ref{funct:unur_chg_debug,unur_chg_debug} @item @ref{funct:unur_set_default_debug,unur_set_default_debug} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_set_debug} @deftypefn Function {int} unur_set_debug (UNUR_PAR* @var{parameters}, unsigned @var{debug}) Set debugging flags for generator. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_set_debug} @deftypefn {} {int} unur_set_debug (UNUR_PAR* @var{parameters}, unsigned @var{debug}) Set debugging flags for generator. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_chg_debug} @deftypefn Function {int} unur_chg_debug (UNUR_GEN* @var{generator}, unsigned @var{debug}) Change debugging flags for generator. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_chg_debug} @deftypefn {} {int} unur_chg_debug (UNUR_GEN* @var{generator}, unsigned @var{debug}) Change debugging flags for generator. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_set_default_debug} @deftypefn Function {int} unur_set_default_debug (unsigned @var{debug}) Change default debugging flag. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_set_default_debug} @deftypefn {} {int} unur_set_default_debug (unsigned @var{debug}) Change default debugging flag. @end deftypefn @end ifnotinfo @c @c end of debug.h @c ------------------------------------- @c ------------------------------------- @c error.h @c @node Error_reporting @section Error reporting UNU.RAN routines report an error whenever they cannot perform the requested task. For example, applying transformed density rejection to a distribution that violates the T-concavity condition, or trying to set a parameter that is out of range, result in an error message. It might also happen that the setup fails for transformed density rejection for a T-concave distribution with some extreme density function simply because of round-off errors that makes the generation of a hat function numerically impossible. Situations like this may happen when using black box algorithms and you should check the return values of all routines. All @command{..._set_...}, and @command{..._chg_...} calls return @code{UNUR_SUCCESS} if they could be executed successfully. Otherwise, some error codes are returned if it was not possible to set or change the desired parameters, e.g. because the given values are out of range, or simply because the set call does not work for the chosen method. All routines that return a pointer to the requested object will return a @code{NULL} pointer in case of error. (Thus you should always check the pointer to avoid possible segmentation faults. Sampling routines usually do not check the given pointer to the generator object.) The library distinguishes between two major classes of error: @table @emph @item (fatal) errors: The library was not able to construct the requested object. @item warnings: Some problems encounters while constructing a generator object. The routine has tried to solve the problem but the resulting object might not be what you want. For example, chosing a special variant of a method does not work and the initialization routine might switch to another variant. Then the generator produces random variates of the requested distribution but correlation induction is not possible. However, it also might happen that changing the domain of a distribution has failed. Then the generator produced random variates with too large/too small range, i.e. their distribution is not correct. @end table It is obvious from the example that this distinction between errors and warning is rather crude and sometimes arbitrary. UNU.RAN routines use the global variable @var{unur_errno} to report errors, completely analogously to @var{errno} in the ANSI C standard library. (However this approach is not thread-safe. There can be only one instance of a global variable per program. Different threads of execution may overwrite @var{unur_errno} simultaneously). Thus when an error occurs the caller of the routine can examine the error code in @var{unur_errno} to get more details about the reason why a routine failed. You get a short description of the error by a @ifhtml @ref{funct:unur_get_strerror,@command{unur_get_strerror}} @end ifhtml @ifnothtml @command{unur_get_strerror} @end ifnothtml call. All the error code numbers have prefix @code{UNUR_ERR_} and expand to non-zero constant unsigned integer values. Error codes are divided into six main groups, see @ref{Errno,,Error codes}. Alternatively, the variable @var{unur_errno} can also read by a @ifhtml @ref{funct:unur_get_errno,@command{unur_get_errno}} @end ifhtml @ifnothtml @command{unur_get_errno} @end ifnothtml call and can be reset by the @ifhtml @ref{funct:unur_reset_errno,@command{unur_reset_errno}} @end ifhtml @ifnothtml @command{unur_reset_errno} @end ifnothtml call (this is in particular required for the Windows version of the library). Additionally, there exists a error handler (@pxref{Error_handlers,,Error handlers}) that is invoked in case of an error. In addition to reporting errors by setting error codes in @var{unur_errno}, the library also has an error handler function. This function is called by other library functions when they report an error, just before they return to the caller (@pxref{Error_handlers,,Error handlers}). The default behavior of the error handler is to print a short message: @example AROU.004: [error] arou.c:1500 - (generator) condition for method violated: AROU.004: ..> PDF not unimodal @end example The purpose of the error handler is to provide a function where a breakpoint can be set that will catch library errors when running under the debugger. It is not intended for use in production programs, which should handle any errors using the return codes. @subheading Function reference @ifhtml @itemize @item @ref{var:unur_errno,unur_errno} @item @ref{funct:unur_get_errno,unur_get_errno} @item @ref{funct:unur_reset_errno,unur_reset_errno} @item @ref{funct:unur_get_strerror,unur_get_strerror} @end itemize @end ifhtml @ifinfo @anchor{var:unur_errno} @deftypevar {extern int} unur_errno @findex unur_errno Global variable for reporting diagnostics of error. @end deftypevar @end ifinfo @ifnotinfo @anchor{var:unur_errno} @deftypevar {extern int} unur_errno @findex unur_errno Global variable for reporting diagnostics of error. @end deftypevar @end ifnotinfo @ifinfo @anchor{funct:unur_get_errno} @deftypefn Function {int} unur_get_errno (void) Get current value of global variable @var{unur_errno}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_get_errno} @deftypefn {} {int} unur_get_errno (void) Get current value of global variable @var{unur_errno}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_reset_errno} @deftypefn Function {void} unur_reset_errno (void) Reset global variable @var{unur_errno} to @code{UNUR_SUCCESS} (i.e., no errors occured). @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_reset_errno} @deftypefn {} {void} unur_reset_errno (void) Reset global variable @var{unur_errno} to @code{UNUR_SUCCESS} (i.e., no errors occured). @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_get_strerror} @deftypefn Function {const char*} unur_get_strerror (const @var{int errnocode}) Get a short description for error code value. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_get_strerror} @deftypefn {} {const char*} unur_get_strerror (const @var{int errnocode}) Get a short description for error code value. @end deftypefn @end ifnotinfo @c @c end of error.h @c ------------------------------------- @c ------------------------------------- @c unur_errno.h @c @node Errno @section Error codes @subsubheading List of error codes @itemize @bullet @item Procedure executed successfully (no error) @ftable @code @item UNUR_SUCCESS (0x0u) success (no error) @end ftable @item Errors that occurred while handling distribution objects. @ftable @code @item UNUR_ERR_DISTR_SET set failed (invalid parameter). @item UNUR_ERR_DISTR_GET get failed (parameter not set). @item UNUR_ERR_DISTR_NPARAMS invalid number of parameters. @item UNUR_ERR_DISTR_DOMAIN parameter(s) out of domain. @item UNUR_ERR_DISTR_GEN invalid variant for special generator. @item UNUR_ERR_DISTR_REQUIRED incomplete distribution object, entry missing. @item UNUR_ERR_DISTR_UNKNOWN unknown distribution, cannot handle. @item UNUR_ERR_DISTR_INVALID invalid distribution object. @item UNUR_ERR_DISTR_DATA data are missing. @item UNUR_ERR_DISTR_PROP desired property does not exist @end ftable @item Errors that occurred while handling parameter objects. @ftable @code @item UNUR_ERR_PAR_SET set failed (invalid parameter) @item UNUR_ERR_PAR_VARIANT invalid variant -> using default @item UNUR_ERR_PAR_INVALID invalid parameter object @end ftable @item Errors that occurred while handling generator objects. @ftable @code @item UNUR_ERR_GEN error with generator object. @item UNUR_ERR_GEN_DATA (possibly) invalid data. @item UNUR_ERR_GEN_CONDITION condition for method violated. @item UNUR_ERR_GEN_INVALID invalid generator object. @item UNUR_ERR_GEN_SAMPLING sampling error. @item UNUR_ERR_NO_REINIT reinit routine not implemented. @item UNUR_ERR_NO_QUANTILE quantile routine not implemented. @end ftable @item Errors that occurred while handling URNG objects. @ftable @code @item UNUR_ERR_URNG generic error with URNG object. @item UNUR_ERR_URNG_MISS missing functionality. @end ftable @item Errors that occurred while parsing strings. @ftable @code @item UNUR_ERR_STR error in string. @item UNUR_ERR_STR_UNKNOWN unknown keyword. @item UNUR_ERR_STR_SYNTAX syntax error. @item UNUR_ERR_STR_INVALID invalid parameter. @item UNUR_ERR_FSTR_SYNTAX syntax error in function string. @item UNUR_ERR_FSTR_DERIV cannot derivate function. @end ftable @item Other run time errors. @ftable @code @item UNUR_ERR_DOMAIN argument out of domain. @item UNUR_ERR_ROUNDOFF (serious) round-off error. @item UNUR_ERR_MALLOC virtual memory exhausted. @item UNUR_ERR_NULL invalid @code{NULL} pointer. @item UNUR_ERR_COOKIE invalid cookie. @item UNUR_ERR_GENERIC generic error. @item UNUR_ERR_SILENT silent error (no error message). @item UNUR_ERR_INF infinity occured. @item UNUR_ERR_NAN NaN occured. @item UNUR_ERR_COMPILE Requested routine requires different compilation switches. Recompilation of library necessary. @item UNUR_ERR_SHOULD_NOT_HAPPEN Internal error, that should not happen. Please report this bug! @end ftable @end itemize @c @c end of unur_errno.h @c ------------------------------------- @c ------------------------------------- @c error.h @c @node Error_handlers @section Error handlers The default behavior of the UNU.RAN error handler is to print a short message onto the output stream, usually a logfile (@pxref{Output_streams,,Output streams}), e.g., @example AROU.004: [error] arou.c:1500 - (generator) condition for method violated: AROU.004: ..> PDF not unimodal @end example This error handler can be switched off using the @ifhtml @ref{funct:unur_set_error_handler_off,@command{unur_set_error_handler_off}} @end ifhtml @ifnothtml @command{unur_set_error_handler_off} @end ifnothtml call, or replace it by a new one. Thus it allows to set a breakpoint that will catch library errors when running under the debugger. It also can be used to redirect error messages when UNU.RAN is included in general purpose libraries or in interactive programming environments. @deftp {Data Type} UNUR_ERROR_HANDLER This is the type of UNU.RAN error handler functions. An error handler will be passed six arguments which specify the identifier of the object where the error occured (a string), the name of the source file in which it occurred (also a string), the line number in that file (an integer), the type of error (a string: @code{"error"} or @code{"warning"}), the error number (an integert), and the reason for the error (a string). The source file and line number are set at compile time using the @code{__FILE__} and @code{__LINE__} directives in the preprocessor. The error number can be translated into a short description using a @ifhtml @ref{funct:unur_get_strerror,@command{unur_get_strerror}} @end ifhtml @ifnothtml @command{unur_get_strerror} @end ifnothtml call. An error handler function returns type @code{void}. Error handler functions should be defined like this, @example void my_handler( @ @ @ @ @ @ @ @ @ @ @ const char *objid, @ @ @ @ @ @ @ @ @ @ @ const char *file, @ @ @ @ @ @ @ @ @ @ @ int line, @ @ @ @ @ @ @ @ @ @ @ const char *errortype, @ @ @ @ @ @ @ @ @ @ @ int unur_errno, @ @ @ @ @ @ @ @ @ @ @ const char *reason ) @end example @end deftp To request the use of your own error handler you need the call @ifhtml @ref{funct:unur_set_error_handler,@command{unur_set_error_handler}.} @end ifhtml @ifnothtml @command{unur_set_error_handler}. @end ifnothtml @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_set_error_handler,unur_set_error_handler} @item @ref{funct:unur_set_error_handler_off,unur_set_error_handler_off} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_set_error_handler} @deftypefn Function {UNUR_ERROR_HANDLER*} unur_set_error_handler (UNUR_ERROR_HANDLER* @var{new_handler}) This function sets a new error handler, @var{new_handler}, for the UNU.RAN library routines. The previous handler is returned (so that you can restore it later). Note that the pointer to a user defined error handler function is stored in a static variable, so there can be only one error handler per program. This function should be not be used in multi-threaded programs except to set up a program-wide error handler from a master thread. To use the default behavior set the error handler to @code{NULL}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_set_error_handler} @deftypefn {} {UNUR_ERROR_HANDLER*} unur_set_error_handler (UNUR_ERROR_HANDLER* @var{new_handler}) This function sets a new error handler, @var{new_handler}, for the UNU.RAN library routines. The previous handler is returned (so that you can restore it later). Note that the pointer to a user defined error handler function is stored in a static variable, so there can be only one error handler per program. This function should be not be used in multi-threaded programs except to set up a program-wide error handler from a master thread. To use the default behavior set the error handler to @code{NULL}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_set_error_handler_off} @deftypefn Function {UNUR_ERROR_HANDLER*} unur_set_error_handler_off (void) This function turns off the error handler by defining an error handler which does nothing (except of setting @var{unur_errno}. The previous handler is returned (so that you can restore it later). @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_set_error_handler_off} @deftypefn {} {UNUR_ERROR_HANDLER*} unur_set_error_handler_off (void) This function turns off the error handler by defining an error handler which does nothing (except of setting @var{unur_errno}. The previous handler is returned (so that you can restore it later). @end deftypefn @end ifnotinfo @c @c end of error.h @c ------------------------------------- @c ------------------------------------- @c unuran_tests.h @c @node Testing @chapter Testing The following routines can be used to test the performance of the implemented generators and can be used to verify the implementions. They are declared in @file{unuran_tests.h} which has to be included. @subheading Function reference @ifhtml @itemize @item @ref{funct:unur_run_tests,unur_run_tests} @item @ref{funct:unur_test_printsample,unur_test_printsample} @item @ref{funct:unur_test_timing,unur_test_timing} @item @ref{funct:unur_test_timing_R,unur_test_timing_R} @item @ref{funct:unur_test_timing_uniform,unur_test_timing_uniform} @item @ref{funct:unur_test_timing_exponential,unur_test_timing_exponential} @item @ref{funct:unur_test_timing_total,unur_test_timing_total} @item @ref{funct:unur_test_count_urn,unur_test_count_urn} @item @ref{funct:unur_test_count_pdf,unur_test_count_pdf} @item @ref{funct:unur_test_par_count_pdf,unur_test_par_count_pdf} @item @ref{funct:unur_test_chi2,unur_test_chi2} @item @ref{funct:unur_test_moments,unur_test_moments} @item @ref{funct:unur_test_correlation,unur_test_correlation} @item @ref{funct:unur_test_quartiles,unur_test_quartiles} @item @ref{funct:unur_test_u_error,unur_test_u_error} @end itemize @end ifhtml @ifinfo @anchor{funct:unur_run_tests} @deftypefn Function {void} unur_run_tests (UNUR_PAR* @var{parameters}, unsigned @var{tests}, FILE* @var{out}) Run a battery of tests. The following tests are available (use @code{|} to combine these tests): @table @code @item UNUR_TEST_ALL run all possible tests. @item UNUR_TEST_TIME estimate generation times. @item UNUR_TEST_N_URNG count number of uniform random numbers @item UNUR_TEST_N_PDF count number of PDF calls @item UNUR_TEST_CHI2 run chi^2 test for goodness of fit @item UNUR_TEST_SAMPLE print a small sample. @end table All these tests can be started individually (see below). @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_run_tests} @deftypefn {} {void} unur_run_tests (UNUR_PAR* @var{parameters}, unsigned @var{tests}, FILE* @var{out}) Run a battery of tests. The following tests are available (use @code{|} to combine these tests): @table @code @item UNUR_TEST_ALL run all possible tests. @item UNUR_TEST_TIME estimate generation times. @item UNUR_TEST_N_URNG count number of uniform random numbers @item UNUR_TEST_N_PDF count number of PDF calls @item UNUR_TEST_CHI2 run chi^2 test for goodness of fit @item UNUR_TEST_SAMPLE print a small sample. @end table All these tests can be started individually (see below). @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_test_printsample} @deftypefn Function {void} unur_test_printsample (UNUR_GEN* @var{generator}, int @var{n_rows}, int @var{n_cols}, FILE* @var{out}) Print a small sample with @var{n_rows} rows and @var{n_cols} columns. @var{out} is the output stream to which all results are written. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_test_printsample} @deftypefn {} {void} unur_test_printsample (UNUR_GEN* @var{generator}, int @var{n_rows}, int @var{n_cols}, FILE* @var{out}) Print a small sample with @var{n_rows} rows and @var{n_cols} columns. @var{out} is the output stream to which all results are written. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_test_timing} @deftypefn Function {UNUR_GEN*} unur_test_timing (UNUR_PAR* @var{parameters}, int @var{log10_samplesize}, double* @var{time_setup}, double* @var{time_sample}, int @var{verbosity}, FILE* @var{out}) Timing. @var{parameters} is an parameter object for which setup time and marginal generation times have to be measured. The results are written into @var{time_setup} and @var{time_sample}, respectively. @var{log10_samplesize} is the common logarithm of the sample size that is used for timing. If @var{verbosity} is @code{TRUE} then a small table is printed to output stream @var{out} with setup time, marginal generation time and average generation times for generating 10, 100, @dots{} random variates. All times are given in micro seconds and relative to the generation times for the underlying uniform random number (using the UNIF interface) and an exponential distributed random variate using the inversion method. The created generator object is returned. If a generator object could not be created successfully, then @code{NULL} is returned. If @var{verbosity} is @code{TRUE} the result is written to the output stream @var{out}. Notice: All timing results are subject to heavy changes. Reruning timings usually results in different results. Minor changes in the source code can cause changes in such timings up to 25 percent. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_test_timing} @deftypefn {} {UNUR_GEN*} unur_test_timing (UNUR_PAR* @var{parameters}, int @var{log10_samplesize}, double* @var{time_setup}, double* @var{time_sample}, int @var{verbosity}, FILE* @var{out}) Timing. @var{parameters} is an parameter object for which setup time and marginal generation times have to be measured. The results are written into @var{time_setup} and @var{time_sample}, respectively. @var{log10_samplesize} is the common logarithm of the sample size that is used for timing. If @var{verbosity} is @code{TRUE} then a small table is printed to output stream @var{out} with setup time, marginal generation time and average generation times for generating 10, 100, @dots{} random variates. All times are given in micro seconds and relative to the generation times for the underlying uniform random number (using the UNIF interface) and an exponential distributed random variate using the inversion method. The created generator object is returned. If a generator object could not be created successfully, then @code{NULL} is returned. If @var{verbosity} is @code{TRUE} the result is written to the output stream @var{out}. Notice: All timing results are subject to heavy changes. Reruning timings usually results in different results. Minor changes in the source code can cause changes in such timings up to 25 percent. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_test_timing_R} @deftypefn Function {double} unur_test_timing_R (UNUR_PAR* @var{parameters}, const @var{char* distrstr}, const @var{char* methodstr}, double @var{log10_samplesize}, double* @var{time_setup}, double* @var{time_marginal}) Timing. @var{parameters} is an parameter object for which setup time and marginal generation times have to be measured. The results are written into @var{time_setup} and @var{time_marginal}, respectively. @var{log10_samplesize} is the common logarithm of the sample size that is used for timing. Alternatively, one could provide the "parameter object" using strings @var{distrstr} and @var{methodstr} as used for @ifhtml @ref{funct:unur_makegen_ssu,@command{unur_makegen_ssu}.} @end ifhtml @ifnothtml @command{unur_makegen_ssu}. @end ifnothtml The results are more accurate than those of function @ifhtml @ref{funct:unur_test_timing,@command{unur_test_timing}} @end ifhtml @ifnothtml @command{unur_test_timing} @end ifnothtml as the timings are computed using linear regression with several timings for sample size 1 and 10^@var{log10_samplesize}. For each sample size total generation time (including setup) is measured 10 times. Since the these timings can be influenced by external effects (like disc sync or handling of interupts) the 2 fastest and the 3 slowest timings are discarded. Intercept and slope for simple linear regression are than stored and @math{R^2} is returned. In case of an error @code{-100.} is returned. Notice: All timing results are subject to heavy changes. Reruning timings usually results in different results. Minor changes in the source code can cause changes in such timings up to 25 percent. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_test_timing_R} @deftypefn {} {double} unur_test_timing_R (UNUR_PAR* @var{parameters}, const @var{char* distrstr}, const @var{char* methodstr}, double @var{log10_samplesize}, double* @var{time_setup}, double* @var{time_marginal}) Timing. @var{parameters} is an parameter object for which setup time and marginal generation times have to be measured. The results are written into @var{time_setup} and @var{time_marginal}, respectively. @var{log10_samplesize} is the common logarithm of the sample size that is used for timing. Alternatively, one could provide the "parameter object" using strings @var{distrstr} and @var{methodstr} as used for @ifhtml @ref{funct:unur_makegen_ssu,@command{unur_makegen_ssu}.} @end ifhtml @ifnothtml @command{unur_makegen_ssu}. @end ifnothtml The results are more accurate than those of function @ifhtml @ref{funct:unur_test_timing,@command{unur_test_timing}} @end ifhtml @ifnothtml @command{unur_test_timing} @end ifnothtml as the timings are computed using linear regression with several timings for sample size 1 and 10^@var{log10_samplesize}. For each sample size total generation time (including setup) is measured 10 times. Since the these timings can be influenced by external effects (like disc sync or handling of interupts) the 2 fastest and the 3 slowest timings are discarded. Intercept and slope for simple linear regression are than stored and @iftex @math{R^2} @end iftex @ifhtml @html R2 @end html @end ifhtml is returned. In case of an error @code{-100.} is returned. Notice: All timing results are subject to heavy changes. Reruning timings usually results in different results. Minor changes in the source code can cause changes in such timings up to 25 percent. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_test_timing_uniform} @anchor{funct:unur_test_timing_exponential} @deftypefn Function {double} unur_test_timing_uniform (const @var{UNUR_PAR* parameters}, int @var{log10_samplesize}) @deftypefnx Function {double} unur_test_timing_exponential (const @var{UNUR_PAR* parameters}, int @var{log10_samplesize}) Marginal generation times for the underlying uniform random number (using the UNIF interface) and an exponential distributed random variate using the inversion method. These times are used in @ifhtml @ref{funct:unur_test_timing,@command{unur_test_timing}} @end ifhtml @ifnothtml @command{unur_test_timing} @end ifnothtml to compute the relative timings results. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_test_timing_uniform} @anchor{funct:unur_test_timing_exponential} @deftypefn {} {double} unur_test_timing_uniform (const @var{UNUR_PAR* parameters}, int @var{log10_samplesize}) @deftypefnx {} {double} unur_test_timing_exponential (const @var{UNUR_PAR* parameters}, int @var{log10_samplesize}) Marginal generation times for the underlying uniform random number (using the UNIF interface) and an exponential distributed random variate using the inversion method. These times are used in @ifhtml @ref{funct:unur_test_timing,@command{unur_test_timing}} @end ifhtml @ifnothtml @command{unur_test_timing} @end ifnothtml to compute the relative timings results. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_test_timing_total} @deftypefn Function {double} unur_test_timing_total (const @var{UNUR_PAR* parameters}, int @var{samplesize}, double @var{avg_duration}) Timing. @var{parameters} is an parameter object for which average times a sample of size @var{samplesize} (including setup) are estimated. Thus sampling is repeated and the median of these timings is returned (in micro seconds). The number of iterations is computed automatically such that the total amount of time necessary for the test ist approximately @var{avg_duration} (given in seconds). However, for very slow generator with expensive setup time the time necessary for this test may be (much) larger. If an error occurs then @code{-1} is returned. Notice: All timing results are subject to heavy changes. Reruning timings usually results in different results. Minor changes in the source code can cause changes in such timings up to 25 percent. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_test_timing_total} @deftypefn {} {double} unur_test_timing_total (const @var{UNUR_PAR* parameters}, int @var{samplesize}, double @var{avg_duration}) Timing. @var{parameters} is an parameter object for which average times a sample of size @var{samplesize} (including setup) are estimated. Thus sampling is repeated and the median of these timings is returned (in micro seconds). The number of iterations is computed automatically such that the total amount of time necessary for the test ist approximately @var{avg_duration} (given in seconds). However, for very slow generator with expensive setup time the time necessary for this test may be (much) larger. If an error occurs then @code{-1} is returned. Notice: All timing results are subject to heavy changes. Reruning timings usually results in different results. Minor changes in the source code can cause changes in such timings up to 25 percent. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_test_count_urn} @deftypefn Function {int} unur_test_count_urn (UNUR_GEN* @var{generator}, int @var{samplesize}, int @var{verbosity}, FILE* @var{out}) Count used uniform random numbers. It returns the total number of uniform random numbers required for a sample of non-uniform random variates of size @var{samplesize}. In case of an error @code{-1} is returned. If @var{verbosity} is @code{TRUE} the result is written to the output stream @var{out}. @emph{Notice:} This test uses global variables to store counters. Thus it is not thread save. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_test_count_urn} @deftypefn {} {int} unur_test_count_urn (UNUR_GEN* @var{generator}, int @var{samplesize}, int @var{verbosity}, FILE* @var{out}) Count used uniform random numbers. It returns the total number of uniform random numbers required for a sample of non-uniform random variates of size @var{samplesize}. In case of an error @code{-1} is returned. If @var{verbosity} is @code{TRUE} the result is written to the output stream @var{out}. @emph{Notice:} This test uses global variables to store counters. Thus it is not thread save. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_test_count_pdf} @deftypefn Function {int} unur_test_count_pdf (UNUR_GEN* @var{generator}, int @var{samplesize}, int @var{verbosity}, FILE* @var{out}) Count evaluations of PDF and similar functions. It returns the total number of evaluations of all such functions required for a sample of non-uniform random variates of size @var{samplesize}. If @var{verbosity} is @code{TRUE} then a more detailed report is printed to the output stream @var{out}. In case of an error @code{-1} is returned. This test is run on a copy of the given generator object. @emph{Notice:} The printed numbers of evaluation should be interpreted with care. For example, methods either use the PDF or the logPDF; if only the logPDF is given, but a method needs the PDF then both the logPDF and the PDF (a wrapper around the logPDF) are called and thus one call to the PDF is counted twice. @emph{Notice:} This test uses global variables to store function pointers and counters. Thus it is not thread save. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_test_count_pdf} @deftypefn {} {int} unur_test_count_pdf (UNUR_GEN* @var{generator}, int @var{samplesize}, int @var{verbosity}, FILE* @var{out}) Count evaluations of PDF and similar functions. It returns the total number of evaluations of all such functions required for a sample of non-uniform random variates of size @var{samplesize}. If @var{verbosity} is @code{TRUE} then a more detailed report is printed to the output stream @var{out}. In case of an error @code{-1} is returned. This test is run on a copy of the given generator object. @emph{Notice:} The printed numbers of evaluation should be interpreted with care. For example, methods either use the PDF or the logPDF; if only the logPDF is given, but a method needs the PDF then both the logPDF and the PDF (a wrapper around the logPDF) are called and thus one call to the PDF is counted twice. @emph{Notice:} This test uses global variables to store function pointers and counters. Thus it is not thread save. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_test_par_count_pdf} @deftypefn Function {int} unur_test_par_count_pdf (UNUR_PAR* @var{parameters}, int @var{samplesize}, int @var{verbosity}, FILE* @var{out}) Same as @ifhtml @ref{funct:unur_test_count_pdf,@command{unur_test_count_pdf}} @end ifhtml @ifnothtml @command{unur_test_count_pdf} @end ifnothtml except that it is run on a parameter object. Thus it also prints the number of function evaluations for the setup. The temporary created generator object is destroyed before the results are returned. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_test_par_count_pdf} @deftypefn {} {int} unur_test_par_count_pdf (UNUR_PAR* @var{parameters}, int @var{samplesize}, int @var{verbosity}, FILE* @var{out}) Same as @ifhtml @ref{funct:unur_test_count_pdf,@command{unur_test_count_pdf}} @end ifhtml @ifnothtml @command{unur_test_count_pdf} @end ifnothtml except that it is run on a parameter object. Thus it also prints the number of function evaluations for the setup. The temporary created generator object is destroyed before the results are returned. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_test_chi2} @deftypefn Function {double} unur_test_chi2 (UNUR_GEN* @var{generator}, int @var{intervals}, int @var{samplesize}, int @var{classmin}, int @var{verbosity}, FILE* @var{out}) Run a Chi^2 test with the @var{generator}. The resulting p-value is returned. It works with discrete und continuous univariate distributions. For the latter the CDF of the distribution is required. @var{intervals} is the number of intervals that is used for continuous univariate distributions. @var{samplesize} is the size of the sample that is used for testing. If it is set to @code{0} then a sample of size @var{intervals}^2 is used (bounded to some upper bound). @var{classmin} is the minimum number of expected entries per class. If a class has to few entries then some classes are joined. @var{verbosity} controls the output of the routine. If it is set to @code{1} then the result is written to the output stream @var{out}. If it is set to @code{2} additionally the list of expected and observed data is printed. If it is set to @code{3} then all generated numbers are printed. There is no output when it is set to @code{0}. @emph{Notice:} For multivariate distributions the generated points are transformed by the inverse of the Cholesky factor of the covariance matrix and the mean vectors (if given for the underlying distribution). The marginal distributions of the transformed vectors are then tested against the marginal distribution given by a @ifhtml @ref{funct:unur_distr_cvec_set_marginals,@command{unur_distr_cvec_set_marginals}} @end ifhtml @ifnothtml @command{unur_distr_cvec_set_marginals} @end ifnothtml or @ifhtml @ref{funct:unur_distr_cvec_set_marginal_array,@command{unur_distr_cvec_set_marginal_array}} @end ifhtml @ifnothtml @command{unur_distr_cvec_set_marginal_array} @end ifnothtml call. (Notice that these marginal distributions are never set by default for any of the distributions provided by UNU.RAN.) Then the Bonferroni corrected p-value of all these tests is returned. However, the test may not be performed correctly if the domain of the underlying distribution is truncated by a @ifhtml @ref{funct:unur_distr_cvec_set_domain_rect,@command{unur_distr_cvec_set_domain_rect}} @end ifhtml @ifnothtml @command{unur_distr_cvec_set_domain_rect} @end ifnothtml call and the components of the distribution are correlated (i.e. @ifhtml @ref{funct:unur_distr_cvec_set_covar,@command{unur_distr_cvec_set_covar}} @end ifhtml @ifnothtml @command{unur_distr_cvec_set_covar} @end ifnothtml is called with the non-NULL argument). Then it almost surely will fail. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_test_chi2} @deftypefn {} {double} unur_test_chi2 (UNUR_GEN* @var{generator}, int @var{intervals}, int @var{samplesize}, int @var{classmin}, int @var{verbosity}, FILE* @var{out}) Run a Chi^2 test with the @var{generator}. The resulting p-value is returned. It works with discrete und continuous univariate distributions. For the latter the CDF of the distribution is required. @var{intervals} is the number of intervals that is used for continuous univariate distributions. @var{samplesize} is the size of the sample that is used for testing. If it is set to @code{0} then a sample of size @var{intervals}^2 is used (bounded to some upper bound). @var{classmin} is the minimum number of expected entries per class. If a class has to few entries then some classes are joined. @var{verbosity} controls the output of the routine. If it is set to @code{1} then the result is written to the output stream @var{out}. If it is set to @code{2} additionally the list of expected and observed data is printed. If it is set to @code{3} then all generated numbers are printed. There is no output when it is set to @code{0}. @emph{Notice:} For multivariate distributions the generated points are transformed by the inverse of the Cholesky factor of the covariance matrix and the mean vectors (if given for the underlying distribution). The marginal distributions of the transformed vectors are then tested against the marginal distribution given by a @ifhtml @ref{funct:unur_distr_cvec_set_marginals,@command{unur_distr_cvec_set_marginals}} @end ifhtml @ifnothtml @command{unur_distr_cvec_set_marginals} @end ifnothtml or @ifhtml @ref{funct:unur_distr_cvec_set_marginal_array,@command{unur_distr_cvec_set_marginal_array}} @end ifhtml @ifnothtml @command{unur_distr_cvec_set_marginal_array} @end ifnothtml call. (Notice that these marginal distributions are never set by default for any of the distributions provided by UNU.RAN.) Then the Bonferroni corrected p-value of all these tests is returned. However, the test may not be performed correctly if the domain of the underlying distribution is truncated by a @ifhtml @ref{funct:unur_distr_cvec_set_domain_rect,@command{unur_distr_cvec_set_domain_rect}} @end ifhtml @ifnothtml @command{unur_distr_cvec_set_domain_rect} @end ifnothtml call and the components of the distribution are correlated (i.e. @ifhtml @ref{funct:unur_distr_cvec_set_covar,@command{unur_distr_cvec_set_covar}} @end ifhtml @ifnothtml @command{unur_distr_cvec_set_covar} @end ifnothtml is called with the non-NULL argument). Then it almost surely will fail. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_test_moments} @deftypefn Function {int} unur_test_moments (UNUR_GEN* @var{generator}, double* @var{moments}, int @var{n_moments}, int @var{samplesize}, int @var{verbosity}, FILE* @var{out}) Computes the first @var{n_moments} central moments for a sample of size @var{samplesize}. The result is stored into the array @var{moments}. @var{n_moments} must be an integer between @code{1} and @code{4}. For multivariate distributions the moments are stored consecutively for each dimension and the provided @var{moments}-array must have a length of at least (@var{n_moments}+1) * @var{dim}, where @var{dim} is the dimension of the multivariate distribution. The @var{m}'th moment for the @var{d}'th dimension (0<=@var{d}<@var{dim}) is thus stored in the array element @var{moments}[@var{d}*@var{n_moments}+@var{m}] If @var{verbosity} is @code{TRUE} the result is written to the output stream @var{out}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_test_moments} @deftypefn {} {int} unur_test_moments (UNUR_GEN* @var{generator}, double* @var{moments}, int @var{n_moments}, int @var{samplesize}, int @var{verbosity}, FILE* @var{out}) Computes the first @var{n_moments} central moments for a sample of size @var{samplesize}. The result is stored into the array @var{moments}. @var{n_moments} must be an integer between @code{1} and @code{4}. For multivariate distributions the moments are stored consecutively for each dimension and the provided @var{moments}-array must have a length of at least (@var{n_moments}+1) * @var{dim}, where @var{dim} is the dimension of the multivariate distribution. The @var{m}'th moment for the @var{d}'th dimension (0<=@var{d}<@var{dim}) is thus stored in the array element @var{moments}[@var{d}*@var{n_moments}+@var{m}] If @var{verbosity} is @code{TRUE} the result is written to the output stream @var{out}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_test_correlation} @deftypefn Function {double} unur_test_correlation (UNUR_GEN* @var{generator1}, UNUR_GEN* @var{generator2}, int @var{samplesize}, int @var{verbosity}, FILE* @var{out}) Compute the correlation coefficient between streams from @var{generator1} and @var{generator2} for two samples of size @var{samplesize}. The resultung correlation is returned. If @var{verbosity} is @code{TRUE} the result is written to the output stream @var{out}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_test_correlation} @deftypefn {} {double} unur_test_correlation (UNUR_GEN* @var{generator1}, UNUR_GEN* @var{generator2}, int @var{samplesize}, int @var{verbosity}, FILE* @var{out}) Compute the correlation coefficient between streams from @var{generator1} and @var{generator2} for two samples of size @var{samplesize}. The resultung correlation is returned. If @var{verbosity} is @code{TRUE} the result is written to the output stream @var{out}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_test_quartiles} @deftypefn Function {int} unur_test_quartiles (UNUR_GEN* @var{generator}, double* @var{q0}, double* @var{q1}, double* @var{q2}, double* @var{q3}, double* @var{q4}, int @var{samplesize}, int @var{verbosity}, FILE* @var{out}) Estimate quartiles of sample of size @var{samplesize}. The resulting quantiles are stored in the variables @var{q}: @table @var @item q0 minimum @item q1 25% @item q2 median (50%) @item q3 75% @item q4 maximum @end table If @var{verbosity} is @code{TRUE} the result is written to the output stream @var{out}. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_test_quartiles} @deftypefn {} {int} unur_test_quartiles (UNUR_GEN* @var{generator}, double* @var{q0}, double* @var{q1}, double* @var{q2}, double* @var{q3}, double* @var{q4}, int @var{samplesize}, int @var{verbosity}, FILE* @var{out}) Estimate quartiles of sample of size @var{samplesize}. The resulting quantiles are stored in the variables @var{q}: @table @var @item q0 minimum @item q1 25% @item q2 median (50%) @item q3 75% @item q4 maximum @end table If @var{verbosity} is @code{TRUE} the result is written to the output stream @var{out}. @end deftypefn @end ifnotinfo @ifinfo @anchor{funct:unur_test_u_error} @deftypefn Function {double} unur_test_u_error (const @var{UNUR_GEN* generator}, double* @var{max_error}, double* @var{MAE}, double @var{threshold}, int @var{samplesize}, int @var{randomized}, int @var{testtails}, int @var{verbosity}, FILE* @var{out}) Estimate U-error of an inversion method, i.e. @math{error = | CDF^(-1)(U) - U |} , by means of a simple Monte Carlo method. Maximum and mean absolute errors are stored in @var{max_error} and @var{MAE}, respectively. The particular computed U-errors should not exceed the given @var{threshold}. However, approximization and round-off errors might occasionally trigger such an event. Thus the function returns a penalty score. It is @code{0.} when the U-error never exceed the @var{threshold} value. It roughly gives the portion of particular test points where the U-error is too larger. However, each such event is weighted with @math{1 + 10 x(uerror - threshold) / threshold} . If @var{randomized} is @code{TRUE} a pseudo-random sequence is used for the estimation. If @var{randomized} is @code{FALSE} then the U-values are choosen equidistributed. If in addition @var{randomized} is set to @code{TRUE} then the tails of the distributions are tested with a more dense set of points. If @var{verbosity} is @code{TRUE} the result is written to the output stream @var{out}. When the domain of the distribution is truncated then the u-error might be larger due to rescaling of floating point numbers. Thus the observed u-errors are corrected by the corresponding rescaling factor. The test also works for discrete distributions albeit with some restrictions: It does not work correctly with truncated distributions and the @var{testtails} flag is ignored. Moreover, the value stored in @var{MAE} is rather useless. In case of an error a negative value is returned. @end deftypefn @end ifinfo @ifnotinfo @anchor{funct:unur_test_u_error} @deftypefn {} {double} unur_test_u_error (const @var{UNUR_GEN* generator}, double* @var{max_error}, double* @var{MAE}, double @var{threshold}, int @var{samplesize}, int @var{randomized}, int @var{testtails}, int @var{verbosity}, FILE* @var{out}) Estimate U-error of an inversion method, i.e. @iftex @math{error = | CDF^{-1}(U) - U |} @end iftex @ifhtml @html error = | CDF-1(U) - U | @end html @end ifhtml , by means of a simple Monte Carlo method. Maximum and mean absolute errors are stored in @var{max_error} and @var{MAE}, respectively. The particular computed U-errors should not exceed the given @var{threshold}. However, approximization and round-off errors might occasionally trigger such an event. Thus the function returns a penalty score. It is @code{0.} when the U-error never exceed the @var{threshold} value. It roughly gives the portion of particular test points where the U-error is too larger. However, each such event is weighted with @iftex @math{1 + 10 \times (uerror - threshold) / threshold} @end iftex @ifhtml @html 1 + 10 x(uerror - threshold) / threshold @end html @end ifhtml . If @var{randomized} is @code{TRUE} a pseudo-random sequence is used for the estimation. If @var{randomized} is @code{FALSE} then the U-values are choosen equidistributed. If in addition @var{randomized} is set to @code{TRUE} then the tails of the distributions are tested with a more dense set of points. If @var{verbosity} is @code{TRUE} the result is written to the output stream @var{out}. When the domain of the distribution is truncated then the u-error might be larger due to rescaling of floating point numbers. Thus the observed u-errors are corrected by the corresponding rescaling factor. The test also works for discrete distributions albeit with some restrictions: It does not work correctly with truncated distributions and the @var{testtails} flag is ignored. Moreover, the value stored in @var{MAE} is rather useless. In case of an error a negative value is returned. @end deftypefn @end ifnotinfo @c @c end of unuran_tests.h @c ------------------------------------- @c ------------------------------------- @c misc.dh @c @node Misc @chapter Miscelleanous @menu * Math:: Mathematics @end menu @c @c end of misc.dh @c ------------------------------------- @c ------------------------------------- @c umath.h @c @node Math @section Mathematics The following macros have been defined @ftable @code @item UNUR_INFINITY indicates infinity for floating point numbers (of type @code{double}). Internally @code{HUGE_VAL} is used. @item INT_MAX @itemx INT_MIN indicate infinity and minus infinity, resp., for integers (defined by ISO C standard). @item @code{TRUE} @itemx @code{FALSE} bolean expression for return values of @code{set} functions. @end ftable @c @c end of umath.h @c ------------------------------------- @c ------------------------------------- @c arvag.dh @c @node RVG @appendix A Short Introduction to Random Variate Generation @menu * Inversion:: The Inversion Method * Rejection:: The Rejection Method * Composition:: The Composition Method * Ratio-of-Uniforms:: The Ratio-of-Uniforms Method * DiscreteInversion:: Inversion for Discrete Distributions * IndexedSearch:: Indexed Search (Guide Table Method) @end menu Random variate generation is the small field of research that deals with algorithms to generate random variates from various distributions. It is common to assume that a uniform random number generator is available. This is a program that produces a sequence of independent and identically distributed continuous @iftex @math{U(0,1)} @end iftex @ifhtml @html U(0,1) @end html @end ifhtml @ifinfo @math{U(0,1)} @end ifinfo random variates (i.e. uniform random variates on the interval @iftex @math{(0,1)} @end iftex @ifhtml @html (0,1) @end html @end ifhtml @ifinfo @math{(0,1)} @end ifinfo ). Of course real world computers can never generate ideal random numbers and they cannot produce numbers of arbitrary precision but state-of-the-art uniform random number generators come close to this aim. Thus random variate generation deals with the problem of transforming such a sequence of @iftex @math{U(0,1)} @end iftex @ifhtml @html U(0,1) @end html @end ifhtml @ifinfo @math{U(0,1)} @end ifinfo random numbers into non-uniform random variates. Here we shortly explain the basic ideas of the @emph{inversion}, @emph{rejection}, and the @emph{ratio of uniforms} method. How these ideas can be used to design a particular automatic random variate generation algorithms that can be applied to large classes of distributions is shortly explained in the description of the different methods included in this manual. For a deeper treatment of the ideas presented here, for other basic methods and for automatic generators we refer the interested reader to our book [HLD04]. @c @c end of arvag.dh @c ------------------------------------- @c ------------------------------------- @c arvag.dh @c @node Inversion @section The Inversion Method When the inverse @iftex @math{F^{-1}} @end iftex @ifhtml @html F-1 @end html @end ifhtml @ifinfo @math{F^(-1)} @end ifinfo of the cumulative distribution function is known, then random variate generation is easy. We just generate a uniformly @iftex @math{U(0,1)} @end iftex @ifhtml @html U(0,1) @end html @end ifhtml @ifinfo @math{U(0,1)} @end ifinfo distributed random number @iftex @math{U} @end iftex @ifhtml @html U @end html @end ifhtml @ifinfo @math{U} @end ifinfo and return @iftex @quotation @math{X=F^{-1}(U).} @end quotation @end iftex @ifhtml @quotation @html X=F-1(U). @end html @end quotation @end ifhtml @ifinfo @quotation @math{X=F^(-1)(U).} @end quotation @end ifinfo @noindent The following figure shows how the inversion method works for the exponential distribution. @image{figures/inversion} This algorithm is so simple that inversion is certainly the method of choice if the inverse CDF is available in closed form. This is the case e.g. for the exponential and the Cauchy distribution. The inversion method also has other special advantages that make it even more attractive for simulation purposes. It preserves the structural properties of the underlying uniform pseudo-random number generator. Consequently it can be used, e.g., for variance reduction techniques, it is easy to sample from truncated distributions, from marginal distributions, and from order statistics. Moreover, the quality of the generated random variables depends only on the underlying uniform (pseudo-) random number generator. Another important advantage of the inversion method is that we can easily characterize its performance. To generate one random variate we always need exactly one uniform variate and one evaluation of the inverse CDF. So its speed mainly depends on the costs for evaluating the inverse CDF. Hence inversion is often considered as the method of choice in the simulation literature. Unfortunately computing the inverse CDF is, for many important standard distributions (e.g. for normal, student, gamma, and beta-distributions), comparatively difficult and slow. Often no such routines are available in standard programming libraries. Then numerical methods for inverting the CDF are necessary, e.g. Newton's method or (polynomial or rational) approximations of the inverse CDF. Such procedures, however, have the disadvantage that they are not exact and/or slow. UNU.RAN implements several methods: NINV (@pxref{NINV}), HINV (@pxref{HINV}) and PINV (@pxref{PINV}). For such approximate inversion methods the approximation error is important for the quality of the generated point set. Let @iftex @math{X=G^{-1}(U)} @end iftex @ifhtml @html X=G-1(U) @end html @end ifhtml @ifinfo @math{X=G^(-1)(U)} @end ifinfo denote the approximate inverse CDF, and let @iftex @math{F} @end iftex @ifhtml @html F @end html @end ifhtml @ifinfo @math{F} @end ifinfo and @iftex @math{F^{-1}} @end iftex @ifhtml @html F-1 @end html @end ifhtml @ifinfo @math{F^(-1)} @end ifinfo be the exact CDF and inverse CDF of the distribution, resp. There are three measures for the approximation error: @table @emph @item u-error is given by @iftex @quotation @math{uerror = |U-F(G^{-1}(U))|} @end quotation @end iftex @ifhtml @quotation @html uerror = |U-F(G-1(U))| @end html @end quotation @end ifhtml @ifinfo @quotation @math{uerror = |U-F(G^(-1)(U))|} @end quotation @end ifinfo @noindent Goodness-of-fit tests like the Kolmogorov-Smirnov test or the chi-squared test look at this type of error. We are also convinced that it is the most suitable error measure for Monte Carlo simulations as pseudo-random numbers and points of low discrepancy sets are located on a grid of restricted resolution. @item x-error is given by @iftex @quotation @math{absolute xerror = |F^{-1}(U)-G^{-1}(U)|} @end quotation @end iftex @ifhtml @quotation @html absolute xerror = |F-1(U)-G-1(U)| @end html @end quotation @end ifhtml @ifinfo @quotation @math{absolute xerror = |F^(-1)(U)-G^(-1)(U)|} @end quotation @end ifinfo @noindent @iftex @quotation @math{relative xerror = |F^{-1}(U)-G^{-1}(U)|\cdot |F^{-1}(U)|} @end quotation @end iftex @ifhtml @quotation @html relative xerror = |F-1(U)-G-1(U)| * |F-1(U)| @end html @end quotation @end ifhtml @ifinfo @quotation @math{relative xerror = |F^(-1)(U)-G^(-1)(U)| * |F^(-1)(U)|} @end quotation @end ifinfo @noindent The x-error measure the deviation of @iftex @math{G^{-1}(U)} @end iftex @ifhtml @html G-1(U) @end html @end ifhtml @ifinfo @math{G^(-1)(U)} @end ifinfo from the exact result. This measure is suitable when the inverse CDF is used as a quantile function in some computations. The main problem with the x-error is that we have to use the @emph{absolute x-error} for @iftex @math{X=F^{-1}(U)} @end iftex @ifhtml @html X=F-1(U) @end html @end ifhtml @ifinfo @math{X=F^(-1)(U)} @end ifinfo close to zero and the @emph{relative x-error} in the tails. @end table We use the terms @emph{u-resolution} and @emph{x-resolution} as the maximal tolerated u-error and x-error, resp. UNU.RAN allows to set u-resolution and x-resolution independently. Both requirements must be fulfilled. We use the following strategy for checking whether the precision goal is reached: @table @emph @item checking u-error: The u-error must be slightly smaller than the given u-resolution: @iftex @quotation @math{|U-F(G^{-1}(U))| < 0.9\cdot uresolution.} @end quotation @end iftex @ifhtml @quotation @html |U-F(G-1(U))| < 0.9 * uresolution. @end html @end quotation @end ifhtml @ifinfo @quotation @math{|U-F(G^(-1)(U))| < 0.9 * uresolution.} @end quotation @end ifinfo @noindent There is no necessity to consinder the relative u-error as we have @iftex @math{0 < U < 1.} @end iftex @ifhtml @html 0 < U < 1. @end html @end ifhtml @ifinfo @math{0 < U < 1.} @end ifinfo @item checking x-error: We combine absoute and relative x-error and use the criterion @iftex @quotation @math{|F^{-1}(U)-G^{-1}(U)| < xresolution \cdot (|G^{-1}(U)| + xresolution).} @end quotation @end iftex @ifhtml @quotation @html |F-1(U)-G-1(U)| < xresolution * (|G-1(U)| + xresolution). @end html @end quotation @end ifhtml @ifinfo @quotation @math{|F^(-1)(U)-G^(-1)(U)| < xresolution * (|G^(-1)(U)| + xresolution).} @end quotation @end ifinfo @noindent @end table @strong{Remark:} It should be noted here that the criterion based on the u-error is too stringent whereever the CDF is extremely steep (and thus the PDF has a pole or a high and narrow peak). This is in particular a problem for distributions with a pole (e.g., the gamma distribution with shape parameter less than 0.5). On the other hand using a criterion based on the x-error causes problems whereever the CDF is extremly flat. This is in particular the case in the (far) tails of heavy-tailed distributions (e.g., for the Cauchy distribution). @c @c end of arvag.dh @c ------------------------------------- @c ------------------------------------- @c arvag.dh @c @node Rejection @section The Rejection Method The rejection method, often called @emph{acceptance-rejection method}, has been suggested by John von Neumann in 1951. Since then it has proven to be the most flexible and most efficient method to generate variates from continuous distributions. We explain the rejection principle first for the density @iftex @math{f(x) = sin(x)/2} @end iftex @ifhtml @html f(x) = sin(x)/2 @end html @end ifhtml @ifinfo @math{f(x) = sin(x)/2} @end ifinfo on the interval @iftex @math{(0,\pi).} @end iftex @ifhtml @html (0, pi). @end html @end ifhtml @ifinfo @math{(0, pi).} @end ifinfo To generate random variates from this distribution we also can sample random points that are uniformly distributed in the region between the graph of @iftex @math{f(x)} @end iftex @ifhtml @html f(x) @end html @end ifhtml @ifinfo @math{f(x)} @end ifinfo and the @i{x}-axis, i.e., the shaded region in the below figure. @image{figures/rejection_from_constant_hat} In general this is not a trivial task but in this example we can easily use the rejection trick: Sample a random point @iftex @math{(X,Y)} @end iftex @ifhtml @html (X,Y) @end html @end ifhtml @ifinfo @math{(X,Y)} @end ifinfo uniformly in the bounding rectangle @iftex @math{(0,\pi)\times(0,0.5).} @end iftex @ifhtml @html (0, pi)x(0,0.5). @end html @end ifhtml @ifinfo @math{(0, pi)x(0,0.5).} @end ifinfo This is easy since each coordinate can be sampled independently from the respective uniform distributions @iftex @math{U(0,\pi)} @end iftex @ifhtml @html U(0, pi) @end html @end ifhtml @ifinfo @math{U(0, pi)} @end ifinfo and @iftex @math{U(0,0.5).} @end iftex @ifhtml @html U(0,0.5). @end html @end ifhtml @ifinfo @math{U(0,0.5).} @end ifinfo Whenever the point falls into the shaded region below the graph (indicated by dots in the figure), i.e., when @iftex @math{Y < sin(X)/2,} @end iftex @ifhtml @html Y < sin(X)/2, @end html @end ifhtml @ifinfo @math{Y < sin(X)/2,} @end ifinfo we accept it and return @iftex @math{X} @end iftex @ifhtml @html X @end html @end ifhtml @ifinfo @math{X} @end ifinfo as a random variate from the distribution with density @iftex @math{f(x).} @end iftex @ifhtml @html f(x). @end html @end ifhtml @ifinfo @math{f(x).} @end ifinfo Otherwise we have to reject the point (indicated by small circles in the figure), and try again. It is quite clear that this idea works for every distribution with a bounded density on a bounded domain. Moreover, we can use this procedure with any multiple of the density, i.e., with any positive bounded function with bounded integral and it is not necessary to know the integral of this function. So we use the term density in the sequel for any positive function with bounded integral. From the figure we can conclude that the performance of a rejection algorithm depends heavily on the area of the enveloping rectangle. Moreover, the method does not work if the target distribution has infinite tails (or is unbounded). Hence non-rectangular shaped regions for the envelopes are important and we have to solve the problem of sampling points uniformly from such domains. Looking again at the example above we notice that the @i{x}-coordinate of the random point @iftex @math{(X,Y)} @end iftex @ifhtml @html (X,Y) @end html @end ifhtml @ifinfo @math{(X,Y)} @end ifinfo was sampled by inversion from the uniform distribution on the domain of the given density. This motivates us to replace the density of the uniform distribution by the (multiple of a) density @iftex @math{h(x)} @end iftex @ifhtml @html h(x) @end html @end ifhtml @ifinfo @math{h(x)} @end ifinfo of some other appropriate distribution. We only have to take care that it is chosen such that it is always an upper bound, i.e., @iftex @math{h(x)\geq f(x)} @end iftex @ifhtml @html h(x) >= f(x) @end html @end ifhtml @ifinfo @math{h(x) >= f(x)} @end ifinfo for all @iftex @math{x} @end iftex @ifhtml @html x @end html @end ifhtml @ifinfo @math{x} @end ifinfo in the domain of the distribution. To generate the pair @iftex @math{(X,Y)} @end iftex @ifhtml @html (X,Y) @end html @end ifhtml @ifinfo @math{(X,Y)} @end ifinfo we generate @iftex @math{X} @end iftex @ifhtml @html X @end html @end ifhtml @ifinfo @math{X} @end ifinfo from the distribution with density proportional to @iftex @math{h(x)} @end iftex @ifhtml @html h(x) @end html @end ifhtml @ifinfo @math{h(x)} @end ifinfo and @iftex @math{Y} @end iftex @ifhtml @html Y @end html @end ifhtml @ifinfo @math{Y} @end ifinfo uniformly between @iftex @math{0} @end iftex @ifhtml @html 0 @end html @end ifhtml @ifinfo @math{0} @end ifinfo and @iftex @math{h(X).} @end iftex @ifhtml @html h(X). @end html @end ifhtml @ifinfo @math{h(X).} @end ifinfo The first step (generate @iftex @math{X} @end iftex @ifhtml @html X @end html @end ifhtml @ifinfo @math{X} @end ifinfo ) is usually done by inversion (@pxref{Inversion}). Thus the general rejection algorithm for a hat @iftex @math{h(x)} @end iftex @ifhtml @html h(x) @end html @end ifhtml @ifinfo @math{h(x)} @end ifinfo with inverse CDF @iftex @math{H^{-1}} @end iftex @ifhtml @html H-1 @end html @end ifhtml @ifinfo @math{H^(-1)} @end ifinfo consists of the following steps: @enumerate @item Generate a @iftex @math{U(0,1)} @end iftex @ifhtml @html U(0,1) @end html @end ifhtml @ifinfo @math{U(0,1)} @end ifinfo random number @iftex @math{U.} @end iftex @ifhtml @html U. @end html @end ifhtml @ifinfo @math{U.} @end ifinfo @item Set @iftex @math{X} @end iftex @ifhtml @html X @end html @end ifhtml @ifinfo @math{X} @end ifinfo to @iftex @math{H^{-1}(U).} @end iftex @ifhtml @html H-1(U). @end html @end ifhtml @ifinfo @math{H^(-1)(U).} @end ifinfo @item Generate a @iftex @math{U(0,1)} @end iftex @ifhtml @html U(0,1) @end html @end ifhtml @ifinfo @math{U(0,1)} @end ifinfo random number @iftex @math{V.} @end iftex @ifhtml @html V. @end html @end ifhtml @ifinfo @math{V.} @end ifinfo @item Set @iftex @math{Y} @end iftex @ifhtml @html Y @end html @end ifhtml @ifinfo @math{Y} @end ifinfo to @iftex @math{V h(X).} @end iftex @ifhtml @html V h(X). @end html @end ifhtml @ifinfo @math{V h(X).} @end ifinfo @item If @iftex @math{Y\leq f(X)} @end iftex @ifhtml @html Y <= f(X) @end html @end ifhtml @ifinfo @math{Y <= f(X)} @end ifinfo accept @iftex @math{X} @end iftex @ifhtml @html X @end html @end ifhtml @ifinfo @math{X} @end ifinfo as the random variate. @item Else try again. @end enumerate If the evaluation of the density @iftex @math{f(x)} @end iftex @ifhtml @html f(x) @end html @end ifhtml @ifinfo @math{f(x)} @end ifinfo is expensive (i.e., time consuming) it is possible to use a simple lower bound of the density as so called @emph{squeeze function} @iftex @math{s(x)} @end iftex @ifhtml @html s(x) @end html @end ifhtml @ifinfo @math{s(x)} @end ifinfo (the triangular shaped function in the above figure is an example for such a squeeze). We can then accept @iftex @math{X} @end iftex @ifhtml @html X @end html @end ifhtml @ifinfo @math{X} @end ifinfo when @iftex @math{Y\leq s(X)} @end iftex @ifhtml @html Y <= s(X) @end html @end ifhtml @ifinfo @math{Y <= s(X)} @end ifinfo and can thus often save the evaluation of the density. We have seen so far that the rejection principle leads to short and simple generation algorithms. The main practical problem to apply the rejection algorithm is the search for a good fitting hat function and for squeezes. We do not discuss these topics here as they are the heart of the different automatic algorithms implemented in UNU.RAN. Information about the construction of hat and squeeze can therefore be found in the descriptions of the methods. The performance characteristics of rejection algorithms mainly depend on the fit of the hat and the squeeze. It is not difficult to prove that: @itemize @bullet @item The expected number of trials to generate one variate is the ratio between the area below the hat and the area below the density. @item The expected number of evaluations of the density necessary to generate one variate is equal to the ratio between the area below the hat and the area below the density, when no squeeze is used. Otherwise, when a squeeze is given it is equal to the ratio between the area between hat and squeeze and the area below the hat. @item The @code{sqhratio} (i.e., the ratio between the area below the squeeze and the area below the hat) used in some of the UNU.RAN methods is easy to compute. It is useful as its reciprocal is an upper bound for the expected number of trials of the rejection algoritm. The expected number of evaluations of the density is bounded by @iftex @math{(1/sqhratio)-1.} @end iftex @ifhtml @html (1/sqhratio)-1. @end html @end ifhtml @ifinfo @math{(1/sqhratio)-1.} @end ifinfo @end itemize @c @c end of arvag.dh @c ------------------------------------- @c ------------------------------------- @c arvag.dh @c @node Composition @section The Composition Method The composition method is an important principle to facilitate and speed up random variate generation. The basic idea is simple. To generate random variates with a given density we first split the domain of the density into subintervals. Then we select one of these randomly with probabilities given by the area below the density in the respective subintervals. Finally we generate a random variate from the density of the selected part by inversion and return it as random variate of the full distribution. Composition can be combined with rejection. Thus it is possible to decompose the domain of the distribution into subintervals and to construct hat and squeeze functions seperatly in every subinterval. The area below the hat must be determined in every subinterval. Then the Composition rejection algorithm contains the following steps: @enumerate @item Generate the index @iftex @math{J} @end iftex @ifhtml @html J @end html @end ifhtml @ifinfo @math{J} @end ifinfo of the subinterval as the realisation of a discrete random variate with probabilities proportional to the area below the hat. @item Generate a random variate @iftex @math{X} @end iftex @ifhtml @html X @end html @end ifhtml @ifinfo @math{X} @end ifinfo proportional to the hat in interval @iftex @math{J.} @end iftex @ifhtml @html J. @end html @end ifhtml @ifinfo @math{J.} @end ifinfo @item Generate the @iftex @math{U(0,f(X))} @end iftex @ifhtml @html U(0,f(X)) @end html @end ifhtml @ifinfo @math{U(0,f(X))} @end ifinfo random number @iftex @math{Y.} @end iftex @ifhtml @html Y. @end html @end ifhtml @ifinfo @math{Y.} @end ifinfo @item If @iftex @math{Y\leq f(X)} @end iftex @ifhtml @html Y <= f(X) @end html @end ifhtml @ifinfo @math{Y <= f(X)} @end ifinfo accept @iftex @math{X} @end iftex @ifhtml @html X @end html @end ifhtml @ifinfo @math{X} @end ifinfo as random variate. @item Else start again with generating the index @iftex @math{J.} @end iftex @ifhtml @html J. @end html @end ifhtml @ifinfo @math{J.} @end ifinfo @end enumerate The first step can be done in constant time (i.e., independent of the number of chosen subintervals) by means of the indexed search method (@pxref{IndexedSearch}). It is possible to reduce the number of uniform random numbers required in the above algorithm by recycling the random numbers used in Step 1 and additionally by applying the principle of @emph{immediate acceptance}. For details see @ifhtml @ref{bib:HLD04,, [HLD04: Sect. 3.1]} @end ifhtml @ifnothtml [HLD04: Sect. 3.1] @end ifnothtml . @c @c end of arvag.dh @c ------------------------------------- @c ------------------------------------- @c arvag.dh @c @node Ratio-of-Uniforms @section The Ratio-of-Uniforms Method The construction of an appropriate hat function for the given density is the crucial step for constructing rejection algorithms. Equivalently we can try to find an appropriate envelope for the region between the graph of the density and the @i{x}-axis, such that we can easily sample uniformly distributed random points. This task could become easier if we can find transformations that map the region between the density and the axis into a region of more suitable shape (for example into a bounded region). As a first example we consider the following simple algorithm for the Cauchy distribution. @enumerate @item Generate a @iftex @math{U(-1,1)} @end iftex @ifhtml @html U(-1,1) @end html @end ifhtml @ifinfo @math{U(-1,1)} @end ifinfo random number @iftex @math{U} @end iftex @ifhtml @html U @end html @end ifhtml @ifinfo @math{U} @end ifinfo and a @iftex @math{U(0,1)} @end iftex @ifhtml @html U(0,1) @end html @end ifhtml @ifinfo @math{U(0,1)} @end ifinfo random number @iftex @math{V.} @end iftex @ifhtml @html V. @end html @end ifhtml @ifinfo @math{V.} @end ifinfo @item If @iftex @math{U^2 + V^2\leq 1} @end iftex @ifhtml @html U2 + V2 <= 1 @end html @end ifhtml @ifinfo @math{U^2 + V^2 <= 1} @end ifinfo accept @iftex @math{X=U/V} @end iftex @ifhtml @html X=U/V @end html @end ifhtml @ifinfo @math{X=U/V} @end ifinfo as a Cauchy random variate. @item Else try again. @end enumerate It is possible to prove that the above algorithm indeed generates Cauchy random variates. The fundamental principle behind this algorithm is the fact that the region below the density is mapped by the transformation @iftex @quotation @math{(X,Y)\mapsto(U,V)=(2\,X\sqrt{Y},2\,\sqrt{Y})} @end quotation @end iftex @ifhtml @quotation @html (X,Y) -> (U,V)=(2 Xsqrt(Y),2 sqrt(Y)) @end html @end quotation @end ifhtml @ifinfo @quotation @math{(X,Y) -> (U,V)=(2 Xsqrt(Y),2 sqrt(Y))} @end quotation @end ifinfo @noindent into a half-disc in such a way that the ratio between the area of the image to the area of the preimage is constant. This is due to the fact that that the Jacobian of this transformation is constant. @image{figures/rou-cauchy} The above example is a special case of a more general principle, called the @emph{Ratio-of-uniforms (RoU) method}. It is based on the fact that for a random variable @iftex @math{X} @end iftex @ifhtml @html X @end html @end ifhtml @ifinfo @math{X} @end ifinfo with density @iftex @math{f(x)} @end iftex @ifhtml @html f(x) @end html @end ifhtml @ifinfo @math{f(x)} @end ifinfo and some constant @iftex @math{\mu} @end iftex @ifhtml @html mu @end html @end ifhtml @ifinfo @math{mu} @end ifinfo we can generate @iftex @math{X} @end iftex @ifhtml @html X @end html @end ifhtml @ifinfo @math{X} @end ifinfo from the desired density by calculating @iftex @math{X=U/V+\mu} @end iftex @ifhtml @html X=U/V+ mu @end html @end ifhtml @ifinfo @math{X=U/V+ mu} @end ifinfo for a pair @iftex @math{(U,V)} @end iftex @ifhtml @html (U,V) @end html @end ifhtml @ifinfo @math{(U,V)} @end ifinfo uniformly distributed in the set @iftex @quotation @math{A_f=\lbrace (u,v)\colon 0 < v \leq \sqrt{f(u/v+\mu)}\rbrace .} @end quotation @end iftex @ifhtml @quotation @html A_f= @{ (u,v) : 0 < v <= sqrt(f(u/v+ mu)) @} . @end html @end quotation @end ifhtml @ifinfo @quotation @math{A_f= @{ (u,v) : 0 < v <= sqrt(f(u/v+ mu)) @} .} @end quotation @end ifinfo @noindent For most distributions it is best to set the constant @iftex @math{\mu} @end iftex @ifhtml @html mu @end html @end ifhtml @ifinfo @math{mu} @end ifinfo equal to the mode of the distribution. For sampling random points uniformly distributed in @iftex @math{A_f} @end iftex @ifhtml @html A_f @end html @end ifhtml @ifinfo @math{A_f} @end ifinfo rejection from a convenient enveloping region is used, usually the minimal bounding rectangle, i.e., the smallest possible rectangle that contains @iftex @math{A_f} @end iftex @ifhtml @html A_f @end html @end ifhtml @ifinfo @math{A_f} @end ifinfo (see the above figure). It is given by @iftex @math{(u^-,u^+)\times (0,v^+)} @end iftex @ifhtml @html (u-,u+)x(0,v+) @end html @end ifhtml @ifinfo @math{(u^-,u^+)x(0,v^+)} @end ifinfo where @iftex @quotation @math{ v^+ = \sup\limits_{b_lv+ = sup_b_l<x<b_r sqrt(f(x)), @*u- = inf_b_l<x<b_r (x- mu) sqrt(f(x)), @*u+ = sup_b_l<x<b_r (x- mu) sqrt(f(x)). @end html @end quotation @end ifhtml @ifinfo @quotation @math{v^+ = sup_(b_lU(u-,u+) @end html @end ifhtml @ifinfo @math{U(u^-,u^+)} @end ifinfo random number @iftex @math{U} @end iftex @ifhtml @html U @end html @end ifhtml @ifinfo @math{U} @end ifinfo and a @iftex @math{U(0,v^+)} @end iftex @ifhtml @html U(0,v+) @end html @end ifhtml @ifinfo @math{U(0,v^+)} @end ifinfo random number @iftex @math{V.} @end iftex @ifhtml @html V. @end html @end ifhtml @ifinfo @math{V.} @end ifinfo @item Set @iftex @math{X} @end iftex @ifhtml @html X @end html @end ifhtml @ifinfo @math{X} @end ifinfo to @iftex @math{U/V+\mu.} @end iftex @ifhtml @html U/V+ mu. @end html @end ifhtml @ifinfo @math{U/V+ mu.} @end ifinfo @item If @iftex @math{V^2 \leq f(X)} @end iftex @ifhtml @html V2 <= f(X) @end html @end ifhtml @ifinfo @math{V^2 <= f(X)} @end ifinfo accept @iftex @math{X} @end iftex @ifhtml @html X @end html @end ifhtml @ifinfo @math{X} @end ifinfo as the random variate. @item Else try again. @end enumerate To apply the ratio-of-uniforms algorithm to a certain density we have to solve the simple optimization problems in the definitions above to obtain the design constants @iftex @math{u^-,} @end iftex @ifhtml @html u-, @end html @end ifhtml @ifinfo @math{u^-,} @end ifinfo @iftex @math{u^+,} @end iftex @ifhtml @html u+, @end html @end ifhtml @ifinfo @math{u^+,} @end ifinfo and @iftex @math{v^+.} @end iftex @ifhtml @html v+. @end html @end ifhtml @ifinfo @math{v^+.} @end ifinfo This simple algorithm works for all distributions with bounded densities that have subquadratic tails (i.e., tails like @iftex @math{1/x^2} @end iftex @ifhtml @html 1/x2 @end html @end ifhtml @ifinfo @math{1/x^2} @end ifinfo or lower). For most standard distributions it has quite good rejection constants. (E.g. 1.3688 for the normal and 1.4715 for the exponential distribution.) Nevertheless, we use more sophisticated method that construct better fitting envelopes, like method AROU (@pxref{AROU}), or even avoid the computation of these design constants and thus have almost no setup, like method SROU (@pxref{SROU}). @subheading The Generalized Ratio-of-Uniforms Method The Ratio-of-Uniforms method can be generalized: If a point @iftex @math{(U,V)} @end iftex @ifhtml @html (U,V) @end html @end ifhtml @ifinfo @math{(U,V)} @end ifinfo is uniformly distributed in the set @iftex @quotation @math{A_f=\lbrace (u,v)\colon 0 < v \leq (f(u/v^r+\mu))^{1/(r+1)}\rbrace } @end quotation @end iftex @ifhtml @quotation @html A_f= @{ (u,v) : 0 < v <= (f(u/vr+ mu))1/(r+1) @} @end html @end quotation @end ifhtml @ifinfo @quotation @math{A_f= @{ (u,v) : 0 < v <= (f(u/v^r+ mu))^(1/(r+1)) @}} @end quotation @end ifinfo @noindent then @iftex @math{X=U/V^r+\mu} @end iftex @ifhtml @html X=U/Vr+ mu @end html @end ifhtml @ifinfo @math{X=U/V^r+ mu} @end ifinfo has the denity @iftex @math{f(x).} @end iftex @ifhtml @html f(x). @end html @end ifhtml @ifinfo @math{f(x).} @end ifinfo The minimal bounding rectangle of this region is given by @iftex @math{(u^-,u^+)\times (0,v^+)} @end iftex @ifhtml @html (u-,u+)x(0,v+) @end html @end ifhtml @ifinfo @math{(u^-,u^+)x(0,v^+)} @end ifinfo where @iftex @quotation @math{ v^+ = \sup\limits_{b_lv+ = sup_b_l<x<b_r (f(x))1/(r+1), @*u- = inf_b_l<x<b_r (x- mu) (f(x))r/(r+1), @*u+ = sup_b_l<x<b_r (x- mu) (f(x))r/(r+1). @end html @end quotation @end ifhtml @ifinfo @quotation @math{v^+ = sup_(b_lr=1. @end html @end ifhtml @ifinfo @math{r=1.} @end ifinfo @c @c end of arvag.dh @c ------------------------------------- @c ------------------------------------- @c arvag.dh @c @node DiscreteInversion @section Inversion for Discrete Distributions We have already presented the idea of the inversion method to generate from continuous random variables (@pxref{Inversion}). For a discrete random variable @iftex @math{X} @end iftex @ifhtml @html X @end html @end ifhtml @ifinfo @math{X} @end ifinfo we can write it mathematically in the same way: @iftex @quotation @math{X=F^{-1}(U),} @end quotation @end iftex @ifhtml @quotation @html X=F-1(U), @end html @end quotation @end ifhtml @ifinfo @quotation @math{X=F^(-1)(U),} @end quotation @end ifinfo @noindent where @iftex @math{F} @end iftex @ifhtml @html F @end html @end ifhtml @ifinfo @math{F} @end ifinfo is the CDF of the desired distribution and @iftex @math{U} @end iftex @ifhtml @html U @end html @end ifhtml @ifinfo @math{U} @end ifinfo is a uniform @iftex @math{U(0,1)} @end iftex @ifhtml @html U(0,1) @end html @end ifhtml @ifinfo @math{U(0,1)} @end ifinfo random number. The difference compared to the continuous case is that @iftex @math{F} @end iftex @ifhtml @html F @end html @end ifhtml @ifinfo @math{F} @end ifinfo is now a step-function. The following figure illustrates the idea of discrete inversion for a simple distribution. @image{figures/discrete_inversion} To realize this idea on a computer we have to use a search algorithm. For the simplest version called @emph{Sequential Search} the CDF is computed on-the-fly as sum of the probabilities @iftex @math{p(k),} @end iftex @ifhtml @html p(k), @end html @end ifhtml @ifinfo @math{p(k),} @end ifinfo since this is usually much cheaper than computing the CDF directly. It is obvious that the basic form of the search algorithm only works for discrete random variables with probability mass functions @iftex @math{p(k)} @end iftex @ifhtml @html p(k) @end html @end ifhtml @ifinfo @math{p(k)} @end ifinfo for nonnegative @iftex @math{k.} @end iftex @ifhtml @html k. @end html @end ifhtml @ifinfo @math{k.} @end ifinfo The sequential search algorithm consists of the following basic steps: @enumerate @item Generate a @iftex @math{U(0,1)} @end iftex @ifhtml @html U(0,1) @end html @end ifhtml @ifinfo @math{U(0,1)} @end ifinfo random number @iftex @math{U.} @end iftex @ifhtml @html U. @end html @end ifhtml @ifinfo @math{U.} @end ifinfo @item Set @iftex @math{X} @end iftex @ifhtml @html X @end html @end ifhtml @ifinfo @math{X} @end ifinfo to @iftex @math{0} @end iftex @ifhtml @html 0 @end html @end ifhtml @ifinfo @math{0} @end ifinfo and @iftex @math{P} @end iftex @ifhtml @html P @end html @end ifhtml @ifinfo @math{P} @end ifinfo to @iftex @math{p(0).} @end iftex @ifhtml @html p(0). @end html @end ifhtml @ifinfo @math{p(0).} @end ifinfo @item Do while @iftex @math{U > P} @end iftex @ifhtml @html U > P @end html @end ifhtml @ifinfo @math{U > P} @end ifinfo @item @w{ } @w{ } @w{ } Set @iftex @math{X} @end iftex @ifhtml @html X @end html @end ifhtml @ifinfo @math{X} @end ifinfo to @iftex @math{X+1} @end iftex @ifhtml @html X+1 @end html @end ifhtml @ifinfo @math{X+1} @end ifinfo and @iftex @math{P} @end iftex @ifhtml @html P @end html @end ifhtml @ifinfo @math{P} @end ifinfo to @iftex @math{P+p(X).} @end iftex @ifhtml @html P+p(X). @end html @end ifhtml @ifinfo @math{P+p(X).} @end ifinfo @item Return @iftex @math{X.} @end iftex @ifhtml @html X. @end html @end ifhtml @ifinfo @math{X.} @end ifinfo @end enumerate With the exception of some very simple discrete distributions, sequential search algorithms become very slow as the while-loop has to be repeated very often. The expected number of iterations, i.e., the number of comparisons in the while condition, is equal to the expectation of the distribution plus @iftex @math{1.} @end iftex @ifhtml @html 1. @end html @end ifhtml @ifinfo @math{1.} @end ifinfo It can therefore become arbitrary large or even infinity if the tail of the distribution is very heavy. Another serious problem can be critical round-off errors due to summing up many probabilities @iftex @math{p(k).} @end iftex @ifhtml @html p(k). @end html @end ifhtml @ifinfo @math{p(k).} @end ifinfo To speed up the search procedure it is best to use indexed search. @c @c end of arvag.dh @c ------------------------------------- @c ------------------------------------- @c arvag.dh @c @node IndexedSearch @section Indexed Search (Guide Table Method) The idea to speed up the sequential search algorithm is easy to understand. Instead of starting always at @iftex @math{0} @end iftex @ifhtml @html 0 @end html @end ifhtml @ifinfo @math{0} @end ifinfo we store a table of size @iftex @math{C} @end iftex @ifhtml @html C @end html @end ifhtml @ifinfo @math{C} @end ifinfo with starting points for our search. For this table we compute @iftex @math{F^{-1}(U)} @end iftex @ifhtml @html F-1(U) @end html @end ifhtml @ifinfo @math{F^(-1)(U)} @end ifinfo for @iftex @math{C} @end iftex @ifhtml @html C @end html @end ifhtml @ifinfo @math{C} @end ifinfo equidistributed values of @iftex @math{U,} @end iftex @ifhtml @html U, @end html @end ifhtml @ifinfo @math{U,} @end ifinfo i.e., for @iftex @math{u_i = i/C,} @end iftex @ifhtml @html u_i = i/C, @end html @end ifhtml @ifinfo @math{u_i = i/C,} @end ifinfo @iftex @math{i=0,...,C-1.} @end iftex @ifhtml @html i=0,...,C-1. @end html @end ifhtml @ifinfo @math{i=0,...,C-1.} @end ifinfo Such a table is called @emph{guide table} or @emph{hash table}. Then it is easy to prove that for every @iftex @math{U} @end iftex @ifhtml @html U @end html @end ifhtml @ifinfo @math{U} @end ifinfo in @iftex @math{(0,1)} @end iftex @ifhtml @html (0,1) @end html @end ifhtml @ifinfo @math{(0,1)} @end ifinfo the guide table entry for @iftex @math{k=floor(UC)} @end iftex @ifhtml @html k=floor(UC) @end html @end ifhtml @ifinfo @math{k=floor(UC)} @end ifinfo is bounded by @iftex @math{F^{-1}(U).} @end iftex @ifhtml @html F-1(U). @end html @end ifhtml @ifinfo @math{F^(-1)(U).} @end ifinfo This shows that we can really start our sequential search procedure from the table entry for @iftex @math{k} @end iftex @ifhtml @html k @end html @end ifhtml @ifinfo @math{k} @end ifinfo and the index @iftex @math{k} @end iftex @ifhtml @html k @end html @end ifhtml @ifinfo @math{k} @end ifinfo of the correct table entry can be found rapidly by means of the truncation operation. The two main differences between @emph{indexed search} and @emph{sequential search} are that we start searching at the number determined by the guide table, and that we have to compute and store the cumulative probabilities in the setup as we have to know the cumulative probability for the starting point of the search algorithm. The rounding problems that can occur in the sequential search algorithm can occur here as well. Compared to sequential search we have now the obvious drawback of a slow setup. The computation of the cumulative probabilities grows linear with the size of the domain of the distribution @iftex @math{L.} @end iftex @ifhtml @html L. @end html @end ifhtml @ifinfo @math{L.} @end ifinfo What we gain is really high speed as the marginal execution time of the sampling algorithm becomes very small. The expected number of comparisons is bounded by @iftex @math{1+L/C.} @end iftex @ifhtml @html 1+L/C. @end html @end ifhtml @ifinfo @math{1+L/C.} @end ifinfo This shows that there is a trade-off between speed and the size of the guide table. Cache-effects in modern computers will however slow down the speed-up for really large table sizes. Thus we recommend to use a guide table that is about two times larger than the probability vector to obtain optimal speed. @c @c end of arvag.dh @c ------------------------------------- @c ------------------------------------- @c glossary.dh @c @node Glossary @appendix Glossary @table @strong @item CDF cumulative distribution function. @item HR hazard rate (or failure rate). @item inverse local concavity local concavity of inverse PDF @iftex @math{f^{-1}(y)} @end iftex @ifhtml @html f-1(y) @end html @end ifhtml @ifinfo @math{f^(-1)(y)} @end ifinfo expressed in term of @iftex @math{x = f^{-1}(y).} @end iftex @ifhtml @html x = f-1(y). @end html @end ifhtml @ifinfo @math{x = f^(-1)(y).} @end ifinfo Is is given by @iftex @math{ilc_f(x) = 1 + x\,f''(x) / f'(x)} @end iftex @ifhtml @html ilc_f(x) = 1 + x f''(x) / f'(x) @end html @end ifhtml @ifinfo @math{ilc_f(x) = 1 + x f''(x) / f'(x)} @end ifinfo @item local concavity maximum value of @i{c} such that PDF @i{f(x)} is @iftex @math{T_c.} @end iftex @ifhtml @html T_c. @end html @end ifhtml @ifinfo @math{T_c.} @end ifinfo Is is given by @iftex @math{lc_f(x) = 1 - f''(x)\,f(x) / f'(x)^2} @end iftex @ifhtml @html lc_f(x) = 1 - f''(x) f(x) / f'(x)2 @end html @end ifhtml @ifinfo @math{lc_f(x) = 1 - f''(x) f(x) / f'(x)^2} @end ifinfo @item PDF probability density function. @item dPDF derivative (gradient) of probability density function. @item PMF probability mass function. @item PV (finite) probability vector. @item URNG uniform random number generator. @item @math{U(a,b)} continuous uniform distribution on the interval @iftex @math{(a,b).} @end iftex @ifhtml @html (a,b). @end html @end ifhtml @ifinfo @math{(a,b).} @end ifinfo @item T-concave a function @i{f(x)} is called @i{T}-convace if the transformed function @i{T(f(x))} is concave. We only deal with transformations @iftex @math{T_c,} @end iftex @ifhtml @html T_c, @end html @end ifhtml @ifinfo @math{T_c,} @end ifinfo where @table @code @item @i{c} = 0 @iftex @math{T(x) = \log(x)} @end iftex @ifhtml @html T(x) = log(x) @end html @end ifhtml @ifinfo @math{T(x) = log(x)} @end ifinfo @item @i{c} = @math{-0.5} @iftex @math{T(x) = -1/\sqrt{x}} @end iftex @ifhtml @html T(x) = -1/sqrt(x) @end html @end ifhtml @ifinfo @math{T(x) = -1/sqrt(x)} @end ifinfo @item @i{c} != 0 @iftex @math{T(x) = sign(x) \cdot x^c} @end iftex @ifhtml @html T(x) = sign(x) * xc @end html @end ifhtml @ifinfo @math{T(x) = sign(x) * x^c} @end ifinfo @end table @item u-error for a given approximate inverse CDF @iftex @math{X=G^{-1}(U)} @end iftex @ifhtml @html X=G-1(U) @end html @end ifhtml @ifinfo @math{X=G^(-1)(U)} @end ifinfo the u-error is given as @iftex @quotation @math{uerror = |U-F(G^{-1}(U))|} @end quotation @end iftex @ifhtml @quotation @html uerror = |U-F(G-1(U))| @end html @end quotation @end ifhtml @ifinfo @quotation @math{uerror = |U-F(G^(-1)(U))|} @end quotation @end ifinfo @noindent where @iftex @math{F} @end iftex @ifhtml @html F @end html @end ifhtml @ifinfo @math{F} @end ifinfo denotes the exact CDF. Goodness-of-fit tests like the Kolmogorov-Smirnov test or the chi-squared test look at this type of error. See @ref{Inversion} for more details. @item u-resolution the maximal tolerated u-error for an approximate inverse CDF. @item x-error for a given approximate inverse CDF @iftex @math{X=G^{-1}(U)} @end iftex @ifhtml @html X=G-1(U) @end html @end ifhtml @ifinfo @math{X=G^(-1)(U)} @end ifinfo the x-error is given as @iftex @quotation @math{xerror = |F^{-1}(U)-G^{-1}(U)|} @end quotation @end iftex @ifhtml @quotation @html xerror = |F-1(U)-G-1(U)| @end html @end quotation @end ifhtml @ifinfo @quotation @math{xerror = |F^(-1)(U)-G^(-1)(U)|} @end quotation @end ifinfo @noindent where @iftex @math{F^{-1}} @end iftex @ifhtml @html F-1 @end html @end ifhtml @ifinfo @math{F^(-1)} @end ifinfo denotes the exact inverse CDF. The x-error measure the deviation of @iftex @math{G^{-1}(U)} @end iftex @ifhtml @html G-1(U) @end html @end ifhtml @ifinfo @math{G^(-1)(U)} @end ifinfo from the exact result. Notice that we have to distinguish between @emph{absolute} and @emph{relative} x-error. In UNU.RAN we use the absolute x-error near 0 and the relative x-error otherwise. See @ref{Inversion} for more details. @item x-resolution the maximal tolerated x-error for an approximate inverse CDF. @end table @c @c end of glossary.dh @c ------------------------------------- @c ------------------------------------- @c references.dh @c @node Bibliography @appendix Bibliography @subheading Standard Distributions @table @t @anchor{bib:JKKa92} @item [JKKa92] @sc{N.L. Johnson, S. Kotz, and A.W. Kemp} (1992). @i{Univariate Discrete Distributions}, 2nd edition, John Wiley & Sons, Inc., New York. @anchor{bib:JKBb94} @item [JKBb94] @sc{N.L. Johnson, S. Kotz, and N. Balakrishnan} (1994). @i{Continuous Univariate Distributions}, Volume 1, 2nd edition, John Wiley & Sons, Inc., New York. @anchor{bib:JKBc95} @item [JKBc95] @sc{N.L. Johnson, S. Kotz, and N. Balakrishnan} (1995). @i{Continuous Univariate Distributions}, Volume 2, 2nd edition, John Wiley & Sons, Inc., New York. @anchor{bib:JKBd97} @item [JKBd97] @sc{N.L. Johnson, S. Kotz, and N. Balakrishnan} (1997). @i{Discrete Multivariate Distributions}, John Wiley & Sons, Inc., New York. @anchor{bib:KBJe00} @item [KBJe00] @sc{S. Kotz, N. Balakrishnan, and N.L. Johnson} (2000). @i{Continuous Multivariate Distributions}, Volume 1: Models and Applications, John Wiley & Sons, Inc., New York. @end table @c ------------------------------------------------------- @subheading Universal Methods -- Surveys @table @t @anchor{bib:HLD04} @item [HLD04] @sc{W. H@"ormann, J. Leydold, and G. Derflinger} (2004). @i{Automatic Nonuniform Random Variate Generation}, Springer, Berlin. @end table @c ------------------------------------------------------- @subheading Universal Methods @table @t @anchor{bib:AJa93} @item [AJa93] @sc{J.H. Ahrens} (1993). @i{Sampling from general distributions by suboptimal division of domains}, Grazer Math. Berichte 319, 30pp. @anchor{bib:AJa95} @item [AJa95] @sc{J.H. Ahrens} (1995). @i{An one-table method for sampling from continuous and discrete distributions}, Computing 54(2), pp. 127-146. @anchor{bib:CAa74} @item [CAa74] @sc{H.C. Chen and Y. Asau} (1974). @i{On generating random variates from an empirical distribution}, AIIE Trans. 6, pp. 163-166. @anchor{bib:DHLa08} @item [DHLa08] @sc{G. Derflinger, W. H@"ormann, and J. Leydold} (2008). @i{Numerical inversion when only the density function is known}, Research Report Series of the Department of Statistics and Mathematics 78, WU Wien, Augasse 2--6, A-1090 Wien, Austria, @uref{http://epub.wu.ac.at/english/}. @anchor{bib:DLa86} @item [DLa86] @sc{L. Devroye} (1986). @i{Non-Uniform Random Variate Generation}, Springer Verlag, New York. @anchor{bib:GWa92} @item [GWa92] @sc{W.R. Gilks and P. Wild} (1992). @i{Adaptive rejection sampling for Gibbs sampling}, Applied Statistics 41, pp. 337-348. @anchor{bib:HWa95} @item [HWa95] @sc{W. H@"ormann} (1995). @i{A rejection technique for sampling from T-concave distributions}, ACM Trans. Math. Software 21(2), pp. 182-193. @anchor{bib:HDa96} @item [HDa96] @sc{W. H@"ormann and G. Derflinger} (1996). @i{Rejection-inversion to generate variates from monotone discrete distributions}, ACM TOMACS 6(3), 169-184. @anchor{bib:HLa00} @item [HLa00] @sc{W. H@"ormann and J. Leydold} (2000). @i{Automatic random variate generation for simulation input.} In: J.A. Joines, R. Barton, P. Fishwick, K. Kang (eds.), Proceedings of the 2000 Winter Simulation Conference, pp. 675-682. @anchor{bib:HLa03} @item [HLa03] @sc{W. H@"ormann and J. Leydold} (2003). @i{Continuous Random Variate Generation by Fast Numerical Inversion}, ACM TOMACS 13(4), 347-362. @anchor{bib:HLDa07} @item [HLDa07] @sc{W. H@"ormann, J. Leydold, and G. Derflinger} (2007). @i{Automatic Random Variate Generation for Unbounded Densities}, ACM Trans. Model. Comput. Simul. 17(4), pp.18. @anchor{bib:KLPa05} @item [KLPa05] @sc{R. Karawatzki, J. Leydold, and K. P@"otzelberger} (2005). @i{Automatic Markov chain Monte Carlo procedures for sampling from multivariate distributions}, Research Report Series of the Department of Statistics and Mathematics 27, WU Wien, Augasse 2--6, A-1090 Wien, Austria, @uref{http://epub.wu.ac.at/english/}. @anchor{bib:LJa98} @item [LJa98] @sc{J. Leydold} (1998). @i{A Rejection Technique for Sampling from Log-Concave Multivariate Distributions}, ACM TOMACS 8(3), pp. 254-280. @anchor{bib:LJa00} @item [LJa00] @sc{J. Leydold} (2000). @i{Automatic Sampling with the Ratio-of-Uniforms Method}, ACM Trans. Math. Software 26(1), pp. 78-98. @anchor{bib:LJa01} @item [LJa01] @sc{J. Leydold} (2001). @i{A simple universal generator for continuous and discrete univariate T-concave distributions}, ACM Trans. Math. Software 27(1), pp. 66-82. @anchor{bib:LJa02} @item [LJa02] @sc{J. Leydold} (2003). @i{Short universal generators via generalized ratio-of-uniforms method}, Math. Comp. 72(243), pp. 1453-1471. @anchor{bib:WGS91} @item [WGS91] @sc{J.C. Wakefield, A.E. Gelfand, and A.F.M. Smith} (1992). @i{Efficient generation of random variates via the ratio-of-uniforms method}, Statist. Comput. 1(2), pp. 129-133. @anchor{bib:WAa77} @item [WAa77] @sc{A.J. Walker} (1977). @i{An efficient method for generating discrete random variables with general distributions}, ACM Trans. Math. Software 3, pp. 253-256. @end table @c ------------------------------------------------------- @subheading Special Generators @table @t @anchor{bib:ADa74} @item [ADa74] @sc{J.H. Ahrens, U. Dieter} (1974). @i{Computer methods for sampling from gamma, beta, Poisson and binomial distributions}, Computing 12, 223-246. @anchor{bib:ADa82} @item [ADa82] @sc{J.H. Ahrens, U. Dieter} (1982). @i{Generating gamma variates by a modified rejection technique}, Communications of the ACM 25, 47-54. @anchor{bib:ADb82} @item [ADb82] @sc{J.H. Ahrens, U. Dieter} (1982). @i{Computer generation of Poisson deviates from modified normal distributions}, ACM Trans. Math. Software 8, 163-179. @anchor{bib:BMa58} @item [BMa58] @sc{G.E.P. Box and M.E. Muller} (1958). @i{A note on the generation of random normal deviates}, Annals Math. Statist. 29, 610-611. @anchor{bib:CHa77} @item [CHa77] @sc{R.C.H. Cheng} (1977). @i{The Generation of Gamma Variables with Non-Integral Shape Parameter}, Appl. Statist. 26(1), 71-75. @anchor{bib:Dag89} @item [Dag89] @sc{J.S. Dagpunar} (1989). @i{An Easily Implemented Generalised Inverse Gaussian Generator}, Commun. Statist. Simul. 18(2), 703-710. @anchor{bib:HDa90} @item [HDa90] @sc{W. H@"ormann and G. Derflinger} (1990). @i{The ACR Method for generating normal random variables}, OR Spektrum 12, 181-185. @anchor{bib:KAa81} @item [KAa81] @sc{A.W. Kemp} (1981). @i{Efficient generation of logarithmically distributed pseudo-random variables}, Appl. Statist. 30, 249-253. @anchor{bib:KRa76} @item [KRa76] @sc{A.J. Kinderman and J.G. Ramage} (1976). @i{Computer Generation of Normal Random Variables}, J. Am. Stat. Assoc. 71(356), 893 - 898. @anchor{bib:MJa87} @item [MJa87] @sc{J.F. Monahan} (1987). @i{An algorithm for generating chi random variables}, ACM Trans. Math. Software 13, 168-172. @anchor{bib:MGa62} @item [MGa62] @sc{G. Marsaglia} (1962). @i{Improving the Polar Method for Generating a Pair of Random Variables}, Boeing Sci. Res. Lab., Seattle, Washington. @anchor{bib:MOa84} @item [MOa84] @sc{G. Marsaglia and I. Olkin} (1984). @i{Generating Correlation Matrices}, SIAM J. Sci. Stat. Comput 5, 470-475. @anchor{bib:STa89} @item [STa89] @sc{E. Stadlober} (1989). @i{Sampling from Poisson, binomial and hypergeometric distributions: ratio of uniforms as a simple and fast alternative}, Bericht 303, Math. Stat. Sektion, Forschungsgesellschaft Joanneum, Graz. @anchor{bib:ZHa94} @item [ZHa94] @sc{H. Zechner} (1994). @i{Efficient sampling from continuous and discrete unimodal distributions}, Pd.D. Thesis, 156 pp., Technical University Graz, Austria. @end table @c ------------------------------------------------------- @subheading Other references @table @t @anchor{bib:CPa76} @item [CPa76] @sc{R. Cranley and T.N.L. Patterson} (1976). @i{Randomization of number theoretic methods for multiple integration}, SIAM J. Num. Anal., Vol. 13, pp. 904-914. @anchor{bib:HJa61} @item [HJa61] @sc{R. Hooke and T.A. Jeeves} (1961). @i{Direct Search Solution of Numerical and Statistical Problems}, Journal of the ACM, Vol. 8, April 1961, pp. 212-229. @end table @c ------------------------------------------------------- @c @c end of references.dh @c ------------------------------------- @c ------------------------------------- @c index.dh @c @node FIndex @appendix Function Index @printindex fn @c @c end of index.dh @c ------------------------------------- unuran-1.11.0/doc/src/ref_example0.texi0000644001357500135600000000530014430713446014637 00000000000000/* ------------------------------------------------------------- */ /* File: example0.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ int main(void) @{ int i; /* loop variable */ double x; /* will hold the random number */ /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Use a predefined standard distribution: */ /* Gaussian with mean zero and standard deviation 1. */ /* Since this is the standard form of the distribution, */ /* we need not give these parameters. */ distr = unur_distr_normal(NULL, 0); /* Use method AUTO: */ /* Let UNURAN select a suitable method for you. */ par = unur_auto_new(distr); /* Now you can change some of the default settings for the */ /* parameters of the chosen method. We don't do it here. */ /* Create the generator object. */ gen = unur_init(par); /* Notice that this call has also destroyed the parameter */ /* object `par' as a side effect. */ /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) @{ fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); @} /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the standard Gaussian distribution. */ /* Eg.: */ for (i=0; i<10; i++) @{ x = unur_sample_cont(gen); printf("%f\n",x); @} /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); @} /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/doc/src/ref_example_gsl.texi0000644001357500135600000000524714430713446015436 00000000000000/* ------------------------------------------------------------- */ /* File: example_gsl.c */ /* ------------------------------------------------------------- */ #ifdef UNURAN_SUPPORTS_GSL /* ------------------------------------------------------------- */ /* This example makes use of the GSL library for generating */ /* uniform random numbers. */ /* (see http://www.gnu.org/software/gsl/) */ /* To compile this example you must have set */ /* ./configure --with-urng-gsl */ /* (Of course the executable has to be linked against the */ /* GSL library.) */ /* ------------------------------------------------------------- */ /* Include UNURAN header files. */ #include #include /* ------------------------------------------------------------- */ int main(void) @{ int i; /* loop variable */ double x; /* will hold the random number */ /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Declare objects for uniform random number generators. */ UNUR_URNG *urng; /* uniform generator objects */ /* GNU Scientific Library only: */ /* Make a object for uniform random number generator. */ urng = unur_urng_gsl_new(gsl_rng_mt19937); if (urng == NULL) exit (EXIT_FAILURE); /* Create a generator object using this URNG */ distr = unur_distr_normal( NULL, 0 ); par = unur_tdr_new(distr); unur_set_urng( par, urng ); gen = unur_init(par); if (gen == NULL) exit (EXIT_FAILURE); unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) @{ x = unur_sample_cont(gen); printf("%f\n",x); @} /* Destroy objects */ unur_free(gen); unur_urng_free(urng); exit (EXIT_SUCCESS); @} /* end of main() */ /* ------------------------------------------------------------- */ #else #include #include int main(void) @{ printf("You must enable the GSL to run this example!\n\n"); exit (77); /* exit code for automake check routines */ @} #endif /* ------------------------------------------------------------- */ unuran-1.11.0/doc/src/ref_example_FuncStr.texi0000644001357500135600000000233014430713446016223 00000000000000/* ------------------------------------------------------------- */ /* File: example_FuncStr.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* Example how to define the PDF for a continuous univariate */ /* distribution using a function string. */ /* ------------------------------------------------------------- */ int main(void) @{ UNUR_DISTR *distr; /* distribution object */ char *pdfstr; /* Get empty distribution object for a continuous distribution */ distr = unur_distr_cont_new(); /* Set PDF using function string */ unur_distr_cont_set_pdfstr(distr,"1-x*x"); unur_distr_cont_set_domain(distr,-1.,1.); /* Read function string from distribution object */ pdfstr = unur_distr_cont_get_pdfstr(distr); printf("functionstring: %s\n",pdfstr); /* Destroy distribution object and clear memory */ unur_distr_free(distr); free (pdfstr); exit (EXIT_SUCCESS); @} /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/doc/src/methods.dh0000644001357500135600000001260714420445767013374 00000000000000/*---------------------------------------------------------------------------*/ =NODE Methods Methods for generating non-uniform random variates =UP TOP [40] =DESCRIPTION Sampling from a particular distribution with UNU.RAN requires the following steps: @enumerate @item Create a distribution object (@pxref{Distribution_objects,,Handling distribution objects}). @item Select a method and create a parameter object. @item Initizialize the generator object using unur_init(). @emph{Important}: Initialization of the generator object might fail. unur_init() returns a NULL pointer then, which @strong{must} not be used for sampling. @item Draw a sample from the generator object using the corresponding sampling function (depending on the type of distribution: univariate continuous, univariate discrete, multivariate continuous, and random matrix). @item It is possible for a generator object to change the parameters and the domain of the underlying distribution. This must be done by extracting this object by means of a unur_get_distr() call and changing the distribution using the correspondig set calls, see @ref{Distribution_objects,,Handling distribution objects}. The generator object @strong{must} then be reinitialized by means of the unur_reinit() call. @emph{Important}: Currently not all methods allow reinitialization, see the description of the particular method (keyword @i{Reinit}). @emph{Important}: Reinitialization of the generator object might fail. Thus one @strong{must} check the return code of the unur_reinit() call. @emph{Important}: When reinitialization fails then sampling routines always return @code{UNUR_INFINITY} (for continuous distributions) or @code{0} (for discrete distributions), respectively. However, it is still possible to change the underlying distribution and try to reinitialize again. @end enumerate =EON /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ =NODEX Methods_for_CONT Methods for continuous univariate distributions =UP Methods [10] =DESCRIPTION @subheading Overview of methods @include methods_cont.texi @subheading Example @smallexample @include ref_example_cont.texi @end smallexample @subheading Example (String API) @smallexample @include ref_example_cont_str.texi @end smallexample =EON /*---------------------------------------------------------------------------*/ =NODEX Methods_for_CEMP Methods for continuous empirical univariate distributions =UP Methods [20] =DESCRIPTION @subheading Overview of methods @include methods_cemp.texi @subheading Example @smallexample @include ref_example_emp.texi @end smallexample @subheading Example (String API) @smallexample @include ref_example_emp_str.texi @end smallexample =EON /*---------------------------------------------------------------------------*/ =NODEX Methods_for_CVEC Methods for continuous multivariate distributions =UP Methods [30] =DESCRIPTION @subheading Overview of methods @include methods_cvec.texi =EON /*---------------------------------------------------------------------------*/ =NODEX MCMC_Methods_for_CVEC Markov chain samplers for continuous multivariate distributions =UP Methods [35] =DESCRIPTION Markov chain samplers generate sequences of random vectors which have the target distribution as stationary distribution. There generated vectors are (more or less) correlated and it might take a long time until the sequence has converged to the given target distribution. @strong{Beware: MCMC sampling can be dangerous!} @subheading Overview of methods @include methods_mcmc.texi =EON /*---------------------------------------------------------------------------*/ =NODEX Methods_for_CVEMP Methods for continuous empirical multivariate distributions =UP Methods [40] =DESCRIPTION @subheading Overview of methods @include methods_cvemp.texi @subheading Example @smallexample @include ref_example_vemp.texi @end smallexample @subheading Example (String API) (not implemented) =EON /*---------------------------------------------------------------------------*/ =NODEX Methods_for_DISCR Methods for discrete univariate distributions =UP Methods [50] =DESCRIPTION @subheading Overview of methods @include methods_discr.texi @subheading Example @smallexample @include ref_example_discr.texi @end smallexample @subheading Example (String API) @smallexample @include ref_example_discr_str.texi @end smallexample =EON /*---------------------------------------------------------------------------*/ =NODEX Methods_for_MATR Methods for random matrices =UP Methods [60] =DESCRIPTION @subheading Overview of methods @include methods_matr.texi =EON /*---------------------------------------------------------------------------*/ =NODEX Methods_for_UNID Methods for uniform univariate distributions =UP Methods [70] =DESCRIPTION =EON /*---------------------------------------------------------------------------*/ =NODEX Meta_Methods Meta Methods for univariate distributions =UP Methods [80] =DESCRIPTION @subheading Example @smallexample @include ref_example_mixt.texi @end smallexample @subheading Example (Inversion) @smallexample @include ref_example_mixt_inv.texi @end smallexample =EON /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ unuran-1.11.0/doc/src/ref_example_reinit.texi0000644001357500135600000000726414430713446016144 00000000000000/* ------------------------------------------------------------- */ /* File: example_reinit.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* In this example we show how the parameters of the underlying */ /* distribution can be changed for an existing generator object. */ /* We use the GIG distribution with method CSTD. */ /* ------------------------------------------------------------- */ int main(void) @{ int i; /* loop variable */ double x; /* will hold the random number */ /* Parameters of distribution. */ double dparam[3] = @{0.5, 1., 5.@}; /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Create initial GIG distribution object */ distr = unur_distr_gig(dparam, 3); /* Choose a method: CSTD. */ par = unur_cstd_new(distr); /* Create the generator object. */ gen = unur_init(par); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) @{ fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); @} /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) @{ x = unur_sample_cont(gen); printf("%f\n",x); @} /* It is possible for method CSTD to change the parameters of */ /* underlying distribution. However, we have to extract to */ /* pointer to the distribution. Be carefull with this pointer! */ distr = unur_get_distr(gen); /* Change the parameter(s). */ dparam[2] = 0.001; unur_distr_cont_set_pdfparams(distr,dparam,3); /* Do not forget to reinitialize the generator object. */ /* Check the return code. */ /* (and try to find a better error handling) */ if (unur_reinit(gen) != UNUR_SUCCESS) @{ fprintf(stderr, "ERROR: cannot reinitialize generator object\n"); exit (EXIT_FAILURE); @} /* Draw a new sample. */ for (i=0; i<10; i++) @{ x = unur_sample_cont(gen); printf("%f\n",x); @} /* Changing parameters can be repeated. */ dparam[2] = 1000; unur_distr_cont_set_pdfparams(distr,dparam,3); if (unur_reinit(gen) != UNUR_SUCCESS) @{ fprintf(stderr, "ERROR: cannot reinitialize generator object\n"); exit (EXIT_FAILURE); @} for (i=0; i<10; i++) @{ x = unur_sample_cont(gen); printf("%f\n",x); @} /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); @} /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/doc/src/ref_example1.texi0000644001357500135600000000540414430713446014645 00000000000000/* ------------------------------------------------------------- */ /* File: example1.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ int main(void) @{ int i; /* loop variable */ double x; /* will hold the random number */ /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Use a predefined standard distribution: */ /* Gaussian with mean zero and standard deviation 1. */ /* Since this is the standard form of the distribution, */ /* we need not give these parameters. */ distr = unur_distr_normal(NULL, 0); /* Choose a method: AROU. */ /* For other (suitable) methods replace "arou" with the */ /* respective name (in lower case letters). */ par = unur_arou_new(distr); /* Now you can change some of the default settings for the */ /* parameters of the chosen method. We don't do it here. */ /* Create the generator object. */ gen = unur_init(par); /* Notice that this call has also destroyed the parameter */ /* object `par' as a side effect. */ /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) @{ fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); @} /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the standard Gaussian distribution. */ /* Eg.: */ for (i=0; i<10; i++) @{ x = unur_sample_cont(gen); printf("%f\n",x); @} /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); @} /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/doc/src/misc.dh0000644001357500135600000000032014420304141012625 00000000000000 /*---------------------------------------------------------------------------*/ =NODE Misc Miscelleanous =UP TOP [80] =EON /*---------------------------------------------------------------------------*/ unuran-1.11.0/doc/src/methods_matr.texi0000644001357500135600000000026714420445767014774 00000000000000@cartouche @noindent Methods for @b{matrix distributions}@* sample with @command{unur_sample_matr} @noindent MCORR: Distribution object for random correlation matrix. @end cartouche unuran-1.11.0/doc/src/methods_cont.texi0000644001357500135600000000321314420445767014766 00000000000000@cartouche @noindent Methods for @b{continuous univariate distributions}@* sample with @command{unur_sample_cont} @multitable {method} {PDF} {dPDF} {CDF} {mode} {area} {build-in standard distributionxx} @item method @tab PDF @tab dPDF @tab CDF @tab mode @tab area @tab other @item AROU @tab x @tab x @tab @tab [x] @tab @tab T-concave @item ARS @tab x @tab x @tab @tab @tab @tab T-concave @item CEXT @tab @tab @tab @tab @tab @tab wrapper for external generator @item CSTD @tab @tab @tab @tab @tab @tab build-in standard distribution @item HINV @tab [x] @tab [x] @tab x @tab @tab @tab @item HRB @tab @tab @tab @tab @tab @tab bounded hazard rate @item HRD @tab @tab @tab @tab @tab @tab decreasing hazard rate @item HRI @tab @tab @tab @tab @tab @tab increasing hazard rate @item ITDR @tab x @tab x @tab @tab x @tab @tab monotone with pole @item NINV @tab [x] @tab @tab x @tab @tab @tab @item NROU @tab x @tab @tab @tab [x] @tab @tab @item PINV @tab x @tab @tab [x] @tab [~] @tab @tab @item SROU @tab x @tab @tab @tab x @tab x @tab T-concave @item SSR @tab x @tab @tab @tab x @tab x @tab T-concave @item TABL @tab x @tab @tab @tab x @tab [~] @tab all local extrema @item TDR @tab x @tab x @tab @tab @tab @tab T-concave @item UTDR @tab x @tab @tab @tab x @tab ~ @tab T-concave @end multitable @end cartouche unuran-1.11.0/doc/src/ref_example_cont_str.texi0000644001357500135600000000531314430713446016476 00000000000000/* ------------------------------------------------------------- */ /* File: example_cont_str.c */ /* ------------------------------------------------------------- */ /* String API. */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* Example how to sample from a continuous univariate */ /* distribution. */ /* We use a generic distribution object and sample. */ /* */ /* The PDF of our distribution is given by */ /* */ /* / 1 - x*x if |x| <= 1 */ /* f(x) = < */ /* \ 0 otherwise */ /* */ /* ------------------------------------------------------------- */ int main(void) @{ int i; /* loop variable */ double x; /* will hold the random number */ /* Declare UNURAN generator object. */ UNUR_GEN *gen; /* generator object */ /* Create the generator object. */ /* Use a generic continuous distribution. */ /* Choose a method: TDR. */ gen = unur_str2gen( "distr = cont; pdf=\"1-x*x\"; domain=(-1,1); mode=0. & \ method=tdr; variant_gw; max_sqhratio=0.90; c=-0.5; \ max_intervals=100; cpoints=10"); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) @{ fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); @} /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) @{ x = unur_sample_cont(gen); printf("%f\n",x); @} /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); @} /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/doc/src/ref_example_cext.texi0000644001357500135600000001102314430713446015601 00000000000000/* ------------------------------------------------------------- */ /* File: example_cext.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* This example shows how an external generator for the */ /* exponential distribution with one scale parameter can be */ /* used within the UNURAN framework. */ /* */ /* Notice, that this example does not provide the simplest */ /* solution. */ /* ------------------------------------------------------------- */ /* Initialization routine. */ /* */ /* Here we simply read the scale parameter of the exponential */ /* distribution and store it in an array for parameters of */ /* the external generator. */ /* [ Of course we could do this in the sampling routine as */ /* and avoid the necessity of this initialization routine. ] */ int exponential_init (UNUR_GEN *gen) @{ /* Get pointer to parameters of exponential distribution */ double *params = unur_cext_get_distrparams(gen); /* The scale parameter is the first entry (see manual) */ double lambda = (params) ? params[0] : 1.; /* Get array to store this parameter for external generator */ double *genpar = unur_cext_get_params(gen, sizeof(double)); genpar[0] = lambda; /* Executed successfully */ return UNUR_SUCCESS; @} /* ------------------------------------------------------------- */ /* Sampling routine. */ /* */ /* Contains the code for the external generator. */ double exponential_sample (UNUR_GEN *gen) @{ /* Get scale parameter */ double *genpar = unur_cext_get_params(gen,0); double lambda = genpar[0]; /* Sample a uniformly distributed random number */ double U = unur_sample_urng(gen); /* Transform into exponentially distributed random variate */ return ( -log(1. - U) * lambda ); @} /* ------------------------------------------------------------- */ int main(void) @{ int i; /* loop variable */ double x; /* will hold the random number */ /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Use predefined exponential distribution with scale param. 2 */ double fpar[1] = @{ 2. @}; distr = unur_distr_exponential(fpar, 1); /* Use method CEXT */ par = unur_cext_new(distr); /* Set initialization and sampling routines. */ unur_cext_set_init(par, exponential_init); unur_cext_set_sample(par, exponential_sample); /* Create the generator object. */ gen = unur_init(par); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) @{ fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); @} /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the standard Gaussian distribution. */ /* Eg.: */ for (i=0; i<10; i++) @{ x = unur_sample_cont(gen); printf("%f\n",x); @} /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); @} /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/doc/src/index.dh0000644001357500135600000000012614420304141013005 00000000000000 =APPENDIX FIndex Function Index =UP TOP [a10] =DESCRIPTION @printindex fn =EON unuran-1.11.0/doc/src/methods_cvemp.texi0000644001357500135600000000027314420445767015140 00000000000000@cartouche @noindent Methods for @b{continuous empirical multivariate distributions}@* sample with @command{unur_sample_vec} @noindent VEMPK: Requires an observed sample. @end cartouche unuran-1.11.0/doc/src/README0000644001357500135600000002050714420445767012272 00000000000000 (*) Simple Markups and TAGs ======================= Great parts of the UNU.RAN User Manual are generated automatically from the library header files by means of the make_texi.pl script. Thus all files in the unuran tree that end in .h or .dh are scanned. (Files ending in .dh are files header files that only contains documentation.) Simple markups (TAGs) are used to indicate relevant parts. A TAG has the regular expression /^\s+=[A-Z]+/, i.e. `=' followed by some capital letters. (C comment strings `/*' are ignored.) The body of the documentation uses texinfo with some additional macros (see below). There are some switches in ./doc/src/make_texi.pl: (*) $PAGEBREAKS: When set to 1 (non-nil) pagebreaks are inserts before each =METHOD and =NODEX tag. (*) $LISTOFCALLS: When set to 1 (non-nil) lists of functions calls (with hyperlinks) are added to top of Function Reference sections in the HTML version of the manual. (*) Nodes ===== Nodes start with a node TAG and contain everything until the next =EON TAG (`End-Of-Node') or end of file. Valid node TAGs are =TOP for the top node =DISTR for handling distribution objects =METHOD for generation methods =APPENDIX for nodes in the appendix =NODE generic node =NODEX generic node, starts new page A header file that has no such TAG or with a different first TAG is ignored and not included into the documentation. Node TAGs must have two arguments: The first word is the name of the node and must be unique in the entire documentation. The remaining part of the line is treated as the node title, used for the texinfo sectioning commands. These two parts are used AS IS by texinfo. (*) Section TAGs ============ TAGs are used to scan the node and partition it into sections. A node section starts with a TAG and ends with the line before the next TAG (or end of file). It depends on the TAG how the read text is processed further. The following TAGs are valid: =END The corresponding node section is simply ignored. Thus it can be used as end markup of a subsection (thus its name). =UP Required! the first word is the super node, i.e. the node to which it is a subnode. It might be followed (optionally) by anything with the regular expression /\[\w+\]/, e.g. [14a]. It is used to sort subnodes (lexicographically ordering of the string between the brachets is used). If it is omitted the node name is used instead. =REQUIRED List of required parameters. Contains a list of parameter that are required for the method. =OPTIONAL List of optional parameters. Contains a list of parameters that are optional for the method. =SPEED Generation speed of generator method. =SEEALSO Similar methods. List of methods that work similar as this method. (not implemented yet) =ABSTRACT Abstract. A very short description of method. Used in an overview. (not implemented yet) =REF References for method or distribution. Each reference has to be enclosed in square brackets "[ ... ]". More than one reference can given; but then only white space characters are allowed to separate them. The format for the entries within the square brackets is the same as for the @unurbibref macro (see below). =PDF PDF of distribution. =PMF PMF of distribution. =CONST Area below PDF or sum over PMF. =DOMAIN Domain of PDF or PMF. =FPARAM List of parameters of distribution. Parameters must be given in the correct ordering. Every line contains a parameter. It is described by 5 fields which terminated by a colon `:'. Eg: 0 : alpha : > 0 : : shape : [1] : beta : > 0 : 1 : scale : [[2]] : gamma : : 0 : location : The first field is the number of the parameter. Square brackets are used to indicate optional parameters. In this example alpha is required. Alternative alpha and beta or alpha, beta and gamma can be provided. The second field is the name of the parameter as it is used in the =PDF, =CONSTANT and =DOMAIN subsections. The third field gives condition for the range of valid parameters. The forth field gives the default value for optional parameters, that are used when these are omitted. The last field is a short description of the parameter. =STDGEN List of special generator for (UNU.RAN) standard distributions. Each special generator must be given in one line. The first entry is the identy for the special generator as given for the unur_cstd_set_variant() and unur_dstd_set_variant() call. Use DEF and INV as abbreviations for UNUR_STDGEN_DEFAULT and UNUR_STDGEN_INVERSION, respectively. References must be given in square brackets [...] as the last entry. Anything after the references is ignored. =DESCRIPTION Discription of method. Can be used to print any text. =ROUTINES Function reference. List of all subroutines. The text is formated in the following way: lines starting with `#' are ignored. The text consists of blocks which are separated by one or more blank lines outside of C comments (everything within a C comment is treated as a single line). In particular blocks end at a `*/' followed by an empty line. IMPORTANT: A function with no description should be immediately followed by `/* */' (on the next line). All C comment markers `/*' and `*/' are removed. A block that started with a C type declaration is treated as a function prototype. Anything below the `;' till the end of the block is interpreted as the function description. An anchor will be made for each function using the key: funct., e.g. `funct.unur_set_urng' for function unur_set_urng. If there is a function prototype with additional lines, it is assumed that it has the same description as the following function. (This is done recursively until a function prototype with description is found.) A "function prototype" without any arguments (with or without braces `( )' )is treated as a variable. A block that starts with a `==DOC' is copied verbatim into the texi file. (Notice that `==DOC' is not a TAG as described above). =OBSOLETE Functions that are obsolete and not documented any more, but are still in the code for compatibility should be put after this tag. Notice that the regular expression for finding this tag is {/\*\s*=OBSOLETE.*$}. Everything after this tag is removed (and is not even part of the string API). (*) Common Transformation Rules =========================== To avoid spoiling the header file with to many texinfo tags, the following transformations are made during file procession: NULL --> @code{NULL} TRUE --> @code{TRUE} FALSE --> @code{FALSE} (\w+)\(\) --> @command($1) eg.: unur_set_urng() --> @command{unur_set_urng}. additionally hyperlinks are made automatically to its definition in HTML output (and in TeX and info with some restrictions). NOTICE: there must not be blanks between the function name and `(' or the braces! to insert C comment sign into a header file use @cc_start --> /* @cc_stop --> */ (*) Special Bibtex Macros ===================== There are a few additional texinfo macros. These start with @unur and are expanded by the make_texi.pl script and not passed directly to makeinfo. @unurbibref makes a reference to a book or journal listed in references.dh. It only contains one such reference. If more references are necessary then a series of such macros is needed. The entry must be the corresponding anchor in the reference.dh file. (The format in this file should be clear from the other entries that already exist.) Additional remarks, like "Sect.5" or "p.234" can follow but must be separated by a colon ":". You are not allowed to use a curly bracket "{" or "}". A comma "," is automatically replaced by a semicolon. (These restrictions are due to texinfo). @unurimage same as @image. But it will be easier to add vertical spaces later. @unurmath same as @math. But we can use a more sophisticated typesetting (once upon a time in the future). Warning: making documantation fails when unknown TeX macros appears, i.e., whenever new macros are used the make_texi.pl script must be modified (see function transform_tex()). There are some differences to plain TeX: - use LaTeX-style \\ for new line (line break) Notice: a trailing point or comma should be inside this macro to avoid strang formating. @unurmathdisplay diplaymode analog of @unurmath. unuran-1.11.0/doc/src/ref_example_mixt_inv.texi0000644001357500135600000000611314430713446016477 00000000000000/* ------------------------------------------------------------- */ /* File: example_mixt_inv.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* Mixture of truncated Gaussian on (-INFINITY,0] and */ /* Exponential distribution on [0,INFINITY) */ /* ------------------------------------------------------------- */ int main(void) @{ /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *comp[2]; /* array of generator objects (components)*/ UNUR_GEN *gen; /* generator object for mixture */ double prob[2]; /* array of probabilities */ int i; /* loop variable */ double x; /* will hold the random number */ /* Create generators for components */ distr = unur_distr_normal(NULL,0); /* Gaussian distribution */ unur_distr_cont_set_domain(distr,-UNUR_INFINITY,0); par = unur_pinv_new(distr); /* choose method PINV */ comp[0] = unur_init(par); /* initialize */ unur_distr_free(distr); /* free distribution obj. */ distr = unur_distr_exponential(NULL,0); /* Exponential distr. */ par = unur_pinv_new(distr); /* choose method PINV */ comp[1] = unur_init(par); /* initialize */ unur_distr_free(distr); /* free distribution obj. */ /* Probabilities for components (need not sum to 1) */ prob[0] = 0.4; prob[1] = 0.3; /* Create mixture */ par = unur_mixt_new(2,prob,comp); /* We want to use inversion for the mixture as well. */ /* (Thus the above order of the components is important!) */ unur_mixt_set_useinversion(par,TRUE); /* Initialize generator object */ gen = unur_init(par); /* we do not need the components any more */ for (i=0; i<2; i++) unur_free(comp[i]); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) @{ fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); @} /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) @{ x = unur_sample_cont(gen); printf("%f\n",x); @} /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); @} /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/doc/src/stddist.dh0000644001357500135600000001157514420445767013412 00000000000000 /*---------------------------------------------------------------------------*/ =NODE Stddist UNU.RAN Library of standard distributions =UP TOP [55] =DESCRIPTION Although it is not its primary target, many distributions are already implemented in UNU.RAN. This section presents these available distributions and their parameters. The syntax to get a distribuion object for distributions @code{} is: @deftypefn -- {UNUR_DISTR*} unur_distr_@code{} (double* @var{params}, int @var{n_params}) @var{params} is an array of doubles of size @var{n_params} holding the parameters. @end deftypefn @noindent E.g. to get an object for the gamma distribution (with shape parameter) use @example unur_distr_gamma( params, 1 ); @end example @noindent Distributions may have default parameters with need not be given explicitely. E.g. The gamma distribution has three parameters: the shape, scale and location parameter. Only the (first) shape parameter is required. The others can be omitted and are then set by default values. @example @cc_start alpha = 5; default: beta = 1, gamma = 0 @cc_stop double fpar[] = @{5.@}; unur_distr_gamma( fpar, 1 ); @cc_start alpha = 5, beta = 3; default: gamma = 0 @cc_stop double fpar[] = @{5., 3.@}; unur_distr_gamma( fpar, 2 ); @cc_start alpha = 5, beta = 3, gamma = -2 double fpar[] = @{5., 3., -2.@}; unur_distr_gamma( fpar, 3 ); @end example @strong{Important:} Naturally the computational accuracy limits the possible parameters. There shouldn't be problems when the parameters of a distribution are in a ``reasonable'' range but e.g. the normal distribution N(10^15,1) won't yield the desired results. (In this case it would be better generating N(0,1) and @emph{then} transform the results.) @* Of course computational inaccuracy is not specific to UNU.RAN and should always be kept in mind when working with computers. @emph{Important:} The routines of the standard library are included for non-uniform random variate generation and not to provide special functions for statistical computations. @subheading Remark The following keywords are used in the tables: @table @i @item PDF probability density function, with variable @i{x}. @item PMF probability mass function, with variable @i{k}. @item constant normalization constant for given PDF and PMF, resp. They must be multiplied by @i{constant} to get the ``real'' PDF and PMF. @item CDF gives information whether the CDF is implemented in UNU.RAN. @item domain domain PDF and PMF, resp. @item parameters @var{n_std} (@var{n_total}): @r{list} list of parameters for distribution, where @var{n_std} is the number of parameters for the standard form of the distribution and @var{n_total} the total number for the (non-standard form of the) distribution. @var{list} is the list of parameters in the order as they are stored in the array of parameters. Optional parameter that can be omitted are enclosed in square brackets @code{[@dots{}]}. A detailed list of these parameters gives then the range of valid parameters and defaults for optional parameters that are used when these are omitted. @item reference gives reference for distribution (@pxref{Bibliography}). @item special generators lists available special generators for the distribution. The first number is the variant that to be set by unur_cstd_set_variant() and unur_dstd_set_variant() call, respectively. If no variant is set the default variant @code{DEF} is used. In the table the respective abbreviations @code{DEF} and @code{INV} are used for @code{UNUR_STDGEN_DEFAULT} and @code{UNUR_STDGEN_INVERSION}. Also the references for these methods are given (@pxref{Bibliography}). Notice that these generators might be slower than universal methods. If @code{DEF} is ommited, the first entry is the default generator. @end table =EON /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ =NODEX Stddist_CONT UNU.RAN Library of continuous univariate distributions =UP Stddist [10] =EON /*---------------------------------------------------------------------------*/ =NODEX Stddist_CVEC UNU.RAN Library of continuous multivariate distributions =UP Stddist [20] =EON /*---------------------------------------------------------------------------*/ =NODEX Stddist_DISCR UNU.RAN Library of discrete univariate distributions =UP Stddist [30] =DESCRIPTION At the moment there are no CDFs implemented for discrete distribution. Thus unur_distr_discr_upd_pmfsum() does not work properly for truncated distribution. =EON /*---------------------------------------------------------------------------*/ =NODEX Stddist_MATR UNU.RAN Library of random matrices =UP Stddist [40] =EON /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ unuran-1.11.0/doc/src/installation.dh0000644001357500135600000001635114420445767014432 00000000000000 =NODE Installation Installation =UP Intro [30] =DESCRIPTION UNU.RAN was developed on an Intel architecture under Linux with the GNU C compiler but should compile and run on any computing environment. It requires an ANSI compliant C compiler. Below find the installation instructions for unices. @subsubheading Uniform random number generator UNU.RAN can be used with any uniform random number generator but (at the moment) some features work best with Pierre L'Ecuyer's RngStreams library (see @url{http://statmath.wu.ac.at/software/RngStreams/} for a description and downloading. For details on using uniform random number in UNU.RAN see @ref{URNG,,Using uniform random number generators}. Install the required libraries first. @subsubheading UNU.RAN @enumerate @item First unzip and untar the package and change to the directory: @example tar zxvf unuran-@value{VERSION}.tar.gz cd unuran-@value{VERSION} @end example @item Optional: Edit the file @file{src/unuran_config.h} @item Run a configuration script: @example sh ./configure --prefix= @end example @noindent where @code{} is the root of the installation tree. When omitted @file{/usr/local} is used. Use @code{./configure --help} to get a list of other options. In particular the following flags are important: @itemize @bullet @item Enable support for some external sources of uniform random number generators (@pxref{URNG,,Using uniform random number generators}): @table @code @item --with-urng-rngstream URNG: use Pierre L'Ecuyer's RNGSTREAM library [default=@code{no}] @item --with-urng-prng URNG: use Otmar Lendl's PRNG library [default=@code{no}] @item --with-urng-gsl URNG: use random number generators from GNU Scientific Library [default=@code{no}] @item --with-urng-default URNG: global default URNG (builtin|rngstream) [default=@code{builtin}] @end table We strongly recommend to use RngStreams library: @example sh ./configure --with-urng-rngstream --with-urng-default=rngstream @end example @emph{Important:} You must install the respective libraries @file{RngStreams}, @file{PRNG} and @file{GSL} before @code{./configure} is executed. @item Also make a shared library: @table @code @item --enable-shared build shared libraries [default=@code{no}] @end table @item The library provides the function @code{unur_gen_info} for information about generator objects. This is intented for using in interactive computing environments. This feature can be enabled / disabled by means of the configure flag @table @code @item --enable-info INFO: provide function with information about generator objects [default=@code{yes}] @end table @item Enable support for deprecated UNU.RAN routines if you have some problems with older application after upgrading the library: @table @code @item --enable-deprecated enable support for deprecated UNU.RAN routines [default=@code{no}] @end table @item Enable debugging tools: @table @code @item --enable-check-struct Debug: check validity of pointers to structures [default=@code{no}] @item --enable-logging Debug: print informations about generator into logfile [default=no] @end table @end itemize @item Compile and install the libray: @example make make install @end example @noindent Obviously @code{$(prefix)/include} and @code{$(prefix)/lib} must be in the search path of your compiler. You can use environment variables to add these directories to the search path. If you are using the bash type (or add to your profile): @example export LIBRARY_PATH="/lib" export C_INCLURE_PATH="/include" @end example @noindent If you want to make a shared library, then making such a library can be enabled using @example sh ./configure --enable-shared @end example @noindent If you want to link against the shared library make sure that it can be found when executing the binary that links to the library. If it is not installed in the usual path, then the easiest way is to set the @code{LD_LIBRARY_PATH} environment variable. See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages. @item Documentation in various formats (PDF, HTML, info, plain text) can be found in directory @file{doc}. @item You can run some tests by @example make check @end example @noindent However, some of these tests requires the usage of the PRNG or RngStreams library and are only executed if these are installed enabled by the corresponding configure flag. An extended set of tests is run by @example make fullcheck @end example @noindent However some of these might fail occasionally due to roundoff errors or the mysteries of floating point arithmetic, since we have used some extreme settings to test the library. @end enumerate @subsubheading Upgrading @itemize @minus @item @emph{Important:} UNU.RAN now relies on some aspects of IEEE 754 compliant floating point arithmetic. In particular, @code{1./0.} and @code{0./0.} must result in @code{infinity} and @code{NaN} (not a number), respectively, and must not cause a floating point exception. For allmost all modern compting architecture this is implemented in hardware. For others there should be a special compiler flag to get this feature (e.g., @code{-MIEEE} on DEC alpha or @code{-mp} for the Intel C complier). @item Upgrading UNU.RAN from version 0.9.x or earlier: With UNU.RAN version 1.0.x some of the macro definitions in file @file{src/unuran_config.h} are moved into file @file{config.h} and are set/controlled by the @code{./configure} script. Writting logging information into the logfile must now be enabled when running the configure script: @example sh ./configure --enable-logging @end example @item Upgrading UNU.RAN from version 0.7.x or earlier: With UNU.RAN version 0.8.0 the interface for changing underlying distributions and running a reinitialization routine has been simplified. The old routines can be compiled into the library using the following configure flag: @example sh ./configure --enable-deprecated @end example @noindent Notice: Using these deprecated routines is not supported any more and this strong discouraged. Wrapper functions for external sources of uniform random numbers are now enabled by configure flags and not by macros defined in file @file{src/unuran_config.h}. The file @file{src/unuran_config.h} is not installed any more. It is now only included when the library is compiled. It should be removed from the global include path of the compiler. @end itemize =EON /*---------------------------------------------------------------------------*/ unuran-1.11.0/doc/src/top.dh0000644001357500135600000001335514420445767012534 00000000000000 =TOP TOP UNU.RAN -- Universal Non-Uniform RANdom number generators =UP (dir) =DESCRIPTION @ifinfo @noindent This is the online-documentation of UNU.RAN.@* Version: @value{VERSION}@* Date: @value{UPDATED} @end ifinfo UNU.RAN (Universal Non-Uniform RAndom Number generator) is a collection of algorithms for generating non-uniform pseudorandom variates as a library of C functions designed and implemented by the ARVAG (Automatic Random VAriate Generation) project group in Vienna, and released under the GNU Public License (GPL). It is especially designed for such situations where @itemize @minus @item a non-standard distribution or a truncated distribution is needed. @item experiments with different types of distributions are made. @item random variates for variance reduction techniques are used. @item fast generators of predictable quality are necessary. @end itemize Of course it is also well suited for standard distributions. However due to its more sophisticated programming interface it might not be as easy to use if you only look for a generator for the standard normal distribution. (Although UNU.RAN provides generators that are superior in many aspects to those found in quite a number of other libraries.) UNU.RAN implements several methods for generating random numbers. The choice depends primary on the information about the distribution can be provided and -- if the user is familar with the different methods -- on the preferences of the user. The design goals of UNU.RAN are to provide @emph{reliable}, @emph{portable} and @emph{robust} (as far as this is possible) functions with a consisent and easy to use interface. It is suitable for all situation where experiments with different distributions including non-standard distributions. For example it is no problem to replace the normal distribution by an empirical distribution in a model. Since originally designed as a library for so called black-box or universal algorithms its interface is different from other libraries. (Nevertheless it also contains special generators for standard distributions.) It does not provide subroutines for random variate generation for particular distributions. Instead it uses an object-oriented interface. Distributions and generators are treated as independent objects. This approach allows one not only to have different methods for generating non-uniform random variates. It is also possible to choose the method which is optimal for a given situation (e.g. speed, quality of random numbers, using for variance reduction techniques, etc.). It also allows to sample from non-standard distribution or even from distributions that arise in a model and can only be computed in a complicated subroutine. Sampling from a particular distribution requires the following steps: @enumerate @item Create a distribution object. (Objects for standard distributions are available in the library) @item Choose a method. @item Initialize the generator, i.e., create the generator object. If the choosen method is not suitable for the given distribution (or if the distribution object contains too little information about the distribution) the initialization routine fails and produces an error message. Thus the generator object does (probably) not produce false results (random variates of a different distribution). @item Use this generator object to sample from the distribution. @end enumerate There are four types of objects that can be manipulated independently: @itemize @bullet @item @strong{Distribution objects:} hold all information about the random variates that should be generated. The following types of distributions are available: @itemize @minus @item Continuous and Discrete distributions @item Empirical distributions @item Multivariate distributions @end itemize Of course a library of standard distributions is included (and these can be further modified to get, e.g., truncated distributions). Moreover the library provides subroutines to build almost arbitrary distributions. @item @strong{Generator objects:} hold the generators for the given distributions. It is possible to build independent generator objects for the same distribution object which might use the same or different methods for generation. (If the choosen method is not suitable for the given method, a NULL pointer is returned in the initialization step). @item @strong{Parameter objects:} Each transformation method requires several parameters to adjust the generator to a given distribution. The parameter object holds all this information. When created it contains all necessary default settings. It is only used to create a generator object and destroyed immediately. Altough there is no need to change these parameters or even know about their existence for ``usual distributions'', they allow a fine tuning of the generator to work with distributions with some awkward properties. The library provides all necessary functions to change these default parameters. @item @strong{Uniform Random Number Generators:} All generator objects need one (or more) streams of uniform random numbers that are transformed into random variates of the given distribution. These are given as pointers to appropriate functions or structures (objects). Two generator objects may have their own uniform random number generators or share a common one. Any functions that produce uniform (pseudo-) random numbers can be used. We suggest Otmar Lendl's PRNG library. @end itemize =EON unuran-1.11.0/doc/src/ref_example_win32_2.texi0000644001357500135600000001166614430713451016032 00000000000000/* ------------------------------------------------------------- */ /* File: example2.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header files. */ #include #include /* ------------------------------------------------------------- */ int main(void) @{ int i; /* loop variable */ double x; int k; /* will hold the random number */ /* Declare UNU.RAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen1, *gen2, *gen3; /* generator objects */ /* Declare objects for uniform random number generators. */ UNUR_URNG *urng2; /* uniform RN generator object */ /* -- Optional: Set seed for RNGSTREAMS library -------------- */ /* The RNGSTREAMS library sets a package seed. */ unsigned long seed[] = @{111u, 222u, 333u, 444u, 555u, 666u@}; RngStream_SetPackageSeed(seed); /* -- Example 1 ---------------------------------------------- */ /* Beta distribution with shape parameters 2 and 3. */ /* Use method 'AUTO' (AUTOmatic). */ /* Create distribution object. */ @{ double fparams[] = @{2., 3.@}; distr = unur_distr_beta( fparams, 2 ); @} /* Choose a method: 'AUTO'. */ par = unur_auto_new(distr); /* Create the generator object. */ gen1 = unur_init(par); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen1' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen1 == NULL) @{ fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); @} /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen1' to sample from */ /* the target distribution. Eg.: */ for (i=0; i<10; i++) @{ x = unur_sample_cont(gen1); printf("%f\n",x); @} /* -- Example 2 ---------------------------------------------- */ /* Student's t distribution with 3 degrees of freedom. */ /* Use method 'TDR' (Transformed Density Rejection) with */ /* "immediate acception" */ /* Create distribution object. */ @{ double fparams[] = @{3.@}; distr = unur_distr_student( fparams, 1 ); @} /* Choose a method: 'TDR'. */ par = unur_tdr_new(distr); /* ... and change to immediate acceptance. */ unur_tdr_set_variant_ia(par); /* However, this time we use a (new) independent stream of */ /* uniformrandom numbers. */ urng2 = unur_urng_rngstream_new("urng2"); unur_set_urng( par, urng2 ); /* Create the generator object. */ gen2 = unur_init(par); if (gen2 == NULL) exit (EXIT_FAILURE); /* Destroy distribution object. (We do not need it any more.) */ unur_distr_free(distr); /* Draw a sample. */ for (i=0; i<10; i++) @{ x = unur_sample_cont(gen2); printf("%f\n",x); @} /* -- Example 3 ---------------------------------------------- */ /* Discrete distribution with given probability vector. */ /* Use method 'DGT' (Discrete Guide Table method). */ /* Create distribution object. */ @{ double probs[] = @{0.5, 1.5, 1.0, 0.3@}; distr = unur_distr_discr_new(); unur_distr_discr_set_pv(distr, probs, 4); @} /* Choose a method: 'DGT'. */ par = unur_dgt_new(distr); /* we use the default URNG again. So there is nothing to do. */ /* Create the generator object. */ gen3 = unur_init(par); if (gen3 == NULL) exit (EXIT_FAILURE); /* Destroy distribution object. (We do not need it any more.) */ unur_distr_free(distr); /* Draw a sample. Notice that we get integers! */ for (i=0; i<10; i++) @{ k = unur_sample_discr(gen3); printf("%d\n",k); @} /* -- Call destructor ---------------------------------------- */ /* When generators are not needed any they can be destroyed. */ unur_free(gen1); unur_free(gen2); unur_urng_free(urng2); unur_free(gen3); exit (EXIT_SUCCESS); @} /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/doc/src/ref_example3.texi0000644001357500135600000000613714430713446014653 00000000000000/* ------------------------------------------------------------- */ /* File: example3.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ int main(void) @{ int i; /* loop variable */ double x; /* will hold the random number */ double fparams[2]; /* array for parameters for distribution */ /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Use a predefined standard distribution: */ /* Gaussian with mean 2. and standard deviation 0.5. */ fparams[0] = 2.; fparams[1] = 0.5; distr = unur_distr_normal( fparams, 2 ); /* Choose a method: TDR. */ par = unur_tdr_new(distr); /* Change some of the default parameters. */ /* We want to use T(x)=log(x) for the transformation. */ unur_tdr_set_c( par, 0. ); /* We want to have the variant with immediate acceptance. */ unur_tdr_set_variant_ia( par ); /* We want to use 10 construction points for the setup */ unur_tdr_set_cpoints ( par, 10, NULL ); /* Create the generator object. */ gen = unur_init(par); /* Notice that this call has also destroyed the parameter */ /* object `par' as a side effect. */ /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) @{ fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); @} /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) @{ x = unur_sample_cont(gen); printf("%f\n",x); @} /* It is possible with method TDR to truncate the distribution */ /* for an existing generator object ... */ unur_tdr_chg_truncated( gen, -1., 0. ); /* ... and sample again. */ for (i=0; i<10; i++) @{ x = unur_sample_cont(gen); printf("%f\n",x); @} /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); @} /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/doc/src/ref_example_discr_str.texi0000644001357500135600000000400414430713446016633 00000000000000/* ------------------------------------------------------------- */ /* File: example_discr_str.c */ /* ------------------------------------------------------------- */ /* String API. */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* Example how to sample from a discrete univariate distribution.*/ /* ------------------------------------------------------------- */ int main(void) @{ int i; /* loop variable */ /* Declare UNURAN generator objects. */ UNUR_GEN *gen1, *gen2; /* generator objects */ /* First distribution: defined by PMF. */ gen1 = unur_str2gen("geometric(0.3); mode=0 & method=dari"); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen1 == NULL) @{ fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); @} /* Second distribution: defined by (finite) PV. */ gen2 = unur_str2gen( "distr=discr; pv=(1,2,3,4,5,6,7,8,4,3) & method=dgt"); if (gen2 == NULL) @{ fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); @} /* print some random integers */ for (i=0; i<10; i++)@{ printf("number %d: %d\n", i*2, unur_sample_discr(gen1) ); printf("number %d: %d\n", i*2+1, unur_sample_discr(gen2) ); @} /* Destroy all objects. */ unur_free(gen1); unur_free(gen2); exit (EXIT_SUCCESS); @} /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/doc/src/ref_example_cont.texi0000644001357500135600000001063414430713446015610 00000000000000/* ------------------------------------------------------------- */ /* File: example_cont.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* Example how to sample from a continuous univariate */ /* distribution. */ /* */ /* We build a distribution object from scratch and sample. */ /* ------------------------------------------------------------- */ /* Define the PDF and dPDF of our distribution. */ /* */ /* Our distribution has the PDF */ /* */ /* / 1 - x*x if |x| <= 1 */ /* f(x) = < */ /* \ 0 otherwise */ /* */ /* The PDF of our distribution: */ double mypdf( double x, const UNUR_DISTR *distr ) /* The second argument (`distr') can be used for parameters */ /* for the PDF. (We do not use parameters in our example.) */ @{ if (fabs(x) >= 1.) return 0.; else return (1.-x*x); @} /* end of mypdf() */ /* The derivative of the PDF of our distribution: */ double mydpdf( double x, const UNUR_DISTR *distr ) @{ if (fabs(x) >= 1.) return 0.; else return (-2.*x); @} /* end of mydpdf() */ /* ------------------------------------------------------------- */ int main(void) @{ int i; /* loop variable */ double x; /* will hold the random number */ /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Create a new distribution object from scratch. */ /* Get empty distribution object for a continuous distribution */ distr = unur_distr_cont_new(); /* Fill the distribution object -- the provided information */ /* must fulfill the requirements of the method choosen below. */ unur_distr_cont_set_pdf(distr, mypdf); /* PDF */ unur_distr_cont_set_dpdf(distr, mydpdf); /* its derivative */ unur_distr_cont_set_mode(distr, 0.); /* mode */ unur_distr_cont_set_domain(distr, -1., 1.); /* domain */ /* Choose a method: TDR. */ par = unur_tdr_new(distr); /* Set some parameters of the method TDR. */ unur_tdr_set_variant_gw(par); unur_tdr_set_max_sqhratio(par, 0.90); unur_tdr_set_c(par, -0.5); unur_tdr_set_max_intervals(par, 100); unur_tdr_set_cpoints(par, 10, NULL); /* Create the generator object. */ gen = unur_init(par); /* Notice that this call has also destroyed the parameter */ /* object `par' as a side effect. */ /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) @{ fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); @} /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) @{ x = unur_sample_cont(gen); printf("%f\n",x); @} /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); @} /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/doc/unuran_win32.html0000644001357500135600000007317514430713525014043 00000000000000 Using UNU.RAN with Microsoft Visual C

Using UNU.RAN with Microsoft Visual C

This document describes how to use Microsoft Visual Studio to create a C or C++ project and link the target with UNU.RAN.

UNU.RAN (Universal Non-Uniform RAndom Number generator) is a collection of algorithms for generating non-uniform pseudorandom variates as a library of C functions designed and implemented by the ARVAG (Automatic Random VAriate Generation) project group in Vienna, and released under the GNU Public License (GPL).

This binary distribution also has support for Pierre L’Ecuyers RngStreams library. This library is already compiled into the distributed DLL, the corresponding header file is included in this package.

The DLL is linked against the C run-time library MSVCRT.lib. Thus the file MSVCR80.DLL must be available at run time for applications linked with UNU.RAN and MSVCRT.lib (i.e., included in the envirenment variate PATH). For details see the Microsoft Visual C++ manual.


1 Installation of Binary Distribution

  1. Download unuran-1.11.0-win32.zip from the UNU.RAN download page.
  2. Unpack unuran-1.11.0-win32.zip. It creates directory unuran which contains the following files:
    unuran.h

    Header file to be included in your application source file. (Contains function prototypes, typedefs and macros.)

    RngStream.h
    unuran_urng_rngstreams.h

    Header files required for using the RngStream library.

    libunuran111.def

    Module-definition file. (Declares all functions exported the UNU.RAN library.)

    libunuran111.dll
    libunuran111.dll.manifest

    DLL (Dynamic link library) and its manifest file (must always be located in the same directory).

    libunuran111.lib

    Import library file.

    libunuran111.exp

    Library export file.

    unuran.pdf

    UNU.RAN User Manual.

    unuran_win32.pdf

    Short description for building your own application using UNU.RAN with Microsoft Visual C.

    example1.c
    example2.c

    Two example files.

  3. Optional: Move directory unuran into an appropriate place, e.g. C:\unuran (or maybe the folder where you build your application).

    Throughout this document, the UNU.RAN installation folder is referred to as <UNURANDIR>. For example, if UNU.RAN has been installed in the folder C:\unuran, references to <UNURANDIR>\libunuran111.lib represent C:\unuran\libunuran111.lib.

  4. Optional: Add <UNURANDIR> to the PATH environment variable. Thus your application can find the location of libunuran111.dll when it is started.

2 Uniform Random Number Generator

This binary distribution uses Pierre L’Ecuyers RngStreams library as its default uniform random number generator. This library uses a package seed. Thus you should add the following piece of code at the beginning of your application (at least before you call any of the UNU.RAN functions):

unsigned long seed[] = {111u, 222u, 333u, 444u, 555u, 666u};
RngStream_SetPackageSeed(seed);

where 111u, …, 666u should be replaced by your seeds.


Remark: UNU.RAN works with any source of uniform random numbers. We refer to the UNU.RAN for details if you want to use your own uniform random number generator instead of the RngStreams library.


3 Building Your Own Project in Visual Studio

Note: The information below applies to the Visual C++ .NET 2005.


Let us assume that you want to build a target named example.exe and have:

  • a source file named example.c which uses the C API of the UNU.RAN library (or alternatively a C++ file example.cpp);
  • a folder where this file is located and which we refer to as <MYAPPDIR>.

One way to build your project is to create a Solution named example.sln as described here.

  1. Start Microsoft Visual Studio .NET 2005.
  2. Build the example.sln solution:

    From the File menu, select New, and then Project.

    When the New Project dialog box appears then

    • In the Project Types pane, select Visual C++ Win32 Projects.
    • In the Templates pane, select the Win32 Console Project icon.
    • Fill in the project name (‘example’).
    • If necessary, correct the location of the project (to <MYAPPDIR>).
    • Click OK.

    When the Win32 Application Wizard appears then

    • Click on Application Settings.
    • Select Console Application as application type.
    • Make sure that Empty Project is checked in Additional Options.
    • Click Finish.

    This creates a solution, example, with a single project, example. You can view the contents of the solution by selecting Solution Explorer in the View menu.

  3. Add your source file to the project. From the Project menu, choose Add Existing Item:
    • Move to folder <MYAPPDIR> and select example.c.
    • Click Add.
  4. Set some options so that the project knows where to find the UNU.RAN include files and the UNU.RAN libraries.
    • From the Project menu, choose example Properties. The example Property Pages dialog box appears.
    • In the Configuration drop-down list, select Release.
    • Select C/C++ in the Configuration Properties tree.
    • Select General.
    • In the Additional Include Directories field
      • add directory <UNURANDIR>;
      • choose No for Detect 64-bit Portability Issues.
    • Select Linker in the Configuration Properties tree.
      • Select General and then select Additional Library Directories.
      • Add directory <UNURANDIR>.
      • Select Input and then select Additional Dependencies. Add library file libunuran111.lib.
    • Click OK to close the example Property Pages dialog box.
  5. Set the default project configuration.
    • From the Build menu, select Configuration Manager.
    • Select Release in the Active Solution Configuration drop-down list.
    • Click Close.
  6. Finally, to build the project, from the Build menu, select Build Solution.

After completion of the compiling and linking process, the target is created. The full path of the executable is <MYAPPDIR>\example\Release\example.exe. Notice that, if you want to run the example.exe by clicking on it, you need to locate the DLL file in the same directory or adjust the PATH environment variable for the DLL (see Installation of Binary Distribution).


4 Building Your Own Project on the Command Line

First you have to set the appropriate environment variables to enable 32-bit command-line builds by means of the vcvars32.bat file:

  1. At the command prompt, change to the \bin subdirectory of your Visual C++ installation.
  2. Run vcvars32.bat by typing VCVARS32.

Then change to your application folder <MYAPPDIR>) that contains your source file(s) (C or C++). Assume you have one C source file example.c. Then you can compile and link your executable by

cl /O2 /W3 /MD /I<UNURANDIR> example.c libunuran111.lib /link /LIBPATH:<UNURANDIR>

which creates the file example.exe.

When you want to run example then the location of the DLL libunuran111.dll (and that of the C run-time library msvcr80.dll) have to be included in the environment variable PATH (or you need to locate these DLLs in the same directory).


5 Two Examples

Here we give small examples. These show

  • How to seed the seed for the RngStreams library.
  • How to create an UNU.RAN generator for a given target distribution. For more detailed information we refer to the UNU.RAN manual.
  • How to use an independent stream of uniform random numbers for one of these UNU.RAN generators.
  • We demonstrate the usage of the easy to use String API.
  • We furthermore show the same example with the more flexible C API.

5.1 The String API

/* ------------------------------------------------------------- */
/* File: example1.c                                              */
/* ------------------------------------------------------------- */

/* Include UNURAN header files.                                  */
#include <unuran.h>
#include <unuran_urng_rngstreams.h>

/* ------------------------------------------------------------- */

int main(void)
{
  int    i;                /* loop variable                      */
  double x; int k;         /* will hold the random number        */

  /* Declare UNU.RAN objects.                                    */
  UNUR_GEN  *gen1, *gen2, *gen3; /* generator objects            */

  /* Declare objects for uniform random number generators.       */
  UNUR_URNG  *urng2;       /* uniform RN generator object        */

  /* -- Optional: Set seed for RNGSTREAMS library -------------- */

  /* The RNGSTREAMS library sets a package seed.                 */
  unsigned long seed[] = {111u, 222u, 333u, 444u, 555u, 666u};
  RngStream_SetPackageSeed(seed);

  /* -- Example 1 ---------------------------------------------- */
  /* Beta distribution with shape parameters 2 and 3.            */
  /* Use method 'AUTO' (AUTOmatic).                              */

  /* Create generator object.                                    */
  gen1 = unur_str2gen("beta(2,3)");

  /* It is important to check if the creation of the generator   */
  /* object was successful. Otherwise `gen1' is the NULL pointer */ 
  /* and would cause a segmentation fault if used for sampling.  */
  if (gen1 == NULL) {
     fprintf(stderr, "ERROR: cannot create generator object\n");
     exit (EXIT_FAILURE);
  }

  /* Now you can use the generator object `gen1' to sample from  */
  /* the target distribution. Eg.:                               */
  for (i=0; i<10; i++) {
    x = unur_sample_cont(gen1);
    printf("%f\n",x);
  }

  /* -- Example 2 ---------------------------------------------- */
  /* Student's t distribution with 3 degrees of freedom.         */
  /* Use method 'TDR' (Transformed Density Rejection) with       */
  /* "immediate acception"                                       */
  gen2 = unur_str2gen("student(3) & method=TDR; variant_ia");
  if (gen2 == NULL) exit (EXIT_FAILURE);

  /* However, this time we use a (new) independent stream of     */
  /* uniformrandom numbers.                                      */
  urng2 = unur_urng_rngstream_new("urng2");
  unur_chg_urng( gen2, urng2 );

  /* Draw a sample.                                              */
  for (i=0; i<10; i++) {
    x = unur_sample_cont(gen2); printf("%f\n",x);
  }

  /* -- Example 3 ---------------------------------------------- */
  /* Discrete distribution with given probability vector.        */
  /* Use method 'DGT' (Discrete Guide Table method).             */
  gen3 = unur_str2gen("discr; pv=(0.5,1.5,1.0,0.3) & method=DGT");
  if (gen3 == NULL) exit (EXIT_FAILURE);

  /* we use the default URNG again. So there is nothing to do.   */

  /* Draw a sample. Notice that we get integers!                 */
  for (i=0; i<10; i++) {
    k = unur_sample_discr(gen3); printf("%d\n",k);
  }

  /* -- Call destructor ---------------------------------------- */
  /* When generators are not needed any they can be destroyed.   */

  unur_free(gen1);
  unur_free(gen2);  unur_urng_free(urng2);
  unur_free(gen3);

  exit (EXIT_SUCCESS);
} /* end of main() */

/* ------------------------------------------------------------- */

5.2 The C API

/* ------------------------------------------------------------- */
/* File: example2.c                                              */
/* ------------------------------------------------------------- */

/* Include UNURAN header files.                                  */
#include <unuran.h>
#include <unuran_urng_rngstreams.h>

/* ------------------------------------------------------------- */

int main(void)
{
  int    i;           /* loop variable                           */
  double x; int k;    /* will hold the random number             */

  /* Declare UNU.RAN objects.                                    */
  UNUR_DISTR *distr;             /* distribution object          */
  UNUR_PAR   *par;               /* parameter object             */
  UNUR_GEN  *gen1, *gen2, *gen3; /* generator objects            */

  /* Declare objects for uniform random number generators.       */
  UNUR_URNG  *urng2;       /* uniform RN generator object        */

  /* -- Optional: Set seed for RNGSTREAMS library -------------- */

  /* The RNGSTREAMS library sets a package seed.                 */
  unsigned long seed[] = {111u, 222u, 333u, 444u, 555u, 666u};
  RngStream_SetPackageSeed(seed);

  /* -- Example 1 ---------------------------------------------- */
  /* Beta distribution with shape parameters 2 and 3.            */
  /* Use method 'AUTO' (AUTOmatic).                              */

  /* Create distribution object.                                 */
  {
    double fparams[] = {2., 3.};
    distr = unur_distr_beta( fparams, 2 );
  }

  /* Choose a method: 'AUTO'.                                    */
  par = unur_auto_new(distr);

  /* Create the generator object.                                */
  gen1 = unur_init(par);

  /* It is important to check if the creation of the generator   */
  /* object was successful. Otherwise `gen1' is the NULL pointer */ 
  /* and would cause a segmentation fault if used for sampling.  */
  if (gen1 == NULL) {
     fprintf(stderr, "ERROR: cannot create generator object\n");
     exit (EXIT_FAILURE);
  }

  /* It is possible to reuse the distribution object to create   */
  /* another generator object. If you do not need it any more,   */
  /* it should be destroyed to free memory.                      */
  unur_distr_free(distr);

  /* Now you can use the generator object `gen1' to sample from  */
  /* the target distribution. Eg.:                               */
  for (i=0; i<10; i++) {
    x = unur_sample_cont(gen1);
    printf("%f\n",x);
  }

  /* -- Example 2 ---------------------------------------------- */
  /* Student's t distribution with 3 degrees of freedom.         */
  /* Use method 'TDR' (Transformed Density Rejection) with       */
  /* "immediate acception"                                       */

  /* Create distribution object.                                 */
  {
    double fparams[] = {3.};
    distr = unur_distr_student( fparams, 1 );
  }

  /* Choose a method: 'TDR'.                                     */
  par = unur_tdr_new(distr);
  /* ... and change to immediate acceptance.                     */
  unur_tdr_set_variant_ia(par);

  /* However, this time we use a (new) independent stream of     */
  /* uniformrandom numbers.                                      */
  urng2 = unur_urng_rngstream_new("urng2");
  unur_set_urng( par, urng2 );

  /* Create the generator object.                                */
  gen2 = unur_init(par);
  if (gen2 == NULL) exit (EXIT_FAILURE);

  /* Destroy distribution object. (We do not need it any more.)  */
  unur_distr_free(distr);

  /* Draw a sample.                                              */
  for (i=0; i<10; i++) {
    x = unur_sample_cont(gen2); printf("%f\n",x);
  }

  /* -- Example 3 ---------------------------------------------- */
  /* Discrete distribution with given probability vector.        */
  /* Use method 'DGT' (Discrete Guide Table method).             */

  /* Create distribution object.                                 */
  {
    double probs[] = {0.5, 1.5, 1.0, 0.3};
    distr = unur_distr_discr_new();
    unur_distr_discr_set_pv(distr, probs, 4);
  }

  /* Choose a method: 'DGT'.                                     */
  par = unur_dgt_new(distr);

  /* we use the default URNG again. So there is nothing to do.   */

  /* Create the generator object.                                */
  gen3 = unur_init(par);
  if (gen3 == NULL) exit (EXIT_FAILURE);

  /* Destroy distribution object. (We do not need it any more.)  */
  unur_distr_free(distr);

  /* Draw a sample. Notice that we get integers!                 */
  for (i=0; i<10; i++) {
    k = unur_sample_discr(gen3); printf("%d\n",k);
  }

  /* -- Call destructor ---------------------------------------- */
  /* When generators are not needed any they can be destroyed.   */

  unur_free(gen1);
  unur_free(gen2);  unur_urng_free(urng2);
  unur_free(gen3);

  exit (EXIT_SUCCESS);
} /* end of main() */

/* ------------------------------------------------------------- */
unuran-1.11.0/doc/unuran_win32.pdf0000644001357500135600000040557614430713526013655 00000000000000%PDF-1.5 %ÐÔÅØ 1 0 obj << /Length 587 /Filter /FlateDecode >> stream xÚmTM¢@½ó+z&ÎÁ±?tBL$ñ°ãd4›½*´.‰<øï·_•èÌf’W¯_wÕ«îrðãc;Šòê`GæUŠOÛV×&³£øç¾öƒ¤Ê®[vïÖæ6ïWÛ7ñÑTÙÖvb¯“uYt/N¼.³ó5·½êÿ¢¥=åS‚> stream xÚmTM¢@½ó+z&ÎÁ±?tBL0ñ°ãd4›½*´.‰<Ì¿ß~U¢Îf’W¯_u½ªîvðãc;ZäÕÁŽÌ«Ÿ¶­®MfGñÏ}í I•]/¶ìÞ­ÍmÞ¯¶o⣩²­íÄ0^'ë²è^œx]fçkn{ÕÿEK{*ʇuÄpg6;µÞ$4»¢;»µgZ8, ’ü²M[Tå›P¯RJG¤eWxm½ñ­ž÷ŽE™7·¢â žÒ"/²îÑ7»¸¦‘¼ýj;{Y—ÇÊ‹"1þt‹m×|‘£o¼irÛåI É‘c¶×º>[TÒ›ÏEnn#×ÛûþbÅø¹‘ûÒî«¶BS¬ØEVå¶­÷™möåÉz‘”s…«¹gËüŸµ)gŽÏR©ð133wÄ xAÄbêí;¬ÒaGL6K& 0+‡}&ö"?‘á°(Ò¦Òa/ ¡cì,•!£½¥‰î-fö3¤Ù*IÃx {aªùð”sIC%ÒðhSô¢¨7å£Å}­HÏ=ŤIYƒ¹(îƒêjŧ ÿZóéàü4{ÖØSOØá5˜‡áZ ä®ekxvKº·Ǭü÷…Ü@2aÂ> stream xÚmSÁnâ0½ç+¼$z Ø¨"¤€ÄaKU¢Õ^C<ÐHàDN8ð÷õÌŠV{Hôüæç=üúØS`¾Jñ m}u%ŒÒßE Y]^/`»w¦¶oâÃÕå:1L·ÙÖVÝ‹omy¾èUÿ­àTÙ ÖÃþŽv¹Êó‘DM^ug{¦…Ç‚° ÉpmUÛ7¡^¥”žX[“ÖôÚã{=1î+kܽ¨8 …@iaª²»¯è_^|Ó˜¼¿µ\¶öXq,ÆŸ>ØvîFŽ^‚ñÎp•=‰!9òÌþÚ4gÀêBË¥0pôùÞÞ‹ ˆñs#P~k@hZ+vQÖÚ¦(ÁöA,åRÄÑf€5ÿĦœq8>K¥Â_¸—žX NˆHæžÐÔ3$¤Çž˜{<Ý0Š*¢5cÕ~ÿP÷õʯÂùÝ5WÂ42^!ž0^#žrq‰xƘœE„3xÎü ñ ªz“)cÒgl1BÌîÒ°õ•?ŸXqû!òŠNA‡¨Wš»A*dý1ùÔ)iȧΰÅç“Оó â9ç’†NVf¤¡–kô¯VäaŠžUJü†ôì?%Íš5Ø»bÿTW£=ј«±®–¾Œ¿É5ëñ2éfè&p2pj³V^ócH£Mc†VYxLS7˜E=›þ1âj· ¾gÈÈ endstream endobj 6 0 obj << /Length 394 /Filter /FlateDecode >> stream xÚ…‘MoÛ0 †ïþ:Ú@͉ú°¤c?7[€N{(zHÛ5H›¬X{Ø_ŸdÆ=E 6I¿$’Èx|ÁŒ•`¥aÛŒOÑ¡cd\}Íð SZ‚V2ÚÊÊYW¢§>)ZÆî¥©X—„'uöåÂh&8TÚjV· ¯â ·¬^³Û|9ö¾+Jit¾\,áêxAÎS¿{$ëGÿ0„1´;r¯ûq¿Ú}ZÜÕ—Ùyý~%ˆõµC0gÒy€ˆ††µÙO"Óš!Ç&2Á-T\1m9`u {E’2I•/}ÿ§6o†qâˆÁ—1܆aK˜³[Òû$ÞoÓû¾(§Duo†Õ. cƒ¡±à¤‹‹à4ÀuaeêÔOIˆÀÈH-Ž ýEp!S¹iï¨@ªJ¤éJ‰šî¨”aÕ¿ cÓÒ2¿7×a³žXx¤ÐñÜ$º)œÊæíVó©¾ý+t%ò8ïÊûw2Î}×{’ží£èùÝCAÞž Á99Ÿé?·"©ã endstream endobj 13 0 obj << /Length 373 /Filter /FlateDecode >> stream xÚ}Q=OÃ0Ýó+<:ví8NÒDLŠ€!MÜÖj“TŽS ñç±}.”(R|÷îݽûàˆ¹£2Ce%h%JÔt ¨Ù 0žîy¹TæÂÙÿÒˆÌdà‘³ª×Ëd¶qFçlÎÑríe«‚–•sZô†o†CšUøÓèÍÖ6ýX> ™Ó¬t’TdðÏE~^‹Ê„“>ã½3.úW–箹ÂuXcìËýÊ”!ð}?Zm'뽯§”c•Ž „Ÿmmµcì®À}‰¯V= ý’Bº‘*DxAy~e:=Žzè]XþÍðÆÔ}š•Øª;¡«w! кon¼Ñ«ÉÆÀÑ'+³r}u€4ÃA«ØÃ:ÝêñT¶÷e§zþÁMh_ä¨ÛŸ¶ ¢M¼ ³17• \ƃý*ì ¬n,Úu`^ˆ\lá2ǨÈ4jTæ¦o!vâ×û=0dXyr»L¾²O²ƒ endstream endobj 25 0 obj << /Length 810 /Filter /FlateDecode >> stream xÚåW]o›0}ϯàðümØ[ÛuU§­«Z2išö@ÒzJ`¢nÿ~v ‰!Àh2­í¦J»ö=×÷œ{¯ATÈØÎír׳ùc^®Î&¨Zç«…¾µò8š¼z˘ƒ aˆœhî0ŒCdc/š9_\é}ÞMN£!†`”ŒD­Wï@ -FŒjh} ÌÔ#y!uã›EâùD07››çI–z¹eb…ö͘¢€P޵)èøH¹±4-dzgvO/¦àêè dyoÞ>ÈÛ<+²yi†Ÿd±Šž@Úb@VHk„מ¸0Þ8yˆ±6i*ÖTP‡ @¬ILýÀPý¨Ãhöš3 «ý¾e`Cã62m˜u|PŸ‚lgF(hZ)ˆ3 8©A}„0sÏÓ¢Œ‹¸”J: -Ë4Κ÷7²(sy³Z¯ê¢ — xÖ”˜ìS… Üþ¢ØìÒ„Åé•ÄÖ“1ŠÂÕ‚À`† &®1Må<Ë—†ø«8eÕûÅj©«Ê!7ÉÍäY’&y\fy·,‚êlPO¤€*RûK`k`H6!¬W–3cT0­dÀ¡XµôŒ ŽWr1Û´†Ïºßd«ŠôU­¸Ì3ÏçÄý–ÜVÝA¦»]âº\ÍdÖÝ*(‚ÿÕVÑÃp„½¶ 0܈µècØvfÃÃКaÆ «»=ŒáºO”÷I}éX.U™0ƒ÷2Mº™ÕÐL÷Wmⶆˆ³Cög93†¸AhM&!VC\ô ëpf~ú#^~_$EgÐQgWÛ_x[~†¶ù‡! nøz´«ý¾e KŒ-s•ë½@ÚÞŒQc »ùõpR 9à¢úøa@ß#!„n´®„¨bŸ›šB¨{té!÷Ü(SÝC,cH}"Ì^ÐÅàå¥ÌS ìÔhª. [Ñ<¾F›ý¾e ëüó»´°¼“ƒØUZІy¸'uFt¦ƒA=³áßTÒ’¼= SËi $LCµ÷%ŒíÍNÂüî?ú" endstream endobj 38 0 obj << /Length 53 /Filter /FlateDecode >> stream xÚ3T0BCs#s c= cs…ä\.°hQº„äÎeUgbj¬gjb dcUWN" endstream endobj 78 0 obj << /Length 1353 /Filter /FlateDecode >> stream xÚWÛnÜ6}÷Wè-Z$bÅ«¤G×M\ŽalÖ~i T–è5­´Ð%ÿ¾Cµ‘d9n +Îp†<äÎŒià $)')O‚âp;m»p°½<£Þ.Ãhbùëîì—R4&YœÑ`÷0]jW†·©÷›ˆsÞ^ß’íùµDøÍô¨þhŠ¶éš‡Å;Ó y…ã‹MĘb2¤›¿vœ½ßH&‰ü?­ŸaO{B•bÄΉ­4ÅžÈ vo÷Ú“å;‹|€È’(©"™R)Q*sG±hªJ½ij”›üæÕ¾i!J‡ƒ¬2‡ƒŒ@,Õ„’ã.îÑY¹¨ÃÕ*ŽcÎp˦â4nB…_7À¬¼5ÀåMógr+sßæí ›ý^àça¨pïoÎìk]úu<;ã9/ÍáXéñ­Z[`:ÜHO8¶t]†¢Ã¸ ”`„«ô§¹8úG“ÖÈ°ØÆá=ßn(¥áû=·8/—ðX¬ˆrïefŽÖ¯€aqF$gs0–™çCß Ö^×Ö“)1‚tÑÄÙKOŒ¦öü«S>Ñ6‘X;m†#:˜Ú/eaj L¿CRž8H³xÚ0»<ÒêJç.1× uiŸÀ$ÿððòú'o,ï+{+^™B×7²G¼¼¹²p]J‚'Љ„*By6Mÿ^É=¬dj$(ˆ¥ézHû>'!<£®Á¹GÇlPuÃñèiÓö¨Á‡67F·­FåÕ›÷Åðä“À2æ6å& ÜEœü<%Gÿh²À –Û¸Óoëý§ÊÏá*!‘©œ¡z™‰£õ+„¢D26Ç0¦…T„d¥1Ø`9J3ç°¨G>pË2[‘eyÇ(½²hGS9!m†hP‚b功Ÿb<šþvuõî¹YÑ@$;èºÄ†ô°££&ìÿ9¦¢ÒSLvã¢J½ž¼ê‘Òθ{Ì ‹ó‹K£{ý#ÊÚ'™9´8pu SX©-ËJÔçûÜÔ]B?º] q;ÔQo^yºT+ü½Öo0¨ƒ `ñ½ÄÇOwÛ¿µ¾CBG­œ·}ÜÖ¢º ñî,ªÕ­`—œïœÆÄekÅH–e§­‘HB ¢|ƒ¢±}L–ÕÖ )”,èö°¢™*¿w‘›¼Çi¸;TàÚ‘{øÎõx„|”ûjf§¦a±²ï˜`dàvµYæS V¯« wö¿"€ËÚ”hˆ&> ô’tÖ œHëèù¦¾óÃrûÕ´ºž´É01)ÿkØi ÏN1¼9ßý¾†š1;­0uGBˆðÃ&åØšR÷ÿn:­¿c\æÖ„’˜R¡ÿtjE÷hâ¿–Yç›`l^ú‡J¬7óì-Ù¼—Ÿ¥ã„‹OOòƒtì­_.à]±dü»¨ÜSÿ/¢‹Ü endstream endobj 82 0 obj << /Length 53 /Filter /FlateDecode >> stream xÚ3T0BCs#s c= cs…ä\.°hQº„äÎeUgbj¬gjb dcUWN" endstream endobj 87 0 obj << /Length 1671 /Filter /FlateDecode >> stream xÚ­XmoÛ6þž_áo“š)Š¢‚a@›¬kжRw_Ö¡S$:*Kž^šf¿~wÃ÷YìÇ|±ÞŒ·Zg‹?½³m²oM½\AàñÓåJÊл(›6)Š¤Í«’fª }?Ëˤ¾¥ñyÞ´u~ÕÑ*ák{Áò¯õË“_Ö¤P„,”Á‘øûÕ÷Á!"&x(ûCÅ||ÂCðå*Tw±äÞyrøÃx‚’²˜‡‹•ÐÌ{l¹RÊ÷Ϋ¥ÐÞMYTIF4tåRD^W'%¨_-W×Âg¾}ºÉq"ìß|oHoSW;z·Ý¼{óŽ]>}sÈ^ ãR-T±XYòXS€ >¸°,N%c:û×WwïϸÄ{Ül|ÌPÒKÄÑÔÃí‚Äq 'öɵa¨{ 1ŸÇ‹W€”¦…3È»rŸ¤ö#ø`¬­9´5ÇŠ3k0±oÈ@x-®Œ¼´6Ikz-Ëk“¶zÎýíÜBQŠH°€û„ +­Ñgü',P²_÷my³ÍSô”­Ó^Y m’— I¬3 –MUÄ^^"æLA+0rÚø½ÏeašS»Ä‡¹@ÓÜì€Å€Oá³íÜdÈ4î€ 4‹B1ðÂ$™ÍqìÀи­ð[{Wpí9a^¦E—™¬¢%·HIÕA„¸}’ý¾ÈÓ>€AÐT]š±´¼ôá!ôÏ*}ŽEÜpÓ•i×–Äë<ª®ÚªEbo÷„¬yââp,Ì̦¡@MJã»$­«†FNö#¦áñ±„_–×o[ð¹Ý<ç…qO9‡&‡8Ö°ºº¼þÿÕÙÌ+åAÄdhÕ‚i-°5ÐáHªÍ?cjS¹5]ƒÎ;Îrr;Wñ,K³‰™CyG…ÛùU©]žË"ÒŒGêk#6"î8ä ð‚96þ€D_©)_¯+ëMYW˜Uf±2w•RYäÈç&-’š²‘ïA £AïÍNn>“Vu‹„£Èe ß–#¬"öyLˬã~#/íX^bÉÔ!/_¯Ží’2ߘ¦u` {ëCÿÕLq>Õ{þêՃؾ-“¤cÄ ¯üHSŽ2Ë–² gò¶! b–7h)îµý–”ûúíw¶#hÜlRÜ`zIPxÛlÈŒV-¹ $=kÔˆ²#Πqïç±&Ù¹¶a¨Z™}' Ãã<ÿb78é4@G¹ã{aÅ€x ÖWch£èúNX]Ýg³¹v„–â¥`ÑñȾ9¤N±¡,,½× µ:Iñh„¨GzçÑl¾ÝÔe¦Ië|ßß ä]a¸êò"jÃ-*<-r]'MM;˜•” %7y»u”ä«I¼8\X¼«CöGÞe´þìÌ™ÏÉn_ÎÒ£m«|÷hEâ+ˆ&Ö6Utl·ã¤˜;&¢€ N:í€9½z’xC¦ôà¿YK'Åé,DŸIÈѯ­‘?-]g¨ø¸÷ÆÇYF"°ßÐzãŽ9µÚ=%èNpsÿª«}CÚ¥‰}‘¤;By†]CuEôPÓ‚gðœ¾ç|Õý¾Ôa¥°AXvT°,€î>  W|bÆáÂw„¬O7[S›I8"–ŒÃlYw…ß}½­«îz[u5:‚J·Í ¼ÚjÕí Ñ ŒqßW„ W Á‰/æ“9Jz踴ߴ6SÛ&Ò*«Hš4sÑüÿó ç—?Ñic&¤÷|©!ÕhÑGÈ<ªôò I‡ƒ ¹M’ºZnJ’»S)®”s×§ ?>Žç¯™|Çßè[2J©nàŠ©XNÜü¥Lû¾…~¦úBƒÊ¸E\Çt,m{möÐﺿ‘h^½b‘ŽæØ8Z¿Ô0Ö#ƒ1AÈ¢(˜¸½|l®“1“zPõ4³^ð±B±@Ç:m0þ=¶Ä ±ßÔ#Þ Åî ÿþtýbnSæ.(ž?åuUö±*BHÖ¡òÈ”Wtg!äÛ{4„á.½àÓ¤p£ %Ï…ºäƒ³ª‰+Ú›QvpQ´qä‹ÿ ¤5xÿO!¡6`k\ç·ôNÞÐ3$^˜XÿKÖ¾RT· endstream endobj 92 0 obj << /Length 53 /Filter /FlateDecode >> stream xÚ3T0BCs#s c= cs…ä\.°hQº„äÎeUgbj¬gjb dcUWN" endstream endobj 97 0 obj << /Length 976 /Filter /FlateDecode >> stream xÚVmoã6 þÞ_áo'³fÉ–_z؇m¸0 Å!M±·Ã¦ØJbÔ‘¿ (†ý÷‘¢œÆ­; ,Š¢Èç¡(*"ˆá'‚\y‘ð"Ƀêt;mHØ|¾Þ.ÃèÊò§íÍ÷¿(ˆ˜—q)‚íþÚÕ¶¾²Ÿú<š>Œ’$aò6ŒÒT±Ûì»þDʶuçå»éÊ‚í¾´+eŸ5½;˜Š2… ¿m½ù´½àRRq•&ÿ“Älý†ILr.…Jg&2ã1Ή #•%ì! àFò”mp¦q˜äÊ1I2¯cÊ&@àuæâHó¸ôá¶Çf€4¨˜í«ûg’ëfûf7MgI3 ÆÙ ö4¡ô õ†´¿}øTMÏ¡Ëçð:q²<‹ +s^f.o\ÁÀ€.KÍu&çíÑËþ•’xÄ±ÛØÃýØ}z)IK.ev éý£œÿ@¢/U¶Ð6»þ’Uí3ÝŒ>•5$Ðer‚žÚ‘Ô“m`N¥‹óžJ@.òÒ‰DÂ…ÅbÞßÔt³ƒónç0P!Ö‡S™?{´»ÀLr6š¿ªi8ë*”9{ a«FϨŒ©/¸Zè&ou즶öÞêš,Æ#áByßµm‡;ž{ðáSG:^²íöx½ VuÀ5gµ¡)pƒ1·^áSqh¬uNqqÞëÑõ¤ÕçsÛTšª—ÿˆU<ûkÆ…G8Ck’n[ïÏb¢ž—!=®œ=Ü=ðÍwkÔö“­ÅÄ­¿¾Ù¢Ê Ad\$%í™ìЬ¤BÇam‡TQ“ùúähø[1}G²”r¡%Îb𦳍”šÅ,˦>®¾\°?ïÍøEWP÷8Ð(>®µ¡è-‘§£éÍçD@#UÚ™!‡5R¢8[ò¤L”¦L% B X[KlÉáâÎÛ‘ñj  d³Õ¥¬áMñµA“Þœ[]™š^–VÉ3­¼®`Šî‹ü˜ è~\ú mBèæ¤ûÇÛ5piÁËdÆ6WY”–9{rQûÇÁO¸{NÒÖcÃɸ*C²«Ú2Ã^D•¾9y¥ç“¨Lû=,æýôfÍűóã‘®uDxõtAïØ¾ëéá«Í¨›v ->Š8^5E‰ÌHŒ†#<\ {ÿFR³±Þæªáâ|æ‰ò;½UAo½ü_p°ì0]¿×°ðì]ÀcÿkµÊS¥:ßòåz}Ò þ?ä—£þ@îç&^`¡ûçî_¡Vn endstream endobj 100 0 obj << /Length 53 /Filter /FlateDecode >> stream xÚ3T0BCs#s c= cs…ä\.°hQº„äÎeUgbj¬gjb dcUWN" endstream endobj 104 0 obj << /Length 2460 /Filter /FlateDecode >> stream xÚÍZkoÛ8ýÞ_áoã`jß’:ƒÒ´d·MƒÆ³Å`gUl:ÑV‘ IžÔûë÷R$õ2åÁ¢@MË4yŸçž{2ÁðL: B†BLO¯pý´x˜˜Å—__»ogoç¯~ú Ä„`áˆLæ«îQóåäÓ«Çx]©âbÆ›²73ÎÅôí&I—Iö`žþ~²i¾¹ ÓzŸ~~ÎÌ'·E~1rúoµ¨Ì“Ä~ò÷¤ÜÄ©YßU›e‰äOƒ‹Îÿúêý¼ZPgGjèv切š¢Dp§&•ëwZM¦ådÓ· D«[ @·HëV˜wF1XÔŠIêƒ'‰ý¤Q ÖV1Ьv­Œ'3 Âpbn¿É+õÆîëyƒD„„íõ¶ù£rV\åÅS\%¹5çýÅŒ†S•æðòl¼¯×i¢J³¡Êí«9‚÷pe¯–Ý«)¥HÍÝ?þ蓤Wvºy?7'RŒÒ_=ø!ˆ`!B"³ó£²ñ°)­°e¹yRNÆØ~º½ Ž¬úͳÖ-Îôÿ•ù’Sê^»Ì,c{D\<(»+‹Ÿ”ýô_^E%EA:%Ô÷øi*¤¾+ŸÆ°9Š"·ù{k¶4w=ÆZ¼?õΡ’w¿»Ü&'30]$­9þÀ$ðš—" OìeZ7LKÇ…6—ú‹M“û".¶æ“?°ÀyaÖq ¸33ADFCz aÄÊ þ¥ÓmÇùÜÎ"D<§DscÛÑÀÁHâ]ƒ®×GÄ (J~ö‘àÖÙ®òt©,??ª¢I«Ä‚A«ŸºgBqå’Å5³ŽjÇ»<´gjånrÉ—ûLRÄi#ð/Ÿ~¿¼½}wýå/Þ(„œv&³x1ƒ˜€'!$’­RŸ3ˆ3ª…ƒÈÑnÍ-¯Ò »y·Õ;jX×{Ö½2¥Ÿh«p ›úý¢P`³Ž}€N)GaÔÃ]žnjtö¨Å9!w;mÖꃽc€Y™fGS-¯Õe©ÊE‘ØJ±´Æ %’ݼÒcl HD? ‚º'1”¶¸° ý)Yy™¯ªÝÂâ*»^ûŠîNíáo[ð] P9l|Ëά¡k†ª¦àÖq#z ¨"8Æ>Åßš&ªÜ¦Ø™øSd¨É¬÷Oëj{TxKlbÕ6ý°²±cxµéªöEPÀ‹šàr¹L´Ý\áý¼ÖïüñƒqÂŽÀ'HRö2¸ð!É’òÑ;ºÒLš±ú04oóº1å2°m–}›Çо&Ó‘ÇÖ OŸ(ƒ½K!…ubèu·;´ûG !ôS§ ]OÈ¥£òzØU["ÎÌâÏD3_½ÒÀiš6!!úM…z0¦Ì‹Ï|5(qΘŽ›>¹¥;v¦;âz¢‰R‹}wÃØôý÷ušªð)‰^Ig ~Ä~EhKRýÎÞž npãè+ +³'ä" غPÙNܨl'nú¹®ùÔz¦^t©É)í4r„&0èy0;¶ßêèªÏ~2¾×ý# ±Å&CiòÒ èÇ#ŽdœC“² ˆëJ=y]Ëz ¦èÉITCüô)o'ªýAS;æÃYÙM³“H× M>ÜGa$epÎlÕáºs¦òe \;|lr°3} ãÙ¯ÙÜÍ„ê‰;„™×]¬r[Ììcój«t½²ûú8ýä[f~˰ßusLý%{ŒÎÄÚA݃ÚѲпÉ,ÒÍRµÛSeÓžÕúXÛ$µ?Æ4`Ùž†4cêÄ@™–èJ@[”à‘…k½ŒD;}(cŽì „hL%F¯ E;ÕÍѧµ*ªDÉZfåæÇ¬ÑÛ8p$¾ï²­«…5Ynkámüà—„ê Ž<{@äOU<‡’—šhe_%›b”§˜sÁ‡:‚ÍfK“P™‹ç²:vÒHHsÿØ—G´÷#¸­½ ùKô6?]ùäñAËEö zúD¤ïŠc\Éä°ÈT…i¨×srNƒt¢±~U™* 9Ó«~É6L× ÊÃ÷ß%(žc.x˜º4¨Ôþ$B"‚2 ˆ¶ÂÅŽ-í5Û=Rë)VÔp‚_ š@1ãóg+@ þ~ÏûVŽÔÙ…-1¹ÉG§8C›¬òbnTv[Øwªj¢MòÙ}bçb·yQÅ÷Iš¸>ûº,7#޲EáAøˆPp<1#>&Ù7/øo ð€`æ ݃úC ‚Óaô¥ƒU¨¤ r,«?6pzV»VA»J¤×—'e2´e­d2ÝÑèl–p÷f³sÆ“˜µÓël½©ŽªlúÀÚ3" Ö3úQyè>h×#ŽyæZ«l©²Å˜7hrt;œ!’“ë;›¿øÐbÙ~ÚÄ/@/Òq²¢¶M†ã6¤QFÈà·K%‘ìߘýY„ endstream endobj 108 0 obj << /Length 1057 /Filter /FlateDecode >> stream xÚÅV[oÛ6~ϯÐ[e bÅ«$`¤ËÖ­IÄ04ÆH´ÃV]’øßïH¤I“—l/ƒë<<÷ïb/„ö"âE1E1¼t{v»åƳÄÕÏGØñÀ 8OWGïÏ9÷pˆ’0ÁÞj=µÊ¼/~¼„û7•.6‹€Rêß\Þ «“K»xÒõ}K1ÿB§¥©Ìº¶¿ëª‘¹¥Ï_W¿ý´Ú[ GœÑ7šÝsÿÍvÁ†¶' ☃ …œYûoÃ0l•Oýĉ˜ƒøŽë,×é‚ÄþwëÉŸî†Þ @âþÂçßf…bÄ@±ãyg}¯šæ¦RnëÞ³ŠD„šôRÔ³Ü>äŽYšUÖ;+q)7ªšµƒ`ãhbH¦en6öê¤5òÍþžQ+ ˆH ¹`0èï®r´„ýkULg~¦Ö²ÉÝîC NrîSií¼5ÅmˆÙ¦)e­M¬™ã|•ªûWÉ:_ÄÔ/Íö-±ä!b/7Ogs HŒ“xmUÑÆ§9¶ËJåλº"z´ÏÛ™)ÖºwßÞºd¬œ¯œáx_^ïf㘡XˆqŠÞ´ë׬§ ¶Á°K(×¹,Da2 •.lÖÿ9 #‚Iõ$­õ£c¿6yÓljMB7çšÀ@ÇÓúp™iqüä$庪„2¡ˆ1üÊï­½â%Hgò•]4Nº$z'Y8žëBæù®EÀñ°½Pÿ®«í1F‡°tìkœ×rEB¥ýÈ9}ñd_3š£xX‡.v4"V˜8A˜Ä®ÒÖ5 Î8´¥¶™ºRƒµYÛ¯ †cйu°”Ef Øú¾ß}(š'àÑOUUµnÆâEF-ËM×/Ö•“[*Y« ÒÈEâ¯zÖu“çN¦„9Úù€Jƒ/E˜cëBg'îu¡žUÚÔò.wëN|gã›´¡Ú?N–˯~¼Å”¹ùÒ’ôƒ]jf³Ž#H;D?`4ñ/M­SÕ[*»šÃ‰¯ñ»6¦±‹§v!»:©Ý ãrxƒ>@Ù´ãÄE€j1A'³ó‚ $µ2×Úµ³*Òê6ópÚÕ œèÎ7 |‚ÓB©ÌYi,_îªr?2Ÿø>}²,현rÊ[º˜0VrëŽ2]ŽL¹surp–L ¥´È‘Ù·¦ª{¤ƒ|5ûÔ l_Ë“Õ/³ÙÃÑÐb;öuiŠ­¥šÇ¾,µ+ʶÙXk½ÆzM[¯yX)5}Òv`ƒv E¢{"gÖÒÝq¼3|)ö÷ƒ€™WîTmÓ÷òÁ6 °[ÿ|,ª:®¬!„Ð5¾»Î ƒÜ2Ò© ž¡ ypøeë˜_1w"Ò +ŽQ¯û/]ëî endstream endobj 112 0 obj << /Length 1237 /Filter /FlateDecode >> stream xÚ•VmoÛ6þž_áo•щå«DÅÇY· i›enŠb0YVjm²äJrÒüûÝñ(ùe*¶Á€u<É{ž;ÞQL8üÄ$–“Ø*fU<É6gÜi›Ïn<Þ.ÃðÀòbqöê1ÁYÂ1Y<nµXM~ æëtÛåÍ4TJú|jm‚‹]Q®Šê3i?M­ êÝTÎLïŸ*š¹iêih¢àÏ<ëHSû™n“í¼ÞlÒjEÚ뢵PQ"‚dúûâ糃óFf´úH{ëÀn̤0º‡+#Æq„p5ú«‚ ³ÇÀ˜ ƆF0’=@ÐÔ~†‚°p²Î'¡´Œ'Þ‹7EÓÂ~¨~žÊÉuƒu:•6xÄ¿5QÐÕômsoïÎEMºÝbDêmS¤×å•[_4uµ!¹£‰Ç)D)Ëe™·‡;XƒJÒ). PF¸ÂÒÅ g—ž´"$¡˜0‚ -ñ´g óbäiÕúœx8ɉ?}Ýí.-Éb>æ ’¢¬îÏxùrÌ¡™–C$ŠªíÒ²L»¢®Q«Á$×D­JÈNznow¾Œ²¡%3\ý¯(Ç'QÞgš†¢¼Åk=(” Éßd<ІÄÌ¿¦›m™³l”pgpö…÷”Ãûi?³Ôk¡¼l‹Þ×0P€êú×Ѫ]¸(ú˜Üükží:ªÖþ"İl¬æXfogUZfðê½ôÂGå…·—^¸zýá݇ÛÙ;—hNµ§Á Ëb¹«vMZ ˆ ü:ÂàÄë«‹›Ùâ§óÃ|›ÿ²oô1gZÁ×Zfö^³Ä @1iòÉÃÙ/c±˜7±fVzVžÖÝDªY“C;l:ŽâÿÍî#xÌx$Nã”Ö%¨ÔIrÔqŽyÿHåÂFû¬PÐJž0tiß¡qÚU˜ivÞ~ÜMa™Ò'^Ž4på°•¸#¼/ýãT%¶0 Å æ\·&k.¯¯iÆ…]îS`U–d‚åÞ@ns*æHˆb*>Éb·¿ìc#±QÁG"ð°+6^ g5)6;ŒSÀx¨Ù›ö1k,w>ELHØ÷¸†8§jú.-9yVTY¹[å+š*ªÿG]8qøè½¥Ð ¹àÅs=ÔŠ³HЈ”×þÙ¾O-Hï*ÏýkÛï>Èþ€ë­¿\W.š$E›n¼4¼=¨0û ý7Ã^ endstream endobj 116 0 obj << /Length 53 /Filter /FlateDecode >> stream xÚ3T0BCs#s c= cs…ä\.°hQº„äÎeUgbj¬gjb dcUWN" endstream endobj 122 0 obj << /Length 1688 /Filter /FlateDecode >> stream xÚµXmoÓHþÞ_õt¼x×^¿P8©ôR®'® 4Õ¨ç&›ÄGbG~¡Eˆÿ~3ûâØ®“pPQOÖ»3ÏÌ<3³)8ðC¡KB7L׎\Í%Œ_P½Ï†vcç‹ÉÁ“SÎÔ!‘ÑÁdÞT5™ ÞZ'ËxSŠ|h»®kñ§CÛó¸5¹²ÐÊÔâè6^oV¢Ú,Œ¢À¢tø~òûÁhR›åŒî¹ÿ£Ù}h@Â(÷ Pæ?!P>´¹ï"4—IhßB@]GͱPÿMäBù¾––ÉGôT~ò¬b¯Vê…К ij&KôŸšcÅ2Ãc7Ê®ï5í†$òøÀ¦>¡ŽŽñ;‡})#>¬8¡Ö)¡”:ø…3%•Kƒ²^šgùö]''Ìu‰çE?dÄ¡‘Ì áðŽ8ü¢L&§½ÒÌ’9o7ôЩkFz2Ne.âuqUD óƒªÝL1»ïÃy »m «ä:óOÃеH_šlF]ñPgÊÿ¶L…Te*t¬)8\ µ§jíòü’ŒÏÕ‡…HE—2g°G%Öcýº¦"µôñ2΢Tò,)Ê<¹®Ê$K”<ô­ÓaèYFÝ:“üÆ¢Œ“püÀ*?)§ y’‚ÙuŒJêb¨éŸ‹¹i†~}Ä‚¢¤”|ÎH೯'–>o7ô%µcFÂ߯°­!ÊPÉU¼êBt!¥Ü?$6õ@*ÕŽuœ¤ïî|Ì’ßãejîT‚z¾Þà *^éfs!4?ÔÕ¼å4 ¼˜ŒGÇ\h>ê{iOeé¼ì óÄk¯ÞB˜àÇ걉§äD4(!¸aÄv·J‹d‘_V6}sòí{%?WÏ”ÒJSŠ1fD;F„ïOFäœÑ÷ýêËQŸñúÛÃÄõ~†±;êIöÅÈDrd&~ ßÒ˺é›/ອ¤æÝ´œÒ2rð5[˜\ä0ÓKy×’QÓ™Ju¸]r§àúì^ZèZfúìƒãËÉëJÆxáG¼îO1hØ7xÀï«äýEfg©ÜÓ°ß´(‚Cç BÃà ‚:¼†¡À»ˆëðnF»“S×W¢C–¬7Y^Ʀ-ã=ŸÓ¥˜~Ð;æf,¿žÕ‰Éº¯ŽbŒî‰½i2DZUTÓ©(Šyµ"ºKàï&1yúó íHmÿüòÕ+M Æé†½óß ¨s“UføLãÊØ‹MÍ.Ö"-ÎÏãjU¶Ã‡º«Àâë1 ¶7"F¦³‘øç[¯ä0W­B*€‹'…ü¶´Ì7p±,ç²ÂK¸ åºIŽÆã×ã§Æµ4ÍÊF6÷qôu½´M¬¦A¸—[ࣿÎ&W§Çg¯.Ç£í»…Tû²¥çÙ>eU ¹ŽïnÂuÕ$Š¡vÑheó瞤@µ1ó‡„n—ÒD-Ęúl'ñkV`¸’玹=£µøèQ7ÓxQã­ðÝöôéØÕ4KKáYÛ²äðç¹ÊðãÛFši#aø·Ù\5À endstream endobj 126 0 obj << /Length 1287 /Filter /FlateDecode >> stream xÚµXyoâFÿ?Ÿ‚Rµlp<>0”M¥44U­ˆi+u+4ØLclä#‡ª~÷¾¹|€Í&Ú4«ÄÏã7ï~¿y³¨¥Ã?ÔrŒ–30µé´¼Í‘ÎWãUKÓë#$ùzÀØ+qþä]Ùv éÚP¢–»,‹rýÖŸdt{† »3Kh¸êöLÓìÌîfÚôâN¼<ÑtÍ(«ó+õâ(‰–©øðM2ú²û—ûËÑÄÍM± [³-ó•v+î=ãMÔhÃ~ßb¶#ðÃ@VËAÀ=4…g']¶½Óë‰çäo¶/†úö–±ç䌹æõ@«Õ¯*»O3Ÿ„éq"^Sñði’Æt‘¥4 ÅŠˆ£LÉBV1!r[´Ï%,ùÑFëö,g_3ªªž%Ò· Iב/ècw<=ägÝÖ݇É2Š7D~“0¡é‹x™’¿‰ÇlVT¶Óì;_ÒÞ¦Jq*ÀžG¶LVÊH·÷¯H(sq.Y˜Ås—_˜ÉíD„”ÑfaØ÷e_ÏÁË‘XxÄ1Åa:§¸Í˜G5¹¢Ë" %õRÿÝìö¶PCžiZpOþ¸qçW7·³é¤"Ý€>2ŒjD~ŽžÈ#‰Oe%¬©ª º‘1z’ÏLeªBòTXACŸlIÈ  >oŠb1ú_,,¤,ñPPQb)Ì6 'P^h8´õY®jRÄ–çð+L™ {õ6çn =ßé­W|7ãYdœJÚ¾áqŒŸ*Kx‡ƒ?†…ý(a¦çº,úåä‡Eìÿá2†H¬¸ò\Sµ\ýÜ‹Dµ2¯„œeÓ0]ò }·üŒL+lŸ>>öÊ*¤©ÿò¾×ÌwõòÓÄ‹‰êîC€¶¢$T.G ¼ AŽ0€/QÌðÌÐõÃHZgãk·gU£®3êKÒÅ‹ ²ÅÔöÆ 2‘Ï´©d>ž³5]³OÿÕOu­žÀêš–@µpd¾í$plÒµJ&Yâ,rgÓ»kÙS+LCMkQ¾'–»œ…@›øwÉçG Tì ê¿­ƒ¹ïQJ½ÜZœVY‘T¡cJV€cßt{ƒac~¿ºí¥œ‡Æ¾çõ¡²ØÐø¾lü‡†ÆCß_â P „2ÍXg½­û_Ó÷¿¯U3ƒW$Æ D&«J€ L+j°ÀáK^2’ò°”´ %»£â7 *l’±E­´Ë©àÁkéÔRü¬yµ0³±Åjºò~vy9¹¿ßɲµ ï|“ 5ðÕño È$Uy¸›z_óSVpvåÀÝÀÒL«o°ùºg ´üík²@mÑ}£ãBp; HLÇ‚YvçâÓR™Ñ…Ô×,sð?™ÝTÃW4 ?(å½jh^>$tQçàîw5¯™oB/ÈÔÉ7,~Ábôš`ŸÈž^‚|Rs‡Œþ––…}d5ŒCmýã«yw溤´·Îö÷ެiªF]Õå§x'Xït—b ˜5(cÇ)º-ˆ¢méÊÀçd!§á‚çGY>R<òƒG#©%?l©Âæuø;çíþ¾7˜Ôž•Ä rÌÍ/â/ìÞÆ«c0Ô›æ^VYóñͽ;•qçCÜHêVZö';!Ó #—üébªP|‹™XgPŠ6,a†T5+™æ1.ôzr'Ñû„¿¼#œ”î Œ6GU ÍOªJx@›™‡ýÄäWA& endstream endobj 129 0 obj << /Length 1358 /Filter /FlateDecode >> stream xÚµXmoÛ6þž_ab§±bêÅ/Éò!mÜ.C– ² h –)Y«EU'(úßwIY’-ÛÝÐ…(Bä=÷ÜsÇ£Q£ ÿP£o6úËXý†u³Y4äÀýp†Ôwø°Søòíäìê½ã4P×v‡¨1ñ‹[M­wK¼æ„µ;–eµœëvǶÖdÓ6­XNŽ^p´^‘¤Ý1Ãa¿…¬öçÉïg£InÖ1ñ­1ê¯w€Z¨10†½ž-p"Àl"ðöŒ®cK°Wm±¼uO¼fD¾ÄóˆÇùâÇLRÂ8’/ ÓE¬Æ4æD}Jæ1K ðµ×wZWÂ9ÚûvI»Ó§©;›ºOÚ0ít[)£y£ÖhT%“îSÅD,°lv»c&ÈDe';ù|^ó0¦xu-_Ç„ËABÈ¢â4 OÜÑÝcù¾ ç ³W½_ñOÎU˜e“%9aß„hò±|¬±÷d‹È Ír¥±”&a@µ+«˜Û…?Ëñ­||C¥—rlš¦‚Hõжm=tG{½^úýf_`]Œ9#8š­JÜc0ü ¢œÈ'º9D‘&R%‰|Aû?öW H¦¶ö–pÅñ"L8 穆œÙ„|©˜ƒ”&: Gò[EÈT¢Šn BÓ³JR,„F›&j;Øj«¥çwÓÉó¹ ºÄk„yè Î`[äôî½ê9©óHæŠØªoÕRó-›6rJØq:×ñð3’ªšLC ÈØ¯Ž RiMJS6˦gsˆ…ð»dâ²DóV="@µû÷ƒÌ,ãX³Ž‹ä_ÙÜ †uáH»àqÊã%=sä¨Ä‹Aâº"ì-kNo° G9 kÐ. †\€´»P*úP¥/Tr£uÌ8¦jšÇòé-‰÷E}áW€{›­Äüz¿„€ä£®æYþa*I=$‰Ÿ® UÀaw¶ u8ÿ<œ—Éí?MUêÆ!åú : #OçMœ®ÔÐÃiE? "ByÁ{§+^æ U•DT¶†>üöbшP}»uKDWe^¶² Z+*Ö_3pÚϪ/_ÆT>5G®ûì^kÏ(y!š‡$ù Y6m–„UDM^B¾Å=úëa2{÷ð8uG…Ü-Ý›¼GdºŽ“$Ì«‘V)#y„òð×Áо•×'(UËv§’´f¿×8UP”±œkš÷š3LU ÅŒ\ž„G/M–[©Îµóœ_µí­ÏH~ü€¡W¡CäÔ ±P¢ÅÊu®í)ÞT(¥åYqJýÛÍoíCRè|&ZÑ©¤åÆ8fîúŠ Q¡Ƶ¨¼f-ûy. 6ÂÛî Æ¯(¾ySÍÏ=GÖËnù–žÍ¼˜rú»Ù¦Î£<¹›¿ø21/_þǹ·÷2Vï5æéÊç¹®ØÇû0KË:&åGH®$A»_×n¿&÷n¡ûšÀ'·=÷új®òÓ%Bžqc óÀG[o†læeÃé–ÝHšp!ìÚ}ç'öxu-:¹ÇûO­]"C]×Ý¡ïîÐvw"¸‚”¡]«Ë½Ý_°úæn_t èôÞÓ rT핦Éjq·cŽ îˆ³¯˜…ЪÍB|j»÷[¼!_‰nø2ï–ÂH!ÙJÆÛ”<¨`…tAքаªŠœ]û¶IiöŽVu¿ßý1!ÉB5¬?’į»ÁÓ3ø/¡è¸5³¯›uET] S|¶U(Щh*Ë÷?Öü Uƒ´á endstream endobj 133 0 obj << /Length 910 /Filter /FlateDecode >> stream xÚÍW[OÛ0~çWdH-çÒˬ”Љõš1 P•6nëÑÆ•ãÐ"ÄŸÛ!i‚I+>®Ïý|çœ4“ý­iiÍ–m´ì¦6^l™É·dª ⢷$ŸÎõ ç·ÁÖÁ©ëjÀ4ÚfhƒIVÕ Ð®kÀ©ë–,·æE(œÖuÛ¶k^ß3.Žûâ²BtÆ)§ö Žð„ЇŸ(Šý¹ ;õÛÁ÷­î uŵ\ÃuìWú­¸ ÎÛ@kíFÃᾇ­ wÛìÖ¹x­C O¡ éLSBâSLÄ~Ã15ê:h´L³¶{À½fèL±Óú˜ˆ%¸Ä‡1¢ÑÓ5—>a8Ì !‰&B€óe´H5}ïüœ‹Š\#úÌÝýu6žŸ{Ýœz‹βòžÀˆü .b4Š)ÂáFŒJù•ÌE€Åbi9„0”òÅ¥Ú&ÐÞ¦¢Í£n ål3À)$ѧºÞj!ÿ±›ë®rs%½¯J^±º¹ºîÞÒÿ»«ãÏçªÛX®ãq ïwí®¼±«™ÚGi É&õU׿`¤€”ˆµ ¤Æ¾Ô4‚·ñ *ÛÊ€KÁŠy^ÄNõ"Anò“pšrð‹UTV®Ë®ÄrI_zN÷òr£ÈÎf‘!•iÊÔa9=lVª½³Y©²q ¿ç“5Àÿ…øw>Dq endstream endobj 9 0 obj << /Type /ObjStm /N 100 /First 816 /Length 2091 /Filter /FlateDecode >> stream xÚíZYoG~篨Gûa{ú>F[Š ‰cè6+èa,Ñ7äŒÁcåüûýªgHŽH*¢8ôî>ÐL÷tWW}utõA9’d)Rš”W¤i/I[2Ú‘rdw— 4H"EãI%JN ´$%½'îPQ“¹N\HYeI”N“Áxg™vVsð!ª*HMtAûµ(Áϲ¼”ÈFÄ`Ç‚½&°R1yr@— Ü1ïÈoЉ¼½7(½x@Q‘€¨$y@Sš@Q…ÁÛÑÝ@É€qŒ7`œƒœàHÓ F ‚NLïÉHé ¬„ÞÑQøˆPMÃ6ýJEXÒx&"ã`$ëPlä2…AB—ÇGÂøâº#B´‰ÖSÂø% †*ÓÂ$ì¨×(؇M¤#Œ%A`"¦–}'AlAn`\ç`)|;XH±µ½†]¡® ¹fÑr¸%¨—’“ >A@8™äÀ¸±àà mØÙ਼‡ qHâÃYöÜî,c‚¾Î©p”åJ"%tIòjM¼Ä7<è%Ç\ŠXã ZØ1%Ëñð­‘ÜaQa°@î-Ç™áñ¬üê½d9>€…2¬ó‹uˆ@„3·ÀëÎs Üš$3L¨pèGBž•iðêÕ ¸øãëŠå—á 8©«ù°šÏÈc" гá¬^Lo†3̪ÜðóðvT¾©¿Ñ•DƒKNh„N´JÄt=—)†ÃÞ™ú‡²€·`J¯^QñѸUÄ`ÌU§õÍùpNWÀqú–Š‹á·9]/Çïgn „cŽq…«xëÙb}0Âçµ9cñºªj°»âÆp”oŠÆ–ªÁ‹PäB˦PM¡s±3óç‹OóüýÓ¨ú}P¼©§·ÃiƒH^3êhëT棜œvÂ!ødE t¯³áΩxW_ÔTœÒ õ’-Ö_¤M)d%Ñká’Þ)ÑI¢–B#5¯D|+»S¤;ŽHȶK‘H¢"·Sd8’H§EkÃ:ï„u~§ÈÔS¤LÂfQRä¶•Hc„ qwôô+<'di…s™h×Î|W™6áºzJ%°@í–©»2OéJ7ɦøÇoÿäõ;x„¢j1_ÿižêdU…µG/?xÏÐ+Çš¸™¿Œ?<ÇBCžÔpfÛþÐr¿|̦{q9U_èòÃ¥8{ýîGó;úyt3­gõç9ý:š-Ê1¼Üÿ¾šÍËñ¸œêªaÔm¡ú3½Uåô:ÍæÓѧE&Übsyöá]‹£}®§:+«ÛzB“Oˆ‘wÃj8-çõt‚Ó›‘o£ñ-+ñ,L¿ÜWü‹cjT-58Ÿ/nGõ6““ŸÞ?ÅÚÌï†tRO&€Fáá6Ÿ¿•“¯ãá¬avq_Óªå1ZÕÒ‚÷9,ѯ?¾”Z¯©O–„„\Ø ¹à{-™¡YƒiŠfŠ÷'Ëâî½HØÌ{äÊd5o®o©|ð":^ä ZÏ÷˳÷ÍëÅÝ|þõïEH›OÊù¸_ˆòF”óbQ-¦eõhÚ ›I¡1½I‚÷¢8 ÄnÐI¤½~€Êé¿Ë/ÏÄcRǯ¤HØVcEXÜòšêíˆ'ô=<\œU_pÃr2{.¼ Ž8³ /#°}^ ±.>Ýdv[i1YæqSOŠaõ·Å¬>M‘6 /WÖ«òůç"Ê—¢œ}ý¶‘ëÃÓ™p?ª§V>¦>‹@Ô›32Ê^‹@T. [ÝsÆ´‘2¢}vv0Ø›ÂåØ;ìÞø p“ØwŒôPÜÖ÷Õ¸.oÅÝ|2Þ§è÷ §=¨ö'Ô#Å^û‹´ZI๵‚éÈ¡•¶B+õ ­ôüÐÒIa W¡ep*ÒØb%´žÈ«lÒ½"+ýŸEïƒ7=û…V:nh)i·.0¤î‘¯ÈöðÕ>dO:kå ‡Žë}e¢dÜ6‹ï5çø:°ç%ˆÁžÊÂ.Z!ùÊ2%ìÁb«³û»uÆè:àÀe}mÝ#¬ëJéí´ç­ìí\G3¥öŠÀ=Ⱦû¾F)¿­¿í«¿;r–ÐÛNÒ9©3–†íá³#c_ÂûÀŠEâÅIó¦?&ÿëM>ÖEÁ>ð|Ãå5…3Ðy)Œ‰GÚ…Ý´Õ]û0¥÷›‡‘¹€]e4Ï›(ݤÁ?t4WÐϽ=ktßY£Ý~ÖxH¦£üSÖÓÖè¨Ý1ÍÁHÛ}-KˆGp¨Ùþ!ŨžêýÕ¹r†¿žÿês=¸2Ò‹@ÝwðüvJ Õ¾›–`08£‘(('ø—gäåÑÊÙ9R†[3‰LÁr‚á5vrN™k3¾• “À o½”ÐPæwJ̧ÛâU–$¼c—uFÝÕ©i±^ægýÕô®Ûºc¸U;FU±ÅÕµKæ§ÓJÆfL¦0}ýW<¿˜ÕX4c.5Þ¿(·QSw8*nÖöy+þß5;0;¿yGáּQFæÞõˆÕœäÿkàPæ/Ãy'IE©<:ØõФ³®u©LÌ‘–ßkíÚ¾¼]À{ôІ+ߨêöÝÚ ª™gl£–g-|”0E›pž ™Îøf¦¬õôð`R¾íoÛòØ–;fŽj Þòw9qŽ^‰Çãóô[+ºYë˜ 3k½Ñ©w¼—[øT¯y´®p© “xê›”ù5éô6 4õ潊‰ëÁE嶆 endstream endobj 144 0 obj << /Length1 2151 /Length2 15337 /Length3 0 /Length 16617 /Filter /FlateDecode >> stream xÚ÷PÛ[×À Cqw‡ÜÝ)îî®E‚kpw(P¬HÑâîîîîNÑâîPìrÎ#=Ïû}3÷Nf’üöò½×Úÿ„‚DI•AØÔÞ(aoçÌÀÂÈÌ •Ñba03³123³ÂSP¨Y:Ûÿ³O¡9YÚÛñþCC4r~_3r~W”··ȸØXØ,œ¼,\¼ÌÌVffžÿ(ÚƒxbF®–¦yF€Œ½Ð žBÔÞÁdináüç?_Ô&4.ú¿Í¶@¥‰‘@ÞÈÙhûÑÄÈ job töøÔ|ÎμLLnnnŒF¶NŒö sz€›¥³@è¹M• P0²þ»4Fx €š…¥Ó¿ªöfÎnF à}ÁÆÒhçônâbg Þ£T¥åŠ@»)ËýKðïͰ0²ü×Ý¿­ÿrdi÷·±‘‰‰½­ƒ‘‡¥9ÀÌÒP”ctvw¦Ù™þ¥hdãdÿnoäjdicdü®ðwêF ae€Ñ{…ÿ®ÏÉdéàìÄèdióWL¹yßfq;SQ{[[ ³ü_ù‰Y‚€&ïûîÁôïõ¶³w³óú™YÚ™šýU†©‹“º¥£ PZìß:ïKðÖÌÎfff.NÐt7±`ú+€š‡ðo!Ë_Ëï5øx9Ø;ÌÞËúXšß?ཛྷŒ\g ÐÇ럂ÿ%x€©¥‰3ÀhniÿÇûû2Ðì_ü~þ Kw€.ó{û±˜ÿzý÷›þ{‡™ÚÛÙxüQÿûˆ™ÔÄTDeUèþ]ò…""öî/6+ €……ÀÅÁ ðù_?JF–ÿ΃ù­´™=€ç_é¾ïÓRvýwPÿ{@hÿëKÁþ½sê?®ÇÌÁlòþÆòÿ¹Ýÿ6ùÿ×åyùmôÿ›‘„‹Íßrê)üÿÈl-m<þ­ñÞ¹.ÎïS oÿ> vÿWUø¯Ñ±·1ý¿2ig£÷Y¶3·ùï6Z:IXºM•,M,þÕ.ÿZWÿkÐl,í€JöN–]-fæÿ#{Ÿ.ë÷ëÃé½'ÿ߇çCŠÛ™Ø›þ5e¬œ#ÈÈžù½•X98^,ïãh tÿ»‹LŒvöÎï&€÷â|fö ø¿N”“À$ü×Ò¿ˆÀ$ò‡¸L¢ˆÀ$ö‡xLâÿ%.“äb0Iý!6“ôb0Éü¡÷xrè=žüz§ð‡Þã)þ—¸™LJè=žÊz§ú‡Þã©ý¡÷jÕÿÐ{t?ô]ó½ÇÓþ/ñ¼ËŒþÐ{fÆè]Óä¿ô×2™þAÖwKSK èô~çýQzß/à?ð½³ÿâû¤2™Yºþ‘sü%¶wýÃà]Åüø^¤Å?ð½JËà{™VÿÀ÷ìmþïéÛþA–÷ôíþD~ÏÞî½ÿ!ÏÜþ¿Èþnlÿ?â÷Tþˆß#;¼Ï¸ý?6„å=×TÂòžëŸáø‹€®@»(¼ûpþ£ðÞÙüÇæ¼'ììfÿƒ÷œ]þï)ºýã<ÞÕÝÿïþ<þïé{þÿ3d&. Ðû£æïkð}ÿÃ?×€@w  üò‚½É§`«šà¶‡*a7†Ý þYŠ]Íd¯eP»Ëod˜DšÊôÀ ÐpâpêÚŽ8õ­Ð ñ‹×qsLXK¼rë“÷³aœÊôn+üÒöÀdÞ±pm?!ƒšÐž÷‹£·F€5D3x§ E–£ 7²Rƃ[Ÿ¤{mÉêXè®ò^%§,ÂsÉ C”úW½€Â9ŠlãŒy\Rhg"XZô w”¹Û»YôÌÉ7b™8:xŸ“(¶|/MÖèÇyÏŸej¬N]xäx:¸D·ècÓ”^"I28‹^E12¡‘fD í(FŽìÕ$Ë|%£“[£¸‡†¢%(;Ó¡1&ÊÛ"Ç6ª™¸èYµ\…3/,†¹ðNÊû/Øž‘åsé  ÁkçS%Ö°”Þo6ƒo©¡;Â’9—ðrúy|g¨ê¾½ù Å-±g;ëv{¹#v|àz¸ô™œ”´ƒý¡{£¦}* 6F8Lf4ÂbA’ù úóéÍ¡ ô7kp‚â¨é²VcÕ2žÈo½ ?ŽM‚W øö…?l.:ªíº/™–è§£S­xeºí GeŸ"ÈXUsªtŽû3DŒÑÇÊäÁíƒk¸*‹ŒŒò’Âs¨ð›ÂÌo x'ꦋg¾ šVŠ˜~óž–.™: ‘2pû"RQ: $;gÉ(eÓŒÏí g›ºî”aÄæ\¬˜#âKVÓ>!­áRã•)býHBÜ"KhԱ꾳È®§KVu«|»Ü®#ýÕ;µ­·¥©À(šO­1£w®°·G˜ÕÞÓƆ 5',xecˆêÔ],ªÔx_‚Ðía¦êQ´µÐi¼‰6Þû™Ç…È!zàNi{(¶JÁ´@#ÇïbQ=83$6±œÝÒ­4iPèƒÛØD ÕÕ5ÿ‹¡hÂSv|õ#[Ù¾ïÝŽT¾Nç®2ï‡ùa˜Vbä…­qÆ„i,÷–ì\WÜï%øÔ©è|:|œK©²«s©µà³tžÏh’íÙÌà4]~ í²øÞÅJÌa“pl¤âl.iù€¨…Ý,Í·æ4}¤útž>(4"[oûà°êØ€á@i=ÛP°P_»”„£ÝSÄ»,z)ß ƒÒ!puJ_4ôu_Hœ$ÉLLÃ`ºÉ¹0èï¬m±¶©–{,` êÄâ“›~Ò³±uÁÉèqîm%pÛƒXh2[ ˜ÒÍtjÑ΂¸„GžW~ ñ.C-êØP…‡djüÂ}S޾œu-ö¨V ’˜ D-Ñ4è*ñ2wÑ¥¨zKsúZÙ˜¸-Ië*Òž—mh›æÆxµ 놹î›äZžê—t~ ŠúÖÚÜ>Þ–E ·š¦°äó2ü˜“Ðc·¯ùDe#+OÐ]Àð°ix:•£lŽ%+ê¶‘¸ÀH>÷p¤ÛÚ+½Dš‘©Kô>†‚†Ûs½·bMͯ¤é)¡Ò°W™-Ð):h~qöp$鯍èóYd‰®»%·_>±+ c$¸YwúI=²YŠûÖë¢äÛžxÞ'ª`=Í>CèŠg±{a„ô9xª0i>"3ÀµJCíÕÇÛZÄ—Í®¨Úšü÷uÓ a3D™]Õsî‰NÚ)KvWé…§áÜHéØkÉ×ófšó’ùÉ*€B²´šÚÄÃ+! ‡dÚŒ‰&rÃr¯uLc.Š-Â’bk"cúÜN‹sÖvbœ 2š%åü—ó-®3gí£nf³Š2ð»ÀVd>]ÈÐéÙÂOÊà=qâŽôXãaD/ØðB+ >‹Ítë¶_,8ݼ„QLøø×+\}ÒÆP”ÀDó7`gh#¼„¿Ÿ˜ÉÐÝ”³”GÆ«Ú=æõïø’Eù¢Ñ†êý¨×³¼ Áz”·LqM¶•ÈÖÌÚ³¾xЪ>‚#ûÜ…[Jjpº5‚ãl‘ÛÖ„ºò¡zê(ÈÍï3+©8¦Þ‘¬Òr »È)¶Mðûûž=þ”{ ”äã¸Ì‡BPCôt*¬;õq‘ûœ$¿ä_ÒAÊõC¶câì~¿õêWèOnE@¤×ÕUlžw–ëgš=Œb¡„„lÙË{‰²ä‰x˜¹p)mz6¿šÔ¤™ŸN½b8­›³*oáñù=jH þc&Õ0¥¬'qAÏbzòuhª)® Æ%‘;‹ù^áq™c²u"RèÉW€K[hTeÛO)ÝóŠÔ_F-ª®B3¹–‡ nû3d/¦©ozFÏCQ)œF6|Óô €á³úÔÑç+ð¼»WF¬-y‚Ókk^!Y»;’™ ?`…jx²mÊ~÷;íq,wH¶ÌhD˜µÞÈ µe¯uçIƒó}n>‹f<»ÕÿÄp}Œ -é£JþÑÈñ~Ëq±ÁÚ…êÜ- õ¥ò»G˜ÄQrðºCoëGÌæø>iÚõ:ÑIÁTEÃap¨6öïèÏ¼Û‰ÕÆâûYúÁ, 3ÆôA¤a²ö̦ƱFø-'xoc™ëfì’ceÖߨ½ö{Çy×àaSê_×õ€2KÆø‰£&ó‚XÕ™ÏcÃ÷Ntè9~¿ ëÒ~ ¨ÖàdÑ9yX‚W_N^›)ê®$ØðžÍQó3ó×#)sä}–V‹†Ø2Ŭ‡,>Gée‚\L6.?Ý[6 vœ…cÁÛKN§˜Xß*¤ÍE>Û}Îùíºˆ5OÚš¸šòí9Ù)çã´×ë9ìséþvEƒž„ë­ú‰&B§¿Í<…;”®yÝêiˆ§o>º(ÂÖé·oÖ6¢5ç(-k„¯Ä4Sv šóéŠL`˜ò¨)å~Øsû¾×:Ží§Å+Ä–Ò9!䙢£ji´îA%ýúO%ûI47Ä–™ààÎì:iI`sú¶»á³`q+ŠOñþ·m4æ`–¯ÍðW dÔ²tͪԴ¸æ˜ñCL°#`Õ!¿Ðß[psËç°OÂyððîŒÕnY½Ú‚\oÓ”n¢É¾eÁû»_µîÞ·ŒÊõ6õe"x”†–ÄUÝLr L«1y™+‹^ú”šŽtÁ-Þù.í€jI*!Ø[_2§co[¿š)åÚ7žúwÊÏÒPÑ'#Ÿq2­jzY,Ÿ3…O§Yíתú̼žÊ„y"L;…FÌ7üŠØZ°Â+Z¯õõL“órÖS™± §‰äõTP•‘ûéAheð£/aðQ=xìáGšµ)ß)Ya¬ßJÌP1Ð2JؾÔ¾<Û”½ùë®ÝÛo¤°AP4íaZûü 3F ¨K5ÅQ,PÛ ®Ð,k殂ûþ융\RwqØÇ$¯×õ 7/ÝV9ÛŠìDEí˜ËÆ?ßvóš£À³%®<®öjwo/)Ͻ®Ý”uét"d¾å86ÁÓ5o !œïØÚÑoXÉÛ‰›I#Ú"©HUªC–×i#Wr÷¤>(„àå¾eÈ¢Fðè÷剔ôã(úË`EœïS- 3ÞYwyñ) õ|Ü%g2ÎÙ¡0Q© ݲk#¤ Ú¹JÍæÁÄäŽ ^S@q1TË8Jei@$¦<£…æ)PºH{ß>Ó½-0ד"ð"€Çšâ¨Â\”—öpV¨»Ý*’Š/>ùM]\óKÄôò g¡Lë’†¸3c‚¡í¼ ¤ÜêxyFõÞ¬3ã"žrR5èÀÕuQ˜›"ù¶úÅïÈjΕ«gy†^ßåDŽ(d„æÜÑK¦€g–pûlž÷Ë·LvrC» è˜lD²¦}1!d7]¬»á²’µŽðzNµq®g/²K=VåÏYƒ.}¥ƒÁÄ£ómoæ.S]ËÃ+é{tSÝK¶†PµC„“7A„r8]T¿‰ÙFy?ç s‰ÆøjÑî%w¨IþÖèsÖ[7Eê¨#[`öߦ pÙ€Zõ¼1þ…S˜\Ep\ Òž>-¨Qˆ¨Êl ¸žÆ3‡»ÂW×¢´ÿ»¤Ø±ý{sNs‚µÚ`÷!ÙS²òô`©53QúòâaÖn¨úFº,ðÄhþù_„SrþeèX$ñãó©ÖYl=æmt³–¸XuúiHÈP½Õð ÓÆF¹ƒóÚÒ¾(8à›_m,>Û\ʳÄëÏm ìueh· ÜŸA‘½^i”âå_ys¬ù(ᇗ©„"EÕÒÞù‰ð™¾ó+i•f²Å–Öîù€˜3ÏnÛú&Â,ÛïåZ_ÛSkx•\†|¿ÆP«Tõ±SÒJøÊ³NánY #¤þk·>NI–Í ×;ÍLW «Äf-”m5`Dw#Ìs¹Ÿ ]x¤ýRØšD`:¦wÝÉi•|Z9·ÔuÐŒ/Þà &9¯‹:ƒlVWè!äÏ¥¥›…ˆ shŠ®IÅÙ*#\ô$y+ÃtŽ@î+JMR·í“…´ã)/[‹ ܨÃ{—…×Ñgïƒ9V!¡œ½Î©ú;¾QÉB{boŵù%U=ײœ»w弎Sßà>áBz¬·­,>È%„6U…¯{ãj»ôœ—âØw"å–²ü)t¹^ .LŽ@§VÒ—ŸÎh¢Ý(›é÷bh+uü|'ÄÈ숧Ģirhh;×®}†AÖ—omÔ=yÛÅÃHìRÙ‡{Êî‘1ú‚LjÉ΃®ÙêL}Êu3v¿n;Æ"yîÑd²Mìé ø.¾ÙÆâ|Ž)ŠãªÏ)?AgÀy¿4yoñ£¿ƒ¤NÕOzSN­©'ð7«G ƒ,LÉ\%c-ä}ã WЧö-Žð›êíϘX‚–CÅ_éõͶ¨mSÇl™ŽÔtŠD¬E7_ƒSohŽÓô1ŸÂ’"9’!ÁQhäŒmRå tm°šüÇ¿…ôýÂî€$†ÎíóaÚ[ÕÂv{´Ùa" ¯ðB NhPuuÞK¼ê7ж-90Ú¥¨8ׯlf`ÐWÂ\8oˆEÒäq0ïÕ·•Ë¢|)«;ËŸö?úœkÉ¥N•!î&à{ÿháÇÆr4º5{A©âL ñ©ûmÏ{šø²Ð…¸Ï3F§œ\X! pÆ$†{Lq³ü¦£ñA-2?0›˜\+‹"I>Ò,T)÷[9m­J´_¡‹YK¶4®E„_°öéyŒÚ’<–ÙE%F¤ayLÛãéd;dîåvõýcw°Åʼn‹!^(ªCÍ<¤.*|}G®ïg¶c‡S£ãr«'S{µ‰Á£Ê%ýÍNXݡתŸºþBƒ”dÜ–;pê’â`_ãZÍm­"Hl«~·/ 7ʘy‰àÉþMÊÒ8¿–™öY:W4””‡/AXñNÆÝYiöÙ=ê7›Qßa}Æ ùNNwü¥Ì³‚v/™ ˆŽéí‡L74bIFˆžwI!ú¼†@gøÍ›öÔõ¾˜—kû‡œK©†¤Armù“O5ö[–ÇO™F™ü«ñÀDŠŒÂÉÇ<]VáöôÞã1GîQÕƒGüa\ µüX  †î-lÝh‰ xn˜ÿnSõæ÷Æ6s±œù½c2¡ J‰Ó5 ä¢Å¯Ÿv+à˜òÀèÍzwóêoÈò·½:¾)µ§LÛˆ”µ’g +¿8˜¢R]›ŒuQŽPö´áï9FdÓÑ>Þäù÷ã~´Íi†Ó/Âǟ਌”¬¶C.ÎÂSD*šåØñ™„\ŸöÓ“Q Ò‹c¿Æ®¸«`Ò¯! uQ4¯Ãò®(-8ªIøÚè™­ñèkúN{žîôð3~DŸu߇Ï9i'eyÔ“©Ëçå"k‡HP“J,B,Ó³"”Ì7E"¼[܃åÕz8­ü¤—ÅwÝ›…¦>̱7=ÂÍú.¦nù,}*1p÷ñ'­îà¤ýuND‡·i–i…­€¢¼ #µÉê fãæPÄI¸|Ééfý0xÕS-ÿª4úgjfœîþ´Ð J\ÝÓ’ƒèóÚŒy ÂÂWÚ€GÍÞês©1®k?r”AëLéb¹3qY1—û™2¿_Ö¬Q‰ ±oï®ö×ý¾FŠ6jË©ðýp˜KÜH-Á‚ø~Ví6vO&ìlÓàZ?8SƒsTà—)@…³šŽ¦§½Õ·öêÜЃüé£_‡±ãn†Ae ¸@z š •N òº+ù‚|~ö¸;¢2°ê褕 —“j"°ÃöË#Ó².^n7¿‰õe‘}†l0·ÝPÿlèV#ÉL‹Â Ñ"—´ZSï’z˜•2«éKa)<¹¸HÆÒwÂö>ëÏeªÊ”j'9Öð^üRç’0ÚêéJ>kÊhÖÓÂÖBE&ž„Eù-öÒ9HX9À‡u¾iÞL='YH»:ÚyüŸ‘…]œIäΉd– ž_D}M?Eë'”àÄ€ÜYNd>|‡RØ€½šB´‰_?I럦¿m~·]?èÛ~éc'!Ky¨—ì,¢ÂÜÁ-øoD¸'e^wÉ÷RïK†ªâCš}¨à°‰Ç½ì­õÎÈAnš\©s qˆ¢j wNçùH¤À!ÃvTÝa«rÈ›„̳gïÇԅ°ÅxuMÐÔ‡oÿXÉ×» ¥„šÂNÔ2«")y)û©õå6ýW˜zÝ\<Š-î=ÀmORâ¥T0oÔS³Àû©V½L`*Ò•–K[kš»ןÛýŒæ¶]f¦@µÖ>6u6Ý[.ݳW1§Ý Þô¤Â›èêw‘ºU†…² /°r¹âbŸ^c}¬R~tt ~.åJ©Ù®Ú‡]“gÚwÔ0;ÝѦ®$¹ìÕ•10FP8 Í㹂©„D %å&J\§û\‘áï;¯°úk]Y©æôeî ¶‹Îwª´Æ™³˜þƒ9düŸ$õ>†(öÖAéÉËØé†¯˜x —ý<ÆÅ_ì)^²ë±ö“‰tžJv]ÏF‘[uôÇ[‡ubëÞî/Üöê|„ñBáù}Ýq—8 ™+#Ô~‰…Û7ž² ˆÖõ}Û5HGVGè;ù¼k™"º—:$Y9t0²„ub?ò%M,·aHÎ(ebŒ«ê/qAó’Çù-§²]ÒŽ¶È;ÍèVC]Óθp¸DH{ú·„Ì´•©B¼Ð­X†û,C­gÖè;¥+õ`†wW(„¿[pÙî›§þL@#¡`ï¬,* #1$QšèKu€N³ýM ¹Ud»óíoß1NÈ5]ö±+F¢ üú"½´#/YØ3D‹|Áy´ÖÙª"þ-Øcç »nj0ØóZ9’øG$§Óû2ظ|)ùŸÊZQ,+0 ÅM×R!%+XÒª~Ód¯õŠ"ú&Æçü9d8˜VjuÓ^‚F Ê\zÉbUÑý^ï9ðÇ%%þòS 8Ñ-®´ÀB Ì™OiòÒ.]Î–Û Š«ö‚ÿ’7C4sŒ32Xײ\cwØ-þ„è Š®¦Ö:ÙÀÞg‚ Û=j¤„daÛ]”ø*€w{û#-KЗòÉhÛ¤›F_]XÛ]–e'YûË_9fBä@¦ˆw2lMº)e-ß Rr(|ö»TíWh#è±^@‘z^²’ÅÅ5£å_Kõsy‚‡X:J¸¢á´£¹†nnòi"–­û¥D>»…%*g"Rʶíí}„.¶É0o¼¹ñ>¸IÖ+Ï£*bç0ú.[r¾Æ¦Åu¥ñA,“ö»r}*"¾øEþˆÍÄüÄ)Žn¶”aÙ>ÖH.)Ê`#¦é°ñ“Êï}p¾uøø<€ô£gÉ•á'DÍ™KrŠ—ÒìZúÎDÙ(w¿¥´€LʼnÎü#£M’±ŠÍAdáïÄrÄ-+iç¥pä¨!/æ.*úÜhDáWjÖFŠ7T9§fJEšQáòqä3KÌ4ô:g+þ±W]Òë]ïÙù%Ra/x 5*..§€Îûà\º¤Ë.Ø 4Ÿ[ÛtÖn«,ÄZïU>º’J¼H]ÊY’ðYî‚ꎓæ?]²œè5 HbâÕ©|" Æd(à{âéK-%Ù~c0¯l~°27͉ëÛ‘+˜Ô9Cµ¥’=ëY ¢³N-h†×„j…›Ñ2”Á!õf•tU¨Û!b5˜¼º¹õEùÉ-Zõ“«ƒdB<““÷™¯Q°Úên¸`{è¦õ• cñzÚi›J7¿-½sL³7üŒ[3-žÞ û¸ëGeåm†rYWËIH´«¥‘Äë1Š>Rº>_k•*˜¶}ü‰œ8–_;¢‹¢uJž×¾6}(f½~ìËÿfII{´¶,}šº£(í¶–™~Þ†;Ê݃²¥»Kü€M¼)êŸ%0·Q|£*ô€ v êÀr¯DnóûÅGŒ~§Î¿4Šv¦¬ñ!m*9¢²6ÄÜói/1}ÞEãʳΤŒþ’QçÌ2z†Ýv0·RÖf¼-/Yv„2€¥ÿ,Ì!D ¼]ÝËÉ=|F-¾cùðdØXž” ýf¶±n³êÈ’‹°Ï`;Äža«R’¹0Ï6‡æ>&³‘ɾÖq‹uø¦_ªj[i ç8þTÞ¥W—Ù«vR(›X‰6¼á\2Ìä1 ‘¼ÖÄÖ>ç â~R?QÄ_ ›(ÌýGpxôR 4©ÛÁQíÇ+¾Ä¡›Æ(L~g‹Ó“O{ªº@™` ¼X`A{!ç[à  %ÌJ$Äç}®<ÓõÙP¬ølëÆzàx8z_[’ÅæÃ„Sä“*•¡ÿŠã6v—ú¦ôÙ—¹Y5$DXÍKàÒlŠo<àÖ¥y¯è¤p ‹æ®/§q2ÃìŒÖò/­í7“ßk³“èˆüaw“¢Kú’˜”!/¨«º9S>èáaiÁ·âHGy¸rŠÍï~hj›öÜó5´=F¹4I&f6hò<5KîpµŒa^›š‰;õšõ˜}E9íÖæ„äú Î¥‡¨¹‡^¤`´’jÓäFG A6»¨†”>™™y &vù„ 9"›ìTåKuü[ï×VÝjTf¬©bâXûbùÚ 5MÏ^i „Ç“ß1Í"ÖŸLÉN,í€IQ.¨ çĪÛí¤s„G/°£kÙÕ×Ш@¹ÏAá©Ì?Þˆþ¹üÁ%Šn}p}¦ 5S dY• 7yV'׫l Â3ÁÙ…ç¢bø<§ñE:Ð3/šìííJŸD— ß3j”CwôÖŠ!Í[Ê€1÷+"óº–"Jš‚ÕÄå·|÷³¦µÚÕÌmLCfJf¨ëÃ)%LíÉÓ> •›h¿çSÄt¯nÍÏéÄ|÷¤À\:–žë˜–cèð„Ôõ†o¡û‘œY4–Gí%eJ"¿öçãÅø!†»³;µÆ­qÂ`‚“'? @mZÁµYߢůš5”°a˜ž¾»‚· Zë˜óû*šŽ‚ÓñEw/ äbægIOR~Eg»jšv’ £]ŒÇ,‰#´ÒKx *^›— Ê’Â@ŽÛ5þTolö-@ø[÷/\« ¸ Y³}©¡ú¬Ô_Óâ¶±ÉwÏ­w,gš“ñ9› ‡ÅCh³ÇÒOÞÙ’séO¼Õ$U‚×)Éoa9ÊoŸ|W&M?¯¬=m*pÌ LE¬~4EúÄtm´C‘åðôå$`¶yåˆÊ^"@þÛx¸‰%‹²eRï\4ç#a!’±Ö}¡! ïqIù ;NbG7ì”äÝYgs²ï|yQ=Qg«ðò$Ï EX%J'‡í'u3’‡ö~S…$m†óÍלØ!p%ß„×Õΰ_?vðky©ö7dðÍ\kÁO ?£ªTû¼¾`Í(&V0õÇí3Þh Ùì¯ÁE¡¤XBw¿ÅLƒ+¥ÙõaeÉÈNû]õu¥ŒÖÖ[Ÿ:jN\?ëgªeð&*¶£î–sš½™kè=ö÷lܬeÌžZìû>³¯ÌàËP¸ƒ‚ƒ^n&.|O/e‘~Žö©^äÔjŽÏV·Èy`²»f rmÅ‚¥¡ ÆÏš„FõÆC¬×¡ÒûšJ¥Á‰¶ÓM^>ö›‹QîMç» êß÷à_·x­>Ì÷ ¡¤à¾`|êV°3{¥,×0œUì?g´ÒÑÃÇf΀²®Ó…K [XÔ]t꣮ÏU>ÆÍÞ}l;êg(b!Îòš¥×'Pî¶Ó+_þ^qk\˜…[‹»ûÍÌI 1SlB'ƒfÊžä€E®:–IY½¡¾JÒÙYlæn 7jài+QüÜÜôÔâZ­ô¿HéJäç–•×ÓtY<£À±eš îm4R˜-ð¥šÛˆƒRÑ8 …2tmŒ «WXLß…\†lÚ ­‘<Ðn¥r¥Þ… ÿô,´¾LÅsã¦Ö¢[DyÇ?“ˆûqä€sØ,üŠ•% Oã&P´vh#d¯¿J¹Ó¡¶iØnånK¤ÂÈù‹-jCõ #0›òã Îzù­´Öšþñ1k£H”Ÿe)º¬ÿ`F¡¦ö‡™6u (èß‹„Ht8ÀâC÷Æz©D]°µPâÏ+îâÂe¼ èÏb"y0AuZ?Î5- ´È}·dƒ&¼Gæ8ûin¼o**6ºÛ[DûÇFƒ5Ü×Ô™¬ªÕt–¦¦Žu(¾c Hæ\býÉ<´¨qÔztô.ÓbûÞ…º“ä%ÐÀ|Ö7ÃÞŽì°Z}êø o˜è_ÌuQö}ÂQ¦ç¦O„HQð.ª¹×©LJÅÄ1ÐÏÝJ 4Ÿtæ¥i±ÈŒŠpÃtý?§¢?¨)_³hg=|H@püL²ú¥Ažz9ÚÊŽ~áAI£æïGŸç°±Ès5Dm˜t|’è¸Q0lXCÍÓ5 +j„¡M…Ñ*rµÈô5ïi ²i†£[bãÉrŽ˜Ž*d:LX¯Â 'ÐlO†ø ‡ÚªSÇg¢H™á¬¤Âiyæ­ç+Z¹3zdÇ$aa¦®æ½¬š ¿Š6¢\—ŽrQÙÇBœŸTërÅÌ…„¾ñ‡ä¼ÇÙ 8é ¢z‹ô[³O5>ý?õµàn}à0¥~ÅÑ”–ƒS%ßÍÝ|BòSôÝÌè“€¾““’gÝŽÛÛòø>ðtõNvIþ¥pØ-¯˜û“Î{K†1öØŽ¢fµ…?!a³ ‘=ܵ)ȪsT¼#h‰‚I¹MUˆc`yÏÃEÇ/Èa‘•­~‚ÖÚt(22è_Þ—Kôx¤Æ‹;®>›\«ñm 99|µ…ZÎR«þ½ƒ°i(€Kð°tØì[I@õª×Þ—ð£¿9}Ê6®7¡¬¼Æýêô3=Í»Pº§òÿ(‰DŸáUÓíÒÏàN93]0JÙ4—ò|Ô˜‚'Ñ:±82s£åÀ@þ܉d©¢ç¸é ÷”íÅe†ò¢_’nÊg83ó’ªÉûë™\¿÷{±V¹í^ƒ m“ÅpFµ ÍT'¢_ÝD‘“Ž©úþí€ÕÔvØQœGá1~yx-QE¼H¬F}«L±öûO~ç‚~¹ßŽ‚V{äÜRʃ·óùˆ’dÈäJÞÈßLÑ8¾v&¦™,¥ñ‚×8Y †l£Ò<|Ðèn2"ŸÛGÊ? :œùÙ=¿ytdàÓšPÓȇ[Ļ޼nˆ„v­Oâ`S¥m­èžïäàf7]X‡!p͘ÁÁž½cx ¢‘¬b܇v ¨¥xƒÅùùvm™ …‰e|¹ywÜÙHžÉÇko:…›ºì÷ÄJ¬P¿ObÙ–7Ë¥Bbܤõ% ÃÝ t€¦°(œY¿ÞúZ ÓX$ÞìèL·MÈ‹g7aZHí¯áëwΟ/m},dÁF­ÎuÛìáð•_Ç£U»\(÷§ìMÊ™>Ñ÷@>[Í5ávâÑŽnÛà&Ä_µ9—r¥o#„nl¥¾·vùaߨEÒI6/„Hò¬ä3‡ú<=ÕKáú˜ð‰ç+§Î?¥Òy\£¹Ïïj–?˜È}ê u[¸MG O‚6C‰ÝŸÆÕ+矘ÀT9Zc¾€âØ ”ÚmÙŽ‰¾÷jK„pcê¨/™- É ùÈ#׿¢nÑ “–í%ê")[r÷Fîi‚¸ÌÙɈxÄ?d3ÞF™©EB±ºQ×¹müÖεrÁ¿üLsõ MÉ+bM%h—÷iqª§Å—ÛÏúæ¶)7)§P²Hî(f5Ë‘¶Í4§z‹õâuÉ~oç•ïæõ¹G#CrMQ\ò–œäBÆ*ê†Ò¿V9­KA–ÇúFžÚíâøe£‹Ñ‹a ž%ÞA4×?+?’mÍCâøùJUÊbʤmì0¹Eä­Àv¶Á`Pã­L¼\ûyCxŒ>,ÄPhüNñ»ÎëÆ`$(XÒƒm±Vµ)EœÏðë =Â#ÝèÂ4ë¼Â„Õµ&,d†ÊFU“â–~{ãý|½ô“y³Vî„~/$âŽÔçRº›µ>J˜Aº­ ’Õøh^ª]B­P|ßM‚ 7âk‚n-^Å_ãjÃÛÕCŽS•ßÏÛ'žï£!"«Öةο•9ªž’=^WiONsw‹+¾^#»c#Á¿²ÿ¨IRMö£4*AEA}]b²›}N×' íй·ÊÿÜw°Â–§rrT”aNw´”D÷ÅT¬ðd±ñ˜œÄÇG›ÐDëØ‚»˜PmNþeû~Ìò°¯~ï¾î+›¼ß…¸¶ºÝ·ñÞH—s¼ÂŒ¤ Í™OˆE»”xÞ©º‡ÅH}V!`c[€ùSBå¼EIüâ°_7•;Øà~%aü0ôi/µÜ,±tÀjä ‚¨ÒªŒÈöäåŠÀ$f„ÅîóÁ¶!ÄÈÿh³< ý”RÜ#`71±1ÿuö{v&«Á"z ´´Š|õ²ºx׉û,–Ð/'fbc“4±GÏgVl¹vû«¾Õ8C ÁShüäø&Sj€Á¦£Q‘ü.¢}–Oïù]a½±uÔ00јxçoÈ Z¡ä¦_…îÄ߯›uŒºìžµ^ ÅXIÆua%©Zª°W¥öµ"©{FNu¼p½š\ê»ÍÃæ.ßv±Ÿ0h9ѹ©äŠP~ÓÇRç»…s`«‰dh;Žh´v= a@Ü{ ³ Ã!Õ¿:ñ Ö·ÒYùlYÄŠ]ÈÄÊ””QuOP žÏ?Œ×ÁpëF>ã¢goß]°GŠ$‚pq ³ï÷5Gùh`•¥ìl°òɺäCmÇgšÏè¿,úRÚ%sÅüxj—û%z{Fwã털ޜÇýX¾%ORLB~Ô›·^ÈApsGNo…eµÅg\RXû©ö»Öª¥QÙ²G~‰SœË´^Òi•âøªÐ1/§”¤fõ\܇ñ– מ-‚´§)‹ólD÷igD¸ƒ‘™õ:r0­b}VÕ@9šUg^ÏF-Nxò6OßÐgí£[Íï\,Ò€Æ^ Ú‰UñÇãžÙ÷—}¡^Tϵ@²ùy¢f¶µz@Èg#XþûöøÖŽôé8Ó…æÄ’’¼Õ]¶È"3ÇÚÛ)‹ï“Ï~þh”x—IºC¬EÁ,bÊúeûbh‰ËÏ\郬¦û‘K,©ßâ¢uÕÓáÊG/e>nY™ A¦Pã{‘Œ©&*l ÕÌk‰/b&çà(•E}¢>Xª¡CÃGmؼN‚¦ÐKjáÑð$Ü, ÷o e–˳fÁïØV&ø¬L‹[ý|®•pRÁŤ¹Oâ2Þ{„¦CArÓ‡ÇGþu%‡B¥GôåvèÛdˆzþaÁRm‚îÖ“‘@DIe IW¢8nC›œ+Ì·;ÎÂ- ïU“<]\”¼žh•YÑ…ž¯Ãek¤D£1Ú"|Iå K‡8âÆsˆJ–ù-í&x“WòÛ›G7Ïô0 Gn]'ÉEÃÒ‚–K™JÔV§T+î¢v…AHM×ރ듙m¨P’/ÈŽòéªfvlßy`òÀÅó0U9éYBôƒ–»-Pûµé¹÷ÆEºÞ0:crùØÕE´Iž”E)EÉKÌl–Ö :ýåå›èòt·fwr§Ñ'”Ä'ø5ü3{QëÙFOÍåehé§å~8=¿ÉGìì|5™–Á9ÒÈ2î3˧Yìø&©Ñð†—ÅÛß·¢ÈQÉê]K\›ç¶§D8Õí-„öÌS° ¸DR;²E/Äbú…SzNP ] Hìg:~Z˜h£Ù­~Òºü¼»¾É¦ÌõY›Λ·` ¬°¾ªx›"£¨£í¦Žvîѧe—þœº­¯«’^Åð¹¼úv¬\º‡GP,é˜/O7” †çý4w{ñ‘¼£§9ÏúÎ…ÛrôRÅW6¾|T¥¯Ú*n7¥ý­Q„›Óðu¨×TvO÷®·É`ß KäÄY×C‹Åí¾!oA$èÛNor*? 6ru`·¯ðOo ‹µ*=¨Û&6ÅùŒ@îFò 4ØÔ‚o§ñ9ìEšŸ¬[cˆb†rÃpI) k»6¡æk@oâh¦Ù3‡2Œð¤—„ýÜMN‹ ¨ï«nÑê³ß_ïò1+ªƒå <¬nuÃ9×¼÷ý&¤4Ôg.³Ö¶‘$ëF“œ\yv+šHÆ«¨|¥©'ˆ ‹ˆ>æ|Œ¯p4ºÕï89–£—"!­Y¼‹–Å_kš¹ª_ØlxIqA\iÆ¢FnÕw¯¡ÜÒå7È ›Å'çôF8)½ìWïCuÓF8÷VÀ׊°ôÿ,Â"Ü—stƒŸ)Ê©ý‰¾VÞ@mî‹g¾…2˜¨Ôƒý«ã:Q}˜ð´iF^ÎùÚëæUhŠkf«cy ~¬Ï òë°ítëÓ11_¹ºµµJ˜5%BQ$le¿¿×ó—ÁÇØÁÉ$c— w5ê_Âg…2q=“-¹uÍâ%{xäç³HJ¯ª=m”ãúËÊÑ õª›HÚ“&¶’:w ú~¶¤åq7ذ‰|÷J…‚Ñå÷î—?BÒoÇàQäñË4ÖBrEæ¤d½¡±–¸B(3©‰FýeYÝê›íu&Œºbh?ÑZIê´„CÞµ—¿•ÅICùø9q^Ÿç•µ'»§æˆá¨“ñvç³-KN×aÁÔ²¬”ýí4ys\žãï­žºúd Ð!‹ e£Ý7=e©„cÕS” )=Úe\}h½l#üðWX_9_YR0Sßž…L<Ÿ`"=Æ<^_¢÷ é?u,¡Ž3ÒZøùÞ9õ_e¢\GG1Òì‚Øôì%Ó±¾ïú˜+,>ì„((F^À5¹4ŸyÎѼ˜ó2@<—õ!7»6#œ8ÈÞjôÌ{y{#Ì¢Çëu¦¨D} KùrZ1;E;ÁCTˆ&W²ï˜¬‰ü³ÅoC̪’~F.¡5ÛîÇÑòpàªõ2<ÿžWuרÐDÚA•+‹šã}уãgNaŸÐ}¢(S‚ïF«P—ºV…äIî6=Ô?­I‡*Eý}KèGTÞì/Ljk Ÿ+Ä÷j®A8'¯1×ÛãÓFì‹Ãh“ãIG~HÞËܲ?[&D`R› ï= 3çzàG(V ã¦Ó¬£¢ž)LG^’Ê mg³^xåZ ú)7ÆbŠõ«’úØÙaš™Ÿ×ÉSzÚØ]0ZÐ|tÔK>ÅAIÜý¶ƒ­vè}vvvŒøºØgÿ].tG endstream endobj 146 0 obj << /Length1 1398 /Length2 5888 /Length3 0 /Length 6843 /Filter /FlateDecode >> stream xÚwT“ë²6‚´ RD¤JD`ÓIh"½÷^U@I€P’„Š ½)½7é*½ƒ(U@”ªt"EEéEàuŸsöùÿµî]Y+ygæ™öÎ3ßúÂ}ÃÐDH †²ƒ«£8!°0H¨¢§§A 1aHÀÍmŠÀ¹ÀÿÖ¸Íá,…”þ„ Átª¨‡BµÝ]€`1 XR|KŠ‚@·ÿ¢0Ò@UˆÔj£p,€[…öÆ q„<¼P> øöí[‚¿ÜJ®p  Aõ 8G¸+!#â4AApœ÷?BðÊ:âphiOOOaˆ+V…qçz"pŽ@c8Žñ€Ã€ç-õ!®ð?­ ¸¦Žìoƒ Êç ÁÀ…  Gb .îH$dšhé Ðpäo°îo€ ðÏåÁÂà…ûã}üå BQ®hÒtÚ#\à@u]aœNAÂÎ,Šàñ€ \ vÀ¯Ò!@u%# „ÐáŸþ°P à c.ç=Šœ‡!\³¦‚ru…#qXÀy}ª J¸wo‘?ÃuF¢<‘>Kö$Ìþ¼ ˜;ZÄ ‰ps‡k©þÁT€ëà8 Hê–˜”î„{AEΘz£á¿Œàs5¡?4 ´'´÷CØÃ ?,ÄÄaÜá~>ÿiø§ƒ0´ƒ; €G'¨áö¿eÂü1/ %ˆ@?0tþù×ÉšÀ0 éâýoø¯‹¨˜ikê« üiù_Fee”ÐGHL($*‚AâRÀ[„ƒß?ãBêø_-¤= xì¼^ÂEý]³ÇðþÙ>à?ƒé£Ô…yÿÍt+JøÿŸùþËåÿGóó(ÿ+Óÿ»"uw—_vÞ߀ÿÇqE¸xÿA¨ëŽ#¬а Èÿ†ZÀﮆpwýo«BX%¤ÒB`qaøo=«Žð‚à 8¨ãoÚüÖ›/œ  7Daç‚ô_6–A ,›¿M,aåp¿y.à KõÏ:ÔPì|ûD%$ â Ÿ I}À„5…Á½~±("ŒDá.@BÏ~@{p>h ) š0ì\øGl¨;CHþ‹„ÄË¿Ö÷‚Cã(¨L°SupËA¥«§Ðò ,éfêÁQ¡Á‚û¸.µa›…x“¬ÌIgê`õûNmúÊnÙ³¶}–j8j½Å÷„8ÔW8ìbÇÏö.Œ&øì³qŽÓ4=±HV¾.]Œé"2d¢m§T€9t™pÓøþUÝñ1Á“‡¡Dý–vH‹~k{eI¦.#Ûmó/ŸŒqMv½¦Ë;Lå|r}´m‘¢ŸÎ©#Ûzˆ÷¬ ïéë¦ëd¨íñpù;W(ŽNM¦—MUœ¼Â|:ïòÏœbtz;+а®çs|ÉÕú[ŽK[Ö7xÛo9Ú&ÚGƒ¿àÙéÐÓ Ê©˜Üü•HØTvIC|Â>Ö¼# ¡ùz¶ì»³vXˆŽ÷ähÇÐüOw-ËwÝÁ¼‚zñr§¥K_üê¸_Æx؇7ÿU™L·¤&À˜É·îg”×Íå’5½Ç2j!j)•êØb*_4};¸9à˜µ"µÜì²HÝçò»{>xñÓ¼íÖVežI·Š(d }4~¾fÚ7½àÉÑ&XäM-4­*Zï麰ç[áµ`­ÛãŠ*ô+÷¸J|ÿ@÷(% äÈ~ºÞÃ$ÜÁY6µØ¾{½”8FT¢Ÿûüh'ñm7ª…H àQ}´?Ù NêеxÒg†WėÛ${òº¨ˆå'Ï~È7§h‹»*NŒÅêÇ›øz}Zò›—èoÓ-„ Ü—ßé%.(Ò8ú ]™â}DýÁ¨7h-þqt‹ÒüNSNßHëè×K-%r·Ÿ~ÎÜØs`eÙΔ»ÌaÙjÃqfw†²¹ú]™Í¼`î¨ûa?yý–'ÇWfâ¥ú¬Œ×ó­5Ô=u¬A_pb÷&Lt«É3ZÿEÙˆ¦ü®ªßîwŠ©¬¸®»I—[¾ÖVî•9”\&kÛµ6ej?ƒøÚ¶:ÆÛ=à{åy7hjÉrJü^}‡è–÷àJª#³ICHé?zô©Ððºýø} äxÜÐÅê"Ž7_Û^EoÏ·±ÛÄÀ+jø‰ñ¾ÉqIá†Û|zÒ2”CMÍaÅÞ=~ìœ+x?Ú.>ý;¾¿‰BÕ"n£L¶¸~…”~ú¸{ð¼)04I7ræ‹E]µh•©zœù<‚¤ÕK¾ÏþƒfÍ‘%‡µ©ÚÞ+§tãÞHcª¥%Æu`z*팋ÔþÎt<ºz''#Kó†ùþt ¬þF}€ Lécgúr Åž,ôÓ×Ü2ŸÝá žðöv@߬ۋ}EóGûßêæä¯L.Õšæ~ìE}3öLY„]Ï€7mD¶(#šWÙÙ^11zm¼ìœ†[™¼“ÔÌy+`Ë 8ƒšk1W’HòÚ`ô8"p!°€€ ™gú¡¢ÖPdaO|ûLn“ý-&í…‡÷T…ã}þWš:U¾V;ïFx^©cÑÛÈä¯ëŒôð~Vx»èZe§$¤¥–î2üîZº_,‰äSQ? Ð7óJÆÁÑäS"Å’íþý -gåøðîS—oòžñ³wÖe?iÞ©ì¾èåAÿòŠ_À’ºWg†à Þ:¼³ª‘±N¦¦çòšSAcg–3Õ’>óžxÙ™øaÚÎ\Íô™“†­Ãp˜Ñ³ªjJÞ¢Ï2ý•FÔfÁ*h»Õ·Š2*D·ák<ê–¼Q€¼Ÿ!‡±‡E ƒL1¢È¯©-Í6;å!ätÃö³ï‰KrJÜA3ûq1Î"ñå<»—Þ —Ö}¤ ¬šÓ½k~ï™Ýñ;Ù– ÷'FyµQçê€êwºÚuc[ëžôÄ™¥Tîe,õÂ\ŽL5Ùz‘çÞp³îØ¥‹Ó™‘¨1ŽA_k`…uÚÒ +¾)pF¿œ'‰%QcÌ ¬X*,r›X¦gHëÂú;u|"WQk€ÙGb—ö’^nó¹ì”Þ€jO¿ª‡šš"5üÜGSvIÎ ?ïVy£¼Þ×;•Kñʯ6y™Jbå]LJ¼¦Ðœm¾úP»žùú!™G/«3$$×’?=`ŸZ@ŸòÁ^‹ÆÒžYŽXžQl„»åÇÓrÚ·gåõ¼¤mVB÷nD3_ÏÞÐîhò±aŒöbëØ$öò˜2Ùéú‰ÈJ8ÓaÚ—3òÌ38½Å(ñ3ü&«tÒÁ<3F]C…¸ºž¾kú*å+&z{cˆÍ1êIù¤ËtÝïö×/-ÿãÿàtÓ¢#Ku]j5ŠkkÄw+ûFƒzä\ß@dã)ËÚ¤n‚ŒÍÌ(Y[‹«¾9¹ãn/ïG&FWc·Õ+ûùÚ–Lñþöã´$·“ŸKÖ|ºf>Êñ÷R½ØxÊf"Hª~¬DAµ=®4Ú5çíÂûpQ÷BÓ;Ü‹\’M³Xúo_V)Û™Ÿ»*ó3Çš2ÜŽRk".´0pšLMS©¹†^aº Ñ$»ÎIa…/8yM+2Z¹@Á¨*•a+s^©­‡ÙmF ª”»mwð„žÜ¹²¡•ŸÑ=šzóÒjªþõÃ7gŸŽá([ø…f ìZáË»ÑòŠLû1•Á«dUOÇ›,H÷С£ÛÎdyAƒ½J¹´¼ÖzKÌèh(iö¦cï– $U¹Ì¼{ï-ǶSr/¡ÈŒç:}Øý: êw6‰D?~©ôرƒ¥ ynKªý6áÔ9ª¥i@CÍq”gUájP0ÿÊ|9«mRÖ¢âí¨©(+E݈iе1Žê ¾­â/þWûf2¡BjC,Ë! ¨¦vŸfÚ$–*Ú~¾Ml•þEÇËM¬£pþ ®˜½,c-ö½ïÅîpPþ€ÜŠZœbEs¢ð¦èýyLM¡t/»¦|)|uÒp`¦fT¦bÿcχ'Á~®™kB?êô”ñX[¬_lvôÄI¶Q‘Á&Û"Bœ’½¨ÞLc¯öúyŠË·¨YG+ [» {ëRé \¼³[½÷ÍÄ®T¸¥×Žîn.n«r>?óh‹jÜu:¥#ŠQHÍ9šîWbiX‘.ÁJ·Z÷°ÊhŠ–‡¼¬Vpi«­†2Ð/îïÜ€SäO­ áÀ>аˆôÄÙɆ&%LŸ8‹,ûÌ‘­ %¢2s¯?~ÛM²ø¥PJƒ›.=Øòf£»Aï‡ôHÒòä5Ô$`ƒUâÆ³øìfPRä§IÅÉõþKª”#7¥d.=x²U{¶½Èžs½RÎAå{^\màŒÂáêÆ<¹LŒuB ÆŸðO3¡"B÷“ªc{URåé- ‡GM©‡oX¥i•ånsí’ÿèÙ`âÊàoŒÛ=êuÄÐìޢ䀗ʬö_¶è.ùïkœ‚ÔR)‰ fÁKõ…1^ˆÊHógn—â+ž'–ÑŽ£?;è_ðô¶ž·ÊœÆŠº¹~;UÈþX¨S´'ã³»kÚ$þ6´=çõãbý¼ÍQÚy²VçùNؼ×+-G5¹ž âðBëxk Ð4¾Ýºù›ÖÃ㯢3Ìå7© Ã.¦®wYRV¦Æâ¡î'ÞMfÆÎó$±„7’º¾ÖçoÛBƒ}[îŽæš¿ìâ]ÃÏ­»úx¼|Ô¡ãÏø‘¥%RM«`‰§²‘Á9Î ed­‹³sדª—n¦1_:˜ùZÍrDÉ ‡·<ûÆ¾Š›wú=¨:¥É)ÊCš*„ޤÒÙô¯Œ°[Ü»!ç®¶m´–˜BÁ»¡*+SãTÙÙ×p47¡µ|(Še`Ï«Ÿ;VªuÕHx«oÒ íýÙüC/:³xkLåÑ}åÜ…¨ÕJ¹LìmòC¦‹[¯¨õL[š>œ5Kg5TÃþE¡x NÞÿAu?&uë2ÃU:[C“39™3µÃÖŒ žíˆ|Œ—(%—å‡h¯q´X+ÑÆ§»fOJÝ‚Hëø‰ms1À§ûJTe fRÝ=]¨X~4öÛ!µZáž‹s±"ÒH`{@Æ8.™!êý.´‚1x¢Þïú‹Uµ:æ¦A7ŸK±,Dg'¡Õ¤[=û²²‡Õ ôT 9¥rZ»kÅÚ=¶ßß$Þá3öÚœ_‹%éô¢”žt,¹IѬªÉ¼ž3ê%†Öù¿jbÔ.¼´Ú¸X(ív‘±»×Ñ[g¦öT]FöîYÎûŸþ¾[Ïæ(Gé®ì˜Š`ÚNŠ8*6•:íÖ[zòk—\J¹]ð; tˆ?ös‚ª¡Š¾¸ŽUýÌÖŠ‚ÚÍÆÈáý$Îõç›39;ñŠ&¹G¾ÚT|g;šVYÉü‡=ÌTeùú“7­ 2N ¾%½ø_úivMã}Ý«R¢†tS®U-½½ï(¢t)Fq=vßʆ¶›9r¶’,ݤĤq8ê+ƒRÎ}×y«d²v‡I™9M‹9Lá×eä¨3.jL=x€—¢½e‚Aó„VsE8ï.½U\¤¨+J‚è„¿N¾Æp³¯î{œºcWñézÕ%œn˜ÔP(¥/Ü÷ÝÈz«Áu¾9·÷Ë´êI8Êdƒâ|9¯êÂæ.Ò¨IêE6+]rg ´')÷—C•ü˜žXQ-xß§”ó²‰~õÜŒôÅãö¹'’aNÊ“‹R ! ÁŸ—UI_ÄűY>ÚñVMœh#wµ(²¹o9Köõä£Ó²§)ë@@ ¾nìK!aí,S4§X¯’"ÏŠ·â˯ŒŸFŠ‘…·'£Döã†X¨¼¨’¶wùoÕoj¾³90’Ýa{` š‚L/ÔL9I¤Àî`’5UÁœ-з–ݼ‡e{®/xQÉíez„_ü©ñŽÁ¯ònÓ7<4mt§â‚ø‡«ùøo©nzò¢…CÔÓ §˜A9‘*š6°º©Ÿšõ±'sÅ&ÜlxE•ê+T Õ¥½¼Skz‘.çÞ¿—ŽŽ8óŒU÷ˆ%ôÖha™†À½öþå誹ȶu¹F ~ž@Ó[Ï¥ü„ÅÞLžïnsIz-Åqµž£ºëe££öqCÑ«\¶<^§˜3»e~F9_\4« t8Dßriج¬}‹•5oö$*í'î?áàçx¬Î´•"TÒ1UsH÷’ê-œ~^+%¡U{pÜÇÓÁðð#YwqÁÁÝ&aPíŒÐØâ¤‰­Ê%¢‡·Üà¦éŒÅ²v…Th4®ºav¸gja`Ê6ü]\ØÀ‹Ë+Þë3ÝGw™sKû¤t4l¾jnŽ£vðEAßúÒ=d-[StjZÚ~Ž›^ôüüëfZÚêøP3¹¾¥›À#mq7²³%-¸èð¬ N&F¬CžA­x,6fõÍD_ZêI>ã_׊æ(Ìfù–Fí¸‡Ž'QÑ ©«ò‘’Ô‹=þ|©”ñ€çO{îxJ¼áì_ðuN+á…3s‰0Íj?oÕ jœO¸Þ³û*› ¤·‹ºéˆ2]ãîÜZ¾ dœË+_È?xD9\ò¥WT"ܱeu³ÙWKXÂý•­‘aþþøC>ÛOSŒŒzê×x’ï‹'H0%ÕÜ/š ~È 7W g§Ðà·Uxk¬®WB=ßp:6à°øhÝn?9GŒ$9%j•èÓÀJ šâ¾êtnÐ[ê¼Ý(k•Ûë¹:ÿbï“\»a±1Œ=R»Zß­Õ´)y x¬eúŠ+,ætÐ;c"ì[ÂÍd4¢iåÌê˜mÍäÂ35÷D½cFºé5­AÁ×ÍÞHŠªÒ%DQtD!Ü|Ää ¦Å =¯„“ÞNÝ”#¶×0zþ#é°qЦ¨õ-/Þ/ÍâhªrC©~6á‹ìÙØ~;ÙÝG5ÖºF¡ Mþƒz¯IåáÂB“¨g#WOU˜Ë™i.&?épé£Ýì²òg6¸ÊåÑJV-L›t£8õ<\Ï]…p„_ú¬ªÄ¬òoì•ãsË‚&,yŠºxÂÚÏVFº —Gõ°·Í¼/ »Ö9X¸Ñã’hî%¶kšõìÒ·®ž…ÌÎ?R+‹’Ž3y‰ô¾†ðô5Ö;ŽºªÂ)Ëày‹¨û0\æA®ïã³Á=)d½˜-”*ÓD/ŒRd›L×}T1è¯Î6‚þŠãSÊIÞ"w¯¯ËÉV$Aí²–v–¬3ô/äQQ‹…§¼‹âº |æ½ • §åšŸ\£û8ÒŠ¢AöÁ+}÷h³¤Å®ôPnÕ¹ç[²|2}u^c(hÅà>¡Hý\ÄI-u¯fïf[`¸9–Ç£x«úãUCαwÅ6z5tz0#KÞÅiÖ²¹–Ñ÷x̯õ0¸×H’“ä3·ú…æÑ8M¤xmL}³ù±Gv endstream endobj 148 0 obj << /Length1 1398 /Length2 5888 /Length3 0 /Length 6843 /Filter /FlateDecode >> stream xÚuTÓýû6("LAB¥a”Ò0º¤$¤[’±ml£AºD@º;%¤„$DAB:Dº‘þ3žßó~ï{Îûž³}?÷}Ýõ¹¯ë;NV=C~E(Ú¦ŠFáøABÒÀûÚÚê a ˆ€0€“Ó‰³‡ýmp>„a°H4Jú!îc``Þ¦ ÆáÚhPÃÙ‚Ä¥AÒBB@a!!©¿hŒ4Pì‚„µ€h à¼vtÇ á¾Îß@.7$%%Á÷+¨èà !`PŒCÀð!`{ !‚„áÜÿ•‚KÃ9J ººº €°h \Ž›èŠÄ!€0, ノ Ô;ÀþŒ&à!ØßC´-ÎŒñ{$†ÂâCœQPˆ¯4T×ê:ÂP¿ÁZ¿|À?— €þ“îOôÏDHÔ¯`0‚vp£Ü‘(8Ðiêªj àÜp|@0 ú¶Ç¢ññ`0Òlƒüj TUÔ‚ñþ™ Á qX,Òþ猂?Óà¯Y½vp€¡pXÀÏþ”‘ïî‚–û…vEyþ}²E¢ ¶?Ç€:; £NÎ0uå?¼ ð ÃÅ„$%D$Å0' Ì ‚üYÀÈÝöË úiÆÏàíéˆvÚâÇ€y#maø€'ìâ0Î0oÏÿíø÷ ¡Hhƒ#Q€²ãÍ0Ûßgüþ1H7 ¹ž~  ÐÏÏž,ñ ƒ¢QöîÿÀ­XPMOQÇÈ”÷ÏÈÿq*)¡Ý€žü" ¿°˜$$,”À?xÿ;ù§¡bÕQ¶h|Äï~ñõwÏ.HÀõG!ÜÀ'ÓAã© rýÃt !1!þ ôÿÍ÷_!ÿ7šÿÌòÿdúw¤êloÿËÏõðøÁH{÷?í›x,"Ö ™˜ù™-þÌ*;­jàÛ\?Ò3Hs4~e¶gÁþZkÿ®4v/DiÑžÏÓІávI¯ fü&Y°êìwT<®¡kGõj DY·ŒŽ¼½¤æ icäàx¬ Gë_í + €Æ¦êmý1ð–Çg‹êjà 0•ý“®DÜxQÁé™t_‰Ä¬TÜÕ¸ø8š¹­(/A«ZùØ(iFÚ5’,]è÷¥µ= 'Åu%÷å/ Ë&5 ƒýd¶³ ·®UyôãŸ6÷·÷Fš¯O–l 2:T µ-_ò£®ÏÈë¤ë¡ÍÜ›Ô 7¿Ç"ªBªÕPpgítž<¼xGBüÖ¹½óše®RïI¦GЕn¾l“³x%lÎ_lò¨q© Õ‡_ëYoõ›Öz.±ZÁ½Ê\f@žþn"1”åïb+;²4I—jæ!#Ó] .¥te& Ú<°Ž°…€Ù2š?Ä‹B¬\éI¤Tj°À#•Æëý$ã>å—š 7 4U[¿Ü\ݦRO”iƒÍŒ%ÈæZžz‰¿ZT9uŽçª+è^®Br«4)ŠO†=•_ôñ?Ÿ¤•LfÔ¢æ›]ôªc¿#U˜F ˜ÝÙfˆ™è}ž‹d€ó?ãì÷–ôñfµ|ª/s/Žs¬ÕU{@RØcsË+aÆU:¹•hû;®’¼®‰\•,iX ŒÐRìR’l%ªux1dûä"í%q‘Mê’†ý|á“KYfØfÊ$£eí“7ºQÉk.a+;zËÊ ñêTLù‰ý;„ÆÓã’ß®Q±ðV·z<ŽàìDô,2¶NÙ|¸ÉNóÕèŠs=¼:l4ö`Pxo-W™©übÂ.—;œhøæi÷+»>ú ?ɅŶÕÎSp.—‚wn•CÒe`aßP³èÀJÉ^!M$´ŽS£Í|{º¿Ø1‡§K‘ ‡‘šügã ÝÇwY2³\ Ð=ù¦ïÌ€|…Ç0³Be›¬éý˜µ©€= £~BFǤY œ0GF·¤¾BÌÑŸÇÞÖÅ–LUTÁ}N^4š\aAT|ÕÈìå~ÌüÊ“4¥0í¨l©3ôЗñN©eì‘ Íníï¦]/a& ,Åå^/+“z`[,ï;©®ˆ–Þ_`Dyé²…]søôp¥'µJùú„⻌“žUf²ÝÜÃÔ‚)©Æ±¿‰ü'»oíP•ñ^&!®–Ã`#ÞqÙNOMUyI‘+PNqÅÉúÇa­hNî23µAšÔÙg÷cß­Û]ë£'õ>)ÁÒ§:¬MúñžsÍ£c`ØD%³LuŒˆ%KàÚ:ƒZŽ$nþ‰þDð ‰N³Ø=ó¡^Ç$céUßEƒ× ^q›ºí6ÆŽŠ]ŸÞ÷½æ¥üï9k-ï!ú ›>i²V´@‹ÂÛ’ ¿˜ôUŸ9](Wõ‰„ÄRÓ(o’|@"Δ¿‘ïèùíŠ9KË̼kî7×¾ìLƒË8Õ>×ða<“Pb9^{ÞÔT³s®çé^Å  VWs[í1ÍM£‹MöÝÜØ½|‡¨:ìšÇä`Î @n]êz”(¤Î8¯"u¡ÝɃî:˜L7HkÛÐ1WÎ^V¡¥÷™aó’X ¼BÖ¼eÙØ3ňè¿Ð’Sº(âT:U‡§O™>y“²ŠÈçi0Bê†Ú OEg½K×ÉTÍSÑ$ù<î« .Žá~‘ºuséè©%UcíñƒœÀÝ…1UѵÎú½âï_ˆ® tâ JŽ,j‹ Û]Íðä⃒µ·ópÿ»ƒ7–j]¨@ªöb©pTÖEÍFN_çtà$ß`Ð øÞgëa‚•ýI¹´òÖ ÷ã7r×0—oˆÜ¸eÁaÑA›5ÒÓYyP£±Aä}) ~ÃiîªÂÃw6ésÏÔÑÜ|_+Ôç3„<’||/Zý.Ïô ‰!3ÆÉÁºt‡d#Ìd=Î?ÜpKTXXã-¿¶ìG5ªLº7vÊp©*rPéÙ©™˜èNž«¶Yñ² ┪ůªjvONF)ž÷Ò_çpù!*&|UÓûÍïa\à¢[QV oÏ„âEú\ñØÁxAœ‘ÎGrUvƒöúšB=t+bÅ­ƒ…·ÁHÜv¢ÄDýfýhc_,!B©ï¢«ÍÿÕíß=»eê>Ðd«j?ó…ñ¹žnW˜É»\¢–ZéýñKk¨’"žˆ¬°gÊ%±w õf[0Ûõ^ň®|µSu_? (Â51ÿzkEƒÏôW×÷ùêa|f ´m-‹8Rè JÚ´¥„ÍÆR3áüÃàìDØö€òÉøb¥[.êÓØÊ–£E?h‹ŠkoA€Xc\²òfVÅò¢Ë^ð,ÆæîZtm^q¥MY´‘{¬ç±¨|#—òÜÞ $ëÇø ƒâ*ˆœß­½SR3èa¹Ý20šOûšÆh£ã{n7°}ØñéѨç†ÙD$ÁŠq$‹ŸôÝ)âÔ‚£²ñ;G/òï9 ŒÆìRÚ»^Êóèì ½ÿ*öá„}<¿9Þë[f¿sL«Â^`-iw§mf—Ù,'<@ÞàÑ{ŠÔ ñô+ì‘»ßVùvåòÔFÉ,(Å*Cd¬gÝ),¨¥V¤cŠWÛö¶ 8>öòSö) ïGÆp`V¶O*ç>&%Oímotí g_ra:#¶2µÏ"Æ—òê 9æžß7øòc¼¸K‚µT¿“Ü£Á»qaé÷ ^à<­kè%ˆu“mߤ5ÃzëŒCvè ÕMNŸ êa€úèá¿À ny@‘ŠçÂêØ ±í>—=³{¸ð†râžÃ›Á ¡­ i¸P·½èJ«6F[ëüÂZöºÕ«b&ÛWU=ÑÔ“§BÍ}k--_»=ä .úHÖF´ÉüŒ,`ZzWM<€Y¿wöܵuØDxè†Ù=@5Ì3’6S”Sèqvd S“K…°¾éOèÅ3#|íè’VH^ñ–«.­kk]PêwG“ÁÌ@ëjêàˆ@I Ùï«Öü:Åörg½áù /®,ßOx˜ˆÖÊ×éÓM«ìøx™ó1A@лó8Õœ§3GvcÑ‹V;:4{‹ÀfÛ×yÄHœpúQ=ÈVÅ©ºÛ\ñmÄY„ peMÑÐ2Ø48#ò¸¢d6­°c-6RÌõ˜*þ¾Çû‘RŸ%i§sÕ‰G«<,ÏLÁ/ìjƒòQšê ñ–&Õ°.šÃÌB?vFÖ5‰¼l± ¾ö>‰WKÁä'ÛbV[¬ù„Ó÷ëIK_ic‹aÃ9 ºÚ,Jh¥~±û$Æã×ëÚ3^Õë¡ÈÜßhÖ§’}ÐáÖ¦¿»À¬¼·R§Y(ª÷3qüâ]LaÕ¢Ø0:äw²“‘R]@g —Dº‰Å­37AZ‡hx*ëlÝ?¿TÊÏ ì"Q\]”|!¢hΖ·‹kAøÒÃßM$æÍ÷ºå€C$Qä>”ùÓAâ%ö~¯bv®sñ#¿>¦„bR_ººçùÅ7TÌ¿xùEǾ§6 tk@Ôˆ½1:cèm$i¤9M”ýªU}íÖ-„ëù@Ù3·§ò?ØôÔnꦨx¹{¼ÐìWÊ8M ÒßäHŒ4›õ,ØØë ¾CY<V('®^—uÄ}±ªgw2™±¾Ml¦TÏí¯Ä>Æ8Ñÿ–=zÏêǦô]0ˆlûFÚ’ZR)…þÝ-òég”ÈB(V½6‰nóŠþe›-ã1¥ÜNþ›¸LØ{c#‚°lcþñ^®Ëö ŸoÓg„e¼Õ®~ÄЙ;Ødº<Ü©þfép/#°œy=Î܇Krþɤe¾#âc¤MZ€_Ò)Gb‰NrZâxÅYÒr@zNMÆ_“„LØõ€Ò*»o\¾/i‘Pa T+L,¯ióªN—Uuz6‘~ ‚ì,×›X_·*ÛYU÷-\&,ÚøX9u{Ջ䘌½YtÍað)¶­L|“‰@!ÚÖv3Ã~¿4¦Y];Ó-²=×TLÖÚ¿ È­~)×&{%Äm}Ü„4d³¢Tsµ Œ®¼„´ð*ò®Ë¶‘A·’§ç[‚B=ǯ$£Ú AOÚÉNŒ›wew\r¾m_v?ÙÂ=ÌØðyyUà?3oÒ$çÏjâHî¬ÍIö 6°#Úd°4d–]+Ö$˜„Ù?R}O°¼óе`;åÍë  ñÔ“NïÐp)},ƒì¸…šÊÁóÓUãŽG—ö߃N£i£¤ßN3õêT–—­WŒ$è]5˜Yjçc¥¶ÃiójØ|ahZ—蟅«Â9 l핯ô¿ÞH&n&Hó }ó âMx“ÀõHzÿòRk•Ú^i>çp?³Œ¨þšqÿu ÒÆy*~=‹£ó/íýUØåÑ»ÃÊ2_‡öRÁ•ÎÅ˘a‚üGì쬶MûijßF‹6/OnKÌ?}" Q ô·§|NÇeiG4í”OÙ¾AòS¡UxtI^¶5fhÙ"ªs7ž’à‚“—*=«|öfJ AȸJ(ì/BOrg h ³©5ñžàÊ5ÉŒ®jÞ„áá‰ÙÂÚîµI>Óí…ëeõÍ,¾ôåÞ<¼60å)_¡¯aUì›.ŸK/èÅv=ßPÉŒ›Xõ1,4§Â¸2zß3>o«…¥Š©$@‡*~°ÖKù7}2¡SxœPé8êý‘´Ä5÷”Émh1Œ>mÇ«ÛÜ–›_ÌgòºyÁ$îŠYÄ_ªóo(öhJ/ÂÚöȼÀ=«Ê¢€ð S ^¥»Y(×N6oY~ßqZ¤ßZñâ+"·à׊ ;"]PnÅ)µÜÖlÈÆP“÷Ö’I‹6ÿd‹ÆjŠg¹¥âǼ`×ÌœYß’Ä9ÈeÊñг!¥å­1‘˜«‹¥7  ªÙ “xóõA?öPÅüU¥+øÙ‰§ùD˜vì/Gù¬¼ˆ?ß°?ƒ_¤jƒ_šìœ¨µ×u++<§3¹ Ï•-'æ›2ᡟE/µÊŒªTDõ‰‘3mc* Ÿ&|T²-Hyt(uý³1½‘ ”6ö×븽Ñ~L©nY!Oí$ÁqÄ×¹ÁZñÉöû}nãôgyá˜dùÕôjÓÍDLK~â«dâKô$ߘ¬œÝÝ™P×Ì +˜sX¾ÌIÓ·LÉæ®|þØöó9¯û*Óëº_øµ‘¡t’¸tV5æ<êIç™l vÚ­‹ç „^3Ç}<5ï˲ïÂ¦Ï  m! +*Ú|i#y4Ì´Ü~›RP×y'щË$ðìÙ1 ƒ€”-O÷À„‹·Ô.:5ßÛº%lMá’'Ä¥ŽÇ9E' —ÏúBJW%ej¾ä;™Í C/‚(__‚‘xÕìîŸÈtEÐo­¦«i´õm’j¿z(ЉÊR·½°r‰}2×ò“éêùÀ&md›‚Eè/½dÃÿÃQ <Öê/=ä&|ˆÂ¾kï xpímTëýX²ORcÑòÕ"Ô|°è$“øÜ§kåÚë{‹´/¹:âÍuÖÖŠ›»n]^{¦›Â ¥=ÃTd~@Ý $1Ë™jRÅ)\u›.·8¶Qëk —kÉóÆÎÜË'¥*ESÛÝ#È\®W› Á”Ï{îôb™ê¸ ‡‡.Ž4+ &±›ï6wójóë> stream xÚŒ¶P]‰¶-Š;!@pÛ¸»»»»;ww‡\‚»»C àîîîwÞN÷¹'Ý÷ÿª÷Š*Xcʘ¾äÄJªôÂf&@ {Wzf&€¨¼ 3€‰‰•‰‰œ\ÍÊÕø1¹ÐÙÅÊÁžç¢Î@cWLÌØd'ï`q³0³˜9x˜9y˜˜,LLÜÿcèàÌ3v·2È3dì.䢎^ÎV–® 0ÿó 2¥0sssÒýå¶:[™Ûä]-v ˆ¦Æ¶US+ «×¿(¨ø,]]y=<<Œí\œ-¨éV®–  ÐÙhø]0@ÁØøwe ä5K+—¿åªæ®ÆÎ@H`ke ´wy¸Ù› àUi9€¢#Ðþoc¹¿ èÿé €™ù¿tÿñþMdeÿ—³±©©ƒ£±½—•½ÀÜÊP”cpõt¥Û›ý64¶uqù»[Ù›€ þÊÜ !¬ 0øŸò\L­]]\¬l—Èø›Ôeq{3Q;; ½« ÂïüĬœ¦ ¶{1þ=Y{{Ÿÿs+{3óßE˜¹92ªÛ[9¹¥Åþc!ü‘Y]ìLLLœÜ¬ èijÉø›^ÍËø—’ù·TŸ£ƒ#ÀTÐÏÊúƒàãbì¸:»ý|þ©ø7B`f˜Y™ºL€VöØAb ùß4|g+O€.h÷˜L¿þû¤Z/3{[¯?æÍ—QI]YJSŽöïŠÿ«qðøÐ³1èYؙ̿—Œôà÷o%c«ÿ¤ñ_i{s÷ßÙ‚Úô?»ÿg¨þsÔ€s)8€¶ ú³äzLìL¦ _ÌÿÏ«þ—Ëÿ߆ÿfù¿-ùÿNHÂÍÖö/5Õ_úÿÚØÎÊÖë? ¥us€¼è ìÿ·©&ðšY¹Ùýo­´«1è„í-lÿÛF+ +O ™’•«©åßÛò·\ý÷•ÙZÙ•\¬~¿Vô Ñü/è´Lm@¯ÐJþ¥‚.çß!ÅíMÌ~Ÿ ;ÀØÙÙØ 4dbø0ƒnÑ èù×ì\A.Py~sg„ßå`0 ÿý8Œ"'€Qôâ0ŠýAÜFñÿ"N&£ÄÄ `”üƒXŒR+€QúÅ“ûƒ@ñäÿ P<…?Oñ¿ˆ OéEPùƒ@Tÿ 6£ÚªVýE×øƒ@Ñ5ÿ P<íÿ"nÎøefòª5q66µ‚¾æ®ä¬ÿ•ÿ}ÿU€¨Mÿ‹ØAd¦¶ ùÿ„í·ÄÎîOÀß‹Áhö üÃ*ø¯Ì, Ø U1v±ü‡¨Kæÿ0!«?¬¿¡ûRæßÛ?úßænÎÿ Xü‚’þŒ ÔgK/GK ý?,@2«@PÖÖÿ€ Ûü‚ºbûj™Ýz½1þaf¹ÚƒŽåzPþ$rvø—TŒã5ˆÌô ´ÿ×ôؘÿ#ý÷ìØ@Y;‚ÞZÿ˜ÆïV9ý™.ÈÂÉÍÁø/:VîÿHÿMÇÌ jÛ?šÊ ê‘ËŸÂ@N.@;«¯ûo û?ZË"q}-þЀrøôÒetµtþcc@%»z8üÃÔB·@P÷ÝÿAyxücs@ÞÿÆ¢÷ú5×ûO¿@LÞ@ç¿CýëÅeêæ ê®ë_ŸЪþþë Ðhа¼à`ÊjÝÚ~_'ŒçA¿?Á?K¾¯™FMï³ìüÝíñl2umVð¦ó­pòpÏûµ]qª¡¢Ÿ“¯M°¿%)·=ù>&¨Lï·!,MaL7öÀãÓ« ø¾8ùjÙ@~ï”!Ïsrãz§T€~ïÑ'éÙØ_±:¾°¯|PË!‹ø\1C£­T:Gžo’=MãJOGƒvá‰2ws;‹–;ùF$“@‹àwÃZ죳Åû0ï½^¥ÆâÒ…C†£ƒMyƒ66Má#r”"ƒµèSV¼6°äù•¯˜(™.uþ=ÃKf­•J”}Ko½ûØró^^2 ”o}/©¾¼åƒ¡3‰"Fm›aºk=« à¨Ã\d½ýV£ÛÜ:…{¦ñ 0‡¬myØÚíóÔä´><2@žúí~¸ed·ÛO³T°_߃™FÜR7rm•'“ ºÂu¢K(ýá=ÝŠ{2×3´qŸOð/‘G\æ"&&.è^ð1ü3ö<ß_±~ÕÍ [s¨‹¶hú!o! o&©E8–¬âFYáTù™âÝŸò7â(•y€Ís!Œ[Õ˜ bå^Dr‰;ìK¿ÉŠÙ¤%{÷k†#õ‚½¬¸ Î4ªÕÛâÙ •‰÷N£èÇšƒ†DBÂú¸oÍŽvn++E 0Ž4.ª="D†c·Õ8Có?u¨æv¹(¦K GA”ÜíÎ÷›þTq'¶k‰CÑTãÜï*yö «#§,^–ï—=æû軬¿$VÜ‹S(„ùé¦%¥á»â=RÖûõXò¬ƒUHRÃïÃ-¿^qEðTÕî H½·ÀzgÆw‰G§wÉ|l«õJÙúZ¼ìÑé¶ Ä‹»W›üTÑ‘¯æ‘­êÂM+øõ™sÀÍÓ¡1(RØï¬L&N¥Eå”YrÅ´Þ’r¬w¼³…‰âZùk\ô6>Üð…Uòëuiƒ“mŠ F¨ÿ€Ÿ:xæHÎñ”ÌW¶¬ÄˈÄÙ³ª%_øœC¼8 džU¯›“z½[@Mm¦ gz„¶Ë7Oùa¨!.å— º«x>q(=O=*%êÖë”ð;”Zèå¾Q™ 0× 0Š^N˜xŽzÒ ©Þ©®“ù©y¼¤«(Æò‘w‹$ìŸã<~©FùÖ¾9(óMN¤""NùáË&df*÷…Kãk;¶;ojyXÊÚ¶¼ØÈ ݬ>„kn®«ËÆ1¼âL9ÁD4˃ÖMî¸âòTâccž'¸âw¼—[AAæåHÿÚêç,ëÆ|Ìú”¡. m•Ù$åZÝ0=ëwë…M¸ðêoJH®·ét¨÷íÛ›"›;±n¦áô·‚ºóÆÚgŒÓ(\¦M‚ÊKy™ù\m¦ª±8wŽMìÏ z÷½ç\§á Vþ;ÈÏÙj3Ú² k²Ø?†©»é°$Gd}Œ#DuD$s¾#x­R½‹”¥ ïeQdšÕH­áV"#³}:~¬j¥OÂÚÒíÂ>™ŽGÝâÂáÈŽ-R°[|6©õþx'3†“Nçæà/_ÅÒ‡í½á–˜ž÷qŽƒ&£¦¹¿¹rú»s¢lS°¯Pö3¦)5öèäݶޅE®k5…`ùnìdßõ“=ŒÚ‰Ç÷¤ƒv²<3=ÑÖÌ¢‰ÅÛ…I¡bMO¢#.'b9³™š]<‡ÿ=f Æè!~¡úëÇŸÄL‰ÝÚùÞd?¦îÉûª;§‡1<¶7¶Yô*z75†/‚Ò–£(nGù"vg0X<ÍÌïà–RÌàʇ¼8î‚»V6Èe¡Ørö쪗åô'³uµ9’Þ÷eÜ?°ù‡(÷¨Æ^Ú¥Ÿ-›|öÑïÒ˜!åÜMçí0 ­šKº(†HäOØõ µh·WcUÛ­™3-§AÓ<eœÀöå'm&1šßôfÛ~'WgÉç!Ô¦V‘c<à«Àc6˜Ä/¢Ï_X½IÓwMQäå§$ûu^Öu!íªÞ¾yOFKÀÀ£ÙV1û­F‘A1gËŠ®‹«r0ä´7<Ì"—_KˆDbëQVâ^-ßä)-¡C#(Ö–ÊÖ¢¦;{Åd¦:f¸õ¨b>e~ToûåÁ˜M™«nÌPɽã¤QÜZ:V Ht1°ùYàb›iÿÎ;¡¶ºð°ˆg_.ÇG?õ¢Â1²¸ "Ä]A¬#J^’“›LZÎê•"IxÉoÛÞ–Ã ü£ |œ„bó%Ÿ,üþ‰Òx‘b¬°0öˆ{xRÀÆŒmÅaó½öþbåò˜æÊÔ~EWS,à#ƒÑ ÞjyÆ Þ$·Gk°Ï[Xªx>—Á‹áR7Ïóëκ+³°[uE6’£ð$ƒ.[¡ê‹‰ÇgZS€kyÑ™Û_l¬a±Ÿ$˜Ð¯’—–ÓQ¯ÈÃM{GÁ`]¼f|í(  ?×píkŠdóÝöÅq ¡0’m úô³Ñ—ÕíÙî2Éã•ï]€÷pÓ49‚C[ífž'äSšK0êš&³„çäÙÜQê&ÀâÕ.!¦ÙSÃë¦yu:›DŸÔÛ;µÔÑý²9› ißô£ÿÔvúµ×/á#GÝ-iTz¼F˜W/8½z¾˜• éšG‘Цlh×Qš@‘^Þr%/Ü{KÉêÒ-£æì£èxγœ°ÏFªÇ9Ö¦œ[5îù¢Öû‹RË9`n3ÑÞÐ>RF.Ž*E¡á0ot*¡ºYÀGV¢ysõÂÀ&Ód£Çþ‡?æO#¹ÚB}¸Uã"õ|ð¯ý>Ïhî;çr›kß Ø’®™ÓÈÐí„ßÎ\’?ô \]ÚëlBÒ¤·ñ—߸Ü\8d~0òIðZ@„#%ŠòÁ2…cÐ ÐùrzNxÀ„e¸eâfᢔfFF?­w[;1—I!ÇçØ …ÖŠb‹ŽäûÕ?³‰ëè‘a¸/å ­ùÄ ·W™{ѶaƒˆwÍÈÇÜðkA÷¹v8ˆWí7‹{µÀ ‰¹pæ‹ìRV?b[x,Ã"ÀÝsîKÀk y©êûÿ Ë…H¯~°uY8®J‚'JÉv'fz8j‰”øŒ´¾ùxV.¾i¬l~¯äÉ(–‡áûVó¹‰wU’páÃ{mtV‘köå«çƒûm)=’ÙJ]˜{攉ôŸ¦ì ÷ÜŽ,œ2m"/WÍ.Œg‘_,¨®Ë=1”éÞ¹ èÖìp'Iºô·ñ©qës| ˆx´óª¡¶jƉt>¶î¹Õ,‹’ëS1 P1¶í<ñl4Ì[ÔÎæi`—/­…Ú<8[ýp ‹ÛVÒŒPöÄh]¶Õ¿œOì·aôùìDŒB?p¨boAYë+ŒÔfé!ʘ«tQu;|ÀÐ<ò6þ/¡%{ŒJç”÷†×§ökA=pÈŠÏ»®Â ÐôrÈö)Q©‚І˜†a«›ýs0âxcŒë¦~–ÉŠ|ܸàö}é^#ªMhEø|d۩옎[Y0KÝþ%û¡¹ø’1†V‡Éàë Ïž+”L½µÐž•!âTL’#¼ß0V• bË?Û¨Q~½ÈyÏ›Ãï„g¿´çäj+'Êœ¤Õ`ÇMEpJXìsš)Ü‹šòfU¥íÂ/Tbîõ'C¨²Œ#²VʤȯŒ„&ÛRýšm&ƒ#üVÞg´sT`—å×|FúR÷®.mGJ¥Toé|­es‹Q÷ëìï;ì½.ƒù ˜&MÑN>ýö@<. 7§½_6›‹#K~dZ,^ÛzJø”É/²<&­¨ Ã| ½šý†jùnLW9\βB›~?Ø_ÕùÕ˘ ¯¤-Y>?ÅKÈ ƒ¯U>¥ †&ʸ¾9M…‹pŸ• €˜ÝÒ2,&eý±àý® †3F°çZ ÂCÀÊÔBmmþ¤MjÍŠm/EJ-)ßáJFÝ%0žÚ|zOÂ;Ó¨e°E°`WÚLHUŠ"…ï º=ñ ènÆ…”-Œ¯·«Q_ÁÚe\-LìåÕ¾Ëók–öCŽ)q¡çtJ°É¤üë§mFs?Ö͔̓ђÁ]ÉòÔêCJsy—iØ9"-Mõ¿çÛæ–Ví¾æÄÀ¹ErëñAb©Žó(E©7¸áñX"Ç/Q¼G&.vdZÝóß5鯑"-ÃV ¬RŠZ ±§ó…ªb¿´ý­ëþ%”T Ÿa\ÕHÿ!]8À42üØÖA¼Ižê2Ƭ¥”tÕhqÊ^ÛÇzÕˆÕ× Æè¥´mÞKÀV=ñ~ÓsþͬRÏÈ©ÏçñÚ´sþ Gã#Ä %ËEH£ì–³Ì]ÇûG¤j.7¯52çË”õ«d7s?S§^Zön/â—uýùìG¼û®ÓwêtÕà®yÔVzIžˆí_}Þ!9a™R:zäqê?Ý—ºÀ‘§¼w °·FEb¼ÈÔvZ¿°òc×hl ¶Û}I¼Ç¤Ÿe ½#°Ú]”Z‹2Ÿ y±iUa8ɼyq§ ´c@£WÝík[¶õz&ÂæLÂ,@Ò¾Ym¬î·;n6øR+éÆn(™ {ß¼Ì\ò„âÊ=‡øº3¶s°Åö©ž¹Ú>ÂðILÀφöÀ¼Â‚Û’Œà±¬\_è\þÁhÉ`櫤ì-/{%L‘ÇàIÔž´³Ó¹p«¹pð¦6ª•[U`Ïú^ïå÷éóÓ4mç÷Çb7·ÙïѦCûý¥J‡gâü°o²¨?‹¹ó²Ù6`Ø…7näv/ë UuJ„±°qÔ”1`°ÂwƘã5ýdd|‘V2„©[;ùÞh¦cL<§°Ç·úÔ˜)ßûÀêRÎ8 ÍÏz¤îpXè©0r߯?Àåà\ó 4lú¾ýG—Ø4&{šw>ïjmuʽ¯¢’GТZ¹~9ÒËMS >AžË ŒšÊÈ{ŒR ÎÖ;‡]*¿¹¶ è=¢IÄXxQÙ.S01£]mïØÍq Y.U‡o÷ž¾²øa1n¼ïÖ$‘7Î׋®õèµÞZQ5ñHÓ1dqûÆ&¨Å¢ßÏV&•1^¹x™aÐ=å$thÈJSÿyåtWœ˜8Å)pJ=Pt•.eŸñ­¬Z˜“äØG,\…‘ÅõE¾ðúÁe¿$ðɆ[Zë:Ѽ°H`™iHÊ-ÐÑbº`TI¾m0¶–;5õB ß‚[F÷£T=<èVy‡Š•» !±ÞÑ22sä—„¬©ù4-öäÛ#Þ †ßü·[?5Ädæ}S¿}ÓBñ›.uŽÂP:B4Ç~H+Lü¬äÇ I2Û.{;K:‘ –×òNâîQï÷åÎ`. ’‘7¾Ë÷‡ @L¯/YÊmŽãM¹ÿe*2[™uȄד´5–ˆõŠHuŒ§ÂÚõç*y««L,£ÀH¾âÛY³ÆFPާ~ÝW˜vêóÜîfý@ÛìHv‡Ž÷º‡ùS¼ïé(Ê(Ñ­Ê#õê”»¥/¥æÆ¯§ˆºÕx~ -Iœc*¼!ªju¯3ÕóUQ·Yni.À}g3ÿ*!Öb·Ê°Ô¨Am  =MOfïá÷B‡¡£Ð*Ž1% ~]{‡¨£ löî™»½`mŸÑCø²äúóõU{›Ý(KÂß0Ó³;&R=Ç7ŠR+±yðc¨¤ŠúÂ{iD=¢ôÐõ[gža Ã'ˆaùni&?ÌÙf=Ÿ% ¸sVõï_Ãn{YæcËEa7J›e#Ôâñ\(ÁÏêÅYÔ5è‘£Ns<[fÖ¤Å_k×0",a‹³Ú]é¿ %"ÈBJrÆí’Tû*O}„8¨xÜè\z»ø†ûöÉÍ7©¢GóšWÌÛµ—ö³žÇ-\¨"²ôñã$,è6šµ,%=Ëdé­5bVã_bšž®`>? øÂŒºvX3Od :¿FbÔtM×¼âŒÉ¸÷ÐÉù‚Ã_6…M&klÄÇg!¤=g*‡6é®mð©wkñàC¯¬ šÒÞ’oÕÃÿTh[Qeç¿én©È!é]èËj´8R;n_ß30)×쇃Y¥j !D{ÀTÝQcDF'í†|P v®îÕö.æ+§ÀrNå6“Å3bŒòC ·€sxëÚ^¢Œ½DfɲáÒŒÉÒã,®k«î+E×WHR†ôaö­=b5NÍŒ‰Ÿ³,MI)qvcÕþÔÞÓ¦oF—OXÔÏù´“K†¦ÿ‹…œOùëÁŽÿ¤¥Á6áîñØi]@á éÊ Y‰£Çt(˜Õ£Õ"8nç¤qu{ïQ?Uý+~%ÃÝŸ˜AŸšÕíÊjŽÊÅ *º¥‘wŠE/šŠ fÛÕ¸Bć‹©G¸5X‡²ˆ5k¢-¼ä®kc amŒÐª´­šÝȺ­èùä$› )R“Y&"ÉDqÞØ ¡t(…Ô‰vŒ®ë=3‡ûË~±%/pÑ)Veû}„±À=º±w–º˜¢Èð_úsÁ¬r}__¯€ÇM®›!ŸHÙè£Hk"¶ k#v*Db ϲdÚ’‚DR¢Éð¥¬Ï .ΚçǦoQfWzaRð¢Ôv…¬[‹èl•£•¸4; `„Ý£[Ò tšÓ‚89ì*LÞaïÝÊPåË} ªë¥Èc»Ú&ÙÔKþµKèöF8bÖ!‡Á3üAùÉ÷ùA²Ñ@RNóPfåTòïGO!’LÛ9¸7· §X·ÅÆÚ?Óš”í‡ß#G´,î(Ðb?"ëøT´Ò³¤O¬Ì)lŒ]ÁßíZÙ¡R1°ç6l"¬øÓÙ¦ª²ÛÿˆkÝâØ;pÚ'ØÆ2KYXÖU‚Ó&FB~ðqõY(F"MíÉ㰳̈0¤õ Pðyá»g¶ihã-—æû¼´¥iv~Ø:ðV›làÐò8Õ+ñüeT,Û9¿GuZƒB]öøm¤` à;d¾ûcMV´€É犄€æ\¡MÐa¿&ÔªEMêS@? F\…ïÉÕ£wÎÎ\~îWÚ®œ‰ßß1CQ'æ¨kKRò…9’wmf‡!”‘¢!¸â„Ê]j÷`íÞjâu¶“ï~(Ä”/kð ò˜B& F@D’.I{„‹P[w2Ÿ˜6Æ Mdà×Håµà®ÜcôJJû r[F:iDRé0ÏFßx¾¿üQCÌd@«!€ý²lœЗòñô—¯8¶¶ ¤™ º7ïeZ"S"Ö^Yo­ä¡sþ‹Ïº¦7¥kû$.öXl)vé/2­[8#vÊé~Nj¶¬”¢×t þˆtÖÁ‚§¡É‘ê  3d8>¸Ðà‹ŽœÑûPÊÁ5œ ײ7‰_Õ“¬Å1?ãûªaD30¤KÍ·¨C}í!土TgÜ‹"bDg‰2×?TJà~¨u×%BЍÑÃ236•Ë®‘å¯6N_‰Sßšüø †(h”Rᬂj+M{š±KÛ?xÀƒeÄ´k{ _¸Âo‡Üƒ.XpòÝûûörÝÕö~~˜^šno ‡O~ï¾YöyKâ&#.Õq]ƒ;õÍÖékDÉhM™´„·ó™+7 Êþ|¥'‚Mƒk<’\ø"’ŒÜIýî{\m“鏸AÓ†\AfzijLïøº]Ë?¬5tK0½¸¢f¡²´ÍD¿ÖZÈÜÄ=oTŸýiùš³Ä¨.>ø6–;©1iù<*êEp3`†‰7*}*È'*Q]7°ü§pÆz2Ò™„bó鬔:8\è%ÓH»»­Åœe~OÈݦ‡ŒÞ™ß•å¢|èÏ©ÿæö–-å鬥‡Å&Ç‘;Aë§*´x6oåÚúdÞ'7y¡=ÌèÀûΓÏ[CÄ^Qk$ArŸíä‘•š!X# ÌìØN3¸0O|ƒw@QŸÀ”"h@ä ’N¦ÀK'ý ²×³èª/9=«®Å#{Í#!Q»q|†¢EÝ—¢X6Ûëèä<öÛR2qÌ.OÅ~$M¤°å3RT„ ü,zãrö%Í3OÆÕ?”6ôHs^:ZƲ…U¨x×!Åž²¦õ»—ÙU7.Ë!Vç³yâRIƒ°¤`°Ê®b9*¶n[ÉÉÍ­ýýd}xãQÝm:²û…áGGmrRé#øõÊšà›U öO ¾ËÑì/q:£Ã³ŒsÁƒ2ôKOGÄ‘V¶²_¬ïw”ì°eÞ䨽˜ùœ .€/ËÃÚŠÉ_sŸ{ÌܼbWC®z‘6&Q‚ÄÞfÕin„uX¨Õ“ªp‡bÃnƒd?D×Ùùe´‘CÞ“ï¦üìóúÉH–‰{lß4Æ.Ëì~I¡È¬>·n\wOÐŽBÌkåIò†À9Îd ÆÿŽÍ‡h%¢®­¬úZ…¢J¦„ç‰XmÙî)¡\O¥›ëó0ÆOñìð(‚× ›õvuæË:㎠·ä.k‹iD9÷Þ²a'ô ²¬¤ì0LlºbWÒhl„­XRÖ×Ãå(Šx>Ž*8xÀla ‡¹JÁI¶'PˆCë5¾œT10×èö’!‡A\×´Üž2ËÄ©Ruÿ¤'í›CM³¦àÄ®óoºÛ¢WÑÉäÞ4ê"©óÔßpDog®rüYÜaß2Frv¤´>~;«Õ{ê(céÚeÂ"Ï1ÏKeæÏÆW6×ó5GVáºé C·™µ .‰À¿óF(-Á >~â=Mp;xܺ;x%Õ¤>³tƒ˜Q`Ž·øIÝÒ_¿ð§¨ÉoœHs¿VªYåÒ­¼#q,kßU ˜{epL-•öWn¨cSq÷ŠÃˆµ—9 {Tg˜©»u^Âiqï=f;Q-ƒ·oÊÉÂÆ;>Se°ä_?GH+zÑ‚»ªhÙK]ðaέñ“¬|u@¢:Â=Ը䔔P×<ë÷o ,BŒj ‚³‡èR"­%S˜JÏ}u¯Â7Ö[[.Ô‰c¢ŸX¾ D յK7!mÚÔ©Q°iõÅÀ9ZÄZœDžû‡çBº‘–‚{–#¸s ÔpÇoö ·i{Èþ\×e=Ê*mDÝ=îbu£ŸÒ²·¡ƒœGšÚ¸­ŸÒÊtcD’.‰§0pWå{º{V•ѾÔKXd8q›Gzôß ŽI'¾?sXVÙÿÁÁ•7%SÂÕbÆÇò3=t³¶Ö8?ÿIóŒ‡U˜Ã!X¹¯_!”v‘5þœú‡5†mSd裬ÿöš‹;çrÕïá¹ Rh¿Ê ²lÁroQZåDÝ·î¨dqG¸‰´¢îŸÍfä7bbT>?Ò Im1蹡g‹ÁÔ4Ñ&}ÖZÞ4–ì/‡Íö$ líÅ#Zj³QEl(‚sa{ z|vÂ8;þñ¾ñÄP©qbœ*‚Ñ4ˆ-à*V9UÅ ÐXȵý¼¶ûÌDœÇ‰-qs>‚æ¨þd¥ð0qÖûã_‘d1jÅ iO3k!OR‰8Hw ‚½¢@¼µ|¹Ÿ=ÀÕþ5õxÀ‘ÎRSØêxßè¦&Kò &˜®‹s‚\vªtéw}~þFµL†'î.fþXwÿƒÊ´¦¶ˆ[/—[A—à°¡Z-´¾šg¼œ§g³™¹óR¼à)¸#Vå {måP׵Ϝb«-ø–üâ8 «ûƒz‚“€õM-.nuÎÀœó^ÁñÎxÖË#nÓªÅÃðèŠ>±Ø¼£‘ŸJ«ç}Ì,?LFå[HÞi ¥Ù¯‡^gk r=æmÿ¨¦ž, ñu£ßhø2¸**Ÿqj=ðή0<ÍÏ{2‹ZeÛ±XD/¸d½äŸÎ5wk [‚½˜Ë·àì½®–ÞÃw0ýâu®AGN]„ÁGj9Nže!üÕZbØ^𺑫zr¼ÃäœÊý"ôx¦OéíÀ:³¾®§`ȸ ®¶VŽò9ŒèãsΧ½«B)¥‰æÔŽ JÝQ‹C`mQ¼·€Ú]È«€¬àÁ®©~¨CN—™ÍËsúXxêøH]tª¯Å5¼=·‡ó{\x—#‹½åHy#Ãq,}s+Ü “@é-+Ùin·Ú¥ åƒR  ïà´­ã>™ÿÐõãF—½9èªòµïõ›Ôe)5!œrE˜lV°yùŠHì]a«¹ì™?WßÝ`I‹ÿI³ü›‹_Áý$/òð†…Œo)ܦeŒ`)ò¦RÆð~Öì]t:ˆSŠHÛ¿Þž>.Œ ¥~ö4€mbÈ…¸Íã0¨üJD¬ÞlFѹxˆ¨ƒ‹¤3¥Gɱ/‹Ï™BkýL’9pQE–O d)‡ñ;­`àýRóÎ.º¦¸…€‹TbÔ®:Óv”ÑHwèyö Eõ3 ñ©z,ßB+eÙ*ŠugHÖåë Ú€öÉó2‰È“Ù5=CÎ "GÓ@à!U™ÔKâ¶åMY+Ù„wS”Ά '±ÊfG<ßkŸƆoãÛt]¯”E6'ÂÇáoQ*£Š…ìb/ƒ9‹–"‹<€i\ÉÙ…¡Í×û>o¯LæU½ÏæL£m­‘W9ráSÈØù­i´ë1&|æŠPÓˆ·.ÅÅb"²µ©b;Á©µSõô©ÏÖÐØ=ðÛ™Çr«_7Þ(}¶+l<ê0yÚY¸e£ëþ¨Åž“x»X,uΉ°}u:pkßãëß—OSIf¾éÒ{L—¦†˜^ø-/„ý³¶Ì^Ü‚rwÄü)äÊi5muðµäi ãE êH¨©®Ý(áÎAØž×Nï{„þ0o½‹wå…qjÞœ›35k' ƒ2ƒnG?¦êB>_ó’ãÛc_$`¥eªþSz#øÈô²…+×ä$œ¸Ãóç¾› 8SÌ KžOV@Åôê#s™øë¯¼ó|3QÓ\ «Ó@É 5¬Ì¸ð®GkTÒŽá@¢GæNßnL”:p4Ýѱ|Y+Ø]3­³Ñ‡¢b£8è‡=³ª‡¸‡k »ušx0o@äæ#±"âè× `‹NÔ e‡wœ£u4Ê;!aøòÏæK,ŽƒC*á ¾¡S®2KÓht\­Q$X‘æÎ-m¯¹ƒž¥ýZÆ™×SPŒ¨€Sø)O¤‡ZÖÀ‚Gw˜þZÒõè³Òd,‚Ag+Êv”¡O>I{·t`ø~„L²Œº¼°ÃÒo6=7_eŽŽ.ßð+R\yîçr&¨Ññ£~¶Â–Zɼã>U"gž ꔓôÙ¿‰(]é$=[%;wKY\2åbÝì*}¨Ë v¹²õkžø 9ŸÂ÷ D²y«BB]‘‹‚./ó‚9BôógR1Â×Eš-ƒÜÁ¬Å¿…µ¿Î\n:+a"ô^ò ùcˆ‰pM˜8H)AÐ=Îç*OôºžX“«wÎg"ûwÇF-xæ¬;N©Ÿãž•M“ÏÈáSk'«Yw§‡‰r˜á†XW÷)çkõ Š ÚÐò¨· gÚ öÇ”¡xÅZ7LÄ®jypãu ÛÃ~h¯.«M6‰wÂr F¬m ¡Ó¿H~=0¿o° %ÙP¸¤¼¥‰¸ïØ´…€9bfægþ´ùa(ŸsòYŒ•ª7Ÿ‹@üäzù‡ØQX9ü/ƒl×Ñsç긺ùzO—³ßøüʱèz´áê)ƒÕ´^b©xÓô¶„¦‡â+©2¥à™Àq5m…æ¾íp^²X”t±Õs‘27:` na§çN‡?ªxu}ï@ÔÜ6»Tô ¸Í®t—W¹†¿ÔÔ²á;ŽMVúÄå+I~wcicâ)tEÌ›ff?íae’ ‹ÙJÄÒÏÉ@öšÜf`ÆÆ,¡íÄd“Ì¡>Xþ#ð§¸DaFº¼´N ¹ €”½Îv+œ\`„™ØôÆØÆ•Xèx+E,;Os#ÜÀÎtð1!½í8ÇžH§×”ÜQ2ø´¥°MЯ~¦µJ3œE½K7Ú`É¢BB•Ýínëž×†^ÑdÔb\´ î÷º¼å©³_äa3x˰¦`W©™Ì­#Ãq'ǰʙ2D]ò¥ñ¡b’g¥Â¿s!Ï ©Ë¬~OЖÓÝî`QCŽ6˜-VIÇé ªà o)Yz:ï(›Dá€80=÷BZÿ¬åXË|@pÑ‚4)ŪUu;¨¨«ÿ©¦ Ô†¾Þu# •VÈc:ùñý‚ƒf{,å‡E]iZ Ç\hæjŽÍôšfQ»Ë¶^„ª%ÿjŒ¾ëN»¨ ›=¸|S±ö÷ø#¹ŠDoXôŒÙ›Í3…FTèüQWüÛ#©¬±‘ÛSì½OŠ„ºäm©”‚3‡;૬Z²±¹QSÙªÐöŠÈ£‡‡åߺ9 Ô»¶mÉã÷sÌ¿{à."wO§)nYbj#ßT}Úü9oöÊófþk\®pü¢ðöš…ò™¹36«H20–`I~ššg"4ŒæŠ½4S—X©ÀšÎ’{¥”¿•úIQ½¶h[…QQÉ»EXLò<a1$¬Æ·iw+½{×üÎô•¾‹Ø •Éâ9bŒH_s6Ø™@­Sê¼ÙK=/ù½H'[Àr“¯³Êd’` ñþ{° D£|€aÜ"A…$ê0)çxÂÒð•RG°©ÐFD"D„è‰KšÁ-x8ú‡€ÙdŽ>Yy|[{«dñlê˜âUÖÐ-zbp™ Ä«;”ËPçYÃ’Ÿ>r†¾B{D '»kxðL|7PcèHèŠÑ|·ð:-Þ$fmº '¢¨.À¯!ë’ßTóè¢*“;4K9ò×¶±¨ÐEI|¿=ËêÖFÂ)bþA=’‡.ÕæÖ8Üpþ+«ýpæ—iù—¸4H!3oSΗ_•âPy*úŸ$zK|Q" ¡µ¸‡º¥¯S͵iTÍJ_h™…ö?Þ1…DÒ$!á’øå%DÀ¢ú]AÂBíú»~ðÜ”jÐræÑp†¶d,Ý‘¦»6…ô±p•'n£XºK.&·]gÝ¢Íwõ4Õxíì¯ ö2â°?f‹É.ܧ§ÓÈÕÅx&Uy¡|QÑ_qù‰ò‡‰Qžà •©AÔÆW¢$•³U\øÔ!àFf3î©6`Å„s!/ž3"u=eÍÞ<ïLG7£íqÍåBs~ Ý2åÊÇN\AS•¼ulUÃ5P”:h± Ql{1ÃoÄá n¹Ä×í$Á¼@u.U´anâÄ#¿}^(èÖz6€é9QŒGîOŸ¸°ÄoU­#c²>ÉŸ«ÈÓý†dâêKè?ÅÏÝHóýÙ ¡oiœý |€¿˜ y¦<ø¶¦Ö¦(a4{[VN›µÙpr>{ÎmÇ_Öê/ý*ñ°07®Ÿ“‰Kp±(aŸÞ´ÌcÄÍHjIʉ2b“1d”ÑV¦çÍâ…Ÿ …î™@©ÒR-Z²¶z·êÞØÜeßȬ¨<Æ¿Å}¬â«kÅ0;7v+f³4¼Sûòm‡²K›l÷£W0OïpjÞýH#bV"jE¿»nÁgÁ÷k‘S+RŒ»\oNJ‘õ(?…^·ûÚàrôáz¦5öyé°Â0„ † ž¨ãGy&$§’þaÞ)£ßÒ—¥<;Î#S_„‘êæˆÖ“ „¡~¿Ò¤‹ÊÌgìÿ;Y¡¯ì0žÁsÄ$'™Ñžæñù‚£Dæúê”À¼÷ Îg¡# n=Ëhììpq t¢ëCjªA9²û%à":ƒ¾«ôhêÀ:‹nm¼Ä°â¼…ÔT­Ûqéô®]†(‰™êBm˜º|Â;Ÿøt) %¤×¨»çq1Œ¦¿I{ ^ÛÏ FÄ/¾=âÇŽrÛŒ“ef¥5OaÜ"vη¤Ióà.Û(?¬Ò]~òÜN—Â7‘K ›N ìÖƒž:0J̱ZJÒ§K…,ãÌü•ôÈfÕÉ.C‚ñTM}Iâ/B/pÅØß¡ÀɋݻWXºÖ(G’Þ›Q/ÙsÆúÌHè! ¡'¦çkuOµ"ïcï²bqE߃Þ¯’]ôLm®¦–¿QýÒ*VpWÆÃ~¹ô¢¿þ4V±®¾"×€åýƒƒbµ–œ½A˜ªmB:§ÂœÙÜÅí£÷žÚ‡Fª ¤Ú¸g.åñ wè ö<ù5¹n:´ce³ žÙ‚Ÿ¸÷…¥ÉÛ4ˆ†(ë7É£ÄÑJGR¥=É©ÄÕ]©œ}›lú3¸ @Á8åÿ2¼<Þþ°·%k×èðB*ÛíǬûG¿¾Öi„¦€»ûgZÕgÎÅGcªIù¼d \‰¢¥¾kO-½*“(ûÓ%•YaS/Áއžõú².&Žl³‹* cEU[³„3%HãjEÛˆ×ÏòÑ;ówmõi`¦ÑìsHIEòañy[~GðÈœ/çÕ¦¯”÷=Óв„’æ©t:×…-µ–ÐÖ×Ugå<¬Ì<ßC˶ßqðÛ­n%(‚TúÆÔ›cêlí ìdc2sÑ¥R®„/›ï¢Ç,ïÞ¥ 3ùóÎ¥.þÚá‡ÂŠšèkƒ½×½·`ˆ¨^¬"£g–Š ^ò¨Ý­œŠ»£7×íòrz°¾T*±õØÆ ÞX¬0ˆÈ.^¥ÝÚôGÄËß ™çscxä]ðRqI¥‹mz~ïç³×ÿþ'¸€M|Ö©l™“=+î<<_È:=ù£féXbaˆ/UÉ/VgLŠÞ\ÀgÍTÿ¢f5†Ü+-NކS»†ï Ò(Qíú»Kß?B¡h…þráœ(ÉÀé9õ/¤~w ândŠÆ,jëdüI ^‚É—[“üldÆDí,lîœí¢¥_•¹Sûhj”ËNp¸VrkS/|¼¾®ÏÿéCLGX†[÷×bJíêäZø­cžª{È8|SÈ9QM¦qغq[¾§·MHnx0Z±ÇkqÖÌþžmÅM§¤ƒ0¨ HBuo®È]`ª°Aµ| 3wßÍraˆÛbM±^õ©‡wyÂHŒ+uksFu:Œ aèš¿äô !vºÓ×ZÑäúQ˜ÑqÞ铪„3š@~!ÎÃ9½ÜÕ‰4AU!lϤè‡Ãp™SÓ•¯/Û#ã7lM’ÕprÖ‹6Ëì†ù ÍÌ÷?&‰ù•Pó²Üœ÷R»å4mcZ͈*÷kèÎï;3v¡>EΓ-¿y4–¦‚¯>™ÚVr 3ÿš+°6Y$ª%ò*FMñ”)(QÿÞìÙùÐgŒÖ¡ÛƒF‡öy£þÛ_iÏ;±†*¼w©`Ÿé1ž¢\á‚;ìÖ~N•‰ß¦dO.žJ‘ä™Ñ\)£Î“{ÃÂó’³$³Û‡«5^rÐ4mnôoÔ8؃ò'ÁÃûú=Bf7±_j.ëB†‘ºß×sâ+ýzã´U³BD½ÖL¿zóy|V¸’ÌÞ,tÄÍ$¶{ Â;C¤1÷4vèwBé yÉNîŒµÄ ¬vo NïCÝˉ4 $ÙVEÌ|¿ªœTÎDš]ßâ‰ðóލß'ÈW¨.° ›#ñ‰ ¨Ô!×±›õµg×ÉÉÜû|ÀÛÕD¤JÉ–æJÓÚ^šBV(žá£0„ã!¹Ü ŽÍÄ)¢T4ÈnËzÙÂ튘K¨Ëï e¥ÁtÈoÞáÞ–×T•?ƒìϲ¥ô¶ö¯Û(‹Žúv½Ìv&Y!c³«6¹'Z|–G OŽ{¨GnŽS:4î5Š{vLÃÛ~U‰Än vÍE•M˜É„)>§ÅÂi—Ø™ôe:h["A[]å«mìn¯:Ç‚PNn_×â#¤RmOK³ÚIí8WÛ{^ÒC³qRSÇÎ(xÓ³½Øe¤#ö)¥Îò%ºã_‰ú¼' l|æÏêáqíüî®Ül93xx½¦× ›ÍqäÛMâù’’!³„«¬8üÆ…ß–êßù@Ø:é»w~êm€ùt!Þ/vÅZü"ú]¯Öµ ú«ƒ–Âpñhâu?‡˜dæb8Fyk´)ÁZÀ8ÅÙÀ½#:TsuÌûôÀ)ÿÐbƒè3]âá*ß[<óª ÝæØ¶>g~{l}Àöž€¯é¡“eQ“f/bNQ{˜À€“>|%:â'¯›¥Íú•v„Œ ž–¸óì”s:ÅÕkbÜÓ¿Ó|´õ›Ÿ*§.Ãv̸Ò)ó³{sÈË|”ËDvÀ)e£±„†<+-Ͷ0 mîûøU êu¦8Áýb¹ôi3Šzà××ÍOwü.F¥l‘Î/¨±Ê÷êÙ 8ó$A·üŠ`W0¼1Eq¦+‹¨‚(qöà_¡d1¶öº7;÷ÀÂIÞ=I4ó~ +˜A2yJ£ò¼Ücø¡ˆøB™>ÈÇW‡KF~*ÿÕ\È è‚àÇAæº$4,xNÄHòFN’B]x´ý¥4éýˆ/ö‡0»A$E®÷Ù£e¼2´±ª'¤$·÷t?¯$¦ÆµFmæµ~MAu_DuG@ŠÝ /â5=Y鎲_bd#ºi­;µÃJ$„îË@ŠÎ¢ÝH¶Q^ãVa°Ø›zýd×5“t*~œ²Ña‰ÙÄŸMòr¢dã úAŠÇÍò»š{L—zM‚…$*šš.Ùü“—Ù·&©möƆ¾ÔYÛùÅêJˆ}§ ¥™Î{“%KcX!l¬›¦ŽxäEÎõ™ø%Í$Ö5D³ÃC^‘Li#ÝH_>º9Úqìôô³Õ¤ ʼbZH¡YT-â\:@³C†ftÜÿ²ïq™T(EƒÙ Åx3v’gy¯‡ÂÔt9f.~qî…L%ÊNûqlNbÇZZÐZyjš «r×TŸ‘†';•mÜEÆê núK&3ª-ìñźÊãZ×׈³Û¬  `f‡½_}ó>)¸_3Ò¦¹U®y÷ì&ÆTËYckÓÞŽHB&õמ…Êé^6s™&ª¥G#òùJX–””ÒŸ^¦³M™…/ ;ú×¼èH*~O§ãØ|ùÀ8\ ɱ‡ÌV¢®Í[FXÖ/uöB$5v‡Á7˜á“ ÞÇþ @' B oÁ¾‹(ù2bØÜ)ؽü £¸;±G$9H9¸?ÉŠQXçSŸ3n¦JUøíék| ÂԾÿ.|ɰNÑâ7©zÂô`î?®×~ø#wÞ5~Q‚ÇEn¸U â(ú`àõŸ¿¬D84{ž4_Ôʺ=›–oñØ×çÝ jõ¯sûˆ´«Å»¼SߺOiôþßp3ÂJïhµ{ùÔ\¾ æÃmå@ñûZ[–媪ÛêécÞ—_$z¬;}x­—àtAÏ„´»I©rô°¯|WÙx{)¡¶SÃ÷lçõ¤Â½CŒÈcÏzD…ÇçxT”åüß¿UKŽÍÿ(ºoöâéØŽ±tŠkXÙ‚ln"ßzÄt¸Ê4MÏÓƒ9àÿÆcª”}ÍAÇÏXâ—jÈpn5êžmqÕhÕþ-çM沑ƒì€ZOûÀþ=]4þ|'Ã’l_ëõ¯E…³=× pUû[NÕI)‚”B1žÛ¤ ªàíØÙÖHų¸;mÂEŽ  }¦74œïHÒÑw:5oc¤A+4ìí@C6@²OJ¾³Ô‰$&þ–Å¥ùÃóŸÎ;¢t fŸ’K@yû~9}¤ÁÂÑ´ËeÓª.7×OËqù$Ó8_ö)½(,"SmY‰cÂג歞Ȼޮ }»>·?*iLì»ð>ü ëhI†WxÞe…_Ud\ ŠÌηúüˆN.w*+AOi}Ch=]ZPík1Ï{¢Fœ7‘º£Ç}¤èD"ŸQ!a§p’öô‘û;dÞq auìU‘`ðlÙw¼mÒ§¯1˜[ ü—“™+£– ÷0ôÙiUªÉh.ŒÐG¼(rȘF ªnHµDp.ÊØ$ñ å#!„pœ2•—ÞÆªî;Ù*S%ùÐÄÃw /†®!]¨…i$ [ö¨!‹ÆºLзÉþ‘zا´æ¹*n§O¾à³ß%Ör@©Tü9«-œç­N˜9nKxKÌÑηĶf[úÇÙlºn$¡$3²pþ—RUö)4D‹k!•þ@ðjß‚]}Sâ!ý²†§Úüôy0oœÐNl Wì¯ó½ºÌ5ÒÌö‘$ý½ð»+Èéªg”ÚLBÕMuÞH‹ºsäsµ÷r«¾Ž<éÊ-寶¿¡ƒ?ÆOu1§ÄZ)ï¬ø"‘Ãð´MMÞžkHSe‚ë·ª:/6ÚßË­ME;ÐﻀcÓºˆ ZB‰á:N <5þE‡tÊfàÇ% ö¿o‡ªázœþ¼ã©ÃD 3„8Rù i‚éuL&c ÃÎu€öØo¬ãï#MþI6<€ª(¦{sM¯¯jeô gõõ”‹‚xeçÃs}Æ ó­Ëyù$à;'輦ÍÜQɹ„€¤ ¸Þ͆(¥;F9yûÍKÂÏ-¨èÐú–½T3ÉS/˜”9˜zfuö&ðÍ™Ÿ‡Ìëe[ÿ?ˆ'ú¹gº „RôÒDº¡‹à­¨E ååËåøMÛÏnú,0¦6öŸSjmÝ47¢‡ÇkµÍÞ†‰¶…È¡:éæéæaŒaÆVá ¹ÐþÕ”ÔËðjÈ÷žtîÝ\ØÞÔnnæ€7A_x eŠê×Ãí[¤Þü¤Ù¥äÖ½*™†”KƒÓÙ&ûlÚ^S±F(àŸûAòþñ…cß\Ò¥ÄC®'ªgeT°VuÀãí<|á•tP\Êrÿ…çËöȬ¡¡ªò¡áMeZ»;ïL—2…0æ¥P½7—-Û4ЄukÙÎüà ե -ñ7V›—Þ$Ü€ÞjùH!&ùm˾|MH'Þ~MM‘æ—UÛ̲D*‹>´ n 61 Þ-_Zhúc›–ðèÉÈB>û?:Š—[MÈðï_ÙºX5–YZZv·Ž#·Êò¥u™a¥74vÅC;î-ëÙuÒÓiþÊäÿ]FÞ¤t[eE¡IËa ŽÍ2KTìV& 9æha†@Wßåá6”W¹ûÃB¡¯Ž?¡—vLmØ@´JÖW¯ùËèÉ->‰ª?¿«l˜.Λ4U¶x£ÃLGbë$pè‚£m2¡]2©äþO£";wGNà Bš­ôñX™$P(ä(\¸\.a…°«;¨ysk:Q•°_4¸–púaX^ä’—Yª(ZHjFé‰-‹hbíN`í¹À>àž3BB ‹â|¥Y@/Zg…$SRWE¿×•Uí+Á>™‹ªÔòèh̺§­‚fõ&Np*7OKÒ6ô.©Œ\&e7“V2—€ÏY´‰"eîv=NJˆbÂÀX$=1vžÅºÄ àfJ·v‚÷Rìx8§“3‰²W›]7]×ù£Ì€Sô“š#ª#n¡ ¯ž‰`« †ÿ Ò‚^XÚˆ{œ²ûÔYüæ†Ι85Þ”ªlÏØºÏþ€|®¶2ðr>ùÉ}ƒ-1Â÷Æš”aÇ6*. )÷ϮƔ•\YhhçÛœ=^A €ñŠ$ø#‹¼ ÒÒ^àâKõÝÑyfݼ…𯈀âvmt…»2×FVæoÿ‘&aSÂ6N#–à4M僰,9ñ«ø)­´A 9÷$~È7ÊúÂ¥ ê¶¼ä1tÆF!n{ÑMÚñ¹‡89<Ò†SÜ…ªšèßS¢¢±Ý%$*í.êyú{y|P‡å†ÎhùÛ&1ä†Úub‚üªëwOM$“h2í‡åBsØáİVª^ꔳs-j¨çíóåN2ìSd q¹>{hZù3kÊü|®Š%3ùñÎtÞ ‹G7öÒõÿ–Ñ@â0 †vb†;@íþ]4O×™Æ/½c>-éo qÚô¿K‹1Y;ƒhÌ¡Rvøxó,Òë\éU“vÑ7øÎ¬»eƒj ßy–ž³Øò± RH˜’KN¥¼ äͯÇYùðþ?u[¾#[àµ"’æ½â`¹Éè~õ#àpüƒÅ¹•Ár‘– ¯MŠ-Œç7¯É»ŒFgœ][# €9;u|_eÛ6X$'d3ĵÎz+u28T”@-&Qó¼.c ü#utMôÕÄ—*ÿœ5#ãüIZÂ[ÇÀÅt'Ó[êf.­óp@€ˆ@Êê3lņþ»BK» =^*ᆢΩ}ƒ‘zNÈ÷£[>E§’3€­Ó@ÑàÀ«ÄÏô_µ5g^Wiïoö7˹~¡vÂem lnT™ØR…ÔþýΙfò[T°ËBœ–V'tì¬x\Åp5²Fùá,¥] ðX±ÇÇ{,˜R"y÷à,¤^‰4Ùƒ3 ÜêV9ÇKœZâN £‡v¨W{Rþ~÷†8O¹)dƒëOWMîs¢üÎüÕ9«ùYýö›&‰‹W=½8!‹jšNîNÇ7›ôo§^7ø§æCÏ“/c§8e 7ð—Âwž³EçÈØÞ:£@ž»bè`Þ=™¸vÿ9Ê訨ßã7iaz-wúh X˜¡IEÏyå‰†xѺX°õp§ï[Ø­ åQ’’÷HhoÐ3ÂVHqø83 Šì7cµw8³fªI·;„Ç2Ä@ñà6£¿šJ|c`¡1‰ãó”U+÷Ý§Ý ½Ór×—ðÒ†^àUÆŽ‘CѯhÙ7¿Ý®`añèPûý‹`Lë¶ûLÅVÎî&ø±ÄfKlÁNlxO@z|uZó®? lA—çòxEÍ«R¸XBÜFF†•¤Ê}»¥|èÁŒEž¤x—œíòÝËìs‰üJJèè9®ÜSÂX®y ²ïŠÌ³Š“ØÔüÇ‹SÂ/ÂŽ±¦S9`¦3þ×l:pÕÁ( BãÜÎMb>ù^WJ.õ»œ8e,Š©;5Lƶ’‰ü–L°@B¾-Ò¡lbèÖ¦’ z´¤>˜Óošaè— ÷Åbíõ-úDaWEmn±àç*ÎÚ<ݶÚóRu3À ˆ›<ªÏAÎiR÷›Ÿ$?è@‘V¾ŽkŽÃÙÒò³x +Nü[ŽŸâp–\?OyRÊ9°¦Û¬RÿUDÞÞDÄ¿rûaš}²ZXRöƘgëR;¨ à¿’Ž"JW£‡\“«±èÞ æ|ßZ0G̚ݖqÑÆ|Stôéó??ry/üIý¸´¿Í»ûö¡Ë‹$ŽËŸ® Z==v1:Oz™µÂÒ¿Á!JL² 3¿] ÖœúC2`EΦ\׉;GB—*š©Ì@—[Ýžæ’.Òb>EZ'÷K¯Ž:¼wÌ#êÒT@—ž†âÌ„1„ÛcP‡Âœ5æ!¢‚Lðj½è$•)™Ó'¦x 1FœÍ"³§gv}ž¹ 9mÌ)…ìÌF’_F;•3Ì€ÇÝÛx6‘åvu.-b›œ\vêNÓ‡FªÐqŽxyïD\”`qÙ©yµÐý N;Z÷Å á3ë+‹HÌÕóö· `ehd˜í ‰z?ݧ-ŠWj>ÜîÈ×üÖe‘¸¹C²èj¹k?Wrk9SÉŽQmïkéÅø‘Äü:`aO"ÛH«ðß›Cp¶Ä­{œ3…]OÑĽ˜‘‡Jm R>FÎÁذ6§p«å’Zdõ9í´HòoøpiÁä€ !GÒö©¥M¨úf—,ß+¡‹1\Pàbšv'¾ £›Ì2G fmæG©ÈÌ[Äð˜|#kà¢/ ¯+’Óy‘Èõ”kw(ÊïëO°§«#Ý<労!¡ ’ÿÞ£r’jhÍEÏŠÒ÷‹_¿°6.E"„xj8àÑ–å˜a0¦±ÜËESÊ“·´­Ñ` ”.¨êW¹î'hH ëõËÃoØ!ÍÕùzfÈq[y¯Ñã  ÅRÛ'—ú Iþ^·LÈ8gЇè¢+åTkšùÌTé\U$êÎýÇjuáÇ™w/×T²ö`ÖªI²e|ÞNøAà+<%•3ÚMñmo¨çN›Ã- ,!JÎ`áÈÊx]ÉG$!g­â+W(õl“v‘ó.ûŒ¢úÀä7ª>©G\Œ!ð¦ÜT`³DÕ°S€ïzKѱb+8M­Ù&ð€·{#Õ{ÂâÁ“8d7Ÿ’ü,D€ç·¦€á£b¯„?¨ ˆD¿1d︺Év2 Nš¯­Q¬xï>Š´?,&´´®)9ç1Φd±ÌZ¶‚•xQvŠâ´ 332Cø±áE”[}Gð©ÿqݬ ݼa=q˜ºnŒΕ d½¯y!D§±¦os¸Ë€ýΔÐSÅt‚¥ÎubýPnoÀ•`œÉÜYLCý4cT-Œm„GÜ7þ”Ý=$/ß Ó@Ú™¤>,ßËLlq@ŸÓŠIJÕ|~ªNœÎŽI<ƒŠÈâ#âÆŒ© TDžJ>zùqSâ©Ì|Á0òy‹ŠÏþÊ‘ƒ¯ZmsQ%‘®„j\ÿŽ9}b¬¬ëܪ+VzÖªˆ®1‚J}ÜÕŠú¡ýçÖÉŠÙéE8ZÊ>ö—4Dâ4àCX Åw)‚våÀ N•È!a¯UoŸVÞô…$Ù|¿‹èþí`óâ>éèÜ’4(Àx”ˆ*žK< ÷•­ñ‹¸jÉAycºOO¯fv#Ù.Sî!‚Z¸Y! endstream endobj 152 0 obj << /Length1 1423 /Length2 6225 /Length3 0 /Length 7204 /Filter /FlateDecode >> stream xÚx4œk×¶ ZÔè}ˆ^g‚è½÷ݘa3˜Ñ‰^#z'„è$ˆ]ôè-¢$ˆ-Z!ù&å¼ç=çÿ×ú¾5k=óÜ{_{ß{ßûºž™õp²é *8" ªHZ$”(éY€€ PT!âä4†¡á¿ìDœ¦O ‰ú/„’'ı)Û£1@$ é€D q)„%ÿ"=¥ÊöÞ0G€Ž@‰€ ˆ8•î~ž0'g4fŸ¿n<`^HRRBàW8@Á â Û#:öhgˆfG°=`„à h¿¤à¹ëŒF»K ûøøÙ»¡„žN²¼Ú`AA<½!Ž€Ÿ-tíÝ Z"â;ÃP¿FH(ÚÇÞÀà00„x!!žÌî# m€ž;ñ¬ý øs8è?éþDÿLCü ¶ƒ‘nîö? …Á!=Um!´/Z`pü ´‡£˜x{o{ÜÞøUº=@UÁ`éðO(°'ÌBÁà?{þ™sÌ*G%¤›Fý¬Oæ cÎÝOøÏp]HDÀ_+( áýÙ†£—»° æáÑPþƒÁ˜ˆþ¶9AÐ1 ¤¸¸ñ@|ÁÎÂ?70ös‡ürþ2cz pGº ˜6 A0(óE€²÷†Ðž^ €ÿvüsEa`4ÀâCýc†@¯1ó÷„ù,úÀŸŸÿÜYcæˆDÀýþ†ÿ±°–Ž¡–‚)ÿŸ–ÿãTTDúE$‚’â@HHˆ‚þ™Gßö§ŽÿŠÕ@@‘ÉßåbÎ鯒½ÿp€ç@xÿÌ¥‹Ä0àù›èV@1 sýŸéþ+äÿÇòŸYþW¢ÿ»"U/8ü—Ÿç7àÿñÛ»Áà~æz¡1*ÐAb´€ø7Ô ò[º:G˜—Û¿½h{ŒNF ‚n oÿ¶ÃPª0_ˆ£> vþÍšßv“ŸzƒÃ}$ öó ƒ‰ÿåÈ ìŠyŠ 0Ôüå‚`4ôÏ}U`¤ãO±‰ˆ‰ì==íýˆ0³Æ¬Ä Œ*!¾¿È B ј¦Ç éIôs° 1€°æŒ0ÇØ›DÂ`˜'ÿãß @Ø †ðBý2ü£ °—§'F’¿è‚)ñ¯õ/ýC ¾0ÑÂ$X:ÂåyDûy­£à‡1¼•ÕÎØ$‹þ14×ÜãgmüµiE;ǧt#™úóQSoùöÏÇ}­ºóB—3Ô ÐX*ý늂…C_» ,ŽH§ ‰ÌØuŠÏÉÌdv–¸–Ü©fo.#%zD·žm_u¢¶îIîÜ¥§älŒè‡ ù;Ø,Ø8VÑÃVä 7=-³¼Œ5L&®°ÀÎÛãé¿ú­[&d/-½ÊèÏ=*Òê­EIOå¯É–?’2HOœ§ù…Å¥(vªT‘žÄN_âŵŒc'±üm¦h -yPÔ«ÑIW)ô†ÞýÑ&¯z¤Ø™üžå#&Û\ã¯Â$tÍ)±Îµ™Šœ5ŽX§ÃYŸkDὸ4,¼úη?tfeågÚØ‹Mñø÷ÃEm6'éÎíæ$ƒD¬Óeàwß?Qׇ³¸@Í/ï¦(8)õ5ptÙ\V½Fn }yÒ«2gMEœ|l~Õ>Ü}€äØg¦žM2ïÈÙéÛN~¡!vúšÂ”OE]§5‡ì²åMÌOœ 6,ÈÇÕoëT“¾'/9?Éžh*JVhL1g¬½…•¥Kh!©2CNJéº_Áül±Z|ô±LX³Lúàý·“×” vÉëÖoô|½n“äày ,B`£UÐyÏÙ®L—[}; Ö´“tùQÑb:ô@âÍrâw“`[ÊòûVЇß¾l4~.0W¨¹Mëš^·}2ÊÜqo )ëåänowú–¯zãÅ)î¥Ã°šÔ {D ¼ª)Q¬Uii€:ÖÄrÀ^»ý¤™À³gÚtò•dy&}{#ÔÝæc£îg÷o•ŠÊ€›dÜó‘’¢ëOuB¸$p‰cLƒ•I¾Ü¹Ib?Ù&ò!„å m"Ú€Ëi-ÒíXrè .Çæ[ŽaßjlX½i]éµAþV¡U©74À¦q#þùÌóo[t_ )¾Û¢g̤³»F³½äynU¢ùFË(gn˜<Î \ÿòÅ È^ôƒj9'½óøŽ/n5#~ñ4:EÝL¡¼çéšt=Û¢éòäw¥ÖaªpSd}æ[ïÖüݹžú4Vé´¼:™‘w²ëeUVìU_›Òsh§ ÷®{*¥Ï—àæ(;Ñ“ÎÈÛ äÒŒä‘u¸Þ¤yè…o)hœëÛ`WÖgû,äP–:j ©û»ò€ÏDÃ}¿%±Ä …î ›èkÔC´Æ+ÆP ‘Äûc5í…{»Þ݉–…-ßæYšµ9õ åw²ÕãRoÞ]ÖçNÐ|2ò6Ø;yV`€£ÝÙ¤LGî¤~Gn5ÕïM„„7é­Ì[}*h],U¾X7EÌæ@4=ÖøCýhk€ÁÏ 4:¼E7¢¤(1³9ÍII¡F\|‘bèÿ„òøú) zÒ†BÙùÝÉÝ¢€ìì5Åô‘í7A/òQ"Pn¥c¿åµZÛÁg3Ïä­Á,wRë Üáô›×´b.o»êÉÐî}¯’cH)XÒGª«enU·˜&lãCµéâÆø`x—}EŽõÉG¹Ybì½#t!<5Ë™\<ù‡^Œwmžá§ÑzÉ$#€ Žþ›ûawãY‹§øY{·tIý½Œ]Þó,’®Ä~ 4ê)~îÒ ÊCsë€Tú=PÞ¤Ôa„uõR®ƒ¿š’;gX d©Ä‡íc]ƘøÃ‘Cý›/Z¤~t¼æêHP¹5ÿ±Ä‘»º÷C£`Kñ+,aÆ~çaBPôBcüü;Zb·‘Èš{— }EÚ¤w&^ž,<7N ©°«ãrµÕK^·j½;9nÊçÍú‚ï‘Ï?÷lá—Þ?ÖVR{ˆÒVg4þÊNP¾xÓû$o¢nò´mT>TLæ(·TgNKÉnÙwæªkÖhñrOuþîGÅ úŒO®õo{ñW ÷xg'lDæ9ÉØ —W»nmXñãdŸànáÈ™W»·é >´R?(ô{D˜š¸èÍzó3ÿý¤â–¾4•FpÂëç 8):;sÂOO™ivÐó‘8—Ꜩ}¥†OÞºû[ìjâAÄ¥»$ûøùÖ BÚ¤—ñiü[µ<-¦³‡+qjåÕp‰0-(£•ÿ²gížÌ75öîÊÛ#Qæ:€Rž.ºÞôº¨ÏôþÂïê›ü§µ{ïE¶Ä*_c¸-Höu¨²çÞÇpÏè¢ùXap5ºš ¦þÕ*ý|³ÂFZKwÞY7®~Uh‰eê‹×)bŽÔåkx T$–BK;±|\£éXÎÕA¼å‰0ö‡“½ŸÃ8€ÌóßCªzMå`]7oÆúoÝèì*‘uüáâgœó0´·ÑÔmp3s•Þ£lÔIi˜>ù8ùóüËÖœk’þ×Û>Ç(- ÷¡ï·&÷gE]/C2óíeJÆxNÌj<(DºÔ˜ìiRúº¶  àó;€jß %i˜Ð›¸˜Gã=;uÄÚ¦±÷O^ý¸3xc fØpyÚŸÀ2ŒJÁó2OÄaš{Æ{¸ÉTd\¸‡UzêÒ*(r­ªsY ®*"`Dýi+Õž1¯²zľHܱ¯03øÄé1C§ù¼eÞ¼˜¡¨G­áìë|"„;s+¶ß2õV1s¸ò-•×a)îî5ª|Uå_ê–³¼?{êÍ8Ž#$7Š)¦q ’á|5Œ»æR_:·dÛs¤øÆ–µ™¡Øc©{%S¸ìS\¤ù™¨Û€Ñ„¼“‹ )N½µZ|Û¡æZ=ØoM›¸ýî*0/ò"öO'nÔÏ·§Qôf'½Õ_!ÕÜù|ôÉFV~eYz …ºûè]³HÛ!Õ²IôE`.VÆ-¼¯b¦;Ð)“¸mýР³Ëé@™ñ9˜ÿ3=bzú½xQ9’‡e, ARùˆ˜ùÜBjºe]ªDÄ(”†Â$r¿Ì§|ΨiÌœg"ú$¬ZÎÈ8Ô2,Ê@æ­¶Æa ±3ù@ˆè»HõCC6Þ¸¹íkF#äkëÖ2BØl+L‹–­PêRd1=¹Ïq ©RÔJ“ä"CôÀZPõñQ€Ïõ[21ѳÕ}§™®úÛ³?näî*”WÝ\íðx>q0Bƺòryêv#~KtqÒä>è™>”î5aõ±À£þñ“õöëL=‹Ë,“—º½íÞ·7Ö}{H{Òì{¦Æñ£€1¢d{B(¨°eüÆhÚ‹rÚwªcÙiàÚºœä0º§ÝP6Úk¬|#•BxÂ[>x}±†wZyääø“€›;ä{u¹4Ü2ó—žÈš³½rK‡ËÃiHÍ~°O›*©<tçµ+ílòõ»~çyº^$öiøÛ%åýB¥Ÿ±Ñº %}1p‘çäÍ® ÖѼ´:çdÁMFE›?,2 añð²g¹Êùl˜“¹/ÁòXdkt—\/†ﮌ÷gžu²L1ìÕÞü±½PÉŸ&}Òt·ð¾·Û.ên¶É§PIw6ÛNì2ƒöÅ/Ü¥º¹j ŸW¯gÉ’b÷—½t±n¸‰85—Õ,ô—[PÞ ‘Ñ=¼Öဠa~àAë`Á#˾p‡ïãƒÎ¡1×r?ÑsäZÜ9Ö;@Èq¬úzI¢²ÏZ˹uqqcõŽãã•êá’Þ>¡ ô«ÙBÔ¦«[Î è¼SWWWëÛ;5Ô¸`hsáE y›®Y†üÑÈñ7ÑG§™î¬pƒšÇ©›Ù±¸«åÔÂîÇ×3§ztªNÝÁµý>«@‘Ò…Ø¡4xÿ£ÈM+!€Ë_úîlW>^¨ÛѺ%Lbt‚¦a'ïÉ!7Í•‡yˆñ5Äú.ãl¼ë‘0\…ˆ=oþÈô¤¥f/}u­èÜïÏzçb@%#y[»Kž0 µâÛrÝR¬â¯žõ|ðYeå³%zjÑIO‹é¡ÁŽ Žç2T ïÃæòä¶åEÁ¼äÖ¢• ¤Û³L³Xœ|:AêL½ ÙŸJò¥•Ÿ¬f]òtï ¯Q¹\¨R0wÅ€#QÌèô=5î³5%«ŒVw^ܧ¼§xßólYs(ŠxëfyZ.rKoèè´5ÖGx xs5Õ Ÿ)­|ÕÅjÒ¾‡ª÷1Ö÷ H¦Aµ·NÔžëç?à|ô´¢ÐäAfê“s}ö6­ñ¨(þªöi‹Nˆ¥°Š'ý”æÈȘ£Ý íäŠ/Ù}“ÇBC0)n÷ì˾´Ý,õÖ¦Â$ºTóǫêÌ ÔƵ6õÁ€fŸðAC‹©zR¢Çªå¯3Ô•ŽLäÜðý¦2[¨ô—9UeÚÂz£ñNN Õ´æõëïë6X6ãj ÛnÇ„(Óø/OC ·ïÎd¤Å_†^³»ùUV½Ñän¿Z]â° 2$Ä# Ã_ ¶*¡XÓq…Ù#½4%D“o7y¯nwk½5 ÈÓ™Y•›K|X¡sdýUÊŒ^šŠÂ›5)’<ëºùšôõEÖÂØ2sÊD!ýU i¹6ãâ€Ð(š]œSëgá)2Sæqßo\¥ˆ5¼Œ ñ ÑAËúÉÔDñ­‡:(átÞ·!é@÷3*xÖ¹›ÎûKÓ/¯YœÍ 1i‡bï„ê§rI Ñdا^jþÒZN·§²H¿ðâeÿT/}ñÎ(=£Ç»cäàò‹Òýz¹.Íð6áUvq¡Z ìö ÿ;-ƒ™ =ûðLÕ”ÌNè!êÓò^¸/RÓzu®’mÔçR\oI(èA~zg$XŒâ Ètm¤¢ž¿š¢äEõÓ——Ìqõ&¨°œgo*ü¶> ÷¥âÄ+‰]ªy:­™àõ‘‹r$FgÆsÖ&6vÅÜO_R«Ü˜¿“Ÿ¹MRXƒ§ãýa…Ç…]¾¾ 9œ(BîåZ[÷`šÑEêÍ'3ĸ‘ Å?Ixz@hhÙI;™…Ô½ërk“à;wØV_;è)å<éKé V²ƒH+àGà7§ûöŽ6ÒÑå-jŽT”e³e«ôé?’P•CÒMô¹è“I®=eÏívJUŒ{?Þ¿ ¿Ÿp"­hc¨W‘*úµ‹Oñ†h}¸¢ ‡ãÅŠÆéö[=<Èw»×D¬Y/Wì‚%© „ûJ>èÔCBòåæ»‡¶§k¯±ï:oàXÇ•:t^}jÛ®²Ý¹;u>–1ÀK¾‹fꩬµœÈ«‹¡×,ü^¡'_Ì©“¬¶ü‰]Ú8ï5kÅÐ"ì°>Õ{¤cªJ= û1ÎïªñAÄLRšTñ@>yÞ×t"ŠŽnªúÑZèRUÚÈ^Ö°y²Ÿô†¨`pÈ’zF;ι;Áâ&u=ï):Nn¦ñÍò!|ßYʩڼœ{‹ä>{ĆJªìXT`“´.Y?±÷7ÎsÖÅcË=ð<ëÏaì8vµL—‡+Ux~qhoßY)/Gƒd¯{~¶TÏÙS+Ÿ8ðouëEYÏÃk|ßs‹û­‹›?W"ïRÖbÑçæò8ÉûXCKM³Gz,·ƒïïăT¿~b±!Sõ®&\ÓËõž®aj¹æMLäñÁ¸yùb¸°Dåpë4÷še®¿ßDÊ,.TýÖuV,ÓÑPa׎§?R> I溟™l×ĂìErÍ–Ÿüfÿ“Õ ‚_¯zÕ¥Áwý$*àl\¾‰­×å+¢_N't,Ä}Ûáµ±m…Õ3†½Éž|Æíµ?HÍ&ûVô°á!moû›Ùgit¼³Ù‚/ô[jõÞ\ˆ–÷4ù¾ú¸CÀcÐOpâ£è4™¼Ö~etÕ–ŸË>W Ïu88õ—n©ËÒð›µR™»Þ=²ëîYîªCüBO¾Âõò±hz¼w8mt¶ÙÇɺÇûQØÝpð|yáe%;H£Q– $E윿o¡Uv€ª®¥ìKÖû-‡ƒç 'µFð›.ý§€$z|oz,òåµûœB”ZþVºT…q[—ëg4*ÛøëS‘i Z$%/•`¨&xÐô}±Ô4ƒÉ‚ÈT³ì(fîU*;Y—Yëãp½«/SÉ·ùôü¿µ ›]ÀiU\—+ïæç'(w·ev$n¦YÐe7œž¿:ØPC k¬¨Æ¥ çÉ]ŽÆe¯’XÛ£„t…Pä¥JÌ'Ãu/ªv×Uõï°d,¨Ý7´r];fî,æô1ÈL°¼‘7åvX;ƒûuw³‚¢'•ß¹Ød }Áz«àÊ€Û.˜FåóDçíXü¶j—ãy²¨w›îi{ËözrIÐͼ|þ.ó )Žé{¡yòazj¬¸E¿›a8Âb5䈅!k>ƒm¯4øi¥û#Ö…ó³6ÍBÄ‘c¹ò—œEOÖä¨À³«ÚV(bï½ÜÊ»ÁƤ±»•Øðü™ªÖî—(«%PØ‹iz$W¨Ìœ ¿O°èäÃ¥%뜡!²*Ä7’C÷îëD38Þ±ph4¯US\™”éóQó¢ndZÎY0àö,몊8ÓãЯ:ˆ'?2ñåny7óËC“nuÙ%ržh\K0×Ô.©­µ©õª&7å»ö,~ß|2¤w4„ï´Ú° ¹Õ¶#¦Á/] ²&×™—t•¾ ÐÿxT-¨91äü=­‡ú†÷^%¡KzM1Ö…¤»m?«„k"Éš—2vTxÌÄJýë•aÇbãÁñ¤TS VSëâŽë”û4óéã÷ï{Å^Â+Zî/M ©3æW»+XPtå×Gˆ¾|2£-H‹í“¤á¤|†ˆ·€z#»"o½OM:dbaØHˆV®tÛèÛüRÜ_àToš× sç1[—ŠÆ¼ß—xÅ5åàõ}ÿ}pêCzfv1+ù’gžïsô6·\š‹³t_ßíD¤^t×èÜÌ%7=ñ…=aV ¡?4¡â}|?h‡øÚÝíiƒ,óˆؼôî.×=,ÉÿY:÷œò~sp³H5…±¢ ‰¸…êj=§£Aÿ )óz endstream endobj 154 0 obj << /Length1 1615 /Length2 10246 /Length3 0 /Length 11297 /Filter /FlateDecode >> stream xÚ´Pœ[-Œ{°àÚ¸Ó¸»»{ph ƒÓkÐà ,Á5¸;Á-Hp î îú¸23wæÿ«Þ«®úú¬í{Ÿµ•†6›¤µ³%HÎÙ ÊÆÉÎ!VÕQääppp³spp¡ÑÑ逡 ÉÑèô@n°³“Ð?,¤Ý@ЙŒôÅPÕÙ  äîàäpò qò qp¸88ÿeèì&±ð[TÙJÎN ´³‹·ØÖú’ç_G£€SPŸõOw€¤#È leáPµ€Ú_2ZY8´­À ¨÷…`±ƒB]„€@OOOv G»³›­+À µh 75à–jŽ ¿[cG£èØ!)´m žn À‹Àlr‚¼¸¸;YƒÜ/ÙÚŠ*uÓ_Æ*°þ€“óßáþöþ#ØéOg ++gG 'o°“-Àì¨Ë©°C½ ¬ 'ë? - Î/þ` ˃?K·ÈIj,^:ü»?ˆ•Ø a‡€þèøG˜—1Ë:YK;;:‚œ ´?ê“»¬^æî üûríœ=|ÿ…lÀNÖ6´aíîÔu»ºƒeþ¶y¡ýGf ‚x988¸ WÈËÊøGoПJÎ?Ä/=øûº8»l^Úùƒm@/h¾ êæò÷ý§â¿''ÀlX‚lÁNhÿ‰þ"Ùü…_îß ìxÃñB?NÇ¿ŸL^fíìäàýó?¯¨¨¦!­&ËòwËÿVJI9{|Ù¸yl\¼NN.ÿËÁÿ¿ãhX€ÿ®ã¾ŠN6ÎÁ¿Ê}™Ó¿Jöø›Œ/à¿c©9¿0`üÑ9x9¬^>œÿÏtÿÓåÿåDù¿ý+’swpøSÏø—ÁÿGoávðþÛâ…¹îЗ-Pu~Ù§ÿ5Õýµºª k°»ãÿj¡/Û édûÂh6Nvž¿ä`ˆØ d­†ZÙýÅš¿äºì›Ø ¤á ÿñ¼xqpüîeɬì_^È 5ÿT^vè¿óÊ:Y9[ÿ±l\¼| 77 o´—»~A¼_Η­´yýIfÝÉúâxéÑ`ãì†öÇÅò €jˆþB‚ ú¿‘¨õÄ jÿ ò€ÿF¼/Q¬œ^šø—„ó…´@Ð? /þ|q·ÿ|ñwø|)Ãñ?ð…ÔÀD~Y# ó?àK•.ÿ€< Û? ý|Éëþ'ü¯)Z¹»¹½<)ÒýeÄÿ¾_ È maÖÙJ8ômMhÛM•$©'ÛöÏ«þ³¨ ý-Yb]Í`i‘Ûsî¼èyÉ®éèÛ5ÜC®âçF{{ÓU¿´h!‚…º6DËMV¿ \Ñ»CˆŠ;׎rg§‘9·“µ-Áq“Ö ç…Ä!«ëéöLæ¾¼}SÅu¹Ý12CÃ/v ¸±Øhd"n ¸ÐvÉÌö ©jÉ©éEZÈ™ÄØïDr¹ýÛ´¾.ÞþÅRVXðzéÁÁ+å‹Ì±O{Ý|$Êæ€)º­nY¢ûŒÁm¡ï-!£Úâ4ÂYŠ[g g[±ŠZ¶M kð}©ðÒk¨OÖP%¿xY2l˜ 3wÊ·D-$ëøpó2”v—•É¿•CEïG•›üZÃþGÙO¥zh2ÁT’œ5•VÀ:’ñºACûÜwŽsÒ u$:Ä-Ì*ÕN¾¨ó9ù휃ÙJð8´Z7¿­KŽ +êôžâ&X/ŸÌoühT^œƒŸ:zlc6â&aªˆz¬ï²g9Ïû{õG¢Íäß÷΢uG~®¶ÀðP¡v±€×¾Ka+."ʵÝmˆð‡žµ®KøÓ'—LN]f™G*¢…ø-åBp&Á6SÍ›d#&Ï¡µ"pï‰|ªŸ3R²NôSŸÃÈu«Gm>F¡—ùç¸ÆšZ±†I|Mö}_;Â×p¼*¥¤ÝYSÚ[ëqI›T{®¥¦=­QAËM§ü¢· ùQüfe… æ¬ì+7_©{>lñȘ¹?n{@^MÌEùf^ŠàeçvO5ÍwUÑbdvKܳ©Á²M’ÀÖWòS‡%¿¶ÞåLS+Sæ‘â.Þ})MX(¦«Õ2wìhf/ýf†Çî•ç!AÂÆÃ%æ0b¤ÛŸ1ð aÖÄj <-8U Ú<é “°÷YPò üà…ó @VMóÙUèGïÔYÇJ¾|[˜,DØ{O¾žŽdŠ6£bW^Qx¯%ðÇ&M"oâÑwì²Jj4Ü`i]žüRó ª®oNìîIÛ`GizQ[‰Ä$.®¨Ù•GÑq›/FÈ”o¯±DĹ.:až^ÔggªÂ´À`xYW¹»õ¢Óv¨Yhyg0ýØ“´®âÌçåß”á{Ï“© Bèø‰\éP˜Eç.è¿`¡ø$ä)qËIÒJ|°ÏŽûA¹vþÃWfòÙö¼÷]0×ÈÕ@¡ˆñ}$Ýj¢Ó¸>c¯»"Á*ýŸÖyЍù6úUmÐ2“Ô[ÄŽn.ÊK8˳ý’ψz˜põ“ÚAê—%õ¯öè“Ì÷íÖ ò’Ôµ›t»Xû¿§ROÚµŠ<×ÇéñóãVØÑd'Ó¦!ëŒGå@1T¤a)l³¦[´´¹s—üU­üÍ»ÏR>æ?¾K“/©4ÚM:¹™ÌzÕ ÒÀf ßúœè£½ý²Õ‹þj óʺdBoݤ¢¡$ϰX섹(&g,nÄÎ\È–TÓ6=ת¶–2(HÝLS+Ã|J;PÚ–‰»áímœ(T‡É—Åöõ¦þ¥)éy<,g“°Î¦¶¤çÁ4ðññ ʼnka»Ñp5^ÂÀ†¡âıœ›üîèö ø^³z8ßûíIOÔC“P `tlk=°tvÃAÄ»+L~NÐÙ,üv~S)ä‰åf¾Ù9‹*z·´ˆÉ;ÝTä5ÊäÁ—çiS[5=¡ÓƒPôå;Æ|¼;ÊÉ·´ìn?¾–^"ûqcí¶…Óe˜ãÓÍô]†Ä”š’ñ~¥Ô;¡D¼´réR‘ %‚VðPð’!+“ÝÜL?¸Zäé|j<ôÿ9Ы±4¢Èð¤%k·Ü2OAÖëDår”çníŒqpU`ÈO‹‚㺻ÄLéD©Y”TwH å*TæÓ$Þ!a¼i%I‡tQ:çb Â´ÜË@Ïî÷-¶”ɃÆS…ü°Ûª &6¿[‘ lÎòØîäÆüæ=†tIÎ3¢pÍþd¬* ד@?}»µähš:e­'…òÆb'_ɧ¶I!‰#Þ=k ?¨zB»qÉ9hhŽÌ`ËÄ‹7\º/d\l‡õÅ0ÉM¾*¹Ù X=ãÖck•µWgQoëSZ±êL<þ‰V⽉zî×/Z» ²u§úvu½0óßÛ}Lä°ñçs:}–j÷vTÆü¨¥e«<ý¥v2ûÚ ö+8*¸é]Î=Âx4…Ü”?y¶_°8IOxt^ÍBa>× ¥ZÔ²¾ò¦4F&6$8jW@¶k¾ŒWZt½iûØíR(ê4,Ž$ÃxŠñqKT¬+pÒ12vÁ'G÷á=*.I>æsÖZ. õo,¼s›À¢/|9”tLZtÖ+ oK²Cø(ñ3ê]QFd5Ù¤)_}‡¤(7N?˼+?«7þ,ªÅM8„g-Fe¸4w(تú^³i,¨7c]»^‹²ÒÍò$µ» ‡_y«OL¢xz¼L¦xé’%yYôÚŽ¹¹ÐêXÕ³‡Czve†•_…£k_¬Ï5+O¿ µ/d±Ó¡-1Ó±-R9œopD¸°ò?6­›ò~¨fþšÃU½üûàb”mþ&€¿œ°ÏûòÝ÷·ò"zÍä9Ž7“’ª&Ÿmf vļL(¢ÁÍ7i;'NºbwÇïr—醛'»tÄ?‡¤}gÇ{eÁ©‚À^çÙ0 ¶û©P^ö´M#Ëfn+JBˆ\a³Â„¦“X#+xAÊPt—Å q—#µEŸâMû,ý_‡It1!oèÖL;›³8þr®²ÕÕwƒ×.h'tø–Œš)³mE!`OÆ~säð»²ËÏÁç#FI-°ìf9]˜!‘KÃDuÝézªzúÍÁ¸Wúa>hM(/y=&“Ám ì†?Ë Ú‘)J¢áÜËFޝá^LÅ,(Ì%K¾éåÈåMv¢l) ò(‹g¦²¼B‚}pi`á‚ X;ïtbVnNŸ|¿¦ÄUðÃÛ„óe†”ÃÀ±» c\|€«Ú"‹gÛµÚß¿'Çâ|à–Ä=KPSÂŒ…(“ºkÁ«Pf#ÎbôIMóÀn#Äj8bgõÚE‚¶ž:ß”[ 7ý¼UÓ*q mE¡ãP&Y;`ßl‹ûe)Ы“›&íŪïþ[Ž­£?ƒ÷{ï| Î…i°².Žâ’Osñ—…-›ÛõÈ.L'CIšØSžžkز€XFÄ ërBaìºÞcz*ø ]Ì •'üŒˆ´oš~jâÑ¡Ë}6äšÓÜýd¿f”`IÁuxÒì¨ð6’Óßõ±µÌLƒ‹ÀoÅBàWÁPÀû‘Qûõ+çÛB³ÃÝì_d¢¢Û8ø±¨çiÓ#Îc±ÏˆV—¾ Üèò¾i6›Â<@ÿ6É´Bu^¿z~l✎Ŷl„{%S(øHè?"g?ÛYÎqmµÛ¸å”«µÒ¥xõޥά->êÃë J¬Õ¶v={]€£ž_if)éñŭ秉9Cxé¹NOs ÚôÇiŸ:U5…4ÆÛF»ŒºÆ< ¯Zço›DÇž×ÌT’% ®K={Ô~4!…úË-[£4Ž:òŒØ9£k±P-¶êÉ<æ‘ZZR*³àgdp¹þ,³±ÁÑ Ž ÅþfŽˆ@æ´‡§‚5ç Œ gðŒÝEGùjʬÿ:7É¢¦¸ ó}¤sÃé}Ô:9fr–Ã1S=èõ~Ë|]Øu‡íS^Æ{ôÇçЃªÛºWA 6=⮵ž­‘йLå\£™{èõ%=â$\6« Ì#Ó†á'VŸO·}>ѱˆÈ;…•tœTÉù0Ù UµáúÔ.îã€$Ç -7ÎâÕM·‡‡ª×ÒŒè¦Y¯  ëÏZ¦…áÑß•¡¸Ç¾3X¶Rµ÷Ô3«E×Ç267Tk«¢~Ñ %šshð›B§‰Œ¨o¢zŠåqb!oÓ†íË4ÐmÉ6'Dµ¢H³XçWÌLta(²¾%ûP&bè³Òê•L â¼ý~´d´ZÿŒMþøšw£cµ±:3¢é:Zñ{!퇼½ÕØÕú‘o~ª_‘VË-Ü£ ,6úa¿ ž‡´¤Ým?#oŽ· ˜À¡¤€€óçÈM>fUé`ddŽö°ú †¤‡¸xtjRöjë ÜfóG={ˆ¨ƒ‡åÏñdŠÈø™—U˜úwzíÚw`]ÉØc½<–˜©ÚAÿŒ¶Kùˇ½,¨ŠV?€å7Óš3vt–©¬ùUciãþ²¢Gîéÿq Žr[- ¤5GÆ'› rÚ‡XüÔpÀÃòm?°£#r[HLÒ)ÐåN8»ÐDoð7=T°’³¤Ç*¡&ìY†þt]2Mü娪Ôg°mªh`üÀ4s¿bŸ`%ê3pri±u«`>cNK˜rÅÓ‹s‡…6½†«° oš d€¢è?ë?N?쎹“ñ2[öÁ# >¨m ÁÇÖÑOWú/6Òd1£,£Íòß…‹îFýîê¥ ¸2ƒ¦Gô º¨<%S‘Ú1訊HhO‡ÆV´ÛkØ—5‹‰—í—‡¶u`¸‚”õë»ÊƯÄVÉciS§†¢ææW«h«½âí–ýÉÙOE3' òšÿž8m[Œd¦V1« ×ôúrYˆ$§8«13qÉXWò¡3ÑZDÂŒp¸n¥âm]/TX5ûç¯ô NÕñ8¥ÜÿÔ®ô~n¾ÚäÐìøm¯Ge¤(çjݪPµq2Û^,AA±_!3«¬6»?0<æã-+œÐ)Œ£ØD&ššábP‡­ÃÎò~`”øË¥Ó‹<Ú4¸#]w§Þü&¼væuÅÔÍ«³0¶·¢"'kµ\*<ý¦ð3ENp¦±kxÜa]'eŸ6® E¼½­·t#r½!nµ·MûÖëq7 +VHs~3XŸçÚÒ¾€Ô¿Í§tˆŠËm®QeÌó£i=À˜¬Ý=!µÝƒ45Uø_/´žI\–`rL& °>&ÌvÜ(ôüº”¤ÛÿÕÄá±Âù&n ¼^åáü+­Çy*{¬?öPËy/’Bà6¶òA|ËU×½xºZ6É g‘ ³K•‹$ùÍUi¡rq‹Õéš4®-/ç7q©ßîVÿþ¥~"öÿ¸n@{ù¥Ù7D­c†Aó3¸eÙ¯î ý¹ Ç*ýãÖψ‹ögPsËÑ™Ûy`‹9˾³‘s7Œ¼?·mÏøâÇèêtY»Ÿj>ÏDi¦ßÅ ßÛÒŠ-»!cKÞH…ùh7‚–Sü/CuÕQz³åųá'¿ª =ïÎ"9h8V¾Ãi@:^*u‘pbõì&ã™%ø)‚êóR˨Ï"ÜQ6°à¢¹CC‰ƒw‡z26<ÌÒø#ú^×ÔmŽìÍm`еö/†¿¾a•ûétîmb£`öh*¬†é­ ›€\¡¡f¢˜y†6!³—Œ•tQg€=#½>'“û`xK_¬`H[úEOt•£c7¶¦ Wo&ó¿¶ÿ–˜”¿•õ¬|¨ÍyÖþiKÉB°ÞgE¿ ’7’4n-S…ˆb p‡›il½”•ð¶#‰Ûk™Îé‘ÁÓ¨¬^tW騅g¼¢ÈëÆWà›°•0\âÝJf!™ì|ÜhškL䪫E°À|ˆ¬Â»ªbÅtM‘êN\†“9ŒlÞçQ“*uG9ëÚô†bMø˜¸|m,J¢.ˆKaïM˜¬œ.;,¿qX¡ÏÜÅ#ÁÔ ˆ×÷”¢Ê»H¸¾w2é`Qäõ44Qðx½\Ó.¬K=ð‰ò"d-F˜èÛ2"nó ÏYFøø ó R泌¯QÖ/]¾xgºï+¢U7€Ïô­µC!8îþe®ªà®bVÍ*¹Jq­yG‹LÄΛeðÉögqo ï‡C˯ ]B•ñú8š×ùXáºËl| ¥ý…æE‚Úþdè •¾ ±gÿQ££¤Úh[ÊúÅf3ü£ÑŒá¤Ê’úiaþµ·ÒWÍD&². Xx.Zƒ6;iTuŠ*„ bÌÌ#ÊçZI§7H“áB]ãùÇùöɶ¯vœ\)Sß—¡ÙIñך¾mÞ_$󊙳®Qüš ÆãŒñóbC]©øä:ÿªöi7Ö-uzJ>R(|@€Â¾ù‰K<‚H' áˆõN³ÐpU±ù~?´VJvQ©ƒÞ­ÍÈ•`¸J]»_x:ÀUNÐj榰ÌÊ*•¸e6­ÃZe ß’£?e¤':ý§]ŸÑÜIVžRÑ@ŒyZ¾].~xÓWXšä heàÀaÍœàËM£ßÈ•uL=w"Fˆe×’ß|þ.ª) …èËßçJÓ'÷CSN­F.™T¼ƒ÷úPwOu‹Ÿ7€ñ ]õ»äeÚ´påõü@”?¦åó&÷«Ž\ ×Rü{“éëâe„+ðUIÊÏèLN|­¾ùKã8Q_JÅYüǦ=J[ÊÉà·>-x– ?EËPß»1 Ùœ÷Á&¼!oœX3üL(*¥³Y Û¤f`õ†¨™Õ‚ Œ¦†Rm“*2›×‰?,}@Î*Ð’F—mý|vΤ2#+³ˆÝ½üã˜D[{ Æ™ªn‰ZjœŽ¬# \¸¿¸‚ Nö]öuQF_5@ËÄ¥ k5lä‹®ÒGP—Ù-~§0JSͯÂÊX~»D!Í@’-ñ"YxK÷»iÒðw_÷±²þcçYFìϔݠ¡=T¢#›]0÷ìÖS¤GƒÎf¥ è÷”ìÏ…Sé®k?jUÜÛSNLCÇ„¬ðí\ø«ÐÁ±´£BqC=·Lë×\ÒnÇÄgÌqÆ{ÄißÞÅjâwD¦“0[ŸqÄ0¦ä:¬zÕdð¥O~ÎÂ)÷!‰“'›¡ ÉD5ïáÆ+p$ù’’”TíHSe¯å] >Og_mf› ·’l¹“¡fôèm5Æ›Á©ÙYb™ÏD‰O6¥ž¤–&b~æÏdé£Cr]ùë™Åé,ß-Ÿ‰l‚6—øR¡“@^ÂIg+S—˜vÊåè«zü·j—æ–.äÏýo£BN¹õwº´îÅ.žd³1-Ãl0‡Œ™|Í[ëulðaûV¯Þ1: |Fû< ‘Â?AiºO¶nLö—Ë(-0"=öV'Œƒ8Ds¶ÝÁœÇ L¿âÊTn4¼26PxCáÚFk Ðá}6Ußd¨†eP"Š9bC"VvNË>íæ-‘IQ»™ ==ˆQijKMOðF  W|4"Šï(°KO^ &V ÑI6HÚúhZP'Ýñ9¨*Pé䢪Ûѵ¨;•ÕaÌŸ³R3íò(ÀË´[|¸Y˜ÙˆÞˆ§ÈÑS§è¿¬¨ìª6;•g»ˆŠGê=öŽ þð‘5‰æÂÂSœZë ¢XÝlÝP È*ÐúÚÿ`c[Éùs£î$âäm¹ Ü·N゘"Û”s~[3<ÜÑÒümåT¹©ý_vPªyÚÍF3,2k9[ó²ŸÈCƒø½%½ü`}Šs&Ý7?/5…±…³ùûh—ü^·cG'Ó%×£Û¨•b­OÌÃÈ»§¼‡ÆÐ@ßP’ØÃRá]þ^òõ›>Ëc¨8±m¤Ü}Ð@`¢`‰r*5Êû­ß7rŽPøìÛÁ ed‘m[S|´ŒrŒÜ…$º>jc¼‘`ØÞâEáCz–>¡Å„,Ïÿäîú&5ßj\̦’mj¢5Þn'öUóÑÝÕ}ê¬ÃN 6ë#ðì×-5厹Z*Rxœðù­ÿ/Uµ9÷ÙBìTÁ&ŸèbaôJÜc𰢋 þƒ¯øúPÛhõ=7?A:È¥TêJ4‚£Xp!w6&+1]göã½uä¾BǪç_•vÊ Àúî8hçæ¨Î¤ÞY¦¿úuèÇ Û9Í™´ Y‰Z•>´ö:}£¬Þ»Kæ¹¾ßAu ‡,’¨…«6þ½2³<Ôˆoƒý©qzDÕ/¤.ЮTÁ!f,Ñ;Ì ÁÎ\”ÇWwÞFrþŠ”=Ñ5dSU­ˆÔ§æ@.#!u¸ø÷#¬Ç°k×e7Ãúgx>sdên=MpÞåE8C3W3ã:eˆ? ¬¬ÄïÄ @¤Àâ`Ÿꌒ¤{%ذÍq‰ëùh½Û± ‹û&žOü>Ñ‚Œî§tØv±YÃÆÄ‹ãƒ¦_LŒýðb¬«v¾Ô¤±íþTÓ]#ÅjBEO± ^Ë<9+˜KáZ÷ºhÀâÆ}Þ£ŸÿZ ¥¬¾@ùeéÖBýìGg‡¹Zõ<.°Y\ûŠñ“ucûç×¼M_;‚ÓÈ_ñÊYÏûŸ)\•ÚFaK 6> ¤öè—ý0±Õ%ö(á‡9ÃqÎoíQ½\»/xe§/ŒèÉeŒ©(ŸüèùºwÙqGˆ¡*ÔBä°{Nî“wØv×ífñ‚+$ÐnZ'qš+Õ9ïÄhÉ…þwØüoŬ¬=æÙ¤7Y•î¤f¼žb!ü-ñÏuÅMôˆ×yty9cŽæÈ<—i‚4ꈓÌ#! z¹ùŽ!£^=³h&%ío»DK£È­óï £ëð„Râ7Tof¿M¸”n~+p6ã7mPZ#Ëf—Y•îVçûRPÅ=œVvi o¼q\£àlÔê>í‡ÝYä’Fú%¸!jßà3ûÃ:œƒ“'EL{˜MjðVË1Ü ¥½õ¨Õu±D& ¹î!%~‡ÓÊ5÷Âð¡9V5z”M'YRÚ+ðZ"*oAM‡uŽŒ,ŠÅ4y#ðÅÇÉÅp€'7Z,Ys¥ëÚËôõ¯ jÿæ£Oxf7½|½çÆ¥¶ñOƒþª¸m=y±EX&¬õ&)„ðú,^ϼÒ(,„{‰«È,&urÛ|¼I4AØñ”ÊÅ\ª[£2_¶Ü1+…Î6y§÷x¢äWùTó™ò~Ó KkP5³¿3<`ëÓñ‹{?­JéEŠBwf×…*#Kpn§¥gìgµžC‰ºv*“# +=âw {ôÀn ÂЭÌ>(í]ש_þ¡â4.µËâY£ñ혶²8÷1Ëé|=÷}Ñv½YŸ5×xi¢‡Ï)Þ çæ‡[’SáµÈ¨åœS'Ê=óż£$’ ¾H×1‡õ=Tí |œ©ªh—N(›Ü[èaW}½æzÈXYRVOõú]zÆ'¨×›Û¼ÈûÝY øœtÅ!­wxÄ+2ó$»{å§}غa}Ô¯¨‘5à~Ñ“2›b,k(xº»^kнAE3DN¬°¾¢‘•¿?+i¼EœíÄê>,¯ Yâ)ܧ‹ <¬ÅÎgÙ@e2¼˜$9’Ø}«±3ʌ‡ф…f¡vF »85fð[‡I’7|”§ªYÊ"!eÖ-òèË’åãß`.%/$¶Ï™›örW¥ö  ª2uYõÃoÒ+C¤É89w¹wcò©ícU­º¸ý™+[@ÌL<_û=æfí²íï«´¹¥>G fi%Ç$0]ó†¿jõëN¥Ä!öuO>ɹô,üŒ`LiX¸ÌôHXQ ÕâÔÅ{;9޲ó>s(·ŸâŸÕVùHfÊyvboâ%?Ì(XÛ¥Òð\Èü}G>Ç¡ºŽ¡ÑT Ú·màe+Ÿ|DA••v@gpd,ªH•ºÏÞ¥9À9ˆZ‰q”n²5 ¹œ×œJ¤O%QNÇÏT_qö¡§P»#Õ?•úšIcÚ½P÷ €!îan&j¦?éãÃȰLÙ††ðÛŽM5K*G·DVÉÞR‹OQÓõ©áì“¡ªS!ÏÄÂÜ0{ÊYOtfîBôº·¶ÄN385xÛ‡B: öH—í Uá6©nr![mˆ˜«YÃ)œm94/Òȵqz_uÚ¯ýԳɚ©²€¼¢\Øû“é£U¾ 'FK;ÛÍLL½†ÑkÞ3cæÐ6p“ê¾dÜî¨W·«Q1V‘}\dêk~m8žõvÓvYÊk{0ÞL¼Ÿ@P¿?¯èð žêç*k¯ØäΘe};þäÍÚŽ ‹¬ÈF_=¥Ž~Ož~—É„ÁœOfñh$™Ø!GpFon•Á¤šÆ­#·?“’E'!V[±Vò—¸™²ÉiVEžòú…/ä!;ð=]eÚ]*Ì<¤†FÏòñ /` ¿lg+™á ð]´£Ï8X𸸧ÈÚÇqCˆ6&áµFPp]ñûÒöc¯£IÃt`g½’‡«b_£ÿ.óå9›ßËÒÏ}MâEЋ¾ñùkÖÆA?\ `}ÖN»„‚<­ªÇÕ—A£ƒ.U¥ì‘¯OÌŽÁÝÖˆ?áPû@¶õ4-=ÒÔfÓÒ·wŠQ“Ã$ì[q¦¦* ?¬á—Â!€C²Ïõûl$…íg õËL³Ús±T†Œ }ȽF‹…¥¥l¾oýç"$®HšÛÛ¥n/Ýaº/϶wóáU¬w3^ cNžŠ€²‹h¸ˆÏ}•\†;úå(Ç8jeØÆ<ûooa°£hÇåd¥‰-¸#=¾¶\Â|ƒ¼& ½+nöJç—–GxD± ƒãF‚ªE¹%ºŽ£‹öÕ(4µEžóxàÙ™ØËf³ ³cUÜÄpÒU3Í›ÖÇxþÁnÜËPèìøª¨øH ëˆÈlÍÐ?v†ŸÒZj$¹]F:mñž;£~Ÿíä&áǘÏuÆ™ öcy*Øéí-S»ôt’ËaÐ [¼4‡’0(\V ›Ï‘'¡Þ›"´y_URÒàS8Óïl-°Ä‹èÆxEL·#^STœÖŠÝSpô­q-µ(VÄû¨÷=RœdÞ@Ú)E À¤¸«w£Bµ™/?M8%‘êäê!‚ó¥ži?«Tu ùµuŽÖix^TÈÔÈÏŒaqèøåô•ŒÙ"ÌÃïÓ‰ÁÐwp ÈòÄ6õr4µÀ‰Lk±Ž}mo4YT¦Y ùôÆ^ñ!BcÿÓGÛßIVÎ_×f0cBDz!±Ÿ½>{,_Ðme«tm`ã§åmœGÓo#ï#Ï”YWúHJ+|éŒ\·­³²GÊ•×ï*—ÄV¹½,y\‰‰_õ Mê{¢ DÓ( ðûuCï[Û?ä;uKRò‹@•¶Þax«SŽ$HE¦Ìà«~ÌY…ÿAÓ»ë”ÈZâŽ~j_to¼î ¥=uæ°DÊÇDe}ÎɰèeAn,B¦A­àË”¡\iF‰BÚ09ÑjLÉJ¬ïÈy¥±Èz®¬ ݽÒwE«ár”¦áÛYüùÇEC¦!ž’Ó-³³EÞ)re"w˜é£4 ;­…¼ä2Î5Ú?»æŒËV„fÚ†oÌåä?=g“žàªÁx*NÂhÎüi¥%³x™tý¼²êe‹”«4¢> stream xÚŒ÷P\kÓ cÁ-hÀ„àîNpwwg€ÁÝ݃»{pw'¸[‚»»ës^Éy¿ÿ¯º·¨fµ­î~ºŸ=›ì“‚2 ‰­PÌÖÆ‰Ž‰ž‘ ,«¢ÂÄ`dd¡gddF$#S9Yÿ#G$S:8‚lm¸ÿa!ì4tËD À†²¶6)g+ €‰›‰ƒ›‘ÀÌÈÈõC[n€ˆ¡ È K²µ:"’ ÛÚ¹;€ÌÌÀ<ÿù  4¦0qqqÐþí´:€Œ m²†Næ@k0£±¡@ÙÖtrÿŸ”¼æNNvÜ ®®®ô†ÖŽô¶f_¨h® 's€Ðèà4üU2@ÎÐøïÒèÉ*æ Ç)”mM\ €°À d ´q»8Û˜`v€²¤ @Þhó/c™ÐþÝ=ÓÃýÛû¯@ ›¿ m­í mÜA6fS /&CïäæD 0´1ùËÐÐÊÑìoèb²24üº!@LP`®ðßõ9;€ìœéAVÕÈðWp›EmL„m­­6NŽˆå'rƒûîÎðïõ´±uµñü2Ù˜˜þU†‰³ƒª ÈÞ()òo°ñÌ è`cddädaí@7cs†¿TÜí€+™þƒkðö´³µ˜‚ËzƒLàˆžŽ†.@€“ƒ3ÐÛóŸŠÿEˆLL±Àh²Aü,šþ ƒÏßäÐf€ñ¯¿ÿ~ÓO˜‰­•ûó¿˜AZYXD\Žæß%ÿW)$dëð¤cÐ1³°ØX8ì\ìïÿ¢`úwÿð”´1µpý+Yp—þ“°Ë¿'€òßëAøßXr¶à¹(ÿŒ¹#£1øƒéÿó°ÿíòÿoÆÿŠòÿ:æÿ7#1g+«¿õ”ÿ2øÿÑZƒ¬Üÿmž[g'ðÈÚ‚7Áæÿšªÿµ¸²@³õÿÕJ:‚wAÐÆÌê¿9ŠÜ€& 'có¿gã_bÕ¿öÌ dT°uýu³è˜ÿ¼\Æ–àÛÃ<’«€àÝù_FQc[“¿–Œ™`èà`èŽÈž$f66€'xM€n1€ÞÆÖ ìWç 0µu@üëHÙÙ ‚‰þ…Ø B€Aøâ0ˆüA\Ñÿ"FƒØÄ`ÿƒ˜  €Aò³KÿA`v™?Ì.ûÙåþ 0»ü'˜]áó)ýA`>å?ˆÀ òÙUÿ 0»ÚfWÿƒÀ|šÿE\`áÎÌè³[:Z:šÿWÊÄ NÃÈÁÐh4uú‡˜íßâ­Éƒ0ýKl tú{.–ÿÊÿ8?ãÿ"6pFƶVà‘ú„•õ/‰µõŸ¬ÿš5“@0%ðOp/€ÿÃÀþ—ÞÞ¼ \À¥šþqçf rùGŒ¿Ô¶Îÿp›˜ý‰Ö›ýõ°þӜ蟶±‚Ûcîng´ù‡Xúgjñ>Ë@p'þdÌ.Ùê¯eú£÷Íúßš ÿ ßÓ ¶’Û‚ŸäÿPƒ °û£ûÚ¦6ÿsb¬Lÿ–þïy±‚³¶ºíŸ`7ÇÎÊùÉ1{ñÖ0 ÿ£egã´ýï9³]ÁÏÿ·ãÿL"˜úO"à™ÁÉÜøc×áäjûp ç?“Îâƶÿl¸Ó.ÿ€àô\ÿ1çà nÿ€`V÷?I‚]=€ÿ¢üŸËÍØÙÜ:§¿Ÿ?à›ï?øïŸ@ Ðñ×¼­1OE]PÇ} +ÝÎ$ß ÙŽz*ç/‡NçGT¸$ªêÌ€5‡[Á¤‘^ôå-QÊ%âϣָжÅö'¯gý8¥évÄÅ8ƒSG‚õéTv½^ì½Ôü-¡[!»¤Èrí9Qò1ï]ûÅÝêÊ~‡Ìï(îV³K#=—ý¤‹RÔñ/ž%Ë3Êšû@ëD÷žãÜ möæv#gêX*ŽÑû8Š¥ÐSk9úaÎc¥B…Ù±OëÃGèŒñirO¡ýd)ÜÏ’¢È5¾…lF*zˆµñb¯±®O'ÜÚ2’¸ŒV¿¸ÄÇI½Ûëü5ú2w” ì¨ëìŽP>ИººŠ‰çË·õëí‡"Ü…9ИȺÄÀɹ{înü‚¹Ñ<º‘>:©›ÒöÕ6ÝD@ÜÄ^nZy µ÷Æ’…%¼Þåìö*°È(%­õ쳘:¶›qÛuSî,=uFE„+HJCCÇ,Hoâ ‰»©ÅdÕA¨æj7‚@Ðé¡ÒÁ[SýMo±ûÊz’7®•Ê)ýäáêJØèn•8U$Éf„ÑLlaw¢…]…šN›À‘S0?R&]Ë}ÿY@ê·I•Àt»Ø1ä„lèÞ]~YÞ“ÉûÏf4uG|Íû_ŽÂafµ²B }[šSÔ Ãån°Â%Ø4–¶xµê ö òB qD' µÇ&És£$‘zY÷çînQ"·a“Ñ>˜ÛYš6‡ÉiWf’á=Œ^V‹õò›)¥I—Öë~ˆåUžQhé~C‹©(ä»)ÛÔ'ìKø¥[óÙ'u\k¦GkÑ}Ôm¸:².´vÈ_\D;næ"ƒ£q§mއ„‹°=XÁûÁû{ÜZWß´áͼ½þËdTîÒ˜qãŠÍn”Þáý kÌÈŒló µ›uËήfU Öø—ãez‡ÌŠX;SOF‘n/vò½œƒ,ÝC†êïæ^S?èï‹•aVGj¤g¡­3­nõ–ÉÕ—ýp#V†<‰šóÏ_¬ÅúñWÎÊ?f5¤t,Í¥°ÄŠIûHâ„rà¨p.Ë>É+ †ÓóD¯ÄFJŒÒ€B4j³y¼ëâï³±v-45nDœË‰;¾± µÛýŽ’ì(ÚÈ Wà<—ærØ)vF±2CJ¤Íαž;k£¸jvö%§gïd1wh;ýø92š¼ô-²!“ßü:-¼Å(sã•ú×G(R?D“ÁBƒpR€B0rpÆWnt’€Ü‹RªèR/Õé³ÁÒ£HS\؇rL‘Ƨ{ôY“”Þâ\¾ŠŒL¶‰«_‚¦‚S ޲#À[ Î&æð{*<Èé°1ˆöaøªË?Äjïb[™D§~6¯ä  Lçûá2áõ}«ÓSâO¦ËJʺì-²Ç ‚ÓËüô EÍdæz·ÇÜÇÊP”›ÓÂÒ%P¾©SÃáñÛÐãpš‰ð€êk3ýzÚù•„¨[€&EÛpÙÝ![˜˜±/ŸÅwæÍÎ9Øyc¬ýXW&ä¨çûñ}?£IÝÐÌð÷–:îèñmÓù¼ÒåȄˢ§S³c².»¼'^б<%…giÌ\ݪkù«ò®20ƒ‚Säíblš`³žyj²{×›èN¬ÒOh®Äv&ª-îS&°'åT«(éè×ERle*¤¼ç´Xê×>à õaÿ§û)¶•ÌkÁÙaš\µ…Q•ÑoñÆ8Ä¡ XôTPs\Éñkj¶z+âtï””2Ê„ …aôªÙ^¸>_ žlÐð ‘î-Q Ä×qSªSìÒB‡B¼ ˆ—!ãÑ9Ä«ä…$Íáh‚ü`Ђ„h-³ KöÈÑ}'ËEI2œ/Úi®?–œ}y?­g@Ñ@™T9CköøIšMzs…âKÎûLÑu9ZnÙ}Ïpeqf%Tvœu~ºó9=( ¿ßû7¾b8ôöæ©}ïî4 r.Ÿ¬ ËJ\ÇÉU©ÚMTV^o¦ËrÕÂnëcI™ý4rý´™‚<ÞáØï?ªò3¢R¤Ú(`„[Ýþ“®/h0ϵ=Áàm¿ .’b§×`Ý\¶YE%F²ÜFâ+Ðj»)ÿ}çDüeô]_®ÆÊíü–ªßí €¢„È.l •’¦\“©u÷¶ük®j×tE ñüã;D2òcBÏ ÊÒÜôÂÇ  i®ü.7‰:L—MÑçYV7}6¢°˜Ü_mÏáéý´×ÙÅ&›VlFcF+ö´É·ôù„š}Î 99›;­~ñËwpöÎDÍCµó²‰P߯{ÌžfM ¡èálO|¨û;“16Ú¾£v±ìîÇ™Në¼mÑü¤!Ž)“Ï<ñ8Ên}4à¼GÎnóÆC÷¸ÌÄ€À(Ñû¹TLù´ÄÔå’# ©ñ¼(hûI æ*Ð’ïp1¨ÃJ6qM$ðZB—zó`hÎÜ— ø®EôõDÚ¢ìdgTÁztÌ úxX4dÓ»ªó<§ÙÒv#à ÉXZJ7zÂq™Â›™=ÓBZx•“wøýü€*;lHým–ôöëÇ.—ÏËM_Ž9T|'úšàÊ!(š¡°BmZäÐ~¤M2E¦ï©¯–¿Â•üzS[F.M•s†¥áz[Bcåxá.ŽF9Ýûº¶†RâÒÛNRé1º‰j+ß«ŸèUa¬õJè!T°(Ьå'H¼òýa]ÀðÐ-y‡Àˆ?vï É$väÛœfwðÙiæ<îו"3¡+Ì_Q\ª/b‡RÕü$Úvº½HKïFí&Í#{r'»ãK.BT¡8ý¦æ<òöV¿Ë„ð×û=B%à>sIGðTÝ<æ©¿‘k$ÝÀ.†rãpÙm5ˆé™¤ MÍK)QB²kÓ©PŸ°~ÊŒšvׄ0 m|¡„Fª„¯>•Å,WüŽÍ dˆnx›œð ·1¬ñÜ ½Y–w ZƒÒ£“i”»ÙûÉ_wÉb´ÉÁ¾÷BúµYÓPØ+•Ù¡u™ÌSqVÜ·må^¹ä»ðþØ(Ú0VB¹¥<:6ÁHŸÐUÍ´J…dò„øùjTv‚§ÝOA£s¤ñ¢G ²ë5éy?©Mš6‘d˜?#+ÁÿvËH(gjrøyÓkù·øTöêÊ™O›2¢Íà¬1sØZµ±Æ$,V.Ó'~îuì÷­É;è8NŸ‰úÖqøÉZ§ï’̂•»€Úé9À ˆ`oÀèš9UÊ£È12´Ýc0|Pÿ±|»Ë‡sA¬€Q BÄÈ­ÁxpÅÀá7¹C÷! ªäñ!,F ^ÌR«þ—÷ðþ(LʇÊ&ï®!>ìh’žPôVÞL÷Xà~ŽsÚ•ô^é^ C÷‡˜d•Š¥Ûy†…™Q¶D‚ <=%7bÏæYy&!}䨲;û®²ë/8¾_ô<Üh—<õâ'Œu26Ùm«šC[oò†W+œ$T–…_¦Iò¾‹½-Ù@À!sÄÇY“rB Èð-]#GŠ®aî)CuÁ†²´/¬h_ ŠØœ×ø¤ˆT.+$°!9K47šqlZ0Ly>×Òù£uÜ?Âg;½ýôVx>NtêÇÎ/–r«Oâ\žQ"ü½A«ã9jà¼ò¦F@ÜX|MvÐÊÒóÌÑ«3ç`"'EÜxø1u™ö’+ViYQ‡Tÿîò»¼EWJ'~ÕÚÒ.Mœ:î‡c©ìœZJUÙ}jòUÏ:\™Ô…¦ÚÅXgÃq7SÏ ¬Ég)&~LÙ†a~L’ £âqÅT³ﭦÆÍ?fr:«‘xͬ|¢ÎRâØ4«¥§øü•w.tL üôáØæ$מn–±.7Û"Æ-ÕWœwͶ}_ò"æOѽ)X­’~$îK¸Z~Ã)^.l«ÒIÌGœ‚º‡ç¨¨(¥¶!R)Ñê=ä]Ø­^êZ”A‡?$dFvC'9Läû¾íŽÙ«G„Æ]âU/Wâfs;â’Á¹Q“ÈòŽÃ¥º,lZpÉIê¼Kd‹2Ÿ[A£ÓIØ–!2šÅî¡­6“·¡àÄy.«¬ú„‹/:BÁóñ5˜ º’9êKwe¨5°Ú#,™©¸åx É›4òSù)L¢Hèj7i‘0g®ÁtWÏCqSòã]ƒ^‘=ïåÙ•ïc›x7R]?ÖpR‰€XÁ$…ƪ\…Ä“Ä^£ïâ &ÿ'?2Ö6y/' Ì¿ûØP¼³WÓÝ>ˆVfµ‡zSGð¶¾+¹ RfGÅyß=œöt}bôƒÒT1CO…]‚­õÆQÉS1L Ë)Ÿ‚2ÅΘ5Ë)jŸ}=×(Ò§qJdÊc¦œGõ\+¹?Û2\¨É+/ñP V+MQ^PÚ1¡&Þ³’;Á]Œ1´ -Å‚rítÖ(†þ@ȸö¥P¿ËºšaÍWñâºÞÙôz3ñ‚BA&¿}“ÓÞ¢ì" q4ú(}¦Ž&»)Ochúã‡üÍöRvr‰‰Â\óÖï¼ú8ê0®ÄȸC/¥^›xW)ËÍÄõzûê}ªÝ`õü¤7Wgñp{Ö55ƒEÆHî[I±øM›9ˆR–Ò׼߷ÆkŒmÛî‡í±Æs´;ƒŒw'¶¥ü\µ¼šz°Þ‘ kO€çH?Iî žêÖ¿òà³x Æyˆmh²ÞªÃ-*JŒ¦JmgPù¼a‘eiw½—çï»àÁÎQr ]k­dûÆO’­¾ãåÇ3W%É~•¨E¡c¾/ýpíè͉ç©(HåŠ/uè§± bqŽTÂ`Rɰg‹3ò"ò9zŒç=`~êæÀ3ôöÏIÃ/”ј•gß{b@§€2à&žš½è„jèjˆ+!jƒÄ¾à4‹”„$½§Mz—5p÷?,ÊÄå§2Ž_~·z•œþƱ!ô‰Sh´3Ú r„~Êö†h §qÎ9ÌQº9H™‚Q‹·ìcÇ¥¬^¶­(ÔÆüY" ¯F˜‰!PEÏgh½Ùáê÷u^kñV—(w3F®/Å $DLE':•ÀÉ É&deÇ÷#B’*Í‘s³.—¿€ûyÄJí–.V¤^• »cF{»óNDE7ˆiÛ-‰GŰú4‹½ŒÀs`د Öƒ’¡q`©Ñ]j¹Eµ¡Û96r/õÆÂPd»O„쎰ðuþתÄÆŸ$鎓ÊÂU»P|½?ÝG‘Ÿ´gŸfõx?Ñ1‘Ö°É$®Ê¾/I÷åg.Qò‚)Ôäs&†×)yšd tðçZÀÔ€YôZ“1u»Ð{Hš’Jìe1u“Yï)%Mç4#èæ€J—ô=c~}3YK6-Û~Û¬mÂ’œúÀŸ¦¹!Ð>¸k'â½_fŸ&ÂhsÐs+R·Ì,Gt¡D91›ù¡Ss Ãä ì`‹Ñö&7˜™AÐ%Nc” Úý[^<ÂEkº†ì[s7(Aê-´PÂáò8·_¿j”ìHé U¯™ÏÚ_`r"â¡¿œ"è¢îï’‘½«:ÛË0êJ,’•ÆK1ô4²•Îܵ™V ²m!p3ûxÉß3å§ôÝþ#ÿûórŠÇR´]HåÇy[Éy5~¸ßº y³áˆ(mý5­Fýc‹ªo¯‰lÕ%rœ®h²adp4¢Ü.‘ˆá£$AÐ-3eg¥¾ †En8Òc¥‡æ·œÆ×åŠÇwÕ9ЛRÜÆe,E¦ÌˆrñÜ,±<òè£.$¼¾8Ãõ‚ü\|]³¡†ñ3†=±eÇÚÛnɽevmœ³Š|?²þÎQÓ_§¡Ï×6:,!uº-e:¤oò™šé1ž~®öÜ.çåÍp9¾[nYÃ÷˜¿å}Dš€¸Hþñm‚kÜvõC£?I¦Q€SSÚh*©ûÁ²ù<µc€®zò‡ÞùŸ³_¾­l1Bg¿¿ñ%V(ŠoV§þ¨%<2˜.Ÿ}¨ìï‡pÄXà7gƒÛ09ßÝ»£TË6™tGçÍñ5~vç]O5n‹¤pUŒ'Ópkˆ`xêšÖ@ý6\žƒ|¥8<¾M*û1VGL>h‹mÍè½È‹Ü]1…«L/ ä-FIÒ„ºK½»ì¤‘©KFkÁ!9í\ˆ\UH útS‡¸v€iðI?6yB©B·[K¹$Ƈô´·£‚%ÚXJî¾w€¶7 ôðñË<Ì´nCÞž¤•K•»Âõ¯g“Èm"è§÷mÓ®Û<ÓæÆ…\ÉÕÈʜǞYq¨sYšR¬–ØŽ­ç¤4Né/¡»TATkÖä2ê㊳([2 T•õf·~Íþ! WqqM$ôaÝo¦€0tÑŒêMD´\ÙÑÛnÂê |ëŒThä²OE0]X,­nXý¼Ú€Óír˜Ó¯¹xG6±+ziŽm#Ü9z)²ž}\¢ ÍXÓ„PãœÓ+B[N¼KêŸêÕ#°Ä{÷¢ûïúèNÉ ¾L»}*B>1M<'{ý™Ö?t_ãÚû‹Åï8ì¨o¬žv±Kq~+²A½¯"¢ r,ç]l¹Q*.S*óYTýxŒ™ ù— ·cu6,.2³z+i XŒw1•½iü˜øm>ϧ­*Z™fàæÌ±ÑË’xÈMS1Õ9ά{š¦êÁÁòð°Cˆç.t‡4ª1ŽOã™a©XøZE•Šwa¼œq~VË·ZÿÖ†Úå0TÚjßiøeîËXbé:ƒ}\!8òÒþÙîaÍ$+æ¯C(™‘Joj.\}w죫þ-Ž_„$Í,Z¿=þÌø‚?QÝÂ(Øø#à3Aªû)|îËôZS²l,yè€{L §^´•÷§âÁçH,\"BÍË]Àë M©ÂŠï7Ó+O“¨ÿ¦ìZß놢ɣª€§}zÿÔ,,Û›¡  ©–FÑ+‰JFvéî[ô3W ù*_GZsIî‡{æ¤Î WÕ-3„O’ÃŒ >~Ì¥ÑH èzå¸ëêÂN«ªwAu©ö„͸ö'Vãq‡6Žnú¶ô?áÒr×ÃQPf‘a«Õ³1Ôé’é­Ô ’ª…Ì+¸Ü ¢Ñ¬UdãiÐØƒÆéyÉSr½Ì>(¤Ðñþ*s:Õ6ÐT0ÄL¬t4ôlFãÜ¥Téò„»¯Ãðy.&ÎŒB¼ÃŸ^ýE•²Tì 1dÙ8A°À)àœ037—-£.D?ú‚m2Óøµ1¸/|fitØ ¢”]žì'Ï0fÙš»¯Q®3¡@a˜!QŠy\~ç³éipÛöŸýƈÙüã„ÎtoÒ÷ùਅÙÙ„¼Ðoß™c™™ˆõ®±åë¶hT"äQüó´ço*MÝ.mw›ò”c¥üZ)÷¢^%â'‹¡ª}ÉicÎxW7ç]º9õùÝ™»¥R þ¹¯m(µ„¢,ѶÝõºd÷‹3zwÅëJ{¿‡2+wIé~[î‘Ç8<)׿@èg›6ú7™(Žô6î_ŸÝŸ9…öÝÊ)]B‡£‘L¹É%Ç­u«^ûÙ¯a¹ÎEN,Îy UEïßïe®p¼ÔØ3¹HëEïCóQ½ðˆÖ´%+0¡›|[ø(ö€ïà é6¯.z¶6>¤¬5³Ò»È¥ÎT‡Ó«õ|iãYæ’ÇW#Ê À'Kô½yy.ùΩ’n2D_I¥º4mE ÆBx\Ð"Â÷¯R_!’ê„k“¤ÏÀç¢BøZ>=˜ž®\,|ç’hòÖE¸ë¨KK&^‰„©ÊkÒ%Oö´áô*_òsbbKêõ ‡¤ª¸y=Ln±kÈ@’Ãz Øo'[GŸPxÞѸˆNä|“P÷^ž·Aô=.¿µ9‚ýF5禪äÚ¿«âŸÖÌ:P¦œç;{ÛÌ,ÀÊI0Ðþ6ÿJøñýûN¶±X•R”vÆ@¦ÍNÆkÂ-ißçy½”¬ÀøÞ¬9E/¢1”Eù†þ¦To´hìÝÄÕßZúþ€jÔ÷ûK}²R|¼Ä‹÷Aœ°þD}=±"7‹–Ýe•9¤½¯ñÔ‘}‘4 ŸBS²3»ãÕPû*÷#¶Ý †•#lfow}ÃõJ¯d±é讉&+˜;ù$ζoËw‹ž¦™6@g‰›ÐI1ϯX LIÚQ^É®WKt™·›hJŽ6ɘh¤ÇÃEux܉~oæzvÅ/· ø=ЕÞÞößöаú,¹Ý¾ýj3`×ucÀm1[ßHP<-Aƒµ ÁCžÇ÷Oui$gƒM¬1-¡%a¿–EÙÇØ~Ûmbj Gý¾žéÏÉ7ï.j<ÛB|¤qEý]Ü \§çù¹ÌùÕ*–æï6N×ÐçƒéÊÊ$Ù–˜®È~Òì ÀeP¶L(Ķª3m¶Z®–ˆ_GO<‡Æ ÚVÔb°Æ¹ù5…âÕ6üLd«™Y*¼A{BÄjð”«{_—æSγÝ6ÙÆgay¾õÁÛ¯hÀé?(#«)Þ¯µ‡ |%¡õÂu VšÕ ±>µ£ž›(ç¯CÞ”À›ã=':œ`b,ðЦuÓ%ë“÷üÔê ¼ISŸIö SôÆEWúÚÝ㛥J¬ü%âôFEÕò ü4³÷u­XE=眪Óã×Jµ¿ ÌFc¢»²nãðC´ýP¯~K›á#WÑlà™êZà#~¨]b0±‰Pâªòú¡ˆjk Z-üZŽ~û÷q©\½íš0–lÿDZºƒhýÔÁû—ÑŠ”s(éõ˜[ÛöAn;øbíxþ“ Ô#Ä‚½[]Yr…÷îÙóÐO{+³¿»ïÓ*b ¾¬¼ûî4®¾û™ýÓçÆü̵[Œ;í™]ïÃØ<ÛÛXÈv5NUuòi'ÈæÍ¢öŒto’øsòé™ M7p™è›­@n ¹¦7µ F4éηÕÔÅKîÝbüÂWí© [ÿ:½“5 ª—/ ÇÎ8›ÆCY)äQB´fRÕU§CüÔ•â_pðØßÊjRz¾r;É÷êäïÊ·ÙøµcžνǑVnÉŠåT{­×’w±ö¨q̳G,B|ÝË`[Ñù_Áƒ¢²÷~¯vókîÄ® Þ'â8ÃNÁjCà|¹¬i*z²¹ÝþÚ§*æHu¹,–"¤±0ËhÆ$2ñÁ›/>S+&›ªŽLñÑn¤bB5a¤(3\‡jçÂpƒePb#ŽùºšZ£?ÛÝÃnü kˆ5i^}õ ²ëê?| >ë†ü¹m÷ƒ!ÜÉú¤‚ úVb0ô¨’F™´šŒÎÊ(¶ ïéú¦CMOÛù:ËÚÜñ§b•mÌ]uÌ‘™¥qg;ã½í!Û±¾XýV}Ô&ÝÎá²}{o¬ýeÁ—²þäçÙ N²)7JÜB(­o!;ާr@>üõýÕ…×S¨Ð§m–,E­ÀvonŠà9T‰ºÙ¡½“9¨b»…ºTÆWîúO‰[¿“‘"Qî E‘;VZ?Lô¹Ò ÒÀ¿ ?1û¥/møãIõJ#-7L(¡óè œ 3*ëâÞ‘ÐŽÙÃ39(žÍŒôlì]T wï;É'¾+Œ†­(#-Û}RãÅõÁ!ºIê°oGjª!øœØòºødi2>‰vº­bÃΔê "޶¯*¹P7¦³ó¸Qä„?9Uol¦ûp àß²¢›÷ô•ËšÖ²\Ö´»_ {Ñ„Ji3Õ²~ÀD’[?HóVÈ|QŠƒìï—ÿ8´:¬Æüù3BØiN½­;§|ÀXuò›ŽÎ;R/sdÅÚ«—_fóUÝâkÒ-¼±{TŸÄÔ-Éj½dnrÏG _W~KÒ*ýWá×ÛÞÃaÉ‘YÇ7Ó«²“¨~ÙþÆý­æ5/[¼jß“ Τc—–ûgj´Ã+Ø\³êƾ˜u)€Å"& ÉÚ7ÿþÏòws(…llKäØ%ûµv¡—#—ý¿oòÏ8OI•o<™#J1»/üƸëuá`! À‡Äý•æ C^bmèð}—Ó^æÀ'zÁ î±§­"ËZ> ‡ymS6B#b¶Ò×VÒ·lÚö—Ã;%&}³ç!)8í!ü÷5‚ónH”»«ÖsÆS¢ñŸ¼ÚÉŠc»×>⽫÷0ÎËŸÞ> äÿ´Äù¥¬¼i0ìË[Pmßä:ìBL¹éA ‡ÖÑÕ[8'ÈœkWææá³xZ¥Q-©þHíQcgù¹vi©uú¸”@â iÖ~#¢‹nÀÚø×#;ôM {Í ‚‰öákïÂ1>Í<[±×X@åðg\Î ]Ûx¢ª3È&²xó0º3n»Ž  Š4Ç<Æz)Të«•—']êܼc•£·Á}ú‡©÷dò¼5£‰¶ŽwâѤs2»¿yÄ>x{"ÆlJר>W¼ÍáÊ säÄé[oÜ @Öõ~”8ô»H‚É ~SÚ÷¶ºX±)ËU)g©Ezâ°¬™R™[Æw&£ï^£µÐQ¹k¾ö ô¸ ÷}Æ*|¨`3(ê|ž @Çm,‰#^Î 5†£®¬*T~0T«0SsAVµÙ#÷Å Ì7þ€R]zúÛûWëy¼™—ûÔtåÄîµöœw-è…m™7­9,ï{õ÷fVû‡~/ôÄÕÊä+òE;!3·ƒl¯;Ãé¿QÓ«7’¬`3ÛâÆ—Å®¿ÿ}^rÒw1(g—Dã·B`ôÆØþxäŸâÕß9ªØ —ƒÁi©)ÑV$j¼×}û”ñiÔeUU'r­n²œ À‘²¦Ÿ¼V`)ˆ­œP J[Ýε9‰ ÃV*f˜s7:åaÖî8*¥0ioC@ÝùnçñŽüÛ1ƒ:T"maûÃApM‚!)ä›öÝ©]§íÊÆMgÞ¹¬ ÀÌU³Õ%¾VÇ3ºÕ«~¤2CJI‘:±"NÖ¾Õ½=§iEâcŒjŸ·%ÿiÕÝ—j”²v9Nþ÷¯2¹L¨ÉÅz=Å¢}&D‡RE§ä‘¬Å—o†M¯“a4§±ûµÎé‚4íÃÄ;úç”d/BŸ·ñ÷àk¤Œµ»ZS'W…Vž«ÊIu‚m§2gZ¾5Bˆ“¤¿—š©ÇšjyŸ—%äoŒgÞÄ9W³ÊG­¯§bža/ç>ÌÝô0sЫøÑ©N0­k¦?ÖêÈ¢ÊéýÅ‹†_«gªÊré…Ý”ÂkçÙ}ˆQÔ“¾ÇBwïh½ØéìŸfE)F;ÜT‹ùÉŸ4žq‡vIi¡fVo瀭‡"³z|ÖÈÈu;åe9§«}™‰ÍXÓÍÑv-ÏÑØõuWJòBÿ7ö§¯ÏÝÙn¿šS`ËÉ`/3¹«[çCV+vL_Y*ÎPåLI?¥úT0AI‰ÚÐú}lNç‘Uk±¦½ Â+š„j#ËÉçP”i¨Yå(ÍòoÏ1XzÅÐP#Ýßüj­Ößí…«³’ ¢‹eW!}ê¹y!ž4ίá1ªU´Uxˆ»Ðü ÙTðs§H9¯¤fèê7!xÖ‘åë?õ¼úY«h}© ¡¯òƒ¿aøÂ>ËÀ•šZq0‰¦]赂ã ógŽÉ‚>~ÉyŽú)–ŽDuƒ”×lÕwDʸYWq†æ>‘¦„Ùß9¹\ìCÚ £öˆO"ö «ŒÕ#fÔì#§‚¢,?ðµ+•i®†„«¤¸i¼VóS) ¬,:ŒÈ¼Kªì—v¾ˆ“Ý Ñ]B­”x¨P²>®!CÉûо2äìŽrD^çá·•å\Â[K°wŽÑ¹âF~˜´¥¾h•eIs 'ÿ¼x÷áØ!ÕPؾPËÏBwYžù‰»¾Ý;‹"])‰y„®²îÂ~&;Ðýp:i kuµâ;!ܶ=þ™lEmŒ,ä.y#Z—Æ1 …(4¾\0æ lóp|¦™{«ØÑ= ɨÂN¯és&_fÙ¶"ÆÅ¼¿äjî·A=CO/é ,ÈÔô x×J€µøPÎà×Z§v£u|×ç(šç­í$£«,×–ˆó /«Ya®´>»ÈX1èûµ¨ËMª.Å|CQ OÅþpJØH(ë0ëôr%èZAæ*=G¬Áï¡Æœç.ñpqS'CŸ÷d¡DÏ4ùÈ‚ÚÎ*Zú“ZŸ¯Ìi¹)-^8ª›ÖÚ s=ç«&¿½ûÙî#kˆJrò.!\[ñäj#7K¤Ž†óG]Òw2æG‘ë¾l7o$XD ’Ç]zBÖìñ®}b5m;~(ÎáN nnSTXMy‘îëUõöÊÂs¯ª®öñ€8žMg•(½N?îÜÜ^Çoý(‡ÇØ¢܉tÃwŒy½ì€¢ñÓ:œÃ÷mPNYD7f«šƒ¤ˆºùñ϶Óp'MŸn õU’f´3ûÏrÒ“‚åVD«Ç )JÖÍ#÷—ÑeÛ‡òw2¨×‘kž¨å¾(Ib£ÎF¹ˆìÝè®}Xͦ!_ =â¡ÒÈ9i©¾ƒ6겊•-³£";cm"lÃH¬ çWºpÁ^[m¹p¤ä €œ8ÑÀo9RQaŠewDÕ´w¹ڥ̔–¡¬ÆC}pçáüêŒ×šÅ§Ûh´ÉQ¢DqDÇirŸžµ<ª¯ 5‚È\e’´ã–·¹5b ·D9(o°L"¤VÆàwG o„«{qâxã@¿+‘Š{ABGÈþLÚÆ°çØÀgT@‡˜?³“jó¾2Ø#' \=5‰Aõ÷Xˆy’§ ê\Oxo\Eõ„bÒªòÒÕ^í éˆnéèX)›€XqžÖןQuµú]—ß+—MjQjÔßé \Ûù$T`¼F³¶0ʉ«¯S鿥J<ÄQŠgŠH/uX"{p!®Õ/¦pF°=t«G<‰n»ç)óNÌY"!o®T Œ-œW~ôpDŠ„ëìJdûõ­Ô.̺"¾÷æ_9eÁˆR¦Æšgº‘„êU–¶‹ž” E³géxPGu}|ØëAÃH[&R%­¨œiŒ¸óQïï•g…ïIŦ¹¼{ »M›ÂMA ûäLÈ¡d…‚¹vxA¬ðUg1.m©ƒŽ–5¼&]¢òšcnZj(IQ”»êž· —Oòg–šß“§>ìÎû¨Ÿ~«ßLxÈ6Dâ yÐ*}†§àp[E?s‹›è0ÍVÈ¥Ðî{‰iq9l]ØT®VUh¸™B‹"ñ¶•Bjv+Ÿxf¢¯D=¸JTø‰_ ö#›÷Z1† vöñ%ìÒ—D;»žÈ,­7Ù’eÂS5>}c|_ðynž Ap6UKÖÑÎ]e/~îåÏIû@1±H›]°/ÂõyI¹¿º~;µ„ÌÒÝúÆFQÃ%AF@úPL÷¦e±Û­‘-xjžÙ$k…«¼‡­JÊ2~yŒIÝ Àò¹îÝÁSéTºÅ 3z1Ž* T*­q±k8G­†Ç!+Í$™‚^LçêÔ›µÌ=DlÇBFEÍÀ“Ýôä~n?vF–ØjžI$ÖªgXA~h[;»9ð±Ó4¾›aÃjŒàƒÜĉÑÖ¶·¡¶ÌéÖ·—‘_N^Ú÷é÷ÅŒð_¿ütBjl‰àßqh•þ‘êŽàøÍsѬ)ÞG«Ç½=«ÛÞÑOm@:zs3 WAÃ/sbñQ8†”RÃëa¸tÖniú—8ñÌ<gj%!ᡬÞN„¿ü:¼*…èA&½éåƒùï!€Ð±^ìHèAQÙ %k—|ú¹3ÉÒVîK-n~â V¾ß¸5©‚Jðó/‘¡ËÅHø î#¤DÁs{4¯˜(~øIø[f$ÀWlj·Ü© ¿ø¯=_‰D_ŠH…r o*ÞïRÄ ž/_õR3mW2X¼ÖQÏúh§XòVÒ¸ü¿¹k°äk¾=cUKÚ@ÙȤ9<ù%õ/ø¬2¹”xúÃ… žmµ±ò\ŒÂ÷¯[Ì;ù²J­†OîòÂaÂJ˜º1zÓô[9Åõm9yhcû°Œ|!eºâlráºTTÞ*èÜü Tª·ìêëi ÊÕjÛ‡Ì?ê ðõÚ” Ì…ÏJV/h 9äQLÙZFª4÷B0Ÿõl??а’¨n…XñI6Î=r¹O´OŒXê/°.Î$ z´¶ô,Þˆ ï™?#vÞVMC5†½•G걯hql_ @%µ“H¢d¹(þøÕ´q8íRØÑ,öàt”‰jwÓ$«6m–4]É Ø‘\i¤û ò›€JÅêÑšÙ,ÂûUŽz£üÂçívDmsAuöÔ#–?<ÉAÎPs ‚™tÅ\­å¼ì5X6*žœDd¶Kfÿ'º·u&…õ~Xƒâ•\¼¿‚Jµy:ðb8ž)­ômç|w×W2¸äÞ+D‘ø‹Ox…‹òüf€Æï®§©wÒ%~ *¿ÜôÂŽ¯ý§½"³]ù YçÂR¥…8Ð@ð±—êSŠš#o¤’^&.zŠ-o^.î»îÂî Û4¸»{‹‰èYÂt¿‚º¬«£‡¦J¿oo]« ®Ù׿)Ò!·×âÛp ;…W½«B,›Ðâ»åtéÏ›Œ«§oÞ-{ÚŸ—É2þº³¼Y§s“á³?Å÷ƒVìë¡fä#N#Å€ø(~1ù$ÿ8k• ä–â¡@Ã_™—;y€Á ÌÍ0 0£…Û×'ÄæIY¥¯¬d¨ý*¬ûý¦–³ãìÃÁð¢åƒèÍí,Û(Áåü.‡›ã@ÖJ žOz,§ª£ ψ€×ÃÄkñyÕ³ Õú¥0{ìm^¶³þY“)i¹:Š_ؘ.9·* }!ƒHŠÿ&–‘’~pÐÑ~NBN’m*9týL«¡öx߯It›9!¨89lh‰‰44ñ HñKq¿§òÊ2Ùƒ€DPîñ ¤A‰$qWPž¯‰žsiôæ]ÉÍ~{ªFú =ö°ŒÅíÍ€‘x²<ôgßÓ™"Ç詈s%ÓlëXÍ`mV©C5Tcj‰çeèð×/©K+ó}J¸MÒu _i|VÞø˜•CS—r©thÌÞQWiÒÖ/B®›:î¾ :ÂS?•–R¥Š/aLÜçêvalcù¿¤§ ph‰!¤·n‰î?\÷Ÿ|:_FNQä¯dÖþN²a 'k¾Ðw ±îà[.ÿyÎá¸Òüé‡\é¢F±#×¾®Ù½UŸ‘y!´ ^…#4ÞDWd¢ÿKaX®§qóºÑ1¢‘úUŠ)3ˆ`xà®@’@ÈÂÝ©U’BTWuQáÚ®6““3ßè6—¶˜DnÚÌ30nÊ„bI&b”|™ ý‰ÌƒgLâŒwžÝ“D½NÞz3½+#¡ó2ôšÙåóåìŠ3I——è¯àh¸áï]ñ(ÎÙ®í4b:ÝêŒC!}xî:…H¸ÊŒÅÖáÁö=þèUÛäÄö *DÍ-ý–B¸¹œÅè*fIС!ã+Ǭ^'D/bá/&V¸ûv“€À»øAWyuÛ w¹‚Ÿº;¢×ä"D˜#kl8™Ú€nS8#kßEJ<{!Bcç *v@H|T¶ÓCny¨–m-Pí2~h Ë_¨ËËÿJµ8¨¥>u&$ÎòxQ±Þ'áJèó6åäÑôđ㣲weà9x–S¯ ¥Ù¾þs~6Oó£yŽ­Ò!}ì¢~–”‘fà1^g“¼üîâÝÊàð[ì¡õùØâ©;϶@P殦0P-m`÷êrÎ1™”-Ö«užÖز§©ò‚Ïð”5ñóO’Så(uƒ. ÎxEêðíS-Ÿéƒ êxµé!Jz1âh˜>“˜~ÏeZÊûdR —A#2„óöÖëü÷‚·³ïJï…Ï,Þ2,¯Ð󹕫4.È~h­B`"Pô‡BjòÆ×!Hÿ®'*ÓC,«Ëþ„ZoüÇŒ1Þ2ø}‰4h¬íEãtÚzþ „ÐÕÚÎOïÎ6ôÐ{[r³ä$ƒõ¿h6Æi©¢°RtœÅW_%·qu>zàЄª‘̲@Ïþç¹I“ÎAÇùå•#ÄÀ7iJÓP)–"½2¦hžy<s€›Ö,VOÚV5Zþ“BËä 3Š_tv’:`±û^˜ìxƒÑ“JbëKÇ?¯Š®Ù,W¼f¥25ø§Ý=C‘åxçl|·»2ü‰¸r¹_A:7„T/ à ¿±áì*1¬¦¿­äS‰õ‰^=Ùœ™®«3C-ÌÅÏ-Ngâ¬qþè·~v\×ÃG&'‰Uˆבåxuؾë<Ä·$Õ—‚þ²³ýµüú±ÏÞD°­:JÔú–âÕ$"Öššùnìyß_)#nÚ` å–ï }ó;P~V38õÓiè˜$è©&$UÝDŒìrŽÁHVŒóÒÍ/ýš£Lw ¸À—ùbß!.%5¥„~>/3ê‡,¢ …»+g\èF¯,ðþËø¤Þm”uëžÉÔêë¨ ’WÖ̯ËœÍuÙZjGLaç†zˆøIéªÏíPlÚÊ F‰ì·œŽ岿Œ.qסœ,d‡W¤$^¨ÞãÛw¼,Œ¿2›ÿ–c;úÆ h>ÁíCX —Amfmªÿ=™v'Áñ\Øé›W˜0¦þå{˜‚|O êSª'!Že´îŠl#«Óƒª¦K4—å6š¦7•¶ü…ßA€#tè=Õ4-5Ýl8ψ})'’]Èuj©<Ô¨ÀÏ€öMÛ±˜_-l/6Óú üÔï‰BG›¶ÃÔİŒ®”õÎ=tý@_Ä_ ^!úV´-ºa(Ê‘t¿ q¹7MØ:w¸Ú[ÇÐ1¹kZ«8'Ùc¬c‡òßl#ËC®[×@qAà1 æžEÂÿ‘mØmSã,½ ½xZ©ÁpN_0¶Y÷+W{¨•]<4Fvôø•„Çkx¶6f§¨z3ÌãÅ$Þâ×d1ÞZ@€ŽÎ³T4,ŽÆšÏuNÇCSAÛ·4&„Úb=ÑQzM¸tw¼«*æF1r¢×*.ÙîW‘ÇqÃ(U|æ©èeà’×!±Þ­½~…%÷=‘‹.¤òZA!jäïù¾^Æê‰g¶Â¾nJ¹è¸Gv{¡Ç»´ÙÏ"ÂѱA§É‡³8 #ƒ7–‘é5un]);f—Æ«)»1ªªr?ûìú²D%?©Už˜Iܵ9g†Úºú° 0‚ ¯ÌGH¯ð6‰UÓ^ôߎˆ§AÇ—xhLæâ6Ó¤²dÅHcC|úwl/_ù˜G«5ŽåÞëMü ¥¼vƒ×æºRY`žÿ™™t$_Ó b¸åÒåQvrú~–ÉÀ~ŠÏ%Ð {h®Ñ>íObO|©|¯&ƒà"”­ äë!¤Ê ýaÿÝKÄÕY• ¾ „À¹Ñ}¤[û3£E«v7f¾Ÿ£W}ü‹À>%"ÊЛe1Óä•á¹¥~md¼#λœ¾ouñùqߪô|¨Ñš-ÀƒzÌ©!¹©Ìáš,Óããò+yͼÄ{•aAT-‹C_äyøa0i²e†KÏ µùŸ*qn8 ÚŸæÂÏñ°ž“ŠÔ ³¬…–Ñܾà! 'ðБ÷Zûvi^-dt"|vjÝ)è/¡3òYµŒþ=Mçƒ8¨SÉ :$FÑÖï¹v™žØùh¡®É´_ 7¹ß@Ýšä†UAHkÂð3…9‹£oB¦JAqmEmêG†7ýÜfÓ/œ¸Ò~Öxûεp2T¤¢æA ÇA³†Zt®°æ„z&GLjÊ~ÞCúAlåŃí¢7±€rýŒD€ƒxíÙjʃHTÅgX™Ôkäj…øŽ®>}ò†¡Ý¥¨™Îm-4‰åa‰„…¼W„å‰RºÓM3Æ%ï>ÿi0Õ@‚(s·ËáÂ]{§Ñš|?²øx-ã¾@kŸš~¤eø®Hô´Kï°F ¯¹>¡óoÚš®0ëCC8W·xã1Ø_1}.!Ži¤uzÛiz4É)ÂÉXŸÑD]¶›}õ~ÂwcgúŽm¡”l-£*ýÿl‰¾~z0“c¦„¬Ìù"AÉê"ª ÆxžæL¹«lº3a ©¯Ì–'íüâo™o]C,Aú¹´ÿe×r£»utRnA‚2¯·¾˜HÌ,ñ‰-ÿQøÂÁ€c‡mU;EZXÉjˆG§L#\¬ãf(FÍúÝÑžÁ¦tY.H(æ/±. ØÃ5øe çQãr€zä—ße9å—QœQS.>~È$ rþBg¯¸ôîrñoJ#ï ¬)ùxj3%jžM_Ñ!QIêÂìF0‹gK8x5©×B"‰ ³#JÐ.b³Y¹áÆÆOåÄ¿Â#ŽjyŽ$¯“ª¤Ó“ºÎÿ\og¶mŦC’pw¨Çxˆƒ‡Úö22€½Ñß4É[ªOLfÀÜ#M#S“O³}Ò)ÇXÒßÄañR×ÓÂT¼«î$§7ûU×B@“³T\8îØœ1¾aЉ¨Iþ%Þ7¼Y6&zûâ†?˜lv1†cB1A·aP#G ãA œ+§yNíÛ=Ey~ä‚2ö½Ò¢’q¯wƒ£ÏZ«á‘o&~¤I)çaòKíç ßÜ?é²zíÐÌXF]<æ"ÙvÄÞ5ÔUв€ãÆËÕl+«Œ>¹ÌÔS)&SYòæú«;Á—§4.­²ö·Ÿ¼5uÖ¢NÞŠ2=7ËMÍÌ=”‘3rýOÉOž’%¶ö¬å%‹³HŒ]c½Èh࡛鳦:"ºÿâ+x|E¹ñ*NÑóp«½ëô\Þ»Ô½†fGIÐ[=$ D‰ìÆ}½:@høPb„à"pðS7[7ûÛô«.Œ©<Ц´Åc• ñÛꮺ´ð°UnÃ!Ü“Ôóšá¥ª.~!DD⯊h‚ä°Ë3ee´ÍwͲo÷þV·ËbòÇ5E‰ú[(@"·;}Ž*ƒœ‘*Í´zD[Ô‚üZ&?$^Zß\ù&2úÂJ È¥z”ólvú½!¿žDWÞÝFT¤}ºúŸ¦,¨Ù=š>³& ÙÞ20èòåðwéÉfÔ‚——2½²˜"3‡ùˆ…KS.µöÕÚOré”>ž^+ [',ŸŸ²ß€Y–’çÁX&à¬Ï¤Ó¥Û<èæ×€’lˆ ĤÚîBË}¸œéø¼ùèíî£`^~ê½nñÁÉO~Ñ­¸êa 2ö±÷£ån‰Î4Å¢¾aÍŒÁçZ΢V²¤9bRÂX^ÕŠÕÅ· ^'C‚• x|úÐt<£ú:ÎürLôF N„vô«%Èæ~lBÝíahOA¢“qËÃEr~A¥õà5¨Íb/› yäc÷k‡8Õ¸M–qqI›³Z2GWM¹‚lT€Ð¡“RNäFAX®6 Ú‚tå±Îq®80V×·jèB›Ñµªió²÷³.·‹`ªyÇÝŠ)glávªŸ<@Ö“nÏ;÷ÓxòQñ—ÿ¤VÑM8GˆxàIØð…ìH2Í)ô‘:\ñ^yÅ4ÐS{—ṫ—ŽÃÞ­+µI1ËžGy a‰]:½É!¼A»ªÖʰ®qGÑSK&ñ%»ÁcT-0 \'W®UR?'KÎl<º€qb°c\ك̨NXÅþVñŠO_?ÏǪ‘.ͯjÖb|ãMá[¯kòq;ÒÆ Óöã(}i zf€¿}‰õÓ+jaaÅxŠð6îlCe<˜õd©Ž°§JmO½gÐóe|6Ò„£AxJÇ;c_$–ÇñH£Ÿ¾À1<" ý×£ "À­E~¹Yûw©¨„ñ¶ªUSý¢c4KÛÝÖî»M!AÁ,_ …‘{Ü®`uMûD—ŒãÎ`}4Ü)ŸaUà¹/%[K4×c…É‹Ït•ݺìüÊÞÿö_µöÙ qi›^c?o^ú¨ê³•¡E¨Nƒ;vSRÍÔ·wÐæ²§“dØ»ymQ›¡+, }ôIî eÖÜ}¥Ã}¦•8[Vå}od:vðôB2´bDŠ"ᣴ É/Sª÷IxœÓçUÊ7u›`Ð^®ºoš«G ‹µ¾Õ€Âš¬MT–áT!B’½‡’½°*ž³¡$R¢öÖdUûL²1š#cùõ·ëÚgløSÆû%X±ëb»ñ¡ÍIÏñKMáZ,,Ö]¨R%x.ªÜ8zª»žˆñŠ„þc·a&•êsÙ–6Y G›%ƒ…ÄTIœsÆ(#‚E®µÆLþ:¹˜2m |mõŠ®G¹YÕ_×iC®°->lǧ¨”yð#Ĩpxʾ3.7r.i`]ÕÕºFÚ6AÖ*†Ž~¨ñ¯Ñ endstream endobj 158 0 obj << /Length1 2643 /Length2 16736 /Length3 0 /Length 18257 /Filter /FlateDecode >> stream xÚŒ÷PX׊âî\‚»; îÜ­w îÁÝÝ݃w'ÁÝ‚@nü“™ï½ª{‹*èµ}ï³ö9 ¥Š:‹˜¹ƒ)HÚÁÞ•…ƒ•] ¡¤¡!`gçbegçD¡¡Ñ»Ú‚þ£Ðhœ]Àö‚ÿ2p]!2I +ÄNÉÁ ïf ààpð rð ²³8ÙÙþÏÐÁY t›”Xòö  G/g°¥•+$Íÿ}Л18ø˜ÿtˆÙœÁf@{€ÐÕ dÉh´¨;˜A®^ÿ A/låêê(ÈÆæááÁ ´saup¶|ÃÀ ð»ZÔ@. gw9à†Ê@;Ð_±¢Ð4¬À.ÉÕ,\=€Î D` 6Ù»@<ÜìÍAÎHr€ºœ"à#Èþ/cÅ¿ ˜ÏÀÁÊñO¸¿½ÿ¶ÿÓhfæ`ç´÷Û[,À¶ À;iEVWOWfÐÞüC ­‹ÄèÛM!VH‹©€ÿnÏÅÌìèêÂê¶ý£E¶?Â@¦,eo.á`g²wuAù£>I°3È 2v/¶¿NÖÆÞÁÃÞûo`¶7·ø£ s7G6M{°“HNòoˆå·Ìä àaggçç“ O3+¶?Âkx9‚þTþ)†tàëíèà°€4ò[€ P¼]€î €«³È×ûߊÿ"€9ØÌ` ²Û£üŽƒ,þÂÃw{ôÙ!Üã°ÿñóÏ'C½Ììm½~›ÿy¾lêÊÒòjêLuüN\ÜÁàÍ `áäâðpsxø¾ÿ ¢ÿ]ûoO9{ €À_µB†ôõºÿ}üô¯࿱” œèSÜ€‡Ý ò‹ãÿ3ÑÿtùÿÇï?¢ü¿Qü ’v³µýSMÿ§þÿG ´Ûzým¡¬›+„þJ%°ÿ_SmÐ_+«2»Ùý¯VÎY1{KÛÆv‘{‚ÌUÀ®fVã/±æ+f ¶©8¸€ÿ¸S,ììÿ£ƒì•™ äÞpðñO²6ÿÍ(eoæ`þÇ~qòð€ÎÎ@/v8yxÞE4yþÉ`«½ƒ+ÄéÎ`áàŒòÇòòØÄþý…xlâ¿€Mâ7â°IþF6©;€Mú7â°ÉüFœ6Ù߈ À&÷Aò)þF|J¿$ŸòoÉ÷îÄɧòA2¨ýF ê¿7€Mã7‚t«ùAòiÿF|:ÿ ˆøâ‚è€vŽÖÿqoýŸ²Gl@UÀ.6¿!¦¦¿ÄÄhfãb t±úGÊÁ ©ÑÔh²Y¸þKÌó·ø¯ù'Ç_bëì¸þ‘ÿdXfÿ HEf¶†ýS8÷;»ß þA=6óAHJÐïÃþ9¹AvóŸ@RCXe ´û—¤W‹ßY!`÷ßAxþP;¸9ÿËbbù; Doùdz ú· ¤Òßsã†ÌÇÊËÑ dÿ/ ˆ ü/a”õ¿ ämþ!£øÝ/¤gÛ?–ë·2¸uÄ1øŠ ’ÉÞÍÎô»Ïò_@îr6‡ß5BB@žú©!}9þVCB:Bž[ûÿœ$7ÇßÒÿž#¤zé Ïê¿Lyÿ”þÅCÈmÝ~÷Á™š“›ƒ+ÈÜôw·¼ ÿ“™Kàoé3sp@Büë8 ½ÿŽÏqrÙÿË*ˆ‹ äÅú§,HõÿÃ{H ¿“@6W+gп8™Ž«‡Ã¿ 1Ü~·©âϯ&.fÎÿ1äXÝÿ!åyük« A=ÿ!Y½~ q}rþ+ånV37gȸþùôA®ÝÿÃ~>Ô‹‘x°L‹,Ðh§3°xqîv{Ä@La¨ËÚr¾KÀZß“¢¿]¥xöþÚьޙ¤ÚõäóÓ8Amî  åó,þðLñW±¦!2dR ÑCŸg'­@Øè^yš|'7~ •BÜAϦ¡ÊµÉ°åÕÃ:^ÔŸ•ó,±š1e‹4¦9K„T®,dHŒ8Wž˜‹w÷ 8y3¿(ä˜P|Ïb¹J¼õ¶9ã~,½ß¨Öàté#¢&Ò#$ƒ½Ã™œ£õ?N•'Xñ./ÙYÉeg`…úlß_x%nntÏVBÉÉ"³ÂäwSj:Å×P~ µ ~1‡r¹Kß¡qài»âRnšš…Si0¸ÐdNÖýÚÄþ ^±±÷þ¨aœéX¿¹p‡JŽ¥Óùi%Ø ×j˳XHœég‹Nízƒ¿CcÊSMPîÚº¤Tì’u·?ÔÁx0Tež“aøå¬BÔ% Ö‘òÓÚJšPï^¦ŸÛ³r¥,M£]Inÿ|B!7‘u! …fs°”Y²cÍOcX”„»Wãˆæ¬Õ]šE 3÷«%¯Ó ù)ÑÓÔ}Ù€ie]ÅøU'T£÷óÜüRZÂèo2”…²‰[s×î»õ&H’(K¨ŠmŒ£¨¡ÔæL –Òç,‡n‘ÐÆÜâ<Ë´”¬Î©¹T`Ò×Îñæ¿xuaðdWã1÷:PÍòÑEu2"œK‡Ã5èAÿZ8)3뺮œ2åu¦6‘îÛGÚ,ckÈyt¾ÿvþ1tãaÀ0 IPüîö@΀Ú/Md1¡°ù4`&"¸­0.ÿËÞÃhöh/åþijcƒj_³:#œ±â´×¾Î¸%c7åkq!is<¯GtwiÖNÏZíõ‚™£y³Hýù“žšGëo5(Áë×è[Ù,VÖíé‹p}‰H‚˧“¦fC …ž$?üf-ÉmáØý3ŠôR §Ë›ic¸¸,c®¹O=ì8¿ÃõÅ9ŠÇdËMÀcD úÅ;UKclŸEº oB]ÉI‰Ì0ÎÉϲÖèy„Í›]Àqb/ó“œé6,³r`Y+ˆ¹Ä u”\ vÅ}7™V3Zô¢PåFòꊈÛÅ8@k¡õ&r‹¿Rµ”F™%*q·mT)¸l¯¨/œìïC ŠÈxÙz xºwbG!Ñ>öb;X´­‚U?:6 mÎy!Ú©.:ƒ‘ð­?LHîLõi"âˆC¹U" ºœ‘…×d„Œxñ}Ý/DüŸ£Fw ÑÙ: 3ëmèœÍvezõÞÂmÒë®}s‘ÅXáÙjÕ/à‚ŸPTݾPóHŸö>%5Úâ=åëçÒP÷ =·[Pz‡TZŸ4¥Æò=jžY¾A“B‰vù#ìN`ð[¿€ûO@9¦tTµS¬ÉÞ•Ô_¥=B:%¼ î¯dY}LÖ‘ •qý–>¾k‚{#ëDèÂ]ýK¼U"bËȸzh¬H®´ÏŸB‡ $+ú‰DD"›Ñ 5´ÎX󪓗©xš|N€=¯ï pÏÈH¯x¤u8ÄUn—ñ«V€ ?è*GDÛ±4‚iÏv9¾ß~%œ‚Ë2¿ü5ß°à¸j a¿h‹Šß<Ë™›èBƒä¥–‰‹zE¢Ð‹§J°|mõ z-c|ô J§×ÛÉ—x#‰±;œ›rè­Ôdetó]LˆÑC0O Ö³­iž-ª³§a=GNÎÔ²WcœÏ6Ö{ÊñØ_„Drm…ê÷?ä+ÍɽqHœ´P¡ Û o6Åw}«”K1õΧ×ÕhwNûÈí–8ÛÃÔälN “çMcñÃ&’¹¼|(Zýàûù·[¥WcdŽ÷ypúÓ®·Û¸äðcnÇF4ŸKoLÈèîPØ5ü Ðà休)By­E ˆa&=¢>#u—ô®F"uM ñ…=Œ¦?÷ ̬áýXô~,Å«À¼Ëë k+Ûü1ƒá&íˆ?þ]­Eq¡Ž=sTyúÄVºJ&L7üòyÌP‡#å\üÉÓ›8‡l¤Ú‚Tª'b³¶G’Äuûèý²€ý„Wx(ùÐ kÏ• yŸ;&îeü&s¾ã u¡¨'í³ùå`9·¬7ÎEŒ<_¹xÐv¦paÖì@žDØÊá,tv`¿¯Ûû㟜°¡Yð3±‰óÝö¡o ˆ¾më’<6ëÜ­›x/°Ç“GŽÉY.ÀÔ+zíQ|8×vÚ~þr|µCK(N†ÒãHåU²þzIFÞì Y:çž\7×!Ö©W,½t÷ia§ q‚ákü³¥Ô莙šyš%TçÑí VÕ`¢*RЯ.R)~ZDûE$õ=WÝÙú +åõÙVÐî—wô—-ÝëlÌ H8þÕ+#뀊êٮČ×Ï2-*mkÁFÜúJ©çíÓØeÐw5 G^¦¼AÅFöfK<á­–ÒQgÖ­ï-GY3FnØ:w¹¥ (ö3‹£ ‹KÖ¶0’Åøž^Á©û~ '\9òh÷èÆ¦õÔ$ˆ6¹Ûµ4Cš"v$¶¥C3(ñ)"I£€êž÷†ê#8ÈÄfš|’ÚÉಠŸy(®‡º¥¡[\nbpŒ®ŽýG¿mfL’È„RNˆgDa8%áBã ÿLV“Ì÷)$¥ul|‚ÙKq$¼2Ç<îÙˆ‚ã±–<øå~2šZs»Î2üø€ öÖ~T²ìFŠ$€Ÿ9ˆc¦ÿWß2'JU”ü‘8…«¡_‡ î„ôº[S7ô`A®•¼¬´_áà(\yçyRirìþ|¡j~îùb=òŒÿjö¬L>|-";e7ËÈåÌ[P–E;0àˆ£á®ó'hS¦­s'v¾Rï‹Ï@8ƒ”€5oùyIÙ£ò[@ˆ^Ÿ‚ÞiQ±û=hq}ívâ­ëè±óZ¯>gÀ½bÞ¶äçËL'è6÷ˆJí!ÊEXõ\Gèï5yíÜiôo[§¬Sýù•èMK_¸*kúß'ýl,gì<—¢Xì¶ûÀôžé5Òû0Þê$RSKIA7mxòïƒUÊ»w‘÷PÙ¬ê 1Yg‘0;,«;ò˜+&t7n£ìzqs©×N3ƒ6̪ V$ä·‚ÔDÔѬØË½[ÔÓ±ß3m: &bÁ¨!“Ù`œý׿}š+eë·×[+bèjÁ1'¢þ>å }*?°¸ÅØ"°nX´w¦sRrÎ3ç/pŒÒ6ðôöåXŠ–‡bóUêüp‰’Á!I‰rWº{»ÎUï”x¦°œUQ†›ÃæYNíÌx2û†0_Ã?/Ì”–µ—ê&oËÔ!—¤ú±€a˜ ýlKM‹Ž³½âÞͪûÆ7'¿ÁTóIŽPÝ;cŒ“oUä¶bþ MZ<Ë&d“¥ô(ËêG58êÿmß5ïüá{.µ'̨Ã/mzSúii I´ó{cV’/ß}êÅT·d$d‚tQí&Àعà=ÎŽ{o‡ü7ðnp³´qìÏ[]ÉB °ZvC­i¤!N³ò‡âì¸&“Ìü°$‰AyŽ@¶¼9Å:íôt]3›±ÆââÈY$x2ä»O¾feü«ÐŠ>å C–Á4u«(XcnZÞfÝfBw"g™‚–0>©ÌÞ_Êq3û¾Î÷‚’úžqoH£1ùfò9øjÇ—¹_¹˜ÒŸÑ¿Ÿõ¶ 9)Ý=Ýõ`–/ìû->Ñ»¶¢Š5¸‡*ÝÖpܰ1„³»TõlõÅJž¥\[¦7Sq¡Úm1yë4ku;/+èjÊ:ÒÀ!^ŠÔÿ44´á šöÂsÍ7º»Á¼ÇǧÙPf†ÕÙç<ÞqNF‹ª&0BàºÏù.ò¼ç²ÛþœyÃ6|W^×TGÔlŒyë×{2+cqE sV™ÄÄ\R}*RÊóô@S°Úa¸/•#ea?¶à=¬FÚ|ó˜§ÈFA×àCbÍnÛ»ÁŸé. ùPNœ—ñ=%<Àtn,@ñû΀Ve(LUÇéÖRL"üì.|³¢¬‚ëS(6úS†Ø¦x•QE·fxnüPyW·¸Z6)CM…Cõ‰Öiý§+õ—CáÁ t!à*9GŒÛ{ö…A2µ1wh{K¡ïZ÷;›ª!’‹Ù}¿Ï‘öF¡ˆ‘}ü¢›]•º÷mKíôŸ‰k=¯¾¤Ð»ŽPÐêèÞ°tÕð1V‘ܰ_z&1LJ]¸JôzY©8x õ-šlY‘·õb‹'åLã,ñ?,¹xlkÄÒVU”êM¶?3H†ÊÖ…¹V‚ÐZ'y ÛÑýx¾¯´¾Í&þ\›ß<3ÿ´Ó?€¸e±OJêÌÊКbÛ|_2êiÜH@þ6BµF{Ž‹31“Þ¶|ï+:YÔáœOà»SéÔ£9CÖTÒZµÉWÉ‹ {’Oï¶%áÛ³ %já)DàØ2F û0îú.°Fîjê‹M–·Ç¤ƒ-UÇåPv_ÁÛ?9©Ôuu¶UÓ§[~–!Q µìtm?pò³ÆºÒuÅ„»ì=w1K,‡Í¥9¦KÊrOt½¼D~Øfô/ƒŒLµV’­ù³«[¨IÑEò€µ¬ÐÛõÖfj¸òº«©×Ñc$@º6ïÅ à&\?[ë¹-ñ‹ë‹¤÷šÍþl:hêûN"í/V´|n·Up2ߴʑČû¹•~þØÝñ0 Ír=„ao„‘¡}Z\Iñ'¼z°Úlù½ÿÈ2Vlöe¾þk|Ę̂Öo ¼Ý [ÞªâÉÕ:ú¯7%帬ƒ_@·‰lʰyš:ØLÅ_‰ –M¨¢à±Tô ž¶¡‚;÷Åt:Ä>àb¸Ôd4Yû ›fâ6Ô…·¨ ò±Æ^\FØðfS¾>ø@WŒn䟱øÂ°»B›ÞØRóÕU£˜èh™x…ýl™Rg|Lo1HLZ™ø4ÈáÓÇ"Ø óüŠ8 ¥A1QmrY·< êµØ:_(Ü•£šAÁÙI¡£Èâóµ½v^‘ƒÆËÜ®?‡®Ïó¿/Ú¦±{¤þBáRpBÑØý±>‹S3ùÉ záãû˸D[ÒÊpCÓ8ÇgËœu >$†n×Ýzým­È9傞Ï/~#ïŒJÃÓbÑÉ`ÜM¢ª~º›Ì…Ûa¢ Eèä[µ—?§½qÆoè ‘p¨S–8Û¦6;üü@ƒ‰9‰wGM1PʬQ „À5#ñnã§V(O$åaD†oÇ­(0Å8>ÃÛ3=e•úLðµÞ ¸‡c<¼Ò6Õ ýS«‘êSnA½âL„Y/-Ѭ¬}"Ã:òLùøQ+á' ô>ßkŒ,¹‡N¥™oH…#)ÚKWŒ˜L,zÕ_·˜Í7+½, Êíܳ ]‘_„àÈHLV±š?&GiËVãÔŸoëÂnøЩ(›tª»‰[àS3ç\.¥,(Þ/îß¶‰nç"ð–l07Ó83þÐÎ^ÖdO,TlÛn>³“ey½& ˜xY˜ usama?©ùy-#æ“DnV°Èµ-fýhð°êÆ}m}ekUʼnTŠZYÅÈøKhùc÷†öû2*L<( }ÀK¯Oy7F©Ç| ‡η4qš…_­ÇAEÚ5±Tæ};¼HªˆrÀîïó9aCR¬;Â=ê9àìýi¸K ¸KL-¹¨“4³Cpº&BÈñiQµ<”á Šê]iÊKä‰÷V*Vû’W«­j „,=!µÄê7'‡Ñ!G]o‘oJ–ŠÕùŸà(¢(+Ó˜ÇgðQCªÜg” Hõa?Lƨć‰<˯ãˆÌ=:O´itm#{üð ÙšƒÞÔê• ¥û½•_ç{ÏŸûŽ¿åóz°DÁM·"Ro -DÛ6qÕ+¥Bc$Â?V• UpAp³_”oËôÁâ]oR;GH-KëXZN÷lѺÊËU•24l(ªî0Æ5´Á«XŽéÔA¹ej1Ï&RUÒ¨ û 8RLÅí¾ÞQ2ð¥Â=àS—ÞÈ%<ÊÁÒäÅÓ–®èƒbT$ž·ÿ¤ûVgS bô´2£.~Ò“Øðé‚ÍH‘a<ª9Š,‘ÄÎk‹ƒXä6"\á´7=£ÎÏÜâê=o¿ú–.,œ³Ñœ˜¹e¿;k{Ö9âÂ5a«iì{ò=ËGéõКRœ¨b„i["TEd¯HX‹áCé·JÇÆ…AŒÀ~ìÔr’ŽÏ0ƒýÄ63Ñ\oÁ^sª±Ç6B÷™C_ Ä+FZDÏq¡o6¼ëaóžcÁ04KèF:œsŠ1–†‰$·¡“Zvum5Ð¥JVžß÷óTh/ég½óHo‚,Ÿ g–‹FŸ‘‹'|Î:éÏÌmFˆ{ÏØ ¦×;ce“afäé<ªÅ/Š\k»IÊÒýs-ßm˜¼kÈ/Ù2[üÖ‘„Vk­ÀxË–>…ýÔŒUÛŽ”ñÑòC£€Þ½0»û¾xBÛ7rm‘4ÿ}ÕC –ðLŸ–0KÈÔÈg3 È‰¤¨jÐhfr…Ö7ßç$ÞåÔükNU¤•¢ûäÎyî`§EF4/í¬H¿Ð~ÔÈÎü$gÛRŠzXxðîÆŸƒ}«W«l$¡éÖüøýgÂr|Šm@Ÿœ‘HYå÷lPãR¯¿n‡:Q«;.‘ “hô!^ÐØXĤ¦PÉySã1¯kJ'N?™L©JˆÍTÎ’Ñ-Û—òÂ!¾+–™ß£ÞA’œJüF¡¯ÚuÄï"¬,É›n)X§œRîÏ?Õí–ä[DBÚ×m×ùjöBYŠFqã*ð£{Õ­›†JåS§J„#<¿ø>¡|=nŒæ]ÜA•]f1Wö½XÆí ³ƒÎgnÀ·z¦±¢ µ©“™ùÜ[ÛŸV“ì³Zª w?í·=«u¬w#è¾¼ïð”mÐòžU#H¥šl\£À°J²Ù nÓLN«!«Z«UÙ³­¹ÖùøÑョ½â°Ô¯%;æÌ졈ݬSü¦gª¯O9¸G+_uW4Îß½QÔCÖRÃÌNõ–H…gÕö8žvƒç)P°ßpfé»ì*P{ÆáÔ'„ ЋT]—,?rk@©ó³\Êæ÷’ ÅÐZ‘ÀJ7–M¯âÁº„·6ó¶’=Ô\Ár²ØYhÊÒÃb9(GðPR¨*î®|œ“›MÑþƺrÝSíÏzDa6°§›&7è §  ¿†eî©3èº,·þT£Bj®‰´éר•_îj}¾Pþú­’Kî i{hqŒN¶h*ØIÏ´ñ…M«˜"«XÄ`& jãf7)YÔ÷{ã°Iéˆç\tüÛì_ÌW’Ì‹†VO¨zùÂHóÜŠ°˜…^ÆÁß$<Œ ‘Rº¢ÎSª#¯§ˆZ‚£û)5Iæ”]³2.qŤ„Ì#½XX5  Ñ¿ž,‡%u½¸(F/Q ”¤óq˜ ZU£vÁ*Ü’½¤€8P›Ð[¿l"Ìë4Ù—æÙQ‹ƒ Q}ŸÒt,jðœLÕ•ZïªË—8dž6@y$¿ ¡½cdŸôRØpÉê•©ØÊ/ãåÈÆ“äxD÷ê€eoÝîÍÒœ³öß«s.|F³©` }zÆLƒcÛMÀ :R{ÝøÝ¢{]Wlš0‘c‡2óçi Ü•õq.øãé` ‡Õù¥:…x_v]ñ¾‰©ßâýº¦']˜YR„ª€œn‚/^ªÇÌLÀ±ÉRŒp®©²Lö°?ÏÉðG»xÏ’±CáÅ”v Ð"eòý[j¾\±wÕ*Ý<^]õé$+«ÒßÓo¸ßÜr˜ r`áµgÉŸ¼q\4_])­&Ž4 ¸Yà©øâꈴ\ýXTþ³ÊZ?œÄOv93€µõƒjÒhÚ o¾íO $FY8µ¤tÙjLÏóM)ƒJ:úD"! ƒ¤jÌZ<ol%ü¨ó‘ëŠa“V“}Æ¿É5çÚ}ñmòÐù0mL Bkr1È0üÊrêŽ{è"Ìòº „sÓCÄFà£ÓéÎÙÌÁ~oÙIî‘oy Ï‘‹(c¸¸¿¾3S`®<$>›ˆ7OÆÖó7øôª8û%Øš—ó¢ìéçÐ+Ê­HD¨Ðˆ‡[щ¥S˜ “횀2T¶¤G{†«fôòÀ8d\Õ/TíKÜïáOU(†'›Ðì1Ÿ½De‹±«Ž…ŸE–Q×2ßÒó“± àa)‡j./¤Múnø *6%†¦8|Ï•8o]AÐkZoÁ¾o¥‹"Nùšq>„(¶!1~½t…{zBÖn©Ã*èð®>›ûN€ý¨£?ŒŠµ¶:È{Š3ZlV ÛjR¬žXÔæ‡Bß» "QK±7X¬¢ ÜŒ¿4·¡;/Q ÒfNfFÖ·9èÞÝ’›€w>}ˆæî~w,îõŒøürƒ÷H)Æ•;±e‹òšôg-ÝåË›Uš0Þ†Øzñ}†Âݤ0Yê+ä?”¦^žw<ð›ºb{¹l¬/»dto[Ð~Nóè{}Qmc,‘ EÏ̾M`÷ºç‰/+{ÙÇT¨•”Õmû¸æ=þ~•gìÙ·èpß>ðéØUZ{׉ Á³fþJæ\þ ¼×€„ñèÔ`Àé¯èmÇwiq`Izµt|D³Êt`ÿÄθ`íÑ¡þµöÆ>šøñæÔ¹zfhisîîœ[ÓÛÁ뻕š¿?‹=‡ˆ:¬gWßÄ)¦¼®¹ã»!°?!{òÊ–„83K.¬TD‘ÆÔ©úÔ—p˜;)|­±û9®¬6÷–Òª*DJ…Mf7Ž¿=†O-² „Jv&µÙªè]_±CžæAï×Ï­GòÓ†#}½EkiN¾^2—¤N¨•ñJÓƒ-ÆKÙ©Ùg¨¯'˜Ï?Yñꎚ›\Ù3TKÀê¹úŸðù“3»SwŸ…|~§×ö ï¾¹×@U;ÌÚγê·ä€Þ}‰æ… íϸPÂÐôãšè¡EÇw<÷üÕ~Gõw~æ€J~ý;Šù.6brÀ 'ñ1xŽ·GÍ\PâÛ08É•Ÿ"ù ôgKxÛ€P¯…ç%y 0•ÄfEwùŒÁ4Õ]ÒŽ€$èvV•§êŒXµ€ Ø‘-RšËy@Ð~¿®õ54®{g‘3‡t|í©%Éx9†§w®ª‘Z棴¬5JFP…IœFÒùæ '¿žOËÌH’/çÊJNSÚzƒ¯+Kl˜ ˜”ñ4Âà 2Ê "¡Z ±tBägF9žÇ>$žó>N›8‚¢ô|ÃØëð;¾¦¨LÒ.RßÐÝb Þ—w ßÄìn]#)Ú¤X´j\¯¨sõÌÁ‡Çש³”š­t>ÄŒUª6×~Å£ióó5ÍÚ:X|D¥\·ãeY‘A‘+Ôi°Þžˆ ‡‹4×V†ÉÅú`n.]øŠ3(`™I©\âäÔ×L§Ú²ôê–‘3–³ýŒ>þž D󡙢"«2Ç_øÒŸàÀy¦sMKòiW‹o;t²ç¢Ëw“®”öз ›Õ‹,´'´y‡oNq×¾w±˜¾¤1 ZnŒ`™½òØê:tIì‡_oŒP˜k±©FÄ<Ìda/Ït› K2ÎO~í£SlXú§/ÞT¸&ıuãÉsùÔÿ¤ÉŒsV¸šNÖ'Ô WˆIRjeÝ=íbÇ5½¾pÒÄn`Ÿ»¥æ›ÏvPmDþªónz<Î*Óèt'×Gf=v?X*©]ãh 6÷’:ô×ð½½¼,5­½¶wü®Â˵ù,+^#ªø¢øŽxuKõÒ…ÙèIô‰ð¾<Òj[òkªZ¹ä<ÑÅ”%ó¶g‚¦† %êÑèý HÖ õU&8yb—‰ôœ;45æÚÿv+8üºAF¨G5oØ@RnEÑgRC:Œ) ™èÕÂõTóÉÇ+Ò'n¤tìž'qx-ôm¦ï­qr¯Y™M l•«4-.E3õòñ1\!í~ÖQ_ý}~ʾøã—"ŽüsÜ-ر´*™…oÑ—4e2c»¾8X[~m’"ýßg7‡-„>«èV¬÷U'ÜkÅ7§¥Š>µÄ„î`êçåÇŸû×^â¤\•Ñg6Y H —ÔjÍiv&ÇLoÈmß½nˆ&$uîœqsšPðh®jH„øý ‚²T#ž¿ z -(hÊPU袮ê%c‡¹î>n¹ÝâiƒGúC[Ô‘otàV£Úòc!Â8qc*yÚÙT*Ç’Ÿ2~H¶#æ£Ã‰¸ìJºÍÅ?÷‡™üòÕ(nÄZN‘ª·‘LËãàòpØL|ÈD«ÛP‡F|HÛäÓäC­08§»,®ò"ê—'OGtc‘™qÈ0Q²è‡ž0}ÉÌᑺ¨^vôF«–ë™åîP„·ÕF ¥Å~¯­«ŠüÖ´ úQ®†ÿù…Jg–åüŽ+™ÂÂ嬿`É{Í6X;w6¿+·ÂŠMÓ8Ù¹·Hº©VÎùOÜŸ¾ÔÖØ& Wëg&Û±OÖu | ;‹ô#UtÙ/™m™Íºáò¥¾9´r 7hÊqhtE.{L¢_Ú2ö˜a¸8‰‹®ø=`uÜ0ÀlÒ·¸; ºóâÿ˜ >ÆBÑlJ Rø%);+üyÓj²PF —Õ¯Y@øÊ û4Ád*¿¤ò|‘†üec°Æ“Ñ <Ø¿«L×ãb§ÚM™KqjkÏ’‘Óg&,͈•À±4ŒYòw-MQ-R»J%²¾Âtƒ/¸<¥JY dzó¶üx/ÏAgïZ{£ÉÑz[˜6=Ýpñ–ž•ƲMfVŒ=Jó#E+µß4FŠûvÉÿØÇü‚ù¹=^観átÏÈçK%›Â ,^}:â·Ì‹Ǣæ½W9=¼º¿Q‚&ºÝfMH%1¼¬Ä´:œjcȶ§D¸åïn¤¾R…óÛº.X–"»¤æo¤œ1€`°“ºÔêÁ«R¿öé½CŪß–1vgŠJn$âB½½Ô?wÇ*Ån.#òÃ\×dtd ˜ðàÛ¤á;¢ÙÓ¹Œ“ìa%P@íißÖWº×o.’‘R³’ýî‡+¡[ b¿L"øñr8Ɉ i—ß%‹A±à§IF€ó¡òÃvÌHΨ縈ÿö–"¯‰µ\úPRã‡øU6ÑÐ¥”§}æãwéÇÈÛŠ?FÈÆ“d]ÁPÒ–T¦5ƒö—W:£ãÒèìh ívkR‡)¶vÆÊå$¥_X˜P×&ÓYÌ/à^l¹§¯üËýi¯¨r¤æß½dúXàqP†Y1žñì+̧–%ä´ä¸0¾N‡ÝÉÏòô¿šN]¸ c$Q2&Øjô® ·žÓÞÛkàØ†öGˆc¨l^ß\ ·#ŒX#°œè˜”GR£²Ùrÿj—¥¯íE^SqØž‘ÄÔÐF_….1÷v6–^Ëi’C«`§Ú0o€Ëð‰UZ%ΛG¹¼‰Çõƒ†^rsvúåü-l¯{ûyÒ¯ ½ªºRxÜHR³ûŽØÅÝjhé´ÃÁ”ÖP܇#>ñcœ·ÔܯR^»· ¹8|2Vaü ›˜ÑÃE§òæ'ÚÏîÁÎÖ“Ãæ”¾°Ññj,=˜hiE¨hùW´ÎÁÂè}¦.°ï8g%ÈrŽ£c¦žÕÇ6ô$¡äWØ ¢;÷J¸Ööpòë:_/ D‚—„Ѐ"¼s¯Ô&P9C`Ô¹è=u¯v»aØí…}—¸@ººCj¤3?äí ’ê¹¯¨;1ñåí˜aÚœ“öÝ,„¥x tFáZÈl%®t;ß>ãÆ­£Ñï×ûa §áЕ¨[F½ƒÞèº^¶âÅ#M0©LîRt¨î ûÝ]WÕœÅ}ã5,™þˆ8‚CnÜË»ù€rŸKVÒ?¯¿ÿ™½åüÊÿVÁ“EèŒf8´Ú¡;-yÖL+ó×*Gx¢2üª³}ËÈ6í7·ˆO ÔYj."òF…È—f–<ÌnXz= $1mCøë¬CŸ+ñæpY_|ye¦ä·6t”8¤*©«L:ŽÙMeo' ÈûÙâ—-Å_ŸÕŸS³:Û1ˆ*×g—1¤L'g-Ö¹thR@ój­w³Á2°¼|5ƒS]J˜Ð~Œ5ˆ#MŠó-½thÃPáì. ¶À‘=é&¿f‡bŠàlCð€µ'ªAfÏzÚÌVÜ4¡J Ýø˜H‹R¸z0ëNÿ ŸÛlè «A×NbÌä³ÝK“ß8¤ãZÈ®) ¹©Ú7.üÞ˜çÇ“»êF,%Õ-u„Ò®Ÿé‘°ˆ½ ¢v0Áî‘sÚ«ià“6½a6 /ŠŸ¡]¶†YàÈ>`Ñ̾šJâj€CV”T£á¹— ¡™ãò*¥@Ë¡æºËãŽðv&4‚ºe á~ 4sØõ°ÇŠã32·×«€ð>ëP}½~òé})Ó‰§!ÖĥǢک#²CµšLHëÉÙ­ •†ÚxnI´!3Ïá{CYàe­ã;ÑúQ™¼É±ùÅ€7§ÌSœc«,´ÝO)·_üû]×ûCXäxJ™÷€Š/ß ¼õ«aÚÍœÝꉲÂR æä‡´Ôê6ÈpJ4«•™ô }ðèÈH°ü˲Ð̨RI S©,çžß{ñœr$õGnB·&˜Ø‚=‘m1Þöí¯‹_+©³ô=mÓ ¡è]ݱà Èð *Êžêplwçí5T_ˆâ.fìòæ8 ´Ïñ—h`PËx¥¢:6+EVx€R½¦Z¶¢ì‡|À1tì!ÎļǀM¢„ó[•<‡…DÅÑ9ªóbX)ôšv*á(D¿ˆ»>¸‡‡×»šbö 弤f_fÅ'òóó¸ééhÓĘxf¦³žO˜é•;Sà}qü‘¾èª¢7„o“„“0ïŸ>ŠúäBSzÀ®_}­KH±„ÅÎd™Ñþ’™»a:eˆ`/4ê±Ø\;…çHŠ£^ìPR¸{_r!y¤ü]f©Q6#˜ô2ó ^h×äéÙí!Øò>²¨±ÖGE‡áà¼Äæ‹r’µÕj΃nñû·Ä´n’LáN2ƒx®wL îÀŒYÞWŠCû˜“Uv2¸ÝŨ_Š1ó?.|K~í0±ÈP+øé-2Šùp³Ÿ dÕ'ô:käHDõGÉ ×Þ!u©ÿˆê»äÈÒž¦Ÿú´‡»[ùê%m:¼gÂæ=Y Hñ4°Ÿ@Q°°§F2È̃°ÂyMΑ¼¨þm}úWä±^ð*âzæ‚^>?—áZØõËv¼ï³„†ÈWaX…ìÔÂ+Ú¡ÁtmˆUÁDEH;Ο t¥B41Ç ré[±P2§ÓºŸƒi©ãë¥-ÊcHÁ«Ä93µi‘nl<'à}J„¨Ö("™?Q Ù9·¹RÈvvœÎàtyRU¾*|Ú&õÒrü©Îã¼Öy.: îKÝh•ƒïkä'¼‘²“²2'õy›$/48Òöý«”vçc`ùj¨þîdv¾1£1“(…=™ßÖ×Ê5\«ù³Tœà·B0â#s'yä$§ íθ6h£“Ôß[Ö¯Æ÷È‹¦åœ}˜™Þå¶0Òç2þrˆo}›6DŒn¼PhñcåcòĶ€,¡[BX]Ì./›3Ç”$êWɾӊKØâ_¤òz íèOkP|hzÒ•êB¹¾c/¥#Î\£ù9ü²ŒÂk¶&ž¤Æs•"j¬}S4Saˆnæ¤E^–„Én zó½O‚/¦‚ÇŸÝe¯jÛ>"ZÆñz½gsS@X÷Ç~BJnƒÞü Ø“ÁëÝ—^Ó€m¨'¯‡)³“¤iC™StŸ‘ç5hêË ÁuP¶*¡ìnï‡'’p9éÁÄ—…dPÄ8¥NP•¯™šfh¼ ‹ ¶qVœwr?¤•z(ãLÂE)zk"‰-Žäç§g.Úk:ÛgIñTwÿÇ ¶aTN%¾³ê÷hÁ;B´f>™’é\h1n¬¨ÏôƒÎ.F÷‘GÀVQ†Ïݦí;Ï$$×l-ܨɳ?#Ü1\=W)˜sx¹µRèoøI›µ—‚ëÓg×p¤í_ˆ „áW€Ñþ·¬aÝ äZ3°"‡ˆ{ÎúëßV¹AÏXòBV(¹ˆÙÛŸ(Éü4†68ø¸Ñ’ÒsSZ)£8+ëÅ­(R$ye†š­²Êh»ZÙ2ûRà †H)žˆ‡0àA‡ÙQù»›µœg.ýèbR [´U)²¯†CÛ«¥ÐUµÄ¥Ö§dÁŠò®ì°ü Ø7(Þ§<4ÚVh©ÁQ~)Á'>ˆ€4Ø5zçª7Ò5ñaØ«­Ljq_‡Í(ï°Ûq}Õ«b]=‹„AV;tY¼ÛçPDöf{˜e‹­Ù Ù&hs±á{vÿûLñøÑnš ûöÐs&ïñàˉm¬Òƒ¿Õ>Ý©y)ÝÊ%kû¥w”ŒDþœÆI°ù{s»<Ë×?qŸƒ=n.U#¦87Ñòy¡Ýog6€\èïà{Bо¡¶—ÐŒUEËA¥ažVŽFDLö^bE~GëWšÄtHð|ÀÔâ{KVÙåË\Û)f¤¬ÚA2™¢–W‘7Gªä7©ÍC5`>‚žmsü&hÙ4" IsDÎÄö[£ ï,#ßAzZ­CÁÕ·Q#°›l¯¬wí›Ô»‹ø1aùÊ{§Ñ#˜£(H¼Â£>¢¶ú_–uHÜk‰-ÄV¼ª;Éwo Ö>Àò7㶯­‘ *ç.&Ùúš¢÷-m '0§‘à\ùphUp«14Æ4è 3¢«zsKÇÅú=ŽÛÍ(e¬¢¿³mß¹×V•ëj˜À 3JAÀ ÈîaZ°š…)·% kÈrèt,‡®µÒˆ¹9N×OM»¼ö˜xà¶‹¹¦…ÁÌŠ‹¸Èwü–•ù§åÝñ¨|êV¾u‹ñë»÷Ç~ÌÔò”P%|µÚ0¥ä6s®=”ÑcŠ6Ç<á4: -êÔ°4¹}xž|ûl—#ioxgò2¶ <¨ ÈÄ›ˆ_·©áìL×xl}3¥~`ú#LÌN1Òî’D$}ZºúŠdÑC­ž¤F¥À±y•Zÿ¿°õ¢^Òä(¿ßóŒ+aÿ€m¤Š2ÒkIqc{Ó‰bù#bMn”ûˆ×®ïÀcýðLmÚ] !n¨vèÐ9ï.Üh_é1öÛ&¼‡Lzœ9G6GÜ’ï6¼Ó ŸúÏ.ZØQ²ÁØTËÁc'4+ŠÃcªÎÁKl½Vlð7=>…TA£"t×Qyš£ƒ\vd5Ó²·je2ô}ïJxž]¤qÜß <ÌkáaLêÇ“¤e{ÖCÏò¿yƒ4xDîùS ÉÚñÂÅeo\•O“ÁõŒqÙ[ÿú\AyàÕßÄQŸ±‚—~n/¯Ç6ø£Å£·³3ø¢2YÙ•Eu}°À¬U™?»q Ù¦ _û}õŸòhÍךේ¹³© ‹wê‰B|ˆIo“ˆbìú ‚ö/WÉû®Ðá1–ebWÆÞWK©×z ?";A3|w‘‡w‚ñuß§Ãò‘ò5=v‘êÕ÷'_Ï&A ‰©ª_8HHN»ÁF®Á9eÒÍÒ`ùZ\´»DzääÕŒ(Ó¥zÙ8̺Ê×ÕsôV£¯ÖÙ_Îý÷Ê©oòôUuÀrФÖ,[¡°s½Íbkic×do´£÷³â¾k½}æì¡gXœ½N÷'**Œ¤^kï2·RsÎ"‰4Šž§ØÀ¢’Î`sé¥5êÔ3C-¯¶ŸY²Ë úZX¦È¥Èªéä—IÔS¼IÓskÆ ¹{òpúÍbsuùoDĆ]ïq`è+æhZ«¨²2ÜW$²Cöõ_Ùzìb}†ahÂ=µMò‰E<[S5 >NlˆJµíï’:ë@õ‰àÕרÆa¾ÄÔ1îFù«c!›õÿŠ\;!: Õ¬ÕçœmxxÚf«]Ã^x~޼O+™HÅ#{`!ŸXÐÝ* }-B D”\ÅÂ~‘ª¸f¸÷éé|´H%¤X Õèø Ž¿´Ö>ËM÷Êí ~Þîêcý¬ãDÓG¾ `ÎÖ8oÃ$õÇi¼›úû$Y!ú Êe%¥"¸2AÎèµÜiýyáëŽË àÑ»ÙfêŸ÷ÚÞ1¨i)=ìoL³I¥œ,sz1g •Œ‹¥eÇWÚ¸ª;Š1BsMDÈCld¢N+Ð e©¿:ô¨‡ß)S(æK] ¶D—î•(˜2+ô6ÐøÕŠãPYâ/è&Ôv{8ÍÔ5XâÚKP¦lQq <ì(e¡a–kC0À<òߥlãn>=bþ<â'í+xsþy`^ªsò5͆քc1¥Ûç÷IOv'\ßcÛÞÄšGëÁ¾=3RWb®Dô7(SÐG&eMÐø¨õ•&ùu¨xÉD—ÝønbÀåxÆÍî¦eR½P*w[Oäw¨IÇ]6/JçƒÇ`²[:=4iÄ”Vo‹ad^'ý¨Š6³Á˜L'D ¢s¢y$ã5lžçè OSœÏ›ŸïíèÊ8œåò›òcI·WwwÚrW•nÑÊþ†ûûGxbºÖYU‚βµ9Uêrë·´^–½h{íÁS¸DÉÈ7!{ˆY• Ó _XeÞYÀ%¹„\EW5öF¨Ks5ñ‚”“-©2ù^ý|ܲ®¢y(Y1îÏ[—B›jÂèbãQ7é*ª2#‘ VÏ9\«™D¥P¤ŠL~êYÀ~˜:Ô¯ŠüÀcàS¿¹{Ô¿þaÄãc9ºáÜ+N9s–XWðî¡@Æ?uLUÀ«Ì>úU^ª>­ã­מ¸Ã€‰n™AÅ ¡±ÙûužŽ4õÆÚj¤®ÿ…KœÌK¥€²‚6á–cvìõg¸ì&‹©yö,›©†gµ¯«7îü"Å‚‰„2êz0Ù5 #oeÙÊO†”}/>ÊKšõÌŸsòŸ×L·\tóˆí ½"RªôÃ[Ž´™¢±$Í2+« áF«àƒ¤ìóÁü Êâþu½eã„@+OO 3X²–×ÝÁŸ/L½ék4–&¶ß|Ô­y_¥tÄ­2[w»OdcÐË¢kì©e–=g†¢ìW Êíè’§tBÔ4¸Rèçè2h9ÐÔT ¼¼Ì ðð99 ^V¥ùy†úŸYж+ãjL¸Çª;úÖŒ\¼ Dp[ߤõh$S,ŠÄŒ$æÌíZar®îúqÙÏ )€µl¡Ó‰Çgyƒ¬Ü-/r1ãl«.b†!¹æ¦B;Ôçp‚:ÌÂ×”=µAÔfG¸ÍfÛZ{ ½ì0ÚWíGyÒNŽ­nÑUÿ9lHJó× é1RàdÐåÁù×åðp¢Ö¯ÅEpŸ•y ôv§ÔžÉ Xôç'ÝÀëw®`œ€„° N4L’ çmšoTÑìŽïqXÂq†êÔ¥M-½rä>£ssµÓïÁÖn8'ŽòÁ¼ß¶1(ìÍg²Õ);ÚF8òŠË;­—ú1Yö•Ï$µå I„Í»RÒ¶Yû0Ɔ×F á€VÏJ]ÒDXR}F†Ûe‘2yú·’™f§-Ö.D 5ÏF&ÐTzHÕF—†¦¶Ê—pÔg)£ÀDtš „-ä°sqª»Ý•Í{¦%ò·-ðáM 3¶áëaÀ'yx®Ë;{:÷UÃÂhôó¶ò:[K-…Ì nž˜•ã\ŒZkS?Ãoì‘dýý«]qØ&ŸÙ¨î½ÒYzE¾`ëC€w^jM%‡øî¯ù+}° ÒâUšutÕÝBÀ22$ñ¢Êà¾ë •brë:`ÁÙ"¤Èujá×^p¤¸kl¶d™¸÷íè„’z’Y7Þ §”*õÕô.ºÜñé£.šª%,´ŠAä<õ/4`¸–þÑI¯ÙÕà8ð£Hßlß… ·Kç§¾›¦m¦ÊeNgÚlp¶äA¿v$‰ìËlõXÚ»û&÷r8–Kafs/ËËÇ¿ ‹!x-ù@L 5á5«ô+SñA•¶Ò]D}[~£ÈÜco† ï a].A ðDéùÔω˜ÔÌ›»ŸÛ†0™½5?ý®²< E`iSüÆA|CÕyP ¾®—û¥Ò3Ù[*?xÇJ¼-¦A$ƒû v全m˜-upláÇ[F“@¡v€ ÁŠÞv뽨 ÀèÄ„Ÿý-ÏÁ‚è_„$5°®ôÜ"IÒîO™¿YM…Í0Rðæ™—DLxF‚èÎ ŠéÏ(S7?\o½¥‰‘×Û€jKŽ ¼UitfÂ,™/fÙñrà™tÆñUwïÌû½·Å»žÐæ¶Ú‘Q…Øu+ÅJ4¯a‘¤z -ÃxeÓ´ž8M;b#Žm¸I>Æ òîŸîÏ,é-ëQbhB÷þ 3yhyh”5%n"áey TšUôzÔ8:á­ÏQ¥Š\`çÅ=BÎD‰5 7«N…$…¹øáVu×ø‘¥rÈ{ ð p>H3K*àôEZdË÷%Xcl!ø‹.Ï y&5a×ò›“åi8íŸFÏb@‘\µþHàBvœæˆI:÷@@ÎYG..ìçj_uf›¸¡ýö…T7ó–á”0‰›Ïô­ã*« >Vh7ÒS»ª× ɸ‘õÖIlìÊpÚG*þ“êÈ$À<¢”·¯ûñ+€¬èà}à(®t+wv$*¸^¬¦Ì«lDÀ«çG8W¶V¶koú -á1]ꢟšù55šk¾KÆzD À%ëó?—?¾QÌð7 åg’•bûto}cß4å±^W«wñÒ¼+6ÞËD‚çsé}¸©ï}‘‹Ïr‰K tÜ€à×=y™íˆ2É‚ÒpÎ\²Ò.['ô+²¥¢}dhRfÜ穟žà.{8F }úÑ3”‡¾f0ñàL®¸i‹<ଳݿÆý€é6á3†®SÆò¿þ­=êÆnpÑU endstream endobj 169 0 obj << /Producer (pdfTeX-1.40.22) /Creator (TeX) /CreationDate (D:20230516164646+02'00') /ModDate (D:20230516164646+02'00') /Trapped /False /PTEX.Fullbanner (This is pdfTeX, Version 3.141592653-2.6-1.40.22 (TeX Live 2021 Gentoo Linux) kpathsea version 6.3.3) >> endobj 143 0 obj << /Type /ObjStm /N 37 /First 309 /Length 1799 /Filter /FlateDecode >> stream xÚ­XYSÛ8ϧÐ#Ì‘uX–gvvBi)²mw:}0‰ Þ:6µ–î§ßŸ,9‡“ИÉèúß§3ÉI@˜ ‰T!æˆè@aŽ !#Œs»„)m@‹†0"œ…ö$&\É€DD0­{\!'{j‚m¨%xáLc¯CN¢˜ˆ89D2³€H®Ñ1‘"€ #Þc 0âP€AMÁH„<¥ˆŒ ³âDê $&】PbŽ üÛHÈXþ˜u ŽXp©ÁHš¤$¨` ƒÂЊó0SÚâhHTï“`¼4õÜÑññ£ä}Et˜`}áG»×2<Šã>œÙàjP  Ý—ðEÔçðªl°cð,†ž g(Töm4UÔgAK‰£Hi˪Ykª8Äh¦ZÉÏ fÖ[néF¥£™ÖV΢7- ¥kË4 73-…ýÈãÛÓÖþæ4¶£;‰Eä1渎@a/A¡m®,Áœ‡ÜÚî80Æ×„ásïÏ?{ôêç½!ô¨ÈëCSÊô¾.Ê^³&@®/' Î>2@–ÜVD:Œƒƒâ|ÚCìq[1LÀ½að¹G÷«‘Ék¢b`’û7&½½ÃV«µb,lYàqdéh?¿Í zô²6“÷ˆZÜ£=‘”–Ç]R^ššìÐ}z@ô¾¢¯ézLßÒSzF‡ô=§ô’^Ñkúž~ ÿЄÞÐÓqjJS¥5ô ý’~ÇTLKzKïhJÿ¥МæinhA Œ÷ôÞ”i1¦%­he¾›œÖ´¾+¡õ‚Néú@ÒÿvŽR¨Î¤D?¹èýõ×o9upýöÍðN=;fÁz§¢“À©¶= ^wªxÌ©{L¶nEO™{U°E¯:‹—-RÛXôú|xõÑY´!MÐÀ¼Eh¬/c‘ ·²HocÑùõßo>œÂ¢‹M!Bóöñs šå½Š7š3Oû#Ÿø¥ýM™Œ¾š:3_êv]Z®¨‡Q‘9ÆÉ$AmÚH£&'Õ]S¾D²y•Üý¼¿CØbùº¶\’Òä¬få$ùúF¿M‹Ú4Ðfå ®´&©ÓÆY•>t í{[jô?SK±„Û·ˆåÉÙÅÉþ{ÄòòŸMÁä1Ù‹qã2ô}Eá<˜ˆìÓ²SÃy3Í2ƒp¤å(3£âþgYÓIšO«e#ù6FÏÃW0òjsS }Æ2._ªõF#mvÚÜL|Ò¤P›@ò¦D¸§ËoÕEO.‡¯‡Öà«% {…}T౫s[2×ngærÎ_¢@O/QTe•Ù¢³jf¥ê dû þ6M²Îw[š·Z™©*†_—ð}6­º‹RuÊ/ì4›²¥™×îJånu¯\Þ^\61Ž×‡Xùã‘«býìGòY=øýˆð&ø®Jò1M*Ûòª¯/ñ&Öæa”%“­CžO'7P.½ýuô­¯–² éàã›ì·šúsrdÃM Moêfkƒ¤2²úP]J©æ¯žeIÒ²ªmLñï¨GO¿a<êÑ鸾«€ëú.½*®sX3†FÛëÓ}ãuõ‰ºú„zA»iÕOðF÷=Ö•ÿ¾ôx{é·SGxÈºÂ­Š ¡ ¡`/ŠîõßÕGtõ Õ ´ ¶Þ½–»ÂÃG#¿ï ¡P]gð'8£skvõYÉK¹ä ¾àuõÛëÓéð]uVUˆê„¿¡Îyrk*tõbjïˆö¥½ìÇ–†ø$WäSà ܛ‰7¯â¬ÅÛ°™t“‡ŸŸÂ\7a$1s“ßÅNd ü=™?ž°ŽkÍð{Þîµ›ÿ• ¦gLg¶W“‰5¤ï¦u†?•iû¨ —ýXÕlZå[ÊW‰|™ïã=éVÞ´–ê¼4ßíw¯Åx6”*šQʵ”CóPÛ/g«”bF,QÚïms¡þ.ò&yœIž«7i/óoSwŸø'ÏþrAOÅWõl;øðÇø |:¨ã3ó±Ôðñÿû=¹ÊGÎ<.åc|ý®ñ¿œù_nðCºü¾ ‘;{l—pW9;{|—¸[ŠìØãvìÚöé7é×?tùKOÓIZ·-èsWà#O+íÆ3íÊu8- 0bâ”uY~€¬ÈQ»öã³#Œ@èšÏ޶ÇޤǞõàôx—„ÞºWxqf¨»Àv_ê!°DÅK¼*œxeŽ_A”—{œWx6gIù.q¯*²sõî}1|]ÜÕd.ˡ̔ñÆ%óqÚÍÒÏëcµÌ—@L­ùw1H qqÛs­mÞ-ÛvµpWXÛS,þ™½GèuefÍ ¼ÿ6– endstream endobj 170 0 obj << /Type /XRef /Index [0 171] /Size 171 /W [1 3 1] /Root 168 0 R /Info 169 0 R /ID [ ] /Length 438 /Filter /FlateDecode >> stream xÚÓÉNTAÆñó54MÒ (¨L€ˆ(8¶ ‚6Š¢Ì(* !¬Lˆñ |€ZW&nÜ☰õtï;èý›_Î9U§êÞ[u#"þ)¢ŠÜ~F~6rEA–>“¦"4(f†œc´ rŠâG׎æ¡ P ôë  ªõÓÞÞÄhò¼‹07aÂ3X?AIÑøÝ …ãp‰U΀&¸J­¨NÂ-jmD-Ð cÔNGjN=Ù«<§æotæ¨y©sÐKÔ¼['tCœ‡ Ð ]ŠRűDzúM¿ýnýp†`@ѼíÉ|Ää—†kŠö²;®Ã ¸ #ÙÀÊpGÑñÇé]‡{ŠÎ×îÃL(ú]›„ix üáÍýugà‘bø¯ç=†§0 óðD1òÞ>£eXP”×ÜñV_®Â+x©¨Ì»¶¯á ¬ÃlÂ[ØbùPNsÙ]8ônRì 8Ê®è— GUŠÃOŽª¥î_ŽòÒø®£é]£‚ôíƒ#.pâ%nNâ¤ç›8ßÄ©¦.àhSOöÓŒfQû3þG endstream endobj startxref 133320 %%EOF unuran-1.11.0/doc/version.texi0000644001357500135600000000014114430713446013164 00000000000000@set UPDATED 21 April 2023 @set UPDATED-MONTH April 2023 @set EDITION 1.11.0 @set VERSION 1.11.0 unuran-1.11.0/doc/unuran_win32.info0000644001357500135600000004765314430713451014032 00000000000000This is unuran_win32.info, produced by makeinfo version 7.0.3 from unuran_win32.texi. Copyright © 2000–2007 Institut fuer Statistik, WU Wien. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. INFO-DIR-SECTION Scientific software START-INFO-DIR-ENTRY * unuran_win32: (unuran_win32). Using UNU.RAN with Microsoft Visual C END-INFO-DIR-ENTRY  File: unuran_win32.info, Node: Top, Next: Installation, Up: (dir) Using UNU.RAN with Microsoft Visual C ************************************* * Menu: * Installation:: Installation of binary distribution * URNG:: Uniform random number generator * IDE:: Building your own project in Visual Studio * CLI:: Building your own project on the command line * Examples:: Two Examples This is the online-documentation of UNU.RAN. Version: 1.11.0 Date: 21 April 2023 This document describes how to use Microsoft Visual Studio to create a C or C++ project and link the target with UNU.RAN. UNU.RAN (http://statmath.wu.ac.at/unuran) (Universal Non-Uniform RAndom Number generator) is a collection of algorithms for generating non-uniform pseudorandom variates as a library of C functions designed and implemented by the ARVAG (http://statmath.wu.ac.at/arvag) (Automatic Random VAriate Generation) project group in Vienna, and released under the GNU Public License (GPL). This binary distribution also has support for Pierre L’Ecuyers RngStreams (http://statmath.wu.ac.at/software/RngStreams) library. This library is already compiled into the distributed DLL, the corresponding header file is included in this package. The DLL is linked against the C run-time library ‘MSVCRT.lib’. Thus the file ‘MSVCR80.DLL’ must be available at run time for applications linked with UNU.RAN and ‘MSVCRT.lib’ (i.e., included in the envirenment variate ‘PATH’). For details see the Microsoft Visual C++ (http://msdn2.microsoft.com/en-us/library/60k1461a(VS.80).aspx) manual.  File: unuran_win32.info, Node: Installation, Next: URNG, Prev: Top, Up: Top 1 Installation of Binary Distribution ************************************* 1. Download unuran-1.11.0-win32.zip from the UNU.RAN download (http://statmath.wu.ac.at/unuran/download.html) page. 2. Unpack unuran-1.11.0-win32.zip. It creates directory ‘unuran’ which contains the following files: ‘unuran.h’ Header file to be included in your application source file. (Contains function prototypes, typedefs and macros.) ‘RngStream.h’ ‘unuran_urng_rngstreams.h’ Header files required for using the ‘RngStream’ library. ‘libunuran111.def’ Module-definition file. (Declares all functions exported the UNU.RAN library.) ‘libunuran111.dll’ ‘libunuran111.dll.manifest’ DLL (Dynamic link library) and its manifest file (must always be located in the same directory). ‘libunuran111.lib’ Import library file. ‘libunuran111.exp’ Library export file. ‘unuran.pdf’ UNU.RAN User Manual. ‘unuran_win32.pdf’ Short description for building your own application using UNU.RAN with Microsoft Visual C. ‘example1.c’ ‘example2.c’ Two example files. 3. _Optional:_ Move directory ‘unuran’ into an appropriate place, e.g. ‘C:\unuran’ (or maybe the folder where you build your application). Throughout this document, the UNU.RAN installation folder is referred to as ‘’. For example, if UNU.RAN has been installed in the folder ‘C:\unuran’, references to ‘\libunuran111.lib’ represent ‘C:\unuran\libunuran111.lib’. 4. _Optional:_ Add ‘’ to the ‘PATH’ environment variable. Thus your application can find the location of libunuran111.dll when it is started.  File: unuran_win32.info, Node: URNG, Next: IDE, Prev: Installation, Up: Top 2 Uniform Random Number Generator ********************************* This binary distribution uses Pierre L’Ecuyers RngStreams (http://statmath.wu.ac.at/software/RngStreams) library as its default uniform random number generator. This library uses a package seed. Thus you should add the following piece of code at the beginning of your application (at least before you call any of the UNU.RAN functions): unsigned long seed[] = {111u, 222u, 333u, 444u, 555u, 666u}; RngStream_SetPackageSeed(seed); where ‘111u’, ..., ‘666u’ should be replaced by your seeds. _Remark:_ UNU.RAN works with any source of uniform random numbers. We refer to the UNU.RAN for details if you want to use your own uniform random number generator instead of the ‘RngStreams’ library.  File: unuran_win32.info, Node: IDE, Next: CLI, Prev: URNG, Up: Top 3 Building Your Own Project in Visual Studio ******************************************** _Note:_ The information below applies to the Visual C++ .NET 2005. Let us assume that you want to build a target named ‘example.exe’ and have: • a source file named ‘example.c’ which uses the C API of the UNU.RAN library (or alternatively a C++ file ‘example.cpp’); • a folder where this file is located and which we refer to as ‘’. One way to build your project is to create a _Solution_ named ‘example.sln’ as described here. 1. Start Microsoft Visual Studio .NET 2005. 2. Build the ‘example.sln’ solution: From the ‘File’ menu, select ‘New’, and then ‘Project’. When the ‘New Project’ dialog box appears then − In the ‘Project Types’ pane, select ‘Visual C++ Win32 Projects’. − In the ‘Templates pane’, select the ‘Win32 Console Project’ icon. − Fill in the project name (‘example’). − If necessary, correct the location of the project (to ‘’). − Click ‘OK’. When the Win32 Application Wizard appears then − Click on ‘Application Settings’. − Select ‘Console Application’ as application type. − Make sure that ‘Empty Project’ is checked in ‘Additional Options’. − Click ‘Finish’. This creates a solution, ‘example’, with a single project, ‘example’. You can view the contents of the solution by selecting ‘Solution Explorer’ in the ‘View’ menu. 3. Add your source file to the project. From the ‘Project’ menu, choose ‘Add Existing Item’: − Move to folder ‘’ and select ‘example.c’. − Click ‘Add’. 4. Set some options so that the project knows where to find the UNU.RAN include files and the UNU.RAN libraries. − From the ‘Project’ menu, choose ‘example Properties’. The ‘example Property Pages’ dialog box appears. − In the ‘Configuration’ drop-down list, select ‘Release’. − Select ‘C/C++’ in the ‘Configuration Properties’ tree. − Select ‘General’. − In the ‘Additional Include Directories’ field . add directory ‘’; . choose ‘No’ for ‘Detect 64-bit Portability Issues’. − Select ‘Linker’ in the ‘Configuration Properties’ tree. . Select ‘General’ and then select ‘Additional Library Directories’. . Add directory ‘’. . Select ‘Input’ and then select ‘Additional Dependencies’. Add library file ‘libunuran111.lib’. − Click ‘OK’ to close the ‘example Property Pages’ dialog box. 5. Set the default project configuration. − From the ‘Build’ menu, select ‘Configuration Manager’. − Select ‘Release’ in the ‘Active Solution Configuration’ drop-down list. − Click ‘Close’. 6. Finally, to build the project, from the ‘Build’ menu, select ‘Build Solution’. After completion of the compiling and linking process, the target is created. The full path of the executable is ‘\example\Release\example.exe’. Notice that, if you want to run the ‘example.exe’ by clicking on it, you need to locate the DLL file in the same directory or adjust the ‘PATH’ environment variable for the DLL (*note Installation::).  File: unuran_win32.info, Node: CLI, Next: Examples, Prev: IDE, Up: Top 4 Building Your Own Project on the Command Line *********************************************** First you have to set the appropriate environment variables to enable 32-bit command-line builds by means of the ‘vcvars32.bat’ file: 1. At the command prompt, change to the ‘\bin’ subdirectory of your Visual C++ installation. 2. Run ‘vcvars32.bat’ by typing ‘VCVARS32’. Then change to your application folder ‘’) that contains your source file(s) (C or C++). Assume you have one C source file ‘example.c’. Then you can compile and link your executable by cl /O2 /W3 /MD /I example.c libunuran111.lib /link /LIBPATH: which creates the file ‘example.exe’. When you want to run ‘example’ then the location of the DLL libunuran111.dll (and that of the C run-time library ‘msvcr80.dll’) have to be included in the environment variable ‘PATH’ (or you need to locate these DLLs in the same directory).  File: unuran_win32.info, Node: Examples, Next: Example1, Prev: CLI, Up: Top 5 Two Examples ************** Here we give small examples. These show • How to seed the seed for the RngStreams (http://statmath.wu.ac.at/software/RngStreams) library. • How to create an UNU.RAN generator for a given target distribution. For more detailed information we refer to the UNU.RAN manual (http://statmath.wu.ac.at/unuran/doc/unuran.html). • How to use an independent stream of uniform random numbers for one of these UNU.RAN generators. • We demonstrate the usage of the easy to use String API. • We furthermore show the same example with the more flexible C API. * Menu: * Example1:: The String API * Example2:: The C API  File: unuran_win32.info, Node: Example1, Next: Example2, Prev: Examples, Up: Examples 5.1 The String API ================== /* ------------------------------------------------------------- */ /* File: example1.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header files. */ #include #include /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; int k; /* will hold the random number */ /* Declare UNU.RAN objects. */ UNUR_GEN *gen1, *gen2, *gen3; /* generator objects */ /* Declare objects for uniform random number generators. */ UNUR_URNG *urng2; /* uniform RN generator object */ /* -- Optional: Set seed for RNGSTREAMS library -------------- */ /* The RNGSTREAMS library sets a package seed. */ unsigned long seed[] = {111u, 222u, 333u, 444u, 555u, 666u}; RngStream_SetPackageSeed(seed); /* -- Example 1 ---------------------------------------------- */ /* Beta distribution with shape parameters 2 and 3. */ /* Use method 'AUTO' (AUTOmatic). */ /* Create generator object. */ gen1 = unur_str2gen("beta(2,3)"); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen1' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen1 == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* Now you can use the generator object `gen1' to sample from */ /* the target distribution. Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen1); printf("%f\n",x); } /* -- Example 2 ---------------------------------------------- */ /* Student's t distribution with 3 degrees of freedom. */ /* Use method 'TDR' (Transformed Density Rejection) with */ /* "immediate acception" */ gen2 = unur_str2gen("student(3) & method=TDR; variant_ia"); if (gen2 == NULL) exit (EXIT_FAILURE); /* However, this time we use a (new) independent stream of */ /* uniformrandom numbers. */ urng2 = unur_urng_rngstream_new("urng2"); unur_chg_urng( gen2, urng2 ); /* Draw a sample. */ for (i=0; i<10; i++) { x = unur_sample_cont(gen2); printf("%f\n",x); } /* -- Example 3 ---------------------------------------------- */ /* Discrete distribution with given probability vector. */ /* Use method 'DGT' (Discrete Guide Table method). */ gen3 = unur_str2gen("discr; pv=(0.5,1.5,1.0,0.3) & method=DGT"); if (gen3 == NULL) exit (EXIT_FAILURE); /* we use the default URNG again. So there is nothing to do. */ /* Draw a sample. Notice that we get integers! */ for (i=0; i<10; i++) { k = unur_sample_discr(gen3); printf("%d\n",k); } /* -- Call destructor ---------------------------------------- */ /* When generators are not needed any they can be destroyed. */ unur_free(gen1); unur_free(gen2); unur_urng_free(urng2); unur_free(gen3); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */  File: unuran_win32.info, Node: Example2, Prev: Example1, Up: Examples 5.2 The C API ============= /* ------------------------------------------------------------- */ /* File: example2.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header files. */ #include #include /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; int k; /* will hold the random number */ /* Declare UNU.RAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen1, *gen2, *gen3; /* generator objects */ /* Declare objects for uniform random number generators. */ UNUR_URNG *urng2; /* uniform RN generator object */ /* -- Optional: Set seed for RNGSTREAMS library -------------- */ /* The RNGSTREAMS library sets a package seed. */ unsigned long seed[] = {111u, 222u, 333u, 444u, 555u, 666u}; RngStream_SetPackageSeed(seed); /* -- Example 1 ---------------------------------------------- */ /* Beta distribution with shape parameters 2 and 3. */ /* Use method 'AUTO' (AUTOmatic). */ /* Create distribution object. */ { double fparams[] = {2., 3.}; distr = unur_distr_beta( fparams, 2 ); } /* Choose a method: 'AUTO'. */ par = unur_auto_new(distr); /* Create the generator object. */ gen1 = unur_init(par); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen1' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen1 == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen1' to sample from */ /* the target distribution. Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen1); printf("%f\n",x); } /* -- Example 2 ---------------------------------------------- */ /* Student's t distribution with 3 degrees of freedom. */ /* Use method 'TDR' (Transformed Density Rejection) with */ /* "immediate acception" */ /* Create distribution object. */ { double fparams[] = {3.}; distr = unur_distr_student( fparams, 1 ); } /* Choose a method: 'TDR'. */ par = unur_tdr_new(distr); /* ... and change to immediate acceptance. */ unur_tdr_set_variant_ia(par); /* However, this time we use a (new) independent stream of */ /* uniformrandom numbers. */ urng2 = unur_urng_rngstream_new("urng2"); unur_set_urng( par, urng2 ); /* Create the generator object. */ gen2 = unur_init(par); if (gen2 == NULL) exit (EXIT_FAILURE); /* Destroy distribution object. (We do not need it any more.) */ unur_distr_free(distr); /* Draw a sample. */ for (i=0; i<10; i++) { x = unur_sample_cont(gen2); printf("%f\n",x); } /* -- Example 3 ---------------------------------------------- */ /* Discrete distribution with given probability vector. */ /* Use method 'DGT' (Discrete Guide Table method). */ /* Create distribution object. */ { double probs[] = {0.5, 1.5, 1.0, 0.3}; distr = unur_distr_discr_new(); unur_distr_discr_set_pv(distr, probs, 4); } /* Choose a method: 'DGT'. */ par = unur_dgt_new(distr); /* we use the default URNG again. So there is nothing to do. */ /* Create the generator object. */ gen3 = unur_init(par); if (gen3 == NULL) exit (EXIT_FAILURE); /* Destroy distribution object. (We do not need it any more.) */ unur_distr_free(distr); /* Draw a sample. Notice that we get integers! */ for (i=0; i<10; i++) { k = unur_sample_discr(gen3); printf("%d\n",k); } /* -- Call destructor ---------------------------------------- */ /* When generators are not needed any they can be destroyed. */ unur_free(gen1); unur_free(gen2); unur_urng_free(urng2); unur_free(gen3); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */  Tag Table: Node: Top458 Node: Installation2051 Node: URNG4052 Node: IDE4925 Node: CLI8688 Node: Examples9763 Node: Example110535 Node: Example214528  End Tag Table  Local Variables: coding: utf-8 End: unuran-1.11.0/src/0000755001357500135600000000000014430713513010705 500000000000000unuran-1.11.0/src/parser/0000755001357500135600000000000014430713513012201 500000000000000unuran-1.11.0/src/parser/stringparser_doc.dh0000644001357500135600000006307614430713435016025 00000000000000/* =NODE KeysDistr Keys for Distribution String =UP StringDistr [10] =DESCRIPTION List of standard distributions @pxref{Stddist,,Standard distributions} @itemize @minus @item @code{[distr =] beta(@dots{})} @ @ @ @ @result{} @pxref{beta} @item @code{[distr =] binomial(@dots{})} @ @ @ @ @result{} @pxref{binomial} @item @code{[distr =] cauchy(@dots{})} @ @ @ @ @result{} @pxref{cauchy} @item @code{[distr =] chi(@dots{})} @ @ @ @ @result{} @pxref{chi} @item @code{[distr =] chisquare(@dots{})} @ @ @ @ @result{} @pxref{chisquare} @item @code{[distr =] exponential(@dots{})} @ @ @ @ @result{} @pxref{exponential} @item @code{[distr =] extremeI(@dots{})} @ @ @ @ @result{} @pxref{extremeI} @item @code{[distr =] extremeII(@dots{})} @ @ @ @ @result{} @pxref{extremeII} @item @code{[distr =] F(@dots{})} @ @ @ @ @result{} @pxref{F} @item @code{[distr =] gamma(@dots{})} @ @ @ @ @result{} @pxref{gamma} @item @code{[distr =] geometric(@dots{})} @ @ @ @ @result{} @pxref{geometric} @item @code{[distr =] gig(@dots{})} @ @ @ @ @result{} @pxref{gig} @item @code{[distr =] gig2(@dots{})} @ @ @ @ @result{} @pxref{gig2} @item @code{[distr =] hyperbolic(@dots{})} @ @ @ @ @result{} @pxref{hyperbolic} @item @code{[distr =] hypergeometric(@dots{})} @ @ @ @ @result{} @pxref{hypergeometric} @item @code{[distr =] ig(@dots{})} @ @ @ @ @result{} @pxref{ig} @item @code{[distr =] laplace(@dots{})} @ @ @ @ @result{} @pxref{laplace} @item @code{[distr =] logarithmic(@dots{})} @ @ @ @ @result{} @pxref{logarithmic} @item @code{[distr =] logistic(@dots{})} @ @ @ @ @result{} @pxref{logistic} @item @code{[distr =] lognormal(@dots{})} @ @ @ @ @result{} @pxref{lognormal} @item @code{[distr =] lomax(@dots{})} @ @ @ @ @result{} @pxref{lomax} @item @code{[distr =] negativebinomial(@dots{})} @ @ @ @ @result{} @pxref{negativebinomial} @item @code{[distr =] normal(@dots{})} @ @ @ @ @result{} @pxref{normal} @item @code{[distr =] pareto(@dots{})} @ @ @ @ @result{} @pxref{pareto} @item @code{[distr =] poisson(@dots{})} @ @ @ @ @result{} @pxref{poisson} @item @code{[distr =] powerexponential(@dots{})} @ @ @ @ @result{} @pxref{powerexponential} @item @code{[distr =] rayleigh(@dots{})} @ @ @ @ @result{} @pxref{rayleigh} @item @code{[distr =] slash(@dots{})} @ @ @ @ @result{} @pxref{slash} @item @code{[distr =] student(@dots{})} @ @ @ @ @result{} @pxref{student} @item @code{[distr =] triangular(@dots{})} @ @ @ @ @result{} @pxref{triangular} @item @code{[distr =] uniform(@dots{})} @ @ @ @ @result{} @pxref{uniform} @item @code{[distr =] weibull(@dots{})} @ @ @ @ @result{} @pxref{weibull} @end itemize List of generic distributions @pxref{Distribution_objects,,Handling Distribution Objects} @itemize @minus @item @code{[distr =] cemp} @ @ @ @ @result{} @pxref{CEMP} @item @code{[distr =] cont} @ @ @ @ @result{} @pxref{CONT} @item @code{[distr =] discr} @ @ @ @ @result{} @pxref{DISCR} @end itemize @emph{Notice}: Order statistics for continuous distributions (@pxref{CORDER}) are supported by using the key @code{orderstatistics} for distributions of type @code{CONT}. List of keys that are available via the String API. For description see the corresponding UNU.RAN set calls. @itemize @bullet @item All distribution types @table @code @item name = "@i{}" @result{} @pxref{funct:unur_distr_set_name,,@command{unur_distr_set_name}} @end table @item @code{cemp} @ @i{(Distribution Type)}@ @ @ @ (@pxref{CEMP}) @table @code @item data = (@i{}) [, @i{}] @result{} @pxref{funct:unur_distr_cemp_set_data,,@command{unur_distr_cemp_set_data}} @item hist_bins = (@i{}) [, @i{}] @result{} @pxref{funct:unur_distr_cemp_set_hist_bins,,@command{unur_distr_cemp_set_hist_bins}} @item hist_domain = @i{}, @i{} | (@i{}) @result{} @pxref{funct:unur_distr_cemp_set_hist_domain,,@command{unur_distr_cemp_set_hist_domain}} @item hist_prob = (@i{}) [, @i{}] @result{} @pxref{funct:unur_distr_cemp_set_hist_prob,,@command{unur_distr_cemp_set_hist_prob}} @end table @item @code{cont} @ @i{(Distribution Type)}@ @ @ @ (@pxref{CONT}) @table @code @item cdf = "@i{}" @result{} @pxref{funct:unur_distr_cont_set_cdfstr,,@command{unur_distr_cont_set_cdfstr}} @item center = @i{} @result{} @pxref{funct:unur_distr_cont_set_center,,@command{unur_distr_cont_set_center}} @item domain = @i{}, @i{} | (@i{}) @result{} @pxref{funct:unur_distr_cont_set_domain,,@command{unur_distr_cont_set_domain}} @item hr = "@i{}" @result{} @pxref{funct:unur_distr_cont_set_hrstr,,@command{unur_distr_cont_set_hrstr}} @item logcdf = "@i{}" @result{} @pxref{funct:unur_distr_cont_set_logcdfstr,,@command{unur_distr_cont_set_logcdfstr}} @item logpdf = "@i{}" @result{} @pxref{funct:unur_distr_cont_set_logpdfstr,,@command{unur_distr_cont_set_logpdfstr}} @item mode = @i{} @result{} @pxref{funct:unur_distr_cont_set_mode,,@command{unur_distr_cont_set_mode}} @item pdf = "@i{}" @result{} @pxref{funct:unur_distr_cont_set_pdfstr,,@command{unur_distr_cont_set_pdfstr}} @item pdfarea = @i{} @result{} @pxref{funct:unur_distr_cont_set_pdfarea,,@command{unur_distr_cont_set_pdfarea}} @item pdfparams = (@i{}) [, @i{}] @result{} @pxref{funct:unur_distr_cont_set_pdfparams,,@command{unur_distr_cont_set_pdfparams}} @item orderstatistics = @i{}, @i{} | (@i{}) Make order statistics for given distribution. The first parameter gives the sample size, the second parameter its rank. (see @pxref{funct:unur_distr_corder_new,,@command{unur_distr_corder_new}}) @end table @item @code{discr} @ @i{(Distribution Type)}@ @ @ @ (@pxref{DISCR}) @table @code @item cdf = "@i{}" @result{} @pxref{funct:unur_distr_discr_set_cdfstr,,@command{unur_distr_discr_set_cdfstr}} @item domain = @i{}, @i{} | (@i{}) @result{} @pxref{funct:unur_distr_discr_set_domain,,@command{unur_distr_discr_set_domain}} @item mode [= @i{}] @result{} @pxref{funct:unur_distr_discr_set_mode,,@command{unur_distr_discr_set_mode}} @item pmf = "@i{}" @result{} @pxref{funct:unur_distr_discr_set_pmfstr,,@command{unur_distr_discr_set_pmfstr}} @item pmfparams = (@i{}) [, @i{}] @result{} @pxref{funct:unur_distr_discr_set_pmfparams,,@command{unur_distr_discr_set_pmfparams}} @item pmfsum = @i{} @result{} @pxref{funct:unur_distr_discr_set_pmfsum,,@command{unur_distr_discr_set_pmfsum}} @item pv = (@i{}) [, @i{}] @result{} @pxref{funct:unur_distr_discr_set_pv,,@command{unur_distr_discr_set_pv}} @end table @end itemize =EON */ /* =NODE KeysMethod Keys for Method String =UP StringMethod [10] =DESCRIPTION List of methods and keys that are available via the String API. For description see the corresponding UNU.RAN set calls. @itemize @bullet @item @code{method = arou} @ @ @ @ @result{} @command{unur_arou_new} (@pxref{AROU}) @table @code @item cpoints = @i{} [, (@i{})] | (@i{}) @result{} @pxref{funct:unur_arou_set_cpoints,,@command{unur_arou_set_cpoints}} @item darsfactor = @i{} @result{} @pxref{funct:unur_arou_set_darsfactor,,@command{unur_arou_set_darsfactor}} @item guidefactor = @i{} @result{} @pxref{funct:unur_arou_set_guidefactor,,@command{unur_arou_set_guidefactor}} @item max_segments [= @i{}] @result{} @pxref{funct:unur_arou_set_max_segments,,@command{unur_arou_set_max_segments}} @item max_sqhratio = @i{} @result{} @pxref{funct:unur_arou_set_max_sqhratio,,@command{unur_arou_set_max_sqhratio}} @item pedantic [= @i{}] @result{} @pxref{funct:unur_arou_set_pedantic,,@command{unur_arou_set_pedantic}} @item usecenter [= @i{}] @result{} @pxref{funct:unur_arou_set_usecenter,,@command{unur_arou_set_usecenter}} @item usedars [= @i{}] @result{} @pxref{funct:unur_arou_set_usedars,,@command{unur_arou_set_usedars}} @item verify [= @i{}] @result{} @pxref{funct:unur_arou_set_verify,,@command{unur_arou_set_verify}} @end table @item @code{method = ars} @ @ @ @ @result{} @command{unur_ars_new} (@pxref{ARS}) @table @code @item cpoints = @i{} [, (@i{})] | (@i{}) @result{} @pxref{funct:unur_ars_set_cpoints,,@command{unur_ars_set_cpoints}} @item max_intervals [= @i{}] @result{} @pxref{funct:unur_ars_set_max_intervals,,@command{unur_ars_set_max_intervals}} @item max_iter [= @i{}] @result{} @pxref{funct:unur_ars_set_max_iter,,@command{unur_ars_set_max_iter}} @item pedantic [= @i{}] @result{} @pxref{funct:unur_ars_set_pedantic,,@command{unur_ars_set_pedantic}} @item reinit_ncpoints [= @i{}] @result{} @pxref{funct:unur_ars_set_reinit_ncpoints,,@command{unur_ars_set_reinit_ncpoints}} @item reinit_percentiles = @i{} [, (@i{})] | (@i{}) @result{} @pxref{funct:unur_ars_set_reinit_percentiles,,@command{unur_ars_set_reinit_percentiles}} @item verify [= @i{}] @result{} @pxref{funct:unur_ars_set_verify,,@command{unur_ars_set_verify}} @end table @item @code{method = auto} @ @ @ @ @result{} @command{unur_auto_new} (@pxref{AUTO}) @table @code @item logss [= @i{}] @result{} @pxref{funct:unur_auto_set_logss,,@command{unur_auto_set_logss}} @end table @item @code{method = cstd} @ @ @ @ @result{} @command{unur_cstd_new} (@pxref{CSTD}) @table @code @item variant = @i{} @result{} @pxref{funct:unur_cstd_set_variant,,@command{unur_cstd_set_variant}} @end table @item @code{method = dari} @ @ @ @ @result{} @command{unur_dari_new} (@pxref{DARI}) @table @code @item cpfactor = @i{} @result{} @pxref{funct:unur_dari_set_cpfactor,,@command{unur_dari_set_cpfactor}} @item squeeze [= @i{}] @result{} @pxref{funct:unur_dari_set_squeeze,,@command{unur_dari_set_squeeze}} @item tablesize [= @i{}] @result{} @pxref{funct:unur_dari_set_tablesize,,@command{unur_dari_set_tablesize}} @item verify [= @i{}] @result{} @pxref{funct:unur_dari_set_verify,,@command{unur_dari_set_verify}} @end table @item @code{method = dau} @ @ @ @ @result{} @command{unur_dau_new} (@pxref{DAU}) @table @code @item urnfactor = @i{} @result{} @pxref{funct:unur_dau_set_urnfactor,,@command{unur_dau_set_urnfactor}} @end table @item @code{method = dgt} @ @ @ @ @result{} @command{unur_dgt_new} (@pxref{DGT}) @table @code @item guidefactor = @i{} @result{} @pxref{funct:unur_dgt_set_guidefactor,,@command{unur_dgt_set_guidefactor}} @item variant = @i{} @result{} @pxref{funct:unur_dgt_set_variant,,@command{unur_dgt_set_variant}} @end table @item @code{method = dsrou} @ @ @ @ @result{} @command{unur_dsrou_new} (@pxref{DSROU}) @table @code @item cdfatmode = @i{} @result{} @pxref{funct:unur_dsrou_set_cdfatmode,,@command{unur_dsrou_set_cdfatmode}} @item verify [= @i{}] @result{} @pxref{funct:unur_dsrou_set_verify,,@command{unur_dsrou_set_verify}} @end table @item @code{method = dstd} @ @ @ @ @result{} @command{unur_dstd_new} (@pxref{DSTD}) @table @code @item variant = @i{} @result{} @pxref{funct:unur_dstd_set_variant,,@command{unur_dstd_set_variant}} @end table @item @code{method = empk} @ @ @ @ @result{} @command{unur_empk_new} (@pxref{EMPK}) @table @code @item beta = @i{} @result{} @pxref{funct:unur_empk_set_beta,,@command{unur_empk_set_beta}} @item kernel = @i{} @result{} @pxref{funct:unur_empk_set_kernel,,@command{unur_empk_set_kernel}} @item positive [= @i{}] @result{} @pxref{funct:unur_empk_set_positive,,@command{unur_empk_set_positive}} @item smoothing = @i{} @result{} @pxref{funct:unur_empk_set_smoothing,,@command{unur_empk_set_smoothing}} @item varcor [= @i{}] @result{} @pxref{funct:unur_empk_set_varcor,,@command{unur_empk_set_varcor}} @end table @item @code{method = gibbs} @ @ @ @ @result{} @command{unur_gibbs_new} (@pxref{GIBBS}) @table @code @item burnin [= @i{}] @result{} @pxref{funct:unur_gibbs_set_burnin,,@command{unur_gibbs_set_burnin}} @item c = @i{} @result{} @pxref{funct:unur_gibbs_set_c,,@command{unur_gibbs_set_c}} @item thinning [= @i{}] @result{} @pxref{funct:unur_gibbs_set_thinning,,@command{unur_gibbs_set_thinning}} @item variant_coordinate @result{} @pxref{funct:unur_gibbs_set_variant_coordinate,,@command{unur_gibbs_set_variant_coordinate}} @item variant_random_direction @result{} @pxref{funct:unur_gibbs_set_variant_random_direction,,@command{unur_gibbs_set_variant_random_direction}} @end table @item @code{method = hinv} @ @ @ @ @result{} @command{unur_hinv_new} (@pxref{HINV}) @table @code @item boundary = @i{}, @i{} | (@i{}) @result{} @pxref{funct:unur_hinv_set_boundary,,@command{unur_hinv_set_boundary}} @item cpoints = (@i{}), @i{} @result{} @pxref{funct:unur_hinv_set_cpoints,,@command{unur_hinv_set_cpoints}} @item guidefactor = @i{} @result{} @pxref{funct:unur_hinv_set_guidefactor,,@command{unur_hinv_set_guidefactor}} @item max_intervals [= @i{}] @result{} @pxref{funct:unur_hinv_set_max_intervals,,@command{unur_hinv_set_max_intervals}} @item order [= @i{}] @result{} @pxref{funct:unur_hinv_set_order,,@command{unur_hinv_set_order}} @item u_resolution = @i{} @result{} @pxref{funct:unur_hinv_set_u_resolution,,@command{unur_hinv_set_u_resolution}} @end table @item @code{method = hitro} @ @ @ @ @result{} @command{unur_hitro_new} (@pxref{HITRO}) @table @code @item adaptive_multiplier = @i{} @result{} @pxref{funct:unur_hitro_set_adaptive_multiplier,,@command{unur_hitro_set_adaptive_multiplier}} @item burnin [= @i{}] @result{} @pxref{funct:unur_hitro_set_burnin,,@command{unur_hitro_set_burnin}} @item r = @i{} @result{} @pxref{funct:unur_hitro_set_r,,@command{unur_hitro_set_r}} @item thinning [= @i{}] @result{} @pxref{funct:unur_hitro_set_thinning,,@command{unur_hitro_set_thinning}} @item use_adaptiveline [= @i{}] @result{} @pxref{funct:unur_hitro_set_use_adaptiveline,,@command{unur_hitro_set_use_adaptiveline}} @item use_adaptiverectangle [= @i{}] @result{} @pxref{funct:unur_hitro_set_use_adaptiverectangle,,@command{unur_hitro_set_use_adaptiverectangle}} @item use_boundingrectangle [= @i{}] @result{} @pxref{funct:unur_hitro_set_use_boundingrectangle,,@command{unur_hitro_set_use_boundingrectangle}} @item v = @i{} @result{} @pxref{funct:unur_hitro_set_v,,@command{unur_hitro_set_v}} @item variant_coordinate @result{} @pxref{funct:unur_hitro_set_variant_coordinate,,@command{unur_hitro_set_variant_coordinate}} @item variant_random_direction @result{} @pxref{funct:unur_hitro_set_variant_random_direction,,@command{unur_hitro_set_variant_random_direction}} @end table @item @code{method = hrb} @ @ @ @ @result{} @command{unur_hrb_new} (@pxref{HRB}) @table @code @item upperbound = @i{} @result{} @pxref{funct:unur_hrb_set_upperbound,,@command{unur_hrb_set_upperbound}} @item verify [= @i{}] @result{} @pxref{funct:unur_hrb_set_verify,,@command{unur_hrb_set_verify}} @end table @item @code{method = hrd} @ @ @ @ @result{} @command{unur_hrd_new} (@pxref{HRD}) @table @code @item verify [= @i{}] @result{} @pxref{funct:unur_hrd_set_verify,,@command{unur_hrd_set_verify}} @end table @item @code{method = hri} @ @ @ @ @result{} @command{unur_hri_new} (@pxref{HRI}) @table @code @item p0 = @i{} @result{} @pxref{funct:unur_hri_set_p0,,@command{unur_hri_set_p0}} @item verify [= @i{}] @result{} @pxref{funct:unur_hri_set_verify,,@command{unur_hri_set_verify}} @end table @item @code{method = itdr} @ @ @ @ @result{} @command{unur_itdr_new} (@pxref{ITDR}) @table @code @item cp = @i{} @result{} @pxref{funct:unur_itdr_set_cp,,@command{unur_itdr_set_cp}} @item ct = @i{} @result{} @pxref{funct:unur_itdr_set_ct,,@command{unur_itdr_set_ct}} @item verify [= @i{}] @result{} @pxref{funct:unur_itdr_set_verify,,@command{unur_itdr_set_verify}} @item xi = @i{} @result{} @pxref{funct:unur_itdr_set_xi,,@command{unur_itdr_set_xi}} @end table @item @code{method = mvtdr} @ @ @ @ @result{} @command{unur_mvtdr_new} (@pxref{MVTDR}) @table @code @item boundsplitting = @i{} @result{} @pxref{funct:unur_mvtdr_set_boundsplitting,,@command{unur_mvtdr_set_boundsplitting}} @item maxcones [= @i{}] @result{} @pxref{funct:unur_mvtdr_set_maxcones,,@command{unur_mvtdr_set_maxcones}} @item stepsmin [= @i{}] @result{} @pxref{funct:unur_mvtdr_set_stepsmin,,@command{unur_mvtdr_set_stepsmin}} @item verify [= @i{}] @result{} @pxref{funct:unur_mvtdr_set_verify,,@command{unur_mvtdr_set_verify}} @end table @item @code{method = ninv} @ @ @ @ @result{} @command{unur_ninv_new} (@pxref{NINV}) @table @code @item max_iter [= @i{}] @result{} @pxref{funct:unur_ninv_set_max_iter,,@command{unur_ninv_set_max_iter}} @item start = @i{}, @i{} | (@i{}) @result{} @pxref{funct:unur_ninv_set_start,,@command{unur_ninv_set_start}} @item table [= @i{}] @result{} @pxref{funct:unur_ninv_set_table,,@command{unur_ninv_set_table}} @item u_resolution = @i{} @result{} @pxref{funct:unur_ninv_set_u_resolution,,@command{unur_ninv_set_u_resolution}} @item usebisect @result{} @pxref{funct:unur_ninv_set_usebisect,,@command{unur_ninv_set_usebisect}} @item usenewton @result{} @pxref{funct:unur_ninv_set_usenewton,,@command{unur_ninv_set_usenewton}} @item useregula @result{} @pxref{funct:unur_ninv_set_useregula,,@command{unur_ninv_set_useregula}} @item x_resolution = @i{} @result{} @pxref{funct:unur_ninv_set_x_resolution,,@command{unur_ninv_set_x_resolution}} @end table @item @code{method = nrou} @ @ @ @ @result{} @command{unur_nrou_new} (@pxref{NROU}) @table @code @item center = @i{} @result{} @pxref{funct:unur_nrou_set_center,,@command{unur_nrou_set_center}} @item r = @i{} @result{} @pxref{funct:unur_nrou_set_r,,@command{unur_nrou_set_r}} @item u = @i{}, @i{} | (@i{}) @result{} @pxref{funct:unur_nrou_set_u,,@command{unur_nrou_set_u}} @item v = @i{} @result{} @pxref{funct:unur_nrou_set_v,,@command{unur_nrou_set_v}} @item verify [= @i{}] @result{} @pxref{funct:unur_nrou_set_verify,,@command{unur_nrou_set_verify}} @end table @item @code{method = pinv} @ @ @ @ @result{} @command{unur_pinv_new} (@pxref{PINV}) @table @code @item boundary = @i{}, @i{} | (@i{}) @result{} @pxref{funct:unur_pinv_set_boundary,,@command{unur_pinv_set_boundary}} @item extra_testpoints [= @i{}] @result{} @pxref{funct:unur_pinv_set_extra_testpoints,,@command{unur_pinv_set_extra_testpoints}} @item keepcdf [= @i{}] @result{} @pxref{funct:unur_pinv_set_keepcdf,,@command{unur_pinv_set_keepcdf}} @item max_intervals [= @i{}] @result{} @pxref{funct:unur_pinv_set_max_intervals,,@command{unur_pinv_set_max_intervals}} @item order [= @i{}] @result{} @pxref{funct:unur_pinv_set_order,,@command{unur_pinv_set_order}} @item searchboundary = @i{}, @i{} | (@i{}) @result{} @pxref{funct:unur_pinv_set_searchboundary,,@command{unur_pinv_set_searchboundary}} @item smoothness [= @i{}] @result{} @pxref{funct:unur_pinv_set_smoothness,,@command{unur_pinv_set_smoothness}} @item u_resolution = @i{} @result{} @pxref{funct:unur_pinv_set_u_resolution,,@command{unur_pinv_set_u_resolution}} @item use_upoints [= @i{}] @result{} @pxref{funct:unur_pinv_set_use_upoints,,@command{unur_pinv_set_use_upoints}} @item usecdf @result{} @pxref{funct:unur_pinv_set_usecdf,,@command{unur_pinv_set_usecdf}} @item usepdf @result{} @pxref{funct:unur_pinv_set_usepdf,,@command{unur_pinv_set_usepdf}} @end table @item @code{method = srou} @ @ @ @ @result{} @command{unur_srou_new} (@pxref{SROU}) @table @code @item cdfatmode = @i{} @result{} @pxref{funct:unur_srou_set_cdfatmode,,@command{unur_srou_set_cdfatmode}} @item pdfatmode = @i{} @result{} @pxref{funct:unur_srou_set_pdfatmode,,@command{unur_srou_set_pdfatmode}} @item r = @i{} @result{} @pxref{funct:unur_srou_set_r,,@command{unur_srou_set_r}} @item usemirror [= @i{}] @result{} @pxref{funct:unur_srou_set_usemirror,,@command{unur_srou_set_usemirror}} @item usesqueeze [= @i{}] @result{} @pxref{funct:unur_srou_set_usesqueeze,,@command{unur_srou_set_usesqueeze}} @item verify [= @i{}] @result{} @pxref{funct:unur_srou_set_verify,,@command{unur_srou_set_verify}} @end table @item @code{method = ssr} @ @ @ @ @result{} @command{unur_ssr_new} (@pxref{SSR}) @table @code @item cdfatmode = @i{} @result{} @pxref{funct:unur_ssr_set_cdfatmode,,@command{unur_ssr_set_cdfatmode}} @item pdfatmode = @i{} @result{} @pxref{funct:unur_ssr_set_pdfatmode,,@command{unur_ssr_set_pdfatmode}} @item usesqueeze [= @i{}] @result{} @pxref{funct:unur_ssr_set_usesqueeze,,@command{unur_ssr_set_usesqueeze}} @item verify [= @i{}] @result{} @pxref{funct:unur_ssr_set_verify,,@command{unur_ssr_set_verify}} @end table @item @code{method = tabl} @ @ @ @ @result{} @command{unur_tabl_new} (@pxref{TABL}) @table @code @item areafraction = @i{} @result{} @pxref{funct:unur_tabl_set_areafraction,,@command{unur_tabl_set_areafraction}} @item boundary = @i{}, @i{} | (@i{}) @result{} @pxref{funct:unur_tabl_set_boundary,,@command{unur_tabl_set_boundary}} @item cpoints = @i{} [, (@i{})] | (@i{}) @result{} @pxref{funct:unur_tabl_set_cpoints,,@command{unur_tabl_set_cpoints}} @item darsfactor = @i{} @result{} @pxref{funct:unur_tabl_set_darsfactor,,@command{unur_tabl_set_darsfactor}} @item guidefactor = @i{} @result{} @pxref{funct:unur_tabl_set_guidefactor,,@command{unur_tabl_set_guidefactor}} @item max_intervals [= @i{}] @result{} @pxref{funct:unur_tabl_set_max_intervals,,@command{unur_tabl_set_max_intervals}} @item max_sqhratio = @i{} @result{} @pxref{funct:unur_tabl_set_max_sqhratio,,@command{unur_tabl_set_max_sqhratio}} @item nstp [= @i{}] @result{} @pxref{funct:unur_tabl_set_nstp,,@command{unur_tabl_set_nstp}} @item pedantic [= @i{}] @result{} @pxref{funct:unur_tabl_set_pedantic,,@command{unur_tabl_set_pedantic}} @item slopes = (@i{}), @i{} @result{} @pxref{funct:unur_tabl_set_slopes,,@command{unur_tabl_set_slopes}} @item usedars [= @i{}] @result{} @pxref{funct:unur_tabl_set_usedars,,@command{unur_tabl_set_usedars}} @item useear [= @i{}] @result{} @pxref{funct:unur_tabl_set_useear,,@command{unur_tabl_set_useear}} @item variant_ia [= @i{}] @result{} @pxref{funct:unur_tabl_set_variant_ia,,@command{unur_tabl_set_variant_ia}} @item variant_splitmode = @i{} @result{} @pxref{funct:unur_tabl_set_variant_splitmode,,@command{unur_tabl_set_variant_splitmode}} @item verify [= @i{}] @result{} @pxref{funct:unur_tabl_set_verify,,@command{unur_tabl_set_verify}} @end table @item @code{method = tdr} @ @ @ @ @result{} @command{unur_tdr_new} (@pxref{TDR}) @table @code @item c = @i{} @result{} @pxref{funct:unur_tdr_set_c,,@command{unur_tdr_set_c}} @item cpoints = @i{} [, (@i{})] | (@i{}) @result{} @pxref{funct:unur_tdr_set_cpoints,,@command{unur_tdr_set_cpoints}} @item darsfactor = @i{} @result{} @pxref{funct:unur_tdr_set_darsfactor,,@command{unur_tdr_set_darsfactor}} @item guidefactor = @i{} @result{} @pxref{funct:unur_tdr_set_guidefactor,,@command{unur_tdr_set_guidefactor}} @item max_intervals [= @i{}] @result{} @pxref{funct:unur_tdr_set_max_intervals,,@command{unur_tdr_set_max_intervals}} @item max_sqhratio = @i{} @result{} @pxref{funct:unur_tdr_set_max_sqhratio,,@command{unur_tdr_set_max_sqhratio}} @item pedantic [= @i{}] @result{} @pxref{funct:unur_tdr_set_pedantic,,@command{unur_tdr_set_pedantic}} @item reinit_ncpoints [= @i{}] @result{} @pxref{funct:unur_tdr_set_reinit_ncpoints,,@command{unur_tdr_set_reinit_ncpoints}} @item reinit_percentiles = @i{} [, (@i{})] | (@i{}) @result{} @pxref{funct:unur_tdr_set_reinit_percentiles,,@command{unur_tdr_set_reinit_percentiles}} @item usecenter [= @i{}] @result{} @pxref{funct:unur_tdr_set_usecenter,,@command{unur_tdr_set_usecenter}} @item usedars [= @i{}] @result{} @pxref{funct:unur_tdr_set_usedars,,@command{unur_tdr_set_usedars}} @item usemode [= @i{}] @result{} @pxref{funct:unur_tdr_set_usemode,,@command{unur_tdr_set_usemode}} @item variant_gw @result{} @pxref{funct:unur_tdr_set_variant_gw,,@command{unur_tdr_set_variant_gw}} @item variant_ia @result{} @pxref{funct:unur_tdr_set_variant_ia,,@command{unur_tdr_set_variant_ia}} @item variant_ps @result{} @pxref{funct:unur_tdr_set_variant_ps,,@command{unur_tdr_set_variant_ps}} @item verify [= @i{}] @result{} @pxref{funct:unur_tdr_set_verify,,@command{unur_tdr_set_verify}} @end table @item @code{method = utdr} @ @ @ @ @result{} @command{unur_utdr_new} (@pxref{UTDR}) @table @code @item cpfactor = @i{} @result{} @pxref{funct:unur_utdr_set_cpfactor,,@command{unur_utdr_set_cpfactor}} @item deltafactor = @i{} @result{} @pxref{funct:unur_utdr_set_deltafactor,,@command{unur_utdr_set_deltafactor}} @item pdfatmode = @i{} @result{} @pxref{funct:unur_utdr_set_pdfatmode,,@command{unur_utdr_set_pdfatmode}} @item verify [= @i{}] @result{} @pxref{funct:unur_utdr_set_verify,,@command{unur_utdr_set_verify}} @end table @item @code{method = vempk} @ @ @ @ @result{} @command{unur_vempk_new} (@pxref{VEMPK}) @table @code @item smoothing = @i{} @result{} @pxref{funct:unur_vempk_set_smoothing,,@command{unur_vempk_set_smoothing}} @item varcor [= @i{}] @result{} @pxref{funct:unur_vempk_set_varcor,,@command{unur_vempk_set_varcor}} @end table @item @code{method = vnrou} @ @ @ @ @result{} @command{unur_vnrou_new} (@pxref{VNROU}) @table @code @item r = @i{} @result{} @pxref{funct:unur_vnrou_set_r,,@command{unur_vnrou_set_r}} @item v = @i{} @result{} @pxref{funct:unur_vnrou_set_v,,@command{unur_vnrou_set_v}} @item verify [= @i{}] @result{} @pxref{funct:unur_vnrou_set_verify,,@command{unur_vnrou_set_verify}} @end table @end itemize =EON */ unuran-1.11.0/src/parser/parser.h0000644001357500135600000003776114420445767013620 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: parser.h * * * * PURPOSE: * * function prototypes for parser * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* =NODE StringAPI String Interface =UP TOP [25] =DESCRIPTION The string interface (string API) provided by the unur_str2gen() call is the easiest way to use UNU.RAN. This function takes a character string as its argument. The string is parsed and the information obtained is used to create a generator object. It returns NULL if this fails, either due to a syntax error, or due to invalid data. In both cases @code{unur_error} is set to the corresponding error codes (@pxref{Error_reporting,,Error reporting}). Additionally there exists the call unur_str2distr() that only produces a distribution object. Notice that the string interface does not implement all features of the UNU.RAN library. For trickier tasks it might be necessary to use the UNU.RAN calls. In @ref{Examples}, all examples are given using both the UNU.RAN standard API and this convenient string API. The corresponding programm codes are equivalent. =END */ /*---------------------------------------------------------------------------*/ /* Routines for user interface */ /* =ROUTINES */ UNUR_GEN *unur_str2gen( const char *string ); /* Get a generator object for the distribution, method and uniform random number generator as described in the given @var{string}. See @ref{StringSyntax,,Syntax of String Interface}, for details. */ UNUR_DISTR *unur_str2distr( const char *string ); /* Get a distribution object for the distribution described in @var{string}. See @ref{StringSyntax,,Syntax of String Interface}, and @ref{StringDistr,,Distribution String}, for details. However, only the block for the distribution object is allowed. */ UNUR_GEN *unur_makegen_ssu( const char *distrstr, const char *methodstr, UNUR_URNG *urng ); /* */ UNUR_GEN *unur_makegen_dsu( const UNUR_DISTR *distribution, const char *methodstr, UNUR_URNG *urng ); /* Make a generator object for the distribution, method and uniform random number generator. The distribution can be given either as string @var{distrstr} or as a distribution object @var{distr}. The method must be given as a string @var{methodstr}. For the syntax of these strings see @ref{StringSyntax,,Syntax of String Interface}. However, the @code{method} keyword is optional for these calls and can be omitted. If @var{methodstr} is the empty (blank) string or NULL method AUTO is used. The uniform random number generator is optional. If @var{urng} is NULL then the default uniform random number generator is used. */ /* =EON */ /*...........................................................................*/ UNUR_PAR *_unur_str2par( const UNUR_DISTR *distribution, const char *method, struct unur_slist **mlist ); /* Get a parameter object for the given distribution object and for the method described in @var{method}. See @ref{StringSyntax,,Syntax of String Interface}, and @ref{StringMethod,,Method String}, for details. However, only the block for the method is allowed. @var{mlist} is used to store memory blocks that have been allocated while parsing and making the parameter object. These blocks should (must) be free using _unur_slist_free() after initializing the generator object to avoid a memory leak. (Not part of manual!!) */ /*---------------------------------------------------------------------------*/ /* =NODE StringSyntax Syntax of String Interface =UP StringAPI [10] =DESCRIPTION The given string holds information about the requested distribution and (optional) about the sampling method and the uniform random number generator invoked. The interpretation of the string is not case-sensitive, all white spaces are ignored. The string consists of up to three blocks, separated by ampersands @code{&}. Each block consists of @code{=} pairs, separated by semicolons @code{;}. The first key in each block is used to indicate each block. We have three different blocks with the following (first) keys: @table @code @item distr definition of the distribution (@pxref{StringDistr,,Distribution String}). @item method description of the transformation method (@pxref{StringMethod,,Method String}). @item urng uniform random number generation (@pxref{StringURNG,,Uniform RNG String}). @end table The @code{distr} block must be the very first block and is obligatory. All the other blocks are optional and can be arranged in arbitrary order. For details see the following description of each block. In the following example @example distr = normal(3.,0.75); domain = (0,inf) & method = tdr; c = 0 @end example @noindent we have a distribution block for the truncated normal distribution with mean 3 and standard deviation 0.75 on domain (0,infinity); and block for choosing method TDR with parameter c set to 0. The @code{=} pairs that follow the first (initial) pair in each block are used to set parameters. The name of the parameter is given by the @code{} string. It is deduced from the UNU.RAN set calls by taking the part after @code{@dots{}_set_}. The @code{} string holds the parameters to be set, separated by commata @code{,}. There are three types of parameters: @table @emph @item string @code{"@dots{}"} or @code{'@dots{}'} i.e. any sequence of characters enclosed by double quotes @code{"@dots{}"} or single quotes @code{'@dots{}'} (there is no distinction between double quotes @code{"} and single quotes @code{'}). @item list @code{(@dots{},@dots{})} i.e. list of @emph{numbers}, separated by commata @code{,}, enclosed in parenthesis @code{(...)}. @item number a sequence of characters that is not enclosed by double quotes @code{"@dots{}"}, single quotes @code{'@dots{}'}, or parenthesis @code{(...)}. It is interpreted as float or integer depending on the type of the corresponding parameter. @end table The @code{} string (including the character @code{=}) can be omitted when no argument is required. At the moment not all @command{set} calls are supported. The syntax for the @code{} can be directly derived from the corresponding @command{set} calls. To simplify the syntax additional shortcuts are possible. The following table lists the parameters for the @code{set} calls that are supported by the string interface; the entry in parenthesis gives the type of the argument as @code{} string: @table @code @item int @i{(number)}: The @i{number} is interpreted as an integer. @code{true} and @code{on} are transformed to @code{1}, @code{false} and @code{off} are transformed to @code{0}. A missing argument is interpreted as @code{1}. @item int, int @i{(number, number} @r{or} @i{list)}: The two numbers or the first two entries in the list are interpreted as a integers. @code{inf} and @code{-inf} are transformed to @code{INT_MAX} and @code{INT_MIN} respectively, i.e. the largest and smallest integers that can be represented by the computer. @item unsigned @i{(number)}: The @i{number} is interpreted as an unsigned hexadecimal integer. @item double @i{(number)}: The number is interpreted as a floating point number. @code{inf} is transformed to @code{UNUR_INFINITY}. @item double, double @i{(number, number} @r{or} @i{list)}: The two numbers or the first two entries in the list are interpreted as a floating point numbers. @code{inf} is transformed to @code{UNUR_INFINITY}. However using @code{inf} in the list might not work for all versions of C. Then it is recommended to use two single numbers instead of a list. @item int, double* @i{([number,] list} @r{or} @i{number)}: @itemize @minus @item The list is interpreted as a double array. The (first) number as its length. If it is less than the actual size of the array only the first entries of the array are used. @item If only the list is given (i.e., if the first number is omitted), the first number is set to the actual size of the array. @item If only the number is given (i.e., if the list is omitted), the NULL pointer is used instead an array as argument. @end itemize @item double*, int @i{(list [,number])}: The list is interpreted as a double array. The (second) number as its length. If the length is omitted, it is replaced by the actual size of the array. (Only in the @code{distribution} block!) @item char* @i{(string)}: The character string is passed as is to the corresponding set call. @end table Notice that missing entries in a list of numbers are interpreted as @code{0}. E.g, a the list @code{(1,,3)} is read as @code{(1,0,3)}, the list @code{(1,2,)} as @code{(1,2,0)}. The the list of @code{key} strings in @ref{KeysDistr,,Keys for Distribution String}, and @ref{KeysMethod,,Keys for Method String}, for further details. =EON */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* =NODEX StringDistr Distribution String =UP StringAPI [20] =DESCRIPTION The @code{distr} block must be the very first block and is obligatory. For that reason the keyword @code{distr} is optional and can be omitted (together with the @code{=} character). Moreover it is ignored while parsing the string. However, to avoid some possible confusion it has to start with the letter @code{d} (if it is given at all). The value of the @code{distr} key is used to get the distribution object, either via a @command{unur_distr_} call for a standard distribution via a @command{unur_distr__new} call to get an object of a generic distribution. However not all generic distributions are supported yet. The parameters for the standard distribution are given as a list. There must not be any character (other than white space) between the name of the standard distribution and the opening parenthesis @code{(} of this list. E.g., to get a beta distribution, use @example distr = beta(2,4) @end example To get an object for a discrete distribution with probability vector (0.5,0.2,0.3), use @example distr = discr; pv = (0.5,0.2,0.3) @end example It is also possible to set a PDF, PMF, or CDF using a string. E.g., to create a continuous distribution with PDF proportional to @code{exp(-sqrt(2+(x-1)^2) + (x-1))} and domain (0,inf) use @example distr = cont; pdf = "exp(-sqrt(2+(x-1)^2) + (x-1))" @end example @noindent Notice: If this string is used in an unur_str2distr() or unur_str2gen() call the double quotes @code{"} must be protected by @code{\"}. Alternatively, single quotes may be used instead @example distr = cont; pdf = 'exp(-sqrt(2+(x-1)^2) + (x-1))' @end example For the details of function strings see @ref{StringFunct,,Function String}. =EON */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* =NODEX StringMethod Method String =UP StringAPI [30] =DESCRIPTION The key @code{method} is obligatory, it must be the first key and its value is the name of a method suitable for the choosen standard distribution. E.g., if method AROU is chosen, use @example method = arou @end example Of course the all following keys dependend on the method choosen at first. All corresponding @command{set} calls of UNU.RAN are available and the key is the string after the @command{unur__set_} part of the command. E.g., UNU.RAN provides the command @command{unur_arou_set_max_sqhratio} to set a parameter of method AROU. To call this function via the string-interface, the key @code{max_sqhratio} can be used: @example max_sqhratio = 0.9 @end example @noindent Additionally the keyword @code{debug} can be used to set debugging flags (see @ref{Debug,,Debugging}, for details). If this block is omitted, a suitable default method is used. Notice however that the default method may change in future versions of UNU.RAN. =EON */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* =NODEX StringURNG Uniform RNG String =UP StringAPI [40] =DESCRIPTION The value of the @code{urng} key is passed to the PRNG interface (see @ifinfo @xref{Top,,Overview,prng,PRNG Manual}. @end ifinfo @ifnotinfo @uref{http://statmath.wu.ac.at/prng/manual/,PRNG manual} @end ifnotinfo for details). However it only works when using the PRNG library is enabled, see @ref{Installation} for details. There are no other keys. IMPORTANT: UNU.RAN creates a new uniform random number generator for the generator object. The pointer to this uniform generator has to be read and saved via a unur_get_urng() call in order to clear the memory @emph{before} the UNU.RAN generator object is destroyed. If this block is omitted the UNU.RAN default generator is used (which @emph{must not} be destroyed). =EON */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/parser/stringparser_lists.ch.in0000644001357500135600000003422214420445767017022 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: stringparser_lists.ch.in / stringparser_lists.ch * * * * * * DESCRIPTION: * * * * Switch lists for string parser. * * (See file stringparser.c) * * * ***************************************************************************** * * * This file is parsed by the perl script make_stringparser.pl which * * replaces the * * =INPUT keyword * * tags with search lists created from the information found within the * * header files of the source code. * * These lists (implemented via 'if' rules together with switch lists to * * with the first letter of the set calls as simple hash function) are * * used to call the corresponding ..._set and ..._new calls for the * * the keywords found in the string. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*****************************************************************************/ /** Distributions **/ /*****************************************************************************/ struct unur_distr * _unur_str_distr_new( char *distribution ) /*----------------------------------------------------------------------*/ /* get new distribution object */ /* */ /* parameters: */ /* distribution ... string that contains distribution name */ /* params ... string that contains list of parameters */ /* */ /* return: */ /* distribution object (pointer to structure) */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_distr *distr = NULL; /* pointer to distribution object */ char distr_unknown; #ifdef UNUR_ENABLE_LOGGING char *name; /* pointer to name of distribution */ #endif char *params; /* pointer to parameter list of distr */ double *darray = NULL; /* array of arguments for distribution */ int n_darray = 0; /* size of array of parameters */ #ifdef UNUR_ENABLE_LOGGING /* name of distribution */ name = distribution; #endif /* get parameter list */ params = strchr(distribution,'('); if (params != NULL) { *params = '\0'; /* terminate key string */ ++params; /* set pointer to value string */ } /* get parameter list */ n_darray = _unur_parse_dlist(params, &darray ); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag & UNUR_DEBUG_SETUP) _unur_str_debug_distr(1,name,darray,n_darray); #endif /* mark distribution as unknown (this is a very ugly hack) */ distr = (struct unur_distr *) &distr_unknown; =INPUT list_of_distributions if (distr == (struct unur_distr *) &distr_unknown) { /* unknown method */ _unur_error_unknown(distribution,"distribution"); distr = NULL; } else if (distr == NULL) { /* invalid data for chosen method */ _unur_error_invalid(distribution,"distribution"); } /* clear memory */ if (darray) free(darray); /* return result */ return distr; } /* end of _unur_str_distr_new() */ /*---------------------------------------------------------------------------*/ int _unur_str_distr_set( UNUR_DISTR **ptr_distr, const char *key, char *value ) /*----------------------------------------------------------------------*/ /* set parameters for distribution */ /* */ /* it also makes a distribution object for an order statistics for */ /* the given distribution when the key word "orderstatistics" occurs. */ /* Thus the distribution object itself might be changed. */ /* */ /* parameters: */ /* ptr_distr ... holds pointer to distribution object */ /* key ... string that contains key for parameter */ /* value ... string that contains list of arguments for parameter */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* error: */ /* return error code */ /*----------------------------------------------------------------------*/ { int result; /* result of UNU.RAN set call */ /* derefence pointer to distribution object */ struct unur_distr *distr = *ptr_distr; /* storing arguments of set calls: */ char type_args[MAX_SET_ARGS+1]; /* array containing info about arguments */ char *args[MAX_SET_ARGS+1]; /* pointers to argument strings */ /* tokenize argument string */ if (_unur_str_set_args( value, type_args, args, MAX_SET_ARGS ) < 0) { /* error */ return UNUR_ERR_STR_SYNTAX; } /* set result indicator to unknown */ result = UNUR_ERR_STR_UNKNOWN; /* find and execute set call */ =INPUT list_of_distr_sets /* special keyword */ if (result == UNUR_ERR_STR_UNKNOWN) if (distr->type == UNUR_DISTR_CONT) { if ( !strcmp(key, "orderstatistics") ) { /* make order statistics and replace distribution object */ *ptr_distr = _unur_str_distr_make_os (distr, key, type_args, args); result = (*ptr_distr == NULL) ? UNUR_ERR_STR_SYNTAX : UNUR_SUCCESS; } } if (result == UNUR_ERR_STR_UNKNOWN) { /* unknown parameter */ _unur_error_unknown(key,"parameter for given distribution"); return UNUR_ERR_STR_UNKNOWN; } else if (result != UNUR_SUCCESS) { /* invalid data for parameter */ _unur_error_invalid(key,"set call"); return UNUR_ERR_STR_SYNTAX; } return UNUR_SUCCESS; } /* end of _unur_str_distr_set() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Methods **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ struct unur_par * _unur_str_par_new( const char *method, const UNUR_DISTR *distr ) /*----------------------------------------------------------------------*/ /* get new parameter object for method */ /* */ /* parameters: */ /* method ... string that contains method name */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* default parameters (pointer to structure) */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_par *par = NULL; char method_unknown; #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag & UNUR_DEBUG_SETUP) _unur_str_debug_string(1,"method",method); #endif /* mark method as unknown (this is a very ugly hack) */ par = (struct unur_par *) &method_unknown; =INPUT list_of_methods if (par == (struct unur_par *) &method_unknown) { /* unknown method */ _unur_error_unknown(method,"method"); par = NULL; } else if (par == NULL) { /* invalid data for chosen method */ _unur_error_invalid(method,"method"); } return par; } /* end of _unur_str_par_new() */ /*---------------------------------------------------------------------------*/ int _unur_str_par_set( UNUR_PAR *par, const char *key, char *value, struct unur_slist *mlist ) /*----------------------------------------------------------------------*/ /* set parameters for method */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* key ... string that contains key for parameter */ /* value ... string that contains list of arguments for parameter */ /* mlist ... list of allocated memory blocks */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int result = 0; /* result of UNU.RAN set call (0 or 1) */ /* storing arguments of set calls: */ char type_args[MAX_SET_ARGS+1]; /* array containing info about arguments */ char *args[MAX_SET_ARGS+1]; /* pointers to argument strings */ /* tokenize argument string */ if (_unur_str_set_args( value, type_args, args, MAX_SET_ARGS ) < 0) { /* error */ return UNUR_ERR_STR_SYNTAX; } /* set result indicator to unknown */ result = UNUR_ERR_STR_UNKNOWN; /* find and execute set call */ =INPUT list_of_par_sets if (result == UNUR_ERR_STR_UNKNOWN) { /* no valid parameter found */ /* try extra keywords */ if ( !strcmp(key, "debug") ) { /* n = 1; type = u: UNUR_PAR *parameters, unsigned DEBUG */ result = _unur_str_par_set_u(par,key,type_args,args,unur_set_debug); } } /* check result */ if (result == UNUR_ERR_STR_UNKNOWN) { /* unknown parameter */ _unur_error_unknown(key,"parameter for given method"); return UNUR_ERR_STR_UNKNOWN; } else if (result != UNUR_SUCCESS) { /* invalid data for parameter */ _unur_error_invalid(key,"set call"); return UNUR_ERR_STR_SYNTAX; } return UNUR_SUCCESS; } /* end of _unur_str_par_set() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/parser/functparser_eval.ch0000644001357500135600000002062514420445767016021 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: functparser_eval.c * * * * Evaluate function tree for given argument x. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** API **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ double _unur_fstr_eval_tree (const struct ftreenode *root, double x) /*----------------------------------------------------------------------*/ /* Evaluate function tree at x */ /* */ /* parameters: */ /* root ... pointer to root of function tree */ /* x ... argument for which function should be evaluated */ /* */ /* return: */ /* result of computation */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { /* check arguments */ CHECK_NULL(root,UNUR_INFINITY); COOKIE_CHECK(root,CK_FSTR_TNODE,UNUR_INFINITY); return _unur_fstr_eval_node( root, x ); } /* end of _unur_fstr_eval_tree() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Routines for evaluating nodes of the function tree **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #define CHECK_INF(x) if(_unur_FP_is_infinity((x))) return UNUR_INFINITY; #define CHECK_INFS(l,r) do { CHECK_INF((l)); CHECK_INF((r)); } while(0) #define NODE_ARGS double l ATTRIBUTE__UNUSED, double r ATTRIBUTE__UNUSED /*---------------------------------------------------------------------------*/ double v_dummy (NODE_ARGS) { return 0.; } double v_const (NODE_ARGS) { return 0.; } /* nothing to do, value in node */ double v_less (NODE_ARGS) { return (double)(l < r); } double v_equal (NODE_ARGS) { return (double)(_unur_FP_same(l,r)); } double v_greater(NODE_ARGS) { return (double)(l > r); } double v_less_or(NODE_ARGS) { return (double)(l <= r); } double v_unequal(NODE_ARGS) { return (double)(!_unur_FP_same(l,r)); } double v_grtr_or(NODE_ARGS) { return (double)(l >= r); } double v_plus (NODE_ARGS) { return (l + r); } double v_minus (NODE_ARGS) { return (l - r); } double v_mul (NODE_ARGS) { return (l * r); } double v_div (NODE_ARGS) { return (l / r); } double v_power (NODE_ARGS) { return pow(l,r); } double v_mod (NODE_ARGS) { return (double)((int)l % (int)r); } double v_exp (NODE_ARGS) { return exp(r); } double v_log (NODE_ARGS) { return (r<=0.) ? UNUR_INFINITY : log(r); } double v_sin (NODE_ARGS) { CHECK_INF(r); return sin(r); } double v_cos (NODE_ARGS) { CHECK_INF(r); return cos(r); } double v_tan (NODE_ARGS) { CHECK_INF(r); return tan(r); } double v_sec (NODE_ARGS) { double cosr; CHECK_INF(r); cosr=cos(r); return _unur_iszero(cosr) ? UNUR_INFINITY : 1./cosr; } double v_sqrt (NODE_ARGS) { return (r<0.) ? UNUR_INFINITY : sqrt(r); } double v_abs (NODE_ARGS) { return fabs(r); } double v_sgn (NODE_ARGS) { return ((r<0.) ? -1. : ((r>0.) ? 1. : 0.)); } /*---------------------------------------------------------------------------*/ #undef CHECK_INF #undef CHECK_INFS #undef NODE_ARGS /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Evaluate function **/ /*****************************************************************************/ double _unur_fstr_eval_node (const struct ftreenode *node, double x) /*----------------------------------------------------------------------*/ /* Evaluate function tree starting from `node' at x */ /* */ /* parameters: */ /* root ... pointer to node in function tree */ /* x ... argument for which function should be evaluated */ /* */ /* return: */ /* result of computation */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { double val_l, val_r; /* check arguments */ CHECK_NULL(node,UNUR_INFINITY); COOKIE_CHECK(node,CK_FSTR_TNODE,UNUR_INFINITY); switch (node->type) { case S_UCONST: case S_SCONST: /* node contains constant */ return node->val; case S_UIDENT: /* variable */ return x; default: /* use evaluation function */ /* compute values at leaves */ val_l = (node->left) ? _unur_fstr_eval_node(node->left, x) : 0. ; val_r = (node->right) ? _unur_fstr_eval_node(node->right,x) : 0. ; return (*symbol[node->token].vcalc)(val_l,val_r); } } /* end of _unur_fstr_eval_node() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/parser/functparser_symbols.h0000644001357500135600000006052214420445767016417 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: functparser_symbols.c * * * * Table of known symbols for function parser * * * * Parser function string, evaluate function, print programm code. * * * * DESCRIPTION: * * Given a string for a function. * * The string is parser. * * A tree representing the function term is generated. * * A tree for the derivative of the function is generated. * * The tree is used to evalute the corresponding function for an x. * * The source code for a program is produced. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* #define one of the two marcos 'PARSER' or 'CODEGEN' before #including this header file: 'PARSER' ... for parsing and evalution of function string 'CODEGEN' ... for the code generating routines These two macros should be #undef-ined after this file has been #included! */ /* #define PARSER */ /* #define CODEGEN */ #if defined(PARSER) && defined(CODEGEN) # error \ You have to #define either 'PARSER' or 'CODEGEN' before including this header file! #endif #if !defined(PARSER) && !defined(CODEGEN) # error \ You have to #define either 'PARSER' or 'CODEGEN' before including this header file! #endif /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Routines for evaluating nodes of the function tree **/ /*****************************************************************************/ #ifdef PARSER static double v_dummy (double l, double r); static double v_less (double l, double r); static double v_equal (double l, double r); static double v_greater(double l, double r); static double v_less_or(double l, double r); static double v_unequal(double l, double r); static double v_grtr_or(double l, double r); static double v_plus (double l, double r); static double v_minus (double l, double r); static double v_mul (double l, double r); static double v_div (double l, double r); static double v_mod (double l, double r); static double v_power (double l, double r); static double v_const (double l, double r); static double v_exp (double l, double r); static double v_log (double l, double r); static double v_sin (double l, double r); static double v_cos (double l, double r); static double v_tan (double l, double r); static double v_sec (double l, double r); static double v_sqrt (double l, double r); static double v_abs (double l, double r); static double v_sgn (double l, double r); #endif /*****************************************************************************/ /** Routines for computing derivatives **/ /*****************************************************************************/ #ifdef PARSER static struct ftreenode *d_error ( const struct ftreenode *node, int *error ); static struct ftreenode *d_const ( const struct ftreenode *node, int *error ); static struct ftreenode *d_var ( const struct ftreenode *node, int *error ); static struct ftreenode *d_add ( const struct ftreenode *node, int *error ); static struct ftreenode *d_mul ( const struct ftreenode *node, int *error ); static struct ftreenode *d_div ( const struct ftreenode *node, int *error ); static struct ftreenode *d_power ( const struct ftreenode *node, int *error ); static struct ftreenode *d_exp ( const struct ftreenode *node, int *error ); static struct ftreenode *d_log ( const struct ftreenode *node, int *error ); static struct ftreenode *d_sin ( const struct ftreenode *node, int *error ); static struct ftreenode *d_cos ( const struct ftreenode *node, int *error ); static struct ftreenode *d_tan ( const struct ftreenode *node, int *error ); static struct ftreenode *d_sec ( const struct ftreenode *node, int *error ); static struct ftreenode *d_sqrt ( const struct ftreenode *node, int *error ); static struct ftreenode *d_abs ( const struct ftreenode *node, int *error ); #endif /*****************************************************************************/ /** Routines for printing C code **/ /*****************************************************************************/ #ifdef CODEGEN /* error */ static unsigned C_error ( struct unur_string *output, const struct ftreenode *node, const char *variable ); /* constants and variables */ static unsigned C_const ( struct unur_string *output, const struct ftreenode *node, const char *variable ); static unsigned C_var ( struct unur_string *output, const struct ftreenode *node, const char *variable ); /* prefix operators (functions) (eg. exp(x)) */ static unsigned C_prefix_generic ( struct unur_string *output, const struct ftreenode *node, const char *variable, const char *symbol ); /* operators where C routine is the same as parser name */ static unsigned C_prefix ( struct unur_string *output, const struct ftreenode *node, const char *variable ); /* special operators */ static unsigned C_power ( struct unur_string *output, const struct ftreenode *node, const char *variable ); static unsigned C_sec ( struct unur_string *output, const struct ftreenode *node, const char *variable ); static unsigned C_abs ( struct unur_string *output, const struct ftreenode *node, const char *variable ); static unsigned C_sgn ( struct unur_string *output, const struct ftreenode *node, const char *variable ); /* infix (binary) operators (eg. x + y) */ static unsigned C_infix_generic ( struct unur_string *output, const struct ftreenode *node, const char *variable, const char *symbol ); /* operators where C routine is the same as parser name */ static unsigned C_infix ( struct unur_string *output, const struct ftreenode *node, const char *variable ); /* special operators */ static unsigned C_equal ( struct unur_string *output, const struct ftreenode *node, const char *variable ); static unsigned C_unequal( struct unur_string *output, const struct ftreenode *node, const char *variable ); static unsigned C_minus ( struct unur_string *output, const struct ftreenode *node, const char *variable ); static unsigned C_mod ( struct unur_string *output, const struct ftreenode *node, const char *variable ); #endif /*****************************************************************************/ /** Routines for printing FORTRAN code **/ /*****************************************************************************/ #ifdef CODEGEN /* error */ static unsigned F_error ( struct unur_string *output, const struct ftreenode *node, const char *variable ); /* constants and variables */ static unsigned F_const ( struct unur_string *output, const struct ftreenode *node, const char *variable ); static unsigned F_var ( struct unur_string *output, const struct ftreenode *node, const char *variable ); /* prefix operators (functions) (eg. exp(x)) */ static unsigned F_prefix_generic ( struct unur_string *output, const struct ftreenode *node, const char *variable, const char *symbol ); /* operators where C routine is the same as parser name */ static unsigned F_prefix ( struct unur_string *output, const struct ftreenode *node, const char *variable ); /* relation operators */ static unsigned F_lt ( struct unur_string *output, const struct ftreenode *node, const char *variable ); static unsigned F_le ( struct unur_string *output, const struct ftreenode *node, const char *variable ); static unsigned F_gt ( struct unur_string *output, const struct ftreenode *node, const char *variable ); static unsigned F_ge ( struct unur_string *output, const struct ftreenode *node, const char *variable ); static unsigned F_eq ( struct unur_string *output, const struct ftreenode *node, const char *variable ); static unsigned F_ne ( struct unur_string *output, const struct ftreenode *node, const char *variable ); /* special operators */ static unsigned F_sec ( struct unur_string *output, const struct ftreenode *node, const char *variable ); static unsigned F_sgn ( struct unur_string *output, const struct ftreenode *node, const char *variable ); /* infix (binary) operators (eg. x + y) */ static unsigned F_infix_generic ( struct unur_string *output, const struct ftreenode *node, const char *variable, const char *symbol ); /* operators where FORTRAN routine is the same as parser name */ static unsigned F_infix ( struct unur_string *output, const struct ftreenode *node, const char *variable ); /* special operators */ static unsigned F_minus ( struct unur_string *output, const struct ftreenode *node, const char *variable ); static unsigned F_power ( struct unur_string *output, const struct ftreenode *node, const char *variable ); /* static unsigned F_equal ( struct unur_string *output, const struct ftreenode *node, const char *variable ); */ /* static unsigned F_unequal( struct unur_string *output, const struct ftreenode *node, const char *variable ); */ #endif /*****************************************************************************/ /** Routines for printing JAVA code **/ /*****************************************************************************/ #ifdef CODEGEN /* error */ static unsigned J_error ( struct unur_string *output, const struct ftreenode *node, const char *variable ); /* constants and variables */ static unsigned J_const ( struct unur_string *output, const struct ftreenode *node, const char *variable ); static unsigned J_var ( struct unur_string *output, const struct ftreenode *node, const char *variable ); /* prefix operators (functions) (eg. exp(x)) */ static unsigned J_prefix_generic ( struct unur_string *output, const struct ftreenode *node, const char *variable, const char *symbol ); /* operators where C routine is the same as parser name */ static unsigned J_prefix ( struct unur_string *output, const struct ftreenode *node, const char *variable ); /* relation operators */ static unsigned J_lt ( struct unur_string *output, const struct ftreenode *node, const char *variable ); static unsigned J_le ( struct unur_string *output, const struct ftreenode *node, const char *variable ); static unsigned J_gt ( struct unur_string *output, const struct ftreenode *node, const char *variable ); static unsigned J_ge ( struct unur_string *output, const struct ftreenode *node, const char *variable ); static unsigned J_eq ( struct unur_string *output, const struct ftreenode *node, const char *variable ); static unsigned J_ne ( struct unur_string *output, const struct ftreenode *node, const char *variable ); /* special operators */ static unsigned J_power ( struct unur_string *output, const struct ftreenode *node, const char *variable ); static unsigned J_sec ( struct unur_string *output, const struct ftreenode *node, const char *variable ); static unsigned J_sgn ( struct unur_string *output, const struct ftreenode *node, const char *variable ); /* infix (binary) operators (eg. x + y) */ static unsigned J_infix_generic ( struct unur_string *output, const struct ftreenode *node, const char *variable, const char *symbol ); /* operators where C routine is the same as parser name */ static unsigned J_infix ( struct unur_string *output, const struct ftreenode *node, const char *variable ); /* special operators */ static unsigned J_minus ( struct unur_string *output, const struct ftreenode *node, const char *variable ); static unsigned J_mod ( struct unur_string *output, const struct ftreenode *node, const char *variable ); #endif /*****************************************************************************/ /** List of known symbols **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Symbol types for tokens */ enum { S_NOSYMBOL = 0, /* token is not a symbol / is unknown */ S_SFUNCT, /* system function */ S_SCONST, /* system constant */ S_UIDENT, /* user defined identifier (variable) */ S_UFUNCT, /* user defined function */ S_UCONST, /* user defined constant */ S_REL_OP, /* relation operator */ S_ADD_OP, /* addition operator */ S_MUL_OP, /* multiplication operator */ S_HPR_OP, /* higher priority operator */ S_OTHERS /* other operator */ }; /* IMPORTANT: symbol types S_ADD_OP, S_MUL_OP and S_HPR_OP indicate */ /* priorities of the corresponding operators. */ /*---------------------------------------------------------------------------*/ /* structure for storing known symbols */ #define SYMBLENGTH 10 /* Maximum length for symbols */ /* structure for storing known symbols */ struct symbols { char name[SYMBLENGTH]; /* name of symbols (e.g. "sin") */ #ifdef PARSER int type; /* type of symbol */ int info; /* priority or number of argument for system function */ double val; /* value of constant (0. otherwise) */ double (*vcalc)(double l, double r); /* function for computing value of node */ struct ftreenode *(*dcalc)(const struct ftreenode *node, int *error); /* function for computing derivate */ #endif #ifdef CODEGEN unsigned (*node2C)(struct unur_string *output, const struct ftreenode *node, const char *variable ); /* function for printing C code */ unsigned (*node2F)(struct unur_string *output, const struct ftreenode *node, const char *variable ); /* function for printing FORTRAN code */ unsigned (*node2J)(struct unur_string *output, const struct ftreenode *node, const char *variable ); /* function for printing JAVA code */ #endif }; /*---------------------------------------------------------------------------*/ /* List of known symbols */ /* IMPORTANT: Symbols that do NOT start with a digit, a letter or `.' */ /* must not have more than ONE single character. */ /* The only exception are relation operators. */ /* */ /* IMPORTANT: symbol types S_ADD_OP, S_MUL_OP and S_HPR_OP indicate */ /* priorities of the corresponding operators. */ /* */ /* In the current implementation system function must not have more than */ /* two arguments. */ /* */ /* Constant should have highest priority to avoid enclosing parenthesis */ /* in string output. */ /* */ /* The first entry in the list must be empty! */ /* */ /* There must be FOUR markers in the list (in this ordering!): */ /* _ROS ... start of relation operators */ /* _NAS ... start of non-alphanumeric symbols (single characters!) */ /* _ANS ... start of alphanumeric symbols (constants and functions) */ /* _END ... end of list */ /* */ /* entries needed for parsing and evaluation of terms */ #ifdef PARSER # define S(name,type,priority,value,funct,deriv) \ name,type,priority,value,funct,deriv #else # define S(name,type,priority,value,funct,deriv) \ name, #endif /* code generating functings */ #ifdef CODEGEN # define CG(cc,fortran,java) cc,fortran,java #else # define CG(cc,fortran,java) #endif static struct symbols symbol[] = { /* symbol, priority, evaluation routine, C function, Java function */ /* type, value, derivative F function, */ /* void */ {S ("" , S_NOSYMBOL, 0, 0.0 , v_dummy , d_error) CG (C_error , F_error , J_error )}, /* user defined symbols: */ /* constant */ {S ("UCONST",S_UCONST , 9, 0.0 , v_const , d_const) CG (C_const , F_const , J_const )}, /* function */ {S ("UFUNCT",S_UFUNCT , 0, 0.0 , v_dummy , d_error) CG (C_error , F_error , J_error )}, /* variable */ {S ("VAR" , S_UIDENT , 9, 0.0 , v_dummy , d_var ) CG (C_var , F_var , J_var )}, /* marker for relation operators */ {S ("_ROS", S_NOSYMBOL, 0, 0.0 , v_dummy , d_error) CG (C_error , F_error , J_error )}, /* relation operators */ {S ("<" , S_REL_OP , 1, 0.0 , v_less , d_const) CG (C_infix , F_lt , J_lt )}, {S ("=" , S_REL_OP , 1, 0.0 , v_equal , d_const) CG (C_equal , F_eq , J_eq )}, {S ("==" , S_REL_OP , 1, 0.0 , v_equal , d_const) CG (C_equal , F_eq , J_eq )}, {S (">" , S_REL_OP , 1, 0.0 , v_greater, d_const) CG (C_infix , F_gt , J_gt )}, {S ("<=" , S_REL_OP , 1, 0.0 , v_less_or, d_const) CG (C_infix , F_le , J_le )}, {S ("<>" , S_REL_OP , 1, 0.0 , v_unequal, d_const) CG (C_unequal, F_ne , J_ne )}, {S ("!=" , S_REL_OP , 1, 0.0 , v_unequal, d_const) CG (C_unequal, F_ne , J_ne )}, {S (">=" , S_REL_OP , 1, 0.0 , v_grtr_or, d_const) CG (C_infix , F_ge , J_ge )}, /* marker for non-alphanumeric symbols */ {S ("_NAS", S_NOSYMBOL, 0, 0.0 , v_dummy , d_error) CG (C_error , F_error , J_error )}, /* special symbols */ {S ("(" , S_OTHERS , 0, 0.0 , v_dummy , d_error) CG (C_error , F_error , J_error )}, {S (")" , S_OTHERS , 0, 0.0 , v_dummy , d_error) CG (C_error , F_error , J_error )}, {S ("," , S_OTHERS , 0, 0.0 , v_dummy , d_error) CG (C_error , F_error , J_error )}, /* arithmetic operators */ {S ("+" , S_ADD_OP , 2, 0.0 , v_plus , d_add ) CG (C_infix , F_infix , J_infix )}, {S ("-" , S_ADD_OP , 2, 0.0 , v_minus , d_add ) CG (C_minus , F_minus , J_minus )}, {S ("*" , S_MUL_OP , 4, 0.0 , v_mul , d_mul ) CG (C_infix , F_infix , J_infix )}, {S ("/" , S_MUL_OP , 4, 0.0 , v_div , d_div ) CG (C_infix , F_infix , J_infix )}, {S ("^" , S_HPR_OP , 5, 0.0 , v_power , d_power) CG (C_power , F_power , J_power )}, /* marker for alphanumeric symbols */ {S ("_ANS", S_NOSYMBOL, 0, 0.0 , v_dummy , d_error) CG (C_error , F_error , J_error )}, /* logical operators: removed */ /* system constants */ {S ("pi" , S_SCONST , 9, M_PI, v_const , d_const) CG (C_const , F_const , J_const )}, {S ("e" , S_SCONST , 9, M_E , v_const , d_const) CG (C_const , F_const , J_const )}, /* system functions */ {S ("mod" , S_SFUNCT , 2, 0.0 , v_mod , d_const) CG (C_mod , F_prefix, J_mod )}, {S ("exp" , S_SFUNCT , 1, 0.0 , v_exp , d_exp ) CG (C_prefix , F_prefix, J_prefix )}, {S ("log" , S_SFUNCT , 1, 0.0 , v_log , d_log ) CG (C_prefix , F_prefix, J_prefix )}, {S ("sin" , S_SFUNCT , 1, 0.0 , v_sin , d_sin ) CG (C_prefix , F_prefix, J_prefix )}, {S ("cos" , S_SFUNCT , 1, 0.0 , v_cos , d_cos ) CG (C_prefix , F_prefix, J_prefix )}, {S ("tan" , S_SFUNCT , 1, 0.0 , v_tan , d_tan ) CG (C_prefix , F_prefix, J_prefix )}, {S ("sec" , S_SFUNCT , 1, 0.0 , v_sec , d_sec ) CG (C_sec , F_sec , J_sec )}, {S ("sqrt", S_SFUNCT , 1, 0.0 , v_sqrt , d_sqrt ) CG (C_prefix , F_prefix, J_prefix )}, {S ("abs" , S_SFUNCT , 1, 0.0 , v_abs , d_abs ) CG (C_abs , F_prefix, J_prefix )}, {S ("sgn" , S_SFUNCT , 1, 0.0 , v_sgn , d_const) CG (C_sgn , F_sgn , J_sgn )}, /* marker for end-of-table */ {S ("_END", S_NOSYMBOL, 0, 0.0 , v_dummy , d_error) CG (C_error , F_error , J_error )}, }; #undef S #undef GC /*---------------------------------------------------------------------------*/ #ifdef PARSER /* location of special symbols in table */ /** DO NOT CHANGE THEIR POSITION IN TABLE **/ static int s_uconst = 1; /* user defined constant */ static int s_ufunct = 2; /* user defined function */ static int s_uident = 3; /* user defined variable */ /* location of special symbols */ static int s_comma, s_minus, s_plus, s_mul, s_div, s_power; /* Marker for different regions in symbol table */ static int _ros_start, _ros_end; /* relation symbols */ static int _nas_start, _nas_end; /* non-alphanumeric symbols */ static int _ans_start, _ans_end; /* alphanumeric symbols */ static int _end; /* end of list */ #endif /*---------------------------------------------------------------------------*/ /* #undef PARSER */ /* #undef CODEGEN */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/parser/functparser_debug.ch0000644001357500135600000002363314420445767016162 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: functparser_debug.c * * * * Debugging tools for function parser. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Debugging utilities **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ void _unur_fstr_debug_input ( const char *fstr ) /*----------------------------------------------------------------------*/ /* Print function string on output stream */ /* */ /* parameters: */ /* fstr ... string containing function definition */ /*----------------------------------------------------------------------*/ { FILE *LOG = unur_get_stream(); fprintf(LOG,"%s: Input string:\n",GENTYPE); fprintf(LOG,"%s: %s\n",GENTYPE,fstr); fprintf(LOG,"%s:\n",GENTYPE); } /* end of _unur_fstr_debug_input() */ /*---------------------------------------------------------------------------*/ void _unur_fstr_debug_token ( const struct parser_data *pdata ) /*----------------------------------------------------------------------*/ /* Print tokenized string on output stream */ /* */ /* parameters: */ /* pdata ... pointer to parser object */ /*----------------------------------------------------------------------*/ { FILE *LOG = unur_get_stream(); int i; /* check arguments */ CHECK_NULL(pdata,RETURN_VOID); COOKIE_CHECK(pdata,CK_FSTR_PDATA,RETURN_VOID); fprintf(LOG,"%s: Tokenized string (token separated by blanks):\n",GENTYPE); fprintf(LOG,"%s: ",GENTYPE); for (i=0; in_tokens; i++) fprintf(LOG,"%s ",pdata->tpos[i]); fprintf(LOG,"\n%s:\n",GENTYPE); } /* end of _unur_fstr_debug_input() */ /*---------------------------------------------------------------------------*/ void _unur_fstr_debug_tree( const struct parser_data *pdata, const struct ftreenode *root ) /*----------------------------------------------------------------------*/ /* Print function tree */ /* */ /* parameters: */ /* pdata ... pointer to parser object */ /* root ... pointer to root of tree */ /*----------------------------------------------------------------------*/ { FILE *LOG = unur_get_stream(); /* check arguments */ CHECK_NULL(pdata,RETURN_VOID); COOKIE_CHECK(pdata,CK_FSTR_PDATA,RETURN_VOID); CHECK_NULL(root,RETURN_VOID); COOKIE_CHECK(root,CK_FSTR_TNODE,RETURN_VOID); fprintf(LOG,"%s: parse tree: (left nodes above right nodes)\n",GENTYPE); fprintf(LOG,"%s:\n",GENTYPE); _unur_fstr_debug_show_tree(pdata,root,0,0); fprintf(LOG,"%s:\n",GENTYPE); } /* end of _unur_fstr_debug_tree() */ /*---------------------------------------------------------------------------*/ void _unur_fstr_debug_show_tree(const struct parser_data *pdata, const struct ftreenode *node, int level, int location) /*----------------------------------------------------------------------*/ /* Print function tree by recursion */ /* */ /* parameters: */ /* pdata ... pointer to parser object */ /* node ... pointer to node in tree */ /* level ... depth in tree */ /* location ... indicates location of node in tree by bit array */ /*----------------------------------------------------------------------*/ { FILE *LOG = unur_get_stream(); const char *name; int i, mask; /* check arguments */ CHECK_NULL(pdata,RETURN_VOID); COOKIE_CHECK(pdata,CK_FSTR_PDATA,RETURN_VOID); fprintf(LOG,"%s: ",GENTYPE); /* draw vertical lines in tree */ for (i = 0, mask = 1; i < level; i++, mask <<= 1) if (mask & location) fprintf(LOG,"| "); else fprintf(LOG," "); /* print node */ if( node != NULL ) { COOKIE_CHECK(node,CK_FSTR_TNODE,RETURN_VOID); /* draw horizontal line in tree */ (mask & location) ? fprintf(LOG,"+--") : fprintf(LOG,"\\__"); /* print symbol */ switch (node->type) { case S_SCONST: fprintf(LOG,"'%s'\t(const=%g)", node->symbol,node->val); break; case S_UCONST: fprintf(LOG,"'%g'\t(const)", node->val); break; case S_UIDENT: name = (pdata) ? pdata->variable_name : "x"; fprintf(LOG,"'%s'\t(variable)", name); break; case S_UFUNCT: name = (pdata) ? pdata->function_name : "f"; fprintf(LOG,"'%s'\t(user function)", name); break; default: fprintf(LOG,"'%s'", node->symbol); } /* end of line */ fprintf(LOG,"\n"); /* print left and right node */ if ( node->left || node->right) { /* ... unless both leaves are empty */ _unur_fstr_debug_show_tree(pdata,node->left, level+1,location|(mask<<1)); _unur_fstr_debug_show_tree(pdata,node->right,level+1,location); } } else { /* empty leave */ (mask & location) ? fprintf(LOG,"+--") : fprintf(LOG,"\\__"); fprintf(LOG,"(void)\n"); } } /* end of _unur_fstr_debug_show_tree() */ /*---------------------------------------------------------------------------*/ void _unur_fstr_debug_deriv (const struct ftreenode *funct, const struct ftreenode *deriv) /*----------------------------------------------------------------------*/ /* Print function and its derivative */ /* */ /* parameters: */ /* funct ... pointer to function tree */ /* deriv ... pointer to derivative */ /*----------------------------------------------------------------------*/ { FILE *LOG = unur_get_stream(); char *str; /* check arguments */ CHECK_NULL(funct,RETURN_VOID); COOKIE_CHECK(funct,CK_FSTR_TNODE,RETURN_VOID); CHECK_NULL(deriv,RETURN_VOID); COOKIE_CHECK(deriv,CK_FSTR_TNODE,RETURN_VOID); fprintf(LOG,"%s: Derivative df/dx of \n",GENTYPE); str = _unur_fstr_tree2string(funct,"x","f",TRUE); fprintf(LOG,"%s: f(x) = %s\n",GENTYPE,str); free (str); if (deriv) { str = _unur_fstr_tree2string(deriv,"x","df",TRUE); fprintf(LOG,"%s: f'(x) = %s\n",GENTYPE,str); free (str); } else { fprintf(LOG,"%s: f'(x) = (unknown)\n",GENTYPE); } /* _unur_fstr_debug_tree(NULL,deriv); */ fprintf(LOG,"%s:\n",GENTYPE); } /* end of _unur_fstr_debug_deriv() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/parser/stringparser_lists.ch0000644001357500135600000020012614430713435016402 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: stringparser_lists.ch.in / stringparser_lists.ch * * * * * * DESCRIPTION: * * * * Switch lists for string parser. * * (See file stringparser.c) * * * ***************************************************************************** * * * This file is parsed by the perl script make_stringparser.pl which * * replaces the * * =INPUT keyword * * tags with search lists created from the information found within the * * header files of the source code. * * These lists (implemented via 'if' rules together with switch lists to * * with the first letter of the set calls as simple hash function) are * * used to call the corresponding ..._set and ..._new calls for the * * the keywords found in the string. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*****************************************************************************/ /** Distributions **/ /*****************************************************************************/ struct unur_distr * _unur_str_distr_new( char *distribution ) /*----------------------------------------------------------------------*/ /* get new distribution object */ /* */ /* parameters: */ /* distribution ... string that contains distribution name */ /* params ... string that contains list of parameters */ /* */ /* return: */ /* distribution object (pointer to structure) */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_distr *distr = NULL; /* pointer to distribution object */ char distr_unknown; #ifdef UNUR_ENABLE_LOGGING char *name; /* pointer to name of distribution */ #endif char *params; /* pointer to parameter list of distr */ double *darray = NULL; /* array of arguments for distribution */ int n_darray = 0; /* size of array of parameters */ #ifdef UNUR_ENABLE_LOGGING /* name of distribution */ name = distribution; #endif /* get parameter list */ params = strchr(distribution,'('); if (params != NULL) { *params = '\0'; /* terminate key string */ ++params; /* set pointer to value string */ } /* get parameter list */ n_darray = _unur_parse_dlist(params, &darray ); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag & UNUR_DEBUG_SETUP) _unur_str_debug_distr(1,name,darray,n_darray); #endif /* mark distribution as unknown (this is a very ugly hack) */ distr = (struct unur_distr *) &distr_unknown; switch (*distribution) { case 'b': if ( !strcmp( distribution, "beta") ) { distr = unur_distr_beta (darray,n_darray); break; } if ( !strcmp( distribution, "binomial") ) { distr = unur_distr_binomial (darray,n_darray); break; } break; case 'c': if ( !strcmp( distribution, "cauchy") ) { distr = unur_distr_cauchy (darray,n_darray); break; } if ( !strcmp( distribution, "chi") ) { distr = unur_distr_chi (darray,n_darray); break; } if ( !strcmp( distribution, "chisquare") ) { distr = unur_distr_chisquare (darray,n_darray); break; } break; case 'e': if ( !strcmp( distribution, "exponential") ) { distr = unur_distr_exponential (darray,n_darray); break; } if ( !strcmp( distribution, "extremei") ) { distr = unur_distr_extremeI (darray,n_darray); break; } if ( !strcmp( distribution, "extremeii") ) { distr = unur_distr_extremeII (darray,n_darray); break; } break; case 'f': if ( !strcmp( distribution, "f") ) { distr = unur_distr_F (darray,n_darray); break; } break; case 'g': if ( !strcmp( distribution, "gamma") ) { distr = unur_distr_gamma (darray,n_darray); break; } if ( !strcmp( distribution, "geometric") ) { distr = unur_distr_geometric (darray,n_darray); break; } if ( !strcmp( distribution, "gig") ) { distr = unur_distr_gig (darray,n_darray); break; } if ( !strcmp( distribution, "gig2") ) { distr = unur_distr_gig2 (darray,n_darray); break; } break; case 'h': if ( !strcmp( distribution, "hyperbolic") ) { distr = unur_distr_hyperbolic (darray,n_darray); break; } if ( !strcmp( distribution, "hypergeometric") ) { distr = unur_distr_hypergeometric (darray,n_darray); break; } break; case 'i': if ( !strcmp( distribution, "ig") ) { distr = unur_distr_ig (darray,n_darray); break; } break; case 'l': if ( !strcmp( distribution, "laplace") ) { distr = unur_distr_laplace (darray,n_darray); break; } if ( !strcmp( distribution, "logarithmic") ) { distr = unur_distr_logarithmic (darray,n_darray); break; } if ( !strcmp( distribution, "logistic") ) { distr = unur_distr_logistic (darray,n_darray); break; } if ( !strcmp( distribution, "lognormal") ) { distr = unur_distr_lognormal (darray,n_darray); break; } if ( !strcmp( distribution, "lomax") ) { distr = unur_distr_lomax (darray,n_darray); break; } break; case 'n': if ( !strcmp( distribution, "negativebinomial") ) { distr = unur_distr_negativebinomial (darray,n_darray); break; } if ( !strcmp( distribution, "normal") ) { distr = unur_distr_normal (darray,n_darray); break; } break; case 'p': if ( !strcmp( distribution, "pareto") ) { distr = unur_distr_pareto (darray,n_darray); break; } if ( !strcmp( distribution, "poisson") ) { distr = unur_distr_poisson (darray,n_darray); break; } if ( !strcmp( distribution, "powerexponential") ) { distr = unur_distr_powerexponential (darray,n_darray); break; } break; case 'r': if ( !strcmp( distribution, "rayleigh") ) { distr = unur_distr_rayleigh (darray,n_darray); break; } break; case 's': if ( !strcmp( distribution, "slash") ) { distr = unur_distr_slash (darray,n_darray); break; } if ( !strcmp( distribution, "student") ) { distr = unur_distr_student (darray,n_darray); break; } break; case 't': if ( !strcmp( distribution, "triangular") ) { distr = unur_distr_triangular (darray,n_darray); break; } break; case 'u': if ( !strcmp( distribution, "uniform") ) { distr = unur_distr_uniform (darray,n_darray); break; } break; case 'w': if ( !strcmp( distribution, "weibull") ) { distr = unur_distr_weibull (darray,n_darray); break; } } /* get pointer to generic distribution object */ if (distr == (struct unur_distr *) &distr_unknown) { do { if ( !strcmp( distribution, "cemp") ) { distr = unur_distr_cemp_new(); break; } if ( !strcmp( distribution, "cont") ) { distr = unur_distr_cont_new(); break; } if ( !strcmp( distribution, "discr") ) { distr = unur_distr_discr_new(); break; } } while (0); } if (distr == (struct unur_distr *) &distr_unknown) { /* unknown method */ _unur_error_unknown(distribution,"distribution"); distr = NULL; } else if (distr == NULL) { /* invalid data for chosen method */ _unur_error_invalid(distribution,"distribution"); } /* clear memory */ if (darray) free(darray); /* return result */ return distr; } /* end of _unur_str_distr_new() */ /*---------------------------------------------------------------------------*/ int _unur_str_distr_set( UNUR_DISTR **ptr_distr, const char *key, char *value ) /*----------------------------------------------------------------------*/ /* set parameters for distribution */ /* */ /* it also makes a distribution object for an order statistics for */ /* the given distribution when the key word "orderstatistics" occurs. */ /* Thus the distribution object itself might be changed. */ /* */ /* parameters: */ /* ptr_distr ... holds pointer to distribution object */ /* key ... string that contains key for parameter */ /* value ... string that contains list of arguments for parameter */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* error: */ /* return error code */ /*----------------------------------------------------------------------*/ { int result; /* result of UNU.RAN set call */ /* derefence pointer to distribution object */ struct unur_distr *distr = *ptr_distr; /* storing arguments of set calls: */ char type_args[MAX_SET_ARGS+1]; /* array containing info about arguments */ char *args[MAX_SET_ARGS+1]; /* pointers to argument strings */ /* tokenize argument string */ if (_unur_str_set_args( value, type_args, args, MAX_SET_ARGS ) < 0) { /* error */ return UNUR_ERR_STR_SYNTAX; } /* set result indicator to unknown */ result = UNUR_ERR_STR_UNKNOWN; /* find and execute set call */ switch (distr->type) { case UNUR_DISTR_CEMP: switch (*key) { case 'd': if ( !strcmp(key, "data") ) { /* n = 2; type = Di: UNUR_DISTR *distribution, const double *sample, int n_sample */ result = _unur_str_distr_set_Di(distr,key,type_args,args,unur_distr_cemp_set_data); break; } break; case 'h': if ( !strcmp(key, "hist_bins") ) { /* n = 2; type = Di: UNUR_DISTR *distribution, const double *bins, int n_bins */ result = _unur_str_distr_set_Di(distr,key,type_args,args,unur_distr_cemp_set_hist_bins); break; } if ( !strcmp(key, "hist_domain") ) { /* n = 2; type = dd: UNUR_DISTR *distribution, double xmin, double xmax */ result = _unur_str_distr_set_dd(distr,key,type_args,args,unur_distr_cemp_set_hist_domain); break; } if ( !strcmp(key, "hist_prob") ) { /* n = 2; type = Di: UNUR_DISTR *distribution, const double *prob, int n_prob */ result = _unur_str_distr_set_Di(distr,key,type_args,args,unur_distr_cemp_set_hist_prob); break; } } break; case UNUR_DISTR_CONT: switch (*key) { case 'c': if ( !strcmp(key, "cdf") ) { /* n = 1; type = C: UNUR_DISTR *distribution, const char *cdfstr */ result = _unur_str_distr_set_C(distr,key,type_args,args,unur_distr_cont_set_cdfstr); break; } if ( !strcmp(key, "cdfstr") ) { /* n = 1; type = C: UNUR_DISTR *distribution, const char *cdfstr */ result = _unur_str_distr_set_C(distr,key,type_args,args,unur_distr_cont_set_cdfstr); break; } if ( !strcmp(key, "center") ) { /* n = 1; type = d: UNUR_DISTR *distribution, double center */ result = _unur_str_distr_set_d(distr,key,type_args,args,unur_distr_cont_set_center); break; } break; case 'd': if ( !strcmp(key, "domain") ) { /* n = 2; type = dd: UNUR_DISTR *distribution, double left, double right */ result = _unur_str_distr_set_dd(distr,key,type_args,args,unur_distr_cont_set_domain); break; } break; case 'h': if ( !strcmp(key, "hr") ) { /* n = 1; type = C: UNUR_DISTR *distribution, const char *hrstr */ result = _unur_str_distr_set_C(distr,key,type_args,args,unur_distr_cont_set_hrstr); break; } if ( !strcmp(key, "hrstr") ) { /* n = 1; type = C: UNUR_DISTR *distribution, const char *hrstr */ result = _unur_str_distr_set_C(distr,key,type_args,args,unur_distr_cont_set_hrstr); break; } break; case 'l': if ( !strcmp(key, "logcdf") ) { /* n = 1; type = C: UNUR_DISTR *distribution, const char *logcdfstr */ result = _unur_str_distr_set_C(distr,key,type_args,args,unur_distr_cont_set_logcdfstr); break; } if ( !strcmp(key, "logcdfstr") ) { /* n = 1; type = C: UNUR_DISTR *distribution, const char *logcdfstr */ result = _unur_str_distr_set_C(distr,key,type_args,args,unur_distr_cont_set_logcdfstr); break; } if ( !strcmp(key, "logpdf") ) { /* n = 1; type = C: UNUR_DISTR *distribution, const char *logpdfstr */ result = _unur_str_distr_set_C(distr,key,type_args,args,unur_distr_cont_set_logpdfstr); break; } if ( !strcmp(key, "logpdfstr") ) { /* n = 1; type = C: UNUR_DISTR *distribution, const char *logpdfstr */ result = _unur_str_distr_set_C(distr,key,type_args,args,unur_distr_cont_set_logpdfstr); break; } break; case 'm': if ( !strcmp(key, "mode") ) { /* n = 1; type = d: UNUR_DISTR *distribution, double mode */ result = _unur_str_distr_set_d(distr,key,type_args,args,unur_distr_cont_set_mode); break; } break; case 'p': if ( !strcmp(key, "pdf") ) { /* n = 1; type = C: UNUR_DISTR *distribution, const char *pdfstr */ result = _unur_str_distr_set_C(distr,key,type_args,args,unur_distr_cont_set_pdfstr); break; } if ( !strcmp(key, "pdfarea") ) { /* n = 1; type = d: UNUR_DISTR *distribution, double area */ result = _unur_str_distr_set_d(distr,key,type_args,args,unur_distr_cont_set_pdfarea); break; } if ( !strcmp(key, "pdfparams") ) { /* n = 2; type = Di: UNUR_DISTR *distribution, const double *params, int n_params */ result = _unur_str_distr_set_Di(distr,key,type_args,args,unur_distr_cont_set_pdfparams); break; } if ( !strcmp(key, "pdfstr") ) { /* n = 1; type = C: UNUR_DISTR *distribution, const char *pdfstr */ result = _unur_str_distr_set_C(distr,key,type_args,args,unur_distr_cont_set_pdfstr); break; } } break; case UNUR_DISTR_DISCR: switch (*key) { case 'c': if ( !strcmp(key, "cdf") ) { /* n = 1; type = C: UNUR_DISTR *distribution, const char *cdfstr */ result = _unur_str_distr_set_C(distr,key,type_args,args,unur_distr_discr_set_cdfstr); break; } if ( !strcmp(key, "cdfstr") ) { /* n = 1; type = C: UNUR_DISTR *distribution, const char *cdfstr */ result = _unur_str_distr_set_C(distr,key,type_args,args,unur_distr_discr_set_cdfstr); break; } break; case 'd': if ( !strcmp(key, "domain") ) { /* n = 2; type = ii: UNUR_DISTR *distribution, int left, int right */ result = _unur_str_distr_set_ii(distr,key,type_args,args,unur_distr_discr_set_domain); break; } break; case 'm': if ( !strcmp(key, "mode") ) { /* n = 1; type = i: UNUR_DISTR *distribution, int mode */ result = _unur_str_distr_set_i(distr,key,type_args,args,unur_distr_discr_set_mode); break; } break; case 'p': if ( !strcmp(key, "pmf") ) { /* n = 1; type = C: UNUR_DISTR *distribution, const char *pmfstr */ result = _unur_str_distr_set_C(distr,key,type_args,args,unur_distr_discr_set_pmfstr); break; } if ( !strcmp(key, "pmfparams") ) { /* n = 2; type = Di: UNUR_DISTR *distribution, const double *params, int n_params */ result = _unur_str_distr_set_Di(distr,key,type_args,args,unur_distr_discr_set_pmfparams); break; } if ( !strcmp(key, "pmfstr") ) { /* n = 1; type = C: UNUR_DISTR *distribution, const char *pmfstr */ result = _unur_str_distr_set_C(distr,key,type_args,args,unur_distr_discr_set_pmfstr); break; } if ( !strcmp(key, "pmfsum") ) { /* n = 1; type = d: UNUR_DISTR *distribution, double sum */ result = _unur_str_distr_set_d(distr,key,type_args,args,unur_distr_discr_set_pmfsum); break; } if ( !strcmp(key, "pv") ) { /* n = 2; type = Di: UNUR_DISTR *distribution, const double *pv, int n_pv */ result = _unur_str_distr_set_Di(distr,key,type_args,args,unur_distr_discr_set_pv); break; } } break; } /* set calls for all distribution types */ if (result == UNUR_ERR_STR_UNKNOWN) { switch (*key) { case 'n': if ( !strcmp(key, "name") ) { /* n = 1; type = C: UNUR_DISTR *distribution, const char *name */ result = _unur_str_distr_set_C(distr,key,type_args,args,unur_distr_set_name); break; } } } /* Ignored set commands: */ /* int unur_distr_cont_set_pdf( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *pdf ); n = 1; type = ? */ /* int unur_distr_cont_set_dpdf( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *dpdf ); n = 1; type = ? */ /* int unur_distr_cont_set_cdf( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *cdf ); n = 1; type = ? */ /* int unur_distr_cont_set_logpdf( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *logpdf ); n = 1; type = ? */ /* int unur_distr_cont_set_dlogpdf( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *dlogpdf ); n = 1; type = ? */ /* int unur_distr_cont_set_logcdf( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *logcdf ); n = 1; type = ? */ /* int unur_distr_cont_set_hr( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *hazard ); n = 1; type = ? */ /* int unur_distr_discr_set_pmf( UNUR_DISTR *distribution, UNUR_FUNCT_DISCR *pmf ); n = 1; type = ? */ /* int unur_distr_discr_set_cdf( UNUR_DISTR *distribution, UNUR_FUNCT_DISCR *cdf ); n = 1; type = ? */ /* int unur_distr_set_extobj( UNUR_DISTR *distribution, const void *extobj ); n = 1; type = ? */ /* Subsituted set commands: */ /* int unur_distr_cont_set_pdfstr( UNUR_DISTR *distribution, const char *pdfstr ); n = 1; type = C */ /* int unur_distr_cont_set_cdfstr( UNUR_DISTR *distribution, const char *cdfstr ); n = 1; type = C */ /* int unur_distr_cont_set_logpdfstr( UNUR_DISTR *distribution, const char *logpdfstr ); n = 1; type = C */ /* int unur_distr_cont_set_logcdfstr( UNUR_DISTR *distribution, const char *logcdfstr ); n = 1; type = C */ /* int unur_distr_cont_set_hrstr( UNUR_DISTR *distribution, const char *hrstr ); n = 1; type = C */ /* int unur_distr_discr_set_pmfstr( UNUR_DISTR *distribution, const char *pmfstr ); n = 1; type = C */ /* int unur_distr_discr_set_cdfstr( UNUR_DISTR *distribution, const char *cdfstr ); n = 1; type = C */ /* Unsupported set commands: */ /* int unur_distr_cemp_set_hist( UNUR_DISTR *distribution, const double *prob, int n_prob, double xmin, double xmax ); n = 4; type = Didd */ /* int unur_distr_cont_set_invcdf( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *invcdf ); n = 1; type = ? */ /* int unur_distr_cont_set_pdfparams_vec( UNUR_DISTR *distribution, int par, const double *param_vec, int n_param_vec ); n = 3; type = iDi */ /* int unur_distr_discr_set_invcdf( UNUR_DISTR *distribution, UNUR_IFUNCT_DISCR *invcdf ); n = 1; type = ? */ /* special keyword */ if (result == UNUR_ERR_STR_UNKNOWN) if (distr->type == UNUR_DISTR_CONT) { if ( !strcmp(key, "orderstatistics") ) { /* make order statistics and replace distribution object */ *ptr_distr = _unur_str_distr_make_os (distr, key, type_args, args); result = (*ptr_distr == NULL) ? UNUR_ERR_STR_SYNTAX : UNUR_SUCCESS; } } if (result == UNUR_ERR_STR_UNKNOWN) { /* unknown parameter */ _unur_error_unknown(key,"parameter for given distribution"); return UNUR_ERR_STR_UNKNOWN; } else if (result != UNUR_SUCCESS) { /* invalid data for parameter */ _unur_error_invalid(key,"set call"); return UNUR_ERR_STR_SYNTAX; } return UNUR_SUCCESS; } /* end of _unur_str_distr_set() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Methods **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ struct unur_par * _unur_str_par_new( const char *method, const UNUR_DISTR *distr ) /*----------------------------------------------------------------------*/ /* get new parameter object for method */ /* */ /* parameters: */ /* method ... string that contains method name */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* default parameters (pointer to structure) */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_par *par = NULL; char method_unknown; #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag & UNUR_DEBUG_SETUP) _unur_str_debug_string(1,"method",method); #endif /* mark method as unknown (this is a very ugly hack) */ par = (struct unur_par *) &method_unknown; switch (*method) { case 'a': if ( !strcmp( method, "arou") ) { par = unur_arou_new(distr); break; } if ( !strcmp( method, "ars") ) { par = unur_ars_new(distr); break; } if ( !strcmp( method, "auto") ) { par = unur_auto_new(distr); break; } break; case 'c': if ( !strcmp( method, "cstd") ) { par = unur_cstd_new(distr); break; } break; case 'd': if ( !strcmp( method, "dari") ) { par = unur_dari_new(distr); break; } if ( !strcmp( method, "dau") ) { par = unur_dau_new(distr); break; } if ( !strcmp( method, "dgt") ) { par = unur_dgt_new(distr); break; } if ( !strcmp( method, "dsrou") ) { par = unur_dsrou_new(distr); break; } if ( !strcmp( method, "dss") ) { par = unur_dss_new(distr); break; } if ( !strcmp( method, "dstd") ) { par = unur_dstd_new(distr); break; } break; case 'e': if ( !strcmp( method, "empk") ) { par = unur_empk_new(distr); break; } if ( !strcmp( method, "empl") ) { par = unur_empl_new(distr); break; } break; case 'g': if ( !strcmp( method, "gibbs") ) { par = unur_gibbs_new(distr); break; } break; case 'h': if ( !strcmp( method, "hinv") ) { par = unur_hinv_new(distr); break; } if ( !strcmp( method, "hist") ) { par = unur_hist_new(distr); break; } if ( !strcmp( method, "hitro") ) { par = unur_hitro_new(distr); break; } if ( !strcmp( method, "hrb") ) { par = unur_hrb_new(distr); break; } if ( !strcmp( method, "hrd") ) { par = unur_hrd_new(distr); break; } if ( !strcmp( method, "hri") ) { par = unur_hri_new(distr); break; } break; case 'i': if ( !strcmp( method, "itdr") ) { par = unur_itdr_new(distr); break; } break; case 'm': if ( !strcmp( method, "mcorr") ) { par = unur_mcorr_new(distr); break; } if ( !strcmp( method, "mvstd") ) { par = unur_mvstd_new(distr); break; } if ( !strcmp( method, "mvtdr") ) { par = unur_mvtdr_new(distr); break; } break; case 'n': if ( !strcmp( method, "ninv") ) { par = unur_ninv_new(distr); break; } if ( !strcmp( method, "norta") ) { par = unur_norta_new(distr); break; } if ( !strcmp( method, "nrou") ) { par = unur_nrou_new(distr); break; } break; case 'p': if ( !strcmp( method, "pinv") ) { par = unur_pinv_new(distr); break; } break; case 's': if ( !strcmp( method, "srou") ) { par = unur_srou_new(distr); break; } if ( !strcmp( method, "ssr") ) { par = unur_ssr_new(distr); break; } break; case 't': if ( !strcmp( method, "tabl") ) { par = unur_tabl_new(distr); break; } if ( !strcmp( method, "tdr") ) { par = unur_tdr_new(distr); break; } break; case 'u': if ( !strcmp( method, "unif") ) { par = unur_unif_new(distr); break; } if ( !strcmp( method, "utdr") ) { par = unur_utdr_new(distr); break; } break; case 'v': if ( !strcmp( method, "vempk") ) { par = unur_vempk_new(distr); break; } if ( !strcmp( method, "vnrou") ) { par = unur_vnrou_new(distr); break; } } if (par == (struct unur_par *) &method_unknown) { /* unknown method */ _unur_error_unknown(method,"method"); par = NULL; } else if (par == NULL) { /* invalid data for chosen method */ _unur_error_invalid(method,"method"); } return par; } /* end of _unur_str_par_new() */ /*---------------------------------------------------------------------------*/ int _unur_str_par_set( UNUR_PAR *par, const char *key, char *value, struct unur_slist *mlist ) /*----------------------------------------------------------------------*/ /* set parameters for method */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* key ... string that contains key for parameter */ /* value ... string that contains list of arguments for parameter */ /* mlist ... list of allocated memory blocks */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int result = 0; /* result of UNU.RAN set call (0 or 1) */ /* storing arguments of set calls: */ char type_args[MAX_SET_ARGS+1]; /* array containing info about arguments */ char *args[MAX_SET_ARGS+1]; /* pointers to argument strings */ /* tokenize argument string */ if (_unur_str_set_args( value, type_args, args, MAX_SET_ARGS ) < 0) { /* error */ return UNUR_ERR_STR_SYNTAX; } /* set result indicator to unknown */ result = UNUR_ERR_STR_UNKNOWN; /* find and execute set call */ switch (par->method) { case UNUR_METH_AROU: switch (*key) { case 'c': if ( !strcmp(key, "cpoints") ) { /* n = 2; type = iD: UNUR_PAR *parameters, int n_stp, const double *stp */ result = _unur_str_par_set_iD(par,key,type_args,args,unur_arou_set_cpoints,mlist); break; } break; case 'd': if ( !strcmp(key, "darsfactor") ) { /* n = 1; type = d: UNUR_PAR *parameters, double factor */ result = _unur_str_par_set_d(par,key,type_args,args,unur_arou_set_darsfactor); break; } break; case 'g': if ( !strcmp(key, "guidefactor") ) { /* n = 1; type = d: UNUR_PAR *parameters, double factor */ result = _unur_str_par_set_d(par,key,type_args,args,unur_arou_set_guidefactor); break; } break; case 'm': if ( !strcmp(key, "max_segments") ) { /* n = 1; type = i: UNUR_PAR *parameters, int max_segs */ result = _unur_str_par_set_i(par,key,type_args,args,unur_arou_set_max_segments); break; } if ( !strcmp(key, "max_sqhratio") ) { /* n = 1; type = d: UNUR_PAR *parameters, double max_ratio */ result = _unur_str_par_set_d(par,key,type_args,args,unur_arou_set_max_sqhratio); break; } break; case 'p': if ( !strcmp(key, "pedantic") ) { /* n = 1; type = i: UNUR_PAR *parameters, int pedantic */ result = _unur_str_par_set_i(par,key,type_args,args,unur_arou_set_pedantic); break; } break; case 'u': if ( !strcmp(key, "usecenter") ) { /* n = 1; type = i: UNUR_PAR *parameters, int usecenter */ result = _unur_str_par_set_i(par,key,type_args,args,unur_arou_set_usecenter); break; } if ( !strcmp(key, "usedars") ) { /* n = 1; type = i: UNUR_PAR *parameters, int usedars */ result = _unur_str_par_set_i(par,key,type_args,args,unur_arou_set_usedars); break; } break; case 'v': if ( !strcmp(key, "verify") ) { /* n = 1; type = i: UNUR_PAR *parameters, int verify */ result = _unur_str_par_set_i(par,key,type_args,args,unur_arou_set_verify); break; } } break; case UNUR_METH_ARS: switch (*key) { case 'c': if ( !strcmp(key, "cpoints") ) { /* n = 2; type = iD: UNUR_PAR *parameters, int n_cpoints, const double *cpoints */ result = _unur_str_par_set_iD(par,key,type_args,args,unur_ars_set_cpoints,mlist); break; } break; case 'm': if ( !strcmp(key, "max_intervals") ) { /* n = 1; type = i: UNUR_PAR *parameters, int max_ivs */ result = _unur_str_par_set_i(par,key,type_args,args,unur_ars_set_max_intervals); break; } if ( !strcmp(key, "max_iter") ) { /* n = 1; type = i: UNUR_PAR *parameters, int max_iter */ result = _unur_str_par_set_i(par,key,type_args,args,unur_ars_set_max_iter); break; } break; case 'p': if ( !strcmp(key, "pedantic") ) { /* n = 1; type = i: UNUR_PAR *parameters, int pedantic */ result = _unur_str_par_set_i(par,key,type_args,args,unur_ars_set_pedantic); break; } break; case 'r': if ( !strcmp(key, "reinit_ncpoints") ) { /* n = 1; type = i: UNUR_PAR *parameters, int ncpoints */ result = _unur_str_par_set_i(par,key,type_args,args,unur_ars_set_reinit_ncpoints); break; } if ( !strcmp(key, "reinit_percentiles") ) { /* n = 2; type = iD: UNUR_PAR *parameters, int n_percentiles, const double *percentiles */ result = _unur_str_par_set_iD(par,key,type_args,args,unur_ars_set_reinit_percentiles,mlist); break; } break; case 'v': if ( !strcmp(key, "verify") ) { /* n = 1; type = i: UNUR_PAR *parameters, int verify */ result = _unur_str_par_set_i(par,key,type_args,args,unur_ars_set_verify); break; } } break; case UNUR_METH_AUTO: switch (*key) { case 'l': if ( !strcmp(key, "logss") ) { /* n = 1; type = i: UNUR_PAR *parameters, int logss */ result = _unur_str_par_set_i(par,key,type_args,args,unur_auto_set_logss); break; } } break; case UNUR_METH_CSTD: switch (*key) { case 'v': if ( !strcmp(key, "variant") ) { /* n = 1; type = u: UNUR_PAR *parameters, unsigned variant */ result = _unur_str_par_set_u(par,key,type_args,args,unur_cstd_set_variant); break; } } break; case UNUR_METH_DARI: switch (*key) { case 'c': if ( !strcmp(key, "cpfactor") ) { /* n = 1; type = d: UNUR_PAR *parameters, double cp_factor */ result = _unur_str_par_set_d(par,key,type_args,args,unur_dari_set_cpfactor); break; } break; case 's': if ( !strcmp(key, "squeeze") ) { /* n = 1; type = i: UNUR_PAR *parameters, int squeeze */ result = _unur_str_par_set_i(par,key,type_args,args,unur_dari_set_squeeze); break; } break; case 't': if ( !strcmp(key, "tablesize") ) { /* n = 1; type = i: UNUR_PAR *parameters, int size */ result = _unur_str_par_set_i(par,key,type_args,args,unur_dari_set_tablesize); break; } break; case 'v': if ( !strcmp(key, "verify") ) { /* n = 1; type = i: UNUR_PAR *parameters, int verify */ result = _unur_str_par_set_i(par,key,type_args,args,unur_dari_set_verify); break; } } break; case UNUR_METH_DAU: switch (*key) { case 'u': if ( !strcmp(key, "urnfactor") ) { /* n = 1; type = d: UNUR_PAR *parameters, double factor */ result = _unur_str_par_set_d(par,key,type_args,args,unur_dau_set_urnfactor); break; } } break; case UNUR_METH_DGT: switch (*key) { case 'g': if ( !strcmp(key, "guidefactor") ) { /* n = 1; type = d: UNUR_PAR *parameters, double factor */ result = _unur_str_par_set_d(par,key,type_args,args,unur_dgt_set_guidefactor); break; } break; case 'v': if ( !strcmp(key, "variant") ) { /* n = 1; type = u: UNUR_PAR *parameters, unsigned variant */ result = _unur_str_par_set_u(par,key,type_args,args,unur_dgt_set_variant); break; } } break; case UNUR_METH_DSROU: switch (*key) { case 'c': if ( !strcmp(key, "cdfatmode") ) { /* n = 1; type = d: UNUR_PAR *parameters, double Fmode */ result = _unur_str_par_set_d(par,key,type_args,args,unur_dsrou_set_cdfatmode); break; } break; case 'v': if ( !strcmp(key, "verify") ) { /* n = 1; type = i: UNUR_PAR *parameters, int verify */ result = _unur_str_par_set_i(par,key,type_args,args,unur_dsrou_set_verify); break; } } break; case UNUR_METH_DSTD: switch (*key) { case 'v': if ( !strcmp(key, "variant") ) { /* n = 1; type = u: UNUR_PAR *parameters, unsigned variant */ result = _unur_str_par_set_u(par,key,type_args,args,unur_dstd_set_variant); break; } } break; case UNUR_METH_EMPK: switch (*key) { case 'b': if ( !strcmp(key, "beta") ) { /* n = 1; type = d: UNUR_PAR *parameters, double beta */ result = _unur_str_par_set_d(par,key,type_args,args,unur_empk_set_beta); break; } break; case 'k': if ( !strcmp(key, "kernel") ) { /* n = 1; type = u: UNUR_PAR *parameters, unsigned kernel*/ result = _unur_str_par_set_u(par,key,type_args,args,unur_empk_set_kernel); break; } break; case 'p': if ( !strcmp(key, "positive") ) { /* n = 1; type = i: UNUR_PAR *parameters, int positive */ result = _unur_str_par_set_i(par,key,type_args,args,unur_empk_set_positive); break; } break; case 's': if ( !strcmp(key, "smoothing") ) { /* n = 1; type = d: UNUR_PAR *parameters, double smoothing */ result = _unur_str_par_set_d(par,key,type_args,args,unur_empk_set_smoothing); break; } break; case 'v': if ( !strcmp(key, "varcor") ) { /* n = 1; type = i: UNUR_PAR *parameters, int varcor */ result = _unur_str_par_set_i(par,key,type_args,args,unur_empk_set_varcor); break; } } break; case UNUR_METH_GIBBS: switch (*key) { case 'b': if ( !strcmp(key, "burnin") ) { /* n = 1; type = i: UNUR_PAR *parameters, int burnin */ result = _unur_str_par_set_i(par,key,type_args,args,unur_gibbs_set_burnin); break; } break; case 'c': if ( !strcmp(key, "c") ) { /* n = 1; type = d: UNUR_PAR *parameters, double c */ result = _unur_str_par_set_d(par,key,type_args,args,unur_gibbs_set_c); break; } break; case 't': if ( !strcmp(key, "thinning") ) { /* n = 1; type = i: UNUR_PAR *parameters, int thinning */ result = _unur_str_par_set_i(par,key,type_args,args,unur_gibbs_set_thinning); break; } break; case 'v': if ( !strcmp(key, "variant_coordinate") ) { /* n = 0; type = : UNUR_PAR *parameters */ result = _unur_str_par_set_void(par,key,type_args,args,unur_gibbs_set_variant_coordinate); break; } if ( !strcmp(key, "variant_random_direction") ) { /* n = 0; type = : UNUR_PAR *parameters */ result = _unur_str_par_set_void(par,key,type_args,args,unur_gibbs_set_variant_random_direction); break; } } break; case UNUR_METH_HINV: switch (*key) { case 'b': if ( !strcmp(key, "boundary") ) { /* n = 2; type = dd: UNUR_PAR *parameters, double left, double right */ result = _unur_str_par_set_dd(par,key,type_args,args,unur_hinv_set_boundary); break; } break; case 'c': if ( !strcmp(key, "cpoints") ) { /* n = 2; type = Di: UNUR_PAR *parameters, const double *stp, int n_stp */ result = _unur_str_par_set_Di(par,key,type_args,args,unur_hinv_set_cpoints,mlist); break; } break; case 'g': if ( !strcmp(key, "guidefactor") ) { /* n = 1; type = d: UNUR_PAR *parameters, double factor */ result = _unur_str_par_set_d(par,key,type_args,args,unur_hinv_set_guidefactor); break; } break; case 'm': if ( !strcmp(key, "max_intervals") ) { /* n = 1; type = i: UNUR_PAR *parameters, int max_ivs */ result = _unur_str_par_set_i(par,key,type_args,args,unur_hinv_set_max_intervals); break; } break; case 'o': if ( !strcmp(key, "order") ) { /* n = 1; type = i: UNUR_PAR *parameters, int order*/ result = _unur_str_par_set_i(par,key,type_args,args,unur_hinv_set_order); break; } break; case 'u': if ( !strcmp(key, "u_resolution") ) { /* n = 1; type = d: UNUR_PAR *parameters, double u_resolution*/ result = _unur_str_par_set_d(par,key,type_args,args,unur_hinv_set_u_resolution); break; } } break; case UNUR_METH_HITRO: switch (*key) { case 'a': if ( !strcmp(key, "adaptive_multiplier") ) { /* n = 1; type = d: UNUR_PAR *parameters, double factor */ result = _unur_str_par_set_d(par,key,type_args,args,unur_hitro_set_adaptive_multiplier); break; } break; case 'b': if ( !strcmp(key, "burnin") ) { /* n = 1; type = i: UNUR_PAR *parameters, int burnin */ result = _unur_str_par_set_i(par,key,type_args,args,unur_hitro_set_burnin); break; } break; case 'r': if ( !strcmp(key, "r") ) { /* n = 1; type = d: UNUR_PAR *parameters, double r */ result = _unur_str_par_set_d(par,key,type_args,args,unur_hitro_set_r); break; } break; case 't': if ( !strcmp(key, "thinning") ) { /* n = 1; type = i: UNUR_PAR *parameters, int thinning */ result = _unur_str_par_set_i(par,key,type_args,args,unur_hitro_set_thinning); break; } break; case 'u': if ( !strcmp(key, "use_adaptiveline") ) { /* n = 1; type = i: UNUR_PAR *parameters, int adaptive */ result = _unur_str_par_set_i(par,key,type_args,args,unur_hitro_set_use_adaptiveline); break; } if ( !strcmp(key, "use_adaptiverectangle") ) { /* n = 1; type = i: UNUR_PAR *parameters, int adaptive */ result = _unur_str_par_set_i(par,key,type_args,args,unur_hitro_set_use_adaptiverectangle); break; } if ( !strcmp(key, "use_boundingrectangle") ) { /* n = 1; type = i: UNUR_PAR *parameters, int rectangle */ result = _unur_str_par_set_i(par,key,type_args,args,unur_hitro_set_use_boundingrectangle); break; } break; case 'v': if ( !strcmp(key, "v") ) { /* n = 1; type = d: UNUR_PAR *parameters, double vmax */ result = _unur_str_par_set_d(par,key,type_args,args,unur_hitro_set_v); break; } if ( !strcmp(key, "variant_coordinate") ) { /* n = 0; type = : UNUR_PAR *parameters */ result = _unur_str_par_set_void(par,key,type_args,args,unur_hitro_set_variant_coordinate); break; } if ( !strcmp(key, "variant_random_direction") ) { /* n = 0; type = : UNUR_PAR *parameters */ result = _unur_str_par_set_void(par,key,type_args,args,unur_hitro_set_variant_random_direction); break; } } break; case UNUR_METH_HRB: switch (*key) { case 'u': if ( !strcmp(key, "upperbound") ) { /* n = 1; type = d: UNUR_PAR *parameters, double upperbound */ result = _unur_str_par_set_d(par,key,type_args,args,unur_hrb_set_upperbound); break; } break; case 'v': if ( !strcmp(key, "verify") ) { /* n = 1; type = i: UNUR_PAR *parameters, int verify */ result = _unur_str_par_set_i(par,key,type_args,args,unur_hrb_set_verify); break; } } break; case UNUR_METH_HRD: switch (*key) { case 'v': if ( !strcmp(key, "verify") ) { /* n = 1; type = i: UNUR_PAR *parameters, int verify */ result = _unur_str_par_set_i(par,key,type_args,args,unur_hrd_set_verify); break; } } break; case UNUR_METH_HRI: switch (*key) { case 'p': if ( !strcmp(key, "p0") ) { /* n = 1; type = d: UNUR_PAR *parameters, double p0 */ result = _unur_str_par_set_d(par,key,type_args,args,unur_hri_set_p0); break; } break; case 'v': if ( !strcmp(key, "verify") ) { /* n = 1; type = i: UNUR_PAR *parameters, int verify */ result = _unur_str_par_set_i(par,key,type_args,args,unur_hri_set_verify); break; } } break; case UNUR_METH_ITDR: switch (*key) { case 'c': if ( !strcmp(key, "cp") ) { /* n = 1; type = d: UNUR_PAR *parameters, double cp */ result = _unur_str_par_set_d(par,key,type_args,args,unur_itdr_set_cp); break; } if ( !strcmp(key, "ct") ) { /* n = 1; type = d: UNUR_PAR *parameters, double ct */ result = _unur_str_par_set_d(par,key,type_args,args,unur_itdr_set_ct); break; } break; case 'v': if ( !strcmp(key, "verify") ) { /* n = 1; type = i: UNUR_PAR *parameters, int verify */ result = _unur_str_par_set_i(par,key,type_args,args,unur_itdr_set_verify); break; } break; case 'x': if ( !strcmp(key, "xi") ) { /* n = 1; type = d: UNUR_PAR *parameters, double xi */ result = _unur_str_par_set_d(par,key,type_args,args,unur_itdr_set_xi); break; } } break; case UNUR_METH_MVTDR: switch (*key) { case 'b': if ( !strcmp(key, "boundsplitting") ) { /* n = 1; type = d: UNUR_PAR *parameters, double boundsplitting */ result = _unur_str_par_set_d(par,key,type_args,args,unur_mvtdr_set_boundsplitting); break; } break; case 'm': if ( !strcmp(key, "maxcones") ) { /* n = 1; type = i: UNUR_PAR *parameters, int maxcones */ result = _unur_str_par_set_i(par,key,type_args,args,unur_mvtdr_set_maxcones); break; } break; case 's': if ( !strcmp(key, "stepsmin") ) { /* n = 1; type = i: UNUR_PAR *parameters, int stepsmin */ result = _unur_str_par_set_i(par,key,type_args,args,unur_mvtdr_set_stepsmin); break; } break; case 'v': if ( !strcmp(key, "verify") ) { /* n = 1; type = i: UNUR_PAR *parameters, int verify */ result = _unur_str_par_set_i(par,key,type_args,args,unur_mvtdr_set_verify); break; } } break; case UNUR_METH_NINV: switch (*key) { case 'm': if ( !strcmp(key, "max_iter") ) { /* n = 1; type = i: UNUR_PAR *parameters, int max_iter */ result = _unur_str_par_set_i(par,key,type_args,args,unur_ninv_set_max_iter); break; } break; case 's': if ( !strcmp(key, "start") ) { /* n = 2; type = dd: UNUR_PAR *parameters, double left, double right*/ result = _unur_str_par_set_dd(par,key,type_args,args,unur_ninv_set_start); break; } break; case 't': if ( !strcmp(key, "table") ) { /* n = 1; type = i: UNUR_PAR *parameters, int no_of_points*/ result = _unur_str_par_set_i(par,key,type_args,args,unur_ninv_set_table); break; } break; case 'u': if ( !strcmp(key, "u_resolution") ) { /* n = 1; type = d: UNUR_PAR *parameters, double u_resolution*/ result = _unur_str_par_set_d(par,key,type_args,args,unur_ninv_set_u_resolution); break; } if ( !strcmp(key, "usebisect") ) { /* n = 0; type = : UNUR_PAR *parameters */ result = _unur_str_par_set_void(par,key,type_args,args,unur_ninv_set_usebisect); break; } if ( !strcmp(key, "usenewton") ) { /* n = 0; type = : UNUR_PAR *parameters */ result = _unur_str_par_set_void(par,key,type_args,args,unur_ninv_set_usenewton); break; } if ( !strcmp(key, "useregula") ) { /* n = 0; type = : UNUR_PAR *parameters */ result = _unur_str_par_set_void(par,key,type_args,args,unur_ninv_set_useregula); break; } break; case 'x': if ( !strcmp(key, "x_resolution") ) { /* n = 1; type = d: UNUR_PAR *parameters, double x_resolution*/ result = _unur_str_par_set_d(par,key,type_args,args,unur_ninv_set_x_resolution); break; } } break; case UNUR_METH_NROU: switch (*key) { case 'c': if ( !strcmp(key, "center") ) { /* n = 1; type = d: UNUR_PAR *parameters, double center */ result = _unur_str_par_set_d(par,key,type_args,args,unur_nrou_set_center); break; } break; case 'r': if ( !strcmp(key, "r") ) { /* n = 1; type = d: UNUR_PAR *parameters, double r */ result = _unur_str_par_set_d(par,key,type_args,args,unur_nrou_set_r); break; } break; case 'u': if ( !strcmp(key, "u") ) { /* n = 2; type = dd: UNUR_PAR *parameters, double umin, double umax */ result = _unur_str_par_set_dd(par,key,type_args,args,unur_nrou_set_u); break; } break; case 'v': if ( !strcmp(key, "v") ) { /* n = 1; type = d: UNUR_PAR *parameters, double vmax */ result = _unur_str_par_set_d(par,key,type_args,args,unur_nrou_set_v); break; } if ( !strcmp(key, "verify") ) { /* n = 1; type = i: UNUR_PAR *parameters, int verify */ result = _unur_str_par_set_i(par,key,type_args,args,unur_nrou_set_verify); break; } } break; case UNUR_METH_PINV: switch (*key) { case 'b': if ( !strcmp(key, "boundary") ) { /* n = 2; type = dd: UNUR_PAR *parameters, double left, double right */ result = _unur_str_par_set_dd(par,key,type_args,args,unur_pinv_set_boundary); break; } break; case 'e': if ( !strcmp(key, "extra_testpoints") ) { /* n = 1; type = i: UNUR_PAR *parameters, int n_points*/ result = _unur_str_par_set_i(par,key,type_args,args,unur_pinv_set_extra_testpoints); break; } break; case 'k': if ( !strcmp(key, "keepcdf") ) { /* n = 1; type = i: UNUR_PAR *parameters, int keepcdf*/ result = _unur_str_par_set_i(par,key,type_args,args,unur_pinv_set_keepcdf); break; } break; case 'm': if ( !strcmp(key, "max_intervals") ) { /* n = 1; type = i: UNUR_PAR *parameters, int max_ivs */ result = _unur_str_par_set_i(par,key,type_args,args,unur_pinv_set_max_intervals); break; } break; case 'o': if ( !strcmp(key, "order") ) { /* n = 1; type = i: UNUR_PAR *parameters, int order*/ result = _unur_str_par_set_i(par,key,type_args,args,unur_pinv_set_order); break; } break; case 's': if ( !strcmp(key, "searchboundary") ) { /* n = 2; type = ii: UNUR_PAR *parameters, int left, int right */ result = _unur_str_par_set_ii(par,key,type_args,args,unur_pinv_set_searchboundary); break; } if ( !strcmp(key, "smoothness") ) { /* n = 1; type = i: UNUR_PAR *parameters, int smoothness*/ result = _unur_str_par_set_i(par,key,type_args,args,unur_pinv_set_smoothness); break; } break; case 'u': if ( !strcmp(key, "u_resolution") ) { /* n = 1; type = d: UNUR_PAR *parameters, double u_resolution*/ result = _unur_str_par_set_d(par,key,type_args,args,unur_pinv_set_u_resolution); break; } if ( !strcmp(key, "use_upoints") ) { /* n = 1; type = i: UNUR_PAR *parameters, int use_upoints */ result = _unur_str_par_set_i(par,key,type_args,args,unur_pinv_set_use_upoints); break; } if ( !strcmp(key, "usecdf") ) { /* n = 0; type = : UNUR_PAR *parameters */ result = _unur_str_par_set_void(par,key,type_args,args,unur_pinv_set_usecdf); break; } if ( !strcmp(key, "usepdf") ) { /* n = 0; type = : UNUR_PAR *parameters */ result = _unur_str_par_set_void(par,key,type_args,args,unur_pinv_set_usepdf); break; } } break; case UNUR_METH_SROU: switch (*key) { case 'c': if ( !strcmp(key, "cdfatmode") ) { /* n = 1; type = d: UNUR_PAR *parameters, double Fmode */ result = _unur_str_par_set_d(par,key,type_args,args,unur_srou_set_cdfatmode); break; } break; case 'p': if ( !strcmp(key, "pdfatmode") ) { /* n = 1; type = d: UNUR_PAR *parameters, double fmode */ result = _unur_str_par_set_d(par,key,type_args,args,unur_srou_set_pdfatmode); break; } break; case 'r': if ( !strcmp(key, "r") ) { /* n = 1; type = d: UNUR_PAR *parameters, double r */ result = _unur_str_par_set_d(par,key,type_args,args,unur_srou_set_r); break; } break; case 'u': if ( !strcmp(key, "usemirror") ) { /* n = 1; type = i: UNUR_PAR *parameters, int usemirror */ result = _unur_str_par_set_i(par,key,type_args,args,unur_srou_set_usemirror); break; } if ( !strcmp(key, "usesqueeze") ) { /* n = 1; type = i: UNUR_PAR *parameters, int usesqueeze */ result = _unur_str_par_set_i(par,key,type_args,args,unur_srou_set_usesqueeze); break; } break; case 'v': if ( !strcmp(key, "verify") ) { /* n = 1; type = i: UNUR_PAR *parameters, int verify */ result = _unur_str_par_set_i(par,key,type_args,args,unur_srou_set_verify); break; } } break; case UNUR_METH_SSR: switch (*key) { case 'c': if ( !strcmp(key, "cdfatmode") ) { /* n = 1; type = d: UNUR_PAR *parameters, double Fmode */ result = _unur_str_par_set_d(par,key,type_args,args,unur_ssr_set_cdfatmode); break; } break; case 'p': if ( !strcmp(key, "pdfatmode") ) { /* n = 1; type = d: UNUR_PAR *parameters, double fmode */ result = _unur_str_par_set_d(par,key,type_args,args,unur_ssr_set_pdfatmode); break; } break; case 'u': if ( !strcmp(key, "usesqueeze") ) { /* n = 1; type = i: UNUR_PAR *parameters, int usesqueeze */ result = _unur_str_par_set_i(par,key,type_args,args,unur_ssr_set_usesqueeze); break; } break; case 'v': if ( !strcmp(key, "verify") ) { /* n = 1; type = i: UNUR_PAR *parameters, int verify */ result = _unur_str_par_set_i(par,key,type_args,args,unur_ssr_set_verify); break; } } break; case UNUR_METH_TABL: switch (*key) { case 'a': if ( !strcmp(key, "areafraction") ) { /* n = 1; type = d: UNUR_PAR *parameters, double fraction */ result = _unur_str_par_set_d(par,key,type_args,args,unur_tabl_set_areafraction); break; } break; case 'b': if ( !strcmp(key, "boundary") ) { /* n = 2; type = dd: UNUR_PAR *parameters, double left, double right */ result = _unur_str_par_set_dd(par,key,type_args,args,unur_tabl_set_boundary); break; } break; case 'c': if ( !strcmp(key, "cpoints") ) { /* n = 2; type = iD: UNUR_PAR *parameters, int n_cpoints, const double *cpoints */ result = _unur_str_par_set_iD(par,key,type_args,args,unur_tabl_set_cpoints,mlist); break; } break; case 'd': if ( !strcmp(key, "darsfactor") ) { /* n = 1; type = d: UNUR_PAR *parameters, double factor */ result = _unur_str_par_set_d(par,key,type_args,args,unur_tabl_set_darsfactor); break; } break; case 'g': if ( !strcmp(key, "guidefactor") ) { /* n = 1; type = d: UNUR_PAR *parameters, double factor */ result = _unur_str_par_set_d(par,key,type_args,args,unur_tabl_set_guidefactor); break; } break; case 'm': if ( !strcmp(key, "max_intervals") ) { /* n = 1; type = i: UNUR_PAR *parameters, int max_ivs */ result = _unur_str_par_set_i(par,key,type_args,args,unur_tabl_set_max_intervals); break; } if ( !strcmp(key, "max_sqhratio") ) { /* n = 1; type = d: UNUR_PAR *parameters, double max_ratio */ result = _unur_str_par_set_d(par,key,type_args,args,unur_tabl_set_max_sqhratio); break; } break; case 'n': if ( !strcmp(key, "nstp") ) { /* n = 1; type = i: UNUR_PAR *parameters, int n_stp */ result = _unur_str_par_set_i(par,key,type_args,args,unur_tabl_set_nstp); break; } break; case 'p': if ( !strcmp(key, "pedantic") ) { /* n = 1; type = i: UNUR_PAR *parameters, int pedantic */ result = _unur_str_par_set_i(par,key,type_args,args,unur_tabl_set_pedantic); break; } break; case 's': if ( !strcmp(key, "slopes") ) { /* n = 2; type = Di: UNUR_PAR *parameters, const double *slopes, int n_slopes */ result = _unur_str_par_set_Di(par,key,type_args,args,unur_tabl_set_slopes,mlist); break; } break; case 'u': if ( !strcmp(key, "usedars") ) { /* n = 1; type = i: UNUR_PAR *parameters, int usedars */ result = _unur_str_par_set_i(par,key,type_args,args,unur_tabl_set_usedars); break; } if ( !strcmp(key, "useear") ) { /* n = 1; type = i: UNUR_PAR *parameters, int useear */ result = _unur_str_par_set_i(par,key,type_args,args,unur_tabl_set_useear); break; } break; case 'v': if ( !strcmp(key, "variant_ia") ) { /* n = 1; type = i: UNUR_PAR *parameters, int use_ia */ result = _unur_str_par_set_i(par,key,type_args,args,unur_tabl_set_variant_ia); break; } if ( !strcmp(key, "variant_splitmode") ) { /* n = 1; type = u: UNUR_PAR *parameters, unsigned splitmode */ result = _unur_str_par_set_u(par,key,type_args,args,unur_tabl_set_variant_splitmode); break; } if ( !strcmp(key, "verify") ) { /* n = 1; type = i: UNUR_PAR *parameters, int verify */ result = _unur_str_par_set_i(par,key,type_args,args,unur_tabl_set_verify); break; } } break; case UNUR_METH_TDR: switch (*key) { case 'c': if ( !strcmp(key, "c") ) { /* n = 1; type = d: UNUR_PAR *parameters, double c */ result = _unur_str_par_set_d(par,key,type_args,args,unur_tdr_set_c); break; } if ( !strcmp(key, "cpoints") ) { /* n = 2; type = iD: UNUR_PAR *parameters, int n_stp, const double *stp */ result = _unur_str_par_set_iD(par,key,type_args,args,unur_tdr_set_cpoints,mlist); break; } break; case 'd': if ( !strcmp(key, "darsfactor") ) { /* n = 1; type = d: UNUR_PAR *parameters, double factor */ result = _unur_str_par_set_d(par,key,type_args,args,unur_tdr_set_darsfactor); break; } break; case 'g': if ( !strcmp(key, "guidefactor") ) { /* n = 1; type = d: UNUR_PAR *parameters, double factor */ result = _unur_str_par_set_d(par,key,type_args,args,unur_tdr_set_guidefactor); break; } break; case 'm': if ( !strcmp(key, "max_intervals") ) { /* n = 1; type = i: UNUR_PAR *parameters, int max_ivs */ result = _unur_str_par_set_i(par,key,type_args,args,unur_tdr_set_max_intervals); break; } if ( !strcmp(key, "max_sqhratio") ) { /* n = 1; type = d: UNUR_PAR *parameters, double max_ratio */ result = _unur_str_par_set_d(par,key,type_args,args,unur_tdr_set_max_sqhratio); break; } break; case 'p': if ( !strcmp(key, "pedantic") ) { /* n = 1; type = i: UNUR_PAR *parameters, int pedantic */ result = _unur_str_par_set_i(par,key,type_args,args,unur_tdr_set_pedantic); break; } break; case 'r': if ( !strcmp(key, "reinit_ncpoints") ) { /* n = 1; type = i: UNUR_PAR *parameters, int ncpoints */ result = _unur_str_par_set_i(par,key,type_args,args,unur_tdr_set_reinit_ncpoints); break; } if ( !strcmp(key, "reinit_percentiles") ) { /* n = 2; type = iD: UNUR_PAR *parameters, int n_percentiles, const double *percentiles */ result = _unur_str_par_set_iD(par,key,type_args,args,unur_tdr_set_reinit_percentiles,mlist); break; } break; case 'u': if ( !strcmp(key, "usecenter") ) { /* n = 1; type = i: UNUR_PAR *parameters, int usecenter */ result = _unur_str_par_set_i(par,key,type_args,args,unur_tdr_set_usecenter); break; } if ( !strcmp(key, "usedars") ) { /* n = 1; type = i: UNUR_PAR *parameters, int usedars */ result = _unur_str_par_set_i(par,key,type_args,args,unur_tdr_set_usedars); break; } if ( !strcmp(key, "usemode") ) { /* n = 1; type = i: UNUR_PAR *parameters, int usemode */ result = _unur_str_par_set_i(par,key,type_args,args,unur_tdr_set_usemode); break; } break; case 'v': if ( !strcmp(key, "variant_gw") ) { /* n = 0; type = : UNUR_PAR *parameters */ result = _unur_str_par_set_void(par,key,type_args,args,unur_tdr_set_variant_gw); break; } if ( !strcmp(key, "variant_ia") ) { /* n = 0; type = : UNUR_PAR *parameters */ result = _unur_str_par_set_void(par,key,type_args,args,unur_tdr_set_variant_ia); break; } if ( !strcmp(key, "variant_ps") ) { /* n = 0; type = : UNUR_PAR *parameters */ result = _unur_str_par_set_void(par,key,type_args,args,unur_tdr_set_variant_ps); break; } if ( !strcmp(key, "verify") ) { /* n = 1; type = i: UNUR_PAR *parameters, int verify */ result = _unur_str_par_set_i(par,key,type_args,args,unur_tdr_set_verify); break; } } break; case UNUR_METH_UTDR: switch (*key) { case 'c': if ( !strcmp(key, "cpfactor") ) { /* n = 1; type = d: UNUR_PAR *parameters, double cp_factor */ result = _unur_str_par_set_d(par,key,type_args,args,unur_utdr_set_cpfactor); break; } break; case 'd': if ( !strcmp(key, "deltafactor") ) { /* n = 1; type = d: UNUR_PAR *parameters, double delta */ result = _unur_str_par_set_d(par,key,type_args,args,unur_utdr_set_deltafactor); break; } break; case 'p': if ( !strcmp(key, "pdfatmode") ) { /* n = 1; type = d: UNUR_PAR *parameters, double fmode */ result = _unur_str_par_set_d(par,key,type_args,args,unur_utdr_set_pdfatmode); break; } break; case 'v': if ( !strcmp(key, "verify") ) { /* n = 1; type = i: UNUR_PAR *parameters, int verify */ result = _unur_str_par_set_i(par,key,type_args,args,unur_utdr_set_verify); break; } } break; case UNUR_METH_VEMPK: switch (*key) { case 's': if ( !strcmp(key, "smoothing") ) { /* n = 1; type = d: UNUR_PAR *parameters, double smoothing */ result = _unur_str_par_set_d(par,key,type_args,args,unur_vempk_set_smoothing); break; } break; case 'v': if ( !strcmp(key, "varcor") ) { /* n = 1; type = i: UNUR_PAR *parameters, int varcor */ result = _unur_str_par_set_i(par,key,type_args,args,unur_vempk_set_varcor); break; } } break; case UNUR_METH_VNROU: switch (*key) { case 'r': if ( !strcmp(key, "r") ) { /* n = 1; type = d: UNUR_PAR *parameters, double r */ result = _unur_str_par_set_d(par,key,type_args,args,unur_vnrou_set_r); break; } break; case 'v': if ( !strcmp(key, "v") ) { /* n = 1; type = d: UNUR_PAR *parameters, double vmax */ result = _unur_str_par_set_d(par,key,type_args,args,unur_vnrou_set_v); break; } if ( !strcmp(key, "verify") ) { /* n = 1; type = i: UNUR_PAR *parameters, int verify */ result = _unur_str_par_set_i(par,key,type_args,args,unur_vnrou_set_verify); break; } } break; } /* Ignored set commands: */ /* int unur_mixt_set_useinversion( UNUR_PAR *parameters, int useinv ); n = 1; type = i */ /* Unsupported set commands: */ /* int unur_cext_set_init( UNUR_PAR *parameters, int (*init)(UNUR_GEN *gen) ); n = 1; type = I */ /* int unur_cext_set_sample( UNUR_PAR *parameters, double (*sample)(UNUR_GEN *gen) ); n = 1; type = D */ /* int unur_dext_set_init( UNUR_PAR *parameters, int (*init)(UNUR_GEN *gen) ); n = 1; type = I */ /* int unur_dext_set_sample( UNUR_PAR *parameters, int (*sample)(UNUR_GEN *gen) ); n = 1; type = I */ /* int unur_empk_set_kernelgen( UNUR_PAR *parameters, const UNUR_GEN *kernelgen, double alpha, double kernelvar ); n = 3; type = ?dd */ /* int unur_gibbs_set_startingpoint( UNUR_PAR *parameters, const double *x0 ); n = 1; type = D */ /* int unur_hitro_set_u( UNUR_PAR *parameters, const double *umin, const double *umax ); n = 2; type = DD */ /* int unur_hitro_set_startingpoint( UNUR_PAR *parameters, const double *x0 ); n = 1; type = D */ /* int unur_mcorr_set_eigenvalues( UNUR_PAR *par, const double *eigenvalues ); n = 1; type = D */ /* int unur_vnrou_set_u( UNUR_PAR *parameters, double *umin, double *umax ); n = 2; type = DD */ if (result == UNUR_ERR_STR_UNKNOWN) { /* no valid parameter found */ /* try extra keywords */ if ( !strcmp(key, "debug") ) { /* n = 1; type = u: UNUR_PAR *parameters, unsigned DEBUG */ result = _unur_str_par_set_u(par,key,type_args,args,unur_set_debug); } } /* check result */ if (result == UNUR_ERR_STR_UNKNOWN) { /* unknown parameter */ _unur_error_unknown(key,"parameter for given method"); return UNUR_ERR_STR_UNKNOWN; } else if (result != UNUR_SUCCESS) { /* invalid data for parameter */ _unur_error_invalid(key,"set call"); return UNUR_ERR_STR_SYNTAX; } return UNUR_SUCCESS; } /* end of _unur_str_par_set() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/parser/Makefile.in0000644001357500135600000004646314430713360014203 00000000000000# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = src/parser ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libparser_la_LIBADD = am_libparser_la_OBJECTS = parser.lo stringparser.lo functparser.lo libparser_la_OBJECTS = $(am_libparser_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/functparser.Plo \ ./$(DEPDIR)/parser.Plo ./$(DEPDIR)/stringparser.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libparser_la_SOURCES) DIST_SOURCES = $(libparser_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autoconf/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILECMD = @FILECMD@ GREP = @GREP@ HAVE_DIVIDE_BY_ZERO = @HAVE_DIVIDE_BY_ZERO@ HAVE_IEEE_COMPARISONS = @HAVE_IEEE_COMPARISONS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNURAN_LT_VERSION = @UNURAN_LT_VERSION@ UNURAN_SUPPORTS_GSL = @UNURAN_SUPPORTS_GSL@ UNURAN_SUPPORTS_PRNG = @UNURAN_SUPPORTS_PRNG@ UNURAN_SUPPORTS_RNGSTREAM = @UNURAN_SUPPORTS_RNGSTREAM@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ have_valgrind = @have_valgrind@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = \ -I$(top_srcdir)/src noinst_LTLIBRARIES = libparser.la libparser_la_SOURCES = \ parser.c parser.h parser_source.h \ stringparser.c stringparser_lists.ch \ functparser.c \ functparser_source.h \ functparser_struct.h \ functparser_symbols.h \ functparser_stringgen.ch \ functparser_debug.ch \ functparser_deriv.ch \ functparser_eval.ch \ functparser_init.ch \ functparser_parser.ch \ functparser_scanner.ch EXTRA_DIST = \ make_stringparser.pl \ functparser_doc.dh \ stringparser_doc.dh \ stringparser_lists.ch.in parser_srcdir = $(top_srcdir)/src/parser # clean backup files CLEANFILES = *~ # clean generated files MAINTAINERCLEANFILES = \ stringparser_lists.ch \ stringparser_doc.dh \ .dep-stringparser_c \ Makefile.in all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/parser/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/parser/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libparser.la: $(libparser_la_OBJECTS) $(libparser_la_DEPENDENCIES) $(EXTRA_libparser_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libparser_la_OBJECTS) $(libparser_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/functparser.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parser.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stringparser.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/functparser.Plo -rm -f ./$(DEPDIR)/parser.Plo -rm -f ./$(DEPDIR)/stringparser.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/functparser.Plo -rm -f ./$(DEPDIR)/parser.Plo -rm -f ./$(DEPDIR)/stringparser.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .PRECIOUS: Makefile # make stringparser.c (process file stringparser.c.in) sinclude .dep-stringparser_c stringparser.c: stringparser_lists.ch stringparser_lists.ch: make_stringparser.pl stringparser_lists.ch.in $(parser_srcdir)/make_stringparser.pl \ < $(parser_srcdir)/stringparser_lists.ch.in \ > $(parser_srcdir)/stringparser_lists.ch # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: unuran-1.11.0/src/parser/parser.c0000644001357500135600000001164414420304141013557 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: parser.c * * * * common routines for parsing strings. * * * ***************************************************************************** * * * REMARK: * * The parser always uses the default debugging flag. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include "parser.h" #include "parser_source.h" /*---------------------------------------------------------------------------*/ char * _unur_parser_prepare_string( const char *str ) /*----------------------------------------------------------------------*/ /* Prepare string for processing: */ /* Make a working copy of the string. */ /* Remove all white spaces and convert to lower case letters. */ /* Single quotes (') are substituted with double quotes (") */ /* */ /* parameters: */ /* str ... pointer to string */ /* */ /* return: */ /* pointer to working string. */ /* */ /* as a side effect, a new string is allocated. */ /*----------------------------------------------------------------------*/ { char *tmp, *ptr; char *new; /* pointer to working copy of string */ size_t len; /* length of string */ /* length of string */ len = strlen(str)+1; /* allocate memory for copy */ new = _unur_xmalloc( len * sizeof(char) ); /* copy memory */ ptr = memcpy(new,str,len); /* copy characters but skip all white spaces */ for (tmp = ptr; *tmp != '\0'; tmp++) if ( !isspace(*tmp) ) { *ptr = tolower(*tmp); /* substitute ' with " */ if (*ptr == '\'') *ptr = '"'; ptr++; } /* terminate string */ *ptr = '\0'; /* return pointer to working copy */ return new; } /* end of _unur_parser_prepare_string() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/parser/functparser_parser.ch0000644001357500135600000013774414420445767016401 00000000000000/***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: functparser_parser.c * * * * Parse tokenized function string and construct function tree * * * ***************************************************************************** * * * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Parser **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ struct ftreenode * _unur_FunctDefinition (struct parser_data *pdata) /*----------------------------------------------------------------------*/ /* Get user defined function. */ /* */ /* FunctDefinition ::= DefFunctDesignator '=' Expression */ /* */ /* '=' */ /* / \ */ /* DefFunctDesignator Expression */ /* */ /* parameters: */ /* pdata ... pointer to parser object */ /* */ /* return: */ /* pointer to function tree */ /*----------------------------------------------------------------------*/ { struct ftreenode *node, *left, *right; char *symb; int token; /* check arguments */ CHECK_NULL(pdata,NULL); COOKIE_CHECK(pdata,CK_FSTR_PDATA,NULL); /* left hand side: DefFunctDesignator */ left = _unur_DefFunctDesignator(pdata); if (pdata->perrno) { _unur_fstr_free(left); return NULL; } /* next token must be "=" sign */ if ( _unur_fstr_next_token(pdata,&token,&symb) != UNUR_SUCCESS || strcmp(symb,"=") != 0 ) { _unur_fstr_free(left); return _unur_fstr_error_parse(pdata,ERR_EXPECT_EQUAL,__LINE__); } /* right hand side: function term */ right = _unur_Expression(pdata); if (pdata->perrno) { _unur_fstr_free(left); _unur_fstr_free(right); return NULL; } /* store function in node */ node = _unur_fstr_create_node(symb,0.,token,left,right); /* return pointer to function */ return node; } /* end of _unur_FunctDefinition() */ /*---------------------------------------------------------------------------*/ struct ftreenode * _unur_DefFunctDesignator (struct parser_data *pdata) /*----------------------------------------------------------------------*/ /* Definition of user defined function. */ /* */ /* DefFunctDesignator ::= Identifier '(' DefParameterlist ')' */ /* */ /* Identifier */ /* / \ */ /* NULL DefParameterlist */ /* */ /* parameters: */ /* pdata ... pointer to parser object */ /* */ /* return: */ /* pointer to function tree */ /*----------------------------------------------------------------------*/ { struct ftreenode *node, *params; char *fsymb, *symb; int n_params; int funct, token; /* check arguments */ CHECK_NULL(pdata,NULL); COOKIE_CHECK(pdata,CK_FSTR_PDATA,NULL); /* get function identifier */ if ( _unur_fstr_next_token(pdata,&funct,&fsymb) != UNUR_SUCCESS || symbol[funct].type != S_UFUNCT ) return _unur_fstr_error_parse(pdata,ERR_EXPECT_FUNCT,__LINE__); /* read opening parenthesis '(' */ if ( _unur_fstr_next_token(pdata,&token,&symb) != UNUR_SUCCESS || symb[0] != '(' ) return _unur_fstr_error_parse(pdata,ERR_EXPECT_OPEN_P,__LINE__); /* read the parameter list */ params = _unur_DefParameterlist(pdata,&n_params); if (pdata->perrno) { _unur_fstr_free(params); return NULL; } /* read closing parenthesis ')' */ if ( _unur_fstr_next_token(pdata,&token,&symb) != UNUR_SUCCESS || symb[0] != ')' ) { _unur_fstr_free(params); return _unur_fstr_error_parse(pdata,ERR_EXPECT_CLOSE_P,__LINE__); } /* store function header in node */ node = _unur_fstr_create_node(fsymb,0.,funct,NULL,params); /* return pointer to function desigatior */ return node; } /* end of _unur_DefFunctDesignator() */ /*---------------------------------------------------------------------------*/ struct ftreenode * _unur_DefParameterlist(struct parser_data *pdata, int *n_params) /*----------------------------------------------------------------------*/ /* Parameter list for user defined function. */ /* */ /* DefParameterlist ::= '(' Identifier [ ',' Identifier ] ')' */ /* */ /* Identifier ',' */ /* / \ or: / \ */ /* NULL NULL more identifiers tree Identifier */ /* / \ */ /* NULL NULL */ /* parameters: */ /* pdata ... pointer to parser object */ /* n_params ... detected number of parameters for defined function */ /* */ /* return: */ /* pointer to function tree */ /*----------------------------------------------------------------------*/ { struct ftreenode *node, *left, *right; char *symb; int token; /* check arguments */ CHECK_NULL(pdata,NULL); COOKIE_CHECK(pdata,CK_FSTR_PDATA,NULL); /* read user defined identifier, i.e. a variable */ if ( _unur_fstr_next_token(pdata,&token,&symb) != UNUR_SUCCESS || symbol[token].type != S_UIDENT ) return _unur_fstr_error_parse(pdata,ERR_EXPECT_VAR,__LINE__); /* make node for first parameter of function and set */ /* counter for parameters to 1 */ node = _unur_fstr_create_node(symb,0.,token,NULL,NULL); *n_params = 1; /* scan token list while we find a list separator `,' */ while ( _unur_fstr_next_token(pdata,&token,&symb) != UNUR_SUCCESS || symb[0] == ',' ) { /* get next variable */ if ( _unur_fstr_next_token(pdata,&token,&symb) != UNUR_SUCCESS || symbol[token].type != S_UIDENT ) { _unur_fstr_free(node); return _unur_fstr_error_parse(pdata,ERR_EXPECT_VAR,__LINE__); } /* old node becomes left node of `,' node */ left = node; /* make node for next variable (becomes right node) */ /* and update counter for parameters */ right = _unur_fstr_create_node(symb,0.,token,NULL,NULL); (*n_params)++; /* make node for `,' separator */ node = _unur_fstr_create_node(",",0.,s_comma,left,right); } /* set token pointer to first element after parameter list */ --(pdata->tno); /* return pointer to parameter list */ return node; } /* end of _unur_DefParameterlist() */ /*---------------------------------------------------------------------------*/ struct ftreenode * _unur_Expression (struct parser_data *pdata) /*----------------------------------------------------------------------*/ /* Expression ::= SimpleExpression [ RelationOperator SimpleExpression ] */ /* */ /* RelationOperator */ /* SimpleExpression or: / \ */ /* SimpleExpression SimpleExpression */ /* */ /* parameters: */ /* pdata ... pointer to parser object */ /* */ /* return: */ /* pointer to function tree */ /*----------------------------------------------------------------------*/ { struct ftreenode *node, *left, *right; char *symb; int token; /* check arguments */ CHECK_NULL(pdata,NULL); COOKIE_CHECK(pdata,CK_FSTR_PDATA,NULL); /* read simple expression from function string */ left = _unur_SimpleExpression(pdata); if (pdata->perrno) { _unur_fstr_free(left); return NULL; } /* get next token */ if ( _unur_fstr_next_token(pdata,&token,&symb) == UNUR_SUCCESS && symbol[token].type == S_REL_OP ) { /* relation operator --> read r.h.s.*/ right = _unur_SimpleExpression(pdata); if (pdata->perrno) { _unur_fstr_free(left); _unur_fstr_free(right); return NULL; } /* create a new node */ node = _unur_fstr_create_node(symb,0.,token,left,right); } else { /* we only have a simple expression */ /* hence we set token pointer to get same token again */ --(pdata->tno); node = left; } /* return pointer to Expression */ return node; } /* end of _unur_Expression() */ /*---------------------------------------------------------------------------*/ struct ftreenode * _unur_SimpleExpression (struct parser_data *pdata) /*----------------------------------------------------------------------*/ /* SimpleExpression ::= STerm { AddingOperator Term } */ /* */ /* AddingOperator */ /* STerm or: / \ */ /* more terms tree Term */ /* */ /* parameters: */ /* pdata ... pointer to parser object */ /* */ /* return: */ /* pointer to function tree */ /*----------------------------------------------------------------------*/ { struct ftreenode *node, *left, *right; char *symb; int token; /* check arguments */ CHECK_NULL(pdata,NULL); COOKIE_CHECK(pdata,CK_FSTR_PDATA,NULL); /* get next Term in string */ node = _unur_STerm(pdata); if (pdata->perrno) { _unur_fstr_free(node); return NULL; } /* get next token */ while ( _unur_fstr_next_token(pdata,&token,&symb) == UNUR_SUCCESS && symbol[token].type == S_ADD_OP) { /* get Term after adding operator and */ /* use node a right node of new operator node */ left = node; right = _unur_Term(pdata); if (pdata->perrno) { _unur_fstr_free(left); _unur_fstr_free(right); return NULL; } node = _unur_fstr_create_node(symb,0.,token,left,right); } /* set token pointer to get same token again */ --(pdata->tno); /* return pointer */ return node; } /* end of _unur_SimpleExpression() */ /*---------------------------------------------------------------------------*/ struct ftreenode * _unur_STerm (struct parser_data *pdata) /*----------------------------------------------------------------------*/ /* STerm ::= [ '+' | '-' ] Term */ /* */ /* '-' */ /* Term or: / \ */ /* '0' Term */ /* / \ */ /* NULL NULL */ /* */ /* parameters: */ /* pdata ... pointer to parser object */ /* */ /* return: */ /* pointer to function tree */ /*----------------------------------------------------------------------*/ { struct ftreenode *node, *left, *right; char *symb; int token; /* check arguments */ CHECK_NULL(pdata,NULL); COOKIE_CHECK(pdata,CK_FSTR_PDATA,NULL); /* get next token */ if ( _unur_fstr_next_token(pdata,&token,&symb) != UNUR_SUCCESS) /* there is no next token */ return NULL; if ( symb[0] == '-' ) { /* term with negative sign */ /* "-" is interpreted as binary operator */ /* thus "0" is added in front of it */ left = _unur_fstr_create_node(NULL,0.,s_uconst,NULL,NULL); right = _unur_Term(pdata); if (pdata->perrno) { _unur_fstr_free(left); _unur_fstr_free(right); return NULL; } node = _unur_fstr_create_node(symb,0.,token,left,right); } else { /* term with positive sign or without any sign */ if( symb[0] != '+' ) { /* set pointer to previous token again */ --(pdata->tno); } node = _unur_Term(pdata); if (pdata->perrno) { _unur_fstr_free(node); return NULL; } } /* return pointer to term */ return node; } /* end of _unur_STerm() */ /*---------------------------------------------------------------------------*/ struct ftreenode * _unur_Term (struct parser_data *pdata) /*----------------------------------------------------------------------*/ /* Term ::= Factor [ MultiplyingOperator Factor ] */ /* */ /* MultiplyingOperator */ /* Factor or: / \ */ /* more factors tree Factor */ /* */ /* parameters: */ /* pdata ... pointer to parser object */ /* */ /* return: */ /* pointer to function tree */ /*----------------------------------------------------------------------*/ { struct ftreenode *node, *left, *right; char *symb; int token; /* check arguments */ CHECK_NULL(pdata,NULL); COOKIE_CHECK(pdata,CK_FSTR_PDATA,NULL); /* get next factor of multiplication */ node = _unur_Factor(pdata); if (pdata->perrno) { _unur_fstr_free(node); return NULL; } /* get next token */ while ( _unur_fstr_next_token(pdata,&token,&symb) == UNUR_SUCCESS && symbol[token].type == S_MUL_OP ) { /* get Factor after multiplication operator and */ /* use node a right node of new operator node */ left = node; right = _unur_Factor(pdata); if (pdata->perrno) { _unur_fstr_free(left); _unur_fstr_free(right); return NULL; } node = _unur_fstr_create_node(symb,0.,token,left,right); } /* set token pointer to get same token again */ --(pdata->tno); /* return pointer to term */ return node; } /* end of _unur_Term() */ /*---------------------------------------------------------------------------*/ struct ftreenode * _unur_Factor (struct parser_data *pdata) /*----------------------------------------------------------------------*/ /* Factor ::= Base [ '^' Exponent ] */ /* */ /* '^' */ /* Bas_Exp or: / \ */ /* Bas_Exp Bas_Exp */ /* */ /* parameters: */ /* pdata ... pointer to parser object */ /* */ /* return: */ /* pointer to function tree */ /*----------------------------------------------------------------------*/ { struct ftreenode *node, *left, *right; char *symb; int token; /* check arguments */ CHECK_NULL(pdata,NULL); COOKIE_CHECK(pdata,CK_FSTR_PDATA,NULL); /* get base of factor */ left = _unur_Bas_Exp(pdata); if (pdata->perrno) { _unur_fstr_free(left); return NULL; } /* get next token */ if ( _unur_fstr_next_token(pdata,&token,&symb) == UNUR_SUCCESS && symb[0] == '^' ) { /* get exponent of factor */ right = _unur_Bas_Exp(pdata); if (pdata->perrno) { _unur_fstr_free(left); _unur_fstr_free(right); return NULL; } /* and create node for '^' operator */ node = _unur_fstr_create_node(symb,0.,token,left,right); } else { /* no exponent */ /* set pointer to previous token again */ --(pdata->tno); /* and return base */ node = left; } /* return pointer to factor */ return node; } /* end of _unur_Factor() */ /*---------------------------------------------------------------------------*/ struct ftreenode * _unur_Bas_Exp (struct parser_data *pdata) /*----------------------------------------------------------------------*/ /* Base ::= Exponent */ /* Exponent ::= UnsignedConstant | Identifier | FunctDesignator */ /* | '(' Expression ')' */ /* */ /* UnsignedConstant Identifier */ /* / \ or / \ or */ /* NULL NULL NULL NULL */ /* */ /* FunctDesignator or Expression */ /* */ /* parameters: */ /* pdata ... pointer to parser object */ /* */ /* return: */ /* pointer to function tree */ /*----------------------------------------------------------------------*/ { struct ftreenode *node; char *symb; int token; /* check arguments */ CHECK_NULL(pdata,NULL); COOKIE_CHECK(pdata,CK_FSTR_PDATA,NULL); /* get next token */ if ( _unur_fstr_next_token(pdata,&token,&symb) != UNUR_SUCCESS) return _unur_fstr_error_parse(pdata,7,__LINE__); /* constant or and variable */ if( symbol[token].type==S_UCONST || symbol[token].type==S_UIDENT || symbol[token].type==S_SCONST ) { /* make a new end node */ node = _unur_fstr_create_node(symb,0.,token,NULL,NULL); } /* system function */ else if( symbol[token].type == S_SFUNCT ) { /* set pointer to previous token again */ --(pdata->tno); /* and get function */ node = _unur_FunctDesignator(pdata); if (pdata->perrno) { _unur_fstr_free(node); return NULL; } } else if( symb[0] == '(' ) { /* opening parenthesis --> read expression in side parenthesis */ node = _unur_Expression(pdata); if (pdata->perrno) { _unur_fstr_free(node); return NULL; } /* next symbol must be closing parenthesis */ if ( _unur_fstr_next_token(pdata,&token,&symb) != UNUR_SUCCESS || symb[0] != ')' ) return _unur_fstr_error_parse(pdata,ERR_EXPECT_CLOSE_P,__LINE__); } else { /* unkown symbol */ --(pdata->tno); return _unur_fstr_error_parse(pdata,ERR_UNKNOWN_SYMBOL,__LINE__); } /* return pointer to base or exponent of an expression */ return node; } /* end of _unur_Bas_Exp() */ /*---------------------------------------------------------------------------*/ struct ftreenode * _unur_FunctDesignator (struct parser_data *pdata) /*----------------------------------------------------------------------*/ /* FunctDesignator ::= FuncIdentifier '(' ActualParameterlist ')' */ /* */ /* Identifier */ /* / \ */ /* NULL ActualParameterlist */ /* */ /* parameters: */ /* pdata ... pointer to parser object */ /* */ /* return: */ /* pointer to function tree */ /*----------------------------------------------------------------------*/ { struct ftreenode *node, *params; char *fsymb, *symb; int funct, token; int n_params; /* check arguments */ CHECK_NULL(pdata,NULL); COOKIE_CHECK(pdata,CK_FSTR_PDATA,NULL); /* get function identifier for system function */ if ( _unur_fstr_next_token(pdata,&funct,&fsymb) != UNUR_SUCCESS || symbol[funct].type != S_SFUNCT ) return _unur_fstr_error_parse(pdata,ERR_EXPECT_FUNCT,__LINE__); /* get number of parameters for this function */ n_params = symbol[funct].info; /* read opening parenthesis '(' */ if ( _unur_fstr_next_token(pdata,&token,&symb) != UNUR_SUCCESS || symb[0] != '(' ) return _unur_fstr_error_parse(pdata,ERR_EXPECT_OPEN_P,__LINE__); /* read the parameter list */ params = _unur_ActualParameterlist(pdata,n_params); if (pdata->perrno) { _unur_fstr_free(params); return NULL; } /* read closing parenthesis ')' */ if ( _unur_fstr_next_token(pdata,&token,&symb) != UNUR_SUCCESS || symb[0] != ')' ) { _unur_fstr_free(params); return _unur_fstr_error_parse(pdata,ERR_EXPECT_CLOSE_P,__LINE__); } /* store function in new node */ node = _unur_fstr_create_node(fsymb,0.,funct,NULL,params); /* return pointer to function */ return node; } /* end of _unur_FunctDesignator() */ /*---------------------------------------------------------------------------*/ struct ftreenode * _unur_ActualParameterlist (struct parser_data *pdata, int n_params) /*----------------------------------------------------------------------*/ /* ActualParameterlist ::= ActualParameter [ ',' ActualParameter ] */ /* */ /* ',' */ /* Expression or: / \ */ /* more expressions tree Expression */ /* */ /* parameters: */ /* pdata ... pointer to parser object */ /* n_params ... number of expected parameters in list */ /* */ /* return: */ /* pointer to function tree */ /*----------------------------------------------------------------------*/ { struct ftreenode *node, *left, *right; char *symb; int token; int c_params; /* counter for parameters */ /* check arguments */ CHECK_NULL(pdata,NULL); COOKIE_CHECK(pdata,CK_FSTR_PDATA,NULL); /* read first parameter from string ... */ node = _unur_Expression(pdata); if (pdata->perrno) { _unur_fstr_free(node); return NULL; } /* .. and set counter for parameters to 1 */ c_params = 1; /* scan token list while we find a list separator `,' */ while ( _unur_fstr_next_token(pdata,&token,&symb) != UNUR_SUCCESS || symb[0] == ',' ) { /* update counter for parameters */ c_params++; if (c_params > n_params) { _unur_fstr_free(node); return _unur_fstr_error_parse(pdata,ERR_INVALID_N_PARAMS,__LINE__); } /* old node becomes left node of `,' node */ left = node; /* make node for next variable (becomes right node) */ right = _unur_Expression(pdata); if (pdata->perrno) { _unur_fstr_free(left); _unur_fstr_free(right); return NULL; } /* make node for `,' separator */ node = _unur_fstr_create_node(",",0.,s_comma,left,right); } /* set token pointer to first element after parameter list */ --(pdata->tno); /* check number of parameters */ if (c_params < n_params) { _unur_fstr_free(node); return _unur_fstr_error_parse(pdata,ERR_INVALID_N_PARAMS,__LINE__); } /* return pointer to parameter list */ return node; } /* end of _unur_ActualParameterlist() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Simplify tree **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ struct ftreenode * _unur_fstr_simplification (const char *symb, int token, struct ftreenode *left, struct ftreenode *right) /*----------------------------------------------------------------------*/ /* Try to simpify nodes */ /* */ /* parameters: */ /* symb ... symbol string */ /* token ... token for which new node should be created */ /* left ... pointer to left node */ /* right ... pointer to right node */ /* */ /* return: */ /* Pointer to simplified node */ /* NULL if no simplication is possible */ /* */ /* Side effects: */ /* 'left' or 'right' may be freed when the node is simplified. */ /* This cannot happen if NULL is returned. */ /*----------------------------------------------------------------------*/ { /* some booleans */ int l_const = left && (left->type == S_SCONST || left->type == S_UCONST); int r_const = right && (right->type == S_SCONST || right->type == S_UCONST); int l_0 = (l_const && _unur_iszero(left->val)); int l_1 = (l_const && _unur_isone(left->val)); int r_0 = (r_const && _unur_iszero(right->val)); int r_1 = (r_const && _unur_isone(right->val)); int and; char s = symb[0]; /* Exp Exp * / \ / \ * NULL ',' ==> X Y * / \ * X Y */ if ( left == NULL && right && right->symbol[0] == ',' ) { COOKIE_CHECK(right,CK_FSTR_TNODE,NULL); right->token = token; right->symbol = symbol[token].name; right->type = symbol[token].type; return right; } /* Operator Operator * / \ or / \ ==> Const (result of computation) * Const Const NULL Const */ if ( (l_const || left==NULL) && r_const && s!=',') { CHECK_NULL(right,NULL); COOKIE_CHECK(right,CK_FSTR_TNODE,NULL); /* compute new value */ right->val = ( (left) ? (*symbol[token].vcalc)(left->val,right->val) : (*symbol[token].vcalc)(0.,right->val) ); right->token = s_uconst; right->type = S_UCONST; right->left = NULL; right->right = NULL; _unur_fstr_free(left); return right; } /* '+' '*' * / \ or / \ ==> X * 0 X 1 X */ if ( (l_0 && s=='+' ) || (l_1 && s=='*') ) { CHECK_NULL(left,NULL); COOKIE_CHECK(left,CK_FSTR_TNODE,NULL); CHECK_NULL(right,NULL); COOKIE_CHECK(right,CK_FSTR_TNODE,NULL); _unur_fstr_free(left); return right; } /* '+' '-' * / \ or / \ or * X 0 X 0 * * '*' '/' * / \ or / \ or * X 1 X 1 * * '^' * / \ ==> X * X 1 */ if ( (r_0 && (s=='+' || s=='-')) || (r_1 && (s=='*' || s=='/' || s=='^')) ) { CHECK_NULL(left,NULL); COOKIE_CHECK(left,CK_FSTR_TNODE,NULL); CHECK_NULL(right,NULL); COOKIE_CHECK(right,CK_FSTR_TNODE,NULL); _unur_fstr_free(right); return left; } /* '*' '*' * / \ or / \ or * 0 X X 0 * * '/' '^' * / \ or / \ or * 0 X 0 X * * "and" "and" * / \ or / \ ==> 0 * 0 X X 0 */ and = (strcmp(symb,"and")==0); if ( l_0 && (s=='*' || s=='/' || s=='^' || and) ) { CHECK_NULL(left,NULL); COOKIE_CHECK(left,CK_FSTR_TNODE,NULL); CHECK_NULL(right,NULL); COOKIE_CHECK(right,CK_FSTR_TNODE,NULL); _unur_fstr_free(right); return left; } if (r_0 && (s=='*' || and ) ) { CHECK_NULL(left,NULL); COOKIE_CHECK(left,CK_FSTR_TNODE,NULL); CHECK_NULL(right,NULL); COOKIE_CHECK(right,CK_FSTR_TNODE,NULL); _unur_fstr_free(left); return right; } /* '^' '^' * / \ or / \ ==> 1 * X 0 1 X */ if (r_0 && s=='^') { CHECK_NULL(left,NULL); COOKIE_CHECK(left,CK_FSTR_TNODE,NULL); CHECK_NULL(right,NULL); COOKIE_CHECK(right,CK_FSTR_TNODE,NULL); _unur_fstr_free(left); right->val = 1.; return right; } if (l_1 && s=='^') { CHECK_NULL(left,NULL); COOKIE_CHECK(left,CK_FSTR_TNODE,NULL); CHECK_NULL(right,NULL); COOKIE_CHECK(right,CK_FSTR_TNODE,NULL); _unur_fstr_free(right); return left; } /* '/' * ___/ \___ * / \ * X X ==> 1 * / \ / \ * NULL NULL NULL NULL */ if ( ( symb[0] == '/' && left && left->left==NULL && left->right==NULL && right && right->left==NULL && right->right==NULL && strcmp(left->symbol,right->symbol)== 0 ) ) { CHECK_NULL(left,NULL); COOKIE_CHECK(left,CK_FSTR_TNODE,NULL); CHECK_NULL(right,NULL); COOKIE_CHECK(right,CK_FSTR_TNODE,NULL); _unur_fstr_free(left); right->token = s_uconst; right->symbol= symbol[s_uconst].name; right->val = 1.; right->type = S_UCONST; right->left = NULL; right->right = NULL; return right; } /* no simplification */ return NULL; } /* _unur_fstr_simplification() */ /*---------------------------------------------------------------------------*/ int _unur_fstr_reorganize (struct ftreenode *node) /*----------------------------------------------------------------------*/ /* Try to reorganize tree at node */ /* */ /* parameters: */ /* node ... pointer to node in tree */ /* */ /* return: */ /* 1 if successful */ /* 0 otherwise */ /*----------------------------------------------------------------------*/ { struct ftreenode *left, *right, *tmp; char symb; int l_const, r_const; int rl_0, ll_0; /* check arguments */ CHECK_NULL(node,0); COOKIE_CHECK(node,CK_FSTR_TNODE,0); left = node->left; right = node->right; symb = node->symbol[0]; /* some booleans */ l_const = left && (left->type == S_SCONST || left->type == S_UCONST); r_const = right && (right->type == S_SCONST || right->type == S_UCONST); rl_0 = (right && right->left && right->left->type == S_UCONST && _unur_iszero(right->left->val)); ll_0 = (left && left->left && left->left->type == S_UCONST && _unur_iszero(left->left->val)); /* Operator Operator * / \ or / \ ==> Const (result of computation) * Const Const NULL Const */ if ( (l_const || left==NULL) && r_const && symb!=',') { /* compute new value */ node->val = ( (left) ? (*symbol[node->token].vcalc)(left->val,right->val) : (*symbol[node->token].vcalc)(0.,right->val) ); node->token = s_uconst; node->type = S_UCONST; node->left = NULL; node->right = NULL; if (left) free(left); if (right) free(right); return 1; } /* '+' '-' * / \ / \ * X '-' ==> X Y * / \ * 0 Y */ if ( rl_0 && symb=='+' && right->symbol[0]=='-' ) { node->symbol = symbol[s_minus].name; node->token = s_minus; node->type = symbol[s_minus].type; node->right = right->right; free(right->left); free(right); return 1; } /* '-' '+' * / \ / \ * X '-' ==> X Y * / \ * 0 Y */ if ( rl_0 && symb=='-' && right->symbol[0]=='-' ) { node->symbol = symbol[s_plus].name; node->token = s_plus; node->type = symbol[s_plus].type; node->right = right->right; free(right->left); free(right); return 1; } /* '+' '-' * / \ / \ * '-' Y ==> Y X * / \ * 0 X */ if ( ll_0 && symb=='+' && left->symbol[0]=='-' ) { node->symbol = symbol[s_minus].name; node->token = s_minus; node->type = symbol[s_minus].type; tmp = node->right; node->right = left->right; node->left = tmp; free(left->left); free(left); return 1; } /* '*' '-' * / \ / \ * X '-' ==> 0 '*' * / \ / \ * 0 Y X Y */ if ( rl_0 && symb=='*' && right->symbol[0]=='-' ) { node->symbol = symbol[s_minus].name; node->token = s_minus; node->type = symbol[s_minus].type; right->symbol= symbol[s_mul].name; right->token = s_mul; right->type = symbol[s_mul].type; tmp = left; node->left = node->right->left; node->right = tmp; return 1; } /* no reorganization */ return 0; } /* end of _unur_fstr_reorganize() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Auxilliary routines **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ int _unur_fstr_next_token (struct parser_data *pdata, int *token, char **symb) /*----------------------------------------------------------------------*/ /* Get next token from list. */ /* */ /* parameters: */ /* pdata ... pointer to parser object */ /* token ... to store token */ /* symb ... to store symbol for token */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ CHECK_NULL(pdata,UNUR_ERR_NULL); COOKIE_CHECK(pdata,CK_FSTR_PDATA,UNUR_ERR_COOKIE); if (pdata->tno < pdata->n_tokens) { /* return token and increment scan position */ *token = pdata->token[pdata->tno]; *symb = pdata->tpos[pdata->tno]; ++(pdata->tno); return UNUR_SUCCESS; } else { /* no more tokens */ ++(pdata->tno); return UNUR_ERR_SILENT; } } /* end of _unur_fstr_next_token() */ /*---------------------------------------------------------------------------*/ struct ftreenode * _unur_fstr_create_node (const char *symb, double val, int token, struct ftreenode *left, struct ftreenode *right) /*----------------------------------------------------------------------*/ /* Create new node. */ /* */ /* parameters: */ /* symb ... symbol string */ /* val ... value of constant (only used if symb is NULL) */ /* token ... token for which node should be created */ /* left ... pointer to left node */ /* right ... pointer to right node */ /* */ /* return: */ /* pointer to new node */ /*----------------------------------------------------------------------*/ { struct ftreenode *node; if ( symb && (node = _unur_fstr_simplification(symb,token,left,right)) ) { /* node has been simplified --> use left node, remove right node */ } else { /* make new node */ node = _unur_xmalloc(sizeof(struct ftreenode)); COOKIE_SET(node,CK_FSTR_TNODE); node->symbol = symbol[token].name; node->token = token; node->type = symbol[token].type; node->left = left; node->right = right; /* compute and/or store constants in val field */ switch (symbol[token].type) { case S_UCONST: /* user defined constant, i.e. a number */ node->val = (symb) ? atof(symb) : val; break; case S_SCONST: /* system constant */ node->val = symbol[token].val; break; default: node->val = 0.; } } /* it might be possible to reorganize the tree */ _unur_fstr_reorganize(node); /* return node */ return node; } /* end of _unur_fstr_create_node() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Error messages **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ struct ftreenode * _unur_fstr_error_parse ( struct parser_data *pdata, int perrno, int line ) /*----------------------------------------------------------------------*/ /* Print error message when parsing function string */ /* */ /* parameters: */ /* pdata ... pointer to parser object */ /* perrno ... error number */ /* line ... line (to be inserted by __LINE__) */ /* */ /* return: */ /* NULL */ /*----------------------------------------------------------------------*/ { int i; struct unur_string *reason; /* check arguments */ CHECK_NULL(pdata,NULL); COOKIE_CHECK(pdata,CK_FSTR_PDATA,NULL); /* set parser error */ if (!pdata->perrno) pdata->perrno = perrno; /* create string for reason of error */ reason = _unur_string_new(); _unur_string_append( reason, "%s: ", _unur_fstr_error_code(perrno) ); for (i=0; itno-1; i++) _unur_string_append( reason, "%s ", pdata->tpos[i]); if (in_tokens) _unur_string_append( reason, " -->%s<-- ", pdata->tpos[i]); else _unur_string_append( reason, " <-- "); for (i++; in_tokens; i++) _unur_string_append( reason, "%s ",pdata->tpos[i]); /* report error */ _unur_error_x( GENTYPE, __FILE__, line, "error", UNUR_ERR_FSTR_SYNTAX,reason->text); /* free working space */ _unur_string_free( reason ); return NULL; } /* _unur_fstr_error_parse() */ /*---------------------------------------------------------------------------*/ const char * _unur_fstr_error_code ( int perrno ) /*----------------------------------------------------------------------*/ /* Print message for error number */ /* */ /* parameters: */ /* perrno ... error number */ /* */ /* return: */ /* pointer to message string */ /*----------------------------------------------------------------------*/ { switch (perrno) { case ERR_UNFINISHED: return "incomplete. not all tokens parsed"; case ERR_UNKNOWN_SYMBOL: return "unknown symbol in function string"; case ERR_EXPECT_EQUAL: return "expected symbol: '='"; case ERR_EXPECT_OPEN_P: return "expected symbol: '('"; case ERR_EXPECT_CLOSE_P: return "expected symbol: ')'"; case ERR_INVALID_N_PARAMS: return "invalid number of parameters for function"; case ERR_EXPECT_FUNCT: return "function (name) expected"; case ERR_EXPECT_VAR: return "user identifier (variable name) expected"; case ERR_MISSING: return "more tokens expected"; default: return ""; } } /* end of _unur_fstr_error_code() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/parser/functparser_struct.h0000644001357500135600000000653414420304141016232 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: functparser_struct.h * * * * PURPOSE: * * declares structures for function parser * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Structure for function tree */ struct ftreenode { char *symbol; /* name of token */ int token; /* location of token in list of symbols */ int type; /* type of token (e.g. S_ADD_OP) */ double val; /* value of constant or (and) value of node during evalution of tree */ struct ftreenode *left; /* pointer to left branch/leave of node */ struct ftreenode *right; /* pointer to right branch/leave of node */ #ifdef UNUR_COOKIES unsigned cookie; /* magic cookie */ #endif }; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/parser/Makefile.am0000644001357500135600000000217214420445767014173 00000000000000## Process this file with automake to produce Makefile.in AM_CPPFLAGS = \ -I$(top_srcdir)/src noinst_LTLIBRARIES = libparser.la libparser_la_SOURCES = \ parser.c parser.h parser_source.h \ stringparser.c stringparser_lists.ch \ functparser.c \ functparser_source.h \ functparser_struct.h \ functparser_symbols.h \ functparser_stringgen.ch \ functparser_debug.ch \ functparser_deriv.ch \ functparser_eval.ch \ functparser_init.ch \ functparser_parser.ch \ functparser_scanner.ch EXTRA_DIST = \ make_stringparser.pl \ functparser_doc.dh \ stringparser_doc.dh \ stringparser_lists.ch.in parser_srcdir = $(top_srcdir)/src/parser # make stringparser.c (process file stringparser.c.in) sinclude .dep-stringparser_c stringparser.c: stringparser_lists.ch stringparser_lists.ch: make_stringparser.pl stringparser_lists.ch.in $(parser_srcdir)/make_stringparser.pl \ < $(parser_srcdir)/stringparser_lists.ch.in \ > $(parser_srcdir)/stringparser_lists.ch # clean backup files CLEANFILES = *~ # clean generated files MAINTAINERCLEANFILES = \ stringparser_lists.ch \ stringparser_doc.dh \ .dep-stringparser_c \ Makefile.in unuran-1.11.0/src/parser/functparser_stringgen.ch0000644001357500135600000002576014420445767017077 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: functparser_codegen.c * * * * Make string or programming code for function given by its tree. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** API **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ char * _unur_fstr_tree2string ( const struct ftreenode *root, const char *variable, const char *function, int spaces ) /*----------------------------------------------------------------------*/ /* Produce string from function tree. */ /* As a side effect a string is allocated. */ /* */ /* parameters: */ /* root ... pointer to root of function tree */ /* variable ... pointer to name of variable */ /* function ... pointer to name of function */ /* spaces ... whether spaces are inserted around binary operators */ /* */ /* return: */ /* pointer to output string (should be freed when not used any more) */ /*----------------------------------------------------------------------*/ { struct unur_string output = {NULL, 0, 0}; /* check arguments */ _unur_check_NULL( GENTYPE,root,NULL ); /* make string */ _unur_fstr_node2string(&output,root,variable,function,spaces); return output.text; } /* end of _unur_fstr_tree2string() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Create function string and source code. **/ /*****************************************************************************/ int _unur_fstr_node2string ( struct unur_string *output, const struct ftreenode *node, const char *variable, const char *function, int spaces ) /*----------------------------------------------------------------------*/ /* Produce string from function subtree rooted at node. */ /* As a side effect a string is allocated. */ /* */ /* parameters: */ /* output ... pointer to string for output */ /* node ... pointer to node in function tree */ /* variable ... pointer to name of variable */ /* function ... pointer to name of function */ /* spaces ... whether spaces are inserted around binary operators */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { struct ftreenode *left = node->left; /* left branch of node */ struct ftreenode *right = node->right; /* right branch of node */ const char *symb; /* symbol for node (or NULL for constant) */ int type = node->type; /* type of symbol */ int priority = symbol[node->token].info; /* priority of symbol */ int operator, parenthesis; /* booleans */ /* get symbol for node */ switch (type) { case S_UIDENT: /* variable */ symb = variable; break; case S_UFUNCT: /* function */ symb = function; break; case S_UCONST: /* node contains constant */ /* use value in node instead of symbol */ symb = NULL; break; case S_SCONST: default: symb = node->symbol; } if (type == S_SFUNCT || type == S_UFUNCT) { /* node '(' left ',' right ')' */ _unur_fstr_print( output, symb, 0. ); _unur_fstr_print( output, "(", 0. ); if (left) { _unur_fstr_node2string(output,left,variable,function,spaces); _unur_fstr_print( output, ",", 0. ); } if (right) { _unur_fstr_node2string(output,right,variable,function,spaces); } _unur_fstr_print( output, ")", 0. ); } else if (symb && symb[0] == ',') { /* left ',' right */ _unur_fstr_print( output, ",", 0. ); if (left) { _unur_fstr_node2string(output,left,variable,function,spaces); _unur_fstr_print( output, ",", 0. ); } if (right) { _unur_fstr_node2string(output,right,variable,function,spaces); } } else { /* check whether enclosing blanks are required for typography */ operator = (type==S_REL_OP || type==S_ADD_OP || type==S_MUL_OP); /* left branch */ if (left) { /* always use parenthesis ... */ parenthesis = 1; /* ... except ... */ if (left->type == S_SCONST || left->type == S_UCONST || left->type == S_SFUNCT || left->type == S_UFUNCT || ( left->type == S_UIDENT && left->val >= 0. ) || ( priority < symbol[left->token].info && !isalpha(node->symbol[0]) ) || ( priority == symbol[left->token].info && (type == S_ADD_OP ) ) ) parenthesis = 0; if (parenthesis) _unur_fstr_print( output, "(", 0. ); if (left->type == S_UCONST && _unur_iszero(left->val) && node->symbol[0] == '-') /* there is no need to print "0 - ..." */ ; else _unur_fstr_node2string(output,left,variable,function,spaces); if (parenthesis) _unur_fstr_print( output, ")", 0. ); } /* symbol for node */ if (operator && spaces) _unur_fstr_print( output, " ", 0. ); _unur_fstr_print( output, symb, node->val ); if (operator && spaces) _unur_fstr_print( output, " ", 0. ); /* right branch */ if (right) { /* always use parenthesis ... */ parenthesis = 1; /* ... except ... */ if (right->type == S_SCONST || right->type == S_UCONST || right->type == S_SFUNCT || right->type == S_UFUNCT || ( right->type == S_UIDENT && right->val >= 0. ) || ( priority < symbol[right->token].info && !isalpha(node->symbol[0]) ) ) parenthesis = 0; if (parenthesis) _unur_fstr_print( output, "(", 0. ); _unur_fstr_node2string(output,right,variable,function,spaces); if (parenthesis) _unur_fstr_print( output, ")", 0. ); } } return UNUR_SUCCESS; } /* end of _unur_fstr_node2string() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Auxilliary routines **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ int _unur_fstr_print ( struct unur_string *output, const char *symb, double number ) /*----------------------------------------------------------------------*/ /* Print string or number into output string. */ /* The number is only printed if symb is the NULL pointer. */ /* */ /* parameters: */ /* output ... pointer to string for output */ /* symb ... string to be printed */ /* number ... constant to be printed */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { if (symb) /* copy symbol into string */ _unur_string_appendtext( output, symb ); else /* copy number symbol into output */ _unur_string_append( output, "%.16g", number); return UNUR_SUCCESS; } /* end of _unur_fstr_print() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/parser/parser_source.h0000644001357500135600000000635714420304141015151 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: parser_source.h * * * * PURPOSE: * * function prototypes for parser * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ char *_unur_parser_prepare_string( const char *str ); /*---------------------------------------------------------------------------*/ /* Prepare string for processing: */ /* Make a working copy of the str, remove all white spaces and convert to */ /* lower case letters. */ /* The string returned by this call should be freed when it is not required */ /* any more. */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/parser/functparser.c0000644001357500135600000012505214420445767014642 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: functparser.c * * * * Parser function string, evaluate function, print programm code. * * * * DESCRIPTION: * * Given a string for a function. * * The string is parser. * * A tree representing the function term is generated. * * A tree for the derivative of the function is generated. * * The tree is used to evalute the corresponding function for an x. * * The source code for a program is produced. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * ***************************************************************************** * * * REFERENCES: * * [1] Aho, A. and Ullman, J. (1972): The Theory of Parsing, Translating * * and Compiling. Prentice-Hall. * * * ***************************************************************************** * * * Description: * * * * Function parser for use with UNU.RAN. For list of symbols and functions * * see functparser_symbols.h. * * * * Important: * * Blanks are ignored, e.g. "x>-1 and x < 1" is transformed to * * "x>-1andx<1" and thus the parser aborts at the unknwn symbol "andx". * * Use parenthesis to solve this problem: (x>-1) and (x<1). * * * * The first unknown symbol is treated as the variable. * * * ***************************************************************************** * * * Pattern in Backus-Naur notation: * * * *---------------------------------------------------------------------------* * * * * * FunctDefinition ::= DefFunctDesignator '=' Expression * * * * '=' * * / \ * * DefFunctDesignator Expression * * * *---------------------------------------------------------------------------* * * * DefFunctDesignator ::= Identifier '(' DefParameterlist ')' * * * * Identifier * * / \ * * NULL DefParameterlist * * * *---------------------------------------------------------------------------* * * * DefParameterlist ::= '(' Identifier [ ',' Identifier ] ')' * * * * * * Identifier ',' * * / \ or: / \ * * NULL NULL more identifiers tree Identifier * * / \ * * NULL NULL * * * *---------------------------------------------------------------------------* * * * Expression ::= SimpleExpression [ RelationOperator SimpleExpression ] * * * * RelationOperator * * SimpleExpression or: / \ * * SimpleExpression SimpleExpression * * * *---------------------------------------------------------------------------* * * * SimpleExpression ::= STerm { AddingOperator Term } * * * * AddingOperator * * STerm or: / \ * * more terms tree Term * * * *---------------------------------------------------------------------------* * * * STerm ::= [ '+' | '-' ] Term * * * * '-' * * Term or: / \ * * '0' Term * * / \ * * NULL NULL * * * *---------------------------------------------------------------------------* * * * Term ::= Factor [ MultiplyingOperator Factor ] * * * * MultiplyingOperator * * Factor or: / \ * * more factors tree Factor * * * *---------------------------------------------------------------------------* * * * Factor ::= Base [ '^' Exponent ] * * * * '^' * * Bas_Exp or: / \ * * Bas_Exp Bas_Exp * * * *---------------------------------------------------------------------------* * * * Base ::= Exponent * * * *---------------------------------------------------------------------------* * * * Exponent ::= UnsignedConstant | Identifier | FunctDesignator * * | '(' Expression ')' * * * * UnsignedConstant Identifier * * / \ or / \ or * * NULL NULL NULL NULL * * * * FunctDesignator or Expression * * * *---------------------------------------------------------------------------* * * * FunctDesignator ::= FuncIdentifier '(' ActualParameterlist ')' * * * * Identifier * * / \ * * NULL ActualParameterlist * * * *---------------------------------------------------------------------------* * * * ActualParameterlist ::= ActualParameter [ ',' ActualParameter ] * * * * ',' * * Expression or: / \ * * more expressions tree Expression * * * *---------------------------------------------------------------------------* * * * UnsignedConstant::= UnsignedInteger | UnsignedReal * * UnsignedInteger ::= DigitSequence * * UnsignedReal ::= UnsignedInteger ['.' DigitSequence] ['e' ScaleFactor]* * DigitSequence ::= Digit [ Digit [...] ] * * Digit ::= '0' | '1' | '2' | ... | '8' | '9' * * ScaleFactor ::= [Sign] DigitSequence * * Sign ::= '+' | '-' * * Identifier ::= Letter [ Letter | Digit [...] ] * * Letter ::= 'a' | 'b' | ... | 'z' | '_' * * RelationOperator::= RelationChar [ RelationChar ] * * RelationChar ::= '<' | '=' | '>' * * * ***************************************************************************** * * * Simplification rules: * * * *---------------------------------------------------------------------------* * Exp Exp * * / \ / \ * * NULL ',' ==> X Y * * / \ * * X Y * *---------------------------------------------------------------------------* * Operator Operator * * / \ or / \ ==> Const (compute) * * Const Const NULL Const * *---------------------------------------------------------------------------* * '+' '*' * * / \ or / \ ==> X * * 0 X 1 X * *---------------------------------------------------------------------------* * '+' '-' * * / \ or / \ or * * X 0 X 0 * * * * '*' '/' * * / \ or / \ or * * X 1 X 1 * * * * '^' * * / \ ==> X * * X 1 * *---------------------------------------------------------------------------* * '*' '*' * * / \ or / \ or * * 0 X X 0 * * * * '/' '^' * * / \ or / \ or * * 0 X 0 X * * * * "and" "and" * * / \ or / \ ==> 0 * * 0 X X 0 * *---------------------------------------------------------------------------* * '^' '^' * * / \ or / \ ==> 1 * * X 0 1 X * *---------------------------------------------------------------------------* * '/' * * ___/ \___ * * / \ * * X X ==> 1 * * / \ / \ * * NULL NULL NULL NULL * *---------------------------------------------------------------------------* * '+' '-' * * / \ / \ * * X '-' ==> X Y * * / \ * * 0 Y * *---------------------------------------------------------------------------* * '-' '+' * * / \ / \ * * X '-' ==> X Y * * / \ * * 0 Y * *---------------------------------------------------------------------------* * '+' '-' * * / \ / \ * * '-' Y ==> Y X * * / \ * * 0 X * *---------------------------------------------------------------------------* * '*' '-' * * / \ / \ * * X '-' ==> 0 '*' * * / \ / \ * * 0 Y X Y * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include "parser.h" #include "parser_source.h" #include "functparser_source.h" /*---------------------------------------------------------------------------*/ #define GENTYPE "FSTRING" /* (pseudo) type of generator */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Structures and definitions **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Structure for storing data while tokizing and parsing the function string */ struct parser_data { char *fstr; /* pointer to function string */ int *token; /* array to store marker for each token in string */ char *tstr; /* working array for tokenized string */ char **tpos; /* array to store pointers to each token in string */ int tno; /* pointer to token in list */ int n_tokens; /* total number of tokens */ char *variable_name; /* name of user defined identifier */ char *function_name; /* name of user defined function */ int scanpos; /* pointer to location in string */ int lastpos; /* position in string before scanning next token */ int len_fstr; /* length of function string */ int perrno; /* error code */ #ifdef UNUR_COOKIES unsigned cookie; /* magic cookie */ #endif }; /*---------------------------------------------------------------------------*/ /* Error codes */ enum { SUCCESS = 0, /* executed succesfully, no errors detected */ ERR_UNFINISHED, /* incomplete. not all tokens parsed */ ERR_UNKNOWN_SYMBOL, /* unknown symbol in function string */ ERR_EXPECT_EQUAL, /* expected symbol: '=' */ ERR_EXPECT_OPEN_P, /* expected symbol: '(' */ ERR_EXPECT_CLOSE_P, /* expected symbol: ')' */ ERR_INVALID_N_PARAMS, /* invalid number of parameters for function */ ERR_EXPECT_FUNCT, /* function (name) expected */ ERR_EXPECT_VAR, /* user identifier (variable name) expected */ ERR_MISSING /* more tokens expected */ }; /*****************************************************************************/ /** List of known symbols **/ /*****************************************************************************/ #define PARSER #include "functparser_symbols.h" #undef PARSER /*****************************************************************************/ /** Prototypes **/ /*****************************************************************************/ /**-------------------------------------------------------------------------**/ /** functparser_init.c **/ /** Init and destroy function tree. **/ /**-------------------------------------------------------------------------**/ static struct ftreenode *_unur_fstr_2_tree (const char *functstr, int withDefFunct); /*---------------------------------------------------------------------------*/ /* Compute funtion tree from string. */ /*---------------------------------------------------------------------------*/ /**-------------------------------------------------------------------------**/ /** functparser_scanner.c **/ /** Scan and tokenize function string **/ /**-------------------------------------------------------------------------**/ /*---------------------------------------------------------------------------*/ /* Initialize and destroy parser */ /*---------------------------------------------------------------------------*/ static struct parser_data *_unur_fstr_parser_init (const char *fstr); /*---------------------------------------------------------------------------*/ /* Create and initialize parser object for given function string. */ /*---------------------------------------------------------------------------*/ static void _unur_fstr_symbols_init (void); /*---------------------------------------------------------------------------*/ /* Prepare table of known symbols for usage. */ /*---------------------------------------------------------------------------*/ static void _unur_fstr_parser_free (struct parser_data *pdata); /*---------------------------------------------------------------------------*/ /* Destroy parser object. */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* Scan function string */ /*---------------------------------------------------------------------------*/ static int _unur_fstr_tokenize (struct parser_data *pdata); /*---------------------------------------------------------------------------*/ /* Tokenize function string. */ /*---------------------------------------------------------------------------*/ static int _unur_fstr_next_symbol (struct parser_data *pdata, char *symb); /*---------------------------------------------------------------------------*/ /* Get next symbol in function string. */ /*---------------------------------------------------------------------------*/ static int _unur_fstr_find_symbol (const char *symb, int start, int end); /*---------------------------------------------------------------------------*/ /* Find symbol in table between position (start+1) and (end-1). */ /*---------------------------------------------------------------------------*/ static int _unur_fstr_find_user_defined (struct parser_data *pdata, char *symb, int next_char); /*---------------------------------------------------------------------------*/ /* Find user defined symbol. */ /*---------------------------------------------------------------------------*/ static int _unur_fstr_UnsignedConstant (struct parser_data *pdata, char *uc); /*---------------------------------------------------------------------------*/ /* Get Unsigned Constant. */ /* UnsignedConstant ::= UnsignedInteger | UnsignedReal */ /* UnsignedInteger ::= DigitSequence */ /* UnsignedReal ::= UnsignedInteger ['.' DigitSequence] ['e' ScaleFactor] */ /*---------------------------------------------------------------------------*/ static int _unur_fstr_DigitalSequence (struct parser_data *pdata, char *ds); /*---------------------------------------------------------------------------*/ /* Get Digital Sequence. */ /* DigitSequence ::= Digit [ Digit [...] ] */ /* Digit ::= '0' | '1' | '2' | ... | '8' | '9' */ /*---------------------------------------------------------------------------*/ static int _unur_fstr_ScaleFactor (struct parser_data *pdata, char *sf); /*---------------------------------------------------------------------------*/ /* Get Scale Factor. */ /* ScaleFactor ::= [Sign] DigitSequence */ /* Sign ::= '+' | '-' */ /*---------------------------------------------------------------------------*/ static int _unur_fstr_Identifier (struct parser_data *pdata, char *id); /*---------------------------------------------------------------------------*/ /* Get Identifier. */ /* Identifier ::= Letter [ Letter | Digit [...] ] */ /* Letter ::= 'a' | 'b' | ... | 'z' | '_' */ /* Digit ::= '0' | '1' | ... | '9' */ /*---------------------------------------------------------------------------*/ static int _unur_fstr_RelationOperator (struct parser_data *pdata, char *ro); /*---------------------------------------------------------------------------*/ /* Get Relation Operator. */ /* RelationOperator ::= RelationChar [ RelationChar [...] ] */ /* RelationChar ::= '<' | '=' | '>' */ /*---------------------------------------------------------------------------*/ static void _unur_fstr_error_scan (const struct parser_data *pdata, const char *symb, int line); /*---------------------------------------------------------------------------*/ /* Print error message when scanning function string. */ /*---------------------------------------------------------------------------*/ /**-------------------------------------------------------------------------**/ /** functparser_parser.c **/ /** Parse tokenized function string and construct function tree **/ /**-------------------------------------------------------------------------**/ /*---------------------------------------------------------------------------*/ /* Parser. */ /*---------------------------------------------------------------------------*/ static struct ftreenode *_unur_FunctDefinition (struct parser_data *pdata); /*---------------------------------------------------------------------------*/ /* Get user defined function. */ /* FunctDefinition ::= DefFunctDesignator '=' Expression */ /*---------------------------------------------------------------------------*/ static struct ftreenode *_unur_DefFunctDesignator (struct parser_data *pdata); /*---------------------------------------------------------------------------*/ /* Definition of user defined function. */ /* DefFunctDesignator ::= Identifier '(' DefParameterlist ')' */ /*---------------------------------------------------------------------------*/ static struct ftreenode *_unur_DefParameterlist (struct parser_data *pdata, int *n_params); /*---------------------------------------------------------------------------*/ /* Parameter list for user defined function. */ /* DefParameterlist ::= '(' Identifier [ ',' Identifier ] ')' */ /*---------------------------------------------------------------------------*/ static struct ftreenode *_unur_Expression (struct parser_data *pdata); /*---------------------------------------------------------------------------*/ /* Expression ::= SimpleExpression [ RelationOperator SimpleExpression ] */ /*---------------------------------------------------------------------------*/ static struct ftreenode *_unur_SimpleExpression (struct parser_data *pdata); /*---------------------------------------------------------------------------*/ /* SimpleExpression ::= STerm { AddingOperator Term } */ /*---------------------------------------------------------------------------*/ static struct ftreenode *_unur_STerm (struct parser_data *pdata); /*---------------------------------------------------------------------------*/ /* STerm ::= [ '+' | '-' ] Term */ /*---------------------------------------------------------------------------*/ static struct ftreenode *_unur_Term (struct parser_data *pdata); /*---------------------------------------------------------------------------*/ /* Term ::= Factor [ MultiplyingOperator Factor ] */ /*---------------------------------------------------------------------------*/ static struct ftreenode *_unur_Factor (struct parser_data *pdata); /*---------------------------------------------------------------------------*/ /* Factor ::= Base [ '^' Exponent ] */ /*---------------------------------------------------------------------------*/ static struct ftreenode *_unur_Bas_Exp (struct parser_data *pdata); /*---------------------------------------------------------------------------*/ /* Base ::= Exponent */ /* Exponent ::= UnsignedConstant | Identifier | FunctDesignator | */ /* '(' Expression ')' */ /*---------------------------------------------------------------------------*/ static struct ftreenode *_unur_FunctDesignator (struct parser_data *pdata); /*---------------------------------------------------------------------------*/ /* FunctDesignator ::= FuncIdentifier '(' ActualParameterlist ')' */ /*---------------------------------------------------------------------------*/ static struct ftreenode *_unur_ActualParameterlist (struct parser_data *pdata, int n_params); /*---------------------------------------------------------------------------*/ /* ActualParameterlist ::= ActualParameter [ ',' ActualParameter ] */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* Simplify tree. */ /*---------------------------------------------------------------------------*/ static struct ftreenode *_unur_fstr_simplification (const char *symb, int token, struct ftreenode *left, struct ftreenode *right); /*---------------------------------------------------------------------------*/ /* Try to simpify nodes. */ /*---------------------------------------------------------------------------*/ static int _unur_fstr_reorganize (struct ftreenode *node); /*---------------------------------------------------------------------------*/ /* Try to reorganize tree at node. */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* Auxilliary routines */ /*---------------------------------------------------------------------------*/ static int _unur_fstr_next_token (struct parser_data *pdata, int *token, char **symb); /*---------------------------------------------------------------------------*/ /* Get next token from list. */ /*---------------------------------------------------------------------------*/ static struct ftreenode *_unur_fstr_create_node (const char *symb, double val, int token, struct ftreenode *left, struct ftreenode *right); /*---------------------------------------------------------------------------*/ /* Create new node. */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* Error messages */ /*---------------------------------------------------------------------------*/ static struct ftreenode *_unur_fstr_error_parse ( struct parser_data *pdata, int perrno, int line ); /*---------------------------------------------------------------------------*/ /* Print error message when parsing function string. */ /*---------------------------------------------------------------------------*/ static const char *_unur_fstr_error_code ( int perrno ); /*---------------------------------------------------------------------------*/ /* Print message for error number. */ /*---------------------------------------------------------------------------*/ /**-------------------------------------------------------------------------**/ /** functparser_eval.c **/ /** Evaluate function tree for given argument x. **/ /** **/ /** (see also functparser_symbols.h) **/ /**-------------------------------------------------------------------------**/ static double _unur_fstr_eval_node (const struct ftreenode *node, double x); /*---------------------------------------------------------------------------*/ /* Evaluate function tree starting from `node' at x */ /*---------------------------------------------------------------------------*/ /**-------------------------------------------------------------------------**/ /** functparser_deriv.c **/ /** Compute function tree for derivative. **/ /** **/ /** (see also functparser_symbols.h) **/ /**-------------------------------------------------------------------------**/ static void _unur_fstr_error_deriv (const struct ftreenode *node, int line); /*---------------------------------------------------------------------------*/ /* Print error message for unknown derivative. */ /*---------------------------------------------------------------------------*/ /**-------------------------------------------------------------------------**/ /** functparser_stringgen.c **/ /** Make string for function given by its tree. **/ /**-------------------------------------------------------------------------**/ static int _unur_fstr_node2string ( struct unur_string *output, const struct ftreenode *node, const char *variable, const char *function, int spaces ); /*---------------------------------------------------------------------------*/ /* Produce string from function tree. */ /*---------------------------------------------------------------------------*/ static int _unur_fstr_print ( struct unur_string *output, const char *symb, double number ); /*---------------------------------------------------------------------------*/ /* Print string or number into output string. */ /* The number is only printed if symb is the NULL pointer. */ /*---------------------------------------------------------------------------*/ /**-------------------------------------------------------------------------**/ /** functparser_debug.c **/ /** Debugging tools for function parser. **/ /**-------------------------------------------------------------------------**/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ /* the following functions print debugging information on output stream, */ /* i.e., into the LOG file if not specified otherwise. */ /*---------------------------------------------------------------------------*/ static void _unur_fstr_debug_input ( const char *fstr ); /*---------------------------------------------------------------------------*/ /* Print function string on output stream. */ /*---------------------------------------------------------------------------*/ static void _unur_fstr_debug_token ( const struct parser_data *pdata ); /*---------------------------------------------------------------------------*/ /* Print tokenized string on output stream. */ /*---------------------------------------------------------------------------*/ static void _unur_fstr_debug_tree ( const struct parser_data *pdata, const struct ftreenode *root ); /*---------------------------------------------------------------------------*/ /* Print function tree. */ /*---------------------------------------------------------------------------*/ static void _unur_fstr_debug_show_tree (const struct parser_data *pdata, const struct ftreenode *node, int level, int location); /*---------------------------------------------------------------------------*/ /* Print function tree by recursion. */ /*---------------------------------------------------------------------------*/ static void _unur_fstr_debug_deriv (const struct ftreenode *funct, const struct ftreenode *deriv); /*---------------------------------------------------------------------------*/ /* Print function and its derivative. */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #endif /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Include sources **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #include "functparser_init.ch" #include "functparser_scanner.ch" #include "functparser_parser.ch" #include "functparser_eval.ch" #include "functparser_deriv.ch" #include "functparser_stringgen.ch" #include "functparser_debug.ch" /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** End **/ /*****************************************************************************/ unuran-1.11.0/src/parser/functparser_scanner.ch0000644001357500135600000006407214420445767016527 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: functparser_scanner.c * * * * Scan and tokenize function string * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Initialize and destroy parser object **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ struct parser_data * _unur_fstr_parser_init ( const char *fstr ) /*----------------------------------------------------------------------*/ /* Create and initialize parser object for given function string. */ /* */ /* parameters: */ /* fstr ... string containing function definition */ /* */ /* return: */ /* pointer to created and initialized parser object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { static int symbols_initialized = FALSE; struct parser_data *pdata; /* first we have to prepare the table of known symbols */ if (symbols_initialized == FALSE) { _unur_fstr_symbols_init(); symbols_initialized = TRUE; } /* allocate memory for parser object */ pdata = _unur_xmalloc(sizeof(struct parser_data)); COOKIE_SET(pdata,CK_FSTR_PDATA); /* make a working copy of the function string, */ /* remove all white spaces and convert to lower case letters. */ pdata->fstr = _unur_parser_prepare_string(fstr); pdata->len_fstr = strlen(pdata->fstr); /* check whether string is empty */ if (pdata->len_fstr <= 0) { /* empty, there is nothing to do */ _unur_error(GENTYPE,UNUR_ERR_STR,"empty string"); free (pdata->fstr); free(pdata); return NULL; } /* make arrays to store tokens in string */ pdata->token = _unur_xmalloc( (pdata->len_fstr+1) * sizeof(int) ); pdata->tpos = _unur_xmalloc( (pdata->len_fstr+1) * sizeof(char *) ); pdata->tstr = _unur_xmalloc( (2*pdata->len_fstr+1) * sizeof(char) ); /* initialize arrays */ pdata->n_tokens = 0; memset(pdata->token,0 ,(size_t)pdata->len_fstr); memset(pdata->tpos, 0 ,(size_t)pdata->len_fstr); memset(pdata->tstr,'\0',(size_t)pdata->len_fstr); /* initialize for scanning */ pdata->scanpos = 0; /* scan position at beginning */ pdata->lastpos = -1; pdata->perrno = 0; /* names of user defined symbols */ pdata->variable_name = NULL; pdata->function_name = NULL; /* initialize data for parsing */ pdata->tno = 0; /* return pointer to parser object */ return pdata; } /* end of _unur_fstr_parser_init() */ /*---------------------------------------------------------------------------*/ void _unur_fstr_symbols_init (void) /*----------------------------------------------------------------------*/ /* Prepare table of known symbols for usage. */ /* */ /* parameters: none */ /*----------------------------------------------------------------------*/ { int i; char *s; /* none of these positions found */ _ros_start = 0; _nas_start = 0; _ans_start = 0; /* find marker in list */ for (i=0; !_end; i++) { s = symbol[i].name; if (!_ros_start) { if ( strcmp(s,"_ROS") == 0) _ros_start = i; continue; } if (!_nas_start) { if ( strcmp(s,"_NAS") == 0) _nas_start = i; continue; } if (!_ans_start) { if ( strcmp(s,"_ANS") == 0) _ans_start = i; continue; } if (strcmp(s,"_END") == 0) _end = i; } /* end of region markers for list */ _ros_end = _nas_start; _nas_end = _ans_start; _ans_end = _end; /* find location of special symbols */ s_comma = _unur_fstr_find_symbol(",",_nas_start,_nas_end); s_minus = _unur_fstr_find_symbol("-",_nas_start,_nas_end); s_plus = _unur_fstr_find_symbol("+",_nas_start,_nas_end); s_mul = _unur_fstr_find_symbol("*",_nas_start,_nas_end); s_div = _unur_fstr_find_symbol("/",_nas_start,_nas_end); s_power = _unur_fstr_find_symbol("^",_nas_start,_nas_end); } /* end of _unur_fstr_symbols_init() */ /*---------------------------------------------------------------------------*/ void _unur_fstr_parser_free ( struct parser_data *pdata ) /*----------------------------------------------------------------------*/ /* Destroy parser object. */ /* */ /* parameters: */ /* pdata ... pointer to parser object */ /*----------------------------------------------------------------------*/ { if (pdata) { COOKIE_CHECK(pdata,CK_FSTR_PDATA,RETURN_VOID); free(pdata->fstr); free(pdata->token); free(pdata->tpos); free(pdata->tstr); free(pdata); } } /* end of _unur_fstr_parser_free() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Tokenize function string **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ int _unur_fstr_tokenize (struct parser_data *pdata) /*----------------------------------------------------------------------*/ /* Tokenize function string */ /* */ /* parameters: */ /* pdata ... pointer to parser object */ /* */ /* return: */ /* error code of called subroutines */ /*----------------------------------------------------------------------*/ { int token; int n_token = 0; /* counter for token */ char *symb = pdata->tstr; /* array to store token */ /* check arguments */ CHECK_NULL(pdata,UNUR_ERR_COOKIE); COOKIE_CHECK(pdata,CK_FSTR_PDATA,UNUR_ERR_COOKIE); /* locate token in function string and copy into token string */ while ((token = _unur_fstr_next_symbol(pdata,symb)) != S_NOSYMBOL) { pdata->token[n_token] = token; /* marker for token */ pdata->tpos[n_token] = symb; /* name of token */ n_token++; /* increment counter for tokens */ symb += pdata->scanpos - pdata->lastpos + 1; /* skip to unused space in string */ } /* store total number of tokens */ pdata->n_tokens = n_token; /* set token pointer to first token */ pdata->tno = 0; /* return error code */ return pdata->perrno; } /* end of _unur_fstr_tokenize() */ /*---------------------------------------------------------------------------*/ int _unur_fstr_next_symbol (struct parser_data *pdata, char *symb) /*----------------------------------------------------------------------*/ /* Get next symbol in function string. */ /* */ /* parameters: */ /* pdata ... pointer to parser object */ /* symb ... pointer to array for storing symbol */ /* */ /* return: */ /* error code of called subroutines */ /*----------------------------------------------------------------------*/ { int token; int errcode = 0; char c; /* check arguments */ CHECK_NULL(pdata,S_NOSYMBOL); COOKIE_CHECK(pdata,CK_FSTR_PDATA,S_NOSYMBOL); /* store position of pointer */ pdata->lastpos = pdata->scanpos; if (pdata->scanpos >= pdata->len_fstr) /* end of string */ return S_NOSYMBOL; /* next character in string */ c = pdata->fstr[pdata->scanpos]; /* new get next symbol in list */ if ( (c >= '0' && c <= '9') || c == '.') { /* Unsigned Constant */ _unur_fstr_UnsignedConstant(pdata,symb); token = s_uconst; } else if (c >= 'a' && c <= 'z') { /* Identifier */ _unur_fstr_Identifier(pdata,symb); if ( ( (token = _unur_fstr_find_symbol(symb,_ans_start,_ans_end)) == 0 ) && ( (token = _unur_fstr_find_user_defined(pdata,symb,pdata->fstr[pdata->scanpos])) <= 0 ) ) errcode = ERR_UNKNOWN_SYMBOL; } else if ( c == '<' || c == '>' || c == '=' || c == '!' ) { /* Relation Operator */ _unur_fstr_RelationOperator(pdata,symb); if ((token = _unur_fstr_find_symbol(symb,_ros_start,_ros_end)) <= 0 ) errcode = ERR_UNKNOWN_SYMBOL; } else { symb[0] = c; symb[1] = '\0'; /* all other charactors */ (pdata->scanpos)++; if ((token = _unur_fstr_find_symbol(symb,_nas_start,_nas_end)) <= 0 ) errcode = ERR_UNKNOWN_SYMBOL; } /* set errorcode */ pdata->perrno = errcode; if (errcode) { _unur_fstr_error_scan (pdata,symb,__LINE__); } return (errcode) ? S_NOSYMBOL : token; } /* end of _unur_fstr_next_symbol() */ /*---------------------------------------------------------------------------*/ int _unur_fstr_find_symbol (const char *symb, int start, int end) /*----------------------------------------------------------------------*/ /* find symbol in table between position (start+1) and (end-1) */ /* */ /* parameters: */ /* symb ... symbol to look for */ /* start ... starting point for searching */ /* end ... endpoint for searching */ /* */ /* return: */ /* location in table */ /* */ /* error: */ /* return 0 */ /*----------------------------------------------------------------------*/ { int i; /* search for symbol in table */ for (i = start + 1; i < end; i++) if (strcmp(symb,symbol[i].name) == 0) break; /* return location if symbol found and 0 otherwise */ return ((i < end ) ? i : 0); } /* end of _unur_fstr_find_symbol() */ /*---------------------------------------------------------------------------*/ int _unur_fstr_find_user_defined (struct parser_data *pdata, char *symb, int next_char) /*----------------------------------------------------------------------*/ /* Find user defined symbol. */ /* If there are no user defined symbols yet, store it. */ /* If there are already user defined symbols, and this one is new, */ /* make return an errorcode. */ /* */ /* parameters: */ /* pdata ... pointer to parser object */ /* symb ... symbol to look for */ /* next_char ... character following given symbol */ /* */ /* return: */ /* location in table */ /* */ /* error: */ /* return 0 */ /*----------------------------------------------------------------------*/ { /* check arguments */ CHECK_NULL(pdata,0); COOKIE_CHECK(pdata,CK_FSTR_PDATA,0); /* we use next_char to distinguish between variables and functions */ if (next_char == '(') { /* symbol is user defined function */ if (pdata->function_name == NULL) { /* new function --> store name */ pdata->function_name = symb; /* return marker for user defined identifier */ return s_ufunct; } else /* the identifier name must match with variable name */ return (strcmp(pdata->function_name,symb) == 0) ? s_ufunct : 0; } else { /* symbol is user defined identifier (i.e. a variable) */ if (pdata->variable_name == NULL) { /* new variable --> store name */ pdata->variable_name = symb; /* return marker for user defined identifier */ return s_uident; } else /* the identifier name must match with variable name */ return (strcmp(pdata->variable_name,symb) == 0) ? s_uident : 0; } } /* end of _unur_fstr_find_user_defined() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Scan function string **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ int _unur_fstr_UnsignedConstant (struct parser_data *pdata, char *uc) /*----------------------------------------------------------------------*/ /* Get Unsigned Constant */ /* */ /* parameters: */ /* pdata ... pointer to parser object */ /* uc ... pointer to array for storing symbol */ /* */ /* Syntax: */ /* UnsignedConstant ::= UnsignedInteger | UnsignedReal */ /* UnsignedInteger ::= DigitSequence */ /* UnsignedReal ::= UnsignedInteger ['.' DigitSequence] ['e' ScaleFactor] */ /* */ /*----------------------------------------------------------------------*/ { /* store scan position */ int startpos = pdata->scanpos; /* check arguments */ CHECK_NULL(pdata,UNUR_ERR_NULL); COOKIE_CHECK(pdata,CK_FSTR_PDATA,UNUR_ERR_COOKIE); /* copy digit sequence into uc */ _unur_fstr_DigitalSequence(pdata,uc); if( pdata->fstr[pdata->scanpos] == '.' ) { /* decimal point --> copy point and following digits */ *(uc + pdata->scanpos - startpos) = '.'; (pdata->scanpos)++; _unur_fstr_DigitalSequence(pdata, uc + pdata->scanpos - startpos); } if( pdata->fstr[pdata->scanpos] == 'e' ) { /* exponent --> copy indicator 'E' and following [sign and] digits */ *(uc + pdata->scanpos - startpos) = 'e'; (pdata->scanpos)++; _unur_fstr_ScaleFactor(pdata, uc + pdata->scanpos - startpos); } return UNUR_SUCCESS; } /* end of _unur_fstr_UnsignedConstant() */ /*---------------------------------------------------------------------------*/ int _unur_fstr_DigitalSequence (struct parser_data *pdata, char *ds) /*----------------------------------------------------------------------*/ /* Get Digital Sequence */ /* */ /* parameters: */ /* pdata ... pointer to parser object */ /* ds ... pointer to array for storing symbol */ /* */ /* Syntax: */ /* DigitSequence ::= Digit [ Digit [...] ] */ /* Digit ::= '0' | '1' | '2' | ... | '8' | '9' */ /*----------------------------------------------------------------------*/ { /* check arguments */ CHECK_NULL(pdata,UNUR_ERR_NULL); COOKIE_CHECK(pdata,CK_FSTR_PDATA,UNUR_ERR_COOKIE); /* copy digit */ while ( (*ds = pdata->fstr[pdata->scanpos]) >= '0' && *ds <= '9' ) { ds++; (pdata->scanpos)++; } /* terminate string */ *ds = '\0'; return UNUR_SUCCESS; } /* end of _unur_fstr_DigitalSequence() */ /*---------------------------------------------------------------------------*/ int _unur_fstr_ScaleFactor (struct parser_data *pdata, char *sf) /*----------------------------------------------------------------------*/ /* Get Scale Factor */ /* */ /* parameters: */ /* pdata ... pointer to parser object */ /* sf ... pointer to array for storing symbol */ /* */ /* Syntax: */ /* ScaleFactor ::= [Sign] DigitSequence */ /* Sign ::= '+' | '-' */ /*----------------------------------------------------------------------*/ { /* check arguments */ CHECK_NULL(pdata,UNUR_ERR_NULL); COOKIE_CHECK(pdata,CK_FSTR_PDATA,UNUR_ERR_COOKIE); /* copy sign */ if ( (sf[0] = pdata->fstr[pdata->scanpos]) == '+' || sf[0] == '-' ) { sf++; (pdata->scanpos)++; } /* copy digital sequence (after sign) */ _unur_fstr_DigitalSequence(pdata,sf); return UNUR_SUCCESS; } /* _unur_fstr_ScaleFactor() */ /*---------------------------------------------------------------------------*/ int _unur_fstr_Identifier (struct parser_data *pdata, char *id) /*----------------------------------------------------------------------*/ /* Get Identifier */ /* */ /* parameters: */ /* pdata ... pointer to parser object */ /* id ... pointer to array for storing symbol */ /* */ /* Syntax: */ /* Identifier ::= Letter [ Letter | Digit [...] ] */ /* Letter ::= 'a' | 'b' | ... | 'z' | '_' */ /* Digit ::= '0' | '1' | ... | '9' */ /*----------------------------------------------------------------------*/ { /* check arguments */ CHECK_NULL(pdata,UNUR_ERR_NULL); COOKIE_CHECK(pdata,CK_FSTR_PDATA,UNUR_ERR_COOKIE); /* copy word */ while ( ((*id = pdata->fstr[pdata->scanpos]) >= 'a' && *id <= 'z') || *id == '_' || ( *id >= '0' && *id <= '9')) { id++; (pdata->scanpos)++; } /* terminate string */ *id = '\0'; return UNUR_SUCCESS; } /* end of _unur_fstr_Identifier() */ /*---------------------------------------------------------------------------*/ int _unur_fstr_RelationOperator (struct parser_data *pdata, char *ro) /*----------------------------------------------------------------------*/ /* Get Relation Operator */ /* */ /* parameters: */ /* pdata ... pointer to parser object */ /* ro ... pointer to array for storing symbol */ /* */ /* Syntax: */ /* RelationOperator ::= RelationChar [ RelationChar ] */ /* RelationChar ::= '<' | '>' | '=' | '!' */ /*----------------------------------------------------------------------*/ { /* check arguments */ CHECK_NULL(pdata,1); COOKIE_CHECK(pdata,CK_FSTR_PDATA,1); /* copy relation operator */ while ((*ro = pdata->fstr[pdata->scanpos]) == '<' || *ro == '>' || *ro == '=' || *ro == '!' ) { ro++; (pdata->scanpos)++; } /* terminate string */ *ro = '\0'; return UNUR_SUCCESS; } /* _unur_fstr_RelationOperator() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Error messages **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ void _unur_fstr_error_scan (const struct parser_data *pdata, const char *symb, int line) /*----------------------------------------------------------------------*/ /* Print error message when scanning function string */ /* */ /* parameters: */ /* pdata ... pointer to parser object */ /* symb ... pointer to unknown symbol */ /*----------------------------------------------------------------------*/ { struct unur_string *reason; char *c; /* check arguments */ CHECK_NULL(pdata,RETURN_VOID); COOKIE_CHECK(pdata,CK_FSTR_PDATA,RETURN_VOID); /* create string for reason of error */ reason = _unur_string_new(); /* print unknown symbol */ _unur_string_append( reason, "unknown symbol '%s': ", symb ); /* print scanned part of function string to error stream */ for (c=pdata->fstr; c < pdata->fstr+pdata->lastpos; c++) _unur_string_append( reason, "%c", *c ); /* print remaining part of function string including unknown symbol */ _unur_string_append( reason, " --> %s", pdata->fstr + pdata->lastpos); /* report error */ _unur_error_x( GENTYPE, __FILE__, line, "error", UNUR_ERR_FSTR_SYNTAX,reason->text); /* free working space */ _unur_string_free( reason ); } /* end of _unur_fstr_error_scan() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/parser/functparser_source.h0000644001357500135600000001300214420445767016216 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: functparser_source.h * * * * PURPOSE: * * declares prototypes for function parser * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifndef FUNCTPARSER_SOURCE_H_SEEN #define FUNCTPARSER_SOURCE_H_SEEN /*---------------------------------------------------------------------------*/ /* Function prototypes for function string parser */ /*---------------------------------------------------------------------------*/ struct ftreenode *_unur_fstr2tree ( const char *functstring ); /*---------------------------------------------------------------------------*/ /* Compute funtion tree from string. */ /*---------------------------------------------------------------------------*/ struct ftreenode *_unur_fstr2tree_DefFunct ( const char *functstring ); /*---------------------------------------------------------------------------*/ /* Compute funtion tree from string. */ /* (Same as _unur_fstr2tree() but string must start with "f(x)=". */ /*---------------------------------------------------------------------------*/ double _unur_fstr_eval_tree ( const struct ftreenode *functtree_root, double x ); /*---------------------------------------------------------------------------*/ /* Evalutes function given by a function tree at x. */ /*---------------------------------------------------------------------------*/ struct ftreenode *_unur_fstr_dup_tree (const struct ftreenode *functtree_root); /*---------------------------------------------------------------------------*/ /* Duplicate function tree rooted at root. */ /*---------------------------------------------------------------------------*/ void _unur_fstr_free ( struct ftreenode *functtree_root ); /*---------------------------------------------------------------------------*/ /* Destroys function tree and frees memory. */ /*---------------------------------------------------------------------------*/ char *_unur_fstr_tree2string ( const struct ftreenode *functtree_root, const char *variable, const char *function, int spaces ); /*---------------------------------------------------------------------------*/ /* Produce string from function tree. */ /* It returns a pointer to the resulting string. This should be freed when */ /* it is not used any more. */ /*---------------------------------------------------------------------------*/ struct ftreenode *_unur_fstr_make_derivative ( const struct ftreenode *functtree_root ); /*---------------------------------------------------------------------------*/ /* Make function tree for derivate of given function (tree). */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #endif /* FUNCTPARSER_SOURCE_H_SEEN */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/parser/functparser_doc.dh0000644001357500135600000001510414420445767015634 00000000000000 /*---------------------------------------------------------------------------*/ /* =NODEX StringFunct Function String =UP StringAPI [25] =DESCRIPTION In unuran it is also possible to define functions (e.g. CDF or PDF) as strings. As you can see in Example 2 (@ref{Example_2_str}) it is very easy to define the PDF of a distribution object by means of a string. The possibilities using this string interface are more restricted than using a pointer to a routine coded in C (@ref{Example_2}). But the differences in evaluation time is small. When a distribution object is defined using this string interface then of course the same conditions on the given density or CDF must be satisfied for a chosen method as for the standard API. This string interface can be used for both within the UNU.RAN string API using the unur_str2gen() call, and for calls that define the density or CDF for a particular distribution object as done with (e.g.) the call unur_distr_cont_set_pdfstr(). Here is an example for the latter case: @example unur_distr_cont_set_pdfstr(distr,"1-x*x"); @end example @subheading Syntax The syntax for the function string is case insensitive, white spaces are ingnored. The expressions are similar to most programming languages and mathematical programs (see also the examples below). It is especially influenced by C. The usual preceedence rules are used (from highest to lowest preceedence: functions, power, multiplication, addition, relation operators). Use parentheses in case of doubt or when these preceedences should be changed. Relation operators can be used as indicator functions, i.e. the term @code{(x>1)} is evaluted as @code{1} if this relation is satisfied, and as @code{0} otherwise. The first unknown symbol (letter or word) is interpreted as the variable of the function. It is recommended to use @code{x}. Only one variable can be used. @noindent @emph{Important}: The symbol @code{e} is used twice, for Euler's constant (= 2.7182@dots{}) and as exponent. The multiplication operator @code{*} must not be omitted, i.e. @code{2 x} is interpreted as the string @code{2x} (which will result in a syntax error). @subheading List of symbols @cartouche @noindent @b{Numbers} @noindent Numbers are composed using digits and, optionally, a sign, a decimal point, and an exponent indicated by @code{e}. @multitable {xxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} @item Symbol @tab Explanation @tab Examples @item @code{0@dots{}9} @tab @i{digits} @tab @code{2343} @item @code{.} @tab @i{decimal point} @tab @code{165.567} @item @code{-} @tab @i{negative sign} @tab @code{-465.223} @item @code{e} @tab @i{exponet} @tab @code{13.2e-4} (=0.00132) @end multitable @end cartouche @cartouche @noindent @b{Constants} @multitable {xxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} @item @code{pi} @tab @i{pi = 3.1415@dots{}} @tab @code{3*pi+2} @item @code{e} @tab @i{Euler's constant} @tab @code{3*e+2} (= 10.15@dots{}; do not cofuse with @code{3e2} = 300) @item @code{inf} @tab @i{infinity} @tab (used for domains) @end multitable @end cartouche @cartouche @noindent @b{Special symbols} @multitable {xxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} @item @code{(} @tab @i{opening parenthesis} @tab @code{2*(3+x)} @item @code{)} @tab @i{closing parenthesis} @tab @code{2*(3+x)} @item @code{,} @tab @i{(argument) list separator} @tab @code{mod(13,2)} @end multitable @end cartouche @cartouche @noindent @b{Relation operators (Indicator functions)} @multitable {xxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} @item @code{<} @tab @i{less than} @tab @code{(x<1)} @item @code{=} @tab @i{equal} @tab @code{(2=x)} @item @code{==} @tab @i{same as} @code{=} @tab @code{(x==3)} @item @code{>} @tab @i{greater than} @tab @code{(x>0)} @item @code{<=} @tab @i{less than or equal} @tab @code{(x<=1)} @item @code{!=} @tab @i{not equal} @tab @code{(x!0)} @item @code{<>} @tab @i{same as} @code{!=} @tab @code{(x<>pi)} @item @code{>=} @tab @i{greater or equal} @tab @code{(x>=1)} @end multitable @end cartouche @cartouche @noindent @b{Arithmetic operators} @multitable {xxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} @item @code{+} @tab @i{addition} @tab @code{2+x} @item @code{-} @tab @i{subtraction} @tab @code{2-x} @item @code{*} @tab @i{multiplication} @tab @code{2*x} @item @code{/} @tab @i{division} @tab @code{x/2} @item @code{^} @tab @i{power} @tab @code{x^2} @end multitable @end cartouche @cartouche @noindent @b{Functions} @multitable {xxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} @item @code{mod} @tab @code{mod(m,n)} @i{remainder of devision m over n} @tab mod(x,2) @item @code{exp} @tab @i{exponential function (same as @code{e^x})} @tab @code{exp(-x^2)} (same as @code{e^(-x^2)}) @item @code{log} @tab @i{natural logarithm} @tab @code{log(x)} @item @code{sin} @tab @i{sine} @tab @code{sin(x)} @item @code{cos} @tab @i{cosine} @tab @code{cos(x)} @item @code{tan} @tab @i{tangent} @tab @code{tan(x)} @item @code{sec} @tab @i{secant} @tab @code{sec(x*2)} @item @code{sqrt} @tab @i{square root} @tab @code{sqrt(2*x)} @item @code{abs} @tab @i{absolute value} @tab @code{abs(x)} @item @code{sgn} @tab @i{sign function} @tab @code{sign(x)*3} @end multitable @end cartouche @cartouche @noindent @b{Variable} @multitable {xxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} @item @code{x} @tab @i{variable} @tab @code{3*x^2} @end multitable @end cartouche @subheading Examples @example 1.231+7.9876*x-1.234e-3*x^2+3.335e-5*x^3 sin(2*pi*x)+x^2 exp(-((x-3)/2.1)^2) @end example @noindent It is also possible to define functions using different terms on separate domains. However, instead of constructs using @code{if @dots{} then @dots{} else @dots{}} indicator functions are available. @noindent For example to define the density of triangular distribution with domain (-1,1) and mode 0 use @example (x>-1)*(x<0)*(1+x) + (x>=0)*(x<1)*(1-x) @end example =EON */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/parser/stringparser.c0000644001357500135600000037501514420445767015037 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: stringparser.c. * * * * * * DESCRIPTION: * * * * The function unur_str2gen() takes a character string as its argument. * * This string is parsed in the following ways and the information * * obtained is used to make a generator object. (It returns NULL when * * it is not possible to make a generator object either due to a syntax * * error in the given string, or due to invalid data. * * * * First the given string is copied into a working string. Moreover letter * * letters are transformed into their lower case counterparts and spaces * * are eliminated (i.e. the working string does not contain any white * * space characters any more.) Then the working string is splitted into * * several blocks, separated by ampersands '&'. Each block consists of * * = pairs, separated by semicolons ';'. The first key in * * each block is used to indicate the corresponding block. * * * * We have three different blocks (yet): * * distr ... contains the definition of the distribution * * method ... contains the description of the transformation methdod * * urng ... contains the definition of the uniform RNG * * (currently it only supports URNGs from the PRNG library) * * * * The 'distr' block must be the very first block and is obligatory. * * For that reason the keyword "distr" is optional and can be omitted * * (together with the '=' character). Moreover it is almost ignored while * * parsing the string. To avoid some possible confussion it only has to * * start with the letter 'd' (if it is given at all). E.g. "dnormal" can * * be used as keyword. * * The value of the "distr" key is used to get a distribution object * * either via a unur_distr_() call for a standard distribution * * or the unur_distr__new() calls are used to get an object for a * * generic distribution. However not all generic distributions are * * supported yet (see the list %UNSUPPORTED_DISTR_TYPES in file * * make_stringparser.pl). * * The parameters for the standard distribution are given as a list of * * numbers enclosed in parenthesis. There must not be any character (other * * than white space) between the name of the standard distribution and * * this list. * * * * All the other blocks are optional and can be arranged in arbitrary * * order. * * The value of the "method" key is the name of the transformation method * * and is used to execute the unur__new() call. * * * * The value of the "urng" key is passed to the PRNG interface. * * However, it only works when using the PRNG library is enabled * * --with-urng-prng flag and libprng is linked by the executable. * * * * In each block consecuting = pairs, separated by semicolons * * ';', are used to set parameters. The name of the parameter is given as * * key, the argument list is given as value. The arguments of the * * corresponding set calls are given as tokens, separated by commata ','. * * There are two types of tokens: * * single tokens, that represent numbers, and * * list, i.e. a list of single tokens, separated by commata ',', * * enclosed in parenthesis. * * The value (including the character '=') can be omitted when no argument * * are required. * * The key is deduced from the UNU.RAN set calls, such that it uses only * * the part of the set call beyond "..._set_". * * Not all set commands are supported yet (see the output to STDERR of * * the make_stringparser.pl script). * * As a rule of thumb only those set calls are supported that only have * * numbers or arrays of numbers as arguments (besides the pointer to the * * distribution or parameter object). * * (See the code of make_stringparser.pl for details.) * * * * There are additional transformations before executing the necessary * * set calls (listed by argument types) * * int: 'true' and 'on' are transformed to 1, * * 'false' and 'off' are transformed to 0. * * a missing argument is transformed to 1. * * int, int: Instead of two integers, a list with at least two * * numbers can be given. * * 'inf[...]' is transformed to INT_MAX, * * '-inf[...]' is transformed to INT_MIN. * * unsigned: string is interpreted as hexadecimal number. * * double: 'inf[...]' is transformed to UNUR_INFINITY, * * '-inf[...]' is transformed to -UNUR_INFINITY. * * double, double: Instead of two doubles, a list with at least two * * numbers can be given. * * 'inf[...]' is transformed to UNUR_INFINITY. * * int, double*: If the first argument is missing, it is replaced * * by the size of the array. * * If the second argument is missing, the NULL pointer is * * used instead an array as argument. * * double*, int: Only for distributions! * * If the second argument 'int' is missing, it is replaced * * by the size of the array. * * Important: there is no support for 'infinity' in lists! * * (See also the source below for more details.) * * * ***************************************************************************** * * * REMARK: * * The stringparser always uses the default debugging flag. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ #include #include #include #include #include #include "parser_source.h" #include "parser.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #if defined(UNUR_URNG_UNURAN) && defined(UNURAN_HAS_PRNG) #include #endif /*---------------------------------------------------------------------------*/ /* Variants: none */ /*---------------------------------------------------------------------------*/ /* Debugging flags */ /* bit 01 ... pameters and structure of generator (do not use here) */ /* bits 02-12 ... setup */ /* bits 13-24 ... adaptive steps */ /* bits 25-32 ... trace sampling */ /*---------------------------------------------------------------------------*/ /* Flags for logging set calls */ /*---------------------------------------------------------------------------*/ #define GENTYPE "STRING" /* (pseudo) type of generator */ /*---------------------------------------------------------------------------*/ static struct unur_distr *_unur_str_distr( char *str_distr ); /*---------------------------------------------------------------------------*/ /* get distribution object for given distribution. */ /*---------------------------------------------------------------------------*/ static struct unur_distr *_unur_str_distr_new( char *distribution ); /*---------------------------------------------------------------------------*/ /* get new distribution object. */ /*---------------------------------------------------------------------------*/ static struct unur_distr *_unur_str_distr_make_os( UNUR_DISTR *distr, const char *key, char *type_args, char **args ); /*---------------------------------------------------------------------------*/ /* Make distribution object for order statistics of given distribution. */ /*---------------------------------------------------------------------------*/ static int _unur_str_distr_set( UNUR_DISTR **ptr_distr, const char *key, char *value ); /*---------------------------------------------------------------------------*/ /* set parameters for distribution. */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* Set parameter in given distribution object. */ /*---------------------------------------------------------------------------*/ typedef int distr_set_i( UNUR_DISTR *distr, int i ); typedef int distr_set_ii( UNUR_DISTR *distr, int i1, int i2 ); typedef int distr_set_d( UNUR_DISTR *distr, double d ); typedef int distr_set_dd( UNUR_DISTR *distr, double d1, double d2 ); typedef int distr_set_Di( UNUR_DISTR *distr, const double *array, int size ); typedef int distr_set_C( UNUR_DISTR *distr, const char *string ); /*---------------------------------------------------------------------------*/ /* types of set calls */ /*---------------------------------------------------------------------------*/ static int _unur_str_distr_set_i( UNUR_DISTR *distr, const char *key, char *type_args, char **args, distr_set_i set ); /*---------------------------------------------------------------------------*/ /* integer. */ /*---------------------------------------------------------------------------*/ static int _unur_str_distr_set_ii( UNUR_DISTR *distr, const char *key, char *type_args, char **args, distr_set_ii set ); /*---------------------------------------------------------------------------*/ /* 2 integers. */ /*---------------------------------------------------------------------------*/ static int _unur_str_distr_set_d( UNUR_DISTR *distr, const char *key, char *type_args, char **args, distr_set_d set ); /*---------------------------------------------------------------------------*/ /* double. */ /*---------------------------------------------------------------------------*/ static int _unur_str_distr_set_dd( UNUR_DISTR *distr, const char *key, char *type_args, char **args, distr_set_dd set ); /*---------------------------------------------------------------------------*/ /* 2 doubles. */ /*---------------------------------------------------------------------------*/ static int _unur_str_distr_set_Di( UNUR_DISTR *distr, const char *key, char *type_args, char **args, distr_set_Di set ); /*---------------------------------------------------------------------------*/ /* array of doubles & integer. */ /*---------------------------------------------------------------------------*/ static int _unur_str_distr_set_C( UNUR_DISTR *distr, const char *key, char *type_args, char **args, distr_set_C set ); /*---------------------------------------------------------------------------*/ /* constant string. */ /*---------------------------------------------------------------------------*/ static struct unur_par *_unur_str_par( char *str_method, const UNUR_DISTR *distr, struct unur_slist *mlist ); /*---------------------------------------------------------------------------*/ /* get parameter object for distribution and method. */ /*---------------------------------------------------------------------------*/ static struct unur_par *_unur_str_par_new( const char *method, const UNUR_DISTR *distr ); /*---------------------------------------------------------------------------*/ /* get new parameter object for method. */ /*---------------------------------------------------------------------------*/ static int _unur_str_par_set( UNUR_PAR *par, const char *key, char *value, struct unur_slist *mlist ); /*---------------------------------------------------------------------------*/ /* set parameters for method. */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* Set parameter in given parameter object. */ /*---------------------------------------------------------------------------*/ typedef int par_set_void( UNUR_PAR *par ); typedef int par_set_i( UNUR_PAR *par, int i ); typedef int par_set_ii( UNUR_PAR *par, int i1, int i2 ); typedef int par_set_u( UNUR_PAR *par, unsigned u ); typedef int par_set_d( UNUR_PAR *par, double d ); typedef int par_set_dd( UNUR_PAR *par, double d1, double d2 ); typedef int par_set_iD( UNUR_PAR *par, int size, const double *array ); typedef int par_set_Di( UNUR_PAR *par, const double *array, int size ); /*---------------------------------------------------------------------------*/ /* types of set calls */ /*---------------------------------------------------------------------------*/ static int _unur_str_par_set_void( UNUR_PAR *par, const char *key, char *type_args, char **args, par_set_void set ); /*---------------------------------------------------------------------------*/ /* void (no argument required). */ /*---------------------------------------------------------------------------*/ static int _unur_str_par_set_i( UNUR_PAR *par, const char *key, char *type_args, char **args, par_set_i set ); /*---------------------------------------------------------------------------*/ /* integer. */ /*---------------------------------------------------------------------------*/ static int _unur_str_par_set_ii( UNUR_PAR *par, const char *key, char *type_args, char **args, par_set_ii set ); /*---------------------------------------------------------------------------*/ /* 2 integers. */ /*---------------------------------------------------------------------------*/ static int _unur_str_par_set_u( UNUR_PAR *par, const char *key, char *type_args, char **args, par_set_u set ); /*---------------------------------------------------------------------------*/ /* unsigned integer. */ /*---------------------------------------------------------------------------*/ static int _unur_str_par_set_d( UNUR_PAR *par, const char *key, char *type_args, char **args, par_set_d set ); /*---------------------------------------------------------------------------*/ /* double. */ /*---------------------------------------------------------------------------*/ static int _unur_str_par_set_dd( UNUR_PAR *par, const char *key, char *type_args, char **args, par_set_dd set ); /*---------------------------------------------------------------------------*/ /* 2 doubles. */ /*---------------------------------------------------------------------------*/ static int _unur_str_par_set_iD( UNUR_PAR *par, const char *key, char *type_args, char **args, par_set_iD set, struct unur_slist *mlist ); /*---------------------------------------------------------------------------*/ /* integer & array of doubles. */ /*---------------------------------------------------------------------------*/ static int _unur_str_par_set_Di( UNUR_PAR *par, const char *key, char *type_args, char **args, par_set_Di set, struct unur_slist *mlist ); /*---------------------------------------------------------------------------*/ /* array of doubles & integer. */ /*---------------------------------------------------------------------------*/ static UNUR_URNG *_unur_str2urng( char *str_urng ); /*---------------------------------------------------------------------------*/ /* get uniform RNG. */ /*---------------------------------------------------------------------------*/ static int _unur_str_set_args( char *value, char *type_args, char **args, int max_args ); /*---------------------------------------------------------------------------*/ /* parse argument string for set call. */ /*---------------------------------------------------------------------------*/ static int _unur_parse_ilist( char *liststr, int **iarray ); /*---------------------------------------------------------------------------*/ /* Process a comma separated list of integers. */ /*---------------------------------------------------------------------------*/ static int _unur_parse_dlist( char *liststr, double **darray ); /*---------------------------------------------------------------------------*/ /* Process a comma separated list of numbers. */ /*---------------------------------------------------------------------------*/ static int _unur_atoi ( const char *str ); /*---------------------------------------------------------------------------*/ /* Convert string into its integer representation. */ /*---------------------------------------------------------------------------*/ static unsigned _unur_atou ( const char *str ); /*---------------------------------------------------------------------------*/ /* Convert string into its unsigned representation (using hexadecimal). */ /*---------------------------------------------------------------------------*/ static double _unur_atod ( const char *str ); /*---------------------------------------------------------------------------*/ /* Convert string into its double value. */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ /* the following functions print debugging information on output stream, */ /* i.e., into the LOG file if not specified otherwise. */ /*---------------------------------------------------------------------------*/ static void _unur_str_debug_string( int level, const char *key, const char *value ); /*---------------------------------------------------------------------------*/ /* print key & value info into LOG file. */ /*---------------------------------------------------------------------------*/ static void _unur_str_debug_distr( int level, const char *name, double *params, int n_params ); /*---------------------------------------------------------------------------*/ /* write info about distribution into LOG file. */ /*---------------------------------------------------------------------------*/ static void _unur_str_debug_set( int level, const char *key, const char *type, ... ); /*---------------------------------------------------------------------------*/ /* write info about set command into LOG file. */ /*---------------------------------------------------------------------------*/ #endif /*---------------------------------------------------------------------------*/ static void _unur_str_error_unknown( const char *file, int line, const char *key, const char *type ); /*---------------------------------------------------------------------------*/ /* print error message: unknown keyword. */ /*---------------------------------------------------------------------------*/ static void _unur_str_error_invalid( const char *file, int line, const char *key, const char *type ); /*---------------------------------------------------------------------------*/ /* print error message: invalid data for keyword. */ /*---------------------------------------------------------------------------*/ static void _unur_str_error_args( const char *file, int line, const char *key ); /*---------------------------------------------------------------------------*/ /* print error message: invalid argument string for set call. */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* abbreviations */ #define _unur_error_unknown(key,what) \ do { \ _unur_str_error_unknown( __FILE__,__LINE__, (key), (what) ); \ } while (0) /* invalid data for key */ #define _unur_error_invalid(key,what) \ do { \ _unur_str_error_invalid( __FILE__,__LINE__, (key), (what) ); \ } while (0) /* invalid argument string for set calls */ #define _unur_error_args(key) \ do { \ _unur_str_error_args( __FILE__,__LINE__, (key) ); \ } while (0) /*---------------------------------------------------------------------------*/ /* constants */ #define MAX_SET_ARGS (10) /* maximal number of arguments for set calls (must be at least 2) */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Load lists of ..._new and ..._set calls **/ /*****************************************************************************/ #include "stringparser_lists.ch" /*****************************************************************************/ /** User Interface **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ struct unur_gen * unur_str2gen (const char *string) /*----------------------------------------------------------------------*/ /* get generator object for distribution and method */ /* */ /* parameters: */ /* string ... string that contains description of generator */ /* */ /* return: */ /* generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { UNUR_DISTR *distr = NULL; /* distribution object */ UNUR_PAR *par = NULL; /* parameter object */ UNUR_GEN *gen = NULL; /* generator object */ UNUR_URNG *urng = NULL; /* uniform random number generator */ char *str_distr = NULL; /* string for distribution */ char *str_method = NULL; /* string for method */ char *str_urng = NULL; /* string for uniform RNG */ char *str = NULL; /* pointer to working string */ char *token; struct unur_slist *mlist; /* list of allocated memory blocks */ /* check arguments */ _unur_check_NULL( GENTYPE,string,NULL ); /* (empty) list of allocated memory blocks */ mlist = _unur_slist_new(); /* Prepare string for processing: */ /* Remove all white spaces, */ /* convert to lower case letters, */ /* copy into working string */ str = _unur_parser_prepare_string( string ); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag) _unur_str_debug_string(0,"[input]",str); #endif /* split string into blocks separated by ampersands '&' */ /* the first block must contain the distribution */ str_distr = strtok(str, "&"); /* new get all the other tokens */ for ( token = strtok(NULL, "&"); token != NULL; token = strtok(NULL, "&") ) { /* get type of block */ if (!strncmp(token,"method=",(size_t)7)) { str_method = token; } else if (!strncmp(token,"urng=",(size_t)5)) { str_urng = token; } else { _unur_error_unknown(token,"category"); _unur_slist_free( mlist ); if (str) free(str); return NULL; } } /* make distribution object */ distr = _unur_str_distr(str_distr); if ( distr == NULL ) { /* error */ _unur_slist_free( mlist ); if (str) free(str); return NULL; } /* get parameter object */ if ( str_method != NULL ) /* method is provided in string */ par = _unur_str_par(str_method, distr, mlist); else /* otherwise use default method */ par = unur_auto_new(distr); /* make generator object */ gen = unur_init(par); /* destroy distribution object */ unur_distr_free(distr); /* set uniform random number generator -- if provided */ if ( str_urng != NULL ) if (gen != NULL) { /* we need a valid generator object */ if ((urng = _unur_str2urng(str_urng)) != NULL ) unur_chg_urng(gen, urng); } /* free allocated memory blocks */ _unur_slist_free(mlist); if (str) free(str); /* check result: nothing to do */ /* if ( gen == NULL ) { */ /* error */ /* return NULL; */ /* } */ #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag) _unur_str_debug_string(0,"",NULL); #endif /* return pointer to generator object */ return gen; } /* end of unur_str2gen() */ /*---------------------------------------------------------------------------*/ struct unur_par * _unur_str2par (const struct unur_distr *distr, const char *string, struct unur_slist **mlist ) /*----------------------------------------------------------------------*/ /* get parameter object for distribution and method */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* string ... string that contains description of method */ /* mlist ... pointer to simple list for allocated memory blocks */ /* */ /* return: */ /* parameter object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { UNUR_PAR *par = NULL; /* parameter object */ char *str = NULL; /* pointer to working string */ /* check arguments */ _unur_check_NULL( GENTYPE,distr,NULL ); _unur_check_NULL( GENTYPE,string,NULL ); /* (empty) list of allocated memory blocks */ *mlist = _unur_slist_new(); /* Prepare string for processing: */ /* Remove all white spaces, */ /* convert to lower case letters, */ /* copy into working string */ str = _unur_parser_prepare_string( string ); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag) _unur_str_debug_string(0,"[input]",str); #endif /* get parameter object */ par = _unur_str_par(str, distr, *mlist); /* free allocated memory blocks */ if (str) free(str); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag) if ( par != NULL ) _unur_str_debug_string(0,"",NULL); #endif /* return pointer to parameter object */ return par; } /* end of _unur_str2par() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_str2distr (const char *string) /*----------------------------------------------------------------------*/ /* get distribution object for given distribution */ /* */ /* parameters: */ /* string ... string that contains description of distribution */ /* */ /* return: */ /* distribution object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { UNUR_DISTR *distr = NULL; /* distribution object */ char *str = NULL; /* pointer to working string */ /* check arguments */ _unur_check_NULL( GENTYPE,string,NULL ); /* Prepare string for processing: */ /* Remove all white spaces, */ /* convert to lower case letters, */ /* copy into working string */ str = _unur_parser_prepare_string( string ); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag) _unur_str_debug_string(0,"[input]",str); #endif /* make distribution object */ distr = _unur_str_distr(str); /* free allocated memory blocks */ if (str) free(str); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag) if ( distr != NULL ) _unur_str_debug_string(0,"",NULL); #endif /* return pointer to distribution object */ return distr; } /* end of unur_str2distr() */ /*---------------------------------------------------------------------------*/ struct unur_gen * unur_makegen_ssu( const char *distrstr, const char *methodstr, UNUR_URNG *urng ) /*----------------------------------------------------------------------*/ /* get generator object for distribution and method */ /* */ /* parameters: */ /* distrstr ... distribution described by a string */ /* methodstr ... chosen method described by a string */ /* urng ... pointer to uniform random number generator */ /* (NULL = default generator) */ /* */ /* return: */ /* generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { UNUR_DISTR *distr = NULL; /* distribution object */ UNUR_PAR *par = NULL; /* parameter object */ UNUR_GEN *gen = NULL; /* generator object */ char *str_distr = NULL; /* string for distribution */ char *str_method = NULL; /* string for method */ struct unur_slist *mlist; /* list of allocated memory blocks */ /* check arguments */ _unur_check_NULL( GENTYPE, distrstr, NULL ); /* (empty) list of allocated memory blocks */ mlist = _unur_slist_new(); /* Prepare string for processing: */ /* Remove all white spaces, */ /* convert to lower case letters, */ /* copy into working string */ str_distr = _unur_parser_prepare_string( distrstr ); str_method = (methodstr) ? _unur_parser_prepare_string( methodstr ) : NULL; #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag) { _unur_str_debug_string(0,"[input-distr]",str_distr); _unur_str_debug_string(0,"[input-method]", (str_method) ? str_method : "(NULL)" ); } #endif do { /* make distribution object */ distr = _unur_str_distr(str_distr); if (distr == NULL) break; /* get parameter object */ if ( str_method != NULL && strlen(str_method)>0 ) /* method is provided in string */ par = _unur_str_par(str_method, distr, mlist); else /* otherwise use default method */ par = unur_auto_new(distr); if (par == NULL) break; /* make generator object */ gen = unur_init(par); if (gen == NULL) break; /* set uniform RNG */ if (urng != NULL) unur_chg_urng(gen, urng); } while (0); /* destroy distribution object */ unur_distr_free(distr); /* free allocated memory blocks */ _unur_slist_free(mlist); if (str_distr) free(str_distr); if (str_method) free(str_method); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag) _unur_str_debug_string(0,"",NULL); #endif /* return pointer to generator object */ return gen; } /* end of unur_makegen_ssu() */ /*---------------------------------------------------------------------------*/ struct unur_gen * unur_makegen_dsu( const struct unur_distr *distr, const char *methodstr, UNUR_URNG *urng ) /*----------------------------------------------------------------------*/ /* get generator object for distribution and method */ /* */ /* parameters: */ /* distr ... distribution object */ /* methodstr ... chosen method described by a string */ /* urng ... pointer to uniform random number generator */ /* (NULL = default generator) */ /* */ /* return: */ /* generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { UNUR_PAR *par = NULL; /* parameter object */ UNUR_GEN *gen = NULL; /* generator object */ char *str_method = NULL; /* string for method */ struct unur_slist *mlist; /* list of allocated memory blocks */ /* check arguments */ _unur_check_NULL( GENTYPE,distr,NULL ); /* (empty) list of allocated memory blocks */ mlist = _unur_slist_new(); /* Prepare string for processing: */ /* Remove all white spaces, */ /* convert to lower case letters, */ /* copy into working string */ str_method = (methodstr) ? _unur_parser_prepare_string( methodstr ) : NULL; #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag) { _unur_str_debug_string(0,"[input-distr]","(distribution object)"); _unur_str_debug_string(0,"[input-method]", (str_method) ? str_method : "(NULL)" ); } #endif do { /* get parameter object */ if ( str_method != NULL && strlen(str_method)>0 ) /* method is provided in string */ par = _unur_str_par(str_method, distr, mlist); else /* otherwise use default method */ par = unur_auto_new(distr); if (par == NULL) break; /* make generator object */ gen = unur_init(par); if (gen == NULL) break; /* set uniform RNG */ if (urng != NULL) unur_chg_urng(gen, urng); } while (0); /* free allocated memory blocks */ _unur_slist_free(mlist); if (str_method) free(str_method); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag) _unur_str_debug_string(0,"",NULL); #endif /* return pointer to generator object */ return gen; } /* end of unur_makegen_dsu() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Distributions **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ struct unur_distr * _unur_str_distr( char *str_distr ) /*----------------------------------------------------------------------*/ /* get distribution object for given distribution */ /* */ /* parameters: */ /* str_distr ... string that contains description of distribution */ /* */ /* return: */ /* distribution object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_distr *distr = NULL; char *token; /* pointer to token in string */ char *next; /* pointer to next token in string */ char *key, *value; /* the key and its value */ /* tokenize the string using ';' as separator and handle the tokens */ for ( token = next = str_distr; next != NULL && *token != '\0'; token = next ) { /* find end of token (i.e. the pointer to next token) */ next = strchr(token,';'); if (next != NULL) { /* next separator found */ *next = '\0'; /* terminate token string */ next++; /* set pointer to next token */ } /* token points to a key */ key = token; /* get the value from the pair key=value and terminate key string */ value = strchr(key, '='); if (value != NULL) { *value = '\0'; /* terminate key string */ value++; /* set pointer to value string */ } /* the first key is treated differently: get new distribution object */ if (key == str_distr) { /* the keyword "distr" is optional */ if (value == NULL) { /* no "distribution" keyword given, so the key points to the value */ value = key; } else { if (*key != 'd') { _unur_error(GENTYPE,UNUR_ERR_STR_SYNTAX,"key for distribution does not start with 'd'"); _unur_distr_free(distr); /* remark: added for ROOT to make coverity integrity manager happy */ return NULL; } } /* get new distribution object */ if (distr != NULL) { _unur_error(GENTYPE,UNUR_ERR_SHOULD_NOT_HAPPEN,""); _unur_distr_free(distr); } distr = _unur_str_distr_new(value); if (distr == NULL) { /* error */ /* _unur_error(GENTYPE,UNUR_ERR_STR,"setting distribution failed"); */ return NULL; } } /* set parameters for distribution */ else { if (_unur_str_distr_set(&distr, key, value)!=UNUR_SUCCESS ) { /* error */ _unur_distr_free(distr); /* _unur_error(GENTYPE,UNUR_ERR_STR,"setting distribution failed"); */ return NULL; } } } return distr; } /* end of _unur_str_distr() */ /*---------------------------------------------------------------------------*/ struct unur_distr * _unur_str_distr_make_os (UNUR_DISTR *distr, const char *key, char *type_args, char **args) /*----------------------------------------------------------------------*/ /* Make distribution object for order statistics of given distribution. */ /* The given distribution `distr' is destroyed. */ /* The list of arguments and their types are given as string. */ /* */ /* type: "ii" (int,int) */ /* */ /* input: "tt" (exactly two single tokens) */ /* "L" (exactly one list) */ /* */ /* action: */ /* if "tt": convert both to int. */ /* execute set call. */ /* if "L": convert list entries to int. */ /* execute set call with first two entries. */ /* (error if list has less than two entries) */ /* otherwise: error */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* key ... name of parameter to be set */ /* type_args ... contains types of arguments. Possible values: */ /* 't' for single token */ /* 'L' for a list */ /* args ... array of pointers to argument strings */ /* */ /* return: */ /* pointer to distribution object for order statistics */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { int *iarray = NULL; /* pointer to working array */ struct unur_distr *os = NULL; /* pointer to order statistics object */ /* either exactly two arguments are given */ if ( !strcmp(type_args, "tt") ) { iarray = _unur_xmalloc( 2*sizeof(double) ); iarray[0] = _unur_atoi( args[0] ); iarray[1] = _unur_atoi( args[1] ); } /* or one list with 2 entries is given */ else if ( !strcmp(type_args, "L") ) { if ( _unur_parse_ilist( args[0], &iarray ) < 2 ) { free (iarray); iarray = NULL; } } if (iarray == NULL ) { /* data list empty (incorrect syntax) */ _unur_error_args(key); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag & UNUR_DEBUG_SETUP) _unur_str_debug_set(2,key,"!"); #endif return NULL; } /* now make object to order statistics */ #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag & UNUR_DEBUG_SETUP) _unur_str_debug_set(2,key,"ii",iarray[0],iarray[1] ); #endif os = unur_distr_corder_new( distr, iarray[0], iarray[1] ); /* free memory */ _unur_distr_free(distr); free (iarray); /* return order statistics (or NULL we could not make such a thing) */ return os; } /* end of _unur_str_distr_make_os() */ /*---------------------------------------------------------------------------*/ int _unur_str_distr_set_i (UNUR_DISTR *distr, const char *key, char *type_args, char **args, distr_set_i set) /*----------------------------------------------------------------------*/ /* Set parameter in given distribution object. */ /* The list of arguments and their types are given as string. */ /* */ /* type: "i" (int) */ /* */ /* input: "t" (exactly one single token) */ /* void (no argument given) */ /* */ /* action: */ /* convert token to int. */ /* (if no argument is given, use 1.) */ /* execute set call. */ /* error if input != "t" */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* key ... name of parameter to be set */ /* type_args ... contains types of arguments. Possible values: */ /* 't' for single token */ /* 'L' for a list */ /* args ... array of pointers to argument strings */ /* set ... pointer to UNU.RAN function for set call */ /* */ /* return: */ /* return code from set call, i.e. */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int iarg; if ( !strcmp(type_args, "t") ) { iarg = _unur_atoi( args[0] ); } else if ( strlen(type_args) == 0 ) { iarg = 1; } else { _unur_error_args(key); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag & UNUR_DEBUG_SETUP) _unur_str_debug_set(2,key,"!"); #endif return UNUR_ERR_STR_INVALID; } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag & UNUR_DEBUG_SETUP) _unur_str_debug_set(2,key,"i",iarg); #endif return set(distr,iarg); } /* end of _unur_str_distr_set_i() */ /*---------------------------------------------------------------------------*/ int _unur_str_distr_set_ii (UNUR_DISTR *distr, const char *key, char *type_args, char **args, distr_set_ii set) /*----------------------------------------------------------------------*/ /* Set parameter in given distribution object. */ /* The list of arguments and their types are given as string. */ /* */ /* type: "ii" (int,int) */ /* */ /* input: "tt" (exactly two single tokens) */ /* "L" (exactly one list) */ /* */ /* action: */ /* if "tt": convert both to int. */ /* execute set call. */ /* if "L": convert list entries to int. */ /* execute set call with first two entries. */ /* (error if list has less than two entries) */ /* otherwise: error */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* key ... name of parameter to be set */ /* type_args ... contains types of arguments. Possible values: */ /* 't' for single token */ /* 'L' for a list */ /* args ... array of pointers to argument strings */ /* set ... pointer to UNU.RAN function for set call */ /* */ /* return: */ /* return code from set call, i.e. */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int *iarray = NULL; int iarg[2]; int result; /* either exactly two arguments are given */ if ( !strcmp(type_args, "tt") ) { iarg[0] = _unur_atoi( args[0] ); iarg[1] = _unur_atoi( args[1] ); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag & UNUR_DEBUG_SETUP) _unur_str_debug_set(2,key,"ii",iarg[0],iarg[1]); #endif return set( distr,iarg[0],iarg[1] ); } /* or one list with 2 entries is given */ else if ( !strcmp(type_args, "L") ) { if ( _unur_parse_ilist( args[0], &iarray ) < 2 ) { _unur_error_args(key); free (iarray); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag & UNUR_DEBUG_SETUP) _unur_str_debug_set(2,key,"!"); #endif return UNUR_ERR_STR_INVALID; } result = set( distr,iarray[0],iarray[1] ); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag & UNUR_DEBUG_SETUP) _unur_str_debug_set(2,key,"ii",iarray[0],iarray[1] ); #endif free (iarray); return result; } else { _unur_error_args(key); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag & UNUR_DEBUG_SETUP) _unur_str_debug_set(2,key,"!"); #endif return UNUR_ERR_STR_INVALID; } } /* end of _unur_str_distr_set_ii() */ /*---------------------------------------------------------------------------*/ int _unur_str_distr_set_d (UNUR_DISTR *distr, const char *key, char *type_args, char **args, distr_set_d set) /*----------------------------------------------------------------------*/ /* Set parameter in given distribution object. */ /* The list of arguments and their types are given as string. */ /* */ /* type: "d" (double) */ /* */ /* input: "t" (exactly one single token) */ /* */ /* action: */ /* convert token to double. */ /* execute set call. */ /* error if input != "t" */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* key ... name of parameter to be set */ /* type_args ... contains types of arguments. Possible values: */ /* 't' for single token */ /* 'L' for a list */ /* args ... array of pointers to argument strings */ /* set ... pointer to UNU.RAN function for set call */ /* */ /* return: */ /* return code from set call, i.e. */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { double darg; if ( strcmp(type_args, "t") ) { _unur_error_args(key); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag & UNUR_DEBUG_SETUP) _unur_str_debug_set(2,key,"!"); #endif return UNUR_ERR_STR_INVALID; } darg = _unur_atod( args[0] ); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag & UNUR_DEBUG_SETUP) _unur_str_debug_set(2,key,"d",darg); #endif return set(distr,darg); } /* end of _unur_str_distr_set_d() */ /*---------------------------------------------------------------------------*/ int _unur_str_distr_set_dd (UNUR_DISTR *distr, const char *key, char *type_args, char **args, distr_set_dd set) /*----------------------------------------------------------------------*/ /* Set parameter in given distribution object. */ /* The list of arguments and their types are given as string. */ /* */ /* type: "dd" (double,double) */ /* */ /* input: "tt" (exactly two single tokens) */ /* "L" (exactly one list) */ /* */ /* action: */ /* if "tt": convert both to double. */ /* execute set call. */ /* if "L": convert list entries to double. */ /* execute set call with first two entries. */ /* (error if list has less than two entries) */ /* otherwise: error */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* key ... name of parameter to be set */ /* type_args ... contains types of arguments. Possible values: */ /* 't' for single token */ /* 'L' for a list */ /* args ... array of pointers to argument strings */ /* set ... pointer to UNU.RAN function for set call */ /* */ /* return: */ /* return code from set call, i.e. */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { double *darray = NULL; double darg[2]; int result; /* either exactly two arguments are given */ if ( !strcmp(type_args, "tt") ) { darg[0] = _unur_atod( args[0] ); darg[1] = _unur_atod( args[1] ); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag & UNUR_DEBUG_SETUP) _unur_str_debug_set(2,key,"dd",darg[0],darg[1]); #endif return set( distr,darg[0],darg[1] ); } /* or one list with 2 entries is given */ else if ( !strcmp(type_args, "L") ) { if ( _unur_parse_dlist( args[0], &darray ) < 2 ) { _unur_error_args(key); free (darray); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag & UNUR_DEBUG_SETUP) _unur_str_debug_set(2,key,"!"); #endif return UNUR_ERR_STR_INVALID; } result = set( distr,darray[0],darray[1] ); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag & UNUR_DEBUG_SETUP) _unur_str_debug_set(2,key,"dd",darray[0],darray[1] ); #endif free (darray); return result; } else { _unur_error_args(key); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag & UNUR_DEBUG_SETUP) _unur_str_debug_set(2,key,"!"); #endif return UNUR_ERR_STR_INVALID; } } /* end of _unur_str_distr_set_dd() */ /*---------------------------------------------------------------------------*/ int _unur_str_distr_set_Di (UNUR_DISTR *distr, const char *key, char *type_args, char **args, distr_set_Di set) /*----------------------------------------------------------------------*/ /* Set parameter in given distribution object. */ /* The list of arguments and their types are given as string. */ /* */ /* type: "Di" (array of doubles, int) */ /* */ /* input: "Lt" (list & single token) */ /* "L" (exactly one list) */ /* */ /* action: */ /* if "L": convert list to array of doubles. */ /* execute set with size if array as second argument. */ /* if "Lt": convert list to array of doubles. */ /* convert second token to int. */ /* set int to min of int and size of array. */ /* execute set call with int and array. */ /* otherwise: error */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* key ... name of parameter to be set */ /* type_args ... contains types of arguments. Possible values: */ /* 't' for single token */ /* 'L' for a list */ /* args ... array of pointers to argument strings */ /* set ... pointer to UNU.RAN function for set call */ /* */ /* return: */ /* return code from set call, i.e. */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int result; int t_size; int size = -1; double *darray = NULL; /* either an integer and a list are given */ if ( !strcmp(type_args, "Lt") ) { t_size = _unur_atoi( args[1] ); size = _unur_parse_dlist( args[0], &darray ); if (size > t_size) size = t_size; } /* or only a list is given */ else if ( !strcmp(type_args, "L") ) { size = _unur_parse_dlist( args[0], &darray ); } /* or there is a syntax error */ if ( !(size>0) ) { _unur_error_args(key); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag & UNUR_DEBUG_SETUP) _unur_str_debug_set(2,key,"!"); #endif result = UNUR_ERR_STR_INVALID; } else { /* execute set command */ result = set( distr,darray,size ); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag & UNUR_DEBUG_SETUP) _unur_str_debug_set(2,key,"Di",darray,size,size); #endif } if (darray) free (darray); return result; } /* end of _unur_str_distr_set_Di() */ /*---------------------------------------------------------------------------*/ int _unur_str_distr_set_C (UNUR_DISTR *distr, const char *key, char *type_args, char **args, distr_set_C set) /*----------------------------------------------------------------------*/ /* Set parameter in given distribution object. */ /* The list of arguments and their types are given as string. */ /* */ /* type: "C" (string = array of char) */ /* */ /* input: "s" (exactly one string) */ /* */ /* action: */ /* execute set call. */ /* error if input != "s" */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* key ... name of parameter to be set */ /* type_args ... contains types of arguments. Possible values: */ /* 's' for single string */ /* args ... array of pointers to argument strings */ /* set ... pointer to UNU.RAN function for set call */ /* */ /* return: */ /* return code from set call, i.e. */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { char *string; if ( strcmp(type_args, "s") ) { _unur_error_args(key); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag & UNUR_DEBUG_SETUP) _unur_str_debug_set(2,key,"!"); #endif return UNUR_ERR_STR_INVALID; } /* get string */ string = args[0]; #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag & UNUR_DEBUG_SETUP) _unur_str_debug_set(2,key,"C",string); #endif return set(distr,string); } /* end of _unur_str_distr_set_C() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Methods **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ struct unur_par * _unur_str_par( char *str_method, const UNUR_DISTR *distr, struct unur_slist *mlist ) /*----------------------------------------------------------------------*/ /* get parameter object for distribution and method */ /* */ /* parameters: */ /* str_method ... string that contains method description */ /* distr ... pointer to distribution object */ /* mlist ... list of allocated memory blocks */ /* */ /* return: */ /* default parameters (pointer to structure) */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_par *par = NULL; /* pointer to parameter object */ char *token; /* pointer to token in string */ char *next; /* pointer to next token in string */ char *key, *value; /* the key and its value */ /* tokenize the string using ';' as separator and handle the tokens */ for ( token = next = str_method; next != NULL && *token != '\0'; token = next ) { /* find end of token (i.e. the pointer to next token) */ next = strchr(token,';'); if (next != NULL) { /* next separator found */ *next = '\0'; /* terminate token string */ next++; /* set pointer to next token */ } /* token points to a key */ key = token; /* get the value from the pair key=value and terminate key string */ value = strchr(key, '='); if (value != NULL) { *value = '\0'; /* terminate key string */ value++; /* set pointer to value string */ } /* the first key is treated differently: get new parameter object */ if (key == str_method) { /* the keyword "method" is optional */ if (value == NULL) { /* no "method" keyword given, so the key points to the value */ value = key; } else { if (*key != 'm') { _unur_error(GENTYPE,UNUR_ERR_STR_SYNTAX,"key for method does not start with 'm'"); return NULL; } } /* get new parameter object */ par = _unur_str_par_new(value,distr); if (par == NULL) { /* error */ _unur_error(GENTYPE,UNUR_ERR_STR,"setting method failed"); return NULL; } } /* set parameters for method */ else { if ( !_unur_str_par_set(par, key, value, mlist) ) { ; /* error: */ } } } /* end */ return par; } /* end of _unur_str_par() */ /*---------------------------------------------------------------------------*/ int _unur_str_par_set_void (UNUR_PAR *par, const char *key, char *type_args, char **args ATTRIBUTE__UNUSED, par_set_void set) /*----------------------------------------------------------------------*/ /* Set parameter in given parameter object. */ /* The list of arguments and their types are given as string. */ /* */ /* type: void (no arguments required) */ /* */ /* input: void (no arguments should be given) */ /* */ /* action: */ /* execute set call. */ /* warning if any argument is given. */ /* */ /* parameters: */ /* par ... pointer to parameter object */ /* key ... name of parameter to be set */ /* type_args ... contains types of arguments. Possible values: */ /* 't' for single token */ /* 'L' for a list */ /* args ... array of pointers to argument strings */ /* set ... pointer to UNU.RAN function for set call */ /* */ /* return: */ /* return code from set call, i.e. */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag & UNUR_DEBUG_SETUP) _unur_str_debug_set(2,key,"v"); #endif if (*type_args != '\0') _unur_error_args(key); return set(par); } /* end of _unur_str_par_set_void() */ /*---------------------------------------------------------------------------*/ int _unur_str_par_set_i (UNUR_PAR *par, const char *key, char *type_args, char **args, par_set_i set) /*----------------------------------------------------------------------*/ /* Set parameter in given parameter object. */ /* The list of arguments and their types are given as string. */ /* */ /* type: "i" (int) */ /* */ /* input: "t" (exactly one single token) */ /* void (no argument given) */ /* */ /* action: */ /* convert token to int. */ /* (if no argument is given, use 1.) */ /* execute set call. */ /* error if input != "t" */ /* */ /* parameters: */ /* par ... pointer to parameter object */ /* key ... name of parameter to be set */ /* type_args ... contains types of arguments. Possible values: */ /* 't' for single token */ /* 'L' for a list */ /* args ... array of pointers to argument strings */ /* set ... pointer to UNU.RAN function for set call */ /* */ /* return: */ /* return code from set call, i.e. */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int iarg; if ( !strcmp(type_args, "t") ) { iarg = _unur_atoi( args[0] ); } else if ( strlen(type_args) == 0 ) { iarg = 1; } else { _unur_error_args(key); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag & UNUR_DEBUG_SETUP) _unur_str_debug_set(2,key,"!"); #endif return UNUR_ERR_STR_INVALID; } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag & UNUR_DEBUG_SETUP) _unur_str_debug_set(2,key,"i",iarg); #endif return set(par,iarg); } /* end of _unur_str_par_set_i() */ /*---------------------------------------------------------------------------*/ int _unur_str_par_set_ii (UNUR_PAR *par, const char *key, char *type_args, char **args, par_set_ii set) /*----------------------------------------------------------------------*/ /* Set parameter in given parameter object. */ /* The list of arguments and their types are given as string. */ /* */ /* type: "ii" (int,int) */ /* */ /* input: "tt" (exactly two single tokens) */ /* "L" (exactly one list) */ /* */ /* action: */ /* if "tt": convert both to int. */ /* execute set call. */ /* if "L": convert list entries to int. */ /* execute set call with first two entries. */ /* (error if list has less than two entries) */ /* otherwise: error */ /* */ /* parameters: */ /* par ... pointer to parameter object */ /* key ... name of parameter to be set */ /* type_args ... contains types of arguments. Possible values: */ /* 't' for single token */ /* 'L' for a list */ /* args ... array of pointers to argument strings */ /* set ... pointer to UNU.RAN function for set call */ /* */ /* return: */ /* return code from set call, i.e. */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int *iarray = NULL; int iarg[2]; int result; /* either exactly two arguments are given */ if ( !strcmp(type_args, "tt") ) { iarg[0] = _unur_atoi( args[0] ); iarg[1] = _unur_atoi( args[1] ); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag & UNUR_DEBUG_SETUP) _unur_str_debug_set(2,key,"ii",iarg[0],iarg[1]); #endif return set( par,iarg[0],iarg[1] ); } /* or one list with 2 entries is given */ else if ( !strcmp(type_args, "L") ) { if ( _unur_parse_ilist( args[0], &iarray ) < 2 ) { _unur_error_args(key); free (iarray); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag & UNUR_DEBUG_SETUP) _unur_str_debug_set(2,key,"!"); #endif return UNUR_ERR_STR_INVALID; } result = set( par,iarray[0],iarray[1] ); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag & UNUR_DEBUG_SETUP) _unur_str_debug_set(2,key,"ii",iarray[0],iarray[1] ); #endif free (iarray); return result; } else { _unur_error_args(key); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag & UNUR_DEBUG_SETUP) _unur_str_debug_set(2,key,"!"); #endif return UNUR_ERR_STR_INVALID; } } /* end of _unur_str_par_set_ii() */ /*---------------------------------------------------------------------------*/ int _unur_str_par_set_u (UNUR_PAR *par, const char *key, char *type_args, char **args, par_set_u set) /*----------------------------------------------------------------------*/ /* Set parameter in given parameter object. */ /* The list of arguments and their types are given as string. */ /* */ /* type: "u" (unsigned) */ /* */ /* input: "t" (exactly one single token) */ /* */ /* action: */ /* convert token to unsigned. */ /* execute set call. */ /* error if input != "t" */ /* */ /* parameters: */ /* par ... pointer to parameter object */ /* key ... name of parameter to be set */ /* type_args ... contains types of arguments. Possible values: */ /* 't' for single token */ /* 'L' for a list */ /* args ... array of pointers to argument strings */ /* set ... pointer to UNU.RAN function for set call */ /* */ /* return: */ /* return code from set call, i.e. */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { unsigned uarg; if ( strcmp(type_args, "t") ) { _unur_error_args(key); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag & UNUR_DEBUG_SETUP) _unur_str_debug_set(2,key,"!"); #endif return UNUR_ERR_STR_INVALID; } uarg = _unur_atou( args[0] ); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag & UNUR_DEBUG_SETUP) _unur_str_debug_set(2,key,"u",uarg); #endif return set(par,uarg); } /* end of _unur_str_par_set_u() */ /*---------------------------------------------------------------------------*/ int _unur_str_par_set_d (UNUR_PAR *par, const char *key, char *type_args, char **args, par_set_d set) /*----------------------------------------------------------------------*/ /* Set parameter in given parameter object. */ /* The list of arguments and their types are given as string. */ /* */ /* type: "d" (double) */ /* */ /* input: "t" (exactly one single token) */ /* */ /* action: */ /* convert token to double. */ /* execute set call. */ /* error if input != "t" */ /* */ /* parameters: */ /* par ... pointer to parameter object */ /* key ... name of parameter to be set */ /* type_args ... contains types of arguments. Possible values: */ /* 't' for single token */ /* 'L' for a list */ /* args ... array of pointers to argument strings */ /* set ... pointer to UNU.RAN function for set call */ /* */ /* return: */ /* return code from set call, i.e. */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { double darg; if ( strcmp(type_args, "t") ) { _unur_error_args(key); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag & UNUR_DEBUG_SETUP) _unur_str_debug_set(2,key,"!"); #endif return UNUR_ERR_STR_INVALID; } darg = _unur_atod( args[0] ); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag & UNUR_DEBUG_SETUP) _unur_str_debug_set(2,key,"d",darg); #endif return set(par,darg); } /* end of _unur_str_par_set_d() */ /*---------------------------------------------------------------------------*/ int _unur_str_par_set_dd (UNUR_PAR *par, const char *key, char *type_args, char **args, par_set_dd set) /*----------------------------------------------------------------------*/ /* Set parameter in given parameter object. */ /* The list of arguments and their types are given as string. */ /* */ /* type: "dd" (double,double) */ /* */ /* input: "tt" (exactly two single tokens) */ /* "L" (exactly one list) */ /* */ /* action: */ /* if "tt": convert both to double. */ /* execute set call. */ /* if "L": convert list entries to double. */ /* execute set call with first two entries. */ /* (error if list has less than two entries) */ /* otherwise: error */ /* */ /* parameters: */ /* par ... pointer to parameter object */ /* key ... name of parameter to be set */ /* type_args ... contains types of arguments. Possible values: */ /* 't' for single token */ /* 'L' for a list */ /* args ... array of pointers to argument strings */ /* set ... pointer to UNU.RAN function for set call */ /* */ /* return: */ /* return code from set call, i.e. */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { double *darray = NULL; double darg[2]; int result; /* either exactly two arguments are given */ if ( !strcmp(type_args, "tt") ) { darg[0] = _unur_atod( args[0] ); darg[1] = _unur_atod( args[1] ); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag & UNUR_DEBUG_SETUP) _unur_str_debug_set(2,key,"dd",darg[0],darg[1]); #endif return set( par,darg[0],darg[1] ); } /* or one list with 2 entries is given */ else if ( !strcmp(type_args, "L") ) { if ( _unur_parse_dlist( args[0], &darray ) < 2 ) { _unur_error_args(key); free (darray); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag & UNUR_DEBUG_SETUP) _unur_str_debug_set(2,key,"!"); #endif return UNUR_ERR_STR_INVALID; } result = set( par,darray[0],darray[1] ); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag & UNUR_DEBUG_SETUP) _unur_str_debug_set(2,key,"dd",darray[0],darray[1] ); #endif free (darray); return result; } else { _unur_error_args(key); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag & UNUR_DEBUG_SETUP) _unur_str_debug_set(2,key,"!"); #endif return UNUR_ERR_STR_INVALID; } } /* end of _unur_str_par_set_dd() */ /*---------------------------------------------------------------------------*/ int _unur_str_par_set_iD (UNUR_PAR *par, const char *key, char *type_args, char **args, par_set_iD set, struct unur_slist *mlist ) /*----------------------------------------------------------------------*/ /* Set parameter in given parameter object. */ /* The list of arguments and their types are given as string. */ /* */ /* type: "iD" (int, array of doubles) */ /* */ /* input: "tL" (single token & list) */ /* "L" (exactly one list) */ /* "t" (single token) */ /* */ /* action: */ /* if "L": convert list to array of doubles. */ /* execute set with size if array as first argument. */ /* if "t": convert token to int. */ /* execute set call with NULL as its second argument. */ /* if "tL": convert list to array of doubles. */ /* convert first token to int. */ /* set int to min of int and size of array. */ /* execute set call with int and array. */ /* otherwise: error */ /* */ /* parameters: */ /* par ... pointer to parameter object */ /* key ... name of parameter to be set */ /* type_args ... contains types of arguments. Possible values: */ /* 't' for single token */ /* 'L' for a list */ /* args ... array of pointers to argument strings */ /* set ... pointer to UNU.RAN function for set call */ /* mlist ... list of allocated memory blocks */ /* */ /* return: */ /* return code from set call, i.e. */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int result; int t_size; int size = -1; double *darray = NULL; /* either an integer and a list are given */ if ( !strcmp(type_args, "tL") ) { t_size = _unur_atoi( args[0] ); size = _unur_parse_dlist( args[1], &darray ); if (size > 0) { if (size > t_size) size = t_size; } else { /* empty list */ size = t_size; if (darray) free (darray); darray = NULL; } } /* or only an integer is given */ else if ( !strcmp(type_args, "t") ) { size = _unur_atoi( args[0] ); darray = NULL; } /* or only a list is given */ else if ( !strcmp(type_args, "L") ) { size = _unur_parse_dlist( args[0], &darray ); } /* or there is a syntax error */ if ( !(size>0) ) { _unur_error_args(key); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag & UNUR_DEBUG_SETUP) _unur_str_debug_set(2,key,"!"); #endif result = UNUR_ERR_STR_INVALID; } else { /* execute set command */ result = set( par,size,darray ); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag & UNUR_DEBUG_SETUP) _unur_str_debug_set(2,key,"iD",size,darray,size); #endif } /* store pointer to allocated array */ if (darray) _unur_slist_append( mlist, darray ); return result; } /* end of _unur_str_par_set_iD() */ /*---------------------------------------------------------------------------*/ int _unur_str_par_set_Di (UNUR_PAR *par, const char *key, char *type_args, char **args, par_set_Di set, struct unur_slist *mlist ) /*----------------------------------------------------------------------*/ /* Set parameter in given parameter object. */ /* The list of arguments and their types are given as string. */ /* */ /* type: "Di" (array of doubles, int) */ /* */ /* input: "Lt" (list & single token & list) */ /* */ /* action: */ /* convert list to array of doubles. */ /* convert token to int. */ /* execute set call with array and int. */ /* */ /* parameters: */ /* par ... pointer to parameter object */ /* key ... name of parameter to be set */ /* type_args ... contains types of arguments. Possible values: */ /* 't' for single token */ /* 'L' for a list */ /* args ... array of pointers to argument strings */ /* set ... pointer to UNU.RAN function for set call */ /* mlist ... list of allocated memory blocks */ /* */ /* return: */ /* return code from set call, i.e. */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int result; int t_size; int size; double *darray = NULL; if ( !strcmp(type_args, "Lt") ) { t_size = _unur_atoi( args[1] ); size = _unur_parse_dlist( args[0], &darray ); if (size > 0) { result = set( par,darray,t_size ); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag & UNUR_DEBUG_SETUP) _unur_str_debug_set(2,key,"Di",darray,size,size); #endif /* store pointer to allocated array */ if (darray) _unur_slist_append( mlist, darray ); return result; } } /* there is a syntax error */ _unur_error_args(key); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag & UNUR_DEBUG_SETUP) _unur_str_debug_set(2,key,"!"); #endif return UNUR_ERR_STR_INVALID; } /* end of _unur_str_par_set_Di() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Uniform RNG **/ /*****************************************************************************/ UNUR_URNG * _unur_str2urng( char *str_urng ATTRIBUTE__UNUSED) /*----------------------------------------------------------------------*/ /* get uniform RNG */ /* */ /* parameters: */ /* str_urng ... string that contains description of uniform RNG */ /* */ /* return: */ /* pointer to uniform RNG */ /* */ /* The string must not contain any other keywords than "urng". */ /* the argument is passed unchanged to the PRNG package. */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { /*---------------------------------------------------------------------------*/ #if defined(UNUR_URNG_UNURAN) && defined(UNURAN_HAS_PRNG) /*---------------------------------------------------------------------------*/ UNUR_URNG *urng = NULL; char *token; /* pointer to token in string */ char *next; /* pointer to next token in string */ char *key, *value; /* the key and its value */ /* tokenize the string using ';' as separator and handle the tokens */ for ( token = next = str_urng; next != NULL && *token != '\0'; token = next ) { /* find end of token (i.e. the pointer to next token) */ next = strchr(token,';'); if (next != NULL) { /* next separator found */ *next = '\0'; /* terminate token string */ next++; /* set pointer to next token */ } /* token points to a key */ key = token; /* get the value from the pair key=value and terminate key string */ value = strchr(key, '='); if (value != NULL) { *value = '\0'; /* terminate key string */ value++; /* set pointer to value string */ } /* get (default) parameter object for method */ if ( !strcmp( key, "urng") ) { if (key == str_urng) { /* "urng" must be the first key. */ /* (on the other hand, the first keyword always must be "urng" */ /* since otherwise we had not called this subroutine. */ /* hence, we only check, whether the keyword "urng" is unique.) */ urng = unur_urng_prng_new(value); if (urng == NULL) { /* error */ _unur_error(GENTYPE,UNUR_ERR_STR,"setting URNG failed"); return NULL; } else { #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag & UNUR_DEBUG_SETUP) _unur_str_debug_string(1,"urng",value); #endif ; } } else { if (urng) unur_urng_free (urng); _unur_error(GENTYPE,UNUR_ERR_STR_SYNTAX,"urng must be first key"); return NULL; } } /* there are no other parameters */ else { /* error: unknown parameter */ if (urng) unur_urng_free (urng); _unur_error_unknown(key,"parameter for uniform RNG"); return NULL; } } /*return pointer to uniform RNG */ return urng; /*---------------------------------------------------------------------------*/ #else /*---------------------------------------------------------------------------*/ _unur_error(GENTYPE,UNUR_ERR_STR,"setting URNG requires PRNG library enabled"); return NULL; /*---------------------------------------------------------------------------*/ #endif /* end defined(UNUR_URNG_UNURAN) && defined(UNURAN_HAS_PRNG) */ /*---------------------------------------------------------------------------*/ } /* end of _unur_str2urng() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Misc **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ int _unur_str_set_args( char *value, char *type_args, char **args, int max_args ) /*----------------------------------------------------------------------*/ /* parse argument string for set call */ /* */ /* parameters: */ /* value ... string that contains list of arguments for set call */ /* type_args ... array containing info about arguments */ /* args ... pointers to argument strings */ /* max_args ... maximal number of argments */ /* */ /* tokenize string with arguments and store the pointer to each */ /* argument in 'args'. Evaluate the type of each argument and store it */ /* in 'type_args'. We have the following types: */ /* 't' ... a single token, or */ /* 'L' ... a list, indicated by (...) */ /* */ /* return: */ /* number of parsed arguments */ /* */ /* error: */ /* return -1 */ /*----------------------------------------------------------------------*/ { char *token; /* pointer to token in string */ char *next; /* pointer to next token in string */ int n_args; /* number of arguments in set call */ /* initialize pointers */ n_args = 0; *type_args = '\0'; *args = NULL; /* we have two types of arguments: 't' ... a single token, or 'L' ... a list, indicated by (...) */ /* split value string into separate arguments */ if (value && *value != '\0') { /* there is at least one argument */ for ( token = next = value; next != NULL && *token != '\0' && n_args < max_args; token = next, n_args++ ) { /* get type of argument */ if ( *token == '(' ) { /* argument is a list */ type_args[n_args] = 'L'; /* skip to next character */ token++; /* store pointer to argument */ args[n_args] = token; /* find end of list using ')' as terminating character */ next = strchr(token,')'); if (next != NULL) { /* end of list found */ *next = '\0'; /* terminate token string */ token = ++next; /* set pointer to first character after ')' */ /* first character after ')' must be ',' */ if ( !(*token == ',' || *token == '\0') ) { _unur_error(GENTYPE,UNUR_ERR_STR_SYNTAX,") not followed by comma"); return -1; } } else { /* no ')' found */ token = NULL; } } else if ( *token == '"' ) { /* argument is a string */ type_args[n_args] = 's'; /* skip to next character */ token++; /* store pointer to argument */ args[n_args] = token; /* find end of string using '"' as terminating character */ next = strchr(token,'"'); if (next != NULL) { /* end of list found */ *next = '\0'; /* terminate token string */ token = ++next; /* set pointer to first character after ')' */ /* first character after ')' must be ',' */ if ( !(*token == ',' || *token == '\0') ) { _unur_error(GENTYPE,UNUR_ERR_STR_SYNTAX,"closing '\"' not followed by comma"); return -1; } } else { /* no '"' found */ token = NULL; } } else { /* argument is a sigle item */ type_args[n_args] = 't'; /* store pointer to argument */ args[n_args] = token; } /* find end of argument string using ',' as separator */ if (token) { next = strchr(token,','); if (next != NULL) { /* next separator found */ *next = '\0'; /* terminate token string */ next++; /* set pointer to next token */ } } else { next = NULL; } } /* terminate string */ type_args[n_args] = '\0'; /* If there are two many arguments, we simply assume a syntax error */ /* (This case should not happen.) */ if (n_args >= max_args) { _unur_error( GENTYPE, UNUR_ERR_STR_SYNTAX, "too many arguments"); return -1; } } /* return number of parsed arguments */ return n_args; } /* end of _unur_str_set_args() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Convert to numbers **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ int _unur_parse_ilist( char *liststr, int **iarray ) /*----------------------------------------------------------------------*/ /* Process a comma separated list of integers, convert it to ints and */ /* store it an array. The list (string) is terminated by a closing */ /* parenthesis ')' or '\0'. */ /* */ /* parameters: */ /* liststr ... string containing list of numbers */ /* iarray ... pointer to adress of double array for storing result */ /* */ /* return: */ /* number of elements extracted */ /* */ /* comment: */ /* as a side effect an int array of appropriate size is allocated. */ /*----------------------------------------------------------------------*/ { int *iarr = NULL; /* pointer to int array */ int n_iarray = 0; /* number of elements in processed list */ int n_alloc = 0; /* number allocated elements */ char *token; /* return 0 if no list is given */ if (liststr == NULL) { *iarray = iarr; return 0; } /* discard possible leading ',' or '(' characters in front of the numbers */ while ( *liststr == ',' || *liststr == '(' ){ liststr++; /* next char */ } /* new get integers */ for ( token = strtok(liststr, ",)"); token != NULL; token = strtok(NULL, ",)") ) { /* check if there is enough space in iarr */ if (n_iarray >= n_alloc) { /* no --> allocate memory */ n_alloc += 100; iarr = _unur_xrealloc( iarr, n_alloc * sizeof(int) ); } /* get int */ iarr[n_iarray++] = _unur_atoi(token); } /* end while -- all elements of list read */ /* store pointer to double array */ *iarray = iarr; /* return number of elements in array */ return n_iarray; } /* end of _unur_parse_ilist() */ /*---------------------------------------------------------------------------*/ int _unur_parse_dlist( char *liststr, double **darray ) /*----------------------------------------------------------------------*/ /* Process a comma separated list of numbers (doubles), convert it to */ /* doubles and store it an array. The list (string) is terminated by */ /* a closing parenthesis ')' or '\0'. */ /* */ /* parameters: */ /* liststr ... string containing list of numbers */ /* darray ... pointer to adress of double array for storing result */ /* */ /* return: */ /* number of elements extracted */ /* */ /* comment: */ /* as a side effect a double array of appropriate size is allocated. */ /*----------------------------------------------------------------------*/ { double *darr = NULL; /* pointer to double array */ int n_darray = 0; /* number of elements in processed list */ int n_alloc = 0; /* number allocated elements */ char *token; /* pointer to token in string */ char *next; /* pointer to next token in string */ /* return 0 if no list is given */ if (liststr == NULL) { *darray = NULL; return 0; } /* extract doubles from string and write them to array of doubles. */ /* end of list is indicated by right bracket ')' or '\0'. */ /* pointer to first token in string */ token = liststr; /* remove (optional) leading parenthesis '(' */ while (*token != '\0' && *token == '(') ++token; /* tokenize the string using ',' as separator and handle the tokens */ for ( next = token; next != NULL && *token != '\0' &&*token != ')'; token = next ) { /* find end of token (i.e. the pointer to next token) */ next = strchr(token,','); if (next != NULL) { /* next separator found */ *next = '\0'; /* terminate token string */ next++; /* set pointer to next token */ } /* check if there is enough space in darr */ if (n_darray >= n_alloc) { /* no --> allocate memory */ n_alloc += 100; darr = _unur_xrealloc( darr, n_alloc * sizeof(double) ); } /* extract double and write to array and increase counter */ darr[n_darray] = _unur_atod(token); n_darray++; } /* store pointer to double array */ *darray = darr; /* return number of elements in array */ return n_darray; } /* end of _unur_parse_dlist() */ /*---------------------------------------------------------------------------*/ int _unur_atoi ( const char *str ) /*----------------------------------------------------------------------*/ /* Converts the string into its integer representation. */ /* 'true' and 'on' are converted to 1, 'false' and 'off' to 0. */ /* */ /* parameters: */ /* str ... pointer to string */ /* */ /* return: */ /* integer */ /*----------------------------------------------------------------------*/ { if ( !strcmp(str,"true") || !strcmp(str,"on") ) return 1; else if ( !strcmp(str,"false") || !strcmp(str,"off") ) return 0; else if ( !strncmp(str,"inf",(size_t)3) ) return INT_MAX; else if ( !strncmp(str,"-inf",(size_t)4) ) return INT_MIN; else return atoi(str); } /* end of _unur_atoi() */ /*---------------------------------------------------------------------------*/ unsigned _unur_atou ( const char *str ) /*----------------------------------------------------------------------*/ /* Converts the string into its unsigned representation. */ /* strings are interprated as hexadecimal numbers. */ /* 'true' and 'on' are converted to 1u, 'false' and 'off' to 0u. */ /* */ /* parameters: */ /* str ... pointer to string */ /* */ /* return: */ /* unsigned */ /*----------------------------------------------------------------------*/ { char *tail; if ( !strcmp(str,"true") || !strcmp(str,"on") ) return 1u; else if ( !strcmp(str,"false") || !strcmp(str,"off") ) return 0u; else return ((unsigned) strtoul(str, &tail, 16)); } /* end of _unur_atou() */ /*---------------------------------------------------------------------------*/ double _unur_atod ( const char *str ) /*----------------------------------------------------------------------*/ /* Converts the string into its double value. */ /* */ /* parameters: */ /* str ... pointer to string */ /* */ /* return: */ /* double */ /*----------------------------------------------------------------------*/ { if ( !strncmp(str,"inf",(size_t)3) ) return UNUR_INFINITY; else if ( !strncmp(str,"-inf",(size_t)4) ) return -UNUR_INFINITY; else return atof(str); } /* end of _unur_atod() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Debugging utilities **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ void _unur_str_debug_string( int level, const char *key, const char *value ) /*----------------------------------------------------------------------*/ /* print key & value info into LOG file */ /* */ /* parameters: */ /* level ... level of indentation */ /* key ... pointer to key string */ /* value ... pointer to value string */ /*----------------------------------------------------------------------*/ { FILE *LOG; LOG = unur_get_stream(); /* fprintf(LOG,"%s: String Interface for UNU.RAN\n",GENTYPE); */ fprintf(LOG,"%s: ",GENTYPE); for (; level>0; level--) fprintf(LOG,"\t"); fprintf(LOG,"%s",key); if (value) fprintf(LOG,": %s",value); fprintf(LOG,"\n"); /* fprintf(LOG,"%s:\n",GENTYPE); */ } /* end of _unur_str_debug_string() */ /*---------------------------------------------------------------------------*/ void _unur_str_debug_distr( int level, const char *name, double *params, int n_params ) /*----------------------------------------------------------------------*/ /* write info about distribution into LOG file */ /* */ /* parameters: */ /* level ... level of indentation */ /* name ... name of distribution */ /* params ... array of parameters */ /* n_params ... number of parameters */ /*----------------------------------------------------------------------*/ { FILE *LOG; int i; LOG = unur_get_stream(); fprintf(LOG,"%s: ",GENTYPE); for (; level>0; level--) fprintf(LOG,"\t"); fprintf(LOG,"distribution = %s (",name); if (n_params >0) { fprintf(LOG,"%g",params[0]); for (i=1; i0; level--) fprintf(LOG,"\t"); fprintf(LOG,"%s: ",key); while (1) { switch (*type) { case 'v': fprintf(LOG," -none-"); break; case 'd': fprintf(LOG," %g",va_arg(ap,double)); break; case 'i': fprintf(LOG," %d",va_arg(ap,int)); break; case 'u': fprintf(LOG," %x",va_arg(ap,unsigned int)); break; case 'C': fprintf(LOG," %s",va_arg(ap,char *)); break; case 'D': { int i,size; double *darray; darray = va_arg(ap,double *); size = va_arg(ap,int); if (size > 0 && darray != NULL) { fprintf(LOG," (%g",darray[0]); for (i=1; itext); _unur_string_free( reason ); } /* end of _unur_str_error_unknown() */ /*---------------------------------------------------------------------------*/ void _unur_str_error_invalid( const char *file, int line, const char *key, const char *type ) /*----------------------------------------------------------------------*/ /* print error message: invalid data for keyword. */ /* */ /* parameters: */ /* file ... file name (inserted by __FILE__) */ /* line ... line number in source file (inserted by __LINE__) */ /* key ... keyword */ /* type ... type of keyword */ /*----------------------------------------------------------------------*/ { struct unur_string *reason = _unur_string_new(); _unur_string_append( reason, "invalid data for %s '%s'", type, key ); _unur_error_x( GENTYPE, file, line, "error", UNUR_ERR_STR_INVALID,reason->text); _unur_string_free( reason ); } /* end of _unur_str_error_invalid() */ /*---------------------------------------------------------------------------*/ void _unur_str_error_args( const char *file, int line, const char *key ) /*----------------------------------------------------------------------*/ /* print error message: invalid argument string for set call. */ /* */ /* parameters: */ /* file ... file name (inserted by __FILE__) */ /* line ... line number in source file (inserted by __LINE__) */ /* key ... keyword */ /*----------------------------------------------------------------------*/ { struct unur_string *reason = _unur_string_new(); _unur_string_append( reason, "invalid argument string for '%s'", key ); _unur_error_x( GENTYPE, file, line, "error", UNUR_ERR_STR_INVALID,reason->text); _unur_string_free( reason ); } /* end of _unur_str_error_args() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/parser/functparser_deriv.ch0000644001357500135600000007574214420445767016215 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: functparser_deriv.c * * * * Compute function tree for derivative. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** API **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ struct ftreenode * _unur_fstr_make_derivative ( const struct ftreenode *root ) /*----------------------------------------------------------------------*/ /* Make function tree for derivate of given function (tree). */ /* */ /* parameters: */ /* root ... pointer to root of function tree */ /* */ /* return: */ /* pointer to tree of derivative */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct ftreenode *deriv = NULL; /* pointer to function tree of derivative */ int error = 0; /* error code */ /* check arguments */ _unur_check_NULL( GENTYPE,root,NULL ); COOKIE_CHECK(root,CK_FSTR_TNODE,NULL); deriv = (*symbol[root->token].dcalc)(root,&error); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag) _unur_fstr_debug_deriv(root,deriv); #endif if (error == TRUE) { /* set unuran error code */ unur_errno = UNUR_ERR_FSTR_DERIV; if (deriv) _unur_fstr_free(deriv); return NULL; } return deriv; } /* end of _unur_fstr_make_derivative() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Routines for computing derivatives **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ struct ftreenode * d_error (const struct ftreenode *node, int *error) { /* check arguments */ CHECK_NULL(node,NULL); COOKIE_CHECK(node,CK_FSTR_TNODE,NULL); _unur_fstr_error_deriv(node,__LINE__); *error = TRUE; return NULL; } /* end of d_error() */ /*---------------------------------------------------------------------------*/ struct ftreenode * d_const (const struct ftreenode *node ATTRIBUTE__UNUSED, int *error ATTRIBUTE__UNUSED) /* (const)' = 0 */ /* */ /* Const 0. */ /* / \ ==> / \ */ /* NULL NULL NULL NULL */ { /* check arguments */ CHECK_NULL(node,NULL); COOKIE_CHECK(node,CK_FSTR_TNODE,NULL); return _unur_fstr_create_node(NULL,0.,s_uconst,NULL,NULL); } /* end of d_const() */ /*---------------------------------------------------------------------------*/ struct ftreenode * d_var (const struct ftreenode *node ATTRIBUTE__UNUSED, int *error ATTRIBUTE__UNUSED) /* x' = 1 */ /* */ /* Var 1. */ /* / \ ==> / \ */ /* NULL NULL NULL NULL */ { /* check arguments */ CHECK_NULL(node,NULL); COOKIE_CHECK(node,CK_FSTR_TNODE,NULL); return _unur_fstr_create_node(NULL,1.,s_uconst,NULL,NULL); } /* end of d_var() */ /*---------------------------------------------------------------------------*/ struct ftreenode * d_add (const struct ftreenode *node, int *error) /* summation rule: (l+r)' = l' + r' */ /* */ /* Op Op */ /* / \ ==> / \ (Op ::= '+' | '-') */ /* X Y X' Y' */ { struct ftreenode *left, *right; struct ftreenode *d_left, *d_right; int op; /* check arguments */ CHECK_NULL(node,NULL); COOKIE_CHECK(node,CK_FSTR_TNODE,NULL); /* left and right node */ left = node->left; right = node->right; /* token for operator */ op = node->token; /* derivative of both branches */ d_left = (left) ? (*symbol[left->token].dcalc) (left,error) : NULL; d_right = (right) ? (*symbol[right->token].dcalc)(right,error) : NULL; /* make subtree */ return _unur_fstr_create_node(node->symbol,0.,op,d_left,d_right); } /* end of d_add() */ /*---------------------------------------------------------------------------*/ struct ftreenode * d_mul (const struct ftreenode *node, int *error) /* product rule: (l*r)' = l'*r + l*r' */ /* */ /* '*' __'+'__ */ /* / \ / \ */ /* X Y ==> '*' '*' */ /* / \ / \ */ /* X' Y X Y' */ { struct ftreenode *left, *right; struct ftreenode *d_left, *d_right; struct ftreenode *br_left, *br_right; /* check arguments */ CHECK_NULL(node,NULL); COOKIE_CHECK(node,CK_FSTR_TNODE,NULL); /* make a copy of the branches of node */ left = _unur_fstr_dup_tree(node->left); right = _unur_fstr_dup_tree(node->right); /* derivative of both branches */ d_left = (left) ? (*symbol[left->token].dcalc) (left,error) : NULL; d_right = (right) ? (*symbol[right->token].dcalc)(right,error) : NULL; /* make subtree */ br_left = _unur_fstr_create_node("*",0.,s_mul,d_left,right); br_right = _unur_fstr_create_node("*",0.,s_mul,left,d_right); /* return subtree */ return _unur_fstr_create_node("+",0.,s_plus,br_left,br_right); } /* end of d_mul() */ /*---------------------------------------------------------------------------*/ struct ftreenode * d_div (const struct ftreenode *node, int *error) /* Quotient rule: (l/r)' = (l'*r-l*r')/r^2 */ /* */ /* '/' ___'/'___ */ /* / \ / \ */ /* X Y ==> '-' '^' */ /* / \ / \ */ /* '*' '*' Y 2 */ /* / \ / \ */ /* X' Y X Y' */ /* */ { struct ftreenode *left, *right; struct ftreenode *d_left, *d_right; struct ftreenode *br_left, *br_right, *two; struct ftreenode *numerator, *denominator; /* check arguments */ CHECK_NULL(node,NULL); COOKIE_CHECK(node,CK_FSTR_TNODE,NULL); /* make a copy of the branches of node */ left = _unur_fstr_dup_tree(node->left); right = _unur_fstr_dup_tree(node->right); /* derivative of both branches */ d_left = (left) ? (*symbol[left->token].dcalc) (left,error) : NULL; d_right = (right) ? (*symbol[right->token].dcalc)(right,error) : NULL; /* make nominator */ two = _unur_fstr_create_node(NULL,2.,s_uconst,NULL,NULL); /* const 2 */ denominator = _unur_fstr_create_node("^",0.,s_power,right,two); /* make numerator */ right = _unur_fstr_dup_tree(node->right); /* we need another copy */ br_left = _unur_fstr_create_node("*",0.,s_mul,d_left,right); br_right = _unur_fstr_create_node("*",0.,s_mul,left,d_right); numerator= _unur_fstr_create_node("-",0.,s_minus,br_left,br_right); /* subtree */ return _unur_fstr_create_node("/",0.,s_div,numerator,denominator); } /* end of d_div() */ /*---------------------------------------------------------------------------*/ struct ftreenode * d_power (const struct ftreenode *node, int *error) /* case: r constant */ /* (l^r)' = r * l^(r-1) * l' */ /* */ /* '^' '*' */ /* / \ ==> / \ */ /* X Y X' '*' */ /* / \ / \ */ /* NULL NULL Y '^' */ /* / \ */ /* X (Y-1) */ /* */ /* case: l constant */ /* (l^r)' = r' * l^r * log(l) */ /* */ /* '^' '*' */ /* / \ ==> / \ */ /* X Y Y' _'*'_ */ /* / \ / \ */ /* NULL NULL "log" '^' */ /* / \ / \ */ /* NULL X X Y */ /* */ /* otherwise: */ /* (l^r)' = l^(r-1) * ( r * l' + l * log(l) * r' ) */ /* */ /* '^' ______'*'_____ */ /* / \ ==> / \ */ /* X Y '^' __'+'__ */ /* / \ / \ */ /* X '-' '*' '*' */ /* / \ / \ / \ */ /* Y 1 Y X' X '*' */ /* / \ */ /* Y' "log" */ /* / \ */ /* NULL X */ /* */ { struct ftreenode *left, *right; struct ftreenode *d_left, *d_right; struct ftreenode *br_right; struct ftreenode *dup_node, *tmp1, *tmp2; /* check arguments */ CHECK_NULL(node,NULL); COOKIE_CHECK(node,CK_FSTR_TNODE,NULL); /* left and right node */ left = node->left; right = node->right; if (right && (right->type == S_UCONST || right->type == S_SCONST) ) { /* '^' '*' */ /* / \ ==> / \ */ /* X Y X' '*' */ /* / \ / \ */ /* NULL NULL Y '^' */ /* / \ */ /* X (Y-1) */ /* derivative of left branch */ d_left = (left) ? (*symbol[left->token].dcalc) (left,error) : NULL; /* make a copy of the branches of node */ left = _unur_fstr_dup_tree(node->left); right = _unur_fstr_dup_tree(node->right); /* make right branch */ tmp1 = _unur_fstr_create_node(NULL,right->val-1,s_uconst,NULL,NULL); tmp2 = _unur_fstr_create_node("^",0.,s_power,left,tmp1); br_right = _unur_fstr_create_node("*",0.,s_mul,right,tmp2); /* subtree */ return _unur_fstr_create_node("*",0.,s_mul,d_left,br_right); } else if (left && (left->type == S_UCONST || left->type == S_SCONST) ) { /* '^' '*' */ /* / \ ==> / \ */ /* X Y Y' _'*'_ */ /* / \ / \ */ /* NULL NULL "log" '^' */ /* / \ / \ */ /* NULL X X Y */ /* */ /* find symbol "log" */ int s_log = _unur_fstr_find_symbol("log",_ans_start,_ans_end); /* derivative of right branch */ d_right = (right) ? (*symbol[right->token].dcalc) (right,error) : NULL; /* make copies of branches */ left = _unur_fstr_dup_tree(node->left); dup_node = _unur_fstr_dup_tree(node); /* make right branch */ tmp1 = _unur_fstr_create_node("log",0.,s_log,NULL,left); br_right = _unur_fstr_create_node("*",0.,s_mul,tmp1,dup_node); /* subtree */ return _unur_fstr_create_node("*",0.,s_mul,d_right,br_right); } else { /* '^' ______'*'_____ */ /* / \ ==> / \ */ /* X Y '^' __'+'__ */ /* / \ / \ */ /* X '-' '*' '*' */ /* / \ / \ / \ */ /* Y 1 Y X' X '*' */ /* / \ */ /* Y' "log" */ /* / \ */ /* NULL X */ /* */ /** TODO **/ _unur_fstr_error_deriv(node,__LINE__); *error = TRUE; return NULL; } } /* end of d_power() */ /*---------------------------------------------------------------------------*/ struct ftreenode * d_exp (const struct ftreenode *node, int *error) /* (exp(r))' = r' * exp(r) */ /* */ /* "exp" '*' */ /* / \ ==> / \ */ /* NULL X X' "exp" */ /* / \ */ /* NULL X */ { struct ftreenode *right; struct ftreenode *d_right; struct ftreenode *br_right; /* check arguments */ CHECK_NULL(node,NULL); COOKIE_CHECK(node,CK_FSTR_TNODE,NULL); /* right node */ right = node->right; /* derivative of right branch */ d_right = (right) ? (*symbol[right->token].dcalc)(right,error) : NULL; /* make a copy of whole subrtree at node */ br_right = _unur_fstr_dup_tree(node); /* subtree */ return _unur_fstr_create_node("*",0.,s_mul,d_right,br_right); } /* ebd of d_exp() */ /*---------------------------------------------------------------------------*/ struct ftreenode * d_log (const struct ftreenode *node, int *error) /* (log(r))' = r'/r */ /* */ /* "log" '/' */ /* / \ ==> / \ */ /* NULL X X' X */ { struct ftreenode *right; struct ftreenode *d_right; /* check arguments */ CHECK_NULL(node,NULL); COOKIE_CHECK(node,CK_FSTR_TNODE,NULL); /* make a copy of the right branch of node */ right = _unur_fstr_dup_tree(node->right); /* derivative of right branch */ d_right = (right) ? (*symbol[right->token].dcalc)(right,error) : NULL; /* subtree */ return _unur_fstr_create_node("/",0.,s_div,d_right,right); } /* end of d_log() */ /*---------------------------------------------------------------------------*/ struct ftreenode * d_sin (const struct ftreenode *node, int *error) /* (sin(r))' = r' * cos(r) */ /* */ /* "sin" '*' */ /* / \ ==> / \ */ /* NULL X X' "cos" */ /* / \ */ /* NULL X */ { struct ftreenode *right; struct ftreenode *d_right; struct ftreenode *br_right; /* find symbol "cos" */ int s_cos = _unur_fstr_find_symbol("cos",_ans_start,_ans_end); /* check arguments */ CHECK_NULL(node,NULL); COOKIE_CHECK(node,CK_FSTR_TNODE,NULL); /* make a copy of the right branch of node */ right = _unur_fstr_dup_tree(node->right); /* derivative of right branch */ d_right = (right) ? (*symbol[right->token].dcalc)(right,error) : NULL; /* right branch of new tree */ br_right = _unur_fstr_create_node("cos",0.,s_cos,NULL,right); /* subtree */ return _unur_fstr_create_node(NULL,0.,s_mul,d_right,br_right); } /* end of d_sin() */ /*---------------------------------------------------------------------------*/ struct ftreenode * d_cos (const struct ftreenode *node, int *error) /* (cos(r))' = -r' * sin(r) */ /* */ /* "cos" ____'*'____ */ /* / \ ==> / \ */ /* NULL X '-' "sin" */ /* / \ / \ */ /* 0 X' NULL X */ { struct ftreenode *right; struct ftreenode *d_right; struct ftreenode *br_left, *br_right; struct ftreenode *zero; /* find symbol "sin" */ int s_sin = _unur_fstr_find_symbol("sin",_ans_start,_ans_end); /* check arguments */ CHECK_NULL(node,NULL); COOKIE_CHECK(node,CK_FSTR_TNODE,NULL); /* make a copy of the right branch of node */ right = _unur_fstr_dup_tree(node->right); /* derivative of right branch */ d_right = (right) ? (*symbol[right->token].dcalc)(right,error) : NULL; /* branches of new tree */ br_right = _unur_fstr_create_node("sin",0.,s_sin,NULL,right); zero = _unur_fstr_create_node(NULL,0.,s_uconst,NULL,NULL); br_left = _unur_fstr_create_node("-",0.,s_minus,zero,d_right); /* subtree */ return _unur_fstr_create_node("*",0.,s_mul,br_left,br_right); } /* end of d_cos() */ /*---------------------------------------------------------------------------*/ struct ftreenode * d_tan (const struct ftreenode *node, int *error) /* (tan(r))' = r' * (sec(r))^2 */ /* */ /* "tan" '*' */ /* / \ ==> / \ */ /* NULL X X' '^' */ /* / \ */ /* "sec" 2. */ /* / \ */ /* NULL X */ { struct ftreenode *right; struct ftreenode *d_right; struct ftreenode *br_right, *sub_right; struct ftreenode *two; /* find symbol "sec" */ int s_sec = _unur_fstr_find_symbol("sec",_ans_start,_ans_end); /* check arguments */ CHECK_NULL(node,NULL); COOKIE_CHECK(node,CK_FSTR_TNODE,NULL); /* make a copy of the right branch of node */ right = _unur_fstr_dup_tree(node->right); /* derivative of right branch */ d_right = (right) ? (*symbol[right->token].dcalc)(right,error) : NULL; /* right branch of new tree */ two = _unur_fstr_create_node(NULL,2.,s_uconst,NULL,NULL); /* const 2 */ sub_right = _unur_fstr_create_node("sec",0.,s_sec,NULL,right); br_right = _unur_fstr_create_node("^",0.,s_power,sub_right,two); /* subtree */ return _unur_fstr_create_node("*",0.,s_mul,d_right,br_right); } /* end of d_tan() */ /*---------------------------------------------------------------------------*/ struct ftreenode * d_sec (const struct ftreenode *node, int *error) /* (sec(r))' = r' * tan(r) * sec(r) */ /* */ /* "sec" '*' */ /* / \ ==> / \ */ /* NULL X X' '*' */ /* / \ */ /* "tan" "sec" */ /* / \ / \ */ /* NULL X NULL X */ { struct ftreenode *right; struct ftreenode *d_right; struct ftreenode *br_right, *sub_right, *dup_node; /* find symbols "tan" */ int s_tan = _unur_fstr_find_symbol("tan",_ans_start,_ans_end); /* check arguments */ CHECK_NULL(node,NULL); COOKIE_CHECK(node,CK_FSTR_TNODE,NULL); /* make a copy of the right branch of node */ right = _unur_fstr_dup_tree(node->right); /* derivative of right branch */ d_right = (right) ? (*symbol[right->token].dcalc)(right,error) : NULL; /* make a copy of the whole subtree at node */ dup_node = _unur_fstr_dup_tree(node); /* right branch of new tree */ sub_right = _unur_fstr_create_node("tan",0.,s_tan,NULL,right); br_right = _unur_fstr_create_node("*",0.,s_mul,sub_right,dup_node); /* subtree */ return _unur_fstr_create_node("*",0.,s_mul,d_right,br_right); } /* end of d_sec() */ /*---------------------------------------------------------------------------*/ struct ftreenode * d_sqrt (const struct ftreenode *node, int *error) /* (sqrt(r))' = r'/(2*sqrt(r)) */ /* */ /* "sqrt" '/' */ /* / \ ==> / \ */ /* NULL X X' '*' */ /* / \ */ /* 2. "sqrt" */ /* / \ */ /* NULL X */ { struct ftreenode *right; struct ftreenode *d_right; struct ftreenode *br_right; struct ftreenode *two, *dup_tree; /* check arguments */ CHECK_NULL(node,NULL); COOKIE_CHECK(node,CK_FSTR_TNODE,NULL); /* right node */ right = node->right; /* derivative of right branch */ d_right = (right) ? (*symbol[right->token].dcalc)(right,error) : NULL; /* make a copy of the whole subtree at node */ dup_tree = _unur_fstr_dup_tree(node); /* right branch of new tree */ two = _unur_fstr_create_node(NULL,2.,s_uconst,NULL,NULL); /* const 2 */ br_right = _unur_fstr_create_node("*",0.,s_mul,two,dup_tree); /* subtree */ return _unur_fstr_create_node("/",0.,s_div,d_right,br_right); } /* end of d_sqrt() */ /*---------------------------------------------------------------------------*/ struct ftreenode * d_abs (const struct ftreenode *node, int *error) /* (abs(r))' = r' * sgn(x) */ /* */ /* "abs" '*' */ /* / \ ==> / \ */ /* NULL X X' "sgn" */ /* / \ */ /* NULL X */ { struct ftreenode *right; struct ftreenode *d_right; struct ftreenode *br_right; /* find symbol "sgn" */ int s_sgn = _unur_fstr_find_symbol("sgn",_ans_start,_ans_end); /* check arguments */ CHECK_NULL(node,NULL); COOKIE_CHECK(node,CK_FSTR_TNODE,NULL); /* make a copy of the right branch of node */ right = _unur_fstr_dup_tree(node->right); /* derivative of right branch */ d_right = (right) ? (*symbol[right->token].dcalc)(right,error) : NULL; /* right branch of new tree */ br_right = _unur_fstr_create_node("sgn",0.,s_sgn,NULL,right); /* subtree */ return _unur_fstr_create_node("*",0.,s_mul,d_right,br_right); } /* end of d_abs() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Error messages **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ void _unur_fstr_error_deriv (const struct ftreenode *node, int line) /*----------------------------------------------------------------------*/ /* Print error message for unknown derivative */ /* */ /* parameters: */ /* node ... pointer to node of function tree */ /*----------------------------------------------------------------------*/ { struct unur_string *reason; /* check arguments */ CHECK_NULL(node,RETURN_VOID); COOKIE_CHECK(node,CK_FSTR_TNODE,RETURN_VOID); /* create string for reason of error */ reason = _unur_string_new(); _unur_string_append( reason, "cannot derivate subtree at '%s'", node->symbol); /* report error */ _unur_error_x( GENTYPE, __FILE__, line, "error", UNUR_ERR_FSTR_DERIV,reason->text); /* free working space */ _unur_string_free( reason ); #ifdef UNUR_ENABLE_LOGGING _unur_fstr_debug_tree(NULL,node); _unur_log_debug ("%s:\n",GENTYPE); #endif } /* end of _unur_fstr_error_deriv() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/parser/make_stringparser.pl0000754001357500135600000010011514430713333016176 00000000000000#!/usr/bin/perl ############################################################################## # # # UNURAN -- Universal Non-Uniform Random number generator # # # ############################################################################## # # # FILE: make_stringparser.pl # # # # Read all UNU.RAN header files and create switch tables for stringparser # # and write doc file for keywords # # # ############################################################################## # # # Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold # # Department of Statistics and Mathematics, WU Wien, Austria # # # # This program is free software; you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # # the Free Software Foundation; either version 2 of the License, or # # (at your option) any later version. # # # # This program is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with this program; if not, write to the # # Free Software Foundation, Inc., # # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA # # # ############################################################################## use strict; my $VERBOSE = 1; # ---------------------------------------------------------------------------- # # File: make_stringparser.pl # ############################################################################## sub usage { my $progname = $0; $progname =~ s#^.*/##g; print STDERR < Cfile Generates a stringparser. A template file is read from STDIN. It contains the auxilliary routines and the skeleton for the string interpreter. The routine reads all relevant information from the corresponding header files and inserts the different cases. The output is written on STDOUT. Additionally the list of all key words produced for the manual texi format. Notice: The keyword _orderstatistics_ is not treated automatically but entered manually into the template file and in this script! EOM exit; } ############################################################################## # Supported Distribution types # my %SUPPORTED_DISTR_TYPES = ( 'cont' => 1, 'cemp' => 1, 'discr' => 1, '-x-all-x-' => 1 # set calls unur_distr_set_... for all types ); # Unsupported types: # corder, cvec, cvemp, matr # Commands substituted by string parser my %SUBST_COMMANDS = ( 'unur_distr_cont_set_pdfstr' => 'pdf', 'unur_distr_cont_set_logpdfstr' => 'logpdf', 'unur_distr_cont_set_cdfstr' => 'cdf', 'unur_distr_cont_set_logcdfstr' => 'logcdf', 'unur_distr_cont_set_hrstr' => 'hr', 'unur_distr_discr_set_pmfstr' => 'pmf', 'unur_distr_discr_set_cdfstr' => 'cdf' , 'unur_distr_discr_set_logcdfstr' => 'logcdf' ); # Methods ignored by string parser my %IGNORED_METHODS = ( 'cext' => 1, 'dext' => 1, 'mixt' => 1, ); # Commands ignored by string parser my %IGNORED_COMMANDS = ( 'unur_distr_set_extobj' => 1, 'unur_distr_cont_set_pdf' => 1, 'unur_distr_cont_set_dpdf' => 1, 'unur_distr_cont_set_logpdf' => 1, 'unur_distr_cont_set_dlogpdf' => 1, 'unur_distr_cont_set_cdf' => 1, 'unur_distr_cont_set_logcdf' => 1, 'unur_distr_cont_set_hr' => 1, 'unur_distr_discr_set_pmf' => 1, 'unur_distr_discr_set_cdf' => 1, 'unur_distr_discr_set_logcdf' => 1, 'unur_mixt_set_useinversion' => 1, ); # distributions ignored by string parser # (We cannot handle this distributions yet. Thus we will ignore them # until we find some time to fix this.) my %IGNORED_DISTRIBUTIONS = ( 'multinormal' => 1, 'multicauchy' => 1, 'multiexponential' => 1, 'multistudent' => 1, 'copula' => 1, 'correlation' => 1 ); ############################################################################## # ---------------------------------------------------------------- # Directory with sources my $top_srcdir = $ENV{'srcdir'} ? $ENV{'srcdir'} : '.'; $top_srcdir .= "/../.."; # ---------------------------------------------------------------- # Load routines for reading data about PDF from UNU.RAN files require "$top_srcdir/scripts/read_PDF.pl"; # ---------------------------------------------------------------- # doc files to be generated my $doc_dir = $ENV{'srcdir'} ? $ENV{'srcdir'} : '.'; my $doc_file = "$doc_dir/stringparser_doc.dh"; my $distr_doc_string; my $method_doc_string; ############################################################################## # Get all header files in methods directory # my $methods_dir = "$top_srcdir/src/methods"; opendir (METHDIR, "$methods_dir") or die "can't open directory $methods_dir"; my @methods_h_files = grep {/[^\#].*[.]h$/ } readdir METHDIR; closedir METHDIR; ############################################################################## # Get all header files in distr directory # my $distr_dir = "$top_srcdir/src/distr"; opendir (DISTRDIR, "$distr_dir") or die "can't open directory $distr_dir"; my @distr_h_files = grep {/[^\#].*[.]h$/ } readdir DISTRDIR; closedir DISTRDIR; foreach my $h (@distr_h_files) { print STDERR "'$h' "; } print STDERR "\n"; ############################################################################## # Global variables # Store unsupported, substituted and ignored set calls for output on screen my $msg_unsupported; my $msg_substituted; my $msg_ignored; my $msg_ignored_methods; ############################################################################## # Read template C file from STDIN and insert C code for string interpreter # while ( ){ unless (/^s*=INPUT\s*(\w*)/){ print $_; } else { my $type = $1; # INPUT type if ( $type eq "list_of_distributions" ){ print make_list_of_distributions(); } elsif ( $type eq "list_of_distr_sets" ){ print make_list_of_distr_sets(); } elsif ( $type eq "list_of_methods" ){ print make_list_of_methods(); } elsif ( $type eq "list_of_par_sets" ){ print make_list_of_par_sets(); } else{ die "Error: unknown qualifier after =INPUT: $type\n"; } } } if ($msg_substituted) { print STDERR "Substituted set commands:\n"; print STDERR "$msg_substituted\n"; } if ($msg_ignored) { print STDERR "Ignored set commands:\n"; print STDERR "$msg_ignored\n"; } if ($msg_ignored_methods) { print STDERR "Ignored methods:\n"; print STDERR "$msg_ignored_methods\n"; } if ($msg_unsupported) { print STDERR "Unsupported set commands:\n"; print STDERR "$msg_unsupported\n"; } # Print documentation. open DOC, ">$doc_file" or die "Cannot open file $doc_file for writing"; print DOC "/*\n", "=NODE KeysDistr Keys for Distribution String\n", "=UP StringDistr [10]\n\n", "=DESCRIPTION\n\n", $distr_doc_string, "\n=EON\n*/\n"; print DOC "/*\n", "=NODE KeysMethod Keys for Method String\n", "=UP StringMethod [10]\n\n", "=DESCRIPTION\n\n", $method_doc_string, "\n=EON\n*/\n"; close DOC; ############################################################################## # # The end # exit (0); ############################################################################## ############################################################################## # # # Subroutines # # # ############################################################################## ############################################################################## # # Make subroutine for getting parameter object for method # sub make_list_of_distributions { my $code; # List of distributions # For description of data fields in this list see file `read_PDF.pl'. my $DISTR = read_PDFdata( $top_srcdir ); # print info on screen print STDERR "\nDistributions:\n" if $VERBOSE; # print docu $distr_doc_string .= "List of standard distributions " ."\@pxref{Stddist,,Standard distributions}\n\n"; $distr_doc_string .= "\@itemize \@minus\n"; # make switch for first letter of distribution name $code .= "\t switch (*distribution) {\n"; my $last_char; # Make list of all distributions sub caseinsensitive { ("\L$a" cmp "\L$b") }; foreach my $distr (sort caseinsensitive keys %{$DISTR}) { # check whether command should be ignored if ($IGNORED_DISTRIBUTIONS{$distr}) { # ignore this distribution $msg_ignored .= " unur_distr_$distr()\n"; next; } print STDERR $distr," "; my $char = lc substr $distr,0,1; if ($char ne $last_char) { $code .= "\t\t break;\n" if $last_char; $code .= "\t case '$char':\n"; $last_char = $char; } # print code $code .= "\t\t if ( !strcmp( distribution, \"\L$distr\") ) {\n"; $code .= "\t\t\t distr = unur_distr_$distr (darray,n_darray);\n"; $code .= "\t\t\t break;\n"; $code .= "\t\t }\n"; # print docu $distr_doc_string .= "\@item \@code{[distr =] $distr(\@dots{})} \@ \@ \@ \@ " ." \@result{} \@pxref{$distr}\n"; } # end of switch for first letter $code .= "\t }\n\n"; # print docu $distr_doc_string .= "\@end itemize\n\n"; print STDERR "\n\n"; # Make list of generic distribution objects print STDERR "Generic distributions:\n"; # print docu $distr_doc_string .= "List of generic distributions " ."\@pxref{Distribution_objects,,Handling Distribution Objects}\n\n"; $distr_doc_string .= "\@itemize \@minus\n"; $code .= "\t /* get pointer to generic distribution object */\n"; $code .= "\t if (distr == (struct unur_distr *) &distr_unknown) { \n"; $code .= "\t\t do {\n"; foreach my $hfile (sort @distr_h_files) { # Read content of header file open H, "< $distr_dir/$hfile" or die ("can't open file: $distr_dir/$hfile"); my $content = ''; while () { $content .= $_; } close H; # there must be a unur_distr_...._new call next unless $content =~ /[^\n]\s*unur\_distr\_(\w+)\_new/; # ID for method my $distr_type = "\L$1"; # not all generic distributions are supported yet next unless $SUPPORTED_DISTR_TYPES{$distr_type}; # make code print STDERR " \U$distr_type" if $VERBOSE; $code .= "\t\t\t if ( !strcmp( distribution, \"$distr_type\") ) {\n"; $code .= "\t\t\t\t distr = unur\_distr\_$distr_type\_new();\n"; $code .= "\t\t\t\t break;\n"; $code .= "\t\t\t }\n"; # print docu $distr_doc_string .= "\@item \@code{[distr =] $distr_type} \@ \@ \@ \@ " ." \@result{} \@pxref{\U$distr_type}\n"; } $code .= "\t\t } while (0);\n"; $code .= "\t }\n\n"; # print docu $distr_doc_string .= "\@end itemize\n\n"; # add comment for order statistics ... $distr_doc_string .= comment_for_corder(); # end print STDERR "\n\n"; # Return result return $code; } # end of make_list_of_distributions() ############################################################################## # # Make subroutine for setting parameters in distribution objects # sub make_list_of_distr_sets { my $set_commands; my $set_doc; my $code_unsupported; my $code_substituted; my $code_ignored; my $code; # print info on screen print STDERR "Set commands for Distributions:\n" if $VERBOSE; # Read all header files foreach my $hfile (sort @distr_h_files) { # Read content of header file open H, "< $distr_dir/$hfile" or die ("can't open file: $distr_dir/$hfile"); my $content = ''; while () { $content .= $_; } close H; # there must be a unur_distr_..._set call next unless $content =~ /[^\n]\s*unur\_distr\_.*\_set\_/; # distribution type my $distr_type; if ($content =~ /[^\n]\s*unur\_distr\_(\w+)\_new/) { # set calls for special distribution type $distr_type = "\L$1"; } else { # set calls for all distribution types $distr_type = "-x-all-x-"; } # not all generic distributions are supported yet next unless $SUPPORTED_DISTR_TYPES{$distr_type}; print STDERR " \U$distr_type: " if $VERBOSE; # remove obsolete functions $content =~ s {/\*\s*=OBSOLETE.*$} []gsx; # Remove all comments and empty lines ... $content =~ s {/\*.*?\*/} []gsx; $content =~ s /\n\s*\n/\n/gsx; # Split into lines ... my @lines = split /\n/, $content; # Get all set calls foreach my $l (@lines) { next unless $l =~ /^\s*(\w*\s+)unur\_distr\_($distr_type\_)?set_(\w+)\s*\((.+)([^\s])\s*$/; # short name of set command my $command = $3; # full name of command my $command_name = "unur\_distr\_".$2."set_$command"; # list of arguments my $args = $4; # Check syntax of set command if ( $5 ne ';' ) { # last character must be a ';' die "Unknown syntax (terminating ';' missing) in $hfile:\n$l\n"; } if ( $1 !~ /^int\s+$/ ) { # type must be 'int' die "Unknown syntax (function type) in $hfile:\n$l\n"; } if ( unmatched_parenthesis($l) ) { # parenthesis must match die "Unknown syntax (umatched parenthesis) in $hfile:\n$l\n"; } # print name of parameter print STDERR "$command " if $VERBOSE; # process list of args $args =~ s/\)\s*$//; # remove closing parenthesis my @args_list = split /\,/, $args; # first argument must be of type UNUR_DISTR my $a = shift @args_list; unless ($a =~ /UNUR_DISTR/) { die "Unknown syntax (first argument not of type UNUR_DISTR) in $hfile:\n$l\n"; } # number of arguments my $n_args = $#args_list+1; # get type of arguments my $type_args = ""; foreach my $a (@args_list) { my $t; # type of argument if ($a =~ /double/) { $t = 'd'; } elsif ($a =~ /int/) { $t = 'i'; } elsif ($a =~ /unsigned/) { $t = 'u'; } elsif ($a =~ /char/) { $t = 'c'; } else { $t = '?'; } # arrays are indicated by capital letters if ($a =~ /\*/ or $a =~ /\[/) { # this is interprated as list $t = "\U$t"; } $type_args .= $t; } # check whether command should be ignored if ($IGNORED_COMMANDS{$command_name}) { # ignore this set command $code_ignored .= "\t /* $l\n\t\t n = $n_args; type = $type_args\t */\n"; $msg_ignored .= " $command_name()\n"; next; } # make set calls my $set; my $doc; # beginning of case $set = "\t\t\t\t /* n = $n_args; type = $type_args: $args*/\n"; # use keyword "void" when no argument is required $type_args = "void" if $type_args eq ""; # we support the following cases: # "i" ... one argument of type int required # "ii" ... two arguments of type int required # "d" ... one argument of type double required # "dd" ... two arguments of type double required # "Di" ... a list of doubles and one argument of type int required # (the second argument is considered as size of the double array) # "C" ... one string (array of char) my %type_args_doc = ( 'i' => '[= @i{}]', 'ii' => '= @i{}, @i{} | (@i{})', 'd' => '= @i{}', 'dd' => '= @i{}, @i{} | (@i{})', 'Di' => '= (@i{}) [, @i{}]', 'C' => '= "@i{}"' ); if ($type_args =~ /^(i|ii|d|dd|Di|C)$/) { my $type = $1; $set .= "\t\t\t\t result = _unur_str_distr_set_$type(distr,key,type_args,args,$command_name);\n"; unless ($set_commands->{$distr_type}->{$command}) { $set_commands->{$distr_type}->{$command} = $set; } else { die "\nset command redefined: $distr_type/$command"; } # check whether command should also have substitute if ($SUBST_COMMANDS{$command_name}) { my $command_subst = $SUBST_COMMANDS{$command_name}; $msg_substituted .= " $command_name() --> $SUBST_COMMANDS{$command_name}\n"; $code_substituted .= "\t /* $l\n\t\t n = $n_args; type = $type_args\t */\n"; unless ($set_commands->{$distr_type}->{$command_subst}) { $set_commands->{$distr_type}->{$command_subst} = $set; } else { die "\nset command redefined: $distr_type/$command_subst"; } } # make docu if ($SUBST_COMMANDS{$command_name}) { $command = $SUBST_COMMANDS{$command_name}; } $set_doc->{$distr_type}->{$command} = "\@item $command $type_args_doc{$type_args}\n \@result{} " ."\@pxref{funct:$command_name,,\@command{$command_name}}\n"; } else { # cannot handle this set command $code_unsupported .= "\t/* $l\n\t\t n = $n_args; type = $type_args\t */\n"; $msg_unsupported .= " $command_name()\n"; } } # end of distribution type print STDERR "\n" if $VERBOSE; } # print info on screen print STDERR "\n" if $VERBOSE; # get list of all distribution types my @distr_type_list = sort (keys %{$set_commands}); # print docu $distr_doc_string .= "List of keys that are available via the String API.\n" ."For description see the corresponding UNU.RAN set calls.\n\n"; $distr_doc_string .= "\@itemize \@bullet\n"; # first distribution type MUST be -x-all-x- my $dt = shift @distr_type_list; unless ($dt eq "-x-all-x-") { die "first distribution type MUST be '-x-all-x-'\n"; } # List of set calls for all distribution types $distr_doc_string .= "\@item All distribution types\n"; my $code_x_all_x_ = make_distr_set_calls($dt,$set_commands,$set_doc); # List of set calls for distribution types # switch for distribution types $code .= "\n\t switch (distr->type) {\n"; foreach $dt (@distr_type_list) { # print docu $distr_doc_string .= "\@item \@code{$dt} \@ \@i{(Distribution Type)}\@ \@ \@ \@ " ."(\@pxref{\U$dt})\n"; # make label for distribution type $code .= "\t case UNUR_DISTR_\U$dt:\n"; # make list of all set commands for distribution type $code .= make_distr_set_calls($dt,$set_commands,$set_doc); # end of case for distribution type $code .= "\t\t break;\n"; } # end of switch for distribution types $code .= "\t }\n"; # append list for set calls for all distribution types $code .= "\n\t /* set calls for all distribution types */\n"; $code .= "\t if (result == UNUR_ERR_STR_UNKNOWN) {\n"; $code .= $code_x_all_x_; $code .= "\t }\n\n"; # print docu $distr_doc_string .= "\@end itemize\n\n"; # add comment on igored and unsupported code into C file if ($code_ignored) { $code .= "\n\t /* Ignored set commands: */\n $code_ignored\n"; } if ($code_substituted) { $code .= "\n\t /* Subsituted set commands: */\n $code_substituted\n"; } if ($code_unsupported) { $code .= "\n\t /* Unsupported set commands: */\n $code_unsupported\n"; } # Return result return $code; } # end of make_list_of_distr_sets() ############################################################################## # # Make subroutine for getting parameter object for method. # Print set command. # sub make_distr_set_calls { my $dt = $_[0]; my $set_commands = $_[1]; my $set_doc = $_[2]; my $code; # make list of set commands for distributions my @command_list = sort (keys %{$set_commands->{$dt}}); # make switch for first letter of key name $code .= "\t\t switch (*key) {\n"; # print docu $distr_doc_string .= "\@table \@code\n"; my $last_char; foreach my $c (@command_list) { my $char = substr $c,0,1; if ($char ne $last_char) { $code .= "\t\t\t break;\n" if $last_char; $code .= "\t\t case '$char':\n"; $last_char = $char; } $code .= "\t\t\t if ( !strcmp(key, \"$c\") ) {\n"; $code .= $set_commands->{$dt}->{$c}; $code .= "\t\t\t\t break;\n"; $code .= "\t\t\t }\n"; # print docu $distr_doc_string .= $set_doc->{$dt}->{$c}; } # end of switch for first letter $code .= "\t\t }\n"; # add comment about order statistics if ($dt eq "cont") { $distr_doc_string .= comment_for_orderstatistics(); } # end of table $distr_doc_string .= "\@end table\n\n"; # Return result return $code; } # end of make_distr_set_calls() ############################################################################## # # Make subroutine for getting parameter object for method # sub make_list_of_methods { my $code; # Get list of all methods my @method_list; # Read all header files foreach my $hfile (sort @methods_h_files) { # Read content of header file open H, "< $methods_dir/$hfile" or die ("can't open file: $methods_dir/$hfile"); my $content = ''; while () { $content .= $_; } close H; # We skip over all header files that do not correspond # to a method. next unless $content =~ /[^\n]\s*=METHOD\s+(\w+)/; # save ID for method push @method_list, "\L$1"; } # sort list of methods @method_list = sort @method_list; # make code # make switch for first letter of method name $code .= "\t switch (*method) {\n"; my $last_char; foreach my $method (@method_list) { # check whether method should be ignored if ($IGNORED_METHODS{$method}) { # ignore this method $msg_ignored_methods .= " unur_$method\_new()\n"; next; } my $char = substr $method,0,1; if ($char ne $last_char) { $code .= "\t\t break;\n" if $last_char; $code .= "\t case '$char':\n"; $last_char = $char; } # print code $code .= "\t\t if ( !strcmp( method, \"$method\") ) {\n"; $code .= "\t\t\t par = unur_$method\_new(distr);\n"; $code .= "\t\t\t break;\n"; $code .= "\t\t }\n"; } # end of switch for first letter $code .= "\t }\n"; # Return result return $code; } # end of make_list_of_methods() ############################################################################## # # Make subroutine for setting parameters in parameter objects # sub make_list_of_par_sets { my $set_commands; my $set_doc; my $code_unsupported; my $code_substituted; my $code_ignored; my $code; # print info on screen print STDERR "Set commands for Methods:\n" if $VERBOSE; # Read all header files foreach my $hfile (sort @methods_h_files) { # Read content of header file open H, "< $methods_dir/$hfile" or die ("can't open file: $methods_dir/$hfile"); my $content = ''; while () { $content .= $_; } close H; # We skip over all header files that do not correspond # to a method. next unless $content =~ /[^\n]\s*=METHOD\s+(\w+)/; # ID for method print STDERR " $1: " if $VERBOSE; my $method = "\L$1"; # remove obsolete functions $content =~ s {/\*\s*=OBSOLETE.*$} []gsx; # Remove all comments and empty lines ... $content =~ s {/\*.*?\*/} []gsx; $content =~ s /\n\s*\n/\n/gsx; # Split into lines ... my @lines = split /\n/, $content; # Get all set calls foreach my $l (@lines) { next unless $l =~ /^\s*(\w*\s+)unur_$method\_set_(\w+)\s*\((.+)([^\s])\s*$/; # short name of set command my $command = $2; # full name of command my $command_name = "unur\_$method\_set_$command"; # list of arguments my $args = $3; # Check syntax of set command if ( $4 ne ';' ) { # last character must be a ';' die "Unknown syntax (terminating ';' missing) in $hfile:\n$l\n"; } if ( $1 !~ /^int\s+$/ ) { # type must be 'int' die "Unknown syntax (function type) in $hfile:\n$l\n"; } if ( unmatched_parenthesis($l) ) { # parenthesis must match die "Unknown syntax (umatched parenthesis) in $hfile:\n$l\n"; } # print name of parameter print STDERR "$command " if $VERBOSE; # process list of args $args =~ s/\)\s*$//; # remove closing parenthesis my @args_list = split /\,/, $args; # first argument must be of type UNUR_PAR my $a = shift @args_list; unless ($a =~ /UNUR_PAR/) { die "Unknown syntax (first argument not of type UNUR_PAR) in $hfile:\n$l\n"; } # number of arguments my $n_args = $#args_list+1; # get type of arguments my $type_args = ""; foreach my $a (@args_list) { my $t; # type of argument if ($a =~ /double/) { $t = 'd'; } elsif ($a =~ /int/) { $t = 'i'; } elsif ($a =~ /unsigned/) { $t = 'u'; } elsif ($a =~ /char/) { $t = 'c'; } else { $t = '?'; } # arrays are indicated by capital letters if ($a =~ /\*/ or $a =~ /\[/) { # this is interprated as list $t = "\U$t"; } $type_args .= $t; } # check whether command should be ignored if ($IGNORED_COMMANDS{$command_name}) { # ignore this set command $code_ignored .= "\t /* $l\n\t\t n = $n_args; type = $type_args\t */\n"; $msg_ignored .= " $command_name()\n"; next; } # check whether method should be ignored for my $m (keys %IGNORED_METHODS) { if ($command_name =~ /^unur_$m/) { # ignore this method $msg_ignored .= " $command_name()\n"; next; } } # make set calls my $set; # beginning of case $set = "\t\t\t\t /* n = $n_args; type = $type_args: $args*/\n"; # use keyword "void" when no argument is required $type_args = "void" if $type_args eq ""; # we support the following cases: # void ... no argument required # "i" ... one argument of type int required # "ii" ... two arguments of type int required # "u" ... one argument of type unsigned required # "d" ... one argument of type double required # "dd" ... two arguments of type double required # "iD" ... one argument of type int and a list of doubles required # (the first argument is considered as size of the double array) # "Di" ... a list of doubles and one argument of type int required my %type_args_doc = ( 'void' => ' ', 'i' => '[= @i{}]', 'ii' => '= @i{}, @i{} | (@i{})', 'u' => '= @i{}', 'd' => '= @i{}', 'dd' => '= @i{}, @i{} | (@i{})', 'iD' => '= @i{} [, (@i{})] | (@i{})', 'Di' => '= (@i{}), @i{}' ); if ($type_args =~ /^(void|i|ii|u|d|dd|iD|Di)$/) { my $type = $1; if ($type_args =~ /^(iD|Di)$/) { $set .= "\t\t\t\t result = _unur_str_par_set_$type(par,key,type_args,args,$command_name,mlist);\n"; } else { $set .= "\t\t\t\t result = _unur_str_par_set_$type(par,key,type_args,args,$command_name);\n"; } unless ($set_commands->{$method}->{$command}) { $set_commands->{$method}->{$command} = $set; } else { die "\nset command redefined: $method/$command"; } # check whether command should also have substitute if ($SUBST_COMMANDS{$command_name}) { my $command_subst = $SUBST_COMMANDS{$command_name}; $msg_substituted .= " $command_name() --> $SUBST_COMMANDS{$command_name}\n"; $code_substituted .= "\t /* $l\n\t\t n = $n_args; type = $type_args\t */\n"; unless ($set_commands->{$method}->{$command_subst}) { $set_commands->{$method}->{$command_subst} = $set; } else { die "\nset command redefined: $method/$command_subst"; } } # make docu if ($SUBST_COMMANDS{$command_name}) { $command = $SUBST_COMMANDS{$command_name}; } $set_doc->{$method}->{$command} = "\@item $command $type_args_doc{$type_args}\n \@result{} " ."\@pxref{funct:$command_name,,\@command{$command_name}}\n"; } else { # cannot handle this set command $code_unsupported .= "\t /* $l\n\t\t n = $n_args; type = $type_args\t */\n"; $msg_unsupported .= " $command_name()\n"; } } # end of method print STDERR "\n" if $VERBOSE; } # print info on screen print STDERR "\n" if $VERBOSE; # get list of all methods my @method_list = sort (keys %{$set_commands}); # make switch for methods $code .= "\t switch (par->method) {\n"; # print docu $method_doc_string .= "List of methods and keys that are available via the String API.\n" ."For description see the corresponding UNU.RAN set calls.\n\n"; $method_doc_string .= "\@itemize \@bullet\n"; foreach my $m (@method_list) { # print docu $method_doc_string .= "\@item \@code{method = $m} \@ \@ \@ \@ " ." \@result{} \@command{unur\_$m\_new}\n" ."(\@pxref{\U$m})\n"; # make list of set commands for method my @command_list = sort (keys %{$set_commands->{$m}}); # make label for method $code .= "\t case UNUR_METH_\U$m:\n"; # make switch for first letter of key name $code .= "\t\t switch (*key) {\n"; # print docu $method_doc_string .= "\@table \@code\n"; my $last_char; foreach my $c (@command_list) { my $char = substr $c,0,1; if ($char ne $last_char) { $code .= "\t\t\t break;\n" if $last_char; $code .= "\t\t case '$char':\n"; $last_char = $char; } $code .= "\t\t\t if ( !strcmp(key, \"$c\") ) {\n"; $code .= $set_commands->{$m}->{$c}; $code .= "\t\t\t\t break;\n"; $code .= "\t\t\t }\n"; # print docu $method_doc_string .= $set_doc->{$m}->{$c}; # $method_doc_string .= "\@item $c\n \@result{} " # ."\@pxref{funct:unur\_$m\_set\_$c,,\@command{unur\_$m\_set\_$c}}\n"; } # end of switch for first letter $code .= "\t\t }\n"; $code .= "\t\t break;\n"; # print docu $method_doc_string .= "\@end table\n\n"; } # end of switch for methods $code .= "\t }\n"; # print docu $method_doc_string .= "\@end itemize\n\n"; # add comment on igored and unsupported code into C file if ($code_ignored) { $code .= "\n\t /* Ignored set commands: */\n $code_ignored\n"; } if ($code_substituted) { $code .= "\n\t /* Subsituted set commands: */\n $code_substituted\n"; } if ($code_unsupported) { $code .= "\n\t /* Unsupported set commands: */\n $code_unsupported\n"; } # Return result return $code; } # end of make_list_of_par_sets() ############################################################################## # # Simple test for unmatched parenthesis. # It returns the number of opening parenthesis `(' minus the number # of closing parenthesis `)' in argument $_. # sub unmatched_parenthesis { my $open = 0; # number of unmatched `(' ++$open while /\(/g; --$open while /\)/g; return $open; } # end of unmachted_parenthesis() ############################################################################## # # Some auxiliary comments. # sub comment_for_corder { return <}, \@i{} | (\@i{}) Make order statistics for given distribution. The first parameter gives the sample size, the second parameter its rank. (see \@pxref{funct:unur_distr_corder_new,,\@command{unur_distr_corder_new}}) EOS } # end if comment_for_orderstatistics() ############################################################################## unuran-1.11.0/src/parser/functparser_init.ch0000644001357500135600000002446014420445767016036 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: functparser_init.c * * * * Init and destroy function tree. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** API **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ struct ftreenode * _unur_fstr2tree (const char *functstr) /*----------------------------------------------------------------------*/ /* Compute funtion tree from string. */ /* */ /* parameters: */ /* functstr ... string containing function definition */ /* */ /* return: */ /* pointer to root of function tree */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { return _unur_fstr_2_tree( functstr, FALSE ); } /* end of _unur_fstr2tree() */ /*---------------------------------------------------------------------------*/ struct ftreenode * _unur_fstr2tree_DefFunct (const char *functstr) /*----------------------------------------------------------------------*/ /* Compute funtion tree from string. */ /* (Same as _unur_fstr2tree() but string must start with "f(x)=". */ /* */ /* parameters: */ /* functstr ... string containing function definition */ /* */ /* return: */ /* pointer to root of function tree (function term only!) */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { return _unur_fstr_2_tree( functstr, TRUE ); } /* end of _unur_fstr2tree_DefFunct() */ /*---------------------------------------------------------------------------*/ struct ftreenode * _unur_fstr_dup_tree (const struct ftreenode *root) /*----------------------------------------------------------------------*/ /* Duplicate function tree rooted at root */ /* */ /* parameters: */ /* root ... pointer to root of function tree */ /* */ /* return: */ /* pointer to duplicated tree */ /*----------------------------------------------------------------------*/ { struct ftreenode *dup; if (root==NULL) return NULL; /* check arguments */ COOKIE_CHECK(root,CK_FSTR_TNODE,NULL); dup = _unur_xmalloc(sizeof(struct ftreenode)); memcpy(dup,root,sizeof(struct ftreenode)); if (root->left) dup->left = _unur_fstr_dup_tree(root->left); if (root->right) dup->right = _unur_fstr_dup_tree(root->right); return dup; } /* end of _unur_fstr_dup_tree() */ /*---------------------------------------------------------------------------*/ void _unur_fstr_free (struct ftreenode *root) /*----------------------------------------------------------------------*/ /* Destroy function tree. */ /* */ /* parameters: */ /* root ... pointer to root of function tree */ /*----------------------------------------------------------------------*/ { if( root != NULL ) { /* check arguments */ COOKIE_CHECK(root,CK_FSTR_TNODE,RETURN_VOID); if (root->left) _unur_fstr_free(root->left); if (root->right) _unur_fstr_free(root->right); free(root); } } /* end of _unur_fstr_free() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Auxilliary routines **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ struct ftreenode * _unur_fstr_2_tree (const char *functstr, int withDefFunct) /*----------------------------------------------------------------------*/ /* Compute funtion tree from string. */ /* */ /* parameters: */ /* functstr ... string containing function definition */ /* withDefFunct ... whether string is assumed to start with "f(x)=" */ /* */ /* return: */ /* pointer to root of function tree */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct parser_data *pdata; struct ftreenode *root; /* check arguments */ _unur_check_NULL( GENTYPE,functstr,NULL ); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag) _unur_fstr_debug_input(functstr); #endif /* initialize parser */ pdata = _unur_fstr_parser_init(functstr); /* check for errors (eg. empty string) */ if (pdata == NULL) return NULL; /* tokenize function string */ _unur_fstr_tokenize(pdata); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (_unur_default_debugflag) _unur_fstr_debug_token(pdata); #endif /* exit in case of error */ if (pdata->perrno) { _unur_fstr_parser_free(pdata); return NULL; } /* parse list of token */ if (withDefFunct) { struct ftreenode *tmp = _unur_FunctDefinition(pdata); root = tmp->right; /* clear left subtree */ _unur_fstr_free(tmp->left); free(tmp); } else { root = _unur_Expression(pdata); } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if ((_unur_default_debugflag & UNUR_DEBUG_SETUP) && root) _unur_fstr_debug_tree(pdata,root); #endif /* check for possible errors */ if (pdata->tno < pdata->n_tokens && !pdata->perrno) _unur_fstr_error_parse(pdata,ERR_UNFINISHED,__LINE__); if (pdata->perrno) { _unur_fstr_parser_free(pdata); _unur_fstr_free(root); return NULL; } /* free working space */ _unur_fstr_parser_free(pdata); /* return pointer to function tree */ return root; } /* end of _unur_fstr_2_tree() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/specfunct/0000755001357500135600000000000014430713512012676 500000000000000unuran-1.11.0/src/specfunct/cephes_source.h0000644001357500135600000001177514420445767015646 00000000000000/* This file was considerably changed for UNU.RAN. As a consequence it has been renamed from "mconf.h" to "cephes_source.h" to avoid confusion. We were only interested in the files: gamma.c igamma.c incbet.c ndtr.c ndtri.c to use these files we needed the auxiliary files: isnan.c mtherr.c polevl.c The aim was to enhance portability for ANSI C without expert knowledge of the floating point unit. The main changes are numeric constants (in cephes - const.c) are replaced by macros defined in this file (source_mconf.h). We changed these constants using the constants provided by ANSI C in the math.h file. We changed also the definitions of MAXGAM (in incbet.c) and of MAXSTIR (in gamma.c). Everything concerning NANS and INFINITY was moved into isnan.c. (Also the defines to turn it off or on.) We have only tested this version with NAN and INFINITY turned off, but we have not changed anything concerning that question. So turning this support on should (could) work. March 26th, 2001, Josef Leydold and Wolfgang Hoermann. */ /*---------------------------------------------------------------------------*/ /* mconf.h * * Common include file for math routines * * * * SYNOPSIS: * * #include "mconf.h" * * * * DESCRIPTION: * * This file contains definitions for error codes that are * passed to the common error handling routine mtherr() * (which see). * * The file also includes a conditional assembly definition * for the type of computer arithmetic (IEEE, DEC, Motorola * IEEE, or UNKnown). * * For Digital Equipment PDP-11 and VAX computers, certain * IBM systems, and others that use numbers with a 56-bit * significand, the symbol DEC should be defined. In this * mode, most floating point constants are given as arrays * of octal integers to eliminate decimal to binary conversion * errors that might be introduced by the compiler. * * For little-endian computers, such as IBM PC, that follow the * IEEE Standard for Binary Floating Point Arithmetic (ANSI/IEEE * Std 754-1985), the symbol IBMPC should be defined. These * numbers have 53-bit significands. In this mode, constants * are provided as arrays of hexadecimal 16 bit integers. * * Big-endian IEEE format is denoted MIEEE. On some RISC * systems such as Sun SPARC, double precision constants * must be stored on 8-byte address boundaries. Since integer * arrays may be aligned differently, the MIEEE configuration * may fail on such machines. * * To accommodate other types of computer arithmetic, all * constants are also provided in a normal decimal radix * which one can hope are correctly converted to a suitable * format by the available C language compiler. To invoke * this mode, define the symbol UNK. * * An important difference among these modes is a predefined * set of machine arithmetic constants for each. The numbers * MACHEP (the machine roundoff error), MAXNUM (largest number * represented), and several other parameters are preset by * the configuration symbol. Check the file const.c to * ensure that these values are correct for your computer. * * Configurations NANS, INFINITIES, MINUSZERO, and DENORMAL * may fail on many systems. Verify that they are supposed * to work on your computer. */ /* Cephes Math Library Release 2.3: June, 1995 Copyright 1984, 1987, 1989, 1995 by Stephen L. Moshier */ /*---------------------------------------------------------------------------*/ /* Include constants used in UNU.RAN. */ #include /*---------------------------------------------------------------------------*/ /* Define mathematical constants (see x_math_source.h). */ #define PI M_PI /* Pi */ #define SQRTH M_SQRTH /* sqrt(1/2) */ /*---------------------------------------------------------------------------*/ /* Define constant for floating point arithmetic. */ #define MAXNUM DBL_MAX /* largest number represented */ /*---------------------------------------------------------------------------*/ /* Prototypes for functions from Cephes library */ /* gamma.c */ double _unur_cephes_gamma( double x ); double _unur_cephes_lgam( double x ); /* igam.c */ double _unur_cephes_igamc( double a, double x ); double _unur_cephes_igam( double a, double x ); /* incbet.c */ double _unur_cephes_incbet( double aa, double bb, double xx ); /* ndtr.c */ double _unur_cephes_ndtr( double a ); double _unur_cephes_erfc( double a ); double _unur_cephes_erf( double x ); /* ndtri.c */ double _unur_cephes_ndtri( double yval ); /* polevl.c */ double _unur_cephes_polevl( double x, double coef[], int N ); double _unur_cephes_p1evl( double x, double coef[], int N ); /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/specfunct/log1p.c0000644001357500135600000000225714420445767014027 00000000000000/* _unur_log1p * * Compute log(1+x) * * Replacement for missing C99 function log1p * * Copied and renamed from gsl_log1p into _unur_log1p * by Josef Leydold, Wed Jun 29 16:39:10 CEST 2005 */ /* sys/log1p.c * * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman, Brian Gough * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #if !HAVE_DECL_LOG1P double _unur_log1p (double x) { volatile double y; y = 1 + x; return log(y) - ((y-1)-x)/y ; /* cancels errors with IEEE arithmetic */ } #endif unuran-1.11.0/src/specfunct/unur_specfunct_source.h0000644001357500135600000002525514420445767017440 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: unur_specfunct_source.h * * * * PURPOSE: * * prototypes and macros for using special functions like erf(), * * gamma(), beta(), etc., which are imported from other packages. * * * ***************************************************************************** * * * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifndef UNUR_SPECFUNCT_SOURCE_H_SEEN #define UNUR_SPECFUNCT_SOURCE_H_SEEN /*---------------------------------------------------------------------------*/ /***************************************************************************** * * * Prototypes for special functions like erf(), gamma(), beta(), etc. * * which are imported from other packages. * * * * We use the package CEPHES/DOUBLE for computing these functions * * (available from NETLIB, http://www.netlib.org/cephes/ * * Copyright 1984 - 1994 by Stephen L. Moshier * * * * Alternatively, we also can use the functions from the Rmath library * * from the R project for statistical computing, http://www.R-project.org/ * * * *****************************************************************************/ /* We define macros for special functions. * * The following macros must be defined: * * _unur_SF_incomplete_beta ... incomplete beta integral * _unur_SF_ln_gamma ... logarithm of gamma function * _unur_SF_ln_factorial ... logarithm of factorial * _unur_SF_incomplete_gamma ... incomplete gamma function * _unur_SF_cdf_normal ... CDF of normal distribution * _unur_SF_invcdf_normal ... inverse CDF of normal distribution * * Additional functions: * * _unur_SF_bessel_k ... modified Bessel function K_nu of second kind * _unur_SF_ln_bessel_k ... logarithm of K_n * *---------------------------------------------------------------------------*/ #ifdef HAVE_LIBRMATH /*---------------------------------------------------------------------------*/ /* Routines from the Rmath library (R project). */ /*---------------------------------------------------------------------------*/ /* we have to distinguish between two cases: */ # ifdef R_UNURAN /* Rmath for 'Runuran': nothing special to do. */ # else /* Rmath standalone library. */ # define MATHLIB_STANDALONE # endif /* include Rmath header file */ # include /* we have to #undef some macros from Rmath.h */ #ifdef trunc #undef trunc #endif #ifdef beta #undef beta #endif /* ......................................................................... */ /* incomplete beta integral */ #define _unur_SF_incomplete_beta(x,a,b) pbeta((x),(a),(b),TRUE,FALSE) /* logarithm of gamma function */ #define _unur_SF_ln_gamma(x) lgammafn(x) /* logarithm of factorial */ #define _unur_SF_ln_factorial(x) lgammafn((x)+1.) /* incomplete gamma function */ #define _unur_SF_incomplete_gamma(x,a) pgamma(x,a,1.,TRUE,FALSE) /* modified Bessel function K_nu of second kind (AKA third kind) */ #define _unur_SF_bessel_k(x,nu) bessel_k((x),(nu),1) /* logarithm of modified Bessel function K_nu of second kind (AKA third kind)*/ #define _unur_SF_ln_bessel_k(x,nu) (log(bessel_k((x),(nu),2)) - (x)) /* Normal distribution */ #define _unur_SF_cdf_normal(x) pnorm((x),0.,1.,TRUE,FALSE) #define _unur_SF_invcdf_normal(u) qnorm((u),0.,1.,TRUE,FALSE) /* ..........................................................................*/ /* Beta Distribution */ #define _unur_SF_invcdf_beta(u,p,q) qbeta((u),(p),(q),TRUE,FALSE) /* F Distribution */ #define _unur_SF_cdf_F(x,nua,nub) pf((x),(nua),(nub),TRUE,FALSE) #define _unur_SF_invcdf_F(u,nua,nub) qf((u),(nua),(nub),TRUE,FALSE) /* Gamma Distribution */ #define _unur_SF_invcdf_gamma(u,shape,scale) qgamma((u),(shape),(scale),TRUE,FALSE) /* Student t Distribution */ #define _unur_SF_cdf_student(x,nu) pt((x),(nu),TRUE,FALSE) #define _unur_SF_invcdf_student(u,nu) qt((u),(nu),TRUE,FALSE) /* Binomial Distribution */ #define _unur_SF_invcdf_binomial(u,n,p) qbinom((u),(n),(p),TRUE,FALSE) /* Hypergeometric Distribution */ #define _unur_SF_cdf_hypergeometric(x,N,M,n) phyper((x),(M),(N)-(M),(n),TRUE,FALSE) #define _unur_SF_invcdf_hypergeometric(u,N,M,n) qhyper((u),(M),(N)-(M),(n),TRUE,FALSE) /* Negative Binomial Distribution */ #define _unur_SF_cdf_negativebinomial(x,n,p) pnbinom((x),(n),(p),TRUE,FALSE) #define _unur_SF_invcdf_negativebinomial(u,n,p) qnbinom((u),(n),(p),TRUE,FALSE) /* Poisson Distribution */ #define _unur_SF_invcdf_poisson(u,theta) qpois((u),(theta),TRUE,FALSE) /*---------------------------------------------------------------------------*/ /* end: Rmath library (R project) */ /*---------------------------------------------------------------------------*/ #else /*---------------------------------------------------------------------------*/ /* Routines from the CEPHES library. */ /*---------------------------------------------------------------------------*/ #define COMPILE_CEPHES /* incomplete beta integral */ double _unur_cephes_incbet(double a, double b, double x); #define _unur_SF_incomplete_beta(x,a,b) _unur_cephes_incbet((a),(b),(x)) /* logarithm of gamma function */ double _unur_cephes_lgam(double x); #define _unur_SF_ln_gamma(x) _unur_cephes_lgam(x) /* logarithm of factorial */ #define _unur_SF_ln_factorial(x) _unur_cephes_lgam((x)+1.) /* incomplete gamma function */ double _unur_cephes_igam(double a, double x); #define _unur_SF_incomplete_gamma(x,a) _unur_cephes_igam((a),(x)) /* normal distribution function */ double _unur_cephes_ndtr(double x); #define _unur_SF_cdf_normal(x) _unur_cephes_ndtr(x) /* inverse of normal distribution function */ double _unur_cephes_ndtri(double x); #define _unur_SF_invcdf_normal(x) _unur_cephes_ndtri(x) /*---------------------------------------------------------------------------*/ /* end: CEPHES library */ /*---------------------------------------------------------------------------*/ #endif /***************************************************************************** * * * Special functions implemented in UNU.RAN * * * *****************************************************************************/ /* modified Bessel function K_nu of second kind (AKA third kind) */ /* when BOTH nu and x are large. */ /* [ Experimental function! ] */ double _unur_bessel_k_nuasympt (double x, double nu, int islog, int expon_scaled); #define _unur_SF_bessel_k_nuasympt(x,nu,islog,exponscaled) \ _unur_bessel_k_nuasympt((x),(nu),(islog),(exponscaled)) /* logarithm of complex gamma function */ double _unur_Relcgamma (double x, double y); #define _unur_SF_Relcgamma(x,y) _unur_Relcgamma((x),(y)) /***************************************************************************** * * * Replacement for missing (system) functions * * * *****************************************************************************/ #if !HAVE_DECL_LOG1P /* log(1+x) */ /* (replacement for missing C99 function log1p) */ double _unur_log1p(double x); #define log1p _unur_log1p #endif #if !HAVE_DECL_HYPOT /* sqrt(x^2 + y^2) */ /* (replacement for missing C99 function hypot) */ double _unur_hypot(const double x, const double y); #define hypot _unur_hypot #endif /*---------------------------------------------------------------------------*/ #endif /* UNUR_SPECFUNCT_SOURCE_H_SEEN */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/specfunct/Makefile.in0000644001357500135600000005074614430713360014700 00000000000000# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = src/specfunct ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libspecfunct_la_LIBADD = am__objects_1 = cephes_gamma.lo cephes_igam.lo cephes_incbet.lo \ cephes_ndtr.lo cephes_ndtri.lo cephes_polevl.lo am__objects_2 = am__objects_3 = bessel_asympt.lo cgamma.lo hypot.lo log1p.lo am_libspecfunct_la_OBJECTS = $(am__objects_1) $(am__objects_2) \ $(am__objects_3) libspecfunct_la_OBJECTS = $(am_libspecfunct_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/bessel_asympt.Plo \ ./$(DEPDIR)/cephes_gamma.Plo ./$(DEPDIR)/cephes_igam.Plo \ ./$(DEPDIR)/cephes_incbet.Plo ./$(DEPDIR)/cephes_ndtr.Plo \ ./$(DEPDIR)/cephes_ndtri.Plo ./$(DEPDIR)/cephes_polevl.Plo \ ./$(DEPDIR)/cgamma.Plo ./$(DEPDIR)/hypot.Plo \ ./$(DEPDIR)/log1p.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libspecfunct_la_SOURCES) DIST_SOURCES = $(libspecfunct_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(noinst_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autoconf/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILECMD = @FILECMD@ GREP = @GREP@ HAVE_DIVIDE_BY_ZERO = @HAVE_DIVIDE_BY_ZERO@ HAVE_IEEE_COMPARISONS = @HAVE_IEEE_COMPARISONS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNURAN_LT_VERSION = @UNURAN_LT_VERSION@ UNURAN_SUPPORTS_GSL = @UNURAN_SUPPORTS_GSL@ UNURAN_SUPPORTS_PRNG = @UNURAN_SUPPORTS_PRNG@ UNURAN_SUPPORTS_RNGSTREAM = @UNURAN_SUPPORTS_RNGSTREAM@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ have_valgrind = @have_valgrind@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = \ -I$(top_srcdir)/src noinst_LTLIBRARIES = libspecfunct.la # Routines taken from # Cephes Math Library Release 2.3: June, 1995 # by Stephen L. Moshier: # [ See also README.cephes ] CEPHES = \ cephes_source.h \ cephes_gamma.c \ cephes_igam.c \ cephes_incbet.c \ cephes_ndtr.c \ cephes_ndtri.c \ cephes_polevl.c RMATH = OTHER = \ bessel_asympt.c \ cgamma.c \ hypot.c \ log1p.c libspecfunct_la_SOURCES = $(CEPHES) $(RMATH) $(OTHER) noinst_HEADERS = \ unur_specfunct_source.h # clean backup files CLEANFILES = *~ # clean generated files MAINTAINERCLEANFILES = \ Makefile.in all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/specfunct/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/specfunct/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libspecfunct.la: $(libspecfunct_la_OBJECTS) $(libspecfunct_la_DEPENDENCIES) $(EXTRA_libspecfunct_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libspecfunct_la_OBJECTS) $(libspecfunct_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bessel_asympt.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cephes_gamma.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cephes_igam.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cephes_incbet.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cephes_ndtr.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cephes_ndtri.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cephes_polevl.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cgamma.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hypot.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log1p.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/bessel_asympt.Plo -rm -f ./$(DEPDIR)/cephes_gamma.Plo -rm -f ./$(DEPDIR)/cephes_igam.Plo -rm -f ./$(DEPDIR)/cephes_incbet.Plo -rm -f ./$(DEPDIR)/cephes_ndtr.Plo -rm -f ./$(DEPDIR)/cephes_ndtri.Plo -rm -f ./$(DEPDIR)/cephes_polevl.Plo -rm -f ./$(DEPDIR)/cgamma.Plo -rm -f ./$(DEPDIR)/hypot.Plo -rm -f ./$(DEPDIR)/log1p.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/bessel_asympt.Plo -rm -f ./$(DEPDIR)/cephes_gamma.Plo -rm -f ./$(DEPDIR)/cephes_igam.Plo -rm -f ./$(DEPDIR)/cephes_incbet.Plo -rm -f ./$(DEPDIR)/cephes_ndtr.Plo -rm -f ./$(DEPDIR)/cephes_ndtri.Plo -rm -f ./$(DEPDIR)/cephes_polevl.Plo -rm -f ./$(DEPDIR)/cgamma.Plo -rm -f ./$(DEPDIR)/hypot.Plo -rm -f ./$(DEPDIR)/log1p.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: unuran-1.11.0/src/specfunct/bessel_asympt.c0000644001357500135600000001200514420445767015647 00000000000000/*---------------------------------------------------------------------------*/ /* */ /* Asymptotic expnasion of Bessel functions for large orders nu. */ /* */ /*---------------------------------------------------------------------------*/ #include /*---------------------------------------------------------------------------*/ double _unur_bessel_k_nuasympt (double x, double nu, int islog, int expon_scaled) /*---------------------------------------------------------------------------*/ /* Asymptotic expansion of Bessel K_nu(x) function */ /* when BOTH nu and x are large. */ /* */ /* parameters: */ /* x ... argument for K_nu() */ /* nu ... order or Bessel function */ /* islog ... return logarithm of result TRUE and result when FALSE */ /* expon_scaled ... return exp(-x)*K_nu(x) when TRUE and K_nu(x) when FALSE*/ /* */ /*---------------------------------------------------------------------------*/ /* */ /* references: */ /* ## Abramowitz & Stegun , p.378, __ 9.7.8. __ */ /* */ /* ## K_nu(nu * z) ~ sqrt(pi/(2*nu)) * exp(-nu*eta)/(1+z^2)^(1/4) */ /* ## * {1 - u_1(t)/nu + u_2(t)/nu^2 - ... } */ /* */ /* ## where t = 1 / sqrt(1 + z^2), */ /* ## eta = sqrt(1 + z^2) + log(z / (1 + sqrt(1+z^2))) */ /* ## */ /* ## and u_k(t) from p.366 __ 9.3.9 __ */ /* */ /* ## u0(t) = 1 */ /* ## u1(t) = (3*t - 5*t^3)/24 */ /* ## u2(t) = (81*t^2 - 462*t^4 + 385*t^6)/1152 */ /* ## ... */ /* */ /* ## with recursion 9.3.10 for k = 0, 1, .... : */ /* ## */ /* ## u_{k+1}(t) = t^2/2 * (1 - t^2) * u'_k(t) + */ /* ## 1/8 \int_0^t (1 - 5*s^2)* u_k(s) ds */ /*---------------------------------------------------------------------------*/ /* */ /* Original implementation in R code (R package "Bessel" v. 0.5-3) by */ /* Martin Maechler, Date: 23 Nov 2009, 13:39 */ /* */ /* Translated into C code by Kemal Dingic, Oct. 2011. */ /* */ /* Modified by Josef Leydold on Tue Nov 1 13:22:09 CET 2011 */ /* */ /*---------------------------------------------------------------------------*/ { double z; /* rescaled argument for K_nu() */ double sz, t, t2, eta; /* auxiliary variables */ double d, u1t,u2t,u3t,u4t; /* (auxiliary) results for Debye polynomials */ double res; /* value of log(K_nu(x)) [= result] */ /* rescale: we comute K_nu(z * nu) */ z = x / nu; /* auxiliary variables */ sz = hypot(1,z); /* = sqrt(1+z^2) */ t = 1. / sz; t2 = t*t; eta = (expon_scaled) ? (1./(z + sz)) : sz; eta += log(z) - log1p(sz); /* = log(z/(1+sz)) */ /* evaluate Debye polynomials u_j(t) */ u1t = (t * (3. - 5.*t2))/24.; u2t = t2 * (81. + t2*(-462. + t2 * 385.))/1152.; u3t = t*t2 * (30375. + t2 * (-369603. + t2 * (765765. - t2 * 425425.)))/414720.; u4t = t2*t2 * (4465125. + t2 * (-94121676. + t2 * (349922430. + t2 * (-446185740. + t2 * 185910725.)))) / 39813120.; d = (-u1t + (u2t + (-u3t + u4t/nu)/nu)/nu)/nu; /* log(K_nu(x)) */ res = log(1.+d) - nu*eta - 0.5*(log(2.*nu*sz) - M_LNPI); return (islog ? res : exp(res)); } /* end of _unur_bessel_k_nuasympt() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/specfunct/cephes_ndtr.c0000644001357500135600000001343614420445767015304 00000000000000/* ndtr.c * * Normal distribution function * * * * SYNOPSIS: * * double x, y, ndtr(); * * y = ndtr( x ); * * * * DESCRIPTION: * * Returns the area under the Gaussian probability density * function, integrated from minus infinity to x: * * x * - * 1 | | 2 * ndtr(x) = --------- | exp( - t /2 ) dt * sqrt(2pi) | | * - * -inf. * * = ( 1 + erf(z) ) / 2 * = erfc(z) / 2 * * where z = x/sqrt(2). Computation is via the functions * erf and erfc. * * * ACCURACY: * * Relative error: * arithmetic domain # trials peak rms * DEC -13,0 8000 2.1e-15 4.8e-16 * IEEE -13,0 30000 3.4e-14 6.7e-15 * * * ERROR MESSAGES: * * message condition value returned * erfc underflow x > 37.519379347 0.0 * */ /* erf.c * * Error function * * * * SYNOPSIS: * * double x, y, erf(); * * y = erf( x ); * * * * DESCRIPTION: * * The integral is * * x * - * 2 | | 2 * erf(x) = -------- | exp( - t ) dt. * sqrt(pi) | | * - * 0 * * The magnitude of x is limited to 9.231948545 for DEC * arithmetic; 1 or -1 is returned outside this range. * * For 0 <= |x| < 1, erf(x) = x * P4(x**2)/Q5(x**2); otherwise * erf(x) = 1 - erfc(x). * * * * ACCURACY: * * Relative error: * arithmetic domain # trials peak rms * DEC 0,1 14000 4.7e-17 1.5e-17 * IEEE 0,1 30000 3.7e-16 1.0e-16 * */ /* erfc.c * * Complementary error function * * * * SYNOPSIS: * * double x, y, erfc(); * * y = erfc( x ); * * * * DESCRIPTION: * * * 1 - erf(x) = * * inf. * - * 2 | | 2 * erfc(x) = -------- | exp( - t ) dt * sqrt(pi) | | * - * x * * * For small x, erfc(x) = 1 - erf(x); otherwise rational * approximations are computed. * * * * ACCURACY: * * Relative error: * arithmetic domain # trials peak rms * DEC 0, 9.2319 12000 5.1e-16 1.2e-16 * IEEE 0,26.6417 30000 5.7e-14 1.5e-14 * * * ERROR MESSAGES: * * message condition value returned * erfc underflow x > 9.231948545 (DEC) 0.0 * * */ /* Cephes Math Library Release 2.8: June, 2000 Copyright 1984, 1987, 1988, 1992, 2000 by Stephen L. Moshier */ /* Wed Jan 3, Josef Leydold: made ANSI compliant declaration */ #include "cephes_source.h" /*---------------------------------------------------------------------------*/ #ifdef COMPILE_CEPHES /*---------------------------------------------------------------------------*/ static double P[] = { 2.46196981473530512524E-10, 5.64189564831068821977E-1, 7.46321056442269912687E0, 4.86371970985681366614E1, 1.96520832956077098242E2, 5.26445194995477358631E2, 9.34528527171957607540E2, 1.02755188689515710272E3, 5.57535335369399327526E2 }; static double Q[] = { /* 1.00000000000000000000E0,*/ 1.32281951154744992508E1, 8.67072140885989742329E1, 3.54937778887819891062E2, 9.75708501743205489753E2, 1.82390916687909736289E3, 2.24633760818710981792E3, 1.65666309194161350182E3, 5.57535340817727675546E2 }; static double R[] = { 5.64189583547755073984E-1, 1.27536670759978104416E0, 5.01905042251180477414E0, 6.16021097993053585195E0, 7.40974269950448939160E0, 2.97886665372100240670E0 }; static double S[] = { /* 1.00000000000000000000E0,*/ 2.26052863220117276590E0, 9.39603524938001434673E0, 1.20489539808096656605E1, 1.70814450747565897222E1, 9.60896809063285878198E0, 3.36907645100081516050E0 }; static double T[] = { 9.60497373987051638749E0, 9.00260197203842689217E1, 2.23200534594684319226E3, 7.00332514112805075473E3, 5.55923013010394962768E4 }; static double U[] = { /* 1.00000000000000000000E0,*/ 3.35617141647503099647E1, 5.21357949780152679795E2, 4.59432382970980127987E3, 2.26290000613890934246E4, 4.92673942608635921086E4 }; /*---------------------------------------------------------------------------*/ double _unur_cephes_ndtr( double a ) { double x, y, z; x = a * SQRTH; z = fabs(x); if( z < SQRTH ) y = 0.5 + 0.5 * _unur_cephes_erf(x); else { y = 0.5 * _unur_cephes_erfc(z); if( x > 0 ) y = 1.0 - y; } return(y); } /*---------------------------------------------------------------------------*/ double _unur_cephes_erfc( double a ) { double p,q,x,y,z; if( a < 0.0 ) x = -a; else x = a; if( x < 1.0 ) return( 1.0 - _unur_cephes_erf(a) ); z = -a * a; if( z < -MAXLOG ) { under: if( a < 0 ) return( 2.0 ); else return( 0.0 ); } z = exp(z); if( x < 8.0 ) { p = _unur_cephes_polevl( x, P, 8 ); q = _unur_cephes_p1evl( x, Q, 8 ); } else { p = _unur_cephes_polevl( x, R, 5 ); q = _unur_cephes_p1evl( x, S, 6 ); } y = (z * p)/q; if( a < 0 ) y = 2.0 - y; if( _unur_iszero(y) ) goto under; return(y); } /*---------------------------------------------------------------------------*/ double _unur_cephes_erf( double x) { double y, z; if( fabs(x) > 1.0 ) return( 1.0 - _unur_cephes_erfc(x) ); z = x * x; y = x * _unur_cephes_polevl( z, T, 4 ) / _unur_cephes_p1evl( z, U, 5 ); return( y ); } /*---------------------------------------------------------------------------*/ #endif /* COMPILE_CEPHES */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/specfunct/Makefile.am0000644001357500135600000000123214420445767014665 00000000000000## Process this file with automake to produce Makefile.in AM_CPPFLAGS = \ -I$(top_srcdir)/src noinst_LTLIBRARIES = libspecfunct.la # Routines taken from # Cephes Math Library Release 2.3: June, 1995 # by Stephen L. Moshier: # [ See also README.cephes ] CEPHES = \ cephes_source.h \ cephes_gamma.c \ cephes_igam.c \ cephes_incbet.c \ cephes_ndtr.c \ cephes_ndtri.c \ cephes_polevl.c RMATH = OTHER = \ bessel_asympt.c \ cgamma.c \ hypot.c \ log1p.c libspecfunct_la_SOURCES = $(CEPHES) $(RMATH) $(OTHER) noinst_HEADERS = \ unur_specfunct_source.h # clean backup files CLEANFILES = *~ # clean generated files MAINTAINERCLEANFILES = \ Makefile.in unuran-1.11.0/src/specfunct/cephes_igam.c0000644001357500135600000001022314420445767015241 00000000000000/* igam.c * * Incomplete gamma integral * * * * SYNOPSIS: * * double a, x, y, igam(); * * y = igam( a, x ); * * DESCRIPTION: * * The function is defined by * * x * - * 1 | | -t a-1 * igam(a,x) = ----- | e t dt. * - | | * | (a) - * 0 * * * In this implementation both arguments must be positive. * The integral is evaluated by either a power series or * continued fraction expansion, depending on the relative * values of a and x. * * ACCURACY: * * Relative error: * arithmetic domain # trials peak rms * IEEE 0,30 200000 3.6e-14 2.9e-15 * IEEE 0,100 300000 9.9e-14 1.5e-14 */ /* igamc() * * Complemented incomplete gamma integral * * * * SYNOPSIS: * * double a, x, y, igamc(); * * y = igamc( a, x ); * * DESCRIPTION: * * The function is defined by * * * igamc(a,x) = 1 - igam(a,x) * * inf. * - * 1 | | -t a-1 * = ----- | e t dt. * - | | * | (a) - * x * * * In this implementation both arguments must be positive. * The integral is evaluated by either a power series or * continued fraction expansion, depending on the relative * values of a and x. * * ACCURACY: * * Tested at random a, x. * a x Relative error: * arithmetic domain domain # trials peak rms * IEEE 0.5,100 0,100 200000 1.9e-14 1.7e-15 * IEEE 0.01,0.5 0,100 200000 1.4e-13 1.6e-15 */ /* Cephes Math Library Release 2.8: June, 2000 Copyright 1985, 1987, 2000 by Stephen L. Moshier */ /* Wed Jan 3, Josef Leydold: made ANSI compliant declaration */ #include "cephes_source.h" /*---------------------------------------------------------------------------*/ #ifdef COMPILE_CEPHES /*---------------------------------------------------------------------------*/ static double big = 4.503599627370496e15; static double biginv = 2.22044604925031308085e-16; /*---------------------------------------------------------------------------*/ double _unur_cephes_igamc( double a, double x ) { double ans, ax, c, yc, r, t, y, z; double pk, pkm1, pkm2, qk, qkm1, qkm2; if( (x <= 0) || ( a <= 0) ) return( 1.0 ); if( (x < 1.0) || (x < a) ) return( 1.0 - _unur_cephes_igam(a,x) ); ax = a * log(x) - x - _unur_cephes_lgam(a); if( ax < -MAXLOG ) return( 0.0 ); ax = exp(ax); /* continued fraction */ y = 1.0 - a; z = x + y + 1.0; c = 0.0; pkm2 = 1.0; qkm2 = x; pkm1 = x + 1.0; qkm1 = z * x; ans = pkm1/qkm1; do { c += 1.0; y += 1.0; z += 2.0; yc = y * c; pk = pkm1 * z - pkm2 * yc; qk = qkm1 * z - qkm2 * yc; if( !_unur_iszero(qk) ) { r = pk/qk; t = fabs( (ans - r)/r ); ans = r; } else t = 1.0; pkm2 = pkm1; pkm1 = pk; qkm2 = qkm1; qkm1 = qk; if( fabs(pk) > big ) { pkm2 *= biginv; pkm1 *= biginv; qkm2 *= biginv; qkm1 *= biginv; } } while( t > MACHEP ); return( ans * ax ); } /*---------------------------------------------------------------------------*/ /* left tail of incomplete gamma function: * * inf. k * a -x - x * x e > ---------- * - - * k=0 | (a+k+1) * */ double _unur_cephes_igam( double a, double x ) { double ans, ax, c, r; if( (x <= 0) || ( a <= 0) ) return( 0.0 ); if( (x > 1.0) && (x > a ) ) return( 1.0 - _unur_cephes_igamc(a,x) ); /* Compute x**a * exp(-x) / gamma(a) */ ax = a * log(x) - x - _unur_cephes_lgam(a); if( ax < -MAXLOG ) return( 0.0 ); ax = exp(ax); /* power series */ r = a; c = 1.0; ans = 1.0; do { r += 1.0; c *= x/r; ans += c; } while( c/ans > MACHEP ); return( ans * ax/a ); } /*---------------------------------------------------------------------------*/ #endif /* COMPILE_CEPHES */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/specfunct/hypot.c0000644001357500135600000000277114420445767014151 00000000000000/* _unur_hypot * * Computs the value of sqrt(x^2 + y^2) in a way that avoids overflow. * * Replacement for missing C99 function hypot() * * Copied and renamed from gsl_hypot into _unur_hypot * by Josef Leydold, Tue Nov 1 11:17:37 CET 2011 */ /* sys/hypot.c * * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough, Patrick Alken * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include #if !HAVE_DECL_HYPOT double _unur_hypot (const double x, const double y) { double xabs = fabs(x) ; double yabs = fabs(y) ; double min, max; if (xabs < yabs) { min = xabs ; max = yabs ; } else { min = yabs ; max = xabs ; } if (min == 0) { return max ; } { double u = min / max ; return max * sqrt (1 + u * u) ; } } /* end of _unur_hypot() */ #endif unuran-1.11.0/src/specfunct/cgamma.c0000644001357500135600000001637114420445767014234 00000000000000/*---------------------------------------------------------------------------*/ /* */ /* Logarithm of complex gamma function */ /* */ /*---------------------------------------------------------------------------*/ #include /*---------------------------------------------------------------------------*/ double _unur_Relcgamma (double x, double y) /*---------------------------------------------------------------------------*/ /* Real part of logarithm of complex gamma function: */ /* log(Gamma(|z|)) = Re(log(Gamma(z)) */ /* */ /* parameters: */ /* x ... real part of argument z */ /* y ... imaginary part of argument z */ /*---------------------------------------------------------------------------*/ /* */ /* references: */ /* S. Zhang & J. Jin: "Computation of Special Functions" (Wiley, 1996). */ /* */ /*---------------------------------------------------------------------------*/ /* */ /* Original FORTRAN code by S. Zhang and J. Jin. */ /* http://iris-lee3.ece.uiuc.edu/~jjin/routines/routines.html */ /* */ /* C All the programs and subroutines contained in this archive are */ /* C copyrighted. However, we give permission to the user who downloads */ /* C these routines to incorporate any of these routines into his or */ /* C her programs provided that the copyright is acknowledged. */ /* */ /* C Contact Information */ /* C Email: j-jin1@uiuc.edu */ /* C Phone: (217) 244-0756 */ /* C Fax: (217) 333-5962 */ /* C Professor Jianming Jin */ /* C Department of Electrical and Computer Engineering */ /* C University of Illinois at Urbana-Champaign */ /* C 461 William L Everitt Laboratory */ /* C 1406 West Green Street */ /* C Urbana, IL 61801-2991 */ /* */ /* We found the code in R package 'fAsiaOptions', Version: 2100.76 */ /* */ /* ......................................................................... */ /* */ /* Translation into C code found in */ /* */ /* cgamma.cpp -- Complex gamma function. */ /* Algorithms and coefficient values from "Computation of Special */ /* Functions", Zhang and Jin, John Wiley and Sons, 1996. */ /* */ /* (C) 2003, C. Bond. All rights reserved. */ /* */ /* See http:// www.crbond.com/ */ /* */ /* This website contains a variety of materials related to technology and */ /* engineering. Downloadable software, much of it original, is available */ /* from some of the pages. */ /* All downloadable software is offered freely and without restriction -- */ /* although in most cases the files should be considered as works in */ /* progress (alpha or beta level). */ /* Source code is also included for some applications. */ /* */ /* ......................................................................... */ /* */ /* Modified by Kemal Dingic Oct 2011. */ /* Modified by Josef Leydold on Tue Nov 1 13:22:09 CET 2011 */ /* */ /*---------------------------------------------------------------------------*/ { double t, x0, x1; double q1, logq1, q2, th /* , th1, th2 */; double gr1, /* gi1, */ sr, si; int j, k, na; static const double a[] = { 8.333333333333333e-02, -2.777777777777778e-03, 7.936507936507937e-04, -5.952380952380952e-04, 8.417508417508418e-04, -1.917526917526918e-03, 6.410256410256410e-03, -2.955065359477124e-02, 1.796443723688307e-01, -1.39243221690590 }; /* real part and imaginary part of Gamma(z) */ double gr; /* gi; */ x1 = 0.0; na = 0; if ((y == 0.0) && (x == (int)x) && (x <= 0.0)) return UNUR_INFINITY; else if (x < 0.0) { x1 = x; x = -x; y = -y; } x0 = x; if (x <= 7.0) { na = (int)(7.0-x); x0 = x+na; } q1 = hypot(x0,y); /* = sqrt(x0*x0+y*y) */ th = atan(y/x0); logq1 = log(q1); gr = (x0-0.5)*logq1-th*y-x0+0.5*log(2.0*M_PI); /* gi = th*(x0-0.5)+y*logq1-y; */ for (k=0; k<10; k++){ t = pow(q1,-1.0-2.0*k); gr += (a[k]*t*cos((2.0*k+1.0)*th)); /* gi -= (a[k]*t*sin((2.0*k+1.0)*th)); */ } if (x <= 7.0) { gr1 = 0.0; /* gi1 = 0.0; */ for (j=0; j= 1 MAXNUM * */ /* Cephes Math Library Release 2.8: June, 2000 Copyright 1984, 1987, 1989, 2000 by Stephen L. Moshier */ /* Wed Jan 3, Josef Leydold: made ANSI compliant declaration */ #include "cephes_source.h" /*---------------------------------------------------------------------------*/ #ifdef COMPILE_CEPHES /*---------------------------------------------------------------------------*/ #define s2pi M_SQRT2PI /* sqrt(2pi) */ /* approximation for 0 <= |y - 0.5| <= 3/8 */ static double P0[5] = { -5.99633501014107895267E1, 9.80010754185999661536E1, -5.66762857469070293439E1, 1.39312609387279679503E1, -1.23916583867381258016E0, }; static double Q0[8] = { /* 1.00000000000000000000E0,*/ 1.95448858338141759834E0, 4.67627912898881538453E0, 8.63602421390890590575E1, -2.25462687854119370527E2, 2.00260212380060660359E2, -8.20372256168333339912E1, 1.59056225126211695515E1, -1.18331621121330003142E0, }; /* Approximation for interval z = sqrt(-2 log y ) between 2 and 8 * i.e., y between exp(-2) = .135 and exp(-32) = 1.27e-14. */ static double P1[9] = { 4.05544892305962419923E0, 3.15251094599893866154E1, 5.71628192246421288162E1, 4.40805073893200834700E1, 1.46849561928858024014E1, 2.18663306850790267539E0, -1.40256079171354495875E-1, -3.50424626827848203418E-2, -8.57456785154685413611E-4, }; static double Q1[8] = { /* 1.00000000000000000000E0,*/ 1.57799883256466749731E1, 4.53907635128879210584E1, 4.13172038254672030440E1, 1.50425385692907503408E1, 2.50464946208309415979E0, -1.42182922854787788574E-1, -3.80806407691578277194E-2, -9.33259480895457427372E-4, }; /* Approximation for interval z = sqrt(-2 log y ) between 8 and 64 * i.e., y between exp(-32) = 1.27e-14 and exp(-2048) = 3.67e-890. */ static double P2[9] = { 3.23774891776946035970E0, 6.91522889068984211695E0, 3.93881025292474443415E0, 1.33303460815807542389E0, 2.01485389549179081538E-1, 1.23716634817820021358E-2, 3.01581553508235416007E-4, 2.65806974686737550832E-6, 6.23974539184983293730E-9, }; static double Q2[8] = { /* 1.00000000000000000000E0,*/ 6.02427039364742014255E0, 3.67983563856160859403E0, 1.37702099489081330271E0, 2.16236993594496635890E-1, 1.34204006088543189037E-2, 3.28014464682127739104E-4, 2.89247864745380683936E-6, 6.79019408009981274425E-9, }; /*---------------------------------------------------------------------------*/ double _unur_cephes_ndtri( double yval ) { double x, y, z, y2, x0, x1; int code; if( yval <= 0.0 ) return( -MAXNUM ); if( yval >= 1.0 ) return( MAXNUM ); code = 1; y = yval; if( y > (1.0 - 0.13533528323661269189) ) /* 0.135... = exp(-2) */ { y = 1.0 - y; code = 0; } if( y > 0.13533528323661269189 ) { y = y - 0.5; y2 = y * y; x = y + y * (y2 * _unur_cephes_polevl( y2, P0, 4)/_unur_cephes_p1evl( y2, Q0, 8 )); x = x * s2pi; return(x); } x = sqrt( -2.0 * log(y) ); x0 = x - log(x)/x; z = 1.0/x; if( x < 8.0 ) /* y > exp(-32) = 1.2664165549e-14 */ x1 = z * _unur_cephes_polevl( z, P1, 8 )/_unur_cephes_p1evl( z, Q1, 8 ); else x1 = z * _unur_cephes_polevl( z, P2, 8 )/_unur_cephes_p1evl( z, Q2, 8 ); x = x0 - x1; if( code != 0 ) x = -x; return( x ); } /*---------------------------------------------------------------------------*/ #endif /* COMPILE_CEPHES */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/specfunct/cephes_gamma.c0000644001357500135600000002035314420445767015413 00000000000000/* Wed Jan 3, Josef Leydold: Remark: the global (extern) variable sgngam has been removed Mon Apr 2 20:41:14 CEST 2012, Josef Leydold: Replaced INFINITY by UNUR_INFINITY */ /* gamma.c * * Gamma function * * * * SYNOPSIS: * * double x, y, gamma(); * extern int sgngam; * * y = gamma( x ); * * * * DESCRIPTION: * * Returns gamma function of the argument. The result is * correctly signed, and the sign (+1 or -1) is also * returned in a global (extern) variable named sgngam. * This variable is also filled in by the logarithmic gamma * function lgam(). * * Arguments |x| <= 34 are reduced by recurrence and the function * approximated by a rational function of degree 6/7 in the * interval (2,3). Large arguments are handled by Stirling's * formula. Large negative arguments are made positive using * a reflection formula. * * * ACCURACY: * * Relative error: * arithmetic domain # trials peak rms * DEC -34, 34 10000 1.3e-16 2.5e-17 * IEEE -170,-33 20000 2.3e-15 3.3e-16 * IEEE -33, 33 20000 9.4e-16 2.2e-16 * IEEE 33, 171.6 20000 2.3e-15 3.2e-16 * * Error for arguments outside the test range will be larger * owing to error amplification by the exponential function. * */ /* lgam() * * Natural logarithm of gamma function * * * * SYNOPSIS: * * double x, y, lgam(); * extern int sgngam; * * y = lgam( x ); * * * * DESCRIPTION: * * Returns the base e (2.718...) logarithm of the absolute * value of the gamma function of the argument. * The sign (+1 or -1) of the gamma function is returned in a * global (extern) variable named sgngam. * * For arguments greater than 13, the logarithm of the gamma * function is approximated by the logarithmic version of * Stirling's formula using a polynomial approximation of * degree 4. Arguments between -33 and +33 are reduced by * recurrence to the interval [2,3] of a rational approximation. * The cosecant reflection formula is employed for arguments * less than -33. * * Arguments greater than MAXLGM return MAXNUM and an error * message. MAXLGM = 2.035093e36 for DEC * arithmetic or 2.556348e305 for IEEE arithmetic. * * * * ACCURACY: * * * arithmetic domain # trials peak rms * DEC 0, 3 7000 5.2e-17 1.3e-17 * DEC 2.718, 2.035e36 5000 3.9e-17 9.9e-18 * IEEE 0, 3 28000 5.4e-16 1.1e-16 * IEEE 2.718, 2.556e305 40000 3.5e-16 8.3e-17 * The error criterion was relative when the function magnitude * was greater than one but absolute when it was less than one. * * The following test used the relative error criterion, though * at certain points the relative error could be much higher than * indicated. * IEEE -200, -4 10000 4.8e-16 1.3e-16 * */ /* gamma.c */ /* gamma function */ /* Cephes Math Library Release 2.8: June, 2000 Copyright 1984, 1987, 1989, 1992, 2000 by Stephen L. Moshier */ /* Wed Jan 3, Josef Leydold: made ANSI compliant declaration */ #include "cephes_source.h" /*---------------------------------------------------------------------------*/ #ifdef COMPILE_CEPHES /*---------------------------------------------------------------------------*/ static double P[] = { 1.60119522476751861407E-4, 1.19135147006586384913E-3, 1.04213797561761569935E-2, 4.76367800457137231464E-2, 2.07448227648435975150E-1, 4.94214826801497100753E-1, 9.99999999999999996796E-1 }; static double Q[] = { -2.31581873324120129819E-5, 5.39605580493303397842E-4, -4.45641913851797240494E-3, 1.18139785222060435552E-2, 3.58236398605498653373E-2, -2.34591795718243348568E-1, 7.14304917030273074085E-2, 1.00000000000000000320E0 }; #define LOGPI M_LNPI /* log(Pi) */ /* Stirling's formula for the gamma function */ static double STIR[5] = { 7.87311395793093628397E-4, -2.29549961613378126380E-4, -2.68132617805781232825E-3, 3.47222221605458667310E-3, 8.33333333333482257126E-2, }; #define SQTPI M_SQRT2PI /* sqrt(2*pi) */ static double stirf ( double ); /*---------------------------------------------------------------------------*/ /* Gamma function computed by Stirling's formula. * The polynomial STIR is valid for 33 <= x <= 172. */ static double stirf( double x) { double y, w, v; w = 1.0/x; w = 1.0 + w * _unur_cephes_polevl( w, STIR, 4 ); y = exp(x); /* #define MAXSTIR MAXLOG/log(MAXLOG) */ if( x > MAXSTIR ) { /* Avoid overflow in pow() */ v = pow( x, 0.5 * x - 0.25 ); y = v * (v / y); } else { y = pow( x, x - 0.5 ) / y; } y = SQTPI * y * w; return( y ); } /*---------------------------------------------------------------------------*/ double _unur_cephes_gamma( double x ) { double p, q, z; int i; int sgngam = 1; if (!_unur_isfinite(x)) return(x); q = fabs(x); if( q > 33.0 ) { if( x < 0.0 ) { p = floor(q); if( _unur_FP_same(p,q) ) { return( sgngam * UNUR_INFINITY); } i = (int) p; if( (i & 1) == 0 ) sgngam = -1; z = q - p; if( z > 0.5 ) { p += 1.0; z = q - p; } z = q * sin( PI * z ); if( _unur_iszero(z) ) { return( sgngam * UNUR_INFINITY); } z = fabs(z); z = PI/(z * stirf(q) ); } else { z = stirf(x); } return( sgngam * z ); } z = 1.0; while( x >= 3.0 ) { x -= 1.0; z *= x; } while( x < 0.0 ) { if( x > -1.E-9 ) goto small; z /= x; x += 1.0; } while( x < 2.0 ) { if( x < 1.e-9 ) goto small; z /= x; x += 1.0; } if( _unur_isfsame(x, 2.0) ) return(z); x -= 2.0; p = _unur_cephes_polevl( x, P, 6 ); q = _unur_cephes_polevl( x, Q, 7 ); return( z * p / q ); small: if( _unur_iszero(x) ) return( UNUR_INFINITY ); else return( z/((1.0 + 0.5772156649015329 * x) * x) ); } /*---------------------------------------------------------------------------*/ /* A[]: Stirling's formula expansion of log gamma * B[], C[]: log gamma function between 2 and 3 */ static double A[] = { 8.11614167470508450300E-4, -5.95061904284301438324E-4, 7.93650340457716943945E-4, -2.77777777730099687205E-3, 8.33333333333331927722E-2 }; static double B[] = { -1.37825152569120859100E3, -3.88016315134637840924E4, -3.31612992738871184744E5, -1.16237097492762307383E6, -1.72173700820839662146E6, -8.53555664245765465627E5 }; static double C[] = { /* 1.00000000000000000000E0, */ -3.51815701436523470549E2, -1.70642106651881159223E4, -2.20528590553854454839E5, -1.13933444367982507207E6, -2.53252307177582951285E6, -2.01889141433532773231E6 }; /* log( sqrt( 2*pi ) ) */ static double LS2PI = 0.91893853320467274178; #define MAXLGM 2.556348e305 /*---------------------------------------------------------------------------*/ /* Logarithm of gamma function */ double _unur_cephes_lgam( double x ) { double p, q, u, w, z; int i; int sgngam = 1; if (!_unur_isfinite(x)) return(UNUR_INFINITY); if( x < -34.0 ) { q = -x; w = _unur_cephes_lgam(q); p = floor(q); if( _unur_FP_same(p,q) ) return (UNUR_INFINITY); i = (int) p; if( (i & 1) == 0 ) sgngam = -1; else sgngam = 1; z = q - p; if( z > 0.5 ) { p += 1.0; z = p - q; } z = q * sin( PI * z ); if( _unur_iszero(z) ) return (UNUR_INFINITY); /* z = log(PI) - log( z ) - w;*/ z = LOGPI - log( z ) - w; return( z ); } if( x < 13.0 ) { z = 1.0; p = 0.0; u = x; while( u >= 3.0 ) { p -= 1.0; u = x + p; z *= u; } while( u < 2.0 ) { if( _unur_iszero(u) ) return (UNUR_INFINITY); z /= u; p += 1.0; u = x + p; } if( z < 0.0 ) { sgngam = -1; z = -z; } else sgngam = 1; if( _unur_isfsame(u, 2.0) ) return( log(z) ); p -= 2.0; x = x + p; p = x * _unur_cephes_polevl( x, B, 5 ) / _unur_cephes_p1evl( x, C, 6); return( log(z) + p ); } if( x > MAXLGM ) return( sgngam * UNUR_INFINITY ); q = ( x - 0.5 ) * log(x) - x + LS2PI; if( x > 1.0e8 ) return( q ); p = 1.0/(x*x); if( x >= 1000.0 ) q += (( 7.9365079365079365079365e-4 * p - 2.7777777777777777777778e-3) *p + 0.0833333333333333333333) / x; else q += _unur_cephes_polevl( p, A, 4 ) / x; return( q ); } /*---------------------------------------------------------------------------*/ #endif /* COMPILE_CEPHES */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/specfunct/cephes_polevl.c0000644001357500135600000000416114420445767015631 00000000000000/* polevl.c * p1evl.c * * Evaluate polynomial * * * * SYNOPSIS: * * int N; * double x, y, coef[N+1], polevl[]; * * y = polevl( x, coef, N ); * * * * DESCRIPTION: * * Evaluates polynomial of degree N: * * 2 N * y = C + C x + C x +...+ C x * 0 1 2 N * * Coefficients are stored in reverse order: * * coef[0] = C , ..., coef[N] = C . * N 0 * * The function p1evl() assumes that coef[N] = 1.0 and is * omitted from the array. Its calling arguments are * otherwise the same as polevl(). * * * SPEED: * * In the interest of speed, there are no checks for out * of bounds arithmetic. This routine is used by most of * the functions in the library. Depending on available * equipment features, the user may wish to rewrite the * program in microcode or assembly language. * */ /* Cephes Math Library Release 2.1: December, 1988 Copyright 1984, 1987, 1988 by Stephen L. Moshier Direct inquiries to 30 Frost Street, Cambridge, MA 02140 */ /* Wed Jan 3, Josef Leydold: made ANSI compliant declaration */ #include "cephes_source.h" /*---------------------------------------------------------------------------*/ #ifdef COMPILE_CEPHES /*---------------------------------------------------------------------------*/ double _unur_cephes_polevl( double x, double coef[], int N ) { double ans; int i; double *p; p = coef; ans = *p++; i = N; do ans = ans * x + *p++; while( --i ); return( ans ); } /*---------------------------------------------------------------------------*/ /* p1evl() */ /* N * Evaluate polynomial when coefficient of x is 1.0. * Otherwise same as polevl. */ double _unur_cephes_p1evl( double x, double coef[], int N ) { double ans; double *p; int i; p = coef; ans = x + *p++; i = N-1; do ans = ans * x + *p++; while( --i ); return( ans ); } /*---------------------------------------------------------------------------*/ #endif /* COMPILE_CEPHES */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/specfunct/cephes_incbet.c0000644001357500135600000001647614420445767015610 00000000000000/* incbet.c * * Incomplete beta integral * * * SYNOPSIS: * * double a, b, x, y, incbet(); * * y = incbet( a, b, x ); * * * DESCRIPTION: * * Returns incomplete beta integral of the arguments, evaluated * from zero to x. The function is defined as * * x * - - * | (a+b) | | a-1 b-1 * ----------- | t (1-t) dt. * - - | | * | (a) | (b) - * 0 * * The domain of definition is 0 <= x <= 1. In this * implementation a and b are restricted to positive values. * The integral from x to 1 may be obtained by the symmetry * relation * * 1 - incbet( a, b, x ) = incbet( b, a, 1-x ). * * The integral is evaluated by a continued fraction expansion * or, when b*x is small, by a power series. * * ACCURACY: * * Tested at uniformly distributed random points (a,b,x) with a and b * in "domain" and x between 0 and 1. * Relative error * arithmetic domain # trials peak rms * IEEE 0,5 10000 6.9e-15 4.5e-16 * IEEE 0,85 250000 2.2e-13 1.7e-14 * IEEE 0,1000 30000 5.3e-12 6.3e-13 * IEEE 0,10000 250000 9.3e-11 7.1e-12 * IEEE 0,100000 10000 8.7e-10 4.8e-11 * Outputs smaller than the IEEE gradual underflow threshold * were excluded from these statistics. * * ERROR MESSAGES: * message condition value returned * incbet domain x<0, x>1 0.0 * incbet underflow 0.0 */ /* Cephes Math Library, Release 2.8: June, 2000 Copyright 1984, 1995, 2000 by Stephen L. Moshier */ /* Wed Jan 3, Josef Leydold: made ANSI compliant declaration */ #include "cephes_source.h" /*---------------------------------------------------------------------------*/ #ifdef COMPILE_CEPHES /*---------------------------------------------------------------------------*/ #define MAXGAM MAXSTIR static double incbcf(double, double, double); static double incbd(double, double, double); static double pseries(double, double, double); static double big = 4.503599627370496e15; static double biginv = 2.22044604925031308085e-16; /*---------------------------------------------------------------------------*/ double _unur_cephes_incbet( double aa, double bb, double xx ) { double a, b, t, x, xc, w, y; int flag; if( aa <= 0.0 || bb <= 0.0 ) return( 0.0 ); if( (xx <= 0.0) || ( xx >= 1.0) ) { if( _unur_iszero(xx) ) return(0.0); if( _unur_isone(xx) ) return( 1.0 ); return( 0.0 ); } flag = 0; if( (bb * xx) <= 1.0 && xx <= 0.95) { t = pseries(aa, bb, xx); goto done; } w = 1.0 - xx; /* Reverse a and b if x is greater than the mean. */ if( xx > (aa/(aa+bb)) ) { flag = 1; a = bb; b = aa; xc = xx; x = w; } else { a = aa; b = bb; xc = w; x = xx; } if( flag == 1 && (b * x) <= 1.0 && x <= 0.95) { t = pseries(a, b, x); goto done; } /* Choose expansion for better convergence. */ y = x * (a+b-2.0) - (a-1.0); if( y < 0.0 ) w = incbcf( a, b, x ); else w = incbd( a, b, x ) / xc; /* Multiply w by the factor a b _ _ _ x (1-x) | (a+b) / ( a | (a) | (b) ) . */ y = a * log(x); t = b * log(xc); if( (a+b) < MAXGAM && fabs(y) < MAXLOG && fabs(t) < MAXLOG ) { t = pow(xc,b); t *= pow(x,a); t /= a; t *= w; t *= _unur_cephes_gamma(a+b) / (_unur_cephes_gamma(a) * _unur_cephes_gamma(b)); goto done; } /* Resort to logarithms. */ y += t + _unur_cephes_lgam(a+b) - _unur_cephes_lgam(a) - _unur_cephes_lgam(b); y += log(w/a); if( y < MINLOG ) t = 0.0; else t = exp(y); done: if( flag == 1 ) { if( t <= MACHEP ) t = 1.0 - MACHEP; else t = 1.0 - t; } return( t ); } /*---------------------------------------------------------------------------*/ /* Continued fraction expansion #1 * for incomplete beta integral */ static double incbcf( double a, double b, double x ) { double xk, pk, pkm1, pkm2, qk, qkm1, qkm2; double k1, k2, k3, k4, k5, k6, k7, k8; double r, t, ans, thresh; int n; k1 = a; k2 = a + b; k3 = a; k4 = a + 1.0; k5 = 1.0; k6 = b - 1.0; k7 = k4; k8 = a + 2.0; pkm2 = 0.0; qkm2 = 1.0; pkm1 = 1.0; qkm1 = 1.0; ans = 1.0; r = 1.0; n = 0; thresh = 3.0 * MACHEP; do { xk = -( x * k1 * k2 )/( k3 * k4 ); pk = pkm1 + pkm2 * xk; qk = qkm1 + qkm2 * xk; pkm2 = pkm1; pkm1 = pk; qkm2 = qkm1; qkm1 = qk; xk = ( x * k5 * k6 )/( k7 * k8 ); pk = pkm1 + pkm2 * xk; qk = qkm1 + qkm2 * xk; pkm2 = pkm1; pkm1 = pk; qkm2 = qkm1; qkm1 = qk; if( !_unur_iszero(qk) ) r = pk/qk; if( !_unur_iszero(r) ) { t = fabs( (ans - r)/r ); ans = r; } else t = 1.0; if( t < thresh ) goto cdone; k1 += 1.0; k2 += 1.0; k3 += 2.0; k4 += 2.0; k5 += 1.0; k6 -= 1.0; k7 += 2.0; k8 += 2.0; if( (fabs(qk) + fabs(pk)) > big ) { pkm2 *= biginv; pkm1 *= biginv; qkm2 *= biginv; qkm1 *= biginv; } if( (fabs(qk) < biginv) || (fabs(pk) < biginv) ) { pkm2 *= big; pkm1 *= big; qkm2 *= big; qkm1 *= big; } } while( ++n < 300 ); cdone: return(ans); } /*---------------------------------------------------------------------------*/ /* Continued fraction expansion #2 * for incomplete beta integral */ static double incbd( double a, double b, double x ) { double xk, pk, pkm1, pkm2, qk, qkm1, qkm2; double k1, k2, k3, k4, k5, k6, k7, k8; double r, t, ans, z, thresh; int n; k1 = a; k2 = b - 1.0; k3 = a; k4 = a + 1.0; k5 = 1.0; k6 = a + b; k7 = a + 1.0;; k8 = a + 2.0; pkm2 = 0.0; qkm2 = 1.0; pkm1 = 1.0; qkm1 = 1.0; z = x / (1.0-x); ans = 1.0; r = 1.0; n = 0; thresh = 3.0 * MACHEP; do { xk = -( z * k1 * k2 )/( k3 * k4 ); pk = pkm1 + pkm2 * xk; qk = qkm1 + qkm2 * xk; pkm2 = pkm1; pkm1 = pk; qkm2 = qkm1; qkm1 = qk; xk = ( z * k5 * k6 )/( k7 * k8 ); pk = pkm1 + pkm2 * xk; qk = qkm1 + qkm2 * xk; pkm2 = pkm1; pkm1 = pk; qkm2 = qkm1; qkm1 = qk; if( !_unur_iszero(qk) ) r = pk/qk; if( !_unur_iszero(r) ) { t = fabs( (ans - r)/r ); ans = r; } else t = 1.0; if( t < thresh ) goto cdone; k1 += 1.0; k2 -= 1.0; k3 += 2.0; k4 += 2.0; k5 += 1.0; k6 += 1.0; k7 += 2.0; k8 += 2.0; if( (fabs(qk) + fabs(pk)) > big ) { pkm2 *= biginv; pkm1 *= biginv; qkm2 *= biginv; qkm1 *= biginv; } if( (fabs(qk) < biginv) || (fabs(pk) < biginv) ) { pkm2 *= big; pkm1 *= big; qkm2 *= big; qkm1 *= big; } } while( ++n < 300 ); cdone: return(ans); } /*---------------------------------------------------------------------------*/ /* Power series for incomplete beta integral. Use when b*x is small and x not too close to 1. */ static double pseries( double a, double b, double x ) { double s, t, u, v, n, t1, z, ai; ai = 1.0 / a; u = (1.0 - b) * x; v = u / (a + 1.0); t1 = v; t = u; n = 2.0; s = 0.0; z = MACHEP * ai; while( fabs(v) > z ) { u = (n - b) * x / n; t *= u; v = t / (a + n); s += v; n += 1.0; } s += t1; s += ai; u = a * log(x); if( (a+b) < MAXGAM && fabs(u) < MAXLOG ) { t = _unur_cephes_gamma(a+b)/(_unur_cephes_gamma(a)*_unur_cephes_gamma(b)); s = s * t * pow(x,a); } else { t = _unur_cephes_lgam(a+b) - _unur_cephes_lgam(a) - _unur_cephes_lgam(b) + u + log(s); if( t < MINLOG ) s = 0.0; else s = exp(t); } return(s); } /*---------------------------------------------------------------------------*/ #endif /* COMPILE_CEPHES */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/tests/0000755001357500135600000000000014430713513012047 500000000000000unuran-1.11.0/src/tests/printsample.c0000644001357500135600000001161714420304141014467 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * file: printsample.c * * * * print a sample of random numbers * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include "unuran_tests.h" /*---------------------------------------------------------------------------*/ static char test_name[] = "Sample"; /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ void unur_test_printsample( struct unur_gen *gen, int n_rows, int n_cols, FILE *out ) /*----------------------------------------------------------------------*/ /* print a sample of generator output in small (n_rows x n_cols) table */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* n_rows ... number of rows */ /* n_cols ... number of columns (for univariate case only) */ /* out ... output stream */ /*----------------------------------------------------------------------*/ { int i,j,k; /* check arguments */ _unur_check_NULL(test_name,gen,RETURN_VOID); fprintf(out,"\nSAMPLE: "); switch (gen->method & UNUR_MASK_TYPE) { case UNUR_METH_DISCR: for( j=0; j #include #include #include "unuran_tests.h" /*---------------------------------------------------------------------------*/ static char test_name[] = "Moments"; /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ int unur_test_moments( UNUR_GEN *gen, double *moments, int n_moments, int samplesize, int verbosity, FILE *out ) /*----------------------------------------------------------------------*/ /* compute central moments of samples. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* moments ... array for storing moments */ /* for multivariate distributions the moments are */ /* stored consecutively for each dimension. */ /* arraylength = (n_moments+1) * dim */ /* n_moments ... number of moments to be calculated (at most 4) */ /* samplesize ... sample size */ /* verbosity ... verbosity level, 0 = no output, 1 = output */ /* out ... output stream */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { #define idx(d,n) ((d)*(n_moments+1)+(n)) double an, an1, dx, dx2; int n, mom, d, dim; double *x; /* check parameter */ _unur_check_NULL(test_name, gen, UNUR_ERR_NULL); /* type of distribution */ if (! ( ((gen->method & UNUR_MASK_TYPE) == UNUR_METH_DISCR) || ((gen->method & UNUR_MASK_TYPE) == UNUR_METH_CONT) || ((gen->method & UNUR_MASK_TYPE) == UNUR_METH_VEC) )) { _unur_error(test_name,UNUR_ERR_GENERIC,"dont know how to compute moments for distribution"); return UNUR_ERR_GENERIC; } /* array for storing moments */ CHECK_NULL(moments,0); if (n_moments <= 0 || n_moments > 4) { _unur_error(test_name,UNUR_ERR_GENERIC,"number of moments < 1 or > 4"); return UNUR_ERR_GENERIC; } /* sample size >= 10 */ if (samplesize < 10) samplesize = 10; /* number of dimensions can only be > 1 for multivariate case */ dim = 1; if ((gen->method & UNUR_MASK_TYPE) == UNUR_METH_VEC) dim = gen->distr->dim; /* allocating memory for sampling "vector" */ x = _unur_xmalloc(dim * sizeof(double)); /* clear array of moments */ for (d=0; dmethod & UNUR_MASK_TYPE) { case UNUR_METH_DISCR: x[0] = _unur_sample_discr(gen); break; case UNUR_METH_CONT: x[0] = _unur_sample_cont(gen); break; case UNUR_METH_VEC: _unur_sample_vec(gen, x); break; } for (d=0; d #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "unuran_tests.h" /*---------------------------------------------------------------------------*/ static char test_name[] = "InvError"; static double uerror_cont ( const UNUR_GEN *gen, double *max_error, double *MAE, double threshold, int samplesize, int randomized, int testtails, int verbosity, FILE *out ); static double uerror_discr( const UNUR_GEN *gen, double *max_error, double *MAE, double threshold, int samplesize, int randomized, int testtails, int verbosity, FILE *out ); static double qrng (int i, int samplesize); /*---------------------------------------------------------------------------*/ double unur_test_u_error( const UNUR_GEN *gen, double *max_error, double *MAE, double threshold, int samplesize, int randomized, int testtails, int verbosity, FILE *out ) /*----------------------------------------------------------------------*/ /* Estimate maximal u-error and mean absolute error (MAE) by means of */ /* (Quasi-) Monte-Carlo simulation. */ /* In addition a penalty value is computed and returned. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* max_error ... pointer for storing maximal u-error */ /* MEA ... pointer for storing MA u-error */ /* threshold ... maximum allowed error */ /* samplesize ... sample size for Monte Carlo simulation */ /* randomized ... use pseudo-random (TRUE) or quasi-random (FALSE) */ /* testtails ... when TRUE then run a special test for tails */ /* verbosity ... verbosity level, 0 = no output, 1 = output */ /* out ... output stream */ /* */ /* return: */ /* penalty score */ /* */ /* error: */ /* return -1 */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL(test_name,gen,-1.); if (verbosity) { _unur_check_NULL(test_name,out,-1.); } if (samplesize < 1000) { _unur_error(test_name,UNUR_ERR_GENERIC,"samplesize too small --> increased to 1000"); samplesize = 1000; } /* type of generator object */ if ( (gen->method == UNUR_METH_HINV) || (gen->method == UNUR_METH_NINV) || (gen->method == UNUR_METH_PINV) || (gen->method == UNUR_METH_CSTD && ((struct unur_cstd_gen*)gen->datap)->is_inversion) || (gen->method == UNUR_METH_MIXT && ((struct unur_mixt_gen*)gen->datap)->is_inversion) ) { /* continuous distribution */ return uerror_cont(gen,max_error,MAE,threshold,samplesize, randomized,testtails,verbosity,out); } if ( (gen->method == UNUR_METH_DGT) || (gen->method == UNUR_METH_DSTD && ((struct unur_dstd_gen*)gen->datap)->is_inversion) ) { /* continuous distribution */ return uerror_discr(gen,max_error,MAE,threshold,samplesize, randomized,testtails,verbosity,out); } _unur_error(test_name,UNUR_ERR_GENERIC,"inversion method required"); return -1.; } /* end of unur_test_estimate_u_error() */ /*---------------------------------------------------------------------------*/ double uerror_cont( const UNUR_GEN *gen, double *max_error, double *MAE, double threshold, int samplesize, int randomized, int testtails, int verbosity, FILE *out ) /*----------------------------------------------------------------------*/ /* Estimate u-error for continuous distributions. */ /* */ /* return: */ /* penalty score */ /* */ /* error: */ /* return -1 */ /*----------------------------------------------------------------------*/ { #define DISTR gen->distr->data.cont double CDFmin, CDFmax; /* minimum and maximum of CDF in given domain */ double (*quantile)(const UNUR_GEN *, double); /* pointer to quantile function */ double U; /* uniform and non-uniform (Q)RN */ double X; /* non-uniform RV */ double cdfX; /* CDF at X */ double uerror, umax, usum; /* last, maximum, sum of U-error(s) */ double penalty = 0; /* score for error */ int j; /* aux variable */ /* get pointer to function that approximates quantiles */ switch (gen->method) { case UNUR_METH_HINV: quantile = unur_hinv_eval_approxinvcdf; break; case UNUR_METH_NINV: quantile = unur_ninv_eval_approxinvcdf; break; case UNUR_METH_PINV: quantile = unur_pinv_eval_approxinvcdf; break; case UNUR_METH_CSTD: if (! (((struct unur_cstd_gen*)gen->datap)->is_inversion)) return -1.; quantile = unur_cstd_eval_invcdf; break; case UNUR_METH_MIXT: if (! (((struct unur_mixt_gen*)gen->datap)->is_inversion)) return -1.; quantile = unur_cstd_eval_invcdf; break; default: _unur_error(test_name,UNUR_ERR_GENERIC,"inversion method required"); return -1.; } /* CDF required */ if (DISTR.cdf == NULL) { _unur_error(test_name,UNUR_ERR_GENERIC,"CDF required"); return -2.; } /* range of CDF */ CDFmin = ((DISTR.trunc[0] > -UNUR_INFINITY) ? _unur_cont_CDF((DISTR.trunc[0]),(gen->distr)) : 0.); CDFmax = ((DISTR.trunc[1] < UNUR_INFINITY) ? _unur_cont_CDF((DISTR.trunc[1]),(gen->distr)) : 1.); /* initialize variables */ umax = 0.; usum = 0.; /* get sample */ for(j=0;jurng); else U = (testtails) ? qrng(j,samplesize) : (j+0.5) / ((double) samplesize); /* compute inverse CDF */ X = quantile(gen,U); /* compute CDF at X */ cdfX = _unur_cont_CDF(X,gen->distr); /* compute U-error: U-error = | U - CDF(X) | However, we have first to rescale CDF(X): CDFrescaled = (CDF(X) - CDFmin) / (CDFmax - CDFmin) as we have to deal with truncated distribution. But then the computed U error might be too large; thus we have to correct it by the factor (CDFmax - CDFmin) to unavoidably high U-errors. */ uerror = fabs( U*(CDFmax - CDFmin) - (cdfX-CDFmin)); /* update error estimates */ usum += uerror; if (uerror > umax) { umax = uerror; } /* update penalty */ if (_unur_FP_less(threshold,uerror)) { penalty += 1. + 10.*(uerror - threshold) / threshold; if (verbosity) fprintf(out,"\tmax u-error exceeded at %g: %g (>%g)\n", X,uerror,threshold); } } /* save data */ *max_error = umax; *MAE = usum/samplesize; /* return penalty */ return penalty/samplesize; #undef DISTR } /* end of uerror_cont() */ /*---------------------------------------------------------------------------*/ double uerror_discr( const UNUR_GEN *gen, double *max_error, double *MAE, double threshold, int samplesize, int randomized, int testtails ATTRIBUTE__UNUSED, int verbosity, FILE *out ) /*----------------------------------------------------------------------*/ /* Estimate u-error for discrete distributions. */ /* */ /* return: */ /* penalty score */ /* */ /* error: */ /* return -1 */ /*----------------------------------------------------------------------*/ { #define DISTR gen->distr->data.discr /* double CDFmin, CDFmax; /\* minimum and maximum of CDF in given domain *\/ */ int (*quantile)(const UNUR_GEN *, double); /* pointer to quantile function */ double U; /* uniform and non-uniform (Q)RN */ int K; /* non-uniform RV */ double cdfK; /* CDF at K */ double uerror, umax, usum; /* uerror, maximum u-error and sum of all uerrors */ double penalty = 0; /* score for error */ int j; /* aux variable */ /* get pointer to function that approximates quantiles */ switch (gen->method) { case UNUR_METH_DGT: quantile = unur_dgt_eval_invcdf; break; case UNUR_METH_DSTD: if (! (((struct unur_dstd_gen*)gen->datap)->is_inversion)) return -1.; quantile = unur_dstd_eval_invcdf; break; default: _unur_error(test_name,UNUR_ERR_GENERIC,"inversion method required"); return -1.; } /* CDF required */ if (DISTR.cdf == NULL) { _unur_error(test_name,UNUR_ERR_GENERIC,"CDF required"); return -2.; } /* range of CDF */ /* CDFmin = (DISTR.trunc[0] <= INT_MIN) ? 0. : _unur_discr_CDF((DISTR.trunc[0]),(gen->distr)); */ /* CDFmax = _unur_discr_CDF((DISTR.trunc[1]),(gen->distr)); */ /* initialize variables */ umax = 0.; usum = 0.; /* get sample */ for(j=0;jurng); else U = (j+0.5) / ((double) samplesize); /* compute inverse CDF */ K = (int) quantile(gen,U); /* estimate uerror */ uerror = 0.; cdfK = _unur_discr_CDF(K,gen->distr); if (cdfK < U) { uerror = U - cdfK; } else { cdfK = _unur_discr_CDF(K-1,gen->distr); uerror = cdfK - U; uerror = _unur_max(0.,uerror); } /* Remark: we could save a lot of time if we store CDF values in a table. */ /* Remark: we do not consider truncated distributions here !! */ /* update error estimates */ usum += uerror; if (uerror > umax) umax = uerror; /* update error estimates */ if (uerror > umax) { umax = uerror; } /* update penalty */ if (_unur_FP_less(threshold,uerror)) { penalty += 1. + 10.*(uerror - threshold) / threshold; if (verbosity) fprintf(out,"\tmax u-error exceeded at U=%g: %g (>%g)\n", U,uerror,threshold); } } /* save data */ *max_error = umax; *MAE = usum/samplesize; /* return penalty */ return penalty/samplesize; #undef DISTR } /* end of uerror_discr() */ /*---------------------------------------------------------------------------*/ double qrng (int i, int samplesize) /*----------------------------------------------------------------------*/ /* Quasi-random sequence for testing inversion error. */ /* 90% of the sample size is used for equidistributed points in (0,1), */ /* 5% for left tail in (0,1e-5) and */ /* 5% for the right tail in (1-1e-5,1). */ /* */ /* parameters: */ /* i ... index of pointe in sequence */ /* samplesize ... sample size for Monte Carlo simulation */ /* */ /* return: */ /* point in sequence */ /*----------------------------------------------------------------------*/ { double U; int tail; /* theshold values for tail parts */ tail = (int) (0.05 * samplesize); /* i must be in 0, ..., samplesize-1 */ i = i % samplesize; if (i < tail) { /* lower tail */ U = (i+0.5) / (1.e5 * tail); } else if (i >= samplesize-tail) { /* upper tail */ i -= samplesize-tail; U = 1. - (i+0.5) / (1.e5 * tail); } else { /* central part */ i -= tail; U = (i+0.5) / (samplesize - 2.*tail); } /* return point */ return U; } /* end of qrng() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/tests/Makefile.in0000644001357500135600000005427314430713360014047 00000000000000# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = src/tests ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(include_HEADERS) \ $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libtests_la_LIBADD = am_libtests_la_OBJECTS = chi2test.lo correlation.lo countpdf.lo \ counturn.lo inverror.lo moments.lo printsample.lo quantiles.lo \ tests.lo timing.lo libtests_la_OBJECTS = $(am_libtests_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/chi2test.Plo \ ./$(DEPDIR)/correlation.Plo ./$(DEPDIR)/countpdf.Plo \ ./$(DEPDIR)/counturn.Plo ./$(DEPDIR)/inverror.Plo \ ./$(DEPDIR)/moments.Plo ./$(DEPDIR)/printsample.Plo \ ./$(DEPDIR)/quantiles.Plo ./$(DEPDIR)/tests.Plo \ ./$(DEPDIR)/timing.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libtests_la_SOURCES) DIST_SOURCES = $(libtests_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(includedir)" HEADERS = $(include_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autoconf/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILECMD = @FILECMD@ GREP = @GREP@ HAVE_DIVIDE_BY_ZERO = @HAVE_DIVIDE_BY_ZERO@ HAVE_IEEE_COMPARISONS = @HAVE_IEEE_COMPARISONS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNURAN_LT_VERSION = @UNURAN_LT_VERSION@ UNURAN_SUPPORTS_GSL = @UNURAN_SUPPORTS_GSL@ UNURAN_SUPPORTS_PRNG = @UNURAN_SUPPORTS_PRNG@ UNURAN_SUPPORTS_RNGSTREAM = @UNURAN_SUPPORTS_RNGSTREAM@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ have_valgrind = @have_valgrind@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = \ -I$(top_srcdir)/src noinst_LTLIBRARIES = libtests.la libtests_la_SOURCES = \ chi2test.c \ correlation.c\ countpdf.c \ counturn.c \ inverror.c \ moments.c \ printsample.c \ quantiles.c \ tests.c \ timing.c include_HEADERS = \ unuran_tests.h # clean backup files CLEANFILES = *~ # clean generated files MAINTAINERCLEANFILES = \ Makefile.in all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/tests/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/tests/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libtests.la: $(libtests_la_OBJECTS) $(libtests_la_DEPENDENCIES) $(EXTRA_libtests_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libtests_la_OBJECTS) $(libtests_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chi2test.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/correlation.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/countpdf.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/counturn.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inverror.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moments.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/printsample.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quantiles.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tests.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timing.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-includeHEADERS: $(include_HEADERS) @$(NORMAL_INSTALL) @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \ $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ done uninstall-includeHEADERS: @$(NORMAL_UNINSTALL) @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(includedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/chi2test.Plo -rm -f ./$(DEPDIR)/correlation.Plo -rm -f ./$(DEPDIR)/countpdf.Plo -rm -f ./$(DEPDIR)/counturn.Plo -rm -f ./$(DEPDIR)/inverror.Plo -rm -f ./$(DEPDIR)/moments.Plo -rm -f ./$(DEPDIR)/printsample.Plo -rm -f ./$(DEPDIR)/quantiles.Plo -rm -f ./$(DEPDIR)/tests.Plo -rm -f ./$(DEPDIR)/timing.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-includeHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/chi2test.Plo -rm -f ./$(DEPDIR)/correlation.Plo -rm -f ./$(DEPDIR)/countpdf.Plo -rm -f ./$(DEPDIR)/counturn.Plo -rm -f ./$(DEPDIR)/inverror.Plo -rm -f ./$(DEPDIR)/moments.Plo -rm -f ./$(DEPDIR)/printsample.Plo -rm -f ./$(DEPDIR)/quantiles.Plo -rm -f ./$(DEPDIR)/tests.Plo -rm -f ./$(DEPDIR)/timing.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-includeHEADERS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-includeHEADERS install-info install-info-am \ install-man install-pdf install-pdf-am install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am uninstall-includeHEADERS .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: unuran-1.11.0/src/tests/quantiles.c0000644001357500135600000002216414420304141014135 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * file: quantiles.c * * * * compute estimate for quartiles and mean of samples * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * ***************************************************************************** * * * REFERENCES: * * [1] R. Jain, I. Chlamtac (1985): The P^2 Algorithm for Dynamic * * Calculation of Quantiles and Histograms Without Storing * * Observations, Comm. ACM 28(19), pp. 1076-1085. * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "unuran_tests.h" /*---------------------------------------------------------------------------*/ static char test_name[] = "Quantiles"; /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ int unur_test_quartiles( UNUR_GEN *gen, double *q0 ,double *q1, double *q2, double *q3, double *q4, int samplesize, int verbosity, FILE *out ) /*----------------------------------------------------------------------*/ /* compute estimate for quartiles and mean of samples. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* q0 ... minimum */ /* q1 ... 1st quartile (25%) */ /* q2 ... median (2nd quartile, 50%) */ /* q3 ... 3rd quartile (75%) */ /* q4 ... maximum */ /* samplesize ... sample size */ /* verbosity ... verbosity level, 0 = no output, 1 = output */ /* out ... output stream */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { double x = 0.; int n; double p = 0.5; /* p-quantile -- median */ double h[5]; /* marker height */ int pos[5]; /* marker position */ double dpos[5]; /* desired position */ int i, j; /* loop variables */ int sgnd; /* sign of d */ double tmp; double d; /* (dp-p) at first, then sign */ /* check parameter */ _unur_check_NULL(test_name, gen, UNUR_ERR_NULL); /* type of distribution */ if (! ( ((gen->method & UNUR_MASK_TYPE) == UNUR_METH_DISCR) || ((gen->method & UNUR_MASK_TYPE) == UNUR_METH_CONT) )) { _unur_error(test_name,UNUR_ERR_GENERIC,"dont know how to compute quartiles for distribution"); return UNUR_ERR_GENERIC; } /* sample size >= 10 */ if (samplesize < 10) samplesize = 10; /* sampling */ /* estimate quartiles using algorithm [1]. */ for (n=0; nmethod & UNUR_MASK_TYPE) { case UNUR_METH_DISCR: x = _unur_sample_discr(gen); break; case UNUR_METH_CONT: x = _unur_sample_cont(gen); break; } /* ******************************************* */ /* PP-algorithm */ if ( n==0 ){ /* BEGIN OF INITIALIZATION */ h[n] = x; pos[n] = n; /* initialize desired positions */ dpos[0] = 0.; dpos[1] = p/2.; dpos[2] = 4.*p; dpos[3] = 2. + 2.*p; dpos[4] = 4.; } /* end of n==0 */ else if ( n<4 ){ /* 0 h[j+1] ){ /* swap */ tmp = h[j]; h[j] = h[j+1]; h[j+1] = tmp; } } } /* end of sorting */ } /* end of n==4 -- END OF INITIALIZATION */ else{ /* n > 4 */ /* adjust height of extreme markers */ if ( x < h[0] ) h[0] = x; if ( x > h[4] ) h[4] = x; /* adjust position of all markers */ for (i=1; i<4; i++){ if ( x < h[i] ){ pos[i]++; } } /* end of for */ pos[4]++; /* will always be at the last positon */ /* adjust desired position of all markers */ dpos[1] = (double) n * p/2.; dpos[2] = (double) n * p; dpos[3] = (double) n * (1.+p)/2.; dpos[4] = (double) n; /* adjust height of markers if necessary */ for (i=1; i<4; i++){ d = dpos[i] - pos[i]; /* discrepancy of position*/ /* decide on update of markers */ if ( (d >= 1. && pos[i+1]-pos[i] > 1) || (d <= -1. && pos[i-1]-pos[i] < -1) ){ /* markers are shifted by at most 1 */ sgnd = (d < 0.) ? -1 : 1; d = (double) sgnd; /* try parabolic formula */ tmp = h[i] + d/(pos[i+1]-pos[i-1]) * ( (pos[i]-pos[i-1]+d) * (h[i+1]-h[i])/(pos[i+1]-pos[i]) + (pos[i+1]-pos[i]-d) * (h[i]-h[i-1])/(pos[i]-pos[i-1]) ); /* use linear formula -- parabolic model failed */ if ( tmp <= h[i-1] || tmp >= h[i+1]){ tmp = h[i] + d*(h[i]-h[i+sgnd])/(pos[i]-pos[i+sgnd]); } h[i] = tmp; /* update height */ pos[i] += sgnd; /* update position */ } /* end if -- marker i updated */ } /* end for -- all markers updated */ /* for (i=0;i<5;i++) fprintf(out,"%6.2f ", h[i]); fprintf(out,"\n"); */ } /* end n>4 */ /* end of PP-algorithm */ /* ******************************************* */ } /* copy results */ *q0 = h[0]; *q1 = h[1]; *q2 = h[2]; *q3 = h[3]; *q4 = h[4]; /* now print results */ if (verbosity) { fprintf(out,"\nQuartiles:\n"); fprintf(out,"\tmin = \t%6.5g\n",*q0); fprintf(out,"\t25%% =\t%6.5g\n",*q1); fprintf(out,"\t50%% =\t%6.5g\n",*q2); fprintf(out,"\t75%% =\t%6.5g\n",*q3); fprintf(out,"\tmax = \t%6.5g\n",*q4); } return UNUR_SUCCESS; } /* end of unur_test_quartiles() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/tests/Makefile.am0000644001357500135600000000065714420445767014047 00000000000000## Process this file with automake to produce Makefile.in AM_CPPFLAGS = \ -I$(top_srcdir)/src noinst_LTLIBRARIES = libtests.la libtests_la_SOURCES = \ chi2test.c \ correlation.c\ countpdf.c \ counturn.c \ inverror.c \ moments.c \ printsample.c \ quantiles.c \ tests.c \ timing.c include_HEADERS = \ unuran_tests.h # clean backup files CLEANFILES = *~ # clean generated files MAINTAINERCLEANFILES = \ Makefile.in unuran-1.11.0/src/tests/countpdf.c0000644001357500135600000005431214420445767013776 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * file: countpdf.c * * * * Count evaluations of PDF and similar functions * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include #include "unuran_tests.h" /*---------------------------------------------------------------------------*/ static char test_name[] = "CountPDF"; /*---------------------------------------------------------------------------*/ /* common variables */ /*---------------------------------------------------------------------------*/ /* counter for evaluations of PDF and similar functions */ static int counter_pdf = 0; static int counter_dpdf = 0; static int counter_pdpdf = 0; static int counter_logpdf = 0; static int counter_dlogpdf = 0; static int counter_pdlogpdf = 0; static int counter_cdf = 0; static int counter_hr = 0; static int counter_pmf = 0; /* pointer to original functions */ static double (*cont_pdf_to_use)(double x, const struct unur_distr *distr); static double (*cont_dpdf_to_use)(double x, const struct unur_distr *distr); static double (*cont_logpdf_to_use)(double x, const struct unur_distr *distr); static double (*cont_dlogpdf_to_use)(double x, const struct unur_distr *distr); static double (*cont_cdf_to_use)(double x, const struct unur_distr *distr); static double (*cont_hr_to_use)(double x, const struct unur_distr *distr); static double (*discr_pmf_to_use)(int x, const struct unur_distr *distr); static double (*discr_cdf_to_use)(int x, const struct unur_distr *distr); static double (*cvec_pdf_to_use)(const double *x, struct unur_distr *distr); static int (*cvec_dpdf_to_use)(double *result, const double *x, struct unur_distr *distr); static double (*cvec_pdpdf_to_use)(const double *x, int coord, struct unur_distr *distr); static double (*cvec_logpdf_to_use)(const double *x, struct unur_distr *distr); static int (*cvec_dlogpdf_to_use)(double *result, const double *x, struct unur_distr *distr); static double (*cvec_pdlogpdf_to_use)(const double *x, int coord, struct unur_distr *distr); /*---------------------------------------------------------------------------*/ /* wrapper for functions */ /*---------------------------------------------------------------------------*/ static double cont_pdf_with_counter( double x, const struct unur_distr *distr ) { ++counter_pdf; return cont_pdf_to_use(x,distr); } static double cont_dpdf_with_counter( double x, const struct unur_distr *distr ) { ++counter_dpdf; return cont_dpdf_to_use(x,distr); } static double cont_logpdf_with_counter( double x, const struct unur_distr *distr ) { ++counter_logpdf; return cont_logpdf_to_use(x,distr); } static double cont_dlogpdf_with_counter( double x, const struct unur_distr *distr ) { ++counter_dlogpdf; return cont_dlogpdf_to_use(x,distr); } static double cont_cdf_with_counter( double x, const struct unur_distr *distr ) { ++counter_cdf; return cont_cdf_to_use(x,distr); } static double cont_hr_with_counter( double x, const struct unur_distr *distr ) { ++counter_hr; return cont_hr_to_use(x,distr); } /*---------------------------------------------------------------------------*/ static double discr_pmf_with_counter( int x, const struct unur_distr *distr ) { ++counter_pmf; return discr_pmf_to_use(x,distr); } static double discr_cdf_with_counter( int x, const struct unur_distr *distr ) { ++counter_cdf; return discr_cdf_to_use(x,distr); } /*---------------------------------------------------------------------------*/ static double cvec_pdf_with_counter( const double *x, struct unur_distr *distr ) { ++counter_pdf; return cvec_pdf_to_use(x,distr); } static int cvec_dpdf_with_counter( double *result, const double *x, struct unur_distr *distr ) { ++counter_dpdf; return cvec_dpdf_to_use(result,x,distr); } static double cvec_pdpdf_with_counter( const double *x, int coord, struct unur_distr *distr ) { ++counter_pdpdf; return cvec_pdpdf_to_use(x,coord,distr); } static double cvec_logpdf_with_counter( const double *x, struct unur_distr *distr ) { ++counter_logpdf; return cvec_logpdf_to_use(x,distr); } static int cvec_dlogpdf_with_counter( double *result, const double *x, struct unur_distr *distr ) { ++counter_dlogpdf; return cvec_dlogpdf_to_use(result,x,distr); } static double cvec_pdlogpdf_with_counter( const double *x, int coord, struct unur_distr *distr ) { ++counter_pdlogpdf; return cvec_pdlogpdf_to_use(x,coord,distr); } /*****************************************************************************/ int unur_test_count_pdf( struct unur_gen *gen, int samplesize, int verbosity, FILE *out ) /*----------------------------------------------------------------------*/ /* count evaluations of PDF and similar functions */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* samplesize ... sample size */ /* verbosity ... verbosity level, 0 = no output, 1 = output */ /* out ... output stream */ /* */ /* return: */ /* total number of evaluations of PDF and similar functions */ /* */ /* error: */ /* return -1 */ /*----------------------------------------------------------------------*/ { int j; int count; struct unur_gen *genclone; struct unur_distr *distr; /* check arguments */ _unur_check_NULL(test_name,gen,-1); /* make a copy (clone) of the generator object */ genclone = _unur_gen_clone(gen); /* get pointer to distribution object */ if (genclone->distr_is_privatecopy) distr = genclone->distr; else { /* we need a private copy of the distribution object in genclone */ distr = genclone->distr = _unur_distr_clone( gen->distr ); genclone->distr_is_privatecopy = TRUE; } /* exchange pointer to PDF etc. with counting wrapper */ switch (distr->type) { case UNUR_DISTR_CONT: cont_pdf_to_use = distr->data.cont.pdf; distr->data.cont.pdf = cont_pdf_with_counter; cont_dpdf_to_use = distr->data.cont.dpdf; distr->data.cont.dpdf = cont_dpdf_with_counter; cont_cdf_to_use = distr->data.cont.cdf; distr->data.cont.cdf = cont_cdf_with_counter; cont_hr_to_use = distr->data.cont.hr; distr->data.cont.hr = cont_hr_with_counter; if (distr->data.cont.logpdf) { cont_logpdf_to_use = distr->data.cont.logpdf; distr->data.cont.logpdf = cont_logpdf_with_counter; } if (distr->data.cont.dlogpdf) { cont_dlogpdf_to_use = distr->data.cont.dlogpdf; distr->data.cont.dlogpdf = cont_dlogpdf_with_counter; } break; case UNUR_DISTR_DISCR: discr_pmf_to_use = distr->data.discr.pmf; distr->data.discr.pmf = discr_pmf_with_counter; discr_cdf_to_use = distr->data.discr.cdf; distr->data.discr.cdf = discr_cdf_with_counter; break; case UNUR_DISTR_CVEC: cvec_pdf_to_use = distr->data.cvec.pdf; distr->data.cvec.pdf = cvec_pdf_with_counter; cvec_dpdf_to_use = distr->data.cvec.dpdf; distr->data.cvec.dpdf = cvec_dpdf_with_counter; cvec_pdpdf_to_use = distr->data.cvec.pdpdf; distr->data.cvec.pdpdf = cvec_pdpdf_with_counter; if (distr->data.cvec.logpdf) { cvec_logpdf_to_use = distr->data.cvec.logpdf; distr->data.cvec.logpdf = cvec_logpdf_with_counter; } if (distr->data.cvec.dlogpdf) { cvec_dlogpdf_to_use = distr->data.cvec.dlogpdf; distr->data.cvec.dlogpdf = cvec_dlogpdf_with_counter; } if (distr->data.cvec.pdlogpdf) { cvec_pdlogpdf_to_use = distr->data.cvec.pdlogpdf; distr->data.cvec.pdlogpdf = cvec_pdlogpdf_with_counter; } break; default: if (verbosity) fprintf(out,"\nCOUNT-PDF: cannot count PDF for distribution type)\n"); _unur_free(genclone); return -1; } /* reset counter */ counter_pdf = 0; counter_dpdf = 0; counter_pdpdf = 0; counter_logpdf = 0; counter_dlogpdf = 0; counter_pdlogpdf = 0; counter_cdf = 0; counter_hr = 0; counter_pmf = 0; /* run generator */ switch (genclone->method & UNUR_MASK_TYPE) { case UNUR_METH_DISCR: for( j=0; jtype) { case UNUR_DISTR_CONT: fprintf(out,"\tPDF: %7d (%g)\n",counter_pdf,((double)counter_pdf)/((double) samplesize)); fprintf(out,"\tdPDF: %7d (%g)\n",counter_dpdf,((double)counter_dpdf)/((double) samplesize)); fprintf(out,"\tlogPDF: %7d (%g)\n",counter_logpdf,((double)counter_logpdf)/((double) samplesize)); fprintf(out,"\tdlogPDF: %7d (%g)\n",counter_dlogpdf,((double)counter_dlogpdf)/((double) samplesize)); fprintf(out,"\tCDF: %7d (%g)\n",counter_cdf,((double)counter_cdf)/((double) samplesize)); fprintf(out,"\tHR: %7d (%g)\n",counter_hr,((double)counter_hr)/((double) samplesize)); break; case UNUR_DISTR_CVEC: fprintf(out,"\tPDF: %7d (%g)\n",counter_pdf,((double)counter_pdf)/((double) samplesize)); fprintf(out,"\tdPDF: %7d (%g)\n",counter_dpdf,((double)counter_dpdf)/((double) samplesize)); fprintf(out,"\tpdPDF: %7d (%g)\n",counter_pdpdf,((double)counter_pdpdf)/((double) samplesize)); fprintf(out,"\tlogPDF: %7d (%g)\n",counter_logpdf,((double)counter_logpdf)/((double) samplesize)); fprintf(out,"\tdlogPDF: %7d (%g)\n",counter_dlogpdf,((double)counter_dlogpdf)/((double) samplesize)); fprintf(out,"\tpdlogPDF:%7d (%g)\n",counter_dlogpdf,((double)counter_dlogpdf)/((double) samplesize)); break; case UNUR_DISTR_DISCR: fprintf(out,"\tPMF: %7d (%g)\n",counter_pmf,((double)counter_pmf)/((double) samplesize)); fprintf(out,"\tCDF: %7d (%g)\n",counter_cdf,((double)counter_cdf)/((double) samplesize)); break; } } /* remove clone */ _unur_free(genclone); /* return total number of evaluations */ return count; } /* end of unur_test_count_pdf() */ /*****************************************************************************/ int unur_test_par_count_pdf( struct unur_par *par, int samplesize, int verbosity, FILE *out ) /*----------------------------------------------------------------------*/ /* count evaluations of PDF and similar functions */ /* */ /* parameters: */ /* par ... pointer to parameter object */ /* samplesize ... sample size */ /* verbosity ... verbosity level, 0 = no output, 1 = output */ /* out ... output stream */ /* */ /* return: */ /* total number of evaluations of PDF and similar functions */ /* */ /* error: */ /* return -1 */ /*----------------------------------------------------------------------*/ { int j; int count, count_total; struct unur_par *parclone; struct unur_gen *gen; struct unur_distr *distr; /* check arguments */ _unur_check_NULL(test_name,par,-1); /* make a copy (clone) of the parameter object */ parclone = _unur_par_clone(par); parclone->distr_is_privatecopy = TRUE; /* make a copy (clone) of the distribution object */ distr = _unur_distr_clone(par->distr); /* set pointer to distribution object in parameter object to cloned one */ parclone->distr = distr; /* exchange pointer to PDF etc. with counting wrapper */ switch (distr->type) { case UNUR_DISTR_CONT: cont_pdf_to_use = distr->data.cont.pdf; distr->data.cont.pdf = cont_pdf_with_counter; cont_dpdf_to_use = distr->data.cont.dpdf; distr->data.cont.dpdf = cont_dpdf_with_counter; cont_cdf_to_use = distr->data.cont.cdf; distr->data.cont.cdf = cont_cdf_with_counter; cont_hr_to_use = distr->data.cont.hr; distr->data.cont.hr = cont_hr_with_counter; if (distr->data.cont.logpdf) { cont_logpdf_to_use = distr->data.cont.logpdf; distr->data.cont.logpdf = cont_logpdf_with_counter; } if (distr->data.cont.dlogpdf) { cont_dlogpdf_to_use = distr->data.cont.dlogpdf; distr->data.cont.dlogpdf = cont_dlogpdf_with_counter; } break; case UNUR_DISTR_DISCR: discr_pmf_to_use = distr->data.discr.pmf; distr->data.discr.pmf = discr_pmf_with_counter; discr_cdf_to_use = distr->data.discr.cdf; distr->data.discr.cdf = discr_cdf_with_counter; break; case UNUR_DISTR_CVEC: cvec_pdf_to_use = distr->data.cvec.pdf; distr->data.cvec.pdf = cvec_pdf_with_counter; cvec_dpdf_to_use = distr->data.cvec.dpdf; distr->data.cvec.dpdf = cvec_dpdf_with_counter; cvec_pdpdf_to_use = distr->data.cvec.pdpdf; distr->data.cvec.pdpdf = cvec_pdpdf_with_counter; if (distr->data.cvec.logpdf) { cvec_logpdf_to_use = distr->data.cvec.logpdf; distr->data.cvec.logpdf = cvec_logpdf_with_counter; } if (distr->data.cvec.dlogpdf) { cvec_dlogpdf_to_use = distr->data.cvec.dlogpdf; distr->data.cvec.dlogpdf = cvec_dlogpdf_with_counter; } if (distr->data.cvec.pdlogpdf) { cvec_pdlogpdf_to_use = distr->data.cvec.pdlogpdf; distr->data.cvec.pdlogpdf = cvec_pdlogpdf_with_counter; } break; default: if (verbosity) fprintf(out,"\nCOUNT-PDF: cannot count PDF for distribution type)\n"); _unur_par_free(parclone); _unur_distr_free(distr); return -1; } /* reset counter */ counter_pdf = 0; counter_dpdf = 0; counter_pdpdf = 0; counter_logpdf = 0; counter_dlogpdf = 0; counter_pdlogpdf = 0; counter_cdf = 0; counter_hr = 0; counter_pmf = 0; /* init generator */ gen = _unur_init(parclone); /* total number of function calls */ count = ( counter_pdf + counter_dpdf + counter_pdpdf + counter_logpdf + counter_dlogpdf + counter_pdlogpdf + counter_cdf + counter_hr + counter_pmf); count_total = count; /* print result */ if (verbosity) { fprintf(out, "\nCOUNT: Initializing Generator:\n"); fprintf(out, "\tfunction calls\n"); fprintf(out, "\ttotal: %7d\n",count); switch (distr->type) { case UNUR_DISTR_CONT: fprintf(out,"\tPDF: %7d\n",counter_pdf); fprintf(out,"\tdPDF: %7d\n",counter_dpdf); fprintf(out,"\tlogPDF: %7d\n",counter_logpdf); fprintf(out,"\tdlogPDF: %7d\n",counter_dlogpdf); fprintf(out,"\tCDF: %7d\n",counter_cdf); fprintf(out,"\tHR: %7d\n",counter_hr); break; case UNUR_DISTR_CVEC: fprintf(out,"\tPDF: %7d\n",counter_pdf); fprintf(out,"\tdPDF: %7d\n",counter_dpdf); fprintf(out,"\tpdPDF: %7d\n",counter_pdpdf); fprintf(out,"\tlogPDF: %7d\n",counter_logpdf); fprintf(out,"\tdlogPDF: %7d\n",counter_dlogpdf); fprintf(out,"\tpdlogPDF:%7d\n",counter_pdlogpdf); break; case UNUR_DISTR_DISCR: fprintf(out,"\tPMF: %7d\n",counter_pmf); fprintf(out,"\tCDF: %7d\n",counter_cdf); break; } } /* reset counter */ counter_pdf = 0; counter_dpdf = 0; counter_pdpdf = 0; counter_logpdf = 0; counter_dlogpdf = 0; counter_pdlogpdf = 0; counter_cdf = 0; counter_hr = 0; counter_pmf = 0; /* run generator */ switch (gen->method & UNUR_MASK_TYPE) { case UNUR_METH_DISCR: for( j=0; jtype) { case UNUR_DISTR_CONT: fprintf(out,"\tPDF: %7d (%g)\n",counter_pdf,((double)counter_pdf)/((double) samplesize)); fprintf(out,"\tdPDF: %7d (%g)\n",counter_dpdf,((double)counter_dpdf)/((double) samplesize)); fprintf(out,"\tlogPDF: %7d (%g)\n",counter_logpdf,((double)counter_logpdf)/((double) samplesize)); fprintf(out,"\tdlogPDF: %7d (%g)\n",counter_dlogpdf,((double)counter_dlogpdf)/((double) samplesize)); fprintf(out,"\tCDF: %7d (%g)\n",counter_cdf,((double)counter_cdf)/((double) samplesize)); fprintf(out,"\tHR: %7d (%g)\n",counter_hr,((double)counter_hr)/((double) samplesize)); break; case UNUR_DISTR_CVEC: fprintf(out,"\tPDF: %7d (%g)\n",counter_pdf,((double)counter_pdf)/((double) samplesize)); fprintf(out,"\tdPDF: %7d (%g)\n",counter_dpdf,((double)counter_dpdf)/((double) samplesize)); fprintf(out,"\tpdPDF: %7d (%g)\n",counter_pdpdf,((double)counter_pdpdf)/((double) samplesize)); fprintf(out,"\tlogPDF: %7d (%g)\n",counter_logpdf,((double)counter_logpdf)/((double) samplesize)); fprintf(out,"\tdlogPDF: %7d (%g)\n",counter_dlogpdf,((double)counter_dlogpdf)/((double) samplesize)); fprintf(out,"\tpdlogPDF:%7d (%g)\n",counter_pdlogpdf,((double)counter_pdlogpdf)/((double) samplesize)); break; case UNUR_DISTR_DISCR: fprintf(out,"\tPMF: %7d (%g)\n",counter_pmf,((double)counter_pmf)/((double) samplesize)); fprintf(out,"\tCDF: %7d (%g)\n",counter_cdf,((double)counter_cdf)/((double) samplesize)); break; } } /* free memory */ _unur_free(gen); _unur_distr_free(distr); /* return total number of evaluations */ return count; } /* end of unur_test_count_pdf() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/tests/counturn.c0000644001357500135600000001630514420445767014031 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * file: counturn.c * * * * Count used uniform random numbers * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include "unuran_tests.h" /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ static char test_name[] = "CountURN"; /*---------------------------------------------------------------------------*/ /* common variables */ static long urng_counter = 0; /* count uniform random numbers */ /*---------------------------------------------------------------------------*/ /* wrapper for uniform random number generator that performs counting */ /*---------------------------------------------------------------------------*/ #ifdef UNUR_URNG_UNURAN /*---------------------------------------------------------------------------*/ static double (*urng_to_use)(void*); /* pointer to real uniform RNG */ /*---------------------------------------------------------------------------*/ static double _urng_with_counter(void *params) /*----------------------------------------------------------------------*/ /* wrapper for uniform random number generator that performs counting */ /*----------------------------------------------------------------------*/ { ++urng_counter; return urng_to_use(params); } /* end of urng_with_counter() */ /*---------------------------------------------------------------------------*/ #endif /* UNUR_URNG_UNURAN */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ int unur_test_count_urn( struct unur_gen *gen, int samplesize, int verbosity, FILE *out ) /*----------------------------------------------------------------------*/ /* count used uniform random numbers */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* samplesize ... sample size */ /* verbosity ... verbosity level, 0 = no output, 1 = output */ /* out ... output stream */ /* */ /* return: */ /* total number of used uniform random numbers */ /* */ /* error: */ /* return -1 */ /*----------------------------------------------------------------------*/ { long j; UNUR_URNG *urng_aux; /* check arguments */ _unur_check_NULL(test_name,gen,-1); /* reset counter */ urng_counter = 0; /* save auxilliary generator */ urng_aux = gen->urng_aux; /* exchange pointer to uniform rng with counting wrapper */ #ifdef UNUR_URNG_UNURAN urng_to_use = gen->urng->sampleunif; gen->urng->sampleunif = _urng_with_counter; if (gen->urng_aux) gen->urng_aux = gen->urng; #else /* no counter available */ if (verbosity) fprintf(out,"\nCOUNT: --- (cannot count URNs)\n"); return -1; #endif /* run generator */ switch (gen->method & UNUR_MASK_TYPE) { case UNUR_METH_DISCR: for( j=0; jurng->sampleunif = urng_to_use; #endif /* restore auxilliary generator */ gen->urng_aux = urng_aux; /* print result */ if (verbosity) { fprintf(out,"\nCOUNT: %g urng per generated number (total = %ld)\n", ((double)urng_counter)/((double) samplesize),urng_counter); } /* return total number of used uniform random numbers */ return urng_counter; } /* end of unur_test_count_urn() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/tests/correlation.c0000644001357500135600000002744314420445767014502 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * file: correlation.c * * * * compute correlation coefficient of two samples * * * ***************************************************************************** * * * REFERENCES: * * [1] Spicer C.C. (1972): Algorithm AS 52: Calculation of Power Sums of * * Deviations about the mean, Applied Statistics 21(2), pp. 226-227. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include "unuran_tests.h" /*---------------------------------------------------------------------------*/ static char test_name[] = "Correlation"; /*---------------------------------------------------------------------------*/ #define CORR_DEFAULT_SAMPLESIZE 10000 /* default sample size used when the given size is <= 0 */ #define CORR_MAX_SAMPLESIZE 10000000 /* maximal sample size to prevent extremely long run times */ /*---------------------------------------------------------------------------*/ double unur_test_correlation( UNUR_GEN *genx, UNUR_GEN *geny, int samplesize, int verbosity, FILE *out ) /*----------------------------------------------------------------------*/ /* compute correlation coefficient of two samples. */ /* */ /* parameters: */ /* genx ... pointer to generator object */ /* geny ... pointer to another generator object */ /* samplesize ... sample size */ /* verbosity ... verbosity level, 0 = no output, 1 = output */ /* out ... output stream */ /* */ /* return: */ /* correlation coefficient */ /* */ /* error: */ /* -2. ... missing data */ /* -3. ... other errors */ /*----------------------------------------------------------------------*/ { double x =0., y =0.; /* contains random numbers */ double mx =0., my=0.; /* mean values (analog to s1 in [1] */ double dx =0., dy=0.; /* analog to delta in [1] */ double sx =0., sy=0.; /* analog to s2 in [1] */ double sxy=0.; /* analog to s2 in [1] */ double factor; int n; /* check parameter */ _unur_check_NULL(test_name,genx,-3.); _unur_check_NULL(test_name,geny,-3.); /* type of distribution */ if (! ( ((genx->method & UNUR_MASK_TYPE) == UNUR_METH_DISCR) || ((genx->method & UNUR_MASK_TYPE) == UNUR_METH_CONT) )) { _unur_error(test_name,UNUR_ERR_GENERIC, "dont know how to compute correlation coefficient for distribution"); return -2.; } if (! ( ((geny->method & UNUR_MASK_TYPE) == UNUR_METH_DISCR) || ((geny->method & UNUR_MASK_TYPE) == UNUR_METH_CONT) )) { _unur_error(test_name,UNUR_ERR_GENERIC, "dont know how to compute correlation coefficient for distribution"); return -2.; } /* samplesize */ if( samplesize <= 0 ) samplesize = CORR_DEFAULT_SAMPLESIZE; samplesize = _unur_min( samplesize, CORR_MAX_SAMPLESIZE ); /* sampling */ for (n=1; n<=samplesize; n++) { /* which type of distribution */ switch (genx->method & UNUR_MASK_TYPE) { case UNUR_METH_DISCR: x = _unur_sample_discr(genx); break; case UNUR_METH_CONT: x = _unur_sample_cont(genx); break; } switch (geny->method & UNUR_MASK_TYPE) { case UNUR_METH_DISCR: y = _unur_sample_discr(geny); break; case UNUR_METH_CONT: y = _unur_sample_cont(geny); break; } factor = (double) ( n*(n-1) ); dx = (x - mx) / n; dy = (y - my) / n; mx += dx; my += dy; sx += factor * dx*dx; sy += factor * dy*dy; sxy += factor * dx*dy; /* fprintf(out,"sx:%f sy:%f sxy:%f, c:%f\n",sx,sy,sxy, sxy/(sqrt(sx*sy)) ); */ } /* now print results */ if (verbosity) { fprintf(out,"\nCorrelation coefficient: %g\n\n", sxy/(sqrt(sx*sy)) ); } return ( sxy/(sqrt(sx*sy)) ); } /* end of unur_test_correlation() */ /*---------------------------------------------------------------------------*/ int unur_test_cvec_rankcorr( double *rc, struct unur_gen *gen, int samplesize, int verbose, FILE *out ) /*----------------------------------------------------------------------*/ /* compute rank correlations between components of random vector. */ /* */ /* parameters: */ /* rc ... pointer to dimxdim array to result */ /* gen ... pointer to multivariate generator object */ /* samplesize ... sample size */ /* verbose ... verbosity level, 0 = no output, 1 = output */ /* out ... output stream */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { #define DISTR gen->distr->data.cvec #define idx(a,b) ((a)*dim+(b)) double *mx; /* mean values (analog to s1 in [1] */ double *dx; /* analog to delta in [1] */ double factor; int dim; /* dimension of multivariate distribution */ UNUR_DISTR **marginals; /* pointer to marginal distributions */ UNUR_FUNCT_CONT **marginal_cdf; /* pointer to CDFs of marginal distributions */ double *X; /* sampling vector */ double *U; /* X transformed to uniform */ int i, j, n; /* auxiliary variables */ /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); /* we do not check magic cookies here */ if (verbose >= 1) fprintf(out,"\nRank correlations of random vector:\n"); /* samplesize */ if( samplesize <= 0 ) samplesize = CORR_DEFAULT_SAMPLESIZE; samplesize = _unur_min( samplesize, CORR_MAX_SAMPLESIZE ); /* dimension of distribution */ dim = gen->distr->dim; if (dim < 1) { _unur_error(test_name,UNUR_ERR_GENERIC,"distribution dimension < 1 ?"); return UNUR_ERR_GENERIC; } /* type of distribution */ if ( (gen->method & UNUR_MASK_TYPE) != UNUR_METH_VEC ) { _unur_error(test_name,UNUR_ERR_GENERIC, "rank correlation coefficients cannot be computed"); return UNUR_ERR_GENERIC; } /* we need all marginal distributions */ if (DISTR.marginals==NULL) { _unur_error(gen->distr->name,UNUR_ERR_DISTR_REQUIRED,"marginal distributions"); return UNUR_ERR_DISTR_REQUIRED; } marginals = _unur_xmalloc(dim * sizeof(UNUR_DISTR *)); marginal_cdf = _unur_xmalloc(dim * sizeof(UNUR_FUNCT_CONT *)); for (i=0; idistr->name,UNUR_ERR_DISTR_REQUIRED,"CDF of continuous marginal"); free (marginals); free (marginal_cdf); return UNUR_ERR_DISTR_REQUIRED; } } /* allocate working space memory */ X = _unur_xmalloc( dim * sizeof(double)); U = _unur_xmalloc( dim * sizeof(double)); mx = _unur_xmalloc( dim * sizeof(double)); dx = _unur_xmalloc( dim * sizeof(double)); /* clear working arrays */ for (i=0; i= 1) _unur_matrix_print_matrix( dim, rc, "rank correlation =", out, "", "\t"); /* free memory */ if (X) free(X); if (U) free(U); if (mx) free(mx); if (dx) free(dx); if (marginals) free (marginals); if (marginal_cdf) free (marginal_cdf); /* return result of test */ return UNUR_SUCCESS; #undef DISTR #undef idx } /* end of unur_test_cvec_rankcorr() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/tests/tests.c0000644001357500135600000003205514420445767013316 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: testw.c * * * * run various statistical tests, timing, ... * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include "unuran_tests.h" /*---------------------------------------------------------------------------*/ #define TEST_TIMING_LOG_SAMPLESIZE 5 /* common log of sample size for timing (>= 2!!) */ #define TEST_COUNTER_SAMPLESIZE 100000 /* sample size for counting number of URNs */ #define TEST_SAMPLE_ROWS 10 /* number of rows and columns for sample */ #define TEST_SAMPLE_COLS 10 #define TEST_CHI2_VERBOSE 1 /* output switch for chi^2 test */ #define TEST_CHI2_INTERVALS 100 /* number of intervals for chi^2 test */ /*---------------------------------------------------------------------------*/ /* some tools */ static int _unur_print_method( struct unur_par *par, FILE *out ); /*---------------------------------------------------------------------------*/ /***************************************************************************** * * * Run different tests * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ void unur_run_tests( struct unur_par *par, unsigned tests, FILE *out ) /*----------------------------------------------------------------------*/ /* test generator */ /* */ /* parameters: */ /* par ... pointer to paramters for building generator object */ /* tests ... list of tests (stored as bit array) */ /* out ... output stream */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen = NULL; struct unur_par *par_clone = NULL; double time_setup, time_sample; /* check arguments */ _unur_check_NULL("Tests",par,RETURN_VOID); if (!out) out = stdout; /* print info about method */ if (_unur_print_method(par,out)!=UNUR_SUCCESS) return; /* unknown method */ /* make a clone of the parameter object which will be needed for counting PDF calls */ par_clone = _unur_par_clone(par); /* init generator object */ if (tests & UNUR_TEST_TIME) /* evaluate setup time and generation time */ gen = unur_test_timing(par,TEST_TIMING_LOG_SAMPLESIZE, &time_setup, &time_sample, TRUE, out); else gen = _unur_init(par); /* init successful ? */ if (!gen) { _unur_par_free(par_clone); return; } /* count number of uniform random numbers */ if (tests & UNUR_TEST_N_URNG ) unur_test_count_urn(gen,TEST_COUNTER_SAMPLESIZE, TRUE, out); /* count PDF calls */ if (tests & UNUR_TEST_N_PDF ) unur_test_par_count_pdf(par_clone,TEST_COUNTER_SAMPLESIZE, TRUE, out); /* print a sample */ if (tests & UNUR_TEST_SAMPLE ) unur_test_printsample(gen,TEST_SAMPLE_ROWS,TEST_SAMPLE_COLS, out); /* run chi2-test*/ if (tests & UNUR_TEST_CHI2) unur_test_chi2(gen,TEST_CHI2_INTERVALS,0,0,TEST_CHI2_VERBOSE, out); /* free generator */ _unur_free(gen); /* free parameter object */ _unur_par_free(par_clone); return; } /* end of unur_run_tests() */ /*---------------------------------------------------------------------------*/ /***************************************************************************** * * * Some tools * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ int _unur_print_method( struct unur_par *par, FILE *out ) /*----------------------------------------------------------------------*/ /* print name of method */ /* */ /* parameters: */ /* par ... pointer to paramters for building generator object */ /* out ... output stream */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* first print type */ switch (par->distr->type) { case UNUR_DISTR_DISCR: fprintf(out,"\nTYPE:\t\tdiscrete univariate distribution\n"); break; case UNUR_DISTR_CONT: fprintf(out,"\nTYPE:\t\tcontinuous univariate distribution\n"); break; case UNUR_DISTR_CEMP: fprintf(out,"\nTYPE:\t\tcontinuous univariate empirical distribution\n"); break; case UNUR_DISTR_CVEC: fprintf(out,"\nTYPE:\t\tcontinuous multivariate distribution\n"); break; default: /* unknown ! */ _unur_error("Tests",UNUR_ERR_GENERIC,"type of method unknown!"); return UNUR_ERR_GENERIC; } /* print method description */ switch (par->method) { /* automatic method */ case UNUR_METH_AUTO: COOKIE_CHECK(par,CK_AUTO_PAR,UNUR_ERR_COOKIE); fprintf(out,"METHOD:\t\tautomatic selection (AUTO)\n"); break; /* discrete, univariate */ case UNUR_METH_DAU: COOKIE_CHECK(par,CK_DAU_PAR,UNUR_ERR_COOKIE); fprintf(out,"METHOD:\t\talias and alias-urn method (DAU)\n"); break; case UNUR_METH_DGT: COOKIE_CHECK(par,CK_DGT_PAR,UNUR_ERR_COOKIE); fprintf(out,"METHOD:\t\tindexed search -- guide table (DGT)\n"); break; case UNUR_METH_DSROU: COOKIE_CHECK(par,CK_DSROU_PAR,UNUR_ERR_COOKIE); fprintf(out,"METHOD:\t\tdiscrete simple universal ratio-of-uniforms search (DSROU)\n"); break; case UNUR_METH_DSS: COOKIE_CHECK(par,CK_DSS_PAR,UNUR_ERR_COOKIE); fprintf(out,"METHOD:\t\tsequential search (DSS)\n"); break; case UNUR_METH_DSTD: COOKIE_CHECK(par,CK_DSTD_PAR,UNUR_ERR_COOKIE); fprintf(out,"METHOD:\t\tspecial (DSTD)\n"); break; case UNUR_METH_DEXT: COOKIE_CHECK(par,CK_DEXT_PAR,UNUR_ERR_COOKIE); fprintf(out,"METHOD:\t\texternal generator (DEXT)\n"); break; /* continuous, univariate */ case UNUR_METH_AROU: COOKIE_CHECK(par,CK_AROU_PAR,UNUR_ERR_COOKIE); fprintf(out,"METHOD:\t\tautomatic ratio-of-uniforms method (NINV)\n"); break; case UNUR_METH_HINV: COOKIE_CHECK(par,CK_HINV_PAR,UNUR_ERR_COOKIE); fprintf(out,"METHOD:\t\tnumerical inversion of CDF by Hermite Interpolation (HINV)\n"); break; case UNUR_METH_ITDR: COOKIE_CHECK(par,CK_ITDR_PAR,UNUR_ERR_COOKIE); fprintf(out,"METHOD:\t\tinverse transformed density rejection (ITDR)\n"); break; case UNUR_METH_NINV: COOKIE_CHECK(par,CK_NINV_PAR,UNUR_ERR_COOKIE); fprintf(out,"METHOD:\t\tnumerical inversion of CDF (NINV)\n"); break; case UNUR_METH_NROU: COOKIE_CHECK(par,CK_NROU_PAR,UNUR_ERR_COOKIE); fprintf(out,"METHOD:\t\tnaive universal ratio-of-uniforms method (NROU)\n"); break; case UNUR_METH_PINV: COOKIE_CHECK(par,CK_PINV_PAR,UNUR_ERR_COOKIE); fprintf(out,"METHOD:\t\tpolynomial interpolation based inversion of CDF (PINV)\n"); break; case UNUR_METH_SROU: COOKIE_CHECK(par,CK_SROU_PAR,UNUR_ERR_COOKIE); fprintf(out,"METHOD:\t\tsimple universal ratio-of-uniforms method (SROU)\n"); break; case UNUR_METH_SSR: COOKIE_CHECK(par,CK_SSR_PAR,UNUR_ERR_COOKIE); fprintf(out,"METHOD:\t\tsimple transformed density rejection with universal bounds (SSR)\n"); break; case UNUR_METH_TABL: COOKIE_CHECK(par,CK_TABL_PAR,UNUR_ERR_COOKIE); fprintf(out,"METHOD:\t\trejection from piecewise constant hat (TABL)\n"); break; case UNUR_METH_TDR: COOKIE_CHECK(par,CK_TDR_PAR,UNUR_ERR_COOKIE); fprintf(out,"METHOD:\t\ttransformed density rejection (TDR)\n"); break; case UNUR_METH_UTDR: COOKIE_CHECK(par,CK_UTDR_PAR,UNUR_ERR_COOKIE); fprintf(out,"METHOD:\t\ttransformed density rejection, 3-point method (UTDR)\n"); break; case UNUR_METH_CSTD: COOKIE_CHECK(par,CK_CSTD_PAR,UNUR_ERR_COOKIE); fprintf(out,"METHOD:\t\tspecial (CSTD)\n"); break; case UNUR_METH_CEXT: COOKIE_CHECK(par,CK_CEXT_PAR,UNUR_ERR_COOKIE); fprintf(out,"METHOD:\t\texternal generator (CEXT)\n"); break; /* continuous, empirical */ case UNUR_METH_EMPK: COOKIE_CHECK(par,CK_EMPK_PAR,UNUR_ERR_COOKIE); fprintf(out,"METHOD:\t\tempirical distribution with kernel smoothing (EMPK)\n"); break; /* continuous, multivariate (random vector) */ case UNUR_METH_GIBBS: COOKIE_CHECK(par,CK_GIBBS_PAR,UNUR_ERR_COOKIE); fprintf(out,"METHOD:\t\tMarkov Chain - GIBBS sampler (GIBBS)\n"); break; case UNUR_METH_HITRO: COOKIE_CHECK(par,CK_HITRO_PAR,UNUR_ERR_COOKIE); fprintf(out,"METHOD:\t\thit&run ratio-of-uniforms (HITRO)\n"); break; case UNUR_METH_MVSTD: COOKIE_CHECK(par,CK_MVSTD_PAR,UNUR_ERR_COOKIE); fprintf(out,"METHOD:\t\tspecial (MVSTD)\n"); break; case UNUR_METH_MVTDR: COOKIE_CHECK(par,CK_MVTDR_PAR,UNUR_ERR_COOKIE); fprintf(out,"METHOD:\t\tmultivariate transformed density rejection (MVTDR)\n"); break; case UNUR_METH_NORTA: COOKIE_CHECK(par,CK_NORTA_PAR,UNUR_ERR_COOKIE); fprintf(out,"METHOD:\t\tnormal to anything (NORTA)\n"); break; case UNUR_METH_VMT: COOKIE_CHECK(par,CK_VMT_PAR,UNUR_ERR_COOKIE); fprintf(out,"METHOD:\t\tvector matrix transformation (VMT)\n"); break; case UNUR_METH_VNROU: COOKIE_CHECK(par,CK_VNROU_PAR,UNUR_ERR_COOKIE); fprintf(out,"METHOD:\t\tvector naive ratio-of-uniforms (VNROU)\n"); break; /* misc */ case UNUR_METH_UNIF: COOKIE_CHECK(par,CK_UNIF_PAR,UNUR_ERR_COOKIE); fprintf(out,"METHOD:\t\twrapper for uniform (UNIF)\n"); break; default: /* unknown ! */ _unur_error("Tests",UNUR_ERR_GENERIC,"method unknown!"); return UNUR_ERR_GENERIC; } /* everything o.k. */ return UNUR_SUCCESS; } /* end of _unur_print_method() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/tests/chi2test.c0000644001357500135600000011643114420445767013702 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * file: chi2test.c * * * * Chi^2 Tests (to validate implementation) * * * * WARNING! * * A succesfull chi^2 test shows that the implementation is (probably) * * correct. It DOES NOT mean that the generator is of good quality! * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include #include #include #include #include #include "unuran_tests.h" /*---------------------------------------------------------------------------*/ /* constants */ #define CHI2_SAMPLEFAC 40 /* if samplesize<=0 use samplesize = CHI2_SAMPLEFAC * intervals^dim */ #define CHI2_CLASSMIN_DEFAULT 20 /* default number of observations in class */ #define CHI2_INTERVALS_DEFAULT 50 /* default number of intervals for chi^2 test if given number is <= 0 */ #define CHI2_DEFAULT_SAMPLESIZE 10000 /* default sample size used when the given size is <= 0 */ #define CHI2_MAX_SAMPLESIZE 1000000 /* maximal sample size to prevent extremely long run times */ #define CHI2_MAX_TOTALINTERVALS 1000000 /* maximal product of intervals used in chi2vec test */ /*---------------------------------------------------------------------------*/ static char test_name[] = "Chi^2-Test"; /*---------------------------------------------------------------------------*/ static double _unur_test_chi2_discr( struct unur_gen *gen, int samplesize, int classmin, int verbose, FILE *out ); static double _unur_test_chi2_cont( struct unur_gen *gen, int n_intervals, int samplesize, int classmin, int verbose, FILE *out ); static double _unur_test_chi2_cemp( struct unur_gen *gen, int n_intervals, int samplesize, int classmin, int verbose, FILE *out ); static double _unur_test_chi2_vec( struct unur_gen *gen, int n_intervals, int samplesize, int classmin, int verbose, FILE *out ); static double _unur_test_chi2_cvemp( struct unur_gen *gen, int n_intervals, int samplesize, int classmin, int verbose, FILE *out ); static double _unur_test_chi2test( double *prob, int *observed, int len, int classmin, int verbose, FILE *out ); /*---------------------------------------------------------------------------*/ double unur_test_chi2( struct unur_gen *gen, int n_intervals, int samplesize, int classmin, int verbose, FILE *out ) /*----------------------------------------------------------------------*/ /* Chi^2 test for univariate distributions */ /* */ /* parameters: */ /* gen ... pointer to generator */ /* n_intervals .. number if intervals */ /* case probability vector: use its length */ /* otherwise and if <= 0 use default */ /* samplesize ... samplesize for test */ /* (if <= 0, (#classes)^2 is used as default.) */ /* classmin ... minimum number of expected occurrences for each class */ /* (if <= 0, a default value is used.) */ /* verbose ... verbosity level */ /* 0 = no output on out */ /* 1 = print summary */ /* 2 = print classes and summary */ /* out ... output stream */ /* */ /* */ /* return: */ /* p-value of test statistics under H_0 */ /* */ /* error: */ /* -2. ... missing data */ /* -1. ... other errors */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL(test_name,gen,-1.); if (verbose >= 1) fprintf(out,"\nGOODNESS-OF-FIT TESTS:\n"); switch (gen->method & UNUR_MASK_TYPE) { case UNUR_METH_DISCR: return _unur_test_chi2_discr(gen, samplesize, classmin, verbose, out); case UNUR_METH_CONT: return _unur_test_chi2_cont(gen, n_intervals, samplesize, classmin, verbose, out); case UNUR_METH_CEMP: return _unur_test_chi2_cemp(gen, n_intervals, samplesize, classmin, verbose, out); case UNUR_METH_VEC: return _unur_test_chi2_vec(gen, n_intervals, samplesize, classmin, verbose, out); case UNUR_METH_CVEMP: return _unur_test_chi2_cvemp(gen, n_intervals, samplesize, classmin, verbose, out); default: _unur_error(test_name,UNUR_ERR_GENERIC,"Not implemented for such distributions!"); return -1.; } } /* end of unur_test_chi2() */ /*---------------------------------------------------------------------------*/ double _unur_test_chi2_discr( struct unur_gen *gen, int samplesize, int classmin, int verbose, FILE *out) /*----------------------------------------------------------------------*/ /* Chi^2 test for univariate discrete distributions */ /* with given probability vector. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* samplesize ... samplesize for test */ /* (if <= 0, (#classes)^2 is used as default.) */ /* classmin ... minimum number of expected occurrences for each class */ /* (if <= 0, a default value is used.) */ /* verbose ... verbosity level */ /* 0 = no output */ /* 1 = print summary */ /* 2 = print classes and summary */ /* out ... output stream */ /* */ /* return: */ /* p-value of test statistics under H_0 */ /* */ /* error: */ /* -2. ... missing data */ /* -1. ... other errors */ /*----------------------------------------------------------------------*/ { #define DISTR gen->distr->data.discr double *pv; /* pointer to probability vectors */ int n_pv; /* length of probability vector */ int *observed; /* vector for observed occurrences */ double pval; /* p-value */ int had_PV; /* whether we had a PV for test or not */ int i,j; /* check arguments */ CHECK_NULL(gen,-1.); /* probability vector */ if (DISTR.pv == NULL) { had_PV = FALSE; /* no PV given --> try to compute PV */ if (!unur_distr_discr_make_pv( gen->distr )) { /* not successful */ return -2.; } } else had_PV = TRUE; /* pointer to PV */ pv = DISTR.pv; n_pv = DISTR.n_pv; /* allocate memory for observations */ observed = _unur_xmalloc( n_pv * sizeof(int)); /* clear array */ for( i=0; i n_pv) ? n_pv * n_pv : 1000000; samplesize = _unur_max(samplesize,1000000); } samplesize = _unur_min( samplesize, CHI2_MAX_SAMPLESIZE ); /* now run generator */ for( i=0; i= 3) fprintf(out,"i = %d\n",j); /* shift vector */ j -= DISTR.domain[0]; /* check range of random variates !! */ if (j >= 0 && j < n_pv) ++observed[j]; /* else: ignore number --> chop off tail */ } if (verbose >= 1) { fprintf(out,"\nChi^2-Test for discrete distribution with given probability vector:"); fprintf(out,"\n length = %d\n",n_pv); } /* and now make chi^2 test */ pval = _unur_test_chi2test(pv, observed, n_pv, classmin, verbose, out); /* free memory */ free(observed); if (!had_PV) { free (DISTR.pv); DISTR.pv = NULL; DISTR.n_pv = 0; } /* return result of test */ return pval; #undef DISTR } /* end of _unur_test_chi2_discr() */ /*---------------------------------------------------------------------------*/ double _unur_test_chi2_cont( struct unur_gen *gen, int n_intervals, int samplesize, int classmin, int verbose, FILE *out ) /*----------------------------------------------------------------------*/ /* Chi^2 test for univariate continuous distributions. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* n_intervals .. number of intervals in which (0,1) is partitioned */ /* samplesize ... samplesize for test */ /* (if <= 0, intervals^2 is used as default.) */ /* classmin ... minimum number of expected occurrences for each class */ /* (if <= 0, a default value is used.) */ /* verbose ... verbosity level */ /* 0 = no output */ /* 1 = print summary */ /* 2 = print classes and summary */ /* out ... output stream */ /* */ /* return: */ /* p-value of test statistics under H_0 */ /* */ /* error: */ /* -2. ... missing data */ /* -1. ... other errors */ /*----------------------------------------------------------------------*/ { #define DISTR gen->distr->data.cont double F, Fl, Fr, Fdelta; /* value of CDF (at left and right boundary point) */ UNUR_FUNCT_CONT *cdf; /* pointer to CDF */ int *observed; /* vector for observed occurrences */ double pval; /* p-value */ int i,j; /* check arguments */ CHECK_NULL(gen,-1.); /* we do not check magic cookies here */ /* CDF required */ cdf = DISTR.cdf; if (DISTR.cdf == NULL) { _unur_error(test_name,UNUR_ERR_GENERIC,"CDF required for continuous random variates!"); return -2.; } /* check given number of intervals */ if (n_intervals <= 2) n_intervals = CHI2_INTERVALS_DEFAULT; /* allocate memory for observations */ observed = _unur_xmalloc( n_intervals * sizeof(int)); /* clear array */ for( i=0; i n_intervals) ? n_intervals*n_intervals : INT_MAX; samplesize = _unur_min( samplesize, CHI2_MAX_SAMPLESIZE ); /* compute Fl and Fr */ if (gen->distr->set & UNUR_DISTR_SET_TRUNCATED) { Fl = (DISTR.trunc[0] <= -UNUR_INFINITY) ? 0. : cdf(DISTR.trunc[0], gen->distr); Fr = (DISTR.trunc[1] >= UNUR_INFINITY) ? 1. : cdf(DISTR.trunc[1], gen->distr); } else { Fl = (DISTR.domain[0] <= -UNUR_INFINITY) ? 0. : cdf(DISTR.domain[0], gen->distr); Fr = (DISTR.domain[1] >= UNUR_INFINITY) ? 1. : cdf(DISTR.domain[1], gen->distr); } Fdelta = Fr - Fl; /* Fr - Fl <= 0. is a fatal error */ if (Fdelta <= 0.) { _unur_error(gen->genid,UNUR_ERR_GENERIC,"Fdelta <= 0."); free (observed); return -1.; } /* now run generator */ for( i=0; i= 3) { double x = _unur_sample_cont(gen); F = cdf( x, gen->distr ); fprintf(out,"x = %g\n",x); } else { F = cdf( _unur_sample_cont(gen), gen->distr ); } F = (F-Fl)/Fdelta; j = (int)(n_intervals * F); if (j > n_intervals) { _unur_warning(test_name,UNUR_ERR_GENERIC,"F(x) > Fmax (out of domain)."); j = n_intervals-1; } if (j >= n_intervals) /* cdf() might return 1. */ j = n_intervals-1; if (j < 0 ) { /* there is something wrong with the boundaries */ _unur_warning(test_name,UNUR_ERR_GENERIC,"F(x) < 0 (out of domain)."); j = 0; } ++observed[j]; } if (verbose >= 1) { fprintf(out,"\nChi^2-Test for continuous distribution:"); fprintf(out,"\n intervals = %d\n",n_intervals); } /* and now make chi^2 test */ pval = _unur_test_chi2test(NULL, observed, n_intervals, classmin, verbose, out ); /* free memory */ free(observed); /* return result of test */ return pval; #undef DISTR } /* end of _unur_test_chi2_cont() */ /*---------------------------------------------------------------------------*/ double _unur_test_chi2_cemp( struct unur_gen *gen, int n_intervals, int samplesize, int classmin, int verbose, FILE *out ) /*----------------------------------------------------------------------*/ /* Chi^2 test for continuous empirical distributions. */ /* Tests for standard normal distribution only! */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* n_intervals .. number of intervals in which (0,1) is partitioned */ /* samplesize ... samplesize for test */ /* (if <= 0, intervals^2 is used as default.) */ /* classmin ... minimum number of expected occurrences for each class */ /* (if <= 0, a default value is used.) */ /* verbose ... verbosity level */ /* 0 = no output */ /* 1 = print summary */ /* 2 = print classes and summary */ /* out ... output stream */ /* */ /* return: */ /* p-value of test statistics under H_0 */ /* */ /* error: */ /* -2. ... missing data */ /* -1. ... other errors */ /*----------------------------------------------------------------------*/ { UNUR_DISTR *distr_normal; /* object for standard normal distribution */ UNUR_FUNCT_CONT *cdf; /* pointer to CDF */ double F; /* value of CDF */ int *observed; /* vector for observed occurrences */ double pval; /* p-value */ int i,j; /* check arguments */ CHECK_NULL(gen,-1.); /* we do not check magic cookies here */ /* CDF for standard normal distribution */ distr_normal = unur_distr_normal( NULL, 0 ); cdf = distr_normal->data.cont.cdf; /* check given number of intervals */ if (n_intervals <= 2) n_intervals = CHI2_INTERVALS_DEFAULT; /* allocate memory for observations */ observed = _unur_xmalloc( n_intervals * sizeof(int)); /* clear array */ for( i=0; i n_intervals) ? n_intervals*n_intervals : INT_MAX; samplesize = _unur_min( samplesize, CHI2_MAX_SAMPLESIZE ); /* now run generator */ for( i=0; i n_intervals) { _unur_warning(test_name,UNUR_ERR_GENERIC,"F(x) > Fmax (out of domain)."); j = n_intervals-1; } if (j >= n_intervals) /* cdf() might return 1. */ j = n_intervals-1; if (j < 0 ) { /* there is something wrong with the boundaries */ _unur_warning(test_name,UNUR_ERR_GENERIC,"F(x) < 0 (out of domain)."); j = 0; } ++observed[j]; } if (verbose >= 1) { fprintf(out,"\nChi^2-Test for continuous empirical distribution:"); fprintf(out,"\n(Assumes standard normal distribution!)"); fprintf(out,"\n intervals = %d\n",n_intervals); } /* and now make chi^2 test */ pval = _unur_test_chi2test(NULL, observed, n_intervals, classmin, verbose, out ); /* free memory */ _unur_distr_free(distr_normal); free(observed); /* return result of test */ return pval; } /* end of _unur_test_chi2_cemp() */ /*---------------------------------------------------------------------------*/ double _unur_test_chi2_vec ( struct unur_gen *gen, int n_intervals, int samplesize, int classmin, int verbose, FILE *out ) /*----------------------------------------------------------------------*/ /* Chi^2 test for multivariate (NORMAL) continuous distributions. */ /* It runs a chi^2 test on all marginal distributions and on the */ /* multivariate distributions. */ /* For the marginal distributions the number of intervals is set to */ /* n_intervals; for the global test we use n_intervals for the first */ /* dimension, n_intervals/2 for the second, n_intervals/3 for the third */ /* dimension as long as the total number of cells does not exceed */ /* CHI2_MAX_TOTALINTERVALS. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* n_intervals... number of intervals in which (0,1) is partitioned */ /* (each dimension is partitioned in n_intervals) */ /* samplesize ... samplesize for test */ /* (if <= 0, CHI2_SAMPLEFAC * intervals^dim is used) */ /* classmin ... minimum number of expected occurrences for each class */ /* (if <= 0, a default value is used.) */ /* verbose ... verbosity level */ /* 0 = no output */ /* 1 = print summary */ /* 2 = print classes and summary */ /* out ... output stream */ /* */ /* return: */ /* minimal p-value * number_of_tests of all test statistics under H_0 */ /* */ /* error: */ /* -2. ... missing data */ /* -1. ... other errors */ /*----------------------------------------------------------------------*/ { #define DISTR gen->distr->data.cvec #define idx(i,j) ((i)*dim+(j)) int dim; /* dimension of multivariate distribution */ double *Fl = NULL; /* value of CDF at left and right boundary point */ double *Fr = NULL; double *Fdelta = NULL; UNUR_DISTR **marginals = NULL; /* pointer to marginal distributions */ UNUR_FUNCT_CONT **marginal_cdf = NULL; /* pointer to CDFs of marginal distributions */ const double *mean = NULL; /* pointer to mean vector */ const double *L = NULL; /* pointer to Cholesky factor */ double *Linv = NULL; /* pointer to inverse Cholesky factor */ double Linv_det; /* determinant of Linv */ double *X = NULL; /* sampling vector */ double *U = NULL; /* X transformed to uniform */ int *bm = NULL; /* array for counting bins for marginals */ double pval, pval_min; /* p-value */ int i, j, k; /* auxiliary variables */ /* check arguments */ CHECK_NULL(gen,-1.); /* we do not check magic cookies here */ /* we need all marginal distributions */ if (DISTR.marginals==NULL) { _unur_error(gen->distr->name,UNUR_ERR_DISTR_REQUIRED,"marginals"); return -2.; } /* when the domain has been changed by a unur_distr_cvec_set_domain_...() */ /* call and the covariance matrix is not the identity matrix then */ /* the test may fail anyway. */ if ((gen->distr->set & UNUR_DISTR_SET_DOMAINBOUNDED) && !(gen->distr->set & UNUR_DISTR_SET_COVAR_IDENT) ) _unur_warning(test_name,UNUR_ERR_GENERIC,"correlated and domain truncated --> test might fail"); /* check given number of intervals */ if (n_intervals <= 2) n_intervals = CHI2_INTERVALS_DEFAULT; /* samplesize */ if( samplesize <= 0 ) samplesize = CHI2_DEFAULT_SAMPLESIZE; samplesize = _unur_min( samplesize, CHI2_MAX_SAMPLESIZE ); /* dimension of distribution */ dim = gen->distr->dim; if (dim < 1) { _unur_error(test_name,UNUR_ERR_GENERIC,"distribution dimension < 1 ?"); return -1.; } /* we need mean vector and covariance matrix */ mean = unur_distr_cvec_get_mean(gen->distr); L = unur_distr_cvec_get_cholesky(gen->distr); /* remark: mean or L might be NULL */ /* get marginal distributions and their CDFs */ marginals = _unur_xmalloc(dim * sizeof(UNUR_DISTR *)); marginal_cdf = _unur_xmalloc(dim * sizeof(UNUR_FUNCT_CONT *)); for (i=0; idistr->name,UNUR_ERR_DISTR_REQUIRED,"CDF of continuous standardized marginal"); pval_min = -2.; goto free_memory; } } /* compute Fl and Fr */ Fl = _unur_xmalloc(dim * sizeof(double)); Fr = _unur_xmalloc(dim * sizeof(double)); Fdelta = _unur_xmalloc(dim * sizeof(double)); if (gen->distr->set & UNUR_DISTR_SET_DOMAINBOUNDED) { for (i=0; igenid,UNUR_ERR_GENERIC,"Fdelta <= 0."); pval_min = -1.; goto free_memory; } } } else { for (i=0; i=n_intervals) iv = n_intervals-1; if (iv < 0) iv = 0; bm[j*n_intervals + iv] += 1; } } /* ----------------------------------------------------------------------------*/ /* make chi^2 test (marginal) */ pval_min = 1.; for (j=0; j= 1) { fprintf(out,"\nChi^2-Test for marginal distribution [%d]\n",j); } pval = _unur_test_chi2test(NULL, bm+(j*n_intervals), n_intervals, classmin, verbose, out ); pval_min = _unur_min(pval_min,pval); } if (verbose >= 1) { fprintf(out,"\nSummary:\n"); fprintf(out," Minimal p-value * number_of_tests = %g:\n\n",pval_min * dim); } /* ----------------------------------------------------------------------------*/ free_memory: /* free memory */ if (X) free(X); if (U) free(U); if (bm) free(bm); if (Linv) free(Linv); if (marginals) free (marginals); if (marginal_cdf) free (marginal_cdf); if (Fl) free(Fl); if (Fr) free(Fr); if (Fdelta) free(Fdelta); /* return result of test */ return pval_min * dim; #undef idx #undef DISTR } /* end of _unur_test_chi2_vec() */ /*---------------------------------------------------------------------------*/ double _unur_test_chi2_cvemp ( struct unur_gen *gen, int n_intervals, int samplesize, int classmin, int verbose, FILE *out ) /*----------------------------------------------------------------------*/ /* Chi^2 test for continuous multivariate empirical distributions */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* n_intervals... number of intervals in which (0,1) is partitioned */ /* (each dimension is partitioned in n_intervals) */ /* samplesize ... samplesize for test */ /* (if <= 0, CHI2_SAMPLEFAC * intervals^dim is used) */ /* classmin ... minimum number of expected occurrences for each class */ /* (if <= 0, a default value is used.) */ /* verbose ... verbosity level */ /* 0 = no output */ /* 1 = print summary */ /* 2 = print classes and summary */ /* out ... output stream */ /* */ /* return: */ /* minimal p-value * number_of_tests of all test statistics under H_0 */ /* */ /* error: */ /* -2. ... missing data */ /* -1. ... other errors */ /*----------------------------------------------------------------------*/ { #define DISTR gen->distr->data.cvec #define idx(i,j) ((i)*dim+(j)) int dim; /* dimension of multivariate distribution */ UNUR_DISTR *distr_normal; /* object for standard normal distribution */ UNUR_FUNCT_CONT *cdf; /* pointer to CDF */ double *X = NULL; /* sampling vector */ double *U = NULL; /* X transformed to uniform */ int *bm = NULL; /* array for counting bins for marginals */ double pval, pval_min; /* p-value */ int i, j; /* auxiliary variables */ /* check arguments */ CHECK_NULL(gen,-1.); /* we do not check magic cookies here */ /* check given number of intervals */ if (n_intervals <= 2) n_intervals = CHI2_INTERVALS_DEFAULT; /* samplesize */ if( samplesize <= 0 ) samplesize = CHI2_DEFAULT_SAMPLESIZE; samplesize = _unur_min( samplesize, CHI2_MAX_SAMPLESIZE ); /* dimension of distribution */ dim = gen->distr->dim; if (dim < 1) { _unur_error(test_name,UNUR_ERR_GENERIC,"distribution dimension < 1 ?"); return -1.; } /* we need the CDF for the standard normal distribution */ distr_normal = unur_distr_normal( NULL, 0 ); cdf = distr_normal->data.cont.cdf; /* allocate working space memory */ X = _unur_xmalloc( dim * sizeof(double)); U = _unur_xmalloc( dim * sizeof(double)); bm = _unur_xmalloc( dim * n_intervals * sizeof(int)); /* bins for marginal tests */ memset(bm , 0, dim * n_intervals * sizeof(int)); /* now run generator */ for( i=0; i=n_intervals) iv = n_intervals-1; if (iv < 0) iv = 0; bm[j*n_intervals + iv] += 1; } } /* make chi^2 test (marginal) */ pval_min = 1.; for (j=0; j= 1) { fprintf(out,"\nChi^2-Test for marginal distribution [%d]\n",j); } pval = _unur_test_chi2test(NULL, bm+(j*n_intervals), n_intervals, classmin, verbose, out ); pval_min = _unur_min(pval_min,pval); } if (verbose >= 1) { fprintf(out,"\nSummary:\n"); fprintf(out," Minimal p-value * number_of_tests = %g:\n\n",pval_min * dim); } /* free memory */ _unur_distr_free(distr_normal); free(X); free(U); free(bm); /* return result of test */ return pval_min * dim; #undef idx #undef DISTR } /* end of _unur_test_chi2_cvemp() */ /*---------------------------------------------------------------------------*/ double _unur_test_chi2test( double *prob, int *observed, int len, int classmin, int verbose, FILE *out ) /*----------------------------------------------------------------------*/ /* Chi^2 test for discrete distributions. */ /* */ /* parameters: */ /* prob ... probability vector (need not sum to 1) */ /* NULL indicates a uniform distribution on (0,len-1) */ /* observed ... vector containing the observed number of occurrences */ /* len ... length of (both) vectors */ /* classmin ... minimum number of expected occurrences for each class */ /* (if <= 0, a default value is used.) */ /* verbose ... verbosity level */ /* 0 = no output */ /* 1 = print summary */ /* 2 = print classes and summary */ /* out ... output stream */ /* */ /* return: */ /* p-value of test statistics under H_0 */ /* */ /* error: */ /* -2. ... missing data */ /* -1. ... other errors */ /* */ /* comment: */ /* joines classes if expected number of occurrences in some classes */ /* is too small, i.e., less than "classmin". */ /*----------------------------------------------------------------------*/ { double chi2 = 0.; /* chi2-value */ double df; /* degrees of freedom for chi^2 distribution */ double pval; /* p-value */ double clexpd = 0.; /* expected occurrences in class */ int clobsd = 0; /* observed occurrences in class */ int classes = 0; /* (total) number of classes */ double probsum = 0.; /* sum of all "probabilities" (need not be 1, for convenience) */ int samplesize = 0; double factor; /* factor for calculating expected number of occurrences */ int i; UNUR_DISTR *distr_chisquare = NULL; /* distribution object to chi^2 distribution */ /* check arguments */ CHECK_NULL(observed,-1.); /* minimum number of occurrences in a class */ classmin = (classmin > 0) ? classmin : CHI2_CLASSMIN_DEFAULT; /* compute sample size */ for( samplesize=0, i=0; i prob[i] = 1/len */ factor = ((double)samplesize)/len; /* compute chi^2 value */ clexpd = 0.; clobsd = 0; classes = 0; for( chi2=0., i=0; i= classmin || i == len-1) { /* number of expected occurrences is large enough or end of array */ if (clobsd <= 0 && clexpd <= 0.) break; chi2 += (clobsd-clexpd)*(clobsd-clexpd)/clexpd; if (verbose >= 2) fprintf(out,"Class #%d:\tobserved %d\texpected %.2f\n",classes,clobsd,clexpd); clexpd = 0.; clobsd = 0; classes++; } } /* there must be at least two classes */ if (classes < 2) { _unur_error(test_name,UNUR_ERR_GENERIC,"too few classes!"); if (verbose >= 1) fprintf(out,"\nCannot run chi^2-Test: too few classes\n"); return -1.; } /* evaluate test statistics */ /* chisquare distribution with df degrees of freedom */ df = (double)(classes-1); distr_chisquare = unur_distr_chisquare( &df, 1 ); /* p-value */ if (distr_chisquare->data.cont.cdf) { pval = 1. - _unur_cont_CDF( chi2, distr_chisquare ); } else { _unur_error(test_name,UNUR_ERR_GENERIC,"CDF for CHI^2 distribution required"); pval = -2.; } _unur_distr_free(distr_chisquare); /* print result (if requested) */ if (verbose >= 1 && pval >= 0.) { fprintf(out,"\nResult of chi^2-Test:\n samplesize = %d\n",samplesize); fprintf(out," classes = %d\t (minimum per class = %d)\n", classes, classmin); fprintf(out," chi2-value = %g\n p-value = %g\n\n", chi2, pval); } /* return result of test */ return pval; } /* end of _unur_test_chi2test() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/tests/timing.c0000644001357500135600000006457314420445767013455 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * file: timing.c * * * * estimate setup and (marginal) generation time * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include #include #include #include #include #include "unuran_tests.h" /*---------------------------------------------------------------------------*/ /* define timer */ #if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H) /* use gettimeofday() command. Not in ANSI C! */ #include static struct timeval tv; #define _unur_get_time() ( gettimeofday(&tv, NULL), ((tv).tv_sec * 1.e6 + (tv).tv_usec) ) #else /* use clock() command. ANSI C but less accurate */ #include #define _unur_get_time() ( (1.e6 * clock()) / CLOCKS_PER_SEC ) #endif /*---------------------------------------------------------------------------*/ static char test_name[] = "Timing"; /*---------------------------------------------------------------------------*/ static double unur_test_timing_total_run( const struct unur_par *par, int samplesize, int repeat ); /*---------------------------------------------------------------------------*/ /* estimate average time (in micro seconds) for sampling 1 random variate */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* compare two doubles (needed for sorting) */ inline static int compare_doubles (const void *a, const void *b) { const double *da = (const double *) a; const double *db = (const double *) b; return (*da > *db) - (*da < *db); } /*---------------------------------------------------------------------------*/ struct unur_gen* unur_test_timing( struct unur_par *par, int log10_samplesize, double *time_setup, double *time_sample, int verbosity, FILE *out ) /*----------------------------------------------------------------------*/ /* init generator and estimate setup and generation time. */ /* */ /* parameters: */ /* par ... pointer to parameters for generator object */ /* log10_samplesize ... common log of maximal sample size */ /* time_setup ... time for setup */ /* time_sample ... marginal generation time (i.e. for one r.n.) */ /* verbosity ... verbosity level, 0 = no output, 1 = output */ /* out ... output stream */ /* */ /* return: */ /* pointer to generator object. */ /* setup time and marginal generation time are stored in */ /* setup_time and marginal_time, respectively. */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; int k ATTRIBUTE__UNUSED; double x ATTRIBUTE__UNUSED; double *vec = NULL; double time_uniform, time_exponential; double time_start, *time_gen; long samples, samplesize, log10_samples; /* check parameter */ _unur_check_NULL(test_name,par,NULL); if (log10_samplesize < 2) log10_samplesize = 2; /* need an array to store timings */ time_gen = _unur_xmalloc((log10_samplesize+1) * sizeof(double)); /* marginal generation time for one unifrom random number */ time_uniform = unur_test_timing_uniform( par,log10_samplesize ); /* marginal generation time for one exponential random variate */ time_exponential = unur_test_timing_exponential( par,log10_samplesize ); /* we need an array for the vector */ if (par->distr && _unur_gen_is_vec(par)) vec = _unur_xmalloc( par->distr->dim * sizeof(double) ); /* initialize generator (and estimate setup time) */ time_start = _unur_get_time(); gen = _unur_init(par); *time_setup = _unur_get_time(); /* init successful ? */ if (!gen) { free (time_gen); if (vec) free(vec); return NULL; } /* evaluate generation time */ samplesize = 10; samples = 0; for( log10_samples=1; log10_samples<=log10_samplesize; log10_samples++ ) { switch (gen->method & UNUR_MASK_TYPE) { case UNUR_METH_DISCR: for( ; samples < samplesize; samples++ ) k = unur_sample_discr(gen); break; case UNUR_METH_CONT: case UNUR_METH_CEMP: for( ; samples < samplesize; samples++ ) x = unur_sample_cont(gen); break; case UNUR_METH_VEC: for( ; samples < samplesize; samples++ ) unur_sample_vec(gen,vec); break; default: /* unknown ! */ _unur_error(test_name,UNUR_ERR_SHOULD_NOT_HAPPEN,""); free(time_gen); if (vec) free(vec); return NULL; } time_gen[log10_samples] = _unur_get_time(); samplesize *= 10; } /* compute generation times */ /* marginal generation time */ *time_sample = (time_gen[log10_samplesize] - time_gen[log10_samplesize-1]) / (0.09 * samplesize); /* mean time per random number including setup */ samplesize = 1; for( log10_samples=1; log10_samples<=log10_samplesize; log10_samples++ ) { samplesize *= 10; time_gen[log10_samples] = (time_gen[log10_samples] - time_start) / samplesize; } /* setup time */ *time_setup -= time_start; /* now print times */ if (verbosity) { fprintf(out,"\nTIMING:\t\t usec \t relative to \t relative to\n"); fprintf(out,"\t\t\t\t uniform\t exponential\n\n"); /* setup time */ fprintf(out," setup time:\t %#g \t %#g \t %#g\n", (*time_setup), (*time_setup)/time_uniform, (*time_setup)/time_exponential); /* marginal generation time */ fprintf(out," generation time: %#g \t %#g \t %#g\n", (*time_sample), (*time_sample)/time_uniform, (*time_sample)/time_exponential); /* generation times */ fprintf(out,"\n average generation time for samplesize:\n"); for( log10_samples=1; log10_samples<=log10_samplesize; log10_samples++ ) fprintf(out,"\t10^%ld:\t %#g \t %#g \t %#g\n",log10_samples, time_gen[log10_samples], time_gen[log10_samples]/time_uniform, time_gen[log10_samples]/time_exponential); } /* free memory */ free(time_gen); if (vec) free(vec); /* return generator object */ return gen; } /* end of unur_test_timing() */ /*---------------------------------------------------------------------------*/ double unur_test_timing_R( struct unur_par *par, const char *distrstr, const char *methodstr, double log10_samplesize, double *time_setup, double *time_marginal ) /*----------------------------------------------------------------------*/ /* setup time and marginal generation time via linear regression. */ /* */ /* parameters: */ /* par ... pointer to parameters for generator object */ /* distrstr ... distribution described by a string */ /* methodstr ... chosen method described by a string */ /* log10_samplesize ... common log of maximal sample size */ /* time_setup ... time for setup */ /* time_marginal ... marginal generation time (i.e. for one r.n.) */ /* */ /* return: */ /* coefficient of determination R^2 */ /* */ /* error: */ /* return -100. */ /*----------------------------------------------------------------------*/ { const int n_steps = 2; /* number of sample sizes */ const int n_reps = 10; /* number of repetitions for each sample size */ struct unur_distr *distr_tmp = NULL; /* temporary distribution object */ struct unur_par *par_tmp = NULL; /* working copy of parameter object */ struct unur_gen *gen_tmp = NULL; /* temporary generator object */ struct unur_slist *mlist = NULL; /* auxiliary table for _unur_str2par()*/ int k ATTRIBUTE__UNUSED; double x ATTRIBUTE__UNUSED; double *vec = NULL; double time_start, *time_gen = NULL; int sample, rep; long samplesize, n; double sx = 0.; /* sums for linear regression */ double sy = 0.; double sxx = 0.; double syy = 0.; double sxy = 0.; double Rsq = -100.; /* coefficient of determination */ /* set initial values */ *time_setup = -100.; *time_marginal = -100.; Rsq = -100.; /* check parameter */ if (log10_samplesize < 2) log10_samplesize = 2; /* create parameter object (if necessary) */ if (par == NULL) { distr_tmp = unur_str2distr(distrstr); if (distr_tmp == NULL) goto error; par = _unur_str2par( distr_tmp, methodstr, &mlist ); if (par == NULL) goto error; } /* we need an array for storing timing results */ time_gen = _unur_xmalloc( n_reps * sizeof(double) ); /* we need an array for a random vector */ if (par->distr && _unur_gen_is_vec(par)) vec = _unur_xmalloc( par->distr->dim * sizeof(double) ); /* measure timings for various sample sizes */ for (sample=0; samplemethod & UNUR_MASK_TYPE) { case UNUR_METH_DISCR: for( n=0; n 1000) { /* make second pilot study with double sample size */ time_2nd = unur_test_timing_total_run(par, 2*size_pilot, repeat_pilot); if (time_2nd < 0) return -1.; /* estimate time for given sample size */ d = 2*time_pilot - time_2nd; if (d<0.) d=0.; k = (time_2nd - time_pilot)/size_pilot; if (k<=0.) k = time_pilot/size_pilot; time_pilot = d + samplesize * k; } else { /* this is not required, but it prevents an error in case of a programming bug */ d = 0; k = time_pilot / size_pilot; } /* now run timing test */ repeat_result = (int) (avg_duration / time_pilot); if (repeat_result > 1000) repeat_result = 1000; /* there is no need for more than 1000 repetitions */ size_result = samplesize; if (repeat_result >= 1) { repeat_result = _unur_max(4,repeat_result); if (repeat_result <= repeat_pilot && size_result == size_pilot) { /* there is no need to run this test again */ time_result = time_pilot; } else { time_result = unur_test_timing_total_run(par,size_result,repeat_result); } } else { /* do not generate the full sample */ repeat_result = 4; size_result = (int) ((avg_duration - d)/k); size_result /= 2; time_result = unur_test_timing_total_run(par,size_result,repeat_result); time_2nd = unur_test_timing_total_run(par,2*size_result,repeat_result); /* estimate time from shorter sample sizes */ d = 2*time_result - time_2nd; if (d<0.) d=0.; k = (time_2nd - time_result)/size_result; if (k<=0.) k = time_result/size_result; time_result = d + samplesize * k; } /* o.k. */ return time_result; } /* end of unur_test_timing_total() */ /*---------------------------------------------------------------------------*/ double unur_test_timing_total_run( const struct unur_par *par, int samplesize, int n_repeat ) /*----------------------------------------------------------------------*/ /* estimate average time (in micro seconds) for sampling */ /* */ /* parameters: */ /* par ... pointer to parameters for generator object */ /* samplesize ... sample size */ /* n_repeat ... number of samples (repetitions of sampling) */ /* */ /* return: */ /* total time in micro seconds */ /* */ /* error: */ /* return -1 */ /*----------------------------------------------------------------------*/ { struct unur_par *par_tmp; /* temporary working copy of parameter object */ struct unur_gen *gen_tmp; /* temporary generator object */ double *time; int n, rep; double time_total; /* total time for sampling */ double time_start; int i; int k ATTRIBUTE__UNUSED; double x ATTRIBUTE__UNUSED; double *vec = NULL; /* check parameter */ _unur_check_NULL(test_name,par,-1.); if (samplesize < 0 || n_repeat < 1) return -1.; /* we need an array for storing timing results */ time = _unur_xmalloc( n_repeat * sizeof(double) ); /* we need an array for a random vector */ if (par->distr && _unur_gen_is_vec(par)) vec = _unur_xmalloc( par->distr->dim * sizeof(double) ); /* make samples */ for (rep = 0; rep < n_repeat; rep++) { /* make a working copy of parameter object */ par_tmp = _unur_par_clone(par); /* start timer */ time_start = _unur_get_time(); /* make generator object (init) */ gen_tmp = _unur_init(par_tmp); if (!gen_tmp) { /* init failed */ if (vec) free(vec); free(time); /* wait a little bit till writing log entry is completed */ for (x=0,i=0; i<100000; i++) x+=i; return -1.; } /* run generator */ switch (gen_tmp->method & UNUR_MASK_TYPE) { case UNUR_METH_DISCR: for( n=0; nurng); /* evaluate marginal generation times */ for( n=0; nurng); /* evaluate marginal generation times */ for( n=0; n #include #include /*-----*/ /* <1> `unur_typedefs.h' */ #ifndef UNUR_TYPEDEFS_H_SEEN #define UNUR_TYPEDEFS_H_SEEN struct unur_distr; typedef struct unur_distr UNUR_DISTR; struct unur_par; typedef struct unur_par UNUR_PAR; struct unur_gen; typedef struct unur_gen UNUR_GEN; struct unur_urng; typedef struct unur_urng UNUR_URNG; #define UNUR_URNG_UNURAN 1 typedef double UNUR_FUNCT_CONT (double x, const struct unur_distr *distr); typedef double UNUR_FUNCT_DISCR (int x, const struct unur_distr *distr); typedef int UNUR_IFUNCT_DISCR(double x, const struct unur_distr *distr); typedef double UNUR_FUNCT_CVEC (const double *x, struct unur_distr *distr); typedef int UNUR_VFUNCT_CVEC(double *result, const double *x, struct unur_distr *distr); typedef double UNUR_FUNCTD_CVEC(const double *x, int coord, struct unur_distr *distr); struct unur_slist; typedef void UNUR_ERROR_HANDLER( const char *objid, const char *file, int line, const char *errortype, int unur_errno, const char *reason ); #endif /* end of `unur_typedefs.h' */ /*-----*/ /*-----*/ /* <1> `urng.h' */ #ifndef URNG_H_SEEN #define URNG_H_SEEN UNUR_URNG *unur_get_default_urng( void ); UNUR_URNG *unur_set_default_urng( UNUR_URNG *urng_new ); UNUR_URNG *unur_set_default_urng_aux( UNUR_URNG *urng_new ); UNUR_URNG *unur_get_default_urng_aux( void ); int unur_set_urng( UNUR_PAR *parameters, UNUR_URNG *urng ); UNUR_URNG *unur_chg_urng( UNUR_GEN *generator, UNUR_URNG *urng ); UNUR_URNG *unur_get_urng( UNUR_GEN *generator ); int unur_set_urng_aux( UNUR_PAR *parameters, UNUR_URNG *urng_aux ); int unur_use_urng_aux_default( UNUR_PAR *parameters ); int unur_chgto_urng_aux_default( UNUR_GEN *generator ); UNUR_URNG *unur_chg_urng_aux( UNUR_GEN *generator, UNUR_URNG *urng_aux ); UNUR_URNG *unur_get_urng_aux( UNUR_GEN *generator ); double unur_urng_sample (UNUR_URNG *urng); double unur_sample_urng (UNUR_GEN *gen); int unur_urng_sample_array (UNUR_URNG *urng, double *X, int dim); int unur_urng_reset (UNUR_URNG *urng); #ifdef UNUR_URNG_UNURAN int unur_urng_sync (UNUR_URNG *urng); int unur_urng_seed (UNUR_URNG *urng, unsigned long seed); int unur_urng_anti (UNUR_URNG *urng, int anti); int unur_urng_nextsub (UNUR_URNG *urng); int unur_urng_resetsub (UNUR_URNG *urng); int unur_gen_sync (UNUR_GEN *generator); int unur_gen_seed (UNUR_GEN *generator, unsigned long seed); int unur_gen_anti (UNUR_GEN *generator, int anti); int unur_gen_reset (UNUR_GEN *generator); int unur_gen_nextsub (UNUR_GEN *generator); int unur_gen_resetsub (UNUR_GEN *generator); UNUR_URNG *unur_urng_new( double (*sampleunif)(void *state), void *state ); void unur_urng_free (UNUR_URNG *urng); int unur_urng_set_sample_array( UNUR_URNG *urng, unsigned int (*samplearray)(void *state, double *X, int dim) ); int unur_urng_set_sync( UNUR_URNG *urng, void (*sync)(void *state) ); int unur_urng_set_seed( UNUR_URNG *urng, void (*setseed)(void *state, unsigned long seed) ); int unur_urng_set_anti( UNUR_URNG *urng, void (*setanti)(void *state, int anti) ); int unur_urng_set_reset( UNUR_URNG *urng, void (*reset)(void *state) ); int unur_urng_set_nextsub( UNUR_URNG *urng, void (*nextsub)(void *state) ); int unur_urng_set_resetsub( UNUR_URNG *urng, void (*resetsub)(void *state) ); int unur_urng_set_delete( UNUR_URNG *urng, void (*fpdelete)(void *state) ); #endif #endif /* end of `urng.h' */ /*-----*/ /*-----*/ /* <1> `urng_builtin.h' */ #ifndef URNG_BUILTIN_H_SEEN #define URNG_BUILTIN_H_SEEN double unur_urng_MRG31k3p (void *dummy); void unur_urng_MRG31k3p_seed (void *dummy, unsigned long seed); void unur_urng_MRG31k3p_reset (void *dummy); double unur_urng_fish (void *dummy); void unur_urng_fish_seed (void *dummy, unsigned long seed); void unur_urng_fish_reset (void *dummy); double unur_urng_mstd (void *dummy); void unur_urng_mstd_seed (void *dummy, unsigned long seed); void unur_urng_mstd_reset (void *dummy); UNUR_URNG *unur_urng_builtin( void ); UNUR_URNG *unur_urng_builtin_aux( void ); #endif /* end of `urng_builtin.h' */ /*-----*/ /*-----*/ /* <1> `urng_fvoid.h' */ #ifndef URNG_FVOID_H_SEEN #define URNG_FVOID_H_SEEN UNUR_URNG *unur_urng_fvoid_new( double (*urand)(void *state), void (*reset)(void *state) ); #endif /* end of `urng_fvoid.h' */ /*-----*/ /*-----*/ /* <1> `urng_randomshift.h' */ #ifndef URNG_RANDOMSHIFT_H_SEEN #define URNG_RANDOMSHIFT_H_SEEN UNUR_URNG *unur_urng_randomshift_new( UNUR_URNG *qrng, UNUR_URNG *srng, int dim ); int unur_urng_randomshift_nextshift( UNUR_URNG *urng ); #endif /* end of `urng_randomshift.h' */ /*-----*/ /*-----*/ /* <1> `distr.h' */ enum { UNUR_DISTR_CONT = 0x010u, UNUR_DISTR_CEMP = 0x011u, UNUR_DISTR_CVEC = 0x110u, UNUR_DISTR_CVEMP = 0x111u, UNUR_DISTR_MATR = 0x210u, UNUR_DISTR_DISCR = 0x020u }; void unur_distr_free( UNUR_DISTR *distribution ); int unur_distr_set_name( UNUR_DISTR *distribution, const char *name ); const char *unur_distr_get_name( const UNUR_DISTR *distribution ); int unur_distr_get_dim( const UNUR_DISTR *distribution ); unsigned int unur_distr_get_type( const UNUR_DISTR *distribution ); int unur_distr_is_cont( const UNUR_DISTR *distribution ); int unur_distr_is_cvec( const UNUR_DISTR *distribution ); int unur_distr_is_cemp( const UNUR_DISTR *distribution ); int unur_distr_is_cvemp( const UNUR_DISTR *distribution ); int unur_distr_is_discr( const UNUR_DISTR *distribution ); int unur_distr_is_matr( const UNUR_DISTR *distribution ); int unur_distr_set_extobj( UNUR_DISTR *distribution, const void *extobj ); const void *unur_distr_get_extobj( const UNUR_DISTR *distribution ); UNUR_DISTR *unur_distr_clone( const UNUR_DISTR *distr ); /* end of `distr.h' */ /*-----*/ /*-----*/ /* <1> `cemp.h' */ UNUR_DISTR *unur_distr_cemp_new( void ); int unur_distr_cemp_set_data( UNUR_DISTR *distribution, const double *sample, int n_sample ); int unur_distr_cemp_read_data( UNUR_DISTR *distribution, const char *filename ); int unur_distr_cemp_get_data( const UNUR_DISTR *distribution, const double **sample ); int unur_distr_cemp_set_hist( UNUR_DISTR *distribution, const double *prob, int n_prob, double xmin, double xmax ); int unur_distr_cemp_set_hist_prob( UNUR_DISTR *distribution, const double *prob, int n_prob ); int unur_distr_cemp_set_hist_domain( UNUR_DISTR *distribution, double xmin, double xmax ); int unur_distr_cemp_set_hist_bins( UNUR_DISTR *distribution, const double *bins, int n_bins ); /* end of `cemp.h' */ /*-----*/ /*-----*/ /* <1> `cont.h' */ UNUR_DISTR *unur_distr_cont_new( void ); int unur_distr_cont_set_pdf( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *pdf ); int unur_distr_cont_set_dpdf( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *dpdf ); int unur_distr_cont_set_cdf( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *cdf ); int unur_distr_cont_set_invcdf( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *invcdf ); UNUR_FUNCT_CONT *unur_distr_cont_get_pdf( const UNUR_DISTR *distribution ); UNUR_FUNCT_CONT *unur_distr_cont_get_dpdf( const UNUR_DISTR *distribution ); UNUR_FUNCT_CONT *unur_distr_cont_get_cdf( const UNUR_DISTR *distribution ); UNUR_FUNCT_CONT *unur_distr_cont_get_invcdf( const UNUR_DISTR *distribution ); double unur_distr_cont_eval_pdf( double x, const UNUR_DISTR *distribution ); double unur_distr_cont_eval_dpdf( double x, const UNUR_DISTR *distribution ); double unur_distr_cont_eval_cdf( double x, const UNUR_DISTR *distribution ); double unur_distr_cont_eval_invcdf( double u, const UNUR_DISTR *distribution ); int unur_distr_cont_set_logpdf( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *logpdf ); int unur_distr_cont_set_dlogpdf( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *dlogpdf ); int unur_distr_cont_set_logcdf( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *logcdf ); UNUR_FUNCT_CONT *unur_distr_cont_get_logpdf( const UNUR_DISTR *distribution ); UNUR_FUNCT_CONT *unur_distr_cont_get_dlogpdf( const UNUR_DISTR *distribution ); UNUR_FUNCT_CONT *unur_distr_cont_get_logcdf( const UNUR_DISTR *distribution ); double unur_distr_cont_eval_logpdf( double x, const UNUR_DISTR *distribution ); double unur_distr_cont_eval_dlogpdf( double x, const UNUR_DISTR *distribution ); double unur_distr_cont_eval_logcdf( double x, const UNUR_DISTR *distribution ); int unur_distr_cont_set_pdfstr( UNUR_DISTR *distribution, const char *pdfstr ); int unur_distr_cont_set_cdfstr( UNUR_DISTR *distribution, const char *cdfstr ); char *unur_distr_cont_get_pdfstr( const UNUR_DISTR *distribution ); char *unur_distr_cont_get_dpdfstr( const UNUR_DISTR *distribution ); char *unur_distr_cont_get_cdfstr( const UNUR_DISTR *distribution ); int unur_distr_cont_set_pdfparams( UNUR_DISTR *distribution, const double *params, int n_params ); int unur_distr_cont_get_pdfparams( const UNUR_DISTR *distribution, const double **params ); int unur_distr_cont_set_pdfparams_vec( UNUR_DISTR *distribution, int par, const double *param_vec, int n_param_vec ); int unur_distr_cont_get_pdfparams_vec( const UNUR_DISTR *distribution, int par, const double **param_vecs ); int unur_distr_cont_set_logpdfstr( UNUR_DISTR *distribution, const char *logpdfstr ); char *unur_distr_cont_get_logpdfstr( const UNUR_DISTR *distribution ); char *unur_distr_cont_get_dlogpdfstr( const UNUR_DISTR *distribution ); int unur_distr_cont_set_logcdfstr( UNUR_DISTR *distribution, const char *logcdfstr ); char *unur_distr_cont_get_logcdfstr( const UNUR_DISTR *distribution ); int unur_distr_cont_set_domain( UNUR_DISTR *distribution, double left, double right ); int unur_distr_cont_get_domain( const UNUR_DISTR *distribution, double *left, double *right ); int unur_distr_cont_get_truncated( const UNUR_DISTR *distribution, double *left, double *right ); int unur_distr_cont_set_hr( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *hazard ); UNUR_FUNCT_CONT *unur_distr_cont_get_hr( const UNUR_DISTR *distribution ); double unur_distr_cont_eval_hr( double x, const UNUR_DISTR *distribution ); int unur_distr_cont_set_hrstr( UNUR_DISTR *distribution, const char *hrstr ); char *unur_distr_cont_get_hrstr( const UNUR_DISTR *distribution ); int unur_distr_cont_set_mode( UNUR_DISTR *distribution, double mode ); int unur_distr_cont_upd_mode( UNUR_DISTR *distribution ); double unur_distr_cont_get_mode( UNUR_DISTR *distribution ); int unur_distr_cont_set_center( UNUR_DISTR *distribution, double center ); double unur_distr_cont_get_center( const UNUR_DISTR *distribution ); int unur_distr_cont_set_pdfarea( UNUR_DISTR *distribution, double area ); int unur_distr_cont_upd_pdfarea( UNUR_DISTR *distribution ); double unur_distr_cont_get_pdfarea( UNUR_DISTR *distribution ); /* end of `cont.h' */ /*-----*/ /*-----*/ /* <1> `cxtrans.h' */ UNUR_DISTR *unur_distr_cxtrans_new( const UNUR_DISTR *distribution ); const UNUR_DISTR *unur_distr_cxtrans_get_distribution( const UNUR_DISTR *distribution ); int unur_distr_cxtrans_set_alpha( UNUR_DISTR *distribution, double alpha ); int unur_distr_cxtrans_set_rescale( UNUR_DISTR *distribution, double mu, double sigma ); double unur_distr_cxtrans_get_alpha( const UNUR_DISTR *distribution ); double unur_distr_cxtrans_get_mu( const UNUR_DISTR *distribution ); double unur_distr_cxtrans_get_sigma( const UNUR_DISTR *distribution ); int unur_distr_cxtrans_set_logpdfpole( UNUR_DISTR *distribution, double logpdfpole, double dlogpdfpole ); #define unur_distr_cxtrans_get_pdf(distr) unur_distr_cont_get_pdf((distr)) #define unur_distr_cxtrans_get_dpdf(distr) unur_distr_cont_get_dpdf((distr)) #define unur_distr_cxtrans_get_cdf(distr) unur_distr_cont_get_cdf((distr)) #define unur_distr_cxtrans_eval_pdf(x,distr) unur_distr_cont_eval_pdf((x),(distr)) #define unur_distr_cxtrans_eval_dpdf(x,distr) unur_distr_cont_eval_dpdf((x),(distr)) #define unur_distr_cxtrans_eval_cdf(x,distr) unur_distr_cont_eval_cdf((x),(distr)) int unur_distr_cxtrans_set_domain( UNUR_DISTR *distribution, double left, double right ); #define unur_distr_cxtrans_get_domain(distr,left,right) unur_distr_cont_get_domain((distr),(left),(right)) #define unur_distr_cxtrans_get_truncated(distr,left,right) unur_distr_cont_get_truncated((distr),(left),(right)) #define unur_distr_cxtrans_set_mode(distr,mode) unur_distr_cont_set_mode((distr),(mode)) #define unur_distr_cxtrans_upd_mode(distr) unur_distr_cont_upd_mode((distr)) #define unur_distr_cxtrans_get_mode(distr) unur_distr_cont_get_mode((distr)) #define unur_distr_cxtrans_set_pdfarea(distr,area) unur_distr_cont_set_pdfarea((distr),(area)) #define unur_distr_cxtrans_upd_pdfarea(distr) unur_distr_cont_upd_pdfarea((distr)) #define unur_distr_cxtrans_get_pdfarea(distr) unur_distr_cont_get_pdfarea((distr)) /* end of `cxtrans.h' */ /*-----*/ /*-----*/ /* <1> `corder.h' */ UNUR_DISTR *unur_distr_corder_new( const UNUR_DISTR *distribution, int n, int k ); const UNUR_DISTR *unur_distr_corder_get_distribution( const UNUR_DISTR *distribution ); int unur_distr_corder_set_rank( UNUR_DISTR *distribution, int n, int k ); int unur_distr_corder_get_rank( const UNUR_DISTR *distribution, int *n, int *k ); #define unur_distr_corder_get_pdf(distr) unur_distr_cont_get_pdf((distr)) #define unur_distr_corder_get_dpdf(distr) unur_distr_cont_get_dpdf((distr)) #define unur_distr_corder_get_cdf(distr) unur_distr_cont_get_cdf((distr)) #define unur_distr_corder_eval_pdf(x,distr) unur_distr_cont_eval_pdf((x),(distr)) #define unur_distr_corder_eval_dpdf(x,distr) unur_distr_cont_eval_dpdf((x),(distr)) #define unur_distr_corder_eval_cdf(x,distr) unur_distr_cont_eval_cdf((x),(distr)) #define unur_distr_corder_set_pdfparams(distr,params,n) unur_distr_cont_set_pdfparams((distr),(params),(n)) #define unur_distr_corder_get_pdfparams(distr,params) unur_distr_cont_get_pdfparams((distr),(params)) #define unur_distr_corder_set_domain(distr,left,right) unur_distr_cont_set_domain((distr),(left),(right)) #define unur_distr_corder_get_domain(distr,left,right) unur_distr_cont_get_domain((distr),(left),(right)) #define unur_distr_corder_get_truncated(distr,left,right) unur_distr_cont_get_truncated((distr),(left),(right)) #define unur_distr_corder_set_mode(distr,mode) unur_distr_cont_set_mode((distr),(mode)) #define unur_distr_corder_upd_mode(distr) unur_distr_cont_upd_mode((distr)) #define unur_distr_corder_get_mode(distr) unur_distr_cont_get_mode((distr)) #define unur_distr_corder_set_pdfarea(distr,area) unur_distr_cont_set_pdfarea((distr),(area)) #define unur_distr_corder_upd_pdfarea(distr) unur_distr_cont_upd_pdfarea((distr)) #define unur_distr_corder_get_pdfarea(distr) unur_distr_cont_get_pdfarea((distr)) /* end of `corder.h' */ /*-----*/ /*-----*/ /* <1> `cvec.h' */ UNUR_DISTR *unur_distr_cvec_new( int dim ); int unur_distr_cvec_set_pdf( UNUR_DISTR *distribution, UNUR_FUNCT_CVEC *pdf ); int unur_distr_cvec_set_dpdf( UNUR_DISTR *distribution, UNUR_VFUNCT_CVEC *dpdf ); int unur_distr_cvec_set_pdpdf( UNUR_DISTR *distribution, UNUR_FUNCTD_CVEC *pdpdf ); UNUR_FUNCT_CVEC *unur_distr_cvec_get_pdf( const UNUR_DISTR *distribution ); UNUR_VFUNCT_CVEC *unur_distr_cvec_get_dpdf( const UNUR_DISTR *distribution ); UNUR_FUNCTD_CVEC *unur_distr_cvec_get_pdpdf( const UNUR_DISTR *distribution ); double unur_distr_cvec_eval_pdf( const double *x, UNUR_DISTR *distribution ); int unur_distr_cvec_eval_dpdf( double *result, const double *x, UNUR_DISTR *distribution ); double unur_distr_cvec_eval_pdpdf( const double *x, int coord, UNUR_DISTR *distribution ); int unur_distr_cvec_set_logpdf( UNUR_DISTR *distribution, UNUR_FUNCT_CVEC *logpdf ); int unur_distr_cvec_set_dlogpdf( UNUR_DISTR *distribution, UNUR_VFUNCT_CVEC *dlogpdf ); int unur_distr_cvec_set_pdlogpdf( UNUR_DISTR *distribution, UNUR_FUNCTD_CVEC *pdlogpdf ); UNUR_FUNCT_CVEC *unur_distr_cvec_get_logpdf( const UNUR_DISTR *distribution ); UNUR_VFUNCT_CVEC *unur_distr_cvec_get_dlogpdf( const UNUR_DISTR *distribution ); UNUR_FUNCTD_CVEC *unur_distr_cvec_get_pdlogpdf( const UNUR_DISTR *distribution ); double unur_distr_cvec_eval_logpdf( const double *x, UNUR_DISTR *distribution ); int unur_distr_cvec_eval_dlogpdf( double *result, const double *x, UNUR_DISTR *distribution ); double unur_distr_cvec_eval_pdlogpdf( const double *x, int coord, UNUR_DISTR *distribution ); int unur_distr_cvec_set_mean( UNUR_DISTR *distribution, const double *mean ); const double *unur_distr_cvec_get_mean( const UNUR_DISTR *distribution ); int unur_distr_cvec_set_covar( UNUR_DISTR *distribution, const double *covar ); int unur_distr_cvec_set_covar_inv( UNUR_DISTR *distribution, const double *covar_inv ); const double *unur_distr_cvec_get_covar( const UNUR_DISTR *distribution ); const double *unur_distr_cvec_get_cholesky( const UNUR_DISTR *distribution ); const double *unur_distr_cvec_get_covar_inv( UNUR_DISTR *distribution ); int unur_distr_cvec_set_rankcorr( UNUR_DISTR *distribution, const double *rankcorr ); const double *unur_distr_cvec_get_rankcorr( const UNUR_DISTR *distribution ); const double *unur_distr_cvec_get_rk_cholesky( const UNUR_DISTR *distribution ); int unur_distr_cvec_set_marginals( UNUR_DISTR *distribution, UNUR_DISTR *marginal ); int unur_distr_cvec_set_marginal_array( UNUR_DISTR *distribution, UNUR_DISTR **marginals ); int unur_distr_cvec_set_marginal_list( UNUR_DISTR *distribution, ... ); const UNUR_DISTR *unur_distr_cvec_get_marginal( const UNUR_DISTR *distribution, int n ); int unur_distr_cvec_set_pdfparams( UNUR_DISTR *distribution, const double *params, int n_params ); int unur_distr_cvec_get_pdfparams( const UNUR_DISTR *distribution, const double **params ); int unur_distr_cvec_set_pdfparams_vec( UNUR_DISTR *distribution, int par, const double *param_vec, int n_params ); int unur_distr_cvec_get_pdfparams_vec( const UNUR_DISTR *distribution, int par, const double **param_vecs ); int unur_distr_cvec_set_domain_rect( UNUR_DISTR *distribution, const double *lowerleft, const double *upperright ); int unur_distr_cvec_is_indomain( const double *x, const UNUR_DISTR *distribution ); int unur_distr_cvec_set_mode( UNUR_DISTR *distribution, const double *mode ); int unur_distr_cvec_upd_mode( UNUR_DISTR *distribution ); const double *unur_distr_cvec_get_mode( UNUR_DISTR *distribution ); int unur_distr_cvec_set_center( UNUR_DISTR *distribution, const double *center ); const double *unur_distr_cvec_get_center( UNUR_DISTR *distribution ); int unur_distr_cvec_set_pdfvol( UNUR_DISTR *distribution, double volume ); int unur_distr_cvec_upd_pdfvol( UNUR_DISTR *distribution ); double unur_distr_cvec_get_pdfvol( UNUR_DISTR *distribution ); /* end of `cvec.h' */ /*-----*/ /*-----*/ /* <1> `condi.h' */ UNUR_DISTR *unur_distr_condi_new( const UNUR_DISTR *distribution, const double *pos, const double *dir, int k ); int unur_distr_condi_set_condition( struct unur_distr *distribution, const double *pos, const double *dir, int k ); int unur_distr_condi_get_condition( struct unur_distr *distribution, const double **pos, const double **dir, int *k ); const UNUR_DISTR *unur_distr_condi_get_distribution( const UNUR_DISTR *distribution ); /* end of `condi.h' */ /*-----*/ /*-----*/ /* <1> `cvemp.h' */ UNUR_DISTR *unur_distr_cvemp_new( int dim ); int unur_distr_cvemp_set_data( UNUR_DISTR *distribution, const double *sample, int n_sample ); int unur_distr_cvemp_read_data( UNUR_DISTR *distribution, const char *filename ); int unur_distr_cvemp_get_data( const UNUR_DISTR *distribution, const double **sample ); /* end of `cvemp.h' */ /*-----*/ /*-----*/ /* <1> `discr.h' */ UNUR_DISTR *unur_distr_discr_new( void ); int unur_distr_discr_set_pv( UNUR_DISTR *distribution, const double *pv, int n_pv ); int unur_distr_discr_make_pv( UNUR_DISTR *distribution ); int unur_distr_discr_get_pv( const UNUR_DISTR *distribution, const double **pv ); int unur_distr_discr_set_pmf( UNUR_DISTR *distribution, UNUR_FUNCT_DISCR *pmf ); int unur_distr_discr_set_cdf( UNUR_DISTR *distribution, UNUR_FUNCT_DISCR *cdf ); int unur_distr_discr_set_invcdf( UNUR_DISTR *distribution, UNUR_IFUNCT_DISCR *invcdf ); UNUR_FUNCT_DISCR *unur_distr_discr_get_pmf( const UNUR_DISTR *distribution ); UNUR_FUNCT_DISCR *unur_distr_discr_get_cdf( const UNUR_DISTR *distribution ); UNUR_IFUNCT_DISCR *unur_distr_discr_get_invcdf( const UNUR_DISTR *distribution ); double unur_distr_discr_eval_pv(int k, const UNUR_DISTR *distribution ); double unur_distr_discr_eval_pmf( int k, const UNUR_DISTR *distribution ); double unur_distr_discr_eval_cdf( int k, const UNUR_DISTR *distribution ); int unur_distr_discr_eval_invcdf( double u, const UNUR_DISTR *distribution ); int unur_distr_discr_set_pmfstr( UNUR_DISTR *distribution, const char *pmfstr ); int unur_distr_discr_set_cdfstr( UNUR_DISTR *distribution, const char *cdfstr ); char *unur_distr_discr_get_pmfstr( const UNUR_DISTR *distribution ); char *unur_distr_discr_get_cdfstr( const UNUR_DISTR *distribution ); int unur_distr_discr_set_pmfparams( UNUR_DISTR *distribution, const double *params, int n_params ); int unur_distr_discr_get_pmfparams( const UNUR_DISTR *distribution, const double **params ); int unur_distr_discr_set_domain( UNUR_DISTR *distribution, int left, int right ); int unur_distr_discr_get_domain( const UNUR_DISTR *distribution, int *left, int *right ); int unur_distr_discr_set_mode( UNUR_DISTR *distribution, int mode ); int unur_distr_discr_upd_mode( UNUR_DISTR *distribution ); int unur_distr_discr_get_mode( UNUR_DISTR *distribution ); int unur_distr_discr_set_pmfsum( UNUR_DISTR *distribution, double sum ); int unur_distr_discr_upd_pmfsum( UNUR_DISTR *distribution ); double unur_distr_discr_get_pmfsum( UNUR_DISTR *distribution ); /* end of `discr.h' */ /*-----*/ /*-----*/ /* <1> `matr.h' */ UNUR_DISTR *unur_distr_matr_new( int n_rows, int n_cols ); int unur_distr_matr_get_dim( const UNUR_DISTR *distribution, int *n_rows, int *n_cols ); /* end of `matr.h' */ /*-----*/ /*-----*/ /* <1> `auto.h' */ UNUR_PAR *unur_auto_new( const UNUR_DISTR *distribution ); int unur_auto_set_logss( UNUR_PAR *parameters, int logss ); /* end of `auto.h' */ /*-----*/ /*-----*/ /* <1> `dari.h' */ UNUR_PAR *unur_dari_new( const UNUR_DISTR *distribution ); int unur_dari_set_squeeze( UNUR_PAR *parameters, int squeeze ); int unur_dari_set_tablesize( UNUR_PAR *parameters, int size ); int unur_dari_set_cpfactor( UNUR_PAR *parameters, double cp_factor ); int unur_dari_set_verify( UNUR_PAR *parameters, int verify ); int unur_dari_chg_verify( UNUR_GEN *generator, int verify ); /* end of `dari.h' */ /*-----*/ /*-----*/ /* <1> `dau.h' */ UNUR_PAR *unur_dau_new( const UNUR_DISTR *distribution ); int unur_dau_set_urnfactor( UNUR_PAR *parameters, double factor ); /* end of `dau.h' */ /*-----*/ /*-----*/ /* <1> `dgt.h' */ UNUR_PAR *unur_dgt_new( const UNUR_DISTR *distribution ); int unur_dgt_set_guidefactor( UNUR_PAR *parameters, double factor ); int unur_dgt_set_variant( UNUR_PAR *parameters, unsigned variant ); int unur_dgt_eval_invcdf_recycle( const UNUR_GEN *generator, double u, double *recycle ); int unur_dgt_eval_invcdf( const UNUR_GEN *generator, double u ); /* end of `dgt.h' */ /*-----*/ /*-----*/ /* <1> `dsrou.h' */ UNUR_PAR *unur_dsrou_new( const UNUR_DISTR *distribution ); int unur_dsrou_set_cdfatmode( UNUR_PAR *parameters, double Fmode ); int unur_dsrou_set_verify( UNUR_PAR *parameters, int verify ); int unur_dsrou_chg_verify( UNUR_GEN *generator, int verify ); int unur_dsrou_chg_cdfatmode( UNUR_GEN *generator, double Fmode ); /* end of `dsrou.h' */ /*-----*/ /*-----*/ /* <1> `dss.h' */ UNUR_PAR *unur_dss_new( const UNUR_DISTR *distribution ); /* end of `dss.h' */ /*-----*/ /*-----*/ /* <1> `arou.h' */ UNUR_PAR *unur_arou_new( const UNUR_DISTR *distribution ); int unur_arou_set_usedars( UNUR_PAR *parameters, int usedars ); int unur_arou_set_darsfactor( UNUR_PAR *parameters, double factor ); int unur_arou_set_max_sqhratio( UNUR_PAR *parameters, double max_ratio ); double unur_arou_get_sqhratio( const UNUR_GEN *generator ); double unur_arou_get_hatarea( const UNUR_GEN *generator ); double unur_arou_get_squeezearea( const UNUR_GEN *generator ); int unur_arou_set_max_segments( UNUR_PAR *parameters, int max_segs ); int unur_arou_set_cpoints( UNUR_PAR *parameters, int n_stp, const double *stp ); int unur_arou_set_usecenter( UNUR_PAR *parameters, int usecenter ); int unur_arou_set_guidefactor( UNUR_PAR *parameters, double factor ); int unur_arou_set_verify( UNUR_PAR *parameters, int verify ); int unur_arou_chg_verify( UNUR_GEN *generator, int verify ); int unur_arou_set_pedantic( UNUR_PAR *parameters, int pedantic ); /* end of `arou.h' */ /*-----*/ /*-----*/ /* <1> `ars.h' */ UNUR_PAR *unur_ars_new( const UNUR_DISTR* distribution ); int unur_ars_set_max_intervals( UNUR_PAR *parameters, int max_ivs ); int unur_ars_set_cpoints( UNUR_PAR *parameters, int n_cpoints, const double *cpoints ); int unur_ars_set_reinit_percentiles( UNUR_PAR *parameters, int n_percentiles, const double *percentiles ); int unur_ars_chg_reinit_percentiles( UNUR_GEN *generator, int n_percentiles, const double *percentiles ); int unur_ars_set_reinit_ncpoints( UNUR_PAR *parameters, int ncpoints ); int unur_ars_chg_reinit_ncpoints( UNUR_GEN *generator, int ncpoints ); int unur_ars_set_max_iter( UNUR_PAR *parameters, int max_iter ); int unur_ars_set_verify( UNUR_PAR *parameters, int verify ); int unur_ars_chg_verify( UNUR_GEN *generator, int verify ); int unur_ars_set_pedantic( UNUR_PAR *parameters, int pedantic ); double unur_ars_get_loghatarea( const UNUR_GEN *generator ); double unur_ars_eval_invcdfhat( const UNUR_GEN *generator, double u ); /* end of `ars.h' */ /*-----*/ /*-----*/ /* <1> `hinv.h' */ UNUR_PAR *unur_hinv_new( const UNUR_DISTR *distribution ); int unur_hinv_set_order( UNUR_PAR *parameters, int order); int unur_hinv_set_u_resolution( UNUR_PAR *parameters, double u_resolution); int unur_hinv_set_cpoints( UNUR_PAR *parameters, const double *stp, int n_stp ); int unur_hinv_set_boundary( UNUR_PAR *parameters, double left, double right ); int unur_hinv_set_guidefactor( UNUR_PAR *parameters, double factor ); int unur_hinv_set_max_intervals( UNUR_PAR *parameters, int max_ivs ); int unur_hinv_get_n_intervals( const UNUR_GEN *generator ); double unur_hinv_eval_approxinvcdf( const UNUR_GEN *generator, double u ); int unur_hinv_chg_truncated( UNUR_GEN *generator, double left, double right ); int unur_hinv_estimate_error( const UNUR_GEN *generator, int samplesize, double *max_error, double *MAE ); /* end of `hinv.h' */ /*-----*/ /*-----*/ /* <1> `hrb.h' */ UNUR_PAR *unur_hrb_new( const UNUR_DISTR *distribution ); int unur_hrb_set_upperbound( UNUR_PAR *parameters, double upperbound ); int unur_hrb_set_verify( UNUR_PAR *parameters, int verify ); int unur_hrb_chg_verify( UNUR_GEN *generator, int verify ); /* end of `hrb.h' */ /*-----*/ /*-----*/ /* <1> `hrd.h' */ UNUR_PAR *unur_hrd_new( const UNUR_DISTR *distribution ); int unur_hrd_set_verify( UNUR_PAR *parameters, int verify ); int unur_hrd_chg_verify( UNUR_GEN *generator, int verify ); /* end of `hrd.h' */ /*-----*/ /*-----*/ /* <1> `hri.h' */ UNUR_PAR *unur_hri_new( const UNUR_DISTR *distribution ); int unur_hri_set_p0( UNUR_PAR *parameters, double p0 ); int unur_hri_set_verify( UNUR_PAR *parameters, int verify ); int unur_hri_chg_verify( UNUR_GEN *generator, int verify ); /* end of `hri.h' */ /*-----*/ /*-----*/ /* <1> `itdr.h' */ UNUR_PAR *unur_itdr_new( const UNUR_DISTR *distribution ); int unur_itdr_set_xi( UNUR_PAR *parameters, double xi ); int unur_itdr_set_cp( UNUR_PAR *parameters, double cp ); int unur_itdr_set_ct( UNUR_PAR *parameters, double ct ); double unur_itdr_get_xi( UNUR_GEN *generator ); double unur_itdr_get_cp( UNUR_GEN *generator ); double unur_itdr_get_ct( UNUR_GEN *generator ); double unur_itdr_get_area( UNUR_GEN *generator ); int unur_itdr_set_verify( UNUR_PAR *parameters, int verify ); int unur_itdr_chg_verify( UNUR_GEN *generator, int verify ); /* end of `itdr.h' */ /*-----*/ /*-----*/ /* <1> `mcorr.h' */ UNUR_PAR *unur_mcorr_new( const UNUR_DISTR *distribution ); int unur_mcorr_set_eigenvalues( UNUR_PAR *par, const double *eigenvalues ); int unur_mcorr_chg_eigenvalues( UNUR_GEN *gen, const double *eigenvalues ); /* end of `mcorr.h' */ /*-----*/ /*-----*/ /* <1> `ninv.h' */ UNUR_PAR *unur_ninv_new( const UNUR_DISTR *distribution ); int unur_ninv_set_useregula( UNUR_PAR *parameters ); int unur_ninv_set_usenewton( UNUR_PAR *parameters ); int unur_ninv_set_usebisect( UNUR_PAR *parameters ); int unur_ninv_set_max_iter( UNUR_PAR *parameters, int max_iter ); int unur_ninv_chg_max_iter(UNUR_GEN *generator, int max_iter); int unur_ninv_set_x_resolution( UNUR_PAR *parameters, double x_resolution); int unur_ninv_chg_x_resolution(UNUR_GEN *generator, double x_resolution); int unur_ninv_set_u_resolution( UNUR_PAR *parameters, double u_resolution); int unur_ninv_chg_u_resolution(UNUR_GEN *generator, double u_resolution); int unur_ninv_set_start( UNUR_PAR *parameters, double left, double right); int unur_ninv_chg_start(UNUR_GEN *gen, double left, double right); int unur_ninv_set_table(UNUR_PAR *parameters, int no_of_points); int unur_ninv_chg_table(UNUR_GEN *gen, int no_of_points); int unur_ninv_chg_truncated(UNUR_GEN *gen, double left, double right); double unur_ninv_eval_approxinvcdf( const UNUR_GEN *generator, double u ); /* end of `ninv.h' */ /*-----*/ /*-----*/ /* <1> `nrou.h' */ UNUR_PAR *unur_nrou_new( const UNUR_DISTR *distribution ); int unur_nrou_set_u( UNUR_PAR *parameters, double umin, double umax ); int unur_nrou_set_v( UNUR_PAR *parameters, double vmax ); int unur_nrou_set_r( UNUR_PAR *parameters, double r ); int unur_nrou_set_center( UNUR_PAR *parameters, double center ); int unur_nrou_set_verify( UNUR_PAR *parameters, int verify ); int unur_nrou_chg_verify( UNUR_GEN *generator, int verify ); /* end of `nrou.h' */ /*-----*/ /*-----*/ /* <1> `pinv.h' */ UNUR_PAR *unur_pinv_new( const UNUR_DISTR *distribution ); int unur_pinv_set_order( UNUR_PAR *parameters, int order); int unur_pinv_set_smoothness( UNUR_PAR *parameters, int smoothness); int unur_pinv_set_u_resolution( UNUR_PAR *parameters, double u_resolution); int unur_pinv_set_extra_testpoints( UNUR_PAR *parameters, int n_points); int unur_pinv_set_use_upoints( UNUR_PAR *parameters, int use_upoints ); int unur_pinv_set_usepdf( UNUR_PAR *parameters ); int unur_pinv_set_usecdf( UNUR_PAR *parameters ); int unur_pinv_set_boundary( UNUR_PAR *parameters, double left, double right ); int unur_pinv_set_searchboundary( UNUR_PAR *parameters, int left, int right ); int unur_pinv_set_max_intervals( UNUR_PAR *parameters, int max_ivs ); int unur_pinv_get_n_intervals( const UNUR_GEN *generator ); int unur_pinv_set_keepcdf( UNUR_PAR *parameters, int keepcdf); double unur_pinv_eval_approxinvcdf( const UNUR_GEN *generator, double u ); double unur_pinv_eval_approxcdf( const UNUR_GEN *generator, double x ); int unur_pinv_estimate_error( const UNUR_GEN *generator, int samplesize, double *max_error, double *MAE ); /* end of `pinv.h' */ /*-----*/ /*-----*/ /* <1> `srou.h' */ UNUR_PAR *unur_srou_new( const UNUR_DISTR *distribution ); int unur_srou_set_r( UNUR_PAR *parameters, double r ); int unur_srou_set_cdfatmode( UNUR_PAR *parameters, double Fmode ); int unur_srou_set_pdfatmode( UNUR_PAR *parameters, double fmode ); int unur_srou_set_usesqueeze( UNUR_PAR *parameters, int usesqueeze ); int unur_srou_set_usemirror( UNUR_PAR *parameters, int usemirror ); int unur_srou_set_verify( UNUR_PAR *parameters, int verify ); int unur_srou_chg_verify( UNUR_GEN *generator, int verify ); int unur_srou_chg_cdfatmode( UNUR_GEN *generator, double Fmode ); int unur_srou_chg_pdfatmode( UNUR_GEN *generator, double fmode ); /* end of `srou.h' */ /*-----*/ /*-----*/ /* <1> `ssr.h' */ UNUR_PAR *unur_ssr_new( const UNUR_DISTR *distribution ); int unur_ssr_set_cdfatmode( UNUR_PAR *parameters, double Fmode ); int unur_ssr_set_pdfatmode( UNUR_PAR *parameters, double fmode ); int unur_ssr_set_usesqueeze( UNUR_PAR *parameters, int usesqueeze ); int unur_ssr_set_verify( UNUR_PAR *parameters, int verify ); int unur_ssr_chg_verify( UNUR_GEN *generator, int verify ); int unur_ssr_chg_cdfatmode( UNUR_GEN *generator, double Fmode ); int unur_ssr_chg_pdfatmode( UNUR_GEN *generator, double fmode ); /* end of `ssr.h' */ /*-----*/ /*-----*/ /* <1> `tabl.h' */ UNUR_PAR *unur_tabl_new( const UNUR_DISTR* distribution ); int unur_tabl_set_variant_ia( UNUR_PAR *parameters, int use_ia ); int unur_tabl_set_cpoints( UNUR_PAR *parameters, int n_cpoints, const double *cpoints ); int unur_tabl_set_nstp( UNUR_PAR *parameters, int n_stp ); int unur_tabl_set_useear( UNUR_PAR *parameters, int useear ); int unur_tabl_set_areafraction( UNUR_PAR *parameters, double fraction ); int unur_tabl_set_usedars( UNUR_PAR *parameters, int usedars ); int unur_tabl_set_darsfactor( UNUR_PAR *parameters, double factor ); int unur_tabl_set_variant_splitmode( UNUR_PAR *parameters, unsigned splitmode ); int unur_tabl_set_max_sqhratio( UNUR_PAR *parameters, double max_ratio ); double unur_tabl_get_sqhratio( const UNUR_GEN *generator ); double unur_tabl_get_hatarea( const UNUR_GEN *generator ); double unur_tabl_get_squeezearea( const UNUR_GEN *generator ); int unur_tabl_set_max_intervals( UNUR_PAR *parameters, int max_ivs ); int unur_tabl_get_n_intervals( const UNUR_GEN *generator ); int unur_tabl_set_slopes( UNUR_PAR *parameters, const double *slopes, int n_slopes ); int unur_tabl_set_guidefactor( UNUR_PAR *parameters, double factor ); int unur_tabl_set_boundary( UNUR_PAR *parameters, double left, double right ); int unur_tabl_chg_truncated(UNUR_GEN *gen, double left, double right); int unur_tabl_set_verify( UNUR_PAR *parameters, int verify ); int unur_tabl_chg_verify( UNUR_GEN *generator, int verify ); int unur_tabl_set_pedantic( UNUR_PAR *parameters, int pedantic ); /* end of `tabl.h' */ /*-----*/ /*-----*/ /* <1> `tdr.h' */ UNUR_PAR *unur_tdr_new( const UNUR_DISTR* distribution ); int unur_tdr_set_c( UNUR_PAR *parameters, double c ); int unur_tdr_set_variant_gw( UNUR_PAR *parameters ); int unur_tdr_set_variant_ps( UNUR_PAR *parameters ); int unur_tdr_set_variant_ia( UNUR_PAR *parameters ); int unur_tdr_set_usedars( UNUR_PAR *parameters, int usedars ); int unur_tdr_set_darsfactor( UNUR_PAR *parameters, double factor ); int unur_tdr_set_cpoints( UNUR_PAR *parameters, int n_stp, const double *stp ); int unur_tdr_set_reinit_percentiles( UNUR_PAR *parameters, int n_percentiles, const double *percentiles ); int unur_tdr_chg_reinit_percentiles( UNUR_GEN *generator, int n_percentiles, const double *percentiles ); int unur_tdr_set_reinit_ncpoints( UNUR_PAR *parameters, int ncpoints ); int unur_tdr_chg_reinit_ncpoints( UNUR_GEN *generator, int ncpoints ); int unur_tdr_chg_truncated(UNUR_GEN *gen, double left, double right); int unur_tdr_set_max_sqhratio( UNUR_PAR *parameters, double max_ratio ); double unur_tdr_get_sqhratio( const UNUR_GEN *generator ); double unur_tdr_get_hatarea( const UNUR_GEN *generator ); double unur_tdr_get_squeezearea( const UNUR_GEN *generator ); int unur_tdr_set_max_intervals( UNUR_PAR *parameters, int max_ivs ); int unur_tdr_set_usecenter( UNUR_PAR *parameters, int usecenter ); int unur_tdr_set_usemode( UNUR_PAR *parameters, int usemode ); int unur_tdr_set_guidefactor( UNUR_PAR *parameters, double factor ); int unur_tdr_set_verify( UNUR_PAR *parameters, int verify ); int unur_tdr_chg_verify( UNUR_GEN *generator, int verify ); int unur_tdr_set_pedantic( UNUR_PAR *parameters, int pedantic ); double unur_tdr_eval_invcdfhat( const UNUR_GEN *generator, double u, double *hx, double *fx, double *sqx ); int _unur_tdr_is_ARS_running( const UNUR_GEN *generator ); /* end of `tdr.h' */ /*-----*/ /*-----*/ /* <1> `utdr.h' */ UNUR_PAR *unur_utdr_new( const UNUR_DISTR *distribution ); int unur_utdr_set_pdfatmode( UNUR_PAR *parameters, double fmode ); int unur_utdr_set_cpfactor( UNUR_PAR *parameters, double cp_factor ); int unur_utdr_set_deltafactor( UNUR_PAR *parameters, double delta ); int unur_utdr_set_verify( UNUR_PAR *parameters, int verify ); int unur_utdr_chg_verify( UNUR_GEN *generator, int verify ); int unur_utdr_chg_pdfatmode( UNUR_GEN *generator, double fmode ); /* end of `utdr.h' */ /*-----*/ /*-----*/ /* <1> `empk.h' */ UNUR_PAR *unur_empk_new( const UNUR_DISTR *distribution ); int unur_empk_set_kernel( UNUR_PAR *parameters, unsigned kernel); int unur_empk_set_kernelgen( UNUR_PAR *parameters, const UNUR_GEN *kernelgen, double alpha, double kernelvar ); int unur_empk_set_beta( UNUR_PAR *parameters, double beta ); int unur_empk_set_smoothing( UNUR_PAR *parameters, double smoothing ); int unur_empk_chg_smoothing( UNUR_GEN *generator, double smoothing ); int unur_empk_set_varcor( UNUR_PAR *parameters, int varcor ); int unur_empk_chg_varcor( UNUR_GEN *generator, int varcor ); int unur_empk_set_positive( UNUR_PAR *parameters, int positive ); /* end of `empk.h' */ /*-----*/ /*-----*/ /* <1> `empl.h' */ UNUR_PAR *unur_empl_new( const UNUR_DISTR *distribution ); /* end of `empl.h' */ /*-----*/ /*-----*/ /* <1> `hist.h' */ UNUR_PAR *unur_hist_new( const UNUR_DISTR *distribution ); /* end of `hist.h' */ /*-----*/ /*-----*/ /* <1> `mvtdr.h' */ UNUR_PAR *unur_mvtdr_new( const UNUR_DISTR *distribution ); int unur_mvtdr_set_stepsmin( UNUR_PAR *parameters, int stepsmin ); int unur_mvtdr_set_boundsplitting( UNUR_PAR *parameters, double boundsplitting ); int unur_mvtdr_set_maxcones( UNUR_PAR *parameters, int maxcones ); int unur_mvtdr_get_ncones( const UNUR_GEN *generator ); double unur_mvtdr_get_hatvol( const UNUR_GEN *generator ); int unur_mvtdr_set_verify( UNUR_PAR *parameters, int verify ); int unur_mvtdr_chg_verify( UNUR_GEN *generator, int verify ); /* end of `mvtdr.h' */ /*-----*/ /*-----*/ /* <1> `norta.h' */ UNUR_PAR *unur_norta_new( const UNUR_DISTR *distribution ); /* end of `norta.h' */ /*-----*/ /*-----*/ /* <1> `vempk.h' */ UNUR_PAR *unur_vempk_new( const UNUR_DISTR *distribution ); int unur_vempk_set_smoothing( UNUR_PAR *parameters, double smoothing ); int unur_vempk_chg_smoothing( UNUR_GEN *generator, double smoothing ); int unur_vempk_set_varcor( UNUR_PAR *parameters, int varcor ); int unur_vempk_chg_varcor( UNUR_GEN *generator, int varcor ); /* end of `vempk.h' */ /*-----*/ /*-----*/ /* <1> `vnrou.h' */ UNUR_PAR *unur_vnrou_new( const UNUR_DISTR *distribution ); int unur_vnrou_set_u( UNUR_PAR *parameters, double *umin, double *umax ); int unur_vnrou_chg_u( UNUR_GEN *generator, double *umin, double *umax ); int unur_vnrou_set_v( UNUR_PAR *parameters, double vmax ); int unur_vnrou_chg_v( UNUR_GEN *generator, double vmax ); int unur_vnrou_set_r( UNUR_PAR *parameters, double r ); int unur_vnrou_set_verify( UNUR_PAR *parameters, int verify ); int unur_vnrou_chg_verify( UNUR_GEN *generator, int verify ); double unur_vnrou_get_volumehat( const UNUR_GEN *generator ); /* end of `vnrou.h' */ /*-----*/ /*-----*/ /* <1> `gibbs.h' */ UNUR_PAR *unur_gibbs_new( const UNUR_DISTR *distribution ); int unur_gibbs_set_variant_coordinate( UNUR_PAR *parameters ); int unur_gibbs_set_variant_random_direction( UNUR_PAR *parameters ); int unur_gibbs_set_c( UNUR_PAR *parameters, double c ); int unur_gibbs_set_startingpoint( UNUR_PAR *parameters, const double *x0 ); int unur_gibbs_set_thinning( UNUR_PAR *parameters, int thinning ); int unur_gibbs_set_burnin( UNUR_PAR *parameters, int burnin ); const double *unur_gibbs_get_state( UNUR_GEN *generator ); int unur_gibbs_chg_state( UNUR_GEN *generator, const double *state ); int unur_gibbs_reset_state( UNUR_GEN *generator ); /* end of `gibbs.h' */ /*-----*/ /*-----*/ /* <1> `hitro.h' */ UNUR_PAR *unur_hitro_new( const UNUR_DISTR *distribution ); int unur_hitro_set_variant_coordinate( UNUR_PAR *parameters ); int unur_hitro_set_variant_random_direction( UNUR_PAR *parameters ); int unur_hitro_set_use_adaptiveline( UNUR_PAR *parameters, int adaptive ); int unur_hitro_set_use_boundingrectangle( UNUR_PAR *parameters, int rectangle ); int unur_hitro_set_use_adaptiverectangle( UNUR_PAR *parameters, int adaptive ); int unur_hitro_set_r( UNUR_PAR *parameters, double r ); int unur_hitro_set_v( UNUR_PAR *parameters, double vmax ); int unur_hitro_set_u( UNUR_PAR *parameters, const double *umin, const double *umax ); int unur_hitro_set_adaptive_multiplier( UNUR_PAR *parameters, double factor ); int unur_hitro_set_startingpoint( UNUR_PAR *parameters, const double *x0 ); int unur_hitro_set_thinning( UNUR_PAR *parameters, int thinning ); int unur_hitro_set_burnin( UNUR_PAR *parameters, int burnin ); const double *unur_hitro_get_state( UNUR_GEN *generator ); int unur_hitro_chg_state( UNUR_GEN *generator, const double *state ); int unur_hitro_reset_state( UNUR_GEN *generator ); /* end of `hitro.h' */ /*-----*/ /*-----*/ /* <1> `cstd.h' */ #define UNUR_STDGEN_DEFAULT 0 #define UNUR_STDGEN_INVERSION (~0u) #define UNUR_STDGEN_FAST (0) UNUR_PAR *unur_cstd_new( const UNUR_DISTR *distribution ); int unur_cstd_set_variant( UNUR_PAR *parameters, unsigned variant ); int unur_cstd_chg_truncated( UNUR_GEN *generator, double left, double right ); double unur_cstd_eval_invcdf( const UNUR_GEN *generator, double u ); /* end of `cstd.h' */ /*-----*/ /*-----*/ /* <1> `dstd.h' */ UNUR_PAR *unur_dstd_new( const UNUR_DISTR *distribution ); int unur_dstd_set_variant( UNUR_PAR *parameters, unsigned variant ); int unur_dstd_chg_truncated( UNUR_GEN *generator, int left, int right ); int unur_dstd_eval_invcdf( const UNUR_GEN *generator, double u ); /* end of `dstd.h' */ /*-----*/ /*-----*/ /* <1> `mvstd.h' */ UNUR_PAR *unur_mvstd_new( const UNUR_DISTR *distribution ); /* end of `mvstd.h' */ /*-----*/ /*-----*/ /* <1> `mixt.h' */ UNUR_PAR *unur_mixt_new( int n, const double *prob, UNUR_GEN **comp ); int unur_mixt_set_useinversion( UNUR_PAR *parameters, int useinv ); double unur_mixt_eval_invcdf( const UNUR_GEN *generator, double u ); /* end of `mixt.h' */ /*-----*/ /*-----*/ /* <1> `cext.h' */ UNUR_PAR *unur_cext_new( const UNUR_DISTR *distribution ); int unur_cext_set_init( UNUR_PAR *parameters, int (*init)(UNUR_GEN *gen) ); int unur_cext_set_sample( UNUR_PAR *parameters, double (*sample)(UNUR_GEN *gen) ); void *unur_cext_get_params( UNUR_GEN *generator, size_t size ); double *unur_cext_get_distrparams( UNUR_GEN *generator ); int unur_cext_get_ndistrparams( UNUR_GEN *generator ); /* end of `cext.h' */ /*-----*/ /*-----*/ /* <1> `dext.h' */ UNUR_PAR *unur_dext_new( const UNUR_DISTR *distribution ); int unur_dext_set_init( UNUR_PAR *parameters, int (*init)(UNUR_GEN *gen) ); int unur_dext_set_sample( UNUR_PAR *parameters, int (*sample)(UNUR_GEN *gen) ); void *unur_dext_get_params( UNUR_GEN *generator, size_t size ); double *unur_dext_get_distrparams( UNUR_GEN *generator ); int unur_dext_get_ndistrparams( UNUR_GEN *generator ); /* end of `dext.h' */ /*-----*/ /*-----*/ /* <1> `unif.h' */ UNUR_PAR *unur_unif_new( const UNUR_DISTR *dummy ); /* end of `unif.h' */ /*-----*/ /*-----*/ /* <1> `unur_methods.h' */ #ifndef UNUR_METHODS_H_SEEN #define UNUR_METHODS_H_SEEN #define UNUR_MASK_TYPE 0xff000000u #define UNUR_METH_DISCR 0x01000000u #define UNUR_METH_DARI 0x01000001u #define UNUR_METH_DAU 0x01000002u #define UNUR_METH_DGT 0x01000003u #define UNUR_METH_DSROU 0x01000004u #define UNUR_METH_DSS 0x01000005u #define UNUR_METH_CONT 0x02000000u #define UNUR_METH_AROU 0x02000100u #define UNUR_METH_ARS 0x02000d00u #define UNUR_METH_HINV 0x02000200u #define UNUR_METH_HRB 0x02000300u #define UNUR_METH_HRD 0x02000400u #define UNUR_METH_HRI 0x02000500u #define UNUR_METH_ITDR 0x02000800u #define UNUR_METH_NINV 0x02000600u #define UNUR_METH_NROU 0x02000700u #define UNUR_METH_PINV 0x02001000u #define UNUR_METH_SROU 0x02000900u #define UNUR_METH_SSR 0x02000a00u #define UNUR_METH_TABL 0x02000b00u #define UNUR_METH_TDR 0x02000c00u #define UNUR_METH_UNIF 0x02000e00u #define UNUR_METH_UTDR 0x02000f00u #define UNUR_METH_CEMP 0x04000000u #define UNUR_METH_EMPK 0x04001100u #define UNUR_METH_EMPL 0x04001200u #define UNUR_METH_HIST 0x04001300u #define UNUR_METH_VEC 0x08000000u #define UNUR_METH_MVTDR 0x08010000u #define UNUR_METH_VMT 0x08020000u #define UNUR_METH_VNROU 0x08030000u #define UNUR_METH_VAROU 0x08040000u #define UNUR_METH_NORTA 0x08050000u #define UNUR_METH_GIBBS 0x08060000u #define UNUR_METH_HITRO 0x08070000u #define UNUR_METH_BALL 0x08080000u #define UNUR_METH_WALK 0x08090000u #define UNUR_METH_CVEMP 0x10000000u #define UNUR_METH_VEMPK 0x10010000u #define UNUR_METH_MAT 0x20000000u #define UNUR_METH_MCORR 0x20010000u #define UNUR_METH_CSTD 0x0200f100u #define UNUR_METH_DSTD 0x0100f200u #define UNUR_METH_MVSTD 0x0800f300u #define UNUR_METH_MIXT 0x0200e100u #define UNUR_METH_CEXT 0x0200f400u #define UNUR_METH_DEXT 0x0100f500u #define UNUR_METH_AUTO 0x00a00000u #define UNUR_METH_UNKNOWN 0xff000000u #endif /* end of `unur_methods.h' */ /*-----*/ /*-----*/ /* <1> `deprecated_distr.h' */ #ifndef UNUR_DEPRECATED_DISTR_H_SEEN #define UNUR_DEPRECATED_DISTR_H_SEEN int unur_distr_cvec_set_stdmarginals( UNUR_DISTR *distribution, UNUR_DISTR *marginal ); int unur_distr_cvec_set_stdmarginal_array( UNUR_DISTR *distribution, UNUR_DISTR **marginals ); int unur_distr_cvec_set_stdmarginal_list( UNUR_DISTR *distribution, ... ); const UNUR_DISTR *unur_distr_cvec_get_stdmarginal( const UNUR_DISTR *distribution, int n ); #endif /* end of `deprecated_distr.h' */ /*-----*/ /*-----*/ /* <1> `deprecated_methods.h' */ #ifndef UNUR_DEPRECATED_METHODS_H_SEEN #define UNUR_DEPRECATED_METHODS_H_SEEN int unur_cstd_chg_pdfparams( UNUR_GEN *generator, double *params, int n_params ); int unur_dari_reinit( UNUR_GEN *generator ); int unur_dari_chg_pmfparams( UNUR_GEN *generator, double *params, int n_params ); int unur_dari_chg_domain( UNUR_GEN *generator, int left, int right ); int unur_dari_chg_mode( UNUR_GEN *generator, int mode ); int unur_dari_upd_mode( UNUR_GEN *generator ); int unur_dari_chg_pmfsum( UNUR_GEN *generator, double sum ); int unur_dari_upd_pmfsum( UNUR_GEN *generator ); int unur_dsrou_reinit( UNUR_GEN *generator ); int unur_dsrou_chg_pmfparams( UNUR_GEN *generator, double *params, int n_params ); int unur_dsrou_chg_domain( UNUR_GEN *generator, int left, int right ); int unur_dsrou_chg_mode( UNUR_GEN *generator, int mode ); int unur_dsrou_upd_mode( UNUR_GEN *generator ); int unur_dsrou_chg_pmfsum( UNUR_GEN *generator, double sum ); int unur_dsrou_upd_pmfsum( UNUR_GEN *generator ); int unur_dstd_chg_pmfparams( UNUR_GEN *gen, double *params, int n_params ); int unur_ninv_chg_pdfparams(UNUR_GEN *generator, double *params, int n_params); int unur_srou_reinit( UNUR_GEN *generator ); int unur_srou_chg_pdfparams( UNUR_GEN *generator, double *params, int n_params ); int unur_srou_chg_domain( UNUR_GEN *generator, double left, double right ); int unur_srou_chg_mode( UNUR_GEN *generator, double mode ); int unur_srou_upd_mode( UNUR_GEN *generator ); int unur_srou_chg_pdfarea( UNUR_GEN *generator, double area ); int unur_srou_upd_pdfarea( UNUR_GEN *generator ); int unur_ssr_reinit( UNUR_GEN *generator ); int unur_ssr_chg_pdfparams( UNUR_GEN *generator, double *params, int n_params ); int unur_ssr_chg_domain( UNUR_GEN *generator, double left, double right ); int unur_ssr_chg_mode( UNUR_GEN *generator, double mode ); int unur_ssr_upd_mode( UNUR_GEN *generator ); int unur_ssr_chg_pdfarea( UNUR_GEN *generator, double area ); int unur_ssr_upd_pdfarea( UNUR_GEN *generator ); int unur_tdr_reinit( UNUR_GEN *generator ); int unur_tdrgw_reinit( UNUR_GEN *generator ); int unur_utdr_reinit( UNUR_GEN *generator ); int unur_utdr_chg_pdfparams( UNUR_GEN *generator, double *params, int n_params ); int unur_utdr_chg_domain( UNUR_GEN *generator, double left, double right ); int unur_utdr_chg_mode( UNUR_GEN *generator, double mode ); int unur_utdr_upd_mode( UNUR_GEN *generator ); int unur_utdr_chg_pdfarea( UNUR_GEN *generator, double area ); int unur_utdr_upd_pdfarea( UNUR_GEN *generator ); #endif /* end of `deprecated_methods.h' */ /*-----*/ /*-----*/ /* <1> `deprecated_tdrgw.h' */ #define unur_tdrgw_new( distr ) \ (unur_ars_new( distr )) #define unur_tdrgw_set_max_intervals( par,max_ivs ) \ (unur_ars_set_max_intervals( (par),(max_ivs) )) #define unur_tdrgw_set_cpoints( par,n_cpoints,cpoints ) \ (unur_ars_set_cpoints( (par),(n_cpoints),(cpoints) )) #define unur_tdrgw_set_reinit_percentiles( par,n_percentiles,percentiles ) \ (unur_ars_set_reinit_percentiles( (par),(n_percentiles),(percentiles) )) #define unur_tdrgw_chg_reinit_percentiles( gen,n_percentiles,percentiles ) \ (unur_ars_chg_reinit_percentiles( (gen),(n_percentiles),(percentiles) )) #define unur_tdrgw_set_reinit_ncpoints( par,ncpoints ) \ (unur_ars_set_reinit_ncpoints( (par),(ncpoints) )) #define unur_tdrgw_chg_reinit_ncpoints( gen,ncpoints ) \ (unur_ars_chg_reinit_ncpoints( (gen),(ncpoints) )) #define unur_tdrgw_set_verify( par,verify ) \ (unur_ars_set_verify( (par),(verify) )) #define unur_tdrgw_chg_verify( gen,verify ) \ (unur_ars_chg_verify( (gen),(verify) )) #define unur_tdrgw_set_pedantic( par,pedantic ) \ (unur_ars_set_pedantic( (par),(pedantic) )) #define unur_tdrgw_get_loghatarea( gen ) \ (unur_ars_get_loghatarea( gen )) #define unur_tdrgw_eval_invcdfhat( gen,u ) \ (unur_ars_eval_invcdfhat( (gen),(u) )) /* end of `deprecated_tdrgw.h' */ /*-----*/ /*-----*/ /* <1> `deprecated_vmt.h' */ UNUR_PAR *unur_vmt_new( const UNUR_DISTR *distribution ); /* end of `deprecated_vmt.h' */ /*-----*/ /*-----*/ /* <1> `parser.h' */ UNUR_GEN *unur_str2gen( const char *string ); UNUR_DISTR *unur_str2distr( const char *string ); UNUR_GEN *unur_makegen_ssu( const char *distrstr, const char *methodstr, UNUR_URNG *urng ); UNUR_GEN *unur_makegen_dsu( const UNUR_DISTR *distribution, const char *methodstr, UNUR_URNG *urng ); UNUR_PAR *_unur_str2par( const UNUR_DISTR *distribution, const char *method, struct unur_slist **mlist ); /* end of `parser.h' */ /*-----*/ /*-----*/ /* <1> `x_gen.h' */ UNUR_GEN *unur_init( UNUR_PAR *parameters ); int unur_reinit( UNUR_GEN *generator ); int unur_sample_discr(UNUR_GEN *generator); double unur_sample_cont(UNUR_GEN *generator); int unur_sample_vec(UNUR_GEN *generator, double *vector); int unur_sample_matr(UNUR_GEN *generator, double *matrix); double unur_quantile ( UNUR_GEN *generator, double U ); void unur_free( UNUR_GEN *generator ); const char *unur_gen_info( UNUR_GEN *generator, int help ); int unur_get_dimension( const UNUR_GEN *generator ); const char *unur_get_genid( const UNUR_GEN *generator ); unsigned int unur_get_method( const UNUR_GEN *generator ); int unur_gen_is_inversion ( const UNUR_GEN *gen ); UNUR_DISTR *unur_get_distr( const UNUR_GEN *generator ); int unur_set_use_distr_privatecopy( UNUR_PAR *parameters, int use_privatecopy ); UNUR_GEN *unur_gen_clone( const UNUR_GEN *gen ); void unur_par_free( UNUR_PAR *par); /* end of `x_gen.h' */ /*-----*/ /*-----*/ /* <1> `unur_distributions.h' */ #ifndef UNURAN_DISTRIBUTIONS_H_SEEN #define UNURAN_DISTRIBUTIONS_H_SEEN /*-----*/ /* <2> `unur_stddistr.h' */ #ifndef UNUR_STDDISTR_H_SEEN #define UNUR_STDDISTR_H_SEEN #define UNUR_DISTR_STD (0x00000001u) enum { UNUR_DISTR_GENERIC = 0x00000000u, UNUR_DISTR_CORDER = 0x00000010u, UNUR_DISTR_CXTRANS = 0x00000020u, UNUR_DISTR_CONDI = 0x00000030u, UNUR_DISTR_BETA = 0x00000101u, UNUR_DISTR_CAUCHY = 0x00000201u, UNUR_DISTR_CHI = 0x00000301u, UNUR_DISTR_CHISQUARE = 0x00000401u, UNUR_DISTR_EPANECHNIKOV = 0x00000501u, UNUR_DISTR_EXPONENTIAL = 0x00000601u, UNUR_DISTR_EXTREME_I = 0x00000701u, UNUR_DISTR_EXTREME_II = 0x00000801u, UNUR_DISTR_F = 0x00000901u, UNUR_DISTR_GAMMA = 0x00000a01u, UNUR_DISTR_GHYP = 0x00002401u, UNUR_DISTR_GIG = 0x00000b01u, UNUR_DISTR_GIG2 = 0x00002201u, UNUR_DISTR_HYPERBOLIC = 0x00002301u, UNUR_DISTR_IG = 0x00002101u, UNUR_DISTR_LAPLACE = 0x00000c01u, UNUR_DISTR_LOGISTIC = 0x00000d01u, UNUR_DISTR_LOGNORMAL = 0x00000e01u, UNUR_DISTR_LOMAX = 0x00000f01u, UNUR_DISTR_MEIXNER = 0x00002601u, UNUR_DISTR_NORMAL = 0x00001001u, UNUR_DISTR_GAUSSIAN = 0x00001001u, UNUR_DISTR_PARETO = 0x00001101u, UNUR_DISTR_POWEREXPONENTIAL = 0x00001201u, UNUR_DISTR_RAYLEIGH = 0x00001301u, UNUR_DISTR_SLASH = 0x00001401u, UNUR_DISTR_STUDENT = 0x00001501u, UNUR_DISTR_TRIANGULAR = 0x00001601u, UNUR_DISTR_UNIFORM = 0x00002001u, UNUR_DISTR_BOXCAR = 0x00002001u, UNUR_DISTR_VG = 0x00002501u, UNUR_DISTR_WEIBULL = 0x00001801u, UNUR_DISTR_BURR_I = 0x0000b001u, UNUR_DISTR_BURR_II = 0x0000b101u, UNUR_DISTR_BURR_III = 0x0000b201u, UNUR_DISTR_BURR_IV = 0x0000b301u, UNUR_DISTR_BURR_V = 0x0000b401u, UNUR_DISTR_BURR_VI = 0x0000b501u, UNUR_DISTR_BURR_VII = 0x0000b601u, UNUR_DISTR_BURR_VIII = 0x0000b701u, UNUR_DISTR_BURR_IX = 0x0000b801u, UNUR_DISTR_BURR_X = 0x0000b901u, UNUR_DISTR_BURR_XI = 0x0000ba01u, UNUR_DISTR_BURR_XII = 0x0000bb01u, UNUR_DISTR_BINOMIAL = 0x00010001u, UNUR_DISTR_GEOMETRIC = 0x00020001u, UNUR_DISTR_HYPERGEOMETRIC = 0x00030001u, UNUR_DISTR_LOGARITHMIC = 0x00040001u, UNUR_DISTR_NEGATIVEBINOMIAL = 0x00050001u, UNUR_DISTR_POISSON = 0x00060001u, UNUR_DISTR_ZIPF = 0x00070001u, UNUR_DISTR_MCAUCHY = 0x01000001u, UNUR_DISTR_MNORMAL = 0x02000001u, UNUR_DISTR_MSTUDENT = 0x03000001u, UNUR_DISTR_MEXPONENTIAL = 0x04000001u, UNUR_DISTR_COPULA = 0x05000001u, UNUR_DISTR_MCORRELATION = 0x10000001u }; #endif /* end of `unur_stddistr.h' */ /*-----*/ UNUR_DISTR *unur_distr_beta(const double *params, int n_params); UNUR_DISTR *unur_distr_burr(const double *params, int n_params); UNUR_DISTR *unur_distr_cauchy(const double *params, int n_params); UNUR_DISTR *unur_distr_chi(const double *params, int n_params); UNUR_DISTR *unur_distr_chisquare(const double *params, int n_params); UNUR_DISTR *unur_distr_exponential(const double *params, int n_params); UNUR_DISTR *unur_distr_extremeI(const double *params, int n_params); UNUR_DISTR *unur_distr_extremeII(const double *params, int n_params); UNUR_DISTR *unur_distr_F(const double *params, int n_params); UNUR_DISTR *unur_distr_gamma(const double *params, int n_params); UNUR_DISTR *unur_distr_ghyp(const double *params, int n_params); UNUR_DISTR *unur_distr_gig(const double *params, int n_params); UNUR_DISTR *unur_distr_gig2(const double *params, int n_params); UNUR_DISTR *unur_distr_hyperbolic(const double *params, int n_params); UNUR_DISTR *unur_distr_ig(const double *params, int n_params); UNUR_DISTR *unur_distr_laplace(const double *params, int n_params); UNUR_DISTR *unur_distr_logistic(const double *params, int n_params); UNUR_DISTR *unur_distr_lognormal(const double *params, int n_params); UNUR_DISTR *unur_distr_lomax(const double *params, int n_params); UNUR_DISTR *unur_distr_meixner(const double *params, int n_params); UNUR_DISTR *unur_distr_normal( const double *params, int n_params ); UNUR_DISTR *unur_distr_pareto( const double *params, int n_params ); UNUR_DISTR *unur_distr_powerexponential(const double *params, int n_params); UNUR_DISTR *unur_distr_rayleigh(const double *params, int n_params); UNUR_DISTR *unur_distr_slash(const double *params, int n_params); UNUR_DISTR *unur_distr_student(const double *params, int n_params); UNUR_DISTR *unur_distr_triangular(const double *params, int n_params); UNUR_DISTR *unur_distr_uniform(const double *params, int n_params); UNUR_DISTR *unur_distr_vg(const double *params, int n_params); UNUR_DISTR *unur_distr_weibull(const double *params, int n_params); UNUR_DISTR *unur_distr_multinormal(int dim, const double *mean, const double *covar); UNUR_DISTR *unur_distr_multicauchy(int dim, const double *mean, const double *covar); UNUR_DISTR *unur_distr_multistudent(int dim, double nu, const double *mean, const double *covar); UNUR_DISTR *unur_distr_multiexponential(int dim, const double *sigma, const double *theta); UNUR_DISTR *unur_distr_copula(int dim, const double *rankcorr); UNUR_DISTR *unur_distr_correlation( int n ); UNUR_DISTR *unur_distr_binomial(const double *params, int n_params); UNUR_DISTR *unur_distr_geometric(const double *params, int n_params); UNUR_DISTR *unur_distr_hypergeometric(const double *params, int n_params); UNUR_DISTR *unur_distr_logarithmic(const double *params, int n_params); UNUR_DISTR *unur_distr_negativebinomial(const double *params, int n_params); UNUR_DISTR *unur_distr_poisson(const double *params, int n_params); UNUR_DISTR *unur_distr_zipf(const double *params, int n_params); #endif /* end of `unur_distributions.h' */ /*-----*/ /*-----*/ /* <1> `stream.h' */ FILE *unur_set_stream( FILE *new_stream ); FILE *unur_get_stream( void ); /* end of `stream.h' */ /*-----*/ /*-----*/ /* <1> `debug.h' */ #ifndef DEBUG_H_SEEN #define DEBUG_H_SEEN #define UNUR_DEBUG_OFF (0u) #define UNUR_DEBUG_ALL (~0u) #define UNUR_DEBUG_INIT 0x00000001u #define UNUR_DEBUG_SETUP 0x00000fffu #define UNUR_DEBUG_ADAPT 0x00fff000u #define UNUR_DEBUG_SAMPLE 0xff000000u int unur_set_debug( UNUR_PAR *parameters, unsigned debug ); int unur_chg_debug( UNUR_GEN *generator, unsigned debug ); int unur_set_default_debug( unsigned debug ); #endif /* end of `debug.h' */ /*-----*/ /*-----*/ /* <1> `error.h' */ extern int unur_errno; int unur_get_errno ( void ); void unur_reset_errno ( void ); const char *unur_get_strerror ( const int errnocode ); UNUR_ERROR_HANDLER *unur_set_error_handler( UNUR_ERROR_HANDLER *new_handler ); UNUR_ERROR_HANDLER *unur_set_error_handler_off( void ); /* end of `error.h' */ /*-----*/ /*-----*/ /* <1> `unur_errno.h' */ #ifndef UNUR_ERRNO_H_SEEN #define UNUR_ERRNO_H_SEEN enum { UNUR_SUCCESS = 0x00, UNUR_FAILURE = 0x01, UNUR_ERR_DISTR_SET = 0x11, UNUR_ERR_DISTR_GET = 0x12, UNUR_ERR_DISTR_NPARAMS = 0x13, UNUR_ERR_DISTR_DOMAIN = 0x14, UNUR_ERR_DISTR_GEN = 0x15, UNUR_ERR_DISTR_REQUIRED = 0x16, UNUR_ERR_DISTR_UNKNOWN = 0x17, UNUR_ERR_DISTR_INVALID = 0x18, UNUR_ERR_DISTR_DATA = 0x19, UNUR_ERR_DISTR_PROP = 0x20, UNUR_ERR_PAR_SET = 0x21, UNUR_ERR_PAR_VARIANT = 0x22, UNUR_ERR_PAR_INVALID = 0x23, UNUR_ERR_GEN = 0x31, UNUR_ERR_GEN_DATA = 0x32, UNUR_ERR_GEN_CONDITION = 0x33, UNUR_ERR_GEN_INVALID = 0x34, UNUR_ERR_GEN_SAMPLING = 0x35, UNUR_ERR_NO_REINIT = 0x36, UNUR_ERR_NO_QUANTILE = 0x37, UNUR_ERR_URNG = 0x41, UNUR_ERR_URNG_MISS = 0x42, UNUR_ERR_STR = 0x51, UNUR_ERR_STR_UNKNOWN = 0x52, UNUR_ERR_STR_SYNTAX = 0x53, UNUR_ERR_STR_INVALID = 0x54, UNUR_ERR_FSTR_SYNTAX = 0x55, UNUR_ERR_FSTR_DERIV = 0x56, UNUR_ERR_DOMAIN = 0x61, UNUR_ERR_ROUNDOFF = 0x62, UNUR_ERR_MALLOC = 0x63, UNUR_ERR_NULL = 0x64, UNUR_ERR_COOKIE = 0x65, UNUR_ERR_GENERIC = 0x66, UNUR_ERR_SILENT = 0x67, UNUR_ERR_INF = 0x68, UNUR_ERR_NAN = 0x69, UNUR_ERR_COMPILE = 0xa0, UNUR_ERR_SHOULD_NOT_HAPPEN = 0xf0 }; #endif /* end of `unur_errno.h' */ /*-----*/ /*-----*/ /* <1> `umath.h' */ #ifndef MATH_H_SEEN #define MATH_H_SEEN #include #ifndef INFINITY extern const double INFINITY; #endif #define UNUR_INFINITY (INFINITY) #ifndef TRUE #define TRUE (1) #endif #ifndef FALSE #define FALSE (0) #endif #endif /* end of `umath.h' */ /*-----*/ /*-----*/ /* <1> `slist.h' */ #ifndef SLIST_H_SEEN #define SLIST_H_SEEN struct unur_slist *_unur_slist_new( void ); int _unur_slist_append( struct unur_slist *slist, void *element ); int _unur_slist_length( const struct unur_slist *slist ); void *_unur_slist_get( const struct unur_slist *slist, int n ); void *_unur_slist_replace( struct unur_slist *slist, int n, void *element ); void _unur_slist_free( struct unur_slist *slist ); #endif /* end of `slist.h' */ /*-----*/ #ifndef TRUE #define TRUE (1) #endif #ifndef FALSE #define FALSE (0) #endif #endif __END_DECLS unuran-1.11.0/src/uniform/0000755001357500135600000000000014430713513012364 500000000000000unuran-1.11.0/src/uniform/urng_prng.c0000644001357500135600000001205314420445767014466 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: urng_prng.c * * * * routines to get new URNG object with sampling routine of type PRNG. * * (Lendl's prng package, see http://statmath.wu.ac.at/prng/ or * * http://random.mat.sbg.ac.at/. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include /*---------------------------------------------------------------------------*/ #if defined(UNURAN_HAS_PRNG) && defined(UNUR_URNG_UNURAN) /*---------------------------------------------------------------------------*/ #include #include "urng_prng.h" /*---------------------------------------------------------------------------*/ UNUR_URNG * unur_urng_prngptr_new( struct prng *prng ) /*----------------------------------------------------------------------*/ /* get new URNG object of type PRNG. */ /* */ /* parameters: */ /* prng ... pointer to generator structure */ /*----------------------------------------------------------------------*/ { UNUR_URNG *urng; if (prng==NULL) { _unur_error("URNG",UNUR_ERR_NULL,"Cannot create PRNG object"); return NULL; } urng = unur_urng_new( (double(*)(void*)) prng->get_next, prng ); unur_urng_set_reset(urng, (void(*)(void*)) prng->reset); unur_urng_set_delete(urng, (void(*)(void*)) prng->destroy); if (prng_can_seed(prng)) { unur_urng_set_seed(urng, (void(*)(void*,unsigned long))prng->seed); } return urng; } /* end of unur_urng_prngptr_new() */ /*---------------------------------------------------------------------------*/ UNUR_URNG * unur_urng_prng_new( const char *prngstr ) /*----------------------------------------------------------------------*/ /* get new URNG object of type PRNG. */ /* */ /* parameters: */ /* prngstr ... string that describes generator */ /*----------------------------------------------------------------------*/ { struct prng *prng = prng_new(prngstr); if (prng==NULL) { _unur_error("URNG",UNUR_ERR_NULL,"Cannot create PRNG object for given string"); return NULL; } return unur_urng_prngptr_new (prng); } /* end of unur_urng_prng_new() */ /*---------------------------------------------------------------------------*/ #endif /* defined(UNURAN_HAS_PRNG) && defined(UNUR_URNG_UNURAN) */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/uniform/urng_builtin.h0000644001357500135600000001002614420445767015171 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: unur_uniform.h * * * * PURPOSE: * * function prototypes for built-in uniform random number generators * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifndef URNG_BUILTIN_H_SEEN #define URNG_BUILTIN_H_SEEN /*---------------------------------------------------------------------------*/ /* Combined multiple recursive generator by Pierre L'Ecuyer and Renee Touzin */ /* Copyright (c) 2002 Renee Touzin. */ double unur_urng_MRG31k3p (void *dummy); void unur_urng_MRG31k3p_seed (void *dummy, unsigned long seed); void unur_urng_MRG31k3p_reset (void *dummy); /* Linear congruential generator by Fishman and Moore */ /* m = 2^31-1, a = 742938285, c = 0. */ double unur_urng_fish (void *dummy); void unur_urng_fish_seed (void *dummy, unsigned long seed); void unur_urng_fish_reset (void *dummy); /* Linear congruential generator "Minimal Standard" */ /* m = 2^31-1, a = 16807, c = 0. */ double unur_urng_mstd (void *dummy); void unur_urng_mstd_seed (void *dummy, unsigned long seed); void unur_urng_mstd_reset (void *dummy); /*---------------------------------------------------------------------------*/ UNUR_URNG *unur_urng_builtin( void ); /* Make object for the default builtin URNG. */ UNUR_URNG *unur_urng_builtin_aux( void ); /* Make object for the default builtin URNG. */ /*---------------------------------------------------------------------------*/ #endif /* URNG_BUILTIN_H_SEEN */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/uniform/urng_gslqrng.h0000644001357500135600000001251214420445767015202 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: urng_gslqmc.h * * * * PURPOSE: * * Function prototypes for using URNG of type GSL-: * * Function prototypes for using uniform of type GSL: * * uniform random number from GSL (GNU Scientific Library), * * see http://www.gnu.org/software/gsl/. * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifndef URNG_GSLQRNG_H_SEEN #define URNG_GSLQRNG_H_SEEN /*---------------------------------------------------------------------------*/ #include /*---------------------------------------------------------------------------*/ /* =NODE URNG-GSLQRNG Interface to GSL generators for quasi-random points =UP URNG [30] =DESCRIPTION Interface to the generators for quasi-random points (also called low discrepancy point sets) from the GNU Scientific Library (GSL). Documentation and source code of this library is available from @uref{http://www.gnu.org/software/gsl/}. The interface to the GSL must be compiled into UNU.RAN using the configure flag @code{--with-urng-gsl}. Notice that the GSL has to be installed before running @code{./configure}. =HOWTOUSE When using this interface @file{unuran_urng_gsl.h} must be included in the corresponding C file, i.e., one must add the line @example #include @end example @noindent Moreover, one must not forget to link the executable against @file{libgsl}. The following routines are supported for URNG objects of this type: @itemize @minus @item unur_urng_sample() @item unur_urng_sample_array() @item unur_urng_reset() @item unur_urng_sync() @item unur_urng_free() @end itemize unur_urng_sync() is used to jump to the first coordinate of the next point generated by the generator. =END */ /*---------------------------------------------------------------------------*/ /* =ROUTINES */ /*---------------------------------------------------------------------------*/ UNUR_URNG *unur_urng_gslqrng_new( const gsl_qrng_type *qrngtype, unsigned int dim ); /* Make object for quasi-random point generators for dimension @var{dim} from the @file{GSL} (GNU Scientific Library). @var{qrngtype} is the type of the chosen generator as described in the GSL manual (see section Quasi-Random Sequences). This library is available from @uref{http://www.gnu.org/software/gsl/}. */ /* =END */ /*---------------------------------------------------------------------------*/ #endif /* URNG_GSLQRNG_H_SEEN */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/uniform/urng_rngstreams.h0000644001357500135600000001404714420445767015717 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: urng_fvoid.h * * * * PURPOSE: * * Function prototypes for using uniform of type RNGSTREAMSPRNG: * * Pierre L'Ecuyer's RNGSTREAMS package. * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifndef URNG_RNGSTREAMS_H_SEEN #define URNG_RNGSTREAMS_H_SEEN /*---------------------------------------------------------------------------*/ #include /*---------------------------------------------------------------------------*/ /* =NODE URNG-RNGSTREAM Interface to L'Ecuyer's RNGSTREAM random number generators =UP URNG [50] =DESCRIPTION URNGs from Pierre L'Ecuyer's @file{RngStream} library for multiple independent streams of pseudo-random numbers. This library provides multiple independent streams of pseudo-random numbers which itselves can be splitted into many substreams. It is available from @uref{http://www.iro.umontreal.ca/~lecuyer/myftp/streams00/c/}. A GNU-style package is available from @uref{http://statmath.wu.ac.at/software/RngStreams/}. The interface to the RngStream library must be compiled into UNU.RAN using the configure flag @code{--with-urng-rngstream}. Notice that the RngStream library has to be installed before running @code{./configure}. =HOWTOUSE When using this interface @file{unuran_urng_rngstream.h} must be included in the corresponding C file, i.e., one must add the line @example #include @end example @noindent Moreover, one must not forget to link the executable against the @file{RngStream} library (i.e., when using the GNU-style package in UNIX like environments one has to add @code{-lrngstreams} when linking an executable). Notice that the @file{rngstream} library uses a package seed, that means one should seed the uniform random number generator only once in an application using the routine @uref{http://statmath.wu.ac.at/software/RngStreams/doc/rngstreams.html#index-RngStream_005fSetPackageSeed-2,,@code{RngStream_SetPackageSeed}}: @example unsigned long seed[] = @{111u, 222u, 333u, 444u, 555u, 666u@}; RngStream_SetPackageSeed(seed); @end example @noindent The following routines are supported for URNG objects of this type: @itemize @minus @item unur_urng_sample() @item unur_urng_sample_array() @item unur_urng_reset() @item unur_urng_nextsub() @item unur_urng_resetsub() @item unur_urng_anti() @item unur_urng_free() @end itemize =END */ /*---------------------------------------------------------------------------*/ /* =ROUTINES */ /*---------------------------------------------------------------------------*/ UNUR_URNG *unur_urng_rngstream_new( const char *urngstr ); /* Make object for URNGs from Pierre L'Ecuyer's @file{RngStream} library. @var{urngstr} is an arbitrary string to label a stream. It need not be unique. */ UNUR_URNG *unur_urng_rngstreamptr_new( RngStream rngstream ); /* Similar to unur_urng_rngstream_new() but it uses a pointer to a generator object as returned by @code{RngStream_CreateStream()}. */ /* =END */ /*---------------------------------------------------------------------------*/ #endif /* URNG_RNGSTREAMS_H_SEEN */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/uniform/urng_fvoid.h0000644001357500135600000001223114420445767014632 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: urng_fvoid.h * * * * PURPOSE: * * Function prototypes for using uniform of type FVOID * * (i.e. routine without an argment: double uniform(void) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifndef URNG_FVOID_H_SEEN #define URNG_FVOID_H_SEEN /*---------------------------------------------------------------------------*/ /* =NODE URNG-FVOID Simple interface for uniform random number generators =UP URNG [10] =DESCRIPTION Simple interface for URNGs of type @code{double uniform(void *state)}. UNU.RAN contains some build-in URNGs of this type: @table @code @item unur_urng_MRG31k3p Combined multiple recursive generator by Pierre L'Ecuyer and Renee Touzin. @item unur_urng_fish Linear congruential generator by Fishman and Moore. @item unur_urng_mstd Linear congruential generator "Minimal Standard" by Park and Miller. @end table Notice, however, that these generators are provided as a fallback for the case that no state-of-the-art uniform random number generators (e.g. @pxref{URNG-RNGSTREAM,Pierre L'Ecuyer's @file{Rngstream} library, Pierre L'Ecuyer's @file{Rngstream} library}) are used. =HOWTOUSE Create an URNG object using unur_urng_fvoid_new(). By this call a pointer to the sampling routine and (optional) a pointer to a reset routine are copied into the URNG object. Other functions, like seeding the URNG, switching to antithetic random number, or jumping to next substream, can be added to the URNG object by the respective calls, e.g. by unur_urng_set_seed(). The following routines are supported for URNG objects of this type: @itemize @minus @item unur_urng_sample() @item unur_urng_sample_array() @item unur_urng_seed() [optional] @item unur_urng_reset() [optional] @item unur_urng_free() @end itemize =END */ /*---------------------------------------------------------------------------*/ /* =ROUTINES */ UNUR_URNG *unur_urng_fvoid_new( double (*urand)(void *state), void (*reset)(void *state) ); /* Make a URNG object for a generator that consists of a single function call @var{urand}. If there is no @var{reset} function use NULL for the second argument. */ /* =END */ /*---------------------------------------------------------------------------*/ #endif /* URNG_FVOID_H_SEEN */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/uniform/urng_gslqrng.c0000644001357500135600000003316014420445767015177 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: urng_gslqmc.c * * * * routines to get new URNG object (of type GSL-QRNG) to use * * quasi-random sequences from the GSL (GNU Scientific Library), * * see http://www.gnu.org/software/gsl/. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include /*---------------------------------------------------------------------------*/ #if defined(UNURAN_HAS_GSL) && defined(UNUR_URNG_UNURAN) /*---------------------------------------------------------------------------*/ #include #include "urng_gslqrng.h" /*---------------------------------------------------------------------------*/ /* structure for storing QRNG */ struct unur_urng_gslqrng { gsl_qrng *qrng; /* pointer to GSL QRNG obejct */ double *X; /* working array for storing points */ unsigned dim; /* dimension for QRNG */ unsigned n; /* current coordinate */ }; /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* We need wrapper functions for the GSL API. */ static UNUR_URNG *_unur_urng_gslqrngptr_new( gsl_qrng *qrngptr, unsigned int dim ); /*---------------------------------------------------------------------------*/ /* Get new URNG object of type GSL-QRNG. */ /*---------------------------------------------------------------------------*/ static double _unur_urng_gslqrng_sample( struct unur_urng_gslqrng *qrng ); /*---------------------------------------------------------------------------*/ /* Sample next coordinate of random point. */ /* Skip to first coordinate of next point after last coordinate. */ /*---------------------------------------------------------------------------*/ static int _unur_urng_gslqrng_sample_array( struct unur_urng_gslqrng *qrng, double *X, unsigned dim ); /*---------------------------------------------------------------------------*/ /* Sample random point and store in X. use only the first dim coordinates */ /* if dim is less than the dimension of the generated points. */ /*---------------------------------------------------------------------------*/ static void _unur_urng_gslqrng_free( struct unur_urng_gslqrng *qrng ); /*---------------------------------------------------------------------------*/ /* Free generator object. */ /*---------------------------------------------------------------------------*/ static void _unur_urng_gslqrng_reset( struct unur_urng_gslqrng *qrng ); /*---------------------------------------------------------------------------*/ /* Reset generator object. */ /*---------------------------------------------------------------------------*/ static void _unur_urng_gslqrng_nextpoint( struct unur_urng_gslqrng *qrng ); /*---------------------------------------------------------------------------*/ /* Skip to first coordinate of next point. */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ double _unur_urng_gslqrng_sample( struct unur_urng_gslqrng *qrng ) /*----------------------------------------------------------------------*/ /* Sample next coordinate of random point. */ /* Skip to first coordinate of next point after last coordinate. */ /* */ /* parameters: */ /* qrng ... pointer to URNG object */ /* */ /* return: */ /* next coordinate */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { int n = qrng->n; if (n==0) /* first coordinate --> get new point */ gsl_qrng_get( qrng->qrng, qrng->X ); /* increment counter for coordinate */ qrng->n = (n+1) % qrng->dim; /* return result */ return qrng->X[n]; } /* end of _unur_urng_gslqrng_sample() */ /*---------------------------------------------------------------------------*/ int _unur_urng_gslqrng_sample_array( struct unur_urng_gslqrng *qrng, double *X, unsigned dim ) /*----------------------------------------------------------------------*/ /* Sample random point and store in X. use only the first dim coordin. */ /* if dim is less than the dimension of the generated points. */ /* Return number of entries filled into array X. */ /* */ /* parameters: */ /* qrng ... pointer to URNG object */ /* X ... pointer to array of length dim */ /* dim ... (maximal) number of entries in X to be set */ /* */ /* return: */ /* number of uniform random numbers filled into array */ /* */ /* error: */ /* return 0 */ /*----------------------------------------------------------------------*/ { if (dim < qrng->dim) { /* size of array X to small --> use working array */ gsl_qrng_get( qrng->qrng, qrng->X ); memcpy( X, qrng->X, dim*sizeof(double) ); return dim; } else { gsl_qrng_get( qrng->qrng, X ); return qrng->dim; } } /* end of _unur_urng_gslqrng_sample_array() */ /*---------------------------------------------------------------------------*/ void _unur_urng_gslqrng_free( struct unur_urng_gslqrng *qrng ) /*----------------------------------------------------------------------*/ /* Free URNG object. */ /* */ /* parameters: */ /* qrng ... pointer to URNG object */ /*----------------------------------------------------------------------*/ { if (qrng) { gsl_qrng_free( qrng->qrng ); free( qrng->X ); free (qrng); } } /* end of _unur_urng_gslqrng_free() */ /*---------------------------------------------------------------------------*/ void _unur_urng_gslqrng_reset( struct unur_urng_gslqrng *qrng ) /*----------------------------------------------------------------------*/ /* Reset URNG object. */ /* */ /* parameters: */ /* qrng ... pointer to URNG object */ /*----------------------------------------------------------------------*/ { gsl_qrng_init( qrng->qrng ); qrng->n = 0u; } /* end of _unur_urng_gslqrng_reset() */ /*---------------------------------------------------------------------------*/ void _unur_urng_gslqrng_nextpoint( struct unur_urng_gslqrng *qrng ) /*----------------------------------------------------------------------*/ /* Skip to first coordinate of next point. */ /* */ /* parameters: */ /* qrng ... pointer to URNG object */ /*----------------------------------------------------------------------*/ { qrng->n = 0u; } /* end of _unur_urng_gslqrng_nextpoint() */ /*---------------------------------------------------------------------------*/ UNUR_URNG * _unur_urng_gslqrngptr_new( gsl_qrng *qrngptr, unsigned int dim ) /*----------------------------------------------------------------------*/ /* get new URNG object of type GSL-QRNG */ /* */ /* parameters: */ /* qrngptr ... pointer to generator structure */ /* dim ... dimension of point sets */ /*----------------------------------------------------------------------*/ { struct unur_urng_gslqrng *qrng; UNUR_URNG *urng; /* check argument */ if (qrngptr == NULL) { _unur_error("URNG",UNUR_ERR_NULL,"Cannot create GSL-QRNG object"); return NULL; } /* make structure to store QRNG object */ qrng = _unur_xmalloc( sizeof(struct unur_urng_gslqrng) ); qrng->X = _unur_xmalloc( dim * sizeof(double) ); qrng->qrng = qrngptr; qrng->dim = dim; qrng->n = 0u; /* make UNURAN_URNG object */ urng = unur_urng_new ( (double(*)(void*)) _unur_urng_gslqrng_sample, qrng ); unur_urng_set_sample_array (urng, (unsigned int(*)(void*,double*,int)) _unur_urng_gslqrng_sample_array); unur_urng_set_delete (urng, (void(*)(void*)) _unur_urng_gslqrng_free); unur_urng_set_reset (urng, (void(*)(void*)) _unur_urng_gslqrng_reset); unur_urng_set_sync (urng, (void(*)(void*)) _unur_urng_gslqrng_nextpoint); return urng; } /* end of _unur_urng_gslqrngptr_new() */ /*---------------------------------------------------------------------------*/ UNUR_URNG * unur_urng_gslqrng_new( const gsl_qrng_type *qrngtype, unsigned int dim ) /*----------------------------------------------------------------------*/ /* get new URNG object of type GSL-QRNG */ /* */ /* parameters: */ /* qrngtype ... type of generator */ /* dim ... dimension of point sets */ /*----------------------------------------------------------------------*/ { /* check argument */ if (dim == 0u) { _unur_error("URNG",UNUR_ERR_GENERIC,"Cannot create GSL-QRNG object for dimension 0"); return NULL; } return _unur_urng_gslqrngptr_new( gsl_qrng_alloc(qrngtype, dim), dim ); } /* end of unur_urng_gslqrng_new() */ /*---------------------------------------------------------------------------*/ #endif /* defined(UNURAN_HAS_GSL) && defined(UNUR_URNG_UNURAN) */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/uniform/urng_fvoid.c0000644001357500135600000000756214420445767014640 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: urng_fvoid.c * * * * routines to get new URNG object with sampling routine of type FVOID: * * double(*urng)(void), NULL) and global state variable. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include /*---------------------------------------------------------------------------*/ #if defined(UNUR_URNG_UNURAN) /*---------------------------------------------------------------------------*/ #include #include "urng_fvoid.h" /*---------------------------------------------------------------------------*/ UNUR_URNG * unur_urng_fvoid_new( double (*urand)(void *state), void (*reset)(void *state) ) /*----------------------------------------------------------------------*/ /* get new URNG object of type FVOID */ /* */ /* parameters: */ /* urand ... pointer to uniform random number generator */ /* reset ... pointer to reset function for URNG */ /*----------------------------------------------------------------------*/ { UNUR_URNG *urng = unur_urng_new( urand, NULL ); unur_urng_set_reset( urng, reset ); return urng; } /* end of unur_urng_fvoid_new() */ /*---------------------------------------------------------------------------*/ #endif /* #if defined(UNUR_URNG_UNURAN) */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/uniform/unuran_urng_gsl.h0000644001357500135600000000215614430713442015672 00000000000000/*******************************************************************\ * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * ******************************************************************* * Copyright (c) 2000-2023 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * \*******************************************************************/ #undef __BEGIN_DECLS #undef __END_DECLS #ifdef __cplusplus # define __BEGIN_DECLS extern "C" { # define __END_DECLS } #else # define __BEGIN_DECLS /* empty */ # define __END_DECLS /* empty */ #endif __BEGIN_DECLS #ifndef UNURAN_URNG_GSL_H_SEEN #define UNURAN_URNG_GSL_H_SEEN #include UNUR_URNG *unur_urng_gsl_new( const gsl_rng_type *urngtype ); UNUR_URNG *unur_urng_gslptr_new( gsl_rng *urng ); #include UNUR_URNG *unur_urng_gslqrng_new( const gsl_qrng_type *qrngtype, unsigned int dim ); #endif /* UNURAN_URNG_GSL_H_SEEN */ __END_DECLS unuran-1.11.0/src/uniform/Makefile.in0000644001357500135600000005566614430713360014373 00000000000000# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = src/uniform ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(include_HEADERS) \ $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libuniform_la_LIBADD = am_libuniform_la_OBJECTS = urng_builtin.lo mrg31k3p.lo fish.lo mstd.lo \ urng_fvoid.lo urng_gsl.lo urng_gslqrng.lo urng_prng.lo \ urng_randomshift.lo urng_rngstreams.lo libuniform_la_OBJECTS = $(am_libuniform_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/fish.Plo ./$(DEPDIR)/mrg31k3p.Plo \ ./$(DEPDIR)/mstd.Plo ./$(DEPDIR)/urng_builtin.Plo \ ./$(DEPDIR)/urng_fvoid.Plo ./$(DEPDIR)/urng_gsl.Plo \ ./$(DEPDIR)/urng_gslqrng.Plo ./$(DEPDIR)/urng_prng.Plo \ ./$(DEPDIR)/urng_randomshift.Plo \ ./$(DEPDIR)/urng_rngstreams.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libuniform_la_SOURCES) DIST_SOURCES = $(libuniform_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(includedir)" HEADERS = $(include_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autoconf/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILECMD = @FILECMD@ GREP = @GREP@ HAVE_DIVIDE_BY_ZERO = @HAVE_DIVIDE_BY_ZERO@ HAVE_IEEE_COMPARISONS = @HAVE_IEEE_COMPARISONS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNURAN_LT_VERSION = @UNURAN_LT_VERSION@ UNURAN_SUPPORTS_GSL = @UNURAN_SUPPORTS_GSL@ UNURAN_SUPPORTS_PRNG = @UNURAN_SUPPORTS_PRNG@ UNURAN_SUPPORTS_RNGSTREAM = @UNURAN_SUPPORTS_RNGSTREAM@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ have_valgrind = @have_valgrind@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = \ -I$(top_srcdir)/src noinst_LTLIBRARIES = libuniform.la libuniform_la_SOURCES = \ urng_builtin.c urng_builtin.h mrg31k3p.c fish.c mstd.c \ urng_fvoid.c urng_fvoid.h \ urng_gsl.c urng_gsl.h \ urng_gslqrng.c urng_gslqrng.h \ urng_prng.c urng_prng.h \ urng_randomshift.c urng_randomshift.h \ urng_rngstreams.c urng_rngstreams.h URNG_HEADER_FILES = \ unuran_urng_gsl.h \ unuran_urng_prng.h \ unuran_urng_rngstreams.h include_HEADERS = $(URNG_HEADER_FILES) # clean backup files CLEANFILES = *~ # clean generated files MAINTAINERCLEANFILES = \ Makefile.in \ $(URNG_HEADER_FILES) all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/uniform/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/uniform/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libuniform.la: $(libuniform_la_OBJECTS) $(libuniform_la_DEPENDENCIES) $(EXTRA_libuniform_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libuniform_la_OBJECTS) $(libuniform_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fish.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mrg31k3p.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mstd.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/urng_builtin.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/urng_fvoid.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/urng_gsl.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/urng_gslqrng.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/urng_prng.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/urng_randomshift.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/urng_rngstreams.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-includeHEADERS: $(include_HEADERS) @$(NORMAL_INSTALL) @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \ $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ done uninstall-includeHEADERS: @$(NORMAL_UNINSTALL) @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(includedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/fish.Plo -rm -f ./$(DEPDIR)/mrg31k3p.Plo -rm -f ./$(DEPDIR)/mstd.Plo -rm -f ./$(DEPDIR)/urng_builtin.Plo -rm -f ./$(DEPDIR)/urng_fvoid.Plo -rm -f ./$(DEPDIR)/urng_gsl.Plo -rm -f ./$(DEPDIR)/urng_gslqrng.Plo -rm -f ./$(DEPDIR)/urng_prng.Plo -rm -f ./$(DEPDIR)/urng_randomshift.Plo -rm -f ./$(DEPDIR)/urng_rngstreams.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-includeHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/fish.Plo -rm -f ./$(DEPDIR)/mrg31k3p.Plo -rm -f ./$(DEPDIR)/mstd.Plo -rm -f ./$(DEPDIR)/urng_builtin.Plo -rm -f ./$(DEPDIR)/urng_fvoid.Plo -rm -f ./$(DEPDIR)/urng_gsl.Plo -rm -f ./$(DEPDIR)/urng_gslqrng.Plo -rm -f ./$(DEPDIR)/urng_prng.Plo -rm -f ./$(DEPDIR)/urng_randomshift.Plo -rm -f ./$(DEPDIR)/urng_rngstreams.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-includeHEADERS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-includeHEADERS install-info install-info-am \ install-man install-pdf install-pdf-am install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am uninstall-includeHEADERS .PRECIOUS: Makefile # make header files for installation unuran_urng_gsl.h: urng_gsl.h urng_gslqrng.h $(top_srcdir)/scripts/make_urng_header.pl urng_gsl.h urng_gslqrng.h > unuran_urng_gsl.h unuran_urng_prng.h: urng_prng.h $(top_srcdir)/scripts/make_urng_header.pl urng_prng.h > unuran_urng_prng.h unuran_urng_rngstreams.h: urng_rngstreams.h $(top_srcdir)/scripts/make_urng_header.pl urng_rngstreams.h > unuran_urng_rngstreams.h # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: unuran-1.11.0/src/uniform/urng_prng.h0000644001357500135600000001431714420445767014500 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: urng_prng.h * * * * PURPOSE: * * Function prototypes for using uniform of type PRNG: * * Otmar Lendl's prng package, * * see http://statmath.wu.ac.at/prng/ or * * http://random.mat.sbg.ac.at/. * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifndef URNG_PRNG_H_SEEN #define URNG_PRNG_H_SEEN /*---------------------------------------------------------------------------*/ #include /*---------------------------------------------------------------------------*/ /* =NODE URNG-PRNG Interface to Otmar Lendl's pseudo-random number generators =UP URNG [40] =DESCRIPTION URNGs from Otmar Lendl's @code{prng} library. It provides a very flexible way to sample form arbitrary URNGs by means of an object oriented programing paradigma. Similarly to the UNU.RAN library independent generator objects can be build and used. This library has been developed by the pLab group at the university of Salzburg (Austria, EU) and implemented by Otmar Lendl. It is available from @uref{http://statmath.wu.ac.at/prng/} or from the pLab site at @uref{http://random.mat.sbg.ac.at/}. The interface to the PRNG library must be compiled into UNU.RAN using the configure flag @code{--with-urng-prng}. Notice that the PRNG library has to be installed before running @code{./configure}. =HOWTOUSE When using this interface @file{unuran_urng_prng.h} must be included in the corresponding C file, i.e., one must add the line @example #include @end example @noindent Moreover, one must not forget to link the executable against @file{libprng}. The following routines are supported for URNG objects of type PRNG: @itemize @minus @item unur_urng_sample() @item unur_urng_sample_array() @item unur_urng_seed() (availability depends on chosen PRNG generator!) @item unur_urng_reset() @item unur_urng_free() @end itemize =END */ /*---------------------------------------------------------------------------*/ /* =ROUTINES */ /*---------------------------------------------------------------------------*/ UNUR_URNG *unur_urng_prng_new( const char *prngstr ); /* Make object for URNGs from Otmar Lendl's @file{prng} package. @var{prngstr} is a string that contains the necessary information to create a uniform random number generator. For the format of this string see the @file{prng} user manual. The @file{prng} library provides a very flexible way to sample form arbitrary URNGs by means of an object oriented programing paradigma. Similarly to the UNU.RAN library independent generator objects can be build and used. The library has been developed and implemented by Otmar Lendl as member of the pLab group at the university of Salzburg (Austria, EU). It is available via anonymous ftp from @uref{http://statmath.wu.ac.at/prng/} or from the pLab site at @uref{http://random.mat.sbg.ac.at/}. */ UNUR_URNG *unur_urng_prngptr_new( struct prng *urng ); /* Similar to unur_urng_prng_new() but it uses a pointer to a generator object as returned by @code{prng_new(prngstr)}; see @file{prng} manual for details. */ /* =END */ /*---------------------------------------------------------------------------*/ #endif /* URNG_PRNG_H_SEEN */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/uniform/Makefile.am0000644001357500135600000000207014420445767014353 00000000000000## Process this file with automake to produce Makefile.in AM_CPPFLAGS = \ -I$(top_srcdir)/src noinst_LTLIBRARIES = libuniform.la libuniform_la_SOURCES = \ urng_builtin.c urng_builtin.h mrg31k3p.c fish.c mstd.c \ urng_fvoid.c urng_fvoid.h \ urng_gsl.c urng_gsl.h \ urng_gslqrng.c urng_gslqrng.h \ urng_prng.c urng_prng.h \ urng_randomshift.c urng_randomshift.h \ urng_rngstreams.c urng_rngstreams.h URNG_HEADER_FILES = \ unuran_urng_gsl.h \ unuran_urng_prng.h \ unuran_urng_rngstreams.h include_HEADERS = $(URNG_HEADER_FILES) # make header files for installation unuran_urng_gsl.h: urng_gsl.h urng_gslqrng.h $(top_srcdir)/scripts/make_urng_header.pl urng_gsl.h urng_gslqrng.h > unuran_urng_gsl.h unuran_urng_prng.h: urng_prng.h $(top_srcdir)/scripts/make_urng_header.pl urng_prng.h > unuran_urng_prng.h unuran_urng_rngstreams.h: urng_rngstreams.h $(top_srcdir)/scripts/make_urng_header.pl urng_rngstreams.h > unuran_urng_rngstreams.h # clean backup files CLEANFILES = *~ # clean generated files MAINTAINERCLEANFILES = \ Makefile.in \ $(URNG_HEADER_FILES) unuran-1.11.0/src/uniform/mstd.c0000644001357500135600000001212214420445767013431 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: fish.c * * * * PURPOSE: * * uniform random number generator provided by UNU.RAN * * random number generators inside UNU.RAN. * * * * DESCRIPTION: * * Linear congruential generator * * x_(n+1) = 16807 * x_n mod (2^32 - 1) ["Minimal Standard"] * * * * WARNING: * * Not state-of-the-art. SHOULD NOT BE USED ANY MORE. * * In UNU.RAN only as auxilliary second stream. * * Should be replaced in future releases. * * * * REFERENCE: * * Park, S. K. and Miller, K. W. (1988): * * Random number generators: good ones are hard to find, * * Comm. ACM 31, 1192--1201. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include "urng_builtin.h" /*---------------------------------------------------------------------------*/ /* seed (must not be 0!) */ #define SEED (1804289L) /* status variable */ static unsigned long x = SEED; static unsigned long x_start = SEED; /* seed of last stream */ /*---------------------------------------------------------------------------*/ double unur_urng_mstd (void *dummy ATTRIBUTE__UNUSED) { # define a 16807 /* multiplicator */ # define m 2147483647 /* modulus */ # define q 127773 /* m / a */ # define r 2836 /* m % a */ int hi, lo, test; /* intermediate results */ hi = x / q; lo = x % q; test = a * lo - r * hi; x = (test > 0 ) ? test : test + m; return (x * 4.656612875245796924105750827e-10); } /* end of unur_urng_mstd() */ /*---------------------------------------------------------------------------*/ void unur_urng_mstd_seed (void *dummy ATTRIBUTE__UNUSED, unsigned long seed) { if (seed==0) { _unur_error("URNG.mstd",UNUR_ERR_GENERIC,"seed = 0"); return; } x = x_start = seed; } /* end of unur_urng_mstd_seed() */ /*---------------------------------------------------------------------------*/ void unur_urng_mstd_reset (void *dummy ATTRIBUTE__UNUSED) { x = x_start; } /* end of unur_urng_mstd_reset() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/uniform/mrg31k3p.c0000644001357500135600000001561514420445767014043 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: mrg31k3p.c * * * * PURPOSE: * * uniform random number generator provided by UNU.RAN * * random number generators inside UNU.RAN. * * * * DESCRIPTION: * * Combined multiple recursive generator. * * The two components of the generator are * * * * x_{1,k} = (2^{22} x_{1,k-2} + (2^7 +1)x_{1,k-3}) mod (2^{31}-1) * * x_{2,k} = (2^{15} x_{2,k-1} + (2^{15} +1)x_{2,k-3} mod (2^{31}-21069) * * * * x_{1,k} and x_{2,k} are combined together and the result is * * multiplied by 1/(2^{31}-1) to have a number between 0 and 1. * * * * REFERENCE: * * L'Ecuyer, P. and R. Touzin (2000): Fast Combined Multiple Recursive * * Generators with Multipliers of the Form a = ±2^q±2^r. * * in: J.A. Jones, R.R. Barton, K. Kang, and P.A. Fishwick (eds.), * * Proc. 2000 Winter Simulation Conference, 683-689. * * * * Copyright for generator code by Renee Touzin. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include "urng_builtin.h" /*---------------------------------------------------------------------------*/ /* seed (must not be 0!) */ #define SEED10 (12345L) #define SEED11 (23456L) #define SEED12 (34067L) #define SEED20 (45678L) #define SEED21 (56789L) #define SEED22 (67890L) /* status variable */ static unsigned long x10 = SEED10; static unsigned long x11 = SEED11; static unsigned long x12 = SEED12; static unsigned long x20 = SEED20; static unsigned long x21 = SEED21; static unsigned long x22 = SEED22; /* seed of last stream */ static unsigned long x10_start = SEED10; static unsigned long x11_start = SEED11; static unsigned long x12_start = SEED12; static unsigned long x20_start = SEED20; static unsigned long x21_start = SEED21; static unsigned long x22_start = SEED22; /*---------------------------------------------------------------------------*/ double unur_urng_MRG31k3p (void *dummy ATTRIBUTE__UNUSED) /* Combined multiple recursive generator. */ /* Copyright (c) 2002 Renee Touzin. */ { # define m1 2147483647 # define m2 2147462579 # define norm 4.656612873077393e-10 # define mask11 511 # define mask12 16777215 # define mask20 65535 register unsigned long yy1, yy2; /* For intermediate results */ /* First component */ yy1 = ( (((x11 & mask11) << 22) + (x11 >> 9)) + (((x12 & mask12) << 7) + (x12 >> 24)) ); if (yy1 > m1) yy1 -= m1; yy1 += x12; if (yy1 > m1) yy1 -= m1; x12 = x11; x11 = x10; x10 = yy1; /* Second component */ yy1 = ((x20 & mask20) << 15) + 21069 * (x20 >> 16); if (yy1 > m2) yy1 -= m2; yy2 = ((x22 & mask20) << 15) + 21069 * (x22 >> 16); if (yy2 > m2) yy2 -= m2; yy2 += x22; if (yy2 > m2) yy2 -= m2; yy2 += yy1; if (yy2 > m2) yy2 -= m2; x22 = x21; x21 = x20; x20 = yy2; /* Combination */ if (x10 <= x20) return ((x10 - x20 + m1) * norm); else return ((x10 - x20) * norm); } /* end of unur_urng_MRG31k3p() */ /*---------------------------------------------------------------------------*/ void unur_urng_MRG31k3p_seed (void *dummy ATTRIBUTE__UNUSED, unsigned long seed) { if (seed==0) { _unur_error("URNG.mrg31k3p",UNUR_ERR_GENERIC,"seed = 0"); return; } /* the following is not really optimal */ x10 = x10_start = seed; x11 = x11_start = seed; x12 = x12_start = seed; x20 = x20_start = seed; x21 = x21_start = seed; x22 = x22_start = seed; } /* end of unur_urng_MRG31k3p_seed() */ /*---------------------------------------------------------------------------*/ void unur_urng_MRG31k3p_reset (void *dummy ATTRIBUTE__UNUSED) { x10 = x10_start; x11 = x11_start; x12 = x12_start; x20 = x20_start; x21 = x21_start; x22 = x22_start; } /* end of unur_urng_MRG31k3p_reset() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/uniform/urng_gsl.c0000644001357500135600000001150714420445767014310 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: urng_gsl.c * * * * routines to get new URNG object with sampling routine of type GSL. * * GSL (GNU Scientific Library), see http://www.gnu.org/software/gsl/. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include /*---------------------------------------------------------------------------*/ #if defined(UNURAN_HAS_GSL) && defined(UNUR_URNG_UNURAN) /*---------------------------------------------------------------------------*/ #include #include "urng_gsl.h" /*---------------------------------------------------------------------------*/ UNUR_URNG * unur_urng_gslptr_new( gsl_rng *gsl ) /*----------------------------------------------------------------------*/ /* get new URNG object of type GSL. */ /* */ /* parameters: */ /* gsl ... pointer to generator structure */ /*----------------------------------------------------------------------*/ { UNUR_URNG *urng; /* check argument */ if (gsl == NULL) { _unur_error("URNG",UNUR_ERR_NULL,"Cannot create GSL object"); return NULL; } urng = unur_urng_new( (double(*)(void*)) gsl_rng_uniform_pos, gsl ); unur_urng_set_delete(urng, (void(*)(void*)) gsl_rng_free); unur_urng_set_seed(urng, (void(*)(void*,unsigned long)) gsl_rng_set); return urng; } /* end of unur_urng_gslptr_new() */ /*---------------------------------------------------------------------------*/ UNUR_URNG * unur_urng_gsl_new( const gsl_rng_type *urngtype ) /*----------------------------------------------------------------------*/ /* get new URNG object of type GSL. */ /* */ /* parameters: */ /* urngtype ... type of generator */ /*----------------------------------------------------------------------*/ { UNUR_URNG *urng = unur_urng_gslptr_new(gsl_rng_alloc(urngtype)); unur_urng_seed(urng,gsl_rng_default_seed); return urng; } /* end of unur_urng_gsl_new() */ /*---------------------------------------------------------------------------*/ #endif /* defined(UNURAN_HAS_GSL) && defined(UNUR_URNG_UNURAN) */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/uniform/urng_rngstreams.c0000644001357500135600000001414614420445767015712 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: urng_rngstreams.c * * * * routines to get new URNG object with sampling routine of type * * RNGSTREAMSPRNG (Pierre L'Ecuyer's RNGSTREAMS package). * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include /*---------------------------------------------------------------------------*/ #if defined(UNURAN_HAS_RNGSTREAM) && defined(UNUR_URNG_UNURAN) /*---------------------------------------------------------------------------*/ #include #include "urng_rngstreams.h" /*---------------------------------------------------------------------------*/ static void _unur_urng_rngstream_delete( RngStream rngstream ); /* wrapper for destructor of rngstream object */ /*---------------------------------------------------------------------------*/ UNUR_URNG * unur_urng_rngstreamptr_new( RngStream rngstream ) /*----------------------------------------------------------------------*/ /* get new URNG object of type RNGSTREAMS. */ /* */ /* parameters: */ /* rngstream ... pointer to generator structure */ /*----------------------------------------------------------------------*/ { UNUR_URNG *urng; /* check argument */ if (rngstream == NULL) { _unur_error("URNG",UNUR_ERR_NULL,"Cannot create RNGSTREAM object"); return NULL; } urng = unur_urng_new( (double(*)(void*)) RngStream_RandU01, rngstream ); unur_urng_set_reset (urng, (void(*)(void*)) RngStream_ResetStartStream); unur_urng_set_delete (urng, (void(*)(void*)) _unur_urng_rngstream_delete); unur_urng_set_anti (urng, (void(*)(void*,int)) RngStream_SetAntithetic); unur_urng_set_nextsub (urng, (void(*)(void*)) RngStream_ResetNextSubstream); unur_urng_set_resetsub (urng, (void(*)(void*)) RngStream_ResetStartSubstream); /* There is only a function for seeding the RngStreams package, but no */ /* function for seeding an individual random stream. */ return urng; } /* end of unur_urng_rngstreamptr_new() */ /*---------------------------------------------------------------------------*/ UNUR_URNG * unur_urng_rngstream_new( const char *urngstr ) /*----------------------------------------------------------------------*/ /* get new URNG object of type RNGSTREAMS. */ /* */ /* parameters: */ /* prngstr ... string that describes generator */ /*----------------------------------------------------------------------*/ { return unur_urng_rngstreamptr_new(RngStream_CreateStream(urngstr)); } /* end of unur_urng_prng_new() */ /*---------------------------------------------------------------------------*/ void _unur_urng_rngstream_delete( RngStream rngstream ) /*----------------------------------------------------------------------*/ /* wrapper for destructor of rngstream object */ /* */ /* parameters: */ /* rngstream ... pointer to generator structure */ /*----------------------------------------------------------------------*/ { RngStream_DeleteStream(&rngstream); } /* end of _unur_urng_rngstream_delete() */ /*---------------------------------------------------------------------------*/ #endif /* defined(UNURAN_HAS_RNGSTREAM) && defined(UNUR_URNG_UNURAN) */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/uniform/unuran_urng_prng.h0000644001357500135600000000176714430713442016062 00000000000000/*******************************************************************\ * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * ******************************************************************* * Copyright (c) 2000-2023 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * \*******************************************************************/ #undef __BEGIN_DECLS #undef __END_DECLS #ifdef __cplusplus # define __BEGIN_DECLS extern "C" { # define __END_DECLS } #else # define __BEGIN_DECLS /* empty */ # define __END_DECLS /* empty */ #endif __BEGIN_DECLS #ifndef UNURAN_URNG_PRNG_H_SEEN #define UNURAN_URNG_PRNG_H_SEEN #include UNUR_URNG *unur_urng_prng_new( const char *prngstr ); UNUR_URNG *unur_urng_prngptr_new( struct prng *urng ); #endif /* UNURAN_URNG_PRNG_H_SEEN */ __END_DECLS unuran-1.11.0/src/uniform/unuran_urng_rngstreams.h0000644001357500135600000000203214430713442017263 00000000000000/*******************************************************************\ * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * ******************************************************************* * Copyright (c) 2000-2023 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * \*******************************************************************/ #undef __BEGIN_DECLS #undef __END_DECLS #ifdef __cplusplus # define __BEGIN_DECLS extern "C" { # define __END_DECLS } #else # define __BEGIN_DECLS /* empty */ # define __END_DECLS /* empty */ #endif __BEGIN_DECLS #ifndef UNURAN_URNG_RNGSTREAMS_H_SEEN #define UNURAN_URNG_RNGSTREAMS_H_SEEN #include UNUR_URNG *unur_urng_rngstream_new( const char *urngstr ); UNUR_URNG *unur_urng_rngstreamptr_new( RngStream rngstream ); #endif /* UNURAN_URNG_RNGSTREAMS_H_SEEN */ __END_DECLS unuran-1.11.0/src/uniform/urng_builtin.c0000644001357500135600000001005014420445767015161 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: urng_builtin.c * * * * routines for default built-in uniform random number generators. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include "urng_fvoid.h" #include "urng_builtin.h" /*---------------------------------------------------------------------------*/ UNUR_URNG *unur_urng_builtin( void ) /*----------------------------------------------------------------------*/ /* get new URNG object of FVOID. */ /* */ /* parameters: none */ /*----------------------------------------------------------------------*/ { UNUR_URNG *urng; urng = unur_urng_fvoid_new(unur_urng_MRG31k3p, unur_urng_MRG31k3p_reset); unur_urng_set_seed(urng, unur_urng_MRG31k3p_seed); return urng; } /* unur_urng_builtin() */ /*---------------------------------------------------------------------------*/ UNUR_URNG *unur_urng_builtin_aux( void ) /*----------------------------------------------------------------------*/ /* get new URNG object of FVOID. */ /* */ /* parameters: none */ /*----------------------------------------------------------------------*/ { UNUR_URNG *urng; urng = unur_urng_fvoid_new(unur_urng_fish, unur_urng_fish_reset); unur_urng_set_seed(urng, unur_urng_fish_seed); return urng; } /* end of unur_urng_builtin_aux() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/uniform/urng_randomshift.c0000644001357500135600000003544414420445767016047 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: urng_randomshift.c * * * * Meta uniform random number generator for Randomized Quasi-Monte Carlo * * integration. * * * * (1) Sample and store a random vector S. * * (2) Run a QMC simulation where S is added to each point of the * * quasi-random point (mod 1). * * (3) Repeat steps (1) and (2). * * (4) Return sample mean and sample variance. * * * ***************************************************************************** * * * References: * * * * [1] Cranley, R. and Patterson T.N.L. (1976), * * Randomization of number theoretic methods for multiple integration. * * SIAM J. Num. Anal. 13, 904-914. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include /*---------------------------------------------------------------------------*/ #if defined(UNUR_URNG_UNURAN) /*---------------------------------------------------------------------------*/ #include #include "urng_randomshift.h" /*---------------------------------------------------------------------------*/ /* structure for storing generators */ struct unur_urng_randomshift { UNUR_URNG *qrng; /* generator for point set */ UNUR_URNG *srng; /* generator for shift vector */ double *shift; /* shift vector */ double *X; /* working array for storing points */ int dim; /* dimension for QRNG */ int n; /* current coordinate */ }; /*---------------------------------------------------------------------------*/ static double _unur_urng_randomshift_sample( struct unur_urng_randomshift *rs ); /*---------------------------------------------------------------------------*/ /* Sample next coordinate of random point. */ /* Skip to first coordinate of next point after last coordinate. */ /*---------------------------------------------------------------------------*/ static int _unur_urng_randomshift_sample_array( struct unur_urng_randomshift *rs, double *X, int dim ); /*---------------------------------------------------------------------------*/ /* Sample random point and store in X. use only the first dim coordinates */ /* if dim is less than the dimension of the generated points. */ /*---------------------------------------------------------------------------*/ static void _unur_urng_randomshift_free( struct unur_urng_randomshift *rs ); /*---------------------------------------------------------------------------*/ /* Free generator object. */ /*---------------------------------------------------------------------------*/ static void _unur_urng_randomshift_reset( struct unur_urng_randomshift *rs ); /*---------------------------------------------------------------------------*/ /* Reset generator object. */ /*---------------------------------------------------------------------------*/ static void _unur_urng_randomshift_nextpoint( struct unur_urng_randomshift *rs ); /*---------------------------------------------------------------------------*/ /* Skip to first coordinate of next point. */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ double _unur_urng_randomshift_sample( struct unur_urng_randomshift *rs ) /*----------------------------------------------------------------------*/ /* Sample next coordinate of random point. */ /* Skip to first coordinate of next point after last coordinate. */ /* */ /* parameters: */ /* rs ... pointer to URNG object */ /* */ /* return: */ /* next coordinate */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { int i; int n = rs->n; double *X = rs->X; if (n==0) { /* first coordinate --> get new point */ unur_urng_sample_array(rs->qrng,X,rs->dim); /* make shift */ for (i=0; idim; i++) { X[i] += rs->shift[i]; if (X[i] >= 1.) X[i] -= 1.; if (X[i] < 0.) X[i] += 1.; } } /* increment counter for coordinate */ rs->n = (n+1) % rs->dim; /* return result */ return X[n]; } /* end of _unur_urng_randomshift_sample() */ /*---------------------------------------------------------------------------*/ int _unur_urng_randomshift_sample_array( struct unur_urng_randomshift *rs, double *X, int dim ) /*----------------------------------------------------------------------*/ /* Sample random point and store in X. use only the first dim coordin. */ /* if dim is less than the dimension of the generated points. */ /* Return number of entries filled into array X. */ /* */ /* parameters: */ /* rs ... pointer to URNG object */ /* X ... pointer to array of length dim */ /* dim ... (maximal) number of entries in X to be set */ /* */ /* return: */ /* number of uniform random numbers filled into array */ /* */ /* error: */ /* return 0 */ /*----------------------------------------------------------------------*/ { int i; if (dim > rs->dim) dim = rs->dim; if (dim == rs->dim) { unur_urng_sample_array(rs->qrng,X,dim); } else { /* dim < rs->dim */ /* size of array X to small --> use working array */ unur_urng_sample_array(rs->qrng,rs->X,dim); memcpy( X, rs->X, dim*sizeof(double) ); } /* make shift */ for (i=0; ishift[i]; if (X[i] >= 1.) X[i] -= 1.; if (X[i] < 0.) X[i] += 1.; } return dim; } /* end of _unur_urng_randomshift_sample_array() */ /*---------------------------------------------------------------------------*/ void _unur_urng_randomshift_free( struct unur_urng_randomshift *rs ) /*----------------------------------------------------------------------*/ /* Free URNG object. */ /* */ /* parameters: */ /* rs ... pointer to URNG object */ /*----------------------------------------------------------------------*/ { if (rs) { free( rs->shift ); free( rs->X ); free( rs ); } } /* end of _unur_urng_randomshift_free() */ /*---------------------------------------------------------------------------*/ void _unur_urng_randomshift_reset( struct unur_urng_randomshift *rs ) /*----------------------------------------------------------------------*/ /* Reset URNG object. */ /* */ /* parameters: */ /* rs ... pointer to URNG object */ /*----------------------------------------------------------------------*/ { unur_urng_reset( rs->qrng ); unur_urng_reset( rs->srng ); rs->n = 0u; } /* end of _unur_urng_randomshift_reset() */ /*---------------------------------------------------------------------------*/ void _unur_urng_randomshift_nextpoint( struct unur_urng_randomshift *rs ) /*----------------------------------------------------------------------*/ /* Skip to first coordinate of next point. */ /* */ /* parameters: */ /* rs ... pointer to URNG object */ /*----------------------------------------------------------------------*/ { rs->n = 0u; } /* end of _unur_urng_randomshift_nextpoint() */ /*---------------------------------------------------------------------------*/ UNUR_URNG * unur_urng_randomshift_new( UNUR_URNG *qrng, UNUR_URNG *srng, int dim ) /*----------------------------------------------------------------------*/ /* get new URNG object of type GSL-QRNG */ /* */ /* parameters: */ /* qrng ... generator for point set */ /* srng ... generator for random shifts */ /* dim ... dimension of point sets */ /*----------------------------------------------------------------------*/ { struct unur_urng_randomshift *rs; UNUR_URNG *urng; /* check argument */ _unur_check_NULL( "URNG", qrng, NULL ); COOKIE_CHECK(qrng,CK_URNG,NULL); _unur_check_NULL( "URNG", srng, NULL ); COOKIE_CHECK(srng,CK_URNG,NULL); /* make structure to store random shift object */ rs = _unur_xmalloc( sizeof(struct unur_urng_randomshift) ); rs->shift = _unur_xmalloc( dim * sizeof(double) ); rs->X = _unur_xmalloc( dim * sizeof(double) ); rs->qrng = qrng; rs->srng = srng; rs->dim = dim; rs->n = 0u; /* make UNURAN_URNG object */ urng = unur_urng_new ( (double(*)(void*)) _unur_urng_randomshift_sample, rs ); unur_urng_set_sample_array (urng, (unsigned int(*)(void*,double*,int)) _unur_urng_randomshift_sample_array); unur_urng_set_delete (urng, (void(*)(void*)) _unur_urng_randomshift_free); unur_urng_set_reset (urng, (void(*)(void*)) _unur_urng_randomshift_reset); unur_urng_set_sync (urng, (void(*)(void*)) _unur_urng_randomshift_nextpoint); /* initialize random shift */ unur_urng_sample_array(rs->srng,rs->shift,rs->dim); return urng; } /* end of unur_urng_randomshift_new() */ /*---------------------------------------------------------------------------*/ int unur_urng_randomshift_nextshift( UNUR_URNG *urng ) /*----------------------------------------------------------------------*/ /* Get the next (randomly chosen) vector for shifting the points set. */ /* */ /* parameters: */ /* rs ... pointer to URNG object */ /*----------------------------------------------------------------------*/ { struct unur_urng_randomshift *rs = urng->state; unur_urng_sample_array(rs->srng,rs->shift,rs->dim); unur_urng_reset( rs->qrng ); rs->n = 0u; return UNUR_SUCCESS; } /* end of unur_urng_randomshift_nextshift() */ /*---------------------------------------------------------------------------*/ #endif /* #if defined(UNUR_URNG_UNURAN) */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/uniform/fish.c0000644001357500135600000001245414420445767013423 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: fish.c * * * * PURPOSE: * * uniform random number generator provided by UNU.RAN * * random number generators inside UNU.RAN. * * * * DESCRIPTION: * * Linear congruential generator with * * m = 2^31-1, a = 742938285, c = 0. * * * * WARNING: * * Not state-of-the-art. SHOULD NOT BE USED ANY MORE. * * In UNU.RAN only as auxilliary second stream. * * Should be replaced in future releases. * * * * REFERENCE: * * Fishman G.S., Moore L.R. (1986): An exhaustive analysis of * * multiplicative congruential number generators with modulus 2^31-1, * * SIAM Journal Sci. Stat. Comput., 24-45. * * * * Copyright for generator code by Ernst Stadlober. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include "urng_builtin.h" /*---------------------------------------------------------------------------*/ /* seed (must not be 0!) */ #define SEED (12345L) /* status variable */ static unsigned long x = SEED; static unsigned long x_start = SEED; /* seed of last stream */ /*---------------------------------------------------------------------------*/ double unur_urng_fish (void *dummy ATTRIBUTE__UNUSED) { # define A 742938285 # define AHI (A>>15) # define ALO (A&0x7FFF) unsigned long xhi, xlo, mid; /* for intermediate results */ /* generator */ xhi = x>>16; xlo = x&0xFFFF; mid = AHI*xlo + (ALO<<1)*xhi; x = AHI*xhi + (mid>>16) + ALO*xlo; if (x&0x80000000) x -= 0x7FFFFFFF; x += ((mid&0xFFFF)<<15); if (x&0x80000000) x -= 0x7FFFFFFF; return (x*4.656612875245797e-10); } /* end of unur_urng_fish() */ /*---------------------------------------------------------------------------*/ void unur_urng_fish_seed (void *dummy ATTRIBUTE__UNUSED, unsigned long seed) { if (seed==0) { _unur_error("URNG.fish",UNUR_ERR_GENERIC,"seed = 0"); return; } x_start = seed; x = seed; } /* end of unur_urng_fish_seed() */ /*---------------------------------------------------------------------------*/ void unur_urng_fish_reset (void *dummy ATTRIBUTE__UNUSED) { x = x_start; } /* end of unur_urng_fish_reset() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/uniform/urng_randomshift.h0000644001357500135600000001355614420445767016054 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: urng_fvoid.h * * * * PURPOSE: * * Function prototypes for meta uniform random number generator to * * combine point set generator with random shifts. * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifndef URNG_RANDOMSHIFT_H_SEEN #define URNG_RANDOMSHIFT_H_SEEN /*---------------------------------------------------------------------------*/ /* =NODE URNG-RANDOMSHIFT Combine point set generator with random shifts =UP URNG [90] =DESCRIPTION Generators of type RANDOMSHIFT combine a point set generator with generators to apply random shifts as proposed in @unurbibref{CPa76}: @enumerate @item Sample and store a random vector S. @item Run a QMC simulation where S is added to each point of the generated quasi-random point (mod 1). @item Repeat steps 1 and 2. @end enumerate =HOWTOUSE Create a URNG object for a point set generator and a URNG object for a generator to create shift vectors at random. The meta URNG object can then be created using unur_urng_randomshift_new(). Notice that only pointers to the two underlying URNG generator objects are copied into the newly created meta generator. Thus manipulating the meta URNG also changes the underlying URNGs and vice versa. The following routines are supported for URNG objects of type RANDOMSHIFT: @itemize @minus @item unur_urng_sample() @item unur_urng_sample_array() @item unur_urng_reset() @item unur_urng_sync() @item unur_urng_randomshift_nextshift() @item unur_urng_free() @end itemize unur_urng_sync() is used to jump to the first coordinate of the next point generated by the generator. unur_urng_randomshift_nextshift() allows to replace the shift vector by another randomly chosen shift vector. @emph{Important:} unur_urng_sync() is only available if it is if it is implemented for the underlying point set generator. @emph{Important:} unur_urng_reset() is only available if it is available for both underlying generators. =END */ /*---------------------------------------------------------------------------*/ /* =ROUTINES */ /*---------------------------------------------------------------------------*/ UNUR_URNG *unur_urng_randomshift_new( UNUR_URNG *qrng, UNUR_URNG *srng, int dim ); /* Make object for URNG with randomly shifted point sets. @var{qrng} is a generated that generates point sets of dimension @var{dim}. @var{srng} is a generated that generates random numbers or vectors. @emph{Notice:} Only pointers to the respective objects @var{qrng} and @var{srng} are copied into the created meta generator. Thus manipulating the meta URNG also changes the underlying URNGs and vice versa. */ int unur_urng_randomshift_nextshift( UNUR_URNG *urng ); /* Get the next (randomly chosen) vector for shifting the points set, and the underlying point generator @var{qrng} is reset. */ /* =END */ /*---------------------------------------------------------------------------*/ #endif /* URNG_RANDOMSHIFT_H_SEEN */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/uniform/urng_gsl.h0000644001357500135600000001321714420445767014315 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: urng_gsl.h * * * * PURPOSE: * * Function prototypes for using URNG of type GSL: * * uniform random number from GSL (GNU Scientific Library), * * see http://www.gnu.org/software/gsl/. * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifndef URNG_GSL_H_SEEN #define URNG_GSL_H_SEEN /*---------------------------------------------------------------------------*/ #include /*---------------------------------------------------------------------------*/ /* =NODE URNG-GSL Interface to GSL uniform random number generators =UP URNG [20] =DESCRIPTION Interface to the uniform random number generators from the GNU Scientific Library (GSL). Documentation and source code of this library is available from @uref{http://www.gnu.org/software/gsl/}. The interface to the GSL must be compiled into UNU.RAN using the configure flag @code{--with-urng-gsl}. Notice that the GSL has to be installed before running @code{./configure}. =HOWTOUSE When using this interface @file{unuran_urng_gsl.h} must be included in the corresponding C file, i.e., one must add the line @example #include @end example @noindent Moreover, one must not forget to link the executable against @file{libgsl}. The following routines are supported for URNG objects of type GSL: @itemize @minus @item unur_urng_sample() @item unur_urng_sample_array() @item unur_urng_seed() @item unur_urng_reset() @item unur_urng_free() @end itemize @smallexample @include ref_example_gsl.texi @end smallexample =END */ /*---------------------------------------------------------------------------*/ /* =ROUTINES */ /*---------------------------------------------------------------------------*/ UNUR_URNG *unur_urng_gsl_new( const gsl_rng_type *urngtype ); /* Make object for URNGs from the @file{GSL} (GNU Scientific Library). @var{urngtype} is the type of the chosen generator as described in the GSL manual (see Section Random Number Generation). This library is available from @uref{http://www.gnu.org/software/gsl/}. */ UNUR_URNG *unur_urng_gslptr_new( gsl_rng *urng ); /* Similar to unur_urng_gsl_new() but it uses a pointer to a generator object as returned by @code{gsl_rng_alloc(rng_type)}; see @file{GSL} manual for details. @emph{Notice}: There is a subtle but important difference between these two calls. When a generator object is created by a unur_urng_gsl_new() call, then resetting of the generator works. When a generator object is created by a unur_urng_gslptr_new() call, then resetting only works after a @code{unur_urng_seed(urng,myseed)} call. */ /* =END */ /*---------------------------------------------------------------------------*/ #endif /* URNG_GSL_H_SEEN */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/unur_source.h0000644001357500135600000001242414420445767013366 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: unur_source.h * * * * PURPOSE: * * To be included as first header file in all sources. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifndef UNUR_SOURCE_H_SEEN #define UNUR_SOURCE_H_SEEN /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* config file generated be autoconf */ #ifdef HAVE_CONFIG_H # include #else # error "config.h" required #endif /*---------------------------------------------------------------------------*/ /* compiler switches and defaults */ #include /*---------------------------------------------------------------------------*/ /* define macros for GCC attributes */ #ifdef __GNUC__ # define ATTRIBUTE__FORMAT(a,b) __attribute__ (( __format__ (printf, (a), (b)) )) # define ATTRIBUTE__UNUSED __attribute__ ((unused)) # define ATTRIBUTE__MALLOC __attribute__ ((malloc)) #else # define ATTRIBUTE__FORMAT(a,b) # define ATTRIBUTE__UNUSED # define ATTRIBUTE__MALLOC #endif /*---------------------------------------------------------------------------*/ /* include standard header files */ #include #include #include #include #include #ifdef HAVE_LIMITS_H # include #endif /*---------------------------------------------------------------------------*/ /* globally used types */ #include #include /*---------------------------------------------------------------------------*/ /* Utilities used by almost all sources */ /* uniform random number generators */ #include /* magic cookies */ #include /* debugging, warnings and error messages */ #include #include #include #include #include #include #include /* floating point arithmetic */ #include #include /* mathematics */ #include #include #include /* special functions */ #include /* vectors */ #include /* strings */ #include /* allocate memory */ #include /* simple lists */ #include /*---------------------------------------------------------------------------*/ #endif /* UNUR_SOURCE_H_SEEN */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/unur_struct.h0000644001357500135600000001335514420445767013416 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: unur_struct.h * * * * PURPOSE: * * declares structures for distribution, parameter, and generator * * objects. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifndef UNUR_STRUCT_H_SEEN #define UNUR_STRUCT_H_SEEN /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Basic header files **/ /*****************************************************************************/ /*****************************************************************************/ /** UNU.RAN objects **/ /*****************************************************************************/ struct unur_distr; /* distribution object */ struct unur_par; /* parameters for generator */ struct unur_gen; /* generator object */ /*****************************************************************************/ /** Generic functions **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Generic functions */ typedef double UNUR_FUNCT_GENERIC (double x, void *params); typedef double UNUR_FUNCT_VGENERIC (double *x, void *params); /* for univariate functions with optional parameter array */ struct unur_funct_generic { UNUR_FUNCT_GENERIC *f; void *params; }; /* for multivariate functions with optional parameter array */ struct unur_funct_vgeneric { UNUR_FUNCT_VGENERIC *f; void *params; }; /*****************************************************************************/ /** Auxiliary tools **/ /*****************************************************************************/ #include #include /*****************************************************************************/ /** Declaration for parser **/ /*****************************************************************************/ #include /*****************************************************************************/ /** URNG (uniform random number generator) objects **/ /*****************************************************************************/ #include /*****************************************************************************/ /** Distribution objects **/ /*****************************************************************************/ #include /*****************************************************************************/ /** Parameter and generators objects **/ /*****************************************************************************/ #include /*---------------------------------------------------------------------------*/ #endif /* UNUR_STRUCT_H_SEEN */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/unur_cookies.h0000644001357500135600000002156314430713333013512 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: source_cookies.h * * * * PURPOSE: * * defines magic cookies. * * * * USAGE: * * internal header file * * included only in source_unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifndef SOURCE_COOKIES_H_SEEN #define SOURCE_COOKIES_H_SEEN /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_COOKIES /* use magic cookies */ /*---------------------------------------------------------------------------*/ /* name of cookies */ /* generators discrete distributions */ #define CK_DARI_PAR 0x00000010u #define CK_DARI_GEN 0x00000011u #define CK_DAU_PAR 0x00000020u #define CK_DAU_GEN 0x00000021u #define CK_DGT_PAR 0x00000030u #define CK_DGT_GEN 0x00000031u #define CK_DSROU_PAR 0x00000040u #define CK_DSROU_GEN 0x00000041u #define CK_DSS_PAR 0x00000050u #define CK_DSS_GEN 0x00000051u /* generators continuous distributions */ #define CK_AROU_PAR 0x00100010u #define CK_AROU_GEN 0x00100011u #define CK_AROU_SEG 0x00100012u #define CK_ARS_PAR 0x001000d0u #define CK_ARS_GEN 0x001000d1u #define CK_ARS_IV 0x001000d2u #define CK_HINV_PAR 0x00100020u #define CK_HINV_GEN 0x00100021u #define CK_HINV_IV 0x00100022u #define CK_HRB_PAR 0x00100030u #define CK_HRB_GEN 0x00100031u #define CK_HRD_PAR 0x00100040u #define CK_HRD_GEN 0x00100041u #define CK_HRI_PAR 0x00100050u #define CK_HRI_GEN 0x00100051u #define CK_ITDR_PAR 0x00100080u #define CK_ITDR_GEN 0x00100081u #define CK_NINV_PAR 0x00100060u #define CK_NINV_GEN 0x00100061u #define CK_NROU_PAR 0x00100070u #define CK_NROU_GEN 0x00100071u #define CK_PINV_PAR 0x00100130u #define CK_PINV_GEN 0x00100131u #define CK_PINV_IV 0x00100132u #define CK_SROU_PAR 0x00100090u #define CK_SROU_GEN 0x00100091u #define CK_SSR_PAR 0x001000a0u #define CK_SSR_GEN 0x001000a1u #define CK_TABL_PAR 0x001000b0u #define CK_TABL_GEN 0x001000b1u #define CK_TABL_IV 0x001000b2u #define CK_TDR_PAR 0x001000c0u #define CK_TDR_GEN 0x001000c1u #define CK_TDR_IV 0x001000c2u #define CK_UNIF_PAR 0x001000e0u #define CK_UNIF_GEN 0x001000e1u #define CK_UTDR_PAR 0x001000f0u #define CK_UTDR_GEN 0x001000f1u #define CK_EMPK_PAR 0x00100100u #define CK_EMPK_GEN 0x00100101u #define CK_EMPL_PAR 0x00100110u #define CK_EMPL_GEN 0x00100111u #define CK_HIST_PAR 0x00100120u #define CK_HIST_GEN 0x00100121u /* meta generators */ #define CK_MIXT_PAR 0x00110130u #define CK_MIXT_GEN 0x00110131u /* generators multivariate continuous distributions */ #define CK_MVTDR_PAR 0x00200010u #define CK_MVTDR_GEN 0x00200010u #define CK_VMT_PAR 0x00200020u #define CK_VMT_GEN 0x00200021u #define CK_VEMPK_PAR 0x00200030u #define CK_VEMPK_GEN 0x00200031u #define CK_VNROU_PAR 0x00200040u #define CK_VNROU_GEN 0x00200041u #define CK_VAROU_PAR 0x00200050u #define CK_VAROU_GEN 0x00200051u #define CK_NORTA_PAR 0x00200060u #define CK_NORTA_GEN 0x00200061u /* Markov chain samplers */ #define CK_BALL_PAR 0x00201010u #define CK_BALL_GEN 0x00201011u #define CK_GIBBS_PAR 0x00201020u #define CK_GIBBS_GEN 0x00201021u #define CK_HITRO_PAR 0x00201030u #define CK_HITRO_GEN 0x00201031u #define CK_WALK_PAR 0x00201040u #define CK_WALK_GEN 0x00201041u /* generators for random matrices */ #define CK_MCORR_PAR 0x00400010u #define CK_MCORR_GEN 0x00400011u /* special generators */ #define CK_CSTD_PAR 0x10000010u #define CK_CSTD_GEN 0x10000011u #define CK_DSTD_PAR 0x10000020u #define CK_DSTD_GEN 0x10000021u #define CK_MVSTD_PAR 0x10000040u #define CK_MVSTD_GEN 0x10000041u #define CK_CEXT_PAR 0x10000110u #define CK_CEXT_GEN 0x10000111u #define CK_DEXT_PAR 0x10000120u #define CK_DEXT_GEN 0x10000121u #define CK_MBLOCK 0xf0000001u /* misc methods */ #define CK_AUTO_PAR 0xa0000010u /* distribution objects */ #define CK_DISTR 0xe0000000u #define CK_DISTR_CONT 0xe0000001u #define CK_DISTR_CEMP 0xe0000002u #define CK_DISTR_MATR 0xe0000003u #define CK_DISTR_CVEC 0xe0000004u #define CK_DISTR_CVEMP 0xe0000005u #define CK_DISTR_DISCR 0xe0000006u #define CK_SPECIALGEN_CONT 0xd00001u /* URNG (uniform random number generator objects) */ #define CK_URNG 0xb0000001u /* function parser */ #define CK_FSTR_PDATA 0xa0000001u #define CK_FSTR_TNODE 0xa0000002u /* auxiliary tools */ #define CK_SLIST 0xa0000004u /*---------------------------------------------------------------------------*/ /* macros for dealing with magic cookies */ /* set magic cookies */ #define COOKIE_SET(ptr,ck) (ptr)->cookie=(ck) #define COOKIE_SET_ARRAY(ptr,ck,n) { \ register int i; \ for (i=0;i<(n);i++) \ ((ptr)+(i))->cookie=(ck); \ } /* check magic cookies */ #define COOKIE_CHECK(ptr,ck,rval) \ if((ptr)->cookie!=(ck)) { \ _unur_error_cookies(__FILE__,__LINE__,(ptr)->cookie, (ck)); \ return rval; \ } /* clear magic cookies (set to 0u). To be used in connection with free() to */ /* to detect access to freed object. */ #define COOKIE_CLEAR(ptr) (ptr)->cookie=0u /*---------------------------------------------------------------------------*/ #else /* do not use magic cookies */ /*---------------------------------------------------------------------------*/ #define COOKIE_SET(ptr,ck) #define COOKIE_SET_ARRAY(ptr,ck,n) #define COOKIE_CHECK(ptr,ck,rval) #define COOKIE_CLEAR(ptr) /*---------------------------------------------------------------------------*/ #endif /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #endif /* SOURCE_COOKIES_H_SEEN */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/Makefile.in0000644001357500135600000006174414430713360012706 00000000000000# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = src ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(include_HEADERS) \ $(noinst_HEADERS) $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" LTLIBRARIES = $(lib_LTLIBRARIES) libunuran_la_DEPENDENCIES = $(SUBLIBS) am_libunuran_la_OBJECTS = libunuran_la_OBJECTS = $(am_libunuran_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libunuran_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libunuran_la_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libunuran_la_SOURCES) DIST_SOURCES = $(libunuran_la_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(include_HEADERS) $(noinst_HEADERS) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir distdir-am am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` am__DIST_COMMON = $(srcdir)/Makefile.in README DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILECMD = @FILECMD@ GREP = @GREP@ HAVE_DIVIDE_BY_ZERO = @HAVE_DIVIDE_BY_ZERO@ HAVE_IEEE_COMPARISONS = @HAVE_IEEE_COMPARISONS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNURAN_LT_VERSION = @UNURAN_LT_VERSION@ UNURAN_SUPPORTS_GSL = @UNURAN_SUPPORTS_GSL@ UNURAN_SUPPORTS_PRNG = @UNURAN_SUPPORTS_PRNG@ UNURAN_SUPPORTS_RNGSTREAM = @UNURAN_SUPPORTS_RNGSTREAM@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ have_valgrind = @have_valgrind@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ @HAVE_MINGW_FALSE@no_undefined = @HAVE_MINGW_TRUE@no_undefined = -no-undefined SUBDIRS = \ utils \ methods \ specfunct \ distr \ distributions \ parser \ tests \ uniform \ urng \ . DIST_SUBDIRS = $(SUBDIRS) SUBLIBS = \ methods/libmethods.la \ distr/libdistr.la \ distributions/libdistributions.la \ specfunct/libspecfunct.la \ parser/libparser.la \ tests/libtests.la \ uniform/libuniform.la \ urng/liburng.la \ utils/libutils.la lib_LTLIBRARIES = libunuran.la libunuran_la_SOURCES = libunuran_la_LIBADD = $(SUBLIBS) libunuran_la_LDFLAGS = -version-info $(UNURAN_LT_VERSION) $(no_undefined) include_HEADERS = unuran.h noinst_HEADERS = \ unuran_config.h \ unuran.h.in \ unur_cookies.h \ unur_source.h \ unur_struct.h \ unur_typedefs.h # clean backup files CLEANFILES = *~ # clean generated files MAINTAINERCLEANFILES = \ Makefile.in \ .dep-unuran_h \ unuran.h all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ } uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libunuran.la: $(libunuran_la_OBJECTS) $(libunuran_la_DEPENDENCIES) $(EXTRA_libunuran_la_DEPENDENCIES) $(AM_V_CCLD)$(libunuran_la_LINK) -rpath $(libdir) $(libunuran_la_OBJECTS) $(libunuran_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-includeHEADERS: $(include_HEADERS) @$(NORMAL_INSTALL) @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \ $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ done uninstall-includeHEADERS: @$(NORMAL_UNINSTALL) @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir) # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-recursive clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-includeHEADERS install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-libLTLIBRARIES install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-libLTLIBRARIES \ clean-libtool cscopelist-am ctags ctags-am distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-includeHEADERS install-info \ install-info-am install-libLTLIBRARIES install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs installdirs-am \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-includeHEADERS uninstall-libLTLIBRARIES .PRECIOUS: Makefile # make unuran.h (process file unuran.h.in) sinclude .dep-unuran_h unuran.h: unuran.h.in $(top_srcdir)/scripts/merge_h.pl $(top_srcdir)/src/unuran.h.in > unuran.h sed -e "s#^unuran\.h\:#stringparser\.c\:#" .dep-unuran_h | sed -e "s#\./#\.\./#g" > ./parser/.dep-stringparser_c # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: unuran-1.11.0/src/urng/0000755001357500135600000000000014430713513011660 500000000000000unuran-1.11.0/src/urng/urng_set.c0000644001357500135600000003470314420445767013615 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: urng_set.c * * * * routines to set, change and get the pointers to the * * uniform random number generators used in generator objects. * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include "urng.h" /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Main uniform random number generator **/ /** **/ /*****************************************************************************/ int unur_set_urng( struct unur_par *par, UNUR_URNG *urng ) /*----------------------------------------------------------------------*/ /* set uniform random number generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* urng ... pointer to uniform random number generator */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, par, UNUR_ERR_NULL ); _unur_check_NULL("URNG", urng, UNUR_ERR_NULL); /* main generator */ par->urng = urng; /* overwrite auxilliary generator */ if (par->urng_aux) par->urng_aux = urng; return UNUR_SUCCESS; } /* end of unur_set_urng() */ /*---------------------------------------------------------------------------*/ UNUR_URNG * unur_get_urng( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* get uniform random number generator */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* Pointer to old uniform RNG */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { /* check arguments */ CHECK_NULL(gen,NULL); return gen->urng; } /* end of unur_get_urng() */ /*---------------------------------------------------------------------------*/ UNUR_URNG * unur_chg_urng( struct unur_gen *gen, UNUR_URNG *urng ) /*----------------------------------------------------------------------*/ /* set uniform random number generator */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* urng ... pointer to uniform random number generator */ /* */ /* return: */ /* Pointer to old uniform RNG */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { UNUR_URNG *urng_old; /* check arguments */ CHECK_NULL(gen,NULL); CHECK_NULL(urng,NULL); urng_old = gen->urng; /* set pointer to main URNG */ gen->urng = urng; /* also set pointer in auxiliary generator objects */ if (gen->gen_aux) unur_chg_urng(gen->gen_aux,urng); if (gen->gen_aux_list && gen->n_gen_aux_list) { int i; for (i=0; in_gen_aux_list; i++) { if (gen->gen_aux_list[i]) unur_chg_urng(gen->gen_aux_list[i],urng); } } /* overwrite auxilliary URNG */ if (gen->urng_aux) gen->urng_aux = urng; return urng_old; } /* end of unur_chg_urng() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Auxiliary uniform random number generator **/ /** **/ /*****************************************************************************/ int unur_set_urng_aux( struct unur_par *par, UNUR_URNG *urng_aux ) /*----------------------------------------------------------------------*/ /* set auxilliary uniform random number generator */ /* */ /* parameters: */ /* par_aux ... pointer to parameter for building generator object */ /* urng ... pointer to auxilliary uniform random number generator */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, par, UNUR_ERR_NULL ); _unur_check_NULL("URNGaux", urng_aux, UNUR_ERR_NULL); if (par->urng_aux == NULL) /* no auxilliary generator is required */ return UNUR_ERR_GENERIC; par->urng_aux = urng_aux; return UNUR_SUCCESS; } /* end of unur_set_urng_aux() */ /*---------------------------------------------------------------------------*/ UNUR_URNG * unur_get_urng_aux( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* get auxilliary uniform random number generator */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* Pointer to old auxilliary uniform RNG */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { /* check arguments */ CHECK_NULL(gen,NULL); return gen->urng_aux; } /* end of unur_get_urng_aux() */ /*---------------------------------------------------------------------------*/ UNUR_URNG * unur_chg_urng_aux( struct unur_gen *gen, UNUR_URNG *urng_aux ) /*----------------------------------------------------------------------*/ /* set auxilliary uniform random number generator */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* urng_aux ... pointer to auxilliary uniform random number generator */ /* */ /* return: */ /* Pointer to old auxilliary uniform RNG */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { UNUR_URNG *urng_aux_old; /* check arguments */ CHECK_NULL(gen,NULL); CHECK_NULL(urng_aux,NULL); if (gen->urng_aux == NULL) /* no auxilliary generator is required */ return NULL; urng_aux_old = gen->urng_aux; /* set pointer to main URNG */ gen->urng_aux = urng_aux; /* also set pointer in auxiliary generator objects */ if (gen->gen_aux) unur_chg_urng_aux(gen->gen_aux,urng_aux); if (gen->gen_aux_list && gen->n_gen_aux_list) { int i; for (i=0; in_gen_aux_list; i++) { if (gen->gen_aux_list[i]) unur_chg_urng_aux(gen->gen_aux_list[i],urng_aux); } } return urng_aux_old; } /* end of unur_chg_urng_aux() */ /*---------------------------------------------------------------------------*/ int unur_use_urng_aux_default( UNUR_PAR *par ) /*----------------------------------------------------------------------*/ /* set auxilliary uniform random number generator to default */ /* (initialize generator if necessary) */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { if (par->urng_aux == NULL) /* no auxilliary generator is required */ return UNUR_ERR_GENERIC; /* set aux URNG */ par->urng_aux = unur_get_default_urng_aux(); return UNUR_SUCCESS; } /* end of unur_use_urng_aux_default() */ /*---------------------------------------------------------------------------*/ int unur_chgto_urng_aux_default( UNUR_GEN *gen ) /*----------------------------------------------------------------------*/ /* set auxilliary uniform random number generator to default */ /* (initialize generator if necessary) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { if (gen->urng_aux == NULL) /* no auxilliary generator is required */ return UNUR_ERR_GENERIC; /* set aux URNG */ gen->urng_aux = unur_get_default_urng_aux(); return UNUR_SUCCESS; } /* end of unur_chgto_urng_aux_default() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/urng/urng_source.h0000644001357500135600000001340514420445767014323 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: unur_source.h * * * * macros for calling and resetting uniform random number generators * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifndef URNG_SOURCE_H_SEEN #define URNG_SOURCE_H_SEEN /*---------------------------------------------------------------------------*/ #ifdef UNUR_URNG_UNURAN /*---------------------------------------------------------------------------*/ /* function call to uniform RNG */ #define _unur_call_urng(urng) ((urng)->sampleunif((urng)->state)) /*---------------------------------------------------------------------------*/ #else /*---------------------------------------------------------------------------*/ #error #error UNUR_URNG changed! #error #error Define _unur_call_urng(urng) and _unur_call_reset(urng) in #error file 'urng_source' #error /*---------------------------------------------------------------------------*/ /* The UNU.RAN API to uniform random number generator should be flexible */ /* enough to use any source of uniform random number generators. */ /* */ /* Please, report any problem with this interface to this interface to the */ /* UNU.RAN development team. */ /* */ /* When the UNU.RAN interface to uniform random number generator must be */ /* changed (not recommended), proceed as following: */ /* */ /* (1) Change the typedef for 'UNUR_URNG' in file 'src/unur_typedefs.h'. */ /* (2) Comment out the #definition of 'UNUR_URNG_UNURAN' to remove all */ /* code from the UNU.RAN API. */ /* (3) Comment out the above error directives. */ /* (4) Define _unur_call_urng(urng) and _unur_call_reset(urng). */ /* Here is a template: */ /* */ /* - function call to uniform RNG: */ /* #define _unur_call_urng(urng) (my_uniform_generator(urng)) */ /* */ /* - reset uniform RNG: */ /* #define _unur_call_reset(urng) (my_reset_unif(urng),UNUR_SUCCESS) */ /* if no such reset call exists: */ /* #define _unur_call_reset(urng) (UNUR_FAILURE) */ /* */ /* (5) Define defaults 'UNUR_URNG_DEFAULT' and 'UNUR_URNG_AUX_DEFAULT' */ /* in file 'src/unuran_config.h'. */ /* */ /* Notice that some test routines (like counting URNGs) and the test suite */ /* do not work for a non-UNU.RAN interface. */ /*---------------------------------------------------------------------------*/ #endif /* UNUR_URNG_UNURAN */ /*---------------------------------------------------------------------------*/ #endif /* #ifndef URNG_SOURCE_H_SEEN */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/urng/urng.c0000644001357500135600000002134114420445767012734 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: urng.c * * * * Unified interface for UNURAN uniform random number generators. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include "urng.h" /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Sample from and reset an URNG object **/ /** **/ /*****************************************************************************/ double unur_urng_sample (UNUR_URNG *urng) /*----------------------------------------------------------------------*/ /* Sample from URNG object. */ /* */ /* parameters: */ /* urng ... pointer to URNG object */ /* */ /* return: */ /* uniform random number */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { /* check argument */ if (urng == NULL) /* use default generator */ urng = unur_get_default_urng(); return _unur_call_urng(urng); } /* end of unur_urng_sample() */ /*---------------------------------------------------------------------------*/ double unur_sample_urng (UNUR_GEN *gen) /*----------------------------------------------------------------------*/ /* Sample from underlying URNG object. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* uniform random number */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { struct unur_urng *urng = (gen) ? gen->urng : unur_get_default_urng(); return _unur_call_urng(urng); } /* end of unur_sample_urng() */ /*---------------------------------------------------------------------------*/ int unur_urng_sample_array (UNUR_URNG *urng, double *X, int dim) /*----------------------------------------------------------------------*/ /* Sample from URNG object and fill array X. */ /* if URNG has a "natural" dimension s then only the first min(s,dim) */ /* entries are filled. */ /* */ /* parameters: */ /* urng ... pointer to URNG object */ /* X ... pointer to array of (at least) length dim */ /* dim ... (maximal) number of entries in X to be set */ /* */ /* return: */ /* number of uniform random numbers filled into array */ /* */ /* error: */ /* return 0 */ /*----------------------------------------------------------------------*/ { /* check argument */ if (urng == NULL) /* use default generator */ urng = unur_get_default_urng(); if (urng->samplearray) { return (urng->samplearray(urng->state,X,dim)); } else { int i; for (i=0; ireset != NULL) { urng->reset (urng->state); return UNUR_SUCCESS; } /* if no reset function exists, we look for an initial seed */ if (urng->setseed != NULL && urng->seed != ULONG_MAX) { unur_urng_seed(urng,urng->seed); return UNUR_SUCCESS; } /* neither works */ _unur_error("URNG",UNUR_ERR_URNG_MISS,"reset"); return UNUR_ERR_URNG_MISS; #else return _unur_call_reset(urng); #endif } /* end of unur_urng_reset() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/urng/Makefile.in0000644001357500135600000004526414430713360013660 00000000000000# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = src/urng ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) liburng_la_LIBADD = am_liburng_la_OBJECTS = urng.lo urng_set.lo urng_default.lo \ urng_unuran.lo liburng_la_OBJECTS = $(am_liburng_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/urng.Plo \ ./$(DEPDIR)/urng_default.Plo ./$(DEPDIR)/urng_set.Plo \ ./$(DEPDIR)/urng_unuran.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(liburng_la_SOURCES) DIST_SOURCES = $(liburng_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autoconf/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILECMD = @FILECMD@ GREP = @GREP@ HAVE_DIVIDE_BY_ZERO = @HAVE_DIVIDE_BY_ZERO@ HAVE_IEEE_COMPARISONS = @HAVE_IEEE_COMPARISONS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNURAN_LT_VERSION = @UNURAN_LT_VERSION@ UNURAN_SUPPORTS_GSL = @UNURAN_SUPPORTS_GSL@ UNURAN_SUPPORTS_PRNG = @UNURAN_SUPPORTS_PRNG@ UNURAN_SUPPORTS_RNGSTREAM = @UNURAN_SUPPORTS_RNGSTREAM@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ have_valgrind = @have_valgrind@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = \ -I$(top_srcdir)/src noinst_LTLIBRARIES = liburng.la liburng_la_SOURCES = \ urng_source.h urng_struct.h \ urng.h urng.c urng_set.c urng_default.c \ urng_unuran.c # clean backup files CLEANFILES = *~ # clean generated files MAINTAINERCLEANFILES = \ Makefile.in all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/urng/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/urng/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } liburng.la: $(liburng_la_OBJECTS) $(liburng_la_DEPENDENCIES) $(EXTRA_liburng_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(liburng_la_OBJECTS) $(liburng_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/urng.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/urng_default.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/urng_set.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/urng_unuran.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/urng.Plo -rm -f ./$(DEPDIR)/urng_default.Plo -rm -f ./$(DEPDIR)/urng_set.Plo -rm -f ./$(DEPDIR)/urng_unuran.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/urng.Plo -rm -f ./$(DEPDIR)/urng_default.Plo -rm -f ./$(DEPDIR)/urng_set.Plo -rm -f ./$(DEPDIR)/urng_unuran.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: unuran-1.11.0/src/urng/Makefile.am0000644001357500135600000000052714420445767013654 00000000000000## Process this file with automake to produce Makefile.in AM_CPPFLAGS = \ -I$(top_srcdir)/src noinst_LTLIBRARIES = liburng.la liburng_la_SOURCES = \ urng_source.h urng_struct.h \ urng.h urng.c urng_set.c urng_default.c \ urng_unuran.c # clean backup files CLEANFILES = *~ # clean generated files MAINTAINERCLEANFILES = \ Makefile.in unuran-1.11.0/src/urng/urng_unuran.c0000644001357500135600000007455414420445767014342 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: urng_unuran.c * * * * Unified interface for UNURAN uniform random number generators. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include "urng.h" /*---------------------------------------------------------------------------*/ #ifdef UNUR_URNG_UNURAN /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Create new URNG object **/ /** **/ /*****************************************************************************/ UNUR_URNG * unur_urng_new( double (*sampleunif)(void *state), void *state ) /*----------------------------------------------------------------------*/ /* create a new URNG object for uniform random number generator. */ /* */ /* parameters: */ /* sampleunif ... pointer to sampling routine */ /* */ /* return: */ /* pointer to URNG object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { UNUR_URNG *urng = NULL; /* pointer to URNG object */ /* check arguments */ _unur_check_NULL( "URNG", sampleunif, NULL ); /* allocate memory for URNG object */ urng = _unur_xmalloc( sizeof(struct unur_urng) ); /* copy parameters into object */ urng->sampleunif = sampleunif; urng->state = state; /* initialize optional functions (set to not available) */ urng->samplearray = NULL; urng->sync = NULL; urng->seed = ULONG_MAX; urng->setseed = NULL; urng->delete = NULL; urng->reset = NULL; urng->nextsub = NULL; urng->resetsub = NULL; urng->anti = NULL; /* set magic cookie */ COOKIE_SET(urng,CK_URNG); /* return object */ return urng; } /* end of unur_urng_new() */ /*---------------------------------------------------------------------------*/ int unur_urng_set_sample_array( UNUR_URNG *urng, unsigned int (*samplearray)(void *state, double *X, int dim) ) /*----------------------------------------------------------------------*/ /* Set function to sample random point */ /* */ /* parameters: */ /* urng ... pointer to URNG object */ /* samplearray ... function for sampling random point */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( "URNG", urng, UNUR_ERR_NULL ); COOKIE_CHECK(urng,CK_URNG,UNUR_ERR_COOKIE); urng->samplearray = samplearray; return UNUR_SUCCESS; } /* end of unur_urng_set_sample_array() */ /*---------------------------------------------------------------------------*/ int unur_urng_set_sync( UNUR_URNG *urng, void (*sync)(void *state) ) /*----------------------------------------------------------------------*/ /* Set function for jumping into defined state ("sync") */ /* */ /* parameters: */ /* urng ... pointer to URNG object */ /* sync ... function for syncing generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( "URNG", urng, UNUR_ERR_NULL ); COOKIE_CHECK(urng,CK_URNG,UNUR_ERR_COOKIE); urng->sync = sync; return UNUR_SUCCESS; } /* end of unur_urng_set_reset() */ /*---------------------------------------------------------------------------*/ int unur_urng_set_seed( UNUR_URNG *urng, void (*setseed)(void *state, unsigned long seed) ) /*----------------------------------------------------------------------*/ /* Set function to seed. */ /* */ /* parameters: */ /* urng ... pointer to URNG object */ /* setseed ... function for seeding generator */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( "URNG", urng, UNUR_ERR_NULL ); COOKIE_CHECK(urng,CK_URNG,UNUR_ERR_COOKIE); urng->setseed = setseed; return UNUR_SUCCESS; } /* end of unur_urng_set_seed() */ /*---------------------------------------------------------------------------*/ int unur_urng_set_anti( UNUR_URNG *urng, void (*setanti)(void *state, int anti) ) /*----------------------------------------------------------------------*/ /* Set function to switch to antithetic random numbers. */ /* */ /* parameters: */ /* urng ... pointer to URNG object */ /* setanti ... function for switching antithetic flag */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( "URNG", urng, UNUR_ERR_NULL ); COOKIE_CHECK(urng,CK_URNG,UNUR_ERR_COOKIE); urng->anti = setanti; return UNUR_SUCCESS; } /* end of unur_urng_set_anti() */ /*---------------------------------------------------------------------------*/ int unur_urng_set_reset( UNUR_URNG *urng, void (*reset)(void *state) ) /*----------------------------------------------------------------------*/ /* Set function for reseting URNG. */ /* */ /* parameters: */ /* urng ... pointer to URNG object */ /* reset ... function for reseting generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( "URNG", urng, UNUR_ERR_NULL ); COOKIE_CHECK(urng,CK_URNG,UNUR_ERR_COOKIE); urng->reset = reset; return UNUR_SUCCESS; } /* end of unur_urng_set_reset() */ /*---------------------------------------------------------------------------*/ int unur_urng_set_nextsub( UNUR_URNG *urng, void (*nextsub)(void *state) ) /*----------------------------------------------------------------------*/ /* Set function for jumping to start of the next substream of URNG. */ /* */ /* parameters: */ /* urng ... pointer to URNG object */ /* nextsub ... function for jumping to next substream */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( "URNG", urng, UNUR_ERR_NULL ); COOKIE_CHECK(urng,CK_URNG,UNUR_ERR_COOKIE); urng->nextsub = nextsub; return UNUR_SUCCESS; } /* end of unur_urng_set_nextsub() */ /*---------------------------------------------------------------------------*/ int unur_urng_set_resetsub( UNUR_URNG *urng, void (*resetsub)(void *state) ) /*----------------------------------------------------------------------*/ /* Set function for jumping to start of the current substream of URNG. */ /* */ /* parameters: */ /* urng ... pointer to URNG object */ /* resetsub ... function for reseting current substream */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( "URNG", urng, UNUR_ERR_NULL ); COOKIE_CHECK(urng,CK_URNG,UNUR_ERR_COOKIE); urng->resetsub = resetsub; return UNUR_SUCCESS; } /* end of unur_urng_set_resetsub() */ /*---------------------------------------------------------------------------*/ int unur_urng_set_delete( UNUR_URNG *urng, void (*delete)(void *state) ) /*----------------------------------------------------------------------*/ /* Set function for destroying URNG. */ /* */ /* parameters: */ /* urng ... pointer to URNG object */ /* delete ... function for destroying generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( "URNG", urng, UNUR_ERR_NULL ); COOKIE_CHECK(urng,CK_URNG,UNUR_ERR_COOKIE); urng->delete = delete; return UNUR_SUCCESS; } /* end of unur_urng_set_delete() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Handle a URNG object **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ int unur_urng_sync (UNUR_URNG *urng) /*----------------------------------------------------------------------*/ /* Jump into defined state ("sync") */ /* */ /* parameters: */ /* urng ... pointer to URNG object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check argument */ if (urng == NULL) /* use default generator */ urng = unur_get_default_urng(); COOKIE_CHECK(urng,CK_URNG,UNUR_ERR_COOKIE); /* check whether we can reset the URNG object */ if (urng->sync == NULL) { _unur_error("URNG",UNUR_ERR_URNG_MISS,"sync"); return UNUR_ERR_URNG_MISS; } /* jump to next substream */ urng->sync (urng->state); return UNUR_SUCCESS; } /* end of unur_urng_sync() */ /*---------------------------------------------------------------------------*/ int unur_urng_seed (UNUR_URNG *urng, unsigned long seed) /*----------------------------------------------------------------------*/ /* (Re-)Seed URNG. */ /* */ /* parameters: */ /* urng ... pointer to URNG object */ /* seed ... new seed for generator */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check argument */ if (urng == NULL) /* use default generator */ urng = unur_get_default_urng(); COOKIE_CHECK(urng,CK_URNG,UNUR_ERR_COOKIE); /* check whether we can set the antithetic flag */ if (urng->setseed == NULL) { _unur_error("URNG",UNUR_ERR_URNG_MISS,"seeding function"); return UNUR_ERR_URNG_MISS; } /* set seed */ urng->setseed (urng->state,seed); /* store seed */ urng->seed = seed; return UNUR_SUCCESS; } /* end of unur_urng_seed() */ /*---------------------------------------------------------------------------*/ int unur_urng_anti (UNUR_URNG *urng, int anti) /*----------------------------------------------------------------------*/ /* Set antithetic flag for URNG. */ /* */ /* parameters: */ /* urng ... pointer to URNG object */ /* anti ... antithetic flag */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check argument */ if (urng == NULL) /* use default generator */ urng = unur_get_default_urng(); COOKIE_CHECK(urng,CK_URNG,UNUR_ERR_COOKIE); /* check whether we can set the antithetic flag */ if (urng->anti == NULL) { _unur_error("URNG",UNUR_ERR_URNG_MISS,"antithetic flag"); return UNUR_ERR_URNG_MISS; } /* set flag */ urng->anti (urng->state,anti); return UNUR_SUCCESS; } /* end of unur_urng_anti() */ /*---------------------------------------------------------------------------*/ int unur_urng_nextsub (UNUR_URNG *urng) /*----------------------------------------------------------------------*/ /* Jump to start of next substream in URNG. */ /* */ /* parameters: */ /* urng ... pointer to URNG object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check argument */ if (urng == NULL) /* use default generator */ urng = unur_get_default_urng(); COOKIE_CHECK(urng,CK_URNG,UNUR_ERR_COOKIE); /* check whether we can reset the URNG object */ if (urng->nextsub == NULL) { _unur_error("URNG",UNUR_ERR_URNG_MISS,"next substream"); return UNUR_ERR_URNG_MISS; } /* jump to next substream */ urng->nextsub (urng->state); return UNUR_SUCCESS; } /* end of unur_urng_nextsub() */ /*---------------------------------------------------------------------------*/ int unur_urng_resetsub (UNUR_URNG *urng) /*----------------------------------------------------------------------*/ /* Reset current substream of the URNG object. */ /* */ /* parameters: */ /* urng ... pointer to URNG object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check argument */ if (urng == NULL) /* use default generator */ urng = unur_get_default_urng(); COOKIE_CHECK(urng,CK_URNG,UNUR_ERR_COOKIE); /* check whether we can reset the URNG object */ if (urng->resetsub == NULL) { _unur_error("URNG",UNUR_ERR_URNG_MISS,"reset substream"); return UNUR_ERR_URNG_MISS; } /* reset substream */ urng->resetsub (urng->state); return UNUR_SUCCESS; } /* end of unur_urng_resetsub() */ /*---------------------------------------------------------------------------*/ void unur_urng_free (UNUR_URNG *urng) /*----------------------------------------------------------------------*/ /* Destroy URNG object. */ /* */ /* parameters: */ /* urng ... pointer to URNG object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check argument */ if (urng == NULL) return; /* nothing to do */ COOKIE_CHECK(urng,CK_URNG,RETURN_VOID); if (urng->delete != NULL) urng->delete (urng->state); free (urng); urng = NULL; return; } /* end of unur_urng_free() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Handle URNG object in a generator object **/ /** **/ /*****************************************************************************/ int unur_gen_sync (UNUR_GEN *gen) /*----------------------------------------------------------------------*/ /* Jump into defined state ("sync") of uniform generator in */ /* generator object. */ /* */ /* parameters: */ /* gen ... generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check argument */ _unur_check_NULL( "URNG", gen, UNUR_ERR_NULL ); return unur_urng_sync(gen->urng); } /* end of unur_gen_sync() */ /*---------------------------------------------------------------------------*/ int unur_gen_seed (UNUR_GEN *gen, unsigned long seed) /*----------------------------------------------------------------------*/ /* (Re-) Seed uniform generator in generator object. */ /* */ /* parameters: */ /* gen ... generator object */ /* seed ... new seed for generator */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check argument */ _unur_check_NULL( "URNG", gen, UNUR_ERR_NULL ); return unur_urng_seed(gen->urng, seed); } /* end of unur_gen_seed() */ /*---------------------------------------------------------------------------*/ int unur_gen_anti (UNUR_GEN *gen, int anti) /*----------------------------------------------------------------------*/ /* Set antithetic flag of uniform generator in generator object. */ /* */ /* parameters: */ /* gen ... generator object */ /* anti ... antithetic flag */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check argument */ _unur_check_NULL( "URNG", gen, UNUR_ERR_NULL ); return unur_urng_anti(gen->urng, anti); } /* end of unur_gen_anti() */ /*---------------------------------------------------------------------------*/ int unur_gen_reset (UNUR_GEN *gen) /*----------------------------------------------------------------------*/ /* Reset uniform generator in generator object. */ /* */ /* parameters: */ /* gen ... generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check argument */ _unur_check_NULL( "URNG", gen, UNUR_ERR_NULL ); return unur_urng_reset(gen->urng); } /* end of unur_gen_reset() */ /*---------------------------------------------------------------------------*/ int unur_gen_nextsub (UNUR_GEN *gen) /*----------------------------------------------------------------------*/ /* Jump uniform generator in generator object to start of next */ /* substream. */ /* */ /* parameters: */ /* gen ... generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check argument */ _unur_check_NULL( "URNG", gen, UNUR_ERR_NULL ); return unur_urng_nextsub(gen->urng); } /* end of unur_gen_nextsub() */ /*---------------------------------------------------------------------------*/ int unur_gen_resetsub (UNUR_GEN *gen) /*----------------------------------------------------------------------*/ /* Reset current substream of uniform generator in generator object. */ /* */ /* parameters: */ /* gen ... generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check argument */ _unur_check_NULL( "URNG", gen, UNUR_ERR_NULL ); return unur_urng_resetsub(gen->urng); } /* end of unur_gen_resetsub() */ /*---------------------------------------------------------------------------*/ #endif /* UNUR_URNG_UNURAN */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/urng/urng.h0000644001357500135600000005445114420445767012751 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: urng.h * * * * PURPOSE: * * declares macros and function prototypes for using uniform * * random number generators inside UNU.RAN. * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifndef URNG_H_SEEN #define URNG_H_SEEN /*---------------------------------------------------------------------------*/ /* =NODE URNG Using uniform random number generators =UP TOP [50] =DESCRIPTION UNU.RAN is designed to work with many sources of (pseudo-) random numbers or low discrepancy numbers (so called quasi-random numbers) for almost all tasks in discrete event simulation, (quasi-) Monte Carlo integration or any other stochastic methods. Hence UNU.RAN uses pointers to access uniform (pseudo-) random number generators (URNG). Each UNU.RAN (non-uniform random variate) generator object has a pointer to a URNG object. Thus each UNU.RAN generator object may have its own (independent) URNG or several generator objects can share the same URNG. If no URNG is provided for a parameter or generator object a default generator is used which is the same for all generators. This URNG is defined in @file{unuran_config.h} at compile time and can be changed at runtime. UNU.RAN uses a unified interface for all sources of random numbers. Unfortunately, the API for random number generators, like the @file{GSL} (GNU Scientific Library), Otmar Lendl's @file{prng} (Pseudo random number generators), or a single function implemented by the user herself, are quite different. Hence an object of type @code{UNUR_URNG} is introduced to store the URNG. Thus it is possible to handle different sources of such URNGs with the unified API. It is inspired from similar to Pierre L'Ecuyers @file{RngStreams} library: @itemize @minus @item seed the random number generator; @item get a uniform random number; @item reset the URNG; @item skip to the begining next substream; @item sample antithetic numbers; @item delete the URNG object. @end itemize The routine to create a URNG depends on the chosen random number generator (i.e. library). Nevertheless, there exist wrapper functions to simplify this task. Currently the following sources of uniform random numbers are directly supported (i.e., there exist wrapper functions). Of course other random number generation libraries can be used. @enumerate @item @code{FVOID} URNGs of type @code{double uniform(void *state)}. The argument @var{state} can be simply ignored in the implementation of @code{uniform} when a global state variable is used. UNU.RAN contains some build-in URNGs of this type in directory @file{src/uniform/}. @item @code{PRNG} URNGs from Otmar Lendl's @code{prng} library. It provides a very flexible way to sample form arbitrary URNGs by means of an object oriented programing paradigma. Similarly to the UNU.RAN library independent generator objects can be build and used. This library has been developed by the pLab group at the university of Salzburg (Austria, EU) and implemented by Otmar Lendl. It is available from @uref{http://statmath.wu.ac.at/prng/} or from the pLab site at @uref{http://random.mat.sbg.ac.at/}. This interface must be compiled into UNU.RAN using the configure flag @code{--with-urng-prng}. @item @code{RNGSTREAM} Pierre L'Ecuyer's @code{RngStream} library for multiple independent streams of pseudo-random numbers. A GNU-style package is available from @uref{http://statmath.wu.ac.at/software/RngStreams/}. This interface must be compiled into UNU.RAN using the configure flag @code{--with-urng-rngstream}. @item @code{GSL} URNG from the GNU Scientific Library (GSL). It is available from @uref{http://www.gnu.org/software/gsl/}. This interface must be compiled into UNU.RAN using the configure flag @code{--with-urng-gsl}. @end enumerate =HOWTOUSE Each UNU.RAN generator object has a pointer to a uniform (pseudo-) random number generator (URNG). It can be set via the unur_set_urng() call. It is also possible to read this pointer via unur_get_urng() or change the URNG for an existing generator object by means of unur_chg_urng(). It is important to note that these calls only copy the pointer to the URNG object into the generator object. If no URNG is provided for a parameter or generator object a default URNG is used which is the same for all generators. This URNG is defined in @file{unuran_config.h} at compile time. A pointer to this default URNG can be obtained via unur_get_default_urng(). Nevertheless, it is also possible to change this default URNG by another one at runtime by means of the unur_set_default_urng() call. However, this only takes effect for new parameter objects. Some generating methods provide the possibility of correlation induction. For this feature a second auxiliary URNG is required. It can be set and changed by unur_set_urng_aux() and unur_chg_urng_aux() calls, respectively. Since the auxiliary URNG is by default the same as the main URNG, the auxiliary URNG must be set after any unur_set_urng() or unur_chg_urng() call! Since in special cases mixing of two URNG might cause problems, we supply a default auxiliary generator that can be used by a unur_use_urng_aux_default() call (after the main URNG has been set). This default auxiliary generator can be changed with analogous calls as the (main) default uniform generator. Uniform random number generators form different sources have different programming interfaces. Thus UNU.RAN stores all information about a particular uniform random number generator in a structure of type @code{UNUR_URNG}. Before a URNG can be used with UNU.RAN an appropriate object has to be created ba a unur_urng_new() call. This call takes two arguments: the pointer to the sampling routine of the generator and a pointer to a possible argument that stores the state of the generator. The function must be of type @code{double (*sampleunif)(void *params)}, but functions without any argument also work. Additionally one can set pointers to functions for reseting or jumping the streams generated by the URNG by the corresponding @code{set} calls. UNU.RAN provides a unified API to all sources of random numbers. Notice, however, that not all functions work for all random number generators (as the respective library has not implemented the corresponding feature). There are wrapper functions for some libraries of uniform random number generators to simplify the task of creating a UNU.RAN object for URNGs. These functions must be compiled into UNU.RAN using the corresponding configure flags (see description of the respective interface below). =END */ /*---------------------------------------------------------------------------*/ /* =ROUTINES */ /*---------------------------------------------------------------------------*/ /* ==DOC @subheading Set and get default uniform RNGs */ UNUR_URNG *unur_get_default_urng( void ); /* Get the pointer to the default URNG. The default URNG is used by all generators where no URNG was set explicitly by a unur_set_urng() call. */ UNUR_URNG *unur_set_default_urng( UNUR_URNG *urng_new ); /* Change the default URNG that is used for new parameter objects. It returns the pointer to the old default URNG that has been used. */ UNUR_URNG *unur_set_default_urng_aux( UNUR_URNG *urng_new ); /* */ UNUR_URNG *unur_get_default_urng_aux( void ); /* Analogous calls for default auxiliary generator. */ /*---------------------------------------------------------------------------*/ /* ==DOC @subheading Set, change and get uniform RNGs in generator objects */ int unur_set_urng( UNUR_PAR *parameters, UNUR_URNG *urng ); /* Use the URNG @code{urng} for the new generator. This overrides the default URNG. It also sets the auxiliary URNG to @code{urng}. @emph{Important}: For multivariate distributions that use marginal distributions this call does not work properly. It is then better first to create the generator object (by a unur_init() call) and then change the URNG by means of unur_chg_urng(). */ UNUR_URNG *unur_chg_urng( UNUR_GEN *generator, UNUR_URNG *urng ); /* Change the URNG for the given generator. It returns the pointer to the old URNG that has been used by the generator. It also changes the auxiliary URNG to @code{urng} and thus it overrides the last unur_chg_urng_aux() call. */ UNUR_URNG *unur_get_urng( UNUR_GEN *generator ); /* Get the pointer to the URNG that is used by the @var{generator}. This is usefull if two generators should share the same URNG. */ int unur_set_urng_aux( UNUR_PAR *parameters, UNUR_URNG *urng_aux ); /* Use the auxiliary URNG @code{urng_aux} for the new generator. (Default is the default URNG or the URNG from the last unur_set_urng() call. Thus if the auxiliary generator should be different to the main URNG, unur_set_urng_aux() must be called after unur_set_urng(). The auxiliary URNG is used as second stream of uniform random number for correlation induction. It is not possible to set an auxiliary URNG for a method that does not need one. In this case an error code is returned. */ int unur_use_urng_aux_default( UNUR_PAR *parameters ); /* Use the default auxiliary URNG. (It must be set after unur_get_urng().) It is not possible to set an auxiliary URNG for a method that does not use one (i.e. the call returns an error code). */ int unur_chgto_urng_aux_default( UNUR_GEN *generator ); /* Switch to default auxiliary URNG. (It must be set after unur_get_urng().) It is not possible to set an auxiliary URNG for a method that does not use one (i.e. the call returns an error code). */ UNUR_URNG *unur_chg_urng_aux( UNUR_GEN *generator, UNUR_URNG *urng_aux ); /* Change the auxiliary URNG for the given @var{generator}. It returns the pointer to the old auxiliary URNG that has been used by the generator. It has to be called after each unur_chg_urng() when the auxiliary URNG should be different from the main URNG. It is not possible to change the auxiliary URNG for a method that does not use one (i.e. the call NULL). */ UNUR_URNG *unur_get_urng_aux( UNUR_GEN *generator ); /* Get the pointer to the auxiliary URNG that is used by the @var{generator}. This is usefull if two generators should share the same URNG. */ /*---------------------------------------------------------------------------*/ /* ==DOC @subheading Handle uniform RNGs @emph{Notice:} Some of the below function calls do not work for every source of random numbers since not every library has implemented these features. */ double unur_urng_sample (UNUR_URNG *urng); /* Get a uniform random number from @var{urng}. If the NULL pointer is given, the default uniform generator is used. */ double unur_sample_urng (UNUR_GEN *gen); /* Get a uniform random number from the underlying uniform random number generator of generator @var{gen}. If the NULL pointer is given, the default uniform generator is used. */ int unur_urng_sample_array (UNUR_URNG *urng, double *X, int dim); /* Set array @var{X} of length @var{dim} with uniform random numbers sampled from generator @var{urng}. If @var{urng} is the NULL pointer, the default uniform generator is used. @emph{Important:} If @var{urng} is based on a point set generator (this is the case for generators of low discrepance point sets as used in quasi-Monte Carlo methods) it has a ``natural dimension'' @i{s}. In this case either only the first @i{s} entries of @var{X} are filled (if @i{s} < @var{dim}), or the first @var{dim} coordinates of the generated point are filled. The called returns the actual number of entries filled. In case of an error @code{0} is returned. */ int unur_urng_reset (UNUR_URNG *urng); /* Reset @var{urng} object. The routine tries two ways to reset the generator (in this order): @enumerate @item It uses the reset function given by an unur_urng_set_reset() call. @item It uses the seed given by the last unur_urng_seed() call (which requires a seeding function given by a unur_urng_set_seed() call). @end enumerate If neither of the two methods work resetting of the generator is not possible and an error code is returned. If the NULL pointer is given, the default uniform generator is reset. */ /*---------------------------------------------------------------------------*/ #ifdef UNUR_URNG_UNURAN /*---------------------------------------------------------------------------*/ int unur_urng_sync (UNUR_URNG *urng); /* Jump into defined state ("sync") of the generator. This is useful when point generators are used where the coordinates are sampled via unur_urng_sample(). Then this call can be used to jump to the first coordinate of the next generated point. */ int unur_urng_seed (UNUR_URNG *urng, unsigned long seed); /* Set @var{seed} for generator @var{urng}. It returns an error code if this is not possible for the given URNG. If the NULL pointer is given, the default uniform generator is seeded (if possible). @emph{Notice}: Seeding should be done only once for a particular generator (except for resetting it to the initial state). Expertise is required when multiple seeds are used to get independent streams. Thus we recommend appropriate libraries for this task, e.g. Pierre L'Ecuyer's @file{RngStreams} package. For this library only a package seed can be set and thus the unur_urng_seed() call will not have any effect to generators of this type. Use unur_urng_reset() or unur_urng_rngstream_new() instead, depending whether one wants to reset the stream or get a new stream that is independent from the previous ones. */ int unur_urng_anti (UNUR_URNG *urng, int anti); /* Switch to antithetic random numbers in @var{urng}. It returns an error code if this is not possible for the given URNG. If the NULL pointer is given, the antithetic flag of the default uniform generator is switched (if possible). */ int unur_urng_nextsub (UNUR_URNG *urng); /* Jump to start of the next substream of @var{urng}. It returns an error code if this is not possible for the given URNG. If the NULL pointer is given, the default uniform generator is set to the start of the next substream (if possible). */ int unur_urng_resetsub (UNUR_URNG *urng); /* Jump to start of the current substream of @var{urng}. It returns an error code if this is not possible for the given URNG. If the NULL pointer is given, the default uniform generator is set to the start of the current substream (if possible). */ int unur_gen_sync (UNUR_GEN *generator); /* */ int unur_gen_seed (UNUR_GEN *generator, unsigned long seed); /* */ int unur_gen_anti (UNUR_GEN *generator, int anti); /* */ int unur_gen_reset (UNUR_GEN *generator); /* */ int unur_gen_nextsub (UNUR_GEN *generator); /* */ int unur_gen_resetsub (UNUR_GEN *generator); /* Analogous to unur_urng_sync(), unur_urng_seed(), unur_urng_anti(), unur_urng_reset(), unur_urng_nextsub(), and unur_urng_resetsub(), but act on the URNG object used by the @var{generator} object. @emph{Warning:} These calls should be used with care as it influences all generator objects that share the same URNG object! */ /*---------------------------------------------------------------------------*/ /* ==DOC @subheading API to create a new URNG object @emph{Notice:} These functions are provided to built a UNUR_URNG object for a particular external random number generator from scratch. For some libraries that contain random number generators (like the GSL) there are special calls, e.g. unur_urng_gsl_new(), to get such an object. Then there is no need to change the UNUR_URNG object as it already contains all available features. If you have a particular library for random number generators you can either write wrapper function like those in @file{src/uniform/urng_gsl.c} or write an email to the authors of UNU.RAN to write it for you. */ UNUR_URNG *unur_urng_new( double (*sampleunif)(void *state), void *state ); /* Get a new URNG object. @var{sampleunif} is a function to the uniform sampling routine, @var{state} a pointer to its arguments which usually contains the state variables of the generator. Functions @var{sampleunif} with a different type for @var{p} or without an argument at all also work. A typecast might be necessary to avoid compiler warnings or error messages. For functions @var{sampleunif} that does not have any argument should use NULL for @var{state}. @emph{Important:} @var{sampleunif} must not be the NULL pointer. There are appropriate calls that simplifies the task of creating URNG objects for some libraries with uniform random number generators, see below. */ void unur_urng_free (UNUR_URNG *urng); /* Destroy @var{urng} object. It returns an error code if this is not possible. If the NULL is given, this function does nothing. @emph{Warning:} This call must be used with care. The @var{urng} object must not be used by any existing generator object! It is designed to work in conjunction with the wrapper functions to create URNG objects for generators of a particular library. Thus an object created by an unur_urng_prng_new() call can be simply destroyed by an unur_urng_free() call. */ int unur_urng_set_sample_array( UNUR_URNG *urng, unsigned int (*samplearray)(void *state, double *X, int dim) ); /* Set function to fill array @var{X} of length @var{dim} with random numbers generated by generator @var{urng} (if available). */ int unur_urng_set_sync( UNUR_URNG *urng, void (*sync)(void *state) ); /* Set function for jumping into a defined state (``sync''). */ int unur_urng_set_seed( UNUR_URNG *urng, void (*setseed)(void *state, unsigned long seed) ); /* Set function to seed generator @var{urng} (if available). */ int unur_urng_set_anti( UNUR_URNG *urng, void (*setanti)(void *state, int anti) ); /* Set function to switch the antithetic flag of generator @var{urng} (if available). */ int unur_urng_set_reset( UNUR_URNG *urng, void (*reset)(void *state) ); /* Set function for reseting the uniform random number generator @var{urng} (if available). */ int unur_urng_set_nextsub( UNUR_URNG *urng, void (*nextsub)(void *state) ); /* Set function that allows jumping to start of the next substream of @var{urng} (if available). */ int unur_urng_set_resetsub( UNUR_URNG *urng, void (*resetsub)(void *state) ); /* Set function that allows jumping to start of the current substream of @var{urng} (if available). */ int unur_urng_set_delete( UNUR_URNG *urng, void (*fpdelete)(void *state) ); /* Set function for destroying @var{urng} (if available). */ /*---------------------------------------------------------------------------*/ #endif /* end defined(UNUR_URNG_UNURAN) */ /*---------------------------------------------------------------------------*/ /* =END */ /*---------------------------------------------------------------------------*/ #endif /* URNG_H_SEEN */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/urng/urng_default.c0000644001357500135600000002310714420445767014442 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: urng_default.c * * * * routines to set, change and get the pointers to the * * UNURAN default uniform random number generators. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include "urng.h" #include #include #include #if defined(UNURAN_HAS_GSL) && defined(UNUR_URNG_UNURAN) # include # include #endif #if defined(UNURAN_HAS_PRNG) && defined(UNUR_URNG_UNURAN) # include #endif #if defined(UNURAN_HAS_RNGSTREAM) && defined(UNUR_URNG_UNURAN) # include #endif /*---------------------------------------------------------------------------*/ /* pointer to default uniform random number generator */ static UNUR_URNG *urng_default = NULL; static UNUR_URNG *urng_aux_default = NULL; /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Main uniform random number generator **/ /** **/ /*****************************************************************************/ UNUR_URNG * unur_get_default_urng( void ) /*----------------------------------------------------------------------*/ /* return default uniform random number generator */ /* (initialize generator if necessary) */ /* */ /* parameters: none */ /* */ /* return: */ /* pointer to default generator */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { /* default generator already running ? */ if( urng_default == NULL ) { /* have to initialize default generator first */ urng_default = UNUR_URNG_DEFAULT; if( urng_default == NULL ) { /* some parameters invalid! */ _unur_error("URNG",UNUR_ERR_NULL,"Cannot set default URNG. EXIT !!!"); #ifndef R_UNURAN /* we cannot recover from this error */ exit(EXIT_FAILURE); #endif /* Remark: When the library is used in R package 'Runuran', */ /* then this case should not happen. */ } } /* return default generator */ return (urng_default); } /* end of unur_get_default_urng() */ /*---------------------------------------------------------------------------*/ UNUR_URNG * unur_set_default_urng( UNUR_URNG *urng_new ) /*----------------------------------------------------------------------*/ /* set default uniform random number generator and return old one */ /* */ /* parameters: pointer to new default uniform random number generator */ /* */ /* return: */ /* pointer to old uniform random number generator */ /*----------------------------------------------------------------------*/ { UNUR_URNG *urng_old = urng_default; /* NULL pointer not allowed */ _unur_check_NULL("URNG", urng_new, urng_default); urng_default = urng_new; /* set urng */ /* return old default generator */ return (urng_old); } /* end of unur_set_default_urng() */ /*****************************************************************************/ /** **/ /** Auxiliary uniform random number generator **/ /** **/ /*****************************************************************************/ UNUR_URNG * unur_get_default_urng_aux( void ) /*----------------------------------------------------------------------*/ /* return default auxilliary uniform random number generator */ /* (initialize generator if necessary) */ /* */ /* parameters: none */ /* */ /* return: */ /* pointer to default auxilliary uniform generator */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { /* default generator already running ? */ if( urng_aux_default == NULL ) { /* have to initialize default generator first */ urng_aux_default = UNUR_URNG_AUX_DEFAULT; if( urng_aux_default == NULL ) { /* some parameters invalid! */ _unur_error("URNG",UNUR_ERR_NULL,"Cannot set default auxilliary URNG. EXIT !!!"); #ifndef R_UNURAN /* we cannot recover from this error */ exit(EXIT_FAILURE); #endif /* Remark: When the library is used in R package 'Runuran', */ /* then this case should not happen. */ } } /* return default generator */ return (urng_aux_default); } /* end of unur_get_default_urng_aux() */ /*---------------------------------------------------------------------------*/ UNUR_URNG * unur_set_default_urng_aux( UNUR_URNG *urng_aux_new ) /*----------------------------------------------------------------------*/ /* set default auxilliary uniform RNG and return old one. */ /* */ /* parameters: pointer to new default auxilliary uniform RNG */ /* */ /* return: */ /* pointer to old auxilliary uniform RNG */ /*----------------------------------------------------------------------*/ { UNUR_URNG *urng_aux_old = urng_aux_default; /* NULL pointer not allowed */ _unur_check_NULL("URNG", urng_aux_new, urng_aux_default); urng_aux_default = urng_aux_new; /* set auxilliary urng */ /* return old default generator */ return (urng_aux_old); } /* end of unur_set_default_urng_aux() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/urng/urng_struct.h0000644001357500135600000001075114420445767014350 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: unur_struct.h * * * * structures used for included uniform random number generators * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ struct unur_urng { double (*sampleunif)(void *state); /* function for generating uniform RNG */ void *state; /* state of the generator */ unsigned int (*samplearray)(void *state, double *X, int dim); /* function for generating array of points */ void (*sync)(void *state); /* jump into defined state ("sync") */ unsigned long seed; /* initial seed of the generator */ void (*setseed)(void *state, unsigned long seed); /* set initial seed of the generator */ void (*reset)(void *state); /* reset object */ void (*nextsub)(void *state); /* skip to next substream */ void (*resetsub)(void *state); /* reset current substream */ void (*anti)(void *state, int a); /* set antithetic flag */ void (*delete)(void *state); /* function for destroying URNG */ #ifdef UNUR_COOKIES unsigned cookie; /* magic cookie */ #endif }; /* Remark: */ /* The 'seed' is used to fill the state variable(s) of a generator with */ /* initial values. For some generators the size of the 'state' is larger */ /* than the size if the 'seed'. In such a case some function is used to */ /* expand the 'seed' to the appropriate size (often this is done with a */ /* LCG (linear congruental generator) with starting state 'seed'; e.g. this */ /* happens for the Mersenne twister). */ /* Often the seed is not stored in the structure for the generator object */ /* (which is stored in 'state'). */ /* Thus we have introduced an additional field 'seed' to store the */ /* starting value. */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/Makefile.am0000644001357500135600000000231114420445767012672 00000000000000## Process this file with automake to produce Makefile.in if HAVE_MINGW no_undefined = -no-undefined else no_undefined = endif SUBDIRS = \ utils \ methods \ specfunct \ distr \ distributions \ parser \ tests \ uniform \ urng \ . DIST_SUBDIRS = $(SUBDIRS) SUBLIBS = \ methods/libmethods.la \ distr/libdistr.la \ distributions/libdistributions.la \ specfunct/libspecfunct.la \ parser/libparser.la \ tests/libtests.la \ uniform/libuniform.la \ urng/liburng.la \ utils/libutils.la lib_LTLIBRARIES = libunuran.la libunuran_la_SOURCES = libunuran_la_LIBADD = $(SUBLIBS) libunuran_la_LDFLAGS = -version-info $(UNURAN_LT_VERSION) $(no_undefined) include_HEADERS = unuran.h noinst_HEADERS = \ unuran_config.h \ unuran.h.in \ unur_cookies.h \ unur_source.h \ unur_struct.h \ unur_typedefs.h # make unuran.h (process file unuran.h.in) sinclude .dep-unuran_h unuran.h: unuran.h.in $(top_srcdir)/scripts/merge_h.pl $(top_srcdir)/src/unuran.h.in > unuran.h sed -e "s#^unuran\.h\:#stringparser\.c\:#" .dep-unuran_h | sed -e "s#\./#\.\./#g" > ./parser/.dep-stringparser_c # clean backup files CLEANFILES = *~ # clean generated files MAINTAINERCLEANFILES = \ Makefile.in \ .dep-unuran_h \ unuran.h unuran-1.11.0/src/distr/0000755001357500135600000000000014430713512012031 500000000000000unuran-1.11.0/src/distr/matr.h0000644001357500135600000001127614420445767013111 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: matr.h * * * * PURPOSE: * * function prototypes for manipulating distribution objects of * * type MATR (matrix distribution) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* =NODEX MATR MATRix distributions =UP Distribution_objects [45] =DESCRIPTION Distributions for random matrices. Notice that UNU.RAN uses arrays of @code{double}s to handle matrices. The rows of the matrix are stored consecutively. =END */ /*---------------------------------------------------------------------------*/ /* Routines for handling matrix distributions (MATR). */ /* =ROUTINES */ UNUR_DISTR *unur_distr_matr_new( int n_rows, int n_cols ); /* Create a new (empty) object for a matrix distribution. @var{n_rows} and @var{n_cols} are the respective numbers of rows and columns of the random matrix (i.e. its dimensions). It is also possible to have only one number or rows and/or columns. Notice, however, that this is treated as a distribution of random matrices with only one row or column or component and not as a distribution of vectors or real numbers. For the latter unur_distr_cont_new() or unur_distr_cvec_new() should be used to create an object for a univariate distribution and a multivariate (vector) distribution, respectively. */ /* ==DOC @subsubheading Essential parameters */ int unur_distr_matr_get_dim( const UNUR_DISTR *distribution, int *n_rows, int *n_cols ); /* Get number of rows and columns of random matrix (its dimension). It returns the total number of components. If successfull @code{UNUR_SUCCESS} is returned. */ /* =END */ /*---------------------------------------------------------------------------*/ /* not implemented: */ /* DOC @subsubheading Derived parameters The following paramters @strong{must} be set whenever one of the essential parameters has been set or changed (and the parameter is required for the chosen method). */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distr/cemp.c0000644001357500135600000006066314420445767013071 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: cemp.c * * * * manipulate empirical univariate continuous distribution objects * * (i.e. samples) * * * * return: * * UNUR_SUCCESS ... on success * * error code ... on error * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include "distr_source.h" #include "distr.h" #include "cemp.h" /*---------------------------------------------------------------------------*/ #define DISTR distr->data.cemp /*---------------------------------------------------------------------------*/ static void _unur_distr_cemp_free( struct unur_distr *distr ); /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** empirical univariate continuous distributions **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_cemp_new( void ) /*----------------------------------------------------------------------*/ /* create a new (empty) distribution object */ /* type: empirical univariate continuous */ /* */ /* parameters: */ /* none */ /* */ /* return: */ /* pointer to distribution object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { register struct unur_distr *distr; /* get empty distribution object */ distr = _unur_distr_generic_new(); if (!distr) return NULL; /* set magic cookie */ COOKIE_SET(distr,CK_DISTR_CEMP); /* set type of distribution */ distr->type = UNUR_DISTR_CEMP; /* set id to generic distribution */ distr->id = UNUR_DISTR_GENERIC; /* dimension of random vector */ distr->dim = 1; /* univariant */ /* name for distribution */ distr->name = "(empirical)"; distr->name_str = NULL; /* destructor */ distr->destroy = _unur_distr_cemp_free; /* clone */ distr->clone = _unur_distr_cemp_clone; /* set defaults */ /* observed sample */ DISTR.sample = NULL; /* sample */ DISTR.n_sample = 0; /* sample size */ /* histogram */ DISTR.n_hist = 0; /* number of bins */ DISTR.hist_prob = NULL; /* probabilities for bins */ DISTR.hist_bins = NULL; /* location of bins */ DISTR.hmin = -UNUR_INFINITY; /* lower ... */ DISTR.hmax = UNUR_INFINITY; /* ... and upper bound */ DISTR.hist_bins = NULL; /* boundary between bins */ /* return pointer to object */ return distr; } /* end of unur_distr_cemp_new() */ /*---------------------------------------------------------------------------*/ struct unur_distr * _unur_distr_cemp_clone( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* copy (clone) distribution object */ /* */ /* parameters: */ /* distr ... pointer to source distribution object */ /* */ /* return: */ /* pointer to clone of distribution object */ /*----------------------------------------------------------------------*/ { #define CLONE clone->data.cemp struct unur_distr *clone; /* check arguments */ _unur_check_NULL( NULL, distr, NULL ); _unur_check_distr_object( distr, CEMP, NULL ); /* allocate memory */ clone = _unur_xmalloc( sizeof(struct unur_distr) ); /* copy distribution object into clone */ memcpy( clone, distr, sizeof( struct unur_distr ) ); /* copy data about sample into generator object (when there is one) */ if (DISTR.sample) { CLONE.sample = _unur_xmalloc( DISTR.n_sample * sizeof(double) ); memcpy( CLONE.sample, DISTR.sample, DISTR.n_sample * sizeof(double) ); } /* copy histogram into generator object (when there is one) */ if (DISTR.hist_prob) { CLONE.hist_prob = _unur_xmalloc( DISTR.n_hist * sizeof(double) ); memcpy( CLONE.hist_prob, DISTR.hist_prob, DISTR.n_hist * sizeof(double) ); } if (DISTR.hist_bins) { CLONE.hist_bins = _unur_xmalloc( (DISTR.n_hist+1) * sizeof(double) ); memcpy( CLONE.hist_bins, DISTR.hist_bins, (DISTR.n_hist+1) * sizeof(double) ); } /* copy user name for distribution */ if (distr->name_str) { size_t len = strlen(distr->name_str) + 1; clone->name_str = _unur_xmalloc(len); memcpy( clone->name_str, distr->name_str, len ); clone->name = clone->name_str; } return clone; #undef CLONE } /* end of _unur_distr_cemp_clone() */ /*---------------------------------------------------------------------------*/ void _unur_distr_cemp_free( struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* free distribution object */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /*----------------------------------------------------------------------*/ { /* check arguments */ if( distr == NULL ) /* nothing to do */ return; COOKIE_CHECK(distr,CK_DISTR_CEMP,RETURN_VOID); if (DISTR.sample) free( DISTR.sample ); if (DISTR.hist_prob) free( DISTR.hist_prob ); if (DISTR.hist_bins) free( DISTR.hist_bins ); if (distr->name_str) free(distr->name_str); COOKIE_CLEAR(distr); free( distr ); } /* end of unur_distr_cemp_free() */ /*---------------------------------------------------------------------------*/ int unur_distr_cemp_set_data( struct unur_distr *distr, const double *sample, int n_sample ) /*----------------------------------------------------------------------*/ /* set observed sample for distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* sample ... pointer to array of observations */ /* n_sample ... number of observations (sample size) */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CEMP, UNUR_ERR_DISTR_INVALID ); _unur_check_NULL( distr->name, sample, UNUR_ERR_NULL ); /* check new parameter for generator */ if (n_sample <= 0) { _unur_error(NULL,UNUR_ERR_DISTR_SET,"sample size"); return UNUR_ERR_DISTR_SET; } /* allocate memory for sample */ DISTR.sample = _unur_xmalloc( n_sample * sizeof(double) ); if (!DISTR.sample) return UNUR_ERR_MALLOC; /* copy observed sample */ memcpy( DISTR.sample, sample, n_sample * sizeof(double) ); DISTR.n_sample = n_sample; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_distr_cemp_set_data() */ /*---------------------------------------------------------------------------*/ int unur_distr_cemp_read_data( struct unur_distr *distr, const char *filename ) /*----------------------------------------------------------------------*/ /* Read data from file `filename'. */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* filename ... name of data file */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CEMP, UNUR_ERR_DISTR_INVALID ); /* read data from file */ DISTR.n_sample = _unur_read_data( filename, 1, &(DISTR.sample) ); /* o.k. ? */ return (DISTR.n_sample > 0) ? UNUR_SUCCESS : UNUR_ERR_DISTR_DATA; } /* end of unur_distr_cemp_read_data() */ /*---------------------------------------------------------------------------*/ int unur_distr_cemp_get_data( const struct unur_distr *distr, const double **sample ) /*----------------------------------------------------------------------*/ /* get number of observations and set pointer to array observations */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* sample ... pointer to observed sampletor */ /* */ /* return: */ /* sample size */ /* */ /* error: */ /* return 0 */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, 0 ); _unur_check_distr_object( distr, CEMP, 0 ); *sample = (DISTR.sample) ? DISTR.sample : NULL; return DISTR.n_sample; } /* end of unur_distr_cemp_get_data() */ /*---------------------------------------------------------------------------*/ int unur_distr_cemp_set_hist( struct unur_distr *distr, const double *prob, int n_prob, double xmin, double xmax ) /*----------------------------------------------------------------------*/ /* set histogram with bins of equal width for distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* prob ... pointer to array of distributions */ /* n_prob ... number of bins */ /* xmin ... lower bound of histogram */ /* xmax ... upper bound of histogram */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int rcode; if ((rcode = unur_distr_cemp_set_hist_domain(distr, xmin, xmax)) != UNUR_SUCCESS) return rcode; if ((rcode = unur_distr_cemp_set_hist_prob(distr, prob, n_prob)) != UNUR_SUCCESS) { distr->set &= ~UNUR_DISTR_SET_DOMAIN; return rcode; } /* Remark: order of set calls is important (otherwise it might be possible */ /* that the function is only computed partially. */ /* o.k. */ return UNUR_SUCCESS; } /* end of unur_distr_cemp_set_hist() */ /*---------------------------------------------------------------------------*/ int unur_distr_cemp_set_hist_prob( struct unur_distr *distr, const double *prob, int n_prob ) /*----------------------------------------------------------------------*/ /* set probabilities of bins of histogram */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* prob ... pointer to array of distributions */ /* n_prob ... number of bins */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CEMP, UNUR_ERR_DISTR_INVALID ); _unur_check_NULL( distr->name, prob, UNUR_ERR_NULL ); /* check new parameter for generator */ if (n_prob <= 0) { _unur_error(NULL,UNUR_ERR_DISTR_SET,"histogram size"); return UNUR_ERR_DISTR_SET; } /* allocate memory for hist */ DISTR.hist_prob = _unur_xmalloc( n_prob * sizeof(double) ); if (!DISTR.hist_prob) return UNUR_ERR_MALLOC; /* copy probabilities */ memcpy( DISTR.hist_prob, prob, n_prob * sizeof(double) ); DISTR.n_hist = n_prob; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_distr_cemp_set_hist_prob() */ /*---------------------------------------------------------------------------*/ int unur_distr_cemp_set_hist_domain( struct unur_distr *distr, double xmin, double xmax ) /*----------------------------------------------------------------------*/ /* set domain of histogram with bins of equal width */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* xmin ... lower bound of histogram */ /* xmax ... upper bound of histogram */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CEMP, UNUR_ERR_DISTR_INVALID ); /* check new parameter for generator */ if (xmin >= xmax) { _unur_error(NULL,UNUR_ERR_DISTR_SET,"histogram, min >= max"); return UNUR_ERR_DISTR_SET; } if (!_unur_isfinite(xmin) || !_unur_isfinite(xmax)) { _unur_error(NULL,UNUR_ERR_DISTR_SET,"histogram, unbounded domain"); return UNUR_ERR_DISTR_SET; } /* store boundaries of histogram */ DISTR.hmin = xmin; DISTR.hmax = xmax; /* changelog */ distr->set |= UNUR_DISTR_SET_DOMAIN; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_distr_cemp_set_hist_domain() */ /*---------------------------------------------------------------------------*/ int unur_distr_cemp_set_hist_bins( struct unur_distr *distr, const double *bins, int n_bins ) /*----------------------------------------------------------------------*/ /* set locations of bins of histogram */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* bins ... pointer to array of boundaries between bins */ /* n_bins ... number of bins */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int i; /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CEMP, UNUR_ERR_DISTR_INVALID ); _unur_check_NULL( distr->name, bins, UNUR_ERR_NULL ); /* check whether probabilities for bins are already set */ if (DISTR.hist_prob == NULL) { _unur_error(NULL,UNUR_ERR_DISTR_SET,"probabilities of histogram not set"); return UNUR_ERR_DISTR_SET; } /* check new parameter for generator */ if (n_bins != (DISTR.n_hist+1)) { _unur_error(NULL,UNUR_ERR_DISTR_SET,"histogram size"); return UNUR_ERR_DISTR_SET; } /* boundary points must be strictly monontonically increasing */ for( i=1; iname,UNUR_ERR_DISTR_SET,"bins not strictly increasing"); return UNUR_ERR_DISTR_SET; } /* set boundary */ if (unur_distr_cemp_set_hist_domain(distr, bins[0], bins[n_bins-1]) != UNUR_SUCCESS) return UNUR_ERR_DISTR_SET; /* allocate memory for bins */ DISTR.hist_bins = _unur_xmalloc( n_bins * sizeof(double) ); if (!DISTR.hist_bins) return UNUR_ERR_MALLOC; /* copy bins */ memcpy( DISTR.hist_bins, bins, n_bins * sizeof(double) ); /* changelog */ distr->set |= UNUR_DISTR_SET_DOMAIN; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_distr_cemp_set_hist_bins() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ void _unur_distr_cemp_debug( const struct unur_distr *distr, const char *genid, unsigned printvector ) /*----------------------------------------------------------------------*/ /* write info about distribution into LOG file */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* genid ... pointer to generator id */ /* printvector ... print observed sample if not 0 */ /*----------------------------------------------------------------------*/ { FILE *LOG; int i; /* check arguments */ CHECK_NULL(distr,RETURN_VOID); COOKIE_CHECK(distr,CK_DISTR_CEMP,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s: distribution:\n",genid); fprintf(LOG,"%s:\ttype = continuous univariate distribution (ie. a sample)\n",genid); fprintf(LOG,"%s:\tname = %s\n",genid,distr->name); if (DISTR.n_sample>0) { /* observed samples */ fprintf(LOG,"%s:\tsample size = %d",genid,DISTR.n_sample); if (printvector) { for (i=0; i0) { /* histogram */ fprintf(LOG,"%s:\thistogram: #bins = %d, ",genid,DISTR.n_hist); fprintf(LOG,"min = %g, max = %g", DISTR.hmin, DISTR.hmax); if (DISTR.hist_bins) { fprintf(LOG," (bins with different width)\n"); if (printvector) { fprintf(LOG,"%s:\t> bins (breaks) = ",genid); for (i=0; i<=DISTR.n_hist; i++) { if (i%10 == 0) fprintf(LOG,"\n%s:\t",genid); fprintf(LOG," %.5f",DISTR.hist_bins[i]); } fprintf(LOG,"\n%s:\n",genid); } } else { fprintf(LOG,", width = %g (equally spaced)\n", (DISTR.hmax-DISTR.hmin)/DISTR.n_hist); } if (printvector) { fprintf(LOG,"%s:\t> bin probabilities = ",genid); for (i=0; i #include #include "distr.h" #include "cont.h" #include "corder.h" #include "distr_source.h" /*---------------------------------------------------------------------------*/ static const char distr_name[] = "order statistics"; /*---------------------------------------------------------------------------*/ #define DISTR distr->data.cont /* underlying (base) distribution */ #define OS os->data.cont /* order statistics */ #define LOGNORMCONSTANT (os->data.cont.norm_constant) /*---------------------------------------------------------------------------*/ /* function prototypes */ static double _unur_pdf_corder( double x, const struct unur_distr *os ); static double _unur_dpdf_corder( double x, const struct unur_distr *os ); static double _unur_cdf_corder( double x, const struct unur_distr *os ); static int _unur_upd_area_corder( struct unur_distr *os ); /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** univariate continuous order statistics **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_corder_new( const struct unur_distr *distr, int n, int k ) /*----------------------------------------------------------------------*/ /* Create an object for order statistics of for a */ /* sample size n and rank k. */ /* `distr' must be a pointer to a univariate continuous distribution. */ /* */ /* parameters: */ /* distr ... pointer to univariate continuous distribution. */ /* n ... sample size */ /* k ... rank */ /* */ /* return: */ /* pointer to distribution object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_distr *os; /* check arguments */ _unur_check_NULL( distr_name,distr,NULL ); /* check distribution */ if (distr->type != UNUR_DISTR_CONT) { _unur_error(distr_name,UNUR_ERR_DISTR_INVALID,""); return NULL; } COOKIE_CHECK(distr,CK_DISTR_CONT,NULL); if (distr->id == UNUR_DISTR_CORDER) { _unur_error(distr_name,UNUR_ERR_DISTR_INVALID,"No order statistics of order statistics allowed"); return NULL; } /* check parameters n and k */ if (n < 2 || k < 1 || k > n) { _unur_error(distr_name,UNUR_ERR_DISTR_INVALID,"n < 2 or k < 1 or k > n"); return NULL; } /* get distribution object for generic continuous univariate distribution */ os = unur_distr_cont_new(); if (!os) return NULL; /* set id to distribution of order statistics */ os->id = UNUR_DISTR_CORDER; /* name of distribution */ os->name = distr_name; /* this is a derived distribution */ /* clone base distribution ... */ os->base = _unur_distr_cont_clone( distr ); if (!os->base) { free(os); return NULL; } /* set parameters for order statistics */ OS.n_params = 2; /* two parameters: n and k */ OS.params[0] = (double) n; OS.params[1] = (double) k; /* copy data */ OS.area = DISTR.area; /* area below PDF (same as for distr) */ OS.trunc[0] = OS.domain[0] = DISTR.domain[0]; /* left boundary of domain */ OS.trunc[1] = OS.domain[1] = DISTR.domain[1]; /* right boundary of domain */ /* pointer to PDF, its derivative, and CDF */ if (DISTR.cdf) { OS.cdf = _unur_cdf_corder; /* pointer to CDF */ if (DISTR.pdf) { OS.pdf = _unur_pdf_corder; /* pointer to PDF */ if (DISTR.dpdf) OS.dpdf = _unur_dpdf_corder; /* derivative of PDF */ } } /* there is no necessity for a function that computes the area below PDF */ OS.upd_area = _unur_upd_area_corder; /* parameters set */ os->set = distr->set & ~UNUR_DISTR_SET_MODE; /* mode not derived from distr */ /* log of normalization constant */ if (_unur_upd_area_corder(os)==UNUR_SUCCESS) os->set |= UNUR_DISTR_SET_PDFAREA; /* return pointer to object */ return os; } /* end of unur_distr_corder_new() */ /*---------------------------------------------------------------------------*/ const struct unur_distr * unur_distr_corder_get_distribution( const struct unur_distr *os ) /*----------------------------------------------------------------------*/ /* get pointer to distribution object for underlying distribution */ /* */ /* parameters: */ /* os ... pointer to order statistics */ /* */ /* return: */ /* pointer to underlying distribution */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( distr_name, os, NULL ); _unur_check_distr_object( os, CONT, NULL ); /* check distribution */ if (os->id != UNUR_DISTR_CORDER) { _unur_warning(distr_name,UNUR_ERR_DISTR_INVALID,""); return NULL; } return os->base; } /* end of unur_distr_corder_get_distribution() */ /*---------------------------------------------------------------------------*/ int unur_distr_corder_set_rank( struct unur_distr *os, int n, int k ) /*----------------------------------------------------------------------*/ /* change sample size n and rank k of order statistics. */ /* */ /* parameters: */ /* os ... pointer to order statistics */ /* n ... sample size */ /* k ... rank */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( distr_name, os, UNUR_ERR_NULL ); _unur_check_distr_object( os, CONT, UNUR_ERR_DISTR_INVALID ); /* check distribution */ if (os->id != UNUR_DISTR_CORDER) { _unur_error(distr_name,UNUR_ERR_DISTR_INVALID,""); return UNUR_ERR_DISTR_INVALID; } COOKIE_CHECK(os,CK_DISTR_CONT,UNUR_ERR_COOKIE); /* check parameters n and k */ if (n < 2 || k < 1 || k > n) { _unur_error(distr_name,UNUR_ERR_DISTR_SET,"n < 2 or k < 1 or k > n"); return UNUR_ERR_DISTR_SET; } /* changelog */ os->set &= ~UNUR_DISTR_SET_MODE; /* mode unknown */ /* copy parameters */ OS.params[0] = (double) n; OS.params[1] = (double) k; /* log of normalization constant */ _unur_upd_area_corder(os); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_distr_corder_set_rank() */ /*---------------------------------------------------------------------------*/ int unur_distr_corder_get_rank( const struct unur_distr *os, int *n, int *k ) /*----------------------------------------------------------------------*/ /* get sample size n and rank k of order statistics. */ /* */ /* parameters: */ /* os ... pointer to order statistics */ /* n ... sample size */ /* k ... rank */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( distr_name, os, UNUR_ERR_NULL ); _unur_check_distr_object( os, CONT, UNUR_ERR_DISTR_INVALID ); /* check distribution */ if (os->id != UNUR_DISTR_CORDER) { _unur_error(distr_name,UNUR_ERR_DISTR_INVALID,""); return UNUR_ERR_DISTR_INVALID; } COOKIE_CHECK(os,CK_DISTR_CONT,UNUR_ERR_COOKIE); /* copy parameters */ *n = (int)(OS.params[0] + 0.5); *k = (int)(OS.params[1] + 0.5); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_distr_corder_get_rank() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** PDF, its derivative and CDF of order statistics **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ double _unur_pdf_corder( double x, const struct unur_distr *os ) /* PDF(x) = b(F(x)) * f(x) b(.) ... PDF of beta(k,n-k+1) distribution f(.) ... PDF of underlying distribution F(.) ... CDF of underlying distribution */ { double Fx; /* CDF of underlying distribution at x */ double fx; /* PDF of underlying distribution at x */ double p,q; /* shape parameters for beta distribution */ /* check arguments */ _unur_check_NULL( NULL, os, UNUR_INFINITY ); _unur_check_distr_object( os, CONT, UNUR_INFINITY ); CHECK_NULL( os->base, UNUR_INFINITY ); _unur_check_distr_object( os->base, CONT, UNUR_INFINITY ); CHECK_NULL( os->base->data.cont.cdf, UNUR_INFINITY ); CHECK_NULL( os->base->data.cont.pdf, UNUR_INFINITY ); Fx = (*(os->base->data.cont.cdf)) (x, os->base); fx = (*(os->base->data.cont.pdf)) (x, os->base); p = OS.params[1]; /* k */ q = OS.params[0] - OS.params[1] + 1.; /* n-k+1 */ /* PDF(x) = b(F(x)) * f(x) */ if (fx <= 0. || Fx <= 0. || Fx >= 1.) return 0.; else return exp(log(fx) + (p-1.)*log(Fx) + (q-1.)*log(1.-Fx) - LOGNORMCONSTANT); } /* end of _unur_pdf_corder() */ /*---------------------------------------------------------------------------*/ double _unur_dpdf_corder( double x, const struct unur_distr *os ) /* PDF'(x) = b'(F(x)) * f(x)^2 + b(F(x)) * f'(x) b(.) ... PDF of beta(k,n-k+1) distribution f(.) ... PDF of underlying distribution F(.) ... CDF of underlying distribution */ { double Fx; /* CDF of underlying distribution at x */ double fx; /* PDF of underlying distribution at x */ double dfx; /* derivative of PDF of underlying distribution at x */ double p,q; /* shape parameters for beta distribution */ double dpdf; /* derivative of PDF of order statistics */ double lFx, lFy; /* check arguments */ _unur_check_NULL( NULL, os, UNUR_INFINITY ); _unur_check_distr_object( os, CONT, UNUR_INFINITY ); CHECK_NULL( os->base, UNUR_INFINITY ); _unur_check_distr_object( os->base, CONT, UNUR_INFINITY ); CHECK_NULL( os->base->data.cont.cdf, UNUR_INFINITY ); CHECK_NULL( os->base->data.cont.pdf, UNUR_INFINITY ); CHECK_NULL( os->base->data.cont.dpdf, UNUR_INFINITY ); Fx = (*(os->base->data.cont.cdf)) (x, os->base); fx = (*(os->base->data.cont.pdf)) (x, os->base); dfx = (*(os->base->data.cont.dpdf)) (x, os->base); p = OS.params[1]; /* k */ q = OS.params[0] - OS.params[1] + 1.; /* n-k+1 */ if (fx <= 0. || Fx <= 0. || Fx >= 1.) return 0.; /* else */ lFx = log(Fx); lFy = log(1.-Fx); /* PDF'(x) = b'(F(x)) * f(x)^2 + b(F(x)) * f'(x) */ dpdf = ( exp(2.*log(fx) + (p-2.)*lFx + (q-2.)*lFy - LOGNORMCONSTANT) * ( (p-1.)*(1.-Fx) - (q-1.)*Fx )); dpdf += exp((p-1.)*lFx + (q-1.)*lFy - LOGNORMCONSTANT) * dfx; return dpdf; } /* end of _unur_dpdf_corder() */ /*---------------------------------------------------------------------------*/ double _unur_cdf_corder( double x, const struct unur_distr *os ) /* CDF(x) = B(F(x)) B(.) ... CDF of beta(k,n-k+1) distribution F(.) ... CDF of underlying distribution */ { double Fx; /* CDF of underlying distribution at x */ double p,q; /* shape parameters for beta distribution */ /* check arguments */ _unur_check_NULL( NULL, os, UNUR_INFINITY ); _unur_check_distr_object( os, CONT, UNUR_INFINITY ); CHECK_NULL( os->base, UNUR_INFINITY ); _unur_check_distr_object( os->base, CONT, UNUR_INFINITY ); CHECK_NULL( os->base->data.cont.cdf, UNUR_INFINITY ); Fx = (*(os->base->data.cont.cdf)) (x, os->base); p = OS.params[1]; /* k */ q = OS.params[0] - OS.params[1] + 1.; /* n-k+1 */ /* CDF(x) = B(F(x)) */ return _unur_SF_incomplete_beta(Fx,p,q); } /* end of _unur_cdf_corder() */ /*---------------------------------------------------------------------------*/ int _unur_upd_area_corder( UNUR_DISTR *os ) { /* log of normalization constant */ /* LOGNORMCONSTANT = _unur_SF_ln_gamma(k) + _unur_SF_ln_gamma(n-k+1) - _unur_SF_ln_gamma(n+1); */ LOGNORMCONSTANT = ( _unur_SF_ln_gamma(OS.params[1]) + _unur_SF_ln_gamma(OS.params[0] - OS.params[1] + 1.) - _unur_SF_ln_gamma(OS.params[0] + 1.) ); /* we assume that the PDF is the derivative of the given CDF ! */ /* standard distribution --> nothing to do */ if (!(os->set & UNUR_DISTR_SET_STDDOMAIN)) { /* truncated distributions */ if (OS.cdf == NULL) /* no CDF */ return UNUR_ERR_DISTR_REQUIRED; OS.area = (OS.domain[1] < UNUR_INFINITY) ? _unur_cdf_corder(OS.domain[1],os) : 1.; OS.area -= (OS.domain[0] > -UNUR_INFINITY) ? _unur_cdf_corder(OS.domain[0],os) : 0.; } return (OS.area > 0.) ? UNUR_SUCCESS : UNUR_ERR_DISTR_DATA; } /* end of _unur_upd_area_corder() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** debug **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ void _unur_distr_corder_debug( const struct unur_distr *os, const char *genid ) /*----------------------------------------------------------------------*/ /* write info about distribution into LOG file */ /* */ /* parameters: */ /* os ... pointer to order statistics */ /* genid ... pointer to generator id */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(os,RETURN_VOID); COOKIE_CHECK(os,CK_DISTR_CONT,RETURN_VOID); CHECK_NULL(os->base,RETURN_VOID); LOG = unur_get_stream(); /* print data about order statistics */ fprintf(LOG,"%s: distribution:\n",genid); fprintf(LOG,"%s:\ttype = order statistics of continuous univariate distribution\n",genid); fprintf(LOG,"%s:\tname = %s\n",genid,os->name); fprintf(LOG,"%s:\tsample size\tn = %d\n",genid,(int)(OS.params[0]+0.5)); fprintf(LOG,"%s:\trank\t\tk = %d\n",genid,(int)(OS.params[1]+0.5)); fprintf(LOG,"%s:\n",genid); if (os->set & UNUR_DISTR_SET_MODE) fprintf(LOG,"%s:\tmode = %g\n",genid,OS.mode); else fprintf(LOG,"%s:\tmode unknown\n",genid); fprintf(LOG,"%s:\tdomain = (%g, %g)",genid,OS.domain[0],OS.domain[1]); _unur_print_if_default(os,UNUR_DISTR_SET_DOMAIN); fprintf(LOG,"\n%s:\tarea below PDF = %g",genid,OS.area); _unur_print_if_default(os,UNUR_DISTR_SET_PDFAREA); fprintf(LOG,"\n%s:\n",genid); /* print data about underlying distribution */ fprintf(LOG,"%s: Underlying distribution:\n",genid); _unur_distr_cont_debug(os->base, genid); } /* end of _unur_distr_corder_debug() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distr/distr_struct.h0000644001357500135600000003264414420445767014701 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: distr_struct.h * * * * PURPOSE: * * declares structures for distributions * * * * USAGE: * * only included in unur_struct.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* define object for univariate continuous distribution */ struct unur_distr_cont { UNUR_FUNCT_CONT *pdf; /* pointer to PDF */ UNUR_FUNCT_CONT *dpdf; /* pointer to derivative of PDF */ UNUR_FUNCT_CONT *cdf; /* pointer to CDF */ UNUR_FUNCT_CONT *invcdf; /* pointer to inverse of CDF */ UNUR_FUNCT_CONT *logpdf; /* pointer to logPDF */ UNUR_FUNCT_CONT *dlogpdf; /* pointer to derivative of logPDF */ UNUR_FUNCT_CONT *logcdf; /* pointer to logCDF */ UNUR_FUNCT_CONT *hr; /* pointer to hazard rate */ double norm_constant; /* (log of) normalization constant for PDF */ double params[UNUR_DISTR_MAXPARAMS]; /* parameters of the PDF */ int n_params; /* number of parameters of the PDF */ double *param_vecs[UNUR_DISTR_MAXPARAMS]; /* parameter vectors */ int n_param_vec[UNUR_DISTR_MAXPARAMS]; /* lengths of the parameter vecs */ double mode; /* location of mode */ double center; /* location of center */ double area; /* area below PDF */ double domain[2]; /* boundary of domain */ double trunc[2]; /* boundary of truncated domain */ struct ftreenode *pdftree; /* pointer to function tree for PDF */ struct ftreenode *dpdftree; /* pointer to function tree for dPDF */ struct ftreenode *logpdftree; /* pointer to function tree for logPDF */ struct ftreenode *dlogpdftree;/* pointer to function tree for dlogPDF */ struct ftreenode *cdftree; /* pointer to function tree for CDF */ struct ftreenode *logcdftree; /* pointer to function tree for logCDF */ struct ftreenode *hrtree; /* pointer to function tree for hazard rate */ int (*set_params)(struct unur_distr *distr, const double *params, int n_params ); /* function for setting parameters and domain*/ int (*upd_mode)(struct unur_distr *distr); /* function for computing mode */ int (*upd_area)(struct unur_distr *distr); /* function for computing area */ int (*init)(struct unur_par *par,struct unur_gen *gen); /* pointer to special init routine */ }; /*---------------------------------------------------------------------------*/ /* define object for multivariate continuous distribution */ struct unur_distr_cvec { UNUR_FUNCT_CVEC *pdf; /* pointer to PDF */ UNUR_VFUNCT_CVEC *dpdf; /* pointer to gradient of PDF */ UNUR_FUNCTD_CVEC *pdpdf; /* pointer to partial derivative of PDF */ UNUR_FUNCT_CVEC *logpdf; /* pointer to logPDF */ UNUR_VFUNCT_CVEC *dlogpdf; /* pointer to gradient of logPDF */ UNUR_FUNCTD_CVEC *pdlogpdf; /* pointer to partial derivative of logPDF */ double *mean; /* mean vector of distribution */ double *covar; /* covariance matrix of distribution */ double *cholesky; /* cholesky factor of covariance matrix */ double *covar_inv; /* inverse of covariance matrix */ double *rankcorr; /* rank correlation matrix */ double *rk_cholesky; /* cholesky factor of rank corr. matrix */ struct unur_distr **marginals; /* array of pointers to marginal distributions */ double params[UNUR_DISTR_MAXPARAMS]; /* parameters of the PDF */ int n_params; /* number of parameters of the PDF */ double *param_vecs[UNUR_DISTR_MAXPARAMS]; /* parameter vectors */ int n_param_vec[UNUR_DISTR_MAXPARAMS]; /* lengths of the parameter vecs */ double norm_constant; /* (log of) normalization constant for PDF */ double *mode; /* location of mode */ double *center; /* location of center */ double volume; /* volume below PDF */ double *domainrect; /* (rectangular) domain of domain: the lower left and the upper right vertices are stored componentwise, i.e. l[0], r[0], l[1], r[1], l[2], r[2], ... */ #ifdef USE_DEPRECATED_CODE struct unur_distr **stdmarginals; /* array of pointers to standardized marginal distributions */ #endif int (*upd_mode)(struct unur_distr *distr); /* function for computing mode */ int (*upd_volume)(struct unur_distr *distr); /* function for computing volume */ int (*init)(struct unur_gen *gen); /* pointer to special init routine */ }; /*---------------------------------------------------------------------------*/ /* define object for univariate discrete distribution */ struct unur_distr_discr { /* (finite) probability vector */ double *pv; /* pointer to probability vector */ int n_pv; /* length of probability vector */ /* probability mass function */ UNUR_FUNCT_DISCR *pmf; /* pointer to probability mass function */ UNUR_FUNCT_DISCR *cdf; /* pointer to CDF */ UNUR_IFUNCT_DISCR *invcdf; /* pointer to inverse of CDF */ double params[UNUR_DISTR_MAXPARAMS]; /* parameters of the PMF */ int n_params; /* number of parameters of the PMF */ double norm_constant; /* (log of) normalization constant for PMF */ int mode; /* location of mode */ double sum; /* sum over PMF */ int (*set_params)(struct unur_distr *distr, const double *params, int n_params ); /* function for setting parameters and domain*/ int (*upd_mode)(struct unur_distr *distr); /* function for computing mode */ int (*upd_sum)(struct unur_distr *distr); /* function for computing sum */ /* other parameters */ int domain[2]; /* boundary of domain */ int trunc[2]; /* boundary of truncated domain */ /** trunc[] not supported yet **/ struct ftreenode *pmftree; /* pointer to function tree for PMF */ struct ftreenode *cdftree; /* pointer to function tree for CDF */ int (*init)(struct unur_par *par,struct unur_gen *gen); /* pointer to special init routine */ }; /*---------------------------------------------------------------------------*/ /* define object for empirical univariate constinuous distribution */ /* (given by empirical sample) */ struct unur_distr_cemp { /* raw data */ int n_sample; /* length of sample probability vector */ double *sample; /* pointer to sample */ /* histogram */ int n_hist; /* number of bins in histogram */ double *hist_prob; /* probabilities for bins */ double hmin, hmax; /* lower and upper bound for histograms with bins of equal length */ double *hist_bins; /* boundary between bins (of different length) */ }; /*---------------------------------------------------------------------------*/ /* define object for empirical mulitvariate constinuous distribution */ /* (given by empirical sample) */ struct unur_distr_cvemp { double *sample; /* pointer to sample */ int n_sample; /* length of sample probability vector */ }; /*---------------------------------------------------------------------------*/ /* define object for matrix distribution */ struct unur_distr_matr { int n_rows; /* number of rows */ int n_cols; /* number of columns */ int (*init)(struct unur_par *par,struct unur_gen *gen); /* pointer to special init routine */ }; /*---------------------------------------------------------------------------*/ /* define distribution object */ struct unur_distr { union { struct unur_distr_cont cont; /* univariate continuous distribution */ struct unur_distr_matr matr; /* matrix distribution */ struct unur_distr_cvec cvec; /* multivariate continuous distribution */ struct unur_distr_discr discr; /* univariate discrete distribution */ struct unur_distr_cemp cemp; /* empirical univ. cont. distr. (sample) */ struct unur_distr_cvemp cvemp; /* empir. multiv. cont. distr. (sample) */ } data; /* data for distribution */ unsigned type; /* type of distribution */ unsigned id; /* identifier for distribution */ const char *name; /* name of distribution */ char *name_str; /* string for storing user name of distr */ int dim; /* number of components of random vector */ unsigned set; /* indicate changed parameters */ const void *extobj; /* pointer to an object for additional data */ struct unur_distr *base; /* pointer to distribution object for derived distribution (e.g. order statistics) */ void (*destroy)(struct unur_distr *distr); /* pointer to destructor */ struct unur_distr* (*clone)(const struct unur_distr *distr ); /* clone */ #ifdef UNUR_COOKIES unsigned cookie; /* magic cookie */ #endif }; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distr/distr_source.h0000644001357500135600000003422314420445767014650 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: distr_source.h * * * * PURPOSE: * * defines macros and function prototypes for handling * * distribution objects. * * * * USAGE: * * only included in source_unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifndef UNUR_DISTR_SOURCE_H_SEEN #define UNUR_DISTR_SOURCE_H_SEEN /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* indicate changed parameters */ /* essential parameters */ #define UNUR_DISTR_SET_MASK_ESSENTIAL 0xffff0000u #define UNUR_DISTR_SET_DOMAIN 0x00010000u #define UNUR_DISTR_SET_DOMAINBOUNDED 0x00020000u /* domain is bounded */ #define UNUR_DISTR_SET_STDDOMAIN 0x00040000u /* domain not truncated (for standard distributions) */ #define UNUR_DISTR_SET_TRUNCATED 0x00080000u /* truncated distribution, i.e. the domain of the distribution has been restricted AFTER initializing the generator object */ #define UNUR_DISTR_SET_MEAN 0x01000000u /* mean (vector for multivariate distr.) */ #define UNUR_DISTR_SET_COVAR 0x02000000u /* covariance matrix (for multivar. distr.) */ #define UNUR_DISTR_SET_COVAR_INV 0x04000000u /* inverse of covariance matrix (for multivar. distr.) */ #define UNUR_DISTR_SET_COVAR_IDENT 0x40000000u /* covariance matrix is identity matrix */ #define UNUR_DISTR_SET_CHOLESKY 0x08000000u /* cholesky factor of covariance matrix (for multivar. distr.) */ #define UNUR_DISTR_SET_RANKCORR 0x10000000u /* rank-correlation (for multivar. distr.) */ #define UNUR_DISTR_SET_RK_CHOLESKY 0x20000000u /* cholesky factor of covariance matrix (for multivar. distr.) */ #define UNUR_DISTR_SET_STDMARGINAL 0x00100000u /* standardized marginal distribution (for multivar. distr.) */ #define UNUR_DISTR_SET_MARGINAL 0x00200000u /* marginal distribution (for multivar. distr.) */ #define UNUR_DISTR_SET_GENERIC 0x00080000u /* generic parameter (can be used for any purpose) */ /* derived parameters */ #define UNUR_DISTR_SET_MASK_DERIVED 0x0000ffffu #define UNUR_DISTR_SET_MODE 0x00000001u #define UNUR_DISTR_SET_MODE_APPROX 0x00000020u /* flag for approximate computation of mode */ #define UNUR_DISTR_SET_CENTER 0x00000002u #define UNUR_DISTR_SET_CENTER_APPROX 0x00000040u /* flag for approximate computation of center */ #define UNUR_DISTR_SET_PDFAREA 0x00000004u #define UNUR_DISTR_SET_PMFSUM 0x00000008u #define UNUR_DISTR_SET_PDFVOLUME 0x00000010u /*---------------------------------------------------------------------------*/ /* call PDFs and CDFs */ /* (no checking for NULL pointer !) */ #define _unur_cont_PDF(x,distr) ((*((distr)->data.cont.pdf)) ((x),(distr))) #define _unur_cont_dPDF(x,distr) ((*((distr)->data.cont.dpdf))((x),(distr))) #define _unur_cont_logPDF(x,distr) ((*((distr)->data.cont.logpdf)) ((x),(distr))) #define _unur_cont_dlogPDF(x,distr) ((*((distr)->data.cont.dlogpdf))((x),(distr))) #define _unur_cont_CDF(x,distr) ((*((distr)->data.cont.cdf)) ((x),(distr))) #define _unur_cont_logCDF(x,distr) ((*((distr)->data.cont.logcdf)) ((x),(distr))) #define _unur_cont_invCDF(u,distr) ((*((distr)->data.cont.invcdf)) ((u),(distr))) #define _unur_cont_HR(x,distr) ((*((distr)->data.cont.hr)) ((x),(distr))) #define _unur_discr_PMF(x,distr) ((*((distr)->data.discr.pmf))((x),(distr))) #define _unur_discr_CDF(x,distr) ((*((distr)->data.discr.cdf))((x),(distr))) #define _unur_discr_invCDF(u,distr) ((int) (*((distr)->data.discr.invcdf)) ((u),(distr))) /* #define _unur_cvec_PDF(x,distr) ((*((distr)->data.cvec.pdf)) ((x),(distr))) */ /* #define _unur_cvec_dPDF(r,x,distr) ((*((distr)->data.cvec.dpdf)) ((r),(x),(distr))) */ /* #define _unur_cvec_pdPDF(x,c,distr) ((*((distr)->data.cvec.pdpdf)) ((x),(c),(distr))) */ /* #define _unur_cvec_logPDF(x,distr) ((*((distr)->data.cvec.logpdf)) ((x),(distr))) */ /* #define _unur_cvec_dlogPDF(r,x,distr) ((*((distr)->data.cvec.dlogpdf)) ((r),(x),(distr))) */ /* #define _unur_cvec_pdlogPDF(x,c,distr) ((*((distr)->data.cvec.pdlogpdf)) ((x),(c),(distr))) */ double _unur_cvec_PDF(const double *x, struct unur_distr *distr); int _unur_cvec_dPDF(double *result, const double *x, struct unur_distr *distr); double _unur_cvec_pdPDF(const double *x, int coord, struct unur_distr *distr); double _unur_cvec_logPDF(const double *x, struct unur_distr *distr); int _unur_cvec_dlogPDF(double *result, const double *x, struct unur_distr *distr); double _unur_cvec_pdlogPDF(const double *x, int coord, struct unur_distr *distr); /*---------------------------------------------------------------------------*/ /* check for existance of function pointers */ #define _unur_cont_have_logPDF(distr) (((distr)->data.cont.logpdf==NULL)?FALSE:TRUE) #define _unur_cont_have_dlogPDF(distr) (((distr)->data.cont.dlogpdf==NULL)?FALSE:TRUE) /*---------------------------------------------------------------------------*/ /* wrapper functions for PDF when only logPDF is given */ double _unur_distr_cont_eval_pdf_from_logpdf( double x, const struct unur_distr *distr ); double _unur_distr_cont_eval_dpdf_from_dlogpdf( double x, const struct unur_distr *distr ); double _unur_distr_cont_eval_cdf_from_logcdf( double x, const struct unur_distr *distr ); double _unur_distr_cvec_eval_pdf_from_logpdf( const double *x, struct unur_distr *distr ); int _unur_distr_cvec_eval_dpdf_from_dlogpdf( double *result, const double *x, struct unur_distr *distr ); double _unur_distr_cvec_eval_pdpdf_from_pdlogpdf( const double *x, int coord, struct unur_distr *distr ); /*---------------------------------------------------------------------------*/ /* generic creator for distribution objects */ struct unur_distr *_unur_distr_generic_new( void ); /*---------------------------------------------------------------------------*/ /* make clone of distribution objects */ struct unur_distr *_unur_distr_cemp_clone ( const struct unur_distr *distr ); struct unur_distr *_unur_distr_cont_clone ( const struct unur_distr *distr ); struct unur_distr *_unur_distr_matr_clone ( const struct unur_distr *distr ); struct unur_distr *_unur_distr_cvec_clone ( const struct unur_distr *distr ); struct unur_distr *_unur_distr_cvemp_clone( const struct unur_distr *distr ); struct unur_distr *_unur_distr_discr_clone( const struct unur_distr *distr ); #define _unur_distr_clone(distr) ((distr)->clone(distr)) /*---------------------------------------------------------------------------*/ /* destroy distribution object */ #define _unur_distr_free(distr) do {if (distr) (distr)->destroy(distr);} while(0) /*---------------------------------------------------------------------------*/ /* debuging routines for distributions */ #ifdef UNUR_ENABLE_LOGGING void _unur_distr_cont_debug( const UNUR_DISTR *distribution, const char *genid ); /* write info about distribution into logfile */ void _unur_distr_corder_debug( const UNUR_DISTR *order_statistics, const char *genid ); /* write info about distribution into logfile */ void _unur_distr_cxtrans_debug( const UNUR_DISTR *cxtrans, const char *genid ); /* write info about distribution into logfile */ void _unur_distr_cemp_debug( const UNUR_DISTR *distribution, const char *genid, unsigned printvector ); /* write info about distribution into logfile */ void _unur_distr_matr_debug( const UNUR_DISTR *distribution, const char *genid ); /* write info about matrix distribution into logfile */ void _unur_distr_cvec_debug( const UNUR_DISTR *distribution, const char *genid ); /* write info about distribution into logfile */ void _unur_distr_condi_debug( const UNUR_DISTR *distribution, const char *genid ); /* write info about distribution into logfile */ void _unur_distr_cvemp_debug( const UNUR_DISTR *distribution, const char *genid, unsigned printvector ); /* write info about distribution into logfile */ void _unur_distr_discr_debug( const UNUR_DISTR *distribution, const char *genid, unsigned printvector ); /* write info about distribution into logfile */ #endif /*---------------------------------------------------------------------------*/ /* routines for creating info strings */ #ifdef UNUR_ENABLE_INFO void _unur_distr_info_typename( struct unur_gen *gen ); /* write string that contains type and name of given distribution object */ void _unur_distr_info_vector( struct unur_gen *gen, const double *vec, int n ); /* write string that contains given vector */ void _unur_distr_cvec_info_domain( struct unur_gen *gen ); /* create character string that contains domain */ #endif /*---------------------------------------------------------------------------*/ /* auxiliary routines */ int _unur_distr_cont_find_center( struct unur_distr *distr ); /* search for an appropriate point for center. */ /* if such a point is found, then it is stored in 'distr'. */ /* test whether all marginals are equal or not (returns TRUE or FALSE) */ /* for dimesion 1, TRUE is returned. */ /* WARNING: There is no checking of arguments in this function! */ int _unur_distr_cvec_marginals_are_equal( struct unur_distr **marginals, int dim ); /* Duplicate first marginal distribution in array of marginal */ /* distributions into all other slots of this array */ /* This is only executed when all entries in this array point to the */ /* same distribution object, i.e. when all marginal distributions */ /* are equal. */ int _unur_distr_cvec_duplicate_firstmarginal( struct unur_distr *distribution ); /* test whether 'x' is the in domain of 'distribution' */ int _unur_distr_cvec_is_indomain( const double *x, const struct unur_distr *distribution); /* check whether @var{distribution} has a bounded domain */ int _unur_distr_cvec_has_boundeddomain( const struct unur_distr *distribution ); /* Same as unur_distr_cont_upd_pdfarea() */ /* but may also silently check the existance of the update function. */ int _unur_distr_cont_upd_pdfarea( struct unur_distr *distr, int silent_check_updfunc ); /*---------------------------------------------------------------------------*/ /* check if parameter object is of correct type, return 0 otherwise */ #define _unur_check_distr_object( distr,distrtype, rcode ) \ do { \ if ((distr)->type != UNUR_DISTR_##distrtype) { \ _unur_warning((distr)->name,UNUR_ERR_DISTR_INVALID,""); \ return rcode; } \ COOKIE_CHECK(distr,CK_DISTR_##distrtype,rcode); } while (0) /*---------------------------------------------------------------------------*/ #endif /* UNUR_DISTR_SOURCE_H_SEEN */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distr/Makefile.in0000644001357500135600000005150014430713360014020 00000000000000# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = src/distr ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libdistr_la_LIBADD = am__libdistr_la_SOURCES_DIST = deprecated_distr.c deprecated_distr.h \ distr.c distr.h distr_info.c distr_struct.h distr_source.h \ cont.c cont.h corder.c corder.h cxtrans.c cxtrans.h cemp.c \ cemp.h cvec.c cvec.h condi.c condi.h cvemp.c cvemp.h discr.c \ discr.h matr.c matr.h @ENABLE_DEPRECATED_TRUE@am__objects_1 = deprecated_distr.lo am_libdistr_la_OBJECTS = $(am__objects_1) distr.lo distr_info.lo \ cont.lo corder.lo cxtrans.lo cemp.lo cvec.lo condi.lo cvemp.lo \ discr.lo matr.lo libdistr_la_OBJECTS = $(am_libdistr_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/cemp.Plo ./$(DEPDIR)/condi.Plo \ ./$(DEPDIR)/cont.Plo ./$(DEPDIR)/corder.Plo \ ./$(DEPDIR)/cvec.Plo ./$(DEPDIR)/cvemp.Plo \ ./$(DEPDIR)/cxtrans.Plo ./$(DEPDIR)/deprecated_distr.Plo \ ./$(DEPDIR)/discr.Plo ./$(DEPDIR)/distr.Plo \ ./$(DEPDIR)/distr_info.Plo ./$(DEPDIR)/matr.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libdistr_la_SOURCES) DIST_SOURCES = $(am__libdistr_la_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autoconf/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILECMD = @FILECMD@ GREP = @GREP@ HAVE_DIVIDE_BY_ZERO = @HAVE_DIVIDE_BY_ZERO@ HAVE_IEEE_COMPARISONS = @HAVE_IEEE_COMPARISONS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNURAN_LT_VERSION = @UNURAN_LT_VERSION@ UNURAN_SUPPORTS_GSL = @UNURAN_SUPPORTS_GSL@ UNURAN_SUPPORTS_PRNG = @UNURAN_SUPPORTS_PRNG@ UNURAN_SUPPORTS_RNGSTREAM = @UNURAN_SUPPORTS_RNGSTREAM@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ have_valgrind = @have_valgrind@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = \ -I$(top_srcdir)/src noinst_LTLIBRARIES = libdistr.la @ENABLE_DEPRECATED_FALSE@DEPRECATED_FILES = # Files that contain deprecated routines @ENABLE_DEPRECATED_TRUE@DEPRECATED_FILES = deprecated_distr.c deprecated_distr.h libdistr_la_SOURCES = \ $(DEPRECATED_FILES) \ \ distr.c distr.h distr_info.c distr_struct.h distr_source.h \ cont.c cont.h \ corder.c corder.h \ cxtrans.c cxtrans.h \ cemp.c cemp.h \ cvec.c cvec.h \ condi.c condi.h \ cvemp.c cvemp.h\ discr.c discr.h \ matr.c matr.h # clean backup files CLEANFILES = *~ # clean generated files MAINTAINERCLEANFILES = \ Makefile.in all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/distr/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/distr/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libdistr.la: $(libdistr_la_OBJECTS) $(libdistr_la_DEPENDENCIES) $(EXTRA_libdistr_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libdistr_la_OBJECTS) $(libdistr_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cemp.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/condi.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cont.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/corder.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cvec.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cvemp.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxtrans.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/deprecated_distr.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/discr.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/distr.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/distr_info.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/matr.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/cemp.Plo -rm -f ./$(DEPDIR)/condi.Plo -rm -f ./$(DEPDIR)/cont.Plo -rm -f ./$(DEPDIR)/corder.Plo -rm -f ./$(DEPDIR)/cvec.Plo -rm -f ./$(DEPDIR)/cvemp.Plo -rm -f ./$(DEPDIR)/cxtrans.Plo -rm -f ./$(DEPDIR)/deprecated_distr.Plo -rm -f ./$(DEPDIR)/discr.Plo -rm -f ./$(DEPDIR)/distr.Plo -rm -f ./$(DEPDIR)/distr_info.Plo -rm -f ./$(DEPDIR)/matr.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/cemp.Plo -rm -f ./$(DEPDIR)/condi.Plo -rm -f ./$(DEPDIR)/cont.Plo -rm -f ./$(DEPDIR)/corder.Plo -rm -f ./$(DEPDIR)/cvec.Plo -rm -f ./$(DEPDIR)/cvemp.Plo -rm -f ./$(DEPDIR)/cxtrans.Plo -rm -f ./$(DEPDIR)/deprecated_distr.Plo -rm -f ./$(DEPDIR)/discr.Plo -rm -f ./$(DEPDIR)/distr.Plo -rm -f ./$(DEPDIR)/distr_info.Plo -rm -f ./$(DEPDIR)/matr.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: unuran-1.11.0/src/distr/cvec.c0000644001357500135600000033557214420445767013071 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: cvec.c * * * * manipulate multivariate continuous distribution objects * * * * return: * * UNUR_SUCCESS ... on success * * error code ... on error * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include "distr_source.h" #include "distr.h" #include "cvec.h" #include #include /*---------------------------------------------------------------------------*/ /* copy and free marginal distributions */ static struct unur_distr **_unur_distr_cvec_marginals_clone ( struct unur_distr **marginals, int dim ); static void _unur_distr_cvec_marginals_free ( struct unur_distr **marginals, int dim ); static void _unur_distr_cvec_free( struct unur_distr *distr ); /*---------------------------------------------------------------------------*/ #define DISTR distr->data.cvec /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** mulitvariate continuous distributions **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_cvec_new( int dim ) /*----------------------------------------------------------------------*/ /* create a new (empty) distribution object */ /* type: multivariate continuous with given PDF */ /* */ /* parameters: */ /* dim ... number of components of random vector (dimension) */ /* */ /* return: */ /* pointer to distribution object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { register struct unur_distr *distr; int i; /* check dimension for new parameter for distribution */ if (dim < 1) { _unur_error(NULL,UNUR_ERR_DISTR_SET,"dimension < 1"); return NULL; } /* get empty distribution object */ distr = _unur_distr_generic_new(); if (!distr) return NULL; /* set magic cookie */ COOKIE_SET(distr,CK_DISTR_CVEC); /* set type of distribution */ distr->type = UNUR_DISTR_CVEC; /* set id to generic distribution */ distr->id = UNUR_DISTR_GENERIC; /* dimension of random vector */ distr->dim = dim; /* multivariant */ /* this is not a derived distribution */ distr->base = NULL; /* destructor */ distr->destroy = _unur_distr_cvec_free; /* clone */ distr->clone = _unur_distr_cvec_clone; /* set defaults */ DISTR.pdf = NULL; /* pointer to PDF */ DISTR.dpdf = NULL; /* pointer to gradient of PDF */ DISTR.pdpdf = NULL; /* pointer to partial derivative of PDF */ DISTR.logpdf = NULL; /* pointer to logPDF */ DISTR.dlogpdf = NULL; /* pointer to gradient of logPDF */ DISTR.pdlogpdf = NULL; /* pointer to partial derivative of logPDF */ DISTR.domainrect = NULL; /* (rectangular) domain of distribution [default: unbounded */ DISTR.init = NULL; /* pointer to special init routine [default: none] */ DISTR.mean = NULL; /* mean vector [default: not known] */ DISTR.covar = NULL; /* covariance matrix [default: not known] */ DISTR.cholesky = NULL; /* cholesky factor of cov. matrix [default: not computed] */ DISTR.covar_inv = NULL; /* inverse covariance matrix [default: not computed] */ DISTR.rankcorr = NULL; /* rank correlation [default: not known] */ DISTR.rk_cholesky = NULL; /* cholesky factor of rank correlation [default: not computed] */ DISTR.marginals = NULL; /* array of pointers to marginal distributions */ DISTR.upd_mode = NULL; /* funct for computing mode */ DISTR.upd_volume = NULL; /* funct for computing volume */ #ifdef USE_DEPRECATED_CODE DISTR.stdmarginals = NULL; /* array of pointers to standardized marginal distributions */ #endif /* initialize parameters of the p.d.f. */ DISTR.n_params = 0; /* number of parameters of the pdf */ for (i=0; idata.cvec struct unur_distr *clone; int i; /* check arguments */ _unur_check_NULL( NULL, distr, NULL ); _unur_check_distr_object( distr, CVEC, NULL ); /* allocate memory */ clone = _unur_xmalloc( sizeof(struct unur_distr) ); /* copy distribution object into clone */ memcpy( clone, distr, sizeof( struct unur_distr ) ); /* copy data about distribution */ if (DISTR.domainrect) { CLONE.domainrect = _unur_xmalloc( 2 * distr->dim * sizeof(double) ); memcpy( CLONE.domainrect, DISTR.domainrect, 2 * distr->dim * sizeof(double) ); } if (DISTR.mean) { CLONE.mean = _unur_xmalloc( distr->dim * sizeof(double) ); memcpy( CLONE.mean, DISTR.mean, distr->dim * sizeof(double) ); } if (DISTR.covar) { CLONE.covar = _unur_xmalloc( distr->dim * distr->dim * sizeof(double) ); memcpy( CLONE.covar, DISTR.covar, distr->dim * distr->dim * sizeof(double) ); } if (DISTR.cholesky) { CLONE.cholesky = _unur_xmalloc( distr->dim * distr->dim * sizeof(double) ); memcpy( CLONE.cholesky, DISTR.cholesky, distr->dim * distr->dim * sizeof(double) ); } if (DISTR.covar_inv) { CLONE.covar_inv = _unur_xmalloc( distr->dim * distr->dim * sizeof(double) ); memcpy( CLONE.covar_inv, DISTR.covar_inv, distr->dim * distr->dim * sizeof(double) ); } if (DISTR.rankcorr) { CLONE.rankcorr = _unur_xmalloc( distr->dim * distr->dim * sizeof(double) ); memcpy( CLONE.rankcorr, DISTR.rankcorr, distr->dim * distr->dim * sizeof(double) ); } if (DISTR.rk_cholesky) { CLONE.rk_cholesky = _unur_xmalloc( distr->dim * distr->dim * sizeof(double) ); memcpy( CLONE.rk_cholesky, DISTR.rk_cholesky, distr->dim * distr->dim * sizeof(double) ); } if (DISTR.mode) { CLONE.mode = _unur_xmalloc( distr->dim * sizeof(double) ); memcpy( CLONE.mode, DISTR.mode, distr->dim * sizeof(double) ); } if (DISTR.center) { CLONE.center = _unur_xmalloc( distr->dim * sizeof(double) ); memcpy( CLONE.center, DISTR.center, distr->dim * sizeof(double) ); } if (DISTR.marginals) CLONE.marginals = _unur_distr_cvec_marginals_clone( DISTR.marginals, distr->dim ); #ifdef USE_DEPRECATED_CODE if (DISTR.stdmarginals) CLONE.stdmarginals = _unur_distr_cvec_marginals_clone( DISTR.stdmarginals, distr->dim ); #endif /* clone of scalar parameters */ CLONE.n_params = DISTR.n_params; for (i=0; iname_str) { size_t len = strlen(distr->name_str) + 1; clone->name_str = _unur_xmalloc(len); memcpy( clone->name_str, distr->name_str, len ); clone->name = clone->name_str; } return clone; #undef CLONE } /* end of _unur_distr_cvec_clone() */ /*---------------------------------------------------------------------------*/ void _unur_distr_cvec_free( struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* free distribution object */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /*----------------------------------------------------------------------*/ { int i; /* check arguments */ if( distr == NULL ) /* nothing to do */ return; COOKIE_CHECK(distr,CK_DISTR_CVEC,RETURN_VOID); for (i=0; idim); #ifdef USE_DEPRECATED_CODE if (DISTR.stdmarginals) _unur_distr_cvec_marginals_free(DISTR.stdmarginals, distr->dim); #endif /* user name for distribution */ if (distr->name_str) free(distr->name_str); COOKIE_CLEAR(distr); free( distr ); } /* end of unur_distr_cvec_free() */ /*---------------------------------------------------------------------------*/ int unur_distr_cvec_set_pdf( struct unur_distr *distr, UNUR_FUNCT_CVEC *pdf ) /*----------------------------------------------------------------------*/ /* set PDF of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* pdf ... pointer to PDF */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_NULL( distr->name, pdf, UNUR_ERR_NULL); _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); /* we do not allow overwriting a PDF */ if (DISTR.pdf != NULL || DISTR.logpdf != NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of PDF not allowed"); return UNUR_ERR_DISTR_SET; } /* changelog */ distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; /* derived parameters like mode, area, etc. might be wrong now! */ DISTR.pdf = pdf; return UNUR_SUCCESS; } /* end of unur_distr_cvec_set_pdf() */ /*---------------------------------------------------------------------------*/ int unur_distr_cvec_set_dpdf( struct unur_distr *distr, UNUR_VFUNCT_CVEC *dpdf ) /*----------------------------------------------------------------------*/ /* set gradient of PDF of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* dpdf ... pointer to gradient of PDF */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_NULL( distr->name, dpdf, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); /* we do not allow overwriting a dPDF */ if (DISTR.dpdf != NULL || DISTR.dlogpdf != NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of dPDF not allowed"); return UNUR_ERR_DISTR_SET; } /* changelog */ distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; /* derived parameters like mode, area, etc. might be wrong now! */ DISTR.dpdf = dpdf; return UNUR_SUCCESS; } /* end of unur_distr_cvec_set_dpdf() */ /*---------------------------------------------------------------------------*/ int unur_distr_cvec_set_pdpdf( struct unur_distr *distr, UNUR_FUNCTD_CVEC *pdpdf ) /*----------------------------------------------------------------------*/ /* set PDF of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* pdpdf ... pointer to partial derivative of the PDF */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_NULL( distr->name, pdpdf, UNUR_ERR_NULL); _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); /* we do not allow overwriting a pdPDF */ if (DISTR.pdpdf != NULL || DISTR.pdlogpdf != NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of pdPDF not allowed"); return UNUR_ERR_DISTR_SET; } /* changelog */ distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; /* derived parameters like mode, area, etc. might be wrong now! */ DISTR.pdpdf = pdpdf; return UNUR_SUCCESS; } /* end of unur_distr_cvec_set_pdpdf() */ /*---------------------------------------------------------------------------*/ UNUR_FUNCT_CVEC * unur_distr_cvec_get_pdf( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get pointer to PDF of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* pointer to PDF */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, NULL ); _unur_check_distr_object( distr, CVEC, NULL ); return DISTR.pdf; } /* end of unur_distr_cvec_get_pdf() */ /*---------------------------------------------------------------------------*/ UNUR_VFUNCT_CVEC * unur_distr_cvec_get_dpdf( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get pointer to gradient of PDF of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* pointer to gradient of PDF */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, NULL ); _unur_check_distr_object( distr, CVEC, NULL ); return DISTR.dpdf; } /* end of unur_distr_cvec_get_dpdf() */ /*---------------------------------------------------------------------------*/ UNUR_FUNCTD_CVEC * unur_distr_cvec_get_pdpdf( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get pointer to partial derivative of PDF of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* pointer to partial derivative of PDF */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, NULL ); _unur_check_distr_object( distr, CVEC, NULL ); return DISTR.pdpdf; } /* end of unur_distr_cvec_get_pdpdf() */ /*---------------------------------------------------------------------------*/ double unur_distr_cvec_eval_pdf( const double *x, struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* evaluate PDF of distribution at x */ /* */ /* parameters: */ /* x ... argument for pdf */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* PDF(x) */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_INFINITY ); _unur_check_distr_object( distr, CVEC, UNUR_INFINITY ); if (DISTR.pdf == NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); return UNUR_INFINITY; } return _unur_cvec_PDF(x,distr); } /* end of unur_distr_cvec_eval_pdf() */ /*---------------------------------------------------------------------------*/ int unur_distr_cvec_eval_dpdf( double *result, const double *x, struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* evaluate gradient of PDF of distribution at x */ /* */ /* parameters: */ /* result ... to store grad (PDF(x)) */ /* x ... argument for dPDF */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); if (DISTR.dpdf == NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); return UNUR_ERR_DISTR_DATA; } return _unur_cvec_dPDF(result,x,distr); } /* end of unur_distr_cvec_eval_dpdf() */ /*---------------------------------------------------------------------------*/ double unur_distr_cvec_eval_pdpdf( const double *x, int coord, struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* evaluate partial derivative of PDF of distribution at x for */ /* coordinate coord. */ /* */ /* parameters: */ /* x ... argument for pdf */ /* coord ... coordinate for partial derivative */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* dPDF(x) / d(coord) */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_INFINITY ); _unur_check_distr_object( distr, CVEC, UNUR_INFINITY ); if (DISTR.pdpdf == NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); return UNUR_INFINITY; } if (coord < 0 || coord >= distr->dim) { _unur_error(distr->name,UNUR_ERR_DISTR_DOMAIN,"invalid coordinate"); return UNUR_INFINITY; } return _unur_cvec_pdPDF(x,coord,distr); } /* end of unur_distr_cvec_eval_pdpdf() */ /*---------------------------------------------------------------------------*/ int unur_distr_cvec_set_logpdf( struct unur_distr *distr, UNUR_FUNCT_CVEC *logpdf ) /*----------------------------------------------------------------------*/ /* set logPDF of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* logpdf ... pointer to logPDF */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_NULL( distr->name, logpdf, UNUR_ERR_NULL); _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); /* we do not allow overwriting a PDF */ if (DISTR.pdf != NULL || DISTR.logpdf != NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of logPDF not allowed"); return UNUR_ERR_DISTR_SET; } /* changelog */ distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; /* derived parameters like mode, area, etc. might be wrong now! */ DISTR.logpdf = logpdf; DISTR.pdf = _unur_distr_cvec_eval_pdf_from_logpdf; return UNUR_SUCCESS; } /* end of unur_distr_cvec_set_logpdf() */ /*---------------------------------------------------------------------------*/ double _unur_distr_cvec_eval_pdf_from_logpdf( const double *x, struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* evaluate PDF of distribution at x */ /* wrapper when only logPDF is given */ /* */ /* parameters: */ /* x ... argument for pdf */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* PDF(x) */ /*----------------------------------------------------------------------*/ { if (DISTR.logpdf == NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); return UNUR_INFINITY; } return exp(_unur_cvec_logPDF(x,distr)); } /* end of _unur_distr_cvec_eval_pdf_from_logpdf() */ /*---------------------------------------------------------------------------*/ int unur_distr_cvec_set_dlogpdf( struct unur_distr *distr, UNUR_VFUNCT_CVEC *dlogpdf ) /*----------------------------------------------------------------------*/ /* set gradient of logPDF of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* dlogpdf ... pointer to gradient of logPDF */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_NULL( distr->name, dlogpdf, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); /* we do not allow overwriting a dlogPDF */ if (DISTR.dpdf != NULL || DISTR.dlogpdf != NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of dlogPDF not allowed"); return UNUR_ERR_DISTR_SET; } /* changelog */ distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; /* derived parameters like mode, area, etc. might be wrong now! */ DISTR.dlogpdf = dlogpdf; DISTR.dpdf = _unur_distr_cvec_eval_dpdf_from_dlogpdf; return UNUR_SUCCESS; } /* end of _unur_distr_cvec_set_dlogpdf() */ /*---------------------------------------------------------------------------*/ int _unur_distr_cvec_eval_dpdf_from_dlogpdf( double *result, const double *x, struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* evaluate gradient of PDF of distribution at x */ /* wrapper when only gradient of logPDF is given */ /* */ /* parameters: */ /* result ... to store grad (PDF(x)) */ /* x ... argument for dPDF */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int ret, i; double fx; if (DISTR.logpdf == NULL || DISTR.dlogpdf == NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); return UNUR_ERR_DISTR_DATA; } fx = exp(unur_distr_cvec_eval_logpdf( x, distr )); if (!_unur_isfinite(fx)) return UNUR_ERR_DISTR_DATA; ret = _unur_cvec_dlogPDF(result,x,distr); for (i=0; idim; i++) result[i] *= fx; return ret; } /* end of _unur_distr_cvec_eval_dpdf_from_dlogpdf() */ /*---------------------------------------------------------------------------*/ int unur_distr_cvec_set_pdlogpdf( struct unur_distr *distr, UNUR_FUNCTD_CVEC *pdlogpdf ) /*----------------------------------------------------------------------*/ /* set partial derivative of logPDF of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* pdlogpdf ... pointer to partial derivative of logPDF */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_NULL( distr->name, pdlogpdf, UNUR_ERR_NULL); _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); /* we do not allow overwriting a PDF */ if (DISTR.pdpdf != NULL || DISTR.pdlogpdf != NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of pdlogPDF not allowed"); return UNUR_ERR_DISTR_SET; } /* changelog */ distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; /* derived parameters like mode, area, etc. might be wrong now! */ DISTR.pdlogpdf = pdlogpdf; DISTR.pdpdf = _unur_distr_cvec_eval_pdpdf_from_pdlogpdf; return UNUR_SUCCESS; } /* end of unur_distr_cvec_set_pdlogpdf() */ /*---------------------------------------------------------------------------*/ double _unur_distr_cvec_eval_pdpdf_from_pdlogpdf( const double *x, int coord, struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* evaluate partial derivative of PDF of distribution at x */ /* wrapper when only logPDF is given */ /* */ /* parameters: */ /* x ... argument for pdf */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* PDF(x) */ /*----------------------------------------------------------------------*/ { double fx; if (DISTR.logpdf == NULL || DISTR.pdlogpdf == NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); return UNUR_INFINITY; } if (coord < 0 || coord >= distr->dim) { _unur_error(distr->name,UNUR_ERR_DISTR_DOMAIN,"invalid coordinate"); return UNUR_INFINITY; } fx = exp(unur_distr_cvec_eval_logpdf( x, distr )); if (!_unur_isfinite(fx)) return UNUR_INFINITY; return fx * _unur_cvec_pdlogPDF(x,coord,distr); } /* end of _unur_distr_cvec_eval_pdpdf_from_pdlogpdf() */ /*---------------------------------------------------------------------------*/ UNUR_FUNCT_CVEC * unur_distr_cvec_get_logpdf( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get pointer to logPDF of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* pointer to logPDF */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, NULL ); _unur_check_distr_object( distr, CVEC, NULL ); return DISTR.logpdf; } /* end of unur_distr_cvec_get_logpdf() */ /*---------------------------------------------------------------------------*/ UNUR_VFUNCT_CVEC * unur_distr_cvec_get_dlogpdf( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get pointer to gradient of logPDF of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* pointer to gradient of logPDF */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, NULL ); _unur_check_distr_object( distr, CVEC, NULL ); return DISTR.dlogpdf; } /* end of unur_distr_cvec_get_dlogpdf() */ /*---------------------------------------------------------------------------*/ UNUR_FUNCTD_CVEC * unur_distr_cvec_get_pdlogpdf( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get pointer to partial derivative of logPDF of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* pointer to partial derivative of logPDF */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, NULL ); _unur_check_distr_object( distr, CVEC, NULL ); return DISTR.pdlogpdf; } /* end of unur_distr_cvec_get_pdlogpdf() */ /*---------------------------------------------------------------------------*/ double unur_distr_cvec_eval_logpdf( const double *x, struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* evaluate logPDF of distribution at x */ /* */ /* parameters: */ /* x ... argument for logpdf */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* logPDF(x) */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_INFINITY ); _unur_check_distr_object( distr, CVEC, UNUR_INFINITY ); if (DISTR.logpdf == NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); return UNUR_INFINITY; } return _unur_cvec_logPDF(x,distr); } /* end of unur_distr_cvec_eval_logpdf() */ /*---------------------------------------------------------------------------*/ int unur_distr_cvec_eval_dlogpdf( double *result, const double *x, struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* evaluate gradient of logPDF of distribution at x */ /* */ /* parameters: */ /* result ... to store grad (logPDF(x)) */ /* x ... argument for dlogPDF */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); if (DISTR.dlogpdf == NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); return UNUR_ERR_DISTR_DATA; } return _unur_cvec_dlogPDF(result,x,distr); } /* end of unur_distr_cvec_eval_dlogpdf() */ /*---------------------------------------------------------------------------*/ double unur_distr_cvec_eval_pdlogpdf( const double *x, int coord, struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* evaluate of partial derivative of logPDF of distribution at x */ /* in direction coord */ /* */ /* parameters: */ /* x ... argument for logpdf */ /* coord ... coordinate for partial derivative */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* d logPDF(x) / d(coord) */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_INFINITY ); _unur_check_distr_object( distr, CVEC, UNUR_INFINITY ); if (DISTR.pdlogpdf == NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); return UNUR_INFINITY; } if (coord < 0 || coord >= distr->dim) { _unur_error(distr->name,UNUR_ERR_DISTR_DOMAIN,"invalid coordinate"); return UNUR_INFINITY; } return _unur_cvec_pdlogPDF(x,coord,distr); } /* end of unur_distr_cvec_eval_pdlogpdf() */ /*---------------------------------------------------------------------------*/ int unur_distr_cvec_set_domain_rect( struct unur_distr *distr, const double *lowerleft, const double *upperright ) /*----------------------------------------------------------------------*/ /* Set rectangular domain */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* lowerleft ... lower left vertex of rectanlge */ /* upperright ... upper right vertex of rectanlge */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int i; /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); _unur_check_NULL( distr->name, lowerleft, UNUR_ERR_NULL ); _unur_check_NULL( distr->name, upperright, UNUR_ERR_NULL ); /* check new parameter for distribution */ for (i=0; idim; i++) { if (!(lowerleft[i] < upperright[i] * (1.-UNUR_SQRT_DBL_EPSILON))) { _unur_error(distr->name,UNUR_ERR_DISTR_SET,"domain, left >= right"); return UNUR_ERR_DISTR_SET; } } /* store data */ DISTR.domainrect = _unur_xrealloc(DISTR.domainrect, 2 * distr->dim * sizeof(double)); for (i=0; idim; i++) { DISTR.domainrect[2*i] = lowerleft[i]; DISTR.domainrect[2*i+1] = upperright[i]; } /* changelog */ distr->set |= UNUR_DISTR_SET_DOMAIN | UNUR_DISTR_SET_DOMAINBOUNDED; /* we silently assume here that at least one of the given coordinates */ /* is finite. */ /* we have to mark all derived parameters as unknown */ distr->set &= ~(UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_MASK_DERIVED ); if (distr->base) { /* for derived distributions (e.g. order statistics) we also have to mark derived parameters as unknown */ distr->base->set &= ~(UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_MASK_DERIVED ); /* We only can set the domain of the base distribution if it */ /* is of the same type as distr */ if ( distr->base->type == UNUR_DISTR_CVEC ) { if (unur_distr_cvec_set_domain_rect(distr->base, lowerleft, upperright)!=UNUR_SUCCESS) return UNUR_ERR_DISTR_SET; } } /* o.k. */ return UNUR_SUCCESS; } /* end unur_distr_cvec_set_domain_rect() */ /*---------------------------------------------------------------------------*/ int _unur_distr_cvec_has_boundeddomain( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* Check whether distr has a bounded domain */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* TRUE ... if domain is bounded */ /* FALSE ... otherwise or in case of an error */ /*----------------------------------------------------------------------*/ { int i; double *domain; /* check arguments */ CHECK_NULL( distr, FALSE ); COOKIE_CHECK(distr,CK_DISTR_CVEC,FALSE); if (! (distr->set & UNUR_DISTR_SET_DOMAINBOUNDED && DISTR.domainrect)) return FALSE; domain = DISTR.domainrect; for (i=0; i < 2*distr->dim; i++) if (!_unur_isfinite(domain[i])) return FALSE; return TRUE; } /* end of _unur_distr_cvec_has_boundeddomain() */ /*---------------------------------------------------------------------------*/ int _unur_distr_cvec_is_indomain( const double *x, const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* Check whether x falls into domain */ /* */ /* parameters: */ /* x ... pointer to point */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* TRUE ... if x in domain */ /* FALSE ... otherwise or in case of an error */ /*----------------------------------------------------------------------*/ { int i; double *domain; /* check arguments */ CHECK_NULL( distr, FALSE ); COOKIE_CHECK(distr,CK_DISTR_CVEC,FALSE); domain = DISTR.domainrect; if (domain==NULL) /* unbounded domain */ return TRUE; for (i=0; idim; i++) { if (x[i] < domain[2*i] || x[i] > domain[2*i+1]) return FALSE; } return TRUE; } /* end of _unur_distr_cvec_is_indomain() */ int unur_distr_cvec_is_indomain( const double *x, const struct unur_distr *distr ) { /* check arguments */ _unur_check_NULL( NULL, distr, FALSE ); _unur_check_distr_object( distr, CVEC, FALSE ); return _unur_distr_cvec_is_indomain(x, distr); } /* end of unur_distr_cvec_is_indomain() */ /*---------------------------------------------------------------------------*/ int unur_distr_cvec_set_mean( struct unur_distr *distr, const double *mean ) /*----------------------------------------------------------------------*/ /* set mean vector of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* mean ... mean vector of distribution */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int i; /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); /* we have to allocate memory first */ if (DISTR.mean == NULL) DISTR.mean = _unur_xmalloc( distr->dim * sizeof(double) ); if (mean) /* mean vector given --> copy */ memcpy( DISTR.mean, mean, distr->dim * sizeof(double) ); else /* mean == NULL --> use zero vector instead */ for (i=0; idim; i++) DISTR.mean[i] = 0.; /* changelog */ distr->set |= UNUR_DISTR_SET_MEAN; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_distr_cvec_set_mean() */ /*---------------------------------------------------------------------------*/ const double * unur_distr_cvec_get_mean( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get mean vector of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* pointer to mean of distribution */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, NULL ); _unur_check_distr_object( distr, CVEC, NULL ); /* mean vector known ? */ if ( !(distr->set & UNUR_DISTR_SET_MEAN) ) { _unur_error(distr->name,UNUR_ERR_DISTR_GET,"mean"); return NULL; } return DISTR.mean; } /* end of unur_distr_cvec_get_mean() */ /*---------------------------------------------------------------------------*/ int unur_distr_cvec_set_covar( struct unur_distr *distr, const double *covar ) /*----------------------------------------------------------------------*/ /* set covariance matrix of distribution. */ /* as a side effect it also computes its cholesky factor. */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* covar ... covariance matrix of distribution */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { #define idx(a,b) ((a)*dim+(b)) int i,j; int dim; /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); dim = distr->dim; /* mark as unknown */ distr->set &= ~( UNUR_DISTR_SET_COVAR | UNUR_DISTR_SET_COVAR_IDENT | UNUR_DISTR_SET_CHOLESKY | UNUR_DISTR_SET_COVAR_INV ); /* we have to allocate memory first */ if (DISTR.covar == NULL) DISTR.covar = _unur_xmalloc( dim * dim * sizeof(double) ); if (DISTR.cholesky == NULL) DISTR.cholesky = _unur_xmalloc( dim * dim * sizeof(double) ); /* if covar == NULL --> use identity matrix */ if (covar==NULL) { for (i=0; iset |= UNUR_DISTR_SET_COVAR_IDENT; } /* covariance matrix given --> copy data */ else { /* check covariance matrix: diagonal entries > 0 */ for (i=0; iname ,UNUR_ERR_DISTR_DOMAIN,"variance <= 0"); return UNUR_ERR_DISTR_DOMAIN; } /* check for symmetry */ for (i=0; iname ,UNUR_ERR_DISTR_DOMAIN, "covariance matrix not symmetric"); return UNUR_ERR_DISTR_DOMAIN; } /* copy data */ memcpy( DISTR.covar, covar, dim * dim * sizeof(double) ); /* compute Cholesky decomposition and check for positive definitness */ if (_unur_matrix_cholesky_decomposition(dim, covar, DISTR.cholesky) != UNUR_SUCCESS) { _unur_error(distr->name, UNUR_ERR_DISTR_DOMAIN, "covariance matrix not positive definite"); return UNUR_ERR_DISTR_DOMAIN; } } /* changelog */ distr->set |= UNUR_DISTR_SET_COVAR | UNUR_DISTR_SET_CHOLESKY; /* o.k. */ return UNUR_SUCCESS; #undef idx } /* end of unur_distr_cvec_set_covar() */ /*---------------------------------------------------------------------------*/ int unur_distr_cvec_set_covar_inv( struct unur_distr *distr, const double *covar_inv ) /*----------------------------------------------------------------------*/ /* set inverse of covariance matrix of distribution. */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* covar_inv ... inverse of covariance matrix of distribution */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { #define idx(a,b) ((a)*dim+(b)) int i,j; int dim; /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); dim = distr->dim; /* mark as unknown */ distr->set &= ~(UNUR_DISTR_SET_COVAR_INV); /* we have to allocate memory first */ if (DISTR.covar_inv == NULL) DISTR.covar_inv = _unur_xmalloc( dim * dim * sizeof(double) ); /* if covar_inv == NULL --> use identity matrix */ if (covar_inv==NULL) for (i=0; i copy data */ else { /* check inverse of covariance matrix: diagonal entries > 0 */ for (i=0; iname ,UNUR_ERR_DISTR_DOMAIN,"diagonals <= 0"); return UNUR_ERR_DISTR_DOMAIN; } /* check for symmetry */ for (i=0; iname ,UNUR_ERR_DISTR_DOMAIN, "inverse of covariance matrix not symmetric"); return UNUR_ERR_DISTR_DOMAIN; } /* copy data */ memcpy( DISTR.covar_inv, covar_inv, dim * dim * sizeof(double) ); } /* changelog */ distr->set |= UNUR_DISTR_SET_COVAR_INV; /* o.k. */ return UNUR_SUCCESS; #undef idx } /* end of unur_distr_cvec_set_covar_inv() */ /*---------------------------------------------------------------------------*/ const double * unur_distr_cvec_get_covar( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get covariance matrix of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* pointer to covariance matrix of distribution */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, NULL ); _unur_check_distr_object( distr, CVEC, NULL ); /* covariance matrix known ? */ if ( !(distr->set & UNUR_DISTR_SET_COVAR) ) { _unur_error(distr->name,UNUR_ERR_DISTR_GET,"covariance matrix"); return NULL; } return DISTR.covar; } /* end of unur_distr_cvec_get_covar() */ /*---------------------------------------------------------------------------*/ const double * unur_distr_cvec_get_cholesky( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get cholesky factor of the covariance matrix of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* pointer to cholesky factor */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, NULL ); _unur_check_distr_object( distr, CVEC, NULL ); /* covariance matrix known ? */ if ( !(distr->set & UNUR_DISTR_SET_CHOLESKY) ) { _unur_error(distr->name,UNUR_ERR_DISTR_GET,"covariance matrix"); return NULL; } return DISTR.cholesky; } /* end of unur_distr_cvec_get_covar_cholesky() */ /*---------------------------------------------------------------------------*/ const double * unur_distr_cvec_get_covar_inv ( struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get inverse covariance matrix of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* pointer to inverse of covariance matrix */ /*----------------------------------------------------------------------*/ { double det; /* determinant of covariance matrix */ int dim; /* check arguments */ _unur_check_NULL( NULL, distr, NULL ); _unur_check_distr_object( distr, CVEC, NULL ); dim = distr->dim; /* covariance matrix known ? */ if ( !(distr->set & UNUR_DISTR_SET_COVAR) ) { _unur_error(distr->name,UNUR_ERR_DISTR_GET,"covariance matrix not known"); return NULL; } /* allocate memory */ if (DISTR.covar_inv == NULL) DISTR.covar_inv = _unur_xmalloc( dim * dim * sizeof(double) ); if ( !(distr->set & UNUR_DISTR_SET_COVAR_INV) ) { /* calculate inverse covariance matrix */ if (_unur_matrix_invert_matrix(dim, DISTR.covar, DISTR.covar_inv, &det) != UNUR_SUCCESS) { _unur_error(distr->name ,UNUR_ERR_DISTR_DOMAIN,"cannot compute inverse of covariance"); return NULL; } } /* changelog */ distr->set |= UNUR_DISTR_SET_COVAR_INV; return DISTR.covar_inv; } /* end of unur_distr_cvec_get_covar_inv() */ /*---------------------------------------------------------------------------*/ int unur_distr_cvec_set_rankcorr( struct unur_distr *distr, const double *rankcorr ) /*----------------------------------------------------------------------*/ /* Set rank-correlation matrix of distribution. */ /* The given matrix is checked for symmetry and positive definitness. */ /* The diagonal entries must be equal to 1. */ /* As a side effect it also computes its cholesky factor. */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* rankcorr ... rankcorrelation matrix of distribution */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { #define idx(a,b) ((a)*dim+(b)) int i,j; int dim; /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); dim = distr->dim; /* mark as unknown */ distr->set &= ~(UNUR_DISTR_SET_RANKCORR | UNUR_DISTR_SET_RK_CHOLESKY); /* we have to allocate memory first */ if (DISTR.rankcorr == NULL) DISTR.rankcorr = _unur_xmalloc( dim * dim * sizeof(double) ); if (DISTR.rk_cholesky == NULL) DISTR.rk_cholesky = _unur_xmalloc( dim * dim * sizeof(double) ); /* if rankcorr == NULL --> use identity matrix */ if (rankcorr==NULL) { for (i=0; i copy data */ else { /* check rankcorriance matrix: diagonal entries == 1 */ for (i=0; iname ,UNUR_ERR_DISTR_DOMAIN,"diagonals != 1"); return UNUR_ERR_DISTR_DOMAIN; } } /* check for symmetry */ for (i=0; iname ,UNUR_ERR_DISTR_DOMAIN, "rank-correlation matrix not symmetric"); return UNUR_ERR_DISTR_DOMAIN; } /* copy data */ memcpy( DISTR.rankcorr, rankcorr, dim * dim * sizeof(double) ); /* compute Cholesky decomposition and check for positive definitness */ if (_unur_matrix_cholesky_decomposition(dim, rankcorr, DISTR.rk_cholesky) != UNUR_SUCCESS) { _unur_error(distr->name, UNUR_ERR_DISTR_DOMAIN, "rankcorriance matrix not positive definite"); return UNUR_ERR_DISTR_DOMAIN; } } /* changelog */ distr->set |= UNUR_DISTR_SET_RANKCORR | UNUR_DISTR_SET_RK_CHOLESKY; /* o.k. */ return UNUR_SUCCESS; #undef idx } /* end of unur_distr_cvec_set_rankcorr() */ /*---------------------------------------------------------------------------*/ const double * unur_distr_cvec_get_rankcorr( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get rank-correlation matrix of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* pointer to rank-correlation matrix of distribution */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, NULL ); _unur_check_distr_object( distr, CVEC, NULL ); /* rankcorriance matrix known ? */ if ( !(distr->set & UNUR_DISTR_SET_RANKCORR) ) { _unur_error(distr->name,UNUR_ERR_DISTR_GET,"rank-correlation matrix"); return NULL; } return DISTR.rankcorr; } /* end of unur_distr_cvec_get_rankcorr() */ /*---------------------------------------------------------------------------*/ const double * unur_distr_cvec_get_rk_cholesky( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get cholesky factor of the rank correlation matrix of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* pointer to cholesky factor */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, NULL ); _unur_check_distr_object( distr, CVEC, NULL ); /* covariance matrix known ? */ if ( !(distr->set & UNUR_DISTR_SET_RK_CHOLESKY) ) { _unur_error(distr->name,UNUR_ERR_DISTR_GET,"rank correlation matrix"); return NULL; } return DISTR.rk_cholesky; } /* end of unur_distr_cvec_get_rk_cholesky() */ /*---------------------------------------------------------------------------*/ int unur_distr_cvec_set_marginals ( struct unur_distr *distr, struct unur_distr *marginal) /*----------------------------------------------------------------------*/ /* Copy marginal distribution into distribution object. */ /* Only one local copy is made. */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* marginal ... pointer to marginal distribution object */ /* */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { struct unur_distr *clone; int i; /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); _unur_check_NULL( distr->name, marginal, UNUR_ERR_NULL ); _unur_check_distr_object( marginal, CONT, UNUR_ERR_DISTR_INVALID ); /* first we have to check whether there is already a list of marginal distributions */ if (DISTR.marginals) _unur_distr_cvec_marginals_free(DISTR.marginals, distr->dim); /* make copy of marginal distribution object */ clone = _unur_distr_clone( marginal ); /* allocate memory for array */ DISTR.marginals = _unur_xmalloc (distr->dim * sizeof(struct unur_distr *)); /* copy pointer */ for (i=0; idim; i++) DISTR.marginals[i] = clone; /* changelog */ distr->set |= UNUR_DISTR_SET_MARGINAL; return UNUR_SUCCESS; } /* end of unur_distr_cvec_set_marginals() */ /*---------------------------------------------------------------------------*/ int unur_distr_cvec_set_marginal_array ( struct unur_distr *distr, struct unur_distr **marginals) /*----------------------------------------------------------------------*/ /* Copy marginal distributions into distribution object. */ /* For each dimension a new copy is made even if the pointer in */ /* the array marginals coincide. */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* marginals ... pointer to array of marginal distribution objects */ /* */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int i; /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); _unur_check_NULL( distr->name, marginals, UNUR_ERR_NULL ); for (i=0; idim; i++) { _unur_check_NULL( distr->name, *(marginals+i), UNUR_ERR_NULL ); _unur_check_distr_object( *(marginals+i), CONT, UNUR_ERR_DISTR_INVALID ); } /* first we have to check whether there is already a list of marginal distributions */ if (DISTR.marginals) _unur_distr_cvec_marginals_free(DISTR.marginals, distr->dim); /* allocate memory for array */ DISTR.marginals = _unur_xmalloc (distr->dim * sizeof(struct unur_distr *)); /* make copy of marginal distribution objects */ for (i=0; idim; i++) DISTR.marginals[i] = _unur_distr_clone( *(marginals+i) ); /* changelog */ distr->set |= UNUR_DISTR_SET_MARGINAL; return UNUR_SUCCESS; } /* end of unur_distr_cvec_set_marginal_array() */ /*---------------------------------------------------------------------------*/ int unur_distr_cvec_set_marginal_list ( struct unur_distr *distr, ... ) /*----------------------------------------------------------------------*/ /* Copy marginal distributions into distribution object. */ /* For each dimenision there must be a pointer to a discribution object.*/ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* ... ... pointer to array of marginal distribution objects */ /* */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* IMPORTANT: */ /* All marginal distribution objects are destroyed after they have */ /* been copied into the distribution object. */ /*----------------------------------------------------------------------*/ { int i; int failed = FALSE; struct unur_distr *marginal; struct unur_distr **marginal_list; va_list vargs; /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); /* allocate memory for array */ marginal_list = _unur_xmalloc (distr->dim * sizeof(struct unur_distr *)); for (i=0; idim; i++) marginal_list[i] = NULL; /* make copy of marginal distribution objects */ va_start(vargs, distr); for (i=0; idim; i++) { marginal = (struct unur_distr *) va_arg(vargs, struct unur_distr *); if (marginal) { marginal_list[i] = _unur_distr_clone( marginal ); _unur_distr_free(marginal); } else { failed = TRUE; } } va_end(vargs); if (failed) { /* some of the pointers are NULL pointers */ _unur_distr_cvec_marginals_free(marginal_list, distr->dim); _unur_error(distr->name ,UNUR_ERR_DISTR_SET,"marginals == NULL"); return UNUR_ERR_DISTR_SET; } /* copy list of marginal distributions. However, first we have to check */ /* whether there is already a list of marginal distributions. */ if (DISTR.marginals) _unur_distr_cvec_marginals_free(DISTR.marginals, distr->dim); DISTR.marginals = marginal_list; /* changelog */ distr->set |= UNUR_DISTR_SET_MARGINAL; return UNUR_SUCCESS; } /* end of unur_distr_cvec_set_marginal_list() */ /*---------------------------------------------------------------------------*/ const struct unur_distr * unur_distr_cvec_get_marginal( const struct unur_distr *distr, int n ) /*----------------------------------------------------------------------*/ /* Get pointer to marginal distribution object. */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* n ... position of marginal distribution object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, NULL ); _unur_check_distr_object( distr, CVEC, NULL ); if (n<=0 || n > distr->dim) { _unur_error(distr->name,UNUR_ERR_DISTR_GET,"n not in 1 .. dim"); return NULL; } /* marginal distributions known ? */ if ( !(distr->set & UNUR_DISTR_SET_MARGINAL) ) { _unur_error(distr->name,UNUR_ERR_DISTR_GET,"marginals"); return NULL; } _unur_check_NULL( distr->name, DISTR.marginals, NULL ); /* return marginal distribution object */ return (DISTR.marginals[n-1]); } /* end of unur_distr_cvec_get_marginal() */ /*---------------------------------------------------------------------------*/ struct unur_distr ** _unur_distr_cvec_marginals_clone ( struct unur_distr **marginals, int dim ) /*----------------------------------------------------------------------*/ /* copy (clone) list of marginal distribution objects */ /* */ /* parameters: */ /* marginals ... pointer to list of marginal distribution objects */ /* dim ... number of marginal distributions */ /* */ /* return: */ /* pointer to clone of list of marginal distribution objects */ /*----------------------------------------------------------------------*/ { struct unur_distr **clone; int i; _unur_check_NULL( NULL, marginals, NULL ); /* check dimension */ if (dim < 1) { _unur_error(NULL,UNUR_ERR_DISTR_SET,"dimension < 1"); return NULL; } /* allocate memory for array */ clone = _unur_xmalloc (dim * sizeof(struct unur_distr *)); if (_unur_distr_cvec_marginals_are_equal(marginals, dim)) { clone[0] = _unur_distr_clone( marginals[0] ); for (i=1; iset & UNUR_DISTR_SET_MARGINAL) || marginal==NULL ) { _unur_error(distr->name,UNUR_ERR_DISTR_DATA,"marginals"); return UNUR_ERR_DISTR_DATA; } /* marginal distribution are equal ? */ if (!_unur_distr_cvec_marginals_are_equal(DISTR.marginals,distr->dim)) { /* nothing to do */ _unur_error(distr->name,UNUR_ERR_DISTR_DATA,"marginals not equal"); return UNUR_ERR_DISTR_DATA; } /* make copy of marginal distribution objects */ for (i=1; idim; i++) DISTR.marginals[i] = _unur_distr_clone( marginal ); return UNUR_SUCCESS; } /* end of _unur_distr_cvec_duplicate_firstmarginal() */ /*---------------------------------------------------------------------------*/ int unur_distr_cvec_set_pdfparams( struct unur_distr *distr, const double *params, int n_params ) /*----------------------------------------------------------------------*/ /* set array of parameters for distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* params ... list of arguments */ /* n_params ... number of arguments */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_NULL( NULL, params, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); if (n_params>0) _unur_check_NULL(distr->name,params,UNUR_ERR_NULL); /* check number of new parameter for the distribution */ if (n_params < 0 || n_params > UNUR_DISTR_MAXPARAMS ) { _unur_error(distr->name,UNUR_ERR_DISTR_NPARAMS,""); return UNUR_ERR_DISTR_NPARAMS; } /* changelog */ distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; /* derived parameters like mode, area, etc. might be wrong now! */ DISTR.n_params = n_params; if (n_params) memcpy( DISTR.params, params, n_params*sizeof(double) ); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_distr_cvec_set_pdfparams() */ /*---------------------------------------------------------------------------*/ int unur_distr_cvec_get_pdfparams( const struct unur_distr *distr, const double **params ) /*----------------------------------------------------------------------*/ /* get number of pdf parameters and sets pointer to array params[] of */ /* parameters */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* params ... pointer to list of arguments */ /* */ /* return: */ /* number of pdf parameters */ /* */ /* error: */ /* return 0 */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, 0 ); _unur_check_distr_object( distr, CVEC, 0 ); *params = (DISTR.n_params) ? DISTR.params : NULL; return DISTR.n_params; } /* end of unur_distr_cvec_get_pdfparams() */ /*---------------------------------------------------------------------------*/ int unur_distr_cvec_set_pdfparams_vec( struct unur_distr *distr, int par, const double *param_vec, int n_param_vec ) /*----------------------------------------------------------------------*/ /* set vector array parameters for distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* par ... which parameter is set */ /* param_vec ... parameter array with number `par' */ /* n_param_vec ... length of parameter array */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); /* check new parameter for distribution */ if (par < 0 || par >= UNUR_DISTR_MAXPARAMS ) { _unur_error(distr->name,UNUR_ERR_DISTR_NPARAMS,""); return UNUR_ERR_DISTR_NPARAMS; } if (param_vec != NULL) { /* allocate memory */ DISTR.param_vecs[par] = _unur_xrealloc( DISTR.param_vecs[par], n_param_vec * sizeof(double) ); /* copy parameters */ memcpy( DISTR.param_vecs[par], param_vec, n_param_vec*sizeof(double) ); /* set length of array */ DISTR.n_param_vec[par] = n_param_vec; } else { if (DISTR.param_vecs[par]) free(DISTR.param_vecs[par]); DISTR.n_param_vec[par] = 0; } /* changelog */ distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; /* derived parameters like mode, area, etc. might be wrong now! */ /* o.k. */ return UNUR_SUCCESS; } /* end of unur_distr_cvec_set_pdfparams_vec() */ /*---------------------------------------------------------------------------*/ int unur_distr_cvec_get_pdfparams_vec( const struct unur_distr *distr, int par, const double **param_vecs ) /*----------------------------------------------------------------------*/ /* get number of PDF parameters and sets pointer to array params[] of */ /* parameters */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* par ... which parameter is read */ /* params ... pointer to parameter array with number `par' */ /* */ /* return: */ /* length of parameter array with number `par' */ /* */ /* error: */ /* return 0 */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, 0 ); _unur_check_distr_object( distr, CVEC, 0 ); /* check new parameter for distribution */ if (par < 0 || par >= UNUR_DISTR_MAXPARAMS ) { _unur_error(distr->name,UNUR_ERR_DISTR_NPARAMS,""); *param_vecs = NULL; return 0; } *param_vecs = DISTR.param_vecs[par]; return (*param_vecs) ? DISTR.n_param_vec[par] : 0; } /* end of unur_distr_cvec_get_pdfparams_vec() */ /*---------------------------------------------------------------------------*/ int unur_distr_cvec_set_mode( struct unur_distr *distr, const double *mode ) /*----------------------------------------------------------------------*/ /* set mode of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* mode ... mode of PDF */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int i; /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); /* we have to allocate memory first */ if (DISTR.mode == NULL) DISTR.mode = _unur_xmalloc( distr->dim * sizeof(double) ); if (mode) /* mode vector given --> copy */ memcpy( DISTR.mode, mode, distr->dim * sizeof(double) ); else /* mode == NULL --> use zero vector instead */ for (i=0; idim; i++) DISTR.mode[i] = 0.; /* changelog */ distr->set |= UNUR_DISTR_SET_MODE; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_distr_cvec_set_mode() */ /*---------------------------------------------------------------------------*/ int unur_distr_cvec_upd_mode( struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* (re-) compute mode of distribution (if possible) */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); if (DISTR.upd_mode == NULL) { /* no function to compute mode available */ _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); return UNUR_ERR_DISTR_DATA; } /* compute mode */ if ((DISTR.upd_mode)(distr)==UNUR_SUCCESS) { /* changelog */ distr->set |= UNUR_DISTR_SET_MODE; return UNUR_SUCCESS; } else { /* computing of mode failed */ _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); return UNUR_ERR_DISTR_DATA; } } /* end of unur_distr_cvec_upd_mode() */ /*---------------------------------------------------------------------------*/ const double * unur_distr_cvec_get_mode( struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get mode of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* pointer to mode of distribution */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, NULL ); _unur_check_distr_object( distr, CVEC, NULL ); /* mode known ? */ if ( !(distr->set & UNUR_DISTR_SET_MODE) ) { /* try to compute mode */ if (DISTR.upd_mode == NULL) { /* no function to compute mode available */ _unur_error(distr->name,UNUR_ERR_DISTR_GET,"mode"); return NULL; } else { /* compute mode */ if (unur_distr_cvec_upd_mode(distr)!=UNUR_SUCCESS) { /* finding mode not successfully */ _unur_error(distr->name,UNUR_ERR_DISTR_GET,"mode"); return NULL; } } } return DISTR.mode; } /* end of unur_distr_cvec_get_mode() */ /*---------------------------------------------------------------------------*/ int unur_distr_cvec_set_center( struct unur_distr *distr, const double *center ) /*----------------------------------------------------------------------*/ /* set center of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* center ... center of PDF */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int i; /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); /* we have to allocate memory first */ if (DISTR.center == NULL) DISTR.center = _unur_xmalloc( distr->dim * sizeof(double) ); if (center) /* center vector given --> copy */ memcpy( DISTR.center, center, distr->dim * sizeof(double) ); else /* center == NULL --> use zero vector instead */ for (i=0; idim; i++) DISTR.center[i] = 0.; /* changelog */ distr->set |= UNUR_DISTR_SET_CENTER; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_distr_cvec_set_center() */ /*---------------------------------------------------------------------------*/ const double * unur_distr_cvec_get_center( struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get center of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* pointer to center of distribution */ /*----------------------------------------------------------------------*/ { int i; /* check arguments */ _unur_check_NULL( NULL, distr, NULL ); _unur_check_distr_object( distr, CVEC, NULL ); /* center given */ if ( distr->set & UNUR_DISTR_SET_CENTER ) return DISTR.center; /* else try mode */ if ( distr->set & UNUR_DISTR_SET_MODE ) return DISTR.mode; /* else try mean */ if ( distr->set & UNUR_DISTR_SET_MEAN ) return DISTR.mean; /* otherwise use (0,...,0) */ if ( DISTR.center == NULL ) DISTR.center = _unur_xmalloc( distr->dim * sizeof(double) ); for (i=0; idim; i++) DISTR.center[i] = 0.; return DISTR.center; } /* end of unur_distr_cvec_get_center() */ /*---------------------------------------------------------------------------*/ int unur_distr_cvec_set_pdfvol( struct unur_distr *distr, double volume ) /*----------------------------------------------------------------------*/ /* set volume below PDF */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* volume ... volume below PDF */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); /* check new parameter for distribution */ if (volume <= 0.) { _unur_error(distr->name,UNUR_ERR_DISTR_SET,"PDF volume <= 0"); return UNUR_ERR_DISTR_SET; } DISTR.volume = volume; /* changelog */ distr->set |= UNUR_DISTR_SET_PDFVOLUME; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_distr_cvec_set_pdfvol() */ /*---------------------------------------------------------------------------*/ int unur_distr_cvec_upd_pdfvol( struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* (re-) compute volume below p.d.f. of distribution (if possible) */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); if (DISTR.upd_volume == NULL) { /* no function to compute mode available */ _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); return UNUR_ERR_DISTR_DATA; } /* compute area */ if (((DISTR.upd_volume)(distr)!=UNUR_SUCCESS) || DISTR.volume <= 0.) { /* computing of area failed */ _unur_error(distr->name,UNUR_ERR_DISTR_SET,"upd volume <= 0"); DISTR.volume = 1.; /* avoid possible floating point exceptions */ distr->set &= ~UNUR_DISTR_SET_PDFVOLUME; return UNUR_ERR_DISTR_SET; } /* changelog */ distr->set |= UNUR_DISTR_SET_PDFVOLUME; return UNUR_SUCCESS; } /* end of unur_distr_cvec_upd_pdfvol() */ /*---------------------------------------------------------------------------*/ double unur_distr_cvec_get_pdfvol( struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get volume below PDF of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* volume below PDF of distribution */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_INFINITY ); _unur_check_distr_object( distr, CVEC, UNUR_INFINITY ); /* volume known ? */ if ( !(distr->set & UNUR_DISTR_SET_PDFVOLUME) ) { /* try to compute volume */ if (DISTR.upd_volume == NULL) { /* no function to compute area available */ _unur_error(distr->name,UNUR_ERR_DISTR_GET,"volume"); return UNUR_INFINITY; } else { /* compute area */ unur_distr_cvec_upd_pdfvol( distr ); } } return DISTR.volume; } /* end of unur_distr_cvec_get_pdfvol() */ /*****************************************************************************/ /* call PDFs and their derivatives */ /* (internal functions. no checking for NULL pointer) */ double _unur_cvec_PDF(const double *x, struct unur_distr *distr) { if ( (distr->set & UNUR_DISTR_SET_DOMAINBOUNDED) && !_unur_distr_cvec_is_indomain(x, distr) ) return 0.; return (*(distr->data.cvec.pdf)) (x,distr); } int _unur_cvec_dPDF(double *result, const double *x, struct unur_distr *distr) { int d; if ( (distr->set & UNUR_DISTR_SET_DOMAINBOUNDED) && !_unur_distr_cvec_is_indomain(x, distr) ) { for (d=0; d < distr->dim; d++) result[d] = 0.; return UNUR_SUCCESS; } return (*(distr->data.cvec.dpdf)) (result,x,distr); } double _unur_cvec_pdPDF(const double *x, int coord, struct unur_distr *distr) { if ( (distr->set & UNUR_DISTR_SET_DOMAINBOUNDED) && !_unur_distr_cvec_is_indomain(x, distr) ) return 0.; return (*(distr->data.cvec.pdpdf)) (x,coord,distr); } double _unur_cvec_logPDF(const double *x, struct unur_distr *distr) { if ( (distr->set & UNUR_DISTR_SET_DOMAINBOUNDED) && !_unur_distr_cvec_is_indomain(x, distr) ) return -UNUR_INFINITY; return (*(distr->data.cvec.logpdf)) (x,distr); } int _unur_cvec_dlogPDF(double *result, const double *x, struct unur_distr *distr) { int d; if ( (distr->set & UNUR_DISTR_SET_DOMAINBOUNDED) && !_unur_distr_cvec_is_indomain(x, distr) ) { for (d=0; d < distr->dim; d++) result[d] = 0.; return UNUR_SUCCESS; } return (*(distr->data.cvec.dlogpdf)) (result,x,distr); } double _unur_cvec_pdlogPDF(const double *x, int coord, struct unur_distr *distr) { if ( (distr->set & UNUR_DISTR_SET_DOMAINBOUNDED) && !_unur_distr_cvec_is_indomain(x, distr) ) return 0.; return (*(distr->data.cvec.pdlogpdf)) (x,coord,distr); } /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ void _unur_distr_cvec_debug( const struct unur_distr *distr, const char *genid ) /*----------------------------------------------------------------------*/ /* write info about distribution into LOG file */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* genid ... pointer to generator id */ /*----------------------------------------------------------------------*/ { FILE *LOG; double *mat; /* check arguments */ CHECK_NULL(distr,RETURN_VOID); COOKIE_CHECK(distr,CK_DISTR_CVEC,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s: distribution:\n",genid); fprintf(LOG,"%s:\ttype = continuous multivariate distribution\n",genid); fprintf(LOG,"%s:\tname = %s\n",genid,distr->name); fprintf(LOG,"%s:\tdimension = %d\n",genid,distr->dim); fprintf(LOG,"%s:\tfunctions: ",genid); if (DISTR.pdf) fprintf(LOG,"PDF "); if (DISTR.logpdf) fprintf(LOG,"logPDF "); if (DISTR.dpdf) fprintf(LOG,"dPDF "); if (DISTR.dlogpdf) fprintf(LOG,"dlogPDF "); if (DISTR.pdpdf) fprintf(LOG,"pdPDF "); if (DISTR.pdlogpdf) fprintf(LOG,"pdlogPDF "); fprintf(LOG,"\n%s:\n",genid); /* domain */ fprintf(LOG,"%s:\tdomain = ",genid); if (!(distr->set & UNUR_DISTR_SET_DOMAINBOUNDED)) { fprintf(LOG,"unbounded\n"); } else { if (DISTR.domainrect) { double *domain = DISTR.domainrect; int i; fprintf(LOG,"rectangular\n"); for (i=0; idim; i++) fprintf(LOG,"%s:\t %c ( %g, %g)\n",genid, i?'x':' ', domain[2*i], domain[2*i+1]); } } fprintf(LOG,"%s:\n",genid); /* mode */ mat = ((distr->set & UNUR_DISTR_SET_MODE) && DISTR.mode) ? DISTR.mode : NULL; _unur_matrix_print_vector( distr->dim, mat, "\tmode =", LOG, genid, "\t "); /* mean vector */ mat = ((distr->set & UNUR_DISTR_SET_MEAN) && DISTR.mean) ? DISTR.mean : NULL; _unur_matrix_print_vector( distr->dim, mat, "\tmean vector =", LOG, genid, "\t "); /* center vector */ if ((distr->set & UNUR_DISTR_SET_CENTER) && DISTR.center) _unur_matrix_print_vector( distr->dim, DISTR.center, "\tcenter vector =", LOG, genid, "\t "); else { fprintf(LOG,"%s:\tcenter = mode [not given explicitly]\n",genid); fprintf(LOG,"%s:\n",genid); } /* covariance matrix */ mat = ((distr->set & UNUR_DISTR_SET_COVAR) && DISTR.covar) ? DISTR.covar : NULL; _unur_matrix_print_matrix( distr->dim, mat, "\tcovariance matrix =", LOG, genid, "\t "); /* inverse covariance matrix */ /* mat = ((distr->set & UNUR_DISTR_SET_COVAR_INV) && DISTR.covar_inv) ? DISTR.covar_inv : NULL; */ /* _unur_matrix_print_matrix( distr->dim, mat, "\tinverse covariance matrix =", LOG, genid, "\t "); */ /* cholesky factor of covariance matrix */ mat = ((distr->set & UNUR_DISTR_SET_CHOLESKY) && DISTR.cholesky) ? DISTR.cholesky : NULL; _unur_matrix_print_matrix( distr->dim, mat, "\tcholesky factor of covariance matrix =", LOG, genid, "\t "); /* rank correlation matrix */ mat = ((distr->set & UNUR_DISTR_SET_RANKCORR) && DISTR.rankcorr) ? DISTR.rankcorr : NULL; _unur_matrix_print_matrix( distr->dim, mat, "\trank correlation matrix =", LOG, genid, "\t "); /* cholesky factor of rank correlation matrix */ mat = ((distr->set & UNUR_DISTR_SET_RK_CHOLESKY) && DISTR.rk_cholesky) ? DISTR.rk_cholesky : NULL; _unur_matrix_print_matrix( distr->dim, mat, "\tcholesky factor of rank correlation matrix =", LOG, genid, "\t "); /* marginal distributions */ fprintf(LOG,"%s:\tmarginal distributions:\n",genid); if (distr->set & UNUR_DISTR_SET_MARGINAL) { if (_unur_distr_cvec_marginals_are_equal(DISTR.marginals, distr->dim)) { fprintf(LOG,"%s: all mariginals [1-%d]:\n",genid,distr->dim); _unur_distr_cont_debug( DISTR.marginals[0], genid ); } else { int i; for (i=0; idim; i++) { fprintf(LOG,"%s: mariginal [%d]:\n",genid,i+1); _unur_distr_cont_debug( DISTR.marginals[i], genid ); } } } else { fprintf(LOG,"%s:\t [unknown]\n",genid); } fprintf(LOG,"%s:\n",genid); #ifdef USE_DEPRECATED_CODE /* standardized marginal distributions */ fprintf(LOG,"%s:\tstandardized marginal distributions: [see also marginal distributions]\n",genid); if (distr->set & UNUR_DISTR_SET_STDMARGINAL) { if (_unur_distr_cvec_marginals_are_equal(DISTR.stdmarginals, distr->dim)) { fprintf(LOG,"%s: all standardized mariginals [1-%d]:\n",genid,distr->dim); _unur_distr_cont_debug( DISTR.stdmarginals[0], genid ); } else { int i; for (i=0; idim; i++) { fprintf(LOG,"%s: mariginal [%d]:\n",genid,i+1); _unur_distr_cont_debug( DISTR.stdmarginals[i], genid ); } } } else { fprintf(LOG,"%s:\t [unknown]\n",genid); } fprintf(LOG,"%s:\n",genid); #endif } /* end of _unur_distr_cvec_debug() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distr/cxtrans.h0000644001357500135600000003504014420445767013623 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: cxtrans.h * * * * PURPOSE: * * function prototypes for manipulating distribution objects of * * id CXTRANS (continuous distribution of transformed RV) * * type CONT (continuous univariate distribution) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* =ExperimentalNODEX CXTRANS Continuous univariate distribution of transformed random variables =UP Distribution_objects [13] =DESCRIPTION Given a continuous univariate distribution object for a random variable @unurmath{X} with CDF @unurmath{F} and PDF @unurmath{f.} Then it can be transformed into a continuous univariate distribution object for @unurmath{Z=\phi(X)} for some strictly monotonically increasing continuous transformation @unurmath{\phi.} Its respetive CDF and PDF are then given by @unurmathdisplay{G(z) = F(\phi^{-1}(z))} and @unurmathdisplay{g(z) = f(\phi^{-1}(z))\cdot(\phi^{-1})'(z)} Currently, only power transformations, logarithmic and exponential transformation are supported. Additionally, The random variable can be relocated and rescaled ("standardized"): @unurmathdisplay{ \phi(X) = \log(Z) \\ \phi(X) = sign(Z) |Z|^\alpha \\ \phi(X) = \exp(Z) } where @unurmathdisplay{ Z = (X-\mu)/\sigma } @unurmath{\alpha} must be between 0 and @unurmath{\infty} where the logarithmic transformation is implemented as special case @unurmath{\alpha=0}, the exponential transformation as @unurmath{\alpha=\infty} and the standardization procedure as @unurmath{\alpha=1.} Moreover, @unurmath{\sigma} must be strictly positive. One of the most important applications of these transformations is to eliminate poles, i.e., where the PDF is not bounded from above. The implementation of a PDF must return @code{UNUR_INFINITY} at such points. By default the value of the PDF @i{g} of the transformed density is set to @code{0} for such points and its derivative dPDF to @code{UNUR_INFINITY}. These figures can be changed to more appropriate values. It must be again noted here that poles are (only) detected/indicated as points where the PDF @i{f} returns @code{UNUR_INFINITY}. Notice that for @unurmath{\alpha > 1} these transformations are not defined at @unurmath{\mu.} It is difficult to check whether there exists a continuous continuation for the density of the transformed random variate at 0. Thus the above value for poles is used at 0. The distribution objects of transformed random variates are special cases of a continuous univariate distributions and thus they have most of these parameters (with the exception that functions cannot be changed). Additionally, @itemize @minus @item there is a call to extract the underlying distribution, @item calls to handle the transformation. @end itemize Notice that by transformation @unurmath{\phi} the mode is usually not known. The domain of the transformed random variate is adjusted according to the transformation. =END */ /*---------------------------------------------------------------------------*/ /* Routines for handling univariate continuous distributions of transformed random variables */ /* =ROUTINES */ UNUR_DISTR *unur_distr_cxtrans_new( const UNUR_DISTR *distribution ); /* Create an object for the distribution of the transformed random variate. @var{distribution} must be a pointer to a univariate continuous distribution. The resulting generator object is of the same type as of a unur_distr_cont_new() call. To select a transformation the unur_distr_cxtrans_set_alpha() call must be used. For the parameters for relocating and rescaling of the random variate unur_distr_cxtrans_set_rescale() has to be used. Without one of these additional calls the identity transformation is used, i.e. the random variate is not transformed at all. */ const UNUR_DISTR *unur_distr_cxtrans_get_distribution( const UNUR_DISTR *distribution ); /* Get pointer to distribution object for underlying distribution. */ /* ==DOC @subsubheading Essential parameters */ int unur_distr_cxtrans_set_alpha( UNUR_DISTR *distribution, double alpha ); /* Change the parameter @var{alpha} for the power transformation. One of the following transformations are possible: @multitable @columnfractions .25 .75 @headitem @var{alpha} @tab Transformation @item @code{UNUR_INFINITY} @tab @unurmath{\phi(X)=\exp(Z)} @item @code{0} @tab @unurmath{\phi(X)=\log(Z)} @item positive @tab @unurmath{\phi(X) = sign(Z) |Z|^\alpha} @end multitable where @unurmath{Z = (X-\mu)/\sigma.} Negative values for @var{alpha} are not allowed. The relocating and rescaling parameters @unurmath{\mu} and @unurmath{\sigma} can be set by the respective call unur_distr_cxtrans_set_rescale(). Default: @code{1} (i.e., identity). */ int unur_distr_cxtrans_set_rescale( UNUR_DISTR *distribution, double mu, double sigma ); /* Change relocating and rescaling parameter. @var{sigma} must be strictly positive. Default: @var{mu} = @code{0.} and @var{sigma} = @code{1.} (i.e., identity) */ double unur_distr_cxtrans_get_alpha( const UNUR_DISTR *distribution ); /* */ double unur_distr_cxtrans_get_mu( const UNUR_DISTR *distribution ); /* */ double unur_distr_cxtrans_get_sigma( const UNUR_DISTR *distribution ); /* Get parameters @unurmath{\alpha,} @unurmath{\mu,} and @unurmath{\sigma} for the power transformation, relocating and rescaling of the random variate. */ int unur_distr_cxtrans_set_logpdfpole( UNUR_DISTR *distribution, double logpdfpole, double dlogpdfpole ); /* Set value for logarithm of PDF and its derivative that are used whenever a pole of the underlying distribution is detected (i.e., when the PDF of the underlying distribution returns UNUR_INFINITY). Default: @code{-UNUR_INFINITY} and @code{UNUR_INFINITY}, respectively. */ /* ==DOC Additionally most of the set and get calls for continuous univariate distributions work. The most important exceptions are that the PDF and CDF cannot be changed and unur_distr_cont_upd_mode() uses in any way a (slow) numerical method that might fail. */ #define unur_distr_cxtrans_get_pdf(distr) unur_distr_cont_get_pdf((distr)) /* UNUR_FUNCT_CONT *unur_distr_cxtrans_get_pdf( UNUR_DISTR *distribution ); */ #define unur_distr_cxtrans_get_dpdf(distr) unur_distr_cont_get_dpdf((distr)) /* UNUR_FUNCT_CONT *unur_distr_cxtrans_get_dpdf( UNUR_DISTR *distribution ); */ #define unur_distr_cxtrans_get_cdf(distr) unur_distr_cont_get_cdf((distr)) /* UNUR_FUNCT_CONT *unur_distr_cxtrans_get_cdf( UNUR_DISTR *distribution ); */ /* Get the respective pointer to the PDF, the derivative of the PDF and the CDF of the distribution, respectively. The pointer is of type @code{double funct(double x, UNUR_DISTR *distr)}. If the corresponding function is not available for the distribution, the NULL pointer is returned. See also unur_distr_cont_get_pdf(). (Macro) */ #define unur_distr_cxtrans_eval_pdf(x,distr) unur_distr_cont_eval_pdf((x),(distr)) /* double unur_distr_cxtrans_eval_pdf( double x, UNUR_DISTR *distribution ); */ #define unur_distr_cxtrans_eval_dpdf(x,distr) unur_distr_cont_eval_dpdf((x),(distr)) /* double unur_distr_cxtrans_eval_dpdf( double x, UNUR_DISTR *distribution ); */ #define unur_distr_cxtrans_eval_cdf(x,distr) unur_distr_cont_eval_cdf((x),(distr)) /* double unur_distr_cxtrans_eval_cdf( double x, UNUR_DISTR *distribution ); */ /* Evaluate the PDF, derivative of the PDF. and the CDF, respectively, at @var{x}. Notice that @var{distribution} must not be the NULL pointer. If the corresponding function is not available for the distribution, @code{UNUR_INFINITY} is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. See also unur_distr_cont_eval_pdf(). (Macro) @emph{IMPORTANT:} In the case of a truncated standard distribution these calls always return the respective values of the @emph{untruncated} distribution! */ int unur_distr_cxtrans_set_domain( UNUR_DISTR *distribution, double left, double right ); /* Set the left and right borders of the domain of the distribution. When the exponential transformation is used (i.e. @var{alpha} is set to @code{UNUR_INFINITY}), then the domain must be a subset of positive numbers. See unur_distr_cont_set_domain() for more details. @emph{Important:} The domain of the transformed random variate may be different from the domain of the underlying random variate. */ #define unur_distr_cxtrans_get_domain(distr,left,right) unur_distr_cont_get_domain((distr),(left),(right)) /* int unur_distr_cxtrans_get_domain( UNUR_DISTR *distribution, double *left, double *right ); */ /* Get the left and right borders of the domain of the distribution. See unur_distr_cont_get_domain() for details. (Macro) */ #define unur_distr_cxtrans_get_truncated(distr,left,right) unur_distr_cont_get_truncated((distr),(left),(right)) /* int unur_distr_cxtrans_get_truncated( UNUR_DISTR *distribution, double *left, double *right ); */ /* Get the left and right borders of the (truncated) domain of the distribution. See unur_distr_cont_get_truncated() for details. (Macro) @emph{Important:} The domain of the transformed random variate may be different from the domain of the underlying random variate. */ /* ==DOC @subsubheading Derived parameters The following paramters @strong{must} be set whenever one of the essential parameters has been set or changed (and the parameter is required for the chosen method). */ #define unur_distr_cxtrans_set_mode(distr,mode) unur_distr_cont_set_mode((distr),(mode)) /* int unur_distr_cxtrans_set_mode( UNUR_DISTR *distribution, double mode ); */ /* Set mode of distribution. See also unur_distr_cxtrans_set_mode(). (Macro) */ #define unur_distr_cxtrans_upd_mode(distr) unur_distr_cont_upd_mode((distr)) /* double unur_distr_cxtrans_upd_mode( UNUR_DISTR *distribution ); */ /* Recompute the mode of the distribution numerically. Notice that this routine is slow and might not work properly in every case. See also unur_distr_cont_upd_mode() for further details. (Macro) */ #define unur_distr_cxtrans_get_mode(distr) unur_distr_cont_get_mode((distr)) /* double unur_distr_cxtrans_get_mode( UNUR_DISTR *distribution ); */ /* Get mode of distribution. See unur_distr_cont_get_mode() for details. (Macro) */ #define unur_distr_cxtrans_set_pdfarea(distr,area) unur_distr_cont_set_pdfarea((distr),(area)) /* int unur_distr_cxtrans_set_pdfarea( UNUR_DISTR *distribution, double area ); */ /* Set the area below the PDF. See unur_distr_cont_set_pdfarea() for details. (Macro) */ #define unur_distr_cxtrans_upd_pdfarea(distr) unur_distr_cont_upd_pdfarea((distr)) /* double unur_distr_cxtrans_upd_pdfarea( UNUR_DISTR *distribution ); */ /* Recompute the area below the PDF of the distribution. It only works for order statistics for distribution objects from the UNU.RAN library of standard distributions when the corresponding function is available. unur_distr_cont_upd_pdfarea() assumes that the PDF of the underlying distribution is normalized, i.e. it is the derivative of its CDF. Otherwise the computed area is wrong and there is @strong{no} warning about this failure. See unur_distr_cont_upd_pdfarea() for further details. (Macro) */ #define unur_distr_cxtrans_get_pdfarea(distr) unur_distr_cont_get_pdfarea((distr)) /* double unur_distr_cxtrans_get_pdfarea( UNUR_DISTR *distribution ); */ /* Get the area below the PDF of the distribution. See unur_distr_cont_get_pdfarea() for details. (Macro) */ /* =END */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distr/discr.c0000644001357500135600000021363314420445767013246 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: discr.c * * * * manipulate univariate discrete distribution objects * * * * return: * * UNUR_SUCCESS ... on success * * error code ... on error * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "distr_source.h" #include "distr.h" #include "discr.h" /*---------------------------------------------------------------------------*/ #define DISTR distr->data.discr /*---------------------------------------------------------------------------*/ /* Constants */ /* maximum size of domain for which the pmfsum is computed automatically */ #define MAX_PMF_DOMAIN_FOR_UPD_PMFSUM (1000) /*---------------------------------------------------------------------------*/ static double _unur_distr_discr_eval_pmf_tree( int k, const struct unur_distr *distr ); /*---------------------------------------------------------------------------*/ /* evaluate function tree for PMF. */ /*---------------------------------------------------------------------------*/ static double _unur_distr_discr_eval_cdf_tree( int k, const struct unur_distr *distr ); /*---------------------------------------------------------------------------*/ /* evaluate function tree for CDF. */ /*---------------------------------------------------------------------------*/ static void _unur_distr_discr_free( struct unur_distr *distr ); /*---------------------------------------------------------------------------*/ /* destroy distribution object. */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ static int _unur_distr_discr_find_mode( struct unur_distr *distr ); /*---------------------------------------------------------------------------*/ /* find mode of unimodal probability vector numerically by bisection. */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** univariate discrete distributions **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_discr_new( void ) /*----------------------------------------------------------------------*/ /* create a new (empty) distribution object */ /* type: univariate discete */ /* */ /* parameters: */ /* none */ /* */ /* return: */ /* pointer to distribution object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { register struct unur_distr *distr; register int i; /* get empty distribution object */ distr = _unur_distr_generic_new(); if (!distr) return NULL; /* set magic cookie */ COOKIE_SET(distr,CK_DISTR_DISCR); /* set type of distribution */ distr->type = UNUR_DISTR_DISCR; /* set id to generic distribution */ distr->id = UNUR_DISTR_GENERIC; /* dimension of random vector */ distr->dim = 1; /* univariant */ /* destructor */ distr->destroy = _unur_distr_discr_free; /* clone */ distr->clone = _unur_distr_discr_clone; /* set defaults */ /* finite probability vector */ DISTR.pv = NULL; /* probability vector (PV) */ DISTR.n_pv = 0; /* length of PV */ /* probability mass function */ DISTR.pmf = NULL; /* pointer to PMF */ DISTR.cdf = NULL; /* pointer to CDF */ DISTR.invcdf = NULL; /* pointer to inverse CDF */ DISTR.init = NULL; /* pointer to special init routine */ DISTR.set_params= NULL; /* funct for setting parameters and domain*/ DISTR.n_params = 0; /* number of parameters of the pmf */ /* initialize parameters of the PMF */ for (i=0; idata.discr struct unur_distr *clone; /* check arguments */ _unur_check_NULL( NULL, distr, NULL ); _unur_check_distr_object( distr, DISCR, NULL ); /* allocate memory */ clone = _unur_xmalloc( sizeof(struct unur_distr) ); /* copy distribution object into clone */ memcpy( clone, distr, sizeof( struct unur_distr ) ); /* copy function trees into generator object (when there is one) */ CLONE.pmftree = (DISTR.pmftree) ? _unur_fstr_dup_tree(DISTR.pmftree) : NULL; CLONE.cdftree = (DISTR.cdftree) ? _unur_fstr_dup_tree(DISTR.cdftree) : NULL; /* copy probability vector into generator object (when there is one) */ if (DISTR.pv) { CLONE.pv = _unur_xmalloc( DISTR.n_pv * sizeof(double) ); memcpy( CLONE.pv, DISTR.pv, DISTR.n_pv * sizeof(double) ); } /* copy user name for distribution */ if (distr->name_str) { size_t len = strlen(distr->name_str) + 1; clone->name_str = _unur_xmalloc(len); memcpy( clone->name_str, distr->name_str, len ); clone->name = clone->name_str; } return clone; #undef CLONE } /* end of _unur_distr_discr_clone() */ /*---------------------------------------------------------------------------*/ void _unur_distr_discr_free( struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* free distribution object */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /*----------------------------------------------------------------------*/ { /* check arguments */ if( distr == NULL ) /* nothing to do */ return; _unur_check_distr_object( distr, DISCR, RETURN_VOID ); if (DISTR.pmftree) _unur_fstr_free(DISTR.pmftree); if (DISTR.cdftree) _unur_fstr_free(DISTR.cdftree); if (DISTR.pv) free( DISTR.pv ); /* user name for distribution */ if (distr->name_str) free(distr->name_str); COOKIE_CLEAR(distr); free( distr ); } /* end of unur_distr_discr_free() */ /*---------------------------------------------------------------------------*/ int unur_distr_discr_set_pv( struct unur_distr *distr, const double *pv, int n_pv ) /*----------------------------------------------------------------------*/ /* set probability vector for distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* pv ... pointer to PV */ /* n_pv ... length of PV */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, DISCR, UNUR_ERR_DISTR_INVALID ); /* it is not possible to set a PV when a PMF is given. */ if (DISTR.pmf != NULL || DISTR.cdf != NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_SET,"PMF/CDF given, cannot set PV"); return UNUR_ERR_DISTR_SET; } /* check new parameter for distribution */ if (n_pv < 0) { _unur_error(distr->name,UNUR_ERR_DISTR_SET,"length of PV"); return UNUR_ERR_DISTR_SET; } /* n_pv must not be too large */ if ( (DISTR.domain[0] > 0) && ((unsigned)DISTR.domain[0] + (unsigned)n_pv > INT_MAX) ) { /* n_pv too large, causes overflow */ _unur_error(distr->name,UNUR_ERR_DISTR_SET,"length of PV too large, overflow"); return UNUR_ERR_DISTR_SET; } DISTR.domain[1] = DISTR.domain[0] + n_pv - 1; /* we do not check non-negativity of p.v. (it is cheaper to do it when unur_init() is called */ /* allocate memory for probability vector */ DISTR.pv = _unur_xrealloc( DISTR.pv, n_pv * sizeof(double) ); if (!DISTR.pv) return UNUR_ERR_MALLOC; /* copy probability vector */ memcpy( DISTR.pv, pv, n_pv * sizeof(double) ); DISTR.n_pv = n_pv; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_distr_discr_set_pv() */ /*---------------------------------------------------------------------------*/ int unur_distr_discr_make_pv( struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* compute probability vector */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* length of probability vector */ /* */ /* error: */ /* return 0 */ /*----------------------------------------------------------------------*/ { double *pv; /* pointer to probability vector */ int n_pv; /* length of PV */ double cdf, cdf_old; /* cumulated sum of PV */ double thresh_cdf; /* threshold for truncating PV */ int valid; /* whether cumputed PV is valid */ int i; /* check arguments */ _unur_check_NULL( NULL, distr, 0 ); _unur_check_distr_object( distr, DISCR, 0 ); /* PMF or CDF required */ if ( DISTR.pmf == NULL && DISTR.cdf == NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_GET,"PMF or CDF"); return 0; } /* if there exists a PV, it has to be removed */ if (DISTR.pv != NULL) { free(DISTR.pv); DISTR.n_pv = 0; } /* compute PV */ if ((unsigned)DISTR.domain[1] - (unsigned)DISTR.domain[0] < UNUR_MAX_AUTO_PV ) { /* first case: bounded domain */ n_pv = DISTR.domain[1] - DISTR.domain[0] + 1; pv = _unur_xmalloc( n_pv * sizeof(double) ); if (DISTR.pmf) { for (i=0; i= UNUR_MAX_AUTO_PV - 1) ) { /* we can have a PV of length UNUR_MAX_AUTO_PV */ size_alloc = MALLOC_SIZE; max_alloc = UNUR_MAX_AUTO_PV; } else { /* length of PV must be shorter than UNUR_MAX_AUTO_PV */ size_alloc = max_alloc = INT_MAX - DISTR.domain[0]; } /* init counter */ n_pv = 0; pv = NULL; valid = FALSE; /* created PV is empty yet and not valid */ cdf = 0.; /* cumulated sum of PV */ cdf_old = 0.; /* cumulated sum of PV in last iteration */ /* threshold for truncating PV */ thresh_cdf = (distr->set & UNUR_DISTR_SET_PMFSUM) ? (1.-1.e-8)*DISTR.sum : UNUR_INFINITY; /* compute PV */ for (n_alloc = size_alloc; n_alloc <= max_alloc; n_alloc += size_alloc) { pv = _unur_xrealloc( pv, n_alloc * sizeof(double) ); if (DISTR.pmf) { for (i=0; i thresh_cdf) { valid = TRUE; break; } } } else if (DISTR.cdf) { for (i=0; i thresh_cdf) { valid = TRUE; break; } } } if (cdf > thresh_cdf) break; } if (distr->set & UNUR_DISTR_SET_PMFSUM) { /* make a warning if computed PV might not be valid */ if (valid != TRUE) /* not successful */ _unur_warning(distr->name,UNUR_ERR_DISTR_GET,"PV truncated"); } else { /* PMFSUM not known */ /* assume we have the important part of distribution */ valid = TRUE; DISTR.sum = cdf; distr->set |= UNUR_DISTR_SET_PMFSUM; } #undef MALLOC_SIZE } /* store vector */ DISTR.pv = pv; DISTR.n_pv = n_pv; DISTR.domain[1] = DISTR.domain[0] + n_pv - 1; /* o.k. */ return (valid) ? n_pv : -n_pv; } /* end of unur_distr_discr_make_pv() */ /*---------------------------------------------------------------------------*/ int unur_distr_discr_get_pv( const struct unur_distr *distr, const double **pv ) /*----------------------------------------------------------------------*/ /* get length of probability vector and set pointer to probability */ /* vector */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* pv ... pointer to probability vector */ /* */ /* return: */ /* length of probability vector */ /* */ /* error: */ /* return 0 */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, 0 ); _unur_check_distr_object( distr, DISCR, 0 ); *pv = (DISTR.pv) ? DISTR.pv : NULL; return DISTR.n_pv; } /* end of unur_distr_discr_get_pv() */ /*---------------------------------------------------------------------------*/ double unur_distr_discr_eval_pv( int k, const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* returns the value of the probability vector at k or, if there is no */ /* probability vector defined, evaluates the pmf */ /* */ /* parampeters: */ /* k ... argument for probability vector of pmf */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* pv[k] or pmf(k) */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_INFINITY ); _unur_check_distr_object( distr, DISCR, UNUR_INFINITY ); if (DISTR.pv != NULL) { /* use probability vector */ if (k < DISTR.domain[0] || k > DISTR.domain[1]) return 0.; else return (DISTR.pv[k-DISTR.domain[0]]); } if (DISTR.pmf != NULL) { /* use PMF */ double px = _unur_discr_PMF(k,distr); if (_unur_isnan(px)) { _unur_warning(distr->name,UNUR_ERR_DISTR_DATA,"PMF returns NaN"); return 0.; } else return px; } /* else: data missing */ _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); return UNUR_INFINITY; } /* end of unur_distr_discr_eval_pv() */ /*---------------------------------------------------------------------------*/ int unur_distr_discr_set_pmf( struct unur_distr *distr, UNUR_FUNCT_DISCR *pmf ) /*----------------------------------------------------------------------*/ /* set PMF of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* pmf ... pointer to PMF */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_NULL( distr->name, pmf, UNUR_ERR_NULL ); _unur_check_distr_object( distr, DISCR, UNUR_ERR_DISTR_INVALID ); /* it is not possible to set both a PMF and a PV */ if (DISTR.pv != NULL) { _unur_warning(distr->name,UNUR_ERR_DISTR_SET,"delete exisiting PV"); free(DISTR.pv); DISTR.n_pv = 0; } /* we do not allow overwriting a PMF */ if (DISTR.pmf != NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of PMF not allowed"); return UNUR_ERR_DISTR_SET; } /* changelog */ distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; /* derived parameters like mode, sum, etc. might be wrong now! */ DISTR.pmf = pmf; return UNUR_SUCCESS; } /* end of unur_distr_discr_set_pmf() */ /*---------------------------------------------------------------------------*/ int unur_distr_discr_set_cdf( struct unur_distr *distr, UNUR_FUNCT_DISCR *cdf ) /*----------------------------------------------------------------------*/ /* set CDF of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* cdf ... pointer to CDF */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_NULL( distr->name, cdf, UNUR_ERR_NULL ); _unur_check_distr_object( distr, DISCR, UNUR_ERR_DISTR_INVALID ); /* it is not possible to set both a CDF and a PV */ if (DISTR.pv != NULL) { _unur_warning(distr->name,UNUR_ERR_DISTR_SET,"delete exisiting PV"); free(DISTR.pv); DISTR.n_pv = 0; } /* we do not allow overwriting a CDF */ if (DISTR.cdf != NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of CDF not allowed"); return UNUR_ERR_DISTR_SET; } /* changelog */ distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; /* derived parameters like mode, sum, etc. might be wrong now! */ DISTR.cdf = cdf; return UNUR_SUCCESS; } /* end of unur_distr_discr_set_cdf() */ /*---------------------------------------------------------------------------*/ int unur_distr_discr_set_invcdf( struct unur_distr *distr, UNUR_IFUNCT_DISCR *invcdf ) /*----------------------------------------------------------------------*/ /* set inverse CDF of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* invcdf ... pointer to inverse CDF */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_NULL( distr->name, invcdf,UNUR_ERR_NULL ); _unur_check_distr_object( distr, DISCR, UNUR_ERR_DISTR_INVALID ); /* we do not allow overwriting an inverse cdf */ if (DISTR.invcdf != NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of inverse CDF not allowed"); return UNUR_ERR_DISTR_SET; } /* for derived distributions (e.g. order statistics) not possible */ if (distr->base) return UNUR_ERR_DISTR_INVALID; /* changelog */ distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; /* derived parameters like mode, area, etc. might be wrong now! */ DISTR.invcdf = invcdf; return UNUR_SUCCESS; } /* end of unur_distr_discr_set_invcdf() */ /*---------------------------------------------------------------------------*/ UNUR_FUNCT_DISCR * unur_distr_discr_get_pmf( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get pointer to PMF of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* pointer to PMF */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, NULL ); _unur_check_distr_object( distr, DISCR, NULL ); return DISTR.pmf; } /* end of unur_distr_discr_get_pmf() */ /*---------------------------------------------------------------------------*/ UNUR_FUNCT_DISCR * unur_distr_discr_get_cdf( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get pointer to CDF of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* pointer to CDF */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, NULL ); _unur_check_distr_object( distr, DISCR, NULL ); return DISTR.cdf; } /* end of unur_distr_discr_get_cdf() */ /*---------------------------------------------------------------------------*/ UNUR_IFUNCT_DISCR * unur_distr_discr_get_invcdf( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get pointer to inverse CDF of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* pointer to inverse CDF */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, NULL ); _unur_check_distr_object( distr, DISCR, NULL ); return DISTR.invcdf; } /* end of unur_distr_discr_get_invcdf() */ /*---------------------------------------------------------------------------*/ double unur_distr_discr_eval_pmf( int k, const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* evaluate PMF of distribution at k */ /* */ /* parameters: */ /* k ... argument for pmf */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* pmf(k) */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_INFINITY ); _unur_check_distr_object( distr, DISCR, UNUR_INFINITY ); if (DISTR.pmf == NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); return UNUR_INFINITY; } return _unur_discr_PMF(k,distr); } /* end of unur_distr_discr_eval_pmf() */ /*---------------------------------------------------------------------------*/ double unur_distr_discr_eval_cdf( int k, const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* evaluate CDF of distribution at k */ /* */ /* parameters: */ /* k ... argument for CDF */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* CDF(k) */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_INFINITY ); _unur_check_distr_object( distr, DISCR, UNUR_INFINITY ); if (DISTR.cdf == NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); return UNUR_INFINITY; } return _unur_discr_CDF(k,distr); } /* end of unur_distr_discr_eval_cdf() */ /*---------------------------------------------------------------------------*/ int unur_distr_discr_eval_invcdf( double u, const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* evaluate inverse CDF of distribution at u */ /* */ /* parameters: */ /* u ... argument for inverse CDF */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* invcdf(u) */ /* INT_MAX ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, INT_MAX ); _unur_check_distr_object( distr, DISCR, INT_MAX ); if (DISTR.invcdf == NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); return INT_MAX; } if (u<=0.) return DISTR.domain[0]; if (u>=1.) return DISTR.domain[1]; else return _unur_discr_invCDF(u,distr); } /* end of unur_distr_discr_eval_invcdf() */ /*---------------------------------------------------------------------------*/ int unur_distr_discr_set_pmfstr( struct unur_distr *distr, const char *pmfstr ) /*----------------------------------------------------------------------*/ /* set PMF of distribution via a string interface */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* pmfstr ... string that describes function term of PMF */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, DISCR, UNUR_ERR_DISTR_INVALID ); _unur_check_NULL( NULL, pmfstr, UNUR_ERR_NULL ); /* it is not possible to set a PMF when a PV is given. */ if (DISTR.pv != NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_SET,"PV given, cannot set PMF"); return UNUR_ERR_DISTR_SET; } /* we do not allow overwriting a PMF */ if (DISTR.pmf != NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of PMF not allowed"); return UNUR_ERR_DISTR_SET; } /* for derived distributions (e.g. order statistics) not possible */ if (distr->base) return UNUR_ERR_DISTR_DATA; /* changelog */ distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; /* derived parameters like mode, area, etc. might be wrong now! */ /* parse PMF string */ if ( (DISTR.pmftree = _unur_fstr2tree(pmfstr)) == NULL ) { _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Syntax error in function string"); return UNUR_ERR_DISTR_SET; } DISTR.pmf = _unur_distr_discr_eval_pmf_tree; return UNUR_SUCCESS; } /* end of unur_distr_discr_set_pmfstr() */ /*---------------------------------------------------------------------------*/ int unur_distr_discr_set_cdfstr( struct unur_distr *distr, const char *cdfstr ) /*----------------------------------------------------------------------*/ /* set CDF of distribution via a string interface */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* cdfstr ... string that describes function term of CDF */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, DISCR, UNUR_ERR_DISTR_INVALID ); _unur_check_NULL( NULL, cdfstr, UNUR_ERR_NULL ); /* we do not allow overwriting a CDF */ if (DISTR.cdf != NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of CDF not allowed"); return UNUR_ERR_DISTR_SET; } /* for derived distributions (e.g. order statistics) not possible */ if (distr->base) return UNUR_ERR_DISTR_DATA; /* changelog */ distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; /* derived parameters like mode, area, etc. might be wrong now! */ /* parse string */ if ( (DISTR.cdftree = _unur_fstr2tree(cdfstr)) == NULL ) { _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Syntax error in function string"); return UNUR_ERR_DISTR_SET; } /* set evaluation function */ DISTR.cdf = _unur_distr_discr_eval_cdf_tree; return UNUR_SUCCESS; } /* end of unur_distr_discr_set_cdfstr() */ /*---------------------------------------------------------------------------*/ double _unur_distr_discr_eval_pmf_tree( int k, const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* evaluate function tree for PMF. */ /* */ /* parameters: */ /* k ... argument for PMF */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* PMF at k */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_INFINITY ); _unur_check_distr_object( distr, DISCR, UNUR_INFINITY ); return ((DISTR.pmftree) ? _unur_fstr_eval_tree(DISTR.pmftree,(double)k) : 0.); } /* end of _unur_distr_discr_eval_pmf_tree() */ /*---------------------------------------------------------------------------*/ double _unur_distr_discr_eval_cdf_tree( int k, const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* evaluate function tree for CDF. */ /* */ /* parameters: */ /* k ... argument for CDF */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* CDF at k */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_INFINITY ); _unur_check_distr_object( distr, DISCR, UNUR_INFINITY ); return ((DISTR.cdftree) ? _unur_fstr_eval_tree(DISTR.cdftree,(double)k) : 0.); } /* end of _unur_distr_discr_eval_cdf_tree() */ /*---------------------------------------------------------------------------*/ char * unur_distr_discr_get_pmfstr( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get PMF string that is given via the string interface */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* pointer to resulting string. */ /* */ /* comment: */ /* This string should be freed when it is not used any more. */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, NULL ); _unur_check_distr_object( distr, DISCR, NULL ); _unur_check_NULL( NULL, DISTR.pmftree, NULL ); /* make and return string */ return _unur_fstr_tree2string(DISTR.pmftree,"x","PMF",TRUE); } /* end of unur_distr_discr_get_pmfstr() */ /*---------------------------------------------------------------------------*/ char * unur_distr_discr_get_cdfstr( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get CDF string that is given via the string interface */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* pointer to resulting string. */ /* */ /* comment: */ /* This string should be freed when it is not used any more. */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, NULL ); _unur_check_distr_object( distr, DISCR, NULL ); _unur_check_NULL( NULL, DISTR.cdftree, NULL ); /* make and return string */ return _unur_fstr_tree2string(DISTR.cdftree,"x","CDF",TRUE); } /* end of unur_distr_discr_get_cdfstr() */ /*---------------------------------------------------------------------------*/ int unur_distr_discr_set_pmfparams( struct unur_distr *distr, const double *params, int n_params ) /*----------------------------------------------------------------------*/ /* set array of parameters for distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* params ... list of arguments */ /* n_params ... number of arguments */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, DISCR, UNUR_ERR_DISTR_INVALID ); if (n_params>0) _unur_check_NULL(distr->name, params, UNUR_ERR_NULL); /* first check number of new parameter for the distribution */ if (n_params < 0 || n_params > UNUR_DISTR_MAXPARAMS ) { _unur_error(NULL,UNUR_ERR_DISTR_NPARAMS,""); return UNUR_ERR_DISTR_NPARAMS; } /* changelog */ distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; /* derived parameters like mode, area, etc. might be wrong now! */ /* even if the set routine fails, the derived parameters are marked as unknown. but this is o.k. since in this case something has been wrong. */ /* use special routine for setting parameters (if there is one) */ if (DISTR.set_params) return (DISTR.set_params(distr,params,n_params)); /* otherwise simply copy parameters */ DISTR.n_params = n_params; if (n_params) memcpy( DISTR.params, params, n_params*sizeof(double) ); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_distr_discr_set_pmfparams() */ /*---------------------------------------------------------------------------*/ int unur_distr_discr_get_pmfparams( const struct unur_distr *distr, const double **params ) /*----------------------------------------------------------------------*/ /* get number of pmf parameters and sets pointer to array params[] of */ /* parameters */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* params ... pointer to list of arguments */ /* */ /* return: */ /* number of pmf parameters */ /* */ /* error: */ /* return 0 */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, 0 ); _unur_check_distr_object( distr, DISCR, 0 ); *params = (DISTR.n_params) ? DISTR.params : NULL; return DISTR.n_params; } /* end of unur_distr_discr_get_pmfparams() */ /*---------------------------------------------------------------------------*/ int unur_distr_discr_set_domain( struct unur_distr *distr, int left, int right ) /*----------------------------------------------------------------------*/ /* set the left and right borders of the domain of the distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* left ... left boundary point */ /* right ... right boundary point */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* INT_MIN and INT_MAX are interpreted as (minus) infinity */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, DISCR, UNUR_ERR_DISTR_INVALID ); /* check new parameter for distribution */ if (left >= right) { _unur_error(distr->name,UNUR_ERR_DISTR_SET,"domain, left >= right"); return UNUR_ERR_DISTR_SET; } /* store data */ DISTR.trunc[0] = DISTR.domain[0] = left; DISTR.trunc[1] = DISTR.domain[1] = (DISTR.pv == NULL) ? right : left+DISTR.n_pv-1; /* changelog */ distr->set |= UNUR_DISTR_SET_DOMAIN; /* if distr is an object for a standard distribution, this */ /* not the original domain of it. (not a "standard domain") */ /* However, since we have changed the domain, we assume */ /* that this is not a truncated distribution. */ /* At last we have to mark all derived parameters as unknown */ distr->set &= ~(UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_TRUNCATED | UNUR_DISTR_SET_MASK_DERIVED ); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_distr_discr_set_domain() */ /*---------------------------------------------------------------------------*/ int unur_distr_discr_get_domain( const struct unur_distr *distr, int *left, int *right ) /*----------------------------------------------------------------------*/ /* set the left and right borders of the domain of the distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* left ... left boundary point */ /* right ... right boundary point */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* INT_MIN and INT_MAX are interpreted as (minus) infinity */ /* if no boundaries have been set [INT_MIN, INT_MAX] is returned. */ /*----------------------------------------------------------------------*/ { /* in case of error the boundaries are set to +/- UNUR_INFINITY */ *left = INT_MIN; *right = INT_MAX; /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, DISCR, UNUR_ERR_DISTR_INVALID ); /* o.k. */ *left = DISTR.domain[0]; *right = DISTR.domain[1]; return UNUR_SUCCESS; } /* end of unur_distr_discr_get_domain() */ /*---------------------------------------------------------------------------*/ int unur_distr_discr_set_mode( struct unur_distr *distr, int mode ) /*----------------------------------------------------------------------*/ /* set mode of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* mode ... mode of PMF */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, DISCR, UNUR_ERR_DISTR_INVALID ); DISTR.mode = mode; /* changelog */ distr->set |= UNUR_DISTR_SET_MODE; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_distr_discr_set_mode() */ /*---------------------------------------------------------------------------*/ int unur_distr_discr_upd_mode( struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* (re-) compute mode of distribution (if possible) */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, DISCR, UNUR_ERR_DISTR_INVALID ); if (DISTR.upd_mode == NULL) { /* no function to compute mode available */ _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); return UNUR_ERR_DISTR_DATA; } /* compute mode */ if ((DISTR.upd_mode)(distr)==UNUR_SUCCESS) { /* changelog */ distr->set |= UNUR_DISTR_SET_MODE; return UNUR_SUCCESS; } else { /* computing of mode failed */ _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); return UNUR_ERR_DISTR_DATA; } } /* end of unur_distr_discr_upd_mode() */ /*---------------------------------------------------------------------------*/ int unur_distr_discr_get_mode( struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get mode of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* mode of distribution */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, INT_MAX ); _unur_check_distr_object( distr, DISCR, INT_MAX ); /* mode known ? */ if ( !(distr->set & UNUR_DISTR_SET_MODE) ) { /* try to compute mode */ if (DISTR.upd_mode == NULL) { /* no function to compute mode available */ _unur_error(distr->name,UNUR_ERR_DISTR_GET,"mode"); return INT_MAX; } else { /* compute mode */ if (unur_distr_discr_upd_mode(distr)!=UNUR_SUCCESS) { /* finding mode not successfully */ _unur_error(distr->name,UNUR_ERR_DISTR_GET,"mode"); return INT_MAX; } } } return DISTR.mode; } /* end of unur_distr_discr_get_mode() */ /*---------------------------------------------------------------------------*/ int unur_distr_discr_set_pmfsum( struct unur_distr *distr, double sum ) /*----------------------------------------------------------------------*/ /* set sum over PMF */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* sum ... sum over PMF */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, DISCR, UNUR_ERR_DISTR_INVALID ); /* check new parameter for distribution */ if (sum <= 0.) { _unur_error(distr->name,UNUR_ERR_DISTR_SET,"pmf sum <= 0"); return UNUR_ERR_DISTR_SET; } DISTR.sum = sum; /* changelog */ distr->set |= UNUR_DISTR_SET_PMFSUM; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_distr_discr_set_pmfsum() */ /*---------------------------------------------------------------------------*/ int unur_distr_discr_upd_pmfsum( struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* (re-) compute sum over PMF of distribution (if possible) */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { double sum = 0.; int k, left, right, length; /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, DISCR, UNUR_ERR_DISTR_SET ); /* changelog */ distr->set |= UNUR_DISTR_SET_PMFSUM; if (DISTR.upd_sum != NULL) { /* try function given by distribution */ if ((DISTR.upd_sum)(distr)==UNUR_SUCCESS) return UNUR_SUCCESS; } /* no function to compute sum available */ left = DISTR.domain[0]; right = DISTR.domain[1]; length = right - left; /* remark: length < 0 if right-left overflows */ if (DISTR.cdf != NULL) { /* use CDF */ if (left > INT_MIN) left -= 1; DISTR.sum = _unur_discr_CDF(right,distr) - _unur_discr_CDF(left,distr); return UNUR_SUCCESS; } if (DISTR.pv != NULL) { for (k = 0; k<= length; k++) /* use probability vector */ sum += DISTR.pv[k]; DISTR.sum = sum; return UNUR_SUCCESS; } if (DISTR.pmf != NULL && length > 0 && length <= MAX_PMF_DOMAIN_FOR_UPD_PMFSUM) { /* use PMF */ for (k = left; k<= right; k++) sum += _unur_discr_PMF(k,distr); DISTR.sum = sum; return UNUR_SUCCESS; } /* error: data missing */ distr->set &= ~UNUR_DISTR_SET_PMFSUM; _unur_error(distr->name,UNUR_ERR_DISTR_DATA,"Cannot compute sum"); return UNUR_ERR_DISTR_DATA; } /* end of unur_distr_discr_upd_pmfsum() */ /*---------------------------------------------------------------------------*/ double unur_distr_discr_get_pmfsum( struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get sum over PMF of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* sum over PMF of distribution */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_INFINITY ); _unur_check_distr_object( distr, DISCR, UNUR_INFINITY ); /* sum known ? */ if ( !(distr->set & UNUR_DISTR_SET_PMFSUM) ) { /* try to compute sum */ if ( unur_distr_discr_upd_pmfsum(distr) != UNUR_SUCCESS ) { _unur_error(distr->name,UNUR_ERR_DISTR_GET,"sum"); return UNUR_INFINITY; } } return DISTR.sum; } /* end of unur_distr_discr_get_pmfsum() */ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ void _unur_distr_discr_debug( const struct unur_distr *distr, const char *genid, unsigned printvector ) /*----------------------------------------------------------------------*/ /* write info about distribution into LOG file */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* genid ... pointer to generator id */ /* printvector ... whether the probability vector (if given) */ /*----------------------------------------------------------------------*/ { FILE *LOG; int i; /* check arguments */ CHECK_NULL(distr,RETURN_VOID); COOKIE_CHECK(distr,CK_DISTR_DISCR,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s: distribution:\n",genid); fprintf(LOG,"%s:\ttype = discrete univariate distribution\n",genid); fprintf(LOG,"%s:\tname = %s\n",genid,distr->name); if ( DISTR.pmf ) { /* have probability mass function */ fprintf(LOG,"%s:\tPMF with %d argument(s)\n",genid,DISTR.n_params); for( i=0; i0) { /* have probability vector */ fprintf(LOG,"%s:\tprobability vector of length %d",genid,DISTR.n_pv); if (printvector) { for (i=0; i0) { /* have probability vector */ fprintf(LOG,"%s:\tdomain for pv = (%d, %d)",genid,DISTR.domain[0],DISTR.domain[0]-1+DISTR.n_pv); _unur_print_if_default(distr,UNUR_DISTR_SET_DOMAIN); fprintf(LOG,"\n%s:\n",genid); } if (distr->set & UNUR_DISTR_SET_MODE) fprintf(LOG,"%s:\tmode = %d\n",genid,DISTR.mode); else fprintf(LOG,"%s:\tmode unknown\n",genid); if (distr->set & UNUR_DISTR_SET_PMFSUM) fprintf(LOG,"%s:\tsum over PMF = %g\n",genid,DISTR.sum); else fprintf(LOG,"%s:\tsum over PMF unknown\n",genid); fprintf(LOG,"%s:\n",genid); } /* end of _unur_distr_discr_debug() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ int _unur_distr_discr_find_mode(struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* find mode of a probability vector by bisection. */ /* */ /* Assumptions: PMF is unimodal, no "inflexion" ("saddle") points. */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { #define N_TRIALS (100) int x[3]; /* bracket for mode x[0] < x[1] < x[2] */ double fx[3]; /* PMF values at bracket points */ int xnew; /* new point in iteration */ double fxnew; /* PMF value at new point */ int step; /* auxiliary variable for searching point */ int this, other; /* side of bracket under consideration */ int cutthis; /* which side of bracket should be cut */ const double r = (sqrt(5.)-1.)/2.; /* sectio aurea */ /* check arguments */ CHECK_NULL( distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, DISCR, UNUR_ERR_DISTR_INVALID ); /* left and right boundary point of bracket */ x[0] = DISTR.domain[0]; x[2] = DISTR.domain[1]; fx[0] = unur_distr_discr_eval_pv(x[0], distr); fx[2] = unur_distr_discr_eval_pv(x[2], distr); /* we assume for our algorithm that there are at least three points */ if (x[2] <= x[0] + 1) { /* we have one or two points only */ DISTR.mode = (fx[0] <= fx[2]) ? x[2] : x[0]; distr->set |= UNUR_DISTR_SET_MODE | UNUR_DISTR_SET_MODE_APPROX ; return UNUR_SUCCESS; } /* --- middle point of bracket ------------------------------------------- */ /* we have to find a middle point where the PMF is non-zero */ /* first trial: mean of boundary points */ x[1] = (x[0]/2) + (x[2]/2); if (x[1]<=x[0]) x[1]++; if (x[1]>=x[2]) x[1]--; fx[1] = unur_distr_discr_eval_pv(x[1], distr); /* second trial: start search from left boundary */ if ( !(fx[1]>0.)) { xnew = (DISTR.domain[0]!=INT_MIN) ? DISTR.domain[0] : 0; for (step = 1; step < N_TRIALS; step++) { xnew += step; if (xnew >= DISTR.domain[1]) break; if ((fxnew = unur_distr_discr_eval_pv(xnew,distr)) > 0.) { x[1] = xnew; fx[1] = fxnew; break; } } } /* third trial: start search from 0 */ if ( !(fx[1]>0.) && DISTR.domain[0]!=0) { xnew = 0; for (step = 1; step < N_TRIALS; step++) { xnew += step; if (xnew >= DISTR.domain[1]) break; if ((fxnew = unur_distr_discr_eval_pv(xnew,distr)) > 0.) { x[1] = xnew; fx[1] = fxnew; break; } } } /* forth trial: start search from right boundary */ if ( !(fx[1]>0.) && DISTR.domain[1]!=INT_MAX) { xnew = DISTR.domain[1]; for (step = 1; step < N_TRIALS; step++) { xnew -= step; if (xnew <= DISTR.domain[0]) break; if ((fxnew = unur_distr_discr_eval_pv(xnew,distr)) > 0.) { x[1] = xnew; fx[1] = fxnew; break; } } } if ( !(fx[1]>0.)) { _unur_error(distr->name,UNUR_ERR_DISTR_DATA, "find_mode(): no positive entry in PV found"); return UNUR_ERR_DISTR_DATA; } if (fx[1]name,UNUR_ERR_DISTR_DATA, "find_mode(): PV not unimodal"); return UNUR_ERR_DISTR_DATA; } /* --- middle point of bracket found ------------------------------------- */ /* --- interate until maximum is found ----------------------------------- */ while (1) { /* fprintf(stderr,"x = %d, %d, %d\n",x[0],x[1],x[2]); */ /* fprintf(stderr,"fx = %g, %g, %g\n",fx[0],fx[1],fx[2]); */ /* terminate */ if (x[0]+1 >= x[1] && x[1] >= x[2]-1) { DISTR.mode = (fx[0]>fx[2]) ? x[0] : x[2]; if (fx[1]>DISTR.mode) DISTR.mode = x[1]; distr->set |= UNUR_DISTR_SET_MODE | UNUR_DISTR_SET_MODE_APPROX ; return UNUR_SUCCESS; } /* new point */ xnew = (int) (r*x[0] + (1.-r)*x[2]); if (xnew == x[0]) ++xnew; if (xnew == x[2]) --xnew; if (xnew == x[1]) xnew += (x[1]-1==x[0]) ? 1 : -1; /* side of bracket */ if (xnew < x[1]) { this = 0; other = 2; } /* l.h.s. of bracket */ else { this = 2; other = 0; } /* r.h.s. of bracket */ /* value at new point */ fxnew = unur_distr_discr_eval_pv(xnew,distr); if ( fxnew < fx[0] && fxnew < fx[2] ) { _unur_error(distr->name,UNUR_ERR_DISTR_DATA, "find_mode(): PV not unimodal"); return UNUR_ERR_DISTR_DATA; } do { if (!_unur_FP_same(fxnew,fx[1])) { cutthis = (fxnew > fx[1]) ? FALSE : TRUE; break; } /* else: fxnew == fx[1] */ if (fx[this] > fx[1]) { cutthis = FALSE; break; } if (fx[other] > fx[1]) { cutthis = TRUE; break; } /* else: fx[0] < fxnew && fx[1] == fxnew && fx[2] < fxnew */ for (step = 1; step < N_TRIALS && xnew >= x[0] && xnew <= x[2]; step++) { xnew += (this==0) ? -1 : 1; fxnew = unur_distr_discr_eval_pv(xnew,distr); if (_unur_FP_less(fxnew,fx[1])) { DISTR.mode = x[1]; distr->set |= UNUR_DISTR_SET_MODE | UNUR_DISTR_SET_MODE_APPROX ; return UNUR_SUCCESS; } } _unur_error(distr->name,UNUR_ERR_DISTR_DATA, "find_mode(): PV not unimodal"); return UNUR_ERR_DISTR_DATA; } while (0); if (cutthis) { x[this] = xnew; fx[this] = fxnew; } else { x[other] = x[1]; fx[other] = fx[1]; x[1] = xnew; fx[1] = fxnew; } } /* --- end while(1) --- */ /* changelog */ /* distr->set |= UNUR_DISTR_SET_MODE | UNUR_DISTR_SET_MODE_APPROX ; */ /* o.k. */ /* return UNUR_SUCCESS; */ } /* end of _unur_distr_discr_find_mode() */ /*---------------------------------------------------------------------------*/ #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distr/Makefile.am0000644001357500135600000000125414420445767014024 00000000000000## Process this file with automake to produce Makefile.in AM_CPPFLAGS = \ -I$(top_srcdir)/src noinst_LTLIBRARIES = libdistr.la # Files that contain deprecated routines if ENABLE_DEPRECATED DEPRECATED_FILES = deprecated_distr.c deprecated_distr.h else DEPRECATED_FILES = endif libdistr_la_SOURCES = \ $(DEPRECATED_FILES) \ \ distr.c distr.h distr_info.c distr_struct.h distr_source.h \ cont.c cont.h \ corder.c corder.h \ cxtrans.c cxtrans.h \ cemp.c cemp.h \ cvec.c cvec.h \ condi.c condi.h \ cvemp.c cvemp.h\ discr.c discr.h \ matr.c matr.h # clean backup files CLEANFILES = *~ # clean generated files MAINTAINERCLEANFILES = \ Makefile.in unuran-1.11.0/src/distr/distr.h0000644001357500135600000003225514420445767013273 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: distr.h * * * * PURPOSE: * * function prototypes for manipulating distribution objects * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /* =NODEX Distribution_objects Handling distribution objects =UP TOP [30] =DESCRIPTION Objects of type @code{UNUR_DISTR} are used for handling distributions. All data about a distribution are stored in this object. UNU.RAN provides functions that return instances of such objects for standard distributions (@pxref{Stddist,,Standard distributions}). It is then possible to change these distribution objects by various set calls. Moreover, it is possible to build a distribution object entirely from scratch. For this purpose there exists @command{unur_distr__new} calls that return an empty object of this type for each object type (eg. univariate contiuous) which can be filled with the appropriate set calls. UNU.RAN distinguishes between several types of distributions, each of which has its own sets of possible parameters (for details see the corresponding sections): @itemize @minus @item continuous univariate distributions @item continuous univariate order statistics @item continuous empirical univariate distributions @item continuous multivariate distributions @item continuous empirical multivariate distributions @item matrix distributions @item discrete univariate distributions @end itemize Notice that there are essential data about a distribution, eg. the PDF, a list of (shape, scale, location) parameters for the distribution, and the domain of (the possibly truncated) distribution. And there exist parameters that are/can be derived from these, eg. the mode of the distribution or the area below the given PDF (which need not be normalized for many methods). UNU.RAN keeps track of parameters which are known. Thus if one of the essential parameters is changed all derived parameters are marked as unknown and must be set again if these are required for the chosen generation method. Additionally to set calls there are calls for updating derived parameters for objects provided by the UNU.RAN library of standard distributions (one for each parameter to avoid computational overhead since not all parameters are required for all generator methods). All parameters of distribution objects can be read by corresponding get calls. Every generator object has its own copy of a distribution object which is accessible by a unur_get_distr() call. Thus the parameter for this distribution can be read. However, @strong{never} extract the distribution object out of a generator object and run one of the set calls on it to modify the distribution. (How should the poor generator object know what has happend?) Instead there exist calls for each of the generator methods that change particular parameters of the internal copy of the distribution object. =HOWTOUSE UNU.RAN collects all data required for a particular generation method in a @emph{distribution object}. There are two ways to get an instance of a distributions object: @enumerate @item Build a distribtion from scratch, by means of the corresponding @command{unur_distr__new} call, where @command{} is the type of the distribution as listed in the below subsections. @item Use the corresponding @command{unur_distr__new} call to get prebuild distribution from the UNU.RAN library of standard distributions. Here @command{} is the name of the standard distribution in @ref{Stddist,,Standard distributions}. @end enumerate In either cases the corresponding @command{unur_distr__set_} calls to set the necessary parameters @command{} (case 1), or change the values of the standard distribution in case 2 (if this makes sense for you). In the latter case @command{} is the type to which the standard distribution belongs to. These @command{set} calls return @code{UNUR_SUCCESS} when the correspondig parameter has been set successfully. Otherwise an error code is returned. The parameters of a distribution are divided into @emph{essential} and @emph{derived} parameters. Notice, that there are some restrictions in setting parameters to avoid possible confusions. Changing essential parameters marks derived parameters as @code{unknown}. Some of the parameters cannot be changed any more when already set; some parameters block each others. In such a case a new instance of a distribution object has to be build. Additionally @command{unur_distr__upd_} calls can be used for updating derived parameters for objects provided by the UNU.RAN library of standard distributions. All parameters of a distribution object get be read by means of @command{unur_distr__get_} calls. Every distribution object be identified by its @code{name} which is a string of arbitrary characters provided by the user. For standard distribution it is automatically set to @command{} in the corresponding @command{new} call. It can be changed to any other string. =EON */ /*---------------------------------------------------------------------------*/ /* =NODEX AllDistr Functions for all kinds of distribution objects =UP Distribution_objects [05] =DESCRIPTION The calls in this section can be applied to all distribution objects. @itemize @minus @item Destroy @command{free} an instance of a generator object. @item Ask for the @command{type} of a generator object. @item Ask for the @command{dimension} of a generator object. @item Deal with the @command{name} (identifier string) of a generator object. @end itemize =END */ /*---------------------------------------------------------------------------*/ /* types of distribtuions */ enum { UNUR_DISTR_CONT = 0x010u, /* univariate continuous distribution */ UNUR_DISTR_CEMP = 0x011u, /* empirical univ. cont. distr. (a sample) */ UNUR_DISTR_CVEC = 0x110u, /* mulitvariate continuous distribution */ UNUR_DISTR_CVEMP = 0x111u, /* empirical multiv. cont. distr. (sample) */ UNUR_DISTR_MATR = 0x210u, /* matrix distribution */ UNUR_DISTR_DISCR = 0x020u /* univariate discrete distribution */ }; /*---------------------------------------------------------------------------*/ /* Parameters common to all distributions. */ /* =ROUTINES */ void unur_distr_free( UNUR_DISTR *distribution ); /* Destroy the @var{distribution} object. */ int unur_distr_set_name( UNUR_DISTR *distribution, const char *name ); /* */ const char *unur_distr_get_name( const UNUR_DISTR *distribution ); /* Set and get @var{name} of @var{distribution}. The @var{name} can be an arbitrary character string. It can be used to identify generator objects for the user. It is used by UNU.RAN when printing information of the distribution object into a log files. */ int unur_distr_get_dim( const UNUR_DISTR *distribution ); /* Get number of components of a random vector (its dimension) the @var{distribution}. For univariate distributions it returns dimension @code{1}. For matrix distributions it returns the number of components (i.e., number of rows times number of columns). When the respective numbers of rows and columns are needed use unur_distr_matr_get_dim() instead. */ unsigned int unur_distr_get_type( const UNUR_DISTR *distribution ); /* Get type of @var{distribution}. Possible types are @table @code @item UNUR_DISTR_CONT univariate continuous distribution @item UNUR_DISTR_CEMP empirical continuous univariate distribution (i.e. a sample) @item UNUR_DISTR_CVEC continuous mulitvariate distribution @item UNUR_DISTR_CVEMP empirical continuous multivariate distribution (i.e. a vector sample) @item UNUR_DISTR_DISCR discrete univariate distribution @item UNUR_DISTR_MATR matrix distribution @end table Alternatively the @command{unur_distr_is_} calls can be used. */ int unur_distr_is_cont( const UNUR_DISTR *distribution ); /* TRUE if @var{distribution} is a continuous univariate distribution. */ int unur_distr_is_cvec( const UNUR_DISTR *distribution ); /* TRUE if @var{distribution} is a continuous multivariate distribution. */ int unur_distr_is_cemp( const UNUR_DISTR *distribution ); /* TRUE if @var{distribution} is an empirical continuous univariate distribution, i.e. a sample. */ int unur_distr_is_cvemp( const UNUR_DISTR *distribution ); /* TRUE if @var{distribution} is an empirical continuous multivariate distribution. */ int unur_distr_is_discr( const UNUR_DISTR *distribution ); /* TRUE if @var{distribution} is a discrete univariate distribution. */ int unur_distr_is_matr( const UNUR_DISTR *distribution ); /* TRUE if @var{distribution} is a matrix distribution. */ int unur_distr_set_extobj( UNUR_DISTR *distribution, const void *extobj ); /* Store a pointer to an external object. This might be usefull if the PDF, PMF, CDF or other functions used to implement a particular distribution a parameter set that cannot be stored as doubles (e.g. pointers to some structure that holds information of the distribution). @strong{Important:} When UNU.RAN copies this distribution object into the generator object, then the address @var{extobj} that this pointer contains is simply copied. Thus the generator holds an address of a non-private object! Once the generator object has been created any change in the external object might effect the generator object. @strong{Warning:} External objects must be used with care. Once the generator object has been created or the distribution object has been copied you @emph{must not} destroy this external object. */ const void *unur_distr_get_extobj( const UNUR_DISTR *distribution ); /* Get the pointer to the external object. @emph{Important:} Changing this object must be done with with extreme care. */ /* =END */ /*---------------------------------------------------------------------------*/ UNUR_DISTR *unur_distr_clone( const UNUR_DISTR *distr ); /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distr/cvec.h0000644001357500135600000007616414420445767013075 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: cvec.h * * * * PURPOSE: * * function prototypes for manipulating distribution objects of * * type CVEC (continuous multivariate distribution) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* =NODEX CVEC Continuous multivariate distributions =UP Distribution_objects [30] =DESCRIPTION The following calls handle multivariate distributions. However, the requirements of particular generation methods is not as unique as for univariate distributions. Moreover, random vector generation methods are still under development. The below functions are a first attempt to handle this situation. Notice that some of the parameters -- when given carelessly -- might contradict to others. For example: Some methods require the marginal distribution and some methods need a standardized form of the marginal distributions, where the actual mean and variance is stored in the mean vector and the covariance matrix, respectively. We also have to mention that some methods might abuse some of the parameters. Please read the discription of the chosen sampling method carfully. The following kind of calls exists: @itemize @minus @item Create a @command{new} instance of a continuous multivariate distribution; @item Handle and evaluate probability density function (PDF, @command{pdf}) and the gradient of the density function (@command{dpdf}). The following is important: @itemize . @item @command{pdf} need not be normalized, i.e., any integrable nonnegative function can be used. @item @command{dpdf} must the derivate of the function provided as @command{pdf}. @end itemize @item Handle and evaluate the logarithm of the probability density function (logPDF, @command{logpdf}) and the gradient of the logarithm of the density function (@command{dlogpdf}). Some methods use the logarithm of the density if available. @item Set (and change) parameters (@command{pdfparams}) and the volume below the graph (@command{pdfvol}) of the given density. @item Set @command{mode} and @command{mean} of the distribution. @item Set the @command{center} of the distribution. It is used by some generation methods to adjust the parameters of the generation algorithms to gain better performance. It can be seens as the location of the ``central part'' of the distribution. @item Handle the @command{covar}iance matrix of the distribution and its @command{cholesky} and @command{inv}verse matrices. @item Set the @command{rankcorr}elation matrix of the distribution. @item Deal with @command{marginal} distributions. @item Set domain of the distribution. @end itemize =END */ /*---------------------------------------------------------------------------*/ /* Routines for handling multivariate continuous distributions (CVEC). */ /* =ROUTINES */ UNUR_DISTR *unur_distr_cvec_new( int dim ); /* Create a new (empty) object for multivariate continuous distribution. @var{dim} is the number of components of the random vector (i.e. its dimension). It is also possible to use dimension 1. Notice, however, that this is treated as a distribution of random vectors with only one component and not as a distribution of real numbers. For the latter unur_distr_cont_new() should be used to create an object for a univariate distribution. */ /* ==DOC @subsubheading Essential parameters */ int unur_distr_cvec_set_pdf( UNUR_DISTR *distribution, UNUR_FUNCT_CVEC *pdf ); /* Set respective pointer to the PDF of the @var{distribution}. This function must be of type @code{double funct(const double *x, UNUR_DISTR *distr)}, where @var{x} must be a pointer to a double array of appropriate size (i.e. of the same size as given to the unur_distr_cvec_new() call). It is not necessary that the given PDF is normalized, i.e. the integral need not be 1. Nevertheless the volume below the PDF can be provided by a unur_distr_cvec_set_pdfvol() call. It is not possible to change the PDF. Once the PDF is set it cannot be overwritten. This also holds when the logPDF is given. A new distribution object has to be used instead. */ int unur_distr_cvec_set_dpdf( UNUR_DISTR *distribution, UNUR_VFUNCT_CVEC *dpdf ); /* Set pointer to the gradient of the PDF. The type of this function must be @code{int funct(double *result, const double *x, UNUR_DISTR *distr)}, where @var{result} and @var{x} must be pointers to double arrays of appropriate size (i.e. of the same size as given to the unur_distr_cvec_new() call). The gradient of the PDF is stored in the array @var{result}. The function should return an error code in case of an error and must return @code{UNUR_SUCCESS} otherwise. The given function must be the gradient of the function given by a unur_distr_cvec_set_pdf() call. It is not possible to change the gradient of the PDF. Once the dPDF is set it cannot be overwritten. This also holds when the gradient of the logPDF is given. A new distribution object has to be used instead. */ int unur_distr_cvec_set_pdpdf( UNUR_DISTR *distribution, UNUR_FUNCTD_CVEC *pdpdf ); /* Set pointer to partial derivatives of the PDF. The type of this function must be @code{double funct(const double *x, int coord, UNUR_DISTR *distr)}, where @var{x} must be a pointer to a double array of appropriate size (i.e. of the same size as given to the unur_distr_cvec_new() call). @var{coord} is the coordinate for which the partial dervative should be computed. Notice that @var{coord} must be an integer from @{0,@dots{},dim-1@}. It is not possible to change the partial derivative of the PDF. Once the pdPDF is set it cannot be overwritten. This also holds when the partial derivative of the logPDF is given. A new distribution object has to be used instead. */ UNUR_FUNCT_CVEC *unur_distr_cvec_get_pdf( const UNUR_DISTR *distribution ); /* Get the pointer to the PDF of the @var{distribution}. The pointer is of type @code{double funct(const double *x, UNUR_DISTR *distr)}. If the corresponding function is not available for the @var{distribution}, the NULL pointer is returned. */ UNUR_VFUNCT_CVEC *unur_distr_cvec_get_dpdf( const UNUR_DISTR *distribution ); /* Get the pointer to the gradient of the PDF of the @var{distribution}. The pointer is of type @code{int double funct(double *result, const double *x, UNUR_DISTR *distr)}. If the corresponding function is not available for the @var{distribution}, the NULL pointer is returned. */ UNUR_FUNCTD_CVEC *unur_distr_cvec_get_pdpdf( const UNUR_DISTR *distribution ); /* Get the pointer to the partial derivative of the PDF of the @var{distribution}. The pointer is of type @code{double funct(const double *x, int coord, UNUR_DISTR *distr)}. If the corresponding function is not available for the @var{distribution}, the NULL pointer is returned. */ double unur_distr_cvec_eval_pdf( const double *x, UNUR_DISTR *distribution ); /* Evaluate the PDF of the @var{distribution} at @var{x}. @var{x} must be a pointer to a double array of appropriate size (i.e. of the same size as given to the unur_distr_cvec_new() call) that contains the vector for which the function has to be evaluated. Notice that @var{distribution} must not be the NULL pointer. If the corresponding function is not available for the @var{distribution}, @code{UNUR_INFINITY} is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. */ int unur_distr_cvec_eval_dpdf( double *result, const double *x, UNUR_DISTR *distribution ); /* Evaluate the gradient of the PDF of the @var{distribution} at @var{x}. The result is stored in the double array @var{result}. Both @var{result} and @var{x} must be pointer to double arrays of appropriate size (i.e. of the same size as given to the unur_distr_cvec_new() call). Notice that @var{distribution} must not be the NULL pointer. If the corresponding function is not available for the @var{distribution}, an error code is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA} (@var{result} is left unmodified). */ double unur_distr_cvec_eval_pdpdf( const double *x, int coord, UNUR_DISTR *distribution ); /* Evaluate the partial derivative of the PDF of the @var{distribution} at @var{x} for the coordinate @var{coord}. @var{x} must be a pointer to a double array of appropriate size (i.e. of the same size as given to the unur_distr_cvec_new() call) that contains the vector for which the function has to be evaluated. Notice that @var{coord} must be an integer from @{0,@dots{},dim-1@}. Notice that @var{distribution} must not be the NULL pointer. If the corresponding function is not available for the @var{distribution}, @code{UNUR_INFINITY} is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. */ int unur_distr_cvec_set_logpdf( UNUR_DISTR *distribution, UNUR_FUNCT_CVEC *logpdf ); /* */ int unur_distr_cvec_set_dlogpdf( UNUR_DISTR *distribution, UNUR_VFUNCT_CVEC *dlogpdf ); /* */ int unur_distr_cvec_set_pdlogpdf( UNUR_DISTR *distribution, UNUR_FUNCTD_CVEC *pdlogpdf ); /* */ UNUR_FUNCT_CVEC *unur_distr_cvec_get_logpdf( const UNUR_DISTR *distribution ); /* */ UNUR_VFUNCT_CVEC *unur_distr_cvec_get_dlogpdf( const UNUR_DISTR *distribution ); /* */ UNUR_FUNCTD_CVEC *unur_distr_cvec_get_pdlogpdf( const UNUR_DISTR *distribution ); /* */ double unur_distr_cvec_eval_logpdf( const double *x, UNUR_DISTR *distribution ); /* */ int unur_distr_cvec_eval_dlogpdf( double *result, const double *x, UNUR_DISTR *distribution ); /* */ double unur_distr_cvec_eval_pdlogpdf( const double *x, int coord, UNUR_DISTR *distribution ); /* Analogous calls for the logarithm of the density function. */ int unur_distr_cvec_set_mean( UNUR_DISTR *distribution, const double *mean ); /* Set mean vector for multivariate @var{distribution}. @var{mean} must be a pointer to an array of size @code{dim}, where @code{dim} is the dimension returned by unur_distr_get_dim(). A NULL pointer for @var{mean} is interpreted as the zero vector (0,@dots{},0). @strong{Important:} If the parameters of a distribution from the UNU.RAN library of standard distributions (@pxref{Stddist,,Standard distributions}) are changed, then neither its mode nor the normalization constant are updated. Please use the respective calls unur_distr_cvec_upd_mode() and unur_distr_cvec_upd_pdfvol(). */ const double *unur_distr_cvec_get_mean( const UNUR_DISTR *distribution ); /* Get the mean vector of the @var{distribution}. The function returns a pointer to an array of size @code{dim}. If the mean vector is not marked as known the NULL pointer is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_GET}. @emph{Important:} Do @strong{not} modify the array that holds the mean vector! */ int unur_distr_cvec_set_covar( UNUR_DISTR *distribution, const double *covar ); /* Set covariance matrix for multivariate @var{distribution}. @var{covar} must be a pointer to an array of size @code{dim} x @code{dim}, where @code{dim} is the dimension returned by unur_distr_get_dim(). The rows of the matrix have to be stored consecutively in this array. @var{covar} must be a variance-covariance matrix of the @var{distribution}, i.e. it must be symmetric and positive definit and its diagonal entries (i.e. the variance of the components of the random vector) must be strictly positive. The Cholesky factor is computed (and stored) to verify the positive definiteness condition. Notice that the inverse of the given covariance matrix is automatically computed when it is requested by some routine. Notice that the computation of this inverse matrix is unstable in case of high correlations and/or high dimensions. Thus it might fail and methods that require this inverse cannot be used. As an alternative the inverse of the covariance matrix can be directly set by a unur_distr_cvec_set_covar_inv() call. A NULL pointer for @var{covar} is interpreted as the identity matrix. @emph{Important:} This entry is abused in some methods which do not require the covariance matrix. It is then used to perform some transformation to obtain better performance. @emph{Important:} In case of an error (e.g. because @var{covar} is not a valid covariance matrix) an error code is returned. Moreover, the covariance matrix is not set and is marked as unknown. A previously set covariance matrix is then no longer available. @strong{Important:} If the parameters of a distribution from the UNU.RAN library of standard distributions (@pxref{Stddist,,Standard distributions}) are changed, then neither its mode nor the normalization constant are updated. Please use the respective calls unur_distr_cvec_upd_mode() and unur_distr_cvec_upd_pdfvol(). @emph{Remark:} UNU.RAN does not check whether the an eventually set covariance matrix and a rank-correlation matrix do not contradict each other. */ int unur_distr_cvec_set_covar_inv( UNUR_DISTR *distribution, const double *covar_inv ); /* Set inverse of the covariance matrix for multivariate @var{distribution}. @var{covar_inv} must be a pointer to an array of size @code{dim} x @code{dim}, where @code{dim} is the dimension returned by unur_distr_get_dim(). The rows of the matrix have to be stored consecutively in this array. @var{covar_inv} must be symmetric and positive definit. Only the symmetry of the matrix is checked. A NULL pointer for @var{covar_inv} is interpreted as the identity matrix. @emph{Important:} In case of an error (because @var{covar_inv} is not symetric) an error code is returned. Moreover, the inverse of the covariance matrix is not set and is marked as unknown. A previously set inverse matrix is then no longer available. @emph{Remark:} UNU.RAN does not check whether the given matrix is positive definit. @emph{Remark:} UNU.RAN does not check whether the matrix @var{covar_inv} is the inverse of the eventually set covariance matrix. */ const double *unur_distr_cvec_get_covar( const UNUR_DISTR *distribution ); /* */ const double *unur_distr_cvec_get_cholesky( const UNUR_DISTR *distribution ); /* */ const double *unur_distr_cvec_get_covar_inv( UNUR_DISTR *distribution ); /* Get covariance matrix of @var{distribution}, its Cholesky factor, and its inverse, respectively. The function returns a pointer to an array of size @code{dim} x @code{dim}. The rows of the matrix are stored consecutively in this array. If the requested matrix is not marked as known the NULL pointer is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_GET}. @emph{Important:} Do @strong{not} modify the array that holds the covariance matrix! @emph{Remark:} The inverse of the covariance matrix is computed if it is not already stored. */ int unur_distr_cvec_set_rankcorr( UNUR_DISTR *distribution, const double *rankcorr ); /* Set rank-correlation matrix (Spearman's correlation) for multivariate @var{distribution}. @var{rankcorr} must be a pointer to an array of size @code{dim} x @code{dim}, where @code{dim} is the dimension returned by unur_distr_get_dim(). The rows of the matrix have to be stored consecutively in this array. @var{rankcorr} must be a rank-correlation matrix of the @var{distribution}, i.e. it must be symmetric and positive definite and its diagonal entries must be equal to @code{1}. The Cholesky factor is computed (and stored) to verify the positive definiteness condition. A NULL pointer for @var{rankcorr} is interpreted as the identity matrix. @emph{Important:} In case of an error (e.g. because @var{rankcorr} is not a valid rank-correlation matrix) an error code is returned. Moreover, the rank-correlation matrix is not set and is marked as unknown. A previously set rank-correlation matrix is then no longer available. @emph{Remark:} UNU.RAN does not check whether the an eventually set covariance matrix and a rank-correlation matrix do not contradict each other. */ const double *unur_distr_cvec_get_rankcorr( const UNUR_DISTR *distribution ); /* */ const double *unur_distr_cvec_get_rk_cholesky( const UNUR_DISTR *distribution ); /* Get rank-correlation matrix and its cholesky factor, respectively, of @var{distribution}. The function returns a pointer to an array of size @code{dim} x @code{dim}. The rows of the matrix are stored consecutively in this array. If the requested matrix is not marked as known the NULL pointer is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_GET}. @emph{Important:} Do @strong{not} modify the array that holds the rank-correlation matrix! */ int unur_distr_cvec_set_marginals( UNUR_DISTR *distribution, UNUR_DISTR *marginal ); /* Sets marginal distributions of the given @var{distribution} to the same @var{marginal} distribution object. The @var{marginal} distribution must be an instance of a continuous univariate distribution object. Notice that the marginal distribution is copied into the @var{distribution} object. */ int unur_distr_cvec_set_marginal_array( UNUR_DISTR *distribution, UNUR_DISTR **marginals ); /* Analogously to the above unur_distr_cvec_set_marginals() call. However, now an array @var{marginals} of the pointers to each of the marginal distributions must be given. It @strong{must} be an array of size @code{dim}, where @code{dim} is the dimension returned by unur_distr_get_dim(). @emph{Notice}: Local copies for each of the entries are stored in the @var{distribution} object. If some of these entries are identical (i.e. contain the same pointer), then for each of these a new copy is made. */ int unur_distr_cvec_set_marginal_list( UNUR_DISTR *distribution, ... ); /* Similar to the above unur_distr_cvec_set_marginal_array() call. However, now the pointers to the particular marginal distributions can be given as parameter and does not require an array of pointers. Additionally the given distribution objects are immediately destroyed. Thus calls like unur_distr_normal() can be used as arguments. (With unur_distr_cvec_set_marginal_array() the result of such call has to be stored in a pointer since it has to be freed afterwarts to avoid memory leaks!) The number of pointers to in the list of function arguments @strong{must} be equal to the dimension of the @var{distribution}, i.e. the dimension returned by unur_distr_get_dim(). If one of the given pointer to marginal distributions is the NULL pointer then the marginal distributions of @var{distribution} are not set (or previous settings are not changed) and an error code is returned. @strong{Important:} All distribution objects given in the argument list are destroyed! */ const UNUR_DISTR *unur_distr_cvec_get_marginal( const UNUR_DISTR *distribution, int n ); /* Get pointer to the @var{n}-th marginal distribution object from the given multivariate @var{distribution}. If this does not exist, NULL is returned. The marginal distributions are enumerated from @code{1} to @code{dim}, where @code{dim} is the dimension returned by unur_distr_get_dim(). */ int unur_distr_cvec_set_pdfparams( UNUR_DISTR *distribution, const double *params, int n_params ); /* Sets array of parameters for @var{distribution}. There is an upper limit for the number of parameters @code{n_params}. It is given by the macro @code{UNUR_DISTR_MAXPARAMS} in @file{unuran_config.h}. (It is set to 5 by default but can be changed to any appropriate nonnegative number.) If @var{n_params} is negative or exceeds this limit no parameters are copied into the distribution object and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_NPARAMS}. For standard distributions from the UNU.RAN library the parameters are checked. Moreover, the domain is updated automatically. If the given parameters are invalid for the standard distribution, then no parameters are set and an error code is returned. Notice that the given parameter list for such a distribution is handled in the same way as in the corresponding @command{new} calls, i.e. optional parameters for the PDF that are not present in the given list are (re-)set to their default values. @strong{Important:} If the parameters of a distribution from the UNU.RAN library of standard distributions (@pxref{Stddist,,Standard distributions}) are changed, then neither its mode nor the normalization constant are updated. Please use the respective calls unur_distr_cvec_upd_mode() and unur_distr_cvec_upd_pdfvol(). */ int unur_distr_cvec_get_pdfparams( const UNUR_DISTR *distribution, const double **params ); /* Get number of parameters of the PDF and set pointer @var{params} to array of parameters. If no parameters are stored in the object, an error code is returned and @code{params} is set to NULL. @emph{Important:} Do @strong{not} change the entries in @var{params}! */ int unur_distr_cvec_set_pdfparams_vec( UNUR_DISTR *distribution, int par, const double *param_vec, int n_params ); /* This function provides an interface for additional vector parameters for a multivariate @var{distribution} besides mean vector and covariance matrix which have their own calls. It sets the parameter with number @var{par}. @var{par} indicates directly which of the parameters is set and must be a number between @code{0} and @code{UNUR_DISTR_MAXPARAMS}-1 (the upper limit of possible parameters defined in @file{unuran_config.h}; it is set to 5 but can be changed to any appropriate nonnegative number.) The entries of a this parameter are given by the array @var{param_vec} of size @var{n_params}. Notice that using this interface an An (@i{n} x @i{m})-matrix has to be stored in an array of length @var{n_params} = @i{n} times @i{m}; where the rows of the matrix are stored consecutively in this array. Due to great variety of possible parameters for a multivariate @var{distribution} there is no simpler interface. If @var{param_vec} is NULL then the corresponding entry is cleared. @strong{Important:} If the parameters of a distribution from the UNU.RAN library of standard distributions (@pxref{Stddist,,Standard distributions}) are changed, then neither its mode nor the normalization constant are updated. Please use the respective calls unur_distr_cvec_upd_mode() and unur_distr_cvec_upd_pdfvol(). If an error occurs no parameters are copied into the parameter object @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. */ int unur_distr_cvec_get_pdfparams_vec( const UNUR_DISTR *distribution, int par, const double **param_vecs ); /* Get parameter of the PDF with number @var{par}. The pointer to the parameter array is stored in @var{param_vecs}, its size is returned by the function. If the requested parameter is not set, then an error code is returned and @code{params} is set to NULL. @emph{Important:} Do @strong{not} change the entries in @var{param_vecs}! */ int unur_distr_cvec_set_domain_rect( UNUR_DISTR *distribution, const double *lowerleft, const double *upperright ); /* Set rectangular domain for @var{distribution} with @var{lowerleft} and @var{upperright} vertices. Both must be pointer to an array of the size returned by unur_distr_get_dim(). A NULL pointer is interpreted as the zero vector (0,@dots{},0). For setting a coordinate of the boundary to @unurmath{\pm\infty} use @code{+/- UNUR_INFINITY}. The @var{lowerleft} vertex must be strictly smaller than @var{upperright} in each component. Otherwise no domain is set and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_SET}. By default the domain of a distribution is unbounded. Thus one can use this call to truncate an existing distribution. @emph{Important:} Changing the domain of @var{distribution} marks derived parameters like the mode or the center as unknown and must be set @emph{after} changing the domain. This is important for the already set (or default) value for the center does not fall into the given domain. Notice that calls of the PDF and derived functions return @code{0.} when the parameter is not contained in the domain. */ int unur_distr_cvec_is_indomain( const double *x, const UNUR_DISTR *distribution ); /* Check whether @var{x} falls into the domain of @var{distribution}. */ /*---------------------------------------------------------------------------*/ /* ==DOC @subsubheading Derived parameters The following paramters @strong{must} be set whenever one of the essential parameters has been set or changed (and the parameter is required for the chosen method). */ int unur_distr_cvec_set_mode( UNUR_DISTR *distribution, const double *mode ); /* Set mode of the @var{distribution}. @var{mode} must be a pointer to an array of the size returned by unur_distr_get_dim(). A NULL pointer for @var{mode} is interpreted as the zero vector (0,@dots{},0). */ int unur_distr_cvec_upd_mode( UNUR_DISTR *distribution ); /* Recompute the mode of the @var{distribution}. This call works properly for distribution objects from the UNU.RAN library of standard distributions when the corresponding function is available. If it failes @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. */ const double *unur_distr_cvec_get_mode( UNUR_DISTR *distribution ); /* Get mode of the @var{distribution}. The function returns a pointer to an array of the size returned by unur_distr_get_dim(). If the mode is not marked as known the NULL pointer is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_GET}. (There is no difference between the case where no routine for computing the mode is available and the case where no mode exists for the @var{distribution} at all.) @emph{Important:} Do @strong{not} modify the array that holds the mode! */ int unur_distr_cvec_set_center( UNUR_DISTR *distribution, const double *center ); /* Set center of the @var{distribution}. @var{center} must be a pointer to an array of the size returned by unur_distr_get_dim(). A NULL pointer for @var{center} is interpreted as the zero vector (0,@dots{},0). The center is used by some methods to shift the distribution in order to decrease numerical round-off error. If not given explicitly a default is used. Moreover, it is used as starting point for several numerical search algorithm (e.g. for the mode). Then @var{center} must be a pointer where the call to the PDF returns a non-zero value. In particular @var{center} must contained in the domain of the distribution. Default: The mode, if given by a unur_distr_cvec_set_mode() call; else the mean, if given by a unur_distr_cvec_set_mean() call; otherwise the null vector (0,@dots{},0). */ const double *unur_distr_cvec_get_center( UNUR_DISTR *distribution ); /* Get center of the @var{distribution}. The function returns a pointer to an array of the size returned by unur_distr_get_dim(). It always returns some point as there always exists a default for the center, see unur_distr_cvec_set_center(). @emph{Important:} Do @strong{not} modify the array that holds the center! */ int unur_distr_cvec_set_pdfvol( UNUR_DISTR *distribution, double volume ); /* Set the volume below the PDF. If @var{vol} is non-positive, no volume is set and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_SET}. */ int unur_distr_cvec_upd_pdfvol( UNUR_DISTR *distribution ); /* Recompute the volume below the PDF of the distribution. It only works for distribution objects from the UNU.RAN library of standard distributions when the corresponding function is available. Otherwise @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. This call also sets the normalization constant such that the given PDF is the derivative of a given CDF, i.e. the volume is 1. */ double unur_distr_cvec_get_pdfvol( UNUR_DISTR *distribution ); /* Get the volume below the PDF of the @var{distribution}. If this volume is not known,@* unur_distr_cont_upd_pdfarea() is called to compute it. If this is not successful @code{UNUR_INFINITY} is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_GET}. */ /* =END */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distr/discr.h0000644001357500135600000004332614420445767013253 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: discr.h * * * * PURPOSE: * * function prototypes for manipulating distribution objects of * * type DISCR (discrete univariate distribution) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* =NODEX DISCR Discrete univariate distributions =UP Distribution_objects [50] =DESCRIPTION The calls in this section can be applied to discrete univariate distributions. @itemize @minus @item Create a @command{new} instance of a discrete univariate distribution. @item Handle and evaluate distribution function (CDF, @command{cdf}) and probability mass function (PMF, @command{pmf}). The following is important: @itemize . @item @command{pmf} need not be normalized, i.e., any summable nonnegative function on the set of intergers can be used. @item @command{cdf} must be a distribution function, i.e. it must be monotonically increasing with range [0,1]. @item If @command{cdf} and @command{pdf} are used together for a pariticular generation method, then @command{pmf} must be normalized, i.e. it must sum to 1. @end itemize @item Alternatively, @command{cdf} and @command{pdf} can be provided as @command{str}ings instead of function pointers. @item Some generation methods require a (finite) probability vector (PV, @command{pv}), i.e. an array of @code{double}s. It can be automatically computed if the @command{pmf} is given but @command{pv} is not. @item Set (and change) parameters (@command{pmfparams}) and the total sum (@command{pmfsum}) of the given PMF or PV. @item Set the @command{mode} of the distribution. @item Set the @command{domain} of the distribution. @end itemize =END */ /*---------------------------------------------------------------------------*/ /* Routines for handling univariate discrete distributions (DISCR). */ /* =ROUTINES */ UNUR_DISTR *unur_distr_discr_new( void ); /* Create a new (empty) object for a univariate discrete distribution. */ /* ==DOC @subsubheading Essential parameters There are two interfaces for discrete univariate distributions: Either provide a (finite) probability vector (PV). Or provide a probability mass function (PMF). For the latter case there are also a couple of derived parameters that are not required when a PV is given. It is not possible to set both a PMF and a PV directly. However, the PV can be computed from the PMF (or the CDF if no PMF is available) by means of a unur_distr_discr_make_pv() call. If both the PV and the PMF are given in the distribution object it depends on the generation method which of these is used. */ int unur_distr_discr_set_pv( UNUR_DISTR *distribution, const double *pv, int n_pv ); /* Set finite probability vector (PV) for the @var{distribution}. It is not necessary that the entries in the given PV sum to 1. @var{n_pv} must be positive. However, there is no testing whether all entries in @var{pv} are non-negative. If no domain has been set, then the left boundary is set to @code{0}, by default. If @var{n_pv} is too large, e.g. because left boundary + @var{n_pv} exceeds the range of integers, then the call fails. Notice that it is not possible to set both a PV and a PMF or CDF. If the PMF or CDF is set first one cannot set the PV. If the PMF or CDF is set first after a PV is set, the latter is removed (and recomputed using unur_distr_discr_make_pv() when required). */ int unur_distr_discr_make_pv( UNUR_DISTR *distribution ); /* Compute a PV when a PMF or CDF is given. However, when the domain is not given or is too large and the sum over the PMF is given then the (right) tail of the @var{distribution} is chopped off such that the probability for the tail region is less than 1.e-8. If the sum over the PMF is not given a PV of maximal length is computed. The maximal size of the created PV is bounded by the macro @code{UNUR_MAX_AUTO_PV} that is defined in @file{unuran_config.h}. If successful, the length of the generated PV is returned. If the sum over the PMF on the chopped tail is not neglible small (i.e. greater than 1.e-8 or unknown) than the negative of the length of the PV is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_SET}. Notice that the left boundary of the PV is set to @code{0} by default when a discrete distribution object is created from scratch. If computing a PV fails for some reasons, an error code is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_SET}. */ int unur_distr_discr_get_pv( const UNUR_DISTR *distribution, const double **pv ); /* Get length of PV of the @var{distribution} and set pointer @var{pv} to array of probabilities. If no PV is given, an error code is returned and @var{pv} is set to NULL.@* (It does not call unur_distr_discr_make_pv()!) */ int unur_distr_discr_set_pmf( UNUR_DISTR *distribution, UNUR_FUNCT_DISCR *pmf ); /* */ int unur_distr_discr_set_cdf( UNUR_DISTR *distribution, UNUR_FUNCT_DISCR *cdf ); /* Set respective pointer to the PMF and the CDF of the @var{distribution}. These functions must be of type @code{double funct(int k, const UNUR_DISTR *distr)}. It is important to note that all these functions must return a result for all integers @var{k}. E.g., if the domain of a given PMF is the interval @{1,2,3,@dots{},100@}, than the given function must return @code{0.0} for all points outside this interval. The default domain for the PMF or CDF is [@code{0}, @code{INT_MAX}]. The domain can be changed using a unur_distr_discr_set_domain() call. It is not possible to change such a function. Once the PMF or CDF is set it cannot be overwritten. A new distribution object has to be used instead. Notice that it is not possible to set both a PV and a PMF or CDF. If the PMF or CDF is set first one cannot set the PV. If the PMF or CDF is set first after a PV is set, the latter is removed (and recomputed using unur_distr_discr_make_pv() when required). */ int unur_distr_discr_set_invcdf( UNUR_DISTR *distribution, UNUR_IFUNCT_DISCR *invcdf ); /* Set inverse CDF of the @var{distribution}. @var{invcdf} must be a pointer must be of type @code{int funct(double x, const UNUR_DISTR *distr)}, i.e., it should return a @code{double}. */ UNUR_FUNCT_DISCR *unur_distr_discr_get_pmf( const UNUR_DISTR *distribution ); /* */ UNUR_FUNCT_DISCR *unur_distr_discr_get_cdf( const UNUR_DISTR *distribution ); /* Get the respective pointer to the PMF and the CDF of the @var{distribution}. The pointer is of type @code{double funct(int k, const UNUR_DISTR *distr)}. If the corresponding function is not available for the @var{distribution}, the NULL pointer is returned. */ UNUR_IFUNCT_DISCR *unur_distr_discr_get_invcdf( const UNUR_DISTR *distribution ); /* Get pointer to the inverse CDF of the @var{distribution}. The pointer is of type @code{int funct(double x, const UNUR_DISTR *distr)}. If the corresponding function is not available for the distribution, the NULL pointer is returned. */ double unur_distr_discr_eval_pv(int k, const UNUR_DISTR *distribution ); /* */ double unur_distr_discr_eval_pmf( int k, const UNUR_DISTR *distribution ); /* */ double unur_distr_discr_eval_cdf( int k, const UNUR_DISTR *distribution ); /* Evaluate the PV, PMF, and the CDF, respectively, at k. Notice that @var{distribution} must not be the NULL pointer. If no PV is set for the @var{distribution}, then unur_distr_discr_eval_pv() behaves like unur_distr_discr_eval_pmf(). If the corresponding function is not available for the @var{distribution}, @code{UNUR_INFINITY} is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. @emph{IMPORTANT:} In the case of a truncated standard distribution these calls always return the respective values of the @emph{untruncated} distribution! */ int unur_distr_discr_eval_invcdf( double u, const UNUR_DISTR *distribution ); /* Evaluate the inverse CDF at @var{u}. Notice that @var{distribution} must not be the NULL pointer. If the corresponding function is not available for the distribution, @code{INT_MAX} is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. @emph{IMPORTANT:} In the case of a truncated standard distribution these calls always return the respective values of the @emph{untruncated} distribution! */ int unur_distr_discr_set_pmfstr( UNUR_DISTR *distribution, const char *pmfstr ); /* This function provides an alternative way to set a PMF of the @var{distribution}. @var{pmfstr} is a character string that contains the formula for the PMF, see @ref{StringFunct,,Function String}, for details. See also the remarks for the unur_distr_discr_set_pmf() call. It is not possible to call this funtion twice or to call this function after a unur_distr_discr_set_pmf() call. */ int unur_distr_discr_set_cdfstr( UNUR_DISTR *distribution, const char *cdfstr ); /* This function provides an alternative way to set a CDF; analogously to the unur_distr_discr_set_pmfstr() call. */ char *unur_distr_discr_get_pmfstr( const UNUR_DISTR *distribution ); /* */ char *unur_distr_discr_get_cdfstr( const UNUR_DISTR *distribution ); /* Get pointer to respective string for PMF and CDF of @var{distribution} that is given via the string interface. This call allocates memory to produce this string. It should be freed when it is not used any more. */ int unur_distr_discr_set_pmfparams( UNUR_DISTR *distribution, const double *params, int n_params ); /* Set array of parameters for @var{distribution}. There is an upper limit for the number of parameters @var{n_params}. It is given by the macro @code{UNUR_DISTR_MAXPARAMS} in @file{unuran_config.h}. (It is set to 5 but can be changed to any appropriate nonnegative number.) If @var{n_params} is negative or exceeds this limit no parameters are copied into the @var{distribution} object and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_NPARAMS}. For standard distributions from the UNU.RAN library the parameters are checked. Moreover, the domain is updated automatically unless it has been changed before by a unur_distr_discr_set_domain() call. If the given parameters are invalid for the standard distribution, then no parameters are set and an error code is returned. Notice that the given parameter list for such a distribution is handled in the same way as in the corresponding @command{new} calls, i.e. optional parameters for the PDF that are not present in the given list are (re-)set to their default values. @emph{Important:} Integer parameter must be given as @code{double}s. */ int unur_distr_discr_get_pmfparams( const UNUR_DISTR *distribution, const double **params ); /* Get number of parameters of the PMF and set pointer @var{params} to array of parameters. If no parameters are stored in the object, an error code is returned and @code{params} is set to NULL. */ int unur_distr_discr_set_domain( UNUR_DISTR *distribution, int left, int right ); /* Set the left and right borders of the domain of the @var{distribution}. This can also be used to truncate an existing distribution. For setting the boundary to @unurmath{\pm\infty} use @code{INT_MIN} and @code{INT_MAX}, respectively. If @var{right} is not strictly greater than @var{left} no domain is set and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_SET}. It is allowed to use this call to increase the domain. If the PV of the discrete distribution is used, than the right boudary is ignored (and internally set to @var{left} + size of PV @math{- 1}). Notice that @code{INT_MIN} and @code{INT_MAX} are interpreted as (minus/plus) infinity. Default: [@code{0}, @code{INT_MAX}]. */ int unur_distr_discr_get_domain( const UNUR_DISTR *distribution, int *left, int *right ); /* Get the left and right borders of the domain of the @var{distribution}. If the domain is not set explicitly the interval [@code{INT_MIN}, @code{INT_MAX}] is assumed and returned. When a PV is given then the domain is set automatically to [@code{0},size of PV @math{- 1}]. */ /* ==DOC @subsubheading Derived parameters The following paramters @strong{must} be set whenever one of the essential parameters has been set or changed (and the parameter is required for the chosen method). */ int unur_distr_discr_set_mode( UNUR_DISTR *distribution, int mode ); /* Set mode of @var{distribution}. */ int unur_distr_discr_upd_mode( UNUR_DISTR *distribution ); /* Recompute the mode of the @var{distribution}. This call works properly for distribution objects from the UNU.RAN library of standard distributions when the corresponding function is available. Otherwise a (slow) numerical mode finder is used. It only works properly for unimodal probability mass functions. If it failes @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. */ int unur_distr_discr_get_mode( UNUR_DISTR *distribution ); /* Get mode of @var{distribution}. If the mode is not marked as known, unur_distr_discr_upd_mode() is called to compute the mode. If this is not successful @code{INT_MAX} is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_GET}. (There is no difference between the case where no routine for computing the mode is available and the case where no mode exists for the distribution at all.) */ int unur_distr_discr_set_pmfsum( UNUR_DISTR *distribution, double sum ); /* Set the sum over the PMF. If @code{sum} is non-positive, no sum is set and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_SET}. For a distribution object created by the UNU.RAN library of standard distributions you always should use the unur_distr_discr_upd_pmfsum(). Otherwise there might be ambiguous side-effects. */ int unur_distr_discr_upd_pmfsum( UNUR_DISTR *distribution ); /* Recompute the sum over the PMF of the @var{distribution}. In most cases the normalization constant is recomputed and thus the sum is 1. This call works for distribution objects from the UNU.RAN library of standard distributions when the corresponding function is available. When a PV, a PMF with finite domain, or a CDF is given, a simple generic function which uses a naive summation loop is used. If this computation is not possible, an error code is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. The call does not work for distributions from the UNU.RAN library of standard distributions with truncated domain when the CDF is not available. */ double unur_distr_discr_get_pmfsum( UNUR_DISTR *distribution ); /* Get the sum over the PMF of the @var{distribution}. If this sum is not known, unur_distr_discr_upd_pmfsum() is called to compute it. If this is not successful @code{UNUR_INFINITY} is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_GET}. */ /* =END */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distr/cxtrans.c0000644001357500135600000012300514420445767013615 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: cxtrans.c * * * * PURPOSE: * * function prototypes for manipulating distribution objects of * * id CXTRANS (continuous distribution of transformed RV) * * type CONT (continuous univariate distribution) * * * * return: * * UNUR_SUCCESS ... on success * * error code ... on error * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include "distr.h" #include "cxtrans.h" #include "cont.h" #include "distr_source.h" /*---------------------------------------------------------------------------*/ static const char distr_name[] = "transformed RV"; /*---------------------------------------------------------------------------*/ #define DISTR distr->data.cont /* underlying (base) distribution */ #define CXT cxt->data.cont /* distribution of transformed RV */ #define BD_LEFT domain[0] /* left and ... */ #define BD_RIGHT domain[1] /* ... right boundary of domain */ #define ALPHA params[0] /* parameter for transformation */ #define MU params[1] /* relocation parameter for transformation */ #define SIGMA params[2] /* rescaling parameter for transformation */ #define logPDFPOLE params[3] /* logPDF at pole */ #define dlogPDFPOLE params[4] /* derivative of logPDF at pole */ /*---------------------------------------------------------------------------*/ /* function prototypes */ static int _unur_distr_cxtrans_compute_domain( struct unur_distr *cxt ); /*---------------------------------------------------------------------------*/ /* compute domain for transformed RV */ /*---------------------------------------------------------------------------*/ /* prototypes for CDF, PDF and its derviative for transformed RV */ static double _unur_cdf_cxtrans( double x, const struct unur_distr *cxt ); static double _unur_pdf_cxtrans( double x, const struct unur_distr *cxt ); static double _unur_logpdf_cxtrans( double x, const struct unur_distr *cxt ); static double _unur_dpdf_cxtrans( double x, const struct unur_distr *cxt ); static double _unur_dlogpdf_cxtrans( double x, const struct unur_distr *cxt ); static double _unur_pdf_at_pole( const struct unur_distr *cxt ); static double _unur_dpdf_at_pole( const struct unur_distr *cxt ); /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** transformed univariate continuous random RV **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_cxtrans_new( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* Create an object for the distribution of a transformed RV */ /* `distr' must be a pointer to a univariate continuous distribution. */ /* */ /* parameters: */ /* distr ... pointer to univariate continuous distribution. */ /* alpha ... parameter of power transformation */ /* 0. -> logarithmic transformation */ /* UNUR_INFINITY -> exponential transformation */ /* */ /* return: */ /* pointer to distribution object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_distr *cxt; /* check arguments */ _unur_check_NULL( distr_name,distr,NULL ); /* check distribution */ if (distr->type != UNUR_DISTR_CONT) { _unur_error(distr_name,UNUR_ERR_DISTR_INVALID,""); return NULL; } COOKIE_CHECK(distr,CK_DISTR_CONT,NULL); /* get distribution object for generic continuous univariate distribution */ cxt = unur_distr_cont_new(); if (!cxt) return NULL; /* set id to distribution of order statistics */ cxt->id = UNUR_DISTR_CXTRANS; /* name of distribution */ cxt->name = distr_name; /* this is a derived distribution */ /* clone base distribution ... */ cxt->base = _unur_distr_cont_clone( distr ); if (!cxt->base) { free(cxt); return NULL; } /* defaults: */ CXT.n_params = 5; /* five parameters */ CXT.ALPHA = 1.; /* parameter for transformation (default: identity) */ CXT.MU = 0.; /* relocation parameter for transformation */ CXT.SIGMA = 1.; /* rescaling parameter for transformation */ CXT.logPDFPOLE = -UNUR_INFINITY; /* logPDF at pole */ CXT.dlogPDFPOLE = UNUR_INFINITY; /* derivative of logPDF at pole */ /* copy data */ CXT.area = DISTR.area; /* area below PDF (same as for distr) */ CXT.BD_LEFT = DISTR.BD_LEFT; /* boundaries of ... */ CXT.BD_RIGHT = DISTR.BD_RIGHT; /* ... domain */ CXT.mode = DISTR.mode; /* mode of distribution */ /* pointer to PDF, its derivative, and CDF */ if (DISTR.cdf) CXT.cdf = _unur_cdf_cxtrans; /* pointer to CDF */ if (DISTR.pdf) CXT.pdf = _unur_pdf_cxtrans; /* pointer to PDF */ if (DISTR.logpdf) CXT.logpdf = _unur_logpdf_cxtrans; /* pointer to logPDF */ if (DISTR.dpdf) CXT.dpdf = _unur_dpdf_cxtrans; /* derivative of PDF */ if (DISTR.dlogpdf) CXT.dlogpdf = _unur_dlogpdf_cxtrans; /* derivative of logPDF */ /* parameters set */ cxt->set = distr->set; /* return pointer to object */ return cxt; } /* end of unur_distr_cxtrans_new() */ /*---------------------------------------------------------------------------*/ const struct unur_distr * unur_distr_cxtrans_get_distribution( const struct unur_distr *cxt ) /*----------------------------------------------------------------------*/ /* get pointer to distribution object for underlying distribution */ /* */ /* parameters: */ /* cxt ... pointer to distribution of transformed RV */ /* */ /* return: */ /* pointer to underlying distribution */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( distr_name, cxt, NULL ); _unur_check_distr_object( cxt, CONT, NULL ); /* check distribution */ if (cxt->id != UNUR_DISTR_CXTRANS) { _unur_error(distr_name,UNUR_ERR_DISTR_INVALID,""); return NULL; } return cxt->base; } /* end of unur_distr_cxtrans_get_distribution() */ /*---------------------------------------------------------------------------*/ int unur_distr_cxtrans_set_alpha( struct unur_distr *cxt, double alpha ) /*----------------------------------------------------------------------*/ /* change parameter of transformation */ /* */ /* parameters: */ /* cxt ... pointer to distribution of transformed RV */ /* alpha ... parameter of power transformation */ /* 0. -> logarithmic transformation */ /* UNUR_INFINITY -> exponential transformation */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { double alpha_bak; /* check arguments */ _unur_check_NULL( distr_name, cxt, UNUR_ERR_NULL ); _unur_check_distr_object( cxt, CONT, UNUR_ERR_DISTR_INVALID ); /* check distribution */ if (cxt->id != UNUR_DISTR_CXTRANS) { _unur_error(distr_name,UNUR_ERR_DISTR_INVALID,""); return UNUR_ERR_DISTR_INVALID; } CHECK_NULL( cxt->base, UNUR_ERR_NULL ); /* check parameter alpha */ if (alpha < 0.) { _unur_error(distr_name,UNUR_ERR_DISTR_SET,"alpha < 0"); return UNUR_ERR_DISTR_SET; } if (_unur_iszero(alpha) && cxt->base->data.cont.BD_LEFT < 0. ) { /* logarithmic transformation */ _unur_error(distr_name,UNUR_ERR_DISTR_SET,"invalid domain"); return UNUR_ERR_DISTR_SET; } /* copy parameters */ alpha_bak = CXT.ALPHA; /* store old value of alpha */ CXT.ALPHA = alpha; /* change domain of transformed RV */ if (_unur_distr_cxtrans_compute_domain(cxt) != UNUR_SUCCESS) { /* invalid alpha */ CXT.ALPHA = alpha_bak; return UNUR_ERR_DISTR_SET; } /* changelog */ cxt->set &= ~UNUR_DISTR_SET_MODE; /* mode unknown */ /* o.k. */ return UNUR_SUCCESS; } /* end of unur_distr_cxtrans_set_alpha() */ /*---------------------------------------------------------------------------*/ double unur_distr_cxtrans_get_alpha( const struct unur_distr *cxt ) /*----------------------------------------------------------------------*/ /* get parameter of transformation */ /* */ /* parameters: */ /* cxt ... pointer to distribution of transformed RV */ /* */ /* return: */ /* parameter alpha ... on success */ /* -UNUR_INFINITY ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( distr_name, cxt, -UNUR_INFINITY ); _unur_check_distr_object( cxt, CONT, -UNUR_INFINITY ); /* check distribution */ if (cxt->id != UNUR_DISTR_CXTRANS) { _unur_error(distr_name,UNUR_ERR_DISTR_INVALID,""); return -UNUR_INFINITY; } /* o.k. */ return CXT.ALPHA; } /* end of unur_distr_cxtrans_get_alpha() */ /*---------------------------------------------------------------------------*/ int unur_distr_cxtrans_set_rescale( struct unur_distr *cxt, double mu, double sigma ) /*----------------------------------------------------------------------*/ /* change relocation and rescaling parameter */ /* */ /* parameters: */ /* cxt ... pointer to distribution of transformed RV */ /* mu ... relocation parameter */ /* sigma ... rescaling parameter */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { double mu_bak; double sigma_bak; /* check arguments */ _unur_check_NULL( distr_name, cxt, UNUR_ERR_NULL ); _unur_check_distr_object( cxt, CONT, UNUR_ERR_DISTR_INVALID ); /* check distribution */ if (cxt->id != UNUR_DISTR_CXTRANS) { _unur_error(distr_name,UNUR_ERR_DISTR_INVALID,""); return UNUR_ERR_DISTR_INVALID; } CHECK_NULL( cxt->base, UNUR_ERR_NULL ); /* check parameter sigma */ if (sigma <= 0.) { _unur_error(distr_name,UNUR_ERR_DISTR_SET,"sigma <= 0"); return UNUR_ERR_DISTR_SET; } /* copy parameters */ mu_bak = CXT.MU; CXT.MU = mu; sigma_bak = CXT.SIGMA; CXT.SIGMA = sigma; /* change domain of transformed RV */ if (_unur_distr_cxtrans_compute_domain(cxt) != UNUR_SUCCESS) { /* invalid alpha */ CXT.MU = mu_bak; CXT.SIGMA = sigma_bak; return UNUR_ERR_DISTR_SET; } /* changelog */ cxt->set &= ~UNUR_DISTR_SET_MODE; /* mode unknown */ /* o.k. */ return UNUR_SUCCESS; } /* end of unur_distr_cxtrans_set_rescale() */ /*---------------------------------------------------------------------------*/ double unur_distr_cxtrans_get_mu( const struct unur_distr *cxt ) /*----------------------------------------------------------------------*/ /* get relocation parameter */ /* */ /* parameters: */ /* cxt ... pointer to distribution of transformed RV */ /* */ /* return: */ /* parameter mu ... on success */ /* -UNUR_INFINITY ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( distr_name, cxt, -UNUR_INFINITY ); _unur_check_distr_object( cxt, CONT, -UNUR_INFINITY ); /* check distribution */ if (cxt->id != UNUR_DISTR_CXTRANS) { _unur_error(distr_name,UNUR_ERR_DISTR_INVALID,""); return -UNUR_INFINITY; } /* o.k. */ return CXT.MU; } /* end of unur_distr_cxtrans_get_mu() */ /*---------------------------------------------------------------------------*/ double unur_distr_cxtrans_get_sigma( const struct unur_distr *cxt ) /*----------------------------------------------------------------------*/ /* get rescaling parameter */ /* */ /* parameters: */ /* cxt ... pointer to distribution of transformed RV */ /* */ /* return: */ /* parameter sigma ... on success */ /* -UNUR_INFINITY ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( distr_name, cxt, -UNUR_INFINITY ); _unur_check_distr_object( cxt, CONT, -UNUR_INFINITY ); /* check distribution */ if (cxt->id != UNUR_DISTR_CXTRANS) { _unur_error(distr_name,UNUR_ERR_DISTR_INVALID,""); return -UNUR_INFINITY; } /* o.k. */ return CXT.SIGMA; } /* end of unur_distr_cxtrans_get_sigma() */ /*---------------------------------------------------------------------------*/ int unur_distr_cxtrans_set_logpdfpole( struct unur_distr *cxt, double logpdfpole, double dlogpdfpole ) /*----------------------------------------------------------------------*/ /* set value for logarithm of PDF and its derivative at poles of the */ /* underlying distribution */ /* */ /* parameters: */ /* cxt ... pointer to distribution of transformed RV */ /* logpdfpole ... value of logPDF at pole */ /* dlogpdfpole ... value of derviate of logPDF at pole */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( distr_name, cxt, UNUR_ERR_NULL ); _unur_check_distr_object( cxt, CONT, UNUR_ERR_DISTR_INVALID ); /* check distribution */ if (cxt->id != UNUR_DISTR_CXTRANS) { _unur_error(distr_name,UNUR_ERR_DISTR_INVALID,""); return UNUR_ERR_DISTR_INVALID; } /* changelog */ cxt->set |= UNUR_DISTR_SET_GENERIC; /* copy parameters */ CXT.logPDFPOLE = logpdfpole; CXT.dlogPDFPOLE = dlogpdfpole; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_distr_cxtrans_set_logpdfpole() */ /*---------------------------------------------------------------------------*/ int unur_distr_cxtrans_set_domain( struct unur_distr *cxt, double left, double right ) /*----------------------------------------------------------------------*/ /* set the left and right borders of the domain of the distribution */ /* */ /* parameters: */ /* cxt ... pointer to distribution of transformed RV */ /* left ... left boundary point */ /* right ... right boundary point */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* the new boundary points may be +/- UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, cxt, UNUR_ERR_NULL ); _unur_check_distr_object( cxt, CONT, UNUR_ERR_DISTR_INVALID ); /* check distribution */ if (cxt->id != UNUR_DISTR_CXTRANS) { _unur_error(distr_name,UNUR_ERR_DISTR_INVALID,""); return UNUR_ERR_DISTR_INVALID; } if (_unur_isinf(CXT.ALPHA)==1) { /* exponential transformation */ if (left < CXT.MU) { _unur_error(NULL,UNUR_ERR_DISTR_SET,"domain, left < 0"); return UNUR_ERR_DISTR_SET; } } return unur_distr_cont_set_domain( cxt, left, right ); } /* end of unur_distr_cxtrans_set_domain() */ /*---------------------------------------------------------------------------*/ int _unur_distr_cxtrans_compute_domain( struct unur_distr *cxt ) /*----------------------------------------------------------------------*/ /* compute domain for transformed RV */ /* */ /* parameters: */ /* cxt ... pointer to distribution of transformed RV */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { double left, right; double left_new, right_new; double alpha; /* check arguments */ CHECK_NULL( cxt, UNUR_ERR_NULL ); CHECK_NULL( cxt->base, UNUR_ERR_NULL ); /* check distribution */ if (cxt->id != UNUR_DISTR_CXTRANS) { _unur_error(distr_name,UNUR_ERR_DISTR_INVALID,""); return UNUR_ERR_DISTR_INVALID; } /* domain of underlying distribution */ left = cxt->base->data.cont.BD_LEFT; right = cxt->base->data.cont.BD_RIGHT; alpha = CXT.ALPHA; /* exponential transformation */ if (_unur_isinf(alpha)==1) { left_new = (_unur_isfinite(left)) ? exp(left) : 0.; right_new = exp(right); } /* logarithmic transformation */ else if (_unur_iszero(alpha)) { if (left < 0. ) { _unur_error(distr_name,UNUR_ERR_DISTR_SET,"invalid domain"); return UNUR_ERR_DISTR_SET; } left_new = (left<=0.) ? -UNUR_INFINITY : log(left); right_new = log(right); } /* power transformation */ else if (alpha > 0.) { left_new = (left>=0.) ? pow(left,alpha) : -pow(-left,alpha); right_new = (right>=0.) ? pow(right,alpha) : -pow(-right,alpha); } /* else: error */ else { _unur_error(distr_name,UNUR_ERR_SHOULD_NOT_HAPPEN,""); return UNUR_ERR_SHOULD_NOT_HAPPEN; } /* check for NaNs */ if (_unur_isnan(left_new) || _unur_isnan(right_new)) { _unur_error(distr_name,UNUR_ERR_DISTR_SET,"NaN in now domain boundaries"); return UNUR_ERR_DISTR_SET; } /* store new domain */ /* also set boundary for truncated distributions */ CXT.trunc[0] = CXT.domain[0] = left_new; /* left boundary of domain */ CXT.trunc[1] = CXT.domain[1] = right_new; /* right boundary of domain */ /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_distr_cxtrans_compute_domain() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** CDF, PDF, and its derivative of transformed RV **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #define CDF(x) ((*(cxt->base->data.cont.cdf)) ((x), cxt->base)) #define PDF(x) ((*(cxt->base->data.cont.pdf)) ((x), cxt->base)) #define logPDF(x) ((*(cxt->base->data.cont.logpdf)) ((x), cxt->base)) #define dPDF(x) ((*(cxt->base->data.cont.dpdf)) ((x), cxt->base)) #define dlogPDF(x) ((*(cxt->base->data.cont.dlogpdf))((x), cxt->base)) /* power transformation */ #define POW(x) ((x>=0.) ? pow(x,1./alpha) : -pow(-x,1./alpha)) #define dPOW(x) ( pow(fabs(x), 1./alpha-1.) / alpha ) /* alpha != 1. */ #define dlogPOW(x) ( (1./alpha-1.)*log(fabs(x)) - log(alpha) ) #define ddPOW(x) ( ((x>=0.)?(1.-alpha):(alpha-1.)) * (_unur_isfsame(alpha,0.5)?1.0:pow(fabs(x),1./alpha-2.)) / (alpha*alpha) ) /* rescale */ #define rescale(x) (CXT.SIGMA * (x) + CXT.MU) /* #define drescale(x) (CXT.SIGMA * (x)) */ /*---------------------------------------------------------------------------*/ double _unur_cdf_cxtrans( double x, const struct unur_distr *cxt ) /* CDF(x) = F(phi^{-1}(x)) F(.) ... CDF of underlying distribution phi(.) ... transformation */ { double alpha, s, mu; /* check arguments */ CHECK_NULL( cxt, UNUR_INFINITY ); CHECK_NULL( cxt->base, UNUR_INFINITY ); CHECK_NULL( cxt->base->data.cont.cdf, UNUR_INFINITY ); alpha = CXT.ALPHA; s = CXT.SIGMA; mu = CXT.MU; /* exponential transformation */ if (_unur_isinf(alpha)==1) { return ((x<=0.) ? 0. : CDF(s*log(x)+mu)); } /* logarithmic transformation */ if (_unur_iszero(alpha)) { return CDF(s*exp(x)+mu); } /* power transformation */ if (alpha > 0.) { return CDF(s*POW(x)+mu); } /* else: error */ _unur_error(distr_name,UNUR_ERR_SHOULD_NOT_HAPPEN,""); return UNUR_INFINITY; } /* end of _unur_cdf_cxtrans() */ /*---------------------------------------------------------------------------*/ double _unur_pdf_cxtrans( double x, const struct unur_distr *cxt ) /* PDF(x) = f(phi^{-1}(x))*(phi^{-1})'(x) f(.) ... PDF of underlying distribution phi(.) ... transformation */ { double alpha, s, mu; /* check arguments */ CHECK_NULL( cxt, UNUR_INFINITY ); CHECK_NULL( cxt->base, UNUR_INFINITY ); CHECK_NULL( cxt->base->data.cont.pdf, UNUR_INFINITY ); alpha = CXT.ALPHA; s = CXT.SIGMA; mu = CXT.MU; /* exponential transformation */ if (_unur_isinf(alpha)==1) { if (x<=0.) return -UNUR_INFINITY; else { /* PDF(log(x))/x */ double fx = PDF(s*log(x)+mu); return (_unur_isfinite(fx) ? fx * s/x : _unur_pdf_at_pole(cxt)); } } /* logarithmic transformation */ if (_unur_iszero(alpha)) { /* PDF(exp(x)) * exp(x) */ double ex = s * exp(x) + mu; if (! _unur_isfinite(ex)) { /* the PDF must be zero at +-infinity */ return 0.; } else { double fx = PDF(ex); /* if PDF(ex) is not finite, we assume that it is a pole */ return (_unur_isfinite(fx) ? fx * s*ex : _unur_pdf_at_pole(cxt)); } } /* identical transformation */ if (_unur_isone(alpha)) { double fx = PDF(s*x+mu); return (_unur_isfinite(fx) ? s*fx : _unur_pdf_at_pole(cxt)); } /* power transformation */ if (alpha > 0.) { double phix = s * POW(x) + mu; if (! _unur_isfinite(phix)) { /* the PDF must be zero at +-infinity */ return 0.; } else { double fx = PDF(phix); if (_unur_isfinite(fx) && (!_unur_iszero(x) || alpha < 1.)) { double fcx = fx * s * dPOW(x); /* if f(phix) is finite but fx*dPOW(x) is not, */ /* we assume that the PDF of the transformed variable is zero. */ /* (This case is very unlikely to happen, but we should be */ /* prepared for round-off error of the FPA.) */ return (_unur_isfinite(fcx) ? fcx : 0.); } else /* if PDF(phix) is not finite, we assume that it is a pole */ return _unur_pdf_at_pole(cxt); } } /* else: error */ _unur_error(distr_name,UNUR_ERR_SHOULD_NOT_HAPPEN,""); return UNUR_INFINITY; } /* end of _unur_pdf_cxtrans() */ /*---------------------------------------------------------------------------*/ double _unur_logpdf_cxtrans( double x, const struct unur_distr *cxt ) /* logPDF(x) = logf(phi^{-1}(x)) + log((phi^{-1})'(x)) logf(.) ... logPDF of underlying distribution phi(.) ... transformation */ { double alpha, s, logs, mu; /* check arguments */ CHECK_NULL( cxt, UNUR_INFINITY ); CHECK_NULL( cxt->base, UNUR_INFINITY ); CHECK_NULL( cxt->base->data.cont.logpdf, UNUR_INFINITY ); alpha = CXT.ALPHA; s = CXT.SIGMA; mu = CXT.MU; logs = log(CXT.SIGMA); /* exponential transformation */ if (_unur_isinf(alpha)==1) { if (x<=0.) return -UNUR_INFINITY; else { /* logPDF(log(x))-log(x) */ double logx = log(x); double logfx = logPDF(s*logx+mu); return (_unur_isfinite(logfx) ? (logfx - logx + logs) : CXT.logPDFPOLE); } } /* logarithmic transformation */ if (_unur_iszero(alpha)) { /* logPDF(exp(x)) + x */ double ex = s * exp(x) + mu; if (! _unur_isfinite(ex)) { /* logPDF must be -infinity (the PDF must be zero) at +-infinity */ return -UNUR_INFINITY; } else { double logfx = logPDF(ex); /* if logPDF(logx) is not finite, we assume that it is a pole */ return (_unur_isfinite(logfx) ? (logfx + x + logs) : CXT.logPDFPOLE); } } /* identical transformation */ if (_unur_isone(alpha)) { double logfx = logPDF(s*x+mu); return (_unur_isfinite(logfx) ? (logfx + logs) : CXT.logPDFPOLE); } /* power transformation */ if (alpha > 0.) { double phix = s * POW(x) + mu; if (! _unur_isfinite(phix)) { /* logPDF must be -infinity (the PDF must be zero) at +-infinity */ return -UNUR_INFINITY; } else { double logfx = logPDF(phix); if (_unur_isfinite(logfx) && (!_unur_iszero(x) || alpha < 1.)) { double logfcx = logfx + logs + dlogPOW(x); /* if logf(phix) is finite but logfx+dlogPOW(x) is not, */ /* we assume that the PDF of the transformed variable is zero. */ /* (This case is very unlikely to happen, but we should be */ /* prepared for round-off error of the FPA.) */ return (_unur_isfinite(logfcx) ? logfcx : -UNUR_INFINITY); } else /* if PDF(phix) is not finite, we assume that it is a pole */ return CXT.logPDFPOLE; } } /* else: error */ _unur_error(distr_name,UNUR_ERR_SHOULD_NOT_HAPPEN,""); return UNUR_INFINITY; } /* end of _unur_logpdf_cxtrans() */ /*---------------------------------------------------------------------------*/ double _unur_dpdf_cxtrans( double x, const struct unur_distr *cxt ) /* PDF(x) = f'(phi^{-1}(x))*((phi^{-1})'(x))^2 + f(phi^{-1}(x))*(phi^{-1})''(x) f(.) ... PDF of underlying distribution phi(.) ... transformation */ { double alpha, s, mu; /* check arguments */ CHECK_NULL( cxt, UNUR_INFINITY ); CHECK_NULL( cxt->base, UNUR_INFINITY ); CHECK_NULL( cxt->base->data.cont.pdf, UNUR_INFINITY ); CHECK_NULL( cxt->base->data.cont.dpdf, UNUR_INFINITY ); alpha = CXT.ALPHA; s = CXT.SIGMA; mu = CXT.MU; /* exponential transformation */ if (_unur_isinf(alpha)==1) { if (x<=0.) return 0.; else { /* dPDF(log(x))/x^2 - PDF(log(x))/x^2 */ double logx = s*log(x)+mu; double fx = PDF(logx); double dfx = dPDF(logx); return (_unur_isfinite(fx) ? s*(s*dfx - fx)/(x*x) : _unur_dpdf_at_pole(cxt)); } } /* logarithmic transformation */ if (_unur_iszero(alpha)) { /* dPDF(exp(x)) * exp(2*x) + PDF(exp(x)) * exp(x) */ double ex = s*exp(x)+mu; if (! _unur_isfinite(ex)) { /* dPDF must be zero at +-infinity */ return 0.; } else { double fx = PDF(ex); double dfx = dPDF(ex); double dfcx = s * (dfx * s*ex*ex + fx * ex); /* if PDF(ex) is not finite, we assume that it is a pole */ if (! _unur_isfinite(fx) ) return _unur_dpdf_at_pole(cxt); /* if derivate of PDF(ex) is not finite (or NaN) we return +/- UNUR_INFINITY */ if (! _unur_isfinite(dfcx) ) return (dfx>0 ? UNUR_INFINITY : -UNUR_INFINITY); /* otherwise return computed value */ return dfcx; } } /* identical transformation */ if (_unur_isone(alpha)) { double fx = PDF(s*x+mu); double dfx = dPDF(s*x+mu); return (_unur_isfinite(fx) ? s*dfx : _unur_dpdf_at_pole(cxt)); } if (alpha > 0.) { /* power transformation */ double phix = s*POW(x)+mu; if (! _unur_isfinite(phix)) { /* dPDF must be zero at +-infinity */ return 0.; } else { double fx = PDF(phix); double dfx = dPDF(phix); double dphix = dPOW(x); double ddphix = ddPOW(x); if (_unur_isfinite(fx) && (!_unur_iszero(x) || alpha <= 0.5)) { double dfcx = s*(dfx * s*dphix*dphix + fx * s*ddphix); /* if f(phix) is finite but dfcx is not, we assume that dPDF */ /* of the transformed variable is zero. */ /* (This case is very unlikely to happen, but we should be */ /* prepared for round-off error of the FPA.) */ return (_unur_isfinite(dfcx) ? dfcx : 0.); } else /* if PDF(phix) is not finite, we assume that it is a pole */ return _unur_dpdf_at_pole(cxt); } } /* else: error */ _unur_error(distr_name,UNUR_ERR_SHOULD_NOT_HAPPEN,""); return UNUR_INFINITY; } /* end of _unur_dpdf_cxtrans() */ /*---------------------------------------------------------------------------*/ double _unur_dlogpdf_cxtrans( double x, const struct unur_distr *cxt ) /* PDF(x) = logf'(phi^{-1}(x)) * (phi^{-1})'(x) + (phi^{-1})''(x) / (phi^{-1})'(x) = logf'(phi^{-1}(x)) * (phi^{-1})'(x) + (log(phi^{-1})'(x))' logf(.) ... logPDF of underlying distribution phi(.) ... transformation */ { double alpha, s, mu; /* check arguments */ CHECK_NULL( cxt, UNUR_INFINITY ); CHECK_NULL( cxt->base, UNUR_INFINITY ); CHECK_NULL( cxt->base->data.cont.logpdf, UNUR_INFINITY ); CHECK_NULL( cxt->base->data.cont.dlogpdf, UNUR_INFINITY ); alpha = CXT.ALPHA; s = CXT.SIGMA; mu = CXT.MU; /* exponential transformation */ if (_unur_isinf(alpha)==1) { if (x<=0.) return -UNUR_INFINITY; else { /* (dlogPDF(log(x)) - 1) / x */ double logx = s*log(x)+mu; double logfx = logPDF(logx); double dlogfx = dlogPDF(logx); /* if logPDF(logx) is not finite, we assume that it is a pole */ return (_unur_isfinite(logfx) ? ((s*dlogfx-1)/x) : CXT.dlogPDFPOLE); } } /* logarithmic transformation */ if (_unur_iszero(alpha)) { /* dlogPDF(exp(x))*exp(x) + 1 */ double ex = s*exp(x)+mu; if (! _unur_isfinite(ex)) { /* dlogPDF must be -/+ infinity at +/-infinity */ return (x>1. ? -UNUR_INFINITY : UNUR_INFINITY); } else { double logfx = logPDF(ex); double dlogfx = dlogPDF(ex); return (_unur_isfinite(logfx) ? s*dlogfx*ex + 1 : CXT.dlogPDFPOLE); } } /* identical transformation */ if (_unur_isone(alpha)) { double logfx = logPDF(x); return (_unur_isfinite(logfx) ? s*dlogPDF(x) : CXT.dlogPDFPOLE); } if (alpha > 0.) { /* power transformation */ double phix = s*POW(x)+mu; if (! _unur_isfinite(phix)) { /* dlogPDF must be -/+ infinity at +/-infinity */ return ((x>1. || (x>-1. && x < 0.)) ? -UNUR_INFINITY : UNUR_INFINITY); } else { double logfx = logPDF(phix); if (_unur_isfinite(logfx) && (!_unur_iszero(x) || alpha <= 1.)) { double dlogfcx = ((x>=0.)?1.:-1.) * (dlogPDF(phix) * s*dPOW(x) + (1./alpha-1.)/x); if (! _unur_isfinite(dlogfcx)) { /* if logf(phix) is finite but dlogfcx is not, we assume that dPDF */ /* of the transformed variable is zero. */ /* (This case is very unlikely to happen, but we should be */ /* prepared for round-off error of the FPA.) */ return ((x>1. || (x>-1. && x < 0.)) ? -UNUR_INFINITY : UNUR_INFINITY); } return dlogfcx; } else /* if PDF(phix) is not finite, we assume that it is a pole */ return CXT.dlogPDFPOLE; } } /* else: error */ _unur_error(distr_name,UNUR_ERR_SHOULD_NOT_HAPPEN,""); return UNUR_INFINITY; } /* end of _unur_dlogpdf_cxtrans() */ /*---------------------------------------------------------------------------*/ double _unur_pdf_at_pole( const struct unur_distr *cxt ) /* return PDF at pole using logPDF at pole */ { return exp(CXT.logPDFPOLE); } /* end of _unur_pdf_at_pole() */ /*---------------------------------------------------------------------------*/ double _unur_dpdf_at_pole( const struct unur_distr *cxt ) /* return derivative of PDF at pole using derivative of logPDF at pole */ { double fx = _unur_pdf_at_pole(cxt); if (! (_unur_isfinite(CXT.logPDFPOLE) && _unur_isfinite(fx)) ) return UNUR_INFINITY; else return (fx * CXT.dlogPDFPOLE); } /* end of _unur_dpdf_at_pole() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** debug **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ void _unur_distr_cxtrans_debug( const struct unur_distr *cxt, const char *genid ) /*----------------------------------------------------------------------*/ /* write info about distribution into LOG file */ /* */ /* parameters: */ /* cxt ... pointer to distribution of transformed RV */ /* genid ... pointer to generator id */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(cxt,RETURN_VOID); COOKIE_CHECK(cxt,CK_DISTR_CONT,RETURN_VOID); CHECK_NULL(cxt->base,RETURN_VOID); LOG = unur_get_stream(); /* print data about distribution */ fprintf(LOG,"%s: distribution:\n",genid); fprintf(LOG,"%s:\ttype = continuous univariate distribution of transformed random variable\n",genid); fprintf(LOG,"%s:\tname = %s\n",genid,cxt->name); fprintf(LOG,"%s:\talpha = %g\t",genid,CXT.ALPHA); if (_unur_isinf(CXT.ALPHA)==1) fprintf(LOG,"[ exponential transformation: Y = exp(Z) ]\n"); else if (_unur_iszero(CXT.ALPHA)) fprintf(LOG,"[ logarithmic transformation: Y = log(Z) ]\n"); else fprintf(LOG,"[ power transformation: Y = Z^alpha ]\n"); fprintf(LOG,"%s:\tmu = %g, sigma = %g\t[Z = (X-%g)/%g]\n",genid, CXT.MU, CXT.SIGMA, CXT.MU, CXT.SIGMA); fprintf(LOG,"%s:\n",genid); fprintf(LOG,"%s:\tvalues used at pole of underlying distribution\n",genid); fprintf(LOG,"%s:\t\tlogPDF = %g\t(PDF = %g)",genid, CXT.logPDFPOLE, _unur_pdf_at_pole(cxt)); _unur_print_if_default(cxt,UNUR_DISTR_SET_GENERIC); fprintf(LOG,"\n"); fprintf(LOG,"%s:\t\tdlogPDF = %g\t(dPDF = %g)",genid, CXT.dlogPDFPOLE, _unur_dpdf_at_pole(cxt)); _unur_print_if_default(cxt,UNUR_DISTR_SET_GENERIC); fprintf(LOG,"\n"); if (cxt->set & UNUR_DISTR_SET_MODE) fprintf(LOG,"%s:\tmode = %g\n",genid,CXT.mode); else fprintf(LOG,"%s:\tmode unknown\n",genid); fprintf(LOG,"%s:\tdomain = (%g, %g)",genid,CXT.BD_LEFT,CXT.BD_RIGHT); _unur_print_if_default(cxt,UNUR_DISTR_SET_DOMAIN); fprintf(LOG,"\n%s:\tarea below PDF = %g",genid,CXT.area); _unur_print_if_default(cxt,UNUR_DISTR_SET_PDFAREA); fprintf(LOG,"\n%s:\n",genid); /* print data about underlying distribution */ fprintf(LOG,"%s: Underlying distribution:\n",genid); _unur_distr_cont_debug(cxt->base, genid); } /* end of _unur_distr_cxtrans_debug() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distr/cvemp.c0000644001357500135600000003675414420445767013263 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: cvemp.c * * * * manipulate empirical multivariate continuous distribution objects * * (i.e. samples) * * * * return: * * UNUR_SUCCESS ... on success * * error code ... on error * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include "distr_source.h" #include "distr.h" #include "cvemp.h" /*---------------------------------------------------------------------------*/ #define DISTR distr->data.cvemp /*---------------------------------------------------------------------------*/ static void _unur_distr_cvemp_free( struct unur_distr *distr ); /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** empirical univariate continuous distributions **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_cvemp_new( int dim ) /*----------------------------------------------------------------------*/ /* create a new (empty) distribution object */ /* type: empirical multivariate continuous */ /* */ /* parameters: */ /* none */ /* */ /* return: */ /* pointer to distribution object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { register struct unur_distr *distr; /* check dimension for new parameter for distribution */ if (dim < 2) { _unur_error(NULL,UNUR_ERR_DISTR_SET,"dimension < 2"); return NULL; } /* get empty distribution object */ distr = _unur_distr_generic_new(); if (!distr) return NULL; /* set magic cookie */ COOKIE_SET(distr,CK_DISTR_CVEMP); /* set type of distribution */ distr->type = UNUR_DISTR_CVEMP; /* set id to generic distribution */ distr->id = UNUR_DISTR_GENERIC; /* dimension of random vector */ distr->dim = dim; /* multivariant */ /* name for distribution */ distr->name = "(empirical)"; distr->name_str = NULL; /* destructor */ distr->destroy = _unur_distr_cvemp_free; /* clone */ distr->clone = _unur_distr_cvemp_clone; /* set defaults */ /* observed sample */ DISTR.sample = NULL; /* sample */ DISTR.n_sample = 0; /* sample size */ /* return pointer to object */ return distr; } /* end of unur_distr_cvemp_new() */ /*---------------------------------------------------------------------------*/ struct unur_distr * _unur_distr_cvemp_clone( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* copy (clone) distribution object */ /* */ /* parameters: */ /* distr ... pointer to source distribution object */ /* */ /* return: */ /* pointer to clone of distribution object */ /*----------------------------------------------------------------------*/ { #define CLONE clone->data.cvemp struct unur_distr *clone; /* check arguments */ _unur_check_NULL( NULL, distr, NULL ); _unur_check_distr_object( distr, CVEMP, NULL ); /* allocate memory */ clone = _unur_xmalloc( sizeof(struct unur_distr) ); /* copy distribution object into clone */ memcpy( clone, distr, sizeof( struct unur_distr ) ); /* copy data about sample into generator object (when there is one) */ if (DISTR.sample) { CLONE.sample = _unur_xmalloc( DISTR.n_sample * distr->dim * sizeof(double) ); memcpy( CLONE.sample, DISTR.sample, DISTR.n_sample * distr->dim * sizeof(double) ); } /* copy user name for distribution */ if (distr->name_str) { size_t len = strlen(distr->name_str) + 1; clone->name_str = _unur_xmalloc(len); memcpy( clone->name_str, distr->name_str, len ); clone->name = clone->name_str; } return clone; #undef CLONE } /* end of _unur_distr_cvemp_clone() */ /*---------------------------------------------------------------------------*/ void _unur_distr_cvemp_free( struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* free distribution object */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /*----------------------------------------------------------------------*/ { /* check arguments */ if( distr == NULL ) /* nothing to do */ return; COOKIE_CHECK(distr,CK_DISTR_CVEMP,RETURN_VOID); if (DISTR.sample) free( DISTR.sample ); /* user name for distribution */ if (distr->name_str) free(distr->name_str); COOKIE_CLEAR(distr); free( distr ); } /* end of unur_distr_cvemp_free() */ /*---------------------------------------------------------------------------*/ int unur_distr_cvemp_set_data( struct unur_distr *distr, const double *sample, int n_sample ) /*----------------------------------------------------------------------*/ /* set observed sample for distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* sample ... pointer to array of observations */ /* n_sample ... number of observations (sample size) */ /* */ /* sample must be an array of size dim x n_sample */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CVEMP, UNUR_ERR_DISTR_INVALID ); _unur_check_NULL( distr->name, sample, UNUR_ERR_NULL ); /* check new parameter for generator */ if (n_sample <= 0) { _unur_error(NULL,UNUR_ERR_DISTR_SET,"sample size"); return UNUR_ERR_DISTR_SET; } /* allocate memory for sample */ DISTR.sample = _unur_xmalloc( n_sample * distr->dim * sizeof(double) ); if (!DISTR.sample) return UNUR_ERR_MALLOC; /* copy observed sample */ memcpy( DISTR.sample, sample, n_sample * distr->dim * sizeof(double) ); DISTR.n_sample = n_sample; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_distr_cvemp_set_sample() */ /*---------------------------------------------------------------------------*/ int unur_distr_cvemp_read_data( struct unur_distr *distr, const char *filename ) /*----------------------------------------------------------------------*/ /* Read data from file `filename'. */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* filename ... name of data file */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CVEMP, UNUR_ERR_DISTR_INVALID ); /* read data from file */ DISTR.n_sample = _unur_read_data( filename, distr->dim, &(DISTR.sample) ); /* o.k. ? */ return (DISTR.n_sample > 0) ? UNUR_SUCCESS : UNUR_ERR_DISTR_DATA; } /* end of unur_distr_cvemp_read_data() */ /*---------------------------------------------------------------------------*/ int unur_distr_cvemp_get_data( const struct unur_distr *distr, const double **sample ) /*----------------------------------------------------------------------*/ /* get number of observations and set pointer to array observations */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* sample ... pointer to observed sampletor */ /* */ /* return: */ /* sample size */ /* */ /* error: */ /* return 0 */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, 0 ); _unur_check_distr_object( distr, CVEMP, 0 ); *sample = (DISTR.sample) ? DISTR.sample : NULL; return DISTR.n_sample; } /* end of unur_distr_cvemp_get_sample() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ void _unur_distr_cvemp_debug( const struct unur_distr *distr, const char *genid, unsigned printvector ) /*----------------------------------------------------------------------*/ /* write info about distribution into LOG file */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* genid ... pointer to generator id */ /* printvector ... print observed sample if not 0 */ /*----------------------------------------------------------------------*/ { #define idx(k,l) (k * distr->dim + l) FILE *LOG; int i,j; /* check arguments */ CHECK_NULL(distr,RETURN_VOID); COOKIE_CHECK(distr,CK_DISTR_CVEMP,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s: distribution:\n",genid); fprintf(LOG,"%s:\ttype = continuous multivariate distribution (ie. a sample)\n",genid); fprintf(LOG,"%s:\tname = %s\n",genid,distr->name); fprintf(LOG,"%s:\tdimension = %d\n",genid,distr->dim); if (DISTR.n_sample>0) { /* observed samples */ fprintf(LOG,"%s:\tsample size = %d\n",genid,DISTR.n_sample); if (printvector) { for (i=0; idim; j++) fprintf(LOG,", %.5f",DISTR.sample[idx(i,j)]); fprintf(LOG,")\n"); } } } fprintf(LOG,"%s:\n",genid); #undef idx } /* end of _unur_distr_cvemp_debug() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distr/condi.h0000644001357500135600000002070314420304141013211 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: condi.h * * * * PURPOSE: * * function prototypes for manipulating distribution objects of * * id CONDI (continuous full conditional distribution) * * type CONT (continuous univariate distribution) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* =NODEX CONDI Continuous univariate full conditional distribution =UP Distribution_objects [35] =DESCRIPTION Full conditional distribution for a given continuous multivariate distributiion. The condition is a position vector and either a variable that is variated or a vector that indicates the direction on which the random vector can variate. There is a subtle difference between using direction vector and using the @var{k}-th variable. When a direction vector is given the PDF of the conditional distribution is defined by @unurmath{f(t) = PDF(pos + t\cdot dir).} When a variable is selected the full conditional distribution with all other variables fixed is used. This is a special case of a continuous univariate distribution and thus they have most of these parameters (with the exception that functions cannot be changed). Additionally, @itemize @minus @item there is a call to extract the underlying multivariate distribution, @item and a call to handle the variables that are fixed and the direction for changing the random vector. @end itemize This distibution type is primarily used for evaluation the conditional distribution and its derivative (as required for, e.g., the Gibbs sampler). The density is not normalized (i.e. does not integrate to one). Mode and area are not available and it does not make sense to use any call to set or change parameters except the ones given below. =END */ /*---------------------------------------------------------------------------*/ /* Routines for handling univariate continuous full conditional distributions (CONDI). */ /* =ROUTINES */ UNUR_DISTR *unur_distr_condi_new( const UNUR_DISTR *distribution, const double *pos, const double *dir, int k ); /* Create an object for full conditional distribution for the given @var{distribution}. The condition is given by a position vector @var{pos} and either the @var{k}-th variable that is variated or the vector @var{dir} that contains the direction on which the random vector can variate. @var{distribution} must be a pointer to a multivariate continuous distribution. @var{pos} must be a pointer to an array of size @code{dim}, where @code{dim} is the dimension of the underlying distribution object. @var{dir} must be a pointer to an array if size @code{dim} or NULL. @var{k} must be in the range @code{0, @dots{}, dim-1}. If the @var{k}-th variable is used, @var{dir} must be set to NULL. @emph{Notice:} There is a subtle difference between using direction vector @var{dir} and using the @var{k}-th variable. When @var{dir} is given, the current position @var{pos} is mapped into 0 of the conditional distribution and the derivative is taken from the function PDF(@var{pos}+t*@var{dir}) w.r.t. @i{t}. On the other hand, when the coordinate @var{k} is used (i.e., when @var{dir} is set to NULL), the full conditional distribution of the distribution is considered (as used for the Gibbs sampler). In particular, the current point is just projected into the one-dimensional subspace without mapping it into the point 0. @emph{Notice:} If a coordinate @var{k} is used, then the @var{k}-th partial derivative is used if it as available. Otherwise the gradient is computed and the @var{k}-th component is returned. The resulting generator object is of the same type as of a unur_distr_cont_new() call. */ int unur_distr_condi_set_condition( struct unur_distr *distribution, const double *pos, const double *dir, int k ); /* Set/change condition for conditional @var{distribution}. Change values of fixed variables to @var{pos} and use direction @var{dir} or @var{k}-th variable of conditional @var{distribution}. @var{pos} must be a pointer to an array of size @code{dim}, where @code{dim} is the dimension of the underlying distribution object. @var{dir} must be a pointer to an array if size @code{dim} or NULL. @var{k} must be in the range @code{0, @dots{}, dim-1}. If the @var{k}-th variable is used, @var{dir} must be set to NULL. @emph{Notice:} There is a subtle difference between using direction vector @var{dir} and using the @var{k}-th variable. When @var{dir} is given, the current position @var{pos} is mapped into 0 of the conditional distribution and the derivative is taken from the function PDF(@var{pos}+t*@var{dir}) w.r.t. @i{t}. On the other hand, when the coordinate @var{k} is used (i.e., when @var{dir} is set to NULL), the full conditional distribution of the distribution is considered (as used for the Gibbs sampler). In particular, the current point is just projected into the one-dimensional subspace without mapping it into the point 0. */ int unur_distr_condi_get_condition( struct unur_distr *distribution, const double **pos, const double **dir, int *k ); /* Get condition for conditional @var{distribution}. The values for the fixed variables are stored in @var{pos}, which must be a pointer to an array of size @code{dim}. The condition is stored in @var{dir} and @var{k}, respectively. @emph{Important:} Do @strong{not} change the entries in @var{pos} and @var{dir}! */ const UNUR_DISTR *unur_distr_condi_get_distribution( const UNUR_DISTR *distribution ); /* Get pointer to distribution object for underlying distribution. */ /* =END */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distr/cemp.h0000644001357500135600000001651714420445767013075 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: cemp.h * * * * PURPOSE: * * function prototypes for manipulating distribution objects of * * type CEMP (continuous empirical univariate distribution) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* =NODEX CEMP Continuous empirical univariate distributions =UP Distribution_objects [20] =DESCRIPTION Empirical univariate distributions are derived from observed data. There are two ways to create such a generator object: @enumerate @item By a list of @emph{raw data} by means of a unur_distr_cemp_set_data() call. @item By a @emph{histogram} (i.e. preprocessed data) by means of a unur_distr_cemp_set_hist() call. @end enumerate How these data are used to sample from the empirical distribution depends from the chosen generation method. =END */ /*---------------------------------------------------------------------------*/ /* Routines for handling empirical univariate continuous distributions (CEMP). */ /* =ROUTINES */ UNUR_DISTR *unur_distr_cemp_new( void ); /* Create a new (empty) object for empirical univariate continuous distribution. */ /* ==DOC @subsubheading Essential parameters */ int unur_distr_cemp_set_data( UNUR_DISTR *distribution, const double *sample, int n_sample ); /* Set observed sample for empirical distribution. */ int unur_distr_cemp_read_data( UNUR_DISTR *distribution, const char *filename ); /* Read data from file @file{filename}. It reads the first number from each line. Numbers are parsed by means of the C standard routine @command{strtod}. Lines that do not start with @code{+}, @code{-}, @code{.}, or a digit are ignored. (Beware of lines starting with a blank!) In case of an error (file cannot be opened, invalid string for double in line) no data are copied into the distribution object and an error code is returned. */ int unur_distr_cemp_get_data( const UNUR_DISTR *distribution, const double **sample ); /* Get number of samples and set pointer @var{sample} to array of observations. If no sample has been given, an error code is returned and @code{sample} is set to NULL. @emph{Important:} Do @strong{not} change the entries in @var{sample}! */ int unur_distr_cemp_set_hist( UNUR_DISTR *distribution, const double *prob, int n_prob, double xmin, double xmax ); /* Set a histogram with bins of equal width. @var{prob} is an array of length @var{n_prob} that contains the probabilities for the bins (in ascending order). @var{xmin} and @var{xmax} give the lower and upper bound of the histogram, respectively. The bins are assumed to have equal width. @emph{Remark:} This is shortcut for calling unur_distr_cemp_set_hist_prob() and unur_distr_cemp_set_hist_domain(). @emph{Notice:} All sampling methods either use raw data or histogram. It is possible to set both types of data; however, it is not checked whether the given histogran corresponds to possibly given raw data. */ int unur_distr_cemp_set_hist_prob( UNUR_DISTR *distribution, const double *prob, int n_prob ); /* Set probabilities of a histogram with @var{n_prob} bins. Hence @var{prob} must be an array of length @var{n_prob} that contains the probabilities for the bins in ascending order. It is important also to set the location of the bins either with a unur_distr_cemp_set_hist_domain() for bins of equal width or unur_distr_cemp_set_hist_bins() when the bins have different width. @emph{Notice:} All sampling methods either use raw data or histogram. It is possible to set both types of data; however, it is not checked whether the given histogram corresponds to possibly given raw data. */ int unur_distr_cemp_set_hist_domain( UNUR_DISTR *distribution, double xmin, double xmax ); /* Set a domain of a histogram with bins of equal width. @var{xmin} and @var{xmax} give the lower and upper bound of the histogram, respectively. */ int unur_distr_cemp_set_hist_bins( UNUR_DISTR *distribution, const double *bins, int n_bins ); /* Set location of bins of a histogram with @var{n_bins} bins. Hence @var{bins} must be an array of length @var{n_bins}. The domain of the @var{distribution} is automatically set by this call and overrides any calls to unur_distr_cemp_set_hist_domain(). @emph{Important:} The probabilities of the bins of the @var{distribution} must be already be set by a unur_distr_cemp_set_hist_prob() (or a unur_distr_cemp_set_hist() call) and the value of @var{n_bins} must equal @var{n_prob}@code{+1} from the corresponding value of the respective call. */ /* =END */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distr/distr.c0000644001357500135600000005115414420445767013265 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: distr.c * * * * manipulate distribution objects * * * * PARAMETER: struct unur_distr * * * * * return: * * UNUR_SUCCESS ... on success * * error code ... on error * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include "distr.h" #include "distr_source.h" /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** routines for all distribution objects **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ struct unur_distr * _unur_distr_generic_new( void ) /*----------------------------------------------------------------------*/ /* generic creator for distribution object */ /* */ /* parameters: none */ /* */ /* return: */ /* pointer empty distribution object */ /* NULL in case of an error */ /*----------------------------------------------------------------------*/ { register struct unur_distr *distr; /* allocate structure */ distr = _unur_xmalloc( sizeof(struct unur_distr) ); if (!distr) return NULL; /* set type of distribution */ distr->type = UNUR_DISTR_GENERIC; /* set id to generic distribution */ distr->id = UNUR_DISTR_GENERIC; /* dimension of random vector */ distr->dim = 1; /* assume univariant */ /* name of distribution */ distr->name = "unknown"; distr->name_str = NULL; /* this is not a derived distribution */ distr->base = NULL; /* defaults */ distr->destroy = NULL; /* destructor: not set */ distr->clone = NULL; /* copy operator: not set */ distr->extobj = NULL; /* pointer to external object: empty */ distr->set = 0u; /* parameters: none set */ /* return pointer to object */ return distr; } /* end of _unur_distr_generic_new() */ /*---------------------------------------------------------------------------*/ void unur_distr_free( struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* free distribution object */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /*----------------------------------------------------------------------*/ { if (distr) _unur_distr_free( distr ); } /* end of unur_distr_free() */ /*---------------------------------------------------------------------------*/ int unur_distr_set_name( struct unur_distr *distr, const char *name ) /*----------------------------------------------------------------------*/ /* set name of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* name ... name of distribution */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { size_t len; char *name_str; /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); /* allocate memory for storing string */ len = strlen(name) + 1; name_str = _unur_xrealloc(distr->name_str,len); /* copy string */ memcpy( name_str, name, len ); /* store string in distribution object */ distr->name_str = name_str; distr->name = name_str; return UNUR_SUCCESS; } /* end of unur_distr_set_name() */ /*---------------------------------------------------------------------------*/ const char * unur_distr_get_name( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get name of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* name of distribution */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, NULL ); return distr->name; } /* end of unur_distr_get_name() */ /*---------------------------------------------------------------------------*/ int unur_distr_get_dim( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get number of components of random vector (i.e. its dimension) */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* dimension */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, 0 ); return distr->dim; } /* end of unur_distr_get_dim() */ /*---------------------------------------------------------------------------*/ unsigned int unur_distr_get_type( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get type of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* type of distribution */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, 0u ); return (distr->type); } /* end of unur_distr_get_type() */ /*---------------------------------------------------------------------------*/ int unur_distr_is_cont( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* TRUE if distribution is univariate continuous. */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* TRUE ... if continuous distribution */ /* FALSE ... otherwise (and in case of an error) */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, FALSE ); return ((distr->type == UNUR_DISTR_CONT) ? TRUE : FALSE); } /* end of unur_distr_is_cont() */ /*---------------------------------------------------------------------------*/ int unur_distr_is_cvec( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* TRUE if distribution is multivariate continuous. */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* TRUE ... if multivariate continuous */ /* FALSE ... otherwise (and in case of an error) */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, FALSE ); return ((distr->type == UNUR_DISTR_CVEC) ? TRUE : FALSE); } /* end of unur_distr_is_cvec() */ /*---------------------------------------------------------------------------*/ int unur_distr_is_cvemp( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* TRUE if distribution is empirical multivariate continuous. */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* TRUE ... if empirical multivariate continuous */ /* FALSE ... otherwise (and in case of an error) */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, FALSE ); return ((distr->type == UNUR_DISTR_CVEMP) ? TRUE : FALSE); } /* end of unur_distr_is_cvemp() */ /*---------------------------------------------------------------------------*/ int unur_distr_is_matr( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* TRUE if distribution is matrix distribution. */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* TRUE ... if matrix distribution */ /* FALSE ... otherwise (and in case of an error) */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, FALSE ); return ((distr->type == UNUR_DISTR_MATR) ? TRUE : FALSE); } /* end of unur_distr_is_matr() */ /*---------------------------------------------------------------------------*/ int unur_distr_is_discr( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* TRUE if distribution is univariate discrete. */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* TREU ... if univariate discrete */ /* FALSE ... otherwise (and in case of an error) */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, FALSE ); return ((distr->type == UNUR_DISTR_DISCR) ? TRUE : FALSE); } /* end of unur_distr_is_discr() */ /*---------------------------------------------------------------------------*/ int unur_distr_is_cemp( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* TRUE if distribution is empirical univariate continuous, */ /* i.e. a sample. */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* TRUE ... if univariate discrete */ /* FALSE ... otherwise (and in case of an error) */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, FALSE ); return ((distr->type == UNUR_DISTR_CEMP) ? TRUE : FALSE); } /* end of unur_distr_is_cemp() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_clone( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* copy (clone) distribution object */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* pointer to clone of distribution object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( "Clone", distr, NULL ); _unur_check_NULL( "Clone", distr->clone, NULL ); return (distr->clone(distr)); } /* end of unur_distr_clone() */ /*---------------------------------------------------------------------------*/ int unur_distr_set_extobj( struct unur_distr *distr, const void *extobj ) /*----------------------------------------------------------------------*/ /* store a pointer to an external object */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* extobj ... pointer to external object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); /* store data */ distr->extobj = extobj; return UNUR_SUCCESS; } /* end of unur_distr_set_extobj() */ /*---------------------------------------------------------------------------*/ const void * unur_distr_get_extobj( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get the pointer to the external object */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* pointer to external object */ /* (NULL if not is given) */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, NULL ); return distr->extobj; } /* unur_distr_get_extobj() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distr/deprecated_distr.h0000644001357500135600000001356514420445767015456 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: deprecated_distr.h * * * * PURPOSE: * * function prototypes and macros for deprecated routines * * * ***************************************************************************** * * * THESE ROUTINES SHOULD NOT BE USED ANY MORE! * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifndef UNUR_DEPRECATED_DISTR_H_SEEN #define UNUR_DEPRECATED_DISTR_H_SEEN /*---------------------------------------------------------------------------*/ /* Set and get standardized marginal distributions. */ int unur_distr_cvec_set_stdmarginals( UNUR_DISTR *distribution, UNUR_DISTR *marginal ); /* Sets standardized marginal distributions of the given @var{distribution} to the same @var{marginal} distribution object. The @var{marginal} distribution must be an instance of a continuous univariate distribution object. In conjunction with unur_distr_cvec_set_covar() and unur_distr_cvec_set_mean() the standardized marginals must be used, i.e., they should have mean 0 and standard deviation 1 (if both exist for the given marginal distribution). Notice that the marginal distribution is copied into the @var{distribution} object. */ int unur_distr_cvec_set_stdmarginal_array( UNUR_DISTR *distribution, UNUR_DISTR **marginals ); /* Analogously to the above unur_distr_cvec_set_stdmarginals() calls. However, now an array @var{marginals} of the pointers to each of the marginal distributions must be given. It @strong{must} be an array of size @code{dim}, where @code{dim} is the dimension returned by unur_distr_get_dim(). @emph{Notice}: Local copies for each of the entries are stored in the @var{distribution} object. If some of these entries are identical (i.e. contain the same pointer), then for each of these a new copy is made. */ int unur_distr_cvec_set_stdmarginal_list( UNUR_DISTR *distribution, ... ); /* Similar to the above unur_distr_cvec_set_stdmarginal_array() call. However, now the pointers to the particular marginal distributions can be given as parameter and does not require an array of pointers. Additionally the given distribution objects are immediately destroyed. Thus calls like unur_distr_normal() can be used as arguments. (With unur_distr_cvec_set_marginal_array() the result of such call has to be stored in a pointer since it has to be freed afterwarts to avoid memory leaks!) If one of the given pointer to marginal distributions is the NULL pointer then the marginal distributions of @var{distribution} are not set (or previous settings are not changed) and an error code is returned. @strong{Important:} All distribution objects given in the argument list are destroyed! */ const UNUR_DISTR *unur_distr_cvec_get_stdmarginal( const UNUR_DISTR *distribution, int n ); /* Get pointer to the @var{n}-th (standardized) marginal distribution object from the given multivariate @var{distribution}. If this does not exist, NULL is returned. The marginal distributions are enumerated from @code{1} to @code{dim}, where @code{dim} is the dimension returned by unur_distr_get_dim(). */ /*---------------------------------------------------------------------------*/ #endif /* UNUR_DEPRECATED_DISTR_H_SEEN */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distr/matr.c0000644001357500135600000002727514420445767013112 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: matr.c * * * * manipulate matrix distribution objects * * * * return: * * UNUR_SUCCESS ... on success * * error code ... on error * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "distr_source.h" #include "distr.h" #include "matr.h" /*---------------------------------------------------------------------------*/ #define DISTR distr->data.matr /*---------------------------------------------------------------------------*/ static void _unur_distr_matr_free( struct unur_distr *distr ); /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** matrix distributions **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_matr_new( int n_rows, int n_cols ) /*----------------------------------------------------------------------*/ /* create a new (empty) distribution object */ /* type: matrix distribution */ /* */ /* parameters: */ /* n_rows ... number of rows of matrix */ /* n_cols ... number of columns of matrix */ /* */ /* return: */ /* pointer to distribution object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { register struct unur_distr *distr; /* check dimension for new parameter for distribution */ if (n_rows < 1 || n_cols < 1) { _unur_error(NULL,UNUR_ERR_DISTR_SET,"n_rows or n_cols < 1"); return NULL; } /* get empty distribution object */ distr = _unur_distr_generic_new(); if (!distr) return NULL; /* set magic cookie */ COOKIE_SET(distr,CK_DISTR_MATR); /* set type of distribution */ distr->type = UNUR_DISTR_MATR; /* set id to generic distribution */ distr->id = UNUR_DISTR_GENERIC; /* dimension of random vector */ DISTR.n_rows = n_rows; DISTR.n_cols = n_cols; distr->dim = n_rows * n_cols; /* destructor */ distr->destroy = _unur_distr_matr_free; /* clone */ distr->clone = _unur_distr_matr_clone; /* set defaults */ DISTR.init = NULL; /* pointer to special init routine (default: none) */ /* return pointer to object */ return distr; } /* end of unur_distr_matr_new() */ /*---------------------------------------------------------------------------*/ struct unur_distr * _unur_distr_matr_clone( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* copy (clone) distribution object */ /* */ /* parameters: */ /* distr ... pointer to source distribution object */ /* */ /* return: */ /* pointer to clone of distribution object */ /*----------------------------------------------------------------------*/ { #define CLONE clone->data.matr struct unur_distr *clone; /* check arguments */ _unur_check_NULL( NULL, distr, NULL ); _unur_check_distr_object( distr, MATR, NULL ); /* allocate memory */ clone = _unur_xmalloc( sizeof(struct unur_distr) ); /* copy distribution object into clone */ memcpy( clone, distr, sizeof( struct unur_distr ) ); /* copy data about distribution */ /* copy user name for distribution */ if (distr->name_str) { size_t len = strlen(distr->name_str) + 1; clone->name_str = _unur_xmalloc(len); memcpy( clone->name_str, distr->name_str, len ); clone->name = clone->name_str; } return clone; #undef CLONE } /* end of _unur_distr_matr_clone() */ /*---------------------------------------------------------------------------*/ void _unur_distr_matr_free( struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* free distribution object */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /*----------------------------------------------------------------------*/ { /* check arguments */ if( distr == NULL ) /* nothing to do */ return; COOKIE_CHECK(distr,CK_DISTR_MATR,RETURN_VOID); /* user name for distribution */ if (distr->name_str) free(distr->name_str); COOKIE_CLEAR(distr); free( distr ); } /* end of unur_distr_matr_free() */ /*---------------------------------------------------------------------------*/ int unur_distr_matr_get_dim( const struct unur_distr *distr, int *n_rows, int *n_cols ) /*----------------------------------------------------------------------*/ /* get number of rows and columns of matrix */ /* return total number of entries */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* n_rows ... to store number of rows */ /* n_cols ... to store number of rows */ /* */ /* return: */ /* total number of entries */ /* */ /* error: */ /* return 0 */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, 0 ); _unur_check_distr_object( distr, MATR, 0 ); CHECK_NULL( n_rows, 0 ); CHECK_NULL( n_cols, 0 ); *n_rows = DISTR.n_rows; *n_cols = DISTR.n_cols; return distr->dim; } /* end of unur_distr_matr_get_dim() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ void _unur_distr_matr_debug( const struct unur_distr *distr, const char *genid ) /*----------------------------------------------------------------------*/ /* write info about distribution into LOG file */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* genid ... pointer to generator id */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(distr,RETURN_VOID); COOKIE_CHECK(distr,CK_DISTR_MATR,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s: distribution:\n",genid); fprintf(LOG,"%s:\ttype = matrix distribution\n",genid); fprintf(LOG,"%s:\tname = %s\n",genid,distr->name); fprintf(LOG,"%s:\tdimension = %d x %d (= %d)\n",genid,DISTR.n_rows,DISTR.n_cols,distr->dim); fprintf(LOG,"%s:\n",genid); } /* end of _unur_distr_matr_debug() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distr/condi.c0000644001357500135600000005457114420445767013242 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: condi.c * * * * manipulate univariate continuous full conditional distributions * * * * return: * * UNUR_SUCCESS ... on success * * error code ... on error * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "distr.h" #include "cont.h" #include "condi.h" #include "distr_source.h" /*---------------------------------------------------------------------------*/ static const char distr_name[] = "conditional"; /*---------------------------------------------------------------------------*/ #define DISTR distr->data.cvec /* underlying (base) distribution */ #define CONDI condi->data.cont /* conditional distribution */ #define iK 0 /* index of variable to be variated */ #define K (condi->data.cont.params[iK]) #define iPOSITION 0 /* condition (position of point) */ #define iDIRECTION 1 /* direction of variation */ #define iXARG 2 /* working array for storing point x */ #define iGRADF 3 /* working array for storing grad of PDF */ #define POSITION (condi->data.cont.param_vecs[iPOSITION]) #define DIRECTION (condi->data.cont.param_vecs[iDIRECTION]) #define XARG (condi->data.cont.param_vecs[iXARG]) #define GRADF (condi->data.cont.param_vecs[iGRADF]) /*---------------------------------------------------------------------------*/ /* function prototypes */ static double _unur_pdf_condi( double x, const struct unur_distr *condi ); static double _unur_dpdf_condi( double x, const struct unur_distr *condi ); static double _unur_logpdf_condi( double x, const struct unur_distr *condi ); static double _unur_dlogpdf_condi( double x, const struct unur_distr *condi ); /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** univariate continuous conditional distribution of multivaraiate **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_condi_new( const struct unur_distr *distr, const double *pos, const double *dir, int k ) /*----------------------------------------------------------------------*/ /* Create an object for full conditional distribution . */ /* either for k-th variable and the other variables fixed to pos; */ /* or for pos + t*dir. */ /* The first one is chosen when dir == NULL. */ /* `distr' must be a pointer to a multivariate continuous distribution. */ /* */ /* parameters: */ /* distr ... pointer to multivariate continuous distribution. */ /* pos ... values for constant variables */ /* dir ... direction (or NULL) */ /* k ... variable (must be in range 0 ... dim-1) */ /* */ /* return: */ /* pointer to conditional distribution object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_distr *condi; double *ar; /* check arguments */ _unur_check_NULL( distr_name, distr, NULL ); /* check distribution */ if (distr->type != UNUR_DISTR_CVEC) { _unur_error(distr_name,UNUR_ERR_DISTR_INVALID,""); return NULL; } COOKIE_CHECK(distr,CK_DISTR_CVEC,NULL); /* check parameters pos and k */ _unur_check_NULL( distr_name, pos, NULL ); if ( dir==NULL && (k<0 || k>=distr->dim)) { _unur_error(distr_name,UNUR_ERR_DISTR_INVALID,"k < 0 or k >= dim"); return NULL; } /* get distribution object for generic continuous univariate distribution */ condi = unur_distr_cont_new(); if (!condi) return NULL; /* set id to distribution of conditional distribution */ condi->id = UNUR_DISTR_CONDI; /* name of distribution */ condi->name = distr_name; /* this is a derived distribution */ /* clone base distribution ... */ condi->base = _unur_distr_cvec_clone( distr ); if (!condi->base) { _unur_distr_free(condi); return NULL; } /* set parameters for conditional distribution */ CONDI.n_params = 1; /* one parameters: k */ if ( unur_distr_condi_set_condition( condi, pos, dir, k ) != UNUR_SUCCESS ) { _unur_distr_free(condi); return NULL; } /* we need two working arrays for computing PDF and dPDF */ /* we abuse parameter vectors for this purpose */ ar = _unur_xmalloc( distr->dim * sizeof(double) ); memset( ar, 0, distr->dim * sizeof(double) ); if ( (unur_distr_cont_set_pdfparams_vec( condi, iXARG, ar, distr->dim ) != UNUR_SUCCESS) || (unur_distr_cont_set_pdfparams_vec( condi, iGRADF, ar, distr->dim ) != UNUR_SUCCESS) ) { _unur_distr_free(condi); free(ar); return NULL; } free(ar); /* pointer to PDF, its derivative, and CDF */ if (DISTR.pdf) { CONDI.pdf = _unur_pdf_condi; /* pointer to PDF */ if (DISTR.dpdf) CONDI.dpdf = _unur_dpdf_condi; /* derivative of PDF */ } /* pointer to logPDF, its derivative */ if (DISTR.logpdf) { CONDI.logpdf = _unur_logpdf_condi; /* pointer to logPDF */ if (DISTR.dlogpdf) CONDI.dlogpdf = _unur_dlogpdf_condi; /* derivative of logPDF */ } /* return pointer to object */ return condi; } /* end of unur_distr_condi_new() */ /*---------------------------------------------------------------------------*/ int unur_distr_condi_set_condition( struct unur_distr *condi, const double *pos, const double *dir, int k ) /*----------------------------------------------------------------------*/ /* Change values of fixed variables to pos and use k-th variable / */ /* direction dir. */ /* */ /* parameters: */ /* condi ... pointer to conditional distribution */ /* pos ... values for constant variables */ /* dir ... direction (or NULL) */ /* k ... variable (must be in range 0 ... dim-1) */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int dim; double *domain; /* check arguments */ _unur_check_NULL( distr_name, condi, UNUR_ERR_NULL ); _unur_check_distr_object( condi, CONT, UNUR_ERR_DISTR_INVALID ); /* check distribution */ if (condi->id != UNUR_DISTR_CONDI) { _unur_error(distr_name,UNUR_ERR_DISTR_INVALID,""); return UNUR_ERR_DISTR_INVALID; } COOKIE_CHECK(condi,CK_DISTR_CONT,UNUR_ERR_COOKIE); /* dimension of underlying distribution */ dim = condi->base->dim; /* check parameters pos and k */ _unur_check_NULL( condi->name, pos, UNUR_ERR_NULL ); if ( dir== NULL && (k<0 || k>=dim)) { _unur_error(condi->name,UNUR_ERR_DISTR_INVALID,"k < 0 or k >= dim"); return UNUR_ERR_DISTR_INVALID; } /* set parameters for conditional distribution */ K = (double) k; if ( unur_distr_cont_set_pdfparams_vec( condi, iPOSITION, pos, dim ) != UNUR_SUCCESS ) { return UNUR_ERR_DISTR_INVALID; } if ( unur_distr_cont_set_pdfparams_vec( condi, iDIRECTION, dir, dim ) != UNUR_SUCCESS ) { return UNUR_ERR_DISTR_INVALID; } /* set domain of conditional distribution */ if ( (domain = condi->base->data.cvec.domainrect) != NULL ) { if (dir == NULL) { CONDI.trunc[0] = CONDI.domain[0] = domain[2*k]; CONDI.trunc[1] = CONDI.domain[1] = domain[2*k+1]; } else { /* arbitrary direction: we ignore given domain */ CONDI.trunc[0] = CONDI.domain[0] = -UNUR_INFINITY; CONDI.trunc[1] = CONDI.domain[1] = UNUR_INFINITY; } } /* changelog */ condi->set &= ~UNUR_DISTR_SET_MODE; /* mode unknown */ /* o.k. */ return UNUR_SUCCESS; } /* end of unur_distr_condi_set_condition() */ /*---------------------------------------------------------------------------*/ int unur_distr_condi_get_condition( struct unur_distr *condi, const double **pos, const double **dir, int *k ) /*----------------------------------------------------------------------*/ /* Read values of fixed variables, variable k / direction dir. */ /* */ /* parameters: */ /* condi ... pointer to conditional distribution */ /* pos ... pointer to array to store constant variables */ /* dir ... pointer to array to store direction */ /* k ... pointer to store variable */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( distr_name, condi, UNUR_ERR_NULL ); _unur_check_distr_object( condi, CONT, UNUR_ERR_DISTR_INVALID ); /* check distribution */ if (condi->id != UNUR_DISTR_CONDI) { _unur_error(distr_name,UNUR_ERR_DISTR_INVALID,""); return UNUR_ERR_DISTR_INVALID; } COOKIE_CHECK(condi,CK_DISTR_CONT,UNUR_ERR_COOKIE); /* position in vector */ *k = (int) K; /* store pointer to values */ *pos = POSITION; /* store pointer to direction */ *dir = DIRECTION; /* return position */ return UNUR_SUCCESS; } /* end of unur_distr_condi_get_condition() */ /*---------------------------------------------------------------------------*/ const struct unur_distr * unur_distr_condi_get_distribution( const struct unur_distr *condi ) /*----------------------------------------------------------------------*/ /* get pointer to distribution object for underlying distribution */ /* */ /* parameters: */ /* condi ... pointer to conditional distribution object */ /* */ /* return: */ /* pointer to underlying distribution */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( distr_name, condi, NULL ); _unur_check_distr_object( condi, CONT, NULL ); /* check distribution */ if (condi->id != UNUR_DISTR_CONDI) { _unur_warning(distr_name,UNUR_ERR_DISTR_INVALID,""); return NULL; } return condi->base; } /* end of unur_distr_condi_get_distribution() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** PDF, its derivative and CDF of conditional distribution **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ double _unur_pdf_condi( double x, const struct unur_distr *condi ) /* PDF(x) = mvpdf(p(x)) mvpdf(.) ... PDF of underlying multivariate distribution p(x) ... vector with x in k-th position and pos in all others */ { int dim = condi->base->dim; /* dimension of underlying distribution */ int k = (int) K; /* position in vector */ int i; /* set point for multivariate PDF */ if (DIRECTION==NULL) { /* use k-th variable */ memcpy(XARG, POSITION, dim * sizeof(double) ); XARG[k] = x; } else { /* use direction vector */ memcpy(XARG, POSITION, dim * sizeof(double) ); for (i=0; ibase); } /* end of _unur_pdf_condi() */ /*---------------------------------------------------------------------------*/ double _unur_logpdf_condi( double x, const struct unur_distr *condi ) /* logPDF(x) = logmvpdf(p(x)) mvpdf(.) ... logPDF of underlying multivariate distribution p(x) ... vector with x in k-th position and pos in all others */ { int dim = condi->base->dim; /* dimension of underlying distribution */ int k = (int) K; /* position in vector */ int i; /* set point for multivariate logPDF */ if (DIRECTION==NULL) { /* use k-th variable */ memcpy(XARG, POSITION, dim * sizeof(double) ); XARG[k] = x; } else { /* use direction vector */ memcpy(XARG, POSITION, dim * sizeof(double) ); for (i=0; ibase); } /* end of _unur_logpdf_condi() */ /*---------------------------------------------------------------------------*/ double _unur_dpdf_condi( double x, const struct unur_distr *condi ) /* (dPDF/dxk)(x) = (grad mvpdf(p(x)))[k] mvpdf(.) ... PDF of underlying multivariate distribution p(x) ... vector with x in k-th position and pos in all others */ { int dim = condi->base->dim; /* dimension of underlying distribution */ int k = (int) K; /* position in vector */ int i; double df; if (DIRECTION==NULL) { /* use k-th variable */ /* set point for multivariate PDF */ memcpy(XARG, POSITION, dim * sizeof(double) ); XARG[k] = x; if (condi->base->data.cvec.pdpdf) { /* we have a pointer to the partial derivative */ df = _unur_cvec_pdPDF(XARG, k, condi->base); } else { /* we do not have partial derivatives --> have to take coordinate from gradient */ /* compute gradient */ _unur_cvec_dPDF(GRADF, XARG, condi->base); /* return k-th component */ df = GRADF[k]; } } else { /* use direction vector */ memcpy(XARG, POSITION, dim * sizeof(double) ); for (i=0; ibase); for (df=0.,i=0; ibase->dim; /* dimension of underlying distribution */ int k = (int) K; /* position in vector */ int i; double df; if (DIRECTION==NULL) { /* use k-th variable */ /* set point for multivariate logPDF */ memcpy(XARG, POSITION, dim * sizeof(double) ); XARG[k] = x; if (condi->base->data.cvec.pdlogpdf) { /* we have a pointer to the partial derivative */ df = _unur_cvec_pdlogPDF(XARG, k, condi->base); } else { /* we do not have partial derivatives --> have to take coordinate from gradient */ /* compute gradient */ _unur_cvec_dlogPDF(GRADF, XARG, condi->base); /* return k-th component */ df = GRADF[k]; } } else { /* use direction vector */ memcpy(XARG, POSITION, dim * sizeof(double) ); for (i=0; ibase); for (df=0.,i=0; ibase,RETURN_VOID); LOG = unur_get_stream(); /* print data about conditional distribution */ fprintf(LOG,"%s: distribution:\n",genid); fprintf(LOG,"%s:\ttype = full conditional distribution of continuous multivariate distribution\n",genid); fprintf(LOG,"%s:\tname = %s\n",genid,condi->name); fprintf(LOG,"%s:\n",genid); /* number of the variable for which the conditional distribution is to be shown */ fprintf(LOG,"%s:\tcondition (at time of creation):\n",genid); if (DIRECTION==NULL) { fprintf(LOG,"%s:\tvariable = %d\n",genid,(int)(K)); _unur_matrix_print_vector( condi->base->dim, POSITION, "\tpoint =", LOG, genid, "\t "); } else { _unur_matrix_print_vector( condi->base->dim, DIRECTION, "\tdirection =", LOG, genid, "\t "); _unur_matrix_print_vector( condi->base->dim, POSITION, "\tpoint =", LOG, genid, "\t "); } fprintf(LOG,"%s:\n",genid); /* domain */ fprintf(LOG,"%s:\tdomain = (%g, %g)\n",genid,CONDI.domain[0],CONDI.domain[1]); fprintf(LOG,"%s:\n",genid); /* print data about underlying distribution */ fprintf(LOG,"%s: Underlying distribution:\n",genid); _unur_distr_cvec_debug(condi->base, genid); } /* end of _unur_distr_condi_debug() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distr/cont.c0000644001357500135600000035153414420445767013110 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: cont.c * * * * manipulate univariate continuous distribution objects * * * * return: * * UNUR_SUCCESS ... on success * * error code ... on error * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include "distr_source.h" #include "distr.h" #include "cont.h" /*---------------------------------------------------------------------------*/ #define DISTR distr->data.cont /* for derived distributions (e.g. order statistics): data of underlying distributions */ #define BASE distr->base->data.cont /*---------------------------------------------------------------------------*/ static double _unur_distr_cont_eval_pdf_tree( double x, const struct unur_distr *distr ); static double _unur_distr_cont_eval_logpdf_tree( double x, const struct unur_distr *distr ); static double _unur_distr_cont_eval_dpdf_tree( double x, const struct unur_distr *distr ); static double _unur_distr_cont_eval_dlogpdf_tree( double x, const struct unur_distr *distr ); /*---------------------------------------------------------------------------*/ /* evaluate function tree for (derivative of) (log) PDF. */ /*---------------------------------------------------------------------------*/ static double _unur_distr_cont_eval_cdf_tree( double x, const struct unur_distr *distr ); static double _unur_distr_cont_eval_logcdf_tree( double x, const struct unur_distr *distr ); /*---------------------------------------------------------------------------*/ /* evaluate function tree for (log) CDF. */ /*---------------------------------------------------------------------------*/ static double _unur_distr_cont_eval_hr_tree( double x, const struct unur_distr *distr ); /*---------------------------------------------------------------------------*/ /* evaluate function tree for HR. */ /*---------------------------------------------------------------------------*/ static void _unur_distr_cont_free( struct unur_distr *distr ); /*---------------------------------------------------------------------------*/ /* destroy distribution object. */ /*---------------------------------------------------------------------------*/ static int _unur_distr_cont_find_mode( struct unur_distr *distr ); /*---------------------------------------------------------------------------*/ /* find mode of unimodal univariate PDF numerically */ /*---------------------------------------------------------------------------*/ static double _unur_aux_pdf(double x, void *p); /*---------------------------------------------------------------------------*/ /* Auxiliary function used in the computation of the mode */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** univariate continuous distributions **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_cont_new( void ) /*----------------------------------------------------------------------*/ /* create a new (empty) distribution object */ /* type: univariate continuous with given p.d.f. */ /* */ /* parameters: */ /* none */ /* */ /* return: */ /* pointer to distribution object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { register struct unur_distr *distr; int i; /* get empty distribution object */ distr = _unur_distr_generic_new(); if (!distr) return NULL; /* set magic cookie */ COOKIE_SET(distr,CK_DISTR_CONT); /* set type of distribution */ distr->type = UNUR_DISTR_CONT; /* set id to generic distribution */ distr->id = UNUR_DISTR_GENERIC; /* dimension of random vector */ distr->dim = 1; /* univariant */ /* destructor */ distr->destroy = _unur_distr_cont_free; /* clone */ distr->clone = _unur_distr_cont_clone; /* set defaults */ DISTR.pdf = NULL; /* pointer to PDF */ DISTR.dpdf = NULL; /* pointer to derivative of PDF */ DISTR.logpdf = NULL; /* pointer to logPDF */ DISTR.dlogpdf = NULL; /* pointer to derivative of logPDF */ DISTR.cdf = NULL; /* pointer to CDF */ DISTR.logcdf = NULL; /* pointer to logCDF */ DISTR.invcdf = NULL; /* pointer to inverse CDF */ DISTR.hr = NULL; /* pointer to HR */ DISTR.init = NULL; /* pointer to special init routine */ /* initialize parameters of the p.d.f. */ DISTR.n_params = 0; /* number of parameters of the pdf */ for (i=0; idata.cont struct unur_distr *clone; int i; /* check arguments */ _unur_check_NULL( NULL, distr, NULL ); _unur_check_distr_object( distr, CONT, NULL ); /* allocate memory */ clone = _unur_xmalloc( sizeof(struct unur_distr) ); /* copy distribution object into clone */ memcpy( clone, distr, sizeof( struct unur_distr ) ); /* copy function trees into generator object (when there is one) */ CLONE.pdftree = (DISTR.pdftree) ? _unur_fstr_dup_tree(DISTR.pdftree) : NULL; CLONE.dpdftree = (DISTR.dpdftree) ? _unur_fstr_dup_tree(DISTR.dpdftree) : NULL; CLONE.logpdftree = (DISTR.logpdftree) ? _unur_fstr_dup_tree(DISTR.logpdftree) : NULL; CLONE.dlogpdftree = (DISTR.dlogpdftree) ? _unur_fstr_dup_tree(DISTR.dlogpdftree) : NULL; CLONE.cdftree = (DISTR.cdftree) ? _unur_fstr_dup_tree(DISTR.cdftree) : NULL; CLONE.logcdftree = (DISTR.logcdftree) ? _unur_fstr_dup_tree(DISTR.logcdftree) : NULL; CLONE.hrtree = (DISTR.hrtree) ? _unur_fstr_dup_tree(DISTR.hrtree) : NULL; /* clone of parameter arrays */ for (i=0; iname_str) { size_t len = strlen(distr->name_str) + 1; clone->name_str = _unur_xmalloc(len); memcpy( clone->name_str, distr->name_str, len ); clone->name = clone->name_str; } /* for a derived distribution we also have to copy the underlying */ /* distribution object */ if (distr->base != NULL) { clone->base = _unur_distr_clone(distr->base); } return clone; #undef CLONE } /* end of _unur_distr_cont_clone() */ /*---------------------------------------------------------------------------*/ void _unur_distr_cont_free( struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* free distribution object */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /*----------------------------------------------------------------------*/ { int i; /* check arguments */ if( distr == NULL ) /* nothing to do */ return; _unur_check_distr_object( distr, CONT, RETURN_VOID ); /* parameter arrays */ for (i=0; ibase) _unur_distr_free(distr->base); /* user name for distribution */ if (distr->name_str) free(distr->name_str); COOKIE_CLEAR(distr); free( distr ); } /* end of _unur_distr_cont_free() */ /*---------------------------------------------------------------------------*/ int unur_distr_cont_set_pdf( struct unur_distr *distr, UNUR_FUNCT_CONT *pdf ) /*----------------------------------------------------------------------*/ /* set PDF of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* pdf ... pointer to PDF */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_NULL( distr->name, pdf, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); /* we do not allow overwriting a pdf */ if (DISTR.pdf != NULL || DISTR.logpdf != NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of PDF not allowed"); return UNUR_ERR_DISTR_SET; } /* for derived distributions (e.g. order statistics) not possible */ if (distr->base) return UNUR_ERR_DISTR_INVALID; /* changelog */ distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; /* derived parameters like mode, area, etc. might be wrong now! */ DISTR.pdf = pdf; return UNUR_SUCCESS; } /* end of unur_distr_cont_set_pdf() */ /*---------------------------------------------------------------------------*/ int unur_distr_cont_set_dpdf( struct unur_distr *distr, UNUR_FUNCT_CONT *dpdf ) /*----------------------------------------------------------------------*/ /* set derivative of PDF of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* dpdf ... pointer to derivative of PDF */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_NULL( distr->name, dpdf, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); /* we do not allow overwriting a dpdf */ if (DISTR.dpdf != NULL || DISTR.dlogpdf != NULL ) { _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of dPDF not allowed"); return UNUR_ERR_DISTR_SET; } /* for derived distributions (e.g. order statistics) not possible */ if (distr->base) return UNUR_ERR_DISTR_INVALID; /* changelog */ distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; /* derived parameters like mode, area, etc. might be wrong now! */ DISTR.dpdf = dpdf; return UNUR_SUCCESS; } /* end of unur_distr_cont_set_dpdf() */ /*---------------------------------------------------------------------------*/ int unur_distr_cont_set_logpdf( struct unur_distr *distr, UNUR_FUNCT_CONT *logpdf ) /*----------------------------------------------------------------------*/ /* set logPDF of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* logpdf ... pointer to logPDF */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_NULL( distr->name, logpdf, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); /* we do not allow overwriting a pdf */ if (DISTR.pdf != NULL || DISTR.logpdf != NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of logPDF not allowed"); return UNUR_ERR_DISTR_SET; } /* for derived distributions (e.g. order statistics) not possible */ if (distr->base) return UNUR_ERR_DISTR_INVALID; /* changelog */ distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; /* derived parameters like mode, area, etc. might be wrong now! */ DISTR.logpdf = logpdf; DISTR.pdf = _unur_distr_cont_eval_pdf_from_logpdf; return UNUR_SUCCESS; } /* end of unur_distr_cont_set_logpdf() */ /*---------------------------------------------------------------------------*/ double _unur_distr_cont_eval_pdf_from_logpdf( double x, const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* evaluate PDF of distribution at x */ /* wrapper when only logPDF is given */ /* */ /* parameters: */ /* x ... argument for pdf */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* PDF(x) */ /*----------------------------------------------------------------------*/ { if (DISTR.logpdf == NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); return UNUR_INFINITY; } return exp(_unur_cont_logPDF(x,distr)); } /* end of _unur_distr_cont_eval_pdf_from_logpdf() */ /*---------------------------------------------------------------------------*/ int unur_distr_cont_set_dlogpdf( struct unur_distr *distr, UNUR_FUNCT_CONT *dlogpdf ) /*----------------------------------------------------------------------*/ /* set derivative of logPDF of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* dlogpdf ... pointer to derivative of logPDF */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_NULL( distr->name, dlogpdf, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); /* we do not allow overwriting a dpdf */ if (DISTR.dpdf != NULL || DISTR.dlogpdf != NULL ) { _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of dlogPDF not allowed"); return UNUR_ERR_DISTR_SET; } /* for derived distributions (e.g. order statistics) not possible */ if (distr->base) return UNUR_ERR_DISTR_INVALID; /* changelog */ distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; /* derived parameters like mode, area, etc. might be wrong now! */ DISTR.dlogpdf = dlogpdf; DISTR.dpdf = _unur_distr_cont_eval_dpdf_from_dlogpdf; return UNUR_SUCCESS; } /* end of unur_distr_cont_set_dlogpdf() */ /*---------------------------------------------------------------------------*/ double _unur_distr_cont_eval_dpdf_from_dlogpdf( double x, const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* evaluate derivative of PDF of distribution at x */ /* wrapper when only derivative of logPDF is given */ /* */ /* parameters: */ /* x ... argument for dPDF */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* dPDF(x) ... on success */ /* UNUR_INFINITY ... on error */ /*----------------------------------------------------------------------*/ { if (DISTR.logpdf == NULL || DISTR.dlogpdf == NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); return UNUR_INFINITY; } return exp(_unur_cont_logPDF(x,distr)) * _unur_cont_dlogPDF(x,distr); } /* end of _unur_distr_cont_eval_dpdf_from_dlogpdf() */ /*---------------------------------------------------------------------------*/ int unur_distr_cont_set_cdf( struct unur_distr *distr, UNUR_FUNCT_CONT *cdf ) /*----------------------------------------------------------------------*/ /* set CDF of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* cdf ... pointer to CDF */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_NULL( distr->name, cdf,UNUR_ERR_NULL ); _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); /* we do not allow overwriting a cdf */ if (DISTR.cdf != NULL || DISTR.logcdf != NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of CDF not allowed"); return UNUR_ERR_DISTR_SET; } /* for derived distributions (e.g. order statistics) not possible */ if (distr->base) return UNUR_ERR_DISTR_INVALID; /* changelog */ distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; /* derived parameters like mode, area, etc. might be wrong now! */ DISTR.cdf = cdf; return UNUR_SUCCESS; } /* end of unur_distr_cont_set_cdf() */ /*---------------------------------------------------------------------------*/ int unur_distr_cont_set_invcdf( struct unur_distr *distr, UNUR_FUNCT_CONT *invcdf ) /*----------------------------------------------------------------------*/ /* set inverse CDF of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* invcdf ... pointer to inverse CDF */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_NULL( distr->name, invcdf,UNUR_ERR_NULL ); _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); /* we do not allow overwriting an inverse cdf */ if (DISTR.invcdf != NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of inverse CDF not allowed"); return UNUR_ERR_DISTR_SET; } /* for derived distributions (e.g. order statistics) not possible */ if (distr->base) return UNUR_ERR_DISTR_INVALID; /* changelog */ distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; /* derived parameters like mode, area, etc. might be wrong now! */ DISTR.invcdf = invcdf; return UNUR_SUCCESS; } /* end of unur_distr_cont_set_invcdf() */ /*---------------------------------------------------------------------------*/ int unur_distr_cont_set_logcdf( struct unur_distr *distr, UNUR_FUNCT_CONT *logcdf ) /*----------------------------------------------------------------------*/ /* set logCDF of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* logcdf ... pointer to logCDF */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_NULL( distr->name, logcdf, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); /* we do not allow overwriting a cdf */ if (DISTR.cdf != NULL || DISTR.logcdf != NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of logCDF not allowed"); return UNUR_ERR_DISTR_SET; } /* for derived distributions (e.g. order statistics) not possible */ if (distr->base) return UNUR_ERR_DISTR_INVALID; /* changelog */ distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; /* derived parameters like mode, area, etc. might be wrong now! */ DISTR.logcdf = logcdf; DISTR.cdf = _unur_distr_cont_eval_cdf_from_logcdf; return UNUR_SUCCESS; } /* end of unur_distr_cont_set_logcdf() */ /*---------------------------------------------------------------------------*/ double _unur_distr_cont_eval_cdf_from_logcdf( double x, const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* evaluate CDF of distribution at x */ /* wrapper when only logCDF is given */ /* */ /* parameters: */ /* x ... argument for cdf */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* CDF(x) */ /*----------------------------------------------------------------------*/ { if (DISTR.logcdf == NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); return UNUR_INFINITY; } return exp(_unur_cont_logCDF(x,distr)); } /* end of _unur_distr_cont_eval_cdf_from_logcdf() */ /*---------------------------------------------------------------------------*/ int unur_distr_cont_set_hr( struct unur_distr *distr, UNUR_FUNCT_CONT *hr ) /*----------------------------------------------------------------------*/ /* set HR of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* hr ... pointer to HR */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_NULL( distr->name, hr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); /* we do not allow overwriting a cdf */ if (DISTR.hr != NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of HR not allowed"); return UNUR_ERR_DISTR_SET; } /* for derived distributions (e.g. order statistics) not possible */ if (distr->base) return UNUR_ERR_DISTR_INVALID; /* changelog */ distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; /* derived parameters like mode, area, etc. might be wrong now! */ DISTR.hr = hr; return UNUR_SUCCESS; } /* end of unur_distr_cont_set_hr() */ /*---------------------------------------------------------------------------*/ int unur_distr_cont_set_pdfstr( struct unur_distr *distr, const char *pdfstr ) /*----------------------------------------------------------------------*/ /* set PDF and its derivative of distribution via a string interface */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* pdfstr ... string that describes function term of PDF */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); _unur_check_NULL( NULL, pdfstr, UNUR_ERR_NULL ); /* When the user calls unur_distr_cont_set_cdfstr() before this function */ /* then the PDF and dPDF probably are already set and we get an error. */ /* This might happen in particular for the String API. */ /* To avoid confusion we remove these settings. */ if ( DISTR.pdftree || DISTR.logpdftree ) { if (DISTR.pdftree) _unur_fstr_free(DISTR.pdftree); if (DISTR.dpdftree) _unur_fstr_free(DISTR.dpdftree); if (DISTR.logpdftree) _unur_fstr_free(DISTR.logpdftree); if (DISTR.dlogpdftree) _unur_fstr_free(DISTR.dlogpdftree); DISTR.pdf = NULL; DISTR.dpdf = NULL; DISTR.logpdf = NULL; DISTR.dlogpdf = NULL; } /* we do not allow overwriting a PDF */ if (DISTR.pdf != NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of PDF not allowed"); return UNUR_ERR_DISTR_SET; } /* for derived distributions (e.g. order statistics) not possible */ if (distr->base) return UNUR_ERR_DISTR_INVALID; /* changelog */ distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; /* derived parameters like mode, area, etc. might be wrong now! */ /* parse PDF string */ if ( (DISTR.pdftree = _unur_fstr2tree(pdfstr)) == NULL ) { _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Syntax error in function string"); return UNUR_ERR_DISTR_SET; } DISTR.pdf = _unur_distr_cont_eval_pdf_tree; /* make derivative */ if ( (DISTR.dpdftree = _unur_fstr_make_derivative(DISTR.pdftree)) == NULL ) return UNUR_ERR_DISTR_DATA; DISTR.dpdf = _unur_distr_cont_eval_dpdf_tree; return UNUR_SUCCESS; } /* end of unur_distr_cont_set_pdfstr() */ /*---------------------------------------------------------------------------*/ int unur_distr_cont_set_logpdfstr( struct unur_distr *distr, const char *logpdfstr ) /*----------------------------------------------------------------------*/ /* set logPDF and its derivative of distribution via a string interface */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* logpdfstr ... string that describes function term of logPDF */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); _unur_check_NULL( NULL, logpdfstr, UNUR_ERR_NULL ); /* When the user calls unur_distr_cont_set_cdfstr() before this function */ /* then the PDF and dPDF probably are already set and we get an error. */ /* This might happen in particular for the String API. */ /* To avoid confusion we remove these settings. */ if ( DISTR.pdftree || DISTR.logpdftree ) { if (DISTR.pdftree) _unur_fstr_free(DISTR.pdftree); if (DISTR.dpdftree) _unur_fstr_free(DISTR.dpdftree); if (DISTR.logpdftree) _unur_fstr_free(DISTR.logpdftree); if (DISTR.dlogpdftree) _unur_fstr_free(DISTR.dlogpdftree); DISTR.pdf = NULL; DISTR.dpdf = NULL; DISTR.logpdf = NULL; DISTR.dlogpdf = NULL; } /* we do not allow overwriting a PDF */ if (DISTR.pdf != NULL || DISTR.logpdf != NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of logPDF not allowed"); return UNUR_ERR_DISTR_SET; } /* for derived distributions (e.g. order statistics) not possible */ if (distr->base) return UNUR_ERR_DISTR_INVALID; /* changelog */ distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; /* derived parameters like mode, area, etc. might be wrong now! */ /* parse logPDF string */ if ( (DISTR.logpdftree = _unur_fstr2tree(logpdfstr)) == NULL ) { _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Syntax error in function string"); return UNUR_ERR_DISTR_SET; } DISTR.logpdf = _unur_distr_cont_eval_logpdf_tree; DISTR.pdf = _unur_distr_cont_eval_pdf_from_logpdf; /* make derivative */ if ( (DISTR.dlogpdftree = _unur_fstr_make_derivative(DISTR.logpdftree)) == NULL ) return UNUR_ERR_DISTR_DATA; DISTR.dlogpdf = _unur_distr_cont_eval_dlogpdf_tree; DISTR.dpdf = _unur_distr_cont_eval_dpdf_from_dlogpdf; return UNUR_SUCCESS; } /* end of unur_distr_cont_set_logpdfstr() */ /*---------------------------------------------------------------------------*/ int unur_distr_cont_set_cdfstr( struct unur_distr *distr, const char *cdfstr ) /*----------------------------------------------------------------------*/ /* set CDF of distribution via a string interface */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* cdfstr ... string that describes function term of CDF */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); _unur_check_NULL( NULL, cdfstr, UNUR_ERR_NULL ); /* we do not allow overwriting a CDF */ if (DISTR.cdf != NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of CDF not allowed"); return UNUR_ERR_DISTR_SET; } /* for derived distributions (e.g. order statistics) not possible */ if (distr->base) return UNUR_ERR_DISTR_INVALID; /* changelog */ distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; /* derived parameters like mode, area, etc. might be wrong now! */ /* parse string */ if ( (DISTR.cdftree = _unur_fstr2tree(cdfstr)) == NULL ) { _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Syntax error in function string"); return UNUR_ERR_DISTR_SET; } DISTR.cdf = _unur_distr_cont_eval_cdf_tree; /* make derivatives (if necessary) */ /* We do not compute derivatives, if these strings are alreasy set by an */ /* unur_distr_cont_set_pdfstr() or unur_distr_cont_set_logpdfstr() call. */ /* We also do not return an error code if computation of derivatives */ /* did not work. */ if (DISTR.pdftree == NULL) if ( (DISTR.pdftree = _unur_fstr_make_derivative(DISTR.cdftree)) != NULL ) DISTR.pdf = _unur_distr_cont_eval_pdf_tree; if (DISTR.dpdftree == NULL) if ( (DISTR.dpdftree = _unur_fstr_make_derivative(DISTR.pdftree)) != NULL ) DISTR.dpdf = _unur_distr_cont_eval_dpdf_tree; return UNUR_SUCCESS; } /* end of unur_distr_cont_set_cdfstr() */ /*---------------------------------------------------------------------------*/ int unur_distr_cont_set_logcdfstr( struct unur_distr *distr, const char *logcdfstr ) /*----------------------------------------------------------------------*/ /* set logCDF and its derivative of distribution via a string interface */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* logcdfstr ... string that describes function term of logCDF */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); _unur_check_NULL( NULL, logcdfstr, UNUR_ERR_NULL ); /* we do not allow overwriting a CDF */ if (DISTR.cdf != NULL || DISTR.logcdf != NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of logCDF not allowed"); return UNUR_ERR_DISTR_SET; } /* for derived distributions (e.g. order statistics) not possible */ if (distr->base) return UNUR_ERR_DISTR_INVALID; /* changelog */ distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; /* derived parameters like mode, area, etc. might be wrong now! */ /* parse logCDF string */ if ( (DISTR.logcdftree = _unur_fstr2tree(logcdfstr)) == NULL ) { _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Syntax error in function string"); return UNUR_ERR_DISTR_SET; } DISTR.logcdf = _unur_distr_cont_eval_logcdf_tree; DISTR.cdf = _unur_distr_cont_eval_cdf_from_logcdf; /* [ we do not make derivatives ] */ /* o.k. */ return UNUR_SUCCESS; } /* end of unur_distr_cont_set_logcdfstr() */ /*---------------------------------------------------------------------------*/ int unur_distr_cont_set_hrstr( struct unur_distr *distr, const char *hrstr ) /*----------------------------------------------------------------------*/ /* set HR of distribution via a string interface */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* hrstr ... string that describes function term of CDF */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); _unur_check_NULL( NULL, hrstr, UNUR_ERR_NULL ); /* we do not allow overwriting a CDF */ if (DISTR.hr != NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Overwriting of CDF not allowed"); return UNUR_ERR_DISTR_SET; } /* for derived distributions (e.g. order statistics) not possible */ if (distr->base) return UNUR_ERR_DISTR_INVALID; /* changelog */ distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; /* derived parameters like mode, area, etc. might be wrong now! */ /* parse string */ if ( (DISTR.hrtree = _unur_fstr2tree(hrstr)) == NULL ) { _unur_error(distr->name,UNUR_ERR_DISTR_SET,"Syntax error in function string"); return UNUR_ERR_DISTR_SET; } /* set evaluation function */ DISTR.hr = _unur_distr_cont_eval_hr_tree; return UNUR_SUCCESS; } /* end of unur_distr_cont_set_hrstr() */ /*---------------------------------------------------------------------------*/ double _unur_distr_cont_eval_pdf_tree( double x, const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* evaluate function tree for PDF. */ /* */ /* parameters: */ /* x ... argument for PDF */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* PDF at x */ /*----------------------------------------------------------------------*/ { return ((DISTR.pdftree) ? _unur_fstr_eval_tree(DISTR.pdftree,x) : UNUR_INFINITY); } /* end of _unur_distr_cont_eval_pdf_tree() */ /*---------------------------------------------------------------------------*/ double _unur_distr_cont_eval_logpdf_tree( double x, const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* evaluate function tree for logPDF. */ /* */ /* parameters: */ /* x ... argument for logPDF */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* logPDF at x */ /*----------------------------------------------------------------------*/ { return ((DISTR.logpdftree) ? _unur_fstr_eval_tree(DISTR.logpdftree,x) : UNUR_INFINITY); } /* end of _unur_distr_cont_eval_logpdf_tree() */ /*---------------------------------------------------------------------------*/ double _unur_distr_cont_eval_dpdf_tree( double x, const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* evaluate function tree for derivative of PDF. */ /* */ /* parameters: */ /* x ... argument for derivative of PDF */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* derivative of PDF at x */ /*----------------------------------------------------------------------*/ { return ((DISTR.dpdftree) ? _unur_fstr_eval_tree(DISTR.dpdftree,x) : UNUR_INFINITY); } /* end of _unur_distr_cont_eval_dpdf_tree() */ /*---------------------------------------------------------------------------*/ double _unur_distr_cont_eval_dlogpdf_tree( double x, const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* evaluate function tree for derivative of logPDF. */ /* */ /* parameters: */ /* x ... argument for derivative of logPDF */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* derivative of logPDF at x */ /*----------------------------------------------------------------------*/ { return ((DISTR.dlogpdftree) ? _unur_fstr_eval_tree(DISTR.dlogpdftree,x) : UNUR_INFINITY); } /* end of _unur_distr_cont_eval_dpdf_tree() */ /*---------------------------------------------------------------------------*/ double _unur_distr_cont_eval_cdf_tree( double x, const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* evaluate function tree for CDF. */ /* */ /* parameters: */ /* x ... argument for CDF */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* CDF at x */ /*----------------------------------------------------------------------*/ { return ((DISTR.cdftree) ? _unur_fstr_eval_tree(DISTR.cdftree,x) : UNUR_INFINITY); } /* end of _unur_distr_cont_eval_cdf_tree() */ /*---------------------------------------------------------------------------*/ double _unur_distr_cont_eval_logcdf_tree( double x, const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* evaluate function tree for logCDF. */ /* */ /* parameters: */ /* x ... argument for logCDF */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* logCDF at x */ /*----------------------------------------------------------------------*/ { return ((DISTR.logcdftree) ? _unur_fstr_eval_tree(DISTR.logcdftree,x) : UNUR_INFINITY); } /* end of _unur_distr_cont_eval_logcdf_tree() */ /*---------------------------------------------------------------------------*/ double _unur_distr_cont_eval_hr_tree( double x, const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* evaluate function tree for HR. */ /* */ /* parameters: */ /* x ... argument for CDF */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* CDF at x */ /*----------------------------------------------------------------------*/ { return ((DISTR.hrtree) ? _unur_fstr_eval_tree(DISTR.hrtree,x) : UNUR_INFINITY); } /* end of _unur_distr_cont_eval_hr_tree() */ /*---------------------------------------------------------------------------*/ char * unur_distr_cont_get_pdfstr( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get PDF string that is given via the string interface */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* pointer to resulting string. */ /* */ /* comment: */ /* This string should be freed when it is not used any more. */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, NULL ); _unur_check_distr_object( distr, CONT, NULL ); _unur_check_NULL( NULL, DISTR.pdftree, NULL ); /* make and return string */ return _unur_fstr_tree2string(DISTR.pdftree,"x","PDF",TRUE); } /* end of unur_distr_cont_get_pdfstr() */ /*---------------------------------------------------------------------------*/ char * unur_distr_cont_get_dpdfstr( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get string for derivative of PDF that is given via string interface */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* pointer to resulting string. */ /* */ /* comment: */ /* This string should be freed when it is not used any more. */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, NULL ); _unur_check_distr_object( distr, CONT, NULL ); _unur_check_NULL( NULL, DISTR.dpdftree, NULL ); /* make and return string */ return _unur_fstr_tree2string(DISTR.dpdftree,"x","dPDF",TRUE); } /* end of unur_distr_cont_get_dpdfstr() */ /*---------------------------------------------------------------------------*/ char * unur_distr_cont_get_logpdfstr( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get logPDF string that is given via the string interface */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* pointer to resulting string. */ /* */ /* comment: */ /* This string should be freed when it is not used any more. */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, NULL ); _unur_check_distr_object( distr, CONT, NULL ); _unur_check_NULL( NULL, DISTR.logpdftree, NULL ); /* make and return string */ return _unur_fstr_tree2string(DISTR.logpdftree,"x","logPDF",TRUE); } /* end of unur_distr_cont_get_logpdfstr() */ /*---------------------------------------------------------------------------*/ char * unur_distr_cont_get_dlogpdfstr( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get string for derivative of logPDF that is given via string API */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* pointer to resulting string. */ /* */ /* comment: */ /* This string should be freed when it is not used any more. */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, NULL ); _unur_check_distr_object( distr, CONT, NULL ); _unur_check_NULL( NULL, DISTR.dlogpdftree, NULL ); /* make and return string */ return _unur_fstr_tree2string(DISTR.dlogpdftree,"x","dlogPDF",TRUE); } /* end of unur_distr_cont_get_dlogpdfstr() */ /*---------------------------------------------------------------------------*/ char * unur_distr_cont_get_cdfstr( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get CDF string that is given via the string interface */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* pointer to resulting string. */ /* */ /* comment: */ /* This string should be freed when it is not used any more. */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, NULL ); _unur_check_distr_object( distr, CONT, NULL ); _unur_check_NULL( NULL, DISTR.cdftree, NULL ); /* make and return string */ return _unur_fstr_tree2string(DISTR.cdftree,"x","CDF",TRUE); } /* end of unur_distr_cont_get_cdfstr() */ /*---------------------------------------------------------------------------*/ char * unur_distr_cont_get_logcdfstr( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get logCDF string that is given via the string interface */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* pointer to resulting string. */ /* */ /* comment: */ /* This string should be freed when it is not used any more. */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, NULL ); _unur_check_distr_object( distr, CONT, NULL ); _unur_check_NULL( NULL, DISTR.logcdftree, NULL ); /* make and return string */ return _unur_fstr_tree2string(DISTR.logcdftree,"x","logCDF",TRUE); } /* end of unur_distr_cont_get_logcdfstr() */ /*---------------------------------------------------------------------------*/ char * unur_distr_cont_get_hrstr( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get HR string that is given via the string interface */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* pointer to resulting string. */ /* */ /* comment: */ /* This string should be freed when it is not used any more. */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, NULL ); _unur_check_distr_object( distr, CONT, NULL ); _unur_check_NULL( NULL, DISTR.hrtree, NULL ); /* make and return string */ return _unur_fstr_tree2string(DISTR.hrtree,"x","HR",TRUE); } /* end of unur_distr_cont_get_hrstr() */ /*---------------------------------------------------------------------------*/ UNUR_FUNCT_CONT * unur_distr_cont_get_pdf( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get pointer to PDF of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* pointer to PDF */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, NULL ); _unur_check_distr_object( distr, CONT, NULL ); return DISTR.pdf; } /* end of unur_distr_cont_get_pdf() */ /*---------------------------------------------------------------------------*/ UNUR_FUNCT_CONT * unur_distr_cont_get_dpdf( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get pointer to derivative of PDF of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* pointer to derivative of PDF */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, NULL ); _unur_check_distr_object( distr, CONT, NULL ); return DISTR.dpdf; } /* end of unur_distr_cont_get_dpdf() */ /*---------------------------------------------------------------------------*/ UNUR_FUNCT_CONT * unur_distr_cont_get_logpdf( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get pointer to logPDF of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* pointer to logPDF */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, NULL ); _unur_check_distr_object( distr, CONT, NULL ); return DISTR.logpdf; } /* end of unur_distr_cont_get_logpdf() */ /*---------------------------------------------------------------------------*/ UNUR_FUNCT_CONT * unur_distr_cont_get_dlogpdf( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get pointer to derivative of logPDF of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* pointer to derivative of logPDF */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, NULL ); _unur_check_distr_object( distr, CONT, NULL ); return DISTR.dlogpdf; } /* end of unur_distr_cont_get_dlogpdf() */ /*---------------------------------------------------------------------------*/ UNUR_FUNCT_CONT * unur_distr_cont_get_cdf( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get pointer to CDF of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* pointer to CDF */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, NULL ); _unur_check_distr_object( distr, CONT, NULL ); return DISTR.cdf; } /* end of unur_distr_cont_get_cdf() */ /*---------------------------------------------------------------------------*/ UNUR_FUNCT_CONT * unur_distr_cont_get_invcdf( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get pointer to inverse CDF of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* pointer to inverse CDF */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, NULL ); _unur_check_distr_object( distr, CONT, NULL ); return DISTR.invcdf; } /* end of unur_distr_cont_get_invcdf() */ /*---------------------------------------------------------------------------*/ UNUR_FUNCT_CONT * unur_distr_cont_get_logcdf( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get pointer to logCDF of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* pointer to logCDF */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, NULL ); _unur_check_distr_object( distr, CONT, NULL ); return DISTR.logcdf; } /* end of unur_distr_cont_get_logcdf() */ /*---------------------------------------------------------------------------*/ UNUR_FUNCT_CONT * unur_distr_cont_get_hr( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get pointer to HR of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* pointer to HR */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, NULL ); _unur_check_distr_object( distr, CONT, NULL ); return DISTR.hr; } /* end of unur_distr_cont_get_hr() */ /*---------------------------------------------------------------------------*/ double unur_distr_cont_eval_pdf( double x, const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* evaluate PDF of distribution at x */ /* */ /* parameters: */ /* x ... argument for pdf */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* pdf(x) */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_INFINITY ); _unur_check_distr_object( distr, CONT, UNUR_INFINITY ); if (DISTR.pdf == NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); return UNUR_INFINITY; } return _unur_cont_PDF(x,distr); } /* end of unur_distr_cont_eval_pdf() */ /*---------------------------------------------------------------------------*/ double unur_distr_cont_eval_dpdf( double x, const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* evaluate derivative of PDF of distribution at x */ /* */ /* parameters: */ /* x ... argument for dpdf */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* (pdf(x))' */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_INFINITY ); _unur_check_distr_object( distr, CONT, UNUR_INFINITY ); if (DISTR.dpdf == NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); return UNUR_INFINITY; } return _unur_cont_dPDF(x,distr); } /* end of unur_distr_cont_eval_dpdf() */ /*---------------------------------------------------------------------------*/ double unur_distr_cont_eval_logpdf( double x, const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* evaluate logPDF of distribution at x */ /* */ /* parameters: */ /* x ... argument for logPDF */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* logPDF(x) */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_INFINITY ); _unur_check_distr_object( distr, CONT, UNUR_INFINITY ); if (DISTR.logpdf == NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); return UNUR_INFINITY; } return _unur_cont_logPDF(x,distr); } /* end of unur_distr_cont_eval_logpdf() */ /*---------------------------------------------------------------------------*/ double unur_distr_cont_eval_dlogpdf( double x, const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* evaluate derivative of logPDF of distribution at x */ /* */ /* parameters: */ /* x ... argument for dlogPDF */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* (pdf(x))' */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_INFINITY ); _unur_check_distr_object( distr, CONT, UNUR_INFINITY ); if (DISTR.dlogpdf == NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); return UNUR_INFINITY; } return _unur_cont_dlogPDF(x,distr); } /* end of unur_distr_cont_eval_dlogpdf() */ /*---------------------------------------------------------------------------*/ double unur_distr_cont_eval_cdf( double x, const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* evaluate CDF of distribution at x */ /* */ /* parameters: */ /* x ... argument for CDF */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* cdf(x) */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_INFINITY ); _unur_check_distr_object( distr, CONT, UNUR_INFINITY ); if (DISTR.cdf == NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); return UNUR_INFINITY; } return _unur_cont_CDF(x,distr); } /* end of unur_distr_cont_eval_cdf() */ /*---------------------------------------------------------------------------*/ double unur_distr_cont_eval_invcdf( double u, const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* evaluate inverse CDF of distribution at u */ /* */ /* parameters: */ /* u ... argument for inverse CDF */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* invcdf(u) */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_INFINITY ); _unur_check_distr_object( distr, CONT, UNUR_INFINITY ); if (DISTR.invcdf == NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); return UNUR_INFINITY; } if (u<=0.) return DISTR.domain[0]; if (u>=1.) return DISTR.domain[1]; else return _unur_cont_invCDF(u,distr); } /* end of unur_distr_cont_eval_invcdf() */ /*---------------------------------------------------------------------------*/ double unur_distr_cont_eval_logcdf( double x, const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* evaluate logCDF of distribution at x */ /* */ /* parameters: */ /* x ... argument for logCDF */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* logCDF(x) */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_INFINITY ); _unur_check_distr_object( distr, CONT, UNUR_INFINITY ); if (DISTR.logcdf == NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); return UNUR_INFINITY; } return _unur_cont_logCDF(x,distr); } /* end of unur_distr_cont_eval_logcdf() */ /*---------------------------------------------------------------------------*/ double unur_distr_cont_eval_hr( double x, const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* evaluate HR of distribution at x */ /* */ /* parameters: */ /* x ... argument for cdf */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* hr(x) */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_INFINITY ); _unur_check_distr_object( distr, CONT, UNUR_INFINITY ); if (DISTR.hr == NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); return UNUR_INFINITY; } return _unur_cont_HR(x,distr); } /* end of unur_distr_cont_eval_hr() */ /*---------------------------------------------------------------------------*/ int unur_distr_cont_set_pdfparams( struct unur_distr *distr, const double *params, int n_params ) /*----------------------------------------------------------------------*/ /* set array of parameters for distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* params ... list of arguments */ /* n_params ... number of arguments */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); if (n_params>0) _unur_check_NULL(distr->name,params,UNUR_ERR_NULL); /* first check number of new parameter for the distribution */ if (n_params < 0 || n_params > UNUR_DISTR_MAXPARAMS ) { _unur_error(NULL,UNUR_ERR_DISTR_NPARAMS,""); return UNUR_ERR_DISTR_NPARAMS; } /* changelog */ distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; /* derived parameters like mode, area, etc. might be wrong now! */ /* even if the set routine fails, the derived parameters are marked as unknown. but this is o.k. since in this case something has been wrong. */ /* use special routine for setting parameters (if there is one) */ if (distr->base && BASE.set_params) return (BASE.set_params(distr->base,params,n_params)); if (DISTR.set_params) return (DISTR.set_params(distr,params,n_params)); /* otherwise simply copy parameters */ if (distr->base) { BASE.n_params = n_params; if (n_params) memcpy( BASE.params, params, n_params*sizeof(double) ); } else { DISTR.n_params = n_params; if (n_params) memcpy( DISTR.params, params, n_params*sizeof(double) ); } /* o.k. */ return UNUR_SUCCESS; } /* end of unur_distr_cont_set_pdfparams() */ /*---------------------------------------------------------------------------*/ int unur_distr_cont_get_pdfparams( const struct unur_distr *distr, const double **params ) /*----------------------------------------------------------------------*/ /* get number of pdf parameters and sets pointer to array params[] of */ /* parameters */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* params ... pointer to list of arguments */ /* */ /* return: */ /* number of pdf parameters */ /* */ /* error: */ /* return 0 */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, 0 ); _unur_check_distr_object( distr, CONT, 0 ); if (distr->base) { /* for derived distributions (e.g. order statistics) the parameters for the underlying distributions are returned */ *params = (BASE.n_params) ? BASE.params : NULL; return BASE.n_params; } else { *params = (DISTR.n_params) ? DISTR.params : NULL; return DISTR.n_params; } } /* end of unur_distr_cont_get_pdfparams() */ /*---------------------------------------------------------------------------*/ int unur_distr_cont_set_pdfparams_vec( struct unur_distr *distr, int par, const double *param_vec, int n_param_vec ) /*----------------------------------------------------------------------*/ /* set vector array parameters for distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* par ... which parameter is set */ /* param_vec ... parameter array with number `par' */ /* n_param_vec ... length of parameter array */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); /* check new parameter for distribution */ if (par < 0 || par >= UNUR_DISTR_MAXPARAMS ) { _unur_error(NULL,UNUR_ERR_DISTR_NPARAMS,"invalid parameter position"); return UNUR_ERR_DISTR_NPARAMS; } if (param_vec != NULL) { /* allocate memory */ DISTR.param_vecs[par] = _unur_xrealloc( DISTR.param_vecs[par], n_param_vec * sizeof(double) ); /* copy parameters */ memcpy( DISTR.param_vecs[par], param_vec, n_param_vec*sizeof(double) ); /* set length of array */ DISTR.n_param_vec[par] = n_param_vec; } else { if (DISTR.param_vecs[par]) free(DISTR.param_vecs[par]); DISTR.param_vecs[par] = NULL; DISTR.n_param_vec[par] = 0; } /* changelog */ distr->set &= ~UNUR_DISTR_SET_MASK_DERIVED; /* derived parameters like mode, area, etc. might be wrong now! */ /* o.k. */ return UNUR_SUCCESS; } /* end of unur_distr_cont_set_pdfparams_vec() */ /*---------------------------------------------------------------------------*/ int unur_distr_cont_get_pdfparams_vec( const struct unur_distr *distr, int par, const double **param_vecs ) /*----------------------------------------------------------------------*/ /* get number of PDF parameters and sets pointer to array params[] of */ /* parameters */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* par ... which parameter is read */ /* params ... pointer to parameter array with number `par' */ /* */ /* return: */ /* length of parameter array with number `par' */ /* */ /* error: */ /* return 0 */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, 0 ); _unur_check_distr_object( distr, CONT, 0 ); /* check new parameter for distribution */ if (par < 0 || par >= UNUR_DISTR_MAXPARAMS ) { _unur_error(NULL,UNUR_ERR_DISTR_NPARAMS,"invalid parameter position"); *param_vecs = NULL; return 0; } *param_vecs = DISTR.param_vecs[par]; return (*param_vecs) ? DISTR.n_param_vec[par] : 0; } /* end of unur_distr_cont_get_pdfparams_vec() */ /*---------------------------------------------------------------------------*/ int unur_distr_cont_set_domain( struct unur_distr *distr, double left, double right ) /*----------------------------------------------------------------------*/ /* set the left and right borders of the domain of the distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* left ... left boundary point */ /* right ... right boundary point */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* the new boundary points may be +/- UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { int unsigned is_set = 0u; /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); /* check new parameter for distribution */ if (left >= right) { _unur_error(NULL,UNUR_ERR_DISTR_SET,"domain, left >= right"); return UNUR_ERR_DISTR_SET; } #if defined(R_UNURAN) /* in Runuran we always set the domain, even if we just use the defaults */ if (_unur_FP_same(left, DISTR.domain[0]) && _unur_FP_same(right, DISTR.domain[1])) { /* nothing to do */ distr->set |= UNUR_DISTR_SET_DOMAIN; return UNUR_SUCCESS; } #endif /* we have to deal with the mode */ if ( distr->set & UNUR_DISTR_SET_MODE ) { is_set |= UNUR_DISTR_SET_MODE; /* mode has been set and new domain might be subset of old domain */ /* we assume the density is unimodal and thus monotone on either side of the mode!! */ if ( DISTR.mode < left) DISTR.mode = left; else if ( DISTR.mode > right) DISTR.mode = right; } /* we have to deal with the mode */ if ( distr->set & UNUR_DISTR_SET_CENTER ) { is_set |= UNUR_DISTR_SET_CENTER; if ( DISTR.center < left) DISTR.center = left; else if ( DISTR.center > right) DISTR.center = right; } /* store data */ DISTR.trunc[0] = DISTR.domain[0] = left; DISTR.trunc[1] = DISTR.domain[1] = right; /* changelog */ distr->set |= UNUR_DISTR_SET_DOMAIN; /* if distr is an object for a standard distribution, this */ /* is not the original domain of it. (not a "standard domain") */ /* However, since we have changed the domain, we assume */ /* that this is not a truncated distribution. */ /* At last we have to mark all derived parameters as unknown. */ distr->set &= ~(UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_TRUNCATED | UNUR_DISTR_SET_MASK_DERIVED ); distr->set |= is_set; if (distr->base) { /* for derived distributions (e.g. order statistics) we also set the domain for the underlying distribution */ BASE.trunc[0] = BASE.domain[0] = left; BASE.trunc[1] = BASE.domain[1] = right; distr->base->set &= ~(UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_TRUNCATED | UNUR_DISTR_SET_MASK_DERIVED ); } /* o.k. */ return UNUR_SUCCESS; } /* end of unur_distr_cont_set_domain() */ /*---------------------------------------------------------------------------*/ int unur_distr_cont_get_domain( const struct unur_distr *distr, double *left, double *right ) /*----------------------------------------------------------------------*/ /* set the left and right borders of the domain of the distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* left ... left boundary point */ /* right ... right boundary point */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* if no boundaries have been set +/- UNUR_INFINITY is returned. */ /*----------------------------------------------------------------------*/ { /* in case of error the boundaries are set to +/- UNUR_INFINITY */ *left = -UNUR_INFINITY; *right = UNUR_INFINITY; /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); /* o.k. */ *left = DISTR.domain[0]; *right = DISTR.domain[1]; return UNUR_SUCCESS; } /* end of unur_distr_cont_get_domain() */ /*---------------------------------------------------------------------------*/ int unur_distr_cont_get_truncated( const struct unur_distr *distr, double *left, double *right ) /*----------------------------------------------------------------------*/ /* set the left and right borders of the truncated domain of the */ /* distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* left ... left boundary point */ /* right ... right boundary point */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* if no boundaries have been set +/- UNUR_INFINITY is returned. */ /*----------------------------------------------------------------------*/ { /* in case of error the boundaries are set to +/- UNUR_INFINITY */ *left = -UNUR_INFINITY; *right = UNUR_INFINITY; /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); /* o.k. */ *left = (distr->set & UNUR_DISTR_SET_TRUNCATED) ? DISTR.trunc[0] : DISTR.domain[0]; *right = (distr->set & UNUR_DISTR_SET_TRUNCATED) ? DISTR.trunc[1] : DISTR.domain[1]; return UNUR_SUCCESS; } /* end of unur_distr_cont_get_truncated() */ /*---------------------------------------------------------------------------*/ int unur_distr_cont_set_mode( struct unur_distr *distr, double mode ) /*----------------------------------------------------------------------*/ /* set mode of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* mode ... mode of p.d.f. */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); /* check whether mode is inside the domain */ if (mode < DISTR.domain[0] || mode > DISTR.domain[1]) { _unur_error(distr->name,UNUR_ERR_DISTR_SET,"mode not in domain"); return UNUR_ERR_DISTR_SET; } /* store data */ DISTR.mode = mode; /* changelog */ distr->set |= UNUR_DISTR_SET_MODE; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_distr_cont_set_mode() */ /*---------------------------------------------------------------------------*/ int unur_distr_cont_upd_mode( struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* (re-) compute mode of distribution (if possible) */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); if (DISTR.upd_mode == NULL) { /* no function to compute mode available */ _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); return UNUR_ERR_DISTR_DATA; } /* compute mode */ if ((DISTR.upd_mode)(distr)==UNUR_SUCCESS) { /* changelog */ distr->set |= UNUR_DISTR_SET_MODE; return UNUR_SUCCESS; } else { /* computing of mode failed */ _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); return UNUR_ERR_DISTR_DATA; } } /* end of unur_distr_cont_upd_mode() */ /*---------------------------------------------------------------------------*/ double unur_distr_cont_get_mode( struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get mode of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* mode of distribution */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_INFINITY ); _unur_check_distr_object( distr, CONT, UNUR_INFINITY ); /* mode known ? */ if ( !(distr->set & UNUR_DISTR_SET_MODE) ) { /* try to compute mode */ if (DISTR.upd_mode == NULL) { /* no function to compute mode available */ _unur_error(distr->name,UNUR_ERR_DISTR_GET,"mode"); return UNUR_INFINITY; } else { /* compute mode */ if (unur_distr_cont_upd_mode(distr)!=UNUR_SUCCESS) { /* finding mode not successfully */ _unur_error(distr->name,UNUR_ERR_DISTR_GET,"mode"); return UNUR_INFINITY; } } } return DISTR.mode; } /* end of unur_distr_cont_get_mode() */ /*---------------------------------------------------------------------------*/ int unur_distr_cont_set_center( struct unur_distr *distr, double center ) /*----------------------------------------------------------------------*/ /* set center of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* center ... center of PDF */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); DISTR.center = center; /* changelog */ distr->set |= UNUR_DISTR_SET_CENTER; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_distr_cont_set_center() */ /*---------------------------------------------------------------------------*/ double unur_distr_cont_get_center( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get center of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* center of distribution */ /*----------------------------------------------------------------------*/ { double center; /* check arguments */ _unur_check_NULL( NULL, distr, 0. ); _unur_check_distr_object( distr, CONT, 0. ); /* center given */ if ( distr->set & UNUR_DISTR_SET_CENTER ) center = DISTR.center; /* else try mode */ else if ( distr->set & UNUR_DISTR_SET_MODE ) center = DISTR.mode; /* else unknown: use default */ else center = 0.; /* return result 0 */ return center; } /* end of unur_distr_cont_get_center() */ /*---------------------------------------------------------------------------*/ int unur_distr_cont_set_pdfarea( struct unur_distr *distr, double area ) /*----------------------------------------------------------------------*/ /* set area below p.d.f. */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* area ... area below p.d.f. */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); /* check new parameter for distribution */ if (area <= 0.) { _unur_error(NULL,UNUR_ERR_DISTR_SET,"pdf area <= 0"); return UNUR_ERR_DISTR_SET; } DISTR.area = area; /* changelog */ distr->set |= UNUR_DISTR_SET_PDFAREA; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_distr_cont_set_pdfarea() */ /*---------------------------------------------------------------------------*/ int unur_distr_cont_upd_pdfarea( struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* (re-) compute area below p.d.f. of distribution (if possible) */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); return _unur_distr_cont_upd_pdfarea(distr, FALSE); } /* end of unur_distr_cont_upd_pdfarea() */ /*...........................................................................*/ int _unur_distr_cont_upd_pdfarea( struct unur_distr *distr, int silent_check_updfunc ) /*----------------------------------------------------------------------*/ /* (re-) compute area below p.d.f. of distribution (if possible) */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* silent_check_updfunc ... whether a error message is shown */ /* when the update does not exist */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ CHECK_NULL(distr, UNUR_ERR_NULL); _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); if (DISTR.upd_area == NULL) { /* no function to compute mode available */ if (! silent_check_updfunc) { _unur_error(distr->name,UNUR_ERR_DISTR_DATA,""); } return UNUR_ERR_DISTR_DATA; } /* compute area */ if (((DISTR.upd_area)(distr)!=UNUR_SUCCESS) || DISTR.area <= 0.) { /* computing of area failed */ _unur_error(distr->name,UNUR_ERR_DISTR_SET,"upd area <= 0"); DISTR.area = 1.; /* avoid possible floating point exceptions */ distr->set &= ~UNUR_DISTR_SET_PDFAREA; return UNUR_ERR_DISTR_SET; } /* changelog */ distr->set |= UNUR_DISTR_SET_PDFAREA; return UNUR_SUCCESS; } /* end of _unur_distr_cont_upd_pdfarea() */ /*---------------------------------------------------------------------------*/ double unur_distr_cont_get_pdfarea( struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get area below p.d.f. of distribution */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* area below p.d.f. of distribution */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_INFINITY ); _unur_check_distr_object( distr, CONT, UNUR_INFINITY ); /* area known ? */ if ( !(distr->set & UNUR_DISTR_SET_PDFAREA) ) { /* try to compute area */ if ( unur_distr_cont_upd_pdfarea(distr) != UNUR_SUCCESS ) { _unur_error(distr->name,UNUR_ERR_DISTR_GET,"area"); return UNUR_INFINITY; } } return DISTR.area; } /* end of unur_distr_cont_get_pdfarea() */ /*****************************************************************************/ double _unur_aux_pdf(double x, void *p) /*----------------------------------------------------------------------*/ /* Auxiliary function used in the computation of the mode */ /*----------------------------------------------------------------------*/ { struct unur_distr *distr = p; return (DISTR.pdf(x, distr)); } /*---------------------------------------------------------------------------*/ int _unur_distr_cont_find_mode( struct unur_distr *distr ) /*----------------------------------------------------------------------*/ { struct unur_funct_generic pdf; /* density function to be maximized */ double mode; /* check arguments */ CHECK_NULL( distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CONT, UNUR_ERR_DISTR_INVALID ); if (DISTR.pdf == NULL) { _unur_error(distr->name,UNUR_ERR_DISTR_GET,"PDF required for finding mode numerically"); return UNUR_ERR_DISTR_DATA; } /* set parameters of pdf */ pdf.f = _unur_aux_pdf; pdf.params = distr; /* compute mode; use DISTR.center as first guess */ mode = _unur_util_find_max( pdf, DISTR.domain[0], DISTR.domain[1], DISTR.center ); /* check result */ if (_unur_isfinite(mode)){ /* mode successfully computed */ DISTR.mode = mode; /* changelog */ distr->set |= UNUR_DISTR_SET_MODE | UNUR_DISTR_SET_MODE_APPROX ; /* o.k. */ return UNUR_SUCCESS; } else { /* computing mode did not work */ /* (we do not change mode entry in distribution object) */ return UNUR_ERR_DISTR_DATA; } } /* end of _unur_distr_cont_find_mode() */ /*---------------------------------------------------------------------------*/ int _unur_distr_cont_find_center( struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* search for an appropriate point for center. */ /* if such a point is found, then it is stored in 'distr'. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { #define PDF(x) _unur_cont_PDF((x),(distr)) /* call to PDF */ #define logPDF(x) _unur_cont_logPDF((x),(distr)) /* call to logPDF */ double center, fc; /* given center and PDF at center */ double x, fx; /* auxiliary point and PDF at point */ int i,d; /* given center of distribution */ center = DISTR.center; fc = (DISTR.logpdf!=NULL) ? exp(logPDF(center)) : PDF(center); /* check given center */ if (fc>0. && _unur_isfinite(fc)) return UNUR_SUCCESS; /* search */ for (d=0; d<2; d++) { /* left and right boundary of truncated domain, resp. */ x = DISTR.trunc[d]; /* Do x and the given center differ? */ if (_unur_FP_equal(center,x)) continue; /* search from boundary towards given center */ for (i=0; i<50; i++) { x = _unur_arcmean(x,center); fx = (DISTR.logpdf!=NULL) ? exp(logPDF(x)) : PDF(x); if (fx>0. && _unur_isfinite(fx)) { /* successfull */ DISTR.center = x; /* changelog */ distr->set |= UNUR_DISTR_SET_CENTER | UNUR_DISTR_SET_CENTER_APPROX ; /* o.k. */ return UNUR_SUCCESS; } } } /* could not find appropriate point */ return UNUR_FAILURE; #undef PDF #undef logPDF } /* end of _unur_distr_cont_find_center() */ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ void _unur_distr_cont_debug( const struct unur_distr *distr, const char *genid ) /*----------------------------------------------------------------------*/ /* write info about distribution into LOG file */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* genid ... pointer to generator id */ /*----------------------------------------------------------------------*/ { FILE *LOG; int i; /* check arguments */ CHECK_NULL(distr,RETURN_VOID); COOKIE_CHECK(distr,CK_DISTR_CONT,RETURN_VOID); LOG = unur_get_stream(); /* is this a derived distribution */ if (distr->base) { switch (distr->id) { case UNUR_DISTR_CORDER: _unur_distr_corder_debug(distr,genid); return; case UNUR_DISTR_CXTRANS: _unur_distr_cxtrans_debug(distr,genid); return; case UNUR_DISTR_CONDI: _unur_distr_condi_debug(distr,genid); return; default: /* nothing to do */ fprintf(LOG,"%s: derived distribution.\n",genid); fprintf(LOG,"%s:\n",genid); } } fprintf(LOG,"%s: distribution:\n",genid); fprintf(LOG,"%s:\ttype = continuous univariate distribution\n",genid); fprintf(LOG,"%s:\tname = %s\n",genid,distr->name); fprintf(LOG,"%s:\tPDF with %d argument(s)\n",genid,DISTR.n_params); for( i=0; iset & UNUR_DISTR_SET_MODE) fprintf(LOG,"%s:\tmode = %g\n",genid,DISTR.mode); else fprintf(LOG,"%s:\tmode unknown\n",genid); fprintf(LOG,"%s:\tcenter = ",genid); if (distr->set & UNUR_DISTR_SET_CENTER) fprintf(LOG,"%g%s\n", DISTR.center, (distr->set & UNUR_DISTR_SET_CENTER_APPROX) ? " [guess]" : ""); else fprintf(LOG,"%g [default]\n", unur_distr_cont_get_center(distr)); fprintf(LOG,"%s:\tdomain = (%g, %g)",genid,DISTR.domain[0],DISTR.domain[1]); _unur_print_if_default(distr,UNUR_DISTR_SET_DOMAIN); fprintf(LOG,"\n%s:\tarea below p.d.f. = %g",genid,DISTR.area); _unur_print_if_default(distr,UNUR_DISTR_SET_PDFAREA); fprintf(LOG,"\n%s:\n",genid); } /* end of _unur_distr_cont_debug() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distr/corder.h0000644001357500135600000002660714420445767013430 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: corder.h * * * * PURPOSE: * * function prototypes for manipulating distribution objects of * * id CORDER (continuous order statistics) * * type CONT (continuous univariate distribution) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* =NODEX CORDER Continuous univariate order statistics =UP Distribution_objects [15] =DESCRIPTION These are special cases of a continuous univariate distributions and thus they have most of these parameters (with the exception that functions cannot be changed). Additionally, @itemize @minus @item there is a call to extract the underlying distribution, @item and a call to handle the @command{rank} of the order statistics. @end itemize =END */ /*---------------------------------------------------------------------------*/ /* Routines for handling univariate continuous order statistics (CORDER). */ /* =ROUTINES */ UNUR_DISTR *unur_distr_corder_new( const UNUR_DISTR *distribution, int n, int k ); /* Create an object for order statistics of sample size @var{n} and rank @var{k}. @var{distribution} must be a pointer to a univariate continuous distribution. The resulting generator object is of the same type as of a unur_distr_cont_new() call. (However, it cannot be used to make an order statistics out of an order statistics.) To have a PDF for the order statistics, the given distribution object must contain a CDF and a PDF. Moreover, it is assumed that the given PDF is the derivative of the given CDF. Otherwise the area below the PDF of the order statistics is not computed correctly. @emph{Important:} There is no warning when the computed area below the PDF of the order statistics is wrong. */ const UNUR_DISTR *unur_distr_corder_get_distribution( const UNUR_DISTR *distribution ); /* Get pointer to distribution object for underlying distribution. */ /* ==DOC @subsubheading Essential parameters */ int unur_distr_corder_set_rank( UNUR_DISTR *distribution, int n, int k ); /* Change sample size @var{n} and rank @var{k} of order statistics. In case of invalid data, no parameters are changed. The area below the PDF can be set to that of the underlying distribution by a unur_distr_corder_upd_pdfarea() call. */ int unur_distr_corder_get_rank( const UNUR_DISTR *distribution, int *n, int *k ); /* Get sample size @var{n} and rank @var{k} of order statistics. In case of error an error code is returned. */ /* ==DOC Additionally most of the set and get calls for continuous univariate distributions work. The most important exceptions are that the PDF and CDF cannot be changed and unur_distr_cont_upd_mode() uses in any way a (slow) numerical method that might fail. */ #define unur_distr_corder_get_pdf(distr) unur_distr_cont_get_pdf((distr)) /* UNUR_FUNCT_CONT *unur_distr_corder_get_pdf( UNUR_DISTR *distribution ); */ #define unur_distr_corder_get_dpdf(distr) unur_distr_cont_get_dpdf((distr)) /* UNUR_FUNCT_CONT *unur_distr_corder_get_dpdf( UNUR_DISTR *distribution ); */ #define unur_distr_corder_get_cdf(distr) unur_distr_cont_get_cdf((distr)) /* UNUR_FUNCT_CONT *unur_distr_corder_get_cdf( UNUR_DISTR *distribution ); */ /* Get the respective pointer to the PDF, the derivative of the PDF and the CDF of the distribution, respectively. The pointer is of type @code{double funct(double x, UNUR_DISTR *distr)}. If the corresponding function is not available for the distribution, the NULL pointer is returned. See also unur_distr_cont_get_pdf(). (Macro) */ #define unur_distr_corder_eval_pdf(x,distr) unur_distr_cont_eval_pdf((x),(distr)) /* double unur_distr_corder_eval_pdf( double x, UNUR_DISTR *distribution ); */ #define unur_distr_corder_eval_dpdf(x,distr) unur_distr_cont_eval_dpdf((x),(distr)) /* double unur_distr_corder_eval_dpdf( double x, UNUR_DISTR *distribution ); */ #define unur_distr_corder_eval_cdf(x,distr) unur_distr_cont_eval_cdf((x),(distr)) /* double unur_distr_corder_eval_cdf( double x, UNUR_DISTR *distribution ); */ /* Evaluate the PDF, derivative of the PDF. and the CDF, respectively, at @var{x}. Notice that @var{distribution} must not be the NULL pointer. If the corresponding function is not available for the distribution, @code{UNUR_INFINITY} is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. See also unur_distr_cont_eval_pdf(). (Macro) @emph{IMPORTANT:} In the case of a truncated standard distribution these calls always return the respective values of the @emph{untruncated} distribution! */ #define unur_distr_corder_set_pdfparams(distr,params,n) unur_distr_cont_set_pdfparams((distr),(params),(n)) /* int unur_distr_corder_set_pdfparams(UNUR_DISTR *distribution,double *params,int n_params); */ /* Set array of parameters for underlying distribution. See unur_distr_cont_set_pdfparams() for details. (Macro) */ #define unur_distr_corder_get_pdfparams(distr,params) unur_distr_cont_get_pdfparams((distr),(params)) /* int unur_distr_corder_get_pdfparams( UNUR_DISTR *distribution, double **params ); */ /* Get number of parameters of the PDF of the underlying distribution and set pointer @var{params} to array of parameters. See unur_distr_cont_get_pdfparams() for details. (Macro) */ #define unur_distr_corder_set_domain(distr,left,right) unur_distr_cont_set_domain((distr),(left),(right)) /* int unur_distr_corder_set_domain( UNUR_DISTR *distribution, double left, double right ); */ /* Set the left and right borders of the domain of the distribution. See unur_distr_cont_set_domain() for details. (Macro) */ #define unur_distr_corder_get_domain(distr,left,right) unur_distr_cont_get_domain((distr),(left),(right)) /* int unur_distr_corder_get_domain( UNUR_DISTR *distribution, double *left, double *right ); */ /* Get the left and right borders of the domain of the distribution. See unur_distr_cont_get_domain() for details. (Macro) */ #define unur_distr_corder_get_truncated(distr,left,right) unur_distr_cont_get_truncated((distr),(left),(right)) /* int unur_distr_corder_get_truncated( UNUR_DISTR *distribution, double *left, double *right ); */ /* Get the left and right borders of the (truncated) domain of the distribution. See unur_distr_cont_get_truncated() for details. (Macro) */ /* ==DOC @subsubheading Derived parameters The following paramters @strong{must} be set whenever one of the essential parameters has been set or changed (and the parameter is required for the chosen method). */ #define unur_distr_corder_set_mode(distr,mode) unur_distr_cont_set_mode((distr),(mode)) /* int unur_distr_corder_set_mode( UNUR_DISTR *distribution, double mode ); */ /* Set mode of distribution. See also unur_distr_corder_set_mode(). (Macro) */ #define unur_distr_corder_upd_mode(distr) unur_distr_cont_upd_mode((distr)) /* double unur_distr_corder_upd_mode( UNUR_DISTR *distribution ); */ /* Recompute the mode of the distribution numerically. Notice that this routine is slow and might not work properly in every case. See also unur_distr_cont_upd_mode() for further details. (Macro) */ #define unur_distr_corder_get_mode(distr) unur_distr_cont_get_mode((distr)) /* double unur_distr_corder_get_mode( UNUR_DISTR *distribution ); */ /* Get mode of distribution. See unur_distr_cont_get_mode() for details. (Macro) */ #define unur_distr_corder_set_pdfarea(distr,area) unur_distr_cont_set_pdfarea((distr),(area)) /* int unur_distr_corder_set_pdfarea( UNUR_DISTR *distribution, double area ); */ /* Set the area below the PDF. See unur_distr_cont_set_pdfarea() for details. (Macro) */ #define unur_distr_corder_upd_pdfarea(distr) unur_distr_cont_upd_pdfarea((distr)) /* double unur_distr_corder_upd_pdfarea( UNUR_DISTR *distribution ); */ /* Recompute the area below the PDF of the distribution. It only works for order statistics for distribution objects from the UNU.RAN library of standard distributions when the corresponding function is available. unur_distr_cont_upd_pdfarea() assumes that the PDF of the underlying distribution is normalized, i.e. it is the derivative of its CDF. Otherwise the computed area is wrong and there is @strong{no} warning about this failure. See unur_distr_cont_upd_pdfarea() for further details. (Macro) */ #define unur_distr_corder_get_pdfarea(distr) unur_distr_cont_get_pdfarea((distr)) /* double unur_distr_corder_get_pdfarea( UNUR_DISTR *distribution ); */ /* Get the area below the PDF of the distribution. See unur_distr_cont_get_pdfarea() for details. (Macro) */ /* =END */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distr/distr_info.c0000644001357500135600000001704714420445767014303 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: distr_info.c * * * * create info strings for distribution objects * * * ***************************************************************************** * * * Copyright (c) 2000-2008 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include "distr.h" #include "distr_source.h" /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_INFO /*---------------------------------------------------------------------------*/ void _unur_distr_info_typename( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* create character string that contains information about the */ /* type and name of the given generator object. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { struct unur_string *info = gen->infostr; struct unur_distr *distr = gen->distr; int n_params = 0; double *params = NULL; int i; /* name of distribution */ _unur_string_append(info," name = %s", distr->name); /* parameters for UNU.RAN standard distributions */ if (distr->id & UNUR_DISTR_STD) { switch (distr->type) { case UNUR_DISTR_CONT: n_params = distr->data.cont.n_params; params = distr->data.cont.params; break; case UNUR_DISTR_DISCR: n_params = distr->data.discr.n_params; params = distr->data.discr.params; break; } if (n_params > 0) { for( i=0; iname,UNUR_ERR_SHOULD_NOT_HAPPEN,""); } } /* end of unur_distr_info_typename() */ /*---------------------------------------------------------------------------*/ void _unur_distr_info_vector( struct unur_gen *gen, const double *vec, int n ) /*----------------------------------------------------------------------*/ /* create character string that contains given character vector */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* vec ... pointer to vector */ /* n ... length vector */ /*----------------------------------------------------------------------*/ { struct unur_string *info = gen->infostr; int i; if (n<1) return; _unur_string_append(info,"(%g",vec[0]); for (i=1;idata.cvec struct unur_string *info = gen->infostr; struct unur_distr *distr = gen->distr; double *domain; int i; COOKIE_CHECK(distr,CK_DISTR_CVEC,RETURN_VOID); _unur_string_append(info," domain = "); if (!(distr->set & UNUR_DISTR_SET_DOMAINBOUNDED)) { _unur_string_append(info,"(-inf,inf)^%d [unbounded]\n",distr->dim); } else { if (DISTR.domainrect) { domain = DISTR.domainrect; for (i=0; idim; i++) _unur_string_append(info,"%s(%g,%g)", i?" x ":"", domain[2*i], domain[2*i+1]); _unur_string_append(info," [rectangular]\n"); } } #undef DISTR } /* end of _unur_distr_cvec_info_domain() */ /*---------------------------------------------------------------------------*/ #endif /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distr/cont.h0000644001357500135600000006214014420445767013105 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: cont.h * * * * PURPOSE: * * function prototypes for manipulating distribution objects of * * type CONT (continuous univariate distribution) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* =NODEX CONT Continuous univariate distributions =UP Distribution_objects [10] =DESCRIPTION The calls in this section can be applied to continuous univariate distributions. @itemize @minus @item Create a @command{new} instance of a continuous univariate distribution. @item Handle and evaluate distribution function (CDF, @command{cdf}), probability density function (PDF, @command{pdf}) and the derivative of the density function (@command{dpdf}). The following is important: @itemize . @item @command{pdf} need not be normalized, i.e., any integrable nonnegative function can be used. @item @command{dpdf} must the derivate of the function provided as @command{pdf}. @item @command{cdf} must be a distribution function, i.e. it must be monotonically increasing with range [0,1]. @item If @command{cdf} and @command{pdf} are used together for a pariticular generation method, then @command{pdf} must be the derivate of the @command{cdf}, i.e., it must be normalized. @end itemize @item Handle and evaluate the logarithm of the probability density function (logPDF, @command{logpdf}) and the derivative of the logarithm of the density function (@command{dlogpdf}). Some methods use the logarithm of the density if available. @item Set (and change) parameters (@command{pdfparams}) and the area below the graph (@command{pdfarea}) of the given density. @item Set the @command{mode} (or pole) of the distribution. @item Set the @command{center} of the distribution. It is used by some generation methods to adjust the parameters of the generation algorithms to gain better performance. It can be seens as the location of the ``central part'' of the distribution. @item Some generation methods require the hazard rate (@command{hr}) of the distribution instead of its @command{pdf}. @item Alternatively, @command{cdf}, @command{pdf}, @command{dpdf}, and @command{hr} can be provided as @command{str}ings instead of function pointers. @item Set the @command{domain} of the distribution. Notice that the library also can handle truncated distributions, i.e., distributions that are derived from (standard) distributions by simply restricting its domain to a subset. However, there is a subtle difference between changing the domain of a distribution object by a unur_distr_cont_set_domain() call and changing the (truncated) domain for an existing generator object. The domain of the distribution object is used to create the generator object with hats, squeezes, tables, etc. Whereas truncating the domain of an existing generator object need not necessarily require a recomputation of these data. Thus by a @command{unur__chg_truncated} call (if available) the sampling region is restricted to the subset of the domain of the given distribution object. However, generation methods that require a recreation of the generator object when the domain is changed have a @command{unur__chg_domain} call instead. For these calls there are of course no restrictions on the given domain (i.e., it is possible to increase the domain of the distribution) (@pxref{Methods}, for details). @end itemize =END */ /*---------------------------------------------------------------------------*/ /* Routines for handling univariate continuous distributions (CONT). */ /* =ROUTINES */ UNUR_DISTR *unur_distr_cont_new( void ); /* Create a new (empty) object for univariate continuous distribution. */ /* ==DOC @subsubheading Essential parameters */ int unur_distr_cont_set_pdf( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *pdf ); /* */ int unur_distr_cont_set_dpdf( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *dpdf ); /* */ int unur_distr_cont_set_cdf( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *cdf ); /* */ int unur_distr_cont_set_invcdf( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *invcdf ); /* Set respective pointer to the probability density function (PDF), the derivative of the probability density function (dPDF), the cumulative distribution function (CDF), and the inverse CDF of the @var{distribution}. Each of these function pointers must be of type @code{double funct(double x, const UNUR_DISTR *distr)}. Due to the fact that some of the methods do not require a normalized PDF the following is important: @itemize @minus @item The given CDF must be the cumulative distribution function of the (non-truncated) distribution. If a distribution from the UNU.RAN library of standard distributions (@pxref{Stddist,,Standard distributions}) is truncated, there is no need to change the CDF. @item If both the CDF and the PDF are used (for a method or for order statistics), the PDF must be the derivative of the CDF. If a truncated distribution for one of the standard distributions from the UNU.RAN library of standard distributions is used, there is no need to change the PDF. @item If the area below the PDF is required for a given distribution it must be given by the unur_distr_cont_set_pdfarea() call. For a truncated distribution this must be of course the integral of the PDF in the given truncated domain. For distributions from the UNU.RAN library of standard distributions this is done automatically by the unur_distr_cont_upd_pdfarea() call. @end itemize It is important to note that all these functions must return a result for all values of @var{x}. Eg., if the domain of a given PDF is the interval [-1,1], then the given function must return @code{0.0} for all points outside this interval. In case of an overflow the PDF should return @code{UNUR_INFINITY}. It is not possible to change such a function. Once the PDF or CDF is set it cannot be overwritten. This also holds when the logPDF is given or when the PDF is given by the unur_distr_cont_set_pdfstr() or unur_distr_cont_set_logpdfstr() call. A new distribution object has to be used instead. */ UNUR_FUNCT_CONT *unur_distr_cont_get_pdf( const UNUR_DISTR *distribution ); /* */ UNUR_FUNCT_CONT *unur_distr_cont_get_dpdf( const UNUR_DISTR *distribution ); /* */ UNUR_FUNCT_CONT *unur_distr_cont_get_cdf( const UNUR_DISTR *distribution ); /* */ UNUR_FUNCT_CONT *unur_distr_cont_get_invcdf( const UNUR_DISTR *distribution ); /* Get the respective pointer to the PDF, the derivative of the PDF, the CDF, and the inverse CDF of the @var{distribution}. The pointer is of type @code{double funct(double x, const UNUR_DISTR *distr)}. If the corresponding function is not available for the distribution, the NULL pointer is returned. */ double unur_distr_cont_eval_pdf( double x, const UNUR_DISTR *distribution ); /* */ double unur_distr_cont_eval_dpdf( double x, const UNUR_DISTR *distribution ); /* */ double unur_distr_cont_eval_cdf( double x, const UNUR_DISTR *distribution ); /* */ double unur_distr_cont_eval_invcdf( double u, const UNUR_DISTR *distribution ); /* Evaluate the PDF, derivative of the PDF, the CDF, and the inverse CDF at @var{x} and @var{u},respectively. Notice that @var{distribution} must not be the NULL pointer. If the corresponding function is not available for the distribution, @code{UNUR_INFINITY} is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. @emph{IMPORTANT:} In the case of a truncated standard distribution these calls always return the respective values of the @emph{untruncated} distribution! */ int unur_distr_cont_set_logpdf( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *logpdf ); /* */ int unur_distr_cont_set_dlogpdf( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *dlogpdf ); /* */ int unur_distr_cont_set_logcdf( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *logcdf ); /* */ UNUR_FUNCT_CONT *unur_distr_cont_get_logpdf( const UNUR_DISTR *distribution ); /* */ UNUR_FUNCT_CONT *unur_distr_cont_get_dlogpdf( const UNUR_DISTR *distribution ); /* */ UNUR_FUNCT_CONT *unur_distr_cont_get_logcdf( const UNUR_DISTR *distribution ); /* */ double unur_distr_cont_eval_logpdf( double x, const UNUR_DISTR *distribution ); /* */ double unur_distr_cont_eval_dlogpdf( double x, const UNUR_DISTR *distribution ); /* */ double unur_distr_cont_eval_logcdf( double x, const UNUR_DISTR *distribution ); /* Analogous calls for the logarithm of the density distribution functions. */ int unur_distr_cont_set_pdfstr( UNUR_DISTR *distribution, const char *pdfstr ); /* This function provides an alternative way to set a PDF and its derivative of the @var{distribution}. @var{pdfstr} is a character string that contains the formula for the PDF, see @ref{StringFunct,,Function String}, for details. The derivative of the given PDF is computed automatically. See also the remarks for the unur_distr_cont_set_pdf() call. It is not possible to call this funtion twice or to call this function after a unur_distr_cont_set_pdf() call. */ int unur_distr_cont_set_cdfstr( UNUR_DISTR *distribution, const char *cdfstr ); /* This function provides an alternative way to set a CDF; analogously to the unur_distr_cont_set_pdfstr() call. The PDF and its derivative of the given CDF are computed automatically. */ char *unur_distr_cont_get_pdfstr( const UNUR_DISTR *distribution ); /* */ char *unur_distr_cont_get_dpdfstr( const UNUR_DISTR *distribution ); /* */ char *unur_distr_cont_get_cdfstr( const UNUR_DISTR *distribution ); /* Get pointer to respective string for PDF, derivate of PDF, and CDF of @var{distribution} that is given as string (instead of a function pointer). This call allocates memory to produce this string. It should be freed when it is not used any more. */ int unur_distr_cont_set_pdfparams( UNUR_DISTR *distribution, const double *params, int n_params ); /* Sets array of parameters for @var{distribution}. There is an upper limit for the number of parameters @code{n_params}. It is given by the macro @code{UNUR_DISTR_MAXPARAMS} in @file{unuran_config.h}. (It is set to 5 by default but can be changed to any appropriate nonnegative number.) If @var{n_params} is negative or exceeds this limit no parameters are copied into the distribution object and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_NPARAMS}. For standard distributions from the UNU.RAN library the parameters are checked. Moreover, the domain is updated automatically unless it has been changed before by a unur_distr_cont_set_domain() call. If the given parameters are invalid for the standard distribution, then no parameters are set and an error code is returned. Notice, that the given parameter list for such a distribution is handled in the same way as in the corresponding @command{new} calls, i.e. optional parameters for the PDF that are not present in the given list are (re-)set to their default values. @strong{Important:} If the parameters of a distribution from the UNU.RAN library of standard distributions (@pxref{Stddist,,Standard distributions}) are changed, then neither its mode nor the normalization constant are updated. Please use the respective calls unur_distr_cont_upd_mode() and unur_distr_cont_upd_pdfarea(). Moreover, if the domain has been changed by a unur_distr_cont_set_domain() it is not automatically updated, either. Updating the normalization constant is in particular very important, when the CDF of the distribution is used. */ int unur_distr_cont_get_pdfparams( const UNUR_DISTR *distribution, const double **params ); /* Get number of parameters of the PDF and set pointer @var{params} to array of parameters. If no parameters are stored in the object, an error code is returned and @code{params} is set to NULL. @emph{Important:} Do @strong{not} change the entries in @var{params}! */ int unur_distr_cont_set_pdfparams_vec( UNUR_DISTR *distribution, int par, const double *param_vec, int n_param_vec ); /* This function provides an interface for additional vector parameters for a continuous @var{distribution}. It sets the parameter with number @var{par}. @var{par} indicates directly which of the parameters is set and must be a number between @code{0} and @code{UNUR_DISTR_MAXPARAMS}-1 (the upper limit of possible parameters defined in @file{unuran_config.h}; it is set to 5 but can be changed to any appropriate nonnegative number.) The entries of a this parameter are given by the array @var{param_vec} of size @var{n_param_vec}. If @var{param_vec} is NULL then the corresponding entry is cleared. If an error occurs no parameters are copied into the parameter object @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. */ int unur_distr_cont_get_pdfparams_vec( const UNUR_DISTR *distribution, int par, const double **param_vecs ); /* Get parameter of the PDF with number @var{par}. The pointer to the parameter array is stored in @var{param_vecs}, its size is returned by the function. If the requested parameter is not set, then an error code is returned and @code{params} is set to NULL. @emph{Important:} Do @strong{not} change the entries in @var{param_vecs}! */ int unur_distr_cont_set_logpdfstr( UNUR_DISTR *distribution, const char *logpdfstr ); /* */ char *unur_distr_cont_get_logpdfstr( const UNUR_DISTR *distribution ); /* */ char *unur_distr_cont_get_dlogpdfstr( const UNUR_DISTR *distribution ); /* */ int unur_distr_cont_set_logcdfstr( UNUR_DISTR *distribution, const char *logcdfstr ); /* */ char *unur_distr_cont_get_logcdfstr( const UNUR_DISTR *distribution ); /* Analogous calls for the logarithm of the density and distribution functions. */ int unur_distr_cont_set_domain( UNUR_DISTR *distribution, double left, double right ); /* Set the left and right borders of the domain of the distribution. This can also be used to truncate an existing distribution. For setting the boundary to @unurmath{\pm\infty} use @code{+/- UNUR_INFINITY}. If @var{right} is not strictly greater than @var{left} no domain is set and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_SET}. @emph{Important:} For some technical reasons it is assumed that the density is unimodal and thus monotone on either side of the mode! This is used in the case when the given mode is outside of the original domain. Then the mode is set to the corresponding boundary of the new domain. If this result is not the desired it must be changed by using a unur_distr_cont_set_mode() call (or a unur_distr_cont_upd_mode() call). The same holds for the center of the distribution. */ int unur_distr_cont_get_domain( const UNUR_DISTR *distribution, double *left, double *right ); /* Get the left and right borders of the domain of the distribution. If the domain is not set @code{+/- UNUR_INFINITY} is assumed and returned. No error is reported in this case. */ int unur_distr_cont_get_truncated( const UNUR_DISTR *distribution, double *left, double *right ); /* Get the left and right borders of the (truncated) domain of the distribution. For non-truncated distribution this call is equivalent to the unur_distr_cont_get_domain() call. This call is only useful in connection with a unur_get_distr() call to get the boundaries of the sampling region of a generator object. */ int unur_distr_cont_set_hr( UNUR_DISTR *distribution, UNUR_FUNCT_CONT *hazard ); /* Set pointer to the hazard rate (HR) of the @var{distribution}. The @emph{hazard rate} (or failure rate) is a mathematical way of describing aging. If the lifetime @i{X} is a random variable with density @i{f(x)} and CDF @i{F(x)} the hazard rate @i{h(x)} is defined as @i{h(x) = f(x) / (1-F(x))}. In other words, @i{h(x)} represents the (conditional) rate of failure of a unit that has survived up to time @i{x} with probability @i{1-F(x)}. The key distribution is the exponential distribution as it has constant hazard rate of value 1. Hazard rates tending to infinity describe distributions with sub-exponential tails whereas distributions with hazard rates tending to zero have heavier tails than the exponential distribution. It is important to note that all these functions must return a result for all floats @i{x}. In case of an overflow the PDF should return @code{UNUR_INFINITY}. @strong{Important}: Do not simply use @i{f(x) / (1-F(x))}, since this is numerically very unstable and results in numerical noise if @i{F(x)} is (very) close to 1. Moreover, if the density @i{f(x)} is known a generation method that uses the density is more appropriate. It is not possible to change such a function. Once the HR is set it cannot be overwritten. This also holds when the HR is given by the unur_distr_cont_set_hrstr() call. A new distribution object has to be used instead. */ UNUR_FUNCT_CONT *unur_distr_cont_get_hr( const UNUR_DISTR *distribution ); /* Get the pointer to the hazard rate of the @var{distribution}. The pointer is of type @code{double funct(double x, const UNUR_DISTR *distr)}. If the corresponding function is not available for the distribution, the NULL pointer is returned. */ double unur_distr_cont_eval_hr( double x, const UNUR_DISTR *distribution ); /* Evaluate the hazard rate at @var{x}. Notice that @var{distribution} must not be the NULL pointer. If the corresponding function is not available for the distribution, @code{UNUR_INFINITY} is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. */ int unur_distr_cont_set_hrstr( UNUR_DISTR *distribution, const char *hrstr ); /* This function provides an alternative way to set a hazard rate and its derivative of the @var{distribution}. @var{hrstr} is a character string that contains the formula for the HR, see @ref{StringFunct,,Function String}, for details. See also the remarks for the unur_distr_cont_set_hr() call. It is not possible to call this funtion twice or to call this function after a unur_distr_cont_set_hr() call. */ char *unur_distr_cont_get_hrstr( const UNUR_DISTR *distribution ); /* Get pointer to string for HR of @var{distribution} that is given via the string interface. This call allocates memory to produce this string. It should be freed when it is not used any more. */ /* ==DOC @subsubheading Derived parameters The following paramters @strong{must} be set whenever one of the essential parameters has been set or changed (and the parameter is required for the chosen method). */ int unur_distr_cont_set_mode( UNUR_DISTR *distribution, double mode ); /* Set mode of @var{distribution}. The @var{mode} must be contained in the domain of @var{distribution}. Otherwise the mode is not set and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_SET}. For distributions with unbounded density, this call is used to set the pole of the PDF. Notice that the PDF should then return @code{UNUR_INFINITY} at the pole. Notice that the mode is adjusted when the domain is set, see the remark for the unur_distr_cont_set_domain() call. */ int unur_distr_cont_upd_mode( UNUR_DISTR *distribution ); /* Recompute the mode of the @var{distribution}. This call works properly for distribution objects from the UNU.RAN library of standard distributions when the corresponding function is available. Otherwise a (slow) numerical mode finder based on Brent's algorithm is used. If it failes @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. */ double unur_distr_cont_get_mode( UNUR_DISTR *distribution ); /* Get mode of @var{distribution}. If the mode is not marked as known, unur_distr_cont_upd_mode() is called to compute the mode. If this is not successful @code{UNUR_INFINITY} is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_GET}. (There is no difference between the case where no routine for computing the mode is available and the case where no mode exists for the distribution at all.) */ int unur_distr_cont_set_center( UNUR_DISTR *distribution, double center ); /* Set center of the @var{distribution}. The center is used by some methods to shift the distribution in order to decrease numerical round-off error. If not given explicitly a default is used. @emph{Important:} This call does not check whether the center is contained in the given domain. Default: The mode, if set by a unur_distr_cont_set_mode() or unur_distr_cont_upd_mode() call; otherwise @code{0}. */ double unur_distr_cont_get_center( const UNUR_DISTR *distribution ); /* Get center of the @var{distribution}. It always returns some point as there always exists a default for the center, see unur_distr_cont_set_center(). */ int unur_distr_cont_set_pdfarea( UNUR_DISTR *distribution, double area ); /* Set the area below the PDF. If @code{area} is non-positive, no area is set and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_SET}. For a distribution object created by the UNU.RAN library of standard distributions you always should use the unur_distr_cont_upd_pdfarea(). Otherwise there might be ambiguous side-effects. */ int unur_distr_cont_upd_pdfarea( UNUR_DISTR *distribution ); /* Recompute the area below the PDF of the distribution. It only works for distribution objects from the UNU.RAN library of standard distributions when the corresponding function is available. Otherwise @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. This call also sets the normalization constant such that the given PDF is the derivative of a given CDF, i.e. the area is 1. However, for truncated distributions the area is smaller than 1. The call does not work for distributions from the UNU.RAN library of standard distributions with truncated domain when the CDF is not available. */ double unur_distr_cont_get_pdfarea( UNUR_DISTR *distribution ); /* Get the area below the PDF of the distribution. If this area is not known,@* unur_distr_cont_upd_pdfarea() is called to compute it. If this is not successful @code{UNUR_INFINITY} is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_GET}. */ /* =END */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distr/deprecated_distr.c0000644001357500135600000003423314420445767015444 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: deprecated_distr.c * * * * Deprecated routines * * * ***************************************************************************** * * * THESE ROUTINES SHOULD NOT BE USED ANY MORE! * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include "deprecated_distr.h" /*---------------------------------------------------------------------------*/ #ifdef USE_DEPRECATED_CODE /*---------------------------------------------------------------------------*/ static void _unur_distr_cvec_marginals_free ( struct unur_distr **marginals, int dim ); /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Public: User Interface (API) **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #define DISTR distr->data.cvec /*---------------------------------------------------------------------------*/ int unur_distr_cvec_set_stdmarginals ( struct unur_distr *distr, struct unur_distr *stdmarginal) /*----------------------------------------------------------------------*/ /* Copy standardized marginal distribution into distribution object. */ /* Only one local copy is made. */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* stdmarginal ... pointer to standardized marginal distrib. object */ /* */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { struct unur_distr *clone; int i; /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); _unur_check_NULL( distr->name, stdmarginal, UNUR_ERR_NULL ); _unur_check_distr_object( stdmarginal, CONT, UNUR_ERR_DISTR_INVALID ); /* first we have to check whether there is already a list of marginal distributions */ if (DISTR.stdmarginals) _unur_distr_cvec_marginals_free(DISTR.stdmarginals, distr->dim); /* make copy of standardized marginal distribution object */ clone = _unur_distr_clone( stdmarginal ); /* allocate memory for array */ DISTR.stdmarginals = _unur_xmalloc (distr->dim * sizeof(struct unur_distr *)); /* copy pointer */ for (i=0; idim; i++) DISTR.stdmarginals[i] = clone; /* changelog */ distr->set |= UNUR_DISTR_SET_STDMARGINAL; return UNUR_SUCCESS; } /* end of unur_distr_cvec_set_stdmarginals() */ /*---------------------------------------------------------------------------*/ int unur_distr_cvec_set_stdmarginal_array ( struct unur_distr *distr, struct unur_distr **stdmarginals) /*----------------------------------------------------------------------*/ /* Copy standardized marginal distributions into distribution object. */ /* For each dimension a new copy is made even if the pointer in */ /* the array stdmarginals coincide. */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* stdmarginals ... pointer to array of std. marginal distr. objects */ /* */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int i; /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); _unur_check_NULL( distr->name, stdmarginals, UNUR_ERR_NULL ); for (i=0; idim; i++) { _unur_check_NULL( distr->name, *(stdmarginals+i), UNUR_ERR_NULL ); _unur_check_distr_object( *(stdmarginals+i), CONT, UNUR_ERR_DISTR_INVALID ); } /* first we have to check whether there is already a list of marginal distributions */ if (DISTR.stdmarginals) _unur_distr_cvec_marginals_free(DISTR.stdmarginals, distr->dim); /* allocate memory for array */ DISTR.stdmarginals = _unur_xmalloc (distr->dim * sizeof(struct unur_distr *)); /* make copy of standardized marginal distribution objects */ for (i=0; idim; i++) DISTR.stdmarginals[i] = _unur_distr_clone( *(stdmarginals+i) ); /* changelog */ distr->set |= UNUR_DISTR_SET_STDMARGINAL; return UNUR_SUCCESS; } /* end of unur_distr_cvec_set_stdmarginal_array() */ /*---------------------------------------------------------------------------*/ int unur_distr_cvec_set_stdmarginal_list ( struct unur_distr *distr, ... ) /*----------------------------------------------------------------------*/ /* Copy standardized marginal distributions into distribution object. */ /* For each dimenision there must be a pointer to a discribution object.*/ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* ... ... pointer to array of std. marginal distibution objects */ /* */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* IMPORTANT: */ /* All marginal distribution objects are destroyed after they have */ /* been copied into the distribution object. */ /*----------------------------------------------------------------------*/ { int i; int failed = FALSE; struct unur_distr *stdmarginal; struct unur_distr **stdmarginal_list; va_list vargs; /* check arguments */ _unur_check_NULL( NULL, distr, UNUR_ERR_NULL ); _unur_check_distr_object( distr, CVEC, UNUR_ERR_DISTR_INVALID ); /* allocate memory for array */ stdmarginal_list = _unur_xmalloc (distr->dim * sizeof(struct unur_distr *)); for (i=0; idim; i++) stdmarginal_list[i] = NULL; /* make copy of standardized marginal distribution objects */ va_start(vargs, distr); for (i=0; idim; i++) { stdmarginal = (struct unur_distr *) va_arg(vargs, struct unur_distr *); if (stdmarginal) { stdmarginal_list[i] = _unur_distr_clone( stdmarginal ); _unur_distr_free(stdmarginal); } else { failed = TRUE; } } va_end(vargs); if (failed) { /* some of the pointers are NULL pointers */ _unur_distr_cvec_marginals_free(stdmarginal_list, distr->dim); _unur_error(distr->name ,UNUR_ERR_DISTR_SET,"stdmarginals == NULL"); return UNUR_ERR_DISTR_SET; } /* copy list of marginal distributions. However, first we have to check */ /* whether there is already a list of marginal distributions. */ if (DISTR.stdmarginals) _unur_distr_cvec_marginals_free(DISTR.stdmarginals, distr->dim); DISTR.stdmarginals = stdmarginal_list; /* changelog */ distr->set |= UNUR_DISTR_SET_STDMARGINAL; return UNUR_SUCCESS; } /* end of unur_distr_cvec_set_stdmarginal_list() */ /*---------------------------------------------------------------------------*/ const struct unur_distr * unur_distr_cvec_get_stdmarginal( const struct unur_distr *distr, int n ) /*----------------------------------------------------------------------*/ /* Get pointer to standardized marginal distribution object. */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* n ... position of standardized marginal distribution object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( NULL, distr, NULL ); _unur_check_distr_object( distr, CVEC, NULL ); if (n<=0 || n > distr->dim) { _unur_error(distr->name,UNUR_ERR_DISTR_GET,"n not in 1 .. dim"); return NULL; } /* mean vector known ? */ if ( !(distr->set & UNUR_DISTR_SET_STDMARGINAL) ) { _unur_warning(distr->name,UNUR_ERR_DISTR_GET,"std marginals"); return NULL; } _unur_check_NULL( distr->name, DISTR.stdmarginals, NULL ); /* return standarized marginal distribution object */ return (DISTR.stdmarginals[n-1]); } /* end of unur_distr_cvec_get_stdmarginal() */ /*---------------------------------------------------------------------------*/ void _unur_distr_cvec_marginals_free ( struct unur_distr **marginals, int dim ) /*----------------------------------------------------------------------*/ /* free list of marginal distribution objects */ /* */ /* parameters: */ /* marginals ... pointer to list of marginal distribution objects */ /* dim ... number of marginal distributions */ /* */ /* return: */ /* pointer to clone of list of marginal distribution objects */ /*----------------------------------------------------------------------*/ { int i; if (_unur_distr_cvec_marginals_are_equal(marginals,dim)) { _unur_distr_free(marginals[0]); } else { for (i=0; i #include #include #include #include "unur_methods_source.h" #include "x_gen_source.h" #include "hist.h" #include "hist_struct.h" /*---------------------------------------------------------------------------*/ /* Variants: none */ /*---------------------------------------------------------------------------*/ /* Debugging flags */ /* bit 01 ... pameters and structure of generator (do not use here) */ /* bits 02-12 ... setup */ /* bits 13-24 ... adaptive steps */ /* bits 25-32 ... trace sampling */ #define HIST_DEBUG_PRINTHIST 0x00000100u /*---------------------------------------------------------------------------*/ /* Flags for logging set calls */ /*---------------------------------------------------------------------------*/ #define GENTYPE "HIST" /* type of generator */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_hist_init( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* Initialize new generator. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_hist_create( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* create new (almost empty) generator object. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_hist_clone( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* copy (clone) generator object. */ /*---------------------------------------------------------------------------*/ static void _unur_hist_free( struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* destroy generator object. */ /*---------------------------------------------------------------------------*/ static double _unur_hist_sample( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* sample from generator */ /*---------------------------------------------------------------------------*/ static int _unur_hist_create_tables( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* create (allocate) tables */ /*---------------------------------------------------------------------------*/ static int _unur_hist_make_guidetable( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* create table for indexed search */ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ /* the following functions print debugging information on output stream, */ /* i.e., into the LOG file if not specified otherwise. */ /*---------------------------------------------------------------------------*/ static void _unur_hist_debug_init( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print after generator has been initialized has completed. */ /*---------------------------------------------------------------------------*/ #endif #ifdef UNUR_ENABLE_INFO static void _unur_hist_info( struct unur_gen *gen, int help ); /*---------------------------------------------------------------------------*/ /* create info string. */ /*---------------------------------------------------------------------------*/ #endif /*---------------------------------------------------------------------------*/ /* abbreviations */ #define DISTR_IN distr->data.cemp /* data for distribution object */ #define PAR ((struct unur_hist_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_hist_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.cemp /* data for distribution in generator object */ #define SAMPLE gen->sample.cont /* pointer to sampling routine */ /*---------------------------------------------------------------------------*/ /* constants */ /*---------------------------------------------------------------------------*/ #define _unur_hist_getSAMPLE(gen) (_unur_hist_sample) /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Public: User Interface (API) **/ /*****************************************************************************/ struct unur_par * unur_hist_new( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get default parameters */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* default parameters (pointer to structure) */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_par *par; /* check arguments */ _unur_check_NULL( GENTYPE,distr,NULL ); /* check distribution */ if (distr->type != UNUR_DISTR_CEMP) { _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } COOKIE_CHECK(distr,CK_DISTR_CEMP,NULL); if (DISTR_IN.hist_prob == NULL || !(distr->set & UNUR_DISTR_SET_DOMAIN)) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"histogram"); return NULL; } /* allocate structure */ par = _unur_par_new( sizeof(struct unur_hist_par) ); COOKIE_SET(par,CK_HIST_PAR); /* copy input */ par->distr = distr; /* pointer to distribution object */ /* set default values */ par->method = UNUR_METH_HIST; /* method */ par->variant = 0u; /* default variant */ par->set = 0u; /* inidicate default parameters */ par->urng = unur_get_default_urng(); /* use default urng */ par->urng_aux = NULL; /* no auxilliary URNG required */ par->debug = _unur_default_debugflag; /* set default debugging flags */ /* routine for starting generator */ par->init = _unur_hist_init; return par; } /* end of unur_hist_new() */ /*****************************************************************************/ /** Private **/ /*****************************************************************************/ struct unur_gen * _unur_hist_init( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* initialize new generator */ /* */ /* parameters: */ /* par ... pointer to paramters for building generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); /* check input */ if ( par->method != UNUR_METH_HIST ) { _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); return NULL; } COOKIE_CHECK(par,CK_HIST_PAR,NULL); /* create a new empty generator object */ gen = _unur_hist_create(par); _unur_par_free(par); if (!gen) return NULL; /* compute guide table */ if ( (_unur_hist_create_tables(gen) != UNUR_SUCCESS) || (_unur_hist_make_guidetable(gen) != UNUR_SUCCESS) ) { _unur_hist_free(gen); return NULL; } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_hist_debug_init(gen); #endif return gen; } /* end of _unur_hist_init() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_hist_create( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* allocate memory for generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* pointer to (empty) generator object with default settings */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_HIST_PAR,NULL); /* create new generic generator object */ gen = _unur_generic_create( par, sizeof(struct unur_hist_gen) ); /* magic cookies */ COOKIE_SET(gen,CK_HIST_GEN); /* set generator identifier */ gen->genid = _unur_set_genid(GENTYPE); /* routines for sampling and destroying generator */ SAMPLE = _unur_hist_getSAMPLE(gen); gen->destroy = _unur_hist_free; gen->clone = _unur_hist_clone; /* make sure that the domain coincides with bin data */ if (DISTR.hist_bins) { DISTR.hmin = DISTR.hist_bins[0]; DISTR.hmax = DISTR.hist_bins[DISTR.n_hist]; } /* copy observed data into generator object */ GEN->n_hist = DISTR.n_hist; /* size of histogram */ GEN->prob = DISTR.hist_prob; /* probabilities of bins */ GEN->hmin = DISTR.hmin; /* lower ... */ GEN->hmax = DISTR.hmax; /* ... and upper bound */ GEN->hwidth = (DISTR.hmax - DISTR.hmin) / DISTR.n_hist; GEN->bins = (DISTR.hist_bins) ? DISTR.hist_bins : NULL; /* set all pointers to NULL */ GEN->sum = 0.; GEN->cumpv = NULL; GEN->guide_table = NULL; #ifdef UNUR_ENABLE_INFO /* set function for creating info string */ gen->info = _unur_hist_info; #endif /* return pointer to (almost empty) generator object */ return gen; } /* end of _unur_hist_create() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_hist_clone( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* copy (clone) generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to clone of generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { #define CLONE ((struct unur_hist_gen*)clone->datap) struct unur_gen *clone; /* check arguments */ CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_HIST_GEN,NULL); /* create generic clone */ clone = _unur_generic_clone( gen, GENTYPE ); /* copy histrogram into generator object */ CLONE->prob = clone->distr->data.cemp.hist_prob; /* probabilities of bins */ CLONE->bins = clone->distr->data.cemp.hist_bins; /* location of bins */ /* copy data for distribution */ CLONE->cumpv = _unur_xmalloc( GEN->n_hist * sizeof(double) ); memcpy( CLONE->cumpv, GEN->cumpv, GEN->n_hist * sizeof(double) ); CLONE->guide_table = _unur_xmalloc( GEN->n_hist * sizeof(int) ); memcpy( CLONE->guide_table, GEN->guide_table, GEN->n_hist * sizeof(int) ); return clone; #undef CLONE } /* end of _unur_hist_clone() */ /*---------------------------------------------------------------------------*/ void _unur_hist_free( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* deallocate generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { /* check arguments */ if( !gen ) /* nothing to do */ return; /* check input */ if ( gen->method != UNUR_METH_HIST ) { _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); return; } COOKIE_CHECK(gen,CK_HIST_GEN,RETURN_VOID); /* we cannot use this generator object any more */ SAMPLE = NULL; /* make sure to show up a programming error */ /* free two auxiliary tables */ if (GEN->guide_table) free(GEN->guide_table); if (GEN->cumpv) free(GEN->cumpv); /* free memory */ _unur_generic_free(gen); } /* end of _unur_hist_free() */ /*****************************************************************************/ double _unur_hist_sample( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { double U; int J; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_HIST_GEN,UNUR_INFINITY); /* sample from U(0,1) */ U = _unur_call_urng(gen->urng); /* look up in guide table ... */ J = GEN->guide_table[(int)(U * GEN->n_hist)]; /* ... and search */ U *= GEN->sum; while (GEN->cumpv[J] < U) J++; /* reuse of uniform random number: U ~ U(0,1) */ U = (U - (J ? GEN->cumpv[J-1] : 0.)) / GEN->prob[J]; /* sample uniformly from bin */ if (GEN->bins) return (U * GEN->bins[J+1] + (1.-U) * GEN->bins[J]); else return (GEN->hmin + (U+J)*GEN->hwidth); } /* end of _unur_hist_sample() */ /*****************************************************************************/ /** Auxilliary Routines **/ /*****************************************************************************/ int _unur_hist_create_tables( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* create (allocate) tables */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* allocation for cummulated probabilities */ GEN->cumpv = _unur_xrealloc( GEN->cumpv, GEN->n_hist * sizeof(double) ); /* allocate memory for the guide table */ GEN->guide_table = _unur_xrealloc( GEN->guide_table, GEN->n_hist * sizeof(int) ); /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_hist_create_tables() */ /*---------------------------------------------------------------------------*/ int _unur_hist_make_guidetable( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* create guide table */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { double *pv; /* pointer to probability vector */ int n_pv; /* length of probability vector */ double pvh; /* aux variable for computing cumulated sums */ double gstep; /* step size when computing guide table */ int i,j; /* probability vector */ pv = GEN->prob; n_pv = GEN->n_hist; /* computation of cumulated probabilities */ for( i=0, pvh=0.; icumpv[i] = ( pvh += pv[i] ); /* ... and check probability vector */ if (pv[i] < 0.) { _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"probability < 0"); return UNUR_ERR_GEN_DATA; } } GEN->sum = GEN->cumpv[n_pv-1]; /* computation of guide-table */ gstep = GEN->sum / GEN->n_hist; pvh = 0.; for( j=0, i=0; jn_hist;j++ ) { while (GEN->cumpv[i] < pvh) i++; if (i >= n_pv) { _unur_warning(gen->genid,UNUR_ERR_ROUNDOFF,"guide table"); break; } GEN->guide_table[j] = i; pvh += gstep; } /* if there has been an round off error, we have to complete the guide table */ for( ; jn_hist; j++ ) GEN->guide_table[j] = n_pv - 1; /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_hist_make_urntable() */ /*****************************************************************************/ /** Debugging utilities **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ void _unur_hist_debug_init( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write info about generator into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_HIST_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: type = continuous univariate random variates\n",gen->genid); fprintf(LOG,"%s: method = HIST (HISTogram of empirical distribution)\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); _unur_distr_cemp_debug( gen->distr, gen->genid, (gen->debug & HIST_DEBUG_PRINTHIST)); fprintf(LOG,"%s: sampling routine = _unur_hist_sample()\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); } /* end of _unur_hist_debug_init() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_INFO /*---------------------------------------------------------------------------*/ void _unur_hist_info( struct unur_gen *gen, int help ) /*----------------------------------------------------------------------*/ /* create character string that contains information about the */ /* given generator object. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* help ... whether to print additional comments */ /*----------------------------------------------------------------------*/ { struct unur_string *info = gen->infostr; /* generator ID */ _unur_string_append(info,"generator ID: %s\n\n", gen->genid); /* distribution */ _unur_string_append(info,"distribution:\n"); _unur_distr_info_typename(gen); _unur_string_append(info," functions = DATA [histogram of size=%d]\n", DISTR.n_hist); _unur_string_append(info,"\n"); /* if (help) { */ /* _unur_string_append(info,"\n"); */ /* } */ /* method */ _unur_string_append(info,"method: HIST (HISTogram of empirical distribution)\n"); _unur_string_append(info,"\n"); /* performance */ /* _unur_string_append(info,"performance characteristics:\n"); */ /* _unur_string_append(info,"\n"); */ /* parameters */ if (help) { _unur_string_append(info,"parameters: none\n"); _unur_string_append(info,"\n"); } /* Hints */ /* if (help) { */ /* _unur_string_append(info,"\n"); */ /* } */ } /* end of _unur_hist_info() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_INFO */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/dau.h0000644001357500135600000001207614420304141013210 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: dau.h * * * * PURPOSE: * * function prototypes for method DAU * * ((Discrete) Alias-Urn) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /* =METHOD DAU (Discrete) Alias-Urn method =UP Methods_for_DISCR =REQUIRED probability vector (PV) =SPEED Set-up: slow (linear with the vector-length), Sampling: very fast =REINIT supported =REF [WAa77] [HLD04: Sect.3.2] =DESCRIPTION DAU samples from distributions with arbitrary but finite probability vectors (PV) of length @i{N}. The algorithmus is based on an ingeneous method by A.J. Walker and requires a table of size (at least) @i{N}. It needs one random numbers and only one comparison for each generated random variate. The setup time for constructing the tables is @i{O(N)}. By default the probability vector is indexed starting at @code{0}. However this can be changed in the distribution object by a unur_distr_discr_set_domain() call. The method also works when no probability vector but a PMF is given. However then additionally a bounded (not too large) domain must be given or the sum over the PMF (see unur_distr_discr_make_pv() for details). =HOWTOUSE Create an object for a discrete distribution either by setting a probability vector or a PMF. The performance can be slightly influenced by setting the size of the used table which can be changed by unur_dau_set_urnfactor(). It is possible to change the parameters and the domain of the chosen distribution and run unur_reinit() to reinitialize the generator object. =END */ /*---------------------------------------------------------------------------*/ /* Routines for user interface */ /* =ROUTINES */ UNUR_PAR *unur_dau_new( const UNUR_DISTR *distribution ); /* Get default parameters for generator. */ /*...........................................................................*/ int unur_dau_set_urnfactor( UNUR_PAR *parameters, double factor ); /* Set size of urn table relative to length of the probability vector. It must not be less than 1. Larger tables result in (slightly) faster generation times but require a more expensive setup. However sizes larger than 2 are not recommended. Default is @code{1}. */ /* =END */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/deprecated_vmt.c0000644001357500135600000006407414420445767015451 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: deprecated_vmt.h * * * * TYPE: continuous multivariate random variate * * METHOD: generated random vector with independent components with * * given marginal distribution and use linear transformation * * of vector. * * * * DESCRIPTION: * * multivariate distribution with given mean vector and * * covariance matrix. * * * ***************************************************************************** * * * THIS METHOD AND THE CORRESPONDING ROUTINES SHOULD NOT BE USED ANY MORE! * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * ***************************************************************************** * * * REFERENCES: * * [1] Devroye, L. (1986): Non-Uniform Random Variate Generation, New-York * * * * [2] Hoermann, W., J. Leydold, and G. Derflinger (2004): * * Automatic Nonuniform Random Variate Generation, Springer, Berlin. * * * ***************************************************************************** * * * VMT generates random vectors for distributions with given mean * * vector mu and covariance matrix Sigma. It produces random vectors * * of the form X = L Y + mu, where L is the Cholesky factor of Sigma, * * i.e. L L^t = Sigma, and Y has independent components of the same * * distribution with mean 0 and standard deviation 1. * * * * See [2], Sect.11.1.6, Alg.11.3. * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include #include "unur_methods_source.h" #include "x_gen.h" #include "x_gen_source.h" #include "auto.h" #include "deprecated_vmt.h" #include "deprecated_vmt_struct.h" /*---------------------------------------------------------------------------*/ #ifdef USE_DEPRECATED_CODE /*---------------------------------------------------------------------------*/ /* Variants */ /*---------------------------------------------------------------------------*/ /* Debugging flags */ /* bit 01 ... pameters and structure of generator (do not use here) */ /* bits 02-12 ... setup */ /* bits 13-24 ... adaptive steps */ /* bits 25-32 ... trace sampling */ #define VMT_DEBUG_REINIT 0x00000010u /* print parameters after reinit */ /*---------------------------------------------------------------------------*/ /* Flags for logging set calls */ /*---------------------------------------------------------------------------*/ #define GENTYPE "VMT" /* type of generator */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_vmt_init( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* Initialize new generator. */ /*---------------------------------------------------------------------------*/ static int _unur_vmt_reinit( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Reinitialize generator. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_vmt_create( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* create new (almost empty) generator object. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_vmt_clone( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* copy (clone) generator object. */ /*---------------------------------------------------------------------------*/ static void _unur_vmt_free( struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* destroy generator object. */ /*---------------------------------------------------------------------------*/ static int _unur_vmt_sample_cvec( struct unur_gen *gen, double *vec ); /*---------------------------------------------------------------------------*/ /* sample from generator */ /*---------------------------------------------------------------------------*/ static int _unur_vmt_make_marginal_gen( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* make generators for marginal distributions */ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ /* the following functions print debugging information on output stream, */ /* i.e., into the LOG file if not specified otherwise. */ /*---------------------------------------------------------------------------*/ static void _unur_vmt_debug_init( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print after generator has been initialized has completed. */ /*---------------------------------------------------------------------------*/ #endif /*---------------------------------------------------------------------------*/ /* abbreviations */ #define DISTR_IN distr->data.cvec /* data for distribution object */ #define PAR ((struct unur_vmt_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_vmt_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.cvec /* data for distribution in generator object */ #define SAMPLE gen->sample.cvec /* pointer to sampling routine */ /*---------------------------------------------------------------------------*/ #define _unur_vmt_getSAMPLE(gen) ( _unur_vmt_sample_cvec ) /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Public: User Interface (API) **/ /*****************************************************************************/ struct unur_par * unur_vmt_new( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get default parameters */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* default parameters (pointer to structure) */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_par *par; /* check arguments */ _unur_check_NULL( GENTYPE,distr,NULL ); /* check distribution */ if (distr->type != UNUR_DISTR_CVEC) { _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } COOKIE_CHECK(distr,CK_DISTR_CVEC,NULL); if (!(distr->set & UNUR_DISTR_SET_MEAN)) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"mean"); return NULL; } if (!(distr->set & UNUR_DISTR_SET_COVAR)) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"covariance matrix"); return NULL; } if (!(distr->set & UNUR_DISTR_SET_STDMARGINAL)) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"standardized marginals"); return NULL; } /* allocate structure */ par = _unur_par_new( sizeof(struct unur_vmt_par) ); COOKIE_SET(par,CK_VMT_PAR); /* copy input */ par->distr = distr; /* pointer to distribution object */ /* set default values */ par->method = UNUR_METH_VMT ; /* method */ par->variant = 0u; /* default variant */ par->set = 0u; /* inidicate default parameters */ par->urng = unur_get_default_urng(); /* use default urng */ par->urng_aux = NULL; /* no auxilliary URNG required */ par->debug = _unur_default_debugflag; /* set default debugging flags */ /* routine for starting generator */ par->init = _unur_vmt_init; return par; } /* end of unur_vmt_new() */ /*****************************************************************************/ /** Private **/ /*****************************************************************************/ struct unur_gen * _unur_vmt_init( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* initialize new generator */ /* */ /* parameters: */ /* par ... pointer to paramters for building generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ _unur_check_NULL( GENTYPE,par,NULL ); /* check input */ if ( par->method != UNUR_METH_VMT ) { _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); return NULL; } COOKIE_CHECK(par,CK_VMT_PAR,NULL); /* create a new empty generator object */ gen = _unur_vmt_create(par); _unur_par_free(par); if (!gen) return NULL; /* initialize generators for marginal distribution */ if (_unur_vmt_make_marginal_gen(gen) != UNUR_SUCCESS) { _unur_vmt_free(gen); return NULL; } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_vmt_debug_init(gen); #endif /* o.k. */ return gen; } /* end of _unur_vmt_init() */ /*---------------------------------------------------------------------------*/ int _unur_vmt_reinit( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* re-initialize (existing) generator. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* (re)set sampling routine */ SAMPLE = _unur_vmt_getSAMPLE(gen); /* free list of (old) marginal generators */ if (gen->gen_aux_list) _unur_gen_list_free( gen->gen_aux_list, gen->n_gen_aux_list ); /* initialize generators for marginal distribution */ return _unur_vmt_make_marginal_gen(gen); } /* end of _unur_vmt_reinit() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_vmt_create( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* allocate memory for generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* pointer to (empty) generator object with default settings */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_VMT_PAR,NULL); /* create new generic generator object */ gen = _unur_generic_create( par, sizeof(struct unur_vmt_gen) ); /* magic cookies */ COOKIE_SET(gen,CK_VMT_GEN); /* dimension of distribution */ GEN->dim = gen->distr->dim; /* set generator identifier */ gen->genid = _unur_set_genid(GENTYPE); /* routines for sampling and destroying generator */ SAMPLE = _unur_vmt_getSAMPLE(gen); gen->destroy = _unur_vmt_free; gen->clone = _unur_vmt_clone; gen->reinit = _unur_vmt_reinit; /* cholesky factor of covariance matrix */ GEN->cholesky = DISTR.cholesky; /* initialize pointer */ GEN->marginalgen_list = NULL; /* return pointer to (almost empty) generator object */ return gen; } /* end of _unur_vmt_create() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_vmt_clone( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* copy (clone) generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to clone of generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { #define CLONE ((struct unur_vmt_gen*)clone->datap) struct unur_gen *clone; /* check arguments */ CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_VMT_GEN,NULL); /* create generic clone */ clone = _unur_generic_clone( gen, GENTYPE ); /* cholesky factor of covariance matrix */ CLONE->cholesky = clone->distr->data.cvec.cholesky; /* marginal generators are (also) stored as auxiliary generator */ /* which has already been cloned by generic_clone. */ CLONE->marginalgen_list = clone->gen_aux_list; return clone; #undef CLONE } /* end of _unur_vmt_clone() */ /*---------------------------------------------------------------------------*/ void _unur_vmt_free( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* deallocate generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { /* check arguments */ if( !gen ) /* nothing to do */ return; /* check input */ if ( gen->method != UNUR_METH_VMT ) { _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); return; } COOKIE_CHECK(gen,CK_VMT_GEN,RETURN_VOID); /* we cannot use this generator object any more */ SAMPLE = NULL; /* make sure to show up a programming error */ _unur_generic_free(gen); } /* end of _unur_vmt_free() */ /*****************************************************************************/ int _unur_vmt_sample_cvec( struct unur_gen *gen, double *vec ) /*----------------------------------------------------------------------*/ /* sample from generator */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* vec ... random vector (result) */ /*----------------------------------------------------------------------*/ { #define idx(a,b) (a*GEN->dim+b) int j,k; /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_VMT_GEN,UNUR_ERR_COOKIE); while (1) { /* generate random vector with independent components */ for (j=0; jdim; j++) vec[j] = unur_sample_cont(GEN->marginalgen_list[j]); /* transform to desired covariance structure: X = L.Y + mu where L ... cholesky factor of the covariance matrix Y ... vector with indenpent components (generated above) mu ... mean vector (notice that L is a lower triangular matrix) */ for (k=GEN->dim-1; k>=0; k--) { vec[k] *= GEN->cholesky[idx(k,k)]; for (j=k-1; j>=0; j--) vec[k] += vec[j] * GEN->cholesky[idx(k,j)]; vec[k] += DISTR.mean[k]; } if ( !(gen->distr->set & UNUR_DISTR_SET_DOMAINBOUNDED) || _unur_distr_cvec_is_indomain( vec, gen->distr) ) return UNUR_SUCCESS; } #undef idx } /* end of _unur_vmt_sample_cvec() */ /*****************************************************************************/ /** Auxilliary Routines **/ /*****************************************************************************/ int _unur_vmt_make_marginal_gen( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* make generators for marginal distributions */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { if (_unur_distr_cvec_marginals_are_equal(DISTR.stdmarginals, GEN->dim)) { /* we can use the same generator object for all marginal distributions */ struct unur_gen *marginalgen = unur_init( unur_auto_new( DISTR.stdmarginals[0] ) ); if (marginalgen) { gen->gen_aux_list = _unur_gen_list_set(marginalgen,GEN->dim); gen->n_gen_aux_list = GEN->dim; } } else { int i,j; int failed = FALSE; struct unur_gen **marginalgens = _unur_xmalloc( GEN->dim * sizeof(struct unur_gen*) ); for (i=0; idim; i++) { marginalgens[i] = unur_init( unur_auto_new( DISTR.stdmarginals[i] ) ); if (marginalgens[i]==NULL) { failed=TRUE; break; } } if (failed) { for (j=0; jgen_aux_list = marginalgens; gen->n_gen_aux_list = GEN->dim; } } /* the marginal generator is an auxiliary generator for method VMT, of course */ GEN->marginalgen_list = gen->gen_aux_list; /* verify initialization of marginal generators */ if (GEN->marginalgen_list == NULL) { _unur_error(gen->genid,UNUR_ERR_GENERIC,"init of marginal generators failed"); return UNUR_FAILURE; } return UNUR_SUCCESS; } /* end of _unur_vmt_make_marginal_gen() */ /*****************************************************************************/ /** Debugging utilities **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ void _unur_vmt_debug_init( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write info about generator into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { int i; FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_VMT_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: type = continuous multivariate random variates\n",gen->genid); fprintf(LOG,"%s: method = VMT (Vector Matrix Transformation)\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); _unur_distr_cvec_debug( gen->distr, gen->genid ); fprintf(LOG,"%s: generators for standardized marginal distributions = \n",gen->genid); fprintf(LOG,"%s:\t",gen->genid); for (i=0; idim; i++) fprintf(LOG,"[%s] ", GEN->marginalgen_list[i]->genid); fprintf(LOG,"\n%s:\n",gen->genid); fprintf(LOG,"%s: sampling routine = _unur_vmt_sample_cvec()\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: INIT completed **********************\n",gen->genid); } /* end of _unur_vmt_debug_init() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ #endif /* USE_DEPRECATED_CODE */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/dsrou.c0000644001357500135600000013273214420445767013614 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: dsrou.c * * * * TYPE: discrete univariate random variate * * METHOD: discrete simple universal method (ratio-of-uniforms method) * * * * DESCRIPTION: * * Given PMF and mode of a T_{-1/2}-concave distribution * * produce a value X consistent with its PMF * * * * REQUIRED: * * pointer to the mass function * * mode of distribution * * sum over PMF * * * * OPTIONAL: * * CDF at mode * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * ***************************************************************************** * * * REFERENCES: * * [1] Leydold J. (2001): A simple universal generator for continuous and * * discrete univariate T-concave distributions, * * ACM Trans. Math. Software 27(1), pp. 66--82. * * * * [2] Kinderman, A.J. and Monahan, F.J. (1977): Computer generation of * * random variables using the ratio of uniform deviates, * * ACM Trans. Math. Software 3(3), pp. 257--260. * * * ***************************************************************************** * * * The ratio-of-uniforms method introduced in [2] is a flexible method that * * is based on the following theorem: * * * * THEOREM: * * Let X be a random variable with density function f(x) = g(x) / G, * * where g(x) is a positive integrable function with support (x_0,x_1) * * not necessarily finite and G = integral g(x) dx. * * If (V,U) is uniformly distributed in * * A = {(v,u): 0 < u <= sqrt(g(v/u)), x_0 < v/u < x_1}, * * then X = V/U has probability density function f(x). * * * * Generating point (V,U) uniformly distributed in A is done by rejection * * from an enveloping region, usually from the minimal bounding rectangle. * * * * For discrete random variates the continuous PDF * * PDF(x) = PMF(floor(x)) * * is used. * * * * The implemented algorithm uses the fact, that for many distributions, * * the polygon having the "spikes" of A as its verticeds is convex. * * Then we can find the follow bounding rectangles: * * (For simplicity we have assumed that the sum over the PMF is 1) * * * * Define * * R = {(v,u): -1/u_l <= v <= 0, 0 <= u <= u_l} \cup * * {(v,u): 0 <= v <= 1/u_r, 0 <= u <= u_r} * * Q = {(v,u): v_l <= v <= 0, 0 <= u <= u_l} \cup * * {(v,u): 0 <= v <= v_r, 0 <= u <= u_r} * * where * * u_l = sqrt(PMF(mode-1)), u_r = sqrt(PMF(mode)), * * v_l = -F(mode-1)/u_l, v_r = (1-F(mode-1))/u_r * * Then * * A subset R subset Q * * * * Thus we can use R to generate whenever the CDF F(mode-1) at the mode * * is known, and Q otherwise. * * Notice, that the rection constant is 2 in the first case and 4 and the * * latter. * * * * Distributions with a convex set A are characterized by the following * * theorem that shows a connection to transformed density rejection TDR. * * * * THEOREM: * * A is convex if and only if g is T-concave with transformation * * T(x) = -1/sqrt(x), i.e., -1/sqrt(g(x)) is a concave function. * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include "unur_methods_source.h" #include "x_gen_source.h" #include "dsrou.h" #include "dsrou_struct.h" /*---------------------------------------------------------------------------*/ /* Variants: */ #define DSROU_VARFLAG_VERIFY 0x002u /* run verify mode */ /*---------------------------------------------------------------------------*/ /* Debugging flags */ /* bit 01 ... pameters and structure of generator (do not use here) */ /* bits 02-12 ... setup */ /* bits 13-24 ... adaptive steps */ /* bits 25-32 ... trace sampling */ #define DSROU_DEBUG_REINIT 0x00000010u /* print parameters after reinit */ /*---------------------------------------------------------------------------*/ /* Flags for logging set calls */ #define DSROU_SET_CDFMODE 0x001u /* CDF at mode is known */ /*---------------------------------------------------------------------------*/ #define GENTYPE "DSROU" /* type of generator */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_dsrou_init( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* Initialize new generator. */ /*---------------------------------------------------------------------------*/ static int _unur_dsrou_reinit( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Reinitialize generator. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_dsrou_create( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* create new (almost empty) generator object. */ /*---------------------------------------------------------------------------*/ static int _unur_dsrou_check_par( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Check parameters of given distribution and method */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_dsrou_clone( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* copy (clone) generator object. */ /*---------------------------------------------------------------------------*/ static void _unur_dsrou_free( struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* destroy generator object. */ /*---------------------------------------------------------------------------*/ static int _unur_dsrou_sample( struct unur_gen *gen ); static int _unur_dsrou_sample_check( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* sample from generator */ /*---------------------------------------------------------------------------*/ static int _unur_dsrou_rectangle( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* compute universal bounding rectangle. */ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ /* the following functions print debugging information on output stream, */ /* i.e., into the LOG file if not specified otherwise. */ /*---------------------------------------------------------------------------*/ static void _unur_dsrou_debug_init( const struct unur_gen *gen, int is_reinit ); /*---------------------------------------------------------------------------*/ /* print after generator has been initialized has completed. */ /*---------------------------------------------------------------------------*/ #endif #ifdef UNUR_ENABLE_INFO static void _unur_dsrou_info( struct unur_gen *gen, int help ); /*---------------------------------------------------------------------------*/ /* create info string. */ /*---------------------------------------------------------------------------*/ #endif /*---------------------------------------------------------------------------*/ /* abbreviations */ #define DISTR_IN distr->data.discr /* data for distribution object */ #define PAR ((struct unur_dsrou_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_dsrou_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.discr /* data for distribution in generator object */ #define BD_LEFT domain[0] /* left boundary of domain of distribution */ #define BD_RIGHT domain[1] /* right boundary of domain of distribution */ #define SAMPLE gen->sample.discr /* pointer to sampling routine */ #define PMF(x) _unur_discr_PMF((x),(gen->distr)) /* call to PMF */ /*---------------------------------------------------------------------------*/ #define _unur_dsrou_getSAMPLE(gen) \ ( ((gen)->variant & DSROU_VARFLAG_VERIFY) \ ? _unur_dsrou_sample_check : _unur_dsrou_sample ) /*---------------------------------------------------------------------------*/ /* constants */ #define SQRT2 (M_SQRT2) /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Public: User Interface (API) **/ /*****************************************************************************/ struct unur_par * unur_dsrou_new( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get default parameters */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* default parameters (pointer to structure) */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_par *par; /* check arguments */ _unur_check_NULL( GENTYPE,distr,NULL ); /* check distribution */ if (distr->type != UNUR_DISTR_DISCR) { _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } COOKIE_CHECK(distr,CK_DISTR_DISCR,NULL); if (DISTR_IN.pmf == NULL) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PMF"); return NULL; } /* allocate structure */ par = _unur_par_new( sizeof(struct unur_dsrou_par) ); COOKIE_SET(par,CK_DSROU_PAR); /* copy input */ par->distr = distr; /* pointer to distribution object */ /* set default values */ PAR->Fmode = -1.; /* CDF at mode (unknown yet) */ par->method = UNUR_METH_DSROU; /* method and default variant */ par->variant = 0u; /* default variant */ par->set = 0u; /* inidicate default parameters */ par->urng = unur_get_default_urng(); /* use default urng */ par->urng_aux = NULL; /* no auxilliary URNG required */ par->debug = _unur_default_debugflag; /* set default debugging flags */ /* routine for starting generator */ par->init = _unur_dsrou_init; return par; } /* end of unur_dsrou_new() */ /*****************************************************************************/ int unur_dsrou_set_cdfatmode( struct unur_par *par, double Fmode ) /*----------------------------------------------------------------------*/ /* set value of cdf at mode */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* Fmode ... CDF at mode */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, DSROU ); /* check new parameter for generator */ if (Fmode < 0. || Fmode > 1.) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"CDF(mode)"); return UNUR_ERR_PAR_SET; } /* store date */ PAR->Fmode = Fmode; /* changelog */ par->set |= DSROU_SET_CDFMODE; return UNUR_SUCCESS; } /* end of unur_dsrou_set_cdfatmode() */ /*---------------------------------------------------------------------------*/ int unur_dsrou_set_verify( struct unur_par *par, int verify ) /*----------------------------------------------------------------------*/ /* turn verifying of algorithm while sampling on/off */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* verify ... 0 = no verifying, !0 = verifying */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* no verifying is the default */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, DSROU ); /* we use a bit in variant */ par->variant = (verify) ? (par->variant | DSROU_VARFLAG_VERIFY) : (par->variant & (~DSROU_VARFLAG_VERIFY)); /* o.k. */ return UNUR_ERR_NULL; } /* end of unur_dsrou_set_verify() */ /*---------------------------------------------------------------------------*/ int unur_dsrou_chg_verify( struct unur_gen *gen, int verify ) /*----------------------------------------------------------------------*/ /* turn verifying of algorithm while sampling on/off */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* verify ... 0 = no verifying, !0 = verifying */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* no verifying is the default */ /*----------------------------------------------------------------------*/ { /* check input */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, DSROU, UNUR_ERR_GEN_INVALID ); /* we must not change this switch when sampling has been disabled by using a pointer to the error producing routine */ if (SAMPLE == _unur_sample_discr_error) return UNUR_FAILURE; if (verify) /* turn verify mode on */ gen->variant |= DSROU_VARFLAG_VERIFY; else /* turn verify mode off */ gen->variant &= ~DSROU_VARFLAG_VERIFY; SAMPLE = _unur_dsrou_getSAMPLE(gen); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_dsrou_chg_verify() */ /*****************************************************************************/ int unur_dsrou_chg_cdfatmode( struct unur_gen *gen, double Fmode ) /*----------------------------------------------------------------------*/ /* change value of cdf at mode */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* Fmode ... CDF at mode */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, DSROU, UNUR_ERR_GEN_INVALID ); /* check new parameter for generator */ if (Fmode < 0. || Fmode > 1.) { _unur_warning(gen->genid,UNUR_ERR_PAR_SET,"CDF(mode)"); return UNUR_ERR_PAR_SET; } /* copy parameters */ GEN->Fmode = Fmode; /* changelog */ gen->set |= DSROU_SET_CDFMODE; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_dsrou_chg_cdfatmode() */ /*****************************************************************************/ /** Private **/ /*****************************************************************************/ struct unur_gen * _unur_dsrou_init( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* initialize new generator */ /* */ /* parameters: */ /* params ... pointer to paramters for building generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); /* check input */ if ( par->method != UNUR_METH_DSROU ) { _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); return NULL; } COOKIE_CHECK(par,CK_DSROU_PAR,NULL); /* create a new empty generator object */ gen = _unur_dsrou_create(par); /* free parameters */ _unur_par_free(par); if (!gen) return NULL; /* check parameters */ if (_unur_dsrou_check_par(gen) != UNUR_SUCCESS) { _unur_dsrou_free(gen); return NULL; } /* compute universal bounding rectangle */ if ( _unur_dsrou_rectangle(gen)!=UNUR_SUCCESS ) { _unur_dsrou_free(gen); return NULL; } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_dsrou_debug_init(gen, FALSE); #endif return gen; } /* end of _unur_dsrou_init() */ /*---------------------------------------------------------------------------*/ int _unur_dsrou_reinit( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* re-initialize (existing) generator. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int result; /* check parameters */ if ( (result = _unur_dsrou_check_par(gen)) != UNUR_SUCCESS) return result; /* compute universal bounding rectangle */ if ( (result = _unur_dsrou_rectangle(gen)) != UNUR_SUCCESS) return result; /* (re)set sampling routine */ SAMPLE = _unur_dsrou_getSAMPLE(gen); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug & DSROU_DEBUG_REINIT) _unur_dsrou_debug_init(gen,TRUE); #endif return UNUR_SUCCESS; } /* end of _unur_dsrou_reinit() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_dsrou_create( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* allocate memory for generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* pointer to (empty) generator object with default settings */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_DSROU_PAR,NULL); /* create new generic generator object */ gen = _unur_generic_create( par, sizeof(struct unur_dsrou_gen) ); /* magic cookies */ COOKIE_SET(gen,CK_DSROU_GEN); /* set generator identifier */ gen->genid = _unur_set_genid(GENTYPE); /* routines for sampling and destroying generator */ SAMPLE = _unur_dsrou_getSAMPLE(gen); gen->destroy = _unur_dsrou_free; gen->clone = _unur_dsrou_clone; gen->reinit = _unur_dsrou_reinit; /* copy some parameters into generator object */ GEN->Fmode = PAR->Fmode; /* CDF at mode */ #ifdef UNUR_ENABLE_INFO /* set function for creating info string */ gen->info = _unur_dsrou_info; #endif /* return pointer to (almost empty) generator object */ return gen; } /* end of _unur_dsrou_create() */ /*---------------------------------------------------------------------------*/ int _unur_dsrou_check_par( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* check parameters of given distribution and method */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check for required data: mode */ if (!(gen->distr->set & UNUR_DISTR_SET_MODE)) { _unur_warning(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"mode: try finding it (numerically)"); if (unur_distr_discr_upd_mode(gen->distr)!=UNUR_SUCCESS) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"mode"); return UNUR_ERR_DISTR_REQUIRED; } } /* check for required data: sum over PMF */ if (!(gen->distr->set & UNUR_DISTR_SET_PMFSUM)) if (unur_distr_discr_upd_pmfsum(gen->distr)!=UNUR_SUCCESS) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"sum over PMF"); return UNUR_ERR_DISTR_REQUIRED; } /* mode must be in domain */ if ( (DISTR.mode < DISTR.BD_LEFT) || (DISTR.mode > DISTR.BD_RIGHT) ) { /* there is something wrong. assume: user has change domain without changing mode. but then, she probably has not updated area and is to large */ _unur_warning(GENTYPE,UNUR_ERR_GEN_DATA,"area and/or CDF at mode"); DISTR.mode = _unur_max(DISTR.mode,DISTR.BD_LEFT); DISTR.mode = _unur_min(DISTR.mode,DISTR.BD_RIGHT); } return UNUR_SUCCESS; } /* end of _unur_dsrou_check_par() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_dsrou_clone( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* copy (clone) generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to clone of generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { #define CLONE ((struct unur_dsrou_gen*)clone->datap) struct unur_gen *clone; /* check arguments */ CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_DSROU_GEN,NULL); /* create generic clone */ clone = _unur_generic_clone( gen, GENTYPE ); return clone; #undef CLONE } /* end of _unur_dsrou_clone() */ /*---------------------------------------------------------------------------*/ void _unur_dsrou_free( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* deallocate generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { /* check arguments */ if( !gen ) /* nothing to do */ return; /* check input */ if ( gen->method != UNUR_METH_DSROU ) { _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); return; } COOKIE_CHECK(gen,CK_DSROU_GEN,RETURN_VOID); /* we cannot use this generator object any more */ SAMPLE = NULL; /* make sure to show up a programming error */ /* free memory */ _unur_generic_free(gen); } /* end of _unur_dsrou_free() */ /*****************************************************************************/ int _unur_dsrou_sample( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* int (sample from random variate) */ /* */ /* error: */ /* return INT_MAX */ /*----------------------------------------------------------------------*/ { double U,V,X; int I; /* check arguments */ CHECK_NULL(gen,INT_MAX); COOKIE_CHECK(gen,CK_DSROU_GEN,INT_MAX); while (1) { /* generate point uniformly in union of rectangles */ V = GEN->al + _unur_call_urng(gen->urng) * (GEN->ar - GEN->al); V /= (V<0.) ? GEN->ul : GEN->ur; /* if ul==0. then al==0. and thus V>=0. */ while ( _unur_iszero(U = _unur_call_urng(gen->urng))); U *= (V<0.) ? GEN->ul : GEN->ur; /* ratio */ X = floor(V/U) + DISTR.mode; /* inside domain ? */ if ( (X < DISTR.BD_LEFT) || (X > DISTR.BD_RIGHT) ) continue; /* convert to int */ I = (int) X; /* accept or reject */ if (U*U <= PMF(I)) return I; } } /* end of _unur_dsrou_sample() */ /*---------------------------------------------------------------------------*/ int _unur_dsrou_sample_check( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator and verify that method can be used */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* int (sample from random variate) */ /* */ /* error: */ /* return INT_MAX */ /*----------------------------------------------------------------------*/ { double U,V,pI,VI,X; double um2, vl, vr; int I; /* check arguments */ CHECK_NULL(gen,INT_MAX); COOKIE_CHECK(gen,CK_DSROU_GEN,INT_MAX); while (1) { /* generate point uniformly in union of rectangles */ V = GEN->al + _unur_call_urng(gen->urng) * (GEN->ar - GEN->al); V /= (V<0.) ? GEN->ul : GEN->ur; while ( _unur_iszero(U = _unur_call_urng(gen->urng))); U *= (V<0.) ? GEN->ul : GEN->ur; /* ratios */ X = floor(V/U) + DISTR.mode; /* inside domain ? */ if ( (X < DISTR.BD_LEFT) || (X > DISTR.BD_RIGHT) ) continue; /* convert to int */ I = (int) X; /* values of PMF and v-coordinate of point */ pI = PMF(I); VI = V/U * sqrt(pI); /* values of boundary of rectangle */ /* (avoid roundoff error with FP registers) */ um2 = (2.+4.*DBL_EPSILON) * ((V<0) ? GEN->ul*GEN->ul : GEN->ur*GEN->ur); vl = (GEN->ul>0.) ? (1.+UNUR_EPSILON) * GEN->al/GEN->ul : 0.; vr = (1.+UNUR_EPSILON) * GEN->ar/GEN->ur; /* check hat */ if ( pI > um2 || VI < vl || VI > vr ) { /* printf("pI = %g < %g VI = %g < %g < %g\n", */ /* pI, ur2, vl, VI, vr); */ _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PMF(x) > hat(x)"); } /* accept or reject */ if (U*U <= pI) return I; } } /* end of _unur_dsrou_sample_check() */ /*****************************************************************************/ /** Auxilliary Routines **/ /*****************************************************************************/ int _unur_dsrou_rectangle( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* compute universal bounding rectangle */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { double pm, pbm; /* PMF at mode and mode-1 */ /* check arguments */ CHECK_NULL( gen, UNUR_ERR_NULL ); COOKIE_CHECK( gen,CK_DSROU_GEN, UNUR_ERR_COOKIE ); /* compute PMF at mode and mode-1 */ pm = PMF(DISTR.mode); pbm = (DISTR.mode-1 < DISTR.BD_LEFT) ? 0. : PMF(DISTR.mode-1); /* pm and pbm must be positive */ if (pm <= 0. || pbm < 0.) { _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"PMF(mode) <= 0."); return UNUR_ERR_GEN_DATA; } /* heights of rectangles */ GEN->ul = sqrt(pbm); GEN->ur = sqrt(pm); /* areas of rectangle */ if (_unur_iszero(GEN->ul)) { /* PMF monotonically decreasing */ GEN->al = 0.; GEN->ar = DISTR.sum; } else if (gen->set & DSROU_SET_CDFMODE) { /* CDF at mode known */ GEN->al = -(GEN->Fmode * DISTR.sum)+pm; GEN->ar = DISTR.sum + GEN->al; } else { GEN->al = -(DISTR.sum - pm); GEN->ar = DISTR.sum; } /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_dsrou_rectangle() */ /*****************************************************************************/ /** Debugging utilities **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ static void _unur_dsrou_debug_init( const struct unur_gen *gen, int is_reinit ) /*----------------------------------------------------------------------*/ /* write info about generator into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* is_reinit ... if TRUE the generator has been reinitialized */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_DSROU_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s:\n",gen->genid); if (!is_reinit) { fprintf(LOG,"%s: type = discrete univariate random variates\n",gen->genid); fprintf(LOG,"%s: method = dsrou (discrete simple universal ratio-of-uniforms)\n",gen->genid); } else fprintf(LOG,"%s: reinit!\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); _unur_distr_discr_debug( gen->distr, gen->genid, FALSE ); fprintf(LOG,"%s: sampling routine = _unur_dsrou_sample",gen->genid); if (gen->variant & DSROU_VARFLAG_VERIFY) fprintf(LOG,"_check"); fprintf(LOG,"()\n%s:\n",gen->genid); if (gen->set & DSROU_SET_CDFMODE) fprintf(LOG,"%s: CDF(mode) = %g\n",gen->genid,GEN->Fmode); else fprintf(LOG,"%s: CDF(mode) unknown\n",gen->genid); fprintf(LOG,"%s: no (universal) squeeze\n",gen->genid); fprintf(LOG,"%s: no mirror principle\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: Rectangles:\n",gen->genid); if (GEN->ul > 0.) fprintf(LOG,"%s: left upper point = (%g,%g) \tarea = %g (%5.2f%%)\n", gen->genid,GEN->al/GEN->ul,GEN->ul,fabs(GEN->al),100.*fabs(GEN->al)/(-GEN->al+GEN->ar)); else fprintf(LOG,"%s: left upper point = (0,0) \tarea = 0 (0.00%%)\n",gen->genid); fprintf(LOG,"%s: right upper point = (%g,%g) \tarea = %g (%5.2f%%)\n", gen->genid,GEN->ar/GEN->ur,GEN->ur,GEN->ar,100.*GEN->ar/(-GEN->al+GEN->ar)); fprintf(LOG,"%s:\n",gen->genid); fflush(LOG); } /* end of _unur_dsrou_debug_init() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_INFO /*---------------------------------------------------------------------------*/ void _unur_dsrou_info( struct unur_gen *gen, int help ) /*----------------------------------------------------------------------*/ /* create character string that contains information about the */ /* given generator object. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* help ... whether to print additional comments */ /*----------------------------------------------------------------------*/ { struct unur_string *info = gen->infostr; struct unur_distr *distr = gen->distr; /* generator ID */ _unur_string_append(info,"generator ID: %s\n\n", gen->genid); /* distribution */ _unur_string_append(info,"distribution:\n"); _unur_distr_info_typename(gen); _unur_string_append(info," functions = PMF\n"); _unur_string_append(info," domain = (%d, %d)\n", DISTR.domain[0],DISTR.domain[1]); _unur_string_append(info," mode = %d %s\n", DISTR.mode, (distr->set & UNUR_DISTR_SET_MODE_APPROX) ? "[numeric.]" : ""); _unur_string_append(info," sum(PMF) = %g\n", DISTR.sum); if (gen->set & DSROU_SET_CDFMODE) _unur_string_append(info," F(mode) = %g\n", GEN->Fmode); else _unur_string_append(info," F(mode) = [unknown]\n"); _unur_string_append(info,"\n"); if (help) { if ( distr->set & UNUR_DISTR_SET_MODE_APPROX ) _unur_string_append(info,"[ Hint: %s ]\n", "You may provide the \"mode\""); _unur_string_append(info,"\n"); } /* method */ _unur_string_append(info,"method: DSROU (Discrete Simple Ratio-Of-Uniforms)\n"); _unur_string_append(info,"\n"); /* performance */ _unur_string_append(info,"performance characteristics:\n"); _unur_string_append(info," enveloping rectangle = (%g,%g) x (%g,%g) [left]\n", (GEN->ul > 0.)?GEN->al/GEN->ul:0., 0., 0., (GEN->ul > 0.)?GEN->ul:0.); _unur_string_append(info," (%g,%g) x (%g,%g) [right]\n", 0.,GEN->ar/GEN->ur, 0., GEN->ur); _unur_string_append(info," area(hat) = %g + %g = %g\n", fabs(GEN->al), GEN->ar, -GEN->al+GEN->ar); _unur_string_append(info," rejection constant = %g\n", 2. * (-GEN->al+GEN->ar) / DISTR.sum); _unur_string_append(info,"\n"); /* parameters */ if (help) { _unur_string_append(info,"parameters:\n"); if (gen->set & DSROU_SET_CDFMODE) _unur_string_append(info," cdfatmode = %g\n", GEN->Fmode); else _unur_string_append(info," cdfatmode = [not set]\n"); if (gen->variant & DSROU_VARFLAG_VERIFY) _unur_string_append(info," verify = on\n"); _unur_string_append(info,"\n"); } /* Hints */ if (help) { if ( !(gen->set & DSROU_SET_CDFMODE)) _unur_string_append(info,"[ Hint: %s ]\n", "You can set \"cdfatmode\" to reduce the rejection constant."); _unur_string_append(info,"\n"); } } /* end of _unur_dsrou_info() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_INFO */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/deprecated_tdrgw.h0000644001357500135600000001246114420445767015770 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: tdrgw.h * * * * PURPOSE: * * function prototypes for method TDRGW * * (Transformed Density Rejection - Gilks & Wild variant) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * THIS METHOD HAS BEEN RENAMED TO 'ARS'. * * THE CORRESPONDING ROUTINES SHOULD NOT BE USED ANY MORE! * * * * Please simply replace 'tdrgw' by 'ars' to get the new function names. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /* =deprecatedMETHOD TDRGW Transformed Density Rejection - Gilks&Wild variant =UP Methods_for_CONT =REQUIRED concave logPDF, derivative of logPDF =OPTIONAL mode =SPEED Set-up: fast, Sampling: slow =REINIT supported =REF [GWa92] [HLD04: Cha.4] =DESCRIPTION Same as method ARS. Please simply replace 'tdrgw' by 'ars' to get the new function names. =HOWTOUSE Same as method ARS. Please simply replace 'tdrgw' by 'ars' to get the new function names. =END */ /*---------------------------------------------------------------------------*/ /* Routines for user interface */ #define unur_tdrgw_new( distr ) \ (unur_ars_new( distr )) #define unur_tdrgw_set_max_intervals( par,max_ivs ) \ (unur_ars_set_max_intervals( (par),(max_ivs) )) #define unur_tdrgw_set_cpoints( par,n_cpoints,cpoints ) \ (unur_ars_set_cpoints( (par),(n_cpoints),(cpoints) )) #define unur_tdrgw_set_reinit_percentiles( par,n_percentiles,percentiles ) \ (unur_ars_set_reinit_percentiles( (par),(n_percentiles),(percentiles) )) #define unur_tdrgw_chg_reinit_percentiles( gen,n_percentiles,percentiles ) \ (unur_ars_chg_reinit_percentiles( (gen),(n_percentiles),(percentiles) )) #define unur_tdrgw_set_reinit_ncpoints( par,ncpoints ) \ (unur_ars_set_reinit_ncpoints( (par),(ncpoints) )) #define unur_tdrgw_chg_reinit_ncpoints( gen,ncpoints ) \ (unur_ars_chg_reinit_ncpoints( (gen),(ncpoints) )) #define unur_tdrgw_set_verify( par,verify ) \ (unur_ars_set_verify( (par),(verify) )) #define unur_tdrgw_chg_verify( gen,verify ) \ (unur_ars_chg_verify( (gen),(verify) )) #define unur_tdrgw_set_pedantic( par,pedantic ) \ (unur_ars_set_pedantic( (par),(pedantic) )) #define unur_tdrgw_get_loghatarea( gen ) \ (unur_ars_get_loghatarea( gen )) #define unur_tdrgw_eval_invcdfhat( gen,u ) \ (unur_ars_eval_invcdfhat( (gen),(u) )) /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/mvtdr_debug.ch0000644001357500135600000002346614420445767015135 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: mvtdr_debug.c * * * * TYPE: continuous multivariate random variate * * METHOD: multivariate transformed density rejection * * * * DESCRIPTION: * * Given (logarithm of the) PDF of a log-concave distribution; * * produce a value x consistent with its density. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*****************************************************************************/ /** Private **/ /*****************************************************************************/ /*****************************************************************************/ /** Debugging utilities **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ void _unur_mvtdr_debug_init_start( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write info about generator into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_MVTDR_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: type = continuous multivariate random variates\n",gen->genid); fprintf(LOG,"%s: method = MVTDR (Multi-Variate Transformed Density Rejection)\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); _unur_distr_cvec_debug( gen->distr, gen->genid ); fprintf(LOG,"%s: sampling routine = _unur_mvtdr_sample_cvec()\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: PDF(center) = %g\n",gen->genid, GEN->pdfcenter); fprintf(LOG,"%s: bound for splitting cones = %g * mean volume\n",gen->genid,GEN->bound_splitting); fprintf(LOG,"%s: maximum number of cones = %d\n",gen->genid,GEN->max_cones); fprintf(LOG,"%s:\n",gen->genid); fflush(LOG); } /* end of _unur_mvtdr_debug_init_start() */ /*---------------------------------------------------------------------------*/ void _unur_mvtdr_debug_init_finished( const struct unur_gen *gen, int successful ) /*----------------------------------------------------------------------*/ /* write info about generator into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* successful ... whether creation of was succesfull */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_MVTDR_GEN,RETURN_VOID); LOG = unur_get_stream(); if (!successful) { fprintf(LOG,"%s: initialization of GENERATOR failed **********************\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); } /* gamma variates */ fprintf(LOG,"%s: upper bound for gamma variates = %g\n",gen->genid,GEN->max_gamma); /* triangulation steps */ fprintf(LOG,"%s: minimum triangulation level = %d\n",gen->genid,GEN->steps_min); fprintf(LOG,"%s: maximum triangulation level = %d\n",gen->genid,GEN->n_steps); /* number of vertices and cones */ fprintf(LOG,"%s: number of cones = %d\n",gen->genid,GEN->n_cone); fprintf(LOG,"%s: number of vertices = %d\n",gen->genid,GEN->n_vertex); /* volume below hat */ fprintf(LOG,"%s: volume below hat = %g",gen->genid,GEN->Htot); if (gen->distr->set & UNUR_DISTR_SET_PDFVOLUME) fprintf(LOG,"\t[ hat/pdf ratio = %g ]",GEN->Htot/DISTR.volume); fprintf(LOG,"\n"); if (gen->debug & MVTDR_DEBUG_VERTEX) _unur_mvtdr_debug_vertices(gen); if (gen->debug & MVTDR_DEBUG_CONE) _unur_mvtdr_debug_cones(gen); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: INIT completed **********************\n",gen->genid); fflush(LOG); } /* end of _unur_mvtdr_debug_init_finished() */ /*---------------------------------------------------------------------------*/ void _unur_mvtdr_debug_vertices( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* print list of vertices */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; VERTEX *vt; int i; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_MVTDR_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s: List of vertices: %d\n",gen->genid,GEN->n_vertex); for (vt = GEN->vertex; vt != NULL; vt = vt->next) { fprintf(LOG,"%s: [%4d] = ( %g",gen->genid,vt->index,vt->coord[0]); for (i=1; idim; i++) fprintf(LOG,", %g",vt->coord[i]); fprintf(LOG," )\n"); } fprintf(LOG,"%s:\n",gen->genid); fflush(LOG); } /* end of _unur_mvtdr_debug_vertices() */ /*---------------------------------------------------------------------------*/ void _unur_mvtdr_debug_cones( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* print list of cones. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; CONE *c; int i,n; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_MVTDR_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s: List of cones: %d\n",gen->genid,GEN->n_cone); for (c = GEN->cone,n=0; c != NULL; c = c->next, n++) { fprintf(LOG,"%s: [%4d|%2d] = { %d", gen->genid, n, c->level, (c->v[0])->index); for (i=1; idim; i++) fprintf(LOG,", %d",(c->v[i])->index); fprintf(LOG," }\n"); fprintf(LOG,"%s:\tgv = ( %g", gen->genid, c->gv[0]); for (i=1; idim; i++) fprintf(LOG,", %g", c->gv[i]); fprintf(LOG," )\n"); fprintf(LOG,"%s:\tHi = %g\t[ %g%% ]\n", gen->genid, c->Hi, 100.*c->Hi/GEN->Htot); fprintf(LOG,"%s:\ttp = %g\n", gen->genid, c->tp); fprintf(LOG,"%s:\tf(tp) = %g\n", gen->genid, exp(c->Tfp)); fprintf(LOG,"%s:\theight = %g\n", gen->genid, c->height); } fprintf(LOG,"%s:\n",gen->genid); fflush(LOG); } /* end of _unur_mvtdr_debug_cones() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/itdr_struct.h0000644001357500135600000001026514420304141015003 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: itdr_struct.h * * * * PURPOSE: * * declares structures for method ITDR * * (Inverse Transformed Density Rejection) * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Information for constructing the generator */ struct unur_itdr_par { double xi; /* intersection point lc(x)=ilc(x) */ double cp, ct; /* c-value for pole and tail region, resp. */ }; /*---------------------------------------------------------------------------*/ /* The generator object */ struct unur_itdr_gen { double bx; /* splitting point between pole and tail region */ double Atot; /* total area below hat */ double Ap, Ac, At; /* areas in upper pole, center, and tail region */ double cp, xp; /* c-value and design point for pole region */ double alphap, betap; /* parameters for hat in pole region */ double by; /* hat of pole region at bx */ double sy; /* PDF(bx) = squeeze for central region */ double ct, xt; /* c-value and design point for tail region */ double Tfxt, dTfxt; /* parameters for hat in tail region */ double pole; /* location of pole */ double bd_right; /* right boundary of shifted domain */ double sign; /* region: +1 ... (-oo,0], -1 ... [0,oo) */ double xi; /* intersection point lc(x)=ilc(x) */ }; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/mcorr_struct.h0000644001357500135600000000673614420304141015173 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: mcorr_struct.h * * * * PURPOSE: * * declares structures for method MCORR * * (Matrix -- CORRelation matrix) * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Information for constructing the generator */ struct unur_mcorr_par { int dim; /* dimension (number of rows and columns) of matrix */ const double *eigenvalues; /* optional eigenvalues of correlation matrix */ }; /*---------------------------------------------------------------------------*/ /* The generator object */ struct unur_mcorr_gen { int dim; /* dimension (number of rows and columns) of matrix */ double *H; /* working array */ double *M; /* working array */ double *eigenvalues; /* optional eigenvalues of the correlation matrix */ }; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/mvtdr.c0000644001357500135600000004160614420445767013613 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: mvtdr.c * * * * TYPE: continuous multivariate random variate * * METHOD: multivariate transformed density rejection * * * * DESCRIPTION: * * Given (logarithm of the) PDF of a log-concave distribution; * * produce a value x consistent with its density. * * * ***************************************************************************** * * * Copyright (c) 2000-2007 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * ***************************************************************************** * * * REFERENCES: * * [1] Leydold, J. (1998): A Rejection Technique for Sampling from * * Log-Concave Multivariate Distributions, * * ACM TOMACS 8(3), pp. 254-280. * * * * [2] Hoermann, W., J. Leydold, and G. Derflinger (2004): * * Automatic Nonuniform Random Variate Generation, Springer, Berlin. * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include #include #include #include #include "unur_methods_source.h" #include "x_gen.h" #include "x_gen_source.h" #include "tdr.h" #include "mvtdr.h" #include "mvtdr_struct.h" #ifdef UNUR_ENABLE_INFO # include #endif /*---------------------------------------------------------------------------*/ /* Constants */ /* relative size of guide table compared to number of cones */ #define GUIDE_TABLE_SIZE 1 /* find proper touching point using Brent's algorithm: */ /* acceptable tolerance for Brent's algorithm */ #define FIND_TP_TOL 0.001 /* fine tuning of generator: */ /* a number is considered to be zero if abs is below */ /* TOLERANCE * PDF(center) / dim */ #define TOLERANCE (1.e-8) /* gamma variate generator (using method TDR) */ #define MVTDR_TDR_SQH_RATIO (0.95) /*---------------------------------------------------------------------------*/ /* Variants */ #define MVTDR_VARFLAG_VERIFY 0x01u /* flag for verifying hat */ /*---------------------------------------------------------------------------*/ /* Debugging flags */ /* bit 01 ... pameters and structure of generator (do not use here) */ /* bits 02-12 ... setup */ /* bits 13-24 ... adaptive steps */ /* bits 25-32 ... trace sampling */ #define MVTDR_DEBUG_VERTEX 0x00000010u /* print list of vertices */ #define MVTDR_DEBUG_CONE 0x00000020u /* print list of conesces */ /*---------------------------------------------------------------------------*/ /* Flags for logging set calls */ #define MVTDR_SET_STEPSMIN 0x001u /* min number of triangulation steps */ #define MVTDR_SET_MAXCONES 0x002u /* max number of cones */ #define MVTDR_SET_BOUNDSPLITTING 0x004u /* bound for splitting cones */ /*---------------------------------------------------------------------------*/ #define GENTYPE "MVTDR" /* type of generator */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_mvtdr_init( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* Initialize new generator. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_mvtdr_create( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* create new (almost empty) generator object. */ /*---------------------------------------------------------------------------*/ static int _unur_mvtdr_sample_cvec( struct unur_gen *gen, double *vec ); /*---------------------------------------------------------------------------*/ /* sample from generator */ /*---------------------------------------------------------------------------*/ static void _unur_mvtdr_free( struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* destroy generator object. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_mvtdr_clone( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* copy (clone) generator object. */ /*---------------------------------------------------------------------------*/ static int _unur_mvtdr_simplex_sample( const struct unur_gen *gen, double *U ); /*---------------------------------------------------------------------------*/ /* sample point uniformly on standard simplex. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_mvtdr_gammagen( struct unur_gen *gen, double alpha ); /*---------------------------------------------------------------------------*/ /* create a gamma random variate generator with shape parameter alpha. */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /* Hat. */ /*****************************************************************************/ static int _unur_mvtdr_create_hat( struct unur_gen *gen ); /* compute cones and hat function */ /*****************************************************************************/ /* CONES. */ /*****************************************************************************/ static int _unur_mvtdr_initial_cones( struct unur_gen *gen ); /* get initial cones */ static CONE *_unur_mvtdr_cone_new( struct unur_gen *gen ); /* get new (empty) vertex object */ static int _unur_mvtdr_cone_center( struct unur_gen *gen, CONE *c ); /* computer center of cone */ static int _unur_mvtdr_cone_params( struct unur_gen *gen, CONE *c ); /* compute parameters for hat for a cone (expect touching point and volume below hat) */ static double _unur_mvtdr_cone_logH( struct unur_gen *gen, CONE *c ); /* calculate log of volume below hat for given touching point */ static int _unur_mvtdr_cone_split( struct unur_gen *gen, CONE *c, int step ); /* split a cone */ static int _unur_mvtdr_triangulate( struct unur_gen *gen, int step, int all); /* make one triangulation step */ static int _unur_mvtdr_cone_height( struct unur_gen *gen, CONE *c ); /* calculate height of pyramid (cone) */ static int _unur_mvtdr_max_gamma( struct unur_gen *gen ); /* compute upper bound for gamma variates */ /*****************************************************************************/ /* optimal distance for touching points */ /*****************************************************************************/ static double _unur_mvtdr_tp_min_aux(double t, void *p); /* auxiliary function to be used with _unur_util_brent(). */ static double _unur_mvtdr_tp_min( double t, void *p ); /* wrapper for _unur_mvtdr_cone_hatvolume(); sets cone->tp; funtion that must be minimized for optimal touching point */ static int _unur_mvtdr_tp_find( struct unur_gen *gen, CONE *c ); /* find optimal touching point for cone */ static int _unur_mvtdr_tp_search( struct unur_gen *gen, TP_ARG *a ); /* search for proper touching point */ static int _unur_mvtdr_tp_bracket( struct unur_gen *gen, TP_ARG *a ); /* search for proper bracket of minimum of tp_f2min() */ /*****************************************************************************/ /* VERTICES. */ /*****************************************************************************/ static int _unur_mvtdr_initial_vertices( struct unur_gen *gen ); /* get vertices of initial cones */ static VERTEX *_unur_mvtdr_vertex_new( struct unur_gen *gen ); /* get new (empty) vertex object */ static int _unur_mvtdr_number_vertices( struct unur_gen *gen, int level ); /* number of vertices in given triangulation level */ static VERTEX *_unur_mvtdr_vertex_on_edge( struct unur_gen *gen, VERTEX **vl ); /* compute new vertex on edge */ /*****************************************************************************/ /* hash table for storing EDGES. */ /*****************************************************************************/ static int _unur_mvtdr_etable_new( struct unur_gen *gen, int size ); /* make new hash table */ static void _unur_mvtdr_etable_free( struct unur_gen *gen ); /* free hash table */ static VERTEX *_unur_mvtdr_etable_find_or_insert( struct unur_gen *gen, VERTEX **vidx ); /* find or insert entry in hash table, return pointer to vertex */ /*****************************************************************************/ static int _unur_mvtdr_make_guide_table( struct unur_gen *gen ); /* create guide table */ /*****************************************************************************/ /* Debug. */ /*****************************************************************************/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ /* the following functions print debugging information on output stream, */ /* i.e., into the LOG file if not specified otherwise. */ /*---------------------------------------------------------------------------*/ static void _unur_mvtdr_debug_init_start( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print after (almost empty generator) object has been created. */ /*---------------------------------------------------------------------------*/ static void _unur_mvtdr_debug_init_finished( const struct unur_gen *gen, int successful ); /*---------------------------------------------------------------------------*/ /* print after generator has been initialized. */ /*---------------------------------------------------------------------------*/ static void _unur_mvtdr_debug_vertices( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print list of vertices. */ /*---------------------------------------------------------------------------*/ static void _unur_mvtdr_debug_cones( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print list of cones. */ /*---------------------------------------------------------------------------*/ #endif #ifdef UNUR_ENABLE_INFO static void _unur_mvtdr_info( struct unur_gen *gen, int help ); /*---------------------------------------------------------------------------*/ /* create info string. */ /*---------------------------------------------------------------------------*/ #endif /*---------------------------------------------------------------------------*/ /* abbreviations */ #define DISTR_IN distr->data.cvec /* data for distribution object */ #define PAR ((struct unur_mvtdr_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_mvtdr_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.cvec /* data for distribution in generator object */ #define SAMPLE gen->sample.cvec /* pointer to sampling routine */ #define PDF(x) _unur_cvec_PDF((x),(gen->distr)) /* call to PDF */ #define logPDF(x) _unur_cvec_logPDF((x),(gen->distr)) /* call to logPDF */ #define dPDF(r,x) _unur_cvec_dPDF((r),(x),(gen->distr)) /* call to dPDF */ #define dlogPDF(r,x) _unur_cvec_dlogPDF((r),(x),(gen->distr)) /* call to dlogPDF */ /* an auxiliary generator for gamma variates */ #define GEN_GAMMA gen->gen_aux /*---------------------------------------------------------------------------*/ /* Transformation */ /* this version supports T(x) = log(x) only */ #define T(x) (log(x)) /* transformation function */ #define T_deriv(x) (1./(x)) /* first derivative of transform funtion */ #define T_inv(x) (exp(x)) /* inverse of transform function */ /*---------------------------------------------------------------------------*/ /* return codes for _unur_mvtdr_tp_bracket() */ #define TP_LEFT 1 /* minimum in left point */ #define TP_MIDDLE 2 /* minimum in middle point */ #define TP_RIGHT 3 /* minimum in right point */ #define TP_BRACKET 4 /* bracket found */ /*---------------------------------------------------------------------------*/ /* since there is only file scope or program code, we abuse the */ /* #include directive. */ /** Public: User Interface (API) **/ #include "mvtdr_newset.ch" /** Private **/ #include "mvtdr_init.ch" #include "mvtdr_sample.ch" #include "mvtdr_debug.ch" #include "mvtdr_info.ch" /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/mcorr.h0000644001357500135600000001536414420304141013564 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: mcorr.h * * * * PURPOSE: * * function prototypes for method MCORR * * (Matrix - CORRelation matrix) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /* =METHOD MCORR Random CORRelation matrix =UP Methods_for_MATR =REQUIRED Distribution object for random correlation matrix =OPTIONAL =SPEED Set-up: fast, Sampling: depends on dimension =REINIT supported =REF [DLa86: Sect.6.1; p.605] [MOa84] =DESCRIPTION MCORR generates a random correlation matrix (Pearson's correlation). Two methods are used: @enumerate @item When a random correlation matrix having given eigenvalues is sought, the method of Marsaglia and Olkin [MOa84] is used. In this case, the correlation matrix @unurmath{R} is given as @unurmath{R=PDP'} where @unurmath{D} is a diagonal matrix containing the eigenvalues and @unurmath{P} is a random orthonormal matrix. In higher dimensions, the rounding-errors introduced in the previous matrix multiplications could lead to a non-symmetric correlation matrix. Therefore the symmetric correlation matrix is computed as @unurmath{R=(PDP'+P'DP)/2}. @item A matrix @unurmath{H} is generated where all rows are independent random vectors of unit length uniformly on a sphere. Then @unurmath{HH'} is a correlation matrix (and vice versa if @unurmath{HH'} is a correlation matrix then the rows of @unurmath{H} are random vectors on a sphere). @end enumerate Notice that due to round-off errors the generated matrices might not be positive definite in extremely rare cases (especially when the given eigenvalues are amost 0). There are many other possibilites (distributions) of sampling the random rows from a sphere. The chosen methods are simple but does not result in a uniform distriubution of the random correlation matrices. It only works with distribution objects of random correlation matrices (@pxref{correlation,,Random Correlation Matrix}). =HOWTOUSE Create a distibution object for random correlation matrices by a @code{unur_distr_correlation} call (@pxref{correlation,,Random Correlation Matrix}). When a correlation matrix with given eigenvalues should be generated, these eigenvalues can be set by a unur_mcorr_set_eigenvalues() call. Otherwise, a faster algorithm is used that generates correlation matrices with random eigenstructure. Notice that due to round-off errors, there is a (small) chance that the resulting matrix is not positive definite for a Cholesky decomposition algorithm, especially when the dimension of the distribution is high. It is possible to change the given eigenvalues using unur_mcorr_chg_eigenvalues() and run unur_reinit() to reinitialize the generator object. =END */ /*---------------------------------------------------------------------------*/ /* Routines for user interface */ /* =ROUTINES */ UNUR_PAR *unur_mcorr_new( const UNUR_DISTR *distribution ); /* Get default parameters for generator. */ int unur_mcorr_set_eigenvalues( UNUR_PAR *par, const double *eigenvalues ); /* Sets the (optional) eigenvalues of the correlation matrix. If set, then the Marsaglia and Olkin algorithm will be used to generate random correlation matrices with given eigenvalues. Important: the given eigenvalues of the correlation matrix must be strictly positive and sum to the dimension of the matrix. If non-positive eigenvalues are attempted, no eigenvalues are set and an error code is returned. In case, that their sum is different from the dimension, an implicit scaling to give the correct sum is performed. */ int unur_mcorr_chg_eigenvalues( UNUR_GEN *gen, const double *eigenvalues ); /* Change the eigenvalues of the correlation matrix. One must run unur_reinit() to reinitialize the generator object then. */ /* =END */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/dstd_struct.h0000644001357500135600000000744114420445767015025 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: dstd_struct.h * * * * PURPOSE: * * declares structures for method DSTD * * (wrapper for special generators for * * Discrete STanDard distributions) * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Information for constructing the generator */ struct unur_dstd_par { int dummy; /* no special parameters */ }; /*---------------------------------------------------------------------------*/ /* The generator object */ struct unur_dstd_gen { double *gen_param; /* parameters for the generator */ int n_gen_param; /* number of parameters for the generator */ int *gen_iparam; /* integer parameters for generator */ int n_gen_iparam; /* number of integer parameters for the generator */ double Umin; /* cdf at left boundary of domain */ double Umax; /* cdf at right boundary of domain */ int is_inversion; /* indicate whether method is inversion method */ const char *sample_routine_name; /* name of sampling routine */ }; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/mixt.c0000644001357500135600000011466514420445767013446 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: mixt.c * * * * TYPE: (continuous) univariate random variate * * METHOD: mixture of distributions (meta method) * * * * DESCRIPTION: * * Given an array of components and array of probabilities * * produce a value X consistent with the mixture distribution * * * * REQUIRED: * * pointers to generators of components * * array of probabilities * * * ***************************************************************************** * * * Copyright (c) 2010 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include #include #include "unur_methods_source.h" #include "x_gen.h" #include "x_gen_source.h" #include "dgt.h" #include "dgt_struct.h" #include "mixt.h" #include "mixt_struct.h" /*---------------------------------------------------------------------------*/ /* Variants: */ #define MIXT_VARFLAG_INVERSION 0x004u /* use inversion method (if possible) */ /*---------------------------------------------------------------------------*/ /* Debugging flags */ /* bit 01 ... pameters and structure of generator (do not use here) */ /* bits 02-12 ... setup */ /* bits 13-24 ... adaptive steps */ /* bits 25-32 ... trace sampling */ /*---------------------------------------------------------------------------*/ /* Flags for logging set calls */ #define MIXT_SET_USEINVERSION 0x001u /* use inverion method */ /*---------------------------------------------------------------------------*/ #define GENTYPE "MIXT" /* type of generator */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_mixt_init( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* Initialize new generator. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_mixt_create( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* create new (almost empty) generator object. */ /*---------------------------------------------------------------------------*/ static int _unur_mixt_check_par( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Check parameters of given distribution and method */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_mixt_clone( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* copy (clone) generator object. */ /*---------------------------------------------------------------------------*/ static void _unur_mixt_free( struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* destroy generator object. */ /*---------------------------------------------------------------------------*/ static double _unur_mixt_sample( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* sample from generator */ /*---------------------------------------------------------------------------*/ static double _unur_mixt_sample_inv( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* sample from generator by inversion */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_mixt_indexgen( const double *prob, int n_prob ); /*---------------------------------------------------------------------------*/ /* create generator for index. */ /*---------------------------------------------------------------------------*/ static int _unur_mixt_get_boundary( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* compute boundary of mixture and check for overlapping domains. */ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ /* the following functions print debugging information on output stream, */ /* i.e., into the LOG file if not specified otherwise. */ /*---------------------------------------------------------------------------*/ static void _unur_mixt_debug_init( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print after generator has been initialized has completed. */ /*---------------------------------------------------------------------------*/ #endif #ifdef UNUR_ENABLE_INFO static void _unur_mixt_info( struct unur_gen *gen, int help ); /*---------------------------------------------------------------------------*/ /* create info string. */ /*---------------------------------------------------------------------------*/ #endif /*---------------------------------------------------------------------------*/ /* abbreviations */ #define PAR ((struct unur_mixt_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_mixt_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.cont /* data for distribution in generator object */ #define SAMPLE gen->sample.cont /* pointer to sampling routine */ #define BD_LEFT domain[0] /* left boundary of domain of distribution */ #define BD_RIGHT domain[1] /* right boundary of domain of distribution */ /* shortcuts for auxiliary generators */ #define INDEX gen_aux #define PROB gen_aux->distr->data.discr.pv #define COMP gen_aux_list #define N_COMP n_gen_aux_list /*---------------------------------------------------------------------------*/ #define _unur_mixt_getSAMPLE(gen) \ ( ((gen)->variant & MIXT_VARFLAG_INVERSION) \ ? _unur_mixt_sample_inv : _unur_mixt_sample ) /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Public: User Interface (API) **/ /*****************************************************************************/ struct unur_par * unur_mixt_new( int n, const double *prob, struct unur_gen **comp ) /*----------------------------------------------------------------------*/ /* get default parameters */ /* */ /* parameters: */ /* n ... number of components */ /* prob ... probabilities for components */ /* comp ... array of pointers to components (generators) */ /* */ /* return: */ /* default parameters (pointer to structure) */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_par *par; /* check arguments */ _unur_check_NULL( GENTYPE, prob, NULL ); _unur_check_NULL( GENTYPE, comp, NULL ); if (n<1) { _unur_error(GENTYPE,UNUR_ERR_DISTR_DOMAIN,"n < 1"); return NULL; } /* checking type of generator objects in 'comp' is delayed to init */ /* allocate structure */ par = _unur_par_new( sizeof(struct unur_mixt_par) ); COOKIE_SET(par,CK_MIXT_PAR); /* copy input */ par->distr = NULL; /* pointer to distribution object */ /* copy data */ PAR->n_comp = n; /* number of components */ PAR->prob = prob; /* probabilities for components */ PAR->comp = comp; /* array of pointers to components (generators) */ /* set default values */ par->method = UNUR_METH_MIXT; /* method and default variant */ par->variant = 0u; /* default variant */ par->set = 0u; /* inidicate default parameters */ par->urng = unur_get_default_urng(); /* use default urng */ par->urng_aux = NULL; /* no auxilliary URNG required */ par->debug = _unur_default_debugflag; /* set default debugging flags */ /* routine for starting generator */ par->init = _unur_mixt_init; return par; } /* end of unur_mixt_new() */ /*****************************************************************************/ int unur_mixt_set_useinversion( struct unur_par *par, int useinversion ) /*----------------------------------------------------------------------*/ /* set flag for using inversion method (default: off) */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* useinversion ... !0 = try inversion method, 0 = no inversion */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* no squeeze is the default */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, MIXT ); /* we use a bit in 'variant' */ par->variant = (useinversion) ? (par->variant | MIXT_VARFLAG_INVERSION) : (par->variant & (~MIXT_VARFLAG_INVERSION)); /* changelog */ par->set |= MIXT_SET_USEINVERSION; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_mixt_set_useinversion() */ /*****************************************************************************/ /** Private **/ /*****************************************************************************/ struct unur_gen * _unur_mixt_init( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* initialize new generator */ /* */ /* parameters: */ /* params pointer to paramters for building generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; int i; /* check arguments */ CHECK_NULL(par,NULL); /* check input */ if ( par->method != UNUR_METH_MIXT ) { _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); return NULL; } COOKIE_CHECK(par,CK_MIXT_PAR,NULL); /* create a new empty generator object */ gen = _unur_mixt_create(par); if (!gen) { _unur_par_free(par); return NULL; } /* probabilities */ gen->INDEX = _unur_mixt_indexgen(PAR->prob,PAR->n_comp); /* components */ gen->N_COMP = PAR->n_comp; /* number of components */ gen->COMP = _unur_xmalloc( gen->N_COMP * sizeof(struct unur_gen *)); for (i=0; iN_COMP; i++) gen->COMP[i] = unur_gen_clone(PAR->comp[i]); /* free parameters */ _unur_par_free(par); /* check parameters */ if (_unur_mixt_check_par(gen) != UNUR_SUCCESS) { _unur_mixt_free(gen); return NULL; } /* compute boundary of mixture and check for overlapping domains */ if ( _unur_mixt_get_boundary(gen) != UNUR_SUCCESS ) { _unur_mixt_free(gen); return NULL; } /* set name of distribution */ unur_distr_set_name(gen->distr, "(mixture)"); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_mixt_debug_init(gen); #endif return gen; } /* end of _unur_mixt_init() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_mixt_create( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* allocate memory for generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* pointer to (empty) generator object with default settings */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_MIXT_PAR,NULL); /* create new generic generator object */ gen = _unur_generic_create( par, sizeof(struct unur_mixt_gen) ); /* magic cookies */ COOKIE_SET(gen,CK_MIXT_GEN); /* set generator identifier */ gen->genid = _unur_set_genid(GENTYPE); /* object 'par' does not contain a distribution object */ /* so we create one. */ gen->distr = unur_distr_cont_new(); /* routines for sampling and destroying generator */ SAMPLE = _unur_mixt_getSAMPLE(gen); gen->destroy = _unur_mixt_free; gen->clone = _unur_mixt_clone; gen->reinit = NULL; /* reinit not implemented ! */ /* copy some parameters into generator object */ GEN->is_inversion = (gen->variant & MIXT_VARFLAG_INVERSION) ? TRUE : FALSE; /* initialize parameters: none */ #ifdef UNUR_ENABLE_INFO /* set function for creating info string */ gen->info = _unur_mixt_info; #endif /* return pointer to (almost empty) generator object */ return gen; } /* end of _unur_mixt_create() */ /*---------------------------------------------------------------------------*/ int _unur_mixt_check_par( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* check parameters of given distribution and method */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int i; int type; /* check probabilities */ if (gen->INDEX == NULL) { _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"invalid probabilities"); return UNUR_ERR_GEN_DATA; } /* check generator objects */ for (i=0; iN_COMP; i++) { /* generators must not be NULL */ if (gen->COMP[i] == NULL) { _unur_error(gen->genid,UNUR_ERR_NULL,"component is NULL"); return UNUR_ERR_NULL; } /* all generators must sample from univariate distributions */ type = gen->COMP[i]->method & UNUR_MASK_TYPE; if ( type != UNUR_METH_DISCR && type != UNUR_METH_CONT && type != UNUR_METH_CEMP ) { _unur_error(gen->genid,UNUR_ERR_GEN_INVALID,"component not univariate"); return UNUR_ERR_GEN_INVALID; } /* we only can use inversion method if all generators use inversion method */ if (GEN->is_inversion && (! unur_gen_is_inversion (gen->COMP[i]))) { _unur_error(gen->genid,UNUR_ERR_GEN_INVALID,"component does not implement inversion"); return UNUR_ERR_GEN_INVALID; } } return UNUR_SUCCESS; } /* end of _unur_mixt_check_par() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_mixt_clone( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* copy (clone) generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to clone of generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { #define CLONE ((struct unur_mixt_gen*)clone->datap) struct unur_gen *clone; /* check arguments */ CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_MIXT_GEN,NULL); /* create generic clone */ clone = _unur_generic_clone( gen, GENTYPE ); return clone; #undef CLONE } /* end of _unur_mixt_clone() */ /*---------------------------------------------------------------------------*/ void _unur_mixt_free( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* deallocate generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { /* check arguments */ if( !gen ) /* nothing to do */ return; /* check input */ if ( gen->method != UNUR_METH_MIXT ) { _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); return; } COOKIE_CHECK(gen,CK_MIXT_GEN,RETURN_VOID); /* we cannot use this generator object any more */ SAMPLE = NULL; /* make sure to show up a programming error */ /* free memory */ _unur_generic_free(gen); } /* end of _unur_mixt_free() */ /*****************************************************************************/ double _unur_mixt_sample( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { struct unur_gen *comp; int J; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_MIXT_GEN,UNUR_INFINITY); /* sample index */ J = unur_sample_discr(gen->INDEX); /* get component */ comp = gen->COMP[J]; /* sample from selected component */ switch(comp->method & UNUR_MASK_TYPE) { case UNUR_METH_DISCR: return ((double) comp->sample.discr(comp)); case UNUR_METH_CONT: case UNUR_METH_CEMP: default: return (comp->sample.cont(comp)); } } /* end of _unur_mixt_sample() */ /*---------------------------------------------------------------------------*/ double _unur_mixt_sample_inv( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator by inversion */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { double U, recycle; int J; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_MIXT_GEN,UNUR_INFINITY); /* sample index */ U = _unur_call_urng(gen->urng); J =unur_dgt_eval_invcdf_recycle( gen->INDEX, U, &recycle ); /* the resolution of recycle is less than that of U. */ /* the values 0. and 1. may be result in UNUR_INFINITY. */ /* thus we make a small perturbation in this case. */ if (_unur_iszero(recycle)) recycle = DBL_MIN; if (_unur_isone(recycle)) recycle = 1. - DBL_EPSILON; /* sample from component */ return unur_quantile(gen->COMP[J], recycle); } /* end of _unur_mixt_sample_inv() */ /*---------------------------------------------------------------------------*/ double unur_mixt_eval_invcdf( const struct unur_gen *gen, double u ) /*----------------------------------------------------------------------*/ /* evaluate inverse CDF at u. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* u ... argument for inverse CDF */ /* */ /* return: */ /* double (inverse CDF) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { double recycle; int J; /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); if ( ! (gen->method == UNUR_METH_MIXT && GEN->is_inversion) ) { _unur_error(gen->genid,UNUR_ERR_GEN_INVALID,""); return UNUR_INFINITY; } COOKIE_CHECK(gen,CK_MIXT_GEN,UNUR_INFINITY); if ( ! (u>0. && u<1.)) { if ( ! (u>=0. && u<=1.)) { _unur_warning(gen->genid,UNUR_ERR_DOMAIN,"U not in [0,1]"); } if (u<=0.) return DISTR.domain[0]; if (u>=1.) return DISTR.domain[1]; return u; /* = NaN */ } /* get index */ J =unur_dgt_eval_invcdf_recycle( gen->INDEX, u, &recycle ); /* the resolution of recycle is less than that of U. */ /* the values 0. and 1. may be result in UNUR_INFINITY. */ /* thus we make a small perturbation in this case. */ if (_unur_iszero(recycle)) recycle = DBL_MIN; if (_unur_isone(recycle)) recycle = 1. - DBL_EPSILON; /* get from component */ return unur_quantile(gen->COMP[J], recycle); } /* end of unur_mixt_eval_invcdf() */ /*****************************************************************************/ /** Auxilliary Routines **/ /*****************************************************************************/ struct unur_gen * _unur_mixt_indexgen( const double *prob, int n_prob ) /*---------------------------------------------------------------------------*/ /* create generator for index using method DGT. */ /* */ /* parameters: */ /* prob ... probability vector */ /* n_prob ... length of probability vector */ /* */ /* return: */ /* pointer to generator object */ /* */ /* error: */ /* return NULL */ /*---------------------------------------------------------------------------*/ { struct unur_distr *distr; struct unur_par *par; struct unur_gen *igen; /* create generator */ distr = unur_distr_discr_new(); unur_distr_discr_set_pv(distr, prob, n_prob); par = unur_dgt_new(distr); igen = unur_init(par); /* clear working space */ unur_distr_free(distr); return igen; } /* end of _unur_mixt_indexgen() */ /*---------------------------------------------------------------------------*/ int _unur_mixt_get_boundary( struct unur_gen *gen ) /*---------------------------------------------------------------------------*/ /* compute boundary of mixture and check for overlapping domains. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... when everything is o.k. */ /* UNUR_NULL ... when a component is NULL (which should not happen) */ /* UNUR_ERR_GEN_INVALID .. if domains of components overlap or not ordered */ /*---------------------------------------------------------------------------*/ { int i; int overlap = FALSE; double comp_left, comp_right; double bd_left, bd_right; struct unur_gen *comp; /* initialize boundary values for mixture */ bd_left = UNUR_INFINITY; bd_right = -UNUR_INFINITY; for (i=0; iN_COMP; i++) { comp = gen->COMP[i]; /* comp has already been check. but we want to be on the safe side. */ CHECK_NULL(comp,UNUR_ERR_NULL); /* domain of component [i] */ switch (comp->method & UNUR_MASK_TYPE) { case UNUR_METH_CONT: comp_left = comp->distr->data.cont.BD_LEFT; comp_right = comp->distr->data.cont.BD_RIGHT; break; case UNUR_METH_DISCR: comp_left = (double) (comp->distr->data.discr.BD_LEFT); comp_right = (double) (comp->distr->data.discr.BD_RIGHT); break; default: /* cannot estimate boundary */ comp_left = -UNUR_INFINITY; comp_right = UNUR_INFINITY; } /* check for overlapping domains */ if ( _unur_FP_less(comp_left,bd_right) ) overlap = TRUE; /* update domain of mixture */ bd_left = _unur_min(bd_left, comp_left); bd_right = _unur_max(bd_right, comp_right); } /* overlap or unordered domains? */ if (GEN->is_inversion && overlap) { _unur_error(gen->genid,UNUR_ERR_GEN_INVALID,"domains of components overlap or are unsorted"); return UNUR_ERR_GEN_INVALID; } /* store boundary */ unur_distr_cont_set_domain(gen->distr, bd_left, bd_right); /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_mixt_get_boundary() */ /*****************************************************************************/ /** Debugging utilities **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ void _unur_mixt_debug_init( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write info about generator into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; struct unur_gen *comp; int i; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_MIXT_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: type = continuous univariate random variates\n",gen->genid); fprintf(LOG,"%s: method = MIXT (MIXTure of distributions -- meta method)\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); _unur_distr_cont_debug( gen->distr, gen->genid ); fprintf(LOG,"%s: sampling routine = _unur_mixt_sample",gen->genid); if (GEN->is_inversion) fprintf(LOG,"_inv"); fprintf(LOG,"()\n%s:\n",gen->genid); fprintf(LOG,"%s: use inversion = %s",gen->genid, (GEN->is_inversion) ? "on" : "off"); _unur_print_if_default(gen,MIXT_SET_USEINVERSION); fprintf(LOG,"\n%s:\n",gen->genid); /* probabilities */ fprintf(LOG,"%s: probabilities (%d) = \n",gen->genid, gen->N_COMP); fprintf(LOG,"%s: %g",gen->genid, (gen->PROB)[0]); for (i=1; iN_COMP; i++) fprintf(LOG,", %g", (gen->PROB)[i]); fprintf(LOG,"\n%s:\n",gen->genid); /* components */ fprintf(LOG,"%s: components (%d):\n",gen->genid, gen->N_COMP); for (i=0; iN_COMP; i++) { comp = gen->COMP[i]; fprintf(LOG,"%s: [%d]: %s\n",gen->genid, i, comp->genid); fprintf(LOG,"%s:\t type = ",gen->genid); switch (comp->distr->type) { case UNUR_DISTR_CONT: case UNUR_DISTR_CEMP: fprintf(LOG,"continuous\n"); break; case UNUR_DISTR_DISCR: fprintf(LOG,"discrete\n"); break; default: fprintf(LOG,"[unknown]\n"); } fprintf(LOG,"%s:\t name = %s\n",gen->genid, comp->distr->name); } fprintf(LOG,"%s:\n",gen->genid); } /* end of _unur_mixt_debug_init() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_INFO /*---------------------------------------------------------------------------*/ void _unur_mixt_info( struct unur_gen *gen, int help ) /*----------------------------------------------------------------------*/ /* create character string that contains information about the */ /* given generator object. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* help ... whether to print additional comments */ /*----------------------------------------------------------------------*/ { struct unur_string *info = gen->infostr; struct unur_gen *comp; int i; double sum; /* generator ID */ _unur_string_append(info,"generator ID: %s\n\n", gen->genid); /* distribution */ _unur_string_append(info,"distribution:\n"); _unur_distr_info_typename(gen); _unur_string_append(info," domain = (%g, %g)\n", DISTR.domain[0],DISTR.domain[1]); _unur_string_append(info," # components = %d\n", gen->N_COMP); if (help) { sum = ((struct unur_dgt_gen*)gen->INDEX->datap)->sum; _unur_string_append(info," probabilities = (%g", gen->PROB[0] / sum); for (i=1; iN_COMP; i++) _unur_string_append(info,", %g", gen->PROB[i] / sum); _unur_string_append(info,")\n"); _unur_string_append(info," components = \n"); for (i=0; iN_COMP; i++) { comp = gen->COMP[i]; _unur_string_append(info,"\t[%d] %s - ",i, comp->genid); switch (comp->distr->type) { case UNUR_DISTR_CONT: case UNUR_DISTR_CEMP: _unur_string_append(info,"continuous"); break; case UNUR_DISTR_DISCR: _unur_string_append(info,"discrete"); break; default: _unur_string_append(info,"[unknown]"); } _unur_string_append(info,": %s\n",comp->distr->name); } } _unur_string_append(info,"\n"); /* method */ _unur_string_append(info,"method: MIXT (MIXTure of distributions -- meta method)\n"); _unur_string_append(info," select component = method DGT\n"); _unur_string_append(info," inversion method = %s\n", (GEN->is_inversion) ? "TRUE" : "FALSE"); _unur_string_append(info,"\n"); /* performance */ _unur_string_append(info,"performance characteristics: depends on components\n"); _unur_string_append(info,"\n"); /* parameters */ if (help) { _unur_string_append(info,"parameters:\n"); _unur_string_append(info," useinversion = "); if (gen->variant & MIXT_VARFLAG_INVERSION) _unur_string_append(info,"on\n"); else _unur_string_append(info,"off [default]\n"); } } /* end of _unur_mixt_info() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_INFO */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/arou.h0000644001357500135600000002354214430377164013425 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: arou.h * * * * PURPOSE: * * function prototypes for method AROU * * (Adaptive Ratio-Of-Uniforms) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /* =METHOD AROU Automatic Ratio-Of-Uniforms method =UP Methods_for_CONT =REQUIRED T-concave PDF, dPDF =OPTIONAL mode =SPEED Set-up: slow, Sampling: fast =REINIT not implemented =REF [LJa00] =DESCRIPTION AROU is a variant of the ratio-of-uniforms method that uses the fact that the transformed region is convex for many distributions. It works for all T-concave distributions with T(x) = -1/sqrt(x). It is possible to use this method for correlation induction by setting an auxiliary uniform random number generator via the unur_set_urng_aux() call. (Notice that this must be done after a possible unur_set_urng() call.) When an auxiliary generator is used then the number of used uniform random numbers that is used up for one generated random variate is constant and equal to 1. There exists a test mode that verifies whether the conditions for the method are satisfied or not while sampling. It can be switched on by calling unur_arou_set_verify() and unur_arou_chg_verify(), respectively. Notice however that sampling is (much) slower then. For densities with modes not close to 0 it is suggested to set either the mode or the center of the distribution by the unur_distr_cont_set_mode() or unur_distr_cont_set_center() call. The latter is the approximate location of the mode or the mean of the distribution. This location provides some information about the main part of the PDF and is used to avoid numerical problems. =END */ /*---------------------------------------------------------------------------*/ /* Routines for user interface */ /* =ROUTINES */ UNUR_PAR *unur_arou_new( const UNUR_DISTR *distribution ); /* Get default parameters for generator. */ /*...........................................................................*/ int unur_arou_set_usedars( UNUR_PAR *parameters, int usedars ); /* If @var{usedars} is set to TRUE, ``derandomized adaptive rejection sampling'' (DARS) is used in setup. Segments where the area between hat and squeeze is too large compared to the average area between hat and squeeze over all intervals are split. This procedure is repeated until the ratio between area below squeeze and area below hat exceeds the bound given by unur_arou_set_max_sqhratio() call or the maximum number of segments is reached. Moreover, it also aborts when no more segments can be found for splitting. Segments are split such that the angle of the segments are halved (corresponds to arc-mean rule of method TDR (@pxref{TDR})). Default is TRUE. */ int unur_arou_set_darsfactor( UNUR_PAR *parameters, double factor ); /* Set factor for ``derandomized adaptive rejection sampling''. This factor is used to determine the segments that are ``too large'', that is, all segments where the area between squeeze and hat is larger than @var{factor} times the average area over all intervals between squeeze and hat. Notice that all segments are split when @var{factor} is set to @code{0.}, and that there is no splitting at all when @var{factor} is set to @code{UNUR_INFINITY}. Default is @code{0.99}. There is no need to change this parameter. */ int unur_arou_set_max_sqhratio( UNUR_PAR *parameters, double max_ratio ); /* Set upper bound for the ratio (area inside squeeze) / (area inside envelope). It must be a number between 0 and 1. When the ratio exceeds the given number no further construction points are inserted via adaptive rejection sampling. Use @code{0} if no construction points should be added after the setup. Use @code{1} if adding new construction points should not be stopped until the maximum number of construction points is reached. Default is @code{0.99}. */ double unur_arou_get_sqhratio( const UNUR_GEN *generator ); /* Get the current ratio (area inside squeeze) / (area inside envelope) for the generator. (In case of an error @code{UNUR_INFINITY} is returned.) */ double unur_arou_get_hatarea( const UNUR_GEN *generator ); /* Get the area below the hat for the generator. (In case of an error @code{UNUR_INFINITY} is returned.) */ double unur_arou_get_squeezearea( const UNUR_GEN *generator ); /* Get the area below the squeeze for the generator. (In case of an error @code{UNUR_INFINITY} is returned.) */ int unur_arou_set_max_segments( UNUR_PAR *parameters, int max_segs ); /* Set maximum number of segements. No construction points are added @emph{after} the setup when the number of segments succeeds @var{max_segs}. Default is @code{100}. */ int unur_arou_set_cpoints( UNUR_PAR *parameters, int n_stp, const double *stp ); /* Set construction points for enveloping polygon. If @var{stp} is NULL, then a heuristical rule of thumb is used to get @var{n_stp} construction points. This is the default behavior when this routine is not called. The (default) number of construction points is @code{30}, then. */ int unur_arou_set_usecenter( UNUR_PAR *parameters, int usecenter ); /* Use the center as construction point. Default is TRUE. */ int unur_arou_set_guidefactor( UNUR_PAR *parameters, double factor ); /* Set factor for relative size of the guide table for indexed search (see also method DGT @ref{DGT}). It must be greater than or equal to @code{0}. When set to @code{0}, then sequential search is used. Default is @code{2}. */ int unur_arou_set_verify( UNUR_PAR *parameters, int verify ); /* */ int unur_arou_chg_verify( UNUR_GEN *generator, int verify ); /* Turn verifying of algorithm while sampling on/off. If the condition squeeze(@i{x}) <= PDF(@i{x}) <= hat(@i{x}) is violated for some @i{x} then @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. However notice that this might happen due to round-off errors for a few values of @i{x} (less than 1%). Default is FALSE. */ int unur_arou_set_pedantic( UNUR_PAR *parameters, int pedantic ); /* Sometimes it might happen that unur_init() has been executed successfully. But when additional construction points are added by adaptive rejection sampling, the algorithm detects that the PDF is not T-concave. With @var{pedantic} being TRUE, the sampling routine is then exchanged by a routine that simply returns @code{UNUR_INFINITY}. Otherwise the new point is not added to the list of construction points. At least the hat function remains T-concave. Setting @var{pedantic} to FALSE allows sampling from a distribution which is ``almost'' T-concave and small errors are tolerated. However it might happen that the hat function cannot be improved significantly. When the hat function that has been constructed by the unur_init() call is extremely large then it might happen that the generation times are extremely high (even hours are possible in extremely rare cases). Default is FALSE. */ /* =END */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/nrou_struct.h0000644001357500135600000000714714420304141015031 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: nrou_struct.h * * * * PURPOSE: * * declares structures for method NROU * * (Naive Ratio-Of-Uniforms method) * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Information for constructing the generator */ struct unur_nrou_par { double umin, umax; /* u boundary for bounding rectangle */ double vmax; /* v boundary for bounding rectangle */ double center; /* center of distribution */ double r; /* r-parameter */ }; /*---------------------------------------------------------------------------*/ /* The generator object */ struct unur_nrou_gen { double umin, umax; /* u boundary for bounding rectangle */ double vmax; /* v boundary for bounding rectangle */ double center; /* center of distribution */ double r; /* r-parameter */ }; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/mvtdr_init.ch0000644001357500135600000022071514420445767015006 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: mvtdr_init.c * * * * TYPE: continuous multivariate random variate * * METHOD: multivariate transformed density rejection * * * * DESCRIPTION: * * Given (logarithm of the) PDF of a log-concave distribution; * * produce a value x consistent with its density. * * * ***************************************************************************** * * * Copyright (c) 2000-2007 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*****************************************************************************/ /** Private **/ /*****************************************************************************/ /*****************************************************************************/ /** Initialzation: Create Hat **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_mvtdr_init( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* initialize new generator */ /* */ /* parameters: */ /* par ... pointer to paramters for building generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ _unur_check_NULL( GENTYPE,par,NULL ); /* check input */ if ( par->method != UNUR_METH_MVTDR ) { _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); return NULL; } COOKIE_CHECK(par,CK_MVTDR_PAR,NULL); /* create a new empty generator object */ gen = _unur_mvtdr_create(par); /* free parameters */ _unur_par_free(par); /* check generator object */ if (!gen) return NULL; #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_mvtdr_debug_init_start(gen); #endif /* check data */ if (!(GEN->pdfcenter > 0.)) { _unur_error(gen->genid,UNUR_ERR_DISTR_DOMAIN,"center out of support of PDF"); _unur_mvtdr_free(gen); return NULL; } /* make hat function */ if(_unur_mvtdr_create_hat(gen) != UNUR_SUCCESS) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"cannot create hat"); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_mvtdr_debug_init_finished(gen, FALSE); #endif _unur_mvtdr_free(gen); return NULL; } /* compute upper bound for gamma variates */ _unur_mvtdr_max_gamma(gen); /* we need an auxiliary generator for gamma random variates */ GEN_GAMMA = _unur_mvtdr_gammagen( gen, (double)(GEN->dim) ); if ( GEN_GAMMA == NULL ) { _unur_mvtdr_free(gen); return NULL; } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_mvtdr_debug_init_finished(gen, TRUE); #endif /* o.k. */ return gen; } /* end of _unur_mvtdr_init() */ /*---------------------------------------------------------------------------*/ static struct unur_gen * _unur_mvtdr_create( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* allocate memory for generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* pointer to (empty) generator object with default settings */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_MVTDR_PAR,NULL); /* create new generic generator object */ gen = _unur_generic_create( par, sizeof(struct unur_mvtdr_gen) ); /* magic cookies */ COOKIE_SET(gen,CK_MVTDR_GEN); /* dimension of distribution */ GEN->dim = gen->distr->dim; /* set generator identifier */ gen->genid = _unur_set_genid(GENTYPE); /* routines for sampling and destroying generator */ SAMPLE = _unur_mvtdr_sample_cvec; gen->destroy = _unur_mvtdr_free; gen->clone = _unur_mvtdr_clone; /* initialize counter and check given parameters */ GEN->n_steps = 0; /* no triangulation steps yet */ GEN->steps_min = _unur_max( 0, PAR->steps_min ); /* minimum number of triangulation steps */ /* check maximal number of cones */ if ( (1 << (GEN->dim + GEN->steps_min)) > PAR->max_cones) { /* WARNING( "number of cones raised to 2^(dim + T_STEPS_MIN)" ); */ PAR->max_cones = 1 << (GEN->dim + GEN->steps_min); } GEN->max_gamma = UNUR_INFINITY; /* upper bound for gamma variaties */ /* initialize pointers to lists */ GEN->cone = NULL; GEN->last_cone = NULL; GEN->n_cone = 0; /* number cones */ GEN->max_cones = PAR->max_cones; /* maximum number of cones */ GEN->bound_splitting = PAR->bound_splitting; /* bound for splitting cones */ GEN->vertex = NULL; GEN->last_vertex = NULL; GEN->n_vertex = 0; /* maximum number of vertices */ GEN->etable = NULL; /* pointer to edge table */ GEN->etable_size = 0; /* size of edge table */ GEN->guide = NULL; GEN->guide_size = 0; /* initialize working arrays: */ /* point on simples */ GEN->S = malloc( GEN->dim * sizeof(double) ); /* vector g (direction of sweeping plane) */ GEN->g = malloc( GEN->dim * sizeof(double) ); /* coordinates of touching point of hat */ GEN->tp_coord = malloc( GEN->dim * sizeof(double) ); /* coordinates of touching point of hat moved into center */ GEN->tp_mcoord = malloc( GEN->dim * sizeof(double) ); /* gradient of transformed density at tp */ GEN->tp_Tgrad = malloc( GEN->dim * sizeof(double) ); if (GEN->S==NULL || GEN->g==NULL || GEN->tp_coord==NULL || GEN->tp_mcoord==NULL || GEN->tp_Tgrad==NULL) { _unur_error(gen->genid,UNUR_ERR_MALLOC,""); _unur_mvtdr_free(gen); return NULL; } /* get center of the distribution and its PDF */ GEN->center = unur_distr_cvec_get_center(gen->distr); GEN->pdfcenter = PDF(GEN->center); /* whether we have set a domain for the distribution */ GEN->has_domain = (gen->distr->set & UNUR_DISTR_SET_DOMAIN) ? TRUE : FALSE; #ifdef UNUR_ENABLE_INFO /* set function for creating info string */ gen->info = _unur_mvtdr_info; #endif /* return pointer to (almost empty) generator object */ return gen; } /* end of _unur_mvtdr_create() */ /*****************************************************************************/ struct unur_gen * _unur_mvtdr_clone( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* copy (clone) generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to clone of generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { #define CLONE ((struct unur_mvtdr_gen*)clone->datap) struct unur_gen *clone; int error = FALSE; size_t size; VERTEX *vt, **vtindex; CONE *c; /* check arguments */ CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_MVTDR_GEN,NULL); /* create generic clone */ clone = _unur_generic_clone( gen, GENTYPE ); /* copy data */ CLONE->center = unur_distr_cvec_get_center(clone->distr); /* working arrays */ size = GEN->dim * sizeof(double); CLONE->S = malloc(size); CLONE->g = malloc(size); CLONE->tp_coord = malloc(size); CLONE->tp_mcoord = malloc(size); CLONE->tp_Tgrad = malloc(size); vtindex = malloc(GEN->n_vertex * sizeof (VERTEX *)); if (CLONE->S==NULL || CLONE->g==NULL || CLONE->tp_coord==NULL || CLONE->tp_mcoord==NULL || CLONE->tp_Tgrad==NULL || vtindex==NULL) { _unur_error(gen->genid,UNUR_ERR_MALLOC,""); if (vtindex) free (vtindex); _unur_mvtdr_free(clone); return NULL; } /* copy data */ if (GEN->S) memcpy( CLONE->S, GEN->S, size ); if (GEN->g) memcpy( CLONE->g, GEN->g, size ); if (GEN->tp_coord) memcpy( CLONE->tp_coord, GEN->tp_coord, size ); if (GEN->tp_mcoord) memcpy( CLONE->tp_mcoord, GEN->tp_mcoord, size ); if (GEN->tp_Tgrad) memcpy( CLONE->tp_Tgrad, GEN->tp_Tgrad, size ); /* clear lists in clone */ CLONE->vertex = NULL; CLONE->n_vertex = 0; CLONE->cone = NULL; CLONE->n_cone = 0; CLONE->guide = NULL; /* copy list of vertices */ for (vt = GEN->vertex; vt != NULL; vt = vt->next) { VERTEX *vtc = _unur_mvtdr_vertex_new( clone ); if (vtc == NULL) { error = TRUE; break; } memcpy(vtc->coord, vt->coord, size); vtc->index = vt->index; vtindex[vt->index] = vtc; } /* copy list of cones */ for (c = GEN->cone; c != NULL && !error; c = c->next) { CONE *cc, *cc_next; VERTEX **v; double *center, *gv; int i; cc = _unur_mvtdr_cone_new( clone ); if (cc == NULL) { error = TRUE; break; } cc_next = cc->next; center = cc->center; gv = cc->gv; v = cc->v; memcpy(cc,c,sizeof(CONE)); memcpy(center, c->center, size); memcpy(gv, c->gv, size); for (i=0; idim; i++) v[i] = vtindex[(c->v[i])->index]; cc->next = cc_next; cc->center = center; cc->gv = gv; cc->v = v; } /* make new guide table */ if (_unur_mvtdr_make_guide_table(clone) != UNUR_SUCCESS) error = TRUE; /* clear auxiliary array */ free (vtindex); if (error == TRUE) { _unur_mvtdr_free(clone); return NULL; } return clone; #undef CLONE } /* end of _unur_mvtdr_clone() */ /*****************************************************************************/ void _unur_mvtdr_free( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* deallocate generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { VERTEX *vt, *vt_next; CONE *c, *c_next; /* check arguments */ if( !gen ) /* nothing to do */ return; /* check input */ if ( gen->method != UNUR_METH_MVTDR ) { _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); return; } COOKIE_CHECK(gen,CK_MVTDR_GEN,RETURN_VOID); /* we cannot use this generator object any more */ SAMPLE = NULL; /* make sure to show up a programming error */ /* clear lists: */ /* hash table for edges */ _unur_mvtdr_etable_free(gen); /* linked list of vertices */ for (vt = GEN->vertex; vt != NULL; vt = vt_next) { vt_next = vt->next; free (vt->coord); /* coordinates of vertex */ free (vt); } /* linked list of cones */ for (c = GEN->cone; c != NULL; c = c_next) { c_next = c->next; free (c->v); /* list of vertices of the cone */ free (c->center); /* barycenter of cone */ free (c->gv); /* for all vertices v */ free (c); } /* guide table */ if (GEN->guide) free (GEN->guide); /* working arrays */ if (GEN->S) free (GEN->S); if (GEN->g) free (GEN->g); if (GEN->tp_coord) free (GEN->tp_coord); if (GEN->tp_mcoord) free (GEN->tp_mcoord); if (GEN->tp_Tgrad) free (GEN->tp_Tgrad); _unur_generic_free(gen); } /* end of _unur_mvtdr_free() */ /*****************************************************************************/ struct unur_gen * _unur_mvtdr_gammagen( struct unur_gen *gen, double alpha ) /*----------------------------------------------------------------------*/ /* create a gamma random variate generator with shape parameter alpha. */ /* */ /* parameters: */ /* gen ... pointer to MVTDR generator object */ /* alpha ... shape parameter */ /* */ /* return: */ /* pointer to generator object */ /*----------------------------------------------------------------------*/ { struct unur_distr *gammadistr; struct unur_par *gammapar; struct unur_gen *gammagen; double shape; /* make generator object */ shape = alpha; gammadistr = unur_distr_gamma(&shape,1); if (_unur_isfinite(GEN->max_gamma)) { unur_distr_cont_set_domain(gammadistr,0.,GEN->max_gamma); } gammapar = unur_tdr_new( gammadistr ); unur_tdr_set_usedars( gammapar, TRUE ); unur_tdr_set_max_sqhratio( gammapar, MVTDR_TDR_SQH_RATIO); if (! GEN->has_domain) { /* we do not need a truncated gamma distribution. */ /* hence we can use immediate acceptance. */ unur_tdr_set_variant_ia( gammapar ); } gammagen = unur_init( gammapar ); _unur_distr_free( gammadistr ); /* check result */ if (gammagen == NULL) { _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN, "Cannot create aux Gamma generator"); return NULL; } /* uniform random number generator and debugging flags */ gammagen->urng = gen->urng; gammagen->debug = gen->debug; return gammagen; } /* end of _unur_mvtdr_gammagen() */ /*****************************************************************************/ /* */ /* Hat. */ /* */ /*****************************************************************************/ int _unur_mvtdr_create_hat( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* create hat function. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int step; /* triangulation steps */ double Hi_bound; /* lower bound on Hi for splitting cone */ CONE *c; int n_splitted; /* vertices of initial cones */ if( _unur_mvtdr_initial_vertices(gen) != UNUR_SUCCESS ) return UNUR_FAILURE; /* initial cones */ if( _unur_mvtdr_initial_cones(gen) != UNUR_SUCCESS ) return UNUR_FAILURE; /* execute minimal number of triangulation steps */ for( step = 1; step <= GEN->steps_min; step++ ) { if (_unur_mvtdr_triangulate(gen,step,TRUE) < 0) return UNUR_FAILURE; } /* compute optimal distance of touching points and volume Hi */ for( c = GEN->cone; c != NULL; c = c->next ) _unur_mvtdr_tp_find (gen,c); /* cones with invalid hats (or too large volumes) must be split */ while( _unur_mvtdr_triangulate(gen,step,FALSE) > 0 ) { if (GEN->n_cone > GEN->max_cones) return UNUR_FAILURE; step++; } /* maximum number of triangulations yet */ GEN->n_steps = step-1; /* compute cumulated volumes in all cones */ GEN->Htot = 0.; /* accumulated sum of volumes */ for( c=GEN->cone; c!=NULL; c=c->next ) { /* volume below hat */ GEN->Htot += c->Hi; /* volume below hat */ c->Hsum = GEN->Htot; /* accumulated sum of volumes */ } /* split until stopping criterion in reached */ while (1) { /* bound for splitting cones */ /* do until all cones have approx same hat volumes */ Hi_bound = GEN->bound_splitting * GEN->Htot / GEN->n_cone; /* and now check all the cones again */ GEN->Htot = 0.; n_splitted = 0; for( c=GEN->cone; c!=NULL; c=c->next ) { /* all cones */ while( Hi_bound < c->Hi && GEN->n_cone < GEN->max_cones ) { /* we (must) split the cone again */ if (_unur_mvtdr_cone_split(gen,c,c->level+1) != UNUR_SUCCESS) return UNUR_FAILURE; ++n_splitted; /* and compute optimal touching point */ _unur_mvtdr_tp_find (gen,c); _unur_mvtdr_tp_find (gen,GEN->last_cone); } GEN->Htot += c->Hi; /* volume below hat */ c->Hsum = GEN->Htot; /* accumulated sum of volumes */ if( c == GEN->last_cone ) break; } /* stop when maximal number of cones is reached or no cones are split */ if (!n_splitted || GEN->n_cone >= GEN->max_cones) break; } /* create guide table for finding cones */ if (_unur_mvtdr_make_guide_table(gen) != UNUR_SUCCESS) return UNUR_FAILURE; /* we do not need the hash table generated in triangulate() cone any more */ if (GEN->dim > 2) _unur_mvtdr_etable_free(gen); return UNUR_SUCCESS; } /* end of _unur_mvtdr_create_hat() */ /*****************************************************************************/ /* */ /* CONES. */ /* */ /*****************************************************************************/ int _unur_mvtdr_initial_cones( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* get initial cones */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int i,j,k; CONE *c; int max_c; /* maximum number of cones */ VERTEX *vt; VERTEX **ivtl; /* list of initial vertices */ int dim = GEN->dim; int error = FALSE; int have_negative_index = FALSE; int cone_out_of_domain; /* make array of initial vertices */ ivtl = malloc(2 * dim * sizeof(VERTEX*)); if( ivtl==NULL ) { _unur_error(gen->genid,UNUR_ERR_MALLOC,""); return UNUR_ERR_MALLOC; } for (vt = GEN->vertex, i=0; i < 2*GEN->dim && vt!=NULL; vt = vt->next, i++) { if (vt->index<0) have_negative_index = TRUE; ivtl[i] = vt; } /* we have (at most) 2^dim initial cones */ max_c = 1 << dim; /* we need vertices, index, volume for each cone */ for( k=0; k>i)&1) && ivtl[i]->index < 0) || ( ((k>>i)&1) && ivtl[i+dim]->index < 0) ) { cone_out_of_domain = TRUE; break; } } if (cone_out_of_domain) /* cone is not inside domain --> skip */ continue; } /* get new (empty) cone object */ c = _unur_mvtdr_cone_new(gen); if (c==NULL) { error = TRUE; break; } /* this is level 0 of triangulation */ c->level = 0; /* each cone is incident to 'dim' edges. */ /* The i-th edge of the cone is either GEN->v[i] or GEN->v[dim+i], */ /* (the latter is equal to (-1)*(GEN->v[i])). */ /* The indices of the vertices must be in ascending order. */ j = 0; for( i=0; i < dim; i++ ) if (!((k>>i)&1)) (c->v)[j++] = ivtl[i]; for( i=0; i < dim && j < dim; i++ ) if ( ((k>>i)&1)) (c->v)[j++] = ivtl[i + dim]; /* determinant and volume of triangle * ((dim-1)!) */ c->logdetf = 0.; /* touching point not known yet */ c->tp = -1.; /* > 0. if and only if tp is computed !! */ } /* free list of initial vertices */ free (ivtl); if (error==TRUE) return UNUR_ERR_MALLOC; /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_mvtdr_initial_cones() */ /*---------------------------------------------------------------------------*/ CONE * _unur_mvtdr_cone_new( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* allocate new cone and append it to linked list of all cones. */ /* increment counter for cones. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to newly allocated cone */ /*----------------------------------------------------------------------*/ { CONE *c; /* allocate memory */ c = malloc(sizeof(CONE)); if (c==NULL) { _unur_error(gen->genid,UNUR_ERR_MALLOC,""); return NULL; } /* insert into list of cones */ if (GEN->cone == NULL) GEN->last_cone = GEN->cone = c; else GEN->last_cone = GEN->last_cone->next = c; c->next = NULL; /* list of vertices of the cone */ c->v = malloc( GEN->dim * sizeof(VERTEX *)); /* barycenter of cone */ c->center = malloc( GEN->dim * sizeof(double)); /* for all vertices v */ c->gv = malloc( GEN->dim * sizeof(double)); if (c->v==NULL || c->center==NULL || c->gv==NULL) { _unur_error(gen->genid,UNUR_ERR_MALLOC,""); return NULL; } /* the cone is unbounded when created */ c->height = UNUR_INFINITY; /* mark as invalid */ c->tp = -1.; c->Hi = UNUR_INFINITY; /* and update counter */ ++(GEN->n_cone); /* return pointer to next vertex */ return c; } /* end of _unur_mvtdr_cone_new() */ /*---------------------------------------------------------------------------*/ int _unur_mvtdr_cone_center( struct unur_gen *gen, CONE *c ) /*----------------------------------------------------------------------*/ /* computer center of cone and normalize the corresponding vector */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* c ... cone for which center has to be computed */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int i,k; double norm; int dim = GEN->dim; /* compute sum of all vertices and square of its norm */ norm = 0.; for( i=0; icenter[i] = 0.; for( k=0; kcenter[i] += (c->v[k])->coord[i]; /* dim * barycenter */ norm += c->center[i] * c->center[i]; /* norm ^2 */ } /* norm --> 1 */ norm = sqrt(norm); for( i=0; icenter[i] /= norm; return UNUR_SUCCESS; } /* end of _unur_mvtdr_cone_center() */ /*---------------------------------------------------------------------------*/ int _unur_mvtdr_cone_params( struct unur_gen *gen, CONE *c ) /*----------------------------------------------------------------------*/ /* compute parameters for hat for a cone */ /* (expect touching point and volume below hat) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* c ... cone for which parameters have to be computed */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { double Tf,f; /* (transformed) density */ double Tderf; /* T'(f(x)) */ int i; /* aux variable */ int dim = GEN->dim; /* dimension */ double *g = GEN->g; /* Vector g (direction of sweeping plane) */ double *coord = GEN->tp_coord; /* coordinates of touching point */ double *mcoord = GEN->tp_mcoord; /* coordinates of touching point moved into center */ double *Tgrad = GEN->tp_Tgrad; /* gradient of transformed density */ /* we consider values for the PDF and of derivated numbers that are too small as equal 0: */ double tolerance = TOLERANCE * GEN->pdfcenter / dim; /* coordinates of touching point */ for( i=0; itp * c->center[i]; mcoord[i] = coord[i] + GEN->center[i]; } /* density at construction point */ if( DISTR.logpdf != NULL ) { c->Tfp = Tf = logPDF(mcoord); if (! _unur_isfinite(Tf)) return UNUR_ERR_DISTR_DOMAIN; } else { f = PDF(mcoord); /* check density */ if( f < tolerance ) /* assume f = 0. */ return UNUR_ERR_DISTR_DOMAIN; /* transformed density */ c->Tfp = Tf = T(f); } /* gradient of logPDF */ if( DISTR.dlogpdf != NULL ) { /* gradient of logPDF available */ dlogPDF(Tgrad,mcoord); } else { /* grad( T(f(x) ) = T'(f(x)) * grad(f(x)) */ dPDF(Tgrad,mcoord); Tderf = T_deriv(exp(Tf)); for( i=0; ialpha = Tf - _unur_vector_scalar_product(dim,Tgrad,coord); c->beta = _unur_vector_norm(dim,Tgrad); /* |Tgrad| must not be too small */ if( c->beta < tolerance ) return UNUR_FAILURE; /* vector g = - grad(T(f)) / |grad(T(f))| */ for( i=0; ibeta; /* for each vertex v of cone and */ /* parameter a1 for volume of cone */ c->logai = c->logdetf; for( i=0; igv[i] = _unur_vector_scalar_product(dim,g,(c->v[i])->coord); /* */ if( c->gv[i] < tolerance ) /* too small: would result in severe numerical errors */ return UNUR_FAILURE; else c->logai -= log(c->gv[i]); } /* this is expensive for calculation for every touching point !!! */ /* Maybe we only perform this computation when at the very end */ /* and use height=UNUR_INFINITY for finding construction points. */ if (_unur_mvtdr_cone_height(gen,c) != UNUR_SUCCESS) return UNUR_FAILURE; /* return error code */ return UNUR_SUCCESS; } /* end of _unur_mvtdr_cone_params() */ /*---------------------------------------------------------------------------*/ double _unur_mvtdr_cone_logH( struct unur_gen *gen, CONE *c ) /*----------------------------------------------------------------------*/ /* calculate log of volume below hat for given touching point. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* c ... cone for which volume below hat has to be computed */ /* */ /* return: */ /* success ... logarithm of volume below hat */ /* PDF(tp)==0 ... -UNUR_INFINITY */ /* error(hat unbounded?) ... +UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { double logH; /* compute parameters for cone */ switch ( _unur_mvtdr_cone_params(gen,c) ) { case UNUR_SUCCESS: break; case UNUR_ERR_DISTR_DOMAIN: /* construction point out of support */ return -UNUR_INFINITY; default: /* something is wrong: beta = 0 and/or <= 0 */ return UNUR_INFINITY; } /* compute log of volume below hat */ logH = c->alpha - GEN->dim * log(c->beta) + c->logai; if (_unur_isfinite(c->height)) { /* there is a change to the paper, eq.(15): */ /* 'logai' does not contain '(dim-1)!' . */ /* thus we have to modify eq.(31) accordingly. */ /* Remark: this is a rather expensive computation. */ /* It could be omitted if 'c->beta*c->height' is */ /* large (not too small). */ if (c->height < 1.e-50) return -UNUR_INFINITY; else logH += log(_unur_SF_incomplete_gamma(c->beta*c->height,(double)GEN->dim)); } /* check for numerical errors (alpha or beta too small) */ return (_unur_isfinite(logH)) ? logH : UNUR_INFINITY; } /* end of _unur_mvtdr_cone_logH() */ /*---------------------------------------------------------------------------*/ int _unur_mvtdr_cone_split( struct unur_gen *gen, CONE *c, int step ) /*----------------------------------------------------------------------*/ /* split a cone along "oldest" edge */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* c ... cone which has to be split */ /* step ... triangulation level */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { CONE *newc; /* new cone */ VERTEX *newv; /* new vertex */ int dim = GEN->dim; /* dimension */ int i; if (dim == 2) /* there is only one edge in this cone */ newv = _unur_mvtdr_vertex_on_edge(gen,c->v); else /* find "oldest" edge, read center of edge from table (or computer) */ newv = _unur_mvtdr_etable_find_or_insert(gen,c->v); if (newv==NULL) return UNUR_FAILURE; /* construct two new cones */ /* first cone */ newc = _unur_mvtdr_cone_new(gen); /* new cone */ if (newc==NULL) return UNUR_ERR_MALLOC; newc->level = step; /* triangulation level */ for (i=0; iv[i] = c->v[i+1]; /* copy list of vertices to new cone */ newc->v[dim-1] = newv; /* add new vertex */ newc->logdetf = c->logdetf - log(2.*newv->norm); /* log of det of spanning vectors */ newc->tp = c->tp; /* distance of touching point remains unchanged */ /* second cone */ c->level = step; /* triangulation level */ for (i=0; iv[i+1] = c->v[i+2]; /* shift list of vertices */ (c->v)[dim-1] = newv; /* add new vertex */ c->logdetf = newc->logdetf; /* the determinant */ /* store maximal triangulation level for debugging */ GEN->n_steps = _unur_max(GEN->n_steps, step); return UNUR_SUCCESS; } /* end of _unur_mvtdr_cone_split() */ /*---------------------------------------------------------------------------*/ int _unur_mvtdr_triangulate( struct unur_gen *gen, int step, int all ) /*----------------------------------------------------------------------*/ /* make one triangulation step */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* step ... level of triangulation steps */ /* all ... whether all (TRUE) cones have to be split */ /* or only those cones where volumes are too big */ /* */ /* return: */ /* number of new cones */ /* -1 in case of error */ /*----------------------------------------------------------------------*/ { int k,nc; CONE *c; int dim = GEN->dim; /* dimension */ if (dim > 2) { /* We need a hash table for storing the edges. */ /* size of table = maximum number of vertices in current triangulation cycle. */ /* only required at begining of new tiangulation iteration, i.e. step = dim-1. */ /* length of cycle dim-1. */ /* only necessary if dim > 2 */ if( step % (dim-1) == 1 ) if( _unur_mvtdr_etable_new(gen, _unur_mvtdr_number_vertices(gen, (step/(dim-1)+1)*(dim-1) )) != UNUR_SUCCESS ) return -1; } /* number of cones before triangulation */ nc = GEN->n_cone; /* triangulate every cone */ for( k=0, c=GEN->cone; ktp < 0. ) { if (_unur_mvtdr_cone_split(gen,c,step) != UNUR_SUCCESS) return -1; _unur_mvtdr_tp_find (gen,c); _unur_mvtdr_tp_find (gen,GEN->last_cone); } /* next cone */ c = c->next; } /* return number of new cones */ return (GEN->n_cone - nc); } /* end of _unur_mvtdr_triangulate() */ /*---------------------------------------------------------------------------*/ int _unur_mvtdr_cone_height( struct unur_gen *gen, CONE *c ) /*----------------------------------------------------------------------*/ /* calculate height of pyramid (cone) using simplex algorithm */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* c ... cone for which we compute height */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* working array for simplex tableau: double A[N+1][N+1]; */ #define A(i,j) (AA[(dim+1)*(i)+(j)]) double *AA; int dim = GEN->dim; /* coordinates of lower left and upper right vertices of domain */ #define ll(i) (domain[2*(i)] - GEN->center[(i)]) #define ur(i) (domain[2*(i)+1] - GEN->center[(i)]) double *domain; int i,j,row,ipc,ipr; double pc,pr,ratio; double sgn; /* bounded domain ? */ if (! GEN->has_domain) /* nothing to do (c->height is set to INIFINITY at creating time) */ return UNUR_SUCCESS; /* get rectangular domain */ if (DISTR.domainrect == NULL) { _unur_error(gen->genid,UNUR_ERR_DISTR_DOMAIN,"no domain given"); return UNUR_ERR_DISTR_DOMAIN; } domain = DISTR.domainrect; /* allocate memory for simplex tableau */ AA = _unur_xmalloc( (dim+1)*(dim+1)*sizeof(double) ); /* set initial matrix for simplex algorithm */ for( i=0, row=0; iv[j])->coord[i] > 0. ) { sgn = +1.; break; } if( (c->v[j])->coord[i] < 0. ) { sgn = -1.; break; } } /* check sign */ if (_unur_iszero(sgn)) continue; /* coefficients of inequalities */ for( j=0; jv[j])->coord[i]; A(row,dim) = (sgn > 0.) ? ur(i) : -(ll(i)); row++; } /* objective function */ for( j=0; jgv[j]); A(row,dim) = 0.; /* find maximum */ while( 1 ) { /* pivot column */ for( j=0,pc=0.,ipc=-1; jheight = A(row,dim); break; } /* find pivot row */ for( i=0,pr=-1.,ipr=-1; i ratio ) { ipr = i; pr = ratio; } } /* unbounded ? */ if( ipr == -1 ) { c->height = UNUR_INFINITY; break; } /* make pivot step */ /* the rest */ for( i=0; i<=row; i++ ) if( i!= ipr ) for( j=0; jheight)) c->height = UNUR_INFINITY; /* o.k. */ return UNUR_SUCCESS; #undef A #undef ll #undef ur } /* end of _unur_mvtdr_cone_height() */ /*---------------------------------------------------------------------------*/ int _unur_mvtdr_max_gamma( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* compute upper bound for gamma variates */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { double max, tmp; CONE *c; if (!GEN->has_domain) { GEN->max_gamma = UNUR_INFINITY; } else { max = 0.; for (c = GEN->cone; c != NULL; c = c->next) { tmp = c->height * c->beta; max = _unur_max(max, tmp); } GEN->max_gamma = (max > 0.) ? max : UNUR_INFINITY; } return UNUR_SUCCESS; } /* end of _unur_mvtdr_max_gamma() */ /*****************************************************************************/ /* */ /* Optimal distance for touching points */ /* */ /*****************************************************************************/ double _unur_mvtdr_tp_min (double t, void *p ) /*----------------------------------------------------------------------*/ /* volume function. */ /* */ /* parameters: */ /* t ... location of touching point */ /* p ... pointer to arguments of volume functions */ /* */ /* return: */ /* logarithm of the volume below the hat */ /*----------------------------------------------------------------------*/ { /* unpack arguments */ TP_ARG *a = p; /* set new construction point for hat */ (a->c)->tp = a->t = t; /* compute volume below hat in cone and return result */ a->logH = _unur_mvtdr_cone_logH (a->gen, a->c); /* status of result */ switch (_unur_isinf(a->logH)) { case -1: a->logH = UNUR_INFINITY; a->status = MVTDR_CONE_DOMAIN; break; case 1: a->status = MVTDR_CONE_INVALID; break; case 0: default: a->status = MVTDR_CONE_OK; } if( a->status != MVTDR_CONE_OK ) /* we mark this case by setting tp = -1 */ (a->c)->tp = -1.; return a->logH; } /* end of _unur_mvtdr_tp_min() */ /*---------------------------------------------------------------------------*/ double _unur_mvtdr_tp_min_aux(double t, void *p) /*----------------------------------------------------------------------*/ /* auxiliary function to be used with _unur_util_brent(). */ /* _unur_util_brent() maximizes functions, so we need the negative */ /* of the volume function. */ /* */ /* parameters: */ /* t ... location of touching point */ /* p ... pointer to arguments of volume functions */ /* */ /* return: */ /* negative of logarithm of the volume below the hat */ /*----------------------------------------------------------------------*/ { return (- _unur_mvtdr_tp_min(t, p) ); } /*---------------------------------------------------------------------------*/ int _unur_mvtdr_tp_find( struct unur_gen *gen, CONE *c ) /*----------------------------------------------------------------------*/ /* find optimal touching point for cone using Brent's method */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* c ... cone for which touching point has to be computed */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { struct unur_funct_generic tpaux; TP_ARG a[3]; /* left, middle and right point of bracket for Brent algorithm */ int i; /* compute center */ _unur_mvtdr_cone_center(gen,c); /* pack arguments for finding minimum */ for (i=0; i<3; i++) { a[i].c = c; a[i].gen = gen; } /* find proper touching point */ switch (_unur_mvtdr_tp_search(gen,a)) { case UNUR_SUCCESS: break; case UNUR_ERR_DISTR_DOMAIN: /* cone not in support of PDF */ c->tp = 0.; c->Hi = 0.; c->height = 0.; return UNUR_ERR_DISTR_DOMAIN; case UNUR_FAILURE: default: /* no proper point found */ return UNUR_FAILURE; } /* find "bracket" for Brent's algorithm */ switch( _unur_mvtdr_tp_bracket(gen,a) ) { /* searching for intervall that contains minimum */ case TP_BRACKET: /* bracket found */ /* make auxiliary function for Brent's algorithms */ tpaux.f = _unur_mvtdr_tp_min_aux; tpaux.params = a+1; c->tp = _unur_util_brent( tpaux, a[0].t, a[2].t, a[1].t, FIND_TP_TOL); c->Hi = exp(a[1].logH); break; /* c->tp already set by tp_min() */ case TP_LEFT: /* minimum in left point */ c->tp = a[0].t; c->Hi = exp(a[0].logH); break; case TP_MIDDLE: /* minimum in middle point */ _unur_mvtdr_tp_min(a[1].t, a+1); /* calculate volume function */ c->Hi = exp(a[1].logH); break; case TP_RIGHT: /* minimum in right point */ c->tp = a[2].t; c->Hi = exp(a[2].logH); break; default: /* no proper touching point found */ c->tp = -1.; return UNUR_FAILURE; } return UNUR_SUCCESS; } /* end of _unur_mvtdr_tp_find() */ /*---------------------------------------------------------------------------*/ int _unur_mvtdr_tp_search( struct unur_gen *gen ATTRIBUTE__UNUSED, TP_ARG *a ) /*----------------------------------------------------------------------*/ /* search for proper touching point. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* a ... arguments for function that should be minimized */ /* a[0], a[1], a[2] ... left, middle and right point of */ /* bracket used for Brent's algorithm, */ /* see _unur_util_brent(). */ /* the result is stored in a[1]. */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { #define N_STEPS (10) /* max number of steps for finding proper touching point */ int i; /* aux counter */ int is_unbounded_cone = FALSE; /* boolean */ double start = 1.; /* starting point for search routine */ /** search from 0 --> 1 (towards infinity) **/ /* initialize boundary of intervall */ a[0].t = 0.; /* x[0] must >= 0. */ a[1].t = start; /* starting point for searching proper touching point */ a[2].t = -1.; /* not known. marked by setting to -1. */ for( i=1; i <= N_STEPS; i++ ) { _unur_mvtdr_tp_min(a[1].t, a+1); /* calculate volume function */ if (a[1].status == MVTDR_CONE_OK) { return UNUR_SUCCESS; } else if (a[1].status == MVTDR_CONE_DOMAIN) { /* touching point out of domain */ break; } else { /* not a proper touching point */ is_unbounded_cone = TRUE; a[0].t = a[1].t; a[1].t *= 2.; } } /** search from 1 --> 0 **/ /* initialize boundary of intervall */ a[0].t = 0.; /* x[0] must >= 0. */ a[1].t = start/2.; /* starting point for searching proper touching point */ a[2].t = 1.; /* t[2] must >= t[1]. */ for( i=0;; i++ ) { _unur_mvtdr_tp_min(a[1].t, a+1); /* calculate volume function */ if (a[1].status == MVTDR_CONE_OK) { return UNUR_SUCCESS; } else if (a[1].status == MVTDR_CONE_DOMAIN) { /* touching point out of domain */ if (a[1].t < 1.e-20 ) { /* the bound 1.e-20 is rather arbirary */ return (is_unbounded_cone) ? UNUR_FAILURE : UNUR_ERR_DISTR_DOMAIN; } a[2].t = a[1].t; a[1].t /= 10.; } else { if (i > N_STEPS) { /* no proper touching point found */ /* --> giving up and split cone before next try */ return UNUR_FAILURE; } is_unbounded_cone = TRUE; a[2].t = a[1].t; a[1].t /= 2.; } } /* no proper touching point found */ /* return UNUR_FAILURE; */ #undef N_STEPS } /* end of _unur_mvtdr_tp_search() */ /*-----------------------------------------------------------------*/ int _unur_mvtdr_tp_bracket( struct unur_gen *gen ATTRIBUTE__UNUSED, TP_ARG *a ) /*----------------------------------------------------------------------*/ /* search for proper bracket for Brent's algorithm */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* a ... arguments for function that should be minimized */ /* a[0], a[1], a[2] ... left, middle and right point of */ /* bracket used for Brent's algorithm, */ /* see _unur_util_brent(). */ /* */ /* return: */ /* TP_LEFT ... minimum in left point */ /* TP_MIDDLE ... use middle point */ /* TP_RIGHT ... minimum in right point */ /* TP_BRACKET ... bracket found */ /*----------------------------------------------------------------------*/ { #define N_STEPS (10) /* max number of steps for finding bracket */ int i; /* aux variable */ double tleft, tright; /* left boundary of searching region */ /** left point of intervall **/ /* initialize boundary of searching region and set starting point */ tleft = a[0].t; a[0].t = a[1].t / 2.; /* search */ for( i=1; i <= _unur_max(1,N_STEPS); i++ ) { _unur_mvtdr_tp_min(a[0].t, a); /* volume function */ if( a[0].status != MVTDR_CONE_OK ) { /* a[0] not a proper touching point */ tleft = a[0].t; /* change boundary of searching region */ a[0].t += (a[1].t - a[0].t) / 2.; /* try another one */ } else if( a[0].logH <= a[1].logH ) { /* a[0] is proper touching point, but ... */ a[2].t = a[1].t; a[2].logH = a[1].logH; a[2].status = MVTDR_CONE_OK; a[1].t = a[0].t; a[1].logH = a[0].logH; a[1].status = MVTDR_CONE_OK; a[0].t = tleft + (a[0].t - tleft)*0.5; } else /* all right: a[0].logH > a[1].logH */ break; } /* search successful ? */ if( a[0].status != MVTDR_CONE_OK ) /* no proper touching point on left side --> use middle point */ return TP_MIDDLE; if( a[0].logH <= a[1].logH ) /* vol(left) <= vol(middle) */ return TP_LEFT; /** right point of intervall **/ /* initialize a[2] if necessary */ if( a[2].t < 0. ) a[2].t = 1.1 * a[1].t; tright = -1.; /* no right boundary known yet */ tleft = a[1].t; /* search */ for( i=1; i <= _unur_max(1,N_STEPS); i++ ) { _unur_mvtdr_tp_min(a[2].t, a+2); /* volume function */ if( a[2].status != MVTDR_CONE_OK ) { /* a[2] not a proper touching point */ tright = a[2].t; a[2].t = (tleft + a[2].t) * 0.5; /* try another one */ } else if( a[2].logH <= a[1].logH ) { /* move right */ tleft = a[2].t; a[2].t = (tright < 0.) ? a[2].t * 2. : (tright + a[2].t) * 0.5; } else /* all right: vol(right) > vol(middle) */ break; } /* search successful ? */ if( a[2].status != MVTDR_CONE_OK ) /* no proper touching point on right side --> use middle point */ return TP_MIDDLE; if( a[2].logH <= a[1].logH ) /* f(right) <= f(middle) */ return TP_RIGHT; /* we have found a bracket */ return TP_BRACKET; #undef N_STEPS } /* end of _unur_mvtdr_tp_bracket() */ /*****************************************************************************/ /* */ /* VERTICES. */ /* */ /*****************************************************************************/ int _unur_mvtdr_initial_vertices( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* get vertices of initial cones. */ /* these are the vertices (0,...,0,+/- 1, 0, ..., 0). */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { VERTEX *vt; int i,k; double d; double *domain; /* get rectangular domain */ domain = ( (GEN->has_domain && DISTR.domainrect != NULL) ? DISTR.domainrect : NULL ); /* unit vectors e_k and -e_k */ for ( d=1.; d > -2.; d -= 2.) { /* '+'-sign and '-'-sign */ for( k=0; kdim; k++ ) { vt = _unur_mvtdr_vertex_new(gen); if (vt==NULL) return UNUR_FAILURE; for( i=0; idim; i++ ) { /* coordinates */ (vt->coord)[i] = (i==k) ? d : 0.; } /* all vectors have norm 1. */ vt->norm = 1.; /* vertices outside domain of PDF get a negative index */ if ( domain ) { if ( (d<0 && _unur_FP_equal(GEN->center[k],domain[2*k])) || (d>0 && _unur_FP_equal(GEN->center[k],domain[2*k+1])) ) vt->index = -vt->index -1; } } } return UNUR_SUCCESS; } /* end of _unur_mvtdr_initial_vertices() */ /*---------------------------------------------------------------------------*/ VERTEX * _unur_mvtdr_vertex_new( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* allocate new vertex and append it to linked list of all vertices. */ /* increment counter for vertices. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to newly allocated vertex */ /*----------------------------------------------------------------------*/ { VERTEX *v; /* allocate memory */ v = malloc(sizeof(VERTEX)); if (v==NULL) { _unur_error(gen->genid,UNUR_ERR_MALLOC,""); return NULL; } /* insert into list of cones */ if (GEN->vertex == NULL) { GEN->last_vertex = GEN->vertex = v; } else { GEN->last_vertex = GEN->last_vertex->next = v; } v->next = NULL; /* coordinates of vertex */ v->coord = malloc(GEN->dim * sizeof(double)); if (v->coord==NULL) { _unur_error(gen->genid,UNUR_ERR_MALLOC,""); return NULL; } /* index of vertex */ v->index = GEN->n_vertex; /* and update counter */ ++(GEN->n_vertex); /* return pointer to next vertex */ return GEN->last_vertex; } /* end of _unur_mvtdr_vertex_new() */ /*---------------------------------------------------------------------------*/ VERTEX * _unur_mvtdr_vertex_on_edge( struct unur_gen *gen, VERTEX **vl ) /*----------------------------------------------------------------------*/ /* compute new vertex on edge (i.e., its barycenter) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* vl ... arraqy of the two end vertices of the edge. */ /* */ /* return: */ /* pointer to new vertex */ /*----------------------------------------------------------------------*/ { int i; VERTEX *newv; /* pointer to new vertex */ /* get an empty vertex */ newv = _unur_mvtdr_vertex_new(gen); if (newv==NULL) return NULL; /* barycenter of edge */ for( i=0; idim; i++ ) newv->coord[i] = 0.5 * ( ((vl[0])->coord)[i] + ((vl[1])->coord)[i] ); /* norm */ newv->norm = _unur_vector_norm(GEN->dim, newv->coord); /* norm --> 1 */ for( i=0; idim; i++ ) newv->coord[i] /= newv->norm; return newv; } /* end of _unur_mvtdr_vertex_on_edge() */ /*---------------------------------------------------------------------------*/ int _unur_mvtdr_number_vertices( struct unur_gen *gen, int level ) /*----------------------------------------------------------------------*/ /* calculate (approximate) number of vertices in a given triangulation */ /* level (when all initial cones are splitted). */ /* These numbers are used for the size of the hash table for edges. */ /* (WARNING! The numbers are found by computer experiments.) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* level ... number of triangulation steps */ /* */ /* return: */ /* number of vertices */ /* */ /* error: */ /* return -1 */ /*----------------------------------------------------------------------*/ { if (level < 0 || GEN->dim < 2) { _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); return -1; /** errorcode **/ } switch (GEN->dim) { case 2: { return (1 << (level+2)); } case 3: { static int nv[]={ 6, 13, 18, 40, 66,142,258,538,1026,2098,4098,8290,16386,32962,65538,131458,262146}; return nv[_unur_min(level,16)]; } case 4: { static int nv[]={ 8, 19, 25, 32, 80,128,192,456, 824,1408,3120,5968,11008,23264,45600, 87552}; return nv[_unur_min(level,15)]; } case 5: { static int nv[]={10, 26, 33, 41, 50,140,220,321, 450,1186,2158,3636, 5890,13970,27130}; return nv[_unur_min(level,14)]; } case 6: { static int nv[]={12, 34, 42, 51, 61, 72,224,348, 501, 681, 912,2660, 4896, 8254}; return nv[_unur_min(level,13)]; } case 7: { static int nv[]={14, 43, 52, 62, 73, 85, 98,336, 518, 743, 985,1289, 1666}; return nv[_unur_min(level,12)]; } case 8: { static int nv[]={16, 53, 63, 74, 86, 99,113,128, 480, 736,1059}; return nv[_unur_min(level,10)]; } case 9: { static int nv[]={18, 64, 75, 87,100,114,129,145, 162, 660}; return nv[_unur_min(level,9)]; } case 10: { static int nv[]={20, 76, 88,101,115,130,146,163, 181, 200}; return nv[_unur_min(level,9)]; } case 11: { static int nv[]={22, 89,102,116,131,147,164,182, 201, 221, 242}; return nv[_unur_min(level,10)]; } default: { /* dim >= 12 */ static int nv[]={24,103,117,132,148,165,183,202, 222, 243, 265, 288}; return nv[_unur_min(level,11)]; } } } /* end of _unur_mvtdr_number_vertices() */ /*****************************************************************************/ /* */ /* hash table for storing EDGES. */ /* */ /*****************************************************************************/ /* hash function for edge table */ #define _unur_mvtdr_etable_hash(x,y) ( (3*((x)+(y))/2) % GEN->etable_size ) /*---------------------------------------------------------------------------*/ int _unur_mvtdr_etable_new( struct unur_gen *gen, int size ) /*----------------------------------------------------------------------*/ /* make a new hash table. */ /* destroy old table if it exists. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* size ... size of hash table */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int n; /* first clear hash table (if necessary) */ _unur_mvtdr_etable_free(gen); /* set size of edge table */ GEN->etable_size = size; /* make root */ GEN->etable = _unur_xmalloc( size * sizeof(E_TABLE*) ); if (GEN->etable==NULL) { _unur_error(gen->genid,UNUR_ERR_MALLOC,""); return UNUR_ERR_MALLOC; } /* initialize table */ for (n = 0; n< size; n++) GEN->etable[n] = NULL; return UNUR_SUCCESS; } /* end of _unur_mvtdr_etable_new() */ /*---------------------------------------------------------------------------*/ void _unur_mvtdr_etable_free( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* free hash table. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { int i; E_TABLE *et, *et_next; if( GEN->etable == NULL ) /* nothing to do */ return; /* clear all branches */ for( i=0; ietable_size; i++ ) { /* free branch in table (linked list) */ for (et = GEN->etable[i]; et != NULL; et = et_next) { et_next = et->next; free (et); } } /* clear root */ free( GEN->etable ); GEN->etable = NULL; GEN->etable_size = 0; } /* end if _unur_mvtdr_etable_free() */ /*---------------------------------------------------------------------------*/ VERTEX * _unur_mvtdr_etable_find_or_insert( struct unur_gen *gen, VERTEX **vidx ) /*----------------------------------------------------------------------*/ /* search for an edge in the hash table. */ /* the edge is given by its end vertices vidx[0] and vidx[1]. */ /* (if vidx is an ordered array of the vertices of a cone then this */ /* edge is the "oldest" edge of that cone (i.e., the end vertices have */ /* the smallest indices of all vertices of the cone.) */ /* */ /* if the edge is found, a pointer to the vertex that corresponds to */ /* the barycenter of the edge. */ /* */ /* if the edge is not found in the table, it is created and inserted */ /* into the table, the barycenter is computed. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* vidx ... array of pointers to vertices */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { E_TABLE *pet, *pet_last; /* table entry */ int idx[2]; /* store indices */ int hidx; /* hash number */ /* check pointer */ CHECK_NULL(GEN->etable,NULL); /* hash number */ idx[0] = vidx[0]->index; idx[1] = vidx[1]->index; hidx = _unur_mvtdr_etable_hash(idx[0],idx[1]); /* get branch of hash table */ pet = pet_last = *(GEN->etable + hidx); /* now find entry in branch */ while( pet != NULL ) { if( pet->index[0] == idx[0] && pet->index[1] == idx[1] ) break; /* found ! */ pet_last = pet; pet = pet->next; } if( pet == NULL ) { /* we have not found the index */ /* new entry in hash table */ pet = malloc( sizeof(E_TABLE) ); if (pet==NULL) { _unur_error(gen->genid,UNUR_ERR_MALLOC,""); return NULL; } pet->next = NULL; if (pet_last == NULL) *(GEN->etable + hidx) = pet; else pet_last->next = pet; /* insert data of new edge */ /* indices of incident vertices */ pet->index[0] = idx[0]; pet->index[1] = idx[1]; /* compute new vertex */ pet->vertex = _unur_mvtdr_vertex_on_edge(gen,vidx); } /* return pointer to (new) edge */ return pet->vertex; } /* end of _unur_mvtdr_etable_find_or_insert() */ /*****************************************************************************/ int _unur_mvtdr_make_guide_table( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* create guide table. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int j; CONE *c; /* memory for the guide table */ GEN->guide_size = GEN->n_cone * GUIDE_TABLE_SIZE; GEN->guide = malloc (GEN->guide_size * sizeof(CONE*)); if (GEN->guide==NULL) { _unur_error(gen->genid,UNUR_ERR_MALLOC,""); return UNUR_ERR_MALLOC; } /* initialize table */ for( j = 0; j < GEN->guide_size ; j++ ) GEN->guide[j] = NULL; /* make table */ for( c=GEN->cone, j=0; c!=NULL && jguide_size; j++ ) { while( c->Hsum / GEN->Htot < (double) j / GEN->guide_size ) c=c->next; (GEN->guide)[j] = c; if( c == GEN->last_cone ) break; } /* is there an error ? */ if( jguide_size ) /* this should not happen */ for( ; jguide_size; j++ ) (GEN->guide)[j] = GEN->last_cone; return UNUR_SUCCESS; } /* end of _unur_mvtdr_make_guide_table() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/pinv_newset.ch0000644001357500135600000005426014420445767015170 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: pinv_newset.c * * * * Routines for creating and changing parameter objects. * * * ***************************************************************************** * * * Copyright (c) 2008 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * *****************************************************************************/ /*****************************************************************************/ /** Public: User Interface (API) **/ /*****************************************************************************/ struct unur_par * unur_pinv_new( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get default parameters */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* default parameters (pointer to structure) */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_par *par; /* check arguments */ _unur_check_NULL( GENTYPE,distr,NULL ); /* check distribution */ if (distr->type != UNUR_DISTR_CONT) { _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } COOKIE_CHECK(distr,CK_DISTR_CONT,NULL); if (DISTR_IN.pdf == NULL && DISTR_IN.cdf == NULL) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PDF or CDF"); return NULL; } /* allocate structure */ par = _unur_par_new( sizeof(struct unur_pinv_par) ); COOKIE_SET(par,CK_PINV_PAR); /* copy input */ par->distr = distr; /* pointer to distribution object */ /* set default values */ PAR->order = 5L; /* order of polynomial */ PAR->smooth = 0L; /* smoothness parameter */ PAR->u_resolution = 1.0e-10; /* maximal error allowed in u-direction */ PAR->bleft = -1.e100; /* left border of the computational domain */ PAR->bright = 1.e100; /* right border of the computational domain */ PAR->sleft = TRUE; /* whether to search for left boundary */ PAR->sright = TRUE; /* whether to search for right boundary */ PAR->max_ivs = PINV_DEFAULT_MAX_IVS; /* maximum number of subintervals */ PAR->n_extra_testpoints = 0L; /* number of extra test points for error estimate */ par->method = UNUR_METH_PINV; /* method */ par->variant = 0u; /* default variant: */ if (DISTR_IN.pdf != NULL) par->variant |= PINV_VARIANT_PDF; /* use PDF */ /* else: use CDF */ par->set = 0u; /* indicate default parameters */ par->urng = unur_get_default_urng(); /* use default urng */ par->urng_aux = NULL; /* no auxilliary URNG required */ par->debug = _unur_default_debugflag; /* set default debugging flags */ /* routine for starting generator */ par->init = _unur_pinv_init; return par; } /* end of unur_pinv_new() */ /*****************************************************************************/ int unur_pinv_set_order( struct unur_par *par, int order) /*----------------------------------------------------------------------*/ /* Set order of Hermite interpolation. */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* order ... order of interpolation polynome */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, PINV ); /* check new parameter for generator */ if (order<3 || order>MAX_ORDER) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"order <3 or >17"); return UNUR_ERR_PAR_SET; } /* store date */ PAR->order = order; /* changelog */ par->set |= PINV_SET_ORDER; return UNUR_SUCCESS; } /* end of unur_pinv_set_order() */ /*---------------------------------------------------------------------------*/ int unur_pinv_set_smoothness( struct unur_par *par, int smooth) /*----------------------------------------------------------------------*/ /* set smoothness of interpolation polynomial. */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* smooth ... smoothness parameter */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, PINV ); /* check new parameter for generator */ if (smooth < 0L || smooth > 2L) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"smoothness must be 0, 1, or 2"); return UNUR_ERR_PAR_SET; } /* store date */ PAR->smooth = smooth; /* changelog */ par->set |= PINV_SET_SMOOTH; return UNUR_SUCCESS; } /* end of unur_pinv_set_smoothness() */ /*---------------------------------------------------------------------------*/ int unur_pinv_set_u_resolution( struct unur_par *par, double u_resolution ) /*----------------------------------------------------------------------*/ /* set maximal relative error in x */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object*/ /* u_resolution ... maximal error in u */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, PINV ); /* check new parameter for generator */ if (u_resolution > 1.001e-5) { /* this is obviously an error */ _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"u-resolution too large --> use 1.e-5 instead"); u_resolution = 1.e-5; } if (u_resolution < 0.999e-15 ) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"u-resolution too small --> use 1.e-15 instead"); u_resolution = 1.e-15; } /* store date */ PAR->u_resolution = u_resolution; /* changelog */ par->set |= PINV_SET_U_RESOLUTION; return UNUR_SUCCESS; } /* end of unur_pinv_set_u_resolutuion() */ /*---------------------------------------------------------------------------*/ int unur_pinv_set_extra_testpoints( struct unur_par *par, int n_points) /*----------------------------------------------------------------------*/ /* set number of additional test points for error estimate */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* n_points ... number of test points */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, PINV ); /* check new parameter for generator */ if (n_points < 0) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"number of extra test point < 0"); return UNUR_ERR_PAR_SET; } /* store date */ PAR->n_extra_testpoints = n_points; /* changelog */ par->set |= PINV_SET_N_EXTRA_TP; return UNUR_SUCCESS; } /* end of unur_pinv_set_extra_testpoints() */ /*---------------------------------------------------------------------------*/ int unur_pinv_set_use_upoints( struct unur_par *par, int use_upoints ) /*----------------------------------------------------------------------*/ /* if TRUE, use Chebyshev points in u-scale. */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* use_upoints ... boolean */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, PINV ); /* store variant */ if (use_upoints) par->variant |= PINV_VARIANT_UPOINTS; else par->variant &= ~PINV_VARIANT_UPOINTS; /* changelog */ par->set |= PINV_SET_UPOINTS; return UNUR_SUCCESS; } /* end of unur_pinv_set_use_upoints() */ /*---------------------------------------------------------------------------*/ int unur_pinv_set_usepdf( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* Use PDF (if available) to compute approximate inverse CDF. */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, PINV ); /* check function pointer */ if (par->distr->data.cont.pdf == NULL) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"PDF missing"); return UNUR_ERR_PAR_SET; } /* store variant (set USE_PDF flag) */ par->variant |= PINV_VARIANT_PDF; /* changelog */ par->set |= PINV_SET_VARIANT; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_pinv_set_usepdf() */ /*---------------------------------------------------------------------------*/ int unur_pinv_set_usecdf( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* Use CDF (if available) to compute approximate inverse CDF. */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, PINV ); /* check function pointer */ if (par->distr->data.cont.cdf == NULL) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"CDF missing"); return UNUR_ERR_PAR_SET; } /* store variant (remove USE_PDF flag) */ par->variant &= ~PINV_VARIANT_PDF; /* changelog */ par->set |= PINV_SET_VARIANT; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_pinv_set_usecdf() */ /*---------------------------------------------------------------------------*/ int unur_pinv_set_boundary( struct unur_par *par, double left, double right ) /*----------------------------------------------------------------------*/ /* set left and right boundary of computation interval */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* left ... left boundary point */ /* right ... right boundary point */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* new boundary points must not be +/- UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, PINV ); /* check new parameter for generator */ if (!_unur_FP_less(left,right)) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"domain"); return UNUR_ERR_PAR_SET; } if (! (_unur_isfinite(left) && _unur_isfinite(right)) ) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"domain (+/- UNUR_INFINITY not allowed)"); return UNUR_ERR_PAR_SET; } /* store date */ PAR->bleft = left; PAR->bright = right; /* changelog */ par->set |= PINV_SET_BOUNDARY; return UNUR_SUCCESS; } /* end of unur_pinv_set_boundary() */ /*---------------------------------------------------------------------------*/ int unur_pinv_set_searchboundary( struct unur_par *par, int left, int right ) /*----------------------------------------------------------------------*/ /* set flag for boundary searching algorithm */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* left ... whether to search for left boundary point */ /* right ... whether to search for right boundary point */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, PINV ); /* store date */ PAR->sleft = (left) ? TRUE : FALSE; PAR->sright = (right) ? TRUE : FALSE; /* changelog */ par->set |= PINV_SET_SEARCHBOUNDARY; return UNUR_SUCCESS; } /* end of unur_pinv_set_searchboundary() */ /*---------------------------------------------------------------------------*/ int unur_pinv_set_max_intervals( struct unur_par *par, int max_ivs ) /*----------------------------------------------------------------------*/ /* set maximum number of intervals */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* max_ivs ... maximum number of intervals */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, PINV ); /* check new parameter for generator */ if (max_ivs < 100 || max_ivs > 1000000) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"maximum number of intervals < 100 or > 1000000"); return UNUR_ERR_PAR_SET; } /* store date */ PAR->max_ivs = max_ivs; /* changelog */ par->set |= PINV_SET_MAX_IVS; return UNUR_SUCCESS; } /* end of unur_pinv_set_max_intervals() */ /*---------------------------------------------------------------------------*/ int unur_pinv_get_n_intervals( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* get number of intervals (or more precisely the number of nodes) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* number of intervals ... on success */ /* 0 ... on error */ /*----------------------------------------------------------------------*/ { /* check input */ _unur_check_NULL( GENTYPE, gen, 0 ); _unur_check_gen_object( gen, PINV, 0 ); return GEN->n_ivs; } /* end of unur_pinv_get_n_intervals() */ /*---------------------------------------------------------------------------*/ int unur_pinv_set_keepcdf( struct unur_par *par, int keepcdf) /*----------------------------------------------------------------------*/ /* if TRUE, use do not discard table for integration. */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* keepcdf ... boolean */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, PINV ); /* store variant */ if (keepcdf) par->variant |= PINV_VARIANT_KEEPCDF; else par->variant &= ~PINV_VARIANT_KEEPCDF; /* changelog */ par->set |= PINV_SET_KEEPCDF; return UNUR_SUCCESS; } /* end of unur_pinv_set_keepcdf() */ /*****************************************************************************/ unuran-1.11.0/src/methods/auto.h0000644001357500135600000001123014420445767013422 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: auto.h * * * * PURPOSE: * * function prototypes for method AUTO * * (selects a method for a given distribution object AUTOmatically) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /* =METHOD AUTO Select method automatically =UP Methods [05] =REINIT not implemented =DESCRIPTION AUTO selects a an appropriate method for the given distribution object automatically. There are no parameters for this method, yet. But it is planned to give some parameter to describe the task for which the random variate generator is used for and thus make the choice of the generating method more appropriate. Notice that the required sampling routine for the generator object depends on the type of the given distribution object. The chosen method also depends on the sample size for which the generator object will be used. If only a few random variates the order of magnitude of the sample size should be set via a unur_auto_set_logss() call. IMPORTANT: This is an experimental version and the method chosen may change in future releases of UNU.RAN. For an example see @ref{Example_0,As short as possible,Example: As short as possible}. =HOWTOUSE Create a generator object for the given distribution object. =END */ /*---------------------------------------------------------------------------*/ /* Routines for user interface */ /* =ROUTINES */ UNUR_PAR *unur_auto_new( const UNUR_DISTR *distribution ); /* Get default parameters for generator. */ /*...........................................................................*/ int unur_auto_set_logss( UNUR_PAR *parameters, int logss ); /* Set the order of magnitude for the size of the sample that will be generated by the generator, i.e., the the common logarithm of the sample size. Default is 10. Notice: This feature will be used in future releases of UNU.RAN only. */ /* =END */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/ninv_struct.h0000644001357500135600000001065314420445767015040 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: ninv_struct.h * * * * PURPOSE: * * declares structures for method NINV * * (Numerical INVersion of cumulative distribution function) * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Information for constructing the generator */ struct unur_ninv_par { int max_iter; /* maximal number of iterations */ double x_resolution; /* maximal tolerated relative x-error */ double u_resolution; /* maximal tolerated (absolute) u-error */ double s[2]; /* interval boundaries at start (left/right) */ int table_on; /* if TRUE a table for starting points is used */ int table_size; /* size of table */ }; /*---------------------------------------------------------------------------*/ /* The generator object */ struct unur_ninv_gen { int max_iter; /* maximal number of iterations */ double x_resolution; /* maximal tolerated relative x-error */ double u_resolution; /* maximal tolerated (absolute) u-error */ double *table; /* table with possible starting values for NINV */ double *f_table; /* function values of points stored in table */ int table_on; /* if TRUE a table for starting points is used */ int table_size; /* size of table */ double Umin, Umax; /* bounds for iid random variable in respect to the given (truncated) domain of the distr. */ double CDFmin, CDFmax; /* CDF-bounds of domain */ double s[2]; /* interval boundaries at start (left/right) ...*/ double CDFs[2]; /* ... and their CDF-values */ }; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/ninv.h0000644001357500135600000003206714420445767013437 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: ninv.h * * * * PURPOSE: * * function prototypes for method NINV * * (Numerical INVersion of cumulative distribution function) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2009 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /* =METHOD NINV Numerical INVersion =UP Methods_for_CONT =REQUIRED CDF =OPTIONAL PDF =SPEED Set-up: optional, Sampling: (very) slow =REINIT supported =DESCRIPTION NINV implementations of some methods for numerical inversion: Newton's method, regula falsi (combined with interval bisectioning), and bisection method. Regula falsi and bisection method require only the CDF while Newton's method also requires the PDF. To speed up marginal generation times a table with suitable starting points can be created during the setup. The performance of the algorithm can adjusted by the desired accuracy of the method. It is possible to use this method for generating from truncated distributions. The truncated domain can be changed for an existing generator object. =HOWTOUSE Method NINV generates random variates by numerical inversion and requires a continuous univariate distribution objects with given CDF. Three variants are available: @itemize @minus @item Regula falsi [default] @item Newton's method @item Interval bisectioning @end itemize Newton's method additionally requires the PDF of the distribution and cannot be used otherwise (NINV automatically switches to regula falsi then). Default algorithm is regula falsi. It is slightly slower but numerically much more stable than Newton's algorithm. Interval bisectioning is the slowest method and should only be considered as a last resort when the other methods fails. It is possible to draw samples from truncated distributions. The truncated domain can even be changed for an existing generator object by an unur_ninv_chg_truncated() call. Marginal generation times can be sped up by means of a table with suitable starting points which can be created during the setup. Using such a table can be switched on by means of a unur_ninv_set_table() call where the table size is given as a parameter. The table is still useful when the (truncated) domain is changed often, since it is computed for the domain of the given distribution. (It is not possible to enlarge this domain.) If it is necessary to recalculate the table during sampling, the command unur_ninv_chg_table() can be used. As a rule of thumb using such a table is appropriate when the number of generated points exceeds the table size by a factor of 100. The default number of iterations of NINV should be enough for all reasonable cases. Nevertheless, it is possible to adjust the maximal number of iterations with the commands unur_ninv_set_max_iter() and unur_ninv_chg_max_iter(). In particular this might be necessary when the PDF has a pole or the distribution has extremely heavy tails. It is also possible to set/change the accuracy of the method (which also heavily influencies the generation time). We use two measures for the approximation error which can be used independently: x-error and u-error (@pxref{Inversion} for more details). It is possible to set the maximal tolerated error using with unur_ninv_set_x_resolution() and with unur_ninv_set_u_resolution(), resp., and change it with the respective calls unur_ninv_chg_x_resolution() and unur_ninv_chg_x_resolution(). The algorithm tries to satisfy @emph{both} accuracy goals (and raises an error flag it this fails). One of these accuracy checks can be disabled by setting the accuracy goal to a negative value. NINV tries to use proper starting values for both the regula falsi and bisection method, and for Newton's method. Of course the user might have more knowledge about the properties of the target distribution and is able to share his wisdom with NINV using the respective commands unur_ninv_set_start() and unur_ninv_chg_start(). It is possible to change the parameters and the domain of the chosen distribution and run unur_reinit() to reinitialize the generator object. The values given by the last unur_ninv_chg_truncated() call will be then changed to the values of the domain of the underlying distribution object. It is important to note that for a distribution from the UNU.RAN library of standard distributions (@pxref{Stddist,,Standard distributions}) the normalization constant has to be updated using the unur_distr_cont_upd_pdfarea() call whenever its parameters have been changed by means of a unur_distr_cont_set_pdfparams() call. It might happen that NINV aborts unur_sample_cont() without computing the correct value (because the maximal number iterations has been exceeded). Then the last approximate value for @i{x} is returned (with might be fairly false) and @code{unur_error} is set to @code{UNUR_ERR_GEN_SAMPLING}. =END */ /*---------------------------------------------------------------------------*/ /* Routines for user interface */ /* =ROUTINES */ UNUR_PAR *unur_ninv_new( const UNUR_DISTR *distribution ); /* Get default parameters for generator. */ /*...........................................................................*/ int unur_ninv_set_useregula( UNUR_PAR *parameters ); /* Switch to regula falsi combined with interval bisectioning. (This the default.) */ int unur_ninv_set_usenewton( UNUR_PAR *parameters ); /* Switch to Newton's method. Notice that it is numerically less stable than regula falsi. It it is not possible to invert the CDF for a particular uniform random number @i{U} when calling unur_sample_cont(), @code{unur_error} is set to @code{UNUR_ERR_GEN_SAMPLING}. Thus it is recommended to check @code{unur_error} before using the result of the sampling routine. */ int unur_ninv_set_usebisect( UNUR_PAR *parameters ); /* Switch to bisection method. This is a slow algorithm and should only be used as a last resort. */ int unur_ninv_set_max_iter( UNUR_PAR *parameters, int max_iter ); /* */ int unur_ninv_chg_max_iter(UNUR_GEN *generator, int max_iter); /* Set and change number of maximal iterations. Default is @code{100}. */ int unur_ninv_set_x_resolution( UNUR_PAR *parameters, double x_resolution); /* */ int unur_ninv_chg_x_resolution(UNUR_GEN *generator, double x_resolution); /* Set and change the maximal tolerated relative x-error. If @var{x_resolution} is negative then checking of the x-error is disabled. Default is @code{1.e-8}. */ int unur_ninv_set_u_resolution( UNUR_PAR *parameters, double u_resolution); /* */ int unur_ninv_chg_u_resolution(UNUR_GEN *generator, double u_resolution); /* Set and change the maximal tolerated (abolute) u-error. If @var{u_resolution} is negative then checking of the u-error is disabled. Default is @code{-1} (disabled). */ int unur_ninv_set_start( UNUR_PAR *parameters, double left, double right); /* Set starting points. If not set, suitable values are chosen automatically. @multitable @columnfractions 0.2 0.2 0.6 @item Newton: @tab @var{left}: @tab starting point @item Regula falsi: @tab @var{left}, @var{right}: @tab boundary of starting interval @end multitable If the starting points are not set then the follwing points are used by default: @multitable @columnfractions 0.2 0.2 0.6 @item Newton: @tab @var{left}: @tab CDF(@var{left}) = 0.5 @item Regula falsi: @tab @var{left}: @tab CDF(@var{left}) = 0.1 @item @tab @var{right}: @tab CDF(@var{right}) = 0.9 @end multitable If @var{left} == @var{right}, then UNU.RAN always uses the default starting points! */ int unur_ninv_chg_start(UNUR_GEN *gen, double left, double right); /* Change the starting points for numerical inversion. If left==right, then UNU.RAN uses the default starting points (see unur_ninv_set_start()). */ int unur_ninv_set_table(UNUR_PAR *parameters, int no_of_points); /* Generates a table with @var{no_of_points} points containing suitable starting values for the iteration. The value of @var{no_of_points} must be at least 10 (otherwise it will be set to 10 automatically). The table points are chosen such that the CDF at these points form an equidistance sequence in the interval (0,1). If a table is used, then the starting points given by unur_ninv_set_start() are ignored. No table is used by default. */ int unur_ninv_chg_table(UNUR_GEN *gen, int no_of_points); /* Recomputes a table as described in unur_ninv_set_table(). */ int unur_ninv_chg_truncated(UNUR_GEN *gen, double left, double right); /* Changes the borders of the domain of the (truncated) distribution. Notice that the given truncated domain must be a subset of the domain of the given distribution. The generator always uses the intersection of the domain of the distribution and the truncated domain given by this call. Moreover the starting point(s) will not be changed. @emph{Important:} If the CDF is (almost) the same for @var{left} and @var{right} and (almost) equal to @code{0} or @code{1}, then the truncated domain is @emph{not} chanced and the call returns an error code. @emph{Notice:} If the parameters of the distribution has been changed by a unur_distr_cont_set_pdfparams() call it is recommended to set the truncated domain again, since the former call might change the domain of the distribution but not update the values for the boundaries of the truncated distribution. */ double unur_ninv_eval_approxinvcdf( const UNUR_GEN *generator, double u ); /* Get approximate approximate value of inverse CDF at @var{u}. If @var{u} is out of the domain [0,1] then @code{unur_errno} is set to @code{UNUR_ERR_DOMAIN} and the respective bound of the domain of the distribution are returned (which is @code{-UNUR_INFINITY} or @code{UNUR_INFINITY} in the case of unbounded domains). @emph{Notice}: This function always evaluates the inverse CDF of the given distribution. A call to unur_ninv_chg_truncated() call has no effect. */ /* =END */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/hitro_struct.h0000644001357500135600000001165714420304141015174 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: hitro_struct.h * * * * PURPOSE: * * declares structures for method HITRO * * (Markov Chain - HIT-and-run sampler with Ratio-Of-uniforms) * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Information for constructing the generator */ struct unur_hitro_par { double r; /* r-parameter of HITRO method */ int thinning; /* thinning factor for generated chain */ int burnin; /* length of burn-in for chain */ double adaptive_mult; /* multiplier for adaptive rectangle */ double vmax; /* bounding rectangle v-coordinate */ const double *umin, *umax; /* bounding rectangle u-coordinates */ const double *x0; /* starting point of chain */ }; /*---------------------------------------------------------------------------*/ /* The generator object */ struct unur_hitro_gen { int dim; /* dimension of distribution */ int thinning; /* thinning factor for generated chain */ double r; /* r-parameter of HITRO method */ double *state; /* state of chain / current point. the state is a point in the acceptance region of the RoU-method in vu-hyperplane. the coordinates are stored in the following order: state = {v, u_1, u_2, ... u_n} */ int coord; /* current coordinate used for HITRO chain */ double *direction; /* working array for random direction */ double *vu; /* working point in RoU scale */ double *vumin, *vumax; /* vertices of bounding rectangles (vu-coordinates) (see 'state' variable for location of v and u-coordinates.) */ double *x; /* working point in the original scale */ const double *center; /* center of distribution */ double adaptive_mult; /* multiplier for adaptive rectangles */ int burnin; /* length of burn-in for chain */ double *x0; /* starting point of chain */ double fx0; /* PDF at starting point of chain */ }; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/empl.c0000644001357500135600000005730414420445767013416 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: empl.c * * * * TYPE: continuous univariate random variate * * METHOD: generate from empirical CDF with linear interpolation * * * * DESCRIPTION: * * Given observed sample. * * Produce a value x consistent with this sample * * * * REQUIRED: * * pointer to sample * * * * OPTIONAL: * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * ***************************************************************************** * * * REFERENCES: * * * * [1] Law, A.M. and Kelton, D. (2000): Simulation Modeling and Analysis. * * New York: McGraw-Hill. * * * * [2] Bratley, P., Fox, B.L., and Schrage E.L. (1987): A Guide to * * Simulation. New York: Springer-Verlag. * * * * [3] Hoermann, W. and Leydold, J. (2000): Automatic random variate * * generation for simulation input. Proceedings of the 2000 Winter * * Simulation Conference. (??? eds.) * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include "unur_methods_source.h" #include "x_gen_source.h" #include "empl.h" #include "empl_struct.h" /*---------------------------------------------------------------------------*/ /* Variants: */ /*---------------------------------------------------------------------------*/ /* Debugging flags */ /* bit 01 ... pameters and structure of generator (do not use here) */ /* bits 02-12 ... setup */ /* bits 13-24 ... adaptive steps */ /* bits 25-32 ... trace sampling */ #define EMPL_DEBUG_PRINTDATA 0x00000100u /*---------------------------------------------------------------------------*/ /* Flags for logging set calls */ /*---------------------------------------------------------------------------*/ #define GENTYPE "EMPL" /* type of generator */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_empl_init( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* Initialize new generator. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_empl_create( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* create new (almost empty) generator object. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_empl_clone( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* copy (clone) generator object. */ /*---------------------------------------------------------------------------*/ static void _unur_empl_free( struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* destroy generator object. */ /*---------------------------------------------------------------------------*/ static double _unur_empl_sample( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* sample from generator */ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ /* the following functions print debugging information on output stream, */ /* i.e., into the LOG file if not specified otherwise. */ /*---------------------------------------------------------------------------*/ static void _unur_empl_debug_init( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print after generator has been initialized has completed. */ /*---------------------------------------------------------------------------*/ #endif #ifdef UNUR_ENABLE_INFO static void _unur_empl_info( struct unur_gen *gen, int help ); /*---------------------------------------------------------------------------*/ /* create info string. */ /*---------------------------------------------------------------------------*/ #endif /*---------------------------------------------------------------------------*/ /* abbreviations */ #define DISTR_IN distr->data.cemp /* data for distribution object */ #define PAR ((struct unur_empl_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_empl_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.cemp /* data for distribution in generator object */ #define SAMPLE gen->sample.cont /* pointer to sampling routine */ /*---------------------------------------------------------------------------*/ /* constants */ /*---------------------------------------------------------------------------*/ /* compare two doubles (needed for sorting) */ inline static int compare_doubles (const void *a, const void *b) { const double *da = (const double *) a; const double *db = (const double *) b; return (*da > *db) - (*da < *db); } /*---------------------------------------------------------------------------*/ #define _unur_empl_getSAMPLE(gen) (_unur_empl_sample) /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Public: User Interface (API) **/ /*****************************************************************************/ struct unur_par * unur_empl_new( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get default parameters */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* default parameters (pointer to structure) */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_par *par; /* check arguments */ _unur_check_NULL( GENTYPE,distr,NULL ); /* check distribution */ if (distr->type != UNUR_DISTR_CEMP) { _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } COOKIE_CHECK(distr,CK_DISTR_CEMP,NULL); if (DISTR_IN.sample == NULL) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"observed sample"); return NULL; } if (DISTR_IN.n_sample < 2) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"number of observed sample"); return NULL; } /* allocate structure */ par = _unur_par_new( sizeof(struct unur_empl_par) ); COOKIE_SET(par,CK_EMPL_PAR); /* copy input */ par->distr = distr; /* pointer to distribution object */ /* set default values */ par->method = UNUR_METH_EMPL; /* method */ par->variant = 0u; /* default variant */ par->set = 0u; /* inidicate default parameters */ par->urng = unur_get_default_urng(); /* use default urng */ par->urng_aux = NULL; /* no auxilliary URNG required */ par->debug = _unur_default_debugflag; /* set default debugging flags */ /* routine for starting generator */ par->init = _unur_empl_init; return par; } /* end of unur_empl_new() */ /*****************************************************************************/ /** Private **/ /*****************************************************************************/ struct unur_gen * _unur_empl_init( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* initialize new generator */ /* */ /* parameters: */ /* par ... pointer to paramters for building generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); /* check input */ if ( par->method != UNUR_METH_EMPL ) { _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); return NULL; } COOKIE_CHECK(par,CK_EMPL_PAR,NULL); /* create a new empty generator object */ gen = _unur_empl_create(par); _unur_par_free(par); if (!gen) return NULL; /* the observed data */ /* sort entries */ qsort( GEN->observ, (size_t)GEN->n_observ, sizeof(double), compare_doubles); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_empl_debug_init(gen); #endif return gen; } /* end of _unur_empl_init() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_empl_create( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* allocate memory for generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* pointer to (empty) generator object with default settings */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_EMPL_PAR,NULL); /* create new generic generator object */ gen = _unur_generic_create( par, sizeof(struct unur_empl_gen) ); /* magic cookies */ COOKIE_SET(gen,CK_EMPL_GEN); /* set generator identifier */ gen->genid = _unur_set_genid(GENTYPE); /* routines for sampling and destroying generator */ SAMPLE = _unur_empl_getSAMPLE(gen); gen->destroy = _unur_empl_free; gen->clone = _unur_empl_clone; /* copy observed data into generator object */ GEN->observ = DISTR.sample; /* observations in distribution object */ GEN->n_observ = DISTR.n_sample; /* sample size */ #ifdef UNUR_ENABLE_INFO /* set function for creating info string */ gen->info = _unur_empl_info; #endif /* return pointer to (almost empty) generator object */ return gen; } /* end of _unur_empl_create() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_empl_clone( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* copy (clone) generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to clone of generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { #define CLONE ((struct unur_empl_gen*)clone->datap) struct unur_gen *clone; /* check arguments */ CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_EMPL_GEN,NULL); /* create generic clone */ clone = _unur_generic_clone( gen, GENTYPE ); /* copy observed data into generator object */ CLONE->observ = clone->distr->data.cemp.sample; /* observations in distribution object */ return clone; #undef CLONE } /* end of _unur_empl_clone() */ /*---------------------------------------------------------------------------*/ void _unur_empl_free( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* deallocate generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { /* check arguments */ if( !gen ) /* nothing to do */ return; /* check input */ if ( gen->method != UNUR_METH_EMPL ) { _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); return; } COOKIE_CHECK(gen,CK_EMPL_GEN,RETURN_VOID); /* we cannot use this generator object any more */ SAMPLE = NULL; /* make sure to show up a programming error */ /* free memory */ _unur_generic_free(gen); } /* end of _unur_empl_free() */ /*****************************************************************************/ double _unur_empl_sample( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { double U,X; int J; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_EMPL_GEN,UNUR_INFINITY); /* select uniformly an interval */ U = _unur_call_urng(gen->urng) * (GEN->n_observ-1); J = (int) (U); /* linear CDF between obeservation points */ X = GEN->observ[J] + (U-J)*(GEN->observ[J+1] - GEN->observ[J]); return X; } /* end of _unur_empl_sample() */ /*****************************************************************************/ /** Auxilliary Routines **/ /*****************************************************************************/ /*****************************************************************************/ /** Debugging utilities **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ static void _unur_empl_debug_init( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write info about generator into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_EMPL_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: type = continuous univariate random variates\n",gen->genid); fprintf(LOG,"%s: method = EMPL (EMPirical distribution with Linear interpolation)\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); _unur_distr_cemp_debug( gen->distr, gen->genid, (gen->debug & EMPL_DEBUG_PRINTDATA)); fprintf(LOG,"%s: sampling routine = _unur_empl_sample()\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); } /* end of _unur_empl_debug_init() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_INFO /*---------------------------------------------------------------------------*/ void _unur_empl_info( struct unur_gen *gen, int help ) /*----------------------------------------------------------------------*/ /* create character string that contains information about the */ /* given generator object. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* help ... whether to print additional comments */ /*----------------------------------------------------------------------*/ { struct unur_string *info = gen->infostr; /* generator ID */ _unur_string_append(info,"generator ID: %s\n\n", gen->genid); /* distribution */ _unur_string_append(info,"distribution:\n"); _unur_distr_info_typename(gen); _unur_string_append(info," functions = DATA [length=%d]\n", GEN->n_observ); _unur_string_append(info,"\n"); /* if (help) { */ /* _unur_string_append(info,"\n"); */ /* } */ /* method */ _unur_string_append(info,"method: EMPL (EMPirical distribution with Linear interpolation)\n"); _unur_string_append(info,"\n"); /* performance */ /* _unur_string_append(info,"performance characteristics:\n"); */ /* _unur_string_append(info,"\n"); */ /* parameters */ if (help) { _unur_string_append(info,"parameters: none\n"); _unur_string_append(info,"\n"); } /* Hints */ /* if (help) { */ /* _unur_string_append(info,"\n"); */ /* } */ } /* end of _unur_empl_info() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_INFO */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/pinv_prep.ch0000644001357500135600000011066014420445767014626 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: pinv_prep.c * * * * Routines for preprocessing steps. * * * ***************************************************************************** * * * Copyright (c) 2008-2010 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * *****************************************************************************/ /*****************************************************************************/ /** Preprocessing **/ /*****************************************************************************/ int _unur_pinv_preprocessing (struct unur_gen *gen) /*----------------------------------------------------------------------*/ /* 1. Find computational domain and compute PDF area. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { double area_approx; if (gen->variant & PINV_VARIANT_PDF) { /* 1a. Estimate computationally relevant domain (support) of PDF */ if (_unur_pinv_relevant_support(gen) != UNUR_SUCCESS) return UNUR_FAILURE; /* 1b. Compute area below PDF over relevant domain approximately. */ if (_unur_pinv_approx_pdfarea(gen) != UNUR_SUCCESS) return UNUR_FAILURE; area_approx = GEN->area; /* store for checking domain */ /* 1c. Compute computational domain where inverse CDF is approximated */ if (_unur_pinv_computational_domain(gen) != UNUR_SUCCESS) return UNUR_FAILURE; /* 1d. Compute area below PDF with requested accuracy and */ /* store intermediate results from adaptive integration. */ if (_unur_pinv_pdfarea(gen) != UNUR_SUCCESS) return UNUR_FAILURE; /* check area below PDF: it should not be (much) smaller than the approximate one */ if (GEN->area < 0.99 * area_approx) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"integration of pdf: numerical problems with cut-off points of computational domain"); return UNUR_FAILURE; } } else { /* use CDF */ /* 1c. Compute computational domain where inverse CDF is approximated */ if (_unur_pinv_computational_domain_CDF(gen) != UNUR_SUCCESS) return UNUR_FAILURE; } /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_pinv_preprocessing() */ /*****************************************************************************/ /** Preprocessing when PDF is given **/ /*****************************************************************************/ int _unur_pinv_relevant_support ( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* 1a. Estimate computationally relevant domain (support) of PDF */ /* (finite interval where PDF is above some threshold value). */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { double fb; /* check PDF at boudary */ if(GEN->sleft) { /* compute PDF at boundary */ fb = PDF(GEN->dleft); if (fb > 1.e-20 && fb < 1.e300) { /* PDF does neither vanish nor is it infinity: */ /* use boundary of given domain of distribution for */ /* computational domain. */ GEN->bleft = GEN->dleft; /* there is no need for further searching */ GEN->sleft = FALSE; } /** FIXME: throw error if fb is not finite! **/ } /* same for right hand boundary */ if(GEN->sright) { fb = PDF(GEN->dright); if (fb > 1.e-20 && fb < 1.e300) { GEN->bright = GEN->dright; GEN->sright = FALSE; } } /* search for interval of computational relevance (if required) */ if(GEN->sleft) { GEN->bleft = _unur_pinv_searchborder(gen, DISTR.center, GEN->bleft, &(GEN->dleft), &(GEN->sleft) ); if (!_unur_isfinite(GEN->bleft)) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"Cannot get left boundary of relevant domain."); return UNUR_ERR_GEN_CONDITION; } } if(GEN->sright) { GEN->bright = _unur_pinv_searchborder(gen, DISTR.center, GEN->bright, &(GEN->dright), &(GEN->sright) ); if (!_unur_isfinite(GEN->bright)) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"Cannot get right boundary of relevant domain."); return UNUR_ERR_GEN_CONDITION; } } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug & PINV_DEBUG_SEARCHBD) _unur_pinv_debug_relevant_support(gen); #endif /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_pinv_relevant_support() */ /*---------------------------------------------------------------------------*/ double _unur_pinv_searchborder (struct unur_gen *gen, double x0, double bound, double *dom, int *search) /*----------------------------------------------------------------------*/ /* [1a.] Find left or right hand border of relevant domain. */ /* */ /* Calculate domain of computational relevant region. */ /* Start at 'x0' and search towards 'bound'. */ /* The boundary points of this domain are approximately given as */ /* PDF(x0) * PINV_PDFLLIM */ /* */ /* As a side effect the support of the distribution is shrinked if */ /* points with PDF(x)=0 are found. */ /* If in addition a discontinuity is detected then the exact position */ /* (up to machine precision) of the boundary of the support of the PDF */ /* is located via interval bisection. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* x0 ... starting point for searching boudary */ /* PDF(x0) must not be too small */ /* bound ... stop searching at this point */ /* dom ... pointer to boundary of domain / support of distribution */ /* search ... pointer to boolean that indicates whether we have to */ /* search for cut-off points. The boolean is set to FALSE */ /* if a discontinuity is found at the boundary. */ /* */ /* return: */ /* boundary point */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { double x; /* current and previous searching point */ double xs, xl; /* point where PDF is less than and larger than threshold */ double fx; /* PDF at x */ double fs, fl; /* PDF at xs and xl */ double fllim; /* threshold value */ double fulim; /* threshold for detecting discontinuity at boundary */ /* threshold value where we stop searching */ fllim = PDF(x0) * PINV_PDFLLIM; fulim = 1.e4 * fllim; /* we already have checked PDF(center). but who knowns. */ if (fllim <= 0.) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF(center) too small"); return UNUR_INFINITY; } /* starting point */ xl = x0; fl = UNUR_INFINITY; x = _unur_arcmean(x0,bound); /* find points where PDF values bracket threshold: */ /* fs = PDF(xs) <= fllim <= PDF(xl) = fl */ while ( (fx=PDF(x)) > fllim ) { if (_unur_FP_same(x,bound)) return bound; xl = x; fl = fx; x = _unur_arcmean(x,bound); } xs = x; fs = fx; /* check sign */ if (fx < 0.) { _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"PDF(x) < 0"); return UNUR_INFINITY; } /* decrease length of bracket if necessary */ while (!_unur_FP_same(xs,xl)) { /* truncate domain if possible */ if (_unur_iszero(fs)) { *dom = xs; } /* new point */ x = xs/2. + xl/2.; fx = PDF(x); if (fx < 0.) { _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"PDF(x) < 0"); return UNUR_INFINITY; } /* check PDF at new point */ if (fx < fllim) { /* update bracket */ xs = x; fs = fx; } else { if (fl > fulim) { /* assume discontinuity at boundary -> update bracket */ xl = x; fl = fx; } else { /* assume smooth PDF -> stop and return point */ return x; } } } /* since we have already found boundary point, we can use this */ /* for the tail cut-off point. Thus we switch off further searching. */ *search = FALSE; /* return point */ return xl; } /* end of _unur_pinv_searchborder() */ /*---------------------------------------------------------------------------*/ int _unur_pinv_approx_pdfarea (struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* 1b. Compute area below PDF over relevant domain approximately. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* Remark: */ /* The user can also provide the area below the PDF. */ /* However, then we probably need not method PINV */ /*----------------------------------------------------------------------*/ { double tol; /* tolerated integration error */ int i; /* number of trials */ int res = UNUR_SUCCESS; /* exit code of subroutine */ /* we might need two trials */ for (i=1; i<=2; i++) { /* we only need a rough approximation of the area below the PDF. */ /* for the tolerated absolute integration error we assume that */ /* it is not "too far" from 1 or the value provides by the user */ /* (if given), respectively. */ tol = PINV_UERROR_AREA_APPROX * GEN->area; /* check center of distribution */ DISTR.center = _unur_max(DISTR.center, GEN->bleft); DISTR.center = _unur_min(DISTR.center, GEN->bright); /* compute area approximately */ GEN->area = _unur_lobatto_adaptive(_unur_pinv_eval_PDF, gen, GEN->bleft, DISTR.center - GEN->bleft, tol, NULL); if (_unur_isfinite(GEN->area)) GEN->area += _unur_lobatto_adaptive(_unur_pinv_eval_PDF, gen, DISTR.center, GEN->bright - DISTR.center, tol, NULL); /* check estimated area */ if ( !_unur_isfinite(GEN->area) || _unur_iszero(GEN->area) ) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"cannot approximate area below PDF"); res = UNUR_FAILURE; break; } /* The tolerated integration error is relative to the PDF area. * For the first trial we have used area=1 (or the value given by the user) * as a first guess. * However, we have to check whether this guess is large enough, * since otherwise the relative integration error is too large. */ if (GEN->area > 1.e-2) { /* relative integration error is sufficiently small */ break; } } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug & PINV_DEBUG_SEARCHBD) _unur_pinv_debug_pdfarea(gen,TRUE); #endif return res; } /* end of _unur_pinv_approx_pdfarea() */ /*---------------------------------------------------------------------------*/ int _unur_pinv_pdfarea (struct unur_gen *gen) /*----------------------------------------------------------------------*/ /* 1d. Compute area below PDF with requested accuracy and */ /* store intermediate results from adaptive integration. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* Remark: */ /* The user can also provide the area below the PDF. */ /* However, then we probably need not method PINV */ /*----------------------------------------------------------------------*/ { double tol; /* tolerated integration error */ /* the tolerated U-error depends on the given u-resolution. */ /* however, we have to make some adjustments for integration error */ /* in order to achieve the desired precison goal. */ tol = GEN->u_resolution * GEN->area * PINV_UERROR_CORRECTION * PINV_UTOL_CORRECTION; /* check center of distribution */ DISTR.center = _unur_max(DISTR.center, GEN->bleft); DISTR.center = _unur_min(DISTR.center, GEN->bright); /* create object that contains approximate CDF */ GEN->aCDF = _unur_lobatto_init(_unur_pinv_eval_PDF, gen, GEN->bleft, DISTR.center, GEN->bright, tol, NULL, PINV_MAX_LOBATTO_IVS); /* retrieve area below the PDF */ GEN->area = _unur_lobatto_integral(GEN->aCDF); /* check estimated area */ if ( !_unur_isfinite(GEN->area) || _unur_iszero(GEN->area) ) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"cannot compute area below PDF"); return UNUR_FAILURE; } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug & PINV_DEBUG_SEARCHBD) _unur_pinv_debug_pdfarea(gen,FALSE); #endif return UNUR_SUCCESS; } /* end of _unur_pinv_pdfarea() */ /*---------------------------------------------------------------------------*/ int _unur_pinv_computational_domain (struct unur_gen *gen) /*----------------------------------------------------------------------*/ /* 1c. Compute computational domain where inverse CDF is approximated */ /* (interval where we safely can compute coefficients of */ /* interpolating polynomial). */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { double tailcut_error; /* threshold values for cut-off points */ double range; /* length of current working domain */ /* parameters for tail cut-off points: maximal area in tails */ /* We use the given U-reslution * PINV_TAILCUTOFF_FACTOR * PDFarea. */ tailcut_error = GEN->u_resolution * PINV_TAILCUTOFF_FACTOR; tailcut_error = _unur_min( tailcut_error, PINV_TAILCUTOFF_MAX ); tailcut_error = _unur_max( tailcut_error, 2*DBL_EPSILON ); tailcut_error *= GEN->area * PINV_UERROR_CORRECTION; /* length of current working domain */ range = GEN->bright-GEN->bleft; /* compute cut-off points for tails */ if(GEN->sleft) { GEN->bleft = _unur_pinv_cut( gen, GEN->bleft, -range, tailcut_error); if ( !_unur_isfinite(GEN->bleft) ) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"cannot find left boundary for computational domain"); return UNUR_FAILURE; } } if(GEN->sright) { GEN->bright = _unur_pinv_cut( gen, GEN->bright, range, tailcut_error); if ( !_unur_isfinite(GEN->bright) ) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"cannot find right boundary for computational domain"); return UNUR_FAILURE; } } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug & PINV_DEBUG_SEARCHBD) _unur_pinv_debug_computational_domain(gen); #endif /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_pinv_computational_domain() */ /*---------------------------------------------------------------------------*/ double _unur_pinv_cut( struct unur_gen *gen, double w, double dw, double crit ) /*----------------------------------------------------------------------*/ /* [1c.] Calculate cut-off points for computational domain of */ /* distribution. */ /* The area outside the cut-off point is given by 'crit'. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* w ... starting point for searching cut-off point */ /* dw ... initial step size for searching, */ /* sign of dw gives searching direction: */ /* dw < 0 ... left hand side cut-off point */ /* dw > 0 ... right hand side cut-off point */ /* crit ... u-error criterium for tail cut-off */ /* */ /* return: */ /* cut-off point */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { double fl,fx,fr; /* value of PDF at x-dx, x, and x+dx */ double x = w; /* current point */ double dx; /* step length for calculation of derivative and local concavity */ double xnew; /* new point in iteration */ double df; /* estimate for derivative of PDF at x */ double lc; /* estimate for local concavity of PDF at x */ double area; /* estimate for tail probability */ int i,j; /* auxiliary variables */ /* check length of interval */ if (_unur_iszero(fabs(dw))) return w; /* starting point and step size for search */ x = w; fx = PDF(x); #ifdef PINV_DEVEL _unur_log_debug("%s: Find cut-off points on %s hand side near %g:\n", gen->genid, (dw>0)?"right":"left", x); #endif /* iteratively search for cut-off point with tail probability approximately 'crit'ical value */ for (i=1; i<100; i++) { #ifdef PINV_DEVEL _unur_log_debug("%s: (% 2d): x=%g, fx=%g\n", gen->genid, i, x, fx); #endif /* -- we need step size 'dx' for computing derivative 'df' and local concavity 'lc' -- */ /* first try */ dx = (fabs(dw) + fabs(x-w)) * 1.e-3; /* check boundary of domain */ if (x-dx < GEN->dleft) dx = x - GEN->dleft; if (x+dx > GEN->dright) dx = GEN->dright - x; /* now let us try to find non-zero points for the PDF */ for (j=1;;j++) { /* decrease step size */ dx = dx/2.; /* check length and protect against infinite loops */ if (dx < 128.*DBL_EPSILON*fabs(dw)) { /* we are too close to the boundary. So we just return the last value. */ #ifdef PINV_DEVEL _unur_log_debug("%s:\tclose to the boundary: dx=%g, dw=%g --> return %g\n", gen->genid, dx, dw, x); #endif return x; } /* compute PDF values */ fl = PDF(x-dx); fr = PDF(x+dx); /* check values */ if (! (_unur_iszero(fl) || _unur_iszero(fx) ||_unur_iszero(fr)) ) break; } /* -- compute paramters -- */ /* derivative */ df = (fr-fl)/(2.*dx); /* local concavity */ lc = fl/(fl-fx)+fr/(fr-fx) - 1; /* estimate for tail probability (Gerhard's formula) */ area = fabs(fx*fx / ((lc+1.) * df)); #ifdef PINV_DEVEL _unur_log_debug("%s:\tdx=%g, fl=%g, fr=%g, df=%g\n", gen->genid, dx,fl,fr,df); _unur_log_debug("%s:\tlc = fl/(fl-fx)+fr/(fr-fx) - 1 = %g\n", gen->genid, lc); _unur_log_debug("%s:\tarea = |fx^2/((lc+1.)*df)| = %g\n", gen->genid, area); #endif /* check for invalid derivative */ if (! _unur_isfinite(df)) { /* df too large --> we cannot compute the next point */ _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION, "numerical problems with cut-off point, PDF too steep"); return UNUR_INFINITY; } if ( ((dw>0)?1.:-1.) * df > 0.) { /* f increasing towards boundary in [fl,fr]. */ _unur_warning(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF increasing towards boundary"); /* Let us try boundary point */ xnew = (dw>0) ? GEN->dright : GEN->dleft; return _unur_pinv_cut_bisect(gen, x, xnew); } /* check for invalid area */ if (_unur_isnan(area)) { /* When the PDF is extremely flat than NaN might occur. There are two possibilities: * (1) We are far away from the center. Then the tail probabilty is almost 0. * (2) PDF(X) is still quite large. Then the tail probability cannot be estimated. * We assume (1). */ _unur_warning(gen->genid,UNUR_ERR_NAN,"tail probability gives NaN --> assume 0."); #ifdef PINV_DEVEL _unur_log_debug("%s:\treturn %g\n",gen->genid, x); #endif return x; } /* check accuracy of computation */ if (fabs(area/crit-1.) < 1.e-4) { #ifdef PINV_DEVEL _unur_log_debug("%s:\taccuracy goal reached --> return %g\n",gen->genid, x); #endif return x; } /* compute next point */ if (_unur_iszero(lc)) { xnew = x + fx/df * log(crit*fabs(df)/(fx*fx)); } else { xnew = x + fx/(lc*df) * ( pow(crit*fabs(df)*(lc+1.)/(fx*fx),lc/(lc+1.)) - 1.); } /* check new point */ if (! _unur_isfinite(xnew)) { /* try smaller step topwards boundary */ xnew = (dw > 0) ? _unur_arcmean(x,GEN->dright) : _unur_arcmean(x,GEN->dleft); } /* check whether new point is inside domain */ if (xnew < GEN->dleft || xnew > GEN->dright) { /* boundary exceeded */ if ( (dw > 0 && xnew < GEN->dleft) || (dw < 0 && xnew > GEN->dright) ) { /* we are on the wrong side --> abort */ _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION, "numerical problems with cut-off point, out of domain"); return UNUR_INFINITY; } else { /* boundary exceeded into search direction */ xnew = (xnew < GEN->dleft) ? GEN->dleft : GEN->dright; #ifdef PINV_DEVEL _unur_log_debug("%s:\tboundary exceeded --> return boundary %g\n",gen->genid, xnew); #endif return _unur_pinv_cut_bisect(gen, x, xnew); } } /* PDF at new point */ fx = PDF(xnew); /* check support of PDF */ if (_unur_iszero(fx)) return _unur_pinv_cut_bisect(gen, x, xnew); /* update point */ x = xnew; } /* maximum number of iterations exceeded */ #ifdef PINV_DEVEL _unur_log_debug("%s:\tmaximum number of iterations exceeded --> return %g\n",gen->genid, x); #endif return x; } /* end of _unur_pinv_cut() */ /*---------------------------------------------------------------------------*/ double _unur_pinv_cut_bisect (struct unur_gen *gen, double x0, double x1) /*----------------------------------------------------------------------*/ /* [1c.] Calculate cut-off points as boudary of bounded support of PDF. */ /* Thus be use bisection method. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* x0 ... point in support of PDF */ /* x1 ... point outside of support of PDF */ /* */ /* return: */ /* cut-off point */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { double x,fx; /* check starting points */ if (! (_unur_isfinite(x0) && _unur_isfinite(x1)) ) return UNUR_INFINITY; /* check sign of PDF */ x = x1; fx = PDF(x); if (fx > 0.) return x; #ifdef PINV_DEVEL _unur_log_debug("%s:\tpoint out of support --> find boundary by bisectioning\n",gen->genid); #endif /* interval bisectioning */ while ( !_unur_FP_equal(x0,x1) ) { x = _unur_arcmean(x0,x1); fx = PDF(x); if (fx > 0.) x0 = x; else x1 = x; } #ifdef PINV_DEVEL _unur_log_debug("%s:\treturn boundary of support = %g\n",gen->genid,x); #endif return x; } /* end of _unur_pinv_cut_bisect() */ /*****************************************************************************/ /** Preprocessing when CDF is given **/ /*****************************************************************************/ int _unur_pinv_computational_domain_CDF (struct unur_gen *gen) /*----------------------------------------------------------------------*/ /* 1c. Compute computational domain where inverse CDF is approximated */ /* (interval where we safely can compute coefficients of */ /* interpolating polynomial). */ /* Use CDF. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { double tailcut_error; /* threshold values for cut-off points */ double fl, fr; /* first we have to chech the domain of the distribution */ fl = CDF(DISTR.domain[0]); fr = CDF(DISTR.domain[1]); if (_unur_FP_approx(fl,fr)) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"truncated domain too narrow"); return UNUR_FAILURE; } /* parameters for tail cut-off points: maximal area in tails */ /* We use the given U-reslution * PINV_TAILCUTOFF_FACTOR * PDFarea. */ tailcut_error = GEN->u_resolution * PINV_TAILCUTOFF_FACTOR; tailcut_error = _unur_min( tailcut_error, PINV_TAILCUTOFF_MAX ); tailcut_error = _unur_max( tailcut_error, 2*DBL_EPSILON ); tailcut_error *= GEN->area * PINV_UERROR_CORRECTION; /* compute cut-off points for tails */ if(GEN->sleft) { GEN->bleft = _unur_pinv_cut_CDF( gen, GEN->dleft, DISTR.center, 0.5*tailcut_error, tailcut_error); if ( !_unur_isfinite(GEN->bleft) ) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"cannot find left boundary for computational domain"); return UNUR_FAILURE; } } if(GEN->sright) { GEN->bright = _unur_pinv_cut_CDF( gen, GEN->dright, DISTR.center, 1.-tailcut_error, 1.-0.5*tailcut_error); if ( !_unur_isfinite(GEN->bright) ) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"cannot find right boundary for computational domain"); return UNUR_FAILURE; } } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug & PINV_DEBUG_SEARCHBD) _unur_pinv_debug_computational_domain(gen); #endif /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_pinv_computational_domain_CDF() */ /*---------------------------------------------------------------------------*/ double _unur_pinv_cut_CDF( struct unur_gen *gen, double dom, double x0, double ul, double uu ) /*----------------------------------------------------------------------*/ /* [1c.] Calculate cut-off points for computational domain of */ /* distribution using CDF. */ /* The area outside the cut-off point is within the interval ul and uu. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* dom ... boundary of domain / support of distribution */ /* x0 ... starting point for searching cut-off point */ /* ul ... lower u-error criterium for tail cut off */ /* uu ... upper u-error criterium for tail cut off */ /* */ /* return: */ /* cut-off point */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { double x; /* current and previous searching point */ double xs, xl; /* point where CDF is less than and larger than threshold */ double fx; /* CDF at x */ double f0, fdom; /* CDF at x0 and dom */ double dx; /* step size for searching for relevant point */ /* check length of interval */ if (_unur_FP_same(x0,dom)) return x0; /* check u-error (protect against u-values too close to 1) */ if (1.-ul < 4*DBL_EPSILON) ul = 1. - 4*DBL_EPSILON; if (1.-uu < 2*DBL_EPSILON) ul = 1. - 2*DBL_EPSILON; /* starting point */ x = x0; f0 = CDF(x0); fdom = CDF(dom); /* check for starting point */ if (_unur_iszero(f0)) { for (dx=0.1; f0ul; dx*=10.) { dom = x0; fdom = f0; x0 -= dx; f0 = CDF(x0); if (!_unur_isfinite(x0)) return UNUR_INFINITY; } } /* find points where CDF values bracket threshold critical u values */ if ( (f0 < ul && fdom < ul) || (f0 > uu && fdom > uu) ) { _unur_warning(gen->genid,UNUR_ERR_GEN_CONDITION,"CDF too small/large on given domain"); return dom; } if (f0 >= ul && f0 <= uu) { /* we already have reached our goal */ return x0; } if ( (x0 < dom && _unur_FP_greater(f0,fdom)) || (x0 > dom && _unur_FP_less(f0,fdom)) ) { /* there is something wrong */ return UNUR_INFINITY; } /* bracket */ if (x0 > dom) { xs = dom; xl = x0; } else { xs = x0; xl = dom; } x = x0; /* decrease length of bracket */ while (!_unur_FP_same(xs,xl)) { /* new point */ x = _unur_arcmean(xs,xl); fx = CDF(x); /* check result */ if (fx >= ul && fx <= uu) { return x; } /* update bracket */ if (fx < ul) { xs = x; } else { xl = x; } } return x; } /* end of _unur_pinv_cut_CDF() */ /*****************************************************************************/ double _unur_pinv_Udiff (struct unur_gen *gen, double x, double h, double *fx) /*----------------------------------------------------------------------*/ /* Compute difference CDF(x+h)-CDF(x) (approximately), where CDF is */ /* the integral of the given (quasi-) density. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* x ... left boundary point of interval */ /* h ... length of interval */ /* fx ... PDF(x) (ignored if NULL or *fx<0) */ /* set *fx <- PDF(x+h) */ /* */ /* return: */ /* (approximate) difference CDF(x+h) - CDF(x) */ /* */ /* store: */ /* if (fx!=NULL) */ /* *fx = PDF(x+h) if computed in _unur_lobatto_eval_diff */ /* *fx = -1. (=unknown) otherwise */ /*----------------------------------------------------------------------*/ { if (gen->variant & PINV_VARIANT_PDF) return _unur_lobatto_eval_diff(GEN->aCDF, x, h, fx); else /* use CDF */ return CDF(x+h) - CDF(x); } /* end of _unur_pinv_Udiff() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/dext.c0000644001357500135600000007403214420445767013422 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: dext.c * * * * TYPE: discrete univariate random variate * * METHOD: wrapper for external generator * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * ***************************************************************************** * * * DEXT is a wrapper that allows to use external generators within the * * framework of UNURAN. * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include "unur_methods_source.h" #include "x_gen_source.h" #include "dext.h" #include "dext_struct.h" #ifdef UNUR_ENABLE_INFO # include #endif /*---------------------------------------------------------------------------*/ /* Variants: none */ /*---------------------------------------------------------------------------*/ /* Debugging flags */ /* bit 01 ... pameters and structure of generator (do not use here) */ /* bits 02-12 ... setup */ /* bits 13-24 ... adaptive steps */ /* bits 25-32 ... trace sampling */ /*---------------------------------------------------------------------------*/ /* Flags for logging set calls */ /*---------------------------------------------------------------------------*/ #define GENTYPE "DEXT" /* type of generator */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_dext_init( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* Initialize new generator. */ /*---------------------------------------------------------------------------*/ static int _unur_dext_reinit( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Reinitialize generator. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_dext_create( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* create new (almost empty) generator object. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_dext_clone( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* copy (clone) generator object. */ /*---------------------------------------------------------------------------*/ static void _unur_dext_free( struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* destroy generator object. */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* There are sampling routines, since every distribution has its own. */ /* Sampling routines are defined in ../distributions/ for each distributions.*/ /* double _unur_dext_sample( UNUR_GEN *gen ); does not exist! */ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ /* the following functions print debugging information on output stream, */ /* i.e., into the LOG file if not specified otherwise. */ /*---------------------------------------------------------------------------*/ static void _unur_dext_debug_init( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print after generator has been initialized has completed. */ /*---------------------------------------------------------------------------*/ #endif #ifdef UNUR_ENABLE_INFO static void _unur_dext_info( struct unur_gen *gen, int help ); /*---------------------------------------------------------------------------*/ /* create info string. */ /*---------------------------------------------------------------------------*/ #endif /*---------------------------------------------------------------------------*/ /* abbreviations */ #define DISTR_IN distr->data.discr /* data for distribution object */ #define PAR ((struct unur_dext_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_dext_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.discr /* data for distribution in generator object */ #define SAMPLE gen->sample.discr /* pointer to sampling routine */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Public: User Interface (API) **/ /*****************************************************************************/ struct unur_par * unur_dext_new( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get default parameters */ /* */ /* parameters: */ /* distr ... pointer to distribution object (can be NULL!) */ /* */ /* return: */ /* default parameters (pointer to structure) */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_par *par; /* check distribution */ if (distr != NULL) { if (distr->type != UNUR_DISTR_DISCR) { _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } COOKIE_CHECK(distr,CK_DISTR_DISCR,NULL); } /* allocate structure */ par = _unur_par_new( sizeof(struct unur_dext_par) ); COOKIE_SET(par,CK_DEXT_PAR); /* copy input */ par->distr = distr; /* pointer to distribution object */ /* set default values */ PAR->init = NULL; /* pointer to initialization routine for external generator */ PAR->sample = NULL; /* pointer to sampling routine for external generator */ par->method = UNUR_METH_DEXT; /* method */ par->variant = 0u; /* default variant */ par->set = 0u; /* inidicate default parameters */ par->urng = unur_get_default_urng(); /* use default urng */ par->urng_aux = NULL; /* no auxilliary URNG required */ par->debug = _unur_default_debugflag; /* set default debugging flags */ /* routine for initializing generator */ par->init = _unur_dext_init; return par; } /* end of unur_dext_new() */ /*****************************************************************************/ int unur_dext_set_init( struct unur_par *par, int (*init)(struct unur_gen *gen) ) /*----------------------------------------------------------------------*/ /* set initialization routine for external generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* init ... pointer to initialization routine for external generator */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); /* check input */ _unur_check_par_object( par, DEXT ); /* store date */ PAR->init = init; return UNUR_SUCCESS; } /* end if unur_dext_set_init() */ /*---------------------------------------------------------------------------*/ int unur_dext_set_sample( struct unur_par *par, int (*sample)(struct unur_gen *gen) ) /*----------------------------------------------------------------------*/ /* set sampling routine for external generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* sample ... pointer to sampling routine for external generator */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_NULL( GENTYPE, sample, UNUR_ERR_NULL ); /* check input */ _unur_check_par_object( par, DEXT ); /* store date */ PAR->sample = sample; return UNUR_SUCCESS; } /* end if unur_dext_set_sample() */ /*---------------------------------------------------------------------------*/ void * unur_dext_get_params( struct unur_gen *gen, size_t size ) /*----------------------------------------------------------------------*/ /* Get pointer to memory block for storing parameters of external */ /* generator. The memory block is (re-) allocated if necessary. */ /* If size is set 0, then only the pointer stored in the generator */ /* object is returned. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* size ... size if the memory block */ /* */ /* return: */ /* pointer to memory block that contains parameters */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { /* check input */ _unur_check_NULL( GENTYPE, gen, NULL ); COOKIE_CHECK(gen, CK_DEXT_GEN, NULL); /* Is it really necessary to check the method? No! */ /* if ( gen->method != UNUR_METH_DEXT ) { */ /* _unur_error((gen)->genid,UNUR_ERR_GEN_INVALID,""); */ /* return NULL; */ /* } */ if (size && size != GEN->size_param) { /* allocate memory block */ GEN->param = _unur_xrealloc(GEN->param, size); GEN->size_param = size; } return GEN->param; } /* end of unur_dext_get_params() */ /*---------------------------------------------------------------------------*/ double * unur_dext_get_distrparams( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* Get pointer to array of parameters of underlying distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to double array */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { /* check input */ CHECK_NULL(gen, NULL); COOKIE_CHECK(gen, CK_DEXT_GEN, NULL); return DISTR.params; } /* end of unur_dext_get_distrparams() */ /*---------------------------------------------------------------------------*/ int unur_dext_get_ndistrparams( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* Get size of array of parameters of underlying distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* length of double array */ /* */ /* error: */ /* return 0 */ /*----------------------------------------------------------------------*/ { /* check input */ CHECK_NULL(gen, 0); COOKIE_CHECK(gen, CK_DEXT_GEN, 0); return DISTR.n_params; } /* end of unur_dext_get_ndistrparams() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Private **/ /*****************************************************************************/ struct unur_gen * _unur_dext_init( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* initialize new generator */ /* */ /* parameters: */ /* par ... pointer to paramters for building generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); /* check input */ if ( par->method != UNUR_METH_DEXT ) { _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); return NULL; } COOKIE_CHECK(par,CK_DEXT_PAR,NULL); /* we need a sampling routine */ if (PAR->sample == NULL) { _unur_error(GENTYPE,UNUR_ERR_GEN_CONDITION,"sampling routine missing"); return NULL; } /* create a new empty generator object */ gen = _unur_dext_create(par); _unur_par_free(par); if (!gen) return NULL; /* run special init routine for external generator */ if (GEN->init != NULL) { if (GEN->init(gen) != UNUR_SUCCESS) { /* init failed --> could not find a sampling routine */ _unur_error(GENTYPE,UNUR_FAILURE,"init for external generator failed"); _unur_dext_free(gen); return NULL; } } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_dext_debug_init(gen); #endif /* o.k. */ return gen; } /* end of _unur_dext_init() */ /*---------------------------------------------------------------------------*/ int _unur_dext_reinit( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* re-initialize (existing) generator. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* run special init routine for external generator */ if (GEN->init != NULL) { if (GEN->init(gen) != UNUR_SUCCESS) { /* init failed --> could not find a sampling routine */ _unur_error(GENTYPE,UNUR_FAILURE,"init for external generator failed"); return UNUR_FAILURE; } } /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_dext_reinit() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_dext_create( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* allocate memory for generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* pointer to (empty) generator object with default settings */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; struct unur_distr *distr = NULL; /* check arguments */ CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_DEXT_PAR,NULL); /* need a distribution object */ if (par->distr == NULL) par->distr = distr = unur_distr_discr_new(); /* create new generic generator object */ gen = _unur_generic_create( par, sizeof(struct unur_dext_gen) ); /* magic cookies */ COOKIE_SET(gen,CK_DEXT_GEN); /* set generator identifier */ gen->genid = _unur_set_genid(GENTYPE); /* routines for sampling and destroying generator */ SAMPLE = PAR->sample; /* will be set in _unur_dext_init() */ gen->destroy = _unur_dext_free; gen->clone = _unur_dext_clone; gen->reinit = _unur_dext_reinit; /* copy data */ GEN->init = PAR->init; GEN->sample = PAR->sample; /* defaults */ GEN->param = NULL; /* parameters for the generator */ GEN->size_param = 0; /* size of parameter object */ /* clean up */ if (distr) _unur_distr_free(distr); #ifdef UNUR_ENABLE_INFO /* set function for creating info string */ gen->info = _unur_dext_info; #endif /* return pointer to (almost empty) generator object */ return gen; } /* end of _unur_dext_create() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_dext_clone( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* copy (clone) generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to clone of generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { #define CLONE ((struct unur_dext_gen*)clone->datap) struct unur_gen *clone; /* check arguments */ CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_DEXT_GEN,NULL); /* create generic clone */ clone = _unur_generic_clone( gen, GENTYPE ); /* copy parameters for special generators */ if (GEN->param) { CLONE->param = _unur_xmalloc( GEN->size_param ); memcpy( CLONE->param, GEN->param, GEN->size_param ); } return clone; #undef CLONE } /* end of _unur_dext_clone() */ /*---------------------------------------------------------------------------*/ void _unur_dext_free( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* deallocate generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { /* check arguments */ if( !gen ) /* nothing to do */ return; /* magic cookies */ COOKIE_CHECK(gen,CK_DEXT_GEN,RETURN_VOID); /* check input */ if ( gen->method != UNUR_METH_DEXT ) { _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); return; } /* we cannot use this generator object any more */ SAMPLE = NULL; /* make sure to show up a programming error */ /* free memory */ if (GEN->param) free(GEN->param); _unur_generic_free(gen); } /* end of _unur_dext_free() */ /*****************************************************************************/ /** double _unur_dext_sample( struct unur_gen *gen ) {} Does not exists !!! Sampling routines are set by user via unur_dext_set_sample(). **/ /*****************************************************************************/ /** Auxilliary Routines **/ /*****************************************************************************/ /*****************************************************************************/ /** Debugging utilities **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ void _unur_dext_debug_init( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write info about generator into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_DEXT_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: type = discrete univariate random variates\n",gen->genid); fprintf(LOG,"%s: method = wrapper for external generator\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); /* distribution */ _unur_distr_discr_debug( gen->distr, gen->genid, FALSE ); } /* end of _unur_dext_info_init() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_INFO /*---------------------------------------------------------------------------*/ void _unur_dext_info( struct unur_gen *gen, int help ) /*----------------------------------------------------------------------*/ /* create character string that contains information about the */ /* given generator object. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* help ... whether to print additional comments */ /*----------------------------------------------------------------------*/ { struct unur_string *info = gen->infostr; int samplesize = 10000; /* generator ID */ _unur_string_append(info,"generator ID: %s\n\n", gen->genid); /* distribution */ _unur_string_append(info,"distribution:\n"); _unur_distr_info_typename(gen); _unur_string_append(info," domain = (%d, %d)\n", DISTR.domain[0],DISTR.domain[1]); _unur_string_append(info,"\n"); /* if (help) { */ /* _unur_string_append(info,"\n"); */ /* } */ /* method */ _unur_string_append(info,"method: DEXT (wrapper for Discrete EXTernal generators)\n"); _unur_string_append(info,"\n"); /* performance */ _unur_string_append(info,"performance characteristics:\n"); _unur_string_append(info," E [#urn] = %.2f [approx.]\n", unur_test_count_urn(gen,samplesize,0,NULL)/((double)samplesize)); _unur_string_append(info,"\n"); /* parameters */ if (help) { _unur_string_append(info,"parameters: none\n"); _unur_string_append(info,"\n"); /* Not displayed: int unur_dext_set_init( UNUR_PAR *parameters, int (*init)(UNUR_GEN *gen) ); int unur_dext_set_sample( UNUR_PAR *parameters, int (*sample)(UNUR_GEN *gen) ); */ } /* Hints */ /* if (help) { */ /* _unur_string_append(info,"\n"); */ /* } */ } /* end of _unur_dext_info() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_INFO */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/arou_struct.h0000644001357500135600000001317514420445767015036 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: arou_struct.h * * * * PURPOSE: * * declares structures for method AROU * * (Adaptive Ratio-Of-Uniforms) * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Information for constructing the generator */ struct unur_arou_par { double guide_factor; /* relative size of guide table */ double bound_for_adding; /* lower bound for relative area */ double max_ratio; /* limit for ratio r_n = |P^s| / |P^e| */ int n_starting_cpoints; /* number of construction points at start */ const double *starting_cpoints; /* pointer to array of starting points */ int max_segs; /* maximum number of segments */ double darsfactor; /* factor for (derandomized) ARS */ }; /*---------------------------------------------------------------------------*/ /* store data for segments */ struct unur_arou_segment { double Acum; /* cumulated sum of areas */ double Ain; /* area of segment inside of squeeze */ double Aout; /* area of segment outside of squeeze */ double ltp[2]; /* coordinates of left tp point in segment */ double dltp[3]; /* tanget line of region at left touching point: dltp[0]*u + dltp[1]*v == dltp[2] */ double mid[2]; /* coordinates of middle (outer) vertex of segment */ double *rtp; /* pointer to coordinates of right tp in segment (stored in next segment) */ double *drtp; /* pointer to tangent line at right tp */ struct unur_arou_segment *next; /* pointer to next segment in list */ #ifdef UNUR_COOKIES unsigned cookie; /* magic cookie */ #endif }; /*---------------------------------------------------------------------------*/ /* The generator object */ struct unur_arou_gen { double Atotal; /* area of enveloping polygon */ double Asqueeze; /* area of squeeze polygon */ double max_ratio; /* limit for ratio r_n = |P^s| / |P^e| */ struct unur_arou_segment **guide; /* pointer to guide table */ int guide_size; /* size of guide table */ double guide_factor; /* relative size of guide table */ struct unur_arou_segment *seg; /* pointer to linked list of segments */ int n_segs; /* number of construction points */ int max_segs; /* maximum number of segments */ double darsfactor; /* factor for (derandomized) ARS */ double center; /* (approximate) location of mode */ #ifdef UNUR_ENABLE_INFO int max_segs_info; /* maximum number of segments (as given) */ #endif }; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/unur_methods.h0000644001357500135600000001364214430713333015163 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: unur_methods.h * * * * PURPOSE: * * defines bitmasks to identify used method in generator objects * * * ***************************************************************************** * * * Copyright (c) 2000-2011 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifndef UNUR_METHODS_H_SEEN #define UNUR_METHODS_H_SEEN /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Bitmask to indicate methods **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ /* bitmasks */ #define UNUR_MASK_TYPE 0xff000000u /* indicate type of method */ /* discrete distributions */ #define UNUR_METH_DISCR 0x01000000u #define UNUR_METH_DARI 0x01000001u #define UNUR_METH_DAU 0x01000002u #define UNUR_METH_DGT 0x01000003u #define UNUR_METH_DSROU 0x01000004u #define UNUR_METH_DSS 0x01000005u /* continuous distributions */ #define UNUR_METH_CONT 0x02000000u #define UNUR_METH_AROU 0x02000100u #define UNUR_METH_ARS 0x02000d00u #define UNUR_METH_HINV 0x02000200u #define UNUR_METH_HRB 0x02000300u #define UNUR_METH_HRD 0x02000400u #define UNUR_METH_HRI 0x02000500u #define UNUR_METH_ITDR 0x02000800u #define UNUR_METH_NINV 0x02000600u #define UNUR_METH_NROU 0x02000700u #define UNUR_METH_PINV 0x02001000u #define UNUR_METH_SROU 0x02000900u #define UNUR_METH_SSR 0x02000a00u #define UNUR_METH_TABL 0x02000b00u #define UNUR_METH_TDR 0x02000c00u #define UNUR_METH_UNIF 0x02000e00u #define UNUR_METH_UTDR 0x02000f00u /* univariate continuous empirical distributions */ #define UNUR_METH_CEMP 0x04000000u #define UNUR_METH_EMPK 0x04001100u #define UNUR_METH_EMPL 0x04001200u #define UNUR_METH_HIST 0x04001300u /* multivariate continuous distributions */ #define UNUR_METH_VEC 0x08000000u #define UNUR_METH_MVTDR 0x08010000u #define UNUR_METH_VMT 0x08020000u #define UNUR_METH_VNROU 0x08030000u #define UNUR_METH_VAROU 0x08040000u #define UNUR_METH_NORTA 0x08050000u #define UNUR_METH_GIBBS 0x08060000u #define UNUR_METH_HITRO 0x08070000u #define UNUR_METH_BALL 0x08080000u #define UNUR_METH_WALK 0x08090000u /* multivariate continuous empirical distributions */ #define UNUR_METH_CVEMP 0x10000000u #define UNUR_METH_VEMPK 0x10010000u /* random matrices */ #define UNUR_METH_MAT 0x20000000u #define UNUR_METH_MCORR 0x20010000u /* generators for standard distributions */ #define UNUR_METH_CSTD 0x0200f100u /* is of type UNUR_METH_CONT !! */ #define UNUR_METH_DSTD 0x0100f200u /* is of type UNUR_METH_DISCR !! */ #define UNUR_METH_MVSTD 0x0800f300u /* is of type UNUR_METH_CVEC !! */ /* meta distributions */ #define UNUR_METH_MIXT 0x0200e100u /* univariate continuous */ /* wrapper for external generators */ #define UNUR_METH_CEXT 0x0200f400u /* is of type UNUR_METH_CONT !! */ #define UNUR_METH_DEXT 0x0100f500u /* is of type UNUR_METH_DISCR !! */ /* automatically selected generator */ #define UNUR_METH_AUTO 0x00a00000u /* can be any type of distribution */ /* to indicate unknown type */ #define UNUR_METH_UNKNOWN 0xff000000u /*---------------------------------------------------------------------------*/ #endif /* UNUR_METHODS_H_SEEN */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/hri_struct.h0000644001357500135600000000652114420304141014623 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: hri_struct.h * * * * PURPOSE: * * declares structures for method HRI * * (Hazard Rate Increasing) * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Information for constructing the generator */ struct unur_hri_par { double p0; /* design (splitting) point */ }; /*---------------------------------------------------------------------------*/ /* The generator object */ struct unur_hri_gen { double p0; /* design (splitting) point */ double left_border; /* left border of domain */ double hrp0; /* hazard rate at p0 */ }; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/mvtdr_sample.ch0000644001357500135600000002051714420445767015322 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: mvtdr_sample.c * * * * TYPE: continuous multivariate random variate * * METHOD: multivariate transformed density rejection * * * * DESCRIPTION: * * Given (logarithm of the) PDF of a log-concave distribution; * * produce a value x consistent with its density. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*****************************************************************************/ /** Private **/ /*****************************************************************************/ /*****************************************************************************/ /** Sampling **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ int _unur_mvtdr_sample_cvec( struct unur_gen *gen, double *rpoint ) /*----------------------------------------------------------------------*/ /* sample from generator */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* vec ... random vector (result) */ /*----------------------------------------------------------------------*/ { CONE *c; /* cone for generating point */ double gx; /* distance of random point */ double U; /* uniformly distributed random number */ double f, h; /* value of density and hat at random point */ int i,j; double *S = GEN->S; /* working array for storing point on simples */ /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_MVTDR_GEN,UNUR_ERR_COOKIE); /* loop until random point is accepted */ while( 1 ) { /*.......................................................................*/ /** find a cone **/ U = _unur_call_urng(gen->urng); /* sample from uniform distribution */ /* look up in guide table and search for cone */ c = (GEN->guide)[(int) (U * GEN->guide_size)]; U *= GEN->Htot; while (c->next!=NULL && c->Hsum < U) c = c->next; /*.......................................................................*/ /** get random point and distance of hyper plane **/ /* get x value for marginal distribution of hat --> hyperplane */ if (GEN->has_domain) /* update domain of gamma distribution */ /* remark: this is rather expensive */ unur_tdr_chg_truncated(GEN_GAMMA, 0., c->beta * c->height ); gx = unur_sample_cont(GEN_GAMMA) / (c->beta); /* nonnegative uniform random numbers with sum u_i = 1 */ _unur_mvtdr_simplex_sample(gen, S); /* move point into center */ for( i=0; idim; i++ ) rpoint[i] = GEN->center[i]; /* calculate random point on chosen hyper-plane */ for( j=0; jdim; j++ ) { double x = gx * S[j] / c->gv[j]; for( i=0; idim; i++ ) rpoint[i] += x * (c->v[j])->coord[i]; } /*.......................................................................*/ /** accept or reject **/ f = PDF(rpoint); /* density */ h = T_inv( c->alpha - c->beta * gx ); /* hat */ /* verify hat function */ if ( (gen->variant & MVTDR_VARFLAG_VERIFY) && ((1.+UNUR_EPSILON) * h < f ) ) _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF(x) > hat(x)"); /* accept point */ if( _unur_call_urng(gen->urng) * h <= f ) return UNUR_SUCCESS; } } /* end of _unur_mvtdr_sample_cvec() */ /*-----------------------------------------------------------------*/ int _unur_mvtdr_simplex_sample( const struct unur_gen *gen, double *U ) /*----------------------------------------------------------------------*/ /* sample point uniformly on standard simplex */ /* point in standard simplex 0 <= u[0] <= ... <= u[dim-2] <= 1 */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* U ... array for storing result */ /*----------------------------------------------------------------------*/ { int dim = GEN->dim; /*................................................................*/ if (dim == 2) { U[0] = _unur_call_urng(gen->urng); U[1] = 1. - U[0]; return UNUR_SUCCESS; } /*................................................................*/ if (dim == 3) { U[0] = _unur_call_urng(gen->urng); U[1] = _unur_call_urng(gen->urng); if( U[0] > U[1] ) { U[2] = U[0]; U[0] = U[1]; U[1] = U[2]; } U[2] = 1. - U[1]; U[1] = U[1] - U[0]; return UNUR_SUCCESS; } /*................................................................*/ if (dim >3) { int i,j; double U_aux; /* generate dim-1 numbers */ for( i=0; iurng); /* sort numbers (insertion sort) */ /** TODO!! replace by exp random variates!! **/ for( i=1; i0 && U[j-1] > U_aux; j-- ) U[j] = U[j-1]; U[j] = U_aux; } /* transform to affine coordinates */ U[dim-1] = 1.; for( i=dim-1; i>0; i-- ) U[i] -= U[i-1]; return UNUR_SUCCESS; } /*................................................................*/ /* else --> make error message!! */ _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); return UNUR_FAILURE; } /* end of _unur_mvtdr_simplex_sample() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/tabl_debug.ch0000644001357500135600000003467714420445767014731 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: tabl_debug.c * * * * TYPE: continuous univariate random variate * * METHOD: rejection form piecewise constant hat * * (Ahren's table method) * * * * DESCRIPTION: * * Given PDF of a unimodal distribution * * produce random variate X with its density * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*****************************************************************************/ /** Debugging utilities **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ #define empty_line() fprintf(LOG,"%s:\n",gen->genid); /*---------------------------------------------------------------------------*/ void _unur_tabl_debug_init_start( const struct unur_par *par, const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write info about generator after setup into LOG file */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; int i; /* check arguments */ CHECK_NULL(par,RETURN_VOID); COOKIE_CHECK(par,CK_TABL_PAR,RETURN_VOID); CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_TABL_GEN,RETURN_VOID); LOG = unur_get_stream(); empty_line(); fprintf(LOG,"%s: type = continuous univariate random variates\n",gen->genid); fprintf(LOG,"%s: method = rejection from piecewise constant hat\n",gen->genid); fprintf(LOG,"%s: variant = ",gen->genid); if (gen->variant & TABL_VARIANT_IA) fprintf(LOG,"immediate acceptance ... IA\n"); else fprintf(LOG,"acceptance/rejection ... RH\n"); empty_line(); _unur_distr_cont_debug( gen->distr, gen->genid ); fprintf(LOG,"%s: sampling routine = _unur_tabl_",gen->genid); if (gen->variant & TABL_VARIANT_IA) fprintf(LOG,"ia"); else fprintf(LOG,"rh"); if (gen->variant & TABL_VARFLAG_VERIFY) fprintf(LOG,"_sample_check()\n"); else fprintf(LOG,"_sample()\n"); fprintf(LOG,"%s: computation interval = (%g, %g)\n",gen->genid,GEN->bleft,GEN->bright); fprintf(LOG,"%s: maximum number of intervals = %d",gen->genid,GEN->max_ivs); _unur_print_if_default(gen,TABL_SET_MAX_IVS); fprintf(LOG,"\n"); if (gen->variant & TABL_VARFLAG_USEEAR) { fprintf(LOG,"%s: use equal area rule\n",gen->genid); fprintf(LOG,"%s:\tarea fraction for equal area rule = %g ",gen->genid,PAR->area_fract); _unur_print_if_default(par,TABL_SET_AREAFRACTION); fprintf(LOG,"\n"); } if (gen->variant & TABL_VARFLAG_USEDARS) { fprintf(LOG,"%s: Derandomized ARS enabled ",gen->genid); _unur_print_if_default(gen,TABL_SET_USE_DARS); fprintf(LOG,"\n%s:\tDARS factor = %g",gen->genid,GEN->darsfactor); _unur_print_if_default(gen,TABL_SET_DARS_FACTOR); } else { fprintf(LOG,"%s: Derandomized ARS disabled ",gen->genid); _unur_print_if_default(gen,TABL_SET_USE_DARS); } fprintf(LOG,"\n"); fprintf(LOG,"%s: bound for ratio Atotal / Asqueeze = %g%%",gen->genid,GEN->max_ratio*100.); _unur_print_if_default(gen,TABL_SET_MAX_SQHRATIO); fprintf(LOG,"\n"); fprintf(LOG,"%s: split intervals at ",gen->genid); switch( gen->variant & TABL_VARMASK_SPLIT ) { case TABL_VARFLAG_SPLIT_MEAN: fprintf(LOG,"mean point"); break; case TABL_VARFLAG_SPLIT_ARC: fprintf(LOG,"\"arcmean\" point"); break; case TABL_VARFLAG_SPLIT_POINT: default: fprintf(LOG,"sample point"); break; } fprintf(LOG," when using adaptive sampling.\n"); empty_line(); fprintf(LOG,"%s: sampling from list of intervals: indexed search (guide table method)\n",gen->genid); fprintf(LOG,"%s: relative guide table size = %g%%",gen->genid,100.*GEN->guide_factor); _unur_print_if_default(gen,TABL_SET_GUIDEFACTOR); fprintf(LOG,"\n"); empty_line(); if (par->set & TABL_SET_SLOPES) { fprintf(LOG,"%s: slopes = %d\n",gen->genid,PAR->n_slopes); for (i=0; in_slopes; i++) { if ( PAR->slopes[2*i] > PAR->slopes[2*i+1] ) fprintf(LOG,"%s: (+) ",gen->genid); else fprintf(LOG,"%s: (-) ",gen->genid); fprintf(LOG,"< %#g, %#g >\n", PAR->slopes[2*i], PAR->slopes[2*i+1] ); } } else fprintf(LOG,"%s: no slopes given. compute from domain and mode.\n",gen->genid); if (PAR->cpoints != NULL) { fprintf(LOG,"%s: cpoints for slopes (%d):\n",gen->genid,PAR->n_cpoints); fprintf(LOG,"%s:\t %g",gen->genid,(PAR->cpoints)[0]); for (i=1; in_cpoints; i++) fprintf(LOG,", %g",(PAR->cpoints)[i]); fprintf(LOG,"\n"); } fprintf(LOG,"%s: number of starting intervals (approx.) = %d",gen->genid,PAR->n_stp); _unur_print_if_default(par,TABL_SET_N_STP); fprintf(LOG,"\n"); empty_line(); } /* end of _unur_tabl_debug_init_start() */ /*****************************************************************************/ void _unur_tabl_debug_init_finished( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write info about generator after setup into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_TABL_GEN,RETURN_VOID); LOG = unur_get_stream(); _unur_tabl_debug_intervals(gen,"INIT completed",TRUE); fprintf(LOG,"%s: INIT completed **********************\n",gen->genid); empty_line(); } /* end of _unur_tabl_debug_init_finished() */ /*****************************************************************************/ void _unur_tabl_debug_dars_start( const struct unur_par *par, const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* print header before runniung DARS into LOG file */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_TABL_GEN,RETURN_VOID); CHECK_NULL(par,RETURN_VOID); COOKIE_CHECK(par,CK_TABL_PAR,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s: DARS started **********************\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: DARS factor = %g",gen->genid,GEN->darsfactor); _unur_print_if_default(par,TABL_SET_DARS_FACTOR); fprintf(LOG,"\n%s:\n",gen->genid); fflush(LOG); } /* end of _unur_tabl_debug_dars_start() */ /*****************************************************************************/ void _unur_tabl_debug_free( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write info about generator before destroying into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_TABL_GEN,RETURN_VOID); LOG = unur_get_stream(); empty_line(); if (gen->status == UNUR_SUCCESS) { fprintf(LOG,"%s: GENERATOR destroyed **********************\n",gen->genid); empty_line(); _unur_tabl_debug_intervals(gen,NULL,TRUE); } else { fprintf(LOG,"%s: initialization of GENERATOR failed **********************\n",gen->genid); } empty_line(); fflush(LOG); } /* end of _unur_tabl_debug_free() */ /*****************************************************************************/ void _unur_tabl_debug_intervals( const struct unur_gen *gen, const char *header, int print_areas ) /*----------------------------------------------------------------------*/ /* write list of intervals into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* header ... header for table */ /* print_areas ... whether table of areas should be printed */ /*----------------------------------------------------------------------*/ { FILE *LOG; struct unur_tabl_interval *iv; double sAsqueeze, Atotal; int i; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_TABL_GEN,RETURN_VOID); LOG = unur_get_stream(); if (header) fprintf(LOG,"%s: %s\n",gen->genid,header); fprintf(LOG,"%s: intervals = %d\n",gen->genid,GEN->n_ivs); if (gen->debug & TABL_DEBUG_IV) { fprintf(LOG,"%s: < max , min > f(max) f(min) \n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); for (iv = GEN->iv, i=0; iv!=NULL; iv=iv->next, i++) { COOKIE_CHECK(iv,CK_TABL_IV,RETURN_VOID); fprintf(LOG,"%s:[%3d]: (%s) < %#-12.6g, %#-12.6g> | %#-12.6g %#-12.6g \n", gen->genid, i, (iv->xmin <= iv->xmax)?"+":"-", iv->xmax, iv->xmin, iv->fmax, iv->fmin); } empty_line(); } if (!print_areas) return; if (GEN->Atotal <= 0.) { fprintf(LOG,"%s: Construction of hat function not successful\n",gen->genid); fprintf(LOG,"%s: Areas may be meaningless !!!!!!!!!!!!!!!!!!\n",gen->genid); empty_line(); Atotal = -1.; /* to avoid floating point exceptions */ } else { Atotal = GEN->Atotal; } /* print and sum areas below squeeze and hat */ if (gen->debug & TABL_DEBUG_IV) { fprintf(LOG,"%s:Areas in intervals:\n",gen->genid); fprintf(LOG,"%s: Nr.\t below squeeze\t\t below hat\t\t cumulated\n",gen->genid); empty_line(); sAsqueeze = 0.; for (iv = GEN->iv, i=0; iv!=NULL; iv=iv->next, i++) { COOKIE_CHECK(iv,CK_TABL_IV,RETURN_VOID); sAsqueeze += iv->Asqueeze; fprintf(LOG,"%s:[%3d]: %-12.6g(%6.3f%%) | %-12.6g(%6.3f%%) | %-12.6g(%6.3f%%)\n", gen->genid,i, iv->Asqueeze, iv->Asqueeze * 100. / Atotal, iv->Ahat, iv->Ahat * 100. / Atotal, iv->Acum, iv->Acum * 100. / Atotal); } fprintf(LOG,"%s: ---------- --------- + ---------- --------- +\n",gen->genid); fprintf(LOG,"%s: Sum : %-12.6g(%6.3f%%) %-12.6g(100%%)\n",gen->genid, sAsqueeze, sAsqueeze * 100. / Atotal, Atotal); empty_line(); } /* summary of areas */ fprintf(LOG,"%s: A(squeeze) = %-12.6g (%6.3f%%)\n",gen->genid, GEN->Asqueeze, GEN->Asqueeze * 100./Atotal); fprintf(LOG,"%s: A(hat\\squeeze) = %-12.6g (%6.3f%%)\n",gen->genid, Atotal - GEN->Asqueeze, (Atotal - GEN->Asqueeze) * 100./Atotal); fprintf(LOG,"%s: A(total) = %-12.6g\n",gen->genid, Atotal); empty_line(); } /* end of _unur_tabl_debug_intervals */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/empk.h0000644001357500135600000002707114420445767013420 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: empk.h * * * * PURPOSE: * * function prototypes for method EMPK * * (EMPirical distribution with Kernel smoothing) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /* =METHOD EMPK EMPirical distribution with Kernel smoothing =UP Methods_for_CEMP =REQUIRED observed sample =SPEED Set-up: slow (as sample is sorted), Sampling: fast (depends on kernel) =REINIT not implemented =REF [HLa00] [HLD04: Sect.12.1.2] =DESCRIPTION EMPK generates random variates from an empirical distribution that is given by an observed sample. The idea is that simply choosing a random point from the sample and to return it with some added noise results in a method that has very nice properties, as it can be seen as sampling from a kernel density estimate. If the underlying distribution is continuous, especially the fine structur of the resulting empirical distribution is much better than using only resampling without noise. Clearly we have to decide about the density of the noise (called kernel) and about the standard deviation of the noise. The mathematical theory of kernel density estimation shows us that we are comparatively free in choosing the kernel. It also supplies us with a simple formula to compute the optimal standarddeviation of the noise, called bandwidth (or window width) of the kernel. The variance of the estimated density is slightly larger than that of the observed sample. However, this can be easily corrected if required. There is also a correction (mirroring technique) for distributions with non-negative support. A simple robust reference method is implemented to find a good standard deviation of the noise (i.e. the bandwidth of kernel density estimation). For some cases (e.g. densities with two or more sharp distinct peaks) there kernel density estimation can be adjusted by changing the smoothness factor and the so called beta factor. =HOWTOUSE EMPK uses empirical distributions. The main parameter is the choice if of kernel density. The most important kernels can be set by unur_empk_set_kernel(). Additionally generators for other kernels can be used by using unur_empk_set_kernelgen() instead. Additionally variance correction and a correction for non-negative variates can be switched on. The two other parameters (smoothing factor and beta factor) are only useful for people knowing the theory of kernel density estimation. It is not necessary to change them if the true underlying distribution is somehow comparable with a bell-shaped curve, even skewed or with some not too sharp extra peaks. In all these cases the simple robust reference method implemented to find a good standard deviation of the noise (i.e. the bandwidth of kernel density estimation) should give sensible results. However, it might be necessary to overwrite this automatic method to find the bandwidth eg. when resampling from data with two or more sharp distinct peaks. Then the distribution has nearly discrete components as well and our automatic method may easily choose too large a bandwidth which results in an empirical distribution which is oversmoothed (i.e. it has lower peaks than the original distribution). Then it is recommended to decrease the bandwidth using the unur_empk_set_smoothing() call. A smoothing factor of @code{1} is the default. A smoothing factor of @code{0} leads to naive resampling of the data. Thus an appropriate value between these extremes should be choosen. We recommend to consult a reference on kernel smoothing when doing so; but it is not a simple problem to determine an optimal bandwidth for distributions with sharp peaks. In general, for most applications it is perfectly ok to use the default values offered. Unless you have some knowledge on density estimation we do not recommend to change anything. There are two exceptions: @enumerate A @item In the case that the unknown underlying distribution is not continuous but discrete you should "turn off" the adding of the noise by setting: @example unur_empk_set_smoothing(par, 0.) @end example @item In the case that you are especially interested in a fast sampling algorithm use the call @example unur_empk_set_kernel(par, UNUR_DISTR_BOXCAR); @end example to change the used noise distribution from the default Gaussian distribution to the uniform distribution. @end enumerate =END */ /*---------------------------------------------------------------------------*/ /* Routines for user interface */ /* =ROUTINES */ UNUR_PAR *unur_empk_new( const UNUR_DISTR *distribution ); /* Get default parameters for generator. */ /*...........................................................................*/ int unur_empk_set_kernel( UNUR_PAR *parameters, unsigned kernel); /* Select one of the supported kernel distributions. Currently the following kernels are supported: @table @code @item UNUR_DISTR_GAUSSIAN Gaussian (normal) kernel @item UNUR_DISTR_EPANECHNIKOV Epanechnikov kernel @item UNUR_DISTR_BOXCAR Boxcar (uniform, rectangular) kernel @item UNUR_DISTR_STUDENT t3 kernel (Student's distribution with 3 degrees of freedom) @item UNUR_DISTR_LOGISTIC logistic kernel @end table For other kernels (including kernels with Student's distribution with other than 3 degrees of freedom) use the unur_empk_set_kernelgen() call. It is not possible to call unur_empk_set_kernel() twice. Default is the Gaussian kernel. */ int unur_empk_set_kernelgen( UNUR_PAR *parameters, const UNUR_GEN *kernelgen, double alpha, double kernelvar ); /* Set generator for the kernel used for density estimation. @var{alpha} is used to compute the optimal bandwidth from the point of view of minimizing the mean integrated square error (MISE). It depends on the kernel K and is given by @example alpha(K) = Var(K)^(-2/5)@{ \int K(t)^2 dt@}^(1/5) @end example For standard kernels (see above) alpha is computed by the algorithm. @var{kernvar} is the variance of the used kernel. It is only required for the variance corrected version of density estimation (which is used by default); otherwise it is ignored. If @var{kernelvar} is nonpositive, variance correction is disabled. For standard kernels (see above) @var{kernvar} is computed by the algorithm. It is not possible to call unur_empk_set_kernelgen() after a standard kernel has been selected by a unur_empk_set_kernel() call. Notice that the uniform random number generator of the kernel generator is overwritten during the unur_init() call and at each unur_chg_urng() call with the uniform generator used for the empirical distribution. Default is the Gaussian kernel. */ int unur_empk_set_beta( UNUR_PAR *parameters, double beta ); /* @var{beta} is used to compute the optimal bandwidth from the point of view of minimizing the mean integrated square error (MISE). @var{beta} depends on the (unknown) distribution of the sampled data points. By default Gaussian distribution is assumed for the sample (@var{beta} = 1.3637439). There is no requirement to change @var{beta}. Default: @code{1.3637439} */ int unur_empk_set_smoothing( UNUR_PAR *parameters, double smoothing ); /* */ int unur_empk_chg_smoothing( UNUR_GEN *generator, double smoothing ); /* Set and change the smoothing factor. The smoothing factor controlles how ``smooth'' the resulting density estimation will be. A smoothing factor equal to @code{0} results in naive resampling. A very large smoothing factor (together with the variance correction) results in a density which is approximately equal to the kernel. Default is 1 which results in a smoothing parameter minimising the MISE (mean integrated squared error) if the data are not too far away from normal. If a large smoothing factor is used, then variance correction must be switched on. Default: @code{1} */ int unur_empk_set_varcor( UNUR_PAR *parameters, int varcor ); /* */ int unur_empk_chg_varcor( UNUR_GEN *generator, int varcor ); /* Switch variance correction in generator on/off. If @var{varcor} is TRUE then the variance of the used density estimation is the same as the sample variance. However this increases the MISE of the estimation a little bit. Default is FALSE. */ int unur_empk_set_positive( UNUR_PAR *parameters, int positive ); /* If @var{positive} is TRUE then only nonnegative random variates are generated. This is done by means of a mirroring technique. Default is FALSE. */ /* =END */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/hist_struct.h0000644001357500135600000000730314420445767015033 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: hist_struct.h * * * * PURPOSE: * * declares structures for method HIST * * (HISTogram of empirical distribution) * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Information for constructing the generator */ struct unur_hist_par { /* the histogram is stored in the distribution object */ int dummy; }; /*---------------------------------------------------------------------------*/ /* The generator object */ struct unur_hist_gen { int n_hist; /* number of bins in histogram */ double *prob; /* probabilities for bins */ double *bins; /* location of bins (when different width) */ double hmin, hmax; /* lower and upper bound for histogram */ double hwidth; /* width of bins (when equal width) */ double sum; /* sum of all probabilities = cumpv[len-1] */ double *cumpv; /* pointer to the vector of cumulated probabilities */ int *guide_table; /* pointer to guide table */ }; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/cext.c0000644001357500135600000007402314420445767013421 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: cext.c * * * * TYPE: continuous univariate random variate * * METHOD: wrapper for external generator * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * ***************************************************************************** * * * CEXT is a wrapper that allows to use external generators within the * * framework of UNURAN. * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include "unur_methods_source.h" #include "x_gen_source.h" #include "cext.h" #include "cext_struct.h" #ifdef UNUR_ENABLE_INFO # include #endif /*---------------------------------------------------------------------------*/ /* Variants: none */ /*---------------------------------------------------------------------------*/ /* Debugging flags */ /* bit 01 ... pameters and structure of generator (do not use here) */ /* bits 02-12 ... setup */ /* bits 13-24 ... adaptive steps */ /* bits 25-32 ... trace sampling */ /*---------------------------------------------------------------------------*/ /* Flags for logging set calls */ /*---------------------------------------------------------------------------*/ #define GENTYPE "CEXT" /* type of generator */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_cext_init( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* Initialize new generator. */ /*---------------------------------------------------------------------------*/ static int _unur_cext_reinit( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Reinitialize generator. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_cext_create( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* create new (almost empty) generator object. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_cext_clone( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* copy (clone) generator object. */ /*---------------------------------------------------------------------------*/ static void _unur_cext_free( struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* destroy generator object. */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* There are sampling routines, since every distribution has its own. */ /* Sampling routines are defined in ../distributions/ for each distributions.*/ /* double _unur_cext_sample( UNUR_GEN *gen ); does not exist! */ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ /* the following functions print debugging information on output stream, */ /* i.e., into the LOG file if not specified otherwise. */ /*---------------------------------------------------------------------------*/ static void _unur_cext_debug_init( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print after generator has been initialized has completed. */ /*---------------------------------------------------------------------------*/ #endif #ifdef UNUR_ENABLE_INFO static void _unur_cext_info( struct unur_gen *gen, int help ); /*---------------------------------------------------------------------------*/ /* create info string. */ /*---------------------------------------------------------------------------*/ #endif /*---------------------------------------------------------------------------*/ /* abbreviations */ #define DISTR_IN distr->data.cont /* data for distribution object */ #define PAR ((struct unur_cext_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_cext_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.cont /* data for distribution in generator object */ #define SAMPLE gen->sample.cont /* pointer to sampling routine */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Public: User Interface (API) **/ /*****************************************************************************/ struct unur_par * unur_cext_new( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get default parameters */ /* */ /* parameters: */ /* distr ... pointer to distribution object (can be NULL!) */ /* */ /* return: */ /* default parameters (pointer to structure) */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_par *par; /* check distribution */ if (distr != NULL) { if (distr->type != UNUR_DISTR_CONT) { _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } COOKIE_CHECK(distr,CK_DISTR_CONT,NULL); } /* allocate structure */ par = _unur_par_new( sizeof(struct unur_cext_par) ); COOKIE_SET(par,CK_CEXT_PAR); /* copy input */ par->distr = distr; /* pointer to distribution object */ /* set default values */ PAR->init = NULL; /* pointer to initialization routine for external generator */ PAR->sample = NULL; /* pointer to sampling routine for external generator */ par->method = UNUR_METH_CEXT; /* method */ par->variant = 0u; /* default variant */ par->set = 0u; /* inidicate default parameters */ par->urng = unur_get_default_urng(); /* use default urng */ par->urng_aux = NULL; /* no auxilliary URNG required */ par->debug = _unur_default_debugflag; /* set default debugging flags */ /* routine for initializing generator */ par->init = _unur_cext_init; return par; } /* end of unur_cext_new() */ /*****************************************************************************/ int unur_cext_set_init( struct unur_par *par, int (*init)(struct unur_gen *gen) ) /*----------------------------------------------------------------------*/ /* set initialization routine for external generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* init ... pointer to initialization routine for external generator */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); /* check input */ _unur_check_par_object( par, CEXT ); /* store date */ PAR->init = init; return UNUR_SUCCESS; } /* end if unur_cext_set_init() */ /*---------------------------------------------------------------------------*/ int unur_cext_set_sample( struct unur_par *par, double (*sample)(struct unur_gen *gen) ) /*----------------------------------------------------------------------*/ /* set sampling routine for external generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* sample ... pointer to sampling routine for external generator */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_NULL( GENTYPE, sample, UNUR_ERR_NULL ); /* check input */ _unur_check_par_object( par, CEXT ); /* store date */ PAR->sample = sample; return UNUR_SUCCESS; } /* end if unur_cext_set_sample() */ /*---------------------------------------------------------------------------*/ void * unur_cext_get_params( struct unur_gen *gen, size_t size ) /*----------------------------------------------------------------------*/ /* Get pointer to memory block for storing parameters of external */ /* generator. The memory block is (re-) allocated if necessary. */ /* If size is set 0, then only the pointer stored in the generator */ /* object is returned. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* size ... size if the memory block */ /* */ /* return: */ /* pointer to memory block that contains parameters */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { /* check input */ _unur_check_NULL( GENTYPE, gen, NULL ); COOKIE_CHECK(gen, CK_CEXT_GEN, NULL); /* Is it really necessary to check the method? No! */ /* if ( gen->method != UNUR_METH_CEXT ) { */ /* _unur_error((gen)->genid,UNUR_ERR_GEN_INVALID,""); */ /* return NULL; */ /* } */ if (size && size != GEN->size_param) { /* allocate memory block */ GEN->param = _unur_xrealloc(GEN->param, size); GEN->size_param = size; } return GEN->param; } /* end of unur_cext_get_params() */ /*---------------------------------------------------------------------------*/ double * unur_cext_get_distrparams( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* Get pointer to array of parameters of underlying distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to double array */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { /* check input */ CHECK_NULL(gen, NULL); COOKIE_CHECK(gen, CK_CEXT_GEN, NULL); return DISTR.params; } /* end of unur_cext_get_distrparams() */ /*---------------------------------------------------------------------------*/ int unur_cext_get_ndistrparams( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* Get size of array of parameters of underlying distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* length of double array */ /* */ /* error: */ /* return 0 */ /*----------------------------------------------------------------------*/ { /* check input */ CHECK_NULL(gen, 0); COOKIE_CHECK(gen, CK_CEXT_GEN, 0); return DISTR.n_params; } /* end of unur_cext_get_ndistrparams() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Private **/ /*****************************************************************************/ struct unur_gen * _unur_cext_init( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* initialize new generator */ /* */ /* parameters: */ /* par ... pointer to paramters for building generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); /* check input */ if ( par->method != UNUR_METH_CEXT ) { _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); return NULL; } COOKIE_CHECK(par,CK_CEXT_PAR,NULL); /* we need a sampling routine */ if (PAR->sample == NULL) { _unur_error(GENTYPE,UNUR_ERR_GEN_CONDITION,"sampling routine missing"); return NULL; } /* create a new empty generator object */ gen = _unur_cext_create(par); _unur_par_free(par); if (!gen) return NULL; /* run special init routine for external generator */ if (GEN->init != NULL) { if (GEN->init(gen) != UNUR_SUCCESS) { /* init failed --> could not find a sampling routine */ _unur_error(GENTYPE,UNUR_FAILURE,"init for external generator failed"); _unur_cext_free(gen); return NULL; } } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_cext_debug_init(gen); #endif /* o.k. */ return gen; } /* end of _unur_cext_init() */ /*---------------------------------------------------------------------------*/ int _unur_cext_reinit( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* re-initialize (existing) generator. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* run special init routine for external generator */ if (GEN->init != NULL) { if (GEN->init(gen) != UNUR_SUCCESS) { /* init failed --> could not find a sampling routine */ _unur_error(GENTYPE,UNUR_FAILURE,"init for external generator failed"); return UNUR_FAILURE; } } /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_cext_reinit() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_cext_create( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* allocate memory for generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* pointer to (empty) generator object with default settings */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; struct unur_distr *distr = NULL; /* check arguments */ CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_CEXT_PAR,NULL); /* need a distribution object */ if (par->distr == NULL) par->distr = distr = unur_distr_cont_new(); /* create new generic generator object */ gen = _unur_generic_create( par, sizeof(struct unur_cext_gen) ); /* magic cookies */ COOKIE_SET(gen,CK_CEXT_GEN); /* set generator identifier */ gen->genid = _unur_set_genid(GENTYPE); /* routines for sampling and destroying generator */ SAMPLE = PAR->sample; /* will be set in _unur_cext_init() */ gen->destroy = _unur_cext_free; gen->clone = _unur_cext_clone; gen->reinit = _unur_cext_reinit; /* copy data */ GEN->init = PAR->init; GEN->sample = PAR->sample; /* defaults */ GEN->param = NULL; /* parameters for the generator */ GEN->size_param = 0; /* size of parameter object */ /* clean up */ if (distr) _unur_distr_free(distr); #ifdef UNUR_ENABLE_INFO /* set function for creating info string */ gen->info = _unur_cext_info; #endif /* return pointer to (almost empty) generator object */ return gen; } /* end of _unur_cext_create() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_cext_clone( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* copy (clone) generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to clone of generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { #define CLONE ((struct unur_cext_gen*)clone->datap) struct unur_gen *clone; /* check arguments */ CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_CEXT_GEN,NULL); /* create generic clone */ clone = _unur_generic_clone( gen, GENTYPE ); /* copy parameters for special generators */ if (GEN->param) { CLONE->param = _unur_xmalloc( GEN->size_param ); memcpy( CLONE->param, GEN->param, GEN->size_param ); } return clone; #undef CLONE } /* end of _unur_cext_clone() */ /*---------------------------------------------------------------------------*/ void _unur_cext_free( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* deallocate generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { /* check arguments */ if( !gen ) /* nothing to do */ return; /* magic cookies */ COOKIE_CHECK(gen,CK_CEXT_GEN,RETURN_VOID); /* check input */ if ( gen->method != UNUR_METH_CEXT ) { _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); return; } /* we cannot use this generator object any more */ SAMPLE = NULL; /* make sure to show up a programming error */ /* free memory */ if (GEN->param) free(GEN->param); _unur_generic_free(gen); } /* end of _unur_cext_free() */ /*****************************************************************************/ /** double _unur_cext_sample( struct unur_gen *gen ) {} Does not exists !!! Sampling routines are set by user via unur_cext_set_sample(). **/ /*****************************************************************************/ /** Auxilliary Routines **/ /*****************************************************************************/ /*****************************************************************************/ /** Debugging utilities **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ void _unur_cext_debug_init( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write info about generator into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_CEXT_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: type = continuous univariate random variates\n",gen->genid); fprintf(LOG,"%s: method = wrapper for external generator\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); /* distribution */ _unur_distr_cont_debug( gen->distr, gen->genid ); } /* end of _unur_cext_info_init() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_INFO /*---------------------------------------------------------------------------*/ void _unur_cext_info( struct unur_gen *gen, int help ) /*----------------------------------------------------------------------*/ /* create character string that contains information about the */ /* given generator object. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* help ... whether to print additional comments */ /*----------------------------------------------------------------------*/ { struct unur_string *info = gen->infostr; int samplesize = 10000; /* generator ID */ _unur_string_append(info,"generator ID: %s\n\n", gen->genid); /* distribution */ _unur_string_append(info,"distribution:\n"); _unur_distr_info_typename(gen); _unur_string_append(info," domain = (%g, %g)\n", DISTR.domain[0],DISTR.domain[1]); _unur_string_append(info,"\n"); /* if (help) { */ /* _unur_string_append(info,"\n"); */ /* } */ /* method */ _unur_string_append(info,"method: CEXT (wrapper for Continuous EXTernal generators)\n"); _unur_string_append(info,"\n"); /* performance */ _unur_string_append(info,"performance characteristics:\n"); _unur_string_append(info," E [#urn] = %.2f [approx.]\n", unur_test_count_urn(gen,samplesize,0,NULL)/((double)samplesize)); _unur_string_append(info,"\n"); /* parameters */ if (help) { _unur_string_append(info,"parameters: none\n"); _unur_string_append(info,"\n"); /* Not displayed: int unur_dext_set_init( UNUR_PAR *parameters, int (*init)(UNUR_GEN *gen) ); int unur_dext_set_sample( UNUR_PAR *parameters, int (*sample)(UNUR_GEN *gen) ); */ } /* Hints */ /* if (help) { */ /* _unur_string_append(info,"\n"); */ /* } */ } /* end of _unur_cext_info() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_INFO */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/vempk_struct.h0000644001357500135600000000754614420304141015173 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: vempk_struct.h * * * * PURPOSE: * * declares structures for method VEMPK * * ((Vector) EMPirical distribution with Kernel smoothing) * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Information for constructing the generator */ struct unur_vempk_par { /* the observed sample is stored in the distribution object */ double smoothing; /* determines how "smooth" the estimated density will be */ }; /*---------------------------------------------------------------------------*/ /* The generator object */ struct unur_vempk_gen { double *observ; /* pointer to the array of the observations */ int n_observ; /* number of observations */ int dim; /* dimension of distribution */ UNUR_GEN *kerngen; /* random variate generator for kernel */ double smoothing; /* determines how "smooth" the estimated density will be */ double hopt; /* for bandwidth selection */ double hact; /* actually used value for bandwith */ double corfac; /* correction for variance correction */ double *xbar; /* mean vector of sample, for variance correction */ }; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/dstd.c0000644001357500135600000013245414420445767013417 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: dstd.c * * * * TYPE: discrete univariate random variate * * METHOD: generators for standard distribution * * * ***************************************************************************** * * * Copyright (c) 2000-2011 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * ***************************************************************************** * * * DSTD is a wrapper for special generator for Discrete univariate * * STandarD distributions. It only works for distributions in the UNURAN * * library of distributions or those discrete distributions that have * * the inverse CDF implemented. Otherwise it refuses to work. * * * * It calls the initialization routine provided by the distribution object. * * This routine has to do all setup steps for the special generator. * * If no such routine is given (i.e. distr->init==NULL) or when it does not * * implement the inversion method then the inverse CDF stored in the * * distribution object (if available) is used. * * If neither is available, then unur_dstd_new() does not work and the * * NULL pointer is returned instead of the pointer to a parameter object. * * * * Notice that using a truncated distribution (this can be constructed by * * changing the default domain of a distribution by means of an * * unur_distr_discr_set_domain() call) is only allowed if the inversion * * method is used. Otherwise no parameter object is returned by the * * unur_dstd_new() call. * * * * Variants (different algorithms for the same distribution) are possible * * and can be selected by unsigned integers using the * * unur_dstd_set_variant() call. * * For possible variants see the generator files for each distribution in * * the distributions directory. However the following are common to all * * distributions: * * * * UNUR_STDGEN_DEFAULT ... the default generator * * UNUR_STDGEN_INVERSION ... the inversion method (if available) * * UNUR_STDGEN_FAST ... the fasted available special generator * * * * unur_dstd_set_variant() return 0 if a variant is not implemented, and 1 * * otherwise. In the first case the selected variant is not changed. * * * * The domain of a (truncated) distribution can be changed without building * * a new generator object by means of the unur_dstd_chg_truncated() call. * * Notice that this only works when the inversion method is used. Otherwise * * nothing happens to the domain and an error message is produced. * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include #include #include "unur_methods_source.h" #include "x_gen_source.h" #include "cstd.h" /* required for UNUR_STDGEN_* macros */ #include "dstd.h" #include "dstd_struct.h" #ifdef UNUR_ENABLE_INFO # include #endif /*---------------------------------------------------------------------------*/ /* Variants: none */ /*---------------------------------------------------------------------------*/ /* Debugging flags */ /* bit 01 ... pameters and structure of generator (do not use here) */ /* bits 02-12 ... setup */ /* bits 13-24 ... adaptive steps */ /* bits 25-32 ... trace sampling */ #define DSTD_DEBUG_GEN 0x00000005u /* print constants for generator */ #define DSTD_DEBUG_REINIT 0x00000010u /* print params of distr after reinit */ #define DSTD_DEBUG_CHG 0x00001000u /* print changed params of distr */ /*---------------------------------------------------------------------------*/ /* Flags for logging set calls */ #define DSTD_SET_VARIANT 0x01u /*---------------------------------------------------------------------------*/ #define GENTYPE "DSTD" /* type of generator */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_dstd_init( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* Initialize new generator. */ /*---------------------------------------------------------------------------*/ static int _unur_dstd_reinit( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Reinitialize generator. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_dstd_create( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* create new (almost empty) generator object. */ /*---------------------------------------------------------------------------*/ static int _unur_dstd_check_par( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Check parameters of given distribution and method */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_dstd_clone( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* copy (clone) generator object. */ /*---------------------------------------------------------------------------*/ static void _unur_dstd_free( struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* destroy generator object. */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* There are no sampling routines, since every distribution has its own. */ /* Sampling routines are defined in ../distributions/ for each distributions.*/ /* double _unur_dstd_sample( UNUR_GEN *gen ); does not exist! */ /*---------------------------------------------------------------------------*/ static int _unur_dstd_sample_inv( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Generic inversion method. */ /*---------------------------------------------------------------------------*/ static int _unur_dstd_inversion_init( struct unur_par *par, struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Initialize special generator for inversion method. */ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ /* the following functions print debugging information on output stream, */ /* i.e., into the LOG file if not specified otherwise. */ /*---------------------------------------------------------------------------*/ static void _unur_dstd_debug_init( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print after generator has been initialized has completed. */ /*---------------------------------------------------------------------------*/ static void _unur_dstd_debug_chg_pmfparams( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print new (changed) parameters of distribution */ /*---------------------------------------------------------------------------*/ static void _unur_dstd_debug_chg_truncated( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print new (changed) domain of (truncated) distribution */ /*---------------------------------------------------------------------------*/ #endif #ifdef UNUR_ENABLE_INFO static void _unur_dstd_info( struct unur_gen *gen, int help ); /*---------------------------------------------------------------------------*/ /* create info string. */ /*---------------------------------------------------------------------------*/ #endif /*---------------------------------------------------------------------------*/ /* abbreviations */ #define DISTR_IN distr->data.discr /* data for distribution object */ #define PAR ((struct unur_dstd_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_dstd_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.discr /* data for distribution in generator object */ #define SAMPLE gen->sample.discr /* pointer to sampling routine */ #define CDF(x) _unur_discr_CDF((x),(gen->distr)) /* call to CDF */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Public: User Interface (API) **/ /*****************************************************************************/ struct unur_par * unur_dstd_new( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get default parameters */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* default parameters (pointer to structure) */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_par *par; /* check arguments */ _unur_check_NULL(GENTYPE,distr,NULL); /* check distribution */ if (distr->type != UNUR_DISTR_DISCR) { _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } COOKIE_CHECK(distr,CK_DISTR_DISCR,NULL); if (DISTR_IN.init == NULL && DISTR_IN.invcdf == NULL) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"init() for special generators or inverse CDF"); return NULL; } /* allocate structure */ par = _unur_par_new( sizeof(struct unur_dstd_par) ); COOKIE_SET(par,CK_DSTD_PAR); /* copy input */ par->distr = distr; /* pointer to distribution object */ /* set default values */ par->method = UNUR_METH_DSTD; /* method */ par->variant = 0u; /* default variant */ par->set = 0u; /* indicate default parameters */ par->urng = unur_get_default_urng(); /* use default urng */ par->urng_aux = NULL; /* no auxilliary URNG required */ par->debug = _unur_default_debugflag; /* set default debugging flags */ /* routine for initializing generator */ par->init = _unur_dstd_init; return par; } /* end of unur_dstd_new() */ /*****************************************************************************/ int unur_dstd_set_variant( struct unur_par *par, unsigned variant ) /*----------------------------------------------------------------------*/ /* set variant of method */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* variant ... indicator for variant */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { unsigned old_variant; /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_NULL( GENTYPE, par->distr, UNUR_ERR_NULL ); _unur_check_par_object( par, DSTD ); /* store date */ old_variant = par->variant; par->variant = variant; /* check variant. run special init routine only in test mode */ if ( (par->DISTR_IN.init == NULL || par->DISTR_IN.init(par,NULL)!=UNUR_SUCCESS) && _unur_dstd_inversion_init(par,NULL)!=UNUR_SUCCESS ) { /* variant not valid */ _unur_warning(GENTYPE,UNUR_ERR_PAR_VARIANT,""); par->variant = old_variant; return UNUR_ERR_PAR_VARIANT; } /* changelog */ par->set |= DSTD_SET_VARIANT; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_dstd_set_variant() */ /*---------------------------------------------------------------------------*/ int unur_dstd_chg_truncated( struct unur_gen *gen, int left, int right ) /*----------------------------------------------------------------------*/ /* change the left and right borders of the domain of the */ /* (truncated) distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* left ... left boundary point */ /* right ... right boundary point */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* the new boundary points may be +/- UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { double Umin, Umax; /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, DSTD, UNUR_ERR_GEN_INVALID ); /* domain can only be changed for inversion method! */ if ( ! GEN->is_inversion ) { /* this is not the inversion method */ _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"truncated domain for non-inversion method"); return UNUR_ERR_GEN_DATA; } /* CDF required ! */ if (DISTR.cdf == NULL) { _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"truncated domain, CDF required"); return UNUR_ERR_GEN_DATA; } /* check new parameter for generator */ /* (the truncated domain must be a subset of the domain) */ if (left < DISTR.domain[0]) { _unur_warning(NULL,UNUR_ERR_DISTR_SET,"truncated domain too large"); left = DISTR.domain[0]; } if (right > DISTR.domain[1]) { _unur_warning(NULL,UNUR_ERR_DISTR_SET,"truncated domain too large"); right = DISTR.domain[1]; } if (left >= right) { _unur_warning(NULL,UNUR_ERR_DISTR_SET,"domain, left >= right"); return UNUR_ERR_DISTR_SET; } /* compute umin and umax */ Umin = (left <= INT_MIN) ? 0. : CDF(left-1); Umax = CDF(right); /* check result */ if (Umin > Umax) { /* this is a serios error that should not happen */ _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); return UNUR_ERR_SHOULD_NOT_HAPPEN; } if (_unur_FP_equal(Umin,Umax)) { /* CDF values very close */ _unur_warning(gen->genid,UNUR_ERR_DISTR_SET,"CDF values very close"); if (_unur_iszero(Umin) || _unur_FP_same(Umax,1.)) { /* this is very bad */ _unur_warning(gen->genid,UNUR_ERR_DISTR_SET,"CDF values at boundary points too close"); return UNUR_ERR_DISTR_SET; } } /* copy new boundaries into generator object */ DISTR.trunc[0] = left; DISTR.trunc[1] = right; GEN->Umin = Umin; GEN->Umax = Umax; /* changelog */ gen->distr->set |= UNUR_DISTR_SET_TRUNCATED; /* indicate that we have a truncated distribution. (do not have the standard domain any more) */ gen->distr->set &= ~UNUR_DISTR_SET_STDDOMAIN; #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug & DSTD_DEBUG_CHG) _unur_dstd_debug_chg_truncated( gen ); #endif /* o.k. */ return UNUR_SUCCESS; } /* end of unur_dstd_chg_truncated() */ /*****************************************************************************/ /** Private **/ /*****************************************************************************/ struct unur_gen * _unur_dstd_init( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* initialize new generator */ /* */ /* parameters: */ /* par ... pointer to paramters for building generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); /* check input */ if ( par->method != UNUR_METH_DSTD ) { _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); return NULL; } COOKIE_CHECK(par,CK_DSTD_PAR,NULL); /* create a new empty generator object */ gen = _unur_dstd_create(par); _unur_par_free(par); if (!gen) return NULL; /* run special init routine for generator */ GEN->is_inversion = FALSE; /* reset flag for inversion method */ if ( (DISTR.init == NULL || DISTR.init(NULL,gen)!=UNUR_SUCCESS) && _unur_dstd_inversion_init(NULL,gen)!=UNUR_SUCCESS ) { /* init failed --> could not find a sampling routine */ _unur_error(GENTYPE,UNUR_ERR_GEN_DATA,"variant for special generator"); _unur_dstd_free(gen); return NULL; } /* check parameters */ if (_unur_dstd_check_par(gen) != UNUR_SUCCESS) { _unur_dstd_free(gen); return NULL; } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_dstd_debug_init(gen); #endif /* o.k. */ return gen; } /* end of _unur_dstd_init() */ /*---------------------------------------------------------------------------*/ int _unur_dstd_reinit( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* re-initialize (existing) generator. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int rcode; /* run special init routine for generator */ GEN->is_inversion = FALSE; /* reset flag for inversion method */ if ( (DISTR.init == NULL || DISTR.init(NULL,gen)!=UNUR_SUCCESS) && _unur_dstd_inversion_init(NULL,gen)!=UNUR_SUCCESS ) { /* init failed --> could not find a sampling routine */ _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"parameters"); return UNUR_ERR_GEN_DATA; } /* check parameters */ if ( (rcode = _unur_dstd_check_par(gen)) != UNUR_SUCCESS) return rcode; #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug & DSTD_DEBUG_REINIT) _unur_dstd_debug_chg_pmfparams( gen ); #endif /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_dstd_reinit() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_dstd_create( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* allocate memory for generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* pointer to (empty) generator object with default settings */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_DSTD_PAR,NULL); /* create new generic generator object */ gen = _unur_generic_create( par, sizeof(struct unur_dstd_gen) ); /* magic cookies */ COOKIE_SET(gen,CK_DSTD_GEN); /* set generator identifier */ gen->genid = _unur_set_genid(GENTYPE); /* routines for sampling and destroying generator */ SAMPLE = NULL; /* will be set in _unur_dstd_init() */ gen->destroy = _unur_dstd_free; gen->clone = _unur_dstd_clone; gen->reinit = _unur_dstd_reinit; /* defaults */ GEN->gen_param = NULL; /* parameters for the generator */ GEN->n_gen_param = 0; /* (computed in special GEN->init() */ GEN->gen_iparam = NULL; /* array for integer parameters */ GEN->n_gen_iparam = 0; GEN->is_inversion = FALSE; /* method not based on inversion */ GEN->sample_routine_name = NULL ; /* name of sampling routine */ /* copy some parameters into generator object */ GEN->Umin = 0.; /* cdf at left boundary of domain */ GEN->Umax = 1.; /* cdf at right boundary of domain */ /* GEN->is_inversion is set in _unur_dstd_inversion_init() */ #ifdef UNUR_ENABLE_INFO /* set function for creating info string */ gen->info = _unur_dstd_info; #endif /* return pointer to (almost empty) generator object */ return gen; } /* end of _unur_dstd_create() */ /*---------------------------------------------------------------------------*/ int _unur_dstd_check_par( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* check parameters of given distribution and method */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* domain valid for special generator ?? */ if (!(gen->distr->set & UNUR_DISTR_SET_STDDOMAIN)) { /* domain has been modified */ gen->distr->set &= UNUR_DISTR_SET_TRUNCATED; DISTR.trunc[0] = DISTR.domain[0]; DISTR.trunc[1] = DISTR.domain[1]; if ( ! GEN->is_inversion ) { /* this is not the inversion method */ _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"domain changed for non inversion method"); return UNUR_ERR_GEN_DATA; } if (DISTR.cdf == NULL) { /* using a truncated distribution requires a CDF */ _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"domain changed, CDF required"); return UNUR_ERR_GEN_DATA; } /* compute Umin and Umax */ GEN->Umin = (DISTR.trunc[0] <= INT_MIN) ? 0. : CDF(DISTR.trunc[0]-1); GEN->Umax = CDF(DISTR.trunc[1]); } return UNUR_SUCCESS; } /* end of _unur_dstd_check_par() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_dstd_clone( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* copy (clone) generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to clone of generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { #define CLONE ((struct unur_dstd_gen*)clone->datap) struct unur_gen *clone; /* check arguments */ CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_DSTD_GEN,NULL); /* create generic clone */ clone = _unur_generic_clone( gen, GENTYPE ); /* copy parameters for special generators */ if (GEN->gen_param) { CLONE->gen_param = _unur_xmalloc( GEN->n_gen_param * sizeof(double) ); memcpy( CLONE->gen_param, GEN->gen_param, GEN->n_gen_param * sizeof(double) ); } if (GEN->gen_iparam) { CLONE->gen_iparam = _unur_xmalloc( GEN->n_gen_iparam * sizeof(int) ); memcpy( CLONE->gen_iparam, GEN->gen_iparam, GEN->n_gen_iparam * sizeof(int) ); } return clone; #undef CLONE } /* end of _unur_dstd_clone() */ /*---------------------------------------------------------------------------*/ void _unur_dstd_free( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* deallocate generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { /* check arguments */ if( !gen ) /* nothing to do */ return; /* magic cookies */ COOKIE_CHECK(gen,CK_DSTD_GEN,RETURN_VOID); /* check input */ if ( gen->method != UNUR_METH_DSTD ) { _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); return; } /* we cannot use this generator object any more */ SAMPLE = NULL; /* make sure to show up a programming error */ /* free memory */ if (GEN->gen_param) free(GEN->gen_param); if (GEN->gen_iparam) free(GEN->gen_iparam); _unur_generic_free(gen); } /* end of _unur_dstd_free() */ /*****************************************************************************/ /** double _unur_dstd_sample( struct unur_gen *gen ) {} Does not exists !!! Sampling routines are defined in ../distributions/ for each distributions. **/ /*****************************************************************************/ int _unur_dstd_sample_inv( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* generic inversion method. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return INT_MAX */ /*----------------------------------------------------------------------*/ { double U; if (!DISTR.invcdf) return INT_MAX; /* sample from uniform random number generator */ while (_unur_iszero(U = GEN->Umin + _unur_call_urng(gen->urng) * (GEN->Umax-GEN->Umin))); /* compute inverse CDF */ return ((int) DISTR.invcdf(U,gen->distr)); } /* _unur_dstd_sample_inv() */ /*---------------------------------------------------------------------------*/ int unur_dstd_eval_invcdf( const struct unur_gen *gen, double u ) /*----------------------------------------------------------------------*/ /* evaluate inverse CDF at u. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* u ... argument for inverse CDF (0<=u<=1, no validation!) */ /* */ /* return: */ /* int (inverse CDF) */ /* */ /* error: */ /* return INT_MAX */ /*----------------------------------------------------------------------*/ { int k; /* check arguments */ _unur_check_NULL( GENTYPE, gen, INT_MAX ); if ( gen->method != UNUR_METH_DSTD ) { _unur_error(gen->genid,UNUR_ERR_GEN_INVALID,""); return INT_MAX; } COOKIE_CHECK(gen,CK_DSTD_GEN,INT_MAX); if (!DISTR.invcdf) { /* no inverse CDF available */ _unur_error(gen->genid,UNUR_ERR_NO_QUANTILE,"inversion CDF required"); return INT_MAX; } if ( ! (u>0. && u<1.)) { if ( ! (u>=0. && u<=1.)) { _unur_warning(gen->genid,UNUR_ERR_DOMAIN,"U not in [0,1]"); } if (u<=0.) return DISTR.trunc[0]; if (u>=1.) return DISTR.trunc[1]; return INT_MAX; /* u == NaN */ } /* rescale given u */ u = GEN->Umin + u * (GEN->Umax - GEN->Umin); /* compute inverse CDF */ k = DISTR.invcdf(u,gen->distr); /* validate range */ if (kDISTR.trunc[1]) k = DISTR.trunc[1]; return k; } /* end of unur_dstd_eval_invcdf() */ /*****************************************************************************/ /** Auxilliary Routines **/ /*****************************************************************************/ int _unur_dstd_inversion_init( struct unur_par *par, struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* initialize special generator for inversion method */ /* when inverse CDF is available for the distribution. */ /* if gen == NULL then only check existance of variant. */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* one of par and gen must not be the NULL pointer */ switch ((par) ? par->variant : gen->variant) { case 0: /* DEFAULT */ case UNUR_STDGEN_INVERSION: /* inversion method */ if (gen) { if (DISTR.invcdf) { GEN->is_inversion = TRUE; _unur_dstd_set_sampling_routine(gen,_unur_dstd_sample_inv); return UNUR_SUCCESS; } } else { if ((par->distr->data.discr).invcdf) { return UNUR_SUCCESS; } } /* FALLTHROUGH */ default: /* no such generator */ if (gen) _unur_warning(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); return UNUR_FAILURE; } } /* end of _unur_dstd_inversion_init() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Debugging utilities **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ void _unur_dstd_debug_init( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write info about generator into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; int i; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_DSTD_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: type = discrete univariate random variates\n",gen->genid); fprintf(LOG,"%s: method = generator for standard distribution\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); /* distribution */ _unur_distr_discr_debug( gen->distr, gen->genid, FALSE ); /* sampling routine */ fprintf(LOG,"%s: sampling routine = ",gen->genid); if (GEN->sample_routine_name) fprintf(LOG,"%s()",GEN->sample_routine_name); else fprintf(LOG,"(Unknown)"); if (GEN->is_inversion) fprintf(LOG," (Inversion)"); fprintf(LOG,"\n%s:\n",gen->genid); /* table of precomputed constants for special generators */ if (gen->debug & DSTD_DEBUG_GEN) { fprintf(LOG,"%s: precomputed double constants for routine: ",gen->genid); if (GEN->gen_param) { fprintf(LOG,"%d\n",GEN->n_gen_param); for (i=0; i < GEN->n_gen_param; i++) fprintf(LOG,"%s:\t[%d] = %g\n",gen->genid,i,GEN->gen_param[i]); } else { fprintf(LOG,"none\n"); } fprintf(LOG,"%s: precomputed integer constants for routine: ",gen->genid); if (GEN->gen_iparam) { fprintf(LOG,"%d\n",GEN->n_gen_iparam); for (i=0; i < GEN->n_gen_iparam; i++) fprintf(LOG,"%s:\t[%d] = %d\n",gen->genid,i,GEN->gen_iparam[i]); } else { fprintf(LOG,"none\n"); } fprintf(LOG,"%s:\n",gen->genid); } /* truncated domain ? */ if (!(gen->distr->set & UNUR_DISTR_SET_STDDOMAIN)) { fprintf(LOG,"%s: domain has been changed. U in (%g,%g)\n",gen->genid,GEN->Umin,GEN->Umax); fprintf(LOG,"%s:\n",gen->genid); } fflush(LOG); } /* end of _unur_dstd_debug_init() */ /*---------------------------------------------------------------------------*/ void _unur_dstd_debug_chg_pmfparams( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* print new (changed) parameters of distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; int i; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_DSTD_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s: parameters of distribution changed:\n",gen->genid); for( i=0; igenid,i,DISTR.params[i]); } /* end of _unur_dstd_debug_chg_pmfparams() */ /*---------------------------------------------------------------------------*/ void _unur_dstd_debug_chg_truncated( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* print new (changed) domain of (truncated) distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_DSTD_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s: domain of truncated distribution changed:\n",gen->genid); fprintf(LOG,"%s:\tdomain = (%d, %d)\n",gen->genid, DISTR.trunc[0], DISTR.trunc[1]); fprintf(LOG,"%s:\tU in (%g,%g)\n",gen->genid,GEN->Umin,GEN->Umax); } /* end of _unur_dstd_debug_chg_truncated() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_INFO /*---------------------------------------------------------------------------*/ void _unur_dstd_info( struct unur_gen *gen, int help ) /*----------------------------------------------------------------------*/ /* create character string that contains information about the */ /* given generator object. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* help ... whether to print additional comments */ /*----------------------------------------------------------------------*/ { struct unur_string *info = gen->infostr; int samplesize = 10000; int i; /* generator ID */ _unur_string_append(info,"generator ID: %s\n\n", gen->genid); /* distribution */ _unur_string_append(info,"distribution:\n"); _unur_distr_info_typename(gen); _unur_string_append(info," domain = (%d, %d)\n", DISTR.domain[0],DISTR.domain[1]); _unur_string_append(info,"\n"); /* if (help) { */ /* _unur_string_append(info,"\n"); */ /* } */ /* method */ _unur_string_append(info,"method: DSTD (special generator for Discrete STandarD distribution)\n"); _unur_string_append(info," variant = %d %s\n", gen->variant, (GEN->is_inversion)?"[implements inversion method]" : ""); _unur_string_append(info,"\n"); /* performance */ _unur_string_append(info,"performance characteristics:\n"); _unur_string_append(info," E [#urn] = %.2f [approx.]\n", unur_test_count_urn(gen,samplesize,0,NULL)/((double)samplesize)); _unur_string_append(info,"\n"); /* parameters */ if (help) { _unur_string_append(info,"parameters:\n"); _unur_string_append(info," variant = %d %s\n", gen->variant, (gen->set & DSTD_SET_VARIANT) ? "" : "[default]"); _unur_string_append(info,"\n"); } /* tables */ if (help) { _unur_string_append(info,"table of precomputed double constants: "); if (GEN->gen_param) { _unur_string_append(info,"%d\n",GEN->n_gen_param); for (i=0; i < GEN->n_gen_param; i++) _unur_string_append(info," [%d] = %g\n",i,GEN->gen_param[i]); } else { _unur_string_append(info,"none\n"); } _unur_string_append(info,"table of precomputed integer constants: "); if (GEN->gen_iparam) { _unur_string_append(info,"%d\n",GEN->n_gen_iparam); for (i=0; i < GEN->n_gen_iparam; i++) _unur_string_append(info," [%d] = %d\n",i,GEN->gen_iparam[i]); } else { _unur_string_append(info,"none\n"); } _unur_string_append(info,"\n"); } /* Hints */ /* if (help) { */ /* _unur_string_append(info,"\n"); */ /* } */ } /* end of _unur_dstd_info() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_INFO */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/ars.c0000644001357500135600000035154014420445767013245 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: ars.c * * * * TYPE: continuous univariate random variate * * METHOD: adaptive rejection sampling (Gilks & Wild) * * * * DESCRIPTION: * * Given logPDF of a log-concave distribution * * produce a value x consistent with its density * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * ***************************************************************************** * * * REFERENCES and DESCRIPTION: * * * * This is special implementation of the TDR method that requires the * * logPDF of a distribution and uses solely adaptive rejection sampling * * for finding constrution points as proposed by Gilks & Wild (1992). * * * * See tdr.c for further information. * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Store intersection point in structure when defined. */ #ifdef DEBUG_STORE_IP # undef DEBUG_STORE_IP #endif /* #define DEBUG_STORE_IP 1 */ /*---------------------------------------------------------------------------*/ #include #include #include #include #include "unur_methods_source.h" #include "x_gen_source.h" #include "ars.h" #include "ars_struct.h" #ifdef UNUR_ENABLE_INFO # include #endif /*---------------------------------------------------------------------------*/ /* Constants */ /*---------------------------------------------------------------------------*/ /* Variants */ #define ARS_VARFLAG_VERIFY 0x0100u /* flag for verifying mode */ #define ARS_VARFLAG_PEDANTIC 0x0800u /* whether pedantic checking is used */ /*---------------------------------------------------------------------------*/ /* Debugging flags */ /* bit 01 ... pameters and structure of generator (do not use here) */ /* bits 02-12 ... setup */ /* bits 13-24 ... adaptive steps */ /* bits 25-32 ... trace sampling */ #define ARS_DEBUG_REINIT 0x00000002u /* print parameters after reinit */ #define ARS_DEBUG_IV 0x00000010u #define ARS_DEBUG_SPLIT 0x00010000u /*---------------------------------------------------------------------------*/ /* Flags for logging set calls */ #define ARS_SET_CPOINTS 0x001u #define ARS_SET_N_CPOINTS 0x002u #define ARS_SET_PERCENTILES 0x004u #define ARS_SET_N_PERCENTILES 0x008u #define ARS_SET_RETRY_NCPOINTS 0x010u #define ARS_SET_MAX_IVS 0x020u #define ARS_SET_MAX_ITER 0x040u /* maximum number of iterations */ /*---------------------------------------------------------------------------*/ #define GENTYPE "ARS" /* type of generator */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_ars_init( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* Initialize new generator. */ /*---------------------------------------------------------------------------*/ static int _unur_ars_reinit( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Reinitialize generator. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_ars_create( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* create new (almost empty) generator object. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_ars_clone( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* copy (clone) generator object. */ /*---------------------------------------------------------------------------*/ static void _unur_ars_free( struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* destroy generator object. */ /*---------------------------------------------------------------------------*/ static double _unur_ars_sample( struct unur_gen *generator ); static double _unur_ars_sample_check( struct unur_gen *generator ); /*---------------------------------------------------------------------------*/ /* sample from generator */ /*---------------------------------------------------------------------------*/ static int _unur_ars_starting_cpoints( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* create list of construction points for starting segments. */ /* if user has not provided such points compute these by means of the */ /* "equi-angle rule". */ /*---------------------------------------------------------------------------*/ static int _unur_ars_starting_intervals( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* compute intervals from given starting construction points. */ /*---------------------------------------------------------------------------*/ static int _unur_ars_interval_parameter( struct unur_gen *gen, struct unur_ars_interval *iv ); /*---------------------------------------------------------------------------*/ /* compute all necessary data for interval. */ /*---------------------------------------------------------------------------*/ static struct unur_ars_interval *_unur_ars_interval_new( struct unur_gen *gen, double x, double logfx ); /*---------------------------------------------------------------------------*/ /* make a new interval with left construction point x. */ /*---------------------------------------------------------------------------*/ static int _unur_ars_tangent_intersection_point( struct unur_gen *gen, struct unur_ars_interval *iv, double *ipt ); /*---------------------------------------------------------------------------*/ /* compute cutting point of interval into left and right part. */ /*---------------------------------------------------------------------------*/ static double _unur_ars_interval_logarea( struct unur_gen *gen, struct unur_ars_interval *iv, double slope, double x ); /*---------------------------------------------------------------------------*/ /* compute log of area below piece of hat or squeeze in interval. */ /*---------------------------------------------------------------------------*/ static int _unur_ars_interval_split( struct unur_gen *gen, struct unur_ars_interval *iv_old, double x, double logfx ); /*---------------------------------------------------------------------------*/ /* split am interval point x. return 0 if not successful. */ /*---------------------------------------------------------------------------*/ static int _unur_ars_improve_hat( struct unur_gen *gen, struct unur_ars_interval *iv, double x, double logfx); /*---------------------------------------------------------------------------*/ /* improve hat function by splitting interval */ /*---------------------------------------------------------------------------*/ static int _unur_ars_make_area_table( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* make table of areas and compute largest area for rescaling. */ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ /* the following functions print debugging information on output stream, */ /* i.e., into the LOG file if not specified otherwise. */ /*---------------------------------------------------------------------------*/ static void _unur_ars_debug_init_start( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print after (almost empty generator) object has been created. */ /*---------------------------------------------------------------------------*/ static void _unur_ars_debug_init_finished( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print after generator has been initialized. */ /*---------------------------------------------------------------------------*/ static void _unur_ars_debug_reinit_start( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print before reinitialization of generator starts. */ /*---------------------------------------------------------------------------*/ static void _unur_ars_debug_reinit_retry( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print before second trial of reinitialization of generator starts. */ /*---------------------------------------------------------------------------*/ static void _unur_ars_debug_reinit_finished( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print after generator has been reinitialized. */ /*---------------------------------------------------------------------------*/ static void _unur_ars_debug_free( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print before generater is destroyed. */ /*---------------------------------------------------------------------------*/ static void _unur_ars_debug_intervals( const struct unur_gen *gen, const char *header, int print_areas ); /*---------------------------------------------------------------------------*/ /* print data for intervals */ /*---------------------------------------------------------------------------*/ static void _unur_ars_debug_split_start( const struct unur_gen *gen, const struct unur_ars_interval *iv, double x, double logfx ); static void _unur_ars_debug_split_stop( const struct unur_gen *gen, const struct unur_ars_interval *iv_left, const struct unur_ars_interval *iv_right ); /*---------------------------------------------------------------------------*/ /* print before and after an interval has been split (not / successfully). */ /*---------------------------------------------------------------------------*/ #endif #ifdef UNUR_ENABLE_INFO static void _unur_ars_info( struct unur_gen *gen, int help ); /*---------------------------------------------------------------------------*/ /* create info string. */ /*---------------------------------------------------------------------------*/ #endif /*---------------------------------------------------------------------------*/ /* abbreviations */ #define DISTR_IN distr->data.cont /* data for distribution object */ #define PAR ((struct unur_ars_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_ars_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.cont /* data for distribution in generator object */ #define BD_LEFT domain[0] /* left boundary of domain of distribution */ #define BD_RIGHT domain[1] /* right boundary of domain of distribution */ #define SAMPLE gen->sample.cont /* pointer to sampling routine */ #define logPDF(x) _unur_cont_logPDF((x),(gen->distr)) /* call to logPDF */ #define dlogPDF(x) _unur_cont_dlogPDF((x),(gen->distr)) /* call to derivative of log PDF */ /* areas in intervaled relative to maximal area */ #define scaled_logarea(iv) ((iv)->logAhat - GEN->logAmax) #define scaled_area(iv) (exp(scaled_logarea(iv))) /* log of function rescaled relative to maximal area */ #define rescaled_logf(logf) ((logf) - GEN->logAmax) /*---------------------------------------------------------------------------*/ #define _unur_ars_getSAMPLE(gen) \ ( ((gen)->variant & ARS_VARFLAG_VERIFY) \ ? _unur_ars_sample_check : _unur_ars_sample ) /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Public: User Interface (API) **/ /*****************************************************************************/ struct unur_par * unur_ars_new( const struct unur_distr* distr ) /*----------------------------------------------------------------------*/ /* get default parameters */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* default parameters (pointer to structure) */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_par *par; /* check arguments */ _unur_check_NULL( GENTYPE,distr,NULL ); /* check distribution */ if (distr->type != UNUR_DISTR_CONT) { _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } COOKIE_CHECK(distr,CK_DISTR_CONT,NULL); if (DISTR_IN.logpdf == NULL) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"logPDF"); return NULL; } if (DISTR_IN.dlogpdf == NULL) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"derivative of logPDF"); return NULL; } /* allocate structure */ par = _unur_par_new( sizeof(struct unur_ars_par) ); COOKIE_SET(par,CK_ARS_PAR); /* copy input */ par->distr = distr; /* pointer to distribution object */ /* set default values */ PAR->starting_cpoints = NULL; /* pointer to array of starting points */ PAR->n_starting_cpoints = 2; /* number of starting points */ PAR->percentiles = NULL; /* pointer to array of percentiles */ PAR->n_percentiles = 2; /* number of percentiles */ PAR->retry_ncpoints = 30; /* number of cpoints for second trial of reinit */ PAR->max_ivs = 200; /* maximum number of intervals */ PAR->max_iter = 10000; /* maximum number of iterations */ par->method = UNUR_METH_ARS; /* method */ par->variant = 0u; /* default variant */ par->set = 0u; /* inidicate default parameters */ par->urng = unur_get_default_urng(); /* use default URNG */ par->urng_aux = par->urng; /* no special auxilliary URNG */ par->debug = _unur_default_debugflag; /* set default debugging flags */ /* routine for starting generator */ par->init = _unur_ars_init; return par; } /* end of unur_ars_new() */ /*****************************************************************************/ int unur_ars_set_max_intervals( struct unur_par *par, int max_ivs ) /*----------------------------------------------------------------------*/ /* set maximum number of intervals */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* max_ivs ... maximum number of intervals */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, ARS ); /* check new parameter for generator */ if (max_ivs < 1 ) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"maximum number of intervals < 1"); return UNUR_ERR_PAR_SET; } /* store date */ PAR->max_ivs = max_ivs; /* changelog */ par->set |= ARS_SET_MAX_IVS; return UNUR_SUCCESS; } /* end of unur_ars_set_max_intervals() */ /*---------------------------------------------------------------------------*/ int unur_ars_set_cpoints( struct unur_par *par, int n_cpoints, const double *cpoints ) /*----------------------------------------------------------------------*/ /* set construction points for hat function */ /* and/or its number for initialization */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* n_cpoints ... number of starting construction points */ /* cpoints ... pointer to array of starting construction points */ /* (NULL for changing only the number of default points)*/ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int i; /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, ARS ); /* check starting construction points */ if (n_cpoints < 2 ) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"number of starting points < 2. using defaults"); n_cpoints = 2; cpoints = NULL; } if (cpoints) /* starting points must be strictly monontonically increasing */ for( i=1; istarting_cpoints = cpoints; PAR->n_starting_cpoints = n_cpoints; /* changelog */ par->set |= ARS_SET_N_CPOINTS | ((cpoints) ? ARS_SET_CPOINTS : 0); return UNUR_SUCCESS; } /* end of unur_ars_set_cpoints() */ /*---------------------------------------------------------------------------*/ int unur_ars_set_reinit_percentiles( struct unur_par *par, int n_percentiles, const double *percentiles ) /*----------------------------------------------------------------------*/ /* set percentiles for construction points for hat function */ /* and/or its number for re-initialization */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator */ /* n_percentiles ... number of percentiles */ /* percentiles ... pointer to array of percentiles */ /* (NULL for using a rule of thumb) */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int i; /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, ARS ); /* check given percentiles */ if (n_percentiles < 2 ) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"number of percentiles < 2. using defaults"); n_percentiles = 2; percentiles = NULL; } if (n_percentiles > 100 ) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"number of percentiles > 100. using 100"); n_percentiles = 100; } if (percentiles) { /* percentiles must be strictly monontonically increasing */ for( i=1; i 0.99) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"percentiles out of range"); return UNUR_ERR_PAR_SET; } } } /* store date */ PAR->percentiles = percentiles; PAR->n_percentiles = n_percentiles; /* changelog */ par->set |= ARS_SET_N_PERCENTILES | ((percentiles) ? ARS_SET_PERCENTILES : 0); return UNUR_SUCCESS; } /* end of unur_ars_set_reinit_percentiles() */ /*---------------------------------------------------------------------------*/ int unur_ars_chg_reinit_percentiles( struct unur_gen *gen, int n_percentiles, const double *percentiles ) /*----------------------------------------------------------------------*/ /* change percentiles for construction points for hat function */ /* and/or its number for re-initialization */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* n_percentiles ... number of percentiles */ /* percentiles ... pointer to array of percentiles */ /* (NULL for using a rule of thumb) */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int i; /* check input */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, ARS, UNUR_ERR_GEN_INVALID ); /* check given percentiles */ if (n_percentiles < 2 ) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"number of percentiles < 2. using defaults"); n_percentiles = 2; percentiles = NULL; } if (n_percentiles > 100 ) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"number of percentiles > 100. using 100"); n_percentiles = 100; } if (percentiles) { /* percentiles must be strictly monontonically increasing */ for( i=1; i 0.99) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"percentiles out of range"); return UNUR_ERR_PAR_SET; } } } /* store date */ GEN->n_percentiles = n_percentiles; GEN->percentiles = _unur_xrealloc( GEN->percentiles, n_percentiles * sizeof(double) ); if (percentiles) { memcpy( GEN->percentiles, percentiles, n_percentiles * sizeof(double) ); } else { if (n_percentiles == 2) { GEN->percentiles[0] = 0.25; GEN->percentiles[1] = 0.75; } else { for (i=0; ipercentiles[i] = (i + 1.) / (n_percentiles + 1.); } } /* changelog */ gen->set |= ARS_SET_N_PERCENTILES | ((percentiles) ? ARS_SET_PERCENTILES : 0); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_ars_chg_reinit_percentiles() */ /*---------------------------------------------------------------------------*/ int unur_ars_set_reinit_ncpoints( struct unur_par *par, int ncpoints ) /*----------------------------------------------------------------------*/ /* set number of construction points for second trial of reinit */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator */ /* ncpoints ... number of construction points */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, ARS ); /* check number */ if (ncpoints < 10 ) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"number of construction points < 10"); return UNUR_ERR_PAR_SET; } /* store date */ PAR->retry_ncpoints = ncpoints; /* changelog */ par->set |= ARS_SET_RETRY_NCPOINTS; return UNUR_SUCCESS; } /* end of unur_ars_set_reinit_ncpoints() */ /*---------------------------------------------------------------------------*/ int unur_ars_chg_reinit_ncpoints( struct unur_gen *gen, int ncpoints ) /*----------------------------------------------------------------------*/ /* change number of construction points for second trial of reinit */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* ncpoints ... number of construction points */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, ARS, UNUR_ERR_GEN_INVALID ); /* check number */ if (ncpoints < 10 ) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"number of construction points < 10"); return UNUR_ERR_PAR_SET; } /* store date */ GEN->retry_ncpoints = ncpoints; /* changelog */ gen->set |= ARS_SET_RETRY_NCPOINTS; return UNUR_SUCCESS; } /* end of unur_ars_chg_reinit_ncpoints() */ /*---------------------------------------------------------------------------*/ int unur_ars_set_max_iter( struct unur_par *par, int max_iter ) /*----------------------------------------------------------------------*/ /* set maximum number of iterations */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* max_iter ... maximum number of iterations */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, ARS ); /* check new parameter for generator */ if (max_iter < 1) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"maximum number of iterations"); return UNUR_ERR_PAR_SET; } /* store date */ PAR->max_iter = max_iter; /* changelog */ par->set |= ARS_SET_MAX_ITER; return UNUR_SUCCESS; } /* end of unur_ars_set_max_iter() */ /*---------------------------------------------------------------------------*/ int unur_ars_set_verify( struct unur_par *par, int verify ) /*----------------------------------------------------------------------*/ /* turn verifying of algorithm while sampling on/off */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* verify ... 0 = no verifying, !0 = verifying */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* no verifying is the default */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, ARS ); /* we use a bit in variant */ par->variant = (verify) ? (par->variant | ARS_VARFLAG_VERIFY) : (par->variant & (~ARS_VARFLAG_VERIFY)); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_ars_set_verify() */ /*---------------------------------------------------------------------------*/ int unur_ars_chg_verify( struct unur_gen *gen, int verify ) /*----------------------------------------------------------------------*/ /* turn verifying of algorithm while sampling on/off */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* verify ... 0 = no verifying, !0 = verifying */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* no verifying is the default */ /*----------------------------------------------------------------------*/ { /* check input */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, ARS, UNUR_ERR_GEN_INVALID ); /* we must not change this switch when sampling has been disabled by using a pointer to the error producing routine */ if (SAMPLE == _unur_sample_cont_error) return UNUR_FAILURE; /* we use a bit in variant */ gen->variant = (verify) ? (gen->variant | ARS_VARFLAG_VERIFY) : (gen->variant & (~ARS_VARFLAG_VERIFY)); /* sampling routines */ SAMPLE = _unur_ars_getSAMPLE(gen); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_ars_chg_verify() */ /*---------------------------------------------------------------------------*/ int unur_ars_set_pedantic( struct unur_par *par, int pedantic ) /*----------------------------------------------------------------------*/ /* turn pedantic mode on/off */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* pedantic ... 0 = no pedantic mode, !0 = use pedantic mode */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* pedantic is the default */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, ARS ); /* we use a bit in variant */ par->variant = (pedantic) ? (par->variant | ARS_VARFLAG_PEDANTIC) : (par->variant & (~ARS_VARFLAG_PEDANTIC)); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_ars_set_pedantic() */ /*---------------------------------------------------------------------------*/ double unur_ars_get_loghatarea( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* get log of area below hat */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* area ... on success */ /* UNUR_INFINITY ... on error */ /*----------------------------------------------------------------------*/ { /* check input */ _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); _unur_check_gen_object( gen, ARS, UNUR_INFINITY ); return log(GEN->Atotal) + GEN->logAmax; } /* end of unur_ars_get_loghatarea() */ /*****************************************************************************/ /** Private **/ /*****************************************************************************/ struct unur_gen * _unur_ars_init( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* initialize new generator */ /* */ /* parameters: */ /* par ... pointer to paramters for building generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* int i,k; */ /* check arguments */ CHECK_NULL(par,NULL); /* check input */ if ( par->method != UNUR_METH_ARS ) { _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); return NULL; } COOKIE_CHECK(par,CK_ARS_PAR,NULL); /* create a new empty generator object */ gen = _unur_ars_create(par); _unur_par_free(par); if (!gen) return NULL; #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_ars_debug_init_start(gen); #endif /* get starting points */ if (_unur_ars_starting_cpoints(gen)!=UNUR_SUCCESS) { _unur_ars_free(gen); return NULL; } /* compute intervals for given starting points */ if (_unur_ars_starting_intervals(gen)!=UNUR_SUCCESS) { _unur_ars_free(gen); return NULL; } /* update maximal number of intervals */ if (GEN->n_ivs > GEN->max_ivs) { GEN->max_ivs = GEN->n_ivs; } /* make initial table of areas */ _unur_ars_make_area_table(gen); /* is there any hat at all ? */ if (GEN->Atotal <= 0. || !_unur_isfinite(GEN->Atotal)) { _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"bad construction points."); _unur_ars_free(gen); return NULL; } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_ars_debug_init_finished(gen); #endif /* creation of generator object successfull */ gen->status = UNUR_SUCCESS; /* o.k. */ return gen; } /* end of _unur_ars_init() */ /*---------------------------------------------------------------------------*/ int _unur_ars_reinit( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* re-initialize (existing) generator. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { struct unur_ars_interval *iv,*next; double *bak_cpoints; int bak_n_cpoints; int i; int n_trials; /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, ARS, UNUR_ERR_GEN_INVALID ); /* first trial */ n_trials = 1; /* which construction points should be used ? */ if (gen->set & ARS_SET_N_PERCENTILES) { if (GEN->starting_cpoints==NULL || (GEN->n_starting_cpoints != GEN->n_percentiles)) { GEN->n_starting_cpoints = GEN->n_percentiles; GEN->starting_cpoints = _unur_xrealloc( GEN->starting_cpoints, GEN->n_percentiles * sizeof(double)); } for (i=0; in_percentiles; i++) { GEN->starting_cpoints[i] = unur_ars_eval_invcdfhat( gen, GEN->percentiles[i] ); if (!_unur_isfinite(GEN->starting_cpoints[i])) /* we cannot use these starting points --> skip to second trial immediately */ n_trials = 2; } } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug & ARS_DEBUG_REINIT) _unur_ars_debug_reinit_start(gen); #endif /* make backup of cpoints */ bak_n_cpoints = GEN->n_starting_cpoints; bak_cpoints = GEN->starting_cpoints; for (;; ++n_trials) { /* free linked list of intervals */ for (iv = GEN->iv; iv != NULL; iv = next) { next = iv->next; free(iv); } GEN->iv = NULL; GEN->n_ivs = 0; GEN->Atotal = 0.; GEN->logAmax = 0.; if (n_trials > 2) { /* we have done our best */ _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"bad construction points for reinit"); GEN->n_starting_cpoints = bak_n_cpoints; GEN->starting_cpoints = bak_cpoints; return UNUR_FAILURE; } if (n_trials > 1) { /* second trial */ GEN->n_starting_cpoints = GEN->retry_ncpoints; GEN->starting_cpoints = NULL; #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug & ARS_DEBUG_REINIT) _unur_ars_debug_reinit_retry(gen); #endif } /* get starting points */ if (_unur_ars_starting_cpoints(gen)!=UNUR_SUCCESS) continue; /* compute intervals for given starting points */ if (_unur_ars_starting_intervals(gen)!=UNUR_SUCCESS) continue; /* update maximal number of intervals */ if (GEN->n_ivs > GEN->max_ivs) GEN->max_ivs = GEN->n_ivs; /* make table of areas */ _unur_ars_make_area_table(gen); /* is there any hat at all ? */ if (GEN->Atotal <= 0.) continue; /* reinit successful */ break; } /* clean up */ if (n_trials > 1) { GEN->n_starting_cpoints = bak_n_cpoints; GEN->starting_cpoints = bak_cpoints; } /* (re)set sampling routine */ SAMPLE = _unur_ars_getSAMPLE(gen); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug & ARS_DEBUG_REINIT) _unur_ars_debug_reinit_finished(gen); #endif return UNUR_SUCCESS; } /* end of _unur_ars_reinit() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_ars_create( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* allocate memory for generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* pointer to (empty) generator object with default settings */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_ARS_PAR,NULL); /* create new generic generator object */ gen = _unur_generic_create( par, sizeof(struct unur_ars_gen) ); /* magic cookies */ COOKIE_SET(gen,CK_ARS_GEN); /* set generator identifier */ gen->genid = _unur_set_genid(GENTYPE); /* routines for sampling and destroying generator */ SAMPLE = _unur_ars_getSAMPLE(gen); gen->destroy = _unur_ars_free; gen->clone = _unur_ars_clone; gen->reinit = _unur_ars_reinit; /* set all pointers to NULL */ GEN->iv = NULL; GEN->n_ivs = 0; GEN->percentiles = NULL; GEN->Atotal = 0.; GEN->logAmax = 0.; /* copy starting points */ GEN->n_starting_cpoints = PAR->n_starting_cpoints; if (PAR->starting_cpoints) { GEN->starting_cpoints = _unur_xmalloc( PAR->n_starting_cpoints * sizeof(double) ); memcpy( GEN->starting_cpoints, PAR->starting_cpoints, PAR->n_starting_cpoints * sizeof(double) ); } else { GEN->starting_cpoints = NULL; } /* copy percentiles */ if (gen->set & ARS_SET_N_PERCENTILES) unur_ars_chg_reinit_percentiles( gen, PAR->n_percentiles, PAR->percentiles ); /* copy all other parameters */ GEN->retry_ncpoints = PAR->retry_ncpoints; /* number of cpoints for second trial of reinit */ /* bounds for adding construction points */ GEN->max_ivs = _unur_max(2*PAR->n_starting_cpoints,PAR->max_ivs); /* maximum number of intervals */ /* bound for number of repetitions of rejection loop */ GEN->max_iter = PAR->max_iter; /* copy variant */ gen->variant = par->variant; #ifdef UNUR_ENABLE_INFO /* set function for creating info string */ gen->info = _unur_ars_info; #endif /* return pointer to (almost empty) generator object */ return gen; } /* end of _unur_ars_create() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_ars_clone( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* copy (clone) generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to clone of generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { #define CLONE ((struct unur_ars_gen*)clone->datap) struct unur_gen *clone; struct unur_ars_interval *iv, *clone_iv, *clone_prev; /* check arguments */ CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_ARS_GEN,NULL); /* create generic clone */ clone = _unur_generic_clone( gen, GENTYPE ); /* copy linked list of intervals */ clone_iv = NULL; clone_prev = NULL; for (iv = GEN->iv; iv != NULL; iv = iv->next) { /* copy segment */ clone_iv = _unur_xmalloc( sizeof(struct unur_ars_interval) ); memcpy( clone_iv, iv, sizeof(struct unur_ars_interval) ); if (clone_prev == NULL) { /* starting point of linked list */ CLONE->iv = clone_iv; } else { /* insert into linked list */ clone_prev->next = clone_iv; } /* next step */ clone_prev = clone_iv; } /* terminate linked list */ if (clone_iv) clone_iv->next = NULL; /* copy starting points */ if (GEN->starting_cpoints) { CLONE->starting_cpoints = _unur_xmalloc( GEN->n_starting_cpoints * sizeof(double) ); memcpy( CLONE->starting_cpoints, GEN->starting_cpoints, GEN->n_starting_cpoints * sizeof(double) ); } /* copy percentiles */ if (GEN->percentiles) { CLONE->percentiles = _unur_xmalloc( GEN->n_percentiles * sizeof(double) ); memcpy( CLONE->percentiles, GEN->percentiles, GEN->n_percentiles * sizeof(double) ); } /* finished clone */ return clone; #undef CLONE } /* end of _unur_ars_clone() */ /*---------------------------------------------------------------------------*/ void _unur_ars_free( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* deallocate generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { /* check arguments */ if( !gen ) /* nothing to do */ return; /* check input */ if ( gen->method != UNUR_METH_ARS ) { _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); return; } COOKIE_CHECK(gen,CK_ARS_GEN,RETURN_VOID); /* we cannot use this generator object any more */ SAMPLE = NULL; /* make sure to show up a programming error */ #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_ars_debug_free(gen); #endif /* free linked list of intervals */ { struct unur_ars_interval *iv,*next; for (iv = GEN->iv; iv != NULL; iv = next) { next = iv->next; free(iv); } } /* free list of starting points */ if (GEN->starting_cpoints) free (GEN->starting_cpoints); /* free list of percentiles */ if (GEN->percentiles) free (GEN->percentiles); /* free other memory not stored in list */ _unur_generic_free(gen); } /* end of _unur_ars_free() */ /*****************************************************************************/ double _unur_ars_sample( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator (original variant by Gilks & Wild) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return UNUR_INFINITY */ /* */ /*======================================================================*/ /* comment: */ /* x ... random point */ /* x0 ... left construction point in interval */ /* x1 ... right construction point in interval */ /* f ... PDF */ /* Tf ... transformed PDF */ /* dTf ... derivative of transformed PDF */ /* sq ... slope of squeeze in interval */ /* */ /*----------------------------------------------------------------------*/ /* if (Tf)'(x0) == 0: */ /* X = x0 + U / f(x0) */ /* U ~ U(0,area below hat) */ /* */ /* squeeze(x) = f(x0) * exp(sq * (x-x0)) */ /* */ /* left hat(x) = f(x0) * exp( (Tf)'(x0) * (x-x0) ) */ /* generation: */ /* X = x0 + 1/(Tf)'(x0) * \log( (Tf)'(x0)/f(x0) * U + 1 ) */ /* U ~ U(0,area below left hat) */ /* */ /* right hat(x) = f(x1) * exp( (Tf)'(x1) * (x-x1) ) */ /* generation: */ /* X = x1 + 1/(Tf)'(x1) * \log( (Tf)'(x1)/f(x1) * U + 1 ) */ /* U ~ U(- area below right hat,0) */ /*----------------------------------------------------------------------*/ { struct unur_ars_interval *iv, *cp; double U, logV; /* (log of) uniform random number */ double X; /* generated point */ double logfx, logsqx, loghx; /* log of density, squeeze, and hat at X */ double x0, logfx0, dlogfx0, fx0; /* construction point and logPDF at x0 */ int n_trials; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_ARS_GEN,UNUR_INFINITY); if (GEN->iv == NULL) { _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"empty generator object"); return UNUR_INFINITY; } for (n_trials=0; n_trialsmax_iter; ++n_trials) { /* sample from U(0,1) */ U = _unur_call_urng(gen->urng); /* evaluate inverse of hat CDF */ /* find interval by sequential search */ /* Remark: there is no need for a guide table as we only generate one point! */ iv = GEN->iv; U *= GEN->Atotal; while (iv->Acum < U) { iv = iv->next; } /* reuse of uniform random number */ U -= iv->Acum; /* result: U in (-A_hat, 0) */ /* l.h.s. or r.h.s. of hat */ if (-U < (scaled_area(iv) * iv->Ahatr_fract)) { /* right */ cp = iv->next; /* U unchanged */ } else { /* left */ cp = iv; U += scaled_area(iv); } /* PDF at x0 */ x0 = cp->x; logfx0 = cp->logfx; dlogfx0 = cp->dlogfx; fx0 = exp(rescaled_logf(logfx0)); /* random variate */ if (_unur_iszero(dlogfx0)) X = x0 + U / fx0; else { double t = dlogfx0 * U / fx0; if (fabs(t) > 1.e-6) X = x0 + log(t + 1.) * U / (fx0 * t); /* x = x0 + log(t + 1.) / dlogfx0; is cheaper but numerical unstable */ else if (fabs(t) > 1.e-8) /* use Taylor series */ X = x0 + U / fx0 * (1 - t/2. + t*t/3.); else X = x0 + U / fx0 * (1 - t/2.); } /* log of hat at x */ loghx = rescaled_logf(logfx0) + dlogfx0*(X - x0); /* log of a random point between 0 and hat at x */ logV = log(_unur_call_urng(gen->urng)) + loghx; /* log of spueeze at x */ logsqx = rescaled_logf(iv->logfx) + iv->sq*(X - iv->x); /* below squeeze ? */ if (logV <= logsqx) return X; /* log of PDF at x */ logfx = logPDF(X); /* below PDF ? */ if (logV <= rescaled_logf(logfx)) return X; /* being above PDF is bad. improve the situation! */ if (GEN->n_ivs < GEN->max_ivs) { /* first check for valid values of X and logf(X) */ if (! (_unur_isfinite(X) && _unur_isfinite(logfx)) ) { X = _unur_arcmean(iv->x,iv->next->x); /* use mean point in interval */ logfx = logPDF(X); } if ( (_unur_ars_improve_hat( gen, iv, X, logfx) != UNUR_SUCCESS) && (gen->variant & ARS_VARFLAG_PEDANTIC) ) return UNUR_INFINITY; } /* else reject and try again */ } /* number of trials exceeded */ _unur_warning(gen->genid,UNUR_ERR_GEN_SAMPLING,"max number of iterations exceeded"); return UNUR_INFINITY; } /* end of _unur_ars_sample() */ /*---------------------------------------------------------------------------*/ double _unur_ars_sample_check( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator and verify results */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { struct unur_ars_interval *iv, *cp; double U, logV; /* (log of) uniform random number */ double X; /* generated point */ double logfx, logsqx, loghx; /* log of density, squeeze, and hat at X */ double x0, logfx0, dlogfx0, fx0; /* construction point and logPDF at x0 */ int n_trials; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_ARS_GEN,UNUR_INFINITY); if (GEN->iv == NULL) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"empty generator object"); return UNUR_INFINITY; } for (n_trials=0; n_trialsmax_iter; ++n_trials) { /* sample from U(0,1) */ U = _unur_call_urng(gen->urng); /* evaluate inverse of hat CDF */ /* find interval by sequential search */ /* Remark: there is no need for a guide table as we only generate one point! */ iv = GEN->iv; U *= GEN->Atotal; while (iv->Acum < U) { iv = iv->next; } /* reuse of uniform random number */ U -= iv->Acum; /* result: U in (-A_hat, 0) */ /* l.h.s. or r.h.s. of hat */ if (-U < (scaled_area(iv) * iv->Ahatr_fract)) { /* right */ cp = iv->next; /* U unchanged */ } else { /* left */ cp = iv; U += scaled_area(iv); } /* PDF at x0 */ x0 = cp->x; logfx0 = cp->logfx; dlogfx0 = cp->dlogfx; fx0 = exp(rescaled_logf(logfx0)); /* random variate */ if (_unur_iszero(dlogfx0)) X = x0 + U / fx0; else { double t = dlogfx0 * U / fx0; if (fabs(t) > 1.e-6) X = x0 + log(t + 1.) * U / (fx0 * t); /* x = x0 + log(t + 1.) / dlogfx0; is cheaper but numerical unstable */ else if (fabs(t) > 1.e-8) /* use Taylor series */ X = x0 + U / fx0 * (1 - t/2. + t*t/3.); else X = x0 + U / fx0 * (1 - t/2.); } /* log of hat at x */ loghx = rescaled_logf(logfx0) + dlogfx0*(X - x0); /* log of spueeze at x */ logsqx = rescaled_logf(iv->logfx) + iv->sq*(X - iv->x); /* log of PDF at x */ logfx = logPDF(X); /* check result */ if (X < DISTR.BD_LEFT || X > DISTR.BD_RIGHT) { _unur_warning(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,"generated point out of domain"); } if (_unur_FP_greater(rescaled_logf(logfx), loghx)) { _unur_warning(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF > hat. Not log-concave!"); } if (_unur_FP_less(rescaled_logf(logfx), logsqx)) { _unur_warning(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF < squeeze. Not log-concave!"); } /* log of a random point between 0 and hat at x */ logV = log(_unur_call_urng(gen->urng)) + loghx; /* below squeeze ? */ if (logV <= logsqx) return X; /* below PDF ? */ if (logV <= rescaled_logf(logfx)) return X; /* being above PDF is bad. improve the situation! */ if (GEN->n_ivs < GEN->max_ivs) { /* first check for valid values of X and logf(X) */ if (! (_unur_isfinite(X) && _unur_isfinite(logfx)) ) { X = _unur_arcmean(iv->x,iv->next->x); /* use mean point in interval */ logfx = logPDF(X); } if ( (_unur_ars_improve_hat( gen, iv, X, logfx) != UNUR_SUCCESS) && (gen->variant & ARS_VARFLAG_PEDANTIC) ) return UNUR_INFINITY; } /* reject and try again */ } /* number of trials exceeded */ _unur_warning(gen->genid,UNUR_ERR_GEN_SAMPLING,"max number of iterations exceeded"); return UNUR_INFINITY; } /* end of _unur_ars_sample_check() */ /*---------------------------------------------------------------------------*/ double unur_ars_eval_invcdfhat( const struct unur_gen *gen, double U ) /*----------------------------------------------------------------------*/ /* evaluate the inverse of the hat CDF at u */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* U ... argument for inverse CDF (0<=U<=1, no validation!) */ /* */ /* return: */ /* inverse of hat CDF. */ /*----------------------------------------------------------------------*/ { struct unur_ars_interval *iv, *cp; double X; /* generated point */ double x0, logfx0, dlogfx0, fx0; /* construction point and logPDF at x0 */ /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); if ( gen->method != UNUR_METH_ARS ) { _unur_error(gen->genid,UNUR_ERR_GEN_INVALID,""); return UNUR_INFINITY; } COOKIE_CHECK(gen,CK_ARS_GEN,UNUR_INFINITY); if ( U<0. || U>1.) { _unur_warning(gen->genid,UNUR_ERR_DOMAIN,"argument u not in [0,1]"); } if (GEN->iv == NULL) { _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"empty generator object"); return UNUR_INFINITY; } /* validate argument */ if (U<=0.) return DISTR.domain[0]; if (U>=1.) return DISTR.domain[1]; /* find interval by sequential search */ /* Remark: there is no need for a guide table as we only generate one point! */ iv = GEN->iv; U *= GEN->Atotal; while (iv->Acum < U) { iv = iv->next; } /* rescale U: U in (-A_hat, 0) */ U -= iv->Acum; /* l.h.s. or r.h.s. of hat */ if (-U < (scaled_area(iv) * iv->Ahatr_fract)) { /* right */ cp = iv->next; /* U unchanged */ } else { /* left */ cp = iv; U += scaled_area(iv); } /* PDF at x0 */ x0 = cp->x; logfx0 = cp->logfx; dlogfx0 = cp->dlogfx; fx0 = exp(rescaled_logf(logfx0)); /* X = H^{-1}(U) in interval*/ if (_unur_iszero(dlogfx0)) X = x0 + U / fx0; else { double t = dlogfx0 * U / fx0; if (fabs(t) > 1.e-6) X = x0 + log(t + 1.) * U / (fx0 * t); /* x = x0 + log(t + 1.) / dlogfx0; is cheaper but numerical unstable */ else if (fabs(t) > 1.e-8) /* use Taylor series */ X = x0 + U / fx0 * (1 - t/2. + t*t/3.); else X = x0 + U / fx0 * (1 - t/2.); } return X; } /* end of unur_ars_eval_invcdfhat() */ /*****************************************************************************/ /** Auxilliary Routines **/ /*****************************************************************************/ int _unur_ars_improve_hat( struct unur_gen *gen, struct unur_ars_interval *iv, double x, double logfx ) /*----------------------------------------------------------------------*/ /* improve hat function by splitting interval */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* iv ... pointer to interval that has to be split */ /* x ... splitting point */ /* logfx ... value of logPDF at splitting point */ /* */ /* return: */ /* UNUR_SUCCESS ... improving hat successful */ /* others ... error: PDF not monotone in interval */ /*----------------------------------------------------------------------*/ { int result; /* add construction point */ result = _unur_ars_interval_split(gen, iv, x, logfx); if (result!=UNUR_SUCCESS && result!=UNUR_ERR_SILENT) { /* condition for PDF is violated! */ _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,""); if (gen->variant & ARS_VARFLAG_PEDANTIC) { /* replace sampling routine by dummy routine that just returns UNUR_INFINITY */ SAMPLE = _unur_sample_cont_error; return UNUR_ERR_GEN_CONDITION; } } /* splitting successful --> update table of areas */ _unur_ars_make_area_table(gen); /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_ars_improve_hat() */ /*---------------------------------------------------------------------------*/ int _unur_ars_starting_cpoints( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* list of construction points for starting intervals. */ /* if not provided as arguments compute these */ /* by means of the "equiangular rule" from AROU. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { struct unur_ars_interval *iv; double left_angle, right_angle, diff_angle, angle; double x, logfx, logfx_last; int is_increasing; int i; /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_ARS_GEN,UNUR_ERR_COOKIE); /* reset counter of intervals */ GEN->n_ivs = 0; /* prepare for computing construction points */ if (!GEN->starting_cpoints) { /* angles of boundary of domain */ left_angle = _unur_FP_is_minus_infinity(DISTR.BD_LEFT) ? -M_PI/2. : atan(DISTR.BD_LEFT); right_angle = _unur_FP_is_infinity(DISTR.BD_RIGHT) ? M_PI/2. : atan(DISTR.BD_RIGHT); /* we use equal distances between the angles of the cpoints */ /* and the boundary points */ diff_angle = (right_angle-left_angle) / (GEN->n_starting_cpoints + 1); angle = left_angle; } else diff_angle = angle = 0.; /* we do not need these variables in this case */ /* the left boundary point */ x = DISTR.BD_LEFT; is_increasing = TRUE; logfx = logfx_last = _unur_isfinite(x) ? logPDF(x) : -UNUR_INFINITY; iv = GEN->iv = _unur_ars_interval_new( gen, x, logfx ); if (iv == NULL) return UNUR_ERR_GEN_DATA; /* logPDF(x) overflow */ /* now all the other points */ for( i=0; i<=GEN->n_starting_cpoints; i++ ) { /* construction point */ if (i < GEN->n_starting_cpoints) { if (GEN->starting_cpoints) { /* construction points provided by user */ x = GEN->starting_cpoints[i]; /* check starting point */ if (x < DISTR.BD_LEFT || x > DISTR.BD_RIGHT) { _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"starting point out of domain"); continue; } } else { /* compute construction points by means of "equiangular rule" */ angle += diff_angle; x = tan( angle ); } } else { /* the very last interval. it is rather a "virtual" interval to store the right vertex of the last interval, i.e., the right boundary point. */ x = DISTR.BD_RIGHT; } /** TODO: check if two construction points are too close ?? check if a point is too close to mode ?? */ /* value of PDF at starting point */ logfx = _unur_isfinite(x) ? logPDF(x) : -UNUR_INFINITY; /* check value of PDF at starting point */ if (!is_increasing && logfx > logfx_last * (1.+DBL_EPSILON)) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF not unimodal!"); return UNUR_ERR_GEN_CONDITION; } /* check whether we are outside of support of PDF */ if (!_unur_isfinite(logfx) && !_unur_isfinite(logfx_last) ) { /* we do not need two such point */ if (is_increasing) { /* PDF is still increasing, i.e., constant 0 til now */ if (in_starting_cpoints) { /* and it is not the right boundary. otherwise the PDF is constant 0 on all construction points. then we need both boundary points. */ iv->x = x; /* we only have to change x, everything else remains unchanged */ continue; /* next construction point */ } } else /* there should be no more points with logPDF(x) > -UNUR_INFINITY */ break; } /* need a new interval */ iv->next = _unur_ars_interval_new( gen, x, logfx ); if (iv->next == NULL) return UNUR_ERR_GEN_DATA; /* logPDF(x) overflow */ /* skip pointer to current interval */ iv = iv->next; /* PDF still increasing ? */ if (is_increasing && logfx < logfx_last) is_increasing = FALSE; /* store last computed values */ logfx_last = logfx; } /* we have left the loop with the right boundary of the support of PDF make shure that we will never use iv for sampling. */ iv->logAhat = -UNUR_INFINITY; iv->Ahatr_fract = iv->sq = 0.; iv->Acum = UNUR_INFINITY; #ifdef DEBUG_STORE_IP iv->ip = iv->x; #endif iv->next = NULL; /* terminate list */ --(GEN->n_ivs); /* we do not count the terminating interval */ /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_ars_starting_cpoints() */ /*---------------------------------------------------------------------------*/ int _unur_ars_starting_intervals( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* compute intervals for starting points */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { struct unur_ars_interval *iv, *iv_new, *iv_tmp; double x, logfx; /* construction point, value of logPDF at x */ /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_ARS_GEN,UNUR_ERR_COOKIE); CHECK_NULL(GEN->iv,UNUR_ERR_NULL); COOKIE_CHECK(GEN->iv,CK_ARS_IV,UNUR_ERR_COOKIE); /* compute paramters for all intervals */ for( iv=GEN->iv; iv->next != NULL; ) { /* compute parameters for interval */ switch (_unur_ars_interval_parameter(gen, iv)) { case UNUR_SUCCESS: /* computation of parameters for interval successful */ /* skip to next interval */ iv = iv->next; continue; case UNUR_ERR_INF: /* interval unbounded */ /* split interval */ break; case UNUR_ERR_SILENT: /* construction points too close */ /* we have to remove this last interval from list */ /* (the last construction point in the list is a boundary point. thus we might change the domain of the distribution. however, we only cut off a piece that is beyond the precesion of the floating point arithmetic.) */ iv_tmp = iv->next; iv->next = iv->next->next; free(iv_tmp); --(GEN->n_ivs); if (iv->next==NULL) { /* last (virtuel) interval in list. make sure that we will never use this segment */ iv->logAhat = -UNUR_INFINITY; iv->Ahatr_fract = iv->sq = 0.; iv->Acum = UNUR_INFINITY; } continue; default: /* PDF not T-concave */ return UNUR_ERR_GEN_CONDITION; } /* area below hat infinite. insert new construction point. */ x = _unur_arcmean(iv->x,iv->next->x); /* use mean point in interval */ /* value of logPDF at x */ logfx = logPDF(x); /* add a new interval, but check if we had to used too many intervals */ if (GEN->n_ivs >= GEN->max_ivs) { /* we do not want to create too many intervals */ _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"cannot create bounded hat!"); return UNUR_ERR_GEN_CONDITION; } iv_new = _unur_ars_interval_new( gen, x, logfx ); if (iv_new == NULL) return UNUR_ERR_GEN_DATA; /* logPDF(x) overflow */ /* if fx is 0, then we can cut off the tail of the distribution (since it must be T-concave) */ if (!_unur_isfinite(logfx) ) { if (!_unur_isfinite(iv->logfx) ) { /* cut off left tail */ iv_new->next = iv->next; free(iv); --(GEN->n_ivs); GEN->iv = iv_new; iv = iv_new; } else if (!_unur_isfinite(iv->next->logfx) ) { /* cut off right tail */ free(iv->next); --(GEN->n_ivs); iv->next = iv_new; } else { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF not T-concave!"); free(iv_new); return UNUR_ERR_GEN_CONDITION; } } else { /* insert new interval into linked list */ iv_new->next = iv->next; iv->next = iv_new; } } /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_ars_starting_intervals() */ /*---------------------------------------------------------------------------*/ struct unur_ars_interval * _unur_ars_interval_new( struct unur_gen *gen, double x, double logfx ) /*----------------------------------------------------------------------*/ /* get new interval and compute left construction point at x. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* x ... left point of new interval */ /* logfx ... value of logPDF at x */ /* */ /* return: */ /* pointer to new interval */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_ars_interval *iv; /* double dfx; */ /* check arguments */ CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_ARS_GEN,NULL); /* first check logfx */ if (!(logfx < UNUR_INFINITY)) { /* overflow */ _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"logPDF(x) overflow"); return NULL; } /* we need a new segment */ iv = _unur_xmalloc( sizeof(struct unur_ars_interval) ); iv->next = NULL; /* add eol marker */ ++(GEN->n_ivs); /* increment counter for intervals */ COOKIE_SET(iv,CK_ARS_IV); /* avoid uninitialized variables */ iv->logAhat = -UNUR_INFINITY; iv->Acum = iv->Ahatr_fract = 0.; iv->sq = 0.; #ifdef DEBUG_STORE_IP iv->ip = 0.; #endif /* make left construction point in interval */ iv->x = x; /* point x */ iv->logfx = logfx; /* value of logPDF at x */ /* derivative of transformed density */ iv->dlogfx = _unur_isfinite(logfx) ? dlogPDF(x) : UNUR_INFINITY; /* the program requires dlogPDF > -UNUR_INFINITY */ if ( !(iv->dlogfx > -UNUR_INFINITY)) iv->dlogfx = UNUR_INFINITY; return iv; } /* end of _unur_ars_interval_new() */ /*---------------------------------------------------------------------------*/ int _unur_ars_interval_parameter( struct unur_gen *gen, struct unur_ars_interval *iv ) /*----------------------------------------------------------------------*/ /* compute intersection point of tangents and */ /* the area below the hat (Gilks & Wild variant) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* iv ... pointer to interval */ /* */ /* return: */ /* UNUR_SUCCESS ... if successful */ /* UNUR_ERR_SILENT ... do not add this construction point */ /* UNUR_ERR_INF ... area = UNUR_INFINITY */ /* others ... error (PDF not T-concave) */ /*----------------------------------------------------------------------*/ { double logAhatl, logAhatr; /* log of areas below hat at l.h.s. and r.h.s. of intersection point, resp. */ double ip = 0.; /* intersection point of tangents */ /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_ARS_GEN,UNUR_ERR_COOKIE); CHECK_NULL(iv,UNUR_ERR_NULL); COOKIE_CHECK(iv,CK_ARS_IV,UNUR_ERR_COOKIE); /* check interval on the right side of iv */ CHECK_NULL(iv->next,UNUR_ERR_NULL); COOKIE_CHECK(iv->next,CK_ARS_IV,UNUR_ERR_COOKIE); /* get intersection point of tangents. used to partition interval into left hand part (construction point of tangent on the left hand boundary) and right hand part (construction point of tangent on the left hand boundary). */ if ( _unur_ars_tangent_intersection_point(gen,iv,&ip)!=UNUR_SUCCESS ) return UNUR_ERR_GEN_CONDITION; #ifdef DEBUG_STORE_IP iv->ip = ip; #endif /* squeeze and area below squeeze */ if (_unur_isfinite(iv->logfx) && _unur_isfinite(iv->next->dlogfx) ) { /* we do not compute the slope when the construction points are too close. at least 8 significant digits should remain. */ if (_unur_FP_approx(iv->x, iv->next->x) ) return UNUR_ERR_SILENT; /* construction points too close */ /* slope of transformed squeeze */ iv->sq = (iv->next->logfx - iv->logfx) / (iv->next->x - iv->x); /* check squeeze */ /* we have to take care about round off error. the following accepts PDFs with might be a little bit not T_concave */ if ( ( (iv->sq > iv->dlogfx && (!_unur_FP_approx(iv->sq,iv->dlogfx)) ) || (iv->sq < iv->next->dlogfx && (!_unur_FP_approx(iv->sq,iv->next->dlogfx)) ) ) && iv->next->dlogfx < UNUR_INFINITY ) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"Squeeze too steep/flat. PDF not T-concave!"); return UNUR_ERR_GEN_CONDITION; } } else { /* no squeeze */ iv->sq = -UNUR_INFINITY; } /* volume below hat */ logAhatl = _unur_ars_interval_logarea( gen, iv, iv->dlogfx, ip); logAhatr = _unur_ars_interval_logarea( gen, iv->next, iv->next->dlogfx, ip); /* areas below head unbounded ? */ if (! (logAhatl < UNUR_INFINITY && logAhatr < UNUR_INFINITY) ) return UNUR_ERR_INF; /* total area */ iv->logAhat = (logAhatl > logAhatr) ? logAhatl+log(1+exp(logAhatr-logAhatl)) : logAhatr+log(1+exp(logAhatl-logAhatr)) ; /* = log( Ahatr + Ahatl ) */ iv->Ahatr_fract = 1./(1.+exp(logAhatl-logAhatr)); /* = Ahatr / (Ahatr + Ahatl) */ /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_ars_interval_parameter() */ /*---------------------------------------------------------------------------*/ int _unur_ars_interval_split( struct unur_gen *gen, struct unur_ars_interval *iv_oldl, double x, double logfx ) /*----------------------------------------------------------------------*/ /* split interval iv_oldl into two intervals at point x */ /* old interval -> left hand side */ /* new interval -> right hand side */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* iv_oldl ... pointer to interval */ /* x ... left point of new segment */ /* logfx ... value of logPDF at x */ /* */ /* return: */ /* UNUR_SUCCESS ... if successful */ /* UNUR_ERR_SILENT ... if no intervals are splitted */ /* others ... error */ /*----------------------------------------------------------------------*/ { struct unur_ars_interval *iv_newr; /* pointer to new interval */ struct unur_ars_interval iv_bak; /* space for backing up data of interval */ int success, success_r; /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_ARS_GEN,UNUR_ERR_COOKIE); CHECK_NULL(iv_oldl,UNUR_ERR_NULL); COOKIE_CHECK(iv_oldl,CK_ARS_IV,UNUR_ERR_COOKIE); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug & ARS_DEBUG_SPLIT) _unur_ars_debug_split_start( gen,iv_oldl,x,logfx ); #endif /* the splitting point must be inside the interval */ if (x < iv_oldl->x || x > iv_oldl->next->x) { _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"splitting point not in interval!"); return UNUR_ERR_SILENT; } /* back up data */ memcpy(&iv_bak, iv_oldl, sizeof(struct unur_ars_interval)); /* check if the new interval is completely outside the support of PDF */ if (!_unur_isfinite(logfx)) { /* one of the two boundary points must be 0, too! */ if (!_unur_isfinite(iv_oldl->logfx)) { /* chop off left part (it's out of support) */ iv_oldl->x = x; } else if (!_unur_isfinite(iv_oldl->next->logfx)) { /* chop off right part (it's out of support) */ iv_oldl->next->x = x; } else { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF not log-concave"); return UNUR_ERR_GEN_CONDITION; } /* compute parameters for chopped interval */ success = _unur_ars_interval_parameter(gen, iv_oldl); /* we did not add a new interval */ iv_newr = NULL; } else { /* we need a new interval */ iv_newr = _unur_ars_interval_new( gen, x, logfx ); if (iv_newr == NULL) { /* logPDF(x) overflow */ _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); return UNUR_ERR_SHOULD_NOT_HAPPEN; } /* insert into linked list */ iv_newr->next = iv_oldl->next; iv_oldl->next = iv_newr; /* compute parameters for interval */ success = _unur_ars_interval_parameter(gen, iv_oldl); success_r = _unur_ars_interval_parameter(gen, iv_newr); /* worst of success and success_r */ if (success_r!=UNUR_SUCCESS) if ((success_r!=UNUR_ERR_SILENT&&success_r!=UNUR_ERR_INF) || (success==UNUR_SUCCESS||success==UNUR_ERR_SILENT||success==UNUR_ERR_INF)) success = success_r; } /* successfull ? */ if (success!=UNUR_SUCCESS) { /* cannot split interval at given point */ _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"Cannot split interval at given point."); if (success!=UNUR_ERR_SILENT && success!=UNUR_ERR_INF) _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF not log-concave"); /* the case of unbounded hat is treated as round-off error for very steep tangents. so we simply do not add this construction point. */ /* restore old interval */ memcpy(iv_oldl, &iv_bak, sizeof(struct unur_ars_interval)); /* decrement counter for intervals and free unused interval */ if (iv_newr) { --(GEN->n_ivs); free( iv_newr ); } return ( (success!=UNUR_ERR_SILENT && success!=UNUR_ERR_INF) ? UNUR_ERR_GEN_CONDITION : UNUR_SUCCESS ); } /* successful */ #ifdef UNUR_ENABLE_LOGGING if (gen->debug & ARS_DEBUG_SPLIT) { /* update total area below hat and squeeze */ GEN->Atotal = ( GEN->Atotal - scaled_area(&iv_bak) + scaled_area(iv_oldl) + ((iv_newr) ? scaled_area(iv_newr) : 0.) ); /* write info into LOG file */ _unur_ars_debug_split_stop( gen,iv_oldl,iv_newr ); } #endif /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_ars_interval_split() */ /*---------------------------------------------------------------------------*/ int _unur_ars_tangent_intersection_point( struct unur_gen *gen, struct unur_ars_interval *iv, double *ipt ) /*----------------------------------------------------------------------*/ /* compute cutting point of interval into left and right part. */ /* (1) use intersection point of tangents of transformed hat. */ /* (2) use mean point if (1) is unstable due to roundoff errors. */ /* (3) use boundary point which is closer to the mode. this is */ /* important when the transformed tagents are extremely steep. */ /* (This might cause a serious roundoff error while sampling.) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* iv ... pointer to interval */ /* ipt ... pointer to intersection point */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_ARS_GEN,UNUR_ERR_COOKIE); CHECK_NULL(iv,UNUR_ERR_NULL); COOKIE_CHECK(iv,CK_ARS_IV,UNUR_ERR_COOKIE); /* case: there is no tangent at one of the boundary points of the interval (then the slope is UNUR_INFINITY) or case: the tangents are too steep (--> case (3)) */ if ( iv->dlogfx > 1.e+140 ) { *ipt = iv->x; /* intersection point = left boundary of interval */ return UNUR_SUCCESS; } if ( iv->next->dlogfx < -1.e+140 || _unur_FP_is_infinity(iv->next->dlogfx)) { *ipt = iv->next->x; /* intersection point = right boundary of interval */ return UNUR_SUCCESS; } /** TODO: 1.e+140 (= sqrt(DBL_MAX) / 1.e15) is arbitrary **/ /* test for T-concavity */ if ( _unur_FP_less( iv->dlogfx, iv->next->dlogfx ) ) { /* it might happen because of round-off errors that iv->next->dTfx is almost zero although it should be large. thus we ignore this case. */ if ( fabs(iv->dlogfx) < DBL_EPSILON * fabs(iv->next->dlogfx) ) { *ipt = iv->x; /* intersection point = left boundary of interval */ iv->dlogfx = UNUR_INFINITY; return UNUR_SUCCESS; } else if ( fabs(iv->next->dlogfx) < DBL_EPSILON * fabs(iv->dlogfx) ) { *ipt = iv->next->x; /* intersection point = right boundary of interval */ iv->next->dlogfx = UNUR_INFINITY; return UNUR_SUCCESS; } else { if (_unur_FP_approx(iv->dlogfx, iv->next->dlogfx)) { /* use mean point */ *ipt = 0.5 * (iv->x + iv->next->x); return UNUR_SUCCESS; } _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"dTfx0 < dTfx1 (x0next->logfx > iv->x + iv->dlogfx*(iv->next->x - iv->x)) { */ /* _unur_warning(gen->genid,UNUR_ERR_INIT,"tangent below PDF, not log-concave!"); */ /* return UNUR_ERR_INIT; */ /* } */ /* case (2): computing intersection of tangents is unstable */ if (_unur_FP_approx(iv->dlogfx, iv->next->dlogfx)) { /* use mean point */ *ipt = 0.5 * (iv->x + iv->next->x); return UNUR_SUCCESS; } /* case (1): compute intersection point of tangents (regular case) */ *ipt = ( (iv->next->logfx - iv->logfx - iv->next->dlogfx * iv->next->x + iv->dlogfx * iv->x) / (iv->dlogfx - iv->next->dlogfx) ); /* check position of intersection point */ if (_unur_FP_less(*ipt, iv->x) || _unur_FP_greater(*ipt, iv->next->x)) /* intersection point of tangents not in interval. This is mostly the case for numerical reasons. Thus we use the center of the interval instead. if the PDF not T-concave, it will catched at a later point when we compare slope of tangents and squeeze. */ *ipt = 0.5 * (iv->x + iv->next->x); /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_ars_tangent_intersection_point() */ /*---------------------------------------------------------------------------*/ double _unur_ars_interval_logarea( struct unur_gen *gen ATTRIBUTE__UNUSED, struct unur_ars_interval *iv, double slope, double x ) /*---------------------------------------------------------------------------*/ /* compute log of area below piece of hat or squeeze in */ /* interval [iv->x,x] or [x,iv->x] */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* iv ... pointer to interval that stores construction point of tangent */ /* slope ... slope of tangent or secant of transformed PDF */ /* x ... boundary of integration domain */ /* */ /* return: */ /* log of area */ /* */ /* error: */ /* return UNUR_INFINITY */ /* */ /* comment: */ /* x0 ... construction point of tangent (= iv->x) */ /* */ /* area = | \int_{x0}^x \exp(Tf(x0) + slope*(t-x0)) dt | */ /* = f(x0) * |x - x0| if slope = 0 */ /* = | f(x0)/slope * (\exp(slope*(x-x0))-1) | if slope != 0 */ /* */ /*---------------------------------------------------------------------------*/ { double x0, logfx0; double logxdiff; double t, logt; /* check arguments */ CHECK_NULL(iv,UNUR_INFINITY); COOKIE_CHECK(iv,CK_ARS_IV,UNUR_INFINITY); /* length of interval > 0 ? */ if (_unur_FP_same(x, iv->x)) return -UNUR_INFINITY; /* if the construction point is at infinity, we cannot compute an area. (in this case we should have x == iv->x == UNUR_INFINITY). */ if (!_unur_isfinite(iv->x)) return UNUR_INFINITY; /* unbounded? */ if ( !_unur_isfinite(slope) || (_unur_FP_is_minus_infinity(x) && slope<=0.) || (_unur_FP_is_infinity(x) && slope>=0.) ) /* we have set (Tf)'(x) = UNUR_INFINITY, if f(x)=0 */ return UNUR_INFINITY; /* construction point x0 of tangent and log of PDF at x0 */ x0 = iv->x; logfx0 = iv->logfx; /* log of |x - x=| */ logxdiff = log(fabs(x - x0)); /* case: hat/squeeze constant --> area = f(x0) * |x - x0| */ if (_unur_iszero(slope)) return (_unur_isfinite(x) ? logfx0 + logxdiff : UNUR_INFINITY); /* case: domain unbounded --> area = f(x0) / |slope| */ if (!_unur_isfinite(x)) return (logfx0 - log(fabs(slope))); /* case bounded domain --> area = | f(x0)/slope * (\exp(slope*(x-x0))-1) | */ /* have to deal with numerical problems when x \approx x0 */ t = slope * (x - x0); logt = log(fabs(slope)) + logxdiff; if (fabs(t) > 1.e-6) { if (t > MAXLOG / 10.) return ( logfx0 + logxdiff + t - logt ); else return ( logfx0 + logxdiff + log( fabs(exp(t) - 1.) ) - log(fabs(t)) ); } else /* use Taylor series */ return (logfx0 + logxdiff + log1p(t/2. + t*t/6.)); } /* end of _unur_ars_interval_logarea() */ /*---------------------------------------------------------------------------*/ int _unur_ars_make_area_table( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* make table of areas and compute largest area for rescaling */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { struct unur_ars_interval *iv; double Acum; /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_ARS_GEN,UNUR_ERR_COOKIE); /* first we need the maximum area in intervals as scaling factor */ GEN->logAmax = -UNUR_INFINITY; for (iv = GEN->iv; iv != NULL; iv = iv->next ) { COOKIE_CHECK(iv,CK_ARS_IV,UNUR_ERR_COOKIE); if (GEN->logAmax < iv->logAhat) GEN->logAmax = iv->logAhat; } /* cumulated areas in intervals */ Acum = 0.; /* area below hat */ for (iv = GEN->iv; iv != NULL; iv = iv->next ) { COOKIE_CHECK(iv,CK_ARS_IV,UNUR_ERR_COOKIE); Acum += scaled_area(iv); iv->Acum = Acum; } /* total area below hat */ GEN->Atotal = Acum; return UNUR_SUCCESS; } /* end of _unur_ars_make_area_table() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Debugging utilities **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ void _unur_ars_debug_init_start( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* print after (almost empty generator) object has been created. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; int i; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_ARS_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: type = continuous univariate random variates\n",gen->genid); fprintf(LOG,"%s: method = ARS (Adaptive Rejection Sampling)\n",gen->genid); fprintf(LOG,"%s: transformation T_c(x) = log(x)\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); if (gen->distr_is_privatecopy) fprintf(LOG,"%s: use private copy of distribution object\n",gen->genid); else fprintf(LOG,"%s: use pointer to external distribution object (dangerous!)\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); _unur_distr_cont_debug( gen->distr, gen->genid ); fprintf(LOG,"%s: sampling routine = _unur_ars_sample",gen->genid); if (gen->variant & ARS_VARFLAG_VERIFY) fprintf(LOG,"_check()\n"); else fprintf(LOG,"()\n"); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: maximum number of intervals = %d",gen->genid,GEN->max_ivs); _unur_print_if_default(gen,ARS_SET_MAX_IVS); fprintf(LOG,"\n"); fprintf(LOG,"%s: maximum number of iterations = %d",gen->genid,GEN->max_iter); _unur_print_if_default(gen,ARS_SET_MAX_ITER); fprintf(LOG,"\n%s:\n",gen->genid); fprintf(LOG,"%s: number of starting points = %d",gen->genid,GEN->n_starting_cpoints); _unur_print_if_default(gen,ARS_SET_N_CPOINTS); fprintf(LOG,"\n%s: starting points:",gen->genid); if (gen->set & ARS_SET_CPOINTS) for (i=0; in_starting_cpoints; i++) { if (i%5==0) fprintf(LOG,"\n%s:\t",gen->genid); fprintf(LOG," %#g,",GEN->starting_cpoints[i]); } else fprintf(LOG," use \"equidistribution\" rule [default]"); fprintf(LOG,"\n%s:\n",gen->genid); fflush(LOG); } /* end of _unur_ars_debug_init_start() */ /*---------------------------------------------------------------------------*/ void _unur_ars_debug_init_finished( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write info about generator after setup into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_ARS_GEN,RETURN_VOID); LOG = unur_get_stream(); _unur_ars_debug_intervals(gen,"INIT completed",TRUE); fprintf(LOG,"%s: INIT completed **********************\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); fflush(LOG); } /* end of _unur_ars_debug_init_finished() */ /*---------------------------------------------------------------------------*/ void _unur_ars_debug_reinit_start( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write info about generator before reinitialization into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { int i; FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_ARS_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s: *** Re-Initialize generator object ***\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); if (gen->set & ARS_SET_N_PERCENTILES) { fprintf(LOG,"%s: use percentiles of old hat as starting points for new hat:",gen->genid); for (i=0; in_percentiles; i++) { if (i%5==0) fprintf(LOG,"\n%s:\t",gen->genid); fprintf(LOG," %#g,",GEN->percentiles[i]); } fprintf(LOG,"\n%s: starting points:",gen->genid); for (i=0; in_starting_cpoints; i++) { if (i%5==0) fprintf(LOG,"\n%s:\t",gen->genid); fprintf(LOG," %#g,",GEN->starting_cpoints[i]); } fprintf(LOG,"\n"); } else { fprintf(LOG,"%s: use starting points given at init\n",gen->genid); } fprintf(LOG,"%s:\n",gen->genid); fflush(LOG); } /* end of _unur_ars_debug_reinit_start() */ /*---------------------------------------------------------------------------*/ void _unur_ars_debug_reinit_retry( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write info about generator before second trial of reinitialization */ /* into LOG file. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_ARS_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s: *** Re-Initialize failed --> second trial ***\n",gen->genid); fprintf(LOG,"%s: use equal-area-rule with %d points\n",gen->genid,GEN->retry_ncpoints); fprintf(LOG,"%s:\n",gen->genid); fflush(LOG); } /* end of _unur_ars_debug_reinit_retry() */ /*---------------------------------------------------------------------------*/ void _unur_ars_debug_reinit_finished( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write info about generator after reinitialization into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_ARS_GEN,RETURN_VOID); LOG = unur_get_stream(); _unur_ars_debug_intervals(gen," *** Generator reinitialized ***",TRUE); fprintf(LOG,"%s:\n",gen->genid); fflush(LOG); } /* end of _unur_ars_debug_reinit_finished() */ /*---------------------------------------------------------------------------*/ void _unur_ars_debug_intervals( const struct unur_gen *gen, const char *header, int print_areas ) /*----------------------------------------------------------------------*/ /* write list of intervals into LOG file (orig. variant by Gilks & Wild)*/ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* header ... header for table */ /* print_areas ... whether table of areas should be printed */ /*----------------------------------------------------------------------*/ { FILE *LOG; struct unur_ars_interval *iv; double Ahat, Ahatl, Ahatr; double sAhatl, sAhatr, Atotal, logAmax; int i; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_ARS_GEN,RETURN_VOID); LOG = unur_get_stream(); if (header) fprintf(LOG,"%s:%s\n",gen->genid,header); fprintf(LOG,"%s:Intervals: %d\n",gen->genid,GEN->n_ivs); if (GEN->iv) { if (gen->debug & ARS_DEBUG_IV) { #ifdef DEBUG_STORE_IP fprintf(LOG,"%s: Nr. tp ip logf(tp) dlogf(tp) squeeze\n",gen->genid); for (iv = GEN->iv, i=0; iv->next!=NULL; iv=iv->next, i++) { COOKIE_CHECK(iv,CK_ARS_IV,RETURN_VOID); fprintf(LOG,"%s:[%3d]: %#12.6g %#12.6g %#12.6g %#12.6g %#12.6g\n", gen->genid, i, iv->x, iv->ip, iv->logfx, iv->dlogfx, iv->sq); } #else fprintf(LOG,"%s: Nr. tp logf(tp) dlogf(tp) squeeze\n",gen->genid); for (iv = GEN->iv, i=0; iv->next!=NULL; iv=iv->next, i++) { COOKIE_CHECK(iv,CK_ARS_IV,RETURN_VOID); fprintf(LOG,"%s:[%3d]: %#12.6g %#12.6g %#12.6g %#12.6g\n", gen->genid, i, iv->x, iv->logfx, iv->dlogfx, iv->sq); } #endif COOKIE_CHECK(iv,CK_ARS_IV,RETURN_VOID); fprintf(LOG,"%s:[...]: %#12.6g %#12.6g %#12.6g\n", gen->genid, iv->x, iv->logfx, iv->dlogfx); } fprintf(LOG,"%s:\n",gen->genid); } else fprintf(LOG,"%s: No intervals !\n",gen->genid); if (!print_areas || GEN->Atotal <= 0.) return; /* print and sum areas below squeeze and hat */ Atotal = GEN->Atotal; logAmax = GEN->logAmax; if (gen->debug & ARS_DEBUG_IV) { fprintf(LOG,"%s:Areas in intervals relative to maximum:\t[ log(A_max) = %g ]\n",gen->genid, logAmax); fprintf(LOG,"%s: Nr.\tbelow hat (left and right)\t\t cumulated\n",gen->genid); sAhatl = sAhatr = 0.; if (GEN->iv) { for (iv = GEN->iv, i=0; iv->next!=NULL; iv=iv->next, i++) { COOKIE_CHECK(iv,CK_ARS_IV,RETURN_VOID); Ahat = scaled_area(iv); sAhatr += Ahatr = Ahat * iv->Ahatr_fract; sAhatl += Ahatl = Ahat - Ahatr; fprintf(LOG,"%s:[%3d]: %-12.6g+ %-12.6g(%6.3f%%) | %-12.6g(%6.3f%%)\n", gen->genid,i, Ahatl, Ahatr, Ahat * 100. / Atotal, iv->Acum, iv->Acum * 100. / Atotal); } fprintf(LOG,"%s: ------------------------ --------- +\n",gen->genid); fprintf(LOG,"%s: Sum : %-12.6g (%6.3f%%)\n",gen->genid, sAhatl+sAhatr, (sAhatl+sAhatr) * 100. / Atotal); fprintf(LOG,"%s:\n",gen->genid); } } /* summary of areas */ fprintf(LOG,"%s: A(total) = %-12.6g\n",gen->genid, GEN->Atotal); fprintf(LOG,"%s:\n",gen->genid); } /* end of _unur_ars_debug_intervals() */ /*---------------------------------------------------------------------------*/ void _unur_ars_debug_free( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write info about generator before destroying into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_ARS_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s:\n",gen->genid); if (gen->status == UNUR_SUCCESS) { fprintf(LOG,"%s: GENERATOR destroyed **********************\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); _unur_ars_debug_intervals(gen,NULL,TRUE); } else { fprintf(LOG,"%s: initialization of GENERATOR failed **********************\n",gen->genid); _unur_ars_debug_intervals(gen,"Intervals after failure:",FALSE); } fprintf(LOG,"%s:\n",gen->genid); fflush(LOG); } /* end of _unur_ars_debug_free() */ /*---------------------------------------------------------------------------*/ void _unur_ars_debug_split_start( const struct unur_gen *gen, const struct unur_ars_interval *iv, double x, double logfx ) /*----------------------------------------------------------------------*/ /* write info about splitting interval */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* iv ... pointer to interval */ /* x ... split at this point */ /* logfx ... value of logPDF at x */ /*----------------------------------------------------------------------*/ { FILE *LOG; double Ahat; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_ARS_GEN,RETURN_VOID); CHECK_NULL(iv,RETURN_VOID); COOKIE_CHECK(iv,CK_ARS_IV,RETURN_VOID); LOG = unur_get_stream(); Ahat = scaled_area(iv); fprintf(LOG,"%s: split interval at x = %g \t\tlogf(x) = %g\n",gen->genid,x,logfx); fprintf(LOG,"%s: old interval:\n",gen->genid); fprintf(LOG,"%s: left construction point = %-12.6g\tlogf(x) = %-12.6g\n",gen->genid,iv->x,iv->logfx); fprintf(LOG,"%s: right construction point = %-12.6g\tlogf(x) = %-12.6g\n",gen->genid,iv->next->x,iv->next->logfx); fprintf(LOG,"%s: A(hat) = %-12.6g + %-12.6g(%6.3f%%)\t[ relative to A_max ]\n",gen->genid, Ahat * (1.-iv->Ahatr_fract), Ahat * iv->Ahatr_fract, Ahat*100./GEN->Atotal); fflush(LOG); } /* end of _unur_ars_debug_split_start() */ /*---------------------------------------------------------------------------*/ void _unur_ars_debug_split_stop( const struct unur_gen *gen, const struct unur_ars_interval *iv_left, const struct unur_ars_interval *iv_right ) /*----------------------------------------------------------------------*/ /* write info about new splitted intervals */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* iv_left ... pointer to new left hand interval */ /* iv_right ... pointer to new right hand interval */ /*----------------------------------------------------------------------*/ { FILE *LOG; double Ahat; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_ARS_GEN,RETURN_VOID); CHECK_NULL(iv_left,RETURN_VOID); COOKIE_CHECK(iv_left,CK_ARS_IV,RETURN_VOID); if (iv_right == NULL) iv_right = iv_left; LOG = unur_get_stream(); fprintf(LOG,"%s: inserted point:\n",gen->genid); fprintf(LOG,"%s: x = %g, logf(x) = %g, dlogf(x) = %g, squeeze = %g:\n", gen->genid, iv_right->x, iv_right->logfx, iv_right->dlogfx, iv_right->sq); fprintf(LOG,"%s: new intervals:\n",gen->genid); fprintf(LOG,"%s: left construction point = %g\n",gen->genid, iv_left->x); if (iv_left != iv_right) fprintf(LOG,"%s: middle construction point = %g\n",gen->genid, iv_right->x); fprintf(LOG,"%s: right construction point = %g\n",gen->genid, iv_right->next->x); fprintf(LOG,"%s: left interval:\n",gen->genid); Ahat = scaled_area(iv_left); fprintf(LOG,"%s: A(hat) = %-12.6g + %-12.6g(%6.3f%%)\t[ relative to A_max ]\n",gen->genid, Ahat * (1.-iv_left->Ahatr_fract), Ahat * iv_left->Ahatr_fract, Ahat * 100./GEN->Atotal); if (iv_left == iv_right) fprintf(LOG,"%s: interval chopped.\n",gen->genid); else { fprintf(LOG,"%s: right interval:\n",gen->genid); Ahat = scaled_area(iv_right); fprintf(LOG,"%s: A(hat) = %-12.6g + %-12.6g(%6.3f%%)\t[ relative to A_max ]\n",gen->genid, Ahat * (1.-iv_right->Ahatr_fract), Ahat * iv_right->Ahatr_fract, Ahat * 100./GEN->Atotal); } fprintf(LOG,"%s: total areas:\n",gen->genid); fprintf(LOG,"%s: A(total) = %-12.6g\n",gen->genid, GEN->Atotal); fprintf(LOG,"%s:\n",gen->genid); fflush(LOG); } /* end of _unur_ars_debug_split_stop() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_INFO /*---------------------------------------------------------------------------*/ void _unur_ars_info( struct unur_gen *gen, int help ) /*----------------------------------------------------------------------*/ /* create character string that contains information about the */ /* given generator object. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* help ... whether to print additional comments */ /*----------------------------------------------------------------------*/ { struct unur_string *info = gen->infostr; struct unur_distr *distr = gen->distr; int samplesize = 10000; int n_ivs_bak; /* generator ID */ _unur_string_append(info,"generator ID: %s\n\n", gen->genid); /* distribution */ _unur_string_append(info,"distribution:\n"); _unur_distr_info_typename(gen); _unur_string_append(info," functions = logPDF dlogPDF\n"); _unur_string_append(info," domain = (%g, %g)\n", DISTR.domain[0],DISTR.domain[1]); _unur_string_append(info,"\n"); /* method */ _unur_string_append(info,"method: ARS (Adaptive Rejection Sampling)\n"); _unur_string_append(info," T_c(x) = log(x) ... c = 0\n"); _unur_string_append(info,"\n"); /* performance */ _unur_string_append(info,"performance characteristics:\n"); _unur_string_append(info," area(hat) = %g [ log = %g ]\n", GEN->Atotal*exp(GEN->logAmax), log(GEN->Atotal) + GEN->logAmax); _unur_string_append(info," rejection constant "); if (distr->set & UNUR_DISTR_SET_PDFAREA) _unur_string_append(info,"= %g\n", GEN->Atotal*exp(GEN->logAmax)/DISTR.area); else { n_ivs_bak = GEN->n_ivs; GEN->n_ivs = GEN->max_ivs+1; _unur_string_append(info,"= %.3f [approx.]\n", unur_test_count_urn(gen,samplesize,0,NULL)/(2.*samplesize)); GEN->n_ivs = n_ivs_bak; } _unur_string_append(info," # intervals = %d\n", GEN->n_ivs); _unur_string_append(info,"\n"); /* parameters */ if (help) { _unur_string_append(info,"parameters:\n"); _unur_string_append(info," cpoints = %d %s\n", GEN->n_starting_cpoints, (gen->set & ARS_SET_N_CPOINTS) ? "" : "[default]"); if (gen->variant & ARS_VARFLAG_VERIFY) _unur_string_append(info," verify = on\n"); if (gen->variant & ARS_VARFLAG_PEDANTIC) _unur_string_append(info," pedantic = on\n"); _unur_string_append(info,"\n"); /* Not displayed: int unur_ars_set_max_intervals( UNUR_PAR *parameters, int max_ivs ); int unur_ars_set_cpoints( UNUR_PAR *parameters, int n_cpoints, const double *cpoints ); int unur_ars_set_reinit_percentiles( UNUR_PAR *parameters, int n_percentiles, const double *percentiles ); int unur_ars_set_reinit_ncpoints( UNUR_PAR *parameters, int ncpoints ); */ } /* Hints */ /* if (help) { */ /* _unur_string_append(info,"\n"); */ /* } */ } /* end of _unur_ars_info() */ /*---------------------------------------------------------------------------*/ #endif /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/nrou.h0000644001357500135600000002230014420445767013435 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: nrou.h * * * * PURPOSE: * * function prototypes for method NROU * * (Naive Ratio-Of-Uniforms method) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /* =METHOD NROU Naive Ratio-Of-Uniforms method =UP Methods_for_CONT =REQUIRED PDF =OPTIONAL mode, center, bounding rectangle for acceptance region =SPEED Set-up: slow or fast, Sampling: moderate =REINIT supported =REF [HLD04: Sect.2.4 and Sect.6.4] =DESCRIPTION NROU is an implementation of the (generalized) ratio-of-uniforms method which uses (minimal) bounding rectangles, see @ref{Ratio-of-Uniforms}. It uses a positive control parameter @i{r} for adjusting the algorithm to the given distribution to improve performance and/or to make this method applicable. Larger values of @i{r} increase the class of distributions for which the method works at the expense of a higher rejection constant. For computational reasons @i{r=1} should be used if possible (this is the default). Moreover, this implementation uses the center @unurmath{\mu} of the distribution (see unur_distr_cont_get_center() for details of its default values). For the special case with @unurmath{r=1} the coordinates of the minimal bounding rectangles are given by @unurmathdisplay{ v^+ = \sup\limits_{x} \sqrt{PDF(x)}, \\ u^- = \inf\limits_{x} (x-\mu) \sqrt{PDF(x)}, \\ u^+ = \sup\limits_{x} (x-\mu) \sqrt{PDF(x)}, } where @unurmath{\mu} is the center of the distribution. For other values of @i{r} we have @unurmathdisplay{ v^+ = \sup\limits_{x} (PDF(x))^{1/(r+1)}, \\ u^- = \inf\limits_{x} (x-\mu) (PDF(x))^{r/(r+1)}, \\ u^+ = \sup\limits_{x} (x-\mu) (PDF(x))^{r/(r+1)}. } These bounds can be given directly. Otherwise they are computed automatically by means of a (slow) numerical routine. Of course this routine can fail, especially when this rectangle is not bounded. It is important to note that the algorithm works with @unurmath{PDF(x-\mu)} instead of @unurmath{PDF(x).} This is important as otherwise the acceptance region can become a very long and skinny ellipsoid along a diagonal of the (huge) bounding rectangle. =HOWTOUSE For using the NROU method UNU.RAN needs the PDF of the distribution. Additionally, the parameter @i{r} can be set via a unur_vnrou_set_r() call. Notice that the acceptance probability decreases when @i{r} is increased. On the other hand is is more unlikely that the bounding rectangle does not exist if @i{r} is small. A bounding rectangle can be given by the unur_vnrou_set_u() and unur_vnrou_set_v() calls. @emph{Important:} The bounding rectangle has to be provided for the function @unurmath{PDF(x-center)!} Notice that @code{center} is the center of the given distribution, see unur_distr_cont_set_center(). If in doubt or if this value is not optimal, it can be changed (overridden) by a unur_nrou_set_center() call. If the coordinates of the bounding rectangle are not provided by the user then the minimal bounding rectangle is computed automatically. By means of unur_vnrou_set_verify() and unur_vnrou_chg_verify() one can run the sampling algorithm in a checking mode, i.e., in every cycle of the rejection loop it is checked whether the used rectangle indeed enclosed the acceptance region of the distribution. When in doubt (e.g., when it is not clear whether the numerical routine has worked correctly) this can be used to run a small Monte Carlo study. It is possible to change the parameters and the domain of the chosen distribution and run unur_reinit() to reinitialize the generator object. Notice, that derived parameters like the mode must also be (re-) set if the parameters or the domain has be changed. Notice, however, that then the values that has been set by unur_vnrou_set_u() and unur_vnrou_set_v() calls are removed and the coordinates of the bounding box are computed numerically. =END */ /*---------------------------------------------------------------------------*/ /* Routines for user interface */ /* =ROUTINES */ UNUR_PAR *unur_nrou_new( const UNUR_DISTR *distribution ); /* Get default parameters for generator. */ /*...........................................................................*/ int unur_nrou_set_u( UNUR_PAR *parameters, double umin, double umax ); /* Sets left and right boundary of bounding rectangle. If no values are given, the boundary of the minimal bounding rectangle is computed numerically. @emph{Notice}: Computing the minimal bounding rectangle may fail under some circumstances. Moreover, for multimodal distributions the bounds might be too small as only local extrema are computed. Nevertheless, for @unurmath{T_c}-concave distributions with @unurmath{c=-1/2} it should work. @emph{Important:} The bounding rectangle that has to be provided is for the function @unurmath{PDF(x-center)!} Default: not set. */ int unur_nrou_set_v( UNUR_PAR *parameters, double vmax ); /* Set upper boundary for bounding rectangle. If this value is not given then @unurmath{\sqrt{PDF(mode)}} is used instead. @emph{Notice}: When the mode is not given for the distribution object, then it will be computed numerically. Default: not set. */ int unur_nrou_set_r( UNUR_PAR *parameters, double r ); /* Sets the parameter @var{r} of the generalized ratio-of-uniforms method. @emph{Notice}: This parameter must satisfy @var{r}>0. Default: @code{1}. */ int unur_nrou_set_center( UNUR_PAR *parameters, double center ); /* Set the center @unurmath{\mu} of the PDF. If not set the center of the given distribution object is used. Default: see unur_distr_cont_set_center(). */ int unur_nrou_set_verify( UNUR_PAR *parameters, int verify ); /* Turn verifying of algorithm while sampling on/off. If the condition @unurmath{PDF(x) \leq hat(x)} is violated for some @i{x} then @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. However, notice that this might happen due to round-off errors for a few values of @i{x} (less than 1%). Default is FALSE. */ int unur_nrou_chg_verify( UNUR_GEN *generator, int verify ); /* Change the verifying of algorithm while sampling on/off. */ /* =END */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/norta_struct.h0000644001357500135600000000710714420445767015211 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: norta_struct.h * * * * PURPOSE: * * declares structures for method NORTA * * (NORmal To Anything) * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Information for constructing the generator */ struct unur_norta_par { int dummy; }; /*---------------------------------------------------------------------------*/ /* The generator object */ struct unur_norta_gen { int dim; /* dimension of distribution */ double *copula; /* pointer to intermediate copula */ struct unur_distr *normaldistr; /* standard normal distribution */ struct unur_gen **marginalgen_list; /* list of generators for marginal distributions */ /* Remark: We use gen->gen_aux to store the pointer to the */ /* multinormal generator. */ /* It is accessed via the macro 'MNORMAL'. */ }; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/pinv.h0000644001357500135600000005272114420445767013440 00000000000000/***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: pinv.h * * * * PURPOSE: * * function prototypes for method PINV * * (Polynomial interpolation based INVersion of CDF) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2008-2010 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /* =METHOD PINV Polynomial interpolation based INVersion of CDF =UP Methods_for_CONT =REQUIRED PDF =OPTIONAL domain, center, CDF, derivative of PDF =REF [DHLa08] =SPEED Set-up: (very) slow, Sampling: (very) fast =REINIT not implemented =DESCRIPTION PINV is a variant of numerical inversion, where the inverse CDF is approximated using Newton's interpolating formula. The interval [0,1] is split into several subintervals. In each of these the inverse CDF is constructed at nodes @unurmath{(CDF(x),x)} for some points @i{x} in this subinterval. If the PDF is given, then the CDF is computed numerically from the given PDF using adaptive Gauss-Lobatto integration with 5 points. Subintervals are split until the requested accuracy goal is reached. The method is not exact, as it only produces random variates of the approximated distribution. Nevertheless, the maximal tolerated approximation error can be set to be the resolution (but of course is bounded by the machine precision). We use the u-error @unurmath{|U-CDF(X)|} to measure the error for @i{X} = "approximate inverse CDF"(@i{U}). Notice that very small values of the u-resolution are possible but increase the cost for the setup step. We call the maximal tolerated u-error the @emph{u-resolution} of the algorithm in the sequel. Both the order of the interpolating polynomial and the u-resolution can be selected. The interpolating polynomials have to be computed in a setup step. However, it only works for distributions with bounded domain; for distributions with unbounded domain the tails are cut off such that the probability for the tail regions is small compared to the given u-resolution. The construction of the interpolation polynomial only works when the PDF is unimodal or when the PDF does not vanish between two modes. There are some restrictions for the given distribution: @itemize @item The support of the distribution (i.e., the region where the PDF is strictly positive) must be connected. In practice this means, that the region where PDF is "not too small" must be connected. Unimodal densities satisfy this condition. If this condition is violated then the domain of the distribution might be truncated. @item When the PDF is integrated numerically, then the given PDF must be continuous and should be smooth. @item The PDF must be bounded. @item The algorithm has problems when the distribution has heavy tails (as then the inverse CDF becomes very steep at 0 or 1) and the requested u-resolution is very small. E.g., the Cauchy distribution is likely to show this problem when the requested u-resolution is less then @code{1.e-12}. @end itemize Regions with very small PDF values or heavy tails might lead to an abortion of the set-up or (even worse) the approximation error might become larger than requested, since the (computation of the) interpolating polynomial becomes numerically unstable. @emph{Remark:} We also have implemented experimental variants. However, we observed that these variants are more sensitive to round-off errors, especially in the right hand tail and we @emph{do not recommend} their usage unless there are severe reasons. @itemize @minus @item Use a function that implements the CDF instead of numerical integration of the PDF. @item Use Hermite interpolation instead of Newton interpolation. Thus the first (and second) derivative of the interpolating polynomial coincides with that of the inverse CDF. Consequently the interpolant is also (twice) differentiable even at the interval boundaries. This variant can be seen as limiting case of Newton interpolation with double (or triple) points as nodes. We have used a @emph{smoothness} parameter to control this feature. However, besides numerical problems we observed that this variant requires more intervals and thus larger setup times and higher memory consumptions. @end itemize =HOWTOUSE PINV works for continuous univariate distribution objects with given PDF. The corresponding distribution object should contain a typical point of the distribution, i.e., a point where the PDF is not too small, e.g., (a point near) the mode. However, it is important that the center is @strong{not} the pole of the distribution (or a point too close to the pole). It can be set using a unur_distr_cont_set_center() or a unur_distr_cont_set_mode() call. If neither is set, or if the given center cannot be used, then a simple search routine tries to find an appropriate point for the center. It is recommended that the domain of the distribution with bounded domain is specified using a unur_distr_cont_set_domain() call. Otherwise, the boundary is searched numerically which might be rather expensive, especially when this boundary point is @code{0}. The inverse CDF is interpolated using Newton polynomials. The order of this polynomial can be set by means of a unur_pinv_set_order() call. The smoothness of the interpolant at interval boundaries can be controlled using a unur_pinv_set_smoothness() call. Then Hermite interpolation instead of Newton interpolation is used. (The former can be seen as a limiting case of Newton interpolation with double (or triple) points.) However, using higher smoothness is @emph{not recommended} unless differentiability at the interval boundaries is important. For distributions with unbounded domains the tails are cut off such that the probability for the tail regions is small compared to the given u-resolution. For finding these cut points the algorithm starts with the region @code{[-1.e100,1.e100]}. For the exceptional case where this does not work these starting points can be changed via a unur_pinv_set_boundary() call. This method is not exact, as it only produces random variates of the approximated distribution. Nevertheless, the numerical error in "u-direction" (i.e., |U-CDF(X)|, for X = "approximate inverse CDF"(U) |U-CDF(X)|) can be controlled by means of unur_pinv_set_u_resolution(). However, the maximal error of this approximation is only estimated. For very small u-resolutions the actual approximation error might be (slightly) larger than the requested u-resolution. (Of course the size of this value depends on the given PDF.) If this error is crucial for an application we recommend to compute this error using unur_pinv_estimate_error() which runs a small Monte Carlo simulation. It is also possible to improve the error estimate during setup by means of unur_pinv_set_extra_testpoints(). See also the documentation for function unur_pinv_set_u_resolution() and the remark given there. The number of required subintervals heavily depends on the order of the interpolating polynomial and the requested u-resolution: it increases when order or u-resolution are decreased. It can be checked using a unur_pinv_get_n_intervals() call. The maximum number of such subintervals is fixed but can be increased using a unur_pinv_set_max_intervals() call. If this maximum number is too small then the set-up aborts with a corresponding error message. It is also possible to use the CDF of the distribution instead of the PDF. Then the distribution object must contain a pointer to the CDF. Moreover, this variant of the algorithm has to be switched on using an unur_pinv_set_usecdf() call. Notice, however, that the setup for this variant is numerically less stable than using integration of the PDF (the default variant). Thus using the CDF is @emph{not recommended}. =END */ /*---------------------------------------------------------------------------*/ /* Routines for user interface */ /* =ROUTINES */ UNUR_PAR *unur_pinv_new( const UNUR_DISTR *distribution ); /* Get default parameters for generator. */ /*...........................................................................*/ int unur_pinv_set_order( UNUR_PAR *parameters, int order); /* Set order of interpolation. Valid orders are between @code{3} and @code{17}. Higher orders result in fewer intervals for the approximations. Default: @code{5}. */ int unur_pinv_set_smoothness( UNUR_PAR *parameters, int smoothness); /* Set smoothness of interpolant. By construction the interpolant is piecewise polynomial and thus smooth on each of the intervals where these polynomials are constructed. At the interval boundaries, however, it usually not be differentiable. Method PINV also implements variants of Newton interpolation where the first (or second) derivative of the interpolating polynomial coincides with the respective derivative of the inverse CDF at the nodes. The the interpolant is (twice) differentiable even at the interval boundaries. These variants can be seen as limiting case of Newton interpolation with double (or triple) points as nodes and are known as Hermite interpolation. Possible values for @var{smoothness}: @multitable @columnfractions .1 .25 .60 @headitem Value @tab Effect @tab Requirements @item @code{0} @tab continuous @tab requires PDF (or CDF) @item @code{1} @tab differentiable @tab requires PDF (optional: CDF), @* order of polynomial must be odd @item @code{2} @tab twice differentiable @tab requires PDF and its derivative (optional: CDF), @* order must be 5, 8, 11, 14 or 17 @end multitable If the order of the polynomial does not satisfy the given condition, then it is increased to the next larger possible value. @emph{Remark:} A higher smoothness parameter usually results in a higher number of intervals and thus a higher setup time and memory consumption. We also observed that higher smoothness parameters make the algorithm more sensible for round-off error. Then the setup fails. @emph{Remark:} If the interpolating polynomial cannot be constructed for the requested smoothness on a particular interval, then the smoothness parameter is reduced for that interval. @emph{Remark:} For order @code{3} and smoothness @code{1} (cubic Hermite interpolation) monotonicity is guaranteed by checking a simple monotonicity condition for the coefficients of the polynomials. @emph{Remark:} Using @var{smoothness} larger than @code{0} is @emph{not recommended} unless differentiability at the interval boundaries is important for ones application. Default: @code{0}. */ int unur_pinv_set_u_resolution( UNUR_PAR *parameters, double u_resolution); /* Set maximal tolerated u-error. Values of @var{u_resolution} must at least @code{1.e-15} and @code{1.e-5} at most. Notice that the resolution of most uniform random number sources is @unurmath{2^{-32}} = @code{2.3e-10}. Thus a value of @code{1.e-10} leads to an inversion algorithm that could be called exact. For most simulations slightly bigger values for the maximal error are enough as well. Smaller values for @var{u_resolution} increase the number of subinterval that are necessary for the approximation of the inverse CDF. For very small values (less then @code{1.e-12}) this number might exceed the maximum number of such intervals. However, this number can be increased using a unur_pinv_set_max_intervals() call. @emph{Remark:} We ran many experiments and found that the observed u-error was always smaller than the given @var{u_resolution} whenever this value was @code{1.e-12}. For values smaller than @code{1e-13} the maximal observed u-error was slightly larger. One use @code{1.e-15} if best approximation is required. However, then the actual u-error can be as large as @code{1.e-14}. Consider calling unur_pinv_set_extra_testpoints() in order to reduce the risk of larger approximation errors. @strong{Warning!} These figures are based on our experiments (with some tolerance added to be on the safe side). There is no guarantee for these error estimates for a particular distribution. Default is @code{1.e-10}. */ int unur_pinv_set_extra_testpoints( UNUR_PAR *parameters, int n_points); /* During setup method PINV checks the current u-error by means of carefully selected test points and improves the approximation where necessary. However, it nevertheless may happen, that the maximal approximation error is larger than estimated in some interval (which usually is hit with a very small probability). This estimate can be improved by using extra test points which can be added by means of this call. However, this increases the setup time considerably. Note that these additional points are selected equidistributed in each subinterval. Default is @code{0} (i.e., no additional test points are used). */ int unur_pinv_set_use_upoints( UNUR_PAR *parameters, int use_upoints ); /* If @var{use_upoints} is TRUE, then the nodes of the interpolating polynomial are constructed by means of Chebyshev points in u-scale not in x-scale. This results is a better approximation but almost doubles the number of PDF or CDF evaluations during the setup. (This is an experimental feature.) Default: FALSE */ int unur_pinv_set_usepdf( UNUR_PAR *parameters ); /* Use PDF (if available) to compute approximate inverse CDF. This is the default. */ int unur_pinv_set_usecdf( UNUR_PAR *parameters ); /* Use CDF (if available) to compute approximate inverse CDF. This variant is intend for running experiments with method PINV. @emph{Remark:} We ran many experiments and found that for small values of the given @var{u_resolution} (less than @code{1.e-12}) the setup fails for distributions with heavy tails. We found that using the PDF (instead of the CDF) is numerically more stable. This is especially the case when the smoothness parameter is set to @code{1} or @code{2}. Using the CDF is @strong{not recommended}. */ int unur_pinv_set_boundary( UNUR_PAR *parameters, double left, double right ); /* Set @var{left} and @var{right} point for finding the cut-off points for the "computational domain", i.e., the domain that covers the essential part of the distribution. The cut-off points are computed such that the tail probabilities are smaller than given by unur_pinv_set_u_resolution(). It is usually safe to use a large interval. However, @code{+/- UNUR_INFINITY} is not allowed. @emph{Important}: This call does not change the domain of the given distribution itself. But it restricts the domain for the resulting random variates. Default: intersection of @code{[-1.e100,+1.e100]} and the given domain of the distribution. */ int unur_pinv_set_searchboundary( UNUR_PAR *parameters, int left, int right ); /* If @var{left} or @var{right} is set to FALSE then the respective boundary as given by a unur_pinv_set_boundary() call is used without any further computations. However, these boundary points might cause numerical problems during the setup when PDF returns @code{0} ``almost everywhere''. If set to TRUE (the default) then the computational interval is shortened to a more sensible region by means of a search algorithm. Switching off this search is useful, e.g., for the Gamma(2) distribution where the left border @code{0} is fixed and finite. @emph{Remark:} The searching algorithm assumes that the support of the distribution is connected. @emph{Remark:} Do not set this parameter to FALSE except when searching for cut-off points fails and one wants to try with precomputed values. Default: TRUE. */ int unur_pinv_set_max_intervals( UNUR_PAR *parameters, int max_ivs ); /* Set maximum number of intervals. @var{max_ivs} must be at least @code{100} and at most @code{1000000}. Default is @code{10000}. */ int unur_pinv_get_n_intervals( const UNUR_GEN *generator ); /* Get number of intervals used for interpolation in the generator object. It returns @code{0} in case of an error. */ int unur_pinv_set_keepcdf( UNUR_PAR *parameters, int keepcdf); /* If the PDF is given, then the CDF is computed numerically from the given PDF using adaptive Gauss-Lobatto integration. Thus a table of CDF points is stored to keep the number of evaluations of the PDF minimal. Usually this table is discarded when the setup is completed. If @var{keepcdf} is TRUE, then this table is kept and can be used to compute the CDF of the underlying distribution by means of function unur_pinv_eval_approxcdf(). This option is ignored when unur_pinv_set_usecdf() is called. Default: FALSE */ double unur_pinv_eval_approxinvcdf( const UNUR_GEN *generator, double u ); /* Evaluate interpolation of inverse CDF at @var{u}. If @var{u} is out of the domain (0,1) then @code{unur_errno} is set to @code{UNUR_ERR_DOMAIN} and the respective bound of the domain of the distribution are returned (which is @code{-UNUR_INFINITY} or @code{UNUR_INFINITY} in the case of unbounded domains). */ double unur_pinv_eval_approxcdf( const UNUR_GEN *generator, double x ); /* Evaluate (approximate) CDF at @var{x}. If the PDF of the distribution is given, then adaptive Gauss-Lobatto integration is used to compute the CDF. If the PDF is used to create the generator object, then the table of integral values must not removed at the end of setup and thus unur_pinv_set_keepcdf() must be called. */ int unur_pinv_estimate_error( const UNUR_GEN *generator, int samplesize, double *max_error, double *MAE ); /* Estimate maximal u-error and mean absolute error (MAE) for @var{generator} by means of Monte-Carlo simulation with sample size @var{samplesize}. The results are stored in @var{max_error} and @var{MAE}, respectively. It returns @code{UNUR_SUCCESS} if successful. */ /* =END */ /*---------------------------------------------------------------------------*/ /* Remark: PINV needs a first guess for the area below the PDF. This value can be set using the unur_distr_cont_set_pdfarea() call. Otherwise @code{1} is used. There is no necessity to set this area unless it differs from 1 by several orders of magnitude. */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/ssr.c0000644001357500135600000014447114420445767013272 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: ssr.c * * * * TYPE: continuous univariate random variate * * METHOD: rejection with universal bounds * * * * DESCRIPTION: * * Given PDF and mode of a T_{-1/2}-concave distribution * * produce a value x consistent with its density * * * * REQUIRED: * * pointer to the density function * * mode of the density * * area below PDF * * OPTIONAL: * * CDF at mode * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * ***************************************************************************** * * * REFERENCES: * * [1] Leydold J. (2001): A simple universal generator for continuous and * * discrete univariate T-concave distributions, * * ACM Trans. Math. Software 27(1), pp. 66--82. * * * * [2] Hoermann W. (1995): A rejection technique for sampling from * * T-concave distributions, ACM TOMS 21, p. 182-193 * * * ***************************************************************************** * * * This algorithm is based on transformed density rejection (see [2]), were * * universal upper and lower bounds are used. These are derived via the * * ratio-of-uniforms method. See [1] for details and a description of the * * algorithm. It works for any distribution, where -1/sqrt(PDF(x)) is * * concave. This includes all log-concave distributions. * * * * (The mirror principle has not been implemented.) * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include "unur_methods_source.h" #include "x_gen_source.h" #include "ssr.h" #include "ssr_struct.h" #ifdef UNUR_ENABLE_INFO # include #endif /*---------------------------------------------------------------------------*/ /* Variants: none */ #define SSR_VARFLAG_VERIFY 0x002u /* run verify mode */ #define SSR_VARFLAG_SQUEEZE 0x004u /* use universal squeeze if possible */ #define SSR_VARFLAG_MIRROR 0x008u /* use mirror principle */ /* not implemented yet! */ /*---------------------------------------------------------------------------*/ /* Debugging flags */ /* bit 01 ... pameters and structure of generator (do not use here) */ /* bits 02-12 ... setup */ /* bits 13-24 ... adaptive steps */ /* bits 25-32 ... trace sampling */ #define SSR_DEBUG_REINIT 0x00000010u /* print parameters after reinit */ /*---------------------------------------------------------------------------*/ /* Flags for logging set calls */ #define SSR_SET_CDFMODE 0x001u /* CDF at mode is known */ #define SSR_SET_PDFMODE 0x002u /* PDF at mode is set */ /*---------------------------------------------------------------------------*/ #define GENTYPE "SSR" /* type of generator */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_ssr_init( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* Initialize new generator. */ /*---------------------------------------------------------------------------*/ static int _unur_ssr_reinit( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Reinitialize generator. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_ssr_create( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* create new (almost empty) generator object. */ /*---------------------------------------------------------------------------*/ static int _unur_ssr_check_par( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Check parameters of given distribution and method */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_ssr_clone( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* copy (clone) generator object. */ /*---------------------------------------------------------------------------*/ static void _unur_ssr_free( struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* destroy generator object. */ /*---------------------------------------------------------------------------*/ static double _unur_ssr_sample( struct unur_gen *gen ); static double _unur_ssr_sample_check( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* sample from generator */ /*---------------------------------------------------------------------------*/ static int _unur_ssr_hat( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* compute universal hat. */ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ /* the following functions print debugging information on output stream, */ /* i.e., into the LOG file if not specified otherwise. */ /*---------------------------------------------------------------------------*/ static void _unur_ssr_debug_init( const struct unur_gen *gen, int is_reinit ); /*---------------------------------------------------------------------------*/ /* print after generator has been initialized has completed. */ /*---------------------------------------------------------------------------*/ #endif #ifdef UNUR_ENABLE_INFO static void _unur_ssr_info( struct unur_gen *gen, int help ); /*---------------------------------------------------------------------------*/ /* create info string. */ /*---------------------------------------------------------------------------*/ #endif /*---------------------------------------------------------------------------*/ /* abbreviations */ #define DISTR_IN distr->data.cont /* data for distribution object */ #define PAR ((struct unur_ssr_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_ssr_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.cont /* data for distribution in generator object */ #define BD_LEFT domain[0] /* left boundary of domain of distribution */ #define BD_RIGHT domain[1] /* right boundary of domain of distribution */ #define SAMPLE gen->sample.cont /* pointer to sampling routine */ #define PDF(x) _unur_cont_PDF((x),(gen->distr)) /* call to PDF */ /*---------------------------------------------------------------------------*/ #define _unur_ssr_getSAMPLE(gen) \ ( ((gen)->variant & SSR_VARFLAG_VERIFY) \ ? _unur_ssr_sample_check : _unur_ssr_sample ) /*---------------------------------------------------------------------------*/ /* constants */ #define SQRT2 1.4142135623731 /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Public: User Interface (API) **/ /*****************************************************************************/ struct unur_par * unur_ssr_new( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get default parameters */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* default parameters (pointer to structure) */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_par *par; /* check arguments */ _unur_check_NULL( GENTYPE,distr,NULL ); /* check distribution */ if (distr->type != UNUR_DISTR_CONT) { _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } COOKIE_CHECK(distr,CK_DISTR_CONT,NULL); if (DISTR_IN.pdf == NULL) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PDF"); return NULL; } /* allocate structure */ par = _unur_par_new( sizeof(struct unur_ssr_par) ); COOKIE_SET(par,CK_SSR_PAR); /* copy input */ par->distr = distr; /* pointer to distribution object */ /* set default values */ PAR->Fmode = -1.; /* CDF at mode (unknown yet) */ PAR->fm = -1.; /* PDF at mode (unknown) */ PAR->um = -1.; /* square of PDF at mode (unknown) */ par->method = UNUR_METH_SSR; /* method and default variant */ par->variant = 0u; /* default variant */ par->set = 0u; /* inidicate default parameters */ par->urng = unur_get_default_urng(); /* use default urng */ par->urng_aux = NULL; /* no auxilliary URNG required */ par->debug = _unur_default_debugflag; /* set default debugging flags */ /* routine for starting generator */ par->init = _unur_ssr_init; return par; } /* end of unur_ssr_new() */ /*****************************************************************************/ int unur_ssr_set_cdfatmode( struct unur_par *par, double Fmode ) /*----------------------------------------------------------------------*/ /* set cdf at mode */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* Fmode ... CDF at mode */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, SSR ); /* check new parameter for generator */ if (Fmode < 0. || Fmode > 1.) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"CDF(mode)"); return UNUR_ERR_PAR_SET; } /* store date */ PAR->Fmode = Fmode; /* changelog */ par->set |= SSR_SET_CDFMODE; return UNUR_SUCCESS; } /* end of unur_ssr_set_cdfatmode() */ /*---------------------------------------------------------------------------*/ int unur_ssr_set_pdfatmode( UNUR_PAR *par, double fmode ) /*----------------------------------------------------------------------*/ /* Set PDF at mode. if set the PDF at the mode is never changed. */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* fmode ... PDF at mode */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, SSR ); /* check new parameter for generator */ if (fmode <= 0.) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"PDF(mode)"); return UNUR_ERR_PAR_SET; } if (!_unur_isfinite(fmode)) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"PDF(mode) overflow"); return UNUR_ERR_PAR_SET; } /* store date */ PAR->fm = fmode; PAR->um = sqrt(fmode); /* changelog */ par->set |= SSR_SET_PDFMODE; return UNUR_SUCCESS; } /* end of unur_ssr_set_pdfatmode() */ /*---------------------------------------------------------------------------*/ int unur_ssr_set_verify( struct unur_par *par, int verify ) /*----------------------------------------------------------------------*/ /* turn verifying of algorithm while sampling on/off */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* verify ... 0 = no verifying, !0 = verifying */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* no verifying is the default */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, SSR ); /* we use a bit in variant */ par->variant = (verify) ? (par->variant | SSR_VARFLAG_VERIFY) : (par->variant & (~SSR_VARFLAG_VERIFY)); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_ssr_set_verify() */ /*---------------------------------------------------------------------------*/ int unur_ssr_chg_verify( struct unur_gen *gen, int verify ) /*----------------------------------------------------------------------*/ /* turn verifying of algorithm while sampling on/off */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* verify ... 0 = no verifying, !0 = verifying */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* no verifying is the default */ /*----------------------------------------------------------------------*/ { /* check input */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, SSR, UNUR_ERR_GEN_INVALID ); /* we must not change this switch when sampling has been disabled by using a pointer to the error producing routine */ if (SAMPLE == _unur_sample_cont_error) return UNUR_FAILURE; if (verify) /* turn verify mode on */ gen->variant |= SSR_VARFLAG_VERIFY; else /* turn verify mode off */ gen->variant &= ~SSR_VARFLAG_VERIFY; SAMPLE = _unur_ssr_getSAMPLE(gen); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_ssr_chg_verify() */ /*---------------------------------------------------------------------------*/ int unur_ssr_set_usesqueeze( struct unur_par *par, int usesqueeze ) /*----------------------------------------------------------------------*/ /* set flag for using universal squeeze (default: off) */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* usesqueeze ... 0 = no squeeze, !0 = use squeeze */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* no squeeze is the default */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, SSR ); /* we use a bit in variant */ par->variant = (usesqueeze) ? (par->variant | SSR_VARFLAG_SQUEEZE) : (par->variant & (~SSR_VARFLAG_SQUEEZE)); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_ssr_set_usesqueeze() */ /*****************************************************************************/ int unur_ssr_chg_cdfatmode( struct unur_gen *gen, double Fmode ) /*----------------------------------------------------------------------*/ /* change value of CDF at mode */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* Fmode ... CDF at mode */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, SSR, UNUR_ERR_GEN_INVALID ); /* check new parameter for generator */ if (Fmode < 0. || Fmode > 1.) { _unur_warning(gen->genid,UNUR_ERR_PAR_SET,"CDF(mode)"); return UNUR_ERR_PAR_SET; } /* copy parameters */ GEN->Fmode = Fmode; /* changelog */ gen->set |= SSR_SET_CDFMODE; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_ssr_chg_cdfatmode() */ /*---------------------------------------------------------------------------*/ int unur_ssr_chg_pdfatmode( struct unur_gen *gen, double fmode ) /*----------------------------------------------------------------------*/ /* change value of PDF at mode */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* fmode ... PDF at mode */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, SSR, UNUR_ERR_GEN_INVALID ); /* check new parameter for generator */ if (fmode <= 0.) { _unur_warning(gen->genid,UNUR_ERR_PAR_SET,"PDF(mode)"); return UNUR_ERR_PAR_SET; } if (!_unur_isfinite(fmode)) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"PDF(mode) overflow"); return UNUR_ERR_PAR_SET; } /* store date */ GEN->fm = fmode; GEN->um = sqrt(fmode); /* changelog */ gen->set |= SSR_SET_PDFMODE; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_ssr_chg_pdfatmode() */ /*****************************************************************************/ /** Private **/ /*****************************************************************************/ struct unur_gen * _unur_ssr_init( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* initialize new generator */ /* */ /* parameters: */ /* params pointer to paramters for building generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); /* check input */ if ( par->method != UNUR_METH_SSR ) { _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); return NULL; } COOKIE_CHECK(par,CK_SSR_PAR,NULL); if (! (par->set & SSR_SET_CDFMODE)) /* cdf at mode unknown --> thus we cannot use universal squeeze */ par->variant &= ~SSR_VARFLAG_SQUEEZE; /* create a new empty generator object */ gen = _unur_ssr_create(par); /* free parameters */ _unur_par_free(par); if (!gen) return NULL; /* check parameters */ if (_unur_ssr_check_par(gen) != UNUR_SUCCESS) { _unur_ssr_free(gen); return NULL; } /* compute universal bounding rectangle */ if (_unur_ssr_hat(gen)!=UNUR_SUCCESS) { _unur_ssr_free(gen); return NULL; } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_ssr_debug_init(gen, FALSE); #endif return gen; } /* end of _unur_ssr_init() */ /*---------------------------------------------------------------------------*/ int _unur_ssr_reinit( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* re-initialize (existing) generator. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int rcode; /* check parameters */ if ( (rcode = _unur_ssr_check_par(gen)) != UNUR_SUCCESS) return rcode; /* compute universal bounding rectangle */ rcode = _unur_ssr_hat( gen ); /* (re)set sampling routine */ SAMPLE = _unur_ssr_getSAMPLE(gen); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug & SSR_DEBUG_REINIT) _unur_ssr_debug_init(gen,TRUE); #endif return rcode; } /* end of _unur_ssr_reinit() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_ssr_create( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* allocate memory for generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* pointer to (empty) generator object with default settings */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_SSR_PAR,NULL); /* create new generic generator object */ gen = _unur_generic_create( par, sizeof(struct unur_ssr_gen) ); /* magic cookies */ COOKIE_SET(gen,CK_SSR_GEN); /* set generator identifier */ gen->genid = _unur_set_genid(GENTYPE); /* routines for sampling and destroying generator */ SAMPLE = _unur_ssr_getSAMPLE(gen); gen->destroy = _unur_ssr_free; gen->clone = _unur_ssr_clone; gen->reinit = _unur_ssr_reinit; /* copy some parameters into generator object */ GEN->Fmode = PAR->Fmode; /* CDF at mode */ GEN->fm = PAR->fm; /* PDF at mode */ GEN->um = PAR->um; /* square root of PDF at mode */ /* initialize parameters */ #ifdef UNUR_ENABLE_INFO /* set function for creating info string */ gen->info = _unur_ssr_info; #endif /* return pointer to (almost empty) generator object */ return gen; } /* end of _unur_ssr_create() */ /*---------------------------------------------------------------------------*/ int _unur_ssr_check_par( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* check parameters of given distribution and method */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check for required data: mode */ if (!(gen->distr->set & UNUR_DISTR_SET_MODE)) { _unur_warning(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"mode: try finding it (numerically)"); if (unur_distr_cont_upd_mode(gen->distr)!=UNUR_SUCCESS) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"mode"); return UNUR_ERR_DISTR_REQUIRED; } } /* check for required data: area */ if (!(gen->distr->set & UNUR_DISTR_SET_PDFAREA)) { if (unur_distr_cont_upd_pdfarea(gen->distr)!=UNUR_SUCCESS) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"area below PDF"); return UNUR_ERR_DISTR_REQUIRED; } } /* mode must be in domain */ if ( (DISTR.mode < DISTR.BD_LEFT) || (DISTR.mode > DISTR.BD_RIGHT) ) { /* there is something wrong. assume: user has change domain without changing mode. but then, she probably has not updated area and is to large */ _unur_warning(GENTYPE,UNUR_ERR_GEN_DATA,"area and/or CDF at mode"); DISTR.mode = _unur_max(DISTR.mode,DISTR.BD_LEFT); DISTR.mode = _unur_min(DISTR.mode,DISTR.BD_RIGHT); } return UNUR_SUCCESS; } /* end of _unur_ssr_check_par() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_ssr_clone( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* copy (clone) generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to clone of generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { #define CLONE ((struct unur_ssr_gen*)clone->datap) struct unur_gen *clone; /* check arguments */ CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_SSR_GEN,NULL); /* create generic clone */ clone = _unur_generic_clone( gen, GENTYPE ); return clone; #undef CLONE } /* end of _unur_ssr_clone() */ /*---------------------------------------------------------------------------*/ void _unur_ssr_free( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* deallocate generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { /* check arguments */ if( !gen ) /* nothing to do */ return; /* check input */ if ( gen->method != UNUR_METH_SSR ) { _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); return; } COOKIE_CHECK(gen,CK_SSR_GEN,RETURN_VOID); /* we cannot use this generator object any more */ SAMPLE = NULL; /* make sure to show up a programming error */ /* free memory */ _unur_generic_free(gen); } /* end of _unur_ssr_free() */ /*****************************************************************************/ double _unur_ssr_sample( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { double U,V,X,xx,y; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_SSR_GEN,UNUR_INFINITY); while (1) { /* uniform ~U(0,1) */ while ( _unur_iszero(U = GEN->Aleft + _unur_call_urng(gen->urng) * GEN->Ain) ); if (U < GEN->al) { /* first part */ X = - GEN->vl * GEN->vl / U; y = (U / GEN->vl); y = y*y; } else if (U <= GEN->ar) { /* second part */ X = GEN->xl + (U-GEN->al)/GEN->fm; y = GEN->fm; } else { /* third part */ X = GEN->vr * GEN->vr / (GEN->um * GEN->vr - (U-GEN->ar)); y = (GEN->A - U) / GEN->vr; y = y*y; } /* accept or reject */ V = _unur_call_urng(gen->urng); y *= V; /* evaluate squeeze */ if (gen->variant & SSR_VARFLAG_SQUEEZE) { xx = 2 * X; if ( xx >= GEN->xl && xx <= GEN->xr && y <= GEN->fm/4. ) return (X + DISTR.mode); } /* Compute X */ X += DISTR.mode; /* evaluate PDF */ if (y <= PDF(X)) return X; } } /* end of _unur_ssr_sample() */ /*---------------------------------------------------------------------------*/ double _unur_ssr_sample_check( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator and verify that method can be used */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { double U,V,X,xx,fx,y; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_SSR_GEN,UNUR_INFINITY); while (1) { /* uniform ~U(0,1) */ while ( _unur_iszero(U = GEN->Aleft + _unur_call_urng(gen->urng) * GEN->Ain) ); if (U < GEN->al) { /* first part */ X = - GEN->vl * GEN->vl / U; y = (U / GEN->vl); y = y*y; } else if (U <= GEN->ar) { /* second part */ X = GEN->xl + (U-GEN->al)/GEN->fm; y = GEN->fm; } else { /* third part */ X = GEN->vr * GEN->vr / (GEN->um * GEN->vr - (U-GEN->ar)); y = (GEN->A - U) / GEN->vr; y = y*y; } /* compute PDF at x */ fx = PDF(X + DISTR.mode); /* verify hat function */ if ( (1.+UNUR_EPSILON) * y < fx ) _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF(x) > hat(x)"); /* accept or reject */ V = _unur_call_urng(gen->urng); y *= V; /* evaluate and check squeeze */ if (gen->variant & SSR_VARFLAG_SQUEEZE) { xx = 2 * X; if ( xx >= GEN->xl && xx <= GEN->xr ) { /* check squeeze */ if ( fx < (1.-UNUR_EPSILON) * GEN->fm/4. ) _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF(x) < squeeze(x)"); /* evaluate squeeze */ if ( y <= GEN->fm/4. ) return (X + DISTR.mode); } } /* Compute X */ X += DISTR.mode; /* evaluate PDF */ if (y <= fx) return X; } } /* end of _unur_ssr_sample_check() */ /*****************************************************************************/ /** Auxilliary Routines **/ /*****************************************************************************/ int _unur_ssr_hat( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* compute universal hat */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { double vm, fm; /* width of rectangle, PDF at mode */ double left,right; /* check arguments */ CHECK_NULL( gen, UNUR_ERR_NULL ); COOKIE_CHECK( gen,CK_SSR_GEN, UNUR_ERR_COOKIE ); /* compute PDF at mode (if not given by user) */ if (!(gen->set & SSR_SET_PDFMODE)) { fm = PDF(DISTR.mode); /* fm must be positive */ if (fm <= 0.) { _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"PDF(mode) <= 0."); return UNUR_ERR_GEN_DATA; } if (!_unur_isfinite(fm)) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"PDF(mode) overflow"); return UNUR_ERR_PAR_SET; } GEN->fm = fm; /* PDF at mode */ GEN->um = sqrt(fm); /* square root of PDF at mode */ } /* compute parameters */ vm = DISTR.area / GEN->um; if (gen->set & SSR_SET_CDFMODE) { /* cdf at mode known */ GEN->vl = -GEN->Fmode * vm; GEN->vr = vm + GEN->vl; GEN->xl = GEN->vl/GEN->um; GEN->xr = GEN->vr/GEN->um; GEN->A = 2 * DISTR.area; GEN->al = (DISTR.BD_LEFT < DISTR.mode) ? (GEN->Fmode * DISTR.area) : 0.; GEN->ar = (DISTR.BD_RIGHT > DISTR.mode) ? (GEN->al + DISTR.area) : GEN->A; /* Compute areas below hat in left tails and inside domain of PDF */ if ( (DISTR.BD_LEFT > -UNUR_INFINITY) && (DISTR.BD_LEFT < DISTR.mode) ) GEN->Aleft = GEN->vl * GEN->vl / (DISTR.mode - DISTR.BD_LEFT); else GEN->Aleft = 0.; if ( (DISTR.BD_RIGHT < UNUR_INFINITY) && (DISTR.BD_RIGHT > DISTR.mode) ) GEN->Ain = GEN->A - GEN->vr * GEN->vr / (DISTR.BD_RIGHT - DISTR.mode); else GEN->Ain = GEN->A; GEN->Ain -= GEN->Aleft; } else { /* cdf at mode unknown */ GEN->vl = -vm; GEN->vr = vm; GEN->xl = GEN->vl/GEN->um; GEN->xr = GEN->vr/GEN->um; GEN->A = 4 * DISTR.area; GEN->al = DISTR.area; GEN->ar = 3 * DISTR.area; /* Compute areas below hat in left tails and inside domain of PDF */ if (DISTR.BD_LEFT > -UNUR_INFINITY) { left = DISTR.BD_LEFT - DISTR.mode; GEN->Aleft = (GEN->xl > left) ? (GEN->vl * GEN->vl / (-left)) : (GEN->al + GEN->fm * (left - GEN->xl)); } else GEN->Aleft = 0.; if (DISTR.BD_RIGHT < UNUR_INFINITY) { right = DISTR.BD_RIGHT - DISTR.mode; GEN->Ain = (GEN->xr < right) ? (GEN->A - GEN->vr * GEN->vr / right) : (GEN->ar - GEN->fm * (GEN->xr - right)); } else GEN->Ain = GEN->A; GEN->Ain -= GEN->Aleft; } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ #endif return UNUR_SUCCESS; } /* end of _unur_ssr_hat() */ /*****************************************************************************/ /** Debugging utilities **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ static void _unur_ssr_debug_init( const struct unur_gen *gen, int is_reinit ) /*----------------------------------------------------------------------*/ /* write info about generator into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* is_reinit ... if TRUE the generator has been reinitialized */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_SSR_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s:\n",gen->genid); if (!is_reinit) { fprintf(LOG,"%s: type = continuous univariate random variates\n",gen->genid); fprintf(LOG,"%s: method = ssr (simple universal transformed density rection)\n",gen->genid); } else fprintf(LOG,"%s: reinit!\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); _unur_distr_cont_debug( gen->distr, gen->genid ); fprintf(LOG,"%s: sampling routine = _unur_ssr_sample",gen->genid); if (gen->variant & SSR_VARFLAG_VERIFY) fprintf(LOG,"_check"); /* else if (gen->variant & SSR_VARFLAG_MIRROR) not implemented */ /* fprintf(LOG,"_mirror"); */ fprintf(LOG,"()\n%s:\n",gen->genid); if (gen->set & SSR_SET_CDFMODE) fprintf(LOG,"%s: CDF at mode = %g\n",gen->genid,GEN->Fmode); else fprintf(LOG,"%s: CDF at mode unknown\n",gen->genid); if (gen->variant & SSR_VARFLAG_SQUEEZE) fprintf(LOG,"%s: use universal squeeze\n",gen->genid); else fprintf(LOG,"%s: no (universal) squeeze\n",gen->genid); /* if (gen->variant & SSR_VARFLAG_MIRROR) */ /* fprintf(LOG,"%s: use mirror principle\n",gen->genid); */ fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: parts:\n",gen->genid); fprintf(LOG,"%s:\txl = %g\n",gen->genid,GEN->xl); fprintf(LOG,"%s:\txr = %g\n",gen->genid,GEN->xr); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: PDF at mode:\n",gen->genid); fprintf(LOG,"%s:\tfm = %g\n",gen->genid,GEN->fm); fprintf(LOG,"%s:\tum = %g\n",gen->genid,GEN->um); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: areas:\n",gen->genid); fprintf(LOG,"%s:\t al = %g\n",gen->genid,GEN->al); fprintf(LOG,"%s:\t ar = %g\n",gen->genid,GEN->ar); fprintf(LOG,"%s:\t Aleft = %g\n",gen->genid,GEN->Aleft); fprintf(LOG,"%s:\t Ain = %g\n",gen->genid,GEN->Ain); fprintf(LOG,"%s:\tAtotal = %g\n",gen->genid,GEN->A); fprintf(LOG,"%s:\n",gen->genid); } /* end of _unur_ssr_debug_init() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_INFO /*---------------------------------------------------------------------------*/ void _unur_ssr_info( struct unur_gen *gen, int help ) /*----------------------------------------------------------------------*/ /* create character string that contains information about the */ /* given generator object. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* help ... whether to print additional comments */ /*----------------------------------------------------------------------*/ { struct unur_string *info = gen->infostr; struct unur_distr *distr = gen->distr; int samplesize = 10000; double rc, rc_approx; /* generator ID */ _unur_string_append(info,"generator ID: %s\n\n", gen->genid); /* distribution */ _unur_string_append(info,"distribution:\n"); _unur_distr_info_typename(gen); _unur_string_append(info," functions = PDF\n"); _unur_string_append(info," domain = (%g, %g)\n", DISTR.domain[0],DISTR.domain[1]); _unur_string_append(info," mode = %g %s\n", DISTR.mode, (distr->set & UNUR_DISTR_SET_MODE_APPROX) ? "[numeric.]" : ""); _unur_string_append(info," area(PDF) = %g\n", DISTR.area); if (gen->set & SSR_SET_CDFMODE) _unur_string_append(info," F(mode) = %g\n", GEN->Fmode); else _unur_string_append(info," F(mode) = [unknown]\n"); if (help) { if ( distr->set & UNUR_DISTR_SET_MODE_APPROX ) _unur_string_append(info,"\n[ Hint: %s ]\n", "You may provide the \"mode\""); } _unur_string_append(info,"\n"); /* method */ _unur_string_append(info,"method: SSR (Simple Setup Rejection)\n"); if (gen->set & SSR_SET_CDFMODE) _unur_string_append(info," use CDF at mode\n"); if (gen->variant & SSR_VARFLAG_SQUEEZE) _unur_string_append(info," use squeeze\n"); _unur_string_append(info,"\n"); /* performance */ _unur_string_append(info,"performance characteristics:\n"); rc = (gen->set & SSR_SET_CDFMODE) ? 2. : 4.; if (_unur_isfinite(DISTR.BD_RIGHT) || _unur_isfinite(DISTR.BD_LEFT)) { rc_approx = unur_test_count_urn(gen,samplesize,0,NULL)/(2.*samplesize); _unur_string_append(info," rejection constant <= %g [approx. = %.2f]\n", rc,rc_approx); } else { _unur_string_append(info," rejection constant = %g\n", rc); } _unur_string_append(info,"\n"); /* parameters */ if (help) { _unur_string_append(info,"parameters:\n"); if (gen->set & SSR_SET_CDFMODE) _unur_string_append(info," cdfatmode = %g\n", GEN->Fmode); else _unur_string_append(info," cdfatmode = [not set]\n"); if (gen->variant & SSR_VARFLAG_SQUEEZE) _unur_string_append(info," usesqueeze\n"); if (gen->variant & SSR_VARFLAG_VERIFY) _unur_string_append(info," verify = on\n"); _unur_string_append(info,"\n"); /* Not displayed: int unur_ssr_set_pdfatmode( UNUR_PAR *parameters, double fmode ); */ } /* Hints */ if (help) { if ( !(gen->set & SSR_SET_CDFMODE)) _unur_string_append(info,"[ Hint: %s ]\n", "You can set \"cdfatmode\" to reduce the rejection constant."); _unur_string_append(info,"\n"); } } /* end of _unur_ssr_info() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_INFO */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/vnrou.c0000644001357500135600000013573414420445767013636 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: vnrou.c * * * * TYPE: continuous multivariate random variate * * METHOD: naive ratio-of-uniforms method * * * * DESCRIPTION: * * Given PDF and (optionally) a bounding rectangle for the acceptance * * region. * * Produce a value x consistent with its density * * The bounding rectangle is computed numerically if it is not given. * * * * REQUIRED: * * pointer to the density function * * OPTIONAL: * * mode of the density * * bounding rectangle of acceptance region * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * ***************************************************************************** * * * REFERENCES: * * [1] Wakefield J.C., Gelfand A.E., Smith A.F.M. * * Efficient generation of random variates via the ratio-of-uniforms * * method. * * Statistics and Computing (1991) 1, pp (129-133) * * * * [2] Hoermann, W., Leydold J., and Derflinger, G. (2004): * * Automatic non-uniform random variate generation, Springer, Berlin. * * Section 2.4, Algorithm 2.9 (RoU), p.35 * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include #include #include #include #include #include #include "unur_methods_source.h" #include "x_gen_source.h" #include "vnrou.h" #include "vnrou_struct.h" #ifdef UNUR_ENABLE_INFO # include #endif /*---------------------------------------------------------------------------*/ /* Variants: */ #define VNROU_VARFLAG_VERIFY 0x002u /* run verify mode */ /*---------------------------------------------------------------------------*/ /* Debugging flags */ /* bit 01 ... pameters and structure of generator (do not use here) */ /* bits 02-12 ... setup */ /* bits 13-24 ... adaptive steps */ /* bits 25-32 ... trace sampling */ #define VNROU_DEBUG_REINIT 0x00000010u /* print parameters after reinit */ /*---------------------------------------------------------------------------*/ /* Flags for logging set calls */ #define VNROU_SET_U 0x001u /* set u values of bounding rectangle */ #define VNROU_SET_V 0x002u /* set v values of bounding rectangle */ #define VNROU_SET_R 0x008u /* set r-parameter */ /*---------------------------------------------------------------------------*/ #define GENTYPE "VNROU" /* type of generator */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_vnrou_init( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* Initialize new generator. */ /*---------------------------------------------------------------------------*/ static int _unur_vnrou_reinit( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Reinitialize generator. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_vnrou_create( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* create new (almost empty) generator object. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_vnrou_clone( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* copy (clone) generator object. */ /*---------------------------------------------------------------------------*/ static void _unur_vnrou_free( struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* destroy generator object. */ /*---------------------------------------------------------------------------*/ static int _unur_vnrou_sample_cvec( struct unur_gen *gen, double *vec ); static int _unur_vnrou_sample_check( struct unur_gen *gen, double *vec ); /*---------------------------------------------------------------------------*/ /* sample from generator. */ /*---------------------------------------------------------------------------*/ static int _unur_vnrou_rectangle( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* compute (minimal) bounding rectangle. */ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ /* the following functions print debugging information on output stream, */ /* i.e., into the LOG file if not specified otherwise. */ /*---------------------------------------------------------------------------*/ static void _unur_vnrou_debug_init( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print after generator has been initialized has completed. */ /*---------------------------------------------------------------------------*/ #endif #ifdef UNUR_ENABLE_INFO static void _unur_vnrou_info( struct unur_gen *gen, int help ); /*---------------------------------------------------------------------------*/ /* create info string. */ /*---------------------------------------------------------------------------*/ #endif /*---------------------------------------------------------------------------*/ /* abbreviations */ #define DISTR_IN distr->data.cvec /* data for distribution object */ #define PAR ((struct unur_vnrou_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_vnrou_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.cvec /* data for distribution in generator object */ #define SAMPLE gen->sample.cvec /* pointer to sampling routine */ #define PDF(x) _unur_cvec_PDF((x),(gen->distr)) /* call to PDF */ /*---------------------------------------------------------------------------*/ #define _unur_vnrou_getSAMPLE(gen) \ ( ((gen)->variant & VNROU_VARFLAG_VERIFY) \ ? _unur_vnrou_sample_check : _unur_vnrou_sample_cvec ) /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Public: User Interface (API) **/ /*****************************************************************************/ struct unur_par * unur_vnrou_new( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get default parameters */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* default parameters (pointer to structure) */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_par *par; /* check arguments */ _unur_check_NULL( GENTYPE,distr,NULL ); /* check distribution */ if (distr->type != UNUR_DISTR_CVEC) { _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } COOKIE_CHECK(distr,CK_DISTR_CVEC,NULL); if (DISTR_IN.pdf == NULL) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PDF"); return NULL; } /* allocate structure */ par = _unur_par_new( sizeof(struct unur_vnrou_par) ); COOKIE_SET(par,CK_VNROU_PAR); /* copy input */ par->distr = distr; /* pointer to distribution object */ /* set default values */ PAR->r = 1.; /* r-parameter of the generalized method */ PAR->vmax = 0.; /* v-boundary of bounding rectangle (unknown) */ PAR->umin = NULL; /* u-boundary of bounding rectangle (unknown) */ PAR->umax = NULL; /* u-boundary of bounding rectangle (unknown) */ par->method = UNUR_METH_VNROU; /* method and default variant */ par->variant = 0u; /* default variant */ par->set = 0u; /* inidicate default parameters */ par->urng = unur_get_default_urng(); /* use default urng */ par->urng_aux = NULL; /* no auxilliary URNG required */ par->debug = _unur_default_debugflag; /* set default debugging flags */ /* routine for starting generator */ par->init = _unur_vnrou_init; return par; } /* end of unur_vnrou_new() */ /*****************************************************************************/ int unur_vnrou_set_u( struct unur_par *par, double *umin, double *umax ) /*----------------------------------------------------------------------*/ /* Sets left and right u-boundary of bounding rectangle. */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* umin ... left boundary of rectangle */ /* umax ... right boundary of rectangle */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int d; /* index used in dimension loops (0 <= d < dim) */ /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, VNROU ); _unur_check_NULL( GENTYPE, umin, UNUR_ERR_NULL ); _unur_check_NULL( GENTYPE, umax, UNUR_ERR_NULL ); /* check new parameter for generator */ for (d=0; ddistr->dim; d++) { if (!_unur_FP_greater(umax[d],umin[d])) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"umax <= umin"); return UNUR_ERR_PAR_SET; } } /* set values */ PAR->umin = umin; PAR->umax = umax; /* changelog */ par->set |= VNROU_SET_U; return UNUR_SUCCESS; } /* end of unur_vnrou_set_u() */ /*---------------------------------------------------------------------------*/ int unur_vnrou_chg_u( struct unur_gen *gen, double *umin, double *umax ) /*----------------------------------------------------------------------*/ /* Sets left and right u-boundary of bounding rectangle. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* umin ... left boundary of rectangle */ /* umax ... right boundary of rectangle */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int d; /* index used in dimension loops (0 <= d < dim) */ /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, VNROU, UNUR_ERR_GEN_INVALID ); _unur_check_NULL( GENTYPE, umin, UNUR_ERR_NULL ); _unur_check_NULL( GENTYPE, umax, UNUR_ERR_NULL ); /* check new parameter for generator */ for (d=0; ddim; d++) { if (!_unur_FP_greater(umax[d],umin[d])) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"umax <= umin"); return UNUR_ERR_PAR_SET; } } /* set values */ memcpy(GEN->umin, umin, GEN->dim * sizeof(double)); memcpy(GEN->umax, umax, GEN->dim * sizeof(double)); /* changelog */ gen->set |= VNROU_SET_U; return UNUR_SUCCESS; } /* end of unur_vnrou_chg_u() */ /*---------------------------------------------------------------------------*/ int unur_vnrou_set_v( struct unur_par *par, double vmax ) /*----------------------------------------------------------------------*/ /* Sets upper v-boundary of bounding rectangle. */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* vmax ... upper boundary of rectangle */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, VNROU ); /* check new parameter for generator */ if (vmax <= 0.) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"vmax <= 0"); return UNUR_ERR_PAR_SET; } /* store values */ PAR->vmax = vmax; /* changelog */ par->set |= VNROU_SET_V; return UNUR_SUCCESS; } /* end of unur_vnrou_set_v() */ /*---------------------------------------------------------------------------*/ int unur_vnrou_chg_v( struct unur_gen *gen, double vmax ) /*----------------------------------------------------------------------*/ /* Sets upper v-boundary of bounding rectangle. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* vmax ... upper boundary of rectangle */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, VNROU, UNUR_ERR_GEN_INVALID ); /* check new parameter for generator */ if (vmax <= 0.) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"vmax <= 0"); return UNUR_ERR_PAR_SET; } /* store values */ GEN->vmax = vmax; /* changelog */ gen->set |= VNROU_SET_V; return UNUR_SUCCESS; } /* end of unur_vnrou_chg_v() */ /*---------------------------------------------------------------------------*/ int unur_vnrou_set_r( struct unur_par *par, double r ) /*----------------------------------------------------------------------*/ /* Set the r-parameter for the generalized ratio-of-uniforms method. */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* r ... r-parameter */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, VNROU ); /* check new parameter for generator */ if (r <= 0.) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"r<=0"); return UNUR_ERR_PAR_SET; } /* store data */ PAR->r = r; /* changelog */ par->set |= VNROU_SET_R; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_vnrou_set_r() */ /*---------------------------------------------------------------------------*/ int unur_vnrou_set_verify( struct unur_par *par, int verify ) /*----------------------------------------------------------------------*/ /* turn verifying of algorithm while sampling on/off */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* verify ... 0 = no verifying, !0 = verifying */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* no verifying is the default */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, VNROU ); /* we use a bit in variant */ par->variant = (verify) ? (par->variant | VNROU_VARFLAG_VERIFY) : (par->variant & (~VNROU_VARFLAG_VERIFY)); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_vnrou_set_verify() */ /*---------------------------------------------------------------------------*/ int unur_vnrou_chg_verify( struct unur_gen *gen, int verify ) /*----------------------------------------------------------------------*/ /* turn verifying of algorithm while sampling on/off */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* verify ... 0 = no verifying, !0 = verifying */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* no verifying is the default */ /*----------------------------------------------------------------------*/ { /* check input */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, VNROU, UNUR_ERR_GEN_INVALID ); /* we must not change this switch when sampling has been disabled by using a pointer to the error producing routine */ if (SAMPLE == _unur_sample_cvec_error) return UNUR_FAILURE; if (verify) /* turn verify bounding rectangle on */ gen->variant |= VNROU_VARFLAG_VERIFY; else /* turn verify bounding rectangle off */ gen->variant &= ~VNROU_VARFLAG_VERIFY; SAMPLE = _unur_vnrou_getSAMPLE(gen); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_vnrou_chg_verify() */ /*---------------------------------------------------------------------------*/ double unur_vnrou_get_volumehat( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* Get the volume of below the hat. */ /* For normalized densities, i.e. when the volume below PDF is 1, */ /* this value equals the rejection constant for the vnrou method. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /*----------------------------------------------------------------------*/ { double vol; int d; /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); _unur_check_gen_object( gen, VNROU, UNUR_INFINITY ); /* compute volume of bounding rectangle */ vol = GEN->vmax; for (d=0; ddim; d++) { vol *= (GEN->umax[d]-GEN->umin[d]); } /* compute volume of corresponding hat function */ vol *= (GEN->r*GEN->dim+1); /* return result */ return vol; } /* end of unur_vnrou_get_volumehat() */ /*****************************************************************************/ /** Private **/ /*****************************************************************************/ struct unur_gen * _unur_vnrou_init( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* initialize new generator */ /* */ /* parameters: */ /* params ... pointer to paramters for building generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); /* check input */ if ( par->method != UNUR_METH_VNROU ) { _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); return NULL; } COOKIE_CHECK(par,CK_VNROU_PAR,NULL); /* create a new empty generator object */ gen = _unur_vnrou_create(par); _unur_par_free(par); if (!gen) return NULL; /* compute bounding rectangle */ if (_unur_vnrou_rectangle(gen)!=UNUR_SUCCESS) { _unur_vnrou_free(gen); return NULL; } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_vnrou_debug_init(gen); #endif return gen; } /* end of _unur_vnrou_init() */ /*---------------------------------------------------------------------------*/ int _unur_vnrou_reinit( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* re-initialize (existing) generator. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int rcode; /* compute bounding rectangle */ if ( (rcode = _unur_vnrou_rectangle(gen))!=UNUR_SUCCESS) { return rcode; } /* (re)set sampling routine */ SAMPLE = _unur_vnrou_getSAMPLE(gen); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug & VNROU_DEBUG_REINIT) _unur_vnrou_debug_init(gen); #endif return UNUR_SUCCESS; } /* end of _unur_vnrou_reinit() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_vnrou_create( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* allocate memory for generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* pointer to (empty) generator object with default settings */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_VNROU_PAR,NULL); /* create new generic generator object */ gen = _unur_generic_create( par, sizeof(struct unur_vnrou_gen) ); /* magic cookies */ COOKIE_SET(gen,CK_VNROU_GEN); /* set generator identifier */ gen->genid = _unur_set_genid(GENTYPE); /* routines for sampling and destroying generator */ SAMPLE = _unur_vnrou_getSAMPLE(gen); gen->destroy = _unur_vnrou_free; gen->clone = _unur_vnrou_clone; gen->reinit = _unur_vnrou_reinit; /* copy parameters into generator object */ GEN->dim = gen->distr->dim; /* dimension */ GEN->r = PAR->r; /* r-parameter of the vnrou method */ GEN->vmax = PAR->vmax; /* upper v-boundary of bounding rectangle */ /* allocate memory for u-boundary arrays */ GEN->umin = _unur_xmalloc( GEN->dim * sizeof(double)); /* bounding rectangle */ GEN->umax = _unur_xmalloc( GEN->dim * sizeof(double)); /* bounding rectangle */ if (PAR->umin != NULL) memcpy(GEN->umin, PAR->umin, GEN->dim * sizeof(double)); if (PAR->umax != NULL) memcpy(GEN->umax, PAR->umax, GEN->dim * sizeof(double)); /* get center of the distribution */ GEN->center = unur_distr_cvec_get_center(gen->distr); #ifdef UNUR_ENABLE_INFO /* set function for creating info string */ gen->info = _unur_vnrou_info; #endif /* return pointer to (almost empty) generator object */ return gen; } /* end of _unur_vnrou_create() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_vnrou_clone( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* copy (clone) generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to clone of generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { #define CLONE ((struct unur_vnrou_gen*)clone->datap) struct unur_gen *clone; /* check arguments */ CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_VNROU_GEN,NULL); /* create generic clone */ clone = _unur_generic_clone( gen, GENTYPE ); /* allocate memory for u-arrays */ CLONE->umin = _unur_xmalloc( GEN->dim * sizeof(double)); CLONE->umax = _unur_xmalloc( GEN->dim * sizeof(double)); /* copy parameters into clone object */ memcpy(CLONE->umin, GEN->umin, GEN->dim * sizeof(double)); memcpy(CLONE->umax, GEN->umax, GEN->dim * sizeof(double)); /* copy data */ CLONE->center = unur_distr_cvec_get_center(clone->distr); return clone; #undef CLONE } /* end of _unur_vnrou_clone() */ /*****************************************************************************/ int _unur_vnrou_sample_cvec( struct unur_gen *gen, double *vec ) /*----------------------------------------------------------------------*/ /* sample from generator */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* vec ... random vector (result) */ /*----------------------------------------------------------------------*/ { double U, V; int d, dim; /* index used in dimension loops (0 <= d < dim) */ /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_VNROU_GEN,UNUR_ERR_COOKIE); dim = GEN->dim; while (1) { /* generate point uniformly on rectangle */ while ( _unur_iszero(V = _unur_call_urng(gen->urng)) ); V *= GEN->vmax; for (d=0; dumin[d] + _unur_call_urng(gen->urng) * (GEN->umax[d] - GEN->umin[d]); vec[d] = U/pow(V,GEN->r) + GEN->center[d]; } /* X[] inside domain ? */ /* accept or reject */ if (V <= pow(PDF(vec),1./(GEN->r * dim + 1.))) return UNUR_SUCCESS; } } /* end of _unur_vnrou_sample() */ /*---------------------------------------------------------------------------*/ int _unur_vnrou_sample_check( struct unur_gen *gen, double *vec ) /*----------------------------------------------------------------------*/ /* sample from generator and verify that method can be used */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* vec ... random sample vector (return) */ /*----------------------------------------------------------------------*/ { double U, V; int d, dim; /* index used in dimension loops (0 <= d < dim) */ int hat_error; double fx,sfx,xfx; /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_VNROU_GEN,UNUR_ERR_COOKIE); dim = GEN->dim; while (1) { /* generate point uniformly on rectangle */ while ( _unur_iszero(V = _unur_call_urng(gen->urng)) ); V *= GEN->vmax; for (d=0; dumin[d] + _unur_call_urng(gen->urng) * (GEN->umax[d] - GEN->umin[d]); vec[d] = U/pow(V,GEN->r) + GEN->center[d]; } /* X[] inside domain ? */ /* evaluate PDF */ fx = PDF(vec); /* a point on the boundary of the region of acceptance has the coordinates ( (vec[]-center[]) * (fx)^(r/r*dim+1)), fx^(1/r*dim+1) ). */ sfx = pow( fx, 1./(GEN->r * dim+1.) ); /* check hat */ hat_error=0; if ( sfx > (1.+DBL_EPSILON) * GEN->vmax ) hat_error++; sfx = pow( fx, GEN->r/(GEN->r * dim + 1.) ); for (d=0; dcenter[d]) * sfx; if ( (xfx < (1.+UNUR_EPSILON) * GEN->umin[d]) || (xfx > (1.+UNUR_EPSILON) * GEN->umax[d])) hat_error++; } if (hat_error>0) _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF(x) > hat(x)"); /* accept or reject */ if (V <= pow(PDF(vec),1./( GEN->r * dim + 1.))) return UNUR_SUCCESS; } } /* end of _unur_vnrou_sample_check() */ /*****************************************************************************/ void _unur_vnrou_free( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* deallocate generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { /* check arguments */ if( !gen ) /* nothing to do */ return; /* check input */ if ( gen->method != UNUR_METH_VNROU ) { _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); return; } COOKIE_CHECK(gen,CK_VNROU_GEN,RETURN_VOID); /* we cannot use this generator object any more */ SAMPLE = NULL; /* make sure to show up a programming error */ /* free memory */ if (GEN->umin) free(GEN->umin); if (GEN->umax) free(GEN->umax); _unur_generic_free(gen); } /* end of _unur_vnrou_free() */ /*****************************************************************************/ /** Auxilliary Routines **/ /*****************************************************************************/ int _unur_vnrou_rectangle( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* compute universal bounding rectangle */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int d; /* index used in dimension loops (0 <= d < dim) */ struct MROU_RECTANGLE *rr; int rectangle_compute; /* check arguments */ CHECK_NULL( gen, UNUR_ERR_NULL ); COOKIE_CHECK( gen,CK_VNROU_GEN, UNUR_ERR_COOKIE ); /* Boundary rectangle is already set */ if ((gen->set & VNROU_SET_U) && (gen->set & VNROU_SET_V)) { return UNUR_SUCCESS; } /* Allocating and filling mrou_rectangle struct */ rr = _unur_mrou_rectangle_new(); rr->distr = gen->distr; rr->dim = GEN->dim; rr->umin = GEN->umin; rr->umax = GEN->umax; rr->r = GEN->r; rr->center = GEN->center; rr->genid = gen->genid; /* calculate bounding rectangle */ rectangle_compute = _unur_mrou_rectangle_compute(rr); if (!(gen->set & VNROU_SET_V)) { /* user has not provided any upper bound for v */ GEN->vmax = rr->vmax; } if (!(gen->set & VNROU_SET_U)) { /* user has not provided any bounds for u */ for (d=0; ddim; d++) { GEN->umin[d] = rr->umin[d]; GEN->umax[d] = rr->umax[d]; } } free(rr); if (rectangle_compute != UNUR_SUCCESS) return UNUR_ERR_INF; /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_vnrou_rectangle() */ /*****************************************************************************/ /** Debugging utilities **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ void _unur_vnrou_debug_init( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write info about generator into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; int d, dim; /* index used in dimension loops (0 <= d < dim) */ double vol; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_VNROU_GEN,RETURN_VOID); LOG = unur_get_stream(); dim = GEN->dim; fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: type = continuous multivariate random variates\n",gen->genid); fprintf(LOG,"%s: method = vnrou (naive ratio-of-uniforms)\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); _unur_distr_cvec_debug( gen->distr, gen->genid ); fprintf(LOG,"%s: sampling routine = _unur_vnrou_sample",gen->genid); if (gen->variant & VNROU_VARFLAG_VERIFY) fprintf(LOG,"_check"); fprintf(LOG,"()\n%s:\n",gen->genid); /* parameters */ fprintf(LOG,"%s: r-parameter = %g",gen->genid, GEN->r); _unur_print_if_default(gen,VNROU_SET_R); fprintf(LOG,"\n%s:\n",gen->genid); /* print center */ _unur_matrix_print_vector( GEN->dim, GEN->center, "center =", LOG, gen->genid, "\t "); /* print bounding rectangle */ fprintf(LOG,"%s: Rectangle:",gen->genid); if (!((gen->set & VNROU_SET_U) && (gen->set & VNROU_SET_V))) fprintf(LOG,"\t[computed]"); else fprintf(LOG,"\t[input]"); fprintf(LOG,"\n"); vol = GEN->vmax; fprintf(LOG,"%s:\tvmax = %g\n",gen->genid, GEN->vmax); for (d=0; dumax[d]-GEN->umin[d]); fprintf(LOG,"%s:\tumin[%d],umax[%d] = (%g,%g)\n",gen->genid, d, d, GEN->umin[d], GEN->umax[d]); } fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s:\tvolume = %g\t(hat = %g)\n",gen->genid, vol, vol*(GEN->r*GEN->dim+1)); fprintf(LOG,"%s:\n",gen->genid); } /* end of _unur_vnrou_debug_init() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_INFO /*---------------------------------------------------------------------------*/ void _unur_vnrou_info( struct unur_gen *gen, int help ) /*----------------------------------------------------------------------*/ /* create character string that contains information about the */ /* given generator object. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* help ... whether to print additional comments */ /*----------------------------------------------------------------------*/ { struct unur_string *info = gen->infostr; struct unur_distr *distr = gen->distr; int samplesize = 10000; int i; double hvol; /* generator ID */ _unur_string_append(info,"generator ID: %s\n\n", gen->genid); /* distribution */ _unur_string_append(info,"distribution:\n"); _unur_distr_info_typename(gen); _unur_string_append(info," dimension = %d\n",GEN->dim); _unur_string_append(info," functions = PDF\n"); _unur_distr_cvec_info_domain(gen); if ( distr->set & UNUR_DISTR_SET_MODE ) { _unur_string_append(info," mode = "); _unur_distr_info_vector( gen, DISTR.mode, GEN->dim); } _unur_string_append(info,"\n"); _unur_string_append(info," center = "); _unur_distr_info_vector( gen, GEN->center, GEN->dim); if ( !(distr->set & UNUR_DISTR_SET_CENTER) ) { if ( distr->set & UNUR_DISTR_SET_MODE ) _unur_string_append(info," [= mode]"); else _unur_string_append(info," [default]"); } _unur_string_append(info,"\n\n"); /* if (help) { */ /* _unur_string_append(info,"\n"); */ /* } */ /* method */ _unur_string_append(info,"method: VNROU (Naive Ratio-Of-Uniforms)\n"); _unur_string_append(info," r = %g\n", GEN->r); _unur_string_append(info,"\n"); /* performance */ _unur_string_append(info,"performance characteristics:\n"); _unur_string_append(info," bounding rectangle = "); for (i=0; idim; i++) _unur_string_append(info,"%s(%g,%g)", i?"x":"", GEN->umin[i], GEN->umax[i]); _unur_string_append(info," x (0,%g)\n", GEN->vmax); hvol = GEN->vmax; for (i=0; idim; i++) hvol *= GEN->umax[i] - GEN->umin[i]; _unur_string_append(info," volume(hat) = %g\n", hvol); _unur_string_append(info," rejection constant "); if ((distr->set & UNUR_DISTR_SET_PDFVOLUME) && _unur_isone(GEN->r)) _unur_string_append(info,"= %g\n", (GEN->dim + 1.) * hvol / DISTR.volume); else _unur_string_append(info,"= %.2f [approx.]\n", unur_test_count_urn(gen,samplesize,0,NULL)/((1.+GEN->dim)*samplesize)); _unur_string_append(info,"\n"); /* parameters */ if (help) { _unur_string_append(info,"parameters:\n"); _unur_string_append(info," r = %g %s\n", GEN->r, (gen->set & VNROU_SET_R) ? "" : "[default]"); _unur_string_append(info," v = %g %s\n", GEN->vmax, (gen->set & VNROU_SET_V) ? "" : "[numeric.]"); _unur_string_append(info," u = "); _unur_distr_info_vector( gen, GEN->umin, GEN->dim); _unur_string_append(info," -- "); _unur_distr_info_vector( gen, GEN->umax, GEN->dim); _unur_string_append(info,"%s\n",(gen->set & VNROU_SET_U) ? "" : " [numeric.]"); if (gen->variant & VNROU_VARFLAG_VERIFY) _unur_string_append(info," verify = on\n"); _unur_string_append(info,"\n"); } /* Hints */ if (help) { if ( !(gen->set & VNROU_SET_V) ) _unur_string_append(info,"[ Hint: %s ]\n", "You can set \"v\" to avoid numerical estimate." ); if ( !(gen->set & VNROU_SET_U) ) _unur_string_append(info,"[ Hint: %s ]\n", "You can set \"u\" to avoid slow (and inexact) numerical estimates." ); _unur_string_append(info,"\n"); } } /* end of _unur_vnrou_info() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_INFO */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/gibbs.h0000644001357500135600000002762014420445767013552 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: gibbs.h * * * * PURPOSE: * * function prototypes for method GIBBS * * (Markov Chain - GIBBS sampler) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /* =METHOD GIBBS Markov Chain - GIBBS sampler =UP MCMC_Methods_for_CVEC =REQUIRED T-concave logPDF, derivatives of logPDF =SPEED Set-up: fast, Sampling: moderate =REINIT not implemented =REF [HLD04: Sect.14.1.2] =DESCRIPTION Method GIBBS implements a Gibbs sampler for a multivariate distribution with given joint density and its gradient. When running such a Markov chain all coordinates are updated cyclically using full conditional distributions. After each step the state of the chain is returned (i.e., a random point is returned whenever a single coordinate has been updated). It is also possible to return only points after all coordinates have been updated by "thinning" the chain. Moreover, to reduce autocorrelation this thinning factor can be any integer. Notice, however, that the sampling time for a chain of given length is increased by the same factor, too. GIBBS also provides a variant of the Gibbs sampler where in each step a point from the full conditional distribution along some random direction is sampled. This direction is chosen uniformly from the sphere in each step. This method is also known as Hit-and-Run algorithm for non-uniform distributions. Our experiences shows that the original Gibbs sampler with sampling along coordinate axes is superior to random direction sampling as long as the correlations between the components of the random vector are not too high. For both variants transformed density rejection (see methods @pxref{TDR} and @pxref{ARS}) is used to sample from the full conditional distributions. In opposition to the univariate case, it is important that the factor @code{c} is as large as possible. I.e., for a log-concave density @code{c} must be set to @code{0.}, since otherwise numerical underflow might stop the algorithm. @emph{Important:} GIBBS does not generate independent random points. The starting point of the Gibbs chain must be in a "typical" region of the target distribution. If such a point is not known or would be too expensive, then the first part of the chain should be discarded (burn-in of the chain). =HOWTOUSE For using the GIBBS method UNU.RAN needs the logarithm of the PDF of the multivariate joint distribution and its gradient or partial derivatives. It provides two variants: @table @emph @item coordinate direction sampling (Gibbs sampling) [default] The coordinates are updated cyclically. It requires the partial derivatives of the (logarithm of the) PDF of the target distribution, see unur_distr_cvec_set_pdlogpdf(). Otherwise, the gradient of the logPDF (see unur_distr_cvec_set_dlogpdf()) is used, which is more expensive. This variant can be selected using unur_gibbs_set_variant_coordinate(). @item random direction sampling (nonuniform Hit-and-Run algorithm) In each step is a direction is sampled uniformly from the sphere and the next point in the chain is sampled from the full conditional distribution along this direction. It requires the gradient of the logPDF and thus each step is more expensive than each step for coordinate direction sampling. This variant can be selected using unur_gibbs_set_variant_random_direction(). @end table It is important that the @code{c} parameter for the TDR method is as large as possible. For logconcave distribution it must be set to @code{0}, since otherwise numerical underflow can cause the algorithm to stop. The starting point of the Gibbs chain must be "typical" for the target distribution. If such a point is not known or would be too expensive, then the first part of the chain should be discarded (burn-in of the chain). When using the unur_gibbs_set_burnin() call this is done during the setup of the Gibbs sampler object. In case of a fatal error in the generator for conditional distributions the methods generates points that contain UNUR_INFINITY. @strong{Warning:} The algorithm requires that all full conditionals for the given distribution object are @i{T}-concave. However, this property is not checked. If this property is not satisfied, then generation from the conditional distributions becomes (very) slow and might fail or (even worse) produces random vectors from an incorrect distribution. When using unur_gibbs_set_burnin() then the setup already might fail. Thus when in doubt whether GIBBS can be used for the targent distribution it is a good idea to use a burn-in for checking. @emph{Remark:} It might happen (very rarely) that the chain becomes stuck due to numerical errors. (This is in particular the case when the given PDF does not fulfill the condition of this method.) When this happens during burn-in then the setup is aborted (i.e. it fails). Otherwise the chain restarts again from its starting point. @strong{Warning:} Be carefull with debugging flags. If it contains flag @code{0x01000000u} it produces a lot of output for each step in the algorithm. (This flag is switched of in the default debugging flags). =END */ /*---------------------------------------------------------------------------*/ /* Routines for user interface */ /* =ROUTINES */ UNUR_PAR *unur_gibbs_new( const UNUR_DISTR *distribution ); /*...........................................................................*/ int unur_gibbs_set_variant_coordinate( UNUR_PAR *parameters ); /* Coordinate Direction Sampling: Sampling along the coordinate directions (cyclic). This is the default. */ int unur_gibbs_set_variant_random_direction( UNUR_PAR *parameters ); /* Random Direction Sampling: Sampling along the random directions. */ int unur_gibbs_set_c( UNUR_PAR *parameters, double c ); /* Set parameter @var{c} for transformation @unurmath{T} of the transformed density rejection method. Currently only values between @code{0} and @code{-0.5} are allowed. If @code{c} is between @code{0} and @code{-0.5} it is set to @code{-0.5}. For @var{c} @code{=0} (for logconcave densities) method ARS (@pxref{ARS}) is used which is very robust against badly normalized PDFs. For other values method TDR (@pxref{TDR}) is used. The value for @var{c} should be as large as possible to avoid fatal numerical underflows. Thus for log-concave distributions @var{c} must be set to @code{0.} Default is @code{0}. */ int unur_gibbs_set_startingpoint( UNUR_PAR *parameters, const double *x0 ); /* Sets the starting point of the Gibbs sampler. @var{x0} must be a "typical" point of the given distribution. If such a "typical" point is not known and a starting point is merely guessed, the first part of the Gibbs chain should be discarded (@emph{burn-in}), e.g.\ by mean of the unur_gibbs_set_burnin() call. Default is the result of unur_distr_cvec_get_center() for the given distribution object. */ int unur_gibbs_set_thinning( UNUR_PAR *parameters, int thinning ); /* Sets the @var{thinning} parameter. When @var{thinning} is set to @i{k} then every @i{k}-th point from the iteration is returned by the sampling algorithm. @emph{Notice}: This parameter must satisfy @var{thinning}>=1. Default: @code{1}. */ int unur_gibbs_set_burnin( UNUR_PAR *parameters, int burnin ); /* If a "typical" point for the target distribution is not known but merely guessed, the first part of the Gibbs chain should be discarded (@emph{burn-in}). This can be done during the initialization of the generator object. The length of the burn-in can is then @var{burnin}. When method GIBBS is not applicable for the target distribution then the initialization already might fail during the burn-in. Thus this reduces the risk of running a generator that returns UNUR_INFINITY cased by some fatal error during sampling. The thinning factor set by a unur_gibbs_set_thinning() call has no effect on the length of the burn-in, i.e., for the burn-in always a thinning factor @code{1} is used. @emph{Notice}: This parameter must satisfy @var{thinning}>=0. Default: @code{0}. */ /*...........................................................................*/ const double *unur_gibbs_get_state( UNUR_GEN *generator ); /* */ int unur_gibbs_chg_state( UNUR_GEN *generator, const double *state ); /* Get and change the current state of the Gibbs chain. */ int unur_gibbs_reset_state( UNUR_GEN *generator ); /* Reset state of chain to starting point. @emph{Notice:} Currently this function does not reset the generators for conditional distributions. Thus it is not possible to get the same Gibbs chain even when the underlying uniform random number generator is reset. */ /* =END */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/hitro.c0000644001357500135600000023720514420445767013606 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: hitro.c * * * * TYPE: continuous multivariate random variate * * METHOD: HITRO sampler using full conditional distributions. * * * * DESCRIPTION: * * Given PDF * * Produce a value x consistent with its density * * * * REQUIRED: * * pointer to the density function and its derivatives * * * * OPTIONAL: * * mode of the density * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * ***************************************************************************** * * * REFERENCES: * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include #include #include #include #include "unur_methods_source.h" #include "arou.h" #include "x_gen.h" #include "x_gen_source.h" #include "hitro.h" #include "hitro_struct.h" #ifdef UNUR_ENABLE_INFO # include #endif /*---------------------------------------------------------------------------*/ /* Constants */ /* minimum value for multiplier (same number also appears in error message) */ #define HITRO_MIN_MULTIPLIER (1.0001) /* starting value for u and v bounds when not provided by user */ #define HITRO_START_UVMIN (1.e-3) /* increase size of adaptive bounding rectangle by this factor */ #define HITRO_DEFAULT_ADAPTIVE_MULTIPLIER (1.1) /*---------------------------------------------------------------------------*/ /* Variants */ #define HITRO_VARMASK_VARIANT 0x000fu /* indicates variant */ #define HITRO_VARIANT_COORD 0x0001u /* coordinate sampler */ #define HITRO_VARIANT_RANDOMDIR 0x0002u /* random direction sampler */ #define HITRO_VARFLAG_ADAPTLINE 0x0010u /* use adaptive line sampling */ #define HITRO_VARFLAG_ADAPTRECT 0x0020u /* use adaptive bounding rectangle */ #define HITRO_VARFLAG_BOUNDRECT 0x0040u /* use entire bounding rectangle */ #define HITRO_VARFLAG_BOUNDDOMAIN 0x0080u /* use bounded domain (if given) */ /*---------------------------------------------------------------------------*/ /* Debugging flags */ /* bit 01 ... pameters and structure of generator (do not use here) */ /* bits 02-12 ... setup */ /* bits 13-24 ... adaptive steps */ /* bits 25-32 ... trace sampling */ /*---------------------------------------------------------------------------*/ /* Flags for logging set calls */ #define HITRO_SET_R 0x0001u /* set parameter r */ #define HITRO_SET_X0 0x0002u /* set starting point */ #define HITRO_SET_THINNING 0x0004u /* set thinning factor */ #define HITRO_SET_BURNIN 0x0008u /* set length of burn-in */ #define HITRO_SET_U 0x0010u /* set u-boundaries of bounding rectangles */ #define HITRO_SET_V 0x0020u /* set upper v-bound of bounding rectangles */ #define HITRO_SET_ADAPTLINE 0x0100u /* set adaptive line sampling */ #define HITRO_SET_ADAPTRECT 0x0200u /* set adaptive bounding rectangle */ #define HITRO_SET_BOUNDRECT 0x0400u /* set entire bounding rectangle */ #define HITRO_SET_ADAPTMULT 0x0800u /* set multiplier for adaptive rectangles */ /*---------------------------------------------------------------------------*/ #define GENTYPE "HITRO" /* type of generator */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_hitro_init( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* Initialize new generator. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_hitro_create( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* create new (almost empty) generator object. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_hitro_clone( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* copy (clone) generator object. */ /*---------------------------------------------------------------------------*/ static void _unur_hitro_free( struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* destroy generator object. */ /*---------------------------------------------------------------------------*/ static int _unur_hitro_coord_sample_cvec( struct unur_gen *gen, double *vec ); static int _unur_hitro_randomdir_sample_cvec( struct unur_gen *gen, double *vec ); /*---------------------------------------------------------------------------*/ /* sample from generator */ /*---------------------------------------------------------------------------*/ static int _unur_hitro_rectangle( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* compute (minimal) bounding rectangle. */ /*---------------------------------------------------------------------------*/ static void _unur_hitro_xy_to_vu( const struct unur_gen *gen, const double *x, double y, double *vu ); static void _unur_hitro_vu_to_x( const struct unur_gen *gen, const double *vu, double *x ); /*---------------------------------------------------------------------------*/ /* transforming between coordinates xy in original scale and */ /* coordinates vu in Ratio-of-Unforms scale. */ /*---------------------------------------------------------------------------*/ static double _unur_hitro_xv_to_u( const struct unur_gen *gen, double x, double v, int k ); /*---------------------------------------------------------------------------*/ /* transform point where we are given the v-coordinate (in RoU scale) */ /* and the k-th x-coordinate (in xy scale). */ /*---------------------------------------------------------------------------*/ static int _unur_hitro_vu_is_inside_region( const struct unur_gen *gen, const double *vu ); /*---------------------------------------------------------------------------*/ /* check whether point with vu-coordinates is inside acceptance region */ /* of RoU method. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_hitro_normalgen( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* create a normal random variate generator */ /*---------------------------------------------------------------------------*/ static void _unur_hitro_random_unitvector( struct unur_gen *gen, double *direction ); /*---------------------------------------------------------------------------*/ /* generate a random direction vector */ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ /* the following functions print debugging information on output stream, */ /* i.e., into the LOG file if not specified otherwise. */ /*---------------------------------------------------------------------------*/ static void _unur_hitro_debug_init_start( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print before init of generator starts. */ /*---------------------------------------------------------------------------*/ static void _unur_hitro_debug_init_finished( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print after generator has been initialized has completed. */ /*---------------------------------------------------------------------------*/ static void _unur_hitro_debug_free( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print before generater is destroyed. */ /*---------------------------------------------------------------------------*/ #endif #ifdef UNUR_ENABLE_INFO static void _unur_hitro_info( struct unur_gen *gen, int help ); /*---------------------------------------------------------------------------*/ /* create info string. */ /*---------------------------------------------------------------------------*/ #endif /*---------------------------------------------------------------------------*/ /* abbreviations */ #define DISTR_IN distr->data.cvec /* data for distribution object */ #define PAR ((struct unur_hitro_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_hitro_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.cvec /* data for distribution in generator object */ #define SAMPLE gen->sample.cvec /* pointer to sampling routine */ #define PDF(x) _unur_cvec_PDF((x),(gen->distr)) /* call to PDF */ /* an auxiliary generator for standard normal variates */ #define GEN_NORMAL gen->gen_aux /*---------------------------------------------------------------------------*/ static UNUR_SAMPLING_ROUTINE_CVEC * _unur_hitro_getSAMPLE( struct unur_gen *gen ) { switch (gen->variant & HITRO_VARMASK_VARIANT) { case HITRO_VARIANT_COORD: return _unur_hitro_coord_sample_cvec; case HITRO_VARIANT_RANDOMDIR: default: return _unur_hitro_randomdir_sample_cvec; } } /* end of _unur_hitro_getSAMPLE() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Public: User Interface (API) **/ /*****************************************************************************/ struct unur_par * unur_hitro_new( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get default parameters */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* default parameters (pointer to structure) */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_par *par; /* check arguments */ _unur_check_NULL( GENTYPE,distr,NULL ); /* check distribution */ if (distr->type != UNUR_DISTR_CVEC) { _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } COOKIE_CHECK(distr,CK_DISTR_CVEC,NULL); if (DISTR_IN.pdf == NULL) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PDF"); return NULL; } /* allocate structure */ par = _unur_par_new( sizeof(struct unur_hitro_par) ); COOKIE_SET(par,CK_HITRO_PAR); /* copy input */ par->distr = distr; /* pointer to distribution object */ /* set default values */ par->method = UNUR_METH_HITRO ; /* method */ par->variant = ( HITRO_VARIANT_COORD | /* default variant */ HITRO_VARFLAG_ADAPTLINE ); /* see also _unur_hitro_init() */ par->set = 0u; /* inidicate default parameters */ par->urng = unur_get_default_urng(); /* use default urng */ par->urng_aux = NULL; /* no auxilliary URNG required */ PAR->r = 1.; /* parameter r */ PAR->thinning = 1; /* thinning factor */ PAR->burnin = 0; /* length of burn-in for chain */ PAR->x0 = NULL; /* starting point of chain, default is 0 */ PAR->adaptive_mult = HITRO_DEFAULT_ADAPTIVE_MULTIPLIER; /* multiplier for adaptive rectangles */ PAR->vmax = -1.; /* v-boundary of bounding rectangle (unknown) */ PAR->umin = NULL; /* u-boundary of bounding rectangle (unknown) */ PAR->umax = NULL; /* u-boundary of bounding rectangle (unknown) */ par->debug = _unur_default_debugflag; /* set default debugging flags */ /* routine for starting generator */ par->init = _unur_hitro_init; return par; } /* end of unur_hitro_new() */ /*****************************************************************************/ int unur_hitro_set_variant_coordinate( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* Coordinate Sampler : */ /* Sampling along the coordinate directions (cyclic). */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, HITRO ); /* we use a bit in variant */ par->variant = (par->variant & ~HITRO_VARMASK_VARIANT) | HITRO_VARIANT_COORD; /* ok */ return UNUR_SUCCESS; } /* end of unur_hitro_set_variant_coordinate() */ /*---------------------------------------------------------------------------*/ int unur_hitro_set_variant_random_direction( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* Random Direction Sampler : */ /* Sampling along the random directions. */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, HITRO ); /* we use a bit in variant */ par->variant = (par->variant & ~HITRO_VARMASK_VARIANT) | HITRO_VARIANT_RANDOMDIR; /* ok */ return UNUR_SUCCESS; } /* end of unur_hitro_set_variant_coordinate() */ /*---------------------------------------------------------------------------*/ int unur_hitro_set_use_adaptiveline( struct unur_par *par, int adaptive ) /*----------------------------------------------------------------------*/ /* Enable/Disable adaptive line sampling */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* adaptive ... whether adaptive line sampling is enabled */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, HITRO ); /* we use a bit in variant */ par->variant = (adaptive) ? (par->variant | HITRO_VARFLAG_ADAPTLINE) : (par->variant & (~HITRO_VARFLAG_ADAPTLINE)); /* changelog */ par->set |= HITRO_SET_ADAPTLINE; /* ok */ return UNUR_SUCCESS; } /* end of unur_hitro_set_use_adaptiveline() */ /*---------------------------------------------------------------------------*/ int unur_hitro_set_use_adaptiverectangle( struct unur_par *par, int adaptive ) /*----------------------------------------------------------------------*/ /* Enable/Disable adaptive bounding rectangle */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* adaptive ... whether adaptive rectangle is enabled */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, HITRO ); /* we use a bit in variant */ par->variant = (adaptive) ? (par->variant | HITRO_VARFLAG_ADAPTRECT) : (par->variant & (~HITRO_VARFLAG_ADAPTRECT)); /* changelog */ par->set |= HITRO_SET_ADAPTRECT; /* ok */ return UNUR_SUCCESS; } /* end of unur_hitro_set_use_adaptiverectangle() */ /*---------------------------------------------------------------------------*/ int unur_hitro_set_use_boundingrectangle( struct unur_par *par, int rectangle ) /*----------------------------------------------------------------------*/ /* Whether to use entire bounding rectangle or just upper bound */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* rectangle ... whether using entire bounding rectangle is enabled */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, HITRO ); /* we use a bit in variant */ par->variant = (rectangle) ? (par->variant | HITRO_VARFLAG_BOUNDRECT) : (par->variant & (~HITRO_VARFLAG_BOUNDRECT)); /* changelog */ par->set |= HITRO_SET_BOUNDRECT; /* ok */ return UNUR_SUCCESS; } /* end of unur_hitro_set_use_adaptiverectangle() */ /*---------------------------------------------------------------------------*/ int unur_hitro_set_r( struct unur_par *par, double r ) /*----------------------------------------------------------------------*/ /* set parameter r for ratio-of-uniforms */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* r ... parameter r */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, HITRO ); /* check new parameter for generator */ if (r <= 0.) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"r <= 0"); return UNUR_ERR_PAR_SET; } /* store date */ PAR->r = r; /* changelog */ par->set |= HITRO_SET_R; return UNUR_SUCCESS; } /* end of unur_hitro_set_r() */ /*---------------------------------------------------------------------------*/ int unur_hitro_set_u( struct unur_par *par, const double *umin, const double *umax ) /*----------------------------------------------------------------------*/ /* u-boundaries for bounding rectangle */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* umin ... lower left boundary of rectangle */ /* umax ... upper right boundary of rectangle */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int d; /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, HITRO ); _unur_check_NULL( GENTYPE, umin, UNUR_ERR_NULL ); _unur_check_NULL( GENTYPE, umax, UNUR_ERR_NULL ); /* check new parameter for generator */ for (d = 0; d < par->distr->dim; d++) { if (!_unur_FP_greater(umax[d],umin[d])) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"umax <= umin"); return UNUR_ERR_PAR_SET; } if (! (_unur_isfinite(umax[d]) && _unur_isfinite(umin[d])) ) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"rectangle not bounded"); return UNUR_ERR_PAR_SET; } } /* set values */ PAR->umin = umin; PAR->umax = umax; /* changelog */ par->set |= HITRO_SET_U; /* ok */ return UNUR_SUCCESS; } /* end of unur_hitro_set_u() */ /*---------------------------------------------------------------------------*/ int unur_hitro_set_v( struct unur_par *par, double vmax ) /*----------------------------------------------------------------------*/ /* upper v-bound for bounding rectangle */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* vmax ... upper bound of rectangle */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, HITRO ); /* check new parameter for generator */ if (vmax <= 0.) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"vmax <= 0"); return UNUR_ERR_PAR_SET; } if (! _unur_isfinite(vmax) ) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"rectangle not bounded"); return UNUR_ERR_PAR_SET; } /* store values */ PAR->vmax = vmax; /* changelog */ par->set |= HITRO_SET_V; /* ok */ return UNUR_SUCCESS; } /* end of unur_hitro_set_v() */ /*---------------------------------------------------------------------------*/ int unur_hitro_set_adaptive_multiplier( struct unur_par *par, double factor ) /*----------------------------------------------------------------------*/ /* set multiplier for adaptive rectangles */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* factor ... multiplier */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, HITRO ); /* check new parameter for generator */ if (factor < HITRO_MIN_MULTIPLIER) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"multiplier too small (<= 1.0001)"); return UNUR_ERR_PAR_SET; } /* store data */ PAR->adaptive_mult = factor; /* changelog */ par->set |= HITRO_SET_ADAPTMULT; /* ok */ return UNUR_SUCCESS; } /* end of unur_hitro_set_adaptive_multiplier() */ /*---------------------------------------------------------------------------*/ int unur_hitro_set_startingpoint( struct unur_par *par, const double *x0) /*----------------------------------------------------------------------*/ /* set starting point for chain */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* x0 ... starting point of chain */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, HITRO ); /* store data */ PAR->x0 = x0; /* changelog */ par->set |= HITRO_SET_X0; /* ok */ return UNUR_SUCCESS; } /* end of unur_hitro_set_startingpoint() */ /*---------------------------------------------------------------------------*/ int unur_hitro_set_thinning( struct unur_par *par, int thinning ) /*----------------------------------------------------------------------*/ /* set thinning factor for chain */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* thinning ... thinning factor */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, HITRO ); /* check new parameter for generator */ if (thinning < 1) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"thinning < 1"); return UNUR_ERR_PAR_SET; } /* store data */ PAR->thinning = thinning; /* changelog */ par->set |= HITRO_SET_THINNING; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_hitro_set_thinning() */ /*---------------------------------------------------------------------------*/ int unur_hitro_set_burnin( struct unur_par *par, int burnin ) /*----------------------------------------------------------------------*/ /* set length of burn-in for chain */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* burnin ... length of burn-in */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, HITRO ); /* check new parameter for generator */ if (burnin < 0) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"burnin < 0"); return UNUR_ERR_PAR_SET; } /* store data */ PAR->burnin = burnin; /* changelog */ par->set |= HITRO_SET_BURNIN; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_hitro_set_burnin() */ /*---------------------------------------------------------------------------*/ const double * unur_hitro_get_state( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* get current state of the HITRO chain */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to chain ... on success */ /* NULL ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, NULL ); if (gen->method != UNUR_METH_HITRO) { _unur_error(gen->genid, UNUR_ERR_GEN_INVALID,""); return NULL; } return GEN->state; } /* end of unur_hitro_get_state() */ /*---------------------------------------------------------------------------*/ int unur_hitro_chg_state( struct unur_gen *gen, const double *state ) /*----------------------------------------------------------------------*/ /* chg current state of the HITRO chain */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* state ... new state of chain */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, HITRO, UNUR_ERR_GEN_INVALID ); _unur_check_NULL( gen->genid, state, UNUR_ERR_NULL ); /* check input */ if ( ! _unur_hitro_vu_is_inside_region(gen,state) ) { _unur_warning(gen->genid,UNUR_ERR_PAR_SET,"invalid state"); return UNUR_ERR_PAR_SET; } /* copy state */ memcpy( GEN->state, state, GEN->dim * sizeof(double)); return UNUR_SUCCESS; } /* end of unur_hitro_chg_state() */ /*---------------------------------------------------------------------------*/ int unur_hitro_reset_state( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* reset current state of the HITRO chain to starting point */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, HITRO, UNUR_ERR_GEN_INVALID ); /* copy state */ memcpy( GEN->state, GEN->x0, GEN->dim * sizeof(double)); /* set state to start from */ _unur_hitro_xy_to_vu(gen, GEN->x0, GEN->fx0/2., GEN->state ); memcpy( GEN->vu, GEN->state, (GEN->dim + 1) * sizeof(double) ); GEN->vumax[0] = pow(GEN->fx0, 1./(GEN->r * GEN->dim + 1.)) * (1. + DBL_EPSILON); if (gen->variant & HITRO_VARIANT_COORD) GEN->coord = 0; return UNUR_SUCCESS; } /* end of unur_hitro_reset_state() */ /*****************************************************************************/ /** Private **/ /*****************************************************************************/ struct unur_gen * _unur_hitro_init( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* initialize new generator */ /* */ /* parameters: */ /* par ... pointer to paramters for building generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ _unur_check_NULL( GENTYPE,par,NULL ); /* check input */ if ( par->method != UNUR_METH_HITRO ) { _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); return NULL; } COOKIE_CHECK(par,CK_HITRO_PAR,NULL); /* check variant flags */ /* ( we assume here that par->variant & (HITRO_VARFLAG_ADAPTRECT | HITRO_VARFLAG_BOUNDRECT) are set to 0 in unur_hitro_new() */ if ( par->variant & HITRO_VARIANT_COORD ) { /* coordinate direction sampling; not all variants are allowed */ if (_unur_distr_cvec_has_boundeddomain(par->distr)) /* we must have a bounded rectangular domain ... */ par->variant |= HITRO_VARFLAG_BOUNDDOMAIN; else /* ... or a bounding rectangle for acceptance region */ par->variant |= HITRO_VARFLAG_BOUNDRECT; /* we do not override the flag set by user for adaptive rectangle */ if (!(par->set & HITRO_SET_ADAPTRECT) ) par->variant |= HITRO_VARFLAG_ADAPTRECT; } /* create a new empty generator object */ gen = _unur_hitro_create(par); _unur_par_free(par); if (!gen) return NULL; #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_hitro_debug_init_start(gen); #endif /* we need a starting point for our chain */ GEN->fx0 = PDF(GEN->x0); if ( (GEN->fx0 / 2.) <= 0.) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"x0 not in support of PDF"); _unur_hitro_free(gen); return NULL; } /* set state to start from */ _unur_hitro_xy_to_vu(gen, GEN->x0, GEN->fx0/2., GEN->state ); memcpy( GEN->vu, GEN->state, (GEN->dim + 1) * sizeof(double) ); GEN->vumax[0] = pow(GEN->fx0, 1./(GEN->r * GEN->dim + 1.)) * (1. + DBL_EPSILON); /* routines for sampling and destroying generator */ if (gen->variant & HITRO_VARIANT_RANDOMDIR ) { /* we need an auxiliary generator for normal random variates */ GEN_NORMAL = _unur_hitro_normalgen( gen ); if ( GEN_NORMAL == NULL ) { _unur_hitro_free(gen); return NULL; } } /* computing required data about bounding rectangle */ if ( !(gen->variant & HITRO_VARFLAG_ADAPTRECT) ) if (_unur_hitro_rectangle(gen) != UNUR_SUCCESS ) { _unur_hitro_free(gen); return NULL; } /* else we use an adaptive bounding rectangle --> nothing to do here */ #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_hitro_debug_init_finished(gen); #endif /* run burn-in */ if (GEN->burnin > 0 ) { int thinning, burnin; double *X; /* allocate memory for random vector */ X = _unur_xmalloc( GEN->dim * sizeof(double) ); /* store thinning factor; we use 1 for burn-in */ thinning = GEN->thinning; GEN->thinning = 1; for (burnin = GEN->burnin; burnin>0; --burnin) _unur_sample_vec(gen,X); /* restore thinning factor */ GEN->thinning = thinning; /* free memory for random vector */ free (X); } /* creation of generator object successfull */ gen->status = UNUR_SUCCESS; /* o.k. */ return gen; } /* end of _unur_hitro_init() */ /*---------------------------------------------------------------------------*/ static struct unur_gen * _unur_hitro_create( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* allocate memory for generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* pointer to (empty) generator object with default settings */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; int i; /* check arguments */ CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_HITRO_PAR,NULL); /* create new generic generator object */ gen = _unur_generic_create( par, sizeof(struct unur_hitro_gen) ); /* magic cookies */ COOKIE_SET(gen,CK_HITRO_GEN); /* dimension of distribution */ GEN->dim = gen->distr->dim; /* set generator identifier */ gen->genid = _unur_set_genid(GENTYPE); /* routines for sampling and destroying generator */ SAMPLE = _unur_hitro_getSAMPLE(gen); gen->destroy = _unur_hitro_free; gen->clone = _unur_hitro_clone; /* variant of sampling method */ gen->variant = par->variant; /* copy parameters into generator object */ GEN->thinning = PAR->thinning; /* thinning factor */ GEN->burnin = PAR->burnin; /* length of burnin */ GEN->r = PAR->r; /* parameter r for RoU */ GEN->adaptive_mult = PAR->adaptive_mult; /* multiplier for adaptive rectangles */ /* get center of the distribution */ GEN->center = unur_distr_cvec_get_center(gen->distr); /* store starting point / get default starting point */ GEN->x0 = _unur_xmalloc( GEN->dim * sizeof(double)); if (PAR->x0 == NULL) PAR->x0 = unur_distr_cvec_get_center(gen->distr); memcpy( GEN->x0, PAR->x0, GEN->dim * sizeof(double)); /* bounding rectangle */ GEN->vumin = _unur_xmalloc( (GEN->dim+1) * sizeof(double) ); GEN->vumax = _unur_xmalloc( (GEN->dim+1) * sizeof(double) ); /* bounding rectangle v-coordinate */ GEN->vumin[0] = 0.; GEN->vumax[0] = (PAR->vmax > 0.) ? PAR->vmax : HITRO_START_UVMIN; /* lower left and upper right vertex of bounding rectangle in u-hyperplane */ if (gen->variant & HITRO_VARFLAG_BOUNDRECT) { if (PAR->umin && PAR->umax) { memcpy (GEN->vumin+1, PAR->umin, GEN->dim * sizeof(double) ); memcpy (GEN->vumax+1, PAR->umax, GEN->dim * sizeof(double) ); } else { for (i=1; idim+1; i++) GEN->vumin[i] = -HITRO_START_UVMIN; for (i=1; idim+1; i++) GEN->vumax[i] = HITRO_START_UVMIN; } } /* else: we do not need the u-bounds */ /* initialize remaining pointers */ GEN->state = _unur_xmalloc( (1 + GEN->dim) * sizeof(double) ); GEN->x = _unur_xmalloc( GEN->dim * sizeof(double) ); GEN->vu = _unur_xmalloc( (1 + GEN->dim) * sizeof(double) ); /* allocate memory for random direction */ GEN->direction = _unur_xmalloc( (1 + GEN->dim) * sizeof(double)); /* defaults */ GEN->coord = 0; /* current coordinate of HITRO chain. */ #ifdef UNUR_ENABLE_INFO /* set function for creating info string */ gen->info = _unur_hitro_info; #endif /* return pointer to (almost empty) generator object */ return gen; } /* end of _unur_hitro_create() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_hitro_clone( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* copy (clone) generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to clone of generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { #define CLONE ((struct unur_hitro_gen*)clone->datap) /* int i; */ struct unur_gen *clone; /* check arguments */ CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_HITRO_GEN,NULL); /* create generic clone */ clone = _unur_generic_clone( gen, GENTYPE ); /* get center of the distribution */ CLONE->center = unur_distr_cvec_get_center(clone->distr); /* copy state */ if (GEN->state) { CLONE->state = _unur_xmalloc( (1 + GEN->dim) * sizeof(double) ); memcpy( CLONE->state, GEN->state, (1 + GEN->dim) * sizeof(double) ); } if (GEN->vumin) { CLONE->vumin = _unur_xmalloc( (GEN->dim+1) * sizeof(double) ); memcpy( CLONE->vumin, GEN->vumin, (GEN->dim+1) * sizeof(double) ); } if (GEN->vumax) { CLONE->vumax = _unur_xmalloc( (GEN->dim+1) * sizeof(double) ); memcpy( CLONE->vumax, GEN->vumax, (GEN->dim+1) * sizeof(double) ); } /* copy starting points */ if (GEN->x0) { CLONE->x0 = _unur_xmalloc( GEN->dim * sizeof(double)); memcpy( CLONE->x0, GEN->x0, GEN->dim * sizeof(double)); } /* working array */ if (GEN->x) { CLONE->x = _unur_xmalloc( GEN->dim * sizeof(double) ); memcpy( CLONE->x, GEN->x, GEN->dim * sizeof(double) ); } if (GEN->vu) { CLONE->vu = _unur_xmalloc( (1 + GEN->dim) * sizeof(double) ); memcpy( CLONE->vu, GEN->vu, (1 + GEN->dim) * sizeof(double) ); } if (GEN->direction) { CLONE->direction = _unur_xmalloc( (1 + GEN->dim) * sizeof(double)); memcpy( CLONE->direction, GEN->direction, (1 + GEN->dim) * sizeof(double)); } return clone; #undef CLONE } /* end of _unur_hitro_clone() */ /*---------------------------------------------------------------------------*/ void _unur_hitro_free( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* deallocate generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { /* check arguments */ if( !gen ) /* nothing to do */ return; /* check input */ if ( gen->method != UNUR_METH_HITRO ) { _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); return; } COOKIE_CHECK(gen,CK_HITRO_GEN,RETURN_VOID); /* we cannot use this generator object any more */ SAMPLE = NULL; /* make sure to show up a programming error */ #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_hitro_debug_free(gen); #endif /* free vectors */ if (GEN->state) free (GEN->state); if (GEN->x0) free (GEN->x0); if (GEN->x) free (GEN->x); if (GEN->vu) free (GEN->vu); if (GEN->direction) free (GEN->direction); if (GEN->vumin) free (GEN->vumin); if (GEN->vumax) free (GEN->vumax); _unur_generic_free(gen); } /* end of _unur_hitro_free() */ /*****************************************************************************/ int _unur_hitro_coord_sample_cvec( struct unur_gen *gen, double *vec ) /*----------------------------------------------------------------------*/ /* sample from generator */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* vec ... random vector (result) */ /*----------------------------------------------------------------------*/ { int thinning; double lmin, lmax, lmid; /* l.h.s., r.h.s. endpoint and midpoint of line segment */ double *vuaux; /* pointer to auxiliary working array */ int coord; /* direction */ double U; /* uniform random number */ /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_HITRO_GEN,UNUR_ERR_COOKIE); /* pointer to auxiliary working array */ vuaux = GEN->vu; for (thinning = GEN->thinning; thinning > 0; --thinning) { /* update coordinate direction */ coord = GEN->coord = (GEN->coord + 1) % (GEN->dim + 1); /* --- l.h.s. and r.h.s. endpoints of line segment --- */ if (! (gen->variant & HITRO_VARFLAG_BOUNDDOMAIN) || coord == 0) { /* no bounded domain or v coordinate */ lmin = GEN->vumin[coord]; lmax = GEN->vumax[coord]; } else { /* bounded domain; we look at one of the u-coordinates */ int k = coord-1; double *domain = DISTR.domainrect; lmin = _unur_hitro_xv_to_u(gen, domain[2*k], vuaux[0], k ); lmax = _unur_hitro_xv_to_u(gen, domain[2*k+1], vuaux[0], k ); if (gen->variant & HITRO_VARFLAG_BOUNDRECT) { /* we also have a bounded domain; look whether this leads to shorter intervals */ lmin = _unur_max(lmin,GEN->vumin[coord]); lmax = _unur_min(lmax,GEN->vumax[coord]); } } /* --- adaptive bounding rectangle --- */ if ( gen->variant & HITRO_VARFLAG_ADAPTRECT ) { lmid = 0.5 * (lmin + lmax); /* check whether endpoint is outside of region */ vuaux[coord] = lmax; while ( _unur_hitro_vu_is_inside_region(gen,vuaux) ) { lmax = lmid + (lmax-lmid) * GEN->adaptive_mult; GEN->vumax[coord] = vuaux[coord] = lmax; } vuaux[coord] = lmin; /* no update of lmin in case of coord == 0 since v-coordinate always > 0 */ while ( coord!=0 && _unur_hitro_vu_is_inside_region(gen,vuaux) ) { lmin = lmid + (lmin-lmid) * GEN->adaptive_mult; GEN->vumin[coord] = vuaux[coord] = lmin; } } /* --- new coordinate for next point --- */ while (1) { U = _unur_call_urng(gen->urng); vuaux[coord] = U * lmin + (1.-U) * lmax; if (_unur_hitro_vu_is_inside_region(gen,vuaux) ) break; /* --- adaptive line sampling --- */ if ( gen->variant & HITRO_VARFLAG_ADAPTLINE ) { if (GEN->state[coord] < vuaux[coord]) lmax = vuaux[coord]; else lmin = vuaux[coord]; } } /* store new state */ GEN->state[coord] = vuaux[coord]; } /* transform current state into point in original scale */ _unur_hitro_vu_to_x( gen, GEN->state, vec ); return UNUR_SUCCESS; } /* end of _unur_hitro_coord_sample_cvec() */ /*---------------------------------------------------------------------------*/ int _unur_hitro_randomdir_sample_cvec( struct unur_gen *gen, double *vec ) /*----------------------------------------------------------------------*/ /* sample from generator */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* vec ... random vector (result) */ /*----------------------------------------------------------------------*/ { #define new_point(ll) { int j; for (j=0;jstate[j]+(ll)*GEN->direction[j]; } int thinning; int i, d, k; double lambda, lb[2]; /* line segments, endpoints */ double *vuaux; /* pointer to auxiliary working array */ double U; int update; int dim = GEN->dim; /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_HITRO_GEN,UNUR_ERR_COOKIE); /* entire bounding rectangle or just covering plate ? */ d = (gen->variant & HITRO_VARFLAG_BOUNDRECT) ? dim+1 : 1; /* pointer to auxiliary working array */ vuaux = GEN->vu; for (thinning = GEN->thinning; thinning > 0; --thinning) { /* new random direction */ _unur_hitro_random_unitvector( gen, GEN->direction ); /* --- l.h.s. and r.h.s. endpoint of line segment --- */ lb[1] = UNUR_INFINITY; lb[0] = -UNUR_INFINITY; for (i=0; ivumin[i] - GEN->state[i]) / GEN->direction[i]; if (lambda>0 && lambdalb[0]) lb[0] = lambda; lambda = (GEN->vumax[i] - GEN->state[i]) / GEN->direction[i]; if (lambda>0 && lambdalb[0]) lb[0] = lambda; } if (! (_unur_isfinite(lb[0]) && _unur_isfinite(lb[1])) ) { _unur_warning(gen->genid,UNUR_ERR_GEN_CONDITION,"line segment not bounded, try again"); continue; } /* --- adaptive bounding rectangle --- */ if ( gen->variant & HITRO_VARFLAG_ADAPTRECT ) { /* check whether endpoint is outside of region */ for (k=0; k<2; k++) { update = FALSE; while (1) { new_point(lb[k]); if (! _unur_hitro_vu_is_inside_region(gen,vuaux) ) break; update = TRUE; lb[k] *= GEN->adaptive_mult; } if (update) { /* we have to update vumin and vmax */ new_point(lb[k]); for (i=0; ivumin[i] && i!=0) GEN->vumin[i] = vuaux[i]; if (vuaux[i] > GEN->vumax[i]) GEN->vumax[i] = vuaux[i]; /* remark: vmin is always 0 */ } } } } /* --- new coordinate for next point --- */ while (1) { U = _unur_call_urng(gen->urng); lambda = U * lb[0] + (1.-U) * lb[1]; new_point(lambda); if (_unur_hitro_vu_is_inside_region(gen,vuaux) ) break; /* --- adaptive line sampling --- */ if ( gen->variant & HITRO_VARFLAG_ADAPTLINE ) { if (lambda < 0) lb[0] = lambda; else lb[1] = lambda; } } /* store new state */ memcpy( GEN->state, vuaux, (dim+1)*sizeof(double) ); } /* transform current state into point in original scale */ _unur_hitro_vu_to_x( gen, GEN->state, vec ); return UNUR_SUCCESS; #undef new_point } /* end of _unur_hitro_randomdir_sample_cvec() */ /*****************************************************************************/ /** Auxilliary Routines **/ /*****************************************************************************/ int _unur_hitro_rectangle( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* compute bounding rectangle */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int d; /* index used in dimension loops (0 <= d < dim) */ struct MROU_RECTANGLE *rr; /* check arguments */ CHECK_NULL( gen, UNUR_ERR_NULL ); COOKIE_CHECK( gen,CK_HITRO_GEN, UNUR_ERR_COOKIE ); /* Boundary rectangle is already set ? */ if ((gen->set & HITRO_SET_U) && (gen->set & HITRO_SET_V)) return UNUR_SUCCESS; /* Allocating and filling mrou_rectangle struct */ rr = _unur_mrou_rectangle_new(); rr->distr = gen->distr; rr->dim = GEN->dim; rr->umin = GEN->vumin+1; rr->umax = GEN->vumax+1; rr->r = GEN->r; rr->center = GEN->center; rr->genid = gen->genid; rr->bounding_rectangle = ( (gen->variant & HITRO_VARFLAG_BOUNDRECT) && !(gen->set & HITRO_SET_U) ) ? 1 : 0; /* calculate bounding rectangle */ if ( _unur_mrou_rectangle_compute(rr) != UNUR_SUCCESS ) { _unur_warning(gen->genid,UNUR_ERR_GEN_CONDITION,"Cannot compute bounding rectangle, try adaptive"); gen->variant &= HITRO_VARFLAG_ADAPTRECT; free(rr); return UNUR_ERR_GEN_CONDITION; } if (!(gen->set & HITRO_SET_V)) { /* user has not provided any upper bound for v */ GEN->vumax[0] = rr->vmax; } if (rr->bounding_rectangle) { /* user has not provided required bounds for u */ for (d=0; ddim; d++) GEN->vumin[d+1] = rr->umin[d]; for (d=0; ddim; d++) GEN->vumax[d+1] = rr->umax[d]; } /* free working space */ free(rr); /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_hitro_rectangle() */ /*---------------------------------------------------------------------------*/ double _unur_hitro_xv_to_u( const struct unur_gen *gen, double x, double v, int k ) /*----------------------------------------------------------------------*/ /* transform point where we are given the v-coordinate (in RoU scale) */ /* and the k-th x-coordinate (in xy scale) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* x ... x coordinates of point (in original scale) */ /* v ... v coordinate of point (in RoU scale) */ /* k ... index of coordinate */ /*----------------------------------------------------------------------*/ { if (_unur_isone(GEN->r)) return (x - GEN->center[k]) * v; else return (x - GEN->center[k]) * pow(v,GEN->r) ; } /* end of _unur_hitro_x_to_u() */ /*---------------------------------------------------------------------------*/ void _unur_hitro_xy_to_vu( const struct unur_gen *gen, const double *x, double y, double *vu ) /*----------------------------------------------------------------------*/ /* transform point with coordinates xy in the original scale into */ /* point in RoU-scale with coordinates vu. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* x ... x coordinates of point */ /* y ... y coordinate of point */ /* vu ... coordinates of transformed point */ /*----------------------------------------------------------------------*/ { int d; double v; double *u = vu+1; vu[0] = v = pow(y, 1./(GEN->r * GEN->dim + 1.)); if (_unur_isone(GEN->r)) for (d=0; ddim; d++) u[d] = (x[d] - GEN->center[d]) * v; else for (d=0; ddim; d++) u[d] = (x[d] - GEN->center[d]) * pow(v,GEN->r) ; } /* end of _unur_hitro_xy_to_vu() */ /*---------------------------------------------------------------------------*/ void _unur_hitro_vu_to_x( const struct unur_gen *gen, const double *vu, double *x ) /*----------------------------------------------------------------------*/ /* transform point with coordinates vu in RoU-scale into original */ /* scale with coordinates xy. The y coordinate is not of interest here */ /* and thus omitted. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* vu ... coordinates of transformed point */ /* x ... x coordinates of point */ /*----------------------------------------------------------------------*/ { int d; double v = vu[0]; const double *u = vu+1; if (v<=0.) { /* we are outside of the domain --> return 0 */ for (d=0; ddim; d++) x[d] = 0.; return; } if (_unur_isone(GEN->r)) for (d=0; ddim; d++) x[d] = u[d]/v + GEN->center[d]; else for (d=0; ddim; d++) x[d] = u[d]/pow(v,GEN->r) + GEN->center[d]; } /* end of _unur_hitro_vu_to_x() */ /*---------------------------------------------------------------------------*/ int _unur_hitro_vu_is_inside_region( const struct unur_gen *gen, const double *vu ) /*----------------------------------------------------------------------*/ /* check whether point is inside RoU acceptance region */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* vu ... point in uv space */ /*----------------------------------------------------------------------*/ { double y; /* v-coordinate */ double v = vu[0]; /* transform into original scale */ _unur_hitro_vu_to_x( gen, vu, GEN->x ); /* PDF at x */ y = PDF(GEN->x); /* we are outside of domain if x is not in support of PDF or */ /* v is non-positive. */ if (y <= 0. || v <= 0.) return FALSE; /* now check whether point is in region below PDF */ return ( (v < pow(y,1./(GEN->r * GEN->dim + 1.))) ? TRUE : FALSE ); } /* end of _unur_hitro_vu_is_inside_region() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_hitro_normalgen( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* create a normal random variate generator */ /* */ /* parameters: */ /* gen ... pointer to HITRO generator object */ /* */ /* */ /*----------------------------------------------------------------------*/ { struct unur_gen *normalgen; struct unur_distr *normaldistr = unur_distr_normal(NULL,0); struct unur_par *normalpar = unur_arou_new( normaldistr ); unur_arou_set_usedars( normalpar, TRUE ); normalgen = unur_init( normalpar ); _unur_distr_free( normaldistr ); if (normalgen == NULL) { _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN, "Cannot create aux Gaussian generator"); return NULL; } /* uniform random number generator and debugging flags */ normalgen->urng = gen->urng; normalgen->debug = gen->debug; return normalgen; } /* end of _unur_hitro_normalgen() */ /*---------------------------------------------------------------------------*/ void _unur_hitro_random_unitvector( struct unur_gen *gen, double *direction ) /*----------------------------------------------------------------------*/ /* generate a random direction vector */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* direction ... random vector (result) */ /*----------------------------------------------------------------------*/ { int i; do { for (i=0; idim+1; i++) direction[i] = unur_sample_cont(GEN_NORMAL); /* normalize direction vector */ _unur_vector_normalize(GEN->dim+1, direction); /* there is an extremely small change that direction is the null before normalizing. In this case non of its coordinates are finite. */ } while (!_unur_isfinite(direction[0])); } /* end of _unur_hitro_random_unitvector() */ /*****************************************************************************/ /** Debugging utilities **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ void _unur_hitro_debug_init_start( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write info about generator into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_HITRO_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: type = continuous multivariate random variates\n",gen->genid); fprintf(LOG,"%s: method = HITRO (Markov Chain - HITRO sampler)\n",gen->genid); fprintf(LOG,"%s: variant = ",gen->genid); switch (gen->variant & HITRO_VARMASK_VARIANT) { case HITRO_VARIANT_COORD: fprintf(LOG,"coordinate sampling [default]\n"); break; case HITRO_VARIANT_RANDOMDIR: fprintf(LOG,"random direction sampling\n"); break; } fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: r = %g",gen->genid, GEN->r); _unur_print_if_default(gen,HITRO_SET_R); fprintf(LOG,"\n%s: adaptive line sampling: %s",gen->genid, (gen->variant&HITRO_VARFLAG_ADAPTLINE)?"on":"off"); _unur_print_if_default(gen,HITRO_SET_ADAPTLINE); fprintf(LOG,"\n%s: use entire bounding rectangle: %s",gen->genid, (gen->variant&HITRO_VARFLAG_BOUNDRECT)?"on":"off"); _unur_print_if_default(gen,HITRO_SET_BOUNDRECT); fprintf(LOG,"\n%s: adaptive bounding rectangle: %s",gen->genid, (gen->variant&HITRO_VARFLAG_ADAPTRECT)?"on":"off"); _unur_print_if_default(gen,HITRO_SET_ADAPTRECT); if (gen->variant&HITRO_VARFLAG_ADAPTRECT) { fprintf(LOG,"\n%s:\tmultiplier = %g",gen->genid,GEN->adaptive_mult); _unur_print_if_default(gen,HITRO_SET_ADAPTMULT); } fprintf(LOG,"\n%s: use domain of distribution: %s\n",gen->genid, (gen->variant&HITRO_VARFLAG_BOUNDDOMAIN)?"on":"off"); fprintf(LOG,"%s:\n",gen->genid); _unur_distr_cvec_debug( gen->distr, gen->genid ); switch (gen->variant & HITRO_VARMASK_VARIANT) { case HITRO_VARIANT_COORD: fprintf(LOG,"%s: sampling routine = _unur_hitro_coord_sample_cvec()\n",gen->genid); break; case HITRO_VARIANT_RANDOMDIR: fprintf(LOG,"%s: sampling routine = _unur_hitro_randomdir_sample_cvec()\n",gen->genid); break; } fprintf(LOG,"%s: thinning = %d",gen->genid,GEN->thinning); _unur_print_if_default(gen,HITRO_SET_THINNING); fprintf(LOG,"\n%s: burn-in = %d",gen->genid,GEN->burnin); _unur_print_if_default(gen,HITRO_SET_BURNIN); fprintf(LOG,"\n%s:\n",gen->genid); _unur_matrix_print_vector( GEN->dim, GEN->x0, "starting point = ", LOG, gen->genid, "\t "); fprintf(LOG,"%s:\n",gen->genid); fflush(LOG); } /* end of _unur_hitro_debug_init_start() */ /*---------------------------------------------------------------------------*/ void _unur_hitro_debug_init_finished( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write info about generator into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_HITRO_GEN,RETURN_VOID); LOG = unur_get_stream(); if (gen->variant & HITRO_VARFLAG_BOUNDRECT) { fprintf(LOG,"%s: bounding rectangle%s:\n",gen->genid, (gen->variant & HITRO_VARFLAG_ADAPTRECT) ? " [start for adaptive rectangle]" : "" ); fprintf(LOG,"%s: vmax = %g\n",gen->genid, GEN->vumax[0]); _unur_matrix_print_vector( GEN->dim, GEN->vumin+1, "umin =", LOG, gen->genid, "\t "); _unur_matrix_print_vector( GEN->dim, GEN->vumax+1, "umax =", LOG, gen->genid, "\t "); } else { fprintf(LOG,"%s: upper bound vmax = %g %s\n",gen->genid, GEN->vumax[0], (gen->variant & HITRO_VARFLAG_ADAPTRECT) ? "[start for adaptive bound]" : "" ); } _unur_matrix_print_vector( GEN->dim+1, GEN->state, "starting state = ", LOG, gen->genid, "\t "); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: INIT completed **********************\n",gen->genid); fflush(LOG); } /* end of _unur_hitro_debug_init_finished() */ /*---------------------------------------------------------------------------*/ void _unur_hitro_debug_free( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write info about generator into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_HITRO_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s:\n",gen->genid); if (gen->status == UNUR_SUCCESS) { fprintf(LOG,"%s: GENERATOR destroyed **********************\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); } else { fprintf(LOG,"%s: initialization of GENERATOR failed **********************\n",gen->genid); } fprintf(LOG,"%s:\n",gen->genid); if (gen->variant & HITRO_VARFLAG_BOUNDRECT) { fprintf(LOG,"%s: bounding rectangle%s:\n",gen->genid, (gen->variant & HITRO_VARFLAG_ADAPTRECT) ? " [adaptive]" : "" ); fprintf(LOG,"%s: vmax = %g\n",gen->genid, GEN->vumax[0]); _unur_matrix_print_vector( GEN->dim, GEN->vumin+1, "umin =", LOG, gen->genid, "\t "); _unur_matrix_print_vector( GEN->dim, GEN->vumax+1, "umax =", LOG, gen->genid, "\t "); } else { fprintf(LOG,"%s: upper bound vmax = %g %s\n",gen->genid, GEN->vumax[0], (gen->variant & HITRO_VARFLAG_ADAPTRECT) ? "[adaptive]" : "" ); } fprintf(LOG,"%s:\n",gen->genid); fflush(LOG); } /* end of _unur_hitro_debug_free() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_INFO /*---------------------------------------------------------------------------*/ void _unur_hitro_info( struct unur_gen *gen, int help ) /*----------------------------------------------------------------------*/ /* create character string that contains information about the */ /* given generator object. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* help ... whether to print additional comments */ /*----------------------------------------------------------------------*/ { struct unur_string *info = gen->infostr; struct unur_distr *distr = gen->distr; int samplesize = 10000; int i; double rc; /* generator ID */ _unur_string_append(info,"generator ID: %s\n\n", gen->genid); /* distribution */ _unur_string_append(info,"distribution:\n"); _unur_distr_info_typename(gen); _unur_string_append(info," dimension = %d\n",GEN->dim); _unur_string_append(info," functions = PDF\n"); _unur_distr_cvec_info_domain(gen); if ( distr->set & UNUR_DISTR_SET_MODE ) { _unur_string_append(info," mode = "); _unur_distr_info_vector( gen, DISTR.mode, GEN->dim); } _unur_string_append(info,"\n"); _unur_string_append(info," center = "); _unur_distr_info_vector( gen, GEN->center, GEN->dim); if ( !(distr->set & UNUR_DISTR_SET_CENTER) ) { if ( distr->set & UNUR_DISTR_SET_MODE ) _unur_string_append(info," [= mode]"); else _unur_string_append(info," [default]"); } _unur_string_append(info,"\n\n"); /* if (help) { */ /* _unur_string_append(info,"\n"); */ /* } */ /* method */ _unur_string_append(info,"method: HITRO (HIT-and-run sampler with Ratio-Of-uniforms [MCMC])\n"); _unur_string_append(info," variant = %s\n", ((gen->variant & HITRO_VARMASK_VARIANT)==HITRO_VARIANT_COORD) ? "coordinate sampling [default]" : "random direction sampling"); _unur_string_append(info," r = %g\n", GEN->r); _unur_string_append(info," thinning = %d\n", GEN->thinning); _unur_string_append(info," adaptive line sampling = %s\n", (gen->variant&HITRO_VARFLAG_ADAPTLINE)?"on":"off"); _unur_string_append(info," use entire bounding rectangle = %s\n", (gen->variant&HITRO_VARFLAG_BOUNDRECT)?"on":"off"); if (gen->variant&HITRO_VARFLAG_ADAPTRECT) _unur_string_append(info," adaptive bounding rectangle = on [multiplier = %g]\n", GEN->adaptive_mult); else _unur_string_append(info," adaptive bounding rectangle = off\n"); _unur_string_append(info,"\n"); /* performance */ _unur_string_append(info,"performance characteristics:\n"); rc = unur_test_count_urn(gen,samplesize,0,NULL)/((double)samplesize); if (gen->variant & HITRO_VARFLAG_BOUNDRECT) { _unur_string_append(info," bounding rectangle %s= ", (gen->variant & HITRO_VARFLAG_ADAPTRECT) ? "[adaptive] " : "" ); for (i=0; idim; i++) _unur_string_append(info,"%s(%g,%g)", i?"x":"", GEN->vumin[i+1], GEN->vumax[i+1]); _unur_string_append(info," x (0,%g)\n", GEN->vumax[0]); } else { _unur_string_append(info," upper bound vmax = %g %s\n", GEN->vumax[0], (gen->variant & HITRO_VARFLAG_ADAPTRECT) ? "[adaptive]" : "" ); } _unur_string_append(info," rejection constant = %.2f [approx.]\n", rc); _unur_string_append(info,"\n"); /* parameters */ if (help) { _unur_string_append(info,"parameters:\n"); switch (gen->variant & HITRO_VARMASK_VARIANT) { case HITRO_VARIANT_COORD: _unur_string_append(info," variant_coordinate [default]\n"); break; case HITRO_VARIANT_RANDOMDIR: _unur_string_append(info," variant_random_direction\n"); break; } _unur_string_append(info," r = %g %s\n", GEN->r, (gen->set & HITRO_SET_R) ? "" : "[default]"); _unur_string_append(info," adaptiveline = %s %s\n", (gen->variant&HITRO_VARFLAG_ADAPTLINE)?"on":"off", (gen->set & HITRO_SET_ADAPTLINE) ? "" : "[default]"); _unur_string_append(info," boundingrectangle = %s %s\n", (gen->variant&HITRO_VARFLAG_BOUNDRECT)?"on":"off", (gen->set & HITRO_SET_BOUNDRECT) ? "" : "[default]"); _unur_string_append(info," adaptiverectangle = %s %s\n", (gen->variant&HITRO_VARFLAG_ADAPTRECT)?"on":"off", (gen->set & HITRO_SET_ADAPTRECT) ? "" : "[default]"); if (gen->variant&HITRO_VARFLAG_ADAPTRECT) _unur_string_append(info," adaptive_multiplier = %g %s\n", GEN->adaptive_mult, (gen->set & HITRO_SET_ADAPTMULT) ? "" : "[default]"); _unur_string_append(info," thinning = %d %s\n", GEN->thinning, (gen->set & HITRO_SET_THINNING) ? "" : "[default]"); _unur_string_append(info," burnin = %d %s\n", GEN->burnin, (gen->set & HITRO_SET_THINNING) ? "" : "[default]"); _unur_string_append(info,"\n"); /* Not displayed: int unur_hitro_set_v( UNUR_PAR *parameters, double vmax ); int unur_hitro_set_u( UNUR_PAR *parameters, const double *umin, const double *umax ); int unur_hitro_set_startingpoint( UNUR_PAR *parameters, const double *x0 ); */ } /* Hints */ /* if (help) { */ /* _unur_string_append(info,"\n"); */ /* } */ } /* end of _unur_hitro_info() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_INFO */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/utdr.h0000644001357500135600000001646614420445767013450 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: utdr.h * * * * PURPOSE: * * function prototypes for method UTDR * * (Universal Transformed Density Rejection; 3-point method) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /* =METHOD UTDR Universal Transformed Density Rejection =UP Methods_for_CONT =REQUIRED T-concave PDF, mode, approximate area =SPEED Set-up: moderate, Sampling: Moderate =REINIT supported =REF [HWa95] [HLD04: Sect.4.5.4, Alg.4.4] =DESCRIPTION UTDR is based on the transformed density rejection and uses three almost optimal points for constructing hat and squeezes. It works for all @i{T}-concave distributions with @unurmath{T(x) = -1/\sqrt(x).} It requires the PDF and the (exact) location of the mode. Notice that if no mode is given at all, a (slow) numerical mode finder will be used. Moreover the approximate area below the given PDF is used. (If no area is given for the distribution the algorithm assumes that it is approximately 1.) The rejection constant is bounded from above by 4 for all @i{T}-concave distributions. =HOWTOUSE UTDR works for any continuous univariate distribution object with given @i{T}-concave PDF (with @unurmath{T(x) = -1/\sqrt{x},)} mode and approximate area below PDF. When the PDF does not change at the mode for varying parameters, then this value can be set with unur_utdr_set_pdfatmode() to avoid some computations. Since this value will not be updated any more when the parameters of the distribution are changed, the unur_utdr_chg_pdfatmode() call is necessary to do this manually. It is possible to change the parameters and the domain of the chosen distribution and run unur_reinit() to reinitialize the generator object. Notice, that derived parameters like the mode must also be (re-) set if the parameters or the domain has be changed. Moreover, if the PDF at the mode has been provided by a unur_utdr_set_pdfatmode() call, additionally unur_utdr_chg_pdfatmode() must be used (otherwise this call is not necessary since then this figure is computed directly from the PDF). There exists a test mode that verifies whether the conditions for the method are satisfied or not. It can be switched on by calling unur_utdr_set_verify() and unur_utdr_chg_verify(), respectively. Notice however that sampling is slower then. =END */ /*---------------------------------------------------------------------------*/ /* Routines for user interface */ /* =ROUTINES */ UNUR_PAR *unur_utdr_new( const UNUR_DISTR *distribution ); /* Get default parameters for generator. */ /*...........................................................................*/ int unur_utdr_set_pdfatmode( UNUR_PAR *parameters, double fmode ); /* Set pdf at mode. When set, the PDF at the mode is never changed. This is to avoid additional computations, when the PDF does not change when parameters of the distributions vary. It is only useful when the PDF at the mode does not change with changing parameters for the distribution. Default: not set. */ int unur_utdr_set_cpfactor( UNUR_PAR *parameters, double cp_factor ); /* Set factor for position of left and right construction point. The @var{cp_factor} is used to find almost optimal construction points for the hat function. There is no need to change this factor in almost all situations. Default is @code{0.664}. */ int unur_utdr_set_deltafactor( UNUR_PAR *parameters, double delta ); /* Set factor for replacing tangents by secants. higher factors increase the rejection constant but reduces the risk of serious round-off errors. There is no need to change this factor it almost all situations. Default is @code{1.e-5}. */ int unur_utdr_set_verify( UNUR_PAR *parameters, int verify ); /* */ int unur_utdr_chg_verify( UNUR_GEN *generator, int verify ); /* Turn verifying of algorithm while sampling on/off. If the condition squeeze(@i{x}) <= PDF(@i{x}) <= hat(@i{x}) is violated for some @i{x} then @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. However notice that this might happen due to round-off errors for a few values of @i{x} (less than 1%). Default is FALSE. */ /*...........................................................................*/ int unur_utdr_chg_pdfatmode( UNUR_GEN *generator, double fmode ); /* Change PDF at mode of distribution. unur_reinit() must be executed before sampling from the generator again. */ /* =END */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/gibbs_struct.h0000644001357500135600000001002114420304141015115 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: gibbs_struct.h * * * * PURPOSE: * * declares structures for method GIBBS * * (Markov Chain - GIBBS sampler) * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Information for constructing the generator */ struct unur_gibbs_par { int thinning; /* thinning factor for generated chain */ int burnin; /* length of burn-in for chain */ double c_T; /* parameter c for transformation T_c */ const double *x0; /* starting point of chain */ }; /*---------------------------------------------------------------------------*/ /* The generator object */ struct unur_gibbs_gen { int dim; /* dimension of distribution */ int thinning; /* thinning factor for generated chain */ double c_T; /* parameter c for transformation T_c */ double *state; /* state of chain / current point */ struct unur_distr *distr_condi; /* conditional distribution */ int coord; /* current coordinate used for GIBBS chain */ double *direction; /* working array for random direction */ int burnin; /* length of burn-in for chain */ double *x0; /* starting point of chain */ }; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/ninv.c0000644001357500135600000004377714420445767013444 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: ninv.c * * * * TYPE: continuous univariate random variate * * METHOD: numerical inversion of cumulative distribution function * * * * DESCRIPTION: * * * * REQUIRED: * * pointer to the CDF * * newton's method: additional pointer to the PDF * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * ***************************************************************************** * * * REFERENCES: * * [1] Neumaier A. (to be published): * * Introduction to numerical analysis, * * Cambridge University Press. * * * * [2] Dahlquist, G. and Bj{\"o}rck, {\AA} (2008): * * Numerical methods in scientific computing, Vol 1., * * SIAM, Philadelphia, PA. * * * * [3] Brent, R. (1973): * * Algorithms for Minimizing without Derivatives, * * Prentice-Hall, Englewood Cliffs, NJ. * * Republished by Dover Publications, Mineola, NY, 2002. * * * ***************************************************************************** * * * Numerical inversion is a method for generating random variables * * using the CDF (and in case of newton's method the PDF). * * * * THEOREM: * * Let X be a random variable with CDF F(x). * * Then the F(X) are uniformly distributed. * * * * COROLLARY: * * Starting with uniformly distributed random variables U, * * the F^(-1)(U) have F(x) as CDF. * * * * Starting with an U, the task is to find a X fulfilling: * * F(X) - U = 0. * * * * Numerical algorithms to find zeros that are used in NINV are variants of * * newton's method (damped newton to guarantee improvement) and * * the regula falsi ( stabilized regula falsi preserving sign change; at * * first an interval with sign change is determined). * * * * In both cases it is possible to specify the maximal number of * * iterations, a desired accuracy in X and starting values for the * * algorithms. * * Instead of starting values it is also possible to use a table * * containing suitable starting values. * * If neither the table nor explicit starting values are used, * * NINV chooses as starting values: * * newton's method: x: CDF(x) = 0.5 * * regula falsi: x1,x2: CDF(x1) = 1 - CDF(x2) = 0.05 * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include "unur_methods_source.h" #include "x_gen_source.h" #include "ninv.h" #include "ninv_struct.h" #ifdef UNUR_ENABLE_INFO # include #endif /*---------------------------------------------------------------------------*/ /* Constants */ /* Starting interval for Regula Falsi includes this percentage of all */ /* univariate random numbers (must be > 0. and < 1.) */ #define INTERVAL_COVERS (0.5) /*---------------------------------------------------------------------------*/ /* Variants: none */ #define NINV_VARFLAG_NEWTON 0x1u /* use Newton's method */ #define NINV_VARFLAG_REGULA 0x2u /* use regula falsi [default] */ #define NINV_VARFLAG_BISECT 0x4u /* use bisection method */ /*---------------------------------------------------------------------------*/ /* Debugging flags */ /* bit 01 ... pameters and structure of generator (do not use here) */ /* bits 02-12 ... setup */ /* bits 13-24 ... adaptive steps */ /* bits 25-32 ... trace sampling */ #define NINV_DEBUG_REINIT 0x00000002u /* print parameters after reinit */ #define NINV_DEBUG_TABLE 0x00000010u /* print table */ #define NINV_DEBUG_CHG 0x00001000u /* print changed parameters */ #define NINV_DEBUG_SAMPLE 0x01000000u /* trace sampling */ /*---------------------------------------------------------------------------*/ /* Flags for logging set calls */ #define NINV_SET_MAX_ITER 0x001u /* number of maximal iterations */ #define NINV_SET_X_RESOLUTION 0x002u /* maximal tolerated relative x-error */ #define NINV_SET_U_RESOLUTION 0x004u /* maximal tolerated (abs.) u-error */ #define NINV_SET_START 0x008u /* intervals at start (left/right) */ /*---------------------------------------------------------------------------*/ #define GENTYPE "NINV" /* type of generator */ /*---------------------------------------------------------------------------*/ /*........................*/ /* file: ninv_newset.ch */ /*........................*/ /* See ninv.h for 'new', 'set', and 'get' calls. */ /*......................*/ /* file: ninv_init.ch */ /*......................*/ static struct unur_gen *_unur_ninv_init( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* Initialize new generator. */ /*---------------------------------------------------------------------------*/ static int _unur_ninv_reinit( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Reinitialize generator. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_ninv_create( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* create new (almost empty) generator object. */ /*---------------------------------------------------------------------------*/ static int _unur_ninv_check_par( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Check parameters of given distribution and method */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_ninv_clone( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* copy (clone) generator object. */ /*---------------------------------------------------------------------------*/ static void _unur_ninv_free( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* destroy generator object. */ /*---------------------------------------------------------------------------*/ static int _unur_ninv_create_table( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* create the table with starting points */ /*---------------------------------------------------------------------------*/ static int _unur_ninv_compute_start( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* get starting points for numerical inversion */ /*---------------------------------------------------------------------------*/ /*........................*/ /* file: ninv_sample.ch */ /*........................*/ static double _unur_ninv_sample_newton( struct unur_gen *gen ); static double _unur_ninv_sample_regula( struct unur_gen *gen ); static double _unur_ninv_sample_bisect( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* sample from generator */ /*---------------------------------------------------------------------------*/ /*........................*/ /* file: ninv_newton.ch */ /*........................*/ static double _unur_ninv_newton( const struct unur_gen *gen, double u); /*---------------------------------------------------------------------------*/ /* algorithm: newton method */ /*---------------------------------------------------------------------------*/ /*........................*/ /* file: ninv_regula.ch */ /*........................*/ static double _unur_ninv_regula( const struct unur_gen *gen, double u ); /*---------------------------------------------------------------------------*/ /* algorithm: regula falsi */ /*---------------------------------------------------------------------------*/ static double _unur_ninv_bisect( const struct unur_gen *gen, double u ); /*---------------------------------------------------------------------------*/ /* algorithm: bisection method */ /*---------------------------------------------------------------------------*/ static int _unur_ninv_bracket( const struct unur_gen *gen, double u, double *xl, double *fl, double *xu, double *fu ); /*---------------------------------------------------------------------------*/ /* find a bracket (enclosing interval) for root of CDF(x)-u. */ /*---------------------------------------------------------------------------*/ static int _unur_ninv_accuracy( const struct unur_gen *gen, double x_resol, double u_resol, double x0, double f0, double x1, double f1 ); /*---------------------------------------------------------------------------*/ /* check accuracy goal for approximate root. */ /*---------------------------------------------------------------------------*/ /*.......................*/ /* file: ninv_debug.ch */ /*.......................*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ /* the following functions print debugging information on output stream, */ /* i.e., into the LOG file if not specified otherwise. */ /*---------------------------------------------------------------------------*/ static void _unur_ninv_debug_init( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print after generator has been initialized has completed. */ /*---------------------------------------------------------------------------*/ static void _unur_ninv_debug_start( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print starting points or table for algorithms into LOG file */ /*---------------------------------------------------------------------------*/ static void _unur_ninv_debug_sample( const struct unur_gen *gen, double u, double x, double fx, int iter ); /*---------------------------------------------------------------------------*/ /* trace sampling. */ /*---------------------------------------------------------------------------*/ static void _unur_ninv_debug_chg_truncated( const struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* trace changes of the truncated domain. */ /*---------------------------------------------------------------------------*/ #endif /*......................*/ /* file: pinv_info.ch */ /*......................*/ #ifdef UNUR_ENABLE_INFO static void _unur_ninv_info( struct unur_gen *gen, int help ); /*---------------------------------------------------------------------------*/ /* create info string. */ /*---------------------------------------------------------------------------*/ #endif /*---------------------------------------------------------------------------*/ /* abbreviations */ #define DISTR_IN distr->data.cont /* data for distribution object */ #define PAR ((struct unur_ninv_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_ninv_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.cont /* data for distribution in generator object */ #define SAMPLE gen->sample.cont /* pointer to sampling routine */ #define PDF(x) _unur_cont_PDF((x),(gen->distr)) /* call to PDF */ #define CDF(x) _unur_cont_CDF((x),(gen->distr)) /* call to CDF */ /*---------------------------------------------------------------------------*/ static UNUR_SAMPLING_ROUTINE_CONT * _unur_ninv_getSAMPLE( struct unur_gen *gen ) { switch (gen->variant) { case NINV_VARFLAG_NEWTON: return _unur_ninv_sample_newton; case NINV_VARFLAG_BISECT: return _unur_ninv_sample_bisect; case NINV_VARFLAG_REGULA: default: return _unur_ninv_sample_regula; } } /* end of _unur_ninv_getSAMPLE() */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* since there is only file scope or program code, we abuse the */ /* #include directive. */ /** Public: User Interface (API) **/ #include "ninv_newset.ch" /** Private **/ #include "ninv_init.ch" #include "ninv_sample.ch" #include "ninv_newton.ch" #include "ninv_regula.ch" #include "ninv_debug.ch" #include "ninv_info.ch" /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/ars_struct.h0000644001357500135600000001267414420445767014660 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: ars_struct.h * * * * PURPOSE: * * declares structures for method ARS * * (Adaptive Rejection Sampling - Gilks & Wild) * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Information for constructing the generator */ struct unur_ars_par { const double *starting_cpoints; /* pointer to array of starting points */ int n_starting_cpoints; /* number of construction points at start */ const double *percentiles; /* percentiles of hat for c. points of new hat */ int n_percentiles; /* number of percentiles */ int retry_ncpoints; /* number of cpoints for second trial of reinit */ int max_ivs; /* maximum number of intervals */ int max_iter; /* maximum number of iterations */ }; /*---------------------------------------------------------------------------*/ /* store data for segments */ struct unur_ars_interval { double x; /* (left hand side) construction point (cp) */ double logfx; /* value of logPDF at cp */ double dlogfx; /* derivative of logPDF at cp */ double sq; /* slope of transformed squeeze in interval */ double Acum; /* cumulated area of intervals */ double logAhat; /* log of area below hat */ double Ahatr_fract; /* fraction of area below hat on r.h.s. */ struct unur_ars_interval *next; /* pointer to next interval in list */ #ifdef DEBUG_STORE_IP double ip; /* intersection point between two tangents */ #endif #ifdef UNUR_COOKIES unsigned cookie; /* magic cookie */ #endif }; /*---------------------------------------------------------------------------*/ /* The generator object */ struct unur_ars_gen { double Atotal; /* area below hat */ double logAmax; /* log of maximum area in intervals */ struct unur_ars_interval *iv; /* pointer to linked list of intervals */ int n_ivs; /* number of intervals */ int max_ivs; /* maximum number of intervals */ int max_iter; /* maximum number of iterations */ double *starting_cpoints; /* pointer to array of starting points */ int n_starting_cpoints; /* number of construction points at start */ double *percentiles; /* percentiles of hat for c. points of new hat */ int n_percentiles; /* number of percentiles */ int retry_ncpoints; /* number of cpoints for second trial of reinit */ }; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/unif.c0000644001357500135600000004673214420445767013425 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: unif.c * * * * dummy generator, produces uniform random numbers in UNURAN framework * * * ***************************************************************************** * * * Copyright (c) 2000-2011 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "unur_methods_source.h" #include "x_gen_source.h" #include "unif.h" #include "unif_struct.h" /*---------------------------------------------------------------------------*/ /* Variants: none */ /*---------------------------------------------------------------------------*/ /* Debugging flags */ /* bit 01 ... pameters and structure of generator (do not use here) */ /* bits 02-12 ... setup */ /* bits 13-24 ... adaptive steps */ /* bits 25-32 ... trace sampling */ /*---------------------------------------------------------------------------*/ #define GENTYPE "UNIF" /* type of generator */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_unif_init( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* Initialize new generator. */ /*---------------------------------------------------------------------------*/ static int _unur_unif_reinit( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Reinitialize generator. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_unif_create( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* create new (almost empty) generator object. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_unif_clone( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* copy (clone) generator object. */ /*---------------------------------------------------------------------------*/ static void _unur_unif_free( struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* destroy generator object. */ /*---------------------------------------------------------------------------*/ static double _unur_unif_sample( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* sample from generator */ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_INFO static void _unur_unif_info( struct unur_gen *gen, int help ); /*---------------------------------------------------------------------------*/ /* create info string. */ /*---------------------------------------------------------------------------*/ #endif /*---------------------------------------------------------------------------*/ /* abbreviations */ #define PAR ((struct unur_unif_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_unif_gen*)gen->datap) /* data for generator object */ #define SAMPLE gen->sample.cont /*---------------------------------------------------------------------------*/ #define _unur_unif_getSAMPLE(gen) ( _unur_unif_sample ) /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Public: User Interface (API) **/ /*****************************************************************************/ struct unur_par * unur_unif_new( const struct unur_distr *distr_dummy ) /*----------------------------------------------------------------------*/ /* get default parameters */ /* */ /* parameters: */ /* distr_dummy ... pointer to a distribution object */ /* it may be NULL. */ /* */ /* return: */ /* default parameters (pointer to structure) */ /* */ /* error: */ /* return NULL */ /* */ /* comment: */ /* for testing. */ /*----------------------------------------------------------------------*/ { struct unur_par *par; /* check distribution */ if (distr_dummy != NULL) { /* we do not need this the distribution at all. */ /* but if it is provided it must be a continuous distribution. */ if (distr_dummy->type != UNUR_DISTR_CONT) { _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } COOKIE_CHECK(distr_dummy,CK_DISTR_CONT,NULL); } /* allocate structure */ par = _unur_par_new( sizeof(struct unur_unif_par) ); COOKIE_SET(par,CK_UNIF_PAR); /* copy input */ par->distr = distr_dummy; /* pointer to distribution object */ /* set default values */ par->method = UNUR_METH_UNIF; /* method and default variant */ par->variant = 0u; /* default variant */ par->set = 0u; /* inidicate default parameters */ par->urng = unur_get_default_urng(); /* use default urng */ par->urng_aux = NULL; /* no auxilliary URNG required */ par->debug = _unur_default_debugflag; /* set default debugging flags */ /* routine for starting generator */ par->init = _unur_unif_init; return par; } /* end of unur_unif_new() */ /*****************************************************************************/ /** Private **/ /*****************************************************************************/ struct unur_gen * _unur_unif_init( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* initialize new generator */ /* */ /* parameters: */ /* params pointer to paramters for building generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); /* check input */ if ( par->method != UNUR_METH_UNIF ) { _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); return NULL; } COOKIE_CHECK(par,CK_UNIF_PAR,NULL); /* create a new empty generator object */ gen = _unur_unif_create(par); /* free parameters */ _unur_par_free(par); return gen; } /* end of _unur_unif_init() */ /*---------------------------------------------------------------------------*/ int _unur_unif_reinit( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* re-initialize (existing) generator. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* (re)set sampling routine */ SAMPLE = _unur_unif_getSAMPLE(gen); /* nothing sensible to do */ return UNUR_SUCCESS; } /* end of _unur_utdr_reinit() */ /*---------------------------------------------------------------------------*/ static struct unur_gen * _unur_unif_create( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* allocate memory for generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* pointer to (empty) generator object with default settings */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_UNIF_PAR,NULL); /* create new generic generator object */ gen = _unur_generic_create( par, sizeof(struct unur_unif_gen) ); /* magic cookies */ COOKIE_SET(gen,CK_UNIF_GEN); /* set generator identifier */ gen->genid = _unur_set_genid(GENTYPE); /* routines for sampling and destroying generator */ SAMPLE = _unur_unif_getSAMPLE(gen); gen->destroy = _unur_unif_free; gen->clone = _unur_unif_clone; gen->reinit = _unur_unif_reinit; #ifdef UNUR_ENABLE_INFO /* set function for creating info string */ gen->info = _unur_unif_info; #endif /* return pointer to (almost empty) generator object */ return gen; } /* end of _unur_unif_create() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_unif_clone( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* copy (clone) generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to clone of generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *clone; /* check arguments */ CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_UNIF_GEN,NULL); /* create generic clone */ clone = _unur_generic_clone( gen, GENTYPE ); return clone; } /* end of _unur_unif_clone() */ /*---------------------------------------------------------------------------*/ void _unur_unif_free( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* deallocate generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { /* check arguments */ if( !gen ) /* nothing to do */ return; /* check input */ if ( gen->method != UNUR_METH_UNIF ) { _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); return; } COOKIE_CHECK(gen,CK_UNIF_GEN,RETURN_VOID); /* we cannot use this generator object any more */ SAMPLE = NULL; /* make sure to show up a programming error */ /* free memory */ _unur_generic_free(gen); } /* end of _unur_unif_free() */ /*****************************************************************************/ double _unur_unif_sample( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_UNIF_GEN,UNUR_INFINITY); /* sample uniform random number */ return _unur_call_urng(gen->urng); } /* end of _unur_unif_sample() */ /*****************************************************************************/ /** Auxilliary Routines **/ /*****************************************************************************/ /*****************************************************************************/ /** Debugging utilities **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ /** None **/ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_INFO /*---------------------------------------------------------------------------*/ void _unur_unif_info( struct unur_gen *gen, int help ) /*----------------------------------------------------------------------*/ /* create character string that contains information about the */ /* given generator object. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* help ... whether to print additional comments */ /*----------------------------------------------------------------------*/ { struct unur_string *info = gen->infostr; /* generator ID */ _unur_string_append(info,"generator ID: %s\n\n", gen->genid); /* distribution */ _unur_string_append(info,"distribution: uniform (0,1)\n\n"); /* method */ _unur_string_append(info,"method: UNIF (wrapper for UNIForm random number generator)\n\n"); /* Hints */ if (help) { _unur_string_append(info,"[Remark: allows using uniform random number generator in UNU.RAN framework]\n"); } } /* end of _unur_unif_info() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_INFO */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/ninv_newset.ch0000644001357500135600000006554514420445767015176 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: ninv_newset.ch * * * * Routines for creating and changing parameter objects. * * * ***************************************************************************** * * * Copyright (c) 2000-2009 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * *****************************************************************************/ /*****************************************************************************/ /** Public: User Interface (API) **/ /*****************************************************************************/ struct unur_par * unur_ninv_new( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get default parameters */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* default parameters (pointer to structure) */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_par *par; /* check arguments */ _unur_check_NULL( GENTYPE,distr,NULL ); /* check distribution */ if (distr->type != UNUR_DISTR_CONT) { _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } COOKIE_CHECK(distr,CK_DISTR_CONT,NULL); if (DISTR_IN.cdf == NULL) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"CDF"); return NULL; } /* if default variant is Newton's method, then we also need the PDF ! */ /* allocate structure */ par = _unur_par_new( sizeof(struct unur_ninv_par) ); COOKIE_SET(par,CK_NINV_PAR); /* copy input */ par->distr = distr; /* pointer to distribution object */ /* set default values */ PAR->max_iter = 100; /* maximal number of iterations */ PAR->x_resolution = 1.0e-8; /* maximal tolerated relative x-error */ PAR->u_resolution = -1.; /* maximal tolerated u-error -- DISABLED */ /* starting points for numerical inversion */ PAR->s[0] = 0.0; /* regula falsi: left boundary of starting interval newton: starting point */ PAR->s[1] = 0.0; /* regula falsi: right boundary of starting interval newton: not used */ /* If s1 and s2 are equal a defaults are used, see below */ PAR->table_on = FALSE; /* Do not use a table for starting points by default. */ par->method = UNUR_METH_NINV; /* method and default variant */ par->variant = NINV_VARFLAG_REGULA; /* Use regula falsi as default method */ par->set = 0u; /* inidicate default parameters */ par->urng = unur_get_default_urng(); /* use default urng */ par->urng_aux = NULL; /* no auxilliary URNG required */ par->debug = _unur_default_debugflag; /* set default debugging flags */ /* routine for starting generator */ par->init = _unur_ninv_init; return par; } /* end of unur_ninv_new() */ /*****************************************************************************/ int unur_ninv_set_usenewton( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* use Newton's method */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, NINV ); /* check new parameter for generator */ if (! par->DISTR_IN.pdf) { _unur_warning(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PDF"); par->variant = NINV_VARFLAG_REGULA; /* use regula falsi instead */ return UNUR_ERR_DISTR_REQUIRED; } /* store date */ par->variant = NINV_VARFLAG_NEWTON; return UNUR_SUCCESS; } /* end of unur_ninv_set_usenewton() */ /*---------------------------------------------------------------------------*/ int unur_ninv_set_useregula( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* use regula falsi */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, NINV ); /* store date */ par->variant = NINV_VARFLAG_REGULA; return UNUR_SUCCESS; } /* end of unur_ninv_set_useregula() */ /*---------------------------------------------------------------------------*/ int unur_ninv_set_usebisect( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* use bisection method */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, NINV ); /* store date */ par->variant = NINV_VARFLAG_BISECT; return UNUR_SUCCESS; } /* end of unur_ninv_set_usebisect() */ /*---------------------------------------------------------------------------*/ int unur_ninv_set_max_iter( struct unur_par *par, int max_iter ) /*----------------------------------------------------------------------*/ /* set number of maximal iterations */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* max_iter ... number of maximal iterations */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, NINV ); /* check new parameter for generator */ if (max_iter < 1) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"maximal iterations"); return UNUR_ERR_PAR_SET; } /* store date */ PAR->max_iter = max_iter; /* changelog */ par->set |= NINV_SET_MAX_ITER; return UNUR_SUCCESS; } /* end of unur_ninv_set_max_iter() */ /*---------------------------------------------------------------------------*/ int unur_ninv_chg_max_iter( struct unur_gen *gen, int max_iter ) /*----------------------------------------------------------------------*/ /* change number of maximal iterations */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* max_iter ... number of maximal iterations */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ CHECK_NULL(gen, UNUR_ERR_NULL); _unur_check_gen_object( gen, NINV, UNUR_ERR_GEN_INVALID ); /* check new parameter for generator */ if (max_iter < 1) { _unur_warning(gen->genid, UNUR_ERR_PAR_SET, "maximal iterations"); return UNUR_ERR_PAR_SET; } /* store date */ GEN->max_iter = max_iter; /* changelog */ gen->set |= NINV_SET_MAX_ITER; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_ninv_chg_max_iter() */ /*---------------------------------------------------------------------------*/ int unur_ninv_set_x_resolution( struct unur_par *par, double x_resolution ) /*----------------------------------------------------------------------*/ /* set maximal tolerated relative x-error */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object*/ /* x_resolution ... x-error */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, NINV ); /* check new parameter for generator */ if (x_resolution > 0. && x_resolution < 2.*DBL_EPSILON) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"x-resolution too small"); x_resolution = 2.*DBL_EPSILON; } /* store date */ PAR->x_resolution = x_resolution; /* changelog */ par->set |= NINV_SET_X_RESOLUTION; return UNUR_SUCCESS; } /* end of unur_ninv_set_x_resolutuion() */ /*---------------------------------------------------------------------------*/ int unur_ninv_chg_x_resolution( struct unur_gen *gen, double x_resolution ) /*----------------------------------------------------------------------*/ /* set maximal tolerated relative x-error */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* x_resolution ... x-error */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ CHECK_NULL(gen, UNUR_ERR_NULL); _unur_check_gen_object( gen, NINV, UNUR_ERR_GEN_INVALID ); /* check new parameter for generator */ if (x_resolution > 0. && x_resolution < DBL_EPSILON) { _unur_warning(gen->genid,UNUR_ERR_PAR_SET,"x-resolution too small"); x_resolution = 2.*DBL_EPSILON; } /* store date */ GEN->x_resolution = x_resolution; /* changelog */ gen->set |= NINV_SET_X_RESOLUTION; return UNUR_SUCCESS; } /* end of unur_ninv_chg_x_resolutuion() */ /*---------------------------------------------------------------------------*/ int unur_ninv_set_u_resolution( struct unur_par *par, double u_resolution ) /*----------------------------------------------------------------------*/ /* set maximal tolerated u-error */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object*/ /* u_resolution ... u-error */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, NINV ); /* check new parameter for generator */ if (u_resolution > 0. && u_resolution < 5*DBL_EPSILON) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"u-resolution too small"); u_resolution = 1.e-15; } /* store date */ PAR->u_resolution = u_resolution; /* changelog */ par->set |= NINV_SET_U_RESOLUTION; return UNUR_SUCCESS; } /* end of unur_ninv_set_u_resolutuion() */ /*---------------------------------------------------------------------------*/ int unur_ninv_chg_u_resolution( struct unur_gen *gen, double u_resolution ) /*----------------------------------------------------------------------*/ /* set maximal tolerated u-error */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* u_resolution ... u-error */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ CHECK_NULL(gen, UNUR_ERR_NULL); _unur_check_gen_object( gen, NINV, UNUR_ERR_GEN_INVALID ); /* check new parameter for generator */ if (u_resolution > 0. && u_resolution < 5*DBL_EPSILON) { _unur_warning(gen->genid,UNUR_ERR_PAR_SET,"u-resolution too small"); u_resolution = 1.e-15; } /* store date */ GEN->u_resolution = u_resolution; /* changelog */ gen->set |= NINV_SET_U_RESOLUTION; return UNUR_SUCCESS; } /* end of unur_ninv_chg_u_resolutuion() */ /*---------------------------------------------------------------------------*/ int unur_ninv_set_start( struct unur_par *par, double s1, double s2 ) /*----------------------------------------------------------------------*/ /* set starting points. */ /* Newton: s1 starting point */ /* other methods: s1, s2 boundary of starting interval */ /* arguments that are not used by method are ignored. */ /* */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* s1 ... left starting point */ /* s2 ... right starting point */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, NINV ); /* store date */ if ( s1 <= s2 ) { PAR->s[0] = s1; PAR->s[1] = s2; } else { PAR->s[0] = s2; PAR->s[1] = s1; } /* changelog */ par->set |= NINV_SET_START; return UNUR_SUCCESS; } /* end of unur_ninv_set_start() */ /*---------------------------------------------------------------------------*/ int unur_ninv_chg_start( struct unur_gen *gen, double s1, double s2 ) /*----------------------------------------------------------------------*/ /* set starting points. */ /* Newton: s1 starting point */ /* regular falsi: s1, s2 boundary of starting interval */ /* arguments that are used by method are ignored. */ /* */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* s1 ... left starting point */ /* s2 ... right starting point */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ CHECK_NULL(gen, UNUR_ERR_NULL); _unur_check_gen_object( gen, NINV, UNUR_ERR_GEN_INVALID ); /* store date */ if ( s1 <= s2 ) { GEN->s[0] = s1; GEN->s[1] = s2; } else { GEN->s[0] = s2; GEN->s[1] = s1; } /* disable table (we now want to use only two starting points) */ GEN->table_on = FALSE; /* compute these points */ _unur_ninv_compute_start(gen); /* this call should not fail */ /* changelog */ gen->set |= NINV_SET_START; return UNUR_SUCCESS; } /* end of unur_ninv_chg_start() */ /*---------------------------------------------------------------------------*/ int unur_ninv_set_table( struct unur_par *par, int tbl_pnts ) /*----------------------------------------------------------------------*/ /* if used, a table is generated to find better startig points */ /* the function unur_ninv_set_start() is overruled */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* tbl_pnts ... number of table points */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, NINV ); PAR->table_size = (tbl_pnts >= 10) ? tbl_pnts : 10; PAR->table_on = TRUE; return UNUR_SUCCESS; } /* end of unur_ninv_set_table() */ /*---------------------------------------------------------------------------*/ int unur_ninv_chg_table( struct unur_gen *gen, int tbl_pnts ) /*----------------------------------------------------------------------*/ /* if used, a table is generated to find better startig points */ /* set somewhere else will be ignored */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* tbl_pnts ... number of table points */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int result; /* check arguments */ CHECK_NULL(gen, UNUR_ERR_NULL); _unur_check_gen_object( gen, NINV, UNUR_ERR_GEN_INVALID ); /* free(GEN->table); not freed, because realloc() is used */ /* free(GEN->f_table); not freed, because realloc() is used */ GEN->table_size = (tbl_pnts >= 10) ? tbl_pnts : 10; result = _unur_ninv_create_table(gen); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug & NINV_DEBUG_CHG) if (result==UNUR_SUCCESS) _unur_ninv_debug_start( gen ); #endif return result; } /* end of unur_ninv_chg_table() */ /*---------------------------------------------------------------------------*/ int unur_ninv_chg_truncated( struct unur_gen *gen, double left, double right ) /*----------------------------------------------------------------------*/ /* change the left and right borders of the domain of the distribution */ /* the new domain should not exceed the original domain given by */ /* unur_distr_cont_set_domain(). Otherwise it is truncated. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* left ... left boundary point */ /* right ... right boundary point */ /* */ /* comment: */ /* the new boundary points may be +/- UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { double Umin, Umax; /* check arguments */ CHECK_NULL(gen, UNUR_ERR_NULL); _unur_check_gen_object( gen, NINV, UNUR_ERR_GEN_INVALID ); /* check new parameter for generator */ /* (the truncated domain must be a subset of the domain) */ if (left < DISTR.domain[0]) { _unur_warning(NULL,UNUR_ERR_DISTR_SET,"truncated domain too large"); left = DISTR.domain[0]; } if (right > DISTR.domain[1]) { _unur_warning(NULL,UNUR_ERR_DISTR_SET,"truncated domain too large"); right = DISTR.domain[1]; } if (left >= right) { _unur_warning(NULL,UNUR_ERR_DISTR_SET,"domain, left >= right"); return UNUR_ERR_DISTR_SET; } /* set bounds of U -- in respect to given bounds */ Umin = (left > -UNUR_INFINITY) ? CDF(left) : 0.; Umax = (right < UNUR_INFINITY) ? CDF(right) : 1.; /* check result */ if (Umin > Umax) { /* this is a serios error that should not happen */ _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); return UNUR_ERR_SHOULD_NOT_HAPPEN; } if (_unur_FP_equal(Umin,Umax)) { /* CDF values very close */ _unur_warning(gen->genid,UNUR_ERR_DISTR_SET,"CDF values very close"); if (_unur_iszero(Umin) || _unur_FP_same(Umax,1.)) { /* this is very bad */ _unur_warning(gen->genid,UNUR_ERR_DISTR_SET,"CDF values at boundary points too close"); return UNUR_ERR_DISTR_SET; } } /* copy new boundaries into generator object */ DISTR.trunc[0] = left; DISTR.trunc[1] = right; GEN->Umin = Umin; GEN->Umax = Umax; /* changelog */ gen->distr->set |= UNUR_DISTR_SET_TRUNCATED; #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug & NINV_DEBUG_CHG) _unur_ninv_debug_chg_truncated( gen ); #endif /* o.k. */ return UNUR_SUCCESS; } /* end of unur_ninv_chg_truncated() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/hinv_struct.h0000644001357500135600000001437714420304141015015 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: hinv_struct.h * * * * PURPOSE: * * declares structures for method HINV * * (Hermite interpolation based INVersion of CDF) * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Information for constructing the generator */ struct unur_hinv_par { int order; /* order of interpolating polynomial */ double u_resolution; /* maximal error in u */ double guide_factor; /* relative size of guide table */ double bleft; /* left border of the computational domain */ double bright; /* right border of the computational domain */ const double *stp; /* pointer to array of starting points */ int n_stp; /* number of construction points at start */ int max_ivs; /* maximum number of intervals */ }; /*---------------------------------------------------------------------------*/ /* store information about splines */ #define UNUR_HINV_MAX_ORDER (5) struct unur_hinv_interval { double spline[UNUR_HINV_MAX_ORDER+1]; /* coefficients of spline */ double p; /* left design point (node) in interval */ double u; /* CDF at node p (u=CDF(p)) */ double f; /* PDF at node p (u=CDF(p)) */ double df; /* derivative of PDF at node p (u=CDF(p)) */ struct unur_hinv_interval *next; /* pointer to next element in list */ #ifdef UNUR_COOKIES unsigned cookie; /* magic cookie */ #endif }; /*---------------------------------------------------------------------------*/ /* The generator object */ struct unur_hinv_gen { int order; /* order of interpolating polynomial */ int N; /* total number of division points = #intervals+1 */ double *intervals; /* pointer to array for storing data for intervals in blocks of size order+2: [0] ... u_{i-1} = CDF at left design point [1] ... p_{i-1} = left design point = spline[0] [2]-[order+1] ... spline[1] - spline[order] size of the array = N * (2+order) */ int *guide; /* pointer to guide table */ int guide_size; /* size of guide table */ double guide_factor; /* relative size of guide table */ double Umin, Umax; /* bounds for iid random variable in respect to the given (truncated) domain of the distr. */ double CDFmin, CDFmax; /* CDF-bounds of domain */ double u_resolution; /* maximal error in u */ double bleft; /* left border of the computational domain */ double bright; /* right border of the computational domain */ struct unur_hinv_interval *iv; /* linked list of splines (only used in setup) */ double tailcutoff_left; /* cut point for left hand tail (u-value) */ double tailcutoff_right;/* cut point for right hand tail (u-value) */ int max_ivs; /* maximum number of intervals */ const double *stp; /* pointer to array of starting points */ int n_stp; /* number of construction points at start */ double bleft_par; /* border of the computational domain as ... */ double bright_par; /* ... given by user */ }; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/arou.c0000644001357500135600000036520114420445767013425 00000000000000/***************************************************************************** * * * unuran -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: arou.h * * * * TYPE: continuous univariate random variate * * METHOD: ratio-of-uniforms with enveloping polygon * * * * DESCRIPTION: * * Given PDF of a T-concave distribution; * * produce a value x consistent with its density * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * ***************************************************************************** * * * REFERENCES: * * [1] Leydold J. (2000): Automatic Sampling with the ratio-of-uniforms * * method, ACM TOMS, forthcoming * * * * [2] Kinderman, A.J. and Monahan, F.J. (1977): Computer generation of * * random variables using the ratio of uniform deviates, * * ACM Trans. Math. Software 3(3), pp. 257--260. * * * ***************************************************************************** * * * The ratio-of-uniforms method introduced in [2] is a flexible method that * * is based on the following theorem: * * * * THEOREM: * * Let X be a random variable with density function f(x) = g(x) / G, * * where g(x) is a positive integrable function with support (x_0,x_1) * * not necessarily finite and G = integral g(x) dx. * * If (V,U) is uniformly distributed in * * A = {(v,u): 0 < u <= sqrt(g(v/u)), x_0 < v/u < x_1}, * * then X = V/U has probability density function f(x). * * * * Generating point (V,U) uniformly distributed in A is done by rejection * * from an enveloping region, usually from the minimal bounding rectangle. * * * * The implemented algorithm uses the fact, that for many distribtions, * * A is convex. Then we easily can construct an enveloping polygon by means * * of tangent lines and a squeeze region by means of secants. * * The resulting algorithm is very fast, since we can sample from the * * squeeze region with immedate acceptance (thus only one uniform random * * number is necessary). The region between envelope and squeeze consists * * of triangles and can be made arbitrarily small (see [1] for details). * * * * Distributions with a convex set A are characterized by the following * * theorem that shows a connection to transformed density rejection TDR. * * * * THEOREM: * * A is convex if and only if g is T-concave with transformation * * T(x) = -1/sqrt(x), i.e., -1/sqrt(g(x)) is a concave function. * * * *...........................................................................* * * * The region A is divided into segments, that contain the origin. Each * * segments consist of an inner triangle (the squeeze region) and the * * outer triangle (the region between envelope and squeeze). We have to * * compute the areas of these triangles. * * * * To generate from the distribution we have to sample from a discrete * * random variate with probability vector proportional to these areas to get * * one of these triangles (inner or outer). We use indexed search (or guide * * tables) to perform this task ([1], see also description of DIS). * * When we have an inner triangle (squeeze), we reuse the uniform random * * variate to get a point (v,u) uniformly distributed on the edge opposite * * to the origin and return the ratio x = v/u (Thus generation from the * * squeeze region is equivalent to the inversion method.) * * When whe have an outer triangle, we have to sample a point (v,u) * * uniformly distributed in this triangle. If u <= g(v/u) then return the * * ratio x = v/u, otherwise reject. * * * *...........................................................................* * * * Algorithm AROU * * * * [Required] * * PDF f(x), construction points c_1,...,c_n * * * * [Setup] * * 1: Construct inner triangles S_i^s and outer triangles S_i^o * * 2: Foreach triangle Do * * 3: Compute respective areas A_i^s and A_i^o. * * * * [Generate] * * 4: Generate I proportional to (A_1^s, A_1^o; A_2^s, A_2^o; ...). * * 5: If inner triangle S_i^s Then * * 6: Compute point (v,u) on edge (Reuse u.r.n. from 4). * * 7: Return v/u. * * 8: Else * * 9: Generate point (V,U) uniformly distributed in outer triangle S_i^o.* * 10: If u <= f(v/u) Return V/U. * * 11: Goto 4. * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include "unur_methods_source.h" #include "x_gen_source.h" #include "arou.h" #include "arou_struct.h" /*---------------------------------------------------------------------------*/ /* Variants */ #define AROU_VARFLAG_VERIFY 0x01u /* flag for verifying mode */ #define AROU_VARFLAG_USECENTER 0x02u /* flag whether center is used as cpoint or not */ #define AROU_VARFLAG_PEDANTIC 0x04u /* whether pedantic checking is used */ #define AROU_VARFLAG_USEDARS 0x10u /* whether DARS is used in setup or not */ /*---------------------------------------------------------------------------*/ /* Debugging flags */ /* bit 01 ... pameters and structure of generator (do not use here) */ /* bits 02-12 ... setup */ /* bits 13-24 ... adaptive steps */ /* bits 25-32 ... trace sampling */ #define AROU_DEBUG_SEGMENTS 0x00000010u /* print list of segments */ #define AROU_DEBUG_SPLIT 0x00010000u /* trace splitting of segments */ #define AROU_DEBUG_DARS 0x00020000u /*---------------------------------------------------------------------------*/ /* Flags for logging set calls */ #define AROU_SET_CENTER 0x001u #define AROU_SET_STP 0x002u #define AROU_SET_N_STP 0x004u #define AROU_SET_GUIDEFACTOR 0x010u #define AROU_SET_MAX_SQHRATIO 0x020u #define AROU_SET_MAX_SEGS 0x040u #define AROU_SET_USE_DARS 0x100u #define AROU_SET_DARS_FACTOR 0x200u /*---------------------------------------------------------------------------*/ #define GENTYPE "AROU" /* type of generator */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_arou_init( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* Initialize new generator. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_arou_create( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* create new (almost empty) generator object. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_arou_clone( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* copy (clone) generator object. */ /*---------------------------------------------------------------------------*/ static void _unur_arou_free( struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* destroy generator object. */ /*---------------------------------------------------------------------------*/ static double _unur_arou_sample( struct unur_gen *gen ); static double _unur_arou_sample_check( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* sample from generator */ /*---------------------------------------------------------------------------*/ static int _unur_arou_get_starting_cpoints( struct unur_par *par, struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* create list of construction points for starting segments. */ /* if user has not provided such points compute these by means of the */ /* "equi-angle rule". */ /*---------------------------------------------------------------------------*/ static int _unur_arou_get_starting_segments( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* compute segments from given starting construction points. */ /*---------------------------------------------------------------------------*/ static double _unur_arou_compute_x( double v, double u ); /*---------------------------------------------------------------------------*/ /* compute point x from (v,u) tuple. */ /*---------------------------------------------------------------------------*/ static int _unur_arou_run_dars( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* run derandomized adaptive rejection sampling. */ /*---------------------------------------------------------------------------*/ static struct unur_arou_segment *_unur_arou_segment_new( struct unur_gen *gen, double x, double fx ); /*---------------------------------------------------------------------------*/ /* make a new segment with left construction point x = v/u. */ /*---------------------------------------------------------------------------*/ static int _unur_arou_segment_parameter( struct unur_gen *gen, struct unur_arou_segment *seg ); /*---------------------------------------------------------------------------*/ /* compute all necessary data for segment. */ /* return: */ /* UNUR_SUCCESS ... on success */ /* UNUR_ERR_SILENT ... do not add this construction point */ /* UNUR_ERR_INF ... if area = UNUR_INFINITY */ /* other error code ... error (PDF not T-concave) */ /*---------------------------------------------------------------------------*/ static int _unur_arou_segment_split( struct unur_gen *gen, struct unur_arou_segment *seg_old, double x, double fx ); /*---------------------------------------------------------------------------*/ /* split a segment at point (direction) x. */ /*---------------------------------------------------------------------------*/ static int _unur_arou_make_guide_table( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* make a guide table for indexed search. */ /*---------------------------------------------------------------------------*/ static double _unur_arou_segment_arcmean( struct unur_arou_segment *seg ); /*---------------------------------------------------------------------------*/ /* compute the "arcmean" of the two construction points of a segement. */ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ /* the following functions print debugging information on output stream, */ /* i.e., into the LOG file if not specified otherwise. */ /*---------------------------------------------------------------------------*/ static void _unur_arou_debug_init( const struct unur_par *par, const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print after generator has been initialized has completed. */ /*---------------------------------------------------------------------------*/ static void _unur_arou_debug_dars_start( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print header before runniung derandomized adaptive rejection sampling. */ /*---------------------------------------------------------------------------*/ static void _unur_arou_debug_dars( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print after generator has run derandomized adaptive rejection sampling. */ /*---------------------------------------------------------------------------*/ static void _unur_arou_debug_free( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print before generater is destroyed. */ /*---------------------------------------------------------------------------*/ static void _unur_arou_debug_segments( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print data for segments. */ /*---------------------------------------------------------------------------*/ static void _unur_arou_debug_split_start( const struct unur_gen *gen, const struct unur_arou_segment *seg, double x, double fx ); static void _unur_arou_debug_split_stop( const struct unur_gen *gen, const struct unur_arou_segment *seg_left, const struct unur_arou_segment *seg_right ); /*---------------------------------------------------------------------------*/ /* print before and after a segment has been split (not / successfully). */ /*---------------------------------------------------------------------------*/ #endif #ifdef UNUR_ENABLE_INFO static void _unur_arou_info( struct unur_gen *gen, int help ); /*---------------------------------------------------------------------------*/ /* create info string. */ /*---------------------------------------------------------------------------*/ #endif /*---------------------------------------------------------------------------*/ /* abbreviations */ #define DISTR_IN distr->data.cont /* data for distribution object */ #define PAR ((struct unur_arou_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_arou_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.cont /* data for distribution in generator object */ #define BD_LEFT domain[0] /* left boundary of domain of distribution */ #define BD_RIGHT domain[1] /* right boundary of domain of distribution */ #define SAMPLE gen->sample.cont /* pointer to sampling routine */ #define PDF(x) _unur_cont_PDF((x),(gen->distr)) /* call to PDF */ #define dPDF(x) _unur_cont_dPDF((x),(gen->distr)) /* call to derivative of PDF */ /*---------------------------------------------------------------------------*/ #define _unur_arou_getSAMPLE(gen) \ ( ((gen)->variant & AROU_VARFLAG_VERIFY) \ ? _unur_arou_sample_check : _unur_arou_sample ) /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Public: User Interface (API) **/ /*****************************************************************************/ struct unur_par * unur_arou_new( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get default parameters */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* default parameters (pointer to structure) */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_par *par; /* check arguments */ _unur_check_NULL(GENTYPE,distr,NULL); /* check distribution */ if (distr->type != UNUR_DISTR_CONT) { _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } COOKIE_CHECK(distr,CK_DISTR_CONT,NULL); if (DISTR_IN.pdf == NULL) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PDF"); return NULL; } if (DISTR_IN.dpdf == NULL) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"derivative of PDF"); return NULL; } /* allocate structure */ par = _unur_par_new( sizeof(struct unur_arou_par) ); COOKIE_SET(par,CK_AROU_PAR); /* copy input */ par->distr = distr; /* pointer to distribution object */ /* set default values */ PAR->guide_factor = 2.; /* size of guide table / number of intervals */ PAR->darsfactor = 0.99; /* factor for (derandomized) ARS. do not add a new construction point in a segment, where abiguous region is too small, i.e. if area / (|S^e\S^s|/number of segments) < darsfactor */ PAR->starting_cpoints = NULL; /* pointer to array of starting points */ PAR->n_starting_cpoints = 30; /* number of starting points */ PAR->max_segs = 100; /* maximum number of segments */ PAR->max_ratio = 0.99; /* do not add construction points if ratio r_n = |P^s| / |P^e| > max_ratio */ par->method = UNUR_METH_AROU; /* method */ par->variant = ( AROU_VARFLAG_USECENTER | AROU_VARFLAG_USEDARS ); /* default variant */ par->set = 0u; /* inidicate default parameters */ par->urng = unur_get_default_urng(); /* use default urng */ par->urng_aux = par->urng; /* no special auxilliary URNG */ par->debug = _unur_default_debugflag; /* set default debugging flags */ /* routine for starting generator */ par->init = _unur_arou_init; return par; } /* end of unur_arou_new() */ /*****************************************************************************/ int unur_arou_set_usedars( struct unur_par *par, int usedars ) /*----------------------------------------------------------------------*/ /* set flag for using DARS (derandomized adaptive rejection sampling). */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* usedars ... 0 = do not use, !0 = use DARS */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* using not using DARS is the default */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); /* check input */ _unur_check_par_object( par, AROU ); /* we use a bit in variant */ par->variant = (usedars) ? (par->variant | AROU_VARFLAG_USEDARS) : (par->variant & (~AROU_VARFLAG_USEDARS)); /* changelog */ par->set |= AROU_SET_USE_DARS; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_arou_set_usedars() */ /*---------------------------------------------------------------------------*/ int unur_arou_set_darsfactor( struct unur_par *par, double factor ) /*----------------------------------------------------------------------*/ /* set factor for derandomized adaptive rejection sampling */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* factor ... parameter for DARS */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); /* check input */ _unur_check_par_object( par, AROU ); /* check new parameter for generator */ if (factor < 0.) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"DARS factor < 0"); return UNUR_ERR_PAR_SET; } /* store date */ PAR->darsfactor = factor; /* changelog */ par->set |= AROU_SET_DARS_FACTOR; return UNUR_SUCCESS; } /* end of unur_arou_set_darsfactor() */ /*---------------------------------------------------------------------------*/ int unur_arou_set_cpoints( struct unur_par *par, int n_stp, const double *stp ) /*----------------------------------------------------------------------*/ /* set construction points for envelope */ /* and/or its number for initialization */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* n_stp ... number of starting points */ /* stp ... pointer to array of starting points */ /* (NULL for changing only the number of default points) */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int i; /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); /* check input */ _unur_check_par_object( par, AROU ); /* check starting construction points */ /* we always use the boundary points as additional starting points, so we do not count these here! */ if (n_stp < 0 ) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"number of starting points < 0"); return UNUR_ERR_PAR_SET; } if (stp) /* starting points must be strictly monontonically increasing */ for( i=1; istarting_cpoints = stp; PAR->n_starting_cpoints = n_stp; /* changelog */ par->set |= AROU_SET_N_STP | ((stp) ? AROU_SET_STP : 0); return UNUR_SUCCESS; } /* end of unur_arou_set_cpoints() */ /*---------------------------------------------------------------------------*/ int unur_arou_set_guidefactor( struct unur_par *par, double factor ) /*----------------------------------------------------------------------*/ /* set factor for relative size of guide table */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* factor ... relative size of table */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); /* check input */ _unur_check_par_object( par, AROU ); /* check new parameter for generator */ if (factor < 0) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"guide table size < 0"); return UNUR_ERR_PAR_SET; } /* store date */ PAR->guide_factor = factor; /* changelog */ par->set |= AROU_SET_GUIDEFACTOR; return UNUR_SUCCESS; } /* end of unur_arou_set_guidefactor() */ /*---------------------------------------------------------------------------*/ int unur_arou_set_max_sqhratio( struct unur_par *par, double max_ratio ) /*----------------------------------------------------------------------*/ /* set bound for ratio A(squeeze) / A(hat) */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* max_ratio ... upper bound for ratio to add a new construction point*/ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); /* check input */ _unur_check_par_object( par, AROU ); /* check new parameter for generator */ if (max_ratio < 0. || max_ratio > 1. ) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"ratio A(squeeze)/A(hat) not in [0,1]"); return UNUR_ERR_PAR_SET; } /* store date */ PAR->max_ratio = max_ratio; /* changelog */ par->set |= AROU_SET_MAX_SQHRATIO; return UNUR_SUCCESS; } /* end of unur_arou_set_max_sqhratio() */ /*---------------------------------------------------------------------------*/ double unur_arou_get_sqhratio( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* get ratio A(squeeze) / A(hat) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* ratio ... on success */ /* UNUR_INFINITY ... on error */ /*----------------------------------------------------------------------*/ { /* check input */ _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); _unur_check_gen_object( gen, AROU, UNUR_INFINITY ); return (GEN->Asqueeze / GEN->Atotal); } /* end of unur_arou_get_sqhratio() */ /*---------------------------------------------------------------------------*/ double unur_arou_get_hatarea( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* get area below hat */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* area ... on success */ /* UNUR_INFINITY ... on error */ /*----------------------------------------------------------------------*/ { /* check input */ _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); _unur_check_gen_object( gen, AROU, UNUR_INFINITY ); return GEN->Atotal; } /* end of unur_arou_get_hatarea() */ /*---------------------------------------------------------------------------*/ double unur_arou_get_squeezearea( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* get area below squeeze */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* area ... on success */ /* UNUR_INFINITY ... on error */ /*----------------------------------------------------------------------*/ { /* check input */ _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); _unur_check_gen_object( gen, AROU, UNUR_INFINITY ); return GEN->Asqueeze; } /* end of unur_arou_get_squeezearea() */ /*---------------------------------------------------------------------------*/ int unur_arou_set_max_segments( struct unur_par *par, int max_segs ) /*----------------------------------------------------------------------*/ /* set maximum number of segments */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* max_segs ... maximum number of segments */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); /* check input */ _unur_check_par_object( par, AROU ); /* check new parameter for generator */ if (max_segs < 1 ) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"maximum number of segments < 1"); return UNUR_ERR_PAR_SET; } /* store date */ PAR->max_segs = max_segs; /* changelog */ par->set |= AROU_SET_MAX_SEGS; return UNUR_SUCCESS; } /* end of unur_arou_set_max_segments() */ /*---------------------------------------------------------------------------*/ int unur_arou_set_usecenter( struct unur_par *par, int usecenter ) /*----------------------------------------------------------------------*/ /* set flag for using center as construction point */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* usecenter ... 0 = do not use, !0 = use */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* using center as construction point is the default */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); /* check input */ _unur_check_par_object( par, AROU ); /* we use a bit in variant */ par->variant = (usecenter) ? (par->variant | AROU_VARFLAG_USECENTER) : (par->variant & (~AROU_VARFLAG_USECENTER)); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_arou_set_usecenter() */ /*---------------------------------------------------------------------------*/ int unur_arou_set_verify( struct unur_par *par, int verify ) /*----------------------------------------------------------------------*/ /* turn verifying of algorithm while sampling on/off */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* verify ... 0 = no verifying, !0 = verifying */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* no verifying is the default */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); /* check input */ _unur_check_par_object( par, AROU ); /* we use a bit in variant */ par->variant = (verify) ? (par->variant | AROU_VARFLAG_VERIFY) : (par->variant & (~AROU_VARFLAG_VERIFY)); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_arou_set_verify() */ /*---------------------------------------------------------------------------*/ int unur_arou_chg_verify( struct unur_gen *gen, int verify ) /*----------------------------------------------------------------------*/ /* turn verifying of algorithm while sampling on/off */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* verify ... 0 = no verifying, !0 = verifying */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* no verifying is the default */ /*----------------------------------------------------------------------*/ { /* check input */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, AROU, UNUR_ERR_GEN_INVALID ); /* we must not change this switch when sampling has been disabled by using a pointer to the error producing routine */ if (SAMPLE == _unur_sample_cont_error) return UNUR_FAILURE; if (verify) /* turn verify mode on */ gen->variant |= AROU_VARFLAG_VERIFY; else /* turn verify mode off */ gen->variant &= ~AROU_VARFLAG_VERIFY; SAMPLE = _unur_arou_getSAMPLE(gen); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_arou_chg_verify() */ /*---------------------------------------------------------------------------*/ int unur_arou_set_pedantic( struct unur_par *par, int pedantic ) /*----------------------------------------------------------------------*/ /* turn pedantic mode on/off */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* pedantic ... 0 = no pedantic mode, !0 = use pedantic mode */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* pedantic is the default */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); /* check input */ _unur_check_par_object( par, AROU ); /* we use a bit in variant */ par->variant = (pedantic) ? (par->variant | AROU_VARFLAG_PEDANTIC) : (par->variant & (~AROU_VARFLAG_PEDANTIC)); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_arou_set_pedantic() */ /*****************************************************************************/ /** Private **/ /*****************************************************************************/ struct unur_gen * _unur_arou_init( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* initialize new generator */ /* */ /* parameters: */ /* par ... pointer to paramters for building generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; int i,k; /* check arguments */ CHECK_NULL(par,NULL); /* check input */ if ( par->method != UNUR_METH_AROU ) { _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); return NULL; } COOKIE_CHECK(par,CK_AROU_PAR,NULL); /* create a new empty generator object */ gen = _unur_arou_create(par); if (!gen) { _unur_par_free(par); return NULL; } /* get starting points */ if (_unur_arou_get_starting_cpoints(par,gen)!=UNUR_SUCCESS ) { #ifdef UNUR_ENABLE_LOGGING if (gen->debug) _unur_arou_debug_init(par,gen); #endif _unur_par_free(par); _unur_arou_free(gen); return NULL; } /* compute segments for given starting points */ if ( _unur_arou_get_starting_segments(gen)!=UNUR_SUCCESS ) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF not T-concave"); #ifdef UNUR_ENABLE_LOGGING if (gen->debug) _unur_arou_debug_init(par,gen); #endif _unur_par_free(par); _unur_arou_free(gen); return NULL; } /* we have to update the maximal number of segments, if the user wants more starting points. */ if (GEN->n_segs > GEN->max_segs) { _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"maximal number of segments too small. increase."); GEN->max_segs = GEN->n_segs; } if (gen->variant & AROU_VARFLAG_USEDARS) { /* run derandomized adaptive rejection sampling (DARS) */ #ifdef UNUR_ENABLE_LOGGING if (gen->debug & AROU_DEBUG_DARS) { /* make initial guide table (only necessary for writing debug info) */ _unur_arou_make_guide_table(gen); /* write info into LOG file */ _unur_arou_debug_init(par,gen); _unur_arou_debug_dars_start(gen); } #endif for (i=0; i<3; i++) { /* we make several tries */ /* run DARS */ if ( _unur_arou_run_dars(gen)!=UNUR_SUCCESS ) { _unur_par_free(par); _unur_arou_free(gen); return NULL; } /* make initial guide table */ _unur_arou_make_guide_table(gen); /* check if DARS was completed */ if (GEN->n_segs < GEN->max_segs) { /* ran ARS instead */ for (k=0; k<5; k++) _unur_sample_cont(gen); } else break; } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) { if (gen->debug & AROU_DEBUG_DARS) _unur_arou_debug_dars(gen); else _unur_arou_debug_init(par,gen); } #endif } else { /* do not run DARS */ /* make initial guide table */ _unur_arou_make_guide_table(gen); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_arou_debug_init(par,gen); #endif } /* free parameters */ _unur_par_free(par); /* is there any envelope at all ? */ if (GEN->Atotal <= 0. || !_unur_isfinite(GEN->Atotal)) { _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"bad construction points"); _unur_arou_free(gen); return NULL; } /* o.k. */ return gen; } /* end of _unur_arou_init() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_arou_create( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* allocate memory for generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* pointer to (empty) generator object with default settings */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_AROU_PAR,NULL); /* create new generic generator object */ gen = _unur_generic_create( par, sizeof(struct unur_arou_gen) ); /* magic cookies */ COOKIE_SET(gen,CK_AROU_GEN); /* set generator identifier */ gen->genid = _unur_set_genid(GENTYPE); /* routines for sampling and destroying generator */ SAMPLE = _unur_arou_getSAMPLE(gen); gen->destroy = _unur_arou_free; gen->clone = _unur_arou_clone; /* set all pointers to NULL */ GEN->seg = NULL; GEN->n_segs = 0; GEN->guide = NULL; GEN->guide_size = 0; GEN->Atotal = 0.; GEN->Asqueeze = 0.; /* copy some parameters into generator object */ GEN->guide_factor = PAR->guide_factor; /* relative size of guide tables */ /* bounds for adding construction points */ GEN->max_segs = PAR->max_segs; /* maximum number of segments */ #ifdef UNUR_ENABLE_INFO GEN->max_segs_info = PAR->max_segs; /* ... for info string */ #endif GEN->max_ratio = PAR->max_ratio; GEN->darsfactor = PAR->darsfactor; /* get center */ if ( (gen->distr->set & UNUR_DISTR_SET_CENTER) || (gen->distr->set & UNUR_DISTR_SET_MODE) ) { GEN->center = unur_distr_cont_get_center(gen->distr); /* center must be in domain */ GEN->center = _unur_max(GEN->center,DISTR.BD_LEFT); GEN->center = _unur_min(GEN->center,DISTR.BD_RIGHT); gen->set |= AROU_SET_CENTER; } else { GEN->center = 0.; /* we cannot use the center as construction point */ gen->variant &= ~AROU_VARFLAG_USECENTER; } #ifdef UNUR_ENABLE_INFO /* set function for creating info string */ gen->info = _unur_arou_info; #endif /* return pointer to (almost empty) generator object */ return(gen); } /* end of _unur_arou_create() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_arou_clone( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* copy (clone) generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to clone of generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { #define CLONE ((struct unur_arou_gen*)clone->datap) struct unur_gen *clone; struct unur_arou_segment *seg,*next, *clone_seg, *clone_prev; /* check arguments */ CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_AROU_GEN,NULL); /* create generic clone */ clone = _unur_generic_clone( gen, GENTYPE ); /* copy linked list of segments */ clone_seg = NULL; clone_prev = NULL; for (seg = GEN->seg; seg != NULL; seg = next) { /* copy segment */ clone_seg = _unur_xmalloc( sizeof(struct unur_arou_segment) ); memcpy( clone_seg, seg, sizeof(struct unur_arou_segment) ); if (clone_prev == NULL) { /* starting point of linked list */ CLONE->seg = clone_seg; } else { /* insert into linked list */ clone_prev->next = clone_seg; clone_prev->rtp = clone_seg->ltp; clone_prev->drtp = clone_seg->dltp; } /* next step */ next = seg->next; clone_prev = clone_seg; } /* terminate linked list */ if (clone_seg) clone_seg->next = NULL; /* make new guide table */ CLONE->guide = NULL; _unur_arou_make_guide_table(clone); /* finished clone */ return clone; #undef CLONE } /* end of _unur_arou_clone() */ /*---------------------------------------------------------------------------*/ void _unur_arou_free( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* deallocate generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { /* check arguments */ if( !gen ) /* nothing to do */ return; /* check input */ if ( gen->method != UNUR_METH_AROU ) { _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); return; } COOKIE_CHECK(gen,CK_AROU_GEN,RETURN_VOID); /* we cannot use this generator object any more */ SAMPLE = NULL; /* make sure to show up a programming error */ /* write info into LOG file */ #ifdef UNUR_ENABLE_LOGGING if (gen->debug) _unur_arou_debug_free(gen); #endif /* free linked list of segments */ { struct unur_arou_segment *seg,*next; for (seg = GEN->seg; seg != NULL; seg = next) { next = seg->next; free(seg); } } /* free other memory not stored in list */ if (GEN->guide) free(GEN->guide); _unur_generic_free(gen); } /* end of _unur_arou_free() */ /*****************************************************************************/ double _unur_arou_sample( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { /** TODO: check uniform random number: u != 0 and u != 1 ?? **/ UNUR_URNG *urng; /* pointer to uniform random number generator */ struct unur_arou_segment *seg; int result_split; double R,R1,R2,R3,tmp,x,fx,u; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_AROU_GEN,UNUR_INFINITY); /* main URNG */ urng = gen->urng; while (1) { /* sample from U(0,1) */ R = _unur_call_urng(urng); /* look up in guide table and search for segment */ seg = GEN->guide[(int) (R * GEN->guide_size)]; R *= GEN->Atotal; while (seg->Acum < R) { seg = seg->next; } COOKIE_CHECK(seg,CK_AROU_SEG,UNUR_INFINITY); /* reuse of uniform random number */ R = seg->Acum - R; /* inside or outside squeeze */ if (R < seg->Ain) { /* inside */ /* reuse of random number. */ /* We can avoid R = (seg->Ain - R) / seg->Ain */ return( ( seg->Ain * seg->rtp[0] + R * (seg->ltp[0] - seg->rtp[0]) ) / ( seg->Ain * seg->rtp[1] + R * (seg->ltp[1] - seg->rtp[1]) ) ); } else { /* outside */ /* from now on we use the auxilliary generator (it can be the same as the main generator) */ urng = gen->urng_aux; /* three uniform random numbers with R1 + R2 + R3 = 1 */ R1 = (R - seg->Ain) / seg->Aout; /* reuse of random number (good ?? ) */ R2 = _unur_call_urng(urng); if (R1>R2) { tmp = R1; R1=R2; R2=tmp; } /* swap */ R3 = 1.-R2; R2 -= R1; /* point (v,u) and ratio x = v/u */ u = seg->ltp[1]*R1 + seg->rtp[1]*R2 + seg->mid[1]*R3; x = (seg->ltp[0]*R1 + seg->rtp[0]*R2 + seg->mid[0]*R3) / u; /* density at x */ fx = PDF(x); /* being outside the squeeze is bad. improve the situation! */ if (GEN->n_segs < GEN->max_segs) { if (GEN->max_ratio * GEN->Atotal > GEN->Asqueeze) { result_split = _unur_arou_segment_split(gen,seg,x,fx); if ( !(result_split == UNUR_SUCCESS || result_split == UNUR_ERR_SILENT) ) { /* condition for PDF is violated! */ _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,""); if (gen->variant & AROU_VARFLAG_PEDANTIC) { /* replace sampling routine by dummy routine that just returns UNUR_INFINITY */ SAMPLE = _unur_sample_cont_error; return UNUR_INFINITY; } } else { /* splitting successful --> update guide table */ _unur_arou_make_guide_table(gen); } } else /* no more construction points (avoid too many second if statements above) */ GEN->max_segs = GEN->n_segs; } /* if inside region of acceptance, return ratio x */ if (u*u <= fx) return x; } } } /* end of _unur_arou_sample() */ /*---------------------------------------------------------------------------*/ double _unur_arou_sample_check( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator and verify that method can be used */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { /** TODO: check uniform random number: u != 0 and u != 1 ?? **/ UNUR_URNG *urng; /* pointer to uniform random number generator */ struct unur_arou_segment *seg; int result_split; double R,R1,R2,R3,tmp,x,fx,u,sqx,a; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_AROU_GEN,UNUR_INFINITY); /* main URNG */ urng = gen->urng; while (1) { /* sample from U(0,1) */ R = _unur_call_urng(urng); /* look up in guide table and search for segment */ seg = GEN->guide[(int) (R * GEN->guide_size)]; R *= GEN->Atotal; while (seg->Acum < R) { seg = seg->next; } COOKIE_CHECK(seg,CK_AROU_SEG,UNUR_INFINITY); /* reuse of uniform random number */ R = seg->Acum - R; /* inside or outside squeeze */ if (R < seg->Ain) { /* inside */ /* reuse of random number. */ /* We can avoid R = (seg->Ain - R) / seg->Ain */ x = ( ( seg->Ain * seg->rtp[0] + R * (seg->ltp[0] - seg->rtp[0]) ) / ( seg->Ain * seg->rtp[1] + R * (seg->ltp[1] - seg->rtp[1]) ) ); /* density at x */ fx = PDF(x); /* compute value of squeeze at x, i.e., we have to solve a*ltp[0] + (1-a)*rtp[0] == a*ltp[1] + (1-a)*rtp[1] */ a = ( (seg->rtp[0] - x * seg->rtp[1]) / (seg->rtp[0] - seg->ltp[0] + x * (seg->ltp[1] - seg->rtp[1])) ); sqx = a * seg->ltp[1] + (1.-a) * seg->rtp[1]; /* test for T-concavity */ if (sqx*sqx > fx * (1.+UNUR_EPSILON)) _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF not T-concave."); return x; } else { /* outside */ /* from now on we use the auxilliary generator (it can be the same as the main generator) */ urng = gen->urng_aux; /* three uniform random numbers with R1 + R2 + R3 = 1 */ R1 = (R - seg->Ain) / seg->Aout; /* reuse of random number (good ?? ) */ R2 = _unur_call_urng(urng); if (R1>R2) { tmp = R1; R1=R2; R2=tmp; } /* swap */ R3 = 1.-R2; R2 -= R1; /* point (v,u) and ratio x = v/u */ u = seg->ltp[1]*R1 + seg->rtp[1]*R2 + seg->mid[1]*R3; x = (seg->ltp[0]*R1 + seg->rtp[0]*R2 + seg->mid[0]*R3) / u; /* density at x */ fx = PDF(x); /* compute value of squeeze at x, i.e., we have to solve a*ltp[0] + (1-a)*rtp[0] == a*ltp[1] + (1-a)*rtp[1] */ a = ( (seg->rtp[0] - x * seg->rtp[1]) / (seg->rtp[0] - seg->ltp[0] + x * (seg->ltp[1] - seg->rtp[1])) ); sqx = a * seg->ltp[1] + (1.-a) * seg->rtp[1]; /* test for T-concavity */ if (sqx*sqx > fx) _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF not T-concave."); /* being outside the squeeze is bad. improve the situation! */ if (GEN->n_segs < GEN->max_segs) { if (GEN->max_ratio * GEN->Atotal > GEN->Asqueeze) { result_split = _unur_arou_segment_split(gen,seg,x,fx); if ( !(result_split == UNUR_SUCCESS || result_split == UNUR_ERR_SILENT) ) { /* condition for PDF is violated! */ _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,""); if (gen->variant & AROU_VARFLAG_PEDANTIC) { /* replace sampling routine by dummy routine that just returns UNUR_INFINITY */ SAMPLE = _unur_sample_cont_error; return UNUR_INFINITY; } } else { /* splitting successful --> update guide table */ _unur_arou_make_guide_table(gen); } } else /* no more construction points (avoid to many second if statement above */ GEN->max_segs = GEN->n_segs; } /* if inside region of acceptance, return ratio x */ if (u*u <= fx) return x; } } } /* end of _unur_arou_sample_check() */ /*****************************************************************************/ /** Auxilliary Routines **/ /*****************************************************************************/ int _unur_arou_get_starting_cpoints( struct unur_par *par, struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* list of construction points for starting segments. */ /* if not provided as arguments compute these */ /* by means of the "equi-angle rule". */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { struct unur_arou_segment *seg, *seg_new; double left_angle, right_angle, diff_angle, angle; double x, x_last, fx, fx_last; int i, use_center, is_increasing; /* is_center,*/ /* check arguments */ CHECK_NULL(par,UNUR_ERR_NULL); COOKIE_CHECK(par,CK_AROU_PAR,UNUR_ERR_COOKIE); CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_AROU_GEN,UNUR_ERR_COOKIE); /* initialize boolean */ /* is_center = FALSE; */ /* use center as construction point ? */ use_center = (gen->variant & AROU_VARFLAG_USECENTER) ? TRUE : FALSE; /* reset counter of segments */ GEN->n_segs = 0; /* prepare for computing construction points */ if (!PAR->starting_cpoints) { /* move center into x = 0 */ /* angles of boundary of domain */ left_angle = ( DISTR.BD_LEFT <= -UNUR_INFINITY ) ? -M_PI/2. : atan(DISTR.BD_LEFT - GEN->center); right_angle = ( DISTR.BD_RIGHT >= UNUR_INFINITY ) ? M_PI/2. : atan(DISTR.BD_RIGHT - GEN->center); /* we use equal distances between the angles of the cpoints */ /* and the boundary points */ diff_angle = (right_angle-left_angle) / (PAR->n_starting_cpoints + 1); angle = left_angle; } else diff_angle = angle = 0.; /* we do not need these variables in this case */ /* the left boundary point */ x = x_last = DISTR.BD_LEFT; fx = fx_last = (x <= -UNUR_INFINITY) ? 0. : PDF(x); seg = GEN->seg = _unur_arou_segment_new( gen, x, fx ); if (seg == NULL) return UNUR_ERR_GEN_CONDITION; /* case of error */ is_increasing = 1; /* assume PDF(x) is increasing for the first construction points */ /* now all the other points */ for( i=0; i<=PAR->n_starting_cpoints; i++ ) { /* starting point */ if (i < PAR->n_starting_cpoints) { if (PAR->starting_cpoints) { /* construction points provided by user */ x = PAR->starting_cpoints[i]; /* check starting point */ if (x <= DISTR.BD_LEFT || x >= DISTR.BD_RIGHT) { _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"starting point out of domain"); continue; } if (x<=x_last) { _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"starting points not increasing -> skip"); continue; } } else { /* compute construction points by means of "equidistance" rule */ angle += diff_angle; x = tan( angle ) + GEN->center; } } else { /* the very last segment. it is rather a "virtual" segment to store the right vertex of the last segment, i.e., the right boundary point. */ x = DISTR.BD_RIGHT; } /* insert center ? */ if (use_center && x >= GEN->center) { use_center = FALSE; /* we use the center only once (of course) */ /* is_center = TRUE; /\* the next construction point is the center *\/ */ if (x>GEN->center) { x = GEN->center; /* use the center now ... */ --i; /* and push the orignal starting point back on stack */ if (!PAR->starting_cpoints) angle -= diff_angle; /* we have to compute the starting point in this case */ } /* else: x == GEN->center --> nothing to do */ } /* else */ /* is_center = FALSE; */ /* value of PDF at starting point */ fx = (x >= UNUR_INFINITY) ? 0. : PDF(x); /* check value of PDF at starting point */ if (!is_increasing && fx > fx_last) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF not unimodal"); return UNUR_ERR_GEN_CONDITION; } if (fx <= 0. && fx_last <= 0.) { /* we do not need two such points */ if (is_increasing) { /* PDF is still increasing, i.e., constant 0 til now */ if (in_starting_cpoints) { /* and it is not the right boundary. otherwise the PDF is constant 0 on all construction points. then we need both boundary points. */ /* we only have to change tangent line v/u = x, everything else remains unchanged */ seg->dltp[0] = -1.; seg->dltp[1] = x; /* seg->dltp[0] = -1; seg->dltp[2] = 0.; not changed */ x_last = x; continue; /* next construction point */ } } else /* there should be no more points with PDF(x) > 0 */ break; } /* need a new segment */ seg_new = _unur_arou_segment_new( gen, x, fx ); if (seg_new == NULL) { /* case of error */ seg->next = NULL; /* derminate list (for listing in debugging mode) */ return UNUR_ERR_GEN_CONDITION; } /* append to linked list */ seg->next =seg_new; seg->rtp = seg_new->ltp; seg->drtp = seg_new->dltp; /* next step */ seg = seg_new; /* PDF still increasing ? */ if (is_increasing && fx < fx_last) is_increasing = 0; /* store last computed values */ x_last = x; fx_last = fx; } /* we have left the loop with the right boundary of the support of PDF make shure that we will never use seg for sampling. */ seg->Ain = seg->Aout = 0.; seg->Acum = UNUR_INFINITY; seg->next = NULL; /* terminate list */ --(GEN->n_segs); /* we do not count this segment */ /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_arou_get_starting_cpoints() */ /*****************************************************************************/ int _unur_arou_get_starting_segments( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* compute segments for starting points */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { #define MAX_IT (1000) /* maximal number of iterations to avoid infinite loop in case of numerical errors */ struct unur_arou_segment *seg, *seg_new, *seg_tmp; double x,fx; /* construction point, value of PDF at x */ int n_it = 0; /* counter for number of iterations */ /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_AROU_GEN,UNUR_ERR_COOKIE); /* compute paramters for all segments */ for( seg=GEN->seg; seg->next != NULL; ) { /* compute parameters for semgent */ switch (_unur_arou_segment_parameter(gen, seg)) { case UNUR_SUCCESS: /* computation of parameters for segment successful */ /* skip to next segment. */ seg = seg->next; continue; case UNUR_ERR_SILENT: /* construction points too close */ /* we have to remove this last segment from list */ /* (the last construction point in the list is a boundary point. thus we might change the domain of the distribution. however, we only cut off a piece that is beyond the precesion of the floating point arithmetic.) */ if (seg->next != NULL) { seg_tmp = seg->next; seg->next = seg->next->next; seg->rtp = seg->next->ltp; seg->drtp = seg->next->dltp; free(seg_tmp); --(GEN->n_segs); } else { /* seg->next==NULL */ /* last (virtuel) interval in list. make shure that we will never use this segment */ seg->Ain = seg->Aout = 0.; seg->Acum = UNUR_INFINITY; } continue; case UNUR_ERR_INF: /* segment unbounded */ /* split segment */ break; default: /* PDF not T-concave */ return UNUR_ERR_GEN_CONDITION; } /* next iteration step */ ++n_it; if (n_it > MAX_IT) { /* maximal number of iterations exceeded */ /* assume PDF not T-concave */ return UNUR_ERR_GEN_CONDITION; } /* area in segment infinite. insert new construction point. */ x = _unur_arou_segment_arcmean(seg); /* use mean point in segment */ /* value of PDF at x */ fx = PDF(x); if (fx < 0.) { _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"PDF < 0"); return UNUR_ERR_GEN_DATA; } /* add a new segment, but check if we had to used too many segments */ if (GEN->n_segs >= GEN->max_segs) { /* we do not want to create too many segments */ _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"cannot create bounded envelope!"); return UNUR_ERR_GEN_CONDITION; } seg_new = _unur_arou_segment_new( gen, x, fx ); if (seg_new == NULL) return UNUR_ERR_GEN_CONDITION; /* case of error */ /* insert into linked list */ seg_new->next = seg->next; seg->next = seg_new; /* right vertices */ seg_new->rtp = seg->rtp; seg_new->drtp = seg->drtp; seg->rtp = seg_new->ltp; seg->drtp = seg_new->dltp; } /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_arou_get_starting_segments() */ /*****************************************************************************/ struct unur_arou_segment * _unur_arou_segment_new( struct unur_gen *gen, double x, double fx ) /*----------------------------------------------------------------------*/ /* get new segment and compute left construction point at x. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* x ... left point of new segment */ /* fx ... value of PDF at x */ /* */ /* return: */ /* pointer to new segment */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_arou_segment *seg; double u,v,dfx; /* check arguments */ CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_AROU_GEN,NULL); /* first check fx */ if (fx<0.) { _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"PDF(x) < 0."); return NULL; } if (_unur_FP_is_infinity(fx)) { /* over flow */ _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"PDF(x) overflow"); return NULL; } /* we need a new segment */ seg = _unur_xmalloc( sizeof(struct unur_arou_segment) ); seg->next = NULL; /* add eol marker */ ++(GEN->n_segs); /* increment counter for segments */ COOKIE_SET(seg,CK_AROU_SEG); /* initialize some entries in seg */ seg->Ain = seg->Aout = seg->Acum = 0.; seg->mid[0] = seg->mid[1] = 0.; /* make left construction point in segment */ /* case: x out of support */ if ( _unur_iszero(fx) ) { seg->ltp[0] = 0.; /* vertex == origin */ seg->ltp[1] = 0.; if (x <= -UNUR_INFINITY || x >= UNUR_INFINITY ) { /* tangent line == line u = 0 (i.e., v-axis) */ seg->dltp[0] = 0.; /* dv */ seg->dltp[1] = 1.; /* du */ seg->dltp[2] = 0.; /* v * dv + u * du */ } else { /* tangent line == line v/u = x */ seg->dltp[0] = -1.; /* dv */ seg->dltp[1] = x; /* du */ seg->dltp[2] = 0.; /* v * dv + u * du */ } return seg; } /* case: x in support */ /* boundary point */ u = sqrt( fx ); v = x * u; seg->ltp[0] = v; seg->ltp[1] = u; /* tangent line at tp */ /* compute derivative of PDF at tp x */ dfx = dPDF(x); /* subcase: derivative bounded use derivative for tangent line */ if ( dfx > -UNUR_INFINITY && dfx < UNUR_INFINITY ) { seg->dltp[0] = -dfx / u; /* dv */ /** TODO: possible overflow **/ seg->dltp[1] = 2 * u + dfx * x / u; /* du */ /** TODO: possible overflow **/ seg->dltp[2] = seg->dltp[0] * v + seg->dltp[1] * u; return seg; } /* subcase: derivative unbounded. use straight line through origin and vertex */ seg->dltp[0] = -u; /* dv */ seg->dltp[1] = v; /* du */ seg->dltp[2] = 0.; return seg; } /* end of _unur_arou_segment_new() */ /*****************************************************************************/ /* maximal distance of intersection point from origin compared to distance of construction points to origin */ #define MAX_NORM_OF_INTERSECTION_POINT 1.e6 /*---------------------------------------------------------------------------*/ int _unur_arou_segment_parameter( struct unur_gen *gen, struct unur_arou_segment *seg ) /*----------------------------------------------------------------------*/ /* compute all parameters for a segment. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* seg ... pointer to segment */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* UNUR_ERR_SILENT ... do not add this construction point */ /* UNUR_ERR_INF ... if area = UNUR_INFINITY */ /* other error code ... error (PDF not T-concave) */ /*----------------------------------------------------------------------*/ { double coeff_det, cramer_det[2]; double norm_vertex; /* sum of 1-norms of vertices */ double diff_tangents; /* difference between coefficients of tangents */ double det_bound; /* bound for determinant for Cramer's rule */ double tmp_a, tmp_b; /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_AROU_GEN,UNUR_ERR_COOKIE); CHECK_NULL(seg,UNUR_ERR_NULL); COOKIE_CHECK(seg,CK_AROU_SEG,UNUR_ERR_COOKIE); /* sum of 1-norms of vertices */ norm_vertex = fabs(seg->ltp[0]) + fabs(seg->ltp[1]) + fabs(seg->rtp[0]) + fabs(seg->rtp[1]); /* area inside the squeeze */ seg->Ain = (seg->ltp[1] * seg->rtp[0] - seg->ltp[0] * seg->rtp[1]) / 2.; /* due to our ordering of construction points, seg->Ain must be >= 0 ! */ if( seg->Ain < 0. ) { /* this could happen by round-off errors when the segment has angle extremely close to 0. Check this. */ if (fabs(seg->Ain) < 1.e-8 * norm_vertex) { seg->Ain = seg->Aout = 0.; } else { /* This should not happen: non-ascending ordering of construction points */ _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); } return UNUR_ERR_SILENT; } /* we use Cramer's rule to compute intersection of tangent lines. (well, we could save one multiplication otherwise) */ coeff_det = seg->dltp[0] * seg->drtp[1] - seg->dltp[1] * seg->drtp[0]; cramer_det[0] = seg->dltp[2] * seg->drtp[1] - seg->dltp[1] * seg->drtp[2]; cramer_det[1] = seg->dltp[0] * seg->drtp[2] - seg->dltp[2] * seg->drtp[0]; /* we there are two possibilities for singular coefficent matrix: either the outer triangle is unlimited. then the two tangents are distinct but parallel and the corresponding linear equation has no solution, i.e. coeff_det == 0 but cramer_det[0] != 0 or cramer_det[1] != 0. or the outer triangle degenerates to a line segment and has area 0. then the two tangents are equal and the corresponding linear equation has a nonunique solution, i.e. coeff_det == cramer_det[0] == cramer_det[1] == 0. */ /* we to not allow that the outer triangles becomes too large. so if the 1-norm of intersection point is too large compared to norm_vertex we assume that this triangle is unbounded. we thus avoid numerical errors. (we use the 1-norm here since it much easier to handle.) However, this might also happen due to roundoff errors, when the real position is extremely close to the secant. But at least we are on the save side. We only make an exception when coeff_det == 0, since otherwise there might be some problems with distributions like U(1,2). */ det_bound = fabs(coeff_det) * norm_vertex * MAX_NORM_OF_INTERSECTION_POINT; /* difference between coefficents of tangents */ diff_tangents = ( fabs(seg->dltp[0] - seg->drtp[0]) + fabs(seg->dltp[1] - seg->drtp[1]) + fabs(seg->dltp[2] - seg->drtp[2]) ); /* case: intersection point exists and is unique */ if (!_unur_iszero(coeff_det) && !_unur_iszero(diff_tangents)) { /* first check whether we can compute the intersection point */ if ( fabs(cramer_det[0]) > det_bound || fabs(cramer_det[1]) > det_bound ) { /* case: triangle is assumed to be unbounded */ /* _unur_warning(gen->genid,UNUR_ERR_GENERIC,"outer triangle assumed unbounded 1"); */ seg->Aout = UNUR_INFINITY; return UNUR_ERR_INF; } /* compute intersection point */ seg->mid[0] = cramer_det[0] / coeff_det; seg->mid[1] = cramer_det[1] / coeff_det; /* area outside the squeeze */ seg->Aout = ( (seg->ltp[0] - seg->mid[0]) * (seg->rtp[1] - seg->mid[1]) - (seg->ltp[1] - seg->mid[1]) * (seg->rtp[0] - seg->mid[0])) / 2.; /* due to our ordering of construction points, seg->Aout must be >= 0 for a regular triangle. Thus if seg->Aout < 0, then the intersection point of tangents is on the WRONG side of the secant through vertices of segment, i.e. the "triangle" outside the squeeze region is unbounded. However this might also happen due to roundoff errors when the real position is extremely close to the secant. We can distinguish between these two case by means of the u-coordinate of the intersection point. If it is on the wrong side of the secant, then we have seg->mid[1] < 0 (Otherwise we have either a round-off error or the PDF is not T-concave.) */ if( seg->mid[1] < 0. ) { /* _unur_warning(gen->genid,UNUR_ERR_GENERIC,"outer triangle unbounded 2"); */ seg->Aout = UNUR_INFINITY; return UNUR_ERR_INF; } /* at last check result. we must have: (*) seg->Aout > 0 (*) intersection point right of left construction point (*) intersection point left of right construction point */ if ( seg->Aout > 0. ) { tmp_a = seg->mid[0] * seg->ltp[1]; tmp_b = seg->ltp[0] * seg->mid[1]; if ( ! _unur_FP_less(tmp_a, tmp_b) ) { tmp_a = seg->mid[0] * seg->rtp[1]; tmp_b = seg->rtp[0] * seg->mid[1]; if ( ! _unur_FP_greater(tmp_a, tmp_b) ) /* everything o.k. */ return UNUR_SUCCESS; } } /* there are two cases why the above check failed: (1) the PDF is not T-concave (2) small roundoff errors. */ if ( !_unur_iszero(seg->ltp[1]) && !_unur_iszero(seg->rtp[1]) ) { tmp_a = seg->ltp[0] * seg->rtp[1]; tmp_b = seg->rtp[0] * seg->ltp[1]; if ( _unur_FP_equal(tmp_a, tmp_b) ) { /* we assume that left construction point = right construction point */ /* (construction points are too close) */ seg->Ain = seg->Aout = 0.; return UNUR_ERR_SILENT; } } /* _unur_warning(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF not T-concave"); */ /* The outer area is unbounded (this might happen if the given PDF is not T-concave or due to round off errors. We assume round off errors. If the PDF is not T-concave we will exceed any bound for the number of segments. */ /* However due to round off errors, Aout might have become < 0 when the boundary of region is (almost) a straight line and the area outside squeeze should be (almost) zero. */ if (!(fabs(seg->Aout) < fabs(seg->Ain) * UNUR_EPSILON)) { seg->Aout = UNUR_INFINITY; return UNUR_ERR_INF; } /* else we assume round-off errors and set Aout = 0. i.e. go to the remaining case below */ } /* remaining case: triangle degenerates to a line segment, i.e. intersection point exists but is not unique */ /* boundary of region is (almost) a straight line and area outside squeeze is (almost) zero. use middle point as intersection point and set area outside the squeeze to 0. */ /* _unur_warning(gen->genid,UNUR_ERR_GENERIC,"outer triangle is line"); */ seg->mid[0] = 0.5 * (seg->ltp[0] + seg->rtp[0]); seg->mid[1] = 0.5 * (seg->ltp[1] + seg->rtp[1]); seg->Aout = 0.; /* now it should be o.k. */ return UNUR_SUCCESS; } /* end if _unur_arou_segment_parameter() */ /*---------------------------------------------------------------------------*/ #undef MAX_NORM_INTERSECTION /*****************************************************************************/ int _unur_arou_segment_split( struct unur_gen *gen, struct unur_arou_segment *seg_oldl, double x, double fx ) /*----------------------------------------------------------------------*/ /* insert new segment */ /* old segment -> left hand side */ /* new segment -> right hand side */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* seg_oldl ... pointer to segment */ /* x ... left point of new segment */ /* fx ... value of PDF at x */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* UNUR_ERR_SILENT ... if no intervals are splitted */ /* other error codes ... on error */ /* 1 ... if successful */ /* 0 ... if */ /* -1 ... error */ /*----------------------------------------------------------------------*/ { struct unur_arou_segment *seg_newr; /* pointer to newly created segment */ struct unur_arou_segment seg_bak; /* space for saving data of segment */ double Adiff; /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_AROU_GEN,UNUR_ERR_COOKIE); CHECK_NULL(seg_oldl,UNUR_ERR_NULL); COOKIE_CHECK(seg_oldl,CK_AROU_SEG,UNUR_ERR_COOKIE); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug & AROU_DEBUG_SPLIT) _unur_arou_debug_split_start( gen,seg_oldl,x,fx ); #endif /* we only add a new construction point, if the relative area is large enough */ if (GEN->n_segs * seg_oldl->Aout / (GEN->Atotal - GEN->Asqueeze) < GEN->darsfactor ) return UNUR_SUCCESS; /* check for data error */ if (fx < 0.) { _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"PDF(x) < 0.!"); return UNUR_ERR_GEN_DATA; } /* backup data */ memcpy(&seg_bak, seg_oldl, sizeof(struct unur_arou_segment)); /* PDF at x is 0. */ if (fx <= 0.) { if (seg_oldl->rtp[1] <= 0. && seg_oldl->rtp[0] <= 0. ) { /* just chop off the right part of segment */ /* we only have to change tangent line v/u = x at the right hand vertex */ seg_oldl->drtp[1] = x; /* du */ } else if (seg_oldl->ltp[1] <= 0. && seg_oldl->ltp[0] <= 0. ) { /* just chop off the left part of segment */ /* we only have to change tangent line v/u = x at the left hand vertex */ seg_oldl->dltp[1] = x; /* du */ } else { _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); return UNUR_ERR_SHOULD_NOT_HAPPEN; } /* parameters of new segment */ if( _unur_arou_segment_parameter(gen,seg_oldl)!=UNUR_SUCCESS ) { /* PDF not T-concave or area in segment not bounded */ _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"Cannot chop segment at given point"); /* error --> restore the old segment */ memcpy(seg_oldl, &seg_bak, sizeof(struct unur_arou_segment)); return UNUR_ERR_SILENT; } /* for _unur_arou_debug_split_stop only */ seg_newr = seg_oldl; } else { /* fx > 0 */ /* need new segment */ seg_newr = _unur_arou_segment_new(gen,x,fx); if (seg_newr == NULL) return UNUR_ERR_GEN_DATA; /* case of error */ /* link into list */ seg_newr->next = seg_oldl->next; seg_oldl->next = seg_newr; /* right vertices */ seg_newr->rtp = seg_oldl->rtp; seg_newr->drtp = seg_oldl->drtp; seg_oldl->rtp = seg_newr->ltp; seg_oldl->drtp = seg_newr->dltp; /* parameters of new segments */ if( _unur_arou_segment_parameter(gen,seg_oldl)!=UNUR_SUCCESS || /* PDF not T-concave or */ _unur_arou_segment_parameter(gen,seg_newr)!=UNUR_SUCCESS /* area in segment not bounded */ ) { /* new construction point not suitable --> do not add */ _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"Cannot split segment at given point."); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug & AROU_DEBUG_SPLIT) _unur_arou_debug_split_stop( gen,seg_oldl,seg_newr ); #endif /* restore the old segment */ memcpy(seg_oldl, &seg_bak, sizeof(struct unur_arou_segment)); /* decrement counter for segments and free unused segment */ if (seg_newr) { --(GEN->n_segs); free( seg_newr ); } return UNUR_ERR_SILENT; } } /* successful */ /* update total area below hat and squeeze */ Adiff = - seg_bak.Ain + seg_oldl->Ain + ((seg_newr!=seg_oldl) ? seg_newr->Ain : 0. ); GEN->Asqueeze += Adiff; Adiff += - seg_bak.Aout + seg_oldl->Aout + ((seg_newr!=seg_oldl) ? seg_newr->Aout : 0. ); GEN->Atotal += Adiff; #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug & AROU_DEBUG_SPLIT) _unur_arou_debug_split_stop( gen,seg_oldl,seg_newr ); #endif /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_arou_segment_split() */ /*****************************************************************************/ double _unur_arou_compute_x( double v, double u ) /*----------------------------------------------------------------------*/ /* compute point x from (v,u) tuple. */ /* */ /* parameters: */ /* v ... numerator */ /* u ... denominator */ /* */ /* return: */ /* point x of (x,y) tuple */ /* */ /* remark: */ /* if (v,u)=(0,0) then x is set to UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { if (!_unur_iszero(u)) return v/u; else if (v<0.) return -UNUR_INFINITY; else return UNUR_INFINITY; } /* end of _unur_arou_compute_x() */ /*---------------------------------------------------------------------------*/ int _unur_arou_run_dars( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* run derandomized adaptive rejection sampling. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { struct unur_arou_segment *seg, *seg_next; double Atot, Asqueezetot; /* total area below hat and squeeze, resp. */ double Alimit; /* threshhold value for splitting interval */ int n_splitted = 1; /* count splitted intervals */ int splitted; /* result of splitting routine */ double xl, xr; /* boundary of interval */ double xsp, fxsp; /* splitting point in interval */ /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_AROU_GEN,UNUR_ERR_COOKIE); /* there is no need to run DARS when the DARS factor is UNUR_INFINITY */ if (_unur_FP_is_infinity(GEN->darsfactor)) return UNUR_SUCCESS; /* first we need the total areas below hat and squeeze. (This is only necessary, when _unur_arou_make_guide_table() has not been called!) */ Atot = 0.; /* area below hat */ Asqueezetot = 0.; /* area below squeeze */ for (seg = GEN->seg; seg != NULL; seg = seg->next ) { COOKIE_CHECK(seg,CK_AROU_SEG,UNUR_ERR_COOKIE); Asqueezetot += seg->Ain; Atot += seg->Ain + seg->Aout; } GEN->Atotal = Atot; GEN->Asqueeze = Asqueezetot; /* now split intervals */ while ( (GEN->max_ratio * GEN->Atotal > GEN->Asqueeze) && (GEN->n_segs < GEN->max_segs) ) { /* compute threshhold value. every interval with area between hat and squeeze greater than this value will be splitted. */ if (GEN->n_segs > 1) Alimit = GEN->darsfactor * ( (GEN->Atotal - GEN->Asqueeze) / GEN->n_segs ); else /* we split every interval if there are only one interval */ Alimit = 0.; /* reset counter for splitted intervals */ n_splitted = 0; /* for all intervals do ... */ for (seg = GEN->seg; seg->next != NULL; seg = seg->next ) { COOKIE_CHECK(seg,CK_AROU_SEG,UNUR_ERR_COOKIE); /* do not exceed the maximum number of intervals */ if (GEN->n_segs >= GEN->max_segs) break; /* we skip over all intervals where the area between hat and squeeze does not exceed the threshhold value. */ if (seg->Aout <= Alimit) continue; /* goto next interval */ /* store pointer to next interval */ seg_next = seg->next; /* boundary of interval */ xl = _unur_arou_compute_x(seg->ltp[0],seg->ltp[1]); xr = _unur_arou_compute_x(seg->rtp[0],seg->rtp[1]); if (xl>xr) xl = -UNUR_INFINITY; /* (0,0) is mapped to INF instead of -INF */ /* However ... */ if ( _unur_FP_is_minus_infinity(xl) && _unur_FP_same(seg->dltp[0],-1.) && _unur_iszero(seg->dltp[2]) ) /* boundary of domain given by tangent */ xl = seg->dltp[1]; if ( _unur_FP_is_infinity(xr) && _unur_FP_same(seg->drtp[0],-1.) && _unur_iszero(seg->drtp[2]) ) /* boundary of domain given by tangent */ xr = seg->drtp[1]; /* get splitting point (arc-mean rule) */ xsp = _unur_arcmean(xl,xr); /* value of PDF at splitting point */ fxsp = PDF(xsp); /* now split interval at given point */ splitted = _unur_arou_segment_split(gen, seg, xsp, fxsp); if (splitted == UNUR_SUCCESS) { /* splitting successful */ ++n_splitted; /* If we have chopped off the left or right tail, we can simply continue with seg->next. Otherwise, if we have split the segment, then seg->next points to the newly created segment and there is no need to split this in this loop; thus we skip seg->next and continue we seg->next->next. we can distinguish between these two cases by comparing the stored pointer seg_next with seg->next. */ if (seg->next != seg_next) seg = seg->next; } else if (splitted != UNUR_ERR_SILENT) { /* some serious error occurred */ /* condition for PDF is violated! */ _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,""); return UNUR_ERR_GEN_CONDITION; } /* else: could not split construction points: too close (?) */ } if (n_splitted == 0) { /* we are not successful in splitting any inteval. abort to avoid endless loop */ _unur_warning(gen->genid,UNUR_ERR_GENERIC,"DARS aborted: no intervals could be splitted."); break; } } /* ratio between squeeze and hat o.k. ? */ if ( GEN->max_ratio * GEN->Atotal > GEN->Asqueeze ) { if ( GEN->n_segs >= GEN->max_segs ) _unur_warning(gen->genid,UNUR_ERR_GENERIC,"DARS aborted: maximum number of intervals exceeded."); _unur_warning(gen->genid,UNUR_ERR_GENERIC,"hat/squeeze ratio too small."); } else { /* no more construction points */ GEN->max_segs = GEN->n_segs; } /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_arou_run_dars() */ /*****************************************************************************/ int _unur_arou_make_guide_table( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* make a guide table for indexed search */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { struct unur_arou_segment *seg; double Acum, Aincum, Astep; int max_guide_size; int j; /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_AROU_GEN,UNUR_ERR_COOKIE); /* allocate blocks for guide table (if necessary). (we allocate blocks for maximal guide table.) */ if (!GEN->guide) { max_guide_size = (GEN->guide_factor > 0.) ? ((int)(GEN->max_segs * GEN->guide_factor)) : 1; if (max_guide_size <= 0) max_guide_size = 1; /* protect against overflow */ GEN->guide = _unur_xmalloc( max_guide_size * sizeof(struct unur_arou_segment*) ); } /* first we need cumulated areas in segments */ Acum = 0.; /* area in enveloping polygon */ Aincum = 0.; /* area in squeeze */ for (seg = GEN->seg; seg != NULL; seg = seg->next ) { COOKIE_CHECK(seg,CK_AROU_SEG,UNUR_ERR_COOKIE); Acum += seg->Ain + seg->Aout; Aincum += seg->Ain; seg->Acum = Acum; } /* total area below hat */ GEN->Atotal = Acum; GEN->Asqueeze = Aincum; /* actual size of guide table */ GEN->guide_size = (int)(GEN->n_segs * GEN->guide_factor); /* we do not vary the relative size of the guide table, since it has very little influence on speed */ /* make table (use variant 2; see dgt.c) */ Astep = GEN->Atotal / GEN->guide_size; Acum=0.; for( j=0, seg=GEN->seg; j < GEN->guide_size; j++ ) { COOKIE_CHECK(seg,CK_AROU_SEG,UNUR_ERR_COOKIE); while( seg->Acum < Acum ) if( seg->next != NULL ) /* skip to next segment if it exists */ seg = seg->next; else { _unur_warning(gen->genid,UNUR_ERR_ROUNDOFF,"guide table"); break; } GEN->guide[j] = seg; Acum += Astep; } /* if there has been an round off error, we have to complete the guide table */ for( ; jguide_size ;j++ ) GEN->guide[j] = seg; return UNUR_SUCCESS; } /* end of _unur_arou_make_guide_table() */ /*****************************************************************************/ double _unur_arou_segment_arcmean( struct unur_arou_segment *seg ) /*----------------------------------------------------------------------*/ /* compute "arctan mean" of two numbers expressed as v/u, u>=0 */ /* */ /* parameters: */ /* seg ... pointer to segment */ /* */ /* return: */ /* mean */ /* */ /* error: */ /* return UNUR_INFINITY */ /* */ /* comment: */ /* "arctan mean" = tan(0.5*(arctan(x0)+arctan(x1))) */ /* */ /* a combination of arithmetical mean (for x0 and x1 close to 0) */ /* and the harmonic mean (for |x0| and |x1| large). */ /*----------------------------------------------------------------------*/ { double xl, xr; /* check arguments */ CHECK_NULL(seg,UNUR_INFINITY); COOKIE_CHECK(seg,CK_AROU_SEG,UNUR_INFINITY); /* if u != 0 ... x is stored in tp (= v/u) */ /* else ... x is stored in tangent dltp */ xl = (seg->ltp[1] > 0.) ? (seg->ltp[0] / seg->ltp[1]) : ( _unur_iszero(seg->dltp[0]) ? -UNUR_INFINITY : (seg->dltp[1]) ); xr = (seg->rtp[1] > 0.) ? (seg->rtp[0] / seg->rtp[1]) : ( _unur_iszero(seg->drtp[0]) ? UNUR_INFINITY : (seg->drtp[1]) ); return _unur_arcmean(xl,xr); } /* end of _unur_arou_segment_arcmean() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Debugging utilities **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ void _unur_arou_debug_init( const struct unur_par *par, const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write info about generator after setup into LOG file */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; int i; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_AROU_GEN,RETURN_VOID); CHECK_NULL(par,RETURN_VOID); COOKIE_CHECK(par,CK_AROU_PAR,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: type = continuous univariate random variates\n",gen->genid); fprintf(LOG,"%s: method = ratio-of-uniforms method with enveloping polygon\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); _unur_distr_cont_debug( gen->distr, gen->genid ); fprintf(LOG,"%s: sampling routine = _unur_arou_sample",gen->genid); if (gen->variant & AROU_VARFLAG_VERIFY) fprintf(LOG,"_check()\n"); else fprintf(LOG,"()\n"); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: center = %g",gen->genid,GEN->center); _unur_print_if_default(gen,AROU_SET_CENTER); if (gen->variant & AROU_VARFLAG_USECENTER) fprintf(LOG,"\n%s: use center as construction point",gen->genid); fprintf(LOG,"\n%s:\n",gen->genid); fprintf(LOG,"%s: maximum number of segments = %d",gen->genid,GEN->max_segs); _unur_print_if_default(gen,AROU_SET_MAX_SEGS); fprintf(LOG,"\n%s: bound for ratio Asqueeze / Atotal = %g%%",gen->genid,GEN->max_ratio*100.); _unur_print_if_default(gen,AROU_SET_MAX_SQHRATIO); fprintf(LOG,"\n%s:\n",gen->genid); if (gen->variant & AROU_VARFLAG_USEDARS) { fprintf(LOG,"%s: Derandomized ARS enabled ",gen->genid); _unur_print_if_default(gen,AROU_SET_USE_DARS); fprintf(LOG,"\n%s:\tDARS factor = %g",gen->genid,GEN->darsfactor); _unur_print_if_default(gen,AROU_SET_DARS_FACTOR); } else { fprintf(LOG,"%s: Derandomized ARS disabled ",gen->genid); _unur_print_if_default(gen,AROU_SET_USE_DARS); } fprintf(LOG,"\n%s:\n",gen->genid); fprintf(LOG,"%s: sampling from list of segments: indexed search (guide table method)\n",gen->genid); fprintf(LOG,"%s: relative guide table size = %g%%",gen->genid,100.*GEN->guide_factor); _unur_print_if_default(gen,AROU_SET_GUIDEFACTOR); fprintf(LOG,"\n%s:\n",gen->genid); fprintf(LOG,"%s: number of starting points = %d",gen->genid,PAR->n_starting_cpoints); _unur_print_if_default(gen,AROU_SET_N_STP); fprintf(LOG,"\n%s: starting points:",gen->genid); if (gen->set & AROU_SET_STP) for (i=0; in_starting_cpoints; i++) { if (i%5==0) fprintf(LOG,"\n%s:\t",gen->genid); fprintf(LOG," %#g,",PAR->starting_cpoints[i]); } else fprintf(LOG," use \"equidistribution\" rule [default]"); fprintf(LOG,"\n%s:\n",gen->genid); _unur_arou_debug_segments(gen); fprintf(LOG,"%s: INIT completed **********************\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); fflush(LOG); } /* end of _unur_arou_debug_init() */ /*****************************************************************************/ void _unur_arou_debug_dars_start( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* print header before runniung DARS into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_AROU_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s: DARS started **********************\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: DARS factor = %g",gen->genid,GEN->darsfactor); _unur_print_if_default(gen,AROU_SET_DARS_FACTOR); fprintf(LOG,"\n%s:\n",gen->genid); fflush(LOG); } /* end of _unur_arou_debug_dars_start() */ /*---------------------------------------------------------------------------*/ void _unur_arou_debug_dars( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* print infor after generator has run DARS into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_AROU_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: DARS finished **********************\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); _unur_arou_debug_segments(gen); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: DARS completed **********************\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); fflush(LOG); } /* end of _unur_arou_debug_dars() */ /*****************************************************************************/ void _unur_arou_debug_free( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write info about generator before destroying into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_AROU_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: GENERATOR destroyed **********************\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); _unur_arou_debug_segments(gen); fprintf(LOG,"%s:\n",gen->genid); fflush(LOG); } /* end of _unur_arou_debug_free() */ /*****************************************************************************/ void _unur_arou_debug_segments( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write list of segments into LOGfile */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; struct unur_arou_segment *seg; double sAin, sAout, Atotal; int i; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_AROU_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s:Segments: %d\n",gen->genid,GEN->n_segs); if ((gen->debug & AROU_DEBUG_SEGMENTS) && GEN->seg != NULL) { fprintf(LOG,"%s: Nr.\t left touching point\t\t intersection point\t\t tangent at left touching point\n",gen->genid); for (seg = GEN->seg, i=0; seg->next!=NULL; seg=seg->next, i++) { COOKIE_CHECK(seg,CK_AROU_SEG,RETURN_VOID); fprintf(LOG,"%s:[%3d]: (%-12.6g,%-12.6g) (%-12.6g,%-12.6g) (%-12.6g,%-12.6g,%-12.6g)\n", gen->genid, i, seg->ltp[0],seg->ltp[1], seg->mid[0],seg->mid[1], seg->dltp[0],seg->dltp[1],seg->dltp[2]); } COOKIE_CHECK(seg,CK_AROU_SEG,RETURN_VOID); fprintf(LOG,"%s:[...]: (%-12.6g,%-12.6g)\n", gen->genid,seg->ltp[0],seg->ltp[1]); } fprintf(LOG,"%s:\n",gen->genid); if (GEN->Atotal <= 0.) { fprintf(LOG,"%s: Construction of enveloping polygon not successful\n",gen->genid); fprintf(LOG,"%s: Areas may be meaningless !!!!!!!!!!!!!!!!!!!!!!!!\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); Atotal = -1.; /* to avoid floating point exceptions */ } else { Atotal = GEN->Atotal; } /* print and sum areas inside and outside of squeeze */ if ((gen->debug & AROU_DEBUG_SEGMENTS) && GEN->seg != NULL) { fprintf(LOG,"%s:Areas in segments:\n",gen->genid); fprintf(LOG,"%s: Nr.\t inside squeeze\t\t outside squeeze\t total segment\t\tcumulated\n",gen->genid); sAin = sAout = 0.; for (seg = GEN->seg, i=0; seg->next!=NULL; seg=seg->next, i++) { COOKIE_CHECK(seg,CK_AROU_SEG,RETURN_VOID); sAin += seg->Ain; sAout += seg->Aout; fprintf(LOG,"%s:[%3d]: %-12.6g(%6.3f%%) | %-12.6g(%6.3f%%) | %-12.6g(%6.3f%%) | %-12.6g(%6.3f%%)\n", gen->genid,i, seg->Ain, seg->Ain * 100. / Atotal, seg->Aout, seg->Aout * 100. / Atotal, seg->Ain + seg->Aout, (seg->Ain + seg->Aout) * 100. / Atotal, seg->Acum, seg->Acum * 100. / Atotal); } fprintf(LOG,"%s:\t---------- --------- | ---------- --------- | ---------- --------- +\n",gen->genid); fprintf(LOG,"%s: Sum : %-12.6g(%6.3f%%) | %-12.6g(%6.3f%%) | %-11.6g(%6.3f%%)\n", gen->genid, sAin, sAin * 100./Atotal, sAout, sAout * 100./Atotal, sAin + sAout, (sAin + sAout) * 100./Atotal); fprintf(LOG,"%s:\n",gen->genid); } /* summary of areas */ fprintf(LOG,"%s: A(squeeze) = %-12.6g (%6.3f%%)\n",gen->genid, GEN->Asqueeze, GEN->Asqueeze * 100./Atotal); fprintf(LOG,"%s: A(hat\\squeeze) = %-12.6g (%6.3f%%)\n",gen->genid, GEN->Atotal - GEN->Asqueeze, (Atotal - GEN->Asqueeze) * 100./Atotal); fprintf(LOG,"%s: A(total) = %-12.6g\n",gen->genid, Atotal); fprintf(LOG,"%s:\n",gen->genid); } /* end of _unur_arou_debug_segments() */ /*****************************************************************************/ void _unur_arou_debug_split_start( const struct unur_gen *gen, const struct unur_arou_segment *seg, double x, double fx ) /*----------------------------------------------------------------------*/ /* write info about splitting segment */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* seg ... pointer to segment */ /* x ... split at this point */ /* fx ... value of PDF at x */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_AROU_GEN,RETURN_VOID); CHECK_NULL(seg,RETURN_VOID); COOKIE_CHECK(seg,CK_AROU_SEG,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s: split segment at x = %g \t\tf(x) = %g\n",gen->genid,x,fx); fprintf(LOG,"%s: old segment:\n",gen->genid); fprintf(LOG,"%s: left construction point = (%-12.6g,%-12.6g)\t x = v/u = %-12.6g\tf(x) = %-12.6g\n", gen->genid, seg->ltp[0], seg->ltp[1], seg->ltp[0]/seg->ltp[1], sqrt(seg->ltp[1]) ); fprintf(LOG,"%s: intersection point = (%-12.6g,%-12.6g)\t x = v/u = %-12.6g\n", gen->genid, seg->mid[0], seg->mid[1], seg->mid[0]/seg->mid[1]); fprintf(LOG,"%s: right construction point = (%-12.6g,%-12.6g)\t x = v/u = %-12.6g\tf(x) = %-12.6g\n", gen->genid, seg->rtp[0], seg->rtp[1], seg->rtp[0]/seg->rtp[1], sqrt(seg->rtp[1]) ); fprintf(LOG,"%s: A(squeeze) = %-12.6g\t(%6.3f%%)\n",gen->genid, seg->Ain, seg->Ain * 100./GEN->Atotal); fprintf(LOG,"%s: A(hat\\squeeze) = %-12.6g\t(%6.3f%%)\n",gen->genid, seg->Aout, seg->Aout * 100./GEN->Atotal); fprintf(LOG,"%s: A(hat) = %-12.6g\t(%6.3f%%)\n",gen->genid, (seg->Ain + seg->Aout), (seg->Ain +seg->Aout) * 100./GEN->Atotal); fflush(LOG); } /* end of _unur_arou_debug_split_start() */ /*****************************************************************************/ void _unur_arou_debug_split_stop( const struct unur_gen *gen, const struct unur_arou_segment *seg_left, const struct unur_arou_segment *seg_right ) /*----------------------------------------------------------------------*/ /* write info about new splitted segments */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* iv_left ... pointer to new left hand segment */ /* iv_right ... pointer to new right hand segment */ /*----------------------------------------------------------------------*/ { FILE *LOG; int chopped; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_AROU_GEN,RETURN_VOID); CHECK_NULL(seg_left,RETURN_VOID); COOKIE_CHECK(seg_left,CK_AROU_SEG,RETURN_VOID); CHECK_NULL(seg_right,RETURN_VOID); COOKIE_CHECK(seg_right,CK_AROU_SEG,RETURN_VOID); LOG = unur_get_stream(); /* whether segment was split or just chopped */ chopped = (seg_left==seg_right) ? 1 : 0; if (chopped) fprintf(LOG,"%s: new segment (chopped):\n",gen->genid); else fprintf(LOG,"%s: new segments:\n",gen->genid); fprintf(LOG,"%s: left construction point = (%-12.6g,%-12.6g)\t x = v/u = %-12.6g\tf(x) = %-12.6g\n", gen->genid, seg_left->ltp[0], seg_left->ltp[1], seg_left->ltp[0]/seg_left->ltp[1], sqrt(seg_left->ltp[1]) ); fprintf(LOG,"%s: intersection point = (%-12.6g,%-12.6g)\t x = v/u = %-12.6g\n", gen->genid, seg_left->mid[0], seg_left->mid[1], seg_left->mid[0]/seg_left->mid[1] ); if (chopped) { fprintf(LOG,"%s: right construction point = (%-12.6g,%-12.6g)\t x = v/u = %-12.6g\tf(x) = %-12.6g\n", gen->genid, seg_left->rtp[0], seg_left->rtp[1], seg_left->rtp[0]/seg_left->rtp[1], sqrt(seg_left->rtp[1]) ); } else { fprintf(LOG,"%s: middle construction point = (%-12.6g,%-12.6g)\t x = v/u = %-12.6g\tf(x) = %-12.6g\n", gen->genid, seg_left->rtp[0], seg_left->rtp[1], seg_left->rtp[0]/seg_left->rtp[1], sqrt(seg_left->rtp[1]) ); fprintf(LOG,"%s: intersection point = (%-12.6g,%-12.6g)\t x = v/u = %-12.6g\n", gen->genid, seg_right->mid[0], seg_right->mid[1], seg_right->mid[0]/seg_right->mid[1] ); fprintf(LOG,"%s: right construction point = (%-12.6g,%-12.6g)\t x = v/u = %-12.6g\tf(x) = %-12.6g\n", gen->genid, seg_right->rtp[0], seg_right->rtp[1], seg_right->rtp[0]/seg_right->rtp[1], sqrt(seg_right->rtp[1]) ); } if (!chopped) { fprintf(LOG,"%s: left segment:\n",gen->genid); fprintf(LOG,"%s: A(squeeze) = %-12.6g\t(%6.3f%%)\n",gen->genid, seg_left->Ain, seg_left->Ain * 100./GEN->Atotal); fprintf(LOG,"%s: A(hat\\squeeze) = %-12.6g\t(%6.3f%%)\n",gen->genid, seg_left->Aout, seg_left->Aout * 100./GEN->Atotal); fprintf(LOG,"%s: A(hat) = %-12.6g\t(%6.3f%%)\n",gen->genid, (seg_left->Ain + seg_left->Aout), (seg_left->Ain +seg_left->Aout) * 100./GEN->Atotal); fprintf(LOG,"%s: right segment:\n",gen->genid); fprintf(LOG,"%s: A(squeeze) = %-12.6g\t(%6.3f%%)\n",gen->genid, seg_right->Ain, seg_right->Ain * 100./GEN->Atotal); fprintf(LOG,"%s: A(hat\\squeeze) = %-12.6g\t(%6.3f%%)\n",gen->genid, seg_right->Aout, seg_right->Aout * 100./GEN->Atotal); fprintf(LOG,"%s: A(hat) = %-12.6g\t(%6.3f%%)\n",gen->genid, (seg_right->Ain + seg_right->Aout), (seg_right->Ain +seg_right->Aout) * 100./GEN->Atotal); } fprintf(LOG,"%s: total areas:\n",gen->genid); fprintf(LOG,"%s: A(squeeze) = %-12.6g\t(%6.3f%%)\n",gen->genid, GEN->Asqueeze, GEN->Asqueeze * 100./GEN->Atotal); fprintf(LOG,"%s: A(hat\\squeeze) = %-12.6g\t(%6.3f%%)\n",gen->genid, GEN->Atotal - GEN->Asqueeze, (GEN->Atotal - GEN->Asqueeze) * 100./GEN->Atotal); fprintf(LOG,"%s: A(total) = %-12.6g\n",gen->genid, GEN->Atotal); fprintf(LOG,"%s:\n",gen->genid); fflush(LOG); } /* end of _unur_arou_debug_split_stop() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_INFO /*---------------------------------------------------------------------------*/ void _unur_arou_info( struct unur_gen *gen, int help ) /*----------------------------------------------------------------------*/ /* create character string that contains information about the */ /* given generator object. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* help ... whether to print additional comments */ /*----------------------------------------------------------------------*/ { struct unur_string *info = gen->infostr; struct unur_distr *distr = gen->distr; /* generator ID */ _unur_string_append(info,"generator ID: %s\n\n", gen->genid); /* distribution */ _unur_string_append(info,"distribution:\n"); _unur_distr_info_typename(gen); _unur_string_append(info," functions = PDF dPDF\n"); _unur_string_append(info," domain = (%g, %g)\n", DISTR.domain[0],DISTR.domain[1]); _unur_string_append(info," center = %g", unur_distr_cont_get_center(distr)); if ( !(distr->set & UNUR_DISTR_SET_CENTER) ) { if ( distr->set & UNUR_DISTR_SET_MODE ) _unur_string_append(info," [= mode]\n"); else _unur_string_append(info," [default]\n"); } else { _unur_string_append(info,"\n"); } if (help) { if ( !(distr->set & (UNUR_DISTR_SET_CENTER | UNUR_DISTR_SET_MODE )) ) _unur_string_append(info,"\n[ Hint: %s ]\n", "You may provide a point near the mode as \"center\"."); } _unur_string_append(info,"\n"); /* method */ _unur_string_append(info,"method: AROU (Automatic Ratio-Of-Uniforms)\n"); _unur_string_append(info,"\n"); /* performance */ _unur_string_append(info,"performance characteristics:\n"); _unur_string_append(info," area(hat) = %g\n", GEN->Atotal); _unur_string_append(info," rejection constant "); if (distr->set & UNUR_DISTR_SET_PDFAREA) _unur_string_append(info,"= %g\n", GEN->Atotal/(0.5*DISTR.area)); else _unur_string_append(info,"<= %g\n", GEN->Atotal/GEN->Asqueeze); _unur_string_append(info," area ratio squeeze/hat = %g\n", GEN->Asqueeze/GEN->Atotal); _unur_string_append(info," # segments = %d\n", GEN->n_segs); _unur_string_append(info,"\n"); /* parameters */ if (help) { _unur_string_append(info,"parameters:\n"); _unur_string_append(info," max_sqhratio = %g %s\n", GEN->max_ratio, (gen->set & AROU_SET_MAX_SQHRATIO) ? "" : "[default]"); _unur_string_append(info," max_segments = %d %s\n", GEN->max_segs_info, (gen->set & AROU_SET_MAX_SEGS) ? "" : "[default]"); if (gen->variant & AROU_VARFLAG_VERIFY) _unur_string_append(info," verify = on\n"); if (gen->variant & AROU_VARFLAG_PEDANTIC) _unur_string_append(info," pedantic = on\n"); /* Not displayed: int unur_arou_set_usedars( UNUR_PAR *parameters, int usedars ); int unur_arou_set_darsfactor( UNUR_PAR *parameters, double factor ); int unur_arou_set_cpoints( UNUR_PAR *parameters, int n_stp, const double *stp ); int unur_arou_set_usecenter( UNUR_PAR *parameters, int usecenter ); int unur_arou_set_guidefactor( UNUR_PAR *parameters, double factor ); */ _unur_string_append(info,"\n"); } /* Hints */ if (help) { if ( !(gen->set & AROU_SET_MAX_SQHRATIO) ) _unur_string_append(info,"[ Hint: %s ]\n", "You can set \"max_sqhratio\" closer to 1 to decrease rejection constant." ); if (GEN->Asqueeze/GEN->Atotal < GEN->max_ratio) _unur_string_append(info,"[ Hint: %s ]\n", "You should increase \"max_segments\" to obtain the desired rejection constant." ); _unur_string_append(info,"\n"); } } /* end of _unur_arou_info() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_INFO */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/dau.c0000644001357500135600000012406014420445767013224 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: dau.c * * * * TYPE: discrete univariate random variate * * METHOD: alias and alias-urn method * * * * DESCRIPTION: * * Given N discrete events with different probabilities P[k] * * produce a value k consistent with its probability. * * * * REQUIRED: pointer to probability vector * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * ***************************************************************************** * * * REFERENCES: * * [1] Walker, A. J. (1974): New fast method for generating discrete * * random numbers with arbitrary frequency distributions, * * Electron. Lett. 10, pp. 127-128 * * * * [2] Walker, A. J. (1977): An efficient method for generating discrete * * random variables with general distributions, * * ACM Trans. Math. Software 3, pp. 253-256 * * * * [3] Kronmal, R. A. and Peterson, A. V. (1979): On the alias method for * * generating random variables from a discrete distribution, * * Amer. Statist. 33(4), pp. 214-218 * * * * [4] Peterson, A. V. and Kronmal, R. A. (1982): On mixture methods for * * the computer generation of random variables, * * Amer. Statist. 36(3), pp. 184-191 * * * * SUMMARY: * * [5] Devroye, L. (1986): Non-Uniform Random Variate Generation, New-York * * * * [6] Knuth, D. E. (1997): The Art of Computer Programming, * * Volume 2 (Seminumerical algorithms), 3rd edition, * * Addison-Wesley (1997), p.120 * * * * SEE ALSO: * * [7] Zaman, A. (1996), Generation of Random Numbers from an Arbitrary * * Unimodal Density by Cutting Corners, unpublished manuskript * * available at http://chenab.lums.edu.pk/~arifz/ * * * ***************************************************************************** * * * This algorithmus is based on [1,2]. It is an ingeneous method for * * generating random variates with finite probability vector which requires * * a table of size N and needs only one comparision. * * * * Walker's algorithm does some preprocessing, and provides two array: * * floating point Q[k] and integer J[k]. A value k is chosen from 0..N-1 * * with equal likelihood, and then a uniform random number u is compared to * * Q[k]. If it is less than Q[k], then k is returned. Otherwise, J[k] is * * returned. * * The method has been generalized in [4] to the "alias-urn" method that * * works in the exactly same way but uses a larger table of aliases. * * * * The original algorithm needs 2 uniform random numbers. By reusing only * * one is necessary (see [6]). * * * * Walker's original paper describes an O(N^2) algorithm for setting * * up the Q and J arrays. It had been improved in e.g. [3]. * * This implementation uses Marsaglia's "Robin Hood algorithm" (see [7]): * * This O(N) algorithm goes through all the p_k's and decides if they are * * are "poor" or "rich" according to whether they are less than or greater * * than (>=) the mean value 1 (For convienience we normalize the p_k's, * * s.t. there sum N instead of 1.). The indices to the poors and the richs * * are put in separate stacks, and then we work through the stacks together. * * We take from the next rich on the stack and give to the poor, s.t. it * * has the average value, and then it is popped from the stack of poors and * * stored in the tables Q and J. * * (Walker always wanted to pair up the poorest with the richest.) * * This reduces the size of the rich and even might become poor, i.e., * * it is popped from the stack of richs and pushed on the stack of poors. * * Since the size of the the two stacks together is <= N, we use one array * * and store the poors on the beginning and the richs at the and of an * * array of size N. * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include "unur_methods_source.h" #include "x_gen_source.h" #include "dau.h" #include "dau_struct.h" /*---------------------------------------------------------------------------*/ /* Variants: none */ /*---------------------------------------------------------------------------*/ /* Debugging flags */ /* bit 01 ... pameters and structure of generator (do not use here) */ /* bits 02-12 ... setup */ /* bits 13-24 ... adaptive steps */ /* bits 25-32 ... trace sampling */ #define DAU_DEBUG_REINIT 0x00000010u /* print parameters after reinit */ #define DAU_DEBUG_PRINTVECTOR 0x00000100u #define DAU_DEBUG_TABLE 0x00000200u /*---------------------------------------------------------------------------*/ /* Flags for logging set calls */ #define DAU_SET_URNFACTOR 0x01u /*---------------------------------------------------------------------------*/ #define GENTYPE "DAU" /* type of generator */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_dau_init( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* Initialize new generator. */ /*---------------------------------------------------------------------------*/ static int _unur_dau_reinit( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Reinitialize generator. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_dau_create( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* create new (almost empty) generator object. */ /*---------------------------------------------------------------------------*/ static int _unur_dau_check_par( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Check parameters of given distribution and method */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_dau_clone( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* copy (clone) generator object. */ /*---------------------------------------------------------------------------*/ static void _unur_dau_free( struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* destroy generator object. */ /*---------------------------------------------------------------------------*/ static int _unur_dau_sample( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* sample from generator */ /*---------------------------------------------------------------------------*/ static int _unur_dau_create_tables( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* create (allocate) tables for alias method */ /*---------------------------------------------------------------------------*/ static int _unur_dau_make_urntable( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* create table for alias method */ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ /* the following functions print debugging information on output stream, */ /* i.e., into the LOG file if not specified otherwise. */ /*---------------------------------------------------------------------------*/ static void _unur_dau_debug_init( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print after generator has been initialized has completed. */ /*---------------------------------------------------------------------------*/ static void _unur_dau_debug_table( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print data for alias table. */ /*---------------------------------------------------------------------------*/ #endif #ifdef UNUR_ENABLE_INFO static void _unur_dau_info( struct unur_gen *gen, int help ); /*---------------------------------------------------------------------------*/ /* create info string. */ /*---------------------------------------------------------------------------*/ #endif /*---------------------------------------------------------------------------*/ /* abbreviations */ #define DISTR_IN distr->data.discr /* data for distribution object */ #define PAR ((struct unur_dau_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_dau_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.discr /* data for distribution in generator object */ #define SAMPLE gen->sample.discr /* pointer to sampling routine */ /*---------------------------------------------------------------------------*/ #define _unur_dau_getSAMPLE(gen) (_unur_dau_sample) /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Public: User Interface (API) **/ /*****************************************************************************/ struct unur_par * unur_dau_new( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get default parameters */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* default parameters (pointer to structure) */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_par *par; /* check arguments */ _unur_check_NULL(GENTYPE,distr,NULL); /* check distribution */ if (distr->type != UNUR_DISTR_DISCR) { _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } COOKIE_CHECK(distr,CK_DISTR_DISCR,NULL); if (DISTR_IN.pv == NULL) { /* There is no PV try to compute it. */ if ( DISTR_IN.pmf && ( (((unsigned)DISTR_IN.domain[1] - (unsigned)DISTR_IN.domain[0]) < UNUR_MAX_AUTO_PV) || ( (distr->set & UNUR_DISTR_SET_PMFSUM) && DISTR_IN.domain[0] > INT_MIN ) ) ) { /* However this requires a PMF and either a bounded domain */ /* or the sum over the PMF. */ _unur_warning(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PV. Try to compute it."); } else { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PV"); return NULL; } } /* allocate structure */ par = _unur_par_new( sizeof(struct unur_dau_par) ); COOKIE_SET(par,CK_DAU_PAR); /* copy input */ par->distr = distr; /* pointer to distribution object */ /* set default values */ PAR->urn_factor = 1.; /* use same size for table */ par->method = UNUR_METH_DAU; /* method */ par->variant = 0u; /* default variant (no other variants) */ par->set = 0u; /* inidicate default parameters */ par->urng = unur_get_default_urng(); /* use default urng */ par->urng_aux = NULL; /* no auxilliary URNG required */ par->debug = _unur_default_debugflag; /* set default debugging flags */ /* routine for starting generator */ par->init = _unur_dau_init; return par; } /* end of unur_dau_new() */ /*---------------------------------------------------------------------------*/ int unur_dau_set_urnfactor( struct unur_par *par, double factor ) /*----------------------------------------------------------------------*/ /* set factor for relative size of urn */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* factor ... relative size of urn */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, DAU ); /* check new parameter for generator */ if (factor < 1.) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"relative urn size < 1."); return UNUR_ERR_PAR_SET; } /* store date */ PAR->urn_factor = factor; /* changelog */ par->set |= DAU_SET_URNFACTOR; return UNUR_SUCCESS; } /* end of unur_dau_set_urnfactor() */ /*****************************************************************************/ /** Private **/ /*****************************************************************************/ struct unur_gen * _unur_dau_init( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* initialize new generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); /* check input */ if ( par->method != UNUR_METH_DAU ) { _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); return NULL; } COOKIE_CHECK(par,CK_DAU_PAR,NULL); /* create a new empty generator object */ gen = _unur_dau_create(par); _unur_par_free(par); if (!gen) return NULL; /* check parameters */ if ( _unur_dau_check_par(gen) != UNUR_SUCCESS ) { _unur_dau_free(gen); return NULL; } /* compute table */ if ( (_unur_dau_create_tables(gen) != UNUR_SUCCESS) || (_unur_dau_make_urntable(gen) != UNUR_SUCCESS) ) { _unur_dau_free(gen); return NULL; } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_dau_debug_init(gen); #endif return gen; } /* end of _unur_dau_init() */ /*---------------------------------------------------------------------------*/ int _unur_dau_reinit( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* re-initialize (existing) generator. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int rcode; /* check parameters */ if ( (rcode = _unur_dau_check_par(gen)) != UNUR_SUCCESS) return rcode; /* compute table */ if ( ((rcode = _unur_dau_create_tables(gen)) != UNUR_SUCCESS) || ((rcode = _unur_dau_make_urntable(gen)) != UNUR_SUCCESS) ) { return rcode; } /* (re)set sampling routine */ SAMPLE = _unur_dau_getSAMPLE(gen); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug & DAU_DEBUG_REINIT) _unur_dau_debug_init(gen); #endif return UNUR_SUCCESS; } /* end of _unur_dau_reinit() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_dau_create( struct unur_par *par) /*----------------------------------------------------------------------*/ /* allocate memory for generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* pointer to (empty) generator object with default settings */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_DAU_PAR,NULL); /* create new generic generator object */ gen = _unur_generic_create( par, sizeof(struct unur_dau_gen) ); /* magic cookies */ COOKIE_SET(gen,CK_DAU_GEN); /* set generator identifier */ gen->genid = _unur_set_genid(GENTYPE); /* routines for sampling and destroying generator */ SAMPLE = _unur_dau_getSAMPLE(gen); gen->destroy = _unur_dau_free; gen->clone = _unur_dau_clone; gen->reinit = _unur_dau_reinit; /* copy parameters */ GEN->urn_factor = PAR->urn_factor; /* relative length of table */ /* initialize parameters */ GEN->len = 0; /* length of probability vector */ GEN->urn_size = 0; GEN->jx = NULL; GEN->qx = NULL; #ifdef UNUR_ENABLE_INFO /* set function for creating info string */ gen->info = _unur_dau_info; #endif /* return pointer to (almost empty) generator object */ return gen; } /* end of _unur_dau_create() */ /*---------------------------------------------------------------------------*/ int _unur_dau_check_par( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* check parameters of given distribution and method */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* we need a PV */ if (DISTR.pv == NULL) { /* try to compute PV */ if (unur_distr_discr_make_pv( gen->distr ) <= 0) { /* not successful */ _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PV"); return UNUR_ERR_DISTR_REQUIRED; } } return UNUR_SUCCESS; } /* end of _unur_dau_check_par() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_dau_clone( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* copy (clone) generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to clone of generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { #define CLONE ((struct unur_dau_gen*)clone->datap) struct unur_gen *clone; /* check arguments */ CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_DAU_GEN,NULL); /* create generic clone */ clone = _unur_generic_clone( gen, GENTYPE ); /* copy data for generator */ CLONE->jx = _unur_xmalloc( GEN->urn_size * sizeof(int) ); memcpy( CLONE->jx, GEN->jx, GEN->urn_size * sizeof(int) ); CLONE->qx = _unur_xmalloc( GEN->urn_size * sizeof(double) ); memcpy( CLONE->qx, GEN->qx, GEN->urn_size * sizeof(double) ); return clone; #undef CLONE } /* end of _unur_dau_clone() */ /*---------------------------------------------------------------------------*/ void _unur_dau_free( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* deallocate generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { /* check arguments */ if( !gen ) /* nothing to do */ return; /* check input */ if ( gen->method != UNUR_METH_DAU ) { _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); return; } COOKIE_CHECK(gen,CK_DAU_GEN,RETURN_VOID); /* we cannot use this generator object any more */ SAMPLE = NULL; /* make sure to show up a programming error */ /* free two auxiliary tables */ if (GEN->jx) free(GEN->jx); if (GEN->qx) free(GEN->qx); /* free memory */ _unur_generic_free(gen); } /* end of _unur_dau_free() */ /*****************************************************************************/ int _unur_dau_sample( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* integer (sample from random variate) */ /* */ /* error: */ /* return INT_MAX */ /*----------------------------------------------------------------------*/ { int iu; double u; /* check arguments */ CHECK_NULL(gen,INT_MAX); COOKIE_CHECK(gen,CK_DAU_GEN,INT_MAX); /* sample from U(0,urn_size) */ u = _unur_call_urng(gen->urng); u *= GEN->urn_size; iu = (int) u; /* immediate return ? */ if (iu >= GEN->len) return (GEN->jx[iu] + DISTR.domain[0]); /* else choose number or its alias at random */ u -= iu; /* reuse of random number */ return (((u <= GEN->qx[iu]) ? iu : GEN->jx[iu] ) + DISTR.domain[0]); } /* end of _unur_dau_sample() */ /*****************************************************************************/ /** Auxilliary Routines **/ /*****************************************************************************/ int _unur_dau_create_tables( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* allocate memory for tables */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* length of probability vector */ GEN->len = DISTR.n_pv; /* size of table */ GEN->urn_size = (int)(GEN->len * GEN->urn_factor); if (GEN->urn_size < GEN->len) /* do not use a table that is smaller then length of probability vector */ GEN->urn_size = GEN->len; /* allocate memory for the tables */ GEN->jx = _unur_xrealloc( GEN->jx, GEN->urn_size * sizeof(int) ); GEN->qx = _unur_xrealloc( GEN->qx, GEN->urn_size * sizeof(double) ); /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_dau_create_tables() */ /*---------------------------------------------------------------------------*/ int _unur_dau_make_urntable( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* create table for alias method using the Robin Hood algorithm */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int *begin, *poor, *rich; /* list of (rich and poor) strips */ int *npoor; /* next poor on stack */ double *pv; /* pointer to probability vector */ int n_pv; /* length of probability vector */ double sum, ratio; int i; /* aux variable */ /* probability vector */ pv = DISTR.pv; n_pv = DISTR.n_pv; /* compute sum of all probabilities */ for( sum=0, i=0; igenid,UNUR_ERR_GEN_DATA,"probability < 0"); return UNUR_ERR_GEN_DATA; } } /* make list of poor and rich strips */ begin = _unur_xmalloc( (GEN->urn_size+2) * sizeof(int) ); poor = begin; /* poor strips are stored at the beginning ... */ rich = begin + GEN->urn_size + 1; /* ... rich strips at the end of the list */ /* copy probability vector; scale so that it sums to GEN->urn_size and */ /* find rich and poor strips at start */ ratio = GEN->urn_size / sum; for( i=0; iqx[i] = pv[i] * ratio; /* probability rescaled */ if (GEN->qx[i] >= 1.) { /* rich strip */ *rich = i; /* add to list ... */ --rich; /* and update pointer */ GEN->jx[i] = i; /* init donor (itself) */ } else { /* poor strip */ *poor = i; /* add to list */ ++poor; /* update pointer */ /* it is not necessary to mark donor */ } } /* all other (additional) strips own nothing yet */ for( ; iurn_size; i++ ) { GEN->qx[i] = 0.; *poor = i; ++poor; } /* there must be at least one rich strip */ if (rich == begin + GEN->urn_size + 1 ) { /* this must not happen: no rich strips found for Robin Hood algorithm. */ _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); free (begin); return UNUR_ERR_SHOULD_NOT_HAPPEN; } /* rich must point to the first rich strip yet */ ++rich; /* now make the "squared histogram" with Robin Hood algorithm (Marsaglia) */ while (poor != begin) { if (rich > begin + GEN->urn_size + 1) { /* there might be something wrong; assume a neglectable round off error */ break; } npoor = poor - 1; /* take next poor from stack */ GEN->jx[*npoor] = *rich; /* store the donor */ GEN->qx[*rich] -= 1. - GEN->qx[*npoor]; /* update rich */ /* rich might has given too much, so it is poor then */ if (GEN->qx[*rich] < 1.) { *npoor = *rich; /* exchange noveau-poor with former poor in list */ ++rich; /* remove it from list of rich */ } else --poor; /* remove poor from list */ } /* if there has been an round off error, we have to complete the table */ if (poor != begin) { sum = 0.; /* we estimate the round off error */ while (poor != begin) { npoor = poor - 1; /* take next poor from stack */ sum += 1. - GEN->qx[*npoor]; GEN->jx[*npoor] = *npoor; /* mark donor as "not valid" */ GEN->qx[*npoor] = 1.; /* set probability to 1 (we assume that it is very close to one) */ --poor; /* remove from list */ } if (fabs(sum) > UNUR_SQRT_DBL_EPSILON) /* sum of deviations very large */ _unur_warning(gen->genid,UNUR_ERR_ROUNDOFF,"squared histogram"); } /* free list of strips */ free(begin); /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_dau_make_urntable() */ /*****************************************************************************/ /** Debugging utilities **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ void _unur_dau_debug_init( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write info about generator into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_DAU_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: type = discrete univariate random variate\n",gen->genid); fprintf(LOG,"%s: method = alias and alias-urn method\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); _unur_distr_discr_debug( gen->distr,gen->genid,(gen->debug & DAU_DEBUG_PRINTVECTOR)); fprintf(LOG,"%s: sampling routine = _unur_dau_sample()\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: length of probability vector = %d\n",gen->genid,GEN->len); fprintf(LOG,"%s: size of urn table = %d (rel. = %g%%", gen->genid,GEN->urn_size,100.*GEN->urn_factor); _unur_print_if_default(gen,DAU_SET_URNFACTOR); if (GEN->urn_size == GEN->len) fprintf(LOG,") (--> alias method)\n"); else fprintf(LOG,") (--> alias-urn method)\n"); fprintf(LOG,"%s:\n",gen->genid); if (gen->debug & DAU_DEBUG_TABLE) { _unur_dau_debug_table(gen); fprintf(LOG,"%s:\n",gen->genid); } } /* end of _unur_dau_debug_init() */ /*---------------------------------------------------------------------------*/ #define HIST_WIDTH 40 /* width of histogram for printing alias table */ void _unur_dau_debug_table( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* print alias table into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; int i, j, m; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_DAU_GEN,RETURN_VOID); LOG = unur_get_stream(); /* print head of table */ fprintf(LOG,"%s: alias table:\n", gen->genid); fprintf(LOG,"%s:\n", gen->genid); fprintf(LOG,"%s: ratio donor/acceptor",gen->genid); for (i=0; iurn_size; i++){ m = HIST_WIDTH * GEN->qx[i] + 0.5; fprintf(LOG,"%s:[%4d]: ", gen->genid,i); /* illustrate ratio donor/acceptor graphically */ for (j=0; jjx[i]); /* name donor */ fprintf(LOG," %6.3f%%\n", GEN->qx[i]*100); /* cut point */ } } /* end of _unur_dau_debug_table() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_INFO /*---------------------------------------------------------------------------*/ void _unur_dau_info( struct unur_gen *gen, int help ) /*----------------------------------------------------------------------*/ /* create character string that contains information about the */ /* given generator object. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* help ... whether to print additional comments */ /*----------------------------------------------------------------------*/ { struct unur_string *info = gen->infostr; /* generator ID */ _unur_string_append(info,"generator ID: %s\n\n", gen->genid); /* distribution */ _unur_string_append(info,"distribution:\n"); _unur_distr_info_typename(gen); _unur_string_append(info," functions = PV [length=%d%s]\n", DISTR.domain[1]-DISTR.domain[0]+1, (DISTR.pmf==NULL) ? "" : ", created from PMF"); _unur_string_append(info," domain = (%d, %d)\n", DISTR.domain[0],DISTR.domain[1]); _unur_string_append(info,"\n"); /* method */ _unur_string_append(info,"method: DAU (Alias-Urn)\n"); _unur_string_append(info,"\n"); /* performance */ _unur_string_append(info,"performance characteristics:\n"); _unur_string_append(info," E [#look-ups] = %g\n", 1+1./GEN->urn_factor); _unur_string_append(info,"\n"); /* parameters */ if (help) { _unur_string_append(info,"parameters:\n"); _unur_string_append(info," urnfactor = %g %s\n", GEN->urn_factor, (gen->set & DAU_SET_URNFACTOR) ? "" : "[default]"); _unur_string_append(info,"\n"); } /* Hints */ /* if (help) { */ /* _unur_string_append(info,"\n"); */ /* } */ } /* end of _unur_dau_info() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_INFO */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/tdr_newset.ch0000644001357500135600000014675714420445767015022 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: tdr_newset.c * * * * TYPE: continuous univariate random variate * * METHOD: transformed density rejection * * * * DESCRIPTION: * * Given PDF of a T-concave distribution * * produce a value x consistent with its density * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Public: User Interface (API) **/ /*****************************************************************************/ struct unur_par * unur_tdr_new( const struct unur_distr* distr ) /*----------------------------------------------------------------------*/ /* get default parameters */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* default parameters (pointer to structure) */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_par *par; /* check arguments */ _unur_check_NULL( GENTYPE,distr,NULL ); /* check distribution */ if (distr->type != UNUR_DISTR_CONT) { _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } COOKIE_CHECK(distr,CK_DISTR_CONT,NULL); if (DISTR_IN.pdf == NULL) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PDF"); return NULL; } if (DISTR_IN.dpdf == NULL) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"derivative of PDF"); return NULL; } /* allocate structure */ par = _unur_par_new( sizeof(struct unur_tdr_par) ); COOKIE_SET(par,CK_TDR_PAR); /* copy input */ par->distr = distr; /* pointer to distribution object */ /* set default values */ PAR->guide_factor = 2.; /* size of guide table / number of intervals */ PAR->c_T = -0.5; /* parameter for transformation (-1. <= c < 0.) */ PAR->starting_cpoints = NULL; /* pointer to array of starting points */ PAR->n_starting_cpoints = 30; /* number of starting points */ PAR->percentiles = NULL; /* pointer to array of percentiles */ PAR->n_percentiles = 2; /* number of percentiles */ PAR->retry_ncpoints = 50; /* number of cpoints for second trial of reinit */ PAR->max_ivs = 100; /* maximum number of intervals */ PAR->max_ratio = 0.99; /* bound for ratio Atotal / Asqueeze */ PAR->bound_for_adding = 0.5; /* do not add a new construction point in an interval, where ambigous region is too small, i.e. if area / ((A_hat - A_squeeze)/number of segments) < bound_for_adding */ PAR->darsfactor = 0.99; /* factor for derandomized ARS */ PAR->darsrule = 1; /* rule for finding splitting points in DARS */ par->method = UNUR_METH_TDR; /* method */ par->variant = ( TDR_VARFLAG_USECENTER | /* default variant */ TDR_VARFLAG_USEMODE | TDR_VARIANT_PS ); par->set = 0u; /* inidicate default parameters */ par->urng = unur_get_default_urng(); /* use default URNG */ par->urng_aux = par->urng; /* no special auxilliary URNG */ par->debug = _unur_default_debugflag; /* set default debugging flags */ /* routine for initializing generator */ par->init = _unur_tdr_init; return par; } /* end of unur_tdr_new() */ /*****************************************************************************/ int unur_tdr_set_cpoints( struct unur_par *par, int n_stp, const double *stp ) /*----------------------------------------------------------------------*/ /* set construction points for hat function */ /* and/or its number for initialization */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* n_stp ... number of starting points */ /* stp ... pointer to array of starting points */ /* (NULL for changing only the number of default points) */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int i; /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, TDR ); /* check starting construction points */ /* we always use the boundary points as additional starting points, so we do not count these here! */ if (n_stp < 0 ) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"number of starting points < 0"); return UNUR_ERR_PAR_SET; } if (stp) /* starting points must be strictly monontonically increasing */ for( i=1; istarting_cpoints = stp; PAR->n_starting_cpoints = n_stp; /* changelog */ par->set |= TDR_SET_N_STP | ((stp) ? TDR_SET_STP : 0); return UNUR_SUCCESS; } /* end of unur_tdr_set_cpoints() */ /*---------------------------------------------------------------------------*/ int unur_tdr_set_reinit_percentiles( struct unur_par *par, int n_percentiles, const double *percentiles ) /*----------------------------------------------------------------------*/ /* set percentiles for construction points for hat function */ /* and/or its number for re-initialization */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator */ /* n_percentiles ... number of percentiles */ /* percentiles ... pointer to array of percentiles */ /* (NULL for using a rule of thumb) */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int i; /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, TDR ); /* check given percentiles */ if (n_percentiles < 2 ) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"number of percentiles < 2. using defaults"); n_percentiles = 2; percentiles = NULL; } if (n_percentiles > 100 ) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"number of percentiles > 100. using 100"); n_percentiles = 100; } if (percentiles) { /* percentiles must be strictly monontonically increasing */ for( i=1; i 0.99) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"percentiles out of range"); return UNUR_ERR_PAR_SET; } } } /* store date */ PAR->percentiles = percentiles; PAR->n_percentiles = n_percentiles; /* changelog */ par->set |= TDR_SET_N_PERCENTILES | ((percentiles) ? TDR_SET_PERCENTILES : 0); return UNUR_SUCCESS; } /* end of unur_tdr_set_reinit_percentiles() */ /*---------------------------------------------------------------------------*/ int unur_tdr_chg_reinit_percentiles( struct unur_gen *gen, int n_percentiles, const double *percentiles ) /*----------------------------------------------------------------------*/ /* change percentiles for construction points for hat function */ /* and/or its number for re-initialization */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* n_percentiles ... number of percentiles */ /* percentiles ... pointer to array of percentiles */ /* (NULL for using a rule of thumb) */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int i; /* check input */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, TDR, UNUR_ERR_GEN_INVALID ); /* check given percentiles */ if (n_percentiles < 2 ) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"number of percentiles < 2. using defaults"); n_percentiles = 2; percentiles = NULL; } if (n_percentiles > 100 ) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"number of percentiles > 100. using 100"); n_percentiles = 100; } if (percentiles) { /* percentiles must be strictly monontonically increasing */ for( i=1; i 0.99) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"percentiles out of range"); return UNUR_ERR_PAR_SET; } } } /* store date */ GEN->n_percentiles = n_percentiles; GEN->percentiles = _unur_xrealloc( GEN->percentiles, n_percentiles * sizeof(double) ); if (percentiles) { memcpy( GEN->percentiles, percentiles, n_percentiles * sizeof(double) ); } else { if (n_percentiles == 2) { GEN->percentiles[0] = 0.25; GEN->percentiles[1] = 0.75; } else { for (i=0; ipercentiles[i] = (i + 1.) / (n_percentiles + 1.); } } /* changelog */ gen->set |= TDR_SET_N_PERCENTILES | ((percentiles) ? TDR_SET_PERCENTILES : 0); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_tdr_chg_reinit_percentiles() */ /*---------------------------------------------------------------------------*/ int unur_tdr_set_reinit_ncpoints( struct unur_par *par, int ncpoints ) /*----------------------------------------------------------------------*/ /* set number of construction points for second trial of reinit */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator */ /* ncpoints ... number of construction points */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, TDR ); /* check number */ if (ncpoints < 10 ) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"number of construction points < 10"); return UNUR_ERR_PAR_SET; } /* store date */ PAR->retry_ncpoints = ncpoints; /* changelog */ par->set |= TDR_SET_RETRY_NCPOINTS; return UNUR_SUCCESS; } /* end of unur_tdr_set_reinit_ncpoints() */ /*---------------------------------------------------------------------------*/ int unur_tdr_chg_reinit_ncpoints( struct unur_gen *gen, int ncpoints ) /*----------------------------------------------------------------------*/ /* change number of construction points for second trial of reinit */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* ncpoints ... number of construction points */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, TDR, UNUR_ERR_GEN_INVALID ); /* check number */ if (ncpoints < 10 ) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"number of construction points < 10"); return UNUR_ERR_PAR_SET; } /* store date */ GEN->retry_ncpoints = ncpoints; /* changelog */ gen->set |= TDR_SET_RETRY_NCPOINTS; return UNUR_SUCCESS; } /* end of unur_tdr_chg_reinit_ncpoints() */ /*---------------------------------------------------------------------------*/ int unur_tdr_set_guidefactor( struct unur_par *par, double factor ) /*----------------------------------------------------------------------*/ /* set factor for relative size of guide table */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* factor ... relative size of table */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, TDR ); /* check new parameter for generator */ if (factor < 0.) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"guide table size < 0"); return UNUR_ERR_PAR_SET; } /* store date */ PAR->guide_factor = factor; /* changelog */ par->set |= TDR_SET_GUIDEFACTOR; return UNUR_SUCCESS; } /* end of unur_tdr_set_guidefactor() */ /*---------------------------------------------------------------------------*/ int unur_tdr_set_max_sqhratio( struct unur_par *par, double max_ratio ) /*----------------------------------------------------------------------*/ /* set bound for ratio A(squeeze) / A(hat) */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* max_ratio ... upper bound for ratio to add a new construction point*/ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, TDR ); /* check new parameter for generator */ if (max_ratio < 0. || max_ratio > 1.+DBL_EPSILON ) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"ratio A(squeeze)/A(hat) not in [0,1]"); return UNUR_ERR_PAR_SET; } /* store date */ PAR->max_ratio = max_ratio; /* changelog */ par->set |= TDR_SET_MAX_SQHRATIO; return UNUR_SUCCESS; } /* end of unur_tdr_set_max_sqhratio() */ /*---------------------------------------------------------------------------*/ double unur_tdr_get_sqhratio( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* get ratio A(squeeze) / A(hat) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* ratio ... on success */ /* UNUR_INFINITY ... on error */ /*----------------------------------------------------------------------*/ { /* check input */ _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); _unur_check_gen_object( gen, TDR, UNUR_INFINITY ); return (GEN->Asqueeze / GEN->Atotal); } /* end of unur_tdr_get_sqhratio() */ /*---------------------------------------------------------------------------*/ double unur_tdr_get_hatarea( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* get area below hat */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* area ... on success */ /* UNUR_INFINITY ... on error */ /*----------------------------------------------------------------------*/ { /* check input */ _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); _unur_check_gen_object( gen, TDR, UNUR_INFINITY ); return GEN->Atotal; } /* end of unur_tdr_get_hatarea() */ /*---------------------------------------------------------------------------*/ double unur_tdr_get_squeezearea( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* get area below squeeze */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* area ... on success */ /* UNUR_INFINITY ... on error */ /*----------------------------------------------------------------------*/ { /* check input */ _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); _unur_check_gen_object( gen, TDR, UNUR_INFINITY ); return GEN->Asqueeze; } /* end of unur_tdr_get_squeezearea() */ /*---------------------------------------------------------------------------*/ int unur_tdr_set_max_intervals( struct unur_par *par, int max_ivs ) /*----------------------------------------------------------------------*/ /* set maximum number of intervals */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* max_ivs ... maximum number of intervals */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, TDR ); /* check new parameter for generator */ if (max_ivs < 1 ) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"maximum number of intervals < 1"); return UNUR_ERR_PAR_SET; } /* store date */ PAR->max_ivs = max_ivs; /* changelog */ par->set |= TDR_SET_MAX_IVS; return UNUR_SUCCESS; } /* end of unur_tdr_set_max_intervals() */ /*---------------------------------------------------------------------------*/ int _unur_tdr_is_ARS_running( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* check whether more points will be added by adaptive rejection */ /* sampling */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* TRUE ... if ARS is still running. */ /* FALSE ... otherwise. */ /*----------------------------------------------------------------------*/ { /* check input */ _unur_check_NULL( GENTYPE, gen, FALSE ); _unur_check_gen_object( gen, TDR, FALSE ); return (GEN->n_ivs < GEN->max_ivs) ? TRUE : FALSE; } /* end of _unur_tdr_is_ARS_running() */ /*---------------------------------------------------------------------------*/ int unur_tdr_set_usecenter( struct unur_par *par, int usecenter ) /*----------------------------------------------------------------------*/ /* set flag for using center as construction point */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* usecenter ... 0 = do not use, !0 = use */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* using center as construction point is the default */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, TDR ); /* we use a bit in variant */ par->variant = (usecenter) ? (par->variant | TDR_VARFLAG_USECENTER) : (par->variant & (~TDR_VARFLAG_USECENTER)); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_tdr_set_usecenter() */ /*---------------------------------------------------------------------------*/ int unur_tdr_set_usemode( struct unur_par *par, int usemode ) /*----------------------------------------------------------------------*/ /* set flag for using (exact) mode as construction point */ /* (this overwrites "use_center"!) */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* usemode ... 0 = do not use, !0 = use */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* using mode as construction point is the default */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, TDR ); /* we use a bit in variant */ par->variant = (usemode) ? (par->variant | TDR_VARFLAG_USEMODE) : (par->variant & (~TDR_VARFLAG_USEMODE)); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_tdr_set_usemode() */ /*---------------------------------------------------------------------------*/ int unur_tdr_set_variant_gw( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* use original variant with squeezes as proposed by Gilks & Wild */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, TDR ); /* we use a bit in variant */ par->variant = (par->variant & ~TDR_VARMASK_VARIANT) | TDR_VARIANT_GW; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_tdr_set_variant_gw() */ /*---------------------------------------------------------------------------*/ int unur_tdr_set_variant_ps( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* Use squeezes proportional to the hat function */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, TDR ); /* we use a bit in variant */ par->variant = (par->variant & ~TDR_VARMASK_VARIANT) | TDR_VARIANT_PS; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_tdr_set_variant_ps() */ /*---------------------------------------------------------------------------*/ int unur_tdr_set_variant_ia( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* Use squeezes proportional to the hat function together with a */ /* composition method that required less uniform random numbers. */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, TDR ); /* we use a bit in variant */ par->variant = (par->variant & ~TDR_VARMASK_VARIANT) | TDR_VARIANT_IA; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_tdr_set_variant_ia() */ /*---------------------------------------------------------------------------*/ int unur_tdr_set_usedars( struct unur_par *par, int usedars ) /*----------------------------------------------------------------------*/ /* set flag for using DARS (derandomized adaptive rejection sampling). */ /* additionally the rule for splitting intervals can be set. */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* usedars ... 0 = do not use, 1-3 = use DARS with given rule */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* using not using DARS is the default */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, TDR ); /* check new parameter for generator */ if (usedars < 0 || usedars > 3) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"invalid rule for DARS"); return UNUR_ERR_PAR_SET; } /* set rule for DARS */ PAR->darsrule = usedars; /* we use a bit in variant */ par->variant = (usedars) ? (par->variant | TDR_VARFLAG_USEDARS) : (par->variant & (~TDR_VARFLAG_USEDARS)); /* changelog */ par->set |= TDR_SET_USE_DARS; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_tdr_set_usedars() */ /*---------------------------------------------------------------------------*/ int unur_tdr_set_darsfactor( struct unur_par *par, double factor ) /*----------------------------------------------------------------------*/ /* set factor for derandomized adaptive rejection sampling */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* factor ... parameter for DARS */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, TDR ); /* check new parameter for generator */ if (factor < 0.) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"DARS factor < 0"); return UNUR_ERR_PAR_SET; } /* store date */ PAR->darsfactor = factor; /* changelog */ par->set |= TDR_SET_DARS_FACTOR; return UNUR_SUCCESS; } /* end of unur_tdr_set_darsfactor() */ /*---------------------------------------------------------------------------*/ int unur_tdr_set_c( struct unur_par *par, double c ) /*----------------------------------------------------------------------*/ /* set parameter c for transformation T_c */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* c ... parameter c */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, TDR ); /* check new parameter for generator */ if (c > 0.) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"c > 0"); return UNUR_ERR_PAR_SET; } /** TODO: ... **/ /* if (c <= -1.) { */ /* _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"c <= -1 only if domain is bounded. Use `TABL' method then."); */ /* return 0; */ /* } */ /** TODO: ... **/ if (c < -0.5) { _unur_error(GENTYPE,UNUR_ERR_PAR_SET,"c < -0.5 not implemented yet"); return UNUR_ERR_PAR_SET; } if (!_unur_iszero(c) && c > -0.5) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"-0.5 < c < 0 not recommended. using c = -0.5 instead."); c = -0.5; } /* store date */ PAR->c_T = c; /* changelog */ par->set |= TDR_SET_C; return UNUR_SUCCESS; } /* end of unur_tdr_set_c() */ /*---------------------------------------------------------------------------*/ int unur_tdr_set_verify( struct unur_par *par, int verify ) /*----------------------------------------------------------------------*/ /* turn verifying of algorithm while sampling on/off */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* verify ... 0 = no verifying, !0 = verifying */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* no verifying is the default */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, TDR ); /* we use a bit in variant */ par->variant = (verify) ? (par->variant | TDR_VARFLAG_VERIFY) : (par->variant & (~TDR_VARFLAG_VERIFY)); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_tdr_set_verify() */ /*---------------------------------------------------------------------------*/ int unur_tdr_chg_verify( struct unur_gen *gen, int verify ) /*----------------------------------------------------------------------*/ /* turn verifying of algorithm while sampling on/off */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* verify ... 0 = no verifying, !0 = verifying */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* no verifying is the default */ /*----------------------------------------------------------------------*/ { /* check input */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, TDR, UNUR_ERR_GEN_INVALID ); /* we must not change this switch when sampling has been disabled by using a pointer to the error producing routine */ if (SAMPLE == _unur_sample_cont_error) return UNUR_FAILURE; /* we use a bit in variant */ gen->variant = (verify) ? (gen->variant | TDR_VARFLAG_VERIFY) : (gen->variant & (~TDR_VARFLAG_VERIFY)); /* sampling routines */ SAMPLE = _unur_tdr_getSAMPLE(gen); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_tdr_chg_verify() */ /*---------------------------------------------------------------------------*/ int unur_tdr_set_pedantic( struct unur_par *par, int pedantic ) /*----------------------------------------------------------------------*/ /* turn pedantic mode on/off */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* pedantic ... 0 = no pedantic mode, !0 = use pedantic mode */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* pedantic is the default */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, TDR ); /* we use a bit in variant */ par->variant = (pedantic) ? (par->variant | TDR_VARFLAG_PEDANTIC) : (par->variant & (~TDR_VARFLAG_PEDANTIC)); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_tdr_set_pedantic() */ /*---------------------------------------------------------------------------*/ int unur_tdr_chg_truncated( struct unur_gen *gen, double left, double right ) /*----------------------------------------------------------------------*/ /* change the left and right borders of the domain of the distribution */ /* the new domain should not exceed the original domain given by */ /* unur_distr_cont_set_domain(). Otherwise it is truncated. */ /* */ /* This call does not work for variant IA (immediate acceptance). */ /* In this case it switches to variant PS!! */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* left ... left boundary point */ /* right ... right boundary point */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* the new boundary points may be +/- UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { double Umin, Umax; /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, TDR, UNUR_ERR_GEN_INVALID ); /* we have to disable adaptive rejection sampling */ if (GEN->max_ivs > GEN->n_ivs) { _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"adaptive rejection sampling disabled for truncated distribution"); GEN->max_ivs = GEN->n_ivs; } /* we cannot use immadate acceptance (IA), switch to variant PS instead */ if ((gen->variant & TDR_VARMASK_VARIANT) == TDR_VARIANT_IA) { _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"cannot use IA for truncated distribution, switch to PS"); /* change variante flag */ gen->variant = (gen->variant & ~TDR_VARMASK_VARIANT) | TDR_VARIANT_PS; /* change sampling routine */ SAMPLE = (gen->variant & TDR_VARFLAG_VERIFY) ? _unur_tdr_ps_sample_check : _unur_tdr_ps_sample; } /* check new parameter for generator */ /* (the truncated domain must be a subset of the domain) */ if (left < DISTR.domain[0]) { _unur_warning(NULL,UNUR_ERR_DISTR_SET,"truncated domain not subset of domain"); left = DISTR.domain[0]; } if (right > DISTR.domain[1]) { _unur_warning(NULL,UNUR_ERR_DISTR_SET,"truncated domain not subset of domain"); right = DISTR.domain[1]; } if (left >= right) { _unur_warning(NULL,UNUR_ERR_DISTR_SET,"domain, left >= right"); return UNUR_ERR_DISTR_SET; } /* compute CDF at x (with respect to given domain of distribution) */ Umin = _unur_tdr_eval_cdfhat(gen,left); Umax = (right < DISTR.domain[1]) ? _unur_tdr_eval_cdfhat(gen,right) : 1.; /* check result */ if (Umin > Umax) { /* this is a serios error that should not happen */ _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); return UNUR_ERR_SHOULD_NOT_HAPPEN; } if (_unur_FP_equal(Umin,Umax)) { /* CDF values very close */ _unur_warning(gen->genid,UNUR_ERR_DISTR_SET,"CDF values very close"); if (_unur_iszero(Umin) || _unur_FP_same(Umax,1.)) { /* this is very bad */ _unur_warning(gen->genid,UNUR_ERR_DISTR_SET,"CDF values at boundary points too close"); return UNUR_ERR_DISTR_SET; } } /* set bounds for truncated domain and for U (CDF) */ DISTR.trunc[0] = left; DISTR.trunc[1] = right; GEN->Umin = Umin; GEN->Umax = Umax; /* changelog */ gen->distr->set |= UNUR_DISTR_SET_TRUNCATED; #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ #endif /* o.k. */ return UNUR_SUCCESS; } /* end of unur_tdr_chg_truncated() */ /*---------------------------------------------------------------------------*/ double _unur_tdr_eval_cdfhat( struct unur_gen *gen, double x ) /*----------------------------------------------------------------------*/ /* evaluate CDF of hat at x (i.e. \int_{-\infty}^x hat(t) dt) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* x ... point at which hat(x) has to be computed */ /* */ /* return: */ /* CDF of hat(x) or */ /* UNUR_INFINITY in case of error */ /* */ /* Important: */ /* If gen is a generator object for variant IA (immediate acceptance) */ /* then it is treated like variant PS (proportional squeeze)! */ /* This is necessary since variant IA is not a pure rejection */ /* algorithm, but a composition method. */ /*----------------------------------------------------------------------*/ { struct unur_tdr_interval *iv; double Aint; double cdf; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_INFINITY); /* the easy case: left and right boundary of domain */ if (x <= DISTR.domain[0]) return 0.; if (x >= DISTR.domain[1]) return 1.; /* there are differencies between variant GW and variant PS */ switch (gen->variant & TDR_VARMASK_VARIANT) { case TDR_VARIANT_GW: /* original variant (Gilks&Wild) */ /* find interval (sequential search) */ for (iv = GEN->iv; iv->next!=NULL; iv=iv->next) { COOKIE_CHECK(iv,CK_TDR_IV,UNUR_INFINITY); /* iv->x is left construction point of interval */ if (x < iv->next->x) break; } if (iv->next == NULL) /* right boundary of domain */ return 1.; /* now iv->x < x <= iv->next->x */ /* compute are below hat between construction point of tangent and x. */ /* we have to cases on either side of the intersection point. */ if (x < iv->ip) { /* left h.s. of intersection point */ Aint = _unur_tdr_interval_area( gen, iv, iv->dTfx, x); if (!_unur_isfinite(Aint)) { /* this should not happen */ Aint = 0.; } /* Notice: iv->prev->Acum == iv->Acum - iv->Ahat; */ cdf = (iv->prev) ? iv->prev->Acum + Aint : Aint; } else { /* right h.s. of intersection point */ Aint = _unur_tdr_interval_area( gen, iv->next, iv->next->dTfx, x); if (!_unur_isfinite(Aint)) { /* this should not happen */ Aint = 0.; } cdf = iv->Acum - Aint; if (cdf < 0.) return 0.; } /* normalize to one (and mind round-off errors) */ cdf /= GEN->Atotal; return ((cdf > 1.) ? 1. : cdf); case TDR_VARIANT_IA: /* immediate acceptance */ /* See comment above */ case TDR_VARIANT_PS: /* proportional squeeze */ /* find interval (sequential search) */ for (iv = GEN->iv; iv->next!=NULL; iv=iv->next) { COOKIE_CHECK(iv,CK_TDR_IV,UNUR_INFINITY); if (x <= iv->next->ip) break; } if (iv->next == NULL) /* right boundary of domain */ return 1.; /* now iv->ip < x <= iv->next->ip */ /* area below hat between construction point and x */ Aint = _unur_tdr_interval_area( gen, iv, iv->dTfx, x); if (!_unur_isfinite(Aint)) { /* this should not happen */ Aint = 0.; } /* compute CDF of hat */ cdf = ((x>iv->x) ? Aint : -Aint) + iv->Acum - iv->Ahatr; /* normalize to one (and mind round-off errors) */ if (cdf < 0.) return 0.; cdf /= GEN->Atotal; return ((cdf > 1.) ? 1. : cdf); default: _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); return UNUR_INFINITY; } } /* end of _unur_tdr_eval_cdfhat() */ /*****************************************************************************/ unuran-1.11.0/src/methods/hri.h0000644001357500135600000001530214420304141013214 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: hri.h * * * * PURPOSE: * * function prototypes for method HRI * * (Hazard Rate Increasing) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /* =METHOD HRI Hazard Rate Increasing =UP Methods_for_CONT =REQUIRED increasing (non-decreasing) hazard rate =SPEED Set-up: fast, Sampling: slow =REINIT supported =REF [HLD04: Sect.9.1.6, Alg.9.6] =DESCRIPTION Generates random variate with given non-increasing hazard rate. It is necessary that the distribution object contains this hazard rate. Increasing hazard rate implies that the corresponding PDF of the distribution has heavier tails than the exponential distribution (which has constant hazard rate). The method uses a decomposition of the hazard rate into a main part which is constant for all @i{x} beyond some point @i{p0} and a remaining part. From both of these parts points are sampled using the thinning method and the minimum of both is returned. Sampling from the first part is easier as we have a constant dominating hazard rate. Thus @i{p0} should be large. On the other hand, if @i{p0} is large than the thinning algorithm needs many iteration. Thus the performance of the the algorithm deponds on the choice of @i{p0}. We found that values close to the expectation of the generated distribution result in good performance. =HOWTOUSE HRI requires a hazard function for a continuous distribution with non-decreasing hazard rate. The parameter @i{p0} should be set to a value close to the expectation of the required distribution using unur_hri_set_p0(). If performance is crucial one may try other values as well. It is important to note that the domain of the distribution can be set via a unur_distr_cont_set_domain() call. However, only the left hand boundary is used. For computational reasons the right hand boundary is always reset to @code{UNUR_INFINITY}. If no domain is given by the user then the left hand boundary is set to @code{0}. For distributions with decreasing hazard rate method HRD (@pxref{HRI,,Hazard Rate Decreasing}) is required. For distributions which do not have increasing or decreasing hazard rates but are bounded from above use method HRB (@pxref{HRB,,Hazard Rate Bounded}). It is possible to change the parameters and the domain of the chosen distribution and run unur_reinit() to reinitialize the generator object. Notice, that the upper bound given by the unur_hrb_set_upperbound() call cannot be changed and must be valid for the changed distribution. Notice that the parameter @i{p0} which has been set by a unur_hri_set_p0() call cannot be changed and must be valid for the changed distribution. =END */ /*---------------------------------------------------------------------------*/ /* Routines for user interface */ /* =ROUTINES */ UNUR_PAR *unur_hri_new( const UNUR_DISTR *distribution ); /* Get default parameters for generator. */ /*...........................................................................*/ int unur_hri_set_p0( UNUR_PAR *parameters, double p0 ); /* Set design point for algorithm. It is used to split the domain of the distribution. Values for @var{p0} close to the expectation of the distribution results in a relatively good performance of the algorithm. It is important that the hazard rate at this point must be greater than @code{0} and less than @code{UNUR_INFINITY}. Default: left boundary of domain + @code{1.} */ int unur_hri_set_verify( UNUR_PAR *parameters, int verify ); /* */ int unur_hri_chg_verify( UNUR_GEN *generator, int verify ); /* Turn verifying of algorithm while sampling on/off. If the hazard rate is not bounded by the given bound, then @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. Default is FALSE. */ /* =END */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/unif.h0000644001357500135600000000763314420445767013427 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: unif.h * * * * PURPOSE: * * function prototypes for method UNIF * * (passes UNIForm random numbers through UNU.RAN framework; * * for testing only) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /* =METHOD UNIF wrapper for UNIForm random number generator =UP Methods_for_UNID =REINIT supported =DESCRIPTION UNIF is a simple wrapper that makes it possible to use a uniform random number generator as a UNU.RAN generator. There are no parameters for this method. =HOWTOUSE Create a generator object with NULL as argument. The created generator object returns raw random numbers from the underlying uniform random number generator. =END */ /*---------------------------------------------------------------------------*/ /* Routines for user interface */ /* =ROUTINES */ UNUR_PAR *unur_unif_new( const UNUR_DISTR *dummy ); /* Get default parameters for generator. UNIF does not need a distribution object. @var{dummy} is not used and can (should) be set to NULL. It is used to keep the API consistent. */ /* =END */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/Makefile.in0000644001357500135600000007301214430713360014340 00000000000000# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = src/methods ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libmethods_la_LIBADD = am__libmethods_la_SOURCES_DIST = deprecated_methods.c \ deprecated_methods.h deprecated_tdrgw.h deprecated_vmt.c \ deprecated_vmt.h deprecated_vmt_struct.h x_gen.c x_gen.h \ x_gen_struct.h x_gen_source.h auto.c auto.h auto_struct.h \ arou.c arou.h arou_struct.h ars.c ars.h ars_struct.h cext.c \ cext.h cext_struct.h cstd.c cstd.h cstd_struct.h dari.c dari.h \ dari_struct.h dau.c dau.h dau_struct.h dext.c dext.h \ dext_struct.h dgt.c dgt.h dgt_struct.h dsrou.c dsrou.h \ dsrou_struct.h dss.c dss.h dss_struct.h dstd.c dstd.h \ dstd_struct.h empk.c empk.h empk_struct.h empl.c empl.h \ empl_struct.h gibbs.c gibbs.h gibbs_struct.h hinv.c hinv.h \ hinv_struct.h hist.c hist.h hist_struct.h hitro.c hitro.h \ hitro_struct.h hrb.c hrb.h hrb_struct.h hrd.c hrd.h \ hrd_struct.h hri.c hri.h hri_struct.h itdr.c itdr.h \ itdr_struct.h mcorr.c mcorr.h mcorr_struct.h mixt.c mixt.h \ mixt_struct.h mvstd.c mvstd.h mvstd_struct.h mvtdr.c mvtdr.h \ mvtdr_struct.h mvtdr_newset.ch mvtdr_init.ch mvtdr_sample.ch \ mvtdr_info.ch mvtdr_debug.ch ninv.c ninv.h ninv_struct.h \ ninv_newset.ch ninv_init.ch ninv_sample.ch ninv_newton.ch \ ninv_regula.ch ninv_debug.ch ninv_info.ch norta.c norta.h \ norta_struct.h nrou.c nrou.h nrou_struct.h pinv.c pinv.h \ pinv_struct.h pinv_newset.ch pinv_init.ch pinv_sample.ch \ pinv_prep.ch pinv_newton.ch pinv_debug.ch pinv_info.ch srou.c \ srou.h srou_struct.h ssr.c ssr.h ssr_struct.h tabl.c tabl.h \ tabl_struct.h tabl_newset.ch tabl_init.ch tabl_sample.ch \ tabl_debug.ch tabl_info.ch tdr.c tdr.h tdr_struct.h \ tdr_newset.ch tdr_init.ch tdr_gw_init.ch tdr_ps_init.ch \ tdr_sample.ch tdr_gw_sample.ch tdr_ps_sample.ch \ tdr_ia_sample.ch tdr_debug.ch tdr_gw_debug.ch tdr_ps_debug.ch \ tdr_info.ch unif.c unif.h unif_struct.h utdr.c utdr.h \ utdr_struct.h vempk.c vempk.h vempk_struct.h vnrou.c vnrou.h \ vnrou_struct.h @ENABLE_DEPRECATED_TRUE@am__objects_1 = deprecated_methods.lo \ @ENABLE_DEPRECATED_TRUE@ deprecated_vmt.lo am_libmethods_la_OBJECTS = $(am__objects_1) x_gen.lo auto.lo arou.lo \ ars.lo cext.lo cstd.lo dari.lo dau.lo dext.lo dgt.lo dsrou.lo \ dss.lo dstd.lo empk.lo empl.lo gibbs.lo hinv.lo hist.lo \ hitro.lo hrb.lo hrd.lo hri.lo itdr.lo mcorr.lo mixt.lo \ mvstd.lo mvtdr.lo ninv.lo norta.lo nrou.lo pinv.lo srou.lo \ ssr.lo tabl.lo tdr.lo unif.lo utdr.lo vempk.lo vnrou.lo libmethods_la_OBJECTS = $(am_libmethods_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/arou.Plo ./$(DEPDIR)/ars.Plo \ ./$(DEPDIR)/auto.Plo ./$(DEPDIR)/cext.Plo ./$(DEPDIR)/cstd.Plo \ ./$(DEPDIR)/dari.Plo ./$(DEPDIR)/dau.Plo \ ./$(DEPDIR)/deprecated_methods.Plo \ ./$(DEPDIR)/deprecated_vmt.Plo ./$(DEPDIR)/dext.Plo \ ./$(DEPDIR)/dgt.Plo ./$(DEPDIR)/dsrou.Plo ./$(DEPDIR)/dss.Plo \ ./$(DEPDIR)/dstd.Plo ./$(DEPDIR)/empk.Plo ./$(DEPDIR)/empl.Plo \ ./$(DEPDIR)/gibbs.Plo ./$(DEPDIR)/hinv.Plo \ ./$(DEPDIR)/hist.Plo ./$(DEPDIR)/hitro.Plo ./$(DEPDIR)/hrb.Plo \ ./$(DEPDIR)/hrd.Plo ./$(DEPDIR)/hri.Plo ./$(DEPDIR)/itdr.Plo \ ./$(DEPDIR)/mcorr.Plo ./$(DEPDIR)/mixt.Plo \ ./$(DEPDIR)/mvstd.Plo ./$(DEPDIR)/mvtdr.Plo \ ./$(DEPDIR)/ninv.Plo ./$(DEPDIR)/norta.Plo \ ./$(DEPDIR)/nrou.Plo ./$(DEPDIR)/pinv.Plo ./$(DEPDIR)/srou.Plo \ ./$(DEPDIR)/ssr.Plo ./$(DEPDIR)/tabl.Plo ./$(DEPDIR)/tdr.Plo \ ./$(DEPDIR)/unif.Plo ./$(DEPDIR)/utdr.Plo \ ./$(DEPDIR)/vempk.Plo ./$(DEPDIR)/vnrou.Plo \ ./$(DEPDIR)/x_gen.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libmethods_la_SOURCES) DIST_SOURCES = $(am__libmethods_la_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(noinst_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autoconf/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILECMD = @FILECMD@ GREP = @GREP@ HAVE_DIVIDE_BY_ZERO = @HAVE_DIVIDE_BY_ZERO@ HAVE_IEEE_COMPARISONS = @HAVE_IEEE_COMPARISONS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNURAN_LT_VERSION = @UNURAN_LT_VERSION@ UNURAN_SUPPORTS_GSL = @UNURAN_SUPPORTS_GSL@ UNURAN_SUPPORTS_PRNG = @UNURAN_SUPPORTS_PRNG@ UNURAN_SUPPORTS_RNGSTREAM = @UNURAN_SUPPORTS_RNGSTREAM@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ have_valgrind = @have_valgrind@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = \ -I$(top_srcdir)/src noinst_LTLIBRARIES = libmethods.la @ENABLE_DEPRECATED_FALSE@DEPRECATED_FILES = # Files that contain deprecated routines @ENABLE_DEPRECATED_TRUE@DEPRECATED_FILES = \ @ENABLE_DEPRECATED_TRUE@ deprecated_methods.c deprecated_methods.h \ @ENABLE_DEPRECATED_TRUE@ deprecated_tdrgw.h \ @ENABLE_DEPRECATED_TRUE@ deprecated_vmt.c deprecated_vmt.h deprecated_vmt_struct.h libmethods_la_SOURCES = \ $(DEPRECATED_FILES) \ \ x_gen.c x_gen.h x_gen_struct.h x_gen_source.h \ \ auto.c auto.h auto_struct.h \ arou.c arou.h arou_struct.h \ ars.c ars.h ars_struct.h \ cext.c cext.h cext_struct.h \ cstd.c cstd.h cstd_struct.h \ dari.c dari.h dari_struct.h \ dau.c dau.h dau_struct.h \ dext.c dext.h dext_struct.h \ dgt.c dgt.h dgt_struct.h \ dsrou.c dsrou.h dsrou_struct.h \ dss.c dss.h dss_struct.h \ dstd.c dstd.h dstd_struct.h \ empk.c empk.h empk_struct.h \ empl.c empl.h empl_struct.h \ gibbs.c gibbs.h gibbs_struct.h \ hinv.c hinv.h hinv_struct.h \ hist.c hist.h hist_struct.h \ hitro.c hitro.h hitro_struct.h \ hrb.c hrb.h hrb_struct.h \ hrd.c hrd.h hrd_struct.h \ hri.c hri.h hri_struct.h \ itdr.c itdr.h itdr_struct.h \ mcorr.c mcorr.h mcorr_struct.h \ mixt.c mixt.h mixt_struct.h \ mvstd.c mvstd.h mvstd_struct.h \ mvtdr.c mvtdr.h mvtdr_struct.h \ mvtdr_newset.ch mvtdr_init.ch mvtdr_sample.ch \ mvtdr_info.ch mvtdr_debug.ch \ ninv.c ninv.h ninv_struct.h \ ninv_newset.ch ninv_init.ch ninv_sample.ch \ ninv_newton.ch ninv_regula.ch \ ninv_debug.ch ninv_info.ch \ norta.c norta.h norta_struct.h \ nrou.c nrou.h nrou_struct.h \ pinv.c pinv.h pinv_struct.h \ pinv_newset.ch pinv_init.ch pinv_sample.ch \ pinv_prep.ch pinv_newton.ch \ pinv_debug.ch pinv_info.ch \ srou.c srou.h srou_struct.h \ ssr.c ssr.h ssr_struct.h \ tabl.c tabl.h tabl_struct.h tabl_newset.ch \ tabl_init.ch tabl_sample.ch tabl_debug.ch tabl_info.ch \ tdr.c tdr.h tdr_struct.h tdr_newset.ch \ tdr_init.ch tdr_gw_init.ch tdr_ps_init.ch \ tdr_sample.ch tdr_gw_sample.ch tdr_ps_sample.ch tdr_ia_sample.ch \ tdr_debug.ch tdr_gw_debug.ch tdr_ps_debug.ch tdr_info.ch \ unif.c unif.h unif_struct.h \ utdr.c utdr.h utdr_struct.h \ vempk.c vempk.h vempk_struct.h \ vnrou.c vnrou.h vnrou_struct.h noinst_HEADERS = \ unur_methods.h \ unur_methods_source.h # clean backup files CLEANFILES = *~ # clean generated files MAINTAINERCLEANFILES = \ Makefile.in all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/methods/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/methods/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libmethods.la: $(libmethods_la_OBJECTS) $(libmethods_la_DEPENDENCIES) $(EXTRA_libmethods_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libmethods_la_OBJECTS) $(libmethods_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arou.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ars.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/auto.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cext.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cstd.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dari.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dau.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/deprecated_methods.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/deprecated_vmt.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dext.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dgt.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dsrou.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dss.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dstd.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/empk.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/empl.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gibbs.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hinv.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hist.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hitro.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hrb.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hrd.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hri.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/itdr.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mcorr.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mixt.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mvstd.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mvtdr.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ninv.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/norta.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nrou.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pinv.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/srou.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssr.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tabl.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tdr.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unif.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utdr.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vempk.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vnrou.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_gen.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/arou.Plo -rm -f ./$(DEPDIR)/ars.Plo -rm -f ./$(DEPDIR)/auto.Plo -rm -f ./$(DEPDIR)/cext.Plo -rm -f ./$(DEPDIR)/cstd.Plo -rm -f ./$(DEPDIR)/dari.Plo -rm -f ./$(DEPDIR)/dau.Plo -rm -f ./$(DEPDIR)/deprecated_methods.Plo -rm -f ./$(DEPDIR)/deprecated_vmt.Plo -rm -f ./$(DEPDIR)/dext.Plo -rm -f ./$(DEPDIR)/dgt.Plo -rm -f ./$(DEPDIR)/dsrou.Plo -rm -f ./$(DEPDIR)/dss.Plo -rm -f ./$(DEPDIR)/dstd.Plo -rm -f ./$(DEPDIR)/empk.Plo -rm -f ./$(DEPDIR)/empl.Plo -rm -f ./$(DEPDIR)/gibbs.Plo -rm -f ./$(DEPDIR)/hinv.Plo -rm -f ./$(DEPDIR)/hist.Plo -rm -f ./$(DEPDIR)/hitro.Plo -rm -f ./$(DEPDIR)/hrb.Plo -rm -f ./$(DEPDIR)/hrd.Plo -rm -f ./$(DEPDIR)/hri.Plo -rm -f ./$(DEPDIR)/itdr.Plo -rm -f ./$(DEPDIR)/mcorr.Plo -rm -f ./$(DEPDIR)/mixt.Plo -rm -f ./$(DEPDIR)/mvstd.Plo -rm -f ./$(DEPDIR)/mvtdr.Plo -rm -f ./$(DEPDIR)/ninv.Plo -rm -f ./$(DEPDIR)/norta.Plo -rm -f ./$(DEPDIR)/nrou.Plo -rm -f ./$(DEPDIR)/pinv.Plo -rm -f ./$(DEPDIR)/srou.Plo -rm -f ./$(DEPDIR)/ssr.Plo -rm -f ./$(DEPDIR)/tabl.Plo -rm -f ./$(DEPDIR)/tdr.Plo -rm -f ./$(DEPDIR)/unif.Plo -rm -f ./$(DEPDIR)/utdr.Plo -rm -f ./$(DEPDIR)/vempk.Plo -rm -f ./$(DEPDIR)/vnrou.Plo -rm -f ./$(DEPDIR)/x_gen.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/arou.Plo -rm -f ./$(DEPDIR)/ars.Plo -rm -f ./$(DEPDIR)/auto.Plo -rm -f ./$(DEPDIR)/cext.Plo -rm -f ./$(DEPDIR)/cstd.Plo -rm -f ./$(DEPDIR)/dari.Plo -rm -f ./$(DEPDIR)/dau.Plo -rm -f ./$(DEPDIR)/deprecated_methods.Plo -rm -f ./$(DEPDIR)/deprecated_vmt.Plo -rm -f ./$(DEPDIR)/dext.Plo -rm -f ./$(DEPDIR)/dgt.Plo -rm -f ./$(DEPDIR)/dsrou.Plo -rm -f ./$(DEPDIR)/dss.Plo -rm -f ./$(DEPDIR)/dstd.Plo -rm -f ./$(DEPDIR)/empk.Plo -rm -f ./$(DEPDIR)/empl.Plo -rm -f ./$(DEPDIR)/gibbs.Plo -rm -f ./$(DEPDIR)/hinv.Plo -rm -f ./$(DEPDIR)/hist.Plo -rm -f ./$(DEPDIR)/hitro.Plo -rm -f ./$(DEPDIR)/hrb.Plo -rm -f ./$(DEPDIR)/hrd.Plo -rm -f ./$(DEPDIR)/hri.Plo -rm -f ./$(DEPDIR)/itdr.Plo -rm -f ./$(DEPDIR)/mcorr.Plo -rm -f ./$(DEPDIR)/mixt.Plo -rm -f ./$(DEPDIR)/mvstd.Plo -rm -f ./$(DEPDIR)/mvtdr.Plo -rm -f ./$(DEPDIR)/ninv.Plo -rm -f ./$(DEPDIR)/norta.Plo -rm -f ./$(DEPDIR)/nrou.Plo -rm -f ./$(DEPDIR)/pinv.Plo -rm -f ./$(DEPDIR)/srou.Plo -rm -f ./$(DEPDIR)/ssr.Plo -rm -f ./$(DEPDIR)/tabl.Plo -rm -f ./$(DEPDIR)/tdr.Plo -rm -f ./$(DEPDIR)/unif.Plo -rm -f ./$(DEPDIR)/utdr.Plo -rm -f ./$(DEPDIR)/vempk.Plo -rm -f ./$(DEPDIR)/vnrou.Plo -rm -f ./$(DEPDIR)/x_gen.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: unuran-1.11.0/src/methods/mcorr.c0000644001357500135600000011276514420445767013606 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: mcorr.c * * * * TYPE: random matrix * * METHOD: Matrix -- COORelation matrix * * * * DESCRIPTION: * * random correlation matrix. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * ***************************************************************************** * * * REFERENCES: * * [1] Devroye, L. (1986): Non-Uniform Random Variate Generation, * * New-York, Sect.6.1, p.605. * * * * [2] Marsaglia, G. and I. Olkin (1984): * * Generating Correlation Matrices. * * SIAM J. Sci. Stat. Comput 5, 470-475. * * * ***************************************************************************** * * * Methods MCORR generates random correlation matrices. * * It implements two algorithms: * * * * (1) HH: Generate a random matrix H where all rows are independent and * * uniformly distributed on the sphere and returns HH'; see ref. [1]. * * * * (2) eigen: The algorithm by Marsaglia and Olkin [2] generates a * * correlation at random with a given set of eigenvalues. * * * * MCORR uses Algorithm (2) when the set of eigenvalues is given; and * * Algorithm (1) otherwise. * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include #include #include #include "unur_methods_source.h" #include "x_gen.h" #include "x_gen_source.h" #include "arou.h" #include "mcorr.h" #include "mcorr_struct.h" /*---------------------------------------------------------------------------*/ /* Variants */ #define MCORR_DEBUG_REINIT 0x00000010u /* print parameters after reinit */ /*---------------------------------------------------------------------------*/ /* Debugging flags */ /* bit 01 ... pameters and structure of generator (do not use here) */ /* bits 02-12 ... setup */ /* bits 13-24 ... adaptive steps */ /* bits 25-32 ... trace sampling */ /*---------------------------------------------------------------------------*/ /* Flags for logging set calls */ #define MCORR_SET_EIGENVALUES 0x001u /* set eigenvalues of corr-matrix */ /*---------------------------------------------------------------------------*/ #define GENTYPE "MCORR" /* type of generator */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_mcorr_init( struct unur_par *par ); static int _unur_mcorr_init_HH( struct unur_gen *gen ); static int _unur_mcorr_init_eigen( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Initialize new generator. */ /*---------------------------------------------------------------------------*/ static int _unur_mcorr_reinit( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Reinitialize generator. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_mcorr_create( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* create new (almost empty) generator object. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_mcorr_clone( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* copy (clone) generator object. */ /*---------------------------------------------------------------------------*/ static void _unur_mcorr_free( struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* destroy generator object. */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* sample from generator */ /*---------------------------------------------------------------------------*/ static int _unur_mcorr_sample_matr_HH( struct unur_gen *gen, double *mat ); /* Algorithm (1) */ static int _unur_mcorr_sample_matr_eigen( struct unur_gen *gen, double *mat ); /* Algorithm (2) */ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ /* the following functions print debugging information on output stream, */ /* i.e., into the LOG file if not specified otherwise. */ /*---------------------------------------------------------------------------*/ static void _unur_mcorr_debug_init( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print after generator has been initialized has completed. */ /*---------------------------------------------------------------------------*/ #endif #ifdef UNUR_ENABLE_INFO static void _unur_mcorr_info( struct unur_gen *gen, int help ); /*---------------------------------------------------------------------------*/ /* create info string. */ /*---------------------------------------------------------------------------*/ #endif /*---------------------------------------------------------------------------*/ /* abbreviations */ #define DISTR_IN distr->data.matr /* data for distribution object */ #define PAR ((struct unur_mcorr_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_mcorr_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.matr /* data for distribution in generator object */ #define SAMPLE gen->sample.matr /* pointer to sampling routine */ /*---------------------------------------------------------------------------*/ #define NORMAL gen->gen_aux /* pointer to normal variate generator */ /*---------------------------------------------------------------------------*/ #define _unur_mcorr_getSAMPLE(gen) \ ( ((gen)->set & MCORR_SET_EIGENVALUES) \ ? _unur_mcorr_sample_matr_eigen : _unur_mcorr_sample_matr_HH ) /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Public: User Interface (API) **/ /*****************************************************************************/ struct unur_par * unur_mcorr_new( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get default parameters */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* default parameters (pointer to structure) */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_par *par; /* check arguments */ _unur_check_NULL( GENTYPE,distr,NULL ); /* check distribution */ if ( !(distr->type == UNUR_DISTR_MATR && distr->id == UNUR_DISTR_MCORRELATION) ) { _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } COOKIE_CHECK(distr,CK_DISTR_MATR,NULL); /* allocate structure */ par = _unur_par_new( sizeof(struct unur_mcorr_par) ); COOKIE_SET(par,CK_MCORR_PAR); /* copy input */ par->distr = distr; /* pointer to distribution object */ /* set default values */ par->method = UNUR_METH_MCORR; /* method */ par->variant = 0u; /* default variant */ par->set = 0u; /* inidicate default parameters */ par->urng = unur_get_default_urng(); /* use default urng */ par->urng_aux = NULL; /* no auxilliary URNG required */ par->debug = _unur_default_debugflag; /* set default debugging flags */ /* number of rows and columns (dimension of distribution). */ /* do not confuse with distr->dim which is the size of */ /* the array that stores the matrix. */ PAR->dim = distr->data.matr.n_rows; PAR->eigenvalues = NULL; /* (optional) eigenvalues of correlation matrix */ /* routine for starting generator */ par->init = _unur_mcorr_init; return par; } /* end of unur_mcorr_new() */ /*---------------------------------------------------------------------------*/ int unur_mcorr_set_eigenvalues( UNUR_PAR *par, const double *eigenvalues ) /*----------------------------------------------------------------------*/ /* sets the (optional) eigenvalues of the correlation matrix */ /*----------------------------------------------------------------------*/ { int i; /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, MCORR ); _unur_check_NULL( GENTYPE, eigenvalues, UNUR_ERR_NULL ); /* check for eigenvalues */ for (i=0; idim; i++) if (eigenvalues[i] <= 0.) { _unur_error(GENTYPE, UNUR_ERR_PAR_SET,"eigenvalue <= 0"); return UNUR_ERR_PAR_SET; } /* store date */ PAR->eigenvalues = eigenvalues; /* changelog */ par->set |= MCORR_SET_EIGENVALUES; return UNUR_SUCCESS; } /* unur_mcorr_set_eigenvalues() */ /*---------------------------------------------------------------------------*/ int unur_mcorr_chg_eigenvalues( UNUR_GEN *gen, const double *eigenvalues ) /*----------------------------------------------------------------------*/ /* change the (optional) eigenvalues of the correlation matrix */ /*----------------------------------------------------------------------*/ { int i; /* check input */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, MCORR, UNUR_ERR_GEN_INVALID ); _unur_check_NULL( GENTYPE, eigenvalues, UNUR_ERR_NULL ); /* check for eigenvalues */ for (i=0; idim; i++) if (eigenvalues[i] <= 0.) { _unur_error(GENTYPE, UNUR_ERR_PAR_SET,"eigenvalue <= 0"); return UNUR_ERR_PAR_SET; } /* store date */ if (GEN->eigenvalues == NULL) GEN->eigenvalues = _unur_xmalloc(GEN->dim * sizeof(double)); memcpy(GEN->eigenvalues, eigenvalues, GEN->dim * sizeof(double)); /* changelog */ gen->set |= MCORR_SET_EIGENVALUES; return UNUR_SUCCESS; } /* unur_mcorr_chg_eigenvalues() */ /*****************************************************************************/ /** Private **/ /*****************************************************************************/ struct unur_gen * _unur_mcorr_init( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* initialize new generator */ /* */ /* parameters: */ /* par ... pointer to paramters for building generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ _unur_check_NULL( GENTYPE,par,NULL ); /* check input */ if ( par->method != UNUR_METH_MCORR ) { _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); return NULL; } COOKIE_CHECK(par,CK_MCORR_PAR,NULL); /* create a new empty generator object */ gen = _unur_mcorr_create(par); _unur_par_free(par); if (!gen) return NULL; /* run special initialize routines */ if (gen->set && MCORR_SET_EIGENVALUES) { if (_unur_mcorr_init_eigen(gen) != UNUR_SUCCESS) { _unur_mcorr_free(gen); return NULL; } } else { if (_unur_mcorr_init_HH(gen) != UNUR_SUCCESS) { _unur_mcorr_free(gen); return NULL; } } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_mcorr_debug_init(gen); #endif /* o.k. */ return gen; } /* end of _unur_mcorr_init() */ /*---------------------------------------------------------------------------*/ int _unur_mcorr_init_HH( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* initialize generator for Algorithm (1) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* we need a generator for standard normal distributons */ if (NORMAL==NULL) { struct unur_distr *normaldistr = unur_distr_normal(NULL,0); struct unur_par *normalpar = unur_arou_new( normaldistr ); unur_arou_set_usedars( normalpar, TRUE ); NORMAL = unur_init( normalpar ); _unur_distr_free( normaldistr ); if (NORMAL == NULL) { _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,"Cannot create aux Gaussian generator"); return UNUR_FAILURE; } /* need same uniform random number generator and debugging flags */ NORMAL->urng = gen->urng; NORMAL->debug = gen->debug; } return UNUR_SUCCESS; } /* end of _unur_mcorr_init_HH() */ /*---------------------------------------------------------------------------*/ int _unur_mcorr_init_eigen( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* initialize generator for Algorithm (2) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int i; double sum_eigenvalues = 0.; /* allocate working array */ GEN->M = _unur_xrealloc(GEN->M, (5*GEN->dim + 2*GEN->dim*GEN->dim)*sizeof(double)); /* we have to normalize the eigenvalues: */ /* sum(eigenvalues) == dim */ /* check for eigenvalues */ for (i=0; idim; i++) { if (GEN->eigenvalues[i] <= 0.) { _unur_error(GENTYPE, UNUR_ERR_SHOULD_NOT_HAPPEN,"eigenvalue <= 0"); return UNUR_FAILURE; } sum_eigenvalues += GEN->eigenvalues[i]; } /* scaling values */ if (!_unur_FP_equal(sum_eigenvalues, (double) GEN->dim)) _unur_warning(GENTYPE, UNUR_ERR_GENERIC,"scaling sum(eigenvalues) -> dim"); for (i=0; idim; i++) GEN->eigenvalues[i] *= GEN->dim / sum_eigenvalues; return UNUR_SUCCESS; } /* end of _unur_mcorr_init_eigen() */ /*---------------------------------------------------------------------------*/ int _unur_mcorr_reinit( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* re-initialize (existing) generator. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* (re)set sampling routine */ SAMPLE = _unur_mcorr_getSAMPLE(gen); /* run special initialize routines */ if (gen->set && MCORR_SET_EIGENVALUES) return _unur_mcorr_init_eigen(gen); else return _unur_mcorr_init_HH(gen); } /* end of _unur_mcorr_reinit() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_mcorr_create( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* allocate memory for generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* pointer to (empty) generator object with default settings */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_MCORR_PAR,NULL); /* create new generic generator object */ gen = _unur_generic_create( par, sizeof(struct unur_mcorr_gen) ); /* magic cookies */ COOKIE_SET(gen,CK_MCORR_GEN); /* number of rows and columns (dimension of distribution). */ /* do not confuse with distr->dim which is the size of */ /* the array that stores the matrix. */ GEN->dim = DISTR.n_rows; /* set generator identifier */ gen->genid = _unur_set_genid(GENTYPE); /* routines for sampling and destroying generator */ SAMPLE = _unur_mcorr_getSAMPLE(gen); gen->destroy = _unur_mcorr_free; gen->clone = _unur_mcorr_clone; gen->reinit = _unur_mcorr_reinit; /* initialize pointers */ GEN->M = NULL; GEN->H = NULL; GEN->eigenvalues = NULL; /* copy optional eigenvalues of the correlation matrix */ if (gen->set && MCORR_SET_EIGENVALUES) { GEN->eigenvalues = _unur_xmalloc(GEN->dim * sizeof(double)); memcpy(GEN->eigenvalues, PAR->eigenvalues, GEN->dim * sizeof(double)); } /* allocate working array */ if (gen->set && MCORR_SET_EIGENVALUES) { GEN->M = _unur_xmalloc((5*GEN->dim + 2*GEN->dim*GEN->dim) * sizeof(double)); } else { GEN->H = _unur_xmalloc(GEN->dim * GEN->dim * sizeof(double)); } #ifdef UNUR_ENABLE_INFO /* set function for creating info string */ gen->info = _unur_mcorr_info; #endif /* return pointer to (almost empty) generator object */ return gen; } /* end of _unur_mcorr_create() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_mcorr_clone( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* copy (clone) generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to clone of generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { #define CLONE ((struct unur_mcorr_gen*)clone->datap) struct unur_gen *clone; /* check arguments */ CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_MCORR_GEN,NULL); /* create generic clone */ clone = _unur_generic_clone( gen, GENTYPE ); /* allocate new working array */ if (GEN->M) CLONE->M = _unur_xmalloc((5*GEN->dim + 2*GEN->dim*GEN->dim) * sizeof(double)); if (GEN->H) CLONE->H = _unur_xmalloc(GEN->dim * GEN->dim * sizeof(double)); /* copy optional eigenvalues */ if (GEN->eigenvalues) { CLONE->eigenvalues = _unur_xmalloc(GEN->dim * sizeof(double)); memcpy(CLONE->eigenvalues, GEN->eigenvalues, GEN->dim * sizeof(double)); } return clone; #undef CLONE } /* end of _unur_mcorr_clone() */ /*---------------------------------------------------------------------------*/ void _unur_mcorr_free( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* deallocate generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { /* check arguments */ if( !gen ) /* nothing to do */ return; /* check input */ if ( gen->method != UNUR_METH_MCORR ) { _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); return; } COOKIE_CHECK(gen,CK_MCORR_GEN,RETURN_VOID); /* we cannot use this generator object any more */ SAMPLE = NULL; /* make sure to show up a programming error */ /* free memory */ if (GEN->eigenvalues) free(GEN->eigenvalues); if (GEN->H) free(GEN->H); if (GEN->M) free(GEN->M); _unur_generic_free(gen); } /* end of _unur_mcorr_free() */ /*****************************************************************************/ int _unur_mcorr_sample_matr_HH( struct unur_gen *gen, double *mat ) /*----------------------------------------------------------------------*/ /* sample from generator - Algorithm (1) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* mat ... random matrix (result) */ /*----------------------------------------------------------------------*/ { #define idx(a,b) ((a)*(GEN->dim)+(b)) int i,j,k; double sum, norm, x; /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_MCORR_GEN,UNUR_ERR_COOKIE); CHECK_NULL(mat,UNUR_ERR_NULL); /* generate rows vectors of matrix H uniformly distributed in the unit sphere */ /** TODO: sum != 0 and all columns must be independent **/ for (i=0; idim; i++) { sum=0.; for (j=0; jdim; j++) { x = _unur_sample_cont(NORMAL); GEN->H[idx(i,j)] = x; sum += x * x; } norm = sqrt(sum); for (j=0; jdim; j++) GEN->H[idx(i,j)] /= norm; } /* Compute HH' */ for (i=0; idim; i++) for (j=0; jdim; j++) { if (jdim; k++) sum += GEN->H[idx(i,k)]*GEN->H[idx(j,k)]; mat[idx(i,j)] = sum; } } return UNUR_SUCCESS; #undef idx } /* end of _unur_mcorr_sample_matr_HH() */ /*--------------------------------------------------------------------------*/ int _unur_mcorr_sample_matr_eigen( struct unur_gen *gen, double *mat ) /*----------------------------------------------------------------------*/ /* sample from generator - Algorithm (2) */ /* (eigenvalues given, Marsaglia-Olkin method) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* mat ... random matrix (result) */ /*----------------------------------------------------------------------*/ { #define idx(a,b) ((a)*dim+(b)) int i,j,k, dim; double *E, *P; double *x, *y, *z, *w, *r; /* misc vectors used in the marsaglia-olkin method */ double a, b, c, e, e2; int s; /* random sign +-1 */ /* check parameters */ CHECK_NULL(gen, UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_MCORR_GEN,UNUR_ERR_COOKIE); CHECK_NULL(mat, UNUR_ERR_NULL); dim = GEN->dim; if (dim<1) { _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,"dimension < 1"); return UNUR_ERR_SHOULD_NOT_HAPPEN; } /* initialization steps */ /* setting working arrays */ x = GEN->M + (0*dim); y = GEN->M + (1*dim); z = GEN->M + (2*dim); w = GEN->M + (3*dim); r = GEN->M + (4*dim); E = GEN->M + (5*dim); P = GEN->M + (5*dim+dim*dim); /* initially E is an identity matrix */ for (i=0; iurng); /* x = E*w */ for (i=0; ieigenvalues[i])*x[i]*x[i]; /* check if all eigenvalues are ~1 */ if (fabs(a)genid, UNUR_ERR_GEN_CONDITION,"all eigenvalues are ~1 -> identity matrix"); return UNUR_ERR_GEN_CONDITION; } do { /* z is a random vector */ for (i=0; iurng); /* y = E*z */ for (i=0; ieigenvalues[i])*x[i]*y[i]; c += (1-GEN->eigenvalues[i])*y[i]*y[i]; } /* e^2 = b^2 - a*c */ e2 = b*b - a*c; } while (e2<0); e=sqrt(e2); /* random sign */ s = ( _unur_call_urng(gen->urng) >.5) ? 1: -1 ; /* r=x*(b+s*e)/a - y */ for (i=0; iurng) >.5) ? 1: -1 ; /* pk=s*r/norm(r) */ _unur_vector_normalize(dim, r); for (i=0; iurng); /* x = E*w */ for (i=0; ieigenvalues[k] * P[idx(j,k)]; } } } /* symmetrization (necessary due to rounding-errors) */ for (i=0; igenid); fprintf(LOG,"%s: type = random matrix\n",gen->genid); fprintf(LOG,"%s: method = MCORR (Matrix - CORRELATION matrix)\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); _unur_distr_matr_debug( gen->distr, gen->genid ); /* eigenvalues */ if (gen->set && MCORR_SET_EIGENVALUES) _unur_matrix_print_vector( GEN->dim, GEN->eigenvalues, "eigenvalues =", LOG, gen->genid, "\t "); if (gen->set && MCORR_SET_EIGENVALUES) fprintf(LOG,"%s: sampling routine = _unur_mcorr_sample_matr_eigen()\n",gen->genid); else fprintf(LOG,"%s: sampling routine = _unur_mcorr_sample_matr_HH()\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); } /* end of _unur_mcorr_debug_init() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_INFO /*---------------------------------------------------------------------------*/ void _unur_mcorr_info( struct unur_gen *gen, int help ) /*----------------------------------------------------------------------*/ /* create character string that contains information about the */ /* given generator object. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* help ... whether to print additional comments */ /*----------------------------------------------------------------------*/ { struct unur_string *info = gen->infostr; /* generator ID */ _unur_string_append(info,"generator ID: %s\n\n", gen->genid); /* distribution */ _unur_string_append(info,"distribution:\n"); _unur_distr_info_typename(gen); _unur_string_append(info," dimension = %d x %d (= %d)\n", DISTR.n_rows, DISTR.n_cols, gen->distr->dim); if (gen->set && MCORR_SET_EIGENVALUES) { _unur_string_append(info," eigenvalues = "); _unur_distr_info_vector( gen, GEN->eigenvalues, GEN->dim); _unur_string_append(info,"\n"); } _unur_string_append(info,"\n"); /* if (help) { */ /* _unur_string_append(info,"\n"); */ /* } */ /* method */ _unur_string_append(info,"method: MCORR (Random CORRelation matrix)\n"); if (gen->set && MCORR_SET_EIGENVALUES) _unur_string_append(info," generate correlation matrix with given eigenvalues\n"); _unur_string_append(info,"\n"); /* performance */ /* _unur_string_append(info,"performance characteristics:\n"); */ /* _unur_string_append(info,"\n"); */ /* parameters */ if (help) { _unur_string_append(info,"parameters: \n"); if (gen->set && MCORR_SET_EIGENVALUES) { _unur_string_append(info," eigenvalues = "); _unur_distr_info_vector( gen, GEN->eigenvalues, GEN->dim); _unur_string_append(info,"\n"); } _unur_string_append(info,"\n"); } /* Hints */ /* if (help) { */ /* _unur_string_append(info,"\n"); */ /* } */ } /* end of _unur_mcorr_info() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_INFO */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/tdr_sample.ch0000644001357500135600000001360014420445767014752 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: tdr_sample.c * * * * TYPE: continuous univariate random variate * * METHOD: transformed density rejection * * * * DESCRIPTION: * * Given PDF of a T-concave distribution * * produce a value x consistent with its density * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*****************************************************************************/ /** Sampling routines **/ /*****************************************************************************/ #include "tdr_gw_sample.ch" #include "tdr_ia_sample.ch" #include "tdr_ps_sample.ch" /*---------------------------------------------------------------------------*/ double unur_tdr_eval_invcdfhat( const struct unur_gen *gen, double u, double *hx, double *fx, double *sqx ) /*----------------------------------------------------------------------*/ /* evaluate inverse CDF of hat at u */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* u ... argument for inverse CDF (0<=u<=1) */ /* hx ... pointer for storing hat at sampled X */ /* fx ... pointer for storing squeeze at sampled X */ /* sqx ... pointer for storing density at sampled X */ /* */ /* return: */ /* inverse hat CDF. */ /* */ /* values of hat, density, squeeze (computation is suppressed if */ /* corresponding pointer is NULL). */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); if ( gen->method != UNUR_METH_TDR ) { _unur_error(gen->genid,UNUR_ERR_GEN_INVALID,""); return UNUR_INFINITY; } COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_INFINITY); if (GEN->iv == NULL) { _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"empty generator object"); return UNUR_INFINITY; } if ( u<0. || u>1.) { _unur_warning(gen->genid,UNUR_ERR_DOMAIN,"argument u not in [0,1]"); } /* validate argument */ if (u<=0.) return DISTR.domain[0]; if (u>=1.) return DISTR.domain[1]; /* compute inverse CDF */ /* sampling routines */ switch (gen->variant & TDR_VARMASK_VARIANT) { case TDR_VARIANT_GW: /* original variant (Gilks&Wild) */ return _unur_tdr_gw_eval_invcdfhat(gen,u,hx,fx,sqx,NULL,NULL); case TDR_VARIANT_IA: /* immediate acceptance */ /* this does not make to much sense, since IA is not a pure rejection method. Nevertheless, we treat it in the same way as variant PS. */ case TDR_VARIANT_PS: /* proportional squeeze */ return _unur_tdr_ps_eval_invcdfhat(gen,u,hx,fx,sqx,NULL); default: _unur_error(GENTYPE,UNUR_ERR_SHOULD_NOT_HAPPEN,""); return UNUR_INFINITY; } } /* end of unur_tdr_eval_invcdfhat() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/empk_struct.h0000644001357500135600000001176614420445767015030 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: empk_struct.h * * * * PURPOSE: * * declares structures for method EMPK * * (EMPirical distribution with Kernel smoothing) * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Information for constructing the generator */ struct unur_empk_par { /* the observed sample is stored in the distribution object */ const UNUR_GEN *kerngen; /* random variate generator for kernel (given by user) */ UNUR_GEN *kernel; /* random variate generator for kernel (provided by UNURAN) */ double alpha; /* alpha is used to compute the optimal bandwidth from the point of view of minimizing the mean integrated square error (MISE). alfa depends on the type of kernel being used. */ double beta; /* beta is used to compute the optimal bandwidth from the point of view of minimizing the mean integrated square error (MISE). beta depends on the (unknown) distribution of the sampled data points. Thus its value contains some guess on this distribution. */ double smoothing; /* determines how "smooth" the estimated density will be */ double kernvar; /* variance of used kernel, only used if varcor == 1 */ }; /*---------------------------------------------------------------------------*/ /* The generator object */ struct unur_empk_gen { double *observ; /* pointer to the array of the observations */ int n_observ; /* number of observations */ UNUR_GEN *kerngen; /* random variate generator for kernel */ double smoothing; /* determines how "smooth" the estimated density will be */ double kernvar; /* variance of used kernel, only used if varcor == 1 */ double bwidth; /* bandwidth for kernel density estimation */ double bwidth_opt; /* optimal bandwith for kernel density estimation */ double mean_observ; /* mean of observed data */ double stddev_observ; /* standard deviation of oberved data */ double sconst; /* constant used for variance corrected version of kernel method */ double alpha; /* parameter for kernel width */ double beta; /* parameter for kernel width */ }; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/mvtdr_newset.ch0000644001357500135600000003751714420445767015356 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: mvtdr_newset.c * * * * TYPE: continuous multivariate random variate * * METHOD: multivariate transformed density rejection * * * * DESCRIPTION: * * Given (logarithm of the) PDF of a log-concave distribution; * * produce a value x consistent with its density. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*****************************************************************************/ /** Public: User Interface (API) **/ /*****************************************************************************/ struct unur_par * unur_mvtdr_new( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get default parameters */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* default parameters (pointer to structure) */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_par *par; /* check arguments */ _unur_check_NULL( GENTYPE,distr,NULL ); /* check distribution */ if (distr->type != UNUR_DISTR_CVEC) { _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } COOKIE_CHECK(distr,CK_DISTR_CVEC,NULL); if (distr->dim < 2) { _unur_error(GENTYPE,UNUR_ERR_DISTR_PROP,"dim < 2"); return NULL; } if ( ! ((DISTR_IN.pdf && DISTR_IN.dpdf) || (DISTR_IN.logpdf && DISTR_IN.dlogpdf)) ) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"d/(log)PDF"); return NULL; } /* allocate structure */ par = _unur_par_new( sizeof(struct unur_mvtdr_par) ); COOKIE_SET(par,CK_MVTDR_PAR); /* copy input */ par->distr = distr; /* pointer to distribution object */ /* set default values */ par->method = UNUR_METH_MVTDR ; /* method */ par->variant = 0u; /* default variant */ par->set = 0u; /* inidicate default parameters */ par->urng = unur_get_default_urng(); /* use default urng */ par->urng_aux = NULL; /* no auxilliary URNG required */ par->debug = _unur_default_debugflag; /* set default debugging flags */ /* routine for starting generator */ par->init = _unur_mvtdr_init; /* set default values */ /* minimum number of triangulation steps */ PAR->steps_min = 5; /* maximum number of cones (at least 2^(dim+T_STEPS_MIN) */ PAR->max_cones = 10000; /* bound for splitting cones */ PAR->bound_splitting = 1.5; /** TODO !! **/ /* move mode to boundary if |mode - boundary| / length < MODE_TO_BOUNDARY */ /* PAR->mode_to_boundary = 0.01; */ return par; } /* end of unur_mvtdr_new() */ /*---------------------------------------------------------------------------*/ int unur_mvtdr_set_stepsmin( struct unur_par *par, int stepsmin ) /*----------------------------------------------------------------------*/ /* set minimum number of triangulation step for each starting cone */ /* */ /* parameters: */ /* par ... pointer to parameter object */ /* stepsmin ... minimum number of triangulation steps */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, MVTDR ); /* check new parameter for generator */ if (stepsmin < 0) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"stepsmin < 0"); return UNUR_ERR_PAR_SET; } /* store date */ PAR->steps_min = stepsmin; /* changelog */ par->set |= MVTDR_SET_STEPSMIN; return UNUR_SUCCESS; } /* end of unur_mvtdr_set_stepsmin() */ /*---------------------------------------------------------------------------*/ int unur_mvtdr_set_boundsplitting( UNUR_PAR *par, double boundsplitting ) /*----------------------------------------------------------------------*/ /* set bound for splitting cones. all cones are splitted when the */ /* volume below the hat is greater than boundsplitting times the */ /* average volume over all cones. */ /* */ /* parameters: */ /* par ... pointer to parameter object */ /* boundsplitting ... maximum number of cones */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, MVTDR ); /* check new parameter for generator */ /* store date */ PAR->bound_splitting = boundsplitting; /* changelog */ par->set |= MVTDR_SET_BOUNDSPLITTING; return UNUR_SUCCESS; } /* end of unur_mvtdr_set_boundsplitting() */ /*---------------------------------------------------------------------------*/ int unur_mvtdr_set_maxcones( struct unur_par *par, int maxcones ) /*----------------------------------------------------------------------*/ /* set maximum number of cones */ /* (this number is always increased to 2^(dim+stepsmin) ) */ /* */ /* parameters: */ /* par ... pointer to parameter object */ /* maxcones ... maximum number of cones */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, MVTDR ); /* check new parameter for generator */ /* none here: it is always increased to 2^(dim+stepsmin) during init */ /* store date */ PAR->max_cones = maxcones; /* changelog */ par->set |= MVTDR_SET_MAXCONES; return UNUR_SUCCESS; } /* end of unur_mvtdr_set_maxcones() */ /*---------------------------------------------------------------------------*/ int unur_mvtdr_get_ncones( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* get number of cones */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* number of cones ... on success */ /* 0 ... on error */ /*----------------------------------------------------------------------*/ { /* check input */ _unur_check_NULL( GENTYPE, gen, 0 ); _unur_check_gen_object( gen, MVTDR, 0 ); return GEN->n_cone; } /* end of unur_mvtdr_get_ncones() */ /*---------------------------------------------------------------------------*/ double unur_mvtdr_get_hatvol( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* get volume below hat */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* volume ... on success */ /* UNUR_INFINITY ... on error */ /*----------------------------------------------------------------------*/ { /* check input */ _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); _unur_check_gen_object( gen, MVTDR, UNUR_INFINITY ); return GEN->Htot; } /* end of unur_mvtdr_get_hatvol() */ /*---------------------------------------------------------------------------*/ int unur_mvtdr_set_verify( struct unur_par *par, int verify ) /*----------------------------------------------------------------------*/ /* turn verifying of algorithm while sampling on/off */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* verify ... 0 = no verifying, !0 = verifying */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* no verifying is the default */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); /* check input */ _unur_check_par_object( par, MVTDR ); /* we use a bit in variant */ par->variant = (verify) ? (par->variant | MVTDR_VARFLAG_VERIFY) : (par->variant & (~MVTDR_VARFLAG_VERIFY)); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_mvtdr_set_verify() */ /*---------------------------------------------------------------------------*/ int unur_mvtdr_chg_verify( struct unur_gen *gen, int verify ) /*----------------------------------------------------------------------*/ /* turn verifying of algorithm while sampling on/off */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* verify ... 0 = no verifying, !0 = verifying */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* no verifying is the default */ /*----------------------------------------------------------------------*/ { /* check input */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, MVTDR, UNUR_ERR_GEN_INVALID ); /* we must not change this switch when sampling has been disabled by using a pointer to the error producing routine */ if (SAMPLE == _unur_sample_cvec_error) return UNUR_FAILURE; /* we use a bit in variant */ gen->variant = (verify) ? (gen->variant | MVTDR_VARFLAG_VERIFY) : (gen->variant & (~MVTDR_VARFLAG_VERIFY)); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_mvtdr_chg_verify() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/hrb.c0000644001357500135600000011200214420445767013217 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: hrb.c * * * * TYPE: continuous univariate random variate * * METHOD: Hazard Rate Bounded * * * * DESCRIPTION: * * * * REQUIRED: * * pointer to the hazard rate * * * * OPTIONAL: * * upper bound for hazard rate * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * ***************************************************************************** * * * REFERENCES: * * * * Evrim Ozgul (2002): The generation of random variates with a given * * hazard rate, M.Sc. thesis, Department of Industrial Engineering, * * Bogazici University, Istanbul. * * * ***************************************************************************** * * * Rejection from majorizing constant hazard rate (exponential * * distribution); constant thinning. * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include "unur_methods_source.h" #include "x_gen_source.h" #include "hrb.h" #include "hrb_struct.h" #ifdef UNUR_ENABLE_INFO # include #endif /*---------------------------------------------------------------------------*/ /* Constants */ /* abort sampling after this number of iterations and return UNUR_INFINITY */ #define HRB_EMERGENCY_BREAK (100000) /*---------------------------------------------------------------------------*/ /* Variants: */ #define HRB_VARFLAG_VERIFY 0x01u /* flag for verifying mode */ /*---------------------------------------------------------------------------*/ /* Debugging flags */ /* bit 01 ... pameters and structure of generator (do not use here) */ /* bits 02-12 ... setup */ /* bits 13-24 ... adaptive steps */ /* bits 25-32 ... trace sampling */ #define HRB_DEBUG_REINIT 0x00000010u /* print parameters after reinit */ #define HRB_DEBUG_SAMPLE 0x01000000u /* trace sampling (only if verify mode is on) */ /*---------------------------------------------------------------------------*/ /* Flags for logging set calls */ #define HRB_SET_UPPERBOUND 0x001u /* set upper bound for hazard rate */ /*---------------------------------------------------------------------------*/ #define GENTYPE "HRB" /* type of generator */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_hrb_init( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* Initialize new generator. */ /*---------------------------------------------------------------------------*/ static int _unur_hrb_reinit( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Reinitialize generator. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_hrb_create( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* create new (almost empty) generator object. */ /*---------------------------------------------------------------------------*/ static int _unur_hrb_check_par( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Check parameters of given distribution and method */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_hrb_clone( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* copy (clone) generator object. */ /*---------------------------------------------------------------------------*/ static void _unur_hrb_free( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* destroy generator object. */ /*---------------------------------------------------------------------------*/ static double _unur_hrb_sample( struct unur_gen *gen ); static double _unur_hrb_sample_check( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* sample from generator */ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ /* the following functions print debugging information on output stream, */ /* i.e., into the LOG file if not specified otherwise. */ /*---------------------------------------------------------------------------*/ static void _unur_hrb_debug_init( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print after generator has been initialized has completed. */ /*---------------------------------------------------------------------------*/ static void _unur_hrb_debug_sample( const struct unur_gen *gen, double x, int i ); /*---------------------------------------------------------------------------*/ /* trace sampling. */ /*---------------------------------------------------------------------------*/ #endif #ifdef UNUR_ENABLE_INFO static void _unur_hrb_info( struct unur_gen *gen, int help ); /*---------------------------------------------------------------------------*/ /* create info string. */ /*---------------------------------------------------------------------------*/ #endif /*---------------------------------------------------------------------------*/ /* abbreviations */ #define DISTR_IN distr->data.cont /* data for distribution object */ #define PAR ((struct unur_hrb_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_hrb_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.cont /* data for distribution in generator object */ #define SAMPLE gen->sample.cont /* pointer to sampling routine */ #define HR(x) _unur_cont_HR((x),(gen->distr)) /* call to hazard rate */ /*---------------------------------------------------------------------------*/ #define _unur_hrb_getSAMPLE(gen) \ ( ((gen)->variant & HRB_VARFLAG_VERIFY) \ ? _unur_hrb_sample_check : _unur_hrb_sample ) /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Public: User Interface (API) **/ /*****************************************************************************/ struct unur_par * unur_hrb_new( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get default parameters */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* default parameters (pointer to structure) */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_par *par; /* check arguments */ _unur_check_NULL( GENTYPE,distr,NULL ); /* check distribution */ if (distr->type != UNUR_DISTR_CONT) { _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } COOKIE_CHECK(distr,CK_DISTR_CONT,NULL); if (DISTR_IN.hr == NULL) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"HR"); return NULL; } /* allocate structure */ par = _unur_par_new( sizeof(struct unur_hrb_par) ); COOKIE_SET(par,CK_HRB_PAR); /* copy input */ par->distr = distr; /* pointer to distribution object */ /* set default values */ PAR->upper_bound = UNUR_INFINITY; /* upper bound for hazard rate (not set yet) */ par->method = UNUR_METH_HRB; /* method */ par->variant = 0u; /* default variant */ par->set = 0u; /* inidicate default parameters */ par->urng = unur_get_default_urng(); /* use default urng */ par->urng_aux = NULL; /* no auxilliary URNG required */ par->debug = _unur_default_debugflag; /* set default debugging flags */ /* routine for starting generator */ par->init = _unur_hrb_init; return par; } /* end of unur_hrb_new() */ /*****************************************************************************/ int unur_hrb_set_upperbound( struct unur_par *par, double upperbound ) /*----------------------------------------------------------------------*/ /* set upper bound for hazard rate */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* upperbound ... upper bound for hazard rate */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, HRB ); /* check new parameter for generator */ if (upperbound <= 0. || _unur_FP_is_infinity(upperbound)) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"bound for hazard rate"); return UNUR_ERR_PAR_SET; } /* store date */ PAR->upper_bound = upperbound; /* changelog */ par->set |= HRB_SET_UPPERBOUND; return UNUR_SUCCESS; } /* end of unur_hrb_set_upperbound() */ /*---------------------------------------------------------------------------*/ int unur_hrb_set_verify( struct unur_par *par, int verify ) /*----------------------------------------------------------------------*/ /* turn verifying of algorithm while sampling on/off */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* verify ... 0 = no verifying, !0 = verifying */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* no verifying is the default */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, HRB ); /* we use a bit in variant */ par->variant = (verify) ? (par->variant | HRB_VARFLAG_VERIFY) : (par->variant & (~HRB_VARFLAG_VERIFY)); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_hrb_set_verify() */ /*---------------------------------------------------------------------------*/ int unur_hrb_chg_verify( struct unur_gen *gen, int verify ) /*----------------------------------------------------------------------*/ /* turn verifying of algorithm while sampling on/off */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* verify ... 0 = no verifying, !0 = verifying */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* no verifying is the default */ /*----------------------------------------------------------------------*/ { /* check input */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, HRB, UNUR_ERR_GEN_INVALID ); /* we must not change this switch when sampling has been disabled by using a pointer to the error producing routine */ if (SAMPLE == _unur_sample_cont_error) return UNUR_FAILURE; /* we use a bit in variant */ gen->variant = (verify) ? (gen->variant | HRB_VARFLAG_VERIFY) : (gen->variant & (~HRB_VARFLAG_VERIFY)); /* sampling routine */ SAMPLE = _unur_hrb_getSAMPLE(gen); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_hrb_chg_verify() */ /*****************************************************************************/ /** Private **/ /*****************************************************************************/ struct unur_gen * _unur_hrb_init( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* initialize new generator */ /* */ /* parameters: */ /* params pointer to paramters for building generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ _unur_check_NULL( GENTYPE,par,NULL ); /* check input */ if ( par->method != UNUR_METH_HRB ) { _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); return NULL; } COOKIE_CHECK(par,CK_HRB_PAR,NULL); /* create a new empty generator object */ gen = _unur_hrb_create(par); _unur_par_free(par); if (!gen) return NULL; /* check parameters */ if (_unur_hrb_check_par(gen) != UNUR_SUCCESS) { _unur_hrb_free(gen); return NULL; } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_hrb_debug_init(gen); #endif return gen; } /* end of _unur_hrb_init() */ /*---------------------------------------------------------------------------*/ int _unur_hrb_reinit( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* re-initialize (existing) generator. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int rcode; /* check parameters */ if ( (rcode = _unur_hrb_check_par(gen)) != UNUR_SUCCESS) return rcode; /* (re)set sampling routine */ SAMPLE = _unur_hrb_getSAMPLE(gen); /* nothing to do */ return UNUR_SUCCESS; } /* end of _unur_hrb_reinit() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_hrb_create( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* allocate memory for generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* pointer to (empty) generator object with default settings */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_HRB_PAR,NULL); /* create new generic generator object */ gen = _unur_generic_create( par, sizeof(struct unur_hrb_gen) ); /* magic cookies */ COOKIE_SET(gen,CK_HRB_GEN); /* set generator identifier */ gen->genid = _unur_set_genid(GENTYPE); /* routines for sampling and destroying generator */ SAMPLE = _unur_hrb_getSAMPLE(gen); gen->destroy = _unur_hrb_free; gen->clone = _unur_hrb_clone; gen->reinit = _unur_hrb_reinit; /* copy parameters into generator object */ GEN->upper_bound = PAR->upper_bound; /* upper bound for hazard rate */ /* default values */ /* initialize variables */ GEN->left_border = 0.; /* left border of domain */ #ifdef UNUR_ENABLE_INFO /* set function for creating info string */ gen->info = _unur_hrb_info; #endif /* return pointer to (almost empty) generator object */ return gen; } /* end of _unur_hrb_create() */ /*---------------------------------------------------------------------------*/ int _unur_hrb_check_par( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* check parameters of given distribution and method */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check for required data: upper bound for hazard rate */ if (!(gen->set & HRB_SET_UPPERBOUND)) { GEN->upper_bound = HR(GEN->left_border); if (GEN->upper_bound <= 0. || _unur_FP_is_infinity(GEN->upper_bound)) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"no valid upper bound for HR at left boundary"); return UNUR_ERR_GEN_CONDITION; } } /* set left border and check domain */ if (DISTR.domain[0] < 0.) DISTR.domain[0] = 0.; if (DISTR.domain[1] < UNUR_INFINITY) DISTR.domain[1] = UNUR_INFINITY; GEN->left_border = DISTR.domain[0]; return UNUR_SUCCESS; } /* end of _unur_hrb_check_par() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_hrb_clone( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* copy (clone) generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to clone of generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { #define CLONE ((struct unur_hrb_gen*)clone->datap) struct unur_gen *clone; /* check arguments */ CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_HRB_GEN,NULL); /* create generic clone */ clone = _unur_generic_clone( gen, GENTYPE ); return clone; #undef CLONE } /* end of _unur_hrb_clone() */ /*---------------------------------------------------------------------------*/ void _unur_hrb_free( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* deallocate generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { /* check arguments */ if( !gen ) /* nothing to do */ return; /* check input */ if ( gen->method != UNUR_METH_HRB ) { _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); return; } COOKIE_CHECK(gen,CK_HRB_GEN,RETURN_VOID); /* we cannot use this generator object any more */ SAMPLE = NULL; /* make sure to show up a programming error */ /* free memory */ _unur_generic_free(gen); } /* end of _unur_hrb_free() */ /*****************************************************************************/ double _unur_hrb_sample( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { double U,V,E,X; double lambda; int i; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_HRB_GEN,UNUR_INFINITY); /* parameter for majorizing hazard rate */ lambda = GEN->upper_bound; /* starting point */ X = GEN->left_border; for(i=1;;i++) { /* sample from U(0,1) */ while ( _unur_iszero(U = 1.-_unur_call_urng(gen->urng)) ); /* sample from exponential distribution with scale parameter lambda */ E = -log(U) / lambda; /* Remark: by this construction E is monotically increasing with the uniform random number generated by the _unur_call_urng() call */ /* next step */ X += E; /* reject or accept */ V = lambda * _unur_call_urng(gen->urng); if( V <= HR(X) ) return X; if (i > HRB_EMERGENCY_BREAK) { /* emergency break */ _unur_warning(gen->genid,UNUR_ERR_GEN_SAMPLING,"maximum number of iterations exceeded"); return X; } } } /* end of _unur_hrb_sample() */ /*---------------------------------------------------------------------------*/ double _unur_hrb_sample_check( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator (verify mode) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { double U,V,E,X,hrx; double lambda; int i; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_HRB_GEN,UNUR_INFINITY); /* parameter for majorizing hazard rate */ lambda = GEN->upper_bound; /* starting point */ X = GEN->left_border; for(i=1;;i++) { /* sample from U(0,1) */ while ( _unur_iszero(U = 1.-_unur_call_urng(gen->urng)) ); /* sample from exponential distribution with scale parameter lambda */ E = -log(U) / lambda; /* Remark: by this construction E is monotically increasing with the uniform random number generated by the _unur_call_urng() call */ /* next step */ X += E; /* hazard rate at generated point */ hrx = HR(X); /* verify upper bound */ if ( (1.+UNUR_EPSILON) * lambda < hrx ) _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"upper bound not valid"); /* reject or accept */ V = lambda * _unur_call_urng(gen->urng); if( V <= hrx ) { #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug & HRB_DEBUG_SAMPLE) _unur_hrb_debug_sample( gen, X, i ); #endif return X; } if (i > HRB_EMERGENCY_BREAK) { /* emergency break */ _unur_warning(gen->genid,UNUR_ERR_GEN_SAMPLING,"maximum number of iterations exceeded"); return X; } } } /* end of _unur_hrb_sample_check() */ /*****************************************************************************/ /** Auxilliary Routines **/ /*****************************************************************************/ /*****************************************************************************/ /** Debugging utilities **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ void _unur_hrb_debug_init( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write info about generator into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_HRB_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: type = continuous univariate random variates\n",gen->genid); fprintf(LOG,"%s: method = HRB (Hazard Rate Bounded)\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); _unur_distr_cont_debug( gen->distr, gen->genid ); fprintf(LOG,"%s: sampling routine = _unur_hrb_sample",gen->genid); if (gen->variant & HRB_VARFLAG_VERIFY) fprintf(LOG,"_check()\n"); else fprintf(LOG,"()\n"); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: upper bound for hazard rate = %g",gen->genid,GEN->upper_bound); _unur_print_if_default(gen,HRB_SET_UPPERBOUND); fprintf(LOG,"\n"); fprintf(LOG,"%s:\n",gen->genid); fflush(LOG); } /* end of _unur_hrb_debug_init() */ /*---------------------------------------------------------------------------*/ void _unur_hrb_debug_sample( const struct unur_gen *gen, double x, int i ) /*----------------------------------------------------------------------*/ /* write info about generated point into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* x ... generated point */ /* i ... number of iterations */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_HRB_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s: X = %g\t #iterations = %d\n",gen->genid,x,i); } /* end of _unur_hrb_debug_init() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_INFO /*---------------------------------------------------------------------------*/ void _unur_hrb_info( struct unur_gen *gen, int help ) /*----------------------------------------------------------------------*/ /* create character string that contains information about the */ /* given generator object. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* help ... whether to print additional comments */ /*----------------------------------------------------------------------*/ { struct unur_string *info = gen->infostr; int samplesize = 10000; /* generator ID */ _unur_string_append(info,"generator ID: %s\n\n", gen->genid); /* distribution */ _unur_string_append(info,"distribution:\n"); _unur_distr_info_typename(gen); _unur_string_append(info," functions = HR\n"); _unur_string_append(info," domain = (%g, %g)\n", DISTR.domain[0],DISTR.domain[1]); _unur_string_append(info,"\n"); /* method */ _unur_string_append(info,"method: HRB (Hazard Rate Bounded)\n"); _unur_string_append(info,"\n"); /* performance */ _unur_string_append(info,"performance characteristics:\n"); _unur_string_append(info," E[#iterations] = %.2f [approx.]\n", unur_test_count_urn(gen,samplesize,0,NULL)/((double)samplesize)); _unur_string_append(info,"\n"); /* parameters */ if (help) { _unur_string_append(info,"parameters:\n"); _unur_string_append(info," upperbound = %g %s\n", GEN->upper_bound, (gen->set & HRB_SET_UPPERBOUND) ? "" : "[default]"); if (gen->variant & HRB_VARFLAG_VERIFY) _unur_string_append(info," verify = on\n"); _unur_string_append(info,"\n"); } /* Hints */ if (help) { if ( !(gen->set & HRB_SET_UPPERBOUND)) _unur_string_append(info,"[ Hint: %s ]\n", "You should set \"upperbound\" for the given hazard rate."); _unur_string_append(info,"\n"); } } /* end of _unur_hrb_info() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_INFO */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/dss_struct.h0000644001357500135600000000602314420304141014627 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: dss_struct.h * * * * PURPOSE: * * declares structures for method DSS * * (Discrete Sequential Search) * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Information for constructing the generator */ struct unur_dss_par { int dummy; }; /*---------------------------------------------------------------------------*/ /* The generator object */ struct unur_dss_gen { int dummy; }; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/Makefile.am0000644001357500135600000000511614430713333014327 00000000000000## Process this file with automake to produce Makefile.in AM_CPPFLAGS = \ -I$(top_srcdir)/src noinst_LTLIBRARIES = libmethods.la # Files that contain deprecated routines if ENABLE_DEPRECATED DEPRECATED_FILES = \ deprecated_methods.c deprecated_methods.h \ deprecated_tdrgw.h \ deprecated_vmt.c deprecated_vmt.h deprecated_vmt_struct.h else DEPRECATED_FILES = endif libmethods_la_SOURCES = \ $(DEPRECATED_FILES) \ \ x_gen.c x_gen.h x_gen_struct.h x_gen_source.h \ \ auto.c auto.h auto_struct.h \ arou.c arou.h arou_struct.h \ ars.c ars.h ars_struct.h \ cext.c cext.h cext_struct.h \ cstd.c cstd.h cstd_struct.h \ dari.c dari.h dari_struct.h \ dau.c dau.h dau_struct.h \ dext.c dext.h dext_struct.h \ dgt.c dgt.h dgt_struct.h \ dsrou.c dsrou.h dsrou_struct.h \ dss.c dss.h dss_struct.h \ dstd.c dstd.h dstd_struct.h \ empk.c empk.h empk_struct.h \ empl.c empl.h empl_struct.h \ gibbs.c gibbs.h gibbs_struct.h \ hinv.c hinv.h hinv_struct.h \ hist.c hist.h hist_struct.h \ hitro.c hitro.h hitro_struct.h \ hrb.c hrb.h hrb_struct.h \ hrd.c hrd.h hrd_struct.h \ hri.c hri.h hri_struct.h \ itdr.c itdr.h itdr_struct.h \ mcorr.c mcorr.h mcorr_struct.h \ mixt.c mixt.h mixt_struct.h \ mvstd.c mvstd.h mvstd_struct.h \ mvtdr.c mvtdr.h mvtdr_struct.h \ mvtdr_newset.ch mvtdr_init.ch mvtdr_sample.ch \ mvtdr_info.ch mvtdr_debug.ch \ ninv.c ninv.h ninv_struct.h \ ninv_newset.ch ninv_init.ch ninv_sample.ch \ ninv_newton.ch ninv_regula.ch \ ninv_debug.ch ninv_info.ch \ norta.c norta.h norta_struct.h \ nrou.c nrou.h nrou_struct.h \ pinv.c pinv.h pinv_struct.h \ pinv_newset.ch pinv_init.ch pinv_sample.ch \ pinv_prep.ch pinv_newton.ch \ pinv_debug.ch pinv_info.ch \ srou.c srou.h srou_struct.h \ ssr.c ssr.h ssr_struct.h \ tabl.c tabl.h tabl_struct.h tabl_newset.ch \ tabl_init.ch tabl_sample.ch tabl_debug.ch tabl_info.ch \ tdr.c tdr.h tdr_struct.h tdr_newset.ch \ tdr_init.ch tdr_gw_init.ch tdr_ps_init.ch \ tdr_sample.ch tdr_gw_sample.ch tdr_ps_sample.ch tdr_ia_sample.ch \ tdr_debug.ch tdr_gw_debug.ch tdr_ps_debug.ch tdr_info.ch \ unif.c unif.h unif_struct.h \ utdr.c utdr.h utdr_struct.h \ vempk.c vempk.h vempk_struct.h \ vnrou.c vnrou.h vnrou_struct.h noinst_HEADERS = \ unur_methods.h \ unur_methods_source.h # clean backup files CLEANFILES = *~ # clean generated files MAINTAINERCLEANFILES = \ Makefile.in unuran-1.11.0/src/methods/pinv_sample.ch0000644001357500135600000002452614420445767015146 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: pinv_sample.c * * * * Sampling routines. * * * ***************************************************************************** * * * Copyright (c) 2008 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * *****************************************************************************/ /*****************************************************************************/ /** Sampling routines **/ /*****************************************************************************/ double _unur_pinv_sample( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { double U,X; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_PINV_GEN,UNUR_INFINITY); /* sample from U(0,1) */ U = _unur_call_urng(gen->urng); /* compute inverse CDF */ X = _unur_pinv_eval_approxinvcdf(gen,U); if (XDISTR.trunc[1]) return DISTR.trunc[1]; return X; } /* end of _unur_pinv_sample() */ /*---------------------------------------------------------------------------*/ double _unur_pinv_eval_approxinvcdf( const struct unur_gen *gen, double u ) /*----------------------------------------------------------------------*/ /* evaluate polynomial interpolation of inverse CDF at u */ /* (internal call) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* u ... argument for inverse CDF (0<=u<=1, no validation!) */ /* */ /* return: */ /* double (approximate inverse CDF) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { int i; double x,un; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_PINV_GEN,UNUR_INFINITY); /* rescale for range (0, Umax) */ un = u * GEN->Umax; /* look up in guide table and search for interval */ i = GEN->guide[(int)(u * GEN->guide_size)]; while (GEN->iv[i+1].cdfi < un) i++; /* rescale for range (0, CDF(right)-CDF(left) for interval */ un -= GEN->iv[i].cdfi; /* evaluate polynomial */ x = _unur_pinv_newton_eval(un, GEN->iv[i].ui, GEN->iv[i].zi, GEN->order); /* return point (add left boundary point to x) */ return (GEN->iv)[i].xi + x; } /* end of _unur_pinv_eval_approxinvcdf() */ /*---------------------------------------------------------------------------*/ double unur_pinv_eval_approxinvcdf( const struct unur_gen *gen, double u ) /*----------------------------------------------------------------------*/ /* evaluate polynomial interpolation of inverse CDF at u */ /* (user call) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* u ... argument for inverse CDF (0<=u<=1) */ /* */ /* return: */ /* double (approximate inverse CDF) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { double x; /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); if ( gen->method != UNUR_METH_PINV ) { _unur_error(gen->genid,UNUR_ERR_GEN_INVALID,""); return UNUR_INFINITY; } COOKIE_CHECK(gen,CK_PINV_GEN,UNUR_INFINITY); if ( ! (u>0. && u<1.)) { if ( ! (u>=0. && u<=1.)) { _unur_warning(gen->genid,UNUR_ERR_DOMAIN,"U not in [0,1]"); } if (u<=0.) return DISTR.domain[0]; if (u>=1.) return DISTR.domain[1]; return u; /* = NaN */ } /* compute inverse CDF */ x = _unur_pinv_eval_approxinvcdf(gen,u); /* validate range */ if (xDISTR.domain[1]) x = DISTR.domain[1]; return x; } /* end of unur_pinv_eval_approxinvcdf() */ /*---------------------------------------------------------------------------*/ double unur_pinv_eval_approxcdf( const struct unur_gen *gen, double x ) /*----------------------------------------------------------------------*/ /* evaluate (approximate) CDF at x. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* x ... argument for CDF */ /* */ /* return: */ /* double (approximate CDF) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); if ( gen->method != UNUR_METH_PINV ) { _unur_error(gen->genid,UNUR_ERR_GEN_INVALID,""); return UNUR_INFINITY; } COOKIE_CHECK(gen,CK_PINV_GEN,UNUR_INFINITY); /* we need the table of CDF values */ if ( (gen->variant & PINV_VARIANT_PDF) && GEN->aCDF == NULL) { _unur_error(gen->genid,UNUR_ERR_GENERIC,"'keepcdf' not set"); return UNUR_INFINITY; } /* argument inside domain ? */ if (x <= DISTR.domain[0]) return 0.; if (x >= DISTR.domain[1]) return 1.; /* compute CDF */ if (gen->variant & PINV_VARIANT_PDF) { /* case: PDF given */ return _unur_lobatto_eval_CDF(GEN->aCDF,x); } else { /* case: CDF given */ return (CDF(x)); } } /* end of unur_pinv_eval_approxcdf() */ /*****************************************************************************/ int unur_pinv_estimate_error( const UNUR_GEN *gen, int samplesize, double *max_error, double *MAE ) /*----------------------------------------------------------------------*/ /* Estimate maximal u-error and mean absolute error (MAE) by means of */ /* Monte-Carlo simulation. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* samplesize ... sample size for Monte Carlo simulation */ /* max_error ... pointer to double for storing maximal u-error */ /* MAE ... pointer to double for storing MA u-error */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL(GENTYPE, gen, UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_PINV_GEN,UNUR_ERR_COOKIE); /* run test */ unur_test_u_error(gen, max_error, MAE, 1.e-20, samplesize, FALSE, FALSE, FALSE, NULL); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_pinv_estimate_error() */ /*****************************************************************************/ unuran-1.11.0/src/methods/empk.c0000644001357500135600000016704214420445767013416 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: empk.c * * * * TYPE: continuous univariate random variate * * METHOD: generate from kernel estimation * * * * DESCRIPTION: * * Given observed sample. * * Produce a value x consistent with this sample * * * * REQUIRED: * * pointer to sample * * alpha factor (is required if a kernel is given) * * * * OPTIONAL: * * kernel * * smoothing factor * * beta factor * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * ***************************************************************************** * * * REFERENCES: * * * * [1] Devroye, L. and Gyorfi, L. (1985): Nonparametric Density * * Estimation: The $L_1$ View. New-York: John Wiley. * * * * [2] Devroye, L. (1986): Non-Uniform Random Variate Generation. (p. 765) * * New York: Springer-Verlag. * * * * [3] Hoermann, W. and Leydold, J. (2000): Automatic random variate * * generation for simulation input. Proceedings of the 2000 Winter * * Simulation Conference. (??? eds.) * * * * [4] Silverman, B. (1986): Density Estimation for Statistics and * * Data Analysis. London: Chapman and Hall. * * * ***************************************************************************** * * * The method here is based on the fact that it is very easy to generate * * random variates that have as density the kernel density estimate of a * * given sample: It is enough to randomly select a point from the given * * sample and return it together with some additive noise (see [1], [2] * * [3] and [4]). Note that it is not necessary to compute the density * * estimate itself! In fact it is much easier to generate variates from * * the density estimate than to compute the estimate itself! * * * * For kernel density estimation we have to choose the kernel function * * (this is for us the density of the noise) and the smoothing parameter * * (i.e. the scale parameter of the kernel variate.) There is a lot * * of theory discussing the optimal smoothing parameter for density * * estimation. As we are mainly interested in a simple formula we * * use the formula explained in [4] p.46-47 that is minimizing the * * asymptotically MISE (mean integrated squared error) for a given * * kernel. We have the danger of oversmoothing the data if they are * * non-normal. Especially for multimodal distributions we get a better * * bandwidth if we replace the sample's stdev s in the formula by the * * minimum of s and the interquartilsrange R divided through 1.34. * * * * bwidth_opt = alpha * beta * min(s,R/1.34) * n^(-1/5) * * * * If we assume normal data we have to take beta = 1.364, which * * is the default value of beta for the library. * * To make it easy for the user to choose the bwidth as a fraction * * of the bwidth_opt explained above we introduced the parameter * * smoothing_factor and compute: * * * * bwidth= bwidth_opt * smoothing_factor * * * * Alpha is a constant only depending on the kernel K(t) and can be * * computed as * * * * alpha(K) = Var(K)^(-2/5){ \int K(t)^2 dt}^(1/5) * * * *...........................................................................* * * * Algorithm EMPK: * * * * [Input] * * Sample X(i) for i=1,2,..,n * * * * [Generate] * * 1: Generate a random variate I uniformly distributed on {1, 2,...,n} * * 2: Generate a random variate W from the distribution with density K(t) * * 3: Return X(I) + bwidth * W * * * *...........................................................................* * * * As kernel we can take any unimodal density symmetric around 0 that has * * finite variance. Regarding the asymptotic MISE the so called * * Epanechnikov (or Bartlett) kernel (K(x) = 3/4(1-x^2) |x|<=1) * * is optimal, but several others have almost the same efficiency. * * From a statistical point of view it may be attractive to add * * Gaussian noise. If we are interested in the speed of the sampling * * procedure it is of course fastest to use the rectangular (or Boxcar) * * kernel as this means uniform noise. * * * * The mean of the empirical distribution is equal to the sample mean. * * One disadvantage of this method lies in the fact that the variance of * * the empirical distribution generated by the kernel method is always * * higher than the sample standard-deviation s. As pointed out in [4] * * it is not difficult to correct this error. For the variance * * corrected version we have to compute the mean mux and the * * standardeviation s of the sample and we have to know the Variance of * * the kernel V(K). Then we can replace step (3) of the algorithm above * * by: * * * * 3': Return mux +(X(I) - mux + bwidth * W)/(1+bwidth^2 V(K)/s^2)^(1/2) * * * * We can turn on or off variance correction with the function * * * * unur_empk_set_varcor(); * * * * We also have problems with this method if we want to generate only * * positive random variates, as due to the added noise it can happen * * that the generated variate is negative, even if all values of the * * observed sample are positive. One simple possibility to get around * * this problem is the so called mirroring principle. If the generated * * variate X is negative we simply return -X. * * * * We can turn on or off the mirroring with the function * * * * unur_empk_set_positive(); * * * * It is not difficult to see that the mirroring principle is * * disturbing the variance correction, which can no longer guarantee * * that the variance of the generated distribution is equal to the * * sample variance. * * The mirroring principle is also spoiling the nice property that the * * mean of the generated distribution is equal to the sample mean. Both * * problems are only of practical relevance if a high proportion of the * * sample is close to 0. There are no simple methods to get around these * * problems. It is a well-known fact that kernel density estimation * * performs poor around a point of discontinuity of the density! There * * are special kernels suggested in the literature to cope with this * * problem but they are not easily applicable to our algorithm. * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include #include "unur_methods_source.h" #include "x_gen.h" #include "x_gen_source.h" #include "arou.h" #include "cstd.h" #include "empk.h" #include "empk_struct.h" /*---------------------------------------------------------------------------*/ /* Variants: */ #define EMPK_VARFLAG_VARCOR 0x001u /* use variance correction */ #define EMPK_VARFLAG_POSITIVE 0x002u /* only positive values */ /*---------------------------------------------------------------------------*/ /* Debugging flags */ /* bit 01 ... pameters and structure of generator (do not use here) */ /* bits 02-12 ... setup */ /* bits 13-24 ... adaptive steps */ /* bits 25-32 ... trace sampling */ #define EMPK_DEBUG_PRINTDATA 0x00000100u /*---------------------------------------------------------------------------*/ /* Flags for logging set calls */ #define EMPK_SET_KERNEL 0x010u /* kernel density */ #define EMPK_SET_KERNGEN 0x020u /* generator for kernel */ #define EMPK_SET_KERNELVAR 0x001u /* variance of kernel */ #define EMPK_SET_ALPHA 0x002u /* alpha factor */ #define EMPK_SET_BETA 0x004u /* beta factor */ #define EMPK_SET_SMOOTHING 0x008u /* smoothing factor */ /*---------------------------------------------------------------------------*/ #define GENTYPE "EMPK" /* type of generator */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_empk_init( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* Initialize new generator. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_empk_create( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* create new (almost empty) generator object. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_empk_clone( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* copy (clone) generator object. */ /*---------------------------------------------------------------------------*/ static void _unur_empk_free( struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* destroy generator object. */ /*---------------------------------------------------------------------------*/ static double _unur_empk_sample( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* sample from generator */ /*---------------------------------------------------------------------------*/ inline static int _unur_empk_comp_stddev( double *data, int n_data, double *mean, double *stddev); /*---------------------------------------------------------------------------*/ /* compute mean and standard deviation of data. */ /*---------------------------------------------------------------------------*/ inline static double _unur_empk_comp_iqrtrange( double *data, int n_data ); /*---------------------------------------------------------------------------*/ /* compute interquartile range. */ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ /* the following functions print debugging information on output stream, */ /* i.e., into the LOG file if not specified otherwise. */ /*---------------------------------------------------------------------------*/ static void _unur_empk_debug_init( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print after generator has been initialized has completed. */ /*---------------------------------------------------------------------------*/ #endif #ifdef UNUR_ENABLE_INFO static void _unur_empk_info( struct unur_gen *gen, int help ); /*---------------------------------------------------------------------------*/ /* create info string. */ /*---------------------------------------------------------------------------*/ #endif /*---------------------------------------------------------------------------*/ /* abbreviations */ #define DISTR_IN distr->data.cemp /* data for distribution object */ #define PAR ((struct unur_empk_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_empk_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.cemp /* data for distribution in generator object */ #define SAMPLE gen->sample.cont /* pointer to sampling routine */ /*---------------------------------------------------------------------------*/ /* constants */ /*---------------------------------------------------------------------------*/ #define SQU(a) ((a)*(a)) /*---------------------------------------------------------------------------*/ /* compare two doubles (needed for sorting) */ inline static int compare_doubles (const void *a, const void *b) { const double *da = (const double *) a; const double *db = (const double *) b; return (*da > *db) - (*da < *db); } /*---------------------------------------------------------------------------*/ #define _unur_empk_getSAMPLE(gen) (_unur_empk_sample) /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Public: User Interface (API) **/ /*****************************************************************************/ struct unur_par * unur_empk_new( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get default parameters */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* default parameters (pointer to structure) */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_par *par; /* check arguments */ _unur_check_NULL( GENTYPE,distr,NULL ); /* check distribution */ if (distr->type != UNUR_DISTR_CEMP) { _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } COOKIE_CHECK(distr,CK_DISTR_CEMP,NULL); if (DISTR_IN.sample == NULL) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"observed sample"); return NULL; } if (DISTR_IN.n_sample < 2) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"number of observed sample"); return NULL; } /* allocate structure */ par = _unur_par_new( sizeof(struct unur_empk_par) ); COOKIE_SET(par,CK_EMPK_PAR); /* copy input */ par->distr = distr; /* pointer to distribution object */ /* set default values */ PAR->kernvar = 1.; /* variance of used kernel, only used if varcor == 1 */ PAR->alpha = 0.7763884; /* alpha for Gaussian kernel, efficiency = 0.951 */ PAR->beta = 1.3637439; /* optimal BETA if data follow normal distribution */ PAR->smoothing = 1.; /* determines how "smooth" the estimated density will be */ /* kernel */ PAR->kerngen = NULL; /* random variate generator for kernel (by user) */ PAR->kernel = NULL; /* random variate generator for kernel (internal) */ par->method = UNUR_METH_EMPK; /* method */ par->variant = 0u; /* default variant */ par->set = 0u; /* inidicate default parameters */ par->urng = unur_get_default_urng(); /* use default urng */ par->urng_aux = NULL; /* no auxilliary URNG required */ par->debug = _unur_default_debugflag; /* set default debugging flags */ /* routine for starting generator */ par->init = _unur_empk_init; return par; } /* end of unur_empk_new() */ /*****************************************************************************/ int unur_empk_set_kernel( struct unur_par *par, unsigned kernel) /*----------------------------------------------------------------------*/ /* set standard kernel and start kernel generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* kernel ... identifier for standard kernel */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { UNUR_DISTR *kerndist; double fpar[4]; /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, EMPK ); /* It is not possible to call unur_empk_set_kernel() twice. */ if (par->set & EMPK_SET_KERNEL) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"Cannot overwrite kernel"); return UNUR_ERR_PAR_SET; } /* check for standard distribution and set data */ switch (kernel) { case UNUR_DISTR_EPANECHNIKOV: /* Epanechnikov (or Bartlett) kernel. efficiency 1.000 minimizes asymptotic MISE. PDF: f(x)=3/4 (1-x^2) for -1kernel = unur_init( unur_arou_new ( kerndist ) ); PAR->alpha = 1.718771928; PAR->kernvar = 0.2; unur_distr_free( kerndist ); break; case UNUR_DISTR_GAUSSIAN: /* Gaussian (normal) kernel. efficiency = 0.951 */ kerndist = unur_distr_normal( NULL, 0 ); PAR->kernel = unur_init( unur_cstd_new ( kerndist ) ); PAR->alpha = 0.7763884; PAR->kernvar = 1.; unur_distr_free( kerndist ); break; case UNUR_DISTR_BOXCAR: /* Boxcar (uniform, rectangular) kernel. efficiency = 0.930 */ fpar[0] = -1.; fpar[1] = 1.; kerndist = unur_distr_uniform( fpar, 2 ); PAR->kernel = unur_init( unur_cstd_new ( kerndist ) ); PAR->alpha = 1.351; PAR->kernvar = 1./3.; unur_distr_free( kerndist ); break; case UNUR_DISTR_STUDENT: /* t3 kernel (Student's distribution with 3 degrees of freedom). efficiency = 0.679 */ fpar[0] = 3.; kerndist = unur_distr_student( fpar, 1 ); PAR->kernel = unur_init( unur_cstd_new ( kerndist ) ); PAR->alpha = 0.48263; PAR->kernvar = 3.; unur_distr_free( kerndist ); break; case UNUR_DISTR_LOGISTIC: /* logistic kernel. efficiency = efficiency = 0.887 */ kerndist = unur_distr_logistic( NULL, 0 ); PAR->kernel = unur_init( unur_cstd_new ( kerndist ) ); PAR->alpha = 0.434; PAR->kernvar = 3.289868133696; /* Pi^2/3 */ unur_distr_free( kerndist ); break; default: _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"Unknown kernel. make it manually"); return UNUR_ERR_PAR_SET; } /* generation of kernel successful ? */ if (PAR->kernel == NULL) { _unur_error(GENTYPE,UNUR_ERR_SHOULD_NOT_HAPPEN,"Could not initialize kernel generator"); return UNUR_ERR_SHOULD_NOT_HAPPEN; } /* changelog */ par->set &= ~EMPK_SET_KERNGEN; /* just for the case that ..._set_kerngen() has been called */ par->set |= EMPK_SET_KERNEL | EMPK_SET_ALPHA | EMPK_SET_KERNELVAR; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_empk_set_kernel() */ /*---------------------------------------------------------------------------*/ int unur_empk_set_kernelgen( struct unur_par *par, const struct unur_gen *kernelgen, double alpha, double kernelvar ) /*----------------------------------------------------------------------*/ /* set generator for kernel distribution */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* kernelgen ... generator object that holds the kernel */ /* alpha ... parameter depending on kernel */ /* kernelvar ... variance of kernel */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_NULL( GENTYPE, kernelgen, UNUR_ERR_NULL ); _unur_check_par_object( par, EMPK ); /* It is not possible to run this function after a unur_empk_set_kernel() call. */ if (par->set & EMPK_SET_KERNEL) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"Cannot overwrite kernel"); return UNUR_ERR_PAR_SET; } /* check kernel distribution */ if ( (kernelgen->method & UNUR_MASK_TYPE) != UNUR_METH_CONT ) { _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return UNUR_ERR_DISTR_INVALID; } /* check new parameter for generator */ if (alpha <= 0.) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"alpha <= 0"); return UNUR_ERR_PAR_SET; } /* set kernel distribution */ PAR->kerngen = kernelgen; /* store alpha factor */ PAR->alpha = alpha; /* changelog */ par->set |= EMPK_SET_KERNGEN | EMPK_SET_ALPHA; /* set kernel variance */ PAR->kernvar = kernelvar; if (kernelvar > 0.) par->set |= EMPK_SET_KERNELVAR; else /* variance correction disabled */ par->set &= ~EMPK_SET_KERNELVAR; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_empk_set_kernelgen() */ /*---------------------------------------------------------------------------*/ int unur_empk_set_beta( struct unur_par *par, double beta ) /*----------------------------------------------------------------------*/ /* set beta factor */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* beta ... parameter depending on sample */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, EMPK ); /* check new parameter for generator */ if (beta <= 0.) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"beta <= 0"); return UNUR_ERR_PAR_SET; } /* store date */ PAR->beta = beta; /* changelog */ par->set |= EMPK_SET_BETA; return UNUR_SUCCESS; } /* end of unur_empk_set_beta() */ /*---------------------------------------------------------------------------*/ int unur_empk_set_smoothing( struct unur_par *par, double smoothing ) /*----------------------------------------------------------------------*/ /* set smoothing factor */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* smoothing ... smoothing factor */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, EMPK ); /* check new parameter for generator */ if (smoothing < 0.) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"smoothing factor < 0"); return UNUR_ERR_PAR_SET; } /* store date */ PAR->smoothing = smoothing; /* changelog */ par->set |= EMPK_SET_SMOOTHING; return UNUR_SUCCESS; } /* end of unur_empk_set_smoothing() */ /*---------------------------------------------------------------------------*/ int unur_empk_chg_smoothing( struct unur_gen *gen, double smoothing ) /*----------------------------------------------------------------------*/ /* change smoothing factor */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* smoothing ... smoothing factor */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, EMPK, UNUR_ERR_GEN_INVALID ); /* no changelog required */ /* check new parameter for generator */ if (smoothing < 0.) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"smoothing factor < 0"); return UNUR_ERR_PAR_SET; } /* recompute band width */ GEN->bwidth = smoothing * GEN->bwidth_opt; /* recompute constant for variance corrected version */ GEN->sconst = 1./sqrt(1. + GEN->kernvar * SQU( GEN->bwidth/GEN->stddev_observ ) ); /* store smoothing factor */ GEN->smoothing = smoothing; /* changelog */ gen->set |= EMPK_SET_SMOOTHING; return UNUR_SUCCESS; } /* end of unur_empk_chg_smoothing() */ /*---------------------------------------------------------------------------*/ int unur_empk_set_varcor( struct unur_par *par, int varcor ) /*----------------------------------------------------------------------*/ /* turn variance correction on/off */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* varcor ... 0 = no variance correction, !0 = variance correction */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* variance correction is the default */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, EMPK ); /* we do not know yet if the kernel variance known */ /* we use a bit in variant */ par->variant = (varcor) ? (par->variant | EMPK_VARFLAG_VARCOR) : (par->variant & (~EMPK_VARFLAG_VARCOR)); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_empk_set_varcor() */ /*---------------------------------------------------------------------------*/ int unur_empk_chg_varcor( struct unur_gen *gen, int varcor ) /*----------------------------------------------------------------------*/ /* turn variance correction on/off */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* varcor ... 0 = no variance correction, !0 = variance correction */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, EMPK, UNUR_ERR_GEN_INVALID ); /* kernel variance known ? */ if (! (gen->set & EMPK_SET_KERNELVAR) ) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"variance correction disabled"); return UNUR_ERR_PAR_SET; } /* no changelog required */ /* we use a bit in variant */ gen->variant = (varcor) ? (gen->variant | EMPK_VARFLAG_VARCOR) : (gen->variant & (~EMPK_VARFLAG_VARCOR)); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_empk_chg_varcor() */ /*---------------------------------------------------------------------------*/ int unur_empk_set_positive( struct unur_par *par, int positive ) /*----------------------------------------------------------------------*/ /* turn mirroring (produces positive random numbers only) on/off */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* positive ... 0 = no mirroring, !0 = mirroring */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* no mirroring is the default */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, EMPK ); /* we use a bit in variant */ par->variant = (positive) ? (par->variant | EMPK_VARFLAG_POSITIVE) : (par->variant & (~EMPK_VARFLAG_POSITIVE)); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_empk_set_positive() */ /*****************************************************************************/ /** Private **/ /*****************************************************************************/ struct unur_gen * _unur_empk_init( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* initialize new generator */ /* */ /* parameters: */ /* par ... pointer to paramters for building generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; double iqrtrange; /* interquartile range of data */ double sigma; /* estimation (guess) for "real" standard deviation of observed data. */ /* check arguments */ CHECK_NULL(par,NULL); /* check input */ if ( par->method != UNUR_METH_EMPK ) { _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); return NULL; } COOKIE_CHECK(par,CK_EMPK_PAR,NULL); /* check kernel generator */ if ( PAR->kerngen==NULL && PAR->kernel == NULL) { /* no kernel given. use default kernel */ if ( unur_empk_set_kernel( par, UNUR_DISTR_GAUSSIAN )!=UNUR_SUCCESS ) { /* cannot make kernel generator (should not happen!) */ _unur_par_free(par); return NULL; } } /* create a new empty generator object */ gen = _unur_empk_create(par); if (!gen) { _unur_par_free(par); return NULL; } /* if variance correction is used, the variance of the kernel must be known and positive */ if( (gen->variant & EMPK_VARFLAG_VARCOR) && !( (gen->set & EMPK_SET_KERNELVAR) && GEN->kernvar > 0. )) { _unur_warning(GENTYPE,UNUR_ERR_GEN_DATA,"variance correction disabled"); gen->variant &= ~EMPK_SET_KERNELVAR; } /* set uniform random number generator */ GEN->kerngen->urng = par->urng; /* copy debugging flags */ GEN->kerngen->debug = par->debug; /* the observed data */ /* sort entries */ /** TODO: this sort can be removed after we have implemented a new version of the function iqrtrange, that does not depend on sorting **/ qsort( GEN->observ, (size_t)GEN->n_observ, sizeof(double), compare_doubles); /* compute mean and standard deviation of observed sample */ _unur_empk_comp_stddev( GEN->observ, GEN->n_observ, &(GEN->mean_observ), &(GEN->stddev_observ) ); /* compute interquartile range of the sample */ iqrtrange = _unur_empk_comp_iqrtrange( GEN->observ, GEN->n_observ ); /* get an estimation (guess) of the "real" standard deviation of the observed data. For normal distributed data it is 1.34 times the interquartile range. If this is greater than the observed standard deviation we use that instead of. */ sigma = iqrtrange / 1.34; if (GEN->stddev_observ < sigma) sigma = GEN->stddev_observ; /* compute band width (also called window width) */ GEN->bwidth_opt = GEN->alpha * GEN->beta * sigma / exp(0.2 * log((double)GEN->n_observ)); GEN->bwidth = GEN->smoothing * GEN->bwidth_opt; /* compute constant for variance corrected version */ GEN->sconst = 1./sqrt(1. + GEN->kernvar * SQU( GEN->bwidth/GEN->stddev_observ ) ); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_empk_debug_init(gen); #endif /* free parameters */ _unur_par_free(par); return gen; } /* end of _unur_empk_init() */ /*---------------------------------------------------------------------------*/ static struct unur_gen * _unur_empk_create( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* allocate memory for generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* pointer to (empty) generator object with default settings */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_EMPK_PAR,NULL); /* create new generic generator object */ gen = _unur_generic_create( par, sizeof(struct unur_empk_gen) ); /* magic cookies */ COOKIE_SET(gen,CK_EMPK_GEN); /* set generator identifier */ gen->genid = _unur_set_genid(GENTYPE); /* routines for sampling and destroying generator */ SAMPLE = _unur_empk_getSAMPLE(gen); gen->destroy = _unur_empk_free; gen->clone = _unur_empk_clone; /* copy observed data into generator object */ GEN->observ = DISTR.sample; /* observations in distribution object */ GEN->n_observ = DISTR.n_sample; /* sample size */ /* copy some parameters into generator object */ GEN->smoothing = PAR->smoothing; /* smoothing factor */ GEN->alpha = PAR->alpha; /* parameter for kernel width */ GEN->beta = PAR->beta; /* parameter for kernel width */ /* copy kernel generator into generator object */ if (PAR->kerngen) /* kernel provided by user */ GEN->kerngen = _unur_gen_clone(PAR->kerngen); else /* kernel from UNURAN list of kernels */ GEN->kerngen = PAR->kernel; /* variance of kernel */ GEN->kernvar = PAR->kernvar; /* the kernel is an auxilliary generator for method EMPK, of course */ gen->gen_aux = GEN->kerngen; #ifdef UNUR_ENABLE_INFO /* set function for creating info string */ gen->info = _unur_empk_info; #endif /* RETURN pointer to (almost empty) generator object */ return gen; } /* end of _unur_empk_create() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_empk_clone( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* copy (clone) generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to clone of generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { #define CLONE ((struct unur_empk_gen*)clone->datap) struct unur_gen *clone; /* check arguments */ CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_EMPK_GEN,NULL); /* create generic clone */ clone = _unur_generic_clone( gen, GENTYPE ); /* copy observed data into generator object */ CLONE->observ = clone->distr->data.cemp.sample; /* observations in distribution object */ /* kernel generator is (also) stored as auxiliary generator */ /* which has already been cloned by generic_clone. */ CLONE->kerngen = clone->gen_aux; return clone; #undef CLONE } /* end of _unur_empk_clone() */ /*---------------------------------------------------------------------------*/ void _unur_empk_free( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* deallocate generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { /* check arguments */ if( !gen ) /* nothing to do */ return; /* check input */ if ( gen->method != UNUR_METH_EMPK ) { _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); return; } COOKIE_CHECK(gen,CK_EMPK_GEN,RETURN_VOID); /* we cannot use this generator object any more */ SAMPLE = NULL; /* make sure to show up a programming error */ /* free memory */ _unur_generic_free(gen); } /* end of _unur_empk_free() */ /*****************************************************************************/ double _unur_empk_sample( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { double U,K,X; int j; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_EMPK_GEN,UNUR_INFINITY); /* select uniformly one of the observations */ U = _unur_call_urng(gen->urng) * GEN->n_observ; j = (int) (U); /** TODO: recycle uniform random variate?? maybe for Boxcar (Uniform) Kernel. **/ /* U -= j; u is now a "recycled" U(0,1) random variate, aber wie weiter verwenden, ? */ /* sample from kernel distribution */ K = unur_sample_cont( GEN->kerngen ); if (gen->variant & EMPK_VARFLAG_VARCOR) /* use variance correction */ X = GEN->mean_observ + (GEN->observ[j] - GEN->mean_observ + GEN->bwidth * K) * GEN->sconst; else /* no variance correction */ X = GEN->observ[j] + GEN->bwidth * K; if (gen->variant & EMPK_VARFLAG_POSITIVE) /* use mirroring to avoid non-positive numbers */ X = (X<0.) ? -X : X; return X; } /* end of _unur_empk_sample() */ /*****************************************************************************/ /** Auxilliary Routines **/ /*****************************************************************************/ int _unur_empk_comp_stddev( double *data, int n_data, double *mean, double *stddev) /*----------------------------------------------------------------------*/ /* compute mean and standard deviation of data */ /* */ /* parameters: */ /* data ... pointer to array of data */ /* n_data ... number of data points */ /* mean ... pointer to store mean */ /* stddev ... pointer to store stddev */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* REFERENCES: */ /* [1] Spicer C.C. (1972): Algorithm AS 52: Calculation of Power Sums */ /* of Deviations about the mean, */ /* Applied Statistics 21(2), pp. 226-227. */ /*----------------------------------------------------------------------*/ { double xsqu_sum; /* sum of x[i]^2 */ double dx; int n; if (n_data < 2) /* cannot compute standard deviation */ return 0; /* initialize counters */ *mean = 0.; xsqu_sum = 0.; /* compute sums */ for (n=1; n <= n_data; n++) { dx = (data[n-1] - *mean) / n; xsqu_sum += n * (n - 1.) * dx * dx; *mean += dx; } /* compute standard deviation */ *stddev = sqrt( xsqu_sum / (n_data - 1.)); return UNUR_SUCCESS; } /* end of _unur_empk_comp_stddev() */ /*---------------------------------------------------------------------------*/ /** TODO: implement a new version of interquartilsrang that does not depend on sorting. (Only important if we want to use really large samples) **/ double _unur_empk_comp_iqrtrange( double *data, int n ) /*----------------------------------------------------------------------*/ /* compute interquartile range of sorted data (in ascending order) */ /* */ /* parameters: */ /* data ... pointer to array of data */ /* n ... number of data points */ /* */ /* return: */ /* interquartile range */ /*----------------------------------------------------------------------*/ { double lowerqrt,upperqrt; /* lower and upper quartile */ int j; /* data must be sorted in ascending order */ j = n/2; if (j % 2) { lowerqrt = data[(j+1)/2-1]; upperqrt = data[n-(j+1)/2]; } else { lowerqrt = (data[j/2-1] + data[j/2+1-1])/2.; upperqrt = (data[n-j/2] + data[n-j/2-1])/2.; } return (upperqrt - lowerqrt); } /* end of _unur_empk_comp_iqrange() */ /*****************************************************************************/ /** Debugging utilities **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ static void _unur_empk_debug_init( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write info about generator into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_EMPK_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: type = continuous univariate random variates\n",gen->genid); fprintf(LOG,"%s: method = EMPK (EMPirical distribution with Kernel smoothing)\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); _unur_distr_cemp_debug( gen->distr, gen->genid, (gen->debug & EMPK_DEBUG_PRINTDATA)); fprintf(LOG,"%s: sampling routine = _unur_empk_sample()\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: smoothing factor = %g",gen->genid, GEN->smoothing); _unur_print_if_default(gen,EMPK_SET_SMOOTHING); fprintf(LOG,"\n"); if (gen->variant & EMPK_VARFLAG_POSITIVE) fprintf(LOG,"%s: positive random variable only; use mirroring \n",gen->genid); if (gen->variant & EMPK_VARFLAG_VARCOR) fprintf(LOG,"%s: use variance correction\n",gen->genid); else fprintf(LOG,"%s: no variance correction\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: Kernel:\n",gen->genid); fprintf(LOG,"%s: type = %s ",gen->genid,GEN->kerngen->distr->name); if (gen->set & EMPK_SET_KERNGEN) fprintf(LOG,"[kernel generator set]\n"); else if (gen->set & EMPK_SET_KERNEL) fprintf(LOG,"[standard kernel]\n"); else fprintf(LOG,"[default kernel]\n"); fprintf(LOG,"%s: window width = %g\t(opt = %g)\n",gen->genid, GEN->bwidth, GEN->bwidth_opt); fprintf(LOG,"%s: alpha = %g",gen->genid, GEN->alpha); _unur_print_if_default(gen,EMPK_SET_ALPHA); fprintf(LOG,"\n"); if (gen->variant & EMPK_VARFLAG_VARCOR) { fprintf(LOG,"%s: kernel variance = %g",gen->genid, GEN->kernvar); _unur_print_if_default(gen,EMPK_SET_KERNELVAR); fprintf(LOG,"\n"); fprintf(LOG,"%s: variance correction factor = %g\n",gen->genid, GEN->sconst); } fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: Data:\n",gen->genid); fprintf(LOG,"%s: beta = %g",gen->genid, GEN->beta); _unur_print_if_default(gen,EMPK_SET_BETA); fprintf(LOG,"\n"); fprintf(LOG,"%s: mean (data) = %g\n",gen->genid, GEN->mean_observ); fprintf(LOG,"%s: stddev (data) = %g\n",gen->genid, GEN->stddev_observ); fprintf(LOG,"%s:\n",gen->genid); } /* end of _unur_empk_debug_init() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_INFO /*---------------------------------------------------------------------------*/ void _unur_empk_info( struct unur_gen *gen, int help ) /*----------------------------------------------------------------------*/ /* create character string that contains information about the */ /* given generator object. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* help ... whether to print additional comments */ /*----------------------------------------------------------------------*/ { struct unur_string *info = gen->infostr; /* generator ID */ _unur_string_append(info,"generator ID: %s\n\n", gen->genid); /* distribution */ _unur_string_append(info,"distribution:\n"); _unur_distr_info_typename(gen); _unur_string_append(info," functions = DATA [length=%d]\n", GEN->n_observ); _unur_string_append(info,"\n"); /* if (help) { */ /* _unur_string_append(info,"\n"); */ /* } */ /* method */ _unur_string_append(info,"method: EMPK (EMPirical distribution with Kernel smoothing)\n"); _unur_string_append(info," kernel type = %s (alpha=%g) ", GEN->kerngen->distr->name, GEN->alpha); if (gen->set & EMPK_SET_KERNGEN) _unur_string_append(info,"[kernel generator set]\n"); else if (gen->set & EMPK_SET_KERNEL) _unur_string_append(info,"[standard kernel]\n"); else _unur_string_append(info,"[default kernel]\n"); _unur_string_append(info," window width = %g (opt = %g)\n", GEN->bwidth, GEN->bwidth_opt); _unur_string_append(info," smoothing factor = %g\n", GEN->smoothing); if (gen->variant & EMPK_VARFLAG_POSITIVE) _unur_string_append(info," positive random variable only; use mirroring\n"); if (gen->variant & EMPK_VARFLAG_VARCOR) _unur_string_append(info," variance correction factor = %g\n", GEN->sconst); else _unur_string_append(info," no variance correction\n"); _unur_string_append(info,"\n"); /* performance */ /* _unur_string_append(info,"performance characteristics:\n"); */ /* _unur_string_append(info,"\n"); */ /* parameters */ if (help) { _unur_string_append(info,"parameters:\n"); _unur_string_append(info," smoothing = %g %s\n", GEN->smoothing, (gen->set & EMPK_SET_SMOOTHING) ? "" : "[default]"); if (gen->set & EMPK_SET_BETA) _unur_string_append(info," beta = %g\n", GEN->beta); if (gen->variant & EMPK_VARFLAG_VARCOR) _unur_string_append(info," varcor = on\n"); if (gen->variant & EMPK_VARFLAG_POSITIVE) _unur_string_append(info," positive = on\n"); _unur_string_append(info,"\n"); /* Not displayed: int unur_empk_set_kernel( UNUR_PAR *parameters, unsigned kernel); int unur_empk_set_kernelgen( UNUR_PAR *parameters, const UNUR_GEN *kernelgen, double alpha, double kernelvar ); */ } /* Hints */ /* if (help) { */ /* _unur_string_append(info,"\n"); */ /* } */ } /* end of _unur_empk_info() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_INFO */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/utdr.c0000644001357500135600000016146214420445767013440 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: utdr.h * * * * TYPE: continuous univariate random variate * * METHOD: transformed density rejection with three points of contact * * T(x) = -1/sqrt(x) (T_c with c= -1/2) * * * * DESCRIPTION: * * Given PDF and mode of a T-concave distribution * * produce a value x consistent with its density * * * * REQUIRED: pointer to the density, mode of the density * * * * PARAMETERS: * * double il, ir ... left and right boundary of domain * * (default: +/- UNUR_INFINITY) * * double pdf_area ... area below PDF (need not be 1) * * (default: 1.) * * double *pdf_param ... parameters of PDF * * (default: NULL) * * int n_pdf_param ... number of parameters of PDF * * (default: 0) * * double c_factor ... constant for choosing the constr. points * * (default: 0.664) * * double delta_factor ... constant for approx. first derivative * * (default: 0.00001) * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * ***************************************************************************** * * * REFERENCES: * * [1] Hoermann W. (1995): A rejection technique for sampling from * * T-concave distributions, ACM TOMS 21, p. 182-193 * * (see Algorithm UTDR) * * * ***************************************************************************** * * * ..... beschreibung .... * * * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include "unur_methods_source.h" #include "x_gen_source.h" #include "utdr.h" #include "utdr_struct.h" #ifdef UNUR_ENABLE_INFO # include #endif /*---------------------------------------------------------------------------*/ /* Variants */ #define UTDR_VARFLAG_VERIFY 0x01u /* flag for verifying mode */ /*---------------------------------------------------------------------------*/ /* Debugging flags */ /* bit 01 ... pameters and structure of generator (do not use here) */ /* bits 02-12 ... setup */ /* bits 13-24 ... adaptive steps */ /* bits 25-32 ... trace sampling */ #define UTDR_DEBUG_REINIT 0x00000010u /* print parameters after reinit */ /*---------------------------------------------------------------------------*/ /* Flags for logging set calls */ #define UTDR_SET_CPFACTOR 0x001u #define UTDR_SET_DELTA 0x002u #define UTDR_SET_PDFMODE 0x004u /* PDF at mode is set */ /*---------------------------------------------------------------------------*/ #define GENTYPE "UTDR" /* type of generator */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_utdr_init( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* Initialize new generator. */ /*---------------------------------------------------------------------------*/ static int _unur_utdr_reinit( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Reinitialize generator. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_utdr_create( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* create new (almost empty) generator object. */ /*---------------------------------------------------------------------------*/ static int _unur_utdr_check_par( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Check parameters of given distribution and method */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_utdr_clone( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* copy (clone) generator object. */ /*---------------------------------------------------------------------------*/ static void _unur_utdr_free( struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* destroy generator object. */ /*---------------------------------------------------------------------------*/ static double _unur_utdr_sample( struct unur_gen *generator ); static double _unur_utdr_sample_check( struct unur_gen *generator ); /*---------------------------------------------------------------------------*/ /* sample from generator */ /*---------------------------------------------------------------------------*/ static int _unur_utdr_hat( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* compute hat and squeezes. */ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ /* the following functions print debugging information on output stream, */ /* i.e., into the LOG file if not specified otherwise. */ /*---------------------------------------------------------------------------*/ static void _unur_utdr_debug_init( const struct unur_gen *gen, double ttly, double ttlys, double ttry, double ttrys, double cfac, int setupok, double c ); /*---------------------------------------------------------------------------*/ /* print after generator has been initialized has completed. */ /*---------------------------------------------------------------------------*/ #endif #ifdef UNUR_ENABLE_INFO static void _unur_utdr_info( struct unur_gen *gen, int help ); /*---------------------------------------------------------------------------*/ /* create info string. */ /*---------------------------------------------------------------------------*/ #endif /*---------------------------------------------------------------------------*/ /* abbreviations */ #define DISTR_IN distr->data.cont /* data for distribution object */ #define PAR ((struct unur_utdr_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_utdr_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.cont /* data for distribution in generator object */ #define BD_LEFT domain[0] /* left boundary of domain of distribution */ #define BD_RIGHT domain[1] /* right boundary of domain of distribution */ #define SAMPLE gen->sample.cont /* pointer to sampling routine */ #define PDF(x) _unur_cont_PDF((x),(gen->distr)) /* call to PDF */ /*---------------------------------------------------------------------------*/ #define _unur_utdr_getSAMPLE(gen) \ ( ((gen)->variant & UTDR_VARFLAG_VERIFY) \ ? _unur_utdr_sample_check : _unur_utdr_sample ) /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Public: User Interface (API) **/ /*****************************************************************************/ struct unur_par * unur_utdr_new( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get default parameters */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* default parameters (pointer to structure) */ /* */ /* error: */ /* return NULL */ /* */ /* comment: */ /* if the area below the PDF is not close to 1 it is necessary to */ /* set pdf_area to an approximate value of its area (+/- 30 % is ok). */ /*----------------------------------------------------------------------*/ { struct unur_par *par; /* check arguments */ _unur_check_NULL( GENTYPE,distr,NULL ); /* check distribution */ if (distr->type != UNUR_DISTR_CONT) { _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } COOKIE_CHECK(distr,CK_DISTR_CONT,NULL); if (DISTR_IN.pdf == NULL) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PDF"); return NULL; } /**TODOWH: Kann man eigentlich einen bound fuer die area auch im Distribution-objekt eingeben????? so dass es klar ist, dass da nur ein bound ist? JL: ich habe ich SSR die moeglichkeit eingebaut, dass nur eine obere schranke eingegeben wurde. dass einzige problem dabei ist, dass dann der squeeze nicht mehr verwendet werden kann. man kann aber die verwendung des squeezes (der eigentlich nur bei sehr teuren dichten etwas bringt, mittels int unur_ssr_set_usesqueeze( UNUR_PAR *parameters, int usesqueeze ); abschalten. waere das ein brauchbarer weg fuer Dich? alternativ koennten wir auch ein unur_distr_set_approx_pdfarea() einbauen. die unterscheidung zwischen exactem wert und naehrung kann man mittels set-flag machen. (irgendwie ist mir bis jetzt nie die idee gekommen, dass so zu machen.) ist das so besser? **/ /* allocate structure */ par = _unur_par_new( sizeof(struct unur_utdr_par) ); COOKIE_SET(par,CK_UTDR_PAR); /* copy input */ par->distr = distr; /* pointer to distribution object */ /* set default values */ PAR->c_factor = 0.664; /* optimal value for the normal distribution, which is good for all bell-shaped densities. The minimax approach for that transformation has c_factor=2. */ PAR->delta_factor = 0.00001; /* constant for choosing delta to replace the tangent. default should not be changed if used doubles have at least 10 decimal digits precision. */ PAR->fm = -1.; /* PDF at mode (unknown) */ PAR->hm = -1.; /* square of PDF at mode (unknown) */ par->method = UNUR_METH_UTDR; /* method */ par->variant = 0u; /* default variant */ par->set = 0u; /* inidicate default parameters */ par->urng = unur_get_default_urng(); /* use default urng */ par->urng_aux = NULL; /* no auxilliary URNG required */ par->debug = _unur_default_debugflag; /* set default debugging flags */ /* routine for starting generator */ par->init = _unur_utdr_init; return par; } /* end of unur_utdr_new() */ /*****************************************************************************/ int unur_utdr_set_pdfatmode( UNUR_PAR *par, double fmode ) /*----------------------------------------------------------------------*/ /* Set PDF at mode. if set, the PDF at the mode is never changed. */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* fmode ... PDF at mode */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, UTDR ); /* check new parameter for generator */ if (fmode <= 0.) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"PDF(mode)"); return UNUR_ERR_PAR_SET; } /* store date */ PAR->fm = fmode; /* PDF at mode */ PAR->hm = -1./sqrt(fmode); /* transformed PDF at mode */ /* changelog */ par->set |= UTDR_SET_PDFMODE; return UNUR_SUCCESS; } /* end of unur_utdr_set_pdfatmode() */ /*---------------------------------------------------------------------------*/ int unur_utdr_set_cpfactor( struct unur_par *par, double cp_factor ) /*----------------------------------------------------------------------*/ /* set factor for position of left and right construction point */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* cp_factor ... factor */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, UTDR ); /* check new parameter for generator */ /** TODO: welche werte fuer c sind zulaessig / sinnvoll ? zulaessig ist jedes c>0, man koennte damit falsche Flaechenangaben kompensieren. Wenn area genau bekannt ist, ist ein c > 2 (2 ist der minimax approach) so weit ich weiss nie sinnvoll. Ich denke aber, das sollte man besser nicht prinzipiell verbieten, hoechstens eine warnung.**/ if (cp_factor <= 0.) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"cp-factor <= 0"); return UNUR_ERR_PAR_SET; } if (cp_factor > 2.1) _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"cp-factor > 2 not recommended. skip"); /* store date */ PAR->c_factor = cp_factor; /* changelog */ par->set |= UTDR_SET_CPFACTOR; return UNUR_SUCCESS; } /* end of unur_utdr_set_cpfactor() */ /*---------------------------------------------------------------------------*/ int unur_utdr_set_deltafactor( struct unur_par *par, double delta ) /*----------------------------------------------------------------------*/ /* set factor for replacing tangents by secants */ /* (which then are move above the transformed density) */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* delta ... delta-factor */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, UTDR ); /* check new parameter for generator */ /** TODO: welche werte fuer delta sind zulaessig / sinnvoll ? von einem rein numerischen Gesichtspunkt kann man sagen: Delta_factor soll nicht kleiner sein als sqrt(epsilon) (mit epsilon meine ich die kleinste Zahl die einen Unterschied zwischen 1 und 1+epsilon erkennen laesst). Dann ist garantiert, dass wir durch Ausloeschung nicht mehr als die haelfte der mantisse verlieren Von Algorithmus ueberlegungen her sollte delta>=xl*deltafactor sicher nicht groesser sein als ein Bruchteil (wohl hoechstens 1/10) zwischen mode und Design-punkt, weil sonst die Anahmewahrscheinlichkeit schlechter wird. Das ergibt sicher probleme fuer Dichten wo der mode sehr gross und der skale-parameter im Vergleich dazu klein ist. Ich habe den Algorithmus so geaendert, dass er, falls es dieses Problem gibt, eine (roundoff-problem) Warnung ausspuckt, und als Delta 1/100*|designpoint-mode| nimmt Empirisch habe ich dafuer festgestellt, dass damit die Flaeche unterm Hut Kaum mehr als 1% zunimmt und das ist ja nicht schlimm**/ if (delta <= 0.) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"delta <= 0"); return UNUR_ERR_PAR_SET; } if (delta > 0.1) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"delta must be small"); return UNUR_ERR_PAR_SET; } /* store date */ PAR->delta_factor = delta; /* changelog */ par->set |= UTDR_SET_DELTA; return UNUR_SUCCESS; } /* end of unur_utdr_set_delta() */ /*---------------------------------------------------------------------------*/ int unur_utdr_set_verify( struct unur_par *par, int verify ) /*----------------------------------------------------------------------*/ /* turn verifying of algorithm while sampling on/off */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* verify ... 0 = no verifying, !0 = verifying */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* no verifying is the default */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, UTDR ); /* we use a bit in variant */ par->variant = (verify) ? (par->variant | UTDR_VARFLAG_VERIFY) : (par->variant & (~UTDR_VARFLAG_VERIFY)); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_utdr_set_verify() */ /*---------------------------------------------------------------------------*/ int unur_utdr_chg_verify( struct unur_gen *gen, int verify ) /*----------------------------------------------------------------------*/ /* turn verifying of algorithm while sampling on/off */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* verify ... 0 = no verifying, !0 = verifying */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* no verifying is the default */ /*----------------------------------------------------------------------*/ { /* check input */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, UTDR, UNUR_ERR_GEN_INVALID ); /* we must not change this switch when sampling has been disabled by using a pointer to the error producing routine */ if (SAMPLE == _unur_sample_cont_error) return UNUR_FAILURE; if (verify) /* turn verify mode on */ gen->variant |= UTDR_VARFLAG_VERIFY; else /* turn verify mode off */ gen->variant &= ~UTDR_VARFLAG_VERIFY; SAMPLE = _unur_utdr_getSAMPLE(gen); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_utdr_chg_verify() */ /*****************************************************************************/ int unur_utdr_chg_pdfatmode( struct unur_gen *gen, double fmode ) /*----------------------------------------------------------------------*/ /* change value of PDF at mode */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* fmode ... PDF at mode */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, UTDR, UNUR_ERR_GEN_INVALID ); /* check new parameter for generator */ if (fmode <= 0.) { _unur_warning(gen->genid,UNUR_ERR_PAR_SET,"PDF(mode)"); return UNUR_ERR_PAR_SET; } /* store date */ GEN->fm = fmode; /* PDF at mode */ GEN->hm = -1./sqrt(fmode); /* transformed PDF at mode */ /* changelog */ gen->set |= UTDR_SET_PDFMODE; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_utdr_chg_pdfatmode() */ /*****************************************************************************/ /** Private **/ /*****************************************************************************/ struct unur_gen * _unur_utdr_init( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* initialize new generator */ /* */ /* parameters: */ /* par ... pointer to paramters for building generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ _unur_check_NULL( GENTYPE,par,NULL ); /* check input */ if ( par->method != UNUR_METH_UTDR ) { _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); return NULL; } COOKIE_CHECK(par,CK_UTDR_PAR,NULL); /* create a new empty generator object */ gen = _unur_utdr_create(par); _unur_par_free(par); if (!gen) return NULL; /* check parameters */ if (_unur_utdr_check_par(gen) != UNUR_SUCCESS) { _unur_utdr_free(gen); return NULL; } /* create hat and squeeze (setup procedure) */ if ( _unur_utdr_hat(gen)!=UNUR_SUCCESS ) { _unur_utdr_free(gen); return NULL; } /* hat successfully created */ return gen; } /* end of _unur_utdr_init() */ /*---------------------------------------------------------------------------*/ int _unur_utdr_reinit( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* re-initialize (existing) generator. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int rcode; /* check parameters */ if ( (rcode = _unur_utdr_check_par(gen)) != UNUR_SUCCESS) return rcode; /* update left and right boundary for algorithm */ GEN->il = DISTR.BD_LEFT; GEN->ir = DISTR.BD_RIGHT; /* (re)set sampling routine */ SAMPLE = _unur_utdr_getSAMPLE(gen); /* compute universal bounding rectangle */ return _unur_utdr_hat( gen ); } /* end of _unur_utdr_reinit() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_utdr_create( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* allocate memory for generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* pointer to (empty) generator object with default settings */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_UTDR_PAR,NULL); /* create new generic generator object */ gen = _unur_generic_create( par, sizeof(struct unur_utdr_gen) ); /* magic cookies */ COOKIE_SET(gen,CK_UTDR_GEN); /* set generator identifier */ gen->genid = _unur_set_genid(GENTYPE); /* routines for sampling and destroying generator */ SAMPLE = _unur_utdr_getSAMPLE(gen); gen->destroy = _unur_utdr_free; gen->clone = _unur_utdr_clone; gen->reinit = _unur_utdr_reinit; /* copy some parameters into generator object */ GEN->il = DISTR.BD_LEFT; /* left boundary of domain */ GEN->ir = DISTR.BD_RIGHT; /* right boundary of domain */ GEN->fm = PAR->fm; /* PDF at mode */ GEN->hm = PAR->hm; /* square root of PDF at mode */ GEN->c_factor = PAR->c_factor; GEN->delta_factor = PAR->delta_factor; /* initialize parameters */ /** TODO !!! **/ /** ist das wirklich so noetig ?? **/ GEN->vollc = 0.; GEN->volcompl = 0.; GEN->voll = 0.; GEN->al = 0.; GEN->ar = 0.; GEN->col = 0.; GEN->cor = 0.; GEN->sal = 0.; GEN->sar = 0.; GEN->bl = 0.; GEN->br = 0.; GEN->ttlx = 0.; GEN->ttrx = 0.; GEN->brblvolc = 0.; GEN->drar = 0.; GEN->dlal = 0.; GEN->ooar2 = 0.; GEN->ooal2 = 0.; /* constants of the hat and for generation*/ #ifdef UNUR_ENABLE_INFO /* set function for creating info string */ gen->info = _unur_utdr_info; #endif /* return pointer to (almost empty) generator object */ return gen; } /* end of _unur_utdr_create() */ /*---------------------------------------------------------------------------*/ int _unur_utdr_check_par( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* check parameters of given distribution and method */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check for required data: mode */ if (!(gen->distr->set & UNUR_DISTR_SET_MODE)) { _unur_warning(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"mode: try finding it (numerically)"); if (unur_distr_cont_upd_mode(gen->distr)!=UNUR_SUCCESS) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"mode"); return UNUR_ERR_DISTR_REQUIRED; } } /* check for required data: area */ if (!(gen->distr->set & UNUR_DISTR_SET_PDFAREA)) { if (unur_distr_cont_upd_pdfarea(gen->distr)!=UNUR_SUCCESS) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"area below PDF"); return UNUR_ERR_DISTR_REQUIRED; } } /* mode must be in domain */ if ( (DISTR.mode < DISTR.BD_LEFT) || (DISTR.mode > DISTR.BD_RIGHT) ) { /* there is something wrong. assume: user has change domain without changing mode. but then, she probably has not updated area and is to large */ _unur_warning(GENTYPE,UNUR_ERR_GEN_DATA,"area and/or CDF at mode"); DISTR.mode = _unur_max(DISTR.mode,DISTR.BD_LEFT); DISTR.mode = _unur_min(DISTR.mode,DISTR.BD_RIGHT); } return UNUR_SUCCESS; } /* end of _unur_utdr_check_par() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_utdr_clone( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* copy (clone) generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to clone of generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { #define CLONE ((struct unur_utdr_gen*)clone->datap) struct unur_gen *clone; /* check arguments */ CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_UTDR_GEN,NULL); /* create generic clone */ clone = _unur_generic_clone( gen, GENTYPE ); return clone; #undef CLONE } /* end of _unur_utdr_clone() */ /*---------------------------------------------------------------------------*/ void _unur_utdr_free( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* deallocate generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { /* check arguments */ if( !gen ) /* nothing to do */ return; /* check input */ if ( gen->method != UNUR_METH_UTDR ) { _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); return; } COOKIE_CHECK(gen,CK_UTDR_GEN,RETURN_VOID); /* we cannot use this generator object any more */ SAMPLE = NULL; /* make sure to show up a programming error */ /* free memory */ _unur_generic_free(gen); } /* end of _unur_utdr_free() */ /*****************************************************************************/ double _unur_utdr_sample( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { double u,v,x,help,linx; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_UTDR_GEN,UNUR_INFINITY); while (1) { /*2*/ u = _unur_call_urng(gen->urng) * GEN->volcompl; /*2.1*/ if (u <= GEN->voll) { u = GEN->voll-u; /*added to ensure inversion for the hat-generation*/ x = -GEN->dlal+GEN->ooal2/(u-GEN->col); help = GEN->al*(u-GEN->col); linx = help*help; } else { if (u <= GEN->vollc) { x = (u-GEN->voll) * GEN->brblvolc + GEN->bl; linx = GEN->fm; } else { x = - GEN->drar - GEN->ooar2 / (u-GEN->vollc - GEN->cor); help = GEN->ar * (u-GEN->vollc - GEN->cor); linx = help*help; } } /*2.2*/ v = _unur_call_urng(gen->urng) * linx; /*2.3*/ if (x= GEN->ttlx) { help = GEN->hm - (DISTR.mode - x) * GEN->sal; if (v * help * help <= 1.) return x; } } else { if (x <= GEN->ttrx) { help = GEN->hm - (DISTR.mode - x) * GEN->sar; if (v * help * help <= 1.) return x; } } if (v <= PDF(x)) return x; } } /* end of _unur_utdr_sample() */ /*---------------------------------------------------------------------------*/ double _unur_utdr_sample_check( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { double u,v,x,help,linx,pdfx,squeezex; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_UTDR_GEN,UNUR_INFINITY); while (1) { /*2*/ u = _unur_call_urng(gen->urng) * GEN->volcompl; /*2.1*/ if (u <= GEN->voll) { u = GEN->voll-u; /* added to ensure inversion for the hat-generation */ x = -GEN->dlal+GEN->ooal2/(u-GEN->col); help = GEN->al*(u-GEN->col); linx = help*help; } else { if (u <= GEN->vollc) { x = (u-GEN->voll) * GEN->brblvolc + GEN->bl; linx = GEN->fm; } else { x = - GEN->drar - GEN->ooar2 / (u-GEN->vollc - GEN->cor); help = GEN->ar * (u-GEN->vollc - GEN->cor); linx = help*help; } } /*2.2*/ v = _unur_call_urng(gen->urng) * linx; /*2.3*/ squeezex=0.; if (x= GEN->ttlx) { help = GEN->hm - (DISTR.mode - x) * GEN->sal; squeezex=1./(help*help); /* if (v * help * help <= 1.) return x;*/ } } else { if (x <= GEN->ttrx) { help = GEN->hm - (DISTR.mode - x) * GEN->sar; squeezex=1./(help*help); /* if (v * help * help <= 1.) return x; */ } } /*evaluate density-function*/ pdfx=PDF(x); /* verify hat function */ if(_unur_FP_less(linx,pdfx)) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF(x) > hat(x)"); _unur_log_printf(gen->genid,__FILE__,__LINE__,"x %e PDF(x) %e hat(x) %e squeeze(x) %e", \ x,pdfx,linx,squeezex ); } /* verify squeeze function */ if(_unur_FP_less(pdfx,squeezex)) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF(x) < squeeze(x)"); _unur_log_printf(gen->genid,__FILE__,__LINE__,"x %e PDF(x) %e hat(x) %e squeeze(x) %e", \ x,pdfx,linx,squeezex ); } if (v <= PDF(x)) return x; } } /* end of _unur_utdr_sample_check() */ /*****************************************************************************/ /** Auxilliary Routines **/ /*****************************************************************************/ /** TODO gibts da schon eine UNURAN constante? ich hab sie nicht gefunden!! **/ #define SMALL_VAL 1.e-50 /** JL: was soll die leisten? wenn sie gebraucht wird, wuerde ich sie mit einer entsprenden beschreibung in unuran_config.h stellen. **/ int _unur_utdr_hat( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* compute hat and squeeze */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { double fm; int setupok=1; double c,cfac,volc,volr,ttly,ttlys,ttry,ttrys,dl,dr,delta,delta1,delta2,pdfx; /* check arguments */ CHECK_NULL( gen, UNUR_ERR_NULL ); COOKIE_CHECK( gen, CK_UTDR_GEN, UNUR_ERR_COOKIE ); /* compute PDF at mode (if not given by user) */ if (!(gen->set & UTDR_SET_PDFMODE)) { fm = PDF(DISTR.mode); /* fm must be positive */ if (fm <= 0.) { _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"PDF(mode) <= 0."); return UNUR_ERR_GEN_DATA; } /* step 1.0 of algorithm UTDR */ GEN->fm = fm; /* PDF at mode */ GEN->hm = -1/sqrt(fm); /* transformed PDF at mode */ } /** TODO: inititialisieren notwendig ?? **/ /** ich habe diese variablen initialisiert, weil ich auf einem alpha rechner eine flaoting exception bei der ersten verwendung von ttry oder ttrys bekommen habe. das ist keine IEEE 764 architektur. es stand dann ttry irgend ein bitmuster, dass keiner regulaeren zahl entsprochen hat und daher die FPE versucht hat (in eine if abfrage !!) das zeigt, das da ttry tatsaechlich nicht initialiesiert verwendet wurde. das sollte man sauberer programmieren. **/ ttry = 0.; ttrys = 0.; ttly = 0.; ttlys = 0.; dl = 0.; dr = 0.; volr = 0.; /* start of the set-up procedure */ /* step 1.0 of algorithm UTDR */ /* see above or in unur_utdr_set_pdfatmode() */ do { /* 1.1 */ cfac = (setupok) ? GEN->c_factor : 2.; /* gibt es hier nur zwei varianten ?? ja*/ c = cfac * DISTR.area/GEN->fm; setupok=1; GEN->ttlx = DISTR.mode - c; GEN->ttrx = DISTR.mode + c; /* 1.2 */ /** TODO: kann man das nicht loeschen ?? **/ if (/*GEN->il > -UNUR_INFINITY &&*/ GEN->ttlx < GEN->il) { /* this is the case of no left tail*/ GEN->bl = GEN->il; GEN->al = 0.; GEN->voll = 0.; if (GEN->il < DISTR.mode) { /* if the left domain border is left of the mode we set ttlx only to use it for the squeeze*/ GEN->ttlx = DISTR.mode + (GEN->il - DISTR.mode) * 0.6; pdfx=PDF(GEN->ttlx); if (pdfx > SMALL_VAL) GEN->sal = (GEN->hm + 1./sqrt(pdfx)) / (DISTR.mode - GEN->ttlx); else GEN->ttlx = DISTR.mode; /* pdfx is too small. We set ttlx=mode that no squeeze is used */ } } else { ttlys = PDF(GEN->ttlx); if (ttlys < SMALL_VAL) { /* in this case we cut off the left tail*/ GEN->il = GEN->ttlx; GEN->bl = GEN->il; GEN->al = 0.; GEN->voll = 0.; GEN->ttlx=DISTR.mode; /* pdfx is too small. We set ttlx=mode that no squeeze is used */ } else { ttlys = -1./sqrt(ttlys); GEN->sal = (GEN->hm - ttlys) / (DISTR.mode - GEN->ttlx); /* delta1> 0 as -ttlys>0 und sal >0; */ delta2 = ( GEN->sal > 0. ) ? -ttlys/GEN->sal : -ttlys; delta1 = fabs(GEN->ttlx); delta = GEN->delta_factor * ((delta1<=delta2) ? delta2 : delta1); if (delta > c * 0.01) { delta = UNUR_SQRT_DBL_EPSILON * ((delta1<=delta2) ? delta2 : delta1); /* Using sqrt(DBL_EPSILON) as delta_factor guarantees that not more than half of the precision will be lost when computing the slope GEN->al */ if (delta > c * 0.01) { delta = c * 0.01; /* delta is forced to be c * 0.01 although this can result in numerical inaccuracies when computing the slope GEN->al. Therefore a warning is issued */ _unur_warning(gen->genid,UNUR_ERR_GEN_DATA, "Delta larger than c/100!!, perhaps you can use a mode closer to 0 to remove this problem?"); } } ttly = -1./sqrt(PDF(GEN->ttlx+delta)); GEN->al = (ttly-ttlys)/delta; if (GEN->al <= 0.) /* setupok==0 means that this setup is quitted and set-up is restarted with different value for cfac */ setupok = 0; else { GEN->bl = GEN->ttlx + (GEN->hm - ttly)/GEN->al; dl = ttly - GEN->al * GEN->ttlx; GEN->voll = -1./(GEN->al * GEN->hm); GEN->col = GEN->voll; if (GEN->il > -UNUR_INFINITY) GEN->voll += 1./(GEN->al * (GEN->al * GEN->il + dl)); } } } /* 1.3 */ if(setupok) { if (/*GEN->ir < UNUR_INFINITY &&*/ GEN->ttrx > GEN->ir) { /* this is the case of no right tail */ GEN->br = GEN->ir; GEN->ar = 0.; volr = 0.; if (GEN->ir > DISTR.mode) { /* if the right domain border is right of the mode we set ttrx only to use it for the squeeze */ GEN->ttrx = DISTR.mode + (GEN->ir - DISTR.mode) * 0.6; pdfx = PDF(GEN->ttrx); if (pdfx > SMALL_VAL) GEN->sar = (GEN->hm + 1./sqrt(PDF(GEN->ttrx))) / (DISTR.mode - GEN->ttrx); else GEN->ttrx = DISTR.mode; /* pdfx is too small. We set ttrx=mode that no squeeze is used */ } } else { ttrys = PDF(GEN->ttrx); if (ttrys < SMALL_VAL){ /* in this case we cut off the right tail */ GEN->ir = GEN->ttrx; GEN->br = GEN->ir; GEN->ar = 0.; volr = 0.; GEN->ttrx = DISTR.mode; /* pdfx is too small. We set ttrx=mode that no squeeze is used */ } else { ttrys= -1./sqrt(ttrys); /* see 1.2. for explanations */ GEN->sar = (GEN->hm - ttrys) / (DISTR.mode - GEN->ttrx); /* delta is positive, da ttrys<0 und sar <0 */ delta2 = (GEN->sar<0.) ? ttrys/GEN->sar : -ttrys; delta1 = fabs(GEN->ttrx); delta = GEN->delta_factor * ((delta1<=delta2) ? delta2 : delta1); if (delta > c*0.01) { delta = UNUR_SQRT_DBL_EPSILON * ((delta1<=delta2) ? delta2 : delta1); /* Using sqrt(DBL_EPSILON) as delta_factor guarantees that not more than have of the precision will be lost when computing the slope GEN->al */ if (delta > c*0.01) { delta=c*0.01; /* delta is forced to be c*0.01 allthough this can result in numerical inaccuracies when computing the slope GEN->al. Therefore a warning is issued*/ _unur_warning(gen->genid,UNUR_ERR_ROUNDOFF, "Delta larger than c/100!!, perhaps you can use a mode closer to 0 to remove this problem?"); } } ttry = -1./sqrt(PDF(GEN->ttrx-delta)); GEN->ar = (ttrys - ttry)/delta; if (GEN->ar >= 0.) /* setupok==0 means that this setup is quitted and set-up is restarted with different value for cfac */ setupok = 0; else { GEN->br = GEN->ttrx + (GEN->hm - ttry) / GEN->ar; dr = ttry - GEN->ar * GEN->ttrx; volr = 1./(GEN->ar * GEN->hm); GEN->cor = volr; if (GEN->ir < UNUR_INFINITY) volr -= 1./(GEN->ar * (GEN->ar * GEN->ir + dr)); } } } } /* 1.4 */ if(setupok) { volc = (GEN->br - GEN->bl) * GEN->fm; GEN->vollc = GEN->voll + volc; GEN->volcompl = GEN->vollc + volr; if (volc>0.) GEN->brblvolc = (GEN->br - GEN->bl)/volc; if (!_unur_iszero(GEN->ar)) { GEN->drar = dr/GEN->ar; GEN->ooar2 = 1./(GEN->ar*GEN->ar); } if (!_unur_iszero(GEN->al)) { GEN->dlal = dl/GEN->al; GEN->ooal2 = 1./(GEN->al*GEN->al); } } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_utdr_debug_init(gen,ttly,ttlys,ttry,ttrys,cfac,setupok,c); #endif if (!_unur_isfsame(cfac,2.)) { if(setupok) if (GEN->volcompl > 4. * DISTR.area || GEN->volcompl < 0.5 * DISTR.area) setupok=0; } else { if (setupok==0 || GEN->volcompl > 8. * DISTR.area || GEN->volcompl < 0.5 * DISTR.area) { _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"; Area below hat too large or zero!! possible reasons: PDF, mode or area below PDF wrong; density not T-concave\n"); return 0; } } } while (!setupok); return UNUR_SUCCESS; } /* end of _unur_utdr_hat() */ #undef SMALL_VAL /*****************************************************************************/ /** Debugging utilities **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ static void _unur_utdr_debug_init( const struct unur_gen *gen, double ttly, double ttlys, double ttry, double ttrys, double cfac, int setupok, double c ) /*----------------------------------------------------------------------*/ /* write info about generator into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_UTDR_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: type = continuous univariate random variates\n",gen->genid); fprintf(LOG,"%s: method = utdr(transformed density rejection with 3 points of contact)\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); _unur_distr_cont_debug( gen->distr, gen->genid ); fprintf(LOG,"%s: sampling routine = _unur_utdr_sample",gen->genid); if (gen->variant & UTDR_VARFLAG_VERIFY) fprintf(LOG,"_check()\n"); else fprintf(LOG,"()\n"); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: Data for hat and squeeze:\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s:\tc_factor=%e delta_factor=%e real c=%e\n",gen->genid,GEN->c_factor,GEN->delta_factor,c); fprintf(LOG,"%s:\ttlx=%e bl=%e mode=%e\n",gen->genid,GEN->ttlx,GEN->bl,DISTR.mode); fprintf(LOG,"%s:\tbr=%e trx=%e\n",gen->genid,GEN->br,GEN->ttrx); fprintf(LOG,"%s:\ttly=%e tlys=%e al=%e \n",gen->genid,ttly,ttlys,GEN->al); fprintf(LOG,"%s:\ttry=%e trys=%e ar=%e \n",gen->genid,ttry,ttrys,GEN->ar); fprintf(LOG,"%s:\tcfac=%e setupok=%d volcompl=%e pdf_area=%e\n",gen->genid,cfac,setupok,GEN->volcompl,DISTR.area); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: INIT completed **********************\n",gen->genid); } /* end of _unur_utdr_debug_init() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_INFO /*---------------------------------------------------------------------------*/ void _unur_utdr_info( struct unur_gen *gen, int help ) /*----------------------------------------------------------------------*/ /* create character string that contains information about the */ /* given generator object. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* help ... whether to print additional comments */ /*----------------------------------------------------------------------*/ { struct unur_string *info = gen->infostr; struct unur_distr *distr = gen->distr; int samplesize = 10000; /* generator ID */ _unur_string_append(info,"generator ID: %s\n\n", gen->genid); /* distribution */ _unur_string_append(info,"distribution:\n"); _unur_distr_info_typename(gen); _unur_string_append(info," functions = PDF\n"); _unur_string_append(info," domain = (%g, %g)\n", DISTR.domain[0],DISTR.domain[1]); _unur_string_append(info," mode = %g %s\n", unur_distr_cont_get_mode(distr), (distr->set & UNUR_DISTR_SET_MODE_APPROX) ? "[numeric.]" : ""); _unur_string_append(info," area(PDF) = %g\n", DISTR.area); _unur_string_append(info,"\n"); /* method */ _unur_string_append(info,"method: UTDR (Universal Transformed Density Rejection -- 3 point method)\n"); _unur_string_append(info,"\n"); /* performance */ _unur_string_append(info,"performance characteristics:\n"); _unur_string_append(info," rejection constant = %.2f [approx.]\n", unur_test_count_urn(gen,samplesize,0,NULL)/(2.*samplesize)); _unur_string_append(info,"\n"); /* parameters */ if (help) { _unur_string_append(info,"parameters:\n"); _unur_string_append(info," deltafactor = %g %s\n", GEN->delta_factor, (gen->set & UTDR_SET_DELTA) ? "" : "[default]"); if (gen->set & UTDR_SET_PDFMODE) _unur_string_append(info," pdfatmode = %g\n", GEN->fm); if (gen->set & UTDR_SET_CPFACTOR) _unur_string_append(info," cpfactor = %g\n", GEN->c_factor); if (gen->variant & UTDR_VARFLAG_VERIFY) _unur_string_append(info," verify = on\n"); _unur_string_append(info,"\n"); } /* Hints */ /* if (help) { */ /* _unur_string_append(info,"\n"); */ /* } */ } /* end of _unur_utdr_info() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_INFO */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/hinv.c0000644001357500135600000026314514420445767013427 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: hinv.c * * * * TYPE: continuous univariate random variate * * METHOD: Hermite interpolation based INVersion of CDF * * * * DESCRIPTION: * * * * REQUIRED: * * pointer to the CDF * * * * OPTIONAL: * * pointer to PDF and dPDF * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * ***************************************************************************** * * * REFERENCES: * * [1] W. Hörmann and J. Leydold: * * Continuous Random Variate Generation by Fast Numerical Inversion, * * ACM Trans. Model. Comput. Simul. 13(4), pp. 347-362 (2003) * * * * [2] W. Hörmann, J. Leydold, and G. Derflinger: * * Automatic Nonuniform Random Variate Generation, * * Springer-Verlag, Berlin Heidelberg (2004) * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include "unur_methods_source.h" #include "x_gen_source.h" #include "hinv.h" #include "hinv_struct.h" /*---------------------------------------------------------------------------*/ /* Constants */ #define HINV_MAX_ITER (300) /* Maximal number of iterations for finding the boundary of the */ /* computational interval, i.e. where CDF(x) is close to 0 and 1, resp. */ #define HINV_MAX_U_LENGTH (0.05) /* Maximal value for |u_i - u_{i-1}|. If for an interval this value is */ /* larger then it is splitted (independently of its u-error). */ #define HINV_TAILCUTOFF_FACTOR (0.1) #define HINV_TAILCUTOFF_MIN (1.e-10) /* For unbounded domains the tails has to be cut off. We use the given */ /* u-resolution for finding the cut points. (The probability for each of the */ /* chopped regions should be less than */ /* HINV_TAILCUTOFF_FACTOR * u-resolution.) */ /* However, it should not be greater than some threshold value, given by */ /* HINV_TAILCUTOFF_MIN which reflects the precision of the used stream of */ /* uniform pseudo-random numbers (typically about 2^32). */ /* However, for computational reasons we use a value that is at least twice */ /* the machine epsilon for the right hand boundary. */ #define HINV_UERROR_CORRECTION (1.-HINV_TAILCUTOFF_FACTOR) /* HINV tries to create an approximation of the inverse CDF where the */ /* U-error is bounded by the given u-resolution. However, the error caused */ /* by cutting off the tails introduces some additional errors which must be */ /* corrected. Thus the upper bound for the pure approximation error by */ /* Hermite interpolation is set to HINV_UERROR_CORRECTION * u-resolution */ /* The correction factor should not exceed (1-HINV_TAILCUTOFF_FACTOR). */ #define HINV_XDEVIATION (0.05) /* Used for splitting intervals. When the u-error is estimated for an */ /* interval then the CDF is evaluated in the approximate center of the */ /* u-interval. This could be used as splitting point of the interval. */ /* However, this might result in slow convergence. A much more stable */ /* point is the center of the x-interval. However, this requires an */ /* additional evalution of the CDF. */ /* Thus we use the following rule: If CDF(approx. center of u-int) is */ /* close to the center of the x-interval use the first, otherwise use the */ /* latter. HINV_XDEVIATION is the threshold value for relative distance */ /* between these two points. */ /* As a rule-of-thumb larger values of HINV_XDEVIATION result in more */ /* intervals but less evaluations of the CDF (until there are too many */ /* intervals). */ /*---------------------------------------------------------------------------*/ /* Variants: none */ /*---------------------------------------------------------------------------*/ /* Debugging flags */ /* bit 01 ... pameters and structure of generator (do not use here) */ /* bits 02-12 ... setup */ /* bits 13-24 ... adaptive steps */ /* bits 25-32 ... trace sampling */ #define HINV_DEBUG_REINIT 0x00000002u /* print parameters after reinit */ #define HINV_DEBUG_TABLE 0x00000010u /* print table */ #define HINV_DEBUG_CHG 0x00001000u /* print changed parameters */ #define HINV_DEBUG_SAMPLE 0x01000000u /* trace sampling */ /*---------------------------------------------------------------------------*/ /* Flags for logging set calls */ #define HINV_SET_ORDER 0x001u /* order of polynomial */ #define HINV_SET_U_RESOLUTION 0x002u /* maximal error in u */ #define HINV_SET_STP 0x004u /* starting design points */ #define HINV_SET_BOUNDARY 0x008u /* boundary of computational region */ #define HINV_SET_GUIDEFACTOR 0x010u /* relative size of guide table */ #define HINV_SET_MAX_IVS 0x020u /* maximal number of intervals */ /*---------------------------------------------------------------------------*/ #define GENTYPE "HINV" /* type of generator */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_hinv_init( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* Initialize new generator. */ /*---------------------------------------------------------------------------*/ static int _unur_hinv_reinit( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Reinitialize generator. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_hinv_create( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* create new (almost empty) generator object. */ /*---------------------------------------------------------------------------*/ static int _unur_hinv_check_par( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Check parameters of given distribution and method */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_hinv_clone( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* copy (clone) generator object. */ /*---------------------------------------------------------------------------*/ static void _unur_hinv_free( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* destroy generator object. */ /*---------------------------------------------------------------------------*/ static double _unur_hinv_sample( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* sample from generator */ /*---------------------------------------------------------------------------*/ static double _unur_hinv_eval_approxinvcdf( const struct unur_gen *gen, double u ); /*---------------------------------------------------------------------------*/ /* evaluate Hermite interpolation of inverse CDF at u. */ /*---------------------------------------------------------------------------*/ static int _unur_hinv_find_boundary( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* find boundary of computational interval */ /*---------------------------------------------------------------------------*/ static int _unur_hinv_create_table( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* create the table with splines */ /*---------------------------------------------------------------------------*/ static struct unur_hinv_interval *_unur_hinv_interval_new( struct unur_gen *gen, double p, double u ); /*---------------------------------------------------------------------------*/ /* make a new interval with node (u=F(p),p). */ /*---------------------------------------------------------------------------*/ static struct unur_hinv_interval *_unur_hinv_interval_adapt( struct unur_gen *gen, struct unur_hinv_interval *iv, int *error_count_shortinterval ); /*---------------------------------------------------------------------------*/ /* check parameters in interval and split or truncate where necessary. */ /*---------------------------------------------------------------------------*/ static int _unur_hinv_interval_is_monotone( struct unur_gen *gen, struct unur_hinv_interval *iv ); /*---------------------------------------------------------------------------*/ /* check whether the given interval is monotone. */ /*---------------------------------------------------------------------------*/ static int _unur_hinv_interval_parameter( struct unur_gen *gen, struct unur_hinv_interval *iv ); /*---------------------------------------------------------------------------*/ /* compute all parameter for interval (spline coefficients). */ /*---------------------------------------------------------------------------*/ static double _unur_hinv_eval_polynomial( double x, double *coeff, int order ); /*---------------------------------------------------------------------------*/ /* evaluate polynomial. */ /*---------------------------------------------------------------------------*/ static int _unur_hinv_list_to_array( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* copy list of intervals into double array. */ /*---------------------------------------------------------------------------*/ static int _unur_hinv_make_guide_table( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* make a guide table for indexed search. */ /*---------------------------------------------------------------------------*/ static double _unur_hinv_CDF( const struct unur_gen *gen, double x ); /*---------------------------------------------------------------------------*/ /* compute CDF of truncated distribution. */ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ /* the following functions print debugging information on output stream, */ /* i.e., into the LOG file if not specified otherwise. */ /*---------------------------------------------------------------------------*/ static void _unur_hinv_debug_init( const struct unur_gen *gen, int ok); /*---------------------------------------------------------------------------*/ /* print after generator has been initialized has completed. */ /*---------------------------------------------------------------------------*/ static void _unur_hinv_debug_intervals( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print starting points or table for algorithms into LOG file. */ /*---------------------------------------------------------------------------*/ static void _unur_hinv_debug_chg_truncated( const struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* trace changes of the truncated domain. */ /*---------------------------------------------------------------------------*/ #endif #ifdef UNUR_ENABLE_INFO static void _unur_hinv_info( struct unur_gen *gen, int help ); /*---------------------------------------------------------------------------*/ /* create info string. */ /*---------------------------------------------------------------------------*/ #endif /*---------------------------------------------------------------------------*/ /* abbreviations */ #define DISTR_IN distr->data.cont /* data for distribution object */ #define PAR ((struct unur_hinv_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_hinv_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.cont /* data for distribution in generator object */ #define SAMPLE gen->sample.cont /* pointer to sampling routine */ /* CDF, PDF, and dPDF are rescaled such that the CDF is a "real" CDF with */ /* u (range) in (0,1) on the interval (DISTR.domain[0], DISTR.domain[1]). */ /* call to CDF: */ #define CDF(x) (_unur_hinv_CDF((gen),(x))) /* --> ((_unur_cont_CDF((x),(gen->distr))-GEN->CDFmin)/(GEN->CDFmax-GEN->CDFmin)) */ /* call to PDF: */ #define PDF(x) (_unur_cont_PDF((x),(gen->distr))/(GEN->CDFmax-GEN->CDFmin)) /* call to derivative of PDF: */ #define dPDF(x) (_unur_cont_dPDF((x),(gen->distr))/(GEN->CDFmax-GEN->CDFmin)) /*---------------------------------------------------------------------------*/ #define _unur_hinv_getSAMPLE(gen) (_unur_hinv_sample) /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Public: User Interface (API) **/ /*****************************************************************************/ struct unur_par * unur_hinv_new( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get default parameters */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* default parameters (pointer to structure) */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_par *par; /* check arguments */ _unur_check_NULL( GENTYPE,distr,NULL ); /* check distribution */ if (distr->type != UNUR_DISTR_CONT) { _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } COOKIE_CHECK(distr,CK_DISTR_CONT,NULL); if (DISTR_IN.cdf == NULL) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"CDF"); return NULL; } /* allocate structure */ par = _unur_par_new( sizeof(struct unur_hinv_par) ); COOKIE_SET(par,CK_HINV_PAR); /* copy input */ par->distr = distr; /* pointer to distribution object */ /* set default values */ PAR->order = (DISTR_IN.pdf) ? 3 : 1; /* order of polynomial */ PAR->u_resolution = 1.0e-10; /* maximal error allowed in u-direction */ PAR->guide_factor = 1.; /* size of guide table / number of intervals */ PAR->bleft = -1.e20; /* left border of the computational domain */ PAR->bright = 1.e20; /* right border of the computational domain */ PAR->max_ivs = 1000000; /* maximal number of intervals */ PAR->stp = NULL; /* starting nodes */ PAR->n_stp = 0; /* number of starting nodes */ par->method = UNUR_METH_HINV; /* method */ par->variant = 0u; /* default variant */ par->set = 0u; /* inidicate default parameters */ par->urng = unur_get_default_urng(); /* use default urng */ par->urng_aux = NULL; /* no auxilliary URNG required */ par->debug = _unur_default_debugflag; /* set default debugging flags */ /* routine for starting generator */ par->init = _unur_hinv_init; return par; } /* end of unur_hinv_new() */ /*****************************************************************************/ int unur_hinv_set_order( struct unur_par *par, int order) /*----------------------------------------------------------------------*/ /* Set order of Hermite interpolation. */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* order ... order of interpolation polynome */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, HINV ); /* check new parameter for generator */ if (order!=1 && order!=3 && order!=5) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"order"); return UNUR_ERR_PAR_SET; } if (order > 1 && par->distr->data.cont.pdf == NULL) { _unur_warning(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PDF"); return UNUR_ERR_DISTR_REQUIRED; } if (order > 3 && par->distr->data.cont.dpdf == NULL) { _unur_warning(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"dPDF"); return UNUR_ERR_DISTR_REQUIRED; } /* store date */ PAR->order = order; /* changelog */ par->set |= HINV_SET_ORDER; return UNUR_SUCCESS; } /* end of unur_hinv_set_order() */ /*---------------------------------------------------------------------------*/ int unur_hinv_set_u_resolution( struct unur_par *par, double u_resolution ) /*----------------------------------------------------------------------*/ /* set maximal relative error in x */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object*/ /* u_resolution ... maximal error in u */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, HINV ); /* check new parameter for generator */ if (u_resolution > 1.e-2) { /* this is obviously an error */ _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"u-resolution"); return UNUR_ERR_PAR_SET; } if (u_resolution < 5.*DBL_EPSILON ) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"u-resolution"); u_resolution = 5.*DBL_EPSILON; } if (u_resolution < UNUR_EPSILON) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"u-resolution so small that problems may occur"); } /* store date */ PAR->u_resolution = u_resolution; /* changelog */ par->set |= HINV_SET_U_RESOLUTION; return UNUR_SUCCESS; } /* end of unur_hinv_set_u_resolutuion() */ /*---------------------------------------------------------------------------*/ int unur_hinv_set_cpoints( struct unur_par *par, const double *stp, int n_stp ) /*----------------------------------------------------------------------*/ /* set starting construction points (nodes) for Hermite interpolation. */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* stp ... pointer to array of starting points */ /* n_stp ... number of starting points */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int i; /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, HINV ); /* check starting construction points */ if (n_stp < 1 || stp==NULL) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"number of starting points < 1"); return UNUR_ERR_PAR_SET; } /* starting points must be strictly monontonically increasing */ for( i=1; istp = stp; PAR->n_stp = n_stp; /* changelog */ par->set |= HINV_SET_STP; return UNUR_SUCCESS; } /* end of unur_hinv_set_cpoints() */ /*---------------------------------------------------------------------------*/ int unur_hinv_set_boundary( struct unur_par *par, double left, double right ) /*----------------------------------------------------------------------*/ /* set left and right boundary of computation interval */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* left ... left boundary point */ /* right ... right boundary point */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* new boundary points must not be +/- UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, HINV ); /* check new parameter for generator */ if (left >= right) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"domain"); return UNUR_ERR_PAR_SET; } if (left <= -UNUR_INFINITY || right >= UNUR_INFINITY) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"domain (+/- UNUR_INFINITY not allowed)"); return UNUR_ERR_PAR_SET; } /* store date */ PAR->bleft = left; PAR->bright = right; /* changelog */ par->set |= HINV_SET_BOUNDARY; return UNUR_SUCCESS; } /* end of unur_hinv_set_boundary() */ /*---------------------------------------------------------------------------*/ int unur_hinv_set_guidefactor( struct unur_par *par, double factor ) /*----------------------------------------------------------------------*/ /* set factor for relative size of guide table */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* factor ... relative size of table */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, HINV ); /* check new parameter for generator */ if (factor < 0) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"guide table size < 0"); return UNUR_ERR_PAR_SET; } /* store date */ PAR->guide_factor = factor; /* changelog */ par->set |= HINV_SET_GUIDEFACTOR; return UNUR_SUCCESS; } /* end of unur_hinv_set_guidefactor() */ /*---------------------------------------------------------------------------*/ int unur_hinv_set_max_intervals( struct unur_par *par, int max_ivs ) /*----------------------------------------------------------------------*/ /* set maximum number of intervals */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* max_ivs ... maximum number of intervals */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); /* check input */ _unur_check_par_object( par, HINV ); /* check new parameter for generator */ if (max_ivs < 1000 ) { /* it does not make sense to set this parameter too small */ _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"maximum number of intervals < 1000"); return UNUR_ERR_PAR_SET; } /* store date */ PAR->max_ivs = max_ivs; /* changelog */ par->set |= HINV_SET_MAX_IVS; return UNUR_SUCCESS; } /* end of unur_hinv_set_max_intervals() */ /*---------------------------------------------------------------------------*/ int unur_hinv_get_n_intervals( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* get number of intervals (or more precisely the number of nodes) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* number of intervals ... on success */ /* 0 ... on error */ /*----------------------------------------------------------------------*/ { /* check input */ _unur_check_NULL( GENTYPE, gen, 0 ); _unur_check_gen_object( gen, HINV, 0 ); return GEN->N; } /* end of unur_hinv_get_n_intervals() */ /*---------------------------------------------------------------------------*/ int unur_hinv_chg_truncated( struct unur_gen *gen, double left, double right ) /*----------------------------------------------------------------------*/ /* change the left and right borders of the domain of the distribution */ /* the new domain should not exceed the original domain given by */ /* unur_distr_cont_set_domain(). Otherwise it is truncated. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* left ... left boundary point */ /* right ... right boundary point */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* the new boundary points may be +/- UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { double Umin, Umax, Uminbound, Umaxbound; /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object(gen, HINV, UNUR_ERR_GEN_INVALID); /* the truncated domain must be a subset of (computational) domain */ if (left < GEN->bleft) { _unur_warning(gen->genid,UNUR_ERR_DISTR_SET,"domain, increase left boundary"); left = GEN->bleft; } if (right > GEN->bright) { _unur_warning(gen->genid,UNUR_ERR_DISTR_SET,"domain, decrease right boundary"); right = GEN->bright; } /* the truncated domain must have non-empty intersection */ if (!_unur_FP_less(left,right)) { _unur_error(gen->genid,UNUR_ERR_DISTR_SET,"domain, left >= right"); return UNUR_ERR_DISTR_SET; } /* compute Uminbound and Umaxbound using the u-value of the first and the last design point. */ /* this setting of Uminbound and Umaxbound guarantees that in the sampling algorithm U is always in a range where a table is available for the inverse CDF. So this is a safe guard against segfault for U=0. or U=1. */ Uminbound = _unur_max(0.,GEN->intervals[0]); Umaxbound = _unur_min(1.,GEN->intervals[(GEN->N-1)*(GEN->order+2)]); /* set bounds of U -- in respect to given bounds */ Umin = (left > -UNUR_INFINITY) ? CDF(left) : 0.; Umax = (right < UNUR_INFINITY) ? CDF(right) : 1.; /* check result */ if (Umin > Umax) { /* this is a serios error that should not happen */ _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); return UNUR_ERR_SHOULD_NOT_HAPPEN; } if (_unur_FP_equal(Umin,Umax)) { /* CDF values very close */ _unur_warning(gen->genid,UNUR_ERR_DISTR_SET,"CDF values very close"); if (_unur_iszero(Umin) || _unur_FP_same(Umax,1.)) { /* this is very bad */ _unur_error(gen->genid,UNUR_ERR_DISTR_SET,"CDF values at boundary points too close"); return UNUR_ERR_DISTR_SET; } } /* copy new boundaries into generator object */ DISTR.trunc[0] = left; DISTR.trunc[1] = right; GEN->Umin = _unur_max(Umin, Uminbound); GEN->Umax = _unur_min(Umax, Umaxbound); /* changelog */ gen->distr->set |= UNUR_DISTR_SET_TRUNCATED; #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug & HINV_DEBUG_CHG) _unur_hinv_debug_chg_truncated( gen ); #endif /* o.k. */ return UNUR_SUCCESS; } /* end of unur_hinv_chg_truncated() */ /*****************************************************************************/ /** Private **/ /*****************************************************************************/ struct unur_gen * _unur_hinv_init( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* initialize new generator */ /* */ /* parameters: */ /* params pointer to paramters for building generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ _unur_check_NULL( GENTYPE,par,NULL ); /* check input */ if ( par->method != UNUR_METH_HINV ) { _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); return NULL; } COOKIE_CHECK(par,CK_HINV_PAR,NULL); /* create a new empty generator object */ gen = _unur_hinv_create(par); _unur_par_free(par); if (!gen) return NULL; /* check parameters */ if (_unur_hinv_check_par(gen) != UNUR_SUCCESS) { _unur_hinv_free(gen); return NULL; } /* compute splines */ if (_unur_hinv_create_table(gen)!=UNUR_SUCCESS) { /* make entry in LOG file */ #ifdef UNUR_ENABLE_LOGGING if (gen->debug) { _unur_hinv_list_to_array( gen ); _unur_hinv_debug_init(gen,FALSE); } #endif _unur_hinv_free(gen); return NULL; } /* copy linked list into array */ _unur_hinv_list_to_array( gen ); /* adjust minimal and maximal U value */ GEN->Umin = _unur_max(0.,GEN->intervals[0]); GEN->Umax = _unur_min(1.,GEN->intervals[(GEN->N-1)*(GEN->order+2)]); /* this setting of Umin and Umax guarantees that in the sampling algorithm U is always in a range where a table is available for the inverse CDF. So this is a safe guard against segfault for U=0. or U=1. */ /* These values for Umin and Umax are only changed in unur_hinv_chg_truncated(). */ /* make guide table */ _unur_hinv_make_guide_table(gen); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_hinv_debug_init(gen,TRUE); #endif /* we do not use 'stp' any more. since it contains a pointer to an array outside the generator object. thus we set the pointer to NULL */ GEN->stp = NULL; GEN->n_stp = 0; /* o.k. */ return gen; } /* end of _unur_hinv_init() */ /*---------------------------------------------------------------------------*/ int _unur_hinv_reinit( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* re-initialize (existing) generator. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int rcode; /* check parameters */ if ( (rcode = _unur_hinv_check_par(gen)) != UNUR_SUCCESS) return rcode; /* compute splines */ if ( (rcode = _unur_hinv_create_table(gen)) != UNUR_SUCCESS) return rcode; /* copy linked list into array */ _unur_hinv_list_to_array( gen ); /* adjust minimal and maximal U value */ GEN->Umin = _unur_max(0.,GEN->intervals[0]); GEN->Umax = _unur_min(1.,GEN->intervals[(GEN->N-1)*(GEN->order+2)]); /* (re)set sampling routine */ SAMPLE = _unur_hinv_getSAMPLE(gen); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug & HINV_DEBUG_REINIT) _unur_hinv_debug_init(gen,TRUE); #endif /* make guide table */ _unur_hinv_make_guide_table(gen); return UNUR_SUCCESS; } /* end of _unur_hinv_reinit() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_hinv_create( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* allocate memory for generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* pointer to (empty) generator object with default settings */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_HINV_PAR,NULL); /* create new generic generator object */ gen = _unur_generic_create( par, sizeof(struct unur_hinv_gen) ); /* magic cookies */ COOKIE_SET(gen,CK_HINV_GEN); /* set generator identifier */ gen->genid = _unur_set_genid(GENTYPE); /* routines for sampling and destroying generator */ SAMPLE = _unur_hinv_getSAMPLE(gen); gen->destroy = _unur_hinv_free; gen->clone = _unur_hinv_clone; gen->reinit = _unur_hinv_reinit; /* copy parameters into generator object */ GEN->order = PAR->order; /* order of polynomial */ GEN->u_resolution = PAR->u_resolution; /* maximal error in u-direction */ GEN->guide_factor = PAR->guide_factor; /* relative size of guide tables */ GEN->bleft_par = PAR->bleft; /* border of computational domain */ GEN->bright_par = PAR->bright; GEN->max_ivs = PAR->max_ivs; /* maximum number of intervals */ GEN->stp = PAR->stp; /* pointer to array of starting points */ GEN->n_stp = PAR->n_stp; /* number of construction points */ /* default values */ GEN->tailcutoff_left = -1.; /* no cut-off by default */ GEN->tailcutoff_right = 10.; /* initialize variables */ GEN->bleft = GEN->bleft_par; GEN->bright = GEN->bright_par; GEN->Umin = 0.; GEN->Umax = 1.; GEN->N = 0; GEN->iv = NULL; GEN->intervals = NULL; GEN->guide_size = 0; GEN->guide = NULL; #ifdef UNUR_ENABLE_INFO /* set function for creating info string */ gen->info = _unur_hinv_info; #endif /* return pointer to (almost empty) generator object */ return gen; } /* end of _unur_hinv_create() */ /*---------------------------------------------------------------------------*/ int _unur_hinv_check_par( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* check parameters of given distribution and method */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { double tailcutoff; /* default tail cut-off points */ tailcutoff = _unur_min(HINV_TAILCUTOFF_MIN, HINV_TAILCUTOFF_FACTOR * GEN->u_resolution); tailcutoff = _unur_max(tailcutoff, 2*DBL_EPSILON); /* computational domain as given by user */ GEN->bleft = GEN->bleft_par; GEN->bright = GEN->bright_par; /* domain not truncated at init */ DISTR.trunc[0] = DISTR.domain[0]; DISTR.trunc[1] = DISTR.domain[1]; /* set bounds of U -- in respect to given bounds */ GEN->CDFmin = (DISTR.domain[0] > -UNUR_INFINITY) ? _unur_cont_CDF((DISTR.domain[0]),(gen->distr)) : 0.; GEN->CDFmax = (DISTR.domain[1] < UNUR_INFINITY) ? _unur_cont_CDF((DISTR.domain[1]),(gen->distr)) : 1.; if (!_unur_FP_less(GEN->CDFmin,GEN->CDFmax)) { _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"CDF not increasing"); return UNUR_ERR_GEN_DATA; } /* cut points for tails */ if (DISTR.domain[0] <= -UNUR_INFINITY || (DISTR.pdf!=NULL && _unur_cont_PDF((DISTR.domain[0]),(gen->distr))<=0.) ) { GEN->tailcutoff_left = tailcutoff; } if (DISTR.domain[1] >= UNUR_INFINITY || (DISTR.pdf!=NULL && _unur_cont_PDF((DISTR.domain[1]),(gen->distr))<=0.) ) { GEN->tailcutoff_right = 1.- tailcutoff; } return UNUR_SUCCESS; } /* end of _unur_hinv_check_par() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_hinv_clone( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* copy (clone) generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to clone of generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { #define CLONE ((struct unur_hinv_gen*)clone->datap) struct unur_gen *clone; /* check arguments */ CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_HINV_GEN,NULL); /* create generic clone */ clone = _unur_generic_clone( gen, GENTYPE ); /* copy tables for generator object */ CLONE->intervals = _unur_xmalloc( GEN->N*(GEN->order+2) * sizeof(double) ); memcpy( CLONE->intervals, GEN->intervals, GEN->N*(GEN->order+2) * sizeof(double) ); CLONE->guide = _unur_xmalloc( GEN->guide_size * sizeof(int) ); memcpy( CLONE->guide, GEN->guide, GEN->guide_size * sizeof(int) ); return clone; #undef CLONE } /* end of _unur_hinv_clone() */ /*---------------------------------------------------------------------------*/ void _unur_hinv_free( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* deallocate generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { /* check arguments */ if( !gen ) /* nothing to do */ return; /* check input */ if ( gen->method != UNUR_METH_HINV ) { _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); return; } COOKIE_CHECK(gen,CK_HINV_GEN,RETURN_VOID); /* we cannot use this generator object any more */ SAMPLE = NULL; /* make sure to show up a programming error */ /* free linked list of intervals */ if (GEN->iv) { struct unur_hinv_interval *iv,*next; for (iv = GEN->iv; iv != NULL; iv = next) { next = iv->next; free(iv); } } /* free tables */ if (GEN->intervals) free (GEN->intervals); if (GEN->guide) free (GEN->guide); /* free memory */ _unur_generic_free(gen); } /* end of _unur_hinv_free() */ /*****************************************************************************/ double _unur_hinv_sample( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { double U,X; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_HINV_GEN,UNUR_INFINITY); /* sample from U( Umin, Umax ) */ U = GEN->Umin + _unur_call_urng(gen->urng) * (GEN->Umax - GEN->Umin); /* compute inverse CDF */ X = _unur_hinv_eval_approxinvcdf(gen,U); if (XDISTR.trunc[1]) return DISTR.trunc[1]; return X; } /* end of _unur_hinv_sample() */ /*---------------------------------------------------------------------------*/ double _unur_hinv_eval_approxinvcdf( const struct unur_gen *gen, double u ) /*----------------------------------------------------------------------*/ /* evaluate Hermite interpolation of inverse CDF at u */ /* (internal call) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* u ... argument for inverse CDF (0<=u<=1, no validation!) */ /* */ /* return: */ /* double (approximate inverse CDF) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { int i; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_HINV_GEN,UNUR_INFINITY); /* look up in guide table and search for interval */ i = GEN->guide[(int) (GEN->guide_size*u)]; while (u > GEN->intervals[i+GEN->order+2]) i += GEN->order+2; /* rescale uniform random number */ u = (u-GEN->intervals[i])/(GEN->intervals[i+GEN->order+2] - GEN->intervals[i]); /* evaluate polynome */ return _unur_hinv_eval_polynomial( u, GEN->intervals+i+1, GEN->order ); } /* end of _unur_hinv_eval_approxinvcdf() */ /*---------------------------------------------------------------------------*/ double unur_hinv_eval_approxinvcdf( const struct unur_gen *gen, double u ) /*----------------------------------------------------------------------*/ /* evaluate Hermite interpolation of inverse CDF at u */ /* (user call) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* u ... argument for inverse CDF (0<=u<=1) */ /* */ /* return: */ /* double (approximate inverse CDF) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { double x; /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); if ( gen->method != UNUR_METH_HINV ) { _unur_error(gen->genid,UNUR_ERR_GEN_INVALID,""); return UNUR_INFINITY; } COOKIE_CHECK(gen,CK_HINV_GEN,UNUR_INFINITY); if ( ! (u>0. && u<1.)) { if ( ! (u>=0. && u<=1.)) { _unur_warning(gen->genid,UNUR_ERR_DOMAIN,"U not in [0,1]"); } if (u<=0.) return DISTR.trunc[0]; if (u>=1.) return DISTR.trunc[1]; return u; /* = NaN */ } /* rescale given u */ u = GEN->Umin + u * (GEN->Umax - GEN->Umin); /* compute inverse CDF */ x = _unur_hinv_eval_approxinvcdf(gen,u); /* validate range */ if (xDISTR.trunc[1]) x = DISTR.trunc[1]; return x; } /* end of unur_hinv_eval_approxinvcdf() */ /*****************************************************************************/ int unur_hinv_estimate_error( const UNUR_GEN *gen, int samplesize, double *max_error, double *MAE ) /*----------------------------------------------------------------------*/ /* Estimate maximal u-error and mean absolute error (MAE) by means of */ /* Monte-Carlo simulation. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* samplesize ... sample size for Monte Carlo simulation */ /* max_error ... pointer to double for storing maximal u-error */ /* MAE ... pointer to double for storing MA u-error */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL(GENTYPE, gen, UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_HINV_GEN,UNUR_ERR_COOKIE); /* run test */ unur_test_u_error(gen, max_error, MAE, 1.e-20, samplesize, FALSE, FALSE, FALSE, NULL); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_hinv_estimate_error() */ /*****************************************************************************/ /** Auxilliary Routines **/ /*****************************************************************************/ int _unur_hinv_find_boundary( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* find boundary of computational interval */ /* */ /* parameters: */ /* gen ... pointer generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { double x,u; int i; /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_HINV_GEN,UNUR_ERR_COOKIE); /* reset counter for intervals */ GEN->N = 0; /* boundary of the computational domain must not exceed domain of distribution */ if (GEN->bleft < DISTR.domain[0]) GEN->bleft = DISTR.domain[0]; if (GEN->bright > DISTR.domain[1]) GEN->bright = DISTR.domain[1]; /* find left boundary point */ for (x = GEN->bleft, i=0; ibleft = x; u = CDF(GEN->bleft); /* everything fine ? */ if (u <= GEN->tailcutoff_left || GEN->tailcutoff_left < 0.) break; /* otherwise ... */ if (DISTR.domain[0] <= -UNUR_INFINITY) { /* domain not bounded from below */ x = (GEN->bleft > -1.) ? -1. : 10.*GEN->bleft; if (! _unur_isfinite(x) ) i = HINV_MAX_ITER; } else { /* domain bounded from below */ x = _unur_arcmean(GEN->bleft, DISTR.domain[0]); if (_unur_FP_equal(x,DISTR.domain[0])) i = HINV_MAX_ITER; } } /* computation successful ? */ if (i >= HINV_MAX_ITER) _unur_warning(gen->genid,UNUR_ERR_DISTR_PROP,"cannot find l.h.s. of domain"); /* make l.h.s. starting interval */ GEN->iv = _unur_hinv_interval_new(gen,GEN->bleft,u); if (GEN->iv == NULL) return UNUR_ERR_GEN_DATA; /* find right boundary point */ for (x = GEN->bright, i=0; ibright = x; u = CDF(GEN->bright); /* everything fine ? */ if (u >= GEN->tailcutoff_right || GEN->tailcutoff_right > 1.1) break; /* otherwise ... */ if (DISTR.domain[1] >= UNUR_INFINITY) { /* domain not bounded from above */ x = (GEN->bright < 1.) ? 1. : 10.*GEN->bright; if (! _unur_isfinite(x) ) i = HINV_MAX_ITER; } else { /* domain bounded from below */ x = _unur_arcmean(GEN->bright, DISTR.domain[1]); if (_unur_FP_equal(x,DISTR.domain[1])) i = HINV_MAX_ITER; } } /* computation successful ? */ if (i >= HINV_MAX_ITER) _unur_warning(gen->genid,UNUR_ERR_DISTR_PROP,"cannot find r.h.s. of domain"); /* make r.h.s. starting intervals */ GEN->iv->next = _unur_hinv_interval_new(gen,GEN->bright,u); if (GEN->iv->next == NULL) return UNUR_ERR_GEN_DATA; /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_hinv_find_boundary() */ /*---------------------------------------------------------------------------*/ int _unur_hinv_create_table( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* create a table of splines */ /* */ /* parameters: */ /* gen ... pointer generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { struct unur_hinv_interval *iv, *iv_new; int i, error_count_shortinterval=0; double Fx; /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_HINV_GEN,UNUR_ERR_COOKIE); /* find boundary point of computational interval */ if (_unur_hinv_find_boundary(gen) != UNUR_SUCCESS) return UNUR_ERR_GEN_DATA; /* use starting design points of given */ if (GEN->stp) { iv = GEN->iv; for (i=0; in_stp; i++) { if (!_unur_FP_greater(GEN->stp[i],GEN->bleft)) continue; /* skip */ if (!_unur_FP_less(GEN->stp[i],GEN->bright)) break; /* no more points */ Fx = CDF(GEN->stp[i]); iv_new = _unur_hinv_interval_new(gen,GEN->stp[i],Fx); if (iv_new == NULL) return UNUR_ERR_GEN_DATA; iv_new->next = iv->next; iv->next = iv_new; iv = iv_new; if (Fx > GEN->tailcutoff_right) /* there is no need to add another starting point in the r.h. tail */ break; } } else /* mode - if known - is inserted as "default design point" */ if( (gen->distr->set & UNUR_DISTR_SET_MODE) && _unur_FP_greater(DISTR.mode, GEN->bleft) && _unur_FP_less(DISTR.mode, GEN->bright) ) { iv = GEN->iv; iv_new = _unur_hinv_interval_new(gen,DISTR.mode,CDF(DISTR.mode)); if (iv_new == NULL) return UNUR_ERR_GEN_DATA; iv_new->next = iv->next; iv->next = iv_new; } /* now split intervals where approximation error is too large */ for (iv=GEN->iv; iv->next!=NULL; ) { COOKIE_CHECK(iv,CK_HINV_IV,UNUR_ERR_COOKIE); if (GEN->N >= GEN->max_ivs) { /* emergency break */ _unur_error(GENTYPE,UNUR_ERR_GEN_CONDITION,"too many intervals"); return UNUR_ERR_GEN_CONDITION; } iv = _unur_hinv_interval_adapt(gen,iv, &error_count_shortinterval); if (iv == NULL) return UNUR_ERR_GEN_DATA; } /* last interval is only used to store right boundary */ iv->spline[0] = iv->p; /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_hinv_create_table() */ /*---------------------------------------------------------------------------*/ struct unur_hinv_interval * _unur_hinv_interval_new( struct unur_gen *gen, double p, double u ) /*----------------------------------------------------------------------*/ /* make a new interval with node (u=F(p),p). */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* p ... left design point of new interval */ /* u ... value of CDF at p, u=CDF(p) */ /* */ /* return: */ /* pointer to new interval */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_hinv_interval *iv; /* check arguments */ CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_HINV_GEN,NULL); /* first check u */ if (u<0.) { if (u < -UNUR_SQRT_DBL_EPSILON) { _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"CDF(x) < 0."); return NULL; } else { /* round off error */ u = 0.; } } if (u>1.) { _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"CDF(x) > 1."); return NULL; } /* we need new interval */ iv = _unur_xmalloc( sizeof(struct unur_hinv_interval) ); COOKIE_SET(iv,CK_HINV_IV); /* compute and store data */ switch (GEN->order) { case 5: iv->df = dPDF(p); /* FALLTHROUGH */ case 3: iv->f = PDF(p); /* FALLTHROUGH */ case 1: iv->p = p; iv->u = u; break; default: _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); free(iv); return NULL; } iv->next = NULL; /* add eol marker */ ++(GEN->N); /* increment counter for intervals */ /* o.k. */ return iv; } /* end of _unur_hinv_interval_new() */ /*---------------------------------------------------------------------------*/ struct unur_hinv_interval * _unur_hinv_interval_adapt( struct unur_gen *gen, struct unur_hinv_interval *iv, int *error_count_shortinterval ) /*----------------------------------------------------------------------*/ /* check parameters in interval and split or truncate where necessary. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* iv ... pointer to interval */ /* error_count_shortinterval ... pointer to errorcount to supress too */ /* many error messages */ /* */ /* return: */ /* iv ... if splitted */ /* iv->next ... if interval was o.k. */ /*----------------------------------------------------------------------*/ { double p_new; /* new design point */ struct unur_hinv_interval *iv_new, *iv_tmp; double x, Fx; /* check arguments */ CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_HINV_GEN,NULL); CHECK_NULL(iv,NULL); COOKIE_CHECK(iv,CK_HINV_IV,NULL); CHECK_NULL(iv->next,NULL); COOKIE_CHECK(iv->next,CK_HINV_IV,NULL); /* 1st check: right most interval (of at least 2) with CDF greater than GEN->tailcutoff_right */ iv_tmp = iv->next->next; if(iv_tmp && iv->next->u > GEN->tailcutoff_right) { /* chop off right hand tail */ free (iv_tmp); iv->next->next = NULL; GEN->N--; /* update right boundary */ GEN->bright = iv->next->p; return iv; } /* 2nd check: is the left most interval (of at least 2) with CDF less than GEN->tailcutoff_left */ if (iv==GEN->iv && iv->next->next && iv->next->u < GEN->tailcutoff_left) { /* chop off left hand tail */ iv_tmp = GEN->iv; GEN->iv = iv->next; free (iv_tmp); GEN->N--; /* update left boundary */ GEN->bleft = GEN->iv->p; return GEN->iv; } /* center of x-interval as splitting point */ p_new = 0.5 * (iv->next->p + iv->p); /* we do not split an interval if is too close */ /* changing the below FP_equal to FP_same can strongly increase the number of intervals needed and may slightly decrease the MAError. In both cases the required u-precision is not reached due to numerical problems with very steep CDF*/ if (_unur_FP_equal(p_new,iv->p) || _unur_FP_equal(p_new,iv->next->p)) { if(!(*error_count_shortinterval)){ _unur_warning(gen->genid,UNUR_ERR_ROUNDOFF, "one or more intervals very short; possibly due to numerical problems with a pole or very flat tail"); (*error_count_shortinterval)++; } /* skip to next interval */ _unur_hinv_interval_parameter(gen,iv); return iv->next; } /* 3rd check: |u_i - u_{i-1}| must not exceed threshold value */ /* 4th check: monotonicity */ if ( (iv->next->u - iv->u > HINV_MAX_U_LENGTH) || (! _unur_hinv_interval_is_monotone(gen,iv)) ) { /* insert new interval into linked list */ iv_new = _unur_hinv_interval_new(gen,p_new,CDF(p_new)); if (iv_new == NULL) return NULL; iv_new->next = iv->next; iv->next = iv_new; return iv; } /* compute coefficients for spline (only necessary if monotone) */ _unur_hinv_interval_parameter(gen,iv); /* 5th check: error in u-direction */ /* compute approximate value for inverse CDF in center of interval */ x = _unur_hinv_eval_polynomial( 0.5, iv->spline, GEN->order ); Fx = CDF(x); /* check for FP errors */ if (_unur_isnan(x)) { _unur_error(gen->genid,UNUR_ERR_ROUNDOFF, "NaN occured; possibly due to numerical problems with a pole or very flat tail"); return NULL; } /* check error */ if (!(fabs(Fx - 0.5*(iv->next->u + iv->u)) < (GEN->u_resolution * HINV_UERROR_CORRECTION))) { /* error in u-direction too large */ /* if possible we use the point x instead of p_new */ if(fabs(p_new-x)< HINV_XDEVIATION * (iv->next->p - iv->p)) iv_new = _unur_hinv_interval_new(gen,x,Fx); else iv_new = _unur_hinv_interval_new(gen,p_new,CDF(p_new)); if (iv_new == NULL) return NULL; iv_new->next = iv->next; iv->next = iv_new; return iv; } /* interval o.k. */ return iv->next; } /* end of _unur_hinv_interval_adapt() */ /*---------------------------------------------------------------------------*/ int _unur_hinv_interval_is_monotone( struct unur_gen *gen, struct unur_hinv_interval *iv ) /*----------------------------------------------------------------------*/ /* check whether the given interval is monotone. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* iv ... pointer to interval */ /* */ /* return: */ /* TRUE ... if monotone */ /* FALSE ... otherwise */ /*----------------------------------------------------------------------*/ { double bound; switch (GEN->order) { case 5: /* the monotone check is in the moment only implemented for order 3 as approximation we use the same check for order 5 */ case 3: /* we skip the test if computing the bound has too many round-off errors */ if (_unur_iszero(iv->u) || _unur_FP_approx(iv->u,iv->next->u)) return TRUE; /* difference quotient */ bound = 3.*(iv->next->p - iv->p)/(iv->next->u - iv->u); return (1./iv->next->f > bound || 1./iv->f > bound) ? FALSE : TRUE; case 1: /* linear interpolation is always monotone */ default: /* we assume that we have checked GEN->order very often till now */ return TRUE; } } /* end of _unur_hinv_interval_is_monotone() */ /*---------------------------------------------------------------------------*/ int _unur_hinv_interval_parameter( struct unur_gen *gen, struct unur_hinv_interval *iv ) /*----------------------------------------------------------------------*/ /* compute all parameter for interval (spline coefficients). */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* iv ... pointer to interval */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { double delta_u, delta_p; double f1, fs0, fs1, fss0, fss1; delta_u = iv->next->u - iv->u; delta_p = iv->next->p - iv->p; switch (GEN->order) { case 5: /* quintic Hermite interpolation */ if (iv->f > 0. && iv->next->f > 0. && iv->df < UNUR_INFINITY && iv->df > -UNUR_INFINITY && iv->next->df < UNUR_INFINITY && iv->next->df > -UNUR_INFINITY ) { f1 = delta_p; fs0 = delta_u / iv->f; fs1 = delta_u / iv->next->f; fss0 = -delta_u * delta_u * iv->df / (iv->f * iv->f * iv->f); fss1 = -delta_u * delta_u * iv->next->df / (iv->next->f * iv->next->f * iv->next->f); iv->spline[0] = iv->p; iv->spline[1] = fs0; iv->spline[2] = 0.5*fss0; iv->spline[3] = 10.*f1 - 6.*fs0 - 4.*fs1 - 1.5*fss0 + 0.5*fss1; iv->spline[4] = -15.*f1 + 8.*fs0 + 7.*fs1 + 1.5*fss0 - fss1; iv->spline[5] = 6.*f1 - 3.*fs0 - 3.*fs1 - 0.5*fss0 + 0.5*fss1; return UNUR_SUCCESS; } else { /* cannot use quintic interpolation in interval; use cubic instead */ iv->spline[4] = 0.; iv->spline[5] = 0.; } /* FALLTHROUGH */ case 3: /* cubic Hermite interpolation */ if (iv->f > 0. && iv->next->f > 0.) { iv->spline[0] = iv->p; iv->spline[1] = delta_u / iv->f; iv->spline[2] = 3.* delta_p - delta_u * (2./iv->f + 1./iv->next->f); iv->spline[3] = -2.* delta_p + delta_u * (1./iv->f + 1./iv->next->f); return UNUR_SUCCESS; } else { /* cannot use cubic interpolation in interval; use linear instead */ iv->spline[2] = 0.; iv->spline[3] = 0.; } /* FALLTHROUGH */ case 1: /* linear interpolation */ iv->spline[0] = iv->p; iv->spline[1] = delta_p; return UNUR_SUCCESS; default: _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); return UNUR_ERR_SHOULD_NOT_HAPPEN; } } /* end of _unur_hinv_interval_parameter() */ /*---------------------------------------------------------------------------*/ double _unur_hinv_eval_polynomial( double x, double *coeff, int order ) /*----------------------------------------------------------------------*/ /* evaluate polynomial using Horner scheme. */ /* */ /* parameters: */ /* x ... argument */ /* coeff ... coefficients of polynomial (increasing order) */ /* order ... order of polynomial */ /* */ /* return: */ /* value of spline at u */ /*----------------------------------------------------------------------*/ { int i; double poly; poly = coeff[order]; for (i=order-1; i>=0; i--) poly = x*poly + coeff[i]; return poly; } /* end of _unur_hinv_eval_polynomial() */ /*---------------------------------------------------------------------------*/ int _unur_hinv_list_to_array( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* copy list of intervals into double array. */ /* the linked list is freed. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int i; struct unur_hinv_interval *iv, *next; /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_HINV_GEN,UNUR_ERR_COOKIE); /* allocate memory */ GEN->intervals = _unur_xrealloc( GEN->intervals, GEN->N*(GEN->order+2)*sizeof(double) ); i = 0; for (iv=GEN->iv; iv!=NULL; iv=next) { /* copy */ GEN->intervals[i] = iv->u; memcpy( GEN->intervals+(i+1), &(iv->spline), (GEN->order+1)*sizeof(double) ); i += GEN->order+2; /* and free linked list */ next = iv->next; free(iv); } /* linked list is now empty */ GEN->iv = NULL; /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_hinv_list_to_array() */ /*---------------------------------------------------------------------------*/ int _unur_hinv_make_guide_table( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* make a guide table for indexed search */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int i,j, imax; /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_HINV_GEN,UNUR_ERR_COOKIE); /* allocate blocks for guide table (if necessary). (we allocate blocks for maximal guide table.) */ GEN->guide_size = (int) (GEN->N * GEN->guide_factor); if (GEN->guide_size <= 0) GEN->guide_size = 1; GEN->guide = _unur_xrealloc( GEN->guide, GEN->guide_size * sizeof(int) ); imax = (GEN->N-2) * (GEN->order+2); /* u value at end of interval */ # define u(i) (GEN->intervals[(i)+GEN->order+2]) i = 0; GEN->guide[0] = 0; for( j=1; jguide_size ;j++ ) { while( u(i) < (j/(double)GEN->guide_size) && i <= imax) i += GEN->order+2; if (i > imax) break; GEN->guide[j]=i; } # undef u /* check i */ i = _unur_min(i,imax); /* if there has been an round off error, we have to complete the guide table */ for( ; jguide_size ;j++ ) GEN->guide[j] = i; /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_hinv_make_guide_table() */ /*---------------------------------------------------------------------------*/ double _unur_hinv_CDF( const struct unur_gen *gen, double x ) /*----------------------------------------------------------------------*/ /* Compute CDF of truncated distribution. */ /* The CDF is rescaled such that the CDF is a "real" CDF with */ /* range u is [0,1] in the interval (DISTR.domain[0], DISTR.domain[1]). */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* x ... argument for CDF */ /*----------------------------------------------------------------------*/ { double u; /* check for boundaries */ if (x<=DISTR.domain[0]) return 0.; if (x>=DISTR.domain[1]) return 1.; /* compute rescaled CDF */ u = (_unur_cont_CDF(x,gen->distr) - GEN->CDFmin) / (GEN->CDFmax - GEN->CDFmin); /* we have to protect us against round-off errors. */ /* thus we allow results that are a little bit too large. */ if (u>1. && _unur_FP_equal(u,1.)) u = 1.; /* Remark: We do not change u if it is too large since then we assume that */ /* the given CDF is incorrect. */ return u; } /* end of _unur_hinv_CDF() */ /*****************************************************************************/ /** Debugging utilities **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ void _unur_hinv_debug_init( const struct unur_gen *gen, int ok ) /*----------------------------------------------------------------------*/ /* write info about generator into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* ok ... exitcode of init call */ /*----------------------------------------------------------------------*/ { FILE *LOG; int i; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_HINV_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: type = continuous univariate random variates\n",gen->genid); fprintf(LOG,"%s: method = HINV (Hermite approximation of INVerse CDF)\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); _unur_distr_cont_debug( gen->distr, gen->genid ); fprintf(LOG,"%s: sampling routine = _unur_hinv_sample\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: order of polynomial = %d",gen->genid,GEN->order); _unur_print_if_default(gen,HINV_SET_ORDER); fprintf(LOG,"\n%s: u-resolution = %g",gen->genid,GEN->u_resolution); _unur_print_if_default(gen,HINV_SET_U_RESOLUTION); fprintf(LOG,"\n%s: tail cut-off points = ",gen->genid); if (GEN->tailcutoff_left < 0.) fprintf(LOG,"none, "); else fprintf(LOG,"%g, ",GEN->tailcutoff_left); if (GEN->tailcutoff_right > 1.) fprintf(LOG,"none\n"); else fprintf(LOG,"1.-%g\n",1.-GEN->tailcutoff_right); fprintf(LOG,"%s: domain of computation = [%g,%g]\n",gen->genid,GEN->bleft,GEN->bright); fprintf(LOG,"%s:\tU in (%g,%g)\n",gen->genid,GEN->Umin,GEN->Umax); fprintf(LOG,"%s:\n",gen->genid); if (GEN->stp && gen->set & HINV_SET_STP) { fprintf(LOG,"%s: starting points: (%d)",gen->genid,GEN->n_stp); for (i=0; in_stp; i++) { if (i%5==0) fprintf(LOG,"\n%s:\t",gen->genid); fprintf(LOG," %#g,",GEN->stp[i]); } fprintf(LOG,"\n%s:\n",gen->genid); } fprintf(LOG,"%s: sampling from list of intervals: indexed search (guide table method)\n",gen->genid); fprintf(LOG,"%s: relative guide table size = %g%%",gen->genid,100.*GEN->guide_factor); _unur_print_if_default(gen,HINV_SET_GUIDEFACTOR); fprintf(LOG,"\n%s:\n",gen->genid); _unur_hinv_debug_intervals(gen); fprintf(LOG,"%s: initialization %s\n",gen->genid,((ok)?"successful":"failed")); fprintf(LOG,"%s:\n",gen->genid); fflush(LOG); } /* end of _unur_hinv_debug_init() */ /*---------------------------------------------------------------------------*/ void _unur_hinv_debug_intervals( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* print table of intervals into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { int i,n; FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_HINV_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s: Intervals: %d\n",gen->genid,GEN->N-1); if (gen->debug & HINV_DEBUG_TABLE) { fprintf(LOG,"%s: Nr. u=CDF(p) p=spline[0] spline[1] ...\n",gen->genid); for (n=0; nN-1; n++) { i = n*(GEN->order+2); fprintf(LOG,"%s:[%4d]: %#12.6g %#12.6g %#12.6g", gen->genid, n, GEN->intervals[i], GEN->intervals[i+1], GEN->intervals[i+2]); if (GEN->order>1) fprintf(LOG," %#12.6g %#12.6g", GEN->intervals[i+3], GEN->intervals[i+4]); if (GEN->order>3) fprintf(LOG," %#12.6g %#12.6g", GEN->intervals[i+5], GEN->intervals[i+6]); fprintf(LOG,"\n"); } /* the following might cause troubles when creating the tables fails. */ /* so we remove it. */ /* i = n*(GEN->order+2); */ /* fprintf(LOG,"%s:[%4d]: %#12.6g %#12.6g (right boundary)\n", gen->genid, n, */ /* GEN->intervals[i], GEN->intervals[i+1] ); */ } fprintf(LOG,"%s:\n",gen->genid); } /* end of _unur_hinv_debug_intervals() */ /*---------------------------------------------------------------------------*/ void _unur_hinv_debug_chg_truncated( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* print new (changed) domain of (truncated) distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_HINV_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s: domain of (truncated) distribution changed:\n",gen->genid); fprintf(LOG,"%s:\tdomain = (%g, %g)\n",gen->genid, DISTR.trunc[0], DISTR.trunc[1]); fprintf(LOG,"%s:\tU in (%g,%g)\n",gen->genid,GEN->Umin,GEN->Umax); } /* end of _unur_hinv_debug_chg_truncated() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_INFO /*---------------------------------------------------------------------------*/ void _unur_hinv_info( struct unur_gen *gen, int help ) /*----------------------------------------------------------------------*/ /* create character string that contains information about the */ /* given generator object. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* help ... whether to print additional comments */ /*----------------------------------------------------------------------*/ { struct unur_string *info = gen->infostr; struct unur_distr *distr = gen->distr; /* generator ID */ _unur_string_append(info,"generator ID: %s\n\n", gen->genid); /* distribution */ _unur_string_append(info,"distribution:\n"); _unur_distr_info_typename(gen); _unur_string_append(info," functions = CDF"); if (GEN->order > 1) _unur_string_append(info," PDF"); if (GEN->order > 3) _unur_string_append(info," dPDF"); _unur_string_append(info,"\n"); _unur_string_append(info," domain = (%g, %g)", DISTR.trunc[0],DISTR.trunc[1]); if (gen->distr->set & UNUR_DISTR_SET_TRUNCATED) { _unur_string_append(info," [truncated from (%g, %g)]", DISTR.domain[0],DISTR.domain[1]); } _unur_string_append(info,"\n"); if (distr->set & UNUR_DISTR_SET_MODE) { _unur_string_append(info," mode = %g\n", DISTR.mode); } if (help) if (! (distr->set & UNUR_DISTR_SET_MODE) ) _unur_string_append(info,"\n[ Hint: %s ]\n", "You may set the \"mode\" of the distribution in case of a high peak"); _unur_string_append(info,"\n"); /* method */ _unur_string_append(info,"method: HINV (Hermite approximation of INVerse CDF)\n"); _unur_string_append(info," order of polynomial = %d\n", GEN->order); _unur_string_append(info,"\n"); /* performance */ _unur_string_append(info,"performance characteristics:\n"); _unur_string_append(info," truncated domain = (%g,%g)\n",GEN->bleft,GEN->bright); _unur_string_append(info," Prob(Xtailcutoff_left)); _unur_string_append(info," Prob(X>domain) = %g\n", _unur_max(0,1.-GEN->tailcutoff_right)); { double max_error=1.; double MAE=1.; unur_hinv_estimate_error( gen, 10000, &max_error, &MAE ); _unur_string_append(info," u-error <= %g (mean = %g)\n", max_error, MAE); } _unur_string_append(info," # intervals = %d\n", GEN->N-1); _unur_string_append(info,"\n"); /* parameters */ if (help) { _unur_string_append(info,"parameters:\n"); _unur_string_append(info," order = %d %s\n", GEN->order, (gen->set & HINV_SET_ORDER) ? "" : "[default]"); _unur_string_append(info," u_resolution = %g %s\n", GEN->u_resolution, (gen->set & HINV_SET_U_RESOLUTION) ? "" : "[default]"); if (gen->set & HINV_SET_MAX_IVS) _unur_string_append(info," max_intervals = %d\n", GEN->max_ivs); _unur_string_append(info," boundary = (%g,%g) %s\n", GEN->bleft, GEN->bright, (gen->set & HINV_SET_BOUNDARY) ? "" : "[computed]"); _unur_string_append(info,"\n"); /* Not displayed: int unur_hinv_set_cpoints( UNUR_PAR *parameters, const double *stp, int n_stp ); int unur_hinv_set_guidefactor( UNUR_PAR *parameters, double factor ); */ } /* Hints */ if (help) { if ( GEN->order < 5 ) _unur_string_append(info,"[ Hint: %s ]\n", "You can set \"order=5\" to decrease #intervals"); if (! (gen->set & HINV_SET_U_RESOLUTION) ) _unur_string_append(info,"[ Hint: %s\n\t%s ]\n", "You can decrease the u-error by decreasing \"u_resolution\".", "(it is bounded by the machine epsilon, however.)"); _unur_string_append(info,"\n"); } } /* end of _unur_tdr_info() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_INFO */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/deprecated_vmt.h0000644001357500135600000001423114420445767015444 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: deprecated_vmt.h * * * * PURPOSE: * * function prototypes for method VMT * * (Vector Matrix Transformation) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * THIS METHOD AND THE CORRESPONDING ROUTINES SHOULD NOT BE USED ANY MORE! * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /* =deprecatedMETHOD VMT Vector Matrix Transformation =UP Methods_for_CVEC =REQUIRED mean vector, covariance matrix, standardized marginal distributions =SPEED Set-up: slow, Sampling: depends on dimension =REINIT supported =REF [HLD04: Sect.11.1.6, Alg.11.3.] =DESCRIPTION VMT generates random vectors for distributions with given mean vector mu and covariance matrix @unurmath{Sigma.} It produces random vectors of the form @unurmath{X = L Y + mu,} where @unurmath{L} is the Cholesky factor of Sigma, i.e. @unurmath{L L^t = Sigma,} and @unurmath{Y} has independent components of the same distribution with mean 0 and standard deviation 1. The method VMT has been implemented especially to sample from a multinormal distribution. Nevertheless, it can also be used (or abused) for other distributions. However, notice that the given standardized marginal distributions are not checked; i.e. if the given distributions do not have mean 0 and variance 1 then @unurmath{mu} and @unurmath{Sigma} are not the mean vector and covariance matrix, respectively, of the resulting distribution. @strong{Important:} Notice that except for the multinormal distribution the given marginal distribution are distorted by the transformation using the Cholesky matrix. Thus for other (non-multinormal) distributions this method should only be used when everything else fails and some approximate results which might even be not entirely correct are better than no results. A much better method is the NORTA (NORmal To Anything) method, see @ref{NORTA}. =HOWTOUSE Create a multivariate generator object, set mean vector and covariance matrix by means of the unur_distr_cvec_set_mean() and unur_distr_cvec_set_covar() call. Set standard marginal distributions using unur_distr_cvec_set_stdmarginals() , unur_distr_cvec_set_stdmarginal_array() , or unur_distr_cvec_set_stdmarginal_list(). (Do not use the corresponding calls for the (non-standard) marginal distributions). It is possible to change the parameters and the domain of the chosen distribution and run unur_reinit() to reinitialize the generator object. The method can also be used with multivariate distribution with a truncated domain, i.e., where the domain has been set by a unur_distr_cvec_set_domain_rect() call. However, it then uses a simple rejection method that can have extremely poor rejection constant especially when dimension is (even moderately) high. There are no optional parameters for this method. =END */ /*---------------------------------------------------------------------------*/ /* Routines for user interface */ /* =ROUTINES */ UNUR_PAR *unur_vmt_new( const UNUR_DISTR *distribution ); /* Get parameters for generator. */ /* =END */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/auto.c0000644001357500135600000004750414420445767013432 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: auto.c * * * * selects a method for a given distribution object AUTOmatically * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "unur_methods_source.h" #include "x_gen_source.h" #include "x_gen.h" #include "auto.h" #include "auto_struct.h" #include "cstd.h" #include "dari.h" #include "dgt.h" #include "dstd.h" #include "empk.h" #include "hist.h" #include "mvstd.h" #include "tdr.h" #include "vempk.h" /*---------------------------------------------------------------------------*/ /* Variants: none */ /*---------------------------------------------------------------------------*/ /* Debugging flags */ /* bit 01 ... pameters and structure of generator (do not use here) */ /* bits 02-12 ... setup */ /* bits 13-24 ... adaptive steps */ /* bits 25-32 ... trace sampling */ /*---------------------------------------------------------------------------*/ /* Flags for logging set calls */ #define AUTO_SET_LOGSS 0x001u /*---------------------------------------------------------------------------*/ #define GENTYPE "AUTO" /* type of generator */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_auto_init( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* Initialize new generator. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_init_cont( struct unur_par *par ); static struct unur_gen *_unur_init_cvec( struct unur_par *par ); static struct unur_gen *_unur_init_discr( struct unur_par *par ); static struct unur_gen *_unur_init_cemp( struct unur_par *par ); static struct unur_gen *_unur_init_cvemp( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* Initialize generator object for detected distribution type. */ /*---------------------------------------------------------------------------*/ /* static struct unur_gen *_unur_auto_create( struct unur_par *par ); */ /* static double _unur_auto_sample( struct unur_gen *gen ); */ /* static void _unur_auto_free( struct unur_gen *gen); */ /*---------------------------------------------------------------------------*/ /* no such functions! */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* abbreviations */ #define PAR ((struct unur_auto_par*)par->datap) /* data for parameter object */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Public: User Interface (API) **/ /*****************************************************************************/ struct unur_par * unur_auto_new( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get default parameters */ /* */ /* parameters: */ /* distr ... dummy pointer to distribution object */ /* */ /* return: */ /* default parameters (pointer to structure) */ /* */ /* error: */ /* return NULL */ /* */ /* comment: */ /* for testing. */ /*----------------------------------------------------------------------*/ { struct unur_par *par; /* check arguments */ _unur_check_NULL(GENTYPE,distr,NULL); /* allocate structure */ par = _unur_par_new( sizeof(struct unur_auto_par) ); COOKIE_SET(par,CK_AUTO_PAR); /* copy input */ par->distr = distr; /* pointer to distribution object */ /* set default values */ par->method = UNUR_METH_AUTO; /* method and default variant */ par->variant = 0u; /* default variant */ par->set = 0u; /* inidicate default parameters */ par->urng = unur_get_default_urng(); /* use default urng */ par->urng_aux = par->urng; /* no special auxilliary URNG */ par->debug = _unur_default_debugflag; /* set default debugging flags */ /* routine for starting generator */ par->init = _unur_auto_init; return par; } /* end of unur_auto_new() */ /*---------------------------------------------------------------------------*/ int unur_auto_set_logss( UNUR_PAR *par, int logss ) /*----------------------------------------------------------------------*/ /* set common logarithm of sample size */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* logss ... common logarithm of sample size */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); /* check input */ _unur_check_par_object( par, AUTO ); if (logss < 0 ) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"log < 0"); return UNUR_ERR_PAR_SET; } /* store date */ PAR->logss = logss; /* changelog */ par->set |= AUTO_SET_LOGSS; return UNUR_SUCCESS; } /* end of unur_auto_set_logss() */ /*****************************************************************************/ /** Private **/ /*****************************************************************************/ struct unur_gen * _unur_auto_init( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* initialize new generator */ /* */ /* parameters: */ /* par ... pointer to paramters for building generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); /* check input */ if ( par->method != UNUR_METH_AUTO ) { _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); return NULL; } COOKIE_CHECK(par,CK_AUTO_PAR,NULL); /* get distribution type */ switch (par->distr->type) { case UNUR_DISTR_CONT: gen = _unur_init_cont( par ); break; case UNUR_DISTR_CVEC: gen = _unur_init_cvec( par ); break; case UNUR_DISTR_DISCR: gen = _unur_init_discr( par ); break; case UNUR_DISTR_CEMP: gen = _unur_init_cemp( par ); break; case UNUR_DISTR_CVEMP: gen = _unur_init_cvemp( par ); break; default: _unur_error(GENTYPE,UNUR_ERR_SHOULD_NOT_HAPPEN,""); gen = NULL; break; } /* copy URNGs and debugging flags */ if (gen) { gen->urng = par->urng; gen->urng_aux = par->urng_aux; gen->debug = par->debug; } /* free parameters */ _unur_par_free(par); return gen; } /* end of _unur_auto_init() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Initialize generator object for detected distribution type **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_init_cont( struct unur_par *par_auto ) /*----------------------------------------------------------------------*/ /* initialize new generator for distribution type CONT */ /* */ /* parameters: */ /* par_auto ... pointer to paramters for building generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_par *par; struct unur_gen *gen; do { /* 1st choice: TDR */ par = unur_tdr_new(par_auto->distr); gen = unur_init(par); if (gen) break; /* 2nd choice: CSTD */ par = unur_cstd_new(par_auto->distr); gen = unur_init(par); if (gen) break; } while (0); return gen; } /* end of _unur_init_cont() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_init_cvec( struct unur_par *par_auto ) /*----------------------------------------------------------------------*/ /* initialize new generator for distribution type CVEC */ /* */ /* parameters: */ /* par_auto ... pointer to paramters for building generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_par *par; struct unur_gen *gen; /* Choose a method: MVSTD */ par = unur_mvstd_new(par_auto->distr); /* Create generator object */ gen = unur_init(par); return gen; } /* end of _unur_init_cvec() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_init_discr( struct unur_par *par_auto ) /*----------------------------------------------------------------------*/ /* initialize new generator for distribution type DISCR */ /* */ /* parameters: */ /* par_auto ... pointer to paramters for building generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_par *par; struct unur_gen *gen; do { /* 1st choice: DGT */ if (par_auto->distr->data.discr.pv != NULL) { par = unur_dgt_new(par_auto->distr); gen = unur_init(par); if (gen) break; } /* 2nd choice: DARI */ if (par_auto->distr->data.discr.pmf != NULL) { par = unur_dari_new(par_auto->distr); gen = unur_init(par); if (gen) break; /* try again with DGT (in this case we have to compute the PV) */ par = unur_dgt_new(par_auto->distr); gen = unur_init(par); if (gen) break; } /* 3rd choice: DSTD */ par = unur_dstd_new(par_auto->distr); gen = unur_init(par); if (gen) break; } while (0); return gen; } /* end of _unur_init_discr() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_init_cemp( struct unur_par *par_auto ) /*----------------------------------------------------------------------*/ /* initialize new generator for distribution type CEMP */ /* */ /* parameters: */ /* par_auto ... pointer to paramters for building generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_par *par; struct unur_gen *gen; do { /* 1st choice: EMPK [requires raw data] */ par = unur_empk_new(par_auto->distr); gen = unur_init(par); if (gen) break; /* 2nd choice: HIST [requires histogram] */ par = unur_hist_new(par_auto->distr); gen = unur_init(par); if (gen) break; } while(0); return gen; } /* end of _unur_init_cemp() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_init_cvemp( struct unur_par *par_auto ) /*----------------------------------------------------------------------*/ /* initialize new generator for distribution type CVEMP */ /* */ /* parameters: */ /* par_auto ... pointer to paramters for building generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_par *par; struct unur_gen *gen; /* Choose a method: VEMPK */ par = unur_vempk_new(par_auto->distr); /* Create generator object */ gen = unur_init(par); return gen; } /* end of _unur_init_cvemp() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Debugging utilities **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ /** None **/ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/hrd.c0000644001357500135600000010562414420445767013235 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: hrd.c * * * * TYPE: continuous univariate random variate * * METHOD: Hazard Rate Decreasing * * * * DESCRIPTION: * * Rejection with dynamic thinning. * * * * REQUIRED: * * pointer to the hazard rate * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * ***************************************************************************** * * * REFERENCES: * * * * Evrim Ozgul (2002): The generation of random variates with a given * * hazard rate, M.Sc. thesis, Department of Industrial Engineering, * * Bogazici University, Istanbul. * * * ***************************************************************************** * * * Rejection from majorizing hazard rate using dynamic thinning. * * This means that rejection from a constant hazard rate is used. * * When a point Xi is generated but rejected a new constant majorizing * * hazard rate with value HR(Xi) starting at Xi is used. * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include "unur_methods_source.h" #include "x_gen_source.h" #include "hrd.h" #include "hrd_struct.h" #ifdef UNUR_ENABLE_INFO # include #endif /*---------------------------------------------------------------------------*/ /* Constants */ /*---------------------------------------------------------------------------*/ /* Variants: */ #define HRD_VARFLAG_VERIFY 0x01u /* flag for verifying mode */ /*---------------------------------------------------------------------------*/ /* Debugging flags */ /* bit 01 ... pameters and structure of generator (do not use here) */ /* bits 02-12 ... setup */ /* bits 13-24 ... adaptive steps */ /* bits 25-32 ... trace sampling */ #define HRD_DEBUG_REINIT 0x00000010u /* print parameters after reinit */ #define HRD_DEBUG_SAMPLE 0x01000000u /* trace sampling (only if verify mode is on) */ /*---------------------------------------------------------------------------*/ /* Flags for logging set calls */ /*---------------------------------------------------------------------------*/ #define GENTYPE "HRD" /* type of generator */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_hrd_init( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* Initialize new generator. */ /*---------------------------------------------------------------------------*/ static int _unur_hrd_reinit( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Reinitialize generator. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_hrd_create( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* create new (almost empty) generator object. */ /*---------------------------------------------------------------------------*/ static int _unur_hrd_check_par( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Check parameters of given distribution and method */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_hrd_clone( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* copy (clone) generator object. */ /*---------------------------------------------------------------------------*/ static void _unur_hrd_free( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* destroy generator object. */ /*---------------------------------------------------------------------------*/ static double _unur_hrd_sample( struct unur_gen *gen ); static double _unur_hrd_sample_check( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* sample from generator */ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ /* the following functions print debugging information on output stream, */ /* i.e., into the LOG file if not specified otherwise. */ /*---------------------------------------------------------------------------*/ static void _unur_hrd_debug_init( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print after generator has been initialized has completed. */ /*---------------------------------------------------------------------------*/ static void _unur_hrd_debug_sample( const struct unur_gen *gen, double x, int i ); /*---------------------------------------------------------------------------*/ /* trace sampling. */ /*---------------------------------------------------------------------------*/ #endif #ifdef UNUR_ENABLE_INFO static void _unur_hrd_info( struct unur_gen *gen, int help ); /*---------------------------------------------------------------------------*/ /* create info string. */ /*---------------------------------------------------------------------------*/ #endif /*---------------------------------------------------------------------------*/ /* abbreviations */ #define DISTR_IN distr->data.cont /* data for distribution object */ #define PAR ((struct unur_hrd_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_hrd_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.cont /* data for distribution in generator object */ #define SAMPLE gen->sample.cont /* pointer to sampling routine */ #define HR(x) _unur_cont_HR((x),(gen->distr)) /* call to hazard rate */ /*---------------------------------------------------------------------------*/ #define _unur_hrd_getSAMPLE(gen) \ ( ((gen)->variant & HRD_VARFLAG_VERIFY) \ ? _unur_hrd_sample_check : _unur_hrd_sample ) /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Public: User Interface (API) **/ /*****************************************************************************/ struct unur_par * unur_hrd_new( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get default parameters */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* default parameters (pointer to structure) */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_par *par; /* check arguments */ _unur_check_NULL( GENTYPE,distr,NULL ); /* check distribution */ if (distr->type != UNUR_DISTR_CONT) { _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } COOKIE_CHECK(distr,CK_DISTR_CONT,NULL); if (DISTR_IN.hr == NULL) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"HR"); return NULL; } /* allocate structure */ par = _unur_par_new( sizeof(struct unur_hrd_par) ); COOKIE_SET(par,CK_HRD_PAR); /* copy input */ par->distr = distr; /* pointer to distribution object */ /* set default values */ par->method = UNUR_METH_HRD; /* method */ par->variant = 0u; /* default variant */ par->set = 0u; /* inidicate default parameters */ par->urng = unur_get_default_urng(); /* use default urng */ par->urng_aux = NULL; /* no auxilliary URNG required */ par->debug = _unur_default_debugflag; /* set default debugging flags */ /* routine for starting generator */ par->init = _unur_hrd_init; return par; } /* end of unur_hrd_new() */ /*****************************************************************************/ int unur_hrd_set_verify( struct unur_par *par, int verify ) /*----------------------------------------------------------------------*/ /* turn verifying of algorithm while sampling on/off */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* verify ... 0 = no verifying, !0 = verifying */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* no verifying is the default */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, HRD ); /* we use a bit in variant */ par->variant = (verify) ? (par->variant | HRD_VARFLAG_VERIFY) : (par->variant & (~HRD_VARFLAG_VERIFY)); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_hrd_set_verify() */ /*---------------------------------------------------------------------------*/ int unur_hrd_chg_verify( struct unur_gen *gen, int verify ) /*----------------------------------------------------------------------*/ /* turn verifying of algorithm while sampling on/off */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* verify ... 0 = no verifying, !0 = verifying */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* no verifying is the default */ /*----------------------------------------------------------------------*/ { /* check input */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, HRD, UNUR_ERR_GEN_INVALID ); /* we must not change this switch when sampling has been disabled by using a pointer to the error producing routine */ if (SAMPLE == _unur_sample_cont_error) return UNUR_FAILURE; /* we use a bit in variant */ gen->variant = (verify) ? (gen->variant | HRD_VARFLAG_VERIFY) : (gen->variant & (~HRD_VARFLAG_VERIFY)); /* sampling routine */ SAMPLE = _unur_hrd_getSAMPLE(gen); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_hrd_chg_verify() */ /*****************************************************************************/ /** Private **/ /*****************************************************************************/ struct unur_gen * _unur_hrd_init( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* initialize new generator */ /* */ /* parameters: */ /* params pointer to paramters for building generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ _unur_check_NULL( GENTYPE,par,NULL ); /* check input */ if ( par->method != UNUR_METH_HRD ) { _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); return NULL; } COOKIE_CHECK(par,CK_HRD_PAR,NULL); /* create a new empty generator object */ gen = _unur_hrd_create(par); _unur_par_free(par); if (!gen) return NULL; /* check parameters */ if (_unur_hrd_check_par(gen) != UNUR_SUCCESS) { _unur_hrd_free(gen); return NULL; } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_hrd_debug_init(gen); #endif return gen; } /* end of _unur_hrd_init() */ /*---------------------------------------------------------------------------*/ int _unur_hrd_reinit( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* re-initialize (existing) generator. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int rcode; /* check parameters */ if ( (rcode = _unur_hrd_check_par(gen)) != UNUR_SUCCESS) return rcode; /* (re)set sampling routine */ SAMPLE = _unur_hrd_getSAMPLE(gen); /* nothing to do */ return UNUR_SUCCESS; } /* end of _unur_hrd_reinit() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_hrd_create( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* allocate memory for generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* pointer to (empty) generator object with default settings */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_HRD_PAR,NULL); /* create new generic generator object */ gen = _unur_generic_create( par, sizeof(struct unur_hrd_gen) ); /* magic cookies */ COOKIE_SET(gen,CK_HRD_GEN); /* set generator identifier */ gen->genid = _unur_set_genid(GENTYPE); /* routines for sampling and destroying generator */ SAMPLE = _unur_hrd_getSAMPLE(gen); gen->destroy = _unur_hrd_free; gen->clone = _unur_hrd_clone; gen->reinit = _unur_hrd_reinit; /* default values */ /* initialize variables */ GEN->left_border = 0.; /* left border of domain */ #ifdef UNUR_ENABLE_INFO /* set function for creating info string */ gen->info = _unur_hrd_info; #endif /* return pointer to (almost empty) generator object */ return gen; } /* end of _unur_hrd_create() */ /*---------------------------------------------------------------------------*/ int _unur_hrd_check_par( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* check parameters of given distribution and method */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* set left border and check domain */ if (DISTR.domain[0] < 0.) DISTR.domain[0] = 0.; if (DISTR.domain[1] < UNUR_INFINITY) DISTR.domain[1] = UNUR_INFINITY; GEN->left_border = DISTR.domain[0]; /* compute upper bound for hazard rate (at left border) */ GEN->upper_bound = HR(GEN->left_border); if (GEN->upper_bound <= 0. || _unur_FP_is_infinity(GEN->upper_bound)) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"no valid upper bound for HR at left boundary"); return UNUR_ERR_GEN_CONDITION; } return UNUR_SUCCESS; } /* end of _unur_hrd_check_par() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_hrd_clone( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* copy (clone) generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to clone of generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { #define CLONE ((struct unur_hrd_gen*)clone->datap) struct unur_gen *clone; /* check arguments */ CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_HRD_GEN,NULL); /* create generic clone */ clone = _unur_generic_clone( gen, GENTYPE ); return clone; #undef CLONE } /* end of _unur_hrd_clone() */ /*---------------------------------------------------------------------------*/ void _unur_hrd_free( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* deallocate generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { /* check arguments */ if( !gen ) /* nothing to do */ return; /* check input */ if ( gen->method != UNUR_METH_HRD ) { _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); return; } COOKIE_CHECK(gen,CK_HRD_GEN,RETURN_VOID); /* we cannot use this generator object any more */ SAMPLE = NULL; /* make sure to show up a programming error */ /* free memory */ _unur_generic_free(gen); } /* end of _unur_hrd_free() */ /*****************************************************************************/ double _unur_hrd_sample( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { double U,V,E,X,hrx; double lambda; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_HRD_GEN,UNUR_INFINITY); /* parameter for majorizing hazard rate */ lambda = GEN->upper_bound; /* starting point */ X = GEN->left_border; for(;;) { /* sample from U(0,1) */ while ( _unur_iszero(U = 1.-_unur_call_urng(gen->urng)) ); /* sample from exponential distribution with scale parameter lambda */ E = -log(U) / lambda; /* Remark: by this construction E is monotically increasing with the uniform random number generated by the _unur_call_urng() call */ /* next step */ X += E; /* hazard rate at generated point */ hrx = HR(X); /* reject or accept */ V = lambda * _unur_call_urng(gen->urng); if( V <= hrx ) return X; /* accept */ /* else: reject */ /* update majorizing hazard rate */ if (hrx > 0.) lambda = hrx; else { /* the given function is not a hazard rate */ _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"HR not valid"); return UNUR_INFINITY; } } } /* end of _unur_hrd_sample() */ /*---------------------------------------------------------------------------*/ double _unur_hrd_sample_check( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator (verify mode) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { double U,V,E,X,hrx; double lambda; int i; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_HRD_GEN,UNUR_INFINITY); /* parameter for majorizing hazard rate */ lambda = GEN->upper_bound; /* starting point */ X = GEN->left_border; for(i=1;;i++) { /* sample from U(0,1) */ while ( _unur_iszero(U = 1.-_unur_call_urng(gen->urng)) ); /* sample from exponential distribution with scale parameter lambda */ E = -log(U) / lambda; /* Remark: by this construction E is monotically increasing with the uniform random number generated by the _unur_call_urng() call */ /* next step */ X += E; /* hazard rate at generated point */ hrx = HR(X); /* verify upper bound */ if ( (1.+UNUR_EPSILON) * lambda < hrx ) _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"HR not decreasing"); /* reject or accept */ V = lambda * _unur_call_urng(gen->urng); if( V <= hrx ) { #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug & HRD_DEBUG_SAMPLE) _unur_hrd_debug_sample( gen, X, i ); #endif return X; } /* else: reject */ /* update majorizing hazard rate */ if (hrx > 0.) lambda = hrx; else { /* the given function is not a hazard rate */ _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"HR not valid"); return UNUR_INFINITY; } } } /* end of _unur_hrd_sample_check() */ /*****************************************************************************/ /** Auxilliary Routines **/ /*****************************************************************************/ /*****************************************************************************/ /** Debugging utilities **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ void _unur_hrd_debug_init( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write info about generator into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_HRD_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: type = continuous univariate random variates\n",gen->genid); fprintf(LOG,"%s: method = HRD (Hazard Rate Decreasing)\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); _unur_distr_cont_debug( gen->distr, gen->genid ); fprintf(LOG,"%s: sampling routine = _unur_hrd_sample",gen->genid); if (gen->variant & HRD_VARFLAG_VERIFY) fprintf(LOG,"_check()\n"); else fprintf(LOG,"()\n"); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); fflush(LOG); } /* end of _unur_hrd_debug_init() */ /*---------------------------------------------------------------------------*/ void _unur_hrd_debug_sample( const struct unur_gen *gen, double x, int i ) /*----------------------------------------------------------------------*/ /* write info about generated point into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* x ... generated point */ /* i ... number of iterations */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_HRD_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s: X = %g\t #iterations = %d\n",gen->genid,x,i); } /* end of _unur_hrd_debug_init() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_INFO /*---------------------------------------------------------------------------*/ void _unur_hrd_info( struct unur_gen *gen, int help ) /*----------------------------------------------------------------------*/ /* create character string that contains information about the */ /* given generator object. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* help ... whether to print additional comments */ /*----------------------------------------------------------------------*/ { struct unur_string *info = gen->infostr; int samplesize = 10000; /* generator ID */ _unur_string_append(info,"generator ID: %s\n\n", gen->genid); /* distribution */ _unur_string_append(info,"distribution:\n"); _unur_distr_info_typename(gen); _unur_string_append(info," functions = HR\n"); _unur_string_append(info," domain = (%g, %g)\n", DISTR.domain[0],DISTR.domain[1]); _unur_string_append(info,"\n"); /* method */ _unur_string_append(info,"method: HRD (Hazard Rate Decreasing)\n"); _unur_string_append(info,"\n"); /* performance */ _unur_string_append(info,"performance characteristics:\n"); _unur_string_append(info," E[#iterations] = %.2f [approx.]\n", unur_test_count_urn(gen,samplesize,0,NULL)/((double)samplesize)); _unur_string_append(info,"\n"); /* parameters */ if (help) { _unur_string_append(info,"parameters:\n"); if (gen->variant & HRD_VARFLAG_VERIFY) _unur_string_append(info," verify = on\n"); _unur_string_append(info,"\n"); } /* Hints */ /* if (help) { */ /* _unur_string_append(info,"\n"); */ /* } */ } /* end of _unur_hrd_info() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_INFO */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/tdr_ps_debug.ch0000644001357500135600000003626614420445767015276 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: tdr_ps_debug.c * * * * TYPE: continuous univariate random variate * * METHOD: transformed density rejection * * * * DESCRIPTION: * * Debugging routines for variant with proportional squeezes. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ void _unur_tdr_ps_debug_intervals( const struct unur_gen *gen, int print_areas ) /*----------------------------------------------------------------------*/ /* write list of intervals into LOG file(proportional squeezes) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* print_areas ... whether table of areas should be printed */ /*----------------------------------------------------------------------*/ { FILE *LOG; struct unur_tdr_interval *iv; double sAsqueeze, sAhatl, sAhatr, Atotal; int i; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_TDR_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s:Intervals: %d\n",gen->genid,GEN->n_ivs); if (GEN->iv) { if (gen->debug & TDR_DEBUG_IV) { fprintf(LOG,"%s: Nr. left ip tp f(tp) T(f(tp)) d(T(f(tp))) f(ip) squ. ratio\n",gen->genid); for (iv=GEN->iv,i=0; iv->next; iv=iv->next, i++) { COOKIE_CHECK(iv,CK_TDR_IV,RETURN_VOID); fprintf(LOG,"%s:[%3d]:%#12.6g %#12.6g %#12.6g %#12.6g %#12.6g %#12.6g %#12.6g\n", gen->genid, i, iv->ip, iv->x, iv->fx, iv->Tfx, iv->dTfx, iv->fip, iv->sq); } COOKIE_CHECK(iv,CK_TDR_IV,RETURN_VOID); fprintf(LOG,"%s:[...]:%#12.6g\t\t\t\t\t\t %#12.6g\n", gen->genid, iv->ip, iv->fip); } fprintf(LOG,"%s:\n",gen->genid); } else fprintf(LOG,"%s: No intervals !\n",gen->genid); if (!print_areas || GEN->Atotal <= 0.) return; /* print and sum areas below squeeze and hat */ Atotal = GEN->Atotal; if (gen->debug & TDR_DEBUG_IV) { fprintf(LOG,"%s:Areas in intervals:\n",gen->genid); fprintf(LOG,"%s: Nr.\tbelow squeeze\t\t below hat (left and right)\t\t cumulated\n",gen->genid); sAsqueeze = sAhatl = sAhatr = 0.; if (GEN->iv) { for (iv=GEN->iv,i=0; iv->next; iv=iv->next, i++) { COOKIE_CHECK(iv,CK_TDR_IV,RETURN_VOID); sAsqueeze += iv->Asqueeze; sAhatl += iv->Ahat - iv->Ahatr; sAhatr += iv->Ahatr; fprintf(LOG,"%s:[%3d]: %-12.6g(%6.3f%%) | %-12.6g+ %-12.6g(%6.3f%%) | %-12.6g(%6.3f%%)\n", gen->genid,i, iv->Asqueeze, iv->Asqueeze * 100. / Atotal, iv->Ahat-iv->Ahatr, iv->Ahatr, iv->Ahat * 100. / Atotal, iv->Acum, iv->Acum * 100. / Atotal); } fprintf(LOG,"%s: ---------- --------- | ------------------------ --------- +\n",gen->genid); fprintf(LOG,"%s: Sum : %-12.6g(%6.3f%%) %-12.6g (%6.3f%%)\n",gen->genid, sAsqueeze, sAsqueeze * 100. / Atotal, sAhatl+sAhatr, (sAhatl+sAhatr) * 100. / Atotal); fprintf(LOG,"%s:\n",gen->genid); } } /* summary of areas */ fprintf(LOG,"%s: A(squeeze) = %-12.6g (%6.3f%%)\n",gen->genid, GEN->Asqueeze, GEN->Asqueeze * 100./Atotal); fprintf(LOG,"%s: A(hat\\squeeze) = %-12.6g (%6.3f%%)\n",gen->genid, Atotal - GEN->Asqueeze, (Atotal - GEN->Asqueeze) * 100./Atotal); fprintf(LOG,"%s: A(total) = %-12.6g\n",gen->genid, Atotal); fprintf(LOG,"%s:\n",gen->genid); } /* end of _unur_tdr_ps_debug_intervals() */ /*---------------------------------------------------------------------------*/ void _unur_tdr_ps_debug_sample( const struct unur_gen *gen, const struct unur_tdr_interval *iv, double x, double fx, double hx, double sqx ) /*----------------------------------------------------------------------*/ /* write info about generated point */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* iv ... pointer to interval */ /* x ... generated point */ /* fx ... value of PDF at x */ /* hx ... value of hat at x */ /* sqx ... value of squeeze at x */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_TDR_GEN,RETURN_VOID); CHECK_NULL(iv,RETURN_VOID); COOKIE_CHECK(iv,CK_TDR_IV,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: construction point: x0 = %g\n",gen->genid,iv->x); fprintf(LOG,"%s: transformed hat Th(x) = %g + %g * (x - %g)\n",gen->genid,iv->Tfx,iv->dTfx,iv->x); fprintf(LOG,"%s: squeeze ratio = %g\n",gen->genid,iv->sq); fprintf(LOG,"%s: generated point: x = %g\n",gen->genid,x); fprintf(LOG,"%s: h(x) = %.20g\n",gen->genid,hx); fprintf(LOG,"%s: f(x) = %.20g\n",gen->genid,fx); fprintf(LOG,"%s: s(x) = %.20g\n",gen->genid,sqx); fprintf(LOG,"%s: h(x) - f(x) = %g",gen->genid,hx-fx); if (hxgenid,fx-sqx); if (fxgenid); fflush(LOG); } /* end of _unur_tdr_ps_debug_sample() */ /*---------------------------------------------------------------------------*/ void _unur_tdr_ps_debug_split_start( const struct unur_gen *gen, const struct unur_tdr_interval *iv_left, const struct unur_tdr_interval *iv_right, double x, double fx ) /*----------------------------------------------------------------------*/ /* write info about new splitted intervals */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* iv_left ... pointer to new left hand interval */ /* iv_right ... pointer to new right hand interval */ /* x ... split at this point */ /* fx ... value of PDF at x */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_TDR_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s: split interval at x = %g \t\tf(x) = %g\n",gen->genid,x,fx); fprintf(LOG,"%s: old intervals:\n",gen->genid); if (iv_left) { fprintf(LOG,"%s: left boundary point = %-12.6g\tf(x) = %-12.6g\n",gen->genid,iv_left->ip,iv_left->fip); fprintf(LOG,"%s: left construction point = %-12.6g\tf(x) = %-12.6g\n",gen->genid,iv_left->x,iv_left->fx); } fprintf(LOG,"%s: middle boundary point = %-12.6g\tf(x) = %-12.6g\n",gen->genid,iv_right->ip,iv_right->fip); if (iv_right->next) { fprintf(LOG,"%s: right construction point = %-12.6g\tf(x) = %-12.6g\n",gen->genid,iv_right->x,iv_right->fx); fprintf(LOG,"%s: right boundary point = %-12.6g\tf(x) = %-12.6g\n",gen->genid, iv_right->next->ip,iv_right->next->fip); } fprintf(LOG,"%s: A(squeeze) =\n",gen->genid); if (iv_left) fprintf(LOG,"%s:\t%-12.6g\t(%6.3f%%)\n",gen->genid, iv_left->Asqueeze,iv_left->Asqueeze*100./GEN->Atotal); if (iv_right->next) fprintf(LOG,"%s:\t%-12.6g\t(%6.3f%%)\n",gen->genid, iv_right->Asqueeze,iv_right->Asqueeze*100./GEN->Atotal); fprintf(LOG,"%s: A(hat\\squeeze) =\n",gen->genid); if (iv_left) fprintf(LOG,"%s:\t%-12.6g\t(%6.3f%%)\n",gen->genid, (iv_left->Ahat - iv_left->Asqueeze),(iv_left->Ahat - iv_left->Asqueeze)*100./GEN->Atotal); if (iv_right->next) fprintf(LOG,"%s:\t%-12.6g\t(%6.3f%%)\n",gen->genid, (iv_right->Ahat - iv_right->Asqueeze),(iv_right->Ahat - iv_right->Asqueeze)*100./GEN->Atotal); fprintf(LOG,"%s: A(hat) =\n",gen->genid); if (iv_left) fprintf(LOG,"%s:\t%-12.6g\t(%6.3f%%)\n",gen->genid, iv_left->Ahat, iv_left->Ahat*100./GEN->Atotal); if (iv_right->next) fprintf(LOG,"%s:\t%-12.6g\t(%6.3f%%)\n",gen->genid, iv_right->Ahat, iv_right->Ahat*100./GEN->Atotal); fflush(LOG); } /* end of _unur_tdr_ps_debug_split_start() */ /*---------------------------------------------------------------------------*/ void _unur_tdr_ps_debug_split_stop( const struct unur_gen *gen, const struct unur_tdr_interval *iv_left, const struct unur_tdr_interval *iv_middle, const struct unur_tdr_interval *iv_right ) /*----------------------------------------------------------------------*/ /* write info about new splitted intervals */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* iv_left ... pointer to new left hand interval */ /* iv_middle ... pointer to new middle interval */ /* iv_right ... pointer to new right hand interval */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_TDR_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s: new intervals:\n",gen->genid); if (iv_left) { fprintf(LOG,"%s: left boundary point = %-12.6g\tf(x) = %-12.6g\n",gen->genid,iv_left->ip,iv_left->fip); fprintf(LOG,"%s: left construction point = %-12.6g\tf(x) = %-12.6g\n",gen->genid,iv_left->x,iv_left->fx); } if (iv_middle) { fprintf(LOG,"%s: middle boundary point = %-12.6g\tf(x) = %-12.6g\n",gen->genid,iv_middle->ip,iv_middle->fip); fprintf(LOG,"%s: middle construction point= %-12.6g\tf(x) = %-12.6g\n",gen->genid,iv_middle->x,iv_middle->fx); } fprintf(LOG,"%s: middle boundary point = %-12.6g\tf(x) = %-12.6g\n",gen->genid,iv_right->ip,iv_right->fip); if (iv_right->next) { fprintf(LOG,"%s: right construction point = %-12.6g\tf(x) = %-12.6g\n",gen->genid,iv_right->x,iv_right->fx); fprintf(LOG,"%s: right boundary point = %-12.6g\tf(x) = %-12.6g\n",gen->genid, iv_right->next->ip,iv_right->next->fip); } fprintf(LOG,"%s: A(squeeze) =\n",gen->genid); if (iv_left) fprintf(LOG,"%s:\t%-12.6g\t(%6.3f%%)\n",gen->genid, iv_left->Asqueeze,iv_left->Asqueeze*100./GEN->Atotal); if (iv_middle) fprintf(LOG,"%s:\t%-12.6g\t(%6.3f%%)\n",gen->genid, iv_middle->Asqueeze,iv_middle->Asqueeze*100./GEN->Atotal); if (iv_right->next) fprintf(LOG,"%s:\t%-12.6g\t(%6.3f%%)\n",gen->genid, iv_right->Asqueeze,iv_right->Asqueeze*100./GEN->Atotal); fprintf(LOG,"%s: A(hat\\squeeze) =\n",gen->genid); if (iv_left) fprintf(LOG,"%s:\t%-12.6g\t(%6.3f%%)\n",gen->genid, (iv_left->Ahat - iv_left->Asqueeze),(iv_left->Ahat - iv_left->Asqueeze)*100./GEN->Atotal); if (iv_middle) fprintf(LOG,"%s:\t%-12.6g\t(%6.3f%%)\n",gen->genid, (iv_middle->Ahat - iv_middle->Asqueeze),(iv_middle->Ahat - iv_middle->Asqueeze)*100./GEN->Atotal); if (iv_right->next) fprintf(LOG,"%s:\t%-12.6g\t(%6.3f%%)\n",gen->genid, (iv_right->Ahat - iv_right->Asqueeze),(iv_right->Ahat - iv_right->Asqueeze)*100./GEN->Atotal); fprintf(LOG,"%s: A(hat) =\n",gen->genid); if (iv_left) fprintf(LOG,"%s:\t%-12.6g\t(%6.3f%%)\n",gen->genid, iv_left->Ahat, iv_left->Ahat*100./GEN->Atotal); if (iv_middle) fprintf(LOG,"%s:\t%-12.6g\t(%6.3f%%)\n",gen->genid, iv_middle->Ahat, iv_middle->Ahat*100./GEN->Atotal); if (iv_right->next) fprintf(LOG,"%s:\t%-12.6g\t(%6.3f%%)\n",gen->genid, iv_right->Ahat, iv_right->Ahat*100./GEN->Atotal); fprintf(LOG,"%s: total areas:\n",gen->genid); fprintf(LOG,"%s: A(squeeze) = %-12.6g (%6.3f%%)\n",gen->genid, GEN->Asqueeze, GEN->Asqueeze * 100./GEN->Atotal); fprintf(LOG,"%s: A(hat\\squeeze) = %-12.6g (%6.3f%%)\n",gen->genid, GEN->Atotal - GEN->Asqueeze, (GEN->Atotal - GEN->Asqueeze) * 100./GEN->Atotal); fprintf(LOG,"%s: A(total) = %-12.6g\n",gen->genid, GEN->Atotal); fprintf(LOG,"%s:\n",gen->genid); fflush(LOG); } /* end of _unur_tdr_ps_debug_split_stop() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/unur_methods_source.h0000644001357500135600000001036714420445767016560 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: unur_methods_source.h * * * * PURPOSE: * * defines macros for checking method in generator objects. * * the bitmasks are defined in file unur_methods.h. * * * ***************************************************************************** * * * Copyright (c) 2000-2011 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifndef UNUR_METHODS_SOURCE_H_SEEN #define UNUR_METHODS_SOURCE_H_SEEN /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Bitmask to indicate methods **/ /*****************************************************************************/ #include /*****************************************************************************/ /** Macros **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ /* check if parameter object is of correct type, return 0 otherwise */ #define _unur_check_par_object( par,type ) \ if ( (par)->method != UNUR_METH_##type ) { \ _unur_error(#type,UNUR_ERR_PAR_INVALID,""); \ return (UNUR_ERR_PAR_INVALID); } \ COOKIE_CHECK((par),CK_##type##_PAR,UNUR_ERR_COOKIE) /*---------------------------------------------------------------------------*/ /* check if generator object is of correct type, return 0 otherwise */ #define _unur_check_gen_object( gen,type,rval ) \ if ( (gen)->method != UNUR_METH_##type ) { \ _unur_error((gen)->genid,UNUR_ERR_GEN_INVALID,""); \ return rval; } \ COOKIE_CHECK((gen),CK_##type##_GEN,UNUR_ERR_COOKIE) /*---------------------------------------------------------------------------*/ #endif /* UNUR_METHODS_SOURCE_H_SEEN */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/mvtdr_struct.h0000644001357500135600000002045114420445767015217 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: mvtdr_struct.h * * * * PURPOSE: * * declares structures for method MVTDR * * (Multi-Variate Transformed Density Rejection) * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Information for constructing the generator */ struct unur_mvtdr_par { int max_cones; /* maximum number of cones (at least 2^(N+T_STEPS_MIN) */ int steps_min; /* minimum number of triangulation steps */ double bound_splitting; /* bound for splitting cones */ /* #if MODE == 1 */ /* double mode_to_boundary; /\* move mode to boundary if |mode - boundary| / length < MODE_TO_BOUNDARY *\/ */ /* #endif */ }; /*---------------------------------------------------------------------------*/ typedef struct s_vertex /* -- data for one vertex ---------------- */ { struct s_vertex *next; /* pointer to next vertex in list */ int index; /* index of vertex */ double *coord; /* coordinates of spanning vector(norm = 1), "vertex" */ double norm; /* norm of vertex */ } VERTEX; typedef struct s_cone /* -- a cone ----------------------------- */ { struct s_cone *next; /* pointer to next cone in list */ int level; /* level of triangulation */ VERTEX **v; /* list of vertices of the cone */ double *center; /* barycenter of cone */ double logdetf; /* log determinant -log((dim-1)!) for cone */ double alpha; /* parameter alpha for hat function */ double beta; /* parameter alpha for hat function */ double *gv; /* for all vertices v */ double logai; /* (log of) coefficient for marginal density */ double tp; /* coordinate of touching point */ double Hi; /* volume under hat in cone */ double Hsum; /* accumulated sum of volumes */ double Tfp; /* value of transformed density at touching point */ double height; /* height of pyramid */ } CONE; typedef struct s_edge_table /* -- hash table for edges --------------- */ { int index[2]; /* index of incident vertices */ VERTEX *vertex; /* index of corresponding vertex (=barycenter) */ struct s_edge_table *next; /* next entry in list */ } E_TABLE; typedef struct s_tp_arg /* -- argument for tp function ----------- */ { double t; /* touching point */ double logH; /* log of volume below hat */ CONE *c; /* parameters */ UNUR_GEN *gen; /* pointer to MVTDR generator object */ int status; /* status of cone parameters */ } TP_ARG; enum { /* -- possible status of cone paramters -- */ MVTDR_CONE_OK = 0x000, /* cone is ready to use */ MVTDR_CONE_DOMAIN = 0x001, /* touching point out of support of PDF */ MVTDR_CONE_INVALID = 0x002 /* parameters invalid (Hi not finite?) */ }; /*---------------------------------------------------------------------------*/ /* The generator object */ struct unur_mvtdr_gen { int dim; /* dimension of distribution */ int has_domain; /* whether the domain of distribution has given domain */ double max_gamma; /* upper bound for gamma variaties */ const double *center; /* center of distribution */ CONE *cone; /* root of list of cones */ CONE *last_cone; /* pointer to last cone in list */ int n_cone; /* number of cones */ int max_cones; /* maximum number of cones */ double bound_splitting; /* bound for splitting cones */ VERTEX *vertex; /* root of list of vertices */ VERTEX *last_vertex; /* pointer to last vertex in list */ int n_vertex; /* number of vertices */ E_TABLE **etable; /* pointer to edge table */ int etable_size; /* size of edge table */ CONE **guide; /* pointer to guide table */ int guide_size; /* size of guide table */ double *S; /* working array for storing point on simples */ double *g; /* working array for vector g (direction of sweeping plane) */ double *tp_coord; /* working array for storing coordinates of touching point of hat */ double *tp_mcoord; /* working array for storing coordinates of touching point of hat moved into center */ double *tp_Tgrad; /* working array for storing gradient of transformed density at tp */ double Htot; /* total volume below hat */ int steps_min; /* minimum number of triangulation steps */ int n_steps; /* (highest) number of triangulation steps */ double pdfcenter; /* PDF at center */ }; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/vempk.c0000644001357500135600000012260714420445767013602 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: vempk.c * * * * TYPE: continuous multivariate random variate * * METHOD: generate from kernel estimation * * * * DESCRIPTION: * * Given observed sample. * * Produce a vector x consistent with this sample * * * * REQUIRED: * * pointer to sample * * * * OPTIONAL: * * smoothing factor * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * ***************************************************************************** * * * REFERENCES: * * * * [1] Devroye, L. and Gyorfi, L. (1985): Nonparametric Density * * Estimation: The $L_1$ View. New-York: John Wiley. * * * * [2] Devroye, L. (1986): Non-Uniform Random Variate Generation. (p. 765) * * New York: Springer-Verlag. * * * * [3] Hoermann, W. and Leydold, J. (2000): Automatic random variate * * generation for simulation input. Proceedings of the 2000 Winter * * Simulation Conference. (??? eds.) * * * * [4] Silverman, B. (1986): Density Estimation for Statistics and * * Data Analysis. London: Chapman and Hall. * * * ***************************************************************************** * * * The method here is based on the fact that it is very easy to generate * * random variates that have as density the kernel density estimate of a * * given sample: It is enough to randomly select a point from the given * * sample and return it together with some additive noise (see [1], [2] * * [3] and [4]). Note that it is not necessary to compute the density * * estimate itself! In fact it is much easier to generate variates from * * the density estimate than to compute the estimate itself! * * * * For kernel density estimation we have to choose the kernel function * * (this is for us the density of the noise) and the smoothing parameter * * (i.e. the scale parameter of the kernel variate.) There is a lot * * of theory discussing the optimal smoothing parameter for density * * estimation. As we are mainly interested in a simple formula we * * use the formula explained in [4] p.46-47 that is minimizing the * * asymptotically MISE (mean integrated squared error) for a given * * kernel. We have the danger of oversmoothing the data if they are * * non-normal. Especially for multimodal distributions we get a better * * bandwidth if we replace the sample's stdev s in the formula by the * * minimum of s and the interquartilsrange R divided through 1.34. * * * * bwidth_opt = ???????????????????? * * * * Currently only Gaussian kernels with the same covariance matrix as the * * given sample are implemented. * * * *...........................................................................* * * * Algorithm VEMPK: * * * * [Input] * * Sample X(i) for i=1,2,..,n * * * * [Generate] * * 1: Generate a random variate I uniformly distributed on {1, 2,...,n} * * 2: Generate a random variate W from the distribution with density K(t) * * 3: Return X(I) + bwidth * W * * * *...........................................................................* * * * The mean of the empirical distribution is equal to the sample mean. * * One disadvantage of this method lies in the fact that the variance of * * the empirical distribution generated by the kernel method is always * * higher than the sample standard-deviation s. As pointed out in [4] * * it is not difficult to correct this error. For the variance * * corrected version we have to compute the mean mux and the * * covariance matrix of the sample and we have to know the covariance * * matrix of the kernel V(K). Then we can replace step (3) of the * * algorithm above by: * * * * 3': Return ?????????????? * * * * We can turn on or off variance correction with the function * * * * unur_vempk_set_varcor(); * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include "unur_methods_source.h" #include "x_gen.h" #include "x_gen_source.h" #include "mvstd.h" #include "vempk.h" #include "vempk_struct.h" /*---------------------------------------------------------------------------*/ /* Variants: */ #define VEMPK_VARFLAG_VARCOR 0x001u /* use variance correction */ /*---------------------------------------------------------------------------*/ /* Debugging flags */ /* bit 01 ... pameters and structure of generator (do not use here) */ /* bits 02-12 ... setup */ /* bits 13-24 ... adaptive steps */ /* bits 25-32 ... trace sampling */ #define VEMPK_DEBUG_PRINTDATA 0x00000100u /*---------------------------------------------------------------------------*/ /* Flags for logging set calls */ #define VEMPK_SET_SMOOTHING 0x008u /* smoothing factor */ /*---------------------------------------------------------------------------*/ #define GENTYPE "VEMPK" /* type of generator */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_vempk_init( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* Initialize new generator. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_vempk_create( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* create new (almost empty) generator object. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_vempk_clone( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* copy (clone) generator object. */ /*---------------------------------------------------------------------------*/ static void _unur_vempk_free( struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* destroy generator object. */ /*---------------------------------------------------------------------------*/ static int _unur_vempk_sample_cvec( struct unur_gen *gen, double *result ); /*---------------------------------------------------------------------------*/ /* sample from generator */ /*---------------------------------------------------------------------------*/ static int compute_mean_covar( double *data, int n_data, int dim, double *xbar, double *S ); /*---------------------------------------------------------------------------*/ /* compute mean vector xbar and covariance matrix S of data. */ /*---------------------------------------------------------------------------*/ /* inline static double _unur_empk_comp_iqrtrange( double *data, int n_data ); */ /*---------------------------------------------------------------------------*/ /* compute interquartile range. */ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ /* the following functions print debugging information on output stream, */ /* i.e., into the LOG file if not specified otherwise. */ /*---------------------------------------------------------------------------*/ static void _unur_vempk_debug_init( const struct unur_par *par, const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print after generator has been initialized has completed. */ /*---------------------------------------------------------------------------*/ #endif #ifdef UNUR_ENABLE_INFO static void _unur_vempk_info( struct unur_gen *gen, int help ); /*---------------------------------------------------------------------------*/ /* create info string. */ /*---------------------------------------------------------------------------*/ #endif /*---------------------------------------------------------------------------*/ /* abbreviations */ #define DISTR_IN distr->data.cvemp /* data for distribution object */ #define PAR ((struct unur_vempk_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_vempk_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.cvemp /* data for distribution in generator object */ #define SAMPLE gen->sample.cvec /* pointer to sampling routine */ /*---------------------------------------------------------------------------*/ #define _unur_vempk_getSAMPLE(gen) ( _unur_vempk_sample_cvec ) /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Public: User Interface (API) **/ /*****************************************************************************/ struct unur_par * unur_vempk_new( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get default parameters */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* default parameters (pointer to structure) */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_par *par; /* check arguments */ _unur_check_NULL( GENTYPE,distr,NULL ); /* check distribution */ if (distr->type != UNUR_DISTR_CVEMP) { _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } COOKIE_CHECK(distr,CK_DISTR_CVEMP,NULL); if (DISTR_IN.sample == NULL) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"observed sample"); return NULL; } if (DISTR_IN.n_sample < 2) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"size of observed sample"); return NULL; } /* allocate structure */ par = _unur_par_new( sizeof(struct unur_vempk_par) ); COOKIE_SET(par,CK_VEMPK_PAR); /* copy input */ par->distr = distr; /* pointer to distribution object */ /* set default values */ PAR->smoothing = 1.; /* determines how "smooth" the estimated density will be */ par->method = UNUR_METH_VEMPK; /* method */ par->variant = 0u; /* default variant */ par->set = 0u; /* inidicate default parameters */ par->urng = unur_get_default_urng(); /* use default urng */ par->urng_aux = NULL; /* no auxilliary URNG required */ par->debug = _unur_default_debugflag; /* set default debugging flags */ /* routine for starting generator */ par->init = _unur_vempk_init; return par; } /* end of unur_vempk_new() */ /*****************************************************************************/ int unur_vempk_set_smoothing( struct unur_par *par, double smoothing ) /*----------------------------------------------------------------------*/ /* set smoothing factor */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* smoothing ... smoothing factor */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, VEMPK ); /* check new parameter for generator */ if (smoothing < 0.) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"smoothing factor < 0"); return UNUR_ERR_PAR_SET; } /* store date */ PAR->smoothing = smoothing; /* changelog */ par->set |= VEMPK_SET_SMOOTHING; return UNUR_SUCCESS; } /* end of unur_vempk_set_smoothing() */ /*---------------------------------------------------------------------------*/ int unur_vempk_chg_smoothing( struct unur_gen *gen, double smoothing ) /*----------------------------------------------------------------------*/ /* change smoothing factor */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* smoothing ... smoothing factor */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, VEMPK, UNUR_ERR_GEN_INVALID ); /* no changelog required */ /* check new parameter for generator */ if (smoothing < 0.) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"smoothing factor < 0"); return UNUR_ERR_PAR_SET; } /* store smoothing factor */ GEN->smoothing = smoothing; /* recompute band width */ GEN->hact = GEN->hopt * GEN->smoothing; /* recompute constant for variance corrected version */ GEN->corfac = 1./sqrt( 1. + GEN->hact * GEN->hact); /* changelog */ gen->set |= VEMPK_SET_SMOOTHING; return UNUR_SUCCESS; } /* end of unur_vempk_chg_smoothing() */ /*---------------------------------------------------------------------------*/ int unur_vempk_set_varcor( struct unur_par *par, int varcor ) /*----------------------------------------------------------------------*/ /* turn variance correction on/off */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* varcor ... 0 = no variance correction, !0 = variance correction */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* variance correction is the default */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, VEMPK ); /* we use a bit in variant */ par->variant = (varcor) ? (par->variant | VEMPK_VARFLAG_VARCOR) : (par->variant & (~VEMPK_VARFLAG_VARCOR)); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_vempk_set_varcor() */ /*---------------------------------------------------------------------------*/ int unur_vempk_chg_varcor( struct unur_gen *gen, int varcor ) /*----------------------------------------------------------------------*/ /* turn variance correction on/off */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* varcor ... 0 = no variance correction, !0 = variance correction */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, VEMPK, UNUR_ERR_GEN_INVALID ); /* no changelog required */ /* we use a bit in variant */ gen->variant = (varcor) ? (gen->variant | VEMPK_VARFLAG_VARCOR) : (gen->variant & (~VEMPK_VARFLAG_VARCOR)); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_vempk_chg_varcor() */ /*****************************************************************************/ /** Private **/ /*****************************************************************************/ struct unur_gen * _unur_vempk_init( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* initialize new generator */ /* */ /* parameters: */ /* par ... pointer to paramters for building generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; double *S; /* covariance matrix of sample */ UNUR_DISTR *kernel_distr; /* kernel distribution */ /* check arguments */ CHECK_NULL(par,NULL); /* check input */ if ( par->method != UNUR_METH_VEMPK ) { _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); return NULL; } COOKIE_CHECK(par,CK_VEMPK_PAR,NULL); /* create a new empty generator object */ gen = _unur_vempk_create(par); if (!gen) { _unur_par_free(par); return NULL; } /* compute mean vector and covariance matrix of sample */ GEN->xbar = _unur_xmalloc( GEN->dim * sizeof(double) ); S = _unur_xmalloc( GEN->dim * GEN->dim * sizeof(double) ); compute_mean_covar( DISTR.sample, DISTR.n_sample, GEN->dim, GEN->xbar, S ); /* make a distribution object for multinormal distribution */ kernel_distr = unur_distr_multinormal( GEN->dim, NULL, S ); /* create kernel generator */ GEN->kerngen = unur_init( unur_mvstd_new( kernel_distr ) ); if (GEN->kerngen==NULL) { _unur_error(GENTYPE,UNUR_ERR_SHOULD_NOT_HAPPEN,""); _unur_par_free (par); free (S); _unur_vempk_free(gen); return NULL; } /* set uniform random number generator */ GEN->kerngen->urng = par->urng; /* copy debugging flags */ GEN->kerngen->debug = par->debug; /* the kernel is an auxiliary generator for method VEMPK, of course */ gen->gen_aux = GEN->kerngen; /* compute bandwith: Silverman (1986), p.86, formular 4.14 for normal kernel */ GEN->hopt = (exp((1./(GEN->dim+4.))*log(4./(GEN->dim+2.)))* exp(-1./(GEN->dim+4.) *log((double)GEN->n_observ))); /* hopt is optimal for the multi-normal distribution as it is oversmoothing especially multimodal distributions */ /* compute used band width */ GEN->hact = GEN->hopt * GEN->smoothing; /* compute constant for variance corrected version */ GEN->corfac = 1./sqrt(1. + GEN->hact * GEN->hact); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_vempk_debug_init(par,gen); #endif /* free parameters */ _unur_par_free(par); /* we do not need mu and S any more */ free(S); unur_distr_free(kernel_distr); return gen; } /* end of _unur_vempk_init() */ /*---------------------------------------------------------------------------*/ static struct unur_gen * _unur_vempk_create( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* allocate memory for generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* pointer to (empty) generator object with default settings */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_VEMPK_PAR,NULL); /* create new generic generator object */ gen = _unur_generic_create( par, sizeof(struct unur_vempk_gen) ); /* magic cookies */ COOKIE_SET(gen,CK_VEMPK_GEN); /* dimension of distribution */ GEN->dim = gen->distr->dim; /* copy observed data into generator object */ GEN->observ = DISTR.sample; /* observations in distribution object */ GEN->n_observ = DISTR.n_sample; /* sample size */ /* set generator identifier */ gen->genid = _unur_set_genid(GENTYPE); /* routines for sampling and destroying generator */ SAMPLE = _unur_vempk_getSAMPLE(gen); gen->destroy = _unur_vempk_free; gen->clone = _unur_vempk_clone; /* copy some parameters into generator object */ GEN->smoothing = PAR->smoothing; /* smoothing factor */ /* initialize pointer */ GEN->kerngen = NULL; /* generator for kernel distribution */ GEN->xbar = NULL; /* mean vector of sample */ #ifdef UNUR_ENABLE_INFO /* set function for creating info string */ gen->info = _unur_vempk_info; #endif /* return pointer to (almost empty) generator object */ return gen; } /* end of _unur_vempk_create() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_vempk_clone( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* copy (clone) generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to clone of generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { #define CLONE ((struct unur_vempk_gen*)clone->datap) struct unur_gen *clone; /* check arguments */ CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_VEMPK_GEN,NULL); /* create generic clone */ clone = _unur_generic_clone( gen, GENTYPE ); /* copy additional data for generator object */ CLONE->observ = clone->distr->data.cvemp.sample; /* observations in distribution object */ if (GEN->xbar) { CLONE->xbar = _unur_xmalloc( GEN->dim * sizeof(double) ); memcpy( CLONE->xbar, GEN->xbar, GEN->dim * sizeof(double) ); } /* kernel generator is (also) stored as auxiliary generator */ /* which has already been cloned by generic_clone. */ CLONE->kerngen = clone->gen_aux; return clone; #undef CLONE } /* end of _unur_vempk_clone() */ /*---------------------------------------------------------------------------*/ void _unur_vempk_free( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* deallocate generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { /* check arguments */ if( !gen ) /* nothing to do */ return; /* check input */ if ( gen->method != UNUR_METH_VEMPK ) { _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); return; } COOKIE_CHECK(gen,CK_VEMPK_GEN,RETURN_VOID); /* we cannot use this generator object any more */ SAMPLE = NULL; /* make sure to show up a programming error */ /* free memory */ if (GEN->xbar) free( GEN->xbar ); _unur_generic_free(gen); } /* end of _unur_vempk_free() */ /*****************************************************************************/ int _unur_vempk_sample_cvec( struct unur_gen *gen, double *result ) /*----------------------------------------------------------------------*/ /* sample from generator */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* result ... random vector (result) */ /*----------------------------------------------------------------------*/ { #define idx(a,b) (a*GEN->dim+b) double U; int j,k; /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_VEMPK_GEN,UNUR_ERR_COOKIE); /* select uniformly one of the observations */ U = _unur_call_urng(gen->urng) * GEN->n_observ; j = (int) (U); /* sample from kernel distribution */ unur_sample_vec( GEN->kerngen, result ); if (gen->variant & VEMPK_VARFLAG_VARCOR) /* use variance correction */ for (k=0; kdim; k++) result[k] = GEN->xbar[k] + (GEN->observ[idx(j,k)] - GEN->xbar[k] + result[k]*GEN->hact) * GEN->corfac; else /* no variance correction */ for (k=0; kdim; k++) result[k] = GEN->hact * result[k] + GEN->observ[idx(j,k)]; return UNUR_SUCCESS; #undef idx } /* end of _unur_vempk_sample() */ /*****************************************************************************/ /** Auxilliary Routines **/ /*****************************************************************************/ int compute_mean_covar( double *data, int n_data, int dim, double *xbar, double *S ) /*----------------------------------------------------------------------*/ /* compute mean vector xbar and covariance matrix S of data */ /* */ /* parameters: */ /* data ... pointer to array of data */ /* n_data ... number of data points */ /* xbar ... pointer to store mean vector */ /* S ... pointer to store covariance matrix */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { #define idx(a,b) (a*dim+b) int i,j,k; double *x; /* allocate working array */ x = malloc(dim*sizeof(double)); /* initialization */ for(j=0; j=0; j--) for (k=0; k<=j; k++) { S[idx(j,k)] /= (n_data-1); if (k!=j) S[idx(k,j)] = S[idx(j,k)]; /* covariance matrix must be symmetric */ } /* free working array */ free(x); /* o.k. */ return UNUR_SUCCESS; } /* compute_mean_covar() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Debugging utilities **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ static void _unur_vempk_debug_init( const struct unur_par *par, const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write info about generator into LOG file */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; int i; /* check arguments */ CHECK_NULL(par,RETURN_VOID); COOKIE_CHECK(par,CK_VEMPK_PAR,RETURN_VOID); CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_VEMPK_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: type = continuous univariate random variates\n",gen->genid); fprintf(LOG,"%s: method = VEMPK ((Vector) EMPirical distribution with Kernel smoothing)\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); _unur_distr_cvemp_debug( gen->distr, gen->genid, (gen->debug & VEMPK_DEBUG_PRINTDATA)); fprintf(LOG,"%s:\tmean vector =\n",gen->genid); fprintf(LOG,"%s:\t ( %g",gen->genid,GEN->xbar[0]); for (i=1; idim; i++) fprintf(LOG,", %g",GEN->xbar[i]); fprintf(LOG,")\n%s:\n",gen->genid); fprintf(LOG,"%s:\tcovariance matrix = [see %s]\n",gen->genid, GEN->kerngen->genid); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: sampling routine = _unur_vempk_sample_cvec()\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: smoothing factor = %g",gen->genid, PAR->smoothing); _unur_print_if_default(par,VEMPK_SET_SMOOTHING); fprintf(LOG,"\n"); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: bandwith hopt = %g\n",gen->genid, GEN->hopt); fprintf(LOG,"%s: (used) hact = %g\n",gen->genid, GEN->hact); fprintf(LOG,"%s:\n",gen->genid); if (gen->variant & VEMPK_VARFLAG_VARCOR) { fprintf(LOG,"%s: use variance correction\n",gen->genid); fprintf(LOG,"%s:\tcorrection factor = %g\n",gen->genid, GEN->corfac); } else fprintf(LOG,"%s: no variance correction\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); } /* end of _unur_vempk_debug_init() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_INFO /*---------------------------------------------------------------------------*/ void _unur_vempk_info( struct unur_gen *gen, int help ) /*----------------------------------------------------------------------*/ /* create character string that contains information about the */ /* given generator object. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* help ... whether to print additional comments */ /*----------------------------------------------------------------------*/ { struct unur_string *info = gen->infostr; /* generator ID */ _unur_string_append(info,"generator ID: %s\n\n", gen->genid); /* distribution */ _unur_string_append(info,"distribution:\n"); _unur_distr_info_typename(gen); _unur_string_append(info," dimension = %d\n",GEN->dim); _unur_string_append(info," functions = DATA [length=%d]\n", GEN->n_observ); _unur_string_append(info,"\n"); /* if (help) { */ /* _unur_string_append(info,"\n"); */ /* } */ /* method */ _unur_string_append(info,"method: VEMPK (EMPirical distribution with Kernel smoothing)\n"); _unur_string_append(info," kernel type = multinormal\n"); _unur_string_append(info," smoothing factor = %g\n", GEN->smoothing); _unur_string_append(info," bandwith = %g\n", GEN->hact); if (gen->variant & VEMPK_VARFLAG_VARCOR) _unur_string_append(info," variance correction factor = %g\n", GEN->corfac); else _unur_string_append(info," no variance correction\n"); _unur_string_append(info,"\n"); /* performance */ /* _unur_string_append(info,"performance characteristics:\n"); */ /* _unur_string_append(info,"\n"); */ /* parameters */ if (help) { _unur_string_append(info,"parameters:\n"); _unur_string_append(info," smoothing = %g %s\n", GEN->smoothing, (gen->set & VEMPK_SET_SMOOTHING) ? "" : "[default]"); if (gen->variant & VEMPK_VARFLAG_VARCOR) _unur_string_append(info," varcor = on\n"); _unur_string_append(info,"\n"); } /* Hints */ /* if (help) { */ /* _unur_string_append(info,"\n"); */ /* } */ } /* end of _unur_vempk_info() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_INFO */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/dari.h0000644001357500135600000001667414420445767013412 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: dari.h * * * * PURPOSE: * * function prototypes for method DARI * * (discrete automatic rejection inversion) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /* =METHOD DARI Discrete Automatic Rejection Inversion =UP Methods_for_DISCR =REQUIRED T-concave PMF, mode, approximate area =SPEED Set-up: moderate, Sampling: fast =REINIT supported =REF [HDa96] [HLD04: Sect.10.2, Alg.10.4] =DESCRIPTION DARI is based on rejection inversion, which can be seen as an adaptation of transformed density rejection to discrete distributions. The used transformation is @unurmath{-1/\sqrt{x}}. DARI uses three almost optimal points for constructing the (continuous) hat. Rejection is then done in horizontal direction. Rejection inversion uses only one uniform random variate per trial. DARI has moderate set-up times (the PMF is evaluated nine times), and good marginal speed, especially if an auxiliary array is used to store values during generation. DARI works for all @unurmath{T_{-1/2}}-concave distributions. It requires the PMF and the location of the mode. Moreover the approximate sum over the PMF is used. (If no sum is given for the distribution the algorithm assumes that it is approximately 1.) The rejection constant is bounded from above by 4 for all @i{T}-concave distributions. =HOWTOUSE DARI works for discrete distribution object with given PMF. The sum over probabilities should be approximately one. Otherwise it must be set by a unur_distr_discr_set_pmfsum() call to its (approximate) value. The size of an auxiliary table can be set by unur_dari_set_tablesize(). The expected number of evaluations can be reduced by switching the use of squeezes by means of unur_dari_set_squeeze(). It is possible to change the parameters and the domain of the chosen distribution and run unur_reinit() to reinitialize the generator object. Notice, that derived parameters like the mode must also be (re-) set if the parameters or the domain has be changed. There exists a test mode that verifies whether the conditions for the method are satisfied or not. It can be switched on by calling unur_dari_set_verify() and unur_dari_chg_verify(), respectively. Notice however that sampling is (much) slower then. =END */ /*---------------------------------------------------------------------------*/ /* Routines for user interface */ /* =ROUTINES */ /*---------------------------------------------------------------------------*/ /* Routines for user interface */ UNUR_PAR *unur_dari_new( const UNUR_DISTR *distribution ); /* Get default parameters for generator. */ /*...........................................................................*/ int unur_dari_set_squeeze( UNUR_PAR *parameters, int squeeze ); /* Turn utilization of the squeeze of the algorithm on/off. This squeeze does not resamble the squeeze of the continuous TDR method. It was especially designed for rejection inversion. The squeeze is not necessary if the size of the auxiliary table is big enough (for the given distribution). Using a squeeze is suggested to speed up the algorithm if the domain of the distribution is very big or if only small samples are produced. Default: no squeeze. */ int unur_dari_set_tablesize( UNUR_PAR *parameters, int size ); /* Set the size for the auxiliary table, that stores constants computed during generation. If @var{size} is set to @code{0} no table is used. The speed-up can be impressive if the PMF is expensive to evaluate and the ``main part of the distribution'' is concentrated in an interval shorter than the size of the table. Default is @code{100}. */ int unur_dari_set_cpfactor( UNUR_PAR *parameters, double cp_factor ); /* Set factor for position of the left and right construction point, resp. The @var{cp_factor} is used to find almost optimal construction points for the hat function. The @var{cp_factor} must be positive and should not exceed 2. There is no need to change this factor in almost all situations. Default is @code{0.664}. */ int unur_dari_set_verify( UNUR_PAR *parameters, int verify ); /* */ int unur_dari_chg_verify( UNUR_GEN *generator, int verify ); /* Turn verifying of algorithm while sampling on/off. If the condition is violated for some @i{x} then @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. However notice that this might happen due to round-off errors for a few values of @i{x} (less than 1%). Default is FALSE. */ /* =END */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/mvtdr.h0000644001357500135600000002160214420445767013612 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: mvtdr.h * * * * PURPOSE: * * function prototypes for method MVTDR * * (Multi-Variate Transformed Density Rejection) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /* =METHOD MVTDR Multi-Variate Transformed Density Rejection =UP Methods_for_CVEC =REQUIRED log-concave (log)PDF, gradient of (log)PDF =OPTIONAL mode =SPEED Set-up: slow, Sampling: depends on dimension =REINIT not implemented =REF [HLD04: Sect.11.3.4, Alg.11.15.] [LJa98] =DESCRIPTION MVTDR a multivariate version of the Transformed Density Rection (@pxref{TDR}) that works for log-concave densities. For this method the domain of the distribution is partitioned into cones with the mode (or the center) of the distribution as their (common) vertex. The hat function is then constructed as tangent planes of the transformed density in each of these cones. The respective construction points lie on the central lines in the cones through the vertex. The point is chosen such that the hat is minimal among all such points (see the given references for more details). The cones are created by starting with the orthants of the reals space. These are then iteratively split when the volume below the hat in such cones is too large. Thus an increasing number of cones results in a better fitting hat function. Notice however, that the required number of cones increases exponentially with the number of dimension. Moreover, due to the construction the rejection does not converge to 1 and remains strictly larger than 1. For distributions with bounded domains the cones are cut to pyramids that cover the domain. =HOWTOUSE Create a multivariate generator object that contains the PDF and its gradient. This object also should contain the mode of the distribution (or a point nearby should be provided as center of the distribution). The method has three parameter to adjust the method for the given distribution: @table @code @item stepsmin Minimal number of iterations for splitting cones. Notice that we start with 2^dim initial cones and that we arrive at 2^(dim+stepsmin) cones after these splits. So this number must be set with care. It can be set by a unur_mvtdr_set_stepsmin() call. @item boundsplitting Cones where the volume below the hat is relatively large (i.e. larger than the average volume over all cones times @code{boundsplitting} are further split. This parameter can set via a unur_mvtdr_set_boundsplitting() call. @item maxcones The maximum number of generated cones. When this number is reached, the initialization routine is stopped. Notice that the rejection constant can be still prohibitive large. This parameter can set via a unur_mvtdr_set_maxcones() call. @end table Setting of these parameter can be quite tricky. The default settings lead to hat functions where the volume below the hat is similar in each cone. However, there might be some problems with distributions with higher correlations, since then too few cones are created. Then it might be necessary to increase the values for @code{stepsmin} and @code{maxcones} and to set @code{boundsplitting} to @code{0}. The number of cones and the total volume below the hat can be controlled using the respective calls unur_mvtdr_get_ncones() and unur_mvtdr_get_hatvol(). Notice, that the rejection constant is bounded from below by some figure (larger than 1) that depends on the dimension. Unfortunately, the algorithm cannot detect the quality of the constructed hat. =END */ /*---------------------------------------------------------------------------*/ /* Routines for user interface */ /* =ROUTINES */ UNUR_PAR *unur_mvtdr_new( const UNUR_DISTR *distribution ); /* Get parameters for generator. */ /*...........................................................................*/ int unur_mvtdr_set_stepsmin( UNUR_PAR *parameters, int stepsmin ); /* Set minimum number of triangulation step for each starting cone. @var{stepsmin} must be nonnegative. Default: @code{5}. */ int unur_mvtdr_set_boundsplitting( UNUR_PAR *parameters, double boundsplitting ); /* Set bound for splitting cones. All cones are split which have a volume below the hat that is greater than @var{bound_splitting} times the average over all volumes. However, the number given by the unur_mvtdr_set_maxcones() is not exceeded. Notice that the later number is always reached if @var{bound_splitting} is less than 1. Default: @code{1.5} */ int unur_mvtdr_set_maxcones( UNUR_PAR *parameters, int maxcones ); /* Set maximum number of cones. Notice that this number is always increased to @unurmath{2^{dim+stepsmin}} where @i{dim} is the dimension of the distribution object and @i{stepsmin} the given mimimum number of triangulation steps. Notice: For higher dimensions and/or higher correlations between the coordinates of the random vector the required number of cones can be very high. A too small maximum number of cones can lead to a very high rejection constant. Default: @code{10000}. */ int unur_mvtdr_get_ncones( const UNUR_GEN *generator ); /* Get the number of cones used for the hat function of the @var{generator}. (In case of an error @code{0} is returned.) */ double unur_mvtdr_get_hatvol( const UNUR_GEN *generator ); /* Get the volume below the hat for the @var{generator}. (In case of an error @code{UNUR_INFINITY} is returned.) */ int unur_mvtdr_set_verify( UNUR_PAR *parameters, int verify ); /* */ int unur_mvtdr_chg_verify( UNUR_GEN *generator, int verify ); /* Turn verifying of algorithm while sampling on/off. If the condition squeeze(@i{x}) <= PDF(@i{x}) <= hat(@i{x}) is violated for some @i{x} then @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. However notice that this might happen due to round-off errors for a few values of @i{x} (less than 1%). Default is FALSE. */ /* =END */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/mixt_struct.h0000644001357500135600000000673414420445767015054 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: mixt_struct.h * * * * PURPOSE: * * declares structures for meta method MIXT * * (MIXTure of distributions) * * * ***************************************************************************** * * * Copyright (c) 2010 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Information for constructing the generator */ struct unur_mixt_par { int n_comp; /* number of components */ const double *prob; /* probabilities (weights) for components */ struct unur_gen **comp; /* array of pointers to components */ }; /*---------------------------------------------------------------------------*/ /* The generator object */ struct unur_mixt_gen { int is_inversion; /* whether inversion is used */ /* components are stored in slot 'gen_aux_list' */ /* probabilities are stored in slot 'gen_aux' as generator with method DGT */ }; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/ars.h0000644001357500135600000002545514420445767013255 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: ars.h * * * * PURPOSE: * * function prototypes for method ARS * * (Adaptive Rejection Sampling - Gilks & Wild) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /* =METHOD ARS Adaptive Rejection Sampling =UP Methods_for_CONT =REQUIRED concave logPDF, derivative of logPDF =OPTIONAL mode =SPEED Set-up: fast, Sampling: slow =REINIT supported =REF [GWa92] [HLD04: Cha.4] =DESCRIPTION ARS is an acceptance/rejection method that uses the concavity of the log-density function to construct hat function and squeezes automatically. It is very similar to method TDR (@pxref{TDR}) with variant GW, parameter @code{c = 0}, and DARS switched off. Moreover, method ARS requires the logPDF and its derivative dlogPDF to run. On the other hand, it is designed to draw only a (very) small samples and it is much more robust against densities with very large or small areas below the PDF as it occurs, for example, in conditional distributions of (high dimensional) multivariate distributions. Additionally, it can be re-initialized when the underlying distribution has been modified. Thus it is well suited for Gibbs sampling. Notice, that method ARS is a restricted version of TDR. If the full functionally of Transformed Density Rejection is needed use method @ref{TDR}. =HOWTOUSE Method ARS is designed for distributions with log-concave densities. To use this method you need a distribution object with the logarithm of the PDF and its derivative given. The number of construction points as well as a set of such points can be provided using unur_ars_set_cpoints(). Notice that addition construction points are added by means of adaptive rejection sampling until the maximal number of intervals given by unur_ars_set_max_intervals() is reached. A generated distribution object can be reinitialized using the unur_reinit() call. When unur_reinit() is called construction points for the new generator are necessary. There are two options: Either the same construction points as for the initial generator (given by a unur_ars_set_cpoints() call) are used (this is the default), or percentiles of the old hat function can be used. This can be set or changed using unur_ars_set_reinit_percentiles() and unur_ars_chg_reinit_percentiles(). This feature is usefull when the underlying distribution object is only moderately changed. (An example is Gibbs sampling with small correlations.) There exists a test mode that verifies whether the conditions for the method are satisfied or not. It can be switched on by calling unur_ars_set_verify() and unur_ars_chg_verify(), respectively. Notice however that sampling is (much) slower then. Method ARS aborts after a given number of iterations and return UNUR_INFINITY to prevent (almost) infinite loops. This might happen when the starting hat is much too large and it is not possible to insert new construction points due to severe numerical errors or (more likely) the given PDF is not log-concave. This maximum number of iterations can be set by means of a unur_ars_set_max_iter() call. =END */ /*---------------------------------------------------------------------------*/ /* Routines for user interface */ /* =ROUTINES */ UNUR_PAR *unur_ars_new( const UNUR_DISTR* distribution ); /* Get default parameters for generator. */ /*...........................................................................*/ int unur_ars_set_max_intervals( UNUR_PAR *parameters, int max_ivs ); /* Set maximum number of intervals. No construction points are added after the setup when the number of intervals suceeds @var{max_ivs}. It is increased automatically to twice the number of construction points if this is larger. Default is @code{200}. */ int unur_ars_set_cpoints( UNUR_PAR *parameters, int n_cpoints, const double *cpoints ); /* Set construction points for the hat function. If @var{cpoints} is NULL then a heuristic rule of thumb is used to get @var{n_cpoints} construction points. This is the default behavior. @var{n_cpoints} should be at least @code{2}, otherwise defaults are used. The default number of construction points is 2. */ int unur_ars_set_reinit_percentiles( UNUR_PAR *parameters, int n_percentiles, const double *percentiles ); /* */ int unur_ars_chg_reinit_percentiles( UNUR_GEN *generator, int n_percentiles, const double *percentiles ); /* By default, when the @var{generator} object is reinitialized, it used the same construction points as for the initialization procedure. Often the underlying distribution object has been changed only moderately. For example, the full conditional distribution of a multivariate distribution. In this case it might be more appropriate to use percentilesm of the hat function for the last (unchanged) distribution. @var{percentiles} must then be a pointer to an ordered array of numbers between @code{0.01} and @code{0.99}. If @var{percentiles} is NULL, then a heuristic rule of thumb is used to get @var{n_percentiles} values for these percentiles. Notice that @var{n_percentiles} must be at least @code{2}, otherwise defaults are used. (Then the first and third quartiles are used by default.) */ int unur_ars_set_reinit_ncpoints( UNUR_PAR *parameters, int ncpoints ); /* */ int unur_ars_chg_reinit_ncpoints( UNUR_GEN *generator, int ncpoints ); /* When reinit fails with the given construction points or the percentiles of the old hat function, another trial is undertaken with @var{ncpoints} construction points. @var{ncpoints} must be at least @code{10}. Default: @code{30} */ int unur_ars_set_max_iter( UNUR_PAR *parameters, int max_iter ); /* The rejection loop stops after @var{max_iter} iterations and return UNUR_INFINITY. Default: @code{10000} */ int unur_ars_set_verify( UNUR_PAR *parameters, int verify ); /* */ int unur_ars_chg_verify( UNUR_GEN *generator, int verify ); /* Turn verifying of algorithm while sampling on/off. If the condition squeeze(@i{x}) <= PDF(@i{x}) <= hat(@i{x}) is violated for some @i{x} then @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. However notice that this might happen due to round-off errors for a few values of @i{x} (less than 1%). Default is FALSE. */ int unur_ars_set_pedantic( UNUR_PAR *parameters, int pedantic ); /* Sometimes it might happen that unur_init() has been executed successfully. But when additional construction points are added by adaptive rejection sampling, the algorithm detects that the PDF is not log-concave. With @var{pedantic} being TRUE, the sampling routine is exchanged by a routine that simply returns @code{UNUR_INFINITY}. Otherwise the new point is not added to the list of construction points. At least the hat function remains log-concave. Setting @var{pedantic} to FALSE allows sampling from a distribution which is ``almost'' log-concave and small errors are tolerated. However it might happen that the hat function cannot be improved significantly. When the hat functions that has been constructed by the unur_init() call is extremely large then it might happen that the generation times are extremely high (even hours are possible in extremely rare cases). Default is FALSE. */ double unur_ars_get_loghatarea( const UNUR_GEN *generator ); /* Get the logarithm of area below the hat for the generator. (In case of an error @code{UNUR_INFINITY} is returned.) */ double unur_ars_eval_invcdfhat( const UNUR_GEN *generator, double u ); /* Evaluate the inverse of the CDF of the hat distribution at @var{u}. If @var{u} is out of the domain [0,1] then @code{unur_errno} is set to @code{UNUR_ERR_DOMAIN} and the respective bound of the domain of the distribution are returned (which is @code{-UNUR_INFINITY} or @code{UNUR_INFINITY} in the case of unbounded domains). */ /* =END */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/hinv.h0000644001357500135600000003634214420445767013431 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: hinv.h * * * * PURPOSE: * * function prototypes for method HINV * * (Hermite interpolation based INVersion of CDF) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /* =METHOD HINV Hermite interpolation based INVersion of CDF =UP Methods_for_CONT =REQUIRED CDF =OPTIONAL PDF, dPDF =REF [HLa03] [HLD04: Sect.7.2, Alg.7.1] =SPEED Set-up: (very) slow, Sampling: (very) fast =REINIT supported =DESCRIPTION HINV is a variant of numerical inversion, where the inverse CDF is approximated using Hermite interpolation, i.e., the interval [0,1] is split into several intervals and in each interval the inverse CDF is approximated by polynomials constructed by means of values of the CDF and PDF at interval boundaries. This makes it possible to improve the accuracy by splitting a particular interval without recomputations in unaffected intervals. Three types of splines are implemented: linear, cubic, and quintic interpolation. For linear interpolation only the CDF is required. Cubic interpolation also requires PDF and quintic interpolation PDF and its derivative. These splines have to be computed in a setup step. However, it only works for distributions with bounded domain; for distributions with unbounded domain the tails are chopped off such that the probability for the tail regions is small compared to the given u-resolution. The method is not exact, as it only produces random variates of the approximated distribution. Nevertheless, the maximal numerical error in "u-direction" (i.e. |U-CDF(X)|, for X = "approximate inverse CDF"(U) |U-CDF(X)|) can be set to the required resolution (within machine precision). Notice that very small values of the u-resolution are possible but may increase the cost for the setup step. As the possible maximal error is only estimated in the setup it may be necessary to set some special design points for computing the Hermite interpolation to guarantee that the maximal u-error can not be bigger than desired. Such points are points where the density is not differentiable or has a local extremum. Notice that there is no necessity to do so. However, if you do not provide these points to the algorithm there might be a small chance that the approximation error is larger than the given u-resolution, or that the required number of intervals is larger than necessary. =HOWTOUSE HINV works for continuous univariate distribution objects with given CDF and (optional) PDF. It uses Hermite interpolation of order 1, 3 [default] or 5. The order can be set by means of unur_hinv_set_order(). For distributions with unbounded domains the tails are chopped off such that the probability for the tail regions is small compared to the given u-resulution. For finding these cut points the algorithm starts with the region @code{[-1.e20,1.e20]}. For the exceptional case where this might be too small (or one knows this region and wants to avoid this search heuristics) it can be directly set via a unur_hinv_set_boundary() call. It is possible to use this method for generating from truncated distributions. It even can be changed for an existing generator object by an unur_hinv_chg_truncated() call. This method is not exact, as it only produces random variates of the approximated distribution. Nevertheless, the numerical error in "u-direction" (i.e. |U-CDF(X)|, for X = "approximate inverse CDF"(U) |U-CDF(X)|) can be controlled by means of unur_hinv_set_u_resolution(). The possible maximal error is only estimated in the setup. Thus it might be necessary to set some special design points for computing the Hermite interpolation to guarantee that the maximal u-error can not be bigger than desired. Such points (e.g. extremal points of the PDF, points with infinite derivative) can be set using using the unur_hinv_set_cpoints() call. If the mode for a unimodal distribution is set in the distribution object this mode is automatically used as design-point if the unur_hinv_set_cpoints() call is not used. As already mentioned the maximal error of this approximation is only estimated. If this error is crucial for an application we recommend to compute this error using unur_hinv_estimate_error() which runs a small Monte Carlo simulation. It is possible to change the parameters and the domain of the chosen distribution and run unur_reinit() to reinitialize the generator object. The values given by the last unur_hinv_chg_truncated() call will be then changed to the values of the domain of the underlying distribution object. Moreover, starting construction points (nodes) that are given by a unur_hinv_set_cpoints() call are ignored when unur_reinit() is called. It is important to note that for a distribution from the UNU.RAN library of standard distributions (@pxref{Stddist,,Standard distributions}) the normalization constant has to be updated using the unur_distr_cont_upd_pdfarea() call whenever its parameters have been changed by means of a unur_distr_cont_set_pdfparams() call. =END */ /*---------------------------------------------------------------------------*/ /* Routines for user interface */ /* =ROUTINES */ UNUR_PAR *unur_hinv_new( const UNUR_DISTR *distribution ); /* Get default parameters for generator. */ /*...........................................................................*/ int unur_hinv_set_order( UNUR_PAR *parameters, int order); /* Set order of Hermite interpolation. Valid orders are @code{1}, @code{3}, and @code{5}. Notice that @var{order} greater than @code{1} requires the density of the distribution, and @var{order} greater than @code{3} even requires the derivative of the density. Using @var{order} @code{1} results for most distributions in a huge number of intervals and is therefore not recommended. If the maximal error in u-direction is very small (say smaller than @code{1.e-10}), @var{order} @code{5} is recommended as it leads to considerably fewer design points, as long there are no poles or heavy tails. @emph{Remark:} When the target distribution has poles or (very) heavy tails @var{order} @code{5} (i.e., quintic interpolation) is numerically less stable and more sensitive to round-off errors than @var{order} @code{3} (i.e., cubic interpolation). Default is @code{3} if the density is given and @code{1} otherwise. */ int unur_hinv_set_u_resolution( UNUR_PAR *parameters, double u_resolution); /* Set maximal error in u-direction. However, the given u-error must not be smaller than machine epsilon (@code{DBL_EPSILON}) and should not be too close to this value. As the resolution of most uniform random number sources is 2^(-32) = @code{2.3e-10}, a value of @code{1.e-10} leads to an inversion algorithm that could be called exact. For most simulations slightly bigger values for the maximal error are enough as well. Remark: The u-error might become larger than @var{u_resolution} due to rescaling of floating point numbers when the domain of the distribution is truncated by a unur_hinv_chg_truncated() call. Default is @code{1.e-10}. */ int unur_hinv_set_cpoints( UNUR_PAR *parameters, const double *stp, int n_stp ); /* Set starting construction points (nodes) for Hermite interpolation. As the possible maximal error is only estimated in the setup it may be necessary to set some special design points for computing the Hermite interpolation to guarantee that the maximal u-error can not be bigger than desired. We suggest to include as special design points all local extrema of the density, all points where the density is not differentiable, and isolated points inside of the domain with density 0. If there is an interval with density constant equal to 0 inside of the given domain of the density, both endpoints of this interval should be included as special design points. Notice that there is no necessity to do so. However, if these points are not provided to the algorithm the approximation error might be larger than the given u-resolution, or the required number of intervals could be larger than necessary. @emph{Important}: Notice that the given points must be in increasing order and they must be disjoint. @emph{Important}: The boundary point of the computational region must not be given in this list! Points outside the boundary of the computational region are ignored. Default is for unimodal densities - if known - the mode of the density, if it is not equal to the border of the domain. */ int unur_hinv_set_boundary( UNUR_PAR *parameters, double left, double right ); /* Set the left and right boundary of the computational interval. Of course @code{+/- UNUR_INFINITY} is not allowed. If the CDF at @var{left} and @var{right} is not close to the respective values @code{0.} and @code{1.} then this interval is increased by a (rather slow) search algorithm. @emph{Important}: This call does not change the domain of the given distribution itself. But it restricts the domain for the resulting random variates. Default is @code{1.e20}. */ int unur_hinv_set_guidefactor( UNUR_PAR *parameters, double factor ); /* Set factor for relative size of the guide table for indexed search (see also method DGT @ref{DGT}). It must be greater than or equal to @code{0}. When set to @code{0}, then sequential search is used. Default is @code{1}. */ int unur_hinv_set_max_intervals( UNUR_PAR *parameters, int max_ivs ); /* Set maximum number of intervals. No generator object is created if the necessary number of intervals for the Hermite interpolation exceeds @var{max_ivs}. It is used to prevent the algorithm to eat up all memory for very badly shaped CDFs. Default is @code{1000000} (1.e6). */ int unur_hinv_get_n_intervals( const UNUR_GEN *generator ); /* Get number of nodes (design points) used for Hermite interpolation in the generator object. The number of intervals is the number of nodes minus 1. It returns an error code in case of an error. */ double unur_hinv_eval_approxinvcdf( const UNUR_GEN *generator, double u ); /* Evaluate Hermite interpolation of inverse CDF at @var{u}. If @var{u} is out of the domain [0,1] then @code{unur_errno} is set to @code{UNUR_ERR_DOMAIN} and the respective bound of the domain of the distribution are returned (which is @code{-UNUR_INFINITY} or @code{UNUR_INFINITY} in the case of unbounded domains). @emph{Notice}: When the domain has been truncated by a unur_hinv_chg_truncated() call then the inverse CDF of the truncated distribution is returned. */ int unur_hinv_chg_truncated( UNUR_GEN *generator, double left, double right ); /* Changes the borders of the domain of the (truncated) distribution. Notice that the given truncated domain must be a subset of the domain of the given distribution. The generator always uses the intersection of the domain of the distribution and the truncated domain given by this call. The tables of splines are not recomputed. Thus it might happen that the relative error for the generated variates from the truncated distribution is greater than the bound for the non-truncated distribution. This call also fails when the CDF values of the boundary points are too close, i.e. when only a few different floating point numbers would be computed due to round-off errors with floating point arithmetic. Remark: The u-error might become larger than the @var{u_resolution} given by a unur_hinv_set_u_resolution() call due to rescaling of floating point numbers when the domain of the distribution is truncated. When failed an error code is returned. @emph{Important}: Always check the return code since the domain is not changed in case of an error. */ int unur_hinv_estimate_error( const UNUR_GEN *generator, int samplesize, double *max_error, double *MAE ); /* Estimate maximal u-error and mean absolute error (MAE) for @var{generator} by means of a (quasi-) Monte-Carlo simulation with sample size @var{samplesize}. The results are stored in @var{max_error} and @var{MAE}, respectively. It returns @code{UNUR_SUCCESS} if successful. */ /* =END */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/dext_struct.h0000644001357500135600000000677714420445767015046 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: dext_struct.h * * * * PURPOSE: * * declares structures for method DEXT * * (wrapper for Discrete EXTernal generators) * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Information for constructing the generator */ struct unur_dext_par { /* data for external generator */ int (*init) (UNUR_GEN *gen); /* pointer to initialization routine */ int (*sample)(UNUR_GEN *gen); /* pointer to sampling routine */ }; /*---------------------------------------------------------------------------*/ /* The generator object */ struct unur_dext_gen { int (*init) (UNUR_GEN *gen); /* pointer to initialization routine */ int (*sample)(UNUR_GEN *gen); /* pointer to sampling routine */ void *param; /* parameters for the generator */ size_t size_param; /* size of parameter object */ }; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/deprecated_vmt_struct.h0000644001357500135600000000707714420445767017062 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: deprecated_vmt_struct.h * * * * PURPOSE: * * declares structures for method VMT * * (Vector Matrix Transformation) * * * ***************************************************************************** * * * THIS METHOD AND THE CORRESPONDING ROUTINES SHOULD NOT BE USED ANY MORE! * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Information for constructing the generator */ struct unur_vmt_par { int dummy; }; /*---------------------------------------------------------------------------*/ /* The generator object */ struct unur_vmt_gen { struct unur_gen **marginalgen_list; /* list of generators for marginal distributions */ double *cholesky; /* cholesky factor of covariance matrix */ int dim; /* dimension of distribution */ }; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/pinv_info.ch0000644001357500135600000001656214420445767014621 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: pinv_info.c * * * * Routines for creating info strings. * * * ***************************************************************************** * * * Copyright (c) 2008 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_INFO /*---------------------------------------------------------------------------*/ void _unur_pinv_info( struct unur_gen *gen, int help ) /*----------------------------------------------------------------------*/ /* create character string that contains information about the */ /* given generator object. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* help ... whether to print additional comments */ /*----------------------------------------------------------------------*/ { struct unur_string *info = gen->infostr; struct unur_distr *distr = gen->distr; /* generator ID */ _unur_string_append(info,"generator ID: %s\n\n", gen->genid); /* distribution */ _unur_string_append(info,"distribution:\n"); _unur_distr_info_typename(gen); _unur_string_append(info," functions = %s\n", (gen->variant & PINV_VARIANT_PDF) ? "PDF" : "CDF"); _unur_string_append(info," domain = (%g, %g)\n", DISTR.trunc[0],DISTR.trunc[1]); _unur_string_append(info," center = %g", unur_distr_cont_get_center(distr)); if (distr->set & UNUR_DISTR_SET_CENTER) _unur_string_append(info, (distr->set & UNUR_DISTR_SET_CENTER_APPROX) ? " [guess]\n" : "\n"); else _unur_string_append(info,(distr->set & UNUR_DISTR_SET_MODE ) ? " [= mode]\n" : " [default]\n"); if (help) { if ( !(distr->set & (UNUR_DISTR_SET_CENTER | UNUR_DISTR_SET_MODE )) ) _unur_string_append(info,"\n[ Hint: %s ]\n", "You may provide a point near the mode as \"center\"."); } _unur_string_append(info,"\n"); /* method */ _unur_string_append(info,"method: PINV (Polynomial interpolation based INVerse CDF)\n"); _unur_string_append(info," order of polynomial = %d\n", GEN->order); _unur_string_append(info," smoothness = %d ", GEN->smooth); switch (GEN->smooth) { case 0: _unur_string_append(info,"[continuous]\n"); break; case 1: _unur_string_append(info,"[differentiable]\n"); break; case 2: _unur_string_append(info,"[twice differentiable]\n"); break; } if (gen->variant & PINV_VARIANT_PDF) _unur_string_append(info," use PDF + Lobatto integration %s\n", (gen->set & PINV_SET_VARIANT) ? "" : "[default]"); else _unur_string_append(info," use CDF %s\n", (gen->set & PINV_SET_VARIANT) ? "" : "[default]"); if (gen->variant & PINV_VARIANT_UPOINTS) _unur_string_append(info," Chebyshev points in u scale\n"); _unur_string_append(info,"\n"); /* performance */ _unur_string_append(info,"performance characteristics:\n"); _unur_string_append(info," truncated domain = (%g,%g)\n",GEN->bleft,GEN->bright); /* _unur_string_append(info," Prob(Xtailcutoff_left)); */ /* _unur_string_append(info," Prob(X>domain) = %g\n", _unur_max(0,1.-GEN->tailcutoff_right)); */ if (DISTR.cdf) { double max_error=1.; double MAE=1.; unur_pinv_estimate_error( gen, 10000, &max_error, &MAE ); _unur_string_append(info," u-error <= %g (mean = %g)\n", max_error, MAE); } else { _unur_string_append(info," u-error NA [requires CDF]\n"); } _unur_string_append(info, " [ u-resolution = %g ]\n",GEN->u_resolution); _unur_string_append(info," area below PDF = %18.17g\n", GEN->area); _unur_string_append(info," # intervals = %d\n", GEN->n_ivs); if (gen->variant & PINV_VARIANT_KEEPCDF) _unur_string_append(info," # CDF table size = %d\n", _unur_lobatto_size_table(GEN->aCDF)); _unur_string_append(info,"\n"); /* parameters */ if (help) { _unur_string_append(info,"parameters:\n"); _unur_string_append(info," order = %d ", GEN->order); if (!(gen->set & PINV_SET_ORDER)) _unur_string_append(info,"[default]"); if (gen->set & PINV_SET_ORDER_COR) _unur_string_append(info,"[corrected]"); _unur_string_append(info,"\n"); _unur_string_append(info," smoothness = %d ", GEN->smooth); if (!(gen->set & PINV_SET_SMOOTH)) _unur_string_append(info,"[default]"); if (gen->set & PINV_SET_SMOOTH_COR) _unur_string_append(info,"[corrected]"); _unur_string_append(info,"\n"); _unur_string_append(info," u_resolution = %g %s\n", GEN->u_resolution, (gen->set & PINV_SET_U_RESOLUTION) ? "" : "[default]"); _unur_string_append(info," use_upoints = %s %s\n", (gen->variant & PINV_VARIANT_UPOINTS) ? "TRUE" : "FALSE", (gen->set & PINV_SET_UPOINTS) ? "" : "[default]"); _unur_string_append(info," boundary = (%g,%g) %s\n", GEN->bleft_par, GEN->bright_par, (gen->set & PINV_SET_BOUNDARY) ? "" : "[default]"); _unur_string_append(info," search for boundary: left=%s, right=%s %s\n", (GEN->sleft ? "TRUE":"FALSE"), (GEN->sright ? "TRUE":"FALSE"), (gen->set & PINV_SET_BOUNDARY) ? "" : "[default]"); _unur_string_append(info," maximum number of interval = %d %s\n", GEN->max_ivs, (gen->set & PINV_SET_MAX_IVS) ? "" : "[default]"); _unur_string_append(info," keep table of CDF values = %s %s\n", (gen->variant & PINV_VARIANT_KEEPCDF) ? "TRUE" : "FALSE", (gen->set & PINV_SET_KEEPCDF) ? "" : "[default]"); _unur_string_append(info,"\n"); } /* Hints */ if (help) { if ( GEN->order < MAX_ORDER ) _unur_string_append(info,"[ Hint: %s ]\n", "You can increase \"order\" to decrease #intervals"); if (! (gen->set & PINV_SET_U_RESOLUTION) ) _unur_string_append(info,"[ Hint: %s\n\t%s ]\n", "You can decrease the u-error by decreasing \"u_resolution\".", "(it is bounded by the machine epsilon, however.)"); _unur_string_append(info,"\n"); } } /* end of _unur_pinv_info() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_INFO */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/norta.c0000644001357500135600000012446414420445767013606 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: norta.c * * * * TYPE: continuous multivariate random variate * * METHOD: generates random vector with given covariance matrix and * * given marginal distribution. * * * * DESCRIPTION: * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * ***************************************************************************** * * * REFERENCES: * * [1] Hoermann, W., J. Leydold, and G. Derflinger (2004): * * Automatic Nonuniform Random Variate Generation, Springer, Berlin. * * * * [2] Gosh, S. (????): Eigenvector Correction method * * * ***************************************************************************** * * * NORTA (NORmal to anything) is a model to get random vectors with * * given marginal distributions and rank correlation. (Notice that this * * does not uniquely define the multivariate distribution.) * * * * In the NORTA model multinormal random variates with the given * * rank (Spearman's) correlations are generated. For this task the rank * * correlations are transformed into the corresponding * * (Pearson) correlation matrix and the VMT method is used to sample from * * the resulting multinormal distribution (by means of the Cholesky * * decomposition of the covariance matrix). * * In a second step the (standard normal distributed) marginal variates * * are transformed by means of the CDF of the normal distribution to get * * uniform marginals. The resulting random vectors then have uniform * * marginals and the desired rank correlation between its components. * * Such a random vector is called 'copula'. * * * * By means of the inverse CDF the uniform marginals are transformed into * * the target marginal distributions. This transformation does not change * * the rank correlation. * * * * It can happen that the desired rank correlation matrix is not feasible, * * i.e., it cannot occur as rank correlation matrix of a multinormal * * distribution. For this case we use Gosh's "eigenvector correction * * method" [2]. In this case a spectral decomposition of the corresponding * * (Pearson) correlation matrix is carried out. If there are some * * non-positive eigenvalues (i.e. this matrix is not a true correlation * * matrix) then these are set to a small value and a new (positive * * definite) correlation matrix is created and used. * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include #include #include #include "unur_methods_source.h" #include "x_gen.h" #include "x_gen_source.h" #include "cstd.h" #include "hinv.h" #include "ninv.h" #include "pinv.h" #include "mvstd.h" #include "norta.h" #include "norta_struct.h" /*---------------------------------------------------------------------------*/ /* Constants */ /* smallest eigenvalue allowed for correlation matrix */ #define UNUR_NORTA_MIN_EIGENVALUE (1.e-10) /*---------------------------------------------------------------------------*/ /* Variants */ /*---------------------------------------------------------------------------*/ /* Debugging flags */ /* bit 01 ... pameters and structure of generator (do not use here) */ /* bits 02-12 ... setup */ /* bits 13-24 ... adaptive steps */ /* bits 25-32 ... trace sampling */ #define NORTA_DEBUG_SIGMA_Y 0x00000010u /* print sigma_y for normal */ /*---------------------------------------------------------------------------*/ /* Flags for logging set calls */ /*---------------------------------------------------------------------------*/ #define GENTYPE "NORTA" /* type of generator */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_norta_init( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* Initialize new generator. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_norta_create( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* create new (almost empty) generator object. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_norta_clone( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* copy (clone) generator object. */ /*---------------------------------------------------------------------------*/ static void _unur_norta_free( struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* destroy generator object. */ /*---------------------------------------------------------------------------*/ static int _unur_norta_sample_cvec( struct unur_gen *gen, double *vec ); /*---------------------------------------------------------------------------*/ /* sample from generator */ /*---------------------------------------------------------------------------*/ static int _unur_norta_nortu_setup( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Compute parameter for NORTU (normal to uniform). */ /*---------------------------------------------------------------------------*/ static int _unur_norta_make_correlationmatrix( int dim, double *M); /*---------------------------------------------------------------------------*/ /* make correlation matrix by transforming symmetric positive definit matrix */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_norta_make_marginalgen( const struct unur_gen *gen, const struct unur_distr *marginal ); /*---------------------------------------------------------------------------*/ /* make generator for marginal distribution */ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ /* the following functions print debugging information on output stream, */ /* i.e., into the LOG file if not specified otherwise. */ /*---------------------------------------------------------------------------*/ static void _unur_norta_debug_init( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print after generator has been initialized has completed. */ /*---------------------------------------------------------------------------*/ static void _unur_norta_debug_sigma_y( const struct unur_gen *gen, const double *sigma_y, const char *comment ); /*---------------------------------------------------------------------------*/ /* print sigma_y of corresponding normal distribution. */ /*---------------------------------------------------------------------------*/ static void _unur_norta_debug_eigensystem( const struct unur_gen *gen, const double *eigenvalues, const double *eigenvectors ); /*---------------------------------------------------------------------------*/ /* print eigensystem of sigma_y. */ /*---------------------------------------------------------------------------*/ static void _unur_norta_debug_nmgenerator( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print genid of multinormal generator. */ /*---------------------------------------------------------------------------*/ #endif #ifdef UNUR_ENABLE_INFO static void _unur_norta_info( struct unur_gen *gen, int help ); /*---------------------------------------------------------------------------*/ /* create info string. */ /*---------------------------------------------------------------------------*/ #endif /*---------------------------------------------------------------------------*/ /* abbreviations */ #define DISTR_IN distr->data.cvec /* data for distribution object */ #define PAR ((struct unur_norta_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_norta_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.cvec /* data for distribution in generator object */ #define SAMPLE gen->sample.cvec /* pointer to sampling routine */ #define MNORMAL gen->gen_aux /* pointer to multinormal generator */ /*---------------------------------------------------------------------------*/ #define _unur_norta_getSAMPLE(gen) (_unur_norta_sample_cvec) /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Public: User Interface (API) **/ /*****************************************************************************/ struct unur_par * unur_norta_new( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get default parameters */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* default parameters (pointer to structure) */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_par *par; /* check arguments */ _unur_check_NULL( GENTYPE,distr,NULL ); /* check distribution */ if (distr->type != UNUR_DISTR_CVEC) { _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } COOKIE_CHECK(distr,CK_DISTR_CVEC,NULL); if (!(distr->set & UNUR_DISTR_SET_RANKCORR)) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"rank correlation matrix"); return NULL; } if (!(distr->set & UNUR_DISTR_SET_MARGINAL)) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"marginals"); return NULL; } /* allocate structure */ par = _unur_par_new( sizeof(struct unur_norta_par) ); COOKIE_SET(par,CK_NORTA_PAR); /* copy input */ par->distr = distr; /* pointer to distribution object */ /* set default values */ par->method = UNUR_METH_NORTA ; /* method */ par->variant = 0u; /* default variant */ par->set = 0u; /* inidicate default parameters */ par->urng = unur_get_default_urng(); /* use default urng */ par->urng_aux = NULL; /* no auxilliary URNG required */ par->debug = _unur_default_debugflag; /* set default debugging flags */ /* routine for starting generator */ par->init = _unur_norta_init; return par; } /* end of unur_norta_new() */ /*****************************************************************************/ /** Private **/ /*****************************************************************************/ struct unur_gen * _unur_norta_init( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* initialize new generator */ /* */ /* parameters: */ /* par ... pointer to paramters for building generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ _unur_check_NULL( GENTYPE,par,NULL ); /* check input */ if ( par->method != UNUR_METH_NORTA ) { _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); return NULL; } COOKIE_CHECK(par,CK_NORTA_PAR,NULL); /* create a new empty generator object */ gen = _unur_norta_create(par); _unur_par_free(par); if (!gen) return NULL; /* check for truncated domain */ if ( gen->distr->set & UNUR_DISTR_SET_DOMAINBOUNDED ) { if ( DISTR.domainrect == NULL ) { /* cannot handle non-rectangular domain */ _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"cannot handle non-rectangular domain"); _unur_norta_free(gen); return NULL; } else { /* rectangular domain */ if (_unur_distr_cvec_marginals_are_equal(DISTR.marginals, GEN->dim)) { /* we have to handle these equal marginal distributions independently */ if ( _unur_distr_cvec_duplicate_firstmarginal(gen->distr) != UNUR_SUCCESS ) { _unur_norta_free(gen); return NULL; } } } } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_norta_debug_init(gen); #endif /* compute parameters for NORTU (normal to uniform) */ if (_unur_norta_nortu_setup(gen) != UNUR_SUCCESS) { _unur_norta_free(gen); return NULL; } /* distribution object for standard normal distribution */ GEN->normaldistr = unur_distr_normal(NULL,0); if (gen->distr->id != UNUR_DISTR_COPULA) { /* we have to initialize generator for marginal distributions */ if (_unur_distr_cvec_marginals_are_equal(DISTR.marginals, GEN->dim)) { /* we can use the same generator object for all marginal distribuitons */ struct unur_gen *marginalgen = _unur_norta_make_marginalgen( gen, DISTR.marginals[0] ); if (marginalgen) GEN->marginalgen_list = _unur_gen_list_set(marginalgen,GEN->dim); } else { /* we need different generator objects for all marginal distribuitons */ int i,j; int failed = FALSE; struct unur_gen **marginalgens = _unur_xmalloc( GEN->dim * sizeof(struct unur_gen*) ); /* check for truncated domain */ if ( gen->distr->set & UNUR_DISTR_SET_DOMAINBOUNDED ) { /* set domains for each marginal distribution */ for (i=0; idim && !failed; i++) { if ( (unur_distr_cont_set_domain(DISTR.marginals[i], DISTR.domainrect[2*i], DISTR.domainrect[2*i+1])) != UNUR_SUCCESS) { failed = TRUE; break; } } } /* create generator for each marginal distribution */ for (i=0; idim && !failed; i++) { marginalgens[i] = _unur_norta_make_marginalgen( gen, DISTR.marginals[i] ); if (marginalgens[i]==NULL) { failed=TRUE; break; } } /* check creating of generators */ if (failed) { for (j=0; jmarginalgen_list = marginalgens; } /* verify initialization of marginal generators */ if (GEN->marginalgen_list == NULL) { _unur_error(gen->genid,UNUR_ERR_GENERIC,"init of marginal generators failed"); _unur_norta_free(gen); return NULL; } } /* o.k. */ return gen; } /* end of _unur_norta_init() */ /*---------------------------------------------------------------------------*/ static struct unur_gen * _unur_norta_create( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* allocate memory for generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* pointer to (empty) generator object with default settings */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_NORTA_PAR,NULL); /* create new generic generator object */ gen = _unur_generic_create( par, sizeof(struct unur_norta_gen) ); /* magic cookies */ COOKIE_SET(gen,CK_NORTA_GEN); /* set generator identifier */ gen->genid = _unur_set_genid(GENTYPE); /* routines for sampling and destroying generator */ SAMPLE = _unur_norta_getSAMPLE(gen); gen->destroy = _unur_norta_free; gen->clone = _unur_norta_clone; /* dimension of distribution */ GEN->dim = gen->distr->dim; /* allocate array for auxiliary copula */ GEN->copula = _unur_xmalloc(sizeof(double)*GEN->dim); /* initialize pointer */ MNORMAL = NULL; GEN->normaldistr = NULL; GEN->marginalgen_list = NULL; #ifdef UNUR_ENABLE_INFO /* set function for creating info string */ gen->info = _unur_norta_info; #endif /* return pointer to (almost empty) generator object */ return gen; } /* end of _unur_norta_create() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_norta_clone( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* copy (clone) generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to clone of generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { #define CLONE ((struct unur_norta_gen*)clone->datap) struct unur_gen *clone; /* check arguments */ CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_NORTA_GEN,NULL); /* create generic clone */ clone = _unur_generic_clone( gen, GENTYPE ); /* allocate array for auxiliary copula */ CLONE->copula = _unur_xmalloc(sizeof(double)*GEN->dim); /* clone marginal distribution */ CLONE->normaldistr = _unur_distr_clone(GEN->normaldistr); /* marginal generators */ if (GEN->marginalgen_list) CLONE->marginalgen_list = _unur_gen_list_clone( GEN->marginalgen_list, GEN->dim ); return clone; #undef CLONE } /* end of _unur_norta_clone() */ /*---------------------------------------------------------------------------*/ void _unur_norta_free( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* deallocate generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { /* check arguments */ if( !gen ) /* nothing to do */ return; /* check input */ if ( gen->method != UNUR_METH_NORTA ) { _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); return; } COOKIE_CHECK(gen,CK_NORTA_GEN,RETURN_VOID); /* free auxiliary arrays */ if (GEN->copula) free (GEN->copula); /* free normal distribution object */ if (GEN->normaldistr) _unur_distr_free (GEN->normaldistr); /* free marginal generators */ if (GEN->marginalgen_list) _unur_gen_list_free( GEN->marginalgen_list, GEN->dim); /* we cannot use this generator object any more */ SAMPLE = NULL; /* make sure to show up a programming error */ _unur_generic_free(gen); } /* end of _unur_norta_free() */ /*****************************************************************************/ int _unur_norta_sample_cvec( struct unur_gen *gen, double *vec ) /*----------------------------------------------------------------------*/ /* sample from generator */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* vec ... random vector (result) */ /*----------------------------------------------------------------------*/ { #define idx(a,b) ((a)*GEN->dim+(b)) int j; double *u; /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_NORTA_GEN,UNUR_ERR_COOKIE); /* pointer to auxiliary array of uniforms */ u = GEN->copula; /* sample from multinormal distribution */ _unur_sample_vec(MNORMAL,u); /* make copula */ for (j=0; jdim; j++) vec[j] = unur_distr_cont_eval_cdf( u[j], GEN->normaldistr ); if (gen->distr->id == UNUR_DISTR_COPULA) /* we want to have a normal copula --> just return data */ return UNUR_SUCCESS; /* else non-uniform marginals */ for (j=0; jdim; j++) { /* call marginal generator (using this U-value) */ vec[j] = unur_quantile(GEN->marginalgen_list[j], vec[j]); } return UNUR_SUCCESS; #undef idx } /* end of _unur_norta_sample_cvec() */ /*****************************************************************************/ /** Auxilliary Routines **/ /*****************************************************************************/ int _unur_norta_nortu_setup( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* Compute parameter for NORTU (Normal to uniform) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS if computed successfully */ /* error code otherwise */ /*----------------------------------------------------------------------*/ { #define idx(a,b) ((a)*dim+(b)) int dim = GEN->dim; /* dimension of distribution */ double *sigma_y; /* correlation matrix for corresponding normal distr. */ double *eigenvalues; /* eigenvalues of sigma_y */ double *eigenvectors; /* eigenvectors of sigma_y */ int eigenvalues_positive; /* boolean indicating whether all eigenvalues are strictly positive */ struct unur_distr *mn_distr; /* multinormal distribution */ struct unur_gen *mn_gen; /* generator for multinormal distribution */ int i,j; /* setup correlation matrix for corresponding normal distribution */ sigma_y = _unur_xmalloc(dim * dim * sizeof(double)); for(i=0; idebug & NORTA_DEBUG_SIGMA_Y) _unur_norta_debug_sigma_y( gen, sigma_y, "NORTU setup:" ); #endif /* compute eigenvectors and eigenvalues of sigma_y */ eigenvalues = _unur_xmalloc(dim * sizeof(double)); eigenvectors = _unur_xmalloc(dim * dim * sizeof(double)); if (_unur_matrix_eigensystem(dim, sigma_y, eigenvalues, eigenvectors) != UNUR_SUCCESS) { _unur_error(GENTYPE,UNUR_ERR_GEN_DATA,"cannot compute eigenvalues for given sigma_y"); free(sigma_y); free(eigenvalues); free(eigenvectors); return UNUR_ERR_GEN_DATA; } #ifdef UNUR_ENABLE_LOGGING if (gen->debug & NORTA_DEBUG_SIGMA_Y) _unur_norta_debug_eigensystem( gen, eigenvalues, eigenvectors ); #endif /* check if all eigenvalues are positive */ /* otherwise set to small values close to 0 */ eigenvalues_positive = TRUE; for(i=0; i corrected matrix"); #ifdef UNUR_ENABLE_LOGGING if (gen->debug & NORTA_DEBUG_SIGMA_Y) _unur_norta_debug_sigma_y( gen, sigma_y, "\tEigenvalues < 0 --> correction required" ); #endif } /* clear working arrays */ free(eigenvalues); free(eigenvectors); /* make generator for multinormal distribution */ mn_distr = unur_distr_multinormal(dim, NULL, sigma_y); mn_gen = NULL; if (mn_distr) { mn_gen = unur_init(unur_mvstd_new(mn_distr)); _unur_distr_free(mn_distr); } if (mn_gen == NULL) { _unur_error(GENTYPE,UNUR_ERR_GEN_DATA,"(corrected) sigma_y not positive definit"); free(sigma_y); return UNUR_ERR_GEN_DATA; } MNORMAL = mn_gen; /* need same uniform random number generator as NORTA generator */ MNORMAL->urng = gen->urng; /* copy debugging flags */ MNORMAL->debug = gen->debug; #ifdef UNUR_ENABLE_LOGGING if (gen->debug & NORTA_DEBUG_SIGMA_Y) _unur_norta_debug_nmgenerator( gen ); #endif /* clear working arrays */ free(sigma_y); return UNUR_SUCCESS; #undef idx } /* end of _unur_norta_nortu_setup() */ /*---------------------------------------------------------------------------*/ int _unur_norta_make_correlationmatrix( int dim, double *M) /*----------------------------------------------------------------------*/ /* make correlation matrix by transforming symmetric positive definit */ /* matrix. */ /* */ /* There is no checking whether M fulfills the conditions! */ /* */ /* parameters: */ /* dim ... dimension of matrix M */ /* M ... symmetric square matrix */ /*----------------------------------------------------------------------*/ { #define idx(a,b) ((a)*dim+(b)) int i,j; /* diagonal is used to store the roots of the diagonal elements */ for (i=0; itype != UNUR_DISTR_CONT) { _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } COOKIE_CHECK(marginal,CK_DISTR_CONT,NULL); /* try PINV, CSTD+Inversion, HINV, and NINV */ do { /* PINV (Polynomial interpolation based INVersion of CDF) */ par = unur_pinv_new( marginal ); if ( (marginalgen = _unur_init(par)) != NULL ) break; /* CSTD + inversion */ par = unur_cstd_new( marginal ); if (unur_cstd_set_variant( par, UNUR_STDGEN_INVERSION)==UNUR_SUCCESS) { marginalgen = _unur_init(par); break; } else { _unur_par_free(par); } /* HINV (Hermite interpolation based INVersion of CDF) */ par = unur_hinv_new( marginal ); if ( (marginalgen = _unur_init(par)) != NULL ) break; /* NINV (Numerical inversion with regula falsi */ par = unur_ninv_new( marginal ); unur_ninv_set_table( par, 100 ); if ( (marginalgen = _unur_init(par)) != NULL ) break; /* no inversion method avaiblable */ _unur_error(gen->genid,UNUR_ERR_DISTR_REQUIRED,"data for (numerical) inversion of marginal missing"); return NULL; } while (1); /* set debugging flags */ marginalgen->debug = gen->debug; /* return generator object */ return marginalgen; } /* end of _unur_norta_make_marginalgen() */ /*****************************************************************************/ /** Debugging utilities **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ void _unur_norta_debug_init( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write info about generator into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { /* int i; */ FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_NORTA_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: type = continuous multivariate random variates\n",gen->genid); fprintf(LOG,"%s: method = NORTA (Vector Matrix Transformation)\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); _unur_distr_cvec_debug( gen->distr, gen->genid ); } /* end of _unur_norta_debug_init() */ /*---------------------------------------------------------------------------*/ void _unur_norta_debug_sigma_y( const struct unur_gen *gen, const double *sigma_y, const char *comment ) /*----------------------------------------------------------------------*/ /* print sigma_y of corresponding normal distribution. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* sigma_y ... pointer to correlation matrix */ /* comment ... additional string printed */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_NORTA_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s: %s\n",gen->genid,comment); fprintf(LOG,"%s:\n",gen->genid); _unur_matrix_print_matrix( GEN->dim, sigma_y, "\tsigma_y =", LOG, gen->genid, "\t "); } /* end of _unur_norta_debug_sigma_y() */ /*---------------------------------------------------------------------------*/ void _unur_norta_debug_eigensystem( const struct unur_gen *gen, const double *eigenvalues, const double *eigenvectors ) /*----------------------------------------------------------------------*/ /* print eigensystem of sigma_y. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* eigenvalues ... eigenvalues */ /* eigenvectors ... eigenvalues */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_NORTA_GEN,RETURN_VOID); LOG = unur_get_stream(); _unur_matrix_print_vector( GEN->dim, eigenvalues, "\teigenvalues of sigma_y =", LOG, gen->genid, "\t "); _unur_matrix_print_matrix( GEN->dim, eigenvectors, "\teigenvectors of sigma_y [rows] =", LOG, gen->genid, "\t "); } /* end of _unur_norta_debug_eigensystem() */ /*---------------------------------------------------------------------------*/ void _unur_norta_debug_nmgenerator( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* print genid of multinormal generator. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_NORTA_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s: generator for multinormal auxiliary distribution = %s\n", gen->genid, MNORMAL->genid ); fprintf(LOG,"%s:\n",gen->genid); } /* end of _unur_norta_debug_nmgenerator() */ /*---------------------------------------------------------------------------*/ #endif /* UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_INFO /*---------------------------------------------------------------------------*/ void _unur_norta_info( struct unur_gen *gen, int help ) /*----------------------------------------------------------------------*/ /* create character string that contains information about the */ /* given generator object. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* help ... whether to print additional comments */ /*----------------------------------------------------------------------*/ { struct unur_string *info = gen->infostr; struct unur_distr *distr = gen->distr; int i; /* generator ID */ _unur_string_append(info,"generator ID: %s\n\n", gen->genid); /* distribution */ _unur_string_append(info,"distribution:\n"); _unur_distr_info_typename(gen); _unur_string_append(info," dimension = %d\n",GEN->dim); _unur_string_append(info," functions = MARGINAL distributions\n"); _unur_string_append(info," marginals ="); for (i=0; idim; i++) _unur_string_append(info," %s", distr->data.cvec.marginals[i]->name); _unur_string_append(info,"\n\n"); /* if (help) { */ /* _unur_string_append(info,"\n"); */ /* } */ /* method */ _unur_string_append(info,"method: NORTA (NORmal To Anything)\n"); _unur_string_append(info,"\n"); /* performance */ /* _unur_string_append(info,"performance characteristics:\n"); */ /* _unur_string_append(info,"\n"); */ /* parameters */ if (help) { _unur_string_append(info,"parameters: none\n"); _unur_string_append(info,"\n"); } /* Hints */ /* if (help) { */ /* _unur_string_append(info,"\n"); */ /* } */ } /* end of _unur_norta_info() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_INFO */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/cstd.h0000644001357500135600000002221114420445767013410 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: cstd.h * * * * PURPOSE: * * function prototypes for method CSTD * * (wrapper for special generators for * * Continuous STanDard distributions) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /* =METHOD CSTD Continuous STandarD distributions =UP Methods_for_CONT =REQUIRED standard distribution from UNU.RAN library (@pxref{Stddist,,Standard distributions}) or continuous distribution with inverse CDF. =SPEED Set-up: fast, Sampling: depends on distribution and generator =REINIT supported =DESCRIPTION CSTD is a wrapper for special generators for continuous univariate standard distributions. It only works for distributions in the UNU.RAN library of standard distributions (@pxref{Stddist,,Standard distributions}) or for continuous distributions where the inverse CDF is given. If a distribution object is provided that is build from scratch, it must provide the inverse CDF. Then CSTD implements the inversion method. Otherwise, the NULL pointer is returned. For some distributions more than one special generator is possible. =HOWTOUSE Create a distribution object for a standard distribution from the UNU.RAN library (@pxref{Stddist,,Standard distributions}), or create a continuous distribution object and set the function for the inverse CDF using unur_distr_cont_set_invcdf(). For some distributions more than one special generator (@emph{variants}) is possible. These can be choosen by a unur_cstd_set_variant() call. For possible variants @pxref{Stddist,,Standard distributions}. However the following are common to all distributions: @table @code @item UNUR_STDGEN_DEFAULT the default generator. @item UNUR_STDGEN_FAST the fastest available special generator. @item UNUR_STDGEN_INVERSION the inversion method (if available). @end table Notice that the variant @code{UNUR_STDGEN_FAST} for a special generator may be slower than one of the universal algorithms! Additional variants may exist for particular distributions. Sampling from truncated distributions (which can be constructed by changing the default domain of a distribution by means of unur_distr_cont_set_domain() or unur_cstd_chg_truncated() calls) is possible but requires the inversion method. Moreover the CDF of the distribution must be implemented. It is possible to change the parameters and the domain of the chosen distribution and run unur_reinit() to reinitialize the generator object. =END */ /*---------------------------------------------------------------------------*/ /* Common variants for all special generators */ #define UNUR_STDGEN_DEFAULT 0 /* default algorithm (don't change 0!)*/ #define UNUR_STDGEN_INVERSION (~0u) /* inversion method */ #define UNUR_STDGEN_FAST (0) /* fastest algorithm */ /*---------------------------------------------------------------------------*/ /* Routines for user interface */ /* =ROUTINES */ UNUR_PAR *unur_cstd_new( const UNUR_DISTR *distribution ); /* Get default parameters for new generator. It requires a distribution object for a continuous univariant distribution from the UNU.RAN library of standard distributions (@pxref{Stddist,,Standard distributions}). Using a truncated distribution is allowed only if the inversion method is available and selected by the unur_cstd_set_variant() call immediately after creating the parameter object. Use a unur_distr_cont_set_domain() call to get a truncated distribution. To change the domain of a (truncated) distribution of a generator use the unur_cstd_chg_truncated() call. */ /*...........................................................................*/ int unur_cstd_set_variant( UNUR_PAR *parameters, unsigned variant ); /* Set variant (special generator) for sampling from a given distribution. For possible variants @pxref{Stddist,,Standard distributions}. Common variants are @code{UNUR_STDGEN_DEFAULT} for the default generator, @code{UNUR_STDGEN_FAST} for (one of the) fastest implemented special generators, and @code{UNUR_STDGEN_INVERSION} for the inversion method (if available). If the selected variant number is not implemented, then an error code is returned and the variant is not changed. */ /*...........................................................................*/ int unur_cstd_chg_truncated( UNUR_GEN *generator, double left, double right ); /* Change left and right border of the domain of the (truncated) distribution. This is only possible if the inversion method is used. Otherwise this call has no effect and an error code is returned. Notice that the given truncated domain must be a subset of the domain of the given distribution. The generator always uses the intersection of the domain of the distribution and the truncated domain given by this call. It is not required to run unur_reinit() after this call has been used. @emph{Important:} If the CDF is (almost) the same for @var{left} and @var{right} and (almost) equal to @code{0} or @code{1}, then the truncated domain is not chanced and the call returns an error code. @emph{Notice:} If the parameters of the distribution has been changed it is recommended to set the truncated domain again, since the former call might change the domain of the distribution but not update the values for the boundaries of the truncated distribution. */ /* =END */ /*---------------------------------------------------------------------------*/ /* Yet not documented! */ double unur_cstd_eval_invcdf( const UNUR_GEN *generator, double u ); /* Evaluate inverse CDF at @var{u}. However, this requires that @var{generator} implements an inversion method. If @var{u} is out of the domain [0,1] then @code{unur_errno} is set to @code{UNUR_ERR_DOMAIN} and the respective bound of the domain of the distribution are returned (which is @code{-UNUR_INFINITY} or @code{UNUR_INFINITY} in the case of unbounded domains). @emph{Notice}: When the domain has been truncated by a unur_cstd_chg_truncated() call then the inverse CDF of the truncated distribution is returned. */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/dau_struct.h0000644001357500135600000000717114420304141014614 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: dau_struct.h * * * * PURPOSE: * * declares structures for method DAU * * ((Discrete) Alias-Urn) * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Information for constructing the generator */ struct unur_dau_par { double urn_factor; /* relative length of table for alias-urn method */ /* (DEFAULT = 1 --> alias method) */ /* length of table = urn_factor * len */ }; /*---------------------------------------------------------------------------*/ /* The generator object */ struct unur_dau_gen { int len; /* length of probability vector */ int urn_size; /* size of table for alias-urn method */ double *qx; /* pointer to cut points for strips */ int *jx; /* pointer to donor */ double urn_factor; /* relative length of table for alias-urn method */ }; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/vnrou_struct.h0000644001357500135600000000715214420304141015213 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: vnrou_struct.h * * * * PURPOSE: * * declares structures for method VNROU * * (Vector Naive Ratio Of Uniforms) * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Information for constructing the generator */ struct unur_vnrou_par { double r; /* r-parameter of the vnrou method */ double *umin, *umax; /* boundary rectangle u-coordinates */ double vmax; /* boundary rectangle v-coordinate */ }; /*---------------------------------------------------------------------------*/ /* The generator object */ struct unur_vnrou_gen { int dim; /* dimension of distribution */ double r; /* r-parameter of the vnrou method */ double *umin, *umax; /* boundary rectangle u-coordinates */ double vmax; /* boundary rectangle v-coordinate */ const double *center; /* center of distribution */ }; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/tdr.c0000644001357500135600000012771614420445767013257 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: tdr.c * * * * TYPE: continuous univariate random variate * * METHOD: transformed density rejection * * * * DESCRIPTION: * * Given PDF of a T-concave distribution * * produce a value x consistent with its density * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * ***************************************************************************** * * * REFERENCES: * * [1] Hoermann W. (1995): A rejection technique for sampling from * * T-concave distributions, ACM TOMS 21, p. 182-193 * * * * [2] Chen, H. C. and Asau, Y. (1974): On generating random variates * * from an empirical distribution, AIIE Trans. 6, pp. 163-166 * * * * [3] Gilks, W. R. and Wild, P. (1992): Adaptive rejection sampling * * for Gibbs sampling, Applied Statistics 41, pp. 337-348 * * * * [4] Evans, M. and Swartz, T. (1998): Random variable generation * * using concavity properties of transformed densities, * * Journal of Computational and Graphical Statistics 7(4), pp. 514-528 * * * * [5] Derflinger, G. and Hoermann, W. (1999): The optimal selection of * * hat functions for rejection algorithms, preprint * * * * [6] Leydold, J. (1999): Automatic Sampling with the ratio-of-uniforms * * method, preprint, 15pp. * * * * [7] Leydold, J and Hoermann, W. (2001): ?????, preprint * * * ***************************************************************************** ***************************************************************************** * Variant GW (Gilks & Wild) * ***************************************************************************** * * * Transformed density rejection (see [1,3,4]) is an acceptance/rejection * * technique that uses the fact, that the probability density function f(x) * * for many distribution is T-concave, to construct a hat function. * * That is, there exists a transformation T(x), such that T(f(x)) is * * concave. Then it is easy to construct a majorizing or hat function Th(x) * * for the transformed density T(F(x)) by the pointwise minima of several * * tangents. Transforming this back into the original scale gives the * * hat h(x) = T^(-1)(Th(x)). Squeezes can be constructed by secants. * * * * However, transformation T(x) has to satisfy (see [1]): * * * * (1) T(f(x)) is concave. * * (2) T is differentiable. * * (3) T is strictly monotonically increasing (i.e., T'(x) > 0), * * which implies that T^(-1) exists. * * (4) the area below the hat is finite. * * (5) it is easy to generate from the hat distribution. * * * * We use a family T_c(x) of distribution defined by (see [1]): * * * * c | T_c(x) * * ---------+--------------- * * 0 | log(x) * * -1/2 | -1/sqrt(x) * * -1 * * .** / **. * * * / *... * * * / * .... * * construction * / squeeze * ... * * point X * ... * * * * .... * * * * ... * * * * .. * * . . * * .* * * * .* * * * . * * . * * * * . * * * * . * * . * transformed PDF * * * transformed . * * hat . * * * * . * * . * * * * . * * . * * * * . * * . * * * * . * * * * * * * * * * * * * * * * * * * *...........................................................................* * * * figure 2: density with hat and squeeze * * T(x) = log(x) * * PDF(x) = exp(-x^2) * * * * .. * * . . * * . . * * . . * * . ***. * * . ** ** * * . * X * * .* /|* * * .* / |* . * * .* / | * . * * .* / | * . * * * / | * .. * * * / | * . * * * / | * .. * * * /squeeze | * . * * construction * / | * .. * * point --- X/ | * .. * * *| | * .. * * *| | * .. * * * | | * .. * * * | | * ... * * * | | * .. * * .* | | * * * .* | | * * * .* | | * * * . * | | * * * . * | | * * * hat .. * | | * * * . * | | * * * .. * PDF | | * * * ... * | | * * * ... ** | | ** * * . ** | | ** * * **** | | **** * * --**--------+---------X---------+---X-----+---------+--------**---> * * -3 -2 -1 0 1 2 3 * * * * * *...........................................................................* * * * To generate from the hat distribution we have to partition the domain * * of the PDF by means of the construction points of the tangents into * * several intervals. Each interval has to be divided into two parts * * according to the tangent line that defines the hat function. * * Although the interval can be divided at any point in the interval, * * the best possible splitting point obviously is the intersection point * * of respective the tangents at the left and right construction point of * * the interval. However there are two cases when this choice is not * * appropriate: (1) The computation of this point is unstable. Then we use * * the mean point of the interval. (2) One of the two construction points * * is very much greater (or smaller) than the other one. Since we generate * * points by adding or subtracting a random number to the construction * * point, it then happens, that we have the difference of two large numbers, * * which results in serious roundoff error. Then it is better to choose the * * intersection point such that we have only one interval with the point * * nearer to the origin as the only construction point. * * (This procedure is a little bit different from [1] or [3], but the author * * of this program finds the implemented version more convenient.) Then we * * have to compute the area below the hat for each of the two parts of the * * interval i (A_l^i for the left hand part, A_r^i for the right hand part) * * for each interval. Then we have to sample from a discrete random variate * * with probability vector proportional to (A_l^0,A_r^0; A_l^1,A_r^1; ...; * * A_l^n,A_r^n) to get one of the intervals. We use indexed search (or * * guide tables) to perform this task ([2], see also description of DIS). * * Then we can sample from the hat distribution in this part of the * * interval by inversion. Notice that we can use reuse the uniform random * * number from the first step (i.e., sampling an interval) for this second * * step without danger. The whole generation can be seen as inversion from * * the hat distribution. * * * *...........................................................................* * * * Algorithm TDR * * * * [Required] * * PDF f(x), transformation T(x), construction points c_1,...,c_n * * * * [Setup] * * 1: Construct hat h(x) and squeeze s(x). * * 2: Foreach Interval (c_i,c_{i+1}) Do * * 3: Compute areas A_l^i, A_r^i, A_squeeze. * * * * [Generate] * * 4: Generate I proportional to (A_l^1,A_r^1; ...). * * 5: Generate X with PDF proportional to h|I. * * 6: Generate U ~ U(0,1). * * 7: If U * h(x) <= min(f(c_i),f(c_{i+1})) Return X. * * 8: If U * h(x) <= s(X) Return X. * * 9: If U * h(x) <= f(X) Return X. * * 10: Goto 4. * * * *...........................................................................* * * * There are several alternatives for the choice of the construction points * * * * (1) Adaptive rejection sampling: * * Use two points on both sides of the mode of the PDF (provided * * that the hat has finite area). * * Whenever the PDF has to be evaluated in step 8, add a new * * construction point at X. * * * * (2) Optimal construction points: * * [5] have show an asymptotic formula for optimal construction points, * * i.e., with minimiza the ration Ahat/Asqueeze for a given number of * * points. Although this formula is only valid for infinitely many * * construction points, it works very well even for 3 or 4 points. * * * * [1] gives a formula for three optimal construction points. * * * * (3) Empirical formulas: * * [6] uses points c_i, such that arctan(c_i) are equidistributed. * * ("equiangular rule"). * * In most cases it has turned out as an acceptable good choice. * * (We made one change to [6]: If the mode is known, all points are * * moved, such the mode becomes the center of these points.) * * * * This implementation uses (3) to get good points for the start and adds * * additional construction points by means of method (1). * * (The number of starting points and the maximum number of points can * * be set for each generator.) * * * *...........................................................................* * * * Implementation details: * * * * (1) If possible the boundary points of the domain are used as * * construction points. (So do not include these in a list of starting * * points.) As a consequence 0 starting points are allowed. * * * * (2) To make use of the automatic generation of starting points call * * `unur_set_cpoints() with the NULL pointer as the last argument * * and the number of construction points (besides the boundary points * * and the mode) as its third argument. * * * * (3) If the mode is given, we use a tangent with slope 0 at this point; * * even when this does not result in the best possible hat (e.g. for * * the exponential distribution). * * * * (4) Starting points and the mode outside the domain are ignored. * * * * (5) If the given starting points does not result in a hat with finite * * area, the program tries to find some proper additional construction * * points by splitting interval with infinite area. (Here we use the * * "equiangular rule" again.) * * * * (6) The use of the additional "fast" squeeze in step 7 is due to a * * suggestion of G. Derflinger. It speeds up the generation about 20 % * * when many construction points are used. * * * ***************************************************************************** ***************************************************************************** * Variant PS (Proportional Squeezes) * ***************************************************************************** * * * The original algorithm can be modified in the following way: * * Use squeezes that are proportional to the hat function in each of the * * intervals. This decreases the marginal generation times; * * see [7] for details. * * * * Technical remarks: * * The boundary points of the intervals are now the intersection points * * of the tangents to the transformed density. However we have used the * * same structure for an interval as in variant GW. To have a similar * * code we have stored the left boundary of an interval together with the * * construction point. Thus the right boundary point is stored in the * * interval structure in the list of intervals. * * We also have added an empty interval structure in this list that just * * marks the right boundary of the domain of the PDF. * * * ***************************************************************************** ***************************************************************************** * Variant IA (Immedate Acceptance) * ***************************************************************************** * * * IA is a composition method that uses squeezes that are proportional to * * the hat function in each of the intervals (as in PS). We immediately * * accept all points below the squeeze and use an acceptance/rejection * * technique only we fall in the region between hat and squeeze. It works * * very well since it is easy to generate points in this region (in * * opposition to variant GW). * * * * For technical details see variant PS. * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include "unur_methods_source.h" #include "x_gen_source.h" #include "tdr.h" #include "tdr_struct.h" /*---------------------------------------------------------------------------*/ /* Constants */ /*---------------------------------------------------------------------------*/ /* Variants */ #define TDR_VARMASK_T 0x000fu /* indicates transformation */ #define TDR_VAR_T_SQRT 0x0001u /* T(x) = -1/sqrt(x) */ #define TDR_VAR_T_LOG 0x0002u /* T(x) = log(x) */ #define TDR_VAR_T_POW 0x0003u /* T(x) = -x^c */ #define TDR_VARMASK_VARIANT 0x00f0u /* indicates which variant */ #define TDR_VARIANT_GW 0x0010u /* original variant (Gilks&Wild) */ #define TDR_VARIANT_PS 0x0020u /* use proportional squeeze */ #define TDR_VARIANT_IA 0x0030u /* use immediate acceptance (requires prop. squeeze) */ #define TDR_VARFLAG_VERIFY 0x0100u /* flag for verifying mode */ #define TDR_VARFLAG_USECENTER 0x0200u /* whether center is used as cpoint or not */ #define TDR_VARFLAG_USEMODE 0x0400u /* whether mode is used as cpoint or not */ #define TDR_VARFLAG_PEDANTIC 0x0800u /* whether pedantic checking is used */ #define TDR_VARFLAG_USEDARS 0x1000u /* whether DARS is used in setup or not */ /*---------------------------------------------------------------------------*/ /* Debugging flags */ /* bit 01 ... pameters and structure of generator (do not use here) */ /* bits 02-12 ... setup */ /* bits 13-24 ... adaptive steps */ /* bits 25-32 ... trace sampling */ #define TDR_DEBUG_IV 0x00000010u #define TDR_DEBUG_SPLIT 0x00010000u #define TDR_DEBUG_DARS 0x00020000u #define TDR_DEBUG_SAMPLE 0x01000000u #define TDR_DEBUG_REINIT 0x00000020u /* print parameters after reinit */ /*---------------------------------------------------------------------------*/ /* Flags for logging set calls */ #define TDR_SET_CENTER 0x1000u #define TDR_SET_STP 0x0001u #define TDR_SET_N_STP 0x0002u #define TDR_SET_PERCENTILES 0x0004u #define TDR_SET_N_PERCENTILES 0x0008u #define TDR_SET_RETRY_NCPOINTS 0x0010u #define TDR_SET_GUIDEFACTOR 0x0020u #define TDR_SET_C 0x0040u #define TDR_SET_MAX_SQHRATIO 0x0080u #define TDR_SET_MAX_IVS 0x0100u #define TDR_SET_USE_DARS 0x0200u #define TDR_SET_DARS_FACTOR 0x0400u /*---------------------------------------------------------------------------*/ #define GENTYPE "TDR" /* type of generator */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_tdr_init( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* Initialize new generator. */ /*---------------------------------------------------------------------------*/ static int _unur_tdr_reinit( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Reinitialize generator. */ /*---------------------------------------------------------------------------*/ static int _unur_tdr_make_gen( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Make generator object. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_tdr_create( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* create new (almost empty) generator object. */ /*---------------------------------------------------------------------------*/ static double _unur_tdr_gw_sample( struct unur_gen *generator ); static double _unur_tdr_gw_sample_check( struct unur_gen *generator ); static double _unur_tdr_ps_sample( struct unur_gen *generator ); static double _unur_tdr_ps_sample_check( struct unur_gen *generator ); static double _unur_tdr_ia_sample( struct unur_gen *generator ); static double _unur_tdr_ia_sample_check( struct unur_gen *generator ); /*---------------------------------------------------------------------------*/ /* sample from generator */ /*---------------------------------------------------------------------------*/ static double _unur_tdr_gw_eval_invcdfhat( const struct unur_gen *generator, double u, double *hx, double *fx, double *sqx, struct unur_tdr_interval **iv, struct unur_tdr_interval **cpt ); static double _unur_tdr_ps_eval_invcdfhat( const struct unur_gen *generator, double u, double *hx, double *fx, double *sqx, struct unur_tdr_interval **iv ); /*---------------------------------------------------------------------------*/ /* auxiliary routines to evaluate the inverse of the hat CDF. */ /*---------------------------------------------------------------------------*/ static void _unur_tdr_free( struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* destroy generator object. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_tdr_clone( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* copy (clone) generator object. */ /*---------------------------------------------------------------------------*/ static int _unur_tdr_starting_cpoints( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* create list of construction points for starting segments. */ /* if user has not provided such points compute these by means of the */ /* "equi-angle rule". */ /*---------------------------------------------------------------------------*/ static int _unur_tdr_starting_intervals( struct unur_gen *gen ); static int _unur_tdr_gw_starting_intervals( struct unur_gen *gen ); static int _unur_tdr_ps_starting_intervals( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* compute intervals from given starting construction points. */ /*---------------------------------------------------------------------------*/ static int _unur_tdr_run_dars( struct unur_gen *gen ); static int _unur_tdr_gw_dars( struct unur_gen *gen ); static int _unur_tdr_ps_dars( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* run derandomized adaptive rejection sampling. */ /*---------------------------------------------------------------------------*/ static int _unur_tdr_gw_interval_parameter( struct unur_gen *gen, struct unur_tdr_interval *iv ); static int _unur_tdr_ps_interval_parameter( struct unur_gen *gen, struct unur_tdr_interval *iv ); /*---------------------------------------------------------------------------*/ /* compute all necessary data for interval. */ /*---------------------------------------------------------------------------*/ static struct unur_tdr_interval *_unur_tdr_interval_new( struct unur_gen *gen, double x, double fx, int is_mode ); /*---------------------------------------------------------------------------*/ /* make a new segment with left construction point x. */ /*---------------------------------------------------------------------------*/ static int _unur_tdr_tangent_intersection_point( struct unur_gen *gen, struct unur_tdr_interval *iv, double *ipt ); /*---------------------------------------------------------------------------*/ /* compute cutting point of interval into left and right part. */ /*---------------------------------------------------------------------------*/ static double _unur_tdr_interval_area( struct unur_gen *gen, struct unur_tdr_interval *iv, double slope, double x ); /*---------------------------------------------------------------------------*/ /* compute area below piece of hat or squeeze in interval. */ /*---------------------------------------------------------------------------*/ static double _unur_tdr_interval_xxarea( struct unur_gen *gen, struct unur_tdr_interval *iv, double slope, double x ); /*---------------------------------------------------------------------------*/ /* compute the interal of x times hat or squeeze ("expected value"). */ /*---------------------------------------------------------------------------*/ static double _unur_tdr_eval_intervalhat( struct unur_gen *gen, struct unur_tdr_interval *iv, double x ); /*---------------------------------------------------------------------------*/ /* evaluate hat at x in interval. */ /*---------------------------------------------------------------------------*/ static double _unur_tdr_eval_cdfhat( struct unur_gen *gen, double x ); /*---------------------------------------------------------------------------*/ /* evaluate CDF of hat at x. */ /*---------------------------------------------------------------------------*/ static int _unur_tdr_gw_interval_split( struct unur_gen *gen, struct unur_tdr_interval *iv_old, double x, double fx ); static int _unur_tdr_ps_interval_split( struct unur_gen *gen, struct unur_tdr_interval *iv_old, double x, double fx ); /*---------------------------------------------------------------------------*/ /* split am interval point x. return 0 if not successful. */ /*---------------------------------------------------------------------------*/ static int _unur_tdr_gw_improve_hat( struct unur_gen *gen, struct unur_tdr_interval *iv, double x, double fx); static int _unur_tdr_ps_improve_hat( struct unur_gen *gen, struct unur_tdr_interval *iv, double x, double fx); /*---------------------------------------------------------------------------*/ /* improve hat function by splitting interval */ /*---------------------------------------------------------------------------*/ static int _unur_tdr_make_guide_table( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* make a guide table for indexed search. */ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ /* the following functions print debugging information on output stream, */ /* i.e., into the LOG file if not specified otherwise. */ /*---------------------------------------------------------------------------*/ static void _unur_tdr_debug_init_start( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print after (almost empty generator) object has been created. */ /*---------------------------------------------------------------------------*/ static void _unur_tdr_debug_init_finished( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print after generator has been initialized has completed. */ /*---------------------------------------------------------------------------*/ static void _unur_tdr_debug_dars_start( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print header before runniung derandomized adaptive rejection sampling. */ /*---------------------------------------------------------------------------*/ static void _unur_tdr_debug_dars_finished( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print after generator has run derandomized adaptive rejection sampling. */ /*---------------------------------------------------------------------------*/ static void _unur_tdr_debug_reinit_start( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print before reinitialization of generator starts. */ /*---------------------------------------------------------------------------*/ static void _unur_tdr_debug_reinit_retry( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print before second trial of reinitialization of generator starts. */ /*---------------------------------------------------------------------------*/ static void _unur_tdr_debug_reinit_finished( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print after generator has been reinitialized. */ /*---------------------------------------------------------------------------*/ static void _unur_tdr_debug_free( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print before generater is destroyed. */ /*---------------------------------------------------------------------------*/ static void _unur_tdr_debug_intervals( const struct unur_gen *gen, const char *header, int print_areas ); static void _unur_tdr_gw_debug_intervals( const struct unur_gen *gen, int print_areas ); static void _unur_tdr_ps_debug_intervals( const struct unur_gen *gen, int print_areas ); /*---------------------------------------------------------------------------*/ /* print data for intervals */ /*---------------------------------------------------------------------------*/ static void _unur_tdr_gw_debug_sample( const struct unur_gen *gen, const struct unur_tdr_interval *iv, const struct unur_tdr_interval *pt, double x, double fx, double hx, double sqx ); static void _unur_tdr_ps_debug_sample( const struct unur_gen *gen, const struct unur_tdr_interval *iv, double x, double fx, double hx, double sqx ); /*---------------------------------------------------------------------------*/ /* print data while sampling from generators. */ /*---------------------------------------------------------------------------*/ static void _unur_tdr_gw_debug_split_start( const struct unur_gen *gen, const struct unur_tdr_interval *iv, double x, double fx ); static void _unur_tdr_gw_debug_split_stop( const struct unur_gen *gen, const struct unur_tdr_interval *iv_left, const struct unur_tdr_interval *iv_right ); static void _unur_tdr_ps_debug_split_start( const struct unur_gen *gen, const struct unur_tdr_interval *iv_left, const struct unur_tdr_interval *iv_right, double x, double fx ); static void _unur_tdr_ps_debug_split_stop( const struct unur_gen *gen, const struct unur_tdr_interval *iv_left, const struct unur_tdr_interval *iv_middle, const struct unur_tdr_interval *iv_right ); /*---------------------------------------------------------------------------*/ /* print before and after an interval has been split (not / successfully). */ /*---------------------------------------------------------------------------*/ #endif #ifdef UNUR_ENABLE_INFO static void _unur_tdr_info( struct unur_gen *gen, int help ); /*---------------------------------------------------------------------------*/ /* create info string. */ /*---------------------------------------------------------------------------*/ #endif /*---------------------------------------------------------------------------*/ /* abbreviations */ #define DISTR_IN distr->data.cont /* data for distribution object */ #define PAR ((struct unur_tdr_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_tdr_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.cont /* data for distribution in generator object */ #define BD_LEFT domain[0] /* left boundary of domain of distribution */ #define BD_RIGHT domain[1] /* right boundary of domain of distribution */ #define SAMPLE gen->sample.cont /* pointer to sampling routine */ #define PDF(x) _unur_cont_PDF((x),(gen->distr)) /* call to PDF */ #define dPDF(x) _unur_cont_dPDF((x),(gen->distr)) /* call to derivative of PDF */ #define logPDF(x) _unur_cont_logPDF((x),(gen->distr)) /* call to logPDF */ #define dlogPDF(x) _unur_cont_dlogPDF((x),(gen->distr)) /* call to derivative of log PDF */ /*---------------------------------------------------------------------------*/ static UNUR_SAMPLING_ROUTINE_CONT * _unur_tdr_getSAMPLE( struct unur_gen *gen ) { switch (gen->variant & TDR_VARMASK_VARIANT) { case TDR_VARIANT_GW: /* original variant (Gilks&Wild) */ return (gen->variant & TDR_VARFLAG_VERIFY) ? _unur_tdr_gw_sample_check : _unur_tdr_gw_sample; case TDR_VARIANT_IA: /* immediate acceptance */ return (gen->variant & TDR_VARFLAG_VERIFY) ? _unur_tdr_ia_sample_check : _unur_tdr_ia_sample; case TDR_VARIANT_PS: /* proportional squeeze */ default: return (gen->variant & TDR_VARFLAG_VERIFY) ? _unur_tdr_ps_sample_check : _unur_tdr_ps_sample; } } /* end of _unur_tdr_getSAMPLE() */ /*---------------------------------------------------------------------------*/ /* since there is only file scope or program code, we abuse the */ /* #include directive. */ /** Public: User Interface (API) **/ #include "tdr_newset.ch" /** Private **/ #include "tdr_init.ch" #include "tdr_sample.ch" #include "tdr_debug.ch" #include "tdr_info.ch" /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/deprecated_methods.h0000644001357500135600000005055214420445767016307 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: deprecated_methods.h * * * * PURPOSE: * * function prototypes and macros for deprecated routines * * * ***************************************************************************** * * * THESE ROUTINES SHOULD NOT BE USED ANY MORE! * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifndef UNUR_DEPRECATED_METHODS_H_SEEN #define UNUR_DEPRECATED_METHODS_H_SEEN /*---------------------------------------------------------------------------*/ int unur_cstd_chg_pdfparams( UNUR_GEN *generator, double *params, int n_params ); /* Change array of parameters of the distribution in a given generator object. If the given parameters are invalid for the distribution, no parameters are set. Notice that optional parameters are (re-)set to their default values if not given for UNURAN standard distributions. */ /*---------------------------------------------------------------------------*/ int unur_dari_reinit( UNUR_GEN *generator ); /* Update an existing generator object after the distribution has been modified. It must be executed whenever the parameters or the domain of the distributions has been changed (see below). It is faster than destroying the existing object and building a new one from scratch. If reinitialization has been successful @code{UNUR_SUCCESS} is returned, in case of a failure an error code is returned. */ int unur_dari_chg_pmfparams( UNUR_GEN *generator, double *params, int n_params ); /* Change array of parameters of the distribution in a given generator object. Notice that this call simply copies the parameters into the generator object. Thus if fewer parameters are provided then the remaining parameters are left unchanged. unur_dari_reinit() must be executed before sampling from the generator again. @emph{Important:} The given parameters are not checked against domain errors; in opposition to the @command{unur__new} calls. */ int unur_dari_chg_domain( UNUR_GEN *generator, int left, int right ); /* Change the left and right border of the domain of the (truncated) distribution. If the mode changes when the domain of the (truncated) distribution is changed, then a correspondig unur_dari_chg_mode() call is required. (There is no domain checking as in the unur_init() call.) Use @code{INT_MIN} and @code{INT_MAX} for (minus) infinity. unur_dari_reinit() must be executed before sampling from the generator again. */ int unur_dari_chg_mode( UNUR_GEN *generator, int mode ); /* Change mode of distribution. unur_dari_reinit() must be executed before sampling from the generator again. */ int unur_dari_upd_mode( UNUR_GEN *generator ); /* Recompute the mode of the distribution. This call only works well when a distribution object from the UNURAN library of standard distributions is used (@pxref{Stddist,,Standard distributions}). Otherwise a (slow) numerical mode finder is called. If no mode can be found, then an error code is returnded and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. unur_dari_reinit() must be executed before sampling from the generator again. */ int unur_dari_chg_pmfsum( UNUR_GEN *generator, double sum ); /* Change sum over the PMF of distribution. unur_dari_reinit() must be executed before sampling from the generator again. */ int unur_dari_upd_pmfsum( UNUR_GEN *generator ); /* Recompute sum over the PMF of the distribution. It only works when a distribution objects from the UNURAN library of standard distributions is used (@pxref{Stddist,,Standard distributions}). Otherwise an error code is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. unur_dari_reinit() must be executed before sampling from the generator again. */ /*---------------------------------------------------------------------------*/ int unur_dsrou_reinit( UNUR_GEN *generator ); /* Update an existing generator object after the distribution has been modified. It must be executed whenever the parameters or the domain of the distribution have been changed (see below). It is faster than destroying the existing object and building a new one from scratch. If reinitialization has been successful @code{UNUR_SUCCESS} is returned, in case of a failure an error code is returned. */ int unur_dsrou_chg_pmfparams( UNUR_GEN *generator, double *params, int n_params ); /* Change array of parameters of the distribution in a given generator object. For standard distributions from the UNURAN library the parameters are checked. It these are invalid, then an error code is returned. Moreover the domain is updated automatically unless it has been changed before by a unur_distr_discr_set_domain() call. Notice that optional parameters are (re-)set to their default values if not given for UNURAN standard distributions. For other distributions @var{params} is simply copied into to distribution object. It is only checked that @var{n_params} does not exceed the maximum number of parameters allowed. Then an error code is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_NPARAMS}. */ int unur_dsrou_chg_domain( UNUR_GEN *generator, int left, int right ); /* Change left and right border of the domain of the (truncated) distribution. If the mode changes when the domain of the (truncated) distribution is changed, then a correspondig unur_dsrou_chg_mode() is required. (There is no checking whether the domain is set or not as in the unur_init() call.) */ int unur_dsrou_chg_mode( UNUR_GEN *generator, int mode ); /* Change mode of distribution. unur_dsrou_reinit() must be executed before sampling from the generator again. */ int unur_dsrou_upd_mode( UNUR_GEN *generator ); /* Recompute the mode of the distribution. See unur_distr_cont_upd_mode() for more details. unur_dsrou_reinit() must be executed before sampling from the generator again. */ int unur_dsrou_chg_pmfsum( UNUR_GEN *generator, double sum ); /* Change sum over PMF of distribution. unur_dsrou_reinit() must be executed before sampling from the generator again. */ int unur_dsrou_upd_pmfsum( UNUR_GEN *generator ); /* Recompute the sum over the the PMF of the distribution. It only works when a distribution objects from the UNURAN library of standard distributions is used (@pxref{Stddist,,Standard distributions}). Otherwise @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. unur_dsrou_reinit() must be executed before sampling from the generator again. */ /*---------------------------------------------------------------------------*/ int unur_dstd_chg_pmfparams( UNUR_GEN *gen, double *params, int n_params ); /* Change array of parameters of the distribution in a given generator object. If the given parameters are invalid for the distribution, no parameters are set. Notice that optional parameters are (re-)set to their default values if not given for UNURAN standard distributions. @emph{Important:} Integer parameter must be given as doubles. */ /*---------------------------------------------------------------------------*/ int unur_ninv_chg_pdfparams(UNUR_GEN *generator, double *params, int n_params); /* Change array of parameters of the distribution in a given generator object. For standard distributions from the UNURAN library the parameters are checked. It these are invalid, then an error code is returned. Moreover the domain is updated automatically unless it has been changed before by a unur_distr_discr_set_domain() call. Notice that optional parameters are (re-)set to their default values if not given for UNURAN standard distributions. For other distributions @var{params} is simply copied into to distribution object. It is only checked that @var{n_params} does not exceed the maximum number of parameters allowed. Then an error code is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_NPARAMS}. */ /*---------------------------------------------------------------------------*/ int unur_srou_reinit( UNUR_GEN *generator ); /* Update an existing generator object after the distribution has been modified. It must be executed whenever the parameters or the domain of the distributions have been changed (see below). It is faster than destroying the existing object and building a new one from scratch. If reinitialization has been successful @code{UNUR_SUCCESS} is returned, in case of a failure an error code is returned. */ int unur_srou_chg_pdfparams( UNUR_GEN *generator, double *params, int n_params ); /* Change array of parameters of the distribution in a given generator object. For standard distributions from the UNURAN library the parameters are checked. It these are invalid, then an error code is returned. Moreover the domain is updated automatically unless it has been changed before by a unur_distr_discr_set_domain() call. Notice that optional parameters are (re-)set to their default values if not given for UNURAN standard distributions. For other distributions @var{params} is simply copied into to distribution object. It is only checked that @var{n_params} does not exceed the maximum number of parameters allowed. Then an error code is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_NPARAMS}. */ int unur_srou_chg_domain( UNUR_GEN *generator, double left, double right ); /* Change left and right border of the domain of the (truncated) distribution. If the mode changes when the domain of the (truncated) distribution is changed, then a correspondig unur_srou_chg_mode() is required. (There is no checking whether the domain is set or not as in the unur_init() call.) */ int unur_srou_chg_mode( UNUR_GEN *generator, double mode ); /* Change mode of distribution. unur_srou_reinit() must be executed before sampling from the generator again. */ int unur_srou_upd_mode( UNUR_GEN *generator ); /* Recompute the mode of the distribution. See unur_distr_cont_upd_mode() for more details. unur_srou_reinit() must be executed before sampling from the generator again. */ int unur_srou_chg_pdfarea( UNUR_GEN *generator, double area ); /* Change area below PDF of distribution. unur_srou_reinit() must be executed before sampling from the generator again. */ int unur_srou_upd_pdfarea( UNUR_GEN *generator ); /* Recompute the area below the PDF of the distribution. It only works when a distribution objects from the UNURAN library of standard distributions is used (@pxref{Stddist,,Standard distributions}). Otherwise @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. unur_srou_reinit() must be executed before sampling from the generator again. */ /*---------------------------------------------------------------------------*/ int unur_ssr_reinit( UNUR_GEN *generator ); /* Update an existing generator object after the distribution has been modified. It must be executed whenever the parameters or the domain of the distribution has been changed (see below). It is faster than destroying the existing object and build a new one from scratch. If reinitialization has been successful @code{UNUR_SUCCESS} is returned, in case of a failure an error code is returned. */ int unur_ssr_chg_pdfparams( UNUR_GEN *generator, double *params, int n_params ); /* Change array of parameters of the distribution in a given generator object. For standard distributions from the UNURAN library the parameters are checked. It these are invalid, then an error code is returned. Moreover the domain is updated automatically unless it has been changed before by a unur_distr_discr_set_domain() call. Notice that optional parameters are (re-)set to their default values if not given for UNURAN standard distributions. For other distributions @var{params} is simply copied into to distribution object. It is only checked that @var{n_params} does not exceed the maximum number of parameters allowed. Then an error code is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_NPARAMS}. */ int unur_ssr_chg_domain( UNUR_GEN *generator, double left, double right ); /* Change left and right border of the domain of the distribution. If the mode changes when the domain of the distribution is changed, then a correspondig unur_ssr_chg_mode() is required. (There is no domain checking as in the unur_init() call.) */ int unur_ssr_chg_mode( UNUR_GEN *generator, double mode ); /* Change mode of distribution. unur_ssr_reinit() must be executed before sampling from the generator again. */ int unur_ssr_upd_mode( UNUR_GEN *generator ); /* Recompute the mode of the distribution. See unur_distr_cont_upd_mode() for more details. unur_ssr_reinit() must be executed before sampling from the generator again. */ int unur_ssr_chg_pdfarea( UNUR_GEN *generator, double area ); /* Change area below PDF of distribution. unur_ssr_reinit() must be executed before sampling from the generator again. */ int unur_ssr_upd_pdfarea( UNUR_GEN *generator ); /* Recompute the area below the PDF of the distribution. It only works when a distribution objects from the UNURAN library of standard distributions is used (@pxref{Stddist,,Standard distributions}). Otherwise @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. unur_ssr_reinit() must be executed before sampling from the generator again. */ /*---------------------------------------------------------------------------*/ int unur_tdr_reinit( UNUR_GEN *generator ); /* Update an existing generator object after the distribution has been modified. It must be executed whenever the parameters of the distribution has been changed. It is faster than destroying the existing object and build a new one from scratch. If reinitialization has been successful @code{UNUR_SUCCESS} is returned. In case of a failure an error code is returned. Then @var{generator} cannot be used before another successful reinit (with proper parameters for the underlying distribution). */ /*---------------------------------------------------------------------------*/ int unur_tdrgw_reinit( UNUR_GEN *generator ); /* Update an existing generator object after the distribution has been modified. It must be executed whenever the parameters of the distribution has been changed. It is faster than destroying the existing object and build a new one from scratch. If reinitialization has been successful @code{UNUR_SUCCESS} is returned. In case of a failure an error code is returned. Then @var{generator} cannot be used before another successful reinit (with proper parameters for the underlying distribution). */ /*---------------------------------------------------------------------------*/ int unur_utdr_reinit( UNUR_GEN *generator ); /* Update an existing generator object after the distribution has been modified. It must be executed whenever the parameters or the domain of the distributions has been changed (see below). It is faster than destroying the existing object and building a new one from scratch. If reinitialization has been successful @code{UNUR_SUCCESS} is returned, in case of a failure an error code is returned. @emph{Important:} Do not use the @var{generator} object for sampling after a failed reinit, since otherwise it may produce garbage. */ int unur_utdr_chg_pdfparams( UNUR_GEN *generator, double *params, int n_params ); /* Change array of parameters of the distribution in a given generator object. For standard distributions from the UNURAN library the parameters are checked. It these are invalid, then an error code is returned. Moreover the domain is updated automatically unless it has been changed before by a unur_distr_discr_set_domain() call. Notice that optional parameters are (re-)set to their default values if not given for UNURAN standard distributions. For other distributions @var{params} is simply copied into to distribution object. It is only checked that @var{n_params} does not exceed the maximum number of parameters allowed. Then an error code is returned and @code{unur_errno} is set to @code{UNUR_ERR_DISTR_NPARAMS}. */ int unur_utdr_chg_domain( UNUR_GEN *generator, double left, double right ); /* Change left and right border of the domain of the (truncated) distribution. If the mode changes when the domain of the (truncated) distribution is changed, then a correspondig unur_utdr_chg_mode() is required. (There is no domain checking as in the unur_init() call.) */ int unur_utdr_chg_mode( UNUR_GEN *generator, double mode ); /* Change mode of distribution. unur_utdr_reinit() must be executed before sampling from the generator again. */ int unur_utdr_upd_mode( UNUR_GEN *generator ); /* Recompute the mode of the distribution. See unur_distr_cont_upd_mode() for more details. unur_srou_reinit() must be executed before sampling from the generator again. */ int unur_utdr_chg_pdfarea( UNUR_GEN *generator, double area ); /* Change area below PDF of distribution. unur_utdr_reinit() must be executed before sampling from the generator again. */ int unur_utdr_upd_pdfarea( UNUR_GEN *generator ); /* Recompute the area below the PDF of the distribution. It only works when a distribution objects from the UNURAN library of standard distributions is used (@pxref{Stddist,,Standard distributions}). Otherwise @code{unur_errno} is set to @code{UNUR_ERR_DISTR_DATA}. unur_srou_reinit() must be executed before sampling from the generator again. */ /*---------------------------------------------------------------------------*/ #endif /* UNUR_DEPRECATED_METHODS_H_SEEN */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/hrd_struct.h0000644001357500135600000000627614420304141014625 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: hrd_struct.h * * * * PURPOSE: * * declares structures for method HRD * * (Hazard Rate Decreasing) * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Information for constructing the generator */ struct unur_hrd_par { int dummy; }; /*---------------------------------------------------------------------------*/ /* The generator object */ struct unur_hrd_gen { double upper_bound; /* upper bound for hazard rate */ double left_border; /* left border of domain */ }; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/x_gen.h0000644001357500135600000003040214420445767013554 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: x_gen.h * * * * PURPOSE: * * defines macros and function prototypes for handling * * generator objects. * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /* =NODE Methods_all Routines for all generator objects =UP Methods [0] =DESCRIPTION Routines for all generator objects. =END */ /*---------------------------------------------------------------------------*/ /* (Re-) Initialize generators */ /* =ROUTINES */ UNUR_GEN *unur_init( UNUR_PAR *parameters ); /* Initialize a generator object. All necessary information must be stored in the parameter object. @strong{Important:} If an error has occurred a NULL pointer is return. This must not be used for the sampling routines (this causes a segmentation fault). @strong{Always} check whether the call was successful or not! @emph{Important:} This call destroys the @var{parameter} object automatically. Thus it is not necessary/allowed to free it. */ /*...........................................................................*/ int unur_reinit( UNUR_GEN *generator ); /* Update an existing generator object after the underlying distribution has been modified (using unur_get_distr() together with corresponding set calls. It @strong{must} be executed before sampling using this generator object is continued as otherwise it produces an invalid sample or might even cause a segmentation fault. @emph{Important}: Currently not all methods allow reinitialization, see the description of the particular method (keyword @i{Reinit}). @emph{Important}: Reinitialization of the generator object might fail. Thus one @strong{must} check the return code: @table @asis @item @code{UNUR_SUCCESS (0x0u)} success (no error) @item @code{UNUR_ERR_NO_REINIT} reinit routine not implemented. @item other values some error has occured while trying to reinitialize the generator object. @end table @emph{Important}: When reinitialization fails then sampling routines always return @code{UNUR_INFINITY} (for continuous distributions) or @code{0} (for discrete distributions), respectively. However, it is still possible to change the underlying distribution and try to reinitialize again. @emph{Important}: When one tries to run unur_reinit(), but reinitialization is not implemented, then the generator object cannot be used any more and must be destroyed and a new one has to be built from scratch. */ /*---------------------------------------------------------------------------*/ /* Sample from generator */ int unur_sample_discr(UNUR_GEN *generator); /* */ double unur_sample_cont(UNUR_GEN *generator); /* */ int unur_sample_vec(UNUR_GEN *generator, double *vector); /* */ int unur_sample_matr(UNUR_GEN *generator, double *matrix); /* Sample from generator object. The three routines depend on the type of the generator object (discrete or continuous univariate distribution, multivariate distribution, or random matrix). @emph{Notice:} UNU.RAN uses arrays of @code{double}s to handle matrices. There the rows of the matrix are stored consecutively. @emph{Notice:} The routines unur_sample_vec() and unur_sample_matr() return @code{UNUR_SUCCESS} if generation was successful and some error code otherwise. @strong{Important:} These routines do @strong{not} check whether @var{generator} is an invalid NULL pointer. */ /*---------------------------------------------------------------------------*/ /* Estimate quantiles */ double unur_quantile ( UNUR_GEN *generator, double U ); /* Compute the @var{U} quantile of a continuous distribution using a @var{generator} object that implements an (approximate) inversion methods. The following methods are currently available: @itemize @item HINV, @pxref{HINV}. @item NINV, @pxref{NINV}. @item PINV, @pxref{PINV}. @item CSTD, @pxref{CSTD}. @* This requires that @var{generator} implements an inversion method. @item DGT, @pxref{DGT}. @* The return value is (of course) type casted to @code{double}. @end itemize @strong{Important:} This routine does @strong{not} check whether @var{generator} is an invalid NULL pointer. In case of an error UNUR_INFINITY or INT_MAX (depending on the type of @var{generator}) is returned. */ /*---------------------------------------------------------------------------*/ /* Destroy (free) generator object */ void unur_free( UNUR_GEN *generator ); /* Destroy (free) the given generator object. */ /*---------------------------------------------------------------------------*/ /* Get information about generator object */ const char *unur_gen_info( UNUR_GEN *generator, int help ); /* Get a string with informations about the given @var{generator}. These informations allow some fine tuning of the generation method. If @var{help} is TRUE, some hints on setting parameters are given. This function is intented for using in interactive environments (like @t{R}). If an error occurs, then NULL is returned. */ /*---------------------------------------------------------------------------*/ /* Get dimension of generator for (multivariate) distribution */ int unur_get_dimension( const UNUR_GEN *generator ); /* Get the number of dimension of a (multivariate) distribution. For a univariate distribution @code{1} is return. */ /*---------------------------------------------------------------------------*/ const char *unur_get_genid( const UNUR_GEN *generator ); /* Get identifier string for generator. */ /*---------------------------------------------------------------------------*/ unsigned int unur_get_method( const UNUR_GEN *generator ); /* Get identifier for generating method. These identifiers are declared in @file{src/methods/unur_metthods.h}. */ /*---------------------------------------------------------------------------*/ int unur_gen_is_inversion ( const UNUR_GEN *gen ); /* Return TRUE if the generator object implements an inversion method, and FALSE otherwise. */ /*---------------------------------------------------------------------------*/ UNUR_DISTR *unur_get_distr( const UNUR_GEN *generator ); /* Get pointer to distribution object from generator object. This function can be used to change the parameters of the distribution and reinitialize the generator object. Notice that currently @strong{not all} generating methods have a reinitialize routine. This function should be used with extreme care. Changing the distribution is changed and using the generator object without reinitializing might cause wrong samples or segmentation faults. Moreover, if the corresponding generator object is freed, the pointer must not be used. @strong{Important:} The returned distribution object must not be freed. If the distribution object is changed then one @strong{must} run unur_reinit()! */ /*---------------------------------------------------------------------------*/ int unur_set_use_distr_privatecopy( UNUR_PAR *parameters, int use_privatecopy ); /* Set flag whether the generator object should make a private copy of the given distribution object or just stores the pointer to this distribution object. Values for @var{use_privatecopy}: @table @code @item TRUE make a private copy (default) @item FALSE do not make a private copy and store pointer to given (external) distribution object. @end table By default, generator objects keep their own private copy of the given distribution object. Thus the generator object can be handled independently from other UNU.RAN objects (with uniform random number generators as the only exception). When the generator object is initialized the given distribution object is cloned and stored. However, in some rare situations it can be useful when only the pointer to the given distribution object is stored without making a private copy. A possible example is when only one random variate has to be drawn from the distribution. This behavior can be achieved when @var{use_localcopy} is set to FALSE. @strong{Warning!} Using a pointer to the external distribution object instead of a private copy must be done with @strong{extreme care}! When the distrubtion object is changed or freed then the generator object does not work any more, might case a segmentation fault, or (even worse) produces garbage. On the other hand, when the generator object is initialized or used to draw a random sampling the distribution object may be changed. @emph{Notice:} The prototypes of all @code{unur__new} calls use a @code{const} qualifier for the distribution argument. However, if @var{use_privatecopy} is set to FALSE this qualifier is discarded and the distribution might be changed. @strong{Important!} If @var{use_localcopy} is set to FALSE and the corresponding distribution object is changed then one must run unur_reinit() on the generator object. (Notice that currently not all generation methods support reinitialization.) Default: @var{use_privatecopy} is TRUE. */ /* =END */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ UNUR_GEN *unur_gen_clone( const UNUR_GEN *gen ); void unur_par_free( UNUR_PAR *par); /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/x_gen_source.h0000644001357500135600000001435114420445767015141 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: x_gen_source.h * * * * PURPOSE: * * defines macros and function prototypes for handling * * generator objects. * * * * USAGE: * * only included in source_unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Invoke generators (macros to avoid function calls) */ #define _unur_init(par) (par)->init(par) #define _unur_sample_discr(gen) (gen)->sample.discr(gen) #define _unur_sample_cont(gen) (gen)->sample.cont(gen) #define _unur_sample_vec(gen,vector) (gen)->sample.cvec(gen,vector) #define _unur_free(gen) do {if(gen) (gen)->destroy(gen);} while(0) /*---------------------------------------------------------------------------*/ /* get type of transformation method */ #define _unur_gen_is_discr(gen) ( ((gen)->distr->type == UNUR_DISTR_DISCR) ? 1 : 0 ) #define _unur_gen_is_cont(gen) ( ((gen)->distr->type == UNUR_DISTR_CONT) ? 1 : 0 ) #define _unur_gen_is_vec(gen) ( ((gen)->distr->type == UNUR_DISTR_CVEC) ? 1 : 0 ) /*---------------------------------------------------------------------------*/ /* aux routine when no sampling routine is available */ int _unur_sample_discr_error( struct unur_gen *gen ); double _unur_sample_cont_error( struct unur_gen *gen ); int _unur_sample_cvec_error( struct unur_gen *gen, double *vec ); int _unur_sample_matr_error( struct unur_gen *gen, double *mat ); /*---------------------------------------------------------------------------*/ /* create, copy and free parameter object */ /* create an empty parameter object with data structure of size 's' */ struct unur_par *_unur_par_new( size_t s ); struct unur_par *_unur_par_clone( const struct unur_par *par ); /* free memory allocated by parameter obejct */ #define _unur_par_free(par) do {free((par)->datap); free(par);} while(0) /*---------------------------------------------------------------------------*/ /* create (new) generic generator object */ struct unur_gen *_unur_generic_create( struct unur_par *par, size_t s ); /*---------------------------------------------------------------------------*/ /* copy (clone) generator objects */ struct unur_gen *_unur_generic_clone( const struct unur_gen *gen, const char *type ); #define _unur_gen_clone(gen) ((gen)->clone(gen)) /*---------------------------------------------------------------------------*/ /* free generic generator object */ void _unur_generic_free( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* set and clone arrays of generator objects */ struct unur_gen **_unur_gen_list_set( struct unur_gen *gen, int n_gen_list ); /* set all entries in list to same generator object */ /* IMPORTANT: Be careful when using this call. When the resulting array */ /* is stored in some multivariate generator object then 'gen' _must not_ */ /* be used any more after this call! */ struct unur_gen **_unur_gen_list_clone( struct unur_gen **gen_list, int n_gen_list ); /* clone list of generator objects */ void _unur_gen_list_free( struct unur_gen **gen_list, int n_gen_list ); /* free list of generator objects */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/vnrou.h0000644001357500135600000002515414420445767013635 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: vnrou.h * * * * PURPOSE: * * function prototypes for method VNROU * * (Vector Naive Ratio-Of-Uniforms method) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /* =METHOD VNROU Multivariate Naive Ratio-Of-Uniforms method =UP Methods_for_CVEC =REQUIRED PDF =OPTIONAL mode, center, bounding rectangle for acceptance region =SPEED Set-up: fast or slow, Sampling: slow =REINIT supported =REF [WGS91] =DESCRIPTION VNROU is an implementation of the multivariate ratio-of-uniforms method which uses a (minimal) bounding hyper-rectangle, see also @ref{Ratio-of-Uniforms}. It uses an additional parameter @i{r} that can be used for adjusting the algorithm to the given distribution to improve performance and/or to make this method applicable. Larger values of @i{r} increase the class of distributions for which the method works at the expense of higher rejection constants. Moreover, this implementation uses the center @unurmath{\mu} of the distribution (which is set to the mode or mean by default, see unur_distr_cvec_get_center() for details of its default values). The minimal bounding has then the coordinates @unurmathdisplay{ v^+ = \sup\limits_{x} (f(x))^{1/r\,d+1}, \\ u^-_i = \inf\limits_{x_i} (x_i-\mu_i) (f(x))^{r/r\,d+1}, \\ u^+_i = \sup\limits_{x_i} (x_i-\mu_i) (f(x))^{r/r\,d+1}, } where @unurmath{x_i} is the @i{i}-th coordinate of point @i{x}; @unurmath{\mu_i} is the @i{i}-th coordinate of the center @unurmath{\mu.} @unurmath{d} denotes the dimension of the distribution. These bounds can either be given directly, or are computed automatically by means of an numerical routine by Hooke and Jeeves @unurbibref{HJa61} called direct search (see @file{src/utils/hooke.c} for further references and details). Of course this algorithm can fail, especially when this rectangle is not bounded. It is important to note that the algorithm works with @unurmath{PDF(x-center)} instead of @unurmath{PDF(x),} i.e. the bounding rectangle has to be provided for @unurmath{PDF(x-center).} This is important as otherwise the acceptance region can become a very long and skinny ellipsoid along a diagonal of the (huge) bounding rectangle. VNROU is based on the rejection method (@pxref{Rejection}), and it is important to note that the acceptance probability decreases exponentially with dimension. Thus even for moderately many dimensions (e.g. 5) the number of repetitions to get one random vector can be prohibitively large and the algorithm seems to stay in an infinite loop. =HOWTOUSE For using the VNROU method UNU.RAN needs the PDF of the distribution. Additionally, the parameter @i{r} can be set via a unur_vnrou_set_r() call. Notice that the acceptance probability decreases when @i{r} is increased. On the other hand is is more unlikely that the bounding rectangle does not exist if @i{r} is small. A bounding rectangle can be given by the unur_vnrou_set_u() and unur_vnrou_set_v() calls. @emph{Important:} The bounding rectangle has to be provided for the function @unurmath{PDF(x-center)!} Notice that @code{center} is the center of the given distribution, see unur_distr_cvec_set_center(). If in doubt or if this value is not optimal, it can be changed (overridden) by a unur_distr_cvec_set_center() call. If the coordinates of the bounding rectangle are not provided by the user then the minimal bounding rectangle is computed automatically. By means of unur_vnrou_set_verify() and unur_vnrou_chg_verify() one can run the sampling algorithm in a checking mode, i.e., in every cycle of the rejection loop it is checked whether the used rectangle indeed enclosed the acceptance region of the distribution. When in doubt (e.g., when it is not clear whether the numerical routine has worked correctly) this can be used to run a small Monte Carlo study. @strong{Important:} The rejection constant (i.e. the expected number of iterations for generationg one random vector) can be extremely high, in particular when the dimension is 4 or higher. Then the algorithm will perform almost infinite loops. Thus it is recommended to read the volume below the hat function by means of the unur_vnrou_get_volumehat() call. The returned number divided by the volume below the PDF (which is 1 in case of a normalized PDF) gives the rejection constant. It is possible to change the parameters and the domain of the chosen distribution and run unur_reinit() to reinitialize the generator object. Notice, that the coordinates of a bounding rectangle given by unur_vnrou_set_u() and unur_vnrou_set_v() calls are used also when the generator is reused. These can be changed by means of unur_vnrou_chg_u() and unur_vnrou_chg_v() calls. (If no such coordinates have been given, then they are computed numerically during the reinitialization proceedure.) =END */ /*---------------------------------------------------------------------------*/ /* Routines for user interface */ /* =ROUTINES */ UNUR_PAR *unur_vnrou_new( const UNUR_DISTR *distribution ); /* Get default parameters for generator. */ /*...........................................................................*/ int unur_vnrou_set_u( UNUR_PAR *parameters, double *umin, double *umax ); /* Sets left and right boundaries of bounding hyper-rectangle. If no values are given, the boundary of the minimal bounding hyper-rectangle is computed numerically. @strong{Important}: The boundaries are those of the density shifted by the center of the distribution, i.e., for the function @unurmath{PDF(x-center)!} @emph{Notice}: Computing the minimal bounding rectangle may fail under some circumstances. Moreover, for multimodal distributions the bounds might be too small as only local extrema are computed. Nevertheless, for log-concave distributions it should work. Default: not set (i.e. computed automatically) */ int unur_vnrou_chg_u( UNUR_GEN *generator, double *umin, double *umax ); /* Change left and right boundaries of bounding hyper-rectangle. */ int unur_vnrou_set_v( UNUR_PAR *parameters, double vmax ); /* Set upper boundary for bounding hyper-rectangle. If no values are given, the density at the mode is evaluated. If no mode is given for the distribution it is computed numerically (and might fail). Default: not set (i.e. computed automatically) */ int unur_vnrou_chg_v( UNUR_GEN *generator, double vmax ); /* Change upper boundary for bounding hyper-rectangle. */ int unur_vnrou_set_r( UNUR_PAR *parameters, double r ); /* Sets the parameter @var{r} of the generalized multivariate ratio-of-uniforms method. @emph{Notice}: This parameter must satisfy @var{r}>0. Default: @code{1}. */ int unur_vnrou_set_verify( UNUR_PAR *parameters, int verify ); /* Turn verifying of algorithm while sampling on/off. If the condition PDF(@i{x}) <= hat(@i{x}) is violated for some @i{x} then @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. However notice that this might happen due to round-off errors for a few values of @i{x} (less than 1%). Default is FALSE. */ int unur_vnrou_chg_verify( UNUR_GEN *generator, int verify ); /* Change the verifying of algorithm while sampling on/off. */ double unur_vnrou_get_volumehat( const UNUR_GEN *generator ); /* Get the volume of below the hat. For normalized densities, i.e. when the volume below PDF is 1, this value equals the rejection constant for the vnrou method. In case of an error UNUR_INFINITY is returned. */ /* =END */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/tdr_info.ch0000644001357500135600000002120514420445767014424 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: tdr_info.ch * * * * TYPE: continuous univariate random variate * * METHOD: transformed density rejection * * * * DESCRIPTION: * * Routines for creating info strings. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_INFO /*---------------------------------------------------------------------------*/ void _unur_tdr_info( struct unur_gen *gen, int help ) /*----------------------------------------------------------------------*/ /* create character string that contains information about the */ /* given generator object. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* help ... whether to print additional comments */ /*----------------------------------------------------------------------*/ { struct unur_string *info = gen->infostr; struct unur_distr *distr = gen->distr; /* generator ID */ _unur_string_append(info,"generator ID: %s\n\n", gen->genid); /* distribution */ _unur_string_append(info,"distribution:\n"); _unur_distr_info_typename(gen); _unur_string_append(info," functions = PDF dPDF\n"); _unur_string_append(info," domain = (%g, %g)", DISTR.trunc[0],DISTR.trunc[1]); if (gen->distr->set & UNUR_DISTR_SET_TRUNCATED) { _unur_string_append(info," [truncated from (%g, %g)]", DISTR.domain[0],DISTR.domain[1]); } _unur_string_append(info,"\n"); _unur_string_append(info," center = %g", unur_distr_cont_get_center(distr)); if ( !(distr->set & UNUR_DISTR_SET_CENTER) ) { if ( distr->set & UNUR_DISTR_SET_MODE ) _unur_string_append(info," [= mode]\n"); else _unur_string_append(info," [default]\n"); } else { _unur_string_append(info,"\n"); } if (help) { if ( !(distr->set & (UNUR_DISTR_SET_CENTER | UNUR_DISTR_SET_MODE )) ) _unur_string_append(info,"\n[ Hint: %s ]\n", "You may provide a point near the mode as \"center\"."); } _unur_string_append(info,"\n"); /* method */ _unur_string_append(info,"method: TDR (Transformed Density Rejection)\n"); _unur_string_append(info," variant = "); switch (gen->variant & TDR_VARMASK_VARIANT) { case TDR_VARIANT_GW: _unur_string_append(info,"GW (original Gilks & Wild)\n"); break; case TDR_VARIANT_PS: _unur_string_append(info,"PS (proportional squeeze)\n"); break; case TDR_VARIANT_IA: _unur_string_append(info,"IA (immediate acceptance)\n"); break; } /* used transformation */ _unur_string_append(info," T_c(x) = "); switch( gen->variant & TDR_VARMASK_T ) { case TDR_VAR_T_LOG: _unur_string_append(info,"log(x) ... c = 0\n"); break; case TDR_VAR_T_SQRT: _unur_string_append(info,"-1/sqrt(x) ... c = -1/2\n"); break; case TDR_VAR_T_POW: _unur_string_append(info,"-x^(%g) ... c = %g\n",GEN->c_T,GEN->c_T); break; } _unur_string_append(info,"\n"); /* performance */ _unur_string_append(info,"performance characteristics:\n"); _unur_string_append(info," area(hat) = %g\n", GEN->Atotal); _unur_string_append(info," rejection constant "); if (distr->set & UNUR_DISTR_SET_PDFAREA) _unur_string_append(info,"= %g\n", GEN->Atotal/DISTR.area); else _unur_string_append(info,"<= %g\n", GEN->Atotal/GEN->Asqueeze); _unur_string_append(info," area ratio squeeze/hat = %g\n", GEN->Asqueeze/GEN->Atotal); _unur_string_append(info," # intervals = %d\n", GEN->n_ivs); _unur_string_append(info,"\n"); /* parameters */ if (help) { _unur_string_append(info,"parameters:\n"); switch (gen->variant & TDR_VARMASK_VARIANT) { case TDR_VARIANT_GW: _unur_string_append(info," variant_gw = on\n"); break; case TDR_VARIANT_PS: _unur_string_append(info," variant_ps = on [default]\n"); break; case TDR_VARIANT_IA: _unur_string_append(info," variant_ia = on\n"); break; } _unur_string_append(info," c = %g %s\n", GEN->c_T, (gen->set & TDR_SET_C) ? "" : "[default]"); _unur_string_append(info," max_sqhratio = %g %s\n", GEN->max_ratio, (gen->set & TDR_SET_MAX_SQHRATIO) ? "" : "[default]"); _unur_string_append(info," max_intervals = %d %s\n", GEN->max_ivs_info, (gen->set & TDR_SET_MAX_IVS) ? "" : "[default]"); if (gen->variant & TDR_VARFLAG_VERIFY) _unur_string_append(info," verify = on\n"); if (gen->variant & TDR_VARFLAG_PEDANTIC) _unur_string_append(info," pedantic = on\n"); _unur_string_append(info,"\n"); /* Not displayed: int unur_tdr_set_usedars( UNUR_PAR *parameters, int usedars ); int unur_tdr_set_darsfactor( UNUR_PAR *parameters, double factor ); int unur_tdr_set_cpoints( UNUR_PAR *parameters, int n_stp, const double *stp ); int unur_tdr_set_reinit_percentiles( UNUR_PAR *parameters, int n_percentiles, const double *percentiles ); int unur_tdr_set_reinit_ncpoints( UNUR_PAR *parameters, int ncpoints ); int unur_tdr_set_usecenter( UNUR_PAR *parameters, int usecenter ); int unur_tdr_set_usemode( UNUR_PAR *parameters, int usemode ); int unur_tdr_set_guidefactor( UNUR_PAR *parameters, double factor ); */ } /* Hints */ if (help) { if ( (gen->variant & TDR_VARMASK_VARIANT) != TDR_VARIANT_IA) _unur_string_append(info,"[ Hint: %s ]\n", "You may use \"variant_ia\" for faster generation times."); if ( !(gen->set & TDR_SET_MAX_SQHRATIO) ) _unur_string_append(info,"[ Hint: %s ]\n", "You can set \"max_sqhratio\" closer to 1 to decrease rejection constant." ); if (GEN->Asqueeze/GEN->Atotal < GEN->max_ratio) _unur_string_append(info,"[ Hint: %s ]\n", "You should increase \"max_intervals\" to obtain the desired rejection constant." ); _unur_string_append(info,"\n"); } } /* end of _unur_tdr_info() */ /*---------------------------------------------------------------------------*/ #endif /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/dsrou_struct.h0000644001357500135600000000647514420304141015205 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: dsrou_struct.h * * * * PURPOSE: * * declares structures for method DSROU * * (Discrete Simple universal generator, Ratio-Of-Uniforms method) * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Information for constructing the generator */ struct unur_dsrou_par { double Fmode; /* cdf at mode */ }; /*---------------------------------------------------------------------------*/ /* The generator object */ struct unur_dsrou_gen { double ul, ur; /* height of rectangles */ double al, ar; /* area of rectangles */ double Fmode; /* cdf at mode */ }; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/dgt.c0000644001357500135600000012761114420445767013236 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: dgt.c * * * * TYPE: discrete univariate random variate * * METHOD: guide table (indexed search) * * * * DESCRIPTION: * * Given N discrete events with different probabilities P[k] * * produce a value k consistent with its probability. * * * * REQUIRED: pointer to probability vector * * * ***************************************************************************** * * * Copyright (c) 2000-2009 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * ***************************************************************************** * * * REFERENCES: * * [1] Chen, H. C. and Asau, Y. (1974): On generating random variates * * from an empirical distribution, AIIE Trans. 6, pp. 163-166 * * * * SUMMARY: * * [2] Devroye, L. (1986): Non-Uniform Random Variate Generation, New-York * * * ***************************************************************************** * * * This method a varient of the inversion method, i.e. * * * * (1) Generate a random number U ~ U(0,1). * * (2) Find largest integer I such that F(I) = P(X<=I) <= U. * * * * Step (2) is the crucial step. Using sequential search requires O(N) * * comparisons. Indexed search however uses a guide table to jump to some * * I' <= I near I. In a preprossing step (0,1) is partitioned into N * * equal intervals and P(X<=I) <= (k-1)/N is solved for all k=1,...,N, * * and the solutions are stored in a table (guide table). Setup this * * table can be done in O(N). [2] has shown that the expected number of * * of comparisons is at most 2. * * * * In the current implementation we use a variant that allows a different * * size for the guide table. Bigger guide tables reduce the expected * * number of comparisions but needs more memory and need more setup time. * * On the other hand, the guide table can be made arbitrarily small to * * save memory and setup time. Indeed, for size = 1 we have sequential * * search again that requires no preprocessing. * * * ***************************************************************************** * * * VARIANTS: * * * * We have three variants for the setup procedure: * * * * 1 ... compute (k-1)/N for each k=1,...,N * * 2 ... compute (k-1)/N by summing up 1/N * * 0 ... use 1 for large N and 2 for small N (default) * * * * variant 2 is faster but is more sensitive to roundoff errors when * * N is large. * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include "unur_methods_source.h" #include "x_gen_source.h" #include "dgt.h" #include "dgt_struct.h" /*---------------------------------------------------------------------------*/ /* Variants */ #define DGT_VARFLAG_DIV 0x01u /* compute guide table by division n/k */ #define DGT_VARFLAG_ADD 0x02u /* compute guide table by adding */ #define DGT_VAR_THRESHOLD 1000 /* above this value: use variant 1, else 2 */ /*---------------------------------------------------------------------------*/ /* Debugging flags */ /* bit 01 ... pameters and structure of generator (do not use here) */ /* bits 02-12 ... setup */ /* bits 13-24 ... adaptive steps */ /* bits 25-32 ... trace sampling */ #define DGT_DEBUG_REINIT 0x00000010u /* print parameters after reinit */ #define DGT_DEBUG_PRINTVECTOR 0x00000100u #define DGT_DEBUG_TABLE 0x00000200u /*---------------------------------------------------------------------------*/ /* Flags for logging set calls */ #define DGT_SET_GUIDEFACTOR 0x010u #define DGT_SET_VARIANT 0x020u /*---------------------------------------------------------------------------*/ #define GENTYPE "DGT" /* type of generator */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_dgt_init( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* Initialize new generator. */ /*---------------------------------------------------------------------------*/ static int _unur_dgt_reinit( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Reinitialize generator. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_dgt_create( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* create new (almost empty) generator object. */ /*---------------------------------------------------------------------------*/ static int _unur_dgt_check_par( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Check parameters of given distribution and method */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_dgt_clone( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* copy (clone) generator object. */ /*---------------------------------------------------------------------------*/ static void _unur_dgt_free( struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* destroy generator object. */ /*---------------------------------------------------------------------------*/ static int _unur_dgt_sample( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* sample from generator */ /*---------------------------------------------------------------------------*/ static int _unur_dgt_create_tables( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* create (allocate) tables */ /*---------------------------------------------------------------------------*/ static int _unur_dgt_make_guidetable( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* create table for indexed search */ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ /* the following functions print debugging information on output stream, */ /* i.e., into the LOG file if not specified otherwise. */ /*---------------------------------------------------------------------------*/ static void _unur_dgt_debug_init( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print after generator has been initialized has completed. */ /*---------------------------------------------------------------------------*/ static void _unur_dgt_debug_table( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print data for guide table. */ /*---------------------------------------------------------------------------*/ #endif #ifdef UNUR_ENABLE_INFO static void _unur_dgt_info( struct unur_gen *gen, int help ); /*---------------------------------------------------------------------------*/ /* create info string. */ /*---------------------------------------------------------------------------*/ #endif /*---------------------------------------------------------------------------*/ /* abbreviations */ #define DISTR_IN distr->data.discr /* data for distribution object */ #define PAR ((struct unur_dgt_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_dgt_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.discr /* data for distribution in generator object */ #define SAMPLE gen->sample.discr /* pointer to sampling routine */ /*---------------------------------------------------------------------------*/ #define _unur_dgt_getSAMPLE(gen) (_unur_dgt_sample) /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Public: User Interface (API) **/ /*****************************************************************************/ struct unur_par * unur_dgt_new( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get default parameters */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* default parameters (pointer to structure) */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_par *par; /* check arguments */ _unur_check_NULL( GENTYPE,distr,NULL ); /* check distribution */ if (distr->type != UNUR_DISTR_DISCR) { _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } COOKIE_CHECK(distr,CK_DISTR_DISCR,NULL); if (DISTR_IN.pv == NULL) { /* There is no PV try to compute it. */ if ( DISTR_IN.pmf && ( (((unsigned)DISTR_IN.domain[1] - (unsigned)DISTR_IN.domain[0]) < UNUR_MAX_AUTO_PV) || ( (distr->set & UNUR_DISTR_SET_PMFSUM) && DISTR_IN.domain[0] > INT_MIN ) ) ) { /* However this requires a PMF and either a bounded domain */ /* or the sum over the PMF. */ _unur_warning(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PV. Try to compute it."); } else { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PV"); return NULL; } } /* allocate structure */ par = _unur_par_new( sizeof(struct unur_dgt_par) ); COOKIE_SET(par,CK_DGT_PAR); /* copy input */ par->distr = distr; /* pointer to distribution object */ /* set default values */ PAR->guide_factor = 1.; /* use same size for guide table */ par->method = UNUR_METH_DGT; /* method */ par->variant = 0u; /* default variant */ par->set = 0u; /* inidicate default parameters */ par->urng = unur_get_default_urng(); /* use default urng */ par->urng_aux = NULL; /* no auxilliary URNG required */ par->debug = _unur_default_debugflag; /* set default debugging flags */ /* routine for starting generator */ par->init = _unur_dgt_init; return par; } /* end of unur_dgt_new() */ /*---------------------------------------------------------------------------*/ int unur_dgt_set_variant( struct unur_par *par, unsigned variant ) /*----------------------------------------------------------------------*/ /* set variant of method */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* variant ... indicator for variant */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, DGT ); /* check new parameter for generator */ if (variant != DGT_VARFLAG_ADD && variant != DGT_VARFLAG_DIV) { _unur_warning(GENTYPE,UNUR_ERR_PAR_VARIANT,""); return UNUR_ERR_PAR_VARIANT; } /* changelog */ par->set |= DGT_SET_VARIANT; par->variant = variant; return UNUR_SUCCESS; } /* end of unur_dgt_set_variant() */ /*---------------------------------------------------------------------------*/ int unur_dgt_set_guidefactor( struct unur_par *par, double factor ) /*----------------------------------------------------------------------*/ /* set factor for relative size of guide table */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* factor ... relative size of table */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, DGT ); /* check new parameter for generator */ if (factor < 0) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"relative table size < 0"); return UNUR_ERR_PAR_SET; } /* store date */ PAR->guide_factor = factor; /* changelog */ par->set |= DGT_SET_GUIDEFACTOR; return UNUR_SUCCESS; } /* end of unur_dgt_set_guidefactor() */ /*****************************************************************************/ /** Private **/ /*****************************************************************************/ struct unur_gen * _unur_dgt_init( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* initialize new generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* pointer to generator object */ /* check arguments */ CHECK_NULL(par,NULL); /* check input */ if ( par->method != UNUR_METH_DGT ) { _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); return NULL; } COOKIE_CHECK(par,CK_DGT_PAR,NULL); /* create a new empty generator object */ gen = _unur_dgt_create(par); _unur_par_free(par); if (!gen) return NULL; /* check parameters */ if ( _unur_dgt_check_par(gen) != UNUR_SUCCESS ) { _unur_dgt_free(gen); return NULL; } /* compute guide table */ if ( (_unur_dgt_create_tables(gen) != UNUR_SUCCESS) || (_unur_dgt_make_guidetable(gen) != UNUR_SUCCESS) ) { _unur_dgt_free(gen); return NULL; } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_dgt_debug_init(gen); #endif return gen; } /* end of _unur_dgt_init() */ /*---------------------------------------------------------------------------*/ int _unur_dgt_reinit( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* re-initialize (existing) generator. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int rcode; /* check parameters */ if ( (rcode = _unur_dgt_check_par(gen)) != UNUR_SUCCESS) return rcode; /* compute table */ if ( ((rcode = _unur_dgt_create_tables(gen)) != UNUR_SUCCESS) || ((rcode = _unur_dgt_make_guidetable(gen)) != UNUR_SUCCESS) ) { return rcode; } /* (re)set sampling routine */ SAMPLE = _unur_dgt_getSAMPLE(gen); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug & DGT_DEBUG_REINIT) _unur_dgt_debug_init(gen); #endif return UNUR_SUCCESS; } /* end of _unur_dgt_reinit() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_dgt_create( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* allocate memory for generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* pointer to (empty) generator object with default settings */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* pointer to generator object */ /* check arguments */ CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_DGT_PAR,NULL); /* create new generic generator object */ gen = _unur_generic_create( par, sizeof(struct unur_dgt_gen) ); /* magic cookies */ COOKIE_SET(gen,CK_DGT_GEN); /* set generator identifier */ gen->genid = _unur_set_genid(GENTYPE); /* routines for sampling and destroying generator */ SAMPLE = _unur_dgt_getSAMPLE(gen); gen->destroy = _unur_dgt_free; gen->clone = _unur_dgt_clone; gen->reinit = _unur_dgt_reinit; /* copy some parameters into generator object */ GEN->guide_factor = PAR->guide_factor; /* set all pointers to NULL */ GEN->cumpv = NULL; GEN->guide_table = NULL; #ifdef UNUR_ENABLE_INFO /* set function for creating info string */ gen->info = _unur_dgt_info; #endif /* return pointer to (almost empty) generator object */ return gen; } /* end of _unur_dgt_create() */ /*---------------------------------------------------------------------------*/ int _unur_dgt_check_par( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* check parameters of given distribution and method */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* we need a PV */ if (DISTR.pv == NULL) { /* try to compute PV */ if (unur_distr_discr_make_pv( gen->distr ) <= 0) { /* not successful */ _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PV"); return UNUR_ERR_DISTR_REQUIRED; } } /* default variant? */ if (gen->variant == 0) /* default variant */ gen->variant = (DISTR.n_pv > DGT_VAR_THRESHOLD) ? DGT_VARFLAG_DIV : DGT_VARFLAG_ADD; return UNUR_SUCCESS; } /* end of _unur_dgt_check_par() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_dgt_clone( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* copy (clone) generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to clone of generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { #define CLONE ((struct unur_dgt_gen*)clone->datap) struct unur_gen *clone; /* check arguments */ CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_DGT_GEN,NULL); /* create generic clone */ clone = _unur_generic_clone( gen, GENTYPE ); /* copy data for distribution */ CLONE->cumpv = _unur_xmalloc( DISTR.n_pv * sizeof(double) ); memcpy( CLONE->cumpv, GEN->cumpv, DISTR.n_pv * sizeof(double) ); CLONE->guide_table = _unur_xmalloc( GEN->guide_size * sizeof(int) ); memcpy( CLONE->guide_table, GEN->guide_table, GEN->guide_size * sizeof(int) ); return clone; #undef CLONE } /* end of _unur_dgt_clone() */ /*---------------------------------------------------------------------------*/ void _unur_dgt_free( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* deallocate generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { /* check arguments */ if (!gen) /* nothing to do */ return; /* check input */ if ( gen->method != UNUR_METH_DGT ) { _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); return; } COOKIE_CHECK(gen,CK_DGT_GEN,RETURN_VOID); /* we cannot use this generator object any more */ SAMPLE = NULL; /* make sure to show up a programming error */ /* free two auxiliary tables */ if (GEN->guide_table) free(GEN->guide_table); if (GEN->cumpv) free(GEN->cumpv); /* free memory */ _unur_generic_free(gen); } /* end of _unur_dgt_free() */ /*****************************************************************************/ int _unur_dgt_sample( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* integer (sample from random variate) */ /* */ /* error: */ /* return INT_MAX */ /*----------------------------------------------------------------------*/ { int j; double u; /* check arguments */ CHECK_NULL(gen,INT_MAX); COOKIE_CHECK(gen,CK_DGT_GEN,INT_MAX); /* sample from U(0,1) */ u = _unur_call_urng(gen->urng); /* look up in guide table ... */ j = GEN->guide_table[(int)(u * GEN->guide_size)]; /* ... and search */ u *= GEN->sum; while (GEN->cumpv[j] < u) j++; return (j + DISTR.domain[0]); } /* end of _unur_dgt_sample() */ /*---------------------------------------------------------------------------*/ int unur_dgt_eval_invcdf_recycle( const struct unur_gen *gen, double u, double *recycle ) /*----------------------------------------------------------------------*/ /* evaluate inverse CDF at u. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* u ... argument for inverse CDF (0<=u<=1) */ /* recycle ... if not NULL then store recycled 'u' */ /* */ /* return: */ /* integer (inverse CDF) */ /* */ /* error: */ /* return INT_MAX */ /*----------------------------------------------------------------------*/ { int j; /* set default */ if (recycle) *recycle = 0.; /* check arguments */ _unur_check_NULL( GENTYPE, gen, INT_MAX ); if ( gen->method != UNUR_METH_DGT ) { _unur_error(gen->genid,UNUR_ERR_GEN_INVALID,""); return INT_MAX; } COOKIE_CHECK(gen,CK_DGT_GEN,INT_MAX); /* check range of u */ if ( ! (u>0. && u<1.)) { if ( ! (u>=0. && u<=1.)) { _unur_warning(gen->genid,UNUR_ERR_DOMAIN,"U not in [0,1]"); } if (u<=0.) return DISTR.domain[0]; if (u>=1.) return DISTR.domain[1]; return INT_MAX; /* u == NaN */ } /* look up in guide table ... */ j = GEN->guide_table[(int)(u * GEN->guide_size)]; /* ... and search */ u *= GEN->sum; while (GEN->cumpv[j] < u) j++; if (recycle) { *recycle = 1. - (GEN->cumpv[j] - u) / DISTR.pv[j]; } j+=DISTR.domain[0]; /* validate range */ if (jDISTR.domain[1]) j = DISTR.domain[1]; return j; } /* end of unur_dgt_eval_invcdf_recycle() */ /*---------------------------------------------------------------------------*/ int unur_dgt_eval_invcdf( const struct unur_gen *gen, double u ) /*----------------------------------------------------------------------*/ /* evaluate inverse CDF at u. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* u ... argument for inverse CDF (0<=u<=1) */ /* */ /* return: */ /* integer (inverse CDF) */ /* */ /* error: */ /* return INT_MAX */ /*----------------------------------------------------------------------*/ { return unur_dgt_eval_invcdf_recycle(gen,u,NULL); } /* end of unur_dgt_eval_invcdf() */ /*****************************************************************************/ /** Auxilliary Routines **/ /*****************************************************************************/ int _unur_dgt_create_tables( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* create (allocate) tables */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* size of guide table */ GEN->guide_size = (int)( DISTR.n_pv * GEN->guide_factor); if (GEN->guide_size <= 0) /* do not use a guide table whenever params->guide_factor is 0 or less */ GEN->guide_size = 1; /* allocation for cummulated probabilities */ GEN->cumpv = _unur_xrealloc( GEN->cumpv, DISTR.n_pv * sizeof(double) ); /* allocate memory for the guide table */ GEN->guide_table = _unur_xrealloc( GEN->guide_table, GEN->guide_size * sizeof(int) ); /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_dgt_create_tables() */ /*---------------------------------------------------------------------------*/ int _unur_dgt_make_guidetable( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* create guide table */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { double *pv; /* pointer to probability vector */ int n_pv; /* length of probability vector */ double pvh; /* aux variable for computing cumulated sums */ double gstep; /* step size when computing guide table */ int i,j; /* probability vector */ pv = DISTR.pv; n_pv = DISTR.n_pv; /* computation of cumulated probabilities */ for( i=0, pvh=0.; icumpv[i] = ( pvh += pv[i] ); /* ... and check probability vector */ if (pv[i] < 0.) { _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"probability < 0"); return UNUR_ERR_GEN_DATA; } } GEN->sum = GEN->cumpv[n_pv-1]; /* computation of guide-table */ if (gen->variant == DGT_VARFLAG_DIV) { GEN->guide_table[0] = 0; for( j=1, i=0; jguide_size ;j++ ) { while( GEN->cumpv[i]/GEN->sum < ((double)j)/GEN->guide_size ) i++; if (i >= n_pv) { _unur_warning(gen->genid,UNUR_ERR_ROUNDOFF,"guide table"); break; } GEN->guide_table[j]=i; } } else { /* gen->variant == DGT_VARFLAG_ADD */ gstep = GEN->sum / GEN->guide_size; pvh = 0.; for( j=0, i=0; jguide_size ;j++ ) { while (GEN->cumpv[i] < pvh) i++; if (i >= n_pv) { _unur_warning(gen->genid,UNUR_ERR_ROUNDOFF,"guide table"); break; } GEN->guide_table[j] = i; pvh += gstep; } } /* if there has been an round off error, we have to complete the guide table */ for( ; jguide_size ;j++ ) GEN->guide_table[j] = n_pv - 1; /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_dgt_make_guidetable() */ /*****************************************************************************/ /** Debugging utilities **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ void _unur_dgt_debug_init( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write info about generator into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_DGT_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: type = discrete univariate random variates\n",gen->genid); fprintf(LOG,"%s: method = indexed search (guide table)\n",gen->genid); fprintf(LOG,"%s: variant = %u ",gen->genid,gen->variant); _unur_print_if_default(gen,DGT_SET_VARIANT); fprintf(LOG,"\n%s:\n",gen->genid); _unur_distr_discr_debug( gen->distr,gen->genid,(gen->debug & DGT_DEBUG_PRINTVECTOR)); fprintf(LOG,"%s: sampling routine = _unur_dgt_sample()\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: length of probability vector = %d\n",gen->genid,DISTR.n_pv); fprintf(LOG,"%s: length of guide table = %d (rel. = %g%%", gen->genid,GEN->guide_size,100.*GEN->guide_factor); _unur_print_if_default(gen,DGT_SET_GUIDEFACTOR); if (GEN->guide_size == 1) fprintf(LOG,") \t (-->sequential search"); fprintf(LOG,")\n%s:\n",gen->genid); fprintf(LOG,"%s: sum over PMF (as computed) = %#-20.16g\n",gen->genid,GEN->sum); if (gen->debug & DGT_DEBUG_TABLE) _unur_dgt_debug_table(gen); } /* end of _unur_dgt_debug_init() */ /*---------------------------------------------------------------------------*/ void _unur_dgt_debug_table( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write guide table into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; int i,j,m; int n_asts; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_DGT_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s: guide table:\n", gen->genid); fprintf(LOG,"%s:\n", gen->genid); n_asts = 0; for (i=0; iguide_size; i++){ fprintf(LOG,"%s: [%5d] -> %5d ", gen->genid, i, GEN->guide_table[i]); /* print row of asterisks */ if (i == GEN->guide_size-1) j = GEN->guide_size - GEN->guide_table[i]; else j = GEN->guide_table[i+1] - GEN->guide_table[i] + 1; for (m=0; mgenid); fprintf(LOG,"%s: expected number of comparisons = %g\n",gen->genid, ((double)n_asts)/GEN->guide_size); fprintf(LOG,"%s:\n", gen->genid); fprintf(LOG,"%s:\n",gen->genid); } /* end of _unur_dgt_debug_table() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_INFO /*---------------------------------------------------------------------------*/ void _unur_dgt_info( struct unur_gen *gen, int help ) /*----------------------------------------------------------------------*/ /* create character string that contains information about the */ /* given generator object. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* help ... whether to print additional comments */ /*----------------------------------------------------------------------*/ { struct unur_string *info = gen->infostr; /* generator ID */ _unur_string_append(info,"generator ID: %s\n\n", gen->genid); /* distribution */ _unur_string_append(info,"distribution:\n"); _unur_distr_info_typename(gen); _unur_string_append(info," functions = PV [length=%d%s]\n", DISTR.domain[1]-DISTR.domain[0]+1, (DISTR.pmf==NULL) ? "" : ", created from PMF"); _unur_string_append(info," domain = (%d, %d)\n", DISTR.domain[0],DISTR.domain[1]); _unur_string_append(info,"\n"); /* method */ _unur_string_append(info,"method: DGT (Guide Table)\n"); _unur_string_append(info,"\n"); /* performance */ _unur_string_append(info,"performance characteristics:\n"); _unur_string_append(info," E [#look-ups] = %g\n", 1+1./GEN->guide_factor); _unur_string_append(info,"\n"); /* parameters */ if (help) { _unur_string_append(info,"parameters:\n"); _unur_string_append(info," guidefactor = %g %s\n", GEN->guide_factor, (gen->set & DGT_SET_GUIDEFACTOR) ? "" : "[default]"); if (gen->set & DGT_SET_VARIANT) _unur_string_append(info," variant = %d\n", gen->variant); _unur_string_append(info,"\n"); } /* Hints */ /* if (help) { */ /* _unur_string_append(info,"\n"); */ /* } */ } /* end of _unur_dgt_info() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_INFO */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/tdr_gw_sample.ch0000644001357500135600000005516614420445767015464 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: tdr_gw_sample.c * * * * TYPE: continuous univariate random variate * * METHOD: transformed density rejection * * * * DESCRIPTION: * * Sampling routines for variant of Gilks and Wild. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*****************************************************************************/ /** Sampling routines **/ /*****************************************************************************/ double _unur_tdr_gw_sample( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator (original variant by Gilks & Wild) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return UNUR_INFINITY */ /* */ /*======================================================================*/ /* comment: */ /* x ... random point */ /* x0 ... left construction point in interval */ /* x1 ... right construction point in interval */ /* f ... PDF */ /* Tf ... transformed PDF */ /* dTf ... derivative of transformed PDF */ /* sq ... slope of squeeze in interval */ /* */ /*----------------------------------------------------------------------*/ /* if (Tf)'(x0) == 0: */ /* X = x0 + U / f(x0) */ /* U ~ U(0,area below hat) */ /* */ /*----------------------------------------------------------------------*/ /* log(x): */ /* squeeze(x) = f(x0) * exp(sq * (x-x0)) */ /* */ /* left hat(x) = f(x0) * exp( (Tf)'(x0) * (x-x0) ) */ /* generation: */ /* X = x0 + 1/(Tf)'(x0) * \log( (Tf)'(x0)/f(x0) * U + 1 ) */ /* U ~ U(0,area below left hat) */ /* */ /* right hat(x) = f(x1) * exp( (Tf)'(x1) * (x-x1) ) */ /* generation: */ /* X = x1 + 1/(Tf)'(x1) * \log( (Tf)'(x1)/f(x1) * U + 1 ) */ /* U ~ U(- area below right hat,0) */ /*----------------------------------------------------------------------*/ /* T(x) = -1/sqrt(x): */ /* */ /* squeeze(x) = 1 / (Tf(x0) + sq * (x-x0))^2 */ /* */ /* left hat(x) = 1 / (Tf(x0) + (Tf)'(x0) * (x-x0))^2 */ /* generation: */ /* X = x0 + (Tf(x0)^2 * U) / (1 - Tf(x0) * (Tf)'(x0) * U) */ /* U ~ U(0,area below left hat) */ /* */ /* right hat(x) = 1 / (Tf(x1) + (Tf)'(x1) * (x-x1))^2 */ /* generation: */ /* X = x1 + (Tf(x1)^2 * U) / (1 - Tf(x1) * (Tf)'(x1) * U) */ /* U ~ U(- area below right hat,0) */ /*----------------------------------------------------------------------*/ { UNUR_URNG *urng; /* pointer to uniform random number generator */ struct unur_tdr_interval *iv, *pt; double U, V; /* uniform random number */ double X; /* generated point */ double fx, sqx, hx; /* values of density, squeeze, and hat at X */ double Tsqx, Thx; /* values of transformed squeeze and hat at X */ /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_INFINITY); if (GEN->iv == NULL) { _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"empty generator object"); return UNUR_INFINITY; } /* main URNG */ urng = gen->urng; while (1) { /* sample from U( Umin, Umax ) */ U = GEN->Umin + _unur_call_urng(urng) * (GEN->Umax - GEN->Umin); /* look up in guide table and search for segment */ iv = GEN->guide[(int) (U * GEN->guide_size)]; U *= GEN->Atotal; while (iv->Acum < U) { iv = iv->next; } /* reuse of uniform random number */ U -= iv->Acum; /* result: U in (-A_hat, 0) */ /* left or right side of hat */ if (-U < iv->Ahatr) { /* right */ pt = iv->next; /* u unchanged */ } else { /* left */ pt = iv; U += iv->Ahat; } /* we have three different types of transformations */ switch (gen->variant & TDR_VARMASK_T) { case TDR_VAR_T_LOG: /* random variate */ if (_unur_iszero(pt->dTfx)) X = pt->x + U / pt->fx; else { double t = pt->dTfx * U / pt->fx; if (fabs(t) > 1.e-6) X = pt->x + log(t + 1.) * U / (pt->fx * t); /* x = pt->x + log(t + 1.) / pt->dTfx; is cheaper but numerical unstable */ else if (fabs(t) > 1.e-8) /* use Taylor series */ X = pt->x + U / pt->fx * (1 - t/2. + t*t/3.); else X = pt->x + U / pt->fx * (1 - t/2.); } /* accept or reject */ hx = pt->fx * exp(pt->dTfx*(X - pt->x)); /* value of hat at x */ V = _unur_call_urng(urng) * hx; /* a random point between 0 and hat at x */ /* below mininum of density in interval ? */ if (V <= iv->fx && V <= iv->next->fx) return X; /* below squeeze ? */ sqx = (iv->Asqueeze > 0.) ? iv->fx * exp(iv->sq*(X - iv->x)) : 0.; /* value of squeeze at x */ if (V <= sqx) return X; break; case TDR_VAR_T_SQRT: /* random variate */ if (_unur_iszero(pt->dTfx)) X = pt->x + U /pt->fx; else { /* it would be less expensive to use: X = pt->x + pt->Tfx/pt->dTfx * (1. - 1./(1. + pt->dTfx * pt->Tfx * U) ) however, this is unstable for small pt->dTfx */ X = pt->x + (pt->Tfx*pt->Tfx*U) / (1.-pt->Tfx*pt->dTfx*U); /* It cannot happen, that the denominator becomes 0 ! */ } /* accept or reject */ Thx = pt->Tfx + pt->dTfx * (X - pt->x); /* transformed hat at x */ hx = 1./(Thx*Thx); V = _unur_call_urng(urng) * hx; /* a random point between 0 and hat at x */ /* below mininum of density in interval ? */ if (V <= iv->fx && V <= iv->next->fx) return X; /* below squeeze ? */ Tsqx = (iv->Asqueeze > 0.) ? (iv->Tfx + iv->sq * (X - iv->x)) : -UNUR_INFINITY; /* transformed squeeze at x */ sqx = (iv->Asqueeze > 0.) ? 1./(Tsqx*Tsqx) : 0.; if (V <= sqx) return X; break; case TDR_VAR_T_POW: /** TODO **/ default: _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); return UNUR_INFINITY; } /* end switch */ /* value of PDF at x */ fx = PDF(X); /** TODO: for the changing parameter case it would be better not to added the new construction point when we accept the generated point! **/ /* being above squeeze is bad. improve the situation! */ if (GEN->n_ivs < GEN->max_ivs) { if ( (_unur_tdr_gw_improve_hat( gen, iv, X, fx) != UNUR_SUCCESS) && (gen->variant & TDR_VARFLAG_PEDANTIC) ) return UNUR_INFINITY; } if (V <= fx) /* between PDF and squeeze */ return X; /* else reject and try again */ /* use the auxilliary generator the next time (it can be the same as the main generator) */ urng = gen->urng_aux; } } /* end of _unur_tdr_gw_sample() */ /*---------------------------------------------------------------------------*/ double _unur_tdr_gw_sample_check( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator and verify results */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { UNUR_URNG *urng; /* pointer to uniform random number generator */ struct unur_tdr_interval *iv, *pt; double U, V; /* uniform random number */ double X; /* generated point */ double fx, sqx, hx; /* value of density, squeeze, and hat at X */ #ifdef UNUR_ENABLE_LOGGING int error = 0; /* indicates error */ #endif /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_INFINITY); if (GEN->iv == NULL) { _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"empty generator object"); return UNUR_INFINITY; } /* main URNG */ urng = gen->urng; while (1) { /* sample from U( Umin, Umax ) */ U = GEN->Umin + _unur_call_urng(urng) * (GEN->Umax - GEN->Umin); /* evaluate inverse of hat CDF */ X = _unur_tdr_gw_eval_invcdfhat( gen, U, &hx, &fx, &sqx, &iv, &pt ); /* check result */ if (X < DISTR.BD_LEFT || X > DISTR.BD_RIGHT) { _unur_warning(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,"generated point out of domain"); #ifdef UNUR_ENABLE_LOGGING error = 1; #endif } if (_unur_FP_greater(fx,hx)) { _unur_warning(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF > hat. Not T-concave!"); #ifdef UNUR_ENABLE_LOGGING error = 1; #endif } if (_unur_FP_less(fx,sqx)) { _unur_warning(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF < squeeze. Not T-concave!"); #ifdef UNUR_ENABLE_LOGGING error = 1; #endif } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file (in case error) */ if (error && (gen->debug & TDR_DEBUG_SAMPLE)) _unur_tdr_gw_debug_sample( gen, iv, pt, X, fx, hx, sqx ); #endif /* accept or reject */ V = _unur_call_urng(urng) * hx; /* a random point between 0 and hat at X */ /* below mininum of density in interval ? */ if (V <= iv->fx && V <= iv->next->fx) return X; /* below squeeze ? */ if (V <= sqx) return X; /* being above squeeze is bad. improve the situation! */ if (GEN->n_ivs < GEN->max_ivs) { if ( (_unur_tdr_gw_improve_hat( gen, iv, X, fx) != UNUR_SUCCESS) && (gen->variant & TDR_VARFLAG_PEDANTIC) ) return UNUR_INFINITY; } if (V <= fx) /* between PDF and squeeze */ return X; /* reject and try again */ /* use the auxilliary generator the next time (it can be the same as the main generator) */ urng = gen->urng_aux; } } /* end of _unur_tdr_gw_sample_check() */ /*---------------------------------------------------------------------------*/ double _unur_tdr_gw_eval_invcdfhat( const struct unur_gen *gen, double U, double *hx, double *fx, double *sqx, struct unur_tdr_interval **ivl, struct unur_tdr_interval **cpt ) /*----------------------------------------------------------------------*/ /* evaluate the inverse of the hat CDF at u */ /* (original variant by Gilks & Wild) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* U ... argument for inverse CDF (0<=U<=1, no validation!) */ /* hx ... pointer for storing hat at sampled X */ /* fx ... pointer for storing squeeze at sampled X */ /* sqx ... pointer for storing density at sampled X */ /* ivl ... pointer to interval for hat */ /* cpt ... pointer to interval where hat construction point is stored */ /* */ /* return: */ /* inverse hat CDF. */ /* */ /* values of hat, density, squeeze (computation is suppressed if */ /* corresponding pointer is NULL). */ /* */ /* ivl and cpt can be NULL. then no pointers are stored. */ /*----------------------------------------------------------------------*/ { struct unur_tdr_interval *iv, *pt; /* pointer to intervals */ double X; /* inverse of hat CDF at U */ double Tsqx, Thx; /* transformed hat and squeeze */ double t; /* aux variable */ /** -1- Compute inverse of hat CDF at U **/ /* look up in guide table and search for interval */ iv = GEN->guide[(int) (U * GEN->guide_size)]; U *= GEN->Atotal; while (iv->Acum < U) { iv = iv->next; } /* transform u such that u in (-A_hat, 0) */ /* (reuse of uniform random number) */ U -= iv->Acum; /* left or right hand side of hat */ if (-U < iv->Ahatr) { /* r.h.s. */ pt = iv->next; /* U unchanged */ } else { /* l.h.s. */ pt = iv; U += iv->Ahat; } /* we have three different types of transformations */ switch (gen->variant & TDR_VARMASK_T) { case TDR_VAR_T_LOG: /* inverse of CDF (random variate) */ if (_unur_iszero(pt->dTfx)) X = pt->x + U / pt->fx; else { t = pt->dTfx * U / pt->fx; if (fabs(t) > 1.e-6) X = pt->x + log(t + 1.) * U / (pt->fx * t); /* x = pt->x + log(t + 1.) / pt->dTfx; is cheaper but numerical unstable */ else if (fabs(t) > 1.e-8) /* use Taylor series */ X = pt->x + U / pt->fx * (1 - t/2. + t*t/3.); else X = pt->x + U / pt->fx * (1 - t/2.); } break; case TDR_VAR_T_SQRT: /* inverse of CDF (random variate) */ if (_unur_iszero(pt->dTfx)) X = pt->x + U / (pt->fx); else { /* it would be less expensive to use: X = pt->x + pt->Tfx/(pt->dTfx) * (1. - 1./(1. + pt->dTfx * pt->Tfx * U) ) however, this is unstable for small pt->dTfx */ X = pt->x + (pt->Tfx*(pt->Tfx)*U) / (1.-(pt->Tfx)*(pt->dTfx)*U); /* It cannot happen, that the denominator becomes 0 ! */ } break; case TDR_VAR_T_POW: /** TODO **/ default: _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); X = UNUR_INFINITY; } /* end switch */ /** -2- Evaluate hat at X **/ if (hx != NULL) { switch (gen->variant & TDR_VARMASK_T) { case TDR_VAR_T_LOG: *hx = pt->fx * exp(pt->dTfx*(X - pt->x)); break; case TDR_VAR_T_SQRT: Thx = pt->Tfx + pt->dTfx * (X - pt->x); /* transformed hat at x */ *hx = 1./(Thx*Thx); break; case TDR_VAR_T_POW: /** TODO **/ default: _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); *hx = UNUR_INFINITY; } } /** -3- Evaluate density at X **/ if (fx != NULL) { *fx = PDF(X); } /** -4- Evaluate squeeze at X **/ if (sqx != NULL) { switch (gen->variant & TDR_VARMASK_T) { case TDR_VAR_T_LOG: *sqx = (iv->Asqueeze > 0.) ? iv->fx * exp(iv->sq*(X - iv->x)) : 0.; break; case TDR_VAR_T_SQRT: if (iv->Asqueeze > 0.) { Tsqx = iv->Tfx + iv->sq * (X - iv->x); *sqx = 1./(Tsqx*Tsqx); } else *sqx = 0.; break; case TDR_VAR_T_POW: /** TODO **/ default: /* this should not happen */ _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); *sqx = 0.; } } /* store interval pointer */ if (ivl) *ivl = iv; if (cpt) *cpt = pt; /* o.k. */ return X; } /* end of _unur_tdr_gw_eval_invcdfhat() */ /*---------------------------------------------------------------------------*/ int _unur_tdr_gw_improve_hat( struct unur_gen *gen, struct unur_tdr_interval *iv, double x, double fx ) /*----------------------------------------------------------------------*/ /* improve hat function by splitting interval */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* iv ... pointer to interval that has to be split */ /* x ... splitting point */ /* fx ... value of PDF at splitting point */ /* */ /* return: */ /* UNUR_SUCCESS ... improving hat successful */ /* others ... error: PDF not monotone in interval */ /*----------------------------------------------------------------------*/ { int result; /* is there any reason to improve hat ? */ if (! (GEN->max_ratio * GEN->Atotal > GEN->Asqueeze) ) { /* no more construction points (avoid calling this function any more) */ GEN->max_ivs = GEN->n_ivs; return UNUR_SUCCESS; } /* add construction point */ result = _unur_tdr_gw_interval_split(gen, iv, x, fx); if (result!=UNUR_SUCCESS && result!=UNUR_ERR_SILENT && result!=UNUR_ERR_INF) { /* condition for PDF is violated! */ _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,""); if (gen->variant & TDR_VARFLAG_PEDANTIC || result == UNUR_ERR_ROUNDOFF) { /* replace sampling routine by dummy routine that just returns UNUR_INFINITY */ SAMPLE = _unur_sample_cont_error; return UNUR_ERR_GEN_CONDITION; } } /* splitting successful --> update guide table */ /** TODO: it is not necessary to update the guide table every time. But then (1) some additional bookkeeping is required and (2) the guide table method requires a acc./rej. step. **/ _unur_tdr_make_guide_table(gen); /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_tdr_gw_improve_hat() */ /*****************************************************************************/ unuran-1.11.0/src/methods/ssr_struct.h0000644001357500135600000000756314420304141014657 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: ssr_struct.h * * * * PURPOSE: * * declares structures for method SSR * * (Simple Setup, Rejection with universal bounds) * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Information for constructing the generator */ struct unur_ssr_par { double Fmode; /* cdf at mode */ double fm; /* pdf at mode */ double um; /* sqrt of pdf at mode */ }; /*---------------------------------------------------------------------------*/ /* The generator object */ struct unur_ssr_gen { double fm; /* pdf at mode */ double um; /* sqrt of pdf at mode */ double vl, vr; /* parameters for hat function */ double xl, xr; /* partition points of hat */ double al, ar; /* areas below hat in first and secont part */ double A; /* area below hat */ double Aleft, Ain; /* areas below hat in left tails and inside domain of pdf */ double Fmode; /* cdf at mode */ }; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/tdr.h0000644001357500135600000004614114420445767013254 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: tdr.h * * * * PURPOSE: * * function prototypes for method TDR * * (Transformed Density Rejection) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /* =METHOD TDR Transformed Density Rejection =UP Methods_for_CONT =REQUIRED T-concave PDF, dPDF =OPTIONAL mode =SPEED Set-up: slow, Sampling: fast =REINIT supported =REF [GWa92] [HWa95] [HLD04: Cha.4] =DESCRIPTION TDR is an acceptance/rejection method that uses the concavity of a transformed density to construct hat function and squeezes automatically. Such PDFs are called T-concave. Currently the following transformations are implemented and can be selected by setting their @code{c}-values by a unur_tdr_set_c() call: @table @code @item c = 0 T(x) = log(x) @item c = -0.5 T(x) = -1/sqrt(x) @ @ @ @ @ (Default) @end table In future releases the transformations T(x) = -(x)^c will be available for any c with 0 > c > -1. Notice that if a PDF is T-concave for a c then it also T-concave for every c' #include #include #include #include "unur_methods_source.h" #include "x_gen_source.h" #include "hri.h" #include "hri_struct.h" #ifdef UNUR_ENABLE_INFO # include #endif /*---------------------------------------------------------------------------*/ /* Constants */ /* abort sampling after this number of iterations and return UNUR_INFINITY */ #define HRI_EMERGENCY_BREAK (10000) /*---------------------------------------------------------------------------*/ /* Variants: */ #define HRI_VARFLAG_VERIFY 0x01u /* flag for verifying mode */ /*---------------------------------------------------------------------------*/ /* Debugging flags */ /* bit 01 ... pameters and structure of generator (do not use here) */ /* bits 02-12 ... setup */ /* bits 13-24 ... adaptive steps */ /* bits 25-32 ... trace sampling */ #define HRB_DEBUG_REINIT 0x00000010u /* print parameters after reinit */ #define HRI_DEBUG_SAMPLE 0x01000000u /* trace sampling (only if verify mode is on) */ /*---------------------------------------------------------------------------*/ /* Flags for logging set calls */ #define HRI_SET_P0 0x001u /*---------------------------------------------------------------------------*/ #define GENTYPE "HRI" /* type of generator */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_hri_init( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* Initialize new generator. */ /*---------------------------------------------------------------------------*/ static int _unur_hri_reinit( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Reinitialize generator. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_hri_create( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* create new (almost empty) generator object. */ /*---------------------------------------------------------------------------*/ static int _unur_hri_check_par( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Check parameters of given distribution and method */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_hri_clone( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* copy (clone) generator object. */ /*---------------------------------------------------------------------------*/ static void _unur_hri_free( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* destroy generator object. */ /*---------------------------------------------------------------------------*/ static double _unur_hri_sample( struct unur_gen *gen ); static double _unur_hri_sample_check( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* sample from generator */ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ /* the following functions print debugging information on output stream, */ /* i.e., into the LOG file if not specified otherwise. */ /*---------------------------------------------------------------------------*/ static void _unur_hri_debug_init( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print after generator has been initialized has completed. */ /*---------------------------------------------------------------------------*/ static void _unur_hri_debug_sample( const struct unur_gen *gen, double x, double p1, int i0, int i1 ); /*---------------------------------------------------------------------------*/ /* trace sampling. */ /*---------------------------------------------------------------------------*/ #endif #ifdef UNUR_ENABLE_INFO static void _unur_hri_info( struct unur_gen *gen, int help ); /*---------------------------------------------------------------------------*/ /* create info string. */ /*---------------------------------------------------------------------------*/ #endif /*---------------------------------------------------------------------------*/ /* abbreviations */ #define DISTR_IN distr->data.cont /* data for distribution object */ #define PAR ((struct unur_hri_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_hri_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.cont /* data for distribution in generator object */ #define SAMPLE gen->sample.cont /* pointer to sampling routine */ #define HR(x) _unur_cont_HR((x),(gen->distr)) /* call to hazard rate */ /*---------------------------------------------------------------------------*/ #define _unur_hri_getSAMPLE(gen) \ ( ((gen)->variant & HRI_VARFLAG_VERIFY) \ ? _unur_hri_sample_check : _unur_hri_sample ) /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Public: User Interface (API) **/ /*****************************************************************************/ struct unur_par * unur_hri_new( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get default parameters */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* default parameters (pointer to structure) */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_par *par; /* check arguments */ _unur_check_NULL( GENTYPE,distr,NULL ); /* check distribution */ if (distr->type != UNUR_DISTR_CONT) { _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } COOKIE_CHECK(distr,CK_DISTR_CONT,NULL); if (DISTR_IN.hr == NULL) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"HR"); return NULL; } /* allocate structure */ par = _unur_par_new( sizeof(struct unur_hri_par) ); COOKIE_SET(par,CK_HRI_PAR); /* copy input */ par->distr = distr; /* pointer to distribution object */ /* set default values */ PAR->p0 = 1.; /* design point */ par->method = UNUR_METH_HRI; /* method */ par->variant = 0u; /* default variant */ par->set = 0u; /* inidicate default parameters */ par->urng = unur_get_default_urng(); /* use default urng */ par->urng_aux = NULL; /* no auxilliary URNG required */ par->debug = _unur_default_debugflag; /* set default debugging flags */ /* routine for starting generator */ par->init = _unur_hri_init; return par; } /* end of unur_hri_new() */ /*****************************************************************************/ int unur_hri_set_p0( struct unur_par *par, double p0 ) /*----------------------------------------------------------------------*/ /* set design point for algorithm */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* p0 ... design point */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* no verifying is the default */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, HRI ); if (p0 <= par->distr->data.cont.domain[0]) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"p0 <= left boundary"); return UNUR_ERR_PAR_SET; } /* store date */ PAR->p0 = p0; /* changelog */ par->set |= HRI_SET_P0; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_hri_set_p0() */ /*---------------------------------------------------------------------------*/ int unur_hri_set_verify( struct unur_par *par, int verify ) /*----------------------------------------------------------------------*/ /* turn verifying of algorithm while sampling on/off */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* verify ... 0 = no verifying, !0 = verifying */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* no verifying is the default */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, HRI ); /* we use a bit in variant */ par->variant = (verify) ? (par->variant | HRI_VARFLAG_VERIFY) : (par->variant & (~HRI_VARFLAG_VERIFY)); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_hri_set_verify() */ /*---------------------------------------------------------------------------*/ int unur_hri_chg_verify( struct unur_gen *gen, int verify ) /*----------------------------------------------------------------------*/ /* turn verifying of algorithm while sampling on/off */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* verify ... 0 = no verifying, !0 = verifying */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* no verifying is the default */ /*----------------------------------------------------------------------*/ { /* check input */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, HRI, UNUR_ERR_GEN_INVALID ); /* we must not change this switch when sampling has been disabled by using a pointer to the error producing routine */ if (SAMPLE == _unur_sample_cont_error) return UNUR_FAILURE; /* we use a bit in variant */ gen->variant = (verify) ? (gen->variant | HRI_VARFLAG_VERIFY) : (gen->variant & (~HRI_VARFLAG_VERIFY)); /* sampling routine */ SAMPLE = _unur_hri_getSAMPLE(gen); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_hri_chg_verify() */ /*****************************************************************************/ /** Private **/ /*****************************************************************************/ struct unur_gen * _unur_hri_init( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* initialize new generator */ /* */ /* parameters: */ /* params pointer to paramters for building generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ _unur_check_NULL( GENTYPE,par,NULL ); /* check input */ if ( par->method != UNUR_METH_HRI ) { _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); return NULL; } COOKIE_CHECK(par,CK_HRI_PAR,NULL); /* create a new empty generator object */ gen = _unur_hri_create(par); _unur_par_free(par); if (!gen) return NULL; /* check parameters */ if (_unur_hri_check_par(gen) != UNUR_SUCCESS) { _unur_hri_free(gen); return NULL; } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_hri_debug_init(gen); #endif return gen; } /* end of _unur_hri_init() */ /*---------------------------------------------------------------------------*/ int _unur_hri_reinit( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* re-initialize (existing) generator. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int rcode; /* check parameters */ if ( (rcode = _unur_hri_check_par(gen)) != UNUR_SUCCESS) return rcode; /* (re)set sampling routine */ SAMPLE = _unur_hri_getSAMPLE(gen); /* nothing to do */ return UNUR_SUCCESS; } /* end of _unur_hri_reinit() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_hri_create( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* allocate memory for generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* pointer to (empty) generator object with default settings */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_HRI_PAR,NULL); /* create new generic generator object */ gen = _unur_generic_create( par, sizeof(struct unur_hri_gen) ); /* magic cookies */ COOKIE_SET(gen,CK_HRI_GEN); /* set generator identifier */ gen->genid = _unur_set_genid(GENTYPE); /* routines for sampling and destroying generator */ SAMPLE = _unur_hri_getSAMPLE(gen); gen->destroy = _unur_hri_free; gen->clone = _unur_hri_clone; gen->reinit = _unur_hri_reinit; /* copy parameters into generator object */ GEN->p0 = PAR->p0; /* design (splitting) point */ /* default values */ GEN->left_border = 0.; /* left border of domain */ GEN->hrp0 = 0.; /* hazard rate at p0 */ /* initialize variables */ GEN->left_border = 0.; /* left border of domain */ #ifdef UNUR_ENABLE_INFO /* set function for creating info string */ gen->info = _unur_hri_info; #endif /* return pointer to (almost empty) generator object */ return gen; } /* end of _unur_hri_create() */ /*---------------------------------------------------------------------------*/ int _unur_hri_check_par( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* check parameters of given distribution and method */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* set left border and check domain */ if (DISTR.domain[0] < 0.) DISTR.domain[0] = 0.; if (DISTR.domain[1] < UNUR_INFINITY) DISTR.domain[1] = UNUR_INFINITY; GEN->left_border = DISTR.domain[0]; /* check design point */ if (gen->set & HRI_SET_P0) { if (GEN->p0 <= GEN->left_border) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"p0 <= left boundary"); GEN->p0 = GEN->left_border + 1.; } } else { /* p0 not set */ GEN->p0 = GEN->left_border + 1.; } /* compute hazard rate at construction point */ GEN->hrp0 = HR(GEN->p0); if (GEN->hrp0 <= 0. || _unur_FP_is_infinity(GEN->hrp0)) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"design point p0 not valid"); return UNUR_ERR_GEN_CONDITION; } return UNUR_SUCCESS; } /* end of _unur_hri_check_par() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_hri_clone( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* copy (clone) generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to clone of generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { #define CLONE ((struct unur_hri_gen*)clone->datap) struct unur_gen *clone; /* check arguments */ CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_HRI_GEN,NULL); /* create generic clone */ clone = _unur_generic_clone( gen, GENTYPE ); return clone; #undef CLONE } /* end of _unur_hri_clone() */ /*---------------------------------------------------------------------------*/ void _unur_hri_free( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* deallocate generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { /* check arguments */ if( !gen ) /* nothing to do */ return; /* check input */ if ( gen->method != UNUR_METH_HRI ) { _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); return; } COOKIE_CHECK(gen,CK_HRI_GEN,RETURN_VOID); /* we cannot use this generator object any more */ SAMPLE = NULL; /* make sure to show up a programming error */ /* free memory */ _unur_generic_free(gen); } /* end of _unur_hri_free() */ /*****************************************************************************/ double _unur_hri_sample( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { double U, V, E, X, hrx1; double lambda0, p1, lambda1; int i0 = 0; int i1 = 0; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_HRI_GEN,UNUR_INFINITY); /* ------------------- 1st thinning loop ------------------- */ /* parameter for majorizing hazard rate of first component */ lambda0 = GEN->hrp0; /* starting point */ X = GEN->left_border; for(i0=1;;i0++) { /* sample from U(0,1) */ while ( _unur_iszero(U = 1.-_unur_call_urng(gen->urng)) ); /* sample from exponential distribution with scale parameter lambda */ E = -log(U) / lambda0; /* Remark: by this construction E is monotically increasing with the uniform random number generated by the _unur_call_urng() call */ /* next step */ X += E; /* hazard rate at generated point */ hrx1 = HR(X); /* reject or accept */ V = lambda0 * _unur_call_urng(gen->urng); if( V <= hrx1 ) /* accept */ break; if (i0>HRI_EMERGENCY_BREAK) { /* emergency break */ _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"abort computation"); return UNUR_INFINITY; } } /* accept point if not larger than design (split) point */ if (X <= GEN->p0) return X; /* ------------------- 2nd thinning loop ------------------- */ /* parameter for majorizing hazard rate of first component */ lambda1 = hrx1 - lambda0; /* check parameter */ if (lambda1 <= 0.) /* hazard rate not strictly increasing. assume hazard rate satisfies condition (i.e. increasing), and this hazard rate constant between p0 and X. */ return X; /* starting point */ p1 = X; X = GEN->p0; for(i1=1;;i1++) { /* sample from U(0,1) */ while ( _unur_iszero(U = 1.-_unur_call_urng(gen->urng)) ); /* sample from exponential distribution with scale parameter lambda */ E = -log(U) / lambda1; /* next step */ X += E; /* reject or accept */ V = lambda0 + lambda1 * _unur_call_urng(gen->urng); /* squeeze */ if (V <= GEN->hrp0) /* we use hazard rate at design point p0 as squeeze (since HR increasing) */ break; /* hazard rate at generated point */ if (V <= HR(X)) break; if (i1>HRI_EMERGENCY_BREAK) { /* emergency break */ _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"abort computation"); return UNUR_INFINITY; } } return ((X <= p1) ? X : p1); } /* end of _unur_hri_sample() */ /*---------------------------------------------------------------------------*/ double _unur_hri_sample_check( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator (verify mode) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { double U, V, E, X, hrx, hrx1; double lambda0, p1, lambda1; int i0 = 0; int i1 = 0; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_HRI_GEN,UNUR_INFINITY); /* ------------------- 1st thinning loop ------------------- */ /* parameter for majorizing hazard rate of first component */ lambda0 = GEN->hrp0; /* starting point */ X = GEN->left_border; for(i0=1;;i0++) { /* sample from U(0,1) */ while ( _unur_iszero(U = 1.-_unur_call_urng(gen->urng)) ); /* sample from exponential distribution with scale parameter lambda */ E = -log(U) / lambda0; /* Remark: by this construction E is monotically increasing with the uniform random number generated by the _unur_call_urng() call */ /* next step */ X += E; /* hazard rate at generated point */ hrx1 = HR(X); /* reject or accept */ V = lambda0 * _unur_call_urng(gen->urng); /* verify majorizing hazard rate */ if ( (X <= GEN->p0 && (1.+UNUR_EPSILON) * lambda0 < hrx1 ) || (X >= GEN->p0 && (1.-UNUR_EPSILON) * lambda0 > hrx1 ) ) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"HR not increasing"); } if( V <= hrx1 ) /* accept */ break; if (i0>HRI_EMERGENCY_BREAK) { /* emergency break */ _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"abort computation"); return UNUR_INFINITY; } } /* accept point if not larger than design (split) point */ if (X <= GEN->p0) { #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug & HRI_DEBUG_SAMPLE) _unur_hri_debug_sample( gen, X, X, i0, 0 ); #endif return X; } /* ------------------- 2nd thinning loop ------------------- */ /* parameter for majorizing hazard rate of first component */ lambda1 = hrx1 - lambda0; /* check parameter */ if (lambda1 <= 0.) { /* hazard rate not strictly increasing. assume hazard rate satisfies condition (i.e. increasing), and this hazard rate constant between p0 and X. */ #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug & HRI_DEBUG_SAMPLE) _unur_hri_debug_sample( gen, X, X, i0, 0 ); #endif return X; } /* starting point */ p1 = X; X = GEN->p0; for(i1=1;;i1++) { /* sample from U(0,1) */ while ( _unur_iszero(U = 1.-_unur_call_urng(gen->urng)) ); /* sample from exponential distribution with scale parameter lambda */ E = -log(U) / lambda1; /* next step */ X += E; /* reject or accept */ V = lambda0 + lambda1 * _unur_call_urng(gen->urng); /* hazard rate at generated point */ hrx = HR(X); /* verify majorizing hazard rate */ if ( (X <= p1 && (1.+UNUR_EPSILON) * (lambda0+lambda1) < hrx ) || (X >= p1 && (1.-UNUR_EPSILON) * (lambda0+lambda1) > hrx ) ) _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"HR not increasing"); /* squeeze */ if (V <= GEN->hrp0) /* we use hazard rate at design point p0 as squeeze (since HR increasing) */ break; /* hazard rate at generated point */ if (V <= hrx) break; if (i1>HRI_EMERGENCY_BREAK) { /* emergency break */ _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"abort computation"); return UNUR_INFINITY; } } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug & HRI_DEBUG_SAMPLE) _unur_hri_debug_sample( gen, X, p1, i0, i1 ); #endif return ((X <= p1) ? X : p1); } /* end of _unur_hri_sample_check() */ /*****************************************************************************/ /** Auxilliary Routines **/ /*****************************************************************************/ /*****************************************************************************/ /** Debugging utilities **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ void _unur_hri_debug_init( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write info about generator into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_HRI_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: type = continuous univariate random variates\n",gen->genid); fprintf(LOG,"%s: method = HRI (Hazard Rate Increasing)\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); _unur_distr_cont_debug( gen->distr, gen->genid ); fprintf(LOG,"%s: sampling routine = _unur_hri_sample",gen->genid); if (gen->variant & HRI_VARFLAG_VERIFY) fprintf(LOG,"_check()\n"); else fprintf(LOG,"()\n"); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: design point p0 = %g (HR(p0)=%g)",gen->genid,GEN->p0,GEN->hrp0); _unur_print_if_default(gen,HRI_SET_P0); fprintf(LOG,"\n%s: left boundary = %g\n",gen->genid,GEN->left_border); fprintf(LOG,"%s:\n",gen->genid); fflush(LOG); } /* end of _unur_hri_debug_init() */ /*---------------------------------------------------------------------------*/ void _unur_hri_debug_sample( const struct unur_gen *gen, double x, double p1, int i0, int i1 ) /*----------------------------------------------------------------------*/ /* write info about generated point into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* x ... generated point */ /* p1 ... point generated at first thing loop */ /* i0 ... number of iterations in first thinning loop */ /* i1 ... number of iterations in second thinning loop */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_HRI_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s: X = %g\t(p1=%g)\t#iterations = %d + %d = %d",gen->genid, x, p1, i0, i1, i0+i1); if (i1) fprintf(LOG," 2nd loop\n"); else fprintf(LOG,"\n"); } /* end of _unur_hri_debug_init() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_INFO /*---------------------------------------------------------------------------*/ void _unur_hri_info( struct unur_gen *gen, int help ) /*----------------------------------------------------------------------*/ /* create character string that contains information about the */ /* given generator object. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* help ... whether to print additional comments */ /*----------------------------------------------------------------------*/ { struct unur_string *info = gen->infostr; int samplesize = 10000; /* generator ID */ _unur_string_append(info,"generator ID: %s\n\n", gen->genid); /* distribution */ _unur_string_append(info,"distribution:\n"); _unur_distr_info_typename(gen); _unur_string_append(info," functions = HR\n"); _unur_string_append(info," domain = (%g, %g)\n", DISTR.domain[0],DISTR.domain[1]); _unur_string_append(info,"\n"); /* method */ _unur_string_append(info,"method: HRI (Hazard Rate Increasing)\n"); _unur_string_append(info,"\n"); /* performance */ _unur_string_append(info,"performance characteristics:\n"); _unur_string_append(info," E[#iterations] = %.2f [approx.]\n", unur_test_count_urn(gen,samplesize,0,NULL)/((double)samplesize)); _unur_string_append(info,"\n"); /* parameters */ if (help) { _unur_string_append(info,"parameters:\n"); _unur_string_append(info," p0 = %g %s\n", GEN->p0, (gen->set & HRI_SET_P0) ? "" : "[default]"); if (gen->variant & HRI_VARFLAG_VERIFY) _unur_string_append(info," verify = on\n"); _unur_string_append(info,"\n"); } /* Hints */ if (help) { if ( !(gen->set & HRI_SET_P0)) _unur_string_append(info,"[ Hint: %s ]\n", "You can set the design point \"p0\" to increase performance."); _unur_string_append(info,"\n"); } } /* end of _unur_hri_info() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_INFO */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/dgt.h0000644001357500135600000002012514420445767013233 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: dgt.h * * * * PURPOSE: * * function prototypes for method DGT * * ((Discrete) Guide Table method (indexed search)) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /* =METHOD DGT (Discrete) Guide Table method (indexed search) =UP Methods_for_DISCR =REQUIRED probability vector (PV) =SPEED Set-up: slow (linear with the vector-length), Sampling: very fast =REINIT supported =REF [CAa74] [HLD04: Sect.3.1.2] =DESCRIPTION DGT samples from arbitrary but finite probability vectors. Random numbers are generated by the inversion method, i.e., @enumerate @item Generate a random number U ~ U(0,1). @item Find smallest integer I such that F(I) = P(X<=I) >= U. @end enumerate Step (2) is the crucial step. Using sequential search requires @i{O(E(X))} comparisons, where @i{E(X)} is the expectation of the distribution. Indexed search, however, uses a guide table to jump to some @i{I'} <= @i{I} near @i{I} to find @i{X} in constant time. Indeed the expected number of comparisons is reduced to 2, when the guide table has the same size as the probability vector (this is the default). For larger guide tables this number becomes smaller (but is always larger than 1), for smaller tables it becomes larger. For the limit case of table size 1 the algorithm simply does sequential search (but uses a more expensive setup then method DSS (@pxref{DSS}). On the other hand the setup time for guide table is @i{O(N)}, where @i{N} denotes the length of the probability vector (for size 1 no preprocessing is required). Moreover, for very large guide tables memory effects might even reduce the speed of the algorithm. So we do not recommend to use guide tables that are more than three times larger than the given probability vector. If only a few random numbers have to be generated, (much) smaller table sizes are better. The size of the guide table relative to the length of the given probability vector can be set by a unur_dgt_set_guidefactor() call. There exist two variants for the setup step which can be set by a unur_dgt_set_variant() call: Variants 1 and 2. Variant 2 is faster but more sensitive to roundoff errors when the guide table is large. By default variant 2 is used for short probability vectors (@i{N}<1000) and variant 1 otherwise. By default the probability vector is indexed starting at @code{0}. However this can be changed in the distribution object by a unur_distr_discr_set_domain() call. The method also works when no probability vector but a PMF is given. However, then additionally a bounded (not too large) domain must be given or the sum over the PMF. In the latter case the domain of the distribution is trucated (see unur_distr_discr_make_pv() for details). =HOWTOUSE Create an object for a discrete distribution either by setting a probability vector or a PMF. The performance can be slightly influenced by setting the size of the used table which can be changed by unur_dgt_set_guidefactor(). It is possible to change the parameters and the domain of the chosen distribution and run unur_reinit() to reinitialize the generator object. =END */ /*---------------------------------------------------------------------------*/ /* Routines for user interface */ /* =ROUTINES */ UNUR_PAR *unur_dgt_new( const UNUR_DISTR *distribution ); /* Get default parameters for generator. */ /*...........................................................................*/ int unur_dgt_set_guidefactor( UNUR_PAR *parameters, double factor ); /* Set size of guide table relative to length of PV. Larger guide tables result in faster generation time but require a more expensive setup. Sizes larger than 3 are not recommended. If the relative size is set to 0, sequential search is used. However, this is not recommended, except in exceptional cases, since method DSS (@pxref{DSS}) is has almost no setup and is thus faster (but requires the sum over the PV as input parameter). Default is @code{1}. */ int unur_dgt_set_variant( UNUR_PAR *parameters, unsigned variant ); /* Set variant for setup step. Possible values are @code{1} or @code{2}. Variant @code{2} is faster but more sensitive to roundoff errors when the guide table is large. By default variant @code{2} is used for short probability vectors (@i{N}<1000) and variant @code{1} otherwise. */ /* =END */ /*---------------------------------------------------------------------------*/ /** NOT IN MANUAL **/ int unur_dgt_eval_invcdf_recycle( const UNUR_GEN *generator, double u, double *recycle ); /* Compute the @var{U} quantile of the discrete distribution in @var{generator}, i.e., the smallest integer I such that P(X<=I) >= U. If @var{u} is out of the domain (0,1) then @code{unur_errno} is set to @code{UNUR_ERR_DOMAIN} and the respective bound of the domain of the distribution are returned. If @var{recycle} is not NULL then @var{u} is recycled, i.e., the value of [ P(X<=I) - U] / [ P(X<=I) - P(X<=I-1) ] is stored in @var{recycle}. */ int unur_dgt_eval_invcdf( const UNUR_GEN *generator, double u ); /* Short for unur_dgt_eval_invcdf_recycle( generator, u, NULL). */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/srou.h0000644001357500135600000002773414420445767013462 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: srou.h * * * * PURPOSE: * * function prototypes for method SROU * * (Simple universal generator, ratio-of-uniforms method) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /* =METHOD SROU Simple Ratio-Of-Uniforms method =UP Methods_for_CONT =REQUIRED T-concave PDF, mode, area =SPEED Set-up: fast, Sampling: slow =REINIT supported =REF [LJa01] [LJa02] [HLD04: Sect.6.3.1, Sect.6.3.2, Sect.6.4.1, Alg.6.4, Alg.6.5, Alg.6.7] =DESCRIPTION SROU is based on the ratio-of-uniforms method (@pxref{Ratio-of-Uniforms}) that uses universal inequalities for constructing a (universal) bounding rectangle. It works for all @i{T}-concave distributions, including log-concave and @i{T}-concave distributions with @unurmath{T(x) = -1/\sqrt{x}.} Moreover an (optional) parameter @code{r} can be given, to adjust the generator to the given distribution. This parameter is strongly related to the parameter @code{c} for transformed density rejection (@pxref{TDR}) via the formula @i{c = -r/(r+1)}. The rejection constant increases with higher values for @code{r}. On the other hand, the given density must be @unurmath{T_c}-concave for the corresponding @i{c}. The default setting for @code{r} is 1 which results in a very simple code. (For other settings, sampling uniformly from the acceptance region is more complicated.) Optionally the CDF at the mode can be given to increase the performance of the algorithm. Then the rejection constant is reduced by 1/2 and (if @code{r=1}) even a universal squeeze can (but need not be) used. A way to increase the performance of the algorithm when the CDF at the mode is not provided is the usage of the mirror principle (only if @code{r=1}). However, using squeezes and using the mirror principle is only recommended when the PDF is expensive to compute. The exact location of the mode and/or the area below the PDF can be replace by appropriate bounds. Then the algorithm still works but has larger rejection constants. =HOWTOUSE SROU works for any continuous univariate distribution object with given @unurmath{T_c}-concave PDF with @unurmath{c<1,}) mode and area below PDF. Optional the CDF at the mode can be given to increase the performance of the algorithm by means of the unur_srou_set_cdfatmode() call. Additionally squeezes can be used and switched on via unur_srou_set_usesqueeze() (only if @code{r=1}). A way to increase the performance of the algorithm when the CDF at the mode is not provided is the usage of the mirror principle which can be swithced on by means of a unur_srou_set_usemirror() call (only if @code{r=1}) . However using squeezes and using the mirror principle is only recommended when the PDF is expensive to compute. The parameter @code{r} can be given, to adjust the generator to the given distribution. This parameter is strongly related parameter @code{c} for transformed density rejection via the formula @i{c = -r/(r+1)}. The parameter @code{r} can be any value larger than or equal to 1. Values less then 1 are automatically set to 1. The rejection constant depends on the chosen parameter @code{r} but not on the particular distribution. It is 4 for @code{r} equal to 1 and higher for higher values of @code{r}. It is important to note that different algorithms for different values of @code{r}: If @code{r} equal to 1 this is much faster than the algorithm for @code{r} greater than 1. The default setting for @code{r} is 1. If the (exact) area below the PDF is not known, then an upper bound can be used instead (which of course increases the rejection constant). But then the squeeze flag must not be set and unur_srou_set_cdfatmode() must not be used. If the exact location of the mode is not known, then use the approximate location and provide the (exact) value of the PDF at the mode by means of the unur_srou_set_pdfatmode() call. But then unur_srou_set_cdfatmode() must not be used. Notice, that a (slow) numerical mode finder will be used if no mode is given at all. It is even possible to give an upper bound for the PDF only. However, then the (upper bound for the) area below the PDF has to be multiplied by the ratio between the upper bound and the lower bound of the PDF at the mode. Again setting the squeeze flag and using unur_srou_set_cdfatmode() is not allowed. It is possible to change the parameters and the domain of the chosen distribution and run unur_reinit() to reinitialize the generator object. Notice, that derived parameters like the mode must also be (re-) set if the parameters or the domain has be changed. Moreover, if the PDF at the mode has been provided by a unur_srou_set_pdfatmode() call, additionally unur_srou_chg_pdfatmode() must be used (otherwise this call is not necessary since then this figure is computed directly from the PDF). There exists a test mode that verifies whether the conditions for the method are satisfied or not while sampling. It can be switched on by calling unur_srou_set_verify() and unur_srou_chg_verify(), respectively. Notice however that sampling is (a little bit) slower then. =END */ /*---------------------------------------------------------------------------*/ /* Routines for user interface */ /* =ROUTINES */ UNUR_PAR *unur_srou_new( const UNUR_DISTR *distribution ); /* Get default parameters for generator. */ /*...........................................................................*/ int unur_srou_set_r( UNUR_PAR *parameters, double r ); /* Set parameter @var{r} for transformation. Only values greater than or equal to 1 are allowed. The performance of the generator decreases when @var{r} is increased. On the other hand @var{r} must not be set to small, since the given density must be T_c-concave for @i{c = -r/(r+1)}. @emph{Notice:} If @var{r} is set to @code{1} a simpler and much faster algorithm is used then for @var{r} greater than one. For computational reasons values of @var{r} that are greater than @code{1} but less than @code{1.01} are always set to @code{1.01}. Default is @code{1}. */ int unur_srou_set_cdfatmode( UNUR_PAR *parameters, double Fmode ); /* Set CDF at mode. When set, the performance of the algorithm is increased by factor 2. However, when the parameters of the distribution are changed unur_srou_chg_cdfatmode() has to be used to update this value. Default: not set. */ int unur_srou_set_pdfatmode( UNUR_PAR *parameters, double fmode ); /* Set pdf at mode. When set, the PDF at the mode is never changed. This is to avoid additional computations, when the PDF does not change when parameters of the distributions vary. It is only useful when the PDF at the mode does not change with changing parameters of the distribution. @emph{IMPORTANT:} This call has to be executed after a possible call of unur_srou_set_r(). Default: not set. */ int unur_srou_set_usesqueeze( UNUR_PAR *parameters, int usesqueeze ); /* Set flag for using universal squeeze (default: off). Using squeezes is only useful when the evaluation of the PDF is (extremely) expensive. Using squeezes is automatically disabled when the CDF at the mode is not given (then no universal squeezes exist). Squeezes can only be used if @code{r=1}. Default is FALSE. */ int unur_srou_set_usemirror( UNUR_PAR *parameters, int usemirror ); /* Set flag for using mirror principle (default: off). Using the mirror principle is only useful when the CDF at the mode is not known and the evaluation of the PDF is rather cheap compared to the marginal generation time of the underlying uniform random number generator. It is automatically disabled when the CDF at the mode is given. (Then there is no necessity to use the mirror principle. However disabling is only done during the initialization step but not at a re-initialization step.) The mirror principle can only be used if @code{r=1}. Default is FALSE. */ int unur_srou_set_verify( UNUR_PAR *parameters, int verify ); /* */ int unur_srou_chg_verify( UNUR_GEN *generator, int verify ); /* Turn verifying of algorithm while sampling on/off. If the condition squeeze(@i{x}) <= PDF(@i{x}) <= hat(@i{x}) is violated for some @i{x} then @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. However notice that this might happen due to round-off errors for a few values of @i{x} (less than 1%). Default is FALSE. */ /*...........................................................................*/ int unur_srou_chg_cdfatmode( UNUR_GEN *generator, double Fmode ); /* Change CDF at mode of distribution. unur_reinit() must be executed before sampling from the generator again. */ int unur_srou_chg_pdfatmode( UNUR_GEN *generator, double fmode ); /* Change PDF at mode of distribution. unur_reinit() must be executed before sampling from the generator again. */ /* =END */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/ninv_newton.ch0000644001357500135600000002556314420445767015177 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: ninv_newton.ch * * * * Routines for Newton's root finding algorithm. * * * ***************************************************************************** * * * Copyright (c) 2000-2009 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * ***************************************************************************** * * * REFERENCES: * * [1] Neumaier A. (to be published): Introduction to numerical analysis, * * Cambridge University Press * * * ***************************************************************************** * * * For a given U find X with F(X) - U = 0. * * * * Method: damped Newton method. * * * *****************************************************************************/ /*****************************************************************************/ /** Newton method **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Constants */ /* maximal number of steps to leave flat region */ #define MAX_FLAT_COUNT (40) /*---------------------------------------------------------------------------*/ double _unur_ninv_newton( const struct unur_gen *gen, double U ) /*----------------------------------------------------------------------*/ /* sample from generator (use Newton's method) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* U ... random number (uniform distribution) */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { double x; /* point for netwon-iteration */ double fx; /* cdf at x */ double dfx; /* pdf at x */ double fxabs; /* absolute valuo of fx */ double xtmp, fxtmp; /* temprary variables for x and fx */ double xold; /* remember last values for stopping criterion */ double fxtmpabs; /* fabs of fxtmp */ double damp; /* damping factor */ double step; /* helps to escape from flat regions of the cdf */ int i; /* counter for for-loop, index */ int flat_count; /* counter of steps in flat region */ double rel_u_resolution; /* relative u resolution */ int x_goal, u_goal; /* whether precision goal is reached */ /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_NINV_GEN,UNUR_INFINITY); /* compute relative u resolution */ rel_u_resolution = ( (GEN->u_resolution > 0.) ? (GEN->Umax - GEN->Umin) * GEN->u_resolution : UNUR_INFINITY ); /* -- 1. initialize starting interval -- */ if (GEN->table_on) { /* -- 1a. use table -- */ /* 0 <= i <= table_size-2 */ if ( _unur_FP_same(GEN->CDFmin,GEN->CDFmax) ) { /* CDF values in table too close, so we use median point since */ /* there is no difference between CDF values. */ i = GEN->table_size/2; } else { i = (int) ( GEN->table_size * (U - GEN->CDFmin) / (GEN->CDFmax - GEN->CDFmin) ); if (i<0) i = 0; else if (i > GEN->table_size - 2) i = GEN->table_size - 2; } if (_unur_FP_is_infinity(GEN->table[i+1])) { x = GEN->table[i]; fx = GEN->f_table[i]; } else { x = GEN->table[i+1]; fx = GEN->f_table[i+1]; } } else { /* 1b. -- no table available -- */ x = GEN->s[0]; fx = GEN->CDFs[0]; } /* -- 1c. check for boundary of truncated domain -- */ if ( x < DISTR.trunc[0] ){ x = DISTR.trunc[0]; fx = GEN->Umin; /* = CDF(x) */ } else if ( x > DISTR.trunc[1] ){ x = DISTR.trunc[1]; fx = GEN->Umax; /* = CDF(x) */ } /* -- 1z. compute values for starting point -- */ fx -= U; dfx = PDF(x); fxabs = fabs(fx); xold = x; /* there is no old value yet */ damp = 2.; /* to be halved at least once */ step = 1.; /* -- 2. Newton iteration -- */ for (i=0; i < GEN->max_iter; i++) { flat_count = 0; while (_unur_iszero(dfx)) { /* function flat at x */ /* printf("step: %g, x: %g, fx: %g, dfx: %g\n",step, x, fx, dfx); */ if (_unur_iszero(fx)) /* exact hit -> leave while-loop */ break; if (fx > 0.) { /* try another x */ xtmp = x - step; xtmp = _unur_max( xtmp, DISTR.domain[0] ); } else { xtmp = x + step; xtmp = _unur_min( xtmp, DISTR.domain[1] ); } fxtmp = CDF(xtmp) - U; fxtmpabs = fabs(fxtmp); if ( fxtmpabs < fxabs ) { /* improvement, update x */ /* printf("fxabs: %g tmpabs: %g\n", fxabs, fxtmpabs); */ step = 1.; /* set back stepsize */ x = xtmp; fx = fxtmp; } else if ( fxtmp*fx < 0. ) { /* step was too large, don't update x */ step /= 2.; } else { /* step was too short, update x */ step *= 2.; x = xtmp; fx = fxtmp; } dfx = PDF(x); fxabs = fabs(fx); if (flat_count < MAX_FLAT_COUNT) flat_count++; else { _unur_error(gen->genid,UNUR_ERR_GEN_SAMPLING, "Newton's method cannot leave flat region"); x = _unur_max( x, DISTR.trunc[0]); x = _unur_min( x, DISTR.trunc[1]); return x; } } /* end of while-loop, (leaving flat region) */ step = 1.; /* set back stepsize */ if (_unur_iszero(fx)) /* exact hit -> finished */ break; if (_unur_isfinite(dfx)) { do { /* newton-step (damped if nececcary) */ damp /= 2.; xtmp = x - damp * fx/dfx; /* make sure that new point is inside (truncated) domain */ xtmp = _unur_min( xtmp, DISTR.trunc[1] ); xtmp = _unur_max( xtmp, DISTR.trunc[0] ); fxtmp = CDF(xtmp) - U; } while (fabs(fxtmp) > fxabs * (1.+UNUR_SQRT_DBL_EPSILON)); /* no improvement */ } else { /* we cannot use Newton's rule if the derivative is not finite. */ /* this happens when we hit a pole of the PDF. */ /* use a bisection step instead. */ xtmp = 0.5*(x + xold); fxtmp = CDF(xtmp) - U; } /* updation variables according to newton-step */ damp = 2.; /* set back factor for damping */ xold = x; /* remember last value of x */ x = xtmp; /* update x */ fx = fxtmp; /* update function value at x */ dfx = PDF(x); /* update derivative sof fx at x */ fxabs = fabs(fx); /* update absolute value of fx */ /* -- 2z. check stopping criterions -- */ if ( GEN->x_resolution > 0. ) { /* check x-error */ /* we use a combination of absolute and relative x-error: */ /* x-error < x-resolution * fabs(x) + x-resolution^2 */ if ( _unur_iszero(fx) || /* exact hit */ fabs(x-xold) < GEN->x_resolution * (fabs(x) + GEN->x_resolution) ) { x_goal = TRUE; } else x_goal = FALSE; } else { /* no check */ x_goal = TRUE; } if ( GEN->u_resolution > 0. ) { /* check u-error */ /* (we use a slightly smaller maximal tolerated error than given by user) */ if ( fabs(fx) < 0.9 * rel_u_resolution ) { /* relative u resolution */ u_goal = TRUE; } else if ( _unur_FP_same(xold, x) ) { /* sharp peak or pole */ _unur_warning(gen->genid,UNUR_ERR_GEN_SAMPLING, "sharp peak or pole: accuracy goal in u cannot be reached"); u_goal = TRUE; } else u_goal = FALSE; } else { u_goal = TRUE; } /* goal reached ? */ if (x_goal && u_goal) /*finished*/ break; } /* end of for-loop (MAXITER reached -> finished) */ if (i >= GEN->max_iter) _unur_warning(gen->genid,UNUR_ERR_GEN_SAMPLING, "max number of iterations exceeded: accuracy goal might not be reached"); /* make sure that result is within boundaries of (truncated) domain */ x = _unur_max( x, DISTR.trunc[0]); x = _unur_min( x, DISTR.trunc[1]); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file (in case error) */ if (gen->debug & NINV_DEBUG_SAMPLE) _unur_ninv_debug_sample(gen, U, x, fx, i); #endif return x; } /* end of _unur_ninv_sample_newton() */ /*---------------------------------------------------------------------------*/ #undef MAX_FLAT_COUNT /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/tabl_info.ch0000644001357500135600000001745114420445767014565 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: tabl_info.c * * * * TYPE: continuous univariate random variate * * METHOD: rejection form piecewise constant hat * * (Ahren's table method) * * * * DESCRIPTION: * * Routines for creating info strings. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_INFO /*---------------------------------------------------------------------------*/ void _unur_tabl_info( struct unur_gen *gen, int help ) /*----------------------------------------------------------------------*/ /* create character string that contains information about the */ /* given generator object. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* help ... whether to print additional comments */ /*----------------------------------------------------------------------*/ { struct unur_string *info = gen->infostr; struct unur_distr *distr = gen->distr; /* generator ID */ _unur_string_append(info,"generator ID: %s\n\n", gen->genid); /* distribution */ _unur_string_append(info,"distribution:\n"); _unur_distr_info_typename(gen); _unur_string_append(info," functions = PDF\n"); _unur_string_append(info," domain = (%g, %g)", DISTR.trunc[0],DISTR.trunc[1]); if (gen->distr->set & UNUR_DISTR_SET_TRUNCATED) { _unur_string_append(info," [truncated from (%g, %g)]", DISTR.domain[0],DISTR.domain[1]); } _unur_string_append(info,"\n"); _unur_string_append(info," mode = %g %s\n", unur_distr_cont_get_mode(distr), (distr->set & UNUR_DISTR_SET_MODE_APPROX) ? "[numeric.]" : ""); _unur_string_append(info," area(PDF) = "); if (gen->distr->set & UNUR_DISTR_SET_PDFAREA) _unur_string_append(info,"%g\n", DISTR.area); else _unur_string_append(info,"[not set: use 1.0]\n"); _unur_string_append(info,"\n"); /* if (help) { */ /* _unur_string_append(info,"\n"); */ /* } */ /* method */ _unur_string_append(info,"method: TABL (Ahrens' TABLe Method)\n"); _unur_string_append(info," variant = "); if (gen->variant & TABL_VARIANT_IA) _unur_string_append(info,"immediate acceptance [ia = on]\n"); else _unur_string_append(info,"acceptance/rejection [ia = off]\n"); _unur_string_append(info,"\n"); /* performance */ _unur_string_append(info,"performance characteristics:\n"); _unur_string_append(info," area(hat) = %g\n", GEN->Atotal); _unur_string_append(info," rejection constant "); if (distr->set & UNUR_DISTR_SET_PDFAREA) _unur_string_append(info,"= %g\n", GEN->Atotal/DISTR.area); else _unur_string_append(info,"<= %g\n", GEN->Atotal/GEN->Asqueeze); _unur_string_append(info," area ratio squeeze/hat = %g\n", GEN->Asqueeze/GEN->Atotal); _unur_string_append(info," # intervals = %d\n", GEN->n_ivs); _unur_string_append(info,"\n"); /* parameters */ if (help) { _unur_string_append(info,"parameters:\n"); if (gen->variant & TABL_VARIANT_IA) _unur_string_append(info," variant_ia = on [default]\n"); else _unur_string_append(info," variant_ia = off\n"); _unur_string_append(info," max_sqhratio = %g %s\n", GEN->max_ratio, (gen->set & TABL_SET_MAX_SQHRATIO) ? "" : "[default]"); _unur_string_append(info," max_intervals = %d %s\n", GEN->max_ivs_info, (gen->set & TABL_SET_MAX_IVS) ? "" : "[default]"); if (gen->variant & TABL_VARFLAG_VERIFY) _unur_string_append(info," verify = on\n"); if (gen->variant & TABL_VARFLAG_PEDANTIC) _unur_string_append(info," pedantic = on\n"); _unur_string_append(info,"\n"); /* Not displayed: int unur_tabl_set_cpoints( UNUR_PAR *parameters, int n_cpoints, const double *cpoints ); int unur_tabl_set_nstp( UNUR_PAR *parameters, int n_stp ); int unur_tabl_set_useear( UNUR_PAR *parameters, int useear ); int unur_tabl_set_areafraction( UNUR_PAR *parameters, double fraction ); int unur_tabl_set_usedars( UNUR_PAR *parameters, int usedars ); int unur_tabl_set_darsfactor( UNUR_PAR *parameters, double factor ); int unur_tabl_set_variant_splitmode( UNUR_PAR *parameters, unsigned splitmode ); int unur_tabl_set_slopes( UNUR_PAR *parameters, const double *slopes, int n_slopes ); int unur_tabl_set_guidefactor( UNUR_PAR *parameters, double factor ); int unur_tabl_set_boundary( UNUR_PAR *parameters, double left, double right ); */ } /* Hints */ if (help) { if ( !(gen->set & TABL_SET_MAX_SQHRATIO) ) _unur_string_append(info,"[ Hint: %s ]\n", "You can set \"max_sqhratio\" closer to 1 to decrease rejection constant." ); if (GEN->Asqueeze/GEN->Atotal < GEN->max_ratio) _unur_string_append(info,"[ Hint: %s ]\n", "You should increase \"max_intervals\" to obtain the desired rejection constant." ); _unur_string_append(info,"\n"); } } /* end of _unur_tabl_info() */ /*---------------------------------------------------------------------------*/ #endif /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/pinv.c0000644001357500135600000010022514420445767013424 00000000000000/***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: pinv.c * * * * TYPE: continuous univariate random variate * * METHOD: Polynomial interpolation based INVersion of CDF * * * * DESCRIPTION: * * Compute values of CDF incrementally and interpolate resulting points * * by polynomials. * * * * Integration: adaptive Gauss-Lobatto integration with 5 points * * Interpolation: Newton recursion for interpolating polynomial * * * * REQUIRED: * * pointer to the PDF, center of distribution * * * * OPTIONAL: * * pointer to CDF, pointer to derivative of PDF * * * ***************************************************************************** * * * Copyright (c) 2008-2010 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * ***************************************************************************** * * * REFERENCES: * * * * [1] Derflinger, Gerhard, H{\"o}rmann, Wolfgang, and Leydold, Josef: * * Random Variate Generation by Numerical Inversion when only the * * Density Is Known. ACM Trans. Model. Comput. Simul. (2010), * * to appear. * * See also Research Report Series of the Department of * * Statistics and Mathematics at WU Vienna, No. 90, June 2009. * * http://epub.wu.ac.at/, oai:epub.wu-wien.ac.at:epub-wu-01_f41 * * * * [2] H{\"o}rmann, Wolfgang and Leydold, Josef: * * Continuous Random Variate Generation by Fast Numerical Inversion, * * ACM Trans. Model. Comput. Simul. 13(4), pp. 347--362, 2003. * * * ***************************************************************************** * * * Method PINV combines numerical integration with interpolation of the * * inverse CDF. * * * * 1. Preprocessing: * * * * 1a. Estimate computationally relevant domain (support) of PDF * * (finite interval where PDF is above some threshold value). * * _unur_pinv_relevant_support() * * _unur_pinv_searchborder() * * * * 1b. Compute area below PDF over relevant domain approximately. * * _unur_pinv_approx_pdfarea() * * * * 1c. Compute computational domain where inverse CDF is approximated * * (interval where we safely can compute coefficients of * * interpolating polynomial). * * _unur_pinv_computational_domain() * * _unur_pinv_cut() * * _unur_pinv_cut_bisect() * * _unur_pinv_cut_CDF() * * * * 1d. Compute area below PDF over relevant domain with requested * * accuracy and store subinterval boundaries and corresponding * * from adaptive integration. * * _unur_pinv_pdfarea() * * * * 2. Interpolation: * * * * 2a. Compute coefficients for interpolating polynomial for * * fixed (sub-) interval. * * _unur_pinv_newton_create() * * _unur_pinv_chebyshev_points() * * _unur_pinv_newton_cpoints() * * * * 2b. Evaluate interpolating polynomial. * * _unur_pinv_newton_eval() * * * * 2c. Estimate approximation error for given interpolating polynomial. * * _unur_pinv_newton_maxerror() * * _unur_pinv_newton_testpoints() * * _unur_pinv_cubic_hermite_monotone() * * * * * * Currently the following methods are implemented: * * * * Quadrature (Integration): * * Adaptive Gauss-Lobatto integration with 5 points. * * see utils/lobatto.c * * * * Interpolation: * * Newton recursion for coefficients of polynomial * * ("Newton interpolation"). * * * * Hermite interpolation [2] (as the limit case with double and * * tripple nodes). * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* enable additional code for development */ /* #define PINV_DEVEL */ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include #include #include "unur_methods_source.h" #include "x_gen_source.h" #include "pinv.h" #include "pinv_struct.h" /*---------------------------------------------------------------------------*/ /* Constants */ /* -- Global parameters */ #define MAX_ORDER (17) /* Maximum order of Newton interpolation polynomial */ #define PINV_UERROR_CORRECTION (0.9) /* PINV tries to create an approximation of the inverse CDF where the */ /* U-error is bounded by the given u-resolution. However, the error caused */ /* by cutting off the tails introduces some additional errors which must be */ /* corrected. Thus the upper bound for the pure approximation error of the */ /* interpolation is set to PINV_UERROR_CORRECTION * u-resolution. */ #define PINV_DEFAULT_MAX_IVS (10000) /* Default for maximum number of subintervals */ /* -- Gauss-Lobatto integration */ #define PINV_MAX_LOBATTO_IVS (20001) /* Maximum number of subintervals for adaptive Gauss-Lobatto integration. */ /* We keep this number fixed (independent of the maximum number of */ /* subintervals for Newton interpolation), since the number of these */ /* subintervals does neither depend on the order of the interpolating */ /* polynomial nor on the requested u-resolution. */ /* */ /* Remark: This parameter MUST NOT be smaller than 2 !! */ /* -- 1. Preprocessing */ #define PINV_PDFLLIM (1.e-13) /* Threshold value used for finding the boundary of the computational */ /* domain. When starting the search at some point x0 then the search stops */ /* when a point x is found where PDF(x) approx. PDF(x0) * PINV_PDFLLIM. */ #define PINV_UERROR_AREA_APPROX (1.e-5) /* Tolerated relative area when computing the area below the PDF */ /* approximately in Step 1b. */ #define PINV_TAILCUTOFF_FACTOR (0.05) #define PINV_TAILCUTOFF_MAX (1.e-10) /* For unbounded domains the tails has to be cut off. We use the given */ /* u-resolution for finding the cut points. (The probability for each of the */ /* chopped regions should be less than */ /* HINV_TAILCUTOFF_FACTOR * u-resolution.) */ /* However, the tail probabilities should not be greater than some threshold */ /* value, given by PINV_TAILCUTOFF_MAX which reflects the precision of the */ /* used stream of uniform pseudo-random numbers (typically about 2^32). */ /* However, for computational reasons we use a value that is at least twice */ /* the machine epsilon for the right hand boundary. */ /* -- 2. Newton interpolation */ #define PINV_UTOL_CORRECTION (0.05) /* We use a smaller tolerance when computing the Gauss-Lobatto integral for */ /* the PDF between construction points of the Newton polynomial. */ #define PINV_MAX_ITER_IVS (10 * GEN->max_ivs) /* maximum number of iterations for computing intervals for Newtwon */ /* interpolation polynomials. Obviously it should be larger than the maximum */ /* number of intervals (or the latter can be reduced). */ #define PINV_GUIDE_FACTOR (1) /* relative size of guide table for finding the subinterval corresponding */ /* to the given U-value. */ /*---------------------------------------------------------------------------*/ /* Variants */ #define PINV_VARIANT_PDF 0x0010u /* use PDF and Lobatto integration [ if not present, use CDF ] */ #define PINV_VARIANT_UPOINTS 0x0040u /* use Chebyshev points in u scale */ #define PINV_VARIANT_KEEPCDF 0x0080u /* keep table for integration */ /*---------------------------------------------------------------------------*/ /* Debugging flags */ /* bit 01 ... pameters and structure of generator (do not use here) */ /* bits 02-12 ... setup */ /* bits 13-24 ... adaptive steps */ /* bits 25-32 ... trace sampling */ #define PINV_DEBUG_REINIT 0x00000002u /* print parameters after reinit */ #define PINV_DEBUG_TABLE 0x00000010u /* print table */ #define PINV_DEBUG_SEARCHBD 0x00010000u /* trace search boundary */ #define PINV_DEBUG_ITABLE 0x00020000u /* print table of integral values */ /*---------------------------------------------------------------------------*/ /* Flags for logging set calls */ #define PINV_SET_ORDER 0x0001u /* order of polynomial */ #define PINV_SET_ORDER_COR 0x1000u /* ... corrected */ #define PINV_SET_SMOOTH 0x0002u /* smoothness of interpolant */ #define PINV_SET_SMOOTH_COR 0x2000u /* ... corrected */ #define PINV_SET_U_RESOLUTION 0x0004u /* maximal error in u */ #define PINV_SET_UPOINTS 0x0008u /* use Chebyshev points in u scale */ #define PINV_SET_BOUNDARY 0x0010u /* boundary of computational region */ #define PINV_SET_SEARCHBOUNDARY 0x0020u /* search for boundary */ #define PINV_SET_VARIANT 0x0040u /* variant of algorithm */ #define PINV_SET_MAX_IVS 0x0080u /* maximum number of subintervals */ #define PINV_SET_KEEPCDF 0x0100u /* keep table for integration */ #define PINV_SET_N_EXTRA_TP 0x4000u /* number of extra test points */ /*---------------------------------------------------------------------------*/ #define GENTYPE "PINV" /* type of generator */ /*---------------------------------------------------------------------------*/ /*........................*/ /* file: pinv_newset.ch */ /*........................*/ /* See pinv.h for 'new', 'set', and 'get' calls. */ /*......................*/ /* file: pinv_init.ch */ /*......................*/ static struct unur_gen *_unur_pinv_init (struct unur_par *par); /*---------------------------------------------------------------------------*/ /* Initialize new generator. */ /*---------------------------------------------------------------------------*/ /* static int _unur_pinv_reinit (struct unur_gen *gen); */ /*---------------------------------------------------------------------------*/ /* Reinitialize generator. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_pinv_create (struct unur_par *par); /*---------------------------------------------------------------------------*/ /* create new (almost empty) generator object. */ /*---------------------------------------------------------------------------*/ static int _unur_pinv_check_par (struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* Check parameters of given distribution and method */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_pinv_clone (const struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* copy (clone) generator object. */ /*---------------------------------------------------------------------------*/ static void _unur_pinv_free (struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* destroy generator object. */ /*---------------------------------------------------------------------------*/ static int _unur_pinv_make_guide_table (struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* make a guide table for indexed search. */ /*---------------------------------------------------------------------------*/ static double _unur_pinv_eval_PDF (double x, struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* call to PDF. */ /*---------------------------------------------------------------------------*/ /*........................*/ /* file: pinv_sample.ch */ /*........................*/ static double _unur_pinv_sample (struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* sample from generator */ /*---------------------------------------------------------------------------*/ static double _unur_pinv_eval_approxinvcdf (const struct unur_gen *gen, double u); /*---------------------------------------------------------------------------*/ /* evaluate interpolation of inverse CDF at u. */ /*---------------------------------------------------------------------------*/ /* declared in pinv.h: */ /* double unur_pinv_eval_approxinvcdf (const struct unur_gen *gen, double u); */ /* int unur_pinv_estimate_error (const UNUR_GEN *gen, int samplesize, double *max_error, double *MAE); */ /*......................*/ /* file: pinv_prep.ch */ /*......................*/ static int _unur_pinv_preprocessing (struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* 1. Find computational domain and compute PDF area. */ /*---------------------------------------------------------------------------*/ static int _unur_pinv_relevant_support (struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* 1a. Estimate computationally relevant domain (support) of PDF */ /* (finite interval where PDF is above some threshold value). */ /*---------------------------------------------------------------------------*/ static double _unur_pinv_searchborder (struct unur_gen *gen, double x0, double bound, double *dom, int *search); /*---------------------------------------------------------------------------*/ /* [1a.] find left or right hand border of relevant domain. */ /*---------------------------------------------------------------------------*/ static int _unur_pinv_approx_pdfarea (struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* 1b. Compute area below PDF over relevant domain approximately. */ /*---------------------------------------------------------------------------*/ static int _unur_pinv_pdfarea (struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* 1d. Compute area below PDF with requested accuracy and */ /* store intermediate results from adaptive integration. */ /*---------------------------------------------------------------------------*/ static int _unur_pinv_computational_domain (struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* 1c. Compute computational domain where inverse CDF is approximated */ /* (interval where we safely can compute coefficients of */ /* interpolating polynomial). */ /*---------------------------------------------------------------------------*/ static double _unur_pinv_cut (struct unur_gen *gen, double w, double dw, double crit); /*---------------------------------------------------------------------------*/ /* [1c.] calculate cut-off points for computational domain of distribution. */ /*---------------------------------------------------------------------------*/ static double _unur_pinv_cut_bisect (struct unur_gen *gen, double x0, double x1); /*---------------------------------------------------------------------------*/ /* [1c.] calculate cut-off points as boudary of bounded support of PDF. */ /*---------------------------------------------------------------------------*/ static int _unur_pinv_computational_domain_CDF (struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* 1c. Compute computational domain where inverse CDF is approximated */ /* (interval where we safely can compute coefficients of */ /* interpolating polynomial). */ /* Use CDF. */ /*---------------------------------------------------------------------------*/ static double _unur_pinv_cut_CDF( struct unur_gen *gen, double dom, double x0, double ul, double uu ); /*---------------------------------------------------------------------------*/ /* [1c.] calculate cut-off points for computational domain of distribution */ /* using CDF. */ /*---------------------------------------------------------------------------*/ static double _unur_pinv_Udiff (struct unur_gen *gen, double x, double h, double *fx); /*---------------------------------------------------------------------------*/ /* compute difference CDF(x+h)-CDF(x) (approximately), where CDF is the */ /* integral of the given (quasi-) density. */ /*---------------------------------------------------------------------------*/ /*........................*/ /* file: pinv_newton.ch */ /*........................*/ static int _unur_pinv_create_table( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* create table for Newton interpolation */ /*---------------------------------------------------------------------------*/ static int _unur_pinv_chebyshev_points (double *pt, int order, int smooth); /*---------------------------------------------------------------------------*/ /* [2a.] Compute Chebyshev points. */ /*---------------------------------------------------------------------------*/ static int _unur_pinv_newton_cpoints (double *xval, int order, struct unur_pinv_interval *iv, double h, double *chebyshev, int smooth, int use_upoints); /*---------------------------------------------------------------------------*/ /* [2a.] Compute points for construct interpolating polynomial. */ /*---------------------------------------------------------------------------*/ static int _unur_pinv_newton_create (struct unur_gen *gen, struct unur_pinv_interval *iv, double *xval, int smooth); /*---------------------------------------------------------------------------*/ /* 2a. Compute coefficients for Newton interpolation. */ /*---------------------------------------------------------------------------*/ static int _unur_pinv_linear_create (struct unur_gen *gen, struct unur_pinv_interval *iv, double *xval); /*---------------------------------------------------------------------------*/ /* [2a.] Compute coefficients for linear interpolation. */ /*---------------------------------------------------------------------------*/ static double _unur_pinv_newton_eval (double q, double *ui, double *zi, int order); /*---------------------------------------------------------------------------*/ /* 2b. evaluate Newton polynomial. */ /*---------------------------------------------------------------------------*/ static double _unur_pinv_newton_maxerror (struct unur_gen *gen, struct unur_pinv_interval *iv, double *xval); static double _unur_pinv_linear_maxerror (struct unur_gen *gen, struct unur_pinv_interval *iv); static double _unur_pinv_maxerror_extra (struct unur_gen *gen, struct unur_pinv_interval *iv, double *xval); /*---------------------------------------------------------------------------*/ /* 2c. estimate maximal error of Newton interpolation in subinterval */ /*---------------------------------------------------------------------------*/ static int _unur_pinv_newton_testpoints (double *utest, double ui[], int order); /*---------------------------------------------------------------------------*/ /* [2c.] calculate the local maxima of the interpolation polynomial */ /*---------------------------------------------------------------------------*/ static int _unur_pinv_cubic_hermite_is_monotone(struct unur_gen *gen, double *ui, double *zi, double *xval); /*---------------------------------------------------------------------------*/ /* [2c.] check monotonicity of cubic Hermite interpolation */ /*---------------------------------------------------------------------------*/ static int _unur_pinv_interval( struct unur_gen *gen, int i, double x, double cdfx ); /*---------------------------------------------------------------------------*/ /* make a new interval i with left boundary point x and CDF(x). */ /*---------------------------------------------------------------------------*/ static int _unur_pinv_lastinterval( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* update size of array and set all uninitialized values to 0. */ /*---------------------------------------------------------------------------*/ /*.......................*/ /* file: pinv_debug.ch */ /*.......................*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ /* the following functions print debugging information on output stream, */ /* i.e., into the LOG file if not specified otherwise. */ /*---------------------------------------------------------------------------*/ static void _unur_pinv_debug_init_start (const struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* print before setup starts. */ /*---------------------------------------------------------------------------*/ static void _unur_pinv_debug_init (const struct unur_gen *gen, int ok); /*---------------------------------------------------------------------------*/ /* print after generator has been initialized has completed. */ /*---------------------------------------------------------------------------*/ static void _unur_pinv_debug_relevant_support (const struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* print relevant domain */ /*---------------------------------------------------------------------------*/ static void _unur_pinv_debug_pdfarea (const struct unur_gen *gen, int approx); /*---------------------------------------------------------------------------*/ /* print estimated area below PDF */ /*---------------------------------------------------------------------------*/ static void _unur_pinv_debug_computational_domain (const struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* print computational domain */ /*---------------------------------------------------------------------------*/ static void _unur_pinv_debug_intervals (const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print starting points or table for algorithms into LOG file. */ /*---------------------------------------------------------------------------*/ static void _unur_pinv_debug_create_table (const struct unur_gen *gen, int iter, int n_incr_h, int n_decr_h, int n_use_linear); /*---------------------------------------------------------------------------*/ /* print data that have been collected while creating polynomials. */ /*---------------------------------------------------------------------------*/ #endif /*......................*/ /* file: pinv_info.ch */ /*......................*/ #ifdef UNUR_ENABLE_INFO static void _unur_pinv_info( struct unur_gen *gen, int help ); /*---------------------------------------------------------------------------*/ /* create info string. */ /*---------------------------------------------------------------------------*/ #endif /*---------------------------------------------------------------------------*/ /* abbreviations */ #define DISTR_IN distr->data.cont /* data for distribution object */ #define PAR ((struct unur_pinv_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_pinv_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.cont /* data for distribution in generator object */ #define SAMPLE gen->sample.cont /* pointer to sampling routine */ #define PDF(x) (_unur_pinv_eval_PDF((x),(gen))) /* call to PDF */ #define dPDF(x) (_unur_cont_dPDF((x),(gen->distr))) /* call to derivate of PDF */ #define CDF(x) (_unur_cont_CDF((x),(gen->distr))) /* call to CDF */ /*---------------------------------------------------------------------------*/ #define _unur_pinv_getSAMPLE(gen) (_unur_pinv_sample) /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* since there is only file scope or program code, we abuse the */ /* #include directive. */ /** Public: User Interface (API) **/ #include "pinv_newset.ch" /** Private **/ #include "pinv_init.ch" #include "pinv_sample.ch" #include "pinv_prep.ch" #include "pinv_newton.ch" #include "pinv_debug.ch" #include "pinv_info.ch" /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/empl.h0000644001357500135600000001160514420445767013415 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: empl.h * * * * PURPOSE: * * function prototypes for method EMPD * * (EMPirical distribution with Linear interpolation) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /* =METHOD EMPL EMPirical distribution with Linear interpolation =UP Methods_for_CEMP =REQUIRED observed sample =SPEED Set-up: slow (as sample is sorted), Sampling: very fast (inversion) =REINIT not implemented =REF [HLa00] [HLD04: Sect.12.1.3] =DESCRIPTION EMPL generates random variates from an empirical distribution that is given by an observed sample. This is done by linear interpolation of the empirical CDF. Although this method is suggested in the books of Law and Kelton (2000) and Bratly, Fox, and Schrage (1987) we do not recommend this method at all since it has many theoretical drawbacks: The variance of empirical distribution function does not coincide with the variance of the given sample. Moreover, when the sample increases the empirical density function does not converge to the density of the underlying random variate. Notice that the range of the generated point set is always given by the range of the given sample. This method is provided in UNU.RAN for the sake of completeness. We always recommend to use method EMPK (@pxref{EMPK,,EMPirical distribution with Kernel smoothing}). If the data seem to be far away from having a bell shaped histogram, then we think that naive resampling is still better than linear interpolation. =HOWTOUSE EMPL creates and samples from an empiral distribution by linear interpolation of the empirical CDF. There are no parameters to set. @noindent @emph{Important}: We do not recommend to use this method! Use method EMPK (@pxref{EMPK,,EMPirical distribution with Kernel smoothing}) instead. =END */ /*---------------------------------------------------------------------------*/ /* Routines for user interface */ /* =ROUTINES */ UNUR_PAR *unur_empl_new( const UNUR_DISTR *distribution ); /* Get default parameters for generator. */ /* =END */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/tabl_newset.ch0000644001357500135600000013101514420445767015130 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: tabl_newset.c * * * * TYPE: continuous univariate random variate * * METHOD: rejection form piecewise constant hat * * (Ahren's table method) * * * * DESCRIPTION: * * Given PDF of a unimodal distribution * * produce random variate X with its density * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*****************************************************************************/ /** Public: User Interface (API) **/ /*****************************************************************************/ struct unur_par * unur_tabl_new( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get default parameters */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* default parameters (pointer to structure) */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_par *par; /* check arguments */ _unur_check_NULL( GENTYPE,distr,NULL ); /* check distribution */ if (distr->type != UNUR_DISTR_CONT) { _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } COOKIE_CHECK(distr,CK_DISTR_CONT,NULL); if (DISTR_IN.pdf == NULL) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PDF"); return NULL; } /* allocate structure */ par = _unur_par_new( sizeof(struct unur_tabl_par) ); COOKIE_SET(par,CK_TABL_PAR); /* copy input */ par->distr = distr; /* pointer to distribution object */ /* set default values */ PAR->slopes = NULL; /* pointer to slopes of PDF */ PAR->n_slopes = 0; /* number of slopes */ PAR->n_stp = 30; /* number of starting points */ PAR->cpoints = NULL; /* pointer to array of starting points */ PAR->n_cpoints = 0; /* number of starting points */ PAR->area_fract = 0.1; /* parameter for equal area rule (default from [1] ) */ PAR->max_ivs = 1000; /* maximum number of intervals */ PAR->max_ratio = 0.90; /* bound for ratio Atotal / Asqueeze */ PAR->guide_factor = 1.; /* guide table has same size as array of intervals */ PAR->darsfactor = 0.99; /* factor for (derandomized) ARS. do not add a new construction point in a interval where abiguous region is too small */ /* default boundary of compution area */ PAR->bleft = -TABL_DEFAULT_COMPUTATION_LIMIT; PAR->bright = TABL_DEFAULT_COMPUTATION_LIMIT; par->method = UNUR_METH_TABL; /* indicate method */ par->variant = (TABL_VARFLAG_SPLIT_MEAN | /* variant: split at arc_mean */ TABL_VARIANT_IA | /* use immediate acceptance */ TABL_VARFLAG_USEEAR | /* run EAR (SPLIT A) on slopes */ TABL_VARFLAG_USEDARS ); /* run DARS (SPLIT B) on slopes */ par->set = 0u; /* inidicate default parameters */ par->urng = unur_get_default_urng(); /* use default urng */ par->urng_aux = par->urng; /* no special auxilliary URNG */ par->debug = _unur_default_debugflag; /* set default debugging flags */ /* routine for starting generator */ par->init = _unur_tabl_init; return par; } /* end of unur_tabl_new() */ /*****************************************************************************/ int unur_tabl_set_variant_ia( struct unur_par *par, int use_ia ) /*----------------------------------------------------------------------*/ /* Switch to immediate acceptance */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* use_ia ... whether immediate acceptance is used */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, TABL ); /* we use a bit in variant */ par->variant = (use_ia) ? (par->variant | TABL_VARIANT_IA) : (par->variant & (~TABL_VARIANT_IA)); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_tabl_set_variant_ia() */ /*---------------------------------------------------------------------------*/ int unur_tabl_set_useear( struct unur_par *par, int useear ) /*----------------------------------------------------------------------*/ /* set flag for using EAS (equal area rule). */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* useear ... 0 = do not use, 1 = use EAS */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* using using EAS is the default */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, TABL ); /* we use a bit in variant */ if (useear) par->variant |= TABL_VARFLAG_USEEAR; else par->variant &= ~TABL_VARFLAG_USEEAR; /* changelog */ par->set |= TABL_SET_USE_EAR; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_tabl_set_useeas() */ /*---------------------------------------------------------------------------*/ int unur_tabl_set_usedars( struct unur_par *par, int usedars ) /*----------------------------------------------------------------------*/ /* set flag for using DARS (derandomized adaptive rejection sampling). */ /* additionally the rule for splitting intervals can be set. */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* usedars ... 0 = do not use, 1 = use DARS */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* using using DARS is the default */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, TABL ); /* we use a bit in variant */ if (usedars) par->variant |= TABL_VARFLAG_USEDARS; else par->variant &= ~TABL_VARFLAG_USEDARS; /* changelog */ par->set |= TABL_SET_USE_DARS; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_tabl_set_usedars() */ /*---------------------------------------------------------------------------*/ int unur_tabl_set_darsfactor( struct unur_par *par, double factor ) /*----------------------------------------------------------------------*/ /* set factor for derandomized adaptive rejection sampling */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* factor ... parameter for DARS */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, TABL ); /* check new parameter for generator */ if (factor < 0.) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"DARS factor < 0"); return UNUR_ERR_PAR_SET; } /* store date */ PAR->darsfactor = factor; /* changelog */ par->set |= TABL_SET_DARS_FACTOR; return UNUR_SUCCESS; } /* end of unur_tabl_set_darsfactor() */ /*---------------------------------------------------------------------------*/ int unur_tabl_set_variant_splitmode( struct unur_par *par, unsigned splitmode ) /*----------------------------------------------------------------------*/ /* set setup variant for adaptive rejection sampling */ /* */ /* There are three variants for adaptive rejection sampling. These */ /* differ in the way how an interval is split: */ /* splitmode 1: use the generated point to split the interval. */ /* splitmode 2: use the mean point of the interval. */ /* splitmode 3: use the arcmean point. */ /* Default is splitmode 3. */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* splitmode ... indicator for variant */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, TABL ); /* store date */ par->variant &= ~TABL_VARMASK_SPLIT; switch (splitmode) { case 1: par->variant |= TABL_VARFLAG_SPLIT_POINT; return UNUR_SUCCESS; case 2: par->variant |= TABL_VARFLAG_SPLIT_MEAN; return UNUR_SUCCESS; case 3: par->variant |= TABL_VARFLAG_SPLIT_ARC; return UNUR_SUCCESS; default: _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"invalid variant"); return UNUR_ERR_PAR_SET; } } /* end if unur_tabl_set_variant_splitmode() */ /*---------------------------------------------------------------------------*/ int unur_tabl_set_max_sqhratio( struct unur_par *par, double max_ratio ) /*----------------------------------------------------------------------*/ /* set bound for ratio A(squeeze) / A(hat) */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* max_ratio ... upper bound for ratio to add a new construction point*/ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, TABL ); /* check new parameter for generator */ if (max_ratio < 0. || max_ratio > 1. ) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"ratio A(squeeze)/A(hat) not in [0,1]"); return UNUR_ERR_PAR_SET; } /* store date */ PAR->max_ratio = max_ratio; /* changelog */ par->set |= TABL_SET_MAX_SQHRATIO; return UNUR_SUCCESS; } /* end of unur_tabl_set_max_sqhratio() */ /*---------------------------------------------------------------------------*/ double unur_tabl_get_sqhratio( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* get ratio A(squeeze) / A(hat) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* ratio ... on success */ /* UNUR_INFINITY ... on error */ /*----------------------------------------------------------------------*/ { /* check input */ _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); _unur_check_gen_object( gen, TABL, UNUR_INFINITY ); return (GEN->Asqueeze / GEN->Atotal); } /* end of unur_tabl_get_sqhratio() */ /*---------------------------------------------------------------------------*/ double unur_tabl_get_hatarea( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* get area below hat */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* area ... on success */ /* UNUR_INFINITY ... on error */ /*----------------------------------------------------------------------*/ { /* check input */ _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); _unur_check_gen_object( gen, TABL, UNUR_INFINITY ); return GEN->Atotal; } /* end of unur_tabl_get_hatarea() */ /*---------------------------------------------------------------------------*/ double unur_tabl_get_squeezearea( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* get area below squeeze */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* area ... on success */ /* UNUR_INFINITY ... on error */ /*----------------------------------------------------------------------*/ { /* check input */ _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); _unur_check_gen_object( gen, TABL, UNUR_INFINITY ); return GEN->Asqueeze; } /* end of unur_tabl_get_squeezearea() */ /*---------------------------------------------------------------------------*/ int unur_tabl_set_max_intervals( struct unur_par *par, int max_ivs ) /*----------------------------------------------------------------------*/ /* set maximum number of intervals */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* max_ivs ... maximum number of intervals */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, TABL ); /* check new parameter for generator */ if (max_ivs < 1 ) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"maximum number of intervals < 1"); return UNUR_ERR_PAR_SET; } /* store date */ PAR->max_ivs = max_ivs; /* changelog */ par->set |= TABL_SET_MAX_IVS; return UNUR_SUCCESS; } /* end of unur_tabl_set_max_intervals() */ /*---------------------------------------------------------------------------*/ int unur_tabl_get_n_intervals( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* get current number of intervals */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* number of intervals ... on success */ /* 0 ... on error */ /*----------------------------------------------------------------------*/ { /* check input */ _unur_check_NULL( GENTYPE, gen, 0 ); _unur_check_gen_object( gen, TABL, 0 ); return GEN->n_ivs; } /* end of unur_tabl_get_n_intervals() */ /*---------------------------------------------------------------------------*/ int unur_tabl_set_areafraction( struct unur_par *par, double fraction ) /*----------------------------------------------------------------------*/ /* set parameter for equal area rule */ /* (each bar has size fraction * area below PDF) */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* fraction ... fraction of area for bar */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, TABL ); /* check new parameter for generator */ if (fraction <= 0.) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"area factor <= 0"); return UNUR_ERR_PAR_SET; } /* store date */ PAR->area_fract = fraction; /* changelog */ par->set |= TABL_SET_AREAFRACTION; return UNUR_SUCCESS; } /* end of unur_tabl_set_areafraction() */ /*---------------------------------------------------------------------------*/ int unur_tabl_set_cpoints( struct unur_par *par, int n_cpoints, const double *cpoints ) /*----------------------------------------------------------------------*/ /* set construction points for slopes of PDF */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* n_cpoints ... number of points for constructing slopes */ /* cpoints ... pointer to array of points for constructing slopes */ /* (NULL for changing only the number of default points)*/ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int i; /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, TABL ); /* check starting construction points */ /* we always use the boundary points as additional starting points, so we do not count these here! */ if (n_cpoints <= 0 ) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"number of starting points <= 0"); return UNUR_ERR_PAR_SET; } if (cpoints) /* starting points must be strictly monontonically increasing */ for( i=1; icpoints = cpoints; PAR->n_cpoints = n_cpoints; } else { /* to avoid segfaults which might be caused by a different use of ... _set_cpoints() compared to methods AROU and TDR we set n_stp in this case */ PAR->n_stp = n_cpoints; /* changelog */ par->set |= TABL_SET_N_STP; } return UNUR_SUCCESS; } /* end of unur_tabl_set_cpoints() */ /*---------------------------------------------------------------------------*/ int unur_tabl_set_nstp( struct unur_par *par, int n_stp ) /*----------------------------------------------------------------------*/ /* */ /* set number of construction points for hat at initialization */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* n_stp ... number of starting points */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, TABL ); /* check starting construction points */ /* we always use the boundary points as additional starting points, so we do not count these here! */ if (n_stp < 0 ) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"number of starting points < 0"); return UNUR_ERR_PAR_SET; } /* store date */ PAR->n_stp = n_stp; /* changelog */ par->set |= TABL_SET_N_STP; return UNUR_SUCCESS; } /* end of unur_tabl_set_nstp() */ /*---------------------------------------------------------------------------*/ int unur_tabl_set_slopes( struct unur_par *par, const double *slopes, int n_slopes ) /*----------------------------------------------------------------------*/ /* set slopes of PDF */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* slopes ... pointer to list of slopes */ /* n_slopes ... number of slopes */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* a slope is an interval [a,b] or [b,a] */ /* such that PDF(a) >= PDF(b). */ /* slopes must be decreasing, non-overlapping and sorted */ /*----------------------------------------------------------------------*/ { int i; double lmax,rmin,rmax; /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, TABL ); /* check new parameter for generator */ if( n_slopes <= 0 ) { _unur_error(GENTYPE,UNUR_ERR_PAR_SET,"number of slopes <= 0"); return UNUR_ERR_PAR_SET; } /* check slopes */ lmax = -UNUR_INFINITY; for( i=0; islopes = slopes; PAR->n_slopes = n_slopes; /* changelog */ par->set |= TABL_SET_SLOPES; return UNUR_SUCCESS; } /* end of unur_tabl_set_slopes() */ /*---------------------------------------------------------------------------*/ int unur_tabl_set_guidefactor( struct unur_par *par, double factor ) /*----------------------------------------------------------------------*/ /* set factor for relative size of guide table */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* factor ... relative size of table */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, TABL ); /* check new parameter for generator */ if (factor < 0) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"guide table size < 0"); return UNUR_ERR_PAR_SET; } /* store date */ PAR->guide_factor = factor; /* changelog */ par->set |= TABL_SET_GUIDEFACTOR; return UNUR_SUCCESS; } /* end of unur_tabl_set_guidefactor() */ /*---------------------------------------------------------------------------*/ int unur_tabl_set_boundary( struct unur_par *par, double left, double right ) /*----------------------------------------------------------------------*/ /* set left and right boundary of computation interval */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* left ... left boundary point */ /* right ... right boundary point */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* new boundary points must not be +/- UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, TABL ); /* check new parameter for generator */ if (left >= right) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"domain"); return UNUR_ERR_PAR_SET; } if (left <= -UNUR_INFINITY || right >= UNUR_INFINITY) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"domain (+/- UNUR_INFINITY not allowed)"); return UNUR_ERR_PAR_SET; } /* store date */ PAR->bleft = left; PAR->bright = right; /* changelog */ par->set |= TABL_SET_BOUNDARY; return UNUR_SUCCESS; } /* end of unur_tabl_set_boundary() */ /*---------------------------------------------------------------------------*/ int unur_tabl_set_verify( struct unur_par *par, int verify ) /*----------------------------------------------------------------------*/ /* turn verifying of algorithm while sampling on/off */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* verify ... 0 = no verifying, !0 = verifying */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* no verifying is the default */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, TABL ); /* we use a bit in variant */ par->variant = (verify) ? (par->variant | TABL_VARFLAG_VERIFY) : (par->variant & (~TABL_VARFLAG_VERIFY)); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_tabl_set_verify() */ /*---------------------------------------------------------------------------*/ int unur_tabl_chg_verify( struct unur_gen *gen, int verify ) /*----------------------------------------------------------------------*/ /* turn verifying of algorithm while sampling on/off */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* verify ... 0 = no verifying, !0 = verifying */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* no verifying is the default */ /*----------------------------------------------------------------------*/ { /* check input */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, TABL, UNUR_ERR_GEN_INVALID ); /* we must not change this switch when sampling has been disabled by using a pointer to the error producing routine */ if (SAMPLE == _unur_sample_cont_error) return UNUR_FAILURE; /* we use a bit in variant */ gen->variant = (verify) ? (gen->variant | TABL_VARFLAG_VERIFY) : (gen->variant & (~TABL_VARFLAG_VERIFY)); /* sampling routines */ SAMPLE = _unur_tabl_getSAMPLE(gen); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_tabl_chg_verify() */ /*---------------------------------------------------------------------------*/ int unur_tabl_set_pedantic( struct unur_par *par, int pedantic ) /*----------------------------------------------------------------------*/ /* turn pedantic mode on/off */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* pedantic ... 0 = no pedantic mode, !0 = use pedantic mode */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* pedantic is the default */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, TABL ); /* we use a bit in variant */ par->variant = (pedantic) ? (par->variant | TABL_VARFLAG_PEDANTIC) : (par->variant & (~TABL_VARFLAG_PEDANTIC)); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_tabl_set_pedantic() */ /*---------------------------------------------------------------------------*/ int unur_tabl_chg_truncated( struct unur_gen *gen, double left, double right ) /*----------------------------------------------------------------------*/ /* change the left and right borders of the domain of the distribution */ /* the new domain should not exceed the original domain given by */ /* unur_distr_cont_set_domain(). Otherwise it is truncated. */ /* */ /* This call does not work for variant IA (immediate acceptance). */ /* In this case it switches to variant RH!! */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* left ... left boundary point */ /* right ... right boundary point */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { double Umin, Umax; /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, TABL, UNUR_ERR_GEN_INVALID ); /* we have to disable adaptive rejection sampling */ if (GEN->max_ivs > GEN->n_ivs) { _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"adaptive rejection sampling disabled for truncated distribution"); GEN->max_ivs = GEN->n_ivs; } /* we cannot use immadate acceptance (IA), switch to variant PS instead */ if (gen->variant & TABL_VARIANT_IA) { _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"cannot use IA for truncated distribution, switch to RH"); /* change variante flag */ gen->variant &= ~TABL_VARIANT_IA; /* change sampling routine */ SAMPLE = (gen->variant & TABL_VARFLAG_VERIFY) ? _unur_tabl_rh_sample_check : _unur_tabl_rh_sample; } /* check new parameter for generator */ /* (the truncated domain must be a subset of the domain) */ if (left < DISTR.domain[0]) { _unur_warning(NULL,UNUR_ERR_DISTR_SET,"truncated domain not subset of domain"); left = DISTR.domain[0]; } if (right > DISTR.domain[1]) { _unur_warning(NULL,UNUR_ERR_DISTR_SET,"truncated domain not subset of domain"); right = DISTR.domain[1]; } if (left >= right) { _unur_warning(NULL,UNUR_ERR_DISTR_SET,"domain, left >= right"); return UNUR_ERR_DISTR_SET; } /* compute CDF at x (with respect to given domain of distribution) */ Umin = _unur_tabl_eval_cdfhat(gen,left); Umax = _unur_tabl_eval_cdfhat(gen,right); /* check result */ if (Umin > Umax) { /* this is a serios error that should not happen */ _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); return UNUR_ERR_SHOULD_NOT_HAPPEN; } if (_unur_FP_equal(Umin,Umax)) { /* CDF values very close */ _unur_warning(gen->genid,UNUR_ERR_DISTR_SET,"CDF values very close"); if (_unur_iszero(Umin) || _unur_FP_same(Umax,1.)) { /* this is very bad */ _unur_warning(gen->genid,UNUR_ERR_DISTR_SET,"CDF values at boundary points too close"); return UNUR_ERR_DISTR_SET; } } /* set bounds for truncated domain and for U (CDF) */ DISTR.trunc[0] = left; DISTR.trunc[1] = right; GEN->Umin = Umin; GEN->Umax = Umax; /* changelog */ gen->distr->set |= UNUR_DISTR_SET_TRUNCATED; #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ #endif /* o.k. */ return UNUR_SUCCESS; } /* end of unur_tabl_chg_truncated() */ /*---------------------------------------------------------------------------*/ double _unur_tabl_eval_cdfhat( struct unur_gen *gen, double x ) /*----------------------------------------------------------------------*/ /* evaluate CDF of hat at x (i.e. \int_{-\infty}^x hat(t) dt) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* x ... point at which hat(x) has to be computed */ /* */ /* return: */ /* CDF of hat(x) or */ /* UNUR_INFINITY in case of error */ /* */ /* Important: */ /* If gen is a generator object for variant IA (immediate acceptance) */ /* then it is treated like variant RH ("classical" rejection)! */ /* This is necessary since variant IA is not a pure rejection */ /* algorithm, but a composition method. */ /*----------------------------------------------------------------------*/ { struct unur_tabl_interval *iv; double Aint = 0.; double cdf; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_TABL_GEN,UNUR_INFINITY); /* the easy case: left and right boundary of domain */ if (x <= DISTR.domain[0]) return 0.; if (x >= DISTR.domain[1]) return 1.; /* find interval (sequential search) */ for (iv = GEN->iv; iv->next!=NULL; iv=iv->next) { COOKIE_CHECK(iv,CK_TABL_IV,UNUR_INFINITY); if (xxmin || xxmax) break; Aint = iv->Acum; /* area of bars to the l.h.s. of x */ if (iv->next == NULL) /* right boundary of domain */ return 1.; } /* add area in interval that contains x */ Aint += iv->fmax * ((iv->xmin > iv->xmax) ? (x - iv->xmax) : (x - iv->xmin)); /* normalize to one (and mind round-off errors) */ cdf = Aint / GEN->Atotal; return ((cdf > 1.) ? 1. : cdf); } /* end of _unur_tabl_eval_cdfhat() */ /*****************************************************************************/ unuran-1.11.0/src/methods/tdr_debug.ch0000644001357500135600000004245414420445767014570 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: tdr_debug.c * * * * TYPE: continuous univariate random variate * * METHOD: transformed density rejection * * * * DESCRIPTION: * * Given PDF of a T-concave distribution * * produce a value x consistent with its density * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*****************************************************************************/ /** Debugging utilities **/ /*****************************************************************************/ #include "tdr_gw_debug.ch" #include "tdr_ps_debug.ch" /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ void _unur_tdr_debug_init_start( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* print after (almost empty generator) object has been created. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; int i; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_TDR_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: type = continuous univariate random variates\n",gen->genid); fprintf(LOG,"%s: method = transformed density rejection\n",gen->genid); fprintf(LOG,"%s: variant = ",gen->genid); switch (gen->variant & TDR_VARMASK_VARIANT) { case TDR_VARIANT_GW: fprintf(LOG,"original (Gilks & Wild) ... GW\n"); break; case TDR_VARIANT_PS: fprintf(LOG,"proportional squeeze ... PS\n"); break; case TDR_VARIANT_IA: fprintf(LOG,"immediate acceptance ... IA\n"); break; } fprintf(LOG,"%s: transformation T_c(x) = ",gen->genid); switch( gen->variant & TDR_VARMASK_T ) { case TDR_VAR_T_LOG: fprintf(LOG,"log(x) ... c = 0"); break; case TDR_VAR_T_SQRT: fprintf(LOG,"-1/sqrt(x) ... c = -1/2"); break; case TDR_VAR_T_POW: fprintf(LOG,"-x^(%g) ... c = %g",GEN->c_T,GEN->c_T); break; } _unur_print_if_default(gen,TDR_SET_C); fprintf(LOG,"\n%s:\n",gen->genid); if (gen->distr_is_privatecopy) fprintf(LOG,"%s: use private copy of distribution object\n",gen->genid); else fprintf(LOG,"%s: use pointer to external distribution object (dangerous!)\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); _unur_distr_cont_debug( gen->distr, gen->genid ); fprintf(LOG,"%s: sampling routine = _unur_tdr_",gen->genid); switch (gen->variant & TDR_VARMASK_VARIANT) { case TDR_VARIANT_GW: fprintf(LOG,"gw"); break; case TDR_VARIANT_PS: fprintf(LOG,"ps"); break; case TDR_VARIANT_IA: fprintf(LOG,"ia"); break; } if (gen->variant & TDR_VARFLAG_VERIFY) fprintf(LOG,"_sample_check()\n"); else fprintf(LOG,"_sample()\n"); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: center = %g",gen->genid,GEN->center); _unur_print_if_default(gen,TDR_SET_CENTER); if (gen->variant & TDR_VARFLAG_USEMODE) fprintf(LOG,"\n%s: use mode as construction point",gen->genid); else if (gen->variant & TDR_VARFLAG_USECENTER) fprintf(LOG,"\n%s: use center as construction point",gen->genid); fprintf(LOG,"\n%s:\n",gen->genid); fprintf(LOG,"%s: maximum number of intervals = %d",gen->genid,GEN->max_ivs); _unur_print_if_default(gen,TDR_SET_MAX_IVS); fprintf(LOG,"\n%s: bound for ratio Asqueeze / Atotal = %g%%",gen->genid,GEN->max_ratio*100.); _unur_print_if_default(gen,TDR_SET_MAX_SQHRATIO); fprintf(LOG,"\n%s:\n",gen->genid); if (gen->variant & TDR_VARFLAG_USEDARS) { fprintf(LOG,"%s: Derandomized ARS enabled ",gen->genid); _unur_print_if_default(gen,TDR_SET_USE_DARS); fprintf(LOG,"\n%s:\tDARS factor = %g",gen->genid,GEN->darsfactor); _unur_print_if_default(gen,TDR_SET_DARS_FACTOR); fprintf(LOG,"\n%s:\tDARS rule %d",gen->genid,GEN->darsrule); _unur_print_if_default(gen,TDR_SET_USE_DARS); } else { fprintf(LOG,"%s: Derandomized ARS disabled ",gen->genid); _unur_print_if_default(gen,TDR_SET_USE_DARS); } fprintf(LOG,"\n%s:\n",gen->genid); fprintf(LOG,"%s: sampling from list of intervals: indexed search (guide table method)\n",gen->genid); fprintf(LOG,"%s: relative guide table size = %g%%",gen->genid,100.*GEN->guide_factor); _unur_print_if_default(gen,TDR_SET_GUIDEFACTOR); fprintf(LOG,"\n%s:\n",gen->genid); fprintf(LOG,"%s: number of starting points = %d",gen->genid,GEN->n_starting_cpoints); _unur_print_if_default(gen,TDR_SET_N_STP); fprintf(LOG,"\n%s: starting points:",gen->genid); if (gen->set & TDR_SET_STP) for (i=0; in_starting_cpoints; i++) { if (i%5==0) fprintf(LOG,"\n%s:\t",gen->genid); fprintf(LOG," %#g,",GEN->starting_cpoints[i]); } else fprintf(LOG," use \"equidistribution\" rule [default]"); fprintf(LOG,"\n%s:\n",gen->genid); fflush(LOG); } /* end of _unur_tdr_debug_init_start() */ /*---------------------------------------------------------------------------*/ void _unur_tdr_debug_init_finished( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write info about generator after setup into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_TDR_GEN,RETURN_VOID); LOG = unur_get_stream(); _unur_tdr_debug_intervals(gen,"INIT completed",TRUE); fprintf(LOG,"%s: INIT completed **********************\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); fflush(LOG); } /* end of _unur_tdr_debug_init_finished() */ /*---------------------------------------------------------------------------*/ void _unur_tdr_debug_dars_start( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* print header before runniung DARS into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_TDR_GEN,RETURN_VOID); LOG = unur_get_stream(); if (gen->debug & TDR_DEBUG_IV) _unur_tdr_debug_intervals(gen,"Starting Intervals:",TRUE); fprintf(LOG,"%s: DARS started **********************\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: DARS factor = %g",gen->genid,GEN->darsfactor); _unur_print_if_default(gen,TDR_SET_DARS_FACTOR); fprintf(LOG,"\n%s: DARS rule %d",gen->genid,GEN->darsrule); _unur_print_if_default(gen,TDR_SET_USE_DARS); fprintf(LOG,"\n%s:\n",gen->genid); fflush(LOG); } /* end of _unur_tdr_debug_dars_start() */ /*---------------------------------------------------------------------------*/ void _unur_tdr_debug_dars_finished( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* print infor after generator has run DARS into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_TDR_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: DARS finished **********************\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); fflush(LOG); } /* end of _unur_tdr_debug_dars_finished() */ /*---------------------------------------------------------------------------*/ void _unur_tdr_debug_reinit_start( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write info about generator before reinitialization into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { int i; FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_TDR_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s: *** Re-Initialize generator object ***\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); if (gen->set & TDR_SET_N_PERCENTILES) { fprintf(LOG,"%s: use percentiles of old hat as starting points for new hat:",gen->genid); for (i=0; in_percentiles; i++) { if (i%5==0) fprintf(LOG,"\n%s:\t",gen->genid); fprintf(LOG," %#g,",GEN->percentiles[i]); } fprintf(LOG,"\n%s: starting points:",gen->genid); for (i=0; in_starting_cpoints; i++) { if (i%5==0) fprintf(LOG,"\n%s:\t",gen->genid); fprintf(LOG," %#g,",GEN->starting_cpoints[i]); } fprintf(LOG,"\n"); } else { fprintf(LOG,"%s: use starting points given at init\n",gen->genid); } fprintf(LOG,"%s:\n",gen->genid); fflush(LOG); } /* end of _unur_tdr_debug_reinit_start() */ /*---------------------------------------------------------------------------*/ void _unur_tdr_debug_reinit_retry( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write info about generator before second trial of reinitialization */ /* into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_TDR_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s: *** Re-Initialize failed --> second trial ***\n",gen->genid); fprintf(LOG,"%s: use equal-area-rule with %d points\n",gen->genid,GEN->retry_ncpoints); fprintf(LOG,"%s:\n",gen->genid); fflush(LOG); } /* end of _unur_tdr_debug_reinit_retry() */ /*---------------------------------------------------------------------------*/ void _unur_tdr_debug_reinit_finished( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write info about generator after reinitialization into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_TDR_GEN,RETURN_VOID); LOG = unur_get_stream(); _unur_tdr_debug_intervals(gen,"*** Generator reinitialized ***",TRUE); fprintf(LOG,"%s:\n",gen->genid); fflush(LOG); } /* end of _unur_tdr_debug_reinit_finished() */ /*---------------------------------------------------------------------------*/ void _unur_tdr_debug_free( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write info about generator before destroying into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_TDR_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s:\n",gen->genid); if (gen->status == UNUR_SUCCESS) { fprintf(LOG,"%s: GENERATOR destroyed **********************\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); _unur_tdr_debug_intervals(gen,NULL,TRUE); } else { fprintf(LOG,"%s: initialization of GENERATOR failed **********************\n",gen->genid); _unur_tdr_debug_intervals(gen,"Intervals after failure:",FALSE); } fprintf(LOG,"%s:\n",gen->genid); fflush(LOG); } /* end of _unur_tdr_debug_free() */ /*---------------------------------------------------------------------------*/ void _unur_tdr_debug_intervals( const struct unur_gen *gen, const char *header, int print_areas ) /*----------------------------------------------------------------------*/ /* write list of intervals into LOG file(orig. variant by Gilks & Wild) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* header ... header for table */ /* print_areas ... whether table of areas should be printed */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_TDR_GEN,RETURN_VOID); LOG = unur_get_stream(); if (header) fprintf(LOG,"%s:%s\n",gen->genid,header); switch (gen->variant & TDR_VARMASK_VARIANT) { case TDR_VARIANT_GW: /* original variant (Gilks&Wild) */ _unur_tdr_gw_debug_intervals(gen,print_areas); return; case TDR_VARIANT_PS: /* proportional squeeze */ case TDR_VARIANT_IA: /* immediate acceptance */ _unur_tdr_ps_debug_intervals(gen,print_areas); return; default: _unur_error(GENTYPE,UNUR_ERR_SHOULD_NOT_HAPPEN,""); return; } } /* end of _unur_tdr_debug_intervals() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/ninv_info.ch0000644001357500135600000001452414420445767014613 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: ninv_info.ch * * * * Routines for creating info strings. * * * ***************************************************************************** * * * Copyright (c) 2000-2009 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_INFO /*---------------------------------------------------------------------------*/ void _unur_ninv_info( struct unur_gen *gen, int help ) /*----------------------------------------------------------------------*/ /* create character string that contains information about the */ /* given generator object. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* help ... whether to print additional comments */ /*----------------------------------------------------------------------*/ { struct unur_string *info = gen->infostr; double n_iter; int samplesize = 10000; int use_newton = (gen->variant==NINV_VARFLAG_NEWTON) ? TRUE : FALSE; /* generator ID */ _unur_string_append(info,"generator ID: %s\n\n", gen->genid); /* distribution */ _unur_string_append(info,"distribution:\n"); _unur_distr_info_typename(gen); _unur_string_append(info," functions = CDF"); if (use_newton) _unur_string_append(info," PDF"); _unur_string_append(info,"\n"); _unur_string_append(info," domain = (%g, %g)", DISTR.trunc[0],DISTR.trunc[1]); if (gen->distr->set & UNUR_DISTR_SET_TRUNCATED) { _unur_string_append(info," [truncated from (%g, %g)]", DISTR.domain[0],DISTR.domain[1]); } _unur_string_append(info,"\n\n"); /* method */ _unur_string_append(info,"method: NINV (Numerical INVersion)\n"); switch (gen->variant) { case NINV_VARFLAG_NEWTON: _unur_string_append(info," Newton method\n"); break; case NINV_VARFLAG_BISECT: _unur_string_append(info," Bisection method\n"); break; case NINV_VARFLAG_REGULA: default: _unur_string_append(info," Regula falsi\n"); break; } _unur_string_append(info,"\n"); /* performance */ _unur_string_append(info,"performance characteristics:\n"); n_iter = unur_test_count_pdf(gen,samplesize,FALSE,NULL)/(2.*samplesize); if (!use_newton) n_iter *= 2.; _unur_string_append(info," average number of iterations = %.2f [approx.]\n", n_iter); if (gen->set & NINV_SET_U_RESOLUTION) { if (DISTR.cdf) { double max_error=1.; double MAE=1.; unur_test_u_error(gen, &max_error, &MAE, 1.e-20, 1000, FALSE, FALSE, FALSE, NULL); _unur_string_append(info," u-error <= %g (mean = %g) [rough estimate]\n", max_error, MAE); } else { _unur_string_append(info," u-error NA [requires CDF]\n"); } _unur_string_append(info, " [ u-resolution = %g ]\n",GEN->u_resolution); } if (GEN->table_on) { _unur_string_append(info," starting points = table of size %d\n", GEN->table_size); } else { _unur_string_append(info," starting points = "); if (use_newton) { _unur_string_append(info,"%g (CDF = %g) %s\n", GEN->s[0], GEN->CDFs[0], (gen->set & NINV_SET_START) ? "" : "[default]"); } else { _unur_string_append(info,"%g, %g (CDF = %g, %g) %s\n", GEN->s[0],GEN->s[1], GEN->CDFs[0],GEN->CDFs[1], (gen->set & NINV_SET_START) ? "" : "[default]"); } } _unur_string_append(info,"\n"); /* parameters */ if (help) { _unur_string_append(info,"parameters:\n"); switch (gen->variant) { case NINV_VARFLAG_NEWTON: _unur_string_append(info," usenewton\n"); break; case NINV_VARFLAG_BISECT: _unur_string_append(info," usebisect\n"); break; case NINV_VARFLAG_REGULA: default: _unur_string_append(info," useregula [default]\n"); break; } _unur_string_append(info," u_resolution = %g %s %s\n", GEN->u_resolution, (GEN->u_resolution > 0.) ? "" : "[disabled]", (gen->set & NINV_SET_U_RESOLUTION) ? "" : "[default]"); _unur_string_append(info," x_resolution = %g %s %s\n", GEN->x_resolution, (GEN->x_resolution > 0.) ? "" : "[disabled]", (gen->set & NINV_SET_X_RESOLUTION) ? "" : "[default]"); _unur_string_append(info," max_iter = %d %s\n", GEN->max_iter, (gen->set & NINV_SET_MAX_ITER) ? "" : "[default]"); /* Not displayed: int unur_ninv_set_start( UNUR_PAR *parameters, double left, double right); int unur_ninv_set_table(UNUR_PAR *parameters, int no_of_points); */ _unur_string_append(info,"\n"); } /* Hints */ if (help) { if (! (gen->set & NINV_SET_X_RESOLUTION) ) _unur_string_append(info,"[ Hint: %s ]\n", "You can increase accuracy by decreasing \"x_resolution\"."); if (! (gen->set & NINV_SET_MAX_ITER) ) _unur_string_append(info,"[ Hint: %s ]\n", "You can increase \"max_iter\" if you encounter problems with accuracy."); _unur_string_append(info,"\n"); } } /* end of _unur_tdr_info() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_INFO */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/ninv_regula.ch0000644001357500135600000005074214420445767015141 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: ninv_regula.ch * * * * Routines for regula falsi root finding algorithm. c * * * ***************************************************************************** * * * Copyright (c) 2000-2009 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * ***************************************************************************** * * * * ***************************************************************************** * * * For a given U find X with F(X) - U = 0. * * * * Method: stabilized regula falsi preserving sign change; * * bisection if slow convergence is detected. * * * *****************************************************************************/ /*****************************************************************************/ /** Regula falsi **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Constants */ /* maximum number of steps to find sign change in Regula Falsi */ #define MAX_STEPS (100) /* STEPFAC* (s[1]-s[0]) is used as first step length for finding sign change */ #define STEPFAC (0.4) /* for #steps > I_CHANGE_TO_BISEC Regula Falsi is always replaced by bisection*/ #define I_CHANGE_TO_BISEC (50) /*---------------------------------------------------------------------------*/ double _unur_ninv_regula( const struct unur_gen *gen, double u ) /*---------------------------------------------------------------------*/ /* algorithm: regula falsi with bisection steps */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* u ... random number (uniform distribution) */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return UNUR_INFINITY */ /* */ /* Remark: */ /* The routine computes the root of CDF(x)-u */ /* */ /* Reference: */ /* [1] Neumaier A. (to be published): */ /* Introduction to numerical analysis, */ /* Cambridge University Press */ /*---------------------------------------------------------------------*/ { double x1, x2, a, xtmp;/* points for regular falsi */ double f1, f2,fa, ftmp;/* function values at x1, x2, xtmp */ double length; /* oriented length of the interval with sign change*/ double lengthabs; /* absolute length of interval */ double lengthsgn; /* orientation of the Intervalls */ double dx; /* RF-stepsize */ int count_nosc = 0; /* counter for "no sign change occured" */ int i; /* loop variable, index */ double min_step_size; /* minimal step size for regula falsi */ double rel_u_resolution; /* relative u resolution */ /* check arguments */ CHECK_NULL(gen, UNUR_INFINITY); COOKIE_CHECK(gen, CK_NINV_GEN, UNUR_INFINITY); /* compute relative u resolution */ rel_u_resolution = ( (GEN->u_resolution > 0.) ? (GEN->Umax - GEN->Umin) * GEN->u_resolution : UNUR_INFINITY ); /* -- 1. + 2. find bracket -- */ if ( _unur_ninv_bracket( gen, u, &x1, &f1, &x2, &f2 ) != UNUR_SUCCESS ) return x2; /* sign changes always within [a, x2] */ a = x1; fa = f1; /* -- 3. secant step, preserve sign change -- */ /* secant step, preserve sign change */ for (i=0; TRUE; i++) { /* -- 3a. check sign of f1 and f2 -- */ if ( f1*f2 < 0.) { /* sign change found */ count_nosc = 0; /* reset counter */ /* f2 always less (better), otherwise exchange */ if ( fabs(f1) < fabs(f2) ) { xtmp = x1; ftmp = f1; x1 = x2; f1 = f2; x2 = xtmp; f2 = ftmp; } /* sign changes within [a, x2] */ a = x1; fa = f1; } else { /* increment counter for "no sign change occured" */ count_nosc++; /* must not update 'a' */ } /* length of enclosing bracket */ length = x2 - a; /* oriented length */ lengthabs = fabs(length); /* absolute length */ lengthsgn = (length < 0.) ? -1. : 1.; /* -- 3b. check stopping criterion -- */ /* check accuracy goal */ if (_unur_ninv_accuracy( gen, GEN->x_resolution, rel_u_resolution, x2, f2, a, fa )) break; if (i >= GEN->max_iter) /* maximum number of iterations reached --> abort */ break; /* -- 3c. try secant step -- */ /* step size: secant or bisection step */ dx = (_unur_FP_same(f1,f2)) ? length/2. : f2*(x2-x1)/(f2-f1) ; /* minimal step size */ if (GEN->u_resolution < 0.) /* we only look at the x-error, so we do not need shorter steps */ min_step_size = fabs(x2) * GEN->x_resolution; else min_step_size = lengthabs * DBL_EPSILON; if ( fabs(dx) < min_step_size ) { dx = lengthsgn * 0.99 * min_step_size; while ( x2 == x2 - dx ){ /* dx too small */ if ( dx != 2.*dx) /* near limit of calculations */ dx = 2.*dx; else dx = length/2.; /* bisection step */ } } /* bisection step if: */ /* no sign change || step leads out of interval */ if ( count_nosc > 1 || i > I_CHANGE_TO_BISEC || (lengthabs-GEN->x_resolution*fabs(x2))/(dx*lengthsgn) <= 1. ) dx = length/2.; /* bisection step */ /* -- 3c. update point -- */ x1 = x2; f1 = f2; x2 = x2-dx; f2 = CDF(x2) - u; } /* end of for-loop */ if (i >= GEN->max_iter) _unur_warning(gen->genid,UNUR_ERR_GEN_SAMPLING, "max number of iterations exceeded: accuracy goal might not be reached"); /* ensure location within given (truncated) domain */ x2 = _unur_max( x2, DISTR.trunc[0]); x2 = _unur_min( x2, DISTR.trunc[1]); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file (in case error) */ if (gen->debug & NINV_DEBUG_SAMPLE) _unur_ninv_debug_sample( gen,u,x2,f2,i ); #endif /* finished */ return x2; } /* end of _unur_ninv_regula() */ /*****************************************************************************/ /** Bisection method **/ /*****************************************************************************/ double _unur_ninv_bisect( const struct unur_gen *gen, double u ) /*---------------------------------------------------------------------*/ /* algorithm: bisection method */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* u ... random number (uniform distribution) */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return UNUR_INFINITY */ /* */ /* Remark: */ /* The routine computes the root of CDF(x)-u */ /* */ /* References: */ /* [2] Dahlquist, G. and Bj{\"o}rck, {\AA} (2008): */ /* Numerical methods in scientific computing, Vol 1., */ /* SIAM, Philadelphia, PA. */ /*---------------------------------------------------------------------*/ { double x1, x2, mid=0.; /* boundary points and mid point of bracket */ double f1, f2, fmid; /* function values at x1, x2, and mid */ int i; /* loop variable, number of iterations */ double rel_u_resolution; /* relative u resolution */ /* check arguments */ CHECK_NULL(gen, UNUR_INFINITY); COOKIE_CHECK(gen, CK_NINV_GEN, UNUR_INFINITY); /* compute relative u resolution */ rel_u_resolution = ( (GEN->u_resolution > 0.) ? (GEN->Umax - GEN->Umin) * GEN->u_resolution : UNUR_INFINITY ); /* -- 1. + 2. find bracket -- */ if ( _unur_ninv_bracket( gen, u, &x1, &f1, &x2, &f2 ) != UNUR_SUCCESS ) return x2; /* -- 3. bisection steps */ for (i=0; imax_iter; i++) { /* compute new point */ mid = x1 + (x2-x1)/2.; fmid = CDF(mid) - u; /* update point */ if (f1*fmid <= 0) { /* keep left endpoint x1 */ x2 = mid; f2 = fmid; /* check accuracy goal */ if (_unur_ninv_accuracy( gen, GEN->x_resolution, rel_u_resolution, mid, fmid, x1, f1 )) break; } else { /* keep right endpoint x2 */ x1 = mid; f1 = fmid; /* check accuracy goal */ if (_unur_ninv_accuracy( gen, GEN->x_resolution, rel_u_resolution, mid, fmid, x2, f2 )) break; } } if (i >= GEN->max_iter) _unur_warning(gen->genid,UNUR_ERR_GEN_SAMPLING, "max number of iterations exceeded: accuracy goal might not be reached"); /* the text book algorithms usually add one more step: */ /* mid = x1 + (x2-x1)/2.; */ /* however, this causes problems when the maximal tolerated u-error */ /* has to be ensured! */ /* ensure location within given (truncated) domain */ mid = _unur_max( mid, DISTR.trunc[0]); mid = _unur_min( mid, DISTR.trunc[1]); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file (in case error) */ if (gen->debug & NINV_DEBUG_SAMPLE) _unur_ninv_debug_sample( gen,u,mid,CDF(mid)-u,i ); #endif /* finished */ return mid; } /* end of _unur_ninv_bisect() */ /*****************************************************************************/ /** Auxiliary routines **/ /*****************************************************************************/ int _unur_ninv_bracket( const struct unur_gen *gen, double u, double *xl, double *fl, double *xu, double *fu ) /*----------------------------------------------------------------------*/ /* find a bracket (enclosing interval) for root of CDF(x)-u. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* u ... random number (uniform distribution) */ /* xl, xu ... store lower and upper boundary of bracket */ /* fl, fu ... store values of CDF(x)-u at xl and xu, resp. */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* error: */ /* *fu is set to "best" result */ /*----------------------------------------------------------------------*/ { int i; /* loop variable, index */ double x1, x2, xtmp; /* points for bracket */ double f1, f2; /* function values at x1, x2 */ double step; /* enlarges interval til sign change found */ int step_count; /* counts number of steps finding sign change */ /* -- 1. initialize starting interval -- */ if (GEN->table_on) { /* -- 1a. use table -- */ /* 0 <= i <= table_size-2 */ if ( _unur_FP_same(GEN->CDFmin, GEN->CDFmax) ) { /* CDF values in table too close, so we use median point since */ /* there is no difference between CDF values. */ i = GEN->table_size/2; } else { i = (int) ( GEN->table_size * (u - GEN->CDFmin) / (GEN->CDFmax - GEN->CDFmin) ); if (i<0) i = 0; else if (i > GEN->table_size - 2) i = GEN->table_size - 2; } /* set starting point for regular falsi */ if ( ! _unur_FP_is_minus_infinity(GEN->table[i]) ){ x1 = GEN->table[i]; f1 = GEN->f_table[i]; } else{ x1 = GEN->table[i+1] + (GEN->table[i+1] - GEN->table[i+2]); f1 = CDF(x1); } if( ! _unur_FP_is_infinity(GEN->table[i+1]) ){ x2 = GEN->table[i+1]; f2 = GEN->f_table[i+1]; } else{ x2 = GEN->table[i] + (GEN->table[i] - GEN->table[i-1]); f2 = CDF(x2); } } else { /* 1b. -- no table available -- */ x1 = GEN->s[0]; /* left boudary of interval */ f1 = GEN->CDFs[0]; x2 = GEN->s[1]; /* right boudary of interval*/ f2 = GEN->CDFs[1]; } /* -- 1c. check for ordering of starting points -- */ if ( x1 >= x2 ) { xtmp = x1; x1 = x2; f1 = f2; x2 = xtmp + fabs(xtmp)*DBL_EPSILON; f2 = CDF(x2); } /* -- 1d. check for boundary of truncated domain -- */ /* in case of truncated domain there might be better starting points */ /* ! no problems with UNUR_INFINITY ! */ if ( x1 < DISTR.trunc[0] || x1 >= DISTR.trunc[1] ){ x1 = DISTR.trunc[0]; f1 = GEN->Umin; /* = CDF(x1) */ } if ( x2 > DISTR.trunc[1] || x2 <= DISTR.trunc[0] ){ x2 = DISTR.trunc[1]; f2 = GEN->Umax; /* = CDF(x2) */ } /* -- 1z. compute function values at interval boundaries -- */ f1 -= u; f2 -= u; /* -- 2. search for enclosing bracket (interval where f changes signs) -- */ step = (GEN->s[1]-GEN->s[0]) * STEPFAC; step_count = 0; while ( f1*f2 > 0. ) { /* interval too small -> make it bigger ( + 2^n * gap ) -- */ if ( f1 > 0. ) { /* lower boundary too big */ x2 = x1; f2 = f1; x1 -= step; f1 = CDF(x1) - u; } else { /* upper boundary too small */ x1 = x2; f1 = f2; x2 += step; f2 = CDF(x2) - u; } /* increase step width */ if (step_count < MAX_STEPS) { ++step_count; step *= 2.; /* safe guard for the case where (GEN->s[1]-GEN->s[0]) is very small*/ if( step_count > 20 && step < 1.) step = 1.; } else { _unur_error(gen->genid,UNUR_ERR_GEN_SAMPLING, "Regula Falsi cannot find interval with sign change"); *xu = (f1>0.) ? DISTR.trunc[0] : DISTR.trunc[1]; return UNUR_ERR_GEN_SAMPLING; } } /* o.k. */ *xl = x1; *xu = x2; *fl = f1; *fu = f2; return UNUR_SUCCESS; } /* end of _unur_ninv_bracket() */ /*---------------------------------------------------------------------------*/ int _unur_ninv_accuracy( const struct unur_gen *gen, double x_resol, double u_resol, double x0, double f0, double x1, double f1 ) /*----------------------------------------------------------------------*/ /* check accuracy goal for approximate root. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* x_resol ... maximal tolerated x-error */ /* u_resol ... maximal tolerated u-error */ /* x0 ... approximate point to be checked */ /* f0 ... function value at x0 */ /* x1 ... second boundary point of bracket */ /* (i.e., function must change sign in interval [x0,x1]) */ /* f1 ... function value at x1 */ /* */ /* return: */ /* TRUE ... if accuracy goal is reached */ /* FALSE ... otherwise */ /*----------------------------------------------------------------------*/ { int x_goal, u_goal; /* whether precision goal is reached */ if ( x_resol > 0. ) { /* check x-error */ /* we use a combination of absolute and relative x-error: */ /* x-error < x-resolution * fabs(x) + x-resolution^2 */ if ( _unur_iszero(f0) || /* exact hit */ fabs(x1-x0) < x_resol * (fabs(x0) + x_resol) ) { x_goal = TRUE; } else if ( _unur_FP_same(f0,f1) ) { /* flat region */ _unur_warning(gen->genid,UNUR_ERR_GEN_SAMPLING, "flat region: accuracy goal in x cannot be reached"); x_goal = TRUE; } else x_goal = FALSE; } else { /* no check */ x_goal = TRUE; } if ( GEN->u_resolution > 0. ) { /* check u-error */ /* (we use a slightly smaller maximal tolerated error than given by user) */ if (fabs(f0) < 0.9 * u_resol) { u_goal = TRUE; } else if ( _unur_FP_same(x0,x1) ) { /* sharp peak or pole */ _unur_warning(gen->genid,UNUR_ERR_GEN_SAMPLING, "sharp peak or pole: accuracy goal in u cannot be reached"); u_goal = TRUE; } else u_goal = FALSE; } else { u_goal = TRUE; } /* return result */ return (x_goal && u_goal); } /* end of _unur_ninv_accuracy() */ /*---------------------------------------------------------------------------*/ #undef MAX_STEPS #undef STEPFAC #undef I_CHANGE_TO_BISEC /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/hitro.h0000644001357500135600000005111314420445767013603 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: hitro.h * * * * PURPOSE: * * function prototypes for method HITRO * * (Markov Chain - HIT-and-run sampler with Ratio-Of-uniforms) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /* =METHOD HITRO Markov Chain - HIT-and-run sampler with Ratio-Of-uniforms =UP MCMC_Methods_for_CVEC =REQUIRED PDF =OPTIONAL mode, center, bounding rectangle for acceptance region =REF [KLPa05] =SPEED Set-up: fast, Sampling: fast =REINIT not implemented =DESCRIPTION HITRO is an implementation of a hit-and-run sampler that runs on the acceptance region of the multivariate ratio-of-uniforms method, see @ref{Ratio-of-Uniforms}. The Ratio-of-Uniforms transforms the region below the density into some region that we call "region of acceptance" in the following. The minimal bounding hyperrectangle of this region is given by @unurmathdisplay{ v^+ = \sup\limits_{x} (f(x))^{1/r\,d+1}, \\ u^-_i = \inf\limits_{x_i} (x_i-\mu_i) (f(x))^{r/r\,d+1}, \\ u^+_i = \sup\limits_{x_i} (x_i-\mu_i) (f(x))^{r/r\,d+1}, } where @i{d} denotes the dimension of the distribution; @unurmath{x_i} is the @i{i}-th coordinate of point @i{x}; @unurmath{\mu_i} is the @i{i}-th coordinate of the center @unurmath{\mu} of the distribution, i.e., a point in the "main region" of the distribution. Using the center is important, since otherwise the acceptance region can become a very long and skinny ellipsoid along a diagonal of the (huge) bounding rectangle. For each step of the Hit-and-Run algorithm we have to choose some direction. This direction together with the current point of the chain determines a straight line. Then a point is sampled uniformly on intersection of this line and the region of acceptance. This is done by rejection from a uniform distribution on a line segment that covers it. Depending of the chosen variant the endpoints of this covering line are computed either by means of a (not necessary minimal) bounding hyper-rectangle, or just the "covering plate" of the bounding hyper-rectangle. The required bounds of the hyper-rectable can be given directly by the user. Otherwise, these are computed automatically by means of a numerical routine by Hooke and Jeeves @unurbibref{HJa61} called direct search (see @file{src/utils/hooke.c} for further references and details). However, this expensive computation can be avoided by determine these bounds "on the fly" by the following adaptive algorithm: Start with some (small) hyper-rectangle and enlarge it whenever the endpoints of the covering line segment are not contained in the acceptance region of the Ratio-of-Unfiorms method. This approach works reliable as long as the region of acceptance is convex. The performance of the uniform sampling from the line segment is much improved if the covering line is adjusted (shortened) whenever a point is rejected (adaptive sampling). This technique reduces the expected number of iterations enormously. Method HITRO requires that the region of acceptance of the Ratio-of-Uniforms method is bounded. The shape of this region can be controlled by a parameter @i{r}. Higher values of @i{r} result in larger classes of distributions with bounded region of acceptance. (A distribution that has such a bounded region for some @i{r} also has a bounded region for every @i{r'} greater than @i{r}.) On the other hand the acceptance probability decreases with increasing @i{r}. Moreover, round-off errors are more likely and (for large values of @i{r}) might result in a chain with a stationary distribution different from the target distribution. Method HITRO works optimal for distributions whose region of acceptance is convex. This is in particular the case for all log-concave distributions when we set @i{r} = @code{1}. For bounded but non-convex regions of acceptance convergence is yet not guarenteed by mathematical theory. =HOWTOUSE Method HITRO requires the PDF of the target distribution (derivatives are not necessary). The acceptance region of the Ratio-of-Uniforms transformation must be bounded. Its shape is controlled by parameter @i{r}. By default this parameter is set to @code{1} as this guarentees a convex region of acceptance when the PDF of the given distribution is log-concave. It should only be set to a different (higher!) value using unur_vnrou_set_r() if otherwise @unurmath{x_i\,(f(x))^{r/r\,d+1}} were not bounded for each coordinate. There are two variants of the HITRO sampler: @table @emph @item coordinate direction sampling. [default] The coordinates are updated cyclically. This can be seen as a Gibbs sampler running on the acceptance region of the Ratio-of-Uniforms method. This variant can be selected using unur_hitro_set_variant_coordinate(). @item random direction sampling. In each step is a direction is sampled uniformly from the sphere. This variant can be selected using unur_hitro_set_variant_random_direction(). @end table Notice that each iteration of the coordinate direction sampler is cheaper than an iteration of the random direction sampler. Sampling uniformly from the line segment can be adjusted in several ways: @table @emph @item Adaptive line sampling vs. simple rejection. When adaptive line sampling is switched on, the covering line is shortened whenever a point is rejected. However, when the region of acceptance is not convex the line segment from which we have to sample might not be connected. We found that the algorithm still works but at the time being there is no formal proof that the generated Markov chain has the required stationary distribution. Adaptive line sampling can switch on/off by means of the unur_hitro_set_use_adaptiveline() call. @item Bounding hyper-rectangle vs. "covering plate". For computing the covering line we can use the bounding hyper-rectangle or just its upper bound. The latter saves computing time during the setup and when computing the covering during at each iteration step at the expense of a longer covering line. When adaptive line sampling is used the total generation time for the entire chain is shorter when only the "covering plate" is used. @emph{Notice:} When coordinate sampling is used the entire bounding rectangle is used. Using the entire bounding hyper-rectangle can be switched on/off by means of the unur_hitro_set_use_boundingrectangle() call. @item Deterministic vs. adaptive bounding hyper-rectangle. A bounding rectangle can be given by the unur_vnrou_set_u() and unur_vnrou_set_v() calls. Otherwise, the minimal bounding rectangle is computed automatically during the setup by means of a numerical algorithm. However, this is (very) slow especially in higher dimensions and it might happen that this algorithm (like any other numerical algorithm) does not return a correct result. Alternatively the bounding rectangle can be computed adaptively. In the latter case unur_vnrou_set_u() and unur_vnrou_set_v() can be used to provide a starting rectangle which must be sufficiently small. Then both endpoints of the covering line segment are always check whether they are outside the acceptance region of the Ratio-of-Uniforms method. If they are not, then the line segment and the ("bounding") rectangle are enlarged using a factor that can be given using the unur_hitro_set_adaptive_multiplier() call. Notice, that running this method in the adaptive rectangle mode requires that the region of acceptance is convex when random directions are used, or the given PDF is unimodal when coordinate direction sampling is used. Moreover, it requires two additional calls to the PDF in each iteration step of the chain. Using addaptive bounding rectangles can be switched on/off by means of the unur_hitro_set_use_adaptiverectangle() call. @end table The algorithm takes of a bounded rectangular domain given by a unur_distr_cvec_set_domain_rect() call, i.e. the PDF is set to zero for every @i{x} outside the given domain. However, it is only the coordinate direction sampler where the boundary values are directly used to get the endpoins of the coverline line for the line sampling step. @emph{Important:} The bounding rectangle has to be provided for the function @unurmath{PDF(x-center)!} Notice that @code{center} is the center of the given distribution, see unur_distr_cvec_set_center(). If in doubt or if this value is not optimal, it can be changed (overridden) by a unur_distr_cvec_set_center() call. =END */ /*---------------------------------------------------------------------------*/ /* Routines for user interface */ /* =ROUTINES */ UNUR_PAR *unur_hitro_new( const UNUR_DISTR *distribution ); /* Get default parameters for generator. */ /*...........................................................................*/ int unur_hitro_set_variant_coordinate( UNUR_PAR *parameters ); /* Coordinate Direction Sampling: Sampling along the coordinate directions (cyclic). @emph{Notice:} For this variant the entire bounding rectangle is always used independent of the unur_hitro_set_use_boundingrectangle() call. This is the default. */ int unur_hitro_set_variant_random_direction( UNUR_PAR *parameters ); /* Random Direction Sampling: Sampling along the random directions. */ int unur_hitro_set_use_adaptiveline( UNUR_PAR *parameters, int adaptive ); /* When @var{adaptive} is set to TRUE adaptive line sampling is applied, otherwise simple rejection is used. @emph{Notice:} When adaptive line sampling is switched off, the entire bounding rectangle must be used since otherwise the sampling time can be arbitrarily slow. @emph{Warning:} When adaptive line sampling is switched off, sampling can be arbitrarily slow. In particular this happens when random direction sampling is used for distributions with rectangular domains. Then the algorithm can be trapped into a vertex (or even edge). Default is TRUE. */ int unur_hitro_set_use_boundingrectangle( UNUR_PAR *parameters, int rectangle ); /* When @var{rectangle} is set to TRUE the entire bounding rectangle is used for computing the covering line. Otherwise, only an upper bound for the acceptance region is used. @emph{Notice:} When coordinate sampling is used the entire bounding rectangle has is always used and this call has no effect. Default: FALSE for random direction samplig, TRUE for coordinate direction sampling. */ int unur_hitro_set_use_adaptiverectangle( UNUR_PAR *parameters, int adaptive ); /* When @var{adaptive} is set to FALSE the bounding rectangle is determined during the setup. Either, it is computed automatically by a (slow) numerical method, or it must be provided by unur_vnrou_set_u() and unur_vnrou_set_v() calls. If @var{adaptive} is set to TRUE the bounding rectangle is computed adaptively. In this case the unur_vnrou_set_u() and unur_vnrou_set_v() calls can be used to provide a starting rectangle. This should be sufficiently small. If not given then we assume @unurmath{v_{max} = 1,} @unurmath{u_{min}=(-0.001,-0.001,\ldots,-0.001),} and @unurmath{u_{max}=(0.001,0.001,\ldots,0.001).} Adaptive enlargements of the bounding hyperrectangle can be controlled set setting an enlargement factor given by a unur_hitro_set_adaptive_multiplier() call. Using adaptive computation of the bounding rectangle reduces the setup time significantly (when it is not given by the user) at the expense of two additional PDF evaluations during each iteration step. @emph{Important:} Using adaptive bounding rectangles requires that the region of acceptance is convex when random directions are used, or a unimodal PDF when coordinate direction sampling is used. Default: FALSE for random direction samplig, TRUE for coordinate direction sampling. */ /*...........................................................................*/ int unur_hitro_set_r( UNUR_PAR *parameters, double r ); /* Sets the parameter @var{r} of the generalized multivariate ratio-of-uniforms method. @emph{Notice}: This parameter must satisfy @var{r}>0. Default: @code{1}. */ int unur_hitro_set_v( UNUR_PAR *parameters, double vmax ); /* Set upper boundary for bounding hyper-rectangle. If not set not set the mode of the distribution is used. If adaptive bounding rectangles the value is used for the starting rectangle. If not given (and the mode of the distribution is not known) then @var{vmax}=@code{1e-3} is used. If deterministic bounding rectangles these values are the given values are used for the rectangle. If no value is given (and the mode of the distribution is not known), the upper bound of the minimal bounding hyper-rectangle is computed numerically (slow). Default: not set. */ int unur_hitro_set_u( UNUR_PAR *parameters, const double *umin, const double *umax ); /* Sets left and right boundaries of bounding hyper-rectangle. If adaptive bounding rectangles these values are used for the starting rectangle. If not given then @var{umin}=@code{@{-b,-b,@dots{},-b@}} and @var{umax}=@code{@{b,b,@dots{},b@}} with @code{b=1.e-3} is used. If deterministic bounding rectangles these values are the given values are used for the rectangle. If no values are given, the boundary of the minimal bounding hyper-rectangle is computed numerically (slow). @strong{Important}: The boundaries are those of the density shifted by the center of the distribution, i.e., for the function @unurmath{PDF(x-center)!} @emph{Notice}: Computing the minimal bounding rectangle may fail under some circumstances. Moreover, for multimodal distributions the bounds might be too small as only local extrema are computed. Nevertheless, for log-concave distributions it should work. Default: not set. */ int unur_hitro_set_adaptive_multiplier( UNUR_PAR *parameters, double factor ); /* Adaptive enlargements of the bounding hyperrectangle can be controlled set setting the enlargement @var{factor}. This must be greater than 1. Values close to 1 result in small adaptive steps and thus reduce the risk of too large bounding rectangles. On the other hand many adaptive steps might be necessary. @emph{Notice:} For practical reasons this call does not accept values for @var{factor} less than @code{1.0001}. If this value is UNUR_INFINITY this results in infinite loops. Default: @code{1.1} */ /*...........................................................................*/ int unur_hitro_set_startingpoint( UNUR_PAR *parameters, const double *x0 ); /* Sets the starting point of the HITRO sampler in the original scale. @var{x0} must be a "typical" point of the given distribution. If such a "typical" point is not known and a starting point is merely guessed, the first part of the HITRO chain should be discarded (@emph{burn-in}), e.g.\ by mean of the unur_hitro_set_burnin() call. @emph{Important:} The PDF of the distribution must not vanish at the given point @var{x0}. Default is the result of unur_distr_cvec_get_center() for the given distribution object. */ int unur_hitro_set_thinning( UNUR_PAR *parameters, int thinning ); /* Sets the @var{thinning} parameter. When @var{thinning} is set to @i{k} then every @i{k}-th point from the iteration is returned by the sampling algorithm. If thinning has to be set such that each coordinate is updated when using coordinate direction sampling, then @var{thinning} should be @code{dim+1} (or any multiple of it) where @code{dim} is the dimension of the distribution object. @emph{Notice}: This parameter must satisfy @var{thinning}>=1. Default: @code{1}. */ int unur_hitro_set_burnin( UNUR_PAR *parameters, int burnin ); /* If a "typical" point for the target distribution is not known but merely guessed, the first part of the HITRO chain should be discarded (@emph{burn-in}). This can be done during the initialization of the generator object. The length of the burn-in can is then @var{burnin}. The thinning factor set by a unur_hitro_set_thinning() call has no effect on the length of the burn-in, i.e., for the burn-in always a thinning factor @code{1} is used. @emph{Notice}: This parameter must satisfy @var{thinning}>=0. Default: @code{0}. */ /*...........................................................................*/ const double *unur_hitro_get_state( UNUR_GEN *generator ); /* */ int unur_hitro_chg_state( UNUR_GEN *generator, const double *state ); /* Get and change the current state of the HITRO chain. @emph{Notice:} The state variable contains the point in the @code{dim+1} dimensional point in the (tansformed) region of acceptance of the Ratio-of-Uniforms method. Its coordinate are stored in the following order: @code{state[] = @{v, u1, u2, @dots{}, udim@}}. If the state can only be changed if the given @var{state} is inside this region. */ int unur_hitro_reset_state( UNUR_GEN *generator ); /* Reset state of chain to starting point. @emph{Notice:} Currently this function does not reset the generators for conditional distributions. Thus it is not possible to get the same HITRO chain even when the underlying uniform random number generator is reset. */ /* =END */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/mvstd.c0000644001357500135600000006355414420445767013622 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: mvstd.c * * * * TYPE: multivariate continuous random variate * * METHOD: generators for standard distribution * * * ***************************************************************************** * * * Copyright (c) 2000-2007 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * ***************************************************************************** * * * MVSTD is a wrapper for special generator for MultiVariate continuous * * STandarD distributions. It only works for distributions in the UNURAN * * library of distributions and will refuse to work otherwise. * * (In detail it rejects a distribution if its id is equal to DISTR_GENERIC, * * the id inserted my the unur_distr_cvec_new() call.) * * * * It calls the initialzation routine provided by the distribution object. * * This routine has to do all setup steps for the special generator. * * If no such routine is given, i.e. distr->init==NULL, then * * unur_mvstd_new() does not work and the NULL pointer is returned instead * * of the pointer to a parameter object. * * * * Notice that using a truncated distribution (this can be constructed by * * changing the default domain of a distribution by means of an * * unur_distr_cvec_set_domain_rect() call) is not possible. * * method is used. Otherwise no parameter object is returned by the * * unur_cstd_new() call. * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include #include "unur_methods_source.h" #include "x_gen_source.h" #include "mvstd.h" #include "mvstd_struct.h" #ifdef UNUR_ENABLE_INFO # include #endif /*---------------------------------------------------------------------------*/ /* Variants: none */ /*---------------------------------------------------------------------------*/ /* Debugging flags */ /* bit 01 ... pameters and structure of generator (do not use here) */ /* bits 02-12 ... setup */ /* bits 13-24 ... adaptive steps */ /* bits 25-32 ... trace sampling */ #define MVSTD_DEBUG_REINIT 0x00000010u /* print parameters after reinit */ /*---------------------------------------------------------------------------*/ /* Flags for logging set calls */ /*---------------------------------------------------------------------------*/ #define GENTYPE "MVSTD" /* type of generator */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_mvstd_init( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* Initialize new generator. */ /*---------------------------------------------------------------------------*/ static int _unur_mvstd_reinit( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Reinitialize generator. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_mvstd_create( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* create new (almost empty) generator object. */ /*---------------------------------------------------------------------------*/ static int _unur_mvstd_check_par( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Check parameters of given distribution and method */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_mvstd_clone( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* copy (clone) generator object. */ /*---------------------------------------------------------------------------*/ static void _unur_mvstd_free( struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* destroy generator object. */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* There are sampling routines, since every distribution has its own. */ /* Sampling routines are defined in ../distributions/ for each distributions.*/ /* double _unur_mvstd_sample( UNUR_GEN *gen ); does not exist! */ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ /* the following functions print debugging information on output stream, */ /* i.e., into the LOG file if not specified otherwise. */ /*---------------------------------------------------------------------------*/ static void _unur_mvstd_debug_init( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print after generator has been initialized has completed. */ /*---------------------------------------------------------------------------*/ #endif #ifdef UNUR_ENABLE_INFO static void _unur_mvstd_info( struct unur_gen *gen, int help ); /*---------------------------------------------------------------------------*/ /* create info string. */ /*---------------------------------------------------------------------------*/ #endif /*---------------------------------------------------------------------------*/ /* abbreviations */ #define DISTR_IN distr->data.cvec /* data for distribution object */ #define PAR ((struct unur_mvstd_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_mvstd_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.cvec /* data for distribution in generator object */ #define SAMPLE gen->sample.cvec /* pointer to sampling routine */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Public: User Interface (API) **/ /*****************************************************************************/ struct unur_par * unur_mvstd_new( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get default parameters */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* default parameters (pointer to structure) */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_par *par; /* check arguments */ _unur_check_NULL(GENTYPE,distr,NULL); /* check distribution */ if (distr->type != UNUR_DISTR_CVEC) { _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } COOKIE_CHECK(distr,CK_DISTR_CVEC,NULL); if (distr->id == UNUR_DISTR_GENERIC) { _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,"standard distribution"); return NULL; } if (DISTR_IN.init == NULL) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"init() for special generators"); return NULL; } /* allocate structure */ par = _unur_par_new( sizeof(struct unur_mvstd_par) ); COOKIE_SET(par,CK_MVSTD_PAR); /* copy input */ par->distr = distr; /* pointer to distribution object */ /* set default values */ par->method = UNUR_METH_MVSTD; /* method */ par->variant = 0u; /* default variant */ par->set = 0u; /* indicate default parameters */ par->urng = unur_get_default_urng(); /* use default urng */ par->urng_aux = NULL; /* no auxilliary URNG required */ par->debug = _unur_default_debugflag; /* set default debugging flags */ /* routine for initializing generator */ par->init = _unur_mvstd_init; return par; } /* end of unur_mvstd_new() */ /*****************************************************************************/ /** Private **/ /*****************************************************************************/ struct unur_gen * _unur_mvstd_init( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* initialize new generator */ /* */ /* parameters: */ /* par ... pointer to paramters for building generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); /* check for required data: initializing routine for special generator */ if (par->DISTR_IN.init == NULL) { _unur_error(GENTYPE,UNUR_ERR_NULL,""); return NULL; } /* check input */ if ( par->method != UNUR_METH_MVSTD ) { _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); return NULL; } COOKIE_CHECK(par,CK_MVSTD_PAR,NULL); /* create a new empty generator object */ gen = _unur_mvstd_create(par); _unur_par_free(par); if (!gen) return NULL; /* run special init routine for generator */ if ( DISTR.init(gen)!=UNUR_SUCCESS ) { /* init failed --> could not find a sampling routine */ _unur_error(GENTYPE,UNUR_ERR_GEN_DATA,"variant for special generator"); _unur_mvstd_free(gen); return NULL; } /* check parameters */ if (_unur_mvstd_check_par(gen) != UNUR_SUCCESS) { _unur_mvstd_free(gen); return NULL; } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_mvstd_debug_init(gen); #endif /* o.k. */ return gen; } /* end of _unur_mvstd_init() */ /*---------------------------------------------------------------------------*/ int _unur_mvstd_reinit( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* re-initialize (existing) generator. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* run special init routine for generator */ if ( DISTR.init(gen)!=UNUR_SUCCESS ) { /* init failed --> could not find a sampling routine */ _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"parameters"); return UNUR_ERR_GEN_DATA; } /* check parameters */ return _unur_mvstd_check_par(gen); } /* end of _unur_mvstd_reinit() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_mvstd_create( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* allocate memory for generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* pointer to (empty) generator object with default settings */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_MVSTD_PAR,NULL); /* create new generic generator object */ gen = _unur_generic_create( par, sizeof(struct unur_mvstd_gen) ); /* magic cookies */ COOKIE_SET(gen,CK_MVSTD_GEN); /* set generator identifier */ gen->genid = _unur_set_genid(GENTYPE); /* routines for sampling and destroying generator */ SAMPLE = NULL; /* will be set in _unur_mvstd_init() */ gen->destroy = _unur_mvstd_free; gen->clone = _unur_mvstd_clone; gen->reinit = _unur_mvstd_reinit; /* defaults */ GEN->sample_routine_name = NULL ; /* name of sampling routine */ #ifdef UNUR_ENABLE_INFO /* set function for creating info string */ gen->info = _unur_mvstd_info; #endif /* return pointer to (almost empty) generator object */ return gen; } /* end of _unur_mvstd_create() */ /*---------------------------------------------------------------------------*/ int _unur_mvstd_check_par( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* check parameters of given distribution and method */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* we do not allow truncated multinormal distributions */ if (gen->distr->set & UNUR_DISTR_SET_DOMAINBOUNDED) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"truncated domain"); return UNUR_ERR_GEN_CONDITION; } /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_mvstd_check_par() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_mvstd_clone( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* copy (clone) generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to clone of generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { #define CLONE ((struct unur_mvstd_gen*)clone->datap) struct unur_gen *clone; /* check arguments */ CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_MVSTD_GEN,NULL); /* create generic clone */ clone = _unur_generic_clone( gen, GENTYPE ); return clone; #undef CLONE } /* end of _unur_mvstd_clone() */ /*---------------------------------------------------------------------------*/ void _unur_mvstd_free( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* deallocate generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { /* check arguments */ if( !gen ) /* nothing to do */ return; /* magic cookies */ COOKIE_CHECK(gen,CK_MVSTD_GEN,RETURN_VOID); /* check input */ if ( gen->method != UNUR_METH_MVSTD ) { _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); return; } /* we cannot use this generator object any more */ SAMPLE = NULL; /* make sure to show up a programming error */ /* free memory */ _unur_generic_free(gen); } /* end of _unur_mvstd_free() */ /*****************************************************************************/ /** double _unur_mvstd_sample( struct unur_gen *gen ) {} Does not exists !!! Sampling routines are defined in ../distributions/ for each distributions. **/ /*****************************************************************************/ /** Auxilliary Routines **/ /*****************************************************************************/ /*****************************************************************************/ /** Debugging utilities **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ void _unur_mvstd_debug_init( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write info about generator into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_MVSTD_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: type = continuous multivariate random variates\n",gen->genid); fprintf(LOG,"%s: method = generator for standard distribution\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); /* distribution */ _unur_distr_cvec_debug( gen->distr, gen->genid ); /* sampling routine */ fprintf(LOG,"%s: sampling routine = ",gen->genid); if (GEN->sample_routine_name) fprintf(LOG,"%s()\n",GEN->sample_routine_name); else fprintf(LOG,"(Unknown)\n"); fprintf(LOG,"%s:\n",gen->genid); fflush(LOG); } /* end of _unur_mvstd_debug_init() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_INFO /*---------------------------------------------------------------------------*/ void _unur_mvstd_info( struct unur_gen *gen, int help ) /*----------------------------------------------------------------------*/ /* create character string that contains information about the */ /* given generator object. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* help ... whether to print additional comments */ /*----------------------------------------------------------------------*/ { struct unur_string *info = gen->infostr; int dim = gen->distr->dim; int samplesize = 10000; double E_urn; /* generator ID */ _unur_string_append(info,"generator ID: %s\n\n", gen->genid); /* distribution */ _unur_string_append(info,"distribution:\n"); _unur_distr_info_typename(gen); _unur_string_append(info," dimension = %d\n",dim); _unur_distr_cvec_info_domain(gen); _unur_string_append(info,"\n\n"); /* if (help) { */ /* _unur_string_append(info,"\n"); */ /* } */ /* method */ _unur_string_append(info,"method: MVSTD (special generator for MultiVariate continuous STandarD distribution)\n"); /* _unur_string_append(info," variant = %d\n", gen->variant); */ _unur_string_append(info,"\n"); /* performance */ _unur_string_append(info,"performance characteristics:\n"); E_urn = unur_test_count_urn(gen,samplesize,0,NULL)/((double)samplesize); _unur_string_append(info," E [#urn] = %.2f x %d = %.2f [approx.]\n", E_urn / dim, dim, E_urn); _unur_string_append(info,"\n"); /* parameters */ if (help) { _unur_string_append(info,"parameters: none\n"); /* _unur_string_append(info," variant = %d %s\n", gen->variant, */ /* (gen->set & MVSTD_SET_VARIANT) ? "" : "[default]"); */ _unur_string_append(info,"\n"); } /* Hints */ /* if (help) { */ /* _unur_string_append(info,"\n"); */ /* } */ } /* end of _unur_mvstd_info() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_INFO */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/dsrou.h0000644001357500135600000001454214420445767013617 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: dsrou.h * * * * PURPOSE: * * function prototypes for method DSROU * * (Discrete, Simple universal generator, Ratio-Of-Uniforms method) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /* =METHOD DSROU Discrete Simple Ratio-Of-Uniforms method =UP Methods_for_DISCR =REQUIRED T-concave PMF, mode, sum over PMF =SPEED Set-up: fast, Sampling: slow =REINIT supported =REF [LJa01] [HLD04: Sect.10.3.2, Alg.10.6] =DESCRIPTION DSROU is based on the ratio-of-uniforms method (@pxref{Ratio-of-Uniforms}) but uses universal inequalities for constructing a (universal) bounding rectangle. It works for all @i{T}-concave distributions with @unurmath{T(x) = -1/\sqrt{x}}. The method requires the PMF, the (exact) location of the mode and the sum over the given PDF. The rejection constant is 4 for all @i{T}-concave distributions. Optionally the CDF at the mode can be given to increase the performance of the algorithm. Then the rejection constant is reduced to 2. =HOWTOUSE The method works for @i{T}-concave discrete distributions with given PMF. The sum over of the PMF or an upper bound of this sum must be known. Optionally the CDF at the mode can be given to increase the performance using unur_dsrou_set_cdfatmode(). However, this @strong{must not} be called if the sum over the PMF is replaced by an upper bound. It is possible to change the parameters and the domain of the chosen distribution and run unur_reinit() to reinitialize the generator object. If any of mode, CDF at mode, or the sum over the PMF has been changed, then unur_reinit() must be executed. (Otherwise the generator produces garbage). There exists a test mode that verifies whether the conditions for the method are satisfied or not while sampling. It can be switched on or off by calling unur_dsrou_set_verify() and unur_dsrou_chg_verify(), respectively. Notice however that sampling is (a little bit) slower then. =END */ /*---------------------------------------------------------------------------*/ /* Routines for user interface */ /* =ROUTINES */ UNUR_PAR *unur_dsrou_new( const UNUR_DISTR *distribution ); /* Get default parameters for generator. */ /*...........................................................................*/ int unur_dsrou_set_cdfatmode( UNUR_PAR *parameters, double Fmode ); /* Set CDF at mode. When set, the performance of the algorithm is increased by factor 2. However, when the parameters of the distribution are changed unur_dsrou_chg_cdfatmode() has to be used to update this value. Notice that the algorithm detects a mode at the left boundary of the domain automatically and it is not necessary to use this call for a monotonically decreasing PMF. Default: not set. */ int unur_dsrou_set_verify( UNUR_PAR *parameters, int verify ); /* */ int unur_dsrou_chg_verify( UNUR_GEN *generator, int verify ); /* Turn verifying of algorithm while sampling on/off. If the condition squeeze(@i{x}) <= PMF(@i{x}) <= hat(@i{x}) is violated for some @i{x} then @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. However notice that this might happen due to round-off errors for a few values of @i{x} (less than 1%). Default is FALSE. */ /*...........................................................................*/ int unur_dsrou_chg_cdfatmode( UNUR_GEN *generator, double Fmode ); /* Change CDF at mode of distribution. unur_reinit() must be executed before sampling from the generator again. */ /* =END */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/norta.h0000644001357500135600000001411714420445767013604 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: norta.h * * * * PURPOSE: * * function prototypes for method NORTA * * (NORmal To Anything) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /* =METHOD NORTA NORmal To Anything =UP Methods_for_CVEC =REQUIRED rank correlation matrix, marginal distributions =SPEED Set-up: slow, Sampling: depends on dimension =REINIT not implemented =REF [HLD04: Sect.12.5.2, Alg.12.11.] =DESCRIPTION NORTA (NORmal to anything) is a model to get random vectors with given marginal distributions and rank correlation. @strong{Important:} Notice that marginal distribution and (rank) correlation structure do not uniquely define a multivariate distribution. Thus there are many other (more or less sensible) models. In the NORTA model multinormal random variates with the given (Spearman's) rank correlations are generated. In a second step the (standard normal distributed) marginal variates are transformed by means of the CDF of the normal distribution to get uniform marginals. The resulting random vectors have uniform marginals and the desired rank correlation between its components. Such a random vector is called 'copula'. By means of the inverse CDF the uniform marginals are then transformed into the target marginal distributions. This transformation does not change the rank correlation. For the generation of the multinormal distribution the (Spearman's) rank correlation matrix is transformed into the corresponding (Pearson) correlation matrix. Samples from the resulting multinormal distribution are generated by means of the Cholesky decomposition of the covariance matrix. It can happen that the desired rank correlation matrix is not feasible, i.e., it cannot occur as rank correlation matrix of a multinormal distribution. The resulting "covariance" matrix is not positive definite. In this case an eigenvector correction method is used. Then all non-positive eigenvalues are set to a small positive value and hence the rank correlation matrix of the generated random vectors is "close" to the desired matrix. =HOWTOUSE Create a multivariate generator object and set marginal distributions using unur_distr_cvec_set_marginals(), unur_distr_cvec_set_marginal_array(), or unur_distr_cvec_set_marginal_list(). (Do not use the corresponding calls for the standard marginal distributions). When the domain of the multivariate distribution is set by of a unur_distr_cvec_set_domain_rect() call then the domain of each of the marginal distributions is truncated by the respective coordinates of the given rectangle. If copulae are required (i.e. multivariate distributions with uniform marginals) such a generator object can be created by means of unur_distr_copula() . There are no optional parameters for this method. =END */ /*---------------------------------------------------------------------------*/ /* Routines for user interface */ /* =ROUTINES */ UNUR_PAR *unur_norta_new( const UNUR_DISTR *distribution ); /* Get default parameters for generator. */ /*...........................................................................*/ /* =END */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/cext.h0000644001357500135600000002035714420445767013427 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: cext.h * * * * PURPOSE: * * function prototypes for method CEXT * * (wrapper for Continuous EXTernal generators) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /* =METHOD CEXT wrapper for Continuous EXTernal generators =UP Methods_for_CONT =REQUIRED routine for sampling continuous random variates =SPEED depends on external generator =REINIT supported =DESCRIPTION Method CEXT is a wrapper for external generators for continuous univariate distributions. It allows the usage of external random variate generators within the UNU.RAN framework. =HOWTOUSE The following steps are required to use some external generator within the UNU.RAN framework (some of these are optional): @enumerate @item Make an empty generator object using a unur_cext_new() call. The argument @var{distribution} is optional and can be replaced by NULL. However, it is required if you want to pass parameters of the generated distribution to the external generator or for running some validation tests provided by UNU.RAN. @item Create an initialization routine of type @code{int (*init)(UNUR_GEN *gen)} and plug it into the generator object using the unur_cext_set_init() call. Notice that the @var{init} routine must return @code{UNUR_SUCCESS} when it has been executed successfully and @code{UNUR_FAILURE} otherwise. It is possible to get the size of and the pointer to the array of parameters of the underlying distribution object by the respective calls unur_cext_get_ndistrparams() and unur_cext_get_distrparams(). Parameters for the external generator that are computed in the @var{init} routine can be stored in a single array or structure which is available by the unur_cext_get_params() call. Using an @var{init} routine is optional and can be omitted. @item Create a sampling routine of type @code{double (*sample)(UNUR_GEN *gen)} and plug it into the generator object using the unur_cext_set_sample() call. Uniform random numbers are provided by the unur_sample_urng() call. Do not use your own implementation of a uniform random number generator directly. If you want to use your own random number generator we recommend to use the UNU.RAN interface (see @pxref{URNG,,Using uniform random number generators}). The array or structure that contains parameters for the external generator that are computed in the @var{init} routine are available using the unur_cext_get_params() call. Using a @var{sample} routine is of course obligatory. @end enumerate It is possible to change the parameters and the domain of the chosen distribution and run unur_reinit() to reinitialize the generator object. The @var{init} routine is then called again. Here is a short example that demonstrates the application of this method by means of the exponential distribution: @smallexample @include ref_example_cext.texi @end smallexample =END */ /*---------------------------------------------------------------------------*/ /* Routines for user interface */ /* =ROUTINES */ UNUR_PAR *unur_cext_new( const UNUR_DISTR *distribution ); /* Get default parameters for new generator. */ /*...........................................................................*/ int unur_cext_set_init( UNUR_PAR *parameters, int (*init)(UNUR_GEN *gen) ); /* Set initialization routine for external generator. Inside the @emph{Important:} The routine @var{init} must return @code{UNUR_SUCCESS} when the generator was initialized successfully and @code{UNUR_FAILURE} otherwise. Parameters that are computed in the @var{init} routine can be stored in an array or structure that is avaiable by means of the unur_cext_get_params() call. Parameters of the underlying distribution object can be obtained by the unur_cext_get_distrparams() call. */ int unur_cext_set_sample( UNUR_PAR *parameters, double (*sample)(UNUR_GEN *gen) ); /* Set sampling routine for external generator. @emph{Important:} Use @code{unur_sample_urng(gen)} to get a uniform random number. The pointer to the array or structure that contains the parameters that are precomputed in the @var{init} routine are available by @code{unur_cext_get_params(gen,0)}. Additionally one can use the unur_cext_get_distrparams() call. */ void *unur_cext_get_params( UNUR_GEN *generator, size_t size ); /* Get pointer to memory block for storing parameters of external generator. A memory block of size @var{size} is automatically (re-) allocated if necessary and the pointer to this block is stored in the @var{generator} object. If one only needs the pointer to this memory block set @var{size} to @code{0}. Notice, that @var{size} is the size of the memory block and not the length of an array. @emph{Important:} This rountine should only be used in the initialization and sampling routine of the external generator. */ double *unur_cext_get_distrparams( UNUR_GEN *generator ); /* */ int unur_cext_get_ndistrparams( UNUR_GEN *generator ); /* Get size of and pointer to array of parameters of underlying distribution in @var{generator} object. @emph{Important:} These rountines should only be used in the initialization and sampling routine of the external generator. */ /*...........................................................................*/ /* =END */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/pinv_init.ch0000644001357500135600000005110014420445767014614 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: pinv_init.c * * * * Routines for initialization and deletion of generator objects. * * * ***************************************************************************** * * * Copyright (c) 2008-2010 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * *****************************************************************************/ /*****************************************************************************/ /** Private **/ /*****************************************************************************/ struct unur_gen * _unur_pinv_init( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* initialize new generator */ /* */ /* parameters: */ /* params pointer to paramters for building generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ _unur_check_NULL( GENTYPE,par,NULL ); /* check input */ if ( par->method != UNUR_METH_PINV ) { _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); return NULL; } COOKIE_CHECK(par,CK_PINV_PAR,NULL); /* create a new empty generator object */ gen = _unur_pinv_create(par); _unur_par_free(par); if (!gen) return NULL; /* check parameters */ if (_unur_pinv_check_par(gen) != UNUR_SUCCESS) { _unur_pinv_free(gen); return NULL; } /* compute rescaling factor for PDF */ /* (only used when logPDF is given) */ /* Disabled! */ /* We found that it is not such a good idea. */ /* if (DISTR.logpdf != NULL && (gen->variant & PINV_VARIANT_PDF) ) { */ /* double lfc = UNUR_UNUR_INFINITY; */ /* /\* use mode if available *\/ */ /* if ( (gen->distr->set & UNUR_DISTR_SET_MODE) && */ /* !_unur_FP_less(DISTR.mode,DISTR.domain[0]) && */ /* !_unur_FP_greater(DISTR.mode,DISTR.domain[1]) ) { */ /* lfc = (DISTR.logpdf)(DISTR.mode,gen->distr); */ /* } */ /* /\* use center otherwise (or if logPDF(mode)==UNUR_INFINITY) *\/ */ /* if (!_unur_isfinite(lfc)) */ /* lfc = (DISTR.logpdf)(DISTR.center,gen->distr); */ /* /\* rescaling results in more evaluations of the logPDF, *\/ */ /* /\* when the logPDF is approximately 0. *\/ */ /* /\* so we only rescale the logPDF when it is too small. *\/ */ /* if (lfc < -3.) */ /* GEN->logPDFconstant = lfc; */ /* } */ #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_pinv_debug_init_start(gen); #endif /* 1. Preprocessing: */ /* find interval for computing Newton interpolation */ if (_unur_pinv_preprocessing(gen) != UNUR_SUCCESS) { /* preprocessing failed */ #ifdef UNUR_ENABLE_LOGGING if (gen->debug) _unur_pinv_debug_init(gen,FALSE); #endif _unur_pinv_free(gen); return NULL; } /* 2. Interpolation: */ /* compute table for Newton interpolation */ if (_unur_pinv_create_table(gen) != UNUR_SUCCESS) { #ifdef UNUR_ENABLE_LOGGING if (gen->debug) _unur_pinv_debug_init(gen,FALSE); #endif _unur_pinv_free(gen); return NULL; } /* we do not need the table with CDF values any more. */ /* thus we may free the allocated memory. */ if (! (gen->variant & PINV_VARIANT_KEEPCDF)) _unur_lobatto_free(&(GEN->aCDF)); /* make guide table */ _unur_pinv_make_guide_table(gen); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_pinv_debug_init(gen,TRUE); #endif /* o.k. */ return gen; } /* end of _unur_pinv_init() */ /*---------------------------------------------------------------------------*/ /* int */ /* _unur_pinv_reinit( struct unur_gen *gen ) */ /* /\*----------------------------------------------------------------------*\/ */ /* /\* re-initialize (existing) generator. *\/ */ /* /\* *\/ */ /* /\* parameters: *\/ */ /* /\* gen ... pointer to generator object *\/ */ /* /\* *\/ */ /* /\* return: *\/ */ /* /\* UNUR_SUCCESS ... on success *\/ */ /* /\* error code ... on error *\/ */ /* /\*----------------------------------------------------------------------*\/ */ /* { */ /* int rcode; */ /* /\* check parameters *\/ */ /* if ( (rcode = _unur_pinv_check_par(gen)) != UNUR_SUCCESS) */ /* return rcode; */ /* return UNUR_SUCCESS; */ /* } /\* end of _unur_pinv_reinit() *\/ */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_pinv_create( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* allocate memory for generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* pointer to (empty) generator object with default settings */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_PINV_PAR,NULL); /* create new generic generator object */ gen = _unur_generic_create( par, sizeof(struct unur_pinv_gen) ); /* magic cookies */ COOKIE_SET(gen,CK_PINV_GEN); /* set generator identifier */ gen->genid = _unur_set_genid(GENTYPE); /* routines for sampling and destroying generator */ SAMPLE = _unur_pinv_getSAMPLE(gen); gen->destroy = _unur_pinv_free; gen->clone = _unur_pinv_clone; /* gen->reinit = _unur_pinv_reinit; */ /* copy parameters into generator object */ GEN->order = PAR->order; /* order of polynomial */ GEN->smooth = PAR->smooth; /* smoothness parameter */ GEN->u_resolution = PAR->u_resolution; /* maximal error in u-direction */ GEN->n_extra_testpoints = PAR->n_extra_testpoints; /* number of extra test points for error estimate */ GEN->bleft_par = PAR->bleft; /* border of computational domain */ GEN->bright_par = PAR->bright; GEN->sleft = PAR->sleft; /* whether to search for boundary */ GEN->sright = PAR->sright; GEN->max_ivs = PAR->max_ivs; /* maximum number of subintervals */ /* initialize variables */ GEN->bleft = GEN->bleft_par; GEN->bright = GEN->bright_par; GEN->dleft = -UNUR_INFINITY; GEN->dright = UNUR_INFINITY; GEN->Umax = 1.; GEN->iv = NULL; GEN->n_ivs = -1; /* -1 indicates that there are no intervals at all */ GEN->guide_size = 0; GEN->guide = NULL; GEN->area = DISTR.area; /* we use the value in the distribution object as first guess */ /* GEN->logPDFconstant = 0.; rescaling constant for logPDF: Disabled */ GEN->aCDF = NULL; /* pointer to approximate CDF */ /* allocate maximal array of intervals */ /* [ Maybe we could move this into _unur_pinv_interval() ] */ GEN->iv = _unur_xmalloc(GEN->max_ivs * sizeof(struct unur_pinv_interval) ); #ifdef UNUR_ENABLE_INFO /* set function for creating info string */ gen->info = _unur_pinv_info; #endif /* return pointer to (almost empty) generator object */ return gen; } /* end of _unur_pinv_create() */ /*---------------------------------------------------------------------------*/ int _unur_pinv_check_par( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* check parameters of given distribution and method */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* smoothness parameter */ switch (GEN->smooth) { case 2: if (GEN->order < 5) { _unur_warning(gen->genid,UNUR_ERR_GENERIC,"order must be >= 5 when smoothness = 2"); GEN->order = 5; gen->set |= PINV_SET_ORDER_COR; } if (GEN->order % 3 != 2) { _unur_warning(gen->genid,UNUR_ERR_GENERIC,"order must be 2 mod 3 when smoothness = 2"); GEN->order = 2 + 3 * (GEN->order / 3); gen->set |= PINV_SET_ORDER_COR; } if (DISTR.pdf == NULL || DISTR.dpdf == NULL) { _unur_warning(gen->genid,UNUR_ERR_DISTR_REQUIRED,"PDF and dPDF required for smoothness = 2 --> try smoothness=1 instead"); GEN->smooth = 1; gen->set |= PINV_SET_SMOOTH_COR; } else { break; } case 1: if (GEN->order % 2 != 1) { _unur_warning(gen->genid,UNUR_ERR_GENERIC,"order must be odd when smoothness = 1"); GEN->order += 1; gen->set |= PINV_SET_ORDER_COR; } if (DISTR.pdf == NULL) { _unur_warning(gen->genid,UNUR_ERR_DISTR_REQUIRED,"PDF required --> use smoothness=0 instead"); GEN->smooth = 0; gen->set |= PINV_SET_SMOOTH_COR; } else { break; } case 0: break; default: _unur_warning(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,"smoothness must be 0, 1, or 2"); GEN->smooth = 0; /* use default */ } /* points for searching computational domain */ GEN->bleft = _unur_max(GEN->bleft_par,DISTR.domain[0]); GEN->bright = _unur_min(GEN->bright_par,DISTR.domain[1]); /* domain not truncated at init */ DISTR.trunc[0] = DISTR.domain[0]; DISTR.trunc[1] = DISTR.domain[1]; /* domain of distribution (used when x with PDF(x)=0 are found) */ GEN->dleft = DISTR.domain[0]; GEN->dright = DISTR.domain[1]; /* center of distribution */ DISTR.center = unur_distr_cont_get_center(gen->distr); if (DISTR.center < GEN->dleft || DISTR.center > GEN->dright) { _unur_warning(gen->genid,UNUR_ERR_GENERIC, "center moved into domain of distribution"); DISTR.center = _unur_max(DISTR.center,GEN->dleft); DISTR.center = _unur_min(DISTR.center,GEN->dright); } /* check center of distribution */ if ( (gen->variant & PINV_VARIANT_PDF ) && /* (_unur_pinv_search_center(gen) != UNUR_SUCCESS) ) { */ (_unur_distr_cont_find_center(gen->distr) != UNUR_SUCCESS) ) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION, "PDF(center) <= 0."); return UNUR_ERR_GEN_CONDITION; } /* there is no table of CDF values when the CDF is given */ if (! (gen->variant & PINV_VARIANT_PDF)) gen->variant &= ~PINV_VARIANT_KEEPCDF; /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_pinv_check_par() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_pinv_clone( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* copy (clone) generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to clone of generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { #define CLONE ((struct unur_pinv_gen*)clone->datap) struct unur_gen *clone; int i; /* check arguments */ CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_PINV_GEN,NULL); /* create generic clone */ clone = _unur_generic_clone( gen, GENTYPE ); /* we do not need the table with CDF values */ CLONE->aCDF = NULL; /* copy coefficients for Newton polynomial */ CLONE->iv = _unur_xmalloc((GEN->n_ivs+1) * sizeof(struct unur_pinv_interval) ); memcpy( CLONE->iv, GEN->iv, (GEN->n_ivs+1) * sizeof(struct unur_pinv_interval) ); for(i=0; i<=GEN->n_ivs; i++) { CLONE->iv[i].ui = _unur_xmalloc( GEN->order * sizeof(double) ); CLONE->iv[i].zi = _unur_xmalloc( GEN->order * sizeof(double) ); memcpy( CLONE->iv[i].ui, GEN->iv[i].ui, GEN->order * sizeof(double) ); memcpy( CLONE->iv[i].zi, GEN->iv[i].zi, GEN->order * sizeof(double) ); } /* copy guide table */ CLONE->guide = _unur_xmalloc( GEN->guide_size * sizeof(int) ); memcpy( CLONE->guide, GEN->guide, GEN->guide_size * sizeof(int) ); return clone; #undef CLONE } /* end of _unur_pinv_clone() */ /*---------------------------------------------------------------------------*/ void _unur_pinv_free( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* deallocate generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { int i; /* check arguments */ if( !gen ) /* nothing to do */ return; /* check input */ if ( gen->method != UNUR_METH_PINV ) { _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); return; } COOKIE_CHECK(gen,CK_PINV_GEN,RETURN_VOID); /* we cannot use this generator object any more */ SAMPLE = NULL; /* make sure to show up a programming error */ /* free guide table */ if (GEN->guide) free (GEN->guide); /* free array for subintervals of adaptive Gauss-Lobatto integration */ _unur_lobatto_free(&(GEN->aCDF)); /* free tables of coefficients of interpolating polynomials */ if (GEN->iv) { for(i=0; i<=GEN->n_ivs; i++){ free(GEN->iv[i].ui); free(GEN->iv[i].zi); } free (GEN->iv); } /* free memory */ _unur_generic_free(gen); } /* end of _unur_pinv_free() */ /*****************************************************************************/ int _unur_pinv_make_guide_table (struct unur_gen *gen) /*----------------------------------------------------------------------*/ /* make a guide table for indexed search */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int i,j, imax; /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_PINV_GEN,UNUR_ERR_COOKIE); /* allocate blocks for guide table (if necessary). (we allocate blocks for maximal guide table.) */ GEN->guide_size = (int) (GEN->n_ivs * PINV_GUIDE_FACTOR); if (GEN->guide_size <= 0) GEN->guide_size = 1; GEN->guide = _unur_xrealloc( GEN->guide, GEN->guide_size * sizeof(int) ); /* maximum index for array of data */ imax = GEN->n_ivs; /* create guide table */ i = 0; GEN->guide[0] = 0; for( j=1; jguide_size ;j++ ) { while(GEN->iv[i+1].cdfi/GEN->Umax < j/(double)GEN->guide_size && i < imax) i++; if (i >= imax) break; GEN->guide[j]=i; } /* check i */ i = _unur_min(i,imax); /* if there has been an round off error, we have to complete the guide table */ for( ; jguide_size ;j++ ) GEN->guide[j] = i; /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_pinv_make_guide_table() */ /*---------------------------------------------------------------------------*/ double _unur_pinv_eval_PDF (double x, struct unur_gen *gen) /*----------------------------------------------------------------------*/ /* call to PDF. */ /* if PDF(x) == UNUR_INFINITY (i.e., x is a pole of the PDF) */ /* we compute PDF(x+dx) for a small dx instead. */ /* */ /* parameters: */ /* x ... argument of PDF */ /* gen ... pointer to generator object */ /* */ /* return: */ /* PDF at x */ /*----------------------------------------------------------------------*/ { struct unur_distr *distr = gen->distr; double fx, dx; int i; for (i=1; i<=2; i++) { /* we try two times: */ /* one time for given x, the second time for x+dx. */ /* compute PDF(x) */ if (DISTR.logpdf != NULL) { fx = exp((DISTR.logpdf)(x,distr)); /* scaling factor Disabled! */ /* fx = exp((DISTR.logpdf)(x,distr) - GEN->logPDFconstant); */ } else fx = (DISTR.pdf)(x,distr); /* check for pole (i.e., PDF(x)==UNUR_INFINITY) */ if (fx >= UNUR_INFINITY) { /* pole at x --> move x slightly */ dx = 2.*fabs(x)*DBL_EPSILON; dx = _unur_max(dx,2.*DBL_MIN); x += ((x - GEN->bleft) < (GEN->bright - x)) ? dx : -dx; } else /* not a pole */ break; } return fx; } /* end of _unur_pinv_eval_PDF() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/unif_struct.h0000644001357500135600000000613614420304141015004 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: unif_struct.h * * * * PURPOSE: * * declares structures for method UNIF * * (passes UNIForm random numbers through UNURAN framework; * * for testing only) * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Information for constructing the generator */ struct unur_unif_par { int dummy; }; /*---------------------------------------------------------------------------*/ /* The generator object */ struct unur_unif_gen { int dummy; }; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/ninv_debug.ch0000644001357500135600000001613514420445767014746 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: ninv_debug.ch * * * * Routines for printing debugging information. * * * ***************************************************************************** * * * Copyright (c) 2000-2009 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * *****************************************************************************/ /*****************************************************************************/ /** Debugging utilities **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ void _unur_ninv_debug_init( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write info about generator into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_NINV_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: type = continuous univariate random variates\n",gen->genid); fprintf(LOG,"%s: method = ninv (numerical inversion of CDF)\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); _unur_distr_cont_debug( gen->distr, gen->genid ); fprintf(LOG,"%s: sampling routine = _unur_ninv_sample",gen->genid); switch (gen->variant) { case NINV_VARFLAG_NEWTON: fprintf(LOG,"_newton\n"); break; case NINV_VARFLAG_BISECT: fprintf(LOG,"_bisect\n"); break; case NINV_VARFLAG_REGULA: default: fprintf(LOG,"_regula\n"); break; } fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: u-resolution = ",gen->genid); if (GEN->u_resolution < 0.) fprintf(LOG,"[disabled]"); else fprintf(LOG,"%g",GEN->u_resolution); _unur_print_if_default(gen,NINV_SET_U_RESOLUTION); fprintf(LOG,"\n%s: x-resolution = ",gen->genid); if (GEN->x_resolution < 0.) fprintf(LOG,"[disabled]"); else fprintf(LOG,"%g",GEN->x_resolution); _unur_print_if_default(gen,NINV_SET_X_RESOLUTION); fprintf(LOG,"\n%s:\n",gen->genid); _unur_ninv_debug_start(gen); fprintf(LOG,"%s:\n",gen->genid); } /* end of _unur_ninv_debug_init() */ /*---------------------------------------------------------------------------*/ void _unur_ninv_debug_start( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* print starting points or table for algorithms into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; int i; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_NINV_GEN,RETURN_VOID); LOG = unur_get_stream(); if (GEN->table_on) { fprintf(LOG,"%s: use table (size = %d)\n",gen->genid,GEN->table_size); if (gen->debug & NINV_DEBUG_TABLE) for (i=0; itable_size; i++) fprintf(LOG,"%s:\tx = %12.6g, F(x) = %10.8f\n",gen->genid,GEN->table[i],GEN->f_table[i]); } else { /* no table */ fprintf(LOG,"%s: starting points:\n",gen->genid); fprintf(LOG,"%s:\ts[0] = %12.6g, F(x) = %10.8f\n",gen->genid,GEN->s[0],GEN->CDFs[0]); if (! (gen->variant & NINV_VARFLAG_NEWTON)) fprintf(LOG,"%s:\ts[1] = %12.6g, F(x) = %10.8f\n",gen->genid,GEN->s[1],GEN->CDFs[1]); } fprintf(LOG,"%s:\n",gen->genid); } /* end of _unur_ninv_debug_start() */ /*---------------------------------------------------------------------------*/ void _unur_ninv_debug_sample( const struct unur_gen *gen, double u, double x, double fx, int iter ) /*----------------------------------------------------------------------*/ /* trace sampling (regula falsi) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_NINV_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s: u = %8.6f,\t x = %8.6g\t(cdf(x)-u = %8.2g)\t -- %2d iterations [%d]\n", gen->genid,u,x,fx,iter,GEN->max_iter); } /* end of _unur_ninv_debug_sample_regula() */ /*---------------------------------------------------------------------------*/ void _unur_ninv_debug_chg_truncated( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* print new (changed) domain of (truncated) distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_NINV_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s: domain of (truncated) distribution changed:\n",gen->genid); fprintf(LOG,"%s:\tdomain = (%g, %g)\n",gen->genid, DISTR.trunc[0], DISTR.trunc[1]); fprintf(LOG,"%s:\tU in (%g,%g)\n",gen->genid,GEN->Umin,GEN->Umax); } /* end of _unur_ninv_debug_chg_truncated() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/tdr_ps_sample.ch0000644001357500135600000004772414420445767015472 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: tdr_ps_sample.c * * * * TYPE: continuous univariate random variate * * METHOD: transformed density rejection * * * * DESCRIPTION: * * Sampling routines for variant with proportional squeezes. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*****************************************************************************/ /** Sampling routines **/ /*****************************************************************************/ double _unur_tdr_ps_sample( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator (proportional squeeze) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return UNUR_INFINITY */ /* */ /*======================================================================*/ /* comment: */ /* x ... random point */ /* x0 ... left construction point in interval */ /* x1 ... right construction point in interval */ /* f ... PDF */ /* Tf ... transformed PDF */ /* dTf ... derivative of transformed PDF */ /* sq ... slope of squeeze in interval */ /* */ /*----------------------------------------------------------------------*/ /* if (Tf)'(x0) == 0: */ /* X = x0 + U / f(x0) */ /* U ~ U(0,area below hat) */ /* */ /*----------------------------------------------------------------------*/ /* log(x): */ /* */ /* hat(x) = f(x0) * exp( (Tf)'(x0) * (x-x0) ) */ /* generation: */ /* X = x0 + 1/(Tf)'(x0) * \log( (Tf)'(x0)/f(x0) * U + 1 ) */ /* U ~ U(-area below left hat, area below left hat) */ /* */ /*----------------------------------------------------------------------*/ /* T(x) = -1/sqrt(x): */ /* */ /* hat(x) = 1 / (Tf(x0) + (Tf)'(x0) * (x-x0))^2 */ /* generation: */ /* X = x0 + (Tf(x0)^2 * U) / (1 - Tf(x0) * (Tf)'(x0) * U) */ /* U ~ U(-area below left hat, area below left hat) */ /*----------------------------------------------------------------------*/ { UNUR_URNG *urng; /* pointer to uniform random number generator */ struct unur_tdr_interval *iv; double U, V; /* uniform random number */ double X; /* generated point */ double fx; /* value of density at X */ double Thx; /* value of transformed hat at X */ /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_INFINITY); if (GEN->iv == NULL) { _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"empty generator object"); return UNUR_INFINITY; } /* main URNG */ urng = gen->urng; while (1) { /* sample from U( Umin, Umax ) */ U = GEN->Umin + _unur_call_urng(urng) * (GEN->Umax - GEN->Umin); /* look up in guide table and search for segment */ iv = GEN->guide[(int) (U * GEN->guide_size)]; U *= GEN->Atotal; while (iv->Acum < U) { iv = iv->next; } /* reuse of uniform random number */ U -= iv->Acum - iv->Ahatr; /* result: U in (-A_hatl, A_hatr) */ /* generate from hat distribution */ switch (gen->variant & TDR_VARMASK_T) { case TDR_VAR_T_LOG: if (_unur_iszero(iv->dTfx)) X = iv->x + U / iv->fx; else { double t = iv->dTfx * U / iv->fx; if (fabs(t) > 1.e-6) /* x = iv->x + log(t + 1.) / iv->dTfx; is cheaper but numerical unstable */ X = iv->x + log(t + 1.) * U / (iv->fx * t); else if (fabs(t) > 1.e-8) /* use Taylor series */ X = iv->x + U / iv->fx * (1 - t/2. + t*t/3.); else X = iv->x + U / iv->fx * (1 - t/2.); } break; case TDR_VAR_T_SQRT: if (_unur_iszero(iv->dTfx)) X = iv->x + U / iv->fx; else { /* it would be less expensive to use: X = iv->x + iv->Tfx/iv->dTfx * (1. - 1./(1. + iv->dTfx * iv->Tfx * U) ) however, this is unstable for small iv->dTfx */ X = iv->x + (iv->Tfx*iv->Tfx*U) / (1.-iv->Tfx*iv->dTfx*U); /* It cannot happen, that the denominator becomes 0 ! */ } break; case TDR_VAR_T_POW: /** TODO **/ default: _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); return UNUR_INFINITY; } /* end switch */ /* accept or reject */ V = _unur_call_urng(urng); /* squeeze rejection */ if (V <= iv->sq) return X; /* evaluate hat at X: get uniform random number between 0 and hat(X) */ switch (gen->variant & TDR_VARMASK_T) { case TDR_VAR_T_LOG: V *= iv->fx * exp(iv->dTfx*(X - iv->x)); break; case TDR_VAR_T_SQRT: Thx = iv->Tfx + iv->dTfx * (X - iv->x); /* transformed hat at X */ V *= 1./(Thx*Thx); break; case TDR_VAR_T_POW: /** TODO **/ default: return UNUR_INFINITY; } /* end switch */ /* evaluate PDF at X */ fx = PDF(X); /* main rejection */ if (V <= fx) return X; /* being above squeeze is bad. improve the situation! */ if (GEN->n_ivs < GEN->max_ivs) { if ( (_unur_tdr_ps_improve_hat( gen, iv, X, fx) != UNUR_SUCCESS) && (gen->variant & TDR_VARFLAG_PEDANTIC) ) return UNUR_INFINITY; } /* else reject and try again */ /* use the auxilliary generator the next time (it can be the same as the main generator) */ urng = gen->urng_aux; } } /* end of _unur_tdr_ps_sample() */ /*---------------------------------------------------------------------------*/ double _unur_tdr_ps_sample_check( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator and verify results (proportional squeeze) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { UNUR_URNG *urng; /* pointer to uniform random number generator */ struct unur_tdr_interval *iv; double U, V; /* uniform random number */ double X; /* generated point */ double fx, sqx, hx; /* values of density, squeeze, and hat at X */ int squeeze_rejection = FALSE; /* indicates squeeze rejection */ #ifdef UNUR_ENABLE_LOGGING int error = 0; /* indicates error */ #endif /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_INFINITY); if (GEN->iv == NULL) { _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"empty generator object"); return UNUR_INFINITY; } /* main URNG */ urng = gen->urng; while (1) { /* sample from U( Umin, Umax ) */ U = GEN->Umin + _unur_call_urng(urng) * (GEN->Umax - GEN->Umin); /* evaluate inverse of hat CDF */ X = _unur_tdr_ps_eval_invcdfhat( gen, U, &hx, &fx, &sqx, &iv ); /* accept or reject */ V = _unur_call_urng(urng); /* squeeze rejection */ if (V <= iv->sq) squeeze_rejection = TRUE; /* get uniform random number between 0 and hat(X) */ V *= hx; /* check result */ if (_unur_FP_less(X, DISTR.BD_LEFT) || _unur_FP_greater(X, DISTR.BD_RIGHT) ) { _unur_warning(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,"generated point out of domain"); #ifdef UNUR_ENABLE_LOGGING error = 1; #endif } if (_unur_FP_greater(fx, hx)) { _unur_warning(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF > hat. Not T-concave!"); #ifdef UNUR_ENABLE_LOGGING error = 1; #endif } if (_unur_FP_less(fx, sqx)) { _unur_warning(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF < squeeze. Not T-concave!"); #ifdef UNUR_ENABLE_LOGGING error = 1; #endif } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file (in case error) */ if (error && (gen->debug & TDR_DEBUG_SAMPLE)) _unur_tdr_ps_debug_sample( gen, iv, X, fx, hx, sqx ); #endif /* squeeze rejection */ if (squeeze_rejection) return X; /* main rejection */ if (V <= fx) return X; /* being above squeeze is bad. improve the situation! */ if (GEN->n_ivs < GEN->max_ivs) { if ( (_unur_tdr_ps_improve_hat( gen, iv, X, fx) != UNUR_SUCCESS) && (gen->variant & TDR_VARFLAG_PEDANTIC) ) return UNUR_INFINITY; } /* else reject and try again */ /* use the auxilliary generator the next time (it can be the same as the main generator) */ urng = gen->urng_aux; } } /* end of _unur_tdr_ps_sample_check() */ /*---------------------------------------------------------------------------*/ double _unur_tdr_ps_eval_invcdfhat( const struct unur_gen *gen, double U, double *hx, double *fx, double *sqx, struct unur_tdr_interval **ivl ) /*----------------------------------------------------------------------*/ /* evaluate the inverse of the hat CDF at u */ /* (original variant by Gilks & Wild) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* U ... argument for inverse CDF (0<=U<=1, no validation!) */ /* hx ... pointer for storing hat at sampled X */ /* fx ... pointer for storing squeeze at sampled X */ /* sqx ... pointer for storing density at sampled X */ /* ivl ... pointer to interval for hat */ /* */ /* return: */ /* inverse hat CDF. */ /* */ /* values of hat, density, squeeze (computation is suppressed if */ /* corresponding pointer is NULL). */ /* */ /* ivl can be NULL. then no pointer is stored. */ /*----------------------------------------------------------------------*/ { struct unur_tdr_interval *iv; /* pointer to intervals */ double X; /* inverse of hat CDF at U */ double Thx; /* transformed squeeze */ double t; /* aux variable */ /** -1- Compute inverse of hat CDF at U **/ /* look up in guide table and search for segment */ iv = GEN->guide[(int) (U * GEN->guide_size)]; U *= GEN->Atotal; while (iv->Acum < U) { iv = iv->next; } /* transform u such that u in (-A_hatl, A_hatr) */ /* (reuse of uniform random number) */ U -= iv->Acum - iv->Ahatr; /* inverse of CDF (random variate) */ switch (gen->variant & TDR_VARMASK_T) { case TDR_VAR_T_LOG: if (_unur_iszero(iv->dTfx)) X = iv->x + U / iv->fx; else { t = iv->dTfx * U / iv->fx; if (fabs(t) > 1.e-6) /* x = iv->x + log(t + 1.) / iv->dTfx; is cheaper but numerical unstable */ X = iv->x + log(t + 1.) * U / (iv->fx * t); else if (fabs(t) > 1.e-8) /* use Taylor series */ X = iv->x + U / iv->fx * (1 - t/2. + t*t/3.); else X = iv->x + U / iv->fx * (1 - t/2.); } break; case TDR_VAR_T_SQRT: if (_unur_iszero(iv->dTfx)) X = iv->x + U / iv->fx; else { /* it would be less expensive to use: X = iv->x + iv->Tfx/iv->dTfx * (1. - 1./(1. + iv->dTfx * iv->Tfx * U) ) however, this is unstable for small iv->dTfx */ X = iv->x + (iv->Tfx*iv->Tfx*U) / (1.-iv->Tfx*iv->dTfx*U); /* It cannot happen, that the denominator becomes 0 ! */ } break; case TDR_VAR_T_POW: /** TODO **/ default: _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); return UNUR_INFINITY; } /* end switch */ /** -2- Evaluate hat at X **/ if (hx != NULL) switch (gen->variant & TDR_VARMASK_T) { case TDR_VAR_T_LOG: *hx = iv->fx * exp(iv->dTfx*(X - iv->x)); break; case TDR_VAR_T_SQRT: Thx = iv->Tfx + iv->dTfx * (X - iv->x); /* transformed hat at X */ *hx = 1./(Thx*Thx); break; case TDR_VAR_T_POW: /** TODO **/ default: *hx = UNUR_INFINITY; } /* end switch */ /** -3- Evaluate density at X **/ if (fx != NULL) { *fx = PDF(X); } /** -4- Evaluate squeeze at X **/ if (sqx != NULL && hx != NULL) { *sqx = *hx * iv->sq; } /* store interval pointer */ if (ivl) *ivl = iv; return X; } /* end of _unur_tdr_ps_eval_invcdfhat() */ /*---------------------------------------------------------------------------*/ int _unur_tdr_ps_improve_hat( struct unur_gen *gen, struct unur_tdr_interval *iv, double x, double fx ) /*----------------------------------------------------------------------*/ /* improve hat function by splitting interval */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* iv ... pointer to interval that has to be split */ /* x ... splitting point */ /* fx ... value of PDF at splitting point */ /* */ /* return: */ /* UNUR_SUCCESS ... improving hat successful */ /* others ... error: PDF not monotone in interval */ /*----------------------------------------------------------------------*/ { int result; /* is there any reason to improve hat ? */ if (! (GEN->max_ratio * GEN->Atotal > GEN->Asqueeze) ) { /* no more construction points (avoid calling this function any more) */ GEN->max_ivs = GEN->n_ivs; return UNUR_SUCCESS; } /* add construction point */ result = _unur_tdr_ps_interval_split(gen, iv, x, fx); if (result!=UNUR_SUCCESS && result!=UNUR_ERR_SILENT && result!=UNUR_ERR_INF) { /* condition for PDF is violated! */ _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,""); if (gen->variant & TDR_VARFLAG_PEDANTIC || result == UNUR_ERR_ROUNDOFF) { /* replace sampling routine by dummy routine that just returns UNUR_INFINITY */ SAMPLE = _unur_sample_cont_error; return UNUR_ERR_GEN_CONDITION; } } /* splitting successful --> update guide table */ /** TODO: it is not necessary to update the guide table every time. But then (1) some additional bookkeeping is required and (2) the guide table method requires a acc./rej. step. **/ _unur_tdr_make_guide_table(gen); /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_tdr_ps_improve_hat() */ /*****************************************************************************/ unuran-1.11.0/src/methods/utdr_struct.h0000644001357500135600000000766714420445767015057 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: utdr_struct.h * * * * PURPOSE: * * declares structures for method UTDR * * (Universal Transformed Density Rejection; 3-point method) * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Information for constructing the generator */ struct unur_utdr_par { double fm; /* PDF at mode */ double hm; /* transformed PDF at mode */ double c_factor; /* constant for choosing the design points */ double delta_factor; /* delta to replace the tangent */ }; /*---------------------------------------------------------------------------*/ /* The generator object */ struct unur_utdr_gen { double il; /* left border of the domain */ double ir; /* right border of the domain */ double fm; /* PDF at mode */ double hm; /* transformed PDF at mode */ double vollc,volcompl,voll, al,ar,col,cor,sal,sar,bl,br,ttlx,ttrx, brblvolc,drar,dlal,ooar2,ooal2;/* constants of the hat and for generation*/ double c_factor; /* constant for choosing the design points */ double delta_factor; /* delta to replace the tangent */ }; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/mvstd_struct.h0000644001357500135600000000705514420445767015225 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: mvstd_struct.h * * * * PURPOSE: * * declares structures for method MVSTD * * (wrapper for special generators for * * MultiVariate continuous STandarD distributions) * * * ***************************************************************************** * * * Copyright (c) 2000-2007 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Information for constructing the generator */ struct unur_mvstd_par { int dummy; /* no special parameters */ }; /*---------------------------------------------------------------------------*/ /* The generator object */ struct unur_mvstd_gen { const char *sample_routine_name; /* name of sampling routine */ /* Currently, there is no need to store constants and parameter for */ /* special generators. So it is not implemented yet. */ /* (When added, do not forget to initialize, copy and free corresponding */ /* pointers!) */ }; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/dgt_struct.h0000644001357500135600000000717114420304141014621 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: dgt_struct.h * * * * PURPOSE: * * declares structures for method DGT * * (Discrete Guide Table (indexed search)) * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Information for constructing the generator */ struct unur_dgt_par { double guide_factor; /* relative length of guide table. (DEFAULT = 1) */ /* length of guide table = guide_factor * len */ }; /*---------------------------------------------------------------------------*/ /* The generator object */ struct unur_dgt_gen { double sum; /* sum of all probabilities = cumpv[len-1] */ double *cumpv; /* pointer to the vector of cumulated probabilities */ int *guide_table; /* pointer to guide table */ int guide_size; /* length of guide table */ double guide_factor; /* relative length of guide table. (DEFAULT = 1) */ /* length of guide table = guide_factor * len */ }; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/vempk.h0000644001357500135600000001433714420304141013563 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: vempk.h * * * * PURPOSE: * * function prototypes for method VEMPK * * ((Vector) EMPirical distribution with Kernel smoothing) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /* =METHOD VEMPK (Vector) EMPirical distribution with Kernel smoothing =UP Methods_for_CVEMP =REQUIRED observed sample =SPEED Set-up: slow, Sampling: slow (depends on dimension) =REINIT not implemented =REF [HLa00] [HLD04: Sect.12.2.1] =DESCRIPTION VEMPK generates random variates from a multivariate empirical distribution that is given by an observed sample. The idea is that simply choosing a random point from the sample and to return it with some added noise results in a method that has very nice properties, as it can be seen as sampling from a kernel density estimate. Clearly we have to decide about the density of the noise (called kernel) and about the covariance matrix of the noise. The mathematical theory of kernel density estimation shows us that we are comparatively free in choosing the kernel. It also supplies us with a simple formula to compute the optimal standarddeviation of the noise, called bandwidth (or window width) of the kernel. Currently only a Gaussian kernel with the same covariance matrix as the given sample is implemented. However it is possible to choose between a variance corrected version or those with optimal MISE. Additionally a smoothing factor can be set to adjust the estimated density to non-bell-shaped data densities. =HOWTOUSE VEMPK uses empirical distributions. The main parameter would be the choice if of kernel density. However, currently only Gaussian kernels are supported. The parameters for the density are computed by a simple but robust method. However, it is possible to control its behavior by changing the smoothing factor. Additionally, variance correction can be swithed on (at the price of suboptimal MISE). =END */ /*---------------------------------------------------------------------------*/ /* Routines for user interface */ /* =ROUTINES */ UNUR_PAR *unur_vempk_new( const UNUR_DISTR *distribution ); /* Get default parameters for generator. */ /*...........................................................................*/ int unur_vempk_set_smoothing( UNUR_PAR *parameters, double smoothing ); /* */ int unur_vempk_chg_smoothing( UNUR_GEN *generator, double smoothing ); /* Set and change the smoothing factor. The smoothing factor controlles how ``smooth'' the resulting density estimation will be. A smoothing factor equal to 0 results in naive resampling. A very large smoothing factor (together with the variance correction) results in a density which is approximately equal to the kernel. Default is 1 which results in a smoothing parameter minimising the MISE (mean integrated squared error) if the data are not too far away from normal. If a large smoothing factor is used, then variance correction must be switched on. Default: @code{1} */ int unur_vempk_set_varcor( UNUR_PAR *parameters, int varcor ); /* */ int unur_vempk_chg_varcor( UNUR_GEN *generator, int varcor ); /* Switch variance correction in generator on/off. If @var{varcor} is TRUE then the variance of the used density estimation is the same as the sample variance. However this increases the MISE of the estimation a little bit. Default is FALSE. */ /* =END */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/tdr_gw_init.ch0000644001357500135600000005666214420445767015150 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: tdr_gw_init.c * * * * TYPE: continuous univariate random variate * * METHOD: transformed density rejection * * * * DESCRIPTION: * * Initializing routines for variant of Gilks and Wild. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ int _unur_tdr_gw_starting_intervals( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* compute intervals for starting points */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { struct unur_tdr_interval *iv, *iv_new, *iv_tmp; double x,fx; /* construction point, value of PDF at x */ /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_ERR_COOKIE); CHECK_NULL(GEN->iv,UNUR_ERR_NULL); COOKIE_CHECK(GEN->iv,CK_TDR_IV,UNUR_ERR_COOKIE); /* compute paramters for all intervals */ for( iv=GEN->iv; iv->next != NULL; ) { /* compute parameters for interval */ switch (_unur_tdr_gw_interval_parameter(gen, iv)) { case UNUR_SUCCESS: /* computation of parameters for interval successful */ /* skip to next interval */ iv = iv->next; continue; case UNUR_ERR_INF: /* interval unbounded */ /* split interval */ break; case UNUR_ERR_SILENT: /* construction points too close */ /* we have to remove this last interval from list */ /* (the last construction point in the list is a boundary point. thus we might change the domain of the distribution. however, we only cut off a piece that is beyond the precesion of the floating point arithmetic.) */ iv_tmp = iv->next; iv->next = iv->next->next; free(iv_tmp); --(GEN->n_ivs); if (iv->next==NULL) { /* last (virtuel) interval in list. make shure that we will never use this segment */ iv->Asqueeze = iv->Ahat = iv->Ahatr = iv->sq = 0.; iv->Acum = UNUR_INFINITY; } else /* we need a pointer to the previous entry in the list */ iv->next->prev = iv; continue; default: /* PDF not T-concave */ return UNUR_ERR_GEN_CONDITION; } /* area below hat infinite. insert new construction point. */ x = _unur_arcmean(iv->x,iv->next->x); /* use mean point in interval */ /* value of PDF at x */ fx = PDF(x); /* add a new interval, but check if we had to used too many intervals */ if (GEN->n_ivs >= GEN->max_ivs) { /* we do not want to create too many intervals */ _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"cannot create bounded hat!"); return UNUR_ERR_GEN_CONDITION; } iv_new = _unur_tdr_interval_new( gen, x, fx, FALSE ); if (iv_new == NULL) return UNUR_ERR_GEN_DATA; /* PDF(x) < 0 or overflow !! */ /* if fx is 0, then we can cut off the tail of the distribution (since it must be T-concave) */ if (fx <= 0.) { if (iv->fx <= 0.) { /* cut off left tail */ iv_new->next = iv->next; free(iv); --(GEN->n_ivs); GEN->iv = iv_new; iv_new->prev = NULL; /* compute the parameters for the new left part */ iv = iv_new; } else if (iv->next->fx <= 0.) { /* cut off right tail */ free(iv->next); --(GEN->n_ivs); iv->next = iv_new; iv_new->prev = iv; /* compute the paramters for the new part */ /* (nothing to do here) */ } else { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF not T-concave!"); free(iv_new); return UNUR_ERR_GEN_CONDITION; } } else { /* insert new interval into linked list */ iv_new->prev = iv; iv_new->next = iv->next; iv->next->prev = iv_new; iv->next = iv_new; } } /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_tdr_gw_starting_intervals() */ /*---------------------------------------------------------------------------*/ int _unur_tdr_gw_dars( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* run derandomized adaptive rejection sampling (Gilks&Wild) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { struct unur_tdr_interval *iv, *iv_next; double Alimit; /* threshhold value for splitting interval */ double x0, x1; /* boundary of interval */ double xsp, fxsp; /* splitting point in interval */ double xAhatl, xAhatr, xAsqueeze; int rule; /* id for splitting rule that has been applied */ int n_splitted; /* count splitted intervals */ int splitted; /* result of splitting routine */ /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_ERR_COOKIE); /* now split intervals */ while ( (GEN->max_ratio * GEN->Atotal > GEN->Asqueeze) && (GEN->n_ivs < GEN->max_ivs) ) { /* compute threshhold value. every interval with area between hat and squeeze greater than this value will be splitted. */ if (GEN->n_ivs > 1) Alimit = GEN->darsfactor * ( (GEN->Atotal - GEN->Asqueeze) / GEN->n_ivs ); else /* we split every interval if there are only one interval */ Alimit = 0.; /* reset counter for splitted intervals */ n_splitted = 0; /* for all intervals do ... */ for (iv = GEN->iv; iv->next != NULL; iv = iv->next ) { COOKIE_CHECK(iv,CK_TDR_IV,UNUR_ERR_COOKIE); /* do not exceed the maximum number of intervals */ if (GEN->n_ivs >= GEN->max_ivs) break; /* we skip over all intervals where the area between hat and squeeze does not exceed the threshhold value. */ if ((iv->Ahat - iv->Asqueeze) <= Alimit) continue; /* goto next interval */ /* store pointer to next interval */ iv_next = iv->next; /* boundary of interval */ x0 = iv->x; x1 = iv->next->x; /* get splitting point */ for (rule = GEN->darsrule; rule <= 3; rule++) { switch (rule) { case 1: /* rule 1: expected value */ if ( _unur_FP_is_minus_infinity(x0) || _unur_FP_is_infinity(x1) || _unur_FP_approx(x0,x1) ) /* we do not use the expected value in case of unbounded intervals */ continue; /* try next rule */ /* l.h.s. hat */ xAhatl = _unur_tdr_interval_xxarea( gen, iv, iv->dTfx, iv->ip); /* r.h.s. hat */ xAhatr = _unur_tdr_interval_xxarea( gen, iv->next, iv->next->dTfx, iv->ip); /* squeeze */ if (iv->Asqueeze > 0.) /* always integrate from point with greater value of transformed density to the other point */ xAsqueeze = (iv->Tfx > iv->next->Tfx) ? _unur_tdr_interval_xxarea( gen, iv, iv->sq, x1) : _unur_tdr_interval_xxarea( gen, iv->next, iv->sq, x0); else /* there is no squeeze */ xAsqueeze = 0.; /* check results */ if (! (_unur_isfinite(xAhatl) && _unur_isfinite(xAhatr) && _unur_isfinite(xAsqueeze)) || _unur_FP_equal(iv->Ahat,iv->Asqueeze) ) continue; /* try next rule */ /* compute expected value */ xsp = (xAhatl+xAhatr-xAsqueeze) / (iv->Ahat - iv->Asqueeze); break; case 2: /* rule 2: arcmean */ xsp = _unur_arcmean(x0,x1); break; case 3: /* rule 3: mean */ if (_unur_FP_is_minus_infinity(x0) || _unur_FP_is_infinity(x1)) /* no arithmetic mean for unbounded intervals */ continue; /* try next rule */ xsp = 0.5 * (x0 + x1); break; default: /* this should not happen */ continue; } /* value of PDF at splitting point */ fxsp = PDF(xsp); /* now split interval at given point */ splitted = _unur_tdr_gw_interval_split(gen, iv, xsp, fxsp); if (splitted==UNUR_SUCCESS || splitted==UNUR_ERR_INF) { /* splitting successful */ if (splitted==UNUR_SUCCESS) ++n_splitted; /* otherwise the area below the hat was not bounded */ /* now depending on the location of xps in the interval iv, iv points to the left of the two new intervals, or to the right of the two new intervals. For the first case we have to move the pointer to the new right interval. Then iv will be moved to the next old interval in the list by the for loop. We can distinguish between these two cases by looking at the iv->next pointer and compare it the pointer in the old unsplitted interval. */ if (iv->next != iv_next) iv = iv->next; /* no more splitting points in this interval */ break; } else if (splitted!=UNUR_ERR_SILENT) { /* some serious error occurred */ /* condition for PDF is violated! */ _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,""); return UNUR_ERR_GEN_CONDITION; } /* else: could not split construction points */ } } if (n_splitted == 0) { /* we are not successful in splitting any inteval. abort to avoid endless loop */ _unur_warning(gen->genid,UNUR_ERR_GENERIC,"DARS aborted: no intervals could be splitted."); break; } } /* ratio between squeeze and hat o.k. ? */ if ( GEN->max_ratio * GEN->Atotal > GEN->Asqueeze ) { if ( GEN->n_ivs >= GEN->max_ivs ) _unur_warning(gen->genid,UNUR_ERR_GENERIC,"DARS aborted: maximum number of intervals exceeded."); _unur_warning(gen->genid,UNUR_ERR_GENERIC,"hat/squeeze ratio too small."); } else { /* no more construction points */ GEN->max_ivs = GEN->n_ivs; } /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_tdr_gw_dars() */ /*---------------------------------------------------------------------------*/ int _unur_tdr_gw_interval_parameter( struct unur_gen *gen, struct unur_tdr_interval *iv ) /*----------------------------------------------------------------------*/ /* compute intersection point of tangents and */ /* the area below the hat (Gilks & Wild variant) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* iv ... pointer to interval */ /* */ /* return: */ /* UNUR_SUCCESS ... if successful */ /* UNUR_ERR_SILENT ... do not add this construction point */ /* UNUR_ERR_INF ... area = UNUR_INFINITY */ /* others ... error (PDF not T-concave) */ /*----------------------------------------------------------------------*/ { double Ahatl; /* area below hat at left side of intersection point */ /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_ERR_COOKIE); CHECK_NULL(iv,UNUR_ERR_NULL); COOKIE_CHECK(iv,CK_TDR_IV,UNUR_ERR_COOKIE); /* check interval on the right side of iv */ CHECK_NULL(iv->next,UNUR_ERR_NULL); COOKIE_CHECK(iv->next,CK_TDR_IV,UNUR_ERR_COOKIE); /* get intersection point of tangents. used to partition interval into left hand part (construction point of tangent on the left hand boundary) and right hand part (construction point of tangent on the left hand boundary). */ if ( _unur_tdr_tangent_intersection_point(gen,iv,&(iv->ip))!=UNUR_SUCCESS ) return UNUR_ERR_GEN_CONDITION; /* squeeze and area below squeeze */ if (iv->Tfx > -UNUR_INFINITY && iv->next->Tfx > -UNUR_INFINITY) { /* we do not compute the slope when the construction points are too close. at least 8 significant digits should remain. */ if (_unur_FP_approx(iv->x, iv->next->x) ) return UNUR_ERR_SILENT; /* construction points too close */ /* slope of transformed squeeze */ iv->sq = (iv->next->Tfx - iv->Tfx) / (iv->next->x - iv->x); /* check squeeze */ /* we have to take care about round off error. the following accepts PDFs with might be a little bit not T_concave */ if ( ( (iv->sq > iv->dTfx && (!_unur_FP_approx(iv->sq,iv->dTfx)) ) || (iv->sq < iv->next->dTfx && (!_unur_FP_approx(iv->sq,iv->next->dTfx)) ) ) && iv->next->dTfx < UNUR_INFINITY ) { /* There are big troubles when the density is extremely small. Then round-off errors may cancel out all significant figures and 0 remains. Thus we simply ignore all violations when the slope of the squeeze or tangent is 0. */ if ( !_unur_iszero(iv->sq) && !_unur_iszero(iv->dTfx) && !_unur_iszero(iv->next->dTfx) ) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"Squeeze too steep/flat. PDF not T-concave!"); return UNUR_ERR_GEN_CONDITION; } } /* volume below squeeze */ /* always integrate from point with greater value of transformed density to the other point */ iv->Asqueeze = (iv->Tfx > iv->next->Tfx) ? _unur_tdr_interval_area( gen, iv, iv->sq, iv->next->x) : _unur_tdr_interval_area( gen, iv->next, iv->sq, iv->x); /* check for fatal numerical errors */ if (!_unur_isfinite(iv->Asqueeze)) iv->Asqueeze = 0.; } else { /* no squeeze */ iv->sq = 0.; iv->Asqueeze = 0.; } /* volume below hat */ Ahatl = _unur_tdr_interval_area( gen, iv, iv->dTfx, iv->ip); iv->Ahatr = _unur_tdr_interval_area( gen, iv->next, iv->next->dTfx, iv->ip); /* areas below head unbounded ? */ if (! (_unur_isfinite(Ahatl) && _unur_isfinite(iv->Ahatr)) ) return UNUR_ERR_INF; /* total area */ iv->Ahat = iv->Ahatr + Ahatl; /* check area */ /* we cannot be more accurate than in the `check squeeze' section */ if ( iv->Asqueeze > iv->Ahat && !(_unur_FP_approx(iv->Asqueeze, iv->Ahat)) ) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"A(squeeze) > A(hat). PDF not T-concave!"); return UNUR_ERR_GEN_CONDITION; } /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_tdr_gw_interval_parameter() */ /*---------------------------------------------------------------------------*/ int _unur_tdr_gw_interval_split( struct unur_gen *gen, struct unur_tdr_interval *iv_oldl, double x, double fx ) /*----------------------------------------------------------------------*/ /* split interval iv_oldl into two intervals at point x */ /* old interval -> left hand side */ /* new interval -> right hand side */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* iv_oldl ... pointer to interval */ /* x ... left point of new segment */ /* fx ... value of PDF at x */ /* */ /* return: */ /* UNUR_SUCCESS ... if successful */ /* UNUR_ERR_SILENT ... if no intervals are splitted */ /* others ... error */ /*----------------------------------------------------------------------*/ { struct unur_tdr_interval *iv_newr; /* pointer to new interval */ struct unur_tdr_interval iv_bak; /* space for backing up data of interval */ int success, success_r; /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_ERR_COOKIE); CHECK_NULL(iv_oldl,UNUR_ERR_NULL); COOKIE_CHECK(iv_oldl,CK_TDR_IV,UNUR_ERR_COOKIE); /* we cannot split point when x is not finite (NaN or Infinity) */ if (!_unur_isfinite(x)) { _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"splitting point not finite (skipped)"); return UNUR_ERR_SILENT; } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug & TDR_DEBUG_SPLIT) _unur_tdr_gw_debug_split_start( gen,iv_oldl,x,fx ); #endif /* the splitting point must be inside the interval */ if (x < iv_oldl->x || x > iv_oldl->next->x) { _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"splitting point not in interval!"); return UNUR_ERR_SILENT; } /* we only add a new construction point, if the relative area is large enough */ if ( (GEN->n_ivs * (iv_oldl->Ahat - iv_oldl->Asqueeze) / (GEN->Atotal - GEN->Asqueeze)) < GEN->bound_for_adding) return UNUR_ERR_SILENT; /* check for data error */ if (fx < 0.) { _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"PDF(x) < 0.!"); return UNUR_ERR_GEN_DATA; } /* back up data */ memcpy(&iv_bak, iv_oldl, sizeof(struct unur_tdr_interval)); /* check if the new interval is completely outside the support of PDF */ if (fx <= 0.) { /* one of the two boundary points must be 0, too! */ if (iv_oldl->fx <= 0.) { /* chop off left part (it's out of support) */ iv_oldl->x = x; } else if (iv_oldl->next->fx <= 0.) { /* chop off right part (it's out of support) */ iv_oldl->next->x = x; } else { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF not T-concave"); return UNUR_ERR_GEN_CONDITION; } /* compute parameters for chopped interval */ success = _unur_tdr_gw_interval_parameter(gen, iv_oldl); /* we did not add a new interval */ iv_newr = NULL; } else { /* we need a new interval */ iv_newr = _unur_tdr_interval_new( gen, x, fx, FALSE ); if (iv_newr == NULL) { /* PDF(x) < 0 or overflow !! */ _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); return UNUR_ERR_SHOULD_NOT_HAPPEN; } /* insert into linked list */ iv_newr->prev = iv_oldl; iv_newr->next = iv_oldl->next; iv_oldl->next->prev = iv_newr; iv_oldl->next = iv_newr; /* compute parameters for interval */ success = _unur_tdr_gw_interval_parameter(gen, iv_oldl); success_r = _unur_tdr_gw_interval_parameter(gen, iv_newr); /* worst of success and success_r */ if (success_r!=UNUR_SUCCESS) if ((success_r!=UNUR_ERR_SILENT&&success_r!=UNUR_ERR_INF) || (success==UNUR_SUCCESS||success==UNUR_ERR_SILENT||success==UNUR_ERR_INF)) success = success_r; } /* successfull ? */ if (success!=UNUR_SUCCESS) { /* cannot split interval at given point */ _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"Cannot split interval at given point."); if (success!=UNUR_ERR_SILENT && success!=UNUR_ERR_INF) _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF not T-concave"); /* the case of unbounded hat is treated as round-off error for very steep tangents. so we simply do not add this construction point. */ /* restore old interval */ memcpy(iv_oldl, &iv_bak, sizeof(struct unur_tdr_interval)); /* remove from linked list; remaines to restore prev pointer in next interval */ if (iv_oldl->next) iv_oldl->next->prev = iv_oldl; /* decrement counter for intervals and free unused interval */ if (iv_newr) { --(GEN->n_ivs); free( iv_newr ); } return success; } /* successful */ /* update total area below hat and squeeze */ GEN->Atotal = ( GEN->Atotal - iv_bak.Ahat + iv_oldl->Ahat + ((iv_newr) ? iv_newr->Ahat : 0.) ); GEN->Asqueeze = ( GEN->Asqueeze - iv_bak.Asqueeze + iv_oldl->Asqueeze + ((iv_newr) ? iv_newr->Asqueeze : 0. ) ); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug & TDR_DEBUG_SPLIT) _unur_tdr_gw_debug_split_stop( gen,iv_oldl,iv_newr ); #endif /* when using inside Gibbs sampler Atotal might be 0 */ if (GEN->Atotal <= 1.e10 * DBL_MIN) { _unur_error(gen->genid,UNUR_ERR_ROUNDOFF,"error below hat (almost) 0"); return UNUR_ERR_ROUNDOFF; } /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_tdr_gw_interval_split() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/tabl_struct.h0000644001357500135600000001404714420445767015011 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: tabl_struct.h * * * * PURPOSE: * * declares structures for method TABL * * (Ahren's TABLe method: piecewise constant hat) * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Information for constructing the generator */ struct unur_tabl_par { const double *slopes; /* slopes , i.e.\ f(a_i) >= f(b_i) */ int n_slopes; /* number of slopes */ double bleft; /* left border of the domain */ double bright; /* right border of the domain */ int max_ivs; /* maximum number of intervals */ double max_ratio; /* limit for ratio r_n = A(squeeze) / A(hat) */ const double *cpoints; /* pointer to array of points for constr. slopes */ int n_cpoints; /* number of points for constructing slopes */ int n_stp; /* number of points for hat for start */ double area_fract; /* parameter for equal area rule */ double darsfactor; /* factor for (derandomized) ARS */ double guide_factor; /* relative size of guide table */ }; /*---------------------------------------------------------------------------*/ /* storing information about generator */ struct unur_tabl_interval { double xmax; /* maximum of pdf in interval */ double fmax; /* maximal value of pdf in interval */ double xmin; /* minimum of pdf in interval */ double fmin; /* minimal value of pdf in interval */ double Ahat; /* area of total bar (below hat) */ double Asqueeze; /* area of bar below squeeze */ double Acum; /* cumulated area of bars */ struct unur_tabl_interval *next; /* pointer to next element in list */ #ifdef UNUR_COOKIES unsigned cookie; /* magic cookie */ #endif }; /*---------------------------------------------------------------------------*/ /* The generator object */ struct unur_tabl_gen { double Atotal; /* total area below hat */ double Asqueeze; /* area of squeeze polygon */ double bleft; /* left boundary of domain */ double bright; /* right boundary of domain */ struct unur_tabl_interval **guide; /* pointer to guide table */ int guide_size; /* size of guide table */ double guide_factor; /* relative size of guide table */ double Umin, Umax; /* bounds for iid random variable in respect to the given (truncated) domain of the distr.*/ struct unur_tabl_interval *iv; /* pointer to linked list of intervals */ int n_ivs; /* number of intervals */ int max_ivs; /* maximum number of intervals */ double max_ratio; /* limit for ratio r_n = A(squeeze) / A(hat) */ double darsfactor; /* factor for (derandomized) ARS */ #ifdef UNUR_ENABLE_INFO int max_ivs_info; /* maximum number of intervals (as given) */ #endif }; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/cstd_struct.h0000644001357500135600000000732214420445767015022 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: cstd_struct.h * * * * PURPOSE: * * declares structures for method CSTD * * (wrapper for special generators for * * Continuous STanDard distributions) * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Information for constructing the generator */ struct unur_cstd_par { int dummy; /* no special parameters */ }; /*---------------------------------------------------------------------------*/ /* The generator object */ struct unur_cstd_gen { double *gen_param; /* parameters for the generator */ int n_gen_param; /* number of parameters for the generator */ int flag; /* sometimes it is convenient to have a flag */ double Umin; /* cdf at left boundary of domain */ double Umax; /* cdf at right boundary of domain */ int is_inversion; /* indicate whether method is inversion method */ const char *sample_routine_name; /* name of sampling routine */ }; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/x_gen.c0000644001357500135600000010561114420445767013554 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: x_gen.c * * * * miscelleanous routines for manipulation generator objects * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include #include #include #include #include #include #include #include #include "unur_methods_source.h" #include "x_gen.h" #include "x_gen_source.h" /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Call Init, Sampling, and Free functions **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ struct unur_gen *unur_init( struct unur_par *par ) { _unur_check_NULL(NULL,par,NULL); return (par->init(par)); } /* end of unur_init() */ /*---------------------------------------------------------------------------*/ int unur_reinit( struct unur_gen *gen ) { int status = UNUR_SUCCESS; _unur_check_NULL(NULL,gen,UNUR_ERR_NULL); if (gen->reinit) { status = gen->reinit(gen); if (status == UNUR_SUCCESS) return status; } else { _unur_error(gen->genid,UNUR_ERR_NO_REINIT,""); status = UNUR_ERR_NO_REINIT; } /* error: change sampling routine */ switch (gen->method & UNUR_MASK_TYPE) { case UNUR_METH_DISCR: gen->sample.discr = _unur_sample_discr_error; break; case UNUR_METH_CONT: case UNUR_METH_CEMP: gen->sample.cont = _unur_sample_cont_error; break; case UNUR_METH_VEC: case UNUR_METH_CVEMP: gen->sample.cvec = _unur_sample_cvec_error; break; case UNUR_METH_MAT: gen->sample.matr = _unur_sample_matr_error; break; default: _unur_error("reinit",UNUR_ERR_SHOULD_NOT_HAPPEN,""); } return status; } /* end of unur_reinit() */ /*---------------------------------------------------------------------------*/ int unur_sample_discr( struct unur_gen *gen ) { CHECK_NULL(gen,0); return (gen->sample.discr(gen)); } /* end of unur_sample_discr() */ double unur_sample_cont( struct unur_gen *gen ) { CHECK_NULL(gen,UNUR_INFINITY); return (gen->sample.cont(gen)); } /* end of unur_sample_cont() */ int unur_sample_vec( struct unur_gen *gen, double *vector ) { CHECK_NULL(gen,UNUR_ERR_NULL); return (gen->sample.cvec(gen,vector)); } /* end of unur_sample_vec() */ int unur_sample_matr( struct unur_gen *gen, double *matrix ) { CHECK_NULL(gen,UNUR_ERR_NULL); return (gen->sample.matr(gen,matrix)); } /* end of unur_sample_matr() */ /*---------------------------------------------------------------------------*/ /* Estimate quantiles */ double unur_quantile ( struct unur_gen *gen, double U ) { /* check arguments */ CHECK_NULL(gen,FALSE); /* Remark: * We DO NOT check the argument U here * (i.e. whether 0<=U<=1 holds) */ switch (gen->method) { case UNUR_METH_HINV: return unur_hinv_eval_approxinvcdf(gen,U); case UNUR_METH_NINV: return unur_ninv_eval_approxinvcdf(gen,U); case UNUR_METH_PINV: return unur_pinv_eval_approxinvcdf(gen,U); case UNUR_METH_CSTD: if (((struct unur_cstd_gen*)gen->datap)->is_inversion) return unur_cstd_eval_invcdf(gen,U); break; case UNUR_METH_MIXT: if (((struct unur_mixt_gen*)gen->datap)->is_inversion) return unur_mixt_eval_invcdf(gen,U); break; case UNUR_METH_DGT: return ((double) unur_dgt_eval_invcdf(gen,U)); case UNUR_METH_DSTD: if (((struct unur_dstd_gen*)gen->datap)->is_inversion) return unur_dstd_eval_invcdf(gen,U); break; } /* default: */ _unur_error(gen->genid,UNUR_ERR_NO_QUANTILE,""); return UNUR_INFINITY; } /* end of unur_quantile() */ /*---------------------------------------------------------------------------*/ int unur_gen_is_inversion ( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* check for type of generator object */ /*----------------------------------------------------------------------*/ { /* check arguments */ if (gen==NULL) return FALSE; switch (gen->method) { case UNUR_METH_HINV: case UNUR_METH_NINV: case UNUR_METH_PINV: case UNUR_METH_DGT: return TRUE; case UNUR_METH_CSTD: return (((struct unur_cstd_gen*)gen->datap)->is_inversion); case UNUR_METH_MIXT: return (((struct unur_mixt_gen*)gen->datap)->is_inversion); default: return FALSE; } } /* end of unur_gen_is_inversion() */ /*---------------------------------------------------------------------------*/ /* aux routines when no sampling routine is available */ int _unur_sample_discr_error( struct unur_gen *gen ATTRIBUTE__UNUSED ) { unur_errno = UNUR_ERR_GEN_CONDITION; return 0; } /* end of _unur_sample_discr_error() */ double _unur_sample_cont_error( struct unur_gen *gen ATTRIBUTE__UNUSED ) { unur_errno = UNUR_ERR_GEN_CONDITION; return UNUR_INFINITY; } /* end of _unur_sample_cont_error() */ int _unur_sample_cvec_error( struct unur_gen *gen, double *vec ) { int d; unur_errno = UNUR_ERR_GEN_CONDITION; for (d=0; d<(gen->distr->dim); d++) vec[d] = UNUR_INFINITY; return UNUR_FAILURE; } /* end of _unur_sample_cvec_error() */ int _unur_sample_matr_error( struct unur_gen *gen, double *mat ) { int n_rows, n_cols, dim, j; unur_errno = UNUR_ERR_GEN_CONDITION; unur_distr_matr_get_dim(gen->distr, &n_rows, &n_cols ); dim = n_rows * n_cols; for (j=0; jdestroy(gen); } /* end of unur_free() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Get data about generator object **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ const char * unur_gen_info( struct unur_gen *gen, int help ) /*----------------------------------------------------------------------*/ /* return pointer to character string that contains information about */ /* the given generator object. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* help ... whether to print additional comments */ /* */ /* return: */ /* pointer to character string */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { #ifdef UNUR_ENABLE_INFO /* check arguments */ _unur_check_NULL("",gen,NULL); if (gen->info) { /* prepare generator object for creating info string */ if (gen->infostr == NULL) /* either allocate memory block */ gen->infostr = _unur_string_new(); else /* or clear string object (i.e. reset pointer) */ _unur_string_clear(gen->infostr); /* create info string */ gen->info((struct unur_gen*) gen, help); /* return info string */ return gen->infostr->text; } else { return NULL; } #else return "INFO string not enable"; #endif } /* end of unur_gen_info() */ /*---------------------------------------------------------------------------*/ int unur_get_dimension( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* get dimension of generator for multivariate distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* dimension of distribution */ /* */ /* error: */ /* return 0 */ /*----------------------------------------------------------------------*/ { return ((gen) ? gen->distr->dim : 0); } /* end of unur_get_dimension() */ /*---------------------------------------------------------------------------*/ const char * unur_get_genid( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* get generator id */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to generator id */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { return ((gen) ? gen->genid : NULL); } /* end of unur_get_genid() */ /*---------------------------------------------------------------------------*/ unsigned int unur_get_method( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* get identifier for generating method. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* ID for method (see unur_method.h) */ /* */ /* error: */ /* return 0U */ /*----------------------------------------------------------------------*/ { return ((gen) ? gen->method : 0U); } /* end of unur_get_method() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_get_distr( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* get pointer to distribution object from generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to distribution object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { return ((gen) ? gen->distr : NULL); } /* end of unur_get_distr() */ /*---------------------------------------------------------------------------*/ int unur_set_use_distr_privatecopy( struct unur_par *par, int use_privatecopy ) /*----------------------------------------------------------------------*/ /* Set flag whether the generator object should make a private copy or */ /* just stores the pointer to the distribution object */ /* */ /* parameters: */ /* par ... pointer to parameter object */ /* use_privatecopy ... TRUE = use private copy */ /* FALSE = store pointer to given distr. object */ /* */ /* return: */ /* pointer to distribution object */ /* */ /* error: */ /* return NULL */ /* */ /* WARNING! */ /* Using a pointer to the external distribution object instead of a */ /* private copy must be applied with EXTREME CARE! */ /* When the distrubtion object is changed or freed then the generator */ /* object does not work any more, might case a segmentation fault, or */ /* (even worse) produces garbage. */ /* On the other hand, when the generator object is initialized or used */ /* to draw a random sampling the distribution object may be changed. */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL("",par,UNUR_ERR_NULL); par->distr_is_privatecopy = use_privatecopy; return UNUR_SUCCESS; } /* end of unur_set_use_distr_privatecopy() */ /*****************************************************************************/ /** **/ /** Copy (clone) generator object **/ /** **/ /*****************************************************************************/ struct unur_gen * unur_gen_clone( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* copy (clone) generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to clone of generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( "Clone", gen, NULL ); _unur_check_NULL( "Clone", gen->clone, NULL ); return (gen->clone(gen)); } /* end of unur_gen_clone() */ /*****************************************************************************/ /** **/ /** Create and free parameter objects **/ /** **/ /*****************************************************************************/ struct unur_par * _unur_par_new( size_t s) /*----------------------------------------------------------------------*/ /* create new parameter object */ /* */ /* parameters: */ /* s ... size of data structure */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_par *par = _unur_xmalloc( sizeof(struct unur_par) ); par->datap = _unur_xmalloc(s); par->s_datap = s; /* set defaults for distribution object */ par->distr_is_privatecopy = TRUE; /* use private copy of distribution object */ return par; } /* end of _unur_par_new() */ /*---------------------------------------------------------------------------*/ struct unur_par * _unur_par_clone( const struct unur_par *par ) /*----------------------------------------------------------------------*/ /* copy parameter object */ /* */ /* parameters: */ /* par ... pointer to parameter object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_par *clone; _unur_check_NULL("clone", par, NULL); clone = _unur_xmalloc( sizeof(struct unur_par) ); memcpy (clone, par, sizeof(struct unur_par)); clone->datap = _unur_xmalloc(par->s_datap); memcpy (clone->datap, par->datap, par->s_datap); return clone; } /* end of unur_par_free() */ /*---------------------------------------------------------------------------*/ void unur_par_free( struct unur_par *par) /*----------------------------------------------------------------------*/ /* free parameter object */ /* */ /* parameters: */ /* par ... pointer to parameter object */ /*----------------------------------------------------------------------*/ { _unur_check_NULL("free", par, RETURN_VOID ); _unur_par_free(par); } /* end of unur_par_free() */ /*****************************************************************************/ /** **/ /** Create, copy (clone) and free generator objects **/ /** **/ /*****************************************************************************/ struct unur_gen * _unur_generic_create( struct unur_par *par, size_t s ) /*----------------------------------------------------------------------*/ /* create new generic generator object */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* s ... size of data structure */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* allocate memory for generator object */ gen = _unur_xmalloc( sizeof(struct unur_gen) ); gen->datap = _unur_xmalloc(s); gen->s_datap = s; /* copy distribution object into generator object */ gen->distr_is_privatecopy = par->distr_is_privatecopy; if (gen->distr_is_privatecopy) gen->distr = (par->distr) ? _unur_distr_clone(par->distr) : NULL; else gen->distr = (struct unur_distr *) par->distr; /* initialize function pointers */ gen->destroy = NULL; /* destructor */ gen->clone = NULL; /* clone generator */ gen->reinit = NULL; /* reinit routine */ /* copy some parameters into generator object */ gen->method = par->method; /* indicates method and variant */ gen->variant = par->variant; /* indicates variant */ gen->set = par->set; /* indicates parameter settings */ gen->debug = par->debug; /* debuging flags */ gen->urng = par->urng; /* pointer to urng */ gen->urng_aux = par->urng_aux; /* pointer to auxilliary URNG */ gen->gen_aux = NULL; /* no auxilliary generator objects */ gen->gen_aux_list = NULL; /* no auxilliary generator objects */ gen->n_gen_aux_list = 0; /* status of generator object */ gen->status = UNUR_FAILURE; /* not successfully created yet */ #ifdef UNUR_ENABLE_INFO gen->infostr = NULL; /* pointer to info string */ gen->info = NULL; /* routine that return info string */ #endif /* return pointer to (almost empty) generator object */ return gen; } /* end of _unur_generic_create() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_generic_clone( const struct unur_gen *gen, const char *type ) /*----------------------------------------------------------------------*/ /* copy (clone) generic generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* type ... type of generator (string) */ /* */ /* return: */ /* pointer to clone of generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *clone; /* allocate memory for generator object and copy main part */ clone = _unur_xmalloc( sizeof(struct unur_gen) ); memcpy( clone, gen, sizeof(struct unur_gen) ); clone->datap = _unur_xmalloc(gen->s_datap); memcpy (clone->datap, gen->datap, gen->s_datap); /* set generator identifier */ clone->genid = _unur_set_genid(type); #ifdef UNUR_ENABLE_INFO /* do not copy pointer to info string */ clone->infostr = NULL; #endif /* copy distribution object into generator object */ clone->distr_is_privatecopy = gen->distr_is_privatecopy; if (clone->distr_is_privatecopy) clone->distr = (gen->distr) ? _unur_distr_clone(gen->distr) : NULL; else clone->distr = gen->distr; /* auxiliary generators */ if (gen->gen_aux) clone->gen_aux = _unur_gen_clone( gen->gen_aux ); if (gen->gen_aux_list && gen->n_gen_aux_list) { clone->gen_aux_list = _unur_gen_list_clone( gen->gen_aux_list, gen->n_gen_aux_list ); clone->n_gen_aux_list = gen->n_gen_aux_list; } /* finished clone */ return clone; } /* _unur_generic_clone() */ /*---------------------------------------------------------------------------*/ void _unur_generic_free( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* deallocate generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { if (gen->gen_aux) _unur_free(gen->gen_aux); if (gen->gen_aux_list && gen->n_gen_aux_list) _unur_gen_list_free( gen->gen_aux_list, gen->n_gen_aux_list ); if (gen->distr_is_privatecopy && gen->distr) _unur_distr_free( gen->distr ); _unur_free_genid(gen); COOKIE_CLEAR(gen); free(gen->datap); #ifdef UNUR_ENABLE_INFO /* free pointer to info string */ if (gen->infostr) _unur_string_free(gen->infostr); #endif free(gen); } /* end of _unur_generic_free() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Set and copy (clone) arrays of auxiliary generators **/ /** **/ /*****************************************************************************/ struct unur_gen ** _unur_gen_list_set( struct unur_gen *gen, int n_gen_list ) /*----------------------------------------------------------------------*/ /* set all entries in list to same generator object 'gen' */ /* */ /* IMPORTANT: Be careful when using this call. When the resulting array */ /* is stored in some multivariate generator object then 'gen' */ /* _must not_ be used any more after this call! */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* n_gen_list ... length of array of generator objects */ /* */ /* return: */ /* pointer to list of generator objects */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen **gen_list; int i; /* check arguments */ _unur_check_NULL( "gen_list_set", gen, NULL ); if (n_gen_list < 1) { _unur_error("gen_list_set",UNUR_ERR_PAR_SET,"dimension < 1"); return NULL; } /* allocate memory for array */ gen_list = _unur_xmalloc (n_gen_list * sizeof(struct unur_gen *)); /* copy pointer */ for (i=0; i 1 && gen_list[0] == gen_list[1]) { clone_list[0] = _unur_gen_clone( gen_list[0] ); for (i=0; i1) ? 1 : 0; imax = (gen_list[0] == gen_list[i2]) ? 1 : n_gen_list; for (i=0; iUmin + (_unur_call_urng(gen->urng)) * (GEN->Umax - GEN->Umin) ); } /*---------------------------------------------------------------------------*/ double _unur_ninv_sample_regula( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator (use regula falsi) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /*----------------------------------------------------------------------*/ { return _unur_ninv_regula( gen, GEN->Umin + (_unur_call_urng(gen->urng)) * (GEN->Umax - GEN->Umin) ); } /* end of _unur_ninv_sample_regula() */ /*---------------------------------------------------------------------------*/ double _unur_ninv_sample_bisect( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator (use bisection method) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /*----------------------------------------------------------------------*/ { return _unur_ninv_bisect( gen, GEN->Umin + (_unur_call_urng(gen->urng)) * (GEN->Umax - GEN->Umin) ); } /* end of _unur_ninv_sample_bisect() */ /*---------------------------------------------------------------------------*/ double unur_ninv_eval_approxinvcdf( const struct unur_gen *gen, double u ) /*----------------------------------------------------------------------*/ /* get approximate value of inverse CDF at u approximately */ /* (user call) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* u ... argument for inverse CDF (0<=u<=1) */ /* */ /* return: */ /* double (approximate inverse CDF) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { double x; /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); if ( gen->method != UNUR_METH_NINV ) { _unur_error(gen->genid,UNUR_ERR_GEN_INVALID,""); return UNUR_INFINITY; } COOKIE_CHECK(gen,CK_NINV_GEN,UNUR_INFINITY); if ( ! (u>0. && u<1.)) { if ( ! (u>=0. && u<=1.)) { _unur_warning(gen->genid,UNUR_ERR_DOMAIN,"U not in [0,1]"); } if (u<=0.) return DISTR.domain[0]; if (u>=1.) return DISTR.domain[1]; return u; /* = NaN */ } /* compute inverse CDF */ switch (gen->variant) { case NINV_VARFLAG_NEWTON: x = _unur_ninv_newton(gen,u); break; case NINV_VARFLAG_BISECT: x = _unur_ninv_bisect(gen,u); break; case NINV_VARFLAG_REGULA: default: x = _unur_ninv_regula(gen,u); break; } /* validate range */ if (xDISTR.domain[1]) x = DISTR.domain[1]; return x; } /* end of unur_hinv_eval_approxinvcdf() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/hrd.h0000644001357500135600000001212214420304141013204 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: hrd.h * * * * PURPOSE: * * function prototypes for method HRD * * (Hazard Rate Decreasing) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /* =METHOD HRD Hazard Rate Decreasing =UP Methods_for_CONT =REQUIRED decreasing (non-increasing) hazard rate =SPEED Set-up: fast, Sampling: slow =REF [HLD04: Sect.9.1.5, Alg.9.5] =REINIT supported =DESCRIPTION Generates random variate with given non-increasing hazard rate. It is necessary that the distribution object contains this hazard rate. Decreasing hazard rate implies that the corresponding PDF of the distribution has heavier tails than the exponential distribution (which has constant hazard rate). =HOWTOUSE HRD requires a hazard function for a continuous distribution with non-increasing hazard rate. There are no parameters for this method. It is important to note that the domain of the distribution can be set via a unur_distr_cont_set_domain() call. However, only the left hand boundary is used. For computational reasons the right hand boundary is always reset to @code{UNUR_INFINITY}. If no domain is given by the user then the left hand boundary is set to @code{0}. For distributions which do not have decreasing hazard rates but are bounded from above use method HRB (@pxref{HRB,,Hazard Rate Bounded}). For distributions with increasing hazard rate method HRI (@pxref{HRI,,Hazard Rate Increasing}) is required. It is possible to change the parameters and the domain of the chosen distribution and run unur_reinit() to reinitialize the generator object. =END */ /*---------------------------------------------------------------------------*/ /* Routines for user interface */ /* =ROUTINES */ UNUR_PAR *unur_hrd_new( const UNUR_DISTR *distribution ); /* Get default parameters for generator. */ /*...........................................................................*/ int unur_hrd_set_verify( UNUR_PAR *parameters, int verify ); /* */ int unur_hrd_chg_verify( UNUR_GEN *generator, int verify ); /* Turn verifying of algorithm while sampling on/off. If the hazard rate is not bounded by the given bound, then @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. Default is FALSE. */ /* =END */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/tdr_ia_sample.ch0000644001357500135600000003635214420445767015434 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: tdr_ia_sample.c * * * * TYPE: continuous univariate random variate * * METHOD: transformed density rejection * * * * DESCRIPTION: * * Sampling routines for variant with proportional squeezes and * * immediate acceptance. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*****************************************************************************/ /** Sampling routines **/ /*****************************************************************************/ double _unur_tdr_ia_sample( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator (immediate acceptance) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return UNUR_INFINITY */ /* */ /*======================================================================*/ /* comment: */ /* x ... random point */ /* x0 ... left construction point in interval */ /* x1 ... right construction point in interval */ /* f ... PDF */ /* Tf ... transformed PDF */ /* dTf ... derivative of transformed PDF */ /* sq ... slope of squeeze in interval */ /* */ /*----------------------------------------------------------------------*/ /* if (Tf)'(x0) == 0: */ /* X = x0 + U / f(x0) */ /* U ~ U(0,area below hat) */ /* */ /*----------------------------------------------------------------------*/ /* log(x): */ /* */ /* hat(x) = f(x0) * exp( (Tf)'(x0) * (x-x0) ) */ /* generation: */ /* X = x0 + 1/(Tf)'(x0) * \log( (Tf)'(x0)/f(x0) * U + 1 ) */ /* U ~ U(-area below left hat, area below left hat) */ /* */ /*----------------------------------------------------------------------*/ /* T(x) = -1/sqrt(x): */ /* */ /* hat(x) = 1 / (Tf(x0) + (Tf)'(x0) * (x-x0))^2 */ /* generation: */ /* X = x0 + (Tf(x0)^2 * U) / (1 - Tf(x0) * (Tf)'(x0) * U) */ /* U ~ U(-area below left hat, area below left hat) */ /*----------------------------------------------------------------------*/ { UNUR_URNG *urng; /* pointer to uniform random number generator */ struct unur_tdr_interval *iv; int use_ia; double U, V, X; double fx, hx, Thx; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_INFINITY); if (GEN->iv == NULL) { _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"empty generator object"); return UNUR_INFINITY; } /* main URNG */ urng = gen->urng; while (1) { /* sample from U(0,1) */ U = _unur_call_urng(urng); /* look up in guide table and search for segment */ iv = GEN->guide[(int) (U * GEN->guide_size)]; U *= GEN->Atotal; while (iv->Acum < U) { iv = iv->next; } /* reuse of uniform random number */ U -= iv->Acum; /* result: U in (-A_hat,0) */ /* check for region of immediate acceptance */ if (U >= - iv->sq * iv->Ahat) { /* region of immediate acceptance */ U /= iv->sq; use_ia = 1; } else { /* rejection from region between hat and squeeze */ U = (U + iv->sq * iv->Ahat) / (1. - iv->sq); use_ia = 0; } /* result: U in (-A_hat,0) */ /* U in (-A_hatl, A_hatr) */ U += iv->Ahatr; /* generate from hat distribution */ switch (gen->variant & TDR_VARMASK_T) { case TDR_VAR_T_LOG: if (_unur_iszero(iv->dTfx)) X = iv->x + U / iv->fx; else { double t = iv->dTfx * U / iv->fx; if (fabs(t) > 1.e-6) /* x = iv->x + log(t + 1.) / iv->dTfx; is cheaper but numerical unstable */ X = iv->x + log(t + 1.) * U / (iv->fx * t); else if (fabs(t) > 1.e-8) /* use Taylor series */ X = iv->x + U / iv->fx * (1 - t/2. + t*t/3.); else X = iv->x + U / iv->fx * (1 - t/2.); } break; case TDR_VAR_T_SQRT: if (_unur_iszero(iv->dTfx)) X = iv->x + U /iv->fx; else { U *= iv->Tfx; /* avoid one multiplication */ X = iv->x + (iv->Tfx * U) / (1. - iv->dTfx * U); /* It cannot happen, that the denominator becomes 0 ! */ } break; case TDR_VAR_T_POW: /** TODO **/ return 1.; break; default: _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); return 1.; } /* end switch */ /* immedate acceptance */ if (use_ia) return X; /* evaluate hat at X */ switch (gen->variant & TDR_VARMASK_T) { case TDR_VAR_T_LOG: hx = iv->fx * exp(iv->dTfx*(X - iv->x)); break; case TDR_VAR_T_SQRT: Thx = iv->Tfx + iv->dTfx * (X - iv->x); /* transformed hat at X */ hx = 1./(Thx*Thx); break; case TDR_VAR_T_POW: default: /** TODO **/ return 1.; } /* end switch */ /* from now on we use the auxilliary generator (it can be the same as the main generator) */ urng = gen->urng_aux; /* rejection from region between hat and (proportional) squeeze */ V = _unur_call_urng(urng); /* get uniform random number between squeeze(X) and hat(X) */ V = (iv->sq + (1 - iv->sq) * V) * hx; /* evaluate PDF at X */ fx = PDF(X); /* main rejection */ if (V <= fx) return X; /* being above squeeze is bad. improve the situation! */ if (GEN->n_ivs < GEN->max_ivs) { if ( (_unur_tdr_ps_improve_hat( gen, iv, X, fx) != UNUR_SUCCESS) && (gen->variant & TDR_VARFLAG_PEDANTIC) ) return UNUR_INFINITY; } /* else reject and try again */ } } /* end of _unur_tdr_ia_sample() */ /*---------------------------------------------------------------------------*/ double _unur_tdr_ia_sample_check( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator and verify results (immediate acceptance) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return UNUR_INFINITY */ /* */ /*----------------------------------------------------------------------*/ { UNUR_URNG *urng; /* pointer to uniform random number generator */ struct unur_tdr_interval *iv; int use_ia; double U, V, X; double fx, hx, Thx, sqx; #ifdef UNUR_ENABLE_LOGGING int error = 0; #endif /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_INFINITY); if (GEN->iv == NULL) { _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"empty generator object"); return UNUR_INFINITY; } /* main URNG */ urng = gen->urng; while (1) { /* sample from U(0,1) */ U = _unur_call_urng(urng); /* look up in guide table and search for segment */ iv = GEN->guide[(int) (U * GEN->guide_size)]; U *= GEN->Atotal; while (iv->Acum < U) { iv = iv->next; } /* reuse of uniform random number */ U -= iv->Acum; /* result: U in (-A_hat,0) */ /* check for region of immediate acceptance */ if (U >= - iv->sq * iv->Ahat) { /* region of immediate acceptance */ U /= iv->sq; use_ia = 1; } else { /* rejection from region between hat and squeeze */ U = (U + iv->sq * iv->Ahat) / (1. - iv->sq); use_ia = 0; } /* result: U in (-A_hat,0) */ /* U in (-A_hatl, A_hatr) */ U += iv->Ahatr; /* generate from hat distribution */ switch (gen->variant & TDR_VARMASK_T) { case TDR_VAR_T_LOG: if (_unur_iszero(iv->dTfx)) X = iv->x + U / iv->fx; else { double t = iv->dTfx * U / iv->fx; if (fabs(t) > 1.e-6) /* x = iv->x + log(t + 1.) / iv->dTfx; is cheaper but numerical unstable */ X = iv->x + log(t + 1.) * U / (iv->fx * t); else if (fabs(t) > 1.e-8) /* use Taylor series */ X = iv->x + U / iv->fx * (1 - t/2. + t*t/3.); else X = iv->x + U / iv->fx * (1 - t/2.); } break; case TDR_VAR_T_SQRT: if (_unur_iszero(iv->dTfx)) X = iv->x + U /iv->fx; else { U *= iv->Tfx; /* avoid one multiplication */ X = iv->x + (iv->Tfx * U) / (1. - iv->dTfx * U); /* It cannot happen, that the denominator becomes 0 ! */ } break; case TDR_VAR_T_POW: /** TODO **/ return 1.; break; default: _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); return 1.; } /* end switch */ /* evaluate hat at X */ switch (gen->variant & TDR_VARMASK_T) { case TDR_VAR_T_LOG: hx = iv->fx * exp(iv->dTfx*(X - iv->x)); break; case TDR_VAR_T_SQRT: Thx = iv->Tfx + iv->dTfx * (X - iv->x); /* transformed hat at X */ hx = 1./(Thx*Thx); break; case TDR_VAR_T_POW: default: /** TODO **/ return 1.; } /* end switch */ /* evaluate PDF at X */ fx = PDF(X); /* evaluate squeeze */ sqx = iv->sq*hx; /* check result */ if (_unur_FP_less(X, DISTR.BD_LEFT) || _unur_FP_greater(X, DISTR.BD_RIGHT) ) { _unur_warning(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,"generated point out of domain"); #ifdef UNUR_ENABLE_LOGGING error = 1; #endif } if (_unur_FP_greater(fx, hx)) { _unur_warning(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF > hat. Not T-concave!"); #ifdef UNUR_ENABLE_LOGGING error = 1; #endif } if (_unur_FP_less(fx, sqx)) { _unur_warning(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF < squeeze. Not T-concave!"); #ifdef UNUR_ENABLE_LOGGING error = 1; #endif } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file (in case error) */ if (error && (gen->debug & TDR_DEBUG_SAMPLE)) _unur_tdr_ps_debug_sample( gen, iv, X, fx, hx, sqx ); #endif /* immedate acceptance */ if (use_ia) return X; /* from now on we use the auxilliary generator (it can be the same as the main generator) */ urng = gen->urng_aux; /* rejection from region between hat and (proportional) squeeze */ V = _unur_call_urng(urng); /* get uniform random number between squeeze(X) and hat(X) */ V = (iv->sq + (1 - iv->sq) * V) * hx; /* main rejection */ if (V <= fx) return X; /* being above squeeze is bad. improve the situation! */ if (GEN->n_ivs < GEN->max_ivs) { if ( (_unur_tdr_ps_improve_hat( gen, iv, X, fx) != UNUR_SUCCESS) && (gen->variant & TDR_VARFLAG_PEDANTIC) ) return UNUR_INFINITY; } /* else reject and try again */ } } /* end of _unur_tdr_ia_sample_check() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/ssr.h0000644001357500135600000002146714420445767013276 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: ssr.h * * * * PURPOSE: * * function prototypes for method SSR * * (Simple Setup, Rejection with universal bounds) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /* =METHOD SSR Simple Setup Rejection =UP Methods_for_CONT =REQUIRED T-concave PDF, mode, area =SPEED Set-up: fast, Sampling: slow =REINIT supported =REF [LJa01] [HLD04: Sect.6.3.3, Alg.6.6] =DESCRIPTION SSR is an acceptance/rejection method that uses universal inequalities for constructing (universal) hats and squeezes (@pxref{Rejection}). It works for all @i{T}-concave distributions with @unurmath{T(x) = -1/\sqrt{x}.} It requires the PDF, the (exact) location of the mode and the area below the given PDF. The rejection constant is 4 for all @i{T}-concave distributions with unbounded domain and is less than 4 when the domain is bounded. Optionally the CDF at the mode can be given to increase the performance of the algorithm. Then the rejection constant is at most 2 and a universal squeeze can (but need not be) used. However, using squeezes is not recommended unless the evaluation of the PDF is expensive. The exact location of the mode and/or the area below the PDF can be replace by appropriate bounds. Then the algorithm still works but has larger rejection constants. =HOWTOUSE SSR works for any continuous univariate distribution object with given @i{T}-concave PDF (with @unurmath{T(x) = -1/\sqrt{x},)} mode and area below PDF. Optional the CDF at the mode can be given to increase the performance of the algorithm by means of the unur_ssr_set_cdfatmode() call. Additionally squeezes can be used and switched on via unur_ssr_set_usesqueeze(). If the (exact) area below the PDF is not known, then an upper bound can be used instead (which of course increases the rejection constant). But then the squeeze flag must not be set and unur_ssr_set_cdfatmode() must not be used. If the exact location of the mode is not known, then use the approximate location and provide the (exact) value of the PDF at the mode by means of the unur_ssr_set_pdfatmode() call. But then unur_ssr_set_cdfatmode() must not be used. Notice, that a (slow) numerical mode finder will be used if no mode is given at all. It is even possible to give an upper bound for the PDF only. However, then the (upper bound for the) area below the PDF has to be multiplied by the ratio between the upper bound and the lower bound of the PDF at the mode. Again setting the squeeze flag and using unur_ssr_set_cdfatmode() is not allowed. It is possible to change the parameters and the domain of the chosen distribution and run unur_reinit() to reinitialize the generator object. Notice, that derived parameters like the mode must also be (re-) set if the parameters or the domain has be changed. Moreover, if the PDF at the mode has been provided by a unur_ssr_set_pdfatmode() call, additionally unur_ssr_chg_pdfatmode() must be used (otherwise this call is not necessary since then this figure is computed directly from the PDF). @emph{Important:} If any of mode, PDF or CDF at the mode, or the area below the mode has been changed, then unur_reinit() must be executed. (Otherwise the generator produces garbage). There exists a test mode that verifies whether the conditions for the method are satisfied or not while sampling. It can be switched on/off by calling unur_ssr_set_verify() and unur_ssr_chg_verify(), respectively. Notice, however, that sampling is (a little bit) slower then. =END */ /*---------------------------------------------------------------------------*/ /* Routines for user interface */ /* =ROUTINES */ UNUR_PAR *unur_ssr_new( const UNUR_DISTR *distribution ); /* Get default parameters for generator. */ /*...........................................................................*/ int unur_ssr_set_cdfatmode( UNUR_PAR *parameters, double Fmode ); /* Set CDF at mode. When set, the performance of the algorithm is increased by factor 2. However, when the parameters of the distribution are changed unur_ssr_chg_cdfatmode() has to be used to update this value. Default: not set. */ int unur_ssr_set_pdfatmode( UNUR_PAR *parameters, double fmode ); /* Set pdf at mode. When set, the PDF at the mode is never changed. This is to avoid additional computations, when the PDF does not change when parameters of the distributions vary. It is only useful when the PDF at the mode does not change with changing parameters for the distribution. Default: not set. */ int unur_ssr_set_usesqueeze( UNUR_PAR *parameters, int usesqueeze ); /* Set flag for using universal squeeze (default: off). Using squeezes is only useful when the evaluation of the PDF is (extremely) expensive. Using squeezes is automatically disabled when the CDF at the mode is not given (then no universal squeezes exist). Default is FALSE. */ int unur_ssr_set_verify( UNUR_PAR *parameters, int verify ); /* */ int unur_ssr_chg_verify( UNUR_GEN *generator, int verify ); /* Turn verifying of algorithm while sampling on/off. If the condition squeeze(@i{x}) <= PDF(@i{x}) <= hat(@i{x}) is violated for some @i{x} then @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. However notice that this might happen due to round-off errors for a few values of @i{x} (less than 1%). Default is FALSE. */ /*...........................................................................*/ int unur_ssr_chg_cdfatmode( UNUR_GEN *generator, double Fmode ); /* Change CDF at mode of distribution. unur_reinit() must be executed before sampling from the generator again. */ int unur_ssr_chg_pdfatmode( UNUR_GEN *generator, double fmode ); /* Change PDF at mode of distribution. unur_reinit() must be executed before sampling from the generator again. */ /* =END */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/dss.h0000644001357500135600000001146214420445767013252 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: dss.h * * * * PURPOSE: * * function prototypes for method DSS * * ((Discrete) Sequential Search (guide table)) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /* =METHOD DSS (Discrete) Sequential Search method =UP Methods_for_DISCR =REQUIRED probability vector (PV) and sum over PV; or probability mass function(PMF), sum over PV and domain; or or cumulative distribution function (CDF) =SPEED Set-up: fast, Sampling: very slow (linear in expectation) =REINIT supported =REF [HLD04: Sect.3.1.1, Alg.3.1] =DESCRIPTION DSS samples from arbitrary discrete distributions. Random numbers are generated by the inversion method, i.e., @enumerate @item Generate a random number U ~ U(0,1). @item Find smallest integer I such that F(I) = P(X<=I) >= U. @end enumerate Step (2) is the crucial step. Using sequential search requires @i{O(E(X))} comparisons, where @i{E(X)} is the expectation of the distribution. Thus this method is only recommended when only a few random variates from the given distribution are required. Otherwise, table methods like DGT (@pxref{DGT}) or DAU (@pxref{DAU}) are much faster. These methods also need not the sum over the PMF (or PV) as input. On the other hand, however, these methods always compute a table. DSS runs with the PV, the PMF, or the CDF of the distribution. It uses actually uses the first one in this list (in this ordering) that could be found. =HOWTOUSE It works with a discrete distribution object with contains at least the PV, the PMF, or the CDF. It is possible to change the parameters and the domain of the chosen distribution and run unur_reinit() to reinitialize the generator object. =END */ /*---------------------------------------------------------------------------*/ /* Routines for user interface */ /* =ROUTINES */ UNUR_PAR *unur_dss_new( const UNUR_DISTR *distribution ); /* Get default parameters for generator. */ /* =END */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/dss.c0000644001357500135600000006771214420445767013256 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: dss.c * * * * TYPE: discrete univariate random variate * * METHOD: sequential search * * * * DESCRIPTION: * * Given PV or PMF together with sum over PV or PMF, * * or the VDF, * * * * REQUIRED: pointer to probability vector, sum over PV * * pointer to PMF, sum over PMF * * pointer to CDF * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * ***************************************************************************** * * * SUMMARY: * * [1] Devroye, L. (1986): Non-Uniform Random Variate Generation, New-York * * * ***************************************************************************** * * * This method a varient of the inversion method, i.e. * * * * (1) Generate a random number U ~ U(0,1). * * (2) Find largest integer I such that F(I) = P(X<=I) <= U. * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include "unur_methods_source.h" #include "x_gen_source.h" #include "dss.h" #include "dss_struct.h" /*---------------------------------------------------------------------------*/ /* Variants */ #define DSS_VARIANT_NONE 0x000u /* invalid data */ #define DSS_VARIANT_PV 0x001u /* use PV */ #define DSS_VARIANT_PMF 0x002u /* use PMF */ #define DSS_VARIANT_CDF 0x004u /* use CDF */ /*---------------------------------------------------------------------------*/ /* Debugging flags */ /* bit 01 ... pameters and structure of generator (do not use here) */ /* bits 02-12 ... setup */ /* bits 13-24 ... adaptive steps */ /* bits 25-32 ... trace sampling */ #define DSS_DEBUG_REINIT 0x00000010u /* print parameters after reinit */ #define DSS_DEBUG_PRINTVECTOR 0x00000100u /*---------------------------------------------------------------------------*/ /* Flags for logging set calls */ /*---------------------------------------------------------------------------*/ #define GENTYPE "DSS" /* type of generator */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_dss_init( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* Initialize new generator. */ /*---------------------------------------------------------------------------*/ static int _unur_dss_reinit( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Reinitialize generator. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_dss_create( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* create new (almost empty) generator object. */ /*---------------------------------------------------------------------------*/ static int _unur_dss_check_par( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Check parameters of given distribution and method */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_dss_clone( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* copy (clone) generator object. */ /*---------------------------------------------------------------------------*/ static void _unur_dss_free( struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* destroy generator object. */ /*---------------------------------------------------------------------------*/ static int _unur_dss_sample( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* sample from generator */ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ /* the following functions print debugging information on output stream, */ /* i.e., into the LOG file if not specified otherwise. */ /*---------------------------------------------------------------------------*/ static void _unur_dss_debug_init( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print after generator has been initialized has completed. */ /*---------------------------------------------------------------------------*/ #endif #ifdef UNUR_ENABLE_INFO static void _unur_dss_info( struct unur_gen *gen, int help ); /*---------------------------------------------------------------------------*/ /* create info string. */ /*---------------------------------------------------------------------------*/ #endif /*---------------------------------------------------------------------------*/ /* abbreviations */ #define DISTR_IN distr->data.discr /* data for distribution object */ #define PAR ((struct unur_dss_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_dss_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.discr /* data for distribution in generator object */ #define SAMPLE gen->sample.discr /* pointer to sampling routine */ #define PMF(x) _unur_discr_PMF((x),(gen->distr)) /* call to PMF */ #define CDF(x) _unur_discr_CDF((x),(gen->distr)) /* call to CDF */ /*---------------------------------------------------------------------------*/ #define _unur_dss_getSAMPLE(gen) (_unur_dss_sample) /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Public: User Interface (API) **/ /*****************************************************************************/ struct unur_par * unur_dss_new( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get default parameters */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* default parameters (pointer to structure) */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_par *par; unsigned variant = DSS_VARIANT_NONE; /* check arguments */ _unur_check_NULL( GENTYPE,distr,NULL ); /* check distribution */ if (distr->type != UNUR_DISTR_DISCR) { _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } COOKIE_CHECK(distr,CK_DISTR_DISCR,NULL); if (DISTR_IN.pv && (distr->set & UNUR_DISTR_SET_PMFSUM)) variant = DSS_VARIANT_PV; else if (DISTR_IN.pmf && (distr->set & UNUR_DISTR_SET_PMFSUM)) variant = DSS_VARIANT_PMF; else if (DISTR_IN.cdf) variant = DSS_VARIANT_CDF; if (variant == DSS_VARIANT_NONE) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PV+sum, PMF+sum, or CDF"); return NULL; } /* allocate structure */ par = _unur_par_new( sizeof(struct unur_dss_par) ); COOKIE_SET(par,CK_DSS_PAR); /* copy input */ par->distr = distr; /* pointer to distribution object */ /* set default values */ par->method = UNUR_METH_DSS; /* method */ par->variant = variant; /* variant of method */ par->set = 0u; /* inidicate default parameters */ par->urng = unur_get_default_urng(); /* use default urng */ par->urng_aux = NULL; /* no auxilliary URNG required */ par->debug = _unur_default_debugflag; /* set default debugging flags */ /* routine for starting generator */ par->init = _unur_dss_init; return par; } /* end of unur_dss_new() */ /*****************************************************************************/ /** Private **/ /*****************************************************************************/ struct unur_gen * _unur_dss_init( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* initialize new generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* pointer to generator object */ /* check arguments */ CHECK_NULL(par,NULL); /* check input */ if ( par->method != UNUR_METH_DSS ) { _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); return NULL; } COOKIE_CHECK(par,CK_DSS_PAR,NULL); /* create a new empty generator object */ gen = _unur_dss_create(par); _unur_par_free(par); if (!gen) return NULL; #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_dss_debug_init(gen); #endif return gen; } /* end of _unur_dss_init() */ /*---------------------------------------------------------------------------*/ int _unur_dss_reinit( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* re-initialize (existing) generator. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int rcode; /* check parameters */ if ( (rcode = _unur_dss_check_par(gen)) != UNUR_SUCCESS) return rcode; /* (re)set sampling routine */ SAMPLE = _unur_dss_getSAMPLE(gen); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug & DSS_DEBUG_REINIT) _unur_dss_debug_init(gen); #endif return UNUR_SUCCESS; } /* end of _unur_dss_reinit() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_dss_create( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* allocate memory for generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* pointer to (empty) generator object with default settings */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* pointer to generator object */ /* check arguments */ CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_DSS_PAR,NULL); /* create new generic generator object */ gen = _unur_generic_create( par, sizeof(struct unur_dss_gen) ); /* magic cookies */ COOKIE_SET(gen,CK_DSS_GEN); /* set generator identifier */ gen->genid = _unur_set_genid(GENTYPE); /* routines for sampling and destroying generator */ SAMPLE = _unur_dss_getSAMPLE(gen); gen->destroy = _unur_dss_free; gen->clone = _unur_dss_clone; gen->reinit = _unur_dss_reinit; #ifdef UNUR_ENABLE_INFO /* set function for creating info string */ gen->info = _unur_dss_info; #endif /* return pointer to (almost empty) generator object */ return gen; } /* end of _unur_dss_create() */ /*---------------------------------------------------------------------------*/ int _unur_dss_check_par( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* check parameters of given distribution and method */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { switch(gen->variant) { case DSS_VARIANT_PV: if (DISTR.pv != NULL) break; _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PV"); return UNUR_ERR_DISTR_REQUIRED; case DSS_VARIANT_PMF: if (DISTR.pmf != NULL) break; _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PMF"); return UNUR_ERR_DISTR_REQUIRED; case DSS_VARIANT_CDF: if (DISTR.cdf != NULL) return UNUR_SUCCESS; _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"CDF"); return UNUR_ERR_DISTR_REQUIRED; default: _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); return UNUR_ERR_SHOULD_NOT_HAPPEN; } /* additionally check for required data: sum over PMF */ if (!(gen->distr->set & UNUR_DISTR_SET_PMFSUM)) if (unur_distr_discr_upd_pmfsum(gen->distr)!=UNUR_SUCCESS) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"sum over PMF"); return UNUR_ERR_DISTR_REQUIRED; } return UNUR_SUCCESS; } /* end of _unur_dss_check_par() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_dss_clone( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* copy (clone) generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to clone of generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { #define CLONE ((struct unur_dss_gen*)clone->datap) struct unur_gen *clone; /* check arguments */ CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_DSS_GEN,NULL); /* create generic clone */ clone = _unur_generic_clone( gen, GENTYPE ); return clone; #undef CLONE } /* end of _unur_dss_clone() */ /*---------------------------------------------------------------------------*/ void _unur_dss_free( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* deallocate generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { /* check arguments */ if (!gen) /* nothing to do */ return; /* check input */ if ( gen->method != UNUR_METH_DSS ) { _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); return; } COOKIE_CHECK(gen,CK_DSS_GEN,RETURN_VOID); /* we cannot use this generator object any more */ SAMPLE = NULL; /* make sure to show up a programming error */ /* free memory */ _unur_generic_free(gen); } /* end of _unur_dss_free() */ /*****************************************************************************/ int _unur_dss_sample( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* integer (sample from random variate) */ /* */ /* error: */ /* return INT_MAX */ /*----------------------------------------------------------------------*/ { int J; double U; double sum; /* check arguments */ CHECK_NULL(gen,INT_MAX); COOKIE_CHECK(gen,CK_DSS_GEN,INT_MAX); switch(gen->variant) { case DSS_VARIANT_PV: U = DISTR.sum * _unur_call_urng(gen->urng); sum = 0.; for (J=0; J= U) break; } return (J + DISTR.domain[0]); case DSS_VARIANT_PMF: U = DISTR.sum * _unur_call_urng(gen->urng); sum = 0.; for (J=DISTR.domain[0]; J<=DISTR.domain[1]; J++) { sum += PMF(J); if (sum >= U) break; } return J; case DSS_VARIANT_CDF: U = _unur_call_urng(gen->urng); for (J=DISTR.domain[0]; J<=DISTR.domain[1]; J++) { if (CDF(J) >= U) break; } return J; default: _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); return INT_MAX; } } /* end of _unur_dss_sample() */ /*****************************************************************************/ /** Auxilliary Routines **/ /*****************************************************************************/ /*****************************************************************************/ /** Debugging utilities **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ void _unur_dss_debug_init( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write info about generator into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_DSS_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: type = discrete univariate random variates\n",gen->genid); fprintf(LOG,"%s: method = sequential search\n",gen->genid); _unur_distr_discr_debug( gen->distr,gen->genid,(gen->debug & DSS_DEBUG_PRINTVECTOR)); fprintf(LOG,"%s: sampling routine = _unur_dss_sample()\n",gen->genid); fprintf(LOG,"%s: variant = ",gen->genid); switch(gen->variant) { case DSS_VARIANT_PV: fprintf(LOG,"use PV\n"); break; case DSS_VARIANT_PMF: fprintf(LOG,"use PMF\n"); break; case DSS_VARIANT_CDF: fprintf(LOG,"use CDF\n"); break; default: _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); } fprintf(LOG,"%s:\n",gen->genid); } /* end of _unur_dss_debug_init() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_INFO /*---------------------------------------------------------------------------*/ void _unur_dss_info( struct unur_gen *gen, int help ) /*----------------------------------------------------------------------*/ /* create character string that contains information about the */ /* given generator object. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* help ... whether to print additional comments */ /*----------------------------------------------------------------------*/ { struct unur_string *info = gen->infostr; /* generator ID */ _unur_string_append(info,"generator ID: %s\n\n", gen->genid); /* distribution */ _unur_string_append(info,"distribution:\n"); _unur_distr_info_typename(gen); switch(gen->variant) { case DSS_VARIANT_PV: _unur_string_append(info," functions = PV [length=%d]\n",DISTR.domain[1]-DISTR.domain[0]+1); break; case DSS_VARIANT_PMF: _unur_string_append(info," functions = PMF\n"); break; case DSS_VARIANT_CDF: _unur_string_append(info," functions = CDF\n"); break; } _unur_string_append(info," domain = (%d, %d)\n", DISTR.domain[0],DISTR.domain[1]); _unur_string_append(info,"\n"); /* method */ _unur_string_append(info,"method: DSS (Simple Sequential Search)\n"); _unur_string_append(info,"\n"); /* performance */ _unur_string_append(info,"performance characteristics: slow\n"); _unur_string_append(info,"\n"); /* parameters */ if (help) { _unur_string_append(info,"parameters: none\n"); _unur_string_append(info,"\n"); } /* Hints */ /* if (help) { */ /* _unur_string_append(info,"\n"); */ /* } */ } /* end of _unur_dss_info() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_INFO */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/pinv_debug.ch0000644001357500135600000003056414420445767014752 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: pinv_debug.c * * * * Routines for printing debugging information. * * * ***************************************************************************** * * * Copyright (c) 2008 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * *****************************************************************************/ /*****************************************************************************/ /** Debugging utilities **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ void _unur_pinv_debug_init_start( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write info about generator into LOG filebefore setup starts. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_PINV_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: type = continuous univariate random variates\n",gen->genid); fprintf(LOG,"%s: method = PINV (Polynomial interpolation based INVerse CDF)\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); _unur_distr_cont_debug( gen->distr, gen->genid ); fprintf(LOG,"%s: sampling routine = _unur_pinv_sample\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: order of polynomial = %d",gen->genid,GEN->order); _unur_print_if_default(gen,PINV_SET_ORDER); if(gen->set & PINV_SET_ORDER_COR) fprintf(LOG," [corrected]"); fprintf(LOG,"\n%s: smoothness = %d",gen->genid,GEN->smooth); _unur_print_if_default(gen,PINV_SET_SMOOTH); if(gen->set & PINV_SET_SMOOTH_COR) fprintf(LOG," [corrected]"); fprintf(LOG,"\n%s: u-resolution = %g",gen->genid,GEN->u_resolution); _unur_print_if_default(gen,PINV_SET_U_RESOLUTION); fprintf(LOG,"\n%s: # extra test points = %d",gen->genid,GEN->n_extra_testpoints); _unur_print_if_default(gen,PINV_SET_N_EXTRA_TP); fprintf(LOG,"\n%s: maximum number of subintervals = %d",gen->genid,GEN->max_ivs); _unur_print_if_default(gen,PINV_SET_MAX_IVS); fprintf(LOG,"\n%s: variant = ",gen->genid); if (gen->variant & PINV_VARIANT_PDF) fprintf(LOG,"use PDF + Lobatto integration"); else fprintf(LOG,"use CDF"); _unur_print_if_default(gen,PINV_SET_VARIANT); fprintf(LOG,"\n"); fprintf(LOG,"%s: use Chebyshev points in %s scale",gen->genid, (gen->variant & PINV_VARIANT_UPOINTS) ? "u" : "x"); _unur_print_if_default(gen,PINV_SET_UPOINTS); fprintf(LOG,"\n"); fprintf(LOG,"%s: keep table of CDF values = %s",gen->genid, (gen->variant & PINV_VARIANT_KEEPCDF) ? "on" : "off"); _unur_print_if_default(gen,PINV_SET_KEEPCDF); fprintf(LOG,"\n"); fprintf(LOG,"%s:\n",gen->genid); fflush(LOG); } /* end of _unur_pinv_debug_init_start() */ /*---------------------------------------------------------------------------*/ void _unur_pinv_debug_init( const struct unur_gen *gen, int ok ) /*----------------------------------------------------------------------*/ /* write info about generator into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* ok ... exitcode of init call */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_PINV_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s: INIT completed **********************\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: domain of computation = [%g,%g]\n",gen->genid, GEN->bleft,GEN->bright); fprintf(LOG,"%s: Umin = 0 [fixed], Umax = %18.16g",gen->genid, GEN->Umax); if (_unur_FP_approx(GEN->Umax,1.)) fprintf(LOG,", 1-Umax = %g",1.-GEN->Umax); fprintf(LOG,"\n%s:\n",gen->genid); fprintf(LOG,"%s: # Intervals = %d\n",gen->genid,GEN->n_ivs); fprintf(LOG,"%s:\n",gen->genid); _unur_pinv_debug_intervals(gen); fprintf(LOG,"%s: initialization %s\n",gen->genid,((ok)?"successful":"*** FAILED ***")); fprintf(LOG,"%s:\n",gen->genid); fflush(LOG); } /* end of _unur_pinv_debug_init() */ /*---------------------------------------------------------------------------*/ void _unur_pinv_debug_relevant_support (const struct unur_gen *gen) /*----------------------------------------------------------------------*/ /* print relevant domain */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_PINV_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s: search for boundaries: left = %s, right = %s\n",gen->genid, GEN->sleft ? "TRUE" : "FALSE", GEN->sright ? "TRUE" : "FALSE"); fprintf(LOG,"%s: relevant domain = (%g,%g) [i.e. where PDF > threshold]\n",gen->genid, GEN->bleft,GEN->bright); fprintf(LOG,"%s: possible support of distribution = (%g,%g)\n",gen->genid, GEN->dleft,GEN->dright); fprintf(LOG,"%s:\n",gen->genid); fflush(LOG); } /* end of _unur_pinv_debug_relevant_support() */ /*---------------------------------------------------------------------------*/ void _unur_pinv_debug_pdfarea (const struct unur_gen *gen, int approx) /*----------------------------------------------------------------------*/ /* print estimated area below PDF */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* approx ... whether this is an approximate value or accurat up to */ /* requested tolerance */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_PINV_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s: area below PDF %s = %19.16g\n",gen->genid, approx ? "(approx.)" : "(accurate)", GEN->area); if (GEN->aCDF) _unur_lobatto_debug_table(GEN->aCDF, gen, (gen->debug & PINV_DEBUG_ITABLE)); fprintf(LOG,"%s:\n",gen->genid); fflush(LOG); } /* end of _unur_pinv_debug_pdfarea() */ /*---------------------------------------------------------------------------*/ void _unur_pinv_debug_computational_domain (const struct unur_gen *gen) /*----------------------------------------------------------------------*/ /* print computational domain */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_PINV_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s: computational domain = (%g,%g)\n",gen->genid, GEN->bleft,GEN->bright); fprintf(LOG,"%s:\n",gen->genid); fflush(LOG); } /* end of _unur_pinv_debug_computational_domain() */ /*---------------------------------------------------------------------------*/ void _unur_pinv_debug_intervals( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* print table of intervals into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { int n, j; FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_PINV_GEN,RETURN_VOID); LOG = unur_get_stream(); if (gen->debug & PINV_DEBUG_TABLE) { for (n=0; n<=GEN->n_ivs; n++) { fprintf(LOG,"%s: [%3d] xi = %.16g, cdfi = %.14g\n",gen->genid, n, GEN->iv[n].xi, GEN->iv[n].cdfi); /* coefficients for constructing Newton interpolation */ fprintf(LOG,"%s:\tui = %.16g",gen->genid, GEN->iv[n].ui[0]); for (j=1; jorder; j++) fprintf(LOG,", %.14g",GEN->iv[n].ui[j]); fprintf(LOG,"\n%s:\tzi = %.16g",gen->genid, GEN->iv[n].zi[0]); for (j=1; jorder; j++) fprintf(LOG,", %.16g",GEN->iv[n].zi[j]); fprintf(LOG,"\n"); } } fprintf(LOG,"%s:\n",gen->genid); fflush(LOG); } /* end of _unur_pinv_debug_intervals() */ /*---------------------------------------------------------------------------*/ void _unur_pinv_debug_create_table (const struct unur_gen *gen, int iter, int n_incr_h, int n_decr_h, int n_use_linear) /*----------------------------------------------------------------------*/ /* print data that have been collected while creating polynomials. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* iter ... total number of iterations */ /* n_incr_h ... number of steps where h is increased */ /* n_decr_h ... number of steps where h is decreased */ /* n_use_linear .. number of steps where linear interpolation is used */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_PINV_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s: Create interpolating polynomials:\n",gen->genid); fprintf(LOG,"%s:\t# iterations = %d\n",gen->genid,iter); fprintf(LOG,"%s:\t# step size increased = %d (%g%%)\n",gen->genid,n_incr_h,(100.*n_incr_h)/iter); fprintf(LOG,"%s:\t# step size decreased = %d (%g%%)\n",gen->genid,n_decr_h,(100.*n_decr_h)/iter); fprintf(LOG,"%s:\t# linear = %d (%g%%)\n",gen->genid,n_use_linear,(100.*n_use_linear)/iter); fprintf(LOG,"%s:\n",gen->genid); fflush(LOG); } /* end of _unur_pinv_debug_create_table() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/cstd.c0000644001357500135600000013076414420445767013420 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: cstd.c * * * * TYPE: continuous univariate random variate * * METHOD: generators for standard distribution * * * ***************************************************************************** * * * Copyright (c) 2000-2011 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * ***************************************************************************** * * * CSTD is a wrapper for special generator for Continuous univariate * * STandarD distributions. It only works for distributions in the UNURAN * * library of distributions or those continuous distributions that have * * the inverse CDF implemented. Otherwise it refuses to work. * * * * It calls the initialization routine provided by the distribution object. * * This routine has to do all setup steps for the special generator. * * If no such routine is given (i.e. distr->init==NULL) or when it does not * * implement the inversion method then the inverse CDF stored in the * * distribution object (if available) is used. * * If neither is available, then unur_cstd_new() does not work and the * * NULL pointer is returned instead of the pointer to a parameter object. * * * * Notice that using a truncated distribution (this can be constructed by * * changing the default domain of a distribution by means of an * * unur_distr_cont_set_domain() call) is only allowed if the inversion * * method is used. Otherwise no parameter object is returned by the * * unur_cstd_new() call. * * * * Variants (different algorithms for the same distribution) are possible * * and can be selected by unsigned integers using the * * unur_cstd_set_variant() call. * * For possible variants see the generator files for each distribution in * * the distributions directory. However the following are common to all * * distributions: * * * * UNUR_STDGEN_DEFAULT ... the default generator * * UNUR_STDGEN_INVERSION ... the inversion method (if available) * * UNUR_STDGEN_FAST ... the fasted available special generator * * * * unur_cstd_set_variant() return 0 if a variant is not implemented, and 1 * * otherwise. In the first case the selected variant is not changed. * * * * The domain of a (truncated) distribution can be changed without building * * a new generator object by means of the unur_cstd_chg_truncated() call. * * Notice that this only works when the inversion method is used. Otherwise * * nothing happens to the domain and an error message is produced. * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include #include #include "unur_methods_source.h" #include "x_gen_source.h" #include "cstd.h" #include "cstd_struct.h" #ifdef UNUR_ENABLE_INFO # include #endif /*---------------------------------------------------------------------------*/ /* Variants: none */ /*---------------------------------------------------------------------------*/ /* Debugging flags */ /* bit 01 ... pameters and structure of generator (do not use here) */ /* bits 02-12 ... setup */ /* bits 13-24 ... adaptive steps */ /* bits 25-32 ... trace sampling */ #define CSTD_DEBUG_GEN 0x00000005u /* print constants for generator */ #define CSTD_DEBUG_REINIT 0x00000010u /* print params of distr after reinit */ #define CSTD_DEBUG_CHG 0x00001000u /* print changed params of distr */ /*---------------------------------------------------------------------------*/ /* Flags for logging set calls */ #define CSTD_SET_VARIANT 0x01u /*---------------------------------------------------------------------------*/ #define GENTYPE "CSTD" /* type of generator */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_cstd_init( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* Initialize new generator. */ /*---------------------------------------------------------------------------*/ static int _unur_cstd_reinit( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Reinitialize generator. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_cstd_create( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* create new (almost empty) generator object. */ /*---------------------------------------------------------------------------*/ static int _unur_cstd_check_par( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Check parameters of given distribution and method */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_cstd_clone( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* copy (clone) generator object. */ /*---------------------------------------------------------------------------*/ static void _unur_cstd_free( struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* destroy generator object. */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* There are no sampling routines, since every distribution has its own. */ /* Sampling routines are defined in ../distributions/ for each distributions.*/ /* double _unur_cstd_sample( UNUR_GEN *gen ); does not exist! */ /*---------------------------------------------------------------------------*/ static double _unur_cstd_sample_inv( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Generic inversion method. */ /*---------------------------------------------------------------------------*/ static int _unur_cstd_inversion_init( struct unur_par *par, struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Initialize special generator for inversion method. */ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ /* the following functions print debugging information on output stream, */ /* i.e., into the LOG file if not specified otherwise. */ /*---------------------------------------------------------------------------*/ static void _unur_cstd_debug_init( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print after generator has been initialized has completed. */ /*---------------------------------------------------------------------------*/ static void _unur_cstd_debug_chg_pdfparams( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print new (changed) parameters of distribution */ /*---------------------------------------------------------------------------*/ static void _unur_cstd_debug_chg_truncated( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print new (changed) domain of (truncated) distribution */ /*---------------------------------------------------------------------------*/ #endif #ifdef UNUR_ENABLE_INFO static void _unur_cstd_info( struct unur_gen *gen, int help ); /*---------------------------------------------------------------------------*/ /* create info string. */ /*---------------------------------------------------------------------------*/ #endif /*---------------------------------------------------------------------------*/ /* abbreviations */ #define DISTR_IN distr->data.cont /* data for distribution object */ #define PAR ((struct unur_cstd_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_cstd_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.cont /* data for distribution in generator object */ #define SAMPLE gen->sample.cont /* pointer to sampling routine */ #define CDF(x) _unur_cont_CDF((x),(gen->distr)) /* call to CDF */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Public: User Interface (API) **/ /*****************************************************************************/ struct unur_par * unur_cstd_new( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get default parameters */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* default parameters (pointer to structure) */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_par *par; /* check arguments */ _unur_check_NULL(GENTYPE,distr,NULL); /* check distribution */ if (distr->type != UNUR_DISTR_CONT) { _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } COOKIE_CHECK(distr,CK_DISTR_CONT,NULL); if (DISTR_IN.init == NULL && DISTR_IN.invcdf == NULL) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"init() for special generators or inverse CDF"); return NULL; } /* allocate structure */ par = _unur_par_new( sizeof(struct unur_cstd_par) ); COOKIE_SET(par,CK_CSTD_PAR); /* copy input */ par->distr = distr; /* pointer to distribution object */ /* set default values */ par->method = UNUR_METH_CSTD; /* method */ par->variant = 0u; /* default variant */ par->set = 0u; /* indicate default parameters */ par->urng = unur_get_default_urng(); /* use default urng */ par->urng_aux = NULL; /* no auxilliary URNG required */ par->debug = _unur_default_debugflag; /* set default debugging flags */ /* routine for initializing generator */ par->init = _unur_cstd_init; return par; } /* end of unur_cstd_new() */ /*****************************************************************************/ int unur_cstd_set_variant( struct unur_par *par, unsigned variant ) /*----------------------------------------------------------------------*/ /* set variant of method */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* variant ... indicator for variant */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { unsigned old_variant; /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_NULL( GENTYPE, par->distr, UNUR_ERR_NULL ); _unur_check_par_object( par, CSTD ); /* store date */ old_variant = par->variant; par->variant = variant; /* check variant. run special init routine only in test mode */ if ( (par->DISTR_IN.init == NULL || par->DISTR_IN.init(par,NULL)!=UNUR_SUCCESS) && _unur_cstd_inversion_init(par,NULL)!=UNUR_SUCCESS ) { /* variant not valid */ _unur_warning(GENTYPE,UNUR_ERR_PAR_VARIANT,""); par->variant = old_variant; return UNUR_ERR_PAR_VARIANT; } /* changelog */ par->set |= CSTD_SET_VARIANT; /* o.k. */ return UNUR_SUCCESS; } /* end if unur_cstd_set_variant() */ /*---------------------------------------------------------------------------*/ int unur_cstd_chg_truncated( struct unur_gen *gen, double left, double right ) /*----------------------------------------------------------------------*/ /* change the left and right borders of the domain of the */ /* (truncated) distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* left ... left boundary point */ /* right ... right boundary point */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* the new boundary points may be +/- UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { double Umin, Umax; /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, CSTD, UNUR_ERR_GEN_INVALID ); /* domain can only be changed for inversion method! */ if ( ! GEN->is_inversion ) { /* this is not the inversion method */ _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"truncated domain for non inversion method"); return UNUR_ERR_GEN_DATA; } /* CDF required ! */ if (DISTR.cdf == NULL) { _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"truncated domain, CDF required"); return UNUR_ERR_GEN_DATA; } /* check new parameter for generator */ /* (the truncated domain must be a subset of the domain) */ if (left < DISTR.domain[0]) { _unur_warning(NULL,UNUR_ERR_DISTR_SET,"truncated domain too large"); left = DISTR.domain[0]; } if (right > DISTR.domain[1]) { _unur_warning(NULL,UNUR_ERR_DISTR_SET,"truncated domain too large"); right = DISTR.domain[1]; } if (left >= right) { _unur_warning(NULL,UNUR_ERR_DISTR_SET,"domain, left >= right"); return UNUR_ERR_DISTR_SET; } /* compute umin and umax */ Umin = (left > -UNUR_INFINITY) ? CDF(left) : 0.; Umax = (right < UNUR_INFINITY) ? CDF(right) : 1.; /* check result */ if (Umin > Umax) { /* this is a serios error that should not happen */ _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); return UNUR_ERR_SHOULD_NOT_HAPPEN; } if (_unur_FP_equal(Umin,Umax)) { /* CDF values very close */ _unur_warning(gen->genid,UNUR_ERR_DISTR_SET,"CDF values very close"); if (_unur_iszero(Umin) || _unur_FP_same(Umax,1.)) { /* this is very bad */ _unur_warning(gen->genid,UNUR_ERR_DISTR_SET,"CDF values at boundary points too close"); return UNUR_ERR_DISTR_SET; } } /* copy new boundaries into generator object */ DISTR.trunc[0] = left; DISTR.trunc[1] = right; GEN->Umin = Umin; GEN->Umax = Umax; /* changelog */ gen->distr->set |= UNUR_DISTR_SET_TRUNCATED; /* indicate that we have a truncated distribution. (do not have the standard domain any more) */ gen->distr->set &= ~UNUR_DISTR_SET_STDDOMAIN; #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug & CSTD_DEBUG_CHG) _unur_cstd_debug_chg_truncated( gen ); #endif /* o.k. */ return UNUR_SUCCESS; } /* end of unur_cstd_chg_truncated() */ /*****************************************************************************/ /** Private **/ /*****************************************************************************/ struct unur_gen * _unur_cstd_init( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* initialize new generator */ /* */ /* parameters: */ /* par ... pointer to paramters for building generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); /* check input */ if ( par->method != UNUR_METH_CSTD ) { _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); return NULL; } COOKIE_CHECK(par,CK_CSTD_PAR,NULL); /* create a new empty generator object */ gen = _unur_cstd_create(par); _unur_par_free(par); if (!gen) return NULL; /* run special init routine for generator */ GEN->is_inversion = FALSE; /* reset flag for inversion method */ if ( (DISTR.init == NULL || DISTR.init(NULL,gen)!=UNUR_SUCCESS) && _unur_cstd_inversion_init(NULL,gen)!=UNUR_SUCCESS ) { /* init failed --> could not find a sampling routine */ _unur_error(GENTYPE,UNUR_ERR_GEN_DATA,"variant for special generator"); _unur_cstd_free(gen); return NULL; } /* check parameters */ if (_unur_cstd_check_par(gen) != UNUR_SUCCESS) { _unur_cstd_free(gen); return NULL; } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_cstd_debug_init(gen); #endif /* o.k. */ return gen; } /* end of _unur_cstd_init() */ /*---------------------------------------------------------------------------*/ int _unur_cstd_reinit( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* re-initialize (existing) generator. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int rcode; /* run special init routine for generator */ GEN->is_inversion = FALSE; /* reset flag for inversion method */ if ( (DISTR.init == NULL || DISTR.init(NULL,gen)!=UNUR_SUCCESS) && _unur_cstd_inversion_init(NULL,gen)!=UNUR_SUCCESS ) { /* init failed --> could not find a sampling routine */ _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"parameters"); return UNUR_ERR_GEN_DATA; } /* check parameters */ if ( (rcode = _unur_cstd_check_par(gen)) != UNUR_SUCCESS) return rcode; #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug & CSTD_DEBUG_REINIT) _unur_cstd_debug_chg_pdfparams( gen ); #endif /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_cstd_reinit() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_cstd_create( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* allocate memory for generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* pointer to (empty) generator object with default settings */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_CSTD_PAR,NULL); /* create new generic generator object */ gen = _unur_generic_create( par, sizeof(struct unur_cstd_gen) ); /* magic cookies */ COOKIE_SET(gen,CK_CSTD_GEN); /* set generator identifier */ gen->genid = _unur_set_genid(GENTYPE); /* routines for sampling and destroying generator */ SAMPLE = NULL; /* will be set in _unur_cstd_init() */ gen->destroy = _unur_cstd_free; gen->clone = _unur_cstd_clone; gen->reinit = _unur_cstd_reinit; /* defaults */ GEN->gen_param = NULL; /* parameters for the generator */ GEN->n_gen_param = 0; /* (computed in special GEN->init() */ GEN->is_inversion = FALSE; /* method not based on inversion */ GEN->sample_routine_name = NULL ; /* name of sampling routine */ /* copy some parameters into generator object */ GEN->Umin = 0.; /* cdf at left boundary of domain */ GEN->Umax = 1.; /* cdf at right boundary of domain */ /* GEN->is_inversion is set in _unur_cstd_inversion_init() */ #ifdef UNUR_ENABLE_INFO /* set function for creating info string */ gen->info = _unur_cstd_info; #endif /* return pointer to (almost empty) generator object */ return gen; } /* end of _unur_cstd_create() */ /*---------------------------------------------------------------------------*/ int _unur_cstd_check_par( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* check parameters of given distribution and method */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* domain valid for special generator ?? */ if (!(gen->distr->set & UNUR_DISTR_SET_STDDOMAIN)) { /* domain has been modified */ gen->distr->set &= UNUR_DISTR_SET_TRUNCATED; DISTR.trunc[0] = DISTR.domain[0]; DISTR.trunc[1] = DISTR.domain[1]; if ( ! GEN->is_inversion ) { /* this is not the inversion method */ _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"domain changed for non inversion method"); return UNUR_ERR_GEN_DATA; } if (DISTR.cdf == NULL) { /* using a truncated distribution requires a CDF */ _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"domain changed, CDF required"); return UNUR_ERR_GEN_DATA; } /* compute Umin and Umax */ GEN->Umin = (DISTR.trunc[0] > -UNUR_INFINITY) ? CDF(DISTR.trunc[0]) : 0.; GEN->Umax = (DISTR.trunc[1] < UNUR_INFINITY) ? CDF(DISTR.trunc[1]) : 1.; } return UNUR_SUCCESS; } /* end of _unur_cstd_check_par() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_cstd_clone( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* copy (clone) generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to clone of generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { #define CLONE ((struct unur_cstd_gen*)clone->datap) struct unur_gen *clone; /* check arguments */ CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_CSTD_GEN,NULL); /* create generic clone */ clone = _unur_generic_clone( gen, GENTYPE ); /* copy parameters for special generators */ if (GEN->gen_param) { CLONE->gen_param = _unur_xmalloc( GEN->n_gen_param * sizeof(double) ); memcpy( CLONE->gen_param, GEN->gen_param, GEN->n_gen_param * sizeof(double) ); } return clone; #undef CLONE } /* end of _unur_cstd_clone() */ /*---------------------------------------------------------------------------*/ void _unur_cstd_free( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* deallocate generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { /* check arguments */ if( !gen ) /* nothing to do */ return; /* magic cookies */ COOKIE_CHECK(gen,CK_CSTD_GEN,RETURN_VOID); /* check input */ if ( gen->method != UNUR_METH_CSTD ) { _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); return; } /* we cannot use this generator object any more */ SAMPLE = NULL; /* make sure to show up a programming error */ /* free memory */ if (GEN->gen_param) free(GEN->gen_param); _unur_generic_free(gen); } /* end of _unur_cstd_free() */ /*****************************************************************************/ /** double _unur_cstd_sample( struct unur_gen *gen ) {} Does not exists !!! Sampling routines are defined in ../distributions/ for each distributions. **/ /*****************************************************************************/ double _unur_cstd_sample_inv( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* generic inversion method. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { double U; if (!DISTR.invcdf) return UNUR_INFINITY; /* sample from uniform random number generator */ while (_unur_iszero(U = GEN->Umin + _unur_call_urng(gen->urng) * (GEN->Umax-GEN->Umin))); /* compute inverse CDF */ return (DISTR.invcdf(U,gen->distr)); } /* _unur_cstd_sample_inv() */ /*---------------------------------------------------------------------------*/ double unur_cstd_eval_invcdf( const struct unur_gen *gen, double u ) /*----------------------------------------------------------------------*/ /* evaluate inverse CDF at u. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* u ... argument for inverse CDF (0<=u<=1, no validation!) */ /* */ /* return: */ /* double (inverse CDF) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { double x; /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); if ( gen->method != UNUR_METH_CSTD ) { _unur_error(gen->genid,UNUR_ERR_GEN_INVALID,""); return UNUR_INFINITY; } COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); if (!DISTR.invcdf) { /* no inverse CDF available */ _unur_error(gen->genid,UNUR_ERR_NO_QUANTILE,"inversion CDF required"); return UNUR_INFINITY; } if ( ! (u>0. && u<1.)) { if ( ! (u>=0. && u<=1.)) { _unur_warning(gen->genid,UNUR_ERR_DOMAIN,"U not in [0,1]"); } if (u<=0.) return DISTR.trunc[0]; if (u>=1.) return DISTR.trunc[1]; return u; /* = NaN */ } /* rescale given u */ u = GEN->Umin + u * (GEN->Umax - GEN->Umin); /* compute inverse CDF */ x = DISTR.invcdf(u,gen->distr); /* validate range */ if (xDISTR.trunc[1]) x = DISTR.trunc[1]; return x; } /* end of unur_cstd_eval_invcdf() */ /*****************************************************************************/ /** Auxilliary Routines **/ /*****************************************************************************/ int _unur_cstd_inversion_init( struct unur_par *par, struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* initialize special generator for inversion method */ /* when inverse CDF is available for the distribution. */ /* if gen == NULL then only check existance of variant. */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* one of par and gen must not be the NULL pointer */ switch ((par) ? par->variant : gen->variant) { case 0: /* DEFAULT */ case UNUR_STDGEN_INVERSION: /* inversion method */ if (gen) { if (DISTR.invcdf) { GEN->is_inversion = TRUE; _unur_cstd_set_sampling_routine(gen,_unur_cstd_sample_inv); return UNUR_SUCCESS; } } else { if ((par->distr->data.cont).invcdf) { return UNUR_SUCCESS; } } /* FALLTHROUGH */ default: /* no such generator */ if (gen) _unur_warning(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); return UNUR_FAILURE; } } /* end of _unur_cstd_inversion_init() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Debugging utilities **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ void _unur_cstd_debug_init( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write info about generator into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; int i; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_CSTD_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: type = continuous univariate random variates\n",gen->genid); fprintf(LOG,"%s: method = generator for standard distribution\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); /* distribution */ _unur_distr_cont_debug( gen->distr, gen->genid ); /* sampling routine */ fprintf(LOG,"%s: sampling routine = ",gen->genid); if (GEN->sample_routine_name) fprintf(LOG,"%s()",GEN->sample_routine_name); else fprintf(LOG,"(Unknown)"); if (GEN->is_inversion) fprintf(LOG," (Inversion)"); fprintf(LOG,"\n%s:\n",gen->genid); /* table of precomputed constants for special generators */ if (gen->debug & CSTD_DEBUG_GEN) { fprintf(LOG,"%s: precomputed constants for routine: ",gen->genid); if (GEN->gen_param) { fprintf(LOG,"%d\n",GEN->n_gen_param); for (i=0; i < GEN->n_gen_param; i++) fprintf(LOG,"%s:\t[%d] = %g\n",gen->genid,i,GEN->gen_param[i]); } else { fprintf(LOG,"none\n"); } fprintf(LOG,"%s:\n",gen->genid); } /* truncated domain ? */ if (!(gen->distr->set & UNUR_DISTR_SET_STDDOMAIN)) { fprintf(LOG,"%s: domain has been changed. U in (%g,%g)\n",gen->genid,GEN->Umin,GEN->Umax); fprintf(LOG,"%s:\n",gen->genid); } fflush(LOG); } /* end of _unur_cstd_debug_init() */ /*---------------------------------------------------------------------------*/ void _unur_cstd_debug_chg_pdfparams( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* print new (changed) parameters of distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; int i; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_CSTD_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s: parameters of distribution changed:\n",gen->genid); for( i=0; igenid,i,DISTR.params[i]); if (gen->distr->set & UNUR_DISTR_SET_TRUNCATED) fprintf(LOG,"%s:\tU in (%g,%g)\n",gen->genid,GEN->Umin,GEN->Umax); } /* end of _unur_cstd_debug_chg_pdfparams() */ /*---------------------------------------------------------------------------*/ void _unur_cstd_debug_chg_truncated( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* print new (changed) domain of (truncated) distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_CSTD_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s: domain of truncated distribution changed:\n",gen->genid); fprintf(LOG,"%s:\tdomain = (%g, %g)\n",gen->genid, DISTR.trunc[0], DISTR.trunc[1]); fprintf(LOG,"%s:\tU in (%g,%g)\n",gen->genid,GEN->Umin,GEN->Umax); } /* end of _unur_cstd_debug_chg_truncated() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_INFO /*---------------------------------------------------------------------------*/ void _unur_cstd_info( struct unur_gen *gen, int help ) /*----------------------------------------------------------------------*/ /* create character string that contains information about the */ /* given generator object. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* help ... whether to print additional comments */ /*----------------------------------------------------------------------*/ { struct unur_string *info = gen->infostr; int samplesize = 10000; int i; /* generator ID */ _unur_string_append(info,"generator ID: %s\n\n", gen->genid); /* distribution */ _unur_string_append(info,"distribution:\n"); _unur_distr_info_typename(gen); _unur_string_append(info," domain = (%g, %g)\n", DISTR.domain[0],DISTR.domain[1]); _unur_string_append(info,"\n"); /* if (help) { */ /* _unur_string_append(info,"\n"); */ /* } */ /* method */ _unur_string_append(info,"method: CSTD (special generator for Continuous STandarD distribution)\n"); _unur_string_append(info," variant = %d %s\n", gen->variant, (GEN->is_inversion)?"[implements inversion method]" : ""); _unur_string_append(info,"\n"); /* performance */ _unur_string_append(info,"performance characteristics:\n"); _unur_string_append(info," E [#urn] = %.2f [approx.]\n", unur_test_count_urn(gen,samplesize,0,NULL)/((double)samplesize)); _unur_string_append(info,"\n"); /* parameters */ if (help) { _unur_string_append(info,"parameters:\n"); _unur_string_append(info," variant = %d %s\n", gen->variant, (gen->set & CSTD_SET_VARIANT) ? "" : "[default]"); _unur_string_append(info,"\n"); } /* tables */ if (help) { _unur_string_append(info,"table of precomputed constants: "); if (GEN->gen_param) { _unur_string_append(info,"%d\n",GEN->n_gen_param); for (i=0; i < GEN->n_gen_param; i++) _unur_string_append(info," [%d] = %g\n",i,GEN->gen_param[i]); } else { _unur_string_append(info,"none\n"); } _unur_string_append(info,"\n"); } /* Hints */ /* if (help) { */ /* _unur_string_append(info,"\n"); */ /* } */ } /* end of _unur_cstd_info() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_INFO */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/srou_struct.h0000644001357500135600000000767414420304141015043 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: srou_struct.h * * * * PURPOSE: * * declares structures for method SROU * * (Simple universal generator, Ratio-Of-Uniforms method) * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Information for constructing the generator */ struct unur_srou_par { double r; /* parameter for power transformation */ double Fmode; /* cdf at mode */ double um; /* square root of pdf at mode */ }; /*---------------------------------------------------------------------------*/ /* The generator object */ struct unur_srou_gen { double um; /* height of rectangle: square root of f(mode) */ double vl, vr; /* left and right boundary of rectangle */ double xl, xr; /* ratios vl/um and vr/um */ double Fmode; /* cdf at mode */ /* parameters for generalized SROU */ double r; /* parameter for power transformation */ double p; /* construction point for bounding curve */ double a, b; /* parameters for bounding curve */ double log_ab; /* parameter for bounding curve */ }; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/tabl.c0000644001357500135600000004367714420445767013413 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: tabl.h * * * * TYPE: continuous univariate random variate * * METHOD: rejection form piecewise constant hat * * (Ahren's table method) * * * * DESCRIPTION: * * Given PDF of a unimodal distribution * * produce random variate X with its density * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * ***************************************************************************** * * * REFERENCES: * * [1] Ahrens J. H. (1993): Sampling from general distributions by * * suboptimal division of domains, * * Grazer Math. Berichte 319, 30pp. * * * * [2] Ahrens J. H. (1995): An one-table method for sampling from * * continuous and discrete distributions, * * Computing 54(2), pp. 127-146 * * * * [3] Hoermann, W., Leydold J., and Derflinger, G. (2004): * * Automatic non-uniform random variate generation, Springer, Berlin. * * Section 2.4, Algorithm 2.9 (RoU), p.35 * * * * SEE ALSO: * * [4] Gilks, W. R. and Wild, P. (1992): * * Adaptive rejection sampling for Gibbs sampling, * * Applied Statistics 41, pp. 337-348 * * * * [5] Zaman, A. (1996), Generation of Random Numbers from an Arbitrary * * Unimodal Density by Cutting Corners, unpublished manuskript * * available at http://chenab.lums.edu.pk/~arifz/ * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include "unur_methods_source.h" #include "x_gen_source.h" #include "tabl.h" #include "tabl_struct.h" /*---------------------------------------------------------------------------*/ /* Constants */ #define TABL_DEFAULT_COMPUTATION_LIMIT 1.e20 /* The domain has to be finite for method TABL. Thus the domain has to be truncated where the regions (tails) that are chopped off must not of "computational relevance". By default the points for chopping of the tails are +/- this figure. */ #define TABL_N_RETRY_DARS 5 #define TABL_N_RUN_ARS 10 /* Sometimes DARS fails then we need random splitting points for the intervals, i.e. we have to run ARS a few times an continue (retry) with DARS. These figures give the number of retries and the number of sampling using ARS, respectively. */ /*---------------------------------------------------------------------------*/ /* Variants */ /* how to sample from genertor object */ #define TABL_VARMASK_VARIANT 0x000fu /* indicates which variant */ #define TABL_VARIANT_IA 0x0001u /* use immediate acceptance */ #define TABL_VARIANT_FAST 0x0002u /* use single array for data (not implemented) */ /* indicate how to split interval */ #define TABL_VARMASK_SPLIT 0x00f0u /* split at computation convergence of hat */ #define TABL_VARFLAG_SPLIT_POINT 0x0010u /* sampled point none slowest */ #define TABL_VARFLAG_SPLIT_MEAN 0x0020u /* mean point slower better */ #define TABL_VARFLAG_SPLIT_ARC 0x0040u /* "arcmean" very slow very good for almost unbounded domain */ /* indicate if starting intervals have to be split */ #define TABL_VARFLAG_USEEAR 0x0100u /* use equal area rule (SPLIT A in [1]) */ #define TABL_VARFLAG_USEDARS 0x0200u /* use main subdivisions (SPLIT B in [1]) (= derandomized ARS) */ #define TABL_VARFLAG_PEDANTIC 0x0400u /* whether pedantic checking is used */ #define TABL_VARFLAG_VERIFY 0x0800u /* flag for verifying mode */ /*---------------------------------------------------------------------------*/ /* Debugging flags */ /* bit 01 ... pameters and structure of generator (do not use here) */ /* bits 02-12 ... setup */ /* bits 13-24 ... adaptive steps */ /* bits 25-32 ... trace sampling */ #define TABL_DEBUG_IV 0x00000100u /* show intervals */ #define TABL_DEBUG_IV_START 0x00000200u /* show starting intervals */ #define TABL_DEBUG_EAR 0x00000400u /* show intervals after EAR */ #define TABL_DEBUG_DARS 0x00000800u /* indicate DARS in LOG file */ /*---------------------------------------------------------------------------*/ /* Flags for logging set calls */ #define TABL_SET_GUIDEFACTOR 0x0001u #define TABL_SET_SLOPES 0x0004u #define TABL_SET_AREAFRACTION 0x0008u #define TABL_SET_MAX_IVS 0x0010u #define TABL_SET_MAX_SQHRATIO 0x0020u #define TABL_SET_N_STP 0x0040u #define TABL_SET_STP 0x0080u #define TABL_SET_BOUNDARY 0x0100u #define TABL_SET_USE_EAR 0x0200u #define TABL_SET_USE_DARS 0x0400u #define TABL_SET_DARS_FACTOR 0x0800u /*---------------------------------------------------------------------------*/ #define GENTYPE "TABL" /* type of generator */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_tabl_init( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* Initialize new generator. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_tabl_create( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* create new (almost empty) generator object. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_tabl_clone( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* copy (clone) generator object. */ /*---------------------------------------------------------------------------*/ static void _unur_tabl_free( struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* destroy generator object. */ /*---------------------------------------------------------------------------*/ static double _unur_tabl_rh_sample( struct unur_gen *gen ); static double _unur_tabl_rh_sample_check( struct unur_gen *gen ); static double _unur_tabl_ia_sample( struct unur_gen *gen ); static double _unur_tabl_ia_sample_check( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* sample from generator */ /*---------------------------------------------------------------------------*/ static int _unur_tabl_get_intervals_from_slopes( struct unur_par *par, struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* compute starting intervals from slopes */ /*---------------------------------------------------------------------------*/ static int _unur_tabl_get_intervals_from_cpoints( struct unur_par *par, struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* compute starting intervals from given cpoints */ /*---------------------------------------------------------------------------*/ static int _unur_tabl_compute_intervals( struct unur_par *par, struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* compute all intervals (by splitting starting intervals/slopes) */ /*---------------------------------------------------------------------------*/ static struct unur_tabl_interval * _unur_tabl_run_equalarearule( struct unur_par *par, struct unur_gen *gen, struct unur_tabl_interval *iv_slope ); /*---------------------------------------------------------------------------*/ /* split starting intervals according to [1] */ /* SPLIT A (equal areas rule) */ /*---------------------------------------------------------------------------*/ static int _unur_tabl_run_dars( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* run derandomized adaptive rejection sampling. */ /* (split starting intervals according to [1] SPLIT B, */ /* but instead of the iteration in [1] use "arcmean". */ /*---------------------------------------------------------------------------*/ static int _unur_tabl_split_interval( struct unur_gen *gen, struct unur_tabl_interval *iv, double x, double fx, unsigned split_mode ); /*---------------------------------------------------------------------------*/ /* split interval (replace old one by two new ones in same place) */ /*---------------------------------------------------------------------------*/ static int _unur_tabl_improve_hat( struct unur_gen *gen, struct unur_tabl_interval *iv, double x, double fx ); /*---------------------------------------------------------------------------*/ /* improve hat function by splitting interval */ /*---------------------------------------------------------------------------*/ static int _unur_tabl_make_guide_table( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* make a guide table for indexed search. */ /*---------------------------------------------------------------------------*/ static double _unur_tabl_eval_cdfhat( struct unur_gen *gen, double x ); /*---------------------------------------------------------------------------*/ /* evaluate CDF of hat at x. */ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ /* the following functions print debugging information on output stream, */ /* i.e., into the LOG file if not specified otherwise. */ /*---------------------------------------------------------------------------*/ static void _unur_tabl_debug_init_start( const struct unur_par *par, const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print after (almost empty generator) object has been created. */ /*---------------------------------------------------------------------------*/ static void _unur_tabl_debug_init_finished( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print after generator has been initialized has completed. */ /*---------------------------------------------------------------------------*/ static void _unur_tabl_debug_dars_start( const struct unur_par *par, const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print header before runniung derandomized adaptive rejection sampling. */ /*---------------------------------------------------------------------------*/ static void _unur_tabl_debug_free( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print before generater is destroyed. */ /*---------------------------------------------------------------------------*/ static void _unur_tabl_debug_intervals( const struct unur_gen *gen, const char *header, int print_areas ); /*---------------------------------------------------------------------------*/ /* print data for intervals. */ /*---------------------------------------------------------------------------*/ #endif #ifdef UNUR_ENABLE_INFO static void _unur_tabl_info( struct unur_gen *gen, int help ); /*---------------------------------------------------------------------------*/ /* create info string. */ /*---------------------------------------------------------------------------*/ #endif /*---------------------------------------------------------------------------*/ /* abbreviations */ #define DISTR_IN distr->data.cont /* data for distribution object */ #define PAR ((struct unur_tabl_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_tabl_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.cont /* data for distribution in generator object */ #define BD_LEFT domain[0] /* left boundary of domain of distribution */ #define BD_RIGHT domain[1] /* right boundary of domain of distribution */ #define SAMPLE gen->sample.cont /* pointer to sampling routine */ #define PDF(x) _unur_cont_PDF((x),(gen->distr)) /* call to PDF */ /*---------------------------------------------------------------------------*/ static UNUR_SAMPLING_ROUTINE_CONT * _unur_tabl_getSAMPLE( struct unur_gen *gen ) { if (gen->variant & TABL_VARIANT_IA) /* immediate acceptance */ return (gen->variant & TABL_VARFLAG_VERIFY) ? _unur_tabl_ia_sample_check : _unur_tabl_ia_sample; else /* "classical" acceptance/rejection method */ return (gen->variant & TABL_VARFLAG_VERIFY) ? _unur_tabl_rh_sample_check : _unur_tabl_rh_sample; } /* end of _unur_tabl_getSAMPLE() */ /*---------------------------------------------------------------------------*/ /* since there is only file scope or program code, we abuse the */ /* #include directive. */ /** Public: User Interface (API) **/ #include "tabl_newset.ch" /** Private **/ #include "tabl_init.ch" #include "tabl_sample.ch" #include "tabl_debug.ch" #include "tabl_info.ch" /* #include "tabl_fast.ch" ... not implemented (only experimental code) */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/tdr_struct.h0000644001357500135600000001614214420445767014656 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: tdr_struct.h * * * * PURPOSE: * * declares structures for method TDR * * (Transformed Density Rejection) * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Information for constructing the generator */ struct unur_tdr_par { double guide_factor; /* relative size of guide table */ const double *starting_cpoints; /* pointer to array of starting points */ int n_starting_cpoints; /* number of construction points at start */ const double *percentiles; /* percentiles of hat for c. points of new hat */ int n_percentiles; /* number of percentiles */ int retry_ncpoints; /* number of cpoints for second trial of reinit */ int max_ivs; /* maximum number of intervals */ double max_ratio; /* bound for ratio r_n = Atotal / Asqueeze */ double bound_for_adding; /* lower bound for relative area */ double c_T; /* parameter c for transformation T_c */ double darsfactor; /* factor for derandomized ARS */ int darsrule; /* rule for finding splitting points in DARS */ }; /*---------------------------------------------------------------------------*/ /* store data for segments */ struct unur_tdr_interval { double x; /* (left) construction point (cp) */ double fx; /* value of PDF at cp */ double Tfx; /* value of transformed PDF at cp */ double dTfx; /* derivative of transformed PDF at cp */ double sq; /* slope of transformed squeeze in interval */ double ip; /* intersection point between two tangents */ double fip; /* value of PDF at ip (for PS and IA only) */ double Acum; /* cumulated area of intervals */ double Ahat; /* area below hat */ double Ahatr; /* area below hat on right side */ double Asqueeze; /* area squeeze */ struct unur_tdr_interval *next; /* pointer to next interval in list */ struct unur_tdr_interval *prev; /* pointer to previous interval in list (for PS and IA only) */ #ifdef UNUR_COOKIES unsigned cookie; /* magic cookie */ #endif }; /*---------------------------------------------------------------------------*/ /* The generator object */ struct unur_tdr_gen { double Atotal; /* area below hat */ double Asqueeze; /* area below squeeze */ double c_T; /* parameter c for transformation T_c */ double Umin, Umax; /* bounds for iid random variable in respect to the given (truncated) domain of the distr.*/ struct unur_tdr_interval *iv; /* pointer to linked list of intervals */ int n_ivs; /* number of intervals */ int max_ivs; /* maximum number of intervals */ double max_ratio; /* bound for ratio r_n = Atotal / Asqueeze */ double bound_for_adding; /* lower bound for relative area */ struct unur_tdr_interval **guide; /* pointer to guide table */ int guide_size; /* size of guide table */ double guide_factor; /* relative size of guide table */ double center; /* approximate location of mode */ double *starting_cpoints; /* pointer to array of starting points */ int n_starting_cpoints; /* number of construction points at start */ double *percentiles; /* percentiles of hat for c. points of new hat */ int n_percentiles; /* number of percentiles */ int retry_ncpoints; /* number of cpoints for second trial of reinit */ double darsfactor; /* factor for derandomized ARS */ int darsrule; /* rule for finding splitting points in DARS */ #ifdef UNUR_ENABLE_INFO int max_ivs_info; /* maximum number of intervals (as given) */ #endif }; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/dari_struct.h0000644001357500135600000001164414420304141014762 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: dari_struct.h * * * * PURPOSE: * * declares structures for method DARI * * ((Discrete) Alias-Urn) * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Information for constructing the generator */ struct unur_dari_par { int squeeze; /* should the squeeze be used 0.. no squeeze, 1..squeeze */ int size; /* size of table for speeding up generation */ double c_factor; /* constant for choosing the design points */ }; /*---------------------------------------------------------------------------*/ /* The generator object */ struct unur_dari_gen { double vt; /* total volume below hat */ double vc; /* volume below center part */ double vcr; /* volume center and right together */ double xsq[2]; /* value necesary for the squeeze computation */ double y[2]; /* value of the transformed density in points of contact */ double ys[2]; /* the slope of the transformed hat */ double ac[2]; /* left and right starting point of the uniform hat in the center */ double pm; /* mode probability */ double Hat[2]; /* point where the hat starts for the left and the right tail */ double c_factor; /* constant for choosing the design points */ int m; /* mode */ int x[2]; /* points of contact left and right of the mode */ int s[2]; /* first and last integer of the center part */ int n[2]; /* contains the first and the last i for which values are stored in table */ int size; /* size of the auxiliary tables */ int squeeze; /* use squeeze yes/no */ double *hp; /* pointer to double array of length size */ char *hb; /* pointer to boolean array of length size */ }; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/hist.h0000644001357500135600000000766714420445767013444 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: hist.h * * * * PURPOSE: * * function prototypes for method HIST * * (HISTogram of empirical distribution) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /* =METHOD HIST HISTogramm of empirical distribution =UP Methods_for_CEMP =REQUIRED histogram =SPEED Set-up: moderate, Sampling: fast =REINIT not implemented =DESCRIPTION Method HIST generates random variates from an empirical distribution that is given as histogram. Sampling is done using the inversion method. If observed (raw) data are provided we recommend method EMPK (@pxref{EMPK,,EMPirical distribution with Kernel smoothing}) instead of compting a histogram as this reduces information. =HOWTOUSE Method HIST uses empirical distributions that are given as a histgram. There are no optional parameters. =END */ /*---------------------------------------------------------------------------*/ /* Routines for user interface */ /* =ROUTINES */ UNUR_PAR *unur_hist_new( const UNUR_DISTR *distribution ); /* Get default parameters for generator. */ /*...........................................................................*/ /* =END */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/tdr_ps_init.ch0000644001357500135600000007345714420445767015156 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: tdr_ps_init.c * * * * TYPE: continuous univariate random variate * * METHOD: transformed density rejection * * * * DESCRIPTION: * * Initializing routines for variant with proportional squeezes. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ int _unur_tdr_ps_starting_intervals( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* compute intervals for starting points */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { struct unur_tdr_interval *iv, *iv_new, *iv_tmp; double x,fx; /* construction point, value of PDF at x */ double lb, flb; /* left boundary point of domain of PDF */ /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_ERR_COOKIE); CHECK_NULL(GEN->iv,UNUR_ERR_NULL); COOKIE_CHECK(GEN->iv,CK_TDR_IV,UNUR_ERR_COOKIE); /* first interval in list */ iv = GEN->iv; /* the left boundary of the domain: iv->x in the first interval is always the left boundary of the domain of the PDF */ lb = iv->x; flb = iv->fx; /* there is no use for a point iv->x that is not used as a construction point in variants PS and IA. (In variant GW it is used to store the left boundary of the domain of the PDF) Thus we remove it from the list. At such points the slope of the tangents to the transformed density is set to UNUR_INFINITY. */ if (_unur_FP_is_infinity(iv->dTfx)) { GEN->iv = iv->next; GEN->iv->prev = NULL; free (iv); --(GEN->n_ivs); iv = GEN->iv; } /* set left boundary: it is stored in iv->ip in the first interval */ iv->ip = lb; iv->fip = flb; /* compute paramters for all intervals */ while (iv) { if (iv->next == NULL) { /* the last interval in the list*/ /* analogously to variant GW we want to have a last virtual (stopping) interval, that simply stores the right boundary point and guaranties that the loop in indexed search stops on an existing interval. However in the case where iv->x is used as construction point we have to add such an interval. */ if (!_unur_FP_is_infinity(iv->dTfx)) { /* get interval */ iv->next = iv_new = _unur_tdr_interval_new( gen, iv->x, 0., FALSE ); if (iv_new == NULL) return UNUR_ERR_GEN_DATA; /* PDF(x) < 0 or overflow !! */ /* link into list */ iv_new->prev = iv; /* copy right boundary of domain */ iv_new->ip = iv->x; iv_new->fip = iv->fx; /* make shure that we will never use this interval for sampling. */ iv->next->Asqueeze = iv->next->Ahat = iv->next->Ahatr = 0.; iv->Acum = UNUR_INFINITY; iv->next-> sq = 0.; /* we even have to to some additional work */ } else /* nothing to do any more */ break; } /* compute parameters for interval */ switch (_unur_tdr_ps_interval_parameter(gen, iv)) { case UNUR_SUCCESS: /* computation of parameters for interval successful */ /* skip to next interval */ iv = iv->next; continue; case UNUR_ERR_INF: /* interval unbounded */ /* split interval */ break; case UNUR_ERR_SILENT: /* construction points too close */ /* we have to remove this last interval from list */ /* (the last construction point in the list is a boundary point. thus we might change the domain of the distribution. however, we only cut off a piece that is beyond the precesion of the floating point arithmetic.) */ iv_tmp = iv->next; iv->next = iv->next->next; free(iv_tmp); --(GEN->n_ivs); if (iv->next==NULL) { /* last (virtuel) interval in list. make shure that we will never use this segment */ iv->Asqueeze = iv->Ahat = iv->Ahatr = iv->sq = 0.; iv->Acum = UNUR_INFINITY; } else /* we need a pointer to the previous entry in the list */ iv->next->prev = iv; continue; default: /* PDF not T-concave */ return UNUR_ERR_GEN_CONDITION; } /* check if we had to used too many intervals */ if (GEN->n_ivs >= GEN->max_ivs) { /* we do not want to create too many intervals */ _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"cannot create bounded hat!"); return UNUR_ERR_GEN_CONDITION; } /* area below hat infinite --> insert new construction point. We have to find out on which side of the construction point the area of the hat is unbounded. */ if (iv->Ahatr >= UNUR_INFINITY) { /* right hand side */ /* iv should never be the last (virtual) interval */ CHECK_NULL(iv->next,0); /* use mean point between the construction point and the right boundary of the interval. (The right boundary point might be a better choice but cannot be used in every case.) */ x = _unur_arcmean(iv->x,iv->next->ip); fx = PDF(x); iv_new = _unur_tdr_interval_new( gen, x, fx, FALSE ); if (iv_new == NULL) return UNUR_ERR_GEN_DATA; /* PDF(x) < 0 or overflow !! */ /* if fx is 0, then we can cut off the tail of the distribution (since it must be T-concave) */ if (fx <= 0.) { if (iv->next->fx > 0.) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF not T-concave!"); free(iv_new); return UNUR_ERR_GEN_CONDITION; } /* cut off right tail */ free(iv->next); --(GEN->n_ivs); iv->next = iv_new; iv_new->prev = iv; } else { /* insert the new interval into the linked list after the old one. */ iv_new->prev = iv; iv_new->next = iv->next; iv->next->prev = iv_new; iv->next = iv_new; } /* the old interval has to be recomputed. */ } else { /* left hand side */ x = _unur_arcmean(iv->ip,iv->x); fx = PDF(x); iv_new = _unur_tdr_interval_new( gen, x, fx, FALSE ); if (iv_new == NULL) return UNUR_ERR_GEN_DATA; /* PDF(x) < 0 or overflow !! */ /* if fx is 0, then we can cut off the tail of the distribution (since it must be T-concave) */ if (fx <= 0.) { if (iv->fx > 0.) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF not T-concave!"); free(iv_new); return UNUR_ERR_GEN_CONDITION; } /* cut off left tail */ iv_new->next = iv->next; iv_new->prev = iv->prev; iv_new->ip = iv->ip; iv_new->fip = iv->fip; --(GEN->n_ivs); GEN->iv = iv_new; /* continue with this new interval */ free(iv); iv = iv_new; } else { if (iv->prev) { /* insert new interval in just before the old unbounded one */ iv_tmp = iv->prev; iv_new->prev = iv->prev; iv_new->next = iv; iv->prev->next = iv_new; iv->prev = iv_new; /* make sure that _unur_arcmean(iv->ip,iv->x) is never out of range */ iv_new->ip = iv->ip; /* continue with the interval before the old one (neccessary since it will change too). */ iv = iv_tmp; } else { /* iv->prev == NULL */ /* insert new interval as first entry in list */ iv_new->ip = iv->ip; iv_new->fip = iv->fip; iv_new->prev = NULL; iv_new->next = iv; iv->prev = iv_new; GEN->iv = iv_new; /* continue with this new interval */ iv = iv_new; } } } } /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_tdr_ps_starting_intervals() */ /*---------------------------------------------------------------------------*/ int _unur_tdr_ps_dars( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* run derandomized adaptive rejection sampling (Gilks&Wild) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { struct unur_tdr_interval *iv, *iv_next; double Adiff; /* area between hat and squeeze */ double Alimit; /* threshhold value for splitting interval */ double squeeze_gw; /* slope of squeeze in variant GW */ double Asqueeze_gw; /* area below squeeze in variant GW */ double Ahat_gw; /* area below hat in variant GW */ double x0, x1; /* boundary of interval */ double xsp, fxsp; /* splitting point in interval */ double xAhatl, xAhatr, xAsqueeze_gw; int rule; /* id for splitting rule that has been applied */ int n_splitted; /* count splitted intervals */ int splitted; /* result of splitting routine */ /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_ERR_COOKIE); /* split intervals */ while ( (GEN->max_ratio * GEN->Atotal > GEN->Asqueeze) && (GEN->n_ivs < GEN->max_ivs) ) { /* compute threshhold value. every interval with area between hat and squeeze greater than this value will be splitted. */ if (GEN->n_ivs > 1) Alimit = GEN->darsfactor * ( (GEN->Atotal - GEN->Asqueeze) / GEN->n_ivs ); else /* we split every interval if there are only one interval */ Alimit = 0.; /* reset counter for splitted intervals */ n_splitted = 0; /* for all intervals do ... */ for (iv = GEN->iv; iv != NULL; iv = iv->next ) { COOKIE_CHECK(iv,CK_TDR_IV,UNUR_ERR_COOKIE); /* do not exceed the maximum number of intervals */ if (GEN->n_ivs >= GEN->max_ivs) break; /* boundary of interval: in opposition to GW the construction point is in the middle of an interval. The boundary points are the intersection points of the tangents. Notice that it does not make sense to have a splitting point near the construction point in the middle of the interval. Thus we use the same intervals as in GW, i.e., the intervals between the construction points. However, now we have to compute some data and the first and last interval has to be treated differently. */ if (iv==GEN->iv) { /* the first interval */ x0 = iv->ip; /* left boundary of interval */ x1 = iv->x; /* right boundary of interval */ Adiff = iv->Ahat - iv->Ahatr; /* area below hat */ Adiff *= 1. - iv->sq; /* area between hat and squeeze */ } else { /* all the other intervals: we use the intervals between the preceeding construction point and the construction point in the given interval for finding a splitting point. */ x0 = iv->prev->x; /* left boundary of interval */ x1 = iv->x; /* right boundary of interval */ /* area between hat and squeeze. (notice: we habe two parts in two intervals.) */ Adiff = ( (1. - iv->prev->sq) * iv->prev->Ahatr + (1. - iv->sq) * (iv->Ahat - iv->Ahatr) ); } /* we skip over all intervals where the area between hat and squeeze does not exceed the threshhold value. */ if (Adiff <= Alimit) continue; /* goto next interval */ /* get splitting point */ for (rule = GEN->darsrule; rule <= 3; rule++) { switch (rule) { case 1: /* rule 1: expected value */ if ( _unur_FP_is_minus_infinity(x0) || _unur_FP_is_infinity(x1) || _unur_FP_approx(x0,x1) ) /* we do not use the expected value in case of unbounded intervals */ continue; /* try next rule */ /* l.h.s. hat */ xAhatl = ( (iv->prev == NULL) ? 0. : _unur_tdr_interval_xxarea( gen, iv->prev, iv->prev->dTfx, iv->ip) ); /* r.h.s. hat */ xAhatr = _unur_tdr_interval_xxarea( gen, iv, iv->dTfx, iv->ip); /* area below hat */ Ahat_gw = ( ((iv->prev == NULL) ? 0. : iv->prev->Ahatr) + (iv->Ahat - iv->Ahatr) ); /* squeeze */ if (iv->Asqueeze > 0. && iv->prev != NULL) { /* slope of transformed squeeze for variant GW */ squeeze_gw = (iv->Tfx - iv->prev->Tfx) / (iv->x - iv->prev->x); /* always integrate from point with greater value of transformed density to the other point */ xAsqueeze_gw = (iv->Tfx > iv->prev->Tfx) ? _unur_tdr_interval_xxarea( gen, iv, squeeze_gw, iv->prev->x) : _unur_tdr_interval_xxarea( gen, iv->prev, squeeze_gw, iv->x); Asqueeze_gw = (iv->Tfx > iv->prev->Tfx) ? _unur_tdr_interval_area( gen, iv, squeeze_gw, iv->prev->x) : _unur_tdr_interval_area( gen, iv->prev, squeeze_gw, iv->x); /* check for fatal numerical errors */ if (!_unur_isfinite(Asqueeze_gw)) Asqueeze_gw = 0.; } else { /* there is no squeeze */ xAsqueeze_gw = 0.; Asqueeze_gw = 0.; } /* check results */ if (! (_unur_isfinite(xAhatl) && _unur_isfinite(xAhatr) && _unur_isfinite(xAsqueeze_gw)) || _unur_FP_equal(Ahat_gw,Asqueeze_gw) ) continue; /* try next rule */ /* compute expected value */ xsp = (xAhatl+xAhatr-xAsqueeze_gw) / (Ahat_gw - Asqueeze_gw); break; case 2: /* rule 2: arcmean */ xsp = _unur_arcmean(x0,x1); break; case 3: /* rule 3: mean */ if (_unur_FP_is_minus_infinity(x0) || _unur_FP_is_infinity(x1)) /* no arithmetic mean for unbounded intervals */ continue; /* try next rule */ xsp = 0.5 * (x0 + x1); break; default: /* this should not happen */ continue; } /* value of PDF at splitting point */ fxsp = PDF(xsp); /* store pointer to next interval */ iv_next = iv->next; /* now split interval at given point. we have to take care that xsp might be either in interval iv or in its preceeding interval, depending whether xsp is less than iv->ip or not. */ splitted = _unur_tdr_ps_interval_split(gen, ((xspip)?iv->prev:iv), xsp, fxsp); if (splitted==UNUR_SUCCESS || splitted==UNUR_ERR_INF) { /* splitting successful */ if (splitted==UNUR_SUCCESS) ++n_splitted; /* otherwise the area below the hat was not bounded */ /* now depending on the location of xps in the interval iv, iv points to the left of the two new intervals, or to the right of the two new intervals. For the first case we have to move the pointer to the new right interval. Then iv will be moved to the next old interval in the list by the for loop. We can distinguish between these two cases by looking at the iv->next pointer and compare it the pointer in the old unsplitted interval. */ if (iv->next != iv_next) iv = iv->next; /* no more splitting points in this interval */ break; } else if (splitted!=UNUR_ERR_SILENT) { /* some serious error occurred */ /* condition for PDF is violated! */ _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,""); return UNUR_ERR_GEN_CONDITION; } /* else: could not split construction points: too close (?) */ } } if (n_splitted == 0) { /* we are not successful in splitting any inteval. abort to avoid endless loop */ _unur_warning(gen->genid,UNUR_ERR_GENERIC,"DARS aborted: no intervals could be splitted."); break; } } /* ratio between squeeze and hat o.k. ? */ if ( GEN->max_ratio * GEN->Atotal > GEN->Asqueeze ) { if ( GEN->n_ivs >= GEN->max_ivs ) _unur_warning(gen->genid,UNUR_ERR_GENERIC,"DARS aborted: maximum number of intervals exceeded."); _unur_warning(gen->genid,UNUR_ERR_GENERIC,"hat/squeeze ratio too small."); } else { /* no more construction points */ GEN->max_ivs = GEN->n_ivs; } /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_tdr_ps_dars() */ /*---------------------------------------------------------------------------*/ int _unur_tdr_ps_interval_parameter( struct unur_gen *gen, struct unur_tdr_interval *iv ) /*----------------------------------------------------------------------*/ /* compute intersection point of tangents and */ /* the area below the hat (proportional squeezes) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* iv ... pointer to interval */ /* */ /* return: */ /* UNUR_SUCCESS ... if successful */ /* UNUR_ERR_SILENT ... do not add this construction point */ /* UNUR_ERR_INF ... area = UNUR_INFINITY */ /* others ... error (PDF not T-concave) */ /*----------------------------------------------------------------------*/ { double Ahatl; /* area below hat at left side of intersection point */ double hxl, hxr; /* value of hat at left and right point of interval */ double sq; /* ration PDF(x) / hat(x) */ /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_ERR_COOKIE); CHECK_NULL(iv,UNUR_ERR_NULL); COOKIE_CHECK(iv,CK_TDR_IV,UNUR_ERR_COOKIE); /* get intersection point of tangents. it is used as boundaries of intervals. it is stored together with the right hand (i.e. next) construction point. */ if (_unur_tdr_tangent_intersection_point(gen,iv,&(iv->next->ip))!=UNUR_SUCCESS) return UNUR_ERR_GEN_CONDITION; /* value of PDF at intersection point */ iv->next->fip = _unur_FP_is_infinity(iv->next->ip) ? 0. : PDF(iv->next->ip); /* volume below hat */ Ahatl = _unur_tdr_interval_area( gen, iv, iv->dTfx, iv->ip); iv->Ahatr = _unur_tdr_interval_area( gen, iv, iv->dTfx, iv->next->ip); /* areas below head unbounded ? */ if (! (_unur_isfinite(Ahatl) && _unur_isfinite(iv->Ahatr)) ) return UNUR_ERR_INF; /* total area */ iv->Ahat = iv->Ahatr + Ahatl; /* compute squeeze: squeeze ration = min_{boundary points} PDF(x) / hat(x) */ /* left boundary point */ hxl = _unur_tdr_eval_intervalhat(gen,iv,iv->ip); if (_unur_FP_greater(iv->fip, hxl) ) { /* PDF(x) > hat(x); this should not happen */ if ( (iv->fip < 1.e-50) || _unur_FP_approx(iv->fip, hxl)) { /* hat(x) and PDF(x) are approximatly the same, or extremely small. assume round-off error */ _unur_warning(gen->genid,UNUR_ERR_GEN_CONDITION,"hat(x) might be < PDF(x)"); } else { /* we really have PDF(x) > hat(x); we do not assume a round-off error */ _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"hat(x) < PDF(x)"); return UNUR_ERR_GEN_CONDITION; } } iv->sq = (_unur_FP_is_infinity(hxl) || hxl <= 0.) ? 0. : iv->fip / hxl; /* right boundary point */ hxr = _unur_tdr_eval_intervalhat(gen,iv,iv->next->ip); if (_unur_FP_greater(iv->next->fip, hxr)) { /* PDF(x) > hat(x); this should not happen */ if ((iv->next->fip < 1.e-50) || _unur_FP_approx(iv->next->fip, hxr)) { /* hat(x) and PDF(x) are approximatly the same, or extremely small. assume round-off error */ _unur_warning(gen->genid,UNUR_ERR_GEN_CONDITION,"hat(x) might be < PDF(x)"); } else { /* we really have PDF(x) > hat(x); we do not assume a round-off error */ _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"hat(x) < PDF(x)"); return UNUR_ERR_GEN_CONDITION; } } sq = (_unur_FP_is_infinity(hxr) || hxr <= 0.) ? 0. : iv->next->fip / hxr; /* squeeze */ if (iv->sq > sq) iv->sq = sq; /* area below squeeze */ iv->Asqueeze = iv->Ahat * iv->sq; /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_tdr_ps_interval_parameter() */ /*---------------------------------------------------------------------------*/ int _unur_tdr_ps_interval_split( struct unur_gen *gen, struct unur_tdr_interval *iv, double x, double fx ) /*----------------------------------------------------------------------*/ /* split interval iv into two intervals at point x */ /* old interval -> left hand side */ /* new interval -> right hand side */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* iv ... pointer to interval */ /* x ... left point of new segment */ /* fx ... value of PDF at x */ /* */ /* return: */ /* UNUR_SUCCESS ... if successful */ /* UNUR_ERR_SILENT ... if no intervals are splitted */ /* others ... error */ /*----------------------------------------------------------------------*/ { struct unur_tdr_interval *oldl, *oldr; /* pointer to old intervals (left, right) */ struct unur_tdr_interval *iv_new; /* pointer to new interval */ struct unur_tdr_interval oldl_bak, oldr_bak; /* space for backing up data of interval */ int success, success_r; /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_ERR_COOKIE); CHECK_NULL(iv,UNUR_ERR_NULL); COOKIE_CHECK(iv,CK_TDR_IV,UNUR_ERR_COOKIE); /* we cannot split point when x is not finite (NaN or Infinity) */ if (!_unur_isfinite(x)) { _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"splitting point not finite (skipped)"); return UNUR_ERR_SILENT; } /* we only add a new construction point, if the relative area is large enough */ if ( (GEN->n_ivs * (iv->Ahat - iv->Asqueeze) / (GEN->Atotal - GEN->Asqueeze)) < GEN->bound_for_adding) return UNUR_ERR_SILENT; /* the splitting point must be inside the interval */ if (x < iv->ip || x > iv->next->ip) { _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"splitting point not in interval!"); return UNUR_ERR_SILENT; } /* check for data error */ if (fx < 0.) { _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"PDF(x) < 0.!"); return UNUR_ERR_GEN_DATA; } /* which side of construction point */ if (x < iv->x) { /* left hand side */ oldl = iv->prev; oldr = iv; } else { /* right hand side */ oldl = iv; oldr = iv->next; } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug & TDR_DEBUG_SPLIT) _unur_tdr_ps_debug_split_start( gen,oldl,oldr,x,fx ); #endif /* back up data */ if (oldl) memcpy(&oldl_bak, oldl, sizeof(struct unur_tdr_interval)); memcpy(&oldr_bak, oldr, sizeof(struct unur_tdr_interval)); /* check if the new interval is completely outside the support of PDF */ if (fx <= 0.) { /* one of the two boundary points must be 0, too! */ if (oldr->fip <= 0. && oldl==NULL) { /* chop off left part (it's out of support) */ oldr->ip = x; oldr->fip = 0.; } else if (oldr->fip <= 0. && oldr->next==NULL) { /* chop off right part (it's out of support) */ oldr->x = x; oldr->ip = x; oldr->fip = 0.; } else { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF not T-concave"); return UNUR_ERR_GEN_CONDITION; } /* we do not add a new interval */ iv_new = NULL; } else { /* we need a new interval */ iv_new = _unur_tdr_interval_new( gen, x, fx, FALSE ); if (iv_new == NULL) { /* PDF(x) < 0 or overflow !! */ _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); return -1; } /* insert into linked list */ iv_new->prev = oldl; iv_new->next = oldr; oldr->prev = iv_new; if (oldl) oldl->next = iv_new; } /* compute parameters for intervals */ success = UNUR_SUCCESS; /* left hand interval */ if (oldl) { success = _unur_tdr_ps_interval_parameter(gen, oldl); } if( iv_new ) { /* middle (newly created) interval) */ if (!oldl) { /* we have to copy the left intersection point from the right hand interval */ iv_new->ip = oldr->ip; iv_new->fip = oldr->fip; } success_r = _unur_tdr_ps_interval_parameter(gen, iv_new); /* worst of success and success_r */ if (success_r!=UNUR_SUCCESS) if ((success_r!=UNUR_ERR_SILENT&&success_r!=UNUR_ERR_INF) || (success==UNUR_SUCCESS||success==UNUR_ERR_SILENT||success==UNUR_ERR_INF)) success = success_r; } if ( oldr->next ) { /* right hand interval */ success_r = _unur_tdr_ps_interval_parameter(gen, oldr); if (success_r!=UNUR_SUCCESS) if ((success_r!=UNUR_ERR_SILENT&&success_r!=UNUR_ERR_INF) || (success==UNUR_SUCCESS||success==UNUR_ERR_SILENT||success==UNUR_ERR_INF)) success = success_r; } /* successfull ? */ if (success!=UNUR_SUCCESS) { /* cannot split interval at given point */ _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"Cannot split interval at given point."); if (success!=UNUR_ERR_SILENT && success!=UNUR_ERR_INF) _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF not T-concave"); /* the case of unbounded hat is treated as round-off error for very steep tangents. so we simply do not add this construction point. */ /* restore old interval */ if (oldl) memcpy(oldl, &oldl_bak, sizeof(struct unur_tdr_interval)); memcpy(oldr, &oldr_bak, sizeof(struct unur_tdr_interval)); /* remove from linked list; remaines to restore prev pointer in next interval */ oldr->prev = oldl; if (oldl) oldl->next = oldr; /* decrement counter for intervals and free unused interval */ if (iv_new) { --(GEN->n_ivs); free( iv_new ); } return success; } /* successful */ /* we have update the pointer to the list */ if (oldl == NULL && iv_new) /* new first entry */ GEN->iv = iv_new; /* update total area below hat and squeeze */ GEN->Atotal = ( GEN->Atotal + (oldr->Ahat - oldr_bak.Ahat) + ((oldl) ? (oldl->Ahat - oldl_bak.Ahat) : 0.) + ((iv_new) ? iv_new->Ahat : 0.) ); GEN->Asqueeze = ( GEN->Asqueeze + (oldr->Asqueeze - oldr_bak.Asqueeze) + ((oldl) ? (oldl->Asqueeze - oldl_bak.Asqueeze) : 0.) + ((iv_new) ? iv_new->Asqueeze : 0.) ); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug & TDR_DEBUG_SPLIT) _unur_tdr_ps_debug_split_stop( gen,oldl,iv_new,oldr ); #endif /* when using inside Gibbs sampler Atotal might be 0 */ if (GEN->Atotal <= 1.e10 * DBL_MIN) { _unur_error(gen->genid,UNUR_ERR_ROUNDOFF,"error below hat (almost) 0"); return UNUR_ERR_ROUNDOFF; } /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_tdr_ps_interval_split() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/tdr_init.ch0000644001357500135600000016116214420445767014443 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: tdr_init.c * * * * TYPE: continuous univariate random variate * * METHOD: transformed density rejection * * * * DESCRIPTION: * * Given PDF of a T-concave distribution * * produce a value x consistent with its density * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include "tdr_gw_init.ch" #include "tdr_ps_init.ch" /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_tdr_init( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* initialize new generator */ /* */ /* parameters: */ /* par ... pointer to paramters for building generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); /* check input */ if ( par->method != UNUR_METH_TDR ) { _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); return NULL; } COOKIE_CHECK(par,CK_TDR_PAR,NULL); /* create a new empty generator object */ gen = _unur_tdr_create(par); if (!gen) { _unur_par_free(par); return NULL; } /* free parameters */ _unur_par_free(par); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_tdr_debug_init_start(gen); #endif /* set-up the generator */ if (_unur_tdr_make_gen( gen ) != UNUR_SUCCESS) { _unur_tdr_free(gen); return NULL; } /* is there any hat at all ? */ if (GEN->Atotal <= 0. || !_unur_isfinite(GEN->Atotal)) { _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"bad construction points."); _unur_tdr_free(gen); return NULL; } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_tdr_debug_init_finished(gen); #endif /* creation of generator object successfull */ gen->status = UNUR_SUCCESS; /* o.k. */ return gen; } /* end of _unur_tdr_init() */ /*---------------------------------------------------------------------------*/ int _unur_tdr_make_gen( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* make generator object */ /* */ /* parameters: */ /* gen ... pointer (almost) empty generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* remark: */ /* on success: gen points to the ready-to-use generator object */ /* on error: gen should not be used at all */ /*----------------------------------------------------------------------*/ { int i,k; /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_ERR_COOKIE); /* get starting points */ if (_unur_tdr_starting_cpoints(gen)!=UNUR_SUCCESS) return UNUR_FAILURE; /* compute intervals for given starting points */ if (_unur_tdr_starting_intervals(gen)!=UNUR_SUCCESS) return UNUR_FAILURE; /* update maximal number of intervals */ if (GEN->n_ivs > GEN->max_ivs) GEN->max_ivs = GEN->n_ivs; if (gen->variant & TDR_VARFLAG_USEDARS) { /* run derandomized adaptive rejection sampling (DARS) */ #ifdef UNUR_ENABLE_LOGGING if (gen->debug & TDR_DEBUG_DARS) { /* make initial guide table (only necessary for writing debug info) */ _unur_tdr_make_guide_table(gen); /* write info into LOG file */ _unur_tdr_debug_dars_start(gen); } #endif for (i=0; i<3; i++) { /* we make several tries */ /* run DARS */ if (_unur_tdr_run_dars(gen)!=UNUR_SUCCESS) return UNUR_FAILURE; /* make initial guide table */ _unur_tdr_make_guide_table(gen); /* check if DARS was completed */ if (GEN->n_ivs < GEN->max_ivs) { /* ran ARS instead */ for (k=0; k<5; k++) _unur_sample_cont(gen); } else break; } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_tdr_debug_dars_finished(gen); #endif } else { /* do not run DARS */ /* make initial guide table */ _unur_tdr_make_guide_table(gen); } /* o.k. */ return UNUR_SUCCESS; } /* end _unur_tdr_make_gen() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_tdr_create( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* allocate memory for generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* pointer to (empty) generator object with default settings */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_TDR_PAR,NULL); /* create new generic generator object */ gen = _unur_generic_create( par, sizeof(struct unur_tdr_gen) ); /* magic cookies */ COOKIE_SET(gen,CK_TDR_GEN); /* set generator identifier */ gen->genid = _unur_set_genid(GENTYPE); /* which transformation */ if (_unur_iszero(PAR->c_T)) gen->variant = (gen->variant & (~TDR_VARMASK_T)) | TDR_VAR_T_LOG; else if (_unur_FP_same(PAR->c_T, -0.5)) gen->variant = (gen->variant & (~TDR_VARMASK_T)) | TDR_VAR_T_SQRT; else gen->variant = (gen->variant & (~TDR_VARMASK_T)) | TDR_VAR_T_POW; /** TODO: remove this **/ if ((gen->variant & TDR_VARMASK_T) == TDR_VAR_T_POW) { _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,"c != 0. and c != -0.5 not implemented!"); _unur_generic_free(gen); return NULL; } /* routines for sampling and destroying generator */ SAMPLE = _unur_tdr_getSAMPLE(gen); gen->destroy = _unur_tdr_free; gen->clone = _unur_tdr_clone; gen->reinit = _unur_tdr_reinit; /* set all pointers to NULL */ GEN->guide = NULL; GEN->guide_size = 0; GEN->iv = NULL; GEN->n_ivs = 0; GEN->Atotal = 0.; GEN->Asqueeze = 0.; /* copy some parameters into generator object */ GEN->guide_factor = PAR->guide_factor; /* relative size of guide tables */ GEN->c_T = PAR->c_T; /* parameter for transformation */ GEN->darsfactor = PAR->darsfactor; /* factor for derandomized ARS */ GEN->darsrule = PAR->darsrule; /* rule for finding splitting points in DARS */ /* bounds for adding construction points */ GEN->max_ivs = _unur_max(2*PAR->n_starting_cpoints,PAR->max_ivs); /* maximum number of intervals */ #ifdef UNUR_ENABLE_INFO GEN->max_ivs_info = PAR->max_ivs; /* ... for info string */ #endif GEN->max_ratio = PAR->max_ratio; /* bound for ratio Atotal / Asqueeze */ GEN->bound_for_adding = PAR->bound_for_adding; /* get center */ if ( (gen->distr->set & UNUR_DISTR_SET_CENTER) || (gen->distr->set & UNUR_DISTR_SET_MODE) ) { GEN->center = unur_distr_cont_get_center(gen->distr); /* center must be in domain */ GEN->center = _unur_max(GEN->center,DISTR.BD_LEFT); GEN->center = _unur_min(GEN->center,DISTR.BD_RIGHT); gen->set |= TDR_SET_CENTER; } else { GEN->center = 0.; /* we cannot use the center as construction point */ gen->variant &= ~TDR_VARFLAG_USECENTER; } /* mode known and in given domain ?? */ if ( !(gen->distr->set & UNUR_DISTR_SET_MODE) || (DISTR.mode < DISTR.BD_LEFT) || (DISTR.mode > DISTR.BD_RIGHT)) /* we cannot use the mode as construction point */ gen->variant = gen->variant & (~TDR_VARFLAG_USEMODE); /* copy starting points */ GEN->n_starting_cpoints = PAR->n_starting_cpoints; if (PAR->starting_cpoints) { GEN->starting_cpoints = _unur_xmalloc( PAR->n_starting_cpoints * sizeof(double) ); memcpy( GEN->starting_cpoints, PAR->starting_cpoints, PAR->n_starting_cpoints * sizeof(double) ); } else { GEN->starting_cpoints = NULL; } /* copy percentiles */ GEN->percentiles = NULL; if (gen->set & TDR_SET_N_PERCENTILES) unur_tdr_chg_reinit_percentiles( gen, PAR->n_percentiles, PAR->percentiles ); /* copy all other parameters */ GEN->retry_ncpoints = PAR->retry_ncpoints; /* number of cpoints for second trial of reinit */ /* set (default) boundaries for U */ GEN->Umin = 0.; GEN->Umax = 1.; /* set default for DARS */ if (!(gen->set & TDR_SET_USE_DARS) && !PAR->starting_cpoints) /* no starting points given by user --> enable derandomized ARS */ gen->variant |= TDR_VARFLAG_USEDARS; #ifdef UNUR_ENABLE_INFO /* set function for creating info string */ gen->info = _unur_tdr_info; #endif /* return pointer to (almost empty) generator object */ return gen; } /* end of _unur_tdr_create() */ /*---------------------------------------------------------------------------*/ int _unur_tdr_reinit( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* re-initialize (existing) generator. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { struct unur_tdr_interval *iv,*next; double *bak_cpoints; int bak_n_cpoints; int i; int n_trials; /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, TDR, UNUR_ERR_GEN_INVALID ); /* first trial */ n_trials = 1; /* which construction points should be used ? */ if (gen->set & TDR_SET_N_PERCENTILES) { if (GEN->starting_cpoints==NULL || (GEN->n_starting_cpoints != GEN->n_percentiles)) { GEN->n_starting_cpoints = GEN->n_percentiles; GEN->starting_cpoints = _unur_xrealloc( GEN->starting_cpoints, GEN->n_percentiles * sizeof(double)); } for (i=0; in_percentiles; i++) { GEN->starting_cpoints[i] = unur_tdr_eval_invcdfhat( gen, GEN->percentiles[i], NULL, NULL, NULL ); if (!_unur_isfinite(GEN->starting_cpoints[i])) /* we cannot use these starting points --> skip to second trial immediately */ n_trials = 2; } } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug & TDR_DEBUG_REINIT) _unur_tdr_debug_reinit_start(gen); #endif /* make backup of cpoints */ bak_n_cpoints = GEN->n_starting_cpoints; bak_cpoints = GEN->starting_cpoints; for (;; ++n_trials) { /* free linked list of intervals */ for (iv = GEN->iv; iv != NULL; iv = next) { next = iv->next; free(iv); } GEN->iv = NULL; GEN->n_ivs = 0; GEN->Atotal = 0.; GEN->Asqueeze = 0.; if (n_trials > 2) { /* we have done our best */ _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"bad construction points for reinit"); GEN->n_starting_cpoints = bak_n_cpoints; GEN->starting_cpoints = bak_cpoints; return UNUR_FAILURE; } if (n_trials > 1) { /* second trial */ GEN->n_starting_cpoints = GEN->retry_ncpoints; GEN->starting_cpoints = NULL; #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug & TDR_DEBUG_REINIT) _unur_tdr_debug_reinit_retry(gen); #endif } /* set-up the generator */ if (_unur_tdr_make_gen( gen ) != UNUR_SUCCESS) continue; /* is there any hat at all ? */ if (GEN->Atotal <= 0.) continue; /* reinit successful */ break; } /* clean up */ if (n_trials > 1) { GEN->n_starting_cpoints = bak_n_cpoints; GEN->starting_cpoints = bak_cpoints; } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug & TDR_DEBUG_REINIT) if (gen->debug) _unur_tdr_debug_reinit_finished(gen); #endif /* (re)set sampling routine */ SAMPLE = _unur_tdr_getSAMPLE(gen); return UNUR_SUCCESS; } /* end of _unur_tdr_reinit() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_tdr_clone( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* copy (clone) generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to clone of generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { #define CLONE ((struct unur_tdr_gen*)clone->datap) struct unur_gen *clone; struct unur_tdr_interval *iv,*next, *clone_iv, *clone_prev; /* check arguments */ CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_TDR_GEN,NULL); /* create generic clone */ clone = _unur_generic_clone( gen, GENTYPE ); /* copy linked list of intervals */ clone_iv = NULL; clone_prev = NULL; for (iv = GEN->iv; iv != NULL; iv = next) { /* copy segment */ clone_iv = _unur_xmalloc( sizeof(struct unur_tdr_interval) ); memcpy( clone_iv, iv, sizeof(struct unur_tdr_interval) ); if (clone_prev == NULL) { /* starting point of linked list */ CLONE->iv = clone_iv; clone_iv->prev = NULL; } else { /* insert into linked list */ clone_prev->next = clone_iv; clone_iv->prev = clone_prev; } /* next step */ next = iv->next; clone_prev = clone_iv; } /* terminate linked list */ if (clone_iv) clone_iv->next = NULL; /* copy starting points */ if (GEN->starting_cpoints) { CLONE->starting_cpoints = _unur_xmalloc( GEN->n_starting_cpoints * sizeof(double) ); memcpy( CLONE->starting_cpoints, GEN->starting_cpoints, GEN->n_starting_cpoints * sizeof(double) ); } /* copy percentiles */ if (GEN->percentiles) { CLONE->percentiles = _unur_xmalloc( GEN->n_percentiles * sizeof(double) ); memcpy( CLONE->percentiles, GEN->percentiles, GEN->n_percentiles * sizeof(double) ); } /* make new guide table */ CLONE->guide = NULL; _unur_tdr_make_guide_table(clone); /* finished clone */ return clone; #undef CLONE } /* end of _unur_tdr_clone() */ /*****************************************************************************/ void _unur_tdr_free( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* deallocate generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { /* check arguments */ if( !gen ) /* nothing to do */ return; /* check input */ if ( gen->method != UNUR_METH_TDR ) { _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); return; } COOKIE_CHECK(gen,CK_TDR_GEN,RETURN_VOID); /* we cannot use this generator object any more */ SAMPLE = NULL; /* make sure to show up a programming error */ #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_tdr_debug_free(gen); #endif /* free linked list of intervals */ { struct unur_tdr_interval *iv,*next; for (iv = GEN->iv; iv != NULL; iv = next) { next = iv->next; free(iv); } } /* free list of starting points */ if (GEN->starting_cpoints) free (GEN->starting_cpoints); /* free list of percentiles */ if (GEN->percentiles) free (GEN->percentiles); /* free table */ if (GEN->guide) free(GEN->guide); /* free other memory not stored in list */ _unur_generic_free(gen); } /* end of _unur_tdr_free() */ /*****************************************************************************/ /** Auxilliary Routines **/ /*****************************************************************************/ int _unur_tdr_starting_cpoints( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* list of construction points for starting intervals. */ /* if not provided as arguments compute these */ /* by means of the "equiangular rule" from AROU. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { struct unur_tdr_interval *iv; double left_angle, right_angle, diff_angle, angle; double x, fx, fx_last; int use_center, use_mode, is_mode, was_mode; int i, is_increasing; double extra_cpoint; /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_ERR_COOKIE); /* use mode as construction point ? */ use_mode = (gen->variant & TDR_VARFLAG_USEMODE) ? TRUE : FALSE; /* use center as construction point ? */ use_center = (!use_mode && (gen->variant & TDR_VARFLAG_USECENTER)) ? TRUE : FALSE; /* add extra construction point */ /* (use either mode or center or none) */ extra_cpoint = use_mode ? DISTR.mode : (use_center ? GEN->center : 0. ); /* reset counter of intervals */ GEN->n_ivs = 0; /* prepare for computing construction points */ if (!GEN->starting_cpoints) { /* move center into x = 0 */ /* angles of boundary of domain */ left_angle = _unur_FP_is_minus_infinity(DISTR.BD_LEFT) ? -M_PI/2. : atan(DISTR.BD_LEFT - GEN->center); right_angle = _unur_FP_is_infinity(DISTR.BD_RIGHT) ? M_PI/2. : atan(DISTR.BD_RIGHT - GEN->center); /* we use equal distances between the angles of the cpoints */ /* and the boundary points */ diff_angle = (right_angle-left_angle) / (GEN->n_starting_cpoints + 1); angle = left_angle; } else diff_angle = angle = 0.; /* we do not need these variables in this case */ /* the left boundary point */ x = DISTR.BD_LEFT; if (use_mode && DISTR.mode <= x) { /* this is the mode of the distribution */ is_mode = TRUE; use_mode = FALSE; /* do not use the mode again */ is_increasing = FALSE; } else if (use_center && GEN->center <= x) { is_mode = FALSE; use_center = FALSE; /* do not use the center again */ is_increasing = TRUE; /* the center may be left of (unknown) mode */ } else { is_mode = FALSE; is_increasing = TRUE; } fx = fx_last = _unur_FP_is_minus_infinity(x) ? 0. : PDF(x); iv = GEN->iv = _unur_tdr_interval_new( gen, x, fx, is_mode ); if (iv == NULL) return UNUR_ERR_GEN_DATA; /* PDF(x) < 0 or overflow !! */ /* terminate beginning of list */ iv->prev = NULL; /* now all the other points */ for( i=0; i<=GEN->n_starting_cpoints; i++ ) { was_mode = is_mode; /* construction point */ if (i < GEN->n_starting_cpoints) { if (GEN->starting_cpoints) { /* construction points provided by user */ x = GEN->starting_cpoints[i]; /* check starting point */ if (x < DISTR.BD_LEFT || x > DISTR.BD_RIGHT) { _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"starting point out of domain"); continue; } } else { /* compute construction points by means of "equiangular rule" */ angle += diff_angle; x = tan( angle ) + GEN->center; } } else { /* the very last interval. it is rather a "virtual" interval to store the right vertex of the last interval, i.e., the right boundary point. */ x = DISTR.BD_RIGHT; } /* insert mode or center ? */ if ((use_mode || use_center) && x >= extra_cpoint) { is_mode = use_mode; /* the next construction point is the mode */ use_center = use_mode = FALSE; /* we use the mode only once (of course) */ if (x>extra_cpoint) { x = extra_cpoint; /* use the mode now ... */ --i; /* and push the orignal starting point back on stack */ if (!GEN->starting_cpoints) angle -= diff_angle; /* we have to compute the starting point in this case */ } /* else: x == extra_cpoint --> nothing to do */ } else is_mode = FALSE; /** TODO: check if two construction points are too close ?? check if a point is too close to mode ?? */ /* value of PDF at starting point */ fx = _unur_FP_is_infinity(x) ? 0. : PDF(x); /* check value of PDF at starting point */ if (!is_increasing && fx > fx_last * (1.+DBL_EPSILON)) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF not unimodal!"); return UNUR_ERR_GEN_CONDITION; } if (is_mode && fx < fx_last * (1.-DBL_EPSILON)) { _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"mode -> ignore"); continue; } if (was_mode && fx > fx_last * (1.+DBL_EPSILON)) { _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"mode"); return UNUR_ERR_GEN_DATA; } if (fx <= 0. && fx_last <= 0.) { /* we do not need two such point */ if (is_increasing) { /* PDF is still increasing, i.e., constant 0 til now */ if (in_starting_cpoints) { /* and it is not the right boundary. otherwise the PDF is constant 0 on all construction points. then we need both boundary points. */ iv->x = x; /* we only have to change x, everything else remains unchanged */ continue; /* next construction point */ } } else /* there should be no more points with PDF(x) > 0 */ break; } /* need a new interval */ iv->next = _unur_tdr_interval_new( gen, x, fx, is_mode ); if (iv->next == NULL) return UNUR_ERR_GEN_DATA; /* PDF(x) < 0 or overflow !! */ /* link into list and skip pointer to current interval */ iv->next->prev = iv; iv = iv->next; /* PDF still increasing ? */ if (is_increasing && fx < fx_last) is_increasing = 0; /* store last computed values */ fx_last = fx; } /* we have left the loop with the right boundary of the support of PDF make shure that we will never use iv for sampling. */ iv->Asqueeze = iv->Ahat = iv->Ahatr = iv->sq = 0.; iv->Acum = UNUR_INFINITY; iv->ip = iv->x; iv->fip = iv->fx; iv->next = NULL; /* terminate list */ --(GEN->n_ivs); /* we do not count this interval */ /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_tdr_starting_cpoints() */ /*****************************************************************************/ int _unur_tdr_starting_intervals( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* compute intervals for starting points */ /* */ /* parameters: */ /* par ... pointer to parameter list */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { switch (gen->variant & TDR_VARMASK_VARIANT) { case TDR_VARIANT_GW: /* original variant (Gilks&Wild) */ return _unur_tdr_gw_starting_intervals(gen); case TDR_VARIANT_PS: /* proportional squeeze */ case TDR_VARIANT_IA: /* immediate acceptance */ return _unur_tdr_ps_starting_intervals(gen); default: _unur_error(GENTYPE,UNUR_ERR_SHOULD_NOT_HAPPEN,""); return UNUR_ERR_SHOULD_NOT_HAPPEN; } } /* end of _unur_tdr_starting_intervals() */ /*****************************************************************************/ int _unur_tdr_run_dars( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* run derandomized adaptive rejection sampling. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { struct unur_tdr_interval *iv; double Atot, Asqueezetot; /* total area below hat and squeeze, resp. */ /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_ERR_COOKIE); /* there is no need to run DARS when the DARS factor is UNUR_INFINITY */ if (_unur_FP_is_infinity(GEN->darsfactor)) return UNUR_SUCCESS; /* first we need the total areas below hat and squeeze. (This is only necessary, when _unur_tdr_make_guide_table() has not been called!) */ Atot = 0.; /* area below hat */ Asqueezetot = 0.; /* area below squeeze */ for (iv = GEN->iv; iv != NULL; iv = iv->next ) { COOKIE_CHECK(iv,CK_TDR_IV,UNUR_ERR_COOKIE); Atot += iv->Ahat; Asqueezetot += iv->Asqueeze; } GEN->Atotal = Atot; GEN->Asqueeze = Asqueezetot; /* now run DARS for different variants */ switch (gen->variant & TDR_VARMASK_VARIANT) { case TDR_VARIANT_GW: /* original variant (Gilks&Wild) */ return _unur_tdr_gw_dars(gen); case TDR_VARIANT_PS: /* proportional squeeze */ case TDR_VARIANT_IA: /* immediate acceptance */ return _unur_tdr_ps_dars(gen); default: _unur_error(GENTYPE,UNUR_ERR_SHOULD_NOT_HAPPEN,""); return UNUR_ERR_SHOULD_NOT_HAPPEN; } } /* end of _unur_tdr_run_dars() */ /*****************************************************************************/ struct unur_tdr_interval * _unur_tdr_interval_new( struct unur_gen *gen, double x, double fx, int is_mode ) /*----------------------------------------------------------------------*/ /* get new interval and compute left construction point at x. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* x ... left point of new interval */ /* fx ... value of PDF at x */ /* is_mode ... if TRUE, x is a mode of the PDF */ /* */ /* return: */ /* pointer to new interval */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_tdr_interval *iv; double dfx; /* check arguments */ CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_TDR_GEN,NULL); /* first check fx */ if (fx<0.) { _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"PDF(x) < 0.!"); return NULL; } if (_unur_FP_is_infinity(fx)) { /* over flow */ _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"PDF(x) overflow"); return NULL; } /* we need a new segment */ iv = _unur_xmalloc( sizeof(struct unur_tdr_interval) ); iv->next = NULL; /* add eol marker */ ++(GEN->n_ivs); /* increment counter for intervals */ COOKIE_SET(iv,CK_TDR_IV); /* avoid uninitialized variables */ iv->Acum = iv->Ahat = iv->Ahatr = iv->Asqueeze = 0.; iv->ip = iv->fip = iv->sq = 0.; /* make left construction point in interval */ iv->x = x; /* point x */ iv->fx = fx; /* value of PDF at x */ if (fx<=0.) { /* --> -UNUR_INFINITY */ iv->Tfx = -UNUR_INFINITY; /* transformed density */ iv->dTfx = UNUR_INFINITY; /* derivative of transformed density */ return iv; } switch( gen->variant & TDR_VARMASK_T ) { case TDR_VAR_T_LOG: /* transformed density */ iv->Tfx = log(fx); /* derivative of transformed density */ if (is_mode) { /* we can set dPDF(x) = 0. for the mode */ iv->dTfx = 0.; break; } if (_unur_cont_have_dlogPDF(gen->distr)) { iv->dTfx = dlogPDF(x); break; } else { dfx = dPDF(x); if (_unur_iszero(dfx)) iv->dTfx = 0.; else iv->dTfx = (1./fx * dfx); /* possible overflow ? */ } break; case TDR_VAR_T_SQRT: /* transformed density */ iv->Tfx = -1./sqrt(fx); /* derivative of transformed density */ if (is_mode) { /* we can set dPDF(x) = 0. for the mode */ iv->dTfx = 0.; break; } if (_unur_cont_have_dlogPDF(gen->distr)) { iv->dTfx = -0.5 * iv->Tfx * dlogPDF(x); break; } else { dfx = dPDF(x); if (_unur_iszero(dfx)) iv->dTfx = 0.; else iv->dTfx = (dfx<0.) ? -exp( -M_LN2 - 1.5*log(fx) + log(-dfx)) : exp( -M_LN2 - 1.5*log(fx) + log(dfx)); } break; case TDR_VAR_T_POW: /** TODO **/ /* iv->Tfx = -pow(fx,GEN->c_T); */ /* iv->dTfx = 0.; */ break; } /* the program requires dTfx > -UNUR_INFINITY */ if ( !(iv->dTfx > -UNUR_INFINITY)) iv->dTfx = UNUR_INFINITY; return iv; } /* end of _unur_tdr_interval_new() */ /*****************************************************************************/ int _unur_tdr_tangent_intersection_point( struct unur_gen *gen, struct unur_tdr_interval *iv, double *ipt ) /*----------------------------------------------------------------------*/ /* compute cutting point of interval into left and right part. */ /* (1) use intersection point of tangents of transformed hat. */ /* (2) use mean point if (1) is unstable due to roundoff errors. */ /* (3) use boundary point which is closer to the mode. this is */ /* important when the transformed tagents are extremely steep. */ /* (This might cause a serious roundoff error while sampling.) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* iv ... pointer to interval */ /* ipt ... pointer to intersection point */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_ERR_COOKIE); CHECK_NULL(iv,UNUR_ERR_NULL); COOKIE_CHECK(iv,CK_TDR_IV,UNUR_ERR_COOKIE); /* case: there is no tangent at one of the boundary points of the interval (then the slope is UNUR_INFINITY) or case: the tangents are too steep (--> case (3)) */ if ( iv->dTfx > 1.e+140 ) { *ipt = iv->x; /* intersection point = left boundary of interval */ return UNUR_SUCCESS; } if ( iv->next->dTfx < -1.e+140 || _unur_FP_is_infinity(iv->next->dTfx)) { *ipt = iv->next->x; /* intersection point = right boundary of interval */ return UNUR_SUCCESS; } /** TODO: 1.e+140 (= sqrt(DBL_MAX) / 1.e15) is arbitrary **/ /* test for T-concavity */ if ( _unur_FP_less( iv->dTfx, iv->next->dTfx ) ) { /* it might happen because of round-off errors that iv->next->dTfx is almost zero although it should be large. thus we ignore this case. */ if ( fabs(iv->dTfx) < DBL_EPSILON * fabs(iv->next->dTfx) ) { *ipt = iv->x; /* intersection point = left boundary of interval */ iv->dTfx = UNUR_INFINITY; return UNUR_SUCCESS; } else if ( fabs(iv->next->dTfx) < DBL_EPSILON * fabs(iv->dTfx) ) { *ipt = iv->next->x; /* intersection point = right boundary of interval */ iv->next->dTfx = UNUR_INFINITY; return UNUR_SUCCESS; } else { /* fprintf(stdout,"\ndTfx0 = %g < %g = dTfx1 (x0 = %g, x1 = %g)\n", */ /* iv->dTfx,iv->next->dTfx,iv->x,iv->next->x); */ _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"dTfx0 < dTfx1 (x0next->Tfx > iv->x + iv->dTfx*(iv->next->x - iv->x)) { */ /* _unur_warning(gen->genid,UNUR_ERR_INIT,"tangent below PDF not T-concave!"); */ /* return UNUR_ERR_INIT; */ /* } */ /* case (2): computing intersection of tangents is unstable */ if (_unur_FP_approx(iv->dTfx, iv->next->dTfx)) { /* use mean point */ *ipt = 0.5 * (iv->x + iv->next->x); return UNUR_SUCCESS; } /* case (1): compute intersection point of tangents (regular case) */ *ipt = ( (iv->next->Tfx - iv->Tfx - iv->next->dTfx * iv->next->x + iv->dTfx * iv->x) / (iv->dTfx - iv->next->dTfx) ); /* check position of intersection point */ if (_unur_FP_less(*ipt, iv->x) || _unur_FP_greater(*ipt, iv->next->x)) /* intersection point of tangents not in interval. This is mostly the case for numerical reasons. Thus we is the center of the interval instead. if the PDF not T-concave, it will catched at a later point when we compare slope of tangents and squeeze. */ *ipt = 0.5 * (iv->x + iv->next->x); /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_tdr_tangent_intersection_point() */ /*****************************************************************************/ double _unur_tdr_interval_area( struct unur_gen *gen, struct unur_tdr_interval *iv, double slope, double x ) /*---------------------------------------------------------------------------*/ /* compute area below piece of hat or squeeze in */ /* interval [iv->x,x] or [x,iv->x] */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* iv ... pointer to interval that stores construction point of tangent */ /* slope ... slope of tangent or secant of transformed PDF */ /* x ... boundary of integration domain */ /* */ /* return: */ /* area */ /* */ /* error: */ /* return UNUR_INFINITY */ /* */ /* comment: */ /* x0 ... construction point of tangent (= iv->x) */ /* */ /* log(x) */ /* area = | \int_{x0}^x \exp(Tf(x0) + slope*(t-x0)) dt | */ /* = f(x0) * |x - x0| if slope = 0 */ /* = | f(x0)/slope * (\exp(slope*(x-x0))-1) | if slope != 0 */ /* */ /* -1/sqrt(x) */ /* area = | \int_{x0}^x 1/(Tf(x0) + slope*(t-x0))^2 dt | */ /* = f(x0) * |x - x0| if slope = 0 */ /* = infinity if T(f(x)) >= 0 */ /* = | (x-x0) / (Tf(x0)*(Tf(x0)+slope*(x-x0))) | otherwise */ /* */ /*---------------------------------------------------------------------------*/ { double area = 0.; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_INFINITY); CHECK_NULL(iv,UNUR_INFINITY); COOKIE_CHECK(iv,CK_TDR_IV,UNUR_INFINITY); /* if the construction point is at infinity, we cannot compute an area. (in this case we should have x == iv->x == UNUR_INFINITY). */ if (_unur_FP_is_infinity(iv->x) || _unur_FP_is_minus_infinity(iv->x)) return 0.; /* length of interval > 0 ? */ if (_unur_FP_same(x, iv->x)) return 0.; /* unbounded? */ if ( _unur_FP_is_infinity(slope) || (_unur_FP_is_minus_infinity(x) && slope<=0.) || (_unur_FP_is_infinity(x) && slope>=0.) ) /* we have set (Tf)'(x) = UNUR_INFINITY, if f(x)=0 */ return UNUR_INFINITY; switch( gen->variant & TDR_VARMASK_T ) { case TDR_VAR_T_LOG: /* T(x) = log(x) */ if (!_unur_iszero(slope)) { if (_unur_FP_is_infinity(x) || _unur_FP_is_minus_infinity(x)) area = iv->fx / slope; else { double t = slope * (x - iv->x); if (fabs(t) > 1.e-6) { if (t > MAXLOG / 10.) { double xdiff = (x>iv->x) ? x - iv->x : iv->x - x; area = exp( log(iv->fx) + log(xdiff) + t - log(t) ); } else { area = iv->fx * (x - iv->x) * ( exp(t) - 1. ) / t; } } else if (fabs(t) > 1.e-8) /* use Taylor series */ area = iv->fx * (x - iv->x) * (1. + t/2. + t*t/6.); else area = iv->fx * (x - iv->x) * (1. + t/2.); } } else { /* hat/squeeze almost constant */ if (_unur_FP_is_infinity(x) || _unur_FP_is_minus_infinity(x)) return UNUR_INFINITY; else area = iv->fx * (x - iv->x); } break; case TDR_VAR_T_SQRT: /* T(x) = -1./sqrt(x) */ if (!_unur_iszero(slope)) { if (_unur_FP_is_infinity(x) || _unur_FP_is_minus_infinity(x)) area = 1. / ( iv->Tfx * slope ); else { /* compute value of transformed hat at integration boundary */ double hx = iv->Tfx + slope * (x - iv->x); /* the transformed hat must always be below the x-axis. otherwise the area below the hat in unbounded. */ if (hx>=0.) return UNUR_INFINITY; else area = (x - iv->x) / ( iv->Tfx * hx ); } } else { /* hat/squeeze almost constant */ if (_unur_FP_is_infinity(x) || _unur_FP_is_minus_infinity(x)) return UNUR_INFINITY; else area = iv->fx * (x - iv->x); } break; case TDR_VAR_T_POW: /* T(x) = -x^c */ /** TODO **/ break; } return ( (area<0.) ? -area : area ); } /* end of _unur_tdr_interval_area() */ /*---------------------------------------------------------------------------*/ double _unur_tdr_interval_xxarea( struct unur_gen *gen, struct unur_tdr_interval *iv, double slope, double x ) /*---------------------------------------------------------------------------*/ /* compute the interal of x times hat or squeeze ("expected value") in */ /* interval [iv->x,x] or [x,iv->x] */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* iv ... pointer to interval that stores construction point of tangent */ /* slope ... slope of tangent or secant of transformed PDF */ /* x ... boundary of integration domain */ /* */ /* return: */ /* "expected value" */ /* (to get the real expected value, it must be divided by the area below */ /* the function (hat or squeeze).) */ /* */ /* error: */ /* return UNUR_INFINITY */ /* */ /* comment: */ /* x0 ... construction point of tangent (= iv->x) */ /* */ /* log(x) */ /* ev = \int_{x0}^x t * \exp(Tf(x0) + slope*(t-x0)) dt */ /* = 0.5 * f(x0) * (x^2 - x0^2) if slope = 0 */ /* = f(x0)/slope^2 * (\exp(slope*(x-x0))*(slope*x-1) - (slope*x0-1)) */ /* if slope != 0 */ /* */ /* -1/sqrt(x) */ /* ev = \int_{x0}^x t / (Tf(x0) + slope*(t-x0))^2 dt */ /* = 0.5 * f(x0) * (x^2 - x0^2) if slope = 0 */ /* = infinity if T(f(x)) >= 0 or |x| = infinity */ /* = x0 / (slope*Tf(x0)) - x / (slope*u) + log(u/Tf(x0)) / slope^2 */ /* where u = Tf(x0) + slope*(x-x0) otherwise */ /* */ /* To get the right sign we have to return sign(x-x0) * ev. */ /* */ /*---------------------------------------------------------------------------*/ { double ev = 0.; double hx,u; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_INFINITY); CHECK_NULL(iv,UNUR_INFINITY); COOKIE_CHECK(iv,CK_TDR_IV,UNUR_INFINITY); /* if the construction point is at infinity, we cannot compute the integral (in this case we should have x == iv->x == UNUR_INFINITY). */ if (_unur_FP_is_infinity(iv->x) || _unur_FP_is_minus_infinity(iv->x)) return 0.; /* length of interval > 0 ? */ if (_unur_FP_same(x, iv->x)) return 0.; /* unbounded? */ if ( _unur_FP_is_infinity(slope) || (_unur_FP_is_minus_infinity(x) && slope<=0.) || (_unur_FP_is_infinity(x) && slope>=0.) ) /* we have set (Tf)'(x) = UNUR_INFINITY, if f(x)=0 */ return UNUR_INFINITY; switch( gen->variant & TDR_VARMASK_T ) { case TDR_VAR_T_LOG: /* T(x) = log(x) */ if (_unur_FP_is_infinity(x) || _unur_FP_is_minus_infinity(x)) { ev = iv->fx / (slope*slope) * (1-slope*iv->x); } else { u = (x-iv->x) * slope; if (fabs(u) > 1.e-6) { ev = iv->fx / (slope*slope) * (exp(u)*(slope*x-1.) - slope*iv->x + 1.); } else { /* use Taylor series */ /* constant term */ ev = 0.5 * (x+iv->x); if (fabs(u) > 0) { /* 1st order expansion */ ev += 1./6. * (2.*x+iv->x) * u; /* 2nd order expansion */ ev += 1./24. * (3.*x+iv->x) * u * u; } ev *= iv->fx * (x-iv->x); } } break; case TDR_VAR_T_SQRT: /* T(x) = -1./sqrt(x) */ if (_unur_FP_is_infinity(x) || _unur_FP_is_minus_infinity(x)) /* the integral becomes UNUR_INFINITY */ return UNUR_INFINITY; /* compute value of transformed hat at integration boundary */ hx = iv->Tfx + slope * (x - iv->x); if (hx >= 0.) /* the transformed hat must always be below the x-axis. otherwise the area below the hat in unbounded. */ return UNUR_INFINITY; u = (x-iv->x) * slope / iv->Tfx; if (fabs(u) > 1.e-6) { ev = ( iv->x / (slope * iv->Tfx) - x / (slope * hx) + log( hx / iv->Tfx ) / (slope*slope) ); } else { /* use Taylor series */ /* constant term */ ev = 0.5 * (x+iv->x); if (fabs(u) > 0) { /* 1st order expansion */ ev -= 1./3. * (2.*x+iv->x) * u; /* 2nd order expansion */ ev += 1./4. * (3.*x+iv->x) * u * u; } ev *= iv->fx * (x-iv->x); } break; case TDR_VAR_T_POW: /* T(x) = -x^c */ /** TODO **/ break; } return ((x>iv->x) ? ev : -ev); } /* end of _unur_tdr_interval_xxarea() */ /*---------------------------------------------------------------------------*/ double _unur_tdr_eval_intervalhat( struct unur_gen *gen, struct unur_tdr_interval *iv, double x ) /*----------------------------------------------------------------------*/ /* evaluate hat at x in interval. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* iv ... pointer to interval that stores constr. point of tangent */ /* x ... point at which hat(x) has to be computed */ /* */ /* return: */ /* hat(x) or */ /* 0. if x is not finite or */ /* UNUR_INFINITY the hat cannot be computed */ /* */ /* error: */ /* return UNUR_INFINITY */ /* */ /* comment: */ /* x0 ... construction point of tangent (= iv->x) */ /* */ /* log(x) */ /* hat(x) = f(x0) * exp( Tf'(x0)(x - x_0) ) */ /* */ /* 1/sqrt(x) */ /* hat(x) = 1/(Tf(x0) + Tf'(x0)(x - x_0))^2 */ /* */ /*----------------------------------------------------------------------*/ { /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_INFINITY); CHECK_NULL(iv,UNUR_INFINITY); COOKIE_CHECK(iv,CK_TDR_IV,UNUR_INFINITY); /* we cannot compute the hat at x if any of the parameters are not finite */ if ( _unur_FP_is_minus_infinity(iv->Tfx) || _unur_FP_is_infinity(iv->dTfx) ) return UNUR_INFINITY; /* at +/- infinity the hat should be 0 (or infinity) */ if ( _unur_FP_is_infinity(x) || _unur_FP_is_minus_infinity(x) || _unur_FP_is_infinity(iv->x) || _unur_FP_is_minus_infinity(iv->x) ) return 0.; /* now evaluate hat at x */ switch( gen->variant & TDR_VARMASK_T ) { case TDR_VAR_T_LOG: /* T(x) = log(x) */ return (iv->fx * exp( iv->dTfx * (x - iv->x) )); case TDR_VAR_T_SQRT: /* T(x) = -1./sqrt(x) */ { /* compute value of transformed hat at x */ double hx = iv->Tfx + iv->dTfx * (x - iv->x); /* hx must be less than 0 ! */ return ((hx<0.) ? 1./(hx*hx) : UNUR_INFINITY); } case TDR_VAR_T_POW: /* T(x) = -1./x^c */ /** TODO **/ return UNUR_INFINITY; default: _unur_error(GENTYPE,UNUR_ERR_SHOULD_NOT_HAPPEN,""); return UNUR_INFINITY; } } /* end of _unur_tdr_eval_intervalhat() */ /*****************************************************************************/ int _unur_tdr_make_guide_table( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* make a guide table for indexed search */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { struct unur_tdr_interval *iv; double Acum, Asqueezecum, Astep; int max_guide_size; int j; /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_TDR_GEN,UNUR_ERR_COOKIE); /* allocate blocks for guide table (if necessary). (we allocate blocks for maximal guide table.) */ if (!GEN->guide) { max_guide_size = (GEN->guide_factor > 0.) ? ((int)(GEN->max_ivs * GEN->guide_factor)) : 1; if (max_guide_size <= 0) max_guide_size = 1; /* protect against overflow */ GEN->guide = _unur_xmalloc( max_guide_size * sizeof(struct unur_tdr_interval*) ); } /* first we need cumulated areas in intervals */ Acum = 0.; /* area below hat */ Asqueezecum = 0.; /* area below squeeze */ for (iv = GEN->iv; iv != NULL; iv = iv->next ) { COOKIE_CHECK(iv,CK_TDR_IV,UNUR_ERR_COOKIE); Acum += iv->Ahat; Asqueezecum += iv->Asqueeze; iv->Acum = Acum; } /* total area below hat */ GEN->Atotal = Acum; GEN->Asqueeze = Asqueezecum; /* actual size of guide table */ GEN->guide_size = (int)(GEN->n_ivs * GEN->guide_factor); /* we do not vary the relative size of the guide table, since it has very little influence on speed */ /* make table (use variant 2; see dis.c) */ Astep = GEN->Atotal / GEN->guide_size; Acum=0.; for( j=0, iv=GEN->iv; j < GEN->guide_size; j++ ) { COOKIE_CHECK(iv,CK_TDR_IV,UNUR_ERR_COOKIE); while( iv->Acum < Acum ) iv = iv->next; if( iv->next == NULL ) { /* this is the last virtual intervall --> do not use */ _unur_warning(gen->genid,UNUR_ERR_ROUNDOFF,"guide table"); break; } GEN->guide[j] = iv; Acum += Astep; } /* if there has been an round off error, we have to complete the guide table */ for( ; jguide_size ;j++ ) GEN->guide[j] = iv; return UNUR_SUCCESS; } /* end of _unur_tdr_make_guide_table() */ /*****************************************************************************/ unuran-1.11.0/src/methods/mvtdr_info.ch0000644001357500135600000001727714420445767015005 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: mvtdr_info.c * * * * TYPE: continuous multivariate random variate * * METHOD: multivariate transformed density rejection * * * * DESCRIPTION: * * Given (logarithm of the) PDF of a log-concave distribution; * * produce a value x consistent with its density. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*****************************************************************************/ /** Private **/ /*****************************************************************************/ /*****************************************************************************/ /** Info string **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_INFO /*---------------------------------------------------------------------------*/ void _unur_mvtdr_info( struct unur_gen *gen, int help ) /*----------------------------------------------------------------------*/ /* create character string that contains information about the */ /* given generator object. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* help ... whether to print additional comments */ /*----------------------------------------------------------------------*/ { struct unur_string *info = gen->infostr; struct unur_distr *distr = gen->distr; int samplesize = 10000; double rc; /* generator ID */ _unur_string_append(info,"generator ID: %s\n\n", gen->genid); /* distribution */ _unur_string_append(info,"distribution:\n"); _unur_distr_info_typename(gen); _unur_string_append(info," dimension = %d\n",GEN->dim); _unur_string_append(info," functions = PDF dPDF\n"); _unur_distr_cvec_info_domain(gen); if ( distr->set & UNUR_DISTR_SET_MODE ) { _unur_string_append(info," mode = "); _unur_distr_info_vector( gen, DISTR.mode, GEN->dim); } _unur_string_append(info,"\n"); _unur_string_append(info," center = "); _unur_distr_info_vector( gen, GEN->center, GEN->dim); if ( !(distr->set & UNUR_DISTR_SET_CENTER) ) { if ( distr->set & UNUR_DISTR_SET_MODE ) _unur_string_append(info," [= mode]"); else _unur_string_append(info," [default]"); } _unur_string_append(info,"\n\n"); if (help) { if ( !(distr->set & UNUR_DISTR_SET_MODE) ) _unur_string_append(info,"[ Hint: %s ]\n", "You can set the mode to improve the rejection constant."); _unur_string_append(info,"\n"); } /* method */ _unur_string_append(info,"method: MVTDR (Multi-Variate Transformed Density Rejection)\n"); _unur_string_append(info,"\n"); /* performance */ _unur_string_append(info,"performance characteristics:\n"); _unur_string_append(info," volume(hat) = %g\n", GEN->Htot); _unur_string_append(info," rejection constant "); if (distr->set & UNUR_DISTR_SET_PDFVOLUME) { _unur_string_append(info,"= %g\n", GEN->Htot / DISTR.volume); } else { rc = unur_test_count_urn(gen,samplesize,0,NULL)/((1.+GEN->dim)*samplesize); _unur_string_append(info,"= %.2f [approx.]\n", rc); } _unur_string_append(info," # cones = %d\n", GEN->n_cone); _unur_string_append(info," # vertices = %d\n", GEN->n_vertex); if (GEN->steps_min == GEN->n_steps) _unur_string_append(info," triangulation levels = %d\n", GEN->n_steps); else _unur_string_append(info," triangulation levels = %d-%d\n", GEN->steps_min, GEN->n_steps); _unur_string_append(info,"\n"); /* parameters */ if (help) { _unur_string_append(info,"parameters:\n"); _unur_string_append(info," stepsmin = %d %s\n", GEN->steps_min, (gen->set & MVTDR_SET_STEPSMIN) ? "" : "[default]"); _unur_string_append(info," maxcones = %d %s\n", GEN->max_cones, (gen->set & MVTDR_SET_MAXCONES) ? "" : "[default]"); _unur_string_append(info," boundsplitting = %g %s\n", GEN->bound_splitting, (gen->set & MVTDR_SET_BOUNDSPLITTING) ? "" : "[default]"); if (gen->variant & MVTDR_VARFLAG_VERIFY) _unur_string_append(info," verify = on\n"); _unur_string_append(info,"\n"); } /* Hints */ if (help) { if ( !(gen->set & MVTDR_SET_STEPSMIN) ) _unur_string_append(info,"[ Hint: %s ]\n", "You can increase \"stepsmin\" to improve the rejection constant." ); if (GEN->max_cones <= GEN->n_cone) _unur_string_append(info,"[ Hint: %s ]\n", "You can increase \"maxcones\" to improve the rejection constant." ); if ( !(gen->set & MVTDR_SET_BOUNDSPLITTING) ) _unur_string_append(info,"[ Hint: %s ]\n", "You can change \"boundsplitting\" to change the creating of the hat function." ); _unur_string_append(info,"\n"); } } /* end of _unur_mvtdr_info() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_INFO */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/tabl_sample.ch0000644001357500135600000004161314420445767015110 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: tabl_sample.c * * * * TYPE: continuous univariate random variate * * METHOD: rejection form piecewise constant hat * * (Ahren's table method) * * * * DESCRIPTION: * * Given PDF of a unimodal distribution * * produce random variate X with its density * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ double _unur_tabl_rh_sample( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator */ /* (use "classical" acceptance/rejection) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { UNUR_URNG *urng; /* pointer to uniform random number generator */ struct unur_tabl_interval *iv; double U,X,fx,V; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_TABL_GEN,UNUR_INFINITY); /* main URNG */ urng = gen->urng; while(1) { /* sample from U( Umin, Umax ) */ U = GEN->Umin + _unur_call_urng(urng) * (GEN->Umax - GEN->Umin); /* look up in guide table and search for interval */ iv = GEN->guide[(int) (U * GEN->guide_size)]; U *= GEN->Atotal; while (iv->Acum < U) iv = iv->next; COOKIE_CHECK(iv,CK_TABL_IV,UNUR_INFINITY); /* reuse of uniform random number (generation of hat should be by inversion) */ U = (iv->xmax >= iv->xmin) ? (iv->Acum - U) : (U - iv->Acum + iv->Ahat); /* U in (0,Ahat) or (-Ahat,0) */ /* sample from hat distribution in interval */ X = iv->xmax + U * (iv->xmin - iv->xmax)/iv->Ahat; /* accept or reject */ V = _unur_call_urng(urng) * iv->fmax; /* a random point between 0 and hat at x */ /* below squeeze ? */ if (V <= iv->fmin) return X; /* value of PDF at x */ fx = PDF(X); /* being above squeeze is bad. split interval. */ if (GEN->n_ivs < GEN->max_ivs) { if ( (_unur_tabl_improve_hat( gen, iv, X, fx ) != UNUR_SUCCESS) && (gen->variant & TABL_VARFLAG_PEDANTIC) ) return UNUR_INFINITY; } /* below hat */ if (V <= fx) return X; /* else reject and try again */ /* use the auxilliary generator the next time (it can be the same as the main generator) */ urng = gen->urng_aux; } } /* end of _unur_tabl_rh_sample() */ /*---------------------------------------------------------------------------*/ double _unur_tabl_rh_sample_check( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator and verify that method can be used */ /* (use "classical" acceptance/rejection) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { UNUR_URNG *urng; /* pointer to uniform random number generator */ struct unur_tabl_interval *iv; double U,X,fx,V; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_TABL_GEN,UNUR_INFINITY); /* main URNG */ urng = gen->urng; while(1) { /* sample from U( Umin, Umax ) */ U = GEN->Umin + _unur_call_urng(urng) * (GEN->Umax - GEN->Umin); /* look up in guide table and search for interval */ iv = GEN->guide[(int) (U * GEN->guide_size)]; U *= GEN->Atotal; while (iv->Acum < U) iv = iv->next; COOKIE_CHECK(iv,CK_TABL_IV,UNUR_INFINITY); /* reuse of uniform random number (generation of squeeze should be inversion) */ U = (iv->xmax >= iv->xmin) ? (iv->Acum - U) : (U - iv->Acum + iv->Ahat); /* U in (0,Ahat) or (-Ahat,0) */ /* sample from hat distribution in interval */ X = iv->xmax + U * (iv->xmin - iv->xmax)/iv->Ahat; /* accept or reject */ V = _unur_call_urng(urng) * iv->fmax; /* a random point between 0 and hat at x */ /* value of PDF at x */ fx = PDF(X); /* test whether PDF is monotone */ if (_unur_FP_greater(fx,iv->fmax)) _unur_warning(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF > hat. PDF not monotone in interval"); if (_unur_FP_less(fx,iv->fmin)) _unur_warning(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF < squeeze. PDF not monotone in interval"); /* below squeeze ? */ if (V <= iv->fmin) return X; /* being above squeeze is bad. split interval. */ if (GEN->n_ivs < GEN->max_ivs) { if ( (_unur_tabl_improve_hat( gen, iv, X, fx ) != UNUR_SUCCESS) && (gen->variant & TABL_VARFLAG_PEDANTIC) ) return UNUR_INFINITY; } /* below hat */ if (V <= fx) return X; /* else reject and try again */ /* use the auxilliary generator the next time (it can be the same as the main generator) */ urng = gen->urng_aux; } } /* end of _unur_tabl_rh_sample_check() */ /*****************************************************************************/ double _unur_tabl_ia_sample( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator */ /* (use immediate acceptance) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { struct unur_tabl_interval *iv; double U,X,fx; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_TABL_GEN,UNUR_INFINITY); while(1) { /* sample from U(0,1) */ U = _unur_call_urng(gen->urng); /* look up in guide table and search for interval */ iv = GEN->guide[(int) (U * GEN->guide_size)]; U *= GEN->Atotal; while (iv->Acum < U) iv = iv->next; COOKIE_CHECK(iv,CK_TABL_IV,UNUR_INFINITY); /* reuse of uniform random number (generation from squeeze should be inversion) */ U = (iv->xmax <= iv->xmin) ? (iv->Acum - U) : (iv->Ahat + U - iv->Acum); if( U < iv->Asqueeze ) { /* below squeeze */ return( iv->xmax + (iv->Asqueeze-U) * (iv->xmin - iv->xmax)/iv->Asqueeze ); } else { /* between spueeze and hat --> have to valuate PDF */ X = iv->xmax + (U-iv->Asqueeze) * (iv->xmin - iv->xmax)/(iv->Ahat - iv->Asqueeze); fx = PDF(X); /* being above squeeze is bad. split interval. */ if (GEN->n_ivs < GEN->max_ivs) { if ( (_unur_tabl_improve_hat( gen, iv, X, fx ) != UNUR_SUCCESS) && (gen->variant & TABL_VARFLAG_PEDANTIC) ) return UNUR_INFINITY; } /* now accept or reject */ U = _unur_call_urng(gen->urng); if (fx >= U * (iv->fmax - iv->fmin) + iv->fmin) return X; } } } /* end of _unur_tabl_ia_sample() */ /*---------------------------------------------------------------------------*/ double _unur_tabl_ia_sample_check( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator and verify that method can be used */ /* (use immediate acceptance) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { struct unur_tabl_interval *iv; double U,X,fx; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_TABL_GEN,UNUR_INFINITY); while(1) { /* sample from U(0,1) */ U = _unur_call_urng(gen->urng); /* look up in guide table and search for interval */ iv = GEN->guide[(int) (U * GEN->guide_size)]; U *= GEN->Atotal; while (iv->Acum < U) iv = iv->next; COOKIE_CHECK(iv,CK_TABL_IV,UNUR_INFINITY); /* reuse of uniform random number (generation of squeeze should be inversion) */ U = (iv->xmax <= iv->xmin) ? (iv->Acum - U) : (iv->Ahat + U - iv->Acum); if( U <= iv->Asqueeze ) { /* below squeeze */ X = iv->xmax + (iv->Asqueeze-U) * (iv->xmin - iv->xmax)/iv->Asqueeze; /* test whether PDF is monotone */ fx = PDF(X); if (_unur_FP_greater(fx,iv->fmax)) _unur_warning(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF > hat. PDF not monotone in interval"); if (_unur_FP_less(fx,iv->fmin)) _unur_warning(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF < squeeze. PDF not monotone in interval"); /* at last return number */ return X; } else { /* between spueeze and hat --> have to valuate PDF */ X = iv->xmax + (U-iv->Asqueeze) * (iv->xmin - iv->xmax)/(iv->Ahat - iv->Asqueeze); fx = PDF(X); /* test whether PDF is monotone */ if (_unur_FP_greater(fx,iv->fmax)) _unur_warning(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF > hat. PDF not monotone in interval"); if (_unur_FP_less(fx,iv->fmin)) _unur_warning(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF < squeeze. PDF not monotone in interval"); /* being above squeeze is bad. split interval. */ if (GEN->n_ivs < GEN->max_ivs) { if ( (_unur_tabl_improve_hat( gen, iv, X, fx ) != UNUR_SUCCESS) && (gen->variant & TABL_VARFLAG_PEDANTIC) ) return UNUR_INFINITY; } /* now accept or reject */ U = _unur_call_urng(gen->urng); if (fx >= U * (iv->fmax - iv->fmin) + iv->fmin) return X; } } } /* end of _unur_tabl_ia_sample_check() */ /*****************************************************************************/ int _unur_tabl_improve_hat( struct unur_gen *gen, struct unur_tabl_interval *iv, double x, double fx) /*----------------------------------------------------------------------*/ /* improve hat function and by splitting interval */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* iv ... pointer to interval that has to be split */ /* x ... splitting point */ /* fx ... value of PDF at splitting point */ /* */ /* return: */ /* UNUR_SUCCESS ... improving hat successful */ /* others ... error: PDF not monotone in interval */ /*----------------------------------------------------------------------*/ { int result; /* is there any reason to improve hat ? */ if (! (GEN->max_ratio * GEN->Atotal > GEN->Asqueeze) ) { /* no more construction points (avoid calling this function any more) */ GEN->max_ivs = GEN->n_ivs; return UNUR_SUCCESS; } /* add construction point */ result = _unur_tabl_split_interval( gen, iv, x, fx,(gen->variant & TABL_VARMASK_SPLIT)); if (! (result == UNUR_SUCCESS || result == UNUR_ERR_SILENT) ) { /* condition for PDF is violated! */ _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,""); /* replace sampling routine by dummy routine that just returns UNUR_INFINITY */ SAMPLE = _unur_sample_cont_error; return UNUR_ERR_GEN_CONDITION; } /* update guide table */ /** TODO: it is not necessary to update the guide table every time. But then (1) some additional bookkeeping is required and (2) the guide table method requires a acc./rej. step. **/ if ( _unur_tabl_make_guide_table(gen) != UNUR_SUCCESS) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"cannot create guide table"); /* replace sampling routine by dummy routine that just returns UNUR_INFINITY */ SAMPLE = _unur_sample_cont_error; return UNUR_ERR_GEN_CONDITION; } /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_tabl_improve_hat() */ /*****************************************************************************/ unuran-1.11.0/src/methods/itdr.h0000644001357500135600000002452614420445767013430 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: itdr.h * * * * PURPOSE: * * function prototypes for method ITDR * * (Inverse Transformed Density Rejection) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /* =METHOD ITDR Inverse Transformed Density Rejection =UP Methods_for_CONT =REQUIRED monotone PDF, dPDF, pole =OPTIONAL splitting point between pole and tail region, c-values =SPEED Set-up: moderate, Sampling: moderate =REINIT supported =REF [HLDa07] =DESCRIPTION ITDR is an acceptance/rejection method that works for monotone densities. It is especially designed for PDFs with a single pole. It uses different hat functions for the pole region and for the tail region. For the tail region @emph{Transformed Density Rejection} with a single construction point is used. For the pole region a variant called @emph{Inverse Transformed Density Rejection} is used. The optimal splitting point between the two regions and the respective maximum local concavity and inverse local concavity (@pxref{Glossary}) that guarantee valid hat functions for each regions are estimated. This splitting point is set to the intersection point of local concavity and inverse local concavity. However, it is assumed that both, the local concavity and the inverse local concavity do not have a local minimum in the interior of the domain (which is the case for all standard distributions with a single pole). In other cases (or when the built-in search routines do not compute non-optimal values) one can provide the splitting point, and the @i{c}-values. =HOWTOUSE Method ITDR requires a distribution object with given PDF and its derivative and the location of the pole (or mode). The PDF must be monotone and may contain a pole. It must be set via the unur_distr_cont_set_pdf() and unur_distr_cont_set_dpdf() calls. The PDF should return UNUR_INFINITY for the pole. Alternatively, one can also set the logarithm of the PDF and its derivative via the unur_distr_cont_set_logpdf() and unur_distr_cont_set_dlogpdf() calls. This is in especially useful since then the setup and search routines are numerically more stable. Moreover, for many distributions computing the logarithm of the PDF is less expensive then computing the PDF directly. The pole of the distribution is given by a unur_distr_cont_set_mode() call. Notice that distributions with ``heavy'' poles may have numerical problems caused by the resultion of the floating point numbers used by computers. While the minimal distance between two different floating point numbers is about @code{1.e-320} near @code{0.} it increases to @code{1.e-16} near @code{1.} Thus any random variate generator implemented on a digital computer in fact draws samples from a discrete distribution that approximates the desired continuous distribution. For distributions with ``heavy'' poles not at 0 this approximation may be too crude and thus every goodness-of-fit test will fail. Besides this theoretic problem that cannot be resolved we have to take into consideration that round-off errors occur more frequently when we have PDFs with poles far away from @code{0.} Method ITDR tries to handles this situation as good as possible by moving the pole into @code{0.} Thus do not use a wrapper for your PDF that hides this shift since the information about the resolution of the floating point numbers near the pole gets lost. Method ITDR uses different hats for the pole region and for the tail region. The splitting point between these two regions, the optimal @i{c}-value and design points for constructing the hats using Transformed Density Rejection are computed automatically. (The results of these computations can be read using the respective calls unur_itdr_get_xi(), unur_itdr_get_cp(), and unur_itdr_get_ct() for the intersection point between local concavity and inverse local concavity, the @i{c}-value for the pole and the tail region.) However, one can also analyze the local concavity and inverse local concavity set the corresponding values using unur_itdr_set_xi(), unur_itdr_set_cp(), and unur_itdr_set_ct() calls. Notice, that @i{c}-values greater than -1/2 can be set to @code{-0.5}. Although this results in smaller acceptance probabities sampling from the hat distribution is much faster than for other values of @i{c}. Depending on the expenses of evaluating the PDF the resulting algorithm is usually faster. It is possible to change the parameters and the domain of the chosen distribution and run unur_reinit() to reinitialize the generator object. However, the values given by unur_itdr_set_xi(), unur_itdr_set_cp(), or unur_itdr_set_ct() calls are then ignored when unur_reinit() is called. =END */ /*---------------------------------------------------------------------------*/ /* Routines for user interface */ /* =ROUTINES */ UNUR_PAR *unur_itdr_new( const UNUR_DISTR *distribution ); /* Get default parameters for generator. */ /*...........................................................................*/ int unur_itdr_set_xi( UNUR_PAR *parameters, double xi ); /* Sets points where local concavity and inverse local concavity are (almost) equal. It is used to estimate the respective c-values for pole region and hat regions and to determine the splitting point @i{bx} between pole and tail region. If no such point is provided it will be computed automatically. Default: not set. */ int unur_itdr_set_cp( UNUR_PAR *parameters, double cp ); /* Sets parameter @var{cp} for transformation T for inverse density in pole region. It must be at most 0 and greater than -1. A value of @code{-0.5} is treated separately and usually results in faster marginal generation time (at the expense of smaller acceptance probabilities. If no @var{cp}-value is given it is estimated automatically. Default: not set. */ int unur_itdr_set_ct( UNUR_PAR *parameters, double ct ); /* Sets parameter @var{ct} for transformation T for density in tail region. It must be at most 0. For densities with unbounded domain it must be greater than -1. A value of @code{-0.5} is treated separately and usually results in faster marginal generation time (at the expense of smaller acceptance probabilities. If no @var{ct}-value is given it is estimated automatically. Default: not set. */ double unur_itdr_get_xi( UNUR_GEN *generator ); /* */ double unur_itdr_get_cp( UNUR_GEN *generator ); /* */ double unur_itdr_get_ct( UNUR_GEN *generator ); /* Get intersection point @var{xi}, and c-values @var{cp} and @var{ct}, respectively. (In case of an error @code{UNUR_INFINITY} is returned.) */ double unur_itdr_get_area( UNUR_GEN *generator ); /* Get area below hat. (In case of an error @code{UNUR_INFINITY} is returned.) */ int unur_itdr_set_verify( UNUR_PAR *parameters, int verify ); /* Turn verifying of algorithm while sampling on/off. If the condition @unurmath{PDF(x) \leq hat(x)} is violated for some @i{x} then @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. However, notice that this might happen due to round-off errors for a few values of @i{x} (less than 1%). Default is FALSE. */ int unur_itdr_chg_verify( UNUR_GEN *generator, int verify ); /* Change the verifying of algorithm while sampling on/off. */ /* =END */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/tabl.h0000644001357500135600000004556714420445767013420 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: tabl.h * * * * PURPOSE: * * function prototypes for method TABL * * (Ahren's TABLe method: piecewise constant hat) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /* =METHOD TABL a TABLe method with piecewise constant hats =UP Methods_for_CONT =REQUIRED PDF, all local extrema, cut-off values for the tails =OPTIONAL approximate area =SPEED Set-up: (very) slow, Sampling: fast =REINIT not implemented =REF [AJa93] [AJa95] [HLD04: Cha.5.1] =ABSTRACT Large tables necessary for heavy tailed distributions =DESCRIPTION TABL (called Ahrens method in @unurbibref{HLD04}) is an acceptance/rejection method (@pxref{Rejection}) that uses a decomposition of the domain of the distribution into many short subintervals. Inside of these subintervals constant hat and squeeze functions are utilized. Thus it is easy to use the idea of immediate acceptance for points below the squeeze. This reduces the expected number of uniform random numbers per generated random variate to less than two. Using a large number of subintervals only little more than one random number is necessary on average. Thus this method becomes very fast. Due to the constant hat function this method only works for distributions with bounded domains. Thus for unbounded domains the left and right tails have to be cut off. This is no problem when the probability of falling into these tail regions is beyond computational relevance (e.g. smaller than @code{1.e-12}). For easy construction of hat and squeeze functions it is necessary to know the regions of monotonicity (called @emph{slopes}) or equivalently all local maxima and minima of the density. The main problem for this method in the setup is the choice of the subintervals. A simple and close to optimal approach is the "equal area rule" @unurbibref{HLD04: Cha.5.1}. There the subintervals are selected such that the area below the hat is the same for each subinterval which can be realized with a simple recursion. If more subintervals are necessary it is possible to split either randomly chosen intervals (adaptive rejection sampling, ARS) or those intervals, where the ratio between squeeze and hat is smallest. This version of the setup is called derandomized ARS (DARS). With the default settings TABL is first calculating approximately 30 subintervals with the equal area rule. Then DARS is used till the desired fit of the hat is reached. A convenient measure to control the quality of the fit of hat and squeeze is the ratio (area below squeeze)/(area below hat) called @code{sqhratio} which must be smaller or equal to one. The expected number of iterations in the rejection algorithm is known to be smaller than 1/sqhratio and the expected number of evaluations of the density is bounded by @code{1/sqhratio - 1}. So values of the sqhratio close to one (e.g. @code{0.95} or @code{0.99}) lead to many subintervals. Thus a better fitting hat is constructed and the sampling algorithm becomes fast; on the other hand large tables are needed and the setup is very slow. For moderate values of sqhratio (e.g. @code{0.9} or @code{0.8}) the sampling is slower but the required tables are smaller and the setup is not so slow. It follows from the above explanations that TABL is always requiring a slow setup and that it is not very well suited for heavy-tailed distributions. =HOWTOUSE For using the TABL method UNU.RAN needs a bounded interval to which the generated variates can be restricted and information about all local extrema of the distribution. For unimodal densities it is sufficient to provide the mode of the distribution. For the case of a built-in unimodal distribution with bounded domain all these information is present in the distribution object and thus no extra input is necessary (see example_TABL1 below). For a built-in unimodal distribution with unbounded domain we should specify the cut-off values for the tails. This can be done with the unur_tabl_set_boundary() call (see example_TABL2 below). For the case that we do not set these boundaries the default values of @code{+/- 1.e20} are used. We can see in example_TABL1 that this still works fine for many standard distributions. For the case of a multimodal distribution we have to set the regions of monotonicity (called slopes) explicitly using the unur_tabl_set_slopes() command (see example_TABL3 below). To controll the fit of the hat and the size of the tables and thus the speed of the setup and the sampling it is most convenient to use the unur_tabl_set_max_sqhratio() call. The default is @code{0.9} which is a sensible value for most distributions and applications. If very large samples of a distribution are required or the evaluation of a density is very slow it may be useful to increase the sqhratio to eg. @code{0.95} or even @code{0.99}. With the unur_tabl_get_sqhratio() call we can check which sqhratio was really reached. If that value is below the desired value it is necessary to increase the maximal number of subintervals, which defaults to @code{1000}, using the unur_tabl_set_max_intervals() call. The unur_tabl_get_n_intervals() call can be used to find out the number of subintervals the setup calculated. It is also possible to set the number of intervals and their respective boundaries by means of the unur_tabl_set_cpoints() call. It is also possible to use method TABL for correlation induction (variance reduction) by setting of an auxiliary uniform random number generator via the unur_set_urng_aux() call. (Notice that this must be done after a possible unur_set_urng() call.) However, this only works when immediate acceptance is switched off by a unur_tabl_set_variant_ia() call. =END */ /*---------------------------------------------------------------------------*/ /* Routines for user interface */ /* =ROUTINES */ UNUR_PAR *unur_tabl_new( const UNUR_DISTR* distribution ); /* Get default parameters for generator. */ /*...........................................................................*/ int unur_tabl_set_variant_ia( UNUR_PAR *parameters, int use_ia ); /* Use immediate acceptance when @var{use_ia} is set to TRUE. This technique requires less uniform. If it is set to FALSE, ``classical'' acceptance/rejection from hat distribution is used. @emph{Notice:} Auxiliary uniform random number generators for correlation induction (variance reduction) can only be used when ``classical'' acceptance/rejection is used. Default: TRUE. */ int unur_tabl_set_cpoints( UNUR_PAR *parameters, int n_cpoints, const double *cpoints ); /* Set construction points for the hat function. If @var{stp} is NULL than a heuristic rule of thumb is used to get @var{n_stp} construction points. This is the default behavior. The default number of construction points is @code{30}. */ int unur_tabl_set_nstp( UNUR_PAR *parameters, int n_stp ); /* Set number of construction points for the hat function. @var{n_stp} must be greater than zero. After the setup there are about @var{n_stp} construction points. However it might be larger when a small fraction is given by the unur_tabl_set_areafraction() call. It also might be smaller for some variants. Default is @code{30}. */ int unur_tabl_set_useear( UNUR_PAR *parameters, int useear ); /* If @var{useear} is set to TRUE, the ``equal area rule'' is used, the given slopes are partitioned in such a way that the area below the hat function in each subinterval (``stripe'') has the same area (except the last the last interval which can be smaller). The area can be set by means of the unur_tabl_set_areafraction() call. Default is TRUE. */ int unur_tabl_set_areafraction( UNUR_PAR *parameters, double fraction ); /* Set parameter for the equal area rule. During the setup a piecewise constant hat is constructed, such that the area below each of these pieces (strips) is the same and equal to the (given) area below the PDF times @var{fraction} (which must be greater than zero). @emph{Important:} If the area below the PDF is not set in the distribution object, then 1 is assumed. Default is @code{0.1}. */ int unur_tabl_set_usedars( UNUR_PAR *parameters, int usedars ); /* If @var{usedars} is set to TRUE, ``derandomized adaptive rejection sampling'' (DARS) is used in the setup. Intervals, where the area between hat and squeeze is too large compared to the average area between hat and squeeze over all intervals, are split. This procedure is repeated until the ratio between squeeze and hat exceeds the bound given by unur_tabl_set_max_sqhratio() call or the maximum number of intervals is reached. Moreover, it also aborts when no more intervals can be found for splitting. For finding splitting points the arc-mean rule (a mixture of arithmetic mean and harmonic mean) is used. Default is TRUE. */ int unur_tabl_set_darsfactor( UNUR_PAR *parameters, double factor ); /* Set factor for ``derandomized adaptive rejection sampling''. This factor is used to determine the segments that are ``too large'', that is, all segments where the area between squeeze and hat is larger than @var{factor} times the average area over all intervals between squeeze and hat. Notice that all segments are split when @var{factor} is set to @code{0.}, and that there is no splitting at all when @var{factor} is set to @code{UNUR_INFINITY}. Default is @code{0.99}. There is no need to change this parameter. */ int unur_tabl_set_variant_splitmode( UNUR_PAR *parameters, unsigned splitmode ); /* There are three variants for adaptive rejection sampling. These differ in the way how an interval is split: @table @r @item splitmode @code{1} use the generated point to split the interval. @item splitmode @code{2} use the mean point of the interval. @item splitmode @code{3} use the arcmean point; suggested for distributions with heavy tails. @end table Default is splitmode @code{2}. */ int unur_tabl_set_max_sqhratio( UNUR_PAR *parameters, double max_ratio ); /* Set upper bound for the ratio (area below squeeze) / (area below hat). It must be a number between 0 and 1. When the ratio exceeds the given number no further construction points are inserted via DARS in the setup. For the case of ARS (unur_tabl_set_usedars() must be set to FALSE): Use @code{0} if no construction points should be added after the setup. Use @code{1} if added new construction points should not be stopped until the maximum number of construction points is reached. If @var{max_ratio} is close to one, many construction points are used. Default is @code{0.9}. */ double unur_tabl_get_sqhratio( const UNUR_GEN *generator ); /* Get the current ratio (area below squeeze) / (area below hat) for the generator. (In case of an error @code{UNUR_INFINITY} is returned.) */ double unur_tabl_get_hatarea( const UNUR_GEN *generator ); /* Get the area below the hat for the generator. (In case of an error @code{UNUR_INFINITY} is returned.) */ double unur_tabl_get_squeezearea( const UNUR_GEN *generator ); /* Get the area below the squeeze for the generator. (In case of an error @code{UNUR_INFINITY} is returned.) */ int unur_tabl_set_max_intervals( UNUR_PAR *parameters, int max_ivs ); /* Set maximum number of intervals. No construction points are added in or after the setup when the number of intervals suceeds @var{max_ivs}. Default is @code{1000}. */ int unur_tabl_get_n_intervals( const UNUR_GEN *generator ); /* Get the current number of intervals. (In case of an error 0 is returned.) */ int unur_tabl_set_slopes( UNUR_PAR *parameters, const double *slopes, int n_slopes ); /* Set slopes for the PDF. A slope is an interval [a,b] or [b,a] where the PDF is monotone and PDF(a) >= PDF(b). The list of slopes is given by an array @var{slopes} where each consecutive tuple (i.e. @code{(slopes[0], slopes[1])}, @code{(slopes[2], slopes[3])}, etc.) defines one slope. Slopes must be sorted (i.e. both @code{slopes[0]} and @code{slopes[1]} must not be greater than any entry of the slope @code{(slopes[2], slopes[3])}, etc.) and must not be overlapping. Otherwise no slopes are set and @var{unur_errno} is set to @code{UNUR_ERR_PAR_SET}. @emph{Notice:} @var{n_slopes} is the number of slopes (and not the length of the array @var{slopes}). @emph{Notice} that setting slopes resets the given domain for the distribution. However, in case of a standard distribution the area below the PDF is not updated. */ int unur_tabl_set_guidefactor( UNUR_PAR *parameters, double factor ); /* Set factor for relative size of the guide table for indexed search (see also method DGT @ref{DGT}). It must be greater than or equal to @code{0}. When set to @code{0}, then sequential search is used. Default is @code{1}. */ int unur_tabl_set_boundary( UNUR_PAR *parameters, double left, double right ); /* Set the left and right boundary of the computation interval. The piecewise hat is only constructed inside this interval. The probability outside of this region must not be of computational relevance. Of course @code{+/- UNUR_INFINITY} is not allowed. Default is @code{-1.e20,1.e20}. */ int unur_tabl_chg_truncated(UNUR_GEN *gen, double left, double right); /* Change the borders of the domain of the (truncated) distribution. Notice that the given truncated domain must be a subset of the domain of the given distribution. The generator always uses the intersection of the domain of the distribution and the truncated domain given by this call. The hat function will not be changed. @emph{Important:} The ratio between the area below the hat and the area below the squeeze changes when the sampling region is restricted. In particalur it becomes (very) large when sampling from the (far) tail of the distribution. Then it is better to create a generator object for the tail of distribution only. @emph{Important:} This call does not work for variant @code{IA} (immediate acceptance). In this case UNU.RAN switches @emph{automatically} to variant @code{RH} (use ``classical'' acceptance/rejection from hat distribution) and does revert to the variant originally set by the user. @emph{Important:} It is not a good idea to use adaptave rejection sampling while sampling from a domain that is a strict subset of the domain that has been used to construct the hat. For that reason adaptive adding of construction points is @emph{automatically disabled} by this call. @emph{Important:} If the CDF of the hat is (almost) the same for @var{left} and @var{right} and (almost) equal to @code{0} or @code{1}, then the truncated domain is not changed and the call returns an error code. */ int unur_tabl_set_verify( UNUR_PAR *parameters, int verify ); /* */ int unur_tabl_chg_verify( UNUR_GEN *generator, int verify ); /* Turn verifying of algorithm while sampling on/off. If the condition squeeze(@i{x}) <= PDF(@i{x}) <= hat(@i{x}) is violated for some @i{x} then @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. However notice that this might happen due to round-off errors for a few values of @i{x} (less than 1%). Default is FALSE. */ int unur_tabl_set_pedantic( UNUR_PAR *parameters, int pedantic ); /* Sometimes it might happen that unur_init() has been executed successfully. But when additional construction points are added by adaptive rejection sampling, the algorithm detects that the PDF is not monotone in the given slopes. With @var{pedantic} being TRUE, the sampling routine is exchanged by a routine that simply returns @code{UNUR_INFINITY} indicating an error. Default is FALSE. */ /* =END */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/mixt.h0000644001357500135600000001631414420445767013443 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: mixt.h * * * * PURPOSE: * * function prototypes for meta method MIXT * * (MIXTure of distributions) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2010 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /* =METHOD MIXT MIXTure of distributions =UP Meta_Methods =SPEED Set-up: fast, Sampling: depends on components =REINIT not implemented =DESCRIPTION MIXT allows to sample from a mixture of univariate distributions. Let @unurmath{f_1,\ldots,f_n} be PDFs of various distributions called the components and @unurmath{(p_1,\ldots,p_n)} be a probability vector. Then @unurmath{f(x) = p_1\cdot f_1(x) + \ldots + p_n\cdot f_n(x)} is the PDF of the so called mixture of these distributions. Method MIXT takes generator objects for the components and a probability vector and creates a generator object for this mixture. The sampling part works as follows: @enumerate @item Generate an index @i{J} as the realisation of a discrete random variate with the given probability vector. This is done by means of method DGT (@pxref{DGT,Guide Table method}). @item Generate a random variate @i{X} with PDF @unurmath{f_J.} @end enumerate When the (interior of the) domains of the the components are disjoint then it is possible to sample from the mixture by inversion, provided that the following conditions are met: @itemize @minus @item The generator objects must use an inversion method for each component. @item The domains of the PDFs @unurmath{f_i} must not overlap. @item The components must be ordered with respect to their domains. @end itemize =HOWTOUSE Create generator objects for the components of the mixture and store the corresponding pointers in an array. Store all probabilities an a double array of the same size. Create the parameter object for the generator of the mixture distribution by means of unur_mixt_new(). The components of the mixture can be any continuous or discrete univariate distributions. This also includes generators for empirical distributions and mixtures of distributions. In particular, mixtures can also be defined recursively. @emph{Remark:} The components of the mixture can be continuous or discrete distributions. The resulting mixture, however, is always a continuous distribution and thus unur_sample_cont() must be used! The inversion method can be switched on by means of unur_mixt_set_useinversion() call. However, the conditions for this method must then be met. Otherwise, initialization of the mixture object fails. =END */ /*---------------------------------------------------------------------------*/ /* Routines for user interface */ /* =ROUTINES */ UNUR_PAR *unur_mixt_new( int n, const double *prob, UNUR_GEN **comp ); /* Get default parameters for the generator for a mixture of the distributions given in the array @var{comp} (components) of length @var{n}. The probabilities are given by @var{prob}. The generators in @var{comp} must be objects for (continuous or discrete) univariate distributions */ /*...........................................................................*/ int unur_mixt_set_useinversion( UNUR_PAR *parameters, int useinv ); /* If @var{useinv} is TRUE, then the inversion method is used for sampling from the mixture distribution. However, the following conditions must be satisfied: @itemize @minus @item The generator objects must use an inversion method for each component. @item The domains of the components must not overlap. @item The components must be ordered with respect to their domains. @end itemize If one of these conditions is violated, then initialization of the mixture object fails. Default is FALSE. */ /* =END */ /*---------------------------------------------------------------------------*/ /* Yet not documented! */ double unur_mixt_eval_invcdf( const UNUR_GEN *generator, double u ); /* Evaluate inverse CDF at @var{u}. However, this requires that @var{generator} implements an inversion method. If @var{u} is out of the domain [0,1] then @code{unur_errno} is set to @code{UNUR_ERR_DOMAIN} and the respective bound of the domain of the distribution are returned (which is @code{-UNUR_INFINITY} or @code{UNUR_INFINITY} in the case of unbounded domains). */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/nrou.c0000644001357500135600000014447314420445767013450 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: nrou.c * * * * TYPE: continuous univariate random variate * * METHOD: naive ratio-of-uniforms method * * * * DESCRIPTION: * * Given PDF and (optionally) a bounding rectangle for the acceptance * * region. * * Produce a value x consistent with its density * * The bounding rectangle is computed numerically if it is not given. * * * * REQUIRED: * * pointer to the density function * * OPTIONAL: * * mode of the density * * bounding rectangle of acceptance region * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * ***************************************************************************** * * * REFERENCES: * * [1] Kinderman, A.J. and Monahan, F.J. (1977): Computer generation of * * random variables using the ratio of uniform deviates, * * ACM Trans. Math. Software 3(3), pp. 257--260. * * * * [2] Hoermann, W., Leydold J., and Derflinger, G. (2004): * * Automatic non-uniform random variate generation, Springer, Berlin. * * Section 2.4, Algorithm 2.9 (RoU), p.35 * * * ***************************************************************************** * * * The ratio-of-uniforms method introduced in [1] is a flexible method that * * is based on the following theorem: * * * * THEOREM: * * Let X be a random variable with density function f(x) = g(x) / G, * * where g(x) is a positive integrable function with support (x_0,x_1) * * not necessarily finite and G = integral g(x) dx. * * If (U,V) is uniformly distributed in * * A = {(u,v): 0 < v <= sqrt(g(u/v)), x_0 < u/v < x_1}, * * then X = V/U has probability density function f(x). * * * * Generating point (U,V) uniformly distributed in A is done by rejection * * from an enveloping region, usually from the minimal bounding rectangle. * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include #include #include "unur_methods_source.h" #include "x_gen_source.h" #include "nrou.h" #include "nrou_struct.h" #ifdef UNUR_ENABLE_INFO # include #endif /*---------------------------------------------------------------------------*/ /* Constants: */ /* Scaling factor for the computed minimum bounding rectangle. */ /* The computed rectangle (0, vmax)x(umin[d], umax[d]) is scaled by this */ /* factor, i.e. : */ /* vmax = vmax * ( 1+ NROU_RECT_SCALING) */ /* umin = umin - (umax-umin)*NROU_RECT_SCALING/2. */ /* umax = umax + (umax-umin)*NROU_RECT_SCALING/2. */ #define NROU_RECT_SCALING (1.e-4) /* The minimum bounding rectangle is computed by an numerical search */ /* algorithm. In case of unbounded domain we need a very large bound */ /* number as starting point: */ #define BD_MAX (DBL_MAX/1000.) /*---------------------------------------------------------------------------*/ /* Variants: */ #define NROU_VARFLAG_VERIFY 0x002u /* run verify mode */ /*---------------------------------------------------------------------------*/ /* Debugging flags */ /* bit 01 ... pameters and structure of generator (do not use here) */ /* bits 02-12 ... setup */ /* bits 13-24 ... adaptive steps */ /* bits 25-32 ... trace sampling */ #define NROU_DEBUG_REINIT 0x00000010u /* print parameters after reinit */ /*---------------------------------------------------------------------------*/ /* Flags for logging set calls */ #define NROU_SET_U 0x001u /* set u values of bounding rectangle */ #define NROU_SET_V 0x002u /* set v values of bounding rectangle */ #define NROU_SET_CENTER 0x004u /* set center of distribution */ #define NROU_SET_R 0x008u /* set r-parameter */ /*---------------------------------------------------------------------------*/ #define GENTYPE "NROU" /* type of generator */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_nrou_init( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* Initialize new generator. */ /*---------------------------------------------------------------------------*/ static int _unur_nrou_reinit( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Reinitialize generator. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_nrou_create( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* create new (almost empty) generator object. */ /*---------------------------------------------------------------------------*/ static int _unur_nrou_check_par( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Check parameters of given distribution and method */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_nrou_clone( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* copy (clone) generator object. */ /*---------------------------------------------------------------------------*/ static void _unur_nrou_free( struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* destroy generator object. */ /*---------------------------------------------------------------------------*/ static double _unur_nrou_sample( struct unur_gen *gen ); static double _unur_nrou_sample_check( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* sample from generator. */ /*---------------------------------------------------------------------------*/ static double _unur_aux_bound_umax(double x, void *p); static double _unur_aux_bound_umin(double x, void *p); /*---------------------------------------------------------------------------*/ /* auxiliary functions to be used in the calculation of umin/umax */ /*---------------------------------------------------------------------------*/ static int _unur_nrou_rectangle( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* compute (minimal) bounding rectangle. */ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ /* the following functions print debugging information on output stream, */ /* i.e., into the LOG file if not specified otherwise. */ /*---------------------------------------------------------------------------*/ static void _unur_nrou_debug_init( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print after generator has been initialized has completed. */ /*---------------------------------------------------------------------------*/ #endif #ifdef UNUR_ENABLE_INFO static void _unur_nrou_info( struct unur_gen *gen, int help ); /*---------------------------------------------------------------------------*/ /* create info string. */ /*---------------------------------------------------------------------------*/ #endif /*---------------------------------------------------------------------------*/ /* abbreviations */ #define DISTR_IN distr->data.cont /* data for distribution object */ #define PAR ((struct unur_nrou_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_nrou_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.cont /* data for distribution in generator object */ #define BD_LEFT domain[0] /* left boundary of domain of distribution */ #define BD_RIGHT domain[1] /* right boundary of domain of distribution */ #define SAMPLE gen->sample.cont /* pointer to sampling routine */ #define PDF(x) _unur_cont_PDF((x),(gen->distr)) /* call to PDF */ /*---------------------------------------------------------------------------*/ #define _unur_nrou_getSAMPLE(gen) \ ( ((gen)->variant & NROU_VARFLAG_VERIFY) \ ? _unur_nrou_sample_check : _unur_nrou_sample ) /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Public: User Interface (API) **/ /*****************************************************************************/ struct unur_par * unur_nrou_new( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get default parameters */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* default parameters (pointer to structure) */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_par *par; /* check arguments */ _unur_check_NULL( GENTYPE,distr,NULL ); /* check distribution */ if (distr->type != UNUR_DISTR_CONT) { _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } COOKIE_CHECK(distr,CK_DISTR_CONT,NULL); if (DISTR_IN.pdf == NULL) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PDF"); return NULL; } /* allocate structure */ par = _unur_par_new( sizeof(struct unur_nrou_par) ); COOKIE_SET(par,CK_NROU_PAR); /* copy input */ par->distr = distr; /* pointer to distribution object */ /* set default values */ PAR->umin = 0.; /* u-boundary of bounding rectangle (unknown) */ PAR->umax = 0.; /* u-boundary of bounding rectangle (unknown) */ PAR->vmax = 0.; /* v-boundary of bounding rectangle (unknown) */ PAR->center = 0.; /* center of distribution (default: 0) */ PAR->r = 1.; /* r-parameter of the generalized method */ par->method = UNUR_METH_NROU; /* method and default variant */ par->variant = 0u; /* default variant */ par->set = 0u; /* inidicate default parameters */ par->urng = unur_get_default_urng(); /* use default urng */ par->urng_aux = NULL; /* no auxilliary URNG required */ par->debug = _unur_default_debugflag; /* set default debugging flags */ /* routine for starting generator */ par->init = _unur_nrou_init; return par; } /* end of unur_nrou_new() */ /*****************************************************************************/ int unur_nrou_set_u( struct unur_par *par, double umin, double umax ) /*----------------------------------------------------------------------*/ /* Sets left and right u-boundary of bounding rectangle. */ /* */ /* parameters: */ /* umin ... left boundary of rectangle */ /* umax ... right boundary of rectangle */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, NROU ); /* check new parameter for generator */ if (!_unur_FP_greater(umax,umin)) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"umax <= umin"); return UNUR_ERR_PAR_SET; } /* store values */ PAR->umin = umin; PAR->umax = umax; /* changelog */ par->set |= NROU_SET_U; return UNUR_SUCCESS; } /* end of unur_nrou_set_u() */ /*---------------------------------------------------------------------------*/ int unur_nrou_set_v( struct unur_par *par, double vmax ) /*----------------------------------------------------------------------*/ /* Sets upper v-boundary of bounding rectangle. */ /* */ /* parameters: */ /* vmax ... upper boundary of rectangle */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, NROU ); /* check new parameter for generator */ if (vmax <= 0.) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"vmax <= 0"); return UNUR_ERR_PAR_SET; } /* store values */ PAR->vmax = vmax; /* changelog */ par->set |= NROU_SET_V; return UNUR_SUCCESS; } /* end of unur_nrou_set_v() */ /*---------------------------------------------------------------------------*/ int unur_nrou_set_center( struct unur_par *par, double center ) /*----------------------------------------------------------------------*/ /* Set the center (approximate mode) of the PDF. */ /* */ /* parameters: */ /* center ... center of distribution */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, NROU ); /* store data */ PAR->center = center; /* changelog */ par->set |= NROU_SET_CENTER; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_nrou_set_center() */ /*---------------------------------------------------------------------------*/ int unur_nrou_set_r( struct unur_par *par, double r ) /*----------------------------------------------------------------------*/ /* Sets r-parameter of the generalized ratio-of-uniforms method */ /* */ /* parameters: */ /* r ... r-parameter */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, NROU ); /* check new parameter for generator */ if (r <= 0.) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"r<=0"); return UNUR_ERR_PAR_SET; } /* store values */ PAR->r = r; /* changelog */ par->set |= NROU_SET_R; return UNUR_SUCCESS; } /* end of unur_nrou_set_r() */ /*---------------------------------------------------------------------------*/ int unur_nrou_set_verify( struct unur_par *par, int verify ) /*----------------------------------------------------------------------*/ /* turn verifying of algorithm while sampling on/off */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* verify ... 0 = no verifying, !0 = verifying */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* no verifying is the default */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, NROU ); /* we use a bit in variant */ par->variant = (verify) ? (par->variant | NROU_VARFLAG_VERIFY) : (par->variant & (~NROU_VARFLAG_VERIFY)); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_nrou_set_verify() */ /*---------------------------------------------------------------------------*/ int unur_nrou_chg_verify( struct unur_gen *gen, int verify ) /*----------------------------------------------------------------------*/ /* turn verifying of algorithm while sampling on/off */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* verify ... 0 = no verifying, !0 = verifying */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* no verifying is the default */ /*----------------------------------------------------------------------*/ { /* check input */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, NROU, UNUR_ERR_GEN_INVALID ); /* we must not change this switch when sampling has been disabled by using a pointer to the error producing routine */ if (SAMPLE == _unur_sample_cont_error) return UNUR_FAILURE; if (verify) /* turn verify mode on */ gen->variant |= NROU_VARFLAG_VERIFY; else /* turn verify mode off */ gen->variant &= ~NROU_VARFLAG_VERIFY; SAMPLE = _unur_nrou_getSAMPLE(gen); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_nrou_chg_verify() */ /*****************************************************************************/ /** Private **/ /*****************************************************************************/ struct unur_gen * _unur_nrou_init( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* initialize new generator */ /* */ /* parameters: */ /* params ... pointer to paramters for building generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); /* check input */ if ( par->method != UNUR_METH_NROU ) { _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); return NULL; } COOKIE_CHECK(par,CK_NROU_PAR,NULL); /* create a new empty generator object */ gen = _unur_nrou_create(par); _unur_par_free(par); if (!gen) return NULL; /* check parameters */ if (_unur_nrou_check_par(gen) != UNUR_SUCCESS) { _unur_nrou_free(gen); return NULL; } /* compute bounding rectangle */ if (_unur_nrou_rectangle(gen)!=UNUR_SUCCESS) { _unur_error(gen->genid , UNUR_ERR_GEN_CONDITION, "Cannot compute bounding rectangle"); _unur_nrou_free(gen); return NULL; } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_nrou_debug_init(gen); #endif return gen; } /* end of _unur_nrou_init() */ /*---------------------------------------------------------------------------*/ int _unur_nrou_reinit( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* re-initialize (existing) generator. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int rcode; /* mark U and V as unknown */ gen->set &= ~(NROU_SET_V | NROU_SET_U); /* check parameters */ if ( (rcode = _unur_nrou_check_par(gen)) != UNUR_SUCCESS) return rcode; /* (re)set sampling routine */ SAMPLE = _unur_nrou_getSAMPLE(gen); /* compute bounding rectangle */ return _unur_nrou_rectangle(gen); } /* end of _unur_nrou_reinit() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_nrou_create( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* allocate memory for generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* pointer to (empty) generator object with default settings */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_NROU_PAR,NULL); /* create new generic generator object */ gen = _unur_generic_create( par, sizeof(struct unur_nrou_gen) ); /* magic cookies */ COOKIE_SET(gen,CK_NROU_GEN); /* set generator identifier */ gen->genid = _unur_set_genid(GENTYPE); /* routines for sampling and destroying generator */ SAMPLE = _unur_nrou_getSAMPLE(gen); gen->destroy = _unur_nrou_free; gen->clone = _unur_nrou_clone; gen->reinit = _unur_nrou_reinit; /* copy some parameters into generator object */ GEN->umin = PAR->umin; /* left u-boundary of bounding rectangle */ GEN->umax = PAR->umax; /* right u-boundary of bounding rectangle */ GEN->vmax = PAR->vmax; /* upper v-boundary of bounding rectangle */ GEN->center = PAR->center; /* center of distribution */ GEN->r = PAR->r; /* r-parameter of the generalized rou-method */ #ifdef UNUR_ENABLE_INFO /* set function for creating info string */ gen->info = _unur_nrou_info; #endif /* return pointer to (almost empty) generator object */ return gen; } /* end of _unur_nrou_create() */ /*---------------------------------------------------------------------------*/ int _unur_nrou_check_par( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* check parameters of given distribution and method */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check for required data: center */ if (!(gen->set & NROU_SET_CENTER)) /* center not set via unur_nrou_set_center */ /* use center of distribution instead. */ GEN->center = unur_distr_cont_get_center(gen->distr) ; return UNUR_SUCCESS; } /* end of _unur_nrou_check_par() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_nrou_clone( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* copy (clone) generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to clone of generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { #define CLONE ((struct unur_nrou_gen*)clone->datap) struct unur_gen *clone; /* check arguments */ CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_NROU_GEN,NULL); /* create generic clone */ clone = _unur_generic_clone( gen, GENTYPE ); return clone; #undef CLONE } /* end of _unur_nrou_clone() */ /*---------------------------------------------------------------------------*/ void _unur_nrou_free( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* deallocate generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { /* check arguments */ if( !gen ) /* nothing to do */ return; /* check input */ if ( gen->method != UNUR_METH_NROU ) { _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); return; } COOKIE_CHECK(gen,CK_NROU_GEN,RETURN_VOID); /* we cannot use this generator object any more */ SAMPLE = NULL; /* make sure to show up a programming error */ /* free memory */ _unur_generic_free(gen); } /* end of _unur_nrou_free() */ /*****************************************************************************/ double _unur_nrou_sample( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { double U,V,X; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_NROU_GEN,UNUR_INFINITY); while (1) { /* generate point uniformly on rectangle */ while ( _unur_iszero(V = _unur_call_urng(gen->urng)) ); V *= GEN->vmax; U = GEN->umin + _unur_call_urng(gen->urng) * (GEN->umax - GEN->umin); /* compute X */ if (_unur_isone(GEN->r)) X = U/V + GEN->center; else X = U/pow(V,GEN->r) + GEN->center; /* inside domain ? */ if ( (X < DISTR.BD_LEFT) || (X > DISTR.BD_RIGHT) ) continue; /* accept or reject */ if (_unur_isone(GEN->r)) { /* normal rou-method with square-root */ if (V*V <= PDF(X)) return X; } else { /* generalized rou-method with pow-function */ if (V <= pow(PDF(X), 1./(1.+GEN->r)) ) return X; } } } /* end of _unur_nrou_sample() */ /*---------------------------------------------------------------------------*/ double _unur_nrou_sample_check( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator and verify that method can be used */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { double U,V,X,fx,sfx,xfx; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_NROU_GEN,UNUR_INFINITY); while (1) { /* generate point uniformly on rectangle */ while ( _unur_iszero(V = _unur_call_urng(gen->urng)) ); V *= GEN->vmax; U = GEN->umin + _unur_call_urng(gen->urng) * (GEN->umax - GEN->umin); /* compute x */ if (_unur_isone(GEN->r)) X = U/V + GEN->center; else X = U/pow(V,GEN->r) + GEN->center; /* inside domain ? */ if ( (X < DISTR.BD_LEFT) || (X > DISTR.BD_RIGHT) ) continue; /* evaluate PDF */ fx = PDF(X); /* a point on the boundary of the region of acceptance has the coordinates ( (X-center) * (fx)^(r/(1+r)), (fx)^(1/(1+r)) ). */ if (_unur_isone(GEN->r)) { /* normal rou-method with square-root */ sfx = sqrt(fx); xfx = (X-GEN->center) * sfx; } else { /* generalized rou-method with pow-function */ sfx = pow(fx, 1./(1.+GEN->r)); xfx = (X-GEN->center) * pow(fx, GEN->r/(1.+GEN->r)); } /* check hat */ if ( ( sfx > (1.+DBL_EPSILON) * GEN->vmax ) /* avoid roundoff error with FP registers */ || (xfx < (1.+UNUR_EPSILON) * GEN->umin) || (xfx > (1.+UNUR_EPSILON) * GEN->umax) ) _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF(x) > hat(x)"); /* accept or reject */ if (_unur_isone(GEN->r)) { /* normal rou-method with square-root */ if (V*V <= PDF(X)) return X; } else { /* generalized rou-method with pow-function */ if (V <= pow(PDF(X), 1./(1.+GEN->r)) ) return X; } } } /* end of _unur_nrou_sample_check() */ /*****************************************************************************/ /** Auxilliary Routines **/ /*****************************************************************************/ double _unur_aux_bound_umax(double x, void *p) /*----------------------------------------------------------------------*/ /* Auxiliary function used in the computation of the bounding rectangle */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; gen = p; /* typecast from void* to unur_gen* */ if (_unur_isone(GEN->r)) return (x-GEN->center) * sqrt( _unur_cont_PDF((x),(gen->distr)) ); else return (x-GEN->center) * pow( _unur_cont_PDF((x),(gen->distr)), GEN->r / (1.+ GEN->r) ); } /*---------------------------------------------------------------------------*/ double _unur_aux_bound_umin(double x, void *p) /*----------------------------------------------------------------------*/ /* Auxiliary function used in the computation of the bounding rectangle */ /*----------------------------------------------------------------------*/ { return (- _unur_aux_bound_umax(x,p)) ; } /*---------------------------------------------------------------------------*/ int _unur_nrou_rectangle( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* compute universal bounding rectangle */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { struct unur_funct_generic faux; /* function to be minimized/maximized */ double mode; /* position of the distribution mode */ double x, cx, sx, bx; /* parameters to be used in min/max search */ /* check arguments */ CHECK_NULL( gen, UNUR_ERR_NULL ); COOKIE_CHECK( gen,CK_NROU_GEN, UNUR_ERR_COOKIE ); /* boundary rectangle is already set */ if ((gen->set & NROU_SET_U) && (gen->set & NROU_SET_V)) { return UNUR_SUCCESS; } /* starting point in min/max algorithm */ cx=GEN->center; /* --------------------------------------------------------------------- */ /* calculation of vmax */ if (!(gen->set & NROU_SET_V)) { /* user has not provided any upper bound for v */ /* get (optional) mode if present or find it numerically */ mode = unur_distr_cont_get_mode(gen->distr); if (!_unur_isfinite(mode)) return UNUR_ERR_GENERIC; /* setting vmax to be (f(mode))^(1/(1+r)) */ GEN->vmax = pow(PDF(mode), 1./(1.+GEN->r)); /* additional scaling of boundary rectangle */ GEN->vmax = GEN->vmax * ( 1. + NROU_RECT_SCALING); /* check for bounded rectangle */ if (! _unur_isfinite(GEN->vmax)) { _unur_error(gen->genid , UNUR_ERR_GENERIC, "vmax not finite"); return UNUR_ERR_GENERIC; } } /* --------------------------------------------------------------------- */ /* calculation of umin and umax */ if (!(gen->set & NROU_SET_U)) { /* umin: */ faux.f = (UNUR_FUNCT_GENERIC*) _unur_aux_bound_umin; faux.params = gen; /* calculating start point for extremum search routine */ sx = _unur_isfinite(DISTR.BD_LEFT) ? (cx+DISTR.BD_LEFT)/2. : (cx-1.); bx = _unur_isfinite(DISTR.BD_LEFT) ? DISTR.BD_LEFT : (-BD_MAX); x = (_unur_FP_same(DISTR.BD_LEFT,cx)) ? cx : _unur_util_find_max(faux, bx, cx, sx); while (!_unur_isfinite(x) && (fabs(bx) >= UNUR_EPSILON) ) { /* _unur_util_find_max() could not yet find a suitable extremum */ /* trying with a sequence of intervals with decreasing length */ bx = bx/10.; sx = bx/2.; x = _unur_util_find_max(faux, bx, cx, sx); } /* umin */ GEN->umin = -faux.f(x,faux.params); /* and now, an analogue calculation for umax */ faux.f = (UNUR_FUNCT_GENERIC*) _unur_aux_bound_umax; faux.params = gen; /* calculating start point for extremum search routine */ sx = _unur_isfinite(DISTR.BD_RIGHT) ? (cx+DISTR.BD_RIGHT)/2. : (cx+1.); bx = _unur_isfinite(DISTR.BD_RIGHT) ? DISTR.BD_RIGHT : BD_MAX; x = (_unur_FP_same(DISTR.BD_RIGHT,cx)) ? cx: _unur_util_find_max(faux, cx, bx, sx); while (!_unur_isfinite(x) && (fabs(bx) >= UNUR_EPSILON) ) { /* _unur_util_find_max() could not yet find a suitable extremum */ /* trying with a sequence of intervals with decreasing length */ bx = bx/10.; sx = bx/2.; x = _unur_util_find_max(faux, cx, bx, sx); } /* umax */ GEN->umax = faux.f(x,faux.params); /* additional scaling of boundary rectangle */ GEN->umin = GEN->umin - (GEN->umax-GEN->umin)*NROU_RECT_SCALING/2.; GEN->umax = GEN->umax + (GEN->umax-GEN->umin)*NROU_RECT_SCALING/2.; /* check for bounded rectangle */ if (! (_unur_isfinite(GEN->umin) && _unur_isfinite(GEN->umax))) { _unur_error(gen->genid , UNUR_ERR_GENERIC, "umin or umax not finite"); return UNUR_ERR_GENERIC; } } /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_nrou_rectangle() */ /*****************************************************************************/ /** Debugging utilities **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ void _unur_nrou_debug_init( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write info about generator into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_NROU_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: type = continuous univariate random variates\n",gen->genid); fprintf(LOG,"%s: method = nrou (naive ratio-of-uniforms)\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); _unur_distr_cont_debug( gen->distr, gen->genid ); fprintf(LOG,"%s: sampling routine = _unur_nrou_sample",gen->genid); if (gen->variant & NROU_VARFLAG_VERIFY) fprintf(LOG,"_check"); fprintf(LOG,"()\n%s:\n",gen->genid); /* parameters */ fprintf(LOG,"%s: r-parameter = %g",gen->genid, GEN->r); _unur_print_if_default(gen,NROU_SET_R); fprintf(LOG,"\n%s:\n",gen->genid); /* center */ fprintf(LOG,"%s: center = %g\n",gen->genid,GEN->center); fprintf(LOG,"%s:\n",gen->genid); /* bounding rectangle */ fprintf(LOG,"%s: Rectangle:\n",gen->genid); fprintf(LOG,"%s: left upper point = (%g,%g)\n",gen->genid,GEN->umin,GEN->vmax); fprintf(LOG,"%s: right upper point = (%g,%g)\n",gen->genid,GEN->umax,GEN->vmax); fprintf(LOG,"%s:\n",gen->genid); } /* end of _unur_nrou_debug_init() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_INFO /*---------------------------------------------------------------------------*/ void _unur_nrou_info( struct unur_gen *gen, int help ) /*----------------------------------------------------------------------*/ /* create character string that contains information about the */ /* given generator object. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* help ... whether to print additional comments */ /*----------------------------------------------------------------------*/ { struct unur_string *info = gen->infostr; struct unur_distr *distr = gen->distr; int samplesize = 10000; double harea; /* generator ID */ _unur_string_append(info,"generator ID: %s\n\n", gen->genid); /* distribution */ _unur_string_append(info,"distribution:\n"); _unur_distr_info_typename(gen); _unur_string_append(info," functions = PDF\n"); _unur_string_append(info," domain = (%g, %g)\n", DISTR.domain[0],DISTR.domain[1]); _unur_string_append(info," center = %g", unur_distr_cont_get_center(distr)); if ( !(distr->set & UNUR_DISTR_SET_CENTER) ) { if ( distr->set & UNUR_DISTR_SET_MODE ) _unur_string_append(info," [= mode]\n"); else _unur_string_append(info," [default]\n"); } else { _unur_string_append(info,"\n"); } if (help) { if ( distr->set & UNUR_DISTR_SET_MODE_APPROX ) _unur_string_append(info,"\n[ Hint: %s\n\t%s ]\n", "You may provide the \"mode\" or at least", "the \"center\" (a point near the mode)."); } _unur_string_append(info,"\n"); /* method */ _unur_string_append(info,"method: NROU (Naive Ratio-Of-Uniforms)\n"); _unur_string_append(info," r = %g\n\n", GEN->r); /* performance */ _unur_string_append(info,"performance characteristics:\n"); _unur_string_append(info," bounding rectangle = (%g,%g) x (%g,%g)\n", GEN->umin,GEN->umax, 0.,GEN->vmax); harea = (GEN->umax - GEN->umin) * GEN->vmax; _unur_string_append(info," area(hat) = %g\n", harea); _unur_string_append(info," rejection constant "); if (distr->set & UNUR_DISTR_SET_PDFAREA) _unur_string_append(info,"= %g\n", 2. * harea / DISTR.area); else _unur_string_append(info,"= %.2f [approx.]\n", unur_test_count_urn(gen,samplesize,0,NULL)/(2.*samplesize)); _unur_string_append(info,"\n"); /* parameters */ if (help) { _unur_string_append(info,"parameters:\n"); _unur_string_append(info," r = %g %s\n", GEN->r, (gen->set & NROU_SET_R) ? "" : "[default]"); _unur_string_append(info," center = %g %s\n",GEN->center, (gen->set & NROU_SET_CENTER) ? "" : "[default]"); _unur_string_append(info," v = %g %s\n", GEN->vmax, (gen->set & NROU_SET_V) ? "" : "[numeric.]"); _unur_string_append(info," u = (%g, %g) %s\n", GEN->umin,GEN->umax, (gen->set & NROU_SET_U) ? "" : "[numeric.]"); if (gen->variant & NROU_VARFLAG_VERIFY) _unur_string_append(info," verify = on\n"); _unur_string_append(info,"\n"); } /* Hints */ if (help) { if ( !(gen->set & NROU_SET_V) ) _unur_string_append(info,"[ Hint: %s ]\n", "You can set \"v\" to avoid numerical estimate." ); if ( !(gen->set & NROU_SET_U) ) _unur_string_append(info,"[ Hint: %s ]\n", "You can set \"u\" to avoid slow (and inexact) numerical estimates." ); _unur_string_append(info,"\n"); } } /* end of _unur_nrou_info() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_INFO */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/auto_struct.h0000644001357500135600000000623114420304141015007 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: unif_struct.h * * * * PURPOSE: * * declares structures for method AUTO * * (selects a method for a given distribution object AUTOmatically) * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Information for constructing the generator */ struct unur_auto_par { int logss; /* logarithm of sample size */ }; /*---------------------------------------------------------------------------*/ /* The generator object */ struct unur_auto_gen { int dummy; /* there is no generator object */ }; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/gibbs.c0000644001357500135600000017110214420445767013540 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: gibbs.c * * * * TYPE: continuous multivariate random variate * * METHOD: Gibbs sampler using full conditional distributions. * * * * DESCRIPTION: * * Given PDF * * Produce a value x consistent with its density * * * * REQUIRED: * * pointer to the density function and its derivatives * * * * OPTIONAL: * * mode of the density * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * ***************************************************************************** * * * REFERENCES: * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include #include #include #include "unur_methods_source.h" #include "x_gen.h" #include "x_gen_source.h" #include "arou.h" #include "ars.h" #include "tdr.h" #include "gibbs.h" #include "gibbs_struct.h" #ifdef UNUR_ENABLE_INFO # include #endif /*---------------------------------------------------------------------------*/ /* Variants */ #define GIBBS_VARMASK_VARIANT 0x000fu /* indicates variant */ #define GIBBS_VARIANT_COORD 0x0001u /* coordinate sampler */ #define GIBBS_VARIANT_RANDOMDIR 0x0002u /* random direction sampler */ #define GIBBS_VARMASK_T 0x00f0u /* indicates transformation */ #define GIBBS_VAR_T_SQRT 0x0010u /* T(x) = -1/sqrt(x) */ #define GIBBS_VAR_T_LOG 0x0020u /* T(x) = log(x) */ #define GIBBS_VAR_T_POW 0x0030u /* T(x) = -x^c */ /*---------------------------------------------------------------------------*/ /* Debugging flags */ /* bit 01 ... pameters and structure of generator (do not use here) */ /* bits 02-12 ... setup */ /* bits 13-24 ... adaptive steps */ /* bits 25-32 ... trace sampling */ #define GIBBS_DEBUG_CONDI 0x01000000u /*---------------------------------------------------------------------------*/ /* Flags for logging set calls */ #define GIBBS_SET_C 0x001u /* set parameter for transformation T */ #define GIBBS_SET_X0 0x002u /* set starting point */ #define GIBBS_SET_THINNING 0x004u /* set thinning factor */ #define GIBBS_SET_BURNIN 0x008u /* set length of burn-in */ /*---------------------------------------------------------------------------*/ #define GENTYPE "GIBBS" /* type of generator */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_gibbs_init( struct unur_par *par ); static int _unur_gibbs_coord_init( struct unur_gen *gen ); static int _unur_gibbs_randomdir_init( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Initialize new generator. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_gibbs_create( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* create new (almost empty) generator object. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_gibbs_clone( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* copy (clone) generator object. */ /*---------------------------------------------------------------------------*/ static void _unur_gibbs_free( struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* destroy generator object. */ /*---------------------------------------------------------------------------*/ static int _unur_gibbs_coord_sample_cvec( struct unur_gen *gen, double *vec ); static int _unur_gibbs_randomdir_sample_cvec( struct unur_gen *gen, double *vec ); /*---------------------------------------------------------------------------*/ /* sample from generator */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_gibbs_normalgen( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* create a normal random variate generator */ /*---------------------------------------------------------------------------*/ static void _unur_gibbs_random_unitvector( struct unur_gen *gen, double *direction ); /*---------------------------------------------------------------------------*/ /* generate a random direction vector */ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ /* the following functions print debugging information on output stream, */ /* i.e., into the LOG file if not specified otherwise. */ /*---------------------------------------------------------------------------*/ static void _unur_gibbs_debug_init_start( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print before init of generator starts. */ /*---------------------------------------------------------------------------*/ static void _unur_gibbs_debug_init_condi( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print list of conditional generators. */ /*---------------------------------------------------------------------------*/ static void _unur_gibbs_debug_burnin_failed( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* print after burnin has failed. */ /*---------------------------------------------------------------------------*/ static void _unur_gibbs_debug_init_finished( const struct unur_gen *gen, int success ); /*---------------------------------------------------------------------------*/ /* print after generator has been initialized has completed. */ /*---------------------------------------------------------------------------*/ #endif #ifdef UNUR_ENABLE_INFO static void _unur_gibbs_info( struct unur_gen *gen, int help ); /*---------------------------------------------------------------------------*/ /* create info string. */ /*---------------------------------------------------------------------------*/ #endif /*---------------------------------------------------------------------------*/ /* abbreviations */ #define DISTR_IN distr->data.cvec /* data for distribution object */ #define PAR ((struct unur_gibbs_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_gibbs_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.cvec /* data for distribution in generator object */ #define SAMPLE gen->sample.cvec /* pointer to sampling routine */ /* generators for conditional distributions */ #define GEN_CONDI gen->gen_aux_list /* an auxiliary generator for standard normal variates */ #define GEN_NORMAL gen->gen_aux /*---------------------------------------------------------------------------*/ static UNUR_SAMPLING_ROUTINE_CVEC * _unur_gibbs_getSAMPLE( struct unur_gen *gen ) { switch (gen->variant & GIBBS_VARMASK_VARIANT) { case GIBBS_VARIANT_RANDOMDIR: return _unur_gibbs_randomdir_sample_cvec; case GIBBS_VARIANT_COORD: default: return _unur_gibbs_coord_sample_cvec; } } /* end of _unur_gibbs_getSAMPLE() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Public: User Interface (API) **/ /*****************************************************************************/ struct unur_par * unur_gibbs_new( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get default parameters */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* default parameters (pointer to structure) */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_par *par; /* check arguments */ _unur_check_NULL( GENTYPE,distr,NULL ); /* check distribution */ if (distr->type != UNUR_DISTR_CVEC) { _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } COOKIE_CHECK(distr,CK_DISTR_CVEC,NULL); if (DISTR_IN.logpdf == NULL) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"logPDF"); return NULL; } if (DISTR_IN.dlogpdf == NULL) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"dlogPDF"); return NULL; } /* allocate structure */ par = _unur_par_new( sizeof(struct unur_gibbs_par) ); COOKIE_SET(par,CK_GIBBS_PAR); /* copy input */ par->distr = distr; /* pointer to distribution object */ /* set default values */ PAR->c_T = 0.; /* parameter for transformation (-1. <= c < 0.) */ par->method = UNUR_METH_GIBBS ; /* method */ par->variant = GIBBS_VARIANT_COORD; /* default variant */ par->set = 0u; /* inidicate default parameters */ par->urng = unur_get_default_urng(); /* use default urng */ par->urng_aux = NULL; /* no auxilliary URNG required */ PAR->thinning = 1; /* thinning factor */ PAR->burnin = 0; /* length of burn-in for chain */ PAR->x0 = NULL; /* starting point of chain, default is 0 */ par->debug = _unur_default_debugflag; /* set default debugging flags */ /* routine for starting generator */ par->init = _unur_gibbs_init; return par; } /* end of unur_gibbs_new() */ /*****************************************************************************/ int unur_gibbs_set_variant_coordinate( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* Coordinate Sampler : */ /* Sampling along the coordinate directions (cyclic). */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, GIBBS ); /* we use a bit in variant */ par->variant = (par->variant & ~GIBBS_VARMASK_VARIANT) | GIBBS_VARIANT_COORD; /* ok */ return UNUR_SUCCESS; } /* end of unur_gibbs_set_variant_coordinate() */ /*---------------------------------------------------------------------------*/ int unur_gibbs_set_variant_random_direction( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* Random Direction Sampler : */ /* Sampling along the random directions. */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, GIBBS ); /* we use a bit in variant */ par->variant = (par->variant & ~GIBBS_VARMASK_VARIANT) | GIBBS_VARIANT_RANDOMDIR; /* ok */ return UNUR_SUCCESS; } /* end of unur_gibbs_set_variant_coordinate() */ /*---------------------------------------------------------------------------*/ int unur_gibbs_set_c( struct unur_par *par, double c ) /*----------------------------------------------------------------------*/ /* set parameter c for transformation T_c used for sampling from */ /* conditional distributions */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* c ... parameter c */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, GIBBS ); /* check new parameter for generator */ if (c > 0.) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"c > 0"); return UNUR_ERR_PAR_SET; } /** TODO: ... **/ /* if (c <= -1.) { */ /* _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"c <= -1 only if domain is bounded. Use `TABL' method then."); */ /* return 0; */ /* } */ /** TODO: ... **/ if (c < -0.5) { _unur_error(GENTYPE,UNUR_ERR_PAR_SET,"c < -0.5 not implemented yet"); return UNUR_ERR_PAR_SET; } if (!_unur_iszero(c) && c > -0.5) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"-0.5 < c < 0 not recommended. using c = -0.5 instead."); c = -0.5; } /* store date */ PAR->c_T = c; /* changelog */ par->set |= GIBBS_SET_C; return UNUR_SUCCESS; } /* end of unur_gibbs_set_c() */ /*---------------------------------------------------------------------------*/ int unur_gibbs_set_startingpoint( struct unur_par *par, const double *x0) /*----------------------------------------------------------------------*/ /* set starting point for chain */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* x0 ... starting point of chain */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, GIBBS ); /* store data */ PAR->x0 = x0; /* changelog */ par->set |= GIBBS_SET_X0; /* ok */ return UNUR_SUCCESS; } /* end of unur_gibbs_set_startingpoint() */ /*---------------------------------------------------------------------------*/ int unur_gibbs_set_thinning( struct unur_par *par, int thinning ) /*----------------------------------------------------------------------*/ /* set thinning factor for chain */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* thinning ... thinning factor */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, GIBBS ); /* check new parameter for generator */ if (thinning < 1) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"thinning < 1"); return UNUR_ERR_PAR_SET; } /* store data */ PAR->thinning = thinning; /* changelog */ par->set |= GIBBS_SET_THINNING; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_gibbs_set_thinning() */ /*---------------------------------------------------------------------------*/ int unur_gibbs_set_burnin( struct unur_par *par, int burnin ) /*----------------------------------------------------------------------*/ /* set length of burn-in for chain */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* burnin ... length of burn-in */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, GIBBS ); /* check new parameter for generator */ if (burnin < 0) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"burnin < 0"); return UNUR_ERR_PAR_SET; } /* store data */ PAR->burnin = burnin; /* changelog */ par->set |= GIBBS_SET_BURNIN; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_gibbs_set_burnin() */ /*---------------------------------------------------------------------------*/ const double * unur_gibbs_get_state( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* get current state of the Gibbs chain */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to chain ... on success */ /* NULL ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, NULL ); if (gen->method != UNUR_METH_GIBBS) { _unur_error(gen->genid, UNUR_ERR_GEN_INVALID,""); return NULL; } return GEN->state; } /* end of unur_gibbs_get_state() */ /*---------------------------------------------------------------------------*/ int unur_gibbs_chg_state( struct unur_gen *gen, const double *state ) /*----------------------------------------------------------------------*/ /* chg current state of the Gibbs chain */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* state ... new state of chain */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, GIBBS, UNUR_ERR_GEN_INVALID ); _unur_check_NULL( gen->genid, state, UNUR_ERR_NULL ); /* copy state */ memcpy( GEN->state, state, GEN->dim * sizeof(double)); return UNUR_SUCCESS; } /* end of unur_gibbs_chg_state() */ /*---------------------------------------------------------------------------*/ int unur_gibbs_reset_state( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* reset current state of the Gibbs chain to starting point */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, GIBBS, UNUR_ERR_GEN_INVALID ); /* copy state */ memcpy( GEN->state, GEN->x0, GEN->dim * sizeof(double)); if (gen->variant & GIBBS_VARIANT_COORD) GEN->coord = (GEN->dim)-1; return UNUR_SUCCESS; } /* end of unur_gibbs_reset_state() */ /*****************************************************************************/ /** Private **/ /*****************************************************************************/ struct unur_gen * _unur_gibbs_init( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* initialize new generator */ /* */ /* parameters: */ /* par ... pointer to paramters for building generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ _unur_check_NULL( GENTYPE,par,NULL ); /* check input */ if ( par->method != UNUR_METH_GIBBS ) { _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); return NULL; } COOKIE_CHECK(par,CK_GIBBS_PAR,NULL); /* create a new empty generator object */ gen = _unur_gibbs_create(par); _unur_par_free(par); if (!gen) return NULL; #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_gibbs_debug_init_start(gen); #endif /* make generators for conditional distributions */ switch (gen->variant & GIBBS_VARMASK_VARIANT) { case GIBBS_VARIANT_COORD: /* --- coordinate direction sampling --- */ if (_unur_gibbs_coord_init(gen)!=UNUR_SUCCESS) { _unur_gibbs_free(gen); return NULL; } break; case GIBBS_VARIANT_RANDOMDIR: /* --- random direction sampling --- */ if (_unur_gibbs_randomdir_init(gen)!=UNUR_SUCCESS) { _unur_gibbs_free(gen); return NULL; } break; default: _unur_error(GENTYPE,UNUR_ERR_SHOULD_NOT_HAPPEN,""); _unur_gibbs_free(gen); return NULL; } #ifdef UNUR_ENABLE_LOGGING if (gen->debug) _unur_gibbs_debug_init_condi(gen); #endif /* run burn-in */ if (GEN->burnin > 0 ) { int thinning, burnin; double *X; /* allocate memory for random vector */ X = _unur_xmalloc( GEN->dim * sizeof(double) ); /* store thinning factor; we use 1 for burn-in */ thinning = GEN->thinning; GEN->thinning = 1; for (burnin = GEN->burnin; burnin>0; --burnin) { if ( _unur_sample_vec(gen,X) != UNUR_SUCCESS ) { #ifdef UNUR_ENABLE_LOGGING _unur_gibbs_debug_burnin_failed(gen); if (gen->debug) _unur_gibbs_debug_init_finished(gen,FALSE); #endif _unur_gibbs_free(gen); free (X); return NULL; } } /* restore thinning factor */ GEN->thinning = thinning; /* free memory for random vector */ free (X); } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_gibbs_debug_init_finished(gen,TRUE); #endif /* o.k. */ return gen; } /* end of _unur_gibbs_init() */ /*---------------------------------------------------------------------------*/ int _unur_gibbs_coord_init( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* initialize new generator for coordinate sampler */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { struct unur_par *par_condi; struct unur_gen *gen_condi; int i; int errorcode = UNUR_SUCCESS; /* conditional distribution object */ GEN->distr_condi = unur_distr_condi_new( gen->distr, GEN->state, NULL, 0); for (i=0; idim; i++) { if ( (errorcode=unur_distr_condi_set_condition(GEN->distr_condi,GEN->state,NULL,i)) != UNUR_SUCCESS ) break; /* make parameter object */ switch( gen->variant & GIBBS_VARMASK_T ) { case GIBBS_VAR_T_LOG: /* use more robust method ARS for T = log */ par_condi = unur_ars_new(GEN->distr_condi); unur_ars_set_reinit_percentiles(par_condi,2,NULL); break; case GIBBS_VAR_T_SQRT: /* we only have method TDR for T = -1/sqrt */ par_condi = unur_tdr_new(GEN->distr_condi); unur_tdr_set_reinit_percentiles(par_condi,2,NULL); unur_tdr_set_c(par_condi,-0.5); unur_tdr_set_usedars(par_condi,FALSE); unur_tdr_set_variant_gw(par_condi); break; case GIBBS_VAR_T_POW: default: _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); return UNUR_ERR_SHOULD_NOT_HAPPEN; } /* we do not need a private copy since otherwise we cannot update the generator object */ unur_set_use_distr_privatecopy( par_condi, FALSE ); /* debugging messages from the conditional generator should be rare */ /* otherwise the size if the LOG file explodes */ unur_set_debug( par_condi, (gen->debug&GIBBS_DEBUG_CONDI)?gen->debug:(gen->debug?1u:0u)); /* we use the same URNG for all auxiliary generators */ unur_set_urng( par_condi, gen->urng ); /* init generator object for sampling from conditional distributions */ gen_condi = unur_init(par_condi); if (gen_condi == NULL) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION, "Cannot create generator for conditional distributions"); #ifdef UNUR_ENABLE_LOGGING if (gen->debug) _unur_gibbs_debug_init_finished(gen,FALSE); #endif errorcode = UNUR_ERR_GEN_CONDITION; break; } /* store pointer to generator of conditional distribution */ GEN_CONDI[i] = gen_condi; if (i==0 && DISTR.domainrect==NULL) { /* when the domain is not bounded by a rectangle we only */ /* need a clone for each dimension (except the first one) */ for (i=1; idim; i++) GEN_CONDI[i] = unur_gen_clone(gen_condi); break; } } return errorcode; } /* end of _unur_gibbs_coord_init() */ /*---------------------------------------------------------------------------*/ int _unur_gibbs_randomdir_init( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* initialize new generator for random direction sampler */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { struct unur_par *par_condi; struct unur_gen *gen_condi; /* we need an auxiliary generator for normal random variates */ GEN_NORMAL = _unur_gibbs_normalgen( gen ); if ( GEN_NORMAL == NULL ) return UNUR_FAILURE; /* conditional distribution object */ _unur_gibbs_random_unitvector( gen, GEN->direction ); GEN->distr_condi = unur_distr_condi_new( gen->distr, GEN->state, GEN->direction, 0); /* make parameter object */ switch( gen->variant & GIBBS_VARMASK_T ) { case GIBBS_VAR_T_LOG: /* use more robust method ARS for T = log */ par_condi = unur_ars_new(GEN->distr_condi); unur_ars_set_reinit_percentiles(par_condi,2,NULL); break; case GIBBS_VAR_T_SQRT: /* we only have method TDR for T = -1/sqrt */ par_condi = unur_tdr_new(GEN->distr_condi); unur_tdr_set_reinit_percentiles(par_condi,2,NULL); unur_tdr_set_c(par_condi,-0.5); unur_tdr_set_usedars(par_condi,FALSE); break; case GIBBS_VAR_T_POW: default: _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); return UNUR_ERR_SHOULD_NOT_HAPPEN; } /* we do not need a private copy since otherwise we cannot update the generator object */ unur_set_use_distr_privatecopy( par_condi, FALSE ); /* debugging messages from the conditional generator should be rare */ /* otherwise the size if the LOG file explodes */ unur_set_debug( par_condi, (gen->debug&GIBBS_DEBUG_CONDI)?gen->debug:(gen->debug?1u:0u)); /* we use the same URNG for all auxiliary generators */ unur_set_urng( par_condi, gen->urng ); /* init generator object for sampling from conditional distributions */ gen_condi = unur_init(par_condi); if (gen_condi == NULL) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION, "Cannot create generator for conditional distributions"); #ifdef UNUR_ENABLE_LOGGING if (gen->debug) _unur_gibbs_debug_init_finished(gen,FALSE); #endif return UNUR_ERR_GEN_CONDITION; } /* store generator in structure. we only need one such generator */ *GEN_CONDI = gen_condi; return UNUR_SUCCESS; } /* end of _unur_gibbs_randomdir_init() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_gibbs_create( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* allocate memory for generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* pointer to (empty) generator object with default settings */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; int i; /* check arguments */ CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_GIBBS_PAR,NULL); /* create new generic generator object */ gen = _unur_generic_create( par, sizeof(struct unur_gibbs_gen) ); /* magic cookies */ COOKIE_SET(gen,CK_GIBBS_GEN); /* dimension of distribution */ GEN->dim = gen->distr->dim; /* set generator identifier */ gen->genid = _unur_set_genid(GENTYPE); /* which transformation for conditional distributions */ if ( _unur_iszero(PAR->c_T) ) par->variant = (par->variant & (~GIBBS_VARMASK_T)) | GIBBS_VAR_T_LOG; else if (_unur_FP_same(PAR->c_T, -0.5)) par->variant = (par->variant & (~GIBBS_VARMASK_T)) | GIBBS_VAR_T_SQRT; else par->variant = (par->variant & (~GIBBS_VARMASK_T)) | GIBBS_VAR_T_POW; /* routines for sampling and destroying generator */ SAMPLE = _unur_gibbs_getSAMPLE(gen); gen->destroy = _unur_gibbs_free; gen->clone = _unur_gibbs_clone; /* variant of sampling method */ gen->variant = par->variant; /* copy parameters into generator object */ GEN->thinning = PAR->thinning; /* thinning factor */ GEN->burnin = PAR->burnin; /* length of burnin */ GEN->c_T = PAR->c_T; /* parameter for transformation */ /* allocate memory for state */ GEN->state = _unur_xmalloc( GEN->dim * sizeof(double)); GEN->x0 = _unur_xmalloc( GEN->dim * sizeof(double)); if (PAR->x0 == NULL) PAR->x0 = unur_distr_cvec_get_center(gen->distr); memcpy( GEN->state, PAR->x0, GEN->dim * sizeof(double)); memcpy( GEN->x0, PAR->x0, GEN->dim * sizeof(double)); /* generator(s) for conditional distributions */ GEN->distr_condi = NULL; GEN_CONDI = _unur_xmalloc( GEN->dim * sizeof(struct unur_gen *) ); gen->n_gen_aux_list = GEN->dim; /* size of array GEN_CONDI */ for (i=0; idim; i++) GEN_CONDI[i] = NULL; /* allocate memory for random direction */ GEN->direction = _unur_xmalloc( GEN->dim * sizeof(double)); /* defaults */ GEN->coord = (GEN->dim)-1; /* current coordinate of GIBBS chain. we want to start with coordinate 0. */ #ifdef UNUR_ENABLE_INFO /* set function for creating info string */ gen->info = _unur_gibbs_info; #endif /* return pointer to (almost empty) generator object */ return gen; } /* end of _unur_gibbs_create() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_gibbs_clone( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* copy (clone) generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to clone of generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { #define CLONE ((struct unur_gibbs_gen*)clone->datap) #define CLONE_CONDI clone->gen_aux_list int i; struct unur_gen *clone; /* check arguments */ CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_GIBBS_GEN,NULL); /* create generic clone */ clone = _unur_generic_clone( gen, GENTYPE ); /* copy state */ CLONE->state = _unur_xmalloc( GEN->dim * sizeof(double)); memcpy( CLONE->state, GEN->state, GEN->dim * sizeof(double)); CLONE->x0 = _unur_xmalloc( GEN->dim * sizeof(double)); memcpy( CLONE->x0, GEN->x0, GEN->dim * sizeof(double)); /* copy generators for conditional distributions */ if (GEN->distr_condi) CLONE->distr_condi = _unur_distr_clone( GEN->distr_condi ); /* GEN_CONDI is cloned by _unur_generic_clone */ /* however, these use a pointer to GEN->distr which must be updated, too */ if (CLONE_CONDI) { for (i=0; idim; i++) if (CLONE_CONDI[i]) CLONE_CONDI[i]->distr = CLONE->distr_condi; } /* allocate memory for random direction */ CLONE->direction = _unur_xmalloc( GEN->dim * sizeof(double)); return clone; #undef CLONE #undef CLONE_CONDI } /* end of _unur_gibbs_clone() */ /*---------------------------------------------------------------------------*/ void _unur_gibbs_free( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* deallocate generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { /* check arguments */ if( !gen ) /* nothing to do */ return; /* check input */ if ( gen->method != UNUR_METH_GIBBS ) { _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); return; } COOKIE_CHECK(gen,CK_GIBBS_GEN,RETURN_VOID); /* we cannot use this generator object any more */ SAMPLE = NULL; /* make sure to show up a programming error */ /* free vectors */ if (GEN->state) free (GEN->state); if (GEN->x0) free (GEN->x0); if (GEN->direction) free (GEN->direction); /* free conditional distribution object */ if (GEN->distr_condi) _unur_distr_free (GEN->distr_condi); /* GEN_CONDI is freed by _unur_generic_free */ _unur_generic_free(gen); } /* end of _unur_gibbs_free() */ /*****************************************************************************/ int _unur_gibbs_coord_sample_cvec( struct unur_gen *gen, double *vec ) /*----------------------------------------------------------------------*/ /* sample from generator */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* vec ... random vector (result) */ /*----------------------------------------------------------------------*/ { double X; int thinning; /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_GIBBS_GEN,UNUR_ERR_COOKIE); for (thinning = GEN->thinning; thinning > 0; --thinning) { /* update coordinate direction */ GEN->coord = (GEN->coord + 1) % GEN->dim; /* check state of chain */ if (!_unur_isfinite(GEN->state[GEN->coord])) /* there has been a fatal error during the last sampling from the conditional distribution. This probably has been caused by improper target distribution for which the method does not work (i.e., it is not T-concave). */ continue; /* update conditional distribution */ unur_distr_condi_set_condition( GEN->distr_condi, GEN->state, NULL, GEN->coord); /* reinit generator object */ if (unur_reinit(GEN_CONDI[GEN->coord]) == UNUR_SUCCESS) { /* sample from distribution */ X = unur_sample_cont(GEN_CONDI[GEN->coord]); if (_unur_isfinite(X)) { /* update state */ GEN->state[GEN->coord] = X; continue; } } /* ERROR: reset to starting point */ _unur_warning(gen->genid,UNUR_ERR_GEN_SAMPLING,"reset chain"); unur_gibbs_reset_state(gen); return UNUR_FAILURE; } /* copy current state into given vector */ memcpy(vec, GEN->state, GEN->dim * sizeof(double)); return UNUR_SUCCESS; } /* end of _unur_gibbs_coord_sample_cvec() */ /*---------------------------------------------------------------------------*/ int _unur_gibbs_randomdir_sample_cvec( struct unur_gen *gen, double *vec ) /*----------------------------------------------------------------------*/ /* sample from generator */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* vec ... random vector (result) */ /*----------------------------------------------------------------------*/ { int i; double X; int thinning; /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_GIBBS_GEN,UNUR_ERR_COOKIE); for (thinning = GEN->thinning; thinning > 0; --thinning) { /* check state of chain */ if (!_unur_isfinite(GEN->state[0])) /* there has been a fatal error during the last sampling from the conditional distribution. This probably has been caused by improper target distribution for which the method does not work (i.e., it is not T-concave). */ break; /* new random direction */ _unur_gibbs_random_unitvector( gen, GEN->direction ); /* update conditional distribution */ unur_distr_condi_set_condition( GEN->distr_condi, GEN->state, GEN->direction, 0); /* reinit generator object */ if (unur_reinit(*GEN_CONDI) == UNUR_SUCCESS) { /* sample from distribution */ X = unur_sample_cont(*GEN_CONDI); if (_unur_isfinite(X)) { /* update state */ for (i=0; idim; i++) GEN->state[i] += X * GEN->direction[i]; continue; } } /* ERROR: reset to starting point */ _unur_warning(gen->genid,UNUR_ERR_GEN_SAMPLING,"reset chain"); unur_gibbs_reset_state(gen); return UNUR_FAILURE; } /* copy current state into given vector */ memcpy(vec, GEN->state, GEN->dim * sizeof(double)); return UNUR_SUCCESS; } /* end of _unur_gibbs_randomdir_sample_cvec() */ /*****************************************************************************/ /** Auxilliary Routines **/ /*****************************************************************************/ struct unur_gen * _unur_gibbs_normalgen( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* create a normal random variate generator */ /* */ /* parameters: */ /* gen ... pointer to GIBBS generator object */ /* */ /* */ /*----------------------------------------------------------------------*/ { struct unur_gen *normalgen; struct unur_distr *normaldistr = unur_distr_normal(NULL,0); struct unur_par *normalpar = unur_arou_new( normaldistr ); unur_arou_set_usedars( normalpar, TRUE ); normalgen = unur_init( normalpar ); _unur_distr_free( normaldistr ); if (normalgen == NULL) { _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN, "Cannot create aux Gaussian generator"); return NULL; } /* uniform random number generator and debugging flags */ normalgen->urng = gen->urng; normalgen->debug = gen->debug; return normalgen; } /* end of _unur_gibbs_normalgen() */ /*---------------------------------------------------------------------------*/ void _unur_gibbs_random_unitvector( struct unur_gen *gen, double *direction ) /*----------------------------------------------------------------------*/ /* generate a random direction vector */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* direction ... random vector (result) */ /*----------------------------------------------------------------------*/ { int i; do { for (i=0; idim; i++) direction[i] = unur_sample_cont(GEN_NORMAL); /* normalize direction vector */ _unur_vector_normalize(GEN->dim, direction); /* there is an extremely small change that direction is the null before normalizing. In this case non of its coordinates are finite. */ } while (!_unur_isfinite(direction[0])); } /* end of _unur_gibbs_random_unitvector() */ /*****************************************************************************/ /** Debugging utilities **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ void _unur_gibbs_debug_init_start( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write info about generator into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_GIBBS_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: type = continuous multivariate random variates\n",gen->genid); fprintf(LOG,"%s: method = GIBBS (Markov Chain - GIBBS sampler)\n",gen->genid); fprintf(LOG,"%s: variant = ",gen->genid); switch (gen->variant & GIBBS_VARMASK_VARIANT) { case GIBBS_VARIANT_COORD: fprintf(LOG,"coordinate sampling (original Gibbs sampler) [default]\n"); break; case GIBBS_VARIANT_RANDOMDIR: fprintf(LOG,"random directions\n"); break; } fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: transformation T_c(x) for TDR method = ",gen->genid); switch( gen->variant & GIBBS_VARMASK_T ) { case GIBBS_VAR_T_LOG: fprintf(LOG,"log(x) ... c = 0"); break; case GIBBS_VAR_T_SQRT: fprintf(LOG,"-1/sqrt(x) ... c = -1/2"); break; case GIBBS_VAR_T_POW: fprintf(LOG,"-x^(%g) ... c = %g",GEN->c_T,GEN->c_T); break; } _unur_print_if_default(gen,GIBBS_SET_C); fprintf(LOG,"\n%s:\n",gen->genid); _unur_distr_cvec_debug( gen->distr, gen->genid ); switch (gen->variant & GIBBS_VARMASK_VARIANT) { case GIBBS_VARIANT_COORD: fprintf(LOG,"%s: sampling routine = _unur_gibbs_coord_sample()\n",gen->genid); break; case GIBBS_VARIANT_RANDOMDIR: fprintf(LOG,"%s: sampling routine = _unur_gibbs_randomdir_sample()\n",gen->genid); break; } fprintf(LOG,"%s: thinning = %d",gen->genid,GEN->thinning); _unur_print_if_default(gen,GIBBS_SET_THINNING); fprintf(LOG,"\n%s: burn-in = %d",gen->genid,GEN->burnin); _unur_print_if_default(gen,GIBBS_SET_BURNIN); fprintf(LOG,"\n%s:\n",gen->genid); _unur_matrix_print_vector( GEN->dim, GEN->x0, "starting point = ", LOG, gen->genid, "\t "); fprintf(LOG,"%s:\n",gen->genid); } /* end of _unur_gibbs_debug_init_start() */ /*---------------------------------------------------------------------------*/ void _unur_gibbs_debug_init_finished( const struct unur_gen *gen, int success ) /*----------------------------------------------------------------------*/ /* write info about generator into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* success ... whether init has failed or not */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_GIBBS_GEN,RETURN_VOID); LOG = unur_get_stream(); if (success) fprintf(LOG,"%s: INIT completed **********************\n",gen->genid); else fprintf(LOG,"%s: INIT failed **********************\n",gen->genid); } /* end of _unur_gibbs_debug_init_finished() */ /*---------------------------------------------------------------------------*/ void _unur_gibbs_debug_burnin_failed( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write info after burnin has failed */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_GIBBS_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s: Burn-in failed --> INIT failed **********************\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); } /* end of _unur_gibbs_debug_burnin_failed() */ /*---------------------------------------------------------------------------*/ void _unur_gibbs_debug_init_condi( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* write list of conditional generators into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { int i; FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_GIBBS_GEN,RETURN_VOID); LOG = unur_get_stream(); switch (gen->variant & GIBBS_VARMASK_VARIANT) { case GIBBS_VARIANT_COORD: fprintf(LOG,"%s: generators for full conditional distributions = \n",gen->genid); fprintf(LOG,"%s:\t",gen->genid); for (i=0; idim; i++) fprintf(LOG,"[%s] ", GEN_CONDI[i]->genid); fprintf(LOG,"\n%s:\n",gen->genid); break; case GIBBS_VARIANT_RANDOMDIR: fprintf(LOG,"%s: generators for full conditional distributions = [%s]\n",gen->genid, GEN_CONDI[0]->genid); fprintf(LOG,"%s: generator for random directions = [%s]\n",gen->genid, GEN_NORMAL->genid); fprintf(LOG,"%s:\n",gen->genid); break; } } /* end of _unur_gibbs_debug_init_condi() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_INFO /*---------------------------------------------------------------------------*/ void _unur_gibbs_info( struct unur_gen *gen, int help ) /*----------------------------------------------------------------------*/ /* create character string that contains information about the */ /* given generator object. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* help ... whether to print additional comments */ /*----------------------------------------------------------------------*/ { struct unur_string *info = gen->infostr; struct unur_distr *distr = gen->distr; int samplesize = 10000; /* generator ID */ _unur_string_append(info,"generator ID: %s\n\n", gen->genid); /* distribution */ _unur_string_append(info,"distribution:\n"); _unur_distr_info_typename(gen); _unur_string_append(info," dimension = %d\n",GEN->dim); _unur_string_append(info," functions = PDF dPDF\n"); _unur_distr_cvec_info_domain(gen); _unur_string_append(info," center = "); _unur_distr_info_vector( gen, unur_distr_cvec_get_center(gen->distr), GEN->dim); if ( !(distr->set & UNUR_DISTR_SET_CENTER) ) { if ( distr->set & UNUR_DISTR_SET_MODE ) _unur_string_append(info," [= mode]"); else _unur_string_append(info," [default]"); } _unur_string_append(info,"\n\n"); /* if (help) { */ /* _unur_string_append(info,"\n"); */ /* } */ /* method */ _unur_string_append(info,"method: GIBBS (GIBBS sampler [MCMC])\n"); _unur_string_append(info," variant = %s\n", ((gen->variant & GIBBS_VARMASK_VARIANT)==GIBBS_VARIANT_COORD) ? "coordinate sampling [default]" : "random direction sampling"); /* used transformation */ _unur_string_append(info," T_c(x) = "); switch( gen->variant & GIBBS_VARMASK_T ) { case GIBBS_VAR_T_LOG: _unur_string_append(info,"log(x) ... c = 0\n"); break; case GIBBS_VAR_T_SQRT: _unur_string_append(info,"-1/sqrt(x) ... c = -1/2\n"); break; case GIBBS_VAR_T_POW: _unur_string_append(info,"-x^(%g) ... c = %g\n",GEN->c_T,GEN->c_T); break; } _unur_string_append(info," thinning = %d\n", GEN->thinning); _unur_string_append(info,"\n"); /* performance */ _unur_string_append(info,"performance characteristics:\n"); _unur_string_append(info," rejection constant = %.2f [approx.]\n", unur_test_count_urn(gen,samplesize,0,NULL)/(2.*samplesize)); _unur_string_append(info,"\n"); /* parameters */ if (help) { _unur_string_append(info,"parameters:\n"); switch (gen->variant & GIBBS_VARMASK_VARIANT) { case GIBBS_VARIANT_COORD: _unur_string_append(info," variant_coordinate [default]\n"); break; case GIBBS_VARIANT_RANDOMDIR: _unur_string_append(info," variant_random_direction\n"); break; } _unur_string_append(info," c = %g %s\n", GEN->c_T, (gen->set & GIBBS_SET_C) ? "" : "[default]"); _unur_string_append(info," thinning = %d %s\n", GEN->thinning, (gen->set & GIBBS_SET_THINNING) ? "" : "[default]"); _unur_string_append(info," burnin = %d %s\n", GEN->burnin, (gen->set & GIBBS_SET_THINNING) ? "" : "[default]"); _unur_string_append(info,"\n"); /* Not displayed: int unur_gibbs_set_startingpoint( UNUR_PAR *parameters, const double *x0 ); */ } /* Hints */ /* if (help) { */ /* _unur_string_append(info,"\n"); */ /* } */ } /* end of _unur_gibbs_info() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_INFO */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/dext.h0000644001357500135600000002034214420445767013422 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: dext.h * * * * PURPOSE: * * function prototypes for method DEXT * * (wrapper for Continuous EXTernal generators) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /* =METHOD DEXT wrapper for Discrete EXTernal generators =UP Methods_for_DISCR =REQUIRED routine for sampling discrete random variates =SPEED depends on external generator =REINIT supported =DESCRIPTION Method DEXT is a wrapper for external generators for discrete univariate distributions. It allows the usage of external random variate generators within the UNU.RAN framework. =HOWTOUSE The following steps are required to use some external generator within the UNU.RAN framework (some of these are optional): @enumerate @item Make an empty generator object using a unur_dext_new() call. The argument @var{distribution} is optional and can be replaced by NULL. However, it is required if you want to pass parameters of the generated distribution to the external generator or for running some validation tests provided by UNU.RAN. @item Create an initialization routine of type @code{int (*init)(UNUR_GEN *gen)} and plug it into the generator object using the unur_dext_set_init() call. Notice that the @var{init} routine must return @code{UNUR_SUCCESS} when it has been executed successfully and @code{UNUR_FAILURE} otherwise. It is possible to get the size of and the pointer to the array of parameters of the underlying distribution object by the respective calls unur_dext_get_ndistrparams() and unur_dext_get_distrparams(). Parameters for the external generator that are computed in the @var{init} routine can be stored in a single array or structure which is available by the unur_dext_get_params() call. Using an @var{init} routine is optional and can be omitted. @item Create a sampling routine of type @code{int (*sample)(UNUR_GEN *gen)} and plug it into the generator object using the unur_dext_set_sample() call. Uniform random numbers are provided by the unur_sample_urng() call. Do not use your own implementation of a uniform random number generator directly. If you want to use your own random number generator we recommend to use the UNU.RAN interface (see @pxref{URNG,,Using uniform random number generators}). The array or structure that contains parameters for the external generator that are computed in the @var{init} routine are available using the unur_dext_get_params() call. Using a @var{sample} routine is of course obligatory. @end enumerate It is possible to change the parameters and the domain of the chosen distribution and run unur_reinit() to reinitialize the generator object. The @var{init} routine is then called again. Here is a short example that demonstrates the application of this method by means of the geometric distribution: @smallexample @include ref_example_dext.texi @end smallexample =END */ /*---------------------------------------------------------------------------*/ /* Routines for user interface */ /* =ROUTINES */ UNUR_PAR *unur_dext_new( const UNUR_DISTR *distribution ); /* Get default parameters for new generator. */ /*...........................................................................*/ int unur_dext_set_init( UNUR_PAR *parameters, int (*init)(UNUR_GEN *gen) ); /* Set initialization routine for external generator. Inside the @emph{Important:} The routine @var{init} must return @code{UNUR_SUCCESS} when the generator was initialized successfully and @code{UNUR_FAILURE} otherwise. Parameters that are computed in the @var{init} routine can be stored in an array or structure that is avaiable by means of the unur_dext_get_params() call. Parameters of the underlying distribution object can be obtained by the unur_dext_get_distrparams() call. */ int unur_dext_set_sample( UNUR_PAR *parameters, int (*sample)(UNUR_GEN *gen) ); /* Set sampling routine for external generator. @emph{Important:} Use @code{unur_sample_urng(gen)} to get a uniform random number. The pointer to the array or structure that contains the parameters that are precomputed in the @var{init} routine are available by @code{unur_dext_get_params(gen,0)}. Additionally one can use the unur_dext_get_distrparams() call. */ void *unur_dext_get_params( UNUR_GEN *generator, size_t size ); /* Get pointer to memory block for storing parameters of external generator. A memory block of size @var{size} is automatically (re-) allocated if necessary and the pointer to this block is stored in the @var{generator} object. If one only needs the pointer to this memory block set @var{size} to @code{0}. Notice, that @var{size} is the size of the memory block and not the length of an array. @emph{Important:} This rountine should only be used in the initialization and sampling routine of the external generator. */ double *unur_dext_get_distrparams( UNUR_GEN *generator ); /* */ int unur_dext_get_ndistrparams( UNUR_GEN *generator ); /* Get size of and pointer to array of parameters of underlying distribution in @var{generator} object. @emph{Important:} These rountines should only be used in the initialization and sampling routine of the external generator. */ /*...........................................................................*/ /* =END */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/deprecated_methods.c0000644001357500135600000020436214420445767016302 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: deprecated_methods.c * * * * Deprecated routines * * * ***************************************************************************** * * * THESE ROUTINES SHOULD NOT BE USED ANY MORE! * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include "unur_methods_source.h" #include "utdr_struct.h" #include "x_gen.h" #include "deprecated_methods.h" /*---------------------------------------------------------------------------*/ #ifdef USE_DEPRECATED_CODE /*---------------------------------------------------------------------------*/ #define GENTYPE "deprecated" /* type of generator */ #define BD_LEFT domain[0] /* left boundary of domain of distribution */ #define BD_RIGHT domain[1] /* right boundary of domain of distribution */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Public: User Interface (API) **/ /*****************************************************************************/ int unur_cstd_chg_pdfparams( struct unur_gen *gen, double *params, int n_params ) /*----------------------------------------------------------------------*/ /* Deprecated call! */ /*----------------------------------------------------------------------*/ /* change array of parameters for distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* params ... list of arguments */ /* n_params ... number of arguments */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* IMPORTANT: The given parameters are not checked against domain */ /* errors (in opposition to the unur__new() call). */ /* */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, CSTD, UNUR_ERR_GEN_INVALID ); if (n_params>0) CHECK_NULL(params, UNUR_ERR_NULL); /* set new parameters in distribution object */ if (unur_distr_cont_set_pdfparams(gen->distr, params,n_params)!=UNUR_SUCCESS) return UNUR_ERR_DISTR_SET; /* reinit */ return gen->reinit(gen); } /* end of unur_cstd_chg_pdfparams() */ /*****************************************************************************/ #define DISTR gen->distr->data.discr /* data for distribution in generator object */ /*---------------------------------------------------------------------------*/ int unur_dari_reinit( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* Deprecated call! */ /*----------------------------------------------------------------------*/ /* re-initialize (existing) generator. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, DARI, UNUR_ERR_GEN_INVALID ); return gen->reinit(gen); } /* end of unur_dari_reinit() */ /*---------------------------------------------------------------------------*/ int unur_dari_chg_pmfparams( struct unur_gen *gen, double *params, int n_params ) /*----------------------------------------------------------------------*/ /* Deprecated call! */ /*----------------------------------------------------------------------*/ /* change array of parameters for distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* params ... list of arguments */ /* n_params ... number of arguments */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* IMPORTANT: The given parameters are not checked against domain */ /* errors (in opposition to the unur__new() call). */ /* */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, DARI, UNUR_ERR_GEN_INVALID ); /* set new parameters in distribution object */ return unur_distr_discr_set_pmfparams(gen->distr,params,n_params); } /* end of unur_dari_chg_pmfparams() */ /*---------------------------------------------------------------------------*/ int unur_dari_chg_domain( struct unur_gen *gen, int left, int right ) /*----------------------------------------------------------------------*/ /* Deprecated call! */ /*----------------------------------------------------------------------*/ /* change the left and right borders of the domain of the distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* left ... left boundary point */ /* right ... right boundary point */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* INT_MIN and INT_MAX are interpreted as (minus) infinity. */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, DARI, UNUR_ERR_GEN_INVALID ); /* check new parameter for generator */ if (left >= right) { _unur_warning(NULL,UNUR_ERR_DISTR_SET,"domain, left >= right"); return UNUR_ERR_DISTR_SET; } /* copy new boundaries into generator object */ DISTR.BD_LEFT = left; DISTR.BD_RIGHT = right; /* changelog */ gen->distr->set |= UNUR_DISTR_SET_DOMAIN; #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ #endif /* o.k. */ return UNUR_SUCCESS; } /* end of unur_dari_chg_domain() */ /*---------------------------------------------------------------------------*/ int unur_dari_chg_mode( struct unur_gen *gen, int mode ) /*----------------------------------------------------------------------*/ /* Deprecated call! */ /*----------------------------------------------------------------------*/ /* change mode of distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* mode ... mode */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, DARI, UNUR_ERR_GEN_INVALID ); /* copy parameters */ DISTR.mode = mode; /* changelog */ gen->distr->set |= UNUR_DISTR_SET_MODE; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_dari_chg_mode() */ /*---------------------------------------------------------------------------*/ int unur_dari_upd_mode( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* Deprecated call! */ /*----------------------------------------------------------------------*/ /* recompute mode of distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, DARI, UNUR_ERR_GEN_INVALID ); return unur_distr_discr_upd_mode( gen->distr ); } /* end of unur_dari_upd_mode() */ /*---------------------------------------------------------------------------*/ int unur_dari_chg_pmfsum( struct unur_gen *gen, double sum ) /*----------------------------------------------------------------------*/ /* Deprecated call! */ /*----------------------------------------------------------------------*/ /* change sum over PMF of distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* sum ... sum */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, DARI, UNUR_ERR_GEN_INVALID ); /* check new parameter for generator */ if (sum <= 0.) { _unur_warning(NULL,UNUR_ERR_DISTR_SET,"sum <= 0"); return UNUR_ERR_DISTR_SET; } /* copy parameters */ DISTR.sum = sum; /* no changelog required */ /* o.k. */ return UNUR_SUCCESS; } /* end of unur_dari_chg_pmfsum() */ /*---------------------------------------------------------------------------*/ int unur_dari_upd_pmfsum( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* Deprecated call! */ /*----------------------------------------------------------------------*/ /* recompute sum over PMF of distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, DARI, UNUR_ERR_GEN_INVALID ); return unur_distr_discr_upd_pmfsum( gen->distr ); } /* end of unur_dari_upd_pmfsum() */ /*---------------------------------------------------------------------------*/ #undef DISTR /*****************************************************************************/ #define DISTR gen->distr->data.discr /* data for distribution in generator object */ /*---------------------------------------------------------------------------*/ int unur_dsrou_reinit( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* Deprecated call! */ /*----------------------------------------------------------------------*/ /* re-initialize (existing) generator. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, DSROU, UNUR_ERR_GEN_DATA ); return gen->reinit(gen); } /* end of unur_dsrou_reinit() */ /*---------------------------------------------------------------------------*/ int unur_dsrou_chg_pmfparams( struct unur_gen *gen, double *params, int n_params ) /*----------------------------------------------------------------------*/ /* Deprecated call! */ /*----------------------------------------------------------------------*/ /* change array of parameters for distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* params ... list of arguments */ /* n_params ... number of arguments */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* IMPORTANT: The given parameters are not checked against domain */ /* errors (in opposition to the unur__new() call). */ /* */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, DSROU, UNUR_ERR_GEN_INVALID ); /* set new parameters in distribution object */ return unur_distr_discr_set_pmfparams(gen->distr,params,n_params); } /* end of unur_dsrou_chg_pmfparams() */ /*---------------------------------------------------------------------------*/ int unur_dsrou_chg_mode( struct unur_gen *gen, int mode ) /*----------------------------------------------------------------------*/ /* Deprecated call! */ /*----------------------------------------------------------------------*/ /* change mode of distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* mode ... mode */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, DSROU, UNUR_ERR_GEN_INVALID ); /* copy parameters */ DISTR.mode = mode; /* no changelog required */ /* o.k. */ return UNUR_SUCCESS; } /* end of unur_dsrou_chg_mode() */ /*---------------------------------------------------------------------------*/ int unur_dsrou_upd_mode( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* Deprecated call! */ /*----------------------------------------------------------------------*/ /* recompute mode of distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, DSROU, UNUR_ERR_GEN_INVALID ); return unur_distr_discr_upd_mode( gen->distr ); } /* end of unur_dsrou_upd_mode() */ /*---------------------------------------------------------------------------*/ int unur_dsrou_chg_domain( struct unur_gen *gen, int left, int right ) /*----------------------------------------------------------------------*/ /* Deprecated call! */ /*----------------------------------------------------------------------*/ /* change the left and right borders of the domain of the distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* left ... left boundary point */ /* right ... right boundary point */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, DSROU, UNUR_ERR_GEN_INVALID ); /* check new parameter for generator */ if (left >= right) { _unur_warning(gen->genid,UNUR_ERR_DISTR_SET,"domain, left >= right"); return UNUR_ERR_DISTR_SET; } /* copy new boundaries into generator object */ DISTR.BD_LEFT = left; DISTR.BD_RIGHT = right; /* changelog */ gen->distr->set &= ~(UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_MASK_DERIVED ); gen->distr->set |= UNUR_DISTR_SET_DOMAIN; #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ #endif /* o.k. */ return UNUR_SUCCESS; } /* end of unur_dsrou_chg_domain() */ /*---------------------------------------------------------------------------*/ int unur_dsrou_chg_pmfsum( struct unur_gen *gen, double sum ) /*----------------------------------------------------------------------*/ /* Deprecated call! */ /*----------------------------------------------------------------------*/ /* change sum over PMF of distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* sum ... sum */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, DSROU, UNUR_ERR_GEN_INVALID ); /* check new parameter for generator */ if (sum <= 0.) { _unur_warning(gen->genid,UNUR_ERR_DISTR_SET,"sum <= 0"); return UNUR_ERR_DISTR_SET; } /* copy parameters */ DISTR.sum = sum; /* no changelog required */ /* o.k. */ return UNUR_SUCCESS; } /* end of unur_dsrou_chg_pmfsum() */ /*---------------------------------------------------------------------------*/ int unur_dsrou_upd_pmfsum( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* Deprecated call! */ /*----------------------------------------------------------------------*/ /* recompute sum over PMF of distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, DSROU, UNUR_ERR_GEN_INVALID ); return unur_distr_discr_upd_pmfsum( gen->distr ); } /* end of unur_dsrou_upd_pmfsum() */ /*---------------------------------------------------------------------------*/ #undef DISTR /*****************************************************************************/ int unur_dstd_chg_pmfparams( struct unur_gen *gen, double *params, int n_params ) /*----------------------------------------------------------------------*/ /* change array of parameters for distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* params ... list of arguments */ /* n_params ... number of arguments */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, DSTD, UNUR_ERR_GEN_INVALID ); if (n_params>0) CHECK_NULL(params, UNUR_ERR_NULL); /* set new parameters in distribution object */ if (unur_distr_discr_set_pmfparams(gen->distr,params,n_params)!=UNUR_SUCCESS) return UNUR_ERR_GEN_DATA; /* reinit */ return gen->reinit(gen); } /* end of unur_dstd_chg_pmfparams() */ /*****************************************************************************/ int unur_ninv_chg_pdfparams( struct unur_gen *gen, double *params, int n_params ) /*----------------------------------------------------------------------*/ /* Deprecated call! */ /*----------------------------------------------------------------------*/ /* change array of parameters for distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* params ... list of arguments */ /* n_params ... number of arguments */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ CHECK_NULL(gen, UNUR_ERR_NULL); _unur_check_gen_object( gen, NINV, UNUR_ERR_GEN_INVALID ); if (n_params>0) CHECK_NULL(params, UNUR_ERR_NULL); /* set new parameters in distribution object */ if (unur_distr_cont_set_pdfparams(gen->distr,params,n_params)!=UNUR_SUCCESS) return UNUR_ERR_GEN_DATA; /* reinit */ return gen->reinit(gen); } /* end of unur_ninv_chg_pdfparams() */ /*****************************************************************************/ #define DISTR gen->distr->data.cont /* data for distribution in generator object */ /*---------------------------------------------------------------------------*/ int unur_srou_reinit( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* Deprecated call! */ /*----------------------------------------------------------------------*/ /* re-initialize (existing) generator. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, SROU, UNUR_ERR_GEN_INVALID ); return gen->reinit(gen); } /* end of unur_srou_reinit() */ /*---------------------------------------------------------------------------*/ int unur_srou_chg_pdfparams( struct unur_gen *gen, double *params, int n_params ) /*----------------------------------------------------------------------*/ /* Deprecated call! */ /*----------------------------------------------------------------------*/ /* change array of parameters for distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* params ... list of arguments */ /* n_params ... number of arguments */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* IMPORTANT: The given parameters are not checked against domain */ /* errors (in opposition to the unur__new() call). */ /* */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, SROU, UNUR_ERR_GEN_INVALID ); /* set new parameters in distribution object */ return unur_distr_cont_set_pdfparams(gen->distr,params,n_params); } /* end of unur_srou_chg_pdfparams() */ /*---------------------------------------------------------------------------*/ int unur_srou_chg_mode( struct unur_gen *gen, double mode ) /*----------------------------------------------------------------------*/ /* Deprecated call! */ /*----------------------------------------------------------------------*/ /* change mode of distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* mode ... mode */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, SROU, UNUR_ERR_GEN_INVALID ); /* copy parameters */ DISTR.mode = mode; /* no changelog required */ /* o.k. */ return UNUR_SUCCESS; } /* end of unur_srou_chg_mode() */ /*---------------------------------------------------------------------------*/ int unur_srou_upd_mode( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* Deprecated call! */ /*----------------------------------------------------------------------*/ /* recompute mode of distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, SROU, UNUR_ERR_GEN_INVALID ); return unur_distr_cont_upd_mode( gen->distr ); } /* end of unur_srou_upd_mode() */ /*---------------------------------------------------------------------------*/ int unur_srou_chg_domain( struct unur_gen *gen, double left, double right ) /*----------------------------------------------------------------------*/ /* Deprecated call! */ /*----------------------------------------------------------------------*/ /* change the left and right borders of the domain of the distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* left ... left boundary point */ /* right ... right boundary point */ /* */ /* comment: */ /* the new boundary points may be +/- UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, SROU, UNUR_ERR_GEN_INVALID ); /* check new parameter for generator */ if (left >= right) { _unur_warning(gen->genid,UNUR_ERR_DISTR_SET,"domain, left >= right"); return UNUR_ERR_DISTR_SET; } /* copy new boundaries into generator object */ DISTR.BD_LEFT = left; DISTR.BD_RIGHT = right; /* changelog */ gen->distr->set &= ~(UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_MASK_DERIVED ); gen->distr->set |= UNUR_DISTR_SET_DOMAIN; #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ #endif /* o.k. */ return UNUR_SUCCESS; } /* end of unur_srou_chg_domain() */ /*---------------------------------------------------------------------------*/ int unur_srou_chg_pdfarea( struct unur_gen *gen, double area ) /*----------------------------------------------------------------------*/ /* Deprecated call! */ /*----------------------------------------------------------------------*/ /* change area below PDF of distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* area ... area */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, SROU, UNUR_ERR_GEN_INVALID ); /* check new parameter for generator */ if (area <= 0.) { _unur_warning(gen->genid,UNUR_ERR_DISTR_SET,"area <= 0"); return UNUR_ERR_DISTR_SET; } /* copy parameters */ DISTR.area = area; /* no changelog required */ /* o.k. */ return UNUR_SUCCESS; } /* end of unur_srou_chg_pdfarea() */ /*---------------------------------------------------------------------------*/ int unur_srou_upd_pdfarea( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* Deprecated call! */ /*----------------------------------------------------------------------*/ /* recompute area below PDF of distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, SROU, UNUR_ERR_GEN_INVALID ); return unur_distr_cont_upd_pdfarea( gen->distr ); } /* end of unur_srou_upd_pdfarea() */ /*---------------------------------------------------------------------------*/ #undef DISTR /*****************************************************************************/ #define DISTR gen->distr->data.cont /* data for distribution in generator object */ /*---------------------------------------------------------------------------*/ int unur_ssr_reinit( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* Deprecated call! */ /*----------------------------------------------------------------------*/ /* re-initialize (existing) generator. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, SSR, UNUR_ERR_GEN_INVALID ); return gen->reinit(gen); } /* end of unur_ssr_reinit() */ /*---------------------------------------------------------------------------*/ int unur_ssr_chg_pdfparams( struct unur_gen *gen, double *params, int n_params ) /*----------------------------------------------------------------------*/ /* Deprecated call! */ /*----------------------------------------------------------------------*/ /* change array of parameters for distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* params ... list of arguments */ /* n_params ... number of arguments */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* IMPORTANT: The given parameters are not checked against domain */ /* errors (in opposition to the unur__new() call). */ /* */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, SSR, UNUR_ERR_GEN_INVALID ); /* set new parameters in distribution object */ return unur_distr_cont_set_pdfparams( gen->distr, params,n_params ); } /* end of unur_ssr_chg_pdfparams() */ /*---------------------------------------------------------------------------*/ int unur_ssr_chg_mode( struct unur_gen *gen, double mode ) /*----------------------------------------------------------------------*/ /* Deprecated call! */ /*----------------------------------------------------------------------*/ /* change mode of distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* mode ... mode */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, SSR, UNUR_ERR_GEN_INVALID ); /* copy parameters */ DISTR.mode = mode; /* no changelog required */ /* o.k. */ return UNUR_SUCCESS; } /* end of unur_ssr_chg_mode() */ /*---------------------------------------------------------------------------*/ int unur_ssr_upd_mode( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* Deprecated call! */ /*----------------------------------------------------------------------*/ /* recompute mode of distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, SSR, UNUR_ERR_GEN_INVALID ); return unur_distr_cont_upd_mode( gen->distr ); } /* end of unur_ssr_upd_mode() */ /*---------------------------------------------------------------------------*/ int unur_ssr_chg_domain( struct unur_gen *gen, double left, double right ) /*----------------------------------------------------------------------*/ /* Deprecated call! */ /*----------------------------------------------------------------------*/ /* change the left and right borders of the domain of the distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* left ... left boundary point */ /* right ... right boundary point */ /* */ /* comment: */ /* the new boundary points may be +/- UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, SSR, UNUR_ERR_GEN_INVALID ); /* check new parameter for generator */ if (left >= right) { _unur_warning(NULL,UNUR_ERR_DISTR_SET,"domain, left >= right"); return UNUR_ERR_DISTR_SET; } /* copy new boundaries into generator object */ DISTR.BD_LEFT = left; DISTR.BD_RIGHT = right; /* changelog */ gen->distr->set &= ~(UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_MASK_DERIVED ); gen->distr->set |= UNUR_DISTR_SET_DOMAIN; #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ #endif /* o.k. */ return UNUR_SUCCESS; } /* end of unur_ssr_chg_domain() */ /*---------------------------------------------------------------------------*/ int unur_ssr_chg_pdfarea( struct unur_gen *gen, double area ) /*----------------------------------------------------------------------*/ /* Deprecated call! */ /*----------------------------------------------------------------------*/ /* change area below PDF of distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* area ... area */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, SSR, UNUR_ERR_GEN_INVALID ); /* check new parameter for generator */ if (area <= 0.) { _unur_warning(NULL,UNUR_ERR_DISTR_SET,"area <= 0"); return UNUR_ERR_DISTR_SET; } /* copy parameters */ DISTR.area = area; /* no changelog required */ /* o.k. */ return UNUR_SUCCESS; } /* end of unur_ssr_chg_pdfarea() */ /*---------------------------------------------------------------------------*/ int unur_ssr_upd_pdfarea( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* Deprecated call! */ /*----------------------------------------------------------------------*/ /* recompute area below PDF of distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, SSR, UNUR_ERR_GEN_INVALID ); return unur_distr_cont_upd_pdfarea( gen->distr ); } /* end of unur_ssr_upd_pdfarea() */ /*---------------------------------------------------------------------------*/ #undef DISTR /*****************************************************************************/ int unur_tdr_reinit( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* Deprecated call! */ /*----------------------------------------------------------------------*/ /* re-initialize (existing) generator. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE,gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, TDR, UNUR_ERR_GEN_INVALID ); return gen->reinit(gen); } /* end of unur_tdr_reinit() */ /*****************************************************************************/ int unur_tdrgw_reinit( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* Deprecated call! */ /*----------------------------------------------------------------------*/ /* Remark: method TDRGW has been renamed into ARS! */ /*----------------------------------------------------------------------*/ /* re-initialize (existing) generator. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE,gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, ARS, UNUR_ERR_GEN_INVALID ); return gen->reinit(gen); } /* end of unur_tdrgw_reinit() */ /*****************************************************************************/ #define DISTR gen->distr->data.cont /* data for distribution in generator object */ #define GEN ((struct unur_utdr_gen*)gen->datap) /* data for generator object */ /*---------------------------------------------------------------------------*/ int unur_utdr_reinit( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* Deprecated call! */ /*----------------------------------------------------------------------*/ /* re-initialize (existing) generator. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE,gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, UTDR, UNUR_ERR_GEN_INVALID ); return gen->reinit(gen); } /* end of unur_utdr_reinit() */ /*---------------------------------------------------------------------------*/ int unur_utdr_chg_pdfparams( struct unur_gen *gen, double *params, int n_params ) /*----------------------------------------------------------------------*/ /* Deprecated call! */ /*----------------------------------------------------------------------*/ /* change array of parameters for distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* params ... list of arguments */ /* n_params ... number of arguments */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* IMPORTANT: The given parameters are not checked against domain */ /* errors (in opposition to the unur__new() call). */ /* */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, UTDR, UNUR_ERR_GEN_INVALID ); /* set new parameters in distribution object */ return unur_distr_cont_set_pdfparams( gen->distr, params,n_params ); } /* end of unur_utdr_chg_pdfparams() */ /*---------------------------------------------------------------------------*/ int unur_utdr_chg_domain( struct unur_gen *gen, double left, double right ) /*----------------------------------------------------------------------*/ /* Deprecated call! */ /*----------------------------------------------------------------------*/ /* change the left and right borders of the domain of the distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* left ... left boundary point */ /* right ... right boundary point */ /* */ /* comment: */ /* the new boundary points may be +/- UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, UTDR, UNUR_ERR_GEN_INVALID ); /* check new parameter for generator */ if (left >= right) { _unur_warning(NULL,UNUR_ERR_DISTR_SET,"domain, left >= right"); return UNUR_ERR_DISTR_SET; } /* copy new boundaries into generator object */ DISTR.BD_LEFT = left; DISTR.BD_RIGHT = right; GEN->il = left; GEN->ir = right; /* changelog */ gen->distr->set |= UNUR_DISTR_SET_DOMAIN; #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ #endif /* o.k. */ return UNUR_SUCCESS; } /* end of unur_utdr_chg_domain() */ /*---------------------------------------------------------------------------*/ int unur_utdr_chg_mode( struct unur_gen *gen, double mode ) /*----------------------------------------------------------------------*/ /* Deprecated call! */ /*----------------------------------------------------------------------*/ /* change mode of distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* mode ... mode */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, UTDR, UNUR_ERR_GEN_INVALID ); /* copy parameters */ DISTR.mode = mode; /* no changelog required */ /* o.k. */ return UNUR_SUCCESS; } /* end of unur_utdr_chg_mode() */ /*---------------------------------------------------------------------------*/ int unur_utdr_upd_mode( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* Deprecated call! */ /*----------------------------------------------------------------------*/ /* recompute mode of distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, UTDR, UNUR_ERR_GEN_INVALID ); return unur_distr_cont_upd_mode( gen->distr ); } /* end of unur_utdr_upd_mode() */ /*---------------------------------------------------------------------------*/ int unur_utdr_chg_pdfarea( struct unur_gen *gen, double area ) /*----------------------------------------------------------------------*/ /* Deprecated call! */ /*----------------------------------------------------------------------*/ /* change area below PDF of distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* area ... area */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, UTDR, UNUR_ERR_GEN_INVALID ); /* check new parameter for generator */ if (area <= 0.) { _unur_warning(NULL,UNUR_ERR_DISTR_SET,"area <= 0"); return UNUR_ERR_DISTR_SET; } /* copy parameters */ DISTR.area = area; /* no changelog required */ /* o.k. */ return UNUR_SUCCESS; } /* end of unur_utdr_chg_pdfarea() */ /*---------------------------------------------------------------------------*/ int unur_utdr_upd_pdfarea( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* Deprecated call! */ /*----------------------------------------------------------------------*/ /* recompute area below PDF of distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, UTDR, UNUR_ERR_GEN_INVALID ); return unur_distr_cont_upd_pdfarea( gen->distr ); } /* end of unur_utdr_upd_pdfarea() */ /*---------------------------------------------------------------------------*/ #undef DISTR #undef GEN /*****************************************************************************/ #endif /* USE_DEPRECATED_CODE */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/cext_struct.h0000644001357500135600000000677714420445767015045 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: cext_struct.h * * * * PURPOSE: * * declares structures for method CEXT * * (wrapper for Continuous EXTernal generators) * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Information for constructing the generator */ struct unur_cext_par { /* data for external generator */ int (*init) (UNUR_GEN *gen); /* pointer to initialization routine */ double (*sample)(UNUR_GEN *gen); /* pointer to sampling routine */ }; /*---------------------------------------------------------------------------*/ /* The generator object */ struct unur_cext_gen { int (*init) (UNUR_GEN *gen); /* pointer to initialization routine */ double (*sample)(UNUR_GEN *gen); /* pointer to sampling routine */ void *param; /* parameters for the generator */ size_t size_param; /* size of parameter object */ }; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/itdr.c0000644001357500135600000021214014420445767013412 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: itdr.c * * * * TYPE: continuous univariate random variate * * METHOD: inverse transformed density rejection * * * * DESCRIPTION: * * Given PDF and pole. * * Produce a value x consistent with its density. * * * * REQUIRED: * * pointer to the density function * * location of pole * * * * OPTIONAL: * * splitting point between pole and tail region * * c-value for pole and tail region, repectively * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * ***************************************************************************** * * * REFERENCES: * * * * [1] W. Hoermann, J. Leydold, and G. Derflinger (2007): * * ACM Trans. Model. Comput. Simul. 17(4), pp.18. * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include "unur_methods_source.h" #include "x_gen_source.h" #include "itdr.h" #include "itdr_struct.h" #ifdef UNUR_ENABLE_INFO # include #endif /*---------------------------------------------------------------------------*/ /* Constants: */ /* maximum value for parameter c */ /* (if this value is changed, then also change the value in the WARNING */ /* message in the set calls unur_itdr_set_cp() and unur_itdr_set_cp()! ) */ #define C_MAX (-0.1) /* relative distance for computing derivatives numerically */ /* (1.e-6 yieldes better results than 1.e-8 when compared with exact values) */ #define DX (1.e-6) /* point near pole for estimating lim_{x->plole} ilc(x) */ /* the point x_i * NEAR_POLE is used */ #define NEAR_POLE (1.e-8) /* precision when computing intersection points. */ /* since the performance is not very sensitive to the accuracy of the result */ /* this value need not be very small. */ #define RESOLUTION_XI (1.e-5) /*---------------------------------------------------------------------------*/ /* Variants: */ #define ITDR_VARFLAG_VERIFY 0x001u /* run verify mode */ /*---------------------------------------------------------------------------*/ /* Debugging flags */ /* bit 01 ... pameters and structure of generator (do not use here) */ /* bits 02-12 ... setup */ /* bits 13-24 ... adaptive steps */ /* bits 25-32 ... trace sampling */ #define ITDR_DEBUG_REINIT 0x00000010u /* print parameters after reinit */ /*---------------------------------------------------------------------------*/ /* Flags for logging set calls */ #define ITDR_SET_XI 0x001u /* set intersection point */ #define ITDR_SET_CP 0x002u /* set c-value for pole region */ #define ITDR_SET_CT 0x004u /* set c-value for tail region */ /*---------------------------------------------------------------------------*/ #define GENTYPE "ITDR" /* type of generator */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_itdr_init( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* Initialize new generator. */ /*---------------------------------------------------------------------------*/ static int _unur_itdr_reinit( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Reinitialize generator. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_itdr_create( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* create new (almost empty) generator object. */ /*---------------------------------------------------------------------------*/ static int _unur_itdr_check_par( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Check parameters of given distribution and method */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_itdr_clone( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* copy (clone) generator object. */ /*---------------------------------------------------------------------------*/ static void _unur_itdr_free( struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* destroy generator object. */ /*---------------------------------------------------------------------------*/ static double _unur_itdr_sample( struct unur_gen *gen ); static double _unur_itdr_sample_check( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* sample from generator. */ /*---------------------------------------------------------------------------*/ static int _unur_itdr_get_hat( struct unur_gen *gen ); static int _unur_itdr_get_hat_pole( struct unur_gen *gen ); static int _unur_itdr_get_hat_tail( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* construct hat function */ /*---------------------------------------------------------------------------*/ static double _unur_itdr_lc( struct unur_gen *gen, double x ); /*---------------------------------------------------------------------------*/ /* compute local concavity at x */ /*---------------------------------------------------------------------------*/ static double _unur_itdr_ilc( struct unur_gen *gen, double x ); /*---------------------------------------------------------------------------*/ /* compute inverse local concavity at x */ /*---------------------------------------------------------------------------*/ static double _unur_itdr_find_xt( struct unur_gen *gen, double b ); /*---------------------------------------------------------------------------*/ /* solves equation (x-b)*f'(x)+f(x)=0, where f is PDF of distribution */ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ /* the following functions print debugging information on output stream, */ /* i.e., into the LOG file if not specified otherwise. */ /*---------------------------------------------------------------------------*/ static void _unur_itdr_debug_init( const struct unur_gen *gen, int error ); /*---------------------------------------------------------------------------*/ /* print after generator has been initialized has completed. */ /*---------------------------------------------------------------------------*/ #endif #ifdef UNUR_ENABLE_INFO static void _unur_itdr_info( struct unur_gen *gen, int help ); /*---------------------------------------------------------------------------*/ /* create info string. */ /*---------------------------------------------------------------------------*/ #endif /*---------------------------------------------------------------------------*/ /* abbreviations */ #define DISTR_IN distr->data.cont /* data for distribution object */ #define PAR ((struct unur_itdr_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_itdr_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.cont /* data for distribution in generator object */ #define BD_LEFT domain[0] /* left boundary of domain of distribution */ #define BD_RIGHT domain[1] /* right boundary of domain of distribution */ #define SAMPLE gen->sample.cont /* pointer to sampling routine */ /* the hat is computed for density PDF(sign*(x-pole)). Thus we have to */ /* transform the internal x value back to the original scale before the PDF */ /* is evaluated or the generated value is returned. */ /* likewise, all x values for the PDF given by the user has to transformed */ /* into the internal scale. */ /* transformation: internal scale --> original scale */ #define I2O(x) ( GEN->sign*(x) + GEN->pole ) /* transformation: original scale --> internal scale */ #define O2I(x) ( GEN->sign * ((x)-GEN->pole) ) /* call to PDF and its derivative in internal scale */ #define PDF(x) ( _unur_cont_PDF(I2O(x), gen->distr) ) #define dPDF(x) ( GEN->sign * _unur_cont_dPDF(I2O(x), gen->distr) ) /* call to PDF and its derivative in original scale */ #define PDFo(x) ( _unur_cont_PDF((x), gen->distr) ) #define dPDFo(x) ( _unur_cont_dPDF((x), gen->distr) ) #define logPDF(x) ( _unur_cont_logPDF(I2O(x), gen->distr) ) /* call to logPDF */ #define dlogPDF(x) ( GEN->sign * _unur_cont_dlogPDF(I2O(x), gen->distr) ) /* call to derivative of log PDF */ #define logPDFo(x) ( _unur_cont_logPDF((x), gen->distr) ) /* call to logPDF */ #define dlogPDFo(x) ( _unur_cont_dlogPDF((x), gen->distr) ) /* call to derivative of log PDF */ /*---------------------------------------------------------------------------*/ /* transformations */ /* T_c(x) */ #define T(c,x) ( -pow((x), (c)) ) #define DT(c,x) ( -(c)*pow((x), ((c)-1.)) ) #define TI(c,x) ( pow(-(x), 1./(c)) ) #define FT(c,x) ( -pow(-(x), ((c)+1.)/(c))*((c)/((c)+1.)) ) #define FTI(c,x) ( -pow(-(x)*((c)+1.)/(c), (c)/((c)+1.)) ) /* logarithm of inverse transformation */ #define logTI(c,x) ( -log(-(x)) / (c) ) /* special case: T_{-1/2}(x) ["square root transformation"] */ #define TsI(c,x) ( 1./((x)*(x)) ) #define FTs(c,x) ( -1./(x) ) #define FTsI(c,x) ( -1./(x) ) /*---------------------------------------------------------------------------*/ #define _unur_itdr_getSAMPLE(gen) \ ( ((gen)->variant & ITDR_VARFLAG_VERIFY) \ ? _unur_itdr_sample_check : _unur_itdr_sample ) /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Public: User Interface (API) **/ /*****************************************************************************/ struct unur_par * unur_itdr_new( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get default parameters */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* default parameters (pointer to structure) */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_par *par; /* check arguments */ _unur_check_NULL( GENTYPE,distr,NULL ); /* check distribution */ if (distr->type != UNUR_DISTR_CONT) { _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } COOKIE_CHECK(distr,CK_DISTR_CONT,NULL); if (DISTR_IN.pdf == NULL) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PDF"); return NULL; } if (DISTR_IN.dpdf == NULL) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"dPDF"); return NULL; } if (!(distr->set & UNUR_DISTR_SET_MODE)) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"mode (pole)"); return NULL; } if ( ! (_unur_isfinite(DISTR_IN.mode) && (_unur_FP_equal(DISTR_IN.mode,DISTR_IN.domain[0]) || _unur_FP_equal(DISTR_IN.mode,DISTR_IN.domain[1]))) ) { _unur_error(GENTYPE,UNUR_ERR_DISTR_PROP,"pole not on boundary of domain"); return NULL; } /* allocate structure */ par = _unur_par_new( sizeof(struct unur_itdr_par) ); COOKIE_SET(par,CK_ITDR_PAR); /* copy input */ par->distr = distr; /* pointer to distribution object */ /* set default values */ PAR->xi = UNUR_INFINITY; /* intersection point lc(x)=ilc(x) */ PAR->cp = UNUR_INFINITY; /* c-value for pole region (unknown) */ PAR->ct = UNUR_INFINITY; /* c-value for tail region (unknown) */ par->method = UNUR_METH_ITDR; /* method and default variant */ par->variant = 0u; /* default variant */ par->set = 0u; /* inidicate default parameters */ par->urng = unur_get_default_urng(); /* use default urng */ par->urng_aux = NULL; /* no auxilliary URNG required */ par->debug = _unur_default_debugflag; /* set default debugging flags */ /* routine for starting generator */ par->init = _unur_itdr_init; return par; } /* end of unur_itdr_new() */ /*****************************************************************************/ int unur_itdr_set_xi( struct unur_par *par, double xi ) /*----------------------------------------------------------------------*/ /* Sets intersection point xi where lc(x) = ilc(x) */ /* */ /* parameters: */ /* xi ... intersection point */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, ITDR ); /* check new parameter for generator */ if (xi <= par->distr->data.cont.BD_LEFT || xi >= par->distr->data.cont.BD_RIGHT) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"xi out of domain"); return UNUR_ERR_PAR_SET; } /* store value */ PAR->xi = xi; /* changelog */ par->set |= ITDR_SET_XI; return UNUR_SUCCESS; } /* end of unur_itdr_set_bx() */ /*---------------------------------------------------------------------------*/ int unur_itdr_set_cp( struct unur_par *par, double cp ) /*----------------------------------------------------------------------*/ /* Sets c-value for transformation T for inverse density in pole region */ /* */ /* parameters: */ /* cp ... c-value for pole region */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, ITDR ); /* check new parameter for generator */ if ( cp > C_MAX || cp <= -1. ) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"cp > -0.1 or <= -1"); return UNUR_ERR_PAR_SET; } /* store value */ PAR->cp = cp; /* changelog */ par->set |= ITDR_SET_CP; return UNUR_SUCCESS; } /* end of unur_itdr_set_cp() */ /*---------------------------------------------------------------------------*/ int unur_itdr_set_ct( struct unur_par *par, double ct ) /*----------------------------------------------------------------------*/ /* Sets c-value for transformation T for density in tail region */ /* */ /* parameters: */ /* ct ... c-value for tail region */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { double range; /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, ITDR ); /* check new parameter for generator */ range = ( par->distr->data.cont.BD_RIGHT - par->distr->data.cont.BD_LEFT ); if ( ct > C_MAX || (ct <= -1. && !_unur_isfinite(range)) ) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"ct > -0.1 or <= -1"); return UNUR_ERR_PAR_SET; } /* store value */ PAR->ct = ct; /* changelog */ par->set |= ITDR_SET_CT; return UNUR_SUCCESS; } /* end of unur_itdr_set_ct() */ /*---------------------------------------------------------------------------*/ double unur_itdr_get_xi( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* get intersection point xi */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* xi ... on success */ /* UNUR_INFINITY ... on error */ /*----------------------------------------------------------------------*/ { /* check input */ _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); _unur_check_gen_object( gen, ITDR, UNUR_INFINITY ); return GEN->xi; } /* end of unur_itdr_get_xi() */ /*---------------------------------------------------------------------------*/ double unur_itdr_get_cp( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* get intersection c-value for pole region */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* cp ... on success */ /* UNUR_INFINITY ... on error */ /*----------------------------------------------------------------------*/ { /* check input */ _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); _unur_check_gen_object( gen, ITDR, UNUR_INFINITY ); return GEN->cp; } /* end of unur_itdr_get_cp() */ /*---------------------------------------------------------------------------*/ double unur_itdr_get_ct( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* get intersection c-value for tail region */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* ct ... on success */ /* UNUR_INFINITY ... on error */ /*----------------------------------------------------------------------*/ { /* check input */ _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); _unur_check_gen_object( gen, ITDR, UNUR_INFINITY ); return GEN->ct; } /* end of unur_itdr_get_ct() */ /*---------------------------------------------------------------------------*/ double unur_itdr_get_area( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* get area below hat */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* area ... on success */ /* UNUR_INFINITY ... on error */ /*----------------------------------------------------------------------*/ { /* check input */ _unur_check_NULL( GENTYPE, gen, UNUR_INFINITY ); _unur_check_gen_object( gen, ITDR, UNUR_INFINITY ); return GEN->Atot; } /* end of unur_itdr_get_area() */ /*---------------------------------------------------------------------------*/ int unur_itdr_set_verify( struct unur_par *par, int verify ) /*----------------------------------------------------------------------*/ /* turn verifying of algorithm while sampling on/off */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* verify ... 0 = no verifying, !0 = verifying */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* no verifying is the default */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, ITDR ); /* we use a bit in variant */ par->variant = (verify) ? (par->variant | ITDR_VARFLAG_VERIFY) : (par->variant & (~ITDR_VARFLAG_VERIFY)); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_itdr_set_verify() */ /*---------------------------------------------------------------------------*/ int unur_itdr_chg_verify( struct unur_gen *gen, int verify ) /*----------------------------------------------------------------------*/ /* turn verifying of algorithm while sampling on/off */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* verify ... 0 = no verifying, !0 = verifying */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* no verifying is the default */ /*----------------------------------------------------------------------*/ { /* check input */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, ITDR, UNUR_ERR_GEN_INVALID ); /* we must not change this switch when sampling has been disabled by using a pointer to the error producing routine */ if (SAMPLE == _unur_sample_cont_error) return UNUR_FAILURE; if (verify) /* turn verify mode on */ gen->variant |= ITDR_VARFLAG_VERIFY; else /* turn verify mode off */ gen->variant &= ~ITDR_VARFLAG_VERIFY; SAMPLE = _unur_itdr_getSAMPLE(gen); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_itdr_chg_verify() */ /*****************************************************************************/ /** Private **/ /*****************************************************************************/ struct unur_gen * _unur_itdr_init( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* initialize new generator */ /* */ /* parameters: */ /* params ... pointer to paramters for building generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); /* check input */ if ( par->method != UNUR_METH_ITDR ) { _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); return NULL; } COOKIE_CHECK(par,CK_ITDR_PAR,NULL); /* create a new empty generator object */ gen = _unur_itdr_create(par); _unur_par_free(par); if (!gen) return NULL; /* check parameters */ if (_unur_itdr_check_par(gen) != UNUR_SUCCESS) { _unur_itdr_free(gen); return NULL; } /* create hat function */ if (_unur_itdr_get_hat(gen) != UNUR_SUCCESS) { #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_itdr_debug_init(gen,UNUR_FAILURE); #endif _unur_itdr_free(gen); return NULL; } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_itdr_debug_init(gen,UNUR_SUCCESS); #endif return gen; } /* end of _unur_itdr_init() */ /*---------------------------------------------------------------------------*/ int _unur_itdr_reinit( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* re-initialize (existing) generator. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int rcode; /* we do not use the given values for when we run reinit */ gen->set &= ~(ITDR_SET_XI | ITDR_SET_CP | ITDR_SET_CT); /* check parameters */ if ( (rcode = _unur_itdr_check_par(gen)) != UNUR_SUCCESS) return rcode; /* create hat function */ rcode = _unur_itdr_get_hat(gen); /* (re)set sampling routine */ SAMPLE = _unur_itdr_getSAMPLE(gen); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug & ITDR_DEBUG_REINIT) _unur_itdr_debug_init(gen,rcode); #endif return rcode; } /* end of _unur_itdr_reinit() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_itdr_create( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* allocate memory for generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* pointer to (empty) generator object with default settings */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_ITDR_PAR,NULL); /* create new generic generator object */ gen = _unur_generic_create( par, sizeof(struct unur_itdr_gen) ); /* magic cookies */ COOKIE_SET(gen,CK_ITDR_GEN); /* set generator identifier */ gen->genid = _unur_set_genid(GENTYPE); /* routines for sampling and destroying generator */ SAMPLE = _unur_itdr_getSAMPLE(gen); gen->destroy = _unur_itdr_free; gen->clone = _unur_itdr_clone; gen->reinit = _unur_itdr_reinit; /* copy data from distribution into generator object*/ GEN->pole = DISTR.mode; /* location of pole */ /* copy some parameters into generator object */ GEN->xi = PAR->xi; /* intersection point lc(x)=ilc(x) */ GEN->cp = PAR->cp; /* c-value for pole region */ GEN->ct = PAR->ct; /* c-value for tail region */ /* initialize values */ GEN->bx = UNUR_INFINITY; /* splitting point betw. pole and tail */ GEN->xp = UNUR_INFINITY; /* design point in pole region */ GEN->xt = UNUR_INFINITY; /* design point in tail region */ GEN->alphap = UNUR_INFINITY; /* parameters for hat in pole region */ GEN->betap = UNUR_INFINITY; GEN->Tfxt = UNUR_INFINITY; /* parameters for hat in tail region */ GEN->dTfxt = UNUR_INFINITY; /* parameters for hat in tail region */ GEN->by = UNUR_INFINITY; /* hat of pole region at bx */ GEN->Ap = UNUR_INFINITY; /* areas in upper pole region */ GEN->Ac = UNUR_INFINITY; /* areas in central region */ GEN->At = UNUR_INFINITY; /* areas in tail region */ GEN->Atot = UNUR_INFINITY; /* total area below hat */ GEN->sy = 0.; /* squeeze for central region */ GEN->sign = 1.; /* region: +1 .. (-oo,0], -1 .. [0,oo) */ GEN->bd_right = UNUR_INFINITY;/* right boundary of shifted domain */ #ifdef UNUR_ENABLE_INFO /* set function for creating info string */ gen->info = _unur_itdr_info; #endif /* return pointer to (almost empty) generator object */ return gen; } /* end of _unur_itdr_create() */ /*---------------------------------------------------------------------------*/ int _unur_itdr_check_par( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* check parameters of given distribution and method */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* copy data from distribution into generator object*/ GEN->pole = DISTR.mode; /* location of pole */ /* estimate sign of region: +1 ... (-oo,0], -1 ... [0,oo) */ do { if (_unur_isfinite(DISTR.BD_LEFT) && !_unur_isfinite(DISTR.BD_RIGHT)) { GEN->sign = 1.; if (dPDFo(DISTR.BD_LEFT) <= 0.) break; } if (!_unur_isfinite(DISTR.BD_LEFT) && _unur_isfinite(DISTR.BD_RIGHT)) { GEN->sign = -1.; if (dPDFo(DISTR.BD_RIGHT) >= 0.) break; } if (_unur_isfinite(DISTR.BD_LEFT) && _unur_isfinite(DISTR.BD_RIGHT)) { GEN->sign = (PDFo(DISTR.BD_LEFT)>=PDFo(DISTR.BD_RIGHT)) ? 1. : -1.; if ( GEN->sign*dPDFo(DISTR.BD_LEFT) <= 0. && GEN->sign*dPDFo(DISTR.BD_RIGHT) <= 0. ) break; } /* else */ _unur_error(gen->genid,UNUR_ERR_DISTR_PROP,"cannot compute sign of region"); return UNUR_ERR_DISTR_PROP; } while (1); /* right boundary of shifted domain */ GEN->bd_right = ( (GEN->sign > 0) ? DISTR.BD_RIGHT - GEN->pole : GEN->pole - DISTR.BD_LEFT ); return UNUR_SUCCESS; } /* end of _unur_itdr_check_par() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_itdr_clone( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* copy (clone) generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to clone of generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { #define CLONE ((struct unur_itdr_gen*)clone->datap) struct unur_gen *clone; /* check arguments */ CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_ITDR_GEN,NULL); /* create generic clone */ clone = _unur_generic_clone( gen, GENTYPE ); return clone; #undef CLONE } /* end of _unur_itdr_clone() */ /*---------------------------------------------------------------------------*/ void _unur_itdr_free( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* deallocate generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { /* check arguments */ if( !gen ) /* nothing to do */ return; /* check input */ if ( gen->method != UNUR_METH_ITDR ) { _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); return; } COOKIE_CHECK(gen,CK_ITDR_GEN,RETURN_VOID); /* we cannot use this generator object any more */ SAMPLE = NULL; /* make sure to show up a programming error */ /* free memory */ _unur_generic_free(gen); } /* end of _unur_itdr_free() */ /*****************************************************************************/ double _unur_itdr_sample( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { double U, V, X, Y; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_ITDR_GEN,UNUR_INFINITY); while (1) { /* generate point uniformly on (0,Atot) */ U = _unur_call_urng(gen->urng) * GEN->Atot; /* generate pair (X,Y) below hat */ if (U < GEN->Ap) { /* upper pole region */ V = _unur_call_urng(gen->urng) * GEN->Ap; if (_unur_isfsame(GEN->cp, -0.5)) { /* square root transformation */ Y = ( FTsI(GEN->cp, GEN->betap*V + FTs(GEN->cp,GEN->alphap+GEN->betap*GEN->by)) - GEN->alphap ) / GEN->betap; X = U * TsI(GEN->cp, GEN->alphap+GEN->betap*Y) / GEN->Ap; } else { /* general T_c transformation */ Y = ( FTI(GEN->cp, GEN->betap*V + FT(GEN->cp,GEN->alphap+GEN->betap*GEN->by)) - GEN->alphap ) / GEN->betap; X = U * TI(GEN->cp, GEN->alphap+GEN->betap*Y) / GEN->Ap; } } else if ((U -= GEN->Ap) < GEN->Ac) { /* central region */ X = U * GEN->bx / GEN->Ac; Y = _unur_call_urng(gen->urng) * GEN->by; if (Y <= GEN->sy) /* squeeze acceptance */ return (I2O(X)); } else { /* tail region */ U -= GEN->Ac; if (_unur_isfsame(GEN->ct, -0.5)) { /* square root transformation */ X = GEN->xt + (FTsI(GEN->ct, GEN->dTfxt*U + FTs(GEN->ct, GEN->Tfxt + GEN->dTfxt*(GEN->bx-GEN->xt)) ) - GEN->Tfxt) / GEN->dTfxt; Y = ( _unur_call_urng(gen->urng) * TsI(GEN->ct, GEN->Tfxt + GEN->dTfxt*(X - GEN->xt))); } else { /* general T_c transformation */ X = GEN->xt + (FTI(GEN->ct, GEN->dTfxt*U + FT(GEN->ct, GEN->Tfxt + GEN->dTfxt*(GEN->bx-GEN->xt)) ) - GEN->Tfxt) / GEN->dTfxt; Y = ( _unur_call_urng(gen->urng) * TI(GEN->ct, GEN->Tfxt + GEN->dTfxt*(X - GEN->xt))); } } /* transform back into original scale */ X = I2O(X); /* accept or reject */ if (Y <= PDFo(X)) return X; } } /* end of _unur_itdr_sample() */ /*---------------------------------------------------------------------------*/ double _unur_itdr_sample_check( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator and verify that method can be used */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { #define ht(x) ( TI(GEN->ct, GEN->Tfxt + GEN->dTfxt*((x)-GEN->xt)) ) #define hp(x) ( (T(GEN->cp,(x)) - GEN->alphap) / GEN->betap ) double U, V, X, Y; double fx, hx, sqx; /* values of PDF, hat and squeeze at x */ /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_ITDR_GEN,UNUR_INFINITY); while (1) { /* generate point uniformly on (0,Atot) */ U = _unur_call_urng(gen->urng) * GEN->Atot; /* generate pair (X,Y) below hat */ if (U < GEN->Ap) { /* upper pole region */ V = _unur_call_urng(gen->urng) * GEN->Ap; if (_unur_isfsame(GEN->cp, -0.5)) { /* square root transformation */ Y = ( FTsI(GEN->cp, GEN->betap*V + FTs(GEN->cp,GEN->alphap+GEN->betap*GEN->by)) - GEN->alphap ) / GEN->betap; X = U * TsI(GEN->cp, GEN->alphap+GEN->betap*Y) / GEN->Ap; } else { /* general T_c transformation */ Y = ( FTI(GEN->cp, GEN->betap*V + FT(GEN->cp,GEN->alphap+GEN->betap*GEN->by)) - GEN->alphap ) / GEN->betap; X = U * TI(GEN->cp, GEN->alphap+GEN->betap*Y) / GEN->Ap; } hx = hp(X); sqx = 0.; } else if ((U -= GEN->Ap) < GEN->Ac) { /* central region */ X = U * GEN->bx / GEN->Ac; Y = _unur_call_urng(gen->urng) * GEN->by; hx = hp(X); sqx = GEN->sy; /* no squeeze acceptance in verify mode */ /* [ if (Y <= GEN->sy) return (I2O(X)); ] */ } else { /* tail region */ U -= GEN->Ac; if (_unur_isfsame(GEN->ct, -0.5)) { /* square root transformation */ X = GEN->xt + (FTsI(GEN->ct, GEN->dTfxt*U + FTs(GEN->ct, GEN->Tfxt + GEN->dTfxt*(GEN->bx-GEN->xt)) ) - GEN->Tfxt) / GEN->dTfxt; Y = ( _unur_call_urng(gen->urng) * TsI(GEN->ct, GEN->Tfxt + GEN->dTfxt*(X - GEN->xt))); } else { /* general T_c transformation */ X = GEN->xt + (FTI(GEN->ct, GEN->dTfxt*U + FT(GEN->ct, GEN->Tfxt + GEN->dTfxt*(GEN->bx-GEN->xt)) ) - GEN->Tfxt) / GEN->dTfxt; Y = ( _unur_call_urng(gen->urng) * TI(GEN->ct, GEN->Tfxt + GEN->dTfxt*(X - GEN->xt))); } hx = ht(X); sqx = 0.; } /* transform back into original scale */ X = I2O(X); /* compute PDF at x */ fx = PDFo(X); /* verify hat and squeeze function */ if ( (1.+UNUR_EPSILON) * hx < fx ) _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF(x) > hat(x)"); if ( (1.-UNUR_EPSILON) * sqx > fx ) _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF(x) < squeeze(x)"); /* accept or reject */ if (Y <= PDFo(X)) return X; } #undef ht #undef hp } /* end of _unur_itdr_sample_check() */ /*****************************************************************************/ /** Auxilliary Routines **/ /*****************************************************************************/ int _unur_itdr_get_hat( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* construct hat function */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_ITDR_GEN,UNUR_ERR_COOKIE); /* Get candidate for bx */ if (gen->set & ITDR_SET_XI) { /* bx set user; have to shift by pole */ GEN->bx = O2I(GEN->xi); } else { /* compute intersection point of local concavity and inverse lc */ GEN->bx = _unur_itdr_find_xt( gen, 0. ); GEN->xi = I2O(GEN->bx); if (!_unur_isfinite(GEN->bx)) { _unur_error(gen->genid,UNUR_ERR_DISTR_PROP,"cannot compute bx"); return UNUR_ERR_DISTR_PROP; } } /* pole region */ if (_unur_itdr_get_hat_pole(gen) != UNUR_SUCCESS) return UNUR_ERR_DISTR_PROP; /* tail region */ if (_unur_FP_equal(GEN->bx, GEN->bd_right)) { GEN->At = 0.; } else { if (_unur_itdr_get_hat_tail(gen) != UNUR_SUCCESS) return UNUR_ERR_DISTR_PROP; } /* total area below hat */ GEN->Atot = GEN->Ap + GEN->Ac + GEN->At; return UNUR_SUCCESS; } /* end of _unur_itdr_get_hat() */ /*---------------------------------------------------------------------------*/ int _unur_itdr_get_hat_pole( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* construct hat function in pole region */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { #define hp(x) ( (T(cp,(x)) - GEN->alphap) / GEN->betap ) double cp, xp; double pdf_bx; double near_pole, ilc_near_pole, pdf_near_pole, logpdf_near_pole; double ilc_bx = -UNUR_INFINITY; /* get cp */ if (gen->set & ITDR_SET_CP) { /* cp set by user */ cp = GEN->cp; } else { ilc_bx = _unur_itdr_ilc(gen, GEN->bx); near_pole = GEN->bx*NEAR_POLE + fabs(GEN->pole)*DBL_EPSILON; ilc_near_pole = (DISTR.logpdf) ? logPDF(near_pole) / log(near_pole) : log(PDF(near_pole)) / log(near_pole); cp = ilc_near_pole; if (cp > C_MAX) cp = C_MAX; if (cp <= -1.) { _unur_error(gen->genid,UNUR_ERR_DISTR_PROP,"cannot compute hat for pole: cp"); return UNUR_ERR_DISTR_PROP; } GEN->cp = cp; } if (cp < -0.5) GEN->bx = _unur_min(2.*GEN->bx, GEN->bd_right); /* compute PDF at check points */ pdf_bx = PDF(GEN->bx); near_pole = fabs(GEN->pole)*DBL_EPSILON; if (near_pole < 1.e-100) near_pole = 1.e-100; pdf_near_pole = logpdf_near_pole = UNUR_INFINITY; while (1) { /* we have to search for a point with PDF(x) < UNUR_INFINITY */ if (DISTR.logpdf) { logpdf_near_pole = logPDF(near_pole); if (_unur_isfinite(logpdf_near_pole)) break; } else { pdf_near_pole = PDF(near_pole); if (_unur_isfinite(pdf_near_pole)) break; } near_pole *= 1000.; if (!_unur_isfinite(near_pole)) { _unur_error(gen->genid,UNUR_ERR_DISTR_PROP,"cannot compute hat for pole: cp"); return UNUR_ERR_DISTR_PROP; } } /* get design point xp */ while (1) { xp = GEN->bx * pow(1.+cp, -1./cp); if ( !(xp > 0. && xp < GEN->bx) ) { _unur_error(gen->genid,UNUR_ERR_DISTR_PROP,"cannot compute hat for pole: xp"); return UNUR_ERR_DISTR_PROP; } /* parameters for hat */ GEN->betap = DT(cp,xp) / dPDF(xp); GEN->alphap = T(cp,xp) - GEN->betap * PDF(xp); /* check hat */ if ( hp(GEN->bx) < pdf_bx || (DISTR.logpdf && _unur_FP_less(log(hp(near_pole)), logpdf_near_pole)) || (DISTR.logpdf==NULL && _unur_FP_less(hp(near_pole), pdf_near_pole)) ) { if (gen->set & ITDR_SET_CP) { _unur_error(gen->genid,UNUR_ERR_DISTR_PROP,"inverse pdf not T_cp concave"); return UNUR_ERR_DISTR_PROP; } /* try new value for cp */ GEN->cp = cp = 0.9*cp-0.1; if (cp < ilc_bx) { /* we try ilc at bx first before we use an even smaller value for cp */ GEN->cp = cp = ilc_bx; ilc_bx = -UNUR_INFINITY; } if (cp < -0.999) { _unur_error(gen->genid,UNUR_ERR_DISTR_PROP,"cannot compute hat for pole: cp"); return UNUR_ERR_DISTR_PROP; } } else break; } GEN->xp = xp; /* hat at intersection point */ GEN->by = hp(GEN->bx); /* area below hat */ GEN->Ap = -FT(cp, GEN->alphap + GEN->betap * GEN->by) / GEN->betap; GEN->Ac = GEN->by * GEN->bx; /* add squeeze for central region */ GEN->sy = PDF(GEN->bx); return UNUR_SUCCESS; #undef hp } /* end of _unur_itdr_get_hat_pole() */ /*---------------------------------------------------------------------------*/ int _unur_itdr_get_hat_tail( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* construct hat function in tail region */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { #define ht(x) ( TI(ct, GEN->Tfxt + GEN->dTfxt*((x)-xt)) ) #define loght(x) ( TI(ct, GEN->Tfxt + GEN->dTfxt*((x)-xt)) ) double ct, xt; double lc_bx, lc_inf; double br; double bx = GEN->bx; /* get design point xt */ GEN->xt = xt = _unur_itdr_find_xt( gen, bx ); /* get ct */ if (gen->set & ITDR_SET_CT) { /* ct set by user */ ct = GEN->ct; } else { /* first try: use point between bx and xt */ ct = _unur_itdr_lc(gen, 0.5*(bx + xt)); /* check local concavity at right boundary */ if ( _unur_isfinite(GEN->bd_right)) lc_inf = _unur_itdr_lc(gen, GEN->bd_right); else { /* right boundary = infinity */ if (DISTR.logpdf) { lc_inf = log(1.e100) / logPDF(1.e100); /* we need lim x->oo log(x) / log(f(x)) */ /* however, this convergence is very slow. */ /* so we add -0.1 to be on the save side. */ lc_inf += -0.01; } else { lc_inf = log(1.e10*bx) / log(PDF(1.e10*bx)); /* we need lim x->oo log(x) / log(f(x)) */ /* however, this convergence is very slow. */ /* so we add -0.1 to be on the save side. */ lc_inf += -0.05; } } if (lc_inf < ct) ct = lc_inf; /* ct should not be too close to 0. */ if (ct > C_MAX) ct = C_MAX; if (ct <= -1.) { _unur_error(gen->genid,UNUR_ERR_DISTR_PROP,"cannot compute hat for tail: ct"); return UNUR_ERR_DISTR_PROP; } GEN->ct = ct; } /* compute and check parameters for hat */ lc_bx = _unur_itdr_lc(gen, bx); while (1) { /* parameters for hat */ GEN->Tfxt = T(ct, PDF(xt)); GEN->dTfxt = DT(ct, PDF(xt)) * dPDF(xt); /* check hat */ br = 1000.*bx; /* "very large x" */ if (br > GEN->bd_right) br = GEN->bd_right; if ( ((GEN->Tfxt + GEN->dTfxt*(bx-xt)) >= 0.) || (DISTR.logpdf && (_unur_FP_less(loght(br),logPDF(br)) || _unur_FP_less(loght(bx), logPDF(bx)) )) || (DISTR.logpdf==NULL && (_unur_FP_less(ht(br),PDF(br)) || _unur_FP_less(ht(bx), PDF(bx)) )) ) { if (gen->set & ITDR_SET_CT) { _unur_error(gen->genid,UNUR_ERR_DISTR_PROP,"pdf not T_ct concave"); return UNUR_ERR_DISTR_PROP; } /* try new value for ct */ ct = 0.5*(ct + lc_bx); if (ct > GEN->ct || ct < -0.999 || _unur_FP_approx(ct,lc_bx)) { /* new ct value is even larger or too small or its time to stop */ _unur_error(gen->genid,UNUR_ERR_DISTR_PROP,"cannot compute hat for tail: ct"); return UNUR_ERR_DISTR_PROP; } GEN->ct = ct; } else break; } /* area below hat */ GEN->At = (!_unur_isfinite(GEN->bd_right)) ? 0. : FT(ct, GEN->Tfxt + GEN->dTfxt * (GEN->bd_right - xt)) / GEN->dTfxt; GEN->At += -FT(ct, GEN->Tfxt + GEN->dTfxt * (GEN->bx - xt)) / GEN->dTfxt; return UNUR_SUCCESS; #undef ht #undef loght } /* end of _unur_itdr_get_hat_tail() */ /*---------------------------------------------------------------------------*/ double _unur_itdr_lc( struct unur_gen *gen, double x ) /*----------------------------------------------------------------------*/ /* compute local concavity at x */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* x ... point x */ /* */ /* return: */ /* local concavity */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { double dx, f, df, ddf; if (DISTR.dlogpdf == NULL) { /* use PDF */ f = PDF(x); df = dPDF(x); dx = x * DX + fabs(GEN->pole) * UNUR_SQRT_DBL_EPSILON; if (x-dx <= 0.) dx = x; if (x+dx > GEN->bd_right) ddf = (dPDF(x)-dPDF(x-dx))/dx; else ddf = (dPDF(x+dx)-dPDF(x-dx))/(2.*dx); return 1. - ddf*f/(df*df); } else { /* use logarithm of PDF */ dx = x * DX + fabs(GEN->pole) * UNUR_SQRT_DBL_EPSILON; if (x-dx <= 0.) dx = x; if (x+dx > GEN->bd_right) return (1./dlogPDF(x) - 1./dlogPDF(x-dx))/dx; else return (1./dlogPDF(x+dx) - 1./dlogPDF(x-dx))/(2.*dx); } } /* end of _unur_itdr_lc() */ /*---------------------------------------------------------------------------*/ double _unur_itdr_ilc( struct unur_gen *gen, double x ) /*----------------------------------------------------------------------*/ /* compute inverse local concavity at x */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* x ... point x */ /* */ /* return: */ /* inverse local concavity */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { if (DISTR.dlogpdf == NULL) { /* use PDF */ double dx, df, ddf; df = dPDF(x); dx = x * DX + fabs(GEN->pole) * UNUR_SQRT_DBL_EPSILON; if (x-dx <= 0.) dx = x; if (x+dx > GEN->bd_right) ddf = (dPDF(x)-dPDF(x-dx))/dx; else ddf = (dPDF(x+dx)-dPDF(x-dx))/(2.*dx); return 1.+x*ddf/(df); } else { /* use logarithm of PDF */ double dx, dlf, ddlf; dlf = dlogPDF(x); dx = x * DX + fabs(GEN->pole) * UNUR_SQRT_DBL_EPSILON; if (x-dx <= 0.) dx = x; if (x+dx > GEN->bd_right) ddlf = (dlogPDF(x)-dlogPDF(x-dx))/dx; else ddlf = (dlogPDF(x+dx)-dlogPDF(x-dx))/(2.*dx); return 1.+x*(dlf + ddlf/dlf); } } /* end of _unur_itdr_ilc() */ /*---------------------------------------------------------------------------*/ double _unur_itdr_find_xt( struct unur_gen *gen, double b ) /*----------------------------------------------------------------------*/ /* solves equation (x-b)*f'(x)+f(x)=0, where f is PDF of distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* startx ... starting point for finding x */ /* */ /* return: */ /* solution xi */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { /* function for finding root */ #define FKT(x) ( DISTR.dlogpdf \ ? (1./((x)-b) + dlogPDF(x)) \ : (((x)-b)*dPDF(x) + PDF(x)) ) double xl, xu; /* lower and upper boundary of bracket */ double xn; /* new guess for root */ /* check parameter */ if (b < 0.) return UNUR_INFINITY; /* find appropriate starting value */ xl = b + _unur_max(1., (fabs(GEN->pole)+b)*UNUR_SQRT_DBL_EPSILON); if (xl > GEN->bd_right) xl = GEN->bd_right; while (!_unur_isfinite(FKT(xl)) || _unur_iszero(PDF(xl)) ) { xl = 0.5*(xl + b); if (!_unur_isfinite(xl) || _unur_FP_same(xl,b)) return UNUR_INFINITY; } xu = xl; /* check upper value xu */ if (_unur_FP_greater(xu,GEN->bd_right)) return GEN->bd_right; /* find bracket for root */ if (FKT(xl)>0.) { do { xl = xu; xu += xu - b; if (!_unur_isfinite(xu) || xu < (1.+2.*DBL_EPSILON)*xl) /* unable to proceed --> break to avoid infinite loop */ return UNUR_INFINITY; if (xu >= GEN->bd_right) /* we have reached right boundary */ return GEN->bd_right; } while(FKT(xu) > 0.); } else { /* FKT(xl)<=0. */ do { xu = xl; xl = 0.5*(xl + b); if (!_unur_isfinite(xl)) return UNUR_INFINITY; } while(FKT(xl) < 0.); } /* use bisection to find root */ while(xu > (1.+RESOLUTION_XI)*xl) { xn = 0.5*(xl+xu); if(FKT(xn)>0.) xl = xn; else xu = xn; } /* return point */ return 0.5*(xl+xu); #undef FKT } /* end of _unur_itdr_find_xt() */ /*****************************************************************************/ /** Debugging utilities **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ void _unur_itdr_debug_init( const struct unur_gen *gen, int error ) /*----------------------------------------------------------------------*/ /* write info about generator into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* error ... error code of hat generation */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_ITDR_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: type = continuous univariate random variates\n",gen->genid); fprintf(LOG,"%s: method = itdr (inverse transformed density rejection)\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); _unur_distr_cont_debug( gen->distr, gen->genid ); fprintf(LOG,"%s: sampling routine = _unur_itdr_sample",gen->genid); if (gen->variant & ITDR_VARFLAG_VERIFY) fprintf(LOG,"_check"); fprintf(LOG,"()\n%s:\n",gen->genid); /* parameters */ fprintf(LOG,"%s: sign = %g\n",gen->genid, GEN->sign); fprintf(LOG,"%s: pole = %g\n",gen->genid, GEN->pole); fprintf(LOG,"%s: bd_right = %g\n",gen->genid, GEN->bd_right); fprintf(LOG,"%s: xi = %g",gen->genid, GEN->xi); fprintf(LOG,"%s\n", (gen->set & ITDR_SET_XI) ? "" : " [computed]"); fprintf(LOG,"%s: bx = %g\n",gen->genid, GEN->bx); fprintf(LOG,"%s: pole region:\n",gen->genid); fprintf(LOG,"%s:\tcp = %g",gen->genid, GEN->cp); fprintf(LOG,"%s\n", (gen->set & ITDR_SET_CP) ? "" : " [computed]"); fprintf(LOG,"%s:\txp = %g\n",gen->genid, GEN->xp); fprintf(LOG,"%s:\talphap = %g, betap = %g\n",gen->genid, GEN->alphap, GEN->betap); fprintf(LOG,"%s:\tby = %g\n",gen->genid, GEN->by); fprintf(LOG,"%s:\tsy = %g\n",gen->genid, GEN->sy); fprintf(LOG,"%s: tail region:\n",gen->genid); fprintf(LOG,"%s:\tct = %g",gen->genid, GEN->ct); fprintf(LOG,"%s\n", (gen->set & ITDR_SET_CT) ? "" : " [computed]"); fprintf(LOG,"%s:\txt = %g\n",gen->genid, GEN->xt); fprintf(LOG,"%s:\tTfxt = %g, dTfxt = %g\n",gen->genid, GEN->Tfxt, GEN->dTfxt); fprintf(LOG,"%s: Area = %g + %g + %g = %g\n",gen->genid, GEN->Ap, GEN->Ac, GEN->At, GEN->Atot); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: **** INIT %s ***\n",gen->genid, (error==UNUR_SUCCESS) ? "successful" : "failed" ); fprintf(LOG,"%s:\n",gen->genid); } /* end of _unur_itdr_debug_init() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_INFO /*---------------------------------------------------------------------------*/ void _unur_itdr_info( struct unur_gen *gen, int help ) /*----------------------------------------------------------------------*/ /* create character string that contains information about the */ /* given generator object. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* help ... whether to print additional comments */ /*----------------------------------------------------------------------*/ { struct unur_string *info = gen->infostr; struct unur_distr *distr = gen->distr; int samplesize = 10000; /* generator ID */ _unur_string_append(info,"generator ID: %s\n\n", gen->genid); /* distribution */ _unur_string_append(info,"distribution:\n"); _unur_distr_info_typename(gen); _unur_string_append(info," functions = PDF dPDF\n"); _unur_string_append(info," domain = (%g, %g)\n", DISTR.domain[0],DISTR.domain[1]); _unur_string_append(info," pole/mode = %g\n", DISTR.mode); _unur_string_append(info,"\n"); /* method */ _unur_string_append(info,"method: ITDR (Inverse Transformed Density Rejection -- 2 point method)\n"); _unur_string_append(info,"\n"); /* performance */ _unur_string_append(info,"performance characteristics:\n"); _unur_string_append(info," area(hat) = %g [ = %g + %g + %g ]\n", GEN->Atot, GEN->Ap, GEN->Ac, GEN->At); _unur_string_append(info," rejection constant = "); if (distr->set & UNUR_DISTR_SET_PDFAREA) _unur_string_append(info,"%g\n", GEN->Atot/DISTR.area); else _unur_string_append(info,"%.2f [approx. ]\n", unur_test_count_urn(gen,samplesize,0,NULL)/(2.*samplesize)); _unur_string_append(info,"\n"); /* parameters */ if (help) { _unur_string_append(info,"parameters:\n"); _unur_string_append(info," cp = %g %s\n", GEN->cp, (gen->set & ITDR_SET_CP) ? "" : " [computed]"); _unur_string_append(info," ct = %g %s\n", GEN->cp, (gen->set & ITDR_SET_CT) ? "" : " [computed]"); _unur_string_append(info," xi = %g %s\n", GEN->xi, (gen->set & ITDR_SET_XI) ? "" : " [computed]"); if (gen->variant & ITDR_VARFLAG_VERIFY) _unur_string_append(info," verify = on\n"); _unur_string_append(info,"\n"); } /* Hints */ /* if (help) { */ /* _unur_string_append(info,"\n"); */ /* } */ } /* end of _unur_itdr_info() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_INFO */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/ninv_init.ch0000644001357500135600000004571014420445767014624 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: ninv_init.ch * * * * Routines for initialization and deletion of generator objects. * * * ***************************************************************************** * * * Copyright (c) 2000-2009 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * *****************************************************************************/ /*****************************************************************************/ /** Private **/ /*****************************************************************************/ struct unur_gen * _unur_ninv_init( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* initialize new generator */ /* */ /* parameters: */ /* params pointer to paramters for building generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ _unur_check_NULL( GENTYPE,par,NULL ); /* check input */ if ( par->method != UNUR_METH_NINV ) { _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); return NULL; } COOKIE_CHECK(par,CK_NINV_PAR,NULL); /* check variant */ if (par->variant == NINV_VARFLAG_NEWTON && ! par->DISTR_IN.pdf) { _unur_warning(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PDF"); par->variant = NINV_VARFLAG_REGULA; /* use regula falsi instead */ } /* create a new empty generator object */ gen = _unur_ninv_create(par); _unur_par_free(par); if (!gen) { return NULL; } /* check parameters */ if (_unur_ninv_check_par(gen) != UNUR_SUCCESS) { _unur_ninv_free(gen); return NULL; } /* compute starting points for numerical inversion */ if (GEN->table_on) { /* use a table */ if (_unur_ninv_create_table(gen)!=UNUR_SUCCESS) { _unur_ninv_free(gen); return NULL; } } else { /* use given points or percentiles */ if (_unur_ninv_compute_start(gen)!=UNUR_SUCCESS) { _unur_ninv_free(gen); return NULL; } } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_ninv_debug_init(gen); #endif return gen; } /* end of _unur_ninv_init() */ /*---------------------------------------------------------------------------*/ int _unur_ninv_reinit( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* re-initialize (existing) generator. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int rcode; /* check parameters */ if ( (rcode = _unur_ninv_check_par(gen)) != UNUR_SUCCESS) return rcode; /* compute normalization constant for standard distribution */ if (DISTR.upd_area != NULL) if ((DISTR.upd_area)(gen->distr)!=UNUR_SUCCESS) { _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"cannot compute normalization constant"); return UNUR_ERR_GEN_DATA; } /* regenerate table */ if (GEN->table != NULL) rcode = _unur_ninv_create_table(gen); else /* or compute starting points */ rcode = unur_ninv_chg_start( gen, 0., 0. ); /* (re)set sampling routine */ SAMPLE = _unur_ninv_getSAMPLE(gen); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug & NINV_DEBUG_REINIT) { _unur_distr_cont_debug( gen->distr, gen->genid ); if (rcode==UNUR_SUCCESS) _unur_ninv_debug_start( gen ); } #endif return UNUR_SUCCESS; } /* end of _unur_ninv_reinit() */ /*---------------------------------------------------------------------------*/ static struct unur_gen * _unur_ninv_create( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* allocate memory for generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* pointer to (empty) generator object with default settings */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_NINV_PAR,NULL); /* create new generic generator object */ gen = _unur_generic_create( par, sizeof(struct unur_ninv_gen) ); /* magic cookies */ COOKIE_SET(gen,CK_NINV_GEN); /* set generator identifier */ gen->genid = _unur_set_genid(GENTYPE); /* routines for sampling and destroying generator */ SAMPLE = _unur_ninv_getSAMPLE(gen); gen->destroy = _unur_ninv_free; gen->clone = _unur_ninv_clone; gen->reinit = _unur_ninv_reinit; /* copy parameters into generator object */ GEN->max_iter = PAR->max_iter; /* maximal number of iterations */ GEN->x_resolution = PAR->x_resolution; /* maximal tolerated relative x-error */ GEN->u_resolution = PAR->u_resolution; /* maximal tolerated u-error */ GEN->table_on = PAR->table_on; /* useage of table for starting points */ GEN->table_size = PAR->table_size; /* number of points for table */ GEN->s[0] = PAR->s[0]; /* starting points */ GEN->s[1] = PAR->s[1]; /* init pointer */ GEN->table = NULL; GEN->f_table = NULL; #ifdef UNUR_ENABLE_INFO /* set function for creating info string */ gen->info = _unur_ninv_info; #endif /* return pointer to (almost empty) generator object */ return gen; } /* end of _unur_ninv_create() */ /*---------------------------------------------------------------------------*/ int _unur_ninv_check_par( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* check parameters of given distribution and method */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* checking x-error or checking u-error must be enabled */ if ( GEN->x_resolution < 0. && GEN->u_resolution < 0. ) { _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"both x-resolution and u-resolution negativ. using defaults."); GEN->x_resolution = 1.e-8; } /* domain not truncated at init */ DISTR.trunc[0] = DISTR.domain[0]; DISTR.trunc[1] = DISTR.domain[1]; /* set bounds of U -- in respect to given bounds */ GEN->CDFmin = GEN->Umin = (DISTR.trunc[0] > -UNUR_INFINITY) ? CDF(DISTR.trunc[0]) : 0.; GEN->CDFmax = GEN->Umax = (DISTR.trunc[1] < UNUR_INFINITY) ? CDF(DISTR.trunc[1]) : 1.; if (_unur_FP_greater(GEN->CDFmin, GEN->CDFmax)) { _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"CDF not increasing"); return UNUR_ERR_GEN_DATA; } return UNUR_SUCCESS; } /* end of _unur_ninv_check_par() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_ninv_clone( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* copy (clone) generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to clone of generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { #define CLONE ((struct unur_ninv_gen*)clone->datap) struct unur_gen *clone; /* check arguments */ CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_NINV_GEN,NULL); /* create generic clone */ clone = _unur_generic_clone( gen, GENTYPE ); /* copy additional data for generator object */ if (GEN->table) { CLONE->table = _unur_xmalloc( GEN->table_size * sizeof(double) ); memcpy( CLONE->table, GEN->table, GEN->table_size * sizeof(double) ); CLONE->f_table = _unur_xmalloc( GEN->table_size * sizeof(double) ); memcpy( CLONE->f_table, GEN->f_table, GEN->table_size * sizeof(double) ); } return clone; #undef CLONE } /* end of _unur_ninv_clone() */ /*---------------------------------------------------------------------------*/ void _unur_ninv_free( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* deallocate generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { /* check arguments */ if( !gen ) /* nothing to do */ return; /* check input */ if ( gen->method != UNUR_METH_NINV ) { _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); return; } COOKIE_CHECK(gen,CK_NINV_GEN,RETURN_VOID); /* we cannot use this generator object any more */ SAMPLE = NULL; /* make sure to show up a programming error */ /* free tables */ if (GEN->table) free(GEN->table); if (GEN->f_table) free(GEN->f_table); /* free memory */ _unur_generic_free(gen); } /* end of _unur_ninv_free() */ /*****************************************************************************/ /** Auxilliary Routines **/ /*****************************************************************************/ int _unur_ninv_create_table( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* create a table for starting points and a table with */ /* the corresponding function values */ /* */ /* parameters: */ /* gen ... pointer generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int i; double x; int table_size = GEN->table_size; /* check arguments */ CHECK_NULL(gen, UNUR_ERR_NULL); _unur_check_gen_object(gen, NINV, UNUR_ERR_GEN_INVALID); GEN->table = _unur_xrealloc( GEN->table, table_size * sizeof(double)); GEN->f_table = _unur_xrealloc( GEN->f_table, table_size * sizeof(double)); /* get arbitrary points */ GEN->s[0] = _unur_max( DISTR.domain[0], -10.); GEN->s[1] = _unur_min( DISTR.domain[1], GEN->s[0]+20. ); GEN->CDFs[0] = CDF(GEN->s[0]); GEN->CDFs[1] = CDF(GEN->s[1]); /* table can't be used to calculate itself */ GEN->table_on = FALSE; /* calculation of the tables */ /* left and right boundary */ GEN->table[0] = DISTR.domain[0]; GEN->f_table[0] = GEN->CDFmin; /* CDF(DISTR.domain[0]) */ GEN->table[table_size-1] = DISTR.domain[1]; GEN->f_table[table_size-1] = GEN->CDFmax; /* CDF(DISTR.domain[1]) */ /* all the other points. we compute these points from boundary to center */ for (i=1; iCDFmin + i * (GEN->CDFmax - GEN->CDFmin) / (table_size-1.); GEN->table[i] = _unur_ninv_regula(gen,x); GEN->f_table[i] = CDF(GEN->table[i]); x = GEN->CDFmin + (table_size-i-1) * (GEN->CDFmax - GEN->CDFmin) / (table_size-1.); GEN->table[table_size-1-i] = _unur_ninv_regula(gen,x); GEN->f_table[table_size-1-i] = CDF(GEN->table[table_size-1-i]); /* set new starting points for computing table points in next step */ if (GEN->table[i] > -UNUR_INFINITY) { GEN->s[0] = GEN->table[i]; GEN->CDFs[0] = GEN->f_table[i]; } if (GEN->table[table_size-1-i] < UNUR_INFINITY) { GEN->s[1] = GEN->table[table_size-1-i]; GEN->CDFs[1] = GEN->f_table[table_size-1-i]; } } /* end of for() */ /* the median point (only if table_size is odd) */ if (table_size & 1) { x = GEN->CDFmin + (table_size/2) * (GEN->CDFmax - GEN->CDFmin) / (table_size-1.); GEN->table[table_size/2] = _unur_ninv_regula(gen,x); GEN->f_table[table_size/2] = CDF(GEN->table[table_size/2]); } /* calculation of tables finished */ GEN->table_on = TRUE; /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_ninv_create_table() */ /*---------------------------------------------------------------------------*/ int _unur_ninv_compute_start( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* compute starting points for numerical inversion. */ /* use 5% percentiles. */ /* */ /* parameters: */ /* gen ... pointer generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { double u; /* check arguments */ CHECK_NULL(gen, UNUR_ERR_NULL); _unur_check_gen_object(gen, NINV, UNUR_ERR_GEN_INVALID); if( GEN->table_on ) /* we have a table --> nothing to do */ return UNUR_SUCCESS; if( !_unur_FP_same(GEN->s[0],GEN->s[1]) ) { /* use given starting points (indicated by s[0] != s[1]) --> nothing to do */ GEN->CDFs[0] = CDF(GEN->s[0]); GEN->CDFs[1] = CDF(GEN->s[1]); return UNUR_SUCCESS; } switch (gen->variant) { case NINV_VARFLAG_BISECT: case NINV_VARFLAG_REGULA: /* get arbitrary points */ GEN->s[0] = _unur_max( DISTR.domain[0], -10.); GEN->s[1] = _unur_min( DISTR.domain[1], GEN->s[0]+20. ); GEN->CDFs[0] = CDF(GEN->s[0]); GEN->CDFs[1] = CDF(GEN->s[1]); /* left percentile */ u = GEN->CDFmin + 0.5*(1.-INTERVAL_COVERS)*(GEN->CDFmax-GEN->CDFmin); GEN->s[0] = _unur_ninv_regula(gen,u); GEN->CDFs[0] = CDF(GEN->s[0]); /* right percentile */ GEN->s[1] = _unur_min( DISTR.domain[1], GEN->s[0]+20. ); u = GEN->CDFmin + 0.5*(1.+INTERVAL_COVERS)*(GEN->CDFmax-GEN->CDFmin); GEN->s[1] = _unur_ninv_regula(gen,u); GEN->CDFs[1] = CDF(GEN->s[1]); break; /* case REGULA end */ case NINV_VARFLAG_NEWTON: /* get arbitrary points */ GEN->s[0] = _unur_max( DISTR.domain[0], -9.987655 ); GEN->s[1] = _unur_min( DISTR.domain[1], GEN->s[0]+20. ); GEN->CDFs[0] = CDF(GEN->s[0]); GEN->CDFs[1] = CDF(GEN->s[1]); /* median */ u = 0.5 * (GEN->CDFmin + GEN->CDFmax); GEN->s[0] = _unur_ninv_regula(gen, u); /* reglua more stable */ GEN->CDFs[0] = CDF(GEN->s[0]); break; /* case NEWTON end */ default: _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); return UNUR_ERR_SHOULD_NOT_HAPPEN; } /* end of switch */ /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_ninv_compute_start() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/tdr_gw_debug.ch0000644001357500135600000003423714420445767015265 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: tdr_gw_debug.c * * * * TYPE: continuous univariate random variate * * METHOD: transformed density rejection * * * * DESCRIPTION: * * Debugging routines for variant of Gilks and Wild. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ void _unur_tdr_gw_debug_intervals( const struct unur_gen *gen, int print_areas ) /*----------------------------------------------------------------------*/ /* write list of intervals into LOG file(orig. variant by Gilks & Wild) */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* print_areas ... whether table of areas should be printed */ /*----------------------------------------------------------------------*/ { FILE *LOG; struct unur_tdr_interval *iv; double sAsqueeze, sAhatl, sAhatr, Atotal; int i; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_TDR_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s:Intervals: %d\n",gen->genid,GEN->n_ivs); if (GEN->iv) { if (gen->debug & TDR_DEBUG_IV) { fprintf(LOG,"%s: Nr. tp ip f(tp) T(f(tp)) d(T(f(tp))) squeeze\n",gen->genid); for (iv = GEN->iv, i=0; iv->next!=NULL; iv=iv->next, i++) { COOKIE_CHECK(iv,CK_TDR_IV,RETURN_VOID); fprintf(LOG,"%s:[%3d]: %#12.6g %#12.6g %#12.6g %#12.6g %#12.6g %#12.6g\n", gen->genid, i, iv->x, iv->ip, iv->fx, iv->Tfx, iv->dTfx, iv->sq); } COOKIE_CHECK(iv,CK_TDR_IV,RETURN_VOID); fprintf(LOG,"%s:[...]: %#12.6g %#12.6g %#12.6g %#12.6g\n", gen->genid, iv->x, iv->fx, iv->Tfx, iv->dTfx); } fprintf(LOG,"%s:\n",gen->genid); } else fprintf(LOG,"%s: No intervals !\n",gen->genid); if (!print_areas || GEN->Atotal <= 0.) return; /* print and sum areas below squeeze and hat */ Atotal = GEN->Atotal; if (gen->debug & TDR_DEBUG_IV) { fprintf(LOG,"%s:Areas in intervals:\n",gen->genid); fprintf(LOG,"%s: Nr.\tbelow squeeze\t\t below hat (left and right)\t\t cumulated\n",gen->genid); sAsqueeze = sAhatl = sAhatr = 0.; if (GEN->iv) { for (iv = GEN->iv, i=0; iv->next!=NULL; iv=iv->next, i++) { COOKIE_CHECK(iv,CK_TDR_IV,RETURN_VOID); sAsqueeze += iv->Asqueeze; sAhatl += iv->Ahat - iv->Ahatr; sAhatr += iv->Ahatr; fprintf(LOG,"%s:[%3d]: %-12.6g(%6.3f%%) | %-12.6g+ %-12.6g(%6.3f%%) | %-12.6g(%6.3f%%)\n", gen->genid,i, iv->Asqueeze, iv->Asqueeze * 100. / Atotal, iv->Ahat-iv->Ahatr, iv->Ahatr, iv->Ahat * 100. / Atotal, iv->Acum, iv->Acum * 100. / Atotal); } fprintf(LOG,"%s: ---------- --------- | ------------------------ --------- +\n",gen->genid); fprintf(LOG,"%s: Sum : %-12.6g(%6.3f%%) %-12.6g (%6.3f%%)\n",gen->genid, sAsqueeze, sAsqueeze * 100. / Atotal, sAhatl+sAhatr, (sAhatl+sAhatr) * 100. / Atotal); fprintf(LOG,"%s:\n",gen->genid); } } /* summary of areas */ fprintf(LOG,"%s: A(squeeze) = %-12.6g (%6.3f%%)\n",gen->genid, GEN->Asqueeze, GEN->Asqueeze * 100./Atotal); fprintf(LOG,"%s: A(hat\\squeeze) = %-12.6g (%6.3f%%)\n",gen->genid, Atotal - GEN->Asqueeze, (Atotal - GEN->Asqueeze) * 100./Atotal); fprintf(LOG,"%s: A(total) = %-12.6g\n",gen->genid, Atotal); fprintf(LOG,"%s:\n",gen->genid); } /* end of _unur_tdr_gw_debug_intervals() */ /*---------------------------------------------------------------------------*/ void _unur_tdr_gw_debug_sample( const struct unur_gen *gen, const struct unur_tdr_interval *iv, const struct unur_tdr_interval *pt, double x, double fx, double hx, double sqx ) /*----------------------------------------------------------------------*/ /* write info about generated point */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* iv ... pointer to interval */ /* pt ... pointer to interval that stores construction point */ /* x ... generated point */ /* fx ... value of PDF at x */ /* hx ... value of hat at x */ /* sqx ... value of squeeze at x */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_TDR_GEN,RETURN_VOID); CHECK_NULL(iv,RETURN_VOID); COOKIE_CHECK(iv,CK_TDR_IV,RETURN_VOID); CHECK_NULL(pt,RETURN_VOID); COOKIE_CHECK(pt,CK_TDR_IV,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s:\n",gen->genid); if (iv == pt) fprintf(LOG,"%s: point generated in left part:\n",gen->genid); else fprintf(LOG,"%s: point generated in right part:\n",gen->genid); fprintf(LOG,"%s: construction point: x0 = %g\n",gen->genid,pt->x); fprintf(LOG,"%s: transformed hat Th(x) = %g + %g * (x - %g)\n",gen->genid,pt->Tfx,pt->dTfx,pt->x); fprintf(LOG,"%s: transformed squeeze Ts(x) = %g + %g * (x - %g)\n",gen->genid,iv->Tfx,iv->sq,iv->x); fprintf(LOG,"%s: generated point: x = %g\n",gen->genid,x); fprintf(LOG,"%s: h(x) = %.20g\n",gen->genid,hx); fprintf(LOG,"%s: f(x) = %.20g\n",gen->genid,fx); fprintf(LOG,"%s: s(x) = %.20g\n",gen->genid,sqx); fprintf(LOG,"%s: hat: x - x0 = %g",gen->genid,x-pt->x); if (x < pt->x && iv == pt) fprintf(LOG," <-- error\n"); else fprintf(LOG,"\n"); fprintf(LOG,"%s: h(x) - f(x) = %g",gen->genid,hx-fx); if (hxgenid,x-iv->x); if (x > pt->x && iv != pt) fprintf(LOG," <-- error\n"); else fprintf(LOG,"\n"); fprintf(LOG,"%s: f(x) - s(x) = %g",gen->genid,fx-sqx); if (fxgenid); fflush(LOG); } /* end of _unur_tdr_gw_debug_sample() */ /*---------------------------------------------------------------------------*/ void _unur_tdr_gw_debug_split_start( const struct unur_gen *gen, const struct unur_tdr_interval *iv, double x, double fx ) /*----------------------------------------------------------------------*/ /* write info about splitting interval */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* iv ... pointer to interval */ /* x ... split at this point */ /* fx ... value of PDF at x */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_TDR_GEN,RETURN_VOID); CHECK_NULL(iv,RETURN_VOID); COOKIE_CHECK(iv,CK_TDR_IV,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s: split interval at x = %g \t\tf(x) = %g\n",gen->genid,x,fx); fprintf(LOG,"%s: old interval:\n",gen->genid); fprintf(LOG,"%s: left construction point = %-12.6g\tf(x) = %-12.6g\n",gen->genid,iv->x,iv->fx); fprintf(LOG,"%s: right construction point = %-12.6g\tf(x) = %-12.6g\n",gen->genid,iv->next->x,iv->next->fx); fprintf(LOG,"%s: A(squeeze) = %-12.6g\t\t(%6.3f%%)\n",gen->genid, iv->Asqueeze,iv->Asqueeze*100./GEN->Atotal); fprintf(LOG,"%s: A(hat\\squeeze) = %-12.6g\t\t(%6.3f%%)\n",gen->genid, (iv->Ahat - iv->Asqueeze),(iv->Ahat - iv->Asqueeze)*100./GEN->Atotal); fprintf(LOG,"%s: A(hat) = %-12.6g + %-12.6g(%6.3f%%)\n",gen->genid, iv->Ahat - iv->Ahatr, iv->Ahatr, iv->Ahat*100./GEN->Atotal); fflush(LOG); } /* end of _unur_tdr_gw_debug_split_start() */ /*---------------------------------------------------------------------------*/ void _unur_tdr_gw_debug_split_stop( const struct unur_gen *gen, const struct unur_tdr_interval *iv_left, const struct unur_tdr_interval *iv_right ) /*----------------------------------------------------------------------*/ /* write info about new splitted intervals */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* iv_left ... pointer to new left hand interval */ /* iv_right ... pointer to new right hand interval */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_TDR_GEN,RETURN_VOID); CHECK_NULL(iv_left,RETURN_VOID); COOKIE_CHECK(iv_left,CK_TDR_IV,RETURN_VOID); if (iv_right == NULL) iv_right = iv_left; LOG = unur_get_stream(); fprintf(LOG,"%s: inserted point:\n",gen->genid); fprintf(LOG,"%s: x = %g, f(x) = %g, Tf(x)=%g, dTf(x) = %g, squeeze = %g:\n", gen->genid, iv_right->x, iv_right->fx, iv_right->Tfx, iv_right->dTfx, iv_right->sq); fprintf(LOG,"%s: new intervals:\n",gen->genid); fprintf(LOG,"%s: left construction point = %g\n",gen->genid, iv_left->x); if (iv_left != iv_right) fprintf(LOG,"%s: middle construction point = %g\n",gen->genid, iv_right->x); fprintf(LOG,"%s: right construction point = %g\n",gen->genid, iv_right->next->x); fprintf(LOG,"%s: left interval:\n",gen->genid); fprintf(LOG,"%s: A(squeeze) = %-12.6g\t\t(%6.3f%%)\n",gen->genid, iv_left->Asqueeze, iv_left->Asqueeze*100./GEN->Atotal); fprintf(LOG,"%s: A(hat\\squeeze) = %-12.6g\t\t(%6.3f%%)\n",gen->genid, (iv_left->Ahat - iv_left->Asqueeze), (iv_left->Ahat - iv_left->Asqueeze) * 100./GEN->Atotal); fprintf(LOG,"%s: A(hat) = %-12.6g + %-12.6g(%6.3f%%)\n",gen->genid, iv_left->Ahat - iv_left->Ahatr, iv_left->Ahatr, iv_left->Ahat * 100./GEN->Atotal); if (iv_left == iv_right) fprintf(LOG,"%s: interval chopped.\n",gen->genid); else { fprintf(LOG,"%s: right interval:\n",gen->genid); fprintf(LOG,"%s: A(squeeze) = %-12.6g\t\t(%6.3f%%)\n",gen->genid, iv_right->Asqueeze, iv_right->Asqueeze*100./GEN->Atotal); fprintf(LOG,"%s: A(hat\\squeeze) = %-12.6g\t\t(%6.3f%%)\n",gen->genid, (iv_right->Ahat - iv_right->Asqueeze), (iv_right->Ahat - iv_right->Asqueeze) * 100./GEN->Atotal); fprintf(LOG,"%s: A(hat) = %-12.6g + %-12.6g(%6.3f%%)\n",gen->genid, iv_right->Ahat - iv_right->Ahatr, iv_right->Ahatr, iv_right->Ahat * 100./GEN->Atotal); } fprintf(LOG,"%s: total areas:\n",gen->genid); fprintf(LOG,"%s: A(squeeze) = %-12.6g\t\t(%6.3f%%)\n",gen->genid, GEN->Asqueeze, GEN->Asqueeze * 100./GEN->Atotal); fprintf(LOG,"%s: A(hat\\squeeze) = %-12.6g\t\t(%6.3f%%)\n",gen->genid, GEN->Atotal - GEN->Asqueeze, (GEN->Atotal - GEN->Asqueeze) * 100./GEN->Atotal); fprintf(LOG,"%s: A(total) = %-12.6g\n",gen->genid, GEN->Atotal); fprintf(LOG,"%s:\n",gen->genid); fflush(LOG); } /* end of _unur_tdr_gw_debug_split_stop() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/dari.c0000644001357500135600000015160614420445767013400 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: dari.c * * * * TYPE: discrete univariate random variate * * METHOD: discrete automatic rejection inversion * * * * DESCRIPTION: * * Given PMF of a T(-1/2)-concave distribution; * * produce a value x consistent with its PMF. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * ***************************************************************************** * * * REFERENCES: * * [1] Hoermann W. and G.Derflinger (1997): * * An automatic generator for a large class of discrete unimodal * * distributions, in A.R. Kaylan and A. Lehmann, ESM 97, pp 139-144 * * * * [2] Hoermann W. and G.Derflinger (1996): * * Rejection-inversion to generate variates from monotone discrete * * distributions, ACM TOMACS 6(3), 169-184 * * * ***************************************************************************** * * * ..... beschreibung .... * * * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include "unur_methods_source.h" #include "x_gen_source.h" #include "dari.h" #include "dari_struct.h" #ifdef UNUR_ENABLE_INFO # include #endif /*---------------------------------------------------------------------------*/ /* Variants */ #define DARI_VARFLAG_VERIFY 0x01u /* flag for verifying mode */ /*---------------------------------------------------------------------------*/ /* Debugging flags */ /* bit 01 ... pameters and structure of generator (do not use here) */ /* bits 02-12 ... setup */ /* bits 13-24 ... adaptive steps */ /* bits 25-32 ... trace sampling */ #define DARI_DEBUG_REINIT 0x00000010u /* print parameters after reinit */ /*---------------------------------------------------------------------------*/ /* Flags for logging set calls */ #define DARI_SET_CFACTOR 0x001u #define DARI_SET_TABLESIZE 0x002u /*---------------------------------------------------------------------------*/ #define GENTYPE "DARI" /* type of generator */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_dari_init( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* Initialize new generator. */ /*---------------------------------------------------------------------------*/ static int _unur_dari_reinit( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Reinitialize generator. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_dari_create( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* create new (almost empty) generator object. */ /*---------------------------------------------------------------------------*/ static int _unur_dari_check_par( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Check parameters of given distribution and method */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_dari_clone( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* copy (clone) generator object. */ /*---------------------------------------------------------------------------*/ static void _unur_dari_free( struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* destroy generator object. */ /*---------------------------------------------------------------------------*/ static int _unur_dari_sample( struct unur_gen *gen ); static int _unur_dari_sample_check( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* sample from generator */ /*---------------------------------------------------------------------------*/ static int _unur_dari_hat( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* compute hat. */ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ /* the following functions print debugging information on output stream, */ /* i.e., into the LOG file if not specified otherwise. */ /*---------------------------------------------------------------------------*/ static void _unur_dari_debug_init( struct unur_gen *gen, const char *status ); /*---------------------------------------------------------------------------*/ /* print after generator has been initialized has completed. */ /*---------------------------------------------------------------------------*/ #endif #ifdef UNUR_ENABLE_INFO static void _unur_dari_info( struct unur_gen *gen, int help ); /*---------------------------------------------------------------------------*/ /* create info string. */ /*---------------------------------------------------------------------------*/ #endif /*---------------------------------------------------------------------------*/ /* abbreviations */ #define DISTR_IN distr->data.discr /* data for distribution object */ #define PAR ((struct unur_dari_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_dari_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.discr /* data for distribution in generator object */ #define BD_LEFT domain[0] /* left boundary of domain of distribution */ #define BD_RIGHT domain[1] /* right boundary of domain of distribution */ #define SAMPLE gen->sample.discr /* pointer to sampling routine */ #define PMF(x) _unur_discr_PMF((x),(gen->distr)) /* call to PMF */ /*---------------------------------------------------------------------------*/ #define T(x) (-1./sqrt(x)) /* transformation for PMF */ #define F(x) (-1./(x)) /* anti-derivative of inverse transformation */ #define FM(x) (-1./(x)) /* inverse of anti-derivative */ #define N0 (GEN->n[0]) /* first position in table */ /*---------------------------------------------------------------------------*/ #define _unur_dari_getSAMPLE(gen) \ ( ((gen)->variant & DARI_VARFLAG_VERIFY) \ ? _unur_dari_sample_check : _unur_dari_sample ) /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Public: User Interface (API) **/ /*****************************************************************************/ struct unur_par * unur_dari_new( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get default parameters */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* default parameters (pointer to structure) */ /* */ /* error: */ /* return NULL */ /* */ /* comment: */ /* if the sum over the PMF is not close to 1 it is necessary to */ /* set pmf_sum to an approximate value of its sum (+/- 30 % is ok). */ /*----------------------------------------------------------------------*/ { struct unur_par *par; /* check arguments */ _unur_check_NULL( GENTYPE,distr,NULL ); /* check distribution */ if (distr->type != UNUR_DISTR_DISCR) { _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } COOKIE_CHECK(distr,CK_DISTR_DISCR,NULL); if (DISTR_IN.pmf == NULL) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PMF"); return NULL; } if (DISTR_IN.domain[0] < 0) { _unur_error(GENTYPE,UNUR_ERR_DISTR_PROP,"domain contains negative numbers"); return NULL; } /* allocate structure */ par = _unur_par_new( sizeof(struct unur_dari_par) ); COOKIE_SET(par,CK_DARI_PAR); /* copy input */ par->distr = distr; /* pointer to distribution object */ /* set default values */ PAR->c_factor = 0.664; /* optimal value for the normal distribution, which is good for all */ /* bell-shaped densities. The minimax approach for that transformation */ /* has c_factor = 2. */ PAR->squeeze = 0; /* no squeezes by default as squeezes slow down the */ /* sampling for most distributions if PAR->size is big enough. Squeeze is */ /* important for the speed only when small samples are required or when */ /* the domain of the distribution is very big. (much bigger than PAR->size) */ PAR->size = 100; /*size of table that stores the "rejection point" for */ /* all integers close to the mode when needed the first time while */ /* sampling; can speed up the generation considerably. */ par->method = UNUR_METH_DARI; /* method */ par->variant = 0u; /* default variant */ par->set = 0u; /* inidicate default parameters */ par->urng = unur_get_default_urng(); /* use default urng */ par->urng_aux = NULL; /* no auxilliary URNG required */ par->debug = _unur_default_debugflag; /* set default debugging flags */ /* routine for starting generator */ par->init = _unur_dari_init; return par; } /* end of unur_dari_new() */ /*****************************************************************************/ int unur_dari_set_cpfactor( struct unur_par *par, double cpfactor ) /*----------------------------------------------------------------------*/ /* set factor for position of left and right construction point */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* cfactor ... factor */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); /* check input */ _unur_check_par_object( par, DARI ); /* check new parameter for generator */ /** TODO: welche werte fuer c sind zulaessig / sinnvoll ? zulaessig ist jedes c>0, man koennte damit falsche Flaechenangaben kompensieren. Wenn sum genau bekannt ist, ist ein c > 2 (2 ist der minimax approach) so weit ich weiss nie sinnvoll. Ich denke aber, das sollte man besser nicht prinzipiell verbieten, hoechstens eine warnung.**/ if (cpfactor <= 0.) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"cp-factor <= 0"); return UNUR_ERR_PAR_SET; } if (cpfactor > 2.1) _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"cp-factor > 2 not recommended. skip"); /* store date */ PAR->c_factor = cpfactor; /* changelog */ par->set |= DARI_SET_CFACTOR; return UNUR_SUCCESS; } /* end of unur_dari_set_cpfactor() */ /*---------------------------------------------------------------------------*/ int unur_dari_set_squeeze( struct unur_par *par, int squeeze ) /*----------------------------------------------------------------------*/ /* turn on/off using squeezes */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* squeeze ... 0 = no squeeze, !0 = use squeeze */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); /* check input */ _unur_check_par_object( par, DARI ); /* store data */ PAR->squeeze = squeeze; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_dari_set_squeeze() */ /*---------------------------------------------------------------------------*/ int unur_dari_set_tablesize( struct unur_par *par, int size ) /*----------------------------------------------------------------------*/ /* set size of table */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* size ... table size */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* no verifying is the default */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); /* check input */ _unur_check_par_object( par, DARI ); /* check parameter */ if (size < 0) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"invalid table size"); return UNUR_ERR_PAR_SET; } /* store data */ PAR->size = size; /* changelog */ par->set |= DARI_SET_TABLESIZE; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_dari_set_tablesize() */ /*---------------------------------------------------------------------------*/ int unur_dari_set_verify( struct unur_par *par, int verify ) /*----------------------------------------------------------------------*/ /* turn verifying of algorithm while sampling on/off */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* verify ... 0 = no verifying, !0 = verifying */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* no verifying is the default */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); /* check input */ _unur_check_par_object( par, DARI ); /* we use a bit in variant */ par->variant = (verify) ? (par->variant | DARI_VARFLAG_VERIFY) : (par->variant & (~DARI_VARFLAG_VERIFY)); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_dari_set_verify() */ /*---------------------------------------------------------------------------*/ int unur_dari_chg_verify( struct unur_gen *gen, int verify ) /*----------------------------------------------------------------------*/ /* turn verifying of algorithm while sampling on/off */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* verify ... 0 = no verifying, !0 = verifying */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* no verifying is the default */ /*----------------------------------------------------------------------*/ { /* check input */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, DARI, UNUR_ERR_GEN_INVALID ); /* we must not change this switch when sampling has been disabled by using a pointer to the error producing routine */ if (SAMPLE == _unur_sample_discr_error) return UNUR_FAILURE; if (verify) /* turn verify mode on */ gen->variant |= DARI_VARFLAG_VERIFY; else /* turn verify mode off */ gen->variant &= ~DARI_VARFLAG_VERIFY; SAMPLE = _unur_dari_getSAMPLE(gen); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_dari_chg_verify() */ /*****************************************************************************/ /** Private **/ /*****************************************************************************/ struct unur_gen * _unur_dari_init( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* initialize new generator */ /* */ /* parameters: */ /* par ... pointer to paramters for building generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ _unur_check_NULL( GENTYPE, par, NULL ); /* check input */ if ( par->method != UNUR_METH_DARI ) { _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); return NULL; } COOKIE_CHECK(par,CK_DARI_PAR,NULL); /* create a new empty generator object */ gen = _unur_dari_create(par); /* free parameters */ _unur_par_free(par); if (!gen) return NULL; /* check parameters */ if (_unur_dari_check_par(gen) != UNUR_SUCCESS) { _unur_dari_free(gen); return NULL; } /* create hat and squeeze (setup procedure) */ if ( _unur_dari_hat(gen)!=UNUR_SUCCESS ) { /* error */ _unur_dari_free(gen); return NULL; } /* hat successfully created */ #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_dari_debug_init(gen,"INIT completed"); #endif /* o.k. */ return gen; } /* end of _unur_dari_init() */ /*---------------------------------------------------------------------------*/ int _unur_dari_reinit( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* re-initialize (existing) generator. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int result; /* check parameters */ if ( (result = _unur_dari_check_par(gen)) != UNUR_SUCCESS) return result; /* compute hat */ if ( (result = _unur_dari_hat( gen )) != UNUR_SUCCESS) return result; /* (re)set sampling routine */ SAMPLE = _unur_dari_getSAMPLE(gen); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug & DARI_DEBUG_REINIT) _unur_dari_debug_init(gen,"REINIT completed"); #endif /* hat successfully created */ return UNUR_SUCCESS; } /* end of _unur_dari_reinit() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_dari_create( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* allocate memory for generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* pointer to (empty) generator object with default settings */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_DARI_PAR,NULL); /* create new generic generator object */ gen = _unur_generic_create( par, sizeof(struct unur_dari_gen) ); /* magic cookies */ COOKIE_SET(gen,CK_DARI_GEN); /* set generator identifier */ gen->genid = _unur_set_genid(GENTYPE); /* routines for sampling and destroying generator */ SAMPLE = _unur_dari_getSAMPLE(gen); gen->destroy = _unur_dari_free; gen->clone = _unur_dari_clone; gen->reinit = _unur_dari_reinit; /* copy some parameters into generator object */ GEN->squeeze = PAR->squeeze; /* squeeze yes/no? */ GEN->c_factor = PAR->c_factor; /* constant for choice of design point */ /* size of auxiliary table; 0 for none it cannot be larger than the given domain (avoid overflow) */ if ((unsigned)DISTR.BD_RIGHT - (unsigned)DISTR.BD_LEFT < INT_MAX) GEN->size = _unur_min(PAR->size,DISTR.BD_RIGHT-DISTR.BD_LEFT+1); else /* length of interval > INT_MAX */ GEN->size = PAR->size; /* allocate */ GEN->hp = (GEN->size > 0) ? _unur_xmalloc( GEN->size * sizeof(double) ) : NULL; GEN->hb = (GEN->size > 0) ? _unur_xmalloc( GEN->size * sizeof(char) ) : NULL; /* initialize parameters */ GEN->vt=0.; /* total volume below hat */ GEN->vc=0.; /* volume below center part */ GEN->vcr=0.; /* volume center and right together */ GEN->xsq[0]=0.; /* value necessary for the squeeze computation */ GEN->xsq[1]=0.; /* value necessary for the squeeze computation */ GEN->y[0]=0.; /* value of the transformed density in points of contact */ GEN->y[1]=0.; /* value of the transformed density in points of contact */ GEN->ys[0]=0.; /* the slope of the transformed hat */ GEN->ys[1]=0.; /* the slope of the transformed hat */ GEN->ac[0]=0.; /* left and right starting point of the uniform hat in the center */ GEN->ac[1]=0.; /* left and right starting point of the uniform hat in the center */ GEN->pm=0.; /* mode probability */ GEN->Hat[0]=0.; /* point where the hat starts for the left and the right tail */ GEN->Hat[1]=0.; /* point where the hat starts for the left and the right tail */ GEN->m=0; /* mode */ GEN->x[0]=0; /* points of contact left and right of the mode */ GEN->x[1]=0; /* points of contact left and right of the mode */ GEN->s[0]=0; /* first and last integer of the center part */ GEN->s[1]=0; /* first and last integer of the center part */ GEN->n[0]=0; /* contains the first and the last i for which values are stored in table */ GEN->n[1]=0; /* contains the first and the last i for which values are stored in table */ #ifdef UNUR_ENABLE_INFO /* set function for creating info string */ gen->info = _unur_dari_info; #endif /* return pointer to (almost empty) generator object */ return gen; } /* end of _unur_dari_create() */ /*---------------------------------------------------------------------------*/ int _unur_dari_check_par( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* check parameters of given distribution and method */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check for required data: mode */ if (!(gen->distr->set & UNUR_DISTR_SET_MODE)) { _unur_warning(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"mode: try finding it (numerically)"); if (unur_distr_discr_upd_mode( gen->distr )!=UNUR_SUCCESS) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"mode"); return UNUR_ERR_DISTR_REQUIRED; } } /* check mode. we assume unimodality since otherwise the PMF would not be T-concave! */ if (DISTR.BD_LEFT > DISTR.mode) DISTR.mode = DISTR.BD_LEFT; else if (DISTR.BD_RIGHT < DISTR.mode) DISTR.mode = DISTR.BD_RIGHT; /* check for required data: sum over PMF */ if (!(gen->distr->set & UNUR_DISTR_SET_PMFSUM)) if (unur_distr_discr_upd_pmfsum(gen->distr)!=UNUR_SUCCESS) _unur_warning(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"sum over PMF; use default"); /* sum must not be zero */ if (DISTR.sum <= 0.) { _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"sum <= 0"); return UNUR_ERR_GEN_DATA; } return UNUR_SUCCESS; } /* end of _unur_dari_check_par() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_dari_clone( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* copy (clone) generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to clone of generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { #define CLONE ((struct unur_dari_gen*)clone->datap) struct unur_gen *clone; /* check arguments */ CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_DARI_GEN,NULL); /* create generic clone */ clone = _unur_generic_clone( gen, GENTYPE ); /* copy additional data */ if (GEN->size > 0) { CLONE->hp = _unur_xmalloc( GEN->size * sizeof(double) ); memcpy( CLONE->hp, GEN->hp, GEN->size * sizeof(double) ); CLONE->hb = _unur_xmalloc( GEN->size * sizeof(char) ); memcpy( CLONE->hb, GEN->hb, GEN->size * sizeof(char) ); } return clone; #undef CLONE } /* end of _unur_dari_clone() */ /*---------------------------------------------------------------------------*/ void _unur_dari_free( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* deallocate generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { /* check arguments */ if( !gen ) /* nothing to do */ return; /* check input */ if ( gen->method != UNUR_METH_DARI ) { _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); return; } COOKIE_CHECK(gen,CK_DARI_GEN,RETURN_VOID); /* we cannot use this generator object any more */ SAMPLE = NULL; /* make sure to show up a programming error */ /* free two auxiliary tables */ if (GEN->hp) free(GEN->hp); if (GEN->hb) free(GEN->hb); /* free memory */ _unur_generic_free(gen); } /* end of _unur_dari_free() */ /*****************************************************************************/ int _unur_dari_sample( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return INT_MAX */ /*----------------------------------------------------------------------*/ { double U, h; double X = 0.; int k,i; static const int sign[2] = {-1,1}; /* check arguments */ CHECK_NULL(gen,INT_MAX); COOKIE_CHECK(gen,CK_DARI_GEN,INT_MAX); /* step 1.0 */ while (1) { U = _unur_call_urng(gen->urng) * GEN->vt; /* step 1.1 */ if (U<=GEN->vc) { X = U * (GEN->ac[1]-GEN->ac[0]) / GEN->vc + GEN->ac[0]; k = (int)(X+0.5); i = (km) ? 0 : 1; if (GEN->squeeze && sign[i]*(GEN->ac[i]-GEN->s[i]) > sign[i]*(X-k)) return k; if (sign[i]*k <= sign[i]*GEN->n[i]) { if (!GEN->hb[k-N0]) { GEN->hp[k-N0] = 0.5 - PMF(k)/GEN->pm; GEN->hb[k-N0] = 1; } h = GEN->hp[k-N0]; } else { h = 0.5-PMF(k)/GEN->pm; } if (h <= sign[i]*(k-X)) return k; } /*step 1.2*/ else { if (U<= GEN->vcr) { i = 1; U -= GEN->vc; } else { i = 0; U -= GEN->vcr; } U = GEN->Hat[i] + sign[i]*U; X = GEN->x[i] + (FM(U*GEN->ys[i])-GEN->y[i]) / GEN->ys[i]; k = (int)(X+0.5); if (GEN->squeeze && (sign[i]*k <= sign[i]*GEN->x[i]+1) && (GEN->xsq[i] <= sign[i]*(X-k))) return k; if (sign[i]*k <= sign[i]*GEN->n[i]) { if (!GEN->hb[k-N0]) { GEN->hp[k-N0] = sign[i] * F(GEN->y[i]+GEN->ys[i]*(k+sign[i]*0.5-GEN->x[i])) / GEN->ys[i] - PMF(k); GEN->hb[k-N0] = 1; } h = GEN->hp[k-N0]; } else { h = sign[i] * F(GEN->y[i]+GEN->ys[i]*(k+sign[i]*0.5-GEN->x[i])) / GEN->ys[i]-PMF(k); } if (sign[i]*U >= h) return k; } } } /* end of _unur_dari_sample() */ /*---------------------------------------------------------------------------*/ int _unur_dari_sample_check( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return INT_MAX */ /*----------------------------------------------------------------------*/ { double U, h; double X = 0.; double hkm05; int k,i; static const int sign[2] = {-1,1}; /* check arguments */ CHECK_NULL(gen,INT_MAX); COOKIE_CHECK(gen,CK_DARI_GEN,INT_MAX); /* step 1.0 */ while (1) { U = _unur_call_urng(gen->urng) * GEN->vt; /* step 1.1 */ if (U <= GEN->vc) { X = U * (GEN->ac[1]-GEN->ac[0]) / GEN->vc + GEN->ac[0]; k = (int)(X+0.5); i = (km) ? 0 : 1; if (GEN->squeeze && sign[i]*(GEN->ac[i]-GEN->s[i]) > sign[i]*(X-k)) return k; if (sign[i]*k <= sign[i]*GEN->n[i]) { if (!GEN->hb[k-N0]) { GEN->hp[k-N0] = 0.5 - PMF(k)/GEN->pm; GEN->hb[k-N0] = 1; } h = GEN->hp[k-N0]; /* CHECKING HAT */ if (h+UNUR_EPSILON*100.<-0.5) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION, "PMF(i) > hat(i) for centerpart"); _unur_log_printf(gen->genid,__FILE__,__LINE__, "i %d PMF(x) %.20e hat(x) %.20e", k,PMF(k),GEN->pm ); } /* end CHECKING HAT */ } else { h = 0.5 - PMF(k)/GEN->pm; /* CHECKING HAT */ /* here UNUR_EPSILON can be too small for distributions that have two neighbouring hats. */ if (h+UNUR_EPSILON*100.<-0.5) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION, "PMF(i) > hat(i) for centerpart"); _unur_log_printf(gen->genid,__FILE__,__LINE__, "i %d PMF(x) %.20e hat(x) %.20e", k,PMF(k),GEN->pm ); } /* end CHECKING HAT */ } if (h <= sign[i]*(k-X)) return k; } /*step 1.2*/ else { if (U<= GEN->vcr) { i = 1; U -= GEN->vc; } else { i = 0; U -= GEN->vcr; } U = GEN->Hat[i] + sign[i]*U; X = GEN->x[i] + (FM(U*GEN->ys[i])-GEN->y[i]) / GEN->ys[i]; k = (int)(X+0.5); /* this is for a very rare case that for k of the tail closest to the mode an x value farer away than 0.5 is generated. */ if(k==GEN->s[i]) k += sign[i]; if (GEN->squeeze && (sign[i]*k <= sign[i]*GEN->x[i]+1) && (GEN->xsq[i] <= sign[i]*(X-k))) return k; if (sign[i]*k <= sign[i]*GEN->n[i]) { if(!GEN->hb[k-N0]) { GEN->hp[k-N0] = sign[i] * F(GEN->y[i]+GEN->ys[i]*(k+sign[i]*0.5-GEN->x[i])) / GEN->ys[i] - PMF(k); /* CHECKING HAT: (only necessary if(k!=GEN->s+1) as for the border the hat is by construction correct) tests if Hat too low i.e.: (H(k+0.5)- p_k < H(k-0.5)) */ if(k != GEN->s[i]+sign[i]) { hkm05 = sign[i] * F(GEN->y[i]+GEN->ys[i]*(k-sign[i]*0.5-GEN->x[i])) / GEN->ys[i]; if (GEN->hp[k-N0]+UNUR_EPSILON < hkm05) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION, "for tailpart hat too low, ie hp[k] < H(k-0.5)"); _unur_log_printf(gen->genid,__FILE__,__LINE__, "k %d hp %.20e H(k-0.5) %.20e ", k,GEN->hp[k-N0],hkm05 ); } } GEN->hb[k-N0] = 1; } h = GEN->hp[k-N0]; } else { h = sign[i] * F(GEN->y[i]+GEN->ys[i]*(k+sign[i]*0.5-GEN->x[i])) / GEN->ys[i] - PMF(k); /* CHECKING HAT:(only necessary if(k!=GEN->s+1) as for the border the hat is by construction correct) tests if Hat too low i.e.: (H(k+0.5)-p_k < H(k-1/2)) */ hkm05 = sign[i] * F(GEN->y[i]+GEN->ys[i]*(k-sign[i]*0.5-GEN->x[i])) / GEN->ys[i]; if(k != GEN->s[i]+sign[i]) { if (h+UNUR_EPSILON < hkm05) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION, "PMF(i) > hat(i) for tailpart"); _unur_log_printf(gen->genid,__FILE__,__LINE__, "k %d h %.20e H(k-0.5) %.20e ", k,h,hkm05 ); } } } if (sign[i]*U >= h) return k; } } } /* end of _unur_dari_sample_check() */ /*****************************************************************************/ /** Auxilliary Routines **/ /*****************************************************************************/ int _unur_dari_hat( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* compute hat */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int sign[2] = {-1,1}; int b[2], d, i, j; double v[2], at[2]; double t0 = 1.; int setup = 1; int rep = 1; /* check arguments */ CHECK_NULL( gen, UNUR_ERR_NULL ); COOKIE_CHECK( gen, CK_DARI_GEN, UNUR_ERR_COOKIE ); /* Step 0: setup */ GEN->m = DISTR.mode; b[0] = DISTR.BD_LEFT; b[1] = DISTR.BD_RIGHT; GEN->pm = PMF(GEN->m); d = _unur_max(2, (int)( GEN->c_factor/(GEN->pm/DISTR.sum))); /* check mode */ if (_unur_iszero(GEN->pm)) { _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"PMF(mode)=0"); return UNUR_ERR_GEN_DATA; } /* step 0.1 */ do { for(i=0; i<=1; i++) { GEN->x[i] = GEN->m + sign[i] * d; if (sign[i]*GEN->x[i]+1 > sign[i]*b[i]) { v[i] = 0; GEN->s[i] = b[i]; } else { GEN->y[i] = T( PMF(GEN->x[i]) ); GEN->ys[i] = sign[i] * (T( PMF(GEN->x[i]+sign[i])) - GEN->y[i]); if (GEN->ys[i]*sign[i] > -DBL_EPSILON) { setup = -setup; /* indicate that the hat is not ok */ i = 1; } else { GEN->s[i] = (int)(0.5+GEN->x[i]+(T(GEN->pm)-GEN->y[i])/GEN->ys[i]); GEN->Hat[i] = ( F(GEN->y[i]+GEN->ys[i]*(GEN->s[i]+sign[i]*1.5-GEN->x[i])) / GEN->ys[i]-sign[i]*PMF(GEN->s[i]+sign[i]) ); at[i] = GEN->x[i] + (FM(GEN->ys[i]*GEN->Hat[i])-GEN->y[i]) / GEN->ys[i]; if(GEN->squeeze) GEN->xsq[i] = sign[i]*(at[i]-(GEN->s[i]+sign[i])); v[i] = sign[i]*(F(GEN->y[i]+GEN->ys[i]*(b[i]+sign[i]*0.5-GEN->x[i]))/ GEN->ys[i]-F(GEN->y[i]+GEN->ys[i]*(at[i]-GEN->x[i]))/GEN->ys[i]); } } if (setup>0) GEN->ac[i] = GEN->s[i] + sign[i]*(PMF(GEN->s[i])/GEN->pm-0.5); } /* step 0.2 */ if(setup>0) { GEN->vc = GEN->pm*(GEN->ac[1]-GEN->ac[0]); GEN->vt = GEN->vc+v[0]+v[1]; GEN->vcr = GEN->vc+v[1]; /* step 0.3 */ GEN->n[0] = _unur_max(b[0],GEN->m - GEN->size/2); GEN->n[1] = GEN->n[0] + GEN->size - 1; if (GEN->n[1] > b[1]) { GEN->n[1] = b[1]; GEN->n[0] = GEN->n[1]- GEN->size + 1; } /* initialize table */ for (j=0; jsize; j++) GEN->hb[j] = 0; } /* setup == 1 first try, up to now ok, ==2 second try, up to now ok */ /* setup == -1 first try, not ok, == -2 second try, not ok */ if (setup == 1 || setup == -1) { t0= 2. * DISTR.sum; if (setup==1 && GEN->vt<=t0) rep=0; else { setup = 2; d = (int) (t0 / GEN->pm); } } else rep=0; } while(rep); if (setup == -2 || GEN->vt > 100.*t0 || !(GEN->vt > 0.)) { #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_dari_debug_init(gen,"RE/INIT failed try again"); #endif _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"Area below hat too large or zero!! possible reasons: PDF, mode or area below PMF wrong; or PMF not T-concave"); return UNUR_ERR_GEN_DATA; } /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_dari_hat() */ /*****************************************************************************/ /** Debugging utilities **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ void _unur_dari_debug_init( struct unur_gen *gen, const char *status ) /*----------------------------------------------------------------------*/ /* write info about generator into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* status ... status of re/init routine */ /*----------------------------------------------------------------------*/ { FILE *LOG; int i; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_DARI_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: type = discrete univariate random variates\n",gen->genid); fprintf(LOG,"%s: method = dari (discrete automatic rejection inversion)\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); _unur_distr_discr_debug( gen->distr, gen->genid, FALSE ); fprintf(LOG,"%s: sampling routine = _unur_dari_sample",gen->genid); if (gen->variant & DARI_VARFLAG_VERIFY) fprintf(LOG,"_check()\n"); else fprintf(LOG,"()\n"); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: Data for hat and squeeze:\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s:area below hat: total %f center: %f, left tail %f, right tail %f\n", gen->genid, GEN->vt, GEN->vc, GEN->vt-GEN->vcr, GEN->vcr-GEN->vc); fprintf(LOG,"%s: mode %d and mode probability %f\n",gen->genid, GEN->m, GEN->pm); for(i=0;i<=1;i++) { fprintf(LOG,"%s:i=%d: x=%d; Hat=%f; ac=%f; s=%d;\n", gen->genid, i, GEN->x[i], GEN->Hat[i], GEN->ac[i], GEN->s[i]); fprintf(LOG,"%s:i=%d: xsq=%f; y=%f; ys=%f; n:=%d (for aux.table)\n", gen->genid, i, GEN->xsq[i], GEN->y[i], GEN->ys[i], GEN->n[i]); } fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: %s ************\n",gen->genid, status ); fprintf(LOG,"%s:\n",gen->genid); } /* end of _unur_dari_debug_init() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_INFO /*---------------------------------------------------------------------------*/ void _unur_dari_info( struct unur_gen *gen, int help ) /*----------------------------------------------------------------------*/ /* create character string that contains information about the */ /* given generator object. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* help ... whether to print additional comments */ /*----------------------------------------------------------------------*/ { struct unur_string *info = gen->infostr; struct unur_distr *distr = gen->distr; int samplesize = 10000; /* generator ID */ _unur_string_append(info,"generator ID: %s\n\n", gen->genid); /* distribution */ _unur_string_append(info,"distribution:\n"); _unur_distr_info_typename(gen); _unur_string_append(info," functions = PMF\n"); _unur_string_append(info," domain = (%d, %d)\n", DISTR.domain[0],DISTR.domain[1]); _unur_string_append(info," mode = %d %s\n", DISTR.mode, (distr->set & UNUR_DISTR_SET_MODE_APPROX) ? "[numeric.]" : ""); _unur_string_append(info," sum(PMF) = %g %s\n", DISTR.sum, (distr->set & UNUR_DISTR_SET_PMFSUM) ? "" : "[unknown]"); _unur_string_append(info,"\n"); if (help) { if ( distr->set & UNUR_DISTR_SET_MODE_APPROX ) _unur_string_append(info,"[ Hint: %s ]\n", "You may provide the \"mode\"."); if (!(distr->set & UNUR_DISTR_SET_PMFSUM)) _unur_string_append(info,"[ Hint: %s ]\n", "You may provide the \"pmfsum\"."); _unur_string_append(info,"\n"); } /* method */ _unur_string_append(info,"method: DARI (Discrete Automatic Rejection Inversion)\n"); if (GEN->size == 0) _unur_string_append(info," no table\n"); else _unur_string_append(info," use table of size %d\n", GEN->size); if (GEN->squeeze) _unur_string_append(info," use squeeze\n"); _unur_string_append(info,"\n"); /* performance */ _unur_string_append(info,"performance characteristics:\n"); _unur_string_append(info," sum(hat) = %g\n",GEN->vt); _unur_string_append(info," rejection constant "); if (distr->set & UNUR_DISTR_SET_PMFSUM) _unur_string_append(info,"= %g\n", GEN->vt/DISTR.sum); else _unur_string_append(info,"= %.2f [approx.]\n", unur_test_count_urn(gen,samplesize,0,NULL)/((double)samplesize)); _unur_string_append(info,"\n"); /* parameters */ if (help) { _unur_string_append(info,"parameters:\n"); _unur_string_append(info," tablesize = %d %s\n", GEN->size, (gen->set & DARI_SET_TABLESIZE) ? "" : "[default]"); if (GEN->squeeze) _unur_string_append(info," squeeze = on\n"); if (gen->set & DARI_SET_CFACTOR) _unur_string_append(info," cpfactor = %g\n", GEN->c_factor); if (gen->variant & DARI_VARFLAG_VERIFY) _unur_string_append(info," verify = on\n"); _unur_string_append(info,"\n"); } /* Hints */ /* if (help) { */ /* _unur_string_append(info,"\n"); */ /* } */ } /* end of _unur_dari_info() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_INFO */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/pinv_newton.ch0000644001357500135600000011714314420445767015175 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: pinv_newton.c * * * * Routines for Newton interpolating polynomial. * * * ***************************************************************************** * * * Copyright (c) 2008-2010 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * *****************************************************************************/ /*****************************************************************************/ /** Compute coefficients for Newton polynomial **/ /*****************************************************************************/ int _unur_pinv_create_table( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* Create table for Newton interpolation. */ /* The computational domain must be already computed / given. */ /* */ /* parameters: */ /* gen ... pointer generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { double utol; /* tolerated maximum U-error */ double maxerror; /* maximum U-error in a particular interval */ double h; /* step size / length of intervals */ int i; /* number of interval at work */ int iter; /* number of iterations */ int cont; /* whether we have to continue or loop */ int smooth; /* local smoothness parameter */ int use_linear; /* whether we use linear interpolation instead of polynomials */ int right_bd; /* whether we have reach right boundary */ int use_upoints; /* whether we use Chebyshev points in u-scale */ double chebyshev[3][MAX_ORDER+1]; /* Chebyshev points */ double xval[MAX_ORDER+1]; /* x-values for construction points for Newton polynomial */ int n_decr_h = 0; /* number of steps where h is decreased */ int n_incr_h = 0; /* number of steps where h is increased */ int n_use_linear = 0; /* number of steps where linear interpolation is used */ /* check arguments */ COOKIE_CHECK(gen,CK_PINV_GEN,UNUR_ERR_COOKIE); /* tolerated U-error */ utol = GEN->u_resolution * GEN->area * PINV_UERROR_CORRECTION; /* initialize step size for subintervals */ h = (GEN->bright-GEN->bleft)/128.; /* initialize array of intervals: starting interval */ if (_unur_pinv_interval( gen, 0, GEN->bleft, 0.) != UNUR_SUCCESS) return UNUR_ERR_GEN_CONDITION; /* compute construction points for Chebyshev points */ for (smooth=0; smooth<=GEN->smooth; ++smooth) _unur_pinv_chebyshev_points(chebyshev[smooth],GEN->order,smooth); /* initialize counter and control variables */ i = 0; /* start at interval 0 ;-) */ cont = TRUE; /* there is at least one iteration */ use_linear = FALSE; /* do not use linear interpolation; use polynomial */ use_upoints = FALSE; /* do not use Chebyshev points in u-scale. * we use this variable to toggle between * Chebyshev points in x-scale and u-scale. */ /* compute intervals and coefficients of Newton polynomials */ for (iter=0; cont ; iter++) { /* check number of iterations */ if (iter >= PINV_MAX_ITER_IVS) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION, "maximum number of iterations exceeded"); return UNUR_ERR_GEN_CONDITION; } /* right boundary reached ? */ if(!_unur_FP_less(GEN->iv[i].xi+h,GEN->bright)) { if (! (GEN->iv[i].xi+h < GEN->bright)) { h = GEN->bright - GEN->iv[i].xi; } cont = FALSE; /* we probably can stop after this iteration */ right_bd = TRUE; /* we have reached right boundary */ } else { right_bd = FALSE; } /** --- compute interpolating polynomial --- **/ /* set local smoothness parameter */ smooth = GEN->smooth; /* we do not use linar interpolation unless everything else fails */ use_linear = FALSE; switch (smooth) { case 2: _unur_pinv_newton_cpoints(xval, GEN->order, GEN->iv+i, h, chebyshev[smooth], smooth, use_upoints); if (_unur_pinv_newton_create(gen,GEN->iv+i,xval,smooth) == UNUR_SUCCESS) break; /* failed: try less smooth interpolation */ smooth = 1; /* FALLTHROUGH */ case 1: if (GEN->order % 2 == 1) { /* order must be odd when smoothness equals 1 */ _unur_pinv_newton_cpoints(xval, GEN->order, GEN->iv+i, h, chebyshev[smooth], smooth, use_upoints); if (_unur_pinv_newton_create(gen,GEN->iv+i,xval,smooth) == UNUR_SUCCESS) break; } /* failed: try less smooth interpolation */ smooth = 0; /* FALLTHROUGH */ case 0: default: /* compute Newton interpolation polynomial */ _unur_pinv_newton_cpoints(xval, GEN->order, GEN->iv+i, h, chebyshev[smooth], smooth, use_upoints); if (_unur_pinv_newton_create(gen,GEN->iv+i,xval,smooth) == UNUR_SUCCESS) break; /* failed: try linear interpolation */ /* FALLTHROUGH */ case -1: /* area below PDF = 0 or serious round-off errors */ /* --> try linear interpolation */ use_linear = TRUE; } if (use_linear) { /* use linear interpolation */ ++n_use_linear; if (_unur_pinv_linear_create(gen,GEN->iv+i,xval) != UNUR_SUCCESS) { /* area below PDF == 0. */ if (i==0) { /* left boundary (first interval) */ /* cut left boundary */ GEN->bleft = GEN->iv[i].xi + h; GEN->iv[i].xi = GEN->bleft; continue; /* outer loop */ } else if (right_bd) { /* right boudary */ GEN->bright = GEN->iv[i].xi; cont = FALSE; break; /* outer loop */ } else { /* -- no idea what to do now --> abort */ _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION, "PDF too close to 0 on relevant part of domain --> abort"); return UNUR_ERR_GEN_CONDITION; } } } /** --- check u-error for interpolating polynomial --- **/ /* estimate error of Newton interpolation */ if (use_linear) { maxerror = _unur_pinv_linear_maxerror(gen,&(GEN->iv[i])); } else { maxerror = _unur_pinv_newton_maxerror(gen,&(GEN->iv[i]),xval); } if (!(maxerror <= utol)) { /* error too large: reduce step size */ h *= (maxerror > 4.*utol) ? 0.81 : 0.9; cont = TRUE; /* we need another iteration */ ++n_decr_h; use_upoints = FALSE; continue; } /* error is below threshold */ if (gen->variant & PINV_VARIANT_UPOINTS) { /* compute polynomial again with (approximate) Chebyshev points in u-scale */ if (!use_upoints && !use_linear ) { use_upoints = TRUE; cont = TRUE; continue; } use_upoints = FALSE; } /* error is below threshold --> continue with next interval */ /* create next interval */ if ( _unur_pinv_interval( gen, i+1, GEN->iv[i].xi+h, GEN->iv[i].cdfi +(GEN->iv)[i].ui[GEN->order-1]) /* cdfi holds CDF value at the left border of the interval, */ /* ui[order-1] holds area below PDF in interval, i.e. CDF(right) - CDF(left) */ != UNUR_SUCCESS ) return UNUR_ERR_GEN_CONDITION; /* increase step size for very small errors */ if (maxerror < 0.3*utol) { h *= (maxerror < 0.1*utol) ? 2. : 1.2; ++n_incr_h; } /* continue with next interval */ i++; } /* update size of array (finish list) */ _unur_pinv_lastinterval(gen); /* set range for uniform random numbers */ /* Umin = 0, Umax depends on area below PDF, tail cut-off points and round-off errors */ GEN->Umax = GEN->iv[GEN->n_ivs].cdfi; #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug & PINV_DEBUG_SEARCHBD) _unur_pinv_debug_create_table(gen,iter,n_incr_h,n_decr_h,n_use_linear); #endif /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_pinv_create_table() */ /*---------------------------------------------------------------------------*/ int _unur_pinv_chebyshev_points (double *pt, int order, int smooth) /*----------------------------------------------------------------------*/ /* [2a.] Compute Chebyshev points. */ /* */ /* parameters: */ /* pt ... pointer to array of size (order+1) for storing points */ /* order ... order of polynomial */ /* smooth ... smoothness parameter */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ /* Chebyshev points rescaled such that the first and last point is */ /* moved into 0 and 1, resp. */ /* We need (order+1) points for a polynomial of given 'order'. */ /* For smooth interpolant we need multiple points: */ /* smooth == 0: single points */ /* smooth == 1: double points */ /* smooth == 2: tripple points */ /*----------------------------------------------------------------------*/ { int i,k; int n_pt = (order+1)/(smooth+1); /* number of points */ double phi = M_PI*0.5/n_pt; /* constant for computing Chebyshev points */ pt[0] = 0.; for (i=1; i<=order; i++) { k = i / (smooth+1); if (kui[order-1]; for(k=0; k<=order; k++) xval[k] = (k % (smooth+1)) ? xval[k-1] : iv->xi + _unur_pinv_newton_eval(hu * chebyshev[k], iv->ui, iv->zi, order); } else { /* use Chebyshev points in x-scale. */ for(k=0; k<=order; k++) { xval[k] = (k % (smooth+1)) ? xval[k-1] : iv->xi + h * chebyshev[k]; } } return UNUR_SUCCESS; } /* end of _unur_pinv_newton_cpoints() */ /*---------------------------------------------------------------------------*/ int _unur_pinv_newton_create (struct unur_gen *gen, struct unur_pinv_interval *iv, double *xval, int smooth) /*----------------------------------------------------------------------*/ /* 2a. Compute coefficients for Newton interpolation within a */ /* subinterval of the domain of the distribution. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* iv ... pointer to current interval */ /* xval ... x-values for constructing polynomial */ /* smooth ... smoothness parameter */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { double fx = -1.; /* PDF at x (-1. --> PDF unknown) */ double *ui = iv->ui; /* u-values for Newton interpolation */ double *zi = iv->zi; /* coefficients of Newton interpolation */ double xi, dxi; /* boundary and length of i-th subinterval */ double area; /* integral of PDF over subinterval */ int i,k; /* auxiliary variables */ /* check arguments */ COOKIE_CHECK(gen,CK_PINV_GEN,UNUR_FAILURE); COOKIE_CHECK(iv,CK_PINV_IV,UNUR_FAILURE); /* compute coefficients of interpolating polynomial */ /* first step: * compute values u_i of nodes and first differences, i.e., * ( CDF^{-1}(u[i]) - CDF^{-1}(u[i-1]) ) / (u[i] - u[i-1]) * = (x[i] - x[i-1]) / (u[i] - u[i-1]) */ for(i=0; iorder; i++) { /* left boundary and length of subinterval for integration */ xi = xval[i]; if (smooth < 1L || !_unur_FP_same(xval[i],xval[i+1])) { /* use differences */ dxi = xval[i+1]-xval[i]; /* compute integral of PDF in interval (xi,xi+dxi) */ area = _unur_pinv_Udiff(gen, xi, dxi, &fx); if (_unur_iszero(area)) { return UNUR_ERR_SILENT; } /* construction points for interpolating polynomial for CDF^{-1} */ ui[i] = (i>0) ? (ui[i-1]+area) : area; /* divided differences of values of CDF^{-1} */ zi[i] = dxi/area; } else { /* use derivative: * [F^{-1}(u)]' = 1/f(x) where x=F^{-1}(u) */ ui[i] = (i>0) ? ui[i-1] : 0.; zi[i] = 1./PDF(xi); } } /* Remark: ui[GEN->order-1] is the probability of the interval */ /* compute second divided differences. */ /* k = 1; */ for(i=GEN->order-1; i>=1; i--) { if (smooth < 2L || !_unur_FP_same(zi[i],zi[i-1])) { /* use differences */ zi[i] = (i>1) ? (zi[i]-zi[i-1]) / (ui[i]-ui[i-2]) : (zi[1]-zi[0]) / ui[1]; } else { /* smooth >= 2L */ /* use second derivative: * [F^{-1}(u)]" = -f'(x) / f(x)^3 where x=F^{-1}(u) */ /* however, this requires the derivative of the PDF */ zi[i] = (DISTR.dpdf != NULL) ? (-0.5 * dPDF(xval[i]) * pow(zi[i],3)) : UNUR_INFINITY; } } /* compute all other divided differences. */ for(k=2; korder; k++) { for(i=GEN->order-1; i>k; i--) { zi[i] = (zi[i]-zi[i-1]) / (ui[i]-ui[i-(k+1)]); } zi[k] = (zi[k]-zi[k-1]) / ui[k]; } /* check result */ for (i=0; iorder; i++) { if (!_unur_isfinite(zi[i])) { return UNUR_ERR_SILENT; } } /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_pinv_newton_create() */ /*---------------------------------------------------------------------------*/ int _unur_pinv_linear_create (struct unur_gen *gen, struct unur_pinv_interval *iv, double *xval) /*----------------------------------------------------------------------*/ /* [2a.] Compute coefficients for linear interpolation within a */ /* subinterval of the domain of the distribution. */ /* The coefficients are stored in the array for Newton interpolation */ /* of order GEN->order where the coefficients of the higher order terms */ /* are set to 0. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* iv ... pointer to current interval */ /* xval ... x-values for constructing polynomial as used for */ /* _unur_pinv_newton_create */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { double *ui = iv->ui; /* u-values for Newton interpolation */ double *zi = iv->zi; /* coefficients of Newton interpolation */ double x0, x1; /* lower and upper boundary point of interval */ double area; /* integral of PDF over subinterval */ int i; /* auxiliary variable */ /* boundary of interval */ x0 = xval[0]; x1 = xval[GEN->order]; /* set all coefficents of the Newton polynomial to 0. */ for (i=0; iorder; i++) { ui[i] = zi[i] = 0.; } /* area below PDF */ area = _unur_pinv_Udiff(gen, x0, x1-x0, NULL); /* zi[0] contains the slope of the polynomial */ zi[0] = (x1 - x0) / area; /* ui[GEN->order-1] stores the probability of the interval */ ui[GEN->order-1] = area; /* check result */ if (!_unur_isfinite(zi[0])) return UNUR_ERR_GEN_CONDITION; /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_pinv_linear_create() */ /*---------------------------------------------------------------------------*/ double _unur_pinv_newton_eval ( double q, double *ui, double *zi, int order ) /*----------------------------------------------------------------------*/ /* 2b. evaluate Newton interpolation polynomial using Horner scheme. */ /* */ /* parameters: */ /* q ... argument */ /* ui ... coefficients of polynomial (increasing order) */ /* zi ... coefficients of polynomial (increasing order) */ /* order ... order of polynomial */ /* */ /* return: */ /* value of interpolating polynomial at u=q */ /*----------------------------------------------------------------------*/ { int k; double chi; chi = zi[order-1]; for (k=order-2; k>=0; k--) chi = chi*(q-ui[k])+zi[k]; return (chi*q); } /* end of _unur_pinv_newton_eval() */ /*---------------------------------------------------------------------------*/ double _unur_pinv_newton_maxerror (struct unur_gen *gen, struct unur_pinv_interval *iv, double *xval) /*----------------------------------------------------------------------*/ /* 2c. Estimate maximal error of Newton interpolation in subinterval. */ /* In addition it makes a simple check for monotonicity of the */ /* inverse CDF. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* iv ... pointer to current interval */ /* xval ... x-values for constructing polynomial */ /* */ /* return: */ /* estimated maximal u-error, or */ /* >1000 whenever the inverse CDF is not monotone */ /*----------------------------------------------------------------------*/ { double x0 = iv->xi; /* left boundary point of interval */ double *ui = iv->ui; /* u-values for Newton interpolation */ double *zi = iv->zi; /* coefficient of Newton interpolation */ double maxerror = 0.; /* maximum error */ double uerror; /* error for given U value */ double x; /* x = CDF^{-1}(U) */ double u; /* u = CDF(x) */ double testu[MAX_ORDER]; /* array of U values for testing */ int i; /* aux variable */ /* check arguments */ COOKIE_CHECK(gen,CK_PINV_GEN,UNUR_FAILURE); COOKIE_CHECK(iv,CK_PINV_IV,UNUR_FAILURE); /* get U values for test (points with maximal worst case error) */ _unur_pinv_newton_testpoints(testu,ui,GEN->order); /* calculate the max u-error at the test points */ for(i=0; iorder; i++) { if (_unur_FP_is_infinity(testu[i])) { /* there is no need to run the test at such a point */ continue; } /* inverse CDF for U test point */ x = _unur_pinv_newton_eval(testu[i], ui, zi, GEN->order); /* check for monotonicity (non-linear case) */ if (! (xval[i] <= x0+x && x0+x <= xval[i+1]) ) if (! _unur_FP_same(xval[i], xval[i+1])) /* not monotone */ return DBL_MAX; /* estimate CDF for interpolated x value */ if (i==0 || xval==NULL) u = _unur_pinv_Udiff(gen, x0, x, NULL); else u = ui[i-1] + _unur_pinv_Udiff(gen, xval[i], x+x0-xval[i], NULL); /* check u-value */ if (!_unur_isfinite(u)) return UNUR_INFINITY; /* compute u-error */ uerror = fabs(u - testu[i]); /* update maximal error */ if (uerror>maxerror) maxerror = uerror; } /* we have an analytical test for cubic Hermite interpolation */ if (GEN->order == 3 && GEN->smooth==1 && xval!=NULL && ! _unur_pinv_cubic_hermite_is_monotone(gen,ui,zi,xval)) /* not monotone */ return 1003.; /* compute u-error at extra test points */ if (GEN->n_extra_testpoints > 0) { uerror = _unur_pinv_maxerror_extra(gen, iv, xval); if (uerror>maxerror) maxerror = uerror; } /* return maximal observed u-error */ return maxerror; } /* end of _unur_pinv_newton_maxerror() */ /*---------------------------------------------------------------------------*/ double _unur_pinv_maxerror_extra (struct unur_gen *gen, struct unur_pinv_interval *iv, double *xval) /*----------------------------------------------------------------------*/ /* 2c. Estimate maximal error of Newton interpolation in subinterval. */ /* In addition it makes a simple check for monotonicity of the */ /* inverse CDF. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* iv ... pointer to current interval */ /* xval ... x-values for constructing polynomial */ /* */ /* return: */ /* estimated maximal u-error, or */ /* >1000 whenever the inverse CDF is not monotone */ /*----------------------------------------------------------------------*/ { double x0 = iv->xi; /* left boundary point of interval */ double *ui = iv->ui; /* u-values for Newton interpolation */ double *zi = iv->zi; /* coefficient of Newton interpolation */ double maxerror = 0.; /* maximum error */ double uerror; /* error for given U value */ double x; /* x = CDF^{-1}(U) */ double u; /* u = CDF(x) */ int i,j; /* aux variables */ /* for generating equidistributed points */ double u0, du; int n_testu; double testu; /* check arguments */ COOKIE_CHECK(gen,CK_PINV_GEN,UNUR_FAILURE); COOKIE_CHECK(iv,CK_PINV_IV,UNUR_FAILURE); /* calculate the max u-error in subinterval */ for(i=0; iorder; i++) { /* check for subintervals of length 0 */ if ( (i==0 && _unur_iszero(ui[0])) || (i>0 && _unur_FP_same(ui[i-1],ui[i])) ) { /* nothing to do */ continue; } /* we use equidistributed points */ n_testu = GEN->n_extra_testpoints; u0 = (i==0) ? 0. : ui[i-1]; du = (ui[i] - u0) / (n_testu + 1.); /* check for each of the equidistributed points */ for(j=1; j < n_testu; j++) { /* test ppint */ testu = u0 + j * du; /* inverse CDF for U test point */ x = _unur_pinv_newton_eval(testu, ui, zi, GEN->order); /* estimate CDF for interpolated x value */ u = u0 + _unur_pinv_Udiff(gen, xval[i], x+x0-xval[i], NULL); /* check u-value */ if (!_unur_isfinite(u)) return UNUR_INFINITY; /* compute u-error */ uerror = fabs(u - testu); /* update maximal error */ if (uerror>maxerror) maxerror = uerror; } } /* return maximal observed u-error */ return maxerror; } /* end of _unur_pinv_maxerror_extra() */ /*---------------------------------------------------------------------------*/ double _unur_pinv_linear_maxerror (struct unur_gen *gen, struct unur_pinv_interval *iv) /*----------------------------------------------------------------------*/ /* 2c. Estimate maximal error of _linear_ interpolation in subinterval. */ /* In addition it makes a simple check for monotonicity of the */ /* inverse CDF. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* iv ... pointer to current interval */ /* */ /* return: */ /* estimated maximal u-error, or */ /* >1000 whenever the inverse CDF is not monotone */ /*----------------------------------------------------------------------*/ { double x0 = iv->xi; /* left boundary point of interval */ double *ui = iv->ui; /* u-values for Newton interpolation */ double *zi = iv->zi; /* coefficient of Newton interpolation */ double maxerror = 0.; /* maximum error */ double uerror; /* error for given U value */ double du, tu; /* points (in u-scale) for estimating u-error */ double x; /* x = CDF^{-1}(U) */ double u; /* u = CDF(x) */ int i; /* aux variable */ /* check arguments */ COOKIE_CHECK(gen,CK_PINV_GEN,UNUR_FAILURE); COOKIE_CHECK(iv,CK_PINV_IV,UNUR_FAILURE); /* check for monotonicity (linear case) */ if (zi[0] < 0.) { /* not monotone */ return 1001.; } /* get distance between test points for test */ /* we use equidistributed points */ du = ui[(GEN->order)-1] / (GEN->order+1); /* distance between points */ /* calculate the max u-error at the test points */ for(i=0; iorder; i++) { /* test point */ tu = (i+0.5) * du; /* inverse CDF for U test point */ x = _unur_pinv_newton_eval(tu, ui, zi, GEN->order); /* estimate CDF for interpolated x value */ /* if (i==0 || xval==NULL) */ u = _unur_pinv_Udiff(gen, x0, x, NULL); /* else */ /* u = ui[i-1] + _unur_pinv_Udiff(gen, xval[i], x+x0-xval[i], NULL); */ /* check u-value */ if (!_unur_isfinite(u)) return UNUR_INFINITY; /* compute u-error */ uerror = fabs(u - tu); /* update maximal error */ if (uerror>maxerror) maxerror = uerror; } /* return maximal observed u-error */ return maxerror; } /* end of _unur_pinv_linear_maxerror() */ /*---------------------------------------------------------------------------*/ int _unur_pinv_newton_testpoints (double *utest, double *ui, int order) /*----------------------------------------------------------------------*/ /* [2c.] calculates the local maxima of the polynomial. */ /* used as control points for error estimate. */ /* */ /* parameters: */ /* utest ... pointer to array for storing control points */ /* ui ... u-values of interpolation */ /* order ... order of interpolation polynomial */ /* */ /* return: */ /* u-values of control points in the array utest */ /* */ /* remark: */ /* a test point is set to INFINITY if there is no need to use */ /* the corresponding point */ /*----------------------------------------------------------------------*/ { int k,j,i; double sum, qsum,x; /* compute approximate maxima of error polynomial */ for(k=0; k0 && _unur_FP_same(ui[k-1],ui[k])) ) { /* utest[k] = ui[k]; */ /* there is no u-error at the nodes of the Newton interpolation */ utest[k] = UNUR_INFINITY; continue; } /* first approximation: use mean of consecuting construction points */ x = (k>0) ? 0.5*(ui[k-1]+ui[k]) : 0.5*ui[k]; /* make two iterations for root finding */ for(j=1; j<=2; j++) { sum = 1./x; qsum = sum*sum; for(i=0; i= GEN->max_ivs) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION, "maximum number of intervals exceeded"); return UNUR_ERR_GEN_CONDITION; } /* set values */ iv = GEN->iv+i; /* pointer to interval */ iv->xi = x; /* left boundary of interval */ iv->cdfi = cdfx; /* CDF at left boundary */ COOKIE_SET(iv,CK_PINV_IV); /* allocate space for coefficients for Newton interpolation */ iv->ui = _unur_xmalloc( GEN->order * sizeof(double) ); iv->zi = _unur_xmalloc( GEN->order * sizeof(double) ); /* update size of array (number of intervals) */ GEN->n_ivs = i; /* set bookmark in table of integral values */ _unur_lobatto_find_linear(GEN->aCDF,x); /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_pinv_interval() */ /*---------------------------------------------------------------------------*/ int _unur_pinv_lastinterval( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* update size of array and set all uninitialized values to 0. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { double *ui, *zi; int i; /* pointer to last interval */ struct unur_pinv_interval *last_iv = GEN->iv + GEN->n_ivs; ui = last_iv->ui; zi = last_iv->zi; /* update size of array */ GEN->iv = _unur_xrealloc( GEN->iv, (GEN->n_ivs+1) * sizeof(struct unur_pinv_interval) ); /* set all entries ui and zi in very last interval to 0 */ for (i=0; iorder; i++) { ui[i] = 0.; zi[i] = 0.; } /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_pinv_lastinterval() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/srou.c0000644001357500135600000021152414420445767013445 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: srou.c * * * * TYPE: continuous univariate random variate * * METHOD: simple universal method (ratio-of-uniforms method) * * * * DESCRIPTION: * * Given PDF and mode of a T_{-1/2}-concave distribution * * produce a value x consistent with its density * * * * REQUIRED: * * pointer to the density function * * mode of the density * * area below PDF * * OPTIONAL: * * CDF at mode * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * ***************************************************************************** * * * REFERENCES: * * [1] Leydold J. (2001): A simple universal generator for continuous and * * discrete univariate T-concave distributions, * * ACM Trans. Math. Software 27(1), pp. 66--82. * * * * [2] Kinderman, A.J. and Monahan, F.J. (1977): Computer generation of * * random variables using the ratio of uniform deviates, * * ACM Trans. Math. Software 3(3), pp. 257--260. * * * * [3] Leydold J. (2002): Short universal generators via generalized * * ratio-of-uniforms method, Preprint. * * * * [4] Wakefield J. C., Gelfand A. E., and Smith A. F. M. (1991): * * Efficient generation of random variates via the ratio-of-uniforms * * method, Statist. Comput. 1(2), pp. 129--133. * * * ***************************************************************************** * * * The ratio-of-uniforms method introduced in [2] is a flexible method that * * is based on the following theorem: * * * * THEOREM: * * Let X be a random variable with density function f(x) = g(x) / G, * * where g(x) is a positive integrable function with support (x_0,x_1) * * not necessarily finite and G = integral g(x) dx. * * If (V,U) is uniformly distributed in * * A = {(v,u): 0 < u <= sqrt(g(v/u)), x_0 < v/u < x_1}, * * then X = V/U has probability density function f(x). * * * * Generating point (V,U) uniformly distributed in A is done by rejection * * from an enveloping region, usually from the minimal bounding rectangle. * * * * The implemented algorithm uses the fact, that for many distribtions, * * A is convex. Then we easily can construct an enveloping rectangle. * * Define * * R = {(v,u): v_l <= v <= v_r, 0 <= u <= u_m}, * * Q = {(v,u): -v_m <= v <= v_m, 0 <= u <= u_m}, * * where * * u_m = sqrt(f(mode)), v_m = (\int f dx) / u_m * * v_l = -F(\mode) v_m, v_r = (1-F(mode)) v_m * * Then * * A subset R subset Q * * * * Thus we can use R to generate whenever the CDF F(mode) at the mode * * is known, and Q otherwise. * * Notice, that the rection constant is 2 in the first case and 4 and the * * latter. * * * * If F(mode) it known, it is even possible to get an universal squeeze * * (see [1] for details). However its usage is only recommended when * * the PDF is (very) expensive. * * * * When F(mode) is not known the mirror principle can be used. i.e., make * * an enveloping rectangle for f(x)+f(-x). It reduces the rejection constant * * to 2 * sqrt(2) at the expense of more evaluations of the PDF. * * Its usage is only recommended when the generation time for the underlying * * uniform prng is extreme large. * * * * Distributions with a convex set A are characterized by the following * * theorem that shows a connection to transformed density rejection TDR. * * * * THEOREM: * * A is convex if and only if g is T-concave with transformation * * T(x) = -1/sqrt(x), i.e., -1/sqrt(g(x)) is a concave function. * * * ***************************************************************************** * * * The theory for r!=1 is described in [3]. * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include "unur_methods_source.h" #include "x_gen_source.h" #include "srou.h" #include "srou_struct.h" #ifdef UNUR_ENABLE_INFO # include #endif /*---------------------------------------------------------------------------*/ /* Variants: */ #define SROU_VARFLAG_VERIFY 0x002u /* run verify mode */ #define SROU_VARFLAG_SQUEEZE 0x004u /* use universal squeeze if possible */ #define SROU_VARFLAG_MIRROR 0x008u /* use mirror principle */ /*---------------------------------------------------------------------------*/ /* Debugging flags */ /* bit 01 ... pameters and structure of generator (do not use here) */ /* bits 02-12 ... setup */ /* bits 13-24 ... adaptive steps */ /* bits 25-32 ... trace sampling */ #define SROU_DEBUG_REINIT 0x00000010u /* print parameters after reinit */ /*---------------------------------------------------------------------------*/ /* Flags for logging set calls */ #define SROU_SET_R 0x001u /* parameter r for power transform. */ #define SROU_SET_CDFMODE 0x002u /* CDF at mode is known */ #define SROU_SET_PDFMODE 0x004u /* PDF at mode is set */ /*---------------------------------------------------------------------------*/ #define GENTYPE "SROU" /* type of generator */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_srou_init( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* Initialize new generator. */ /*---------------------------------------------------------------------------*/ static int _unur_srou_reinit( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Reinitialize generator. */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_srou_create( struct unur_par *par ); /*---------------------------------------------------------------------------*/ /* create new (almost empty) generator object. */ /*---------------------------------------------------------------------------*/ static int _unur_srou_check_par( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* Check parameters of given distribution and method */ /*---------------------------------------------------------------------------*/ static struct unur_gen *_unur_srou_clone( const struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* copy (clone) generator object. */ /*---------------------------------------------------------------------------*/ static void _unur_srou_free( struct unur_gen *gen); /*---------------------------------------------------------------------------*/ /* destroy generator object. */ /*---------------------------------------------------------------------------*/ static double _unur_srou_sample( struct unur_gen *gen ); static double _unur_srou_sample_mirror( struct unur_gen *gen ); static double _unur_srou_sample_check( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* sample from generator (case r=1). */ /*---------------------------------------------------------------------------*/ static double _unur_gsrou_sample( struct unur_gen *gen ); static double _unur_gsrou_sample_check( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* sample from generator (case r>1). */ /*---------------------------------------------------------------------------*/ static int _unur_srou_rectangle( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* compute universal bounding rectangle (case r=1). */ /*---------------------------------------------------------------------------*/ static int _unur_gsrou_envelope( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* compute parameters for universal bounding envelope (case r>1). */ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ /* the following functions print debugging information on output stream, */ /* i.e., into the LOG file if not specified otherwise. */ /*---------------------------------------------------------------------------*/ static void _unur_srou_debug_init( const struct unur_gen *gen, int is_reinit ); /*---------------------------------------------------------------------------*/ /* print after generator has been initialized has completed. */ /*---------------------------------------------------------------------------*/ #endif #ifdef UNUR_ENABLE_INFO static void _unur_srou_info( struct unur_gen *gen, int help ); /*---------------------------------------------------------------------------*/ /* create info string. */ /*---------------------------------------------------------------------------*/ #endif /*---------------------------------------------------------------------------*/ /* abbreviations */ #define DISTR_IN distr->data.cont /* data for distribution object */ #define PAR ((struct unur_srou_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_srou_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.cont /* data for distribution in generator object */ #define BD_LEFT domain[0] /* left boundary of domain of distribution */ #define BD_RIGHT domain[1] /* right boundary of domain of distribution */ #define SAMPLE gen->sample.cont /* pointer to sampling routine */ #define PDF(x) _unur_cont_PDF((x),(gen->distr)) /* call to PDF */ /*---------------------------------------------------------------------------*/ static UNUR_SAMPLING_ROUTINE_CONT * _unur_srou_getSAMPLE( struct unur_gen *gen ) { if (gen->variant & SROU_VARFLAG_VERIFY) return (gen->set & SROU_SET_R) ? _unur_gsrou_sample_check : _unur_srou_sample_check; else { if (gen->set & SROU_SET_R) return _unur_gsrou_sample; else return (gen->variant & SROU_VARFLAG_MIRROR) ? _unur_srou_sample_mirror : _unur_srou_sample; } } /* end of _unur_srou_getSAMPLE() */ /*---------------------------------------------------------------------------*/ /* constants */ #define SQRT2 (M_SQRT2) /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Public: User Interface (API) **/ /*****************************************************************************/ struct unur_par * unur_srou_new( const struct unur_distr *distr ) /*----------------------------------------------------------------------*/ /* get default parameters */ /* */ /* parameters: */ /* distr ... pointer to distribution object */ /* */ /* return: */ /* default parameters (pointer to structure) */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_par *par; /* check arguments */ _unur_check_NULL( GENTYPE,distr,NULL ); /* check distribution */ if (distr->type != UNUR_DISTR_CONT) { _unur_error(GENTYPE,UNUR_ERR_DISTR_INVALID,""); return NULL; } COOKIE_CHECK(distr,CK_DISTR_CONT,NULL); if (DISTR_IN.pdf == NULL) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"PDF"); return NULL; } /* allocate structure */ par = _unur_par_new( sizeof(struct unur_srou_par) ); COOKIE_SET(par,CK_SROU_PAR); /* copy input */ par->distr = distr; /* pointer to distribution object */ /* set default values */ PAR->r = 1.; /* parameter for power transformation */ PAR->Fmode = -1.; /* CDF at mode (unknown yet ) */ PAR->um = -1.; /* (square) root of PDF at mode (unknown) */ par->method = UNUR_METH_SROU; /* method and default variant */ par->variant = 0u; /* default variant */ par->set = 0u; /* inidicate default parameters */ par->urng = unur_get_default_urng(); /* use default urng */ par->urng_aux = NULL; /* no auxilliary URNG required */ par->debug = _unur_default_debugflag; /* set default debugging flags */ /* routine for starting generator */ par->init = _unur_srou_init; return par; } /* end of unur_srou_new() */ /*****************************************************************************/ int unur_srou_set_r( struct unur_par *par, double r ) /*----------------------------------------------------------------------*/ /* set parameter r for power transformation */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* r ... parameter r */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, SROU ); /* check new parameter for generator */ if (r < 1.) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"r < 1"); return UNUR_ERR_PAR_SET; } if (_unur_isone(r)) { /* simple version, same as R is not set */ PAR->r = r; par->set &= ~SROU_SET_R; } else { /* for computational reasons r should be at least 1.01 */ if (r<1.01) r = 1.01; PAR->r = r; par->set |= SROU_SET_R; } /* we have to reset the marker for the PDF at the mode */ par->set &= ~SROU_SET_PDFMODE; return UNUR_SUCCESS; } /* end of unur_srou_set_r() */ /*---------------------------------------------------------------------------*/ int unur_srou_set_cdfatmode( struct unur_par *par, double Fmode ) /*----------------------------------------------------------------------*/ /* set value of cdf at mode */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* Fmode ... cdf at mode */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, SROU ); /* check new parameter for generator */ if (Fmode < 0. || Fmode > 1.) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"CDF(mode)"); return UNUR_ERR_PAR_SET; } /* store date */ PAR->Fmode = Fmode; /* changelog */ par->set |= SROU_SET_CDFMODE; return UNUR_SUCCESS; } /* end of unur_srou_set_cdfatmode() */ /*---------------------------------------------------------------------------*/ int unur_srou_set_pdfatmode( UNUR_PAR *par, double fmode ) /*----------------------------------------------------------------------*/ /* Set pdf at mode. if set the PDF at the mode is never changed. */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* fmode ... PDF at mode */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, SROU ); /* check new parameter for generator */ if (fmode <= 0.) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"PDF(mode)"); return UNUR_ERR_PAR_SET; } if (!_unur_isfinite(fmode)) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"PDF(mode) overflow"); return UNUR_ERR_PAR_SET; } /* store date ((square) root of fmode) */ PAR->um = (par->set & SROU_SET_R) ? pow(fmode,1./(PAR->r+1.)) : sqrt(fmode); /* changelog */ par->set |= SROU_SET_PDFMODE; return UNUR_SUCCESS; } /* end of unur_srou_set_pdfatmode() */ /*---------------------------------------------------------------------------*/ int unur_srou_set_verify( struct unur_par *par, int verify ) /*----------------------------------------------------------------------*/ /* turn verifying of algorithm while sampling on/off */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* verify ... 0 = no verifying, !0 = verifying */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* no verifying is the default */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, SROU ); /* we use a bit in variant */ par->variant = (verify) ? (par->variant | SROU_VARFLAG_VERIFY) : (par->variant & (~SROU_VARFLAG_VERIFY)); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_srou_set_verify() */ /*---------------------------------------------------------------------------*/ int unur_srou_chg_verify( struct unur_gen *gen, int verify ) /*----------------------------------------------------------------------*/ /* turn verifying of algorithm while sampling on/off */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* verify ... 0 = no verifying, !0 = verifying */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* no verifying is the default */ /*----------------------------------------------------------------------*/ { /* check input */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, SROU, UNUR_ERR_GEN_INVALID ); /* we must not change this switch when sampling has been disabled by using a pointer to the error producing routine */ if (SAMPLE == _unur_sample_cont_error) return UNUR_FAILURE; if (verify) /* turn verify mode on */ gen->variant |= SROU_VARFLAG_VERIFY; else /* turn verify mode off */ gen->variant &= ~SROU_VARFLAG_VERIFY; SAMPLE = _unur_srou_getSAMPLE(gen); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_srou_chg_verify() */ /*---------------------------------------------------------------------------*/ int unur_srou_set_usesqueeze( struct unur_par *par, int usesqueeze ) /*----------------------------------------------------------------------*/ /* set flag for using universal squeeze (default: off) */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* usesqueeze ... 0 = no squeeze, !0 = use squeeze */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* no squeeze is the default */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, SROU ); /* we use a bit in variant */ par->variant = (usesqueeze) ? (par->variant | SROU_VARFLAG_SQUEEZE) : (par->variant & (~SROU_VARFLAG_SQUEEZE)); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_srou_set_usesqueeze() */ /*---------------------------------------------------------------------------*/ int unur_srou_set_usemirror( struct unur_par *par, int usemirror ) /*----------------------------------------------------------------------*/ /* set flag for using mirror principle (default: off) */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* usemirror ... 0 = no mirror princ., !0 = use mirror principle */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* do not use mirror principle is the default */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, par, UNUR_ERR_NULL ); _unur_check_par_object( par, SROU ); /* we use a bit in variant */ par->variant = (usemirror) ? (par->variant | SROU_VARFLAG_MIRROR) : (par->variant & (~SROU_VARFLAG_MIRROR)); /* o.k. */ return UNUR_SUCCESS; } /* end of unur_srou_set_usemirror() */ /*****************************************************************************/ int unur_srou_chg_cdfatmode( struct unur_gen *gen, double Fmode ) /*----------------------------------------------------------------------*/ /* change value of cdf at mode */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* Fmode ... cdf at mode */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, SROU, UNUR_ERR_GEN_INVALID ); /* check new parameter for generator */ if (Fmode < 0. || Fmode > 1.) { _unur_warning(gen->genid,UNUR_ERR_PAR_SET,"CDF(mode)"); return UNUR_ERR_PAR_SET; } /* copy parameters */ GEN->Fmode = Fmode; /* changelog */ gen->set |= SROU_SET_CDFMODE; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_srou_chg_cdfatmode() */ /*---------------------------------------------------------------------------*/ int unur_srou_chg_pdfatmode( struct unur_gen *gen, double fmode ) /*----------------------------------------------------------------------*/ /* change value of PDF at mode */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* fmode ... PDF at mode */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check arguments */ _unur_check_NULL( GENTYPE, gen, UNUR_ERR_NULL ); _unur_check_gen_object( gen, SROU, UNUR_ERR_GEN_INVALID ); /* check new parameter for generator */ if (fmode <= 0.) { _unur_warning(gen->genid,UNUR_ERR_PAR_SET,"PDF(mode)"); return UNUR_ERR_PAR_SET; } if (!_unur_isfinite(fmode)) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"PDF(mode) overflow"); return UNUR_ERR_PAR_SET; } /* store date ((square) root of fmode) */ GEN->um = (gen->set & SROU_SET_R) ? pow(fmode,1./(GEN->r+1.)) : sqrt(fmode); /* changelog */ gen->set |= SROU_SET_PDFMODE; /* o.k. */ return UNUR_SUCCESS; } /* end of unur_srou_chg_pdfatmode() */ /*****************************************************************************/ /** Private **/ /*****************************************************************************/ struct unur_gen * _unur_srou_init( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* initialize new generator */ /* */ /* parameters: */ /* params ... pointer to paramters for building generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; int rcode; /* check arguments */ CHECK_NULL(par,NULL); /* check input */ if ( par->method != UNUR_METH_SROU ) { _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); return NULL; } COOKIE_CHECK(par,CK_SROU_PAR,NULL); /* there are no squeezes and no mirrir principle when r is changed */ if (par->set & SROU_SET_R) { par->variant &= ~SROU_VARFLAG_MIRROR; par->variant &= ~SROU_VARFLAG_SQUEEZE; } if (par->set & SROU_SET_CDFMODE) /* cdf at mode known --> thus it does not make sense to use the mirror principle */ par->variant &= ~SROU_VARFLAG_MIRROR; else /* cdf at mode unknown --> thus we cannot use universal squeeze */ par->variant &= ~SROU_VARFLAG_SQUEEZE; /* create a new empty generator object */ gen = _unur_srou_create(par); /* free parameters */ _unur_par_free(par); if (!gen) return NULL; /* check parameters */ if (_unur_srou_check_par(gen) != UNUR_SUCCESS) { _unur_srou_free(gen); return NULL; } /* compute universal bounding envelope */ if (gen->set & SROU_SET_R) rcode = _unur_gsrou_envelope( gen ); else rcode = _unur_srou_rectangle( gen ); if (rcode!=UNUR_SUCCESS) { /* error */ _unur_srou_free(gen); return NULL; } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_srou_debug_init(gen, FALSE); #endif return gen; } /* end of _unur_srou_init() */ /*---------------------------------------------------------------------------*/ int _unur_srou_reinit( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* re-initialize (existing) generator. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { int rcode; /* check parameters */ if ( (rcode = _unur_srou_check_par(gen)) != UNUR_SUCCESS) return rcode; /* compute universal bounding envelope */ if (gen->set & SROU_SET_R) rcode = _unur_gsrou_envelope( gen ); else rcode = _unur_srou_rectangle( gen ); /* (re)set sampling routine */ SAMPLE = _unur_srou_getSAMPLE(gen); #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug & SROU_DEBUG_REINIT) _unur_srou_debug_init(gen,TRUE); #endif return rcode; } /* end of _unur_srou_reinit() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_srou_create( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* allocate memory for generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* pointer to (empty) generator object with default settings */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_SROU_PAR,NULL); /* create new generic generator object */ gen = _unur_generic_create( par, sizeof(struct unur_srou_gen) ); /* magic cookies */ COOKIE_SET(gen,CK_SROU_GEN); /* set generator identifier */ gen->genid = _unur_set_genid(GENTYPE); /* routines for sampling and destroying generator */ SAMPLE = _unur_srou_getSAMPLE(gen); gen->destroy = _unur_srou_free; gen->clone = _unur_srou_clone; gen->reinit = _unur_srou_reinit; /* copy some parameters into generator object */ GEN->r = PAR->r; /* parameter for power transformation */ GEN->Fmode = PAR->Fmode; /* CDF at mode */ GEN->um = PAR->um; /* square root of PDF at mode */ /* initialize variables */ GEN->vl = GEN->vr = 0.; GEN->xl = GEN->xr = 0.; GEN->p = 0.; GEN->a = GEN->b = 0.; GEN->log_ab = 0.; #ifdef UNUR_ENABLE_INFO /* set function for creating info string */ gen->info = _unur_srou_info; #endif /* return pointer to (almost empty) generator object */ return gen; } /* end of _unur_srou_create() */ /*---------------------------------------------------------------------------*/ int _unur_srou_check_par( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* check parameters of given distribution and method */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check for required data: mode */ if (!(gen->distr->set & UNUR_DISTR_SET_MODE)) { _unur_warning(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"mode: try finding it (numerically)"); if (unur_distr_cont_upd_mode(gen->distr)!=UNUR_SUCCESS) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"mode"); return UNUR_ERR_DISTR_REQUIRED; } } /* check for required data: area */ if (!(gen->distr->set & UNUR_DISTR_SET_PDFAREA)) { if (unur_distr_cont_upd_pdfarea(gen->distr)!=UNUR_SUCCESS) { _unur_error(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"area below PDF"); return UNUR_ERR_DISTR_REQUIRED; } } /* mode must be in domain */ if ( (DISTR.mode < DISTR.BD_LEFT) || (DISTR.mode > DISTR.BD_RIGHT) ) { /* there is something wrong. assume: user has change domain without changing mode. but then, she probably has not updated area and is to large */ _unur_warning(GENTYPE,UNUR_ERR_GEN_DATA,"area and/or CDF at mode"); DISTR.mode = _unur_max(DISTR.mode,DISTR.BD_LEFT); DISTR.mode = _unur_min(DISTR.mode,DISTR.BD_RIGHT); } return UNUR_SUCCESS; } /* end of _unur_srou_check_par() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_srou_clone( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* copy (clone) generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to clone of generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { #define CLONE ((struct unur_srou_gen*)clone->datap) struct unur_gen *clone; /* check arguments */ CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_SROU_GEN,NULL); /* create generic clone */ clone = _unur_generic_clone( gen, GENTYPE ); return clone; #undef CLONE } /* end of _unur_srou_clone() */ /*---------------------------------------------------------------------------*/ void _unur_srou_free( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* deallocate generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { /* check arguments */ if( !gen ) /* nothing to do */ return; /* check input */ if ( gen->method != UNUR_METH_SROU ) { _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); return; } COOKIE_CHECK(gen,CK_SROU_GEN,RETURN_VOID); /* we cannot use this generator object any more */ SAMPLE = NULL; /* make sure to show up a programming error */ /* free memory */ _unur_generic_free(gen); } /* end of _unur_srou_free() */ /*****************************************************************************/ double _unur_srou_sample( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { double U,V,X,x,xx; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_SROU_GEN,UNUR_INFINITY); while (1) { /* generate point uniformly on rectangle */ while ( _unur_iszero(U = _unur_call_urng(gen->urng)) ); U *= GEN->um; V = GEN->vl + _unur_call_urng(gen->urng) * (GEN->vr - GEN->vl); /* ratio */ X = V/U; /* compute x */ x = X + DISTR.mode; /* inside domain ? */ if ( (x < DISTR.BD_LEFT) || (x > DISTR.BD_RIGHT) ) continue; /* evaluate squeeze */ if ( (gen->variant & SROU_VARFLAG_SQUEEZE) && (X >= GEN->xl) && (X <= GEN->xr ) && (U < GEN->um) ) { xx = V / (GEN->um - U); if ( (xx >= GEN->xl) && (xx <= GEN->xr ) ) return x; } /* accept or reject */ if (U*U <= PDF(x)) return x; } } /* end of _unur_srou_sample() */ /*---------------------------------------------------------------------------*/ double _unur_srou_sample_mirror( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator, use mirror principle */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { double U,V,X,x,fx,fnx,uu; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_SROU_GEN,UNUR_INFINITY); while (1) { /* generate point uniformly on rectangle */ while ( _unur_iszero(U = _unur_call_urng(gen->urng)) ); U *= GEN->um * SQRT2; V = 2. * (_unur_call_urng(gen->urng) - 0.5) * GEN->vr; /* vr = vm when the CDF at the mode is not known */ /* ratio */ X = V/U; /* evaluate PDF */ x = X + DISTR.mode; fx = (x < DISTR.BD_LEFT || x > DISTR.BD_RIGHT) ? 0. : PDF(x); uu = U * U; /* accept or reject */ if (uu <= fx) return x; /* try mirrored PDF */ x = -X + DISTR.mode; fnx = (x < DISTR.BD_LEFT || x > DISTR.BD_RIGHT) ? 0. : PDF(x); if (uu <= fx + fnx) return x; } } /* end of _unur_srou_sample_mirror() */ /*---------------------------------------------------------------------------*/ double _unur_srou_sample_check( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator and verify that method can be used */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { double U,uu,V,X,x,nx,fx,sfx,fnx,xfx,xfnx,xx; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_SROU_GEN,UNUR_INFINITY); if (gen->variant & SROU_VARFLAG_MIRROR) { /* use mirror principle */ while (1) { /* generate point uniformly on rectangle */ while ( _unur_iszero(U = _unur_call_urng(gen->urng)) ); U *= GEN->um * SQRT2; V = 2. * (_unur_call_urng(gen->urng) - 0.5) * GEN->vr; /* vr = vm when the CDF at the mode is not known */ /* ratio */ X = V/U; /* x values */ x = X + DISTR.mode; nx = -X + DISTR.mode; /* evaluate PDF */ fx = (x < DISTR.BD_LEFT || x > DISTR.BD_RIGHT) ? 0. : PDF(x); fnx = (nx < DISTR.BD_LEFT || nx > DISTR.BD_RIGHT) ? 0. : PDF(nx); uu = U * U; /* check hat */ xfx = (x - DISTR.mode) * sqrt(fx); xfnx = (nx - DISTR.mode) * sqrt(fnx); if ( ((2.+4.*DBL_EPSILON) * GEN->um*GEN->um < fx + fnx) /* avoid roundoff error with FP registers */ || (xfx < (1.+UNUR_EPSILON) * GEN->vl) || (xfx > (1.+UNUR_EPSILON) * GEN->vr) || (xfnx < (1.+UNUR_EPSILON) * GEN->vl) || (xfnx > (1.+UNUR_EPSILON) * GEN->vr) ) _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF(x) > hat(x)"); /* accept or reject */ if (uu <= fx) return x; /* try mirrored PDF */ if (uu <= fx + fnx) return nx; } } else { /* do not use mirror principle */ while (1) { /* generate point uniformly on rectangle */ while ( _unur_iszero(U = _unur_call_urng(gen->urng)) ); U *= GEN->um; V = GEN->vl + _unur_call_urng(gen->urng) * (GEN->vr - GEN->vl); /* ratio */ X = V/U; /* compute x */ x = X + DISTR.mode; /* inside domain ? */ if ( (x < DISTR.BD_LEFT) || (x > DISTR.BD_RIGHT) ) continue; /* evaluate PDF */ fx = PDF(x); /* the point on the boundary of the region of acceptance in direction X = V/U has the coordinates ( X * sqrt(fx), sqrt(fx) ). */ sfx = sqrt(fx); xfx = X * sfx; /* check hat */ if ( ( sfx > (1.+DBL_EPSILON) * GEN->um ) /* avoid roundoff error with FP registers */ || (xfx < (1.+UNUR_EPSILON) * GEN->vl) || (xfx > (1.+UNUR_EPSILON) * GEN->vr) ) _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF(x) > hat(x)"); /* evaluate and check squeeze */ if ( (gen->variant & SROU_VARFLAG_SQUEEZE) && (X >= GEN->xl) && (X <= GEN->xr ) && (U < GEN->um) ) { /* check squeeze */ xx = xfx / (GEN->um - sfx); if ( (xx > (1.-UNUR_EPSILON) * GEN->xl) && (xx < (1.-UNUR_EPSILON) * GEN->xr) ) _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF(x) < squeeze(x)"); /* squeeze acceptance */ xx = V / (GEN->um - U); if ( (xx >= GEN->xl) && (xx <= GEN->xr ) ) return x; } /* accept or reject */ if (U*U <= PDF(x)) return x; } } } /* end of _unur_srou_sample_check() */ /*****************************************************************************/ double _unur_gsrou_sample( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { double U,Ur,V,W,X,Z; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_SROU_GEN,UNUR_INFINITY); while (1) { W = GEN->log_ab *_unur_call_urng(gen->urng); Z = GEN->vl + _unur_call_urng(gen->urng) * (GEN->vr - GEN->vl); U = (exp(-W)-1.) * GEN->a/GEN->b; V = -Z/(GEN->a + GEN->b*U); U *= GEN->um; Ur = pow(U,GEN->r); X = V/Ur + DISTR.mode; /* inside domain ? */ if ( (X < DISTR.BD_LEFT) || (X > DISTR.BD_RIGHT) ) continue; /* accept or reject */ if (Ur*U <= PDF(X)) return X; } } /* end of _unur_gsrou_sample() */ /*---------------------------------------------------------------------------*/ double _unur_gsrou_sample_check( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* sample from generator and verify that method can be used */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* double (sample from random variate) */ /* */ /* error: */ /* return UNUR_INFINITY */ /*----------------------------------------------------------------------*/ { double U,Ur,V,W,X,x,Z; double fx,uf,vf,vhl,vhr; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_SROU_GEN,UNUR_INFINITY); while (1) { W = GEN->log_ab *_unur_call_urng(gen->urng); Z = GEN->vl + _unur_call_urng(gen->urng) * (GEN->vr - GEN->vl); U = (exp(-W)-1.) * GEN->a/GEN->b; V = -Z/(GEN->a + GEN->b*U); U *= GEN->um; Ur = pow(U,GEN->r); X = V/Ur; /* compute x */ x = X + DISTR.mode; /* inside domain ? */ if ( (x < DISTR.BD_LEFT) || (x > DISTR.BD_RIGHT) ) continue; /* evaluate density */ fx = PDF(x); /* the point on the boundary of the region of acceptance in direction X = V/U^r has the coordinates ( (x-mode) * (fx)^(r/(r+1)), sqrt[r+1](fx) ). */ uf = pow(fx,1./(GEN->r+1)); vf = X * pow(fx,GEN->r/(GEN->r+1.)); /* the corresponding point on boundary of the enveloping region */ /* with same u-coordinate. */ vhl = - GEN->vl /(GEN->a + GEN->b*(uf/GEN->um)); vhr = - GEN->vr /(GEN->a + GEN->b*(uf/GEN->um)); /* check hat */ if ( ( uf > (1.+DBL_EPSILON) * GEN->um ) /* avoid roundoff error with FP registers */ || (vf < (1.+UNUR_EPSILON) * vhl ) || (vf > (1.+UNUR_EPSILON) * vhr ) ) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF(x) > hat(x)"); } /* accept or reject */ if (Ur*U <= fx) return x; } } /* end of _unur_gsrou_sample_check() */ /*****************************************************************************/ /** Auxilliary Routines **/ /*****************************************************************************/ int _unur_srou_rectangle( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* compute universal bounding rectangle */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { double vm, fm; /* width of rectangle, PDF at mode */ /* check arguments */ CHECK_NULL( gen, UNUR_ERR_NULL ); COOKIE_CHECK( gen,CK_SROU_GEN, UNUR_ERR_COOKIE ); /* compute PDF at mode (if not given by user) */ if (!(gen->set & SROU_SET_PDFMODE)) { fm = PDF(DISTR.mode); /* fm must be positive */ if (fm <= 0.) { _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"PDF(mode) <= 0."); return UNUR_ERR_GEN_DATA; } if (!_unur_isfinite(fm)) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"PDF(mode) overflow"); return UNUR_ERR_PAR_SET; } GEN->um = sqrt(fm); /* height of rectangle */ } /* width of rectangle */ vm = DISTR.area / GEN->um; if (gen->set & SROU_SET_CDFMODE) { /* cdf at mode known */ GEN->vl = -GEN->Fmode * vm; GEN->vr = vm + GEN->vl; GEN->xl = GEN->vl/GEN->um; GEN->xr = GEN->vr/GEN->um; } else { /* cdf at mode unknown */ GEN->vl = -vm; GEN->vr = vm; GEN->xl = GEN->vl/GEN->um; GEN->xr = GEN->vr/GEN->um; /* we cannot use universal squeeze */ gen->variant &= ~SROU_VARFLAG_SQUEEZE; } /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_srou_rectangle() */ /*---------------------------------------------------------------------------*/ int _unur_gsrou_envelope( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* compute parameters for universal bounding envelope. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { double fm; /* PDF at mode */ double vm; /* maximal width of envelope */ double pr; /* p^r */ double p; /* short cuts */ double r = GEN->r; /* check arguments */ CHECK_NULL( gen, UNUR_ERR_NULL ); COOKIE_CHECK( gen, CK_SROU_GEN, UNUR_ERR_COOKIE ); if (!(gen->set & SROU_SET_PDFMODE)) { /* compute PDF at mode */ fm = PDF(DISTR.mode); /* fm must be positive */ if (fm <= 0.) { _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"PDF(mode) <= 0."); return UNUR_ERR_GEN_DATA; } if (!_unur_isfinite(fm)) { _unur_warning(GENTYPE,UNUR_ERR_PAR_SET,"PDF(mode) overflow"); return UNUR_ERR_PAR_SET; } GEN->um = pow(fm,1./(r+1.)); /* height of envelope */ } /* maximal width of envelope */ vm = DISTR.area / (GEN->r*GEN->um); if (gen->set & SROU_SET_CDFMODE) { /* cdf at mode known */ GEN->vl = -GEN->Fmode * vm; GEN->vr = vm + GEN->vl; } else { /* cdf at mode unknown */ GEN->vl = -vm; GEN->vr = vm; } /* construction point for bounding curve */ GEN->p = p = 1. - 2.187/pow(r + 5 - 1.28/r, 0.9460 ); pr = pow(p,r); /* parameters for bounding envelope */ GEN->b = (1. - r * pr/p + (r-1.)*pr) / ((pr-1.)*(pr-1)); GEN->a = -(p-1.)/(pr-1.) - p * GEN->b; GEN->log_ab = log(GEN->a/(GEN->a+GEN->b)); /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_gsrou_envelope() */ /*****************************************************************************/ /** Debugging utilities **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_LOGGING /*---------------------------------------------------------------------------*/ void _unur_srou_debug_init( const struct unur_gen *gen, int is_reinit ) /*----------------------------------------------------------------------*/ /* write info about generator into LOG file */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* is_reinit ... if TRUE the generator has been reinitialized */ /*----------------------------------------------------------------------*/ { FILE *LOG; /* check arguments */ CHECK_NULL(gen,RETURN_VOID); COOKIE_CHECK(gen,CK_SROU_GEN,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s:\n",gen->genid); if (!is_reinit) { fprintf(LOG,"%s: type = continuous univariate random variates\n",gen->genid); fprintf(LOG,"%s: method = srou (simple universal ratio-of-uniforms)\n",gen->genid); } else fprintf(LOG,"%s: reinit!\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); _unur_distr_cont_debug( gen->distr, gen->genid ); if (gen->set & SROU_SET_R) { fprintf(LOG,"%s: Generalized version: r = %g\n",gen->genid,GEN->r); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: sampling routine = _unur_gsrou_sample",gen->genid); if (gen->variant & SROU_VARFLAG_VERIFY) fprintf(LOG,"_check"); fprintf(LOG,"()\n%s:\n",gen->genid); } else { fprintf(LOG,"%s: Simple version (r = 1) [default]\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); fprintf(LOG,"%s: sampling routine = _unur_srou_sample",gen->genid); if (gen->variant & SROU_VARFLAG_VERIFY) fprintf(LOG,"_check"); else if (gen->variant & SROU_VARFLAG_MIRROR) fprintf(LOG,"_mirror"); fprintf(LOG,"()\n%s:\n",gen->genid); } if (gen->set & SROU_SET_CDFMODE) fprintf(LOG,"%s: F(mode) = %g\n",gen->genid,GEN->Fmode); else fprintf(LOG,"%s: F(mode) unknown\n",gen->genid); if (gen->variant & SROU_VARFLAG_SQUEEZE) fprintf(LOG,"%s: use universal squeeze\n",gen->genid); else fprintf(LOG,"%s: no (universal) squeeze\n",gen->genid); if (gen->variant & SROU_VARFLAG_MIRROR) fprintf(LOG,"%s: use mirror principle\n",gen->genid); fprintf(LOG,"%s:\n",gen->genid); if (gen->set & SROU_SET_R) { fprintf(LOG,"%s: Enveloping region:\n",gen->genid); fprintf(LOG,"%s: um = %g\n",gen->genid,GEN->um); fprintf(LOG,"%s: vl = %g\n",gen->genid,GEN->vl); fprintf(LOG,"%s: vr = %g\n",gen->genid,GEN->vr); fprintf(LOG,"%s: p = %g\n",gen->genid,GEN->p); fprintf(LOG,"%s: a = %g\n",gen->genid,GEN->a); fprintf(LOG,"%s: b = %g\n",gen->genid,GEN->b); } else { fprintf(LOG,"%s: Rectangle:\n",gen->genid); fprintf(LOG,"%s: left upper point = (%g,%g)\n",gen->genid,GEN->vl,GEN->um); fprintf(LOG,"%s: right upper point = (%g,%g)\n",gen->genid,GEN->vr,GEN->um); } fprintf(LOG,"%s:\n",gen->genid); } /* end of _unur_srou_debug_init() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_LOGGING */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #ifdef UNUR_ENABLE_INFO /*---------------------------------------------------------------------------*/ void _unur_srou_info( struct unur_gen *gen, int help ) /*----------------------------------------------------------------------*/ /* create character string that contains information about the */ /* given generator object. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* help ... whether to print additional comments */ /*----------------------------------------------------------------------*/ { struct unur_string *info = gen->infostr; struct unur_distr *distr = gen->distr; int samplesize = 10000; double h_area, rc; /* generator ID */ _unur_string_append(info,"generator ID: %s\n\n", gen->genid); /* distribution */ _unur_string_append(info,"distribution:\n"); _unur_distr_info_typename(gen); _unur_string_append(info," functions = PDF\n"); _unur_string_append(info," domain = (%g, %g)\n", DISTR.domain[0],DISTR.domain[1]); _unur_string_append(info," mode = %g %s\n", DISTR.mode, (distr->set & UNUR_DISTR_SET_MODE_APPROX) ? "[numeric.]" : ""); _unur_string_append(info," area(PDF) = %g\n", DISTR.area); if (gen->set & SROU_SET_CDFMODE) _unur_string_append(info," F(mode) = %g\n", GEN->Fmode); else _unur_string_append(info," F(mode) = [unknown]\n"); if (help) { if ( distr->set & UNUR_DISTR_SET_MODE_APPROX ) _unur_string_append(info,"\n[ Hint: %s ]\n", "You may provide the \"mode\""); } _unur_string_append(info,"\n"); /* method */ _unur_string_append(info,"method: SROU (Simple Ratio-Of-Uniforms)\n"); _unur_string_append(info," r = %g %s\n", GEN->r, (gen->set & SROU_SET_R) ? "[generalized version]" : ""); if (gen->set & SROU_SET_CDFMODE) _unur_string_append(info," use CDF at mode\n"); if (gen->variant & SROU_VARFLAG_SQUEEZE) _unur_string_append(info," use squeeze\n"); if (gen->variant & SROU_VARFLAG_MIRROR) _unur_string_append(info," use mirror principle\n"); _unur_string_append(info,"\n"); /* performance */ _unur_string_append(info,"performance characteristics:\n"); if (gen->set & SROU_SET_R) { rc = unur_test_count_urn(gen,samplesize,0,NULL)/(2.*samplesize); _unur_string_append(info," enveloping rectangle = (%g,%g) x (%g,%g)\n", GEN->vl,GEN->vr, 0.,GEN->um); _unur_string_append(info," rejection constant = %.2f [approx.]\n", rc); } else { _unur_string_append(info," bounding rectangle = (%g,%g) x (%g,%g)\n", GEN->vl,GEN->vr, 0.,GEN->um); h_area = (GEN->vr - GEN->vl) * GEN->um; _unur_string_append(info," area(hat) = %g\n", h_area); if (gen->set & SROU_SET_CDFMODE) rc = 2.; else rc = (gen->variant & SROU_VARFLAG_MIRROR) ? 2.829 : 4.; _unur_string_append(info," rejection constant = %g\n", rc); } _unur_string_append(info,"\n"); /* parameters */ if (help) { _unur_string_append(info,"parameters:\n"); _unur_string_append(info," r = %g %s\n", GEN->r, (gen->set & SROU_SET_R) ? "" : "[default]"); if (gen->set & SROU_SET_CDFMODE) _unur_string_append(info," cdfatmode = %g\n", GEN->Fmode); else _unur_string_append(info," cdfatmode = [not set]\n"); if (gen->variant & SROU_VARFLAG_SQUEEZE) _unur_string_append(info," usesqueeze\n"); if (gen->variant & SROU_VARFLAG_MIRROR) _unur_string_append(info," usemirror\n"); if (gen->variant & SROU_VARFLAG_VERIFY) _unur_string_append(info," verify = on\n"); _unur_string_append(info,"\n"); /* Not displayed: int unur_srou_set_pdfatmode( UNUR_PAR *parameters, double fmode ); */ } /* Hints */ if (help) { if ( !(gen->set & SROU_SET_CDFMODE)) _unur_string_append(info,"[ Hint: %s ]\n", "You can set \"cdfatmode\" to reduce the rejection constant."); _unur_string_append(info,"\n"); } } /* end of _unur_srou_info() */ /*---------------------------------------------------------------------------*/ #endif /* end UNUR_ENABLE_INFO */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/hrb.h0000644001357500135600000001340214420304141013204 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: hrb.h * * * * PURPOSE: * * function prototypes for method HRB * * (Hazard Rate Bounded) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /* =METHOD HRB Hazard Rate Bounded =UP Methods_for_CONT =REQUIRED bounded hazard rate =OPTIONAL upper bound for hazard rate =SPEED Set-up: fast, Sampling: slow =REINIT supported =REF [HLD04: Sect.9.1.4, Alg.9.4] =DESCRIPTION Generates random variate with given hazard rate which must be bounded from above. It uses the thinning method with a constant dominating hazard function. =HOWTOUSE HRB requires a hazard function for a continuous distribution together with an upper bound. The latter has to be set using the unur_hrb_set_upperbound() call. If no such upper bound is given it is assumed that the upper bound can be achieved by evaluating the hazard rate at the left hand boundary of the domain of the distribution. Notice, however, that for decreasing hazard rate the method HRD (@pxref{HRD,,Hazard Rate Decreasing}) is much faster and thus the prefered method. It is important to note that the domain of the distribution can be set via a unur_distr_cont_set_domain() call. However, the left border must not be negative. Otherwise it is set to @code{0}. This is also the default if no domain is given at all. For computational reasons the right border is always set to @code{UNUR_INFINITY} independently of the given domain. Thus for domains bounded from right the function for computing the hazard rate should return @code{UNUR_INFINITY} right of this domain. For distributions with increasing hazard rate method HRI (@pxref{HRI,,Hazard Rate Increasing}) is required. It is possible to change the parameters and the domain of the chosen distribution and run unur_reinit() to reinitialize the generator object. Notice, that the upper bound given by the unur_hrb_set_upperbound() call cannot be changed and must be valid for the changed distribution. =END */ /*---------------------------------------------------------------------------*/ /* Routines for user interface */ /* =ROUTINES */ UNUR_PAR *unur_hrb_new( const UNUR_DISTR *distribution ); /* Get default parameters for generator. */ /*...........................................................................*/ int unur_hrb_set_upperbound( UNUR_PAR *parameters, double upperbound ); /* Set upper bound for hazard rate. If this call is not used it is assumed that the the maximum of the hazard rate is achieved at the left hand boundary of the domain of the distribution. */ int unur_hrb_set_verify( UNUR_PAR *parameters, int verify ); /* */ int unur_hrb_chg_verify( UNUR_GEN *generator, int verify ); /* Turn verifying of algorithm while sampling on/off. If the hazard rate is not bounded by the given bound, then @code{unur_errno} is set to @code{UNUR_ERR_GEN_CONDITION}. Default is FALSE. */ /* =END */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/tabl_init.ch0000644001357500135600000012472014420445767014573 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: tabl_init.c * * * * TYPE: continuous univariate random variate * * METHOD: rejection form piecewise constant hat * * (Ahren's table method) * * * * DESCRIPTION: * * Given PDF of a unimodal distribution * * produce random variate X with its density * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*****************************************************************************/ /** Private **/ /*****************************************************************************/ struct unur_gen * _unur_tabl_init( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* initialize new generator */ /* */ /* parameters: */ /* params pointer to paramters for building generator object */ /* */ /* return: */ /* pointer to generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); /* check input */ if ( par->method != UNUR_METH_TABL ) { _unur_error(GENTYPE,UNUR_ERR_PAR_INVALID,""); return NULL; } COOKIE_CHECK(par,CK_TABL_PAR,NULL); /* create a new empty generator object */ gen = _unur_tabl_create(par); if (!gen) { _unur_par_free(par); return NULL; } #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_tabl_debug_init_start(par,gen); #endif /* make starting intervals */ do { /* (1) use slopes if given, otherwise (2) use construction points if given, otherwise (3) use mode if available, otherwise (s) stop (no generator object can be created) */ /* (1) use slopes if given */ if (PAR->n_slopes > 0) { if (_unur_tabl_get_intervals_from_slopes(par,gen)!=UNUR_SUCCESS) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"Cannot make hat function"); _unur_par_free(par); _unur_tabl_free(gen); return NULL; } break; } /* (2) use construction points if given */ if (PAR->cpoints == NULL) { if (! ( (par->distr->set & UNUR_DISTR_SET_MODE) && unur_tabl_set_cpoints(par,1,&(DISTR.mode)) == UNUR_SUCCESS) ) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"Cannot compute slopes"); _unur_par_free(par); _unur_tabl_free(gen); return NULL; } } /* now there should be construnctions points */ if (PAR->cpoints != NULL) { if (_unur_tabl_get_intervals_from_cpoints(par,gen)!=UNUR_SUCCESS) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"Cannot make hat function"); _unur_par_free(par); _unur_tabl_free(gen); return NULL; } break; } /* one of the above cases should have happened */ _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); _unur_par_free(par); _unur_tabl_free(gen); return NULL; } while(0); #ifdef UNUR_ENABLE_LOGGING /* print starting intervals */ if (gen->debug & TABL_DEBUG_IV_START) _unur_tabl_debug_intervals(gen,"starting intervals:",FALSE); #endif /* update number of slopes */ PAR->n_slopes = GEN->n_ivs; /* split starting intervals / slopes */ if (_unur_tabl_compute_intervals(par,gen) != UNUR_SUCCESS) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"Cannot split intervals"); _unur_par_free(par); _unur_tabl_free(gen); return NULL; } /* make initial guide table */ if (_unur_tabl_make_guide_table(gen) != UNUR_SUCCESS) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"cannot create guide table"); _unur_par_free(par); _unur_tabl_free(gen); return NULL; } /* creation of generator object successfull */ gen->status = UNUR_SUCCESS; #ifdef UNUR_ENABLE_LOGGING if (gen->debug) _unur_tabl_debug_init_finished(gen); #endif /* free parameters */ _unur_par_free(par); return gen; } /* end of _unur_tabl_init() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_tabl_create( struct unur_par *par ) /*----------------------------------------------------------------------*/ /* allocate memory for generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* */ /* return: */ /* pointer to (empty) generator object with default settings */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { struct unur_gen *gen; /* check arguments */ CHECK_NULL(par,NULL); COOKIE_CHECK(par,CK_TABL_PAR,NULL); /* create new generic generator object */ gen = _unur_generic_create( par, sizeof(struct unur_tabl_gen) ); /* magic cookies */ COOKIE_SET(gen,CK_TABL_GEN); /* check for required data: area */ if (!(gen->distr->set & UNUR_DISTR_SET_PDFAREA)) if (_unur_distr_cont_upd_pdfarea(gen->distr, TRUE)!=UNUR_SUCCESS) _unur_warning(GENTYPE,UNUR_ERR_DISTR_REQUIRED,"area below PDF, use default instead"); /* set generator identifier */ gen->genid = _unur_set_genid(GENTYPE); /* routines for sampling, cloning and destroying generator */ SAMPLE = _unur_tabl_getSAMPLE(gen); gen->destroy = _unur_tabl_free; gen->clone = _unur_tabl_clone; /* set all pointers to NULL */ GEN->Atotal = 0.; GEN->Asqueeze = 0.; GEN->guide = NULL; GEN->guide_size = 0; GEN->iv = NULL; GEN->n_ivs = 0; /* the boundaries for our computation limits are intersection of the */ /* domain of the distribution and the given computation boundaries. */ if (par->distr->set & UNUR_DISTR_SET_DOMAIN) { PAR->bleft = _unur_max(PAR->bleft, DISTR.BD_LEFT); PAR->bright = _unur_min(PAR->bright,DISTR.BD_RIGHT); } GEN->bleft = PAR->bleft; /* left boundary of domain */ GEN->bright = PAR->bright; /* right boundary of domain */ /* set (default) boundaries for U */ GEN->Umin = 0.; GEN->Umax = 1.; /* relative size of guide tables */ GEN->guide_factor = PAR->guide_factor; /* bounds for adding construction points */ GEN->max_ivs = PAR->max_ivs; /* maximum number of intervals */ #ifdef UNUR_ENABLE_INFO GEN->max_ivs_info = PAR->max_ivs; /* ... for info string */ #endif GEN->max_ratio = PAR->max_ratio; /* bound for ratio Atotal / Asqueeze */ GEN->darsfactor = PAR->darsfactor; #ifdef UNUR_ENABLE_INFO /* set function for creating info string */ gen->info = _unur_tabl_info; #endif /* return pointer to (almost empty) generator object */ return gen; } /* end of _unur_tabl_create() */ /*---------------------------------------------------------------------------*/ struct unur_gen * _unur_tabl_clone( const struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* copy (clone) generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* pointer to clone of generator object */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { #define CLONE ((struct unur_tabl_gen*)clone->datap) struct unur_gen *clone; struct unur_tabl_interval *iv,*next, *clone_iv, *clone_prev; /* check arguments */ CHECK_NULL(gen,NULL); COOKIE_CHECK(gen,CK_TABL_GEN,NULL); /* create generic clone */ clone = _unur_generic_clone( gen, GENTYPE ); /* copy linked list of intervals */ clone_iv = NULL; clone_prev = NULL; for (iv = GEN->iv; iv != NULL; iv = next) { /* copy segment */ clone_iv = _unur_xmalloc( sizeof(struct unur_tabl_interval) ); memcpy( clone_iv, iv, sizeof(struct unur_tabl_interval) ); if (clone_prev == NULL) { /* starting point of linked list */ CLONE->iv = clone_iv; } else { /* insert into linked list */ clone_prev->next = clone_iv; } /* next step */ next = iv->next; clone_prev = clone_iv; } /* terminate linked list */ if (clone_iv) clone_iv->next = NULL; /* make new guide table */ CLONE->guide = NULL; if (_unur_tabl_make_guide_table(clone) != UNUR_SUCCESS) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"cannot create guide table"); /* There is no chance to run out of this error! */ /* however, this should never happen. */ } /* finished clone */ return clone; #undef CLONE } /* end of _unur_tabl_clone() */ /*---------------------------------------------------------------------------*/ void _unur_tabl_free( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* deallocate generator object */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /*----------------------------------------------------------------------*/ { /* check arguments */ if( !gen ) /* nothing to do */ return; /* check input */ if ( gen->method != UNUR_METH_TABL ) { _unur_warning(gen->genid,UNUR_ERR_GEN_INVALID,""); return; } COOKIE_CHECK(gen,CK_TABL_GEN,RETURN_VOID); /* we cannot use this generator object any more */ SAMPLE = NULL; /* make sure to show up a programming error */ #ifdef UNUR_ENABLE_LOGGING /* write info into LOG file */ if (gen->debug) _unur_tabl_debug_free(gen); #endif /* free linked list of intervals */ { struct unur_tabl_interval *iv,*next; for (iv = GEN->iv; iv != NULL; iv = next) { next = iv->next; free(iv); } } /* free tables */ if (GEN->guide) free(GEN->guide); /* free other memory */ _unur_generic_free(gen); } /* end of _unur_tabl_free() */ /*****************************************************************************/ /** Auxilliary Routines **/ /*****************************************************************************/ int _unur_tabl_get_intervals_from_slopes( struct unur_par *par, struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* compute starting intervals, slopes are given by user. */ /* estimate domain when not given. */ /* */ /* parameters: */ /* par ... pointer to parameter list */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* comment: */ /* a slope is an interval [a,b] or [b,a] such that */ /* PDF(a) >= PDF(b) */ /*----------------------------------------------------------------------*/ { struct unur_tabl_interval *iv; double xmax, xmin; double sl, sr; int i; /* check arguments */ CHECK_NULL(par,UNUR_ERR_NULL); COOKIE_CHECK(par,CK_TABL_PAR,UNUR_ERR_COOKIE); CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_TABL_GEN,UNUR_ERR_COOKIE); /* init counter of intervals */ GEN->n_ivs = 0; iv = GEN->iv = NULL; /* boundary of computational interval are reset by boundaries of slopes */ GEN->bleft = UNUR_INFINITY; GEN->bright = -UNUR_INFINITY; /* compute initial intervals */ for ( i=0; i < 2*PAR->n_slopes; i+=2 ) { /* max and min of PDF in interval */ xmax = PAR->slopes[i]; xmin = PAR->slopes[i+1]; /* check whether boundaries of slopes are inside computational region */ if (xmax > xmin) { /* increasing slope */ sl = xmin; sr = xmax; } else { /* decreasing slope */ sl = xmax; sr = xmin; } if (_unur_FP_greater(DISTR.BD_LEFT,sr)) continue; /* slope not in domain */ if (_unur_FP_less(DISTR.BD_RIGHT,sl)) continue; /* slope not in domain */ if (_unur_FP_greater(DISTR.BD_LEFT,sl)) { /* chop slope (parts of slope not in domain) */ if (xmax > xmin) xmin = DISTR.BD_LEFT; else xmax = DISTR.BD_LEFT; } if (_unur_FP_less(DISTR.BD_RIGHT,sr)) { /* chop slope (parts of slope not in domain) */ if (xmax < xmin) xmin = DISTR.BD_RIGHT; else xmax = DISTR.BD_RIGHT; } /* get a new interval and link into list */ if (GEN->iv==NULL) /* the first interval */ iv = GEN->iv = _unur_xmalloc(sizeof(struct unur_tabl_interval)); else /* all the other intervals */ iv = iv->next = _unur_xmalloc(sizeof(struct unur_tabl_interval)); ++(GEN->n_ivs); COOKIE_SET(iv,CK_TABL_IV); /* max and min of PDF in interval */ iv->xmax = xmax; iv->fmax = PDF(iv->xmax); iv->xmin = xmin; iv->fmin = PDF(iv->xmin); /* check for overflow */ if (! (_unur_isfinite(iv->fmax) && _unur_isfinite(iv->fmin) && iv->fmax >= 0. && iv->fmin >= 0.) ) { /* overflow */ _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"PDF(x) overflow"); iv->next = NULL; /* terminate list (freeing list) */ return UNUR_ERR_GEN_DATA; } /* check slopes (but only give a warning) */ if (_unur_FP_less(iv->fmax,iv->fmin)) { _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"PDF discontinuous or slope not monotone"); } /* we assume that the PDF is discontinuous at the boundary of the slope. Thus we cannot use squezzes in the interval on the "lower" end of the slope. */ iv->fmin = 0.; /* area of slope */ iv->Ahat = fabs(xmax - xmin) * iv->fmax; iv->Asqueeze = fabs(xmax - xmin) * iv->fmin; iv->Acum = 0.; /* estimate domain */ if (xmax > xmin) { /* increasing slope */ GEN->bleft = _unur_min(GEN->bleft,xmin); GEN->bright = _unur_max(GEN->bright,xmax); } else { /* decreasing slope */ GEN->bleft = _unur_min(GEN->bleft,xmax); GEN->bright = _unur_max(GEN->bright,xmin); } } /* check whether we have added slopes */ if (GEN->iv==NULL) { _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"invalid slopes"); return UNUR_ERR_GEN_DATA; } /* terminate list */ iv->next = NULL; /* reset area below distribution */ gen->distr->set &= ~UNUR_DISTR_SET_PDFAREA; _unur_distr_cont_upd_pdfarea( gen->distr, TRUE ); /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_tabl_get_intervals_from_slopes() */ /*---------------------------------------------------------------------------*/ int _unur_tabl_get_intervals_from_cpoints( struct unur_par *par, struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* compute starting intervals, cpoints are given by user. */ /* (it is assumed that the PDF is continuous) */ /* */ /* parameters: */ /* par ... pointer to parameter list */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { struct unur_tabl_interval *iv; double sl, sr; /* boundary of slopes */ double fl, fr; /* PDF at boundary points */ double cp; /* construction point */ int i; /* check arguments */ CHECK_NULL(par,UNUR_ERR_NULL); COOKIE_CHECK(par,CK_TABL_PAR,UNUR_ERR_COOKIE); CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_TABL_GEN,UNUR_ERR_COOKIE); /* init counter of intervals */ GEN->n_ivs = 0; iv = GEN->iv = NULL; /* the left boudary of computational domain */ sr = GEN->bleft; fr = PDF(sr); for (i=0; i<=PAR->n_cpoints; i++) { if (i < PAR->n_cpoints) { /* the next point in list */ cp = PAR->cpoints[i]; /* check whether we are inside domain */ if (! _unur_FP_less(GEN->bleft,cp)) continue; /* skip to next point */ if (! _unur_FP_greater(GEN->bright,cp)) { /* there are no other cpoints since these should be sorted */ i = (PAR->n_cpoints)-1; /* skip to end of list */ continue; } } else { /* we have looped over all points in list */ /* add right boundary of computational domain */ cp = GEN->bright; } /* make compute points (assume continuity) */ sl = sr; fl = fr; sr = cp; fr = PDF(sr); /* get a new interval and link into list */ if (GEN->iv==NULL) /* the first interval */ iv = GEN->iv = _unur_xmalloc(sizeof(struct unur_tabl_interval)); else /* all the other intervals */ iv = iv->next = _unur_xmalloc(sizeof(struct unur_tabl_interval)); ++(GEN->n_ivs); COOKIE_SET(iv,CK_TABL_IV); /* check for overflow */ if (! (_unur_isfinite(fr) && _unur_isfinite(fl) && fr >= 0. && fl >= 0.) ) { /* overflow */ _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"PDF(x) overflow"); iv->next = NULL; /* terminate list (freeing list) */ return UNUR_ERR_GEN_DATA; } /* remark: for simplicity of code, GEN->iv should not be NULL. Thus we have allocated 'iv' before this check. */ /* max and min of PDF in interval */ if (fr > fl) { /* increasing slope */ iv->xmax = sr; iv->fmax = fr; iv->xmin = sl; iv->fmin = fl; } else { /* decreasing slope */ iv->xmax = sl; iv->fmax = fl; iv->xmin = sr; iv->fmin = fr; } /* area of slope */ iv->Ahat = fabs(sr - sl) * iv->fmax; iv->Asqueeze = fabs(sr - sl) * iv->fmin; iv->Acum = 0.; } /* check whether we have added slopes */ if (GEN->iv==NULL) { _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"invalid slopes"); return UNUR_ERR_GEN_DATA; } /* terminate list */ iv->next = NULL; /* reset domain of distribution */ DISTR.trunc[0] = DISTR.BD_LEFT = GEN->bleft; DISTR.trunc[1] = DISTR.BD_RIGHT = GEN->bright; /* reset area below distribution */ gen->distr->set &= ~UNUR_DISTR_SET_PDFAREA; _unur_distr_cont_upd_pdfarea( gen->distr, TRUE ); /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_tabl_get_intervals_from_cpoints() */ /*---------------------------------------------------------------------------*/ int _unur_tabl_compute_intervals( struct unur_par *par, struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* compute all intervals (by splitting starting intervals/slopes) */ /* */ /* parameters: */ /* par ... pointer to parameter list */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { struct unur_tabl_interval *iv; int i,k; /* check arguments */ CHECK_NULL(par,UNUR_ERR_NULL); COOKIE_CHECK(par,CK_TABL_PAR,UNUR_ERR_COOKIE); CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_TABL_GEN,UNUR_ERR_COOKIE); /* split interval following [1], split A (equal area rule) */ if (par->variant & TABL_VARFLAG_USEEAR) { for (iv = GEN->iv; iv != NULL; iv = iv->next ) { COOKIE_CHECK(iv,CK_TABL_IV,UNUR_ERR_COOKIE); iv = _unur_tabl_run_equalarearule( par, gen, iv ); if (iv == NULL) return UNUR_ERR_GEN_DATA; } #ifdef UNUR_ENABLE_LOGGING /* print intervals after equal area rule has been applied intervals have been created */ if (gen->debug & TABL_DEBUG_IV_START) _unur_tabl_debug_intervals(gen,"equal area rule applied:",FALSE); #endif } if (par->variant & TABL_VARFLAG_USEDARS) { /* run derandomized adaptive rejection sampling (DARS) */ #ifdef UNUR_ENABLE_LOGGING if (gen->debug & TABL_DEBUG_DARS) _unur_tabl_debug_dars_start(par,gen); #endif for (i=0; in_ivs >= GEN->max_ivs) break; /* else run ARS instead */ /* first we have to make an initial gudie table */ if (_unur_tabl_make_guide_table(gen) != UNUR_SUCCESS) return UNUR_ERR_GEN_CONDITION; for (k=0; kn_ivs >= GEN->max_ivs) /* maximal number of intervals reached */ return NULL; iv = iv_slope; /* pointer to actual interval */ iv_last = iv_slope; /* pointer to last interval in list */ /* (maximal) area of bar (= hat in one interval) */ bar_area = DISTR.area * PAR->area_fract; while (_unur_FP_greater(iv->Ahat, bar_area)) { /* increasing or decreasing slope */ slope = (iv->xmax > iv->xmin) ? 1. : -1.; /* compute splitting point: slope == +1 --> move from right to left slope == -1 --> move from left to right */ x = iv->xmax - slope * bar_area / iv->fmax; /* compute PDF */ fx = PDF(x); /* check for overflow */ if (! (_unur_isfinite(fx) && fx >= 0.)) { /* overflow */ _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"PDF(x) overflow"); return NULL; } /* now split interval at x */ switch (_unur_tabl_split_interval( gen, iv, x, fx, TABL_VARFLAG_SPLIT_POINT )) { case UNUR_SUCCESS: /* splitting succesful */ if (slope > 0.) { if (iv_last == iv_slope) iv_last = iv->next; } else { /* slope < 0 */ iv = iv->next; break; } break; case UNUR_ERR_SILENT: /* interval chopped */ break; /* nothing to do */ default: /* error (slope not monotonically increasing) */ return NULL; } /* check number of intervals */ if (GEN->n_ivs >= GEN->max_ivs) { /* maximal number of intervals reached */ _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"split A stopped, maximal number of intervals reached."); break; } } /* pointer to last interval */ return ((iv->xmax > iv->xmin) ? iv_last : iv); } /* end of _unur_tabl_run_equalarearule() */ /*---------------------------------------------------------------------------*/ int _unur_tabl_run_dars( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* run derandomized adaptive rejection sampling. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { struct unur_tabl_interval *iv; double Atot, Asqueezetot; /* total area below hat and squeeze, resp. */ double Alimit; /* threshhold value for splitting interval */ int n_splitted = 1; /* count splitted intervals */ /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_TABL_GEN,UNUR_ERR_COOKIE); /* there is no need to run DARS when the DARS factor is UNUR_INFINITY */ if (_unur_FP_is_infinity(GEN->darsfactor)) return UNUR_SUCCESS; /* first we need the total areas below hat and squeeze. (This is only necessary, when _unur_arou_make_guide_table() has not been called!) */ Atot = 0.; /* area below hat */ Asqueezetot = 0.; /* area below squeeze */ for (iv = GEN->iv; iv != NULL; iv = iv->next ) { COOKIE_CHECK(iv,CK_TABL_IV,UNUR_ERR_COOKIE); Atot += iv->Ahat; Asqueezetot += iv->Asqueeze; } GEN->Atotal = Atot; GEN->Asqueeze = Asqueezetot; /* now split intervals */ while ( (GEN->max_ratio * GEN->Atotal > GEN->Asqueeze) && (GEN->n_ivs < GEN->max_ivs) ) { /* compute threshhold value. every interval with area between hat and squeeze greater than this value will be splitted. */ if (GEN->n_ivs > 1) Alimit = GEN->darsfactor * ( (GEN->Atotal - GEN->Asqueeze) / GEN->n_ivs ); else /* we split every interval if there are only one interval */ Alimit = 0.; /* reset counter for splitted intervals */ n_splitted = 0; /* for all intervals do ... */ for (iv = GEN->iv; iv != NULL; iv = iv->next ) { COOKIE_CHECK(iv,CK_TABL_IV,UNUR_ERR_COOKIE); /* do not exceed the maximum number of intervals */ if (GEN->n_ivs >= GEN->max_ivs) break; /* we skip over all intervals where the area between hat and squeeze does not exceed the threshhold value. */ if ((iv->Ahat - iv->Asqueeze) <= Alimit) continue; /* goto next interval */ switch (_unur_tabl_split_interval( gen, iv, 0., 0., TABL_VARFLAG_SPLIT_ARC )) { case UNUR_SUCCESS: /* splitting succesful */ case UNUR_ERR_SILENT: /* interval chopped */ ++n_splitted; break; /* nothing to do */ default: /* error (slope not monotonically decreasing) */ return UNUR_ERR_GEN_DATA; } } if (n_splitted == 0) { /* we are not successful in splitting any inteval. abort to avoid endless loop */ _unur_warning(gen->genid,UNUR_ERR_GENERIC,"DARS aborted: no intervals could be splitted."); break; } } /* ratio between squeeze and hat o.k. ? */ if ( GEN->max_ratio * GEN->Atotal > GEN->Asqueeze ) { if ( GEN->n_ivs >= GEN->max_ivs ) _unur_warning(gen->genid,UNUR_ERR_GENERIC,"DARS aborted: maximum number of intervals exceeded."); _unur_warning(gen->genid,UNUR_ERR_GENERIC,"hat/squeeze ratio too small."); } else { /* no more construction points */ GEN->max_ivs = GEN->n_ivs; } /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_tabl_run_dars() */ /*****************************************************************************/ int _unur_tabl_split_interval( struct unur_gen *gen, struct unur_tabl_interval *iv_old, double x, double fx, unsigned split_mode ) /*----------------------------------------------------------------------*/ /* split interval (replace old one by two new ones in same place) */ /* new interval is inserted immedately after old one. */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* iv_old ... pointer to interval that has to be split */ /* x ... splitting point */ /* fx ... value of PDF at splitting point */ /* split_mode ... how to split interval */ /* TABL_VARFLAG_SPLIT_POINT: split at given point x */ /* TABL_VARFLAG_SPLIT_MEAN: at mean point of interval */ /* TABL_VARFLAG_SPLIT_ARC: at arc mean point */ /* */ /* return: */ /* UNUR_SUCCESS ... splitting successful */ /* UNUR_ERR_SILENT ... interval chopped off domain */ /* (not part of support of PDF) */ /* others ... error: PDF not monotone in interval */ /*----------------------------------------------------------------------*/ { struct unur_tabl_interval *iv_new; double A_hat_old, A_squ_old; /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_TABL_GEN,UNUR_ERR_COOKIE); CHECK_NULL(iv_old,UNUR_ERR_NULL); COOKIE_CHECK(iv_old,CK_TABL_IV,UNUR_ERR_COOKIE); /* There are three possibilities for the splitting point: (1) use x and avoid computation of PDF(x). (2) use middle of interval. converges faster in many cases. (3) use "arc_mean" of interval. converges faster when domain is almost unbounded. */ switch( split_mode ) { case TABL_VARFLAG_SPLIT_POINT: /* (1) */ /* nothing to do (default) */ break; case TABL_VARFLAG_SPLIT_MEAN: /* (2) */ x = 0.5 * (iv_old->xmin + iv_old->xmax); fx = PDF(x); break; case TABL_VARFLAG_SPLIT_ARC: /* (3) */ x = _unur_arcmean(iv_old->xmin, iv_old->xmax); fx = PDF(x); break; default: /* this should not happen: Invalid variant, use default n*/ _unur_warning(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); break; } /* check for overflow */ if (! (_unur_isfinite(fx) && fx >= 0.)) { /* overflow */ _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"PDF(x) overflow"); return UNUR_ERR_GEN_DATA; } /* check for monotonicity */ if (_unur_FP_greater(fx,iv_old->fmax) || _unur_FP_less(fx,iv_old->fmin)) { _unur_error(gen->genid,UNUR_ERR_GEN_DATA,"PDF not monotone in slope"); return UNUR_ERR_GEN_DATA; } /* store areas of old interval */ A_hat_old = iv_old->Ahat; A_squ_old = iv_old->Asqueeze; /* check if the new interval is completely outside the support of PDF */ if (fx <= 0.) { /* check montonicity */ if (iv_old->fmin > 0.) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"PDF not monotone in slope"); return UNUR_ERR_GEN_CONDITION; } /* chop off part out of support */ iv_old->xmin = x; /* compute new area in interval */ iv_old->Ahat = fabs(iv_old->xmax - iv_old->xmin) * iv_old->fmax; /* iv_old->Asqueeze remains 0 */ /* update total area */ GEN->Atotal += iv_old->Ahat - A_hat_old; /* GEN->Asqueeze remains unchanged */ /* check result */ if (!_unur_isfinite(GEN->Atotal)) { /* we have decreased the hat, thus ... */ _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); return UNUR_ERR_INF; } /* interval chopped but not split */ return UNUR_ERR_SILENT; } /* we need a new interval */ iv_new = _unur_xmalloc(sizeof(struct unur_tabl_interval)); ++(GEN->n_ivs); COOKIE_SET(iv_new,CK_TABL_IV); /* iv_new SHOULD have the same slope as iv_old */ /* we have to distinguish between two cases: PDF is increasing (slope = +1) or PDF is decreasing (slope = -1). */ if (iv_old->xmax > iv_old->xmin) { /* increasing slope */ /* (x) The iv_new inherits the maximum of iv_old. iv_old keeps the minimum. (x) The splitting point is the minimum of iv_new and the maximum of iv_old. */ iv_new->xmax = iv_old->xmax; iv_new->fmax = iv_old->fmax; iv_old->xmax = iv_new->xmin = x; iv_old->fmax = iv_new->fmin = fx; } else { /* decreasing slope */ /* (x) The iv_new inherits the minimum of iv_old. iv_old keeps the maximum. (x) The splitting point is the maximum of iv_new and the minimum of iv_old. */ iv_new->xmin = iv_old->xmin; iv_new->fmin = iv_old->fmin; iv_old->xmin = iv_new->xmax = x; iv_old->fmin = iv_new->fmax = fx; } /* compute the areas in both intervals */ iv_new->Ahat = fabs(iv_new->xmax - iv_new->xmin) * iv_new->fmax; iv_new->Asqueeze = fabs(iv_new->xmax - iv_new->xmin) * iv_new->fmin; iv_old->Ahat = fabs(iv_old->xmax - iv_old->xmin) * iv_old->fmax; iv_old->Asqueeze = fabs(iv_old->xmax - iv_old->xmin) * iv_old->fmin; /* update total areas */ GEN->Atotal += iv_old->Ahat + iv_new->Ahat - A_hat_old; GEN->Asqueeze += iv_old->Asqueeze + iv_new->Asqueeze - A_squ_old; /* insert iv_new into linked list of intervals. iv_old is stored on the left hand side of iv_new. */ iv_new->next = iv_old->next; iv_old->next = iv_new; /* check result */ if (! (_unur_isfinite(GEN->Atotal) && _unur_isfinite(GEN->Asqueeze)) ) { _unur_error(gen->genid,UNUR_ERR_INF,"hat unbounded"); return UNUR_ERR_INF; } /* splitting successful */ return UNUR_SUCCESS; } /* end of _unur_tabl_split_interval() */ /*****************************************************************************/ int _unur_tabl_make_guide_table( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* make a guide table for indexed search */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* 1 (--> successful) */ /* */ /* error: */ /* return 0. */ /*----------------------------------------------------------------------*/ { struct unur_tabl_interval *iv; double Acum, Asqueezecum, Astep; int max_guide_size; int j; /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_TABL_GEN,UNUR_ERR_COOKIE); /* allocate blocks for guide table (if necessary). (we allocate blocks for maximal guide table.) */ if (!GEN->guide) { max_guide_size = (GEN->guide_factor > 0.) ? ((int)(GEN->max_ivs * GEN->guide_factor)) : 1; if (max_guide_size <= 0) max_guide_size = 1; /* protect against overflow */ GEN->guide = _unur_xmalloc( max_guide_size * sizeof(struct unur_tabl_interval*) ); } /* first we need the cumulated areas of rectangles */ Acum = 0.; /* area below hat */ Asqueezecum = 0.; /* area below squeeze */ for (iv = GEN->iv; iv != NULL; iv = iv->next ) { COOKIE_CHECK(iv,CK_TABL_IV,UNUR_ERR_COOKIE); Acum += iv->Ahat; Asqueezecum += iv->Asqueeze; iv->Acum = Acum; } /* total area below hat */ GEN->Atotal = Acum; GEN->Asqueeze = Asqueezecum; /* actual size of guide table */ GEN->guide_size = GEN->n_ivs; /* make table (use variant 2; see dis.c) */ Astep = GEN->Atotal / GEN->guide_size; Acum=0.; for( j=0, iv=GEN->iv; j < GEN->guide_size; j++ ) { COOKIE_CHECK(iv,CK_TABL_IV,UNUR_ERR_COOKIE); while( iv->Acum < Acum ) if( iv->next != NULL ) /* skip to next segment if it exists */ iv = iv->next; else { _unur_warning(gen->genid,UNUR_ERR_ROUNDOFF,"guide table"); break; } GEN->guide[j] = iv; Acum += Astep; } /* if there has been an round off error, we have to complete the guide table */ for( ; jguide_size ;j++ ) GEN->guide[j] = iv; /* check table */ if (! (_unur_isfinite(GEN->Atotal) && _unur_isfinite(GEN->Asqueeze) && GEN->Atotal > 0. && (!_unur_FP_less(GEN->Atotal,DISTR.area) || !(gen->distr->set & UNUR_DISTR_SET_PDFAREA)) ) ) { /* in this case the guide table is corrupted and completely worthless. */ /* this error is unlikely to happen. for this rare case the check is */ /* done at the end to have the table at least filled with numbers */ /* and thus avoid infinite loops in the sampling routines. */ _unur_warning(gen->genid,UNUR_ERR_GEN_DATA,"sum of areas not valid"); return UNUR_ERR_GEN_DATA; } /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_tabl_make_guide_table() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/empl_struct.h0000644001357500135600000000635114420304141014777 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: empl_struct.h * * * * PURPOSE: * * declares structures for method EMPL * * (EMPirical distribution with Linear interpolation) * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Information for constructing the generator */ struct unur_empl_par { /* the observed sample is stored in the distribution object */ int dummy; }; /*---------------------------------------------------------------------------*/ /* The generator object */ struct unur_empl_gen { double *observ; /* pointer to the array of the observations */ int n_observ; /* number of observations */ }; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/mvstd.h0000644001357500135600000001127214420445767013615 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: mvstd.h * * * * PURPOSE: * * function prototypes for method MVSTD * * (wrapper for special generators for * * MultiVariate continuous STandarD distributions) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2007 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /* =METHOD MVSTD MultiVariate continuous STandarD distributions =UP Methods_for_CVEC =REQUIRED standard distribution from UNU.RAN library (@pxref{Stddist,,Standard distributions}). =SPEED depends on distribution and generator =REINIT supported =DESCRIPTION MVSTD is a wrapper for special generators for multivariate continuous standard distributions. It only works for distributions in the UNU.RAN library of standard distributions (@pxref{Stddist,,Standard distributions}). If a distribution object is provided that is build from scratch, or if no special generator for the given standard distribution is provided, the NULL pointer is returned. =HOWTOUSE Create a distribution object for a standard distribution from the UNU.RAN library (@pxref{Stddist,,Standard distributions}). Sampling from truncated distributions (which can be constructed by changing the default domain of a distribution by means of unur_distr_cvec_set_domain_rect() call) is not possible. It is possible to change the parameters and the domain of the chosen distribution and run unur_reinit() to reinitialize the generator object. =END */ /*---------------------------------------------------------------------------*/ /* Routines for user interface */ /* =ROUTINES */ UNUR_PAR *unur_mvstd_new( const UNUR_DISTR *distribution ); /* Get default parameters for new generator. It requires a distribution object for a multivariate continuous distribution from the UNU.RAN library of standard distributions (@pxref{Stddist,,Standard distributions}). Using a truncated distribution is not possible. */ /* =END */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/hrb_struct.h0000644001357500135600000000640114420304141014611 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: hrb_struct.h * * * * PURPOSE: * * declares structures for method HRB * * (Hazard Rate Bounded) * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Information for constructing the generator */ struct unur_hrb_par { double upper_bound; /* upper bound for hazard rate */ }; /*---------------------------------------------------------------------------*/ /* The generator object */ struct unur_hrb_gen { double upper_bound; /* upper bound for hazard rate */ double left_border; /* left border of domain */ }; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/methods/dstd.h0000644001357500135600000002116114420445767013414 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: dstd.h * * * * PURPOSE: * * function prototypes for method DSTD * * (wrapper for special generators for * * Discrete STanDard distributions) * * * * USAGE: * * only included in unuran.h * * * ***************************************************************************** * * * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /* =METHOD DSTD Discrete STandarD distributions =UP Methods_for_DISCR =REQUIRED standard distribution from UNU.RAN library (@pxref{Stddist,,Standard distributions}) or discrete distribution with inverse CDF. =SPEED Set-up: fast, Sampling: depends on distribution and generator =REINIT supported =DESCRIPTION DSTD is a wrapper for special generators for discrete univariate standard distributions. It only works for distributions in the UNU.RAN library of standard distributions (@pxref{Stddist,,Standard distributions}) or for discrete distributions where the inverse CDF is given. If a distribution object is provided that is build from scratch, it must provide the inverse CDF. Then CSTD implements the inversion method. Otherwise, the NULL pointer is returned. For some distributions more than one special generator is possible. =HOWTOUSE Create a distribution object for a standard distribution from the UNU.RAN library (@pxref{Stddist,,Standard distributions}), or create a discrete distribution object and set the function for the inverse CDF using unur_distr_discr_set_invcdf(). For some distributions more than one special generator (@emph{variants}) is possible. These can be choosen by a unur_dstd_set_variant() call. For possible variants @xref{Stddist,,Standard distributions}. However the following are common to all distributions: @table @code @item UNUR_STDGEN_DEFAULT the default generator. @item UNUR_STDGEN_FAST the fastest available special generator. @item UNUR_STDGEN_INVERSION the inversion method (if available). @end table Notice that the variant @code{UNUR_STDGEN_FAST} for a special generator might be slower than one of the universal algorithms! Additional variants may exist for particular distributions. Sampling from truncated distributions (which can be constructed by changing the default domain of a distribution by means of unur_distr_discr_set_domain() or unur_dstd_chg_truncated calls) is possible but requires the inversion method. Moreover the CDF of the distribution must be implemented. It is possible to change the parameters and the domain of the chosen distribution and run unur_reinit() to reinitialize the generator object. =END */ /*---------------------------------------------------------------------------*/ /* Routines for user interface */ /* =ROUTINES */ UNUR_PAR *unur_dstd_new( const UNUR_DISTR *distribution ); /* Get default parameters for new generator. It requires a distribution object for a discrete univariant distribution from the UNU.RAN library of standard distributions (@pxref{Stddist,,Standard distributions}). Using a truncated distribution is allowed only if the inversion method is available and selected by the unur_dstd_set_variant() call immediately after creating the parameter object. Use a unur_distr_discr_set_domain() call to get a truncated distribution. */ /*...........................................................................*/ int unur_dstd_set_variant( UNUR_PAR *parameters, unsigned variant ); /* Set variant (special generator) for sampling from a given distribution. For possible variants @pxref{Stddist,,Standard distributions}. Common variants are @code{UNUR_STDGEN_DEFAULT} for the default generator, @code{UNUR_STDGEN_FAST} for (one of the) fastest implemented special generators, and @code{UNUR_STDGEN_INVERSION} for the inversion method (if available). If the selected variant number is not implemented, then an error code is returned and the variant is not changed. */ /*...........................................................................*/ int unur_dstd_chg_truncated( UNUR_GEN *generator, int left, int right ); /* Change left and right border of the domain of the (truncated) distribution. This is only possible if the inversion method is used. Otherwise this call has no effect and an error code is returned. Notice that the given truncated domain must be a subset of the domain of the given distribution. The generator always uses the intersection of the domain of the distribution and the truncated domain given by this call. It is not required to run unur_reinit() after this call has been used. @emph{Important:} If the CDF is (almost) the same for @var{left} and @var{right} and (almost) equal to @code{0} or @code{1}, then the truncated domain is not chanced and the call returns an error code. @emph{Notice:} If the parameters of the distribution has been changed it is recommended to set the truncated domain again, since the former call might change the domain of the distribution but not update the values for the boundaries of the truncated distribution. */ /* =END */ /*---------------------------------------------------------------------------*/ /* Yet not documented! */ int unur_dstd_eval_invcdf( const UNUR_GEN *generator, double u ); /* Evaluate inverse CDF at @var{u}. However, this requires that @var{generator} implements an inversion method. If @var{u} is out of the domain [0,1] then @code{unur_errno} is set to @code{UNUR_ERR_DOMAIN} and the respective bound of the domain of the distribution are returned (which is @code{INT_MIN} or @code{INT_MAX} in the case of unbounded domains). @emph{Notice}: When the domain has been truncated by a unur_dstd_chg_truncated() call then the inverse CDF of the truncated distribution is returned. */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/unuran_config.h0000644001357500135600000001761414420445767013660 00000000000000/***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * file: unuran_config.h * * * * compiler switches, compile time options and default values * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifndef UNURAN_CONFIG_H_SEEN #define UNURAN_CONFIG_H_SEEN /*---------------------------------------------------------------------------*/ /***************************************************************************** * Logging and debugging. * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Default name of log file. */ /* */ #define UNUR_LOG_FILE "unuran.log" /*---------------------------------------------------------------------------*/ /* Set default flag for debugging of generators: */ /* */ /* UNUR_DEBUG_OFF ... switch off debugging information */ /* UNUR_DEBUG_INIT ... pameters and structure of generator only */ /* UNUR_DEBUG_SETUP ... information for setup step */ /* UNUR_DEBUG_ADAPT ... trace adaptive steps */ /* UNUR_DEBUG_SAMPLE ... trace sampling */ /* UNUR_DEBUG_ALL ... write all available debugging information */ /* */ /* Detailed discription of possible flags in file `./utils/debug.h' */ /* */ /* Debugging information is written into the log file. */ /* It only works if the library is built with the ----enable-logging */ /* configure flag. */ #define UNUR_DEBUGFLAG_DEFAULT UNUR_DEBUG_INIT /***************************************************************************** * Compile time parameters for generators. * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Distribution objects. */ /* Maximal number of parameters for the PDF of a distribution. */ /* (It must be at least 5!) */ #define UNUR_DISTR_MAXPARAMS 5 /* Maximal size of automatically created probability vectors. */ #define UNUR_MAX_AUTO_PV 100000 /***************************************************************************** * Interface for uniform random number generators. * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Default generators */ /* Macros 'UNUR_URNG_DEFAULT' and 'UNUR_URNG_AUX_DEFAULT' must expand to */ /* (a function returning) an object of type UNUR_URNG. */ /* */ /* IMPORTANT! */ /* */ /* When a particular default is chosen then the corresponding library must */ /* be installed and the wrapper functions must be enabled by defining the */ /* above macros. Moreover, the library must linked when creating an */ /* executable. */ /* */ /* If you have none of these libraries use type FVOID. */ /* */ /* The following is switched on by the configure flag */ /* --with-urng-default=rngstream */ #ifdef UNUR_URNG_DEFAULT_RNGSTREAM /* use type RNGSTREAM (recommended!) */ # define UNUR_URNG_DEFAULT (unur_urng_rngstream_new("URNG_main")) # define UNUR_URNG_AUX_DEFAULT (unur_urng_rngstream_new("URNG_aux")) /* else we assume that we have */ /* --with-urng-default=builtin */ #else /* use type FVOID (built-in) */ # define UNUR_URNG_DEFAULT (unur_urng_builtin()) # define UNUR_URNG_AUX_DEFAULT (unur_urng_builtin_aux()) #endif /* However, it is also possible to use any other URNG. */ /* Then one must comment out the above #definitions (and thus disables the */ /* the corresponding configure flags) and #defines new ones. */ /* Here are two examples: */ /* use type PRNG */ /* #define UNUR_URNG_DEFAULT (unur_urng_prng_new("mt19937(19863)")) */ /* #define UNUR_URNG_AUX_DEFAULT (unur_urng_prng_new("LCG(2147483647,16807,0,1)")) */ /* use type GSL */ /* #define UNUR_URNG_DEFAULT (unur_urng_gsl_new(gsl_rng_mt19937)) */ /* #define UNUR_URNG_AUX_DEFAULT (unur_urng_gsl_new(gsl_rng_cmrg)) */ /*---------------------------------------------------------------------------*/ #endif /* UNURAN_CONFIG_H_SEEN */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/README0000644001357500135600000000517614420445767011532 00000000000000Naming conventions: *.c ... C source files *.ch ... C source files #include'd in a *.c file *.h ... header file *_source.h ... header file only used for compiling library *_struct.h ... header file for structure defintions (only used for compiling library) unur_*.h ... header files that are protected against multiple inclusion unuran*.h ... header files to be installed -------------------------------------------------- ./: README ... this file unuran.h ... main header file for UNU.RAN unuran.h.in ... same as unuran.h but #include's are not expanded unuran_config.h ... configuration file for library unur_source.h ... main header file for compiling library (included in all sources!) unur_cookies.h ... definition of magic cookies unur_typedefs.h ... declaration of all objects used by UNU.RAN methods/ ... sources of methods distr/ ... sources for generic distributions distributions/ ... sources for standard distributions and special generators utils/ ... sources for utilities tests/ ... sources for various tests uniform/ ... sources for simple uniform RNGs and wrapper for external RNGs urng/ ... sources for interface to uniform RNGs -------------------------------------------------- ./utils/: debug.c ... debuging routines debug.h debug_source.h error.c ... warnings and error messages error.h error_source.h unur_errno.h stream.c ... output streams stream.h stream_source.h slist.c ... handle simple lists slist.h slist_struct.h umalloc.c ... allocate memory umalloc_source.h umath.c ... mathematics umath.h umath_source.h unur_math_source.h unur_fp_source.h floating point arithmetic unur_fp_const_source.h -------------------------------------------------- ./methods/: unur_methods_source.h ... id's for methods x_gen.c ... handle generator objects -------------------------------------------------- ./distr/: -------------------------------------------------- ./distributions/: unur_distributions.h ... header file for standard distribution unur_stddistr.h ... id's for standard distributions -------------------------------------------------- ./tests/: unuran_tests.h ... header file for test routines chi2test.c ... chi^2 test for goodness of fit counturn.c ... count used uniform random numbers printsample.c ... print a small sample into logfile timing.c ... measure setup time and marginal generation time tests.c ... interface to start these tests -------------------------------------------------- ./uniform/: unuran-1.11.0/src/unur_typedefs.h0000644001357500135600000001247514420445767013717 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: unur_typedefs.h * * * * PURPOSE: * * typedefs and names of globally used structures * * (not already defined in unuran_config.h) * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifndef UNUR_TYPEDEFS_H_SEEN #define UNUR_TYPEDEFS_H_SEEN /*---------------------------------------------------------------------------*/ /* UNURAN objects */ struct unur_distr; /* distribution object */ typedef struct unur_distr UNUR_DISTR; struct unur_par; /* parameters for generator */ typedef struct unur_par UNUR_PAR; struct unur_gen; /* generator object */ typedef struct unur_gen UNUR_GEN; struct unur_urng; /* uniform random number generator */ typedef struct unur_urng UNUR_URNG; /* comment out the following definition when type 'UNUR_URNG' is changed !! */ /* You have to define _unur_call_urng(urng) and _unur_call_reset(urng) */ /* in file 'src/urng/urng_source.h' then! */ #define UNUR_URNG_UNURAN 1 /*---------------------------------------------------------------------------*/ /* functions for continuous univariate PDF, CDF, and their derivatives */ typedef double UNUR_FUNCT_CONT (double x, const struct unur_distr *distr); typedef double UNUR_FUNCT_DISCR (int x, const struct unur_distr *distr); typedef int UNUR_IFUNCT_DISCR(double x, const struct unur_distr *distr); /*---------------------------------------------------------------------------*/ /* functions for continuous multivariate PDF, CDF, and their gradients */ /* Remark: we cannot use a const pointer to distr as some data are */ /* computed "on the fly" when they are needed and stored in the */ /* distribution object. */ typedef double UNUR_FUNCT_CVEC (const double *x, struct unur_distr *distr); typedef int UNUR_VFUNCT_CVEC(double *result, const double *x, struct unur_distr *distr); typedef double UNUR_FUNCTD_CVEC(const double *x, int coord, struct unur_distr *distr); /*---------------------------------------------------------------------------*/ /* structures for auxiliary tools */ struct unur_slist; /* structure for simple list */ /*---------------------------------------------------------------------------*/ /* error handler */ typedef void UNUR_ERROR_HANDLER( const char *objid, const char *file, int line, const char *errortype, int unur_errno, const char *reason ); /*---------------------------------------------------------------------------*/ #endif /* UNUR_TYPEDEFS_H_SEEN */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/0000755001357500135600000000000014430713512013606 500000000000000unuran-1.11.0/src/distributions/c_lognormal.c0000644001357500135600000002350414420445767016207 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: c_lognormal.c * * * * REFERENCES: * * * * [2] N.L. Johnson, S. Kotz and N. Balakrishnan * * Continuous Univariate Distributions, * * Volume 1, 2nd edition * * John Wiley & Sons, Inc., New York, 1994 * * * ***************************************************************************** * * * distr: Lognormal distribution [2; ch.14, p.207] * * * * pdf: f(x) = 1/(x-theta) * exp( -(log(x-theta)-zeta)^2/(2 sigma^2) )* * domain: x > theta * * constant: 1 / (sigma * sqrt(2*pi)) * * * * parameters: * * 0: zeta * * 1: sigma > 0 * * 2: theta ... location * * * ***************************************************************************** * * * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "unur_distributions.h" #include "unur_distributions_source.h" #include "unur_stddistr.h" /*---------------------------------------------------------------------------*/ static const char distr_name[] = "lognormal"; /* parameters */ #define zeta params[0] #define sigma params[1] #define theta params[2] #define DISTR distr->data.cont #define NORMCONSTANT (distr->data.cont.norm_constant) /* function prototypes */ static double _unur_pdf_lognormal( double x, const UNUR_DISTR *distr ); static double _unur_dpdf_lognormal( double x, const UNUR_DISTR *distr ); static double _unur_cdf_lognormal( double x, const UNUR_DISTR *distr ); static double _unur_invcdf_lognormal( double x, const UNUR_DISTR *distr ); static int _unur_upd_mode_lognormal( UNUR_DISTR *distr ); static int _unur_set_params_lognormal( UNUR_DISTR *distr, const double *params, int n_params ); /*---------------------------------------------------------------------------*/ double _unur_pdf_lognormal( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; register double z; if (x <= theta) return 0.; z = log(x-theta)-zeta; return ( 1./(x-theta) * exp( -z*z/(2.*sigma*sigma) ) / NORMCONSTANT ); } /* end of _unur_pdf_lognormal() */ /*---------------------------------------------------------------------------*/ double _unur_dpdf_lognormal( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; register double z, sigmasqu; if (x <= theta) return 0.; z = log(x-theta)-zeta; sigmasqu = sigma * sigma; return ( 1/((x-theta)*(x-theta)) * exp( -z*z/(2*sigmasqu) ) * (1.+z/sigmasqu) / NORMCONSTANT ); } /* end of _unur_dpdf_lognormal() */ /*---------------------------------------------------------------------------*/ double _unur_cdf_lognormal( double x, const UNUR_DISTR *distr ) { const double *params = DISTR.params; double z; if (x <= theta) return 0.; z = (log(x-theta)-zeta) / sigma; return _unur_SF_cdf_normal(z); } /* end of _unur_cdf_lognormal() */ /*---------------------------------------------------------------------------*/ double _unur_invcdf_lognormal( double x, const UNUR_DISTR *distr ) { const double *params = DISTR.params; return (theta + exp( _unur_SF_invcdf_normal(x) * sigma + zeta)); } /* end of _unur_invcdf_lognormal() */ /*---------------------------------------------------------------------------*/ int _unur_upd_mode_lognormal( UNUR_DISTR *distr ) { register const double *params = DISTR.params; DISTR.mode = exp(-sigma*sigma) * ( exp(zeta) + theta*exp(sigma*sigma) ); /* mode must be in domain */ if (DISTR.mode < DISTR.domain[0]) DISTR.mode = DISTR.domain[0]; else if (DISTR.mode > DISTR.domain[1]) DISTR.mode = DISTR.domain[1]; return UNUR_SUCCESS; } /* end of _unur_upd_mode_lognormal() */ /*---------------------------------------------------------------------------*/ int _unur_set_params_lognormal( UNUR_DISTR *distr, const double *params, int n_params ) { /* check number of parameters for distribution */ if (n_params < 2) { _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } if (n_params > 3) { _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); n_params = 3; } CHECK_NULL(params,UNUR_ERR_NULL); /* check parameter sigma */ if (sigma <= 0.) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"sigma <= 0"); return UNUR_ERR_DISTR_DOMAIN; } /* copy parameters for standard form */ DISTR.zeta = zeta; DISTR.sigma = sigma; /* default parameters */ DISTR.theta = 0.; /* default for theta */ /* copy optional parameters */ if (n_params == 3) DISTR.theta = theta; /* store total number of parameters */ DISTR.n_params = 3; /* set (standard) domain */ if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.domain[0] = DISTR.theta; /* left boundary */ DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ } return UNUR_SUCCESS; } /* end of _unur_set_params_lognormal() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_lognormal( const double *params, int n_params ) { register struct unur_distr *distr; /* get new (empty) distribution object */ distr = unur_distr_cont_new(); /* set distribution id */ distr->id = UNUR_DISTR_LOGNORMAL; /* name of distribution */ distr->name = distr_name; /* how to get special generators */ /* DISTR.init = _unur_stdgen_lognormal_init; */ /* functions */ DISTR.pdf = _unur_pdf_lognormal; /* pointer to PDF */ DISTR.dpdf = _unur_dpdf_lognormal; /* pointer to derivative of PDF */ DISTR.cdf = _unur_cdf_lognormal; /* pointer to CDF */ DISTR.invcdf = _unur_invcdf_lognormal; /* pointer to inverse CDF */ /* indicate which parameters are set */ distr->set = ( UNUR_DISTR_SET_DOMAIN | UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_MODE | UNUR_DISTR_SET_PDFAREA ); /* set parameters for distribution */ if (_unur_set_params_lognormal(distr,params,n_params)!=UNUR_SUCCESS) { free(distr); return NULL; } /* normalization constant */ NORMCONSTANT = DISTR.sigma * sqrt(2.*M_PI); /* mode and area below p.d.f. */ _unur_upd_mode_lognormal(distr); DISTR.area = 1.; /* function for setting parameters and updating domain */ DISTR.set_params = _unur_set_params_lognormal; /* function for updating derived parameters */ DISTR.upd_mode = _unur_upd_mode_lognormal; /* funct for computing mode */ /* DISTR.upd_area = _unur_upd_area_lognormal; funct for computing area */ /* return pointer to object */ return distr; } /* end of unur_distr_lognormal() */ /*---------------------------------------------------------------------------*/ #undef zeta #undef sigma #undef theta #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/c_chi_gen.c0000644001357500135600000002401614420445767015610 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: c_chi_gen.c * * * * Special generators for Chi distribution * * (Do not confuse with Chi^2 distribution!) * * * ***************************************************************************** * * * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "unur_distributions_source.h" /*---------------------------------------------------------------------------*/ /* init routines for special generators */ inline static int chi_chru_init( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* abbreviations */ #define PAR ((struct unur_cstd_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_cstd_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.cont /* data for distribution in generator object */ /* #define MAX_gen_params (4) maximal number of parameters for generator */ #define uniform() _unur_call_urng(gen->urng) /* call for uniform prng */ #define nu (DISTR.params[0]) /* shape (degrees of freedom) */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Inititialize **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ int _unur_stdgen_chi_init( struct unur_par *par, struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* initialize special generator for chi distribution */ /* if gen == NULL then only check existance of variant. */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* one of par and gen must not be the NULL pointer */ switch ((par) ? par->variant : gen->variant) { case 0: /* DEFAULT */ case 1: /* Ratio of Uniforms with shift */ { /* check parameters of distribution */ double d_nu = (par) ? par->distr->data.cont.params[0] : nu; if (d_nu < 1.) { _unur_error(NULL,UNUR_ERR_GEN_CONDITION,""); return UNUR_ERR_GEN_CONDITION; } } /* nu >= 1 !!!! */ _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_chi_chru ); return chi_chru_init( gen ); default: /* no such generator */ return UNUR_FAILURE; } } /* end of _unur_stdgen_chi_init() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Special generators **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ /***************************************************************************** * * * Chi Distribution: Ratio of Uniforms with shift * * * ***************************************************************************** * * * FUNCTION: - samples a random number from the Chi distribution with * * parameters nu >= 1. * * * * REFERENCE : - J.F. Monahan (1987): An algorithm for generating chi random * * variables, ACM Trans. Math. Software 13, 168-172. * * * * Implemented by R. Kremer, 1990 * ***************************************************************************** * WinRand (c) 1995 Ernst Stadlober, Institut fuer Statistitk, TU Graz * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #define GEN_N_PARAMS (4) #define b (GEN->gen_param[0]) #define vm (GEN->gen_param[1]) #define vp (GEN->gen_param[2]) #define vd (GEN->gen_param[3]) /*---------------------------------------------------------------------------*/ inline static int chi_chru_init( struct unur_gen *gen ) { /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_ERR_COOKIE); if (GEN->gen_param == NULL || GEN->n_gen_param != GEN_N_PARAMS) { GEN->n_gen_param = GEN_N_PARAMS; GEN->gen_param = _unur_xrealloc(GEN->gen_param, GEN->n_gen_param * sizeof(double)); } /* -X- setup code -X- */ if (nu < 1.) { _unur_error(NULL,UNUR_ERR_GEN_CONDITION,""); return UNUR_ERR_GEN_CONDITION; } if (_unur_isone(nu)) /* no setup step required */ return UNUR_SUCCESS; /* else nu > 1 */ b = sqrt(nu - 1.); vm = - 0.6065306597 * (1. - 0.25 / (b * b + 1.)); vm = (-b > vm) ? -b : vm; vp = 0.6065306597 * (0.7071067812 + b) / (0.5 + b); vd = vp - vm; /* -X- end of setup code -X- */ return UNUR_SUCCESS; } /* end of chi_chru_init() */ /*---------------------------------------------------------------------------*/ double _unur_stdgen_sample_chi_chru( struct unur_gen *gen ) { /* -X- generator code -X- */ double u,v,z,zz,r; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); if (_unur_isone(nu)) { while (1) { u = uniform(); v = uniform() * 0.857763884960707; z = v / u; if (z < 0) continue; zz = z * z; r = 2.5 - zz; if (z < 0.) r = r + zz * z / (3. * z); if (u < r * 0.3894003915) break; if (zz > (1.036961043 / u + 1.4)) continue; if (2 * log(u) < (- zz * 0.5 )) break; } } else { /* nu > 1 */ while (1) { u = uniform(); v = uniform() * vd + vm; z = v / u; if (z < -b) continue; zz = z * z; r = 2.5 - zz; if (z < 0.0) r = r + zz * z / (3.0 * (z + b)); if (u < r * 0.3894003915) { z += b; break; } if (zz > (1.036961043 / u + 1.4)) continue; if (2. * log(u) < (log(1.0 + z / b) * b * b - zz * 0.5 - z * b)) { z += b; break; } } } /* -X- end of generator code -X- */ return z; } /* end of _unur_stdgen_sample_chi_chru() */ /*---------------------------------------------------------------------------*/ #undef GEN_N_PARAMS #undef b #undef vm #undef vp #undef vd /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/vc_copula.c0000644001357500135600000001650114420445767015665 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: vc_copula.c * * * * REFERENCES: * * * ***************************************************************************** * * * distr: Copula * * * * domain: (0,1)^(dim) * * * * parameters: * * 0: rankcorr ... rank correlation matrix (identity matrix) * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include /* #include */ #include "unur_distributions.h" #include "unur_distributions_source.h" /* #include "unur_stddistr.h" */ /*---------------------------------------------------------------------------*/ static const char distr_name[] = "copula"; /*---------------------------------------------------------------------------*/ /* parameters */ /*---------------------------------------------------------------------------*/ #define DISTR distr->data.cvec /* #define LOGNORMCONSTANT (distr->data.cvec.norm_constant) */ /*---------------------------------------------------------------------------*/ /* function prototypes */ /* static double _unur_pdf_copula( const double *x, UNUR_DISTR *distr ); */ /* static double _unur_logpdf_copula( const double *x, UNUR_DISTR *distr ); */ /* static int _unur_dlogpdf_copula( double *result, const double *x, UNUR_DISTR *distr ); */ /** TODO: static int _unur_upd_mode_copula( UNUR_DISTR *distr ); static int _unur_upd_area_copula( UNUR_DISTR *distr ); **/ /*---------------------------------------------------------------------------*/ /* double */ /* _unur_pdf_copula( const double *x, UNUR_DISTR *distr ) */ /* { */ /* return 1; */ /* } /\* end of _unur_pdf_copula() *\/ */ /*---------------------------------------------------------------------------*/ /* int */ /* _unur_dpdf_copula( double *result, const double *x, UNUR_DISTR *distr ) */ /* { */ /* return UNUR_SUCCESS; */ /* } /\* end of _unur_dlogpdf_copula() *\/ */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Make distribution object **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_copula( int dim, const double *rankcorr ) /* @code{UNUR_DISTR *unur_distr_copula(int dim, const double *rankcorr)} creates a distribution object for a copula with @var{dim} components. @var{rankcorr} is an array of size @var{dim}x@var{dim} and holds the rank correlation matrix (Spearman's correlation), where the rows of the matrix are stored consecutively in this array. The NULL pointer can be used instead the identity matrix. If @var{covar} is not a valid rank correlation matrix (i.e., not positive definite) then no distribution object is created and NULL is returned. */ { struct unur_distr *distr; struct unur_distr *marginal; /* get new (empty) distribution object */ distr = unur_distr_cvec_new(dim); /* check new parameter for generator */ if (distr == NULL) { /* error: dim < 1 */ return NULL; } /* set distribution id */ distr->id = UNUR_DISTR_COPULA; /* name of distribution */ distr->name = distr_name; /* how to get special generators */ DISTR.init = NULL; /* copy (and check) parameters */ if ( unur_distr_cvec_set_rankcorr(distr,rankcorr)!=UNUR_SUCCESS ) { unur_distr_free( distr ); return NULL; } /* functions: none */ /* set marginal distributions */ marginal = unur_distr_uniform(NULL,0); unur_distr_cvec_set_marginals(distr,marginal); unur_distr_free(marginal); /* copy other parameters of distribution */ /* none */ /* number of other parameters */ /* DISTR.n_params = 0; ... default */ /* domain */ /* normalization constant */ /* mode */ /* volume below p.d.f. */ /* indicate which parameters are set (additional to mean and covariance) */ distr->set |= ( 0 ); /* return pointer to object */ return distr; } /* end of unur_distr_copula() */ /*---------------------------------------------------------------------------*/ #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/c_pareto.c0000644001357500135600000002354614420445767015515 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: c_pareto.c * * * * REFERENCES: * * * * [2] N.L. Johnson, S. Kotz and N. Balakrishnan * * Continuous Univariate Distributions, * * Volume 1, 2nd edition * * John Wiley & Sons, Inc., New York, 1994 * * * ***************************************************************************** * * * distr: Pareto distribution (of first kind) [2; ch.20, p.574] * * * * pdf: f(x) = x^(-(a+1)) * * domain: x >= k * * constant: a * k^a * * * * parameters: * * 0: k > 0 ... location, shape * * 1: a > 0 ... shape * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "unur_distributions.h" #include "unur_distributions_source.h" #include "unur_stddistr.h" /*---------------------------------------------------------------------------*/ static const char distr_name[] = "pareto"; /* parameters */ #define k params[0] #define a params[1] #define DISTR distr->data.cont /* #define NORMCONSTANT (distr->data.cont.norm_constant) */ /* function prototypes */ static double _unur_pdf_pareto( double x, const UNUR_DISTR *distr ); static double _unur_dpdf_pareto( double x, const UNUR_DISTR *distr ); static double _unur_cdf_pareto( double x, const UNUR_DISTR *distr ); static double _unur_invcdf_pareto( double u, const UNUR_DISTR *distr ); static int _unur_upd_mode_pareto( UNUR_DISTR *distr ); static int _unur_upd_area_pareto( UNUR_DISTR *distr ); static int _unur_set_params_pareto( UNUR_DISTR *distr, const double *params, int n_params ); /*---------------------------------------------------------------------------*/ double _unur_pdf_pareto( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; if (x DISTR.domain[1]) DISTR.mode = DISTR.domain[1]; return UNUR_SUCCESS; } /* end of _unur_upd_mode_pareto() */ /*---------------------------------------------------------------------------*/ int _unur_upd_area_pareto( UNUR_DISTR *distr ) { /* normalization constant: none */ if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.area = 1.; return UNUR_SUCCESS; } /* else */ DISTR.area = ( _unur_cdf_pareto( DISTR.domain[1],distr) - _unur_cdf_pareto( DISTR.domain[0],distr) ); return UNUR_SUCCESS; } /* end of _unur_upd_area_pareto() */ /*---------------------------------------------------------------------------*/ int _unur_set_params_pareto( UNUR_DISTR *distr, const double *params, int n_params ) { /* check number of parameters for distribution */ /* check new parameter for generator */ if (n_params < 2) { _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } if (n_params > 2) { _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); n_params = 2; } CHECK_NULL(params,UNUR_ERR_NULL); /* check parameter k */ if (k <= 0.) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"k <= 0"); return UNUR_ERR_DISTR_DOMAIN; } /* check parameter a */ if (a <= 0.) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"a <= 0"); return UNUR_ERR_DISTR_DOMAIN; } /* copy parameters for standard form */ DISTR.k = k; DISTR.a = a; /* default parameters: none */ /* copy optional parameters: none */ /* store number of parameters */ DISTR.n_params = n_params; /* set (standard) domain */ if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.domain[0] = DISTR.k; /* left boundary */ DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ } return UNUR_SUCCESS; } /* end of _unur_set_params_pareto() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_pareto( const double *params, int n_params ) { register struct unur_distr *distr; /* get new (empty) distribution object */ distr = unur_distr_cont_new(); /* set distribution id */ distr->id = UNUR_DISTR_PARETO; /* name of distribution */ distr->name = distr_name; /* how to get special generators */ /* DISTR.init = _unur_stdgen_pareto_init; */ /* functions */ DISTR.pdf = _unur_pdf_pareto; /* pointer to PDF */ DISTR.dpdf = _unur_dpdf_pareto; /* pointer to derivative of PDF */ DISTR.cdf = _unur_cdf_pareto; /* pointer to CDF */ DISTR.invcdf = _unur_invcdf_pareto; /* pointer to inverse CDF */ /* indicate which parameters are set */ distr->set = ( UNUR_DISTR_SET_DOMAIN | UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_MODE | UNUR_DISTR_SET_PDFAREA ); /* set parameters for distribution */ if (_unur_set_params_pareto(distr,params,n_params)!=UNUR_SUCCESS) { free(distr); return NULL; } /* normalization constant: none */ /* mode and area below p.d.f. */ DISTR.mode = DISTR.k; DISTR.area = 1.; /* function for setting parameters and updating domain */ DISTR.set_params = _unur_set_params_pareto; /* function for updating derived parameters */ DISTR.upd_mode = _unur_upd_mode_pareto; /* funct for computing mode */ DISTR.upd_area = _unur_upd_area_pareto; /* funct for computing area */ /* return pointer to object */ return distr; } /* end of unur_distr_pareto() */ /*---------------------------------------------------------------------------*/ #undef k #undef a #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/c_laplace.c0000644001357500135600000003027314420445767015617 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: c_laplace.c * * * * REFERENCES: * * * * [3] N.L. Johnson, S. Kotz and N. Balakrishnan * * Continuous Univariate Distributions, * * Volume 2, 2nd edition * * John Wiley & Sons, Inc., New York, 1995 * * * ***************************************************************************** * * * Laplace distribution [3; ch.24, p.164] * * * * pdf: f(x) = exp(- abs(x-theta) / phi ) * * domain: -infinity < x < infinity * * constant: 1 / (2 * phi) * * * * parameters: * * 0: theta ... location * * 1: phi > 0 ... scale * * * ***************************************************************************** * * * standard form * * * * pdf: f(x) = exp(- abs(x)) * * domain: -infinity < x < infinity * * constant: 2 * * * * parameters: none * * * * 0: theta = 0 ... location * * 1: phi = 1 ... scale * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "unur_distributions.h" #include "unur_distributions_source.h" #include "unur_stddistr.h" /*---------------------------------------------------------------------------*/ static const char distr_name[] = "laplace"; /* parameters */ #define theta params[0] #define phi params[1] #define DISTR distr->data.cont /* #define NORMCONSTANT (distr->data.cont.norm_constant) */ /* function prototypes */ static double _unur_pdf_laplace( double x, const UNUR_DISTR *distr ); static double _unur_dpdf_laplace( double x, const UNUR_DISTR *distr ); static double _unur_cdf_laplace( double x, const UNUR_DISTR *distr ); static double _unur_invcdf_laplace( double u, const UNUR_DISTR *distr ); static double _unur_logpdf_laplace( double x, const UNUR_DISTR *distr ); static double _unur_dlogpdf_laplace( double x, const UNUR_DISTR *distr ); static int _unur_upd_mode_laplace( UNUR_DISTR *distr ); static int _unur_upd_area_laplace( UNUR_DISTR *distr ); static int _unur_set_params_laplace( UNUR_DISTR *distr, const double *params, int n_params ); /*---------------------------------------------------------------------------*/ double _unur_pdf_laplace( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; if (xtheta) ? (x-theta)/phi : (theta-x)/phi; if (_unur_iszero(z)) /* derivative is not defined, but ... */ return 0.; /* a tangent parallel to x-axis is possible. */ return ( ((x>theta) ? -exp(-z)/phi : exp(-z)/phi) / (2.*phi) ); } /* end of unur_dpdf_laplace() */ /*---------------------------------------------------------------------------*/ double _unur_dlogpdf_laplace( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; return ( (xtheta) ? 1.-0.5 * exp(-z) : 0.5*exp(z) ); } /* end of _unur_cdf_laplace() */ /*---------------------------------------------------------------------------*/ double _unur_invcdf_laplace( double U, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; double X; U *= 2.; X = (U>1.) ? -log(2.-U) : log(U); return ((DISTR.n_params==0) ? X : theta + phi * X ); } /* end of _unur_invcdf_laplace() */ /*---------------------------------------------------------------------------*/ int _unur_upd_mode_laplace( UNUR_DISTR *distr ) { DISTR.mode = DISTR.theta; /* mode must be in domain */ if (DISTR.mode < DISTR.domain[0]) DISTR.mode = DISTR.domain[0]; else if (DISTR.mode > DISTR.domain[1]) DISTR.mode = DISTR.domain[1]; return UNUR_SUCCESS; } /* end of _unur_upd_mode_laplace() */ /*---------------------------------------------------------------------------*/ int _unur_upd_area_laplace( UNUR_DISTR *distr ) { /* normalization constant: none */ if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.area = 1.; return UNUR_SUCCESS; } /* else */ DISTR.area = ( _unur_cdf_laplace( DISTR.domain[1],distr) - _unur_cdf_laplace( DISTR.domain[0],distr) ); return UNUR_SUCCESS; } /* end of _unur_upd_area_laplace() */ /*---------------------------------------------------------------------------*/ int _unur_set_params_laplace( UNUR_DISTR *distr, const double *params, int n_params ) { /* check number of parameters for distribution */ if (n_params < 0) n_params = 0; if (n_params > 2) { _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); n_params = 2; } if (n_params > 0) CHECK_NULL(params,UNUR_ERR_NULL); /* check parameter phi */ if (n_params == 2 && phi <= 0.) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"phi <= 0"); return UNUR_ERR_DISTR_DOMAIN; } /* copy parameters for standard form: none */ /* default parameters */ DISTR.theta = 0.; DISTR.phi = 1.; /* copy optional parameters */ switch (n_params) { case 2: DISTR.phi = phi; /* FALLTHROUGH */ case 1: DISTR.theta = theta; /* FALLTHROUGH */ default: n_params = 2; /* number of parameters for non-standard form */ } /* store number of parameters */ DISTR.n_params = n_params; /* set (standard) domain */ if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.domain[0] = -UNUR_INFINITY; /* left boundary */ DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ } return UNUR_SUCCESS; } /* end of _unur_set_params_laplace() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_laplace( const double *params, int n_params ) { register struct unur_distr *distr; /* get new (empty) distribution object */ distr = unur_distr_cont_new(); /* set distribution id */ distr->id = UNUR_DISTR_LAPLACE; /* name of distribution */ distr->name = distr_name; /* how to get special generators */ /* DISTR.init = _unur_stdgen_laplace_init; */ /* functions */ DISTR.pdf = _unur_pdf_laplace; /* pointer to PDF */ DISTR.logpdf = _unur_logpdf_laplace; /* pointer to logPDF */ DISTR.dpdf = _unur_dpdf_laplace; /* pointer to derivative of PDF */ DISTR.dlogpdf = _unur_dlogpdf_laplace; /* pointer to deriv. of logPDF */ DISTR.cdf = _unur_cdf_laplace; /* pointer to CDF */ DISTR.invcdf = _unur_invcdf_laplace; /* pointer to inverse CDF */ /* indicate which parameters are set */ distr->set = ( UNUR_DISTR_SET_DOMAIN | UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_PDFAREA | UNUR_DISTR_SET_MODE ); /* set parameters for distribution */ if (_unur_set_params_laplace(distr,params,n_params)!=UNUR_SUCCESS) { free(distr); return NULL; } /* normalization constant: none */ /* mode and area below p.d.f. */ DISTR.mode = DISTR.theta; DISTR.area = 1.; /* function for setting parameters and updating domain */ DISTR.set_params = _unur_set_params_laplace; /* function for updating derived parameters */ DISTR.upd_mode = _unur_upd_mode_laplace; /* funct for computing mode */ DISTR.upd_area = _unur_upd_area_laplace; /* funct for computing area */ /* return pointer to object */ return distr; } /* end of unur_distr_laplace() */ /*---------------------------------------------------------------------------*/ #undef theta #undef phi #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/c_gig_gen.c0000644001357500135600000003034614420445767015616 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: c_gig_gen.c * * * * Special generators for GIG distribution * * * ***************************************************************************** * * * Copyright (c) 2000-2011 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "unur_distributions_source.h" /*---------------------------------------------------------------------------*/ /* init routines for special generators */ inline static int gig_gigru_init( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* abbreviations */ #define PAR ((struct unur_cstd_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_cstd_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.cont /* data for distribution in generator object */ #define uniform() _unur_call_urng(gen->urng) /* call for uniform prng */ /* #define MAX_gen_params (10) maximal number of parameters for generator */ #define theta (DISTR.params[0]) /* shape */ #define omega (DISTR.params[1]) /* scale */ #define eta (DISTR.params[2]) /* shape */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Inititialize **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ int _unur_stdgen_gig_init( struct unur_par *par, struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* initialize special generator for gig distribution */ /* if gen == NULL then only check existance of variant. */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* one of par and gen must not be the NULL pointer */ switch ((par) ? par->variant : gen->variant) { case 0: /* DEFAULT */ case 1: /* Ratio of Uniforms */ if (par!=NULL && par->distr->data.cont.params[0] <= 0.) { /* theta <= 0 */ _unur_error(NULL,UNUR_ERR_GEN_CONDITION,""); return UNUR_ERR_GEN_CONDITION; } /* theta > 0 ! */ _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_gig_gigru ); return gig_gigru_init( gen ); default: /* no such generator */ return UNUR_FAILURE; } } /* end of _unur_stdgen_gig_init() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Special generators **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ /***************************************************************************** * * * Generalized Inverse Gaussian (GIG) Distribution: Ratio of Uniforms * * * ***************************************************************************** * * * FUNCTION: - samples a random number from the reparameterized * * Generalized Inverse Gaussian distribution with parameters * * theta > 0 and omega > 0 using Ratio of Uniforms method * * without shift for theta <= 1 and omega <= 1 and shift at * * mode m otherwise. * * * * REFERENCE: - J.S. Dagpunar (1989): An easily implemented generalized * * inverse Gaussian generator, * * Commun. Statist. Simul. 18(2), 703-710. * * * * Implemented by R. Kremer, 1990 * * Revised by F. Niederl, August 1992 * ***************************************************************************** * WinRand (c) 1995 Ernst Stadlober, Institut fuer Statistitk, TU Graz * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #define GEN_N_PARAMS (10) #define m (GEN->gen_param[0]) #define linvmax (GEN->gen_param[1]) #define vminus (GEN->gen_param[2]) #define vdiff (GEN->gen_param[3]) #define b2 (GEN->gen_param[4]) #define hm12 (GEN->gen_param[5]) #define a (GEN->gen_param[6]) #define d (GEN->gen_param[7]) #define e (GEN->gen_param[8]) #define c (GEN->gen_param[9]) /*---------------------------------------------------------------------------*/ static const double drittel = 0.3333333333333333; /* 1/3 */ static const double pdrittel = 0.037037037037037; /* 1/27 */ /*---------------------------------------------------------------------------*/ inline static int gig_gigru_init( struct unur_gen *gen ) { double r,s,t,p,q,xeta,fi,fak,yy1,yy2,max,invy1,invy2,vplus,hm1,xm,ym; /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_ERR_COOKIE); if (GEN->gen_param == NULL || GEN->n_gen_param != GEN_N_PARAMS) { GEN->n_gen_param = GEN_N_PARAMS; GEN->gen_param = _unur_xrealloc(GEN->gen_param, GEN->n_gen_param * sizeof(double)); } /* -X- setup code -X- */ if (theta <= 0) { _unur_error(NULL,UNUR_ERR_GEN_CONDITION,""); return UNUR_ERR_GEN_CONDITION; } if (theta<=1. && omega<=1.) { /* NO SHIFT m */ e = omega * omega; d = theta + 1.; ym = (-d + sqrt(d*d + e))/omega; d = theta - 1.; xm = (d + sqrt(d*d + e))/omega; d = 0.5 * d; e = -0.25 * omega; r = xm + 1./xm; s = xm*ym; /* a = vplus/uplus */ a = exp(-0.5*theta*log(s) + 0.5*log(xm/ym) - e*(r - ym - 1.0/ym)); /* c = 1/log{sqrt[hx(xm)]} */ c = -d * log(xm) - e * r; /* vminus = 0 */ /* initialize remaining (unused) variables */ hm12 = b2 = vdiff = vminus = linvmax = m = 0.; } else { /* SHIFT BY m */ hm1 = theta - 1.; hm12 = hm1 * 0.5; b2 = omega * 0.25; m = (hm1 + sqrt(hm1*hm1 + omega*omega))/omega; /* Modus */ max = exp(hm12 * log(m) - b2 * (m + (1./m))); /* sqrt[hx(m)] */ linvmax = log(1.0/max); /* Find the points x1,x2 (-->invy1,invy2) where the hat function touches the density f(x) */ r = (6.*m + 2.*theta*m - omega*m*m + omega)/(4.*m*m); s = (1. + theta - omega*m)/(2.*m*m); t = omega/(-4.*m*m); p = (3.*s - r*r) * drittel; q = (2.*r*r*r) * pdrittel - (r*s) * drittel + t; xeta = sqrt(-(p*p*p)*pdrittel); fi = acos(-q/(2.*xeta)); fak = 2.*exp(log(xeta)*drittel); yy1 = fak * cos(fi*drittel) - r*drittel; yy2 = fak * cos(fi*drittel + 2.*drittel*M_PI) - r*drittel; invy1 = 1./yy1; invy2 = 1./yy2; vplus = exp(linvmax + log(invy1) + hm12*log(invy1 + m) - b2*(invy1 + m + 1./(invy1 + m))); vminus = -exp(linvmax + log(-invy2) + hm12 * log(invy2 + m) - b2*(invy2 + m + 1./(invy2 + m))); vdiff = vplus - vminus; /* uplus = 1 */ /* initialize remaining (unused) variables */ c = e = d = a = 0.; } /* -X- end of setup code -X- */ return UNUR_SUCCESS; } /* end of gig_gigru_init() */ double _unur_stdgen_sample_gig_gigru( struct unur_gen *gen ) { double U,V,X,Z; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); /* -X- generator code -X- */ if (theta<=1. && omega<=1.) { /* NO SHIFT m */ do { U = uniform(); /* U(0,1) */ V = uniform(); /* U(0,1) */ X = a*(V/U); } /* Acceptance/Rejection */ while (((log(U)) > (d*log(X) + e*(X + 1./X) + c))); } else { /* SHIFT BY m */ do { do { U = uniform(); /* U(0,1) */ V = vminus + uniform() * vdiff; /* U(v-,v+) */ Z = V/U; } while (Z < (-m)); X = Z + m; } /* Acceptance/Rejection */ while ((log(U) > (linvmax + hm12 * log(X) - b2 * (X + 1./X)))); } /* -X- end of generator code -X- */ return ((DISTR.n_params==2) ? X : eta * X ); } /* end of _unur_stdgen_sample_gig_gigru() */ /*---------------------------------------------------------------------------*/ #undef GEN_N_PARAMS #undef m #undef linvmax #undef vminus #undef vdiff #undef b2 #undef hm12 #undef a #undef d #undef e #undef c /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/c_extremeI.c0000644001357500135600000003007114420445767015774 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: c_extremeI.c * * * * REFERENCES: * * * * [3] N.L. Johnson, S. Kotz and N. Balakrishnan * * Continuous Univariate Distributions, * * Volume 2, 2nd edition * * John Wiley & Sons, Inc., New York, 1995 * * * ***************************************************************************** * * * distr: Extreme value type I distribution [3; ch.22, p.2] * * (also Gumbel-type distribution) * * * * * * Type I (also Gumbel-type distribution) * * * * cdf: F(x) = exp( -exp( -(x-zeta)/theta ) ) * * pdf: f(x) = exp( -exp( -(x-zeta)/theta ) - (x-zeta)/theta ) * * domain: -infinity < x 0 (1) ... scale * * * *...........................................................................* * * * Standard Form: * * * * cdf: F(x) = exp( -exp(-x) ) * * pdf: f(x) = exp( -exp(-x) - x ) * * domain: -infinity < x #include #include #include "unur_distributions.h" #include "unur_distributions_source.h" #include "unur_stddistr.h" /*---------------------------------------------------------------------------*/ static const char distr_name[] = "extremeI"; /* parameters */ #define zeta params[0] /* location */ #define theta params[1] /* scale */ #define DISTR distr->data.cont #define LOGNORMCONSTANT (distr->data.cont.norm_constant) /* function prototypes */ static double _unur_pdf_extremeI( double x, const UNUR_DISTR *distr ); static double _unur_dpdf_extremeI( double x, const UNUR_DISTR *distr ); static double _unur_cdf_extremeI( double x, const UNUR_DISTR *distr ); static double _unur_invcdf_extremeI( double u, const UNUR_DISTR *distr ); static int _unur_upd_mode_extremeI( UNUR_DISTR *distr ); static int _unur_upd_area_extremeI( UNUR_DISTR *distr ); static int _unur_set_params_extremeI( UNUR_DISTR *distr, const double *params, int n_params ); /*---------------------------------------------------------------------------*/ double _unur_pdf_extremeI( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; if (DISTR.n_params > 0) /* standardize */ x = (x - zeta) / theta; /* standard form */ return ( exp( -exp(-x) - x - LOGNORMCONSTANT) ); } /* end of _unur_pdf_extremeI() */ /*---------------------------------------------------------------------------*/ double _unur_dpdf_extremeI( double x, const UNUR_DISTR *distr ) { register double factor = 1.; register double expx; register const double *params = DISTR.params; if (DISTR.n_params > 0) { /* standardize */ factor = 1. / (theta * theta); x = (x - zeta) / theta; } /* standard form */ expx = exp(-x); return ( exp( -expx - x ) * (expx - 1.) * factor ); } /* end of unur_dpdf_extremeI() */ /*---------------------------------------------------------------------------*/ double _unur_cdf_extremeI( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; if (DISTR.n_params > 0) /* standardize */ x = (x - zeta) / theta; /* standard form */ return exp( -exp( -x) ); } /* end of _unur_cdf_extremeI() */ /*---------------------------------------------------------------------------*/ double _unur_invcdf_extremeI( double U, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; double X; X = -log( -log(U) ); return ((DISTR.n_params==0) ? X : zeta + theta * X ); } /* end of _unur_invcdf_extremeI() */ /*---------------------------------------------------------------------------*/ int _unur_upd_mode_extremeI( UNUR_DISTR *distr ) { DISTR.mode = DISTR.zeta; /* mode must be in domain */ if (DISTR.mode < DISTR.domain[0]) DISTR.mode = DISTR.domain[0]; else if (DISTR.mode > DISTR.domain[1]) DISTR.mode = DISTR.domain[1]; return UNUR_SUCCESS; } /* end of _unur_upd_mode_extremeI() */ /*---------------------------------------------------------------------------*/ int _unur_upd_area_extremeI( UNUR_DISTR *distr ) { /* log of normalization constant */ LOGNORMCONSTANT = log(DISTR.theta); if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.area = 1.; return UNUR_SUCCESS; } /* else */ DISTR.area = ( _unur_cdf_extremeI( DISTR.domain[1],distr) - _unur_cdf_extremeI( DISTR.domain[0],distr) ); return UNUR_SUCCESS; } /* end of _unur_upd_area_extremeI() */ /*---------------------------------------------------------------------------*/ int _unur_set_params_extremeI( UNUR_DISTR *distr, const double *params, int n_params ) { /* check number of parameters for distribution */ if (n_params < 0) n_params = 0; if (n_params > 2) { _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); n_params = 2; } if (n_params > 0) CHECK_NULL(params,UNUR_ERR_NULL); /* check parameter theta */ if (n_params == 2 && theta <= 0.) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"theta <= 0"); return UNUR_ERR_DISTR_DOMAIN; } /* copy parameters for standard form: none */ /* default parameters */ DISTR.zeta = 0.; DISTR.theta = 1.; /* copy optional parameters */ switch (n_params) { case 2: DISTR.theta = theta; /* FALLTHROUGH */ case 1: DISTR.zeta = zeta; n_params = 2; /* number of parameters for non-standard form */ /* FALLTHROUGH */ default: break; } /* store number of parameters */ DISTR.n_params = n_params; /* set (standard) domain */ if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.domain[0] = -UNUR_INFINITY; /* left boundary */ DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ } return UNUR_SUCCESS; } /* end of _unur_set_params_extremeI() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_extremeI( const double *params, int n_params ) { register struct unur_distr *distr; /* get new (empty) distribution object */ distr = unur_distr_cont_new(); /* set distribution id */ distr->id = UNUR_DISTR_EXTREME_I; /* name of distribution */ distr->name = distr_name; /* how to get special generators */ /* DISTR.init = _unur_stdgen_extremeI_init; */ /* functions */ DISTR.pdf = _unur_pdf_extremeI; /* pointer to PDF */ DISTR.dpdf = _unur_dpdf_extremeI; /* pointer to derivative of PDF */ DISTR.cdf = _unur_cdf_extremeI; /* pointer to CDF */ DISTR.invcdf = _unur_invcdf_extremeI; /* pointer to inverse CDF */ /* indicate which parameters are set */ distr->set = ( UNUR_DISTR_SET_DOMAIN | UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_MODE | UNUR_DISTR_SET_PDFAREA ); /* set parameters for distribution */ if (_unur_set_params_extremeI(distr,params,n_params)!=UNUR_SUCCESS) { free(distr); return NULL; } /* log of normalization constant */ LOGNORMCONSTANT = log(DISTR.theta); /* domain */ DISTR.domain[0] = -UNUR_INFINITY; /* left boundary */ DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ /* mode and area below p.d.f. */ DISTR.mode = DISTR.zeta; DISTR.area = 1.; /* function for setting parameters and updating domain */ DISTR.set_params = _unur_set_params_extremeI; /* function for updating derived parameters */ DISTR.upd_mode = _unur_upd_mode_extremeI; /* funct for computing mode */ DISTR.upd_area = _unur_upd_area_extremeI; /* funct for computing area */ /* return pointer to object */ return distr; } /* end of unur_distr_extremeI() */ /*---------------------------------------------------------------------------*/ #undef c #undef alpha #undef zeta #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/c_ghyp.c0000644001357500135600000003413714420445767015170 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: c_ghyp.c * * * * REFERENCES: * * * ***************************************************************************** * * * distr: Generalized hyperbolic distribution * * * * pdf: f(x) = (delta^2+(x-mu)^2)^(1/2*(lambda-1/2)) * exp(beta*(x-mu)) * * * K_{lambda-1/2}(alpha*sqrt(delta^2+(x-mu)^2)) * * * * domain: infinity < x < infinity * * * * constant: ( (gamma/delta)^lambda ) * * / ( sqrt(2*pi) * alpha^(lambda-1/2) * K_{lambda}(delta*gamma) ) * * * [gamma = sqrt(alpha^2 - beta^2) ] * * [K_theta(.) ... modified Bessel function of second kind] * * * * parameters: 4 * * 0 : lambda ... shape * * 1 : alpha >|beta| ... shape * * 2 : beta ... shape (asymmetry) * * 3 : delta > 0 ... scale * * 4 : mu ... location * * * ***************************************************************************** * * * We use the Rmath library for computing the Bessel function K_n. * * * ***************************************************************************** * * * Copyright (c) 2009-2012 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "unur_distributions.h" #include "unur_distributions_source.h" #include "unur_stddistr.h" /*---------------------------------------------------------------------------*/ static const char distr_name[] = "ghyp"; /* parameters */ #define lambda params[0] /* shape */ #define alpha params[1] /* shape */ #define beta params[2] /* shape (asymmetry) */ #define delta params[3] /* scale */ #define mu params[4] /* location */ #define DISTR distr->data.cont #define LOGNORMCONSTANT (distr->data.cont.norm_constant) /* function prototypes */ #ifdef _unur_SF_bessel_k static double _unur_pdf_ghyp( double x, const UNUR_DISTR *distr ); static double _unur_logpdf_ghyp( double x, const UNUR_DISTR *distr ); static double _unur_normconstant_ghyp( const double *params, int n_params ); /* static double _unur_dpdf_ghyp( double x, const UNUR_DISTR *distr ); */ /* static double _unur_cdf_ghyp( double x, const UNUR_DISTR *distr ); */ #endif static int _unur_upd_center_ghyp( UNUR_DISTR *distr ); static int _unur_set_params_ghyp( UNUR_DISTR *distr, const double *params, int n_params ); /*---------------------------------------------------------------------------*/ #ifdef _unur_SF_bessel_k double _unur_pdf_ghyp(double x, const UNUR_DISTR *distr) { /* f(x) = (delta^2+(x-mu)^2)^(1/2*(lambda-1/2)) * exp(beta*(x-mu)) */ /* * K_{lambda-1/2}(alpha*sqrt(delta^2+(x-mu)^2)) */ return exp(_unur_logpdf_ghyp(x,distr)); } /* end of _unur_pdf_ghyp() */ /*---------------------------------------------------------------------------*/ double _unur_logpdf_ghyp(double x, const UNUR_DISTR *distr) { /* f(x) = (delta^2+(x-mu)^2)^(1/2*(lambda-1/2)) * exp(beta*(x-mu)) */ /* * K_{lambda-1/2}(alpha*sqrt(delta^2+(x-mu)^2)) */ register const double *params = DISTR.params; double res = 0.; /* result of computation */ double nu = lambda - 0.5; /* order of modified Bessel function K() */ double y; /* auxiliary variable */ y = sqrt(delta*delta + (x-mu)*(x-mu)); /* Using nu and y we find: * f(x) = y^nu * exp(beta*(x-mu) * K_nu(alpha*y) * and * log(f(x)) = nu*log(y) + beta*(x-mu) + log(K_nu(alpha*y) */ /* see also c_vg.c */ do { if (y>0.) { /* first simply compute Bessel K_nu and compute logarithm. */ double besk; /* we currently use two algorithms based on our experiences * with the functions in the Rmath library. * (Maybe we could change this when we link against * other libraries.) */ if (nu < 100) /* the "standard implementation" using log(bessel_k) */ besk = _unur_SF_ln_bessel_k(alpha*y, nu); else /* an algorithm for large nu */ besk = _unur_SF_bessel_k_nuasympt(alpha*y, nu, TRUE, FALSE); /* there can be numerical problems with the Bessel function K_nu. */ if (_unur_isfinite(besk) && besk < MAXLOG - 20.0) { /* o.k. */ res = LOGNORMCONSTANT + besk + nu*log(y) + beta*(x-mu); break; } } /* Case: numerical problems with Bessel function K_nu. */ if (y < 1.0) { /* Case: Bessel function K_nu overflows for small values of y. * The following code is inspired by gsl_sf_bessel_lnKnu_e() from * the GSL (GNU Scientific Library). */ res = LOGNORMCONSTANT + beta*(x-mu); res += -M_LN2 + _unur_SF_ln_gamma(nu) + nu*log(2./alpha); if (nu > 1.0) { double xi = 0.25*(alpha*y)*(alpha*y); double sum = 1.0 - xi/(nu-1.0); if(nu > 2.0) sum += (xi/(nu-1.0)) * (xi/(nu-2.0)); res += log(sum); } } else { /* Case: Bessel function K_nu underflows for very large values of y * and we get NaN. * However, then the PDF of the Generalized Hyperbolic distribution is 0. */ res = -UNUR_INFINITY; } } while(0); /* see also c_vg.c */ return res; } /* end of _unur_logpdf_ghyp() */ /* Remark: a few references NIST Digital Library of Mathematical Functions http://dlmf.nist.gov/10.27.E3 K_{-nu}(z) = K_nu(z) http://dlmf.nist.gov/10.32.E10 K_nu(z) = 0.5*(0.5*z)^nu * \int_0^\infty exp(-t-z^2/(4*t)) * t^(-nu-1) dt This implies K_nu(z) = K_{-nu}(z) = 0.5*(0.5*z)^(-nu) * \int_0^\infty exp(-t-z^2/(4*t)) * t^(nu-1) dt <= 0.5*(0.5*z)^(-nu) * \int_0^\infty exp(-t) * t^(nu-1) dt = 0.5*(0.5*z)^(-nu) * Gamma(z) http://dlmf.nist.gov/10.30.E2 K_nu(z) ~ 0.5*Gamma(nu)*(0.5*z)^(-nu) for z->0 */ #endif /*---------------------------------------------------------------------------*/ int _unur_upd_center_ghyp( UNUR_DISTR *distr ) { register const double *params = DISTR.params; /* we simply use parameter 'mu' */ DISTR.center = mu; /* an alternative approach would be the mean of the distribution: */ /* double gamma = sqrt(alpha*alpha-beta*beta); */ /* DISTR.center = ( mu */ /* + ( delta*beta * bessel_k( delta*gamma, lambda+1, 1) ) */ /* / ( gamma * bessel_k( delta*gamma, lambda, 1) ) ); */ /* center must be in domain */ if (DISTR.center < DISTR.domain[0]) DISTR.center = DISTR.domain[0]; else if (DISTR.center > DISTR.domain[1]) DISTR.center = DISTR.domain[1]; return UNUR_SUCCESS; } /* end of _unur_upd_center_ghyp() */ /*---------------------------------------------------------------------------*/ #ifdef _unur_SF_bessel_k double _unur_normconstant_ghyp(const double *params ATTRIBUTE__UNUSED, int n_params ATTRIBUTE__UNUSED) { double gamm = sqrt(alpha*alpha-beta*beta); /* ( (gamm/delta)^lambda ) / ( sqrt(2*pi) * alpha^(lambda-1/2) * K_{lambda}(delta*gamm) ) */ double logconst = -0.5*(M_LNPI+M_LN2) + lambda * log(gamm/delta); logconst -= (lambda-0.5) * log(alpha); if (lambda < 50) /* threshold value 50 is selected by experiments */ logconst -= _unur_SF_ln_bessel_k( delta*gamm, lambda ); else logconst -= _unur_SF_bessel_k_nuasympt( delta*gamm, lambda, TRUE, FALSE ); return logconst; } /* end of _unur_normconstant_ghyp() */ #endif /*---------------------------------------------------------------------------*/ int _unur_set_params_ghyp( UNUR_DISTR *distr, const double *params, int n_params ) { /* check number of parameters for distribution */ if (n_params < 5) { _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } if (n_params > 5) { _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); n_params = 5; } CHECK_NULL(params,UNUR_ERR_NULL); /* check parameter omega */ if (delta <= 0.) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"delta <= 0"); return UNUR_ERR_DISTR_DOMAIN; } if (alpha <= fabs(beta)) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"alpha <= |beta|"); return UNUR_ERR_DISTR_DOMAIN; } /* copy parameters for standard form */ DISTR.lambda = lambda; DISTR.alpha = alpha; DISTR.beta = beta; DISTR.delta = delta; DISTR.mu = mu; /* default parameters: none */ /* store number of parameters */ DISTR.n_params = n_params; /* set (standard) domain */ if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.domain[0] = -UNUR_INFINITY; /* left boundary */ DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ } return UNUR_SUCCESS; } /* end of _unur_set_params_ghyp() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_ghyp( const double *params, int n_params) { register struct unur_distr *distr; /* get new (empty) distribution object */ distr = unur_distr_cont_new(); /* set distribution id */ distr->id = UNUR_DISTR_GHYP; /* name of distribution */ distr->name = distr_name; /* how to get special generators */ /* DISTR.init = _unur_stdgen_ghyp_init; */ /* functions */ #ifdef _unur_SF_bessel_k DISTR.pdf = _unur_pdf_ghyp; /* pointer to PDF */ DISTR.logpdf = _unur_logpdf_ghyp; /* pointer to log-PDF */ #endif /* indicate which parameters are set */ #ifdef _unur_SF_bessel_k distr->set = ( UNUR_DISTR_SET_DOMAIN | UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_CENTER | UNUR_DISTR_SET_PDFAREA ); #else distr->set = ( UNUR_DISTR_SET_DOMAIN | UNUR_DISTR_SET_STDDOMAIN ); #endif /* set parameters for distribution */ if (_unur_set_params_ghyp(distr,params,n_params)!=UNUR_SUCCESS) { free(distr); return NULL; } /* normalization constant */ #ifdef _unur_SF_bessel_k LOGNORMCONSTANT = _unur_normconstant_ghyp(DISTR.params,DISTR.n_params); #else LOGNORMCONSTANT = 0.; #endif /* we need the center of the distribution */ if (_unur_upd_center_ghyp(distr)!=UNUR_SUCCESS) { free(distr); return NULL; } /* mode and area below p.d.f. */ /* DISTR.mode = ? */ #ifdef _unur_SF_bessel_k DISTR.area = 1; #endif /* function for setting parameters and updating domain */ DISTR.set_params = _unur_set_params_ghyp; /* function for updating derived parameters */ /* DISTR.upd_mode = _unur_upd_mode_ghyp; /\* funct for computing mode *\/ */ /* DISTR.upd_area = _unur_upd_area_ghyp; funct for computing area */ /* return pointer to object */ return distr; } /* end of unur_distr_ghyp() */ /*---------------------------------------------------------------------------*/ #undef mu #undef alpha #undef beta #undef delta #undef lambda #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/d_binomial.c0000644001357500135600000002410414420445767016005 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: d_binomial.c * * * * REFERENCES: * * * * [1] N.L. Johnson, S. Kotz and A.W. Kemp * * Univariate Discrete Distributions, * * 2nd edition * * John Wiley & Sons, Inc., New York, 1992 * * * ***************************************************************************** * * * distr: Binomial distribution [1; ch.3, p.105] * * * * pmf: p(k) = (n \choose k) * p^k * (1-p)^(n-k) * * domain: 0 <= k <= n * * constant: 1 * * * * parameters: * * 0: n >= 1 * * 1: 0 < p < 1 * * * ***************************************************************************** * * * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "unur_distributions.h" #include "unur_distributions_source.h" #include "unur_stddistr.h" /*---------------------------------------------------------------------------*/ static const char distr_name[] = "binomial"; /*---------------------------------------------------------------------------*/ /* parameters */ #define n params[0] #define p params[1] /*---------------------------------------------------------------------------*/ #define DISTR distr->data.discr /* #define LOGNORMCONSTANT (distr->data.discr.norm_constant) */ /*---------------------------------------------------------------------------*/ /* function prototypes */ static double _unur_pmf_binomial( int k, const UNUR_DISTR *distr ); static double _unur_cdf_binomial( int k, const UNUR_DISTR *distr ); #ifdef _unur_SF_invcdf_binomial static int _unur_invcdf_binomial( double u, const UNUR_DISTR *distr ); #endif static int _unur_upd_mode_binomial( UNUR_DISTR *distr ); static int _unur_upd_sum_binomial( UNUR_DISTR *distr ); static int _unur_set_params_binomial( UNUR_DISTR *distr, const double *params, int n_params ); /*---------------------------------------------------------------------------*/ double _unur_pmf_binomial(int k, const UNUR_DISTR *distr) { const double *params = DISTR.params; if ( k<0 || k>(n+0.5) ) return 0.; else return exp( k * log(p) + (n-k) * log(1.-p) + _unur_SF_ln_factorial(n) - _unur_SF_ln_factorial(k) - _unur_SF_ln_factorial(n-k) ) ; } /* end of _unur_pmf_binomial() */ /*---------------------------------------------------------------------------*/ double _unur_cdf_binomial(int k, const UNUR_DISTR *distr) { const double *params = DISTR.params; if (k<0) return 0.; if (k==0) return exp(n*(log(1.-p))); if(k>(n-0.5)) return 1.; /* else */ return(_unur_SF_incomplete_beta(1.-p, n-k, k+1.)); } /* end of _unur_cdf_binomial() */ /*---------------------------------------------------------------------------*/ #ifdef _unur_SF_invcdf_binomial int _unur_invcdf_binomial(double u, const UNUR_DISTR *distr) { const double *params = DISTR.params; double x; x = _unur_SF_invcdf_binomial(u,n,p); return ((x>=INT_MAX) ? INT_MAX : ((int) x)); } /* end of _unur_invcdf_binomial() */ #endif /*---------------------------------------------------------------------------*/ int _unur_upd_mode_binomial( UNUR_DISTR *distr ) { DISTR.mode = (int) ((DISTR.n + 1) * DISTR.p); /* mode must be in domain */ if (DISTR.mode < DISTR.domain[0]) DISTR.mode = DISTR.domain[0]; else if (DISTR.mode > DISTR.domain[1]) DISTR.mode = DISTR.domain[1]; /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_upd_mode_binomial() */ /*---------------------------------------------------------------------------*/ int _unur_upd_sum_binomial( UNUR_DISTR *distr ) { /* log of normalization constant: none */ if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.sum = 1.; return UNUR_SUCCESS; } /* else */ DISTR.sum = ( _unur_cdf_binomial( DISTR.domain[1],distr) - _unur_cdf_binomial( DISTR.domain[0]-1,distr) ); return UNUR_SUCCESS; } /* end of _unur_upd_sum_binomial() */ /*---------------------------------------------------------------------------*/ int _unur_set_params_binomial( UNUR_DISTR *distr, const double *params, int n_params ) { int nh; /* check number of parameters for distribution */ if (n_params < 2) { _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } if (n_params > 2) { _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); n_params = 2; } CHECK_NULL(params,UNUR_ERR_NULL); /* check parameters */ if (p <= 0. || p >= 1. || n <= 0.) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"p <= 0 || p >= 1 || n <= 0"); return UNUR_ERR_DISTR_DOMAIN; } /* copy parameters for standard form */ /* round parameter n */ nh = (int)(n+0.5); if(fabs(nh-n)>0.001) _unur_warning(distr_name,UNUR_ERR_DISTR_DOMAIN,"n was rounded to the closest integer value"); DISTR.n = nh; DISTR.p = p; /* default parameters: none */ /* copy optional parameters: none */ /* store number of parameters */ DISTR.n_params = n_params; /* set (standard) domain: [0, n] */ if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.domain[0] = 0; /* left boundary */ DISTR.domain[1] = nh; /* right boundary */ } return UNUR_SUCCESS; } /* end of _unur_set_params_binomial() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_binomial( const double *params, int n_params ) { register struct unur_distr *distr; /* get new (empty) distribution object */ distr = unur_distr_discr_new(); /* set distribution id */ distr->id = UNUR_DISTR_BINOMIAL; /* name of distribution */ distr->name = distr_name; /* how to get special generators */ DISTR.init = _unur_stdgen_binomial_init; /* functions */ DISTR.pmf = _unur_pmf_binomial; /* pointer to PMF */ DISTR.cdf = _unur_cdf_binomial; /* pointer to CDF */ #ifdef _unur_SF_invcdf_binomial DISTR.invcdf = _unur_invcdf_binomial; /* pointer to inverse CDF */ #endif /* indicate which parameters are set */ distr->set = ( UNUR_DISTR_SET_DOMAIN | UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_PMFSUM | UNUR_DISTR_SET_MODE ); /* set parameters for distribution */ if (_unur_set_params_binomial(distr,params,n_params)!=UNUR_SUCCESS) { free(distr); return NULL; } /* log of normalization constant: none */ /* mode and sum over PMF */ DISTR.mode = (int) ((DISTR.n + 1) * DISTR.p); DISTR.sum = 1.; /* function for setting parameters and updating domain */ DISTR.set_params = _unur_set_params_binomial; /* function for updating derived parameters */ DISTR.upd_mode = _unur_upd_mode_binomial; /* funct for computing mode */ DISTR.upd_sum = _unur_upd_sum_binomial; /* funct for computing area */ /* return pointer to object */ return distr; } /* end of unur_distr_binomial() */ /*---------------------------------------------------------------------------*/ #undef p #undef r #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/c_slash_gen.c0000644001357500135600000002072714420445767016164 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: c_slash_gen.c * * * * Special generators for Slash distribution * * * ***************************************************************************** * * * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include "unur_distributions_source.h" #include "unur_distributions.h" /*---------------------------------------------------------------------------*/ /* init routines for special generators */ inline static int slash_slash_init( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* abbreviations */ #define PAR ((struct unur_cstd_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_cstd_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.cont /* data for distribution in generator object */ #define uniform() _unur_call_urng(gen->urng) /* call for uniform prng */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Inititialize **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ int _unur_stdgen_slash_init( struct unur_par *par, struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* initialize special generator for Slash distribution */ /* if gen == NULL then only check existance of variant. */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* one of par and gen must not be the NULL pointer */ switch ((par) ? par->variant : gen->variant) { case 0: /* DEFAULT */ case 1: /* Ratio of normal and uniform random variates */ _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_slash_slash ); return slash_slash_init( gen ); default: /* no such generator */ return UNUR_FAILURE; } } /* end of _unur_stdgen_slash_init() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Special generators **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ /***************************************************************************** * * * Slash Distribution: Z/U (Z from N(0,1), U from U(0,1)) * * * ***************************************************************************** * * * FUNCTION: - samples a random number from the Slash distribution. * * * * Implemented by R. Kremer, 1990 * ***************************************************************************** * WinRand (c) 1995 Ernst Stadlober, Institut fuer Statistitk, TU Graz * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #define NORMAL gen->gen_aux /* pointer to normal variate generator */ /*---------------------------------------------------------------------------*/ inline static int slash_slash_init( struct unur_gen *gen ) { /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_ERR_COOKIE); /* -X- setup code -X- */ /* make a normal variate generator (use default special generator) */ if (NORMAL==NULL) { struct unur_distr *distr = unur_distr_normal(NULL,0); struct unur_par *par = unur_cstd_new( distr ); NORMAL = (par) ? _unur_init(par) : NULL; _unur_check_NULL( NULL, NORMAL, UNUR_ERR_NULL ); /* need same uniform random number generator as slash generator */ NORMAL->urng = gen->urng; /* copy debugging flags */ NORMAL->debug = gen->debug; /* we do not need the distribution object any more */ _unur_distr_free( distr ); } /* else we are in the re-init mode --> there is no necessity to make the generator object again */ /* -X- end of setup code -X- */ return UNUR_SUCCESS; } /* end of slash_slash_init() */ double _unur_stdgen_sample_slash_slash( struct unur_gen *gen ) { /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); /* -X- generator code -X- */ return (_unur_sample_cont(NORMAL) / uniform()); /* -X- end of generator code -X- */ } /* end of _unur_stdgen_sample_slash_slash() */ /*---------------------------------------------------------------------------*/ #undef NORMAL /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/c_cauchy.c0000644001357500135600000002657714420445767015506 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: c_cauchy.c * * * * REFERENCES: * * * * [2] N.L. Johnson, S. Kotz and N. Balakrishnan * * Continuous Univariate Distributions, * * Volume 1, 2nd edition * * John Wiley & Sons, Inc., New York, 1994 * * * ***************************************************************************** * * * distr: Cauchy distribution [2; ch.16, p.299] * * * * pdf: f(x) = 1./( 1 + ((x-theta)/lambda)^2 ) * * domain: -infinity < x < infinity * * constant: 1 / (pi * lambda) * * * * parameters: * * 0: theta ... location * * 1: lambda > 0 ... scale * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "unur_distributions.h" #include "unur_distributions_source.h" #include "unur_stddistr.h" /*---------------------------------------------------------------------------*/ static const char distr_name[] = "cauchy"; /* parameters */ #define theta params[0] #define lambda params[1] #define DISTR distr->data.cont #define NORMCONSTANT (distr->data.cont.norm_constant) /* function prototypes */ static double _unur_pdf_cauchy( double x, const UNUR_DISTR *distr ); static double _unur_logpdf_cauchy( double x, const UNUR_DISTR *distr ); static double _unur_dpdf_cauchy( double x, const UNUR_DISTR *distr ); static double _unur_dlogpdf_cauchy( double x, const UNUR_DISTR *distr ); static double _unur_cdf_cauchy( double x, const UNUR_DISTR *distr ); static double _unur_invcdf_cauchy( double u, const UNUR_DISTR *distr ); static int _unur_upd_mode_cauchy( UNUR_DISTR *distr ); static int _unur_upd_area_cauchy( UNUR_DISTR *distr ); static int _unur_set_params_cauchy( UNUR_DISTR *distr, const double *params, int n_params ); /*---------------------------------------------------------------------------*/ double _unur_pdf_cauchy(double x, const UNUR_DISTR *distr) { register const double *params = DISTR.params; if (DISTR.n_params > 0) /* standardize */ x = (x - theta) / lambda; /* standard form */ return (1./((1+x*x)*NORMCONSTANT)); } /* end of _unur_pdf_cauchy() */ /*---------------------------------------------------------------------------*/ double _unur_logpdf_cauchy(double x, const UNUR_DISTR *distr) { register const double *params = DISTR.params; if (DISTR.n_params > 0) /* standardize */ x = (x - theta) / lambda; /* standard form */ return (-log1p(x*x)-log(NORMCONSTANT)); } /* end of _unur_logpdf_cauchy() */ /*---------------------------------------------------------------------------*/ double _unur_dpdf_cauchy(double x, const UNUR_DISTR *distr) { register const double *params = DISTR.params; if (DISTR.n_params > 0) /* standardize */ x = (x - theta) / lambda; /* standard form */ return ( -2.*x/(lambda*(1.+x*x)*(1.+x*x)*NORMCONSTANT) ); } /* end of _unur_dpdf_cauchy() */ /*---------------------------------------------------------------------------*/ double _unur_dlogpdf_cauchy(double x, const UNUR_DISTR *distr) { register const double *params = DISTR.params; if (DISTR.n_params > 0) /* standardize */ x = (x - theta) / lambda; /* standard form */ return -2.*x/(lambda*(1.+x*x)); } /* end of _unur_dlogpdf_cauchy() */ /*---------------------------------------------------------------------------*/ double _unur_cdf_cauchy(double x, const UNUR_DISTR *distr) { register const double *params = DISTR.params; register double Fx; if (DISTR.n_params > 0) /* standardize */ x = (x - theta) / lambda; /* standard form */ Fx = 0.5 + atan(x)/M_PI; /* correct round off error of atan() */ if (Fx<0.) Fx = 0.; if (Fx>1.) Fx = 1.; return Fx; } /* end of _unur_cdf_cauchy() */ /*---------------------------------------------------------------------------*/ double _unur_invcdf_cauchy(double u, const UNUR_DISTR *distr) { register const double *params = DISTR.params; double X; X = tan( M_PI * (u - 0.5) ); return ((DISTR.n_params==0) ? X : theta + lambda * X ); } /* end of _unur_invcdf_cauchy() */ /*---------------------------------------------------------------------------*/ int _unur_upd_mode_cauchy( UNUR_DISTR *distr ) { DISTR.mode = DISTR.theta; /* mode must be in domain */ if (DISTR.mode < DISTR.domain[0]) DISTR.mode = DISTR.domain[0]; else if (DISTR.mode > DISTR.domain[1]) DISTR.mode = DISTR.domain[1]; return UNUR_SUCCESS; } /* end of _unur_upd_mode_cauchy() */ /*---------------------------------------------------------------------------*/ int _unur_upd_area_cauchy( UNUR_DISTR *distr ) { /* normalization constant */ NORMCONSTANT = M_PI * DISTR.lambda; if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.area = 1.; return UNUR_SUCCESS; } /* else */ DISTR.area = ( _unur_cdf_cauchy( DISTR.domain[1],distr) - _unur_cdf_cauchy( DISTR.domain[0],distr) ); return UNUR_SUCCESS; } /* end of _unur_upd_area_cauchy() */ /*---------------------------------------------------------------------------*/ int _unur_set_params_cauchy( UNUR_DISTR *distr, const double *params, int n_params ) { /* check number of parameters for distribution */ if (n_params < 0) n_params = 0; if (n_params > 2) { _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); n_params = 2; } if (n_params > 0) CHECK_NULL(params,UNUR_ERR_NULL); /* check parameter lambda */ if (n_params == 2 && lambda <= 0.) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"lambda <= 0"); return UNUR_ERR_DISTR_DOMAIN; } /* copy parameters for standard form: none */ /* default parameters */ DISTR.theta = 0.; DISTR.lambda = 1.; /* copy optional parameters */ switch (n_params) { case 2: DISTR.lambda = lambda; /* FALLTHROUGH */ case 1: DISTR.theta = theta; n_params = 2; /* number of parameters for non-standard form */ /* FALLTHROUGH */ default: break; } /* store number of parameters */ DISTR.n_params = n_params; /* set (standard) domain */ if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.domain[0] = -UNUR_INFINITY; /* left boundary */ DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ } return UNUR_SUCCESS; } /* end of _unur_set_params_cauchy() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_cauchy( const double *params, int n_params ) { register struct unur_distr *distr; /* get new (empty) distribution object */ distr = unur_distr_cont_new(); /* set distribution id */ distr->id = UNUR_DISTR_CAUCHY; /* name of distribution */ distr->name = distr_name; /* how to get special generators */ /* DISTR.init = _unur_stdgen_cauchy_init; */ /* functions */ DISTR.pdf = _unur_pdf_cauchy; /* pointer to PDF */ DISTR.logpdf = _unur_logpdf_cauchy; /* pointer to logPDF */ DISTR.dpdf = _unur_dpdf_cauchy; /* pointer to derivative of PDF */ DISTR.dlogpdf = _unur_dlogpdf_cauchy; /* pointer to derivative of logPDF */ DISTR.cdf = _unur_cdf_cauchy; /* pointer to CDF */ DISTR.invcdf = _unur_invcdf_cauchy; /* pointer to inverse CDF */ /* indicate which parameters are set */ distr->set = ( UNUR_DISTR_SET_DOMAIN | UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_MODE | UNUR_DISTR_SET_PDFAREA ); /* set parameters for distribution */ if (_unur_set_params_cauchy(distr,params,n_params)!=UNUR_SUCCESS) { free(distr); return NULL; } /* normalization constant */ NORMCONSTANT = M_PI * DISTR.lambda; /* mode and area below p.d.f. */ DISTR.mode = DISTR.theta; DISTR.area = 1.; /* function for setting parameters and updating domain */ DISTR.set_params = _unur_set_params_cauchy; /* function for updating derived parameters */ DISTR.upd_mode = _unur_upd_mode_cauchy; /* funct for computing mode */ DISTR.upd_area = _unur_upd_area_cauchy; /* funct for computing area */ /* return pointer to object */ return distr; } /* end of unur_distr_cauchy() */ /*---------------------------------------------------------------------------*/ #undef theta #undef lambda #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/d_negativebinomial.c0000644001357500135600000002510714420445767017534 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: d_negativebinomial.c * * * * REFERENCES: * * * * [1] N.L. Johnson, S. Kotz and A.W. Kemp * * Univariate Discrete Distributions, * * 2nd edition * * John Wiley & Sons, Inc., New York, 1992 * * * ***************************************************************************** * * * distr: Negative Binomial distribution [1; ch.5.1, p.200] * * * * pmf: p(k) = (k+r-1 \choose r-1) * p^r * (1-p)^k * * domain: 0 <= k < infinity * * constant: 1 * * * * parameters: * * 0: 0 < p < 1 * * 1: r > 0 * * * ***************************************************************************** * * * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "unur_distributions.h" #include "unur_distributions_source.h" #include "unur_stddistr.h" /*---------------------------------------------------------------------------*/ static const char distr_name[] = "negativebinomial"; /*---------------------------------------------------------------------------*/ /* parameters */ #define p params[0] #define r params[1] /*---------------------------------------------------------------------------*/ #define DISTR distr->data.discr #define LOGNORMCONSTANT (distr->data.discr.norm_constant) /*---------------------------------------------------------------------------*/ /* function prototypes */ static double _unur_pmf_negativebinomial( int k, const UNUR_DISTR *distr ); #ifdef _unur_SF_cdf_negativebinomial static double _unur_cdf_negativebinomial( int k, const UNUR_DISTR *distr ); #endif #ifdef _unur_SF_invcdf_negativebinomial static int _unur_invcdf_negativebinomial( double u, const UNUR_DISTR *distr ); #endif static int _unur_upd_mode_negativebinomial( UNUR_DISTR *distr ); static int _unur_upd_sum_negativebinomial( UNUR_DISTR *distr ); static int _unur_set_params_negativebinomial( UNUR_DISTR *distr, const double *params, int n_params ); /*---------------------------------------------------------------------------*/ double _unur_pmf_negativebinomial(int k, const UNUR_DISTR *distr) { const double *params = DISTR.params; if (k<0) return 0.; else return exp( k*log(1-p) + _unur_SF_ln_gamma(k+r) - _unur_SF_ln_gamma(k+1.) - LOGNORMCONSTANT ) ; } /* end of _unur_pmf_negativebinomial() */ /*---------------------------------------------------------------------------*/ #ifdef _unur_SF_cdf_negativebinomial double _unur_cdf_negativebinomial(int k, const UNUR_DISTR *distr) { const double *params = DISTR.params; if (k<0) return 0.; else return _unur_SF_cdf_negativebinomial(k,r,p); } /* end of _unur_cdf_negativebinomial() */ #endif /*---------------------------------------------------------------------------*/ #ifdef _unur_SF_invcdf_negativebinomial int _unur_invcdf_negativebinomial(double u, const UNUR_DISTR *distr) { const double *params = DISTR.params; double x; x = _unur_SF_invcdf_negativebinomial(u,r,p); return ((x>=INT_MAX) ? INT_MAX : ((int) x)); } /* end of _unur_invcdf_negativebinomial() */ #endif /*---------------------------------------------------------------------------*/ int _unur_upd_mode_negativebinomial( UNUR_DISTR *distr ) { if (DISTR.r > 1.) { /* mode = floor( (r-1) * (1-p) / p ) */ /* (we add a guard against round-off errors */ DISTR.mode = (int) ((1.+UNUR_EPSILON) * (DISTR.r - 1.) * (1. - DISTR.p) / DISTR.p); } else { /* r <= 1. */ DISTR.mode = 0; } /* mode must be in domain */ if (DISTR.mode < DISTR.domain[0]) DISTR.mode = DISTR.domain[0]; else if (DISTR.mode > DISTR.domain[1]) DISTR.mode = DISTR.domain[1]; /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_upd_mode_negativebinomial() */ /*---------------------------------------------------------------------------*/ int _unur_upd_sum_negativebinomial( UNUR_DISTR *distr ) { /* log of normalization constant */ LOGNORMCONSTANT = - DISTR.r * log(DISTR.p) + _unur_SF_ln_gamma(DISTR.r); if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.sum = 1.; return UNUR_SUCCESS; } #ifdef _unur_SF_cdf_negativebinomial /* else */ DISTR.sum = ( _unur_cdf_negativebinomial( DISTR.domain[1],distr) - _unur_cdf_negativebinomial( DISTR.domain[0]-1,distr) ); return UNUR_SUCCESS; #else return UNUR_ERR_DISTR_REQUIRED; #endif } /* end of _unur_upd_sum_negativebinomial() */ /*---------------------------------------------------------------------------*/ int _unur_set_params_negativebinomial( UNUR_DISTR *distr, const double *params, int n_params ) { /* check number of parameters for distribution */ if (n_params < 2) { _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } if (n_params > 2) { _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); n_params = 2; } CHECK_NULL(params,UNUR_ERR_NULL); /* check parameters */ if (p <= 0. || p >= 1. || r <= 0.) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"p <= 0 || p >= 1 || r <= 0"); return UNUR_ERR_DISTR_DOMAIN; } /* copy parameters for standard form */ DISTR.p = p; DISTR.r = r; /* default parameters: none */ /* copy optional parameters: none */ /* store number of parameters */ DISTR.n_params = n_params; /* set (standard) domain: [0, infinity] */ if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.domain[0] = 0; /* left boundary */ DISTR.domain[1] = INT_MAX; /* right boundary */ } return UNUR_SUCCESS; } /* end of _unur_set_params_negativebinomial() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_negativebinomial( const double *params, int n_params ) { register struct unur_distr *distr; /* get new (empty) distribution object */ distr = unur_distr_discr_new(); /* set distribution id */ distr->id = UNUR_DISTR_NEGATIVEBINOMIAL; /* name of distribution */ distr->name = distr_name; /* how to get special generators */ /* DISTR.init = _unur_stdgen_negativebinomial_init; */ /* functions */ DISTR.pmf = _unur_pmf_negativebinomial; /* pointer to PMF */ #ifdef _unur_SF_cdf_negativebinomial DISTR.cdf = _unur_cdf_negativebinomial; /* pointer to CDF */ #endif #ifdef _unur_SF_invcdf_negativebinomial DISTR.invcdf = _unur_invcdf_negativebinomial; /* pointer to inverse CDF */ #endif /* indicate which parameters are set */ distr->set = ( UNUR_DISTR_SET_DOMAIN | UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_PMFSUM | UNUR_DISTR_SET_MODE ); /* set parameters for distribution */ if (_unur_set_params_negativebinomial(distr,params,n_params)!=UNUR_SUCCESS) { free(distr); return NULL; } /* log of normalization constant */ _unur_upd_sum_negativebinomial( distr ); /* mode and sum over PMF */ _unur_upd_mode_negativebinomial(distr); DISTR.sum = 1.; /* function for setting parameters and updating domain */ DISTR.set_params = _unur_set_params_negativebinomial; /* function for updating derived parameters */ DISTR.upd_mode = _unur_upd_mode_negativebinomial; /* funct for computing mode */ DISTR.upd_sum = _unur_upd_sum_negativebinomial; /* funct for computing area */ /* return pointer to object */ return distr; } /* end of unur_distr_negativebinomial() */ /*---------------------------------------------------------------------------*/ #undef p #undef r #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/c_beta.c0000644001357500135600000004001314420445767015122 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: c_beta.c * * * * REFERENCES: * * * * [3] N.L. Johnson, S. Kotz and N. Balakrishnan * * Continuous Univariate Distributions, * * Volume 2, 2nd edition * * John Wiley & Sons, Inc., New York, 1995 * * * ***************************************************************************** * * * distr: Beta distribution [3; ch.25, p.210] * * * * pdf: f(x) = (x-a)^(p-1) * (b-x)^(q-1) * * domain: a < x < b * * constant: 1 / ( Beta(p,q) * (b-a)^(p+q-1) ) * * * * parameters: 4 * * 0: p > 0 ... shape * * 1: q > 0 ... shape * * 2: a (0) ... location * * 3: b >a (1) ... location * * * ***************************************************************************** * * * standard form * * * * pdf: f(x) = x^(p-1) * (1-x)^(q-1) * * domain: 0 < x < 1 * * constant: 1 / Beta(p,q) * * * * parameters: 2 * * 0: p > 0 ... shape * * 1: q > 0 ... shape * * * * 2: a = 0 * * 3: b = 1 * * * ***************************************************************************** * * * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "unur_distributions.h" #include "unur_distributions_source.h" #include "unur_stddistr.h" /*---------------------------------------------------------------------------*/ static const char distr_name[] = "beta"; /*---------------------------------------------------------------------------*/ /* parameters */ #define p params[0] #define q params[1] #define a params[2] #define b params[3] /*---------------------------------------------------------------------------*/ #define DISTR distr->data.cont #define LOGNORMCONSTANT (distr->data.cont.norm_constant) /*---------------------------------------------------------------------------*/ /* function prototypes */ static double _unur_pdf_beta( double x, const UNUR_DISTR *distr ); static double _unur_logpdf_beta( double x, const UNUR_DISTR *distr ); static double _unur_dpdf_beta( double x, const UNUR_DISTR *distr ); static double _unur_dlogpdf_beta( double x, const UNUR_DISTR *distr ); static double _unur_cdf_beta( double x, const UNUR_DISTR *distr ); #ifdef _unur_SF_invcdf_beta static double _unur_invcdf_beta( double x, const UNUR_DISTR *distr ); #endif static int _unur_upd_mode_beta( UNUR_DISTR *distr ); static int _unur_upd_area_beta( UNUR_DISTR *distr ); inline static double _unur_lognormconstant_beta( const double *params, int n_params ); static int _unur_set_params_beta( UNUR_DISTR *distr, const double *params, int n_params ); /*---------------------------------------------------------------------------*/ double _unur_pdf_beta(double x, const UNUR_DISTR *distr) { register const double *params = DISTR.params; if (DISTR.n_params > 2) /* standardize */ x = (x-a) / (b-a); /* standard form */ if (x > 0. && x < 1.) return exp((p-1.)*log(x) + (q-1.)*log(1.-x) - LOGNORMCONSTANT); if ((_unur_iszero(x) && _unur_isone(p)) || (_unur_isone(x) && _unur_isone(q))) return exp(-LOGNORMCONSTANT); if ((_unur_iszero(x) && p<1.) || (_unur_isone(x) && q<1.)) return UNUR_INFINITY; /* out of support */ return 0.; } /* end of _unur_pdf_beta() */ /*---------------------------------------------------------------------------*/ double _unur_logpdf_beta(double x, const UNUR_DISTR *distr) { register const double *params = DISTR.params; if (DISTR.n_params > 2) /* standardize */ x = (x-a) / (b-a); /* standard form */ if (x > 0. && x < 1.) return ((p-1.)*log(x) + (q-1.)*log(1.-x) - LOGNORMCONSTANT); if ((_unur_iszero(x) && _unur_isone(p)) || (_unur_isone(x) && _unur_isone(q))) return (-LOGNORMCONSTANT); if ((_unur_iszero(x) && p<1.) || (_unur_isone(x) && q<1.)) return UNUR_INFINITY; /* out of support */ return -UNUR_INFINITY; } /* end of _unur_logpdf_beta() */ /*---------------------------------------------------------------------------*/ double _unur_dpdf_beta(double x, const UNUR_DISTR *distr) { register const double *params = DISTR.params; if (DISTR.n_params > 2) { /* standardize */ x = (x-a) / (b-a); } /* standard form */ if (x > 0. && x < 1.) return (exp((p-2.)*log(x) + (q-2.)*log(1.-x) - LOGNORMCONSTANT) * ( (p-1.)*(1.-x) - (q-1.)*x ) / (b-a) ); if (_unur_iszero(x) && _unur_isone(p)) return (1.-q)*exp(-LOGNORMCONSTANT)/(b-a); if (_unur_iszero(x) && _unur_isfsame(p,2.)) return exp(-LOGNORMCONSTANT)/(b-a); if (_unur_iszero(x) && p<2.) return (p>1. ? UNUR_INFINITY : -UNUR_INFINITY); /* if (_unur_iszero(x) && p>2.) */ /* return 0.; */ if (_unur_isone(x) && _unur_isone(q)) return (p-1.)*exp(-LOGNORMCONSTANT)/(b-a); if (_unur_isone(x) && _unur_isfsame(q,2.)) return -exp(-LOGNORMCONSTANT)/(b-a); if (_unur_isone(x) && q<2.) return (q>1. ? -UNUR_INFINITY : UNUR_INFINITY); /* if (_unur_isone(x) && q>2.) */ /* return 0.; */ /* out of support */ return 0.; } /* end of _unur_dpdf_beta() */ /*---------------------------------------------------------------------------*/ double _unur_dlogpdf_beta(double x, const UNUR_DISTR *distr) { register const double *params = DISTR.params; if (DISTR.n_params > 2) { /* standardize */ x = (x-a) / (b-a); } /* standard form */ if (x > 0. && x < 1.) return (((p-1.)/x - (q-1.)/(1.-x)) / (b-a)); if (_unur_iszero(x) && p<1.) return -UNUR_INFINITY; if (_unur_iszero(x) && _unur_isone(p)) return (-(q-1.)/((1.-x)*(b-a))); if (_unur_iszero(x) && p>1.) return UNUR_INFINITY; if (_unur_isone(x) && q<1.) return UNUR_INFINITY; if (_unur_isone(x) && _unur_isone(q)) return ((p-1.)/(b-a)); if (_unur_isone(x) && q>1.) return -UNUR_INFINITY; /* out of support */ return 0.; } /* end of _unur_dlogpdf_beta() */ /*---------------------------------------------------------------------------*/ double _unur_cdf_beta(double x, const UNUR_DISTR *distr) { register const double *params = DISTR.params; if (DISTR.n_params > 2) /* standardize */ x = (x-a) / (b-a); /* standard form */ /* out of support of p.d.f.? */ if (x <= 0.) return 0.; if (x >= 1.) return 1.; return _unur_SF_incomplete_beta(x,p,q); } /* end of _unur_cdf_beta() */ /*---------------------------------------------------------------------------*/ #ifdef _unur_SF_invcdf_beta double _unur_invcdf_beta(double x, const UNUR_DISTR *distr) { const double *params = DISTR.params; if (DISTR.n_params == 2) return _unur_SF_invcdf_beta(x,p,q); else return (a + _unur_SF_invcdf_beta(x,p,q))*(b-a); } /* end of _unur_invcdf_beta() */ #endif /*---------------------------------------------------------------------------*/ int _unur_upd_mode_beta( UNUR_DISTR *distr ) { register double *params = DISTR.params; if (p <= 1. && q > 1.) DISTR.mode = 0.; /* left limit of domain */ else if (p > 1. && q <= 1.) DISTR.mode = 1.; /* right limit of domain */ else if (p > 1. && q > 1.) DISTR.mode = (p - 1.) / (p + q - 2.); else { /* p.d.f. is not unimodal */ DISTR.mode = UNUR_INFINITY; return UNUR_ERR_DISTR_PROP; } if (DISTR.n_params > 2) DISTR.mode = DISTR.mode * (b - a) + a; /* mode must be in domain */ if (DISTR.mode < DISTR.domain[0]) DISTR.mode = DISTR.domain[0]; else if (DISTR.mode > DISTR.domain[1]) DISTR.mode = DISTR.domain[1]; /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_upd_mode_beta() */ /*---------------------------------------------------------------------------*/ int _unur_upd_area_beta( UNUR_DISTR *distr ) { /* log of normalization constant */ LOGNORMCONSTANT = _unur_lognormconstant_beta(DISTR.params,DISTR.n_params); if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.area = 1.; return UNUR_SUCCESS; } /* else */ DISTR.area = ( _unur_cdf_beta( DISTR.domain[1],distr) - _unur_cdf_beta( DISTR.domain[0],distr) ); return UNUR_SUCCESS; } /* end of _unur_upd_area_beta() */ /*---------------------------------------------------------------------------*/ double _unur_lognormconstant_beta(const double *params, int n_params) { if (n_params > 2) /* non-standard form */ /* log( Beta(p,q) * (b-a) ) */ return (_unur_SF_ln_gamma(p) + _unur_SF_ln_gamma(q) - _unur_SF_ln_gamma(p+q) + log(b-a) ); else /* standard form */ /* log( Beta(p,q) ) */ return (_unur_SF_ln_gamma(p) + _unur_SF_ln_gamma(q) - _unur_SF_ln_gamma(p+q)); } /* end of _unur_lognormconstant_beta() */ /*---------------------------------------------------------------------------*/ int _unur_set_params_beta( UNUR_DISTR *distr, const double *params, int n_params ) { /* check number of parameters for distribution */ if (n_params < 2) { _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } if (n_params == 3) { _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,""); n_params = 2; } if (n_params > 4) { _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); n_params = 4; } CHECK_NULL(params,UNUR_ERR_NULL); /* check parameters p and q */ if (p <= 0. || q <= 0.) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"p <= 0 or q <= 0"); return UNUR_ERR_DISTR_DOMAIN; } /* check parameters a and b */ if (n_params > 2 && a >= b) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"a >= b"); return UNUR_ERR_DISTR_DOMAIN; } /* copy parameters for standard form */ DISTR.p = p; DISTR.q = q; /* copy optional parameters */ if (n_params > 2) { DISTR.a = a; DISTR.b = b; } else { /* or use defaults */ DISTR.a = 0.; /* default for a */ DISTR.b = 1.; /* default for b */ } /* store number of parameters */ DISTR.n_params = n_params; /* set (standard) domain */ if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.domain[0] = DISTR.a; /* left boundary */ DISTR.domain[1] = DISTR.b; /* right boundary */ } return UNUR_SUCCESS; } /* end of _unur_set_params_beta() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_beta( const double *params, int n_params ) { register struct unur_distr *distr; /* get new (empty) distribution object */ distr = unur_distr_cont_new(); /* set distribution id */ distr->id = UNUR_DISTR_BETA; /* name of distribution */ distr->name = distr_name; /* how to get special generators */ DISTR.init = _unur_stdgen_beta_init; /* functions */ DISTR.pdf = _unur_pdf_beta; /* pointer to PDF */ DISTR.logpdf = _unur_logpdf_beta; /* pointer to logPDF */ DISTR.dpdf = _unur_dpdf_beta; /* pointer to derivative of PDF */ DISTR.dlogpdf = _unur_dlogpdf_beta; /* pointer to derivative of logPDF */ DISTR.cdf = _unur_cdf_beta; /* pointer to CDF */ #ifdef _unur_SF_invcdf_beta DISTR.invcdf = _unur_invcdf_beta; /* pointer to inverse CDF */ #endif /* indicate which parameters are set */ distr->set = ( UNUR_DISTR_SET_DOMAIN | UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_PDFAREA | UNUR_DISTR_SET_MODE ); /* set parameters for distribution */ if (_unur_set_params_beta(distr,params,n_params)!=UNUR_SUCCESS) { free(distr); return NULL; } /* log of normalization constant */ LOGNORMCONSTANT = _unur_lognormconstant_beta(DISTR.params,DISTR.n_params); /* mode and area below p.d.f. */ _unur_upd_mode_beta( distr ); DISTR.area = 1.; /* function for setting parameters and updating domain */ DISTR.set_params = _unur_set_params_beta; /* function for updating derived parameters */ DISTR.upd_mode = _unur_upd_mode_beta; /* funct for computing mode */ DISTR.upd_area = _unur_upd_area_beta; /* funct for computing area */ /* return pointer to object */ return distr; } /* end of unur_distr_beta() */ /*---------------------------------------------------------------------------*/ #undef p #undef q #undef a #undef b #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/Makefile.in0000644001357500135600000007627214430713360015612 00000000000000# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = src/distributions ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libdistributions_la_LIBADD = am_libdistributions_la_OBJECTS = c_beta.lo c_beta_gen.lo c_burr.lo \ c_cauchy.lo c_chi.lo c_chi_gen.lo c_chisquare.lo \ c_exponential.lo c_exponential_gen.lo c_extremeI.lo \ c_extremeII.lo c_F.lo c_gamma.lo c_gamma_gen.lo c_ghyp.lo \ c_gig.lo c_gig_gen.lo c_gig2.lo c_hyperbolic.lo c_ig.lo \ c_laplace.lo c_logistic.lo c_lognormal.lo c_lomax.lo \ c_meixner.lo c_normal.lo c_normal_gen.lo c_pareto.lo \ c_powerexponential.lo c_powerexponential_gen.lo c_rayleigh.lo \ c_slash.lo c_slash_gen.lo c_student.lo c_student_gen.lo \ c_triangular.lo c_uniform.lo c_vg.lo c_weibull.lo \ d_binomial.lo d_binomial_gen.lo d_geometric.lo \ d_hypergeometric.lo d_hypergeometric_gen.lo d_logarithmic.lo \ d_logarithmic_gen.lo d_negativebinomial.lo d_poisson.lo \ d_poisson_gen.lo d_zipf.lo d_zipf_gen.lo m_correlation.lo \ vc_copula.lo vc_multicauchy.lo vc_multiexponential.lo \ vc_multinormal.lo vc_multinormal_gen.lo vc_multistudent.lo libdistributions_la_OBJECTS = $(am_libdistributions_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/c_F.Plo ./$(DEPDIR)/c_beta.Plo \ ./$(DEPDIR)/c_beta_gen.Plo ./$(DEPDIR)/c_burr.Plo \ ./$(DEPDIR)/c_cauchy.Plo ./$(DEPDIR)/c_chi.Plo \ ./$(DEPDIR)/c_chi_gen.Plo ./$(DEPDIR)/c_chisquare.Plo \ ./$(DEPDIR)/c_exponential.Plo \ ./$(DEPDIR)/c_exponential_gen.Plo ./$(DEPDIR)/c_extremeI.Plo \ ./$(DEPDIR)/c_extremeII.Plo ./$(DEPDIR)/c_gamma.Plo \ ./$(DEPDIR)/c_gamma_gen.Plo ./$(DEPDIR)/c_ghyp.Plo \ ./$(DEPDIR)/c_gig.Plo ./$(DEPDIR)/c_gig2.Plo \ ./$(DEPDIR)/c_gig_gen.Plo ./$(DEPDIR)/c_hyperbolic.Plo \ ./$(DEPDIR)/c_ig.Plo ./$(DEPDIR)/c_laplace.Plo \ ./$(DEPDIR)/c_logistic.Plo ./$(DEPDIR)/c_lognormal.Plo \ ./$(DEPDIR)/c_lomax.Plo ./$(DEPDIR)/c_meixner.Plo \ ./$(DEPDIR)/c_normal.Plo ./$(DEPDIR)/c_normal_gen.Plo \ ./$(DEPDIR)/c_pareto.Plo ./$(DEPDIR)/c_powerexponential.Plo \ ./$(DEPDIR)/c_powerexponential_gen.Plo \ ./$(DEPDIR)/c_rayleigh.Plo ./$(DEPDIR)/c_slash.Plo \ ./$(DEPDIR)/c_slash_gen.Plo ./$(DEPDIR)/c_student.Plo \ ./$(DEPDIR)/c_student_gen.Plo ./$(DEPDIR)/c_triangular.Plo \ ./$(DEPDIR)/c_uniform.Plo ./$(DEPDIR)/c_vg.Plo \ ./$(DEPDIR)/c_weibull.Plo ./$(DEPDIR)/d_binomial.Plo \ ./$(DEPDIR)/d_binomial_gen.Plo ./$(DEPDIR)/d_geometric.Plo \ ./$(DEPDIR)/d_hypergeometric.Plo \ ./$(DEPDIR)/d_hypergeometric_gen.Plo \ ./$(DEPDIR)/d_logarithmic.Plo \ ./$(DEPDIR)/d_logarithmic_gen.Plo \ ./$(DEPDIR)/d_negativebinomial.Plo ./$(DEPDIR)/d_poisson.Plo \ ./$(DEPDIR)/d_poisson_gen.Plo ./$(DEPDIR)/d_zipf.Plo \ ./$(DEPDIR)/d_zipf_gen.Plo ./$(DEPDIR)/m_correlation.Plo \ ./$(DEPDIR)/vc_copula.Plo ./$(DEPDIR)/vc_multicauchy.Plo \ ./$(DEPDIR)/vc_multiexponential.Plo \ ./$(DEPDIR)/vc_multinormal.Plo \ ./$(DEPDIR)/vc_multinormal_gen.Plo \ ./$(DEPDIR)/vc_multistudent.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libdistributions_la_SOURCES) DIST_SOURCES = $(libdistributions_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(noinst_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autoconf/depcomp \ README DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILECMD = @FILECMD@ GREP = @GREP@ HAVE_DIVIDE_BY_ZERO = @HAVE_DIVIDE_BY_ZERO@ HAVE_IEEE_COMPARISONS = @HAVE_IEEE_COMPARISONS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNURAN_LT_VERSION = @UNURAN_LT_VERSION@ UNURAN_SUPPORTS_GSL = @UNURAN_SUPPORTS_GSL@ UNURAN_SUPPORTS_PRNG = @UNURAN_SUPPORTS_PRNG@ UNURAN_SUPPORTS_RNGSTREAM = @UNURAN_SUPPORTS_RNGSTREAM@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ have_valgrind = @have_valgrind@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = \ -I$(top_srcdir)/src noinst_LTLIBRARIES = libdistributions.la libdistributions_la_SOURCES = \ c_beta.c c_beta_gen.c \ c_burr.c \ c_cauchy.c \ c_chi.c c_chi_gen.c \ c_chisquare.c \ c_exponential.c c_exponential_gen.c \ c_extremeI.c \ c_extremeII.c \ c_F.c \ c_gamma.c c_gamma_gen.c \ c_ghyp.c \ c_gig.c c_gig_gen.c \ c_gig2.c \ c_hyperbolic.c \ c_ig.c \ c_laplace.c \ c_logistic.c \ c_lognormal.c \ c_lomax.c \ c_meixner.c \ c_normal.c c_normal_gen.c \ c_pareto.c \ c_powerexponential.c c_powerexponential_gen.c \ c_rayleigh.c \ c_slash.c c_slash_gen.c \ c_student.c c_student_gen.c \ c_triangular.c \ c_uniform.c \ c_vg.c \ c_weibull.c \ d_binomial.c d_binomial_gen.c \ d_geometric.c \ d_hypergeometric.c d_hypergeometric_gen.c \ d_logarithmic.c d_logarithmic_gen.c \ d_negativebinomial.c \ d_poisson.c d_poisson_gen.c \ d_zipf.c d_zipf_gen.c \ m_correlation.c \ vc_copula.c \ vc_multicauchy.c \ vc_multiexponential.c \ vc_multinormal.c vc_multinormal_gen.c \ vc_multistudent.c noinst_HEADERS = \ unur_distributions.h \ unur_distributions_source.h \ unur_stddistr.h EXTRA_DIST = \ README # clean backup files CLEANFILES = *~ # clean generated files MAINTAINERCLEANFILES = \ Makefile.in all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/distributions/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/distributions/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libdistributions.la: $(libdistributions_la_OBJECTS) $(libdistributions_la_DEPENDENCIES) $(EXTRA_libdistributions_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libdistributions_la_OBJECTS) $(libdistributions_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_F.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_beta.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_beta_gen.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_burr.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_cauchy.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_chi.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_chi_gen.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_chisquare.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_exponential.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_exponential_gen.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_extremeI.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_extremeII.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_gamma.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_gamma_gen.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_ghyp.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_gig.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_gig2.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_gig_gen.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_hyperbolic.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_ig.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_laplace.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_logistic.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_lognormal.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_lomax.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_meixner.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_normal.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_normal_gen.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_pareto.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_powerexponential.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_powerexponential_gen.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_rayleigh.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_slash.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_slash_gen.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_student.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_student_gen.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_triangular.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_uniform.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_vg.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_weibull.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/d_binomial.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/d_binomial_gen.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/d_geometric.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/d_hypergeometric.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/d_hypergeometric_gen.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/d_logarithmic.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/d_logarithmic_gen.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/d_negativebinomial.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/d_poisson.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/d_poisson_gen.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/d_zipf.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/d_zipf_gen.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m_correlation.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vc_copula.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vc_multicauchy.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vc_multiexponential.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vc_multinormal.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vc_multinormal_gen.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vc_multistudent.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/c_F.Plo -rm -f ./$(DEPDIR)/c_beta.Plo -rm -f ./$(DEPDIR)/c_beta_gen.Plo -rm -f ./$(DEPDIR)/c_burr.Plo -rm -f ./$(DEPDIR)/c_cauchy.Plo -rm -f ./$(DEPDIR)/c_chi.Plo -rm -f ./$(DEPDIR)/c_chi_gen.Plo -rm -f ./$(DEPDIR)/c_chisquare.Plo -rm -f ./$(DEPDIR)/c_exponential.Plo -rm -f ./$(DEPDIR)/c_exponential_gen.Plo -rm -f ./$(DEPDIR)/c_extremeI.Plo -rm -f ./$(DEPDIR)/c_extremeII.Plo -rm -f ./$(DEPDIR)/c_gamma.Plo -rm -f ./$(DEPDIR)/c_gamma_gen.Plo -rm -f ./$(DEPDIR)/c_ghyp.Plo -rm -f ./$(DEPDIR)/c_gig.Plo -rm -f ./$(DEPDIR)/c_gig2.Plo -rm -f ./$(DEPDIR)/c_gig_gen.Plo -rm -f ./$(DEPDIR)/c_hyperbolic.Plo -rm -f ./$(DEPDIR)/c_ig.Plo -rm -f ./$(DEPDIR)/c_laplace.Plo -rm -f ./$(DEPDIR)/c_logistic.Plo -rm -f ./$(DEPDIR)/c_lognormal.Plo -rm -f ./$(DEPDIR)/c_lomax.Plo -rm -f ./$(DEPDIR)/c_meixner.Plo -rm -f ./$(DEPDIR)/c_normal.Plo -rm -f ./$(DEPDIR)/c_normal_gen.Plo -rm -f ./$(DEPDIR)/c_pareto.Plo -rm -f ./$(DEPDIR)/c_powerexponential.Plo -rm -f ./$(DEPDIR)/c_powerexponential_gen.Plo -rm -f ./$(DEPDIR)/c_rayleigh.Plo -rm -f ./$(DEPDIR)/c_slash.Plo -rm -f ./$(DEPDIR)/c_slash_gen.Plo -rm -f ./$(DEPDIR)/c_student.Plo -rm -f ./$(DEPDIR)/c_student_gen.Plo -rm -f ./$(DEPDIR)/c_triangular.Plo -rm -f ./$(DEPDIR)/c_uniform.Plo -rm -f ./$(DEPDIR)/c_vg.Plo -rm -f ./$(DEPDIR)/c_weibull.Plo -rm -f ./$(DEPDIR)/d_binomial.Plo -rm -f ./$(DEPDIR)/d_binomial_gen.Plo -rm -f ./$(DEPDIR)/d_geometric.Plo -rm -f ./$(DEPDIR)/d_hypergeometric.Plo -rm -f ./$(DEPDIR)/d_hypergeometric_gen.Plo -rm -f ./$(DEPDIR)/d_logarithmic.Plo -rm -f ./$(DEPDIR)/d_logarithmic_gen.Plo -rm -f ./$(DEPDIR)/d_negativebinomial.Plo -rm -f ./$(DEPDIR)/d_poisson.Plo -rm -f ./$(DEPDIR)/d_poisson_gen.Plo -rm -f ./$(DEPDIR)/d_zipf.Plo -rm -f ./$(DEPDIR)/d_zipf_gen.Plo -rm -f ./$(DEPDIR)/m_correlation.Plo -rm -f ./$(DEPDIR)/vc_copula.Plo -rm -f ./$(DEPDIR)/vc_multicauchy.Plo -rm -f ./$(DEPDIR)/vc_multiexponential.Plo -rm -f ./$(DEPDIR)/vc_multinormal.Plo -rm -f ./$(DEPDIR)/vc_multinormal_gen.Plo -rm -f ./$(DEPDIR)/vc_multistudent.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/c_F.Plo -rm -f ./$(DEPDIR)/c_beta.Plo -rm -f ./$(DEPDIR)/c_beta_gen.Plo -rm -f ./$(DEPDIR)/c_burr.Plo -rm -f ./$(DEPDIR)/c_cauchy.Plo -rm -f ./$(DEPDIR)/c_chi.Plo -rm -f ./$(DEPDIR)/c_chi_gen.Plo -rm -f ./$(DEPDIR)/c_chisquare.Plo -rm -f ./$(DEPDIR)/c_exponential.Plo -rm -f ./$(DEPDIR)/c_exponential_gen.Plo -rm -f ./$(DEPDIR)/c_extremeI.Plo -rm -f ./$(DEPDIR)/c_extremeII.Plo -rm -f ./$(DEPDIR)/c_gamma.Plo -rm -f ./$(DEPDIR)/c_gamma_gen.Plo -rm -f ./$(DEPDIR)/c_ghyp.Plo -rm -f ./$(DEPDIR)/c_gig.Plo -rm -f ./$(DEPDIR)/c_gig2.Plo -rm -f ./$(DEPDIR)/c_gig_gen.Plo -rm -f ./$(DEPDIR)/c_hyperbolic.Plo -rm -f ./$(DEPDIR)/c_ig.Plo -rm -f ./$(DEPDIR)/c_laplace.Plo -rm -f ./$(DEPDIR)/c_logistic.Plo -rm -f ./$(DEPDIR)/c_lognormal.Plo -rm -f ./$(DEPDIR)/c_lomax.Plo -rm -f ./$(DEPDIR)/c_meixner.Plo -rm -f ./$(DEPDIR)/c_normal.Plo -rm -f ./$(DEPDIR)/c_normal_gen.Plo -rm -f ./$(DEPDIR)/c_pareto.Plo -rm -f ./$(DEPDIR)/c_powerexponential.Plo -rm -f ./$(DEPDIR)/c_powerexponential_gen.Plo -rm -f ./$(DEPDIR)/c_rayleigh.Plo -rm -f ./$(DEPDIR)/c_slash.Plo -rm -f ./$(DEPDIR)/c_slash_gen.Plo -rm -f ./$(DEPDIR)/c_student.Plo -rm -f ./$(DEPDIR)/c_student_gen.Plo -rm -f ./$(DEPDIR)/c_triangular.Plo -rm -f ./$(DEPDIR)/c_uniform.Plo -rm -f ./$(DEPDIR)/c_vg.Plo -rm -f ./$(DEPDIR)/c_weibull.Plo -rm -f ./$(DEPDIR)/d_binomial.Plo -rm -f ./$(DEPDIR)/d_binomial_gen.Plo -rm -f ./$(DEPDIR)/d_geometric.Plo -rm -f ./$(DEPDIR)/d_hypergeometric.Plo -rm -f ./$(DEPDIR)/d_hypergeometric_gen.Plo -rm -f ./$(DEPDIR)/d_logarithmic.Plo -rm -f ./$(DEPDIR)/d_logarithmic_gen.Plo -rm -f ./$(DEPDIR)/d_negativebinomial.Plo -rm -f ./$(DEPDIR)/d_poisson.Plo -rm -f ./$(DEPDIR)/d_poisson_gen.Plo -rm -f ./$(DEPDIR)/d_zipf.Plo -rm -f ./$(DEPDIR)/d_zipf_gen.Plo -rm -f ./$(DEPDIR)/m_correlation.Plo -rm -f ./$(DEPDIR)/vc_copula.Plo -rm -f ./$(DEPDIR)/vc_multicauchy.Plo -rm -f ./$(DEPDIR)/vc_multiexponential.Plo -rm -f ./$(DEPDIR)/vc_multinormal.Plo -rm -f ./$(DEPDIR)/vc_multinormal_gen.Plo -rm -f ./$(DEPDIR)/vc_multistudent.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: unuran-1.11.0/src/distributions/vc_multinormal_gen.c0000644001357500135600000002227014420445767017576 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: vc_multinormal_gen.c * * * * Special generators for MultiNormal distribution * * * ***************************************************************************** * * * Copyright (c) 2000-2007 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include #include "unur_distributions.h" #include "unur_distributions_source.h" /*---------------------------------------------------------------------------*/ /* init routines for special generators */ static int _unur_stdgen_init_multinormal_cholesky( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* abbreviations */ #define PAR ((struct unur_mvstd_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_mvstd_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.cvec /* data for distribution in generator object */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Inititialize **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ int _unur_stdgen_multinormal_init( struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* initialize special generator for multinormal distribution */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* check parameters */ /* the generator does not work correctly when the domain has been truncated*/ if ( gen->distr->set & UNUR_DISTR_SET_DOMAINBOUNDED ) { _unur_error(gen->genid,UNUR_ERR_GEN_CONDITION,"truncated domain not allowed"); return UNUR_FAILURE; } /* set sampling routine */ gen->sample.cvec = _unur_stdgen_sample_multinormal_cholesky; /* set routine name */ GEN->sample_routine_name = "_unur_stdgen_sample_multinormal_cholesky"; /* run special init routine */ return _unur_stdgen_init_multinormal_cholesky(gen); } /* end of _unur_stdgen_multinormal_init() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Special generators **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ /***************************************************************************** * * * MultiNormal Distribution: Cholesky decomposition * * * ***************************************************************************** * * * FUNCTION: - samples a random number from the * * MultiNormal distribution N(mu,sigma). * * * ***************************************************************************** * UNURAN (c) 2007 W. Hoermann & J. Leydold, Institut f. Statistik, WU Wien * *****************************************************************************/ #define NORMAL gen->gen_aux /* pointer to normal variate generator */ /*---------------------------------------------------------------------------*/ int _unur_stdgen_init_multinormal_cholesky( struct unur_gen *gen ) { /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_MVSTD_GEN,UNUR_ERR_COOKIE); /* we do not allow truncated multinormal distributions. */ /* [ currently checked in routine _unur_mvstd_check_par() ] */ /* make a normal variate generator */ if (NORMAL==NULL) { /* make generator object */ struct unur_distr *distr = unur_distr_normal(NULL,0); NORMAL = unur_init( unur_cstd_new( distr ) ); _unur_check_NULL( gen->genid, NORMAL, UNUR_ERR_NULL ); /* use same uniform random number generator */ NORMAL->urng = gen->urng; /* copy debugging flags */ NORMAL->debug = gen->debug; /* we do not need the distribution object any more */ _unur_distr_free( distr ); } /* else we are in the re-init mode --> there is no necessity to make the generator object again */ return UNUR_SUCCESS; } /* end of _unur_stdgen_init_multinormal_cholesky() */ /*---------------------------------------------------------------------------*/ int _unur_stdgen_sample_multinormal_cholesky( struct unur_gen *gen, double *X ) { #define idx(a,b) ((a)*dim+(b)) int j,k; int dim = gen->distr->dim; /* dimension of distribution */ double *L = DISTR.cholesky; /* cholesky factor of covariance matrix */ double *mean = DISTR.mean; /* mean (mode) of distribution */ /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_MVSTD_GEN,UNUR_ERR_COOKIE); /* generate random vector with independent components */ for (j=0; j=0; k--) { X[k] *= L[idx(k,k)]; for (j=k-1; j>=0; j--) X[k] += X[j] * L[idx(k,j)]; X[k] += mean[k]; } return UNUR_SUCCESS; #undef idx } /* end of _unur_stdgen_sample_multinormal_cholesky() */ /*---------------------------------------------------------------------------*/ #undef NORMAL /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/c_weibull.c0000644001357500135600000003047214420445767015662 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: c_weibull.c * * * * REFERENCES: * * * * [2] N.L. Johnson, S. Kotz and N. Balakrishnan * * Continuous Univariate Distributions, * * Volume 1, 2nd edition * * John Wiley & Sons, Inc., New York, 1994 * * * ***************************************************************************** * * * distr: Weibull distribution [2; ch.21, p.628] * * * * pdf: f(x) = ((x-zeta)/alpha)^(c-1) * exp(-((x-zeta)/alpha)^c) * * domain: zeta < x < infinity * * constant: c / alpha * * * * parameters: 3 * * 0: c > 0 ... shape * * 1: alpha > 0 (1) ... scale * * 2: zeta (0) ... location * * * ***************************************************************************** * * * standard form * * * * pdf: f(x) = x^(c-1) * exp(-x^c) * * domain: 0 < x < infinity * * constant: c * * * * parameters: 1 * * 0: c >0 ... shape * * * * 1: alpha = 1 * * 2: zeta = 0 * * * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "unur_distributions.h" #include "unur_distributions_source.h" #include "unur_stddistr.h" /*---------------------------------------------------------------------------*/ static const char distr_name[] = "weibull"; /* parameters */ #define c params[0] #define alpha params[1] #define zeta params[2] #define DISTR distr->data.cont #define NORMCONSTANT (distr->data.cont.norm_constant) /* function prototypes */ static double _unur_pdf_weibull( double x, const UNUR_DISTR *distr ); static double _unur_dpdf_weibull( double x, const UNUR_DISTR *distr ); static double _unur_cdf_weibull( double x, const UNUR_DISTR *distr ); static double _unur_invcdf_weibull( double u, const UNUR_DISTR *distr ); static int _unur_upd_mode_weibull( UNUR_DISTR *distr ); static int _unur_upd_area_weibull( UNUR_DISTR *distr ); static int _unur_set_params_weibull( UNUR_DISTR *distr, const double *params, int n_params ); /*---------------------------------------------------------------------------*/ double _unur_pdf_weibull( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; if (DISTR.n_params > 1) /* standardize */ x = (x - zeta) / alpha; /* standard form */ if (x < 0.) return 0.; if (_unur_iszero(x) && _unur_isone(c)) return NORMCONSTANT; if (_unur_iszero(x) && !_unur_isone(c)) return 0.; /* else */ return (exp (-pow (x, c) + (c-1.) * log (x)) * NORMCONSTANT); } /* end of _unur_pdf_weibull() */ /*---------------------------------------------------------------------------*/ double _unur_dpdf_weibull( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; register double factor = 1.; register double xc; if (DISTR.n_params > 1) { /* standardize */ factor = 1. / alpha; x = (x - zeta) / alpha; } /* standard form */ if (x < 0.) return 0.; if (_unur_iszero(x) && _unur_isone(c)) return 0.; /* else */ xc = -pow (x, c); return (exp (xc + (c-2.) * log (x)) * (-1. - c * (-xc-1.)) * NORMCONSTANT * factor); } /* end of unur_dpdf_weibull() */ /*---------------------------------------------------------------------------*/ double _unur_cdf_weibull( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; if (DISTR.n_params > 1) /* standardize */ x = (x - zeta) / alpha; /* standard form */ if (x <= 0.) return 0.; /* else */ return (1. - exp(-pow (x, c))); } /* end of _unur_cdf_weibull() */ /*---------------------------------------------------------------------------*/ double _unur_invcdf_weibull( double U, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; double X; X = pow( -log(1.-U), 1./c ); return ((DISTR.n_params==1) ? X : zeta + alpha * X ); } /* end of _unur_invcdf_weibull() */ /*---------------------------------------------------------------------------*/ int _unur_upd_mode_weibull( UNUR_DISTR *distr ) { DISTR.mode = (DISTR.c<=1.) ? 0. : DISTR.alpha * pow((DISTR.c - 1.)/DISTR.c, 1./DISTR.c) + DISTR.zeta; /* mode must be in domain */ if (DISTR.mode < DISTR.domain[0]) DISTR.mode = DISTR.domain[0]; else if (DISTR.mode > DISTR.domain[1]) DISTR.mode = DISTR.domain[1]; return UNUR_SUCCESS; } /* end of _unur_upd_mode_weibull() */ /*---------------------------------------------------------------------------*/ int _unur_upd_area_weibull( UNUR_DISTR *distr ) { /* normalization constant */ NORMCONSTANT = DISTR.c / DISTR.alpha; if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.area = 1.; return UNUR_SUCCESS; } /* else */ DISTR.area = ( _unur_cdf_weibull( DISTR.domain[1],distr) - _unur_cdf_weibull( DISTR.domain[0],distr) ); return UNUR_SUCCESS; } /* end of _unur_upd_area_weibull() */ /*---------------------------------------------------------------------------*/ int _unur_set_params_weibull( UNUR_DISTR *distr, const double *params, int n_params ) { /* check number of parameters for distribution */ if (n_params < 1) { _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } if (n_params > 3) { _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); n_params = 3; } CHECK_NULL(params,UNUR_ERR_NULL); /* check parameter c */ if (c <= 0.) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"c <= 0"); return UNUR_ERR_DISTR_DOMAIN; } /* check parameter alpha */ if (n_params > 1 && alpha <= 0.) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"alpha <= 0"); return UNUR_ERR_DISTR_DOMAIN; } /* copy parameters for standard form */ DISTR.c = c; /* default parameters */ DISTR.alpha = 1.; DISTR.zeta = 0.; /* copy optional parameters */ switch (n_params) { case 3: DISTR.zeta = zeta; /* FALLTHROUGH */ case 2: DISTR.alpha = alpha; n_params = 3; /* number of parameters for non-standard form */ /* FALLTHROUGH */ default: break; } /* store number of parameters */ DISTR.n_params = n_params; /* set (standard) domain */ if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.domain[0] = DISTR.zeta; /* left boundary */ DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ } return UNUR_SUCCESS; } /* end of _unur_set_params_weibull() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_weibull( const double *params, int n_params ) { register struct unur_distr *distr; /* get new (empty) distribution object */ distr = unur_distr_cont_new(); /* set distribution id */ distr->id = UNUR_DISTR_WEIBULL; /* name of distribution */ distr->name = distr_name; /* how to get special generators */ /* DISTR.init = _unur_stdgen_weibull_init; */ /* functions */ DISTR.pdf = _unur_pdf_weibull; /* pointer to PDF */ DISTR.dpdf = _unur_dpdf_weibull; /* pointer to derivative of PDF */ DISTR.cdf = _unur_cdf_weibull; /* pointer to CDF */ DISTR.invcdf = _unur_invcdf_weibull; /* pointer to inverse CDF */ /* indicate which parameters are set */ distr->set = ( UNUR_DISTR_SET_DOMAIN | UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_MODE | UNUR_DISTR_SET_PDFAREA ); /* set parameters for distribution */ if (_unur_set_params_weibull(distr,params,n_params)!=UNUR_SUCCESS) { free(distr); return NULL; } /* normalization constant */ NORMCONSTANT = DISTR.c / DISTR.alpha; /* mode and area below p.d.f. */ DISTR.mode = (DISTR.c<=1.) ? 0. : DISTR.alpha * pow((DISTR.c - 1.)/DISTR.c, 1./DISTR.c) + DISTR.zeta; DISTR.area = 1.; /* function for setting parameters and updating domain */ DISTR.set_params = _unur_set_params_weibull; /* function for updating derived parameters */ DISTR.upd_mode = _unur_upd_mode_weibull; /* funct for computing mode */ DISTR.upd_area = _unur_upd_area_weibull; /* funct for computing area */ /* return pointer to object */ return distr; } /* end of unur_distr_weibull() */ /*---------------------------------------------------------------------------*/ #undef c #undef alpha #undef zeta #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/d_zipf.c0000644001357500135600000002251214420445767015164 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: d_zipf.c * * * * REFERENCES: * * * * [1] N.L. Johnson, S. Kotz and A.W. Kemp * * Univariate Discrete Distributions, * * 2nd edition * * John Wiley & Sons, Inc., New York, 1992 * * * ***************************************************************************** * * * distr: Zipf distribution (or Zeta distribution) [1; ch.11.20, p.465] * * * * pmf: p(k) = (k + tau)^(-(rho+1)) * * domain: 1 <= k < infinity * * constant: 1 / sum_k=1^infinity (k+tau)^(rho+1) * * [ zeta(a) = sum_1^infinity (x^a) ... Riemann zeta function ] * * * * parameters: * * 0: rho > 0 ... shape * * 1: tau >= 0 * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "unur_distributions.h" #include "unur_distributions_source.h" #include "unur_stddistr.h" /*---------------------------------------------------------------------------*/ static const char distr_name[] = "zipf"; /* parameters */ #define rho params[0] #define tau params[1] #define DISTR distr->data.discr /* #define NORMCONSTANT (distr->data.discr.norm_constant) */ /*---------------------------------------------------------------------------*/ /* no CDF */ #undef HAVE_CDF /* no normalization constant */ #undef HAVE_SUM /*---------------------------------------------------------------------------*/ /* function prototypes */ static double _unur_pmf_zipf( int k, const UNUR_DISTR *distr ); #ifdef HAVE_CDF static double _unur_cdf_zipf( int k, const UNUR_DISTR *distr ); #endif static int _unur_upd_mode_zipf( UNUR_DISTR *distr ); #ifdef HAVE_SUM static int _unur_upd_sum_zipf( UNUR_DISTR *distr ); #endif static int _unur_set_params_zipf( UNUR_DISTR *distr, const double *params, int n_params ); /*---------------------------------------------------------------------------*/ double _unur_pmf_zipf(int k, const UNUR_DISTR *distr) { return ((k<1) ? 0. : exp( log(k + DISTR.tau) * (-DISTR.rho - 1.) ) ); } /* end of _unur_pmf_zipf() */ /*---------------------------------------------------------------------------*/ #ifdef HAVE_CDF double _unur_cdf_zipf(int k, const UNUR_DISTR *distr) { /** TODO: CDF **/ return ((k<1) ? 0. : 1.); } /* end of _unur_cdf_zipf() */ #endif /*---------------------------------------------------------------------------*/ int _unur_upd_mode_zipf( UNUR_DISTR *distr ) { DISTR.mode = 1; /* mode must be in domain */ if (DISTR.mode < DISTR.domain[0]) DISTR.mode = DISTR.domain[0]; else if (DISTR.mode > DISTR.domain[1]) DISTR.mode = DISTR.domain[1]; /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_upd_mode_zipf() */ /*---------------------------------------------------------------------------*/ #ifdef HAVE_SUM int _unur_upd_sum_zipf( UNUR_DISTR *distr ) { /* log normalization constant */ /** TODO: sum **/ if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.sum = 1.; return UNUR_SUCCESS; } #ifdef HAVE_CDF /* else */ DISTR.sum = ( _unur_cdf_zipf( DISTR.domain[1],distr) - _unur_cdf_zipf( DISTR.domain[0]-1,distr) ); return UNUR_SUCCESS; #else return UNUR_ERR_DISTR_REQUIRED; #endif } /* end of _unur_upd_sum_zipf() */ #endif /*---------------------------------------------------------------------------*/ int _unur_set_params_zipf( UNUR_DISTR *distr, const double *params, int n_params ) { /* check number of parameters for distribution */ if (n_params < 1) { _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } if (n_params > 2) { _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); n_params = 2; } CHECK_NULL(params,UNUR_ERR_NULL); /* check parameter rho */ if (rho <= 0.) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"rho <= 0"); return UNUR_ERR_DISTR_DOMAIN; } /* check parameter tau */ if (n_params > 1 && tau < 0.) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"tau < 0"); return UNUR_ERR_DISTR_DOMAIN; } /* copy parameters for standard form */ DISTR.rho = rho; /* default parameters */ DISTR.tau = 0.; /* copy optional parameters */ if (n_params == 2) DISTR.tau = tau; /* store total number of parameters */ DISTR.n_params = 2; /* set (standard) domain: [1, infinity] */ if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.domain[0] = 1; /* left boundary */ DISTR.domain[1] = INT_MAX; /* right boundary */ } return UNUR_SUCCESS; } /* end of _unur_set_params_zipf() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_zipf( const double *params, int n_params ) { register struct unur_distr *distr; /* get new (empty) distribution object */ distr = unur_distr_discr_new(); /* set distribution id */ distr->id = UNUR_DISTR_ZIPF; /* name of distribution */ distr->name = distr_name; /* how to get special generators */ DISTR.init = _unur_stdgen_zipf_init; /* functions */ DISTR.pmf = _unur_pmf_zipf; /* pointer to PMF */ #ifdef HAVE_CDF DISTR.cdf = _unur_cdf_zipf; /* pointer to CDF */ #endif /* indicate which parameters are set */ distr->set = ( UNUR_DISTR_SET_DOMAIN | UNUR_DISTR_SET_STDDOMAIN | #ifdef HAVE_SUM UNUR_DISTR_SET_PMFSUM | #endif UNUR_DISTR_SET_MODE ); /* set parameters for distribution */ if (_unur_set_params_zipf(distr,params,n_params)!=UNUR_SUCCESS) { free(distr); return NULL; } /* log of normalization constant */ /* mode and sum over PMF */ DISTR.mode = 1; DISTR.sum = 1.; /* function for setting parameters and updating domain */ DISTR.set_params = _unur_set_params_zipf; /* function for updating derived parameters */ DISTR.upd_mode = _unur_upd_mode_zipf; /* funct for computing mode */ #ifdef HAVE_SUM DISTR.upd_sum = _unur_upd_sum_zipf; /* funct for computing area */ #endif /* return pointer to object */ return distr; } /* end of unur_distr_zipf() */ /*---------------------------------------------------------------------------*/ #undef rho #undef tau #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/c_gamma.c0000644001357500135600000003676614420445767015315 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: c_gamma.c * * * * REFERENCES: * * * * [2] N.L. Johnson, S. Kotz and N. Balakrishnan * * Continuous Univariate Distributions, * * Volume 1, 2nd edition * * John Wiley & Sons, Inc., New York, 1994 * * * ***************************************************************************** * * * distr: Gamma distribution [2; ch.17, p.337] * * * * pdf: f(x) = ((x-gamma)/beta)^(alpha-1) * exp( -(x-gamma)/beta ) * * domain: x > gamma * * constant: 1 / (beta * Gamma(alpha)) * * * * parameters: * * 0: alpha > 0 ... shape * * 1: beta > 0 (1) ... scale * * 2: gamma (0) ... location * * * ***************************************************************************** * * * standard form * * * * pdf: f(x) = x^(alpha-1) * exp(-x) * * domain: x > 0 * * constant: Gamma(alpha) * * * * parameters: * * 0: alpha > 0 ... shape * * * * 1: beta = 1 * * 2: gamma = 0 * * * ***************************************************************************** * * * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "unur_distributions.h" #include "unur_distributions_source.h" #include "unur_stddistr.h" /*---------------------------------------------------------------------------*/ static const char distr_name[] = "gamma"; /*---------------------------------------------------------------------------*/ /* parameters */ #define alpha params[0] /* shape */ #define beta params[1] /* scale */ #define gamma params[2] /* location */ /*---------------------------------------------------------------------------*/ #define DISTR distr->data.cont #define LOGNORMCONSTANT (distr->data.cont.norm_constant) /*---------------------------------------------------------------------------*/ /* function prototypes */ static double _unur_pdf_gamma( double x, const UNUR_DISTR *distr ); static double _unur_logpdf_gamma( double x, const UNUR_DISTR *distr ); static double _unur_dpdf_gamma( double x, const UNUR_DISTR *distr ); static double _unur_dlogpdf_gamma( double x, const UNUR_DISTR *distr ); static double _unur_cdf_gamma( double x, const UNUR_DISTR *distr ); #ifdef _unur_SF_invcdf_gamma static double _unur_invcdf_gamma( double x, const UNUR_DISTR *distr ); #endif static int _unur_upd_mode_gamma( UNUR_DISTR *distr ); static int _unur_upd_area_gamma( UNUR_DISTR *distr ); static double _unur_lognormconstant_gamma(const double *params, int n_params); static int _unur_set_params_gamma( UNUR_DISTR *distr, const double *params, int n_params ); /*---------------------------------------------------------------------------*/ double _unur_pdf_gamma( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; if (DISTR.n_params > 1) /* standardize */ x = (x-gamma) / beta; /* standard form */ if (_unur_isone(alpha) && x >= 0.) return exp( -x - LOGNORMCONSTANT); if (x > 0.) /* pow(x,alpha-1.) * exp(-x) */ return exp( (alpha-1.)*log(x) - x - LOGNORMCONSTANT); if (_unur_iszero(x)) return (alpha>1. ? 0. : UNUR_INFINITY); /* out of domain */ return 0.; } /* end of _unur_pdf_gamma() */ /*---------------------------------------------------------------------------*/ double _unur_logpdf_gamma( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; if (DISTR.n_params > 1) /* standardize */ x = (x-gamma) / beta; /* standard form */ if (_unur_isone(alpha) && x >= 0.) return ( -x - LOGNORMCONSTANT); if (x > 0.) return ( (alpha-1.)*log(x) - x - LOGNORMCONSTANT); if (_unur_iszero(x)) return (alpha>1. ? -UNUR_INFINITY : UNUR_INFINITY); /* out of domain */ return -UNUR_INFINITY; } /* end of _unur_logpdf_gamma() */ /*---------------------------------------------------------------------------*/ double _unur_dpdf_gamma( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; if (DISTR.n_params > 1) /* standardize */ x = (x-gamma) / beta; /* standard form */ if (_unur_isone(alpha) && x>=0) return( -exp(-x - LOGNORMCONSTANT) / beta ); if (x > 0.) return ( exp( log(x) * (alpha-2.) - x - LOGNORMCONSTANT) * ((alpha-1.) -x) / beta ); if (_unur_iszero(x) && alpha < 2.) return (alpha>1. ? UNUR_INFINITY : -UNUR_INFINITY); /* out of domain */ return 0.; } /* end of _unur_dpdf_gamma() */ /*---------------------------------------------------------------------------*/ double _unur_dlogpdf_gamma( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; if (DISTR.n_params > 1) /* standardize */ x = (x-gamma) / beta; /* standard form */ if (_unur_isone(alpha) && x >= 0.) return -1./beta; if (x > 0.) return ((alpha-1.)/x - 1)/beta; if (_unur_iszero(x)) return (alpha>1. ? UNUR_INFINITY : -UNUR_INFINITY); /* out of domain */ return 0.; } /* end of _unur_dlogpdf_gamma() */ /*---------------------------------------------------------------------------*/ double _unur_cdf_gamma( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; if (DISTR.n_params > 1) /* standardize */ x = (x-gamma) / beta; /* standard form */ if (x <= 0.) return 0.; if (_unur_isinf(x)==1) return 1.; return _unur_SF_incomplete_gamma(x,alpha); } /* end of _unur_cdf_gamma() */ /*---------------------------------------------------------------------------*/ #ifdef _unur_SF_invcdf_gamma double _unur_invcdf_gamma( double x, const UNUR_DISTR *distr ) { const double *params = DISTR.params; if (DISTR.n_params == 1) return _unur_SF_invcdf_gamma(x, alpha, 1.); else return (gamma + _unur_SF_invcdf_gamma(x, alpha, beta)); } /* end of _unur_invcdf_gamma() */ #endif /*---------------------------------------------------------------------------*/ int _unur_upd_mode_gamma( UNUR_DISTR *distr ) { register double *params = DISTR.params; DISTR.mode = (alpha >= 1.) ? (alpha - 1.) : 0.; if (DISTR.n_params > 1) /* de-standardize */ DISTR.mode = DISTR.mode * beta + gamma; /* mode must be in domain */ if (DISTR.mode < DISTR.domain[0]) DISTR.mode = DISTR.domain[0]; else if (DISTR.mode > DISTR.domain[1]) DISTR.mode = DISTR.domain[1]; /* for shape parameters less than 1 we also should set */ /* the center of the distribution to some value > 0. */ if (alpha < 1.) { double center = alpha * beta + gamma; center = _unur_max(center,DISTR.domain[0]); center = _unur_min(center,DISTR.domain[1]); unur_distr_cont_set_center(distr,center); } return UNUR_SUCCESS; } /* end of _unur_upd_mode_gamma() */ /*---------------------------------------------------------------------------*/ int _unur_upd_area_gamma( UNUR_DISTR *distr ) { /* log of normalization constant */ LOGNORMCONSTANT = _unur_lognormconstant_gamma(DISTR.params,DISTR.n_params); if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.area = 1.; return UNUR_SUCCESS; } /* else */ DISTR.area = ( _unur_cdf_gamma( DISTR.domain[1],distr) - _unur_cdf_gamma( DISTR.domain[0],distr) ); return UNUR_SUCCESS; } /* end of _unur_upd_area_gamma() */ /*---------------------------------------------------------------------------*/ double _unur_lognormconstant_gamma( const double *params, int n_params ) { if (n_params > 1) /* non-standard form */ return ( _unur_SF_ln_gamma(alpha) + log(beta) ); else /* standard form */ return (_unur_SF_ln_gamma(alpha)); } /* end of _unur_lognormconstant_gamma() */ /*---------------------------------------------------------------------------*/ int _unur_set_params_gamma( UNUR_DISTR *distr, const double *params, int n_params ) { /* check number of parameters for distribution */ if (n_params < 1) { _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } if (n_params > 3) { _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); n_params = 3; } CHECK_NULL(params,UNUR_ERR_NULL); /* check parameter alpha */ if (alpha <= 0.) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"alpha <= 0."); return UNUR_ERR_DISTR_DOMAIN; } /* check parameter beta */ if (n_params > 1 && beta <= 0.) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"beta <= 0."); return UNUR_ERR_DISTR_DOMAIN; } /* copy parameters for standard form */ DISTR.alpha = alpha; /* default parameters */ DISTR.beta = 1.; DISTR.gamma = 0.; /* copy optional parameters */ switch (n_params) { case 3: DISTR.gamma = gamma; /* FALLTHROUGH */ case 2: DISTR.beta = beta; n_params = 3; /* number of parameters for non-standard form */ /* FALLTHROUGH */ default: break; } /* store number of parameters */ DISTR.n_params = n_params; /* set (standard) domain */ if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.domain[0] = DISTR.gamma; /* left boundary */ DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ } return UNUR_SUCCESS; } /* end of _unur_set_params_gamma() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Make distribution object **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_gamma( const double *params, int n_params ) { register struct unur_distr *distr; /* get new (empty) distribution object */ distr = unur_distr_cont_new(); /* set distribution id */ distr->id = UNUR_DISTR_GAMMA; /* name of distribution */ distr->name = distr_name; /* how to get special generators */ DISTR.init = _unur_stdgen_gamma_init; /* functions */ DISTR.pdf = _unur_pdf_gamma; /* pointer to PDF */ DISTR.logpdf = _unur_logpdf_gamma; /* pointer to logPDF */ DISTR.dpdf = _unur_dpdf_gamma; /* pointer to derivative of PDF */ DISTR.dlogpdf = _unur_dlogpdf_gamma; /* pointer to derivative of logPDF */ DISTR.cdf = _unur_cdf_gamma; /* pointer to CDF */ #ifdef _unur_SF_invcdf_gamma DISTR.invcdf = _unur_invcdf_gamma; /* pointer to inverse CDF */ #endif /* indicate which parameters are set */ distr->set = ( UNUR_DISTR_SET_DOMAIN | UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_PDFAREA | UNUR_DISTR_SET_MODE ); /* set parameters for distribution */ if (_unur_set_params_gamma(distr,params,n_params)!=UNUR_SUCCESS) { free(distr); return NULL; } /* log of normalization constant */ LOGNORMCONSTANT = _unur_lognormconstant_gamma(DISTR.params,DISTR.n_params); /* mode and area below p.d.f. */ _unur_upd_mode_gamma( distr ); DISTR.area = 1.; /* function for setting parameters and updating domain */ DISTR.set_params = _unur_set_params_gamma; /* function for updating derived parameters */ DISTR.upd_mode = _unur_upd_mode_gamma; /* funct for computing mode */ DISTR.upd_area = _unur_upd_area_gamma; /* funct for computing area */ /* return pointer to object */ return distr; } /* end of unur_distr_gamma() */ /*---------------------------------------------------------------------------*/ #undef alpha #undef beta #undef gamma #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/c_student_gen.c0000644001357500135600000002754114420445767016541 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: c_student_gen.c * * * * Special generators for Student's t distribution * * * ***************************************************************************** * * * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "unur_distributions_source.h" /*---------------------------------------------------------------------------*/ /* init routines for special generators */ inline static int student_trouo_init( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* abbreviations */ #define PAR ((struct unur_cstd_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_cstd_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.cont /* data for distribution in generator object */ /* #define MAX_gen_params (6) maximal number of parameters for generator */ #define uniform() _unur_call_urng(gen->urng) /* call for uniform prng */ #define nu (DISTR.params[0]) /* shape (degrees of freedom) */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Inititialize **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ int _unur_stdgen_student_init( struct unur_par *par, struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* initialize special generator for Student's distribution */ /* if gen == NULL then only check existance of variant. */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* one of par and gen must not be the NULL pointer */ switch ((par) ? par->variant : gen->variant) { case 0: /* DEFAULT */ case 1: /* Polar Method */ _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_student_tpol ); return UNUR_SUCCESS; case 2: /* Ratio of Uniforms */ if (par!=NULL && par->distr->data.cont.params[0] < 1.) { /* nu < 1 */ _unur_error(NULL,UNUR_ERR_GEN_CONDITION,""); return UNUR_ERR_GEN_CONDITION; } /* nu >= 1 !!!! */ _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_student_trouo ); return student_trouo_init( gen ); default: /* no such generator */ return UNUR_FAILURE; } } /* end of _unur_stdgen_chi_init() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Special generators **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ /***************************************************************************** * * * Student's t Distribution: Polar Method * * * ***************************************************************************** * * * FUNCTION: - samples a random number from Student's t distribution with * * parameters nu > 0. * * * * REFERENCE: - R.W. Bailey (1994): Polar generation of random variates * * with the t-distribution, * * Mathematics of Computation 62, 779-781. * * * * Implemented by F. Niederl, 1994 * ***************************************************************************** * * * The polar method of Box/Muller for generating Normal variates is adapted * * to the Student-t distribution. The two generated variates are not * * independent and the expected no. of uniforms per variate is 2.5464. * * * ***************************************************************************** * WinRand (c) 1995 Ernst Stadlober, Institut fuer Statistitk, TU Graz * *****************************************************************************/ double _unur_stdgen_sample_student_tpol( struct unur_gen *gen ) { /* -X- generator code -X- */ double u,v,w; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); do { u = 2. * uniform() - 1.; v = 2. * uniform() - 1.; w = u * u + v * v; } while (w > 1.); return(u * sqrt( nu * ( exp(- 2. / nu * log(w)) - 1.) / w)); /* -X- end of generator code -X- */ } /* end of _unur_stdgen_sample_student_tpol() */ /*---------------------------------------------------------------------------*/ /***************************************************************************** * * * Student's t Distribution: Ratio of Uniforms * * * ***************************************************************************** * * * FUNCTION: - samples a random number from Student's t distribution with * * parameters nu >= 1. * * * * REFERENCE: - A.J. Kinderman, J.F. Monahan (1980): * * New methods for generating Student's t and gamma variables, * * Computing 25, 369-377. * * * * Implemented by R. Kremer, 1990 * ***************************************************************************** * WinRand (c) 1995 Ernst Stadlober, Institut fuer Statistitk, TU Graz * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #define GEN_N_PARAMS (6) #define c (GEN->gen_param[0]) #define e (GEN->gen_param[1]) #define p (GEN->gen_param[2]) #define q (GEN->gen_param[3]) #define r (GEN->gen_param[4]) #define vm (GEN->gen_param[5]) /*---------------------------------------------------------------------------*/ inline static int student_trouo_init( struct unur_gen *gen ) { /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_ERR_COOKIE); if (GEN->gen_param == NULL || GEN->n_gen_param != GEN_N_PARAMS) { GEN->n_gen_param = GEN_N_PARAMS; GEN->gen_param = _unur_xrealloc(GEN->gen_param, GEN->n_gen_param * sizeof(double)); } /* -X- setup code -X- */ if (nu < 1.) { _unur_error(NULL,UNUR_ERR_GEN_CONDITION,""); return UNUR_ERR_GEN_CONDITION; } r = 1. / nu; p = 1. / (1. + r); q = -0.25 * (nu + 1.); c = 4. * pow(p, q); e = 16. / c; vm = (nu>1.0) ? sqrt(p+p) * pow( (1.-r)*p, 0.25*(nu-1.) ) : 1.; /* -X- end of setup code -X- */ return UNUR_SUCCESS; } /* end of student_trouo_init() */ double _unur_stdgen_sample_student_trouo( struct unur_gen *gen ) { /* -X- generator code -X- */ double tru,u,v; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); while (1) { /* step 1 */ u = uniform(); /* step 2 */ v = uniform(); v = vm * (v + v - 1.); tru = v / u; /* step 3 */ if ( c * u <= 5. - tru * tru) break; if (nu >= 3.) if (u * (tru * tru + 3.) >= e) continue; /* goto 1 */ /* step 4 */ if ( u <= pow(1. + tru * tru * r, q)) break; } return tru; } /* end of _unur_stdgen_sample_student_trouo() */ /*---------------------------------------------------------------------------*/ #undef GEN_N_PARAMS #undef c #undef e #undef p #undef q #undef r #undef vm /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/Makefile.am0000644001357500135600000000253714420445767015606 00000000000000## Process this file with automake to produce Makefile.in AM_CPPFLAGS = \ -I$(top_srcdir)/src noinst_LTLIBRARIES = libdistributions.la libdistributions_la_SOURCES = \ c_beta.c c_beta_gen.c \ c_burr.c \ c_cauchy.c \ c_chi.c c_chi_gen.c \ c_chisquare.c \ c_exponential.c c_exponential_gen.c \ c_extremeI.c \ c_extremeII.c \ c_F.c \ c_gamma.c c_gamma_gen.c \ c_ghyp.c \ c_gig.c c_gig_gen.c \ c_gig2.c \ c_hyperbolic.c \ c_ig.c \ c_laplace.c \ c_logistic.c \ c_lognormal.c \ c_lomax.c \ c_meixner.c \ c_normal.c c_normal_gen.c \ c_pareto.c \ c_powerexponential.c c_powerexponential_gen.c \ c_rayleigh.c \ c_slash.c c_slash_gen.c \ c_student.c c_student_gen.c \ c_triangular.c \ c_uniform.c \ c_vg.c \ c_weibull.c \ d_binomial.c d_binomial_gen.c \ d_geometric.c \ d_hypergeometric.c d_hypergeometric_gen.c \ d_logarithmic.c d_logarithmic_gen.c \ d_negativebinomial.c \ d_poisson.c d_poisson_gen.c \ d_zipf.c d_zipf_gen.c \ m_correlation.c \ vc_copula.c \ vc_multicauchy.c \ vc_multiexponential.c \ vc_multinormal.c vc_multinormal_gen.c \ vc_multistudent.c noinst_HEADERS = \ unur_distributions.h \ unur_distributions_source.h \ unur_stddistr.h EXTRA_DIST = \ README # clean backup files CLEANFILES = *~ # clean generated files MAINTAINERCLEANFILES = \ Makefile.in unuran-1.11.0/src/distributions/d_hypergeometric_gen.c0000644001357500135600000003606114420445767020077 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: d_hypergeometric_gen.c * * * * Special generators for Hypergeometric distribution * * * ***************************************************************************** * * * Copyright (c) 2000-2011 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include /* for the definition of `UNUR_STDGEN_INVERSION' */ #include #include "unur_distributions_source.h" /*---------------------------------------------------------------------------*/ /* init routines for special generators */ /*---------------------------------------------------------------------------*/ /* abbreviations */ #define PAR ((struct unur_dstd_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_dstd_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.discr /* data for distribution in generator object */ #define uniform() _unur_call_urng(gen->urng) /* call for uniform prng */ /* #define MAX_gen_params (8) maximal number of parameters for generator */ /* #define MAX_gen_iparams (9) maximal number of integer parameters for generator */ /* parameters */ #define par_N (DISTR.params[0]) #define par_M (DISTR.params[1]) #define par_n (DISTR.params[2]) /*---------------------------------------------------------------------------*/ /* init routines for special generators */ inline static int hypergeometric_hruec_init( struct unur_gen *gen ); static int _unur_stdgen_sample_hypergeometric_hruec( struct unur_gen *gen ); inline static int h_util(int N_, int M_, int n_, int k_); /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Inititialize **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ int _unur_stdgen_hypergeometric_init( struct unur_par *par, struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* initialize special generator for Hypergeometric distribution */ /* if gen == NULL then only check existance of variant. */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* one of par and gen must not be the NULL pointer */ switch ((par) ? par->variant : gen->variant) { case 0: /* DEFAULT */ case 1: /* HRUEC method */ _unur_dstd_set_sampling_routine(gen, _unur_stdgen_sample_hypergeometric_hruec ); return hypergeometric_hruec_init( gen ); default: /* no such generator */ return UNUR_FAILURE; } } /* end of _unur_stdgen_hypergeometric_init() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Special generators **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ /***************************************************************************** * * * Hypergeometric Distribution - Ratio of Uniforms/Inversion * * * ***************************************************************************** * * * Ratio of Uniforms combined with Inversion for sampling from * * Hypergeometric distributions with parameters N, M and n. The algorithm * * is valid for M <= N/2, n <= N/2. Otherwise parameters (at the beginning * * of the algorithm) and random numbers k are adapted in function h_util(). * * For mode m < 5 Inversion is applied: * * The random numbers are generated via sequential search, starting at the * * lowest index k=0. The cumulative probabilities are avoided by using the * * technique of chop-down. * * For mode m >=5 Ratio of Uniforms is employed: A table mountain hat * * function h(x) with optimal scale parameter s for fixed location * * parameter a = mu+1/2 is used. * * If the mode m <= 20 and the candidate k is near the mode f(k) is * * computed recursively starting at the mode m. * * * ***************************************************************************** * * * FUNCTION: - hruec samples a random number from the Hypergeometric * * distribution with parameters N (number of red and * * black balls), M (number of red balls) and n (number of * * trials) valid for N >= 2, M,n <= N. * * REFERENCE: - E. Stadlober (1989): Sampling from Poisson, binomial and * * hypergeometric distributions: ratio of uniforms as a * * simple and fast alternative, * * Bericht 303, Math. Stat. Sektion, * * Forschungsgesellschaft Joanneum, Graz. * * * * Implemented by R.Kremer 1990, revised by P.Busswald, July 1992 * ***************************************************************************** * WinRand (c) 1995 Ernst Stadlober, Institut fuer Statistitk, TU Graz * *****************************************************************************/ #define flogfak(k) (_unur_SF_ln_factorial(k)) #define delta(k) (flogfak(k)+flogfak(Mc-k)+flogfak(nc-k)+flogfak(NMn+k)) /*---------------------------------------------------------------------------*/ #define GEN_N_IPARAMS (9) #define GEN_N_PARAMS (8) #define N (GEN->gen_iparam[0]) #define M (GEN->gen_iparam[1]) #define n (GEN->gen_iparam[2]) #define b (GEN->gen_iparam[3]) #define m (GEN->gen_iparam[4]) #define NMn (GEN->gen_iparam[5]) #define Mc (GEN->gen_iparam[6]) #define nc (GEN->gen_iparam[7]) #define N_half (GEN->gen_iparam[8]) #define NMnp (GEN->gen_param[0]) #define Np (GEN->gen_param[1]) #define Mp (GEN->gen_param[2]) #define np (GEN->gen_param[3]) #define g (GEN->gen_param[4]) #define a (GEN->gen_param[5]) #define h (GEN->gen_param[6]) #define p0 (GEN->gen_param[7]) /*---------------------------------------------------------------------------*/ int hypergeometric_hruec_init( struct unur_gen *gen ) { int k1,bh; double x,p,q,c,my; /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_DSTD_GEN,UNUR_ERR_COOKIE); if (GEN->gen_param == NULL || GEN->n_gen_param != GEN_N_PARAMS) { GEN->n_gen_param = GEN_N_PARAMS; GEN->gen_param = _unur_xrealloc(GEN->gen_param, GEN->n_gen_param * sizeof(double)); } if (GEN->gen_iparam == NULL || GEN->n_gen_iparam != GEN_N_IPARAMS) { GEN->n_gen_iparam = GEN_N_IPARAMS; GEN->gen_iparam = _unur_xrealloc(GEN->gen_iparam, GEN->n_gen_iparam * sizeof(int)); } /* convert integer parameters that are stored in an array of type 'double' */ /* into those of type 'int' and store it in working array GEN->gen_iparam. */ N = (int) par_N; M = (int) par_M; n = (int) par_n; /* -X- setup code -X- */ N_half = N/2; /* Preparations of the parameters */ Mc = (M<=N_half) ? M : N-M; /* if M<=N/2, M is replaced by N-M */ nc = (n<=N_half) ? n : N-n; /* if n<=N/2, n is replaced by n-M */ /* Set-up */ Np = (double) N; Mp = (double) Mc; np = (double) nc; NMn = N - Mc - nc; NMnp = Np - Mp - np; p = Mp / Np; q = 1.0 - p; my = np * p; bh = _unur_min(nc,Mc); m = (int) ((np+1.0)*(Mp+1.0)/(Np+2.0)); /* mode */ if (m < 5) { /* Set-up for Inversion */ c = my + 10.0*sqrt(my*q*(1.0-np/Np)); b = _unur_min(bh,(int)c); /* safety-bound */ p0 = exp(flogfak(N-Mc)+flogfak(N-nc)-flogfak(NMn)-flogfak(N)); /* initialize (unused) variables */ h = a = g = 0.; } else { /* Set-up for Ratio of Uniforms */ a = my+0.5; c = sqrt(2.0*a*q*(1.0-np/Np)); b = _unur_min(bh,(int)(a+7.0*c)); /* safety-bound */ g = delta(m); k1 = (int)(a-c); x = (a-k1-1.0)/(a-k1); if((np-k1)*(p-(double)k1/Np)*x*x > (k1+1)*(q-(np-k1-1.0)/Np)) k1++; h = (a-k1)*exp(0.5*(g-delta(k1))+M_LN2); /* h=2*s */ /* initialize (unused) variables */ p0 = 0.; } /* -X- end of setup code -X- */ return UNUR_SUCCESS; } /* end of hypergeometric_hruec_init() */ /*---------------------------------------------------------------------------*/ int _unur_stdgen_sample_hypergeometric_hruec( struct unur_gen *gen ) { int k,i; double x,u,f,lf; /* check arguments */ CHECK_NULL(gen,INT_MAX); COOKIE_CHECK(gen,CK_DSTD_GEN,INT_MAX); /* -X- generator code -X- */ if (m<5) { /* Inversion/Chop-down */ double pk; k = 0; pk = p0; u = uniform(); while (u>pk) { ++k; if (k>b) { u = uniform(); k = 0; pk = p0; } else { u -= pk; pk *= ((Mp-k+1.0)*(np-k+1.0)) / ((double)k*(NMnp+k)); } } return (h_util(N,M,n,k)); } for (;;) { /* Ratio of Uniforms */ do { u = uniform(); x = a + h*(uniform()-0.5) / u; } while (x < 0 || ((k=(int)x) > b)); /* check, if k is valid candidate */ if (m <= 20 || abs(m-k) <= 15) { /* compute f(k) recursively */ f = 1.0; if (m 0 (1) ... scale * * * ***************************************************************************** * * * standard form * * * * pdf: f(x) = exp(-x) * (1 + exp(-x))^(-2) * * cdf: F(x) = (1 + exp(-x))^(-1) * * domain: infinity < x < infinity * * constant: 1 * * * * parameters: none * * * * 0: alpha = 0 * * 1: beta = 1 * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "unur_distributions.h" #include "unur_distributions_source.h" #include "unur_stddistr.h" /*---------------------------------------------------------------------------*/ static const char distr_name[] = "logistic"; /* parameters */ #define alpha params[0] #define beta params[1] #define DISTR distr->data.cont #define NORMCONSTANT (distr->data.cont.norm_constant) /* function prototypes */ static double _unur_pdf_logistic( double x, const UNUR_DISTR *distr ); static double _unur_dpdf_logistic( double x, const UNUR_DISTR *distr ); static double _unur_cdf_logistic( double x, const UNUR_DISTR *distr ); static double _unur_invcdf_logistic( double u, const UNUR_DISTR *distr ); static int _unur_upd_mode_logistic( UNUR_DISTR *distr ); static int _unur_upd_area_logistic( UNUR_DISTR *distr ); static int _unur_set_params_logistic( UNUR_DISTR *distr, const double *params, int n_params ); /*---------------------------------------------------------------------------*/ double _unur_pdf_logistic( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; register double ex; if (DISTR.n_params > 0) /* standardize */ x = (x - alpha) / beta; /* standard form */ ex = exp( -fabs(x) ); return (NORMCONSTANT * ex / ((1. + ex) * (1. + ex))); } /* end of _unur_pdf_logistic() */ /*---------------------------------------------------------------------------*/ double _unur_dpdf_logistic( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; register double factor = 1.; register double ex; if (DISTR.n_params > 0) { /* standardize */ factor = 1. / beta; x = (x - alpha) / beta; } /* standard form */ ex = exp(-fabs(x)); if (x<0) factor = -factor; return (factor * NORMCONSTANT * ex * (ex - 1.) / ((1.+ex)*(1.+ex)*(1.+ex))); } /* end of unur_dpdf_logistic() */ /*---------------------------------------------------------------------------*/ double _unur_cdf_logistic( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; if (DISTR.n_params > 0) /* standardize */ x = (x - alpha) / beta; /* standard form */ return ( 1. / (1. + exp(-x)) ); } /* end of _unur_cdf_logistic() */ /*---------------------------------------------------------------------------*/ double _unur_invcdf_logistic( double U, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; double X; X = -log(1./U - 1.); return ((DISTR.n_params==0) ? X : alpha + beta * X ); } /* end of _unur_invcdf_logistic() */ /*---------------------------------------------------------------------------*/ int _unur_upd_mode_logistic( UNUR_DISTR *distr ) { DISTR.mode = DISTR.alpha; /* mode must be in domain */ if (DISTR.mode < DISTR.domain[0]) DISTR.mode = DISTR.domain[0]; else if (DISTR.mode > DISTR.domain[1]) DISTR.mode = DISTR.domain[1]; return UNUR_SUCCESS; } /* end of _unur_upd_mode_logistic() */ /*---------------------------------------------------------------------------*/ int _unur_upd_area_logistic( UNUR_DISTR *distr ) { /* normalization constant */ NORMCONSTANT = 1. / DISTR.beta; if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.area = 1.; return UNUR_SUCCESS; } /* else */ DISTR.area = ( _unur_cdf_logistic( DISTR.domain[1],distr) - _unur_cdf_logistic( DISTR.domain[0],distr) ); return UNUR_SUCCESS; } /* end of _unur_upd_area_logistic() */ /*---------------------------------------------------------------------------*/ int _unur_set_params_logistic( UNUR_DISTR *distr, const double *params, int n_params ) { /* check number of parameters for distribution */ if (n_params < 0) n_params = 0; if (n_params > 2) { _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); n_params = 2; } if (n_params > 0) CHECK_NULL(params,UNUR_ERR_NULL); /* check parameter sigma */ if (n_params > 1 && beta <= 0.) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"beta <= 0"); return UNUR_ERR_DISTR_DOMAIN; } /* copy parameters for standard form: none */ /* default parameters */ DISTR.alpha = 0.; DISTR.beta = 1.; /* copy optional parameters */ /* copy parameters */ switch (n_params) { case 2: DISTR.beta = beta; /* FALLTHROUGH */ case 1: DISTR.alpha = alpha; n_params = 2; /* number of parameters for non-standard form */ /* FALLTHROUGH */ default: break; } /* store number of parameters */ DISTR.n_params = n_params; /* set (standard) domain */ if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.domain[0] = -UNUR_INFINITY; /* left boundary */ DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ } return UNUR_SUCCESS; } /* end of _unur_set_params_logistic() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_logistic( const double *params, int n_params ) { register struct unur_distr *distr; /* get new (empty) distribution object */ distr = unur_distr_cont_new(); /* set distribution id */ distr->id = UNUR_DISTR_LOGISTIC; /* name of distribution */ distr->name = distr_name; /* how to get special generators */ /* DISTR.init = _unur_stdgen_logistic_init; */ /* functions */ DISTR.pdf = _unur_pdf_logistic; /* pointer to PDF */ DISTR.dpdf = _unur_dpdf_logistic; /* pointer to derivative of PDF */ DISTR.cdf = _unur_cdf_logistic; /* pointer to CDF */ DISTR.invcdf = _unur_invcdf_logistic; /* pointer to inverse CDF */ /* indicate which parameters are set */ distr->set = ( UNUR_DISTR_SET_DOMAIN | UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_MODE | UNUR_DISTR_SET_PDFAREA ); /* set parameters for distribution */ if (_unur_set_params_logistic(distr,params,n_params)!=UNUR_SUCCESS) { free(distr); return NULL; } /* function for setting parameters and updating domain */ DISTR.set_params = _unur_set_params_logistic; /* normalization constant */ NORMCONSTANT = 1. / DISTR.beta; /* mode and area below p.d.f. */ DISTR.mode = DISTR.alpha; DISTR.area = 1.; /* function for updating derived parameters */ DISTR.upd_mode = _unur_upd_mode_logistic; /* funct for computing mode */ DISTR.upd_area = _unur_upd_area_logistic; /* funct for computing area */ /* return pointer to object */ return distr; } /* end of unur_distr_logistic() */ /*---------------------------------------------------------------------------*/ #undef alpha #undef beta #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/c_F.c0000644001357500135600000003124214420445767014400 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: c_F.c * * * * REFERENCES: * * * * [3] N.L. Johnson, S. Kotz, and N. Balakrishnan * * Continuous Univariate Distributions, * * Volume 2, 2nd edition * * John Wiley & Sons, Inc., New York, 1995 * * * ***************************************************************************** * * * distr: F distribution [3; ch.27, p.332] * * * * pdf: f(x) = (x^{{nu_1}/2-1}) / ((1+nu_1/nu_2 x)^{(nu_1+nu_2)/2}) * * domain: 0 < x < infinity * * constant: \frac{(nu_1/nu_2)^{{nu_1}/2}/Beta({nu_1}/2,{nu_2}/2) * * * * parameters: * * 0: nu_1 > 0 ... shape (degrees of freedom) * * 1: nu_2 > 0 ... shape (degrees of freedom) * * * ***************************************************************************** * * * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "unur_distributions.h" #include "unur_distributions_source.h" #include "unur_stddistr.h" /*---------------------------------------------------------------------------*/ static const char distr_name[] = "F"; /*---------------------------------------------------------------------------*/ /* parameters */ #define nua params[0] #define nub params[1] /*---------------------------------------------------------------------------*/ #define DISTR distr->data.cont #define LOGNORMCONSTANT (distr->data.cont.norm_constant) /*---------------------------------------------------------------------------*/ /* function prototypes */ static double _unur_pdf_F( double x, const UNUR_DISTR *distr ); static double _unur_logpdf_F( double x, const UNUR_DISTR *distr ); static double _unur_dpdf_F( double x, const UNUR_DISTR *distr ); static double _unur_dlogpdf_F( double x, const UNUR_DISTR *distr ); static double _unur_cdf_F( double x, const UNUR_DISTR *distr ); #ifdef _unur_SF_invcdf_F static double _unur_invcdf_F( double x, const UNUR_DISTR *distr ); #endif static int _unur_upd_mode_F( UNUR_DISTR *distr ); static int _unur_upd_area_F( UNUR_DISTR *distr ); inline static double _unur_lognormconstant_F( const double *params, int n_params ); static int _unur_set_params_F( UNUR_DISTR *distr, const double *params, int n_params ); /*---------------------------------------------------------------------------*/ double _unur_pdf_F(double x, const UNUR_DISTR *distr) { register const double *params = DISTR.params; if (x < 0.) /* out of support */ return 0.; else if (_unur_iszero(x)) { if (nua < 2.) return UNUR_INFINITY; else if (_unur_isfsame(nua,2.)) return exp(-LOGNORMCONSTANT); else return 0.; } else return exp ((nua/2. - 1.)*log(x) - 0.5*(nua + nub)*log(1. + x * nua / nub) - LOGNORMCONSTANT); } /* end of _unur_pdf_F() */ /*---------------------------------------------------------------------------*/ double _unur_logpdf_F(double x, const UNUR_DISTR *distr) { register const double *params = DISTR.params; if (x < 0.) /* out of support */ return -UNUR_INFINITY; else if (_unur_iszero(x)) { if (nua < 2.) return UNUR_INFINITY; else if (_unur_isfsame(nub,2.)) return -LOGNORMCONSTANT; else return -UNUR_INFINITY; } else return ((nua/2. - 1.)*log(x) - 0.5*(nua + nub)*log(1. + x * nua / nub) - LOGNORMCONSTANT); } /* end of _unur_logpdf_F() */ /*---------------------------------------------------------------------------*/ double _unur_dpdf_F(double x, const UNUR_DISTR *distr) { register const double *params = DISTR.params; if (x < 0.) /* out of support */ return 0.; else if (_unur_iszero(x)) { if (nua < 2.) return -UNUR_INFINITY; else if (_unur_isfsame(nub,2.)) return -(2.+nub)/nub * exp(-LOGNORMCONSTANT); else return 0.; } else return _unur_pdf_F(x,distr) * _unur_dlogpdf_F(x,distr); } /* end of _unur_dpdf_F() */ /*---------------------------------------------------------------------------*/ double _unur_dlogpdf_F(double x, const UNUR_DISTR *distr) { register const double *params = DISTR.params; if (x < 0.) /* out of support */ return 0.; else if (_unur_iszero(x)) { if (nua < 2.) return -UNUR_INFINITY; else if (_unur_isfsame(nub,2.)) return -(2.+nub)/nub; else return UNUR_INFINITY; } else return ((nua/2.-1.)/x - nua*(nua+nub)/(2.*nub)/(1.+x*nua/nub)); } /* end of _unur_dlogpdf_F() */ /*---------------------------------------------------------------------------*/ double _unur_cdf_F(double x, const UNUR_DISTR *distr) { #ifdef _unur_SF_cdf_F return _unur_SF_cdf_F(x,DISTR.nua,DISTR.nub); #else const double *params = DISTR.params; if (x <= 0.) /* out of support of p.d.f. */ return 0.; if (nua * x > nub) return 1. - _unur_SF_incomplete_beta(nub / (nub + nua * x), nub/2., nua/2.); else return _unur_SF_incomplete_beta(nua * x / (nub + nua * x), nua/2., nub/2.); #endif } /* end of _unur_cdf_chisquare() */ /*---------------------------------------------------------------------------*/ #ifdef _unur_SF_invcdf_F double _unur_invcdf_F(double x, const UNUR_DISTR *distr) { return _unur_SF_invcdf_F(x,DISTR.nua,DISTR.nub); } /* end of _unur_invcdf_F() */ #endif /*---------------------------------------------------------------------------*/ int _unur_upd_mode_F( UNUR_DISTR *distr ) { if (DISTR.nua >= 2.) DISTR.mode = ((DISTR.nua - 2.) * DISTR.nub) / (DISTR.nua * (DISTR.nub + 2.)); else DISTR.mode = 0.; /* mode must be in domain */ if (DISTR.mode < DISTR.domain[0]) DISTR.mode = DISTR.domain[0]; else if (DISTR.mode > DISTR.domain[1]) DISTR.mode = DISTR.domain[1]; return UNUR_SUCCESS; } /* end of _unur_upd_mode_F() */ /*---------------------------------------------------------------------------*/ int _unur_upd_area_F( UNUR_DISTR *distr ) { /* log of normalization constant */ LOGNORMCONSTANT = _unur_lognormconstant_F(DISTR.params,DISTR.n_params); if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.area = 1.; return UNUR_SUCCESS; } /* else */ DISTR.area = ( _unur_cdf_F( DISTR.domain[1],distr) - _unur_cdf_F( DISTR.domain[0],distr) ); return UNUR_SUCCESS; } /* end of _unur_upd_area_F() */ /*---------------------------------------------------------------------------*/ double _unur_lognormconstant_F(const double *params, int n_params ATTRIBUTE__UNUSED) { /* log( Beta(nu1/2, nu2/2) ) - (nu1/2) * log(nu1 / nu2) */ return ((_unur_SF_ln_gamma(nua/2.) + _unur_SF_ln_gamma(nub/2.) - _unur_SF_ln_gamma((nua+nub)/2.)) - 0.5 * nua * log(nua/nub)); } /* end of _unur_lognormconstant_F() */ /*---------------------------------------------------------------------------*/ int _unur_set_params_F( UNUR_DISTR *distr, const double *params, int n_params ) { /* check number of parameters for distribution */ if (n_params < 2) { _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } if (n_params > 2) { _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); n_params = 2; } CHECK_NULL(params,UNUR_ERR_NULL); /* check parameters nu1 and nu2 */ if (nua <= 0. || nub <= 0.) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"nu <= 0"); return UNUR_ERR_DISTR_DOMAIN; } /* copy parameters for standard form */ DISTR.nua = nua; DISTR.nub = nub; /* copy optional parameters: none */ /* store number of parameters */ DISTR.n_params = n_params; /* set (standard) domain */ if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.domain[0] = 0.; /* left boundary */ DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ } return UNUR_SUCCESS; } /* end of _unur_set_params_F() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_F( const double *params, int n_params ) { register struct unur_distr *distr; /* get new (empty) distribution object */ distr = unur_distr_cont_new(); /* set distribution id */ distr->id = UNUR_DISTR_F; /* name of distribution */ distr->name = distr_name; /* how to get special generators */ DISTR.init = NULL; /* functions */ DISTR.pdf = _unur_pdf_F; /* pointer to PDF */ DISTR.logpdf = _unur_logpdf_F; /* pointer to logPDF */ DISTR.dpdf = _unur_dpdf_F; /* pointer to derivative of PDF */ DISTR.dlogpdf = _unur_dlogpdf_F; /* pointer to derivative of logPDF */ DISTR.cdf = _unur_cdf_F; /* pointer to CDF */ #ifdef _unur_SF_invcdf_student DISTR.invcdf = _unur_invcdf_F; /* pointer to inverse CDF */ #endif /* indicate which parameters are set */ distr->set = ( UNUR_DISTR_SET_DOMAIN | UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_PDFAREA | UNUR_DISTR_SET_MODE ); /* set parameters for distribution */ if (_unur_set_params_F(distr,params,n_params)!=UNUR_SUCCESS) { free(distr); return NULL; } /* log of normalization constant */ LOGNORMCONSTANT = _unur_lognormconstant_F(DISTR.params,DISTR.n_params); /* mode and area below p.d.f. */ _unur_upd_mode_F( distr ); DISTR.area = 1.; /* function for setting parameters and updating domain */ DISTR.set_params = _unur_set_params_F; /* function for updating derived parameters */ DISTR.upd_mode = _unur_upd_mode_F; /* funct for computing mode */ DISTR.upd_area = _unur_upd_area_F; /* funct for computing area */ /* return pointer to object */ return distr; } /* end of unur_distr_F() */ /*---------------------------------------------------------------------------*/ #undef nu1 #undef nu2 #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/c_student.c0000644001357500135600000002537114420445767015707 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: c_student.c * * * * REFERENCES: * * * * [3] N.L. Johnson, S. Kotz and N. Balakrishnan * * Continuous Univariate Distributions, * * Volume 2, 2nd edition * * John Wiley & Sons, Inc., New York, 1995 * * * ***************************************************************************** * * * distr: Student distribution or t-distribution [3; ch. 28; p. 362] * * * * pdf: f(x) = ( 1 + (x^2)/nu )^(-(nu+1)/2) * * domain: -infinity < x < infintiy * * constant: 1 / (sqrt(nu) * Beta(1/2,nu/2)) * * = 1 / (sqrt(pi*nu) * Gamma(nu/2) / Gamma((nu+1)/2)) * * * * parameters: 1 * * 0: nu > 0 ... shape * * * ***************************************************************************** * * * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "unur_distributions.h" #include "unur_distributions_source.h" #include "unur_stddistr.h" /*---------------------------------------------------------------------------*/ static const char distr_name[] = "student"; /*---------------------------------------------------------------------------*/ /* parameters */ #define nu params[0] /*---------------------------------------------------------------------------*/ #define DISTR distr->data.cont #define NORMCONSTANT (distr->data.cont.norm_constant) /*---------------------------------------------------------------------------*/ /* function prototypes */ static double _unur_pdf_student( double x, const UNUR_DISTR *distr ); static double _unur_dpdf_student( double x, const UNUR_DISTR *distr ); static double _unur_cdf_student( double x, const UNUR_DISTR *distr ); #ifdef _unur_SF_invcdf_student static double _unur_invcdf_student( double x, const UNUR_DISTR *distr ); #endif static int _unur_upd_mode_student( UNUR_DISTR *distr ); static int _unur_upd_area_student( UNUR_DISTR *distr ); static double _unur_normconstant_student(const double *params, int n_params); static int _unur_set_params_student( UNUR_DISTR *distr, const double *params, int n_params ); /*---------------------------------------------------------------------------*/ double _unur_pdf_student( double x, const UNUR_DISTR *distr ) { const double *params = DISTR.params; return pow( (1. + x*x/nu), (-nu-1.)*0.5 ) / NORMCONSTANT; } /* end of _unur_pdf_student() */ /*---------------------------------------------------------------------------*/ double _unur_dpdf_student( double x, const UNUR_DISTR *distr ) { const double *params = DISTR.params; return ( (-nu-1.)*x/nu * pow( (1. + x*x/nu), (-nu-3.)*0.5 ) / NORMCONSTANT ); } /* end of _unur_dpdf_student() */ /*---------------------------------------------------------------------------*/ double _unur_cdf_student(double x, const UNUR_DISTR *distr) { #ifdef _unur_SF_cdf_student return _unur_SF_cdf_student(x,DISTR.nu); #else const double *params = DISTR.params; double xx; if (_unur_iszero(nu)) return 0.; /* maybe we could return the Heaviside step-function here ... */ xx=1./(1.+x*x/nu); if (x>0) return 1-0.5*_unur_SF_incomplete_beta(xx,0.5*nu,0.5)/_unur_SF_incomplete_beta(1.,0.5*nu,0.5); else return 0.5*_unur_SF_incomplete_beta(xx,0.5*nu,0.5)/_unur_SF_incomplete_beta(1.,0.5*nu,0.5); #endif } /* end of _unur_cdf_student() */ /*---------------------------------------------------------------------------*/ #ifdef _unur_SF_invcdf_student double _unur_invcdf_student(double x, const UNUR_DISTR *distr) { return _unur_SF_invcdf_student(x,DISTR.nu); } /* end of _unur_invcdf_student() */ #endif /*---------------------------------------------------------------------------*/ int _unur_upd_mode_student( UNUR_DISTR *distr ) { DISTR.mode = 0.; /* mode must be in domain */ if (DISTR.mode < DISTR.domain[0]) DISTR.mode = DISTR.domain[0]; else if (DISTR.mode > DISTR.domain[1]) DISTR.mode = DISTR.domain[1]; /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_upd_mode_student() */ /*---------------------------------------------------------------------------*/ int _unur_upd_area_student( UNUR_DISTR *distr ) { /* normalization constant */ NORMCONSTANT = _unur_normconstant_student(DISTR.params,DISTR.n_params); if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.area = 1.; return UNUR_SUCCESS; } /* else */ DISTR.area = ( _unur_cdf_student( DISTR.domain[1],distr) - _unur_cdf_student( DISTR.domain[0],distr) ); return UNUR_SUCCESS; } /* end of _unur_upd_area_student() */ /*---------------------------------------------------------------------------*/ double _unur_normconstant_student( const double *params, int n_params ATTRIBUTE__UNUSED ) { return( sqrt(M_PI * nu) * exp(_unur_SF_ln_gamma(0.5*nu) - _unur_SF_ln_gamma(0.5*(nu+1.))) ); } /* end of _unur_normconstant_student() */ /*---------------------------------------------------------------------------*/ int _unur_set_params_student( UNUR_DISTR *distr, const double *params, int n_params ) { /* check number of parameters for distribution */ if (n_params < 1) { _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } if (n_params > 1) { _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); n_params = 1; } CHECK_NULL(params,UNUR_ERR_NULL); /* check parameter nu */ if (nu <= 0.) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"nu <= 0."); return UNUR_ERR_DISTR_DOMAIN; } /* copy parameters for standard form */ DISTR.nu = nu; /* default parameters: none */ /* copy optional parameters:none */ /* store number of parameters */ DISTR.n_params = n_params; /* set (standard) domain */ if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.domain[0] = -UNUR_INFINITY; /* left boundary */ DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ } return UNUR_SUCCESS; } /* end of _unur_set_params_student() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_student( const double *params, int n_params ) { register struct unur_distr *distr; /* get new (empty) distribution object */ distr = unur_distr_cont_new(); /* set distribution id */ distr->id = UNUR_DISTR_STUDENT; /* name of distribution */ distr->name = distr_name; /* how to get special generators */ DISTR.init = _unur_stdgen_student_init; /* functions */ DISTR.pdf = _unur_pdf_student; /* pointer to PDF */ DISTR.dpdf = _unur_dpdf_student; /* pointer to derivative of PDF */ DISTR.cdf = _unur_cdf_student; /* pointer to CDF */ #ifdef _unur_SF_invcdf_student DISTR.invcdf = _unur_invcdf_student; /* pointer to inverse CDF */ #endif /* indicate which parameters are set */ distr->set = ( UNUR_DISTR_SET_DOMAIN | UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_PDFAREA | UNUR_DISTR_SET_MODE ); /* set parameters for distribution */ if (_unur_set_params_student(distr,params,n_params)!=UNUR_SUCCESS) { free(distr); return NULL; } /* normalization constant */ NORMCONSTANT = _unur_normconstant_student(DISTR.params,DISTR.n_params); /* mode and area below p.d.f. */ DISTR.mode = 0.; DISTR.area = 1.; /* function for setting parameters and updating domain */ DISTR.set_params = _unur_set_params_student; /* function for updating derived parameters */ DISTR.upd_mode = _unur_upd_mode_student; /* funct for computing mode */ DISTR.upd_area = _unur_upd_area_student; /* funct for computing area */ /* return pointer to object */ return distr; } /* end of unur_distr_student() */ /*---------------------------------------------------------------------------*/ #undef nu #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/d_poisson_gen.c0000644001357500135600000006604614420445767016551 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: d_poisson_gen.c * * * * Special generators for Poisson distribution * * * ***************************************************************************** * * * Copyright (c) 2000-2011 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include /* for the definition of `UNUR_STDGEN_INVERSION' */ #include #include #include #include "unur_distributions_source.h" #include "unur_distributions.h" /*---------------------------------------------------------------------------*/ /* init routines for special generators */ inline static int poisson_pdtabl_init( struct unur_gen *gen ); inline static int poisson_pdac_init( struct unur_gen *gen ); inline static int poisson_pprsc_init( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* abbreviations */ #define PAR ((struct unur_dstd_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_dstd_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.discr /* data for distribution in generator object */ #define uniform() _unur_call_urng(gen->urng) /* call for uniform prng */ /* #define MAX_gen_params (39) maximal number of parameters for generator */ /* #define MAX_gen_iparams (5) maximal number of integer param. for gen. */ /* parameters */ #define theta (DISTR.params[0]) /* shape */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Inititialize **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ int _unur_stdgen_poisson_init( struct unur_par *par, struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* initialize special generator for Poisson distribution */ /* if gen == NULL then only check existance of variant. */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* one of par and gen must not be the NULL pointer */ switch ((par) ? par->variant : gen->variant) { case 0: /* DEFAULT */ case 1: /* Tabulated Inversion combined with Acceptance Complement */ if (gen==NULL) return UNUR_SUCCESS; /* test existence only */ if (theta < 10.) { /* CASE B: Tabulated Inversion */ _unur_dstd_set_sampling_routine(gen, _unur_stdgen_sample_poisson_pdtabl ); return poisson_pdtabl_init( gen ); } else { /* theta >= 10. */ /* CASE A: acceptance complement */ _unur_dstd_set_sampling_routine(gen, _unur_stdgen_sample_poisson_pdac ); return poisson_pdac_init( gen ); } case 2: /* Tabulated Inversion combined with Patchwork Rejection */ if (gen==NULL) return UNUR_SUCCESS; /* test existence only */ if (theta < 10.) { /* CASE: Tabulated Inversion --> same as case 1 !! */ _unur_dstd_set_sampling_routine(gen, _unur_stdgen_sample_poisson_pdtabl ); return poisson_pdtabl_init( gen ); } else { /* theta >= 10. */ /* CASE: Patchwork Rejection */ _unur_dstd_set_sampling_routine(gen, _unur_stdgen_sample_poisson_pprsc ); return poisson_pprsc_init( gen ); } /** WinRand routine `pruec' (Ratio of Uniforms/Inversion) not implemented **/ default: /* no such generator */ return UNUR_FAILURE; } } /* end of _unur_stdgen_poisson_init() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Special generators **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ /***************************************************************************** * * * Poisson Distribution: Tabulated Inversion combined with * * Acceptance Complement * * * ***************************************************************************** * * * FUNCTION: - samples a random number from the Poisson distribution with * * parameter theta > 0. * * Tabulated Inversion for theta < 10 * * Acceptance Complement for theta >= 10. * * * * REFERENCE: - J.H. Ahrens, U. Dieter (1982): Computer generation of * * Poisson deviates from modified normal distributions, * * ACM Trans. Math. Software 8, 163-179. * * * * Implemented by R. Kremer, August 1990 * * Revised by E. Stadlober, April 1992 * ***************************************************************************** * WinRand (c) 1995 Ernst Stadlober, Institut fuer Statistitk, TU Graz * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #define GEN_N_IPARAMS (2) #define GEN_N_PARAMS (39) #define m (GEN->gen_iparam[0]) #define ll (GEN->gen_iparam[1]) #define p0 (GEN->gen_param[0]) #define q (GEN->gen_param[1]) #define p (GEN->gen_param[2]) #define pp ((GEN->gen_param)+3) /* array of length 36 */ /*---------------------------------------------------------------------------*/ int poisson_pdtabl_init( struct unur_gen *gen ) /* theta < 10: Tabulated inversion */ { int i; /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_DSTD_GEN,UNUR_ERR_COOKIE); if (GEN->gen_param == NULL || GEN->n_gen_param != GEN_N_PARAMS) { GEN->n_gen_param = GEN_N_PARAMS; GEN->gen_param = _unur_xrealloc(GEN->gen_param, GEN->n_gen_param * sizeof(double)); } if (GEN->gen_iparam == NULL || GEN->n_gen_iparam != GEN_N_IPARAMS) { GEN->n_gen_iparam = GEN_N_IPARAMS; GEN->gen_iparam = _unur_xrealloc(GEN->gen_iparam, GEN->n_gen_iparam * sizeof(int)); } /* -X- setup code -X- */ m = (theta > 1.) ? ((int) theta) : 1; ll = 0; p0 = q = p = exp(-theta); for (i=0; i<36; i++) pp[i]=0.; /* -X- end of setup code -X- */ return UNUR_SUCCESS; } /* end of poisson_pdtabl_init() */ int _unur_stdgen_sample_poisson_pdtabl( struct unur_gen *gen ) /* theta < 10: Tabulated inversion */ { /* -X- generator code -X- */ double U; int K,i; /* check arguments */ CHECK_NULL(gen,INT_MAX); COOKIE_CHECK(gen,CK_DSTD_GEN,INT_MAX); while (1) { U = uniform(); /* Step U. Uniform sample */ K = 0; if (U <= p0) return K; /* Step T. Table comparison */ if (ll != 0) { i = (U > 0.458) ? _unur_min(ll,m) : 1; for (K = i; K <=ll; K++) if (U <= pp[K]) return K; if (ll == 35) continue; } /* Step C. Creation of new prob. */ for (K = ll +1; K <= 35; K++) { p *= theta / (double)K; q += p; pp[K] = q; if (U <= q) { ll = K; return K; } } ll = 35; } /* -X- end of generator code -X- */ } /* end of _unur_stdgen_sample_poisson_pdtabl() */ /*---------------------------------------------------------------------------*/ #undef GEN_N_IPARAMS #undef GEN_N_PARAMS #undef m #undef ll #undef p0 #undef q #undef p #undef pp /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #define GEN_N_IPARAMS (1) #define GEN_N_PARAMS (10) #define l (GEN->gen_iparam[0]) #define s (GEN->gen_param[0]) #define d (GEN->gen_param[1]) #define omega (GEN->gen_param[2]) #define b1 (GEN->gen_param[3]) #define b2 (GEN->gen_param[4]) #define c (GEN->gen_param[5]) #define c0 (GEN->gen_param[6]) #define c1 (GEN->gen_param[7]) #define c2 (GEN->gen_param[8]) #define c3 (GEN->gen_param[9]) #define NORMAL gen->gen_aux /* pointer to normal variate generator */ /*---------------------------------------------------------------------------*/ int poisson_pdac_init( struct unur_gen *gen ) /* Theta >= 10: acceptance complement */ { /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_DSTD_GEN,UNUR_ERR_COOKIE); if (GEN->gen_param == NULL || GEN->n_gen_param != GEN_N_PARAMS) { GEN->n_gen_param = GEN_N_PARAMS; GEN->gen_param = _unur_xrealloc(GEN->gen_param, GEN->n_gen_param * sizeof(double)); } if (GEN->gen_iparam == NULL || GEN->n_gen_iparam != GEN_N_IPARAMS) { GEN->n_gen_iparam = GEN_N_IPARAMS; GEN->gen_iparam = _unur_xrealloc(GEN->gen_iparam, GEN->n_gen_iparam * sizeof(int)); } /* -X- setup code -X- */ /* make a normal variate generator (use default special generator) */ if (NORMAL==NULL) { struct unur_distr *distr = unur_distr_normal(NULL,0); struct unur_par *par = unur_cstd_new( distr ); NORMAL = (par) ? _unur_init(par) : NULL; _unur_check_NULL( NULL, NORMAL, UNUR_ERR_NULL ); /* need same uniform random number generator as slash generator */ NORMAL->urng = gen->urng; /* copy debugging flags */ NORMAL->debug = gen->debug; /* we do not need the distribution object any more */ _unur_distr_free( distr ); } /* else we are in the re-init mode --> there is no necessity to make the generator object again */ s = sqrt(theta); d = 6. * theta * theta; l = (int)(theta - 1.1484); /* Step P. Preparations for steps Q and H */ omega = 0.3989423 / s; b1 = 0.416666666667e-1 / theta; b2 = 0.3 * b1 * b1; c3 = 0.1428571 * b1 * b2; c2 = b2 - 15.0 * c3; c1 = b1 - 6.0 * b2 + 45.0 * c3; c0 = 1.0 - b1 + 3.0 * b2 - 15.0 * c3; c = 0.1069 / theta; /* -X- end of setup code -X- */ return UNUR_SUCCESS; } /* end of poisson_pdac_init() */ /*---------------------------------------------------------------------------*/ #define a0 -0.5000000002 #define a1 0.3333333343 #define a2 -0.2499998565 #define a3 0.1999997049 #define a4 -0.1666848753 #define a5 0.1428833286 #define a6 -0.1241963125 #define a7 0.1101687109 #define a8 -0.1142650302 #define a9 0.1055093006 /*---------------------------------------------------------------------------*/ int _unur_stdgen_sample_poisson_pdac( struct unur_gen *gen ) /* Theta >= 10: acceptance complement */ { /* -X- generator code -X- */ /* factorial for 0 <= k <= 9 */ static const int fac[] = {1,1,2,6,24,120,720,5040,40320,362880}; double t,g,theta_k; double gx,gy,px,py,x,xx,delta,v; int sign; double E, U; int K; /* check arguments */ CHECK_NULL(gen,INT_MAX); COOKIE_CHECK(gen,CK_DSTD_GEN,INT_MAX); /* Step N. Normal sample */ t = _unur_sample_cont(NORMAL); g = theta + s * t; if (g >= 0.) { K = (int) g; /* Step I. Immediate acceptance */ if (K >= l) return K; /* Step S. Squeeze acceptance */ U = uniform(); theta_k = theta - K; if (d * U >= theta_k * theta_k * theta_k) return K; /* FUNCTION F */ if (K < 10) { px = -theta; py = exp(K * log(theta)) / fac[K]; } else { /* k >= 10 */ delta = 0.83333333333e-1 / (double)K; delta = delta - 4.8 * delta*delta*delta * (1.-1./(3.5*K*K)); v = (theta_k) / (double)K; if (fabs(v) > 0.25) px = K * log(1. + v) - theta_k - delta; else { px = K * v * v; px *= ((((((((a9*v+a8)*v+a7)*v+a6)*v+a5)*v+ a4)*v+a3)*v+a2)*v+a1)*v+a0; px -= delta; } py = 0.3989422804 / sqrt((double)K); } x = (0.5 - theta_k) / s; xx = x * x; gx = -0.5 * xx; gy = omega * (((c3 * xx + c2) * xx + c1) * xx + c0); /* end FUNCTION F */ /* Step Q. Quotient acceptance */ if (gy * (1.0 - U) <= py * exp(px - gx)) return K; } /* Step E. Double exponential sample */ while (1) { do { E = - log(uniform()); U = uniform(); U = U + U - 1.; sign = (U < 0.) ? -1 : 1; t = 1.8 + E * sign; } while (t <= -0.6744); K = (int)(theta + s * t); theta_k = theta - K; /* FUNCTION F */ if (K < 10) { px = -theta; py = exp(K * log(theta)) / fac[K]; } else { /* k >= 10 */ delta = 0.83333333333e-1 / (double)K; delta = delta - 4.8*delta*delta*delta*(1.0-1.0/(3.5*K*K)); v = (theta_k) / (double)K; if (fabs(v) > 0.25) px = K * log(1. + v) - theta_k - delta; else { px = K * v * v; px *= ((((((((a9*v+a8)*v+a7)*v+a6)*v+a5)*v+ a4)*v+a3)*v+a2)*v+a1)*v+a0; px -= delta; } py = 0.3989422804 / sqrt((double)K); } x = (0.5 - theta_k) / s; xx = x * x; gx = -0.5 * xx; gy = omega * (((c3 * xx + c2) * xx + c1) * xx + c0); /* end FUNCTION F */ /* Step H. Hat acceptance */ if (c * sign * U <= py * exp(px + E) - gy * exp(gx + E)) return K; } /* -X- end of generator code -X- */ } /* end of _unur_stdgen_sample_poisson_pdac() */ /*---------------------------------------------------------------------------*/ #undef a0 #undef a1 #undef a2 #undef a3 #undef a4 #undef a5 #undef a6 #undef a7 #undef a8 #undef a9 #undef GEN_N_IPARAMS #undef GEN_N_PARAMS #undef l #undef s #undef d #undef omega #undef b1 #undef b2 #undef c #undef c0 #undef c1 #undef c2 #undef c3 #undef NORMAL /*---------------------------------------------------------------------------*/ /***************************************************************************** * * * Poisson Distribution: Tabulated Inversion combined with * * Patchwork Rejection * * * ***************************************************************************** * * * FUNCTION: - samples a random number from the Poisson distribution with * * parameter theta > 0. * * Tabulated Inversion for theta < 10 * * Patchwork Rejection for theta >= 10. * * * * REFERENCE: - H. Zechner (1994): Efficient sampling from continuous and * * discrete unimodal distributions, * * Pd.D. Thesis, 156 pp., Technical University Graz, Austria. * * * * Implemented by H. Zechner, January 1994 * * Revised by F. Niederl, July 1994 * ***************************************************************************** * * * Patchwork Rejection: * * The area below the histogram function f(x) is rearranged in its body by * * certain point reflections. Within a large center interval variates are * * sampled efficiently by rejection from uniform hats. Rectangular immediate * * acceptance regions speed up the generation. The remaining tails are * * covered by exponential functions. * * * ***************************************************************************** * WinRand (c) 1995 Ernst Stadlober, Institut fuer Statistitk, TU Graz * *****************************************************************************/ /*---------------------------------------------------------------------------*/ inline static double f(int k, double l_nu, double c_pm) { return exp(k * l_nu - _unur_SF_ln_factorial(k) - c_pm); } /*---------------------------------------------------------------------------*/ #define GEN_N_IPARAMS (5) #define GEN_N_PARAMS (20) #define m (GEN->gen_iparam[0]) #define k2 (GEN->gen_iparam[1]) #define k4 (GEN->gen_iparam[2]) #define k1 (GEN->gen_iparam[3]) #define k5 (GEN->gen_iparam[4]) #define dl (GEN->gen_param[0]) #define dr (GEN->gen_param[1]) #define r1 (GEN->gen_param[2]) #define r2 (GEN->gen_param[3]) #define r4 (GEN->gen_param[4]) #define r5 (GEN->gen_param[5]) #define ll (GEN->gen_param[6]) #define lr (GEN->gen_param[7]) #define l_theta (GEN->gen_param[8]) #define c_pm (GEN->gen_param[9]) #define f2 (GEN->gen_param[10]) #define f4 (GEN->gen_param[11]) #define f1 (GEN->gen_param[12]) #define f5 (GEN->gen_param[13]) #define p1 (GEN->gen_param[14]) #define p2 (GEN->gen_param[15]) #define p3 (GEN->gen_param[16]) #define p4 (GEN->gen_param[17]) #define p5 (GEN->gen_param[18]) #define p6 (GEN->gen_param[19]) /*---------------------------------------------------------------------------*/ int poisson_pprsc_init( struct unur_gen *gen ) /* theta < 10: Tabulated inversion */ { double Ds; /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_DSTD_GEN,UNUR_ERR_COOKIE); if (GEN->gen_param == NULL || GEN->n_gen_param != GEN_N_PARAMS) { GEN->n_gen_param = GEN_N_PARAMS; GEN->gen_param = _unur_xrealloc(GEN->gen_param, GEN->n_gen_param * sizeof(double)); } if (GEN->gen_iparam == NULL || GEN->n_gen_iparam != GEN_N_IPARAMS) { GEN->n_gen_iparam = GEN_N_IPARAMS; GEN->gen_iparam = _unur_xrealloc(GEN->gen_iparam, GEN->n_gen_iparam * sizeof(int)); } /* -X- setup code -X- */ /* approximate deviation of reflection points k2, k4 from theta - 1/2 */ Ds = sqrt(theta + 0.25); /* mode m, reflection points k2 and k4, and points k1 and k5, which */ /* delimit the centre region of h(x) */ m = (int) theta; k2 = (int) (theta + 0.5 - Ds); k4 = (int) (theta - 0.5 + Ds); k1 = k2 + k2 - m + 1; k5 = k4 + k4 - m; /* range width of the critical left and right centre region */ dl = (double) (k2 - k1); dr = (double) (k5 - k4); /* recurrence constants r(k) = p(k)/p(k-1) at k = k1, k2, k4+1, k5+1 */ r1 = theta / (double) k1; r2 = theta / (double) k2; r4 = theta / (double)(k4 + 1); r5 = theta / (double)(k5 + 1); /* reciprocal values of the scale parameters of expon. tail envelopes */ ll = log(r1); /* expon. tail left */ lr = -log(r5); /* expon. tail right*/ /* Poisson constants, necessary for computing function values f(k) */ l_theta = log(theta); c_pm = m * l_theta - _unur_SF_ln_factorial(m); /* function values f(k) = p(k)/p(m) at k = k2, k4, k1, k5 */ f2 = f(k2, l_theta, c_pm); f4 = f(k4, l_theta, c_pm); f1 = f(k1, l_theta, c_pm); f5 = f(k5, l_theta, c_pm); /* area of the two centre and the two exponential tail regions */ /* area of the two immediate acceptance regions between k2, k4 */ p1 = f2 * (dl + 1.); /* immed. left */ p2 = f2 * dl + p1; /* centre left */ p3 = f4 * (dr + 1.) + p2; /* immed. right */ p4 = f4 * dr + p3; /* centre right */ p5 = f1 / ll + p4; /* expon. tail left */ p6 = f5 / lr + p5; /* expon. tail right*/ /* -X- end of setup code -X- */ return UNUR_SUCCESS; } /* end of poisson_pprsc_init() */ int _unur_stdgen_sample_poisson_pprsc( struct unur_gen *gen ) /* theta >= 10: Patchwork Rejection */ { /* -X- generator code -X- */ int Dk, X, Y; double U, V, W; while (1) { /* generate uniform number U -- U(0, p6) */ U = uniform() * p6; /* case distinction corresponding to U */ if (U < p2) { /* centre left */ /* immediate acceptance region R2 = [k2, m) *[0, f2), X = k2, ... m-1 */ V = U - p1; if (V < 0.) return (k2 + (int)(U/f2)); /* immediate acceptance region R1 = [k1, k2)*[0, f1), X = k1, ... k2-1 */ W = V / dl; if (W < f1) return (k1 + (int)(V/f1)); /* computation of candidate X < k2, and its counterpart Y > k2 */ /* either squeeze-acceptance of X or acceptance-rejection of Y */ Dk = (int)(dl * uniform()) + 1; if (W <= f2 - Dk * (f2 - f2/r2)) /* quick accept of */ return (k2 - Dk); /* X = k2 - Dk */ if ((V = f2 + f2 - W) < 1.) { /* quick reject of Y*/ Y = k2 + Dk; if (V <= f2 + Dk * (1. - f2)/(dl + 1.)) /* quick accept of */ return Y; /* Y = k2 + Dk */ if (V <= f(Y, l_theta, c_pm)) /* final accept of Y*/ return Y; } X = k2 - Dk; } else if (U < p4) { /* centre right */ /* immediate acceptance region R3 = [m, k4+1)*[0, f4), X = m, ... k4 */ (V = U - p3); if (V < 0.) return (k4 - (int)((U - p2)/f4)); /* immediate acceptance region R4 = [k4+1, k5+1)*[0, f5) */ W = V / dr; if (W < f5 ) return (k5 - (int)(V/f5)); /* computation of candidate X > k4, and its counterpart Y < k4 */ /* either squeeze-acceptance of X or acceptance-rejection of Y */ Dk = (int)(dr * uniform()) + 1; if (W <= f4 - Dk * (f4 - f4*r4)) /* quick accept of */ return(k4 + Dk); /* X = k4 + Dk */ if ((V = f4 + f4 - W) < 1.0) { /* quick reject of Y*/ Y = k4 - Dk; if (V <= f4 + Dk * (1.0 - f4)/ dr) /* quick accept of */ return Y; /* Y = k4 - Dk */ if (V <= f(Y, l_theta, c_pm)) return Y; /* final accept of Y*/ } X = k4 + Dk; } else { W = uniform(); if (U < p5) { /* expon. tail left */ Dk = (int)(1. - log(W)/ll); X = k1 - Dk; if (X < 0) continue; /* 0 <= X <= k1 - 1 */ W *= (U - p4) * ll; /* W -- U(0, h(x)) */ if (W <= f1 - Dk * (f1 - f1/r1)) return X; /* quick accept of X*/ } else { /* expon. tail right*/ Dk = (int)(1. - log(W)/lr); X = k5 + Dk; /* X >= k5 + 1 */ W *= (U - p5) * lr; /* W -- U(0, h(x)) */ if (W <= f5 - Dk * (f5 - f5*r5)) return X; /* quick accept of X*/ } } /* acceptance-rejection test of candidate X from the original area */ /* test, whether W <= f(k), with W = U*h(x) and U -- U(0, 1) */ /* log f(X) = (X - m)*log(theta) - log X! + log m! */ if (log(W) <= X * l_theta - _unur_SF_ln_factorial(X) - c_pm) return X; } /* -X- end of generator code -X- */ } /* end of _unur_stdgen_sample_poisson_pprsc() */ /*---------------------------------------------------------------------------*/ #undef GEN_N_IPARAMS #undef GEN_N_PARAMS #undef m #undef k2 #undef k4 #undef k1 #undef k5 #undef dl #undef dr #undef r1 #undef r2 #undef r4 #undef r5 #undef ll #undef lr #undef l_theta #undef c_pm #undef f2 #undef f4 #undef f1 #undef f5 #undef p1 #undef p2 #undef p3 #undef p4 #undef p5 #undef p6 /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/c_triangular.c0000644001357500135600000002416014420445767016364 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: c_triangular.c * * * * REFERENCES: * * * * [3] N.L. Johnson, S. Kotz and N. Balakrishnan * * Continuous Univariate Distributions, * * Volume 2, 2nd edition * * John Wiley & Sons, Inc., New York, 1995 * * * ***************************************************************************** * * * distr: Triangular distribution [3; ch.26, p.297] * * * * pdf: f(x) = 2*x / H for 0 <= x <= H * * pdf: f(x) = 2*(1-x) / (1-H) for H <= x <= 1 * * domain: 0 <= x <= 1 * * constant: 1 * * * * parameters: 1 * * 0: H (0 <= H <= 1) ... shape * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "unur_distributions.h" #include "unur_distributions_source.h" #include "unur_stddistr.h" /*---------------------------------------------------------------------------*/ static const char distr_name[] = "triangular"; /* parameters */ #define H params[0] /* shape */ #define DISTR distr->data.cont /* #define NORMCONSTANT (distr->data.cont.norm_constant) */ /* function prototypes */ static double _unur_pdf_triangular( double x, const UNUR_DISTR *distr ); static double _unur_dpdf_triangular( double x, const UNUR_DISTR *distr ); static double _unur_cdf_triangular( double x, const UNUR_DISTR *distr ); static double _unur_invcdf_triangular( double u, const UNUR_DISTR *distr ); static int _unur_upd_mode_triangular( UNUR_DISTR *distr ); static int _unur_upd_area_triangular( UNUR_DISTR *distr ); static int _unur_set_params_triangular( UNUR_DISTR *distr, const double *params, int n_params ); /*---------------------------------------------------------------------------*/ double _unur_pdf_triangular( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; if (x <= 0.) return 0.; if (x <= H) return (2.*x/H); if (x < 1.) return (2.*(1.-x)/(1.-H)); /* otherwise */ return 0.; } /* end of _unur_pdf_triangular() */ /*---------------------------------------------------------------------------*/ double _unur_dpdf_triangular( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; if (x < 0.) return 0.; if (x <= H && H > 0.) return (2./H); if (x <= 1.&& H < 1.) return (-2./(1.-H)); /* otherwise */ return 0.; } /* end of unur_dpdf_triangular() */ /*---------------------------------------------------------------------------*/ double _unur_cdf_triangular( double x, const UNUR_DISTR *distr ) { const double *params = DISTR.params; double Fx; if (x <= 0.) return 0.; if (x <= H) return (x*x/H); if (x < 1.) { if ((Fx = ((H + x * (x-2.))/(H-1.))) < 1.) return Fx; } /* otherwise */ return 1.; } /* end of _unur_cdf_triangular() */ /*---------------------------------------------------------------------------*/ double _unur_invcdf_triangular( double U, const UNUR_DISTR *distr ) { const double *params = DISTR.params; double tmp,X; if (U<=H) { X = sqrt(H*U); } else { tmp = (1.-H)*(1.-U); X = (tmp>0.) ? (1.-sqrt(tmp)) : 1.; } return X; } /* end of _unur_invcdf_triangular() */ /*---------------------------------------------------------------------------*/ int _unur_upd_mode_triangular( UNUR_DISTR *distr ) { DISTR.mode = DISTR.H; /* mode must be in domain */ if (DISTR.mode < DISTR.domain[0]) DISTR.mode = DISTR.domain[0]; else if (DISTR.mode > DISTR.domain[1]) DISTR.mode = DISTR.domain[1]; return UNUR_SUCCESS; } /* end of _unur_upd_mode_triangular() */ /*---------------------------------------------------------------------------*/ int _unur_upd_area_triangular( UNUR_DISTR *distr ) { /* normalization constant: none */ if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.area = 1.; return UNUR_SUCCESS; } /* else */ DISTR.area = ( _unur_cdf_triangular( DISTR.domain[1],distr) - _unur_cdf_triangular( DISTR.domain[0],distr) ); return UNUR_SUCCESS; } /* end of _unur_upd_area_triangular() */ /*---------------------------------------------------------------------------*/ int _unur_set_params_triangular( UNUR_DISTR *distr, const double *params, int n_params ) { /* check number of parameters for distribution */ if (n_params < 0) n_params = 0; if (n_params > 1) { _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); n_params = 1; } if (n_params > 0) CHECK_NULL(params,UNUR_ERR_NULL); /* check parameter H */ if (n_params > 0 && (H < 0. || H > 1.)) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"H < 0 || H > 1"); return UNUR_ERR_DISTR_DOMAIN; } /* copy parameters for standard form: none */ /* default parameters */ DISTR.H = 0.5; /* default is symmetric triangular distribution */ /* copy optional parameters */ if (n_params == 1) DISTR.H = H; /* store total number of parameters */ DISTR.n_params = 1; /* set (standard) domain */ if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.domain[0] = 0.; /* left boundary */ DISTR.domain[1] = 1.; /* right boundary */ } return UNUR_SUCCESS; } /* end of _unur_set_params_triangular() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_triangular( const double *params, int n_params ) { register struct unur_distr *distr; /* get new (empty) distribution object */ distr = unur_distr_cont_new(); /* set distribution id */ distr->id = UNUR_DISTR_TRIANGULAR; /* name of distribution */ distr->name = distr_name; /* how to get special generators */ /* DISTR.init = _unur_stdgen_triangular_init; */ /* functions */ DISTR.pdf = _unur_pdf_triangular; /* pointer to PDF */ DISTR.dpdf = _unur_dpdf_triangular; /* pointer to derivative of PDF */ DISTR.cdf = _unur_cdf_triangular; /* pointer to CDF */ DISTR.invcdf = _unur_invcdf_triangular; /* pointer to inverse CDF */ /* indicate which parameters are set */ distr->set = ( UNUR_DISTR_SET_DOMAIN | UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_MODE | UNUR_DISTR_SET_PDFAREA ); /* set parameters for distribution */ if (_unur_set_params_triangular(distr,params,n_params)!=UNUR_SUCCESS) { free(distr); return NULL; } /* mode and area below p.d.f. */ DISTR.mode = DISTR.H; DISTR.area = 1.; /* function for setting parameters and updating domain */ DISTR.set_params = _unur_set_params_triangular; /* function for updating derived parameters */ DISTR.upd_mode = _unur_upd_mode_triangular; /* funct for computing mode */ DISTR.upd_area = _unur_upd_area_triangular; /* funct for computing area */ /* return pointer to object */ return distr; } /* end of unur_distr_triangular() */ /*---------------------------------------------------------------------------*/ #undef theta #undef phi #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/c_uniform.c0000644001357500135600000002527014420445767015676 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: c_uniform.c * * * * REFERENCES: * * * * [3] N.L. Johnson, S. Kotz and N. Balakrishnan * * Continuous Univariate Distributions, * * Volume 2, 2nd edition * * John Wiley & Sons, Inc., New York, 1995 * * * ***************************************************************************** * * * distr: Uniform distribution [3; ch.26, p.276] * * * * pdf: f(x) = 1 / (b-a) * * domain: a <= x <= b * * constant: 1 * * * * parameters: * * 0: a ... location * * 1: b (>a) ... location * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "unur_distributions.h" #include "unur_distributions_source.h" #include "unur_stddistr.h" /*---------------------------------------------------------------------------*/ static const char distr_name[] = "uniform"; /* parameters */ #define a params[0] #define b params[1] #define DISTR distr->data.cont /* #define NORMCONSTANT (distr->data.cont.norm_constant) */ /* function prototypes */ static double _unur_pdf_uniform( double x, const UNUR_DISTR *distr ); static double _unur_dpdf_uniform( double x, const UNUR_DISTR *distr ); static double _unur_logpdf_uniform( double x, const UNUR_DISTR *distr ); static double _unur_dlogpdf_uniform( double x, const UNUR_DISTR *distr ); static double _unur_cdf_uniform( double x, const UNUR_DISTR *distr ); static double _unur_invcdf_uniform( double u, const UNUR_DISTR *distr ); static int _unur_upd_mode_uniform( UNUR_DISTR *distr ); static int _unur_upd_area_uniform( UNUR_DISTR *distr ); static int _unur_set_params_uniform( UNUR_DISTR *distr, const double *params, int n_params ); /*---------------------------------------------------------------------------*/ double _unur_pdf_uniform( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; if (x < a || x > b) return 0.; /* else */ return 1./(b-a); /* return ((x < a || x > b) ? 0. : 1./(b-a)); */ } /* end of _unur_pdf_uniform() */ /*---------------------------------------------------------------------------*/ double _unur_logpdf_uniform( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; if (x < a || x > b) return -UNUR_INFINITY; /* else */ return -log(b-a); } /* end of _unur_logpdf_uniform() */ /*---------------------------------------------------------------------------*/ double _unur_dpdf_uniform( double x ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED ) { return 0.; } /* end of _unur_dpdf_uniform() */ /*---------------------------------------------------------------------------*/ double _unur_dlogpdf_uniform( double x ATTRIBUTE__UNUSED, const UNUR_DISTR *distr ATTRIBUTE__UNUSED ) { return 0.; } /* end of _unur_dlogpdf_uniform() */ /*---------------------------------------------------------------------------*/ double _unur_cdf_uniform( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; /* standardize */ x = (x-a) / (b-a); if (x<=0.) return 0.; if (x>=1.) return 1.; return x; } /* end of _unur_cdf_uniform() */ /*---------------------------------------------------------------------------*/ double _unur_invcdf_uniform( double U, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; double X; X = (DISTR.n_params==0) ? U : a + U * (b - a); return X; } /* end of _unur_invcdf_uniform() */ /*---------------------------------------------------------------------------*/ int _unur_upd_mode_uniform( UNUR_DISTR *distr ) { DISTR.mode = (DISTR.a + DISTR.b) / 2.; /* mode must be in domain */ if (DISTR.mode < DISTR.domain[0]) DISTR.mode = DISTR.domain[0]; else if (DISTR.mode > DISTR.domain[1]) DISTR.mode = DISTR.domain[1]; return UNUR_SUCCESS; } /* end of _unur_upd_mode_uniform() */ /*---------------------------------------------------------------------------*/ int _unur_upd_area_uniform( UNUR_DISTR *distr ) { if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.area = 1.; return UNUR_SUCCESS; } /* else */ DISTR.area = ( _unur_cdf_uniform( DISTR.domain[1],distr) - _unur_cdf_uniform( DISTR.domain[0],distr) ); return UNUR_SUCCESS; } /* end of _unur_upd_area_uniform() */ /*---------------------------------------------------------------------------*/ int _unur_set_params_uniform( UNUR_DISTR *distr, const double *params, int n_params ) { /* check number of parameters for distribution */ if (n_params < 0) n_params = 0; if (n_params == 1) { _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } if (n_params > 2) { _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); n_params = 2; } if (n_params > 0) CHECK_NULL(params,UNUR_ERR_NULL); /* check parameters a and b */ if (n_params == 2 && (a >= b)) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"a >= b"); return UNUR_ERR_DISTR_DOMAIN; } /* copy parameters for standard form: none */ /* default parameters */ DISTR.a = 0.; DISTR.b = 1.; /* copy optional parameters */ if (n_params == 2) { DISTR.a = a; DISTR.b = b; } /* store total number of parameters */ DISTR.n_params = 2; /* set (standard) domain */ if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.domain[0] = DISTR.a; /* left boundary */ DISTR.domain[1] = DISTR.b; /* right boundary */ } return UNUR_SUCCESS; } /* end of _unur_set_params_uniform() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_uniform( const double *params, int n_params ) { register struct unur_distr *distr; /* get new (empty) distribution object */ distr = unur_distr_cont_new(); /* set distribution id */ distr->id = UNUR_DISTR_UNIFORM; /* name of distribution */ distr->name = distr_name; /* how to get special generators */ /* DISTR.init = _unur_stdgen_uniform_init; */ /* functions */ DISTR.pdf = _unur_pdf_uniform; /* pointer to PDF */ DISTR.logpdf = _unur_logpdf_uniform; /* pointer to logPDF */ DISTR.dpdf = _unur_dpdf_uniform; /* pointer to derivative of PDF */ DISTR.dlogpdf = _unur_dlogpdf_uniform; /* pointer to deriv. of logPDF */ DISTR.cdf = _unur_cdf_uniform; /* pointer to CDF */ DISTR.invcdf = _unur_invcdf_uniform; /* pointer to inverse CDF */ /* indicate which parameters are set */ distr->set = ( UNUR_DISTR_SET_DOMAIN | UNUR_DISTR_SET_MODE | UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_PDFAREA ); /* set parameters for distribution */ if (_unur_set_params_uniform(distr,params,n_params)!=UNUR_SUCCESS) { free(distr); return NULL; } /* normalization constant: none */ /* mode and area below p.d.f. */ DISTR.mode = (DISTR.a + DISTR.b) / 2.; DISTR.area = 1.; /* function for setting parameters and updating domain */ DISTR.set_params = _unur_set_params_uniform; /* function for updating derived parameters */ DISTR.upd_mode = _unur_upd_mode_uniform; /* funct for computing mode */ DISTR.upd_area = _unur_upd_area_uniform; /* funct for computing area */ /* return pointer to object */ return distr; } /* end of unur_distr_uniform() */ /*---------------------------------------------------------------------------*/ #undef a #undef b #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/c_normal.c0000644001357500135600000003207614420445767015511 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: c_normal.c * * * * REFERENCES: * * * * [2] N.L. Johnson, S. Kotz and N. Balakrishnan * * Continuous Univariate Distributions, * * Volume 1, 2nd edition * * John Wiley & Sons, Inc., New York, 1994 * * * ***************************************************************************** * * * distr: Normal (Gaussian) distribution [2; ch.13, p.80] * * * * pdf: f(x) = exp( -1/2 * ((x-mu)/sigma)^2 ) * * domain: -infinity < x < infinity * * constant: 1 / (sigma * sqrt(2 pi)) * * * * parameters: * * 0: mu (0.) ... location * * 1: sigma > 0 (1.) ... scale * * * ***************************************************************************** * * * standard form * * * * pdf: f(x) = exp( - x^2 / 2) * * domain: -infinity < x < infinity * * constant: 1/sqrt(2 pi) * * * * parameters: * * none * * * * 0: mu = 0. * * 1: sigma = 1. * * * ***************************************************************************** * * * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "unur_distributions.h" #include "unur_distributions_source.h" #include "unur_stddistr.h" /*---------------------------------------------------------------------------*/ static const char distr_name[] = "normal"; /*---------------------------------------------------------------------------*/ /* parameters */ #define mu params[0] #define sigma params[1] /*---------------------------------------------------------------------------*/ #define DISTR distr->data.cont #define LOGNORMCONSTANT (distr->data.cont.norm_constant) /*---------------------------------------------------------------------------*/ /* function prototypes */ static double _unur_pdf_normal( double x, const UNUR_DISTR *distr ); static double _unur_logpdf_normal( double x, const UNUR_DISTR *distr ); static double _unur_dpdf_normal( double x, const UNUR_DISTR *distr ); static double _unur_dlogpdf_normal( double x, const UNUR_DISTR *distr ); static double _unur_cdf_normal( double x, const UNUR_DISTR *distr ); static double _unur_invcdf_normal( double u, const UNUR_DISTR *distr ); static int _unur_upd_mode_normal( UNUR_DISTR *distr ); static int _unur_upd_area_normal( UNUR_DISTR *distr ); static int _unur_set_params_normal( UNUR_DISTR *distr, const double *params, int n_params ); /*---------------------------------------------------------------------------*/ double _unur_pdf_normal( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; if (DISTR.n_params > 0) /* standardize */ x = (x - mu) / sigma; /* standard form */ return exp(-x*x/2. + LOGNORMCONSTANT); } /* end of _unur_pdf_normal() */ /*---------------------------------------------------------------------------*/ double _unur_logpdf_normal( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; if (DISTR.n_params > 0) /* standardize */ x = (x - mu) / sigma; /* standard form */ return (-x*x/2. + LOGNORMCONSTANT); } /* end of _unur_logpdf_normal() */ /*---------------------------------------------------------------------------*/ double _unur_dpdf_normal( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; if (DISTR.n_params > 0) { /* standardize */ x = (x - mu) / sigma; } /* standard form */ return ( -x * exp(-x*x/2. + LOGNORMCONSTANT) / sigma ); } /* end of _unur_dpdf_normal() */ /*---------------------------------------------------------------------------*/ double _unur_dlogpdf_normal( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; if (DISTR.n_params > 0) /* non-standard form */ return (mu - x)/(sigma*sigma); else /* standard form */ return (-x); } /* end of _unur_dlogpdf_normal() */ /*---------------------------------------------------------------------------*/ double _unur_cdf_normal( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; if (DISTR.n_params > 0) /* standardize */ x = (x - mu) / sigma; /* standard form */ return _unur_SF_cdf_normal(x); } /* end of _unur_cdf_normal() */ /*---------------------------------------------------------------------------*/ double _unur_invcdf_normal( double u, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; double X; X = _unur_SF_invcdf_normal(u); return ((DISTR.n_params==0) ? X : mu + sigma * X ); } /* end of _unur_invcdf_normal() */ /*---------------------------------------------------------------------------*/ int _unur_upd_mode_normal( UNUR_DISTR *distr ) { DISTR.mode = DISTR.mu; /* mode must be in domain */ if (DISTR.mode < DISTR.domain[0]) DISTR.mode = DISTR.domain[0]; else if (DISTR.mode > DISTR.domain[1]) DISTR.mode = DISTR.domain[1]; return UNUR_SUCCESS; } /* end of _unur_upd_mode_normal() */ /*---------------------------------------------------------------------------*/ int _unur_upd_area_normal( UNUR_DISTR *distr ) { /* log of normalization constant */ LOGNORMCONSTANT = - log(M_SQRTPI * M_SQRT2 * DISTR.sigma); if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.area = 1.; return UNUR_SUCCESS; } /* else */ DISTR.area = ( _unur_cdf_normal( DISTR.domain[1],distr) - _unur_cdf_normal( DISTR.domain[0],distr) ); return UNUR_SUCCESS; } /* end of _unur_upd_area_normal() */ /*---------------------------------------------------------------------------*/ int _unur_set_params_normal( UNUR_DISTR *distr, const double *params, int n_params ) { /* check number of parameters for distribution */ if (n_params < 0) n_params = 0; if (n_params > 2) { _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); n_params = 2; } if (n_params > 0) CHECK_NULL(params,UNUR_ERR_NULL); /* check parameter sigma */ if (n_params > 1 && sigma <= 0.) { _unur_error(distr_name ,UNUR_ERR_DISTR_DOMAIN,"sigma <= 0"); return UNUR_ERR_DISTR_DOMAIN; } /* copy parameters for standard form: none */ /* default parameters */ DISTR.mu = 0.; DISTR.sigma = 1.; /* copy optional parameters */ switch (n_params) { case 2: DISTR.sigma = sigma; /* FALLTHROUGH */ case 1: DISTR.mu = mu; n_params = 2; /* number of parameters for non-standard form */ /* FALLTHROUGH */ default: break; } /* store number of parameters */ DISTR.n_params = n_params; /* set (standard) domain */ if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.domain[0] = -UNUR_INFINITY; /* left boundary */ DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ } return UNUR_SUCCESS; } /* end of _unur_set_params_normal() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Make distribution object **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_normal( const double *params, int n_params ) { register struct unur_distr *distr; /* get new (empty) distribution object */ distr = unur_distr_cont_new(); /* set distribution id */ distr->id = UNUR_DISTR_NORMAL; /* name of distribution */ distr->name = distr_name; /* how to get special generators */ DISTR.init = _unur_stdgen_normal_init; /* functions */ DISTR.pdf = _unur_pdf_normal; /* pointer to PDF */ DISTR.logpdf = _unur_logpdf_normal; /* pointer to logPDF */ DISTR.dpdf = _unur_dpdf_normal; /* pointer to derivative of PDF */ DISTR.dlogpdf = _unur_dlogpdf_normal; /* pointer to derivative of logPDF */ DISTR.cdf = _unur_cdf_normal; /* pointer to CDF */ DISTR.invcdf = _unur_invcdf_normal; /* pointer to inverse CDF */ /* indicate which parameters are set */ distr->set = ( UNUR_DISTR_SET_DOMAIN | UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_MODE | UNUR_DISTR_SET_PDFAREA ); /* set parameters for distribution */ if (_unur_set_params_normal(distr,params,n_params)!=UNUR_SUCCESS) { free(distr); return NULL; } /* log of normalization constant */ LOGNORMCONSTANT = - log(M_SQRTPI * M_SQRT2 * DISTR.sigma); /* mode and area below p.d.f. */ DISTR.mode = DISTR.mu; DISTR.area = 1.; /* function for setting parameters and updating domain */ DISTR.set_params = _unur_set_params_normal; /* function for updating derived parameters */ DISTR.upd_mode = _unur_upd_mode_normal; /* funct for computing mode */ DISTR.upd_area = _unur_upd_area_normal; /* funct for computing area */ /* return pointer to object */ return distr; } /* end of unur_distr_normal() */ /*---------------------------------------------------------------------------*/ #undef mu #undef sigma #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/c_gamma_gen.c0000644001357500135600000004463714420445767016142 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: c_gamma_gen.c * * * * Special generators for Gamma distribution * * * ***************************************************************************** * * * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include "unur_distributions_source.h" #include "unur_distributions.h" /*---------------------------------------------------------------------------*/ /* init routines for special generators */ inline static int gamma_gll_init( struct unur_gen *gen ); inline static int gamma_gs_init( struct unur_gen *gen ); inline static int gamma_gd_init( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* abbreviations */ #define PAR ((struct unur_cstd_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_cstd_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.cont /* data for distribution in generator object */ /* #define MAX_gen_params (8) maximal number of parameters for generator */ #define uniform() _unur_call_urng(gen->urng) /* call for uniform prng */ #define alpha (DISTR.params[0]) /* shape */ #define beta (DISTR.params[1]) /* scale */ #define gamma (DISTR.params[2]) /* location */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Inititialize **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ int _unur_stdgen_gamma_init( struct unur_par *par, struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* initialize special generator for gamma distribution */ /* if gen == NULL then only check existance of variant. */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* one of par and gen must not be the NULL pointer */ switch ((par) ? par->variant : gen->variant) { case 0: /* DEFAULT */ case 1: /* Acceptance Rejection combined with Acceptance Complement */ if (gen==NULL) return UNUR_SUCCESS; /* test existence only */ if (alpha < 1.) { _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_gamma_gs ); return gamma_gs_init( gen ); } else { _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_gamma_gd ); return gamma_gd_init( gen ); } case 2: /* Rejection with log-logistic envelopes */ _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_gamma_gll ); return gamma_gll_init( gen ); default: /* no such generator */ return UNUR_FAILURE; } } /* end of _unur_stdgen_gamma_init() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Special generators **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ /***************************************************************************** * * * Gamma Distribution: Rejection from log-logistic envelopes * * * ***************************************************************************** * * * FUNCTION: - samples a random number from the * * Gamma distribution with parameter a. * * * * REFERENCE: - R.C.H. Cheng (1977): The Generation of Gamma Variables * * with Non-Integral Shape Parameter, * * Appl. Statist. 26(1), 71-75 * * * * Implemented by Ralf Kremer * ***************************************************************************** * WinRand (c) 1995 Ernst Stadlober, Institut fuer Statistitk, TU Graz * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #define GEN_N_PARAMS (3) #define aa GEN->gen_param[0] #define bb GEN->gen_param[1] #define cc GEN->gen_param[2] /*---------------------------------------------------------------------------*/ inline static int gamma_gll_init( struct unur_gen *gen ) { /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_ERR_COOKIE); if (GEN->gen_param == NULL || GEN->n_gen_param != GEN_N_PARAMS) { GEN->n_gen_param = GEN_N_PARAMS; GEN->gen_param = _unur_xrealloc(GEN->gen_param, GEN->n_gen_param * sizeof(double)); } /* -X- setup code -X- */ aa = (alpha > 1.0) ? sqrt(alpha + alpha - 1.0) : alpha; bb = alpha - 1.386294361; cc = alpha + aa; /* -X- end of setup code -X- */ return UNUR_SUCCESS; } /* end of gamma_gll_init() */ double _unur_stdgen_sample_gamma_gll( struct unur_gen *gen ) { /* -X- generator code -X- */ double X; double u1,u2,v,r,z; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); while (1) { u1 = uniform(); u2 = uniform(); v = log(u1 / (1.0 - u1)) / aa; X = alpha * exp(v); r = bb + cc * v - X; z = u1 * u1 * u2; if (r + 2.504077397 >= 4.5 * z) break; if (r >= log(z)) break; } /* -X- end of generator code -X- */ return ((DISTR.n_params==1) ? X : gamma + beta * X ); } /* end of _unur_stdgen_sample_gamma_gll() */ /*---------------------------------------------------------------------------*/ #undef GEN_N_PARAMS #undef aa #undef bb #undef cc /*---------------------------------------------------------------------------*/ /***************************************************************************** * * * Gamma Distribution: Acceptance Rejection combined with * * Acceptance Complement * * * ***************************************************************************** * * * FUNCTION: - samples a random number from the Gamma distribution with * * parameter alpha > 0. * * Acceptance Rejection gs for alpha < 1, * * Acceptance Complement gd for alpha >= 1. * * * * REFERENCE: - J.H. Ahrens, U. Dieter (1974): Computer methods for * * sampling from gamma, beta, Poisson and binomial * * distributions, Computing 12, 223-246. * * - J.H. Ahrens, U. Dieter (1982): Generating gamma variates * * by a modified rejection technique, * * Communications of the ACM 25, 47-54. * * * * Implemented by G. Thallinger and E. Stadlober, August 1990 * ***************************************************************************** * WinRand (c) 1995 Ernst Stadlober, Institut fuer Statistitk, TU Graz * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #define GEN_N_PARAMS (1) #define b GEN->gen_param[0] /*---------------------------------------------------------------------------*/ inline static int gamma_gs_init( struct unur_gen *gen ) /* CASE alpha < 1: Acceptance rejection algorithm gs */ { /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_ERR_COOKIE); if (GEN->gen_param == NULL || GEN->n_gen_param != GEN_N_PARAMS) { GEN->n_gen_param = GEN_N_PARAMS; GEN->gen_param = _unur_xrealloc(GEN->gen_param, GEN->n_gen_param * sizeof(double)); } /* -X- setup code -X- */ b = 1. + 0.36788794412 * alpha; /* Step 1 */ /* -X- end of setup code -X- */ return UNUR_SUCCESS; } /* end of gamma_gs_init() */ double _unur_stdgen_sample_gamma_gs( struct unur_gen *gen ) { /* -X- generator code -X- */ double X, p; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); while (1) { p = b * uniform(); if (p <= 1.) { /* Step 2. Case gds <= 1 */ X = exp(log(p) / alpha); if ( log(uniform()) <= -X) break; } else { /* Step 3. Case gds > 1 */ X = - log ((b - p) / alpha); if ( log(uniform()) <= ((alpha - 1.) * log(X))) break; } } /* -X- end of generator code -X- */ return ((DISTR.n_params==1) ? X : gamma + beta * X ); } /* end of _unur_stdgen_sample_gamma_gs() */ /*---------------------------------------------------------------------------*/ #undef GEN_N_PARAMS #undef b /*---------------------------------------------------------------------------*/ #define GEN_N_PARAMS (8) #define ss GEN->gen_param[0] #define s GEN->gen_param[1] #define d GEN->gen_param[2] #define r GEN->gen_param[3] #define q0 GEN->gen_param[4] #define b GEN->gen_param[5] #define c GEN->gen_param[6] #define si GEN->gen_param[7] #define q1 0.0416666664 #define q2 0.0208333723 #define q3 0.0079849875 #define q4 0.0015746717 #define q5 -0.0003349403 #define q6 0.0003340332 #define q7 0.0006053049 #define q8 -0.0004701849 #define q9 0.0001710320 #define a1 0.333333333 #define a2 -0.249999949 #define a3 0.199999867 #define a4 -0.166677482 #define a5 0.142873973 #define a6 -0.124385581 #define a7 0.110368310 #define a8 -0.112750886 #define a9 0.104089866 #define e1 1.000000000 #define e2 0.499999994 #define e3 0.166666848 #define e4 0.041664508 #define e5 0.008345522 #define e6 0.001353826 #define e7 0.000247453 /*---------------------------------------------------------------------------*/ #define NORMAL gen->gen_aux /* pointer to normal variate generator */ /*---------------------------------------------------------------------------*/ inline static int gamma_gd_init( struct unur_gen *gen ) /* CASE alpha >= 1: Acceptance complement algorithm gd */ { /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_ERR_COOKIE); if (GEN->gen_param == NULL || GEN->n_gen_param != GEN_N_PARAMS) { GEN->n_gen_param = GEN_N_PARAMS; GEN->gen_param = _unur_xrealloc(GEN->gen_param, GEN->n_gen_param * sizeof(double)); } /* -X- setup code -X- */ /* Step 1. Preparations */ ss = alpha - 0.5; s = sqrt(ss); d = 5.656854249 - 12. * s; /* Step 4. Set-up for hat case */ r = 1. / alpha; q0 = ((((((((q9 * r + q8) * r + q7) * r + q6) * r + q5) * r + q4) * r + q3) * r + q2) * r + q1) * r; if (alpha > 3.686) { if (alpha > 13.022) { b = 1.77; si = 0.75; c = 0.1515 / s; } else { b = 1.654 + 0.0076 * ss; si = 1.68 / s + 0.275; c = 0.062 / s + 0.024; } } else { b = 0.463 + s - 0.178 * ss; si = 1.235; c = 0.195 / s - 0.079 + 0.016 * s; } /* make a normal variate generator (use default special generator) */ if (NORMAL==NULL) { struct unur_distr *distr = unur_distr_normal(NULL,0); struct unur_par *par = unur_cstd_new( distr ); NORMAL = (par) ? _unur_init(par) : NULL; _unur_check_NULL( NULL, NORMAL, UNUR_ERR_NULL ); /* need same uniform random number generator as slash generator */ NORMAL->urng = gen->urng; /* copy debugging flags */ NORMAL->debug = gen->debug; /* we do not need the distribution object any more */ _unur_distr_free( distr ); } /* else we are in the re-init mode --> there is no necessity to make the generator object again */ /* -X- end of setup code -X- */ return UNUR_SUCCESS; } /* end of gamma_gd_init() */ double _unur_stdgen_sample_gamma_gd( struct unur_gen *gen ) { /* -X- generator code -X- */ double U,X,E; double q,sign_U,t,v,w,x; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); do { /* Step 2. Normal deviate */ t = _unur_sample_cont(NORMAL); x = s + 0.5 * t; X = x * x; if (t >= 0.) break; /* Immediate acceptance */ /* Step 3. Uniform random number */ U = uniform(); if (d * U <= t * t * t) break; /* Squeeze acceptance */ /* Step 5. Calculation of q */ if (x > 0.) { /* Step 6. */ v = t / (s + s); if (fabs(v) > 0.25) q = q0 - s * t + 0.25 * t * t + (ss + ss) * log(1. + v); else q = q0 + 0.5 * t * t * ((((((((a9 * v + a8) * v + a7) * v + a6) * v + a5) * v + a4) * v + a3) * v + a2) * v + a1) * v; /* Step 7. Quotient acceptance */ if (log(1. - U) <= q) break; } /* Step 8. Double exponential deviate t */ while (1) { do { E = -log( uniform() ); U = uniform(); U = U + U - 1.; sign_U = (U > 0) ? 1. : -1.; t = b + (E * si) * sign_U; } while (t <= -0.71874483771719); /* Step 9. Rejection of t */ /* Step 10. New q(t) */ v = t / (s + s); if (fabs(v) > 0.25) q = q0 - s * t + 0.25 * t * t + (ss + ss) * log(1. + v); else q = q0 + 0.5 * t * t * ((((((((a9 * v + a8) * v + a7) * v + a6) * v + a5) * v + a4) * v + a3) * v + a2) * v + a1) * v; /* Step 11. */ if (q <= 0.) continue; if (q > 0.5) w = exp(q) - 1.; else w = ((((((e7 * q + e6) * q + e5) * q + e4) * q + e3) * q + e2) * q + e1) * q; /* Step 12. Hat acceptance */ if ( c * U * sign_U <= w * exp(E - 0.5 * t * t)) { x = s + 0.5 * t; X = x * x; break; } } } while (0); /* -X- end of generator code -X- */ return ((DISTR.n_params==1) ? X : gamma + beta * X ); } /* end of _unur_stdgen_sample_gamma_gd() */ /*---------------------------------------------------------------------------*/ #undef GEN_N_PARAMS #undef ss #undef s #undef d #undef r #undef q0 #undef b #undef c #undef si #undef q1 #undef q2 #undef q3 #undef q4 #undef q5 #undef q6 #undef q7 #undef q8 #undef q9 #undef a1 #undef a2 #undef a3 #undef a4 #undef a5 #undef a6 #undef a7 #undef a8 #undef a9 #undef e1 #undef e2 #undef e3 #undef e4 #undef e5 #undef e6 #undef e7 /*---------------------------------------------------------------------------*/ #undef NORMAL /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/c_extremeII.c0000644001357500135600000003115314420445767016107 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: c_extremeII.c * * * * REFERENCES: * * * * [3] N.L. Johnson, S. Kotz and N. Balakrishnan * * Continuous Univariate Distributions, * * Volume 2, 2nd edition * * John Wiley & Sons, Inc., New York, 1995 * * * ***************************************************************************** * * * distr: Extreme value type II distribution [3; ch.22, p.2] * * (also Frechet-type distribution) * * * * * * Type II (also Frechet-type distribution) * * * * cdf: F(x) = exp( -((x-zeta)/theta)^(-k) ) * * pdf: f(x) = exp( -((x-zeta)/theta)^(-k)) * ((x-zeta)/theta)^(-k-1) * * domain: zeta < x 0 ... shape * * 1: zeta (0) ... location * * 2: theta > 0 (1) ... scale * * * *...........................................................................* * * * Standard Form: * * * * cdf: F(x) = exp( -x^(-k) ) * * pdf: f(x) = exp( -x^(-k) ) * x^(-k-1) * * domain: 0 < x #include #include #include "unur_distributions.h" #include "unur_distributions_source.h" #include "unur_stddistr.h" /*---------------------------------------------------------------------------*/ static const char distr_name[] = "extremeII"; /* parameters */ #define k params[0] /* shape */ #define zeta params[1] /* location */ #define theta params[2] /* scale */ #define DISTR distr->data.cont #define LOGNORMCONSTANT (distr->data.cont.norm_constant) /* function prototypes */ static double _unur_pdf_extremeII( double x, const UNUR_DISTR *distr ); static double _unur_dpdf_extremeII( double x, const UNUR_DISTR *distr ); static double _unur_cdf_extremeII( double x, const UNUR_DISTR *distr ); static double _unur_invcdf_extremeII( double u, const UNUR_DISTR *distr ); static int _unur_upd_mode_extremeII( UNUR_DISTR *distr ); static int _unur_upd_area_extremeII( UNUR_DISTR *distr ); static int _unur_set_params_extremeII( UNUR_DISTR *distr, const double *params, int n_params ); /*---------------------------------------------------------------------------*/ double _unur_pdf_extremeII( double x, const UNUR_DISTR *distr ) { register double xk; register const double *params = DISTR.params; if (DISTR.n_params > 1) /* standardize */ x = (x - zeta) / theta; /* standard form */ if (x<=0.) return 0.; xk = pow( x, -k - 1.); return ( exp( -xk * x - LOGNORMCONSTANT) * xk * k ); } /* end of _unur_pdf_extremeII() */ /*---------------------------------------------------------------------------*/ double _unur_dpdf_extremeII( double x, const UNUR_DISTR *distr ) { register double factor = 1.; register double xk; register const double *params = DISTR.params; if (DISTR.n_params > 1) { /* standardize */ factor = 1. / (theta * theta); x = (x - zeta) / theta; } /* standard form */ if (x<=0.) return 0.; xk = pow(x, k); return (- factor * exp(-1./xk) * k * (xk + k*(xk - 1.)) / pow(x,2. + 2.*k)) ; } /* end of unur_dpdf_extremeII() */ /*---------------------------------------------------------------------------*/ double _unur_cdf_extremeII( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; if (DISTR.n_params > 1) /* standardize */ x = (x - zeta) / theta; /* standard form */ if (x<=0.) return 0.; return ( exp( -pow( x, -k ) ) ); } /* end of _unur_cdf_extremeII() */ /*---------------------------------------------------------------------------*/ double _unur_invcdf_extremeII( double U, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; double X; X = exp( -log( -log(U) )/k ); return ((DISTR.n_params==1) ? X : zeta + theta * X ); } /* end of _unur_invcdf_extremeII() */ /*---------------------------------------------------------------------------*/ int _unur_upd_mode_extremeII( UNUR_DISTR *distr ) { DISTR.mode = DISTR.zeta + pow( DISTR.k/(DISTR.k+1.), 1/DISTR.k ) * DISTR.theta; /* mode must be in domain */ if (DISTR.mode < DISTR.domain[0]) DISTR.mode = DISTR.domain[0]; else if (DISTR.mode > DISTR.domain[1]) DISTR.mode = DISTR.domain[1]; return UNUR_SUCCESS; } /* end of _unur_upd_mode_extremeII() */ /*---------------------------------------------------------------------------*/ int _unur_upd_area_extremeII( UNUR_DISTR *distr ) { /* log of normalization constant */ LOGNORMCONSTANT = log(DISTR.theta); if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.area = 1.; return UNUR_SUCCESS; } /* else */ DISTR.area = ( _unur_cdf_extremeII( DISTR.domain[1],distr) - _unur_cdf_extremeII( DISTR.domain[0],distr) ); return UNUR_SUCCESS; } /* end of _unur_upd_area_extremeII() */ /*---------------------------------------------------------------------------*/ int _unur_set_params_extremeII( UNUR_DISTR *distr, const double *params, int n_params ) { /* check number of parameters for distribution */ if (n_params < 1) { _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } if (n_params > 3) { _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); n_params = 3; } CHECK_NULL(params,UNUR_ERR_NULL); /* check parameter k */ if (k <= 0.) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"k <= 0"); return UNUR_ERR_DISTR_DOMAIN; } /* check parameter theta */ if (n_params > 2 && theta <= 0.) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"theta <= 0"); return UNUR_ERR_DISTR_DOMAIN; } /* copy parameters for standard form */ DISTR.k = k; /* default parameters */ DISTR.zeta = 0.; DISTR.theta = 1.; /* copy optional parameters */ switch (n_params) { case 3: DISTR.theta = theta; /* FALLTHROUGH */ case 2: DISTR.zeta = zeta; n_params = 3; /* number of parameters for non-standard form */ /* FALLTHROUGH */ default: break; } /* store number of parameters */ DISTR.n_params = n_params; /* set (standard) domain */ if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.domain[0] = DISTR.zeta; /* left boundary */ DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ } return UNUR_SUCCESS; } /* end of _unur_set_params_extremeII() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_extremeII( const double *params, int n_params ) { register struct unur_distr *distr; /* get new (empty) distribution object */ distr = unur_distr_cont_new(); /* set distribution id */ distr->id = UNUR_DISTR_EXTREME_II; /* name of distribution */ distr->name = distr_name; /* how to get special generators */ /* DISTR.init = _unur_stdgen_extremeII_init; */ /* functions */ DISTR.pdf = _unur_pdf_extremeII; /* pointer to PDF */ DISTR.dpdf = _unur_dpdf_extremeII; /* pointer to derivative of PDF */ DISTR.cdf = _unur_cdf_extremeII; /* pointer to CDF */ DISTR.invcdf = _unur_invcdf_extremeII; /* pointer to inverse CDF */ /* indicate which parameters are set */ distr->set = ( UNUR_DISTR_SET_DOMAIN | UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_MODE | UNUR_DISTR_SET_PDFAREA ); /* set parameters for distribution */ if (_unur_set_params_extremeII(distr,params,n_params)!=UNUR_SUCCESS) { free(distr); return NULL; } /* log of normalization constant */ LOGNORMCONSTANT = log(DISTR.theta); /* mode and area below p.d.f. */ DISTR.mode = DISTR.zeta + pow( DISTR.k/(DISTR.k+1.), 1/DISTR.k ) * DISTR.theta; DISTR.area = 1.; /* function for setting parameters and updating domain */ DISTR.set_params = _unur_set_params_extremeII; /* function for updating derived parameters */ DISTR.upd_mode = _unur_upd_mode_extremeII; /* funct for computing mode */ DISTR.upd_area = _unur_upd_area_extremeII; /* funct for computing area */ /* return pointer to object */ return distr; } /* end of unur_distr_extremeII() */ /*---------------------------------------------------------------------------*/ #undef c #undef alpha #undef zeta #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/unur_distributions_source.h0000644001357500135600000006401714420445767021257 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: unur_distribution_source.h * * * * PURPOSE: * * defines macros and prototypes for special generators * * of distribtions. * * * * * * NAMING SCHEME: * * Includes all distribution source files. * * (Not all of these function exist for every distribution!) * * * * double _unur_pdf_(double x, UNUR_DISTR *distr) * * ... value of PDF at x * * double _unur_dpdf_(double x, UNUR_DISTR *distr) * * ... value of derivative of PDF at x * * double _unur_cdf_(double x, UNUR_DISTR *distr) * * ... value of CDF at x * * double _unur_mode_(double *params, int n_params) * * ... mode of distribution * * double _unur_normconstant_(double *params, int n_params) * * ... normalization constant of PDF * * double _unur_lognormconstant_(double *params, int n_params) * * ... log of normalization constant of PDF * * int _unur_stdgen__init( * * UNUR_PAR *parameters, UNUR_GEN *generator) * * ... initialize new (special) generator for distribution * * double unur_stdgen_sample__(UNUR_GEN *generator) * * ... call (special) generator for distribution * * * * double x ... argument of PDF * * double* params ... parameter list for PDF * * int n_params ... number of parameters (length of array) * * * * UNUR_DISTR* distr ... pointer to distribution object * * UNUR_PAR* parameters ... pointer to paraters of generator * * UNUR_GEN* generator ... pointer to generator object * * * * * * REFERENCES: * * * * [1] N.L. Johnson, S. Kotz, and A.W. Kemp * * Univariate Discrete Distributions, * * 2nd edition * * John Wiley & Sons, Inc., New York, 1992 * * * * [2] N.L. Johnson, S. Kotz, and N. Balakrishnan * * Continuous Univariate Distributions, * * Volume 1, 2nd edition * * John Wiley & Sons, Inc., New York, 1994 * * * * [3] N.L. Johnson, S. Kotz, and N. Balakrishnan * * Continuous Univariate Distributions, * * Volume 2, 2nd edition * * John Wiley & Sons, Inc., New York, 1995 * * * * [4] N.L. Johnson, S. Kotz, and N. Balakrishnan * * Discrete Multivariate Distributions, * * John Wiley & Sons, Inc., New York, 1997 * * * * [5] S. Kotz, N. Balakrishnan, and N.L. Johnson * * Continuous Multivariate Distributions, * * Volume 1: Models and Applications * * John Wiley & Sons, Inc., New York, 2000 * * * * [0] S. Kotz and N.L. Johnson * * Encyclopedia of Statistical Sciences * * Volumes 1-9 * * John Wiley & Sons, Inc., New York, 1982-1988 * * * ***************************************************************************** * * * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifndef UNUR_DISTRIBUTIONS_SOURCE_H_SEEN #define UNUR_DISTRIBUTIONS_SOURCE_H_SEEN /*---------------------------------------------------------------------------*/ /***************************************************************************** * * * Continuous univariate distributions * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Beta distribution [3; ch.25, p.210] */ /* initialize special generator */ int _unur_stdgen_beta_init( UNUR_PAR *parameters, UNUR_GEN *generator ); /* Acceptance/Rejection from log-logistic hats */ double _unur_stdgen_sample_beta_bb( UNUR_GEN *generator ); double _unur_stdgen_sample_beta_bc( UNUR_GEN *generator ); /* Stratified Rejection/Patchwork Rejection */ double _unur_stdgen_sample_beta_b00( UNUR_GEN *generator ); double _unur_stdgen_sample_beta_b01( UNUR_GEN *generator ); double _unur_stdgen_sample_beta_b1prs( UNUR_GEN *generator ); double _unur_stdgen_sample_beta_binv( UNUR_GEN *generator ); /*---------------------------------------------------------------------------*/ /* Burr family of distributions [2; ch.12, p.54] */ /* initialize special generator */ int _unur_stdgen_burr_init( UNUR_PAR *parameters, UNUR_GEN *generator ); /*---------------------------------------------------------------------------*/ /* Cauchy distribution [2; ch.16, p.299] */ /* initialize special generator */ int _unur_stdgen_cauchy_init( UNUR_PAR *parameters, UNUR_GEN *generator ); /*---------------------------------------------------------------------------*/ /* Chi distribution [2; ch.18, p.417] */ /* initialize special generator */ int _unur_stdgen_chi_init( UNUR_PAR *parameters, UNUR_GEN *generator ); /* Ratio of Uniforms with shift */ double _unur_stdgen_sample_chi_chru( UNUR_GEN *generator ); /*---------------------------------------------------------------------------*/ /* Chisquare distribution [2; ch.18, p.416] */ /*---------------------------------------------------------------------------*/ /* Erlang distribution */ /*---------------------------------------------------------------------------*/ /* Exponential distribution [2; ch.19, p.494] */ /* initialize special generator */ int _unur_stdgen_exponential_init( UNUR_PAR *parameters, UNUR_GEN *generator ); /* Inversion method */ double _unur_stdgen_sample_exponential_inv( UNUR_GEN *generator ); /*---------------------------------------------------------------------------*/ /* Extreme value type I distribution [3; ch.22, p.2] */ /* initialize special generator */ int _unur_stdgen_extremeI_init( UNUR_PAR *parameters, UNUR_GEN *generator ); /*---------------------------------------------------------------------------*/ /* Extreme value type II distribution [3; ch.22, p.2] */ /* initialize special generator */ int _unur_stdgen_extremeII_init( UNUR_PAR *parameters, UNUR_GEN *generator ); /*---------------------------------------------------------------------------*/ /* F distribution [3; ch.27, p.332] */ /*---------------------------------------------------------------------------*/ /* Gamma distribution [2; ch.17, p.337] */ /* initialize special generator */ int _unur_stdgen_gamma_init( UNUR_PAR *parameters, UNUR_GEN *generator ); /* Rejection with log-logistic envelopes */ double _unur_stdgen_sample_gamma_gll( UNUR_GEN *generator ); /* Acceptance Rejection combined with Acceptance Complement */ double _unur_stdgen_sample_gamma_gs( UNUR_GEN *generator ); double _unur_stdgen_sample_gamma_gd( UNUR_GEN *generator ); /*---------------------------------------------------------------------------*/ /* Generalized hyperbolic distribution */ /*---------------------------------------------------------------------------*/ /* Generalized inverse Gaussian distribution [2; ch.15, p.284] */ /* initialize special generator */ int _unur_stdgen_gig_init( UNUR_PAR *parameters, UNUR_GEN *generator ); /* Ratio of Uniforms */ double _unur_stdgen_sample_gig_gigru( UNUR_GEN *generator ); /*---------------------------------------------------------------------------*/ /* Inverse Gaussian (Wald) distribution [2; ch.15, p.259] */ /*---------------------------------------------------------------------------*/ /* Laplace distribution [3; ch.24, p.164] */ /* initialize special generator */ int _unur_stdgen_laplace_init( UNUR_PAR *parameters, UNUR_GEN *generator ); /*---------------------------------------------------------------------------*/ /* Logistic distribution [3; ch.23, p.115] */ /* initialize special generator */ int _unur_stdgen_logistic_init( UNUR_PAR *parameters, UNUR_GEN *generator ); /*---------------------------------------------------------------------------*/ /* Lognormal distribution [2; ch.14, p.208] */ /*---------------------------------------------------------------------------*/ /* Lomax distribution (Pareto distr. of second kind) [2; ch.20, p.575] */ /* initialize special generator */ int _unur_stdgen_lomax_init( UNUR_PAR *parameters, UNUR_GEN *generator ); /*---------------------------------------------------------------------------*/ /* Meixner distribution */ /*---------------------------------------------------------------------------*/ /* Normal distribution [2; ch.13, p.80] */ /* initialize special generator */ int _unur_stdgen_normal_init( UNUR_PAR *parameters, UNUR_GEN *generator ); /* Box-Muller method */ double _unur_stdgen_sample_normal_bm( UNUR_GEN *generator ); /* Polarmethod with rejection */ double _unur_stdgen_sample_normal_pol( UNUR_GEN *generator ); /* Ratio-of-uniforms method with squeeze */ double _unur_stdgen_sample_normal_quo( UNUR_GEN *generator ); /* "Naive" ratio-of-uniforms method */ double _unur_stdgen_sample_normal_nquo( UNUR_GEN *generator ); /* Ratio-of-uniforms method with quadratic bounding curves */ double _unur_stdgen_sample_normal_leva( UNUR_GEN *generator ); /* Kindermann-Ramage method */ double _unur_stdgen_sample_normal_kr( UNUR_GEN *generator ); /* Acceptance-complement ratio */ double _unur_stdgen_sample_normal_acr( UNUR_GEN *generator ); /* infamous sum-of-12-uniforms method. NEVER use it!! */ double _unur_stdgen_sample_normal_sum( UNUR_GEN *generator ); /*---------------------------------------------------------------------------*/ /* Pareto distribution (of first kind) [2; ch.20, p.574] */ /* initialize special generator */ int _unur_stdgen_pareto_init( UNUR_PAR *parameters, UNUR_GEN *generator ); /*---------------------------------------------------------------------------*/ /* Pearson VI distribution */ /*---------------------------------------------------------------------------*/ /* Perks distribution */ /*---------------------------------------------------------------------------*/ /* Planck distribution */ /*---------------------------------------------------------------------------*/ /* Power-exponential (Subbotin) distribution [3; ch.24, p.195] */ /* initialize special generator */ int _unur_stdgen_powerexponential_init( UNUR_PAR *parameters, UNUR_GEN *generator ); /* rejection method for logconcave densities */ double _unur_stdgen_sample_powerexponential_epd( UNUR_GEN *generator ); /*---------------------------------------------------------------------------*/ /* Rayleigh distribution [2; ch.18, p.456] */ /*---------------------------------------------------------------------------*/ /* Snedecor's F distribution */ /*---------------------------------------------------------------------------*/ /* Student's t distribution [3; ch. 28; p. 362] */ /* initialize special generator */ int _unur_stdgen_student_init( UNUR_PAR *parameters, UNUR_GEN *generator ); /* Polar Method */ double _unur_stdgen_sample_student_tpol( UNUR_GEN *generator ); /* Ratio of Uniforms */ double _unur_stdgen_sample_student_trouo( UNUR_GEN *generator ); /*---------------------------------------------------------------------------*/ /* Slash distribution [2; ch.12, p.63] */ /* initialize special generator */ int _unur_stdgen_slash_init( UNUR_PAR *parameters, UNUR_GEN *generator ); /* Ratio of normal and uniform random variates */ double _unur_stdgen_sample_slash_slash( UNUR_GEN *generator ); /*---------------------------------------------------------------------------*/ /* Triangular distribution [3; ch.26, p.297] */ /* initialize special generator */ int _unur_stdgen_triangular_init( UNUR_PAR *parameters, UNUR_GEN *generator ); /*---------------------------------------------------------------------------*/ /* Uniform distribution [3; ch.26, p.276] */ /* initialize special generator */ int _unur_stdgen_uniform_init( UNUR_PAR *parameters, UNUR_GEN *generator ); /*---------------------------------------------------------------------------*/ /* Variance Gamma distribution */ /*---------------------------------------------------------------------------*/ /* Weibull distribution [2; ch.21, p.628] */ /* initialize special generator */ int _unur_stdgen_weibull_init( UNUR_PAR *parameters, UNUR_GEN *generator ); /*---------------------------------------------------------------------------*/ /***************************************************************************** * * * Continuous multivariate distributions * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Multinormal distribution [5; ch.45, p.107] */ /* initialize special generator */ int _unur_stdgen_multinormal_init( UNUR_GEN *generator ); /* Cholesky decomposition of covariance matrix */ int _unur_stdgen_sample_multinormal_cholesky( UNUR_GEN *generator, double *X ); /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /***************************************************************************** * * * Continuous matrix distributions * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Random correlation matrix */ /*---------------------------------------------------------------------------*/ /***************************************************************************** * * * Discrete univariate distributions * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Binomial distribution [1; ch.3, p.105] */ /* initialize special generator */ int _unur_stdgen_binomial_init( UNUR_PAR *parameters, UNUR_GEN *generator ); /*---------------------------------------------------------------------------*/ /* Geometric distribution [1; ch.5.2, p.201] */ /* initialize special generator */ int _unur_stdgen_geometric_init( UNUR_PAR *parameters, UNUR_GEN *generator ); /* Inversion */ int _unur_stdgen_sample_geometric_inv( UNUR_GEN *generator ); /*---------------------------------------------------------------------------*/ /* Hypergometric distribution [1; ch.6, p.237] */ /* initialize special generator */ int _unur_stdgen_hypergeometric_init( UNUR_PAR *parameters, UNUR_GEN *generator ); /*---------------------------------------------------------------------------*/ /* Logarithmic distribution [1; ch.7, p.285] */ /* initialize special generator */ int _unur_stdgen_logarithmic_init( UNUR_PAR *parameters, UNUR_GEN *generator ); /* Acceptance Rejection */ int _unur_stdgen_sample_logarithmic_lsk( UNUR_GEN *generator ); /*---------------------------------------------------------------------------*/ /* Negative Binomial distribution [1; ch.5.1, p.200] */ /* initialize special generator */ /* int _unur_stdgen_negativebinomial_init( UNUR_PAR *parameters, UNUR_GEN *generator ); */ /* Compound method */ /* int _unur_stdgen_sample_negativebinomial_nbp( UNUR_GEN *generator ); */ /*---------------------------------------------------------------------------*/ /* Poisson distribution [1; ch.4, p.151] */ /* initialize special generator */ int _unur_stdgen_poisson_init( UNUR_PAR *parameters, UNUR_GEN *generator ); /* Tabulated Inversion combined with Acceptance Complement */ int _unur_stdgen_sample_poisson_pdtabl( UNUR_GEN *generator ); int _unur_stdgen_sample_poisson_pdac( UNUR_GEN *generator ); /* Tabulated Inversion combined with Patchwork Rejection */ /* int _unur_stdgen_sample_poisson_pdtabl( UNUR_GEN *generator ); */ int _unur_stdgen_sample_poisson_pprsc( UNUR_GEN *generator ); /*---------------------------------------------------------------------------*/ /* Zipf (or Zeta) distribution [1; ch.11.20, p.465] */ /* initialize special generator */ int _unur_stdgen_zipf_init( UNUR_PAR *parameters, UNUR_GEN *generator ); /* Acceptance Rejection */ int _unur_stdgen_sample_zipf_zet( UNUR_GEN *generator ); /*---------------------------------------------------------------------------*/ /***************************************************************************** * * * Macros * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* set routine for sampling */ #define _unur_cstd_set_sampling_routine(gen,routine) \ do { \ if ((gen)==NULL) return UNUR_SUCCESS; /* test existence only */ \ (gen)->sample.cont = (routine); /* set pointer */ \ ((struct unur_cstd_gen*)gen->datap)->sample_routine_name = #routine; /* set routine name */ \ } while (0) #define _unur_dstd_set_sampling_routine(gen,routine) \ do { \ if ((gen)==NULL) return UNUR_SUCCESS; /* test existence only */ \ (gen)->sample.discr = (routine); /* set pointer */ \ ((struct unur_dstd_gen*)gen->datap)->sample_routine_name = #routine; /* set routine name */ \ } while (0) /*---------------------------------------------------------------------------*/ #endif /* UNUR_DISTRIBUTIONS_SOURCE_H_SEEN */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/c_beta_gen.c0000644001357500135600000007575114420445767015774 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: c_beta_gen.c * * * * Special generators for Beta distribution * * * ***************************************************************************** * * * Copyright (c) 2000-2011 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "unur_distributions_source.h" /*---------------------------------------------------------------------------*/ /* init routines for special generators */ inline static int beta_bc_init( struct unur_gen *gen ); inline static int beta_bb_init( struct unur_gen *gen ); inline static int beta_b00_init( struct unur_gen *gen ); inline static int beta_b01_init( struct unur_gen *gen ); inline static int beta_b1prs_init( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* abbreviations */ #define PAR ((struct unur_cstd_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_cstd_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.cont /* data for distribution in generator object */ #define uniform() _unur_call_urng(gen->urng) /* call for uniform prng */ /* #define MAX_gen_params (22) maximal number of parameters for generator */ #define p (DISTR.params[0]) /* shape parameter */ #define q (DISTR.params[1]) /* shape parameter */ #define a (DISTR.params[2]) /* left boundary */ #define b (DISTR.params[3]) /* right boundary */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Inititialize **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ int _unur_stdgen_beta_init( struct unur_par *par, struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* initialize special generator for gamma distribution. */ /* if gen == NULL then only check existance of variant. */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* one of par and gen must not be the NULL pointer */ switch ((par) ? par->variant : gen->variant) { case 0: /* DEFAULT */ case 1: /* Rejection with log-logistic envelopes */ if (gen==NULL) return UNUR_SUCCESS; /* test existence only */ if (p>1. && q>1.) { _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_beta_bb ); return beta_bb_init( gen ); } else { _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_beta_bc ); return beta_bc_init( gen ); } case 2: /* Stratified Rejection/Patchwork Rejection */ if (gen==NULL) return UNUR_SUCCESS; /* test existence only */ if (p > 1. && q > 1.) { _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_beta_b1prs ); return beta_b1prs_init( gen ); } else if (p < 1. && q < 1.) { _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_beta_b00 ); return beta_b00_init( gen ); } else if (_unur_isone(p) || _unur_isone(q)) { /* p==1 || q==1 */ _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_beta_binv ); return UNUR_SUCCESS; } else { /* (p > 1 && q < 1) || (p < 1 && q > 1) */ _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_beta_b01 ); return beta_b01_init( gen ); } default: /* no such generator */ return UNUR_FAILURE; } } /* end of _unur_stdgen_beta_init() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Special generators **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ /***************************************************************************** * * * Beta Distribution: Acceptance/Rejection from log-logistic hats for the * * beta prime distribution * * * ***************************************************************************** * * * FUNCTION: - samples a random number from the Beta distribution with * * parameters p,q (p > 0, q > 0). * * It combines algorithms bb (p > 1, q > 1) and * * bc (p <= 1 or q <= 1). * * * * REFERENCE : - R.C.H. Cheng (1978): Generating beta variates with * * nonintegral shape parameters, * * Communications of the ACM 21, 317-322. * * * * ROUTINES: - bb ... Beta generator for p > 1, q > 1 * * - bc ... Beta generator for p <= 1 or q <= 1 * * * * Implemented by E. Stadlober, R. Kremer, 1990 * ***************************************************************************** * WinRand (c) 1995 Ernst Stadlober, Institut fuer Statistitk, TU Graz * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #define GEN_N_PARAMS (8) #define am (GEN->gen_param[0]) #define bm (GEN->gen_param[1]) #define al (GEN->gen_param[2]) #define alnam (GEN->gen_param[3]) #define be (GEN->gen_param[4]) #define si (GEN->gen_param[5]) #define rk1 (GEN->gen_param[6]) #define rk2 (GEN->gen_param[7]) /*---------------------------------------------------------------------------*/ inline static int beta_bc_init( struct unur_gen *gen ) /* p <= 1. || q <= 1. */ { /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_ERR_COOKIE); if (GEN->gen_param == NULL || GEN->n_gen_param != GEN_N_PARAMS) { GEN->n_gen_param = GEN_N_PARAMS; GEN->gen_param = _unur_xrealloc(GEN->gen_param, GEN->n_gen_param * sizeof(double)); } /* -X- setup code -X- */ am = (p > q) ? p : q; bm = (p < q) ? p : q; al = am + bm; alnam = al * log(al/am) - 1.386294361; be = 1.0 / bm; si = 1.0 + am - bm; rk1 = si * (0.013888889 + 0.041666667 * bm) / (am * be - 0.77777778); rk2 = 0.25 + (0.5 + 0.25 / si) * bm; /* -X- end of setup code -X- */ return UNUR_SUCCESS; } /* end of beta_bc_init() */ double _unur_stdgen_sample_beta_bc( struct unur_gen *gen ) /* p <= 1. || q <= 1. */ { /* -X- generator code -X- */ double X; double u1,u2,v,w,y,z; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); while (1) { /* Step 1 */ u1 = uniform(); u2 = uniform(); if (u1 < 0.5) { /* Step 2 */ y = u1 * u2; z = u1 * y; if ((0.25 * u2 - y + z) >= rk1) continue; /* goto 1 */ /* Step 5 */ v = be * log(u1 / (1.0 - u1)); if (v > 80.0) { if (alnam < log(z)) continue; X = (_unur_FP_same(am,p)) ? 1.0 : 0.0; break; } else { w = am * exp(v); if ((al * (log(al / (bm + w)) + v) - 1.386294361) < log(z)) continue; /* goto 1 */ /* Step 6_a */ X = (!_unur_FP_same(am,p)) ? bm / (bm + w) : w / (bm + w); break; } } else { /* Step 3 */ z = u1 * u1 * u2; if (z < 0.25) { /* Step 5 */ v = be * log(u1 / (1.0 - u1)); if (v > 80.0) { X = (_unur_FP_same(am,p)) ? 1.0 : 0.0; break; } w = am * exp(v); X = (!_unur_FP_same(am,p)) ? bm / (bm + w) : w / (bm + w); break; } else { if (z >= rk2) continue; v = be * log(u1 / (1.0 - u1)); if ( v > 80.0) { if (alnam < log(z)) continue; X = (_unur_FP_same(am,p)) ? 1.0 : 0.0; break; } w = am * exp(v); if ((al * (log(al / (bm + w)) + v) - 1.386294361) < log(z)) continue; /* goto 1 */ /* Step 6_b */ X = (!_unur_FP_same(am,p))? bm / (bm + w) : w / (bm + w); break; } } } /* -X- end of generator code -X- */ return ((DISTR.n_params==2) ? X : a + (b-a) * X); } /* end of _unur_stdgen_sample_beta_bc() */ /*---------------------------------------------------------------------------*/ #undef GEN_N_PARAMS #undef am #undef bm #undef al #undef alnam #undef be #undef si #undef rk1 #undef rk2 /*---------------------------------------------------------------------------*/ #define GEN_N_PARAMS (5) #define am (GEN->gen_param[0]) #define bm (GEN->gen_param[1]) #define al (GEN->gen_param[2]) #define be (GEN->gen_param[3]) #define ga (GEN->gen_param[4]) /*---------------------------------------------------------------------------*/ inline static int beta_bb_init( struct unur_gen *gen ) /* p > 1. && q > 1. */ { /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_ERR_COOKIE); if (GEN->gen_param == NULL || GEN->n_gen_param != GEN_N_PARAMS) { GEN->n_gen_param = GEN_N_PARAMS; GEN->gen_param = _unur_xrealloc(GEN->gen_param, GEN->n_gen_param * sizeof(double)); } /* -X- setup code -X- */ am = (p < q) ? p : q; bm = (p > q) ? p : q; al = am + bm; be = sqrt((al - 2.0)/(2.0 * p * q - al)); ga = am + 1.0 / be; /* -X- end of setup code -X- */ return UNUR_SUCCESS; } /* end of beta_bb_init() */ double _unur_stdgen_sample_beta_bb( struct unur_gen *gen ) /* p > 1. && q > 1. */ { /* -X- generator code -X- */ double X; double u1,u2,v,w,z,r,s,t; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); while (1) { /* Step 1 */ u1 = uniform(); u2 = uniform(); v = be * log(u1 / (1.0 - u1)); w = am * exp(v); z = u1 * u1 * u2; r = ga * v - 1.386294361; s = am + r - w; /* Step 2 */ if (s + 2.609437912 < 5.0 * z) { /* Step 3 */ t = log(z); if (s < t) /* Step 4 */ if (r + al * log(al/(bm + w)) < t) continue; } /* Step 5 */ X = (_unur_FP_same(am,p)) ? w / (bm + w) : bm / (bm + w); break; } /* -X- end of generator code -X- */ return ((DISTR.n_params==2) ? X : a + (b-a) * X); } /* end of _unur_stdgen_sample_beta_bb() */ /*---------------------------------------------------------------------------*/ #undef GEN_N_PARAMS #undef am #undef bm #undef al #undef be #undef ga /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /***************************************************************************** * * * Beta Distribution: Stratified Rejection/Patchwork Rejection * * * ***************************************************************************** * * * FUNCTION: - samples a random number from the Beta distribution with * * parameters p,q (p > 0, q > 0). * * * * REFERENCES: - H. Sakasegawa (1983): Stratified rejection and squeeze * * method for generating beta random numbers, * * Ann. Inst. Statist. Math. 35 B, 291-302. * * - H. Zechner, E. Stadlober (1993): Generating beta variates * * via patchwork rejection, Computing 50, 1-18. * * * * ROUTINES: - b00 ... Beta generator for p < 1, q < 1 * * - b01 ... Beta generator for p < 1 < q or p > 1 > q * * - b1prs ... Beta generator for p > 1, q > 1 * * * * Implemented by H. Zechner and F. Niederl, July 1994 * ***************************************************************************** * * * For parameters p < 1 , q < 1 and p < 1 < q or q < 1 < p the * * stratified rejection methods b00 and b01 of Sakasegawa are used. Both * * procedures employ suitable two-part power functions from which samples * * can be obtained by inversion. * * If p > 1, q > 1 (unimodal case) the patchwork rejection method b1prs * * of Zechner/Stadlober is utilized: The area below the density function * * f(x) in its body is rearranged by certain point reflections. Within a * * large center interval variates are sampled efficiently by rejection * * from uniform hats. Rectangular immediate acceptance regions speed up * * the generation. The remaining tails are covered by exponential * * functions. * * If (p-1)(q-1) = 0 sampling is done by inversion if either p or q are * * not equal to one. If p = q = 1 a uniform random variate is delivered. * * * ***************************************************************************** * WinRand (c) 1995 Ernst Stadlober, Institut fuer Statistitk, TU Graz * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #define GEN_N_PARAMS (8) #define p_ (GEN->gen_param[0]) #define q_ (GEN->gen_param[1]) #define c (GEN->gen_param[2]) #define t (GEN->gen_param[3]) #define fp (GEN->gen_param[4]) #define fq (GEN->gen_param[5]) #define p1 (GEN->gen_param[6]) #define p2 (GEN->gen_param[7]) /*---------------------------------------------------------------------------*/ inline static int beta_b00_init( struct unur_gen *gen ) /* p < 1. && q < 1. */ { /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_ERR_COOKIE); if (GEN->gen_param == NULL || GEN->n_gen_param != GEN_N_PARAMS) { GEN->n_gen_param = GEN_N_PARAMS; GEN->gen_param = _unur_xrealloc(GEN->gen_param, GEN->n_gen_param * sizeof(double)); } /* -X- setup code -X- */ p_ = p - 1.; q_ = q - 1.; c = (q * q_) / (p * p_); /* q(1-q) / p(1-p) */ t = _unur_FP_same(c,1.) ? 0.5 : (1. - sqrt(c))/(1. - c); /* t = t_opt */ fp = exp(p_ * log(t)); fq = exp(q_ * log(1. - t)); /* f(t) = fa * fb */ p1 = t/p; /* 0 < X < t */ p2 = (1. - t)/q + p1; /* t < X < 1 */ /* -X- end of setup code -X- */ return UNUR_SUCCESS; } /* end of beta_b00_init() */ double _unur_stdgen_sample_beta_b00( struct unur_gen *gen ) /* p < 1. && q < 1. */ { /* -X- generator code -X- */ double U, V, X, Z; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); while (1) { U = uniform() * p2; if (U <= p1) { /* X < t */ Z = exp(log(U/p1) / p); X = t * Z; /* squeeze accept: L(x) = 1 + (1 - q)x */ V = uniform() * fq; if (V <= 1. - q_ * X) break; /* squeeze reject: U(x) = 1 + ((1 - t)^(q-1) - 1)/t * x */ if (V <= 1. + (fq - 1.) * Z) { /* quotient accept: quot(x) = (1 - x)^(q-1) / fq */ if (log(V) <= q_ * log(1. - X)) break; } } else { /* X > t */ Z = exp( log( (U-p1)/(p2-p1) ) / q); X = 1. - (1. - t)*Z; /* squeeze accept: L(x) = 1 + (1 - p)(1 - x) */ V = uniform() * fp; if (V <= 1.0 - p_*(1. - X)) break; /* squeeze reject: U(x) = 1 + (t^(p-1) - 1)/(1 - t) * (1 - x) */ if (V <= 1.0 + (fp - 1.) * Z) { /* quotient accept: quot(x) = x^(p-1) / fp */ if (log(V) <= p_ * log(X)) break; } } } /* -X- end of generator code -X- */ return ((DISTR.n_params==2) ? X : a + (b-a) * X); } /* end of _unur_stdgen_sample_beta_b00() */ /*---------------------------------------------------------------------------*/ #undef GEN_N_PARAMS #undef p_ #undef q_ #undef c #undef t #undef fp #undef fq #undef p1 #undef p2 /*---------------------------------------------------------------------------*/ #define GEN_N_PARAMS (11) #define pint (GEN->gen_param[0]) #define qint (GEN->gen_param[1]) #define p_ (GEN->gen_param[2]) #define q_ (GEN->gen_param[3]) #define t (GEN->gen_param[4]) #define fp (GEN->gen_param[5]) #define fq (GEN->gen_param[6]) #define ml (GEN->gen_param[7]) #define mu (GEN->gen_param[8]) #define p1 (GEN->gen_param[9]) #define p2 (GEN->gen_param[10]) /*---------------------------------------------------------------------------*/ inline static int beta_b01_init( struct unur_gen *gen ) /* p < 1. < q || p > 1. > q */ { /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_ERR_COOKIE); if (GEN->gen_param == NULL || GEN->n_gen_param != GEN_N_PARAMS) { GEN->n_gen_param = GEN_N_PARAMS; GEN->gen_param = _unur_xrealloc(GEN->gen_param, GEN->n_gen_param * sizeof(double)); } /* -X- setup code -X- */ /* internal use of p and q */ if (p>q) { /* swap p and q */ pint = q; qint = p; } else { pint = p; qint = q; } p_ = pint - 1.; q_ = qint - 1.; t = p_/(pint - qint); /* one step Newton * start value t */ fq = exp((q_ - 1.) * log(1. - t)); fp = pint - (pint + q_) * t; t -= (t - (1. - fp) * (1. - t) * fq / qint) / (1. - fp*fq); fp = exp(p_ * log(t)); fq = exp(q_ * log(1. - t)); /* f(t) = fa * fb */ if (q_ <= 1.0) { ml = (1. - fq) / t; /* ml = -m1 */ mu = q_ * t; /* mu = -m2 * t */ } else { ml = q_; mu = 1. - fq; } p1 = t/pint; /* 0 < X < t */ p2 = fq * (1. - t)/qint + p1; /* t < X < 1 */ /* -X- end of setup code -X- */ return UNUR_SUCCESS; } /* end of beta_b01_init() */ double _unur_stdgen_sample_beta_b01( struct unur_gen *gen ) /* p < 1. < q || p > 1. > q */ { /* -X- generator code -X- */ double U, V, X, Z; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); while (1) { U = uniform() * p2; if (U <= p1) { /* X < t */ Z = exp( log(U/p1) / pint); X = t * Z; /* squeeze accept: L(x) = 1 + m1*x, ml = -m1 */ V = uniform(); if (V <= 1. - ml * X) break; /* squeeze reject: U(x) = 1 + m2*x, mu = -m2 * t */ if (V <= 1. - mu * Z) /* quotient accept: quot(x) = (1 - x)^(q-1) */ if (log(V) <= q_ * log(1. - X)) break; } else { /* X > t */ Z = exp( log((U-p1)/(p2-p1)) / qint); X = 1. - (1. - t) * Z; /* squeeze accept: L(x) = 1 + (1 - p)(1 - x) */ V = uniform() * fp; if (V <= 1. - p_ * (1. - X)) break; /* squeeze reject: U(x) = 1 + (t^(p-1) - 1)/(1 - t) * (1 - x) */ if (V <= 1. + (fp - 1.) * Z) /* quotient accept: quot(x) = (x)^(p-1) / fp */ if (log(V) <= p_ * log(X)) break; } } if (p>q) /* p and q has been swapped */ X = 1. - X; /* -X- end of generator code -X- */ return ((DISTR.n_params==2) ? X : a + (b-a) * X); } /* end of _unur_stdgen_sample_beta_b01() */ /*---------------------------------------------------------------------------*/ #undef GEN_N_PARAMS #undef pint #undef qint #undef p_ #undef q_ #undef t #undef fp #undef fq #undef ml #undef mu #undef p1 #undef p2 /*---------------------------------------------------------------------------*/ #define GEN_N_PARAMS (22) #define p_ (GEN->gen_param[0]) #define q_ (GEN->gen_param[1]) #define s (GEN->gen_param[2]) #define m (GEN->gen_param[3]) #define D (GEN->gen_param[4]) #define Dl (GEN->gen_param[5]) #define x1 (GEN->gen_param[6]) #define x2 (GEN->gen_param[7]) #define x4 (GEN->gen_param[8]) #define x5 (GEN->gen_param[9]) #define f1 (GEN->gen_param[10]) #define f2 (GEN->gen_param[11]) #define f4 (GEN->gen_param[12]) #define f5 (GEN->gen_param[13]) #define ll (GEN->gen_param[14]) #define lr (GEN->gen_param[15]) #define z2 (GEN->gen_param[16]) #define z4 (GEN->gen_param[17]) #define p1 (GEN->gen_param[18]) #define p2 (GEN->gen_param[19]) #define p3 (GEN->gen_param[20]) #define p4 (GEN->gen_param[21]) /*---------------------------------------------------------------------------*/ inline static int beta_b1prs_init( struct unur_gen *gen ) /* p > 1. && q > 1. */ { /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_ERR_COOKIE); if (GEN->gen_param == NULL || GEN->n_gen_param != GEN_N_PARAMS) { GEN->n_gen_param = GEN_N_PARAMS; GEN->gen_param = _unur_xrealloc(GEN->gen_param, GEN->n_gen_param * sizeof(double)); } /* -X- setup code -X- */ p_ = p - 1.0; q_ = q - 1.0; s = p_ + q_; m = p_ / s; if (p_ > 1. || q_ > 1.) D = sqrt(m * (1. - m) / (s - 1.)); if (p_ <= 1.) { x2 = Dl = m * 0.5; x1 = z2 = f1 = ll = 0.; } else { x2 = m - D; x1 = x2 - D; z2 = x2 * (1. - (1. - x2)/(s * D)); if (x1 <= 0. || (s - 6.) * x2 - p_ + 3. > 0.) { x1 = z2; x2 = (x1 + m) * 0.5; Dl = m - x2; } else { Dl = D; } f1 = exp( p_ * log(x1/m) + q_ * log((1. - x1)/(1. - m)) ); ll = x1 * (1.0 - x1) / (s * (m - x1)); /* z1 = x1 - ll */ } f2 = exp( p_ * log(x2/m) + q_ * log((1. - x2)/(1. - m)) ); if (q_ <= 1.) { D = (1. - m) * 0.5; x4 = 1. - D; x5 = z4 = 1.; f5 = lr = 0.; } else { x4 = m + D; x5 = x4 + D; z4 = x4 * (1. + (1. - x4)/(s * D)); if (x5 >= 1. || (s - 6.) * x4 - p_ + 3. < 0.) { x5 = z4; x4 = (m + x5) * 0.5; D = x4 - m; } f5 = exp( p_ * log(x5/m) + q_ * log((1. - x5)/(1. - m)) ); lr = x5 * (1. - x5) / (s * (x5 - m)); /* z5 = x5 + lr */ } f4 = exp( p_ * log(x4/m) + q_ * log((1. - x4)/(1. - m)) ); p1 = f2 * (Dl + Dl); /* x1 < X < m */ p2 = f4 * (D + D) + p1; /* m < X < x5 */ p3 = f1 * ll + p2; /* X < x1 */ p4 = f5 * lr + p3; /* x5 < X */ /* -X- end of setup code -X- */ return UNUR_SUCCESS; } /* end of beta_b1prs_init() */ double _unur_stdgen_sample_beta_b1prs( struct unur_gen *gen ) /* p > 1. && q > 1. */ { /* -X- generator code -X- */ double U, V, W, X, Y; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); while (1) { U = uniform() * p4; if (U <= p1) { /* immediate accept: x2 < X < m, - f(x2) < W < 0 */ W = U/Dl - f2; if (W <= 0.) { X = m - U/f2; break; } /* immediate accept: x1 < X < x2, 0 < W < f(x1) */ if (W <= f1) { X = x2 - W/f1 * Dl; break; } /* candidates for acceptance-rejection-test */ U = uniform(); V = Dl * U; X = x2 - V; Y = x2 + V; /* squeeze accept: L(x) = f(x2) (x - z2) / (x2 - z2) */ if (W * (x2 - z2) <= f2 * (X - z2)) break; V = f2 + f2 - W; if (V < 1.) { /* squeeze accept: L(x) = f(x2) + (1 - f(x2))(x - x2)/(m - x2) */ if (V <= f2 + (1. - f2) * U) { X = Y; break; } /* quotient accept: x2 < Y < m, W >= 2f2 - f(Y) */ if (V <= exp( p_ * log(Y/m) + q_ * log((1. - Y)/(1. - m)) ) ) { X = Y; break; } } } else if (U <= p2) { U -= p1; /* immediate accept: m < X < x4, - f(x4) < W < 0 */ W = U/D - f4; if (W <= 0.) { X = m + U/f4; break; } /* immediate accept: x4 < X < x5, 0 < W < f(x5) */ if (W <= f5) { X = x4 + W/f5 * D; break; } /* candidates for acceptance-rejection-test */ U = uniform(); V = D * U; X = x4 + V; Y = x4 - V; /* squeeze accept: L(x) = f(x4) (z4 - x) / (z4 - x4) */ if (W * (z4 - x4) <= f4 * (z4 - X)) break; V = f4 + f4 - W; if (V < 1.) { /* squeeze accept: L(x) = f(x4) + (1 - f(x4))(x4 - x)/(x4 - m) */ if (V <= f4 + (1.0 - f4) * U) { X = Y; break; } /* quotient accept: m < Y < x4, W >= 2f4 - f(Y) */ if (V <= exp( p_ * log(Y/m) + q_ * log((1. - Y)/(1. - m)) ) ) { X = Y; break; } } } else if (U <= p3) { /* X < x1 */ U = (U - p2)/(p3 - p2); Y = log(U); X = x1 + ll * Y; if (X <= 0.) /* X > 0!! */ continue; W = U * uniform(); /* squeeze accept: L(x) = f(x1) (x - z1) / (x1 - z1) */ /* z1 = x1 - ll, W <= 1 + (X - x1)/ll */ if (W <= 1. + Y) break; W *= f1; } else { /* x5 < X */ U = (U - p3)/(p4 - p3); Y = log(U); X = x5 - lr * Y; if (X >= 1.) /* X < 1!! */ continue; W = U * uniform(); /* squeeze accept: L(x) = f(x5) (z5 - x) / (z5 - x5) */ /* z5 = x5 + lr, W <= 1 + (x5 - X)/lr */ if (W <= 1. + Y) break; W *= f5; } /* density accept: f(x) = (x/m)^(p_) ((1 - x)/(1 - m))^(q_) */ if (log(W) <= p_ * log(X/m) + q_ * log((1. - X)/(1. - m))) break; } /* -X- end of generator code -X- */ return ((DISTR.n_params==2) ? X : a + (b-a) * X); } /* end of _unur_stdgen_sample_beta_b1prs() */ /*---------------------------------------------------------------------------*/ #undef GEN_N_PARAMS #undef p_ #undef q_ #undef s #undef m #undef D #undef Dl #undef x1 #undef x2 #undef x4 #undef x5 #undef f1 #undef f2 #undef f4 #undef f5 #undef ll #undef lr #undef z2 #undef z4 #undef p1 #undef p2 #undef p3 #undef p4 /*---------------------------------------------------------------------------*/ double _unur_stdgen_sample_beta_binv( struct unur_gen *gen ) /* p == 1. || q == 1. */ { /* -X- generator code -X- */ double X; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); if (_unur_isone(p) && _unur_isone(q)) { X = uniform(); } else if (_unur_isone(p)) { X = 1. - pow(1.-uniform(), 1/q); } else { /* _unur_isone(q) */ X = pow(uniform(), 1/p); } /* -X- end of generator code -X- */ return ((DISTR.n_params==2) ? X : a + (b-a) * X); } /* end of _unur_stdgen_sample_beta_binv() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/vc_multiexponential.c0000644001357500135600000003712614420445767020011 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: vc_multiexponential.c * * * ***************************************************************************** * * * distr: Multiexponential distribution * * * * REFERENCES: * * * * [5] S. Kotz, N. Balakrishnan, and N.L. Johnson * * Continuous Multivariate Distributions, * * Volume 1: Models and Applications * * John Wiley & Sons, Inc., New York, 2000 * * * * John E. Freund * * A Bivariate Extension of the Exponential Distribution * * Journal of the American Statistical Association, * * Vol. 56, p971-977 (1961) * * * * Asit P. Basu, Kai Sun * * Multivariate Exponential Distributions with Constant Failure Rates * * Journal of Multivariate Analysis, * * Vol. 61, p159-169 (1997) * * * * * * pdf: f(x) = Prod_{i=0}^{i=dim-1} * * exp(-(dim-i) (x_{i}-x_{i-1} - (theta_i-theta_{i-1}) ) / sigma_i) * * with x_{-1}=0 and theta_{-1}=0 * * domain: [0, inf)^(dim) * * constant: Prod_{i=0}^{i=dim-1} 1/sigma_i * * * * * * parameters: * * 0: sigma ... scale parameter (default : (1,1,...,1)-vector) * * 1: theta ... location parameter (default : (0,0,...,0)-vector) * * * ***************************************************************************** * * * standard form * * * * pdf: f(x) = exp( - Sum_{i_0}^{i=dim-1} (dim-i) (x_{i}-x{i-1}) ) * * domain: [0, inf)^(dim) * * * * parameters: * * none * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include "unur_distributions.h" #include "unur_distributions_source.h" #include "unur_stddistr.h" /*---------------------------------------------------------------------------*/ static const char distr_name[] = "multiexponential"; /*---------------------------------------------------------------------------*/ /* parameters */ #define INDEX_SIGMA 0 #define INDEX_THETA 1 /*---------------------------------------------------------------------------*/ #define DISTR distr->data.cvec #define LOGNORMCONSTANT (distr->data.cvec.norm_constant) /*---------------------------------------------------------------------------*/ /* function prototypes */ static double _unur_pdf_multiexponential( const double *x, UNUR_DISTR *distr ); static double _unur_logpdf_multiexponential( const double *x, UNUR_DISTR *distr ); static int _unur_dlogpdf_multiexponential( double *result, const double *x, UNUR_DISTR *distr ); static int _unur_set_params_multiexponential( UNUR_DISTR *distr, const double *sigma, const double *theta ); static int _unur_upd_mode_multiexponential( UNUR_DISTR *distr ); static int _unur_upd_volume_multiexponential( UNUR_DISTR *distr ); /*---------------------------------------------------------------------------*/ double _unur_pdf_multiexponential( const double *x, UNUR_DISTR *distr ) { double flog; flog=_unur_logpdf_multiexponential( x, distr ); if (_unur_isfinite(flog)) /* && flog <= log(DBL_MAX) */ return exp( flog ); return 0.; } /* end of _unur_pdf_multiexponential() */ /*---------------------------------------------------------------------------*/ double _unur_logpdf_multiexponential( const double *x, UNUR_DISTR *distr ) { int i, dim; double dx, sum; /* arguments used in the evaluation of the density */ double *sigma, *theta; dim = distr->dim ; dx=0.; sum=0.; sigma = DISTR.param_vecs[INDEX_SIGMA]; theta = DISTR.param_vecs[INDEX_THETA]; /* TODO : reconsider logic concerning NULL pointers ? */ if ( sigma==NULL || theta==NULL ) { /* standard form */ for (i=0; i UNUR_EPSILON here */ dx /= sigma[i]; sum -= (dim-i) * dx; } } return ( sum + LOGNORMCONSTANT); } /* end of _unur_logpdf_multiexponential() */ /*---------------------------------------------------------------------------*/ int _unur_dlogpdf_multiexponential( double *result, const double *x, UNUR_DISTR *distr ) { int i, dim; double dx, fx1, fx2; double *xx; dim = distr->dim; /* working array */ xx=malloc(dim*sizeof(double)); /* calculation of the dlogpdf components */ dx=1e7*UNUR_EPSILON; /* should work for the exponential distribution */ for (i=0; idim * sizeof(double)); for (i=0; idim; i++) default_sigma[i]=1.; unur_distr_cvec_set_pdfparams_vec( distr, INDEX_SIGMA, default_sigma, distr->dim ); if (default_sigma) free(default_sigma); } else { /* check parameter sigma */ for (i=0; idim; i++) { if ( sigma[i] <= UNUR_EPSILON ) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"sigma is too low"); return UNUR_ERR_DISTR_DOMAIN; } } unur_distr_cvec_set_pdfparams_vec( distr, INDEX_SIGMA, sigma, distr->dim ); } /* copy the theta parameters into their parameter vectors */ if(theta==NULL) { /* initializing vector with default values */ default_theta = _unur_xmalloc(distr->dim * sizeof(double) ); for (i=0; idim; i++) default_theta[i]=0.; unur_distr_cvec_set_pdfparams_vec( distr, INDEX_THETA, default_theta, distr->dim ); if (default_theta) free(default_theta); } else { unur_distr_cvec_set_pdfparams_vec( distr, INDEX_THETA, theta, distr->dim ); } /* store number of parameters */ DISTR.n_params = 0; /* we have only vector parameter here ... */ return UNUR_SUCCESS; } /* end of _unur_set_params_multiexponential() */ /*---------------------------------------------------------------------------*/ int _unur_upd_mode_multiexponential( UNUR_DISTR *distr ) { /* TODO: checking if mode is inside domain */ int i; if (DISTR.mode == NULL) DISTR.mode = _unur_xmalloc( distr->dim * sizeof(double) ); for (i=0; idim; i++) DISTR.mode[i]=0.; return UNUR_SUCCESS; } /* end of _unur_upd_mode_multiexponential() */ /*---------------------------------------------------------------------------*/ int _unur_upd_volume_multiexponential( UNUR_DISTR *distr ) { /* TODO: checking for modified domain */ int i; double sumsigma = 0.; for (i=0; idim; i++) { sumsigma += DISTR.param_vecs[INDEX_SIGMA][i]; } LOGNORMCONSTANT = - 1. / sumsigma; return UNUR_SUCCESS; } /* end of _unur_upd_volume_multiexponential() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Make distribution object **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_multiexponential( int dim, const double *sigma, const double *theta ) /* @code{UNUR_DISTR *unur_distr_multiexponential(int dim, const double *sigma, const double *theta)} creates a distribution object for the linear multivariate exponential distribution with @var{dim} components. @var{sigma} (the scale parameter) is an array of size @var{dim} and each element must be strictly > 0. @var{theta} (the location parameter) is an array of size @var{dim}. A NULL pointer for @var{sigma} OR @var{theta} chooses the standard form, where the scale parameter is (1,@dots{},1) and the location parameter is (0,@dots,0). */ { struct unur_distr *distr; struct unur_distr **marginal; int i; double sumsigma; /* used in the calculation of LOGNORMCONSTANT */ double alpha; /* get new (empty) distribution object */ distr = unur_distr_cvec_new(dim); /* check new parameter for generator */ if (distr == NULL) { /* error: dim < 1 */ return NULL; } /* set distribution id */ distr->id = UNUR_DISTR_MEXPONENTIAL; /* name of distribution */ distr->name = distr_name; /* how to get special generators */ DISTR.init = NULL; /* functions */ DISTR.pdf = _unur_pdf_multiexponential; /* pointer to PDF */ DISTR.logpdf = _unur_logpdf_multiexponential; /* pointer to logPDF */ DISTR.dpdf = _unur_distr_cvec_eval_dpdf_from_dlogpdf; /* pointer to gradient of PDF */ DISTR.dlogpdf = _unur_dlogpdf_multiexponential; /* pointer to gradient of logPDF */ DISTR.pdpdf = _unur_distr_cvec_eval_pdpdf_from_pdlogpdf; /* pointer to part. deriv. of PDF */ /*DISTR.pdlogpdf = _unur_pdlogpdf_multiexponential;*/ /* pointer to partial derivative of logPDF */ /* set standardized marginal distributions */ marginal = malloc(distr->dim * sizeof(struct unur_distr*)); for (i=0; idim; i++) { alpha = i+1.; /* shape parameter */ marginal[i] = unur_distr_gamma(&alpha, 1); } unur_distr_cvec_set_marginal_array(distr, marginal); /* free memory allocated to the marginal array */ for (i=0; idim; i++) if (marginal[i]) _unur_distr_free(marginal[i]); if (marginal) free(marginal); /* set parameters for distribution */ if (_unur_set_params_multiexponential(distr, sigma, theta)!=UNUR_SUCCESS) { _unur_distr_free(distr); return NULL; } /* domain */ /* log of normalization constant */ /* constant: Prod_{i=0}^{i=dim-1} 1/sigma_i */ sumsigma = 0.; for (i=0; idim; i++) { sumsigma += DISTR.param_vecs[INDEX_SIGMA][i]; } LOGNORMCONSTANT = - 1. / sumsigma; /* mode */ DISTR.mode = _unur_xmalloc(distr->dim * sizeof(double) ); for (i=0; idim; i++) DISTR.mode[i]=0.; /* volume below p.d.f. */ DISTR.volume = 1.; /* function for updating derived parameters */ DISTR.upd_mode = _unur_upd_mode_multiexponential; /* funct for computing mode */ DISTR.upd_volume = _unur_upd_volume_multiexponential; /* funct for computing volume */ /* indicate which parameters are set (additional to mean and covariance) */ distr->set |= ( UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_PDFVOLUME | UNUR_DISTR_SET_MODE ); /* return pointer to object */ return distr; } /* end of unur_distr_multiexponential() */ /*---------------------------------------------------------------------------*/ #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/unur_stddistr.h0000644001357500135600000002166114420445767016633 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: unur_stddistr.h * * * * PURPOSE: * * defines identifiers for standard distributions * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifndef UNUR_STDDISTR_H_SEEN #define UNUR_STDDISTR_H_SEEN /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* indentifiers for standard distributions */ #define UNUR_DISTR_STD (0x00000001u) /* flag for UNU.RAN standard distribution */ enum { UNUR_DISTR_GENERIC = 0x00000000u, UNUR_DISTR_CORDER = 0x00000010u, /* order statistics */ UNUR_DISTR_CXTRANS = 0x00000020u, /* distribution of transformed RV */ UNUR_DISTR_CONDI = 0x00000030u, /* full conditional distribution */ /** pdf cdf mode area gen doc */ UNUR_DISTR_BETA = 0x00000101u, /* X X X X X . */ UNUR_DISTR_CAUCHY = 0x00000201u, /* X X X X X . */ UNUR_DISTR_CHI = 0x00000301u, /* X X X X X . */ UNUR_DISTR_CHISQUARE = 0x00000401u, /* X X X X . . */ UNUR_DISTR_EPANECHNIKOV = 0x00000501u, /* . . . . . . */ UNUR_DISTR_EXPONENTIAL = 0x00000601u, /* X X X X X . */ UNUR_DISTR_EXTREME_I = 0x00000701u, /* X X X X X . */ UNUR_DISTR_EXTREME_II = 0x00000801u, /* X X X X X . */ UNUR_DISTR_F = 0x00000901u, /* X X X X X . */ UNUR_DISTR_GAMMA = 0x00000a01u, /* X X X X X . */ UNUR_DISTR_GHYP = 0x00002401u, /* X . . . . . */ UNUR_DISTR_GIG = 0x00000b01u, /* X . X . X . */ UNUR_DISTR_GIG2 = 0x00002201u, /* X . X . X . */ UNUR_DISTR_HYPERBOLIC = 0x00002301u, /* X . X . . . */ UNUR_DISTR_IG = 0x00002101u, /* X X X . . . */ UNUR_DISTR_LAPLACE = 0x00000c01u, /* X X X X X . */ UNUR_DISTR_LOGISTIC = 0x00000d01u, /* X X X X X . */ UNUR_DISTR_LOGNORMAL = 0x00000e01u, /* X X . X . . */ UNUR_DISTR_LOMAX = 0x00000f01u, /* X X X X . . */ UNUR_DISTR_MEIXNER = 0x00002601u, /* X . . X . . */ UNUR_DISTR_NORMAL = 0x00001001u, /* X X X X X . */ UNUR_DISTR_GAUSSIAN = 0x00001001u, /* same as NORMAL */ UNUR_DISTR_PARETO = 0x00001101u, /* X X X X . . */ UNUR_DISTR_POWEREXPONENTIAL = 0x00001201u, /* X X X X X . */ UNUR_DISTR_RAYLEIGH = 0x00001301u, /* X X X X . . */ UNUR_DISTR_SLASH = 0x00001401u, /* X . X X X . */ UNUR_DISTR_STUDENT = 0x00001501u, /* X (X) X X X . */ UNUR_DISTR_TRIANGULAR = 0x00001601u, /* X X X X X . */ UNUR_DISTR_UNIFORM = 0x00002001u, /* X X X X . . */ UNUR_DISTR_BOXCAR = 0x00002001u, /* same as UNIFORM */ UNUR_DISTR_VG = 0x00002501u, /* X . . . . . */ UNUR_DISTR_WEIBULL = 0x00001801u, /* X X X X X . */ UNUR_DISTR_BURR_I = 0x0000b001u, /* . X . . X . */ UNUR_DISTR_BURR_II = 0x0000b101u, /* . X . . X . */ UNUR_DISTR_BURR_III = 0x0000b201u, /* . X . . X . */ UNUR_DISTR_BURR_IV = 0x0000b301u, /* . X . . X . */ UNUR_DISTR_BURR_V = 0x0000b401u, /* . X . . X . */ UNUR_DISTR_BURR_VI = 0x0000b501u, /* . X . . X . */ UNUR_DISTR_BURR_VII = 0x0000b601u, /* . X . . X . */ UNUR_DISTR_BURR_VIII = 0x0000b701u, /* . X . . X . */ UNUR_DISTR_BURR_IX = 0x0000b801u, /* . X . . X . */ UNUR_DISTR_BURR_X = 0x0000b901u, /* . X . . X . */ UNUR_DISTR_BURR_XI = 0x0000ba01u, /* . X . . . . */ UNUR_DISTR_BURR_XII = 0x0000bb01u, /* . X . . X . */ /** pmf cdf mode sum gen doc */ UNUR_DISTR_BINOMIAL = 0x00010001u, /* . . . . . . */ UNUR_DISTR_GEOMETRIC = 0x00020001u, /* X X X X X . */ UNUR_DISTR_HYPERGEOMETRIC = 0x00030001u, /* . . . . . . */ UNUR_DISTR_LOGARITHMIC = 0x00040001u, /* X . X X X . */ UNUR_DISTR_NEGATIVEBINOMIAL = 0x00050001u, /* X . X X X . */ UNUR_DISTR_POISSON = 0x00060001u, /* X X X X X . */ UNUR_DISTR_ZIPF = 0x00070001u, /* X . X . X . */ /** pdf doc */ UNUR_DISTR_MCAUCHY = 0x01000001u, /* X . */ UNUR_DISTR_MNORMAL = 0x02000001u, /* X . */ UNUR_DISTR_MSTUDENT = 0x03000001u, /* X . */ UNUR_DISTR_MEXPONENTIAL = 0x04000001u, /* X . */ UNUR_DISTR_COPULA = 0x05000001u, /* . . */ /** */ UNUR_DISTR_MCORRELATION = 0x10000001u /* */ }; /*---------------------------------------------------------------------------*/ #endif /* UNUR_STDDISTR_H_SEEN */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/vc_multistudent.c0000644001357500135600000003700414420445767017144 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: vc_multistudent.c * * * ***************************************************************************** * * * distr: Multivariate Student distribution [5; ch.45, p.219] * * * * pdf: f(x) = 1 / ( 1 + (x-mu)^t . Sigma^-1 . (x-mu) / m)^(dim+m)/2 )* * domain: Reals^(dim) * * constant: Gamma((dim+m)/2) * * / ( Gamma(m/2) (m*pi)^(dim/2) * sqrt(det(Sigma)) ) * * * * parameters: * * 0: d.f. ... m (default : 1) * * 1: mean ... mu (default : 0-vector) * * 2: "covar" ... Sigma (default : identity matrix) * * * ***************************************************************************** * * * standard form * * * * pdf: f(x) = 1 / ( 1 + x^t . x )^(dim+m)/2 * * domain: Reals^(dim) * * * * parameters: * * * * d.f. = m * * mean = (0,...,0) ... 0-vector * * covar = identity matrix * * * ***************************************************************************** * * * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include "unur_distributions.h" #include "unur_distributions_source.h" #include "unur_stddistr.h" #ifdef USE_DEPRECATED_CODE # include #endif /*---------------------------------------------------------------------------*/ static const char distr_name[] = "multistudent"; /*---------------------------------------------------------------------------*/ /* parameters */ #define nu params[0] /*---------------------------------------------------------------------------*/ #define DISTR distr->data.cvec #define LOGNORMCONSTANT (distr->data.cvec.norm_constant) /*---------------------------------------------------------------------------*/ /* function prototypes */ static double _unur_pdf_multistudent( const double *x, UNUR_DISTR *distr ); static double _unur_logpdf_multistudent( const double *x, UNUR_DISTR *distr ); static int _unur_dlogpdf_multistudent( double *result, const double *x, UNUR_DISTR *distr ); static double _unur_pdlogpdf_multistudent( const double *x, int coord, UNUR_DISTR *distr ); static int _unur_set_params_multistudent( UNUR_DISTR *distr, double df ); static int _unur_upd_mode_multistudent( UNUR_DISTR *distr ); static int _unur_upd_volume_multistudent( UNUR_DISTR *distr ); /*---------------------------------------------------------------------------*/ double _unur_pdf_multistudent( const double *x, UNUR_DISTR *distr ) { return exp( _unur_logpdf_multistudent( x, distr ) ); } /* end of _unur_pdf_multistudent() */ /*---------------------------------------------------------------------------*/ double _unur_logpdf_multistudent( const double *x, UNUR_DISTR *distr ) { #define idx(a,b) ((a)*dim+(b)) int i,j, dim; double *mean; const double *covar_inv; double xx; /* argument used in the evaluation of exp(-xx/2) */ double cx; /* element of multiplication of covariance matrix and x */ dim = distr->dim; if (DISTR.mean == NULL) { if (DISTR.covar != NULL) { _unur_warning(distr->name,UNUR_ERR_SHOULD_NOT_HAPPEN,""); } /* standard form */ xx=0.; for (i=0; idim; mean = DISTR.mean; /* get inverse of covariance matrix */ covar_inv = unur_distr_cvec_get_covar_inv(distr); if (covar_inv==NULL) /* inverse of covariance matrix not available */ return UNUR_FAILURE; /* calculating (x-mean)' Sigma^-1 (x-mean) */ xx=0.; for (i=0; idim; double *mean = DISTR.mean; /* check arguments */ if (coord < 0 || coord >= dim) { _unur_warning(distr->name,UNUR_ERR_DISTR_DOMAIN,"invalid coordinate"); return UNUR_INFINITY; } /* get inverse of covariance matrix */ covar_inv = unur_distr_cvec_get_covar_inv(distr); if (covar_inv==NULL) /* inverse of covariance matrix not available */ return UNUR_INFINITY; /* calculating (x-mean)' Sigma^-1 (x-mean) */ xx=0.; for (i=0; idim * sizeof(double) ); memcpy( DISTR.mode, DISTR.mean, distr->dim * sizeof(double) ); return UNUR_SUCCESS; } /* end of _unur_upd_mode_multistudent() */ /*---------------------------------------------------------------------------*/ int _unur_upd_volume_multistudent( UNUR_DISTR *distr ) { /* TODO: checking for modified domain */ double det_covar; /* log of normalization constant */ det_covar = (DISTR.covar == NULL) ? 1. : _unur_matrix_determinant(distr->dim, DISTR.covar); LOGNORMCONSTANT = _unur_SF_ln_gamma((distr->dim+DISTR.nu)/2.) - _unur_SF_ln_gamma(DISTR.nu/2.) - ( distr->dim * log(DISTR.nu*M_PI) + log(det_covar) ) / 2.; return UNUR_SUCCESS; } /* end of _unur_upd_volume_multistudent() */ /*****************************************************************************/ /** **/ /** Make distribution object **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_multistudent( int dim, double df, const double *mean, const double *covar ) /* @code{UNUR_DISTR *unur_distr_multistudent(int dim, const double nu, const double *mean, const double *covar)} creates a distribution object for the multivariate Student t-distribution with @var{dim} components and @var{nu} degrees of freedom. @var{mean} is an array of size @var{dim}. A NULL pointer for @var{mean} is interpreted as the zero vector (0,@dots{},0). @var{covar} is an array of size @var{dim}x@var{dim} and holds the covariance matrix, where the rows of the matrix are stored consecutively in this array. The NULL pointer can be used instead the identity matrix. If @var{covar} is not a valid covariance matrix (i.e., not positive definite) then no distribution object is created and NULL is returned. For standard form of the distribution use the null vector for @var{mean} and the identity matrix for @var{covar}. */ { struct unur_distr *distr; double det_covar; /* determinant of covariance matrix */ /* get new (empty) distribution object */ distr = unur_distr_cvec_new(dim); /* check new parameter for generator */ if (distr == NULL) { /* error: dim < 1 */ return NULL; } /* set distribution id */ distr->id = UNUR_DISTR_MSTUDENT; /* name of distribution */ distr->name = distr_name; /* how to get special generators */ DISTR.init = NULL; /* copy (and check) parameters */ if ( (_unur_set_params_multistudent(distr, df)!=UNUR_SUCCESS) || (unur_distr_cvec_set_mean(distr,mean)!=UNUR_SUCCESS) || (unur_distr_cvec_set_covar(distr,covar)!=UNUR_SUCCESS) ) { unur_distr_free( distr ); return NULL; } /* functions */ DISTR.pdf = _unur_pdf_multistudent; /* pointer to PDF */ DISTR.logpdf = _unur_logpdf_multistudent; /* pointer to logPDF */ DISTR.dpdf = _unur_distr_cvec_eval_dpdf_from_dlogpdf; /* pointer to gradient of PDF */ DISTR.dlogpdf = _unur_dlogpdf_multistudent; /* pointer to gradient of logPDF */ DISTR.pdpdf = _unur_distr_cvec_eval_pdpdf_from_pdlogpdf; /* pointer to part. deriv. of PDF */ DISTR.pdlogpdf = _unur_pdlogpdf_multistudent; /* pointer to partial derivative of logPDF */ #ifdef USE_DEPRECATED_CODE /* set standardized marginal distributions */ { struct unur_distr *stdmarginal = unur_distr_student(&df,1); unur_distr_cvec_set_stdmarginals(distr,stdmarginal); unur_distr_free(stdmarginal); } #endif /* domain */ /* log of normalization constant */ /* constant: Gamma((dim+1)/2) / ( pi^((dim+1)/2) * sqrt(det(Sigma)) ) */ /* constant: Gamma((dim+df)/2) */ /* / ( Gamma(df/2) (df*pi)^(dim/2) * sqrt(det(Sigma)) ) */ det_covar = (DISTR.covar == NULL) ? 1. : _unur_matrix_determinant(dim, DISTR.covar); LOGNORMCONSTANT = _unur_SF_ln_gamma((distr->dim+df)/2.) - _unur_SF_ln_gamma(df/2.) - ( distr->dim * log(df*M_PI) + log(det_covar) ) / 2.; /* mode */ DISTR.mode = _unur_xmalloc( distr->dim * sizeof(double) ); memcpy( DISTR.mode, DISTR.mean, distr->dim * sizeof(double) ); /* volume below p.d.f. */ DISTR.volume = 1.; /* function for updating derived parameters */ DISTR.upd_mode = _unur_upd_mode_multistudent; /* funct for computing mode */ DISTR.upd_volume = _unur_upd_volume_multistudent; /* funct for computing volume */ /* indicate which parameters are set (additional to mean and covariance) */ distr->set |= ( UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_PDFVOLUME | UNUR_DISTR_SET_MODE ); /* return pointer to object */ return distr; } /* end of unur_distr_multistudent() */ /*---------------------------------------------------------------------------*/ #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/c_exponential_gen.c0000644001357500135600000001660514420445767017400 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: c_exponential_gen.c * * * * Special generators for Exponential distribution * * * ***************************************************************************** * * * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /***************************************************************************** * We use the marginal generation time for inversion from the * * exponential distribution as time unit for timings. * * Thus we do not use the inverse CDF but have the particular method * * implemented. * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "unur_distributions_source.h" /*---------------------------------------------------------------------------*/ /* Prototypes for special generators */ /*---------------------------------------------------------------------------*/ /* abbreviations */ #define PAR ((struct unur_cstd_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_cstd_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.cont /* data for distribution in generator object */ #define uniform() _unur_call_urng(gen->urng) /* call for uniform prng */ #define sigma (DISTR.params[0]) /* scale */ #define theta (DISTR.params[1]) /* location */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Inititialize **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ int _unur_stdgen_exponential_init( struct unur_par *par, struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* initialize special generator for exponential distribution */ /* if gen == NULL then only check existance of variant. */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* one of par and gen must not be the NULL pointer */ switch ((par) ? par->variant : gen->variant) { case 0: /* DEFAULT */ case UNUR_STDGEN_INVERSION: /* inversion method */ if (gen) GEN->is_inversion = TRUE; _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_exponential_inv); /** Remark: We use sampling from exponential distribution as timing unit **/ /* _unur_cstd_set_sampling_routine(gen, _unur_cstd_sample_inv); */ return UNUR_SUCCESS; default: /* no such generator */ if (gen) _unur_warning(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,""); return UNUR_FAILURE; } } /* end of _unur_stdgen_exponential_init() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Special generators **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ double _unur_stdgen_sample_exponential_inv( struct unur_gen *gen ) /* Inversion method */ { /* -X- generator code -X- */ double U,X; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); /* sample from uniform random number generator */ U = GEN->Umin + uniform() * (GEN->Umax-GEN->Umin); /* transform to random variate */ X = - log( 1. - U ); /* -X- end of generator code -X- */ return ((DISTR.n_params==0) ? X : theta + sigma * X); } /* end of _unur_stdgen_sample_exponential_inv() */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #undef sigma #undef theta /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/vc_multinormal.c0000644001357500135600000003433514420445767016752 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: vc_multinormal.c * * * * REFERENCES: * * * * [5] S. Kotz, N. Balakrishnan, and N.L. Johnson * * Continuous Multivariate Distributions, * * Volume 1: Models and Applications * * John Wiley & Sons, Inc., New York, 2000 * * * ***************************************************************************** * * * distr: Multinormal distribution [5; ch.45, p.107] * * * * pdf: f(x) = exp( -1/2 * (x-mu)^t . Sigma^(-1) . (x-mu) ) * * domain: Reals^(dim) * * constant: 1 / ( (2 pi)^(dim/2) * sqrt(det(Sigma)) ) * * * * parameters: * * 0: mean ... mu (0-vector) * * 1: covar ... Sigma (identity matrix) * * * ***************************************************************************** * * * standard form * * * * pdf: f(x) = exp( -1/2 * x^t . x ) * * domain: Reals^(dim) * * constant: 1/(2 pi)^(dim/2) * * * * parameters: * * none * * * * mean = (0,...,0) ... 0-vector * * covar = identity matrix * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include "unur_distributions.h" #include "unur_distributions_source.h" #include "unur_stddistr.h" #ifdef USE_DEPRECATED_CODE # include #endif /*---------------------------------------------------------------------------*/ static const char distr_name[] = "multinormal"; /*---------------------------------------------------------------------------*/ /* parameters */ /*---------------------------------------------------------------------------*/ #define DISTR distr->data.cvec #define LOGNORMCONSTANT (distr->data.cvec.norm_constant) /*---------------------------------------------------------------------------*/ /* function prototypes */ static double _unur_pdf_multinormal( const double *x, UNUR_DISTR *distr ); static double _unur_logpdf_multinormal( const double *x, UNUR_DISTR *distr ); static int _unur_dlogpdf_multinormal( double *result, const double *x, UNUR_DISTR *distr ); static double _unur_pdlogpdf_multinormal( const double *x, int coord, UNUR_DISTR *distr ); static int _unur_upd_mode_multinormal( UNUR_DISTR *distr ); static int _unur_upd_volume_multinormal( UNUR_DISTR *distr ); /*---------------------------------------------------------------------------*/ double _unur_pdf_multinormal( const double *x, UNUR_DISTR *distr ) { return exp( _unur_logpdf_multinormal( x, distr ) ); } /* end of _unur_pdf_multinormal() */ /*---------------------------------------------------------------------------*/ double _unur_logpdf_multinormal( const double *x, UNUR_DISTR *distr ) { #define idx(a,b) ((a)*dim+(b)) int i,j, dim; double *mean; const double *covar_inv; double xx; /* argument used in the evaluation of exp(-xx/2) */ double cx; /* element of multiplication of covariance matrix and x */ dim = distr->dim; if (DISTR.mean == NULL) { if (DISTR.covar != NULL) { _unur_warning(distr->name,UNUR_ERR_SHOULD_NOT_HAPPEN,""); } /* standard form */ xx=0.; for (i=0; idim; mean = DISTR.mean; /* get inverse of covariance matrix */ covar_inv = unur_distr_cvec_get_covar_inv(distr); if (covar_inv==NULL) /* inverse of covariance matrix not available */ return UNUR_FAILURE; for (i=0; idim; mean = DISTR.mean; /* check arguments */ if (coord < 0 || coord >= dim) { _unur_warning(distr->name,UNUR_ERR_DISTR_DOMAIN,"invalid coordinate"); return UNUR_INFINITY; } /* get inverse of covariance matrix */ covar_inv = unur_distr_cvec_get_covar_inv(distr); if (covar_inv==NULL) /* inverse of covariance matrix not available */ return UNUR_INFINITY; result = 0.; for (j=0; jdim * sizeof(double) ); memcpy( DISTR.mode, DISTR.mean, distr->dim * sizeof(double) ); return UNUR_SUCCESS; } /* end of _unur_upd_mode_multinormal() */ /*---------------------------------------------------------------------------*/ int _unur_upd_volume_multinormal( UNUR_DISTR *distr ) { /* TODO: checking for modified domain */ double det_covar; /* log of normalization constant */ det_covar = (DISTR.covar == NULL) ? 1. : _unur_matrix_determinant(distr->dim, DISTR.covar); LOGNORMCONSTANT = - ( distr->dim * log(2 * M_PI) + log(det_covar) ) / 2.; return UNUR_SUCCESS; } /* end of _unur_upd_volume_multinormal() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Make distribution object **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_multinormal( int dim, const double *mean, const double *covar ) /* @code{UNUR_DISTR *unur_distr_multinormal(int dim, const double *mean, const double *covar)} creates a distribution object for the multinormal distribution with @var{dim} components. @var{mean} is an array of size @var{dim}. A NULL pointer for @var{mean} is interpreted as the zero vector (0,@dots{},0). @var{covar} is an array of size @var{dim}x@var{dim} and holds the covariance matrix, where the rows of the matrix are stored consecutively in this array. The NULL pointer can be used instead the identity matrix. If @var{covar} is not a valid covariance matrix (i.e., not positive definite) then no distribution object is created and NULL is returned. For standard form of the distribution use the null vector for @var{mean} and the identity matrix for @var{covar}. */ { struct unur_distr *distr; double det_covar; /* determinant of covariance matrix */ /* get new (empty) distribution object */ distr = unur_distr_cvec_new(dim); /* check new parameter for generator */ if (distr == NULL) { /* error: dim < 1 */ return NULL; } /* set distribution id */ distr->id = UNUR_DISTR_MNORMAL; /* name of distribution */ distr->name = distr_name; /* how to get special generators */ DISTR.init = _unur_stdgen_multinormal_init; /* copy (and check) parameters */ if ((unur_distr_cvec_set_mean(distr,mean)!=UNUR_SUCCESS) || (unur_distr_cvec_set_covar(distr,covar)!=UNUR_SUCCESS) ) { unur_distr_free( distr ); return NULL; } /* functions */ DISTR.pdf = _unur_pdf_multinormal; /* pointer to PDF */ DISTR.logpdf = _unur_logpdf_multinormal; /* pointer to logPDF */ DISTR.dpdf = _unur_distr_cvec_eval_dpdf_from_dlogpdf; /* pointer to gradient of PDF */ DISTR.dlogpdf = _unur_dlogpdf_multinormal; /* pointer to gradient of logPDF */ DISTR.pdpdf = _unur_distr_cvec_eval_pdpdf_from_pdlogpdf; /* pointer to part. deriv. of PDF */ DISTR.pdlogpdf = _unur_pdlogpdf_multinormal; /* pointer to partial derivative of logPDF */ #ifdef USE_DEPRECATED_CODE { /* set standardized marginal distributions */ struct unur_distr *stdmarginal = unur_distr_normal(NULL,0); unur_distr_cvec_set_stdmarginals(distr,stdmarginal); unur_distr_free(stdmarginal); } #endif /* copy other parameters of distribution */ /* none */ /* number of other parameters */ /* DISTR.n_params = 0; ... default */ /* domain */ /* log of normalization constant */ det_covar = (DISTR.covar == NULL) ? 1. : _unur_matrix_determinant(dim, DISTR.covar); LOGNORMCONSTANT = - ( distr->dim * log(2 * M_PI) + log(det_covar) ) / 2.; /* mode */ DISTR.mode = _unur_xmalloc( distr->dim * sizeof(double) ); memcpy( DISTR.mode, DISTR.mean, distr->dim * sizeof(double) ); /* volume below p.d.f. */ DISTR.volume = 1.; /* function for updating derived parameters */ DISTR.upd_mode = _unur_upd_mode_multinormal; /* funct for computing mode */ DISTR.upd_volume = _unur_upd_volume_multinormal; /* funct for computing volume */ /* indicate which parameters are set (additional to mean and covariance) */ distr->set |= ( UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_PDFVOLUME | UNUR_DISTR_SET_MODE ); /* return pointer to object */ return distr; } /* end of unur_distr_multinormal() */ /*---------------------------------------------------------------------------*/ #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/c_gig2.c0000644001357500135600000003311414420445767015043 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: c_gig2.c * * * * REFERENCES: * * * * [2] N.L. Johnson, S. Kotz and N. Balakrishnan * * Continuous Univariate Distributions, * * Volume 1, 2nd edition * * John Wiley & Sons, Inc., New York, 1994 * * * ***************************************************************************** * * * distr: Generalized Inverse Gaussian (GIG) distribution [2; ch.15, p.284] * * * * Alternative parametrization. * * * * pdf: f(x) = x^(theta-1) * exp( -1/2 * (chi/x + psi*x)) * * domain: 0 < x < infinity * * constant: (psi/chi)^(theta/2) / (2*K_theta(sqrt(psi*chi))) * * [K_theta(.) ... modified Bessel function of third kind] * * K_theta(x) = 1/2 * int_-inf^inf cosh(theta*u) * exp(-x*cosh(u)) du * * * * inf * * - * * 1 | * * K_theta(omega) = - | cosh(theta*u) * exp(-omega*cosh(u)) du * * 2 | * * - * * -inf * * * * * * parameters: 3 * * 0: theta ... shape * * 1: psi > 0 ... shape * * 2: chi > 0 ... shape * * * ***************************************************************************** * * * Reparametrization towards "gig": * * omega = sqrt(psi*chi) * * eta = sqrt(chi/psi) * * * ***************************************************************************** * * * Copyright (c) 2000-2012 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "unur_distributions.h" #include "unur_distributions_source.h" #include "unur_stddistr.h" #ifdef USE_EXPERIMENTAL_CODE #include #endif /*---------------------------------------------------------------------------*/ static const char distr_name[] = "gig2"; /* parameters */ #define theta params[0] /* shape */ #define psi params[1] /* shape */ #define chi params[2] /* shape */ #define DISTR distr->data.cont #define NORMCONSTANT (distr->data.cont.norm_constant) /* function prototypes */ static double _unur_pdf_gig2( double x, const UNUR_DISTR *distr ); static double _unur_logpdf_gig2( double x, const UNUR_DISTR *distr ); static double _unur_dpdf_gig2( double x, const UNUR_DISTR *distr ); static double _unur_dlogpdf_gig2( double x, const UNUR_DISTR *distr ); #ifdef USE_EXPERIMENTAL_CODE static double _unur_cdf_gig2( double x, const UNUR_DISTR *distr ); #endif static int _unur_upd_mode_gig2( UNUR_DISTR *distr ); static double _unur_normconstant_gig2( const double *params, int n_params ); static int _unur_set_params_gig2( UNUR_DISTR *distr, const double *params, int n_params ); /*---------------------------------------------------------------------------*/ double _unur_pdf_gig2(double x, const UNUR_DISTR *distr) { register const double *params = DISTR.params; if (x <= 0.) /* out of support */ return 0.; return (NORMCONSTANT * exp( (theta-1.) * log(x) - 0.5 * (chi/x + psi*x) )); } /* end of _unur_pdf_gig2() */ /*---------------------------------------------------------------------------*/ double _unur_logpdf_gig2(double x, const UNUR_DISTR *distr) { register const double *params = DISTR.params; if (x <= 0.) /* out of support */ return -UNUR_INFINITY; return ( (theta-1.) * log(x) - 0.5 * (chi/x + psi*x) + log(NORMCONSTANT) ); } /* end of _unur_logpdf_gig2() */ /*---------------------------------------------------------------------------*/ double _unur_dpdf_gig2(double x, const UNUR_DISTR *distr) { register const double *params = DISTR.params; if (x <= 0.) /* out of support */ return 0.; return ( NORMCONSTANT * 0.5 * exp( (theta-3.) * log(x) - (chi + psi*x*x)/(2*x) ) * (chi - x*(2 - 2*theta + psi*x)) ); } /* end of _unur_dpdf_gig2() */ /*---------------------------------------------------------------------------*/ double _unur_dlogpdf_gig2(double x, const UNUR_DISTR *distr) { register const double *params = DISTR.params; if (x <= 0.) /* out of support */ return 0.; return ( -0.5*(psi - chi/(x*x)) + (theta-1.)/x + log(NORMCONSTANT) ) ; } /* end of _unur_dlogpdf_gig2() */ /*---------------------------------------------------------------------------*/ #ifdef USE_EXPERIMENTAL_CODE #ifndef _unur_SF_bessel_k #error run ./configure with flag --with-Rmath #endif double _unur_cdf_gig2(double x, const UNUR_DISTR *distr) { double epsabs = 1.e-13; double epsrel = 1.e-13; double result, abserr; size_t limit = 1000; gsl_integration_workspace *work; if (x <= 0.) /* out of support */ return 0.; /* use GSL function */ work = gsl_integration_workspace_alloc (limit); gsl_function F; F.function = _unur_pdf_gig2; F.params = distr; gsl_integration_qag (&F, 0, x, epsabs, epsrel, limit, /* key = */ GSL_INTEG_GAUSS61, work, &result, &abserr); /* The integration rule is determined by the value of 'key', * which should be chosen from the following symbolic names, * * GSL_INTEG_GAUSS15 (key = 1) * GSL_INTEG_GAUSS21 (key = 2) * GSL_INTEG_GAUSS31 (key = 3) * GSL_INTEG_GAUSS41 (key = 4) * GSL_INTEG_GAUSS51 (key = 5) * GSL_INTEG_GAUSS61 (key = 6) */ gsl_integration_workspace_free (work); return result; } /* end of _unur_cdf_gig2() */ #endif /*---------------------------------------------------------------------------*/ int _unur_upd_mode_gig2( UNUR_DISTR *distr ) { register const double *params = DISTR.params; if (theta >= 1.) { /* Use mode of pdf(x) */ DISTR.mode = ((theta-1.)+sqrt((theta-1.)*(theta-1.) + psi*chi)) / psi; } else { /* theta < 1. */ /* Use reciprocal of mode of pdf(1/x) */ DISTR.mode = chi / ((1.-theta)+sqrt((1.-theta)*(1.-theta) + psi*chi)); } /* mode must be in domain */ if (DISTR.mode < DISTR.domain[0]) DISTR.mode = DISTR.domain[0]; else if (DISTR.mode > DISTR.domain[1]) DISTR.mode = DISTR.domain[1]; return UNUR_SUCCESS; } /* end of _unur_upd_mode_gig2() */ /*---------------------------------------------------------------------------*/ double _unur_normconstant_gig2(const double *params ATTRIBUTE__UNUSED, int n_params ATTRIBUTE__UNUSED) { #ifdef _unur_SF_bessel_k /* * constant: (psi/chi)^(theta/2) / (2*K_theta(sqrt(psi*chi))) */ return ( pow(psi/chi, theta/2.) / (2. * _unur_SF_bessel_k(sqrt(psi*chi),theta)) ); #else return 1.; #endif } /* end of _unur_normconstant_gig2() */ /*---------------------------------------------------------------------------*/ int _unur_set_params_gig2( UNUR_DISTR *distr, const double *params, int n_params ) { /* check number of parameters for distribution */ if (n_params < 3) { _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } if (n_params > 3) { _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); n_params = 3; } CHECK_NULL(params,UNUR_ERR_NULL); /* check parameter omega */ if (psi <= 0.) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"psi <= 0"); return UNUR_ERR_DISTR_DOMAIN; } /* check parameter eta */ if (chi <= 0.) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"chi <= 0"); return UNUR_ERR_DISTR_DOMAIN; } /* copy parameters for standard form */ DISTR.theta = theta; DISTR.psi = psi; DISTR.chi = chi; /* default parameters: none */ /* copy optional parameters: none */ /* store number of parameters */ DISTR.n_params = n_params; /* set (standard) domain */ if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.domain[0] = 0.; /* left boundary */ DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ } return UNUR_SUCCESS; } /* end of _unur_set_params_gig2() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_gig2( const double *params, int n_params ) { register struct unur_distr *distr; /* get new (empty) distribution object */ distr = unur_distr_cont_new(); /* set distribution id */ distr->id = UNUR_DISTR_GIG2; /* name of distribution */ distr->name = distr_name; /* how to get special generators */ /* DISTR.init = _unur_stdgen_gig2_init; */ /* functions */ DISTR.pdf = _unur_pdf_gig2; /* pointer to PDF */ DISTR.logpdf = _unur_logpdf_gig2; /* pointer to logPDF */ DISTR.dpdf = _unur_dpdf_gig2; /* pointer to derivative of PDF */ DISTR.dlogpdf = _unur_dlogpdf_gig2; /* pointer to derivative of logPDF */ #ifdef USE_EXPERIMENTAL_CODE DISTR.cdf = _unur_cdf_gig2; /* pointer to CDF */ #endif /* indicate which parameters are set */ distr->set = ( UNUR_DISTR_SET_DOMAIN | UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_MODE ); /* UNUR_DISTR_SET_PDFAREA ); */ /* set parameters for distribution */ if (_unur_set_params_gig2(distr,params,n_params)!=UNUR_SUCCESS) { free(distr); return NULL; } /* normalization constant */ NORMCONSTANT = _unur_normconstant_gig2(DISTR.params,DISTR.n_params); /* mode and area below p.d.f. */ _unur_upd_mode_gig2(distr); /* DISTR.area = ? */ /* function for setting parameters and updating domain */ DISTR.set_params = _unur_set_params_gig2; /* function for updating derived parameters */ DISTR.upd_mode = _unur_upd_mode_gig2; /* funct for computing mode */ /* DISTR.upd_area = _unur_upd_area_gig2; funct for computing area */ /* return pointer to object */ return distr; } /* end of unur_distr_gig2() */ /*---------------------------------------------------------------------------*/ #undef theta #undef psi #undef chi #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/d_zipf_gen.c0000644001357500135600000002466114420445767016024 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: d_zipf_gen.c * * * * Special generators for Zipf (or Zeta) distribution * * * ***************************************************************************** * * * Copyright (c) 2000-2011 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include /* for the definition of `UNUR_STDGEN_INVERSION' */ #include #include "unur_distributions_source.h" /*---------------------------------------------------------------------------*/ /* init routines for special generators */ inline static int zipf_zet_init( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* abbreviations */ #define PAR ((struct unur_dstd_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_dstd_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.discr /* data for distribution in generator object */ #define uniform() _unur_call_urng(gen->urng) /* call for uniform prng */ /* #define MAX_gen_params 2 maximal number of parameters for generator */ /* parameters */ #define rho (DISTR.params[0]) /* shape */ #define tau (DISTR.params[1]) /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Inititialize **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ int _unur_stdgen_zipf_init( struct unur_par *par, struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* initialize special generator for Zipf distribution */ /* if gen == NULL then only check existance of variant. */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* one of par and gen must not be the NULL pointer */ switch ((par) ? par->variant : gen->variant) { case 0: /* DEFAULT */ case 1: /* Acceptance Rejection */ _unur_dstd_set_sampling_routine(gen, _unur_stdgen_sample_zipf_zet ); return zipf_zet_init( gen ); default: /* no such generator */ return UNUR_FAILURE; } } /* end of _unur_stdgen_zipf_init() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Special generators **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ /***************************************************************************** * * * Zipf Distribution: Acceptance Rejection * * * ***************************************************************************** * * * FUNCTION: - samples a random number from the Zipf distribution with * * parameters rho > 0 and tau >= 0. * * * * REFERENCE : - J. Dagpunar (1988): Principles of Random Variate Generation,* * Clarendon Press, Oxford. * * * * Implemented by P. Busswald, September 1992 * ***************************************************************************** * * * To sample from the Zipf (or Zeta) distribution with parameters rho and * * tau it suffices to sample variates x from the distribution with density * * function * * f(x) = B * {[x+0.5]+tau}^(-(1+rho)) ( x > 0.5 ) * * and then deliver k=[x+0.5]. * * 1/B = Sum[(j+tau)^-(rho+1)] (j=1,2,...) converges for rho >= 0.5. * * It is not necessary to compute B, because variates x are generated by * * acceptance rejection using density function * * g(x) = rho * (c+0.5)^rho * (c+x)^-(rho+1). * * Integer overflow is possible, when roh is small (rho <= .5) and tau * * large. In this case a new sample is generated. * * If rho and tau satisfy the inequality * * rho > 0.14 + tau * 1.85e-8 + 0.02 * ln(tau) * * the percentage of overflow is less than 1%, so that the result is * * reliable. * * If either rho > 100 or k > 10000 numerical problems in computing the * * theoretical moments arise, therefore rho<=100 and k<=10000 are * * recommended. * * * ***************************************************************************** * WinRand (c) 1995 Ernst Stadlober, Institut fuer Statistitk, TU Graz * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #define GEN_N_PARAMS (2) #define c (GEN->gen_param[0]) #define d (GEN->gen_param[1]) /*---------------------------------------------------------------------------*/ inline static int zipf_zet_init( struct unur_gen *gen ) { /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_DSTD_GEN,UNUR_ERR_COOKIE); if (GEN->gen_param == NULL || GEN->n_gen_param != GEN_N_PARAMS) { GEN->n_gen_param = GEN_N_PARAMS; GEN->gen_param = _unur_xrealloc(GEN->gen_param, GEN->n_gen_param * sizeof(double)); } /* -X- setup code -X- */ if (rho= (double) INT_MAX); K = (long int) (X+0.5); E = -log(V); } while ( E < (1.+rho) * log( (K+tau)/(X+c)) - d ); /* -X- end of generator code -X- */ return K; } /* end of _unur_stdgen_sample_zipf_zet() */ /*---------------------------------------------------------------------------*/ #undef GEN_N_PARAMS #undef c #undef d /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/unur_distributions.h0000644001357500135600000010243514420445767017674 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: unur_distributions.h * * * * PURPOSE: * * defines macros and function prototypes for PDF, CDF, etc. * * of distribtions. * * * * REFERENCES: * * * * [1] N.L. Johnson, S. Kotz, and A.W. Kemp * * Univariate Discrete Distributions, * * 2nd edition * * John Wiley & Sons, Inc., New York, 1992 * * * * [2] N.L. Johnson, S. Kotz, and N. Balakrishnan * * Continuous Univariate Distributions, * * Volume 1, 2nd edition * * John Wiley & Sons, Inc., New York, 1994 * * * * [3] N.L. Johnson, S. Kotz, and N. Balakrishnan * * Continuous Univariate Distributions, * * Volume 2, 2nd edition * * John Wiley & Sons, Inc., New York, 1995 * * * * [4] N.L. Johnson, S. Kotz, and N. Balakrishnan * * Discrete Multivariate Distributions, * * John Wiley & Sons, Inc., New York, 1997 * * * * [5] S. Kotz, N. Balakrishnan, and N.L. Johnson * * Continuous Multivariate Distributions, * * Volume 1: Models and Applications * * John Wiley & Sons, Inc., New York, 2000 * * * * [0] S. Kotz and N.L. Johnson * * Encyclopedia of Statistical Sciences * * Volumes 1-9 * * John Wiley & Sons, Inc., New York, 1982-1988 * * * ***************************************************************************** * * * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifndef UNURAN_DISTRIBUTIONS_H_SEEN #define UNURAN_DISTRIBUTIONS_H_SEEN /*---------------------------------------------------------------------------*/ #include /*---------------------------------------------------------------------------*/ /***************************************************************************** * * * Continuous univariate distributions * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Beta distribution [3; ch.25, p.210] */ /* =DISTR beta Beta distribution =UP Stddist_CONT =REF [JKBc95: Ch.25, p.210] =PDF (x-a)^{p-1} * (b-x)^{q-1} =CONST 1 / (B(p,q) * (b-a)^{p+q-1}) =DOMAIN a < x < b =FPARAM 0 : p : > 0 : : scale : 1 : q : > 0 : : scale : [2] : a : : 0 : location, scale : [3] : b : > a : 1 : location, scale : =EON */ UNUR_DISTR *unur_distr_beta(const double *params, int n_params); /** TODO: STDGEN **/ /*---------------------------------------------------------------------------*/ /* Burr family of distributions [2; ch.12, p.54] */ UNUR_DISTR *unur_distr_burr(const double *params, int n_params); /** under construction **/ /* FIXME */ /*---------------------------------------------------------------------------*/ /* Cauchy distribution [2; ch.16, p.299] */ /* =DISTR cauchy Cauchy distribution =UP Stddist_CONT =REF [JKBb94: Ch.16, p.299] =PDF 1/(1 + ((x-theta)/lambda)^2) =CONST 1/(pi * lambda) =DOMAIN -infinity < x < infinity =FPARAM [0] : theta : : 0 : location : [[1]] : lambda : > 0 : 1 : scale : =STDGEN INV Inversion method =EON */ UNUR_DISTR *unur_distr_cauchy(const double *params, int n_params); /*---------------------------------------------------------------------------*/ /* Chi distribution [2; ch.18, p.417] */ /* =DISTR chi Chi distribution =UP Stddist_CONT =REF [JKBb94: Ch.18, p.417] =PDF x^{nu-1} * exp( -x^2/2 ) =CONST 1 / (2^{(nu/2)-1} * Gamma(nu/2)) =DOMAIN 0 <= x < infinity =FPARAM 0 : nu : > 0 : : shape : =STDGEN DEF Ratio of Uniforms with shift (only for @tex $nu >= 1$@end tex) [MJa87] =EON */ UNUR_DISTR *unur_distr_chi(const double *params, int n_params); /*---------------------------------------------------------------------------*/ /* Chisquare distribution [2; ch.18, p.416] */ /* =DISTR chisquare Chisquare distribution =UP Stddist_CONT =REF [JKBb94: Ch.18, p.416] =PDF x^{(nu/2)-1} * exp( -x/2 ) =CONST 1 / (2^{nu/2} * Gamma(nu/2)) =DOMAIN 0 <= x < infinity =FPARAM 0 : nu : > 0 : : shape (degrees of freedom) : =EON */ UNUR_DISTR *unur_distr_chisquare(const double *params, int n_params); /** TODO: STDGEN **/ /*---------------------------------------------------------------------------*/ /* Erlang distribution */ /* not implemented */ /*---------------------------------------------------------------------------*/ /* Exponential distribution [2; ch.19, p.494] */ /* =DISTR exponential Exponential distribution =UP Stddist_CONT =REF [JKBb94: Ch.19, p.494] =PDF exp( -(x-theta)/sigma) =CONST 1/sigma =DOMAIN theta <= x < infinity =FPARAM [0] : sigma : > 0 : 1 : scale : [[1]] : theta : : 0 : location : =STDGEN INV Inversion method =EON */ UNUR_DISTR *unur_distr_exponential(const double *params, int n_params); /*---------------------------------------------------------------------------*/ /* Extreme value type I distribution [3; ch.22, p.2] */ /* =DISTR extremeI Extreme value type I (Gumbel-type) distribution =UP Stddist_CONT =REF [JKBc95: Ch.22, p.2] =PDF exp( -exp( -\frac{x-zeta}{theta} ) - \frac{x-zeta}{theta} ) =CONST 1/theta =DOMAIN -infinity < x 0 : 1 : scale : =STDGEN INV Inversion method =EON */ UNUR_DISTR *unur_distr_extremeI(const double *params, int n_params); /*---------------------------------------------------------------------------*/ /* Extreme value type II distribution [3; ch.22, p.2] */ /* =DISTR extremeII Extreme value type II (Frechet-type) distribution =UP Stddist_CONT =REF [JKBc95: Ch.22, p.2] =PDF exp( -(\frac{x-zeta}{theta})^{-k}) * (\frac{x-zeta}{theta})^{-k-1} =CONST k/theta =DOMAIN zeta < x 0 : : shape : [1] : zeta : : 0 : location : [[2]] : theta : > 0 : 1 : scale : =STDGEN INV Inversion method =EON */ UNUR_DISTR *unur_distr_extremeII(const double *params, int n_params); /*---------------------------------------------------------------------------*/ /* F distribution [3; ch.27, p.332] */ /* =DISTR F F-distribution =UP Stddist_CONT =REF [JKBc95: Ch.27, p.322] =PDF (x^{nu_1/2-1}) / (1+nu_1/nu_2 x)^{(nu_1+nu_2)/2} =CONST (nu_1/nu_2)^{nu_1/2} / B(nu_1/2,nu_2/2) =DOMAIN 0 < x < infinity =FPARAM 0 : nu_1 : > 0 : : scale : 1 : nu_2 : > 0 : : scale : =EON */ UNUR_DISTR *unur_distr_F(const double *params, int n_params); /*---------------------------------------------------------------------------*/ /* Gamma distribution [2; ch.17, p.337] */ /* =DISTR gamma Gamma distribution =UP Stddist_CONT =REF [JKBb94: Ch.17, p.337] =PDF (\frac{x-gamma}{beta})^{alpha-1} * exp( -\frac{x-gamma}{beta} ) =CONST 1 / (beta * Gamma(alpha)) =DOMAIN gamma < x < infinity =FPARAM 0 : alpha : > 0 : : shape : [1] : beta : > 0 : 1 : scale : [[2]] : gamma : : 0 : location : =STDGEN DEF Acceptance Rejection combined with Acceptance Complement [ADa74] [ADa82] 2 Rejection from log-logistic envelopes [CHa77] =EON */ UNUR_DISTR *unur_distr_gamma(const double *params, int n_params); /*---------------------------------------------------------------------------*/ /* Generalized hyperbolic distribution */ /* Only pdf is implemented when macro 'HAVE_LIBRMATH' is defined! */ UNUR_DISTR *unur_distr_ghyp(const double *params, int n_params); /*---------------------------------------------------------------------------*/ /* Generalized inverse Gaussian distribution [2; ch.15, p.284] */ /* =DISTR gig Generalized Inverse Gaussian distribution =UP Stddist_CONT =REF [JKBb94: Ch.15, p.84] =PDF x^{theta-1} * exp( -\frac{1}{2} * omega * (\frac{x}{eta} + \frac{eta}{x})) =CONST @text{not implemented!} =CDF @text{not implemented!} =DOMAIN 0 < x 0 : : scale : [2] : eta : > 0 : 1 : shape : =STDGEN DEF Ratio-of-Uniforms method [Dag89] =EON */ UNUR_DISTR *unur_distr_gig(const double *params, int n_params); /*---------------------------------------------------------------------------*/ /* Generalized inverse Gaussian distribution [2; ch.15, p.284] */ /* (Alternative parametrization.) */ /* =DISTR gig2 Generalized Inverse Gaussian distribution =UP Stddist_CONT =REF [JKBb94: Ch.15, p.84] =PDF x^{theta-1} * exp( -\frac{1}{2} * (\frac{chi}{x} + psi*x)) =CONST @text{not implemented!} =CDF @text{not implemented!} =DOMAIN 0 < x 0 : : shape : 2 : chi : > 0 : : shape : =EON */ /** TODO: STDGEN **/ UNUR_DISTR *unur_distr_gig2(const double *params, int n_params); /*---------------------------------------------------------------------------*/ /* Hyperbolic distribution */ /* =DISTR hyperbolic Hyperbolic distribution =UP Stddist_CONT =PDF exp( -alpha * sqrt{delta^2 + (x - mu)^2} + beta*(x-mu) ) =CONST @text{not implemented!} =CDF @text{not implemented!} =DOMAIN -infinity < x |beta| : : shape (tail) : 1 : beta : : : shape (asymmetry): 2 : delta : > 0 : : scale : 3 : mu : : : location : =EON */ UNUR_DISTR *unur_distr_hyperbolic(const double *params, int n_params); /** TODO: STDGEN **/ /*---------------------------------------------------------------------------*/ /* Inverse Gaussian (Wald) distribution [2; ch.15, p.259] */ /* =DISTR ig Inverse Gaussian distribution =UP Stddist_CONT =REF [JKBb94: Ch.15, p.259] =PDF sqrt{ \frac{lambda}{2*pi*x^3} } * exp( -\frac{lambda*(x-mu)^2}{2*mu^2*x} ) =CONST 1 =CDF @text{not implemented!} =DOMAIN 0 < x 0 : : mean : 1 : lambda : > 0 : : shape : =EON */ UNUR_DISTR *unur_distr_ig(const double *params, int n_params); /** TODO: STDGEN **/ /*---------------------------------------------------------------------------*/ /* Laplace distribution [3; ch.24, p.164] */ /* =DISTR laplace Laplace distribution =UP Stddist_CONT =REF [JKBc95: Ch.24, p.164] =PDF exp( -|x-theta| / phi ) =CONST 1/(2 * phi) =DOMAIN -infinity < x 0 : 1 : scale : =STDGEN INV Inversion method =EON */ UNUR_DISTR *unur_distr_laplace(const double *params, int n_params); /*---------------------------------------------------------------------------*/ /* Logistic distribution [3; ch.23, p.115] */ /* =DISTR logistic Logistic distribution =UP Stddist_CONT =REF [JKBc95: Ch.23, p.115] =PDF exp(-\frac{x-alpha}{beta}) * (1 + exp(-\frac{x-alpha}{beta}))^{-2} =CONST 1/beta =DOMAIN -infinity < x 0 : 1 : scale : =STDGEN INV Inversion method =EON */ UNUR_DISTR *unur_distr_logistic(const double *params, int n_params); /*---------------------------------------------------------------------------*/ /* Lognormal distribution [2; ch.14, p.208] */ /* =DISTR lognormal Log-Normal distribution =UP Stddist_CONT =REF [JKBb94: Ch.14, p. 208] =PDF 1/(x-theta) * exp( -(log(x-theta)-zeta)^2/(2 sigma^2) ) =CONST 1/(sigma * sqrt{2 pi}) =DOMAIN theta <= x < infinity =FPARAM 0 : zeta : : : shape : 1 : sigma : > 0 : : shape : [2] : theta : : 0 : location : =EON */ UNUR_DISTR *unur_distr_lognormal(const double *params, int n_params); /** TODO: STDGEN **/ /*---------------------------------------------------------------------------*/ /* Lomax distribution (Pareto distr. of second kind) [2; ch.20, p.575] */ /* =DISTR lomax Lomax distribution (Pareto distribution of second kind) =UP Stddist_CONT =REF [JKBb94: Ch.20, p.575] =PDF (x+C)^{-(a+1)} =CONST a * C^a =DOMAIN 0 <= x < infinity =FPARAM 0 : a : > 0 : : shape : [1] : C : > 0 : 1 : scale : =STDGEN INV Inversion method =EON */ UNUR_DISTR *unur_distr_lomax(const double *params, int n_params); /*---------------------------------------------------------------------------*/ /* Meixner distribution */ /* Only pdf is implemented when macro 'HAVE_LIBRMATH' is defined! */ UNUR_DISTR *unur_distr_meixner(const double *params, int n_params); /*---------------------------------------------------------------------------*/ /* Normal distribution [2; ch.13, p.80] */ /* =DISTR normal Normal distribution =UP Stddist_CONT =REF [JKBb94: Ch.13, p.80] =PDF exp( -\frac{1}{2} * (\frac{x-mu}{sigma})^2 ) =CONST 1 / (sigma * sqrt{2 pi}) =DOMAIN -infinity < x < infinity =FPARAM [0] : mu : : 0 : location : [[1]] : sigma : > 0 : 1 : scale : =STDGEN DEF ACR method (Acceptance-Complement Ratio) [HDa90] 1 Box-Muller method [BMa58] 2 Polar method with rejection [MGa62] 3 Kindermann-Ramage method [KRa76] INV Inversion method (slow) =EON */ UNUR_DISTR *unur_distr_normal( const double *params, int n_params ); /*---------------------------------------------------------------------------*/ /* Pareto distribution (of first kind) [2; ch.20, p.574] */ /* =DISTR pareto Pareto distribution (of first kind) =UP Stddist_CONT =REF [JKBb94: Ch.20, p.574] =PDF x^{-(a+1)} =CONST a * k^a =DOMAIN k < x < infinity =FPARAM 0 : k : > 0 : : shape, location : 1 : a : > 0 : : shape : =STDGEN INV Inversion method =EON */ UNUR_DISTR *unur_distr_pareto( const double *params, int n_params ); /*---------------------------------------------------------------------------*/ /* Pearson VI distribution */ /* not implemented */ /*---------------------------------------------------------------------------*/ /* Perks distribution */ /* not implemented */ /*---------------------------------------------------------------------------*/ /* Planck distribution */ /* not implemented **/ /*---------------------------------------------------------------------------*/ /* Power-exponential (Subbotin) distribution [3; ch.24, p.195] */ /* =DISTR powerexponential Powerexponential (Subbotin) distribution =UP Stddist_CONT =REF [JKBc95: Ch.24, p.195] =PDF exp( -|x|^tau ) =CONST 1 / (2 * Gamma(1+1/tau)) =DOMAIN -infinity < x < infinity =FPARAM 0 : tau : > 0 : : shape : =STDGEN DEF Transformed density rejection (only for @tex $tau >= 1$@end tex) [DLa86] =EON */ UNUR_DISTR *unur_distr_powerexponential(const double *params, int n_params); /*---------------------------------------------------------------------------*/ /* Rayleigh distribution [2; ch.18, p.456] */ /* =DISTR rayleigh Rayleigh distribution =UP Stddist_CONT =REF [JKBb94: Ch.18, p.456] =PDF x * exp( -1/2 * (\frac{x}{sigma})^2 ) =CONST 1 / sigma^2 =DOMAIN 0 <= x < infinity =FPARAM 0 : sigma : > 0 : : scale : =EON */ UNUR_DISTR *unur_distr_rayleigh(const double *params, int n_params); /** TODO: STDGEN **/ /*---------------------------------------------------------------------------*/ /* Slash distribution [2; ch.12, p.63] */ /* =DISTR slash Slash distribution =UP Stddist_CONT =REF [JKBb94: Ch.12, p.63] =PDF (1 - exp(-x^2/2)) / x^2 =CONST 1 / sqrt{2 pi} =CDF @text{not implemented!} =DOMAIN -infinity < x < infinity =STDGEN DEF Ratio of normal and uniform random variates =EON */ UNUR_DISTR *unur_distr_slash(const double *params, int n_params); /*---------------------------------------------------------------------------*/ /* Student's t distribution [3; ch. 28; p. 362] */ /* =DISTR student Student's t distribution =UP Stddist_CONT =REF [JKBc95: Ch.28, p.362] =PDF (1+\frac{t^2}{nu})^{-(nu+1)/2} =CONST 1 / (sqrt{nu} * B(1/2,nu/2)) =CDF @text{not implemented!} =DOMAIN -infinity < x < infinity =FPARAM 0 : nu : > 0 : : shape : =EON */ UNUR_DISTR *unur_distr_student(const double *params, int n_params); /*---------------------------------------------------------------------------*/ /* Triangular distribution [3; ch.26, p.297] */ /* =DISTR triangular Triangular distribution =UP Stddist_CONT =REF [JKBc95: Ch.26, p.297] =PDF 2*x / H, \hbox{ for } 0 <= x <= H \hfill\break 2*(1-x) / (1-H), \hbox{ for } H <= x <= 1 =CONST 1 =DOMAIN 0 <= x <= 1 =FPARAM [0] : H : 0 <= H <= 1 : 1/2 : shape : =STDGEN INV Inversion method =EON */ UNUR_DISTR *unur_distr_triangular(const double *params, int n_params); /*---------------------------------------------------------------------------*/ /* Uniform distribution [3; ch.26, p.276] */ /* =DISTR uniform Uniform distribution =UP Stddist_CONT =REF [JKBc95: Ch.26, p.276] =PDF 1 / (b-a) =CONST 1 =DOMAIN a < x < b =FPARAM [0] : a : : 0 : location : [1] : b : > a : 1 : location : =STDGEN INV Inversion method =EON */ UNUR_DISTR *unur_distr_uniform(const double *params, int n_params); /*---------------------------------------------------------------------------*/ /* Variance Gamma distribution */ /* Only pdf is implemented when macro 'HAVE_LIBRMATH' is defined! */ UNUR_DISTR *unur_distr_vg(const double *params, int n_params); /*---------------------------------------------------------------------------*/ /* Weibull distribution [2; ch.21, p.628] */ /* =DISTR weibull Weibull distribution =UP Stddist_CONT =REF [JKBb94: Ch.21, p.628] =PDF (\frac{x-zeta}{alpha})^{c-1} * exp( -(\frac{x-zeta}{alpha})^c ) =CONST c / alpha =DOMAIN zeta < x < infinity =FPARAM 0 : c : > 0 : : shape : [1] : alpha : > 0 : 1 : scale : [[2]] : zeta : : 0 : location : =STDGEN INV Inversion method =EON */ UNUR_DISTR *unur_distr_weibull(const double *params, int n_params); /*---------------------------------------------------------------------------*/ /***************************************************************************** * * * Continuous multivariate distributions * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Multinormal distribution [5; ch.45, p.105] */ /* =DISTR multinormal Multinormal distribution =UP Stddist_CVEC =REF [KBJe00: Ch.45, p.105] =PDF f(x) = exp( -1/2 * (x-mu)^t . Sigma^{-1} . (x-mu) ) =CONST 1 / ( (2 pi)^{dim/2} * sqrt{det(Sigma)} ) =DOMAIN -infinity^{dim} < x < infinity^{dim} =FPARAM [0] : mu : : (0,@dots{},0) : location : [1] : Sigma : Symm, Pos. def. : I : shape : =EON */ UNUR_DISTR *unur_distr_multinormal(int dim, const double *mean, const double *covar); /*---------------------------------------------------------------------------*/ /* Multicauchy distribution [5; ch.45, p.219] */ /* =DISTR multicauchy Multicauchy distribution =UP Stddist_CVEC =PDF f(x) = 1 / ( 1 + (x-mu)^t . Sigma^{-1} . (x-mu) )^{(dim+1)/2} =CONST Gamma((dim+1)/2) / ( pi^{(dim+1)/2} * sqrt{det(Sigma)} ) =DOMAIN -infinity^{dim} < x < infinity^{dim} =FPARAM [0] : mu : : (0,@dots{},0) : location : [1] : Sigma : Symm, Pos. def. : I : shape : =STDGEN DEF Cholesky factor =EON */ UNUR_DISTR *unur_distr_multicauchy(int dim, const double *mean, const double *covar); /*---------------------------------------------------------------------------*/ /* Multistudent distribution */ /* =DISTR multistudent Multistudent distribution =UP Stddist_CVEC =PDF f(x) = 1 / ( 1 + (x-mu)^t . Sigma^{-1} . (x-mu) / m)^{(dim+m)/2} ) =CONST Gamma((dim+m)/2) / ( Gamma(m/2) (m*pi)^{dim/2} * sqrt{det(Sigma)} ) =DOMAIN -infinity^{dim} < x < infinity^{dim} =FPARAM [0] : m : m>0 : 1 : location : [1] : mu : : (0,@dots{},0) : location : [2] : Sigma : Symm, Pos. def. : I : shape : =EON */ UNUR_DISTR *unur_distr_multistudent(int dim, double nu, const double *mean, const double *covar); /*---------------------------------------------------------------------------*/ /* Multiexponential distribution */ /* =DISTR multiexponential Multiexponential distribution =UP Stddist_CVEC =PDF f(x) = Prod_{i=0}^{i=dim-1} exp(-(dim-i) (x_{i}-x_{i-1} - (theta_i-theta_{i-1}) ) / sigma_i); with x_{-1}=0 and theta_{i-1}=0 =CONST Prod_{i=0}^{i=dim-1} 1/sigma_i =DOMAIN 0^{dim} <= x < infinity^{dim} =FPARAM [0] : sigma : : (1,@dots{},1) : shape : [1] : theta : : (0,@dots{},0) : location : =EON */ UNUR_DISTR *unur_distr_multiexponential(int dim, const double *sigma, const double *theta); /*---------------------------------------------------------------------------*/ /* Copula */ /* =DISTR copula Copula (distribution with uniform marginals) =UP Stddist_CVEC =DESCRIPTION @code{UNUR_DISTR *unur_distr_copula(int dim, const double *rankcorr)} creates a distribution object for a copula with @var{dim} components. @var{rankcorr} is an array of size @var{dim}x@var{dim} and holds the rank correlation matrix (Spearman's correlation), where the rows of the matrix are stored consecutively in this array. The NULL pointer can be used instead the identity matrix. If @var{covar} is not a valid rank correlation matrix (i.e., not positive definite) then no distribution object is created and NULL is returned. =EON */ UNUR_DISTR *unur_distr_copula(int dim, const double *rankcorr); /*---------------------------------------------------------------------------*/ /***************************************************************************** * * * Continuous matrix distributions * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Random correlation matrix */ UNUR_DISTR *unur_distr_correlation( int n ); /* =DISTR correlation Random correlation matrix =UP Stddist_MATR =DESCRIPTION @code{UNUR_DISTR *unur_distr_correlation( int n )} creates a distribution object for a random correlation matrix of @var{n} rows and columns. It can be used with method MCORR (@pxref{MCORR,,Random Correlation Matrix}) to generate random correlation matrices of the given size. =EON */ /*---------------------------------------------------------------------------*/ /***************************************************************************** * * * Discrete univariate distributions * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Binomial distribution [1; ch.3, p.105] */ /* =DISTR binomial Binomial distribution =UP Stddist_DISCR =REF [JKKa92: Ch.3, p.105] =PMF {n \choose k} * p^k * (1-p)^{n-k} =CONST 1 =DOMAIN 0 <= k <= n =FPARAM 0 : n : >= 1 : : no. of elements : 1 : p : 0 < p < 1 : : shape : =STDGEN DEF Ratio of Uniforms/Inversion [STa89] =EON */ UNUR_DISTR *unur_distr_binomial(const double *params, int n_params); /** No CDF !!! **/ /*---------------------------------------------------------------------------*/ /* Geometric distribution [1; ch.5.2, p.201] */ /* =DISTR geometric Geometric distribution =UP Stddist_DISCR =REF [JKKa92: Ch.5.2, p.201] =PMF p * (1-p)^k =CONST 1 =DOMAIN 0 <= k < infinity =FPARAM 0 : p : 0 < p < 1 : : shape : =STDGEN INV Inversion method =EON */ UNUR_DISTR *unur_distr_geometric(const double *params, int n_params); /*---------------------------------------------------------------------------*/ /* Hypergeometric distribution [1; ch.6, p.237] */ /* =DISTR hypergeometric Hypergeometric distribution =UP Stddist_DISCR =REF [JKKa92: Ch.6, p.237] =PMF {M \choose k} * {N-M \choose n-k} / {N \choose n} =CONST 1 =DOMAIN max(0,n-N+M) <= k <= min(n,M) =FPARAM 0 : N : >= 1 : : no. of elements : 1 : M : 1 <= M <= N : : shape : 2 : n : 1 <= n <= N : : shape : =STDGEN DEF Ratio of Uniforms/Inversion [STa89] =EON */ UNUR_DISTR *unur_distr_hypergeometric(const double *params, int n_params); /** No CDF !!! **/ /*---------------------------------------------------------------------------*/ /* Logarithmic distribution [1; ch.7, p.285] */ /* =DISTR logarithmic Logarithmic distribution =UP Stddist_DISCR =REF [JKKa92: Ch.7, p.285] =PMF theta^k / k =CONST - log( 1.-theta); =DOMAIN 1 <= k < infinity =FPARAM 0 : theta : 0 < theta < 1 : : shape : =STDGEN DEF Inversion/Transformation [KAa81] =EON */ UNUR_DISTR *unur_distr_logarithmic(const double *params, int n_params); /** No CDF !!! **/ /*---------------------------------------------------------------------------*/ /* Negative Binomial distribution [1; ch.5.1, p.200] */ /* =DISTR negativebinomial Negative Binomial distribution =UP Stddist_DISCR =REF [JKKa92: Ch.5.1, p.200] =PMF {k+r-1 \choose r-1} * p^r * (1-p)^k =CONST 1 =DOMAIN 0 <= k < infinity =FPARAM 0 : p : 0 < p < 1 : : shape : 1 : r : > 0 : : shape : =EON */ UNUR_DISTR *unur_distr_negativebinomial(const double *params, int n_params); /** No CDF !!! **/ /** TODO: STDGEN **/ /*---------------------------------------------------------------------------*/ /* Poisson distribution [1; ch.4, p.151] */ /* =DISTR poisson Poisson distribution =UP Stddist_DISCR =REF [JKKa92: Ch.4, p.151] =PMF theta^k / k! =CONST exp(theta) =DOMAIN 0 <= k < infinity =FPARAM 0 : theta : > 0 : : shape : =STDGEN DEF Tabulated Inversion combined with Acceptance Complement [ADb82] 2 Tabulated Inversion combined with Patchwork Rejection [ZHa94] =EON */ UNUR_DISTR *unur_distr_poisson(const double *params, int n_params); /** No CDF !!! **/ /*---------------------------------------------------------------------------*/ /* Zipf (or Zeta) distribution [1; ch.11.20, p.465] */ UNUR_DISTR *unur_distr_zipf(const double *params, int n_params); /** No CDF !!! **/ /** TODO: STDGEN **/ /*---------------------------------------------------------------------------*/ #endif /* UNURAN_DISTRIBUTIONS_H_SEEN */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/d_hypergeometric.c0000644001357500135600000002627014420445767017247 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: d_hypergeometric.c * * * * REFERENCES: * * * * [1] N.L. Johnson, S. Kotz and A.W. Kemp * * Univariate Discrete Distributions, * * 2nd edition * * John Wiley & Sons, Inc., New York, 1992 * * * ***************************************************************************** * * * distr: Hypergeometric distribution [1; ch.6, p.237] * * * * pmf: p(k) = (M \choose k) * (N-M \choose n-k) / (N \choose n) * * domain: max(0,n-N+M) <= k <= min(n,M) * * constant: 1 * * * * parameters: * * 0: N >= M * * 1: M >= 1 * * 2: n n >= 1 * * * ***************************************************************************** * * * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "unur_distributions.h" #include "unur_distributions_source.h" #include "unur_stddistr.h" /*---------------------------------------------------------------------------*/ static const char distr_name[] = "hypergeometric"; /*---------------------------------------------------------------------------*/ /* parameters */ #define N params[0] #define M params[1] #define n params[2] /*---------------------------------------------------------------------------*/ #define DISTR distr->data.discr #define LOGNORMCONSTANT (distr->data.discr.norm_constant) /*---------------------------------------------------------------------------*/ /* function prototypes */ static double _unur_pmf_hypergeometric( int k, const UNUR_DISTR *distr ); #ifdef _unur_SF_cdf_hypergeometric static double _unur_cdf_hypergeometric( int k, const UNUR_DISTR *distr ); #endif #ifdef _unur_SF_invcdf_hypergeometric static int _unur_invcdf_hypergeometric( double u, const UNUR_DISTR *distr ); #endif static int _unur_upd_mode_hypergeometric( UNUR_DISTR *distr ); static int _unur_upd_sum_hypergeometric( UNUR_DISTR *distr ); static int _unur_set_params_hypergeometric( UNUR_DISTR *distr, const double *params, int n_params ); /*---------------------------------------------------------------------------*/ double _unur_pmf_hypergeometric(int k, const UNUR_DISTR *distr) { register const double *params = DISTR.params; if ( k < _unur_max(0,(n-N+M-0.5)) || k > _unur_min(n,M)+0.5 ) return 0.; else return exp( LOGNORMCONSTANT - _unur_SF_ln_factorial(k) - _unur_SF_ln_factorial(M-k) - _unur_SF_ln_factorial(n-k) - _unur_SF_ln_factorial(N-M-n+k) ); } /* end of _unur_pmf_hypergeometric() */ /*---------------------------------------------------------------------------*/ #ifdef _unur_SF_cdf_hypergeometric double _unur_cdf_hypergeometric(int k, const UNUR_DISTR *distr) { const double *params = DISTR.params; return _unur_SF_cdf_hypergeometric(k,N,M,n); } /* end of _unur_cdf_hypergeometric() */ #endif /*---------------------------------------------------------------------------*/ #ifdef _unur_SF_invcdf_hypergeometric int _unur_invcdf_hypergeometric(double u, const UNUR_DISTR *distr) { const double *params = DISTR.params; double x; x = _unur_SF_invcdf_hypergeometric(u,N,M,n); return ((x>=INT_MAX) ? INT_MAX : ((int) x)); } /* end of _unur_invcdf_hypergeometric() */ #endif /*---------------------------------------------------------------------------*/ int _unur_upd_mode_hypergeometric( UNUR_DISTR *distr ) { DISTR.mode = (int) ( (DISTR.n + 1) * (DISTR.M + 1.) / (DISTR.N + 2.) ); /* mode must be in domain */ if (DISTR.mode < DISTR.domain[0]) DISTR.mode = DISTR.domain[0]; else if (DISTR.mode > DISTR.domain[1]) DISTR.mode = DISTR.domain[1]; /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_upd_mode_hypergeometric() */ /*---------------------------------------------------------------------------*/ int _unur_upd_sum_hypergeometric( UNUR_DISTR *distr ) { register double *params = DISTR.params; /* log of normalization constant: none */ LOGNORMCONSTANT = _unur_SF_ln_factorial(M) + _unur_SF_ln_factorial(N-M) + _unur_SF_ln_factorial(n) + _unur_SF_ln_factorial(N-n) - _unur_SF_ln_factorial(N); if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.sum = 1.; return UNUR_SUCCESS; } #ifdef _unur_SF_cdf_hypergeometric /* else */ DISTR.sum = ( _unur_cdf_hypergeometric( DISTR.domain[1],distr) - _unur_cdf_hypergeometric( DISTR.domain[0]-1,distr) ); return UNUR_SUCCESS; #else return UNUR_ERR_DISTR_REQUIRED; #endif } /* end of _unur_upd_sum_hypergeometric() */ /*---------------------------------------------------------------------------*/ int _unur_set_params_hypergeometric( UNUR_DISTR *distr, const double *params, int n_params ) { int nh; /* check number of parameters for distribution */ if (n_params < 3) { _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } if (n_params > 3) { _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); n_params = 3; } CHECK_NULL(params,UNUR_ERR_NULL); /* check parameters */ if (M <= 0. || N <=0. || n <= 0. || n >= N || M >= N ) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"M, N, n must be > 0 and n0.001) _unur_warning(distr_name,UNUR_ERR_DISTR_DOMAIN,"n was rounded to the closest integer value"); DISTR.N = nh; nh = (int)(M+0.5); if(fabs(nh-M)>0.001) _unur_warning(distr_name,UNUR_ERR_DISTR_DOMAIN,"n was rounded to the closest integer value"); DISTR.M = nh; nh = (int)(n+0.5); if(fabs(nh-n)>0.001) _unur_warning(distr_name,UNUR_ERR_DISTR_DOMAIN,"n was rounded to the closest integer value"); DISTR.n = nh; /* default parameters: none */ /* copy optional parameters: none */ /* store number of parameters */ DISTR.n_params = n_params; /* set (standard) domain */ if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.domain[0] = (int) (_unur_max(0,(DISTR.n - DISTR.N + DISTR.M + 0.5))); /* left boundary */ DISTR.domain[1] = (int) (_unur_min(DISTR.n, DISTR.M) + 0.5); /* right boundary */ } return UNUR_SUCCESS; } /* end of _unur_set_params_hypergeometric() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_hypergeometric( const double *params, int n_params ) { register struct unur_distr *distr; /* get new (empty) distribution object */ distr = unur_distr_discr_new(); /* set distribution id */ distr->id = UNUR_DISTR_HYPERGEOMETRIC; /* name of distribution */ distr->name = distr_name; /* how to get special generators */ DISTR.init = _unur_stdgen_hypergeometric_init; /* functions */ DISTR.pmf = _unur_pmf_hypergeometric; /* pointer to PMF */ #ifdef _unur_SF_cdf_hypergeometric DISTR.cdf = _unur_cdf_hypergeometric; /* pointer to CDF */ #endif #ifdef _unur_SF_invcdf_hypergeometric DISTR.invcdf = _unur_invcdf_hypergeometric; /* pointer to inverse CDF */ #endif /* indicate which parameters are set */ distr->set = ( UNUR_DISTR_SET_DOMAIN | UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_PMFSUM | UNUR_DISTR_SET_MODE ); /* set parameters for distribution */ if (_unur_set_params_hypergeometric(distr,params,n_params)!=UNUR_SUCCESS) { free(distr); return NULL; } /* log of normalization constant */ _unur_upd_sum_hypergeometric( distr ); /* mode and sum over PMF */ _unur_upd_mode_hypergeometric(distr); DISTR.sum = 1.; /* function for setting parameters and updating domain */ DISTR.set_params = _unur_set_params_hypergeometric; /* function for updating derived parameters */ DISTR.upd_mode = _unur_upd_mode_hypergeometric; /* funct for computing mode */ DISTR.upd_sum = _unur_upd_sum_hypergeometric; /* funct for computing area */ /* return pointer to object */ return distr; } /* end of unur_distr_hypergeometric() */ /*---------------------------------------------------------------------------*/ #undef N #undef M #undef n #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/c_exponential.c0000644001357500135600000003104714420445767016544 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: c_exponential.c * * * * REFERENCES: * * * * [2] N.L. Johnson, S. Kotz and N. Balakrishnan * * Continuous Univariate Distributions, * * Volume 1, 2nd edition * * John Wiley & Sons, Inc., New York, 1994 * * * ***************************************************************************** * * * distr: Exponential distribution [2; ch.19, p.494] * * * * pdf: f(x) = exp( - (x-theta)/sigma ) * * domain: x >= theta * * constant: 1 / sigma * * * * parameters: * * 0: sigma > 0 (1) ... scale * * 1: theta (0) ... location * * * ***************************************************************************** * * * standard form * * * * pdf: f(x) = exp(-x) * * domain: x >= 0 * * * * parameters: * * none * * * * 0: sigma = 1 * * 1: theta = 0 * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "unur_distributions.h" #include "unur_distributions_source.h" #include "unur_stddistr.h" /*---------------------------------------------------------------------------*/ static const char distr_name[] = "exponential"; /* parameters */ #define sigma params[0] #define theta params[1] #define DISTR distr->data.cont #define LOGNORMCONSTANT (distr->data.cont.norm_constant) /* function prototypes */ static double _unur_pdf_exponential( double x, const UNUR_DISTR *distr ); static double _unur_logpdf_exponential( double x, const UNUR_DISTR *distr ); static double _unur_dpdf_exponential( double x, const UNUR_DISTR *distr ); static double _unur_dlogpdf_exponential( double x, const UNUR_DISTR *distr ); static double _unur_cdf_exponential( double x, const UNUR_DISTR *distr ); static double _unur_invcdf_exponential( double u, const UNUR_DISTR *distr ); static int _unur_upd_mode_exponential( UNUR_DISTR *distr ); static int _unur_upd_area_exponential( UNUR_DISTR *distr ); static int _unur_set_params_exponential( UNUR_DISTR *distr, const double *params, int n_params ); /*---------------------------------------------------------------------------*/ double _unur_pdf_exponential( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; if (DISTR.n_params > 0) /* standardize */ x = (x - theta) / sigma; /* standard form */ return ( (x<0.) ? 0. : exp(-x - LOGNORMCONSTANT) ); } /* end of _unur_pdf_exponential() */ /*---------------------------------------------------------------------------*/ double _unur_logpdf_exponential( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; if (DISTR.n_params > 0) /* standardize */ x = (x - theta) / sigma; /* standard form */ return ( (x<0.) ? -UNUR_INFINITY : (-x - LOGNORMCONSTANT) ); } /* end of _unur_logpdf_exponential() */ /*---------------------------------------------------------------------------*/ double _unur_dpdf_exponential( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; if (DISTR.n_params > 0) /* standardize */ x = (x - theta) / sigma; /* standard form */ return ( (x<0.) ? 0. : -exp(-x - 2.*LOGNORMCONSTANT) ); } /* end of _unur_dpdf_exponential() */ /*---------------------------------------------------------------------------*/ double _unur_dlogpdf_exponential( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; if (DISTR.n_params > 0) /* standardize */ x = (x - theta) / sigma; /* standard form */ return ( (x<0.) ? 0. : -1./sigma ); } /* end of _unur_dlogpdf_exponential() */ /*---------------------------------------------------------------------------*/ double _unur_cdf_exponential( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; if (DISTR.n_params > 0) /* standardize */ x = (x - theta) / sigma; /* standard form */ return ( (x<0.) ? 0. : 1.-exp(-x) ); } /* end of _unur_cdf_exponential() */ /*---------------------------------------------------------------------------*/ double _unur_invcdf_exponential( double U, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; double X; X = - log( 1. - U ); return ((DISTR.n_params==0) ? X : theta + sigma * X); } /* end of _unur_invcdf_exponential() */ /*---------------------------------------------------------------------------*/ int _unur_upd_mode_exponential( UNUR_DISTR *distr ) { DISTR.mode = DISTR.theta; /* mode must be in domain */ if (DISTR.mode < DISTR.domain[0]) DISTR.mode = DISTR.domain[0]; else if (DISTR.mode > DISTR.domain[1]) DISTR.mode = DISTR.domain[1]; return UNUR_SUCCESS; } /* end of _unur_upd_mode_exponential() */ /*---------------------------------------------------------------------------*/ int _unur_upd_area_exponential( UNUR_DISTR *distr ) { /* log of normalization constant */ LOGNORMCONSTANT = log(DISTR.sigma); if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.area = 1.; return UNUR_SUCCESS; } /* else */ DISTR.area = ( _unur_cdf_exponential( DISTR.domain[1],distr) - _unur_cdf_exponential( DISTR.domain[0],distr) ); return UNUR_SUCCESS; } /* end of _unur_upd_area_exponential() */ /*---------------------------------------------------------------------------*/ int _unur_set_params_exponential( UNUR_DISTR *distr, const double *params, int n_params ) { /* check number of parameters for distribution */ if (n_params < 0) n_params = 0; if (n_params > 2) { _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); n_params = 2; } if (n_params > 0) CHECK_NULL(params,UNUR_ERR_NULL); /* check parameter sigma */ if (n_params > 0 && sigma <= 0.) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"sigma <= 0"); return UNUR_ERR_DISTR_DOMAIN; } /* copy parameters for standard form: none */ /* default parameters */ DISTR.sigma = 1.; DISTR.theta = 0.; /* copy optional parameters */ switch (n_params) { case 2: DISTR.theta = theta; /* FALLTHROUGH */ case 1: DISTR.sigma = sigma; n_params = 2; /* number of parameters for non-standard form */ /* FALLTHROUGH */ default: break; } /* store number of parameters */ DISTR.n_params = n_params; /* set (standard) domain */ if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { /* domain */ DISTR.domain[0] = DISTR.theta; /* left boundary */ DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ } return UNUR_SUCCESS; } /* end of _unur_set_params_exponential() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_exponential( const double *params, int n_params ) { register struct unur_distr *distr; /* get new (empty) distribution object */ distr = unur_distr_cont_new(); /* set distribution id */ distr->id = UNUR_DISTR_EXPONENTIAL; /* name of distribution */ distr->name = distr_name; /* how to get special generators */ DISTR.init = _unur_stdgen_exponential_init; /* functions */ DISTR.pdf = _unur_pdf_exponential; /* pointer to PDF */ DISTR.logpdf = _unur_logpdf_exponential; /* pointer to logPDF */ DISTR.dpdf = _unur_dpdf_exponential; /* pointer to derivative of PDF */ DISTR.dlogpdf = _unur_dlogpdf_exponential; /* pointer to derivative of logPDF */ DISTR.cdf = _unur_cdf_exponential; /* pointer to CDF */ DISTR.invcdf = _unur_invcdf_exponential; /* pointer to inverse CDF */ /* indicate which parameters are set */ distr->set = ( UNUR_DISTR_SET_DOMAIN | UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_MODE | UNUR_DISTR_SET_PDFAREA ); /* set parameters for distribution */ if (_unur_set_params_exponential(distr,params,n_params)!=UNUR_SUCCESS) { free(distr); return NULL; } /* log of normalization constant */ LOGNORMCONSTANT = log(DISTR.sigma); /* mode and area below p.d.f. */ DISTR.mode = DISTR.theta; /* theta */ DISTR.area = 1.; /* function for setting parameters and updating domain */ DISTR.set_params = _unur_set_params_exponential; /* function for updating derived parameters */ DISTR.upd_mode = _unur_upd_mode_exponential; /* funct for computing mode */ DISTR.upd_area = _unur_upd_area_exponential; /* funct for computing area */ /* return pointer to object */ return distr; } /* end of unur_distr_exponential() */ /*---------------------------------------------------------------------------*/ #undef sigma #undef theta #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/c_rayleigh.c0000644001357500135600000002253514420445767016024 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: c_rayleigh.c * * * * REFERENCES: * * * * [2] N.L. Johnson, S. Kotz and N. Balakrishnan * * Continuous Univariate Distributions, * * Volume 1, 2nd edition * * John Wiley & Sons, Inc., New York, 1994 * * * ***************************************************************************** * * * distr: Rayleigh distribution [2; ch.18, p.456] * * * * pdf: f(x) = x * exp( -1/2 * (x/sigma)^2 ) * * domain: 0 <= x < infinity * * constant: 1 / sigma^2 * * * * parameters: 1 * * 0: sigma > 0 ... scale * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "unur_distributions.h" #include "unur_distributions_source.h" #include "unur_stddistr.h" /*---------------------------------------------------------------------------*/ static const char distr_name[] = "rayleigh"; /* parameters */ #define sigma params[0] #define DISTR distr->data.cont #define LOGNORMCONSTANT (distr->data.cont.norm_constant) /* function prototypes */ static double _unur_pdf_rayleigh( double x, const UNUR_DISTR *distr ); static double _unur_dpdf_rayleigh( double x, const UNUR_DISTR *distr ); static double _unur_cdf_rayleigh( double x, const UNUR_DISTR *distr ); static int _unur_upd_mode_rayleigh( UNUR_DISTR *distr ); static int _unur_upd_area_rayleigh( UNUR_DISTR *distr ); static int _unur_set_params_rayleigh( UNUR_DISTR *distr, const double *params, int n_params ); /*---------------------------------------------------------------------------*/ double _unur_pdf_rayleigh( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; if (x<=0.) return 0.; /* else */ return (x * exp(-x*x/(2.*sigma*sigma) - LOGNORMCONSTANT ) ); } /* end of _unur_pdf_rayleigh() */ /*---------------------------------------------------------------------------*/ double _unur_dpdf_rayleigh( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; register double z; z = x*x/(sigma*sigma); return ( (x<=0.) ? 0. : exp(-z/2 - LOGNORMCONSTANT) * (1-z) ); } /* end of _unur_dpdf_rayleigh() */ /*---------------------------------------------------------------------------*/ double _unur_cdf_rayleigh( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; return ( (x<=0.) ? 0. : 1. - exp(-x*x/(2.*sigma*sigma)) ); } /* end of _unur_cdf_rayleigh() */ /*---------------------------------------------------------------------------*/ int _unur_upd_mode_rayleigh( UNUR_DISTR *distr ) { DISTR.mode = DISTR.sigma; /* mode must be in domain */ if (DISTR.mode < DISTR.domain[0]) DISTR.mode = DISTR.domain[0]; else if (DISTR.mode > DISTR.domain[1]) DISTR.mode = DISTR.domain[1]; return UNUR_SUCCESS; } /* end of _unur_upd_mode_rayleigh() */ /*---------------------------------------------------------------------------*/ int _unur_upd_area_rayleigh( UNUR_DISTR *distr ) { /* log of normalization constant */ LOGNORMCONSTANT = 2. * log(DISTR.sigma); if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.area = 1.; return UNUR_SUCCESS; } /* else */ DISTR.area = ( _unur_cdf_rayleigh( DISTR.domain[1],distr) - _unur_cdf_rayleigh( DISTR.domain[0],distr) ); return UNUR_SUCCESS; } /* end of _unur_upd_area_rayleigh() */ /*---------------------------------------------------------------------------*/ int _unur_set_params_rayleigh( UNUR_DISTR *distr, const double *params, int n_params ) { /* check number of parameters for distribution */ if (n_params < 1) { _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } if (n_params > 1) { _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); n_params = 1; } CHECK_NULL(params,UNUR_ERR_NULL); /* check parameter sigma */ if (sigma <= 0.) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"sigma <= 0."); return UNUR_ERR_DISTR_DOMAIN; } /* copy parameters for standard form */ DISTR.sigma = sigma; /* default parameters: none */ /* copy optional parameters: none */ /* store number of parameters */ DISTR.n_params = n_params; /* set (standard) domain */ if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.domain[0] = 0.; /* left boundary */ DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ } return UNUR_SUCCESS; } /* end of _unur_set_params_rayleigh() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_rayleigh( const double *params, int n_params ) { register struct unur_distr *distr; /* get new (empty) distribution object */ distr = unur_distr_cont_new(); /* set distribution id */ distr->id = UNUR_DISTR_RAYLEIGH; /* name of distribution */ distr->name = distr_name; /* how to get special generators */ DISTR.init = NULL; /* _unur_stdgen_rayleigh_init; */ /* functions */ DISTR.pdf = _unur_pdf_rayleigh; /* pointer to PDF */ DISTR.dpdf = _unur_dpdf_rayleigh; /* pointer to derivative of PDF */ DISTR.cdf = _unur_cdf_rayleigh; /* pointer to CDF */ /* indicate which parameters are set */ distr->set = ( UNUR_DISTR_SET_DOMAIN | UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_MODE | UNUR_DISTR_SET_PDFAREA ); /* set parameters for distribution */ if (_unur_set_params_rayleigh(distr,params,n_params)!=UNUR_SUCCESS) { free(distr); return NULL; } /* log of normalization constant */ LOGNORMCONSTANT = 2. * log(DISTR.sigma); /* mode and area below p.d.f. */ DISTR.mode = DISTR.sigma; DISTR.area = 1.; /* function for setting parameters and updating domain */ DISTR.set_params = _unur_set_params_rayleigh; /* function for updating derived parameters */ DISTR.upd_mode = _unur_upd_mode_rayleigh; /* funct for computing mode */ DISTR.upd_area = _unur_upd_area_rayleigh; /* funct for computing area */ /* return pointer to object */ return distr; } /* end of unur_distr_rayleigh() */ /*---------------------------------------------------------------------------*/ #undef sigma #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/d_geometric.c0000644001357500135600000002226614420445767016200 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: d_geometric.c * * * * REFERENCES: * * * * [1] N.L. Johnson, S. Kotz and A.W. Kemp * * Univariate Discrete Distributions, * * 2nd edition * * John Wiley & Sons, Inc., New York, 1992 * * * ***************************************************************************** * * * distr: Geometric distribution [1; ch.5.2, p.201] * * * * pmf: p(k) = p * (1-p)^k * * domain: 0 <= k < infinity * * constant: 1 * * * * parameters: * * 0: 0 < p < 1 ... shape * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "unur_distributions.h" #include "unur_distributions_source.h" #include "unur_stddistr.h" /*---------------------------------------------------------------------------*/ static const char distr_name[] = "geometric"; /* parameters */ #define p params[0] #define DISTR distr->data.discr /* #define NORMCONSTANT (distr->data.discr.norm_constant) */ /*---------------------------------------------------------------------------*/ /* function prototypes */ static double _unur_pmf_geometric( int k, const UNUR_DISTR *distr ); static double _unur_cdf_geometric( int k, const UNUR_DISTR *distr ); static int _unur_invcdf_geometric( double u, const UNUR_DISTR *distr ); static int _unur_upd_mode_geometric( UNUR_DISTR *distr ); static int _unur_upd_sum_geometric( UNUR_DISTR *distr ); static int _unur_set_params_geometric( UNUR_DISTR *distr, const double *params, int n_params ); /*---------------------------------------------------------------------------*/ double _unur_pmf_geometric(int k, const UNUR_DISTR *distr) { return ((k<0) ? 0. : DISTR.p * pow( 1. - DISTR.p, (double)k )); } /* end of _unur_pmf_geometric() */ /*---------------------------------------------------------------------------*/ double _unur_cdf_geometric(int k, const UNUR_DISTR *distr) { return ((k<0) ? 0. : (1. - pow(1. - DISTR.p, k+1.)) ); } /* end of _unur_cdf_geometric() */ /*---------------------------------------------------------------------------*/ int _unur_invcdf_geometric(double u, const UNUR_DISTR *distr) { double x; if (_unur_isone(DISTR.p)) return 0; /* else */ x = ceil(log1p(-u) / log1p(-DISTR.p) - 1.); return ((x>=INT_MAX) ? INT_MAX : ((int) x)); } /* end of _unur_invcdf_geometric() */ /*---------------------------------------------------------------------------*/ int _unur_upd_mode_geometric( UNUR_DISTR *distr ) { DISTR.mode = 0; /* mode must be in domain */ if (DISTR.mode < DISTR.domain[0] || DISTR.mode > DISTR.domain[1]) DISTR.mode = (DISTR.domain[0]<0) ? 0 : DISTR.domain[0]; /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_upd_mode_geometric() */ /*---------------------------------------------------------------------------*/ int _unur_upd_sum_geometric( UNUR_DISTR *distr ) { /* normalization constant: none */ if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.sum = 1.; return UNUR_SUCCESS; } /* else */ DISTR.sum = ( _unur_cdf_geometric( DISTR.domain[1],distr) - _unur_cdf_geometric( DISTR.domain[0]-1,distr) ); return UNUR_SUCCESS; } /* end of _unur_upd_sum_geometric() */ /*---------------------------------------------------------------------------*/ int _unur_set_params_geometric( UNUR_DISTR *distr, const double *params, int n_params ) { /* check number of parameters for distribution */ if (n_params < 1) { _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } if (n_params > 1) { _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); n_params = 1; } CHECK_NULL(params,UNUR_ERR_NULL); /* check parameter p */ if (p <= 0. || p >= 1.) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"p <= 0 || p >= 1"); return UNUR_ERR_DISTR_DOMAIN; } /* copy parameters for standard form */ DISTR.p = p; /* default parameters: none */ /* copy optional parameters: none */ /* store number of parameters */ DISTR.n_params = n_params; /* set (standard) domain: [0,inifinity] */ if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.domain[0] = 0; /* left boundary */ DISTR.domain[1] = INT_MAX; /* right boundary */ } return UNUR_SUCCESS; } /* end of _unur_set_params_geometric() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_geometric( const double *params, int n_params ) { register struct unur_distr *distr; /* get new (empty) distribution object */ distr = unur_distr_discr_new(); /* set distribution id */ distr->id = UNUR_DISTR_GEOMETRIC; /* name of distribution */ distr->name = distr_name; /* how to get special generators */ /* DISTR.init = _unur_stdgen_geometric_init; */ /* functions */ DISTR.pmf = _unur_pmf_geometric; /* pointer to PMF */ DISTR.cdf = _unur_cdf_geometric; /* pointer to CDF */ DISTR.invcdf = _unur_invcdf_geometric; /* pointer to invsere of CDF */ /* indicate which parameters are set */ distr->set = ( UNUR_DISTR_SET_DOMAIN | UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_MODE | UNUR_DISTR_SET_PMFSUM ); /* set parameters for distribution */ if (_unur_set_params_geometric(distr,params,n_params)!=UNUR_SUCCESS) { free(distr); return NULL; } /* log of normalization constant: none */ /* mode and sum over PMF */ DISTR.mode = 0; DISTR.sum = 1.; /* function for setting parameters and updating domain */ DISTR.set_params = _unur_set_params_geometric; /* function for updating derived parameters */ DISTR.upd_mode = _unur_upd_mode_geometric; /* funct for computing mode */ DISTR.upd_sum = _unur_upd_sum_geometric; /* funct for computing sum */ /* return pointer to object */ return distr; } /* end of unur_distr_geometric() */ /*---------------------------------------------------------------------------*/ #undef p #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/c_meixner.c0000644001357500135600000002355314420445767015670 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: c_meixner.c * * * * REFERENCES: * * * ***************************************************************************** * * * distr: Meixner distribution * * * * pdf: f(x) = exp(beta*(x-mu)/alpha) * |Gamma(delta+ i*(x-mu)/alpha)|^2 * * * * domain: infinity < x < infinity * * * * constant: (2*cos(beta/2))^(2*delta) / (2*alpha*pi*Gamma(2*delta)) * * * * parameters: 4 * * 0 : alpha > 0 ... scale * * 1 : beta ... shape (asymmetry) in [-pi,pi] * * 2 : delta >0 ... shape * * 3 : mu ... location * * * ***************************************************************************** * * * Copyright (c) 2011-2012 Wolfgang Hoermann and Josef Leydold * * Institute for Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "unur_distributions.h" #include "unur_distributions_source.h" #include "unur_stddistr.h" /*---------------------------------------------------------------------------*/ static const char distr_name[] = "meixner"; /* parameters */ #define alpha params[0] /* scale */ #define beta params[1] /* shape (asymmetry) */ #define delta params[2] /* shape */ #define mu params[3] /* location */ #define DISTR distr->data.cont #define LOGNORMCONSTANT (distr->data.cont.norm_constant) /* function prototypes */ static double _unur_pdf_meixner( double x, const UNUR_DISTR *distr ); static double _unur_logpdf_meixner( double x, const UNUR_DISTR *distr ); /* static double _unur_dpdf_meixner( double x, const UNUR_DISTR *distr ); */ /* static double _unur_cdf_meixner( double x, const UNUR_DISTR *distr ); */ static int _unur_upd_center_meixner( UNUR_DISTR *distr ); static double _unur_lognormconstant_meixner( const double *params, int n_params ); static int _unur_set_params_meixner( UNUR_DISTR *distr, const double *params, int n_params ); /*---------------------------------------------------------------------------*/ double _unur_pdf_meixner(double x, const UNUR_DISTR *distr) { /* Original implementation by Kemal Dingic */ /* f(x) = exp(beta*(x-mu)/alpha) * |Gamma(delta+ i*(x-mu)/alpha)|^2 */ return exp(_unur_logpdf_meixner(x,distr)); } /* end of _unur_pdf_meixner() */ /*---------------------------------------------------------------------------*/ double _unur_logpdf_meixner(double x, const UNUR_DISTR *distr) { const double *params = DISTR.params; double res; /* result of computation */ double y; /* auxiliary variables */ y = (x-mu) / alpha; res = LOGNORMCONSTANT + beta*y + 2*_unur_SF_Relcgamma(delta, y); return res; } /* end of _unur_logpdf_meixner() */ /*---------------------------------------------------------------------------*/ int _unur_upd_center_meixner( UNUR_DISTR *distr ) { const double *params = DISTR.params; /* we simply use parameter 'mu' */ DISTR.center = mu; /* an alternative approach would be the mean of the distribution: */ /* DISTR.center = mu + alpha*delta*tan(beta/2); */ /* center must be in domain */ if (DISTR.center < DISTR.domain[0]) DISTR.center = DISTR.domain[0]; else if (DISTR.center > DISTR.domain[1]) DISTR.center = DISTR.domain[1]; return UNUR_SUCCESS; } /* end of _unur_upd_center_meixner() */ /*---------------------------------------------------------------------------*/ double _unur_lognormconstant_meixner(const double *params, int n_params ATTRIBUTE__UNUSED) { /* (2*cos(beta/2))^(2*delta) / (2*alpha*pi*Gamma(2*delta)) */ return ( 2.*delta*log(2.*cos(beta/2.)) - (log(2.*alpha*M_PI) + _unur_SF_ln_gamma(2.*delta))); } /* end of _unur_normconstant_meixner() */ /*---------------------------------------------------------------------------*/ int _unur_set_params_meixner( UNUR_DISTR *distr, const double *params, int n_params ) { /* check number of parameters for distribution */ if (n_params < 4) { _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } if (n_params > 4) { _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); n_params = 4; } CHECK_NULL(params,UNUR_ERR_NULL); /* check parameter omega */ if (alpha <= 0. || delta <= 0.) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"alpha or delta <= 0"); return UNUR_ERR_DISTR_DOMAIN; } if (fabs(beta) >= M_PI) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"beta not in (-PI,PI)"); return UNUR_ERR_DISTR_DOMAIN; } /* copy parameters for standard form */ DISTR.alpha = alpha; DISTR.beta = beta; DISTR.delta = delta; DISTR.mu = mu; /* default parameters: none */ /* store number of parameters */ DISTR.n_params = n_params; /* set (standard) domain */ if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.domain[0] = -UNUR_INFINITY; /* left boundary */ DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ } return UNUR_SUCCESS; } /* end of _unur_set_params_meixner() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_meixner( const double *params, int n_params) { register struct unur_distr *distr; /* get new (empty) distribution object */ distr = unur_distr_cont_new(); /* set distribution id */ distr->id = UNUR_DISTR_MEIXNER; /* name of distribution */ distr->name = distr_name; /* how to get special generators */ /* DISTR.init = _unur_stdgen_meixner_init; */ /* functions */ DISTR.pdf = _unur_pdf_meixner; /* pointer to PDF */ DISTR.logpdf = _unur_logpdf_meixner; /* pointer to logPDF */ /* indicate which parameters are set */ distr->set = ( UNUR_DISTR_SET_DOMAIN | UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_CENTER | UNUR_DISTR_SET_PDFAREA ); /* set parameters for distribution */ if (_unur_set_params_meixner(distr,params,n_params)!=UNUR_SUCCESS) { free(distr); return NULL; } /* normalization constant */ LOGNORMCONSTANT = _unur_lognormconstant_meixner(DISTR.params,DISTR.n_params); /* we need the center of the distribution */ if (_unur_upd_center_meixner(distr)!=UNUR_SUCCESS) { free(distr); return NULL; } /* mode and area below p.d.f. */ /* DISTR.mode = ? */ DISTR.area = 1; /* function for setting parameters and updating domain */ DISTR.set_params = _unur_set_params_meixner; /* function for updating derived parameters */ /* DISTR.upd_mode = _unur_upd_mode_meixner; /\* funct for computing mode *\/ */ /* DISTR.upd_area = _unur_upd_area_meixner; /\* funct for computing area *\/ */ /* return pointer to object */ return distr; } /* end of unur_distr_meixner() */ /*---------------------------------------------------------------------------*/ #undef alpha #undef beta #undef delta #undef mu #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/c_chisquare.c0000644001357500135600000002462514420445767016206 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: c_chisquare.c * * * * REFERENCES: * * * * [2] N.L. Johnson, S. Kotz and N. Balakrishnan * * Continuous Univariate Distributions, * * Volume 1, 2nd edition * * John Wiley & Sons, Inc., New York, 1994 * * * ***************************************************************************** * * * distr: Chisquare distribution [2; ch.18, p.416] * * * * pdf: f(x) = x^((nu/2)-1) * exp( -x/2 ) * * domain: 0 <= x < infinity * * constant: 1 / (2^(nu/2) * Gamma(nu/2)) * * * * parameters: * * 0: nu > 0 ... shape (degrees of freedom) * * * ***************************************************************************** * * * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "unur_distributions.h" #include "unur_distributions_source.h" #include "unur_stddistr.h" /*---------------------------------------------------------------------------*/ static const char distr_name[] = "chisquare"; /*---------------------------------------------------------------------------*/ /* parameters */ #define nu params[0] /*---------------------------------------------------------------------------*/ #define DISTR distr->data.cont #define LOGNORMCONSTANT (distr->data.cont.norm_constant) /*---------------------------------------------------------------------------*/ /* function prototypes */ static double _unur_pdf_chisquare( double x, const UNUR_DISTR *distr ); static double _unur_dpdf_chisquare( double x, const UNUR_DISTR *distr ); static double _unur_cdf_chisquare( double x, const UNUR_DISTR *distr ); #ifdef _unur_SF_invcdf_gamma static double _unur_invcdf_chisquare( double x, const UNUR_DISTR *distr ); #endif static int _unur_upd_mode_chisquare( UNUR_DISTR *distr ); static int _unur_upd_area_chisquare( UNUR_DISTR *distr ); static int _unur_set_params_chisquare( UNUR_DISTR *distr, const double *params, int n_params ); /*---------------------------------------------------------------------------*/ double _unur_pdf_chisquare(double x, const UNUR_DISTR *distr) { register const double *params = DISTR.params; if (x <= 0.) /* out of support */ return 0.; if (_unur_isfsame(nu,2.)) return exp(-x/2. - LOGNORMCONSTANT); return exp( log(x) * (nu/2. - 1.) - x/2. - LOGNORMCONSTANT ); } /* end of _unur_pdf_chisquare() */ /*---------------------------------------------------------------------------*/ double _unur_dpdf_chisquare(double x, const UNUR_DISTR *distr) { register const double *params = DISTR.params; if (x <= 0.) /* out of support */ return 0.; if (_unur_isfsame(nu,2.)) return ( -exp(-x/2. - LOGNORMCONSTANT) / 2. ); return ( exp( log(x) * (nu/2. - 2.) - x/2. - LOGNORMCONSTANT) * (nu - 2. - x)/2. ); } /* end of _unur_dpdf_chisquare() */ /*---------------------------------------------------------------------------*/ double _unur_cdf_chisquare(double x, const UNUR_DISTR *distr) { register const double *params = DISTR.params; if (x <= 0.) /* out of support of p.d.f. */ return 0.; return _unur_SF_incomplete_gamma(x/2.,nu/2.); } /* end of _unur_cdf_chisquare() */ /*---------------------------------------------------------------------------*/ #ifdef _unur_SF_invcdf_gamma double _unur_invcdf_chisquare( double x, const UNUR_DISTR *distr ) { const double *params = DISTR.params; return _unur_SF_invcdf_gamma(x, 0.5*nu, 2.); } /* end of _unur_invcdf_chisquare() */ #endif /*---------------------------------------------------------------------------*/ int _unur_upd_mode_chisquare( UNUR_DISTR *distr ) { DISTR.mode = (DISTR.nu >= 2.) ? (DISTR.nu - 2.) : 0.; /* mode must be in domain */ if (DISTR.mode < DISTR.domain[0]) DISTR.mode = DISTR.domain[0]; else if (DISTR.mode > DISTR.domain[1]) DISTR.mode = DISTR.domain[1]; return UNUR_SUCCESS; } /* end of _unur_upd_mode_chisquare() */ /*---------------------------------------------------------------------------*/ int _unur_upd_area_chisquare( UNUR_DISTR *distr ) { /* normalization constant */ LOGNORMCONSTANT = _unur_SF_ln_gamma(DISTR.nu/2.) + M_LN2 * (DISTR.nu/2.); if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.area = 1.; return UNUR_SUCCESS; } /* else */ DISTR.area = ( _unur_cdf_chisquare( DISTR.domain[1],distr) - _unur_cdf_chisquare( DISTR.domain[0],distr) ); return UNUR_SUCCESS; } /* end of _unur_upd_area_chisquare() */ /*---------------------------------------------------------------------------*/ int _unur_set_params_chisquare( UNUR_DISTR *distr, const double *params, int n_params ) { /* check number of parameters for distribution */ if (n_params < 1) { _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } if (n_params > 1) { _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); n_params = 1; } CHECK_NULL(params,UNUR_ERR_NULL); /* check parameter nu */ if (nu <= 0.) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"nu <= 0"); return UNUR_ERR_DISTR_DOMAIN; } /* copy parameters for standard form */ DISTR.nu = nu; /* copy optional parameters: none */ /* store number of parameters */ DISTR.n_params = n_params; /* set (standard) domain */ if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.domain[0] = 0.; /* left boundary */ DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ } return UNUR_SUCCESS; } /* end of _unur_set_params_chisquare() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_chisquare( const double *params, int n_params ) { register struct unur_distr *distr; /* get new (empty) distribution object */ distr = unur_distr_cont_new(); /* set distribution id */ distr->id = UNUR_DISTR_CHISQUARE; /* name of distribution */ distr->name = distr_name; /* how to get special generators */ DISTR.init = NULL; /* functions */ DISTR.pdf = _unur_pdf_chisquare; /* pointer to PDF */ DISTR.dpdf = _unur_dpdf_chisquare; /* pointer to derivative of PDF */ DISTR.cdf = _unur_cdf_chisquare; /* pointer to CDF */ #ifdef _unur_SF_invcdf_gamma DISTR.invcdf = _unur_invcdf_chisquare; /* pointer to inverse CDF */ #endif /* indicate which parameters are set */ distr->set = ( UNUR_DISTR_SET_DOMAIN | UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_PDFAREA | UNUR_DISTR_SET_MODE ); /* set parameters for distribution */ if (_unur_set_params_chisquare(distr,params,n_params)!=UNUR_SUCCESS) { free(distr); return NULL; } /* log of normalization constant */ LOGNORMCONSTANT = _unur_SF_ln_gamma(DISTR.nu/2.) + M_LN2 * (DISTR.nu/2.); /* mode and area below p.d.f. */ DISTR.mode = (DISTR.nu >= 2.) ? (DISTR.nu - 2.) : 0.; DISTR.area = 1.; /* function for setting parameters and updating domain */ DISTR.set_params = _unur_set_params_chisquare; /* function for updating derived parameters */ DISTR.upd_mode = _unur_upd_mode_chisquare; /* funct for computing mode */ DISTR.upd_area = _unur_upd_area_chisquare; /* funct for computing area */ /* return pointer to object */ return distr; } /* end of unur_distr_chisquare() */ /*---------------------------------------------------------------------------*/ #undef nu #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/m_correlation.c0000644001357500135600000001105114420445767016542 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: m_correlation.c * * * * Random correlation matrix * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include "unur_distributions.h" #include "unur_distributions_source.h" #include "unur_stddistr.h" /*---------------------------------------------------------------------------*/ static const char distr_name[] = "correlation"; /*---------------------------------------------------------------------------*/ /* parameters */ /*---------------------------------------------------------------------------*/ #define DISTR distr->data.matr /*---------------------------------------------------------------------------*/ /* function prototypes */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Make distribution object **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_correlation( int n ) { struct unur_distr *distr; /* get new (empty) distribution object */ distr = unur_distr_matr_new(n,n); /* check new parameter for generator */ if (distr == NULL) { /* error: n < 2 */ return NULL; } /* set distribution id */ distr->id = UNUR_DISTR_MCORRELATION; /* name of distribution */ distr->name = distr_name; /* how to get special generators */ DISTR.init = NULL; /* functions */ /* indicate which parameters are set (additional to mean and covariance) */ /* distr->set |= 0; */ /* return pointer to object */ return distr; } /* end of unur_distr_correlation() */ /*---------------------------------------------------------------------------*/ #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/c_vg.c0000644001357500135600000003174314420445767014635 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: c_vg.c * * * * REFERENCES: * * * ***************************************************************************** * * * distr: Variance gamma distribution * * * * pdf: f(x) = |x-mu|^(lambda-1/2) * exp(beta*(x-mu)) * * * K_{lambda-1/2}(alpha*|x-mu|)} * * * * domain: infinity < x < infinity * * * * constant: (alpha^2 - beta^2)^lambda * * / (sqrt(pi) * (2*alpha)^(lambda-1/2) * Gamma(lambda)) * * * * [K_theta(.) ... modified Bessel function of second kind] * * * * parameters: 4 * * 0 : lambda > 0 ... shape * * 1 : alpha >|beta| ... shape * * 2 : beta ... shape (asymmetry) * * 3 : mu ... location * * * ***************************************************************************** * * * We use the Rmath library for computing the Bessel function K_n. * * * ***************************************************************************** * * * Copyright (c) 2011-2012 Wolfgang Hoermann and Josef Leydold * * Institute for Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "unur_distributions.h" #include "unur_distributions_source.h" #include "unur_stddistr.h" /*---------------------------------------------------------------------------*/ static const char distr_name[] = "vg"; /* parameters */ #define lambda params[0] /* shape */ #define alpha params[1] /* shape */ #define beta params[2] /* shape (asymmetry) */ #define mu params[3] /* location */ #define DISTR distr->data.cont #define LOGNORMCONSTANT (distr->data.cont.norm_constant) /* function prototypes */ #ifdef _unur_SF_bessel_k static double _unur_pdf_vg( double x, const UNUR_DISTR *distr ); static double _unur_logpdf_vg( double x, const UNUR_DISTR *distr ); /* static double _unur_dpdf_vg( double x, const UNUR_DISTR *distr ); */ /* static double _unur_cdf_vg( double x, const UNUR_DISTR *distr ); */ #endif static int _unur_upd_center_vg( UNUR_DISTR *distr ); static double _unur_lognormconstant_vg( const double *params, int n_params ); static int _unur_set_params_vg( UNUR_DISTR *distr, const double *params, int n_params ); /*---------------------------------------------------------------------------*/ #ifdef _unur_SF_bessel_k double _unur_pdf_vg(double x, const UNUR_DISTR *distr) { /* Original implementation by Kemal Dingic */ /* f(x) = |x-mu|^(lambda-1/2) * exp(beta*(x-mu)) * K_{lambda-1/2}(alpha*|x-mu|)} */ return exp(_unur_logpdf_vg(x,distr)); } /* end of _unur_pdf_vg() */ /*---------------------------------------------------------------------------*/ double _unur_logpdf_vg(double x, const UNUR_DISTR *distr) { /* Original implementation by Kemal Dingic */ /* f(x) = |x-mu|^(lambda-1/2) * exp(beta*(x-mu)) * K_{lambda-1/2}(alpha*|x-mu|) */ const double *params = DISTR.params; double nu = lambda - 0.5; /* order of modified Bessel function K() */ double res; /* result of computation */ double y, absy; /* auxiliary variables */ y = x - mu; absy = fabs(y); /* Using nu and y we find: * f(x) = |y|^nu * exp(beta*y) * K_nu(alpha*|y|) * and * log(f(x)) = nu*log(|y|)+ beta*y + log(K_nu(alpha*|y|) */ do { if (absy>0) { /* first simply compute Bessel K_nu and compute logarithm. */ double besk; /* we currently use two algorithms based on our experiences * with the functions in the Rmath library. * (Maybe we could change this when we link against * other libraries.) */ if (nu < 100) /* the "standard implementation" using log(bessel_k) */ besk = _unur_SF_ln_bessel_k(alpha*absy, nu); else /* an algorithm for large nu */ besk = _unur_SF_bessel_k_nuasympt(alpha*absy, nu, TRUE, FALSE); /* there can be numerical problems with the Bessel function K_nu. */ if (_unur_isfinite(besk) && besk < MAXLOG - 20.0) { /* o.k. */ res = LOGNORMCONSTANT + besk + log(absy)*nu + beta*y; break; } } /* Case: numerical problems with Bessel function K_nu. */ if (absy < 1.0) { /* Case: Bessel function K_nu overflows for small values of y. * The following code is inspired by gsl_sf_bessel_lnKnu_e() from * the GSL (GNU Scientific Library). */ res = LOGNORMCONSTANT + beta*y; res += -M_LN2 + _unur_SF_ln_gamma(nu) + nu*log(2./alpha); if (nu > 1.0) { double xi = 0.25*(alpha*absy)*(alpha*absy); double sum = 1.0 - xi/(nu-1.0); if(nu > 2.0) sum += (xi/(nu-1.0)) * (xi/(nu-2.0)); res += log(sum); } } else { /* Case: Bessel function K_nu underflows for very large values of y * and we get NaN. * However, then the PDF of the Variance Gamma distribution is 0. */ res = -UNUR_INFINITY; } } while(0); /* Remark: a few references NIST Digital Library of Mathematical Functions http://dlmf.nist.gov/10.27.E3 K_{-nu}(z) = K_nu(z) http://dlmf.nist.gov/10.32.E10 K_nu(z) = 0.5*(0.5*z)^nu * \int_0^\infty exp(-t-z^2/(4*t)) * t^(-nu-1) dt This implies K_nu(z) = K_{-nu}(z) = 0.5*(0.5*z)^(-nu) * \int_0^\infty exp(-t-z^2/(4*t)) * t^(nu-1) dt <= 0.5*(0.5*z)^(-nu) * \int_0^\infty exp(-t) * t^(nu-1) dt = 0.5*(0.5*z)^(-nu) * Gamma(z) http://dlmf.nist.gov/10.30.E2 K_nu(z) ~ 0.5*Gamma(nu)*(0.5*z)^(-nu) for z->0 */ return res; } /* end of _unur_logpdf_vg() */ #endif /*---------------------------------------------------------------------------*/ int _unur_upd_center_vg( UNUR_DISTR *distr ) { const double *params = DISTR.params; /* we use the mean of the distribution: */ double gam = sqrt(alpha*alpha-beta*beta); DISTR.center = mu + 2*beta*lambda / (gam*gam); /* there is some change of overflow. then we simply use 'mu' */ if (!_unur_isfinite(DISTR.center)) DISTR.center = mu; /* center must be in domain */ if (DISTR.center < DISTR.domain[0]) DISTR.center = DISTR.domain[0]; else if (DISTR.center > DISTR.domain[1]) DISTR.center = DISTR.domain[1]; return UNUR_SUCCESS; } /* end of _unur_upd_center_vg() */ /*---------------------------------------------------------------------------*/ double _unur_lognormconstant_vg(const double *params, int n_params ATTRIBUTE__UNUSED) { /* (alpha^2 - beta^2)^lambda / (sqrt(pi) * (2*alpha)^(lambda-1/2) * Gamma(lambda)) */ return (lambda*log(alpha*alpha - beta*beta) - 0.5*M_LNPI - (lambda-0.5)*log(2*alpha) - _unur_SF_ln_gamma(lambda)); } /* end of _unur_normconstant_vg() */ /*---------------------------------------------------------------------------*/ int _unur_set_params_vg( UNUR_DISTR *distr, const double *params, int n_params ) { /* check number of parameters for distribution */ if (n_params < 4) { _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } if (n_params > 4) { _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); n_params = 4; } CHECK_NULL(params,UNUR_ERR_NULL); /* check parameter omega */ if (lambda <= 0.) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"lambda <= 0"); return UNUR_ERR_DISTR_DOMAIN; } if (alpha <= fabs(beta)) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"alpha <= |beta|"); return UNUR_ERR_DISTR_DOMAIN; } /* copy parameters for standard form */ DISTR.lambda = lambda; DISTR.alpha = alpha; DISTR.beta = beta; DISTR.mu = mu; /* default parameters: none */ /* store number of parameters */ DISTR.n_params = n_params; /* set (standard) domain */ if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.domain[0] = -UNUR_INFINITY; /* left boundary */ DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ } return UNUR_SUCCESS; } /* end of _unur_set_params_vg() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_vg( const double *params, int n_params) { register struct unur_distr *distr; /* get new (empty) distribution object */ distr = unur_distr_cont_new(); /* set distribution id */ distr->id = UNUR_DISTR_VG; /* name of distribution */ distr->name = distr_name; /* how to get special generators */ /* DISTR.init = _unur_stdgen_vg_init; */ /* functions */ #ifdef _unur_SF_bessel_k DISTR.pdf = _unur_pdf_vg; /* pointer to PDF */ DISTR.logpdf = _unur_logpdf_vg; /* pointer to log-PDF */ #endif /* indicate which parameters are set */ distr->set = ( UNUR_DISTR_SET_DOMAIN | UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_CENTER | UNUR_DISTR_SET_PDFAREA ); /* set parameters for distribution */ if (_unur_set_params_vg(distr,params,n_params)!=UNUR_SUCCESS) { free(distr); return NULL; } /* normalization constant */ LOGNORMCONSTANT = _unur_lognormconstant_vg(DISTR.params,DISTR.n_params); /* we need the center of the distribution */ if (_unur_upd_center_vg(distr)!=UNUR_SUCCESS) { free(distr); return NULL; } /* mode and area below p.d.f. */ /* DISTR.mode = ? */ DISTR.area = 1; /* function for setting parameters and updating domain */ DISTR.set_params = _unur_set_params_vg; /* function for updating derived parameters */ /* DISTR.upd_mode = _unur_upd_mode_vg; /\* funct for computing mode *\/ */ /* DISTR.upd_area = _unur_upd_area_vg; /\* funct for computing area *\/ */ /* return pointer to object */ return distr; } /* end of unur_distr_vg() */ /*---------------------------------------------------------------------------*/ #undef mu #undef alpha #undef beta #undef lambda #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/c_lomax.c0000644001357500135600000002365014420445767015337 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: c_lomax.c * * * * REFERENCES: * * * * [2] N.L. Johnson, S. Kotz and N. Balakrishnan * * Continuous Univariate Distributions, * * Volume 1, 2nd edition * * John Wiley & Sons, Inc., New York, 1994 * * * ***************************************************************************** * * * distr: Lomax distribution (Pareto distr. of second kind) [2; ch.20, p.575]* * * * pdf: f(x) = (x+C)^(-(a+1)) * * domain: x >= 0 * * constant: a * C^a * * * * parameters: * * 0: a > 0 ... shape * * 1: C > 0 ... location * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "unur_distributions.h" #include "unur_distributions_source.h" #include "unur_stddistr.h" /*---------------------------------------------------------------------------*/ static const char distr_name[] = "lomax"; /* parameters */ #define a params[0] #define C params[1] #define DISTR distr->data.cont #define NORMCONSTANT (distr->data.cont.norm_constant) /* function prototypes */ static double _unur_pdf_lomax( double x, const UNUR_DISTR *distr ); static double _unur_dpdf_lomax( double x, const UNUR_DISTR *distr ); static double _unur_cdf_lomax( double x, const UNUR_DISTR *distr ); static double _unur_invcdf_lomax( double u, const UNUR_DISTR *distr ); static int _unur_upd_mode_lomax( UNUR_DISTR *distr ); static int _unur_upd_area_lomax( UNUR_DISTR *distr ); static int _unur_set_params_lomax( UNUR_DISTR *distr, const double *params, int n_params ); /*---------------------------------------------------------------------------*/ double _unur_pdf_lomax( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; if (x<0.) return 0.; /* else */ return ( pow(x+C,-(a+1.)) * NORMCONSTANT ); /* return ( (x<0.) ? 0. : pow(x+C,-(a+1.)) * NORMCONSTANT ); */ } /* end of _unur_pdf_lomax() */ /*---------------------------------------------------------------------------*/ double _unur_dpdf_lomax( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; return ( (x<0.) ? 0. : -(a+1.) * pow(x+C,-(a+2.)) * NORMCONSTANT ); } /* end of _unur_dpdf_lomax() */ /*---------------------------------------------------------------------------*/ double _unur_cdf_lomax( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; return ( (x<0.) ? 0. : 1. - pow((C/(x+C)),a) ); } /* end of _unur_cdf_lomax() */ /*---------------------------------------------------------------------------*/ double _unur_invcdf_lomax( double U, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; double X; X = C * ( pow(1-U, -1/a) - 1. ); return X; } /* end of _unur_invcdf_lomax() */ /*---------------------------------------------------------------------------*/ int _unur_upd_mode_lomax( UNUR_DISTR *distr ) { DISTR.mode = 0.; /* mode must be in domain */ if (DISTR.mode < DISTR.domain[0]) DISTR.mode = DISTR.domain[0]; else if (DISTR.mode > DISTR.domain[1]) DISTR.mode = DISTR.domain[1]; return UNUR_SUCCESS; } /* end of _unur_upd_mode_lomax() */ /*---------------------------------------------------------------------------*/ int _unur_upd_area_lomax( UNUR_DISTR *distr ) { /* normalization constant */ NORMCONSTANT = DISTR.a * pow(DISTR.C,DISTR.a); if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.area = 1.; return UNUR_SUCCESS; } /* else */ DISTR.area = ( _unur_cdf_lomax( DISTR.domain[1],distr) - _unur_cdf_lomax( DISTR.domain[0],distr) ); return UNUR_SUCCESS; } /* end of _unur_upd_area_lomax() */ /*---------------------------------------------------------------------------*/ int _unur_set_params_lomax( UNUR_DISTR *distr, const double *params, int n_params ) { /* check number of parameters for distribution */ if (n_params < 1) { _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } if (n_params > 2) { _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); n_params = 2; } CHECK_NULL(params,UNUR_ERR_NULL); /* check parameter a */ if (a <= 0.) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"a <= 0"); return UNUR_ERR_DISTR_DOMAIN; } /* check parameter C */ if (n_params > 1 && C <= 0.) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"C <= 0"); return UNUR_ERR_DISTR_DOMAIN; } /* copy parameters for standard form */ DISTR.a = a; /* default parameters */ DISTR.C = 1.; /* copy optional parameters */ if (n_params == 2) DISTR.C = C; /* store total number of parameters */ DISTR.n_params = 2; /* set (standard) domain */ if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.domain[0] = 0; /* left boundary */ DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ } return UNUR_SUCCESS; } /* end of _unur_set_params_lomax() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_lomax( const double *params, int n_params ) { register struct unur_distr *distr; /* get new (empty) distribution object */ distr = unur_distr_cont_new(); /* set distribution id */ distr->id = UNUR_DISTR_LOMAX; /* name of distribution */ distr->name = distr_name; /* how to get special generators */ /* DISTR.init = _unur_stdgen_lomax_init; */ /* functions */ DISTR.pdf = _unur_pdf_lomax; /* pointer to PDF */ DISTR.dpdf = _unur_dpdf_lomax; /* pointer to derivative of PDF */ DISTR.cdf = _unur_cdf_lomax; /* pointer to CDF */ DISTR.invcdf = _unur_invcdf_lomax; /* pointer to inverse CDF */ /* indicate which parameters are set */ distr->set = ( UNUR_DISTR_SET_DOMAIN | UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_MODE | UNUR_DISTR_SET_PDFAREA ); /* set parameters for distribution */ if (_unur_set_params_lomax(distr,params,n_params)!=UNUR_SUCCESS) { free(distr); return NULL; } /* normalization constant */ NORMCONSTANT = DISTR.a * pow(DISTR.C,DISTR.a); /* mode and area below p.d.f. */ DISTR.mode = 0.; DISTR.area = 1.; /* function for setting parameters and updating domain */ DISTR.set_params = _unur_set_params_lomax; /* function for updating derived parameters */ DISTR.upd_mode = _unur_upd_mode_lomax; /* funct for computing mode */ DISTR.upd_area = _unur_upd_area_lomax; /* funct for computing area */ /* return pointer to object */ return distr; } /* end of unur_distr_lomax() */ /*---------------------------------------------------------------------------*/ #undef a #undef C #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/c_normal_gen.c0000644001357500135600000006672014420445767016345 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: c_normal_gen.c * * * * Special generators for Normal distribution * * * ***************************************************************************** * * * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "unur_distributions_source.h" /*---------------------------------------------------------------------------*/ /* init routines for special generators */ inline static int normal_bm_init( struct unur_gen *gen ); inline static int normal_pol_init( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* abbreviations */ #define PAR ((struct unur_cstd_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_cstd_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.cont /* data for distribution in generator object */ #define uniform() _unur_call_urng(gen->urng) /* call for uniform prng */ /* #define MAX_gen_params 1 maximal number of parameters for generator */ #define mu (DISTR.params[0]) /* location */ #define sigma (DISTR.params[1]) /* scale */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Inititialize **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ int _unur_stdgen_normal_init( struct unur_par *par, struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* initialize special generator for normal distribution */ /* if gen == NULL then only check existance of variant. */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* one of par and gen must not be the NULL pointer */ switch ((par) ? par->variant : gen->variant) { case 1: /* Box-Muller method */ _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_normal_bm ); return normal_bm_init( gen ); case 2: /* Polarmethod with rejection */ _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_normal_pol ); return normal_pol_init( gen ); case 3: /* Kindermann-Ramage method */ _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_normal_kr ); return UNUR_SUCCESS; case 0: /* DEFAULT */ case 4: /* Acceptance-complement ratio */ _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_normal_acr ); return UNUR_SUCCESS; case 5: /* "Naive" ratio-of-uniforms */ _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_normal_nquo ); return UNUR_SUCCESS; case 6: /* Ratio-of-uniforms with squeeze */ _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_normal_quo ); return UNUR_SUCCESS; case 7: /* Ratio-of-uniforms with quadratic bounding curves */ _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_normal_leva ); return UNUR_SUCCESS; case 99: /* infamous sum-of-12-uniforms method. DO NOT USE */ _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_normal_sum ); return UNUR_SUCCESS; default: /* no such generator */ return UNUR_FAILURE; } } /* end of _unur_stdgen_normal_init() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Special generators **/ /** **/ /*****************************************************************************/ /***************************************************************************** * * * Normal Distribution: Sinus-Cosinus or Box/Muller Method * * * ***************************************************************************** * * * This method is based on the transformation * * x = sqrt(-2 ln(u)) cos(2pi*v), y = sqrt(-2 ln(u)) sin(2pi*v) * * which converts two independent (0,1)-Uniforms u and v to two * * independent standard Normal variates x and y. * * * * FUNCTION: - samples a random number from the * * standard Normal distribution N(0,1). * * * * REFERENCE: - G.E.P. Box, M.E. Muller (1958): * * A note on the generation of random normal deviates, * * Annals Math. Statist. 29, 610-611. * * * * Implemented by W. Hoermann, April 1992 * ***************************************************************************** * WinRand (c) 1995 Ernst Stadlober, Institut fuer Statistitk, TU Graz * *****************************************************************************/ #define GEN_N_PARAMS (1) #define Xstore GEN->gen_param[0] #define flag GEN->flag int normal_bm_init( struct unur_gen *gen ) { /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_ERR_COOKIE); if (GEN->gen_param == NULL || GEN->n_gen_param != GEN_N_PARAMS) { GEN->n_gen_param = GEN_N_PARAMS; GEN->gen_param = _unur_xrealloc(GEN->gen_param, GEN->n_gen_param * sizeof(double)); } /* -X- setup code -X- */ Xstore = 0.; flag = 1; /* -X- end of setup code -X- */ return UNUR_SUCCESS; } /* end of normal_bm_init() */ double _unur_stdgen_sample_normal_bm( struct unur_gen *gen ) { /* -X- generator code -X- */ double X; double u,v,s; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); do { flag = -flag; if (flag > 0) { X = Xstore; break; } u = uniform(); v = uniform(); s = sqrt(-2.0 * log(u)); Xstore = s * sin(2 * M_PI * v); X = s * cos(2 * M_PI * v); } while(0); /* -X- end of generator code -X- */ return ((DISTR.n_params==0) ? X : mu + sigma * X ); } /* end of _unur_stdgen_sample_normal_bm() */ #undef GEN_N_PARAMS #undef Xstore #undef flag /*---------------------------------------------------------------------------*/ /***************************************************************************** * * * Normal Distribution: Polarmethod with rejection * * * ***************************************************************************** * * * FUNCTION: - samples a random number from the standard * * Normal distribution N(0,1). * * * * REFERENCE: - G. Marsaglia (1962): Improving the Polar Method for * * Generating a Pair of Random Variables, * * Boeing Sci. Res. Lab., Seattle, Washington. * * * * Implemented by W. Hoermann, April 1992 * ***************************************************************************** * WinRand (c) 1995 Ernst Stadlober, Institut fuer Statistitk, TU Graz * *****************************************************************************/ #define GEN_N_PARAMS (1) #define Xstore GEN->gen_param[0] #define flag GEN->flag int normal_pol_init( struct unur_gen *gen ) { /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_ERR_COOKIE); if (GEN->gen_param == NULL || GEN->n_gen_param != GEN_N_PARAMS) { GEN->n_gen_param = GEN_N_PARAMS; GEN->gen_param = _unur_xrealloc(GEN->gen_param, GEN->n_gen_param * sizeof(double)); } /* -X- setup code -X- */ Xstore = 0.; flag = 1; /* -X- end of setup code -X- */ return UNUR_SUCCESS; } /* end of normal_pol_init() */ double _unur_stdgen_sample_normal_pol( struct unur_gen *gen ) { /* -X- generator code -X- */ double X; double s,x,y,tmp; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); do { flag = -flag; if (flag > 0) { X = Xstore; break; } while(1) { x = 2. * uniform() - 1.; y = 2. * uniform() - 1.; s = x*x + y*y; if( s < 1. ) { tmp = sqrt( -2. * log(s) / s ); Xstore = y * tmp; X = x * tmp; break; } } } while(0); /* -X- end of generator code -X- */ return ((DISTR.n_params==0) ? X : mu + sigma * X ); } /* end of _unur_stdgen_sample_normal_pol() */ #undef GEN_N_PARAMS #undef Xstore #undef flag /*---------------------------------------------------------------------------*/ /***************************************************************************** * * * Normal Distribution: "Naive" Ratio of uniforms * * * ***************************************************************************** * * * FUNCTION: - samples a random number from the * * standard Normal distribution N(0,1). * * * * REFERENCE: - A.J. Kindermann, F.J.Monahan (1977): Computing generation * * of random variables using the ratio of uniform deviates, * * ACM TOMS 3(3), 257-260 * * * ***************************************************************************** * UNURAN (c) 2000 W. Hoermann & J. Leydold, Institut f. Statistik, WU Wien * *****************************************************************************/ double _unur_stdgen_sample_normal_nquo( struct unur_gen *gen ) { /* -X- generator code -X- */ double X; double u,v; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); while (1) { u = uniform(); if (_unur_iszero(u)) u = 1.; v = (uniform() - 0.5) * 0.857763885 * 2; X = v/u; if (X*X <= -4. * log(u)) break; } /* -X- end of generator code -X- */ return ((DISTR.n_params==0) ? X : mu + sigma * X ); } /* end of _unur_stdgen_sample_normal_nquo() */ /*---------------------------------------------------------------------------*/ /***************************************************************************** * * * Normal Distribution: Ratio of uniforms with squeeze * * * ***************************************************************************** * * * FUNCTION: - samples a random number from the * * standard Normal distribution N(0,1). * * * * REFERENCE: - L. Barabesi (1993): Random variate generation * * by using the ratio-of-uniforms method, p. 133 * * * ***************************************************************************** * UNURAN (c) 2000 W. Hoermann & J. Leydold, Institut f. Statistik, WU Wien * *****************************************************************************/ double _unur_stdgen_sample_normal_quo( struct unur_gen *gen ) { /* -X- generator code -X- */ double X; double r,w; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); while (1) { r = uniform(); X = (2.101083837941101 * uniform() - 1.050541918970551) / sqrt(r); w = X * X; if (4. - 4.186837275258269 * r < w) { if (1.5/r - 0.920558458320164 < w) continue; if (-3.*log(r) < w ) continue; } break; } /* -X- end of generator code -X- */ return ((DISTR.n_params==0) ? X : mu + sigma * X ); } /* end of _unur_stdgen_sample_normal_quo() */ /*---------------------------------------------------------------------------*/ /***************************************************************************** * * * Normal Distribution: Ratio of uniforms with quadratic bounding curves * * * ***************************************************************************** * * * FUNCTION: - samples a random number from the * * standard Normal distribution N(0,1). * * * * REFERENCE: - J.L. Leva (1992): * * Algorithm 712; a normal random number generator, * * ACM TOMS 18(4), 454-455 * * * ***************************************************************************** * UNURAN (c) 2000 W. Hoermann & J. Leydold, Institut f. Statistik, WU Wien * *****************************************************************************/ double _unur_stdgen_sample_normal_leva( struct unur_gen *gen ) { /* -X- generator code -X- */ #define S 0.449871 #define T -0.386595 #define A 0.19600 #define B 0.25472 #define RA 0.27597 #define RB 0.27846 double X; double u,v,x,y,q; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); while (1) { u = uniform(); v = uniform(); v = 1.7156 * (v - 0.5); x = u - S; y = fabs(v) - T; q = x * x + y * (A * y - B * x); X = v/u; if( q < RA ) break; if( q > RB ) continue; if (v*v > -4.*log(u)*u*u) continue; break; } #undef S #undef T #undef A #undef B #undef RA #undef RB /* -X- end of generator code -X- */ return ((DISTR.n_params==0) ? X : mu + sigma * X ); } /* end of _unur_stdgen_sample_normal_leva() */ /*---------------------------------------------------------------------------*/ /***************************************************************************** * * * Normal Distribution: Kindermann-Ramage (patchwork) method * * * ***************************************************************************** * * * FUNCTION: - samples a random number from the * * standard Normal distribution N(0,1). * * * * REFERENCE: - Kinderman A.J., Ramage J.G. (1976): * * Computer Generation of Normal Random Variables, * * J. Am. Stat. Assoc. 71(356), 893 - 898. * * * * - Tirler G., Dalgaard P., Hoermann W., and Leydold J. (2004): * * An Error in the {Kinderman-Ramage} Method and How to Fix It,* * Comp. Stat. Data Anal. 47(3), 433 - 440. * * * * Remark: This is the fixed version of the algorithm. * * * ***************************************************************************** * UNURAN (c) 2000 W. Hoermann & J. Leydold, Institut f. Statistik, WU Wien * *****************************************************************************/ double _unur_stdgen_sample_normal_kr( struct unur_gen *gen ) { /* -X- generator code -X- */ #define XI 2.216035867166471 #define PIhochK 0.3989422804 double U, V, W, X; double t, z; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); U = uniform(); if (U < 0.884070402298758) { V = uniform(); X = XI * (1.131131635444180 * U + V - 1.); } else if (U >= 0.973310954173898) { do { V = uniform(); W = uniform(); if (_unur_iszero(W)) { t=0.; continue; } t = XI * XI/2. - log(W); } while ( (V*V*t) > (XI*XI/2.) ); X = (U < 0.986655477086949) ? pow(2*t,0.5) : -pow(2*t,0.5); } else if (U>=0.958720824790463) { do { V = uniform(); W = uniform(); z = V - W; t = XI - 0.630834801921960 * _unur_min(V,W); } while (_unur_max(V,W) > 0.755591531667601 && 0.034240503750111 * fabs(z) > (PIhochK * exp(t*t/(-2.)) - 0.180025191068563*(XI-fabs(t))) ); X = (z<0) ? t : -t; } else if (U>=0.911312780288703) { do { V = uniform(); W = uniform(); z = V - W; t = 0.479727404222441 + 1.105473661022070 * _unur_min(V,W); } while (_unur_max(V,W) > 0.872834976671790 && 0.049264496373128*fabs(z) > (PIhochK * exp(t*t/(-2)) -0.180025191068563*(XI-fabs(t))) ); X = (z<0) ? t : -t; } else { do { V = uniform(); W = uniform(); z = V - W; t = 0.479727404222441 - 0.595507138015940 * _unur_min(V,W); /* * The following line rejects negative values for t * (the KR algorithm only generates random variates from * the half-normal distribution). * However, it is missing in the original algorithm as * compiled in the paper. */ if (t<=0.) continue; } while (_unur_max(V,W)>0.805777924423817 && 0.053377549506886*fabs(z) > (PIhochK * exp(t*t/(-2)) -0.180025191068563*(XI-fabs(t))) ); X = (z<0) ? t : -t; } #undef XI #undef PIhochK /* -X- end of generator code -X- */ return ((DISTR.n_params==0) ? X : mu + sigma * X ); } /* end of _unur_stdgen_sample_normal_kr() */ /*---------------------------------------------------------------------------*/ /***************************************************************************** * * * Normal Distribution: Acceptance-complement ratio * * * ***************************************************************************** * * * FUNCTION: - samples a random number from the * * standard Normal distribution N(0,1). * * * * REFERENCE: - W. Hoermann and G. Derflinger (1990): * * The ACR Methodfor generating normal random variables, * * OR Spektrum 12 (1990), 181-185. * * * ***************************************************************************** * UNURAN (c) 2000 W. Hoermann & J. Leydold, Institut f. Statistik, WU Wien * *****************************************************************************/ double _unur_stdgen_sample_normal_acr( struct unur_gen *gen ) { /* -X- generator code -X- */ #define c1 1.448242853 #define c2 3.307147487 #define c3 1.46754004 #define d1 1.036467755 #define d2 5.295844968 #define d3 3.631288474 #define hm 0.483941449 #define zm 0.107981933 #define hp 4.132731354 #define zp 18.52161694 #define phln 0.4515827053 #define hm1 0.516058551 #define hp1 3.132731354 #define hzm 0.375959516 #define hzmp 0.591923442 /*zhm 0.967882898*/ #define as 0.8853395638 #define bs 0.2452635696 #define cs 0.2770276848 #define b 0.5029324303 #define x0 0.4571828819 #define ym 0.187308492 #define s 0.7270572718 #define t 0.03895759111 double X; double rn,x,y,z; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); do { y = uniform(); if (y>hm1) { X = hp*y-hp1; break; } else if (y0) ? (1+rn) : (-1+rn); break; } else if (y0) ? 2-rn : -2-rn; if ((c1-y)*(c3+fabs(z))0) rn = 2+y/x; else { x = 1-x; y = ym-y; rn = -(2+y/x); } if ((y-as+x)*(cs+x)+bs<0) { X = rn; break; } else if (y #include #include #include "unur_distributions.h" #include "unur_distributions_source.h" #include "unur_stddistr.h" /*---------------------------------------------------------------------------*/ static const char distr_name[] = "logarithmic"; /* parameters */ #define theta params[0] #define DISTR distr->data.discr #define NORMCONSTANT (distr->data.discr.norm_constant) /*---------------------------------------------------------------------------*/ /* no CDF for distribution */ #undef HAVE_CDF /*---------------------------------------------------------------------------*/ /* function prototypes */ static double _unur_pmf_logarithmic( int k, const UNUR_DISTR *distr ); #ifdef HAVE_CDF static double _unur_cdf_logarithmic( int k, const UNUR_DISTR *distr ); #endif static int _unur_upd_mode_logarithmic( UNUR_DISTR *distr ); static int _unur_upd_sum_logarithmic( UNUR_DISTR *distr ); static int _unur_set_params_logarithmic( UNUR_DISTR *distr, const double *params, int n_params ); /*---------------------------------------------------------------------------*/ double _unur_pmf_logarithmic(int k, const UNUR_DISTR *distr) { return ((k<1) ? 0. : pow( DISTR.theta, (double)k ) / k * NORMCONSTANT); } /* end of _unur_pmf_logarithmic() */ /*---------------------------------------------------------------------------*/ #ifdef HAVE_CDF double _unur_cdf_logarithmic(int k, const UNUR_DISTR *distr) { /** TODO: CDF **/ return 0.; } /* end of _unur_cdf_logarithmic() */ #endif /*---------------------------------------------------------------------------*/ int _unur_upd_mode_logarithmic( UNUR_DISTR *distr ) { DISTR.mode = 1; /* mode must be in domain */ if (DISTR.mode < DISTR.domain[0]) DISTR.mode = DISTR.domain[0]; else if (DISTR.mode > DISTR.domain[1]) DISTR.mode = DISTR.domain[1]; /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_upd_mode_logarithmic() */ /*---------------------------------------------------------------------------*/ int _unur_upd_sum_logarithmic( UNUR_DISTR *distr ) { /* normalization constant */ NORMCONSTANT = -1. / log( 1.-DISTR.theta); if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.sum = 1.; return UNUR_SUCCESS; } #ifdef HAVE_CDF /* else */ DISTR.sum = ( _unur_cdf_logarithmic( DISTR.domain[1],distr) - _unur_cdf_logarithmic( DISTR.domain[0]-1,distr) ); return UNUR_SUCCESS; #else return UNUR_ERR_DISTR_REQUIRED; #endif } /* end of _unur_upd_sum_logarithmic() */ /*---------------------------------------------------------------------------*/ int _unur_set_params_logarithmic( UNUR_DISTR *distr, const double *params, int n_params ) { /* check number of parameters for distribution */ if (n_params < 1) { _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } if (n_params > 1) { _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); n_params = 1; } CHECK_NULL(params,UNUR_ERR_NULL); /* check parameter theta */ if (theta <= 0. || theta >= 1.) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"theta <= 0 || theta >= 1"); return UNUR_ERR_DISTR_DOMAIN; } /* copy parameters for standard form */ DISTR.theta = theta; /* default parameters: none */ /* copy optional parameters: none */ /* store number of parameters */ DISTR.n_params = n_params; /* set (standard) domain: [1, infinity] */ if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.domain[0] = 1; /* left boundary */ DISTR.domain[1] = INT_MAX; /* right boundary */ } return UNUR_SUCCESS; } /* end of _unur_set_params_logarithmic() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_logarithmic( const double *params, int n_params ) { register struct unur_distr *distr; /* get new (empty) distribution object */ distr = unur_distr_discr_new(); /* set distribution id */ distr->id = UNUR_DISTR_LOGARITHMIC; /* name of distribution */ distr->name = distr_name; /* how to get special generators */ DISTR.init = _unur_stdgen_logarithmic_init; /* functions */ DISTR.pmf = _unur_pmf_logarithmic; /* pointer to PMF */ #ifdef HAVE_CDF DISTR.cdf = _unur_cdf_logarithmic; /* pointer to CDF */ #endif /* indicate which parameters are set */ distr->set = ( UNUR_DISTR_SET_DOMAIN | UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_MODE | UNUR_DISTR_SET_PMFSUM ); /* set parameters for distribution */ if (_unur_set_params_logarithmic(distr,params,n_params)!=UNUR_SUCCESS) { free(distr); return NULL; } /* normalization constant */ NORMCONSTANT = -1. / log( 1.-DISTR.theta); /* mode and sum over PMF */ DISTR.mode = 1; DISTR.sum = 1.; /* function for setting parameters and updating domain */ DISTR.set_params = _unur_set_params_logarithmic; /* function for updating derived parameters */ DISTR.upd_mode = _unur_upd_mode_logarithmic; /* funct for computing mode */ DISTR.upd_sum = _unur_upd_sum_logarithmic; /* funct for computing sum */ /* return pointer to object */ return distr; } /* end of unur_distr_logarithmic() */ /*---------------------------------------------------------------------------*/ #undef theta #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/c_slash.c0000644001357500135600000002006614420445767015327 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: c_slash.c * * * * REFERENCES: * * * * [2] N.L. Johnson, S. Kotz and N. Balakrishnan * * Continuous Univariate Distributions, * * Volume 1, 2nd edition * * John Wiley & Sons, Inc., New York, 1994 * * * ***************************************************************************** * * * distr: Slash distribution [2; ch.12, p.63] * * * * pdf: f(x) = (1 - exp(-x^2/2)) / x^2 for x != 0 * * pdf: f(x) = 1 / 2 for x == 0 * * domain: -infinity < x < infinity * * constant: 1 / sqrt(2 * pi) * * * * parameters: none * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "unur_distributions.h" #include "unur_distributions_source.h" #include "unur_stddistr.h" /*---------------------------------------------------------------------------*/ static const char distr_name[] = "slash"; /* parameters */ /* none */ #define DISTR distr->data.cont #define NORMCONSTANT (distr->data.cont.norm_constant) /* function prototypes */ static double _unur_pdf_slash( double x, const UNUR_DISTR *distr ); static double _unur_dpdf_slash( double x, const UNUR_DISTR *distr ); /* static double _unur_cdf_slash( double x, const UNUR_DISTR *distr ); */ static int _unur_upd_mode_slash( UNUR_DISTR *distr ); static int _unur_set_params_slash( UNUR_DISTR *distr, const double *params, int n_params ); /*---------------------------------------------------------------------------*/ double _unur_pdf_slash(double x, const UNUR_DISTR *distr) { if (_unur_iszero(x)) return (0.5 * NORMCONSTANT); else return ((1. - exp(-x*x/2.)) / (x*x) * NORMCONSTANT); } /* end of _unur_pdf_slash() */ /*---------------------------------------------------------------------------*/ double _unur_dpdf_slash(double x, const UNUR_DISTR *distr ATTRIBUTE__UNUSED) { register double xsq = x * x; if (_unur_iszero(x)) return 0.; else return (NORMCONSTANT * ((-2. + exp(-xsq/2.) * (2. + xsq)) / (xsq * x))); } /* end of _unur_dpdf_slash() */ /*---------------------------------------------------------------------------*/ int _unur_upd_mode_slash( UNUR_DISTR *distr ) { DISTR.mode = 0.; /* mode must be in domain */ if (DISTR.mode < DISTR.domain[0]) DISTR.mode = DISTR.domain[0]; else if (DISTR.mode > DISTR.domain[1]) DISTR.mode = DISTR.domain[1]; return UNUR_SUCCESS; } /* end of _unur_upd_mode_slash() */ /*---------------------------------------------------------------------------*/ int _unur_set_params_slash( UNUR_DISTR *distr, const double *params ATTRIBUTE__UNUSED, int n_params ) { /* check number of parameters for distribution */ if (n_params > 0) _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); /* copy parameters for standard form: none */ /* default parameters: none */ /* copy optional parameters: none */ /* store number of parameters */ DISTR.n_params = 0; /* set (standard) domain */ if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.domain[0] = -UNUR_INFINITY; /* left boundary */ DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ } return UNUR_SUCCESS; } /* end of _unur_set_params_slash() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_slash( const double *params, int n_params ) { register struct unur_distr *distr; /* get new (empty) distribution object */ distr = unur_distr_cont_new(); /* set distribution id */ distr->id = UNUR_DISTR_SLASH; /* name of distribution */ distr->name = distr_name; /* how to get special generators */ DISTR.init = _unur_stdgen_slash_init; /* functions */ DISTR.pdf = _unur_pdf_slash; /* pointer to PDF */ DISTR.dpdf = _unur_dpdf_slash; /* pointer to derivative of PDF */ /* DISTR.cdf = _unur_cdf_slash; pointer to CDF */ /* indicate which parameters are set */ distr->set = ( UNUR_DISTR_SET_DOMAIN | UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_MODE | UNUR_DISTR_SET_PDFAREA ); /* set parameters for distribution */ if (_unur_set_params_slash(distr,params,n_params)!=UNUR_SUCCESS) { free(distr); return NULL; } /* normalization constant */ NORMCONSTANT = 1. / (M_SQRT2 * M_SQRTPI); /* mode and area below p.d.f. */ DISTR.mode = 0.; DISTR.area = 1.; /* function for setting parameters and updating domain */ DISTR.set_params = _unur_set_params_slash; /* function for updating derived parameters */ DISTR.upd_mode = _unur_upd_mode_slash; /* funct for computing mode */ /* DISTR.upd_area = _unur_upd_area_slash; funct for computing area */ /* return pointer to object */ return distr; } /* end of unur_distr_slash() */ /*---------------------------------------------------------------------------*/ #undef nu #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/d_binomial_gen.c0000644001357500135600000003323114420445767016637 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: d_binomial_gen.c * * * * Special generators for Binomial distribution * * * ***************************************************************************** * * * Copyright (c) 2000-2011 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include /* for the definition of `UNUR_STDGEN_INVERSION' */ #include #include "unur_distributions_source.h" /*---------------------------------------------------------------------------*/ /* init routines for special generators */ inline static int binomial_bruec_init( struct unur_gen *gen ); static int _unur_stdgen_sample_binomial_bruec( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* abbreviations */ #define PAR ((struct unur_dstd_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_dstd_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.discr /* data for distribution in generator object */ #define uniform() _unur_call_urng(gen->urng) /* call for uniform prng */ /* #define MAX_gen_params (11) maximal number of parameters for generator */ /* #define MAX_gen_iparams (3) maximal number of integer param. for gen. */ /* parameters */ #define par_n (DISTR.params[0]) #define par_p (DISTR.params[1]) /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Inititialize **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ int _unur_stdgen_binomial_init( struct unur_par *par, struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* initialize special generator for Binomial distribution */ /* if gen == NULL then only check existance of variant. */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* one of par and gen must not be the NULL pointer */ switch ((par) ? par->variant : gen->variant) { case 0: /* DEFAULT */ case 1: /* Ratio of Uniforms/Inversion */ if (gen==NULL) return UNUR_SUCCESS; /* test existence only */ _unur_dstd_set_sampling_routine(gen, _unur_stdgen_sample_binomial_bruec ); return binomial_bruec_init( gen ); default: /* no such generator */ return UNUR_FAILURE; } } /* end of _unur_stdgen_binomial_init() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Special generators **/ /** **/ /*****************************************************************************/ #define flogfak(k) _unur_SF_ln_factorial(k) /***************************************************************************** * * * Binomial Distribution - Ratio of Uniforms/Inversion * * * ***************************************************************************** * * * Ratio of Uniforms method combined with Inversion for sampling from * * Binomial distributions with parameters n (number of trials) and * * p (probability of success). * * For min(n*p,n*(1-p)) < 5 the Inversion method is applied: * * The random numbers are generated via sequential search, starting at the * * lowest index k=0. The cumulative probabilities are avoided by using the * * technique of chop-down. * * For min(n*p,n*(1-p)) >=5 Ratio of Uniforms is employed: * * A table mountain hat function h(x) with optimal scale parameter s for * * fixed location parameter a = mu+1/2 is used. If the candidate k is * * near the mode and k>29 (respectively n-k > 29) f(k) is computed * * recursively starting at the mode m. The algorithm is valid for * * np > 0, n > =1, p <= 0.5. For p > 0.5, p is replaced by 1-p and * * k is replaced by n-k. * * * ***************************************************************************** * * * FUNCTION: - bruec samples a random number from the Binomial * * distribution with parameters n and p . It is valid for * * n * min(p,1-p) > 0. * * * * REFERENCE: - E. Stadlober (1989): Sampling from Poisson, binomial and * * hypergeometric distributions: ratio of uniforms as a * * simple and fast alternative, * * Bericht 303, Math. Stat. Sektion, Forschungsgesellschaft * * Joanneum, Graz. * * * * Implemented by R.Kremer 1990, revised by P.Busswald, July 1992 * ***************************************************************************** * WinRand (c) 1995 Ernst Stadlober, Institut fuer Statistitk, TU Graz * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #define GEN_N_IPARAMS (3) #define GEN_N_PARAMS (10) #define p (DISTR.params[1]) #define n (GEN->gen_iparam[0]) #define b (GEN->gen_iparam[1]) #define m (GEN->gen_iparam[2]) #define par (GEN->gen_param[0]) #define q1 (GEN->gen_param[1]) #define np (GEN->gen_param[2]) #define a (GEN->gen_param[3]) #define h (GEN->gen_param[4]) #define g (GEN->gen_param[5]) #define r (GEN->gen_param[6]) #define t (GEN->gen_param[7]) #define r1 (GEN->gen_param[8]) #define p0 (GEN->gen_param[9]) /*---------------------------------------------------------------------------*/ int binomial_bruec_init( struct unur_gen *gen ) { int bh,k1; double c,x; /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_DSTD_GEN,UNUR_ERR_COOKIE); if (GEN->gen_param == NULL || GEN->n_gen_param != GEN_N_PARAMS) { GEN->n_gen_param = GEN_N_PARAMS; GEN->gen_param = _unur_xrealloc(GEN->gen_param, GEN->n_gen_param * sizeof(double)); } if (GEN->gen_iparam == NULL || GEN->n_gen_iparam != GEN_N_IPARAMS) { GEN->n_gen_iparam = GEN_N_IPARAMS; GEN->gen_iparam = _unur_xrealloc(GEN->gen_iparam, GEN->n_gen_iparam * sizeof(int)); } /* convert integer parameters that are stored in an array of type 'double' */ /* into those of type 'int' and store it in working array GEN->gen_iparam. */ n = (int) par_n; /* -X- setup code -X- */ par = _unur_min(p, 1.-p); q1 = 1.0 - par; np = n*par; /*np=min(n*p,n*(1-p))*/ if (np < 5) { p0 = exp(n*log(q1)); /* Set-up for Inversion */ bh = (int)(np + 10.0*sqrt(np*q1)); b = _unur_min(n,bh); /* safety-bound */ /* initialize (unused) variables */ m = 0; r1 = t = r = g = h = a = 0.; } else { /* Set-up for Ratio of Uniforms */ m = (int)(np + par); /* mode */ a = np + 0.5; /* shift parameter */ c = sqrt(2.0 * a * q1); r = par/q1; t = (n+1) * r; r1 = log(r); bh = (int)(a + 7.0*c); b = _unur_min(n,bh); /* safety-bound */ g = flogfak(m) + flogfak(n-m); /* binomial const. */ k1 = (int)(a-c); x = (a-k1-1.0)/(a-k1); if((n-k1)*par*x*x > (k1+1)*q1) k1++; /* h=2*s */ h = (a-k1) * exp(.5*((k1-m)*r1+g-flogfak(k1)-flogfak(n-k1))+M_LN2); /* initialize (unused) variables */ p0 = 0.; } /* -X- end of setup code -X- */ return UNUR_SUCCESS; } /* end of binomial_bruec_init() */ /*---------------------------------------------------------------------------*/ int _unur_stdgen_sample_binomial_bruec( struct unur_gen *gen ) { /* -X- generator code -X- */ int i,k; double u,f,x,lf; /* check arguments */ CHECK_NULL(gen,INT_MAX); COOKIE_CHECK(gen,CK_DSTD_GEN,INT_MAX); if (np<5) { /* Inversion/Chop-down */ double pk; k = 0; pk = p0; u = uniform(); while (u>pk) { ++k; if (k>b) { u = uniform(); k = 0; pk=p0; } else { u -= pk; pk=(double)(((n-k+1)*par*pk)/(k*q1)); } } return ((p>0.5) ? n-k:k); } /* Ratio of Uniforms */ for (;;) { do { u = uniform(); x = a+h*(uniform()-0.5)/u; } while (x < 0 || ((k=(int)x) > b)); /* check, if k is valed candidate */ if ((abs(m-k)<=15) && ((k>29)||(n-k>29)) ) { f = 1.0; /* compute f(k) recursively */ if (m 0.5) ? n-k : k); /* -X- end of generator code -X- */ } /* end of _unur_stdgen_sample_binomial_bruec() */ /*---------------------------------------------------------------------------*/ #undef GEN_N_IPARAMS #undef GEN_N_PARAMS #undef p #undef n #undef m #undef b #undef par #undef q1 #undef np #undef al #undef h #undef g #undef r #undef t #undef r1 #undef p0 #undef par_n #undef par_p /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/c_chi.c0000644001357500135600000002322314420445767014756 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: c_chi.c * * * * REFERENCES: * * * * [2] N.L. Johnson, S. Kotz and N. Balakrishnan * * Continuous Univariate Distributions, * * Volume 1, 2nd edition * * John Wiley & Sons, Inc., New York, 1994 * * * ***************************************************************************** * * * distr: Chi distribution [2; ch.18, p.417] * * (Do not confuse with Chi^2 distribution!) * * * * pdf: f(x) = x^(nu-1) * exp( -x^2/2 ) * * domain: 0 <= x < infinity * * constant: 1 / (2^((nu/2)-1) * Gamma(nu/2)) * * * * parameters: * * 0: nu > 0 ... shape (degrees of freedom) * * * ***************************************************************************** * * * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "unur_distributions.h" #include "unur_distributions_source.h" #include "unur_stddistr.h" /*---------------------------------------------------------------------------*/ static const char distr_name[] = "chi"; /*---------------------------------------------------------------------------*/ /* parameters */ #define nu params[0] /*---------------------------------------------------------------------------*/ #define DISTR distr->data.cont #define LOGNORMCONSTANT (distr->data.cont.norm_constant) /*---------------------------------------------------------------------------*/ /* function prototypes */ static double _unur_pdf_chi( double x, const UNUR_DISTR *distr ); static double _unur_dpdf_chi( double x, const UNUR_DISTR *distr ); static double _unur_cdf_chi( double x, const UNUR_DISTR *distr ); static int _unur_upd_mode_chi( UNUR_DISTR *distr ); static int _unur_upd_area_chi( UNUR_DISTR *distr ); static int _unur_set_params_chi( UNUR_DISTR *distr, const double *params, int n_params ); /*---------------------------------------------------------------------------*/ double _unur_pdf_chi(double x, const UNUR_DISTR *distr) { register const double *params = DISTR.params; if (x <= 0.) /* out of support */ return 0.; return (exp( log(x)*(nu - 1.) -x*x/2. - LOGNORMCONSTANT )); } /* end of _unur_pdf_chi() */ /*---------------------------------------------------------------------------*/ double _unur_dpdf_chi(double x, const UNUR_DISTR *distr) { register const double *params = DISTR.params; if (x <= 0.) /* out of support */ return 0.; return ( exp(log(x)*(nu - 2.)-x*x/2. - LOGNORMCONSTANT) * (nu - 1. - x*x) ); } /* end of _unur_dpdf_chi() */ /*---------------------------------------------------------------------------*/ double _unur_cdf_chi(double x, const UNUR_DISTR *distr) { register const double *params = DISTR.params; if (x <= 0.) /* out of support of p.d.f. */ return 0.; return _unur_SF_incomplete_gamma(x*x/2.,nu/2.); } /* end of _unur_cdf_chi() */ /*---------------------------------------------------------------------------*/ int _unur_upd_mode_chi( UNUR_DISTR *distr ) { DISTR.mode = (DISTR.nu >= 1.) ? sqrt(DISTR.nu - 1.) : 0.; /* mode must be in domain */ if (DISTR.mode < DISTR.domain[0]) DISTR.mode = DISTR.domain[0]; else if (DISTR.mode > DISTR.domain[1]) DISTR.mode = DISTR.domain[1]; return UNUR_SUCCESS; } /* end of _unur_upd_mode_chi() */ /*---------------------------------------------------------------------------*/ int _unur_upd_area_chi( UNUR_DISTR *distr ) { /* normalization constant */ LOGNORMCONSTANT = _unur_SF_ln_gamma(DISTR.nu/2.) + M_LN2 * (DISTR.nu/2. - 1.); if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.area = 1.; return UNUR_SUCCESS; } /* else */ DISTR.area = ( _unur_cdf_chi( DISTR.domain[1],distr) - _unur_cdf_chi( DISTR.domain[0],distr) ); return UNUR_SUCCESS; } /* end of _unur_upd_area_chi() */ /*---------------------------------------------------------------------------*/ int _unur_set_params_chi( UNUR_DISTR *distr, const double *params, int n_params ) { /* check number of parameters for distribution */ if (n_params < 1) { _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } if (n_params > 1) { _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); n_params = 1; } CHECK_NULL(params,UNUR_ERR_NULL); /* check parameter nu */ if (nu <= 0.) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"nu <= 0"); return UNUR_ERR_DISTR_DOMAIN; } /* copy parameters for standard form */ DISTR.nu = nu; /* copy optional parameters: none */ /* store number of parameters */ DISTR.n_params = n_params; /* set (standard) domain */ if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.domain[0] = 0.; /* left boundary */ DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ } return UNUR_SUCCESS; } /* end of _unur_set_params_chi() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_chi( const double *params, int n_params ) { register struct unur_distr *distr; /* get new (empty) distribution object */ distr = unur_distr_cont_new(); /* set distribution id */ distr->id = UNUR_DISTR_CHI; /* name of distribution */ distr->name = distr_name; /* how to get special generators */ DISTR.init = _unur_stdgen_chi_init; /* functions */ DISTR.pdf = _unur_pdf_chi; /* pointer to PDF */ DISTR.dpdf = _unur_dpdf_chi; /* pointer to derivative of PDF */ DISTR.cdf = _unur_cdf_chi; /* pointer to CDF */ /* indicate which parameters are set */ distr->set = ( UNUR_DISTR_SET_DOMAIN | UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_PDFAREA | UNUR_DISTR_SET_MODE ); /* set parameters for distribution */ if (_unur_set_params_chi(distr,params,n_params)!=UNUR_SUCCESS) { free(distr); return NULL; } /* log of normalization constant */ LOGNORMCONSTANT = _unur_SF_ln_gamma(DISTR.nu/2.) + M_LN2 * (DISTR.nu/2. - 1.); /* mode and area below p.d.f. */ DISTR.mode = (DISTR.nu >= 1.) ? sqrt(DISTR.nu - 1.) : 0.; DISTR.area = 1.; /* function for setting parameters and updating domain */ DISTR.set_params = _unur_set_params_chi; /* function for updating derived parameters */ DISTR.upd_mode = _unur_upd_mode_chi; /* funct for computing mode */ DISTR.upd_area = _unur_upd_area_chi; /* funct for computing area */ /* return pointer to object */ return distr; } /* end of unur_distr_chi() */ /*---------------------------------------------------------------------------*/ #undef nu #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/c_powerexponential.c0000644001357500135600000002713214420445767017621 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: c_powerexponential.c * * * * REFERENCES: * * * * [3] N.L. Johnson, S. Kotz and N. Balakrishnan * * Continuous Univariate Distributions, * * Volume 2, 2nd edition * * John Wiley & Sons, Inc., New York, 1995 * * * ***************************************************************************** * * * distr: power-exponential distribution * * (also called Subbotin distribution) * * * * (see also [3; ch.24, p.195] for a different definition; * * also called Subbotin distribution) * * * * pdf: exp(-abs(x)^tau) * * domain: -infinity < x < infinity * * constant: 1 / (2 * Gamma(1+1/tau)) * * * * parameters: 1 * * 0: tau > 0 ... shape * * * ***************************************************************************** * * * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "unur_distributions.h" #include "unur_distributions_source.h" #include "unur_stddistr.h" /*---------------------------------------------------------------------------*/ static const char distr_name[] = "powerexponential"; /*---------------------------------------------------------------------------*/ /* parameters */ #define tau params[0] /*---------------------------------------------------------------------------*/ #define DISTR distr->data.cont #define LOGNORMCONSTANT (distr->data.cont.norm_constant) /*---------------------------------------------------------------------------*/ /* function prototypes */ static double _unur_pdf_powerexponential( double x, const UNUR_DISTR *distr ); static double _unur_logpdf_powerexponential( double x, const UNUR_DISTR *distr ); static double _unur_dpdf_powerexponential( double x, const UNUR_DISTR *distr ); static double _unur_dlogpdf_powerexponential( double x, const UNUR_DISTR *distr ); static double _unur_cdf_powerexponential( double x, const UNUR_DISTR *distr ); static int _unur_upd_mode_powerexponential( UNUR_DISTR *distr ); static int _unur_upd_area_powerexponential( UNUR_DISTR *distr ); static int _unur_set_params_powerexponential( UNUR_DISTR *distr, const double *params, int n_params ); /*---------------------------------------------------------------------------*/ double _unur_pdf_powerexponential( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; return exp( - pow( fabs(x), tau ) - LOGNORMCONSTANT); } /* end of _unur_pdf_powerexponential() */ /*---------------------------------------------------------------------------*/ double _unur_logpdf_powerexponential( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; return ( - pow( fabs(x), tau ) - LOGNORMCONSTANT); } /* end of _unur_logpdf_powerexponential() */ /*---------------------------------------------------------------------------*/ double _unur_dpdf_powerexponential( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; register double tmp; if (_unur_iszero(x)) /* derivative may not be defined, but ... */ return 0.; /* a tangent parallel to x-axis is possible. */ tmp = exp( -pow(fabs(x),tau) - LOGNORMCONSTANT + (tau-1.)*log(fabs(x)) ) * tau; /* sign ! */ return ( (x<0.) ? tmp : -tmp ); } /* end of _unur_dpdf_powerexponential() */ /*---------------------------------------------------------------------------*/ double _unur_dlogpdf_powerexponential( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; if (_unur_iszero(x)) /* derivative may not be defined, but ... */ return 0.; /* a tangent parallel to x-axis is possible. */ /* sign ! */ return (x<0. ? 1. : -1.) * (tau-1.)* pow(fabs(x), tau-1.); } /* end of _unur_dlogpdf_powerexponential() */ /*---------------------------------------------------------------------------*/ double _unur_cdf_powerexponential( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; register double cdf; /* compute cdf(abs(x)) - cdf(0) */ cdf = _unur_SF_incomplete_gamma(pow(fabs(x),tau),1./tau) / 2.; return ((x<0.) ? 0.5 - cdf : 0.5 + cdf); } /* end of _unur_cdf_powerexponential() */ /*---------------------------------------------------------------------------*/ int _unur_upd_mode_powerexponential( UNUR_DISTR *distr ) { DISTR.mode = 0; /* mode must be in domain */ if (DISTR.mode < DISTR.domain[0]) DISTR.mode = DISTR.domain[0]; else if (DISTR.mode > DISTR.domain[1]) DISTR.mode = DISTR.domain[1]; return UNUR_SUCCESS; } /* end of _unur_upd_mode_powerexponential() */ /*---------------------------------------------------------------------------*/ int _unur_upd_area_powerexponential( UNUR_DISTR *distr ) { /* log of normalization constant */ LOGNORMCONSTANT = _unur_SF_ln_gamma(1. + 1./DISTR.tau) + M_LN2; if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.area = 1.; return UNUR_SUCCESS; } /* else */ DISTR.area = ( _unur_cdf_powerexponential( DISTR.domain[1],distr) - _unur_cdf_powerexponential( DISTR.domain[0],distr) ); return UNUR_SUCCESS; } /* end of _unur_upd_area_powerexponential() */ /*---------------------------------------------------------------------------*/ int _unur_set_params_powerexponential( UNUR_DISTR *distr, const double *params, int n_params ) { /* check number of parameters for distribution */ if (n_params < 1) { _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } if (n_params > 1) { _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); n_params = 1; } CHECK_NULL(params,UNUR_ERR_NULL); /* check parameter tau */ if (tau <= 0.) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"tau <= 0"); return UNUR_ERR_DISTR_DOMAIN; } /* copy parameters for standard form */ DISTR.tau = tau; /* default parameters: none */ /* copy optional parameters: none */ /* store number of parameters */ DISTR.n_params = n_params; /* set (standard) domain */ if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.domain[0] = -UNUR_INFINITY; /* left boundary */ DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ } return UNUR_SUCCESS; } /* end of _unur_set_params_powerexponential() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_powerexponential( const double *params, int n_params ) { register struct unur_distr *distr; /* get new (empty) distribution object */ distr = unur_distr_cont_new(); /* set distribution id */ distr->id = UNUR_DISTR_POWEREXPONENTIAL; /* name of distribution */ distr->name = distr_name; /* how to get special generators */ DISTR.init = _unur_stdgen_powerexponential_init; /* functions */ DISTR.pdf = _unur_pdf_powerexponential; /* pointer to PDF */ DISTR.logpdf = _unur_logpdf_powerexponential; /* pointer to logPDF */ DISTR.dpdf = _unur_dpdf_powerexponential; /* pointer to derivative of PDF */ DISTR.dlogpdf = _unur_dlogpdf_powerexponential; /* pointer to derivative of logPDF */ DISTR.cdf = _unur_cdf_powerexponential; /* pointer to CDF */ DISTR.cdf = _unur_cdf_powerexponential; /* pointer to CDF */ /* indicate which parameters are set */ distr->set = ( UNUR_DISTR_SET_DOMAIN | UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_PDFAREA | UNUR_DISTR_SET_MODE ); /* set parameters for distribution */ if (_unur_set_params_powerexponential(distr,params,n_params)!=UNUR_SUCCESS) { free(distr); return NULL; } /* log of normalization constant */ LOGNORMCONSTANT = _unur_SF_ln_gamma(1. + 1./DISTR.tau) + M_LN2; /* mode and area below p.d.f. */ DISTR.mode = 0; DISTR.area = 1.; /* function for setting parameters and updating domain */ DISTR.set_params = _unur_set_params_powerexponential; /* function for updating derived parameters */ DISTR.upd_mode = _unur_upd_mode_powerexponential; /* funct for computing mode */ DISTR.upd_area = _unur_upd_area_powerexponential; /* funct for computing area */ /* return pointer to object */ return distr; } /* end of unur_distr_powerexponential() */ /*---------------------------------------------------------------------------*/ #undef tau #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/d_poisson.c0000644001357500135600000002252514420445767015712 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: d_poisson.c * * * * REFERENCES: * * * * [1] N.L. Johnson, S. Kotz and A.W. Kemp * * Univariate Discrete Distributions, * * 2nd edition * * John Wiley & Sons, Inc., New York, 1992 * * * ***************************************************************************** * * * distr: Poisson distribution [1; ch.4, p.151] * * * * pmf: p(k) = theta^k / k! * * domain: 0 <= k < infinity * * constant: exp( -theta ) * * * * parameters: * * 0: theta > 0 ... shape * * * ***************************************************************************** * * * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "unur_distributions.h" #include "unur_distributions_source.h" #include "unur_stddistr.h" /*---------------------------------------------------------------------------*/ static const char distr_name[] = "poisson"; /* parameters */ #define theta params[0] #define DISTR distr->data.discr /* #define LOGNORMCONSTANT (distr->data.discr.norm_constant) */ /*---------------------------------------------------------------------------*/ /* function prototypes */ static double _unur_pmf_poisson( int k, const UNUR_DISTR *distr ); static double _unur_cdf_poisson( int k, const UNUR_DISTR *distr ); #ifdef _unur_SF_invcdf_binomial static int _unur_invcdf_poisson( double u, const UNUR_DISTR *distr ); #endif static int _unur_upd_mode_poisson( UNUR_DISTR *distr ); static int _unur_upd_sum_poisson( UNUR_DISTR *distr ); static int _unur_set_params_poisson( UNUR_DISTR *distr, const double *params, int n_params ); /*---------------------------------------------------------------------------*/ double _unur_pmf_poisson(int k, const UNUR_DISTR *distr) { if (k>=0) return exp( -DISTR.theta + k * log(DISTR.theta) - _unur_SF_ln_factorial(k) ); else return 0.; } /* end of _unur_pmf_poisson() */ /*---------------------------------------------------------------------------*/ double _unur_cdf_poisson(int k, const UNUR_DISTR *distr) { if (k>=0) return (1.-_unur_SF_incomplete_gamma(DISTR.theta,k+1.)); else return 0.; } /* end of _unur_cdf_poisson() */ /*---------------------------------------------------------------------------*/ #ifdef _unur_SF_invcdf_poisson int _unur_invcdf_poisson(double u, const UNUR_DISTR *distr) { const double *params = DISTR.params; double x; x = _unur_SF_invcdf_poisson(u,theta); return ((x>=INT_MAX) ? INT_MAX : ((int) x)); } /* end of _unur_invcdf_poisson() */ #endif /*---------------------------------------------------------------------------*/ int _unur_upd_mode_poisson( UNUR_DISTR *distr ) { DISTR.mode = (int) DISTR.theta; /* mode must be in domain */ if (DISTR.mode < DISTR.domain[0]) DISTR.mode = DISTR.domain[0]; else if (DISTR.mode > DISTR.domain[1]) DISTR.mode = DISTR.domain[1]; /* o.k. */ return UNUR_SUCCESS; } /* end of _unur_upd_mode_poisson() */ /*---------------------------------------------------------------------------*/ int _unur_upd_sum_poisson( UNUR_DISTR *distr ) { /* log normalization constant: none */ if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.sum = 1.; return UNUR_SUCCESS; } /* else */ DISTR.sum = ( _unur_cdf_poisson( DISTR.domain[1],distr) - _unur_cdf_poisson( DISTR.domain[0]-1,distr) ); return UNUR_SUCCESS; } /* end of _unur_upd_sum_poisson() */ /*---------------------------------------------------------------------------*/ int _unur_set_params_poisson( UNUR_DISTR *distr, const double *params, int n_params ) { /* check number of parameters for distribution */ if (n_params < 1) { _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } if (n_params > 1) { _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); n_params = 1; } CHECK_NULL(params,UNUR_ERR_NULL); /* check parameter theta */ if (theta <= 0.) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"theta <= 0"); return UNUR_ERR_DISTR_DOMAIN; } /* copy parameters for standard form */ DISTR.theta = theta; /* default parameters: none */ /* copy optional parameters: none */ /* store number of parameters */ DISTR.n_params = n_params; /* set (standard) domain: [0, inifinty] */ if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.domain[0] = 0; /* left boundary */ DISTR.domain[1] = INT_MAX; /* right boundary */ } return UNUR_SUCCESS; } /* end of _unur_set_params_poisson() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_poisson( const double *params, int n_params ) { register struct unur_distr *distr; /* get new (empty) distribution object */ distr = unur_distr_discr_new(); /* set distribution id */ distr->id = UNUR_DISTR_POISSON; /* name of distribution */ distr->name = distr_name; /* how to get special generators */ DISTR.init = _unur_stdgen_poisson_init; /* functions */ DISTR.pmf = _unur_pmf_poisson; /* pointer to PMF */ DISTR.cdf = _unur_cdf_poisson; /* pointer to CDF */ #ifdef _unur_SF_invcdf_poisson DISTR.invcdf = _unur_invcdf_poisson; /* pointer to inverse CDF */ #endif /* indicate which parameters are set */ distr->set = ( UNUR_DISTR_SET_DOMAIN | UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_PMFSUM | UNUR_DISTR_SET_MODE ); /* set parameters for distribution */ if (_unur_set_params_poisson(distr,params,n_params)!=UNUR_SUCCESS) { free(distr); return NULL; } /* log normalization constant: none */ /* mode and sum over PMF */ DISTR.mode = (int) DISTR.theta; DISTR.sum = 1.; /* function for setting parameters and updating domain */ DISTR.set_params = _unur_set_params_poisson; /* function for updating derived parameters */ DISTR.upd_mode = _unur_upd_mode_poisson; /* funct for computing mode */ DISTR.upd_sum = _unur_upd_sum_poisson; /* funct for computing area */ /* return pointer to object */ return distr; } /* end of unur_distr_poisson() */ /*---------------------------------------------------------------------------*/ #undef theta #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/README0000644001357500135600000000200514420304141014374 00000000000000# # The PDF and PMF codes in this directory are parsed by a perl script # to be used for a code generator. To make this parser as simple as # possible the following coding rules must be satisfied: # # (1) The PDF subroutine must end with the sequence that matches the # regular expression: # /\\/\\*\\s+end\\s+of\\s+$PDF_name/ # where $PDF_name is the name of the PDF function. # E.g.: if the PDF function is _unur_pdf_gamma we must have # # double _unur_pdf_gamma( double x, const UNUR_DISTR *distr ) # { # .... # } /* end of _unur_pdf_gamma() */ # # (2) The first argument must be named `x' for PDFs and `k' for PMFs. # # (3) Only use single commands for `if' blocks; do not use braces. # # (4) `if' statements must be on a separate line; the `if' command # must be on the next line (comment lines and empty lines are # allowed). # # (5) Do not use ?: statements. # # # Remark: # These rules need not be satisfied any other routine (e.g. dPDF, CDF, ...). # unuran-1.11.0/src/distributions/c_burr.c0000644001357500135600000006447714420445767015205 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: c_burr.c * * * * REFERENCES: * * * * [2] N.L. Johnson, S. Kotz and N. Balakrishnan * * Continuous Univariate Distributions, * * Volume 1, 2nd edition * * John Wiley & Sons, Inc., New York, 1994 * * * ***************************************************************************** * * * Burr family of distributions [2; ch.12, p.54] * * * * first parameter must be type of distribution (1 ... 12)! * * * *...........................................................................* * * * distr: Burr distribution Type I * * first parameter is 1 * * * * cdf: F(x) = x * * pdf: f(x) = 1 * * domain: 0 <= x <= 1 * * constant: 1 * * * * parameters: none * * * *...........................................................................* * * * distr: Burr distribution Type II * * first parameter is 2 * * * * cdf: F(x) = (exp(-x) + 1)^(-k) * * pdf: f(x) = k * exp(-x) * (exp(-x)+1)^(-k-1) * * domain: -infinity < x < infinity * * constant: 1 * * * * parameters: 1 * * 0: k > 0 * * * *...........................................................................* * * * distr: Burr distribution Type III * * first parameter is 3 * * * * cdf: F(x) = (x^(-c)+1)^(-k) * * pdf: f(x) = c * k * x^(-c-1) * (x^(-c) + 1)^(-k-1) * * domain: 0 < x < infinity * * constant: 1 * * * * parameters: 2 * * 0: k > 0 * * 1: c > 0 * * * *...........................................................................* * * * distr: Burr distribution Type IV * * first parameter is 4 * * * * cdf: F(x) = (((c-x)/x)^(1/c) + 1)^(-k) * * pdf: f(x) = * * domain: 0 < x < c * * constant: 1 * * * * parameters: 2 * * 0: k > 0 * * 1: c > 0 * * * *...........................................................................* * * * distr: Burr distribution Type V * * first parameter is 5 * * * * cdf: F(x) = (c * exp(-tan(x)) + 1)^(-k) * * pdf: f(x) = * * domain: -pi/2 < x < pi/2 * * constant: * * * * parameters: 2 * * 0: k > 0 * * 1: c > 0 * * * *...........................................................................* * * * distr: Burr distribution Type VI * * first parameter is 6 * * * * cdf: F(x) = (c * exp(-k*sinh(x)) + 1)^(-k) * * pdf: f(x) = * * domain: -infinity < x < infinity * * constant: * * * * parameters: 2 * * 0: k > 0 * * 1: c > 0 * * * *...........................................................................* * * * distr: Burr distribution Type VII * * first parameter is 7 * * * * cdf: F(x) = 2^(-k) * (1 + tanh(x))^k * * pdf: f(x) = * * domain: -infinity < x < infinity * * constant: * * * * parameters: * * 0: k > 0 * * 1: c > 0 * * * *...........................................................................* * * * distr: Burr distribution Type VIII * * first parameter is 8 * * * * cdf: F(x) = (2/pi * arctan(exp(x)))^k * * pdf: f(x) = * * domain: -infinity < x < infinity * * constant: * * * * parameters: 1 * * 0: k > 0 * * * *...........................................................................* * * * distr: Burr distribution Type IX * * first parameter is 9 * * * * cdf: F(x) = 1 - 2 / (2 + c * ((1+exp(x))^k - 1)) * * pdf: f(x) = * * domain: -infinity < x < infinity * * constant: * * * * parameters: 2 * * 0: k > 0 * * 1: c > 0 * * * *...........................................................................* * * * distr: Burr distribution Type X * * first parameter is 10 * * * * cdf: F(x) = (1 - exp(-x^2))^k * * pdf: f(x) = * * domain: 0 < x < infinity * * constant: * * * * parameters: 1 * * 0: k > 0 * * * *...........................................................................* * * * distr: Burr distribution Type XI * * first parameter is 11 * * * * cdf: F(x) = (x - 1/(2*pi) * sin( 2*pi*x))^k * * pdf: f(x) = * * domain: 0 < x < 1 * * constant: * * * * parameters: * * 0: k > 0 * * * *...........................................................................* * * * distr: Burr distribution Type XII * * first parameter is 12 * * * * cdf: F(x) = 1 - (1 + x^c)^(-k) * * pdf: f(x) = * * domain: 0 < x < infinity * * constant: * * * * parameters: * * 0: k > 0 * * 1: c > 0 * * * ***************************************************************************** * * * Copyright (c) 2000-2006, 2010 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "unur_distributions.h" #include "unur_distributions_source.h" #include "unur_stddistr.h" /*---------------------------------------------------------------------------*/ static const char distr_name[] = "burr"; /* parameters */ #define burr_type params[0] #define k params[1] #define c params[2] #define DISTR distr->data.cont /* #define NORMCONSTANT (distr->data.cont.norm_constant) */ /* function prototypes */ /* static double _unur_pdf_burr(double x, const UNUR_DISTR *distr); */ /* static double _unur_dpdf_burr(double x, const UNUR_DISTR *distr); */ static double _unur_cdf_burr(double x, const UNUR_DISTR *distr); static double _unur_invcdf_burr(double u, const UNUR_DISTR *distr); /* static int _unur_upd_mode_burr( UNUR_DISTR *distr ); */ /* static int _unur_upd_area_burr( UNUR_DISTR *distr ); */ static int _unur_set_params_burr( UNUR_DISTR *distr, const double *params, int n_params ); /*---------------------------------------------------------------------------*/ double _unur_cdf_burr( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; switch ((int) (burr_type + 0.5)) { case 1: /* Type I: F(x) = x */ if (x<=0.) return 0.; if (x>=1.) return 1.; return x; case 2: /* Type II: F(x) = (exp(-x) + 1)^(-k) */ return pow(exp(-x) + 1., -k); case 3: /* Type III: F(x) = (x^(-c)+1)^(-k) */ if (x<=0.) return 0.; return pow( pow(x, -c) + 1., -k); case 4: /* Type IV: F(x) = (((c-x)/x)^(1/c) + 1)^(-k) */ if (x<=0.) return 0.; if (x>=c) return 1.; return pow( pow( (c-x)/x, 1/c ) + 1., -k); case 5: /* Type V: F(x) = (c * exp(-tan(x)) + 1)^(-k) */ if (x<=-M_PI/2.) return 0.; if (x>= M_PI/2.) return 1.; return pow( c * exp(-tan(x)) + 1., -k ); case 6: /* Type VI: F(x) = (c * exp(-k*sinh(x)) + 1)^(-k) */ return pow( c * exp(-k*sinh(x)) + 1., -k ); case 7: /* Type VII: F(x) = 2^(-k) * (1 + tanh(x))^k */ return pow( (1. + tanh(x))/2, k ); case 8: /* Type VIII:F(x) = (2/pi * arctan(exp(x)))^k */ return pow( 2./M_PI * atan(exp(x)), k ); case 9: /* Type IX: F(x) = 1 - 2 / (2 + c * ((1+exp(x))^k - 1)) */ return (1. - 2. / (2. + c * (pow(1.+exp(x), k) - 1.))); case 10: /* Type X: F(x) = (1 - exp(-x^2))^k */ if (x<=0.) return 0.; return pow( 1. - exp(-x*x), k ); case 11: /* Type XI: F(x) = (x - 1/(2*pi) * sin(2*pi*x))^k */ if (x<=0.) return 0.; if (x>=1.) return 1.; return pow( x - 1./(2.*M_PI) * sin( 2. * M_PI * x), k ); case 12: /* Type XII: F(x) = 1 - (1 + x^c)^(-k) */ if (x<=0.) return 0.; return (1. - pow( 1 + pow(x, c), -k ) ); default: _unur_error(distr_name,UNUR_ERR_SHOULD_NOT_HAPPEN,""); return UNUR_INFINITY; } } /* end of _unur_cdf_burr() */ /*---------------------------------------------------------------------------*/ double _unur_invcdf_burr( double U, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; double Y; switch (distr->id) { case UNUR_DISTR_BURR_I: return U; case UNUR_DISTR_BURR_II: Y = exp( -log(U)/k ); /* U^(-1/k) */ return ( -log( Y - 1. ) ); case UNUR_DISTR_BURR_III: Y = exp( -log(U)/k ); /* U^(-1/k) */ return ( exp( -log( Y - 1. )/c ) ); case UNUR_DISTR_BURR_IV: Y = exp( -log(U)/k ); /* U^(-1/k) */ Y = exp( c * log( Y - 1. )) + 1.; return (c/Y); case UNUR_DISTR_BURR_V: Y = exp( -log(U)/k ); /* U^(-1/k) */ return atan( -log( (Y - 1.) / c ) ); case UNUR_DISTR_BURR_VI: Y = exp( -log(U)/k ); /* U^(-1/k) */ Y = -log( (Y - 1.) / c)/k; return log( Y + sqrt(Y * Y +1.)); case UNUR_DISTR_BURR_VII: Y = exp( log(U)/k ); /* U^(1/k) */ return ( log(2. * Y / (2. - 2.*Y)) / 2. ); case UNUR_DISTR_BURR_VIII: Y = exp( log(U)/k ); /* U^(1/k) */ return ( log( tan( Y * M_PI/2. ) ) ); case UNUR_DISTR_BURR_IX: Y = 1. + 2. * U / (c * (1.-U)); return log( exp( log(Y) / k) - 1. ); case UNUR_DISTR_BURR_X: Y = exp( log(U)/k ); /* U^(1/k) */ return ( sqrt( -log( 1. - Y ) ) ); case UNUR_DISTR_BURR_XII: Y = exp( -log(1-U)/k ); /* (1-U)^(-1/k) */ return ( exp( log( Y - 1.) / c) ); case UNUR_DISTR_BURR_XI: default: _unur_error(distr_name,UNUR_ERR_SHOULD_NOT_HAPPEN,""); return UNUR_INFINITY; } } /* end of _unur_invcdf_burr() */ /*---------------------------------------------------------------------------*/ int _unur_set_params_burr( UNUR_DISTR *distr, const double *params, int n_params ) { CHECK_NULL(params,UNUR_ERR_NULL); /* check number of parameters for == 3 */ switch (distr->id) { case UNUR_DISTR_BURR_I: if (n_params > 1) { _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); n_params = 1; } break; case UNUR_DISTR_BURR_II: case UNUR_DISTR_BURR_VII: case UNUR_DISTR_BURR_VIII: case UNUR_DISTR_BURR_X: case UNUR_DISTR_BURR_XI: if (n_params < 2) { _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } if (n_params > 2) { _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); n_params = 2; } break; case UNUR_DISTR_BURR_III: case UNUR_DISTR_BURR_IV: case UNUR_DISTR_BURR_V: case UNUR_DISTR_BURR_VI: case UNUR_DISTR_BURR_IX: case UNUR_DISTR_BURR_XII: if (n_params < 3) { _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } if (n_params > 3) { _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); n_params = 3; } break; default: _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"unkown type"); return UNUR_ERR_DISTR_NPARAMS; } /* check parameters */ if (k <= 0. || (c <= 0. && n_params == 3) ) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"k <= 0 || c <= 0"); return UNUR_ERR_DISTR_DOMAIN; } /* copy parameters */ DISTR.burr_type = burr_type; switch (n_params) { case 3: DISTR.c = c; /* FALLTHROUGH */ case 2: DISTR.k = k; /* FALLTHROUGH */ default: break; } /* number of arguments */ DISTR.n_params = n_params; /* set (standard) domain */ if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.domain[0] = -UNUR_INFINITY; /* left boundary */ DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ switch (distr->id) { case UNUR_DISTR_BURR_I: DISTR.domain[0] = 0.; /* left boundary */ DISTR.domain[1] = 1.; /* right boundary */ break; case UNUR_DISTR_BURR_III: DISTR.domain[0] = 0.; /* left boundary */ break; case UNUR_DISTR_BURR_IV: DISTR.domain[0] = 0.; /* left boundary */ DISTR.domain[1] = DISTR.c; /* right boundary */ break; case UNUR_DISTR_BURR_V: DISTR.domain[0] = -M_PI/2.; /* left boundary */ DISTR.domain[1] = M_PI/2.; /* right boundary */ break; case UNUR_DISTR_BURR_X: DISTR.domain[0] = 0.; /* left boundary */ break; case UNUR_DISTR_BURR_XI: DISTR.domain[0] = 0.; /* left boundary */ DISTR.domain[1] = 1.; /* right boundary */ break; case UNUR_DISTR_BURR_XII: DISTR.domain[0] = 0.; /* left boundary */ break; } } /* pointer to inverse CDF */ DISTR.invcdf = ( (distr->id != UNUR_DISTR_BURR_XI) ? _unur_invcdf_burr : NULL ); return UNUR_SUCCESS; } /* end of _unur_set_params_burr() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_burr( const double *params, int n_params ) { register struct unur_distr *distr; if (n_params < 1) { _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return NULL; } /* get new (empty) distribution object */ distr = unur_distr_cont_new(); /* get type of distribution and set distribution id */ switch ((int) (burr_type + 0.5)) { case 1: distr->id = UNUR_DISTR_BURR_I; break; case 2: distr->id = UNUR_DISTR_BURR_II; break; case 3: distr->id = UNUR_DISTR_BURR_III; break; case 4: distr->id = UNUR_DISTR_BURR_IV; break; case 5: distr->id = UNUR_DISTR_BURR_V; break; case 6: distr->id = UNUR_DISTR_BURR_VI; break; case 7: distr->id = UNUR_DISTR_BURR_VII; break; case 8: distr->id = UNUR_DISTR_BURR_VIII; break; case 9: distr->id = UNUR_DISTR_BURR_IX; break; case 10: distr->id = UNUR_DISTR_BURR_X; break; case 11: distr->id = UNUR_DISTR_BURR_XI; break; case 12: distr->id = UNUR_DISTR_BURR_XII; break; default: _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"type < 1 || type > 12"); free( distr ); return NULL; } /* name of distribution */ distr->name = distr_name; /* how to get special generators */ /* DISTR.init = _unur_stdgen_burr_init; */ /* functions */ /* DISTR.pdf = _unur_pdf_burr; pointer to PDF */ /* DISTR.dpdf = _unur_dpdf_burr; pointer to derivative of PDF */ DISTR.cdf = _unur_cdf_burr; /* pointer to CDF */ DISTR.invcdf = _unur_invcdf_burr; /* pointer to inverse CDF */ /* indicate which parameters are set */ distr->set = ( UNUR_DISTR_SET_DOMAIN | UNUR_DISTR_SET_STDDOMAIN ); /* UNUR_DISTR_SET_MODE | */ /* UNUR_DISTR_SET_PDFAREA ); */ /* set parameters for distribution */ if (_unur_set_params_burr(distr,params,n_params)!=UNUR_SUCCESS) { free(distr); return NULL; } /* normalization constant: none */ /* mode and area below p.d.f. */ /* DISTR.mode = 0.; */ /* DISTR.area = 1.; */ /* function for setting parameters and updating domain */ DISTR.set_params = _unur_set_params_burr; /* function for updating derived parameters */ /* DISTR.upd_mode = _unur_upd_mode_burr; funct for computing mode */ /* DISTR.upd_area = _unur_upd_area_burr; funct for computing area */ /* return pointer to object */ return distr; } /* end of unur_distr_burr() */ /*---------------------------------------------------------------------------*/ #undef burr_type #undef k #undef c #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/d_logarithmic_gen.c0000644001357500135600000002514514420445767017354 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: d_logarithmic_gen.c * * * * Special generators for Logarithmic distribution * * * ***************************************************************************** * * * Copyright (c) 2000-2011 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include /* for the definition of `UNUR_STDGEN_INVERSION' */ #include #include "unur_distributions_source.h" /*---------------------------------------------------------------------------*/ /* init routines for special generators */ inline static int logarithmic_lsk_init( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* abbreviations */ #define PAR ((struct unur_dstd_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_dstd_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.discr /* data for distribution in generator object */ #define uniform() _unur_call_urng(gen->urng) /* call for uniform prng */ /* #define MAX_gen_params 2 maximal number of parameters for generator */ /* parameters */ #define theta (DISTR.params[0]) /* shape */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Inititialize **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ int _unur_stdgen_logarithmic_init( struct unur_par *par, struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* initialize special generator for Logarithmic distribution */ /* if gen == NULL then only check existance of variant. */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* one of par and gen must not be the NULL pointer */ switch ((par) ? par->variant : gen->variant) { case 0: /* DEFAULT */ case 1: /* Inversion/Transformation */ _unur_dstd_set_sampling_routine(gen, _unur_stdgen_sample_logarithmic_lsk ); return logarithmic_lsk_init( gen ); default: /* no such generator */ return UNUR_FAILURE; } } /* end of _unur_stdgen_logarithmic_init() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Special generators **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ /***************************************************************************** * * * Logarithmic Distribution: Inversion/Transformation * * * ***************************************************************************** * * * FUNCTION: - samples a random number from the Logarithmic distribution * * with parameter 0 < theta < 1. * * * * REFERENCE: - A.W. Kemp (1981): Efficient generation of logarithmically * * distributed pseudo-random variables, * * Appl. Statist. 30, 249-253. * * * * Implemented by R.Kremer 1990, revised by P.Busswald, July 1992 * ***************************************************************************** * * * The algorithm combines Inversion and Transformation. * * It is based on the following fact: A random variable X from the * * Logarithmic distribution has the property that X for fixed Y = y is * * Geometric distributed with * * (*) P(X=x|Y=y) = (1-y) * y^(x-1) * * where Y has distribution function F(y) = ln(1-y) / ln(1-p). * * So first random numbers y are generated by simple Inversion, then * * k = (int)(1+ln(u) / ln(y)) is a Geometric random number and because of * * (*) a Logarithmic one. * * To speed up the algorithm squeezes are used as well as the fact, that * * many of the random numbers are 1 or 2 (depending on special * * circumstances). * * On an IBM/PC 486 optimal performance is achieved, if for p<0.97 simple * * inversion is used and otherwise the transformation. * * On an IBM/PC 286 inversion should be restricted to p<0.90. * * * ***************************************************************************** * WinRand (c) 1995 Ernst Stadlober, Institut fuer Statistitk, TU Graz * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #define GEN_N_PARAMS (2) #define t (GEN->gen_param[0]) #define h (GEN->gen_param[1]) #define theta_limit 0.97 /* theta < theta_limit --> Inversion theta >= theta_limit --> Transformation */ /*---------------------------------------------------------------------------*/ inline static int logarithmic_lsk_init( struct unur_gen *gen ) { /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_DSTD_GEN,UNUR_ERR_COOKIE); if (GEN->gen_param == NULL || GEN->n_gen_param != GEN_N_PARAMS) { GEN->n_gen_param = GEN_N_PARAMS; GEN->gen_param = _unur_xrealloc(GEN->gen_param, GEN->n_gen_param * sizeof(double)); t = 0.; h = 0.; /* initialize variables */ } /* -X- setup code -X- */ if (theta < theta_limit) t = -theta / log(1.0 - theta); else h=log(1.0 - theta); /* -X- end of setup code -X- */ return UNUR_SUCCESS; } /* end of logarithmic_lsk_init() */ int _unur_stdgen_sample_logarithmic_lsk( struct unur_gen *gen ) { /* -X- generator code -X- */ double U, V, p, q; int K; /* check arguments */ CHECK_NULL(gen,INT_MAX); COOKIE_CHECK(gen,CK_DSTD_GEN,INT_MAX); U = uniform(); if (theta < theta_limit) { /* Inversion/Chop-down */ K = 1; p = t; while (U > p) { U -= p; K++; p *= theta * (K - 1.)/((double) K); } return K; } else { /* Transformation */ if (U > theta) return 1; V = uniform(); q = 1. - exp(V * h); if ( U <= q * q) { K = 1 + (int)(log(U)/log(q)); return K; } return ((U > q) ? 1 : 2); } /* -X- end of generator code -X- */ } /* end of _unur_stdgen_sample_logarithmic_lsk() */ /*---------------------------------------------------------------------------*/ #undef GEN_N_PARAMS #undef t #undef h #undef theta_limit /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/c_ig.c0000644001357500135600000002716214420445767014620 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: c_ig.c * * * * REFERENCES: * * * * [2] N.L. Johnson, S. Kotz and N. Balakrishnan * * Continuous Univariate Distributions, * * Volume 1, 2nd edition * * John Wiley & Sons, Inc., New York, 1994 * * * ***************************************************************************** * * * distr: Inverse Gaussian (Wald) distribution [2; ch.15, p.259] * * * * pdf: f(x) = sqrt( lambda/(2*pi*x^3) ) * * * exp( -lambda*(x-mu)^2 / (2*mu^2*x) ) * * domain: 0 < x < infinity * * constant: 1 * * * * parameters: * * 0: mu > 0 ... shape (mean) * * 1: lambda > 0 ... shape * * * ***************************************************************************** * * * Copyright (c) 2009-2010 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "unur_distributions.h" #include "unur_distributions_source.h" #include "unur_stddistr.h" /*---------------------------------------------------------------------------*/ static const char distr_name[] = "ig"; /*---------------------------------------------------------------------------*/ /* parameters */ #define mu params[0] #define lambda params[1] /*---------------------------------------------------------------------------*/ #define DISTR distr->data.cont #define LOGNORMCONSTANT (distr->data.cont.norm_constant) /*---------------------------------------------------------------------------*/ /* function prototypes */ static double _unur_pdf_ig( double x, const UNUR_DISTR *distr ); static double _unur_logpdf_ig( double x, const UNUR_DISTR *distr ); static double _unur_dpdf_ig( double x, const UNUR_DISTR *distr ); static double _unur_dlogpdf_ig( double x, const UNUR_DISTR *distr ); static double _unur_cdf_ig( double x, const UNUR_DISTR *distr ); static int _unur_upd_mode_ig( UNUR_DISTR *distr ); static int _unur_upd_area_ig( UNUR_DISTR *distr ); static int _unur_set_params_ig( UNUR_DISTR *distr, const double *params, int n_params ); /*---------------------------------------------------------------------------*/ double _unur_pdf_ig( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; if (x<=0.) return 0.; else return ( sqrt(lambda/(2*M_PI*x*x*x)) * exp( -lambda*(x-mu)*(x-mu) / (2*mu*mu*x) ) ); } /* end of _unur_pdf_ig() */ /*---------------------------------------------------------------------------*/ double _unur_logpdf_ig( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; if (x<0.) return -UNUR_INFINITY; else return ( 0.5* log ( lambda/(2*M_PI*x*x*x) ) -lambda*(x-mu)*(x-mu) / (2*mu*mu*x) ); } /* end of _unur_logpdf_ig() */ /*---------------------------------------------------------------------------*/ double _unur_dpdf_ig( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; double res; if (x<=0.) return 0.; /* else */ res = -exp( -lambda*(x-mu)*(x-mu) / (2*mu*mu*x) ); res *= sqrt(lambda / (x*x*x)); res *= (3*mu*mu*x + lambda*(-mu*mu + x*x)); res /= 2*mu*mu*sqrt(2*M_PI)*x*x; return res; } /* end of _unur_dpdf_ig() */ /*---------------------------------------------------------------------------*/ double _unur_dlogpdf_ig( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; if (x<=0.) return 0.; else return (0.5 * lambda*(-1./(mu*mu) + 1./(x*x)) - 3./x); } /* end of _unur_dlogpdf_ig() */ /*---------------------------------------------------------------------------*/ double _unur_cdf_ig( double x, const UNUR_DISTR *distr ) { register const double *params = DISTR.params; #define Phi(x) (_unur_SF_cdf_normal(x)) if (x<=0.) return 0.; return ( Phi(sqrt(lambda/x)*(x/mu-1.)) + exp(2*lambda/mu) * Phi(-sqrt(lambda/x)*(x/mu+1.)) ); #undef Phi } /* end of _unur_cdf_ig() */ /*---------------------------------------------------------------------------*/ int _unur_upd_mode_ig( UNUR_DISTR *distr ) { register const double *params = DISTR.params; DISTR.mode = (-3.*mu*mu + mu*sqrt(4.*lambda*lambda + 9*mu*mu))/(2*lambda); /* mode must be in domain */ if (DISTR.mode < DISTR.domain[0]) DISTR.mode = DISTR.domain[0]; else if (DISTR.mode > DISTR.domain[1]) DISTR.mode = DISTR.domain[1]; return UNUR_SUCCESS; } /* end of _unur_upd_mode_ig() */ /*---------------------------------------------------------------------------*/ int _unur_upd_area_ig( UNUR_DISTR *distr ) { /* log of normalization constant */ LOGNORMCONSTANT = 0.; if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.area = 1.; return UNUR_SUCCESS; } /* else */ DISTR.area = ( _unur_cdf_ig( DISTR.domain[1],distr) - _unur_cdf_ig( DISTR.domain[0],distr) ); return UNUR_SUCCESS; } /* end of _unur_upd_area_ig() */ /*---------------------------------------------------------------------------*/ int _unur_set_params_ig( UNUR_DISTR *distr, const double *params, int n_params ) { /* check number of parameters for distribution */ /* check new parameter for generator */ if (n_params < 2) { _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } if (n_params > 2) { _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); n_params = 2; } CHECK_NULL(params,UNUR_ERR_NULL); /* check parameter a */ if (mu <= 0.) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"mu <= 0"); return UNUR_ERR_DISTR_DOMAIN; } if (lambda <= 0.) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"lambda <= 0"); return UNUR_ERR_DISTR_DOMAIN; } /* copy parameters for standard form */ DISTR.mu = mu; DISTR.lambda = lambda; /* default parameters: none */ /* copy optional parameters: none */ /* store number of parameters */ DISTR.n_params = n_params; /* set (standard) domain */ if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.domain[0] = 0.; /* left boundary */ DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ } return UNUR_SUCCESS; } /* end of _unur_set_params_ig() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Make distribution object **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_ig( const double *params, int n_params ) { register struct unur_distr *distr; /* get new (empty) distribution object */ distr = unur_distr_cont_new(); /* set distribution id */ distr->id = UNUR_DISTR_IG; /* name of distribution */ distr->name = distr_name; /* how to get special generators */ DISTR.init = NULL; /* _unur_stdgen_ig_init */ /* functions */ DISTR.pdf = _unur_pdf_ig; /* pointer to PDF */ DISTR.logpdf = _unur_logpdf_ig; /* pointer to logPDF */ DISTR.dpdf = _unur_dpdf_ig; /* pointer to derivative of PDF */ DISTR.dlogpdf = _unur_dlogpdf_ig; /* pointer to derivative of logPDF */ DISTR.cdf = _unur_cdf_ig; /* pointer to CDF */ /* DISTR.invcdf = _unur_invcdf_ig; pointer to inverse CDF */ /* indicate which parameters are set */ distr->set = ( UNUR_DISTR_SET_DOMAIN | UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_MODE | UNUR_DISTR_SET_PDFAREA ); /* set parameters for distribution */ if (_unur_set_params_ig(distr,params,n_params)!=UNUR_SUCCESS) { free(distr); return NULL; } /* log of normalization constant */ LOGNORMCONSTANT = 0; /* mode and area below p.d.f. */ _unur_upd_mode_ig(distr); DISTR.area = 1.; /* function for setting parameters and updating domain */ DISTR.set_params = _unur_set_params_ig; /* function for updating derived parameters */ DISTR.upd_mode = _unur_upd_mode_ig; /* funct for computing mode */ DISTR.upd_area = _unur_upd_area_ig; /* funct for computing area */ /* return pointer to object */ return distr; } /* end of unur_distr_ig() */ /*---------------------------------------------------------------------------*/ #undef mu #undef lambda #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/c_hyperbolic.c0000644001357500135600000002525314420445767016360 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: c_hyperbolic.c * * * * REFERENCES: * * * ***************************************************************************** * * * distr: Hyperbolic distribution * * * * pdf: f(x) = exp( -alpha * sqrt(delta^2 + (x - mu)^2) + beta*(x-mu) ) * * domain: infinity < x < infinity * * constant: gamma / (2 * alpha * delta * K_1(delta * gamma) * * [gamma = sqrt(alpha^2 - beta^2) ] * * [K_theta(.) ... modified Bessel function of second (third) kind] * * * * parameters: 4 * * 0 : alpha >|beta| ... shape (tail) * * 1 : beta ... shape (asymmetry) * * 2 : delta > 0 ... scale * * 3 : mu ... location * * * ***************************************************************************** * * * Copyright (c) 2000-2012 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "unur_distributions.h" #include "unur_distributions_source.h" #include "unur_stddistr.h" /*---------------------------------------------------------------------------*/ static const char distr_name[] = "hyperbolic"; /* parameters */ #define alpha params[0] /* shape (tail) */ #define beta params[1] /* shape (asymmetry) */ #define delta params[2] /* scale */ #define mu params[3] /* location */ #define DISTR distr->data.cont #define NORMCONSTANT (distr->data.cont.norm_constant) /* function prototypes */ static double _unur_pdf_hyperbolic( double x, const UNUR_DISTR *distr ); static double _unur_logpdf_hyperbolic( double x, const UNUR_DISTR *distr ); static double _unur_dpdf_hyperbolic( double x, const UNUR_DISTR *distr ); static double _unur_dlogpdf_hyperbolic( double x, const UNUR_DISTR *distr ); /* static double _unur_cdf_hyperbolic( double x, const UNUR_DISTR *distr ); */ static int _unur_upd_mode_hyperbolic( UNUR_DISTR *distr ); static double _unur_normconstant_hyperbolic( const double *params, int n_params ); static int _unur_set_params_hyperbolic( UNUR_DISTR *distr, const double *params, int n_params ); /*---------------------------------------------------------------------------*/ double _unur_pdf_hyperbolic(double x, const UNUR_DISTR *distr) { register const double *params = DISTR.params; return (NORMCONSTANT * exp(-alpha * sqrt(delta*delta + (x-mu)*(x-mu)) + beta*(x-mu) ) ); } /* end of _unur_pdf_hyperbolic() */ /*---------------------------------------------------------------------------*/ double _unur_logpdf_hyperbolic(double x, const UNUR_DISTR *distr) { register const double *params = DISTR.params; return (-alpha * sqrt(delta*delta + (x-mu)*(x-mu)) + beta*(x-mu) + log(NORMCONSTANT) ); } /* end of _unur_logpdf_hyperbolic() */ /*---------------------------------------------------------------------------*/ double _unur_dpdf_hyperbolic(double x, const UNUR_DISTR *distr) { return (NORMCONSTANT * _unur_pdf_hyperbolic(x,distr) * _unur_dlogpdf_hyperbolic(x,distr)); } /* end of _unur_dpdf_hyperbolic() */ /*---------------------------------------------------------------------------*/ double _unur_dlogpdf_hyperbolic(double x, const UNUR_DISTR *distr) { register const double *params = DISTR.params; return (beta - (alpha*(x-mu))/sqrt(delta*delta + (x-mu)*(x-mu)) + log(NORMCONSTANT)); } /* end of _unur_dlogpdf_hyperbolic() */ /*---------------------------------------------------------------------------*/ int _unur_upd_mode_hyperbolic( UNUR_DISTR *distr ) { register const double *params = DISTR.params; DISTR.mode = mu + delta*beta / sqrt(alpha*alpha - beta*beta); /* mode must be in domain */ if (DISTR.mode < DISTR.domain[0]) DISTR.mode = DISTR.domain[0]; else if (DISTR.mode > DISTR.domain[1]) DISTR.mode = DISTR.domain[1]; return UNUR_SUCCESS; } /* end of _unur_upd_mode_hyperbolic() */ /*---------------------------------------------------------------------------*/ double _unur_normconstant_hyperbolic(const double *params ATTRIBUTE__UNUSED, int n_params ATTRIBUTE__UNUSED) { #ifdef _unur_SF_bessel_k double gamm = sqrt(alpha*alpha-beta*beta); /* * constant: gamma / (2 * alpha * delta * K_1(delta * gamma) * * [gamma = sqrt(alpha^2 - beta^2) ] * * [K_theta(.) ... modified Bessel function of second kind] * */ return ( gamm / ( 2 * alpha * delta * _unur_SF_bessel_k(delta*gamm, 1) ) ); #else return 1.; #endif } /* end of _unur_normconstant_hyperbolic() */ /*---------------------------------------------------------------------------*/ int _unur_set_params_hyperbolic( UNUR_DISTR *distr, const double *params, int n_params ) { /* check number of parameters for distribution */ if (n_params < 4) { _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } if (n_params > 4) { _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); n_params = 4; } CHECK_NULL(params,UNUR_ERR_NULL); /* check parameter omega */ if (delta <= 0.) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"delta <= 0"); return UNUR_ERR_DISTR_DOMAIN; } if (alpha <= fabs(beta)) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"alpha <= |beta|"); return UNUR_ERR_DISTR_DOMAIN; } /* copy parameters for standard form */ DISTR.mu = mu; DISTR.alpha = alpha; DISTR.beta = beta; DISTR.delta = delta; /* default parameters: none */ /* store number of parameters */ DISTR.n_params = n_params; /* set (standard) domain */ if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.domain[0] = -UNUR_INFINITY; /* left boundary */ DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ } return UNUR_SUCCESS; } /* end of _unur_set_params_hyperbolic() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_hyperbolic( const double *params, int n_params ) { register struct unur_distr *distr; /* get new (empty) distribution object */ distr = unur_distr_cont_new(); /* set distribution id */ distr->id = UNUR_DISTR_HYPERBOLIC; /* name of distribution */ distr->name = distr_name; /* how to get special generators */ /* DISTR.init = _unur_stdgen_hyperbolic_init; */ /* functions */ DISTR.pdf = _unur_pdf_hyperbolic; /* pointer to PDF */ DISTR.logpdf = _unur_logpdf_hyperbolic; /* pointer to logPDF */ DISTR.dpdf = _unur_dpdf_hyperbolic; /* pointer to derivative of PDF */ DISTR.dlogpdf = _unur_dlogpdf_hyperbolic; /* pointer to derivative of logPDF */ DISTR.cdf = NULL; /* _unur_cdf_hyperbolic; pointer to CDF */ /* indicate which parameters are set */ distr->set = ( UNUR_DISTR_SET_DOMAIN | UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_MODE ); /* UNUR_DISTR_SET_PDFAREA ); */ /* set parameters for distribution */ if (_unur_set_params_hyperbolic(distr,params,n_params)!=UNUR_SUCCESS) { free(distr); return NULL; } /* normalization constant */ NORMCONSTANT = _unur_normconstant_hyperbolic(DISTR.params,DISTR.n_params); /* mode and area below p.d.f. */ _unur_upd_mode_hyperbolic(distr); /* DISTR.area = ? */ /* function for setting parameters and updating domain */ DISTR.set_params = _unur_set_params_hyperbolic; /* function for updating derived parameters */ DISTR.upd_mode = _unur_upd_mode_hyperbolic; /* funct for computing mode */ /* DISTR.upd_area = _unur_upd_area_hyperbolic; funct for computing area */ /* return pointer to object */ return distr; } /* end of unur_distr_hyperbolic() */ /*---------------------------------------------------------------------------*/ #undef mu #undef alpha #undef beta #undef delta #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/vc_multicauchy.c0000644001357500135600000003610114420445767016727 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: vc_multicauchy.c * * * * REFERENCES: * * * * [5] S. Kotz, N. Balakrishnan, and N.L. Johnson * * Continuous Multivariate Distributions, * * Volume 1: Models and Applications * * John Wiley & Sons, Inc., New York, 2000 * ***************************************************************************** * * * distr: Multivariate Cauchy distribution [5; ch.45, p.219] * * * * pdf: f(x) = 1 / ( 1 + (x-mu)^t . Sigma^-1 . (x-mu) )^(dim+1)/2 * * domain: Reals^(dim) * * constant: Gamma((dim+1)/2) / ( pi^((dim+1)/2) * sqrt(det(Sigma)) ) * * * * parameters: * * 0: mean ... mu (default : 0-vector) * * 1: "covar" ... Sigma (default : identity matrix) * * * ***************************************************************************** * * * standard form * * * * pdf: f(x) = 1 / ( 1 + x^t . x )^(dim+1)/2 * * domain: Reals^(dim) * * constant: Gamma((dim+1)/2) / pi^((dim+1)/2) * * * * parameters: * * none * * * * mean = (0,...,0) ... 0-vector * * covar = identity matrix * * * ***************************************************************************** * * * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include "unur_distributions.h" #include "unur_distributions_source.h" #include "unur_stddistr.h" #ifdef USE_DEPRECATED_CODE # include #endif /*---------------------------------------------------------------------------*/ static const char distr_name[] = "multicauchy"; /*---------------------------------------------------------------------------*/ /* parameters */ /*---------------------------------------------------------------------------*/ #define DISTR distr->data.cvec #define LOGNORMCONSTANT (distr->data.cvec.norm_constant) /*---------------------------------------------------------------------------*/ /* function prototypes */ static double _unur_pdf_multicauchy( const double *x, UNUR_DISTR *distr ); static double _unur_logpdf_multicauchy( const double *x, UNUR_DISTR *distr ); static int _unur_dlogpdf_multicauchy( double *result, const double *x, UNUR_DISTR *distr ); static double _unur_pdlogpdf_multicauchy( const double *x, int coord, UNUR_DISTR *distr ); static int _unur_upd_mode_multicauchy( UNUR_DISTR *distr ); static int _unur_upd_volume_multicauchy( UNUR_DISTR *distr ); /*---------------------------------------------------------------------------*/ double _unur_pdf_multicauchy( const double *x, UNUR_DISTR *distr ) { return exp( _unur_logpdf_multicauchy( x, distr ) ); } /* end of _unur_pdf_multicauchy() */ /*---------------------------------------------------------------------------*/ double _unur_logpdf_multicauchy( const double *x, UNUR_DISTR *distr ) { #define idx(a,b) ((a)*dim+(b)) int i,j, dim; double *mean; const double *covar_inv; double xx; /* argument used in the evaluation of exp(-xx/2) */ double cx; /* element of multiplication of covariance matrix and x */ dim = distr->dim; if (DISTR.mean == NULL) { if (DISTR.covar != NULL) { _unur_warning(distr->name,UNUR_ERR_SHOULD_NOT_HAPPEN,""); } /* standard form */ xx=0.; for (i=0; idim; mean = DISTR.mean; /* get inverse of covariance matrix */ covar_inv = unur_distr_cvec_get_covar_inv(distr); if (covar_inv==NULL) /* inverse of covariance matrix not available */ return UNUR_FAILURE; /* calculating (x-mean)' Sigma^-1 (x-mean) */ xx=0.; for (i=0; idim; double *mean = DISTR.mean; /* check arguments */ if (coord < 0 || coord >= dim) { _unur_warning(distr->name,UNUR_ERR_DISTR_DOMAIN,"invalid coordinate"); return UNUR_INFINITY; } /* get inverse of covariance matrix */ covar_inv = unur_distr_cvec_get_covar_inv(distr); if (covar_inv==NULL) /* inverse of covariance matrix not available */ return UNUR_INFINITY; /* calculating (x-mean)' Sigma^-1 (x-mean) */ xx=0.; for (i=0; idim * sizeof(double) ); memcpy( DISTR.mode, DISTR.mean, distr->dim * sizeof(double) ); return UNUR_SUCCESS; } /* end of _unur_upd_mode_multicauchy() */ /*---------------------------------------------------------------------------*/ int _unur_upd_volume_multicauchy( UNUR_DISTR *distr ) { /* TODO: checking for modified domain */ double det_covar; /* log of normalization constant */ det_covar = (DISTR.covar == NULL) ? 1. : _unur_matrix_determinant(distr->dim, DISTR.covar); LOGNORMCONSTANT = _unur_SF_ln_gamma((distr->dim+1)/2.) - ( (distr->dim+1) * log(M_PI) + log(det_covar) ) / 2.; return UNUR_SUCCESS; } /* end of _unur_upd_volume_multicauchy() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Make distribution object **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_multicauchy( int dim, const double *mean, const double *covar ) /* @code{UNUR_DISTR *unur_distr_multicauchy(int dim, const double *mean, const double *covar)} creates a distribution object for the multivariate Cauchy distribution with @var{dim} components. @var{mean} is an array of size @var{dim}. A NULL pointer for @var{mean} is interpreted as the zero vector (0,@dots{},0). @var{covar} is an array of size @var{dim}x@var{dim} and holds the covariance matrix, where the rows of the matrix are stored consecutively in this array. The NULL pointer can be used instead the identity matrix. If @var{covar} is not a valid covariance matrix (i.e., not positive definite) then no distribution object is created and NULL is returned. For standard form of the distribution use the null vector for @var{mean} and the identity matrix for @var{covar}. */ { struct unur_distr *distr; double det_covar; /* determinant of covariance matrix */ /* get new (empty) distribution object */ distr = unur_distr_cvec_new(dim); /* check new parameter for generator */ if (distr == NULL) { /* error: dim < 1 */ return NULL; } /* set distribution id */ distr->id = UNUR_DISTR_MCAUCHY; /* name of distribution */ distr->name = distr_name; /* how to get special generators */ DISTR.init = NULL; /* copy (and check) parameters */ if ((unur_distr_cvec_set_mean(distr,mean)!=UNUR_SUCCESS) || (unur_distr_cvec_set_covar(distr,covar)!=UNUR_SUCCESS) ) { unur_distr_free( distr ); return NULL; } /* functions */ DISTR.pdf = _unur_pdf_multicauchy; /* pointer to PDF */ DISTR.logpdf = _unur_logpdf_multicauchy; /* pointer to logPDF */ DISTR.dpdf = _unur_distr_cvec_eval_dpdf_from_dlogpdf; /* pointer to gradient of PDF */ DISTR.dlogpdf = _unur_dlogpdf_multicauchy; /* pointer to gradient of logPDF */ DISTR.pdpdf = _unur_distr_cvec_eval_pdpdf_from_pdlogpdf; /* pointer to part. deriv. of PDF */ DISTR.pdlogpdf = _unur_pdlogpdf_multicauchy; /* pointer to partial derivative of logPDF */ #ifdef USE_DEPRECATED_CODE /* set standardized marginal distributions */ { struct unur_distr *stdmarginal = unur_distr_cauchy(NULL,0); unur_distr_cvec_set_stdmarginals(distr,stdmarginal); unur_distr_free(stdmarginal); } #endif /* copy other parameters of distribution */ /* none */ /* number of other parameters */ /* DISTR.n_params = 0; ... default */ /* domain */ /* log of normalization constant */ /* constant: Gamma((dim+1)/2) / ( pi^((dim+1)/2) * sqrt(det(Sigma)) ) */ det_covar = (DISTR.covar == NULL) ? 1. : _unur_matrix_determinant(dim, DISTR.covar); LOGNORMCONSTANT = _unur_SF_ln_gamma((distr->dim+1)/2.) - ( (distr->dim+1) * log(M_PI) + log(det_covar) ) / 2.; /* mode */ DISTR.mode = _unur_xmalloc( distr->dim * sizeof(double) ); memcpy( DISTR.mode, DISTR.mean, distr->dim * sizeof(double) ); /* volume below p.d.f. */ DISTR.volume = 1.; /* function for updating derived parameters */ DISTR.upd_mode = _unur_upd_mode_multicauchy; /* funct for computing mode */ DISTR.upd_volume = _unur_upd_volume_multicauchy; /* funct for computing volume */ /* indicate which parameters are set (additional to mean and covariance) */ distr->set |= ( UNUR_DISTR_SET_STDDOMAIN | UNUR_DISTR_SET_PDFVOLUME | UNUR_DISTR_SET_MODE ); /* return pointer to object */ return distr; } /* end of unur_distr_multicauchy() */ /*---------------------------------------------------------------------------*/ #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/c_gig.c0000644001357500135600000003301614420445767014762 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: c_gig.c * * * * REFERENCES: * * * * [2] N.L. Johnson, S. Kotz and N. Balakrishnan * * Continuous Univariate Distributions, * * Volume 1, 2nd edition * * John Wiley & Sons, Inc., New York, 1994 * * * ***************************************************************************** * * * distr: Generalized Inverse Gaussian (GIG) distribution [2; ch.15, p.284] * * * * pdf: f(x) = x^(theta-1) * exp( -1/2 * omega * (x/eta + eta/x)) * * domain: 0 < x < infinity * * constant: 1 / (2 * eta^theta K_theta(omega)) * * [K_theta(.) ... modified Bessel function of third kind] * * K_theta(x) = 1/2 * int_-inf^inf cosh(theta*u) * exp(-x*cosh(u)) du * * * * inf * * - * * 1 | * * K_theta(omega) = - | cosh(theta*u) * exp(-omega*cosh(u)) du * * 2 | * * - * * -inf * * * * * * parameters: 3 * * 0: theta ... shape * * 1: omega > 0 ... scale * * 2: eta > 0 (1) ... shape * * * ***************************************************************************** * * * Reparametrization from "gig2": * * omega = sqrt(psi*chi) * * eta = sqrt(chi/psi) * * * ***************************************************************************** * * * Standard form: * * * * pdf: f(x) = x^(theta-1) * exp( -1/2 * omega * (x + 1/x)) * * domain: 0 < x < infinity * * constant: 2 * K_theta(omega) * * * * parameters: 2 * * 0: theta ... shape * * 1: omega > 0 ... scale * * * * 2: eta = 1 * * * ***************************************************************************** * * * Copyright (c) 2000-2012 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "unur_distributions.h" #include "unur_distributions_source.h" #include "unur_stddistr.h" /*---------------------------------------------------------------------------*/ static const char distr_name[] = "gig"; /* parameters */ #define theta params[0] /* shape */ #define omega params[1] /* scale */ #define eta params[2] /* shape */ #define DISTR distr->data.cont #define LOGNORMCONSTANT (distr->data.cont.norm_constant) /* function prototypes */ static double _unur_pdf_gig( double x, const UNUR_DISTR *distr ); static double _unur_logpdf_gig( double x, const UNUR_DISTR *distr ); static double _unur_dpdf_gig( double x, const UNUR_DISTR *distr ); static double _unur_dlogpdf_gig( double x, const UNUR_DISTR *distr ); /* static double _unur_cdf_gig( double x, const UNUR_DISTR *distr ); */ static int _unur_upd_mode_gig( UNUR_DISTR *distr ); #ifdef _unur_SF_bessel_k static double _unur_lognormconstant_gig( const double *params, int n_params ); #endif static int _unur_set_params_gig( UNUR_DISTR *distr, const double *params, int n_params ); /*---------------------------------------------------------------------------*/ double _unur_pdf_gig(double x, const UNUR_DISTR *distr) { register const double *params = DISTR.params; if (x <= 0.) /* out of support */ return 0.; return (exp( LOGNORMCONSTANT + (theta-1.) * log(x) - 0.5 * omega * (x/eta + eta/x) )); } /* end of _unur_pdf_gig() */ /*---------------------------------------------------------------------------*/ double _unur_logpdf_gig(double x, const UNUR_DISTR *distr) { register const double *params = DISTR.params; if (x <= 0.) /* out of support */ return -UNUR_INFINITY; return ( LOGNORMCONSTANT + (theta-1.) * log(x) - 0.5 * omega * (x/eta + eta/x) ); } /* end of _unur_logpdf_gig() */ /*---------------------------------------------------------------------------*/ double _unur_dpdf_gig(double x, const UNUR_DISTR *distr) { register const double *params = DISTR.params; if (x <= 0.) /* out of support */ return 0.; return ( exp( LOGNORMCONSTANT + (theta-3.) * log(x) - 0.5 * omega * (x/eta + eta/x) ) * (eta*eta*omega + 2.*eta*(theta-1.)*x - omega*x*x) / (2*eta) ); } /* end of _unur_dpdf_gig() */ /*---------------------------------------------------------------------------*/ double _unur_dlogpdf_gig(double x, const UNUR_DISTR *distr) { register const double *params = DISTR.params; if (x <= 0.) /* out of support */ return 0.; return ( -0.5*(omega*(1/eta - eta/(x*x))) + (theta-1.)/x ); } /* end of _unur_dlogpdf_gig() */ /*---------------------------------------------------------------------------*/ int _unur_upd_mode_gig( UNUR_DISTR *distr ) { register const double *params = DISTR.params; if (theta >= 1.) { /* mode of PDF(x) */ DISTR.mode = eta * (sqrt(omega*omega + (theta-1.)*(theta-1.)) + (theta-1.))/omega; } else { /* reciprocal of mode of PDF(1/x) */ DISTR.mode = eta * omega / (sqrt((1.-theta)*(1.-theta) + omega*omega)+(1.-theta)); } /* mode must be in domain */ if (DISTR.mode < DISTR.domain[0]) DISTR.mode = DISTR.domain[0]; else if (DISTR.mode > DISTR.domain[1]) DISTR.mode = DISTR.domain[1]; return UNUR_SUCCESS; } /* end of _unur_upd_mode_gig() */ /*---------------------------------------------------------------------------*/ #ifdef _unur_SF_bessel_k double _unur_lognormconstant_gig(const double *params, int n_params ATTRIBUTE__UNUSED) { double logconst = -M_LN2 - theta*log(eta); if (theta < 50) /* threshold value 50 is selected by experiments */ logconst -= _unur_SF_ln_bessel_k(omega, theta); else logconst -= _unur_SF_bessel_k_nuasympt(omega, theta, TRUE, FALSE); return logconst; } /* end of _unur_normconstant_gig() */ #endif /*---------------------------------------------------------------------------*/ int _unur_set_params_gig( UNUR_DISTR *distr, const double *params, int n_params ) { /* check number of parameters for distribution */ if (n_params < 2) { _unur_error(distr_name,UNUR_ERR_DISTR_NPARAMS,"too few"); return UNUR_ERR_DISTR_NPARAMS; } if (n_params > 3) { _unur_warning(distr_name,UNUR_ERR_DISTR_NPARAMS,"too many"); n_params = 3; } CHECK_NULL(params,UNUR_ERR_NULL); /* check parameter omega */ if (omega <= 0.) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"omega <= 0"); return UNUR_ERR_DISTR_DOMAIN; } /* check parameter eta */ if (n_params == 3 && eta <= 0.) { _unur_error(distr_name,UNUR_ERR_DISTR_DOMAIN,"eta <= 0"); return UNUR_ERR_DISTR_DOMAIN; } /* copy parameters for standard form */ DISTR.theta = theta; DISTR.omega = omega; /* default parameters */ DISTR.eta = 1.; /* copy optional parameters */ if (n_params > 2) DISTR.eta = eta; n_params = 3; /* store number of parameters */ DISTR.n_params = n_params; /* set (standard) domain */ if (distr->set & UNUR_DISTR_SET_STDDOMAIN) { DISTR.domain[0] = 0.; /* left boundary */ DISTR.domain[1] = UNUR_INFINITY; /* right boundary */ } return UNUR_SUCCESS; } /* end of _unur_set_params_gig() */ /*---------------------------------------------------------------------------*/ struct unur_distr * unur_distr_gig( const double *params, int n_params ) { register struct unur_distr *distr; /* get new (empty) distribution object */ distr = unur_distr_cont_new(); /* set distribution id */ distr->id = UNUR_DISTR_GIG; /* name of distribution */ distr->name = distr_name; /* how to get special generators */ DISTR.init = _unur_stdgen_gig_init; /* functions */ DISTR.pdf = _unur_pdf_gig; /* pointer to PDF */ DISTR.logpdf = _unur_logpdf_gig; /* pointer to logPDF */ DISTR.dpdf = _unur_dpdf_gig; /* pointer to derivative of PDF */ DISTR.dlogpdf = _unur_dlogpdf_gig; /* pointer to derivative of logPDF */ DISTR.cdf = NULL; /* _unur_cdf_gig; pointer to CDF */ /* indicate which parameters are set */ distr->set = ( UNUR_DISTR_SET_DOMAIN | UNUR_DISTR_SET_STDDOMAIN | #ifdef _unur_SF_bessel_k UNUR_DISTR_SET_PDFAREA | #endif UNUR_DISTR_SET_MODE ); /* set parameters for distribution */ if (_unur_set_params_gig(distr,params,n_params)!=UNUR_SUCCESS) { free(distr); return NULL; } /* log of normalization constant */ #ifdef _unur_SF_bessel_k LOGNORMCONSTANT = _unur_lognormconstant_gig(DISTR.params,DISTR.n_params); #else LOGNORMCONSTANT = 0.; #endif /* mode and area below p.d.f. */ _unur_upd_mode_gig(distr); #ifdef _unur_SF_bessel_k DISTR.area = 1.; #endif /* function for setting parameters and updating domain */ DISTR.set_params = _unur_set_params_gig; /* function for updating derived parameters */ DISTR.upd_mode = _unur_upd_mode_gig; /* funct for computing mode */ /* DISTR.upd_area = _unur_upd_area_gig; funct for computing area */ /* return pointer to object */ return distr; } /* end of unur_distr_gig() */ /*---------------------------------------------------------------------------*/ #undef theta #undef omega #undef eta #undef DISTR /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/distributions/c_powerexponential_gen.c0000644001357500135600000002315114420445767020447 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: c_powerexponential_gen.c * * * * Special generators for Power-exponential distribution * * * ***************************************************************************** * * * Copyright (c) 2000-2010 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include "unur_distributions_source.h" /*---------------------------------------------------------------------------*/ /* init routines for special generators */ inline static int powerexponential_epd_init( struct unur_gen *gen ); /*---------------------------------------------------------------------------*/ /* abbreviations */ #define PAR ((struct unur_cstd_par*)par->datap) /* data for parameter object */ #define GEN ((struct unur_cstd_gen*)gen->datap) /* data for generator object */ #define DISTR gen->distr->data.cont /* data for distribution in generator object */ /* #define MAX_gen_params (2) maximal number of parameters for generator */ #define uniform() _unur_call_urng(gen->urng) /* call for uniform prng */ /*---------------------------------------------------------------------------*/ #define tau (DISTR.params[0]) /* shape */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Inititialize **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ int _unur_stdgen_powerexponential_init( struct unur_par *par, struct unur_gen *gen ) /*----------------------------------------------------------------------*/ /* initialize special generator for power-exponential distribution */ /* if gen == NULL then only check existance of variant. */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* gen ... pointer to generator object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { /* one of par and gen must not be the NULL pointer */ switch ((par) ? par->variant : gen->variant) { case 0: /* DEFAULT */ case 1: /* Transformed density rejection */ { /* check parameters of distribution */ double d_tau = (par) ? par->distr->data.cont.params[0] : tau; if (d_tau < 1.) { _unur_error(NULL,UNUR_ERR_GEN_CONDITION,""); return UNUR_ERR_GEN_CONDITION; } } /* tau >= 1 !!!! */ _unur_cstd_set_sampling_routine(gen, _unur_stdgen_sample_powerexponential_epd ); return powerexponential_epd_init( gen ); default: /* no such generator */ return UNUR_FAILURE; } } /* end of _unur_stdgen_powerexponential_init() */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Special generators **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ /***************************************************************************** * * * Powerexponential Distribution: Transformed density rejection * * * ***************************************************************************** * * * FUNCTION: - samples a random number from the Power-exponential * * distribution with parameter tau >= 1 by using the * * non-universal rejection method for logconcave densities. * * * * REFERENCE: - L. Devroye (1986): Non-Uniform Random Variate Generation, * * Springer Verlag, New York. * * * * Implemented by K. Lehner, 1990 * * Revised by F. Niederl, August 1992 * ***************************************************************************** * WinRand (c) 1995 Ernst Stadlober, Institut fuer Statistitk, TU Graz * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #define GEN_N_PARAMS (2) #define s GEN->gen_param[0] #define sm1 GEN->gen_param[1] /*---------------------------------------------------------------------------*/ inline static int powerexponential_epd_init( struct unur_gen *gen ) { /* check arguments */ CHECK_NULL(gen,UNUR_ERR_NULL); COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_ERR_COOKIE); if (GEN->gen_param == NULL || GEN->n_gen_param != GEN_N_PARAMS) { GEN->n_gen_param = GEN_N_PARAMS; GEN->gen_param = _unur_xrealloc(GEN->gen_param, GEN->n_gen_param * sizeof(double)); } /* -X- setup code -X- */ s = 1. / tau; sm1 = 1. - s; /* -X- end of setup code -X- */ return UNUR_SUCCESS; } /* end of powerexponential_epd_init() */ double _unur_stdgen_sample_powerexponential_epd( struct unur_gen *gen ) { /* -X- generator code -X- */ double U,u1,V,X,y; /* check arguments */ CHECK_NULL(gen,UNUR_INFINITY); COOKIE_CHECK(gen,CK_CSTD_GEN,UNUR_INFINITY); do { U = 2. * uniform() - 1.; /* U(-1.0/1.0) */ u1 = fabs(U); /* u1=|u| */ V = uniform(); /* U(0/1) */ if (u1 <= sm1) /* Uniform hat-function for x <= (1-1/tau) */ X = u1; else { /* Exponential hat-function for x > (1-1/tau) */ y = tau * (1. - u1); /* U(0/1) */ X = sm1 - s * log(y); V *= y; } } while (log(V) > -exp(log(X)*tau)); /* Acceptance/Rejection */ /* Random sign */ if (U > 0.) X = -X; /* -X- end of generator code -X- */ return X; } /* end of _unur_stdgen_sample_powerexponential_epd() */ /*---------------------------------------------------------------------------*/ #undef GEN_N_PARAMS #undef s #undef sm1 /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/unuran.h.in0000644001357500135600000002111014430713333012706 00000000000000/***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: unuran.h * * * * PURPOSE: * * defines macros and declares structures and function prototypes * * for all UNU.RAN methods * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifndef UNURAN_H_IN_SEEN #define UNURAN_H_IN_SEEN /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** Basic header files **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ /* basic header files */ #include #include #include /*****************************************************************************/ /** Typedefs **/ /*****************************************************************************/ #include /*****************************************************************************/ /** Declarations for uniform random number generators **/ /*****************************************************************************/ #include #include #include #include /* The following are now separate header files! */ /* #include */ /* #include */ /* #include */ /* #include */ /*****************************************************************************/ /** Function prototypes for manipulating distribution objects **/ /*****************************************************************************/ #include #include #include #include #include #include #include #include #include #include /*****************************************************************************/ /** Function prototypes for manipulating generator objects **/ /*****************************************************************************/ /* automatically selected method */ #include /* methods for discrete distributions */ #include #include #include #include #include /* methods for continuous distributions */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* methods for continuous multivariate distributions */ #include #include #include #include /* methods for Markov chain sampler */ #include #include /* wrapper for special generators for standard distributions */ #include /* continuous */ #include /* discrete */ #include /* multivariate continuous */ /* meta methods */ #include /* wrapper for external random variate generators */ #include /* continuous */ #include /* discrete */ /* wrapper for uniform random number generator */ #include /*****************************************************************************/ /** IDs for generating methods **/ /*****************************************************************************/ #include /*****************************************************************************/ /** Deprecated routines **/ /*****************************************************************************/ #include #include #include #include /*****************************************************************************/ /** String parser **/ /*****************************************************************************/ #include /*****************************************************************************/ /** Invoke generators **/ /*****************************************************************************/ #include /*****************************************************************************/ /** Distributions **/ /*****************************************************************************/ #include /*****************************************************************************/ /** Debugging and Error messages **/ /*****************************************************************************/ #include #include #include #include /*****************************************************************************/ /** Additional header files for further function prototypes **/ /*****************************************************************************/ #include #include #ifndef TRUE #define TRUE (1) #endif #ifndef FALSE #define FALSE (0) #endif /*---------------------------------------------------------------------------*/ #endif /* UNURAN_H_IN_SEEN */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/utils/0000755001357500135600000000000014430713512012044 500000000000000unuran-1.11.0/src/utils/error.h0000644001357500135600000002630714420445767013313 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: error.h * * * * PURPOSE: * * Global variables and prototypes for error handling. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* =NODE Error_reporting Error reporting =UP Error_Debug [30] =DESCRIPTION UNU.RAN routines report an error whenever they cannot perform the requested task. For example, applying transformed density rejection to a distribution that violates the T-concavity condition, or trying to set a parameter that is out of range, result in an error message. It might also happen that the setup fails for transformed density rejection for a T-concave distribution with some extreme density function simply because of round-off errors that makes the generation of a hat function numerically impossible. Situations like this may happen when using black box algorithms and you should check the return values of all routines. All @command{..._set_...}, and @command{..._chg_...} calls return @code{UNUR_SUCCESS} if they could be executed successfully. Otherwise, some error codes are returned if it was not possible to set or change the desired parameters, e.g. because the given values are out of range, or simply because the set call does not work for the chosen method. All routines that return a pointer to the requested object will return a NULL pointer in case of error. (Thus you should always check the pointer to avoid possible segmentation faults. Sampling routines usually do not check the given pointer to the generator object.) The library distinguishes between two major classes of error: @table @emph @item (fatal) errors: The library was not able to construct the requested object. @item warnings: Some problems encounters while constructing a generator object. The routine has tried to solve the problem but the resulting object might not be what you want. For example, chosing a special variant of a method does not work and the initialization routine might switch to another variant. Then the generator produces random variates of the requested distribution but correlation induction is not possible. However, it also might happen that changing the domain of a distribution has failed. Then the generator produced random variates with too large/too small range, i.e. their distribution is not correct. @end table It is obvious from the example that this distinction between errors and warning is rather crude and sometimes arbitrary. UNU.RAN routines use the global variable @var{unur_errno} to report errors, completely analogously to @var{errno} in the ANSI C standard library. (However this approach is not thread-safe. There can be only one instance of a global variable per program. Different threads of execution may overwrite @var{unur_errno} simultaneously). Thus when an error occurs the caller of the routine can examine the error code in @var{unur_errno} to get more details about the reason why a routine failed. You get a short description of the error by a unur_get_strerror() call. All the error code numbers have prefix @code{UNUR_ERR_} and expand to non-zero constant unsigned integer values. Error codes are divided into six main groups, see @ref{Errno,,Error codes}. Alternatively, the variable @var{unur_errno} can also read by a unur_get_errno() call and can be reset by the unur_reset_errno() call (this is in particular required for the Windows version of the library). Additionally, there exists a error handler (@pxref{Error_handlers,,Error handlers}) that is invoked in case of an error. In addition to reporting errors by setting error codes in @var{unur_errno}, the library also has an error handler function. This function is called by other library functions when they report an error, just before they return to the caller (@pxref{Error_handlers,,Error handlers}). The default behavior of the error handler is to print a short message: @example AROU.004: [error] arou.c:1500 - (generator) condition for method violated: AROU.004: ..> PDF not unimodal @end example The purpose of the error handler is to provide a function where a breakpoint can be set that will catch library errors when running under the debugger. It is not intended for use in production programs, which should handle any errors using the return codes. =END */ /*---------------------------------------------------------------------------*/ /* =ROUTINES */ extern int unur_errno; /* Global variable for reporting diagnostics of error. */ int unur_get_errno ( void ); /* Get current value of global variable @var{unur_errno}. */ void unur_reset_errno ( void ); /* Reset global variable @var{unur_errno} to @code{UNUR_SUCCESS} (i.e., no errors occured). */ const char *unur_get_strerror ( const int errnocode ); /* Get a short description for error code value. */ /* =END */ /* =EON */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* =NODE Error_handlers Error handlers =UP Error_Debug [50] =DESCRIPTION The default behavior of the UNU.RAN error handler is to print a short message onto the output stream, usually a logfile (@pxref{Output_streams,,Output streams}), e.g., @example AROU.004: [error] arou.c:1500 - (generator) condition for method violated: AROU.004: ..> PDF not unimodal @end example This error handler can be switched off using the unur_set_error_handler_off() call, or replace it by a new one. Thus it allows to set a breakpoint that will catch library errors when running under the debugger. It also can be used to redirect error messages when UNU.RAN is included in general purpose libraries or in interactive programming environments. @deftp {Data Type} UNUR_ERROR_HANDLER This is the type of UNU.RAN error handler functions. An error handler will be passed six arguments which specify the identifier of the object where the error occured (a string), the name of the source file in which it occurred (also a string), the line number in that file (an integer), the type of error (a string: @code{"error"} or @code{"warning"}), the error number (an integert), and the reason for the error (a string). The source file and line number are set at compile time using the @code{__FILE__} and @code{__LINE__} directives in the preprocessor. The error number can be translated into a short description using a unur_get_strerror() call. An error handler function returns type @code{void}. Error handler functions should be defined like this, @example void my_handler( @ @ @ @ @ @ @ @ @ @ @ const char *objid, @ @ @ @ @ @ @ @ @ @ @ const char *file, @ @ @ @ @ @ @ @ @ @ @ int line, @ @ @ @ @ @ @ @ @ @ @ const char *errortype, @ @ @ @ @ @ @ @ @ @ @ int unur_errno, @ @ @ @ @ @ @ @ @ @ @ const char *reason ) @end example @end deftp To request the use of your own error handler you need the call unur_set_error_handler(). =END */ /* =ROUTINES */ UNUR_ERROR_HANDLER *unur_set_error_handler( UNUR_ERROR_HANDLER *new_handler ); /* This function sets a new error handler, @var{new_handler}, for the UNU.RAN library routines. The previous handler is returned (so that you can restore it later). Note that the pointer to a user defined error handler function is stored in a static variable, so there can be only one error handler per program. This function should be not be used in multi-threaded programs except to set up a program-wide error handler from a master thread. To use the default behavior set the error handler to NULL. */ UNUR_ERROR_HANDLER *unur_set_error_handler_off( void ); /* This function turns off the error handler by defining an error handler which does nothing (except of setting @var{unur_errno}. The previous handler is returned (so that you can restore it later). */ /* =END */ /* =EON */ /*---------------------------------------------------------------------------*/ /* @example void my_handler( const char *objid, const char *file, int line, const char *errortype, int unur_errno, const char *reason ); void handler (const char * reason, const char * file, int line, int gsl_errno) @end example */ unuran-1.11.0/src/utils/lobatto_struct.h0000644001357500135600000000767514420445767015241 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: lobatto_struct.h * * * * PURPOSE: * * declares structures for Gauss-Lobatto integration * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* 'Lobatto object': */ /* store integrand, boundaries and integrals of subintervals computed */ /* during adaptive Gauss-Lobatto integration. */ struct unur_lobatto_nodes { double x; /* right boundary of subinterval */ double u; /* integral of PDF over subinterval */ }; struct unur_lobatto_table { struct unur_lobatto_nodes *values; /* boundaries and integral values */ int n_values; /* number of stored integral values (nodes) */ int cur_iv; /* position of first entry whose x value is larger than left boundary of current interval*/ int size; /* size of table */ UNUR_LOBATTO_FUNCT *funct; /* pointer to integrand */ struct unur_gen *gen; /* pointer to generator object */ double tol; /* tolerated ABSOLUTE integration error */ UNUR_LOBATTO_ERROR *uerror; /* function for estimating error */ double bleft; /* left boundary of computational domain */ double bright; /* right boundary of computational domain */ double integral; /* integral over whole domain */ }; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/utils/slist_struct.h0000644001357500135600000000576714420304141014707 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: slist_struct.h * * * * PURPOSE: * * declares structures for simple list * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Store simple list. */ struct unur_slist { void **ptr; /* pointer to array with pointers to list elements */ int n_ptr; /* number of list elements */ #ifdef UNUR_COOKIES unsigned cookie; /* magic cookie */ #endif }; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/utils/string.c0000644001357500135600000002036614420445767013462 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: string.c * * * * routines for handling strings * * * ***************************************************************************** * * * Copyright (c) 2000-2011 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #define MEMBLOCKSIZE 128 /* block size for allocating memory */ #define MAXSTRINGSIZE 1024 /* maximum size of printed string */ /*---------------------------------------------------------------------------*/ struct unur_string * _unur_string_new ( void ) /*----------------------------------------------------------------------*/ /* Make new string */ /* */ /* parameters: none */ /*----------------------------------------------------------------------*/ { struct unur_string *string; string = _unur_xmalloc(sizeof(struct unur_string)); string->text = NULL; string->length = 0; string->allocated = 0; return string; } /* end of _unur_string_new() */ /*---------------------------------------------------------------------------*/ int _unur_string_append ( struct unur_string *string, const char *format, ... ) /*----------------------------------------------------------------------*/ /* Append to string */ /* */ /* parameters: */ /* string ... structure for string */ /* format ... format for sprintf() */ /* ... ... (optional) arguments to be be printed */ /* */ /* Important! */ /* The generated string must not be longer than 1023 characters! */ /*----------------------------------------------------------------------*/ { size_t len; va_list ap; /* optional list of arguments */ va_start(ap, format); /* Resize the allocated memory if necessary */ while (string->length + MAXSTRINGSIZE + 1 > string->allocated) { string->allocated += MEMBLOCKSIZE; string->text = _unur_xrealloc( string->text, (size_t)string->allocated ); } /* print into string */ #if HAVE_DECL_VSNPRINTF /* this is part of ISO C99 */ len = vsnprintf (string->text+string->length, (size_t)MAXSTRINGSIZE, format, ap); #else #error Function vsnprintf() required. /* Fallback: */ /** TODO: this is dangerous, since we have to take care, that the generated string text is not longer than MAXSTRINGSIZE-1. **/ /* len = vsprintf (string->text+string->length, format, ap); */ /* if (len >= MAXSTRINGSIZE) { */ /* _unur_error("UTIL",UNUR_ERR_SHOULD_NOT_HAPPEN,"string too long"); */ /* exit (-1); /\* fatal error *\/ */ /* } */ #endif /* update length of string */ string->length += len; /* close optional list of arguments */ va_end(ap); return UNUR_SUCCESS; } /* end of _unur_string_append() */ /*---------------------------------------------------------------------------*/ int _unur_string_appendtext ( struct unur_string *string, const char *text ) /*----------------------------------------------------------------------*/ /* Append text to string */ /* */ /* parameters: */ /* string ... structure for stringing string */ /* text ... char array with text to be appended */ /*----------------------------------------------------------------------*/ { int len; /* length of text string */ len = strlen(text); /* Resize the allocated memory if necessary */ while (string->length + len + 1 > string->allocated) { string->allocated += MEMBLOCKSIZE; string->text = _unur_xrealloc( string->text, (size_t)string->allocated ); } /* copy text into string */ strncpy( string->text+string->length, text, len+1 ); /* update length of string */ string->length += len; return UNUR_SUCCESS; } /* end of _unur_string_appendtext() */ /*---------------------------------------------------------------------------*/ void _unur_string_free ( struct unur_string *string ) /*----------------------------------------------------------------------*/ /* Destroy string (free all memory) */ /* */ /* parameters: */ /* string ... structure for stringing string */ /*----------------------------------------------------------------------*/ { if (string) { if (string->text) free (string->text); free (string); string = NULL; } } /* end of _unur_string_free() */ /*---------------------------------------------------------------------------*/ void _unur_string_clear ( struct unur_string *string ) /*----------------------------------------------------------------------*/ /* Clear string (set length of string to 0) */ /* */ /* parameters: */ /* string ... structure for stringing string */ /*----------------------------------------------------------------------*/ { if (string) { string->length = 0; *(string->text) = '\0'; } } /* end of _unur_string_clear() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/utils/stream.c0000644001357500135600000003405514420445767013447 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: stream.c * * * * routines for output streams and reading data * * * ***************************************************************************** * * * Copyright (c) 2000-2012 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #ifdef R_UNURAN #include #endif /*---------------------------------------------------------------------------*/ /* we check whether 'UNUR_LOG_FILE' is defined. use a fallback otherwise. */ #ifndef UNUR_LOG_FILE # define UNUR_LOG_FILE "unuran.log" #endif /*---------------------------------------------------------------------------*/ static FILE *_unur_logfile_open( void ); /*---------------------------------------------------------------------------*/ static FILE *unur_stream = NULL; static const char GENID_UNKNOWN[] = "UNURAN"; /*---------------------------------------------------------------------------*/ void _unur_log_printf( const char *genid ATTRIBUTE__UNUSED, const char *filename ATTRIBUTE__UNUSED, int line ATTRIBUTE__UNUSED, const char *format ATTRIBUTE__UNUSED, ... ) /*----------------------------------------------------------------------*/ /* write messages on output stream(s) */ /* */ /* parameters: */ /* genid ... identifier of generator object (NULL if not known) */ /* filename ... name of source file (provided by __FILE__) */ /* line ... line number in source file (provided by __LINE__) */ /* format ... format for fprintf() */ /* ... ... (optional) arguments to be be printed */ /*----------------------------------------------------------------------*/ { #ifdef UNUR_ENABLE_LOGGING va_list ap; /* generator identifier known ? */ if (!genid) genid = GENID_UNKNOWN; va_start(ap, format); /* write onto output stream */ if (!unur_stream) unur_get_stream(); fprintf(unur_stream,"%s: %s:%d - ",genid,filename,line); vfprintf(unur_stream,format,ap); fprintf(unur_stream,"\n"); fflush(unur_stream); /* in case of a segmentation fault */ va_end(ap); #else return; #endif } /* end of _unur_log_printf() */ /*---------------------------------------------------------------------------*/ void _unur_log_debug( const char *format ATTRIBUTE__UNUSED, ... ) /*----------------------------------------------------------------------*/ /* write debugging messages on output stream(s) */ /* (same as _unur_stream_printf() but without file and line number) */ /* */ /* parameters: */ /* format ... format for fprintf() */ /* ... ... (optional) arguments to be be printed */ /*----------------------------------------------------------------------*/ { #ifdef UNUR_ENABLE_LOGGING va_list ap; va_start(ap, format); /* write onto output stream */ if (!unur_stream) unur_get_stream(); vfprintf(unur_stream,format,ap); fflush(unur_stream); /* in case of a segmentation fault */ va_end(ap); #else return; #endif } /* end of _unur_log_debug() */ /*---------------------------------------------------------------------------*/ FILE * unur_set_stream( FILE *new_stream ) /*----------------------------------------------------------------------*/ /* (re)set output stream for (error) messages */ /* */ /* parameters: */ /* new_stream ... pointer to new output stream */ /* */ /* return: */ /* pointer to old stream */ /*----------------------------------------------------------------------*/ { FILE * previous_stream; _unur_check_NULL( GENID_UNKNOWN,new_stream,NULL ); previous_stream = unur_stream; unur_stream = new_stream; return previous_stream; } /* end of unur_set_stream() */ /*---------------------------------------------------------------------------*/ FILE * unur_get_stream( void ) /*----------------------------------------------------------------------*/ /* get output stream for (error) messages */ /* */ /* parameters: none */ /* */ /* return: */ /* pointer to output stream */ /*----------------------------------------------------------------------*/ { if (unur_stream == NULL) { unur_stream = _unur_logfile_open(); } return unur_stream; } /* end of unur_get_stream() */ /*---------------------------------------------------------------------------*/ FILE * _unur_logfile_open( void ) /*----------------------------------------------------------------------*/ /* open log file */ /*----------------------------------------------------------------------*/ { static FILE* LOG = NULL; if (LOG) return LOG; /* log file already open */ #if defined(UNUR_ENABLE_LOGGING) /* logging enabled: print error messages into log file */ /* open log file */ LOG = fopen(UNUR_LOG_FILE,"w"); if (!LOG) { fprintf(stderr,"Warning: cannot open logfile %s !\n",UNUR_LOG_FILE); fprintf(stderr,"Use STDERR instead !\n"); LOG = stderr; } /* write header into log file */ fprintf(LOG,"\nUNU.RAN - Universal Non-Uniform RANdom number generator\n\n"); fprintf(LOG,"Version: %s\n",PACKAGE_VERSION); /* time when created */ { time_t started; if (time( &started ) != -1) fprintf(LOG,"%s",ctime(&started)); } fprintf(LOG,"\n=======================================================\n\n"); #elif defined(R_UNURAN) /* Inside R package 'Runuran'. */ /* We do not need an output stream. So we could use 'stderr' as we */ /* do not write anything at all. However, R CMD check complains. */ /* We also just could use NULL. However, this surely results in a */ /* segfault in the unlikely case that we accidently ask for */ /* output handle 'LOG'. Thus we open file UNUR_LOG_FILE. */ LOG = fopen(UNUR_LOG_FILE,"w"); if (!LOG) { error("Cannot open LOG file."); } #else /* logging disabled: print error messages into stderr */ LOG = stderr; #endif /* return file handler */ return LOG; } /* end of _unur_logfile_open() */ /*---------------------------------------------------------------------------*/ int _unur_read_data( const char *filename, int no_of_entries, double **ar ) /*----------------------------------------------------------------------*/ /* get default parameters */ /* */ /* parameters: */ /* filename ... name of data file */ /* no_of_entries ... number of entries per line */ /* ar ... to store pointer to array */ /* */ /* return: */ /* number of valid lines read. */ /* the pointer to the double array is stored in ar. */ /* */ /* error: */ /* return 0, ar is set to NULL. */ /* */ /* comment: */ /* This function takes the name of a data file and read the first */ /* `no_of_entries' double numbers of each line successive into an */ /* array. All lines not starting with a number are skipped */ /* (including lines starting with white space!). */ /* If a line contains less than `no_of_entries' numbers, the */ /* function reports an error, `ar' is set to NULL, and 0 is returned. */ /* The function allocates the required double array as a side effect. */ /* In case of an error this array is freed. */ /*----------------------------------------------------------------------*/ { #define LINELENGTH 1024 /* max length of lines allowed */ /* ------------------------------------------------------- */ /* variable declarations */ const int datasize = 1000; /* initial size of data array */ int i, j; char *c; int memfactor = 1; char line[LINELENGTH]; char *toline; char *chktoline; double *data; /* pointer to data array */ int n_data; /* number of data in array */ FILE *fp; /* ------------------------------------------------------- */ /* initialize array ar */ *ar = NULL; n_data = 0; /* array must be able to hold at least no_of_entries numbers */ if (datasize < no_of_entries) { _unur_error("read_data",UNUR_ERR_GEN_DATA,"No of entries > max datasize"); return 0; } /* allocate memory for data */ data = _unur_xmalloc(memfactor * datasize * sizeof(double)); /* open the file with the data */ fp = fopen(filename, "r"); if (fp == NULL) { _unur_error("read_data",UNUR_ERR_GENERIC,"cannot open file"); free(data); return 0; } /* read lines until eof */ for ( c = fgets(line, LINELENGTH, fp), i=0; !feof(fp) && c; c = fgets(line, LINELENGTH, fp) ) { /* if necessary allocate more memory for array */ if (i > memfactor*datasize - no_of_entries-2){ memfactor++; data = _unur_xrealloc(data, memfactor*datasize*sizeof(double)); } /* ignore all lines not starting with a double number */ if ( ! (isdigit(line[0]) || line[0] == '.' || line[0] == '+' || line[0] == '-' ) ) continue; /* increase counter */ ++n_data; /* read data from line */ toline = line; /* pointer to first element of array */ for (j=0 ; j toline changes */ /* no success reading a double */ if (chktoline == toline) { _unur_error("read_data",UNUR_ERR_GEN_DATA,"data file not valid"); free(data); fclose(fp); return 0; /* terminate routine */ } } /* end of for -- read data from line */ } /* end of for -- read lines of file */ /* close input stream */ fclose(fp); /* allocate exactly the memory needed */ data = _unur_xrealloc( data, (i+1) * sizeof(double) ); /* o.k. */ *ar = data; return n_data; /* ------------------------------------------------------- */ #undef LINELENGTH } /* end of _unur_read_data() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/utils/unur_fp_const_source.h0000644001357500135600000000317114430713373016410 00000000000000/** File automatically created by scripts/compute_machine_constants **/ /***************************************************************************** * * * unuran -- Universal Non-Uniform Random number generator * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifndef UNUR_FP_CONST_SOURCE_H_SEEN #define UNUR_FP_CONST_SOURCE_H_SEEN /*---------------------------------------------------------------------------*/ /* maximal relative error when testing equality of two doubles */ #define UNUR_EPSILON 2.22044604925031308084726333618e-14 /* square root of DBL_EPSILON */ #define UNUR_SQRT_DBL_EPSILON 1.490116119384765625e-08 /* log of DBL_EPSILON */ #define UNUR_LOG_DBL_EPSILON -36.0436533891171535515240975656 /* the machine roundoff error */ #define MACHEP 1.11022302462515654042363166809e-16 /* largest argument for exp() */ #define MAXLOG 709.782712893383973096206318587 /* smallest argument for exp() without underflow */ #define MINLOG -708.396418532264078748994506896 /* the maximal number that pow(x,x-0.5) has no overflow */ /* we use a (very) conservative portable bound */ #define MAXSTIR 108.116855767857671821730036754 /*---------------------------------------------------------------------------*/ #endif /* UNUR_FP_CONST_SOURCE_H_SEEN */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/utils/umath.c0000644001357500135600000001251714420445767013271 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: umath.c * * * * miscelleanous mathematical routines * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include /*---------------------------------------------------------------------------*/ /* If the macro INFINITY is not already defined we store infinity in the */ /* global variable INFINITY. */ #ifndef INFINITY # if defined(HAVE_DECL_HUGE_VAL) const double INFINITY = HUGE_VAL; # elif defined(HAVE_DIVIDE_BY_ZERO) const double INFINITY = 1.0 / 0.0; # elif defined(HAVE_DECL_DBL_MAX) const double INFINITY = DBL_MAX; # else # error # error +--------------------------------------------+ # error ! Sorry, Cannot define INFINITY correctly!.. ! # error ! Please contact . ! # error +--------------------------------------------+ # error # endif #endif /*---------------------------------------------------------------------------*/ #define ARCMEAN_HARMONIC (1.e3) /* use harmonic mean when abs larger than this value */ #define ARCMEAN_ARITHMETIC (1.e-6) /* use harmonic mean when abs larger than this value */ double _unur_arcmean( double x0, double x1 ) /*----------------------------------------------------------------------*/ /* compute "arctan mean" of two numbers. */ /* */ /* parameters: */ /* x0, x1 ... two numbers */ /* */ /* return: */ /* mean */ /* */ /* comment: */ /* "arctan mean" = tan(0.5*(arctan(x0)+arctan(x1))) */ /* */ /* a combination of arithmetical mean (for x0 and x1 close to 0) */ /* and the harmonic mean (for |x0| and |x1| large). */ /*----------------------------------------------------------------------*/ { double a0,a1; double r; /* we need x0 < x1 */ if (x0>x1) {double tmp = x0; x0=x1; x1=tmp;} if (x1 < -ARCMEAN_HARMONIC || x0 > ARCMEAN_HARMONIC) /* use harmonic mean */ return (2./(1./x0 + 1./x1)); a0 = (x0<=-UNUR_INFINITY) ? -M_PI/2. : atan(x0); a1 = (x1>= UNUR_INFINITY) ? M_PI/2. : atan(x1); if (fabs(a0-a1) < ARCMEAN_ARITHMETIC) /* use arithmetic mean */ r = 0.5*x0 + 0.5*x1; else /* use "arc mean" */ r = tan((a0 + a1)/2.); return r; } /* end of _unur_arcmean() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/utils/umalloc.c0000644001357500135600000001171114420445767013602 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: umalloc.c * * * * allocate memory * * * ***************************************************************************** * * * Copyright (c) 2000-2011 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #ifdef R_UNURAN #include #endif /*---------------------------------------------------------------------------*/ void* _unur_xmalloc(size_t size) /*----------------------------------------------------------------------*/ /* allocate memory */ /* */ /* parameters: */ /* size ... size of allocated block */ /* */ /* error: */ /* abort program */ /*----------------------------------------------------------------------*/ { register void *ptr; /* allocate memory */ ptr = malloc( size ); /* successful ? */ if (ptr == NULL) { _unur_error(NULL,UNUR_ERR_MALLOC,""); #ifdef R_UNURAN error("memory exhausted"); #else exit (EXIT_FAILURE); #endif } return ptr; } /* end of _unur_xmalloc() */ /*---------------------------------------------------------------------------*/ void* _unur_xrealloc(void *ptr, size_t size) /*----------------------------------------------------------------------*/ /* reallocate memory */ /* */ /* parameters: */ /* ptr ... address of memory block previously allocated by malloc. */ /* size ... size of reallocated block */ /* */ /* error: */ /* abort program */ /*----------------------------------------------------------------------*/ { register void *new_ptr; /* reallocate memory */ new_ptr = realloc( ptr, size ); /* successful ? */ if (new_ptr == NULL) { _unur_error(NULL,UNUR_ERR_MALLOC,""); #ifdef R_UNURAN error("memory exhausted"); #else exit (EXIT_FAILURE); #endif } return new_ptr; } /* end of _unur_xrealloc() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/utils/stream.h0000644001357500135600000001175014420445767013451 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: stream.h * * * * PURPOSE: * * routines for output streams and reading data * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* =NODE Output_streams Output streams =UP Error_Debug [10] =DESCRIPTION @cindex Error handlers @cindex Output streams UNU.RAN uses a logfile for writing all error messages, warnings, and debugging information onto an output stream. This stream can be set at runtime by the unur_set_stream() call. If no such stream is given by the user a default stream is used by the library: all messages are written into the file @file{unuran.log} in the current working directory. The name of this logfile is defined by the macro @code{UNUR_LOG_FILE} in @file{unuran_config.h}. (If UNU.RAN fails to open this file for writing, @file{stderr} is used instead.) To destinguish between messages for different objects each of these has its own identifier which is composed by the name of the distribution obejct and generator type, resp., followed by a dot and three digits. (If there are more than 999 generators then the identifiers are not unique.) @emph{Remark:} Writting debugging information must be switched on at compile time using the configure flag @code{--enable-logging}, see @ref{Debug,,Debugging}. =END */ /* =ROUTINES */ /*---------------------------------------------------------------------------*/ /* manipulate output stream */ FILE *unur_set_stream( FILE *new_stream ); /* This function sets a new file handler for the output stream, @var{new_stream}, for the UNU.RAN library routines. The previous handler is returned (so that you can restore it later). Note that the pointer to a user defined file handler is stored in a static variable, so there can be only one output stream handler per program. This function should be not be used in multi-threaded programs except to set up a program-wide error handler from a master thread. The NULL pointer is not allowed. (If you want to disable logging of debugging information use unur_set_default_debug(UNUR_DEBUG_OFF) instead. If you want to disable error messages at all use unur_set_error_handler_off().) */ FILE *unur_get_stream( void ); /* Get the file handle for the current output stream. It can be used to allow applications to write additional information into the logfile. */ /* =END */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/utils/stream_source.h0000644001357500135600000000620614420445767015031 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: stream_source.h * * * * PURPOSE: * * defines macros and function prototypes for input/output streams * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Function prototypes */ void _unur_log_printf (const char *genid, const char *filename, int line, const char *format, ...) ATTRIBUTE__FORMAT(4,5); void _unur_log_debug (const char *format, ...) ATTRIBUTE__FORMAT(1,2); /*---------------------------------------------------------------------------*/ /* Read data from file into double array. */ int _unur_read_data (const char *file, int no_of_entries, double **array); /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/utils/mrou_rectangle_source.h0000644001357500135600000000645214420304141016523 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: rou_rectangle_source.c * * * * * * DESCRIPTION: * * Declarations for the bounding rectangle calculations used in * * the multivariate RoU-methods. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* create MROU rectangle object. */ /*---------------------------------------------------------------------------*/ struct MROU_RECTANGLE *_unur_mrou_rectangle_new( void ); /*---------------------------------------------------------------------------*/ /* compute (minimal) bounding hyper-rectangle. */ /*---------------------------------------------------------------------------*/ int _unur_mrou_rectangle_compute( struct MROU_RECTANGLE *rr ); /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/utils/Makefile.in0000644001357500135600000005260114430713360014036 00000000000000# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = src/utils ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libutils_la_LIBADD = am_libutils_la_OBJECTS = debug.lo eigensystem.lo error.lo fmax.lo \ hooke.lo lobatto.lo matrix.lo mrou_rectangle.lo slist.lo \ stream.lo string.lo umalloc.lo umath.lo unur_fp.lo vector.lo libutils_la_OBJECTS = $(am_libutils_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/debug.Plo \ ./$(DEPDIR)/eigensystem.Plo ./$(DEPDIR)/error.Plo \ ./$(DEPDIR)/fmax.Plo ./$(DEPDIR)/hooke.Plo \ ./$(DEPDIR)/lobatto.Plo ./$(DEPDIR)/matrix.Plo \ ./$(DEPDIR)/mrou_rectangle.Plo ./$(DEPDIR)/slist.Plo \ ./$(DEPDIR)/stream.Plo ./$(DEPDIR)/string.Plo \ ./$(DEPDIR)/umalloc.Plo ./$(DEPDIR)/umath.Plo \ ./$(DEPDIR)/unur_fp.Plo ./$(DEPDIR)/vector.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libutils_la_SOURCES) DIST_SOURCES = $(libutils_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(noinst_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autoconf/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILECMD = @FILECMD@ GREP = @GREP@ HAVE_DIVIDE_BY_ZERO = @HAVE_DIVIDE_BY_ZERO@ HAVE_IEEE_COMPARISONS = @HAVE_IEEE_COMPARISONS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNURAN_LT_VERSION = @UNURAN_LT_VERSION@ UNURAN_SUPPORTS_GSL = @UNURAN_SUPPORTS_GSL@ UNURAN_SUPPORTS_PRNG = @UNURAN_SUPPORTS_PRNG@ UNURAN_SUPPORTS_RNGSTREAM = @UNURAN_SUPPORTS_RNGSTREAM@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ have_valgrind = @have_valgrind@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = \ -I$(top_srcdir)/src noinst_LTLIBRARIES = libutils.la libutils_la_DEPENDENCIES = unur_fp_const_source.h libutils_la_SOURCES = \ debug.c debug.h debug_source.h \ eigensystem.c \ error.c error.h error_source.h \ fmax.c fmax_source.h \ hooke.c hooke_source.h \ lobatto.c lobatto_source.h lobatto_struct.h \ matrix.c matrix_source.h \ mrou_rectangle.c mrou_rectangle_source.h mrou_rectangle_struct.h \ slist.c slist.h slist_struct.h \ stream.c stream.h stream_source.h \ string.c string_source.h string_struct.h \ umalloc.c umalloc_source.h \ umath.c umath.h umath_source.h \ unur_fp.c \ vector.c vector_source.h noinst_HEADERS = \ unur_fp_source.h unur_fp_const_source.h \ unur_errno.h \ unur_math_source.h # clean backup files CLEANFILES = *~ # clean generated files MAINTAINERCLEANFILES = \ Makefile.in \ unur_fp_const_source.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/utils/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/utils/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libutils.la: $(libutils_la_OBJECTS) $(libutils_la_DEPENDENCIES) $(EXTRA_libutils_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libutils_la_OBJECTS) $(libutils_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eigensystem.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/error.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fmax.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hooke.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lobatto.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/matrix.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mrou_rectangle.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/slist.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/string.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umalloc.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umath.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unur_fp.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vector.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/debug.Plo -rm -f ./$(DEPDIR)/eigensystem.Plo -rm -f ./$(DEPDIR)/error.Plo -rm -f ./$(DEPDIR)/fmax.Plo -rm -f ./$(DEPDIR)/hooke.Plo -rm -f ./$(DEPDIR)/lobatto.Plo -rm -f ./$(DEPDIR)/matrix.Plo -rm -f ./$(DEPDIR)/mrou_rectangle.Plo -rm -f ./$(DEPDIR)/slist.Plo -rm -f ./$(DEPDIR)/stream.Plo -rm -f ./$(DEPDIR)/string.Plo -rm -f ./$(DEPDIR)/umalloc.Plo -rm -f ./$(DEPDIR)/umath.Plo -rm -f ./$(DEPDIR)/unur_fp.Plo -rm -f ./$(DEPDIR)/vector.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/debug.Plo -rm -f ./$(DEPDIR)/eigensystem.Plo -rm -f ./$(DEPDIR)/error.Plo -rm -f ./$(DEPDIR)/fmax.Plo -rm -f ./$(DEPDIR)/hooke.Plo -rm -f ./$(DEPDIR)/lobatto.Plo -rm -f ./$(DEPDIR)/matrix.Plo -rm -f ./$(DEPDIR)/mrou_rectangle.Plo -rm -f ./$(DEPDIR)/slist.Plo -rm -f ./$(DEPDIR)/stream.Plo -rm -f ./$(DEPDIR)/string.Plo -rm -f ./$(DEPDIR)/umalloc.Plo -rm -f ./$(DEPDIR)/umath.Plo -rm -f ./$(DEPDIR)/unur_fp.Plo -rm -f ./$(DEPDIR)/vector.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: unuran-1.11.0/src/utils/umalloc_source.h0000644001357500135600000000564314420445767015176 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: umalloc_source.h * * * * PURPOSE: * * prototypes for allocating memory blocks * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Function prototypes for allocating memory blocks */ /*---------------------------------------------------------------------------*/ void *_unur_xmalloc(size_t size) ATTRIBUTE__MALLOC; void *_unur_xrealloc(void *ptr, size_t size) ATTRIBUTE__MALLOC; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/utils/string_struct.h0000644001357500135600000000573414420304141015051 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: string_struct.h * * * * PURPOSE: * * declares structures for strings * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* String */ struct unur_string { char *text; /* pointer to string text */ int length; /* length of string */ int allocated; /* length allocated memory block */ }; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/utils/debug.h0000644001357500135600000001531014420445767013240 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: debug.h * * * * PURPOSE: * * defines macros and function prototypes for debugging routines. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifndef DEBUG_H_SEEN #define DEBUG_H_SEEN /*---------------------------------------------------------------------------*/ /* =NODE Debug Debugging =UP Error_Debug [20] =DESCRIPTION The UNU.RAN library has several debugging levels which can be switched on/off by debugging flags. This debugging feature must be enabled when building the library using the @code{--enable-logging} configure flag. The debugging levels range from print a short description of the created generator object to a detailed description of hat functions and tracing the sampling routines. The output is printed onto the debugging output stream (@pxref{Output_streams,,Output streams}). The debugging flags can be set or changed by the respective calls unur_set_debug() and unur_chg_debug() independently for each generator. By default flag @code{UNUR_DEBUG_INIT} (see below) is used. This default flags is set by the macro @code{UNUR_DEBUGFLAG_DEFAULT} in @file{unuran_config.h} and can be changed at runtime by a unur_set_default_debug() call. Off course these debugging flags depend on the chosen method. Since most of these are merely for debugging the library itself, a description of the flags are given in the corresponding source files of the method. Nevertheless, the following flags can be used with all methods. Common debug flags: @ftable @code @item UNUR_DEBUG_OFF @findex UNUR_DEBUG_OFF switch off all debuging information @item UNUR_DEBUG_ALL @findex UNUR_DEBUG_ALL all avaivable information @item UNUR_DEBUG_INIT @findex UNUR_DEBUG_INIT parameters of generator object after initialization @item UNUR_DEBUG_SETUP @findex UNUR_DEBUG_SETUP data created at setup @item UNUR_DEBUG_ADAPT @findex UNUR_DEBUG_ADAPT data created during adaptive steps @item UNUR_DEBUG_SAMPLE @findex UNUR_DEBUG_SAMPLE trace sampling @end ftable Notice that these are flags which could be combined using the @code{|} operator. Almost all routines check a given pointer before they read from or write to the given address. This does not hold for time-critical routines like all sampling routines. Thus you are responsible for checking a pointer that is returned from a unur_init() call. However, it is possible to turn on checking for invalid NULL pointers even in such time-critical routines by building the library using the @code{--enable-check-struct} configure flag. Another debugging tool used in the library are magic cookies that validate a given pointer. It produces an error whenever a given pointer points to an object that is invalid in the context. The usage of magic cookies is also switched on by the @code{--enable-check-struct} configure flag. =END */ /* common debug flags */ #define UNUR_DEBUG_OFF (0u) /* switch off debugging information */ #define UNUR_DEBUG_ALL (~0u) /* write all avaivable information */ #define UNUR_DEBUG_INIT 0x00000001u /* bit 01 ... parameters of gen. */ #define UNUR_DEBUG_SETUP 0x00000fffu /* bits 02-12 ... setup */ #define UNUR_DEBUG_ADAPT 0x00fff000u /* bits 13-24 ... adaptive steps */ #define UNUR_DEBUG_SAMPLE 0xff000000u /* bits 25-32 ... trace sampling */ /*---------------------------------------------------------------------------*/ /* set debugging flag for generator */ /* =ROUTINES */ int unur_set_debug( UNUR_PAR *parameters, unsigned debug ); /* Set debugging flags for generator. */ int unur_chg_debug( UNUR_GEN *generator, unsigned debug ); /* Change debugging flags for generator. */ int unur_set_default_debug( unsigned debug ); /* Change default debugging flag. */ /* =END */ /*---------------------------------------------------------------------------*/ #endif /* DEBUG_H_SEEN */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/utils/Makefile.am0000644001357500135600000000177114420445767014043 00000000000000## Process this file with automake to produce Makefile.in AM_CPPFLAGS = \ -I$(top_srcdir)/src noinst_LTLIBRARIES = libutils.la libutils_la_DEPENDENCIES = unur_fp_const_source.h libutils_la_SOURCES = \ debug.c debug.h debug_source.h \ eigensystem.c \ error.c error.h error_source.h \ fmax.c fmax_source.h \ hooke.c hooke_source.h \ lobatto.c lobatto_source.h lobatto_struct.h \ matrix.c matrix_source.h \ mrou_rectangle.c mrou_rectangle_source.h mrou_rectangle_struct.h \ slist.c slist.h slist_struct.h \ stream.c stream.h stream_source.h \ string.c string_source.h string_struct.h \ umalloc.c umalloc_source.h \ umath.c umath.h umath_source.h \ unur_fp.c \ vector.c vector_source.h noinst_HEADERS = \ unur_fp_source.h unur_fp_const_source.h \ unur_errno.h \ unur_math_source.h # clean backup files CLEANFILES = *~ # clean generated files ##DISTCLEANFILES = \ ## unur_fp_const_source.h MAINTAINERCLEANFILES = \ Makefile.in \ unur_fp_const_source.h unuran-1.11.0/src/utils/mrou_rectangle.c0000644001357500135600000004315714420445767015165 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: mrou_rectangle.c * * * * * * DESCRIPTION: * * The bounding rectangle for the multivariate RoU-methods is computed * * numerically. * * Only power transformations with parameter r are considered. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * ***************************************************************************** * * * Notation follows [2]. * * * ***************************************************************************** * * * REFERENCES: * * [1] Wakefield J.C., Gelfand A.E., Smith A.F.M. * * Efficient generation of random variates via the ratio-of-uniforms * * method. * * Statistics and Computing (1991) 1, pp (129-133) * * * * [2] Hoermann, W., Leydold J., and Derflinger, G. (2004): * * Automatic non-uniform random variate generation, Springer, Berlin. * * Section 2.4, Algorithm 2.9 (RoU), p.35 * * * * [3] Hooke, R. and Jeeves, T.A. (1961): * * Direct Search Solution of Numerical and Statistical Problems. * * Journal of the ACM, Vol. 8, April 1961, pp. 212-229. * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include #include #include #include #include #include /*---------------------------------------------------------------------------*/ /* Constants */ /* Convergence parameters for the hooke optimization algorithm */ #define MROU_HOOKE_RHO (0.5) #define MROU_HOOKE_EPSILON (1.e-7) #define MROU_HOOKE_MAXITER (1000L) /* Scaling factor for the computed minimum bounding rectangle. */ /* The computed rectangle (0, vmax)x(umin[d], umax[d]) is scaled by this */ /* factor, i.e. : */ /* vmax = vmax * ( 1+ MROU_RECT_SCALING) */ /* umin[i] = umin[i] - (umax[i]-umin[i])*MROU_RECT_SCALING/2. */ /* umax[i] = umax[i] + (umax[i]-umin[i])*MROU_RECT_SCALING/2. */ #define MROU_RECT_SCALING (1.e-4) static double _unur_mrou_rectangle_aux_vmax(double *x, void *p ); static double _unur_mrou_rectangle_aux_umin(double *x, void *p ); static double _unur_mrou_rectangle_aux_umax(double *x, void *p ); /*---------------------------------------------------------------------------*/ /* Auxiliary functions used in the computation of the bounding rectangle */ /*---------------------------------------------------------------------------*/ #define PDF(x) _unur_cvec_PDF((x),(distr)) /* call to PDF */ /*---------------------------------------------------------------------------*/ double _unur_mrou_rectangle_aux_vmax(double *x, void *p ) /*----------------------------------------------------------------------*/ /* Auxiliary function used in the computation of the bounding rectangle */ /*----------------------------------------------------------------------*/ { struct MROU_RECTANGLE *rr; rr = p; /* typecast from void* to unur_rou_rectangle* */ return -pow( _unur_cvec_PDF((x),(rr->distr)) , 1./(1.+ rr->r * rr->dim) ); } /*---------------------------------------------------------------------------*/ double _unur_mrou_rectangle_aux_umin(double *x, void *p) /*----------------------------------------------------------------------*/ /* Auxiliary function used in the computation of the bounding rectangle */ /*----------------------------------------------------------------------*/ { struct MROU_RECTANGLE *rr; rr = p; /* typecast from void* to unur_rou_rectangle* */ return ( (x[rr->aux_dim] - rr->center[rr->aux_dim]) * pow( _unur_cvec_PDF((x),(rr->distr)), rr->r / (1.+ rr->r * rr->dim) ) ); } /*---------------------------------------------------------------------------*/ double _unur_mrou_rectangle_aux_umax(double *x, void *p) /*----------------------------------------------------------------------*/ /* Auxiliary function used in the computation of the bounding rectangle */ /*----------------------------------------------------------------------*/ { return (- _unur_mrou_rectangle_aux_umin(x,p)) ; } /*---------------------------------------------------------------------------*/ struct MROU_RECTANGLE * _unur_mrou_rectangle_new( void ) /*----------------------------------------------------------------------*/ /* create empty MROU rectangle object. */ /* */ /* parameters: none */ /* */ /* return: */ /* pointer to allocated and initialized MROU_RECTANGLE object */ /*----------------------------------------------------------------------*/ { struct MROU_RECTANGLE *rr; rr = _unur_xmalloc(sizeof(struct MROU_RECTANGLE )); rr->distr = NULL; rr->dim = 0; rr->umin = NULL; rr->umax = NULL; rr->r = 1; rr->bounding_rectangle = 1; rr->center = NULL; rr->genid = ""; return rr; } /* end of _unur_mrou_rectangle_new() */ /*---------------------------------------------------------------------------*/ int _unur_mrou_rectangle_compute( struct MROU_RECTANGLE *rr ) /*----------------------------------------------------------------------*/ /* compute universal bounding hyper-rectangle */ /* */ /* parameters: */ /* rr ... mRoU object */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /* */ /* remark: */ /* This routine computes two parameters of the bounding rectangle: */ /* vmax .... the upper bound of the v-coordinate */ /* umin, umax ... left lower and right upper vertex of rectangle */ /* in u-hyperplane */ /* */ /* vmax is computed by means of the mode of the given distribution. */ /* If this is not available, a method by Hooke and Jeeves [3] is */ /* used. */ /* */ /* umin and umax is computed if flag rr->bounding_rectangle is */ /* nonzero. Again the algorithm by Hooke and Jeeves [3] is used. */ /* In this case rr->umin and rr->umax must contain points to */ /* to double arrays each of size (at least) (rr->dim)+1. */ /* Otherwise, these two pointers are not needed and can be NULL. */ /* */ /*----------------------------------------------------------------------*/ { struct unur_funct_vgeneric faux; /* function to be minimized/maximized */ double *xstart, *xend, *xumin, *xumax; /* coordinate arrays used in maximum/minimum calculations */ int d, dim; /* index used in dimension loops (0 <= d < dim) */ int hooke_iters_vmax; /* actual number of min/max iterations = return value of hooke()*/ int hooke_iters_umin; /* actual number of min/max iterations = return value of hooke()*/ int hooke_iters_umax; /* actual number of min/max iterations = return value of hooke()*/ double scaled_epsilon; /* to be used in the hooke algorithm */ int flag_finite = TRUE; /* sanity flag FALSE when some of the rectangle (u,v)-values are not finite */ /* dimension of the distribution */ dim = rr->dim; /* allocate memory for the coordinate vectors */ xstart = _unur_xmalloc(dim * sizeof(double)); xend = _unur_xmalloc(dim * sizeof(double)); xumin = _unur_xmalloc(dim * sizeof(double)); xumax = _unur_xmalloc(dim * sizeof(double)); /* --- compute vmax --- */ if ( (rr->distr->set & UNUR_DISTR_SET_MODE) && (rr->distr->data.cvec.mode != NULL)) { /* position of mode is known ... vmax = f(mode)^(1/r*dim+1)) */ faux.f = (UNUR_FUNCT_VGENERIC*) _unur_mrou_rectangle_aux_vmax; faux.params = rr; rr->vmax = -faux.f(rr->distr->data.cvec.mode, faux.params); } else { /* calculation of vmax */ faux.f = (UNUR_FUNCT_VGENERIC*) _unur_mrou_rectangle_aux_vmax; faux.params = rr; /* starting point */ memcpy(xstart, rr->center, dim * sizeof(double)); hooke_iters_vmax = _unur_hooke( faux, dim, xstart, xend, MROU_HOOKE_RHO, MROU_HOOKE_EPSILON, MROU_HOOKE_MAXITER); rr->vmax = -faux.f(xend, faux.params); if (hooke_iters_vmax >= MROU_HOOKE_MAXITER) { scaled_epsilon = MROU_HOOKE_EPSILON * rr->vmax; if (scaled_epsilon>MROU_HOOKE_EPSILON) scaled_epsilon=MROU_HOOKE_EPSILON; /* recalculating extremum with scaled_epsilon and new starting point */ memcpy(xstart, xend, dim * sizeof(double)); hooke_iters_vmax = _unur_hooke( faux, dim, xstart, xend, MROU_HOOKE_RHO, scaled_epsilon , MROU_HOOKE_MAXITER); rr->vmax = -faux.f(xend, faux.params); if (hooke_iters_vmax >= MROU_HOOKE_MAXITER) { _unur_warning(rr->genid , UNUR_ERR_GENERIC, "Bounding rect uncertain (vmax)"); } } /* additional scaling of boundary rectangle */ rr->vmax = rr->vmax * ( 1+ MROU_RECT_SCALING); } /* check for finite results */ flag_finite = _unur_isfinite(rr->vmax); /* --- compute umin and umax --- */ if (rr->bounding_rectangle) { /* check pointers to avoid segfault */ if (rr->umin == NULL || rr->umax == NULL) { free(xstart); free(xend); free(xumin); free(xumax); _unur_error(rr->genid,UNUR_ERR_NULL,""); return UNUR_ERR_NULL; } /* calculation of umin and umax */ for (d=0; daux_dim = d; /* starting point at center */ memcpy(xstart, rr->center, dim * sizeof(double)); /*-----------------------------------------------------------------------------*/ /* calculation for umin */ faux.f = (UNUR_FUNCT_VGENERIC*) _unur_mrou_rectangle_aux_umin; faux.params = rr; hooke_iters_umin = _unur_hooke( faux, dim, xstart, xend, MROU_HOOKE_RHO, MROU_HOOKE_EPSILON, MROU_HOOKE_MAXITER); rr->umin[d] = faux.f(xend, faux.params); /* storing actual endpoint in case we need a recalculation */ memcpy(xumin, xend, dim * sizeof(double)); /*-----------------------------------------------------------------------------*/ /* and now, an analogue calculation for umax */ faux.f = (UNUR_FUNCT_VGENERIC*) _unur_mrou_rectangle_aux_umax; faux.params = rr; hooke_iters_umax = _unur_hooke( faux, dim, xstart, xend, MROU_HOOKE_RHO, MROU_HOOKE_EPSILON, MROU_HOOKE_MAXITER); rr->umax[d] = -faux.f(xend, faux.params); /* storing actual endpoint in case we need a recalculation */ memcpy(xumax, xend, dim * sizeof(double)); /*-----------------------------------------------------------------------------*/ /* checking if we need to recalculate umin */ if (hooke_iters_umin >= MROU_HOOKE_MAXITER) { scaled_epsilon = MROU_HOOKE_EPSILON * (rr->umax[d]-rr->umin[d]); if (scaled_epsilon>MROU_HOOKE_EPSILON) scaled_epsilon=MROU_HOOKE_EPSILON; /* recalculating extremum with scaled_epsilon and new starting point */ faux.f = (UNUR_FUNCT_VGENERIC*) _unur_mrou_rectangle_aux_umin; faux.params = rr; memcpy(xstart, xumin, dim * sizeof(double)); hooke_iters_umin = _unur_hooke( faux, dim, xstart, xend, MROU_HOOKE_RHO, scaled_epsilon , MROU_HOOKE_MAXITER); rr->umin[d] = faux.f(xend, faux.params); if (hooke_iters_umin >= MROU_HOOKE_MAXITER) { _unur_warning(rr->genid , UNUR_ERR_GENERIC, "Bounding rect uncertain (umin)"); } } /* checking if we need to recalculate umax */ if (hooke_iters_umax >= MROU_HOOKE_MAXITER) { scaled_epsilon = MROU_HOOKE_EPSILON * (rr->umax[d]-rr->umin[d]); if (scaled_epsilon>MROU_HOOKE_EPSILON) scaled_epsilon=MROU_HOOKE_EPSILON; /* recalculating extremum with scaled_epsilon and new starting point */ faux.f = (UNUR_FUNCT_VGENERIC*) _unur_mrou_rectangle_aux_umax; faux.params = rr; memcpy(xstart, xumax, dim * sizeof(double)); hooke_iters_umax = _unur_hooke( faux, dim, xstart, xend, MROU_HOOKE_RHO, scaled_epsilon , MROU_HOOKE_MAXITER); rr->umin[d] = faux.f(xend, faux.params); if (hooke_iters_umax >= MROU_HOOKE_MAXITER) { _unur_warning(rr->genid , UNUR_ERR_GENERIC, "Bounding rect uncertain (umax)"); } } /*-----------------------------------------------------------------------------*/ /* additional scaling of boundary rectangle */ rr->umin[d] = rr->umin[d] - (rr->umax[d]-rr->umin[d])*MROU_RECT_SCALING/2.; rr->umax[d] = rr->umax[d] + (rr->umax[d]-rr->umin[d])*MROU_RECT_SCALING/2.; /* check for finite results */ flag_finite = flag_finite && _unur_isfinite(rr->umin[d]) && _unur_isfinite(rr->umax[d]); } } /* free working arrays */ free(xstart); free(xend); free(xumin); free(xumax); if (rr->vmax <= 0.) { /* vmax must be strictly positive! */ _unur_error("RoU",UNUR_ERR_DISTR_DATA,"cannot find bounding rectangle"); return UNUR_ERR_DISTR_DATA; } /* return status of computation */ return (flag_finite ? UNUR_SUCCESS : UNUR_ERR_INF); } /* end of _unur_mrou_rectangle() */ #undef PDF #undef MROU_HOOKE_RHO #undef MROU_HOOKE_EPSILON #undef MROU_HOOKE_MAXITER #undef MROU_RECT_SCALING /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/utils/unur_math_source.h0000644001357500135600000001033114420445767015532 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: unur_math_source.h * * * * PURPOSE: * * declares macros, constants, structures, function prototypes, etc. * * for using mathematics in UNU.RAN. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifndef UNUR_MATH_SOURCE_H_SEEN #define UNUR_MATH_SOURCE_H_SEEN /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* mathematical constants */ #ifndef M_E #define M_E 2.71828182845904523536028747135 /* e */ #endif #ifndef M_SQRT2 #define M_SQRT2 1.41421356237309504880168872421 /* sqrt(2) */ #endif #ifndef M_SQRT3 #define M_SQRT3 1.73205080756887729352744634151 /* sqrt(3) */ #endif #ifndef M_SQRTH #define M_SQRTH 0.707106781186547524400844362105 /* sqrt(1/2) */ #endif #ifndef M_PI #define M_PI 3.14159265358979323846264338328 /* pi */ #endif #ifndef M_PI_4 #define M_PI_4 0.78539816339744830966156608458 /* pi/4 */ #endif #ifndef M_SQRTPI #define M_SQRTPI 1.77245385090551602729816748334 /* sqrt(pi) */ #endif #ifndef M_SQRT2PI #define M_SQRT2PI 2.50662827463100050241576528481 /* sqrt(2*pi) */ #endif #ifndef M_LN10 #define M_LN10 2.30258509299404568401799145468 /* ln(10) */ #endif #ifndef M_LN2 #define M_LN2 0.69314718055994530941723212146 /* ln(2) */ #endif #ifndef M_LNPI #define M_LNPI 1.14472988584940017414342735135 /* ln(pi) */ #endif #ifndef M_EULER #define M_EULER 0.57721566490153286060651209008 /* Euler constant */ #endif /*---------------------------------------------------------------------------*/ #endif /* UNUR_MATH_SOURCE_H_SEEN */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/utils/unur_fp_source.h0000644001357500135600000001364514420445767015221 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: unur_fp_source.h * * * * PURPOSE: * * declares macros for floating point arithmetic. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifndef UNUR_FP_SOURCE_H_SEEN #define UNUR_FP_SOURCE_H_SEEN /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* Comparisons */ int _unur_FP_cmp( double x1, double x2, double eps); /* compare two floats: */ /* x1 eq x2 iff |x1-x2| <= min(|x1|,|x2) * eps */ /* return: */ /* -1 if x1 < x2 */ /* 0 if x1 eq x2 */ /* +1 if x1 > x2 */ /* macros for different levels of accuracy */ #define _unur_FP_cmp_same(a,b) (_unur_FP_cmp((a),(b),DBL_EPSILON)) #define _unur_FP_cmp_equal(a,b) (_unur_FP_cmp((a),(b),UNUR_EPSILON)) #define _unur_FP_cmp_approx(a,b) (_unur_FP_cmp((a),(b),UNUR_SQRT_DBL_EPSILON)) /* a == b (except precision bit) */ #define _unur_FP_same(a,b) (_unur_FP_cmp((a),(b),DBL_EPSILON)==0) /* a == b */ #define _unur_FP_equal(a,b) (_unur_FP_cmp((a),(b),UNUR_EPSILON)==0) /* a is approximately equal to b */ #define _unur_FP_approx(a,b) (_unur_FP_cmp((a),(b),UNUR_SQRT_DBL_EPSILON)==0) /* a < b */ #define _unur_FP_less(a,b) ((_unur_FP_cmp((a),(b),UNUR_EPSILON)<0) ? TRUE : FALSE) /* a > b */ #define _unur_FP_greater(a,b) ((_unur_FP_cmp((a),(b),UNUR_EPSILON)>0) ? TRUE : FALSE) /*---------------------------------------------------------------------------*/ /* Comparing floating point with == or != is unsafe. */ /* However, we assume that comparing with 0.0 and powers of 2.0 is safe. */ /* Thus we use the followig functions to mark these "safe" comparisons in */ /* the code and thus we can use the GCC to detect all other comparisons. */ /* For the latter _unur_FP_cmp_same() must be used. */ /* defined as macros */ #define _unur_iszero(x) ((x)==0.0) #define _unur_isone(x) ((x)==1.0) #define _unur_isfsame(x,y) ((x)==(y)) /* defined as functions: only used for debugging. */ /* (it switches off GCC warnings) */ #ifndef _unur_iszero int _unur_iszero (const double x); #endif #ifndef _unur_isone int _unur_isone (const double x); #endif #ifndef _unur_isfsame int _unur_isfsame (const double x, const double y); #endif /*---------------------------------------------------------------------------*/ /* Infinity and NaN (Not a Number) */ /* wrapper / replacement for corresponding C99 functions */ int _unur_isfinite (const double x); int _unur_isnan (const double x); int _unur_isinf (const double x); /*---------------------------------------------------------------------------*/ /* Other checks for infinity */ /* +oo */ #define _unur_FP_is_infinity(a) ((a) >= UNUR_INFINITY) /* -oo */ #define _unur_FP_is_minus_infinity(a) ((a) <= -UNUR_INFINITY) /*---------------------------------------------------------------------------*/ #endif /* UNUR_FP_SOURCE_H_SEEN */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/utils/hooke_source.h0000644001357500135600000000614114420304141014615 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: hooke_source.h * * * * PURPOSE: * * defines function prototypes for finding extremum of multivariate * * function * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Function prototypes */ /* Algorithm by Hooke and Jeeves */ /* (direct search minimization algorithm) */ int _unur_hooke( struct unur_funct_vgeneric faux, int dim, double *startpt, double *endpt, double rho, double epsilon, long itermax); /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/utils/lobatto_source.h0000644001357500135600000001425314420445767015203 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: lobatto_source.c * * * * PURPOSE: * * macros and function prototypes for Gauss-Lobatto integration * * * ***************************************************************************** * * * Copyright (c) 2009 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* typedefs */ /* Integrand */ typedef double UNUR_LOBATTO_FUNCT(double x, struct unur_gen *gen); /* Error estimate */ typedef double UNUR_LOBATTO_ERROR(struct unur_gen *gen, double delta, double x); struct unur_lobatto_table; /*---------------------------------------------------------------------------*/ /* Function prototypes */ double _unur_lobatto_adaptive (UNUR_LOBATTO_FUNCT funct, struct unur_gen *gen, double x, double h, double tol, UNUR_LOBATTO_ERROR uerror); /*---------------------------------------------------------------------------*/ /* numerical integration of 'funct' over the interval (x,x+h) using */ /* adaptive Gauss-Lobatto integration with 5 points for each recursion. */ /*---------------------------------------------------------------------------*/ struct unur_lobatto_table * _unur_lobatto_init (UNUR_LOBATTO_FUNCT funct, struct unur_gen *gen, double left, double center, double right, double tol, UNUR_LOBATTO_ERROR uerror, int size); /*---------------------------------------------------------------------------*/ /* create object for Lobatto integral. */ /*---------------------------------------------------------------------------*/ int _unur_lobatto_find_linear (struct unur_lobatto_table *Itable, double x); /*---------------------------------------------------------------------------*/ /* find first subinterval where left boundary is not less than x. */ /*---------------------------------------------------------------------------*/ double _unur_lobatto_eval_diff (struct unur_lobatto_table *Itable, double x, double h, double *fx); /*---------------------------------------------------------------------------*/ /* evaluate integration object over the interval (x,x+h). */ /*---------------------------------------------------------------------------*/ double _unur_lobatto_eval_CDF (struct unur_lobatto_table *Itable, double x); /*---------------------------------------------------------------------------*/ /* evaluate integration object over the interval (-UNUR_INFINITY, x). */ /* it is important, that the integration object 'Itable' already exists. */ /*---------------------------------------------------------------------------*/ double _unur_lobatto_integral (struct unur_lobatto_table *Itable ); /*---------------------------------------------------------------------------*/ /* get value of integral from Lobatto object. */ /*---------------------------------------------------------------------------*/ void _unur_lobatto_free (struct unur_lobatto_table **Itable); /*---------------------------------------------------------------------------*/ /* destroy Lobatto object and set pointer to NULL. */ /*---------------------------------------------------------------------------*/ void _unur_lobatto_debug_table (struct unur_lobatto_table *Itable, const struct unur_gen *gen, int print_Itable ); /*---------------------------------------------------------------------------*/ /* print size and entries of table of integral values. */ /*---------------------------------------------------------------------------*/ int _unur_lobatto_size_table (struct unur_lobatto_table *Itable); /*---------------------------------------------------------------------------*/ /* size of table of integral values. */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/utils/lobatto.c0000644001357500135600000010552714420445767013623 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: lobatto.c * * * * Routines for Gauss-Lobatto integration with 5 points. * * We store integral values for subintervals to speed up repeated * * computations. * * * ***************************************************************************** * * * Copyright (c) 2009-2011 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include "lobatto_source.h" #include "lobatto_struct.h" /*---------------------------------------------------------------------------*/ /* Function prototypes */ static double _unur_lobatto5_simple (UNUR_LOBATTO_FUNCT funct, struct unur_gen *gen, double x, double h, double *fx); /*---------------------------------------------------------------------------*/ /* numerical integration of 'funct' over the interval (x,x+h) */ /* using Gauss-Lobatto integration with 5 points. (non-adaptive) */ /*---------------------------------------------------------------------------*/ static double _unur_lobatto5_adaptive (UNUR_LOBATTO_FUNCT funct, struct unur_gen *gen, double x, double h, double tol, UNUR_LOBATTO_ERROR uerror, struct unur_lobatto_table *Itable); /*---------------------------------------------------------------------------*/ /* numerical integration of 'funct' over the interval (x,x+h) using */ /* adaptive Gauss-Lobatto integration with 5 points for each recursion. */ /*---------------------------------------------------------------------------*/ static double _unur_lobatto5_recursion (UNUR_LOBATTO_FUNCT funct, struct unur_gen *gen, double x, double h, double tol, UNUR_LOBATTO_ERROR uerror, double int1, double fl, double fr, double fc, int *W_accuracy, int *n_calls, struct unur_lobatto_table *Itable); /*---------------------------------------------------------------------------*/ /* run recursion for adaptive Lobatto integration. */ /*---------------------------------------------------------------------------*/ static int _unur_lobatto_table_append (struct unur_lobatto_table *Itable, double x, double u); /*---------------------------------------------------------------------------*/ /* append entry to table of integral values. */ /*---------------------------------------------------------------------------*/ static void _unur_lobatto_table_resize (struct unur_lobatto_table *Itable); /*---------------------------------------------------------------------------*/ /* resize table of integral values. */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* abbreviations */ #define FKT(x) (funct((x),gen)) /* call to integrand */ /*---------------------------------------------------------------------------*/ /* points for Lobatto integration */ #define W1 (0.17267316464601146) /* = 0.5-sqrt(3/28) */ #define W2 (1.-W1) /*---------------------------------------------------------------------------*/ /* emergency break for adaptive Lobatto integration: */ /* abort recursive calls to _unur_lobatto5_recursion() after this number */ /* of calls. */ #define LOBATTO_MAX_CALLS (1000000) /*---------------------------------------------------------------------------*/ double _unur_lobatto5_simple (UNUR_LOBATTO_FUNCT funct, struct unur_gen *gen, double x, double h, double *fx) /*----------------------------------------------------------------------*/ /* Numerical integration of 'funct' over the interval (x,x+h) */ /* using Gauss-Lobatto integration with 5 points. (non-adaptive) */ /* */ /* parameters: */ /* funct ... integrand */ /* gen ... pointer to generator object */ /* x ... left boundary point of interval */ /* h ... length of interval */ /* fx ... funct(x) (ignored if NULL or *fx<0) */ /* set *fx <- funct(x+h) */ /* */ /* return: */ /* integral */ /* */ /* store: */ /* funct(x+h) in *fx if fx!=NULL */ /*----------------------------------------------------------------------*/ { double fl, fr; if (fx==NULL) { fl = FKT(x); fr = FKT(x+h); } else { fl = (*fx>=0.) ? *fx : FKT(x); fr = *fx = FKT(x+h); } return (9*(fl+fr)+49.*(FKT(x+h*W1)+FKT(x+h*W2))+64*FKT(x+h/2.))*h/180.; } /* end of _unur_lobatto5_simple() */ /*---------------------------------------------------------------------------*/ double _unur_lobatto_adaptive (UNUR_LOBATTO_FUNCT funct, struct unur_gen *gen, double x, double h, double tol, UNUR_LOBATTO_ERROR uerror) /*----------------------------------------------------------------------*/ /* Numerical integration of the 'funct' over the interval (x,x+h) */ /* using adaptive Gauss-Lobatto integration with 5 points. */ /*----------------------------------------------------------------------*/ { return _unur_lobatto5_adaptive(funct,gen,x,h,tol,uerror,NULL); } /* end of _unur_lobatto_adaptive() */ /*---------------------------------------------------------------------------*/ double _unur_lobatto5_adaptive (UNUR_LOBATTO_FUNCT funct, struct unur_gen *gen, double x, double h, double tol, UNUR_LOBATTO_ERROR uerror, struct unur_lobatto_table *Itable) /*----------------------------------------------------------------------*/ /* Numerical integration of the 'funct' over the interval (x,x+h) */ /* using adaptive Gauss-Lobatto integration with 5 points. */ /* */ /* Halfs intervals recursively if error is too large. */ /* */ /* The recursion stops when the ABSOLUTE error is less than the */ /* respective given tolerances. */ /* */ /* As a side effect, it stores boundaries and integrals for all */ /* subintervals in each recursion step where no further adaptation is */ /* required. */ /* The values are stored in Itable (unless it equals NULL) in */ /* chronological order. It is important to take care when calling this */ /* function for several subintervals and 'Itable' is given. */ /* */ /* parameters: */ /* funct ... integrand */ /* gen ... pointer to generator object */ /* x ... left boundary point of interval */ /* h ... length of interval */ /* tol ... tolerated ABSOLUTE error */ /* Itable ... table for storing integral values (may be NULL) */ /* */ /* return: */ /* integral */ /*----------------------------------------------------------------------*/ { double fl, fc, fr; /* values of PDF at x, x+h/2, and x+h */ double int1, int2; /* estimated values for integral */ int W_accuracy = 0; /* raise flag for printing warning about accuracy */ int n_calls = 0; /* number of recursive calls */ /* check length of interval */ if (_unur_iszero(h)) return 0.; /* arguments which are not finite (inf or NaN) cause infinite recursions */ if (!_unur_isfinite(x+h)) { _unur_error(gen->genid,UNUR_ERR_INF,"boundaries of integration domain not finite"); return UNUR_INFINITY; } /* compute function values */ fl = FKT(x); fc = FKT(x+h/2.); fr = FKT(x+h); /* first estimate for integral on [x,x+h] */ int1 = (9*(fl+fr)+49.*(FKT(x+h*W1)+FKT(x+h*W2))+64*fc)*h/180.; /* run adaptive steps */ int2 = _unur_lobatto5_recursion(funct,gen,x,h,tol,uerror,int1,fl,fc,fr,&W_accuracy,&n_calls,Itable); /* check warning flag */ if (W_accuracy) { if (W_accuracy == 1) _unur_warning(gen->genid,UNUR_ERR_ROUNDOFF, "numeric integration did not reach full accuracy"); else _unur_error(gen->genid,UNUR_ERR_ROUNDOFF, "adaptive numeric integration aborted (too many function calls)"); } /* return result */ return int2; } /* end of _unur_lobatto5_adaptive() */ /*---------------------------------------------------------------------------*/ double _unur_lobatto5_recursion (UNUR_LOBATTO_FUNCT funct, struct unur_gen *gen, double x, double h, double tol, UNUR_LOBATTO_ERROR uerror, double int1, double fl, double fc, double fr, int *W_accuracy, int *n_calls, struct unur_lobatto_table *Itable) /*----------------------------------------------------------------------*/ /* run recursion for adaptive Lobatto integration. */ /* */ /* parameters: */ /* funct ... integrand */ /* gen ... pointer to generator object */ /* x ... left boundary point of interval */ /* h ... length of interval */ /* tol ... tolerated ABSOLUTE error */ /* fl ... PDF at x */ /* fc ... PDF at x+h/2 */ /* fr ... PDF at x+h */ /* W_accuracy.. warning about accuracy */ /* n_calls ... number of recursive calls */ /* Itable ... table for storing integral values (may be NULL) */ /* */ /* return: */ /* integral */ /*----------------------------------------------------------------------*/ { double flc, frc; /* values at PDF at x+h/4 and x+3*h/4 */ double int2; /* estimated values of integrals */ double intl, intr; /* left and right part of int2 */ double ierror; /* integration error */ /* First check number of recursive calls */ if (++(*n_calls) > LOBATTO_MAX_CALLS) { /* maximum allowed number of calls exceeded. */ /* Remark: this may happen, when the initial guess */ /* for the integral is too small. */ *W_accuracy = 2; return UNUR_INFINITY; } /* compute function values */ flc = FKT(x+h/4); frc = FKT(x+3*h/4); /* compute integral on [x,x+h/2] and on [x+h/2,x+h] */ intl = (9*(fl+fc)+49.*(FKT(x+h*W1*0.5)+FKT(x+h*W2*0.5))+64*flc)*h/360.; intr = (9*(fc+fr)+49.*(FKT(x+h*(0.5+W1*0.5))+FKT(x+h*(0.5+W2*0.5)))+64*frc)*h/360.; int2 = intl + intr; /* integration error */ if (uerror!=NULL) ierror = uerror(gen, fabs(int1-int2), x+h/2.); else ierror = fabs(int1-int2); /* check whether accuracy goal is reached */ if (ierror >= tol) { /* error above tolerance */ /* if (_unur_FP_equal(x+h/2.,x) || _unur_FP_equal(int1,int2) ) { */ if (_unur_FP_equal(x+h/2.,x)) { /* we cannot decrease length of subintervals any more */ *W_accuracy = 1; /* Remark: Since we are halving intervals, this comparision */ /* limits the maximal number of iterations to at most 2048. */ } else { /* recompute with shorter intervals */ /* Remark: it is important that the two calls to _unur_lobatto5_recursion() must be done in exactly this order! Otherwise 'Itable' gets corrupted. So we need to two seperate statements and store the results in the temporary variabel 'int2' to prevent the compiler to revert this order. */ int2 = _unur_lobatto5_recursion(funct,gen,x,h/2,tol/1.,uerror, intl,fl,flc,fc, W_accuracy,n_calls, Itable); int2 += _unur_lobatto5_recursion(funct,gen,x+h/2,h/2,tol/1.,uerror, intr,fc,frc,fr, W_accuracy,n_calls, Itable); return int2; } } /* store integral values */ if (Itable) { /* l.h.s. subinterval */ _unur_lobatto_table_append(Itable, x+h/2., intl); /* r.h.s. subinterval */ _unur_lobatto_table_append(Itable, x+h, intr); } /* Remark: we do not throw a warning if the table size is exceeded. */ /* return estimate for integral */ return int2; } /* end of _unur_lobatto5_recursion() */ /*---------------------------------------------------------------------------*/ double _unur_lobatto_eval_diff (struct unur_lobatto_table *Itable, double x, double h, double *fx) /*----------------------------------------------------------------------*/ /* Numerical integration of 'funct' over the interval (x,x+h) using */ /* table of integral values together with (adaptive) Gauss-Lobatto */ /* integration with 5 points. */ /* */ /* It is important that the pointer points to an entry in the table of */ /* integral values with x-value larger than the given 'x'. */ /* */ /* parameters: */ /* Itable ... table for storing integral values (may be NULL) */ /* x ... left boundary point of interval */ /* h ... length of interval */ /* fx ... funct(x) (ignored if NULL or *fx<0) */ /* set *fx <- funct(x+h) if _unur_lobatto5_simple called */ /* set *fx <- -1. otherwise */ /* */ /* return: */ /* integral */ /* */ /* store: */ /* if (fx!=NULL) */ /* *fx = funct(x+h) if _unur_lobatto5_simple is called */ /* *fx = -1. (=unknown) if _unur_lobatto5_adaptive is called */ /*----------------------------------------------------------------------*/ { int cur; /* pointer to current position in table */ double x1; /* left and right boundary of a subinterval */ double Q; /* value of integral */ struct unur_lobatto_nodes *values; int n_values; /* clear function values if it does not contain the correct value. */ /* this is in particular necessary whenever we call */ /* _unur_lobatto5_adaptive instead if _unur_lobatto5_simple !! */ #define clear_fx() if(fx!=NULL){*fx=-1.;} /* check for invalid NULL pointer */ CHECK_NULL(Itable,UNUR_INFINITY); /* read data from table */ values = Itable->values; n_values = Itable->n_values; /* arguments which are not finite (inf or NaN) cause infinite recursions */ if (!_unur_isfinite(x+h)) { /* _unur_warning(gen->genid,UNUR_ERR_INF,"boundaries of integration domain not finite"); */ clear_fx(); return UNUR_INFINITY; } /* check for boundaries of integration table */ if (x < Itable->bleft || x+h > Itable->bright) { clear_fx(); return _unur_lobatto5_adaptive(Itable->funct, Itable->gen, x, h, Itable->tol, Itable->uerror, NULL); } /* move pointer for reading to start position in interval */ cur = Itable->cur_iv; /* first entry in interval */ while (cur < n_values && values[cur].x < x) ++cur; /* did we find such an entry ? */ if (cur >= n_values) { /* we must use adaptive Lobatto integration if the table for */ /* integral values was too small. */ clear_fx(); return _unur_lobatto5_adaptive(Itable->funct, Itable->gen, x, h, Itable->tol, Itable->uerror, NULL); } /* store x value and goto next entry */ x1 = values[cur].x; ++cur; /* are there more than one entry in interval ? */ if (cur >= n_values || values[cur].x > x+h) { /* there is at most one entry in the interval [x,x+h]. */ /* thus we (can) use simple Lobatto integration. */ return _unur_lobatto5_simple(Itable->funct, Itable->gen, x, h, fx); } /* else: */ /* there are more than one entries in the interval. */ /* thus there is at least one subinterval from adapative Lobatto */ /* integration within [x,x+h]. we reuse the stored values. */ /* for the remaining two subintervals at the boundary [x,x+h] */ /* we use simple Gauss-Lobatto integration. */ Q = _unur_lobatto5_simple(Itable->funct, Itable->gen, x, x1-x, fx); do { Q += values[cur].u; /* = _unur_lobatto5(gen, funct, x1, x2-x1) */ x1 = values[cur].x; ++cur; } while (cur < n_values && values[cur].x <= x+h); /* now *fx does not hold PDF(x1). so we have to clear it */ clear_fx(); /* We have to distinguish two cases: */ if (cur >= n_values) { /* the table of integral values is too small */ Q += _unur_lobatto5_adaptive(Itable->funct, Itable->gen, x1, x+h-x1, Itable->tol, Itable->uerror, NULL); } else { /* the table is not too small but x+h is outside the computational domain */ Q += _unur_lobatto5_simple(Itable->funct, Itable->gen, x1, x+h-x1, fx); } return Q; #undef clear_fx } /* end of _unur_lobatto_eval_diff() */ /*---------------------------------------------------------------------------*/ double _unur_lobatto_eval_CDF (struct unur_lobatto_table *Itable, double x) /*----------------------------------------------------------------------*/ /* Numerical integration of 'funct' over the interval (-UNUR_INFINITY,x)*/ /* using a table of integral values together with */ /* (adaptive) Gauss-Lobatto integration with 5 points. */ /* It is important, that the integration object 'Itable' already exists.*/ /* */ /* parameters: */ /* Itable ... table for storing integral values (may be NULL) */ /* x ... argument */ /* */ /* return: */ /* integral */ /*----------------------------------------------------------------------*/ { struct unur_lobatto_nodes *values; int n_values; /* table size */ double area; /* integral over (-UNUR_INFINITY, UNUR_INFINITY) */ double xr; /* most right point from table */ double cdf; /* cdf at x */ int cur; /* current interval (position in table) */ /* check for invalid NULL pointer */ CHECK_NULL(Itable, UNUR_INFINITY); /* check boundary */ if (x <= Itable->bleft) return 0.; if (x >= Itable->bright) return 1.; /* read data from table */ values = Itable->values; n_values = Itable->n_values; area = Itable->integral; /* the area must not equal 0 (this should not happen anyway) */ if (area <= 0.) { _unur_error(Itable->gen->genid,UNUR_ERR_NAN,"area below PDF 0."); return UNUR_INFINITY; } /* sum values over all intervals that are on the l.h.s. of x */ cdf = 0; xr = Itable->bleft; for (cdf=0, cur=0; cur < n_values && x > values[cur].x; cur++) { cdf += values[cur].u; xr = values[cur].x; } /* integrate from xr to x */ if (cur >= n_values) { cdf += _unur_lobatto5_adaptive(Itable->funct, Itable->gen, xr, x-xr, Itable->tol, Itable->uerror, NULL); } else { cdf += _unur_lobatto5_simple(Itable->funct, Itable->gen, xr, x-xr, NULL); } /* compute CDF */ cdf /= area; cdf = _unur_max(0., cdf); cdf = _unur_min(1., cdf); /* return CDF */ return cdf; } /* end of _unur_lobatto_eval_CDF() */ /*---------------------------------------------------------------------------*/ double _unur_lobatto_integral (struct unur_lobatto_table *Itable) /*----------------------------------------------------------------------*/ /* Get value of integral from Lobatto object. */ /* Get integration from Lobatto object. */ /* */ /* parameters: */ /* Itable ... table for storing integral values (may be NULL) */ /* */ /* return: */ /* integral */ /*----------------------------------------------------------------------*/ { CHECK_NULL(Itable, UNUR_INFINITY); return Itable->integral; } /* end of _unur_lobatto_eval_integral() */ /*****************************************************************************/ /* */ /* Table with integral values */ /* */ /*****************************************************************************/ struct unur_lobatto_table * _unur_lobatto_init (UNUR_LOBATTO_FUNCT funct, struct unur_gen *gen, double left, double center, double right, double tol, UNUR_LOBATTO_ERROR uerror, int size) /*----------------------------------------------------------------------*/ /* create and initialize table of integral values. */ /* */ /* parameters: */ /* funct ... pointer to integrand */ /* gen ... pointer to generator object */ /* left ... left boundary of computational domain */ /* center... central ("typical") point of computational domain */ /* right ... right boundary of computational domain */ /* tol ... tolerated ABSOLUTE integration error */ /* size ... (maximal) size of table (MUST BE >=2) */ /* */ /* return: */ /* pointer to table */ /*----------------------------------------------------------------------*/ { struct unur_lobatto_table *Itable; /* check argument */ if (size<2) { _unur_error(gen->genid,UNUR_ERR_SHOULD_NOT_HAPPEN,"size<2"); return NULL; } /* allocate memory */ Itable = _unur_xmalloc( sizeof(struct unur_lobatto_table) ); Itable->values = _unur_xmalloc(size * sizeof(struct unur_lobatto_nodes) ); /* set counter */ Itable->size = size; Itable->n_values = 0; Itable->cur_iv = 0; /* store integrand */ Itable->funct = funct; Itable->gen = gen; Itable->bleft = left; Itable->bright = right; /* tolerated integration error */ Itable->tol = tol; Itable->uerror = uerror; /* store left boundary point in table */ _unur_lobatto_table_append(Itable,left,0.); /* compute integral over whole domain */ /* Remark: it is important that the two calls to _unur_lobatto5_adaptive() must be done in exactly this order! Otherwise 'Itable' gets corrupted. So we need two seperate statements to prevent the compiler to revert this order. */ Itable->integral = _unur_lobatto5_adaptive(funct, gen, left, center-left, tol, uerror, Itable ); Itable->integral += _unur_lobatto5_adaptive(funct, gen, center, right-center, tol, uerror, Itable ); /* possibly shrink memory block for table of integral values */ _unur_lobatto_table_resize(Itable); return Itable; } /* end of _unur_lobatto_table_create() */ /*---------------------------------------------------------------------------*/ int _unur_lobatto_find_linear (struct unur_lobatto_table *Itable, double x) /*----------------------------------------------------------------------*/ /* Find first subinterval where left boundary is not less than x. */ /* we start at last position found by this routine and continue with */ /* linear search. */ /* (We set a bookmark in the table of integral values.) */ /* */ /* parameters: */ /* Itables ... table with integral values */ /* x ... value to be found */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { if (Itable != NULL) { /* search for first entry in interval. */ /* we can continue from the position in the last interval. */ /* otherwise, to restart from the first entry uncomment this line */ /* Itable->cur_iv = 0; */ while (Itable->cur_iv < Itable->n_values && Itable->values[Itable->cur_iv].x < x) ++(Itable->cur_iv); return UNUR_SUCCESS; } else { /* nothing to do */ return UNUR_ERR_SILENT; } } /* end of _unur_lobatto_find_linear() */ /*---------------------------------------------------------------------------*/ int _unur_lobatto_table_append (struct unur_lobatto_table *Itable, double x, double u) /*----------------------------------------------------------------------*/ /* append entry to the end of the table of integral values. */ /* */ /* parameters: */ /* Itables ... table with integral values */ /* x ... right boundary of subinterval */ /* u ... integral over subinterval */ /* */ /* return: */ /* UNUR_SUCCESS ... on success */ /* error code ... on error */ /*----------------------------------------------------------------------*/ { if (Itable==NULL) return UNUR_ERR_NULL; if (Itable->n_values >= Itable->size - 1) /* we do not write a warning here */ return UNUR_ERR_GENERIC; Itable->values[Itable->n_values].x = x; Itable->values[Itable->n_values].u = u; ++(Itable->n_values); return UNUR_SUCCESS; } /* end of _unur_lobatto_table_append() */ /*---------------------------------------------------------------------------*/ void _unur_lobatto_table_resize (struct unur_lobatto_table *Itable) /*----------------------------------------------------------------------*/ /* resize table of integral values. */ /* */ /* parameters: */ /* Itable ... pointer to pointer to table of integral values */ /*----------------------------------------------------------------------*/ { if (Itable) { Itable->size = Itable->n_values; Itable->values = _unur_xrealloc(Itable->values, Itable->size * sizeof(struct unur_lobatto_nodes)); } /* else: nothing to do */ } /* end of _unur_lobatto_table_resize() */ /*---------------------------------------------------------------------------*/ void _unur_lobatto_free (struct unur_lobatto_table **Itable) /*----------------------------------------------------------------------*/ /* destroy table of integral values and set pointer to NULL. */ /* */ /* parameters: */ /* Itable ... pointer to pointer to table with integral values */ /*----------------------------------------------------------------------*/ { if (*Itable) { free ((*Itable)->values); free (*Itable); *Itable = NULL; } /* else: nothing to do */ } /* end of _unur_lobatto_free() */ /*---------------------------------------------------------------------------*/ void _unur_lobatto_debug_table (struct unur_lobatto_table *Itable, const struct unur_gen *gen, int print_Itable ) /*----------------------------------------------------------------------*/ /* print size and entries of table of integral values. */ /* */ /* parameters: */ /* Itable ... table with integral values */ /* gen ... pointer to generator object */ /* print_Itable ... whether table is printed */ /*----------------------------------------------------------------------*/ { FILE *LOG; int n; /* check arguments */ CHECK_NULL(Itable,RETURN_VOID); LOG = unur_get_stream(); fprintf(LOG,"%s: subintervals for Lobatto integration: %d\n",gen->genid, Itable->n_values - 1); for (n=0; print_Itable && n < Itable->n_values; n++) { fprintf(LOG,"%s: [%3d] x = %.16g, u = %.16g\n",gen->genid, n, Itable->values[n].x, Itable->values[n].u ); } } /* end of _unur_lobatto_debug_table() */ /*---------------------------------------------------------------------------*/ int _unur_lobatto_size_table (struct unur_lobatto_table *Itable) /*----------------------------------------------------------------------*/ /* size of table of integral values. */ /* */ /* parameters: */ /* Itable ... table with integral values */ /*----------------------------------------------------------------------*/ { return (Itable->n_values - 1); } /* end of _unur_lobatto_size_table() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/utils/vector.c0000644001357500135600000001162714420304141013432 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: vector.c * * * * Routines for computations with vectors (arrays). * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*--------------------------------------------------------------------------*/ #include /*---------------------------------------------------------------------------*/ /* allocate memory for new vector */ double * _unur_vector_new(int dim) { int i; double *v; v = _unur_xmalloc(dim*sizeof(double)); /* setting all coordinates to 0 */ for (i=0; i /*---------------------------------------------------------------------------*/ struct unur_slist * _unur_slist_new( void ) /*----------------------------------------------------------------------*/ /* Make new simple list. */ /* Append pointer to element to simple list. */ /* */ /* parameters: none */ /* */ /* return: */ /* pointer to new empty simple list */ /*----------------------------------------------------------------------*/ { struct unur_slist *slist; /* allocate structure */ slist = _unur_xmalloc(sizeof(struct unur_slist)); COOKIE_SET(slist,CK_SLIST); /* initialize */ slist->ptr = NULL; slist->n_ptr = 0; return slist; } /* end of _unur_slist_new() */ /*---------------------------------------------------------------------------*/ int _unur_slist_length( const struct unur_slist *slist ) /*----------------------------------------------------------------------*/ /* Get length if list (number of list entries). */ /* */ /* parameters: */ /* slist ... pointer to simple list */ /* */ /* return: */ /* number of elements */ /*----------------------------------------------------------------------*/ { /* check arguments */ CHECK_NULL(slist,0); COOKIE_CHECK(slist,CK_SLIST,0); if (slist->ptr==NULL) return 0; return (slist->n_ptr); } /* end of _unur_slist_length() */ /*---------------------------------------------------------------------------*/ void * _unur_slist_get( const struct unur_slist *slist, int n ) /*----------------------------------------------------------------------*/ /* Get pointer to n-th element. */ /* */ /* parameters: */ /* slist ... pointer to simple list */ /* n ... index element */ /* */ /* return: */ /* pointer to element */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { /* check arguments */ CHECK_NULL(slist,NULL); COOKIE_CHECK(slist,CK_SLIST,NULL); if (slist->ptr==NULL || n >= slist->n_ptr || n < 0) { _unur_warning("list",UNUR_ERR_GENERIC,"element does not exist"); return NULL; } return (slist->ptr[n]); } /* end of _unur_slist_get() */ /*---------------------------------------------------------------------------*/ int _unur_slist_append( struct unur_slist *slist, void *element ) /*----------------------------------------------------------------------*/ /* Append pointer to element to simple list. */ /* */ /* parameters: */ /* slist ... pointer to simple list */ /* element ... pointer to element to be appended */ /* */ /* return: */ /* success ... UNUR_SUCCESS */ /* error ... error code */ /*----------------------------------------------------------------------*/ { /* check arguments */ CHECK_NULL(slist,UNUR_ERR_NULL); COOKIE_CHECK(slist,CK_SLIST,UNUR_ERR_COOKIE); /* allocate memory for the list of blocks */ slist->ptr = _unur_xrealloc(slist->ptr,(slist->n_ptr+1)*sizeof(void *)); /* store allocated element */ slist->ptr[slist->n_ptr] = element; /* update number of allocated elements */ ++(slist->n_ptr); return UNUR_SUCCESS; } /* end of _unur_slist_append() */ /*---------------------------------------------------------------------------*/ void * _unur_slist_replace( struct unur_slist *slist, int n, void *element ) /*----------------------------------------------------------------------*/ /* Replace (existing) pointer to n-th element by 'element'. */ /* */ /* If n-th element does not exist, no new element is inserted! */ /* */ /* parameters: */ /* slist ... pointer to simple list */ /* n ... index element */ /* element ... pointer to new element to be inserted */ /* */ /* return: */ /* pointer to old element */ /* */ /* error: */ /* return NULL */ /*----------------------------------------------------------------------*/ { void *old_element; /* check arguments */ CHECK_NULL(slist,NULL); COOKIE_CHECK(slist,CK_SLIST,NULL); if (slist->ptr==NULL || n >= slist->n_ptr || n < 0) { _unur_warning("list",UNUR_ERR_GENERIC,"element does not exist"); return NULL; } old_element = slist->ptr[n]; slist->ptr[n] = element; return old_element; } /* end of _unur_slist_replace() */ /*---------------------------------------------------------------------------*/ void _unur_slist_free( struct unur_slist *slist ) /*----------------------------------------------------------------------*/ /* Free all elements and list in simple list. */ /* compute "arctan mean" of two numbers. */ /* */ /* parameters: */ /* slist ... pointer to simple list */ /*----------------------------------------------------------------------*/ { int i; /* check arguments */ if (slist == NULL) return; /* nothing to do */ COOKIE_CHECK(slist,CK_SLIST,RETURN_VOID); if ( slist->ptr != NULL ) { /* free memory blocks */ for (i=0; i < slist->n_ptr; i++) if (slist->ptr[i]) free(slist->ptr[i]); free(slist->ptr); slist->ptr = NULL; } /* free list */ free (slist); } /* end of _unur_slist_free() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/utils/error.c0000644001357500135600000003575014420445767013310 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: error.c * * * * routines for warnings and error messages * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include /*---------------------------------------------------------------------------*/ /* global variables */ /* global variable used to record errors */ int unur_errno = UNUR_SUCCESS; /* error handler used to report errors in UNURAN */ static UNUR_ERROR_HANDLER *_unur_error_handler = _unur_error_handler_default; /*---------------------------------------------------------------------------*/ void _unur_error_x( const char *objid, const char *file, int line, const char *errortype, int errorcode, const char *reason ) /*----------------------------------------------------------------------*/ /* error handler */ /* */ /* parameters: */ /* objid ... id/type of object */ /* file ... file name (inserted by __FILE__) */ /* line ... line number in source file (inserted by __LINE__) */ /* errortype ... "warning" or "error" */ /* errorcode ... UNURAN error code */ /* reason ... (very) short description of reason for error */ /*----------------------------------------------------------------------*/ { _unur_error_handler(objid, file, line, errortype, errorcode, reason); unur_errno = errorcode; } /* end of _unur_error_x() */ /*---------------------------------------------------------------------------*/ void _unur_error_handler_default( const char *objid, const char *file, int line, const char *errortype, int errorcode, const char *reason ) /*----------------------------------------------------------------------*/ /* default error handler */ /* */ /* parameters: */ /* objid ... id/type of object */ /* file ... file name (inserted by __FILE__) */ /* line ... line number in source file (inserted by __LINE__) */ /* errortype ... "warning" or "error" */ /* errorcode ... UNURAN error code */ /* reason ... (very) short description of reason for error */ /*----------------------------------------------------------------------*/ { FILE *LOG = unur_get_stream(); /* generator identifier known ? */ if (!objid) objid = "UNURAN"; fprintf(LOG,"%s: [%s] %s:%d - %s:\n", objid, errortype, file, line, unur_get_strerror(errorcode)); if (reason && strlen(reason)) fprintf(LOG,"%s: ..> %s\n", objid, reason); fflush(LOG); /* in case of a segmentation fault */ } /* end of _unur_error_handler_default() */ /*---------------------------------------------------------------------------*/ void _unur_error_handler_off( const char *objid ATTRIBUTE__UNUSED, const char *file ATTRIBUTE__UNUSED, int line ATTRIBUTE__UNUSED, const char *errortype ATTRIBUTE__UNUSED, int errorcode ATTRIBUTE__UNUSED, const char *reason ATTRIBUTE__UNUSED ) /*----------------------------------------------------------------------*/ /* disable error handler (except for logging) */ /* */ /* parameters: */ /* objid ... id/type of object */ /* file ... file name (inserted by __FILE__) */ /* line ... line number in source file (inserted by __LINE__) */ /* errortype ... "warning" or "error" */ /* errorcode ... UNURAN error code */ /* reason ... (very) short description of reason for error */ /*----------------------------------------------------------------------*/ { return; } /* end of _unur_error_handler_off() */ /*---------------------------------------------------------------------------*/ #ifdef UNUR_COOKIES void _unur_error_cookies( const char *file, int line, unsigned observed, unsigned expected ) /*----------------------------------------------------------------------*/ /* print error message: invalid cookie detected */ /* */ /* parameters: */ /* file ... file name (inserted by __FILE__) */ /* line ... line number in source file (inserted by __LINE__) */ /* observed ... observed cookie */ /* expected ... expected cookie */ /*----------------------------------------------------------------------*/ { struct unur_string *reason = _unur_string_new(); _unur_string_append( reason, "observed = %#x, expected = %#x", observed, expected ); _unur_error_x( "COOKIE", file, line, "error", UNUR_ERR_COOKIE, reason->text); _unur_string_free( reason ); } /* end of _unur_error_cookies() */ #endif /*---------------------------------------------------------------------------*/ const char * unur_get_strerror ( const int errorcode ) /*----------------------------------------------------------------------*/ /* return string that describes error */ /* */ /* parameters: */ /* errorcode ... error code */ /* */ /* return: */ /* pointer to charater string */ /* */ /*----------------------------------------------------------------------*/ { switch (errorcode) { /** procedure executed successfully **/ case UNUR_SUCCESS: return "(no error)"; /** distribution object **/ case UNUR_ERR_DISTR_NPARAMS: return "(distribution) invalid number of parameters"; case UNUR_ERR_DISTR_DOMAIN: return "(distribution) parameter out of domain"; case UNUR_ERR_DISTR_GEN: return "(distribution) invalid variant for special generator"; case UNUR_ERR_DISTR_INVALID: return "(distribution) invalid distribution object"; case UNUR_ERR_DISTR_REQUIRED: return "(distribution) incomplete distribution object, entry missing"; case UNUR_ERR_DISTR_UNKNOWN: return "(distribution) unknown distribution, cannot handle"; case UNUR_ERR_DISTR_SET: return "(distribution) set failed (invalid parameter)"; case UNUR_ERR_DISTR_GET: return "(distribution) get failed (parameter not set)"; case UNUR_ERR_DISTR_DATA: return "(distribution) data are missing (cannot execute)"; case UNUR_ERR_DISTR_PROP: return "(distribution) desired property does not exist"; /** parameter object **/ case UNUR_ERR_PAR_SET: return "(parameter) set failed, invalid parameter -> using default"; case UNUR_ERR_PAR_VARIANT: return "(parameter) invalid variant -> using default"; case UNUR_ERR_PAR_INVALID: return "(parameter) invalid parameter object"; /** generator object **/ case UNUR_ERR_GEN_DATA: return "(generator) (possible) invalid data"; case UNUR_ERR_GEN_CONDITION: return "(generator) condition for method violated"; case UNUR_ERR_GEN_INVALID: return "(generator) invalid generator object"; case UNUR_ERR_GEN_SAMPLING: return "(generator) sampling error"; case UNUR_ERR_NO_REINIT: return "(generator) reinit not implemented"; case UNUR_ERR_NO_QUANTILE: return "(generator) quantile not implemented"; case UNUR_ERR_GEN: return "(generator)"; /** uniform random number generator (URNG) object **/ case UNUR_ERR_URNG: return "(URNG)"; case UNUR_ERR_URNG_MISS: return "(URNG) missing functionality"; /** string parser **/ case UNUR_ERR_STR: return "(parser) invalid string"; case UNUR_ERR_STR_UNKNOWN: return "(parser) unknown keyword"; case UNUR_ERR_STR_SYNTAX: return "(parser) syntax error"; case UNUR_ERR_STR_INVALID: return "(parser) invalid parameter"; case UNUR_ERR_FSTR_SYNTAX: return "(function parser) syntax error"; case UNUR_ERR_FSTR_DERIV: return "(function parser) cannot derivate function"; /** misc **/ case UNUR_ERR_DOMAIN: return "argument out of domain"; case UNUR_ERR_ROUNDOFF: return "(serious) round-off error"; case UNUR_ERR_MALLOC: return "virtual memory exhausted"; case UNUR_ERR_NULL: return "invalid NULL pointer"; case UNUR_ERR_COOKIE: return "invalid cookie"; case UNUR_ERR_SILENT: return "(silent error)"; case UNUR_ERR_GENERIC: return ""; case UNUR_ERR_INF: return "invalid infinity occured"; case UNUR_ERR_NAN: return "NaN occured"; /** compilation switches **/ case UNUR_ERR_COMPILE: return "not available, recompile library"; /** this should not happen **/ case UNUR_ERR_SHOULD_NOT_HAPPEN: default: return "error should not happen, report this!"; } } /* end of unur_get_strerror() */ /*---------------------------------------------------------------------------*/ UNUR_ERROR_HANDLER * unur_set_error_handler( UNUR_ERROR_HANDLER *new_handler ) /*----------------------------------------------------------------------*/ /* (re)set error handler */ /* */ /* parameters: */ /* new_handler ... new error handler */ /* */ /* return: */ /* pointer to old error handler */ /*----------------------------------------------------------------------*/ { UNUR_ERROR_HANDLER *old_handler = _unur_error_handler; _unur_error_handler = (new_handler) ? new_handler : _unur_error_handler_default; return old_handler; } /* end of unur_set_error_handler() */ /*---------------------------------------------------------------------------*/ UNUR_ERROR_HANDLER * unur_set_error_handler_off( void ) /*----------------------------------------------------------------------*/ /* disable error messages */ /* */ /* parameters: none */ /* */ /* return: */ /* pointer to old error handler */ /*----------------------------------------------------------------------*/ { UNUR_ERROR_HANDLER *old_handler = _unur_error_handler; _unur_error_handler = _unur_error_handler_off; return old_handler; } /* end of unur_set_error_handler_off() */ /*---------------------------------------------------------------------------*/ int unur_get_errno ( void ) /*----------------------------------------------------------------------*/ /* get current value of global variable 'unur_errno' */ /*----------------------------------------------------------------------*/ { return unur_errno; } /*---------------------------------------------------------------------------*/ void unur_reset_errno ( void ) /*----------------------------------------------------------------------*/ /* reset global variable 'unur_errno' to UNUR_SUCCESS */ /*----------------------------------------------------------------------*/ { unur_errno = UNUR_SUCCESS; } /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/utils/umath_source.h0000644001357500135600000000677014420445767014662 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: umath_source.h * * * * PURPOSE: * * declares macros, constants, structures, function prototypes, etc. * * for using mathematics in UNU.RAN. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifndef UMATH_SOURCE_H_SEEN #define UMATH_SOURCE_H_SEEN /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* Prototypes for various functions used in library */ /* Compute a "mean" defined as combibation of arithmetic and harmonic mean */ double _unur_arcmean( double x0, double x1 ); /*---------------------------------------------------------------------------*/ /* Macros */ #define _unur_min(x,y) (((x)<(y)) ? (x) : (y)) #define _unur_max(x,y) (((x)>(y)) ? (x) : (y)) /*---------------------------------------------------------------------------*/ #endif /* UMATH_SOURCE_H_SEEN */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/utils/umath.h0000644001357500135600000001033614420445767013273 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: umath.h * * * * PURPOSE: * * defines macros and function prototypes for miscelleanous * * mathematical routines * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifndef MATH_H_SEEN #define MATH_H_SEEN /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* =NODE Math Mathematics =UP Misc [0] =DESCRIPTION The following macros have been defined @ftable @code @item UNUR_INFINITY indicates infinity for floating point numbers (of type @code{double}). Internally @code{HUGE_VAL} is used. @item INT_MAX @itemx INT_MIN indicate infinity and minus infinity, resp., for integers (defined by ISO C standard). @item TRUE @itemx FALSE bolean expression for return values of @code{set} functions. @end ftable =END */ /*---------------------------------------------------------------------------*/ /* Define INFINITY */ /* (we use the largest possible value to indicate infinity) */ #include #ifndef INFINITY /* use a global variable to store infinity */ /* (definition in umath.c) */ extern const double INFINITY; #endif #define UNUR_INFINITY (INFINITY) /*---------------------------------------------------------------------------*/ /* True and false */ #ifndef TRUE #define TRUE (1) #endif #ifndef FALSE #define FALSE (0) #endif /*---------------------------------------------------------------------------*/ #endif /* MATH_H_SEEN */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/utils/unur_errno.h0000644001357500135600000002541114420445767014353 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: unur_errno.h * * * * PURPOSE: * * defines error codes. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifndef UNUR_ERRNO_H_SEEN #define UNUR_ERRNO_H_SEEN /*---------------------------------------------------------------------------*/ /* =NODE Errno Error codes =UP Error_Debug [40] =DESCRIPTION @subsubheading List of error codes @itemize @bullet @item Procedure executed successfully (no error) @ftable @code @item UNUR_SUCCESS (0x0u) success (no error) @end ftable @item Errors that occurred while handling distribution objects. @ftable @code @item UNUR_ERR_DISTR_SET set failed (invalid parameter). @item UNUR_ERR_DISTR_GET get failed (parameter not set). @item UNUR_ERR_DISTR_NPARAMS invalid number of parameters. @item UNUR_ERR_DISTR_DOMAIN parameter(s) out of domain. @item UNUR_ERR_DISTR_GEN invalid variant for special generator. @item UNUR_ERR_DISTR_REQUIRED incomplete distribution object, entry missing. @item UNUR_ERR_DISTR_UNKNOWN unknown distribution, cannot handle. @item UNUR_ERR_DISTR_INVALID invalid distribution object. @item UNUR_ERR_DISTR_DATA data are missing. @item UNUR_ERR_DISTR_PROP desired property does not exist @end ftable @item Errors that occurred while handling parameter objects. @ftable @code @item UNUR_ERR_PAR_SET set failed (invalid parameter) @item UNUR_ERR_PAR_VARIANT invalid variant -> using default @item UNUR_ERR_PAR_INVALID invalid parameter object @end ftable @item Errors that occurred while handling generator objects. @ftable @code @item UNUR_ERR_GEN error with generator object. @item UNUR_ERR_GEN_DATA (possibly) invalid data. @item UNUR_ERR_GEN_CONDITION condition for method violated. @item UNUR_ERR_GEN_INVALID invalid generator object. @item UNUR_ERR_GEN_SAMPLING sampling error. @item UNUR_ERR_NO_REINIT reinit routine not implemented. @item UNUR_ERR_NO_QUANTILE quantile routine not implemented. @end ftable @item Errors that occurred while handling URNG objects. @ftable @code @item UNUR_ERR_URNG generic error with URNG object. @item UNUR_ERR_URNG_MISS missing functionality. @end ftable @item Errors that occurred while parsing strings. @ftable @code @item UNUR_ERR_STR error in string. @item UNUR_ERR_STR_UNKNOWN unknown keyword. @item UNUR_ERR_STR_SYNTAX syntax error. @item UNUR_ERR_STR_INVALID invalid parameter. @item UNUR_ERR_FSTR_SYNTAX syntax error in function string. @item UNUR_ERR_FSTR_DERIV cannot derivate function. @end ftable @item Other run time errors. @ftable @code @item UNUR_ERR_DOMAIN argument out of domain. @item UNUR_ERR_ROUNDOFF (serious) round-off error. @item UNUR_ERR_MALLOC virtual memory exhausted. @item UNUR_ERR_NULL invalid NULL pointer. @item UNUR_ERR_COOKIE invalid cookie. @item UNUR_ERR_GENERIC generic error. @item UNUR_ERR_SILENT silent error (no error message). @item UNUR_ERR_INF infinity occured. @item UNUR_ERR_NAN NaN occured. @item UNUR_ERR_COMPILE Requested routine requires different compilation switches. Recompilation of library necessary. @item UNUR_ERR_SHOULD_NOT_HAPPEN Internal error, that should not happen. Please report this bug! @end ftable @end itemize =END =EON */ /*---------------------------------------------------------------------------*/ enum { /** procedure executed successfully **/ UNUR_SUCCESS = 0x00, /* exited successfully */ /** procedure executed with error (for internal use) **/ UNUR_FAILURE = 0x01, /* failure */ /** distribution object **/ /* @code{UNUR_ERR_DISTR_...} Errors that occurred while handling distribution objects. */ UNUR_ERR_DISTR_SET = 0x11, /* set failed (invalid parameter) */ UNUR_ERR_DISTR_GET = 0x12, /* get failed (parameter not set) */ UNUR_ERR_DISTR_NPARAMS = 0x13, /* invalid number of parameters */ UNUR_ERR_DISTR_DOMAIN = 0x14, /* parameter out of domain */ UNUR_ERR_DISTR_GEN = 0x15, /* invalid variant for special generator */ UNUR_ERR_DISTR_REQUIRED = 0x16, /* incomplete distribution object, entry missing */ UNUR_ERR_DISTR_UNKNOWN = 0x17, /* unknown distribution, cannot handle */ UNUR_ERR_DISTR_INVALID = 0x18, /* invalid distribution object */ UNUR_ERR_DISTR_DATA = 0x19, /* data are missing */ UNUR_ERR_DISTR_PROP = 0x20, /* desired property does not exist */ /** parameter object **/ /* @code{UNUR_ERR_PAR_...} Errors that occurred while handling parameter objects. */ UNUR_ERR_PAR_SET = 0x21, /* set failed (invalid parameter) */ UNUR_ERR_PAR_VARIANT = 0x22, /* invalid variant -> using default */ UNUR_ERR_PAR_INVALID = 0x23, /* invalid parameter object */ /** generator object **/ /* @code{UNUR_ERR_GEN_...} Errors that occurred while handling generator objects. */ UNUR_ERR_GEN = 0x31, /* bit for generator object */ UNUR_ERR_GEN_DATA = 0x32, /* (possible) invalid data */ UNUR_ERR_GEN_CONDITION = 0x33, /* condition for method violated */ UNUR_ERR_GEN_INVALID = 0x34, /* invalid generator object */ UNUR_ERR_GEN_SAMPLING = 0x35, /* sampling error */ UNUR_ERR_NO_REINIT = 0x36, /* reinit not implemented */ UNUR_ERR_NO_QUANTILE = 0x37, /* qunantile not implemented */ /** uniform random number generator (URNG) object **/ /* @code{UNUR_ERR_URNG_...} Errors that occurred while handling URNG objects. */ UNUR_ERR_URNG = 0x41, /* generic error with URNG object */ UNUR_ERR_URNG_MISS = 0x42, /* missing functionality */ /** string parser **/ /* @code{UNUR_ERR_STR_...} Errors that occurred while parsing strings. */ UNUR_ERR_STR = 0x51, /* error in stringparser */ UNUR_ERR_STR_UNKNOWN = 0x52, /* unknown key word in string */ UNUR_ERR_STR_SYNTAX = 0x53, /* syntax error in string */ UNUR_ERR_STR_INVALID = 0x54, /* invalid parameter in argument */ UNUR_ERR_FSTR_SYNTAX = 0x55, /* syntax error in function parser */ UNUR_ERR_FSTR_DERIV = 0x56, /* cannot derivate function */ /** misc **/ /* @code{UNUR_ERR_...} Other errors. */ UNUR_ERR_DOMAIN = 0x61, /* argument out of domain */ UNUR_ERR_ROUNDOFF = 0x62, /* (serious) round-off error */ UNUR_ERR_MALLOC = 0x63, /* virtual memory exhausted */ UNUR_ERR_NULL = 0x64, /* invalid NULL pointer */ UNUR_ERR_COOKIE = 0x65, /* invalid cookie */ UNUR_ERR_GENERIC = 0x66, /* generic error */ UNUR_ERR_SILENT = 0x67, /* silent error (no error message) */ UNUR_ERR_INF = 0x68, /* infinity occured */ UNUR_ERR_NAN = 0x69, /* NaN occured */ /** compilation switches **/ /* @code{UNUR_ERR_COMPILE} Requested routine requires different compilation switches. Recompilation of library necessary. */ UNUR_ERR_COMPILE = 0xa0, /* not available, recompile library */ /** this should not happen **/ /* @code{UNUR_ERR_SHOULD_NOT_HAPPEN} Internal error. This should not happen. Please make a bug report. */ UNUR_ERR_SHOULD_NOT_HAPPEN = 0xf0 /* error should not happen, report this! */ }; /*---------------------------------------------------------------------------*/ #endif /* UNUR_ERRNO_H_SEEN */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/utils/fmax.c0000644001357500135600000004646214420445767013114 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: fmax.c * * * * Find maximum of a function using Brent's algorithm. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include "fmax_source.h" /*---------------------------------------------------------------------------*/ double _unur_util_find_max( struct unur_funct_generic fs, /* function structure */ double interval_min, /* lower bound of interval */ double interval_max, /* upper bound of interval */ double guess_max /* initial guess for maximum */ ) /*----------------------------------------------------------------------*/ /* find max of univariate continuous distribution numerically */ /* */ /* This is achieved by the following steps: */ /* -- Determine a interval containing the max and a third */ /* point within ( x0< x1 < x2 ) */ /* ++ Determine a region where to search the max; this will be the */ /* interval [max-100, max+100] if this is no contrdiction to */ /* the given interval;`max' is the best known approx to the max */ /* ++ Find a point in the interval with a positve pdf */ /* This is done by two geometric sequences of MAX_SRCH elements */ /* and find two other points within the given domain */ /* ++ Unbounded domains: refine x0, x1, x2 until: */ /* f(x0) < f(x1) > f(x2) */ /* -- invoke a maximization-routine to determine the max */ /* */ /* parameters: */ /* fs ... function structure */ /* interval_min ... left boundary of function definition interval */ /* interval_max ... right boundary of function definition interval */ /* guess_max ... initial guess for max position */ /* */ /* return: */ /* x ... approximate position of max on success */ /* UNUR_INFINITY ... on error */ /*----------------------------------------------------------------------*/ { #define MAX_SRCH (100) int i; double x[3]; /* max (and x[2]) should be between x[0] and x[2] ...*/ double fx[3]; /* ... and the respective funtion values */ double max; /* (approximative) max of the distribution */ double max_l; /* lower bound for max search */ double max_u; /* upper bound for max search */ double step; int unbound_left; int unbound_right; /* first guess for max */ max = (_unur_FP_is_infinity(guess_max)) ? 0. : guess_max; /* determine where to look for the max */ /* unbounded domain */ if ( _unur_FP_is_minus_infinity(interval_min) && _unur_FP_is_infinity(interval_max) ){ unbound_left = 1; unbound_right = 1; x[1] = max; fx[1] = fs.f(x[1], fs.params); max_l = max - 100.0; max_u = max + 100.0; } /* domain unbounded on the right */ else if ( ! _unur_FP_is_minus_infinity(interval_min) && _unur_FP_is_infinity(interval_max) ){ unbound_left = 0; unbound_right = 1; if ( max >= interval_min ){ x[1] = max; fx[1] = fs.f(x[1], fs.params); max_l = interval_min; max_u = 2 * max - interval_min; } else{ x[1] = interval_min + 100.0; fx[1] = fs.f(x[1], fs.params); max_l = interval_min; max_u = x[1] + 100.0; } } /* domain unbounded on the left */ else if ( _unur_FP_is_minus_infinity(interval_min) && ! _unur_FP_is_infinity(interval_max) ){ unbound_left = 1; unbound_right = 0; if ( max <= interval_max ){ x[1] = max; fx[1] = fs.f(x[1], fs.params); max_l = interval_max - 2 * max; max_u = interval_max; } else{ x[1] = interval_max - 100.0; fx[1] = fs.f(x[1], fs.params); max_l = x[1] - 100.0; max_u = interval_max; } } /* domain is bounded */ else { unbound_left = 0; unbound_right = 0; if ( max >= interval_min && max <= interval_max ){ x[1] = max; fx[1] = fs.f(x[1], fs.params); } else{ x[1] = interval_min/2.0 + interval_max/2.0; fx[1] = fs.f(x[1], fs.params); } max_l = interval_min; max_u = interval_max; } max = x[1]; /* not exact mode -- best guess */ /* find point with pdf > 0.0 -- max MAX_SRCH trials */ /* search on the left side */ step = pow(x[1]-max_l, 1.0/MAX_SRCH); i = 0; while (i <= MAX_SRCH && _unur_FP_same(0.0, fx[1]) ){ x[1] = max - pow(step, (double)i); fx[1] = fs.f(x[1], fs.params); i++; } /* search on the right side */ if( _unur_FP_same(0.0, fx[1]) ){ step = pow(max_u-x[1], 1.0/MAX_SRCH); i = 0; while (i <= MAX_SRCH && _unur_FP_same(0.0, fx[1]) ){ x[1] = max + pow(step, (double)i); fx[1] = fs.f(x[1], fs.params); i++; } } /* no success -- exit routine */ if( _unur_FP_same(fx[1], 0.0) ) return UNUR_INFINITY; /* can't find max in flat region */ /* x[1] has f > 0 or routines already terminated */ /* determine 3 points in the given domain -- at least one with pdf > 0 */ if ( unbound_left ){ x[2] = x[1]; fx[2] = fx[1]; x[1] = x[2] - 1.0; fx[1] = fs.f(x[1], fs.params); x[0] = x[2] - 2.0; fx[0] = fs.f(x[0], fs.params); } else if ( unbound_right ){ x[0] = x[1]; fx[0] = fx[1]; x[1] = x[0] + 1.0; fx[1] = fs.f(x[1], fs.params); x[2] = x[0] + 2.0; fx[2] = fs.f(x[2], fs.params); } else{ /* bounded */ x[0] = interval_min; fx[0] = fs.f(x[0], fs.params); x[2] = interval_max; fx[2] = fs.f(x[2], fs.params); if ( _unur_FP_same(x[1], interval_min) || _unur_FP_same(x[1], interval_max) ){ x[1] = interval_min/2.0 + interval_max/2.0; fx[1] = fs.f(x[1], fs.params); } } /* points x[i] with their function values determined */ /* find interval containing the max */ step = 1.0; if ( unbound_right ){ while(fx[0] <= fx[1] && fx[1] <= fx[2]){ /* on the left side of the max */ step *= 2.0; x[0] = x[1]; fx[0] = fx[1]; x[1] = x[2]; fx[1] = fx[2]; x[2] += step; fx[2] = fs.f(x[2], fs.params); } } step = 1.0; /* reset step size */ if ( unbound_left ){ while(fx[0] >= fx[1] && fx[1] >= fx[2]){ /* on the right side of the max */ step *= 2.0; x[2] = x[1]; fx[2] = fx[1]; x[1] = x[0]; fx[1] = fx[0]; x[0] -= step; fx[0] = fs.f(x[0], fs.params); } } /* now: the max is between x[0] and x[2] */ /* printf("x0: %f, fx0: %e\n", x[0], fx[0]); */ /* printf("x1: %f, fx1: %e\n", x[1], fx[1]); */ /* printf("x2: %f, fx2: %e\n", x[2], fx[2]); */ /** TODO: FLT_MIN must be much larger than DBL_MIN **/ max = _unur_util_brent( fs, x[0], x[2], x[1], FLT_MIN ); if (!(_unur_FP_is_infinity( max )) ){ /* mode successfully computed */ } else { /* computing max did not work */ return UNUR_INFINITY; } /* o.k. */ return max; #undef MAX_SRCH } /* end of _unur_util_find_max() */ /*---------------------------------------------------------------------------*/ /* */ /* Brent algorithm for maximum-calculation of a continous function */ /* */ /*---------------------------------------------------------------------------*/ /* ***************************************************************************** * C math library * * function FMINBR - one-dimensional search for a function minimum * * over the given range * * * * Author: Oleg Keselyov. * * * * modified by Josef Leydold (documentation unchanged) * * computed maximum instead of minimum. * * * * Input * * double fminbr(f, a,b,c,tol) * * double a; Minimum will be seeked for over * * double b; a range [a,b], a being < b. * * double c; c within (a,b) is first guess * * double (*f)(double x); Name of the function whose minimum * * will be seeked for * * double tol; Acceptable tolerance for the minimum * * location. It have to be positive * * (e.g. may be specified as EPSILON) * * * * Output * * Fminbr returns an estimate for the minimum location with accuracy * * 3*SQRT_EPSILON*abs(x) + tol. * * The function always obtains a local minimum which coincides with * * the global one only if a function under investigation being * * unimodular. * * If a function being examined possesses no local minimum within * * the given range, Fminbr returns 'a' (if f(a) < f(b)), otherwise * * it returns the right range boundary value b. * * * * Algorithm * * G.Forsythe, M.Malcolm, C.Moler, Computer methods for mathematical * * computations. M., Mir, 1980, p.202 of the Russian edition * * * * The function makes use of the "gold section" procedure combined with * * the parabolic interpolation. * * At every step program operates three abscissae - x,v, and w. * * x - the last and the best approximation to the minimum location, * * i.e. f(x) <= f(a) or/and f(x) <= f(b) * * (if the function f has a local minimum in (a,b), then the both * * conditions are fulfiled after one or two steps). * * v,w are previous approximations to the minimum location. They may * * coincide with a, b, or x (although the algorithm tries to make all * * u, v, and w distinct). Points x, v, and w are used to construct * * interpolating parabola whose minimum will be treated as a new * * approximation to the minimum location if the former falls within * * [a,b] and reduces the range enveloping minimum more efficient than * * the gold section procedure. * * When f(x) has a second derivative positive at the minimum location * * (not coinciding with a or b) the procedure converges superlinearly * * at a rate order about 1.324 * * * *****************************************************************************/ /* in case of any error UNUR_INFINITY is returned */ double _unur_util_brent( /* An estimate to the min or max location */ struct unur_funct_generic fs, /* Function struct */ double a, /* Left border | of the range */ double b, /* Right border| the min is seeked */ double c, /* first guess for the min/max */ double tol) /* Acceptable tolerance */ { #define SQRT_EPSILON (1.e-7) /* tolerance for relative error */ #define MAXIT (1000) /* maximum number of iterations */ /* compute maximum (instead of minimum as in original implementation ) */ #define f(x) ( (-1) * ((fs.f)(x, fs.params)) ) int i; double x,v,w; /* Abscissae, descr. see above */ double fx; /* f(x) */ double fv; /* f(v) */ double fw; /* f(w) */ const double r = (3.-sqrt(5.0))/2; /* Gold section ratio */ /* check arguments */ CHECK_NULL(fs.f, UNUR_INFINITY); if ( tol < 0. || b <= a || c <= a || b <= c) { _unur_error("CMAX",UNUR_ERR_SHOULD_NOT_HAPPEN,""); return UNUR_INFINITY; } /* Origially the third point was computed by golden section. In the */ /* modified version it is given as point `c' by the calling function. */ /* v = a + r*(b-a); fv = f(v); First step - always gold section */ v = c; fv = f(v); /* First step */ x = v; w = v; fx=fv; fw=fv; for(i=0; i < MAXIT; i++) { /* Main iteration loop */ double range = b-a; /* Range over which the minimum is */ /* seeked for */ double middle_range = (a+b)/2; double tol_act = /* Actual tolerance */ SQRT_EPSILON*fabs(x) + tol/3; double new_step; /* Step at this iteration */ if( fabs(x-middle_range) + range/2 <= 2*tol_act ) return x; /* Acceptable approx. is found */ /* Obtain the gold section step */ new_step = r * ( x= tol_act ) { /* If x and w are distinct */ /* interpolatiom may be tried */ register double p; /* Interpolation step is calculated */ register double q; /* as p/q; division operation */ /* is delayed until last moment */ register double t; t = (x-w) * (fx-fv); q = (x-v) * (fx-fw); p = (x-v)*q - (x-w)*t; q = 2*(q-t); if( q>(double)0 ) /* q was calculated with the */ p = -p; /* opposite sign; make q positive */ else /* and assign possible minus to p */ q = -q; if( fabs(p) < fabs(new_step*q) && /* If x + p/q falls in [a,b] not too */ p > q*(a-x+2*tol_act) && /* close to a and b, and isn't too */ p < q*(b-x-2*tol_act) ) /* large, it is accepted. */ new_step = p/q; /* If p/q is too large then the */ /* gold section procedure can reduce */ /* [a,b] range to more extent. */ } if( fabs(new_step) < tol_act ) { /* Adjust the step to be not less */ if( new_step > (double)0 ) /* than tolerance. */ new_step = tol_act; else new_step = -tol_act; } /* Obtain the next approximation to min */ { /* and reduce the enveloping range. */ register double t = x + new_step; /* Tentative point for the min */ register double ft = f(t); if( ft <= fx ) { /* t is a better approximation */ if( t < x ) b = x; /* Reduce the range so that */ else /* t would fall within it */ a = x; v = w; w = x; x = t; /* Assign the best approx to x */ fv=fw; fw=fx; fx=ft; } else { /* x remains the better approx */ if( t < x ) a = t; /* Reduce the range enclosing x */ else b = t; if( ft <= fw || _unur_FP_same(w,x) ) { v = w; w = t; fv=fw; fw=ft; } else if( ft<=fv || _unur_FP_same(v,x) || _unur_FP_same(v,w) ) { v = t; fv=ft; } } } /* ----- end-of-block ----- */ } /* ===== End of for loop ===== */ /* maximal number of iterations exceeded */ return UNUR_INFINITY; #undef f #undef MAXIT #undef SQRT_EPSILON } /* end of _unur_util_brent() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/utils/debug.c0000644001357500135600000001656014420445767013243 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: debug.c * * * * debugging routines * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include /*---------------------------------------------------------------------------*/ /*****************************************************************************/ /** **/ /** Set debuging flags **/ /** **/ /*****************************************************************************/ /*---------------------------------------------------------------------------*/ /* global variable for default debugging flags */ unsigned _unur_default_debugflag = UNUR_DEBUGFLAG_DEFAULT; /*---------------------------------------------------------------------------*/ int unur_set_debug( struct unur_par *par ATTRIBUTE__UNUSED, unsigned debug ATTRIBUTE__UNUSED ) /*----------------------------------------------------------------------*/ /* set debugging flag for generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* debug ... debugging flag */ /*----------------------------------------------------------------------*/ { #ifdef UNUR_ENABLE_LOGGING _unur_check_NULL( NULL,par,UNUR_ERR_NULL ); par->debug = debug; return UNUR_SUCCESS; #else _unur_warning("DEBUG",UNUR_ERR_COMPILE,"debugging not enabled"); return UNUR_ERR_COMPILE; #endif } /* end of unur_set_debug() */ /*---------------------------------------------------------------------------*/ int unur_chg_debug( struct unur_gen *gen ATTRIBUTE__UNUSED, unsigned debug ATTRIBUTE__UNUSED ) /*----------------------------------------------------------------------*/ /* change debugging flag for generator */ /* */ /* parameters: */ /* gen ... pointer to generator object */ /* debug ... debugging flag */ /*----------------------------------------------------------------------*/ { #ifdef UNUR_ENABLE_LOGGING CHECK_NULL( gen, UNUR_ERR_NULL ); gen->debug = debug; return UNUR_SUCCESS; #else _unur_warning("DEBUG",UNUR_ERR_COMPILE,"debugging not enabled"); return UNUR_ERR_COMPILE; #endif } /* end of unur_chg_debug() */ /*---------------------------------------------------------------------------*/ int unur_set_default_debug( unsigned debug ) /*----------------------------------------------------------------------*/ /* set default debugging flag for generator */ /* */ /* parameters: */ /* par ... pointer to parameter for building generator object */ /* debug ... debugging flag */ /*----------------------------------------------------------------------*/ { _unur_default_debugflag = debug; return UNUR_SUCCESS; } /* end of unur_set_default_debug() */ /*---------------------------------------------------------------------------*/ char * _unur_make_genid( const char *gentype ) /*----------------------------------------------------------------------*/ /* make a new generator identifier */ /* */ /* parameters: */ /* gentype ... type of generator */ /* */ /* return: */ /* pointer generator id (char string) */ /*----------------------------------------------------------------------*/ { static int count = 0; /* counter for identifiers */ char *genid; size_t len; /* allocate memory for identifier */ len = strlen(gentype); genid = _unur_xmalloc(sizeof(char)*(len+5)); /* make new identifier */ ++count; count %= 1000; /* 1000 different generators should be enough */ #if HAVE_DECL_SNPRINTF /* this is part of ISO C99 */ snprintf(genid, len+5, "%s.%03d", gentype, count); #else #error Function snprintf() required. /* Fallback: */ /* sprintf(genid, "%s.%03d", gentype, count); */ #endif return genid; } /* end of _unur_make_genid() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/utils/vector_source.h0000644001357500135600000000614014420304141015011 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: vector_source.h * * * * Routines for computations with vectors (arrays). * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*--------------------------------------------------------------------------*/ double *_unur_vector_new(int dim); /* allocate memory for new vector and initialize to 0 */ void _unur_vector_free(double *v); /* free allocated memory used by vector */ double _unur_vector_norm(int dim, double *v); /* calculation of euclidean (L2) norm of vector */ double _unur_vector_scalar_product(int dim, double *v1, double *v2); /* calculation of scalar product */ void _unur_vector_normalize(int dim, double *v); /* normalize a vector to have unit norm */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/utils/error_source.h0000644001357500135600000001303014420445767014660 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: error_source.h * * * * PURPOSE: * * defines macros and function prototypes error messages * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifndef UNUR_ERROR_SOURCE_H_SEEN #define UNUR_ERROR_SOURCE_H_SEEN /*---------------------------------------------------------------------------*/ void _unur_error_x( const char *objid, const char *file, int line, const char *errortype, int errorcode, const char *reason ); /*---------------------------------------------------------------------------*/ /* set unur_errno and call error handler. */ /*---------------------------------------------------------------------------*/ /* void _unur_error_formated( const char *objid, const char *file, int line, */ /* const char *errortype, int errorcode, const char *format, ... ); */ /*---------------------------------------------------------------------------*/ /* like _unur_error_x but used a template for more sophisticated messages. */ /*---------------------------------------------------------------------------*/ void _unur_error_handler_default( const char *objid, const char *file, int line, const char *errortype, int errorcode, const char *reason ); /*---------------------------------------------------------------------------*/ /* unuran default error handler */ /*---------------------------------------------------------------------------*/ void _unur_error_handler_off( const char *objid, const char *file, int line, const char *errortype, int errorcode, const char *reason ); /*---------------------------------------------------------------------------*/ /* disabled error handler (suppress all warnings and error messages */ /*---------------------------------------------------------------------------*/ #ifdef UNUR_COOKIES void _unur_error_cookies( const char *file, int line, unsigned observed, unsigned expected ); /*---------------------------------------------------------------------------*/ /* report invalid cookie */ /*---------------------------------------------------------------------------*/ #endif #define _unur_error(genid,errorcode,reason) \ do { \ _unur_error_x((genid),__FILE__,__LINE__,"error",(errorcode),(reason)); \ } while (0) /*---------------------------------------------------------------------------*/ /* call error handler in case of a (fatal) error. */ /*---------------------------------------------------------------------------*/ #define _unur_warning(genid,errorcode,reason) \ do { \ _unur_error_x((genid),__FILE__,__LINE__,"warning",(errorcode),(reason)); \ } while (0) /*---------------------------------------------------------------------------*/ /* call error handler in case of a warning. */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #endif /* UNUR_ERROR_SOURCE_H_SEEN */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/utils/mrou_rectangle_struct.h0000644001357500135600000000662614420304141016552 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: rou_rectangle_source.c * * * * * * DESCRIPTION: * * Structure needed for the bounding rectangle calculations used in * * the multivariate RoU-methods. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ struct MROU_RECTANGLE { UNUR_DISTR *distr; /* distribution object */ int dim; /* dimension of distribution */ double r; /* r-parameter of the mrou method */ int bounding_rectangle; /* flag to calculate bounding rectangle / strip */ double *umin, *umax; /* boundary rectangle u-coordinates */ double vmax; /* boundary rectangle v-coordinate */ const double *center; /* center of distribution */ int aux_dim; /* parameter used in auxiliary functions */ const char *genid; /* generator id */ }; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/utils/matrix_source.h0000644001357500135600000001333614420445767015044 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: matrix_source.h * * * * Routines for computations with square matrices. * * Matrices are stored as double array (i.e.: double *matrix). * * The rows of the matrix have to be stored consecutively in this array, * * i.e. the entry with index [i,j] can be entered via (i*dim+j), where * * dim is the dimension of the dim x dim - matrix. * * * * Routines are mainly adapted from the GSL (GNU Scientifiy Library) * * * ***************************************************************************** * * * adapted by Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ int _unur_matrix_transform_diagonal (int dim, const double *M, const double *D, double *res); /* Computes the transformation M^t . D . M of diagonal matrix D */ /* and stores it in matrix 'res'. */ int _unur_matrix_cholesky_decomposition (int dim, const double *S, double *L ); /* The Cholesky factor L of a variance-covariance matrix S is computed: */ /* S = LL' */ int _unur_matrix_invert_matrix (int dim, const double *A, double *Ainv, double *det ); /* Calculates the inverse matrix (by means of LU decomposition). */ /* As a side effect det(A) is computed. */ double _unur_matrix_determinant ( int dim, const double *A ); /* Calculates the determinant of the matrix A */ int _unur_matrix_multiplication(int dim, const double *A, const double *B, double *AB); /* Calculates the matrix multiplication of two matrices A and B */ double _unur_matrix_qf (int dim, double *x, double *A ); /* Compute quadratic form x'Ax. */ int _unur_matrix_eigensystem (int dim, const double *M, double *values, double *vectors ); /* Calculates eigenvalues and eigenvectors of real symmetric matrix M. */ /* The eigenvectors are normalized and (almost) orthognal. */ /* The eigenvectors are stored consecutively in the array vectors. */ void _unur_matrix_print_vector ( int dim, const double *vec, const char *info, FILE *LOG, const char *genid, const char *indent ); /* Print elements of vector in a single row enclosed by parenthesis into */ /* LOG file. The line starts with : */ /* is printed in a (first) separate line. */ /* A blank line is inserted after the printed vector. */ /* If the NULL pointer is given, the string "[unknown]" is printed. */ void _unur_matrix_print_matrix ( int dim, const double *mat, const char *info, FILE *LOG, const char *genid, const char *indent ); /* Print elements of the given x square matrix into LOG file. */ /* The matrix is stored row-wise in . */ /* The lines start with : */ /* is printed in a (first) separate line. */ /* A blank line is inserted after the printed matrix. */ /* If the NULL pointer is given, the string "[unknown]" is printed. */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/utils/debug_source.h0000644001357500135600000001045014420445767014620 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: debug_source.h * * * * PURPOSE: * * defines macros and function prototypes for debugging routines. * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* set generator id */ char *_unur_make_genid( const char *gentype ); #define _unur_set_genid(gentype) _unur_make_genid(gentype) #define _unur_free_genid(gen) do {if (gen->genid) free((gen)->genid);} while(0) /*---------------------------------------------------------------------------*/ /* default debugging flag for generator */ extern unsigned _unur_default_debugflag; /* default debugging flags */ /*---------------------------------------------------------------------------*/ /* warnings and error messages */ /* an abbreviation */ #define _unur_print_if_default(par,flag) if(!((par)->set & (flag))) fprintf(LOG," [default]") /*---------------------------------------------------------------------------*/ /* Check for NULL pointer */ #ifdef UNUR_ENABLE_CHECKNULL #define CHECK_NULL(ptr,rval) \ if (!(ptr)) { \ _unur_error(NULL,UNUR_ERR_NULL,""); \ return rval; \ } #else /* do not check (be carefull) */ #define CHECK_NULL(ptr,rval) do {} while(0) #endif /* the second macro cannot be switched off by a compiler switch */ #define _unur_check_NULL(gid,ptr,rval) \ if (!(ptr)) { \ _unur_error((gid),UNUR_ERR_NULL,""); \ return rval; \ } /* Some preprocessor (e.g. in MacOS X) fail when 'rval' is an empty string. */ /* The following should fix this problem. */ #define RETURN_VOID ; /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/utils/hooke.c0000644001357500135600000002773314420445767013266 00000000000000/********************************************************************/ /** **/ /** hooke.c **/ /** **/ /** find minimum of a multivariate function **/ /** **/ /** authors: see below **/ /** minor changes by Josef Leydold **/ /** **/ /** adapted for unuran in June 2004 **/ /** **/ /********************************************************************/ /*-----------------------------------------------------------------*/ /* Nonlinear Optimization using the algorithm of Hooke and Jeeves */ /* 12 February 1994 author: Mark G. Johnson */ /* Find a point X where the nonlinear function f(X) has a local */ /* minimum. X is an n-vector and f(X) is a scalar. In mathe- */ /* matical notation f: R^n -> R^1. The objective function f() */ /* is not required to be continuous. Nor does f() need to be */ /* differentiable. The program does not use or require */ /* derivatives of f(). */ /* The software user supplies three things: a subroutine that */ /* computes f(X), an initial "starting guess" of the minimum point */ /* X, and values for the algorithm convergence parameters. Then */ /* the program searches for a local minimum, beginning from the */ /* starting guess, using the Direct Search algorithm of Hooke and */ /* Jeeves. */ /* This C program is adapted from the Algol pseudocode found in */ /* "Algorithm 178: Direct Search" by Arthur F. Kaupe Jr., Commun- */ /* ications of the ACM, Vol 6. p.313 (June 1963). It includes the */ /* improvements suggested by Bell and Pike (CACM v.9, p. 684, Sept */ /* 1966) and those of Tomlin and Smith, "Remark on Algorithm 178" */ /* (CACM v.12). The original paper, which I don't recommend as */ /* highly as the one by A. Kaupe, is: R. Hooke and T. A. Jeeves, */ /* "Direct Search Solution of Numerical and Statistical Problems", */ /* Journal of the ACM, Vol. 8, April 1961, pp. 212-229. */ /* Calling sequence: */ /* int hooke(dim, startpt, endpt, rho, epsilon, itermax) */ /* */ /* dim {an integer} This is the number of dimensions */ /* in the domain of f(). It is the number of */ /* coordinates of the starting point (and the */ /* minimum point.) */ /* startpt {an array of doubles} This is the user- */ /* supplied guess at the minimum. */ /* endpt {an array of doubles} This is the location of */ /* the local minimum, calculated by the program */ /* rho {a double} This is a user-supplied convergence */ /* parameter (more detail below), which should be */ /* set to a value between 0.0 and 1.0. Larger */ /* values of rho give greater probability of */ /* convergence on highly nonlinear functions, at a */ /* cost of more function evaluations. Smaller */ /* values of rho reduces the number of evaluations */ /* (and the program running time), but increases */ /* the risk of nonconvergence. See below. */ /* epsilon {a double} This is the criterion for halting */ /* the search for a minimum. When the algorithm */ /* begins to make less and less progress on each */ /* iteration, it checks the halting criterion: if */ /* the stepsize is below epsilon, terminate the */ /* iteration and return the current best estimate */ /* of the minimum. Larger values of epsilon (such */ /* as 1.0e-4) give quicker running time, but a */ /* less accurate estimate of the minimum. Smaller */ /* values of epsilon (such as 1.0e-7) give longer */ /* running time, but a more accurate estimate of */ /* the minimum. */ /* itermax {an integer} A second, rarely used, halting */ /* criterion. If the algorithm uses >= itermax */ /* iterations, halt. */ /* The user-supplied objective function f(x) is provided as the */ /* member-function of the struct unur_funct_vgeneric */ /* rho, the algorithm convergence control */ /* The algorithm works by taking "steps" from one estimate of */ /* a minimum, to another (hopefully better) estimate. Taking */ /* big steps gets to the minimum more quickly, at the risk of */ /* "stepping right over" an excellent point. The stepsize is */ /* controlled by a user supplied parameter called rho. At each */ /* iteration, the stepsize is multiplied by rho (0 < rho < 1), */ /* so the stepsize is successively reduced. */ /* Small values of rho correspond to big stepsize changes, */ /* which make the algorithm run more quickly. However, there */ /* is a chance (especially with highly nonlinear functions) */ /* that these big changes will accidentally overlook a */ /* promising search vector, leading to nonconvergence. */ /* Large values of rho correspond to small stepsize changes, */ /* which force the algorithm to carefully examine nearby points */ /* instead of optimistically forging ahead. This improves the */ /* probability of convergence. */ /* The stepsize is reduced until it is equal to (or smaller */ /* than) epsilon. So the number of iterations performed by */ /* Hooke-Jeeves is determined by rho and epsilon: */ /* rho**(number_of_iterations) = epsilon */ /* In general it is a good idea to set rho to an aggressively */ /* small value like 0.5 (hoping for fast convergence). Then, */ /* if the user suspects that the reported minimum is incorrect */ /* (or perhaps not accurate enough), the program can be run */ /* again with a larger value of rho such as 0.85, using the */ /* result of the first minimization as the starting guess to */ /* begin the second minimization. */ /* Normal use: (1) Code your function f() in the C language */ /* (2) Install your starting guess {or read it in} */ /* (3) Run the program */ /* (4) {for the skeptical}: Use the computed minimum */ /* as the starting point for another run */ /* Data Fitting: */ /* Code your function f() to be the sum of the squares of the */ /* errors (differences) between the computed values and the */ /* measured values. Then minimize f() using Hooke-Jeeves. */ /* EXAMPLE: you have 20 datapoints (ti, yi) and you want to */ /* find A,B,C such that (A*t*t) + (B*exp(t)) + (C*tan(t)) */ /* fits the data as closely as possible. Then f() is just */ /* f(x) = SUM (measured_y[i] - ((A*t[i]*t[i]) + (B*exp(t[i])) */ /* + (C*tan(t[i]))))^2 */ /* where x[] is a 3-vector consisting of {A, B, C}. */ /* */ /* The author of this software is M.G. Johnson. */ /* Permission to use, copy, modify, and distribute this software */ /* for any purpose without fee is hereby granted, provided that */ /* this entire notice is included in all copies of any software */ /* which is or includes a copy or modification of this software */ /* and in all copies of the supporting documentation for such */ /* software. THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT */ /* ANY EXPRESS OR IMPLIED WARRANTY. IN PARTICULAR, NEITHER THE */ /* AUTHOR NOR AT&T MAKE ANY REPRESENTATION OR WARRANTY OF ANY */ /* KIND CONCERNING THE MERCHANTABILITY OF THIS SOFTWARE OR ITS */ /* FITNESS FOR ANY PARTICULAR PURPOSE. */ /* */ /*-----------------------------------------------------------------*/ #include #include "hooke_source.h" /* The following maximum number of 'sub-iterations' has been */ /* introduced in order to avoid potential infinite loops in the */ /* main hooke algorithm. */ #define HOOKE_SUBITERMAX 10 /*-----------------------------------------------------------------*/ /* prototypes */ /* given a point, look for a better one nearby, one coord at a time */ static double best_nearby(struct unur_funct_vgeneric faux, double *delta, double *point, double prevbest, int dim); /*-----------------------------------------------------------------*/ static double best_nearby(struct unur_funct_vgeneric faux, double *delta, double *point, double prevbest, int dim) /* Given a point, look for a better one nearby, one coord at a time */ { double *z; double minf, ftmp; int i; z=(double *) malloc( dim*sizeof(double)); minf = prevbest; for (i = 0; i < dim; i++) z[i] = point[i]; for (i = 0; i < dim; i++) { z[i] = point[i] + delta[i]; ftmp = faux.f(z, faux.params); if (ftmp < minf) minf = ftmp; else { delta[i] = 0.0 - delta[i]; z[i] = point[i] + delta[i]; ftmp = faux.f(z, faux.params); if (ftmp < minf) minf = ftmp; else z[i] = point[i]; } } for (i = 0; i < dim; i++) point[i] = z[i]; free(z); return (minf); } /* end of best_nearby() */ /*-----------------------------------------------------------------*/ int _unur_hooke(struct unur_funct_vgeneric faux, int dim, double *startpt, double *endpt, double rho, double epsilon, long itermax) /* Direct search minimization algorithm */ { double *delta, *xbefore, *newx; double newf, fbefore, steplength, tmp; int i, keep; int iters, isubiters; delta = (double *) malloc( dim*sizeof(double)); xbefore = (double *) malloc( dim*sizeof(double)); newx = (double *) malloc( dim*sizeof(double)); for (i = 0; i < dim; i++) { newx[i] = xbefore[i] = startpt[i]; delta[i] = fabs(startpt[i] * rho); if (_unur_iszero(delta[i])) delta[i] = rho; } steplength = rho; iters = 0; fbefore = faux.f(newx, faux.params); newf = fbefore; while ((iters < itermax) && (steplength > epsilon)) { iters++; /* find best new point, one coord at a time */ for (i = 0; i < dim; i++) { newx[i] = xbefore[i]; } newf = best_nearby(faux, delta, newx, fbefore, dim); /* if we made some improvements, pursue that direction */ keep = 1; isubiters=0; while ((newf < fbefore) && (keep == 1) ) { for (i = 0; i < dim; i++) { /* firstly, arrange the sign of delta[] */ if (newx[i] <= xbefore[i]) delta[i] = 0.0 - fabs(delta[i]); else delta[i] = fabs(delta[i]); /* now, move further in this direction */ tmp = xbefore[i]; xbefore[i] = newx[i]; newx[i] = newx[i] + newx[i] - tmp; } fbefore = newf; newf = best_nearby(faux, delta, newx, fbefore, dim); /* if the further (optimistic) move was bad.... */ if (newf >= fbefore) break; /* make sure that the differences between the new */ /* and the old points are due to actual */ /* displacements; beware of roundoff errors that */ /* might cause newf < fbefore */ keep = 0; for (i = 0; i < dim; i++) { if (fabs(newx[i] - xbefore[i]) > (0.5 * fabs(delta[i]))) { keep = 1; break; } } /* stopping condition to avoid infinite while-loop */ if ( isubiters++ >= HOOKE_SUBITERMAX) break; } if ((steplength >= epsilon) && (newf >= fbefore)) { steplength = steplength * rho; for (i = 0; i < dim; i++) { delta[i] *= rho; } } } for (i = 0; i < dim; i++) endpt[i] = xbefore[i]; free(delta); free(xbefore); free(newx); return (iters); } /* end of hooke() */ /*-----------------------------------------------------------------*/ unuran-1.11.0/src/utils/matrix.c0000644001357500135600000007320714420445767013462 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: matrix.c * * * * Routines for computations with square matrices. * * Matrices are stored as double array (i.e.: double *matrix). * * The rows of the matrix have to be stored consecutively in this array, * * i.e. the entry with index [i,j] can be entered via (i*dim+j), where * * dim is the dimension of the dim x dim - matrix. * * * ***************************************************************************** * * * Routines are mainly adapted from the GSL (GNU Scientifiy Library) * * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman, Brian Gough * * * * adapted by Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*--------------------------------------------------------------------------*/ #include #include "matrix_source.h" /*---------------------------------------------------------------------------*/ static int _unur_matrix_swap_rows (int dim, double *A, int i, int j); /* Swap rows i and j in square matrix A of dimension dim. */ static int _unur_matrix_permutation_swap (int dim, int *p, int i, int j); /* Swap entries i and j of the integer array p. */ static int _unur_matrix_LU_decomp (int dim, double *A, int *P, int *signum); /* Factorise a general dim x dim matrix A into P A = L U. */ static int _unur_matrix_backsubstitution_dtrsv(int dim, double *LU, double *X); /* Backsubstitution used for inversion alg. _unur_matrix_LU_invert(). */ static int _unur_matrix_forwardsubstitution_dtrsv(int dim, double *LU, double *X); /* Forwardsubstitution used for inversion alg. _unur_matrix_LU_invert(). */ static int _unur_matrix_LU_invert (int dim, double *LU, int *p, double *inverse); /* Compute inverse of matrix with given LU decomposition. */ /*---------------------------------------------------------------------------*/ int _unur_matrix_transform_diagonal (int dim, const double *M, const double *D, double *res) /*----------------------------------------------------------------------*/ /* Computes the transformation M^t . D . M of diagonal matrix D */ /* and stores it in matrix 'res'. */ /* */ /* input: */ /* dim ... number of columns and rows of m and diag */ /* M ... square matrix */ /* D ... diagonal entries of a diagonal matrix */ /* */ /* output: */ /* res ... square matrix to store result */ /* */ /* return: */ /* UNUR_SUCCESS on success */ /* error code otherwise */ /*----------------------------------------------------------------------*/ { #define idx(a,b) ((a)*dim+(b)) int i,j,k; double sum; /* check arguments */ CHECK_NULL(M,UNUR_ERR_NULL); CHECK_NULL(D,UNUR_ERR_NULL); CHECK_NULL(res,UNUR_ERR_NULL); for (i=0; idata[j] */ /* */ /* signum gives the sign of the permutation, (-1)^n, where n is the */ /* number of interchanges in the permutation. */ /* */ /* See Golub & Van Loan, Matrix Computations, Algorithm 3.4.1 (Gauss */ /* Elimination with Partial Pivoting). */ /* */ /* input: */ /* dim ... number of columns and rows of */ /* A ... dim x dim matrix */ /* p ... pointer to array where permutation should be stored */ /* signum ... pointer where sign of permutation should be stored */ /* */ /* output: */ /* A ... L (strict lower triangular part) and U (upper part) */ /* p ... permutation vector of length dim */ /* (contains all integers between 0 and dim-1) */ /* signum ... sign of the permutation (1 or -1) */ /* */ /* return: */ /* UNUR_SUCCESS on success */ /* error code otherwise */ /*----------------------------------------------------------------------*/ { #define idx(a,b) ((a)*dim+(b)) int i, j, k; /* check arguments */ CHECK_NULL(A,UNUR_ERR_NULL); CHECK_NULL(p,UNUR_ERR_NULL); CHECK_NULL(signum,UNUR_ERR_NULL); /* initialize permutation vector */ *signum = 1; for(i=0;i max){ max = aij; i_pivot = i; } } if (i_pivot != j){ _unur_matrix_swap_rows (dim, A, j, i_pivot); _unur_matrix_permutation_swap (dim, p, j, i_pivot); *signum = -(*signum); } ajj = A[idx(j,j)]; if ( !_unur_iszero(ajj) ){ for (i = j + 1; i < dim; i++){ double aij = A[idx(i,j)] / ajj; A[idx(i,j)] = aij; for (k = j + 1; k < dim; k++){ double aik = A[idx(i,k)]; double ajk = A[idx(j,k)]; A[idx(i,k)]= aik - aij * ajk; } } } } return UNUR_SUCCESS; #undef idx } /* end of _unur_matrix_LU_decomp() */ /*---------------------------------------------------------------------------*/ int _unur_matrix_backsubstitution_dtrsv(int dim, double *LU, double *X) /*----------------------------------------------------------------------*/ /* Backsubstitution used for inversion alg. _unur_matrix_LU_invert() */ /* */ /* input: */ /* dim ... number of columns and rows of */ /* LU ... dim x dim -matrix that contains LU decomposition of matrix */ /* X ... vector */ /* */ /* output: */ /* X */ /* */ /* return: */ /* UNUR_SUCCESS on success */ /* error code otherwise */ /*----------------------------------------------------------------------*/ { #define idx(a,b) ((a)*dim+(b)) int ix,jx,i,j; /* check arguments */ CHECK_NULL(LU,UNUR_ERR_NULL); CHECK_NULL(X,UNUR_ERR_NULL); /* backsubstitution */ ix = (dim - 1); X[ix] = X[ix] / LU[idx(ix,ix)]; ix--; for (i = dim - 1; i > 0 && i--;) { double tmp = X[ix]; jx = ix + 1; for (j = i + 1; j < dim; j++) { tmp -= LU[idx(i,j)] * X[jx]; jx ++; } X[ix] = tmp / LU[idx(i,i)]; ix --; } return UNUR_SUCCESS; #undef idx } /* end of _unur_matrix_backsubstitution_dtrsv() */ /*---------------------------------------------------------------------------*/ int _unur_matrix_forwardsubstitution_dtrsv(int dim, double *LU, double *X) /*----------------------------------------------------------------------*/ /* Forwardsubstitution used for inversion alg. _unur_matrix_LU_invert() */ /* */ /* input: */ /* dim ... number of columns and rows of */ /* LU ... dim x dim -matrix that contains LU decomposition of matrix */ /* X ... vector */ /* */ /* output: */ /* X */ /* */ /* return: */ /* UNUR_SUCCESS on success */ /* error code otherwise */ /*----------------------------------------------------------------------*/ { #define idx(a,b) ((a)*dim+(b)) int ix,jx,i,j; /* check arguments */ CHECK_NULL(LU,UNUR_ERR_NULL); CHECK_NULL(X,UNUR_ERR_NULL); /* forward substitution */ ix = 0; ix++; for (i = 1; i < dim; i++) { double tmp = X[ix]; jx = 0; for (j = 0; j < i; j++) { tmp -= LU[idx(i,j)] * X[jx]; jx += 1; } X[ix] = tmp; ix ++; } return UNUR_SUCCESS; #undef idx } /* end of _unur_matrix_forwardsubstitution_dtrsv() */ /*---------------------------------------------------------------------------*/ int _unur_matrix_LU_invert (int dim, double *LU, int *p, double *inverse) /*----------------------------------------------------------------------*/ /* Compute inverse of matrix with given LU decomposition. */ /* */ /* input: */ /* dim ... number of columns and rows of */ /* LU ... dim x dim -matrix, LU decomposition */ /* p ... permutation vector of length dim */ /* (contains all integers between 0 and dim-1) */ /* inverse ... pointer to array where inverse should be stored */ /* */ /* output */ /* inverse ... the inverse matrix */ /* */ /* return: */ /* UNUR_SUCCESS on success */ /* error code otherwise */ /*----------------------------------------------------------------------*/ { #define idx(a,b) ((a)*dim+(b)) double *vector; int i,j; /* check arguments */ CHECK_NULL(LU,UNUR_ERR_NULL); CHECK_NULL(p,UNUR_ERR_NULL); CHECK_NULL(inverse,UNUR_ERR_NULL); /* allocate working array */ vector = _unur_xmalloc(dim*sizeof(double)); for (i = 0; i < dim; i++){ for(j=0;j sum1)) { /* covariance matrix not positive definite */ return UNUR_FAILURE; } L[idx(j,j)] = sqrt( S[idx(j,j)] - sum1 ); } /* although not necessary upper triangular of L - matrix is set to 0 */ for(j=0; j entries */ /* info ... additional info-string to be printed as first line */ /* LOG ... output stream */ /* genid ... id string */ /* indent ... left margin of printed vector */ /*----------------------------------------------------------------------*/ { int i; if (vec) { fprintf(LOG,"%s: %s\n", genid, info ); fprintf(LOG,"%s: %s( %g", genid, indent, vec[0]); for (i=1; ix square matrix into LOG file. */ /* The matrix is stored row-wise in . */ /* */ /* parameters: */ /* dim ... dimension */ /* mat ... square matrix with rows and columns */ /* info ... additional info-string to be printed as first line */ /* LOG ... output stream */ /* genid ... id string */ /* indent ... left margin of printed vector */ /*----------------------------------------------------------------------*/ { #define idx(a,b) ((a)*dim+(b)) int i,j; if (mat) { fprintf(LOG,"%s: %s\n", genid, info); for (i=0; i /*---------------------------------------------------------------------------*/ int _unur_FP_cmp( double x1, double x2, double eps) /*----------------------------------------------------------------------*/ /* Compare two floats: */ /* x1 eq x2 iff |x1-x2| <= min(|x1|,|x2) * eps */ /* */ /* parameters: */ /* x1 ... double */ /* x2 ... double */ /* eps ... maximal relative deviation */ /* */ /* return: */ /* -1 if x1 < x2 */ /* 0 if x1 eq x2 */ /* +1 if x1 > x2 */ /* */ /* remark: */ /* This is similar to Knuth's algorithm. However, we use */ /* instead of max(|x1|,|x2). */ /* We also have to deal with +-INFINITY correctly. */ /* */ /* (For an implementation of Knuth's algorithm see */ /* fcmp 1.2.2 Copyright (c) 1998-2000 Theodore C. Belding */ /* University of Michigan Center for the Study of Complex Systems */ /* Ted.Belding@umich.edu) */ /*----------------------------------------------------------------------*/ { double fx1 = (x1>=0.) ? x1 : -x1; double fx2 = (x2>=0.) ? x2 : -x2; double delta = eps * _unur_min(fx1,fx2); double difference = x1 - x2; /* we have to take care about INFINITY */ if (_unur_isinf(delta)) { delta = eps * DBL_MAX; } /* denormalized numbers (close to zero) may cause problems. */ /* so we check this special case. */ if (fx1 <= 2.*DBL_MIN && fx2 <= 2.*DBL_MIN) return 0; if (difference > delta) /* x1 > x2 */ return +1; else if (difference < -delta) /* x1 < x2 */ return -1; else /* -delta <= difference <= delta */ return 0; /* x1 ~=~ x2 */ } /* end of _unur_FP_cmp() */ /*---------------------------------------------------------------------------*/ #ifndef _unur_iszero int _unur_iszero (const double x) /*----------------------------------------------------------------------*/ /* Check whether x is equal to 0.0 */ /* */ /* parameters: */ /* x ... floating-point number */ /* */ /* return: */ /* TRUE if x == 0 */ /* FALSE otherwise */ /*----------------------------------------------------------------------*/ { return (x==0.); } /* end of _unur_iszero() */ #endif /*---------------------------------------------------------------------------*/ #ifndef _unur_isone int _unur_isone (const double x) /*----------------------------------------------------------------------*/ /* Check whether x is equal to 1.0 */ /* */ /* parameters: */ /* x ... floating-point number */ /* */ /* return: */ /* TRUE if x == 1 */ /* FALSE otherwise */ /*----------------------------------------------------------------------*/ { return (x==1.); } /* end of _unur_isone() */ #endif /*---------------------------------------------------------------------------*/ #ifndef _unur_isfsame int _unur_isfsame (const double x, const double y) /*----------------------------------------------------------------------*/ /* Check whether x == y */ /* (Unsafe version that should only be used for powers of 2) */ /* */ /* parameters: */ /* x ... floating-point number */ /* y ... floating-point number */ /* */ /* return: */ /* TRUE if x == y */ /* FALSE otherwise */ /*----------------------------------------------------------------------*/ { return (x==y); } /* end of _unur_isfsame() */ #endif /*---------------------------------------------------------------------------*/ int _unur_isfinite (const double x) /*----------------------------------------------------------------------*/ /* Check whether x is a finite number. */ /* */ /* parameters: */ /* x ... floating-point number */ /* */ /* return: */ /* TRUE if x is finite */ /* FALSE otherwise (i.e., if x is +/- infinity or NaN) */ /*----------------------------------------------------------------------*/ { #if HAVE_DECL_ISFINITE return (isfinite(x) ? TRUE : FALSE); #elif defined(_MSC_VER) /* Microsoft Visual C++ */ return (_finite(x) ? TRUE : FALSE); #elif HAVE_IEEE_COMPARISONS if (x < UNUR_INFINITY && x > -UNUR_INFINITY) return TRUE; else return FALSE; #else # error # error +--------------------------------------------+ # error ! Sorry, Cannot handle INFINITY correctly! . ! # error ! Please contact . ! # error +--------------------------------------------+ # error #endif } /* end of _unur_isfinite() */ /*---------------------------------------------------------------------------*/ int _unur_isnan (const double x) /*----------------------------------------------------------------------*/ /* Check whether x is a NaN (not a number) value. */ /* */ /* parameters: */ /* x ... floating-point number */ /* */ /* return: */ /* TRUE if x is NaN */ /* FALSE otherwise */ /*----------------------------------------------------------------------*/ { #if HAVE_DECL_ISNAN return (isnan(x) ? TRUE : FALSE); #elif defined(_MSC_VER) /* Microsoft Visual C++ */ return (_isnan(x) ? TRUE : FALSE); #elif HAVE_IEEE_COMPARISONS return ((x!=x) ? TRUE : FALSE); #else # error # error +--------------------------------------------+ # error ! Sorry, Cannot handle NaN correctly! ...... ! # error ! Please contact . ! # error +--------------------------------------------+ # error #endif } /* end of _unur_isnan() */ /*---------------------------------------------------------------------------*/ int _unur_isinf (const double x) /*----------------------------------------------------------------------*/ /* Check whether x is infinity. */ /* */ /* parameters: */ /* x ... floating-point number */ /* */ /* return: */ /* -1 ... if x is -infinity */ /* 1 ... if x is +infinity */ /* 0 ... otherwise */ /*----------------------------------------------------------------------*/ { #if HAVE_DECL_ISINF return isinf(x); #elif defined(_MSC_VER) /* Microsoft Visual C++ */ int fpc = _fpclass(x); if (fpc == _FPCLASS_PINF) return +1; else if (fpc == _FPCLASS_NINF) return -1; else return 0; #elif HAVE_IEEE_COMPARISONS if (x>=UNUR_INFINITY) return 1; else if (x<=-UNUR_INFINITY) return -1; else return 0; #else # error # error +--------------------------------------------+ # error ! Sorry, Cannot handle INFINITY correctly! . ! # error ! Please contact . ! # error +--------------------------------------------+ # error #endif } /* end of _unur_isinf() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/utils/string_source.h0000644001357500135600000000702214420445767015041 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: string_source.h * * * * PURPOSE: * * defines macros and function prototypes for strings * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ /* Function prototypes */ /* Make new string */ struct unur_string * _unur_string_new ( void ); /* Append to string */ /* Important: The generated string must not be longer than 1023 characters! */ int _unur_string_append ( struct unur_string *string, const char *format, ... ) ATTRIBUTE__FORMAT(2,3); /* Append text to string */ int _unur_string_appendtext ( struct unur_string *string, const char *text ); /* Destroy string */ void _unur_string_free ( struct unur_string *string ); /* Clear string (set length of string to 0) */ void _unur_string_clear ( struct unur_string *string ); /*---------------------------------------------------------------------------*/ unuran-1.11.0/src/utils/eigensystem.c0000644001357500135600000004634214420445767014512 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: eigensystem.c * * * * Routines for calculating eigenvalues and eigenvectors of real * * symmetric matrices. * * * * Mainly adapted and modified from FORTRAN77 code POLYEN created by * * G. Derflinger * * * ***************************************************************************** * FORTRAN version by Gerhard Derflinger. * * Translated into C and adapted for UNU.RAN by Roman Karawatzki. * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ #include #include "matrix_source.h" /* ---------------------------------------------------------------------------- */ static const double EPS = DBL_EPSILON; static const double EPS2 = (DBL_EPSILON * DBL_EPSILON); /* ---------------------------------------------------------------------------- */ static int _unur_eigensystem_house ( int dim, double *A, double *d, double *e, double *e2 ); /* householder reduction of a real symmetric matrix A to its tridiagonal form */ static int _unur_eigensystem_newqr(int dim, double *a, double *b, double *b2, double *g); /* computes the eigenvalues of a real symmetric tri-diagonal matrix */ static int _unur_eigensystem_trinv(int dim, double *a, double *b, double *g, double *c, double *p, double *q, double *r, double *w, double *y, int *in); /* computes the eigenvectors of a real symmetric tri-diagonal matrix */ static int _unur_eigensystem_back(int dim, double *a, double *e, double *c); /* backtransformation of eigenvectors of tridiagonal matrix to original matrix */ /* ---------------------------------------------------------------------------- */ int _unur_matrix_eigensystem(int dim, const double *M, double *values, double *vectors) /*----------------------------------------------------------------------*/ /* Computes the eigenvalues and the corresponding eigenvectors */ /* of a real symmetric matrix M. */ /* The eigenvectors are normalized and (almost) orthognal. */ /* The eigenvectors are stored consecutively in vectors. */ /* */ /* Method: */ /* Householder tri-diagonalization */ /* Secant-QR method */ /* Inverse iteration */ /* */ /* Parameters: */ /* dim : dimension */ /* M : real symmetric dim x dim matrix */ /* */ /* Output: */ /* values : eigenvalues of M in ascending order */ /* vectors : normalized eigenvectors of M stored row-wise */ /* */ /* Return: */ /* UNUR_SUCCESS : eignesystem successfully computed */ /* UNUR_FAILURE : qr algorithm did not converge */ /* UNUR_ERR_NULL: invalid NULL pointer occurred */ /*----------------------------------------------------------------------*/ { double *A; /* local working copy of M (elements of A will be overwritten) */ double *diag; double *codiag; double *wk; int *in; int i; int ret = 0; /* UNUR_SUCCESS */ /* Check arguments */ CHECK_NULL(M,UNUR_ERR_NULL); /* Special case when M is one-dimensional */ if (dim==1) { values[0]=M[0]; vectors[0]=1.; return ret; } /* make a local copy of the matrix M -> A */ A = _unur_xmalloc(dim*dim*sizeof(double)); memcpy(A, M, dim*dim*sizeof(double)); /* alocate working arrays */ diag = _unur_xmalloc(dim*sizeof(double)); codiag = _unur_xmalloc(dim*sizeof(double)); /* stored in 0..(dim-2) */ wk = _unur_xmalloc((5*dim+2)*sizeof(double)); /*working array */ in = _unur_xmalloc(dim*sizeof(int)); /*working array */ /* calculate tridiagonal Householder matrix */ _unur_eigensystem_house(dim, A, diag, codiag, &wk[0]); for (i=1; icrit && w>oldw); label_9: g[ll-1]=xnull+shift; if (ll EPS2) { cosec = p / b2[i-1] + ONE; if (sec > TWO) gamm = (aa+oldgam)/sec - oldgam; else gamm = aa - (aa+oldgam)/cosec; p = gamm*gamm*sec; b2[i-1] = (p + b2[i]) / cosec; } else { gamm = aa; p = gamm * gamm; b2[i-1] = ZERO; } } else { gamm = -oldgam; if (i==1) sec = ONE; if ( ! _unur_iszero(sec) ) p = b2[i-1] / sec; sec = ZERO; b2[i-1] = p + b2[i]; } a[i-1] = a[i] - gamm + oldgam; if (a[i-1] <= a[k-1]) k=i; } a[l-1] = gamm + shift; if (a[l-1] <= a[k-1]) k=l; /* convergence */ if (k>1) { if (b2[k-2]>crit2) continue; b2[k-2] = ZERO; } if (kcrit2) continue; for (i=k; i=1; i--) { for (j=1; j<=dim; j++) { p[j-1]=0.; q[j-1]=b[j-1]; r[j-1]=a[j-1]-g[i-1]; y[j-1]=epsa; } if (i= fabs(b[j-1])) { if ( _unur_iszero(r[j-1]) ) r[j-1]=EPS2; in[j-1]=0; f=b[j-1]/r[j-1]; } else { in[j-1]=1; f=r[j-1]/b[j-1]; r[j-1]=b[j-1]; t=r[j]; r[j]=q[j-1]; q[j-1]=t; p[j-1]=q[j]; q[j]=0.; } w[j-1]=f; q[j] -= f*p[j-1]; r[j] -= f*q[j-1]; if ( _unur_iszero(r[j-1]) ) r[j-1]=EPS2; } if ( _unur_iszero(r[dim-1]) ) r[dim-1]=EPS2; /* two iterations */ for (j=dim; j>=1; j--) { y[j-1]=(y[j-1]-y[j]*q[j-1]-y[j+1]*p[j-1])/r[j-1]; c[idx1(1,j)]=y[j-1]; } for (j=1; j=1; j--) { y[j-1]=(y[j-1]-y[j]*q[j-1]-y[j+1]*p[j-1])/r[j-1]; t += y[j-1]*y[j-1]; } /* Orthogonalize in case of close eigenvalues */ if (close) { for (k=i+1; k<=i+l; k++) { t=0.; for (j=1; j<=dim; j++) t += y[j-1]*c[idx1(k,j)]; for (j=1; j<=dim; j++) y[j-1] -= t*c[idx1(k,j)]; } t=0.; for (j=1; j<=dim; j++) t += y[j-1]*y[j-1]; } /* normalize and store eigenvector */ t=sqrt(t); for (j=1; j<=dim; j++) { c[idx1(i,j)]=y[j-1]/t; } } return UNUR_SUCCESS; #undef idx1 } /* end of _unur_eigensystem_trinv() */ /* ---------------------------------------------------------------------------- */ int _unur_eigensystem_back(int dim, double *a, double *e, double *c) { /*----------------------------------------------------------------------*/ /* Performas a back-transformation on the eigenvectors of the tri- */ /* diagonal matrix in order to obtain the eigenvectors of the original */ /* matrix. */ /* */ /* Parameters */ /* dim : dimension */ /* a, e : the strictly lower triangle of a and e contain the */ /* : necessary information on the householder reduction */ /* : (diagonal and co-diagonal elements) */ /* : a and e are left unaltered by this routine */ /* c : eigenvectors of tridiagonal matrix - overwritten by */ /* : resultant eigenvectors */ /*----------------------------------------------------------------------*/ #define idx1(a,b) ((a-1)*dim+(b-1)) int i,j,k,k1; double h, s, s2; for (k=dim-2; k>=1; k--) { if( ! _unur_iszero(e[k-1]) ) { k1=k+1; h=-e[k-1]*a[idx1(k1,k)]; for (j=1; j<=dim; j++) { s=0.; for (i=k1; i<=dim; i++) s += a[idx1(i,k)]*c[idx1(j,i)]; s=s/h; for (i=k1; i<=dim; i++) c[idx1(j,i)] -= s*a[idx1(i,k)]; /* non-negative sum of eigenvector components */ s=0.; for (i=1; i<=dim; i++) s += c[idx1(j,i)]; if (s < 0.) { for (i=1; i<=dim; i++) c[idx1(j,i)] = -c[idx1(j,i)]; } /* eigenvector normalization */ s2=0.; for (i=1; i<=dim; i++) s2 += c[idx1(j,i)]*c[idx1(j,i)] ; s2 = sqrt(s2); for (i=1; i<=dim; i++) c[idx1(j,i)] /= s2 ; } } } return UNUR_SUCCESS; #undef idx1 } /* end of _unur_eigensystem_back() */ /* ------------------------------------------------------------------------- */ unuran-1.11.0/src/utils/slist.h0000644001357500135600000001250714420304141013271 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: slist.h * * * * PURPOSE: * * defines function prototypes for simple list * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifndef SLIST_H_SEEN #define SLIST_H_SEEN /*---------------------------------------------------------------------------*/ /* Not part of manual! */ /*---------------------------------------------------------------------------*/ /* */ /* A simple list can be used to store an arbitrary numbers of pointers */ /* to allocated memory in a list. */ /* */ /* IMPORTANT: These elements must be allocated via (c|m|re)alloc()!! */ /* */ /*---------------------------------------------------------------------------*/ struct unur_slist *_unur_slist_new( void ); /*---------------------------------------------------------------------------*/ /* Make new simple list. */ /*---------------------------------------------------------------------------*/ int _unur_slist_append( struct unur_slist *slist, void *element ); /*---------------------------------------------------------------------------*/ /* Append pointer to element to simple list. */ /*---------------------------------------------------------------------------*/ int _unur_slist_length( const struct unur_slist *slist ); /*---------------------------------------------------------------------------*/ /* Get length if list (number of list entries). */ /*---------------------------------------------------------------------------*/ void *_unur_slist_get( const struct unur_slist *slist, int n ); /*---------------------------------------------------------------------------*/ /* Get pointer to n-th element. */ /*---------------------------------------------------------------------------*/ void *_unur_slist_replace( struct unur_slist *slist, int n, void *element ); /*---------------------------------------------------------------------------*/ /* Replace (existing) pointer to n-th element by 'element'. */ /*---------------------------------------------------------------------------*/ void _unur_slist_free( struct unur_slist *slist ); /*---------------------------------------------------------------------------*/ /* Free all elements and list in simple list. */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ #endif /* SLIST_H_SEEN */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/configure.ac0000644001357500135600000002632114430713333012330 00000000000000dnl Process this file with autoconf to produce a configure script. dnl Initialize. AC_PREREQ([2.71]) AC_INIT([unuran],[1.11.0],[unuran@statmath.wu.ac.at]) AC_CONFIG_AUX_DIR(autoconf) AC_CONFIG_SRCDIR([src/unuran_config.h]) AC_CONFIG_HEADERS([config.h]) AM_INIT_AUTOMAKE([-Wall -Wno-extra-portability foreign]) dnl Library versioning (current:revision:age) dnl See the libtool manual for an explanation of the numbers dnl dnl unuran-0.4.0 0:0:0 dnl unuran-0.4.2 1:1:0 dnl unuran-0.4.4 1:2:0 dnl unuran-0.5.0 2:0:0 dnl unuran-0.6.0 3:0:0 dnl unuran-0.7.0 4:0:0 dnl unuran-0.7.1 4:1:0 dnl unuran-0.7.2 4:2:0 dnl unuran-0.8.1 5:0:0 dnl unuran-0.9.0 6:0:0 dnl unuran-1.0.0 7:0:0 dnl unuran-1.0.1 7:1:0 dnl unuran-1.1.0 8:0:1 dnl unuran-1.2.0 9:0:0 dnl unuran-1.2.1 9:1:0 dnl unuran-1.2.2 9:2:0 dnl unuran-1.2.3 9:3:2 dnl unuran-1.2.4 9:4:2 dnl unuran-1.3.0 10:0:0 dnl unuran-1.3.1 10:0:0 dnl unuran-1.4.0 11:0:1 dnl unuran-1.4.1 11:1:1 dnl unuran-1.5.0 12:0:0 dnl unuran-1.6.0 13:0:0 dnl unuran-1.7.0 14:0:0 dnl unuran-1.8.0 15:0:0 dnl unuran-1.8.1 15:0:0 dnl unuran-1.9.0 16:0:0 dnl unuran-1.10.0 16:1:0 dnl unuran-1.11.0 17:0:0 UNURAN_LT_VERSION="16:1:0" AC_SUBST([UNURAN_LT_VERSION]) dnl use maintainer mode AM_MAINTAINER_MODE dnl Check for which system. AC_CANONICAL_HOST dnl Checks for programs. AC_PROG_MAKE_SET AC_PROG_CC AC_PROG_CXX AC_PROG_CPP AC_PROG_RANLIB AC_PROG_INSTALL AC_PROG_LN_S AC_CHECK_TOOL(AR, ar, :) LT_INIT([disable-shared]) dnl Checks for libraries. dnl libm: the standard math library AC_CHECK_LIB([m], [sqrt]) dnl libgsl: the GNU Scientific library dnl (used for experimental code or dnl when the GSL uniform random number generators are used, see below) AC_CHECK_LIB([gslcblas],[cblas_dgemm]) AC_CHECK_LIB([gsl],[gsl_blas_dgemm]) dnl Optional support for external uniform random number generators dnl RngStream: Pierre L'Ecuyer's multiple random stream generator AX_ADD_URNG_LIB([rngstream],[RNGSTREAM],[Pierre L'Ecuyer's RNGSTREAM library], [rngstreams],[RngStream_CreateStream],[RngStream.h]) dnl prng: Otmar Lendl's library for pseudo random number generators AX_ADD_URNG_LIB([prng],[PRNG],[Otmar Lendl's PRNG library], [prng],[prng_new],[prng.h]) dnl GSL: GNU Scientific Library AX_ADD_URNG_LIB([gsl],[GSL],[random number generators from GNU Scientific Library], [gsl],[gsl_rng_alloc],[gsl/gsl_rng.h]) dnl Default URNG AC_ARG_WITH(urng_default, [AS_HELP_STRING([--with-urng-default], [URNG: global default (builtin|rngstream) @<:@default=builtin@:>@])], [case "${withval}" in builtin) ;; rngstream) ;; *) AC_MSG_ERROR(bad value '${withval}' for --with-urng-default) ;; esac], [with_urng_default=builtin]) AS_IF([test "x$with_urng_default" == xrngstream], AS_IF([test "x$with_urng_rngstream" == xno], [with_urng_default=builtin AC_MSG_NOTICE([ ******************************************************** * * --with-urng-default=rngstream * but --with-urng-rngstream=no. * use --with-urng-default=builtin instead * ******************************************************** ]) ], [AC_DEFINE([UNUR_URNG_DEFAULT_RNGSTREAM], [1], [Define to 1 if you use RNGSTREAM as global URNG.])]), []) dnl Optional support for Rmath standalone library AX_ADD_RMATH() dnl Checks for header files. AC_CHECK_HEADERS([float.h limits.h stdlib.h string.h unistd.h]) AC_CHECK_HEADERS_ONCE([sys/time.h]) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_C_INLINE AC_TYPE_SIZE_T dnl Checks for library functions. AC_CHECK_FUNCS([alarm floor gettimeofday memset pow sqrt strcasecmp strchr strtol strtoul]) dnl For the following function replacements exist AC_CHECK_DECLS(log1p,,,[#include ]) AC_CHECK_DECLS(hypot,,,[#include ]) dnl Checks for GNU extensions AC_CHECK_DECLS([getopt, snprintf, vsnprintf]) dnl Check for C99 functions */ AC_CHECK_DECLS(isfinite,,,[#include ]) AC_CHECK_DECLS(isinf,,,[#include ]) AC_CHECK_DECLS(isnan,,,[#include ]) AC_CHECK_DECLS(INFINITY,,,[#include ]) AC_CHECK_DECLS(HUGE_VAL,,,[#include ]) AC_CHECK_DECLS(DBL_MAX,,,[#include ]) dnl Check IEEE comparisons, whether "x != x" is true for NaNs AX_IEEE_COMP dnl Check whether 1./0. works and results in "infinity" AX_DIVIDE_BY_ZERO dnl Check for alarm and signal handler AC_CHECK_DECLS(alarm,,,[#include ]) AC_CHECK_DECLS(signal,,,[#include ]) AC_CHECK_FUNCS([alarm signal]) dnl Some routines are deprecated. dnl Compiling and linking these into the library can be controlled dnl by a configure flag. dnl Default is disabled. AC_ARG_ENABLE(deprecated, [AS_HELP_STRING([--enable-deprecated], [enable support for deprecated UNU.RAN routines @<:@default=no@:>@])], [], [enable_deprecated=no]) AM_CONDITIONAL(ENABLE_DEPRECATED, test x$enable_deprecated = xyes) AS_IF([test "x$enable_deprecated" = xyes], [AC_DEFINE([USE_DEPRECATED_CODE], [1], [Define to 1 if you want to use deprecated code.])], []) dnl UNU.RAN has additional checks against invalid NULL pointers or dnl pointers to wrong structures. For the latter cookies are inserted dnl into structures and checked whenever such structure is accessed. dnl Both checks can be enabled by the '--enable-check-struct' flag. dnl Default is disabled. AC_ARG_ENABLE(check-struct, [AS_HELP_STRING([--enable-check-struct], [Debug: check validity of pointers to structures @<:@default=no@:>@])], [], [enable_check_struct=no]) AS_IF([test "x$enable_check_struct" = xyes], [AC_DEFINE([UNUR_ENABLE_CHECKNULL], [1], [Define to 1 if you want to perform additional checks against an invalid NULL pointer]) AC_DEFINE([UNUR_COOKIES], [1], [Define to 1 if you want to use magic cookies to validate type of a pointer])], []) dnl UNU.RAN allows to write information about distribution and a log file. dnl The default name of the logfile is set in 'src/unuran_config.h'. dnl The logfile is enabled by the '--enable-logging' flag. AC_ARG_ENABLE(logging, [AS_HELP_STRING([--enable-logging], [Debug: print informations about generator into logfile @<:@default=no@:>@])], [], [enable_logging=no]) AS_IF([test "x$enable_logging" = xyes], [AC_DEFINE([UNUR_ENABLE_LOGGING], [1], [Define to 1 if you want to use a logfile for logging informations about UNU.RAN objects])], []) dnl UNU.RAN provides a function that returns a string with some information dnl about a given generator object. dnl This function is enabled by the '--enable-info' flag. AC_ARG_ENABLE(info, [AS_HELP_STRING([--enable-info], [Info: provide function with information about generator objects @<:@default=yes@:>@])], [], [enable_info=yes]) AS_IF([test "x$enable_info" = xyes], [AC_DEFINE([UNUR_ENABLE_INFO], [1], [Define to 1 if you want to use the info routine for printing informations about UNU.RAN objects])], []) dnl UNU.RAN contains some experimental code that can be enabled dnl by means of the '--enable-experimental' flag. AC_ARG_ENABLE(experimental, [AS_HELP_STRING([--enable-experimental], [Experimental code (not documented) @<:@default=no@:>@])], [], [enable_experimental=no]) AS_IF([test "x$enable_experimental" = xyes], [AC_DEFINE([USE_EXPERIMENTAL_CODE], [1], [Define to 1 if you want to use experimental code])], []) AM_CONDITIONAL(ENABLE_EXPERIMENTAL, test x$enable_experimental = xyes) dnl Some tests compare the return values of PDFs, CDFs and of dnl the function parser with the output of corresponding dnl Mathematica(R) scripts. dnl Thus for these tests we need Mathematica(R). dnl However, simply checking for the existance of programm 'math' dnl breaks the configure script when 'math' is available but dnl ask for a password. dnl Hence these tests are enabled by means of a configure option. AC_ARG_WITH(mathematica, [AS_HELP_STRING([--with-mathematica], [Use Mathematica(R) for some checks @<:@default=no@:>@])], [case "${withval}" in yes) mathematica=true ;; no) mathematica=false ;; *) AC_MSG_ERROR(bad value '${withval}' for --with-mathematica) ;; esac], [mathematica=false]) AM_CONDITIONAL(HAVE_MATHEMATICA, test x$mathematica = xtrue) dnl check for Valgrind dnl (Valgrind is a GPL'd system for debugging and profiling x86-Linux programs) AC_CHECK_PROG(have_valgrind,valgrind,true,false) AM_CONDITIONAL(HAVE_VALGRIND, test x$have_valgrind = xtrue) dnl Set flags for compiler dnl GCC EXTRA_GCC_FLAGS= EXTRA_GCC_FLAGS="$EXTRA_GCC_FLAGS -Wshadow -Wstrict-prototypes" ##EXTRA_GCC_FLAGS="$EXTRA_GCC_FLAGS -Wdeprecated-declarations -Wbad-function-cast -Wcast-align -Wmissing-declarations -Wmissing-format-attribute -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wredundant-decls -Wstrict-prototypes -Wwrite-strings -Wconversion" ## the following flags raise warnings: ##EXTRA_GCC_FLAGS="$EXTRA_GCC_FLAGS -Wcast-qual -Wfloat-equal -Wunreachable-code" ## -Wcast-qual ## Warn whenever a pointer is cast so as to remove a type qualifier from the target type. For example, warn if a ## "const char *" is cast to an ordinary "char *". ## -Wfloat-equal ## Warn if floating point values are used in equality comparisons. ## -Wunreachable-code ## Warn if the compiler detects that code will never be executed. CC_FLAGS= if test X"$GCC" = Xyes ; then CC_FLAGS="$CC_FLAGS -Wall -Wextra $EXTRA_GCC_FLAGS" fi case "${host_os}" in linux*) case "${CC}" in ## Intel compiler *icc) ## -mp is the preferred form of -mieee-fp CC_FLAGS="$CC_FLAGS -mp" ;; esac ;; esac AC_SUBST(AM_CFLAGS,[$CC_FLAGS]) dnl MinGW (Win32) case "${host}" in *-*-mingw*) have_mingw=yes ;; *) have_mingw=no esac AM_CONDITIONAL(HAVE_MINGW, test "$have_mingw" = "yes") dnl create Makefiles for source AC_CONFIG_FILES([\ Makefile \ src/Makefile \ src/distr/Makefile \ src/distributions/Makefile \ src/methods/Makefile \ src/parser/Makefile \ src/specfunct/Makefile \ src/tests/Makefile \ src/uniform/Makefile \ src/urng/Makefile \ src/utils/Makefile \ scripts/Makefile \ doc/Makefile \ doc/src/Makefile \ doc/figures/Makefile \ tests/Makefile \ tests/testdistributions/Makefile \ examples/Makefile \ experiments/Makefile \ ]) AC_OUTPUT dnl ----------------------------------------- AC_MSG_RESULT([ *======================================================== * * Configuration for ${PACKAGE}-${VERSION}: * * Source directory: ${srcdir} * Installation directory: ${prefix} * C Compiler: ${CC} * * Build shared library: ${enable_shared} * Build static library: ${enable_static} * * Use deprecated code: ${enable_deprecated} * Enable runtime checks: ${enable_check_struct} * Enable logging of data: ${enable_logging} * Enable info routine: ${enable_info} * Experimenal code: ${enable_experimental} * Use Rmath library: ${with_Rmath} * * Support for external uniform random number generators * Rngstream: ${with_urng_rngstream} * PRNG: ${with_urng_prng} * GSL: ${with_urng_gsl} * * Default URNG: ${with_urng_default} * *======================================================== ]) dnl ----------------------------------------- unuran-1.11.0/experiments/0000755001357500135600000000000014430713513012461 500000000000000unuran-1.11.0/experiments/timings_chap_8.conf0000644001357500135600000000252314420445767016162 00000000000000# Timings for ARVAG, Chap. 8 # -------------------------- # # Runtime approx (# distributions)x(# methods) # # Distributions: distr = normal distr = cauchy distr = exponential distr = gamma(3) distr = beta(3,4) distr = beta(30,40) distr = cont; name="hyperbolic"; pdf="exp(-0.5*sqrt(1+x^2))"; pdfarea=3.31288224; mode=0. distr = normal; domain=(0,0.5) distr = powerexponential(3); orderstatistics=199,100; mode=0 # Methods: method = tdr; variant_gw; c=0; cpoints=3; usedars; max_sqhratio=0.99; method = tdr; variant_gw; c=-0.5; cpoints=3; usedars; max_sqhratio=0.99; method = tdr; variant_ia; c=-0.5; cpoints=3; usedars; max_sqhratio=0.99; method = tdr; variant_ps; c=-0.5; cpoints=3; usedars; max_sqhratio=0.99; method = tdr; variant_ps; c=-0.5; cpoints=3; usedars; max_sqhratio=0.9; method = tdr; variant_ps; c=-0.5; cpoints=3; usedars; max_sqhratio=0.5; method = tdr; variant_ps; c=-0.5; cpoints=3; usedars=off; max_sqhratio=0.99; method = utdr; method = arou; cpoints=3; usedars; max_sqhratio=0.99; method = tabl; usedars; nstp=5; max_intervals=10000; max_sqhratio=0.99; method = tabl; usedars; nstp=5; areafraction=0.25; max_sqhratio=0.9; method = srou method = srou; cdfatmode=0.5; method = srou; r=2; method = ssr method = ssr; cdfatmode=0.5; method = ninv; useregula; method = ninv; useregula; table=100; method = hinv; order=3; u_resolution=1.e-9 unuran-1.11.0/experiments/Makefile.in0000644001357500135600000004451014430713360014452 00000000000000# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ noinst_PROGRAMS = make_timing_table$(EXEEXT) subdir = experiments ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = PROGRAMS = $(noinst_PROGRAMS) make_timing_table_SOURCES = make_timing_table.c make_timing_table_OBJECTS = make_timing_table.$(OBJEXT) make_timing_table_LDADD = $(LDADD) make_timing_table_DEPENDENCIES = $(top_builddir)/src/libunuran.la AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/make_timing_table.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = make_timing_table.c DIST_SOURCES = make_timing_table.c am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autoconf/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILECMD = @FILECMD@ GREP = @GREP@ HAVE_DIVIDE_BY_ZERO = @HAVE_DIVIDE_BY_ZERO@ HAVE_IEEE_COMPARISONS = @HAVE_IEEE_COMPARISONS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNURAN_LT_VERSION = @UNURAN_LT_VERSION@ UNURAN_SUPPORTS_GSL = @UNURAN_SUPPORTS_GSL@ UNURAN_SUPPORTS_PRNG = @UNURAN_SUPPORTS_PRNG@ UNURAN_SUPPORTS_RNGSTREAM = @UNURAN_SUPPORTS_RNGSTREAM@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ have_valgrind = @have_valgrind@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = \ -I$(top_srcdir)/src \ -I$(top_srcdir)/src/tests AM_LDFLAGS = \ -L$(top_builddir)/src LDADD = \ $(top_builddir)/src/libunuran.la EXTRA_DIST = \ timings_chap_8.conf \ timings_chap_10.conf # clean backup files CLEANFILES = \ unuran.log \ *~ # clean generated files MAINTAINERCLEANFILES = \ Makefile.in all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign experiments/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign experiments/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstPROGRAMS: @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list make_timing_table$(EXEEXT): $(make_timing_table_OBJECTS) $(make_timing_table_DEPENDENCIES) $(EXTRA_make_timing_table_DEPENDENCIES) @rm -f make_timing_table$(EXEEXT) $(AM_V_CCLD)$(LINK) $(make_timing_table_OBJECTS) $(make_timing_table_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/make_timing_table.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/make_timing_table.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/make_timing_table.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstPROGRAMS cscopelist-am \ ctags ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: unuran-1.11.0/experiments/timings_chap_10.conf0000644001357500135600000002071314420304141016210 00000000000000# Timings for ARVAG, Chap. 8 # -------------------------- # # Runtime approx (# distributions)x(# methods) # # Distributions: distr = discr; pmfsum=46.22619; pv=(0.4833,0.1034,0.1078,0.4275,0.449,0.164,0.1882,0.8197,0.05556,0.3701,0.2285,0.923,0.02765,0.8563,0.3065,0.6959,0.9116,0.8122,0.58,0.9536,0.415,0.6801,0.5578,0.8655,0.9317,0.5767,0.45,0.4381,0.4827,0.4127,0.2618,0.6184,0.4272,0.04263,0.03328,0.6954,0.3995,0.1863,0.7268,0.9995,0.4879,0.3741,0.1468,0.04585,0.07295,0.6941,0.589,0.1803,0.1412,0.1174,0.1391,0.7422,0.6585,0.7047,0.8773,0.1238,0.2313,0.662,0.844,0.4284,0.8317,0.4757,0.1172,0.4289,0.3438,0.1016,0.9704,0.3831,0.2708,0.4075,0.3814,0.2028,0.1296,0.2901,0.2423,0.4606,0.4711,0.5855,0.365,0.3367,0.2399,0.9235,0.521,0.9083,0.4081,0.4477,0.4038,0.4794,0.06433,0.3461,0.4334,0.09627,0.7935,0.9386,0.05207,0.8935,0.6639,0.6485,0.8098,0.4329) distr = discr; pmfsum=496.7561432; pv=(0.7472,0.9614,0.1895,0.947,0.2913,0.7556,0.103,0.995,0.9449,0.5864,0.3492,0.905,0.744,0.5745,0.3345,0.3965,0.4539,0.2156,0.03381,0.06004,0.6551,0.3588,0.7331,0.1497,0.9079,0.3974,0.5437,0.2026,0.6166,0.6418,0.4407,0.2077,0.6717,0.0554,0.09146,0.3027,0.9277,0.4809,0.7569,0.9062,0.4738,0.2653,0.7231,0.8462,0.8187,0.9065,0.99,0.6965,0.9108,0.5091,0.4463,0.4938,0.2942,0.8673,0.005628,0.2862,0.6225,0.8119,0.9142,0.9835,0.6948,0.331,0.1572,0.07726,0.221,0.06568,0.4341,0.2311,0.4024,0.1592,0.4442,0.5346,0.4916,0.65,0.9978,0.04076,0.1973,0.7828,0.9922,0.7546,0.5748,0.9709,0.07804,0.7711,0.88,0.6399,0.9208,0.6939,0.659,0.5742,0.4867,0.4628,0.2566,0.4151,0.04251,0.9282,0.7651,0.765,0.04467,0.8874,0.5677,0.9822,0.05246,0.1328,0.9929,0.01138,0.9744,0.3617,0.1129,0.3715,0.05362,0.6678,0.4539,0.7973,0.567,0.2051,0.1973,0.3822,0.5244,0.2769,0.4322,0.6172,0.4798,0.3895,0.8645,0.635,0.4273,0.2567,0.8716,0.6236,0.4529,0.895,0.7587,0.2521,0.3993,0.2272,0.3048,0.4548,0.8323,0.02217,0.1075,0.07261,0.3079,0.7453,0.6754,0.4554,0.8281,0.3558,0.8109,0.8204,0.4008,0.09905,0.9393,0.1969,0.9479,0.204,0.1806,0.9448,0.5486,0.9768,0.8758,0.4899,0.7163,0.9546,0.7683,0.4173,0.4084,0.2094,0.09292,0.9619,0.5803,0.8536,0.282,0.1415,0.1795,0.7545,0.3427,0.9446,0.2317,0.5505,0.1621,0.9999,0.683,0.5737,0.2862,0.5099,0.9667,0.6191,0.518,0.0926,0.5583,0.4097,0.425,0.1307,0.978,0.5561,0.143,0.9892,0.7984,0.8016,0.8003,0.04456,0.5668,0.2511,0.6383,0.04469,0.8837,0.6773,0.352,0.5348,0.917,0.05822,0.8341,0.4422,0.3587,0.6485,0.4091,0.3115,0.3807,0.09234,0.266,0.3223,0.5823,0.2908,0.4657,0.2778,0.01558,0.03969,0.8275,0.2331,0.1319,0.3624,0.4754,0.6983,0.2149,0.3041,0.6413,0.2561,0.8562,0.6557,0.2323,0.9446,0.4754,0.5633,0.9662,0.6223,0.8931,0.2726,0.5005,0.3446,0.8775,0.2329,0.6731,0.1115,0.7457,0.8705,0.1976,0.4132,0.5308,0.5664,0.5563,0.1571,0.6746,0.9107,0.324,0.2124,0.1992,0.3474,0.3577,0.5901,0.3061,0.07484,0.8572,0.2456,0.4285,0.842,0.1842,0.134,0.6829,0.9715,0.9865,0.7208,0.1521,0.4051,0.4303,0.5638,0.4775,0.4944,0.1063,0.3513,0.2783,0.147,0.7485,0.7612,0.9722,0.07213,0.8913,0.5156,0.5437,0.2302,0.7071,0.3816,0.8608,0.2587,0.7206,0.6608,0.7087,0.8536,0.2903,0.09699,0.2313,0.3592,0.1841,0.7457,0.9529,0.2123,0.4356,0.9845,0.9807,0.1401,0.5443,0.4688,0.437,0.91,0.8372,0.08725,0.5762,0.6513,0.1166,0.4265,0.8674,0.7977,0.8263,0.3295,0.6362,0.4384,0.6422,0.5838,0.6832,0.2261,0.2066,0.5993,0.7025,0.086,0.6624,0.1305,0.2655,0.176,0.8252,0.04326,0.6894,0.5247,0.7086,0.6168,0.8219,0.7271,0.8824,0.2873,0.1858,0.2886,0.2402,0.7034,0.5026,0.0625,0.03355,0.1041,0.8,0.9765,0.3712,0.9736,0.5345,0.8005,0.546,0.9303,0.8452,0.2758,0.8374,0.3136,0.02325,0.5487,0.955,0.0263,0.8375,0.2601,0.7148,0.3229,0.3349,0.1976,0.6813,0.2188,0.5349,0.2211,0.3101,0.2452,0.0003473,0.4206,0.7641,0.3149,0.1552,0.1448,0.9267,0.001311,0.1319,0.5961,0.9717,0.975,0.2944,0.336,0.2569,0.6522,0.9595,0.1385,0.5756,0.4334,0.4246,0.9174,0.2656,0.1882,0.4243,0.4968,0.5015,0.8733,0.2691,0.3521,0.5748,0.872,0.1372,0.756,0.603,0.897,0.8428,0.4199,0.3461,0.2448,0.8833,0.2815,0.7705,0.8115,0.4586,0.3641,0.505,0.6233,0.03434,0.8672,0.0035,0.75,0.7652,0.5152,0.4287,0.878,0.628,0.7592,0.8257,0.981,0.7853,0.3393,0.4796,0.7361,0.902,0.05779,0.709,0.9247,0.4434,0.6937,0.2041,0.3014,0.409,0.8265,0.2006,0.5514,0.6438,0.3113,0.7718,0.6735,0.01581,0.5521,0.9461,0.6925,0.2305,0.2129,0.4666,0.9564,0.3285,0.1551,0.7575,0.03174,0.8852,0.4614,0.5534,0.7303,0.4761,0.6349,0.3528,0.1789,0.8323,0.3235,0.581,0.5054,0.8165,0.7714,0.6349,0.8129,0.5859,0.5586,0.1683,0.8565,0.2574,0.4035,0.4108,0.8248,0.3722,0.9421,0.8574,0.09443,0.8961,0.3073,0.5046,0.9155,0.06382,0.9837,0.9236,0.4101,0.2473,0.2123,0.2887,0.5972,0.6614,0.6538,0.1203,0.7407,0.404,0.2503,0.7095,0.9159,0.03179,0.3081,0.8521,0.8214,0.1357,0.0008759,0.3476,0.9059,0.07186,0.01714,0.424,0.4958,0.8245,0.8048,0.1353,0.8987,0.1631,0.1511,0.015,0.158,0.7591,0.9008,0.3055,0.2422,0.7273,0.5926,0.4534,0.4207,0.5916,0.5917,0.1058,0.5148,0.5198,0.5746,0.6818,0.01894,0.6952,0.7698,0.5464,0.1203,0.5321,0.6187,0.5314,0.9622,0.773,0.718,0.2259,0.7201,0.04573,0.1253,0.7726,0.2994,0.4541,0.5336,0.6668,0.7846,0.9343,0.959,0.985,0.7657,0.2391,0.1892,0.4386,0.6454,0.707,0.5705,0.9071,0.6831,0.9339,0.8525,0.6812,0.963,0.8882,0.7271,0.9086,0.6637,0.4341,0.1935,0.2418,0.8791,0.4998,0.2346,0.2568,0.1134,0.2607,0.04536,0.8182,0.468,0.5537,0.4749,0.9111,0.7849,0.6198,0.6224,0.2299,0.8218,0.7316,0.8953,0.3213,0.1582,0.2975,0.7017,0.07945,0.2791,0.7977,0.4672,0.8226,0.1657,0.537,0.4218,0.004419,0.6977,0.9833,0.9469,0.09334,0.9128,0.3636,0.3245,0.8635,0.09094,0.632,0.4292,0.5422,0.9328,0.3346,0.7275,0.4627,0.6536,0.5369,0.2603,0.6401,0.4879,0.9998,0.8385,0.6357,0.7902,0.0165,0.8916,0.5423,0.8775,0.6529,0.5671,0.6789,0.7865,0.02092,0.1379,0.1367,0.8538,0.6864,0.4104,0.674,0.2001,0.1495,0.15,0.03386,0.7122,0.1497,0.3115,0.3982,0.922,0.1332,0.4199,0.8559,0.0445,0.4802,0.8528,0.177,0.258,0.4593,0.7149,0.0403,0.4042,0.7729,0.3045,0.3664,0.2041,0.6235,0.1544,0.3325,0.4919,0.4738,0.8429,0.9343,0.5699,0.3407,0.423,0.07843,0.5254,0.8604,0.5703,0.9014,0.2675,0.4011,0.8554,0.8611,0.8632,0.6282,0.5509,0.4948,0.6591,0.004726,0.3965,0.1623,0.1672,0.5309,0.5536,0.228,0.5973,0.1903,0.1306,0.1496,0.07185,0.3298,0.5603,0.2481,0.8044,0.9287,0.7049,0.387,0.9412,0.3005,0.1539,0.8922,0.282,0.2958,0.7574,0.7299,0.1148,0.7649,0.2038,0.5019,0.5175,0.5746,0.07328,0.3523,0.4457,0.2448,0.513,0.1042,0.6413,0.3161,0.8081,0.7172,0.7001,0.01557,0.6542,0.825,0.4181,0.7198,0.8967,0.09514,0.3033,0.9549,0.6929,0.5932,0.7858,0.3803,0.6196,0.2409,0.3401,0.1356,0.1066,0.1367,0.6988,0.8195,0.2985,0.4195,0.9987,0.8039,0.6443,0.5944,0.5806,0.08412,0.7476,0.4993,0.2773,0.1292,0.05468,0.906,0.4916,0.7488,0.435,0.6651,0.1515,0.6133,0.3284,0.5284,0.4526,0.7938,0.0299,0.1089,0.4539,0.9899,0.3856,0.5145,0.8733,0.9058,0.638,0.01521,0.5959,0.7766,0.5833,0.1092,0.1044,0.02772,0.1483,0.444,0.9529,0.4144,0.8198,0.9156,0.5003,0.6206,0.7899,0.8067,0.04638,0.6308,0.4044,0.2922,0.1731,0.725,0.7664,0.277,0.5771,0.9484,0.1831,0.1678,0.4728,0.9207,0.03485,0.7238,0.5199,0.5063,0.215,0.8082,0.01957,0.8856,0.4251,0.001493,0.9732,0.2549,0.0207,0.7093,0.8001,0.5299,0.2543,0.4324,0.2229,0.5814,0.0712,0.2646,0.7502,0.6607,0.03635,0.5408,0.2303,0.1544,0.8213,0.7326,0.2107,0.2688,0.3963,0.7311,0.2376,0.01396,0.3756,0.02181,0.4375,0.4841,0.1213,0.5894,0.2145,0.9027,0.05007,0.3249,0.4643,0.242,0.01372,0.7841,0.234,0.08753,0.1924,0.05146,0.02327,0.8187,0.7961,0.3203,0.7857,0.8047,0.4205,0.2985,0.3483,0.3206,0.2993,0.7091,0.1337,0.418,0.2492,0.3842,0.6694,0.176,0.2355,0.6001,0.4354,0.08845,0.0431,0.5486,0.4121,0.2697,0.247,0.2283,0.6264,0.465,0.8265,0.9298,0.2782,0.1443,0.5272,0.2207,0.1444,0.7264,0.278,0.8365,0.475,0.5504,0.04256,0.2364,0.03961,0.462,0.9995,0.6878,0.6275,0.1922,0.7525,0.4595,0.001042,0.7272,0.926,0.5297,0.7229,0.5829,0.3988,0.3089,0.5784,0.8565,0.1208,0.4724,0.1034,0.3061,0.07819,0.236,0.06382,0.8441,0.07872,0.5482,0.4364,0.6519,0.3263,0.08877,0.4353,0.9246,0.4002,0.5591,0.7124,0.3417,0.001461) distr = binomial(50,0.5) distr = binomial(500,0.5) distr = binomial(5000,0.5) distr = poisson(5) distr = poisson(50) distr = poisson(500) distr = hypergeometric(5000,500,50) distr = hypergeometric(50000,5000,500) distr = hypergeometric(500000,50000,5000) distr = logarithmic(0.01) distr = logarithmic(0.5) distr = logarithmic(0.99) # Methods: method = dss method = dgt; guidefactor=0.2 method = dgt; guidefactor=1 method = dgt; guidefactor=4 method = dau; urnfactor=1 method = dau; urnfactor=4 method = dari; squeeze=off; tablesize=100 method = dari; squeeze=on; tablesize=100 method = dari; squeeze=on; tablesize=0 method = dari; squeeze=on; tablesize=1000 method = dari; squeeze=off; tablesize=1000 method = dsrou method = dsrou; cdfatmode=0.5 unuran-1.11.0/experiments/Makefile.am0000644001357500135600000000065414420445767014456 00000000000000## Process this file with automake to produce Makefile.in AM_CPPFLAGS = \ -I$(top_srcdir)/src \ -I$(top_srcdir)/src/tests AM_LDFLAGS = \ -L$(top_builddir)/src LDADD = \ $(top_builddir)/src/libunuran.la noinst_PROGRAMS = \ make_timing_table EXTRA_DIST = \ timings_chap_8.conf \ timings_chap_10.conf # clean backup files CLEANFILES = \ unuran.log \ *~ # clean generated files MAINTAINERCLEANFILES = \ Makefile.in unuran-1.11.0/experiments/make_timing_table.c0000644001357500135600000004365314420445767016227 00000000000000/***************************************************************************** * * * UNURAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: make_timing_table.c * * * * Create a table with timing results * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #ifdef HAVE_CONFIG_H # include #else # error "config.h" required #endif #include #include #include #include #ifdef HAVE_UNISTD_H # include #endif #include #include /* ------------------------------------------------------------------------- */ /* Program name */ static const char *progname = "make_timing_table"; /*---------------------------------------------------------------------------*/ extern char *_unur_parser_prepare_string( const char *str ); /*---------------------------------------------------------------------------*/ /* print help */ static void print_usage(void); /* get unit for relative timing */ static double get_timing_unit(void); /* read config file */ static int read_config_file ( const char *filename, struct unur_slist *distr_str_list, struct unur_slist *meth_str_list ); /* make distribution objects */ static struct unur_slist *make_distr_list ( struct unur_slist *distr_str_list ); /* print legend for distributions and methods */ static int print_legend ( struct unur_slist *distr_str_list, struct unur_slist *meth_str_list ); /* print legend for timings results */ static int print_timing_legend ( int samplesize, double unit, int is_default ); /* print label for distribution and methods with index n*/ static int print_label ( int n, int ltype ); #define LABEL_DISTR 'A' /* label used for distributions */ #define LABEL_METH '1' /* label used for methods */ /* compute timings table */ static double *compute_timings ( struct unur_slist *distr_str_list, struct unur_slist *meth_str_list, int samplesize, double duration, double unit ); /* print timings table */ static int print_timings ( double *timings, struct unur_slist *distr_str_list, struct unur_slist *meth_str_list, int rowentry ); #define ROW_DISTRIBUTION 1 /* print distributions on row, methods in columns */ #define ROW_METHOD 2 /* print distributions on columns, methods in rows*/ /*---------------------------------------------------------------------------*/ /* print usage */ void print_usage(void) { #if HAVE_DECL_GETOPT fprintf(stderr,"\n%s [-D] [-n size] [-d time] conffile\n",progname); fprintf(stderr,"\n"); fprintf(stderr,"Compute average generation time (including setup) for a sampling.\n"); fprintf(stderr,"\n"); fprintf(stderr,"Arguments:\n"); fprintf(stderr,"\t-D ... debug mode\n"); fprintf(stderr,"\t-n size ... size of sample (default: 1000)\n"); fprintf(stderr,"\t-d time ... duration for each test in sec. (default: 0.1)\n"); fprintf(stderr,"\t-u unit ... timing unit in micro sec. (default: generation for exponential)\n"); fprintf(stderr,"\t conffile ... file with list of distributions and methods\n"); fprintf(stderr,"\n"); #else fprintf(stderr,"\n%s conffile [samplesize]\n",progname); fprintf(stderr,"\n"); fprintf(stderr,"Compute average generation time (including setup) for a sampling.\n"); fprintf(stderr,"\n"); fprintf(stderr,"Arguments:\n"); fprintf(stderr,"\tconffile ... file with list of distributions and methods\n"); fprintf(stderr,"\tsamplesize ... size of sample (default: 1000)\n"); fprintf(stderr,"\n"); #endif } /* end of print_usage() */ /*****************************************************************************/ int main (int argc, char *argv[]) { /* defaults */ int debug = 0; /* debug mode (on/off) */ int samplesize = 1000; /* size of samples */ double duration = 0.1; /* duration in seconds for timing generation of a sample */ double unit = -1.; /* timing unit in micro sec. (<= 0. --> use default) */ char *conffile; /* name of configuration file */ struct unur_slist *distr_str_list; /* list of strings for distributions */ struct unur_slist *meth_str_list; /* list of strings for methods */ double timing_unit; /* unit for timing result */ double *time_0; /* ------------------------------------------------------------------------*/ /* read parameters */ #if HAVE_DECL_GETOPT int c; while ((c = getopt(argc, argv, "Dd:n:u:")) != -1) { switch (c) { case 'D': /* debug */ debug = 1; break; case 'd': /* duration */ duration = atof(optarg); break; case 'n': /* sample size */ samplesize = atoi(optarg); break; case 'u': /* sample size */ unit = atof(optarg); break; case '?': /* Help Message */ case 'h': default: print_usage(); exit (EXIT_FAILURE); } } /* name of configuration file */ if (optind >= argc) { print_usage(); exit (EXIT_FAILURE); } conffile = argv[optind]; #else /* name of configuration file */ if (argc<2) { print_usage(); exit (EXIT_FAILURE); } conffile = argv[1]; /* sample size */ if (argc >= 3) samplesize = atoi(argv[2]); #endif /* ------------------------------------------------------------------------*/ /* debugging and logging information */ if (debug) unur_set_default_debug(~0u); /* on */ else unur_set_default_debug(0u); /* off */ /* create lists for distributions and methods */ distr_str_list = _unur_slist_new(); meth_str_list = _unur_slist_new(); /* read config file */ read_config_file(conffile, distr_str_list, meth_str_list); /* print legend */ print_legend(distr_str_list,meth_str_list); /* get unit for relative timings */ timing_unit = (unit <= 0.) ? get_timing_unit() : unit; /* make timings */ time_0 = compute_timings(distr_str_list,meth_str_list,samplesize,duration,timing_unit); /* print timings */ print_timing_legend(samplesize, timing_unit,((unit<= 0.)?TRUE:FALSE)); print_timings(time_0,distr_str_list,meth_str_list,ROW_DISTRIBUTION); print_timings(time_0,distr_str_list,meth_str_list,ROW_METHOD); /* free memory */ _unur_slist_free(distr_str_list); _unur_slist_free(meth_str_list); free(time_0); exit (EXIT_SUCCESS); } /* end of main() */ /*---------------------------------------------------------------------------*/ double get_timing_unit(void) /* get unit for relative timings */ /* (use generation of exponential random variate via inversion) */ { UNUR_DISTR *distr; /* pointer to working distribution object */ UNUR_PAR *par; /* pointer to working parameter object */ static double timing_unit = -1.; /* timing result for basis of relative timings */ if (timing_unit < 0.) { /* compute timing unit */ distr = unur_distr_exponential(NULL,0); par = unur_cstd_new(distr); timing_unit = unur_test_timing_exponential(par, 6); unur_par_free(par); unur_distr_free(distr); } return timing_unit; } /* end of get_timing_unit() */ /*---------------------------------------------------------------------------*/ int read_config_file ( const char *filename, struct unur_slist *distr_str_list, struct unur_slist *meth_str_list ) /* read config file */ { #define LINELENGTH 10240 /* max length of lines allowed */ char line[LINELENGTH]; /* input buffer */ char *str; /* pointer to working string */ FILE *fh; /* file handle for input stream */ int line_no; /* counter for lines */ /* open the file with the data read-only */ fh = fopen(filename, "r"); if (fh == NULL) { fprintf(stderr,"error: cannot open config file `%s'.\n",filename); exit(EXIT_FAILURE); } /* read lines until eof */ line_no = 0; while( fgets(line, LINELENGTH, fh) ) { ++line_no; /* make a working copy of the line; */ /* remove all white spaces and convert to lower case letters. */ str = _unur_parser_prepare_string( line ); /* ignore all lines that do not start with a letter */ if ( ! isalpha(str[0]) || str[0] == '#') { free(str); continue; } /* store distribution object */ if ( strncmp( str, "distr", (size_t)5)==0 ) { _unur_slist_append(distr_str_list,str); continue; } /* store method (parameter object) */ if ( strncmp( str, "method=", (size_t)7)==0 ) { _unur_slist_append(meth_str_list,str); continue; } fprintf(stderr,"syntax error in line %d: %s\n",line_no,str); exit (EXIT_FAILURE); } /* close input stream */ fclose(fh); /* check number of distributions and methods */ if ( _unur_slist_length(distr_str_list) == 0 || _unur_slist_length(meth_str_list) == 0 ) { fprintf(stderr,"error: no distributions or methods given.\n"); exit (EXIT_FAILURE); } /* o.k. */ return 1; #undef LINELENGTH } /* end of read_config_file() */ /*---------------------------------------------------------------------------*/ struct unur_slist * make_distr_list ( struct unur_slist *distr_str_list ) /* make distribution objects */ { struct unur_slist *distr_list; /* list of distributions */ int n_distr; /* number of distributions */ char *str; /* pointer to working string */ UNUR_DISTR *distr; /* pointer to distribution object */ int i; /* get number of distributions */ n_distr = _unur_slist_length(distr_str_list); /* create lists for distributions and methods */ distr_list = _unur_slist_new(); /* get all distribution objects */ for (i=0; i\n",n_distr); for (i=0; i\n",n_meth); for (k=0; k\n"); printf("Average generation times (including setup) for sample of size %d.\n",samplesize); if (is_default) { printf("Timings are relative to generation of exponential random variate\n"); printf("using inversion within UNU.RAN environment\n"); } printf("(timing unit = %g microseconds)\n\n", unit); return 1; } /* end of print_timing_legend() */ /*---------------------------------------------------------------------------*/ int print_label ( int n, int ltype ) /* print label for distribution and methods with index n*/ { switch(ltype) { case 'a': printf(" [%c]", 'a'+n); break; case 'A': printf(" [%c]", 'A'+n); break; case '1': default: printf("[%02d]", 1+n); break; } return 1; } /* end of print_label() */ /*---------------------------------------------------------------------------*/ double * compute_timings ( struct unur_slist *distr_str_list, struct unur_slist *meth_str_list, int samplesize, double duration, double timing_unit ) /* compute timings table */ { struct unur_slist *distr_list; /* list of distributions */ int n_distr; /* number of distributions */ int n_meth; /* number of methods */ char *str; /* pointer to working string */ UNUR_DISTR *distr; /* pointer to working distribution object */ UNUR_PAR *par; /* pointer to working parameter object */ int i,k; struct unur_slist *mlist = NULL; /* list of allocated memory blocks in running _unur_str2par() */ double *timing; /* timing results */ /* get all distribution objects */ distr_list = make_distr_list(distr_str_list); /* get number of distributions and methods */ n_distr = _unur_slist_length(distr_str_list); n_meth = _unur_slist_length(meth_str_list); /* allocate array for timings */ timing = malloc(n_distr * n_meth * sizeof(double)); /* make timings */ for (i=0; i\n"); break; case ROW_METHOD: default: /* print distributions on columns, methods in rows*/ n_row = n_meth; rltype = LABEL_METH; n_col = n_distr; cltype = LABEL_DISTR; printf("\n"); break; } /* print table header */ printf(" "); for (row=0; row 0.) { printf("%10.4g",timings[idx_time]); } else { printf("%10s","--"); } } printf("\n"); } printf("\n"); /* o.k. */ return 1; } /* end of print_timings() */ /*---------------------------------------------------------------------------*/ unuran-1.11.0/README0000644001357500135600000001145514420445767010740 00000000000000 ***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** UNU.RAN is an ANSI C library licensed under GPL. It contains universal (also called automatic or black-box) algorithms that can generate random numbers from large classes of continuous or discrete distributions, and also from practically all standard distributions. The library and an extensive online documentation are available at: ------------------------------------------ http://statmath.wu.ac.at/unuran/ ------------------------------------------ --------------------------------------------------------- A short overview --------------------------------------------------------- To generate random numbers the user must supply some information about the desired distribution, especially a C-function that computes the density and - depending on the chosen methods - some additional information (like the borders of the domain, the mode, the derivative of the density ...). After a user has given this information an init-program computes all tables and constants necessary for the random variate generation. The sample program can then generate variates from the desired distribution. The main part of UNU.RAN are different universal algorithms (called methods). There are: 7 methods for continuous univariate distributions 3 methods for discrete univariate distributions 1 method for univariate empirical distributions (given by an observed sample) 1 method for multivariate empirical distributions (given by a vector sample) The choice of the method depends on the information available for the distribution and on the desired characteristics of the algorithm (fast initialisation and slow sampling, slow initialisation and fast sampling). A second important part of UNU.RAN is the distribution module containing all necessary functions for many continuous and discrete univariate standard distributions. Thus UNU.RAN can be used without extra coding to obtain very fast generators for the best known standard distributions. UNU.RAN is coded in ANSI C but uses an object oriented programming interface. There are three objects: distribution objects containing all information of the distribution. parameter objects containing all input parameters (and defaults) for the different methods. generator object produced by the initialization program, containing everything necessary for sampling. Of course a uniform random number generator is necessary to use UNU.RAN. We provide an interface to use the PRNG uniform package from the pLab team from the University of Salzburg (Austria), available at http://random.mat.ac.at/ or from http://statmath.wu.ac.at/prng/. It is also no problem to include any other uniform random number generator. --------------------------------------------------------- ADVANTAGES OF UNUNRAN --------------------------------------------------------- Why can it be worth the time to download UNU.RAN and to understand the concept of its interface? Isn't it much faster to implement a simple standard method for the distribution I am interested in? - The first and main advantage lies in the modelling flexibility you gain for your simulation. Once you have installed UNU.RAN you can sample from practically all uni-modal (and other) distributions without coding more than the density functions. For a big number of standard distributions (and truncated versions of these standard distributions) you need not even code the densities as these are already included in UNU.RAN. - It is possible to sample from non-standard distribution. In fact only a pointer to a function that returns e.g. the density at a given point x is required. - Distributions can be exchanged easily. For example it is not difficult at all to start your simulation with the normal distribution, and switch to an empirical distribution later. - The library contains reliable and fast generation algorithms. The characteristics of some these algorithms (like speed, expected number of uniforms required etc, ...) are only slightly influenced by the chosen distribution. (However numerical inversion is included as a (very slow) brute force algorithm for the rare cases where the more sophisticated methods do not work.) - Correlation induction facilities are included. --------------------------------------------------------- March 31st, 2001 Josef Leydold (leydold@statmath.wu.ac.at) Wolfgang Hoermann (hormannw@boun.edu.tr) unuran-1.11.0/acinclude.m40000644001357500135600000000673714420445767012260 00000000000000dnl dnl AX_IEEE_COMP dnl Check IEEE comparisons, whether "x != x" is true for NaNs dnl ------------------------------------------------------------------------- AC_DEFUN([AX_IEEE_COMP], [ AC_CACHE_CHECK([for IEEE comparisons], ac_cv_c_ieee_comparisons, [AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include int main (void) { int status; double inf, nan; inf = exp(1.0e10); nan = inf / inf; /* nan = 0.0 / 0.0; */ status = (nan == nan); return status; }]])], [ac_cv_c_ieee_comparisons="yes"], [ac_cv_c_ieee_comparisons="no"], [ac_cv_c_ieee_comparisons="yes"]) ]) if test "$ac_cv_c_ieee_comparisons" != no ; then AC_DEFINE([HAVE_IEEE_COMPARISONS], [1], [Define to 1 if "x != x" is true for NaNs]) AC_SUBST(HAVE_IEEE_COMPARISONS) fi ]) # end of AX_IEEE_COMP dnl dnl AX_DIVIDE_BY_ZERO dnl Check whether 1./0. works and results in "infinity" dnl ------------------------------------------------------------------------- AC_DEFUN([AX_DIVIDE_BY_ZERO], [ AC_CACHE_CHECK([for divide-by-zero], ac_cv_c_divide_by_zero, [AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include #include int main (void) { double x = 0.0; double inf = 1.0 / x; int status = (inf < DBL_MAX/2.); return status; }]])], [ac_cv_c_divide_by_zero="yes"], [ac_cv_c_divide_by_zero="no"], [ac_cv_c_divide_by_zero="yes"]) ]) if test "$ac_cv_c_divide_by_zero" != no ; then AC_DEFINE([HAVE_DIVIDE_BY_ZERO], [1], [Define to 1 if "1.0/0.0" results in INFINITY]) AC_SUBST(HAVE_DIVIDE_BY_ZERO) fi ]) # end of AX_DIVIDE_BY_ZERO dnl dnl AX_ADD_URNG_LIB([TAG],[UTAG],[NAME],[LIB],[PROG],[HEADER]) dnl Add support for library providing uniform random number generators dnl via configure flag and check existance of library and header file dnl ------------------------------------------------------------------------- AC_DEFUN([AX_ADD_URNG_LIB], [ AC_ARG_WITH(urng_$1, [AS_HELP_STRING([--with-urng-$1], [URNG: use $3 @<:@default=no@:>@])], [case "${withval}" in yes) ;; no) ;; *) AC_MSG_ERROR(bad value '${withval}' for --with-urng-$1) ;; esac], [with_urng_$1=no]) AS_IF([test "x$with_urng_$1" != xno], [AC_CHECK_LIB([$4], [$5], [], []) AC_CHECK_HEADERS([$6], [AC_SUBST(UNURAN_SUPPORTS_$2,-DUNURAN_SUPPORTS_$2) AC_DEFINE_UNQUOTED([UNURAN_HAS_$2], [1], [Define to 1 if you use $3.])], [AC_MSG_FAILURE( [PRINT_WITH_FRAME([--with-urng-$1 given, but '$6' not found]) ]) ]) ], []) ]) dnl dnl AX_ADD_RMATH() dnl Add support for Rmath standalone library from R project dnl via configure flag and check existance of library dnl (Remark: AC_CHECK_HEADERS cannot be used as is. I have skipped the dnl test for header file Rmath.h.) dnl ------------------------------------------------------------------------- AC_DEFUN([AX_ADD_RMATH], [ AC_ARG_WITH(Rmath, [AS_HELP_STRING([--with-Rmath], [use Rmath library from R project @<:@EXPERIMENTAL@:>@ @<:@default=no@:>@])], [case "${withval}" in yes) ;; no) ;; *) AC_MSG_ERROR(bad value '${withval}' for --with-Rmath) ;; esac], [with_Rmath=no]) AS_IF([test "x$with_Rmath" != xno], [AC_CHECK_LIB([Rmath], [bessel_k],[], [AC_MSG_FAILURE( [PRINT_WITH_FRAME([--with-Rmath given, but 'libRmath' not found]) ]) ]) ], []) ]) dnl dnl PRINT_WITH_FRAME([STRING)] dnl Print 'string' inside framed box dnl ------------------------------------------------------------------------- AC_DEFUN([PRINT_WITH_FRAME],[ `echo "$1" | \ $SED 's/\(.*\)/* \1 */;h;s/./*/g;p;s/./ /g;s/./*/;s/.$/*/;p;x;p;x;p;x;s/./*/g'` ]) # end of PRINT_WITH_FRAME unuran-1.11.0/INSTALL0000644001357500135600000003434614420445767011115 00000000000000 ***************************************************************************** * * * UNU.RAN -- Universal Non-Uniform Random number generator * * * ***************************************************************************** Installation instructions for the UNU.RAN library. Version 1.11.0 While the code is plain ANSI C and thus quite portable, the following adaptions might be necessary for compiling this library. Uniform random number generator ............................... UNU.RAN can be used with any uniform random number generator but (at the moment) some features work best with Pierre L'Ecuyer's RngStreams library (see for a description and downloading). Install the requires libraries first. Installing UNU.RAN .................. 1. First unzip and untar the package and change to the directory: tar zxvf unuran-1.11.0.tar.gz cd unuran-1.11.0 2. Optional: Edit the file `src/unuran_config.h'. 3. Run a configuration script: sh ./configure --prefix= where `' is the root of the installation tree. When omitted `/usr/local' is used. Use ./configure --help to get a list of other options. In particular the following flags are important: [*] Enable support for some external sources of uniform random number generators: --with-urng-rngstream URNG: use Pierre L'Ecuyer's RNGSTREAM library [default=no] --with-urng-prng URNG: use Otmar Lendl's PRNG library [default=no] --with-urng-gsl URNG: use random number generators from GNU Scientific Library [default=no] --with-urng-default URNG: global default URNG (builtin|rngstream) [default=builtin] We strongly recommend to use RngStreams library: sh ./configure --with-urng-rngstream --with-urng-default=rngstream Important: You must install the respective libraries RngStreams, PRNG and GSL before ./configure is executed. [*] Also make a shared library: --enable-shared build shared libraries [default=no] [*] The library provides the function `unur_gen_info' for information about generator objects. This is intended for using in interactive computing environments. This feature can be enabled / disabled by means of the configure flag --enable-info INFO: provide function with information about generator objects [default=`yes'] [*] Enable support for deprecated UNU.RAN routines if you have some problems with older application after upgrading the library: --enable-deprecated enable support for deprecated UNU.RAN routines [default=no] [*] Enable debugging tools: --enable-check-struct Debug: check validity of pointers to structures [default=no] --enable-logging Debug: print informations about generator into logfile [default=no] 4. Compile and install the library: make make install This installs the following files: $(prefix)/include/unuran.h $(prefix)/include/unuran_tests.h $(prefix)/lib/libunuran.a $(prefix)/info/unuran.info Obviously `$(prefix)/include' and `$(prefix)/lib' must be in the search path of your compiler. You can use environment variables to add these directories to the search path. If you are using the bash type (or add to your profile): export LIBRARY_PATH="HOMEDIRECTORY/lib" export C_INCLUDE_PATH="HOMEDIRECTORY/include" 5. Documentation in various formats (PDF, HTML, info, plain text) can be found in the directory `doc'. 6. You can run some tests by make check However, some of these tests requires the usage of the PRNG or RngStreams library and are only executed if these are installed enabled by the corresponding configure flag. An extended set of tests is run by make fullcheck However some of these might fail occasionally due to roundoff errors or the mysteries of floating point arithmetic, since we have used some extreme settings to test the library. (For further targets for make and more details see the GNU generic installation instructions below.) Upgrading UNU.RAN ................. Important: UNU.RAN now relies on some aspects of IEEE 754 compliant floating point arithmetic. In particular, 1./0. and 0./0. must result in INFINITY and NaN (not a number), respectively, and must not cause a floating point exception. For almost all modern computing architecture this is implemented in hardware. For others there should be a special compiler flag to get this feature (e.g. -MIEEE on DEC alpha or -mp for the Intel C compiler). Upgrading UNU.RAN from version 0.9.x or earlier: With UNU.RAN version 1.0.x some of the macro definitions in file 'src/unuran_config.h' are moved into file 'config.h' and are set/controlled by the ./configure script. Writting logging information into the logfile must now be enabled when running the configure script: sh ./configure --enable-logging Upgrading UNU.RAN from version 0.7.x or earlier: With UNU.RAN version 0.8.x the interface for changing underlying distributions and running a reinitialization routine has been simplified. The old routines can be compiled into the library using the following configure flag: sh ./configure --enable-deprecated Notice: Using these deprecated routines is not supported any more and this strong discouraged. Wrapper functions for external sources of uniform random numbers are now enabled by configure flags and not by macros defined in file 'src/unuran_config.h'. The file 'src/unuran_config.h' is not installed any more. It is now only included when the library is compiled. It should be removed from the global include path of the compiler. ********************************************************************* * * * GNU generic installation instructions. * * * ********************************************************************* Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, a file `config.cache' that saves the results of its tests to speed up reconfiguring, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.in' is used to create `configure' by a program called `autoconf'. You only need `configure.in' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. You can give `configure' initial values for variables by setting them in the environment. Using a Bourne-compatible shell, you can do that on the command line like this: CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure Or on systems that have the `env' program, you can do it like this: env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not supports the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=PATH' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' can not figure out automatically, but needs to determine by the type of host the package will run on. Usually `configure' can figure that out, but if it prints a message saying it can not guess the host type, give it the `--host=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name with three fields: CPU-COMPANY-SYSTEM See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the host type. If you are building compiler tools for cross-compiling, you can also use the `--target=TYPE' option to select the type of system they will produce code for and the `--build=TYPE' option to select the type of system on which you are compiling the package. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Operation Controls ================== `configure' recognizes the following options to control how it operates. `--cache-file=FILE' Use and save the results of the tests in FILE instead of `./config.cache'. Set FILE to `/dev/null' to disable caching, for debugging `configure'. `--help' Print a summary of the options to `configure', and exit. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--version' Print the version of Autoconf used to generate the `configure' script, and exit. `configure' also accepts some other, not widely useful, options. unuran-1.11.0/examples/0000755001357500135600000000000014430713513011734 500000000000000unuran-1.11.0/examples/example_rngstreams.c0000644001357500135600000001112014420445767015727 00000000000000/* ------------------------------------------------------------- */ /* File: example_rngstreams.c */ /* ------------------------------------------------------------- */ #ifdef UNURAN_SUPPORTS_RNGSTREAM /* ------------------------------------------------------------- */ /* This example makes use of the RNGSTREAM library for */ /* for generating uniform random numbers. */ /* (see http://statmath.wu.ac.at/software/RngStreams/) */ /* To compile this example you must have set */ /* ./configure --with-urng-rngstream */ /* (Of course the executable has to be linked against the */ /* RNGSTREAM library.) */ /* ------------------------------------------------------------- */ /* Include UNURAN header files. */ #include #include /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; /* will hold the random number */ double fparams[2]; /* array for parameters for distribution */ /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Declare objects for uniform random number generators. */ UNUR_URNG *urng1, *urng2; /* uniform generator objects */ /* The RNGSTREAMS library sets a package seed. */ unsigned long seed[] = {111u, 222u, 333u, 444u, 555u, 666u}; RngStream_SetPackageSeed(seed); /* RngStreams only: */ /* Make a object for uniform random number generator. */ /* For details see */ /* http://statmath.wu.ac.at/software/RngStreams/ */ urng1 = unur_urng_rngstream_new("urng-1"); if (urng1 == NULL) exit (EXIT_FAILURE); /* Use a predefined standard distribution: */ /* Beta with parameters 2 and 3. */ fparams[0] = 2.; fparams[1] = 3.; distr = unur_distr_beta( fparams, 2 ); /* Choose a method: TDR. */ par = unur_tdr_new(distr); /* Set uniform generator in parameter object */ unur_set_urng( par, urng1 ); /* Create the generator object. */ gen = unur_init(par); /* Notice that this call has also destroyed the parameter */ /* object `par' as a side effect. */ /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* Now we want to switch to a different (independent) stream */ /* of uniform random numbers. */ urng2 = unur_urng_rngstream_new("urng-2"); if (urng2 == NULL) exit (EXIT_FAILURE); unur_chg_urng( gen, urng2 ); /* ... and sample again. */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); /* We also should destroy the uniform random number generators.*/ unur_urng_free(urng1); unur_urng_free(urng2); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ #else #include #include int main(void) { printf("You must enable the RNGSTREAM library to run this example!\n\n"); exit (77); /* exit code for automake check routines */ } #endif /* ------------------------------------------------------------- */ unuran-1.11.0/examples/example_mcorr.c0000644001357500135600000000440114420445767014670 00000000000000/* ------------------------------------------------------------- */ /* File: example_mcorr.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* Example how to generate random correlation matrices */ /* ------------------------------------------------------------- */ #define dim (4) int main(void) { int i,j; double M[dim*dim]; /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Create a distribution object for random correlation matrix */ distr = unur_distr_correlation( dim ); /* Choose a method: MCORR. */ par = unur_mcorr_new(distr); /* Create the generator object. */ gen = unur_init(par); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) { unur_sample_matr(gen, M); for (j=0; j /* ------------------------------------------------------------- */ /* Example how to sample from a continuous univariate */ /* distribution. */ /* */ /* We build a distribution object from scratch and sample. */ /* ------------------------------------------------------------- */ /* Define the PDF and dPDF of our distribution. */ /* */ /* Our distribution has the PDF */ /* */ /* / 1 - x*x if |x| <= 1 */ /* f(x) = < */ /* \ 0 otherwise */ /* */ /* The PDF of our distribution: */ double mypdf( double x, const UNUR_DISTR *distr ) /* The second argument (`distr') can be used for parameters */ /* for the PDF. (We do not use parameters in our example.) */ { if (fabs(x) >= 1.) return 0.; else return (1.-x*x); } /* end of mypdf() */ /* The derivative of the PDF of our distribution: */ double mydpdf( double x, const UNUR_DISTR *distr ) { if (fabs(x) >= 1.) return 0.; else return (-2.*x); } /* end of mydpdf() */ /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; /* will hold the random number */ /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Create a new distribution object from scratch. */ /* Get empty distribution object for a continuous distribution */ distr = unur_distr_cont_new(); /* Fill the distribution object -- the provided information */ /* must fulfill the requirements of the method choosen below. */ unur_distr_cont_set_pdf(distr, mypdf); /* PDF */ unur_distr_cont_set_dpdf(distr, mydpdf); /* its derivative */ unur_distr_cont_set_mode(distr, 0.); /* mode */ unur_distr_cont_set_domain(distr, -1., 1.); /* domain */ /* Choose a method: TDR. */ par = unur_tdr_new(distr); /* Set some parameters of the method TDR. */ unur_tdr_set_variant_gw(par); unur_tdr_set_max_sqhratio(par, 0.90); unur_tdr_set_c(par, -0.5); unur_tdr_set_max_intervals(par, 100); unur_tdr_set_cpoints(par, 10, NULL); /* Create the generator object. */ gen = unur_init(par); /* Notice that this call has also destroyed the parameter */ /* object `par' as a side effect. */ /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/examples/example_mixt_inv.c0000644001357500135600000000610514420445767015406 00000000000000/* ------------------------------------------------------------- */ /* File: example_mixt_inv.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* Mixture of truncated Gaussian on (-INFINITY,0] and */ /* Exponential distribution on [0,INFINITY) */ /* ------------------------------------------------------------- */ int main(void) { /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *comp[2]; /* array of generator objects (components)*/ UNUR_GEN *gen; /* generator object for mixture */ double prob[2]; /* array of probabilities */ int i; /* loop variable */ double x; /* will hold the random number */ /* Create generators for components */ distr = unur_distr_normal(NULL,0); /* Gaussian distribution */ unur_distr_cont_set_domain(distr,-UNUR_INFINITY,0); par = unur_pinv_new(distr); /* choose method PINV */ comp[0] = unur_init(par); /* initialize */ unur_distr_free(distr); /* free distribution obj. */ distr = unur_distr_exponential(NULL,0); /* Exponential distr. */ par = unur_pinv_new(distr); /* choose method PINV */ comp[1] = unur_init(par); /* initialize */ unur_distr_free(distr); /* free distribution obj. */ /* Probabilities for components (need not sum to 1) */ prob[0] = 0.4; prob[1] = 0.3; /* Create mixture */ par = unur_mixt_new(2,prob,comp); /* We want to use inversion for the mixture as well. */ /* (Thus the above order of the components is important!) */ unur_mixt_set_useinversion(par,TRUE); /* Initialize generator object */ gen = unur_init(par); /* we do not need the components any more */ for (i=0; i<2; i++) unur_free(comp[i]); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/examples/example_prng.c0000644001357500135600000001075114420445767014521 00000000000000/* ------------------------------------------------------------- */ /* File: example_prng.c */ /* ------------------------------------------------------------- */ #ifdef UNURAN_SUPPORTS_PRNG /* ------------------------------------------------------------- */ /* This example makes use of the PRNG library for generating */ /* uniform random numbers. */ /* (see http://statmath.wu.ac.at/prng/) */ /* To compile this example you must have set */ /* ./configure --with-urng-prng */ /* (Of course the executable has to be linked against the */ /* PRNG library.) */ /* ------------------------------------------------------------- */ /* Include UNURAN header files. */ #include #include /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; /* will hold the random number */ double fparams[2]; /* array for parameters for distribution */ /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Declare objects for uniform random number generators. */ UNUR_URNG *urng1, *urng2; /* uniform generator objects */ /* PRNG only: */ /* Make a object for uniform random number generator. */ /* For details see http://statmath.wu.ac.at/prng/ */ /* We use the Mersenne Twister. */ urng1 = unur_urng_prng_new("mt19937(1237)"); if (urng1 == NULL) exit (EXIT_FAILURE); /* Use a predefined standard distribution: */ /* Beta with parameters 2 and 3. */ fparams[0] = 2.; fparams[1] = 3.; distr = unur_distr_beta( fparams, 2 ); /* Choose a method: TDR. */ par = unur_tdr_new(distr); /* Set uniform generator in parameter object */ unur_set_urng( par, urng1 ); /* Create the generator object. */ gen = unur_init(par); /* Notice that this call has also destroyed the parameter */ /* object `par' as a side effect. */ /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* Now we want to switch to a different uniform random number */ /* generator. */ /* Now we use an ICG (Inversive Congruental Generator). */ urng2 = unur_urng_prng_new("icg(2147483647,1,1,0)"); if (urng2 == NULL) exit (EXIT_FAILURE); unur_chg_urng( gen, urng2 ); /* ... and sample again. */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); /* We also should destroy the uniform random number generators.*/ unur_urng_free(urng1); unur_urng_free(urng2); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ #else #include #include int main(void) { printf("You must enable the PRNG library to run this example!\n\n"); exit (77); /* exit code for automake check routines */ } #endif /* ------------------------------------------------------------- */ unuran-1.11.0/examples/example_dext.c0000644001357500135600000001074214420445767014517 00000000000000/* ------------------------------------------------------------- */ /* File: example_dext.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* This example shows how an external generator for the */ /* geometric distribution can be used within the UNURAN */ /* framework. */ /* */ /* Notice, that this example does not provide the simplest */ /* solution. */ /* ------------------------------------------------------------- */ /* Initialization routine. */ /* */ /* Here we simply read the parameter of the geometric */ /* distribution and store it in an array for parameters of */ /* the external generator. */ /* [ Of course we could do this in the sampling routine as */ /* and avoid the necessity of this initialization routine. ] */ int geometric_init (UNUR_GEN *gen) { /* Get pointer to parameters of geometric distribution */ double *params = unur_dext_get_distrparams(gen); /* The parameter is the first entry (see manual) */ double p = params[0]; /* Get array to store this parameter for external generator */ double *genpar = unur_dext_get_params(gen, sizeof(double)); genpar[0] = p; /* Executed successfully */ return UNUR_SUCCESS; } /* ------------------------------------------------------------- */ /* Sampling routine. */ /* */ /* Contains the code for the external generator. */ int geometric_sample (UNUR_GEN *gen) { /* Get scale parameter */ double *genpar = unur_dext_get_params(gen,0); double p = genpar[0]; /* Sample a uniformly distributed random number */ double U = unur_sample_urng(gen); /* Transform into geometrically distributed random variate */ return ( (int) (log(U) / log(1.-p)) ); } /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ int K; /* will hold the random number */ /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Use predefined geometric distribution with parameter 1/10 */ double fpar[1] = { 0.1 }; distr = unur_distr_geometric(fpar, 1); /* Use method DEXT */ par = unur_dext_new(distr); /* Set initialization and sampling routines. */ unur_dext_set_init(par, geometric_init); unur_dext_set_sample(par, geometric_sample); /* Create the generator object. */ gen = unur_init(par); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the standard Gaussian distribution. */ /* Eg.: */ for (i=0; i<10; i++) { K = unur_sample_discr(gen); printf("%d\n",K); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/examples/example_FuncStr.c0000644001357500135600000000232614420304141015112 00000000000000/* ------------------------------------------------------------- */ /* File: example_FuncStr.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* Example how to define the PDF for a continuous univariate */ /* distribution using a function string. */ /* ------------------------------------------------------------- */ int main(void) { UNUR_DISTR *distr; /* distribution object */ char *pdfstr; /* Get empty distribution object for a continuous distribution */ distr = unur_distr_cont_new(); /* Set PDF using function string */ unur_distr_cont_set_pdfstr(distr,"1-x*x"); unur_distr_cont_set_domain(distr,-1.,1.); /* Read function string from distribution object */ pdfstr = unur_distr_cont_get_pdfstr(distr); printf("functionstring: %s\n",pdfstr); /* Destroy distribution object and clear memory */ unur_distr_free(distr); free (pdfstr); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/examples/Makefile.in0000644001357500135600000017471314430713360013736 00000000000000# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ check_PROGRAMS = $(am__EXEEXT_1) TESTS = $(am__EXEEXT_1) subdir = examples ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__EXEEXT_1 = example0$(EXEEXT) example0_str$(EXEEXT) \ example1$(EXEEXT) example1_str$(EXEEXT) example2$(EXEEXT) \ example2_str$(EXEEXT) example3$(EXEEXT) example3_str$(EXEEXT) \ example_reinit$(EXEEXT) example_cext$(EXEEXT) \ example_cont$(EXEEXT) example_cont_str$(EXEEXT) \ example_dext$(EXEEXT) example_discr$(EXEEXT) \ example_discr_str$(EXEEXT) example_emp$(EXEEXT) \ example_emp_str$(EXEEXT) example_vemp$(EXEEXT) \ example_FuncStr$(EXEEXT) example_mcorr$(EXEEXT) \ example_mixt$(EXEEXT) example_mixt_inv$(EXEEXT) \ example_cpp$(EXEEXT) example_gsl$(EXEEXT) \ example_rngstreams$(EXEEXT) example_prng$(EXEEXT) \ example_prng_str$(EXEEXT) example_anti$(EXEEXT) \ example_anti_str$(EXEEXT) example_errorhandler$(EXEEXT) example0_SOURCES = example0.c example0_OBJECTS = example0.$(OBJEXT) example0_LDADD = $(LDADD) example0_DEPENDENCIES = $(top_builddir)/src/libunuran.la AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = example0_str_SOURCES = example0_str.c example0_str_OBJECTS = example0_str.$(OBJEXT) example0_str_LDADD = $(LDADD) example0_str_DEPENDENCIES = $(top_builddir)/src/libunuran.la example1_SOURCES = example1.c example1_OBJECTS = example1.$(OBJEXT) example1_LDADD = $(LDADD) example1_DEPENDENCIES = $(top_builddir)/src/libunuran.la example1_str_SOURCES = example1_str.c example1_str_OBJECTS = example1_str.$(OBJEXT) example1_str_LDADD = $(LDADD) example1_str_DEPENDENCIES = $(top_builddir)/src/libunuran.la example2_SOURCES = example2.c example2_OBJECTS = example2.$(OBJEXT) example2_LDADD = $(LDADD) example2_DEPENDENCIES = $(top_builddir)/src/libunuran.la example2_str_SOURCES = example2_str.c example2_str_OBJECTS = example2_str.$(OBJEXT) example2_str_LDADD = $(LDADD) example2_str_DEPENDENCIES = $(top_builddir)/src/libunuran.la example3_SOURCES = example3.c example3_OBJECTS = example3.$(OBJEXT) example3_LDADD = $(LDADD) example3_DEPENDENCIES = $(top_builddir)/src/libunuran.la example3_str_SOURCES = example3_str.c example3_str_OBJECTS = example3_str.$(OBJEXT) example3_str_LDADD = $(LDADD) example3_str_DEPENDENCIES = $(top_builddir)/src/libunuran.la example_FuncStr_SOURCES = example_FuncStr.c example_FuncStr_OBJECTS = example_FuncStr.$(OBJEXT) example_FuncStr_LDADD = $(LDADD) example_FuncStr_DEPENDENCIES = $(top_builddir)/src/libunuran.la example_anti_SOURCES = example_anti.c example_anti_OBJECTS = example_anti.$(OBJEXT) example_anti_LDADD = $(LDADD) example_anti_DEPENDENCIES = $(top_builddir)/src/libunuran.la example_anti_str_SOURCES = example_anti_str.c example_anti_str_OBJECTS = example_anti_str.$(OBJEXT) example_anti_str_LDADD = $(LDADD) example_anti_str_DEPENDENCIES = $(top_builddir)/src/libunuran.la example_cext_SOURCES = example_cext.c example_cext_OBJECTS = example_cext.$(OBJEXT) example_cext_LDADD = $(LDADD) example_cext_DEPENDENCIES = $(top_builddir)/src/libunuran.la example_cont_SOURCES = example_cont.c example_cont_OBJECTS = example_cont.$(OBJEXT) example_cont_LDADD = $(LDADD) example_cont_DEPENDENCIES = $(top_builddir)/src/libunuran.la example_cont_str_SOURCES = example_cont_str.c example_cont_str_OBJECTS = example_cont_str.$(OBJEXT) example_cont_str_LDADD = $(LDADD) example_cont_str_DEPENDENCIES = $(top_builddir)/src/libunuran.la am_example_cpp_OBJECTS = example_cpp.$(OBJEXT) example_cpp_OBJECTS = $(am_example_cpp_OBJECTS) example_cpp_LDADD = $(LDADD) example_cpp_DEPENDENCIES = $(top_builddir)/src/libunuran.la example_dext_SOURCES = example_dext.c example_dext_OBJECTS = example_dext.$(OBJEXT) example_dext_LDADD = $(LDADD) example_dext_DEPENDENCIES = $(top_builddir)/src/libunuran.la example_discr_SOURCES = example_discr.c example_discr_OBJECTS = example_discr.$(OBJEXT) example_discr_LDADD = $(LDADD) example_discr_DEPENDENCIES = $(top_builddir)/src/libunuran.la example_discr_str_SOURCES = example_discr_str.c example_discr_str_OBJECTS = example_discr_str.$(OBJEXT) example_discr_str_LDADD = $(LDADD) example_discr_str_DEPENDENCIES = $(top_builddir)/src/libunuran.la example_emp_SOURCES = example_emp.c example_emp_OBJECTS = example_emp.$(OBJEXT) example_emp_LDADD = $(LDADD) example_emp_DEPENDENCIES = $(top_builddir)/src/libunuran.la example_emp_str_SOURCES = example_emp_str.c example_emp_str_OBJECTS = example_emp_str.$(OBJEXT) example_emp_str_LDADD = $(LDADD) example_emp_str_DEPENDENCIES = $(top_builddir)/src/libunuran.la example_errorhandler_SOURCES = example_errorhandler.c example_errorhandler_OBJECTS = example_errorhandler.$(OBJEXT) example_errorhandler_LDADD = $(LDADD) example_errorhandler_DEPENDENCIES = $(top_builddir)/src/libunuran.la example_gsl_SOURCES = example_gsl.c example_gsl_OBJECTS = example_gsl.$(OBJEXT) example_gsl_LDADD = $(LDADD) example_gsl_DEPENDENCIES = $(top_builddir)/src/libunuran.la example_mcorr_SOURCES = example_mcorr.c example_mcorr_OBJECTS = example_mcorr.$(OBJEXT) example_mcorr_LDADD = $(LDADD) example_mcorr_DEPENDENCIES = $(top_builddir)/src/libunuran.la example_mixt_SOURCES = example_mixt.c example_mixt_OBJECTS = example_mixt.$(OBJEXT) example_mixt_LDADD = $(LDADD) example_mixt_DEPENDENCIES = $(top_builddir)/src/libunuran.la example_mixt_inv_SOURCES = example_mixt_inv.c example_mixt_inv_OBJECTS = example_mixt_inv.$(OBJEXT) example_mixt_inv_LDADD = $(LDADD) example_mixt_inv_DEPENDENCIES = $(top_builddir)/src/libunuran.la example_prng_SOURCES = example_prng.c example_prng_OBJECTS = example_prng.$(OBJEXT) example_prng_LDADD = $(LDADD) example_prng_DEPENDENCIES = $(top_builddir)/src/libunuran.la example_prng_str_SOURCES = example_prng_str.c example_prng_str_OBJECTS = example_prng_str.$(OBJEXT) example_prng_str_LDADD = $(LDADD) example_prng_str_DEPENDENCIES = $(top_builddir)/src/libunuran.la example_reinit_SOURCES = example_reinit.c example_reinit_OBJECTS = example_reinit.$(OBJEXT) example_reinit_LDADD = $(LDADD) example_reinit_DEPENDENCIES = $(top_builddir)/src/libunuran.la example_rngstreams_SOURCES = example_rngstreams.c example_rngstreams_OBJECTS = example_rngstreams.$(OBJEXT) example_rngstreams_LDADD = $(LDADD) example_rngstreams_DEPENDENCIES = $(top_builddir)/src/libunuran.la example_vemp_SOURCES = example_vemp.c example_vemp_OBJECTS = example_vemp.$(OBJEXT) example_vemp_LDADD = $(LDADD) example_vemp_DEPENDENCIES = $(top_builddir)/src/libunuran.la AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/example0.Po \ ./$(DEPDIR)/example0_str.Po ./$(DEPDIR)/example1.Po \ ./$(DEPDIR)/example1_str.Po ./$(DEPDIR)/example2.Po \ ./$(DEPDIR)/example2_str.Po ./$(DEPDIR)/example3.Po \ ./$(DEPDIR)/example3_str.Po ./$(DEPDIR)/example_FuncStr.Po \ ./$(DEPDIR)/example_anti.Po ./$(DEPDIR)/example_anti_str.Po \ ./$(DEPDIR)/example_cext.Po ./$(DEPDIR)/example_cont.Po \ ./$(DEPDIR)/example_cont_str.Po ./$(DEPDIR)/example_cpp.Po \ ./$(DEPDIR)/example_dext.Po ./$(DEPDIR)/example_discr.Po \ ./$(DEPDIR)/example_discr_str.Po ./$(DEPDIR)/example_emp.Po \ ./$(DEPDIR)/example_emp_str.Po \ ./$(DEPDIR)/example_errorhandler.Po ./$(DEPDIR)/example_gsl.Po \ ./$(DEPDIR)/example_mcorr.Po ./$(DEPDIR)/example_mixt.Po \ ./$(DEPDIR)/example_mixt_inv.Po ./$(DEPDIR)/example_prng.Po \ ./$(DEPDIR)/example_prng_str.Po ./$(DEPDIR)/example_reinit.Po \ ./$(DEPDIR)/example_rngstreams.Po ./$(DEPDIR)/example_vemp.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_@AM_V@) am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) am__v_CXX_0 = @echo " CXX " $@; am__v_CXX_1 = CXXLD = $(CXX) CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) am__v_CXXLD_0 = @echo " CXXLD " $@; am__v_CXXLD_1 = SOURCES = example0.c example0_str.c example1.c example1_str.c \ example2.c example2_str.c example3.c example3_str.c \ example_FuncStr.c example_anti.c example_anti_str.c \ example_cext.c example_cont.c example_cont_str.c \ $(example_cpp_SOURCES) example_dext.c example_discr.c \ example_discr_str.c example_emp.c example_emp_str.c \ example_errorhandler.c example_gsl.c example_mcorr.c \ example_mixt.c example_mixt_inv.c example_prng.c \ example_prng_str.c example_reinit.c example_rngstreams.c \ example_vemp.c DIST_SOURCES = example0.c example0_str.c example1.c example1_str.c \ example2.c example2_str.c example3.c example3_str.c \ example_FuncStr.c example_anti.c example_anti_str.c \ example_cext.c example_cont.c example_cont_str.c \ $(example_cpp_SOURCES) example_dext.c example_discr.c \ example_discr_str.c example_emp.c example_emp_str.c \ example_errorhandler.c example_gsl.c example_mcorr.c \ example_mixt.c example_mixt_inv.c example_prng.c \ example_prng_str.c example_reinit.c example_rngstreams.c \ example_vemp.c am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` am__tty_colors_dummy = \ mgn= red= grn= lgn= blu= brg= std=; \ am__color_tests=no am__tty_colors = { \ $(am__tty_colors_dummy); \ if test "X$(AM_COLOR_TESTS)" = Xno; then \ am__color_tests=no; \ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ am__color_tests=yes; \ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ am__color_tests=yes; \ fi; \ if test $$am__color_tests = yes; then \ red=''; \ grn=''; \ lgn=''; \ blu=''; \ mgn=''; \ brg=''; \ std=''; \ fi; \ } am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__recheck_rx = ^[ ]*:recheck:[ ]* am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* # A command that, given a newline-separated list of test names on the # standard input, print the name of the tests that are to be re-run # upon "make recheck". am__list_recheck_tests = $(AWK) '{ \ recheck = 1; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ { \ if ((getline line2 < ($$0 ".log")) < 0) \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ { \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ { \ break; \ } \ }; \ if (recheck) \ print $$0; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # A command that, given a newline-separated list of test names on the # standard input, create the global log from their .trs and .log files. am__create_global_log = $(AWK) ' \ function fatal(msg) \ { \ print "fatal: making $@: " msg | "cat >&2"; \ exit 1; \ } \ function rst_section(header) \ { \ print header; \ len = length(header); \ for (i = 1; i <= len; i = i + 1) \ printf "="; \ printf "\n\n"; \ } \ { \ copy_in_global_log = 1; \ global_test_result = "RUN"; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".trs"); \ if (line ~ /$(am__global_test_result_rx)/) \ { \ sub("$(am__global_test_result_rx)", "", line); \ sub("[ ]*$$", "", line); \ global_test_result = line; \ } \ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ copy_in_global_log = 0; \ }; \ if (copy_in_global_log) \ { \ rst_section(global_test_result ": " $$0); \ while ((rc = (getline line < ($$0 ".log"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".log"); \ print line; \ }; \ printf "\n"; \ }; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # Restructured Text title. am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } # Solaris 10 'make', and several other traditional 'make' implementations, # pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it # by disabling -e (using the XSI extension "set +e") if it's set. am__sh_e_setup = case $$- in *e*) set +e;; esac # Default flags passed to test drivers. am__common_driver_flags = \ --color-tests "$$am__color_tests" \ --enable-hard-errors "$$am__enable_hard_errors" \ --expect-failure "$$am__expect_failure" # To be inserted before the command running the test. Creates the # directory for the log if needed. Stores in $dir the directory # containing $f, in $tst the test, in $log the log. Executes the # developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and # passes TESTS_ENVIRONMENT. Set up options for the wrapper that # will run the test scripts (or their associated LOG_COMPILER, if # thy have one). am__check_pre = \ $(am__sh_e_setup); \ $(am__vpath_adj_setup) $(am__vpath_adj) \ $(am__tty_colors); \ srcdir=$(srcdir); export srcdir; \ case "$@" in \ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ *) am__odir=.;; \ esac; \ test "x$$am__odir" = x"." || test -d "$$am__odir" \ || $(MKDIR_P) "$$am__odir" || exit $$?; \ if test -f "./$$f"; then dir=./; \ elif test -f "$$f"; then dir=; \ else dir="$(srcdir)/"; fi; \ tst=$$dir$$f; log='$@'; \ if test -n '$(DISABLE_HARD_ERRORS)'; then \ am__enable_hard_errors=no; \ else \ am__enable_hard_errors=yes; \ fi; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ am__expect_failure=yes;; \ *) \ am__expect_failure=no;; \ esac; \ $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) # A shell command to get the names of the tests scripts with any registered # extension removed (i.e., equivalently, the names of the test logs, with # the '.log' extension removed). The result is saved in the shell variable # '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, # we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", # since that might cause problem with VPATH rewrites for suffix-less tests. # See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. am__set_TESTS_bases = \ bases='$(TEST_LOGS)'; \ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ bases=`echo $$bases` AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING)' RECHECK_LOGS = $(TEST_LOGS) AM_RECURSIVE_TARGETS = check recheck TEST_SUITE_LOG = test-suite.log TEST_EXTENSIONS = @EXEEXT@ .test LOG_DRIVER = $(SHELL) $(top_srcdir)/autoconf/test-driver LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) am__set_b = \ case '$@' in \ */*) \ case '$*' in \ */*) b='$*';; \ *) b=`echo '$@' | sed 's/\.log$$//'`; \ esac;; \ *) \ b='$*';; \ esac am__test_logs1 = $(TESTS:=.log) am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) TEST_LOGS = $(am__test_logs2:.test.log=.log) TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/autoconf/test-driver TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ $(TEST_LOG_FLAGS) am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autoconf/depcomp \ $(top_srcdir)/autoconf/test-driver DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILECMD = @FILECMD@ GREP = @GREP@ HAVE_DIVIDE_BY_ZERO = @HAVE_DIVIDE_BY_ZERO@ HAVE_IEEE_COMPARISONS = @HAVE_IEEE_COMPARISONS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNURAN_LT_VERSION = @UNURAN_LT_VERSION@ UNURAN_SUPPORTS_GSL = @UNURAN_SUPPORTS_GSL@ UNURAN_SUPPORTS_PRNG = @UNURAN_SUPPORTS_PRNG@ UNURAN_SUPPORTS_RNGSTREAM = @UNURAN_SUPPORTS_RNGSTREAM@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ have_valgrind = @have_valgrind@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = \ $(UNURAN_SUPPORTS_GSL) \ $(UNURAN_SUPPORTS_PRNG) \ $(UNURAN_SUPPORTS_RNGSTREAM) \ -I$(top_srcdir)/src \ -I$(top_srcdir)/src/uniform AM_LDFLAGS = \ -L$(top_builddir)/src LDADD = \ $(top_builddir)/src/libunuran.la EXAMPLES = \ example0 example0_str \ example1 example1_str \ example2 example2_str \ example3 example3_str \ example_reinit \ example_cext \ example_cont example_cont_str \ example_dext \ example_discr example_discr_str \ example_emp example_emp_str \ example_vemp \ example_FuncStr \ example_mcorr \ example_mixt example_mixt_inv \ example_cpp \ example_gsl \ example_rngstreams \ example_prng example_prng_str \ example_anti example_anti_str \ example_errorhandler example_cpp_SOURCES = example_cpp.cpp # clean log files and backup files CLEANFILES = \ unuran.log \ valgrind-* \ *~ # clean generated files MAINTAINERCLEANFILES = \ Makefile.in all: all-am .SUFFIXES: .SUFFIXES: .c .cpp .lo .log .o .obj .test .test$(EXEEXT) .trs $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign examples/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign examples/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list example0$(EXEEXT): $(example0_OBJECTS) $(example0_DEPENDENCIES) $(EXTRA_example0_DEPENDENCIES) @rm -f example0$(EXEEXT) $(AM_V_CCLD)$(LINK) $(example0_OBJECTS) $(example0_LDADD) $(LIBS) example0_str$(EXEEXT): $(example0_str_OBJECTS) $(example0_str_DEPENDENCIES) $(EXTRA_example0_str_DEPENDENCIES) @rm -f example0_str$(EXEEXT) $(AM_V_CCLD)$(LINK) $(example0_str_OBJECTS) $(example0_str_LDADD) $(LIBS) example1$(EXEEXT): $(example1_OBJECTS) $(example1_DEPENDENCIES) $(EXTRA_example1_DEPENDENCIES) @rm -f example1$(EXEEXT) $(AM_V_CCLD)$(LINK) $(example1_OBJECTS) $(example1_LDADD) $(LIBS) example1_str$(EXEEXT): $(example1_str_OBJECTS) $(example1_str_DEPENDENCIES) $(EXTRA_example1_str_DEPENDENCIES) @rm -f example1_str$(EXEEXT) $(AM_V_CCLD)$(LINK) $(example1_str_OBJECTS) $(example1_str_LDADD) $(LIBS) example2$(EXEEXT): $(example2_OBJECTS) $(example2_DEPENDENCIES) $(EXTRA_example2_DEPENDENCIES) @rm -f example2$(EXEEXT) $(AM_V_CCLD)$(LINK) $(example2_OBJECTS) $(example2_LDADD) $(LIBS) example2_str$(EXEEXT): $(example2_str_OBJECTS) $(example2_str_DEPENDENCIES) $(EXTRA_example2_str_DEPENDENCIES) @rm -f example2_str$(EXEEXT) $(AM_V_CCLD)$(LINK) $(example2_str_OBJECTS) $(example2_str_LDADD) $(LIBS) example3$(EXEEXT): $(example3_OBJECTS) $(example3_DEPENDENCIES) $(EXTRA_example3_DEPENDENCIES) @rm -f example3$(EXEEXT) $(AM_V_CCLD)$(LINK) $(example3_OBJECTS) $(example3_LDADD) $(LIBS) example3_str$(EXEEXT): $(example3_str_OBJECTS) $(example3_str_DEPENDENCIES) $(EXTRA_example3_str_DEPENDENCIES) @rm -f example3_str$(EXEEXT) $(AM_V_CCLD)$(LINK) $(example3_str_OBJECTS) $(example3_str_LDADD) $(LIBS) example_FuncStr$(EXEEXT): $(example_FuncStr_OBJECTS) $(example_FuncStr_DEPENDENCIES) $(EXTRA_example_FuncStr_DEPENDENCIES) @rm -f example_FuncStr$(EXEEXT) $(AM_V_CCLD)$(LINK) $(example_FuncStr_OBJECTS) $(example_FuncStr_LDADD) $(LIBS) example_anti$(EXEEXT): $(example_anti_OBJECTS) $(example_anti_DEPENDENCIES) $(EXTRA_example_anti_DEPENDENCIES) @rm -f example_anti$(EXEEXT) $(AM_V_CCLD)$(LINK) $(example_anti_OBJECTS) $(example_anti_LDADD) $(LIBS) example_anti_str$(EXEEXT): $(example_anti_str_OBJECTS) $(example_anti_str_DEPENDENCIES) $(EXTRA_example_anti_str_DEPENDENCIES) @rm -f example_anti_str$(EXEEXT) $(AM_V_CCLD)$(LINK) $(example_anti_str_OBJECTS) $(example_anti_str_LDADD) $(LIBS) example_cext$(EXEEXT): $(example_cext_OBJECTS) $(example_cext_DEPENDENCIES) $(EXTRA_example_cext_DEPENDENCIES) @rm -f example_cext$(EXEEXT) $(AM_V_CCLD)$(LINK) $(example_cext_OBJECTS) $(example_cext_LDADD) $(LIBS) example_cont$(EXEEXT): $(example_cont_OBJECTS) $(example_cont_DEPENDENCIES) $(EXTRA_example_cont_DEPENDENCIES) @rm -f example_cont$(EXEEXT) $(AM_V_CCLD)$(LINK) $(example_cont_OBJECTS) $(example_cont_LDADD) $(LIBS) example_cont_str$(EXEEXT): $(example_cont_str_OBJECTS) $(example_cont_str_DEPENDENCIES) $(EXTRA_example_cont_str_DEPENDENCIES) @rm -f example_cont_str$(EXEEXT) $(AM_V_CCLD)$(LINK) $(example_cont_str_OBJECTS) $(example_cont_str_LDADD) $(LIBS) example_cpp$(EXEEXT): $(example_cpp_OBJECTS) $(example_cpp_DEPENDENCIES) $(EXTRA_example_cpp_DEPENDENCIES) @rm -f example_cpp$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(example_cpp_OBJECTS) $(example_cpp_LDADD) $(LIBS) example_dext$(EXEEXT): $(example_dext_OBJECTS) $(example_dext_DEPENDENCIES) $(EXTRA_example_dext_DEPENDENCIES) @rm -f example_dext$(EXEEXT) $(AM_V_CCLD)$(LINK) $(example_dext_OBJECTS) $(example_dext_LDADD) $(LIBS) example_discr$(EXEEXT): $(example_discr_OBJECTS) $(example_discr_DEPENDENCIES) $(EXTRA_example_discr_DEPENDENCIES) @rm -f example_discr$(EXEEXT) $(AM_V_CCLD)$(LINK) $(example_discr_OBJECTS) $(example_discr_LDADD) $(LIBS) example_discr_str$(EXEEXT): $(example_discr_str_OBJECTS) $(example_discr_str_DEPENDENCIES) $(EXTRA_example_discr_str_DEPENDENCIES) @rm -f example_discr_str$(EXEEXT) $(AM_V_CCLD)$(LINK) $(example_discr_str_OBJECTS) $(example_discr_str_LDADD) $(LIBS) example_emp$(EXEEXT): $(example_emp_OBJECTS) $(example_emp_DEPENDENCIES) $(EXTRA_example_emp_DEPENDENCIES) @rm -f example_emp$(EXEEXT) $(AM_V_CCLD)$(LINK) $(example_emp_OBJECTS) $(example_emp_LDADD) $(LIBS) example_emp_str$(EXEEXT): $(example_emp_str_OBJECTS) $(example_emp_str_DEPENDENCIES) $(EXTRA_example_emp_str_DEPENDENCIES) @rm -f example_emp_str$(EXEEXT) $(AM_V_CCLD)$(LINK) $(example_emp_str_OBJECTS) $(example_emp_str_LDADD) $(LIBS) example_errorhandler$(EXEEXT): $(example_errorhandler_OBJECTS) $(example_errorhandler_DEPENDENCIES) $(EXTRA_example_errorhandler_DEPENDENCIES) @rm -f example_errorhandler$(EXEEXT) $(AM_V_CCLD)$(LINK) $(example_errorhandler_OBJECTS) $(example_errorhandler_LDADD) $(LIBS) example_gsl$(EXEEXT): $(example_gsl_OBJECTS) $(example_gsl_DEPENDENCIES) $(EXTRA_example_gsl_DEPENDENCIES) @rm -f example_gsl$(EXEEXT) $(AM_V_CCLD)$(LINK) $(example_gsl_OBJECTS) $(example_gsl_LDADD) $(LIBS) example_mcorr$(EXEEXT): $(example_mcorr_OBJECTS) $(example_mcorr_DEPENDENCIES) $(EXTRA_example_mcorr_DEPENDENCIES) @rm -f example_mcorr$(EXEEXT) $(AM_V_CCLD)$(LINK) $(example_mcorr_OBJECTS) $(example_mcorr_LDADD) $(LIBS) example_mixt$(EXEEXT): $(example_mixt_OBJECTS) $(example_mixt_DEPENDENCIES) $(EXTRA_example_mixt_DEPENDENCIES) @rm -f example_mixt$(EXEEXT) $(AM_V_CCLD)$(LINK) $(example_mixt_OBJECTS) $(example_mixt_LDADD) $(LIBS) example_mixt_inv$(EXEEXT): $(example_mixt_inv_OBJECTS) $(example_mixt_inv_DEPENDENCIES) $(EXTRA_example_mixt_inv_DEPENDENCIES) @rm -f example_mixt_inv$(EXEEXT) $(AM_V_CCLD)$(LINK) $(example_mixt_inv_OBJECTS) $(example_mixt_inv_LDADD) $(LIBS) example_prng$(EXEEXT): $(example_prng_OBJECTS) $(example_prng_DEPENDENCIES) $(EXTRA_example_prng_DEPENDENCIES) @rm -f example_prng$(EXEEXT) $(AM_V_CCLD)$(LINK) $(example_prng_OBJECTS) $(example_prng_LDADD) $(LIBS) example_prng_str$(EXEEXT): $(example_prng_str_OBJECTS) $(example_prng_str_DEPENDENCIES) $(EXTRA_example_prng_str_DEPENDENCIES) @rm -f example_prng_str$(EXEEXT) $(AM_V_CCLD)$(LINK) $(example_prng_str_OBJECTS) $(example_prng_str_LDADD) $(LIBS) example_reinit$(EXEEXT): $(example_reinit_OBJECTS) $(example_reinit_DEPENDENCIES) $(EXTRA_example_reinit_DEPENDENCIES) @rm -f example_reinit$(EXEEXT) $(AM_V_CCLD)$(LINK) $(example_reinit_OBJECTS) $(example_reinit_LDADD) $(LIBS) example_rngstreams$(EXEEXT): $(example_rngstreams_OBJECTS) $(example_rngstreams_DEPENDENCIES) $(EXTRA_example_rngstreams_DEPENDENCIES) @rm -f example_rngstreams$(EXEEXT) $(AM_V_CCLD)$(LINK) $(example_rngstreams_OBJECTS) $(example_rngstreams_LDADD) $(LIBS) example_vemp$(EXEEXT): $(example_vemp_OBJECTS) $(example_vemp_DEPENDENCIES) $(EXTRA_example_vemp_DEPENDENCIES) @rm -f example_vemp$(EXEEXT) $(AM_V_CCLD)$(LINK) $(example_vemp_OBJECTS) $(example_vemp_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example0.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example0_str.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example1.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example1_str.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example2.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example2_str.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example3.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example3_str.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example_FuncStr.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example_anti.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example_anti_str.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example_cext.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example_cont.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example_cont_str.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example_cpp.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example_dext.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example_discr.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example_discr_str.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example_emp.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example_emp_str.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example_errorhandler.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example_gsl.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example_mcorr.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example_mixt.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example_mixt_inv.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example_prng.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example_prng_str.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example_reinit.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example_rngstreams.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example_vemp.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< .cpp.o: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< .cpp.obj: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cpp.lo: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags # Recover from deleted '.trs' file; this should ensure that # "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create # both 'foo.log' and 'foo.trs'. Break the recipe in two subshells # to avoid problems with "make -n". .log.trs: rm -f $< $@ $(MAKE) $(AM_MAKEFLAGS) $< # Leading 'am--fnord' is there to ensure the list of targets does not # expand to empty, as could happen e.g. with make check TESTS=''. am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) am--force-recheck: @: $(TEST_SUITE_LOG): $(TEST_LOGS) @$(am__set_TESTS_bases); \ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ redo_bases=`for i in $$bases; do \ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ done`; \ if test -n "$$redo_bases"; then \ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ if $(am__make_dryrun); then :; else \ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ fi; \ fi; \ if test -n "$$am__remaking_logs"; then \ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ "recursion detected" >&2; \ elif test -n "$$redo_logs"; then \ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ fi; \ if $(am__make_dryrun); then :; else \ st=0; \ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ for i in $$redo_bases; do \ test -f $$i.trs && test -r $$i.trs \ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ test -f $$i.log && test -r $$i.log \ || { echo "$$errmsg $$i.log" >&2; st=1; }; \ done; \ test $$st -eq 0 || exit 1; \ fi @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ ws='[ ]'; \ results=`for b in $$bases; do echo $$b.trs; done`; \ test -n "$$results" || results=/dev/null; \ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ if test `expr $$fail + $$xpass + $$error` -eq 0; then \ success=true; \ else \ success=false; \ fi; \ br='==================='; br=$$br$$br$$br$$br; \ result_count () \ { \ if test x"$$1" = x"--maybe-color"; then \ maybe_colorize=yes; \ elif test x"$$1" = x"--no-color"; then \ maybe_colorize=no; \ else \ echo "$@: invalid 'result_count' usage" >&2; exit 4; \ fi; \ shift; \ desc=$$1 count=$$2; \ if test $$maybe_colorize = yes && test $$count -gt 0; then \ color_start=$$3 color_end=$$std; \ else \ color_start= color_end=; \ fi; \ echo "$${color_start}# $$desc $$count$${color_end}"; \ }; \ create_testsuite_report () \ { \ result_count $$1 "TOTAL:" $$all "$$brg"; \ result_count $$1 "PASS: " $$pass "$$grn"; \ result_count $$1 "SKIP: " $$skip "$$blu"; \ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ result_count $$1 "FAIL: " $$fail "$$red"; \ result_count $$1 "XPASS:" $$xpass "$$red"; \ result_count $$1 "ERROR:" $$error "$$mgn"; \ }; \ { \ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ $(am__rst_title); \ create_testsuite_report --no-color; \ echo; \ echo ".. contents:: :depth: 2"; \ echo; \ for b in $$bases; do echo $$b; done \ | $(am__create_global_log); \ } >$(TEST_SUITE_LOG).tmp || exit 1; \ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ if $$success; then \ col="$$grn"; \ else \ col="$$red"; \ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ fi; \ echo "$${col}$$br$${std}"; \ echo "$${col}Testsuite summary"$(AM_TESTSUITE_SUMMARY_HEADER)"$${std}"; \ echo "$${col}$$br$${std}"; \ create_testsuite_report --maybe-color; \ echo "$$col$$br$$std"; \ if $$success; then :; else \ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ if test -n "$(PACKAGE_BUGREPORT)"; then \ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ fi; \ echo "$$col$$br$$std"; \ fi; \ $$success || exit 1 check-TESTS: $(check_PROGRAMS) @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ log_list=`for i in $$bases; do echo $$i.log; done`; \ trs_list=`for i in $$bases; do echo $$i.trs; done`; \ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ exit $$?; recheck: all $(check_PROGRAMS) @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ bases=`for i in $$bases; do echo $$i; done \ | $(am__list_recheck_tests)` || exit 1; \ log_list=`for i in $$bases; do echo $$i.log; done`; \ log_list=`echo $$log_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ am__force_recheck=am--force-recheck \ TEST_LOGS="$$log_list"; \ exit $$? example0.log: example0$(EXEEXT) @p='example0$(EXEEXT)'; \ b='example0'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) example0_str.log: example0_str$(EXEEXT) @p='example0_str$(EXEEXT)'; \ b='example0_str'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) example1.log: example1$(EXEEXT) @p='example1$(EXEEXT)'; \ b='example1'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) example1_str.log: example1_str$(EXEEXT) @p='example1_str$(EXEEXT)'; \ b='example1_str'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) example2.log: example2$(EXEEXT) @p='example2$(EXEEXT)'; \ b='example2'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) example2_str.log: example2_str$(EXEEXT) @p='example2_str$(EXEEXT)'; \ b='example2_str'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) example3.log: example3$(EXEEXT) @p='example3$(EXEEXT)'; \ b='example3'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) example3_str.log: example3_str$(EXEEXT) @p='example3_str$(EXEEXT)'; \ b='example3_str'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) example_reinit.log: example_reinit$(EXEEXT) @p='example_reinit$(EXEEXT)'; \ b='example_reinit'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) example_cext.log: example_cext$(EXEEXT) @p='example_cext$(EXEEXT)'; \ b='example_cext'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) example_cont.log: example_cont$(EXEEXT) @p='example_cont$(EXEEXT)'; \ b='example_cont'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) example_cont_str.log: example_cont_str$(EXEEXT) @p='example_cont_str$(EXEEXT)'; \ b='example_cont_str'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) example_dext.log: example_dext$(EXEEXT) @p='example_dext$(EXEEXT)'; \ b='example_dext'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) example_discr.log: example_discr$(EXEEXT) @p='example_discr$(EXEEXT)'; \ b='example_discr'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) example_discr_str.log: example_discr_str$(EXEEXT) @p='example_discr_str$(EXEEXT)'; \ b='example_discr_str'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) example_emp.log: example_emp$(EXEEXT) @p='example_emp$(EXEEXT)'; \ b='example_emp'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) example_emp_str.log: example_emp_str$(EXEEXT) @p='example_emp_str$(EXEEXT)'; \ b='example_emp_str'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) example_vemp.log: example_vemp$(EXEEXT) @p='example_vemp$(EXEEXT)'; \ b='example_vemp'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) example_FuncStr.log: example_FuncStr$(EXEEXT) @p='example_FuncStr$(EXEEXT)'; \ b='example_FuncStr'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) example_mcorr.log: example_mcorr$(EXEEXT) @p='example_mcorr$(EXEEXT)'; \ b='example_mcorr'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) example_mixt.log: example_mixt$(EXEEXT) @p='example_mixt$(EXEEXT)'; \ b='example_mixt'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) example_mixt_inv.log: example_mixt_inv$(EXEEXT) @p='example_mixt_inv$(EXEEXT)'; \ b='example_mixt_inv'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) example_cpp.log: example_cpp$(EXEEXT) @p='example_cpp$(EXEEXT)'; \ b='example_cpp'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) example_gsl.log: example_gsl$(EXEEXT) @p='example_gsl$(EXEEXT)'; \ b='example_gsl'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) example_rngstreams.log: example_rngstreams$(EXEEXT) @p='example_rngstreams$(EXEEXT)'; \ b='example_rngstreams'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) example_prng.log: example_prng$(EXEEXT) @p='example_prng$(EXEEXT)'; \ b='example_prng'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) example_prng_str.log: example_prng_str$(EXEEXT) @p='example_prng_str$(EXEEXT)'; \ b='example_prng_str'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) example_anti.log: example_anti$(EXEEXT) @p='example_anti$(EXEEXT)'; \ b='example_anti'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) example_anti_str.log: example_anti_str$(EXEEXT) @p='example_anti_str$(EXEEXT)'; \ b='example_anti_str'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) example_errorhandler.log: example_errorhandler$(EXEEXT) @p='example_errorhandler$(EXEEXT)'; \ b='example_errorhandler'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) .test.log: @p='$<'; \ $(am__set_b); \ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) @am__EXEEXT_TRUE@.test$(EXEEXT).log: @am__EXEEXT_TRUE@ @p='$<'; \ @am__EXEEXT_TRUE@ $(am__set_b); \ @am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ @am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/example0.Po -rm -f ./$(DEPDIR)/example0_str.Po -rm -f ./$(DEPDIR)/example1.Po -rm -f ./$(DEPDIR)/example1_str.Po -rm -f ./$(DEPDIR)/example2.Po -rm -f ./$(DEPDIR)/example2_str.Po -rm -f ./$(DEPDIR)/example3.Po -rm -f ./$(DEPDIR)/example3_str.Po -rm -f ./$(DEPDIR)/example_FuncStr.Po -rm -f ./$(DEPDIR)/example_anti.Po -rm -f ./$(DEPDIR)/example_anti_str.Po -rm -f ./$(DEPDIR)/example_cext.Po -rm -f ./$(DEPDIR)/example_cont.Po -rm -f ./$(DEPDIR)/example_cont_str.Po -rm -f ./$(DEPDIR)/example_cpp.Po -rm -f ./$(DEPDIR)/example_dext.Po -rm -f ./$(DEPDIR)/example_discr.Po -rm -f ./$(DEPDIR)/example_discr_str.Po -rm -f ./$(DEPDIR)/example_emp.Po -rm -f ./$(DEPDIR)/example_emp_str.Po -rm -f ./$(DEPDIR)/example_errorhandler.Po -rm -f ./$(DEPDIR)/example_gsl.Po -rm -f ./$(DEPDIR)/example_mcorr.Po -rm -f ./$(DEPDIR)/example_mixt.Po -rm -f ./$(DEPDIR)/example_mixt_inv.Po -rm -f ./$(DEPDIR)/example_prng.Po -rm -f ./$(DEPDIR)/example_prng_str.Po -rm -f ./$(DEPDIR)/example_reinit.Po -rm -f ./$(DEPDIR)/example_rngstreams.Po -rm -f ./$(DEPDIR)/example_vemp.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/example0.Po -rm -f ./$(DEPDIR)/example0_str.Po -rm -f ./$(DEPDIR)/example1.Po -rm -f ./$(DEPDIR)/example1_str.Po -rm -f ./$(DEPDIR)/example2.Po -rm -f ./$(DEPDIR)/example2_str.Po -rm -f ./$(DEPDIR)/example3.Po -rm -f ./$(DEPDIR)/example3_str.Po -rm -f ./$(DEPDIR)/example_FuncStr.Po -rm -f ./$(DEPDIR)/example_anti.Po -rm -f ./$(DEPDIR)/example_anti_str.Po -rm -f ./$(DEPDIR)/example_cext.Po -rm -f ./$(DEPDIR)/example_cont.Po -rm -f ./$(DEPDIR)/example_cont_str.Po -rm -f ./$(DEPDIR)/example_cpp.Po -rm -f ./$(DEPDIR)/example_dext.Po -rm -f ./$(DEPDIR)/example_discr.Po -rm -f ./$(DEPDIR)/example_discr_str.Po -rm -f ./$(DEPDIR)/example_emp.Po -rm -f ./$(DEPDIR)/example_emp_str.Po -rm -f ./$(DEPDIR)/example_errorhandler.Po -rm -f ./$(DEPDIR)/example_gsl.Po -rm -f ./$(DEPDIR)/example_mcorr.Po -rm -f ./$(DEPDIR)/example_mixt.Po -rm -f ./$(DEPDIR)/example_mixt_inv.Po -rm -f ./$(DEPDIR)/example_prng.Po -rm -f ./$(DEPDIR)/example_prng_str.Po -rm -f ./$(DEPDIR)/example_reinit.Po -rm -f ./$(DEPDIR)/example_rngstreams.Po -rm -f ./$(DEPDIR)/example_vemp.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-TESTS \ check-am clean clean-checkPROGRAMS clean-generic clean-libtool \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ recheck tags tags-am uninstall uninstall-am .PRECIOUS: Makefile # run tests with valgrind @HAVE_VALGRIND_TRUE@valgrind: $(check_PROGRAMS) @HAVE_VALGRIND_TRUE@ @list='$(check_PROGRAMS)'; for p in $$list; do \ @HAVE_VALGRIND_TRUE@ $(top_srcdir)/scripts/run_valgrind.sh ./$$p; \ @HAVE_VALGRIND_TRUE@ done # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: unuran-1.11.0/examples/example_emp.c0000644001357500135600000000503314420304141014305 00000000000000/* ------------------------------------------------------------- */ /* File: example_emp.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* Example how to sample from an empirial continuous univariate */ /* distribution. */ /* ------------------------------------------------------------- */ int main(void) { int i; double x; /* data points */ double data[15] = { -0.1, 0.05, -0.5, 0.08, 0.13,\ -0.21,-0.44, -0.43, -0.33, -0.3, \ 0.18, 0.2, -0.37, -0.29, -0.9 }; /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Create a distribution object and set empirical sample. */ distr = unur_distr_cemp_new(); unur_distr_cemp_set_data(distr, data, 15); /* Choose a method: EMPK. */ par = unur_empk_new(distr); /* Set smooting factor. */ unur_empk_set_smoothing(par, 0.8); /* Create the generator object. */ gen = unur_init(par); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/examples/example_cont_str.c0000644001357500135600000000530514420445767015405 00000000000000/* ------------------------------------------------------------- */ /* File: example_cont_str.c */ /* ------------------------------------------------------------- */ /* String API. */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* Example how to sample from a continuous univariate */ /* distribution. */ /* We use a generic distribution object and sample. */ /* */ /* The PDF of our distribution is given by */ /* */ /* / 1 - x*x if |x| <= 1 */ /* f(x) = < */ /* \ 0 otherwise */ /* */ /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; /* will hold the random number */ /* Declare UNURAN generator object. */ UNUR_GEN *gen; /* generator object */ /* Create the generator object. */ /* Use a generic continuous distribution. */ /* Choose a method: TDR. */ gen = unur_str2gen( "distr = cont; pdf=\"1-x*x\"; domain=(-1,1); mode=0. & \ method=tdr; variant_gw; max_sqhratio=0.90; c=-0.5; \ max_intervals=100; cpoints=10"); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/examples/example_gsl.c0000644001357500135600000000524114420445767014336 00000000000000/* ------------------------------------------------------------- */ /* File: example_gsl.c */ /* ------------------------------------------------------------- */ #ifdef UNURAN_SUPPORTS_GSL /* ------------------------------------------------------------- */ /* This example makes use of the GSL library for generating */ /* uniform random numbers. */ /* (see http://www.gnu.org/software/gsl/) */ /* To compile this example you must have set */ /* ./configure --with-urng-gsl */ /* (Of course the executable has to be linked against the */ /* GSL library.) */ /* ------------------------------------------------------------- */ /* Include UNURAN header files. */ #include #include /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; /* will hold the random number */ /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Declare objects for uniform random number generators. */ UNUR_URNG *urng; /* uniform generator objects */ /* GNU Scientific Library only: */ /* Make a object for uniform random number generator. */ urng = unur_urng_gsl_new(gsl_rng_mt19937); if (urng == NULL) exit (EXIT_FAILURE); /* Create a generator object using this URNG */ distr = unur_distr_normal( NULL, 0 ); par = unur_tdr_new(distr); unur_set_urng( par, urng ); gen = unur_init(par); if (gen == NULL) exit (EXIT_FAILURE); unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* Destroy objects */ unur_free(gen); unur_urng_free(urng); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ #else #include #include int main(void) { printf("You must enable the GSL to run this example!\n\n"); exit (77); /* exit code for automake check routines */ } #endif /* ------------------------------------------------------------- */ unuran-1.11.0/examples/Makefile.am0000644001357500135600000000227214420445767013727 00000000000000## Process this file with automake to produce Makefile.in AM_CPPFLAGS = \ $(UNURAN_SUPPORTS_GSL) \ $(UNURAN_SUPPORTS_PRNG) \ $(UNURAN_SUPPORTS_RNGSTREAM) \ -I$(top_srcdir)/src \ -I$(top_srcdir)/src/uniform AM_LDFLAGS = \ -L$(top_builddir)/src LDADD = \ $(top_builddir)/src/libunuran.la EXAMPLES = \ example0 example0_str \ example1 example1_str \ example2 example2_str \ example3 example3_str \ example_reinit \ example_cext \ example_cont example_cont_str \ example_dext \ example_discr example_discr_str \ example_emp example_emp_str \ example_vemp \ example_FuncStr \ example_mcorr \ example_mixt example_mixt_inv \ example_cpp \ example_gsl \ example_rngstreams \ example_prng example_prng_str \ example_anti example_anti_str \ example_errorhandler example_cpp_SOURCES = example_cpp.cpp check_PROGRAMS = $(EXAMPLES) TESTS = $(EXAMPLES) # run tests with valgrind if HAVE_VALGRIND valgrind: $(check_PROGRAMS) @list='$(check_PROGRAMS)'; for p in $$list; do \ $(top_srcdir)/scripts/run_valgrind.sh ./$$p; \ done endif # clean log files and backup files CLEANFILES = \ unuran.log \ valgrind-* \ *~ # clean generated files MAINTAINERCLEANFILES = \ Makefile.in unuran-1.11.0/examples/example_errorhandler.c0000644001357500135600000000411414420445767016236 00000000000000/* ------------------------------------------------------------- */ /* File: example_errorhandler.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* Simple example of an error handler that simply prints a */ /* message to stderr. */ /* ------------------------------------------------------------- */ void my_error_handler( const char *objid, /* id/type of object */ const char *file, /* source file name (__FILE__) */ int line, /* source line number (__LINE__) */ const char *errortype, /* "warning" or "error" */ int errorcode, /* UNU.RAN error code */ const char *reason /* short description of reason */ ) { FILE *LOG = stderr; static int n = 0; fprintf(LOG,"\n"); fprintf(LOG,"[[ %d ]] my_error_handler: [ %s ]\n",++n,errortype); fprintf(LOG,"\tobject = %s\n",objid); fprintf(LOG,"\tfile = %s\n",file); fprintf(LOG,"\tline = %d\n",line); fprintf(LOG,"\tcode = [%#x] %s\n",errorcode, unur_get_strerror(errorcode)); fprintf(LOG,"\treason = %s\n",reason); fprintf(LOG,"\n"); } /* end of my_error_handler() */ /* ------------------------------------------------------------- */ int main(void) { /* Declare UNURAN object. */ UNUR_GEN *gen; /* generator object */ /* Declare a point to hold old error handler. */ UNUR_ERROR_HANDLER *default_error_handler = NULL; /* Set new error handler. */ default_error_handler = unur_set_error_handler( my_error_handler ); /* The following statement causes an error */ gen = unur_str2gen("normal(0.,-1)"); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/examples/example_reinit.c0000644001357500135600000000724414420445767015050 00000000000000/* ------------------------------------------------------------- */ /* File: example_reinit.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* In this example we show how the parameters of the underlying */ /* distribution can be changed for an existing generator object. */ /* We use the GIG distribution with method CSTD. */ /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; /* will hold the random number */ /* Parameters of distribution. */ double dparam[3] = {0.5, 1., 5.}; /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Create initial GIG distribution object */ distr = unur_distr_gig(dparam, 3); /* Choose a method: CSTD. */ par = unur_cstd_new(distr); /* Create the generator object. */ gen = unur_init(par); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* It is possible for method CSTD to change the parameters of */ /* underlying distribution. However, we have to extract to */ /* pointer to the distribution. Be carefull with this pointer! */ distr = unur_get_distr(gen); /* Change the parameter(s). */ dparam[2] = 0.001; unur_distr_cont_set_pdfparams(distr,dparam,3); /* Do not forget to reinitialize the generator object. */ /* Check the return code. */ /* (and try to find a better error handling) */ if (unur_reinit(gen) != UNUR_SUCCESS) { fprintf(stderr, "ERROR: cannot reinitialize generator object\n"); exit (EXIT_FAILURE); } /* Draw a new sample. */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* Changing parameters can be repeated. */ dparam[2] = 1000; unur_distr_cont_set_pdfparams(distr,dparam,3); if (unur_reinit(gen) != UNUR_SUCCESS) { fprintf(stderr, "ERROR: cannot reinitialize generator object\n"); exit (EXIT_FAILURE); } for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/examples/example_vemp.c0000644001357500135600000000533514420304141014500 00000000000000/* ------------------------------------------------------------- */ /* File: example_vemp.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* Example how to sample from an empirial continuous */ /* multivariate distribution. */ /* ------------------------------------------------------------- */ int main(void) { int i; /* 4 data points of dimension 2 */ double data[] = { 1. ,1., /* 1st data point */ -1.,1., /* 2nd data point */ 1.,-1., /* 3rd data point */ -1.,-1. }; /* 4th data point */ double result[2]; /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Create a distribution object with dimension 2. */ distr = unur_distr_cvemp_new( 2 ); /* Set empirical sample. */ unur_distr_cvemp_set_data(distr, data, 4); /* Choose a method: VEMPK. */ par = unur_vempk_new(distr); /* Use variance correction. */ unur_vempk_set_varcor( par, 1 ); /* Create the generator object. */ gen = unur_init(par); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) { unur_sample_vec(gen, result); printf("(%f,%f)\n", result[0], result[1]); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/examples/example_anti_str.c0000644001357500135600000000716414420445767015402 00000000000000/* ------------------------------------------------------------- */ /* File: example_anti_str.c */ /* ------------------------------------------------------------- */ /* String API. */ /* ------------------------------------------------------------- */ #ifdef UNURAN_SUPPORTS_PRNG /* ------------------------------------------------------------- */ /* This example makes use of the PRNG library for generating */ /* uniform random numbers. */ /* (see http://statmath.wu.ac.at/prng/) */ /* To compile this example you must have set */ /* ./configure --with-urng-prng */ /* (Of course the executable has to be linked against the */ /* PRNG library.) */ /* ------------------------------------------------------------- */ /* Example how to sample from two streams of antithetic random */ /* variates from Gaussian N(2,5) and Gamma(4) distribution, resp.*/ /* ------------------------------------------------------------- */ /* Include UNURAN header files. */ #include #include /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double xn, xg; /* will hold the random number */ /* Declare UNURAN generator objects. */ UNUR_GEN *gen_normal, *gen_gamma; /* PRNG only: */ /* Make a object for uniform random number generator. */ /* For details see http://statmath.wu.ac.at/prng/. */ /* Create the first generator: Gaussian N(2,5) */ gen_normal = unur_str2gen("normal(2,5) & method=tdr; variant_ps & urng=mt19937(1237)"); if (gen_normal == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* Set auxilliary uniform random number generator. */ /* We use the default generator. */ unur_chgto_urng_aux_default(gen_normal); /* The second generator: Gamma(4) with antithetic variates. */ gen_gamma = unur_str2gen("gamma(4) & method=tdr; variant_ps & urng=anti(mt19937(1237))"); if (gen_gamma == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } unur_chgto_urng_aux_default(gen_gamma); /* Now we can sample pairs of negatively correlated random */ /* variates. E.g.: */ for (i=0; i<10; i++) { xn = unur_sample_cont(gen_normal); xg = unur_sample_cont(gen_gamma); printf("%g, %g\n",xn,xg); } /* When you do not need the generator objects any more, you */ /* can destroy it. */ /* But first we have to destroy the uniform random number */ /* generators. */ unur_urng_free(unur_get_urng(gen_normal)); unur_urng_free(unur_get_urng(gen_gamma)); unur_free(gen_normal); unur_free(gen_gamma); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ #else #include #include int main(void) { printf("You must enable the PRNG library to run this example!\n\n"); exit (77); /* exit code for automake check routines */ } #endif /* ------------------------------------------------------------- */ unuran-1.11.0/examples/example_cext.c0000644001357500135600000001100714420445767014511 00000000000000/* ------------------------------------------------------------- */ /* File: example_cext.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* This example shows how an external generator for the */ /* exponential distribution with one scale parameter can be */ /* used within the UNURAN framework. */ /* */ /* Notice, that this example does not provide the simplest */ /* solution. */ /* ------------------------------------------------------------- */ /* Initialization routine. */ /* */ /* Here we simply read the scale parameter of the exponential */ /* distribution and store it in an array for parameters of */ /* the external generator. */ /* [ Of course we could do this in the sampling routine as */ /* and avoid the necessity of this initialization routine. ] */ int exponential_init (UNUR_GEN *gen) { /* Get pointer to parameters of exponential distribution */ double *params = unur_cext_get_distrparams(gen); /* The scale parameter is the first entry (see manual) */ double lambda = (params) ? params[0] : 1.; /* Get array to store this parameter for external generator */ double *genpar = unur_cext_get_params(gen, sizeof(double)); genpar[0] = lambda; /* Executed successfully */ return UNUR_SUCCESS; } /* ------------------------------------------------------------- */ /* Sampling routine. */ /* */ /* Contains the code for the external generator. */ double exponential_sample (UNUR_GEN *gen) { /* Get scale parameter */ double *genpar = unur_cext_get_params(gen,0); double lambda = genpar[0]; /* Sample a uniformly distributed random number */ double U = unur_sample_urng(gen); /* Transform into exponentially distributed random variate */ return ( -log(1. - U) * lambda ); } /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; /* will hold the random number */ /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Use predefined exponential distribution with scale param. 2 */ double fpar[1] = { 2. }; distr = unur_distr_exponential(fpar, 1); /* Use method CEXT */ par = unur_cext_new(distr); /* Set initialization and sampling routines. */ unur_cext_set_init(par, exponential_init); unur_cext_set_sample(par, exponential_sample); /* Create the generator object. */ gen = unur_init(par); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the standard Gaussian distribution. */ /* Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/examples/example1.c0000644001357500135600000000537614420304141013537 00000000000000/* ------------------------------------------------------------- */ /* File: example1.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; /* will hold the random number */ /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Use a predefined standard distribution: */ /* Gaussian with mean zero and standard deviation 1. */ /* Since this is the standard form of the distribution, */ /* we need not give these parameters. */ distr = unur_distr_normal(NULL, 0); /* Choose a method: AROU. */ /* For other (suitable) methods replace "arou" with the */ /* respective name (in lower case letters). */ par = unur_arou_new(distr); /* Now you can change some of the default settings for the */ /* parameters of the chosen method. We don't do it here. */ /* Create the generator object. */ gen = unur_init(par); /* Notice that this call has also destroyed the parameter */ /* object `par' as a side effect. */ /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the standard Gaussian distribution. */ /* Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/examples/example_cpp.cpp0000644001357500135600000000611214420304141014645 00000000000000/* ------------------------------------------------------------- */ /* File: example1.cpp */ /* */ /* This example simply shows that UNU.RAN can directly be used */ /* with C++. */ /* (Of course the example could be much less "C-stylish".) */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include #include /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; /* will hold the random number */ /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Use a predefined standard distribution: */ /* Gaussian with mean zero and standard deviation 1. */ /* Since this is the standard form of the distribution, */ /* we need not give these parameters. */ distr = unur_distr_normal(NULL, 0); /* Choose a method: AROU. */ /* For other (suitable) methods replace "arou" with the */ /* respective name (in lower case letters). */ par = unur_arou_new(distr); /* Now you can change some of the default settings for the */ /* parameters of the chosen method. We don't do it here. */ /* Create the generator object. */ gen = unur_init(par); /* Notice that this call has also destroyed the parameter */ /* object `par' as a side effect. */ /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { std::cerr << "ERROR: cannot create generator object" << std::endl; exit (EXIT_FAILURE); } /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the standard Gaussian distribution. */ /* Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); std::cout << "x(" << i << ") = " << x << std::endl; } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/examples/example2_str.c0000644001357500135600000000523414420445767014445 00000000000000/* ------------------------------------------------------------- */ /* File: example2_str.c */ /* ------------------------------------------------------------- */ /* String API. */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* In this example we use a generic distribution object */ /* and sample from this distribution. */ /* */ /* The PDF of our distribution is given by */ /* */ /* / 1 - x*x if |x| <= 1 */ /* f(x) = < */ /* \ 0 otherwise */ /* */ /* We use method TDR (Transformed Density Rejection) which */ /* required a PDF and the derivative of the PDF. */ /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; /* will hold the random number */ /* Declare UNURAN generator object. */ UNUR_GEN *gen; /* generator object */ /* Create the generator object. */ /* Use a generic continuous distribution. */ /* Choose a method: TDR. */ gen = unur_str2gen( "distr = cont; pdf=\"1-x*x\"; domain=(-1,1) & method=tdr"); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/examples/example_discr_str.c0000644001357500135600000000377414420445767015556 00000000000000/* ------------------------------------------------------------- */ /* File: example_discr_str.c */ /* ------------------------------------------------------------- */ /* String API. */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* Example how to sample from a discrete univariate distribution.*/ /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ /* Declare UNURAN generator objects. */ UNUR_GEN *gen1, *gen2; /* generator objects */ /* First distribution: defined by PMF. */ gen1 = unur_str2gen("geometric(0.3); mode=0 & method=dari"); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen1 == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* Second distribution: defined by (finite) PV. */ gen2 = unur_str2gen( "distr=discr; pv=(1,2,3,4,5,6,7,8,4,3) & method=dgt"); if (gen2 == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* print some random integers */ for (i=0; i<10; i++){ printf("number %d: %d\n", i*2, unur_sample_discr(gen1) ); printf("number %d: %d\n", i*2+1, unur_sample_discr(gen2) ); } /* Destroy all objects. */ unur_free(gen1); unur_free(gen2); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/examples/example1_str.c0000644001357500135600000000413014420304141014412 00000000000000/* ------------------------------------------------------------- */ /* File: example1_str.c */ /* ------------------------------------------------------------- */ /* String API. */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; /* will hold the random number */ /* Declare UNURAN generator object. */ UNUR_GEN *gen; /* generator object */ /* Create the generator object. */ /* Use a predefined standard distribution: */ /* Standard Gaussian distribution. */ /* Choose a method: AROU. */ /* For other (suitable) methods replace "arou" with the */ /* respective name. */ gen = unur_str2gen("normal() & method=arou"); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* Now you can use the generator object `gen' to sample from */ /* the standard Gaussian distribution. */ /* Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/examples/example_mixt.c0000644001357500135600000000543214420445767014534 00000000000000/* ------------------------------------------------------------- */ /* File: example_mixt.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* Mixture of a Gaussian and a Cauchy distribution. */ /* ------------------------------------------------------------- */ int main(void) { /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *comp[2]; /* array of generator objects (components)*/ UNUR_GEN *gen; /* generator object for mixture */ double prob[2]; /* array of probabilities */ int i; /* loop variable */ double x; /* will hold the random number */ /* Create generators for components */ distr = unur_distr_normal(NULL,0); /* Gaussian distribution */ par = unur_pinv_new(distr); /* choose method PINV */ comp[0] = unur_init(par); /* initialize */ unur_distr_free(distr); /* free distribution obj. */ distr = unur_distr_cauchy(NULL,0); /* Cauchy distribution */ par = unur_tdr_new(distr); /* choose method TDR */ comp[1] = unur_init(par); /* initialize */ unur_distr_free(distr); /* free distribution obj. */ /* Probabilities for components (need not sum to 1) */ prob[0] = 0.4; prob[1] = 0.3; /* Create mixture */ par = unur_mixt_new(2,prob,comp); /* Initialize generator object */ gen = unur_init(par); /* we do not need the components any more */ for (i=0; i<2; i++) unur_free(comp[i]); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/examples/example_prng_str.c0000644001357500135600000000760514420445767015415 00000000000000/* ------------------------------------------------------------- */ /* File: example_prng_str.c */ /* ------------------------------------------------------------- */ /* String API. */ /* ------------------------------------------------------------- */ #ifdef UNURAN_SUPPORTS_PRNG /* ------------------------------------------------------------- */ /* This example makes use of the PRNG library for generating */ /* uniform random numbers. */ /* (see http://statmath.wu.ac.at/prng/) */ /* To compile this example you must have set */ /* ./configure --with-urng-prng */ /* (Of course the executable has to be linked against the */ /* PRNG library.) */ /* ------------------------------------------------------------- */ /* Include UNURAN header files. */ #include #include /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; /* will hold the random number */ /* Declare UNURAN generator object. */ UNUR_GEN *gen; /* generator object */ /* Declare objects for uniform random number generators. */ UNUR_URNG *urng1, *urng2; /* uniform generator objects */ /* Create the generator object. */ /* Use a predefined standard distribution: */ /* Beta with parameters 2 and 3. */ /* Choose a method: TDR. */ /* Use the Mersenne Twister for unifrom random number */ /* generator (requires PRNG library). */ gen = unur_str2gen("beta(2,3) & method=tdr & urng = mt19937(1237)"); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* Now we want to switch to a different uniform random number */ /* generator. */ /* Now we use an ICG (Inversive Congruental Generator). */ urng2 = unur_urng_prng_new("icg(2147483647,1,1,0)"); if (urng2 == NULL) exit (EXIT_FAILURE); /* Change uniform random number generator. */ /* Notice however that we should save the pointer to uniform */ /* random number generator in the generator object. */ urng1 = unur_chg_urng( gen, urng2 ); /* ... and sample again. */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); /* We also should destroy the uniform random number generators.*/ unur_urng_free(urng1); unur_urng_free(urng2); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ #else #include #include int main(void) { printf("You must enable the PRNG library to run this example!\n\n"); exit (77); /* exit code for automake check routines */ } #endif /* ------------------------------------------------------------- */ unuran-1.11.0/examples/example_emp_str.c0000644001357500135600000000400614420445767015220 00000000000000/* ------------------------------------------------------------- */ /* File: example_emp_str.c */ /* ------------------------------------------------------------- */ /* String API. */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* Example how to sample from an empirial continuous univariate */ /* distribution. */ /* ------------------------------------------------------------- */ int main(void) { int i; double x; /* Declare UNURAN generator object. */ UNUR_GEN *gen; /* generator object */ /* Create the generator object. */ gen = unur_str2gen("distr = cemp; \ data=(-0.10, 0.05,-0.50, 0.08, 0.13, \ -0.21,-0.44,-0.43,-0.33,-0.30, \ 0.18, 0.20,-0.37,-0.29,-0.90) & \ method=empk; smoothing=0.8"); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/examples/example3.c0000644001357500135600000000612714420304141013534 00000000000000/* ------------------------------------------------------------- */ /* File: example3.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; /* will hold the random number */ double fparams[2]; /* array for parameters for distribution */ /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Use a predefined standard distribution: */ /* Gaussian with mean 2. and standard deviation 0.5. */ fparams[0] = 2.; fparams[1] = 0.5; distr = unur_distr_normal( fparams, 2 ); /* Choose a method: TDR. */ par = unur_tdr_new(distr); /* Change some of the default parameters. */ /* We want to use T(x)=log(x) for the transformation. */ unur_tdr_set_c( par, 0. ); /* We want to have the variant with immediate acceptance. */ unur_tdr_set_variant_ia( par ); /* We want to use 10 construction points for the setup */ unur_tdr_set_cpoints ( par, 10, NULL ); /* Create the generator object. */ gen = unur_init(par); /* Notice that this call has also destroyed the parameter */ /* object `par' as a side effect. */ /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* It is possible with method TDR to truncate the distribution */ /* for an existing generator object ... */ unur_tdr_chg_truncated( gen, -1., 0. ); /* ... and sample again. */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/examples/example3_str.c0000644001357500135600000000471714420445767014453 00000000000000/* ------------------------------------------------------------- */ /* File: example3_str.c */ /* ------------------------------------------------------------- */ /* String API. */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; /* will hold the random number */ /* Declare UNURAN generator object. */ UNUR_GEN *gen; /* generator object */ /* Create the generator object. */ /* Use a predefined standard distribution: */ /* Gaussian with mean 2. and standard deviation 0.5. */ /* Choose a method: TDR with parameters */ /* c = 0: use T(x)=log(x) for the transformation; */ /* variant "immediate acceptance"; */ /* number of construction points = 10. */ gen = unur_str2gen( "normal(2,0.5) & method=tdr; c=0.; variant_ia; cpoints=10"); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* It is possible with method TDR to truncate the distribution */ /* for an existing generator object ... */ unur_tdr_chg_truncated( gen, -1., 0. ); /* ... and sample again. */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/examples/example_anti.c0000644001357500135600000001341314420445767014504 00000000000000/* ------------------------------------------------------------- */ /* File: example_anti.c */ /* ------------------------------------------------------------- */ #ifdef UNURAN_SUPPORTS_PRNG /* ------------------------------------------------------------- */ /* This example makes use of the PRNG library for generating */ /* uniform random numbers. */ /* (see http://statmath.wu.ac.at/prng/) */ /* To compile this example you must have set */ /* ./configure --with-urng-prng */ /* (Of course the executable has to be linked against the */ /* PRNG library.) */ /* ------------------------------------------------------------- */ /* Example how to sample from two streams of antithetic random */ /* variates from Gaussian N(2,5) and Gamma(4) distribution, resp.*/ /* ------------------------------------------------------------- */ /* Include UNURAN header files. */ #include #include /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double xn, xg; /* will hold the random number */ double fparams[2]; /* array for parameters for distribution */ /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen_normal, *gen_gamma; /* generator objects */ /* Declare objects for uniform random number generators. */ UNUR_URNG *urng1, *urng2; /* uniform generator objects */ /* PRNG only: */ /* Make a object for uniform random number generator. */ /* For details see http://statmath.wu.ac.at/prng/. */ /* The first generator: Gaussian N(2,5) */ /* uniform generator: We use the Mersenne Twister. */ urng1 = unur_urng_prng_new("mt19937(1237)"); if (urng1 == NULL) exit (EXIT_FAILURE); /* UNURAN generator object for N(2,5) */ fparams[0] = 2.; fparams[1] = 5.; distr = unur_distr_normal( fparams, 2 ); /* Choose method TDR with variant PS. */ par = unur_tdr_new( distr ); unur_tdr_set_variant_ps( par ); /* Set uniform generator in parameter object. */ unur_set_urng( par, urng1 ); /* Set auxilliary uniform random number generator. */ /* We use the default generator. */ unur_use_urng_aux_default( par ); /* Alternatively you can create and use your own auxilliary */ /* uniform random number generator: */ /* UNUR_URNG *urng_aux; */ /* urng_aux = unur_urng_prng_new("tt800"); */ /* if (urng_aux == NULL) exit (EXIT_FAILURE); */ /* unur_set_urng_aux( par, urng_aux ); */ /* Create the generator object. */ gen_normal = unur_init(par); if (gen_normal == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* Destroy distribution object (gen_normal has its own copy). */ unur_distr_free(distr); /* The second generator: Gamma(4) with antithetic variates. */ /* uniform generator: We use the Mersenne Twister. */ urng2 = unur_urng_prng_new("anti(mt19937(1237))"); if (urng2 == NULL) exit (EXIT_FAILURE); /* UNURAN generator object for gamma(4) */ fparams[0] = 4.; distr = unur_distr_gamma( fparams, 1 ); /* Choose method TDR with variant PS. */ par = unur_tdr_new( distr ); unur_tdr_set_variant_ps( par ); /* Set uniform generator in parameter object. */ unur_set_urng( par, urng2 ); /* Set auxilliary uniform random number generator. */ /* We use the default generator. */ unur_use_urng_aux_default( par ); /* Alternatively you can create and use your own auxilliary */ /* uniform random number generator (see above). */ /* Notice that both generator objects gen_normal and */ /* gen_gamma can share the same auxilliary URNG. */ /* Create the generator object. */ gen_gamma = unur_init(par); if (gen_gamma == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* Destroy distribution object (gen_normal has its own copy). */ unur_distr_free(distr); /* Now we can sample pairs of negatively correlated random */ /* variates. E.g.: */ for (i=0; i<10; i++) { xn = unur_sample_cont(gen_normal); xg = unur_sample_cont(gen_gamma); printf("%g, %g\n",xn,xg); } /* When you do not need the generator objects any more, you */ /* can destroy it. */ unur_free(gen_normal); unur_free(gen_gamma); /* We also should destroy the uniform random number generators.*/ unur_urng_free(urng1); unur_urng_free(urng2); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ #else #include #include int main(void) { printf("You must enable the PRNG library to run this example!\n\n"); exit (77); /* exit code for automake check routines */ } #endif /* ------------------------------------------------------------- */ unuran-1.11.0/examples/example_discr.c0000644001357500135600000000457614420304141014643 00000000000000/* ------------------------------------------------------------- */ /* File: example_discr.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* Example how to sample from a discrete univariate distribution.*/ /* ------------------------------------------------------------- */ int main(void) { int i; double param = 0.3; double probvec[10] = {1.0, 2.0, 3.0, 4.0, 5.0,\ 6.0, 7.0, 8.0, 4.0, 3.0}; /* Declare the three UNURAN objects. */ UNUR_DISTR *distr1, *distr2; /* distribution objects */ UNUR_PAR *par1, *par2; /* parameter objects */ UNUR_GEN *gen1, *gen2; /* generator objects */ /* First distribution: defined by PMF. */ distr1 = unur_distr_geometric(¶m, 1); unur_distr_discr_set_mode(distr1, 0); /* Choose a method: DARI. */ par1 = unur_dari_new(distr1); gen1 = unur_init(par1); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen1 == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* Second distribution: defined by (finite) PV. */ distr2 = unur_distr_discr_new(); unur_distr_discr_set_pv(distr2, probvec, 10); /* Choose a method: DGT. */ par2 = unur_dgt_new(distr2); gen2 = unur_init(par2); if (gen2 == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* print some random integers */ for (i=0; i<10; i++){ printf("number %d: %d\n", i*2, unur_sample_discr(gen1) ); printf("number %d: %d\n", i*2+1, unur_sample_discr(gen2) ); } /* Destroy all objects. */ unur_distr_free(distr1); unur_distr_free(distr2); unur_free(gen1); unur_free(gen2); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/examples/example0_str.c0000644001357500135600000000400614420304141014413 00000000000000/* ------------------------------------------------------------- */ /* File: example0_str.c */ /* ------------------------------------------------------------- */ /* String API. */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; /* will hold the random number */ /* Declare UNURAN generator object. */ UNUR_GEN *gen; /* generator object */ /* Create the generator object. */ /* Use a predefined standard distribution: */ /* Standard Gaussian distribution. */ /* Use method AUTO: */ /* Let UNURAN select a suitable method for you. */ gen = unur_str2gen("normal()"); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* Now you can use the generator object `gen' to sample from */ /* the standard Gaussian distribution. */ /* Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/examples/example0.c0000644001357500135600000000527214420304141013531 00000000000000/* ------------------------------------------------------------- */ /* File: example0.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; /* will hold the random number */ /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Use a predefined standard distribution: */ /* Gaussian with mean zero and standard deviation 1. */ /* Since this is the standard form of the distribution, */ /* we need not give these parameters. */ distr = unur_distr_normal(NULL, 0); /* Use method AUTO: */ /* Let UNURAN select a suitable method for you. */ par = unur_auto_new(distr); /* Now you can change some of the default settings for the */ /* parameters of the chosen method. We don't do it here. */ /* Create the generator object. */ gen = unur_init(par); /* Notice that this call has also destroyed the parameter */ /* object `par' as a side effect. */ /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the standard Gaussian distribution. */ /* Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/examples/example2.c0000644001357500135600000001055114420304141013527 00000000000000/* ------------------------------------------------------------- */ /* File: example2.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header file. */ #include /* ------------------------------------------------------------- */ /* In this example we build a distribution object from scratch */ /* and sample from this distribution. */ /* */ /* We use method TDR (Transformed Density Rejection) which */ /* required a PDF and the derivative of the PDF. */ /* ------------------------------------------------------------- */ /* Define the PDF and dPDF of our distribution. */ /* */ /* Our distribution has the PDF */ /* */ /* / 1 - x*x if |x| <= 1 */ /* f(x) = < */ /* \ 0 otherwise */ /* */ /* The PDF of our distribution: */ double mypdf( double x, const UNUR_DISTR *distr ) /* The second argument (`distr') can be used for parameters */ /* for the PDF. (We do not use parameters in our example.) */ { if (fabs(x) >= 1.) return 0.; else return (1.-x*x); } /* end of mypdf() */ /* The derivative of the PDF of our distribution: */ double mydpdf( double x, const UNUR_DISTR *distr ) { if (fabs(x) >= 1.) return 0.; else return (-2.*x); } /* end of mydpdf() */ /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; /* will hold the random number */ /* Declare the three UNURAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen; /* generator object */ /* Create a new distribution object from scratch. */ /* It is a continuous distribution, and we need a PDF and the */ /* derivative of the PDF. Moreover we set the domain. */ /* Get empty distribution object for a continuous distribution */ distr = unur_distr_cont_new(); /* Assign the PDF and dPDF (defined above). */ unur_distr_cont_set_pdf( distr, mypdf ); unur_distr_cont_set_dpdf( distr, mydpdf ); /* Set the domain of the distribution (optional for TDR). */ unur_distr_cont_set_domain( distr, -1., 1. ); /* Choose a method: TDR. */ par = unur_tdr_new(distr); /* Now you can change some of the default settings for the */ /* parameters of the chosen method. We don't do it here. */ /* Create the generator object. */ gen = unur_init(par); /* Notice that this call has also destroyed the parameter */ /* object `par' as a side effect. */ /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen' to sample from */ /* the distribution. Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen); printf("%f\n",x); } /* When you do not need the generator object any more, you */ /* can destroy it. */ unur_free(gen); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/scripts/0000755001357500135600000000000014430713512011604 500000000000000unuran-1.11.0/scripts/make_urng_header.pl0000754001357500135600000001155014430713333015346 00000000000000#!/usr/bin/perl ############################################################################## # # # UNURAN -- Universal Non-Uniform Random number generator # # # ############################################################################## # # # FILE: make_urng_header.pl # # # # Make header file for UNU.RAN wrapper functions for external URNGs # # # ############################################################################## # # # Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold # # Department of Statistics and Mathematics, WU Wien, Austria # # # # This program is free software; you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # # the Free Software Foundation; either version 2 of the License, or # # (at your option) any later version. # # # # This program is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with this program; if not, write to the # # Free Software Foundation, Inc., # # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA # # # ############################################################################## use strict; my $DEBUG = 0; ############################################################ sub usage { my $progname = $0; $progname =~ s#^.*/##g; print STDERR < [ ...] Create header file for wrappers for external URNGs EOM exit -1; } ############################################################ # year my $year = 1900 + (localtime(time))[5]; # content of files my $out = ''; # copyright statment my $copyright = "/*******************************************************************\\\n". " * *\n". " * UNU.RAN -- Universal Non-Uniform Random number generator *\n". " * *\n". " *******************************************************************\n". " * Copyright (c) 2000-$year Wolfgang Hoermann and Josef Leydold *\n". " * Department of Statistics and Mathematics, WU Wien, Austria *\n". "\\*******************************************************************/\n"; my $CPP_header = "#undef __BEGIN_DECLS\n". "#undef __END_DECLS\n". "#ifdef __cplusplus\n". "# define __BEGIN_DECLS extern \"C\" {\n". "# define __END_DECLS }\n". "#else\n". "# define __BEGIN_DECLS /* empty */\n". "# define __END_DECLS /* empty */\n". "#endif\n". "\n". "__BEGIN_DECLS\n\n"; my $CPP_bottom = "__END_DECLS\n"; # marker my $marker = ''; # read file name from argument list ... while (my $file = shift) { # open file ... open IN, $file or die "cannot open file $file\n"; # do we have to define a marker? unless ($marker) { $marker = "UNURAN_" . uc($file) . "_SEEN"; $marker =~ s/\W/\_/g; } # read file ... my $content = ''; while () { $content .= $_; } close IN; # remove all comments and empty lines ... $content =~ s {/\*.*?\*/} []gsx; $content =~ s /\n\s*\n/\n/gsx; # remove ifdef ...H_SEEN if ($content =~ /\#ifndef URNG_.*_H_SEEN/) { $content =~ s {\#ifndef\s+URNG_.*_H_SEEN\s+\#define\s+URNG_.*_H_SEEN\s*\n} []gsx; $content =~ s /\#endif\s+$//gsx; } # add to output $out .= $content; } print $copyright . $CPP_header . "\#ifndef $marker\n" . "\#define $marker\n" . $out . "\#endif /* $marker */\n" . $CPP_bottom; # end exit 0; ############################################################ unuran-1.11.0/scripts/merge_h.pl0000754001357500135600000002125214420445767013510 00000000000000#!/usr/bin/perl ############################################################################## # # # UNURAN -- Universal Non-Uniform Random number generator # # # ############################################################################## # # # FILE: merge_h.pl # # # # Read all UNU.RAN header files, strip comments and create single header # # file 'unuran.h' # # # ############################################################################## # # # Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold # # Department of Statistics and Mathematics, WU Wien, Austria # # # # This program is free software; you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # # the Free Software Foundation; either version 2 of the License, or # # (at your option) any later version. # # # # This program is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with this program; if not, write to the # # Free Software Foundation, Inc., # # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA # # # ############################################################################## use strict; my $DEBUG = 0; ############################################################ # constants my $DEP_file = ".dep-unuran_h"; ############################################################ sub usage { my $progname = $0; $progname =~ s#^.*/##g; print STDERR < Scans and inserts all header files found in subtree rooted at current working directory. Other header files and those with names containing "config" are ignored and just #included. All comments and blank lines are removed. The output is written on stdout. EOM exit -1; } ############################################################ # dependencies my $DEP = "unuran.h: "; ############################################################ sub h_file_header { print <) { chomp; next unless /^.*\/+(.*\.h)$/; next if /config/; $header_files{$1} = $_; # store file and path of file } close FILES; # insert file header ... h_file_header; # scan master file ... scan_file ($master_file,0); # insert bottom of file h_file_bottom; # write dependencies open DEP, ">$DEP_file" or die "Cannot open file for writing: $DEP_file"; print DEP "$DEP\n"; close DEP; exit 0; ############################################################ # scan given file ... sub scan_file { my $file = $_[0]; my $level = $_[1]+1; my $handle = new FileHandle; print STDERR "$file\n"; # open file ... open $handle, $file or die "cannot find file $file\n"; # read file ... my $content = ''; while (<$handle>) { $content .= $_; } close $handle; # remove all comments and empty lines ... $content =~ s {/\*.*?\*/} []gsx; $content =~ s /\n\s*\n/\n/gsx; # split into lines ... my @lines = split /\n/, $content; foreach my $line (@lines) { unless ($line =~ /^\#include\s+[<\"](.*)[>\"]/) { print "$line\n"; next; } # have found a file to be included ... my @tmp = split /\//, $1; my $include_file = pop @tmp; print STDERR "$include_file " if $DEBUG; # we do not include header files out of the subtree ... unless (defined( $header_files{$include_file} ) ) { print STDERR "file not found in subtree ... #include\n" if $DEBUG; print "\n$line\n\n"; next; } # we include header files only once ... if (defined( $header_included{$include_file} ) ) { print STDERR "already included ... skip\n" if $DEBUG; next; } $header_included{$include_file} .= 1; # have found header file ... print STDERR "to be inserted\n" if $DEBUG; print "/*-----*/\n"; print "/* <$level> `$include_file' */"; # add dependency $DEP .= "$header_files{$include_file} "; # scan header file ... scan_file ($header_files{$include_file},$level); print "/* end of `$include_file' */\n"; print "/*-----*/\n"; } } ############################################################ ############################################################ unuran-1.11.0/scripts/remove_comments.pl0000754001357500135600000000737314420445767015314 00000000000000#!/usr/bin/perl ############################################################################## # # # UNURAN -- Universal Non-Uniform Random number generator # # # ############################################################################## # # # FILE: remove_comments.pl # # # # Remove all comments and blank lines from given C source or header file # # # ############################################################################## # # # Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold # # Department of Statistics and Mathematics, WU Wien, Austria # # # # This program is free software; you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # # the Free Software Foundation; either version 2 of the License, or # # (at your option) any later version. # # # # This program is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with this program; if not, write to the # # Free Software Foundation, Inc., # # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA # # # ############################################################################## use strict; my $DEBUG = 0; ############################################################ sub usage { my $progname = $0; $progname =~ s#^.*/##g; print STDERR < Removes all comments and blank lines from C file EOM exit -1; } ############################################################ # year my $year = 1900 + (localtime(time))[5]; # read file name from argument list ... my $file = shift; (usage and die) unless $file; print "stripping $file ...\n"; # open file ... open IN, $file or die "cannot open file $file\n"; # read file ... my $content = ''; while () { $content .= $_; } close IN; # some comments must not be removed. # so we first masks them $content =~ s {/\*\s*FALLTHROUGH\s*\*/} [\@\@FALLTHROUGH\@\@]gsx; # remove all comments and empty lines ... $content =~ s {/\*.*?\*/} []gsx; $content =~ s /\n\s*\n/\n/gsx; # now unmask these special comments $content =~ s {\@\@FALLTHROUGH\@\@} [/\* FALLTHROUGH \*/]gsx; # copyright statment my $copyright = "/* Copyright (c) 2000-$year Wolfgang Hoermann and Josef Leydold */\n" . "/* Department of Statistics and Mathematics, WU Wien, Austria */\n"; # print into file open OUT, ">$file"; print OUT $copyright; print OUT $content; close OUT; # end exit 0; ############################################################ unuran-1.11.0/scripts/Makefile.in0000644001357500135600000004543514430713360013605 00000000000000# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ noinst_PROGRAMS = compute_machine_constants$(EXEEXT) subdir = scripts ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = PROGRAMS = $(noinst_PROGRAMS) compute_machine_constants_SOURCES = compute_machine_constants.c compute_machine_constants_OBJECTS = \ compute_machine_constants.$(OBJEXT) compute_machine_constants_LDADD = $(LDADD) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/compute_machine_constants.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = compute_machine_constants.c DIST_SOURCES = compute_machine_constants.c am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(noinst_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autoconf/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILECMD = @FILECMD@ GREP = @GREP@ HAVE_DIVIDE_BY_ZERO = @HAVE_DIVIDE_BY_ZERO@ HAVE_IEEE_COMPARISONS = @HAVE_IEEE_COMPARISONS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNURAN_LT_VERSION = @UNURAN_LT_VERSION@ UNURAN_SUPPORTS_GSL = @UNURAN_SUPPORTS_GSL@ UNURAN_SUPPORTS_PRNG = @UNURAN_SUPPORTS_PRNG@ UNURAN_SUPPORTS_RNGSTREAM = @UNURAN_SUPPORTS_RNGSTREAM@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ have_valgrind = @have_valgrind@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = \ make_urng_header.pl \ merge_h.pl \ read_PDF.pl \ remove_comments.pl \ run_valgrind.sh \ \ win32/Makefile.win32 \ win32/build.sh \ win32/make_dll_def.pl \ win32/example1.c \ win32/example2.c noinst_HEADERS = \ $(top_srcdir)/src/utils/unur_fp_const_source.h # clean backup files CLEANFILES = \ *~ \ win32/*~ # clean generated files MAINTAINERCLEANFILES = \ Makefile.in all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign scripts/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign scripts/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstPROGRAMS: @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list compute_machine_constants$(EXEEXT): $(compute_machine_constants_OBJECTS) $(compute_machine_constants_DEPENDENCIES) $(EXTRA_compute_machine_constants_DEPENDENCIES) @rm -f compute_machine_constants$(EXEEXT) $(AM_V_CCLD)$(LINK) $(compute_machine_constants_OBJECTS) $(compute_machine_constants_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compute_machine_constants.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) $(HEADERS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/compute_machine_constants.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/compute_machine_constants.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstPROGRAMS cscopelist-am \ ctags ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .PRECIOUS: Makefile # create files with floating point constants $(top_srcdir)/src/utils/unur_fp_const_source.h: compute_machine_constants test -f $(top_srcdir)/src/utils/unur_fp_const_source.h \ || ./compute_machine_constants > $(top_srcdir)/src/utils/unur_fp_const_source.h # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: unuran-1.11.0/scripts/Makefile.am0000644001357500135600000000137314420445767013601 00000000000000## Process this file with automake to produce Makefile.in noinst_PROGRAMS = compute_machine_constants EXTRA_DIST = \ make_urng_header.pl \ merge_h.pl \ read_PDF.pl \ remove_comments.pl \ run_valgrind.sh \ \ win32/Makefile.win32 \ win32/build.sh \ win32/make_dll_def.pl \ win32/example1.c \ win32/example2.c noinst_HEADERS = \ $(top_srcdir)/src/utils/unur_fp_const_source.h # create files with floating point constants $(top_srcdir)/src/utils/unur_fp_const_source.h: compute_machine_constants test -f $(top_srcdir)/src/utils/unur_fp_const_source.h \ || ./compute_machine_constants > $(top_srcdir)/src/utils/unur_fp_const_source.h # clean backup files CLEANFILES = \ *~ \ win32/*~ # clean generated files MAINTAINERCLEANFILES = \ Makefile.in unuran-1.11.0/scripts/win32/0000755001357500135600000000000014430713512012546 500000000000000unuran-1.11.0/scripts/win32/build.sh0000754001357500135600000001126114420445767014141 00000000000000#! sh # --- Default building flags ------------------------------------------------ UNURAN_CONFIGURE_FLAGS="--enable-maintainer-mode --disable-deprecated" # --- Synopsis -------------------------------------------------------------- function usage () { echo "usage: build.sh [options] [--configure-options]" echo "" echo " options:" echo " dist ....... create distributio (zip file)" echo " rstream .... add Pierre L'Ecuyer's RngStreams package" echo " examples ... run examples" echo " check ...... run UNU.RAN tests" echo " help ....... this message" echo "" echo " --configure-options:" echo " see './configure --help'" exit 1; } # --- Setup environment ----------------------------------------------------- # Where to find MS Visual Studio 2005 compilers export VSCYG='/cygdrive/c/Programme/Microsoft Visual Studio 8' export VCWIN='C:\Programme\Microsoft Visual Studio 8\VC' # Add path to compiler export PATH=${VSCYG}/VC/bin:${PATH} export PATH=${VSCYG}/Common7/IDE:${PATH} # Add path to MSVC system header files export INCLUDE="${VCWIN}\include;${INCLUDE}" export INCLUDE="${VCWIN}\PlatformSDK\Include;${INCLUDE}" # Add path to MSVC libraries export LIB="${VCWIN}\lib;${LIB}" export LIB="${VCWIN}\PlatformSDK\Lib;${LIB}" # C prepsocessor, compiler and linker export CPP="cl -E" export CC="cl " export CXXCPP="cl -E" export CXX="cl " export LD="cl " # directory for windows files export WINDIST_DIR="unuran-win32" # add path to created DLL (for testing) export PATH=`pwd`/${WINDIST_DIR}:${PATH} # --- Read command line arguments ------------------------------------------- for arg in "$@"; do case "${arg}" in help) # Synopsis usage ;; dist) # Create package doc=true zip=true export USE_RNGSTREAM=true ;; rstream) # add RngStreams package export USE_RNGSTREAM=true ;; examples) # Compile, link and run all examples examples=true ;; check) # Compile, link and run all tests check=true export USE_PRIVATE=true ;; clean) # Remove all files created by this script clean=true ;; --*) # ./configure option UNURAN_CONFIGURE_FLAGS="${UNURAN_CONFIGURE_FLAGS} ${arg}" ;; *) echo "Invalid argment '${arg}'" usage ;; esac done # --- Check working directory ----------------------------------------------- # test whether the script is started from top source directory if [[ ! -f ./configure.ac || -z `grep unuran ./configure.ac` ]]; then echo "You must run this script from UNU.RAN top source directory"; exit 1; fi # test whether script start in cygwin environment if [[ -z `uname | grep -i cygwin` ]]; then echo "This scripts requires CYGWIN"; exit 1; fi # test whether config.h was created using the MSVC compiler if [[ -f ./config.h && -f ./Makefile && -z `grep "CC = cl" ./Makefile` ]]; then echo "config.h created with wrong CC; deleting ..." make maintainer-clean fi # --- Clear working directory ----------------------------------------------- if [[ "${clean}" ]]; then make -f scripts/win32/Makefile.win32 clean; echo "working space cleared"; exit 0; fi # --- Prepare UNU.RAN ------------------------------------------------------- # create 'config.h' and Makefiles using autotools if [[ !( -f ./configure ) ]]; then autoreconf -i ./configure ${UNURAN_CONFIGURE_FLAGS} fi if [[ !( -f ./config.h && -f ./Makefile) ]]; then ./configure ${UNURAN_CONFIGURE_FLAGS} fi # create directory for windows files test -d "${WINDIST_DIR}" && rm -rf "${WINDIST_DIR}" mkdir "${WINDIST_DIR}" # create all required UNU.RAN header files (cd src/parser; make stringparser_lists.ch) (cd src; make unuran.h; cp -v unuran.h ../${WINDIST_DIR}) (cd src/uniform; make unuran_urng_rngstreams.h) # Do we use Rngstreams library? if [[ -n "${USE_RNGSTREAM}" ]]; then cp -v ../rngstreams/src/RngStream.[ch] ./src/uniform cp -v ../rngstreams/src/RngStream.h ${WINDIST_DIR} cp -v ./src/uniform/unuran_urng_rngstreams.h ${WINDIST_DIR} cp -v ./scripts/win32/example*.c ${WINDIST_DIR} else rm -vf cp ./src/uniform/RngStream.* fi # create doc if [[ "${doc}" ]]; then (cd doc; make pdf; cp -v *.pdf ../${WINDIST_DIR}); fi # --- Create DLL ------------------------------------------------------------ make -f scripts/win32/Makefile.win32 # --- Compile, link and run all examples and test files if [[ "${examples}" ]]; then make -f scripts/win32/Makefile.win32 examples; fi if [[ ${check} ]]; then make -f scripts/win32/Makefile.win32 check; fi # --- Create ZIP file ------------------------------------------------------- if [[ ${zip} ]]; then make -f scripts/win32/Makefile.win32 zip; fi # --- Done ------------------------------------------------------------------ exit 0 unuran-1.11.0/scripts/win32/make_dll_def.pl0000754001357500135600000001710514420445767015434 00000000000000#!/usr/bin/perl ############################################################################## # # # UNURAN -- Universal Non-Uniform Random number generator # # # ############################################################################## # # # FILE: makedll_def.pl # # # # Read all UNU.RAN header files and create .def file for .dll # # # ############################################################################## # # # Copyright (c) 2000-2007 Wolfgang Hoermann and Josef Leydold # # Department of Statistics and Mathematics, WU Wien, Austria # # # # This program is free software; you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # # the Free Software Foundation; either version 2 of the License, or # # (at your option) any later version. # # # # This program is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with this program; if not, write to the # # Free Software Foundation, Inc., # # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA # # # ############################################################################## use strict; use Getopt::Std; my $DEBUG = 0; ############################################################ # constants my $DEP_file = ".dep-unuran_def"; ############################################################ sub usage { my $progname = $0; $progname =~ s#^.*/##g; print STDERR <] [-L ] [-I] [ ... ] Scans and inserts all header files found in subtree rooted at current working directory. Other header files and those with names containing "config" are ignored. The function declaration and global variables are extracted and .def file is created. Option '-V' can be used to set a library version number using the format 'major.minor'. Option '-L' can be used to set a library name. Use option '-I' when also (some) internal functions should be exported. The output is written on stdout. EOM exit -1; } ############################################################ # dependencies my $DEP = "unuran.def: "; ############################################################ use FileHandle; ############################################################ # global variables # default name of library my $Library = "unuran"; # DATA section (to be set manually!!) my $DATA = ""; # "\tunur_errno\tDATA\n"; # "\tINFINITY\tDATA\n"; # EXPORTS section (functions; set automatically) my $EXPORTS; my @EXPORTS; ############################################################ # read options my %opts; getopts('V:L:I', \%opts) or usage(); my $Version = $opts{'V'}; $Library = $opts{'L'} if $opts{'L'}; my $INTERNAL = $opts{'I'}; # read master file name from argument list ... my @master_files; while ($_ = shift) { push @master_files, $_; } (usage and die) unless @master_files; # header files in sub tree (except those containing "config") ... # (files are stored in an associate array with key=filename and # value=complete path of file.) my %header_files; # included header files ... my %header_included; # search subtree for header files ... open (FILES, "find . |"); while () { chomp; next unless /^.*\/+(.*\.h)$/; next if /config/; $header_files{$1} = $_; # store file and path of file } close FILES; # scan master file(s) ... foreach my $m (@master_files) { scan_file ($m); } # write file print "LIBRARY $Library\n"; print "VERSION $Version\n" if $Version; print "EXPORTS\n"; print $DATA; foreach my $e (sort @EXPORTS) { $EXPORTS .= "\t$e\n"; } print $EXPORTS; # write dependencies #open DEP, ">$DEP_file" or die "Cannot open file for writing: $DEP_file"; #print DEP "$DEP\n"; #close DEP; exit 0; ############################################################ # scan given file ... sub scan_file { my $file = $_[0]; my $handle = new FileHandle; ## print STDERR "$file\n" if $DEBUG; # open file ... open $handle, $file or die "cannot find file $file\n"; # read file ... my $content = ''; while (<$handle>) { $content .= $_; } close $handle; # remove all comments and empty lines ... $content =~ s {/\*.*?\*/} []gsx; $content =~ s /\n\s*\n/\n/gsx; # split into lines ... my @lines = split /\n/, $content; my $line; foreach my $l (@lines) { chomp($l); if ($line =~ /^.*\\\s*$/) { $line =~ s/\\\s*$//; $line .= $l; next; } $line = $l; unless ($line =~ /^\#include\s+[<\"](.*)[>\"]/) { # remove all blank lines next if $line !~ /\w/; # remove all (other) preprocessor directives next if $line =~ /^\s*\#/; # find all non-functions next if $line !~ /\(.+/; next if $line =~ /^\s*typedef\s+/; # internal functions unless ($INTERNAL) { next if $line =~ /[\s\*]_unur/; } else { # remove internal debugging routines next if $line =~ /[\s\*]_unur_error_cookies/; next if $line =~ /[\s\*]_unur_distr_\w+_debug/; } # line with isolated attribute statement next if $line =~ /^\s*ATTRIBUTE__/; # remove special symbols next if $line =~ /_unur_is(zero|one|fsame)/; # exported functions $line =~ /.*?[\s\*]+(\w+)\s*\(/; push @EXPORTS, $1; next; } # have found a file to be included ... my @tmp = split /\//, $1; my $include_file = pop @tmp; print STDERR "$include_file " if $DEBUG; # we do not include header files out of the subtree ... unless (defined( $header_files{$include_file} ) ) { print STDERR "file not found in subtree ... skip\n" if $DEBUG; next; } # we do not include header files for deprecated calls if ( $include_file =~ /deprecated/ ) { print STDERR "deprecated ... skip\n" if $DEBUG; next; } # we include header files only once ... if (defined( $header_included{$include_file} ) ) { print STDERR "already included ... skip\n" if $DEBUG; next; } $header_included{$include_file} .= 1; # have found header file ... print STDERR "to be inserted\n" if $DEBUG; # add dependency $DEP .= "$header_files{$include_file} "; # scan header file ... scan_file ($header_files{$include_file}); } } ############################################################ ############################################################ unuran-1.11.0/scripts/win32/example1.c0000644001357500135600000000667414420445767014400 00000000000000/* ------------------------------------------------------------- */ /* File: example1.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header files. */ #include #include /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; int k; /* will hold the random number */ /* Declare UNU.RAN objects. */ UNUR_GEN *gen1, *gen2, *gen3; /* generator objects */ /* Declare objects for uniform random number generators. */ UNUR_URNG *urng2; /* uniform RN generator object */ /* -- Optional: Set seed for RNGSTREAMS library -------------- */ /* The RNGSTREAMS library sets a package seed. */ unsigned long seed[] = {111u, 222u, 333u, 444u, 555u, 666u}; RngStream_SetPackageSeed(seed); /* -- Example 1 ---------------------------------------------- */ /* Beta distribution with shape parameters 2 and 3. */ /* Use method 'AUTO' (AUTOmatic). */ /* Create generator object. */ gen1 = unur_str2gen("beta(2,3)"); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen1' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen1 == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* Now you can use the generator object `gen1' to sample from */ /* the target distribution. Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen1); printf("%f\n",x); } /* -- Example 2 ---------------------------------------------- */ /* Student's t distribution with 3 degrees of freedom. */ /* Use method 'TDR' (Transformed Density Rejection) with */ /* "immediate acception" */ gen2 = unur_str2gen("student(3) & method=TDR; variant_ia"); if (gen2 == NULL) exit (EXIT_FAILURE); /* However, this time we use a (new) independent stream of */ /* uniformrandom numbers. */ urng2 = unur_urng_rngstream_new("urng2"); unur_chg_urng( gen2, urng2 ); /* Draw a sample. */ for (i=0; i<10; i++) { x = unur_sample_cont(gen2); printf("%f\n",x); } /* -- Example 3 ---------------------------------------------- */ /* Discrete distribution with given probability vector. */ /* Use method 'DGT' (Discrete Guide Table method). */ gen3 = unur_str2gen("discr; pv=(0.5,1.5,1.0,0.3) & method=DGT"); if (gen3 == NULL) exit (EXIT_FAILURE); /* we use the default URNG again. So there is nothing to do. */ /* Draw a sample. Notice that we get integers! */ for (i=0; i<10; i++) { k = unur_sample_discr(gen3); printf("%d\n",k); } /* -- Call destructor ---------------------------------------- */ /* When generators are not needed any they can be destroyed. */ unur_free(gen1); unur_free(gen2); unur_urng_free(urng2); unur_free(gen3); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/scripts/win32/Makefile.win320000644001357500135600000001260014420445767015103 00000000000000 # --- Compiler and linker options ------------------------------------------- # VC Compiler flags CFLAGS = -O1 -W3 -nologo -D_CRT_SECURE_NO_DEPRECATE -MD \ -DHAVE_CONFIG_H -I./ -I./src/ -I./src/tests CTESTFLAGS = -O2 -W3 -nologo -MD -I./ -I./src/ -I./src/tests # VC Linker flags LINKFLAGS = -nologo -incremental:no -machine:IX86 # --- Definitions ----------------------------------------------------------- # Where to find source files TOP_SRCDIR := . SCRIPTS_DIR=$(TOP_SRCDIR)/scripts TESTS_DIR=$(TOP_SRCDIR)/tests # Files for RngStreams libary RNGSTREAM_SRC := $(TOP_SRCDIR)/src/uniform/RngStream.c RNGSTREAM_H := $(TOP_SRCDIR)/src/uniform/RngStream.h UNURAN_RNGSTREAM_H := $(TOP_SRCDIR)/src/uniform/unuran_urng_rngstreams.h URNG_RNGSTREAM_H := $(TOP_SRCDIR)/src/uniform/urng_rngstreams.h RNGSTREAM_CFLAGS := $(shell test -z ${USE_RNGSTREAM} \ || echo "-I./src/uniform -DUNURAN_HAS_RNGSTREAM -DUNURAN_SUPPORTS_RNGSTREAM -DUNUR_URNG_DEFAULT_RNGSTREAM" ) # UNU.RAN version: major.minor UNURAN_VERSION=$(shell \ grep PACKAGE_VERSION $(TOP_SRCDIR)/config.h | \ sed -e 's/.*_VERSION\s*\"\(.*\)\..*\"/\1/') # UNU.RAN library name UNURAN_LIBNAME=libunuran$(shell echo $(UNURAN_VERSION) | sed 's/\.//') # libUNURAN UNURAN_SRC := $(wildcard $(TOP_SRCDIR)/src/*/*.c) UNURAN_OBJ := $(UNURAN_SRC:.c=.obj) UNURAN_H := $(TOP_SRCDIR)/src/unuran.h.in \ $(TOP_SRCDIR)/src/tests/unuran_tests.h UNURAN_SOURCE_H := $(wildcard $(TOP_SRCDIR)/src/*/*_source.h) # DLL files UNURAN_DEF=$(WINDIST_DIR)/$(UNURAN_LIBNAME).def UNURAN_LIB=$(WINDIST_DIR)/$(UNURAN_LIBNAME).lib UNURAN_DLL=$(WINDIST_DIR)/$(UNURAN_LIBNAME).dll # Header files for creating .DEF file DEF_H := $(UNURAN_H) \ $(shell test -z ${USE_PRIVATE} || echo "$(UNURAN_SOURCE_H)") \ $(shell test -z ${USE_RNGSTREAM} || echo "$(UNURAN_RNGSTREAM_H)" ) INT=$(shell test -z ${USE_PRIVATE} || echo "-I") # Examples EXAMPLES_SRC := $(wildcard $(TOP_SRCDIR)/examples/*.c) \ $(wildcard $(WINDIST_DIR)/example*.c) EXAMPLES_OBJ := $(EXAMPLES_SRC:.c=.obj) EXAMPLES_EXE := $(EXAMPLES_SRC:.c=.exe) # Test suite UNURANTEST_SRC := $(wildcard $(TESTS_DIR)/testdistributions/*.c) \ $(TESTS_DIR)/testroutines.c $(TESTS_DIR)/testcounter.c UNURANTEST_OBJ := $(UNURANTEST_SRC:.c=.obj) TESTS_CONF := $(filter-out $(TESTS_DIR)/README.conf \ $(TESTS_DIR)/t_deprecated%, \ $(wildcard $(TESTS_DIR)/*.conf)) TESTS_SRC := $(TESTS_CONF:.conf=.c) TESTS_OBJ := $(TESTS_SRC:.c=.obj) TESTS_EXE := $(TESTS_SRC:.c=.exe) # Some special files: # header file with constants for floating point arithmetic FPCONST_H = $(TOP_SRCDIR)/src/utils/unur_fp_const_source.h # --- Make DLL -------------------------------------------------------------- all: $(UNURAN_DLL) # Create DLL $(UNURAN_DLL): $(FPCONST_H) $(UNURAN_OBJ) $(UNURAN_DEF) link $(LINKFLAGS) -DLL -out:$(UNURAN_DLL) \ $(UNURAN_OBJ) -def:$(UNURAN_DEF) $(UNURAN_DEF): $(DEF_H) $(UNURAN_RNGSTREAM_H) $(SCRIPTS_DIR)/win32/make_dll_def.pl -V $(UNURAN_VERSION) $(INT) \ -L $(UNURAN_LIBNAME) $(DEF_H) > $(UNURAN_DEF) %.obj: %.c $(CC) $(CFLAGS) $(RNGSTREAM_CFLAGS) -Fo$@ -c $< $(UNURAN_RNGSTREAM_H): $(URNG_RNGSTREAM_H) $(SCRIPTS_DIR)/make_urng_header.pl \ $(URNG_RNGSTREAM_H) > $(UNURAN_RNGSTREAM_H) $(FPCONST_H): $(SCRIPTS_DIR)/compute_machine_constants.exe $(SCRIPTS_DIR)/compute_machine_constants.exe > $(FPCONST_H) $(SCRIPTS_DIR)/compute_machine_constants.exe: $(SCRIPTS_DIR)/compute_machine_constants.obj $(LD) -nologo -Fe$(SCRIPTS_DIR)/compute_machine_constants.exe \ $(SCRIPTS_DIR)/compute_machine_constants.obj # --- Run tests ------------------------------------------------------------- # Compile, link and run examples examples: $(EXAMPLES_EXE) for f in $(EXAMPLES_EXE); do \ echo "running $$f ..."; \ eval $$f; \ done $(EXAMPLES_EXE): $(EXAMPLES_OBJ) $(LD) -nologo -O2 -W3 -Fe$@ $(@:.exe=.obj) $(UNURAN_LIB) $(EXAMPLES_OBJ): $(EXAMPLES_SRC) $(CC) $(CFLAGS) $(RNGSTREAM_CFLAGS) -Fo$@ -c $(@:.obj=.c) # Run test suite check: $(UNURANTEST_OBJ) $(TESTS_EXE) @for f in $(TESTS_EXE); do \ echo "running $$f ..."; \ eval $$f; \ done $(TESTS_SRC): $(TESTS_CONF) $(TESTS_DIR)/make_test_files.pl $(TOP_SRCDIR) $(@:.c=.conf) > $@ $(TESTS_EXE): $(TESTS_OBJ) $(UNURANTEST_OBJ) $(LD) -nologo -Fe$@ $(@:.exe=.obj) $(UNURANTEST_OBJ) $(UNURAN_LIB) $(TESTS_OBJ): $(TESTS_SRC) $(CC) $(CFLAGS) $(RNGSTREAM_CFLAGS) -Fo$@ -c $(@:.obj=.c) # --- Create ZIP file ------------------------------------------------------ ZIPFILE := unuran-$(shell \ grep PACKAGE_VERSION $(TOP_SRCDIR)/config.h | \ sed -e 's/.*_VERSION\s*\"\(.*\)\"/\1/')-win32.zip UNURANWIN_DIR := unuran zip: @echo "Create ZIP file '$(ZIPFILE)' ..." test ! -d $(UNURANWIN_DIR) || rm -rf $(UNURANWIN_DIR) test ! -f $(ZIPFILE) || rm -f $(ZIPFILE) test -d $(WINDIST_DIR) && \ mv $(WINDIST_DIR) $(UNURANWIN_DIR) && \ zip -r $(ZIPFILE) $(UNURANWIN_DIR) && \ rm -rf $(UNURANWIN_DIR) # --- Clear working space -------------------------------------------------- # Remove created files clean: rm -rf $(WINDIST_DIR) rm -rf $(UNURANWIN_DIR) rm -f $(ZIPFILE) rm -f $(UNURAN_OBJ) rm -f $(SCRIPTS_DIR)/compute_machine_constants.exe rm -f $(SCRIPTS_DIR)/compute_machine_constants.obj rm -f $(EXAMPLES_OBJ) $(EXAMPLES_EXE) rm -f $(TESTS_SRC) $(TESTS_OBJ) $(TESTS_EXE) rm -f $(UNURANTEST_OBJ) rm -f $(RNGSTREAM_SRC) $(RNGSTREAM_H) rm -f t_*.log unuran.log rm -f `find . -type f -name "*.manifest"` .PHONY: check clean examples unuran-1.11.0/scripts/win32/example2.c0000644001357500135600000001163614420445767014373 00000000000000/* ------------------------------------------------------------- */ /* File: example2.c */ /* ------------------------------------------------------------- */ /* Include UNURAN header files. */ #include #include /* ------------------------------------------------------------- */ int main(void) { int i; /* loop variable */ double x; int k; /* will hold the random number */ /* Declare UNU.RAN objects. */ UNUR_DISTR *distr; /* distribution object */ UNUR_PAR *par; /* parameter object */ UNUR_GEN *gen1, *gen2, *gen3; /* generator objects */ /* Declare objects for uniform random number generators. */ UNUR_URNG *urng2; /* uniform RN generator object */ /* -- Optional: Set seed for RNGSTREAMS library -------------- */ /* The RNGSTREAMS library sets a package seed. */ unsigned long seed[] = {111u, 222u, 333u, 444u, 555u, 666u}; RngStream_SetPackageSeed(seed); /* -- Example 1 ---------------------------------------------- */ /* Beta distribution with shape parameters 2 and 3. */ /* Use method 'AUTO' (AUTOmatic). */ /* Create distribution object. */ { double fparams[] = {2., 3.}; distr = unur_distr_beta( fparams, 2 ); } /* Choose a method: 'AUTO'. */ par = unur_auto_new(distr); /* Create the generator object. */ gen1 = unur_init(par); /* It is important to check if the creation of the generator */ /* object was successful. Otherwise `gen1' is the NULL pointer */ /* and would cause a segmentation fault if used for sampling. */ if (gen1 == NULL) { fprintf(stderr, "ERROR: cannot create generator object\n"); exit (EXIT_FAILURE); } /* It is possible to reuse the distribution object to create */ /* another generator object. If you do not need it any more, */ /* it should be destroyed to free memory. */ unur_distr_free(distr); /* Now you can use the generator object `gen1' to sample from */ /* the target distribution. Eg.: */ for (i=0; i<10; i++) { x = unur_sample_cont(gen1); printf("%f\n",x); } /* -- Example 2 ---------------------------------------------- */ /* Student's t distribution with 3 degrees of freedom. */ /* Use method 'TDR' (Transformed Density Rejection) with */ /* "immediate acception" */ /* Create distribution object. */ { double fparams[] = {3.}; distr = unur_distr_student( fparams, 1 ); } /* Choose a method: 'TDR'. */ par = unur_tdr_new(distr); /* ... and change to immediate acceptance. */ unur_tdr_set_variant_ia(par); /* However, this time we use a (new) independent stream of */ /* uniformrandom numbers. */ urng2 = unur_urng_rngstream_new("urng2"); unur_set_urng( par, urng2 ); /* Create the generator object. */ gen2 = unur_init(par); if (gen2 == NULL) exit (EXIT_FAILURE); /* Destroy distribution object. (We do not need it any more.) */ unur_distr_free(distr); /* Draw a sample. */ for (i=0; i<10; i++) { x = unur_sample_cont(gen2); printf("%f\n",x); } /* -- Example 3 ---------------------------------------------- */ /* Discrete distribution with given probability vector. */ /* Use method 'DGT' (Discrete Guide Table method). */ /* Create distribution object. */ { double probs[] = {0.5, 1.5, 1.0, 0.3}; distr = unur_distr_discr_new(); unur_distr_discr_set_pv(distr, probs, 4); } /* Choose a method: 'DGT'. */ par = unur_dgt_new(distr); /* we use the default URNG again. So there is nothing to do. */ /* Create the generator object. */ gen3 = unur_init(par); if (gen3 == NULL) exit (EXIT_FAILURE); /* Destroy distribution object. (We do not need it any more.) */ unur_distr_free(distr); /* Draw a sample. Notice that we get integers! */ for (i=0; i<10; i++) { k = unur_sample_discr(gen3); printf("%d\n",k); } /* -- Call destructor ---------------------------------------- */ /* When generators are not needed any they can be destroyed. */ unur_free(gen1); unur_free(gen2); unur_urng_free(urng2); unur_free(gen3); exit (EXIT_SUCCESS); } /* end of main() */ /* ------------------------------------------------------------- */ unuran-1.11.0/scripts/run_valgrind.sh0000754001357500135600000000147314420445767014576 00000000000000#!/bin/bash # check arguments test -z $1 && echo "Argument missing" && exit 1 test -f suppressions-valgrind && SUPPRESS="--suppressions=suppressions-valgrind" VALGRINDOPTIONS="-v --tool=memcheck --leak-check=full --leak-resolution=high --num-callers=40 --show-reachable=yes --track-fds=yes $SUPPRESS" ##VALGRINDOPTIONS="-v --stats=yes --tool=memcheck --leak-check=full --leak-resolution=high --num-callers=40 --show-reachable=yes --track-fds=yes $SUPPRESS" PROG=`echo $1 | sed -e "s#\./##"` LOGFILENAME="valgrind-${PROG}" echo "run valgrind on ${PROG} ..." valgrind --log-file=${LOGFILENAME} ${VALGRINDOPTIONS} ./${PROG} echo ""; echo "Summary:"; echo "" grep ERROR ${LOGFILENAME}* grep lost ${LOGFILENAME}* grep "All heap blocks were freed" ${LOGFILENAME}* echo ""; echo "========================="; echo "" exit 0 unuran-1.11.0/scripts/compute_machine_constants.c0000644001357500135600000001323014420304141017114 00000000000000/***************************************************************************** * * * unuran -- Universal Non-Uniform Random number generator * * * ***************************************************************************** * * * FILE: compute_machine_constants.c * * * * Compute some machine constants and print to stdout * * * ***************************************************************************** * * * Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold * * Department of Statistics and Mathematics, WU Wien, Austria * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * * *****************************************************************************/ /*---------------------------------------------------------------------------*/ #include #include #include #include /*---------------------------------------------------------------------------*/ /** TODO: #define MAXLGM 2.556348e305 **/ /*---------------------------------------------------------------------------*/ int main(void) { printf("/** File automatically created by scripts/compute_machine_constants **/\n\n"); printf("/*****************************************************************************\n"); printf(" * *\n"); printf(" * unuran -- Universal Non-Uniform Random number generator *\n"); printf(" * *\n"); printf(" *****************************************************************************/\n"); printf("\n"); printf("/*---------------------------------------------------------------------------*/\n"); printf("#ifndef UNUR_FP_CONST_SOURCE_H_SEEN\n"); printf("#define UNUR_FP_CONST_SOURCE_H_SEEN\n"); printf("/*---------------------------------------------------------------------------*/\n\n"); /* Epsilon for comparision of two doubles: */ /* Two doubles are considered equal if there relative difference is */ /* less than UNUR_EPSILON (see file `./methods/source_fp.h' for details). */ /* Use 100 times DBL_EPSILON. */ printf("/* maximal relative error when testing equality of two doubles */\n"); printf("#define UNUR_EPSILON %.30g\n\n", 100.*DBL_EPSILON); /* Square root of machine epsilon. It is used to compare two doubles */ /* when round-off errors have to be considered */ /* (see file `./methods/source_fp.h' for details). */ printf("/* square root of DBL_EPSILON */\n"); printf("#define UNUR_SQRT_DBL_EPSILON %.30g\n\n", sqrt(DBL_EPSILON)); /* Log of machine epsilon. */ /* Negative of least number x such that exp(x)-1. == exp(x) */ printf("/* log of DBL_EPSILON */\n"); printf("#define UNUR_LOG_DBL_EPSILON %.30g\n\n", log(DBL_EPSILON)); /* Constants used by CEPHES functions */ printf("/* the machine roundoff error */\n"); printf("#define MACHEP %.30g\n\n", DBL_EPSILON/2.); printf("/* largest argument for exp() */\n"); printf("#define MAXLOG %.30g\n\n", log(DBL_MAX)); printf("/* smallest argument for exp() without underflow */\n"); printf("#define MINLOG %.30g\n\n", log(DBL_MIN)); printf("/* the maximal number that pow(x,x-0.5) has no overflow */\n"); printf("/* we use a (very) conservative portable bound */\n"); printf("#define MAXSTIR %.30g\n\n", log(DBL_MAX) / log(log(DBL_MAX)) ); printf("/*---------------------------------------------------------------------------*/\n"); printf("#endif /* UNUR_FP_CONST_SOURCE_H_SEEN */\n"); printf("/*---------------------------------------------------------------------------*/\n"); exit (0); } /*---------------------------------------------------------------------------*/ unuran-1.11.0/scripts/read_PDF.pl0000644001357500135600000004006114420445767013503 00000000000000############################################################################## # # # UNURAN -- Universal Non-Uniform Random number generator # # # ############################################################################## # # # FILE: read_PDF.pl # # # # Subroutine read_PDFdata(): # # # # Read all UNU.RAN C files and extract information about PDFs of # # distributions. The result is stored in an associate array and returned. # # # ############################################################################## # # # Copyright (c) 2000-2006 Wolfgang Hoermann and Josef Leydold # # Department of Statistics and Mathematics, WU Wien, Austria # # # # This program is free software; you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # # the Free Software Foundation; either version 2 of the License, or # # (at your option) any later version. # # # # This program is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with this program; if not, write to the # # Free Software Foundation, Inc., # # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA # # # ############################################################################## use strict; use File::Find; # ---------------------------------------------------------------- # Global constants # Header file for UNU.RAN standard distributions my $h_stddistr = "unur_distributions.h"; # List of distribution types my %distr_types = ( "CONT" => { "file_prefix" => "c", "PDF_prefix" => "_unur_pdf_", "PDF_type" => "double" }, "CVEC" => { "file_prefix" => "vc", "PDF_prefix" => "-none-", "PDF_type" => "-none-" }, "DISCR" => { "file_prefix" => "d", "PDF_prefix" => "_unur_pmf_", "PDF_type" => "double" }, "MATR" => { "file_prefix" => "m", "PDF_prefix" => "-none-", "PDF_type" => "-none-" } ); # ................................................................ # List of files my %file_list; # ................................................................ # List of distributions my $DISTR; # Description of data fields (with beta distribution as example) # # $DISTR->{"beta"} ... entries for distribution "beta" # # $DISTR->{"beta"}->{"=NAME"} ... name of distribution # $DISTR->{"beta"}->{"=TYPE"} ... type of distribution (CONT|DISCR) # $DISTR->{"beta"}->{"=FILE"} ... file name + path for C file # $DISTR->{"beta"}->{"=ID"} ... id of distribution # # $DISTR->{"beta"}->{"=DOC"} ... documentation for distribution # $DISTR->{"beta"}->{"=DOC"}->{"=PDF"} ... formula for PDF # $DISTR->{"beta"}->{"=DOC"}->{"=CONST"} ... normalization constant for PDF # $DISTR->{"beta"}->{"=DOC"}->{"=CDF"} ... formula for CDF # $DISTR->{"beta"}->{"=DOC"}->{"=DOMAIN"} ... domain for PDF # $DISTR->{"beta"}->{"=DOC"}->{"=FPARAM"} ... list of parameters with constraints # Remark: There exist other fields which are not relevant here # (see src/distributions/unur_distributions.h). # # $DISTR->{"beta"}->{"=PDF"} ... PDF of distribution # $DISTR->{"beta"}->{"=PDF"}->{"=NAME"} ... name of PDF # $DISTR->{"beta"}->{"=PDF"}->{"=RTYPE"} ... return type of PDF # $DISTR->{"beta"}->{"=PDF"}->{"=ARGS"} ... list of arguments for PDF # $DISTR->{"beta"}->{"=PDF"}->{"=N_PARAMS"} ... number of parameters for PDF # $DISTR->{"beta"}->{"=PDF"}->{"=PARAMS"}[2] ... parameter #2 for PDF (starting at 0) # $DISTR->{"beta"}->{"=PDF"}->{"=BODY"} ... function body of PDF # $DISTR->{"beta"}->{"=PDF"}->{"=CONST"} ... macro expansion for (LOG)NORMCONSTANT # $DISTR->{"beta"}->{"=PDF"}->{"=DISTR"} ... macro expansion for DISTR # # ---------------------------------------------------------------- # Read data for PDF from source code sub read_PDFdata { # Start the search for the files in these directories my @Startdirs = @_; # ................................................................ # List of files find (\&find_files, @Startdirs); # ................................................................ # Scan header file for UNU.RAN standard distributions # and get a list of valid distributions scan_stddistr( $file_list{$h_stddistr} ); # ................................................................ # End. Return result return $DISTR; } # end of read_PDFdata() # ---------------------------------------------------------------- # # Subroutines # # ---------------------------------------------------------------- # ---------------------------------------------------------------- # Finds recursively all C- or H-files containing the relevant # informations. sub find_files { if ($File::Find::name =~ /(.*\/)?(.+\.[ch])$/ ) { my $file_path = $File::Find::name; my $file_name = $2; $file_list{$file_name} = $file_path; } } # end of find_files() # ---------------------------------------------------------------- # Scan header file for UNU.RAN standard distributions sub scan_stddistr { # header file for standard distributions my $file = shift; # Read header file open HFILE, $file or die "cannot open file \"$file\".\n"; my $file_content; while () { chomp; $_ =~ s/^\s*(.*)\s*$/$1/; $file_content .= "$_\n"; } close HFILE; # Split into sections my @sections = split /=EON/, $file_content; # Scan sections foreach my $s (@sections) { # Remove trailing part of sections (my $dummy, $s) = split /=DISTR/, $s, 2; next unless $s; # Get name of distribution $s =~ s/(\w+)\s+(.+)\n//; my $distr = $1; $DISTR->{$distr}->{"=NAME"} = $2; # Scan distribution section scan_distr($distr,$s); # Get type of distribution and path of distribution file get_distr_file($distr); # Read distribution file read_distr_file($distr); } } # end of scan_h_stddistr() # ---------------------------------------------------------------- # Scan distribution sub scan_distr { # distribution my $distr = $_[0]; # description of distribution my $distr_text = $_[1]; # add =END TAG to text (for convenience) $distr_text .= "\n=END"; # split into lines my @lines = split /\n/, $distr_text; # scan all TAGs (node sections) my $this_TAG = "=END"; # add =END tag to node TAG foreach my $l (@lines) { # next TAG ? if ($l =~ /^\s*(\/\*)?\s*(=[A-Z]+)\s*(.*)$/) { # store next TAG $this_TAG = $2; # save rest of line $l = $3; } # append to stored lines # (except for =END TAG) unless ($this_TAG eq "=END") { $DISTR->{$distr}->{"=DOC"}->{$this_TAG} .= $l."\n"; } } } # end of scan_distr() # ---------------------------------------------------------------- # Get type of distribution and path of distribution file sub get_distr_file { # distribution my $distr = $_[0]; my $found = 0; foreach my $type (keys %distr_types) { next unless $type; my $file_name = $distr_types{$type}{"file_prefix"}."\_$distr\.c"; if ($file_list{$file_name}) { $found = 1; $DISTR->{$distr}->{"=FILE"} = $file_list{$file_name}; $DISTR->{$distr}->{"=TYPE"} = $type; last; } } die "Cannot find file for $distr" unless $found; } # end of get_distr_file() # ---------------------------------------------------------------- # Read distribution file sub read_distr_file { # distribution my $distr = $_[0]; # Read file my $file = $DISTR->{$distr}->{"=FILE"}; open CFILE, $file or die "cannot open file $file\n"; my $file_content; while () { $file_content .= $_; } close CFILE; # Check distribution name $file_content =~ /static\s+const\s+char\s+distr\_name\s*\[\s*\]\s*=\s*\"$distr\"/ or die "$distr: distr_name inconsistent"; # Type of distribution my $type = $DISTR->{$distr}->{"=TYPE"}; # Get PDF source my $PDF_name; unless ($distr_types{$type}{"PDF_prefix"} eq "-none-") { $PDF_name = $distr_types{$type}{"PDF_prefix"}.$distr; my $PDF_pattern = "(int|double)\\s+" # $1: return type .$PDF_name # name of function ."\\s*\\(([^\\)]*)\\)\\s*" # $2: arguments of function ."([^;])" # $3: first character (to distinguish from prototype) ."(.*)" # $4: function body ."\\/\\*\\s+end\\s+of\\s+$PDF_name"; # end of function marker $file_content =~ /$PDF_pattern/s or die "cannot find PDF for $distr"; # Store data $DISTR->{$distr}->{"=PDF"}->{"=NAME"} = $PDF_name; # name of PDF function $DISTR->{$distr}->{"=PDF"}->{"=RTYPE"} = $1; # return type $DISTR->{$distr}->{"=PDF"}->{"=ARGS"} = $2; # arguments for function $DISTR->{$distr}->{"=PDF"}->{"=BODY"} = polish_C_code($3.$4); # function body } else { $PDF_name = ""; $DISTR->{$distr}->{"=PDF"}->{"=NAME"} = ""; $DISTR->{$distr}->{"=PDF"}->{"=RTYPE"} = ""; $DISTR->{$distr}->{"=PDF"}->{"=ARGS"} = ""; $DISTR->{$distr}->{"=PDF"}->{"=BODY"} = ""; } # Modify function arguments: # remove DISTR from argument list $DISTR->{$distr}->{"=PDF"}->{"=ARGS"} =~ s /\,\s*(UNUR_DISTR|struct unur_distr)\s*\*\s*distr\s*//; # Get parameters for PDF $file_content =~ s {/\*.*?\*/} []gsx; # remove all comments my @lines = split /\n/, $file_content; my $n_params = -1; foreach my $l (@lines) { next unless $l =~ /\#define\s+(\w+)\s+(.*)$/; my $macro_name = $1; my $macro_body = $2; if ($macro_body =~ /params\s*\[(\d)+\]/) { $n_params = ($n_params < $1) ? $1 : $n_params; $DISTR->{$distr}->{"=PDF"}->{"=PARAMS"}[$1] = $macro_name; next; } if ($macro_name =~ /(.*NORMCONSTANT)/) { $DISTR->{$distr}->{"=PDF"}->{"=CONST"} = $macro_body; next; } if ($macro_name =~ /(DISTR)/) { $DISTR->{$distr}->{"=PDF"}->{"=DISTR"} = $macro_body; next; } } # Number of parameters for PDF $DISTR->{$distr}->{"=PDF"}->{"=N_PARAMS"} = $n_params+1; # Id of distribution $file_content =~ /distr\-\>id\s*=\s*(\w+)/ or die "cannot find ID for $distr"; $DISTR->{$distr}->{"=ID"} = $1; } # end of read_distr_file() # ---------------------------------------------------------------- # Polish C code of function body sub polish_C_code { my $code = $_[0]; # remove comments $code =~ s {/\*.*?\*/} []gsx; # remove enclosing brackets $code =~ s /^\s*\{(.*)\}\s*$/$1/s; # remove empty lines $code =~ s /\n\s*\n/\n/gx; $code =~ s /^\s*\n//; # remove declaration of "params" $code =~ s /.*(register)?\s+double\s*\*\s*params\W.*\n//; # remove all `DISTR.' from body $code =~ s /DISTR\.//g; # remove UNU.RAN-isms # expand _unur_iszero while ($code =~ "_unur_iszero") { $code = expand_unuris($code,"zero","==0.0"); } # expand _unur_isone while ($code =~ "_unur_isone") { $code = expand_unuris($code,"one","==1.0"); } # expand _unur_isfsame while ($code =~ "_unur_isfsame") { $code = expand_unurisfsame($code); } # expand INFINITY $code =~ s/(UNUR\_)?INFINITY/HUGE_VAL/g; return $code; } # end of polish_C_code() # ---------------------------------------------------------------- # Expand _unur_is... functions sub expand_unuris { my $code = $_[0]; my $what = "_unur_is".$_[1]; my $cmpstring = $_[2]; # split into part before UNU.RAN function name # and part after name my ($first,$second) = split /$what/, $code, 2; # split second part into argument of function call # and part after function call my ($arg,$remaining) = find_argument($second); # compile new string with UNU.RAN function call expanded (replaced) $code = $first."((".$arg.")".$cmpstring.")".$remaining; return $code; } # end of expand_unuris() # ................................................................ sub expand_unurisfsame { my $code = $_[0]; my $what = "_unur_isfsame"; # split into part before UNU.RAN function name # and part after name my ($first,$second) = split /$what/, $code, 2; # split second part into argument of function call # and part after function call my ($arg,$remaining) = find_argument($second); # split arguments my (@args) = split /\,/, $arg; die "Invalid number of arguments" unless $#args==1; # compile new string with UNU.RAN function call expanded (replaced) $code = $first."((".$args[0].")==(".$args[1]."))".$remaining; return $code; } # end of expand_unuris() # ---------------------------------------------------------------- # Find argument of function call (i.e. matching brackets) sub find_argument { my $code = $_[0]; # remove leading blanks and check for starting '(' $code =~ s/^\s+//; die unless $code =~ /\(/; # find closing bracket ')' my $open = 1; my $idx = 1; while ($open) { ++$open if substr($code, $idx, 1) eq "("; --$open if substr($code, $idx, 1) eq ")"; ++$idx; die "Cannot find closing bracket" if $idx > length($code); } my $arg = substr $code, 1, $idx-2; my $remaining = substr $code, $idx; return ($arg, $remaining); } # end of find_argument() # ---------------------------------------------------------------- # Print data on screen (for debugging) sub print_data { # List of distributions my $DISTR = $_[0]; foreach my $d (keys %{$DISTR}) { print "-------------------------------------\n"; print "distribution = \"$d\"\n"; print "NAME: ".$DISTR->{$d}->{"=NAME"}."\n"; print "TYPE: ".$DISTR->{$d}->{"=TYPE"}."\n"; print "ID : ".$DISTR->{$d}->{"=ID"}."\n"; print "FILE: ".$DISTR->{$d}->{"=FILE"}."\n\n"; print "DOC: PDF : ".$DISTR->{$d}->{"=DOC"}->{"=PDF"}; print "DOC: CONST : ".$DISTR->{$d}->{"=DOC"}->{"=CONST"}; print "DOC: CDF : ".$DISTR->{$d}->{"=DOC"}->{"=CDF"}; print "DOC: DOMAIN : ".$DISTR->{$d}->{"=DOC"}->{"=DOMAIN"}; print "DOC: FPARAM :\n".$DISTR->{$d}->{"=DOC"}->{"=FPARAM"}."\n"; print "PDF: NAME : ".$DISTR->{$d}->{"=PDF"}->{"=NAME"}."\n"; print "PDF: RTYPE : ".$DISTR->{$d}->{"=PDF"}->{"=RTYPE"}."\n"; print "PDF: ARGS : ".$DISTR->{$d}->{"=PDF"}->{"=ARGS"}."\n"; print "PDF: PARAM : ".$DISTR->{$d}->{"=PDF"}->{"=N_PARAMS"}."\n"; foreach my $i (0 .. $DISTR->{$d}->{"=PDF"}->{"=N_PARAMS"} - 1) { print "\t[$i]: ".$DISTR->{$d}->{"=PDF"}->{"=PARAMS"}[$i]."\n" } print "PDF: CONST : ".$DISTR->{$d}->{"=PDF"}->{"=CONST"}."\n"; print "PDF: DISTR : ".$DISTR->{$d}->{"=PDF"}->{"=DISTR"}."\n"; print "PDF: BODY :\n".$DISTR->{$d}->{"=PDF"}->{"=BODY"}."\n"; } } # end of print_data() # ---------------------------------------------------------------- # End of file return 1; # ----------------------------------------------------------------